From: Andrea Bianco Date: Thu, 23 Sep 2021 13:02:34 +0000 (+0200) Subject: Built motion from commit 746c7d2a.|2.5.35 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22my-avatar.png/%22?a=commitdiff_plain;h=8f3710d61ad4f188686c6bee34468724f64a2e30;p=motion2.git Built motion from commit 746c7d2a.|2.5.35 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 27a5480..0b5776e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-19T19:50:08.868Z", + "time": "2021-09-23T12:56:02.602Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d386851..24bcf9f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-19T19:50:08.868Z", + "time": "2021-09-23T12:56:02.602Z", "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 43844df..3a952f2 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 _0xb6a6=['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]','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x31b0de,_0x2d8988){var _0x4de47f=function(_0x176a3f){while(--_0x176a3f){_0x31b0de['push'](_0x31b0de['shift']());}};_0x4de47f(++_0x2d8988);}(_0xb6a6,0x1ed));var _0x6b6a=function(_0x4c1c56,_0x4a4b63){_0x4c1c56=_0x4c1c56-0x0;var _0x1e561a=_0xb6a6[_0x4c1c56];return _0x1e561a;};'use strict';var Sequelize=require('sequelize');module[_0x6b6a('0x0')]={'name':{'type':Sequelize[_0x6b6a('0x1')],'get':function(_0x176431){return this[_0x6b6a('0x2')]('action');}},'action':{'type':Sequelize[_0x6b6a('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6b6a('0x4'),_0x6b6a('0x5'),_0x6b6a('0x6'),'jscripty','urlForward',_0x6b6a('0x7'),_0x6b6a('0x8'),_0x6b6a('0x9')]],'msg':_0x6b6a('0xa')}},'comment':_0x6b6a('0xa')},'data1':{'type':Sequelize[_0x6b6a('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':_0x6b6a('0xb')},'data3':{'type':Sequelize[_0x6b6a('0x3')](0x1000),'comment':_0x6b6a('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x6b6a('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x6b6a('0xe')},'data6':{'type':Sequelize[_0x6b6a('0x3')],'comments':_0x6b6a('0xf')},'data7':{'type':Sequelize[_0x6b6a('0x10')],'comments':_0x6b6a('0x11')}}; \ No newline at end of file +var _0xd9dd=['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)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','motionbar','urlForward','bot','script'];(function(_0x47014f,_0x1e5544){var _0x5e24a5=function(_0x1e1581){while(--_0x1e1581){_0x47014f['push'](_0x47014f['shift']());}};_0x5e24a5(++_0x1e5544);}(_0xd9dd,0x1a6));var _0xdd9d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9dd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdd9d('0x0'));module[_0xdd9d('0x1')]={'name':{'type':Sequelize[_0xdd9d('0x2')],'get':function(_0x5bee62){return this[_0xdd9d('0x3')](_0xdd9d('0x4'));}},'action':{'type':Sequelize[_0xdd9d('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xdd9d('0x6'),'jscripty',_0xdd9d('0x7'),'browser',_0xdd9d('0x8'),_0xdd9d('0x9')]],'msg':_0xdd9d('0xa')}},'comment':_0xdd9d('0xa')},'data1':{'type':Sequelize[_0xdd9d('0x5')](0x1000),'comment':_0xdd9d('0xb')},'data2':{'type':Sequelize[_0xdd9d('0x5')](0x1000),'comment':_0xdd9d('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xdd9d('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xdd9d('0x5')](0x1000),'comments':_0xdd9d('0xe')},'data6':{'type':Sequelize[_0xdd9d('0x5')],'comments':_0xdd9d('0xf')},'data7':{'type':Sequelize[_0xdd9d('0x10')],'comments':_0xdd9d('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index bfb99b2..1b0ac27 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 _0x22c5=['Action','params','catch','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','body'];(function(_0x234b33,_0x24747c){var _0x3f3ab8=function(_0xe110d7){while(--_0xe110d7){_0x234b33['push'](_0x234b33['shift']());}};_0x3f3ab8(++_0x24747c);}(_0x22c5,0xe0));var _0x522c=function(_0x369c25,_0x2b1b6e){_0x369c25=_0x369c25-0x0;var _0x15b1bd=_0x22c5[_0x369c25];return _0x15b1bd;};'use strict';var emlformat=require(_0x522c('0x0'));var rimraf=require(_0x522c('0x1'));var zipdir=require(_0x522c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x522c('0x3'));var BPromise=require(_0x522c('0x4'));var Mustache=require(_0x522c('0x5'));var util=require('util');var path=require(_0x522c('0x6'));var sox=require(_0x522c('0x7'));var csv=require(_0x522c('0x8'));var ejs=require(_0x522c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x522c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x522c('0xb'));var toCsv=require(_0x522c('0x8'));var querystring=require('querystring');var Papa=require(_0x522c('0xc'));var Redis=require('ioredis');var authService=require(_0x522c('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x522c('0xe'))(_0x522c('0xf'));var utils=require(_0x522c('0x10'));var config=require(_0x522c('0x11'));var licenseUtil=require(_0x522c('0x12'));var db=require(_0x522c('0x13'))['db'];function respondWithStatusCode(_0x114a6c,_0x3712af){_0x3712af=_0x3712af||0xcc;return function(_0x59d647){if(_0x59d647){return _0x114a6c['sendStatus'](_0x3712af);}return _0x114a6c[_0x522c('0x14')](_0x3712af)['end']();};}function respondWithResult(_0x4c1c82,_0x23feb7){_0x23feb7=_0x23feb7||0xc8;return function(_0x248b03){if(_0x248b03){return _0x4c1c82[_0x522c('0x14')](_0x23feb7)['json'](_0x248b03);}};}function respondWithFilteredResult(_0x44dec5,_0x581969){return function(_0x548932){if(_0x548932){var _0x3ac163=typeof _0x581969[_0x522c('0x15')]===_0x522c('0x16')&&typeof _0x581969[_0x522c('0x17')]==='undefined';var _0x48abab=_0x548932[_0x522c('0x18')];var _0x3f3172=_0x3ac163?0x0:_0x581969['offset'];var _0x96df50=_0x3ac163?_0x548932['count']:_0x581969['offset']+_0x581969[_0x522c('0x17')];var _0x3edc5e;if(_0x96df50>=_0x48abab){_0x96df50=_0x48abab;_0x3edc5e=0xc8;}else{_0x3edc5e=0xce;}_0x44dec5[_0x522c('0x14')](_0x3edc5e);return _0x44dec5[_0x522c('0x19')](_0x522c('0x1a'),_0x3f3172+'-'+_0x96df50+'/'+_0x48abab)[_0x522c('0x1b')](_0x548932);}return null;};}function patchUpdates(_0x244d3b){return function(_0x4882e7){try{jsonpatch[_0x522c('0x1c')](_0x4882e7,_0x244d3b,!![]);}catch(_0x38134e){return BPromise[_0x522c('0x1d')](_0x38134e);}return _0x4882e7[_0x522c('0x1e')]();};}function saveUpdates(_0x1a0fb0,_0x2ec0a2){return function(_0x4e7984){if(_0x4e7984){return _0x4e7984[_0x522c('0x1f')](_0x1a0fb0)[_0x522c('0x20')](function(_0x2076fd){return _0x2076fd;});}return null;};}function removeEntity(_0x28d385,_0x3f2ea7){return function(_0x5c4b62){if(_0x5c4b62){return _0x5c4b62['destroy']()['then'](function(){_0x28d385[_0x522c('0x14')](0xcc)[_0x522c('0x21')]();});}};}function handleEntityNotFound(_0x1e33d2,_0x4956e6){return function(_0x14b179){if(!_0x14b179){_0x1e33d2[_0x522c('0x22')](0x194);}return _0x14b179;};}function handleError(_0x4b1051,_0x245711){_0x245711=_0x245711||0x1f4;return function(_0x58c776){logger[_0x522c('0x23')](_0x58c776[_0x522c('0x24')]);if(_0x58c776['name']){delete _0x58c776[_0x522c('0x25')];}_0x4b1051['status'](_0x245711)[_0x522c('0x26')](_0x58c776);};}exports[_0x522c('0x1f')]=function(_0x5f0980,_0x4e0127){if(_0x5f0980[_0x522c('0x27')]['id']){delete _0x5f0980[_0x522c('0x27')]['id'];}return db[_0x522c('0x28')]['find']({'where':{'id':_0x5f0980[_0x522c('0x29')]['id']}})[_0x522c('0x20')](handleEntityNotFound(_0x4e0127,null))[_0x522c('0x20')](saveUpdates(_0x5f0980[_0x522c('0x27')],null))[_0x522c('0x20')](respondWithResult(_0x4e0127,null))[_0x522c('0x2a')](handleError(_0x4e0127,null));};exports[_0x522c('0x2b')]=function(_0x97cea,_0x612262){return db[_0x522c('0x28')]['find']({'where':{'id':_0x97cea['params']['id']}})[_0x522c('0x20')](handleEntityNotFound(_0x612262,null))[_0x522c('0x20')](removeEntity(_0x612262,null))['catch'](handleError(_0x612262,null));}; \ No newline at end of file +var _0x788b=['then','destroy','error','stack','name','send','body','Action','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update'];(function(_0x44b533,_0x221c8d){var _0x42325b=function(_0x309350){while(--_0x309350){_0x44b533['push'](_0x44b533['shift']());}};_0x42325b(++_0x221c8d);}(_0x788b,0x1eb));var _0xb788=function(_0x5b2878,_0x3453fa){_0x5b2878=_0x5b2878-0x0;var _0x350952=_0x788b[_0x5b2878];return _0x350952;};'use strict';var emlformat=require(_0xb788('0x0'));var rimraf=require(_0xb788('0x1'));var zipdir=require(_0xb788('0x2'));var jsonpatch=require(_0xb788('0x3'));var rp=require(_0xb788('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb788('0x5'));var util=require(_0xb788('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb788('0x7'));var ejs=require(_0xb788('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb788('0x9'));var squel=require(_0xb788('0xa'));var crypto=require(_0xb788('0xb'));var jsforce=require(_0xb788('0xc'));var deskjs=require(_0xb788('0xd'));var toCsv=require(_0xb788('0x7'));var querystring=require(_0xb788('0xe'));var Papa=require('papaparse');var Redis=require(_0xb788('0xf'));var authService=require(_0xb788('0x10'));var qs=require(_0xb788('0x11'));var as=require(_0xb788('0x12'));var hardwareService=require(_0xb788('0x13'));var logger=require(_0xb788('0x14'))('api');var utils=require(_0xb788('0x15'));var config=require(_0xb788('0x16'));var licenseUtil=require(_0xb788('0x17'));var db=require(_0xb788('0x18'))['db'];function respondWithStatusCode(_0x56963f,_0x9e2286){_0x9e2286=_0x9e2286||0xcc;return function(_0x50f502){if(_0x50f502){return _0x56963f[_0xb788('0x19')](_0x9e2286);}return _0x56963f[_0xb788('0x1a')](_0x9e2286)[_0xb788('0x1b')]();};}function respondWithResult(_0x143530,_0x2db5a2){_0x2db5a2=_0x2db5a2||0xc8;return function(_0x5f000a){if(_0x5f000a){return _0x143530[_0xb788('0x1a')](_0x2db5a2)['json'](_0x5f000a);}};}function respondWithFilteredResult(_0x394e80,_0x43f43e){return function(_0x35f4a1){if(_0x35f4a1){var _0x4ff7c9=typeof _0x43f43e[_0xb788('0x1c')]===_0xb788('0x1d')&&typeof _0x43f43e[_0xb788('0x1e')]===_0xb788('0x1d');var _0x44ca89=_0x35f4a1[_0xb788('0x1f')];var _0x518889=_0x4ff7c9?0x0:_0x43f43e[_0xb788('0x1c')];var _0x3e3078=_0x4ff7c9?_0x35f4a1[_0xb788('0x1f')]:_0x43f43e[_0xb788('0x1c')]+_0x43f43e[_0xb788('0x1e')];var _0x5e23ee;if(_0x3e3078>=_0x44ca89){_0x3e3078=_0x44ca89;_0x5e23ee=0xc8;}else{_0x5e23ee=0xce;}_0x394e80[_0xb788('0x1a')](_0x5e23ee);return _0x394e80[_0xb788('0x20')](_0xb788('0x21'),_0x518889+'-'+_0x3e3078+'/'+_0x44ca89)[_0xb788('0x22')](_0x35f4a1);}return null;};}function patchUpdates(_0x4cf795){return function(_0x1e9820){try{jsonpatch['apply'](_0x1e9820,_0x4cf795,!![]);}catch(_0x1cbe44){return BPromise['reject'](_0x1cbe44);}return _0x1e9820[_0xb788('0x23')]();};}function saveUpdates(_0x3afe33,_0x4b3331){return function(_0x389b07){if(_0x389b07){return _0x389b07[_0xb788('0x24')](_0x3afe33)[_0xb788('0x25')](function(_0x13a3ae){return _0x13a3ae;});}return null;};}function removeEntity(_0x454edc,_0x1afe56){return function(_0x2ee702){if(_0x2ee702){return _0x2ee702[_0xb788('0x26')]()[_0xb788('0x25')](function(){_0x454edc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32ec83,_0x14826b){return function(_0x1bbf5a){if(!_0x1bbf5a){_0x32ec83[_0xb788('0x19')](0x194);}return _0x1bbf5a;};}function handleError(_0x54a1cf,_0x3aaf0b){_0x3aaf0b=_0x3aaf0b||0x1f4;return function(_0x59b522){logger[_0xb788('0x27')](_0x59b522[_0xb788('0x28')]);if(_0x59b522['name']){delete _0x59b522[_0xb788('0x29')];}_0x54a1cf[_0xb788('0x1a')](_0x3aaf0b)[_0xb788('0x2a')](_0x59b522);};}exports['update']=function(_0xb5a1dc,_0x357b30){if(_0xb5a1dc[_0xb788('0x2b')]['id']){delete _0xb5a1dc[_0xb788('0x2b')]['id'];}return db[_0xb788('0x2c')][_0xb788('0x2d')]({'where':{'id':_0xb5a1dc['params']['id']}})[_0xb788('0x25')](handleEntityNotFound(_0x357b30,null))[_0xb788('0x25')](saveUpdates(_0xb5a1dc[_0xb788('0x2b')],null))['then'](respondWithResult(_0x357b30,null))[_0xb788('0x2e')](handleError(_0x357b30,null));};exports[_0xb788('0x26')]=function(_0x3949f3,_0x1c71be){return db['Action']['find']({'where':{'id':_0x3949f3[_0xb788('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1c71be,null))[_0xb788('0x25')](removeEntity(_0x1c71be,null))[_0xb788('0x2e')](handleError(_0x1c71be,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index f753697..d7b6520 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 _0xd802=['path','rimraf','../../config/environment','define','tools_actions','util','../../config/logger','moment','request-promise'];(function(_0x3d0293,_0x3d3c80){var _0x5aa8d3=function(_0x1e1a9a){while(--_0x1e1a9a){_0x3d0293['push'](_0x3d0293['shift']());}};_0x5aa8d3(++_0x3d3c80);}(_0xd802,0x7a));var _0x2d80=function(_0x1b1365,_0x205568){_0x1b1365=_0x1b1365-0x0;var _0x5edfd8=_0xd802[_0x1b1365];return _0x5edfd8;};'use strict';var _=require('lodash');var util=require(_0x2d80('0x0'));var logger=require(_0x2d80('0x1'))('api');var moment=require(_0x2d80('0x2'));var BPromise=require('bluebird');var rp=require(_0x2d80('0x3'));var fs=require('fs');var path=require(_0x2d80('0x4'));var rimraf=require(_0x2d80('0x5'));var config=require(_0x2d80('0x6'));var attributes=require('./action.attributes');module['exports']=function(_0xf81f6f,_0x22c27c){return _0xf81f6f[_0x2d80('0x7')]('Action',attributes,{'tableName':_0x2d80('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0053=['tools_actions','util','../../config/logger','api','moment','request-promise','rimraf','./action.attributes','define','Action'];(function(_0x10f6c5,_0xa3fc35){var _0x3003f9=function(_0x22d5df){while(--_0x22d5df){_0x10f6c5['push'](_0x10f6c5['shift']());}};_0x3003f9(++_0xa3fc35);}(_0x0053,0x14b));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3005('0x0'));var logger=require(_0x3005('0x1'))(_0x3005('0x2'));var moment=require(_0x3005('0x3'));var BPromise=require('bluebird');var rp=require(_0x3005('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3005('0x5'));var config=require('../../config/environment');var attributes=require(_0x3005('0x6'));module['exports']=function(_0x17c82a,_0x3c6aa2){return _0x17c82a[_0x3005('0x7')](_0x3005('0x8'),attributes,{'tableName':_0x3005('0x9'),'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 eeabe27..6e99062 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2e7e96,_0x2b8f8b){var _0x2790ba=function(_0x534fdb){while(--_0x534fdb){_0x2e7e96['push'](_0x2e7e96['shift']());}};_0x2790ba(++_0x2b8f8b);}(_0xabce,0x103));var _0xeabc=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xabce[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1a6225,_0x4140f0){var _0x4bd1d3=function(_0x128f51){while(--_0x128f51){_0x1a6225['push'](_0x1a6225['shift']());}};_0x4bd1d3(++_0x4140f0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 52e0569..efee6d9 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 _0x444d=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated'];(function(_0x204cbf,_0x26b425){var _0x19729f=function(_0x357104){while(--_0x357104){_0x204cbf['push'](_0x204cbf['shift']());}};_0x19729f(++_0x26b425);}(_0x444d,0xd5));var _0xd444=function(_0xb660ff,_0x5452f0){_0xb660ff=_0xb660ff-0x0;var _0x544073=_0x444d[_0xb660ff];return _0x544073;};'use strict';var multer=require(_0xd444('0x0'));var util=require(_0xd444('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd444('0x2'));var router=express[_0xd444('0x3')]();var fs_extra=require(_0xd444('0x4'));var auth=require(_0xd444('0x5'));var interaction=require(_0xd444('0x6'));var config=require('../../config/environment');var controller=require(_0xd444('0x7'));router[_0xd444('0x8')](_0xd444('0x9'),auth[_0xd444('0xa')](),controller['update']);router[_0xd444('0xb')]('/:id',auth[_0xd444('0xa')](),controller[_0xd444('0xc')]);module[_0xd444('0xd')]=router; \ No newline at end of file +var _0xb0fa=['./action.controller','put','/:id','isAuthenticated','delete','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x425c51,_0x8ae79f){var _0x5a2ef6=function(_0x1d450d){while(--_0x1d450d){_0x425c51['push'](_0x425c51['shift']());}};_0x5a2ef6(++_0x8ae79f);}(_0xb0fa,0xff));var _0xab0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0fa[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab0f('0x0'));var timeout=require('connect-timeout');var express=require(_0xab0f('0x1'));var router=express['Router']();var fs_extra=require(_0xab0f('0x2'));var auth=require(_0xab0f('0x3'));var interaction=require(_0xab0f('0x4'));var config=require('../../config/environment');var controller=require(_0xab0f('0x5'));router[_0xab0f('0x6')](_0xab0f('0x7'),auth[_0xab0f('0x8')](),controller['update']);router[_0xab0f('0x9')](_0xab0f('0x7'),auth[_0xab0f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d1569a9..812af26 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 _0xafc4=['sequelize','STRING','TEXT'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xafc4,0x69));var _0x4afc=function(_0x3e85b5,_0x262880){_0x3e85b5=_0x3e85b5-0x0;var _0x3a3c32=_0xafc4[_0x3e85b5];return _0x3a3c32;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file +var _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x4d1133,_0x11548f){var _0x3d52c7=function(_0x4c0401){while(--_0x4c0401){_0x4d1133['push'](_0x4d1133['shift']());}};_0x3d52c7(++_0x11548f);}(_0x1883,0xab));var _0x3188=function(_0x4485c7,_0x1e619b){_0x4485c7=_0x4485c7-0x0;var _0x1b61c1=_0x1883[_0x4485c7];return _0x1b61c1;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 46c4e6d..c870ec2 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 _0x5554=['fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','show','params','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','MetricId','metric','field','function','replace','orderBy','order','DESC','alias','joins','parse','foreignTable','format','%s.%s\x20=\x20%s.%s','table','parentKey','foreignKey','conditions','clone','debug','toString','sequelize','SELECT','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','AnalyticMetric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','select','countTable','COUNT(*)','QueryTypes','run','IS\x20EMPTY','value','groupBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x9c173a,_0x461c9c){var _0x88d611=function(_0x4900c7){while(--_0x4900c7){_0x9c173a['push'](_0x9c173a['shift']());}};_0x88d611(++_0x461c9c);}(_0x5554,0x70));var _0x4555=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x5554[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x4555('0x0'));var rimraf=require(_0x4555('0x1'));var zipdir=require(_0x4555('0x2'));var jsonpatch=require(_0x4555('0x3'));var rp=require(_0x4555('0x4'));var moment=require('moment');var BPromise=require(_0x4555('0x5'));var Mustache=require('mustache');var util=require(_0x4555('0x6'));var path=require(_0x4555('0x7'));var sox=require('sox');var csv=require(_0x4555('0x8'));var ejs=require(_0x4555('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4555('0xa'));var squel=require(_0x4555('0xb'));var crypto=require(_0x4555('0xc'));var jsforce=require(_0x4555('0xd'));var deskjs=require(_0x4555('0xe'));var toCsv=require(_0x4555('0x8'));var querystring=require(_0x4555('0xf'));var Papa=require(_0x4555('0x10'));var Redis=require(_0x4555('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4555('0x12'));var as=require(_0x4555('0x13'));var hardwareService=require(_0x4555('0x14'));var logger=require(_0x4555('0x15'))('api');var utils=require(_0x4555('0x16'));var config=require(_0x4555('0x17'));var licenseUtil=require(_0x4555('0x18'));var db=require(_0x4555('0x19'))['db'];var dbH=require('../../mysqldb')[_0x4555('0x1a')];function respondWithStatusCode(_0x252d8e,_0x3176cd){_0x3176cd=_0x3176cd||0xcc;return function(_0x5b90e1){if(_0x5b90e1){return _0x252d8e['sendStatus'](_0x3176cd);}return _0x252d8e[_0x4555('0x1b')](_0x3176cd)[_0x4555('0x1c')]();};}function respondWithResult(_0x37ca01,_0x2ce7d1){_0x2ce7d1=_0x2ce7d1||0xc8;return function(_0x345b35){if(_0x345b35){return _0x37ca01[_0x4555('0x1b')](_0x2ce7d1)[_0x4555('0x1d')](_0x345b35);}};}function respondWithFilteredResult(_0x105429,_0x3cb791){return function(_0x5618f6){if(_0x5618f6){var _0x370016=typeof _0x3cb791[_0x4555('0x1e')]==='undefined'&&typeof _0x3cb791['limit']===_0x4555('0x1f');var _0x5d618f=_0x5618f6['count'];var _0x3f571c=_0x370016?0x0:_0x3cb791['offset'];var _0x498914=_0x370016?_0x5618f6['count']:_0x3cb791[_0x4555('0x1e')]+_0x3cb791['limit'];var _0x1573ca;if(_0x498914>=_0x5d618f){_0x498914=_0x5d618f;_0x1573ca=0xc8;}else{_0x1573ca=0xce;}_0x105429['status'](_0x1573ca);return _0x105429[_0x4555('0x20')](_0x4555('0x21'),_0x3f571c+'-'+_0x498914+'/'+_0x5d618f)[_0x4555('0x1d')](_0x5618f6);}return null;};}function patchUpdates(_0x3d43ac){return function(_0x2bdd9c){try{jsonpatch[_0x4555('0x22')](_0x2bdd9c,_0x3d43ac,!![]);}catch(_0x4d0ad5){return BPromise[_0x4555('0x23')](_0x4d0ad5);}return _0x2bdd9c[_0x4555('0x24')]();};}function saveUpdates(_0x5bb5c3,_0x5e9b5c){return function(_0xb18ff6){if(_0xb18ff6){return _0xb18ff6[_0x4555('0x25')](_0x5bb5c3)[_0x4555('0x26')](function(_0x5170f9){return _0x5170f9;});}return null;};}function removeEntity(_0x4053d6,_0x276b29){return function(_0x2d7b55){if(_0x2d7b55){return _0x2d7b55[_0x4555('0x27')]()[_0x4555('0x26')](function(){var _0x2eb1bc=_0x2d7b55[_0x4555('0x28')]({'plain':!![]});var _0x1dd476=_0x4555('0x29');return db[_0x4555('0x2a')]['destroy']({'where':{'type':_0x1dd476,'resourceId':_0x2eb1bc['id']}})[_0x4555('0x26')](function(){return _0x2d7b55;});})[_0x4555('0x26')](function(){_0x4053d6[_0x4555('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9627,_0x47a689){return function(_0x28d2ee){if(!_0x28d2ee){_0x3c9627[_0x4555('0x2b')](0x194);}return _0x28d2ee;};}function handleError(_0x337de2,_0x6af5cd){_0x6af5cd=_0x6af5cd||0x1f4;return function(_0x59fcb4){logger['error'](_0x59fcb4[_0x4555('0x2c')]);if(_0x59fcb4['name']){delete _0x59fcb4[_0x4555('0x2d')];}_0x337de2[_0x4555('0x1b')](_0x6af5cd)['send'](_0x59fcb4);};}exports['index']=function(_0x8ba98,_0x17ce60){var _0x56f340={},_0xf9bb24={},_0x560f75={'count':0x0,'rows':[]};var _0x283d1b=_[_0x4555('0x2e')](db[_0x4555('0x2f')][_0x4555('0x30')],function(_0x1b8499){return{'name':_0x1b8499[_0x4555('0x31')],'type':_0x1b8499[_0x4555('0x32')][_0x4555('0x33')]};});_0xf9bb24[_0x4555('0x34')]=_[_0x4555('0x2e')](_0x283d1b,_0x4555('0x2d'));_0xf9bb24[_0x4555('0x35')]=_[_0x4555('0x36')](_0x8ba98[_0x4555('0x35')]);_0xf9bb24[_0x4555('0x37')]=_[_0x4555('0x38')](_0xf9bb24[_0x4555('0x34')],_0xf9bb24['query']);_0x56f340['attributes']=_[_0x4555('0x38')](_0xf9bb24['model'],qs[_0x4555('0x39')](_0x8ba98['query'][_0x4555('0x39')]));_0x56f340[_0x4555('0x3a')]=_0x56f340['attributes']['length']?_0x56f340['attributes']:_0xf9bb24[_0x4555('0x34')];if(!_0x8ba98[_0x4555('0x35')][_0x4555('0x3b')](_0x4555('0x3c'))){_0x56f340['limit']=qs[_0x4555('0x3d')](_0x8ba98[_0x4555('0x35')][_0x4555('0x3d')]);_0x56f340['offset']=qs[_0x4555('0x1e')](_0x8ba98[_0x4555('0x35')][_0x4555('0x1e')]);}_0x56f340['order']=qs[_0x4555('0x3e')](_0x8ba98[_0x4555('0x35')][_0x4555('0x3e')]);_0x56f340[_0x4555('0x3f')]=qs[_0x4555('0x37')](_['pick'](_0x8ba98['query'],_0xf9bb24[_0x4555('0x37')]),_0x283d1b);if(_0x8ba98[_0x4555('0x35')][_0x4555('0x40')]){_0x56f340[_0x4555('0x3f')]=_[_0x4555('0x41')](_0x56f340[_0x4555('0x3f')],{'$or':_[_0x4555('0x2e')](_0x283d1b,function(_0xaaa4df){if(_0xaaa4df[_0x4555('0x32')]!=='VIRTUAL'){var _0x181344={};_0x181344[_0xaaa4df[_0x4555('0x2d')]]={'$like':'%'+_0x8ba98['query'][_0x4555('0x40')]+'%'};return _0x181344;}})});}_0x56f340=_[_0x4555('0x41')]({},_0x56f340,_0x8ba98[_0x4555('0x42')]);var _0x356faa={'where':_0x56f340['where']};return db[_0x4555('0x2f')][_0x4555('0x43')](_0x356faa)[_0x4555('0x26')](function(_0x385b98){_0x560f75[_0x4555('0x43')]=_0x385b98;if(_0x8ba98[_0x4555('0x35')][_0x4555('0x44')]){_0x56f340[_0x4555('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x4555('0x46')](_0x56f340);})[_0x4555('0x26')](function(_0x2d3242){_0x560f75[_0x4555('0x47')]=_0x2d3242;return _0x560f75;})[_0x4555('0x26')](respondWithFilteredResult(_0x17ce60,_0x56f340))['catch'](handleError(_0x17ce60,null));};exports[_0x4555('0x48')]=function(_0x517752,_0x54355c){var _0x1d207e={'raw':![],'where':{'id':_0x517752[_0x4555('0x49')]['id']}},_0x4ae09c={};_0x4ae09c['model']=_[_0x4555('0x36')](db['AnalyticCustomReport'][_0x4555('0x30')]);_0x4ae09c['query']=_['keys'](_0x517752[_0x4555('0x35')]);_0x4ae09c[_0x4555('0x37')]=_['intersection'](_0x4ae09c['model'],_0x4ae09c[_0x4555('0x35')]);_0x1d207e[_0x4555('0x3a')]=_['intersection'](_0x4ae09c[_0x4555('0x34')],qs[_0x4555('0x39')](_0x517752[_0x4555('0x35')]['fields']));_0x1d207e[_0x4555('0x3a')]=_0x1d207e[_0x4555('0x3a')][_0x4555('0x4a')]?_0x1d207e[_0x4555('0x3a')]:_0x4ae09c[_0x4555('0x34')];if(_0x517752[_0x4555('0x35')][_0x4555('0x44')]){_0x1d207e[_0x4555('0x45')]=[{'all':!![]}];}_0x1d207e=_['merge']({},_0x1d207e,_0x517752[_0x4555('0x42')]);return db[_0x4555('0x2f')]['find'](_0x1d207e)[_0x4555('0x26')](handleEntityNotFound(_0x54355c,null))['then'](respondWithResult(_0x54355c,null))[_0x4555('0x4b')](handleError(_0x54355c,null));};exports[_0x4555('0x4c')]=function(_0x460ebc,_0x2918ac){return db['AnalyticCustomReport'][_0x4555('0x4c')](_0x460ebc[_0x4555('0x4d')],{})[_0x4555('0x26')](function(_0x3474c0){var _0xa95828=_0x460ebc['user'][_0x4555('0x28')]({'plain':!![]});if(!_0xa95828)throw new Error(_0x4555('0x4e'));if(_0xa95828[_0x4555('0x4f')]==='user'){var _0x146cbb=_0x3474c0[_0x4555('0x28')]({'plain':!![]});var _0x55e135=_0x4555('0x50');return db[_0x4555('0x51')][_0x4555('0x52')]({'where':{'name':_0x55e135,'userProfileId':_0xa95828[_0x4555('0x53')]},'raw':!![]})['then'](function(_0x40c14d){if(_0x40c14d&&_0x40c14d[_0x4555('0x54')]===0x0){return db[_0x4555('0x2a')][_0x4555('0x4c')]({'name':_0x146cbb[_0x4555('0x2d')],'resourceId':_0x146cbb['id'],'type':_0x4555('0x29'),'sectionId':_0x40c14d['id']},{})[_0x4555('0x26')](function(){return _0x3474c0;});}else{return _0x3474c0;}})[_0x4555('0x4b')](function(_0x5afc03){logger[_0x4555('0x55')](_0x4555('0x56'),_0x5afc03);throw _0x5afc03;});}return _0x3474c0;})['then'](respondWithResult(_0x2918ac,0xc9))[_0x4555('0x4b')](handleError(_0x2918ac,null));};exports[_0x4555('0x25')]=function(_0x2be64b,_0x5d908f){if(_0x2be64b[_0x4555('0x4d')]['id']){delete _0x2be64b[_0x4555('0x4d')]['id'];}return db[_0x4555('0x2f')][_0x4555('0x52')]({'where':{'id':_0x2be64b[_0x4555('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d908f,null))[_0x4555('0x26')](saveUpdates(_0x2be64b[_0x4555('0x4d')],null))[_0x4555('0x26')](respondWithResult(_0x5d908f,null))[_0x4555('0x4b')](handleError(_0x5d908f,null));};exports[_0x4555('0x27')]=function(_0x5bd5b6,_0x4666b4){return db[_0x4555('0x2f')]['find']({'where':{'id':_0x5bd5b6[_0x4555('0x49')]['id']}})['then'](handleEntityNotFound(_0x4666b4,null))['then'](removeEntity(_0x4666b4,null))[_0x4555('0x4b')](handleError(_0x4666b4,null));};exports[_0x4555('0x57')]=function(_0x35c17f,_0x11c744){var _0x37fa01=0xa;var _0x30b645=[_0x4555('0x58'),_0x4555('0x59'),'right_join',_0x4555('0x5a')];var _0x51351b={'SUM':_0x4555('0x5b'),'COUNT':_0x4555('0x5c'),'COUNT DISTINCT':_0x4555('0x5d'),'MAX':_0x4555('0x5e'),'MIN':_0x4555('0x5f'),'AVG':_0x4555('0x60'),'GROUP_CONCAT':_0x4555('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4555('0x62')};var _0x3b7050={'SEC_TO_TIME':_0x4555('0x63'),'DATE':_0x4555('0x64'),'HOUR':_0x4555('0x65'),'ROUND':_0x4555('0x66'),'UNIX_TIMESTAMP':_0x4555('0x67')};var _0x33f6ad=function(_0x386013){return!_[_0x4555('0x68')]([_0x4555('0x69'),_0x4555('0x6a'),'IS\x20EMPTY',_0x4555('0x6b')],_0x386013);};var _0x32e65b=function(_0x297268){if(!_0x297268||!_0x297268[_0x4555('0x6c')]['length']){return'';}for(var _0x24eee3='(',_0x28cd1c=0x0;_0x28cd1c<_0x297268['rules']['length'];_0x28cd1c+=0x1){_0x28cd1c>0x0&&(_0x24eee3+='\x20'+_0x297268[_0x4555('0x6d')]+'\x20');_0x24eee3+=_0x297268[_0x4555('0x6c')][_0x28cd1c][_0x4555('0x6e')]?_0x32e65b(_0x297268['rules'][_0x28cd1c]['group']):_0x297268[_0x4555('0x6c')][_0x28cd1c]['field']+'\x20'+_0x297268[_0x4555('0x6c')][_0x28cd1c]['condition']+(_0x33f6ad(_0x297268[_0x4555('0x6c')][_0x28cd1c][_0x4555('0x6f')])?'\x20'+_0x297268[_0x4555('0x6c')][_0x28cd1c]['value']:'');}return _0x24eee3+')';};var _0x5dd139={'where':{'id':_0x35c17f['params']['id']}},_0x104b62,_0x75923f,_0x16e93b,_0x5d6fd6,_0x202367;_0x5dd139=_['merge']({},_0x5dd139,_0x35c17f[_0x4555('0x42')]);return db[_0x4555('0x2f')][_0x4555('0x52')](_0x5dd139)[_0x4555('0x26')](function(_0x5bd729){if(_0x5bd729){_0x104b62=_0x5bd729;return _0x5bd729[_0x4555('0x70')]();}return null;})[_0x4555('0x26')](function(_0x3c1250){if(_0x3c1250){if(!_0x3c1250[_0x4555('0x4a')]){throw new db[(_0x4555('0x71'))][(_0x4555('0x72'))](_0x4555('0x73'),0x193);}_0x75923f=_0x3c1250;return db['AnalyticMetric'][_0x4555('0x46')]({'raw':!![]});}return null;})[_0x4555('0x26')](function(_0x1c7dd6){if(_0x1c7dd6){_0x16e93b=_[_0x4555('0x74')](_0x1c7dd6,'id');var _0x48b277;var _0x2c0ace=squel['select']();_0x2c0ace[_0x4555('0x75')](_0x104b62['table']);for(var _0x5e9635=0x0;_0x5e9635<_0x75923f[_0x4555('0x4a')];_0x5e9635+=0x1){_0x48b277=_0x75923f[_0x5e9635][_0x4555('0x76')]?_0x16e93b[_0x75923f[_0x5e9635][_0x4555('0x76')]][_0x4555('0x77')]:_0x75923f[_0x5e9635][_0x4555('0x78')];_0x48b277=_0x75923f[_0x5e9635][_0x4555('0x79')]?_['replace'](_0x51351b[_0x75923f[_0x5e9635][_0x4555('0x79')]],'%s',_0x48b277):_0x48b277;_0x48b277=_0x75923f[_0x5e9635]['format']?_[_0x4555('0x7a')](_0x3b7050[_0x75923f[_0x5e9635]['format']],'%s',_0x48b277):_0x48b277;if(_0x75923f[_0x5e9635]['groupBy']){_0x2c0ace[_0x4555('0x6e')](_0x48b277);}_0x75923f[_0x5e9635][_0x4555('0x7b')]&&_0x2c0ace[_0x4555('0x7c')](_0x48b277,_0x75923f[_0x5e9635]['orderBy']===_0x4555('0x7d')?![]:!![]);_0x2c0ace[_0x4555('0x78')](_0x48b277,_0x75923f[_0x5e9635][_0x4555('0x7e')]||_0x48b277);}if(_0x104b62[_0x4555('0x7f')]){_0x104b62['joins']=JSON[_0x4555('0x80')](_0x104b62['joins']);for(var _0x2fec54=0x0;_0x2fec54<_0x104b62['joins']['length'];_0x2fec54+=0x1){if(_0x104b62['joins'][_0x2fec54][_0x4555('0x32')]&&_[_0x4555('0x68')](_0x30b645,_0x104b62[_0x4555('0x7f')][_0x2fec54]['type'])&&_0x104b62[_0x4555('0x7f')][_0x2fec54]['parentKey']&&_0x104b62[_0x4555('0x7f')][_0x2fec54][_0x4555('0x81')]&&_0x104b62[_0x4555('0x7f')][_0x2fec54]['foreignKey']){_0x2c0ace[_0x104b62['joins'][_0x2fec54][_0x4555('0x32')]](_0x104b62[_0x4555('0x7f')][_0x2fec54]['foreignTable'],null,util[_0x4555('0x82')](_0x4555('0x83'),_0x104b62[_0x4555('0x84')],_0x104b62[_0x4555('0x7f')][_0x2fec54][_0x4555('0x85')],_0x104b62[_0x4555('0x7f')][_0x2fec54][_0x4555('0x81')],_0x104b62[_0x4555('0x7f')][_0x2fec54][_0x4555('0x86')]));}}}if(_0x104b62[_0x4555('0x87')]){_0x104b62[_0x4555('0x87')]=JSON[_0x4555('0x80')](_0x104b62['conditions']);_0x2c0ace[_0x4555('0x3f')](_0x32e65b(_0x104b62[_0x4555('0x87')][_0x4555('0x6e')]));}_0x202367=_0x2c0ace[_0x4555('0x88')]();_0x2c0ace[_0x4555('0x3d')](_0x37fa01);_0x2c0ace['offset'](0x0);logger[_0x4555('0x89')]('Limited\x20Query:',_0x2c0ace['toString']());return dbH['sequelize'][_0x4555('0x35')](_0x2c0ace[_0x4555('0x8a')](),{'type':dbH[_0x4555('0x8b')]['QueryTypes'][_0x4555('0x8c')]});}})[_0x4555('0x26')](respondWithResult(_0x11c744,null))[_0x4555('0x4b')](handleError(_0x11c744,null));};function runReport(_0x16daab,_0xc3e9bf,_0x1e3a55){var _0x5bd8f1=_0xc3e9bf[_0x4555('0x2d')];var _0x5653ce=0xa;var _0x2b068d=[_0x4555('0x58'),'left_join',_0x4555('0x8d'),'cross_join'];var _0x4772f3={'SUM':_0x4555('0x5b'),'COUNT':_0x4555('0x5c'),'COUNT DISTINCT':_0x4555('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4555('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4555('0x8e'),'GROUP_CONCAT DESC':_0x4555('0x62')};var _0x40cef0={'SEC_TO_TIME':_0x4555('0x63'),'DATE':_0x4555('0x64'),'HOUR':_0x4555('0x65'),'ROUND':_0x4555('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x26e695=function(_0x22eba6){return!_['includes']([_0x4555('0x69'),_0x4555('0x6a'),'IS\x20EMPTY',_0x4555('0x6b')],_0x22eba6);};var _0x5607a1=function(_0x1b91f7){if(!_0x1b91f7||!_0x1b91f7[_0x4555('0x6c')][_0x4555('0x4a')]){return'';}for(var _0x1bc5df='(',_0x51af5a=0x0;_0x51af5a<_0x1b91f7[_0x4555('0x6c')][_0x4555('0x4a')];_0x51af5a+=0x1){_0x51af5a>0x0&&(_0x1bc5df+='\x20'+_0x1b91f7[_0x4555('0x6d')]+'\x20');_0x1bc5df+=_0x1b91f7[_0x4555('0x6c')][_0x51af5a][_0x4555('0x6e')]?_0x5607a1(_0x1b91f7[_0x4555('0x6c')][_0x51af5a][_0x4555('0x6e')]):_0x1b91f7[_0x4555('0x6c')][_0x51af5a]['field']+'\x20'+_0x1b91f7[_0x4555('0x6c')][_0x51af5a][_0x4555('0x6f')]+(_0x26e695(_0x1b91f7['rules'][_0x51af5a]['condition'])?'\x20'+_0x1b91f7[_0x4555('0x6c')][_0x51af5a]['value']:'');}return _0x1bc5df+')';};var _0x4503a8={'where':{'id':_0x16daab['id']}},_0x392e41,_0x23d762,_0x1ee0c8,_0x45f782,_0x5228c0;_0x4503a8=_[_0x4555('0x41')]({},_0x4503a8,_0x1e3a55);return db['AnalyticCustomReport'][_0x4555('0x52')](_0x4503a8)['then'](function(_0x4b0c2a){if(_0x4b0c2a){_0x392e41=_0x4b0c2a;return _0x4b0c2a['getFields']();}return null;})['then'](function(_0x35bad8){if(_0x35bad8){if(!_0x35bad8[_0x4555('0x4a')]){throw new db[(_0x4555('0x71'))][(_0x4555('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x23d762=_0x35bad8;return db[_0x4555('0x8f')][_0x4555('0x46')]({'raw':!![]});}return null;})[_0x4555('0x26')](function(_0x5d1d26){if(_0x5d1d26){_0x1ee0c8=_['keyBy'](_0x5d1d26,'id');var _0x5823db;var _0x2fb914=squel['select']();_0x2fb914[_0x4555('0x75')](_0x392e41[_0x4555('0x84')]);for(var _0x1e7443=0x0;_0x1e7443<_0x23d762[_0x4555('0x4a')];_0x1e7443+=0x1){_0x5823db=_0x23d762[_0x1e7443][_0x4555('0x76')]?_0x1ee0c8[_0x23d762[_0x1e7443][_0x4555('0x76')]][_0x4555('0x77')]:_0x23d762[_0x1e7443]['field'];_0x5823db=_0x23d762[_0x1e7443][_0x4555('0x79')]?_[_0x4555('0x7a')](_0x4772f3[_0x23d762[_0x1e7443][_0x4555('0x79')]],'%s',_0x5823db):_0x5823db;_0x5823db=_0x23d762[_0x1e7443][_0x4555('0x82')]?_[_0x4555('0x7a')](_0x40cef0[_0x23d762[_0x1e7443]['format']],'%s',_0x5823db):_0x5823db;if(_0x23d762[_0x1e7443]['groupBy']){_0x2fb914[_0x4555('0x6e')](_0x5823db);}_0x23d762[_0x1e7443][_0x4555('0x7b')]&&_0x2fb914[_0x4555('0x7c')](_0x5823db,_0x23d762[_0x1e7443]['orderBy']==='DESC'?![]:!![]);_0x2fb914[_0x4555('0x78')](_0x5823db,_0x23d762[_0x1e7443][_0x4555('0x7e')]||_0x5823db);}if(_0x392e41[_0x4555('0x7f')]){_0x392e41[_0x4555('0x7f')]=JSON[_0x4555('0x80')](_0x392e41['joins']);for(var _0x523744=0x0;_0x523744<_0x392e41['joins'][_0x4555('0x4a')];_0x523744+=0x1){if(_0x392e41['joins'][_0x523744][_0x4555('0x32')]&&_[_0x4555('0x68')](_0x2b068d,_0x392e41[_0x4555('0x7f')][_0x523744]['type'])&&_0x392e41[_0x4555('0x7f')][_0x523744]['parentKey']&&_0x392e41['joins'][_0x523744][_0x4555('0x81')]&&_0x392e41[_0x4555('0x7f')][_0x523744][_0x4555('0x86')]){_0x2fb914[_0x392e41[_0x4555('0x7f')][_0x523744][_0x4555('0x32')]](_0x392e41[_0x4555('0x7f')][_0x523744][_0x4555('0x81')],null,util[_0x4555('0x82')](_0x4555('0x83'),_0x392e41[_0x4555('0x84')],_0x392e41[_0x4555('0x7f')][_0x523744]['parentKey'],_0x392e41[_0x4555('0x7f')][_0x523744][_0x4555('0x81')],_0x392e41[_0x4555('0x7f')][_0x523744][_0x4555('0x86')]));}}}if(_0x392e41[_0x4555('0x87')]){_0x392e41[_0x4555('0x87')]=JSON[_0x4555('0x80')](_0x392e41[_0x4555('0x87')]);_0x2fb914['where'](_0x5607a1(_0x392e41[_0x4555('0x87')][_0x4555('0x6e')]));}_0x5228c0=_0x2fb914[_0x4555('0x88')]();_0x2fb914[_0x4555('0x3d')](_0x5653ce);_0x2fb914[_0x4555('0x1e')](0x0);return;}})[_0x4555('0x26')](function(){if(_0xc3e9bf[_0x4555('0x90')]===_0x4555('0x91')){return null;}var _0x279a92=_[_0x4555('0x41')](_0xc3e9bf,{'name':_0xc3e9bf[_0x4555('0x92')]||_0xc3e9bf[_0x4555('0x2d')]||_0x392e41[_0x4555('0x2d')],'basename':_0x5bd8f1,'savename':util[_0x4555('0x82')](_0x4555('0x93'),_0xc3e9bf[_0x4555('0x2d')]||_0x392e41[_0x4555('0x2d')],require(_0x4555('0x94'))[_0x4555('0x95')](0x4),_0xc3e9bf[_0x4555('0x90')]||_0x4555('0x96')),'reportId':_0x392e41['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x4555('0x4c')](_0x279a92,{'raw':!![]});})[_0x4555('0x26')](function(_0x233a11){if(_0x392e41[_0x4555('0x84')]===_0x4555('0x97')){_0x5228c0[_0x4555('0x3f')](_0x392e41[_0x4555('0x84')]+_0x4555('0x98'),_0xc3e9bf[_0x4555('0x99')],_0xc3e9bf[_0x4555('0x9a')]);}else{_0x5228c0[_0x4555('0x3f')](_0x392e41[_0x4555('0x84')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc3e9bf[_0x4555('0x99')],_0xc3e9bf[_0x4555('0x9a')]);}if(_0x233a11){logger[_0x4555('0x9b')](_0x4555('0x9c'),_0x5228c0['toString']());require(_0x4555('0x9d'))[_0x4555('0x9e')](path[_0x4555('0x58')](__dirname,_0x4555('0x9f'),_0x233a11['output']),[_0x233a11['id'],_0x5228c0['toString'](),path[_0x4555('0x58')](__dirname,'../../files/reports',_0x233a11[_0x4555('0xa0')]),_0x5bd8f1]);return _0x233a11;}else{var _0x28caa8=squel[_0x4555('0xa1')]();_0x28caa8[_0x4555('0x75')]('('+_0x5228c0['toString']()+')',_0x4555('0xa2'));_0x28caa8[_0x4555('0x78')](_0x4555('0xa3'),_0x4555('0x43'));_0x5228c0[_0x4555('0x3d')](_0xc3e9bf[_0x4555('0x3d')]||_0x5653ce);_0x5228c0[_0x4555('0x1e')](_0xc3e9bf['offset']||0x0);return dbH[_0x4555('0x8b')][_0x4555('0x35')](_0x28caa8[_0x4555('0x8a')](),{'type':dbH[_0x4555('0x8b')][_0x4555('0xa4')][_0x4555('0x8c')]})[_0x4555('0x26')](function(_0x22946e){if(!_0x22946e[_0x4555('0x4a')]){_0x45f782=0x0;}else{_0x45f782=_0x22946e[0x0][_0x4555('0x43')]||0x0;}return dbH[_0x4555('0x8b')]['query'](_0x5228c0[_0x4555('0x8a')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x4555('0x26')](function(_0x5ec227){return{'rows':_0x5ec227||[],'count':_0x45f782};});}});}exports[_0x4555('0xa5')]=function(_0x2d0b8f,_0x3ddb47){return runReport(_0x2d0b8f[_0x4555('0x49')],_0x2d0b8f[_0x4555('0x35')],_0x2d0b8f[_0x4555('0x42')])[_0x4555('0x26')](respondWithResult(_0x3ddb47,null))['catch'](handleError(_0x3ddb47,null));};exports['runReport']=runReport;exports['query']=function(_0x57674a,_0x52c76f){var _0x5eb19d=0xa;var _0x4b9472=[_0x4555('0x58'),_0x4555('0x59'),_0x4555('0x8d'),_0x4555('0x5a')];var _0x528b55={'SUM':_0x4555('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4555('0x5d'),'MAX':_0x4555('0x5e'),'MIN':_0x4555('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4555('0x8e'),'GROUP_CONCAT DESC':_0x4555('0x62')};var _0x32db47={'SEC_TO_TIME':_0x4555('0x63'),'DATE':_0x4555('0x64'),'HOUR':_0x4555('0x65'),'ROUND':_0x4555('0x66'),'UNIX_TIMESTAMP':_0x4555('0x67')};var _0x585f10=function(_0x3059bc){return!_['includes'](['IS\x20NULL',_0x4555('0x6a'),_0x4555('0xa6'),_0x4555('0x6b')],_0x3059bc);};var _0x38bb7e=function(_0x781db5){if(!_0x781db5||!_0x781db5[_0x4555('0x6c')][_0x4555('0x4a')]){return'';}for(var _0x7fdb6a='(',_0x3b3f90=0x0;_0x3b3f90<_0x781db5[_0x4555('0x6c')][_0x4555('0x4a')];_0x3b3f90+=0x1){_0x3b3f90>0x0&&(_0x7fdb6a+='\x20'+_0x781db5[_0x4555('0x6d')]+'\x20');_0x7fdb6a+=_0x781db5['rules'][_0x3b3f90]['group']?_0x38bb7e(_0x781db5['rules'][_0x3b3f90][_0x4555('0x6e')]):_0x781db5[_0x4555('0x6c')][_0x3b3f90][_0x4555('0x78')]+'\x20'+_0x781db5['rules'][_0x3b3f90][_0x4555('0x6f')]+(_0x585f10(_0x781db5[_0x4555('0x6c')][_0x3b3f90][_0x4555('0x6f')])?'\x20'+_0x781db5['rules'][_0x3b3f90][_0x4555('0xa7')]:'');}return _0x7fdb6a+')';};var _0x154681={'where':{'id':_0x57674a[_0x4555('0x49')]['id']}},_0x5ea282,_0x1a26f7,_0x39b03b,_0x1afbec,_0x33f482;_0x154681=_['merge']({},_0x154681,_0x57674a['options']);return db[_0x4555('0x2f')][_0x4555('0x52')](_0x154681)['then'](function(_0xc0441){if(_0xc0441){_0x5ea282=_0xc0441;return _0xc0441[_0x4555('0x70')]();}return null;})[_0x4555('0x26')](function(_0x57cc43){if(_0x57cc43){if(!_0x57cc43[_0x4555('0x4a')]){throw new db[(_0x4555('0x71'))][(_0x4555('0x72'))](_0x4555('0x73'),0x193);}_0x1a26f7=_0x57cc43;return db[_0x4555('0x8f')]['findAll']({'raw':!![]});}return null;})[_0x4555('0x26')](function(_0x281362){if(_0x281362){_0x39b03b=_['keyBy'](_0x281362,'id');var _0x4d4dc4;var _0x412fe8=squel[_0x4555('0xa1')]();_0x412fe8[_0x4555('0x75')](_0x5ea282[_0x4555('0x84')]);for(var _0x1ff167=0x0;_0x1ff167<_0x1a26f7[_0x4555('0x4a')];_0x1ff167+=0x1){_0x4d4dc4=_0x1a26f7[_0x1ff167][_0x4555('0x76')]?_0x39b03b[_0x1a26f7[_0x1ff167]['MetricId']]['metric']:_0x1a26f7[_0x1ff167]['field'];_0x4d4dc4=_0x1a26f7[_0x1ff167]['function']?_['replace'](_0x528b55[_0x1a26f7[_0x1ff167][_0x4555('0x79')]],'%s',_0x4d4dc4):_0x4d4dc4;_0x4d4dc4=_0x1a26f7[_0x1ff167][_0x4555('0x82')]?_['replace'](_0x32db47[_0x1a26f7[_0x1ff167][_0x4555('0x82')]],'%s',_0x4d4dc4):_0x4d4dc4;if(_0x1a26f7[_0x1ff167][_0x4555('0xa8')]){_0x412fe8[_0x4555('0x6e')](_0x4d4dc4);}_0x1a26f7[_0x1ff167][_0x4555('0x7b')]&&_0x412fe8[_0x4555('0x7c')](_0x4d4dc4,_0x1a26f7[_0x1ff167][_0x4555('0x7b')]==='DESC'?![]:!![]);_0x412fe8[_0x4555('0x78')](_0x4d4dc4,_0x1a26f7[_0x1ff167][_0x4555('0x7e')]||_0x4d4dc4);}if(_0x5ea282[_0x4555('0x7f')]){_0x5ea282['joins']=JSON[_0x4555('0x80')](_0x5ea282[_0x4555('0x7f')]);for(var _0x227959=0x0;_0x227959<_0x5ea282['joins'][_0x4555('0x4a')];_0x227959+=0x1){if(_0x5ea282[_0x4555('0x7f')][_0x227959]['type']&&_[_0x4555('0x68')](_0x4b9472,_0x5ea282[_0x4555('0x7f')][_0x227959]['type'])&&_0x5ea282[_0x4555('0x7f')][_0x227959][_0x4555('0x85')]&&_0x5ea282[_0x4555('0x7f')][_0x227959][_0x4555('0x81')]&&_0x5ea282['joins'][_0x227959]['foreignKey']){_0x412fe8[_0x5ea282['joins'][_0x227959][_0x4555('0x32')]](_0x5ea282[_0x4555('0x7f')][_0x227959][_0x4555('0x81')],null,util[_0x4555('0x82')](_0x4555('0x83'),_0x5ea282['table'],_0x5ea282[_0x4555('0x7f')][_0x227959][_0x4555('0x85')],_0x5ea282['joins'][_0x227959]['foreignTable'],_0x5ea282[_0x4555('0x7f')][_0x227959][_0x4555('0x86')]));}}}if(_0x5ea282[_0x4555('0x87')]){_0x5ea282[_0x4555('0x87')]=JSON[_0x4555('0x80')](_0x5ea282[_0x4555('0x87')]);_0x412fe8[_0x4555('0x3f')](_0x38bb7e(_0x5ea282[_0x4555('0x87')][_0x4555('0x6e')]));}_0x33f482=_0x412fe8[_0x4555('0x88')]();_0x412fe8['limit'](_0x5eb19d);_0x412fe8['offset'](0x0);logger[_0x4555('0x89')]('Limited\x20Query:',_0x412fe8[_0x4555('0x8a')]());return dbH[_0x4555('0x8b')][_0x4555('0x35')](_0x412fe8[_0x4555('0x8a')](),{'type':dbH[_0x4555('0x8b')][_0x4555('0xa4')][_0x4555('0x8c')]});}})['then'](function(){return{'sql':_0x33f482[_0x4555('0x8a')]()};})[_0x4555('0x26')](respondWithResult(_0x52c76f,null))[_0x4555('0x4b')](handleError(_0x52c76f,null));}; \ No newline at end of file +var _0x07a5=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','end','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','Sequelize','from','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','clone','rimraf','zip-dir','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x20959c,_0x3ffd34){var _0x185282=function(_0x1eeba2){while(--_0x1eeba2){_0x20959c['push'](_0x20959c['shift']());}};_0x185282(++_0x3ffd34);}(_0x07a5,0x96));var _0x507a=function(_0x487702,_0x49f5d4){_0x487702=_0x487702-0x0;var _0x5e7150=_0x07a5[_0x487702];return _0x5e7150;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x507a('0x0'));var zipdir=require(_0x507a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x507a('0x2'));var moment=require('moment');var BPromise=require(_0x507a('0x3'));var Mustache=require('mustache');var util=require(_0x507a('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x507a('0x5'));var ejs=require(_0x507a('0x6'));var fs=require('fs');var fs_extra=require(_0x507a('0x7'));var _=require(_0x507a('0x8'));var squel=require(_0x507a('0x9'));var crypto=require(_0x507a('0xa'));var jsforce=require(_0x507a('0xb'));var deskjs=require(_0x507a('0xc'));var toCsv=require(_0x507a('0x5'));var querystring=require(_0x507a('0xd'));var Papa=require(_0x507a('0xe'));var Redis=require(_0x507a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x507a('0x10'));var as=require(_0x507a('0x11'));var hardwareService=require(_0x507a('0x12'));var logger=require(_0x507a('0x13'))(_0x507a('0x14'));var utils=require(_0x507a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x507a('0x16'));var db=require(_0x507a('0x17'))['db'];var dbH=require(_0x507a('0x17'))[_0x507a('0x18')];function respondWithStatusCode(_0x48790c,_0x4443e4){_0x4443e4=_0x4443e4||0xcc;return function(_0x1bf154){if(_0x1bf154){return _0x48790c[_0x507a('0x19')](_0x4443e4);}return _0x48790c[_0x507a('0x1a')](_0x4443e4)['end']();};}function respondWithResult(_0x18bae6,_0x13ed36){_0x13ed36=_0x13ed36||0xc8;return function(_0x209ed2){if(_0x209ed2){return _0x18bae6[_0x507a('0x1a')](_0x13ed36)[_0x507a('0x1b')](_0x209ed2);}};}function respondWithFilteredResult(_0x4f5953,_0x5af7cd){return function(_0x2e7585){if(_0x2e7585){var _0x4a2e1f=typeof _0x5af7cd[_0x507a('0x1c')]===_0x507a('0x1d')&&typeof _0x5af7cd[_0x507a('0x1e')]===_0x507a('0x1d');var _0x341963=_0x2e7585[_0x507a('0x1f')];var _0x50c309=_0x4a2e1f?0x0:_0x5af7cd[_0x507a('0x1c')];var _0x33a5cb=_0x4a2e1f?_0x2e7585[_0x507a('0x1f')]:_0x5af7cd[_0x507a('0x1c')]+_0x5af7cd[_0x507a('0x1e')];var _0x2b2c5e;if(_0x33a5cb>=_0x341963){_0x33a5cb=_0x341963;_0x2b2c5e=0xc8;}else{_0x2b2c5e=0xce;}_0x4f5953[_0x507a('0x1a')](_0x2b2c5e);return _0x4f5953[_0x507a('0x20')](_0x507a('0x21'),_0x50c309+'-'+_0x33a5cb+'/'+_0x341963)[_0x507a('0x1b')](_0x2e7585);}return null;};}function patchUpdates(_0x2bf1bf){return function(_0xe1aa5d){try{jsonpatch[_0x507a('0x22')](_0xe1aa5d,_0x2bf1bf,!![]);}catch(_0x3f3551){return BPromise[_0x507a('0x23')](_0x3f3551);}return _0xe1aa5d[_0x507a('0x24')]();};}function saveUpdates(_0x2c8009,_0x12f767){return function(_0x4b3f03){if(_0x4b3f03){return _0x4b3f03[_0x507a('0x25')](_0x2c8009)[_0x507a('0x26')](function(_0x473e62){return _0x473e62;});}return null;};}function removeEntity(_0x48a6bd,_0x45b443){return function(_0x5aaef0){if(_0x5aaef0){return _0x5aaef0[_0x507a('0x27')]()[_0x507a('0x26')](function(){var _0x4bba11=_0x5aaef0[_0x507a('0x28')]({'plain':!![]});var _0x50454f=_0x507a('0x29');return db['UserProfileResource'][_0x507a('0x27')]({'where':{'type':_0x50454f,'resourceId':_0x4bba11['id']}})[_0x507a('0x26')](function(){return _0x5aaef0;});})['then'](function(){_0x48a6bd['status'](0xcc)[_0x507a('0x2a')]();});}};}function handleEntityNotFound(_0x54c9e9,_0x813588){return function(_0x5dad19){if(!_0x5dad19){_0x54c9e9[_0x507a('0x19')](0x194);}return _0x5dad19;};}function handleError(_0x2164eb,_0x34816f){_0x34816f=_0x34816f||0x1f4;return function(_0xecce3){logger['error'](_0xecce3[_0x507a('0x2b')]);if(_0xecce3['name']){delete _0xecce3[_0x507a('0x2c')];}_0x2164eb[_0x507a('0x1a')](_0x34816f)[_0x507a('0x2d')](_0xecce3);};}exports[_0x507a('0x2e')]=function(_0x1cd717,_0x3cd494){var _0x46f75b={},_0x5e78f6={},_0x41c6fa={'count':0x0,'rows':[]};var _0x56b619=_[_0x507a('0x2f')](db[_0x507a('0x30')][_0x507a('0x31')],function(_0xd84480){return{'name':_0xd84480[_0x507a('0x32')],'type':_0xd84480['type'][_0x507a('0x33')]};});_0x5e78f6[_0x507a('0x34')]=_[_0x507a('0x2f')](_0x56b619,_0x507a('0x2c'));_0x5e78f6[_0x507a('0x35')]=_['keys'](_0x1cd717['query']);_0x5e78f6[_0x507a('0x36')]=_[_0x507a('0x37')](_0x5e78f6[_0x507a('0x34')],_0x5e78f6[_0x507a('0x35')]);_0x46f75b[_0x507a('0x38')]=_[_0x507a('0x37')](_0x5e78f6[_0x507a('0x34')],qs[_0x507a('0x39')](_0x1cd717[_0x507a('0x35')][_0x507a('0x39')]));_0x46f75b['attributes']=_0x46f75b[_0x507a('0x38')]['length']?_0x46f75b[_0x507a('0x38')]:_0x5e78f6[_0x507a('0x34')];if(!_0x1cd717[_0x507a('0x35')][_0x507a('0x3a')]('nolimit')){_0x46f75b['limit']=qs['limit'](_0x1cd717[_0x507a('0x35')][_0x507a('0x1e')]);_0x46f75b[_0x507a('0x1c')]=qs[_0x507a('0x1c')](_0x1cd717[_0x507a('0x35')][_0x507a('0x1c')]);}_0x46f75b[_0x507a('0x3b')]=qs[_0x507a('0x3c')](_0x1cd717[_0x507a('0x35')][_0x507a('0x3c')]);_0x46f75b[_0x507a('0x3d')]=qs[_0x507a('0x36')](_[_0x507a('0x3e')](_0x1cd717['query'],_0x5e78f6[_0x507a('0x36')]),_0x56b619);if(_0x1cd717[_0x507a('0x35')][_0x507a('0x3f')]){_0x46f75b['where']=_['merge'](_0x46f75b['where'],{'$or':_['map'](_0x56b619,function(_0x11bb37){if(_0x11bb37[_0x507a('0x40')]!==_0x507a('0x41')){var _0x5d8ba8={};_0x5d8ba8[_0x11bb37[_0x507a('0x2c')]]={'$like':'%'+_0x1cd717[_0x507a('0x35')][_0x507a('0x3f')]+'%'};return _0x5d8ba8;}})});}_0x46f75b=_[_0x507a('0x42')]({},_0x46f75b,_0x1cd717['options']);var _0x12a925={'where':_0x46f75b[_0x507a('0x3d')]};return db['AnalyticCustomReport'][_0x507a('0x1f')](_0x12a925)[_0x507a('0x26')](function(_0x214614){_0x41c6fa[_0x507a('0x1f')]=_0x214614;if(_0x1cd717[_0x507a('0x35')][_0x507a('0x43')]){_0x46f75b[_0x507a('0x44')]=[{'all':!![]}];}return db[_0x507a('0x30')][_0x507a('0x45')](_0x46f75b);})[_0x507a('0x26')](function(_0x59978d){_0x41c6fa[_0x507a('0x46')]=_0x59978d;return _0x41c6fa;})[_0x507a('0x26')](respondWithFilteredResult(_0x3cd494,_0x46f75b))[_0x507a('0x47')](handleError(_0x3cd494,null));};exports[_0x507a('0x48')]=function(_0x2e040e,_0x91d3f0){var _0x23f62c={'raw':![],'where':{'id':_0x2e040e[_0x507a('0x49')]['id']}},_0x5e1c68={};_0x5e1c68[_0x507a('0x34')]=_[_0x507a('0x4a')](db['AnalyticCustomReport'][_0x507a('0x31')]);_0x5e1c68[_0x507a('0x35')]=_[_0x507a('0x4a')](_0x2e040e[_0x507a('0x35')]);_0x5e1c68[_0x507a('0x36')]=_['intersection'](_0x5e1c68[_0x507a('0x34')],_0x5e1c68[_0x507a('0x35')]);_0x23f62c[_0x507a('0x38')]=_[_0x507a('0x37')](_0x5e1c68['model'],qs[_0x507a('0x39')](_0x2e040e[_0x507a('0x35')][_0x507a('0x39')]));_0x23f62c[_0x507a('0x38')]=_0x23f62c['attributes'][_0x507a('0x4b')]?_0x23f62c['attributes']:_0x5e1c68[_0x507a('0x34')];if(_0x2e040e['query'][_0x507a('0x43')]){_0x23f62c[_0x507a('0x44')]=[{'all':!![]}];}_0x23f62c=_[_0x507a('0x42')]({},_0x23f62c,_0x2e040e[_0x507a('0x4c')]);return db[_0x507a('0x30')][_0x507a('0x4d')](_0x23f62c)[_0x507a('0x26')](handleEntityNotFound(_0x91d3f0,null))[_0x507a('0x26')](respondWithResult(_0x91d3f0,null))[_0x507a('0x47')](handleError(_0x91d3f0,null));};exports[_0x507a('0x4e')]=function(_0x9b1e79,_0x24b634){return db[_0x507a('0x30')][_0x507a('0x4e')](_0x9b1e79[_0x507a('0x4f')],{})[_0x507a('0x26')](function(_0x36e19a){var _0x5c6f79=_0x9b1e79[_0x507a('0x50')][_0x507a('0x28')]({'plain':!![]});if(!_0x5c6f79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c6f79[_0x507a('0x51')]===_0x507a('0x50')){var _0x7ea683=_0x36e19a['get']({'plain':!![]});var _0x4250cd='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x4250cd,'userProfileId':_0x5c6f79[_0x507a('0x52')]},'raw':!![]})['then'](function(_0x183fa6){if(_0x183fa6&&_0x183fa6[_0x507a('0x53')]===0x0){return db['UserProfileResource'][_0x507a('0x4e')]({'name':_0x7ea683[_0x507a('0x2c')],'resourceId':_0x7ea683['id'],'type':_0x507a('0x29'),'sectionId':_0x183fa6['id']},{})[_0x507a('0x26')](function(){return _0x36e19a;});}else{return _0x36e19a;}})[_0x507a('0x47')](function(_0x4efb16){logger[_0x507a('0x54')](_0x507a('0x55'),_0x4efb16);throw _0x4efb16;});}return _0x36e19a;})[_0x507a('0x26')](respondWithResult(_0x24b634,0xc9))[_0x507a('0x47')](handleError(_0x24b634,null));};exports['update']=function(_0x339b14,_0xb1fc31){if(_0x339b14[_0x507a('0x4f')]['id']){delete _0x339b14['body']['id'];}return db[_0x507a('0x30')][_0x507a('0x4d')]({'where':{'id':_0x339b14['params']['id']}})[_0x507a('0x26')](handleEntityNotFound(_0xb1fc31,null))[_0x507a('0x26')](saveUpdates(_0x339b14[_0x507a('0x4f')],null))[_0x507a('0x26')](respondWithResult(_0xb1fc31,null))[_0x507a('0x47')](handleError(_0xb1fc31,null));};exports[_0x507a('0x27')]=function(_0x305024,_0x31b89b){return db[_0x507a('0x30')][_0x507a('0x4d')]({'where':{'id':_0x305024[_0x507a('0x49')]['id']}})[_0x507a('0x26')](handleEntityNotFound(_0x31b89b,null))[_0x507a('0x26')](removeEntity(_0x31b89b,null))[_0x507a('0x47')](handleError(_0x31b89b,null));};exports[_0x507a('0x56')]=function(_0x47d2ea,_0x39e4ca){var _0x797d49=0xa;var _0x16f569=[_0x507a('0x57'),_0x507a('0x58'),_0x507a('0x59'),_0x507a('0x5a')];var _0xbc4cf7={'SUM':_0x507a('0x5b'),'COUNT':_0x507a('0x5c'),'COUNT DISTINCT':_0x507a('0x5d'),'MAX':_0x507a('0x5e'),'MIN':_0x507a('0x5f'),'AVG':_0x507a('0x60'),'GROUP_CONCAT':_0x507a('0x61'),'GROUP_CONCAT ASC':_0x507a('0x62'),'GROUP_CONCAT DESC':_0x507a('0x63')};var _0x4891e1={'SEC_TO_TIME':_0x507a('0x64'),'DATE':_0x507a('0x65'),'HOUR':_0x507a('0x66'),'ROUND':_0x507a('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4451ce=function(_0x5f6263){return!_['includes']([_0x507a('0x68'),_0x507a('0x69'),'IS\x20EMPTY',_0x507a('0x6a')],_0x5f6263);};var _0x3a90cd=function(_0x224dc2){if(!_0x224dc2||!_0x224dc2[_0x507a('0x6b')][_0x507a('0x4b')]){return'';}for(var _0x2fa856='(',_0x5ad1ac=0x0;_0x5ad1ac<_0x224dc2[_0x507a('0x6b')]['length'];_0x5ad1ac+=0x1){_0x5ad1ac>0x0&&(_0x2fa856+='\x20'+_0x224dc2[_0x507a('0x6c')]+'\x20');_0x2fa856+=_0x224dc2[_0x507a('0x6b')][_0x5ad1ac][_0x507a('0x6d')]?_0x3a90cd(_0x224dc2[_0x507a('0x6b')][_0x5ad1ac][_0x507a('0x6d')]):_0x224dc2[_0x507a('0x6b')][_0x5ad1ac][_0x507a('0x6e')]+'\x20'+_0x224dc2[_0x507a('0x6b')][_0x5ad1ac][_0x507a('0x6f')]+(_0x4451ce(_0x224dc2[_0x507a('0x6b')][_0x5ad1ac][_0x507a('0x6f')])?'\x20'+_0x224dc2['rules'][_0x5ad1ac][_0x507a('0x70')]:'');}return _0x2fa856+')';};var _0x3ef231={'where':{'id':_0x47d2ea[_0x507a('0x49')]['id']}},_0x5eb65e,_0x103968,_0x35a67a,_0x1aac9f,_0x1ceeef;_0x3ef231=_[_0x507a('0x42')]({},_0x3ef231,_0x47d2ea[_0x507a('0x4c')]);return db[_0x507a('0x30')][_0x507a('0x4d')](_0x3ef231)[_0x507a('0x26')](function(_0x4be962){if(_0x4be962){_0x5eb65e=_0x4be962;return _0x4be962['getFields']();}return null;})['then'](function(_0x263e38){if(_0x263e38){if(!_0x263e38['length']){throw new db['Sequelize'][(_0x507a('0x71'))](_0x507a('0x72'),0x193);}_0x103968=_0x263e38;return db[_0x507a('0x73')][_0x507a('0x45')]({'raw':!![]});}return null;})[_0x507a('0x26')](function(_0x3a4302){if(_0x3a4302){_0x35a67a=_[_0x507a('0x74')](_0x3a4302,'id');var _0x3f79e4;var _0x4dd5ba=squel[_0x507a('0x75')]();_0x4dd5ba['from'](_0x5eb65e[_0x507a('0x76')]);for(var _0x5a9208=0x0;_0x5a9208<_0x103968['length'];_0x5a9208+=0x1){_0x3f79e4=_0x103968[_0x5a9208][_0x507a('0x77')]?_0x35a67a[_0x103968[_0x5a9208][_0x507a('0x77')]][_0x507a('0x78')]:_0x103968[_0x5a9208][_0x507a('0x6e')];_0x3f79e4=_0x103968[_0x5a9208]['function']?_[_0x507a('0x79')](_0xbc4cf7[_0x103968[_0x5a9208][_0x507a('0x7a')]],'%s',_0x3f79e4):_0x3f79e4;_0x3f79e4=_0x103968[_0x5a9208]['format']?_[_0x507a('0x79')](_0x4891e1[_0x103968[_0x5a9208][_0x507a('0x7b')]],'%s',_0x3f79e4):_0x3f79e4;if(_0x103968[_0x5a9208][_0x507a('0x7c')]){_0x4dd5ba[_0x507a('0x6d')](_0x3f79e4);}_0x103968[_0x5a9208][_0x507a('0x7d')]&&_0x4dd5ba[_0x507a('0x3b')](_0x3f79e4,_0x103968[_0x5a9208][_0x507a('0x7d')]===_0x507a('0x7e')?![]:!![]);_0x4dd5ba[_0x507a('0x6e')](_0x3f79e4,_0x103968[_0x5a9208][_0x507a('0x7f')]||_0x3f79e4);}if(_0x5eb65e['joins']){_0x5eb65e[_0x507a('0x80')]=JSON[_0x507a('0x81')](_0x5eb65e['joins']);for(var _0x30a01e=0x0;_0x30a01e<_0x5eb65e[_0x507a('0x80')][_0x507a('0x4b')];_0x30a01e+=0x1){if(_0x5eb65e[_0x507a('0x80')][_0x30a01e][_0x507a('0x40')]&&_[_0x507a('0x82')](_0x16f569,_0x5eb65e['joins'][_0x30a01e][_0x507a('0x40')])&&_0x5eb65e[_0x507a('0x80')][_0x30a01e][_0x507a('0x83')]&&_0x5eb65e[_0x507a('0x80')][_0x30a01e][_0x507a('0x84')]&&_0x5eb65e[_0x507a('0x80')][_0x30a01e][_0x507a('0x85')]){_0x4dd5ba[_0x5eb65e[_0x507a('0x80')][_0x30a01e][_0x507a('0x40')]](_0x5eb65e['joins'][_0x30a01e][_0x507a('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5eb65e[_0x507a('0x76')],_0x5eb65e[_0x507a('0x80')][_0x30a01e][_0x507a('0x83')],_0x5eb65e[_0x507a('0x80')][_0x30a01e][_0x507a('0x84')],_0x5eb65e['joins'][_0x30a01e]['foreignKey']));}}}if(_0x5eb65e['conditions']){_0x5eb65e['conditions']=JSON[_0x507a('0x81')](_0x5eb65e[_0x507a('0x86')]);_0x4dd5ba['where'](_0x3a90cd(_0x5eb65e['conditions'][_0x507a('0x6d')]));}_0x1ceeef=_0x4dd5ba['clone']();_0x4dd5ba[_0x507a('0x1e')](_0x797d49);_0x4dd5ba['offset'](0x0);logger[_0x507a('0x87')](_0x507a('0x88'),_0x4dd5ba['toString']());return dbH[_0x507a('0x89')][_0x507a('0x35')](_0x4dd5ba[_0x507a('0x8a')](),{'type':dbH['sequelize'][_0x507a('0x8b')][_0x507a('0x8c')]});}})[_0x507a('0x26')](respondWithResult(_0x39e4ca,null))[_0x507a('0x47')](handleError(_0x39e4ca,null));};function runReport(_0x1eec9e,_0x17a854,_0x3faf3c){var _0x338bc1=_0x17a854[_0x507a('0x2c')];var _0x3b1b68=0xa;var _0x1981f6=[_0x507a('0x57'),_0x507a('0x58'),_0x507a('0x59'),_0x507a('0x5a')];var _0x4889d6={'SUM':_0x507a('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x507a('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x507a('0x60'),'GROUP_CONCAT':_0x507a('0x61'),'GROUP_CONCAT ASC':_0x507a('0x62'),'GROUP_CONCAT DESC':_0x507a('0x63')};var _0x210960={'SEC_TO_TIME':_0x507a('0x64'),'DATE':_0x507a('0x65'),'HOUR':_0x507a('0x66'),'ROUND':_0x507a('0x67'),'UNIX_TIMESTAMP':_0x507a('0x8d')};var _0x3777c5=function(_0x13842a){return!_[_0x507a('0x82')]([_0x507a('0x68'),_0x507a('0x69'),_0x507a('0x8e'),'IS\x20NOT\x20EMPTY'],_0x13842a);};var _0x197c6f=function(_0x53d01e){if(!_0x53d01e||!_0x53d01e[_0x507a('0x6b')][_0x507a('0x4b')]){return'';}for(var _0x2afdf9='(',_0x442f60=0x0;_0x442f60<_0x53d01e[_0x507a('0x6b')][_0x507a('0x4b')];_0x442f60+=0x1){_0x442f60>0x0&&(_0x2afdf9+='\x20'+_0x53d01e[_0x507a('0x6c')]+'\x20');_0x2afdf9+=_0x53d01e['rules'][_0x442f60]['group']?_0x197c6f(_0x53d01e['rules'][_0x442f60][_0x507a('0x6d')]):_0x53d01e[_0x507a('0x6b')][_0x442f60]['field']+'\x20'+_0x53d01e[_0x507a('0x6b')][_0x442f60][_0x507a('0x6f')]+(_0x3777c5(_0x53d01e[_0x507a('0x6b')][_0x442f60]['condition'])?'\x20'+_0x53d01e[_0x507a('0x6b')][_0x442f60][_0x507a('0x70')]:'');}return _0x2afdf9+')';};var _0x6f8d8={'where':{'id':_0x1eec9e['id']}},_0x12f6b6,_0x4cd6cd,_0x13f22d,_0x2c5df8,_0x4f0818;_0x6f8d8=_[_0x507a('0x42')]({},_0x6f8d8,_0x3faf3c);return db[_0x507a('0x30')][_0x507a('0x4d')](_0x6f8d8)['then'](function(_0x2b49b0){if(_0x2b49b0){_0x12f6b6=_0x2b49b0;return _0x2b49b0[_0x507a('0x8f')]();}return null;})[_0x507a('0x26')](function(_0x4411c5){if(_0x4411c5){if(!_0x4411c5[_0x507a('0x4b')]){throw new db[(_0x507a('0x90'))][(_0x507a('0x71'))](_0x507a('0x72'),0x193);}_0x4cd6cd=_0x4411c5;return db[_0x507a('0x73')][_0x507a('0x45')]({'raw':!![]});}return null;})[_0x507a('0x26')](function(_0x5977f3){if(_0x5977f3){_0x13f22d=_[_0x507a('0x74')](_0x5977f3,'id');var _0x3089c3;var _0x2cb915=squel[_0x507a('0x75')]();_0x2cb915[_0x507a('0x91')](_0x12f6b6[_0x507a('0x76')]);for(var _0x40265e=0x0;_0x40265e<_0x4cd6cd[_0x507a('0x4b')];_0x40265e+=0x1){_0x3089c3=_0x4cd6cd[_0x40265e][_0x507a('0x77')]?_0x13f22d[_0x4cd6cd[_0x40265e][_0x507a('0x77')]][_0x507a('0x78')]:_0x4cd6cd[_0x40265e][_0x507a('0x6e')];_0x3089c3=_0x4cd6cd[_0x40265e]['function']?_['replace'](_0x4889d6[_0x4cd6cd[_0x40265e]['function']],'%s',_0x3089c3):_0x3089c3;_0x3089c3=_0x4cd6cd[_0x40265e][_0x507a('0x7b')]?_['replace'](_0x210960[_0x4cd6cd[_0x40265e][_0x507a('0x7b')]],'%s',_0x3089c3):_0x3089c3;if(_0x4cd6cd[_0x40265e][_0x507a('0x7c')]){_0x2cb915['group'](_0x3089c3);}_0x4cd6cd[_0x40265e][_0x507a('0x7d')]&&_0x2cb915[_0x507a('0x3b')](_0x3089c3,_0x4cd6cd[_0x40265e]['orderBy']===_0x507a('0x7e')?![]:!![]);_0x2cb915[_0x507a('0x6e')](_0x3089c3,_0x4cd6cd[_0x40265e][_0x507a('0x7f')]||_0x3089c3);}if(_0x12f6b6[_0x507a('0x80')]){_0x12f6b6['joins']=JSON[_0x507a('0x81')](_0x12f6b6['joins']);for(var _0x3f805f=0x0;_0x3f805f<_0x12f6b6['joins'][_0x507a('0x4b')];_0x3f805f+=0x1){if(_0x12f6b6[_0x507a('0x80')][_0x3f805f][_0x507a('0x40')]&&_[_0x507a('0x82')](_0x1981f6,_0x12f6b6['joins'][_0x3f805f][_0x507a('0x40')])&&_0x12f6b6[_0x507a('0x80')][_0x3f805f]['parentKey']&&_0x12f6b6[_0x507a('0x80')][_0x3f805f][_0x507a('0x84')]&&_0x12f6b6[_0x507a('0x80')][_0x3f805f][_0x507a('0x85')]){_0x2cb915[_0x12f6b6[_0x507a('0x80')][_0x3f805f]['type']](_0x12f6b6[_0x507a('0x80')][_0x3f805f][_0x507a('0x84')],null,util['format'](_0x507a('0x92'),_0x12f6b6[_0x507a('0x76')],_0x12f6b6[_0x507a('0x80')][_0x3f805f][_0x507a('0x83')],_0x12f6b6[_0x507a('0x80')][_0x3f805f][_0x507a('0x84')],_0x12f6b6[_0x507a('0x80')][_0x3f805f][_0x507a('0x85')]));}}}if(_0x12f6b6[_0x507a('0x86')]){_0x12f6b6[_0x507a('0x86')]=JSON[_0x507a('0x81')](_0x12f6b6[_0x507a('0x86')]);_0x2cb915[_0x507a('0x3d')](_0x197c6f(_0x12f6b6[_0x507a('0x86')][_0x507a('0x6d')]));}_0x4f0818=_0x2cb915['clone']();_0x2cb915[_0x507a('0x1e')](_0x3b1b68);_0x2cb915['offset'](0x0);return;}})['then'](function(){if(_0x17a854[_0x507a('0x93')]===_0x507a('0x94')){return null;}var _0x574777=_[_0x507a('0x42')](_0x17a854,{'name':_0x17a854[_0x507a('0x95')]||_0x17a854['name']||_0x12f6b6[_0x507a('0x2c')],'basename':_0x338bc1,'savename':util[_0x507a('0x7b')](_0x507a('0x96'),_0x17a854[_0x507a('0x2c')]||_0x12f6b6[_0x507a('0x2c')],require(_0x507a('0x97'))[_0x507a('0x98')](0x4),_0x17a854[_0x507a('0x93')]||_0x507a('0x99')),'reportId':_0x12f6b6['id'],'reportType':'custom'});return db[_0x507a('0x9a')]['create'](_0x574777,{'raw':!![]});})[_0x507a('0x26')](function(_0x5ec887){if(_0x12f6b6[_0x507a('0x76')]===_0x507a('0x9b')){_0x4f0818[_0x507a('0x3d')](_0x12f6b6['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x17a854[_0x507a('0x9c')],_0x17a854[_0x507a('0x9d')]);}else{_0x4f0818[_0x507a('0x3d')](_0x12f6b6[_0x507a('0x76')]+_0x507a('0x9e'),_0x17a854[_0x507a('0x9c')],_0x17a854['endDate']);}if(_0x5ec887){logger[_0x507a('0x9f')](_0x507a('0xa0'),_0x4f0818['toString']());require(_0x507a('0xa1'))[_0x507a('0xa2')](path[_0x507a('0x57')](__dirname,_0x507a('0xa3'),_0x5ec887['output']),[_0x5ec887['id'],_0x4f0818[_0x507a('0x8a')](),path['join'](__dirname,_0x507a('0xa4'),_0x5ec887[_0x507a('0xa5')]),_0x338bc1]);return _0x5ec887;}else{var _0x5940cf=squel['select']();_0x5940cf[_0x507a('0x91')]('('+_0x4f0818['toString']()+')',_0x507a('0xa6'));_0x5940cf[_0x507a('0x6e')]('COUNT(*)',_0x507a('0x1f'));_0x4f0818[_0x507a('0x1e')](_0x17a854['limit']||_0x3b1b68);_0x4f0818[_0x507a('0x1c')](_0x17a854['offset']||0x0);return dbH[_0x507a('0x89')][_0x507a('0x35')](_0x5940cf[_0x507a('0x8a')](),{'type':dbH[_0x507a('0x89')]['QueryTypes'][_0x507a('0x8c')]})['then'](function(_0x466eca){if(!_0x466eca[_0x507a('0x4b')]){_0x2c5df8=0x0;}else{_0x2c5df8=_0x466eca[0x0]['count']||0x0;}return dbH['sequelize'][_0x507a('0x35')](_0x4f0818[_0x507a('0x8a')](),{'type':dbH[_0x507a('0x89')][_0x507a('0x8b')][_0x507a('0x8c')]});})[_0x507a('0x26')](function(_0x5ecc21){return{'rows':_0x5ecc21||[],'count':_0x2c5df8};});}});}exports['run']=function(_0x157a15,_0x1c5a3e){return runReport(_0x157a15[_0x507a('0x49')],_0x157a15[_0x507a('0x35')],_0x157a15[_0x507a('0x4c')])[_0x507a('0x26')](respondWithResult(_0x1c5a3e,null))[_0x507a('0x47')](handleError(_0x1c5a3e,null));};exports['runReport']=runReport;exports[_0x507a('0x35')]=function(_0x543ed9,_0x41e14b){var _0x5617e2=0xa;var _0xdf2647=[_0x507a('0x57'),_0x507a('0x58'),_0x507a('0x59'),_0x507a('0x5a')];var _0x32f1cc={'SUM':'SUM(%s)','COUNT':_0x507a('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x507a('0x60'),'GROUP_CONCAT':_0x507a('0x61'),'GROUP_CONCAT ASC':_0x507a('0x62'),'GROUP_CONCAT DESC':_0x507a('0x63')};var _0x2bb6e3={'SEC_TO_TIME':_0x507a('0x64'),'DATE':'DATE(%s)','HOUR':_0x507a('0x66'),'ROUND':_0x507a('0x67'),'UNIX_TIMESTAMP':_0x507a('0x8d')};var _0x4212ce=function(_0x2f1927){return!_[_0x507a('0x82')]([_0x507a('0x68'),_0x507a('0x69'),_0x507a('0x8e'),_0x507a('0x6a')],_0x2f1927);};var _0x481931=function(_0x218bb3){if(!_0x218bb3||!_0x218bb3[_0x507a('0x6b')][_0x507a('0x4b')]){return'';}for(var _0x49670e='(',_0x3b74a5=0x0;_0x3b74a5<_0x218bb3[_0x507a('0x6b')][_0x507a('0x4b')];_0x3b74a5+=0x1){_0x3b74a5>0x0&&(_0x49670e+='\x20'+_0x218bb3['operator']+'\x20');_0x49670e+=_0x218bb3[_0x507a('0x6b')][_0x3b74a5][_0x507a('0x6d')]?_0x481931(_0x218bb3[_0x507a('0x6b')][_0x3b74a5]['group']):_0x218bb3['rules'][_0x3b74a5][_0x507a('0x6e')]+'\x20'+_0x218bb3[_0x507a('0x6b')][_0x3b74a5][_0x507a('0x6f')]+(_0x4212ce(_0x218bb3[_0x507a('0x6b')][_0x3b74a5][_0x507a('0x6f')])?'\x20'+_0x218bb3[_0x507a('0x6b')][_0x3b74a5]['value']:'');}return _0x49670e+')';};var _0x1240d1={'where':{'id':_0x543ed9[_0x507a('0x49')]['id']}},_0x24b67a,_0x5156fb,_0x7c01e5,_0x3a73de,_0x30a6be;_0x1240d1=_[_0x507a('0x42')]({},_0x1240d1,_0x543ed9[_0x507a('0x4c')]);return db[_0x507a('0x30')][_0x507a('0x4d')](_0x1240d1)[_0x507a('0x26')](function(_0x2f2a9b){if(_0x2f2a9b){_0x24b67a=_0x2f2a9b;return _0x2f2a9b['getFields']();}return null;})[_0x507a('0x26')](function(_0x596c8b){if(_0x596c8b){if(!_0x596c8b[_0x507a('0x4b')]){throw new db[(_0x507a('0x90'))][(_0x507a('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5156fb=_0x596c8b;return db[_0x507a('0x73')]['findAll']({'raw':!![]});}return null;})[_0x507a('0x26')](function(_0x535bf0){if(_0x535bf0){_0x7c01e5=_[_0x507a('0x74')](_0x535bf0,'id');var _0xb93418;var _0x4b4cbd=squel['select']();_0x4b4cbd['from'](_0x24b67a[_0x507a('0x76')]);for(var _0x82e72=0x0;_0x82e72<_0x5156fb[_0x507a('0x4b')];_0x82e72+=0x1){_0xb93418=_0x5156fb[_0x82e72][_0x507a('0x77')]?_0x7c01e5[_0x5156fb[_0x82e72][_0x507a('0x77')]]['metric']:_0x5156fb[_0x82e72][_0x507a('0x6e')];_0xb93418=_0x5156fb[_0x82e72][_0x507a('0x7a')]?_[_0x507a('0x79')](_0x32f1cc[_0x5156fb[_0x82e72][_0x507a('0x7a')]],'%s',_0xb93418):_0xb93418;_0xb93418=_0x5156fb[_0x82e72][_0x507a('0x7b')]?_['replace'](_0x2bb6e3[_0x5156fb[_0x82e72][_0x507a('0x7b')]],'%s',_0xb93418):_0xb93418;if(_0x5156fb[_0x82e72][_0x507a('0x7c')]){_0x4b4cbd[_0x507a('0x6d')](_0xb93418);}_0x5156fb[_0x82e72][_0x507a('0x7d')]&&_0x4b4cbd[_0x507a('0x3b')](_0xb93418,_0x5156fb[_0x82e72][_0x507a('0x7d')]===_0x507a('0x7e')?![]:!![]);_0x4b4cbd[_0x507a('0x6e')](_0xb93418,_0x5156fb[_0x82e72][_0x507a('0x7f')]||_0xb93418);}if(_0x24b67a[_0x507a('0x80')]){_0x24b67a[_0x507a('0x80')]=JSON['parse'](_0x24b67a['joins']);for(var _0x42e59e=0x0;_0x42e59e<_0x24b67a['joins'][_0x507a('0x4b')];_0x42e59e+=0x1){if(_0x24b67a[_0x507a('0x80')][_0x42e59e][_0x507a('0x40')]&&_[_0x507a('0x82')](_0xdf2647,_0x24b67a[_0x507a('0x80')][_0x42e59e][_0x507a('0x40')])&&_0x24b67a[_0x507a('0x80')][_0x42e59e][_0x507a('0x83')]&&_0x24b67a[_0x507a('0x80')][_0x42e59e]['foreignTable']&&_0x24b67a['joins'][_0x42e59e]['foreignKey']){_0x4b4cbd[_0x24b67a['joins'][_0x42e59e][_0x507a('0x40')]](_0x24b67a['joins'][_0x42e59e]['foreignTable'],null,util[_0x507a('0x7b')](_0x507a('0x92'),_0x24b67a[_0x507a('0x76')],_0x24b67a['joins'][_0x42e59e][_0x507a('0x83')],_0x24b67a['joins'][_0x42e59e][_0x507a('0x84')],_0x24b67a[_0x507a('0x80')][_0x42e59e][_0x507a('0x85')]));}}}if(_0x24b67a[_0x507a('0x86')]){_0x24b67a[_0x507a('0x86')]=JSON[_0x507a('0x81')](_0x24b67a['conditions']);_0x4b4cbd[_0x507a('0x3d')](_0x481931(_0x24b67a['conditions']['group']));}_0x30a6be=_0x4b4cbd[_0x507a('0xa7')]();_0x4b4cbd[_0x507a('0x1e')](_0x5617e2);_0x4b4cbd[_0x507a('0x1c')](0x0);logger[_0x507a('0x87')](_0x507a('0x88'),_0x4b4cbd['toString']());return dbH[_0x507a('0x89')]['query'](_0x4b4cbd['toString'](),{'type':dbH[_0x507a('0x89')][_0x507a('0x8b')][_0x507a('0x8c')]});}})[_0x507a('0x26')](function(){return{'sql':_0x30a6be[_0x507a('0x8a')]()};})['then'](respondWithResult(_0x41e14b,null))[_0x507a('0x47')](handleError(_0x41e14b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8af8f00..82d7a29 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 _0x798d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','util'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x798d,0xdb));var _0xd798=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x798d[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0xd798('0x0'));var logger=require('../../config/logger')(_0xd798('0x1'));var moment=require(_0xd798('0x2'));var BPromise=require(_0xd798('0x3'));var rp=require(_0xd798('0x4'));var fs=require('fs');var path=require(_0xd798('0x5'));var rimraf=require(_0xd798('0x6'));var config=require(_0xd798('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0xd798('0x8')]=function(_0x59329b,_0x91ceee){return _0x59329b[_0xd798('0x9')](_0xd798('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ce2=['exports','define','AnalyticCustomReport','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./analyticCustomReport.attributes'];(function(_0x269732,_0x1b3473){var _0x23e9b4=function(_0x142f10){while(--_0x142f10){_0x269732['push'](_0x269732['shift']());}};_0x23e9b4(++_0x1b3473);}(_0x2ce2,0x1e3));var _0x22ce=function(_0x14d9b7,_0x41650d){_0x14d9b7=_0x14d9b7-0x0;var _0x254b92=_0x2ce2[_0x14d9b7];return _0x254b92;};'use strict';var _=require(_0x22ce('0x0'));var util=require(_0x22ce('0x1'));var logger=require(_0x22ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0x22ce('0x3'));var rp=require(_0x22ce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22ce('0x5'));var config=require('../../config/environment');var attributes=require(_0x22ce('0x6'));module[_0x22ce('0x7')]=function(_0x2c9235,_0x4e8c20){return _0x2c9235[_0x22ce('0x8')](_0x22ce('0x9'),attributes,{'tableName':'analytics_custom_reports','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 9c38abb..de24a5a 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 _0x532c=['../../config/environment','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3e0d88,_0x3c850f){var _0x47cdc0=function(_0x40fb30){while(--_0x40fb30){_0x3e0d88['push'](_0x3e0d88['shift']());}};_0x47cdc0(++_0x3c850f);}(_0x532c,0x109));var _0xc532=function(_0x273f1b,_0x22b88f){_0x273f1b=_0x273f1b-0x0;var _0x38aab0=_0x532c[_0x273f1b];return _0x38aab0;};'use strict';var _=require(_0xc532('0x0'));var util=require(_0xc532('0x1'));var moment=require(_0xc532('0x2'));var BPromise=require(_0xc532('0x3'));var rs=require(_0xc532('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc532('0x5'))['db'];var utils=require(_0xc532('0x6'));var logger=require(_0xc532('0x7'))('rpc');var config=require(_0xc532('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc532('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x341f90,_0x261770,_0x55a08f){return new BPromise(function(_0x82476d,_0x11eca8){return client[_0xc532('0xa')](_0x341f90,_0x55a08f)['then'](function(_0x230966){logger[_0xc532('0xb')](_0xc532('0xc'),_0x261770,_0xc532('0xd'));logger['debug'](_0xc532('0xe'),_0x261770,_0xc532('0xd'),JSON[_0xc532('0xf')](_0x230966));if(_0x230966[_0xc532('0x10')]){if(_0x230966[_0xc532('0x10')][_0xc532('0x11')]===0x1f4){logger[_0xc532('0x10')](_0xc532('0xc'),_0x261770,_0x230966[_0xc532('0x10')][_0xc532('0x12')]);return _0x11eca8(_0x230966['error'][_0xc532('0x12')]);}logger[_0xc532('0x10')](_0xc532('0xc'),_0x261770,_0x230966[_0xc532('0x10')]['message']);return _0x82476d(_0x230966[_0xc532('0x10')]['message']);}else{logger[_0xc532('0xb')](_0xc532('0xc'),_0x261770,_0xc532('0xd'));_0x82476d(_0x230966[_0xc532('0x13')][_0xc532('0x12')]);}})[_0xc532('0x14')](function(_0x98f7b1){logger[_0xc532('0x10')](_0xc532('0xc'),_0x261770,_0x98f7b1);_0x11eca8(_0x98f7b1);});});} \ No newline at end of file +var _0x09eb=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x09eb,0x103));var _0xb09e=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0x09eb[_0x5a99db];return _0x3aad62;};'use strict';var _=require(_0xb09e('0x0'));var util=require(_0xb09e('0x1'));var moment=require(_0xb09e('0x2'));var BPromise=require(_0xb09e('0x3'));var rs=require(_0xb09e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb09e('0x5'))['db'];var utils=require(_0xb09e('0x6'));var logger=require('../../config/logger')(_0xb09e('0x7'));var config=require(_0xb09e('0x8'));var jayson=require(_0xb09e('0x9'));var client=jayson[_0xb09e('0xa')][_0xb09e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x302fb8,_0x3cbf51,_0x5006ae){return new BPromise(function(_0x360a5f,_0x2f92f3){return client[_0xb09e('0xc')](_0x302fb8,_0x5006ae)[_0xb09e('0xd')](function(_0x29cf13){logger['info'](_0xb09e('0xe'),_0x3cbf51,_0xb09e('0xf'));logger[_0xb09e('0x10')](_0xb09e('0x11'),_0x3cbf51,_0xb09e('0xf'),JSON[_0xb09e('0x12')](_0x29cf13));if(_0x29cf13[_0xb09e('0x13')]){if(_0x29cf13[_0xb09e('0x13')]['code']===0x1f4){logger['error'](_0xb09e('0xe'),_0x3cbf51,_0x29cf13[_0xb09e('0x13')]['message']);return _0x2f92f3(_0x29cf13[_0xb09e('0x13')][_0xb09e('0x14')]);}logger[_0xb09e('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3cbf51,_0x29cf13[_0xb09e('0x13')][_0xb09e('0x14')]);return _0x360a5f(_0x29cf13['error']['message']);}else{logger[_0xb09e('0x15')](_0xb09e('0xe'),_0x3cbf51,_0xb09e('0xf'));_0x360a5f(_0x29cf13['result'][_0xb09e('0x14')]);}})[_0xb09e('0x16')](function(_0x93d710){logger[_0xb09e('0x13')](_0xb09e('0xe'),_0x3cbf51,_0x93d710);_0x2f92f3(_0x93d710);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 321da13..9fa96b5 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 _0x2f63=['../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3fad58,_0x52d780){var _0x135e78=function(_0x546e43){while(--_0x546e43){_0x3fad58['push'](_0x3fad58['shift']());}};_0x135e78(++_0x52d780);}(_0x2f63,0xe8));var _0x32f6=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0x2f63[_0x3d7022];return _0x40870b;};'use strict';var multer=require(_0x32f6('0x0'));var util=require(_0x32f6('0x1'));var path=require(_0x32f6('0x2'));var timeout=require(_0x32f6('0x3'));var express=require(_0x32f6('0x4'));var router=express[_0x32f6('0x5')]();var fs_extra=require(_0x32f6('0x6'));var auth=require(_0x32f6('0x7'));var interaction=require(_0x32f6('0x8'));var config=require(_0x32f6('0x9'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x32f6('0xa')](),controller['index']);router[_0x32f6('0xb')]('/:id',auth[_0x32f6('0xa')](),controller[_0x32f6('0xc')]);router[_0x32f6('0xb')](_0x32f6('0xd'),auth[_0x32f6('0xa')](),controller[_0x32f6('0xe')]);router[_0x32f6('0xb')](_0x32f6('0xf'),auth[_0x32f6('0xa')](),controller[_0x32f6('0x10')]);router[_0x32f6('0xb')](_0x32f6('0x11'),auth[_0x32f6('0xa')](),controller[_0x32f6('0x12')]);router[_0x32f6('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32f6('0x14')](_0x32f6('0x15'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x32f6('0xa')](),controller[_0x32f6('0x16')]);module[_0x32f6('0x17')]=router; \ No newline at end of file +var _0x387e=['preview','/:id/run','run','/:id/query','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/preview'];(function(_0xeb43f1,_0x16b60d){var _0x401a42=function(_0x5b40c8){while(--_0x5b40c8){_0xeb43f1['push'](_0xeb43f1['shift']());}};_0x401a42(++_0x16b60d);}(_0x387e,0x1c0));var _0xe387=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x387e[_0x236c89];return _0x3b2a15;};'use strict';var multer=require(_0xe387('0x0'));var util=require('util');var path=require(_0xe387('0x1'));var timeout=require(_0xe387('0x2'));var express=require(_0xe387('0x3'));var router=express[_0xe387('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe387('0x5'));var interaction=require(_0xe387('0x6'));var config=require(_0xe387('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xe387('0x8')]('/',auth[_0xe387('0x9')](),controller[_0xe387('0xa')]);router['get']('/:id',auth[_0xe387('0x9')](),controller['show']);router[_0xe387('0x8')](_0xe387('0xb'),auth[_0xe387('0x9')](),controller[_0xe387('0xc')]);router[_0xe387('0x8')](_0xe387('0xd'),auth['isAuthenticated'](),controller[_0xe387('0xe')]);router[_0xe387('0x8')](_0xe387('0xf'),auth[_0xe387('0x9')](),controller['query']);router[_0xe387('0x10')]('/',auth['isAuthenticated'](),controller[_0xe387('0x11')]);router[_0xe387('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe387('0x13')](_0xe387('0x14'),auth[_0xe387('0x9')](),controller[_0xe387('0x15')]);module[_0xe387('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 4d47642..986a28b 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x5bb99a,_0xdcf922){var _0x7b09cd=function(_0x25dc13){while(--_0x25dc13){_0x5bb99a['push'](_0x5bb99a['shift']());}};_0x7b09cd(++_0xdcf922);}(_0x6f47,0xc7));var _0x76f4=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x6f47[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x3377ef,_0xcd2120){var _0x3d2638=function(_0x5509c1){while(--_0x5509c1){_0x3377ef['push'](_0x3377ef['shift']());}};_0x3d2638(++_0xcd2120);}(_0xac9d,0x14d));var _0xdac9=function(_0x3d3590,_0x23bd12){_0x3d3590=_0x3d3590-0x0;var _0x1348ff=_0xac9d[_0x3d3590];return _0x1348ff;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 703835a..e0b87dc 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4ebb37,_0x53ebf3){_0x4ebb37=_0x4ebb37-0x0;var _0x156e72=_0xc6ac[_0x4ebb37];return _0x156e72;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x5a0d6e,_0x2b572b){var _0x11f186=function(_0x3012c3){while(--_0x3012c3){_0x5a0d6e['push'](_0x5a0d6e['shift']());}};_0x11f186(++_0x2b572b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x893974,_0x6e411a){_0x893974=_0x893974-0x0;var _0x3ff57d=_0x1cb9[_0x893974];return _0x3ff57d;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6ebbd2f..196ae17 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 _0x33a1=['./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x33a1,0x1bb));var _0x133a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x133a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x133a('0x1'));var moment=require('moment');var BPromise=require(_0x133a('0x2'));var rp=require(_0x133a('0x3'));var fs=require('fs');var path=require(_0x133a('0x4'));var rimraf=require(_0x133a('0x5'));var config=require(_0x133a('0x6'));var attributes=require(_0x133a('0x7'));module[_0x133a('0x8')]=function(_0x4f8746,_0x1a7568){return _0x4f8746['define'](_0x133a('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1509=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1509,0x15f));var _0x9150=function(_0x4b8c1b,_0x23daf2){_0x4b8c1b=_0x4b8c1b-0x0;var _0x34f867=_0x1509[_0x4b8c1b];return _0x34f867;};'use strict';var _=require(_0x9150('0x0'));var util=require(_0x9150('0x1'));var logger=require(_0x9150('0x2'))(_0x9150('0x3'));var moment=require('moment');var BPromise=require(_0x9150('0x4'));var rp=require(_0x9150('0x5'));var fs=require('fs');var path=require(_0x9150('0x6'));var rimraf=require('rimraf');var config=require(_0x9150('0x7'));var attributes=require(_0x9150('0x8'));module[_0x9150('0x9')]=function(_0x570411,_0x5ad593){return _0x570411[_0x9150('0xa')](_0x9150('0xb'),attributes,{'tableName':_0x9150('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4ce9f2e..3cd77b1 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 _0x1f88=['catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x476bcd,_0x2f6582){var _0x47b60f=function(_0x406a6e){while(--_0x406a6e){_0x476bcd['push'](_0x476bcd['shift']());}};_0x47b60f(++_0x2f6582);}(_0x1f88,0xdd));var _0x81f8=function(_0x12a9c6,_0x17fcf7){_0x12a9c6=_0x12a9c6-0x0;var _0x432410=_0x1f88[_0x12a9c6];return _0x432410;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x81f8('0x0'));var BPromise=require(_0x81f8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81f8('0x2'));var db=require(_0x81f8('0x3'))['db'];var utils=require(_0x81f8('0x4'));var logger=require(_0x81f8('0x5'))(_0x81f8('0x6'));var config=require(_0x81f8('0x7'));var jayson=require(_0x81f8('0x8'));var client=jayson[_0x81f8('0x9')][_0x81f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bfa0d,_0x11e8f4,_0x448297){return new BPromise(function(_0x5a27cd,_0x1cb0ee){return client['request'](_0x3bfa0d,_0x448297)[_0x81f8('0xb')](function(_0x40d067){logger[_0x81f8('0xc')](_0x81f8('0xd'),_0x11e8f4,_0x81f8('0xe'));logger[_0x81f8('0xf')](_0x81f8('0x10'),_0x11e8f4,_0x81f8('0xe'),JSON[_0x81f8('0x11')](_0x40d067));if(_0x40d067[_0x81f8('0x12')]){if(_0x40d067['error'][_0x81f8('0x13')]===0x1f4){logger[_0x81f8('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x11e8f4,_0x40d067[_0x81f8('0x12')][_0x81f8('0x14')]);return _0x1cb0ee(_0x40d067[_0x81f8('0x12')][_0x81f8('0x14')]);}logger['error'](_0x81f8('0xd'),_0x11e8f4,_0x40d067[_0x81f8('0x12')][_0x81f8('0x14')]);return _0x5a27cd(_0x40d067['error'][_0x81f8('0x14')]);}else{logger[_0x81f8('0xc')](_0x81f8('0xd'),_0x11e8f4,_0x81f8('0xe'));_0x5a27cd(_0x40d067['result'][_0x81f8('0x14')]);}})[_0x81f8('0x15')](function(_0x1bd561){logger['error'](_0x81f8('0xd'),_0x11e8f4,_0x1bd561);_0x1cb0ee(_0x1bd561);});});} \ No newline at end of file +var _0x960b=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x525ffa,_0x523d3f){var _0x34befd=function(_0x44006a){while(--_0x44006a){_0x525ffa['push'](_0x525ffa['shift']());}};_0x34befd(++_0x523d3f);}(_0x960b,0x187));var _0xb960=function(_0x3db1fd,_0x4c9d21){_0x3db1fd=_0x3db1fd-0x0;var _0x3fe0e2=_0x960b[_0x3db1fd];return _0x3fe0e2;};'use strict';var _=require(_0xb960('0x0'));var util=require(_0xb960('0x1'));var moment=require(_0xb960('0x2'));var BPromise=require('bluebird');var rs=require(_0xb960('0x3'));var fs=require('fs');var Redis=require(_0xb960('0x4'));var db=require(_0xb960('0x5'))['db'];var utils=require(_0xb960('0x6'));var logger=require(_0xb960('0x7'))('rpc');var config=require(_0xb960('0x8'));var jayson=require(_0xb960('0x9'));var client=jayson[_0xb960('0xa')][_0xb960('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35482d,_0x16be1c,_0x58d9f1){return new BPromise(function(_0x32b8e2,_0x1fa653){return client[_0xb960('0xc')](_0x35482d,_0x58d9f1)[_0xb960('0xd')](function(_0x27242c){logger[_0xb960('0xe')](_0xb960('0xf'),_0x16be1c,_0xb960('0x10'));logger[_0xb960('0x11')](_0xb960('0x12'),_0x16be1c,_0xb960('0x10'),JSON[_0xb960('0x13')](_0x27242c));if(_0x27242c[_0xb960('0x14')]){if(_0x27242c[_0xb960('0x14')][_0xb960('0x15')]===0x1f4){logger[_0xb960('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x16be1c,_0x27242c['error'][_0xb960('0x16')]);return _0x1fa653(_0x27242c[_0xb960('0x14')][_0xb960('0x16')]);}logger[_0xb960('0x14')](_0xb960('0xf'),_0x16be1c,_0x27242c[_0xb960('0x14')]['message']);return _0x32b8e2(_0x27242c['error'][_0xb960('0x16')]);}else{logger[_0xb960('0xe')](_0xb960('0xf'),_0x16be1c,_0xb960('0x10'));_0x32b8e2(_0x27242c['result'][_0xb960('0x16')]);}})['catch'](function(_0x2496cd){logger['error'](_0xb960('0xf'),_0x16be1c,_0x2496cd);_0x1fa653(_0x2496cd);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3efd9fa..9b7b24c 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 _0x6b02=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','post','put'];(function(_0x560582,_0x1406d4){var _0x3c7c83=function(_0x4d9978){while(--_0x4d9978){_0x560582['push'](_0x560582['shift']());}};_0x3c7c83(++_0x1406d4);}(_0x6b02,0x1d0));var _0x26b0=function(_0x269568,_0x53c448){_0x269568=_0x269568-0x0;var _0x38a9bd=_0x6b02[_0x269568];return _0x38a9bd;};'use strict';var multer=require('multer');var util=require(_0x26b0('0x0'));var path=require(_0x26b0('0x1'));var timeout=require(_0x26b0('0x2'));var express=require(_0x26b0('0x3'));var router=express['Router']();var fs_extra=require(_0x26b0('0x4'));var auth=require(_0x26b0('0x5'));var interaction=require(_0x26b0('0x6'));var config=require(_0x26b0('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x26b0('0x8')]('/',auth[_0x26b0('0x9')](),controller[_0x26b0('0xa')]);router[_0x26b0('0x8')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller['show']);router['get'](_0x26b0('0xc'),auth['isAuthenticated'](),controller[_0x26b0('0xd')]);router[_0x26b0('0x8')](_0x26b0('0xe'),auth[_0x26b0('0x9')](),controller[_0x26b0('0xf')]);router[_0x26b0('0x8')]('/:id/query',auth[_0x26b0('0x9')](),controller[_0x26b0('0x10')]);router[_0x26b0('0x11')]('/',auth[_0x26b0('0x9')](),controller['create']);router[_0x26b0('0x12')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller[_0x26b0('0x13')]);router[_0x26b0('0x14')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller[_0x26b0('0x15')]);module[_0x26b0('0x16')]=router; \ No newline at end of file +var _0x2071=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get'];(function(_0x3ce34a,_0x5a2dd4){var _0x3320ed=function(_0x2815f7){while(--_0x2815f7){_0x3ce34a['push'](_0x3ce34a['shift']());}};_0x3320ed(++_0x5a2dd4);}(_0x2071,0xb1));var _0x1207=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0x2071[_0x44cd28];return _0x39356e;};'use strict';var multer=require(_0x1207('0x0'));var util=require(_0x1207('0x1'));var path=require(_0x1207('0x2'));var timeout=require('connect-timeout');var express=require(_0x1207('0x3'));var router=express[_0x1207('0x4')]();var fs_extra=require(_0x1207('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1207('0x6'));var config=require(_0x1207('0x7'));var controller=require(_0x1207('0x8'));router['get']('/',auth[_0x1207('0x9')](),controller[_0x1207('0xa')]);router[_0x1207('0xb')]('/:id',auth[_0x1207('0x9')](),controller[_0x1207('0xc')]);router[_0x1207('0xb')](_0x1207('0xd'),auth[_0x1207('0x9')](),controller[_0x1207('0xe')]);router['get'](_0x1207('0xf'),auth[_0x1207('0x9')](),controller[_0x1207('0x10')]);router['get'](_0x1207('0x11'),auth[_0x1207('0x9')](),controller[_0x1207('0x12')]);router[_0x1207('0x13')]('/',auth[_0x1207('0x9')](),controller[_0x1207('0x14')]);router[_0x1207('0x15')](_0x1207('0x16'),auth[_0x1207('0x9')](),controller[_0x1207('0x17')]);router[_0x1207('0x18')](_0x1207('0x16'),auth[_0x1207('0x9')](),controller[_0x1207('0x19')]);module[_0x1207('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8b4f768..75fad23 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 _0x2973=['csv','xlsx','DATE','Loading','manual','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2973,0xa6));var _0x3297=function(_0x44c340,_0x575719){_0x44c340=_0x44c340-0x0;var _0x2cd080=_0x2973[_0x44c340];return _0x2cd080;};'use strict';var Sequelize=require(_0x3297('0x0'));var moment=require('moment');module[_0x3297('0x1')]={'name':{'type':Sequelize[_0x3297('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x3297('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x3297('0x3')](_0x3297('0x4'),'pdf',_0x3297('0x5')),'allowNull':![],'defaultValue':_0x3297('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x3297('0x6')]},'endDate':{'type':Sequelize[_0x3297('0x6')]},'status':{'type':Sequelize[_0x3297('0x2')],'defaultValue':_0x3297('0x7')},'type':{'type':Sequelize[_0x3297('0x3')](_0x3297('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x3297('0x8')},'reportId':{'type':Sequelize[_0x3297('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a58=['ENUM','csv','pdf','xlsx','DATE','Loading','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2a58,0x68));var _0x82a5=function(_0x1c411a,_0x2cbf0a){_0x1c411a=_0x1c411a-0x0;var _0xe8808c=_0x2a58[_0x1c411a];return _0xe8808c;};'use strict';var Sequelize=require(_0x82a5('0x0'));var moment=require(_0x82a5('0x1'));module[_0x82a5('0x2')]={'name':{'type':Sequelize[_0x82a5('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x82a5('0x4')](_0x82a5('0x5'),_0x82a5('0x6'),_0x82a5('0x7')),'allowNull':![],'defaultValue':_0x82a5('0x5')},'savename':{'type':Sequelize[_0x82a5('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x82a5('0x8')]},'endDate':{'type':Sequelize[_0x82a5('0x8')]},'status':{'type':Sequelize[_0x82a5('0x3')],'defaultValue':_0x82a5('0x9')},'type':{'type':Sequelize[_0x82a5('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x82a5('0xa')](0xb)[_0x82a5('0xb')]},'reportType':{'type':Sequelize[_0x82a5('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0a89d51..2b26951 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 _0x5d90=['attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','destroy','then','get','ExtractedReports','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','intersection'];(function(_0x2b5d9a,_0x238e95){var _0x2c852a=function(_0x19b275){while(--_0x19b275){_0x2b5d9a['push'](_0x2b5d9a['shift']());}};_0x2c852a(++_0x238e95);}(_0x5d90,0x146));var _0x05d9=function(_0x19d22c,_0x3c48af){_0x19d22c=_0x19d22c-0x0;var _0x568d33=_0x5d90[_0x19d22c];return _0x568d33;};'use strict';var emlformat=require(_0x05d9('0x0'));var rimraf=require(_0x05d9('0x1'));var zipdir=require(_0x05d9('0x2'));var jsonpatch=require(_0x05d9('0x3'));var rp=require(_0x05d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x05d9('0x5'));var util=require(_0x05d9('0x6'));var path=require(_0x05d9('0x7'));var sox=require(_0x05d9('0x8'));var csv=require(_0x05d9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05d9('0xa'));var _=require(_0x05d9('0xb'));var squel=require(_0x05d9('0xc'));var crypto=require(_0x05d9('0xd'));var jsforce=require(_0x05d9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x05d9('0x9'));var querystring=require(_0x05d9('0xf'));var Papa=require(_0x05d9('0x10'));var Redis=require(_0x05d9('0x11'));var authService=require(_0x05d9('0x12'));var qs=require(_0x05d9('0x13'));var as=require(_0x05d9('0x14'));var hardwareService=require(_0x05d9('0x15'));var logger=require(_0x05d9('0x16'))('api');var utils=require(_0x05d9('0x17'));var config=require(_0x05d9('0x18'));var licenseUtil=require(_0x05d9('0x19'));var db=require(_0x05d9('0x1a'))['db'];function respondWithStatusCode(_0x3c6627,_0x5372fe){_0x5372fe=_0x5372fe||0xcc;return function(_0x55e64a){if(_0x55e64a){return _0x3c6627[_0x05d9('0x1b')](_0x5372fe);}return _0x3c6627[_0x05d9('0x1c')](_0x5372fe)[_0x05d9('0x1d')]();};}function respondWithResult(_0x475413,_0x36a0e7){_0x36a0e7=_0x36a0e7||0xc8;return function(_0x595e34){if(_0x595e34){return _0x475413['status'](_0x36a0e7)[_0x05d9('0x1e')](_0x595e34);}};}function respondWithFilteredResult(_0x239571,_0x566b4c){return function(_0x1d80db){if(_0x1d80db){var _0x4d8a0b=typeof _0x566b4c[_0x05d9('0x1f')]===_0x05d9('0x20')&&typeof _0x566b4c[_0x05d9('0x21')]===_0x05d9('0x20');var _0x2ec2c0=_0x1d80db['count'];var _0x19cacb=_0x4d8a0b?0x0:_0x566b4c[_0x05d9('0x1f')];var _0x122489=_0x4d8a0b?_0x1d80db[_0x05d9('0x22')]:_0x566b4c[_0x05d9('0x1f')]+_0x566b4c[_0x05d9('0x21')];var _0x149430;if(_0x122489>=_0x2ec2c0){_0x122489=_0x2ec2c0;_0x149430=0xc8;}else{_0x149430=0xce;}_0x239571[_0x05d9('0x1c')](_0x149430);return _0x239571[_0x05d9('0x23')]('Content-Range',_0x19cacb+'-'+_0x122489+'/'+_0x2ec2c0)[_0x05d9('0x1e')](_0x1d80db);}return null;};}function patchUpdates(_0x78932d){return function(_0x41deca){try{jsonpatch[_0x05d9('0x24')](_0x41deca,_0x78932d,!![]);}catch(_0x2a1521){return BPromise['reject'](_0x2a1521);}return _0x41deca['save']();};}function saveUpdates(_0x48bb87,_0x319d7d){return function(_0x42f580){if(_0x42f580){return _0x42f580['update'](_0x48bb87)['then'](function(_0x5bad5b){return _0x5bad5b;});}return null;};}function removeEntity(_0x41ef95,_0x1c4800){return function(_0x2a486e){if(_0x2a486e){return _0x2a486e[_0x05d9('0x25')]()[_0x05d9('0x26')](function(){var _0x3925f8=_0x2a486e[_0x05d9('0x27')]({'plain':!![]});var _0x42b131=_0x05d9('0x28');return db['UserProfileResource'][_0x05d9('0x25')]({'where':{'type':_0x42b131,'resourceId':_0x3925f8['id']}})[_0x05d9('0x26')](function(){return _0x2a486e;});})[_0x05d9('0x26')](function(){_0x41ef95['status'](0xcc)[_0x05d9('0x1d')]();});}};}function handleEntityNotFound(_0x2a59a9,_0x5bbc5c){return function(_0x4b686c){if(!_0x4b686c){_0x2a59a9[_0x05d9('0x1b')](0x194);}return _0x4b686c;};}function handleError(_0x31f08a,_0x48c574){_0x48c574=_0x48c574||0x1f4;return function(_0x445656){logger['error'](_0x445656[_0x05d9('0x29')]);if(_0x445656[_0x05d9('0x2a')]){delete _0x445656[_0x05d9('0x2a')];}_0x31f08a[_0x05d9('0x1c')](_0x48c574)[_0x05d9('0x2b')](_0x445656);};}exports[_0x05d9('0x2c')]=function(_0x53f087,_0x1c95e9){var _0x45eb03={},_0x32b34d={},_0x37738f={'count':0x0,'rows':[]};var _0x1627e3=_[_0x05d9('0x2d')](db[_0x05d9('0x2e')]['rawAttributes'],function(_0x481a0e){return{'name':_0x481a0e[_0x05d9('0x2f')],'type':_0x481a0e[_0x05d9('0x30')][_0x05d9('0x31')]};});_0x32b34d[_0x05d9('0x32')]=_[_0x05d9('0x2d')](_0x1627e3,'name');_0x32b34d[_0x05d9('0x33')]=_[_0x05d9('0x34')](_0x53f087[_0x05d9('0x33')]);_0x32b34d['filters']=_[_0x05d9('0x35')](_0x32b34d['model'],_0x32b34d['query']);_0x45eb03[_0x05d9('0x36')]=_['intersection'](_0x32b34d[_0x05d9('0x32')],qs['fields'](_0x53f087['query']['fields']));_0x45eb03[_0x05d9('0x36')]=_0x45eb03[_0x05d9('0x36')][_0x05d9('0x37')]?_0x45eb03[_0x05d9('0x36')]:_0x32b34d[_0x05d9('0x32')];if(!_0x53f087['query']['hasOwnProperty']('nolimit')){_0x45eb03[_0x05d9('0x21')]=qs['limit'](_0x53f087[_0x05d9('0x33')][_0x05d9('0x21')]);_0x45eb03['offset']=qs[_0x05d9('0x1f')](_0x53f087[_0x05d9('0x33')][_0x05d9('0x1f')]);}_0x45eb03[_0x05d9('0x38')]=qs[_0x05d9('0x39')](_0x53f087[_0x05d9('0x33')][_0x05d9('0x39')]);_0x45eb03[_0x05d9('0x3a')]=qs[_0x05d9('0x3b')](_[_0x05d9('0x3c')](_0x53f087[_0x05d9('0x33')],_0x32b34d['filters']),_0x1627e3);if(_0x53f087[_0x05d9('0x33')]['filter']){_0x45eb03[_0x05d9('0x3a')]=_[_0x05d9('0x3d')](_0x45eb03[_0x05d9('0x3a')],{'$or':_['map'](_0x1627e3,function(_0x1f4e18){if(_0x1f4e18[_0x05d9('0x30')]!==_0x05d9('0x3e')){var _0xd51fd7={};_0xd51fd7[_0x1f4e18[_0x05d9('0x2a')]]={'$like':'%'+_0x53f087['query']['filter']+'%'};return _0xd51fd7;}})});}_0x45eb03=_[_0x05d9('0x3d')]({},_0x45eb03,_0x53f087[_0x05d9('0x3f')]);var _0x2d2cba={'where':_0x45eb03[_0x05d9('0x3a')]};return db['AnalyticExtractedReport'][_0x05d9('0x22')](_0x2d2cba)['then'](function(_0x29323f){_0x37738f['count']=_0x29323f;if(_0x53f087[_0x05d9('0x33')][_0x05d9('0x40')]){_0x45eb03['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x05d9('0x41')](_0x45eb03);})['then'](function(_0x44cce1){_0x37738f[_0x05d9('0x42')]=_0x44cce1;return _0x37738f;})[_0x05d9('0x26')](respondWithFilteredResult(_0x1c95e9,_0x45eb03))['catch'](handleError(_0x1c95e9,null));};exports['show']=function(_0x1e298c,_0x184bae){var _0x1ea2fd={'raw':!![],'where':{'id':_0x1e298c[_0x05d9('0x43')]['id']}},_0x39f9f9={};_0x39f9f9[_0x05d9('0x32')]=_[_0x05d9('0x34')](db[_0x05d9('0x2e')][_0x05d9('0x44')]);_0x39f9f9['query']=_[_0x05d9('0x34')](_0x1e298c[_0x05d9('0x33')]);_0x39f9f9['filters']=_[_0x05d9('0x35')](_0x39f9f9['model'],_0x39f9f9[_0x05d9('0x33')]);_0x1ea2fd[_0x05d9('0x36')]=_[_0x05d9('0x35')](_0x39f9f9['model'],qs['fields'](_0x1e298c[_0x05d9('0x33')]['fields']));_0x1ea2fd[_0x05d9('0x36')]=_0x1ea2fd['attributes'][_0x05d9('0x37')]?_0x1ea2fd[_0x05d9('0x36')]:_0x39f9f9['model'];if(_0x1e298c['query'][_0x05d9('0x40')]){_0x1ea2fd[_0x05d9('0x45')]=[{'all':!![]}];}_0x1ea2fd=_[_0x05d9('0x3d')]({},_0x1ea2fd,_0x1e298c['options']);return db[_0x05d9('0x2e')][_0x05d9('0x46')](_0x1ea2fd)[_0x05d9('0x26')](handleEntityNotFound(_0x184bae,null))[_0x05d9('0x26')](respondWithResult(_0x184bae,null))[_0x05d9('0x47')](handleError(_0x184bae,null));};exports[_0x05d9('0x48')]=function(_0x4d4f80,_0x3362d1){return db[_0x05d9('0x2e')]['create'](_0x4d4f80[_0x05d9('0x49')],{})['then'](function(_0x52360c){var _0x503c14=_0x4d4f80[_0x05d9('0x4a')]['get']({'plain':!![]});if(!_0x503c14)throw new Error(_0x05d9('0x4b'));if(_0x503c14['role']===_0x05d9('0x4a')){var _0x3d0f5b=_0x52360c['get']({'plain':!![]});var _0xf0e7f2='ExtractedReports';return db['UserProfileSection'][_0x05d9('0x46')]({'where':{'name':_0xf0e7f2,'userProfileId':_0x503c14[_0x05d9('0x4c')]},'raw':!![]})[_0x05d9('0x26')](function(_0x3d91cc){if(_0x3d91cc&&_0x3d91cc[_0x05d9('0x4d')]===0x0){return db[_0x05d9('0x4e')][_0x05d9('0x48')]({'name':_0x3d0f5b[_0x05d9('0x2a')],'resourceId':_0x3d0f5b['id'],'type':_0x3d91cc['name'],'sectionId':_0x3d91cc['id']},{})[_0x05d9('0x26')](function(){return _0x52360c;});}else{return _0x52360c;}})[_0x05d9('0x47')](function(_0x385b01){logger['error'](_0x05d9('0x4f'),_0x385b01);throw _0x385b01;});}return _0x52360c;})[_0x05d9('0x26')](respondWithResult(_0x3362d1,0xc9))['catch'](handleError(_0x3362d1,null));};exports[_0x05d9('0x50')]=function(_0xb94525,_0xd6b541){if(_0xb94525['body']['id']){delete _0xb94525[_0x05d9('0x49')]['id'];}return db[_0x05d9('0x2e')][_0x05d9('0x46')]({'where':{'id':_0xb94525[_0x05d9('0x43')]['id']}})['then'](handleEntityNotFound(_0xd6b541,null))[_0x05d9('0x26')](saveUpdates(_0xb94525['body'],null))[_0x05d9('0x26')](respondWithResult(_0xd6b541,null))['catch'](handleError(_0xd6b541,null));};exports[_0x05d9('0x25')]=function(_0x400f28,_0x24a883){return db[_0x05d9('0x2e')]['find']({'where':{'id':_0x400f28[_0x05d9('0x43')]['id']}})[_0x05d9('0x26')](handleEntityNotFound(_0x24a883,null))[_0x05d9('0x26')](removeEntity(_0x24a883,null))['catch'](handleError(_0x24a883,null));};exports[_0x05d9('0x51')]=function(_0x3ef654,_0x2dd76a,_0x458bb5){return db[_0x05d9('0x2e')]['find']({'where':{'id':_0x3ef654[_0x05d9('0x43')]['id']},'attributes':[_0x05d9('0x2a'),_0x05d9('0x52'),'savename',_0x05d9('0x53')],'raw':!![]})[_0x05d9('0x26')](handleEntityNotFound(_0x2dd76a,null))[_0x05d9('0x26')](function(_0x4e52fb){if(_0x4e52fb){if(!fs[_0x05d9('0x54')](path[_0x05d9('0x55')](config[_0x05d9('0x56')],_0x05d9('0x57'),_0x4e52fb[_0x05d9('0x58')]))){throw new db[(_0x05d9('0x59'))][(_0x05d9('0x5a'))](_0x05d9('0x5b'));}if(_0x3ef654[_0x05d9('0x33')][_0x05d9('0x5c')]){return _0x2dd76a['sendStatus'](0xc8);}return _0x2dd76a[_0x05d9('0x51')](path['join'](config['root'],_0x05d9('0x57'),_0x4e52fb[_0x05d9('0x58')]),util[_0x05d9('0x5d')](_0x05d9('0x5e'),_0x4e52fb[_0x05d9('0x52')]||_0x4e52fb['name'],_0x4e52fb[_0x05d9('0x53')]['toLowerCase']()));}})['catch'](handleError(_0x2dd76a,null));}; \ No newline at end of file +var _0xc1a6=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','ExtractedReports','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','AnalyticExtractedReport','includeAll','include','findAll','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2f8219,_0x209d33){var _0x101515=function(_0x2467ce){while(--_0x2467ce){_0x2f8219['push'](_0x2f8219['shift']());}};_0x101515(++_0x209d33);}(_0xc1a6,0x18f));var _0x6c1a=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc1a6[_0x40ac5e];return _0x2839d6;};'use strict';var emlformat=require(_0x6c1a('0x0'));var rimraf=require(_0x6c1a('0x1'));var zipdir=require(_0x6c1a('0x2'));var jsonpatch=require(_0x6c1a('0x3'));var rp=require('request-promise');var moment=require(_0x6c1a('0x4'));var BPromise=require(_0x6c1a('0x5'));var Mustache=require(_0x6c1a('0x6'));var util=require(_0x6c1a('0x7'));var path=require(_0x6c1a('0x8'));var sox=require(_0x6c1a('0x9'));var csv=require(_0x6c1a('0xa'));var ejs=require(_0x6c1a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c1a('0xc'));var squel=require(_0x6c1a('0xd'));var crypto=require(_0x6c1a('0xe'));var jsforce=require(_0x6c1a('0xf'));var deskjs=require(_0x6c1a('0x10'));var toCsv=require(_0x6c1a('0xa'));var querystring=require(_0x6c1a('0x11'));var Papa=require('papaparse');var Redis=require(_0x6c1a('0x12'));var authService=require(_0x6c1a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6c1a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c1a('0x15'))('api');var utils=require(_0x6c1a('0x16'));var config=require(_0x6c1a('0x17'));var licenseUtil=require(_0x6c1a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa214ba,_0x1a4d51){_0x1a4d51=_0x1a4d51||0xcc;return function(_0x3263d3){if(_0x3263d3){return _0xa214ba['sendStatus'](_0x1a4d51);}return _0xa214ba[_0x6c1a('0x19')](_0x1a4d51)[_0x6c1a('0x1a')]();};}function respondWithResult(_0x2b2f12,_0xb6a31b){_0xb6a31b=_0xb6a31b||0xc8;return function(_0x2b2ce2){if(_0x2b2ce2){return _0x2b2f12[_0x6c1a('0x19')](_0xb6a31b)['json'](_0x2b2ce2);}};}function respondWithFilteredResult(_0xf2c4f9,_0x34c317){return function(_0x182925){if(_0x182925){var _0x3317ec=typeof _0x34c317[_0x6c1a('0x1b')]===_0x6c1a('0x1c')&&typeof _0x34c317['limit']===_0x6c1a('0x1c');var _0x5e7ecb=_0x182925[_0x6c1a('0x1d')];var _0xb0c00a=_0x3317ec?0x0:_0x34c317[_0x6c1a('0x1b')];var _0x18181e=_0x3317ec?_0x182925[_0x6c1a('0x1d')]:_0x34c317[_0x6c1a('0x1b')]+_0x34c317[_0x6c1a('0x1e')];var _0x39d25e;if(_0x18181e>=_0x5e7ecb){_0x18181e=_0x5e7ecb;_0x39d25e=0xc8;}else{_0x39d25e=0xce;}_0xf2c4f9[_0x6c1a('0x19')](_0x39d25e);return _0xf2c4f9[_0x6c1a('0x1f')](_0x6c1a('0x20'),_0xb0c00a+'-'+_0x18181e+'/'+_0x5e7ecb)[_0x6c1a('0x21')](_0x182925);}return null;};}function patchUpdates(_0x541235){return function(_0xd6dfd0){try{jsonpatch[_0x6c1a('0x22')](_0xd6dfd0,_0x541235,!![]);}catch(_0x1a5a14){return BPromise['reject'](_0x1a5a14);}return _0xd6dfd0[_0x6c1a('0x23')]();};}function saveUpdates(_0x3f9057,_0x2fd91a){return function(_0x2691a6){if(_0x2691a6){return _0x2691a6[_0x6c1a('0x24')](_0x3f9057)[_0x6c1a('0x25')](function(_0x1296d5){return _0x1296d5;});}return null;};}function removeEntity(_0x87d670,_0x2151d6){return function(_0x17aac6){if(_0x17aac6){return _0x17aac6['destroy']()[_0x6c1a('0x25')](function(){var _0x102b1a=_0x17aac6['get']({'plain':!![]});var _0x54f21a=_0x6c1a('0x26');return db['UserProfileResource'][_0x6c1a('0x27')]({'where':{'type':_0x54f21a,'resourceId':_0x102b1a['id']}})[_0x6c1a('0x25')](function(){return _0x17aac6;});})['then'](function(){_0x87d670['status'](0xcc)[_0x6c1a('0x1a')]();});}};}function handleEntityNotFound(_0x39ab9a,_0x348195){return function(_0x5491b3){if(!_0x5491b3){_0x39ab9a[_0x6c1a('0x28')](0x194);}return _0x5491b3;};}function handleError(_0x347fd8,_0x493f06){_0x493f06=_0x493f06||0x1f4;return function(_0x2c2c45){logger[_0x6c1a('0x29')](_0x2c2c45[_0x6c1a('0x2a')]);if(_0x2c2c45[_0x6c1a('0x2b')]){delete _0x2c2c45[_0x6c1a('0x2b')];}_0x347fd8['status'](_0x493f06)[_0x6c1a('0x2c')](_0x2c2c45);};}exports[_0x6c1a('0x2d')]=function(_0x1e5cd8,_0x574457){var _0x2a02b5={},_0x9cb2a6={},_0x6bb718={'count':0x0,'rows':[]};var _0x3cdb47=_[_0x6c1a('0x2e')](db['AnalyticExtractedReport'][_0x6c1a('0x2f')],function(_0x3fc252){return{'name':_0x3fc252[_0x6c1a('0x30')],'type':_0x3fc252[_0x6c1a('0x31')][_0x6c1a('0x32')]};});_0x9cb2a6['model']=_[_0x6c1a('0x2e')](_0x3cdb47,'name');_0x9cb2a6[_0x6c1a('0x33')]=_[_0x6c1a('0x34')](_0x1e5cd8['query']);_0x9cb2a6['filters']=_[_0x6c1a('0x35')](_0x9cb2a6[_0x6c1a('0x36')],_0x9cb2a6[_0x6c1a('0x33')]);_0x2a02b5['attributes']=_[_0x6c1a('0x35')](_0x9cb2a6[_0x6c1a('0x36')],qs['fields'](_0x1e5cd8[_0x6c1a('0x33')][_0x6c1a('0x37')]));_0x2a02b5[_0x6c1a('0x38')]=_0x2a02b5['attributes'][_0x6c1a('0x39')]?_0x2a02b5[_0x6c1a('0x38')]:_0x9cb2a6[_0x6c1a('0x36')];if(!_0x1e5cd8[_0x6c1a('0x33')][_0x6c1a('0x3a')](_0x6c1a('0x3b'))){_0x2a02b5[_0x6c1a('0x1e')]=qs[_0x6c1a('0x1e')](_0x1e5cd8[_0x6c1a('0x33')][_0x6c1a('0x1e')]);_0x2a02b5['offset']=qs[_0x6c1a('0x1b')](_0x1e5cd8[_0x6c1a('0x33')]['offset']);}_0x2a02b5[_0x6c1a('0x3c')]=qs[_0x6c1a('0x3d')](_0x1e5cd8[_0x6c1a('0x33')][_0x6c1a('0x3d')]);_0x2a02b5['where']=qs[_0x6c1a('0x3e')](_[_0x6c1a('0x3f')](_0x1e5cd8[_0x6c1a('0x33')],_0x9cb2a6[_0x6c1a('0x3e')]),_0x3cdb47);if(_0x1e5cd8[_0x6c1a('0x33')][_0x6c1a('0x40')]){_0x2a02b5[_0x6c1a('0x41')]=_[_0x6c1a('0x42')](_0x2a02b5[_0x6c1a('0x41')],{'$or':_[_0x6c1a('0x2e')](_0x3cdb47,function(_0x130606){if(_0x130606[_0x6c1a('0x31')]!=='VIRTUAL'){var _0x3b1788={};_0x3b1788[_0x130606['name']]={'$like':'%'+_0x1e5cd8[_0x6c1a('0x33')][_0x6c1a('0x40')]+'%'};return _0x3b1788;}})});}_0x2a02b5=_[_0x6c1a('0x42')]({},_0x2a02b5,_0x1e5cd8[_0x6c1a('0x43')]);var _0x299301={'where':_0x2a02b5['where']};return db[_0x6c1a('0x44')][_0x6c1a('0x1d')](_0x299301)['then'](function(_0x5c4a83){_0x6bb718[_0x6c1a('0x1d')]=_0x5c4a83;if(_0x1e5cd8[_0x6c1a('0x33')][_0x6c1a('0x45')]){_0x2a02b5[_0x6c1a('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x6c1a('0x47')](_0x2a02b5);})[_0x6c1a('0x25')](function(_0x479298){_0x6bb718[_0x6c1a('0x48')]=_0x479298;return _0x6bb718;})[_0x6c1a('0x25')](respondWithFilteredResult(_0x574457,_0x2a02b5))['catch'](handleError(_0x574457,null));};exports['show']=function(_0xb0bbdd,_0x353a53){var _0x4d21ec={'raw':!![],'where':{'id':_0xb0bbdd[_0x6c1a('0x49')]['id']}},_0x78ef9={};_0x78ef9[_0x6c1a('0x36')]=_[_0x6c1a('0x34')](db['AnalyticExtractedReport'][_0x6c1a('0x2f')]);_0x78ef9[_0x6c1a('0x33')]=_['keys'](_0xb0bbdd[_0x6c1a('0x33')]);_0x78ef9['filters']=_[_0x6c1a('0x35')](_0x78ef9['model'],_0x78ef9['query']);_0x4d21ec[_0x6c1a('0x38')]=_[_0x6c1a('0x35')](_0x78ef9[_0x6c1a('0x36')],qs[_0x6c1a('0x37')](_0xb0bbdd[_0x6c1a('0x33')][_0x6c1a('0x37')]));_0x4d21ec[_0x6c1a('0x38')]=_0x4d21ec[_0x6c1a('0x38')]['length']?_0x4d21ec[_0x6c1a('0x38')]:_0x78ef9[_0x6c1a('0x36')];if(_0xb0bbdd[_0x6c1a('0x33')][_0x6c1a('0x45')]){_0x4d21ec[_0x6c1a('0x46')]=[{'all':!![]}];}_0x4d21ec=_['merge']({},_0x4d21ec,_0xb0bbdd[_0x6c1a('0x43')]);return db['AnalyticExtractedReport'][_0x6c1a('0x4a')](_0x4d21ec)[_0x6c1a('0x25')](handleEntityNotFound(_0x353a53,null))[_0x6c1a('0x25')](respondWithResult(_0x353a53,null))[_0x6c1a('0x4b')](handleError(_0x353a53,null));};exports['create']=function(_0x2215d8,_0x5b6338){return db[_0x6c1a('0x44')][_0x6c1a('0x4c')](_0x2215d8[_0x6c1a('0x4d')],{})[_0x6c1a('0x25')](function(_0x19bd3b){var _0x524388=_0x2215d8[_0x6c1a('0x4e')][_0x6c1a('0x4f')]({'plain':!![]});if(!_0x524388)throw new Error(_0x6c1a('0x50'));if(_0x524388[_0x6c1a('0x51')]==='user'){var _0x74603a=_0x19bd3b[_0x6c1a('0x4f')]({'plain':!![]});var _0x1d510a=_0x6c1a('0x26');return db[_0x6c1a('0x52')]['find']({'where':{'name':_0x1d510a,'userProfileId':_0x524388[_0x6c1a('0x53')]},'raw':!![]})[_0x6c1a('0x25')](function(_0x391327){if(_0x391327&&_0x391327[_0x6c1a('0x54')]===0x0){return db['UserProfileResource'][_0x6c1a('0x4c')]({'name':_0x74603a[_0x6c1a('0x2b')],'resourceId':_0x74603a['id'],'type':_0x391327[_0x6c1a('0x2b')],'sectionId':_0x391327['id']},{})[_0x6c1a('0x25')](function(){return _0x19bd3b;});}else{return _0x19bd3b;}})['catch'](function(_0xd44577){logger[_0x6c1a('0x29')](_0x6c1a('0x55'),_0xd44577);throw _0xd44577;});}return _0x19bd3b;})[_0x6c1a('0x25')](respondWithResult(_0x5b6338,0xc9))[_0x6c1a('0x4b')](handleError(_0x5b6338,null));};exports[_0x6c1a('0x24')]=function(_0x429749,_0xf992f0){if(_0x429749[_0x6c1a('0x4d')]['id']){delete _0x429749[_0x6c1a('0x4d')]['id'];}return db[_0x6c1a('0x44')][_0x6c1a('0x4a')]({'where':{'id':_0x429749['params']['id']}})[_0x6c1a('0x25')](handleEntityNotFound(_0xf992f0,null))[_0x6c1a('0x25')](saveUpdates(_0x429749[_0x6c1a('0x4d')],null))['then'](respondWithResult(_0xf992f0,null))[_0x6c1a('0x4b')](handleError(_0xf992f0,null));};exports['destroy']=function(_0x2c2821,_0x28b0cc){return db[_0x6c1a('0x44')]['find']({'where':{'id':_0x2c2821[_0x6c1a('0x49')]['id']}})[_0x6c1a('0x25')](handleEntityNotFound(_0x28b0cc,null))[_0x6c1a('0x25')](removeEntity(_0x28b0cc,null))[_0x6c1a('0x4b')](handleError(_0x28b0cc,null));};exports['download']=function(_0x423fce,_0x26376c,_0x741844){return db[_0x6c1a('0x44')]['find']({'where':{'id':_0x423fce[_0x6c1a('0x49')]['id']},'attributes':[_0x6c1a('0x2b'),'basename',_0x6c1a('0x56'),_0x6c1a('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x26376c,null))[_0x6c1a('0x25')](function(_0x4e975d){if(_0x4e975d){if(!fs['existsSync'](path[_0x6c1a('0x58')](config[_0x6c1a('0x59')],_0x6c1a('0x5a'),_0x4e975d[_0x6c1a('0x56')]))){throw new db['Sequelize'][(_0x6c1a('0x5b'))](_0x6c1a('0x5c'));}if(_0x423fce[_0x6c1a('0x33')]['exists']){return _0x26376c[_0x6c1a('0x28')](0xc8);}return _0x26376c['download'](path['join'](config[_0x6c1a('0x59')],'server/files/reports',_0x4e975d[_0x6c1a('0x56')]),util['format'](_0x6c1a('0x5d'),_0x4e975d[_0x6c1a('0x5e')]||_0x4e975d[_0x6c1a('0x2b')],_0x4e975d[_0x6c1a('0x57')][_0x6c1a('0x5f')]()));}})['catch'](handleError(_0x26376c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7729b7c..8ec6086 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 _0x3f68=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','../../config/logger','api','moment','path','../../config/environment'];(function(_0x5a723b,_0x31eac3){var _0x475a83=function(_0x5bcf41){while(--_0x5bcf41){_0x5a723b['push'](_0x5a723b['shift']());}};_0x475a83(++_0x31eac3);}(_0x3f68,0x13a));var _0x83f6=function(_0x629c0a,_0x12c1cf){_0x629c0a=_0x629c0a-0x0;var _0x30ca16=_0x3f68[_0x629c0a];return _0x30ca16;};'use strict';var _=require(_0x83f6('0x0'));var util=require('util');var logger=require(_0x83f6('0x1'))(_0x83f6('0x2'));var moment=require(_0x83f6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x83f6('0x4'));var rimraf=require('rimraf');var config=require(_0x83f6('0x5'));var attributes=require(_0x83f6('0x6'));module[_0x83f6('0x7')]=function(_0x194662,_0x500d50){return _0x194662[_0x83f6('0x8')](_0x83f6('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2261=['bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x35c817,_0x53e6a5){var _0xbc0a55=function(_0x43d9bd){while(--_0x43d9bd){_0x35c817['push'](_0x35c817['shift']());}};_0xbc0a55(++_0x53e6a5);}(_0x2261,0x7d));var _0x1226=function(_0x47af7f,_0x116e95){_0x47af7f=_0x47af7f-0x0;var _0x5a62f9=_0x2261[_0x47af7f];return _0x5a62f9;};'use strict';var _=require(_0x1226('0x0'));var util=require(_0x1226('0x1'));var logger=require(_0x1226('0x2'))(_0x1226('0x3'));var moment=require(_0x1226('0x4'));var BPromise=require(_0x1226('0x5'));var rp=require(_0x1226('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1226('0x7'));var config=require(_0x1226('0x8'));var attributes=require(_0x1226('0x9'));module['exports']=function(_0x3bdb21,_0x7bae98){return _0x3bdb21[_0x1226('0xa')](_0x1226('0xb'),attributes,{'tableName':_0x1226('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 8263ba5..670fc8b 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 _0xb63b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb63b,0x106));var _0xbb63=function(_0x29e218,_0x868444){_0x29e218=_0x29e218-0x0;var _0x310fb8=_0xb63b[_0x29e218];return _0x310fb8;};'use strict';var _=require(_0xbb63('0x0'));var util=require(_0xbb63('0x1'));var moment=require(_0xbb63('0x2'));var BPromise=require(_0xbb63('0x3'));var rs=require(_0xbb63('0x4'));var fs=require('fs');var Redis=require(_0xbb63('0x5'));var db=require(_0xbb63('0x6'))['db'];var utils=require(_0xbb63('0x7'));var logger=require(_0xbb63('0x8'))('rpc');var config=require(_0xbb63('0x9'));var jayson=require(_0xbb63('0xa'));var client=jayson[_0xbb63('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430c99,_0x3d9a85,_0x213068){return new BPromise(function(_0x29ed7c,_0x6167d8){return client[_0xbb63('0xc')](_0x430c99,_0x213068)[_0xbb63('0xd')](function(_0x134ce8){logger[_0xbb63('0xe')](_0xbb63('0xf'),_0x3d9a85,_0xbb63('0x10'));logger[_0xbb63('0x11')](_0xbb63('0x12'),_0x3d9a85,'request\x20sent',JSON['stringify'](_0x134ce8));if(_0x134ce8[_0xbb63('0x13')]){if(_0x134ce8['error'][_0xbb63('0x14')]===0x1f4){logger[_0xbb63('0x13')](_0xbb63('0xf'),_0x3d9a85,_0x134ce8[_0xbb63('0x13')][_0xbb63('0x15')]);return _0x6167d8(_0x134ce8[_0xbb63('0x13')][_0xbb63('0x15')]);}logger[_0xbb63('0x13')](_0xbb63('0xf'),_0x3d9a85,_0x134ce8[_0xbb63('0x13')][_0xbb63('0x15')]);return _0x29ed7c(_0x134ce8[_0xbb63('0x13')]['message']);}else{logger['info'](_0xbb63('0xf'),_0x3d9a85,_0xbb63('0x10'));_0x29ed7c(_0x134ce8[_0xbb63('0x16')]['message']);}})[_0xbb63('0x17')](function(_0xe2573c){logger[_0xbb63('0x13')](_0xbb63('0xf'),_0x3d9a85,_0xe2573c);_0x6167d8(_0xe2573c);});});} \ No newline at end of file +var _0xd6f7=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0xa840a9,_0x231941){var _0x3f7029=function(_0x480fa7){while(--_0x480fa7){_0xa840a9['push'](_0xa840a9['shift']());}};_0x3f7029(++_0x231941);}(_0xd6f7,0xed));var _0x7d6f=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xd6f7[_0x301c34];return _0x1a8c5a;};'use strict';var _=require(_0x7d6f('0x0'));var util=require(_0x7d6f('0x1'));var moment=require(_0x7d6f('0x2'));var BPromise=require(_0x7d6f('0x3'));var rs=require(_0x7d6f('0x4'));var fs=require('fs');var Redis=require(_0x7d6f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d6f('0x6'));var logger=require('../../config/logger')(_0x7d6f('0x7'));var config=require(_0x7d6f('0x8'));var jayson=require(_0x7d6f('0x9'));var client=jayson[_0x7d6f('0xa')][_0x7d6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe5f837,_0x5aef59,_0xc5f0be){return new BPromise(function(_0x31b9a9,_0x1ebcb3){return client[_0x7d6f('0xc')](_0xe5f837,_0xc5f0be)[_0x7d6f('0xd')](function(_0x4884d2){logger[_0x7d6f('0xe')](_0x7d6f('0xf'),_0x5aef59,_0x7d6f('0x10'));logger[_0x7d6f('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x5aef59,_0x7d6f('0x10'),JSON[_0x7d6f('0x12')](_0x4884d2));if(_0x4884d2[_0x7d6f('0x13')]){if(_0x4884d2[_0x7d6f('0x13')]['code']===0x1f4){logger[_0x7d6f('0x13')](_0x7d6f('0xf'),_0x5aef59,_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);return _0x1ebcb3(_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);}logger['error'](_0x7d6f('0xf'),_0x5aef59,_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);return _0x31b9a9(_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);}else{logger[_0x7d6f('0xe')](_0x7d6f('0xf'),_0x5aef59,_0x7d6f('0x10'));_0x31b9a9(_0x4884d2[_0x7d6f('0x15')][_0x7d6f('0x14')]);}})[_0x7d6f('0x16')](function(_0x39e631){logger[_0x7d6f('0x13')](_0x7d6f('0xf'),_0x5aef59,_0x39e631);_0x1ebcb3(_0x39e631);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1235edd..f59d01b 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 _0x23ed=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x23ed,0x126));var _0xd23e=function(_0x1f6fd1,_0x4a5bb7){_0x1f6fd1=_0x1f6fd1-0x0;var _0x1c5fd5=_0x23ed[_0x1f6fd1];return _0x1c5fd5;};'use strict';var multer=require(_0xd23e('0x0'));var util=require(_0xd23e('0x1'));var path=require(_0xd23e('0x2'));var timeout=require(_0xd23e('0x3'));var express=require('express');var router=express[_0xd23e('0x4')]();var fs_extra=require(_0xd23e('0x5'));var auth=require(_0xd23e('0x6'));var interaction=require(_0xd23e('0x7'));var config=require(_0xd23e('0x8'));var controller=require(_0xd23e('0x9'));router[_0xd23e('0xa')]('/',auth['isAuthenticated'](),controller[_0xd23e('0xb')]);router[_0xd23e('0xa')]('/:id',auth[_0xd23e('0xc')](),controller['show']);router[_0xd23e('0xa')](_0xd23e('0xd'),auth['isAuthenticated'](),controller[_0xd23e('0xe')]);router[_0xd23e('0xf')]('/',auth[_0xd23e('0xc')](),controller[_0xd23e('0x10')]);router[_0xd23e('0x11')](_0xd23e('0x12'),auth[_0xd23e('0xc')](),controller[_0xd23e('0x13')]);router[_0xd23e('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xd23e('0x15')]);module[_0xd23e('0x16')]=router; \ No newline at end of file +var _0x03ac=['download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','show','/:id/download','isAuthenticated'];(function(_0x22f373,_0xfe4768){var _0x1da590=function(_0x187492){while(--_0x187492){_0x22f373['push'](_0x22f373['shift']());}};_0x1da590(++_0xfe4768);}(_0x03ac,0xfa));var _0xc03a=function(_0x528b29,_0x1b9d72){_0x528b29=_0x528b29-0x0;var _0x34e6c5=_0x03ac[_0x528b29];return _0x34e6c5;};'use strict';var multer=require(_0xc03a('0x0'));var util=require(_0xc03a('0x1'));var path=require(_0xc03a('0x2'));var timeout=require(_0xc03a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc03a('0x4'));var auth=require(_0xc03a('0x5'));var interaction=require(_0xc03a('0x6'));var config=require(_0xc03a('0x7'));var controller=require(_0xc03a('0x8'));router[_0xc03a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc03a('0xa'),auth['isAuthenticated'](),controller[_0xc03a('0xb')]);router[_0xc03a('0x9')](_0xc03a('0xc'),auth[_0xc03a('0xd')](),controller[_0xc03a('0xe')]);router[_0xc03a('0xf')]('/',auth[_0xc03a('0xd')](),controller[_0xc03a('0x10')]);router[_0xc03a('0x11')](_0xc03a('0xa'),auth['isAuthenticated'](),controller[_0xc03a('0x12')]);router[_0xc03a('0x13')](_0xc03a('0xa'),auth[_0xc03a('0xd')](),controller[_0xc03a('0x14')]);module[_0xc03a('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3cbea14..523050d 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 _0x8475=['TEXT','STRING','BOOLEAN','exports'];(function(_0x46dcf3,_0x3dc151){var _0x48d3ca=function(_0x262f26){while(--_0x262f26){_0x46dcf3['push'](_0x46dcf3['shift']());}};_0x48d3ca(++_0x3dc151);}(_0x8475,0x18f));var _0x5847=function(_0x25758a,_0x5b2dbc){_0x25758a=_0x25758a-0x0;var _0x92822d=_0x8475[_0x25758a];return _0x92822d;};'use strict';var Sequelize=require('sequelize');module[_0x5847('0x0')]={'field':{'type':Sequelize[_0x5847('0x1')]},'alias':{'type':Sequelize[_0x5847('0x2')]},'function':{'type':Sequelize[_0x5847('0x2')]},'format':{'type':Sequelize[_0x5847('0x2')]},'groupBy':{'type':Sequelize[_0x5847('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x5847('0x2')]},'custom':{'type':Sequelize[_0x5847('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xef31=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x4117bd,_0x54c2b8){var _0x376d67=function(_0x48e8ea){while(--_0x48e8ea){_0x4117bd['push'](_0x4117bd['shift']());}};_0x376d67(++_0x54c2b8);}(_0xef31,0x17a));var _0x1ef3=function(_0x1c2b85,_0x3d3ca2){_0x1c2b85=_0x1c2b85-0x0;var _0x598796=_0xef31[_0x1c2b85];return _0x598796;};'use strict';var Sequelize=require(_0x1ef3('0x0'));module[_0x1ef3('0x1')]={'field':{'type':Sequelize[_0x1ef3('0x2')]},'alias':{'type':Sequelize[_0x1ef3('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1ef3('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1ef3('0x3')]},'custom':{'type':Sequelize[_0x1ef3('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 0b0fc2f..aa44344 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 _0xf6c4=['bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','AnalyticFieldReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','name','options','include','findAll','rows','catch','show','params','includeAll','create','body','bulkCreate','find'];(function(_0x27ba2c,_0xa760f4){var _0x2c09eb=function(_0x58b65a){while(--_0x58b65a){_0x27ba2c['push'](_0x27ba2c['shift']());}};_0x2c09eb(++_0xa760f4);}(_0xf6c4,0x1df));var _0x4f6c=function(_0x32dffe,_0x2c6d36){_0x32dffe=_0x32dffe-0x0;var _0x1f6d1e=_0xf6c4[_0x32dffe];return _0x1f6d1e;};'use strict';var emlformat=require(_0x4f6c('0x0'));var rimraf=require(_0x4f6c('0x1'));var zipdir=require(_0x4f6c('0x2'));var jsonpatch=require(_0x4f6c('0x3'));var rp=require('request-promise');var moment=require(_0x4f6c('0x4'));var BPromise=require(_0x4f6c('0x5'));var Mustache=require(_0x4f6c('0x6'));var util=require(_0x4f6c('0x7'));var path=require(_0x4f6c('0x8'));var sox=require(_0x4f6c('0x9'));var csv=require(_0x4f6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f6c('0xb'));var _=require(_0x4f6c('0xc'));var squel=require('squel');var crypto=require(_0x4f6c('0xd'));var jsforce=require(_0x4f6c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4f6c('0xf'));var Papa=require(_0x4f6c('0x10'));var Redis=require(_0x4f6c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4f6c('0x12'));var as=require(_0x4f6c('0x13'));var hardwareService=require(_0x4f6c('0x14'));var logger=require(_0x4f6c('0x15'))(_0x4f6c('0x16'));var utils=require(_0x4f6c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4f6c('0x18'));var db=require(_0x4f6c('0x19'))['db'];function respondWithStatusCode(_0x418344,_0x3f8b87){_0x3f8b87=_0x3f8b87||0xcc;return function(_0xd84ea6){if(_0xd84ea6){return _0x418344[_0x4f6c('0x1a')](_0x3f8b87);}return _0x418344[_0x4f6c('0x1b')](_0x3f8b87)[_0x4f6c('0x1c')]();};}function respondWithResult(_0x98fd91,_0x1da8b0){_0x1da8b0=_0x1da8b0||0xc8;return function(_0x4e8593){if(_0x4e8593){return _0x98fd91[_0x4f6c('0x1b')](_0x1da8b0)[_0x4f6c('0x1d')](_0x4e8593);}};}function respondWithFilteredResult(_0x338e35,_0x47d159){return function(_0x18c5ca){if(_0x18c5ca){var _0xa0650a=typeof _0x47d159[_0x4f6c('0x1e')]===_0x4f6c('0x1f')&&typeof _0x47d159[_0x4f6c('0x20')]===_0x4f6c('0x1f');var _0x570663=_0x18c5ca[_0x4f6c('0x21')];var _0x5bf655=_0xa0650a?0x0:_0x47d159[_0x4f6c('0x1e')];var _0x5db133=_0xa0650a?_0x18c5ca[_0x4f6c('0x21')]:_0x47d159[_0x4f6c('0x1e')]+_0x47d159[_0x4f6c('0x20')];var _0x29b271;if(_0x5db133>=_0x570663){_0x5db133=_0x570663;_0x29b271=0xc8;}else{_0x29b271=0xce;}_0x338e35[_0x4f6c('0x1b')](_0x29b271);return _0x338e35['set']('Content-Range',_0x5bf655+'-'+_0x5db133+'/'+_0x570663)[_0x4f6c('0x1d')](_0x18c5ca);}return null;};}function patchUpdates(_0x305f46){return function(_0x44d2c5){try{jsonpatch[_0x4f6c('0x22')](_0x44d2c5,_0x305f46,!![]);}catch(_0x7d6e24){return BPromise[_0x4f6c('0x23')](_0x7d6e24);}return _0x44d2c5[_0x4f6c('0x24')]();};}function saveUpdates(_0x58e9de,_0x7c124){return function(_0x569e62){if(_0x569e62){return _0x569e62[_0x4f6c('0x25')](_0x58e9de)['then'](function(_0x1ce493){return _0x1ce493;});}return null;};}function removeEntity(_0x57a5b6,_0x34226d){return function(_0xb39725){if(_0xb39725){return _0xb39725[_0x4f6c('0x26')]()[_0x4f6c('0x27')](function(){_0x57a5b6[_0x4f6c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454c8a,_0x3ca289){return function(_0x44d335){if(!_0x44d335){_0x454c8a[_0x4f6c('0x1a')](0x194);}return _0x44d335;};}function handleError(_0x1780c4,_0xd9d31f){_0xd9d31f=_0xd9d31f||0x1f4;return function(_0x450408){logger[_0x4f6c('0x28')](_0x450408[_0x4f6c('0x29')]);if(_0x450408['name']){delete _0x450408['name'];}_0x1780c4[_0x4f6c('0x1b')](_0xd9d31f)['send'](_0x450408);};}exports['index']=function(_0x34fd1d,_0x1209af){var _0x5613a9={},_0x246b88={},_0x26044e={'count':0x0,'rows':[]};var _0x430604=_['map'](db[_0x4f6c('0x2a')][_0x4f6c('0x2b')],function(_0x30b4da){return{'name':_0x30b4da[_0x4f6c('0x2c')],'type':_0x30b4da[_0x4f6c('0x2d')][_0x4f6c('0x2e')]};});_0x246b88['model']=_[_0x4f6c('0x2f')](_0x430604,'name');_0x246b88[_0x4f6c('0x30')]=_[_0x4f6c('0x31')](_0x34fd1d['query']);_0x246b88[_0x4f6c('0x32')]=_[_0x4f6c('0x33')](_0x246b88[_0x4f6c('0x34')],_0x246b88['query']);_0x5613a9[_0x4f6c('0x35')]=_['intersection'](_0x246b88[_0x4f6c('0x34')],qs[_0x4f6c('0x36')](_0x34fd1d['query']['fields']));_0x5613a9[_0x4f6c('0x35')]=_0x5613a9['attributes'][_0x4f6c('0x37')]?_0x5613a9[_0x4f6c('0x35')]:_0x246b88[_0x4f6c('0x34')];if(!_0x34fd1d[_0x4f6c('0x30')][_0x4f6c('0x38')](_0x4f6c('0x39'))){_0x5613a9[_0x4f6c('0x20')]=qs['limit'](_0x34fd1d[_0x4f6c('0x30')][_0x4f6c('0x20')]);_0x5613a9[_0x4f6c('0x1e')]=qs['offset'](_0x34fd1d['query'][_0x4f6c('0x1e')]);}_0x5613a9[_0x4f6c('0x3a')]=qs['sort'](_0x34fd1d[_0x4f6c('0x30')]['sort']);_0x5613a9[_0x4f6c('0x3b')]=qs[_0x4f6c('0x32')](_['pick'](_0x34fd1d[_0x4f6c('0x30')],_0x246b88['filters']),_0x430604);if(_0x34fd1d[_0x4f6c('0x30')]['filter']){_0x5613a9[_0x4f6c('0x3b')]=_[_0x4f6c('0x3c')](_0x5613a9['where'],{'$or':_[_0x4f6c('0x2f')](_0x430604,function(_0x35cff1){if(_0x35cff1[_0x4f6c('0x2d')]!=='VIRTUAL'){var _0x4ad6fe={};_0x4ad6fe[_0x35cff1[_0x4f6c('0x3d')]]={'$like':'%'+_0x34fd1d['query']['filter']+'%'};return _0x4ad6fe;}})});}_0x5613a9=_[_0x4f6c('0x3c')]({},_0x5613a9,_0x34fd1d[_0x4f6c('0x3e')]);var _0x483d28={'where':_0x5613a9[_0x4f6c('0x3b')]};return db[_0x4f6c('0x2a')][_0x4f6c('0x21')](_0x483d28)[_0x4f6c('0x27')](function(_0x39e09a){_0x26044e[_0x4f6c('0x21')]=_0x39e09a;if(_0x34fd1d[_0x4f6c('0x30')]['includeAll']){_0x5613a9[_0x4f6c('0x3f')]=[{'all':!![]}];}return db[_0x4f6c('0x2a')][_0x4f6c('0x40')](_0x5613a9);})[_0x4f6c('0x27')](function(_0x35374d){_0x26044e[_0x4f6c('0x41')]=_0x35374d;return _0x26044e;})[_0x4f6c('0x27')](respondWithFilteredResult(_0x1209af,_0x5613a9))[_0x4f6c('0x42')](handleError(_0x1209af,null));};exports[_0x4f6c('0x43')]=function(_0x32cfbc,_0x449016){var _0x1f14e4={'raw':![],'where':{'id':_0x32cfbc[_0x4f6c('0x44')]['id']}},_0x255631={};_0x255631[_0x4f6c('0x34')]=_['keys'](db[_0x4f6c('0x2a')][_0x4f6c('0x2b')]);_0x255631[_0x4f6c('0x30')]=_[_0x4f6c('0x31')](_0x32cfbc[_0x4f6c('0x30')]);_0x255631[_0x4f6c('0x32')]=_['intersection'](_0x255631[_0x4f6c('0x34')],_0x255631[_0x4f6c('0x30')]);_0x1f14e4[_0x4f6c('0x35')]=_[_0x4f6c('0x33')](_0x255631[_0x4f6c('0x34')],qs[_0x4f6c('0x36')](_0x32cfbc[_0x4f6c('0x30')][_0x4f6c('0x36')]));_0x1f14e4[_0x4f6c('0x35')]=_0x1f14e4[_0x4f6c('0x35')][_0x4f6c('0x37')]?_0x1f14e4[_0x4f6c('0x35')]:_0x255631[_0x4f6c('0x34')];if(_0x32cfbc['query'][_0x4f6c('0x45')]){_0x1f14e4[_0x4f6c('0x3f')]=[{'all':!![]}];}_0x1f14e4=_[_0x4f6c('0x3c')]({},_0x1f14e4,_0x32cfbc[_0x4f6c('0x3e')]);return db['AnalyticFieldReport']['find'](_0x1f14e4)[_0x4f6c('0x27')](handleEntityNotFound(_0x449016,null))[_0x4f6c('0x27')](respondWithResult(_0x449016,null))['catch'](handleError(_0x449016,null));};exports[_0x4f6c('0x46')]=function(_0x24c60d,_0x45e87d){return db[_0x4f6c('0x2a')][_0x4f6c('0x46')](_0x24c60d[_0x4f6c('0x47')],{})[_0x4f6c('0x27')](respondWithResult(_0x45e87d,0xc9))[_0x4f6c('0x42')](handleError(_0x45e87d,null));};exports[_0x4f6c('0x48')]=function(_0x1cf850,_0x3fbff0){return db[_0x4f6c('0x2a')][_0x4f6c('0x48')](_0x1cf850[_0x4f6c('0x47')],{'raw':![],'individualHooks':!![]})[_0x4f6c('0x27')](respondWithResult(_0x3fbff0,0xc9))['catch'](handleError(_0x3fbff0,null));};exports[_0x4f6c('0x25')]=function(_0x1dd4ba,_0x4fff9e){if(_0x1dd4ba[_0x4f6c('0x47')]['id']){delete _0x1dd4ba[_0x4f6c('0x47')]['id'];}return db[_0x4f6c('0x2a')]['find']({'where':{'id':_0x1dd4ba[_0x4f6c('0x44')]['id']}})[_0x4f6c('0x27')](handleEntityNotFound(_0x4fff9e,null))['then'](saveUpdates(_0x1dd4ba[_0x4f6c('0x47')],null))[_0x4f6c('0x27')](respondWithResult(_0x4fff9e,null))['catch'](handleError(_0x4fff9e,null));};exports['destroy']=function(_0x542d26,_0x102c71){return db[_0x4f6c('0x2a')][_0x4f6c('0x49')]({'where':{'id':_0x542d26[_0x4f6c('0x44')]['id']}})[_0x4f6c('0x27')](handleEntityNotFound(_0x102c71,null))[_0x4f6c('0x27')](removeEntity(_0x102c71,null))[_0x4f6c('0x42')](handleError(_0x102c71,null));};exports[_0x4f6c('0x4a')]=function(_0xa1acb,_0x392260){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0xa1acb['query'][_0x4f6c('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x4f6c('0x27')](respondWithResult(_0x392260,0xcc))[_0x4f6c('0x42')](handleError(_0x392260,null));};exports['addFields']=function(_0x537da0,_0xe3baea,_0x266772){return db[_0x4f6c('0x4c')][_0x4f6c('0x4d')]({'where':{'id':_0x537da0['params']['id']}})[_0x4f6c('0x27')](handleEntityNotFound(_0xe3baea,null))[_0x4f6c('0x27')](function(_0x350836){if(_0x350836){return db[_0x4f6c('0x4e')]['transaction'](function(_0x767dd5){return db[_0x4f6c('0x2a')][_0x4f6c('0x26')]({'where':{'CustomReportId':_0x537da0['params']['id']},'transaction':_0x767dd5})['then'](function(_0x377f6c){var _0x35b3fb=_[_0x4f6c('0x2f')](_0x537da0[_0x4f6c('0x47')],function(_0x41e64b){delete _0x41e64b['id'];_0x41e64b['CustomReportId']=_0x537da0[_0x4f6c('0x44')]['id'];return _0x41e64b;});return db['AnalyticFieldReport']['bulkCreate'](_0x35b3fb,{'transaction':_0x767dd5});});})[_0x4f6c('0x27')](function(){return db[_0x4f6c('0x2a')][_0x4f6c('0x40')]({'where':{'CustomReportId':_0x537da0[_0x4f6c('0x44')]['id']}});});}})[_0x4f6c('0x27')](respondWithResult(_0xe3baea,null))[_0x4f6c('0x42')](handleError(_0xe3baea,null));}; \ No newline at end of file +var _0x6d42=['findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','includeAll','include','catch','show','params','options','find','create','body','bulkCreate','ids','AnalyticCustomReport','findOne','sequelize','transaction','map','CustomReportId'];(function(_0x524eae,_0x418e7c){var _0x2635b9=function(_0x5d2c9f){while(--_0x5d2c9f){_0x524eae['push'](_0x524eae['shift']());}};_0x2635b9(++_0x418e7c);}(_0x6d42,0x151));var _0x26d4=function(_0x4b61fa,_0x428814){_0x4b61fa=_0x4b61fa-0x0;var _0x51c27d=_0x6d42[_0x4b61fa];return _0x51c27d;};'use strict';var emlformat=require(_0x26d4('0x0'));var rimraf=require(_0x26d4('0x1'));var zipdir=require(_0x26d4('0x2'));var jsonpatch=require(_0x26d4('0x3'));var rp=require(_0x26d4('0x4'));var moment=require(_0x26d4('0x5'));var BPromise=require(_0x26d4('0x6'));var Mustache=require(_0x26d4('0x7'));var util=require(_0x26d4('0x8'));var path=require(_0x26d4('0x9'));var sox=require(_0x26d4('0xa'));var csv=require(_0x26d4('0xb'));var ejs=require(_0x26d4('0xc'));var fs=require('fs');var fs_extra=require(_0x26d4('0xd'));var _=require(_0x26d4('0xe'));var squel=require(_0x26d4('0xf'));var crypto=require('crypto');var jsforce=require(_0x26d4('0x10'));var deskjs=require(_0x26d4('0x11'));var toCsv=require(_0x26d4('0xb'));var querystring=require(_0x26d4('0x12'));var Papa=require('papaparse');var Redis=require(_0x26d4('0x13'));var authService=require(_0x26d4('0x14'));var qs=require(_0x26d4('0x15'));var as=require(_0x26d4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26d4('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x26d4('0x18'));var licenseUtil=require(_0x26d4('0x19'));var db=require(_0x26d4('0x1a'))['db'];function respondWithStatusCode(_0xed26f4,_0x3c7a73){_0x3c7a73=_0x3c7a73||0xcc;return function(_0x1dea7e){if(_0x1dea7e){return _0xed26f4[_0x26d4('0x1b')](_0x3c7a73);}return _0xed26f4[_0x26d4('0x1c')](_0x3c7a73)[_0x26d4('0x1d')]();};}function respondWithResult(_0x5636df,_0x1ff05d){_0x1ff05d=_0x1ff05d||0xc8;return function(_0x4adad4){if(_0x4adad4){return _0x5636df[_0x26d4('0x1c')](_0x1ff05d)[_0x26d4('0x1e')](_0x4adad4);}};}function respondWithFilteredResult(_0x15f7c0,_0x4fef30){return function(_0x474d12){if(_0x474d12){var _0x2ed591=typeof _0x4fef30[_0x26d4('0x1f')]===_0x26d4('0x20')&&typeof _0x4fef30['limit']===_0x26d4('0x20');var _0x5c7eb9=_0x474d12['count'];var _0x44566e=_0x2ed591?0x0:_0x4fef30[_0x26d4('0x1f')];var _0x2ff6e9=_0x2ed591?_0x474d12[_0x26d4('0x21')]:_0x4fef30[_0x26d4('0x1f')]+_0x4fef30['limit'];var _0x22fef3;if(_0x2ff6e9>=_0x5c7eb9){_0x2ff6e9=_0x5c7eb9;_0x22fef3=0xc8;}else{_0x22fef3=0xce;}_0x15f7c0[_0x26d4('0x1c')](_0x22fef3);return _0x15f7c0[_0x26d4('0x22')](_0x26d4('0x23'),_0x44566e+'-'+_0x2ff6e9+'/'+_0x5c7eb9)[_0x26d4('0x1e')](_0x474d12);}return null;};}function patchUpdates(_0x1a0621){return function(_0x453e18){try{jsonpatch['apply'](_0x453e18,_0x1a0621,!![]);}catch(_0x227eb0){return BPromise[_0x26d4('0x24')](_0x227eb0);}return _0x453e18[_0x26d4('0x25')]();};}function saveUpdates(_0xf06204,_0x48d4c8){return function(_0x4e04d9){if(_0x4e04d9){return _0x4e04d9[_0x26d4('0x26')](_0xf06204)['then'](function(_0x29e440){return _0x29e440;});}return null;};}function removeEntity(_0x17d7c4,_0x267cdb){return function(_0x3a1d5e){if(_0x3a1d5e){return _0x3a1d5e[_0x26d4('0x27')]()[_0x26d4('0x28')](function(){_0x17d7c4[_0x26d4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x144d6f,_0x2ed92c){return function(_0x49bc0b){if(!_0x49bc0b){_0x144d6f[_0x26d4('0x1b')](0x194);}return _0x49bc0b;};}function handleError(_0x7a14a3,_0x42d9c1){_0x42d9c1=_0x42d9c1||0x1f4;return function(_0x370586){logger[_0x26d4('0x29')](_0x370586[_0x26d4('0x2a')]);if(_0x370586[_0x26d4('0x2b')]){delete _0x370586[_0x26d4('0x2b')];}_0x7a14a3[_0x26d4('0x1c')](_0x42d9c1)[_0x26d4('0x2c')](_0x370586);};}exports[_0x26d4('0x2d')]=function(_0x41567a,_0x5db4a1){var _0x537431={},_0x4ce3ce={},_0x14d481={'count':0x0,'rows':[]};var _0x2167ef=_['map'](db[_0x26d4('0x2e')][_0x26d4('0x2f')],function(_0x4e3676){return{'name':_0x4e3676[_0x26d4('0x30')],'type':_0x4e3676[_0x26d4('0x31')][_0x26d4('0x32')]};});_0x4ce3ce[_0x26d4('0x33')]=_['map'](_0x2167ef,_0x26d4('0x2b'));_0x4ce3ce[_0x26d4('0x34')]=_[_0x26d4('0x35')](_0x41567a['query']);_0x4ce3ce[_0x26d4('0x36')]=_[_0x26d4('0x37')](_0x4ce3ce[_0x26d4('0x33')],_0x4ce3ce[_0x26d4('0x34')]);_0x537431[_0x26d4('0x38')]=_[_0x26d4('0x37')](_0x4ce3ce['model'],qs[_0x26d4('0x39')](_0x41567a[_0x26d4('0x34')][_0x26d4('0x39')]));_0x537431[_0x26d4('0x38')]=_0x537431[_0x26d4('0x38')][_0x26d4('0x3a')]?_0x537431[_0x26d4('0x38')]:_0x4ce3ce[_0x26d4('0x33')];if(!_0x41567a[_0x26d4('0x34')]['hasOwnProperty'](_0x26d4('0x3b'))){_0x537431[_0x26d4('0x3c')]=qs['limit'](_0x41567a[_0x26d4('0x34')][_0x26d4('0x3c')]);_0x537431[_0x26d4('0x1f')]=qs[_0x26d4('0x1f')](_0x41567a['query'][_0x26d4('0x1f')]);}_0x537431[_0x26d4('0x3d')]=qs[_0x26d4('0x3e')](_0x41567a[_0x26d4('0x34')][_0x26d4('0x3e')]);_0x537431[_0x26d4('0x3f')]=qs['filters'](_[_0x26d4('0x40')](_0x41567a[_0x26d4('0x34')],_0x4ce3ce[_0x26d4('0x36')]),_0x2167ef);if(_0x41567a[_0x26d4('0x34')]['filter']){_0x537431[_0x26d4('0x3f')]=_[_0x26d4('0x41')](_0x537431[_0x26d4('0x3f')],{'$or':_['map'](_0x2167ef,function(_0x556354){if(_0x556354['type']!=='VIRTUAL'){var _0x2182d4={};_0x2182d4[_0x556354['name']]={'$like':'%'+_0x41567a['query']['filter']+'%'};return _0x2182d4;}})});}_0x537431=_[_0x26d4('0x41')]({},_0x537431,_0x41567a['options']);var _0x1bb07a={'where':_0x537431[_0x26d4('0x3f')]};return db[_0x26d4('0x2e')]['count'](_0x1bb07a)[_0x26d4('0x28')](function(_0x2ba7e4){_0x14d481['count']=_0x2ba7e4;if(_0x41567a['query'][_0x26d4('0x42')]){_0x537431[_0x26d4('0x43')]=[{'all':!![]}];}return db[_0x26d4('0x2e')]['findAll'](_0x537431);})[_0x26d4('0x28')](function(_0x123b27){_0x14d481['rows']=_0x123b27;return _0x14d481;})[_0x26d4('0x28')](respondWithFilteredResult(_0x5db4a1,_0x537431))[_0x26d4('0x44')](handleError(_0x5db4a1,null));};exports[_0x26d4('0x45')]=function(_0x3242d1,_0x2f1e48){var _0x108843={'raw':![],'where':{'id':_0x3242d1[_0x26d4('0x46')]['id']}},_0x4d7ee5={};_0x4d7ee5[_0x26d4('0x33')]=_[_0x26d4('0x35')](db[_0x26d4('0x2e')][_0x26d4('0x2f')]);_0x4d7ee5[_0x26d4('0x34')]=_[_0x26d4('0x35')](_0x3242d1[_0x26d4('0x34')]);_0x4d7ee5[_0x26d4('0x36')]=_[_0x26d4('0x37')](_0x4d7ee5[_0x26d4('0x33')],_0x4d7ee5[_0x26d4('0x34')]);_0x108843[_0x26d4('0x38')]=_[_0x26d4('0x37')](_0x4d7ee5['model'],qs['fields'](_0x3242d1[_0x26d4('0x34')][_0x26d4('0x39')]));_0x108843[_0x26d4('0x38')]=_0x108843[_0x26d4('0x38')][_0x26d4('0x3a')]?_0x108843[_0x26d4('0x38')]:_0x4d7ee5[_0x26d4('0x33')];if(_0x3242d1[_0x26d4('0x34')]['includeAll']){_0x108843[_0x26d4('0x43')]=[{'all':!![]}];}_0x108843=_['merge']({},_0x108843,_0x3242d1[_0x26d4('0x47')]);return db[_0x26d4('0x2e')][_0x26d4('0x48')](_0x108843)['then'](handleEntityNotFound(_0x2f1e48,null))['then'](respondWithResult(_0x2f1e48,null))[_0x26d4('0x44')](handleError(_0x2f1e48,null));};exports[_0x26d4('0x49')]=function(_0x3ebf4d,_0x7aa3d2){return db[_0x26d4('0x2e')]['create'](_0x3ebf4d[_0x26d4('0x4a')],{})[_0x26d4('0x28')](respondWithResult(_0x7aa3d2,0xc9))[_0x26d4('0x44')](handleError(_0x7aa3d2,null));};exports[_0x26d4('0x4b')]=function(_0x4a2f97,_0x28e907){return db[_0x26d4('0x2e')][_0x26d4('0x4b')](_0x4a2f97['body'],{'raw':![],'individualHooks':!![]})[_0x26d4('0x28')](respondWithResult(_0x28e907,0xc9))[_0x26d4('0x44')](handleError(_0x28e907,null));};exports['update']=function(_0x2ff8c4,_0x33b163){if(_0x2ff8c4[_0x26d4('0x4a')]['id']){delete _0x2ff8c4['body']['id'];}return db['AnalyticFieldReport'][_0x26d4('0x48')]({'where':{'id':_0x2ff8c4[_0x26d4('0x46')]['id']}})['then'](handleEntityNotFound(_0x33b163,null))[_0x26d4('0x28')](saveUpdates(_0x2ff8c4[_0x26d4('0x4a')],null))[_0x26d4('0x28')](respondWithResult(_0x33b163,null))[_0x26d4('0x44')](handleError(_0x33b163,null));};exports['destroy']=function(_0x5045c2,_0x1ef9b3){return db[_0x26d4('0x2e')][_0x26d4('0x48')]({'where':{'id':_0x5045c2[_0x26d4('0x46')]['id']}})[_0x26d4('0x28')](handleEntityNotFound(_0x1ef9b3,null))[_0x26d4('0x28')](removeEntity(_0x1ef9b3,null))[_0x26d4('0x44')](handleError(_0x1ef9b3,null));};exports['bulkDestroy']=function(_0x3e0f3c,_0x46cf40){return db[_0x26d4('0x2e')][_0x26d4('0x27')]({'where':{'id':_0x3e0f3c[_0x26d4('0x34')][_0x26d4('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x46cf40,0xcc))[_0x26d4('0x44')](handleError(_0x46cf40,null));};exports['addFields']=function(_0x2988d1,_0x157831,_0x1766ad){return db[_0x26d4('0x4d')][_0x26d4('0x4e')]({'where':{'id':_0x2988d1['params']['id']}})[_0x26d4('0x28')](handleEntityNotFound(_0x157831,null))['then'](function(_0x413063){if(_0x413063){return db[_0x26d4('0x4f')][_0x26d4('0x50')](function(_0x1b051c){return db[_0x26d4('0x2e')][_0x26d4('0x27')]({'where':{'CustomReportId':_0x2988d1[_0x26d4('0x46')]['id']},'transaction':_0x1b051c})['then'](function(_0x3ba655){var _0x2d4892=_[_0x26d4('0x51')](_0x2988d1[_0x26d4('0x4a')],function(_0x9aa4f4){delete _0x9aa4f4['id'];_0x9aa4f4[_0x26d4('0x52')]=_0x2988d1[_0x26d4('0x46')]['id'];return _0x9aa4f4;});return db[_0x26d4('0x2e')][_0x26d4('0x4b')](_0x2d4892,{'transaction':_0x1b051c});});})[_0x26d4('0x28')](function(){return db[_0x26d4('0x2e')][_0x26d4('0x53')]({'where':{'CustomReportId':_0x2988d1[_0x26d4('0x46')]['id']}});});}})[_0x26d4('0x28')](respondWithResult(_0x157831,null))['catch'](handleError(_0x157831,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3046624..4ae0cd3 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 _0xe582=['rimraf','../../config/environment','exports','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe582,0x130));var _0x2e58=function(_0xa522f,_0x5debbc){_0xa522f=_0xa522f-0x0;var _0x2083b0=_0xe582[_0xa522f];return _0x2083b0;};'use strict';var _=require(_0x2e58('0x0'));var util=require(_0x2e58('0x1'));var logger=require(_0x2e58('0x2'))(_0x2e58('0x3'));var moment=require(_0x2e58('0x4'));var BPromise=require(_0x2e58('0x5'));var rp=require(_0x2e58('0x6'));var fs=require('fs');var path=require(_0x2e58('0x7'));var rimraf=require(_0x2e58('0x8'));var config=require(_0x2e58('0x9'));var attributes=require('./analyticFieldReport.attributes');module[_0x2e58('0xa')]=function(_0x36fac5,_0x32d42d){return _0x36fac5['define'](_0x2e58('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0bf=['lodash','util','api','moment','bluebird','path','../../config/environment','exports','define','analytics_report_fields'];(function(_0x27e502,_0x24cdc3){var _0x53967a=function(_0x426162){while(--_0x426162){_0x27e502['push'](_0x27e502['shift']());}};_0x53967a(++_0x24cdc3);}(_0xa0bf,0x104));var _0xfa0b=function(_0x106604,_0xf73447){_0x106604=_0x106604-0x0;var _0x26ddd8=_0xa0bf[_0x106604];return _0x26ddd8;};'use strict';var _=require(_0xfa0b('0x0'));var util=require(_0xfa0b('0x1'));var logger=require('../../config/logger')(_0xfa0b('0x2'));var moment=require(_0xfa0b('0x3'));var BPromise=require(_0xfa0b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa0b('0x5'));var rimraf=require('rimraf');var config=require(_0xfa0b('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0xfa0b('0x7')]=function(_0x55c247,_0x58b2c3){return _0x55c247[_0xfa0b('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0xfa0b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index d5761fa..21dc5ce 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 _0xca51=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca51,0x196));var _0x1ca5=function(_0x58b63d,_0x2689f0){_0x58b63d=_0x58b63d-0x0;var _0x30738e=_0xca51[_0x58b63d];return _0x30738e;};'use strict';var _=require(_0x1ca5('0x0'));var util=require(_0x1ca5('0x1'));var moment=require(_0x1ca5('0x2'));var BPromise=require(_0x1ca5('0x3'));var rs=require(_0x1ca5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ca5('0x5'));var logger=require(_0x1ca5('0x6'))('rpc');var config=require(_0x1ca5('0x7'));var jayson=require(_0x1ca5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4c68,_0x52f7d2,_0xfd13f7){return new BPromise(function(_0x4f55d5,_0x23614c){return client[_0x1ca5('0x9')](_0x1e4c68,_0xfd13f7)[_0x1ca5('0xa')](function(_0x451974){logger[_0x1ca5('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x52f7d2,_0x1ca5('0xc'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x52f7d2,'request\x20sent',JSON[_0x1ca5('0xd')](_0x451974));if(_0x451974[_0x1ca5('0xe')]){if(_0x451974[_0x1ca5('0xe')][_0x1ca5('0xf')]===0x1f4){logger[_0x1ca5('0xe')](_0x1ca5('0x10'),_0x52f7d2,_0x451974[_0x1ca5('0xe')][_0x1ca5('0x11')]);return _0x23614c(_0x451974[_0x1ca5('0xe')]['message']);}logger[_0x1ca5('0xe')](_0x1ca5('0x10'),_0x52f7d2,_0x451974['error'][_0x1ca5('0x11')]);return _0x4f55d5(_0x451974['error'][_0x1ca5('0x11')]);}else{logger[_0x1ca5('0xb')](_0x1ca5('0x10'),_0x52f7d2,_0x1ca5('0xc'));_0x4f55d5(_0x451974[_0x1ca5('0x12')]['message']);}})[_0x1ca5('0x13')](function(_0x10d983){logger['error'](_0x1ca5('0x10'),_0x52f7d2,_0x10d983);_0x23614c(_0x10d983);});});} \ No newline at end of file +var _0x8dd3=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x243b15,_0x48e5bb){var _0x13f58e=function(_0x1b93ba){while(--_0x1b93ba){_0x243b15['push'](_0x243b15['shift']());}};_0x13f58e(++_0x48e5bb);}(_0x8dd3,0x19a));var _0x38dd=function(_0x26601e,_0x139a4c){_0x26601e=_0x26601e-0x0;var _0x116282=_0x8dd3[_0x26601e];return _0x116282;};'use strict';var _=require('lodash');var util=require(_0x38dd('0x0'));var moment=require(_0x38dd('0x1'));var BPromise=require(_0x38dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38dd('0x3'))['db'];var utils=require(_0x38dd('0x4'));var logger=require(_0x38dd('0x5'))(_0x38dd('0x6'));var config=require(_0x38dd('0x7'));var jayson=require(_0x38dd('0x8'));var client=jayson['client'][_0x38dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b4c6e,_0xd7e510,_0x18abdd){return new BPromise(function(_0x30c27e,_0x219051){return client[_0x38dd('0xa')](_0x5b4c6e,_0x18abdd)[_0x38dd('0xb')](function(_0x35971f){logger[_0x38dd('0xc')](_0x38dd('0xd'),_0xd7e510,'request\x20sent');logger['debug'](_0x38dd('0xe'),_0xd7e510,'request\x20sent',JSON[_0x38dd('0xf')](_0x35971f));if(_0x35971f[_0x38dd('0x10')]){if(_0x35971f['error'][_0x38dd('0x11')]===0x1f4){logger[_0x38dd('0x10')](_0x38dd('0xd'),_0xd7e510,_0x35971f['error'][_0x38dd('0x12')]);return _0x219051(_0x35971f[_0x38dd('0x10')]['message']);}logger[_0x38dd('0x10')](_0x38dd('0xd'),_0xd7e510,_0x35971f[_0x38dd('0x10')][_0x38dd('0x12')]);return _0x30c27e(_0x35971f[_0x38dd('0x10')][_0x38dd('0x12')]);}else{logger[_0x38dd('0xc')](_0x38dd('0xd'),_0xd7e510,_0x38dd('0x13'));_0x30c27e(_0x35971f[_0x38dd('0x14')]['message']);}})['catch'](function(_0x5d07c4){logger['error'](_0x38dd('0xd'),_0xd7e510,_0x5d07c4);_0x219051(_0x5d07c4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b5dd39a..6f68b83 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(_0x1c064c,_0x28adb6){var _0x7c603b=function(_0x3a87ef){while(--_0x3a87ef){_0x1c064c['push'](_0x1c064c['shift']());}};_0x7c603b(++_0x28adb6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x5e4151,_0xc1d194){var _0x25de8f=function(_0x5714ff){while(--_0x5714ff){_0x5e4151['push'](_0x5e4151['shift']());}};_0x25de8f(++_0xc1d194);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 a5b2944..6152910 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 _0x1ca7=['exports','TEXT','STRING','sequelize'];(function(_0x5ec655,_0x1b7d41){var _0x144c58=function(_0x4285dd){while(--_0x4285dd){_0x5ec655['push'](_0x5ec655['shift']());}};_0x144c58(++_0x1b7d41);}(_0x1ca7,0x157));var _0x71ca=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1ca7[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x71ca('0x0'));module[_0x71ca('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x71ca('0x2')]},'description':{'type':Sequelize[_0x71ca('0x3')]}}; \ No newline at end of file +var _0x5fc7=['TEXT','sequelize','exports','STRING','name'];(function(_0x511cb,_0x3e571b){var _0x267407=function(_0x3aa1b6){while(--_0x3aa1b6){_0x511cb['push'](_0x511cb['shift']());}};_0x267407(++_0x3e571b);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x5fc7[_0x2c7dc6];return _0x10002b;};'use strict';var Sequelize=require(_0x75fc('0x0'));module[_0x75fc('0x1')]={'name':{'type':Sequelize[_0x75fc('0x2')],'allowNull':![],'unique':_0x75fc('0x3')},'table':{'type':Sequelize[_0x75fc('0x2')]},'metric':{'type':Sequelize[_0x75fc('0x4')]},'description':{'type':Sequelize[_0x75fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index d8b9cf4..6d21061 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 _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x2c27be,_0x2a4f85){var _0x1da496=function(_0x2f829b){while(--_0x2f829b){_0x2c27be['push'](_0x2c27be['shift']());}};_0x1da496(++_0x2a4f85);}(_0x81bd,0x7c));var _0xd81b=function(_0x3541da,_0x5b2254){_0x3541da=_0x3541da-0x0;var _0xa24cff=_0x81bd[_0x3541da];return _0xa24cff;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file +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(_0x86c9d5,_0x41f245){var _0x5b6aab=function(_0x162a42){while(--_0x162a42){_0x86c9d5['push'](_0x86c9d5['shift']());}};_0x5b6aab(++_0x41f245);}(_0x00bb,0x1d8));var _0xb00b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x00bb[_0x42245d];return _0x4b211a;};'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 diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5c7bb3d..65cff8a 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 _0xb5dd=['moment','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x25db7e,_0x4c8eaa){var _0x1a6163=function(_0x3cb546){while(--_0x3cb546){_0x25db7e['push'](_0x25db7e['shift']());}};_0x1a6163(++_0x4c8eaa);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb5dd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var logger=require(_0xdb5d('0x2'))(_0xdb5d('0x3'));var moment=require(_0xdb5d('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb5d('0x5'));var fs=require('fs');var path=require(_0xdb5d('0x6'));var rimraf=require(_0xdb5d('0x7'));var config=require('../../config/environment');var attributes=require(_0xdb5d('0x8'));module[_0xdb5d('0x9')]=function(_0x43afa8,_0x13996b){return _0x43afa8[_0xdb5d('0xa')](_0xdb5d('0xb'),attributes,{'tableName':_0xdb5d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc61d=['exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticMetric.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc61d,0xfb));var _0xdc61=function(_0x2d1556,_0x2b918c){_0x2d1556=_0x2d1556-0x0;var _0x5514a0=_0xc61d[_0x2d1556];return _0x5514a0;};'use strict';var _=require(_0xdc61('0x0'));var util=require(_0xdc61('0x1'));var logger=require(_0xdc61('0x2'))(_0xdc61('0x3'));var moment=require(_0xdc61('0x4'));var BPromise=require(_0xdc61('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc61('0x6'));var rimraf=require(_0xdc61('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc61('0x8'));module[_0xdc61('0x9')]=function(_0xf7834c,_0x20eef5){return _0xf7834c[_0xdc61('0xa')](_0xdc61('0xb'),attributes,{'tableName':_0xdc61('0xc'),'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 b2ca0e8..9df41d1 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 _0xd32d=['jayson/promise','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x85268c,_0x4cf5a9){var _0x5b4df7=function(_0x4cdf04){while(--_0x4cdf04){_0x85268c['push'](_0x85268c['shift']());}};_0x5b4df7(++_0x4cf5a9);}(_0xd32d,0x91));var _0xdd32=function(_0x4de158,_0x34f440){_0x4de158=_0x4de158-0x0;var _0x214074=_0xd32d[_0x4de158];return _0x214074;};'use strict';var _=require(_0xdd32('0x0'));var util=require(_0xdd32('0x1'));var moment=require(_0xdd32('0x2'));var BPromise=require(_0xdd32('0x3'));var rs=require(_0xdd32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd32('0x5'))['db'];var utils=require(_0xdd32('0x6'));var logger=require(_0xdd32('0x7'))(_0xdd32('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd32('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7486,_0x58db92,_0x396cb3){return new BPromise(function(_0x513d24,_0x350cd4){return client[_0xdd32('0xa')](_0x3d7486,_0x396cb3)[_0xdd32('0xb')](function(_0x3473a1){logger[_0xdd32('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x58db92,_0xdd32('0xd'));logger[_0xdd32('0xe')](_0xdd32('0xf'),_0x58db92,_0xdd32('0xd'),JSON[_0xdd32('0x10')](_0x3473a1));if(_0x3473a1['error']){if(_0x3473a1[_0xdd32('0x11')][_0xdd32('0x12')]===0x1f4){logger['error'](_0xdd32('0x13'),_0x58db92,_0x3473a1[_0xdd32('0x11')][_0xdd32('0x14')]);return _0x350cd4(_0x3473a1[_0xdd32('0x11')]['message']);}logger['error'](_0xdd32('0x13'),_0x58db92,_0x3473a1[_0xdd32('0x11')]['message']);return _0x513d24(_0x3473a1[_0xdd32('0x11')][_0xdd32('0x14')]);}else{logger[_0xdd32('0xc')](_0xdd32('0x13'),_0x58db92,'request\x20sent');_0x513d24(_0x3473a1['result'][_0xdd32('0x14')]);}})[_0xdd32('0x15')](function(_0x77596f){logger[_0xdd32('0x11')](_0xdd32('0x13'),_0x58db92,_0x77596f);_0x350cd4(_0x77596f);});});} \ No newline at end of file +var _0x30e5=['stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','info','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x27ca9a,_0x308d61){var _0x36a049=function(_0x22f4fc){while(--_0x22f4fc){_0x27ca9a['push'](_0x27ca9a['shift']());}};_0x36a049(++_0x308d61);}(_0x30e5,0x94));var _0x530e=function(_0x4998bd,_0x3faca9){_0x4998bd=_0x4998bd-0x0;var _0x5d4b6c=_0x30e5[_0x4998bd];return _0x5d4b6c;};'use strict';var _=require(_0x530e('0x0'));var util=require(_0x530e('0x1'));var moment=require(_0x530e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x530e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x530e('0x4'))(_0x530e('0x5'));var config=require('../../config/environment');var jayson=require(_0x530e('0x6'));var client=jayson['client'][_0x530e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44b038,_0x59be63,_0x544de6){return new BPromise(function(_0x3f7fd0,_0x12498e){return client[_0x530e('0x8')](_0x44b038,_0x544de6)[_0x530e('0x9')](function(_0x583e3e){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x59be63,_0x530e('0xa'));logger[_0x530e('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x59be63,_0x530e('0xa'),JSON[_0x530e('0xc')](_0x583e3e));if(_0x583e3e[_0x530e('0xd')]){if(_0x583e3e[_0x530e('0xd')][_0x530e('0xe')]===0x1f4){logger[_0x530e('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x59be63,_0x583e3e[_0x530e('0xd')]['message']);return _0x12498e(_0x583e3e[_0x530e('0xd')][_0x530e('0xf')]);}logger[_0x530e('0xd')](_0x530e('0x10'),_0x59be63,_0x583e3e['error'][_0x530e('0xf')]);return _0x3f7fd0(_0x583e3e[_0x530e('0xd')][_0x530e('0xf')]);}else{logger[_0x530e('0x11')](_0x530e('0x10'),_0x59be63,_0x530e('0xa'));_0x3f7fd0(_0x583e3e[_0x530e('0x12')][_0x530e('0xf')]);}})[_0x530e('0x13')](function(_0x12e6f2){logger[_0x530e('0xd')](_0x530e('0x10'),_0x59be63,_0x12e6f2);_0x12498e(_0x12e6f2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index de1e65f..6962c95 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 _0x093a=['destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x1719e4,_0x4278fe){var _0x236bac=function(_0x12e8a3){while(--_0x12e8a3){_0x1719e4['push'](_0x1719e4['shift']());}};_0x236bac(++_0x4278fe);}(_0x093a,0x16a));var _0xa093=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x093a[_0x4c630b];return _0x181259;};'use strict';var multer=require('multer');var util=require(_0xa093('0x0'));var path=require(_0xa093('0x1'));var timeout=require(_0xa093('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa093('0x3'));var auth=require(_0xa093('0x4'));var interaction=require(_0xa093('0x5'));var config=require(_0xa093('0x6'));var controller=require(_0xa093('0x7'));router[_0xa093('0x8')]('/',auth[_0xa093('0x9')](),controller[_0xa093('0xa')]);router[_0xa093('0x8')](_0xa093('0xb'),auth[_0xa093('0x9')](),controller[_0xa093('0xc')]);router[_0xa093('0xd')]('/',auth[_0xa093('0x9')](),controller[_0xa093('0xe')]);router[_0xa093('0xf')](_0xa093('0xb'),auth[_0xa093('0x9')](),controller[_0xa093('0x10')]);router[_0xa093('0x11')](_0xa093('0xb'),auth['isAuthenticated'](),controller[_0xa093('0x12')]);module[_0xa093('0x13')]=router; \ No newline at end of file +var _0xa4bd=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa4bd,0x1e4));var _0xda4b=function(_0x141cf7,_0x5d9082){_0x141cf7=_0x141cf7-0x0;var _0x2eff71=_0xa4bd[_0x141cf7];return _0x2eff71;};'use strict';var multer=require(_0xda4b('0x0'));var util=require(_0xda4b('0x1'));var path=require(_0xda4b('0x2'));var timeout=require('connect-timeout');var express=require(_0xda4b('0x3'));var router=express[_0xda4b('0x4')]();var fs_extra=require(_0xda4b('0x5'));var auth=require(_0xda4b('0x6'));var interaction=require(_0xda4b('0x7'));var config=require(_0xda4b('0x8'));var controller=require(_0xda4b('0x9'));router[_0xda4b('0xa')]('/',auth[_0xda4b('0xb')](),controller[_0xda4b('0xc')]);router['get'](_0xda4b('0xd'),auth[_0xda4b('0xb')](),controller[_0xda4b('0xe')]);router[_0xda4b('0xf')]('/',auth['isAuthenticated'](),controller[_0xda4b('0x10')]);router[_0xda4b('0x11')](_0xda4b('0xd'),auth['isAuthenticated'](),controller[_0xda4b('0x12')]);router['delete'](_0xda4b('0xd'),auth[_0xda4b('0xb')](),controller[_0xda4b('0x13')]);module[_0xda4b('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 2f2693b..5d07e0b 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 _0xbff3=['TEXT','sequelize','exports'];(function(_0x41f9d8,_0x4718ba){var _0x13f080=function(_0x3bf1d4){while(--_0x3bf1d4){_0x41f9d8['push'](_0x41f9d8['shift']());}};_0x13f080(++_0x4718ba);}(_0xbff3,0x1f0));var _0x3bff=function(_0x5ed847,_0x1ce9d3){_0x5ed847=_0x5ed847-0x0;var _0x33ed61=_0xbff3[_0x5ed847];return _0x33ed61;};'use strict';var Sequelize=require(_0x3bff('0x0'));module[_0x3bff('0x1')]={'tree':{'type':Sequelize[_0x3bff('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9465=['TEXT','sequelize'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x9465,0x81));var _0x5946=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x9465[_0x15ca1a];return _0x507626;};'use strict';var Sequelize=require(_0x5946('0x0'));module['exports']={'tree':{'type':Sequelize[_0x5946('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 18d4ef3..6a247f0 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 _0x084f=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x219729,_0x19f07d){var _0x35c464=function(_0x3c412c){while(--_0x3c412c){_0x219729['push'](_0x219729['shift']());}};_0x35c464(++_0x19f07d);}(_0x084f,0x1cd));var _0xf084=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x084f[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xf084('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf084('0x1'));var moment=require('moment');var BPromise=require(_0xf084('0x2'));var Mustache=require(_0xf084('0x3'));var util=require('util');var path=require(_0xf084('0x4'));var sox=require(_0xf084('0x5'));var csv=require(_0xf084('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf084('0x7'));var squel=require('squel');var crypto=require(_0xf084('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xf084('0x9'));var toCsv=require('to-csv');var querystring=require(_0xf084('0xa'));var Papa=require(_0xf084('0xb'));var Redis=require(_0xf084('0xc'));var authService=require(_0xf084('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf084('0xe'));var logger=require(_0xf084('0xf'))(_0xf084('0x10'));var utils=require('../../config/utils');var config=require(_0xf084('0x11'));var licenseUtil=require(_0xf084('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19bec2,_0x2d93ce){_0x2d93ce=_0x2d93ce||0xcc;return function(_0x4ac337){if(_0x4ac337){return _0x19bec2[_0xf084('0x13')](_0x2d93ce);}return _0x19bec2[_0xf084('0x14')](_0x2d93ce)[_0xf084('0x15')]();};}function respondWithResult(_0x52d6c3,_0x130180){_0x130180=_0x130180||0xc8;return function(_0x196c13){if(_0x196c13){return _0x52d6c3[_0xf084('0x14')](_0x130180)[_0xf084('0x16')](_0x196c13);}};}function respondWithFilteredResult(_0x3cb84b,_0x2f9168){return function(_0x343e56){if(_0x343e56){var _0x1e3998=typeof _0x2f9168[_0xf084('0x17')]==='undefined'&&typeof _0x2f9168['limit']===_0xf084('0x18');var _0x2ccba5=_0x343e56[_0xf084('0x19')];var _0x186282=_0x1e3998?0x0:_0x2f9168[_0xf084('0x17')];var _0x25cf4a=_0x1e3998?_0x343e56['count']:_0x2f9168['offset']+_0x2f9168[_0xf084('0x1a')];var _0x2cd834;if(_0x25cf4a>=_0x2ccba5){_0x25cf4a=_0x2ccba5;_0x2cd834=0xc8;}else{_0x2cd834=0xce;}_0x3cb84b[_0xf084('0x14')](_0x2cd834);return _0x3cb84b['set']('Content-Range',_0x186282+'-'+_0x25cf4a+'/'+_0x2ccba5)[_0xf084('0x16')](_0x343e56);}return null;};}function patchUpdates(_0x574497){return function(_0x5e1878){try{jsonpatch[_0xf084('0x1b')](_0x5e1878,_0x574497,!![]);}catch(_0x2743ee){return BPromise[_0xf084('0x1c')](_0x2743ee);}return _0x5e1878[_0xf084('0x1d')]();};}function saveUpdates(_0x240956,_0x3a8abe){return function(_0x16e634){if(_0x16e634){return _0x16e634[_0xf084('0x1e')](_0x240956)['then'](function(_0x394133){return _0x394133;});}return null;};}function removeEntity(_0x5d1dd3,_0x1db511){return function(_0x1561c6){if(_0x1561c6){return _0x1561c6['destroy']()[_0xf084('0x1f')](function(){_0x5d1dd3[_0xf084('0x14')](0xcc)[_0xf084('0x15')]();});}};}function handleEntityNotFound(_0x5aa13f,_0x1e72cd){return function(_0x4e7c5e){if(!_0x4e7c5e){_0x5aa13f[_0xf084('0x13')](0x194);}return _0x4e7c5e;};}function handleError(_0x245480,_0x486f24){_0x486f24=_0x486f24||0x1f4;return function(_0x1861dd){logger[_0xf084('0x20')](_0x1861dd[_0xf084('0x21')]);if(_0x1861dd['name']){delete _0x1861dd[_0xf084('0x22')];}_0x245480['status'](_0x486f24)[_0xf084('0x23')](_0x1861dd);};}exports[_0xf084('0x24')]=function(_0x2f6c47,_0x1a6738){var _0x110044={},_0x168a7c={},_0x44cf9e={'count':0x0,'rows':[]};var _0x124bfe=_[_0xf084('0x25')](db[_0xf084('0x26')][_0xf084('0x27')],function(_0x55d8df){return{'name':_0x55d8df[_0xf084('0x28')],'type':_0x55d8df[_0xf084('0x29')]['key']};});_0x168a7c[_0xf084('0x2a')]=_['map'](_0x124bfe,_0xf084('0x22'));_0x168a7c[_0xf084('0x2b')]=_[_0xf084('0x2c')](_0x2f6c47['query']);_0x168a7c[_0xf084('0x2d')]=_[_0xf084('0x2e')](_0x168a7c[_0xf084('0x2a')],_0x168a7c[_0xf084('0x2b')]);_0x110044['attributes']=_['intersection'](_0x168a7c['model'],qs[_0xf084('0x2f')](_0x2f6c47['query'][_0xf084('0x2f')]));_0x110044[_0xf084('0x30')]=_0x110044[_0xf084('0x30')][_0xf084('0x31')]?_0x110044[_0xf084('0x30')]:_0x168a7c[_0xf084('0x2a')];if(!_0x2f6c47[_0xf084('0x2b')][_0xf084('0x32')]('nolimit')){_0x110044[_0xf084('0x1a')]=qs['limit'](_0x2f6c47[_0xf084('0x2b')][_0xf084('0x1a')]);_0x110044[_0xf084('0x17')]=qs[_0xf084('0x17')](_0x2f6c47['query'][_0xf084('0x17')]);}_0x110044[_0xf084('0x33')]=qs[_0xf084('0x34')](_0x2f6c47[_0xf084('0x2b')][_0xf084('0x34')]);_0x110044[_0xf084('0x35')]=qs[_0xf084('0x2d')](_['pick'](_0x2f6c47[_0xf084('0x2b')],_0x168a7c[_0xf084('0x2d')]),_0x124bfe);if(_0x2f6c47[_0xf084('0x2b')][_0xf084('0x36')]){_0x110044['where']=_[_0xf084('0x37')](_0x110044[_0xf084('0x35')],{'$or':_['map'](_0x124bfe,function(_0x513170){if(_0x513170[_0xf084('0x29')]!==_0xf084('0x38')){var _0x1163fc={};_0x1163fc[_0x513170['name']]={'$like':'%'+_0x2f6c47[_0xf084('0x2b')][_0xf084('0x36')]+'%'};return _0x1163fc;}})});}_0x110044=_[_0xf084('0x37')]({},_0x110044,_0x2f6c47[_0xf084('0x39')]);var _0x58d19e={'where':_0x110044[_0xf084('0x35')]};return db[_0xf084('0x26')][_0xf084('0x19')](_0x58d19e)['then'](function(_0x9ac16e){_0x44cf9e[_0xf084('0x19')]=_0x9ac16e;if(_0x2f6c47[_0xf084('0x2b')][_0xf084('0x3a')]){_0x110044[_0xf084('0x3b')]=[{'all':!![]}];}return db[_0xf084('0x26')][_0xf084('0x3c')](_0x110044);})['then'](function(_0x3b56e6){_0x44cf9e[_0xf084('0x3d')]=_0x3b56e6;return _0x44cf9e;})[_0xf084('0x1f')](respondWithFilteredResult(_0x1a6738,_0x110044))[_0xf084('0x3e')](handleError(_0x1a6738,null));};exports[_0xf084('0x3f')]=function(_0x2a8ecd,_0x7a5006){var _0x159d6a={'raw':!![],'where':{'id':_0x2a8ecd[_0xf084('0x40')]['id']}},_0x200a92={};_0x200a92[_0xf084('0x2a')]=_[_0xf084('0x2c')](db['AnalyticTreeReport'][_0xf084('0x27')]);_0x200a92[_0xf084('0x2b')]=_[_0xf084('0x2c')](_0x2a8ecd[_0xf084('0x2b')]);_0x200a92['filters']=_['intersection'](_0x200a92[_0xf084('0x2a')],_0x200a92[_0xf084('0x2b')]);_0x159d6a[_0xf084('0x30')]=_['intersection'](_0x200a92[_0xf084('0x2a')],qs[_0xf084('0x2f')](_0x2a8ecd[_0xf084('0x2b')][_0xf084('0x2f')]));_0x159d6a[_0xf084('0x30')]=_0x159d6a['attributes'][_0xf084('0x31')]?_0x159d6a['attributes']:_0x200a92['model'];if(_0x2a8ecd[_0xf084('0x2b')][_0xf084('0x3a')]){_0x159d6a[_0xf084('0x3b')]=[{'all':!![]}];}_0x159d6a=_[_0xf084('0x37')]({},_0x159d6a,_0x2a8ecd[_0xf084('0x39')]);return db[_0xf084('0x26')][_0xf084('0x41')](_0x159d6a)[_0xf084('0x1f')](handleEntityNotFound(_0x7a5006,null))[_0xf084('0x1f')](respondWithResult(_0x7a5006,null))[_0xf084('0x3e')](handleError(_0x7a5006,null));};exports['create']=function(_0x486235,_0x514ed6){return db[_0xf084('0x26')][_0xf084('0x42')](_0x486235['body'],{})[_0xf084('0x1f')](respondWithResult(_0x514ed6,0xc9))[_0xf084('0x3e')](handleError(_0x514ed6,null));};exports[_0xf084('0x1e')]=function(_0x319e33,_0x4dccfa){if(_0x319e33[_0xf084('0x43')]['id']){delete _0x319e33['body']['id'];}return db[_0xf084('0x26')][_0xf084('0x41')]({'where':{'id':_0x319e33['params']['id']}})[_0xf084('0x1f')](handleEntityNotFound(_0x4dccfa,null))['then'](saveUpdates(_0x319e33[_0xf084('0x43')],null))[_0xf084('0x1f')](respondWithResult(_0x4dccfa,null))[_0xf084('0x3e')](handleError(_0x4dccfa,null));};exports['destroy']=function(_0x57c443,_0x4e9b27){return db[_0xf084('0x26')]['find']({'where':{'id':_0x57c443[_0xf084('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e9b27,null))[_0xf084('0x1f')](removeEntity(_0x4e9b27,null))[_0xf084('0x3e')](handleError(_0x4e9b27,null));}; \ No newline at end of file +var _0xa856=['map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','index'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xa856,0x139));var _0x6a85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa856[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6a85('0x0'));var rimraf=require(_0x6a85('0x1'));var zipdir=require(_0x6a85('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a85('0x3'));var moment=require(_0x6a85('0x4'));var BPromise=require(_0x6a85('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a85('0x6'));var sox=require('sox');var csv=require(_0x6a85('0x7'));var ejs=require(_0x6a85('0x8'));var fs=require('fs');var fs_extra=require(_0x6a85('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a85('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a85('0x7'));var querystring=require(_0x6a85('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a85('0xc'));var qs=require(_0x6a85('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a85('0xe'));var logger=require(_0x6a85('0xf'))('api');var utils=require(_0x6a85('0x10'));var config=require(_0x6a85('0x11'));var licenseUtil=require(_0x6a85('0x12'));var db=require(_0x6a85('0x13'))['db'];function respondWithStatusCode(_0x4fe2da,_0x38352c){_0x38352c=_0x38352c||0xcc;return function(_0x3fd25c){if(_0x3fd25c){return _0x4fe2da[_0x6a85('0x14')](_0x38352c);}return _0x4fe2da['status'](_0x38352c)[_0x6a85('0x15')]();};}function respondWithResult(_0x15c323,_0x4a4005){_0x4a4005=_0x4a4005||0xc8;return function(_0x385e1a){if(_0x385e1a){return _0x15c323[_0x6a85('0x16')](_0x4a4005)[_0x6a85('0x17')](_0x385e1a);}};}function respondWithFilteredResult(_0x214c21,_0x3c07ad){return function(_0x30fc3d){if(_0x30fc3d){var _0x57f9ff=typeof _0x3c07ad[_0x6a85('0x18')]===_0x6a85('0x19')&&typeof _0x3c07ad[_0x6a85('0x1a')]===_0x6a85('0x19');var _0x2ccd5d=_0x30fc3d[_0x6a85('0x1b')];var _0x1e5f72=_0x57f9ff?0x0:_0x3c07ad['offset'];var _0x3752a3=_0x57f9ff?_0x30fc3d[_0x6a85('0x1b')]:_0x3c07ad[_0x6a85('0x18')]+_0x3c07ad[_0x6a85('0x1a')];var _0x3c4151;if(_0x3752a3>=_0x2ccd5d){_0x3752a3=_0x2ccd5d;_0x3c4151=0xc8;}else{_0x3c4151=0xce;}_0x214c21[_0x6a85('0x16')](_0x3c4151);return _0x214c21['set'](_0x6a85('0x1c'),_0x1e5f72+'-'+_0x3752a3+'/'+_0x2ccd5d)[_0x6a85('0x17')](_0x30fc3d);}return null;};}function patchUpdates(_0x494a33){return function(_0x37b631){try{jsonpatch['apply'](_0x37b631,_0x494a33,!![]);}catch(_0x451c37){return BPromise['reject'](_0x451c37);}return _0x37b631[_0x6a85('0x1d')]();};}function saveUpdates(_0x5e0f6b,_0x2f0e24){return function(_0x57a688){if(_0x57a688){return _0x57a688[_0x6a85('0x1e')](_0x5e0f6b)[_0x6a85('0x1f')](function(_0x3b35ce){return _0x3b35ce;});}return null;};}function removeEntity(_0x44e9ee,_0x203d65){return function(_0x577429){if(_0x577429){return _0x577429[_0x6a85('0x20')]()['then'](function(){_0x44e9ee[_0x6a85('0x16')](0xcc)[_0x6a85('0x15')]();});}};}function handleEntityNotFound(_0x448626,_0x2d4815){return function(_0x4cc0c5){if(!_0x4cc0c5){_0x448626[_0x6a85('0x14')](0x194);}return _0x4cc0c5;};}function handleError(_0x3b2b49,_0x5a21ac){_0x5a21ac=_0x5a21ac||0x1f4;return function(_0x4653fc){logger[_0x6a85('0x21')](_0x4653fc[_0x6a85('0x22')]);if(_0x4653fc[_0x6a85('0x23')]){delete _0x4653fc[_0x6a85('0x23')];}_0x3b2b49[_0x6a85('0x16')](_0x5a21ac)['send'](_0x4653fc);};}exports[_0x6a85('0x24')]=function(_0x588e52,_0x11cf6f){var _0x5fa685={},_0x54cc78={},_0x4e5daf={'count':0x0,'rows':[]};var _0x547bd8=_[_0x6a85('0x25')](db[_0x6a85('0x26')][_0x6a85('0x27')],function(_0x1f375f){return{'name':_0x1f375f[_0x6a85('0x28')],'type':_0x1f375f[_0x6a85('0x29')][_0x6a85('0x2a')]};});_0x54cc78[_0x6a85('0x2b')]=_[_0x6a85('0x25')](_0x547bd8,_0x6a85('0x23'));_0x54cc78[_0x6a85('0x2c')]=_[_0x6a85('0x2d')](_0x588e52['query']);_0x54cc78[_0x6a85('0x2e')]=_[_0x6a85('0x2f')](_0x54cc78[_0x6a85('0x2b')],_0x54cc78[_0x6a85('0x2c')]);_0x5fa685['attributes']=_[_0x6a85('0x2f')](_0x54cc78[_0x6a85('0x2b')],qs[_0x6a85('0x30')](_0x588e52['query'][_0x6a85('0x30')]));_0x5fa685[_0x6a85('0x31')]=_0x5fa685[_0x6a85('0x31')][_0x6a85('0x32')]?_0x5fa685[_0x6a85('0x31')]:_0x54cc78['model'];if(!_0x588e52[_0x6a85('0x2c')][_0x6a85('0x33')](_0x6a85('0x34'))){_0x5fa685[_0x6a85('0x1a')]=qs[_0x6a85('0x1a')](_0x588e52[_0x6a85('0x2c')][_0x6a85('0x1a')]);_0x5fa685[_0x6a85('0x18')]=qs[_0x6a85('0x18')](_0x588e52[_0x6a85('0x2c')]['offset']);}_0x5fa685[_0x6a85('0x35')]=qs[_0x6a85('0x36')](_0x588e52[_0x6a85('0x2c')][_0x6a85('0x36')]);_0x5fa685[_0x6a85('0x37')]=qs['filters'](_[_0x6a85('0x38')](_0x588e52[_0x6a85('0x2c')],_0x54cc78[_0x6a85('0x2e')]),_0x547bd8);if(_0x588e52['query'][_0x6a85('0x39')]){_0x5fa685[_0x6a85('0x37')]=_['merge'](_0x5fa685[_0x6a85('0x37')],{'$or':_[_0x6a85('0x25')](_0x547bd8,function(_0x41086f){if(_0x41086f[_0x6a85('0x29')]!==_0x6a85('0x3a')){var _0x4ce7eb={};_0x4ce7eb[_0x41086f[_0x6a85('0x23')]]={'$like':'%'+_0x588e52[_0x6a85('0x2c')][_0x6a85('0x39')]+'%'};return _0x4ce7eb;}})});}_0x5fa685=_['merge']({},_0x5fa685,_0x588e52[_0x6a85('0x3b')]);var _0x5bfaa1={'where':_0x5fa685[_0x6a85('0x37')]};return db[_0x6a85('0x26')][_0x6a85('0x1b')](_0x5bfaa1)[_0x6a85('0x1f')](function(_0x3dccaa){_0x4e5daf['count']=_0x3dccaa;if(_0x588e52[_0x6a85('0x2c')][_0x6a85('0x3c')]){_0x5fa685[_0x6a85('0x3d')]=[{'all':!![]}];}return db[_0x6a85('0x26')][_0x6a85('0x3e')](_0x5fa685);})['then'](function(_0x5d9e62){_0x4e5daf[_0x6a85('0x3f')]=_0x5d9e62;return _0x4e5daf;})['then'](respondWithFilteredResult(_0x11cf6f,_0x5fa685))['catch'](handleError(_0x11cf6f,null));};exports['show']=function(_0x81109a,_0x278c4c){var _0x8ca301={'raw':!![],'where':{'id':_0x81109a[_0x6a85('0x40')]['id']}},_0x4ee031={};_0x4ee031[_0x6a85('0x2b')]=_[_0x6a85('0x2d')](db[_0x6a85('0x26')][_0x6a85('0x27')]);_0x4ee031[_0x6a85('0x2c')]=_[_0x6a85('0x2d')](_0x81109a[_0x6a85('0x2c')]);_0x4ee031[_0x6a85('0x2e')]=_[_0x6a85('0x2f')](_0x4ee031[_0x6a85('0x2b')],_0x4ee031[_0x6a85('0x2c')]);_0x8ca301[_0x6a85('0x31')]=_[_0x6a85('0x2f')](_0x4ee031['model'],qs['fields'](_0x81109a['query'][_0x6a85('0x30')]));_0x8ca301[_0x6a85('0x31')]=_0x8ca301[_0x6a85('0x31')][_0x6a85('0x32')]?_0x8ca301[_0x6a85('0x31')]:_0x4ee031['model'];if(_0x81109a[_0x6a85('0x2c')][_0x6a85('0x3c')]){_0x8ca301[_0x6a85('0x3d')]=[{'all':!![]}];}_0x8ca301=_[_0x6a85('0x41')]({},_0x8ca301,_0x81109a[_0x6a85('0x3b')]);return db[_0x6a85('0x26')][_0x6a85('0x42')](_0x8ca301)[_0x6a85('0x1f')](handleEntityNotFound(_0x278c4c,null))[_0x6a85('0x1f')](respondWithResult(_0x278c4c,null))[_0x6a85('0x43')](handleError(_0x278c4c,null));};exports[_0x6a85('0x44')]=function(_0x356dc2,_0x3caf73){return db[_0x6a85('0x26')][_0x6a85('0x44')](_0x356dc2[_0x6a85('0x45')],{})[_0x6a85('0x1f')](respondWithResult(_0x3caf73,0xc9))[_0x6a85('0x43')](handleError(_0x3caf73,null));};exports['update']=function(_0x109bd3,_0x139139){if(_0x109bd3[_0x6a85('0x45')]['id']){delete _0x109bd3[_0x6a85('0x45')]['id'];}return db['AnalyticTreeReport'][_0x6a85('0x42')]({'where':{'id':_0x109bd3[_0x6a85('0x40')]['id']}})[_0x6a85('0x1f')](handleEntityNotFound(_0x139139,null))['then'](saveUpdates(_0x109bd3[_0x6a85('0x45')],null))[_0x6a85('0x1f')](respondWithResult(_0x139139,null))['catch'](handleError(_0x139139,null));};exports[_0x6a85('0x20')]=function(_0x2a06f3,_0x176bf1){return db[_0x6a85('0x26')][_0x6a85('0x42')]({'where':{'id':_0x2a06f3[_0x6a85('0x40')]['id']}})[_0x6a85('0x1f')](handleEntityNotFound(_0x176bf1,null))[_0x6a85('0x1f')](removeEntity(_0x176bf1,null))[_0x6a85('0x43')](handleError(_0x176bf1,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a1bad7c..901b084 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 _0x1f01=['define','AnalyticTreeReport','lodash','util','../../config/logger','api','moment','path','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x2fdef1,_0x4cb3a9){var _0x36944c=function(_0xe87218){while(--_0xe87218){_0x2fdef1['push'](_0x2fdef1['shift']());}};_0x36944c(++_0x4cb3a9);}(_0x1f01,0xde));var _0x11f0=function(_0x518e15,_0x568735){_0x518e15=_0x518e15-0x0;var _0x3bd658=_0x1f01[_0x518e15];return _0x3bd658;};'use strict';var _=require(_0x11f0('0x0'));var util=require(_0x11f0('0x1'));var logger=require(_0x11f0('0x2'))(_0x11f0('0x3'));var moment=require(_0x11f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x11f0('0x5'));var rimraf=require('rimraf');var config=require(_0x11f0('0x6'));var attributes=require(_0x11f0('0x7'));module[_0x11f0('0x8')]=function(_0x267d90,_0x343d5f){return _0x267d90[_0x11f0('0x9')](_0x11f0('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb327=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash'];(function(_0x45fa7d,_0x2c3049){var _0x1f9fe0=function(_0x7389f1){while(--_0x7389f1){_0x45fa7d['push'](_0x45fa7d['shift']());}};_0x1f9fe0(++_0x2c3049);}(_0xb327,0x137));var _0x7b32=function(_0x36e9da,_0x133203){_0x36e9da=_0x36e9da-0x0;var _0x58f668=_0xb327[_0x36e9da];return _0x58f668;};'use strict';var _=require(_0x7b32('0x0'));var util=require(_0x7b32('0x1'));var logger=require(_0x7b32('0x2'))(_0x7b32('0x3'));var moment=require('moment');var BPromise=require(_0x7b32('0x4'));var rp=require(_0x7b32('0x5'));var fs=require('fs');var path=require(_0x7b32('0x6'));var rimraf=require(_0x7b32('0x7'));var config=require(_0x7b32('0x8'));var attributes=require(_0x7b32('0x9'));module[_0x7b32('0xa')]=function(_0x2446a0,_0x38fdcd){return _0x2446a0[_0x7b32('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x7b32('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 6e311f7..9556b43 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x337261,_0x1182a7){var _0x2639a1=function(_0x3b83c1){while(--_0x3b83c1){_0x337261['push'](_0x337261['shift']());}};_0x2639a1(++_0x1182a7);}(_0x1261,0x144));var _0x1126=function(_0x1a48a0,_0x3c95f5){_0x1a48a0=_0x1a48a0-0x0;var _0x269714=_0x1261[_0x1a48a0];return _0x269714;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4d324d,_0x16b4f3){var _0x34c197=function(_0x506963){while(--_0x506963){_0x4d324d['push'](_0x4d324d['shift']());}};_0x34c197(++_0x16b4f3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13d130,_0x5c9dc1){_0x13d130=_0x13d130-0x0;var _0x52df35=_0x5f2f[_0x13d130];return _0x52df35;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6dc225b..1da8027 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 _0xd89c=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','/:id','destroy','exports','util','path'];(function(_0x1b0750,_0xe873a2){var _0x2153ab=function(_0x414941){while(--_0x414941){_0x1b0750['push'](_0x1b0750['shift']());}};_0x2153ab(++_0xe873a2);}(_0xd89c,0x76));var _0xcd89=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xd89c[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require('multer');var util=require(_0xcd89('0x0'));var path=require(_0xcd89('0x1'));var timeout=require(_0xcd89('0x2'));var express=require('express');var router=express[_0xcd89('0x3')]();var fs_extra=require(_0xcd89('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcd89('0x5'));var config=require(_0xcd89('0x6'));var controller=require('./analyticTreeReport.controller');router[_0xcd89('0x7')]('/',auth[_0xcd89('0x8')](),controller[_0xcd89('0x9')]);router[_0xcd89('0x7')]('/:id',auth[_0xcd89('0x8')](),controller['show']);router[_0xcd89('0xa')]('/',auth[_0xcd89('0x8')](),controller[_0xcd89('0xb')]);router['put']('/:id',auth[_0xcd89('0x8')](),controller['update']);router['delete'](_0xcd89('0xc'),auth[_0xcd89('0x8')](),controller[_0xcd89('0xd')]);module[_0xcd89('0xe')]=router; \ No newline at end of file +var _0x641b=['../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','index','get','show','post','create','update','delete','/:id','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x641b,0x1ab));var _0xb641=function(_0x334b90,_0x7fe59b){_0x334b90=_0x334b90-0x0;var _0x13e76b=_0x641b[_0x334b90];return _0x13e76b;};'use strict';var multer=require(_0xb641('0x0'));var util=require(_0xb641('0x1'));var path=require('path');var timeout=require(_0xb641('0x2'));var express=require(_0xb641('0x3'));var router=express['Router']();var fs_extra=require(_0xb641('0x4'));var auth=require(_0xb641('0x5'));var interaction=require(_0xb641('0x6'));var config=require('../../config/environment');var controller=require(_0xb641('0x7'));router['get']('/',auth[_0xb641('0x8')](),controller[_0xb641('0x9')]);router[_0xb641('0xa')]('/:id',auth[_0xb641('0x8')](),controller[_0xb641('0xb')]);router[_0xb641('0xc')]('/',auth[_0xb641('0x8')](),controller[_0xb641('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb641('0xe')]);router[_0xb641('0xf')](_0xb641('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xb641('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f47b515..1a782de 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 _0xdb13=['exports','STRING'];(function(_0x13dee0,_0x5e168e){var _0x61d462=function(_0xf5c736){while(--_0xf5c736){_0x13dee0['push'](_0x13dee0['shift']());}};_0x61d462(++_0x5e168e);}(_0xdb13,0x10c));var _0x3db1=function(_0xbf8aed,_0x2a7eca){_0xbf8aed=_0xbf8aed-0x0;var _0x271f3d=_0xdb13[_0xbf8aed];return _0x271f3d;};'use strict';var Sequelize=require('sequelize');module[_0x3db1('0x0')]={'name':{'type':Sequelize[_0x3db1('0x1')]},'basename':{'type':Sequelize[_0x3db1('0x1')]},'type':{'type':Sequelize[_0x3db1('0x1')]}}; \ No newline at end of file +var _0x3cd1=['exports','STRING'];(function(_0x3fcbe1,_0x5b1f24){var _0x5efafc=function(_0x4bae4c){while(--_0x4bae4c){_0x3fcbe1['push'](_0x3fcbe1['shift']());}};_0x5efafc(++_0x5b1f24);}(_0x3cd1,0x112));var _0x13cd=function(_0x31405e,_0x19260b){_0x31405e=_0x31405e-0x0;var _0x2a9b18=_0x3cd1[_0x31405e];return _0x2a9b18;};'use strict';var Sequelize=require('sequelize');module[_0x13cd('0x0')]={'name':{'type':Sequelize[_0x13cd('0x1')]},'basename':{'type':Sequelize[_0x13cd('0x1')]},'type':{'type':Sequelize[_0x13cd('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index f012d4d..e133c0c 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 _0x1fe8=['body','create','file','originalname','filename','mimetype','download','findOne','join','root','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','clone','get','omit','createdAt','updatedAt'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1fe8,0x6b));var _0x81fe=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1fe8[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0x81fe('0x0'));var rimraf=require(_0x81fe('0x1'));var zipdir=require(_0x81fe('0x2'));var jsonpatch=require(_0x81fe('0x3'));var rp=require(_0x81fe('0x4'));var moment=require(_0x81fe('0x5'));var BPromise=require(_0x81fe('0x6'));var Mustache=require(_0x81fe('0x7'));var util=require('util');var path=require(_0x81fe('0x8'));var sox=require(_0x81fe('0x9'));var csv=require(_0x81fe('0xa'));var ejs=require(_0x81fe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81fe('0xc'));var squel=require(_0x81fe('0xd'));var crypto=require(_0x81fe('0xe'));var jsforce=require(_0x81fe('0xf'));var deskjs=require(_0x81fe('0x10'));var toCsv=require(_0x81fe('0xa'));var querystring=require(_0x81fe('0x11'));var Papa=require(_0x81fe('0x12'));var Redis=require('ioredis');var authService=require(_0x81fe('0x13'));var qs=require(_0x81fe('0x14'));var as=require(_0x81fe('0x15'));var hardwareService=require(_0x81fe('0x16'));var logger=require(_0x81fe('0x17'))(_0x81fe('0x18'));var utils=require(_0x81fe('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81fe('0x1a'))['db'];function respondWithStatusCode(_0x133db9,_0x20ab46){_0x20ab46=_0x20ab46||0xcc;return function(_0x12ed09){if(_0x12ed09){return _0x133db9[_0x81fe('0x1b')](_0x20ab46);}return _0x133db9[_0x81fe('0x1c')](_0x20ab46)[_0x81fe('0x1d')]();};}function respondWithResult(_0x130b87,_0x434957){_0x434957=_0x434957||0xc8;return function(_0x199cf5){if(_0x199cf5){return _0x130b87[_0x81fe('0x1c')](_0x434957)[_0x81fe('0x1e')](_0x199cf5);}};}function respondWithFilteredResult(_0x3b6bc0,_0xb47cea){return function(_0x242c32){if(_0x242c32){var _0xcccbbc=typeof _0xb47cea['offset']===_0x81fe('0x1f')&&typeof _0xb47cea[_0x81fe('0x20')]===_0x81fe('0x1f');var _0x1af871=_0x242c32['count'];var _0x1f276f=_0xcccbbc?0x0:_0xb47cea[_0x81fe('0x21')];var _0x3ae6db=_0xcccbbc?_0x242c32[_0x81fe('0x22')]:_0xb47cea[_0x81fe('0x21')]+_0xb47cea[_0x81fe('0x20')];var _0x26ad54;if(_0x3ae6db>=_0x1af871){_0x3ae6db=_0x1af871;_0x26ad54=0xc8;}else{_0x26ad54=0xce;}_0x3b6bc0['status'](_0x26ad54);return _0x3b6bc0['set'](_0x81fe('0x23'),_0x1f276f+'-'+_0x3ae6db+'/'+_0x1af871)[_0x81fe('0x1e')](_0x242c32);}return null;};}function patchUpdates(_0x5d88b4){return function(_0x5adfb4){try{jsonpatch[_0x81fe('0x24')](_0x5adfb4,_0x5d88b4,!![]);}catch(_0x3c9462){return BPromise['reject'](_0x3c9462);}return _0x5adfb4[_0x81fe('0x25')]();};}function saveUpdates(_0x5778e1,_0x4aa2e4){return function(_0x22bcbc){if(_0x22bcbc){return _0x22bcbc[_0x81fe('0x26')](_0x5778e1)[_0x81fe('0x27')](function(_0x2f0d90){return _0x2f0d90;});}return null;};}function removeEntity(_0x5ac3c9,_0xd3b5c4){return function(_0x3f33ef){if(_0x3f33ef){return _0x3f33ef['destroy']()[_0x81fe('0x27')](function(){_0x5ac3c9['status'](0xcc)[_0x81fe('0x1d')]();});}};}function handleEntityNotFound(_0x980b6c,_0x2e0ff1){return function(_0x118a84){if(!_0x118a84){_0x980b6c[_0x81fe('0x1b')](0x194);}return _0x118a84;};}function handleError(_0x21ce6b,_0xac1cf9){_0xac1cf9=_0xac1cf9||0x1f4;return function(_0x4ac2a7){logger['error'](_0x4ac2a7[_0x81fe('0x28')]);if(_0x4ac2a7[_0x81fe('0x29')]){delete _0x4ac2a7[_0x81fe('0x29')];}_0x21ce6b['status'](_0xac1cf9)[_0x81fe('0x2a')](_0x4ac2a7);};}exports[_0x81fe('0x2b')]=function(_0x481c55,_0xaaf44e){var _0x10177a={},_0x2a1955={},_0x4b73a9={'count':0x0,'rows':[]};var _0x43a5b0=_[_0x81fe('0x2c')](db[_0x81fe('0x2d')][_0x81fe('0x2e')],function(_0x3dae16){return{'name':_0x3dae16[_0x81fe('0x2f')],'type':_0x3dae16[_0x81fe('0x30')][_0x81fe('0x31')]};});_0x2a1955[_0x81fe('0x32')]=_['map'](_0x43a5b0,'name');_0x2a1955[_0x81fe('0x33')]=_[_0x81fe('0x34')](_0x481c55[_0x81fe('0x33')]);_0x2a1955[_0x81fe('0x35')]=_['intersection'](_0x2a1955['model'],_0x2a1955[_0x81fe('0x33')]);_0x10177a[_0x81fe('0x36')]=_['intersection'](_0x2a1955[_0x81fe('0x32')],qs[_0x81fe('0x37')](_0x481c55[_0x81fe('0x33')]['fields']));_0x10177a['attributes']=_0x10177a['attributes'][_0x81fe('0x38')]?_0x10177a['attributes']:_0x2a1955[_0x81fe('0x32')];if(!_0x481c55[_0x81fe('0x33')][_0x81fe('0x39')](_0x81fe('0x3a'))){_0x10177a[_0x81fe('0x20')]=qs[_0x81fe('0x20')](_0x481c55['query']['limit']);_0x10177a[_0x81fe('0x21')]=qs[_0x81fe('0x21')](_0x481c55[_0x81fe('0x33')][_0x81fe('0x21')]);}_0x10177a[_0x81fe('0x3b')]=qs[_0x81fe('0x3c')](_0x481c55[_0x81fe('0x33')][_0x81fe('0x3c')]);_0x10177a[_0x81fe('0x3d')]=qs[_0x81fe('0x35')](_[_0x81fe('0x3e')](_0x481c55[_0x81fe('0x33')],_0x2a1955[_0x81fe('0x35')]),_0x43a5b0);if(_0x481c55[_0x81fe('0x33')]['filter']){_0x10177a['where']=_[_0x81fe('0x3f')](_0x10177a[_0x81fe('0x3d')],{'$or':_[_0x81fe('0x2c')](_0x43a5b0,function(_0x535005){if(_0x535005[_0x81fe('0x30')]!==_0x81fe('0x40')){var _0x1df42e={};_0x1df42e[_0x535005[_0x81fe('0x29')]]={'$like':'%'+_0x481c55[_0x81fe('0x33')][_0x81fe('0x41')]+'%'};return _0x1df42e;}})});}_0x10177a=_[_0x81fe('0x3f')]({},_0x10177a,_0x481c55[_0x81fe('0x42')]);var _0x21577f={'where':_0x10177a[_0x81fe('0x3d')]};return db[_0x81fe('0x2d')][_0x81fe('0x22')](_0x21577f)[_0x81fe('0x27')](function(_0x5bb41e){_0x4b73a9['count']=_0x5bb41e;if(_0x481c55['query'][_0x81fe('0x43')]){_0x10177a[_0x81fe('0x44')]=[{'all':!![]}];}return db[_0x81fe('0x2d')][_0x81fe('0x45')](_0x10177a);})[_0x81fe('0x27')](function(_0x235b62){_0x4b73a9[_0x81fe('0x46')]=_0x235b62;return _0x4b73a9;})[_0x81fe('0x27')](respondWithFilteredResult(_0xaaf44e,_0x10177a))[_0x81fe('0x47')](handleError(_0xaaf44e,null));};exports[_0x81fe('0x48')]=function(_0x2acf56,_0x17344f){var _0x315283={'raw':!![],'where':{'id':_0x2acf56[_0x81fe('0x49')]['id']}},_0x3493b1={};_0x3493b1['model']=_[_0x81fe('0x34')](db['Attachment'][_0x81fe('0x2e')]);_0x3493b1[_0x81fe('0x33')]=_[_0x81fe('0x34')](_0x2acf56[_0x81fe('0x33')]);_0x3493b1['filters']=_[_0x81fe('0x4a')](_0x3493b1[_0x81fe('0x32')],_0x3493b1[_0x81fe('0x33')]);_0x315283[_0x81fe('0x36')]=_[_0x81fe('0x4a')](_0x3493b1[_0x81fe('0x32')],qs[_0x81fe('0x37')](_0x2acf56[_0x81fe('0x33')][_0x81fe('0x37')]));_0x315283[_0x81fe('0x36')]=_0x315283[_0x81fe('0x36')][_0x81fe('0x38')]?_0x315283['attributes']:_0x3493b1[_0x81fe('0x32')];if(_0x2acf56[_0x81fe('0x33')][_0x81fe('0x43')]){_0x315283[_0x81fe('0x44')]=[{'all':!![]}];}_0x315283=_[_0x81fe('0x3f')]({},_0x315283,_0x2acf56['options']);return db[_0x81fe('0x2d')][_0x81fe('0x4b')](_0x315283)[_0x81fe('0x27')](handleEntityNotFound(_0x17344f,null))['then'](respondWithResult(_0x17344f,null))['catch'](handleError(_0x17344f,null));};exports[_0x81fe('0x4c')]=function(_0x5bc0f1,_0x3a765a){var _0x170866={'where':{'id':_0x5bc0f1[_0x81fe('0x49')]['id']}},_0x127f75={};_0x127f75['model']=_[_0x81fe('0x34')](db[_0x81fe('0x2d')][_0x81fe('0x2e')]);_0x170866[_0x81fe('0x36')]=_[_0x81fe('0x4a')](_0x127f75[_0x81fe('0x32')],qs[_0x81fe('0x37')](_0x5bc0f1[_0x81fe('0x33')][_0x81fe('0x37')]));_0x170866[_0x81fe('0x36')]=_0x170866[_0x81fe('0x36')]['length']?_0x170866[_0x81fe('0x36')]:_0x127f75[_0x81fe('0x32')];if(_0x5bc0f1[_0x81fe('0x33')][_0x81fe('0x43')]){_0x170866[_0x81fe('0x44')]=[{'all':!![]}];}_0x170866=_[_0x81fe('0x3f')]({},_0x170866,_0x5bc0f1[_0x81fe('0x42')]);return db['Attachment'][_0x81fe('0x4b')](_0x170866)[_0x81fe('0x27')](handleEntityNotFound(_0x3a765a,null))[_0x81fe('0x27')](function(_0xb7f83d){if(_0xb7f83d){var _0x3c77ef=_0xb7f83d[_0x81fe('0x4d')]({'plain':!![]});_0x3c77ef=qs[_0x81fe('0x4e')](_0x3c77ef,['id',_0x81fe('0x4f'),_0x81fe('0x50')]);_0x5bc0f1[_0x81fe('0x51')]=_[_0x81fe('0x4e')](_0x5bc0f1[_0x81fe('0x51')],['id','createdAt',_0x81fe('0x50')]);return db[_0x81fe('0x2d')]['create'](_[_0x81fe('0x3f')](_0x3c77ef,_0x5bc0f1['body']),{'include':_0x5bc0f1['query'][_0x81fe('0x43')]?[{'all':!![]}]:undefined});}})[_0x81fe('0x27')](respondWithResult(_0x3a765a,0xc9))[_0x81fe('0x47')](handleError(_0x3a765a,null));};exports[_0x81fe('0x26')]=function(_0x5d7040,_0x11e59a){if(_0x5d7040[_0x81fe('0x51')]['id']){delete _0x5d7040['body']['id'];}return db[_0x81fe('0x2d')][_0x81fe('0x4b')]({'where':{'id':_0x5d7040[_0x81fe('0x49')]['id']}})[_0x81fe('0x27')](handleEntityNotFound(_0x11e59a,null))[_0x81fe('0x27')](saveUpdates(_0x5d7040[_0x81fe('0x51')],null))['then'](respondWithResult(_0x11e59a,null))['catch'](handleError(_0x11e59a,null));};exports['destroy']=function(_0xe3adbe,_0x26633b){return db['Attachment'][_0x81fe('0x4b')]({'where':{'id':_0xe3adbe[_0x81fe('0x49')]['id']}})[_0x81fe('0x27')](handleEntityNotFound(_0x26633b,null))[_0x81fe('0x27')](removeEntity(_0x26633b,null))[_0x81fe('0x47')](handleError(_0x26633b,null));};exports[_0x81fe('0x52')]=function(_0x181f90,_0xa1a184,_0xa0ab11){_0x181f90[_0x81fe('0x51')][_0x81fe('0x29')]=_0x181f90[_0x81fe('0x53')][_0x81fe('0x54')];_0x181f90[_0x81fe('0x51')]['basename']=_0x181f90[_0x81fe('0x53')][_0x81fe('0x55')];_0x181f90[_0x81fe('0x51')][_0x81fe('0x30')]=_0x181f90[_0x81fe('0x53')][_0x81fe('0x56')];return db[_0x81fe('0x2d')][_0x81fe('0x52')](_0x181f90[_0x81fe('0x51')])[_0x81fe('0x27')](respondWithResult(_0xa1a184,0xc9))['catch'](handleError(_0xa1a184,null));};exports[_0x81fe('0x57')]=function(_0xfcad8b,_0x449bec,_0x129e9b){return db[_0x81fe('0x2d')][_0x81fe('0x58')]({'where':{'id':_0xfcad8b[_0x81fe('0x49')]['id']},'raw':!![]})[_0x81fe('0x27')](handleEntityNotFound(_0x449bec,null))[_0x81fe('0x27')](function(_0x227c31){if(_0x227c31){var _0x16426d=_0x227c31['ChatOfflineMessageId']!==null;var _0x259d02=path[_0x81fe('0x59')](config[_0x81fe('0x5a')],_0x81fe('0x5b'));if(_0x16426d){_0x259d02=path[_0x81fe('0x59')](_0x259d02,_0x81fe('0x5c'));}var _0x8e9a76=path[_0x81fe('0x59')](_0x259d02,_0x227c31[_0x81fe('0x5d')]);return _0x449bec['download'](_0x8e9a76);}})[_0x81fe('0x47')](handleError(_0x449bec,null));}; \ No newline at end of file +var _0x8116=['catch','show','find','clone','params','length','omit','createdAt','updatedAt','body','create','file','originalname','filename','mimetype','download','findOne','join','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include'];(function(_0x5da341,_0x540c57){var _0x1365f3=function(_0x386dcc){while(--_0x386dcc){_0x5da341['push'](_0x5da341['shift']());}};_0x1365f3(++_0x540c57);}(_0x8116,0x71));var _0x6811=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8116[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x6811('0x0'));var rimraf=require(_0x6811('0x1'));var zipdir=require(_0x6811('0x2'));var jsonpatch=require(_0x6811('0x3'));var rp=require(_0x6811('0x4'));var moment=require(_0x6811('0x5'));var BPromise=require(_0x6811('0x6'));var Mustache=require('mustache');var util=require(_0x6811('0x7'));var path=require(_0x6811('0x8'));var sox=require(_0x6811('0x9'));var csv=require(_0x6811('0xa'));var ejs=require(_0x6811('0xb'));var fs=require('fs');var fs_extra=require(_0x6811('0xc'));var _=require(_0x6811('0xd'));var squel=require(_0x6811('0xe'));var crypto=require('crypto');var jsforce=require(_0x6811('0xf'));var deskjs=require(_0x6811('0x10'));var toCsv=require(_0x6811('0xa'));var querystring=require(_0x6811('0x11'));var Papa=require('papaparse');var Redis=require(_0x6811('0x12'));var authService=require(_0x6811('0x13'));var qs=require(_0x6811('0x14'));var as=require(_0x6811('0x15'));var hardwareService=require(_0x6811('0x16'));var logger=require(_0x6811('0x17'))(_0x6811('0x18'));var utils=require(_0x6811('0x19'));var config=require(_0x6811('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6811('0x1b'))['db'];function respondWithStatusCode(_0x2d9422,_0x3778ef){_0x3778ef=_0x3778ef||0xcc;return function(_0xa8c705){if(_0xa8c705){return _0x2d9422[_0x6811('0x1c')](_0x3778ef);}return _0x2d9422[_0x6811('0x1d')](_0x3778ef)['end']();};}function respondWithResult(_0x4f20ee,_0x566aba){_0x566aba=_0x566aba||0xc8;return function(_0x3bc9ab){if(_0x3bc9ab){return _0x4f20ee['status'](_0x566aba)[_0x6811('0x1e')](_0x3bc9ab);}};}function respondWithFilteredResult(_0x155735,_0x251307){return function(_0x4ba590){if(_0x4ba590){var _0x1cbd59=typeof _0x251307['offset']==='undefined'&&typeof _0x251307[_0x6811('0x1f')]===_0x6811('0x20');var _0x1d2a29=_0x4ba590[_0x6811('0x21')];var _0x36b24d=_0x1cbd59?0x0:_0x251307[_0x6811('0x22')];var _0x30f59e=_0x1cbd59?_0x4ba590[_0x6811('0x21')]:_0x251307[_0x6811('0x22')]+_0x251307[_0x6811('0x1f')];var _0x32ab74;if(_0x30f59e>=_0x1d2a29){_0x30f59e=_0x1d2a29;_0x32ab74=0xc8;}else{_0x32ab74=0xce;}_0x155735['status'](_0x32ab74);return _0x155735['set'](_0x6811('0x23'),_0x36b24d+'-'+_0x30f59e+'/'+_0x1d2a29)['json'](_0x4ba590);}return null;};}function patchUpdates(_0x39efbf){return function(_0x3913c7){try{jsonpatch[_0x6811('0x24')](_0x3913c7,_0x39efbf,!![]);}catch(_0x4e14c0){return BPromise[_0x6811('0x25')](_0x4e14c0);}return _0x3913c7[_0x6811('0x26')]();};}function saveUpdates(_0x1bc23d,_0x14173e){return function(_0xec9630){if(_0xec9630){return _0xec9630[_0x6811('0x27')](_0x1bc23d)[_0x6811('0x28')](function(_0x4a4e2d){return _0x4a4e2d;});}return null;};}function removeEntity(_0x371b81,_0x307517){return function(_0x280ce9){if(_0x280ce9){return _0x280ce9[_0x6811('0x29')]()[_0x6811('0x28')](function(){_0x371b81['status'](0xcc)[_0x6811('0x2a')]();});}};}function handleEntityNotFound(_0x4ca39e,_0x25d59b){return function(_0xc4ade2){if(!_0xc4ade2){_0x4ca39e[_0x6811('0x1c')](0x194);}return _0xc4ade2;};}function handleError(_0x4829e8,_0x3487a4){_0x3487a4=_0x3487a4||0x1f4;return function(_0x1f0d79){logger[_0x6811('0x2b')](_0x1f0d79[_0x6811('0x2c')]);if(_0x1f0d79[_0x6811('0x2d')]){delete _0x1f0d79[_0x6811('0x2d')];}_0x4829e8[_0x6811('0x1d')](_0x3487a4)[_0x6811('0x2e')](_0x1f0d79);};}exports[_0x6811('0x2f')]=function(_0x115c23,_0x418f01){var _0x2195d6={},_0x5a5b26={},_0x5cd140={'count':0x0,'rows':[]};var _0x37d849=_['map'](db[_0x6811('0x30')][_0x6811('0x31')],function(_0x28cc57){return{'name':_0x28cc57['fieldName'],'type':_0x28cc57[_0x6811('0x32')][_0x6811('0x33')]};});_0x5a5b26[_0x6811('0x34')]=_['map'](_0x37d849,_0x6811('0x2d'));_0x5a5b26[_0x6811('0x35')]=_[_0x6811('0x36')](_0x115c23[_0x6811('0x35')]);_0x5a5b26[_0x6811('0x37')]=_[_0x6811('0x38')](_0x5a5b26['model'],_0x5a5b26[_0x6811('0x35')]);_0x2195d6[_0x6811('0x39')]=_[_0x6811('0x38')](_0x5a5b26[_0x6811('0x34')],qs[_0x6811('0x3a')](_0x115c23[_0x6811('0x35')][_0x6811('0x3a')]));_0x2195d6[_0x6811('0x39')]=_0x2195d6['attributes']['length']?_0x2195d6[_0x6811('0x39')]:_0x5a5b26[_0x6811('0x34')];if(!_0x115c23[_0x6811('0x35')][_0x6811('0x3b')](_0x6811('0x3c'))){_0x2195d6['limit']=qs[_0x6811('0x1f')](_0x115c23[_0x6811('0x35')][_0x6811('0x1f')]);_0x2195d6['offset']=qs['offset'](_0x115c23[_0x6811('0x35')][_0x6811('0x22')]);}_0x2195d6[_0x6811('0x3d')]=qs[_0x6811('0x3e')](_0x115c23[_0x6811('0x35')][_0x6811('0x3e')]);_0x2195d6[_0x6811('0x3f')]=qs[_0x6811('0x37')](_['pick'](_0x115c23[_0x6811('0x35')],_0x5a5b26[_0x6811('0x37')]),_0x37d849);if(_0x115c23[_0x6811('0x35')][_0x6811('0x40')]){_0x2195d6[_0x6811('0x3f')]=_[_0x6811('0x41')](_0x2195d6[_0x6811('0x3f')],{'$or':_[_0x6811('0x42')](_0x37d849,function(_0x1a9126){if(_0x1a9126[_0x6811('0x32')]!==_0x6811('0x43')){var _0x2dbd42={};_0x2dbd42[_0x1a9126[_0x6811('0x2d')]]={'$like':'%'+_0x115c23[_0x6811('0x35')][_0x6811('0x40')]+'%'};return _0x2dbd42;}})});}_0x2195d6=_[_0x6811('0x41')]({},_0x2195d6,_0x115c23[_0x6811('0x44')]);var _0x30f47f={'where':_0x2195d6['where']};return db[_0x6811('0x30')][_0x6811('0x21')](_0x30f47f)[_0x6811('0x28')](function(_0x4f993b){_0x5cd140['count']=_0x4f993b;if(_0x115c23['query'][_0x6811('0x45')]){_0x2195d6[_0x6811('0x46')]=[{'all':!![]}];}return db[_0x6811('0x30')]['findAll'](_0x2195d6);})[_0x6811('0x28')](function(_0x464c63){_0x5cd140['rows']=_0x464c63;return _0x5cd140;})[_0x6811('0x28')](respondWithFilteredResult(_0x418f01,_0x2195d6))[_0x6811('0x47')](handleError(_0x418f01,null));};exports[_0x6811('0x48')]=function(_0x49114e,_0x3d2d6b){var _0x302c5a={'raw':!![],'where':{'id':_0x49114e['params']['id']}},_0x411172={};_0x411172[_0x6811('0x34')]=_[_0x6811('0x36')](db['Attachment'][_0x6811('0x31')]);_0x411172[_0x6811('0x35')]=_[_0x6811('0x36')](_0x49114e[_0x6811('0x35')]);_0x411172[_0x6811('0x37')]=_['intersection'](_0x411172[_0x6811('0x34')],_0x411172[_0x6811('0x35')]);_0x302c5a[_0x6811('0x39')]=_[_0x6811('0x38')](_0x411172[_0x6811('0x34')],qs[_0x6811('0x3a')](_0x49114e[_0x6811('0x35')][_0x6811('0x3a')]));_0x302c5a['attributes']=_0x302c5a[_0x6811('0x39')]['length']?_0x302c5a['attributes']:_0x411172[_0x6811('0x34')];if(_0x49114e['query'][_0x6811('0x45')]){_0x302c5a[_0x6811('0x46')]=[{'all':!![]}];}_0x302c5a=_['merge']({},_0x302c5a,_0x49114e[_0x6811('0x44')]);return db[_0x6811('0x30')][_0x6811('0x49')](_0x302c5a)[_0x6811('0x28')](handleEntityNotFound(_0x3d2d6b,null))[_0x6811('0x28')](respondWithResult(_0x3d2d6b,null))[_0x6811('0x47')](handleError(_0x3d2d6b,null));};exports[_0x6811('0x4a')]=function(_0x409c84,_0x4d5205){var _0x166fee={'where':{'id':_0x409c84[_0x6811('0x4b')]['id']}},_0x5708f3={};_0x5708f3[_0x6811('0x34')]=_['keys'](db[_0x6811('0x30')]['rawAttributes']);_0x166fee[_0x6811('0x39')]=_[_0x6811('0x38')](_0x5708f3[_0x6811('0x34')],qs['fields'](_0x409c84[_0x6811('0x35')][_0x6811('0x3a')]));_0x166fee[_0x6811('0x39')]=_0x166fee[_0x6811('0x39')][_0x6811('0x4c')]?_0x166fee[_0x6811('0x39')]:_0x5708f3['model'];if(_0x409c84[_0x6811('0x35')]['includeAll']){_0x166fee[_0x6811('0x46')]=[{'all':!![]}];}_0x166fee=_[_0x6811('0x41')]({},_0x166fee,_0x409c84[_0x6811('0x44')]);return db[_0x6811('0x30')][_0x6811('0x49')](_0x166fee)[_0x6811('0x28')](handleEntityNotFound(_0x4d5205,null))[_0x6811('0x28')](function(_0x2ee6d3){if(_0x2ee6d3){var _0x381ba2=_0x2ee6d3['get']({'plain':!![]});_0x381ba2=qs[_0x6811('0x4d')](_0x381ba2,['id',_0x6811('0x4e'),_0x6811('0x4f')]);_0x409c84['body']=_[_0x6811('0x4d')](_0x409c84[_0x6811('0x50')],['id',_0x6811('0x4e'),_0x6811('0x4f')]);return db[_0x6811('0x30')][_0x6811('0x51')](_[_0x6811('0x41')](_0x381ba2,_0x409c84[_0x6811('0x50')]),{'include':_0x409c84[_0x6811('0x35')][_0x6811('0x45')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4d5205,0xc9))[_0x6811('0x47')](handleError(_0x4d5205,null));};exports[_0x6811('0x27')]=function(_0x152fcc,_0x2119b3){if(_0x152fcc[_0x6811('0x50')]['id']){delete _0x152fcc[_0x6811('0x50')]['id'];}return db[_0x6811('0x30')][_0x6811('0x49')]({'where':{'id':_0x152fcc[_0x6811('0x4b')]['id']}})[_0x6811('0x28')](handleEntityNotFound(_0x2119b3,null))['then'](saveUpdates(_0x152fcc[_0x6811('0x50')],null))[_0x6811('0x28')](respondWithResult(_0x2119b3,null))[_0x6811('0x47')](handleError(_0x2119b3,null));};exports['destroy']=function(_0x6a6ed2,_0x198cd9){return db['Attachment'][_0x6811('0x49')]({'where':{'id':_0x6a6ed2['params']['id']}})[_0x6811('0x28')](handleEntityNotFound(_0x198cd9,null))[_0x6811('0x28')](removeEntity(_0x198cd9,null))[_0x6811('0x47')](handleError(_0x198cd9,null));};exports['create']=function(_0x337eec,_0x50f7f3,_0x40cb99){_0x337eec[_0x6811('0x50')]['name']=_0x337eec[_0x6811('0x52')][_0x6811('0x53')];_0x337eec[_0x6811('0x50')]['basename']=_0x337eec[_0x6811('0x52')][_0x6811('0x54')];_0x337eec[_0x6811('0x50')][_0x6811('0x32')]=_0x337eec['file'][_0x6811('0x55')];return db[_0x6811('0x30')][_0x6811('0x51')](_0x337eec['body'])[_0x6811('0x28')](respondWithResult(_0x50f7f3,0xc9))[_0x6811('0x47')](handleError(_0x50f7f3,null));};exports[_0x6811('0x56')]=function(_0x171b76,_0x970a19,_0x32a18d){return db[_0x6811('0x30')][_0x6811('0x57')]({'where':{'id':_0x171b76[_0x6811('0x4b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x970a19,null))[_0x6811('0x28')](function(_0x245ce2){if(_0x245ce2){var _0x35ddd4=_0x245ce2['ChatOfflineMessageId']!==null;var _0x27b9cd=path[_0x6811('0x58')](config['root'],_0x6811('0x59'));if(_0x35ddd4){_0x27b9cd=path[_0x6811('0x58')](_0x27b9cd,_0x6811('0x5a'));}var _0xc9fe3=path[_0x6811('0x58')](_0x27b9cd,_0x245ce2[_0x6811('0x5b')]);return _0x970a19[_0x6811('0x56')](_0xc9fe3);}})[_0x6811('0x47')](handleError(_0x970a19,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c4501be..8990b09 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 _0xb877=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x10ab7e,_0x3d0349){var _0x3acecf=function(_0xb4fa82){while(--_0xb4fa82){_0x10ab7e['push'](_0x10ab7e['shift']());}};_0x3acecf(++_0x3d0349);}(_0xb877,0x19b));var _0x7b87=function(_0x186214,_0x1e5ad4){_0x186214=_0x186214-0x0;var _0x434495=_0xb877[_0x186214];return _0x434495;};'use strict';var _=require('lodash');var util=require(_0x7b87('0x0'));var logger=require(_0x7b87('0x1'))('api');var moment=require(_0x7b87('0x2'));var BPromise=require(_0x7b87('0x3'));var rp=require(_0x7b87('0x4'));var fs=require('fs');var path=require(_0x7b87('0x5'));var rimraf=require(_0x7b87('0x6'));var config=require(_0x7b87('0x7'));var attributes=require(_0x7b87('0x8'));module[_0x7b87('0x9')]=function(_0x2f6031,_0x25bd58){return _0x2f6031[_0x7b87('0xa')](_0x7b87('0xb'),attributes,{'tableName':_0x7b87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x037e=['request-promise','path','rimraf','../../config/environment','define','attachments','util','../../config/logger','api','moment','bluebird'];(function(_0x2c6f39,_0x3f9fb9){var _0x8e2c52=function(_0x2217ca){while(--_0x2217ca){_0x2c6f39['push'](_0x2c6f39['shift']());}};_0x8e2c52(++_0x3f9fb9);}(_0x037e,0x171));var _0xe037=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x037e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe037('0x0'));var logger=require(_0xe037('0x1'))(_0xe037('0x2'));var moment=require(_0xe037('0x3'));var BPromise=require(_0xe037('0x4'));var rp=require(_0xe037('0x5'));var fs=require('fs');var path=require(_0xe037('0x6'));var rimraf=require(_0xe037('0x7'));var config=require(_0xe037('0x8'));var attributes=require('./attachment.attributes');module['exports']=function(_0x1725d9,_0x292222){return _0x1725d9[_0xe037('0x9')]('Attachment',attributes,{'tableName':_0xe037('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 47d1117..e0a3282 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 _0xc874=['Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','then','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info'];(function(_0x1e182d,_0x4f35c2){var _0x5627c6=function(_0x12b34c){while(--_0x12b34c){_0x1e182d['push'](_0x1e182d['shift']());}};_0x5627c6(++_0x4f35c2);}(_0xc874,0x154));var _0x4c87=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xc874[_0x3c81b5];return _0x5888c4;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});}exports[_0x4c87('0x13')]=function(_0x547d92){var _0x428144=this;return new Promise(function(_0x561441,_0x9bc75f){return db[_0x4c87('0x14')][_0x4c87('0x15')](_0x547d92[_0x4c87('0x16')],{'raw':_0x547d92['options']?_0x547d92[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![]})[_0x4c87('0x19')](function(_0x3f27d4){logger[_0x4c87('0xa')](_0x4c87('0x13'),_0x547d92);logger[_0x4c87('0xd')](_0x4c87('0x13'),_0x547d92,JSON['stringify'](_0x3f27d4));_0x561441(_0x3f27d4);})[_0x4c87('0x1a')](function(_0x33aafd){logger['error'](_0x4c87('0x13'),_0x33aafd[_0x4c87('0x11')],_0x547d92);_0x9bc75f(_0x428144['error'](0x1f4,_0x33aafd[_0x4c87('0x11')]));});});}; \ No newline at end of file +var _0xf25a=['Attachment','create','body','options','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateAttachment'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0xf25a,0x195));var _0xaf25=function(_0x31db5b,_0x4014dc){_0x31db5b=_0x31db5b-0x0;var _0xff1d36=_0xf25a[_0x31db5b];return _0xff1d36;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var moment=require(_0xaf25('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf25('0x3'));var fs=require('fs');var Redis=require(_0xaf25('0x4'));var db=require(_0xaf25('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf25('0x6'))(_0xaf25('0x7'));var config=require(_0xaf25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaf25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48c6e6,_0x4b7258,_0x457ba5){return new BPromise(function(_0x41b3cd,_0x61e8d){return client['request'](_0x48c6e6,_0x457ba5)[_0xaf25('0xa')](function(_0x24ac0a){logger[_0xaf25('0xb')](_0xaf25('0xc'),_0x4b7258,_0xaf25('0xd'));logger['debug'](_0xaf25('0xe'),_0x4b7258,_0xaf25('0xd'),JSON[_0xaf25('0xf')](_0x24ac0a));if(_0x24ac0a[_0xaf25('0x10')]){if(_0x24ac0a['error']['code']===0x1f4){logger[_0xaf25('0x10')](_0xaf25('0xc'),_0x4b7258,_0x24ac0a[_0xaf25('0x10')][_0xaf25('0x11')]);return _0x61e8d(_0x24ac0a[_0xaf25('0x10')]['message']);}logger['error'](_0xaf25('0xc'),_0x4b7258,_0x24ac0a['error'][_0xaf25('0x11')]);return _0x41b3cd(_0x24ac0a[_0xaf25('0x10')][_0xaf25('0x11')]);}else{logger[_0xaf25('0xb')]('Attachment,\x20%s,\x20%s',_0x4b7258,_0xaf25('0xd'));_0x41b3cd(_0x24ac0a['result']['message']);}})[_0xaf25('0x12')](function(_0x4b396d){logger[_0xaf25('0x10')](_0xaf25('0xc'),_0x4b7258,_0x4b396d);_0x61e8d(_0x4b396d);});});}exports[_0xaf25('0x13')]=function(_0x2c815a){var _0x28bb0e=this;return new Promise(function(_0x10ed9a,_0x615537){return db[_0xaf25('0x14')][_0xaf25('0x15')](_0x2c815a[_0xaf25('0x16')],{'raw':_0x2c815a['options']?_0x2c815a[_0xaf25('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaf25('0xa')](function(_0x396af4){logger[_0xaf25('0xb')](_0xaf25('0x13'),_0x2c815a);logger[_0xaf25('0x18')](_0xaf25('0x13'),_0x2c815a,JSON[_0xaf25('0xf')](_0x396af4));_0x10ed9a(_0x396af4);})[_0xaf25('0x12')](function(_0x2d8b66){logger[_0xaf25('0x10')](_0xaf25('0x13'),_0x2d8b66[_0xaf25('0x11')],_0x2c815a);_0x615537(_0x28bb0e[_0xaf25('0x10')](0x1f4,_0x2d8b66[_0xaf25('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5f27430..dacf01d 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x292a7a,_0x3ac93e){_0x292a7a=_0x292a7a-0x0;var _0x1771d3=_0xdb28[_0x292a7a];return _0x1771d3;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x202c32,_0x55471d){var _0x1a44dd=function(_0x4ef989){while(--_0x4ef989){_0x202c32['push'](_0x202c32['shift']());}};_0x1a44dd(++_0x55471d);}(_0xadb5,0xad));var _0x5adb=function(_0x59fc43,_0x3801d1){_0x59fc43=_0x59fc43-0x0;var _0x4b40f3=_0xadb5[_0x59fc43];return _0x4b40f3;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 13f0aa9..e5e1b91 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 _0x9ece=['blockedAt','add','minutes','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','authenticate','google','/login','profile','email','use','clientID','secret','callbackURL','Setting','blockDuration','then','User','find','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked'];(function(_0x4f3f71,_0x1e35ce){var _0x559c25=function(_0x1d874e){while(--_0x1d874e){_0x4f3f71['push'](_0x4f3f71['shift']());}};_0x559c25(++_0x1e35ce);}(_0x9ece,0x159));var _0xe9ec=function(_0x8ccbf0,_0x3317aa){_0x8ccbf0=_0x8ccbf0-0x0;var _0x3e7903=_0x9ece[_0x8ccbf0];return _0x3e7903;};'use strict';var _=require('lodash');var passport=require(_0xe9ec('0x0'));var GoogleStrategy=require(_0xe9ec('0x1'))[_0xe9ec('0x2')];var moment=require(_0xe9ec('0x3'));var db=require(_0xe9ec('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xe9ec('0x5'))[_0xe9ec('0x6')];var utils=require('../../config/utils');exports['login']=passport[_0xe9ec('0x7')](_0xe9ec('0x8'),{'failureRedirect':_0xe9ec('0x9'),'scope':[_0xe9ec('0xa'),_0xe9ec('0xb')],'session':![]});exports['callback']=passport[_0xe9ec('0x7')](_0xe9ec('0x8'),{'failureRedirect':_0xe9ec('0x9'),'session':![]});passport[_0xe9ec('0xc')](new GoogleStrategy({'clientID':config[_0xe9ec('0x8')]?config[_0xe9ec('0x8')][_0xe9ec('0xd')]:'id','clientSecret':config[_0xe9ec('0x8')]?config[_0xe9ec('0x8')]['clientSecret']:_0xe9ec('0xe'),'callbackURL':config[_0xe9ec('0x8')]?config['google'][_0xe9ec('0xf')]:''},function(_0x38cd5b,_0x1abf96,_0x29feaf,_0x57d1a9){var _0x3a7a80,_0xf7d25a;return db[_0xe9ec('0x10')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9ec('0x11')],'raw':!![]})[_0xe9ec('0x12')](function(_0x1a428b){_0x3a7a80=_0x1a428b;return db[_0xe9ec('0x13')][_0xe9ec('0x14')]({'where':{'email':_[_0xe9ec('0x15')](_0x29feaf[_0xe9ec('0x16')],'value'),'role':{'$or':[_0xe9ec('0x17'),_0xe9ec('0x18'),_0xe9ec('0x19')]}}});})[_0xe9ec('0x12')](function(_0x94a784){_0xf7d25a=_0x94a784;if(_0xf7d25a){if(_0xf7d25a[_0xe9ec('0x1a')]){return _0x57d1a9(_0xe9ec('0x1b'));}else if(_0x3a7a80[_0xe9ec('0x11')]>0x0){if(_0xf7d25a[_0xe9ec('0x1c')]){if(moment(_0xf7d25a[_0xe9ec('0x1d')])[_0xe9ec('0x1e')](_0x3a7a80[_0xe9ec('0x11')],_0xe9ec('0x1f'))>moment()){return _0x57d1a9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xe9ec('0x20')](_0xf7d25a,0x0,![],null)[_0xe9ec('0x12')](function(){return utils[_0xe9ec('0x21')](_0xf7d25a);})[_0xe9ec('0x12')](function(){return _0x57d1a9(null,_0xf7d25a);});}}else{return utils[_0xe9ec('0x21')](_0xf7d25a)[_0xe9ec('0x12')](function(){return _0x57d1a9(null,_0xf7d25a);});}}else{return utils[_0xe9ec('0x21')](_0xf7d25a)['then'](function(){return _0x57d1a9(null,_0xf7d25a);});}}return _0x57d1a9(_0xe9ec('0x1b'));})['catch'](function(_0x5e173b){_0x57d1a9(_0x5e173b);});})); \ No newline at end of file +var _0x91d1=['admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','Setting','allowedLoginAttempts','blockDuration','then','find','value'];(function(_0x56c18d,_0x2bf58c){var _0x4f6673=function(_0x44f644){while(--_0x44f644){_0x56c18d['push'](_0x56c18d['shift']());}};_0x4f6673(++_0x2bf58c);}(_0x91d1,0x74));var _0x191d=function(_0x321575,_0x2feea4){_0x321575=_0x321575-0x0;var _0x48e024=_0x91d1[_0x321575];return _0x48e024;};'use strict';var _=require(_0x191d('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x191d('0x1'))['Strategy'];var moment=require(_0x191d('0x2'));var db=require(_0x191d('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0x191d('0x4'))[_0x191d('0x5')];var utils=require(_0x191d('0x6'));exports[_0x191d('0x7')]=passport[_0x191d('0x8')](_0x191d('0x9'),{'failureRedirect':_0x191d('0xa'),'scope':[_0x191d('0xb'),_0x191d('0xc')],'session':![]});exports[_0x191d('0xd')]=passport[_0x191d('0x8')]('google',{'failureRedirect':_0x191d('0xa'),'session':![]});passport[_0x191d('0xe')](new GoogleStrategy({'clientID':config['google']?config['google'][_0x191d('0xf')]:'id','clientSecret':config[_0x191d('0x9')]?config[_0x191d('0x9')][_0x191d('0x10')]:_0x191d('0x11'),'callbackURL':config[_0x191d('0x9')]?config[_0x191d('0x9')]['callbackURL']:''},function(_0x10a97e,_0x424405,_0x2ee6af,_0x95b7eb){var _0x14c29d,_0x3d0efb;return db[_0x191d('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0x191d('0x13'),_0x191d('0x14')],'raw':!![]})[_0x191d('0x15')](function(_0x581f41){_0x14c29d=_0x581f41;return db['User'][_0x191d('0x16')]({'where':{'email':_['map'](_0x2ee6af['emails'],_0x191d('0x17')),'role':{'$or':[_0x191d('0x18'),'user',_0x191d('0x19')]}}});})[_0x191d('0x15')](function(_0x515fb3){_0x3d0efb=_0x515fb3;if(_0x3d0efb){if(_0x3d0efb[_0x191d('0x1a')]){return _0x95b7eb(_0x191d('0x1b'));}else if(_0x14c29d['blockDuration']>0x0){if(_0x3d0efb[_0x191d('0x1c')]){if(moment(_0x3d0efb[_0x191d('0x1d')])[_0x191d('0x1e')](_0x14c29d[_0x191d('0x14')],_0x191d('0x1f'))>moment()){return _0x95b7eb(_0x191d('0x1b'));}else{return utils[_0x191d('0x20')](_0x3d0efb,0x0,![],null)[_0x191d('0x15')](function(){return utils['getLicense'](_0x3d0efb);})[_0x191d('0x15')](function(){return _0x95b7eb(null,_0x3d0efb);});}}else{return utils['getLicense'](_0x3d0efb)[_0x191d('0x15')](function(){return _0x95b7eb(null,_0x3d0efb);});}}else{return utils[_0x191d('0x21')](_0x3d0efb)[_0x191d('0x15')](function(){return _0x95b7eb(null,_0x3d0efb);});}}return _0x95b7eb(_0x191d('0x1b'));})[_0x191d('0x22')](function(_0x128e5c){_0x95b7eb(_0x128e5c);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index ceb18e7..deedf44 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 _0x3404=['exports','express','passport','Router','../user/user.controller.js','get','login','/callback','callback','isMiddleware'];(function(_0x287868,_0x4623bf){var _0x5703ee=function(_0x3d8a91){while(--_0x3d8a91){_0x287868['push'](_0x287868['shift']());}};_0x5703ee(++_0x4623bf);}(_0x3404,0xc9));var _0x4340=function(_0x58a907,_0x3928a5){_0x58a907=_0x58a907-0x0;var _0x41ca9a=_0x3404[_0x58a907];return _0x41ca9a;};'use strict';var express=require(_0x4340('0x0'));var passport=require(_0x4340('0x1'));var router=express[_0x4340('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x4340('0x3'));var authService=require('../../components/auth/service');router[_0x4340('0x4')]('/',controller[_0x4340('0x5')]);router[_0x4340('0x4')](_0x4340('0x6'),controller[_0x4340('0x7')],authService[_0x4340('0x8')],userController[_0x4340('0x5')],authService['setTokenCookie']);module[_0x4340('0x9')]=router; \ No newline at end of file +var _0x0abe=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x1d848d,_0x4514e6){var _0x3d71d7=function(_0x4233eb){while(--_0x4233eb){_0x1d848d['push'](_0x1d848d['shift']());}};_0x3d71d7(++_0x4514e6);}(_0x0abe,0x14a));var _0xe0ab=function(_0x2999d3,_0x3689f9){_0x2999d3=_0x2999d3-0x0;var _0x2aa91c=_0x0abe[_0x2999d3];return _0x2aa91c;};'use strict';var express=require('express');var passport=require(_0xe0ab('0x0'));var router=express[_0xe0ab('0x1')]();var controller=require(_0xe0ab('0x2'));var userController=require(_0xe0ab('0x3'));var authService=require(_0xe0ab('0x4'));router['get']('/',controller['login']);router[_0xe0ab('0x5')](_0xe0ab('0x6'),controller[_0xe0ab('0x7')],authService[_0xe0ab('0x8')],userController[_0xe0ab('0x9')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 45ef7c9..9edd4ce 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 _0xd681=['Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','password','salt','blockedAt','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','merge','format','name','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local','role','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','https://','/reset/','status','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd681,0x13b));var _0x1d68=function(_0x1c1803,_0x33b31e){_0x1c1803=_0x1c1803-0x0;var _0x522ba0=_0xd681[_0x1c1803];return _0x522ba0;};'use strict';var util=require('util');var passport=require(_0x1d68('0x0'));var LocalStrategy=require('passport-local')[_0x1d68('0x1')];var jayson=require('jayson/promise');var _=require(_0x1d68('0x2'));var rs=require(_0x1d68('0x3'));var moment=require(_0x1d68('0x4'));var db=require(_0x1d68('0x5'))['db'];var authService=require(_0x1d68('0x6'));var utils=require(_0x1d68('0x7'));var client=jayson[_0x1d68('0x8')][_0x1d68('0x9')]({'port':0x232b});function localAuthenticate(_0x2f8816,_0x2d2a0d,_0x5bdcbd,_0x3e2e1e){var _0x28193c,_0x166de2;return db[_0x1d68('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x1d68('0xb'),_0x1d68('0xc')],'raw':!![]})[_0x1d68('0xd')](function(_0x5c50f5){_0x28193c=_0x5c50f5;return _0x2f8816[_0x1d68('0xe')]({'attributes':['id','name',_0x1d68('0xf'),_0x1d68('0x10'),'role','disabled','blocked',_0x1d68('0x11'),'loginAttempts'],'where':{'name':_0x2d2a0d,'role':{'$or':['admin',_0x1d68('0x12'),_0x1d68('0x13')]}}});})['then'](function(_0x4b0659){if(!_0x4b0659||_0x4b0659&&_0x4b0659['name']!==_0x2d2a0d){throw new Error(_0x1d68('0x14'));}else{_0x166de2=_0x4b0659;return _0x166de2;}})[_0x1d68('0xd')](function(){_0x166de2[_0x1d68('0x15')](_0x5bdcbd,function(_0x3bf44f,_0x1c262e){var _0x4c2edc=_0x166de2['loginAttempts']+0x1;if(_0x3bf44f){return _0x3e2e1e(_0x3bf44f);}else if(!_0x1c262e){if(_0x166de2['disabled']){return _0x3e2e1e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x28193c[_0x1d68('0xb')]>0x0){if(_0x166de2[_0x1d68('0x16')]){if(_0x28193c['blockDuration']>0x0){if(moment(_0x166de2[_0x1d68('0x11')])[_0x1d68('0x17')](_0x28193c['blockDuration'],_0x1d68('0x18'))>moment()){return _0x3e2e1e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x1d68('0x19')](_0x166de2,_0x4c2edc,![],null)[_0x1d68('0xd')](function(){return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});});}}else{return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});}}else{if(_0x4c2edc>=_0x28193c[_0x1d68('0xb')]){return utils['clearBlockUser'](_0x166de2,0x0,!![],moment())[_0x1d68('0xd')](function(){return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});});}else{return utils[_0x1d68('0x19')](_0x166de2,_0x4c2edc,![],null)[_0x1d68('0xd')](function(){return _0x3e2e1e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});}}else{if(_0x166de2[_0x1d68('0x1a')]){return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});}else if(_0x28193c[_0x1d68('0xb')]>0x0){if(_0x166de2[_0x1d68('0x16')]){if(_0x28193c[_0x1d68('0xc')]>0x0){if(moment(_0x166de2[_0x1d68('0x11')])[_0x1d68('0x17')](_0x28193c['blockDuration'],_0x1d68('0x18'))>moment()){return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});}else{return utils[_0x1d68('0x19')](_0x166de2,0x0,![],null)[_0x1d68('0xd')](function(){return utils[_0x1d68('0x1b')](_0x166de2);})[_0x1d68('0xd')](function(){return _0x3e2e1e(null,_0x166de2);});}}else{return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});}}else{return utils['clearBlockUser'](_0x166de2,0x0,![],null)[_0x1d68('0xd')](function(){return utils[_0x1d68('0x1b')](_0x166de2);})['then'](function(){return _0x3e2e1e(null,_0x166de2);})[_0x1d68('0x1c')](function(_0x26d74c){return _0x3e2e1e(null,![],_0x26d74c);});}}else{if(_0x166de2['blocked']){return _0x3e2e1e(null,![],{'message':_0x1d68('0x14')});}else{return utils[_0x1d68('0x1b')](_0x166de2)['then'](function(){return _0x3e2e1e(null,_0x166de2);});}}}});})[_0x1d68('0x1c')](function(_0x30ffaf){return _0x3e2e1e(null,![],_0x30ffaf);});}function sendServiceMail(_0x4cfef7){return db[_0x1d68('0x1d')][_0x1d68('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x1d68('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x1d68('0x20')}]})[_0x1d68('0xd')](function(_0x1f364c){if(!_0x1f364c){throw new Error(_0x1d68('0x21'));}var _0x2c037c={'tls':{'rejectUnauthorized':![]}};if(_0x1f364c['Smtp'][_0x1d68('0x22')]){_0x2c037c['service']=_0x1f364c[_0x1d68('0x20')]['service'];}else{_0x2c037c[_0x1d68('0x23')]=_0x1f364c[_0x1d68('0x20')][_0x1d68('0x23')];_0x2c037c[_0x1d68('0x24')]=_0x1f364c[_0x1d68('0x20')]['port'];_0x2c037c[_0x1d68('0x25')]=_0x1f364c[_0x1d68('0x20')]['secure'];}if(_0x1f364c['Smtp']['authentication']){_0x2c037c[_0x1d68('0x26')]={'user':_0x1f364c[_0x1d68('0x20')][_0x1d68('0x12')],'pass':_0x1f364c['Smtp']['pass']};}var _0x1f3bc0={'account':_0x2c037c,'message':_[_0x1d68('0x27')]({'from':util[_0x1d68('0x28')]('\x22%s\x22\x20<%s>',_0x1f364c[_0x1d68('0x29')],_0x1f364c[_0x1d68('0x1f')]||_0x1f364c[_0x1d68('0x20')][_0x1d68('0x12')])},_0x4cfef7)};return client[_0x1d68('0x2a')](_0x1d68('0x2b'),_0x1f3bc0);})[_0x1d68('0xd')](function(_0x2a570d){if(_0x2a570d[_0x1d68('0x2c')]){throw new Error(util[_0x1d68('0x28')](_0x1d68('0x2d'),_0x2a570d[_0x1d68('0x2c')][_0x1d68('0x2e')]||JSON[_0x1d68('0x2f')](_0x2a570d[_0x1d68('0x2c')])));}return!![];});}function handleError(_0x12f5d5,_0x37a547,_0x59c32f){return _0x12f5d5['status'](_0x37a547||0x1f4)[_0x1d68('0x30')]({'message':_0x59c32f?_0x59c32f['message']||_0x59c32f:''});}exports[_0x1d68('0x31')]=function(_0x1b03e1,_0x2d4153,_0x5a18c3){passport['authenticate'](_0x1d68('0x32'),function(_0x7bbf72,_0x49a52a,_0x487715){var _0x59ab10=_0x7bbf72||_0x487715;if(_0x59ab10){return handleError(_0x2d4153,0x191,_0x59ab10);}if(!_0x49a52a){return handleError(_0x2d4153,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x17c775={'payload':{'id':_0x49a52a['id'],'role':_0x49a52a[_0x1d68('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0x1d68('0x34')](_0x17c775)[_0x1d68('0xd')](function(_0x5ca293){_0x2d4153[_0x1d68('0x35')]({'id':_0x49a52a['id'],'token':_0x5ca293,'statusCall':'','isAlreadyLogged':_0x49a52a['online']});});}})(_0x1b03e1,_0x2d4153,_0x5a18c3);};exports[_0x1d68('0x36')]=function(_0x28cfa6,_0x1dbc24,_0x304943){if(!_0x28cfa6[_0x1d68('0x37')][_0x1d68('0x1f')]){return handleError(_0x1dbc24,0x1f4,{'message':_0x1d68('0x38')});}var _0x191ce3=rs[_0x1d68('0x39')]();_0x28cfa6[_0x1d68('0x37')][_0x1d68('0x1f')]=_0x28cfa6[_0x1d68('0x37')][_0x1d68('0x1f')][_0x1d68('0x3a')]()['toLowerCase']();var _0x37fe8f;return db[_0x1d68('0xa')][_0x1d68('0xe')]({'where':{'id':0x1},'attributes':[_0x1d68('0xb'),_0x1d68('0xc')],'raw':!![]})[_0x1d68('0xd')](function(_0x1db324){_0x37fe8f=_0x1db324;return db[_0x1d68('0x3b')][_0x1d68('0x1e')]({'where':{'email':_0x28cfa6['body'][_0x1d68('0x1f')]}});})[_0x1d68('0xd')](function(_0x51d025){if(!_0x51d025){throw new Error(_0x1d68('0x3c'));}if(_0x51d025[_0x1d68('0x1a')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x51d025[_0x1d68('0x16')]){if(moment(_0x51d025['blockedAt'])[_0x1d68('0x17')](_0x37fe8f[_0x1d68('0xc')],_0x1d68('0x18'))>moment()){throw new Error(_0x1d68('0x3d'));}else{_0x51d025[_0x1d68('0x16')]=![];_0x51d025[_0x1d68('0x11')]=null;}}_0x51d025[_0x1d68('0x3e')]=_0x191ce3;_0x51d025[_0x1d68('0x3f')]=Date[_0x1d68('0x40')]()+0x36ee80;return _0x51d025['save']();})[_0x1d68('0xd')](function(){return sendServiceMail({'to':_0x28cfa6['body'][_0x1d68('0x1f')],'subject':_0x1d68('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x1d68('0x42')+_0x28cfa6['headers'][_0x1d68('0x23')]+_0x1d68('0x43')+_0x191ce3+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x1dbc24[_0x1d68('0x44')](0xc8)[_0x1d68('0x30')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x20180e){return handleError(_0x1dbc24,0x1f4,_0x20180e);});};exports[_0x1d68('0x45')]=function(_0x566fb2,_0x46b436,_0x4e6f6d){return db[_0x1d68('0x3b')]['find']({'where':{'resetPasswordToken':_0x566fb2[_0x1d68('0x46')]['token'],'resetPasswordExpires':{'$gt':Date[_0x1d68('0x40')]()}}})[_0x1d68('0xd')](function(_0x2dbcf3){if(!_0x2dbcf3){throw new Error(_0x1d68('0x47'));}return db[_0x1d68('0xa')]['findOne']({'attributes':['id',_0x1d68('0x48'),'enforcePasswordHistory',_0x1d68('0x49')]})['then'](function(_0x2f83d6){if(_0x2f83d6['securePassword'])authService[_0x1d68('0x4a')](_0x566fb2[_0x1d68('0x37')][_0x1d68('0xf')]);if(!_0x2f83d6['enforcePasswordHistory']||!_0x2dbcf3[_0x1d68('0x4b')])return _0x2dbcf3;authService[_0x1d68('0x4c')](_0x566fb2[_0x1d68('0x37')][_0x1d68('0xf')],_0x2dbcf3['previousPasswords'],_0x2f83d6[_0x1d68('0x49')]);return _0x2dbcf3;})['then'](function(){_0x2dbcf3[_0x1d68('0xf')]=_0x566fb2[_0x1d68('0x37')][_0x1d68('0xf')];_0x2dbcf3['resetPasswordToken']=null;_0x2dbcf3[_0x1d68('0x3f')]=null;return _0x2dbcf3['save']();});})[_0x1d68('0xd')](function(){_0x46b436[_0x1d68('0x44')](0xc8)[_0x1d68('0x30')]({'message':_0x1d68('0x4d')});})['catch'](function(_0x20bc81){return handleError(_0x46b436,0x1f4,_0x20bc81);});};passport[_0x1d68('0x4e')](new LocalStrategy({'usernameField':_0x1d68('0x29'),'passwordField':_0x1d68('0xf')},function(_0x5ab1cb,_0x1dc7f2,_0x33f97e){return localAuthenticate(db['User'],_0x5ab1cb,_0x1dc7f2,_0x33f97e);})); \ No newline at end of file +var _0xf925=['randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','blockDuration','findOne','name','salt','role','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','allowedLoginAttempts','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','generate','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','password','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','util','passport'];(function(_0x3aaf7d,_0x110885){var _0x364c9e=function(_0x5b0aca){while(--_0x5b0aca){_0x3aaf7d['push'](_0x3aaf7d['shift']());}};_0x364c9e(++_0x110885);}(_0xf925,0x1a7));var _0x5f92=function(_0x3b1106,_0x4bd523){_0x3b1106=_0x3b1106-0x0;var _0x1fbeef=_0xf925[_0x3b1106];return _0x1fbeef;};'use strict';var util=require(_0x5f92('0x0'));var passport=require(_0x5f92('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x5f92('0x2'));var moment=require(_0x5f92('0x3'));var db=require(_0x5f92('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5f92('0x5'));var client=jayson[_0x5f92('0x6')][_0x5f92('0x7')]({'port':0x232b});function localAuthenticate(_0x484788,_0x9cf95e,_0xd5b7f4,_0x28c227){var _0x40e627,_0x2277b2;return db[_0x5f92('0x8')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5f92('0x9')],'raw':!![]})['then'](function(_0x21b51a){_0x40e627=_0x21b51a;return _0x484788[_0x5f92('0xa')]({'attributes':['id',_0x5f92('0xb'),'password',_0x5f92('0xc'),_0x5f92('0xd'),'disabled',_0x5f92('0xe'),'blockedAt',_0x5f92('0xf')],'where':{'name':_0x9cf95e,'role':{'$or':[_0x5f92('0x10'),_0x5f92('0x11'),_0x5f92('0x12')]}}});})[_0x5f92('0x13')](function(_0x1c94d2){if(!_0x1c94d2||_0x1c94d2&&_0x1c94d2[_0x5f92('0xb')]!==_0x9cf95e){throw new Error(_0x5f92('0x14'));}else{_0x2277b2=_0x1c94d2;return _0x2277b2;}})['then'](function(){_0x2277b2[_0x5f92('0x15')](_0xd5b7f4,function(_0xc1d590,_0x285f96){var _0x32ccbb=_0x2277b2['loginAttempts']+0x1;if(_0xc1d590){return _0x28c227(_0xc1d590);}else if(!_0x285f96){if(_0x2277b2[_0x5f92('0x16')]){return _0x28c227(null,![],{'message':_0x5f92('0x14')});}else if(_0x40e627[_0x5f92('0x17')]>0x0){if(_0x2277b2[_0x5f92('0xe')]){if(_0x40e627['blockDuration']>0x0){if(moment(_0x2277b2[_0x5f92('0x18')])[_0x5f92('0x19')](_0x40e627[_0x5f92('0x9')],_0x5f92('0x1a'))>moment()){return _0x28c227(null,![],{'message':_0x5f92('0x14')});}else{return utils[_0x5f92('0x1b')](_0x2277b2,_0x32ccbb,![],null)['then'](function(){return _0x28c227(null,![],{'message':_0x5f92('0x14')});});}}else{return _0x28c227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x32ccbb>=_0x40e627[_0x5f92('0x17')]){return utils['clearBlockUser'](_0x2277b2,0x0,!![],moment())[_0x5f92('0x13')](function(){return _0x28c227(null,![],{'message':_0x5f92('0x14')});});}else{return utils[_0x5f92('0x1b')](_0x2277b2,_0x32ccbb,![],null)[_0x5f92('0x13')](function(){return _0x28c227(null,![],{'message':_0x5f92('0x14')});});}}}else{return _0x28c227(null,![],{'message':_0x5f92('0x14')});}}else{if(_0x2277b2[_0x5f92('0x16')]){return _0x28c227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x40e627[_0x5f92('0x17')]>0x0){if(_0x2277b2['blocked']){if(_0x40e627[_0x5f92('0x9')]>0x0){if(moment(_0x2277b2[_0x5f92('0x18')])[_0x5f92('0x19')](_0x40e627['blockDuration'],_0x5f92('0x1a'))>moment()){return _0x28c227(null,![],{'message':_0x5f92('0x14')});}else{return utils[_0x5f92('0x1b')](_0x2277b2,0x0,![],null)['then'](function(){return utils[_0x5f92('0x1c')](_0x2277b2);})[_0x5f92('0x13')](function(){return _0x28c227(null,_0x2277b2);});}}else{return _0x28c227(null,![],{'message':_0x5f92('0x14')});}}else{return utils[_0x5f92('0x1b')](_0x2277b2,0x0,![],null)['then'](function(){return utils[_0x5f92('0x1c')](_0x2277b2);})[_0x5f92('0x13')](function(){return _0x28c227(null,_0x2277b2);})['catch'](function(_0x273ccd){return _0x28c227(null,![],_0x273ccd);});}}else{if(_0x2277b2[_0x5f92('0xe')]){return _0x28c227(null,![],{'message':_0x5f92('0x14')});}else{return utils[_0x5f92('0x1c')](_0x2277b2)['then'](function(){return _0x28c227(null,_0x2277b2);});}}}});})[_0x5f92('0x1d')](function(_0x5210fb){return _0x28c227(null,![],_0x5210fb);});}function sendServiceMail(_0x23f5b8){return db[_0x5f92('0x1e')][_0x5f92('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x5f92('0xb'),_0x5f92('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x5f92('0x21')}]})['then'](function(_0x1b42c3){if(!_0x1b42c3){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x150b97={'tls':{'rejectUnauthorized':![]}};if(_0x1b42c3[_0x5f92('0x21')][_0x5f92('0x22')]){_0x150b97[_0x5f92('0x22')]=_0x1b42c3['Smtp'][_0x5f92('0x22')];}else{_0x150b97[_0x5f92('0x23')]=_0x1b42c3['Smtp'][_0x5f92('0x23')];_0x150b97['port']=_0x1b42c3[_0x5f92('0x21')][_0x5f92('0x24')];_0x150b97[_0x5f92('0x25')]=_0x1b42c3[_0x5f92('0x21')][_0x5f92('0x25')];}if(_0x1b42c3[_0x5f92('0x21')][_0x5f92('0x26')]){_0x150b97[_0x5f92('0x27')]={'user':_0x1b42c3[_0x5f92('0x21')][_0x5f92('0x11')],'pass':_0x1b42c3['Smtp'][_0x5f92('0x28')]};}var _0x973d95={'account':_0x150b97,'message':_[_0x5f92('0x29')]({'from':util[_0x5f92('0x2a')](_0x5f92('0x2b'),_0x1b42c3[_0x5f92('0xb')],_0x1b42c3[_0x5f92('0x20')]||_0x1b42c3[_0x5f92('0x21')][_0x5f92('0x11')])},_0x23f5b8)};return client[_0x5f92('0x2c')](_0x5f92('0x2d'),_0x973d95);})[_0x5f92('0x13')](function(_0xe4f5ad){if(_0xe4f5ad[_0x5f92('0x2e')]){throw new Error(util['format'](_0x5f92('0x2f'),_0xe4f5ad[_0x5f92('0x2e')][_0x5f92('0x30')]||JSON[_0x5f92('0x31')](_0xe4f5ad[_0x5f92('0x2e')])));}return!![];});}function handleError(_0x54ff4e,_0xda5613,_0x4fb864){return _0x54ff4e[_0x5f92('0x32')](_0xda5613||0x1f4)[_0x5f92('0x33')]({'message':_0x4fb864?_0x4fb864['message']||_0x4fb864:''});}exports[_0x5f92('0x34')]=function(_0x4fa6fb,_0x4ae1a8,_0x48301a){passport[_0x5f92('0x15')]('local',function(_0x1f5a2e,_0x2c9cb1,_0x217512){var _0x22d2cf=_0x1f5a2e||_0x217512;if(_0x22d2cf){return handleError(_0x4ae1a8,0x191,_0x22d2cf);}if(!_0x2c9cb1){return handleError(_0x4ae1a8,0x194,{'message':_0x5f92('0x35')});}else{var _0x4a2cfd={'payload':{'id':_0x2c9cb1['id'],'role':_0x2c9cb1[_0x5f92('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x5f92('0x36')](_0x4a2cfd)['then'](function(_0x16fe6a){_0x4ae1a8[_0x5f92('0x37')]({'id':_0x2c9cb1['id'],'token':_0x16fe6a,'statusCall':'','isAlreadyLogged':_0x2c9cb1['online']});});}})(_0x4fa6fb,_0x4ae1a8,_0x48301a);};exports[_0x5f92('0x38')]=function(_0xbdb8ac,_0x36d63a,_0x3f4020){if(!_0xbdb8ac[_0x5f92('0x39')]['email']){return handleError(_0x36d63a,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x3a07dc=rs[_0x5f92('0x3a')]();_0xbdb8ac[_0x5f92('0x39')][_0x5f92('0x20')]=_0xbdb8ac[_0x5f92('0x39')][_0x5f92('0x20')]['trim']()['toLowerCase']();var _0x43e45f;return db[_0x5f92('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x5f92('0x17'),_0x5f92('0x9')],'raw':!![]})[_0x5f92('0x13')](function(_0x1cbacf){_0x43e45f=_0x1cbacf;return db['User'][_0x5f92('0x1f')]({'where':{'email':_0xbdb8ac[_0x5f92('0x39')][_0x5f92('0x20')]}});})[_0x5f92('0x13')](function(_0x1fbf69){if(!_0x1fbf69){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x1fbf69[_0x5f92('0x16')]){throw new Error(_0x5f92('0x3b'));}if(_0x1fbf69[_0x5f92('0xe')]){if(moment(_0x1fbf69['blockedAt'])[_0x5f92('0x19')](_0x43e45f[_0x5f92('0x9')],_0x5f92('0x1a'))>moment()){throw new Error(_0x5f92('0x3c'));}else{_0x1fbf69[_0x5f92('0xe')]=![];_0x1fbf69['blockedAt']=null;}}_0x1fbf69['resetPasswordToken']=_0x3a07dc;_0x1fbf69['resetPasswordExpires']=Date[_0x5f92('0x3d')]()+0x36ee80;return _0x1fbf69[_0x5f92('0x3e')]();})[_0x5f92('0x13')](function(){return sendServiceMail({'to':_0xbdb8ac[_0x5f92('0x39')][_0x5f92('0x20')],'subject':_0x5f92('0x3f'),'text':_0x5f92('0x40')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x5f92('0x41')+_0xbdb8ac[_0x5f92('0x42')][_0x5f92('0x23')]+_0x5f92('0x43')+_0x3a07dc+'\x0a\x0a'+_0x5f92('0x44')});})['then'](function(){_0x36d63a['status'](0xc8)[_0x5f92('0x33')]({'message':_0x5f92('0x45')});})['catch'](function(_0x2d4d4b){return handleError(_0x36d63a,0x1f4,_0x2d4d4b);});};exports['reset']=function(_0x5cdbff,_0x476a07,_0x2c71fc){return db[_0x5f92('0x46')][_0x5f92('0x1f')]({'where':{'resetPasswordToken':_0x5cdbff[_0x5f92('0x47')][_0x5f92('0x48')],'resetPasswordExpires':{'$gt':Date[_0x5f92('0x3d')]()}}})[_0x5f92('0x13')](function(_0x498bd5){if(!_0x498bd5){throw new Error(_0x5f92('0x49'));}return db[_0x5f92('0x8')]['findOne']({'attributes':['id',_0x5f92('0x4a'),_0x5f92('0x4b'),_0x5f92('0x4c')]})[_0x5f92('0x13')](function(_0xca9229){if(_0xca9229[_0x5f92('0x4a')])authService[_0x5f92('0x4d')](_0x5cdbff[_0x5f92('0x39')]['password']);if(!_0xca9229[_0x5f92('0x4b')]||!_0x498bd5[_0x5f92('0x4e')])return _0x498bd5;authService[_0x5f92('0x4f')](_0x5cdbff['body'][_0x5f92('0x50')],_0x498bd5[_0x5f92('0x4e')],_0xca9229[_0x5f92('0x4c')]);return _0x498bd5;})['then'](function(){_0x498bd5[_0x5f92('0x50')]=_0x5cdbff[_0x5f92('0x39')][_0x5f92('0x50')];_0x498bd5[_0x5f92('0x51')]=null;_0x498bd5[_0x5f92('0x52')]=null;return _0x498bd5[_0x5f92('0x3e')]();});})[_0x5f92('0x13')](function(){_0x476a07['status'](0xc8)[_0x5f92('0x33')]({'message':_0x5f92('0x53')});})['catch'](function(_0x404c18){return handleError(_0x476a07,0x1f4,_0x404c18);});};passport[_0x5f92('0x54')](new LocalStrategy({'usernameField':'name','passwordField':_0x5f92('0x50')},function(_0x2d3168,_0x1a82d9,_0x3c3cbf){return localAuthenticate(db[_0x5f92('0x46')],_0x2d3168,_0x1a82d9,_0x3c3cbf);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0f10721..9b2484b 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 _0x6d85=['forgot','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x2e5030,_0x120033){var _0x205687=function(_0x36b7a4){while(--_0x36b7a4){_0x2e5030['push'](_0x2e5030['shift']());}};_0x205687(++_0x120033);}(_0x6d85,0x122));var _0x56d8=function(_0x39a09b,_0x403398){_0x39a09b=_0x39a09b-0x0;var _0x382252=_0x6d85[_0x39a09b];return _0x382252;};'use strict';var express=require(_0x56d8('0x0'));var router=express[_0x56d8('0x1')]();var controller=require(_0x56d8('0x2'));router[_0x56d8('0x3')]('/',controller[_0x56d8('0x4')]);router[_0x56d8('0x3')](_0x56d8('0x5'),controller[_0x56d8('0x6')]);router[_0x56d8('0x3')]('/reset/:token',controller['reset']);module[_0x56d8('0x7')]=router; \ No newline at end of file +var _0x77b0=['login','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x4cc89c,_0x4d2e23){var _0x5852a2=function(_0xc597fc){while(--_0xc597fc){_0x4cc89c['push'](_0x4cc89c['shift']());}};_0x5852a2(++_0x4d2e23);}(_0x77b0,0x17c));var _0x077b=function(_0x118824,_0x49e7b2){_0x118824=_0x118824-0x0;var _0x406641=_0x77b0[_0x118824];return _0x406641;};'use strict';var express=require(_0x077b('0x0'));var router=express[_0x077b('0x1')]();var controller=require(_0x077b('0x2'));router[_0x077b('0x3')]('/',controller[_0x077b('0x4')]);router['post']('/forgot',controller['forgot']);router['post'](_0x077b('0x5'),controller[_0x077b('0x6')]);module[_0x077b('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 cbf5042..dc6438a 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 _0x2da9=['BOOLEAN','sequelize','exports','STRING'];(function(_0x17bfa4,_0x3eb5f7){var _0x3d9ca8=function(_0x235cd4){while(--_0x235cd4){_0x17bfa4['push'](_0x17bfa4['shift']());}};_0x3d9ca8(++_0x3eb5f7);}(_0x2da9,0x1b1));var _0x92da=function(_0x206437,_0x40e74f){_0x206437=_0x206437-0x0;var _0x15a3cf=_0x2da9[_0x206437];return _0x15a3cf;};'use strict';var Sequelize=require(_0x92da('0x0'));module[_0x92da('0x1')]={'name':{'type':Sequelize[_0x92da('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x92da('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x2c45=['STRING','INTEGER','exports'];(function(_0x249529,_0x15af2f){var _0x4fb4d4=function(_0x5dd532){while(--_0x5dd532){_0x249529['push'](_0x249529['shift']());}};_0x4fb4d4(++_0x15af2f);}(_0x2c45,0x143));var _0x52c4=function(_0x1fe9a7,_0xa8b21){_0x1fe9a7=_0x1fe9a7-0x0;var _0x587177=_0x2c45[_0x1fe9a7];return _0x587177;};'use strict';var Sequelize=require('sequelize');module[_0x52c4('0x0')]={'name':{'type':Sequelize[_0x52c4('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x52c4('0x1')]},'description':{'type':Sequelize[_0x52c4('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x52c4('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 46a0392..75e6750 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 _0x3a8b=['../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','send','index','map','Automation','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','type','includeAll','rows','catch','show','params','options','find','create','body','Condition','ids','omit','getConditions','findOne','hasOwnProperty','nolimit','addActions','Action','getActions','order','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util'];(function(_0x26dc9a,_0x1633c7){var _0xd4fbf2=function(_0x4dc0b3){while(--_0x4dc0b3){_0x26dc9a['push'](_0x26dc9a['shift']());}};_0xd4fbf2(++_0x1633c7);}(_0x3a8b,0xd5));var _0xb3a8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3a8b[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3a8('0x0'));var zipdir=require(_0xb3a8('0x1'));var jsonpatch=require(_0xb3a8('0x2'));var rp=require(_0xb3a8('0x3'));var moment=require('moment');var BPromise=require(_0xb3a8('0x4'));var Mustache=require(_0xb3a8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb3a8('0x6'));var csv=require('to-csv');var ejs=require(_0xb3a8('0x7'));var fs=require('fs');var fs_extra=require(_0xb3a8('0x8'));var _=require(_0xb3a8('0x9'));var squel=require(_0xb3a8('0xa'));var crypto=require(_0xb3a8('0xb'));var jsforce=require(_0xb3a8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb3a8('0xd'));var querystring=require(_0xb3a8('0xe'));var Papa=require('papaparse');var Redis=require(_0xb3a8('0xf'));var authService=require(_0xb3a8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb3a8('0x11'));var hardwareService=require(_0xb3a8('0x12'));var logger=require(_0xb3a8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb3a8('0x14'));var db=require(_0xb3a8('0x15'))['db'];function respondWithStatusCode(_0x34eb1b,_0x4a1733){_0x4a1733=_0x4a1733||0xcc;return function(_0x330b6f){if(_0x330b6f){return _0x34eb1b['sendStatus'](_0x4a1733);}return _0x34eb1b[_0xb3a8('0x16')](_0x4a1733)[_0xb3a8('0x17')]();};}function respondWithResult(_0x47bbe1,_0x916644){_0x916644=_0x916644||0xc8;return function(_0x57a27c){if(_0x57a27c){return _0x47bbe1['status'](_0x916644)[_0xb3a8('0x18')](_0x57a27c);}};}function respondWithFilteredResult(_0x34ca46,_0x1bb8c3){return function(_0x2680ae){if(_0x2680ae){var _0x416dda=typeof _0x1bb8c3['offset']===_0xb3a8('0x19')&&typeof _0x1bb8c3[_0xb3a8('0x1a')]===_0xb3a8('0x19');var _0x52f39b=_0x2680ae[_0xb3a8('0x1b')];var _0x3c2cc5=_0x416dda?0x0:_0x1bb8c3[_0xb3a8('0x1c')];var _0x536633=_0x416dda?_0x2680ae[_0xb3a8('0x1b')]:_0x1bb8c3[_0xb3a8('0x1c')]+_0x1bb8c3['limit'];var _0x5ef535;if(_0x536633>=_0x52f39b){_0x536633=_0x52f39b;_0x5ef535=0xc8;}else{_0x5ef535=0xce;}_0x34ca46['status'](_0x5ef535);return _0x34ca46[_0xb3a8('0x1d')](_0xb3a8('0x1e'),_0x3c2cc5+'-'+_0x536633+'/'+_0x52f39b)[_0xb3a8('0x18')](_0x2680ae);}return null;};}function patchUpdates(_0x2a0b50){return function(_0x2fff74){try{jsonpatch['apply'](_0x2fff74,_0x2a0b50,!![]);}catch(_0x110f71){return BPromise[_0xb3a8('0x1f')](_0x110f71);}return _0x2fff74['save']();};}function saveUpdates(_0x3b0510,_0x5871ff){return function(_0x1ad96a){if(_0x1ad96a){return _0x1ad96a[_0xb3a8('0x20')](_0x3b0510)[_0xb3a8('0x21')](function(_0xae2968){return _0xae2968;});}return null;};}function removeEntity(_0x5efabe,_0x547431){return function(_0x583e7c){if(_0x583e7c){return _0x583e7c[_0xb3a8('0x22')]()[_0xb3a8('0x21')](function(){_0x5efabe[_0xb3a8('0x16')](0xcc)[_0xb3a8('0x17')]();});}};}function handleEntityNotFound(_0x212ea8,_0x1e1a86){return function(_0x1c359b){if(!_0x1c359b){_0x212ea8[_0xb3a8('0x23')](0x194);}return _0x1c359b;};}function handleError(_0x3bda7c,_0x36b081){_0x36b081=_0x36b081||0x1f4;return function(_0xb52bd9){logger[_0xb3a8('0x24')](_0xb52bd9['stack']);if(_0xb52bd9[_0xb3a8('0x25')]){delete _0xb52bd9[_0xb3a8('0x25')];}_0x3bda7c[_0xb3a8('0x16')](_0x36b081)[_0xb3a8('0x26')](_0xb52bd9);};}exports[_0xb3a8('0x27')]=function(_0x638e79,_0x9b5157){var _0x5af26c={},_0x4498db={},_0x5357f6={'count':0x0,'rows':[]};var _0x63af0e=_[_0xb3a8('0x28')](db[_0xb3a8('0x29')][_0xb3a8('0x2a')],function(_0x892f53){return{'name':_0x892f53['fieldName'],'type':_0x892f53['type'][_0xb3a8('0x2b')]};});_0x4498db[_0xb3a8('0x2c')]=_['map'](_0x63af0e,'name');_0x4498db['query']=_[_0xb3a8('0x2d')](_0x638e79[_0xb3a8('0x2e')]);_0x4498db[_0xb3a8('0x2f')]=_[_0xb3a8('0x30')](_0x4498db[_0xb3a8('0x2c')],_0x4498db[_0xb3a8('0x2e')]);_0x5af26c[_0xb3a8('0x31')]=_['intersection'](_0x4498db[_0xb3a8('0x2c')],qs[_0xb3a8('0x32')](_0x638e79[_0xb3a8('0x2e')][_0xb3a8('0x32')]));_0x5af26c[_0xb3a8('0x31')]=_0x5af26c['attributes'][_0xb3a8('0x33')]?_0x5af26c[_0xb3a8('0x31')]:_0x4498db[_0xb3a8('0x2c')];if(!_0x638e79[_0xb3a8('0x2e')]['hasOwnProperty']('nolimit')){_0x5af26c['limit']=qs[_0xb3a8('0x1a')](_0x638e79[_0xb3a8('0x2e')][_0xb3a8('0x1a')]);_0x5af26c[_0xb3a8('0x1c')]=qs[_0xb3a8('0x1c')](_0x638e79['query'][_0xb3a8('0x1c')]);}_0x5af26c['order']=qs[_0xb3a8('0x34')](_0x638e79[_0xb3a8('0x2e')][_0xb3a8('0x34')]);_0x5af26c['where']=qs[_0xb3a8('0x2f')](_[_0xb3a8('0x35')](_0x638e79[_0xb3a8('0x2e')],_0x4498db['filters']),_0x63af0e);if(_0x638e79['query'][_0xb3a8('0x36')]){_0x5af26c[_0xb3a8('0x37')]=_[_0xb3a8('0x38')](_0x5af26c[_0xb3a8('0x37')],{'$or':_[_0xb3a8('0x28')](_0x63af0e,function(_0x41c46e){if(_0x41c46e[_0xb3a8('0x39')]!=='VIRTUAL'){var _0x20f55e={};_0x20f55e[_0x41c46e[_0xb3a8('0x25')]]={'$like':'%'+_0x638e79[_0xb3a8('0x2e')][_0xb3a8('0x36')]+'%'};return _0x20f55e;}})});}_0x5af26c=_['merge']({},_0x5af26c,_0x638e79['options']);var _0x2a5ebe={'where':_0x5af26c['where']};return db['Automation']['count'](_0x2a5ebe)[_0xb3a8('0x21')](function(_0x317c98){_0x5357f6[_0xb3a8('0x1b')]=_0x317c98;if(_0x638e79['query'][_0xb3a8('0x3a')]){_0x5af26c['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x5af26c);})['then'](function(_0xba121a){_0x5357f6[_0xb3a8('0x3b')]=_0xba121a;return _0x5357f6;})[_0xb3a8('0x21')](respondWithFilteredResult(_0x9b5157,_0x5af26c))[_0xb3a8('0x3c')](handleError(_0x9b5157,null));};exports[_0xb3a8('0x3d')]=function(_0xf9493f,_0x5a5678){var _0x185b24={'raw':![],'where':{'id':_0xf9493f[_0xb3a8('0x3e')]['id']}},_0x9d633d={};_0x9d633d[_0xb3a8('0x2c')]=_[_0xb3a8('0x2d')](db[_0xb3a8('0x29')]['rawAttributes']);_0x9d633d['query']=_['keys'](_0xf9493f[_0xb3a8('0x2e')]);_0x9d633d[_0xb3a8('0x2f')]=_[_0xb3a8('0x30')](_0x9d633d[_0xb3a8('0x2c')],_0x9d633d['query']);_0x185b24['attributes']=_['intersection'](_0x9d633d[_0xb3a8('0x2c')],qs[_0xb3a8('0x32')](_0xf9493f[_0xb3a8('0x2e')][_0xb3a8('0x32')]));_0x185b24[_0xb3a8('0x31')]=_0x185b24['attributes'][_0xb3a8('0x33')]?_0x185b24[_0xb3a8('0x31')]:_0x9d633d[_0xb3a8('0x2c')];if(_0xf9493f[_0xb3a8('0x2e')][_0xb3a8('0x3a')]){_0x185b24['include']=[{'all':!![]}];}_0x185b24=_[_0xb3a8('0x38')]({},_0x185b24,_0xf9493f[_0xb3a8('0x3f')]);return db[_0xb3a8('0x29')][_0xb3a8('0x40')](_0x185b24)[_0xb3a8('0x21')](handleEntityNotFound(_0x5a5678,null))[_0xb3a8('0x21')](respondWithResult(_0x5a5678,null))['catch'](handleError(_0x5a5678,null));};exports['create']=function(_0x320121,_0x271b9a){return db[_0xb3a8('0x29')][_0xb3a8('0x41')](_0x320121[_0xb3a8('0x42')],{})['then'](respondWithResult(_0x271b9a,0xc9))[_0xb3a8('0x3c')](handleError(_0x271b9a,null));};exports[_0xb3a8('0x20')]=function(_0x46368b,_0x5f5643){if(_0x46368b[_0xb3a8('0x42')]['id']){delete _0x46368b[_0xb3a8('0x42')]['id'];}return db['Automation']['find']({'where':{'id':_0x46368b[_0xb3a8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5f5643,null))[_0xb3a8('0x21')](saveUpdates(_0x46368b[_0xb3a8('0x42')],null))[_0xb3a8('0x21')](respondWithResult(_0x5f5643,null))[_0xb3a8('0x3c')](handleError(_0x5f5643,null));};exports[_0xb3a8('0x22')]=function(_0x16b8b2,_0x31e272){return db[_0xb3a8('0x29')][_0xb3a8('0x40')]({'where':{'id':_0x16b8b2['params']['id']}})[_0xb3a8('0x21')](handleEntityNotFound(_0x31e272,null))['then'](removeEntity(_0x31e272,null))['catch'](handleError(_0x31e272,null));};exports['addConditions']=function(_0x23b79e,_0x1554a1,_0x2f2e9d){return db[_0xb3a8('0x43')]['find']({'where':{'id':_0x23b79e[_0xb3a8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1554a1,null))[_0xb3a8('0x21')](function(_0x2076a1){if(_0x2076a1){return _0x2076a1['addConditions'](_0x23b79e[_0xb3a8('0x42')][_0xb3a8('0x44')],_[_0xb3a8('0x45')](_0x23b79e[_0xb3a8('0x42')],[_0xb3a8('0x44'),'id'])||{});}})[_0xb3a8('0x21')](respondWithResult(_0x1554a1,null))[_0xb3a8('0x3c')](handleError(_0x1554a1,null));};exports[_0xb3a8('0x46')]=function(_0x42c73a,_0x2b689d,_0x5cc761){var _0x50bdf4={};var _0x19089d={};var _0x17fae9;var _0x4545bb;return db[_0xb3a8('0x29')][_0xb3a8('0x47')]({'where':{'id':_0x42c73a[_0xb3a8('0x3e')]['id']}})[_0xb3a8('0x21')](handleEntityNotFound(_0x2b689d,null))[_0xb3a8('0x21')](function(_0x489cb9){if(_0x489cb9){_0x17fae9=_0x489cb9;_0x19089d[_0xb3a8('0x2c')]=_[_0xb3a8('0x2d')](db[_0xb3a8('0x43')][_0xb3a8('0x2a')]);_0x19089d[_0xb3a8('0x2e')]=_[_0xb3a8('0x2d')](_0x42c73a[_0xb3a8('0x2e')]);_0x19089d['filters']=_[_0xb3a8('0x30')](_0x19089d['model'],_0x19089d['query']);_0x50bdf4[_0xb3a8('0x31')]=_['intersection'](_0x19089d[_0xb3a8('0x2c')],qs['fields'](_0x42c73a[_0xb3a8('0x2e')][_0xb3a8('0x32')]));_0x50bdf4[_0xb3a8('0x31')]=_0x50bdf4[_0xb3a8('0x31')][_0xb3a8('0x33')]?_0x50bdf4['attributes']:_0x19089d[_0xb3a8('0x2c')];_0x50bdf4['order']=qs[_0xb3a8('0x34')](_0x42c73a['query']['sort']);_0x50bdf4[_0xb3a8('0x37')]=qs[_0xb3a8('0x2f')](_['pick'](_0x42c73a[_0xb3a8('0x2e')],_0x19089d[_0xb3a8('0x2f')]));if(_0x42c73a[_0xb3a8('0x2e')]['filter']){_0x50bdf4[_0xb3a8('0x37')]=_[_0xb3a8('0x38')](_0x50bdf4[_0xb3a8('0x37')],{'$or':_['map'](_0x50bdf4['attributes'],function(_0x4934a4){var _0x42eb07={};_0x42eb07[_0x4934a4]={'$like':'%'+_0x42c73a[_0xb3a8('0x2e')][_0xb3a8('0x36')]+'%'};return _0x42eb07;})});}_0x50bdf4=_[_0xb3a8('0x38')]({},_0x50bdf4,_0x42c73a['options']);return _0x17fae9[_0xb3a8('0x46')](_0x50bdf4);}})[_0xb3a8('0x21')](function(_0x56ba5a){if(_0x56ba5a){_0x4545bb=_0x56ba5a[_0xb3a8('0x33')];if(!_0x42c73a[_0xb3a8('0x2e')][_0xb3a8('0x48')](_0xb3a8('0x49'))){_0x50bdf4[_0xb3a8('0x1a')]=qs['limit'](_0x42c73a[_0xb3a8('0x2e')][_0xb3a8('0x1a')]);_0x50bdf4[_0xb3a8('0x1c')]=qs[_0xb3a8('0x1c')](_0x42c73a[_0xb3a8('0x2e')][_0xb3a8('0x1c')]);}return _0x17fae9['getConditions'](_0x50bdf4);}})['then'](function(_0x15ee4e){if(_0x15ee4e){return _0x15ee4e?{'count':_0x4545bb,'rows':_0x15ee4e}:null;}})[_0xb3a8('0x21')](respondWithResult(_0x2b689d,null))['catch'](handleError(_0x2b689d,null));};exports[_0xb3a8('0x4a')]=function(_0x3b6d3b,_0x6b4453,_0x18baa1){return db[_0xb3a8('0x4b')][_0xb3a8('0x40')]({'where':{'id':_0x3b6d3b[_0xb3a8('0x3e')]['id']}})[_0xb3a8('0x21')](handleEntityNotFound(_0x6b4453,null))['then'](function(_0xec9e0b){if(_0xec9e0b){return _0xec9e0b[_0xb3a8('0x4a')](_0x3b6d3b['body'][_0xb3a8('0x44')],_['omit'](_0x3b6d3b[_0xb3a8('0x42')],[_0xb3a8('0x44'),'id'])||{});}})['then'](respondWithResult(_0x6b4453,null))['catch'](handleError(_0x6b4453,null));};exports[_0xb3a8('0x4c')]=function(_0x153d4e,_0x5f5529,_0x5c02a7){var _0x3c86a2={};var _0x3f8426={};var _0x501f1d;var _0xbc2d09;return db['Automation'][_0xb3a8('0x47')]({'where':{'id':_0x153d4e['params']['id']}})[_0xb3a8('0x21')](handleEntityNotFound(_0x5f5529,null))[_0xb3a8('0x21')](function(_0xf9f30b){if(_0xf9f30b){_0x501f1d=_0xf9f30b;_0x3f8426[_0xb3a8('0x2c')]=_[_0xb3a8('0x2d')](db['Action'][_0xb3a8('0x2a')]);_0x3f8426[_0xb3a8('0x2e')]=_[_0xb3a8('0x2d')](_0x153d4e[_0xb3a8('0x2e')]);_0x3f8426[_0xb3a8('0x2f')]=_[_0xb3a8('0x30')](_0x3f8426[_0xb3a8('0x2c')],_0x3f8426[_0xb3a8('0x2e')]);_0x3c86a2[_0xb3a8('0x31')]=_[_0xb3a8('0x30')](_0x3f8426[_0xb3a8('0x2c')],qs['fields'](_0x153d4e[_0xb3a8('0x2e')]['fields']));_0x3c86a2[_0xb3a8('0x31')]=_0x3c86a2['attributes'][_0xb3a8('0x33')]?_0x3c86a2[_0xb3a8('0x31')]:_0x3f8426[_0xb3a8('0x2c')];_0x3c86a2[_0xb3a8('0x4d')]=qs[_0xb3a8('0x34')](_0x153d4e[_0xb3a8('0x2e')][_0xb3a8('0x34')]);_0x3c86a2['where']=qs[_0xb3a8('0x2f')](_['pick'](_0x153d4e[_0xb3a8('0x2e')],_0x3f8426[_0xb3a8('0x2f')]));if(_0x153d4e[_0xb3a8('0x2e')][_0xb3a8('0x36')]){_0x3c86a2[_0xb3a8('0x37')]=_['merge'](_0x3c86a2[_0xb3a8('0x37')],{'$or':_[_0xb3a8('0x28')](_0x3c86a2[_0xb3a8('0x31')],function(_0x1fe4ea){var _0x531c92={};_0x531c92[_0x1fe4ea]={'$like':'%'+_0x153d4e[_0xb3a8('0x2e')][_0xb3a8('0x36')]+'%'};return _0x531c92;})});}_0x3c86a2=_[_0xb3a8('0x38')]({},_0x3c86a2,_0x153d4e[_0xb3a8('0x3f')]);return _0x501f1d[_0xb3a8('0x4c')](_0x3c86a2);}})[_0xb3a8('0x21')](function(_0x3d0494){if(_0x3d0494){_0xbc2d09=_0x3d0494[_0xb3a8('0x33')];if(!_0x153d4e['query'][_0xb3a8('0x48')](_0xb3a8('0x49'))){_0x3c86a2['limit']=qs[_0xb3a8('0x1a')](_0x153d4e[_0xb3a8('0x2e')][_0xb3a8('0x1a')]);_0x3c86a2[_0xb3a8('0x1c')]=qs[_0xb3a8('0x1c')](_0x153d4e[_0xb3a8('0x2e')][_0xb3a8('0x1c')]);}return _0x501f1d['getActions'](_0x3c86a2);}})[_0xb3a8('0x21')](function(_0x224308){if(_0x224308){return _0x224308?{'count':_0xbc2d09,'rows':_0x224308}:null;}})[_0xb3a8('0x21')](respondWithResult(_0x5f5529,null))[_0xb3a8('0x3c')](handleError(_0x5f5529,null));}; \ No newline at end of file +var _0x3c22=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','Automation','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','addConditions','Condition','find','ids','getConditions','findOne','order','nolimit','addActions','Action','omit','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2d6b73,_0x11a92f){var _0x45bbf2=function(_0x472e5f){while(--_0x472e5f){_0x2d6b73['push'](_0x2d6b73['shift']());}};_0x45bbf2(++_0x11a92f);}(_0x3c22,0x94));var _0x23c2=function(_0x4baa8a,_0x3ea752){_0x4baa8a=_0x4baa8a-0x0;var _0x41c481=_0x3c22[_0x4baa8a];return _0x41c481;};'use strict';var emlformat=require(_0x23c2('0x0'));var rimraf=require(_0x23c2('0x1'));var zipdir=require(_0x23c2('0x2'));var jsonpatch=require(_0x23c2('0x3'));var rp=require('request-promise');var moment=require(_0x23c2('0x4'));var BPromise=require(_0x23c2('0x5'));var Mustache=require('mustache');var util=require(_0x23c2('0x6'));var path=require(_0x23c2('0x7'));var sox=require(_0x23c2('0x8'));var csv=require(_0x23c2('0x9'));var ejs=require(_0x23c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x23c2('0xb'));var crypto=require(_0x23c2('0xc'));var jsforce=require(_0x23c2('0xd'));var deskjs=require(_0x23c2('0xe'));var toCsv=require(_0x23c2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x23c2('0xf'));var qs=require(_0x23c2('0x10'));var as=require(_0x23c2('0x11'));var hardwareService=require(_0x23c2('0x12'));var logger=require('../../config/logger')(_0x23c2('0x13'));var utils=require('../../config/utils');var config=require(_0x23c2('0x14'));var licenseUtil=require(_0x23c2('0x15'));var db=require(_0x23c2('0x16'))['db'];function respondWithStatusCode(_0x1c751e,_0x6f980c){_0x6f980c=_0x6f980c||0xcc;return function(_0x2ebd62){if(_0x2ebd62){return _0x1c751e[_0x23c2('0x17')](_0x6f980c);}return _0x1c751e[_0x23c2('0x18')](_0x6f980c)[_0x23c2('0x19')]();};}function respondWithResult(_0x3ecd20,_0x125664){_0x125664=_0x125664||0xc8;return function(_0x33f665){if(_0x33f665){return _0x3ecd20[_0x23c2('0x18')](_0x125664)[_0x23c2('0x1a')](_0x33f665);}};}function respondWithFilteredResult(_0x3a0765,_0x25fc9d){return function(_0x39e83b){if(_0x39e83b){var _0xf84a41=typeof _0x25fc9d['offset']===_0x23c2('0x1b')&&typeof _0x25fc9d[_0x23c2('0x1c')]==='undefined';var _0x3d94f5=_0x39e83b[_0x23c2('0x1d')];var _0x59068d=_0xf84a41?0x0:_0x25fc9d[_0x23c2('0x1e')];var _0x386fba=_0xf84a41?_0x39e83b[_0x23c2('0x1d')]:_0x25fc9d[_0x23c2('0x1e')]+_0x25fc9d[_0x23c2('0x1c')];var _0x16f314;if(_0x386fba>=_0x3d94f5){_0x386fba=_0x3d94f5;_0x16f314=0xc8;}else{_0x16f314=0xce;}_0x3a0765[_0x23c2('0x18')](_0x16f314);return _0x3a0765['set'](_0x23c2('0x1f'),_0x59068d+'-'+_0x386fba+'/'+_0x3d94f5)[_0x23c2('0x1a')](_0x39e83b);}return null;};}function patchUpdates(_0x136202){return function(_0x5c35dd){try{jsonpatch[_0x23c2('0x20')](_0x5c35dd,_0x136202,!![]);}catch(_0x554627){return BPromise['reject'](_0x554627);}return _0x5c35dd[_0x23c2('0x21')]();};}function saveUpdates(_0x5bb137,_0xc74b04){return function(_0x4384f1){if(_0x4384f1){return _0x4384f1[_0x23c2('0x22')](_0x5bb137)[_0x23c2('0x23')](function(_0x1e32c0){return _0x1e32c0;});}return null;};}function removeEntity(_0x21f448,_0x5d6cb9){return function(_0x501ad6){if(_0x501ad6){return _0x501ad6[_0x23c2('0x24')]()[_0x23c2('0x23')](function(){_0x21f448[_0x23c2('0x18')](0xcc)[_0x23c2('0x19')]();});}};}function handleEntityNotFound(_0x544577,_0x17c81d){return function(_0x19abee){if(!_0x19abee){_0x544577[_0x23c2('0x17')](0x194);}return _0x19abee;};}function handleError(_0x3954a9,_0x1482b7){_0x1482b7=_0x1482b7||0x1f4;return function(_0x4eaca3){logger[_0x23c2('0x25')](_0x4eaca3[_0x23c2('0x26')]);if(_0x4eaca3[_0x23c2('0x27')]){delete _0x4eaca3['name'];}_0x3954a9[_0x23c2('0x18')](_0x1482b7)['send'](_0x4eaca3);};}exports[_0x23c2('0x28')]=function(_0x6da4dd,_0xa4e27e){var _0x10faca={},_0x48c4b0={},_0x4d8066={'count':0x0,'rows':[]};var _0x4b3644=_[_0x23c2('0x29')](db[_0x23c2('0x2a')]['rawAttributes'],function(_0xd15c06){return{'name':_0xd15c06[_0x23c2('0x2b')],'type':_0xd15c06[_0x23c2('0x2c')][_0x23c2('0x2d')]};});_0x48c4b0[_0x23c2('0x2e')]=_[_0x23c2('0x29')](_0x4b3644,_0x23c2('0x27'));_0x48c4b0[_0x23c2('0x2f')]=_[_0x23c2('0x30')](_0x6da4dd[_0x23c2('0x2f')]);_0x48c4b0['filters']=_[_0x23c2('0x31')](_0x48c4b0[_0x23c2('0x2e')],_0x48c4b0[_0x23c2('0x2f')]);_0x10faca[_0x23c2('0x32')]=_[_0x23c2('0x31')](_0x48c4b0['model'],qs[_0x23c2('0x33')](_0x6da4dd[_0x23c2('0x2f')][_0x23c2('0x33')]));_0x10faca['attributes']=_0x10faca['attributes'][_0x23c2('0x34')]?_0x10faca['attributes']:_0x48c4b0[_0x23c2('0x2e')];if(!_0x6da4dd['query'][_0x23c2('0x35')]('nolimit')){_0x10faca['limit']=qs[_0x23c2('0x1c')](_0x6da4dd[_0x23c2('0x2f')][_0x23c2('0x1c')]);_0x10faca[_0x23c2('0x1e')]=qs[_0x23c2('0x1e')](_0x6da4dd['query'][_0x23c2('0x1e')]);}_0x10faca['order']=qs[_0x23c2('0x36')](_0x6da4dd[_0x23c2('0x2f')][_0x23c2('0x36')]);_0x10faca[_0x23c2('0x37')]=qs['filters'](_[_0x23c2('0x38')](_0x6da4dd[_0x23c2('0x2f')],_0x48c4b0[_0x23c2('0x39')]),_0x4b3644);if(_0x6da4dd[_0x23c2('0x2f')][_0x23c2('0x3a')]){_0x10faca[_0x23c2('0x37')]=_[_0x23c2('0x3b')](_0x10faca[_0x23c2('0x37')],{'$or':_[_0x23c2('0x29')](_0x4b3644,function(_0x2316c3){if(_0x2316c3['type']!==_0x23c2('0x3c')){var _0x1cffbc={};_0x1cffbc[_0x2316c3[_0x23c2('0x27')]]={'$like':'%'+_0x6da4dd[_0x23c2('0x2f')][_0x23c2('0x3a')]+'%'};return _0x1cffbc;}})});}_0x10faca=_[_0x23c2('0x3b')]({},_0x10faca,_0x6da4dd[_0x23c2('0x3d')]);var _0xc0c6b6={'where':_0x10faca[_0x23c2('0x37')]};return db[_0x23c2('0x2a')][_0x23c2('0x1d')](_0xc0c6b6)[_0x23c2('0x23')](function(_0x2e7451){_0x4d8066['count']=_0x2e7451;if(_0x6da4dd[_0x23c2('0x2f')][_0x23c2('0x3e')]){_0x10faca[_0x23c2('0x3f')]=[{'all':!![]}];}return db['Automation'][_0x23c2('0x40')](_0x10faca);})[_0x23c2('0x23')](function(_0x18c1c2){_0x4d8066[_0x23c2('0x41')]=_0x18c1c2;return _0x4d8066;})[_0x23c2('0x23')](respondWithFilteredResult(_0xa4e27e,_0x10faca))[_0x23c2('0x42')](handleError(_0xa4e27e,null));};exports['show']=function(_0x5fe7e6,_0x3b8cfd){var _0x3342d5={'raw':![],'where':{'id':_0x5fe7e6[_0x23c2('0x43')]['id']}},_0x1547b1={};_0x1547b1['model']=_['keys'](db['Automation'][_0x23c2('0x44')]);_0x1547b1['query']=_[_0x23c2('0x30')](_0x5fe7e6[_0x23c2('0x2f')]);_0x1547b1[_0x23c2('0x39')]=_[_0x23c2('0x31')](_0x1547b1[_0x23c2('0x2e')],_0x1547b1[_0x23c2('0x2f')]);_0x3342d5[_0x23c2('0x32')]=_[_0x23c2('0x31')](_0x1547b1[_0x23c2('0x2e')],qs['fields'](_0x5fe7e6[_0x23c2('0x2f')][_0x23c2('0x33')]));_0x3342d5[_0x23c2('0x32')]=_0x3342d5[_0x23c2('0x32')]['length']?_0x3342d5['attributes']:_0x1547b1[_0x23c2('0x2e')];if(_0x5fe7e6[_0x23c2('0x2f')][_0x23c2('0x3e')]){_0x3342d5[_0x23c2('0x3f')]=[{'all':!![]}];}_0x3342d5=_[_0x23c2('0x3b')]({},_0x3342d5,_0x5fe7e6[_0x23c2('0x3d')]);return db[_0x23c2('0x2a')]['find'](_0x3342d5)[_0x23c2('0x23')](handleEntityNotFound(_0x3b8cfd,null))[_0x23c2('0x23')](respondWithResult(_0x3b8cfd,null))['catch'](handleError(_0x3b8cfd,null));};exports['create']=function(_0x3a54e8,_0x5e9f9c){return db[_0x23c2('0x2a')][_0x23c2('0x45')](_0x3a54e8[_0x23c2('0x46')],{})['then'](respondWithResult(_0x5e9f9c,0xc9))[_0x23c2('0x42')](handleError(_0x5e9f9c,null));};exports['update']=function(_0x4fd38a,_0x14780d){if(_0x4fd38a['body']['id']){delete _0x4fd38a[_0x23c2('0x46')]['id'];}return db[_0x23c2('0x2a')]['find']({'where':{'id':_0x4fd38a[_0x23c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x14780d,null))[_0x23c2('0x23')](saveUpdates(_0x4fd38a[_0x23c2('0x46')],null))['then'](respondWithResult(_0x14780d,null))[_0x23c2('0x42')](handleError(_0x14780d,null));};exports[_0x23c2('0x24')]=function(_0x139014,_0x581c08){return db[_0x23c2('0x2a')]['find']({'where':{'id':_0x139014[_0x23c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x581c08,null))[_0x23c2('0x23')](removeEntity(_0x581c08,null))[_0x23c2('0x42')](handleError(_0x581c08,null));};exports[_0x23c2('0x47')]=function(_0x56c274,_0x441d54,_0x18791e){return db[_0x23c2('0x48')][_0x23c2('0x49')]({'where':{'id':_0x56c274['params']['id']}})[_0x23c2('0x23')](handleEntityNotFound(_0x441d54,null))[_0x23c2('0x23')](function(_0xb9159){if(_0xb9159){return _0xb9159[_0x23c2('0x47')](_0x56c274[_0x23c2('0x46')][_0x23c2('0x4a')],_['omit'](_0x56c274[_0x23c2('0x46')],[_0x23c2('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x441d54,null))[_0x23c2('0x42')](handleError(_0x441d54,null));};exports[_0x23c2('0x4b')]=function(_0x28304f,_0x23e4d,_0x25345a){var _0x4431c2={};var _0x22d6ea={};var _0x103abd;var _0x25532f;return db[_0x23c2('0x2a')][_0x23c2('0x4c')]({'where':{'id':_0x28304f['params']['id']}})['then'](handleEntityNotFound(_0x23e4d,null))[_0x23c2('0x23')](function(_0x4cb56b){if(_0x4cb56b){_0x103abd=_0x4cb56b;_0x22d6ea[_0x23c2('0x2e')]=_[_0x23c2('0x30')](db[_0x23c2('0x48')][_0x23c2('0x44')]);_0x22d6ea['query']=_[_0x23c2('0x30')](_0x28304f[_0x23c2('0x2f')]);_0x22d6ea[_0x23c2('0x39')]=_[_0x23c2('0x31')](_0x22d6ea['model'],_0x22d6ea['query']);_0x4431c2[_0x23c2('0x32')]=_['intersection'](_0x22d6ea[_0x23c2('0x2e')],qs[_0x23c2('0x33')](_0x28304f[_0x23c2('0x2f')][_0x23c2('0x33')]));_0x4431c2[_0x23c2('0x32')]=_0x4431c2['attributes'][_0x23c2('0x34')]?_0x4431c2[_0x23c2('0x32')]:_0x22d6ea[_0x23c2('0x2e')];_0x4431c2[_0x23c2('0x4d')]=qs[_0x23c2('0x36')](_0x28304f[_0x23c2('0x2f')][_0x23c2('0x36')]);_0x4431c2[_0x23c2('0x37')]=qs['filters'](_[_0x23c2('0x38')](_0x28304f[_0x23c2('0x2f')],_0x22d6ea[_0x23c2('0x39')]));if(_0x28304f[_0x23c2('0x2f')][_0x23c2('0x3a')]){_0x4431c2[_0x23c2('0x37')]=_['merge'](_0x4431c2[_0x23c2('0x37')],{'$or':_['map'](_0x4431c2['attributes'],function(_0x52a5cc){var _0x342969={};_0x342969[_0x52a5cc]={'$like':'%'+_0x28304f[_0x23c2('0x2f')][_0x23c2('0x3a')]+'%'};return _0x342969;})});}_0x4431c2=_[_0x23c2('0x3b')]({},_0x4431c2,_0x28304f[_0x23c2('0x3d')]);return _0x103abd[_0x23c2('0x4b')](_0x4431c2);}})[_0x23c2('0x23')](function(_0x3c5011){if(_0x3c5011){_0x25532f=_0x3c5011[_0x23c2('0x34')];if(!_0x28304f[_0x23c2('0x2f')][_0x23c2('0x35')](_0x23c2('0x4e'))){_0x4431c2[_0x23c2('0x1c')]=qs[_0x23c2('0x1c')](_0x28304f[_0x23c2('0x2f')]['limit']);_0x4431c2['offset']=qs[_0x23c2('0x1e')](_0x28304f[_0x23c2('0x2f')]['offset']);}return _0x103abd['getConditions'](_0x4431c2);}})[_0x23c2('0x23')](function(_0x429fd7){if(_0x429fd7){return _0x429fd7?{'count':_0x25532f,'rows':_0x429fd7}:null;}})[_0x23c2('0x23')](respondWithResult(_0x23e4d,null))[_0x23c2('0x42')](handleError(_0x23e4d,null));};exports[_0x23c2('0x4f')]=function(_0x48e816,_0x3fba6b,_0x201603){return db[_0x23c2('0x50')][_0x23c2('0x49')]({'where':{'id':_0x48e816['params']['id']}})[_0x23c2('0x23')](handleEntityNotFound(_0x3fba6b,null))[_0x23c2('0x23')](function(_0x441e6c){if(_0x441e6c){return _0x441e6c['addActions'](_0x48e816[_0x23c2('0x46')][_0x23c2('0x4a')],_[_0x23c2('0x51')](_0x48e816['body'],[_0x23c2('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x3fba6b,null))['catch'](handleError(_0x3fba6b,null));};exports[_0x23c2('0x52')]=function(_0x5ecf36,_0x36f440,_0x3c9a58){var _0x1b0bfc={};var _0x2a7ef0={};var _0x200239;var _0x288f2b;return db['Automation'][_0x23c2('0x4c')]({'where':{'id':_0x5ecf36[_0x23c2('0x43')]['id']}})[_0x23c2('0x23')](handleEntityNotFound(_0x36f440,null))[_0x23c2('0x23')](function(_0x12b177){if(_0x12b177){_0x200239=_0x12b177;_0x2a7ef0[_0x23c2('0x2e')]=_[_0x23c2('0x30')](db[_0x23c2('0x50')][_0x23c2('0x44')]);_0x2a7ef0[_0x23c2('0x2f')]=_[_0x23c2('0x30')](_0x5ecf36['query']);_0x2a7ef0[_0x23c2('0x39')]=_[_0x23c2('0x31')](_0x2a7ef0['model'],_0x2a7ef0[_0x23c2('0x2f')]);_0x1b0bfc[_0x23c2('0x32')]=_[_0x23c2('0x31')](_0x2a7ef0['model'],qs[_0x23c2('0x33')](_0x5ecf36[_0x23c2('0x2f')][_0x23c2('0x33')]));_0x1b0bfc['attributes']=_0x1b0bfc['attributes'][_0x23c2('0x34')]?_0x1b0bfc[_0x23c2('0x32')]:_0x2a7ef0['model'];_0x1b0bfc[_0x23c2('0x4d')]=qs[_0x23c2('0x36')](_0x5ecf36[_0x23c2('0x2f')]['sort']);_0x1b0bfc[_0x23c2('0x37')]=qs[_0x23c2('0x39')](_['pick'](_0x5ecf36['query'],_0x2a7ef0['filters']));if(_0x5ecf36['query'][_0x23c2('0x3a')]){_0x1b0bfc[_0x23c2('0x37')]=_['merge'](_0x1b0bfc[_0x23c2('0x37')],{'$or':_['map'](_0x1b0bfc[_0x23c2('0x32')],function(_0x24bb5d){var _0x32aad6={};_0x32aad6[_0x24bb5d]={'$like':'%'+_0x5ecf36['query'][_0x23c2('0x3a')]+'%'};return _0x32aad6;})});}_0x1b0bfc=_[_0x23c2('0x3b')]({},_0x1b0bfc,_0x5ecf36[_0x23c2('0x3d')]);return _0x200239[_0x23c2('0x52')](_0x1b0bfc);}})[_0x23c2('0x23')](function(_0x3f6bb9){if(_0x3f6bb9){_0x288f2b=_0x3f6bb9[_0x23c2('0x34')];if(!_0x5ecf36['query'][_0x23c2('0x35')]('nolimit')){_0x1b0bfc[_0x23c2('0x1c')]=qs[_0x23c2('0x1c')](_0x5ecf36[_0x23c2('0x2f')][_0x23c2('0x1c')]);_0x1b0bfc['offset']=qs[_0x23c2('0x1e')](_0x5ecf36[_0x23c2('0x2f')][_0x23c2('0x1e')]);}return _0x200239[_0x23c2('0x52')](_0x1b0bfc);}})[_0x23c2('0x23')](function(_0x319c57){if(_0x319c57){return _0x319c57?{'count':_0x288f2b,'rows':_0x319c57}:null;}})[_0x23c2('0x23')](respondWithResult(_0x36f440,null))['catch'](handleError(_0x36f440,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8fc7c91..5600be0 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 _0xf365=['exports','define','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x1973f7,_0xf09bda){var _0x3f490e=function(_0x16fbc2){while(--_0x16fbc2){_0x1973f7['push'](_0x1973f7['shift']());}};_0x3f490e(++_0xf09bda);}(_0xf365,0x145));var _0x5f36=function(_0x6a2228,_0x4a1d8b){_0x6a2228=_0x6a2228-0x0;var _0x2d7c81=_0xf365[_0x6a2228];return _0x2d7c81;};'use strict';var _=require(_0x5f36('0x0'));var util=require(_0x5f36('0x1'));var logger=require(_0x5f36('0x2'))(_0x5f36('0x3'));var moment=require(_0x5f36('0x4'));var BPromise=require(_0x5f36('0x5'));var rp=require(_0x5f36('0x6'));var fs=require('fs');var path=require(_0x5f36('0x7'));var rimraf=require(_0x5f36('0x8'));var config=require(_0x5f36('0x9'));var attributes=require(_0x5f36('0xa'));module[_0x5f36('0xb')]=function(_0x199479,_0x26ae99){return _0x199479[_0x5f36('0xc')]('Automation',attributes,{'tableName':_0x5f36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa25a=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x916634,_0x9494db){var _0x3b381c=function(_0x594310){while(--_0x594310){_0x916634['push'](_0x916634['shift']());}};_0x3b381c(++_0x9494db);}(_0xa25a,0x114));var _0xaa25=function(_0x331926,_0x5b2f83){_0x331926=_0x331926-0x0;var _0x426fef=_0xa25a[_0x331926];return _0x426fef;};'use strict';var _=require('lodash');var util=require(_0xaa25('0x0'));var logger=require(_0xaa25('0x1'))(_0xaa25('0x2'));var moment=require(_0xaa25('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa25('0x5'));var config=require(_0xaa25('0x6'));var attributes=require(_0xaa25('0x7'));module[_0xaa25('0x8')]=function(_0x3566c2,_0x571198){return _0x3566c2[_0xaa25('0x9')](_0xaa25('0xa'),attributes,{'tableName':_0xaa25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 82b1a07..4a8e050 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 _0x8212=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x271e26,_0xeaa798){var _0x4c3771=function(_0x594c71){while(--_0x594c71){_0x271e26['push'](_0x271e26['shift']());}};_0x4c3771(++_0xeaa798);}(_0x8212,0xb3));var _0x2821=function(_0x5421ea,_0x10c8e0){_0x5421ea=_0x5421ea-0x0;var _0x4260db=_0x8212[_0x5421ea];return _0x4260db;};'use strict';var _=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var moment=require('moment');var BPromise=require(_0x2821('0x2'));var rs=require(_0x2821('0x3'));var fs=require('fs');var Redis=require(_0x2821('0x4'));var db=require(_0x2821('0x5'))['db'];var utils=require(_0x2821('0x6'));var logger=require(_0x2821('0x7'))(_0x2821('0x8'));var config=require(_0x2821('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2821('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x376c57,_0x1dc078,_0x4ea6d5){return new BPromise(function(_0x3644aa,_0x201069){return client[_0x2821('0xb')](_0x376c57,_0x4ea6d5)[_0x2821('0xc')](function(_0x16003f){logger[_0x2821('0xd')](_0x2821('0xe'),_0x1dc078,_0x2821('0xf'));logger[_0x2821('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x1dc078,_0x2821('0xf'),JSON[_0x2821('0x11')](_0x16003f));if(_0x16003f[_0x2821('0x12')]){if(_0x16003f['error']['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x1dc078,_0x16003f[_0x2821('0x12')][_0x2821('0x13')]);return _0x201069(_0x16003f[_0x2821('0x12')][_0x2821('0x13')]);}logger[_0x2821('0x12')](_0x2821('0xe'),_0x1dc078,_0x16003f['error'][_0x2821('0x13')]);return _0x3644aa(_0x16003f['error']['message']);}else{logger[_0x2821('0xd')](_0x2821('0xe'),_0x1dc078,_0x2821('0xf'));_0x3644aa(_0x16003f[_0x2821('0x14')]['message']);}})[_0x2821('0x15')](function(_0x5c2aa7){logger[_0x2821('0x12')](_0x2821('0xe'),_0x1dc078,_0x5c2aa7);_0x201069(_0x5c2aa7);});});} \ No newline at end of file +var _0x110f=['result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x110f,0x1e6));var _0xf110=function(_0x4238ba,_0x50c846){_0x4238ba=_0x4238ba-0x0;var _0x1fffa1=_0x110f[_0x4238ba];return _0x1fffa1;};'use strict';var _=require(_0xf110('0x0'));var util=require(_0xf110('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf110('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf110('0x3'));var logger=require(_0xf110('0x4'))(_0xf110('0x5'));var config=require('../../config/environment');var jayson=require(_0xf110('0x6'));var client=jayson[_0xf110('0x7')][_0xf110('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dcb19,_0x1a1a3b,_0xadc2a3){return new BPromise(function(_0x194a16,_0x57593b){return client[_0xf110('0x9')](_0x4dcb19,_0xadc2a3)[_0xf110('0xa')](function(_0x11c28f){logger['info'](_0xf110('0xb'),_0x1a1a3b,_0xf110('0xc'));logger[_0xf110('0xd')](_0xf110('0xe'),_0x1a1a3b,'request\x20sent',JSON[_0xf110('0xf')](_0x11c28f));if(_0x11c28f[_0xf110('0x10')]){if(_0x11c28f['error'][_0xf110('0x11')]===0x1f4){logger[_0xf110('0x10')](_0xf110('0xb'),_0x1a1a3b,_0x11c28f[_0xf110('0x10')]['message']);return _0x57593b(_0x11c28f[_0xf110('0x10')][_0xf110('0x12')]);}logger[_0xf110('0x10')]('Automation,\x20%s,\x20%s',_0x1a1a3b,_0x11c28f[_0xf110('0x10')][_0xf110('0x12')]);return _0x194a16(_0x11c28f['error'][_0xf110('0x12')]);}else{logger[_0xf110('0x13')](_0xf110('0xb'),_0x1a1a3b,_0xf110('0xc'));_0x194a16(_0x11c28f[_0xf110('0x14')][_0xf110('0x12')]);}})[_0xf110('0x15')](function(_0x44ba58){logger[_0xf110('0x10')]('Automation,\x20%s,\x20%s',_0x1a1a3b,_0x44ba58);_0x57593b(_0x44ba58);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 68c8c82..cf255eb 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 _0xe096=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','getActions','create','/:id/actions','addActions','/:id','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xe096,0x13c));var _0x6e09=function(_0xdd2348,_0x5d3232){_0xdd2348=_0xdd2348-0x0;var _0x2e0a02=_0xe096[_0xdd2348];return _0x2e0a02;};'use strict';var multer=require(_0x6e09('0x0'));var util=require(_0x6e09('0x1'));var path=require(_0x6e09('0x2'));var timeout=require(_0x6e09('0x3'));var express=require(_0x6e09('0x4'));var router=express[_0x6e09('0x5')]();var fs_extra=require(_0x6e09('0x6'));var auth=require(_0x6e09('0x7'));var interaction=require(_0x6e09('0x8'));var config=require(_0x6e09('0x9'));var controller=require(_0x6e09('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6e09('0xb')]('/:id',auth[_0x6e09('0xc')](),controller[_0x6e09('0xd')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0x6e09('0xb')]('/:id/actions',auth[_0x6e09('0xc')](),controller[_0x6e09('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6e09('0xf')]);router['post']('/:id/conditions',auth[_0x6e09('0xc')](),controller['addConditions']);router['post'](_0x6e09('0x10'),auth[_0x6e09('0xc')](),controller[_0x6e09('0x11')]);router['put'](_0x6e09('0x12'),auth[_0x6e09('0xc')](),controller['update']);router['delete'](_0x6e09('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd5b2=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','/:id/conditions','isAuthenticated','getConditions','get','/:id/actions','getActions','post','create','addConditions','addActions','put','update','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xd5b2[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require('multer');var util=require(_0x2d5b('0x0'));var path=require(_0x2d5b('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d5b('0x2'));var router=express[_0x2d5b('0x3')]();var fs_extra=require(_0x2d5b('0x4'));var auth=require(_0x2d5b('0x5'));var interaction=require(_0x2d5b('0x6'));var config=require(_0x2d5b('0x7'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2d5b('0x8')]);router['get'](_0x2d5b('0x9'),auth['isAuthenticated'](),controller[_0x2d5b('0xa')]);router['get'](_0x2d5b('0xb'),auth[_0x2d5b('0xc')](),controller[_0x2d5b('0xd')]);router[_0x2d5b('0xe')](_0x2d5b('0xf'),auth[_0x2d5b('0xc')](),controller[_0x2d5b('0x10')]);router[_0x2d5b('0x11')]('/',auth[_0x2d5b('0xc')](),controller[_0x2d5b('0x12')]);router[_0x2d5b('0x11')](_0x2d5b('0xb'),auth[_0x2d5b('0xc')](),controller[_0x2d5b('0x13')]);router['post']('/:id/actions',auth[_0x2d5b('0xc')](),controller[_0x2d5b('0x14')]);router[_0x2d5b('0x15')](_0x2d5b('0x9'),auth[_0x2d5b('0xc')](),controller[_0x2d5b('0x16')]);router['delete'](_0x2d5b('0x9'),auth['isAuthenticated'](),controller[_0x2d5b('0x17')]);module[_0x2d5b('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f614277..de10a4f 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 _0x9045=['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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\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','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED'];(function(_0x275ae6,_0x51d1cb){var _0x4e6bd3=function(_0x507fea){while(--_0x507fea){_0x275ae6['push'](_0x275ae6['shift']());}};_0x4e6bd3(++_0x51d1cb);}(_0x9045,0x83));var _0x5904=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x9045[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0x5904('0x0'));module['exports']={'name':{'type':Sequelize[_0x5904('0x1')],'unique':_0x5904('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5904('0x3')](_0x5904('0x4')),'allowNull':![],'defaultValue':_0x5904('0x4')},'description':{'type':Sequelize[_0x5904('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5904('0x5')},'limitCalls':{'type':Sequelize[_0x5904('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5904('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5904('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5904('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5904('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5904('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5904('0x6')](0x3)[_0x5904('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5904('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5904('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5904('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5904('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5904('0x6')](0x5)[_0x5904('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5904('0x6')](0x3)[_0x5904('0x8')],'defaultValue':0x3,'comment':_0x5904('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5904('0x6')](0x5)[_0x5904('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5904('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5904('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5904('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5904('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5904('0xf'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5904('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x5904('0x6')](0x9)[_0x5904('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x5904('0x6')](0x9)[_0x5904('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5904('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5904('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5904('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5904('0x6')](0x9)[_0x5904('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5904('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5904('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5904('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5904('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5904('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x5904('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5904('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5904('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5904('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5904('0x6')](0x9)[_0x5904('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5904('0x3')](_0x5904('0x18'),_0x5904('0x19')),'defaultValue':_0x5904('0x18')},'dialPrefix':{'type':Sequelize[_0x5904('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5904('0x6')](0x3)[_0x5904('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5904('0x1a')},'dialCutDigit':{'type':Sequelize[_0x5904('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5904('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5904('0x6')](0x3)[_0x5904('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5904('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5904('0x6')](0x5)[_0x5904('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5904('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5904('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5904('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5904('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5904('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5904('0x6')](0x5)[_0x5904('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5904('0x6')](0x3)[_0x5904('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5904('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5904('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5904('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5904('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5904('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5904('0x6')](0x5)[_0x5904('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5904('0x22')}}; \ No newline at end of file +var _0x0b79=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x268202,_0x4ff2ff){var _0x1847aa=function(_0x23ac03){while(--_0x23ac03){_0x268202['push'](_0x268202['shift']());}};_0x1847aa(++_0x4ff2ff);}(_0x0b79,0x9a));var _0x90b7=function(_0x3892e1,_0x3f2266){_0x3892e1=_0x3892e1-0x0;var _0x4264e5=_0x0b79[_0x3892e1];return _0x4264e5;};'use strict';var Sequelize=require('sequelize');module[_0x90b7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x90b7('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x90b7('0x2')](_0x90b7('0x3')),'allowNull':![],'defaultValue':_0x90b7('0x3')},'description':{'type':Sequelize[_0x90b7('0x4')]},'active':{'type':Sequelize[_0x90b7('0x5')],'defaultValue':0x0,'comment':_0x90b7('0x6')},'limitCalls':{'type':Sequelize[_0x90b7('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x90b7('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x90b7('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x90b7('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x90b7('0x7')](0x3)[_0x90b7('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b7('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x90b7('0x7')](0x3)[_0x90b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b7('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b7('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b7('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x90b7('0x7')](0x5)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x90b7('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x90b7('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b7('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x90b7('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x90b7('0x4')],'defaultValue':_0x90b7('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x90b7('0x2')]('always',_0x90b7('0x11'),'onlyIfOpen'),'defaultValue':_0x90b7('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x90b7('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x90b7('0x7')](0x9)[_0x90b7('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x90b7('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x90b7('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x90b7('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x90b7('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x90b7('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x90b7('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x90b7('0x7')](0x9)[_0x90b7('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x90b7('0x7')](0x9)[_0x90b7('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x90b7('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x90b7('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x90b7('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x90b7('0x7')](0x9)[_0x90b7('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x90b7('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x90b7('0x2')](_0x90b7('0x1c'),_0x90b7('0x1d')),'defaultValue':_0x90b7('0x1c')},'dialPrefix':{'type':Sequelize[_0x90b7('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x90b7('0x7')](0x3)[_0x90b7('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x90b7('0x1e')},'dialCutDigit':{'type':Sequelize[_0x90b7('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x90b7('0x7')](0x3)[_0x90b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b7('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x90b7('0x7')](0x5)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x90b7('0x7')](0x5)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b7('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x90b7('0x7')](0x3)[_0x90b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b7('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b7('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x90b7('0x7')](0x3)[_0x90b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b7('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x90b7('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x90b7('0x7')](0x5)[_0x90b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e6751ac..6606dc0 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 _0xae3c=['nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','Campaign','includeAll','catch','show','params','rawAttributes','include','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','error','update','getHoppers','findOne','CmHopper','hasOwnProperty','order','CampaignId','rows','getHopperHistories','CmHopperHistory','findAll','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','phone','field','NOW()','scheduledAt','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','deletedAt\x20IS\x20NULL','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','get','IvrCampaigns','UserProfileResource','then','sendStatus','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xae3c,0x159));var _0xcae3=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0xae3c[_0x3cb30b];return _0x2ca717;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcae3('0x0'));var jsonpatch=require(_0xcae3('0x1'));var rp=require('request-promise');var moment=require(_0xcae3('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcae3('0x3'));var path=require(_0xcae3('0x4'));var sox=require('sox');var csv=require(_0xcae3('0x5'));var ejs=require(_0xcae3('0x6'));var fs=require('fs');var fs_extra=require(_0xcae3('0x7'));var _=require(_0xcae3('0x8'));var squel=require(_0xcae3('0x9'));var crypto=require('crypto');var jsforce=require(_0xcae3('0xa'));var deskjs=require(_0xcae3('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcae3('0xc'));var Redis=require('ioredis');var authService=require(_0xcae3('0xd'));var qs=require(_0xcae3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcae3('0xf'));var logger=require(_0xcae3('0x10'))(_0xcae3('0x11'));var utils=require(_0xcae3('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcae3('0x13'));var db=require(_0xcae3('0x14'))['db'];function respondWithStatusCode(_0x1b08b4,_0x5cef5d){_0x5cef5d=_0x5cef5d||0xcc;return function(_0x17ffa4){if(_0x17ffa4){return _0x1b08b4['sendStatus'](_0x5cef5d);}return _0x1b08b4['status'](_0x5cef5d)[_0xcae3('0x15')]();};}function respondWithResult(_0x270097,_0x234e9d){_0x234e9d=_0x234e9d||0xc8;return function(_0x43ee66){if(_0x43ee66){return _0x270097[_0xcae3('0x16')](_0x234e9d)[_0xcae3('0x17')](_0x43ee66);}};}function respondWithFilteredResult(_0x1d297a,_0x3d9e68){return function(_0x154a9d){if(_0x154a9d){var _0x3da154=typeof _0x3d9e68[_0xcae3('0x18')]===_0xcae3('0x19')&&typeof _0x3d9e68['limit']==='undefined';var _0x348bfc=_0x154a9d[_0xcae3('0x1a')];var _0x42e9ff=_0x3da154?0x0:_0x3d9e68['offset'];var _0x4e12a6=_0x3da154?_0x154a9d[_0xcae3('0x1a')]:_0x3d9e68[_0xcae3('0x18')]+_0x3d9e68[_0xcae3('0x1b')];var _0x5771d9;if(_0x4e12a6>=_0x348bfc){_0x4e12a6=_0x348bfc;_0x5771d9=0xc8;}else{_0x5771d9=0xce;}_0x1d297a[_0xcae3('0x16')](_0x5771d9);return _0x1d297a[_0xcae3('0x1c')](_0xcae3('0x1d'),_0x42e9ff+'-'+_0x4e12a6+'/'+_0x348bfc)['json'](_0x154a9d);}return null;};}function patchUpdates(_0xbc9478){return function(_0x62bbdd){try{jsonpatch[_0xcae3('0x1e')](_0x62bbdd,_0xbc9478,!![]);}catch(_0x419ab0){return BPromise[_0xcae3('0x1f')](_0x419ab0);}return _0x62bbdd[_0xcae3('0x20')]();};}function saveUpdates(_0x39b93f,_0x554189){return function(_0xeae52b){if(_0xeae52b){return _0xeae52b['update'](_0x39b93f)['then'](function(_0x149d02){return _0x149d02;});}return null;};}function removeEntity(_0x3feb7e,_0x3b01f5){return function(_0x4ab0d4){if(_0x4ab0d4){return _0x4ab0d4[_0xcae3('0x21')]()['then'](function(){var _0x556144=_0x4ab0d4[_0xcae3('0x22')]({'plain':!![]});var _0x1fd4e5=_0xcae3('0x23');return db[_0xcae3('0x24')][_0xcae3('0x21')]({'where':{'type':_0x1fd4e5,'resourceId':_0x556144['id']}})[_0xcae3('0x25')](function(){return _0x4ab0d4;});})[_0xcae3('0x25')](function(){_0x3feb7e[_0xcae3('0x16')](0xcc)[_0xcae3('0x15')]();});}};}function handleEntityNotFound(_0x329e53,_0x477949){return function(_0x1ab203){if(!_0x1ab203){_0x329e53[_0xcae3('0x26')](0x194);}return _0x1ab203;};}function handleError(_0x151a71,_0x1b56cc){_0x1b56cc=_0x1b56cc||0x1f4;return function(_0x490285){logger['error'](_0x490285[_0xcae3('0x27')]);if(_0x490285[_0xcae3('0x28')]){delete _0x490285[_0xcae3('0x28')];}_0x151a71['status'](_0x1b56cc)[_0xcae3('0x29')](_0x490285);};}exports[_0xcae3('0x2a')]=function(_0x104407,_0x4c5015){var _0x287b71={},_0x40d4a6={},_0x550125={'count':0x0,'rows':[]};var _0x863c3d=_[_0xcae3('0x2b')](db['Campaign']['rawAttributes'],function(_0xc12a57){return{'name':_0xc12a57[_0xcae3('0x2c')],'type':_0xc12a57['type'][_0xcae3('0x2d')]};});_0x40d4a6['model']=_[_0xcae3('0x2b')](_0x863c3d,_0xcae3('0x28'));_0x40d4a6[_0xcae3('0x2e')]=_[_0xcae3('0x2f')](_0x104407['query']);_0x40d4a6[_0xcae3('0x30')]=_[_0xcae3('0x31')](_0x40d4a6[_0xcae3('0x32')],_0x40d4a6[_0xcae3('0x2e')]);_0x287b71[_0xcae3('0x33')]=_['intersection'](_0x40d4a6[_0xcae3('0x32')],qs[_0xcae3('0x34')](_0x104407[_0xcae3('0x2e')][_0xcae3('0x34')]));_0x287b71[_0xcae3('0x33')]=_0x287b71[_0xcae3('0x33')][_0xcae3('0x35')]?_0x287b71[_0xcae3('0x33')]:_0x40d4a6[_0xcae3('0x32')];if(!_0x104407[_0xcae3('0x2e')]['hasOwnProperty'](_0xcae3('0x36'))){_0x287b71[_0xcae3('0x1b')]=qs['limit'](_0x104407[_0xcae3('0x2e')][_0xcae3('0x1b')]);_0x287b71[_0xcae3('0x18')]=qs[_0xcae3('0x18')](_0x104407[_0xcae3('0x2e')]['offset']);}_0x287b71['order']=qs[_0xcae3('0x37')](_0x104407[_0xcae3('0x2e')][_0xcae3('0x37')]);_0x287b71[_0xcae3('0x38')]=qs[_0xcae3('0x30')](_[_0xcae3('0x39')](_0x104407[_0xcae3('0x2e')],_0x40d4a6['filters']),_0x863c3d);if(_0x104407['query'][_0xcae3('0x3a')]){_0x287b71[_0xcae3('0x38')]=_[_0xcae3('0x3b')](_0x287b71[_0xcae3('0x38')],{'$or':_[_0xcae3('0x2b')](_0x863c3d,function(_0x260677){if(_0x260677[_0xcae3('0x3c')]!==_0xcae3('0x3d')){var _0x2734a3={};_0x2734a3[_0x260677[_0xcae3('0x28')]]={'$like':'%'+_0x104407[_0xcae3('0x2e')][_0xcae3('0x3a')]+'%'};return _0x2734a3;}})});}_0x287b71=_[_0xcae3('0x3b')]({},_0x287b71,_0x104407[_0xcae3('0x3e')]);var _0x238ce7={'where':_0x287b71[_0xcae3('0x38')]};return db[_0xcae3('0x3f')][_0xcae3('0x1a')](_0x238ce7)['then'](function(_0x1a51eb){_0x550125[_0xcae3('0x1a')]=_0x1a51eb;if(_0x104407[_0xcae3('0x2e')][_0xcae3('0x40')]){_0x287b71['include']=[{'all':!![]}];}return db[_0xcae3('0x3f')]['findAll'](_0x287b71);})[_0xcae3('0x25')](function(_0x105e65){_0x550125['rows']=_0x105e65;return _0x550125;})['then'](respondWithFilteredResult(_0x4c5015,_0x287b71))[_0xcae3('0x41')](handleError(_0x4c5015,null));};exports[_0xcae3('0x42')]=function(_0x3ef968,_0x41a882){var _0x25576b={'raw':![],'where':{'id':_0x3ef968[_0xcae3('0x43')]['id']}},_0x2f6525={};_0x2f6525[_0xcae3('0x32')]=_[_0xcae3('0x2f')](db[_0xcae3('0x3f')][_0xcae3('0x44')]);_0x2f6525['query']=_['keys'](_0x3ef968['query']);_0x2f6525[_0xcae3('0x30')]=_['intersection'](_0x2f6525['model'],_0x2f6525['query']);_0x25576b[_0xcae3('0x33')]=_['intersection'](_0x2f6525[_0xcae3('0x32')],qs['fields'](_0x3ef968[_0xcae3('0x2e')][_0xcae3('0x34')]));_0x25576b['attributes']=_0x25576b[_0xcae3('0x33')][_0xcae3('0x35')]?_0x25576b['attributes']:_0x2f6525[_0xcae3('0x32')];if(_0x3ef968[_0xcae3('0x2e')][_0xcae3('0x40')]){_0x25576b[_0xcae3('0x45')]=[{'all':!![]}];}_0x25576b=_[_0xcae3('0x3b')]({},_0x25576b,_0x3ef968[_0xcae3('0x3e')]);return db[_0xcae3('0x3f')][_0xcae3('0x46')](_0x25576b)[_0xcae3('0x25')](handleEntityNotFound(_0x41a882,null))['then'](respondWithResult(_0x41a882,null))['catch'](handleError(_0x41a882,null));};exports[_0xcae3('0x47')]=function(_0x36e8a8,_0x65b9d){return db[_0xcae3('0x3f')][_0xcae3('0x47')](_0x36e8a8[_0xcae3('0x48')],{})[_0xcae3('0x25')](function(_0x2f8614){var _0x51b33e=_0x36e8a8[_0xcae3('0x49')]['get']({'plain':!![]});if(!_0x51b33e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51b33e[_0xcae3('0x4a')]==='user'){var _0x26ba1f=_0x2f8614[_0xcae3('0x22')]({'plain':!![]});var _0x3706f1=_0xcae3('0x23');return db['UserProfileSection'][_0xcae3('0x46')]({'where':{'name':_0x3706f1,'userProfileId':_0x51b33e[_0xcae3('0x4b')]},'raw':!![]})[_0xcae3('0x25')](function(_0x284ae8){if(_0x284ae8&&_0x284ae8[_0xcae3('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x26ba1f['name'],'resourceId':_0x26ba1f['id'],'type':_0x284ae8[_0xcae3('0x28')],'sectionId':_0x284ae8['id']},{})['then'](function(){return _0x2f8614;});}else{return _0x2f8614;}})[_0xcae3('0x41')](function(_0x376cae){logger['error'](_0xcae3('0x4d'),_0x376cae);throw _0x376cae;});}return _0x2f8614;})[_0xcae3('0x25')](respondWithResult(_0x65b9d,0xc9))[_0xcae3('0x41')](handleError(_0x65b9d,null));};exports[_0xcae3('0x4e')]=function(_0x5aa8b2,_0x38938a){var _0xbd8393={'where':{'id':_0x5aa8b2[_0xcae3('0x43')]['id']}},_0x5c02c2={};_0x5c02c2[_0xcae3('0x32')]=_[_0xcae3('0x2f')](db[_0xcae3('0x3f')][_0xcae3('0x44')]);_0xbd8393['attributes']=_[_0xcae3('0x31')](_0x5c02c2[_0xcae3('0x32')],qs[_0xcae3('0x34')](_0x5aa8b2[_0xcae3('0x2e')][_0xcae3('0x34')]));_0xbd8393[_0xcae3('0x33')]=_0xbd8393['attributes'][_0xcae3('0x35')]?_0xbd8393[_0xcae3('0x33')]:_0x5c02c2[_0xcae3('0x32')];if(_0x5aa8b2['query'][_0xcae3('0x40')]){_0xbd8393['include']=[{'all':!![]}];}_0xbd8393=_[_0xcae3('0x3b')]({},_0xbd8393,_0x5aa8b2[_0xcae3('0x3e')]);return db[_0xcae3('0x3f')][_0xcae3('0x46')](_0xbd8393)[_0xcae3('0x25')](handleEntityNotFound(_0x38938a,null))[_0xcae3('0x25')](function(_0x4255ba){if(_0x4255ba){var _0x13cf76=_0x4255ba['get']({'plain':!![]});_0x13cf76=qs[_0xcae3('0x4f')](_0x13cf76,['id',_0xcae3('0x50'),_0xcae3('0x51')]);_0x5aa8b2['body']=_[_0xcae3('0x4f')](_0x5aa8b2['body'],['id',_0xcae3('0x50'),_0xcae3('0x51')]);return db['Campaign']['create'](_[_0xcae3('0x3b')](_0x13cf76,_0x5aa8b2[_0xcae3('0x48')]),{'include':_0x5aa8b2[_0xcae3('0x2e')][_0xcae3('0x40')]?[{'all':!![]}]:undefined})[_0xcae3('0x25')](function(_0x30367e){var _0x366649=_0x5aa8b2[_0xcae3('0x49')][_0xcae3('0x22')]({'plain':!![]});if(!_0x366649)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x366649['role']===_0xcae3('0x49')){var _0x34c14a=_0x30367e['get']({'plain':!![]});var _0xca64a='IvrCampaigns';return db['UserProfileSection'][_0xcae3('0x46')]({'where':{'name':_0xca64a,'userProfileId':_0x366649['userProfileId']},'raw':!![]})['then'](function(_0x4013d0){if(_0x4013d0&&_0x4013d0['autoAssociation']===0x0){return db['UserProfileResource'][_0xcae3('0x47')]({'name':_0x34c14a[_0xcae3('0x28')],'resourceId':_0x34c14a['id'],'type':_0x4013d0[_0xcae3('0x28')],'sectionId':_0x4013d0['id']},{})[_0xcae3('0x25')](function(){return _0x30367e;});}else{return _0x30367e;}})[_0xcae3('0x41')](function(_0xf1b8c){logger[_0xcae3('0x52')](_0xcae3('0x4d'),_0xf1b8c);throw _0xf1b8c;});}return _0x30367e;});}})[_0xcae3('0x25')](respondWithResult(_0x38938a,0xc9))[_0xcae3('0x41')](handleError(_0x38938a,null));};exports[_0xcae3('0x53')]=function(_0x43d55d,_0x37f983){if(_0x43d55d['body']['id']){delete _0x43d55d['body']['id'];}return db[_0xcae3('0x3f')][_0xcae3('0x46')]({'where':{'id':_0x43d55d[_0xcae3('0x43')]['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x37f983,null))[_0xcae3('0x25')](saveUpdates(_0x43d55d[_0xcae3('0x48')],null))[_0xcae3('0x25')](respondWithResult(_0x37f983,null))['catch'](handleError(_0x37f983,null));};exports['destroy']=function(_0x422f99,_0x1ae51c){return db[_0xcae3('0x3f')][_0xcae3('0x46')]({'where':{'id':_0x422f99[_0xcae3('0x43')]['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x1ae51c,null))[_0xcae3('0x25')](removeEntity(_0x1ae51c,null))[_0xcae3('0x41')](handleError(_0x1ae51c,null));};exports[_0xcae3('0x54')]=function(_0x4a8883,_0x555e40,_0x249175){var _0x4a74ed={'raw':!![],'where':{}};var _0x25bdae={};var _0x13f928={'count':0x0,'rows':[]};return db[_0xcae3('0x3f')][_0xcae3('0x55')]({'where':{'id':_0x4a8883['params']['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x555e40,null))[_0xcae3('0x25')](function(_0x396d9b){if(_0x396d9b){_0x25bdae[_0xcae3('0x32')]=_[_0xcae3('0x2f')](db[_0xcae3('0x56')][_0xcae3('0x44')]);_0x25bdae[_0xcae3('0x2e')]=_[_0xcae3('0x2f')](_0x4a8883[_0xcae3('0x2e')]);_0x25bdae[_0xcae3('0x30')]=_[_0xcae3('0x31')](_0x25bdae[_0xcae3('0x32')],_0x25bdae[_0xcae3('0x2e')]);_0x4a74ed[_0xcae3('0x33')]=_['intersection'](_0x25bdae[_0xcae3('0x32')],qs[_0xcae3('0x34')](_0x4a8883['query'][_0xcae3('0x34')]));_0x4a74ed[_0xcae3('0x33')]=_0x4a74ed[_0xcae3('0x33')]['length']?_0x4a74ed[_0xcae3('0x33')]:_0x25bdae[_0xcae3('0x32')];if(!_0x4a8883[_0xcae3('0x2e')][_0xcae3('0x57')](_0xcae3('0x36'))){_0x4a74ed['limit']=qs[_0xcae3('0x1b')](_0x4a8883['query'][_0xcae3('0x1b')]);_0x4a74ed[_0xcae3('0x18')]=qs[_0xcae3('0x18')](_0x4a8883[_0xcae3('0x2e')]['offset']);}_0x4a74ed[_0xcae3('0x58')]=qs[_0xcae3('0x37')](_0x4a8883[_0xcae3('0x2e')][_0xcae3('0x37')]);_0x4a74ed[_0xcae3('0x38')]=qs[_0xcae3('0x30')](_[_0xcae3('0x39')](_0x4a8883['query'],_0x25bdae[_0xcae3('0x30')]));_0x4a74ed[_0xcae3('0x38')][_0xcae3('0x59')]=_0x396d9b['id'];if(_0x4a8883[_0xcae3('0x2e')][_0xcae3('0x3a')]){_0x4a74ed['where']=_[_0xcae3('0x3b')](_0x4a74ed[_0xcae3('0x38')],{'$or':_[_0xcae3('0x2b')](_0x4a74ed['attributes'],function(_0x597146){var _0xe47197={};_0xe47197[_0x597146]={'$like':'%'+_0x4a8883[_0xcae3('0x2e')][_0xcae3('0x3a')]+'%'};return _0xe47197;})});}_0x4a74ed=_[_0xcae3('0x3b')]({},_0x4a74ed,_0x4a8883['options']);return db[_0xcae3('0x56')][_0xcae3('0x1a')]({'where':_0x4a74ed[_0xcae3('0x38')]})[_0xcae3('0x25')](function(_0x431938){_0x13f928[_0xcae3('0x1a')]=_0x431938;if(_0x4a8883[_0xcae3('0x2e')][_0xcae3('0x40')]){_0x4a74ed[_0xcae3('0x45')]=[{'all':!![]}];}return db[_0xcae3('0x56')]['findAll'](_0x4a74ed);})[_0xcae3('0x25')](function(_0x165bb6){_0x13f928[_0xcae3('0x5a')]=_0x165bb6;return _0x13f928;});}})[_0xcae3('0x25')](respondWithFilteredResult(_0x555e40,_0x4a74ed))['catch'](handleError(_0x555e40,null));};exports[_0xcae3('0x5b')]=function(_0x589150,_0x407e73,_0x3033fc){var _0x5010a6={'raw':!![],'where':{}};var _0x1302ba={};var _0x247790={'count':0x0,'rows':[]};return db[_0xcae3('0x3f')][_0xcae3('0x55')]({'where':{'id':_0x589150['params']['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x407e73,null))[_0xcae3('0x25')](function(_0x43df07){if(_0x43df07){_0x1302ba[_0xcae3('0x32')]=_[_0xcae3('0x2f')](db['CmHopperHistory'][_0xcae3('0x44')]);_0x1302ba['query']=_[_0xcae3('0x2f')](_0x589150[_0xcae3('0x2e')]);_0x1302ba[_0xcae3('0x30')]=_[_0xcae3('0x31')](_0x1302ba[_0xcae3('0x32')],_0x1302ba[_0xcae3('0x2e')]);_0x5010a6[_0xcae3('0x33')]=_[_0xcae3('0x31')](_0x1302ba['model'],qs['fields'](_0x589150[_0xcae3('0x2e')][_0xcae3('0x34')]));_0x5010a6[_0xcae3('0x33')]=_0x5010a6[_0xcae3('0x33')][_0xcae3('0x35')]?_0x5010a6['attributes']:_0x1302ba['model'];if(!_0x589150['query']['hasOwnProperty']('nolimit')){_0x5010a6[_0xcae3('0x1b')]=qs[_0xcae3('0x1b')](_0x589150['query']['limit']);_0x5010a6[_0xcae3('0x18')]=qs['offset'](_0x589150[_0xcae3('0x2e')][_0xcae3('0x18')]);}_0x5010a6[_0xcae3('0x58')]=qs['sort'](_0x589150[_0xcae3('0x2e')][_0xcae3('0x37')]);_0x5010a6[_0xcae3('0x38')]=qs[_0xcae3('0x30')](_[_0xcae3('0x39')](_0x589150[_0xcae3('0x2e')],_0x1302ba[_0xcae3('0x30')]));_0x5010a6[_0xcae3('0x38')][_0xcae3('0x59')]=_0x43df07['id'];if(_0x589150['query'][_0xcae3('0x3a')]){_0x5010a6['where']=_[_0xcae3('0x3b')](_0x5010a6['where'],{'$or':_['map'](_0x5010a6[_0xcae3('0x33')],function(_0x3782b8){var _0x136f35={};_0x136f35[_0x3782b8]={'$like':'%'+_0x589150['query']['filter']+'%'};return _0x136f35;})});}_0x5010a6=_[_0xcae3('0x3b')]({},_0x5010a6,_0x589150[_0xcae3('0x3e')]);return db[_0xcae3('0x5c')][_0xcae3('0x1a')]({'where':_0x5010a6['where']})[_0xcae3('0x25')](function(_0x5a0aaa){_0x247790[_0xcae3('0x1a')]=_0x5a0aaa;if(_0x589150['query']['includeAll']){_0x5010a6[_0xcae3('0x45')]=[{'all':!![]}];}return db[_0xcae3('0x5c')][_0xcae3('0x5d')](_0x5010a6);})['then'](function(_0x16f230){_0x247790[_0xcae3('0x5a')]=_0x16f230;return _0x247790;});}})[_0xcae3('0x25')](respondWithFilteredResult(_0x407e73,_0x5010a6))['catch'](handleError(_0x407e73,null));};exports['getHopperFinals']=function(_0x1b160e,_0x17aba4,_0x3df0c2){var _0x51a5b7={'raw':!![],'where':{}};var _0x230197={};var _0x2e8779={'count':0x0,'rows':[]};return db['Campaign'][_0xcae3('0x55')]({'where':{'id':_0x1b160e['params']['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x17aba4,null))[_0xcae3('0x25')](function(_0x29809c){if(_0x29809c){_0x230197[_0xcae3('0x32')]=_['keys'](db[_0xcae3('0x5e')][_0xcae3('0x44')]);_0x230197[_0xcae3('0x2e')]=_['keys'](_0x1b160e[_0xcae3('0x2e')]);_0x230197[_0xcae3('0x30')]=_[_0xcae3('0x31')](_0x230197[_0xcae3('0x32')],_0x230197['query']);_0x51a5b7[_0xcae3('0x33')]=_[_0xcae3('0x31')](_0x230197[_0xcae3('0x32')],qs[_0xcae3('0x34')](_0x1b160e[_0xcae3('0x2e')][_0xcae3('0x34')]));_0x51a5b7[_0xcae3('0x33')]=_0x51a5b7[_0xcae3('0x33')]['length']?_0x51a5b7[_0xcae3('0x33')]:_0x230197[_0xcae3('0x32')];if(!_0x1b160e[_0xcae3('0x2e')][_0xcae3('0x57')](_0xcae3('0x36'))){_0x51a5b7['limit']=qs[_0xcae3('0x1b')](_0x1b160e[_0xcae3('0x2e')][_0xcae3('0x1b')]);_0x51a5b7[_0xcae3('0x18')]=qs[_0xcae3('0x18')](_0x1b160e[_0xcae3('0x2e')][_0xcae3('0x18')]);}_0x51a5b7[_0xcae3('0x58')]=qs[_0xcae3('0x37')](_0x1b160e[_0xcae3('0x2e')]['sort']);_0x51a5b7[_0xcae3('0x38')]=qs[_0xcae3('0x30')](_[_0xcae3('0x39')](_0x1b160e[_0xcae3('0x2e')],_0x230197[_0xcae3('0x30')]));_0x51a5b7[_0xcae3('0x38')]['CampaignId']=_0x29809c['id'];if(_0x1b160e[_0xcae3('0x2e')][_0xcae3('0x3a')]){_0x51a5b7[_0xcae3('0x38')]=_[_0xcae3('0x3b')](_0x51a5b7['where'],{'$or':_['map'](_0x51a5b7[_0xcae3('0x33')],function(_0x329780){var _0x404537={};_0x404537[_0x329780]={'$like':'%'+_0x1b160e[_0xcae3('0x2e')][_0xcae3('0x3a')]+'%'};return _0x404537;})});}_0x51a5b7=_[_0xcae3('0x3b')]({},_0x51a5b7,_0x1b160e[_0xcae3('0x3e')]);return db['CmHopperFinal'][_0xcae3('0x1a')]({'where':_0x51a5b7[_0xcae3('0x38')]})[_0xcae3('0x25')](function(_0x4597d1){_0x2e8779[_0xcae3('0x1a')]=_0x4597d1;if(_0x1b160e[_0xcae3('0x2e')][_0xcae3('0x40')]){_0x51a5b7[_0xcae3('0x45')]=[{'all':!![]}];}return db[_0xcae3('0x5e')][_0xcae3('0x5d')](_0x51a5b7);})[_0xcae3('0x25')](function(_0x4abbd6){_0x2e8779[_0xcae3('0x5a')]=_0x4abbd6;return _0x2e8779;});}})['then'](respondWithFilteredResult(_0x17aba4,_0x51a5b7))['catch'](handleError(_0x17aba4,null));};exports[_0xcae3('0x5f')]=function(_0x2c3b93,_0x2b77dd,_0x21bfff){var _0x25805c={'raw':!![],'where':{}};var _0x4da6c7={};var _0x4858da={'count':0x0,'rows':[]};return db[_0xcae3('0x3f')][_0xcae3('0x55')]({'where':{'id':_0x2c3b93['params']['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x2b77dd,null))[_0xcae3('0x25')](function(_0x183169){if(_0x183169){_0x4da6c7[_0xcae3('0x32')]=_[_0xcae3('0x2f')](db[_0xcae3('0x60')][_0xcae3('0x44')]);_0x4da6c7['query']=_[_0xcae3('0x2f')](_0x2c3b93[_0xcae3('0x2e')]);_0x4da6c7['filters']=_[_0xcae3('0x31')](_0x4da6c7[_0xcae3('0x32')],_0x4da6c7['query']);_0x25805c['attributes']=_[_0xcae3('0x31')](_0x4da6c7[_0xcae3('0x32')],qs['fields'](_0x2c3b93[_0xcae3('0x2e')]['fields']));_0x25805c[_0xcae3('0x33')]=_0x25805c['attributes'][_0xcae3('0x35')]?_0x25805c[_0xcae3('0x33')]:_0x4da6c7['model'];if(!_0x2c3b93['query']['hasOwnProperty'](_0xcae3('0x36'))){_0x25805c[_0xcae3('0x1b')]=qs['limit'](_0x2c3b93[_0xcae3('0x2e')]['limit']);_0x25805c[_0xcae3('0x18')]=qs[_0xcae3('0x18')](_0x2c3b93[_0xcae3('0x2e')]['offset']);}_0x25805c['order']=qs['sort'](_0x2c3b93[_0xcae3('0x2e')][_0xcae3('0x37')]);_0x25805c[_0xcae3('0x38')]=qs[_0xcae3('0x30')](_[_0xcae3('0x39')](_0x2c3b93['query'],_0x4da6c7[_0xcae3('0x30')]));_0x25805c[_0xcae3('0x38')]['CampaignId']=_0x183169['id'];if(_0x2c3b93['query']['filter']){_0x25805c['where']=_[_0xcae3('0x3b')](_0x25805c['where'],{'$or':_[_0xcae3('0x2b')](_0x25805c['attributes'],function(_0x449713){var _0x1a0c34={};_0x1a0c34[_0x449713]={'$like':'%'+_0x2c3b93['query'][_0xcae3('0x3a')]+'%'};return _0x1a0c34;})});}_0x25805c=_[_0xcae3('0x3b')]({},_0x25805c,_0x2c3b93['options']);return db[_0xcae3('0x60')]['count']({'where':_0x25805c[_0xcae3('0x38')]})[_0xcae3('0x25')](function(_0x1da92c){_0x4858da[_0xcae3('0x1a')]=_0x1da92c;if(_0x2c3b93[_0xcae3('0x2e')][_0xcae3('0x40')]){_0x25805c[_0xcae3('0x45')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xcae3('0x5d')](_0x25805c);})[_0xcae3('0x25')](function(_0x3d3214){_0x4858da[_0xcae3('0x5a')]=_0x3d3214;return _0x4858da;});}})[_0xcae3('0x25')](respondWithFilteredResult(_0x2b77dd,_0x25805c))[_0xcae3('0x41')](handleError(_0x2b77dd,null));};exports[_0xcae3('0x61')]=function(_0x27b268,_0xd55e06,_0x31a71c){var _0x4a6435={};var _0x38c46a={};var _0x52fadd;var _0x188daa;return db[_0xcae3('0x3f')][_0xcae3('0x55')]({'where':{'id':_0x27b268['params']['id']}})['then'](handleEntityNotFound(_0xd55e06,null))[_0xcae3('0x25')](function(_0x362e96){if(_0x362e96){_0x52fadd=_0x362e96;_0x38c46a['model']=_['keys'](db[_0xcae3('0x62')][_0xcae3('0x44')]);_0x38c46a[_0xcae3('0x2e')]=_[_0xcae3('0x2f')](_0x27b268[_0xcae3('0x2e')]);_0x38c46a[_0xcae3('0x30')]=_['intersection'](_0x38c46a[_0xcae3('0x32')],_0x38c46a['query']);_0x4a6435[_0xcae3('0x33')]=_['intersection'](_0x38c46a['model'],qs[_0xcae3('0x34')](_0x27b268[_0xcae3('0x2e')][_0xcae3('0x34')]));_0x4a6435[_0xcae3('0x33')]=_0x4a6435[_0xcae3('0x33')][_0xcae3('0x35')]?_0x4a6435[_0xcae3('0x33')]:_0x38c46a[_0xcae3('0x32')];_0x4a6435[_0xcae3('0x58')]=qs[_0xcae3('0x37')](_0x27b268['query'][_0xcae3('0x37')]);_0x4a6435['where']=qs[_0xcae3('0x30')](_[_0xcae3('0x39')](_0x27b268['query'],_0x38c46a[_0xcae3('0x30')]));if(_0x27b268[_0xcae3('0x2e')][_0xcae3('0x3a')]){_0x4a6435[_0xcae3('0x38')]=_['merge'](_0x4a6435['where'],{'$or':_[_0xcae3('0x2b')](_0x4a6435['attributes'],function(_0x278ecc){var _0x135b05={};_0x135b05[_0x278ecc]={'$like':'%'+_0x27b268['query'][_0xcae3('0x3a')]+'%'};return _0x135b05;})});}_0x4a6435=_[_0xcae3('0x3b')]({},_0x4a6435,_0x27b268[_0xcae3('0x3e')]);return _0x52fadd[_0xcae3('0x61')](_0x4a6435);}})['then'](function(_0x184c3a){if(_0x184c3a){_0x188daa=_0x184c3a[_0xcae3('0x35')];if(!_0x27b268[_0xcae3('0x2e')][_0xcae3('0x57')]('nolimit')){_0x4a6435[_0xcae3('0x1b')]=qs[_0xcae3('0x1b')](_0x27b268[_0xcae3('0x2e')][_0xcae3('0x1b')]);_0x4a6435[_0xcae3('0x18')]=qs[_0xcae3('0x18')](_0x27b268[_0xcae3('0x2e')][_0xcae3('0x18')]);}return _0x52fadd[_0xcae3('0x61')](_0x4a6435);}})[_0xcae3('0x25')](function(_0xc9d7a3){if(_0xc9d7a3){return _0xc9d7a3?{'count':_0x188daa,'rows':_0xc9d7a3}:null;}})[_0xcae3('0x25')](respondWithResult(_0xd55e06,null))[_0xcae3('0x41')](handleError(_0xd55e06,null));};exports[_0xcae3('0x63')]=function(_0x304775,_0x2349ea,_0x343a78){var _0xe0769b,_0x5c0142;return db[_0xcae3('0x3f')]['find']({'where':{'id':_0x304775[_0xcae3('0x43')]['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x2349ea,null))[_0xcae3('0x25')](function(_0x1438e1){if(_0x1438e1){_0x5c0142=_0x1438e1;return _0x1438e1['addLists'](_0x304775[_0xcae3('0x48')][_0xcae3('0x64')],_[_0xcae3('0x4f')](_0x304775[_0xcae3('0x48')],[_0xcae3('0x64'),'id'])||{});}return null;})[_0xcae3('0x65')](function(_0x3fd04f){var _0x3430a2;_0xe0769b=_0x3fd04f||[];var _0x263b23=[];if(_0x3fd04f){for(var _0x5ed9b0=0x0;_0x5ed9b0<_0x3fd04f[_0xcae3('0x35')];_0x5ed9b0+=0x1){var _0x40ec47=_0x3fd04f[_0x5ed9b0][_0xcae3('0x22')]({'plain':!![]});_0x5c0142[_0xcae3('0x66')]=_0x304775[_0xcae3('0x48')][_0xcae3('0x66')]?_0x304775[_0xcae3('0x48')][_0xcae3('0x66')]:_0x5c0142[_0xcae3('0x66')];switch(_0x5c0142['dialCheckDuplicateType']){case'always':_0x3430a2=squel[_0xcae3('0x67')]()[_0xcae3('0x68')](_0xcae3('0x69'))[_0xcae3('0x6a')](['phone','scheduledAt',_0xcae3('0x6b'),_0xcae3('0x6c'),_0xcae3('0x59'),_0xcae3('0x50'),_0xcae3('0x51')],squel[_0xcae3('0x6d')]()['field']('phone',_0xcae3('0x6e'))[_0xcae3('0x6f')](_0xcae3('0x70'),_0xcae3('0x71'))['field']('id',_0xcae3('0x6b'))[_0xcae3('0x6f')](_0x40ec47[_0xcae3('0x72')][_0xcae3('0x73')](),_0xcae3('0x6c'))[_0xcae3('0x6f')](_0x304775[_0xcae3('0x43')]['id']['toString'](),_0xcae3('0x59'))[_0xcae3('0x6f')](_0xcae3('0x70'),_0xcae3('0x50'))[_0xcae3('0x6f')](_0xcae3('0x70'),_0xcae3('0x51'))['from'](_0xcae3('0x74'))[_0xcae3('0x38')]('deletedAt\x20IS\x20NULL')[_0xcae3('0x38')](_0xcae3('0x75'),_0x40ec47[_0xcae3('0x72')][_0xcae3('0x73')]())[_0xcae3('0x38')](_0xcae3('0x76'))[_0xcae3('0x38')](_0xcae3('0x77'),squel[_0xcae3('0x6d')]()[_0xcae3('0x6f')](_0xcae3('0x78'))[_0xcae3('0x79')](_0xcae3('0x7a'))[_0xcae3('0x38')](_0xcae3('0x7b'),_0x304775[_0xcae3('0x43')]['id'][_0xcae3('0x73')]()))[_0xcae3('0x38')](_0xcae3('0x77'),squel['select']()[_0xcae3('0x6f')]('COALESCE(phone,\x27\x27)')[_0xcae3('0x79')]('cm_hopper')[_0xcae3('0x38')]('CampaignId\x20=\x20?',_0x304775['params']['id'][_0xcae3('0x73')]())))['toString']();break;case'onlyIfOpen':_0x3430a2=squel[_0xcae3('0x67')]()[_0xcae3('0x68')]('cm_hopper')['fromQuery'](['phone',_0xcae3('0x71'),_0xcae3('0x6b'),_0xcae3('0x6c'),'CampaignId',_0xcae3('0x50'),_0xcae3('0x51')],squel[_0xcae3('0x6d')]()[_0xcae3('0x6f')](_0xcae3('0x6e'),_0xcae3('0x6e'))[_0xcae3('0x6f')](_0xcae3('0x70'),_0xcae3('0x71'))[_0xcae3('0x6f')]('id',_0xcae3('0x6b'))[_0xcae3('0x6f')](_0x40ec47[_0xcae3('0x72')][_0xcae3('0x73')](),_0xcae3('0x6c'))[_0xcae3('0x6f')](_0x304775[_0xcae3('0x43')]['id'][_0xcae3('0x73')](),'CampaignId')[_0xcae3('0x6f')](_0xcae3('0x70'),_0xcae3('0x50'))['field'](_0xcae3('0x70'),_0xcae3('0x51'))[_0xcae3('0x79')](_0xcae3('0x74'))[_0xcae3('0x38')](_0xcae3('0x7c'))[_0xcae3('0x38')](_0xcae3('0x75'),_0x40ec47[_0xcae3('0x72')][_0xcae3('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xcae3('0x38')](_0xcae3('0x77'),squel[_0xcae3('0x6d')]()[_0xcae3('0x6f')]('COALESCE(phone,\x27\x27)')['from'](_0xcae3('0x69'))[_0xcae3('0x38')](_0xcae3('0x7b'),_0x304775[_0xcae3('0x43')]['id']['toString']())))[_0xcae3('0x73')]();break;default:_0x3430a2=squel[_0xcae3('0x67')]()[_0xcae3('0x68')](_0xcae3('0x69'))[_0xcae3('0x6a')]([_0xcae3('0x6e'),_0xcae3('0x71'),_0xcae3('0x6b'),_0xcae3('0x6c'),_0xcae3('0x59'),_0xcae3('0x50'),_0xcae3('0x51')],squel['select']()[_0xcae3('0x6f')]('phone',_0xcae3('0x6e'))[_0xcae3('0x6f')](_0xcae3('0x70'),_0xcae3('0x71'))[_0xcae3('0x6f')]('id',_0xcae3('0x6b'))[_0xcae3('0x6f')](_0x40ec47[_0xcae3('0x72')]['toString'](),_0xcae3('0x6c'))[_0xcae3('0x6f')](_0x304775['params']['id'][_0xcae3('0x73')](),'CampaignId')[_0xcae3('0x6f')](_0xcae3('0x70'),_0xcae3('0x50'))['field'](_0xcae3('0x70'),_0xcae3('0x51'))[_0xcae3('0x79')](_0xcae3('0x74'))[_0xcae3('0x38')](_0xcae3('0x7c'))[_0xcae3('0x38')](_0xcae3('0x75'),_0x40ec47[_0xcae3('0x72')][_0xcae3('0x73')]())['where'](_0xcae3('0x76')))[_0xcae3('0x73')]();}_0x263b23[_0xcae3('0x7d')](db['sequelize'][_0xcae3('0x2e')](_0x3430a2));}return BPromise[_0xcae3('0x7e')](_0x263b23);}})[_0xcae3('0x25')](function(){return _0xe0769b;})['then'](respondWithResult(_0x2349ea,null))[_0xcae3('0x41')](handleError(_0x2349ea,null));};exports[_0xcae3('0x7f')]=function(_0x339b10,_0x13ecb5,_0x251544){return db['Campaign'][_0xcae3('0x46')]({'where':{'id':_0x339b10[_0xcae3('0x43')]['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x13ecb5,null))[_0xcae3('0x25')](function(_0x23a552){if(_0x23a552){return _0x23a552[_0xcae3('0x7f')](_0x339b10[_0xcae3('0x2e')][_0xcae3('0x64')]);}})[_0xcae3('0x25')](function(_0x46c9d5){if(_0x46c9d5){return db[_0xcae3('0x56')][_0xcae3('0x21')]({'where':{'ListId':_0x339b10[_0xcae3('0x2e')][_0xcae3('0x64')],'CampaignId':_0x339b10[_0xcae3('0x43')]['id']}})[_0xcae3('0x25')](function(){return _0x46c9d5;});}})[_0xcae3('0x25')](respondWithStatusCode(_0x13ecb5,null))[_0xcae3('0x41')](handleError(_0x13ecb5,null));};exports['getBlackLists']=function(_0x1ab682,_0x1d7194,_0x5b22a6){var _0x5af82a={};var _0x507f39={};var _0x15cb4e;var _0x3465a5;return db[_0xcae3('0x3f')][_0xcae3('0x55')]({'where':{'id':_0x1ab682[_0xcae3('0x43')]['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x1d7194,null))[_0xcae3('0x25')](function(_0x3a0a93){if(_0x3a0a93){_0x15cb4e=_0x3a0a93;_0x507f39['model']=_[_0xcae3('0x2f')](db[_0xcae3('0x62')]['rawAttributes']);_0x507f39[_0xcae3('0x2e')]=_[_0xcae3('0x2f')](_0x1ab682[_0xcae3('0x2e')]);_0x507f39['filters']=_[_0xcae3('0x31')](_0x507f39[_0xcae3('0x32')],_0x507f39[_0xcae3('0x2e')]);_0x5af82a[_0xcae3('0x33')]=_[_0xcae3('0x31')](_0x507f39[_0xcae3('0x32')],qs[_0xcae3('0x34')](_0x1ab682[_0xcae3('0x2e')][_0xcae3('0x34')]));_0x5af82a[_0xcae3('0x33')]=_0x5af82a['attributes'][_0xcae3('0x35')]?_0x5af82a['attributes']:_0x507f39['model'];_0x5af82a['order']=qs[_0xcae3('0x37')](_0x1ab682[_0xcae3('0x2e')][_0xcae3('0x37')]);_0x5af82a[_0xcae3('0x38')]=qs[_0xcae3('0x30')](_[_0xcae3('0x39')](_0x1ab682[_0xcae3('0x2e')],_0x507f39[_0xcae3('0x30')]));if(_0x1ab682['query']['filter']){_0x5af82a[_0xcae3('0x38')]=_[_0xcae3('0x3b')](_0x5af82a['where'],{'$or':_['map'](_0x5af82a[_0xcae3('0x33')],function(_0x248a15){var _0x4b0d37={};_0x4b0d37[_0x248a15]={'$like':'%'+_0x1ab682[_0xcae3('0x2e')][_0xcae3('0x3a')]+'%'};return _0x4b0d37;})});}_0x5af82a=_[_0xcae3('0x3b')]({},_0x5af82a,_0x1ab682[_0xcae3('0x3e')]);return _0x15cb4e[_0xcae3('0x80')](_0x5af82a);}})[_0xcae3('0x25')](function(_0x48c8d7){if(_0x48c8d7){_0x3465a5=_0x48c8d7[_0xcae3('0x35')];if(!_0x1ab682[_0xcae3('0x2e')][_0xcae3('0x57')](_0xcae3('0x36'))){_0x5af82a[_0xcae3('0x1b')]=qs['limit'](_0x1ab682['query'][_0xcae3('0x1b')]);_0x5af82a['offset']=qs['offset'](_0x1ab682[_0xcae3('0x2e')][_0xcae3('0x18')]);}return _0x15cb4e['getBlackLists'](_0x5af82a);}})[_0xcae3('0x25')](function(_0x5d5afa){if(_0x5d5afa){return _0x5d5afa?{'count':_0x3465a5,'rows':_0x5d5afa}:null;}})[_0xcae3('0x25')](respondWithResult(_0x1d7194,null))[_0xcae3('0x41')](handleError(_0x1d7194,null));};exports[_0xcae3('0x81')]=function(_0x1b8225,_0x891511,_0x24a97a){var _0x34114d,_0x282f46;return db[_0xcae3('0x3f')][_0xcae3('0x46')]({'where':{'id':_0x1b8225[_0xcae3('0x43')]['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x891511,null))['then'](function(_0x5437b5){if(_0x5437b5){_0x282f46=_0x5437b5;return _0x5437b5[_0xcae3('0x81')](_0x1b8225[_0xcae3('0x48')][_0xcae3('0x64')],_['omit'](_0x1b8225[_0xcae3('0x48')],[_0xcae3('0x64'),'id'])||{});}return null;})[_0xcae3('0x65')](function(_0x4a40a8){var _0x589905;_0x34114d=_0x4a40a8||[];var _0x51cf1a=[];if(_0x4a40a8){for(var _0x6ae99b=0x0;_0x6ae99b<_0x4a40a8[_0xcae3('0x35')];_0x6ae99b+=0x1){var _0x5a4aed=_0x4a40a8[_0x6ae99b][_0xcae3('0x22')]({'plain':!![]});_0x589905=squel[_0xcae3('0x67')]()['into'](_0xcae3('0x82'))[_0xcae3('0x6a')]([_0xcae3('0x6e'),_0xcae3('0x6b'),_0xcae3('0x6c'),'CampaignId','createdAt',_0xcae3('0x51')],squel[_0xcae3('0x6d')]()['field']('phone','phone')[_0xcae3('0x6f')]('id','ContactId')['field'](_0x5a4aed[_0xcae3('0x72')][_0xcae3('0x73')](),_0xcae3('0x6c'))[_0xcae3('0x6f')](_0x1b8225[_0xcae3('0x43')]['id'][_0xcae3('0x73')](),_0xcae3('0x59'))['field'](_0xcae3('0x70'),_0xcae3('0x50'))[_0xcae3('0x6f')](_0xcae3('0x70'),'updatedAt')[_0xcae3('0x79')](_0xcae3('0x74'))['where']('deletedAt\x20IS\x20NULL')[_0xcae3('0x38')](_0xcae3('0x75'),_0x5a4aed[_0xcae3('0x72')][_0xcae3('0x73')]())['where'](_0xcae3('0x76')))[_0xcae3('0x73')]();_0x51cf1a[_0xcae3('0x7d')](db[_0xcae3('0x83')][_0xcae3('0x2e')](_0x589905));}return BPromise['all'](_0x51cf1a);}})[_0xcae3('0x25')](function(){return _0x34114d;})[_0xcae3('0x25')](respondWithResult(_0x891511,null))[_0xcae3('0x41')](handleError(_0x891511,null));};exports['removeBlackLists']=function(_0x4d6d57,_0x257d3f,_0x24aa56){return db[_0xcae3('0x3f')][_0xcae3('0x46')]({'where':{'id':_0x4d6d57['params']['id']}})[_0xcae3('0x25')](handleEntityNotFound(_0x257d3f,null))[_0xcae3('0x25')](function(_0x2e700d){if(_0x2e700d){return _0x2e700d[_0xcae3('0x84')](_0x4d6d57[_0xcae3('0x2e')][_0xcae3('0x64')]);}})[_0xcae3('0x25')](function(_0x55ae3d){if(_0x55ae3d){return db[_0xcae3('0x60')][_0xcae3('0x21')]({'where':{'ListId':_0x4d6d57['query'][_0xcae3('0x64')],'CampaignId':_0x4d6d57['params']['id']}})[_0xcae3('0x25')](function(){return _0x55ae3d;});}})[_0xcae3('0x25')](respondWithStatusCode(_0x257d3f,null))[_0xcae3('0x41')](handleError(_0x257d3f,null));}; \ No newline at end of file +var _0x7eab=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','order','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','onlyIfOpen','insert','cm_contacts','COALESCE(phone,\x27\x27)','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','sendStatus','error','stack','name','send','index','Campaign','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','user'];(function(_0x32ae4e,_0x1dd4b0){var _0x1084a7=function(_0x50c403){while(--_0x50c403){_0x32ae4e['push'](_0x32ae4e['shift']());}};_0x1084a7(++_0x1dd4b0);}(_0x7eab,0xca));var _0xb7ea=function(_0x1b34fe,_0x362300){_0x1b34fe=_0x1b34fe-0x0;var _0x438670=_0x7eab[_0x1b34fe];return _0x438670;};'use strict';var emlformat=require(_0xb7ea('0x0'));var rimraf=require(_0xb7ea('0x1'));var zipdir=require(_0xb7ea('0x2'));var jsonpatch=require(_0xb7ea('0x3'));var rp=require(_0xb7ea('0x4'));var moment=require(_0xb7ea('0x5'));var BPromise=require(_0xb7ea('0x6'));var Mustache=require(_0xb7ea('0x7'));var util=require(_0xb7ea('0x8'));var path=require('path');var sox=require(_0xb7ea('0x9'));var csv=require(_0xb7ea('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7ea('0xb'));var _=require(_0xb7ea('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb7ea('0xd'));var deskjs=require(_0xb7ea('0xe'));var toCsv=require(_0xb7ea('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb7ea('0xf'));var authService=require(_0xb7ea('0x10'));var qs=require(_0xb7ea('0x11'));var as=require(_0xb7ea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7ea('0x13'))(_0xb7ea('0x14'));var utils=require('../../config/utils');var config=require(_0xb7ea('0x15'));var licenseUtil=require(_0xb7ea('0x16'));var db=require(_0xb7ea('0x17'))['db'];function respondWithStatusCode(_0x61f25,_0x3083d5){_0x3083d5=_0x3083d5||0xcc;return function(_0x4d55ec){if(_0x4d55ec){return _0x61f25['sendStatus'](_0x3083d5);}return _0x61f25[_0xb7ea('0x18')](_0x3083d5)[_0xb7ea('0x19')]();};}function respondWithResult(_0x2f47ae,_0x5941bd){_0x5941bd=_0x5941bd||0xc8;return function(_0x50b205){if(_0x50b205){return _0x2f47ae[_0xb7ea('0x18')](_0x5941bd)[_0xb7ea('0x1a')](_0x50b205);}};}function respondWithFilteredResult(_0x2b2f3c,_0x33f016){return function(_0x2a8aa1){if(_0x2a8aa1){var _0x2c20fd=typeof _0x33f016[_0xb7ea('0x1b')]===_0xb7ea('0x1c')&&typeof _0x33f016[_0xb7ea('0x1d')]==='undefined';var _0x3b8fcf=_0x2a8aa1[_0xb7ea('0x1e')];var _0x2dbc52=_0x2c20fd?0x0:_0x33f016[_0xb7ea('0x1b')];var _0x3a3cea=_0x2c20fd?_0x2a8aa1[_0xb7ea('0x1e')]:_0x33f016[_0xb7ea('0x1b')]+_0x33f016[_0xb7ea('0x1d')];var _0x840a9d;if(_0x3a3cea>=_0x3b8fcf){_0x3a3cea=_0x3b8fcf;_0x840a9d=0xc8;}else{_0x840a9d=0xce;}_0x2b2f3c[_0xb7ea('0x18')](_0x840a9d);return _0x2b2f3c[_0xb7ea('0x1f')](_0xb7ea('0x20'),_0x2dbc52+'-'+_0x3a3cea+'/'+_0x3b8fcf)[_0xb7ea('0x1a')](_0x2a8aa1);}return null;};}function patchUpdates(_0x2744b9){return function(_0x559eb5){try{jsonpatch[_0xb7ea('0x21')](_0x559eb5,_0x2744b9,!![]);}catch(_0x426a9b){return BPromise[_0xb7ea('0x22')](_0x426a9b);}return _0x559eb5[_0xb7ea('0x23')]();};}function saveUpdates(_0x1e7eb8,_0x2019a7){return function(_0x1da2ab){if(_0x1da2ab){return _0x1da2ab[_0xb7ea('0x24')](_0x1e7eb8)[_0xb7ea('0x25')](function(_0x36dc80){return _0x36dc80;});}return null;};}function removeEntity(_0xafd393,_0x4b72f5){return function(_0x56c7cf){if(_0x56c7cf){return _0x56c7cf[_0xb7ea('0x26')]()[_0xb7ea('0x25')](function(){var _0x527e05=_0x56c7cf[_0xb7ea('0x27')]({'plain':!![]});var _0x446e61=_0xb7ea('0x28');return db['UserProfileResource'][_0xb7ea('0x26')]({'where':{'type':_0x446e61,'resourceId':_0x527e05['id']}})[_0xb7ea('0x25')](function(){return _0x56c7cf;});})[_0xb7ea('0x25')](function(){_0xafd393[_0xb7ea('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bcc61,_0x50d84f){return function(_0x143384){if(!_0x143384){_0x3bcc61[_0xb7ea('0x29')](0x194);}return _0x143384;};}function handleError(_0x380217,_0x3d8333){_0x3d8333=_0x3d8333||0x1f4;return function(_0x1a07cd){logger[_0xb7ea('0x2a')](_0x1a07cd[_0xb7ea('0x2b')]);if(_0x1a07cd['name']){delete _0x1a07cd[_0xb7ea('0x2c')];}_0x380217[_0xb7ea('0x18')](_0x3d8333)[_0xb7ea('0x2d')](_0x1a07cd);};}exports[_0xb7ea('0x2e')]=function(_0x3c1144,_0x2cc937){var _0x5aa5c5={},_0x3f4977={},_0xdac933={'count':0x0,'rows':[]};var _0x3d503a=_['map'](db[_0xb7ea('0x2f')][_0xb7ea('0x30')],function(_0x1d7d88){return{'name':_0x1d7d88['fieldName'],'type':_0x1d7d88[_0xb7ea('0x31')][_0xb7ea('0x32')]};});_0x3f4977[_0xb7ea('0x33')]=_[_0xb7ea('0x34')](_0x3d503a,'name');_0x3f4977[_0xb7ea('0x35')]=_[_0xb7ea('0x36')](_0x3c1144[_0xb7ea('0x35')]);_0x3f4977[_0xb7ea('0x37')]=_['intersection'](_0x3f4977[_0xb7ea('0x33')],_0x3f4977['query']);_0x5aa5c5[_0xb7ea('0x38')]=_[_0xb7ea('0x39')](_0x3f4977[_0xb7ea('0x33')],qs['fields'](_0x3c1144[_0xb7ea('0x35')][_0xb7ea('0x3a')]));_0x5aa5c5[_0xb7ea('0x38')]=_0x5aa5c5[_0xb7ea('0x38')]['length']?_0x5aa5c5[_0xb7ea('0x38')]:_0x3f4977[_0xb7ea('0x33')];if(!_0x3c1144[_0xb7ea('0x35')][_0xb7ea('0x3b')](_0xb7ea('0x3c'))){_0x5aa5c5['limit']=qs[_0xb7ea('0x1d')](_0x3c1144[_0xb7ea('0x35')][_0xb7ea('0x1d')]);_0x5aa5c5['offset']=qs['offset'](_0x3c1144[_0xb7ea('0x35')][_0xb7ea('0x1b')]);}_0x5aa5c5['order']=qs[_0xb7ea('0x3d')](_0x3c1144[_0xb7ea('0x35')][_0xb7ea('0x3d')]);_0x5aa5c5[_0xb7ea('0x3e')]=qs[_0xb7ea('0x37')](_[_0xb7ea('0x3f')](_0x3c1144['query'],_0x3f4977[_0xb7ea('0x37')]),_0x3d503a);if(_0x3c1144[_0xb7ea('0x35')][_0xb7ea('0x40')]){_0x5aa5c5[_0xb7ea('0x3e')]=_[_0xb7ea('0x41')](_0x5aa5c5['where'],{'$or':_[_0xb7ea('0x34')](_0x3d503a,function(_0x3e8850){if(_0x3e8850[_0xb7ea('0x31')]!==_0xb7ea('0x42')){var _0x5bddaa={};_0x5bddaa[_0x3e8850[_0xb7ea('0x2c')]]={'$like':'%'+_0x3c1144['query'][_0xb7ea('0x40')]+'%'};return _0x5bddaa;}})});}_0x5aa5c5=_[_0xb7ea('0x41')]({},_0x5aa5c5,_0x3c1144[_0xb7ea('0x43')]);var _0x45c519={'where':_0x5aa5c5['where']};return db[_0xb7ea('0x2f')][_0xb7ea('0x1e')](_0x45c519)[_0xb7ea('0x25')](function(_0x88c5b3){_0xdac933['count']=_0x88c5b3;if(_0x3c1144['query'][_0xb7ea('0x44')]){_0x5aa5c5[_0xb7ea('0x45')]=[{'all':!![]}];}return db[_0xb7ea('0x2f')][_0xb7ea('0x46')](_0x5aa5c5);})['then'](function(_0x4b60aa){_0xdac933['rows']=_0x4b60aa;return _0xdac933;})[_0xb7ea('0x25')](respondWithFilteredResult(_0x2cc937,_0x5aa5c5))[_0xb7ea('0x47')](handleError(_0x2cc937,null));};exports[_0xb7ea('0x48')]=function(_0x9dc267,_0x24175c){var _0x9e5ddb={'raw':![],'where':{'id':_0x9dc267[_0xb7ea('0x49')]['id']}},_0x18e103={};_0x18e103['model']=_[_0xb7ea('0x36')](db['Campaign'][_0xb7ea('0x30')]);_0x18e103['query']=_[_0xb7ea('0x36')](_0x9dc267[_0xb7ea('0x35')]);_0x18e103[_0xb7ea('0x37')]=_[_0xb7ea('0x39')](_0x18e103[_0xb7ea('0x33')],_0x18e103[_0xb7ea('0x35')]);_0x9e5ddb['attributes']=_[_0xb7ea('0x39')](_0x18e103[_0xb7ea('0x33')],qs[_0xb7ea('0x3a')](_0x9dc267['query'][_0xb7ea('0x3a')]));_0x9e5ddb[_0xb7ea('0x38')]=_0x9e5ddb['attributes'][_0xb7ea('0x4a')]?_0x9e5ddb[_0xb7ea('0x38')]:_0x18e103['model'];if(_0x9dc267[_0xb7ea('0x35')][_0xb7ea('0x44')]){_0x9e5ddb[_0xb7ea('0x45')]=[{'all':!![]}];}_0x9e5ddb=_['merge']({},_0x9e5ddb,_0x9dc267[_0xb7ea('0x43')]);return db[_0xb7ea('0x2f')]['find'](_0x9e5ddb)[_0xb7ea('0x25')](handleEntityNotFound(_0x24175c,null))[_0xb7ea('0x25')](respondWithResult(_0x24175c,null))[_0xb7ea('0x47')](handleError(_0x24175c,null));};exports[_0xb7ea('0x4b')]=function(_0x337b60,_0x3ee093){return db[_0xb7ea('0x2f')][_0xb7ea('0x4b')](_0x337b60[_0xb7ea('0x4c')],{})[_0xb7ea('0x25')](function(_0x2465e0){var _0xc691e1=_0x337b60[_0xb7ea('0x4d')][_0xb7ea('0x27')]({'plain':!![]});if(!_0xc691e1)throw new Error(_0xb7ea('0x4e'));if(_0xc691e1[_0xb7ea('0x4f')]===_0xb7ea('0x4d')){var _0xe87c29=_0x2465e0[_0xb7ea('0x27')]({'plain':!![]});var _0x3c978a=_0xb7ea('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x3c978a,'userProfileId':_0xc691e1[_0xb7ea('0x50')]},'raw':!![]})[_0xb7ea('0x25')](function(_0x5dc35b){if(_0x5dc35b&&_0x5dc35b[_0xb7ea('0x51')]===0x0){return db[_0xb7ea('0x52')]['create']({'name':_0xe87c29[_0xb7ea('0x2c')],'resourceId':_0xe87c29['id'],'type':_0x5dc35b['name'],'sectionId':_0x5dc35b['id']},{})[_0xb7ea('0x25')](function(){return _0x2465e0;});}else{return _0x2465e0;}})['catch'](function(_0x31634e){logger[_0xb7ea('0x2a')](_0xb7ea('0x53'),_0x31634e);throw _0x31634e;});}return _0x2465e0;})[_0xb7ea('0x25')](respondWithResult(_0x3ee093,0xc9))['catch'](handleError(_0x3ee093,null));};exports[_0xb7ea('0x54')]=function(_0x1e056a,_0x1391c3){var _0x57b556={'where':{'id':_0x1e056a[_0xb7ea('0x49')]['id']}},_0x1dbaea={};_0x1dbaea['model']=_[_0xb7ea('0x36')](db[_0xb7ea('0x2f')][_0xb7ea('0x30')]);_0x57b556[_0xb7ea('0x38')]=_['intersection'](_0x1dbaea[_0xb7ea('0x33')],qs[_0xb7ea('0x3a')](_0x1e056a['query'][_0xb7ea('0x3a')]));_0x57b556[_0xb7ea('0x38')]=_0x57b556[_0xb7ea('0x38')][_0xb7ea('0x4a')]?_0x57b556[_0xb7ea('0x38')]:_0x1dbaea[_0xb7ea('0x33')];if(_0x1e056a[_0xb7ea('0x35')]['includeAll']){_0x57b556[_0xb7ea('0x45')]=[{'all':!![]}];}_0x57b556=_[_0xb7ea('0x41')]({},_0x57b556,_0x1e056a['options']);return db[_0xb7ea('0x2f')][_0xb7ea('0x55')](_0x57b556)[_0xb7ea('0x25')](handleEntityNotFound(_0x1391c3,null))['then'](function(_0x371cd1){if(_0x371cd1){var _0x380ff9=_0x371cd1['get']({'plain':!![]});_0x380ff9=qs[_0xb7ea('0x56')](_0x380ff9,['id',_0xb7ea('0x57'),_0xb7ea('0x58')]);_0x1e056a['body']=_[_0xb7ea('0x56')](_0x1e056a[_0xb7ea('0x4c')],['id',_0xb7ea('0x57'),_0xb7ea('0x58')]);return db[_0xb7ea('0x2f')][_0xb7ea('0x4b')](_['merge'](_0x380ff9,_0x1e056a[_0xb7ea('0x4c')]),{'include':_0x1e056a[_0xb7ea('0x35')][_0xb7ea('0x44')]?[{'all':!![]}]:undefined})[_0xb7ea('0x25')](function(_0xda17ae){var _0x18466f=_0x1e056a['user'][_0xb7ea('0x27')]({'plain':!![]});if(!_0x18466f)throw new Error(_0xb7ea('0x4e'));if(_0x18466f[_0xb7ea('0x4f')]===_0xb7ea('0x4d')){var _0x202eeb=_0xda17ae['get']({'plain':!![]});var _0x24d727=_0xb7ea('0x28');return db[_0xb7ea('0x59')]['find']({'where':{'name':_0x24d727,'userProfileId':_0x18466f[_0xb7ea('0x50')]},'raw':!![]})[_0xb7ea('0x25')](function(_0x162492){if(_0x162492&&_0x162492[_0xb7ea('0x51')]===0x0){return db['UserProfileResource'][_0xb7ea('0x4b')]({'name':_0x202eeb[_0xb7ea('0x2c')],'resourceId':_0x202eeb['id'],'type':_0x162492['name'],'sectionId':_0x162492['id']},{})[_0xb7ea('0x25')](function(){return _0xda17ae;});}else{return _0xda17ae;}})['catch'](function(_0x17fa4d){logger[_0xb7ea('0x2a')](_0xb7ea('0x53'),_0x17fa4d);throw _0x17fa4d;});}return _0xda17ae;});}})[_0xb7ea('0x25')](respondWithResult(_0x1391c3,0xc9))[_0xb7ea('0x47')](handleError(_0x1391c3,null));};exports[_0xb7ea('0x24')]=function(_0x19f765,_0x5896f5){if(_0x19f765['body']['id']){delete _0x19f765[_0xb7ea('0x4c')]['id'];}return db[_0xb7ea('0x2f')]['find']({'where':{'id':_0x19f765['params']['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x5896f5,null))[_0xb7ea('0x25')](saveUpdates(_0x19f765[_0xb7ea('0x4c')],null))['then'](respondWithResult(_0x5896f5,null))[_0xb7ea('0x47')](handleError(_0x5896f5,null));};exports[_0xb7ea('0x26')]=function(_0x3cdb7b,_0x532ce1){return db[_0xb7ea('0x2f')][_0xb7ea('0x55')]({'where':{'id':_0x3cdb7b[_0xb7ea('0x49')]['id']}})['then'](handleEntityNotFound(_0x532ce1,null))[_0xb7ea('0x25')](removeEntity(_0x532ce1,null))['catch'](handleError(_0x532ce1,null));};exports[_0xb7ea('0x5a')]=function(_0x4daded,_0x2905da,_0x3433e9){var _0x46526b={'raw':!![],'where':{}};var _0x59c421={};var _0x4bb60={'count':0x0,'rows':[]};return db['Campaign'][_0xb7ea('0x5b')]({'where':{'id':_0x4daded['params']['id']}})['then'](handleEntityNotFound(_0x2905da,null))[_0xb7ea('0x25')](function(_0x574309){if(_0x574309){_0x59c421[_0xb7ea('0x33')]=_[_0xb7ea('0x36')](db[_0xb7ea('0x5c')][_0xb7ea('0x30')]);_0x59c421['query']=_[_0xb7ea('0x36')](_0x4daded[_0xb7ea('0x35')]);_0x59c421[_0xb7ea('0x37')]=_[_0xb7ea('0x39')](_0x59c421[_0xb7ea('0x33')],_0x59c421['query']);_0x46526b[_0xb7ea('0x38')]=_[_0xb7ea('0x39')](_0x59c421[_0xb7ea('0x33')],qs['fields'](_0x4daded[_0xb7ea('0x35')][_0xb7ea('0x3a')]));_0x46526b[_0xb7ea('0x38')]=_0x46526b[_0xb7ea('0x38')]['length']?_0x46526b[_0xb7ea('0x38')]:_0x59c421[_0xb7ea('0x33')];if(!_0x4daded[_0xb7ea('0x35')][_0xb7ea('0x3b')](_0xb7ea('0x3c'))){_0x46526b['limit']=qs[_0xb7ea('0x1d')](_0x4daded['query'][_0xb7ea('0x1d')]);_0x46526b[_0xb7ea('0x1b')]=qs[_0xb7ea('0x1b')](_0x4daded['query'][_0xb7ea('0x1b')]);}_0x46526b['order']=qs[_0xb7ea('0x3d')](_0x4daded[_0xb7ea('0x35')]['sort']);_0x46526b[_0xb7ea('0x3e')]=qs['filters'](_[_0xb7ea('0x3f')](_0x4daded[_0xb7ea('0x35')],_0x59c421['filters']));_0x46526b[_0xb7ea('0x3e')][_0xb7ea('0x5d')]=_0x574309['id'];if(_0x4daded['query'][_0xb7ea('0x40')]){_0x46526b[_0xb7ea('0x3e')]=_[_0xb7ea('0x41')](_0x46526b[_0xb7ea('0x3e')],{'$or':_[_0xb7ea('0x34')](_0x46526b['attributes'],function(_0x3a3301){var _0x3777b4={};_0x3777b4[_0x3a3301]={'$like':'%'+_0x4daded[_0xb7ea('0x35')][_0xb7ea('0x40')]+'%'};return _0x3777b4;})});}_0x46526b=_[_0xb7ea('0x41')]({},_0x46526b,_0x4daded['options']);return db[_0xb7ea('0x5c')][_0xb7ea('0x1e')]({'where':_0x46526b[_0xb7ea('0x3e')]})['then'](function(_0x38751c){_0x4bb60[_0xb7ea('0x1e')]=_0x38751c;if(_0x4daded[_0xb7ea('0x35')][_0xb7ea('0x44')]){_0x46526b[_0xb7ea('0x45')]=[{'all':!![]}];}return db[_0xb7ea('0x5c')][_0xb7ea('0x46')](_0x46526b);})[_0xb7ea('0x25')](function(_0x5653d2){_0x4bb60['rows']=_0x5653d2;return _0x4bb60;});}})[_0xb7ea('0x25')](respondWithFilteredResult(_0x2905da,_0x46526b))[_0xb7ea('0x47')](handleError(_0x2905da,null));};exports[_0xb7ea('0x5e')]=function(_0xf37e2c,_0x245aac,_0x21e90a){var _0x650f65={'raw':!![],'where':{}};var _0x4c9644={};var _0x501339={'count':0x0,'rows':[]};return db[_0xb7ea('0x2f')][_0xb7ea('0x5b')]({'where':{'id':_0xf37e2c[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x245aac,null))[_0xb7ea('0x25')](function(_0x4d525d){if(_0x4d525d){_0x4c9644[_0xb7ea('0x33')]=_[_0xb7ea('0x36')](db[_0xb7ea('0x5f')][_0xb7ea('0x30')]);_0x4c9644['query']=_['keys'](_0xf37e2c[_0xb7ea('0x35')]);_0x4c9644[_0xb7ea('0x37')]=_[_0xb7ea('0x39')](_0x4c9644['model'],_0x4c9644[_0xb7ea('0x35')]);_0x650f65['attributes']=_[_0xb7ea('0x39')](_0x4c9644[_0xb7ea('0x33')],qs['fields'](_0xf37e2c[_0xb7ea('0x35')][_0xb7ea('0x3a')]));_0x650f65[_0xb7ea('0x38')]=_0x650f65[_0xb7ea('0x38')][_0xb7ea('0x4a')]?_0x650f65[_0xb7ea('0x38')]:_0x4c9644['model'];if(!_0xf37e2c['query'][_0xb7ea('0x3b')](_0xb7ea('0x3c'))){_0x650f65['limit']=qs[_0xb7ea('0x1d')](_0xf37e2c[_0xb7ea('0x35')][_0xb7ea('0x1d')]);_0x650f65[_0xb7ea('0x1b')]=qs['offset'](_0xf37e2c[_0xb7ea('0x35')][_0xb7ea('0x1b')]);}_0x650f65[_0xb7ea('0x60')]=qs[_0xb7ea('0x3d')](_0xf37e2c[_0xb7ea('0x35')][_0xb7ea('0x3d')]);_0x650f65[_0xb7ea('0x3e')]=qs[_0xb7ea('0x37')](_['pick'](_0xf37e2c['query'],_0x4c9644[_0xb7ea('0x37')]));_0x650f65[_0xb7ea('0x3e')][_0xb7ea('0x5d')]=_0x4d525d['id'];if(_0xf37e2c[_0xb7ea('0x35')][_0xb7ea('0x40')]){_0x650f65['where']=_[_0xb7ea('0x41')](_0x650f65[_0xb7ea('0x3e')],{'$or':_[_0xb7ea('0x34')](_0x650f65[_0xb7ea('0x38')],function(_0x3d0a72){var _0x11584a={};_0x11584a[_0x3d0a72]={'$like':'%'+_0xf37e2c[_0xb7ea('0x35')][_0xb7ea('0x40')]+'%'};return _0x11584a;})});}_0x650f65=_[_0xb7ea('0x41')]({},_0x650f65,_0xf37e2c[_0xb7ea('0x43')]);return db[_0xb7ea('0x5f')][_0xb7ea('0x1e')]({'where':_0x650f65[_0xb7ea('0x3e')]})['then'](function(_0x2cab6b){_0x501339[_0xb7ea('0x1e')]=_0x2cab6b;if(_0xf37e2c[_0xb7ea('0x35')][_0xb7ea('0x44')]){_0x650f65['include']=[{'all':!![]}];}return db[_0xb7ea('0x5f')][_0xb7ea('0x46')](_0x650f65);})['then'](function(_0x5b5e73){_0x501339[_0xb7ea('0x61')]=_0x5b5e73;return _0x501339;});}})['then'](respondWithFilteredResult(_0x245aac,_0x650f65))[_0xb7ea('0x47')](handleError(_0x245aac,null));};exports[_0xb7ea('0x62')]=function(_0x4033e2,_0x1b75a6,_0x3c379d){var _0x54ff4a={'raw':!![],'where':{}};var _0x1823df={};var _0x3b7eab={'count':0x0,'rows':[]};return db[_0xb7ea('0x2f')]['findOne']({'where':{'id':_0x4033e2['params']['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x1b75a6,null))[_0xb7ea('0x25')](function(_0x4f4483){if(_0x4f4483){_0x1823df[_0xb7ea('0x33')]=_[_0xb7ea('0x36')](db[_0xb7ea('0x63')]['rawAttributes']);_0x1823df[_0xb7ea('0x35')]=_[_0xb7ea('0x36')](_0x4033e2[_0xb7ea('0x35')]);_0x1823df[_0xb7ea('0x37')]=_[_0xb7ea('0x39')](_0x1823df[_0xb7ea('0x33')],_0x1823df[_0xb7ea('0x35')]);_0x54ff4a[_0xb7ea('0x38')]=_[_0xb7ea('0x39')](_0x1823df['model'],qs[_0xb7ea('0x3a')](_0x4033e2[_0xb7ea('0x35')][_0xb7ea('0x3a')]));_0x54ff4a[_0xb7ea('0x38')]=_0x54ff4a['attributes'][_0xb7ea('0x4a')]?_0x54ff4a['attributes']:_0x1823df[_0xb7ea('0x33')];if(!_0x4033e2[_0xb7ea('0x35')][_0xb7ea('0x3b')](_0xb7ea('0x3c'))){_0x54ff4a[_0xb7ea('0x1d')]=qs[_0xb7ea('0x1d')](_0x4033e2['query'][_0xb7ea('0x1d')]);_0x54ff4a[_0xb7ea('0x1b')]=qs['offset'](_0x4033e2['query'][_0xb7ea('0x1b')]);}_0x54ff4a['order']=qs['sort'](_0x4033e2['query']['sort']);_0x54ff4a[_0xb7ea('0x3e')]=qs[_0xb7ea('0x37')](_['pick'](_0x4033e2[_0xb7ea('0x35')],_0x1823df['filters']));_0x54ff4a['where']['CampaignId']=_0x4f4483['id'];if(_0x4033e2[_0xb7ea('0x35')][_0xb7ea('0x40')]){_0x54ff4a[_0xb7ea('0x3e')]=_[_0xb7ea('0x41')](_0x54ff4a[_0xb7ea('0x3e')],{'$or':_[_0xb7ea('0x34')](_0x54ff4a[_0xb7ea('0x38')],function(_0x5dd0ec){var _0x38b5df={};_0x38b5df[_0x5dd0ec]={'$like':'%'+_0x4033e2[_0xb7ea('0x35')]['filter']+'%'};return _0x38b5df;})});}_0x54ff4a=_[_0xb7ea('0x41')]({},_0x54ff4a,_0x4033e2[_0xb7ea('0x43')]);return db['CmHopperFinal'][_0xb7ea('0x1e')]({'where':_0x54ff4a['where']})[_0xb7ea('0x25')](function(_0x545717){_0x3b7eab['count']=_0x545717;if(_0x4033e2[_0xb7ea('0x35')][_0xb7ea('0x44')]){_0x54ff4a[_0xb7ea('0x45')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x54ff4a);})[_0xb7ea('0x25')](function(_0x180c9d){_0x3b7eab['rows']=_0x180c9d;return _0x3b7eab;});}})[_0xb7ea('0x25')](respondWithFilteredResult(_0x1b75a6,_0x54ff4a))['catch'](handleError(_0x1b75a6,null));};exports[_0xb7ea('0x64')]=function(_0xe8b615,_0x4171cc,_0x5d53b7){var _0x1b9751={'raw':!![],'where':{}};var _0x28311a={};var _0x1cb641={'count':0x0,'rows':[]};return db['Campaign'][_0xb7ea('0x5b')]({'where':{'id':_0xe8b615[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x4171cc,null))[_0xb7ea('0x25')](function(_0x13ce5f){if(_0x13ce5f){_0x28311a['model']=_['keys'](db['CmHopperBlack'][_0xb7ea('0x30')]);_0x28311a[_0xb7ea('0x35')]=_[_0xb7ea('0x36')](_0xe8b615['query']);_0x28311a[_0xb7ea('0x37')]=_[_0xb7ea('0x39')](_0x28311a[_0xb7ea('0x33')],_0x28311a[_0xb7ea('0x35')]);_0x1b9751[_0xb7ea('0x38')]=_[_0xb7ea('0x39')](_0x28311a[_0xb7ea('0x33')],qs[_0xb7ea('0x3a')](_0xe8b615[_0xb7ea('0x35')][_0xb7ea('0x3a')]));_0x1b9751['attributes']=_0x1b9751['attributes']['length']?_0x1b9751['attributes']:_0x28311a['model'];if(!_0xe8b615[_0xb7ea('0x35')][_0xb7ea('0x3b')](_0xb7ea('0x3c'))){_0x1b9751[_0xb7ea('0x1d')]=qs[_0xb7ea('0x1d')](_0xe8b615[_0xb7ea('0x35')][_0xb7ea('0x1d')]);_0x1b9751[_0xb7ea('0x1b')]=qs[_0xb7ea('0x1b')](_0xe8b615[_0xb7ea('0x35')]['offset']);}_0x1b9751[_0xb7ea('0x60')]=qs['sort'](_0xe8b615['query']['sort']);_0x1b9751[_0xb7ea('0x3e')]=qs[_0xb7ea('0x37')](_['pick'](_0xe8b615['query'],_0x28311a[_0xb7ea('0x37')]));_0x1b9751['where'][_0xb7ea('0x5d')]=_0x13ce5f['id'];if(_0xe8b615[_0xb7ea('0x35')][_0xb7ea('0x40')]){_0x1b9751[_0xb7ea('0x3e')]=_[_0xb7ea('0x41')](_0x1b9751[_0xb7ea('0x3e')],{'$or':_[_0xb7ea('0x34')](_0x1b9751['attributes'],function(_0x1221a8){var _0xaf5cd={};_0xaf5cd[_0x1221a8]={'$like':'%'+_0xe8b615[_0xb7ea('0x35')]['filter']+'%'};return _0xaf5cd;})});}_0x1b9751=_[_0xb7ea('0x41')]({},_0x1b9751,_0xe8b615['options']);return db[_0xb7ea('0x65')][_0xb7ea('0x1e')]({'where':_0x1b9751[_0xb7ea('0x3e')]})[_0xb7ea('0x25')](function(_0x2c16ed){_0x1cb641[_0xb7ea('0x1e')]=_0x2c16ed;if(_0xe8b615[_0xb7ea('0x35')][_0xb7ea('0x44')]){_0x1b9751[_0xb7ea('0x45')]=[{'all':!![]}];}return db[_0xb7ea('0x65')]['findAll'](_0x1b9751);})[_0xb7ea('0x25')](function(_0x15709f){_0x1cb641[_0xb7ea('0x61')]=_0x15709f;return _0x1cb641;});}})[_0xb7ea('0x25')](respondWithFilteredResult(_0x4171cc,_0x1b9751))[_0xb7ea('0x47')](handleError(_0x4171cc,null));};exports[_0xb7ea('0x66')]=function(_0x390e2c,_0x3473b5,_0x130294){var _0x24124d={};var _0xecba2e={};var _0x1b3c37;var _0x192871;return db[_0xb7ea('0x2f')][_0xb7ea('0x5b')]({'where':{'id':_0x390e2c[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x3473b5,null))[_0xb7ea('0x25')](function(_0x20a488){if(_0x20a488){_0x1b3c37=_0x20a488;_0xecba2e[_0xb7ea('0x33')]=_[_0xb7ea('0x36')](db[_0xb7ea('0x67')][_0xb7ea('0x30')]);_0xecba2e[_0xb7ea('0x35')]=_['keys'](_0x390e2c[_0xb7ea('0x35')]);_0xecba2e['filters']=_['intersection'](_0xecba2e[_0xb7ea('0x33')],_0xecba2e['query']);_0x24124d[_0xb7ea('0x38')]=_[_0xb7ea('0x39')](_0xecba2e['model'],qs[_0xb7ea('0x3a')](_0x390e2c[_0xb7ea('0x35')][_0xb7ea('0x3a')]));_0x24124d['attributes']=_0x24124d[_0xb7ea('0x38')][_0xb7ea('0x4a')]?_0x24124d[_0xb7ea('0x38')]:_0xecba2e['model'];_0x24124d[_0xb7ea('0x60')]=qs[_0xb7ea('0x3d')](_0x390e2c['query'][_0xb7ea('0x3d')]);_0x24124d[_0xb7ea('0x3e')]=qs[_0xb7ea('0x37')](_['pick'](_0x390e2c['query'],_0xecba2e[_0xb7ea('0x37')]));if(_0x390e2c[_0xb7ea('0x35')]['filter']){_0x24124d[_0xb7ea('0x3e')]=_[_0xb7ea('0x41')](_0x24124d[_0xb7ea('0x3e')],{'$or':_[_0xb7ea('0x34')](_0x24124d[_0xb7ea('0x38')],function(_0x4b7133){var _0x4ce9d6={};_0x4ce9d6[_0x4b7133]={'$like':'%'+_0x390e2c['query'][_0xb7ea('0x40')]+'%'};return _0x4ce9d6;})});}_0x24124d=_[_0xb7ea('0x41')]({},_0x24124d,_0x390e2c['options']);return _0x1b3c37['getLists'](_0x24124d);}})[_0xb7ea('0x25')](function(_0x3549bb){if(_0x3549bb){_0x192871=_0x3549bb['length'];if(!_0x390e2c[_0xb7ea('0x35')][_0xb7ea('0x3b')](_0xb7ea('0x3c'))){_0x24124d[_0xb7ea('0x1d')]=qs[_0xb7ea('0x1d')](_0x390e2c[_0xb7ea('0x35')][_0xb7ea('0x1d')]);_0x24124d[_0xb7ea('0x1b')]=qs[_0xb7ea('0x1b')](_0x390e2c[_0xb7ea('0x35')]['offset']);}return _0x1b3c37[_0xb7ea('0x66')](_0x24124d);}})[_0xb7ea('0x25')](function(_0xc1dab5){if(_0xc1dab5){return _0xc1dab5?{'count':_0x192871,'rows':_0xc1dab5}:null;}})[_0xb7ea('0x25')](respondWithResult(_0x3473b5,null))[_0xb7ea('0x47')](handleError(_0x3473b5,null));};exports[_0xb7ea('0x68')]=function(_0x42f3a3,_0x33b8cf,_0x30152c){var _0x46f4c5,_0x59a0c8;return db[_0xb7ea('0x2f')]['find']({'where':{'id':_0x42f3a3[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x33b8cf,null))['then'](function(_0x3e428e){if(_0x3e428e){_0x59a0c8=_0x3e428e;return _0x3e428e['addLists'](_0x42f3a3['body'][_0xb7ea('0x69')],_[_0xb7ea('0x56')](_0x42f3a3[_0xb7ea('0x4c')],[_0xb7ea('0x69'),'id'])||{});}return null;})[_0xb7ea('0x6a')](function(_0x1b4ca0){var _0x1fcddd;_0x46f4c5=_0x1b4ca0||[];var _0x7b2f3e=[];if(_0x1b4ca0){for(var _0x5ab277=0x0;_0x5ab277<_0x1b4ca0[_0xb7ea('0x4a')];_0x5ab277+=0x1){var _0x1b06b7=_0x1b4ca0[_0x5ab277][_0xb7ea('0x27')]({'plain':!![]});_0x59a0c8[_0xb7ea('0x6b')]=_0x42f3a3[_0xb7ea('0x4c')][_0xb7ea('0x6b')]?_0x42f3a3[_0xb7ea('0x4c')][_0xb7ea('0x6b')]:_0x59a0c8[_0xb7ea('0x6b')];switch(_0x59a0c8['dialCheckDuplicateType']){case _0xb7ea('0x6c'):_0x1fcddd=squel['insert']()[_0xb7ea('0x6d')](_0xb7ea('0x6e'))[_0xb7ea('0x6f')]([_0xb7ea('0x70'),_0xb7ea('0x71'),_0xb7ea('0x72'),_0xb7ea('0x73'),_0xb7ea('0x5d'),_0xb7ea('0x57'),_0xb7ea('0x58')],squel[_0xb7ea('0x74')]()[_0xb7ea('0x75')]('phone',_0xb7ea('0x70'))[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x71'))['field']('id',_0xb7ea('0x72'))[_0xb7ea('0x75')](_0x1b06b7[_0xb7ea('0x77')][_0xb7ea('0x78')](),_0xb7ea('0x73'))[_0xb7ea('0x75')](_0x42f3a3[_0xb7ea('0x49')]['id'][_0xb7ea('0x78')](),'CampaignId')[_0xb7ea('0x75')]('NOW()',_0xb7ea('0x57'))[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x58'))['from']('cm_contacts')['where'](_0xb7ea('0x79'))[_0xb7ea('0x3e')](_0xb7ea('0x7a'),_0x1b06b7[_0xb7ea('0x77')][_0xb7ea('0x78')]())['where'](_0xb7ea('0x7b'))[_0xb7ea('0x3e')](_0xb7ea('0x7c'),squel[_0xb7ea('0x74')]()[_0xb7ea('0x75')](_0xb7ea('0x7d'))[_0xb7ea('0x7e')](_0xb7ea('0x7f'))[_0xb7ea('0x3e')]('CampaignId\x20=\x20?',_0x42f3a3[_0xb7ea('0x49')]['id'][_0xb7ea('0x78')]()))['where'](_0xb7ea('0x7c'),squel[_0xb7ea('0x74')]()[_0xb7ea('0x75')]('COALESCE(phone,\x27\x27)')[_0xb7ea('0x7e')](_0xb7ea('0x6e'))[_0xb7ea('0x3e')]('CampaignId\x20=\x20?',_0x42f3a3['params']['id'][_0xb7ea('0x78')]())))[_0xb7ea('0x78')]();break;case _0xb7ea('0x80'):_0x1fcddd=squel[_0xb7ea('0x81')]()[_0xb7ea('0x6d')](_0xb7ea('0x6e'))[_0xb7ea('0x6f')]([_0xb7ea('0x70'),_0xb7ea('0x71'),_0xb7ea('0x72'),_0xb7ea('0x73'),_0xb7ea('0x5d'),'createdAt',_0xb7ea('0x58')],squel[_0xb7ea('0x74')]()[_0xb7ea('0x75')]('phone','phone')[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x71'))[_0xb7ea('0x75')]('id','ContactId')[_0xb7ea('0x75')](_0x1b06b7[_0xb7ea('0x77')][_0xb7ea('0x78')](),'ListId')[_0xb7ea('0x75')](_0x42f3a3[_0xb7ea('0x49')]['id'][_0xb7ea('0x78')](),'CampaignId')[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x57'))[_0xb7ea('0x75')](_0xb7ea('0x76'),'updatedAt')['from'](_0xb7ea('0x82'))[_0xb7ea('0x3e')](_0xb7ea('0x79'))['where'](_0xb7ea('0x7a'),_0x1b06b7[_0xb7ea('0x77')][_0xb7ea('0x78')]())['where'](_0xb7ea('0x7b'))[_0xb7ea('0x3e')](_0xb7ea('0x7c'),squel[_0xb7ea('0x74')]()[_0xb7ea('0x75')](_0xb7ea('0x83'))[_0xb7ea('0x7e')](_0xb7ea('0x6e'))['where']('CampaignId\x20=\x20?',_0x42f3a3[_0xb7ea('0x49')]['id'][_0xb7ea('0x78')]())))[_0xb7ea('0x78')]();break;default:_0x1fcddd=squel[_0xb7ea('0x81')]()[_0xb7ea('0x6d')]('cm_hopper')[_0xb7ea('0x6f')]([_0xb7ea('0x70'),'scheduledAt',_0xb7ea('0x72'),_0xb7ea('0x73'),_0xb7ea('0x5d'),_0xb7ea('0x57'),_0xb7ea('0x58')],squel[_0xb7ea('0x74')]()[_0xb7ea('0x75')]('phone',_0xb7ea('0x70'))[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x71'))[_0xb7ea('0x75')]('id',_0xb7ea('0x72'))[_0xb7ea('0x75')](_0x1b06b7[_0xb7ea('0x77')][_0xb7ea('0x78')](),_0xb7ea('0x73'))[_0xb7ea('0x75')](_0x42f3a3['params']['id']['toString'](),'CampaignId')[_0xb7ea('0x75')](_0xb7ea('0x76'),'createdAt')[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x58'))[_0xb7ea('0x7e')](_0xb7ea('0x82'))[_0xb7ea('0x3e')](_0xb7ea('0x79'))[_0xb7ea('0x3e')](_0xb7ea('0x7a'),_0x1b06b7[_0xb7ea('0x77')][_0xb7ea('0x78')]())[_0xb7ea('0x3e')](_0xb7ea('0x7b')))[_0xb7ea('0x78')]();}_0x7b2f3e['push'](db[_0xb7ea('0x84')]['query'](_0x1fcddd));}return BPromise['all'](_0x7b2f3e);}})[_0xb7ea('0x25')](function(){return _0x46f4c5;})[_0xb7ea('0x25')](respondWithResult(_0x33b8cf,null))[_0xb7ea('0x47')](handleError(_0x33b8cf,null));};exports[_0xb7ea('0x85')]=function(_0x27150c,_0xf4550a,_0x44a638){return db[_0xb7ea('0x2f')]['find']({'where':{'id':_0x27150c[_0xb7ea('0x49')]['id']}})['then'](handleEntityNotFound(_0xf4550a,null))[_0xb7ea('0x25')](function(_0x113c38){if(_0x113c38){return _0x113c38['removeLists'](_0x27150c[_0xb7ea('0x35')][_0xb7ea('0x69')]);}})[_0xb7ea('0x25')](function(_0x51c01d){if(_0x51c01d){return db[_0xb7ea('0x5c')][_0xb7ea('0x26')]({'where':{'ListId':_0x27150c[_0xb7ea('0x35')]['ids'],'CampaignId':_0x27150c[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](function(){return _0x51c01d;});}})[_0xb7ea('0x25')](respondWithStatusCode(_0xf4550a,null))[_0xb7ea('0x47')](handleError(_0xf4550a,null));};exports[_0xb7ea('0x86')]=function(_0x52775f,_0x2cb202,_0x536aa0){var _0x7cb048={};var _0x2f42a3={};var _0x585bef;var _0x380243;return db[_0xb7ea('0x2f')][_0xb7ea('0x5b')]({'where':{'id':_0x52775f[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x2cb202,null))[_0xb7ea('0x25')](function(_0x1b8d60){if(_0x1b8d60){_0x585bef=_0x1b8d60;_0x2f42a3['model']=_['keys'](db['CmList'][_0xb7ea('0x30')]);_0x2f42a3[_0xb7ea('0x35')]=_[_0xb7ea('0x36')](_0x52775f[_0xb7ea('0x35')]);_0x2f42a3[_0xb7ea('0x37')]=_[_0xb7ea('0x39')](_0x2f42a3[_0xb7ea('0x33')],_0x2f42a3[_0xb7ea('0x35')]);_0x7cb048['attributes']=_[_0xb7ea('0x39')](_0x2f42a3[_0xb7ea('0x33')],qs[_0xb7ea('0x3a')](_0x52775f[_0xb7ea('0x35')][_0xb7ea('0x3a')]));_0x7cb048['attributes']=_0x7cb048[_0xb7ea('0x38')][_0xb7ea('0x4a')]?_0x7cb048[_0xb7ea('0x38')]:_0x2f42a3[_0xb7ea('0x33')];_0x7cb048[_0xb7ea('0x60')]=qs['sort'](_0x52775f[_0xb7ea('0x35')][_0xb7ea('0x3d')]);_0x7cb048[_0xb7ea('0x3e')]=qs[_0xb7ea('0x37')](_[_0xb7ea('0x3f')](_0x52775f[_0xb7ea('0x35')],_0x2f42a3[_0xb7ea('0x37')]));if(_0x52775f[_0xb7ea('0x35')]['filter']){_0x7cb048['where']=_[_0xb7ea('0x41')](_0x7cb048[_0xb7ea('0x3e')],{'$or':_[_0xb7ea('0x34')](_0x7cb048[_0xb7ea('0x38')],function(_0x49152a){var _0x6e67c4={};_0x6e67c4[_0x49152a]={'$like':'%'+_0x52775f[_0xb7ea('0x35')][_0xb7ea('0x40')]+'%'};return _0x6e67c4;})});}_0x7cb048=_[_0xb7ea('0x41')]({},_0x7cb048,_0x52775f[_0xb7ea('0x43')]);return _0x585bef[_0xb7ea('0x86')](_0x7cb048);}})[_0xb7ea('0x25')](function(_0x56787b){if(_0x56787b){_0x380243=_0x56787b[_0xb7ea('0x4a')];if(!_0x52775f[_0xb7ea('0x35')]['hasOwnProperty'](_0xb7ea('0x3c'))){_0x7cb048['limit']=qs['limit'](_0x52775f[_0xb7ea('0x35')]['limit']);_0x7cb048['offset']=qs[_0xb7ea('0x1b')](_0x52775f['query'][_0xb7ea('0x1b')]);}return _0x585bef['getBlackLists'](_0x7cb048);}})[_0xb7ea('0x25')](function(_0x43f355){if(_0x43f355){return _0x43f355?{'count':_0x380243,'rows':_0x43f355}:null;}})[_0xb7ea('0x25')](respondWithResult(_0x2cb202,null))[_0xb7ea('0x47')](handleError(_0x2cb202,null));};exports[_0xb7ea('0x87')]=function(_0x11f10c,_0x4a6dcb,_0x1b3ca1){var _0x2cda15,_0x13e4ea;return db['Campaign'][_0xb7ea('0x55')]({'where':{'id':_0x11f10c[_0xb7ea('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a6dcb,null))['then'](function(_0x58951c){if(_0x58951c){_0x13e4ea=_0x58951c;return _0x58951c[_0xb7ea('0x87')](_0x11f10c[_0xb7ea('0x4c')][_0xb7ea('0x69')],_['omit'](_0x11f10c['body'],[_0xb7ea('0x69'),'id'])||{});}return null;})['spread'](function(_0x13a105){var _0x57e623;_0x2cda15=_0x13a105||[];var _0x574f22=[];if(_0x13a105){for(var _0x478814=0x0;_0x478814<_0x13a105[_0xb7ea('0x4a')];_0x478814+=0x1){var _0x3f381a=_0x13a105[_0x478814][_0xb7ea('0x27')]({'plain':!![]});_0x57e623=squel[_0xb7ea('0x81')]()[_0xb7ea('0x6d')](_0xb7ea('0x88'))[_0xb7ea('0x6f')](['phone',_0xb7ea('0x72'),_0xb7ea('0x73'),_0xb7ea('0x5d'),_0xb7ea('0x57'),_0xb7ea('0x58')],squel[_0xb7ea('0x74')]()['field'](_0xb7ea('0x70'),_0xb7ea('0x70'))['field']('id','ContactId')[_0xb7ea('0x75')](_0x3f381a[_0xb7ea('0x77')][_0xb7ea('0x78')](),_0xb7ea('0x73'))[_0xb7ea('0x75')](_0x11f10c[_0xb7ea('0x49')]['id']['toString'](),_0xb7ea('0x5d'))[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x57'))[_0xb7ea('0x75')](_0xb7ea('0x76'),_0xb7ea('0x58'))[_0xb7ea('0x7e')]('cm_contacts')[_0xb7ea('0x3e')](_0xb7ea('0x79'))[_0xb7ea('0x3e')]('ListId\x20=\x20?',_0x3f381a['CmListId']['toString']())['where'](_0xb7ea('0x7b')))[_0xb7ea('0x78')]();_0x574f22[_0xb7ea('0x89')](db[_0xb7ea('0x84')]['query'](_0x57e623));}return BPromise[_0xb7ea('0x8a')](_0x574f22);}})[_0xb7ea('0x25')](function(){return _0x2cda15;})[_0xb7ea('0x25')](respondWithResult(_0x4a6dcb,null))[_0xb7ea('0x47')](handleError(_0x4a6dcb,null));};exports[_0xb7ea('0x8b')]=function(_0x913e9c,_0x536f50,_0x344919){return db[_0xb7ea('0x2f')][_0xb7ea('0x55')]({'where':{'id':_0x913e9c[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](handleEntityNotFound(_0x536f50,null))[_0xb7ea('0x25')](function(_0x50c695){if(_0x50c695){return _0x50c695[_0xb7ea('0x8b')](_0x913e9c[_0xb7ea('0x35')][_0xb7ea('0x69')]);}})[_0xb7ea('0x25')](function(_0xac5c5e){if(_0xac5c5e){return db[_0xb7ea('0x65')][_0xb7ea('0x26')]({'where':{'ListId':_0x913e9c[_0xb7ea('0x35')][_0xb7ea('0x69')],'CampaignId':_0x913e9c[_0xb7ea('0x49')]['id']}})[_0xb7ea('0x25')](function(){return _0xac5c5e;});}})[_0xb7ea('0x25')](respondWithStatusCode(_0x536f50,null))[_0xb7ea('0x47')](handleError(_0x536f50,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 17b2e15..f0808d3 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(_0x49dd26,_0x9e5a5d){var _0x45f549=function(_0x8a8d93){while(--_0x8a8d93){_0x49dd26['push'](_0x49dd26['shift']());}};_0x45f549(++_0x9e5a5d);}(_0x7a54,0x106));var _0x47a5=function(_0x1c25e5,_0xfb6548){_0x1c25e5=_0x1c25e5-0x0;var _0x4a66cc=_0x7a54[_0x1c25e5];return _0x4a66cc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x7a54,0x106));var _0x47a5=function(_0x6e3d42,_0x434edc){_0x6e3d42=_0x6e3d42-0x0;var _0x3a8a0b=_0x7a54[_0x6e3d42];return _0x3a8a0b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index f265864..8432010 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 _0x1e69=['include','model','map','then','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit'];(function(_0x44c31c,_0x538c1d){var _0x27f211=function(_0x3f4026){while(--_0x3f4026){_0x44c31c['push'](_0x44c31c['shift']());}};_0x27f211(++_0x538c1d);}(_0x1e69,0x85));var _0x91e6=function(_0x769dd2,_0x51c569){_0x769dd2=_0x769dd2-0x0;var _0x103980=_0x1e69[_0x769dd2];return _0x103980;};'use strict';var _=require('lodash');var util=require(_0x91e6('0x0'));var moment=require(_0x91e6('0x1'));var BPromise=require(_0x91e6('0x2'));var rs=require(_0x91e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x91e6('0x4'));var logger=require(_0x91e6('0x5'))(_0x91e6('0x6'));var config=require(_0x91e6('0x7'));var jayson=require(_0x91e6('0x8'));var client=jayson[_0x91e6('0x9')][_0x91e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2733bf,_0x1347c3,_0x375184){return new BPromise(function(_0x266fe6,_0x46edd7){return client[_0x91e6('0xb')](_0x2733bf,_0x375184)['then'](function(_0x57682b){logger[_0x91e6('0xc')](_0x91e6('0xd'),_0x1347c3,_0x91e6('0xe'));logger[_0x91e6('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1347c3,_0x91e6('0xe'),JSON[_0x91e6('0x10')](_0x57682b));if(_0x57682b[_0x91e6('0x11')]){if(_0x57682b[_0x91e6('0x11')]['code']===0x1f4){logger[_0x91e6('0x11')](_0x91e6('0xd'),_0x1347c3,_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);return _0x46edd7(_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);}logger[_0x91e6('0x11')]('Campaign,\x20%s,\x20%s',_0x1347c3,_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);return _0x266fe6(_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);}else{logger['info'](_0x91e6('0xd'),_0x1347c3,_0x91e6('0xe'));_0x266fe6(_0x57682b['result'][_0x91e6('0x12')]);}})['catch'](function(_0x57d30d){logger['error']('Campaign,\x20%s,\x20%s',_0x1347c3,_0x57d30d);_0x46edd7(_0x57d30d);});});}exports[_0x91e6('0x13')]=function(_0xdc9327){var _0x4b53b0=this;return new Promise(function(_0x5bda45,_0x368329){return db[_0x91e6('0x14')][_0x91e6('0x15')]({'raw':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')][_0x91e6('0x17')]===undefined?!![]:![]:!![],'where':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')][_0x91e6('0x18')]||null:null,'attributes':_0xdc9327[_0x91e6('0x16')]?_0xdc9327['options'][_0x91e6('0x19')]||null:null,'limit':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')][_0x91e6('0x1a')]||null:null,'include':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')]['include']?_['map'](_0xdc9327[_0x91e6('0x16')][_0x91e6('0x1b')],function(_0x581fcd){return{'model':db[_0x581fcd[_0x91e6('0x1c')]],'as':_0x581fcd['as'],'attributes':_0x581fcd['attributes'],'include':_0x581fcd[_0x91e6('0x1b')]?_[_0x91e6('0x1d')](_0x581fcd[_0x91e6('0x1b')],function(_0x1024a5){return{'model':db[_0x1024a5[_0x91e6('0x1c')]],'as':_0x1024a5['as'],'attributes':_0x1024a5[_0x91e6('0x19')],'include':_0x1024a5[_0x91e6('0x1b')]?_[_0x91e6('0x1d')](_0x1024a5[_0x91e6('0x1b')],function(_0x18c614){return{'model':db[_0x18c614[_0x91e6('0x1c')]],'as':_0x18c614['as'],'attributes':_0x18c614['attributes']};}):[]};}):[]};}):[]:[]})[_0x91e6('0x1e')](function(_0x360f21){logger[_0x91e6('0xc')](_0x91e6('0x13'),_0xdc9327);logger[_0x91e6('0xf')]('GetCampaign',_0xdc9327,JSON[_0x91e6('0x10')](_0x360f21));_0x5bda45(_0x360f21);})[_0x91e6('0x1f')](function(_0x4ca580){logger[_0x91e6('0x11')](_0x91e6('0x13'),_0x4ca580[_0x91e6('0x12')],_0xdc9327);_0x368329(_0x4b53b0['error'](0x1f4,_0x4ca580[_0x91e6('0x12')]));});});}; \ No newline at end of file +var _0x16d2=['include','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','map'];(function(_0x53b6ae,_0x3cb9f4){var _0x34f4b2=function(_0x4b3169){while(--_0x4b3169){_0x53b6ae['push'](_0x53b6ae['shift']());}};_0x34f4b2(++_0x3cb9f4);}(_0x16d2,0x123));var _0x216d=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0x16d2[_0x449b81];return _0xb9b60c;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('Campaign,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});}exports[_0x216d('0x19')]=function(_0x53d464){var _0x3b60dd=this;return new Promise(function(_0x5124ab,_0x4ddc51){return db[_0x216d('0x1a')][_0x216d('0x1b')]({'raw':_0x53d464['options']?_0x53d464[_0x216d('0x1c')][_0x216d('0x1d')]===undefined?!![]:![]:!![],'where':_0x53d464['options']?_0x53d464[_0x216d('0x1c')][_0x216d('0x1e')]||null:null,'attributes':_0x53d464[_0x216d('0x1c')]?_0x53d464[_0x216d('0x1c')]['attributes']||null:null,'limit':_0x53d464[_0x216d('0x1c')]?_0x53d464[_0x216d('0x1c')][_0x216d('0x1f')]||null:null,'include':_0x53d464[_0x216d('0x1c')]?_0x53d464[_0x216d('0x1c')]['include']?_[_0x216d('0x20')](_0x53d464[_0x216d('0x1c')][_0x216d('0x21')],function(_0x2880c6){return{'model':db[_0x2880c6[_0x216d('0x22')]],'as':_0x2880c6['as'],'attributes':_0x2880c6['attributes'],'include':_0x2880c6[_0x216d('0x21')]?_[_0x216d('0x20')](_0x2880c6[_0x216d('0x21')],function(_0x5998a1){return{'model':db[_0x5998a1['model']],'as':_0x5998a1['as'],'attributes':_0x5998a1['attributes'],'include':_0x5998a1['include']?_['map'](_0x5998a1[_0x216d('0x21')],function(_0x470d8a){return{'model':db[_0x470d8a[_0x216d('0x22')]],'as':_0x470d8a['as'],'attributes':_0x470d8a[_0x216d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x216d('0xe')](function(_0x47fa6d){logger['info'](_0x216d('0x19'),_0x53d464);logger['debug'](_0x216d('0x19'),_0x53d464,JSON[_0x216d('0x13')](_0x47fa6d));_0x5124ab(_0x47fa6d);})[_0x216d('0x18')](function(_0x20bc16){logger[_0x216d('0x14')](_0x216d('0x19'),_0x20bc16[_0x216d('0x16')],_0x53d464);_0x4ddc51(_0x3b60dd[_0x216d('0x14')](0x1f4,_0x20bc16[_0x216d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 960aefe..266d8ba 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 _0x2303=['getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x2303,0x75));var _0x3230=function(_0x378a00,_0x37f19b){_0x378a00=_0x378a00-0x0;var _0x327605=_0x2303[_0x378a00];return _0x327605;};'use strict';var multer=require(_0x3230('0x0'));var util=require(_0x3230('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3230('0x2'));var auth=require(_0x3230('0x3'));var interaction=require(_0x3230('0x4'));var config=require(_0x3230('0x5'));var controller=require(_0x3230('0x6'));router[_0x3230('0x7')]('/',auth[_0x3230('0x8')](),controller[_0x3230('0x9')]);router[_0x3230('0x7')](_0x3230('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3230('0x7')](_0x3230('0xb'),auth[_0x3230('0x8')](),controller[_0x3230('0xc')]);router[_0x3230('0x7')](_0x3230('0xd'),auth[_0x3230('0x8')](),controller[_0x3230('0xe')]);router[_0x3230('0x7')](_0x3230('0xf'),auth[_0x3230('0x8')](),controller['getHopperFinals']);router[_0x3230('0x7')](_0x3230('0x10'),auth[_0x3230('0x8')](),controller[_0x3230('0x11')]);router[_0x3230('0x7')](_0x3230('0x12'),auth[_0x3230('0x8')](),controller[_0x3230('0x13')]);router[_0x3230('0x7')](_0x3230('0x14'),auth[_0x3230('0x8')](),controller[_0x3230('0x15')]);router['post']('/',auth[_0x3230('0x8')](),controller[_0x3230('0x16')]);router[_0x3230('0x17')](_0x3230('0x18'),auth[_0x3230('0x8')](),controller[_0x3230('0x19')]);router[_0x3230('0x17')](_0x3230('0x12'),auth[_0x3230('0x8')](),controller[_0x3230('0x1a')]);router['post'](_0x3230('0x14'),auth['isAuthenticated'](),controller[_0x3230('0x1b')]);router[_0x3230('0x1c')](_0x3230('0xa'),auth[_0x3230('0x8')](),controller[_0x3230('0x1d')]);router[_0x3230('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x3230('0x1f')]);router['delete'](_0x3230('0x12'),auth['isAuthenticated'](),controller[_0x3230('0x20')]);router[_0x3230('0x1e')](_0x3230('0x14'),auth[_0x3230('0x8')](),controller[_0x3230('0x21')]);module['exports']=router; \ No newline at end of file +var _0x36b6=['destroy','removeLists','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','index','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','put','update','delete'];(function(_0x213c2f,_0x394152){var _0x43a27f=function(_0x469ab0){while(--_0x469ab0){_0x213c2f['push'](_0x213c2f['shift']());}};_0x43a27f(++_0x394152);}(_0x36b6,0x1bf));var _0x636b=function(_0x4e4bab,_0x46b901){_0x4e4bab=_0x4e4bab-0x0;var _0x44d282=_0x36b6[_0x4e4bab];return _0x44d282;};'use strict';var multer=require(_0x636b('0x0'));var util=require(_0x636b('0x1'));var path=require(_0x636b('0x2'));var timeout=require('connect-timeout');var express=require(_0x636b('0x3'));var router=express[_0x636b('0x4')]();var fs_extra=require(_0x636b('0x5'));var auth=require(_0x636b('0x6'));var interaction=require(_0x636b('0x7'));var config=require(_0x636b('0x8'));var controller=require(_0x636b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x636b('0xa')]);router[_0x636b('0xb')](_0x636b('0xc'),auth[_0x636b('0xd')](),controller[_0x636b('0xe')]);router['get'](_0x636b('0xf'),auth[_0x636b('0xd')](),controller[_0x636b('0x10')]);router[_0x636b('0xb')](_0x636b('0x11'),auth[_0x636b('0xd')](),controller[_0x636b('0x12')]);router[_0x636b('0xb')](_0x636b('0x13'),auth[_0x636b('0xd')](),controller[_0x636b('0x14')]);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x636b('0x15')]);router[_0x636b('0xb')](_0x636b('0x16'),auth[_0x636b('0xd')](),controller[_0x636b('0x17')]);router[_0x636b('0xb')](_0x636b('0x18'),auth[_0x636b('0xd')](),controller[_0x636b('0x19')]);router[_0x636b('0x1a')]('/',auth[_0x636b('0xd')](),controller[_0x636b('0x1b')]);router[_0x636b('0x1a')](_0x636b('0x1c'),auth[_0x636b('0xd')](),controller[_0x636b('0x1d')]);router[_0x636b('0x1a')](_0x636b('0x16'),auth[_0x636b('0xd')](),controller[_0x636b('0x1e')]);router[_0x636b('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0x636b('0x1f')]('/:id',auth[_0x636b('0xd')](),controller[_0x636b('0x20')]);router[_0x636b('0x21')](_0x636b('0xc'),auth[_0x636b('0xd')](),controller[_0x636b('0x22')]);router['delete'](_0x636b('0x16'),auth[_0x636b('0xd')](),controller[_0x636b('0x23')]);router['delete'](_0x636b('0x18'),auth[_0x636b('0xd')](),controller['removeBlackLists']);module[_0x636b('0x24')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 188f72d..34d4710 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 _0x7c4e=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x49475f,_0x31b9bd){var _0x2de658=function(_0x45de79){while(--_0x45de79){_0x49475f['push'](_0x49475f['shift']());}};_0x2de658(++_0x31b9bd);}(_0x7c4e,0x174));var _0xe7c4=function(_0x12ef39,_0x18d320){_0x12ef39=_0x12ef39-0x0;var _0x47a734=_0x7c4e[_0x12ef39];return _0x47a734;};'use strict';var Sequelize=require(_0xe7c4('0x0'));module[_0xe7c4('0x1')]={'key':{'type':Sequelize[_0xe7c4('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe7c4('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xe7c4('0x2')]},'name':{'type':Sequelize[_0xe7c4('0x4')],'get':function(){return this[_0xe7c4('0x5')](_0xe7c4('0x6'));}}}; \ No newline at end of file +var _0x6fd1=['exports','STRING','TEXT','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6fd1,0x77));var _0x16fd=function(_0x5738c8,_0x1217f1){_0x5738c8=_0x5738c8-0x0;var _0x2e5dcd=_0x6fd1[_0x5738c8];return _0x2e5dcd;};'use strict';var Sequelize=require(_0x16fd('0x0'));module[_0x16fd('0x1')]={'key':{'type':Sequelize[_0x16fd('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x16fd('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 62cd443..fea58f9 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 _0x361f=['hasOwnProperty','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','params','includeAll','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length'];(function(_0x388868,_0x3a3378){var _0x683d2a=function(_0xc2e05e){while(--_0xc2e05e){_0x388868['push'](_0x388868['shift']());}};_0x683d2a(++_0x3a3378);}(_0x361f,0x1bc));var _0xf361=function(_0x3f9f68,_0x4820d3){_0x3f9f68=_0x3f9f68-0x0;var _0x1ab658=_0x361f[_0x3f9f68];return _0x1ab658;};'use strict';var emlformat=require(_0xf361('0x0'));var rimraf=require(_0xf361('0x1'));var zipdir=require(_0xf361('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf361('0x3'));var Mustache=require('mustache');var util=require(_0xf361('0x4'));var path=require('path');var sox=require(_0xf361('0x5'));var csv=require(_0xf361('0x6'));var ejs=require(_0xf361('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf361('0x8'));var crypto=require(_0xf361('0x9'));var jsforce=require(_0xf361('0xa'));var deskjs=require(_0xf361('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf361('0xc'));var Redis=require(_0xf361('0xd'));var authService=require(_0xf361('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf361('0xf'));var hardwareService=require(_0xf361('0x10'));var logger=require(_0xf361('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf361('0x12'));var licenseUtil=require(_0xf361('0x13'));var db=require(_0xf361('0x14'))['db'];function respondWithStatusCode(_0x295eb0,_0x3cee4e){_0x3cee4e=_0x3cee4e||0xcc;return function(_0x16e746){if(_0x16e746){return _0x295eb0[_0xf361('0x15')](_0x3cee4e);}return _0x295eb0[_0xf361('0x16')](_0x3cee4e)[_0xf361('0x17')]();};}function respondWithResult(_0x3812e1,_0x4f578c){_0x4f578c=_0x4f578c||0xc8;return function(_0x16ea6f){if(_0x16ea6f){return _0x3812e1['status'](_0x4f578c)[_0xf361('0x18')](_0x16ea6f);}};}function respondWithFilteredResult(_0x3304f5,_0x2b4162){return function(_0x2277f8){if(_0x2277f8){var _0x57565a=typeof _0x2b4162[_0xf361('0x19')]===_0xf361('0x1a')&&typeof _0x2b4162[_0xf361('0x1b')]===_0xf361('0x1a');var _0x7f3e93=_0x2277f8[_0xf361('0x1c')];var _0x66f8d2=_0x57565a?0x0:_0x2b4162['offset'];var _0x55013f=_0x57565a?_0x2277f8[_0xf361('0x1c')]:_0x2b4162[_0xf361('0x19')]+_0x2b4162[_0xf361('0x1b')];var _0x191770;if(_0x55013f>=_0x7f3e93){_0x55013f=_0x7f3e93;_0x191770=0xc8;}else{_0x191770=0xce;}_0x3304f5['status'](_0x191770);return _0x3304f5['set'](_0xf361('0x1d'),_0x66f8d2+'-'+_0x55013f+'/'+_0x7f3e93)[_0xf361('0x18')](_0x2277f8);}return null;};}function patchUpdates(_0x55e0e6){return function(_0x5e3035){try{jsonpatch['apply'](_0x5e3035,_0x55e0e6,!![]);}catch(_0x2156bb){return BPromise['reject'](_0x2156bb);}return _0x5e3035[_0xf361('0x1e')]();};}function saveUpdates(_0x3e7458,_0x460ad4){return function(_0x2e3295){if(_0x2e3295){return _0x2e3295[_0xf361('0x1f')](_0x3e7458)[_0xf361('0x20')](function(_0x5e1729){return _0x5e1729;});}return null;};}function removeEntity(_0x4683d1,_0x1a3768){return function(_0xad7c0d){if(_0xad7c0d){return _0xad7c0d[_0xf361('0x21')]()[_0xf361('0x20')](function(){var _0x409d42=_0xad7c0d[_0xf361('0x22')]({'plain':!![]});var _0x4635df='CannedAnswers';return db[_0xf361('0x23')][_0xf361('0x21')]({'where':{'type':_0x4635df,'resourceId':_0x409d42['id']}})[_0xf361('0x20')](function(){return _0xad7c0d;});})[_0xf361('0x20')](function(){_0x4683d1[_0xf361('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227402,_0x538f3c){return function(_0x4851e6){if(!_0x4851e6){_0x227402[_0xf361('0x15')](0x194);}return _0x4851e6;};}function handleError(_0xf731cc,_0xd9a303){_0xd9a303=_0xd9a303||0x1f4;return function(_0x297562){logger[_0xf361('0x24')](_0x297562[_0xf361('0x25')]);if(_0x297562[_0xf361('0x26')]){delete _0x297562['name'];}_0xf731cc[_0xf361('0x16')](_0xd9a303)['send'](_0x297562);};}exports[_0xf361('0x27')]=function(_0x27ba64,_0x3fb029){var _0x1c199b={},_0x2df260={},_0x3bfae8={'count':0x0,'rows':[]};var _0x29f7d6=_[_0xf361('0x28')](db[_0xf361('0x29')][_0xf361('0x2a')],function(_0x1f2f86){return{'name':_0x1f2f86[_0xf361('0x2b')],'type':_0x1f2f86[_0xf361('0x2c')][_0xf361('0x2d')]};});_0x2df260['model']=_['map'](_0x29f7d6,_0xf361('0x26'));_0x2df260[_0xf361('0x2e')]=_[_0xf361('0x2f')](_0x27ba64[_0xf361('0x2e')]);_0x2df260[_0xf361('0x30')]=_[_0xf361('0x31')](_0x2df260['model'],_0x2df260[_0xf361('0x2e')]);_0x1c199b[_0xf361('0x32')]=_[_0xf361('0x31')](_0x2df260[_0xf361('0x33')],qs[_0xf361('0x34')](_0x27ba64[_0xf361('0x2e')]['fields']));_0x1c199b[_0xf361('0x32')]=_0x1c199b[_0xf361('0x32')][_0xf361('0x35')]?_0x1c199b[_0xf361('0x32')]:_0x2df260[_0xf361('0x33')];if(!_0x27ba64[_0xf361('0x2e')][_0xf361('0x36')]('nolimit')){_0x1c199b[_0xf361('0x1b')]=qs[_0xf361('0x1b')](_0x27ba64[_0xf361('0x2e')][_0xf361('0x1b')]);_0x1c199b['offset']=qs[_0xf361('0x19')](_0x27ba64[_0xf361('0x2e')][_0xf361('0x19')]);}_0x1c199b[_0xf361('0x37')]=qs[_0xf361('0x38')](_0x27ba64[_0xf361('0x2e')][_0xf361('0x38')]);_0x1c199b[_0xf361('0x39')]=qs[_0xf361('0x30')](_[_0xf361('0x3a')](_0x27ba64[_0xf361('0x2e')],_0x2df260[_0xf361('0x30')]),_0x29f7d6);if(_0x27ba64[_0xf361('0x2e')][_0xf361('0x3b')]){_0x1c199b[_0xf361('0x39')]=_['merge'](_0x1c199b[_0xf361('0x39')],{'$or':[{'key':{'$like':'%'+_0x27ba64[_0xf361('0x2e')][_0xf361('0x3b')]+'%'}},{'value':{'$like':'%'+_0x27ba64['query'][_0xf361('0x3b')]+'%'}}]});}_0x1c199b=_['merge']({},_0x1c199b,_0x27ba64[_0xf361('0x3c')]);var _0x41248f={'where':_0x1c199b['where']};return db[_0xf361('0x29')][_0xf361('0x1c')](_0x41248f)[_0xf361('0x20')](function(_0x29d883){_0x3bfae8[_0xf361('0x1c')]=_0x29d883;if(_0x27ba64['query']['includeAll']){_0x1c199b[_0xf361('0x3d')]=[{'all':!![]}];}return db[_0xf361('0x29')][_0xf361('0x3e')](_0x1c199b);})[_0xf361('0x20')](function(_0x580b75){_0x3bfae8[_0xf361('0x3f')]=_0x580b75;return _0x3bfae8;})['then'](respondWithFilteredResult(_0x3fb029,_0x1c199b))[_0xf361('0x40')](handleError(_0x3fb029,null));};exports[_0xf361('0x41')]=function(_0x474001,_0x2656a1){var _0x448355={'raw':!![],'where':{'id':_0x474001[_0xf361('0x42')]['id']}},_0x5d0b7c={};_0x5d0b7c[_0xf361('0x33')]=_[_0xf361('0x2f')](db['CannedAnswer'][_0xf361('0x2a')]);_0x5d0b7c['query']=_[_0xf361('0x2f')](_0x474001['query']);_0x5d0b7c[_0xf361('0x30')]=_[_0xf361('0x31')](_0x5d0b7c[_0xf361('0x33')],_0x5d0b7c[_0xf361('0x2e')]);_0x448355[_0xf361('0x32')]=_[_0xf361('0x31')](_0x5d0b7c[_0xf361('0x33')],qs[_0xf361('0x34')](_0x474001[_0xf361('0x2e')][_0xf361('0x34')]));_0x448355['attributes']=_0x448355[_0xf361('0x32')]['length']?_0x448355[_0xf361('0x32')]:_0x5d0b7c[_0xf361('0x33')];if(_0x474001[_0xf361('0x2e')][_0xf361('0x43')]){_0x448355['include']=[{'all':!![]}];}_0x448355=_['merge']({},_0x448355,_0x474001['options']);return db[_0xf361('0x29')]['find'](_0x448355)[_0xf361('0x20')](handleEntityNotFound(_0x2656a1,null))[_0xf361('0x20')](respondWithResult(_0x2656a1,null))[_0xf361('0x40')](handleError(_0x2656a1,null));};exports['update']=function(_0x2f0981,_0x40b489){if(_0x2f0981['body']['id']){delete _0x2f0981[_0xf361('0x44')]['id'];}return db['CannedAnswer'][_0xf361('0x45')]({'where':{'id':_0x2f0981[_0xf361('0x42')]['id']}})[_0xf361('0x20')](handleEntityNotFound(_0x40b489,null))['then'](saveUpdates(_0x2f0981[_0xf361('0x44')],null))['then'](respondWithResult(_0x40b489,null))[_0xf361('0x40')](handleError(_0x40b489,null));};exports[_0xf361('0x21')]=function(_0x13040d,_0x8d3b91){return db[_0xf361('0x29')][_0xf361('0x45')]({'where':{'id':_0x13040d['params']['id']}})[_0xf361('0x20')](handleEntityNotFound(_0x8d3b91,null))[_0xf361('0x20')](removeEntity(_0x8d3b91,null))[_0xf361('0x40')](handleError(_0x8d3b91,null));};exports[_0xf361('0x46')]=function(_0x1f6abc,_0x331bbe){var _0x3c7aa8={'key':_0x1f6abc[_0xf361('0x44')][_0xf361('0x2d')]};if(_0x1f6abc[_0xf361('0x44')][_0xf361('0x47')]){_0x3c7aa8[_0xf361('0x47')]=_0x1f6abc[_0xf361('0x44')][_0xf361('0x47')];}else if(_0x1f6abc[_0xf361('0x44')][_0xf361('0x48')]){_0x3c7aa8['SmsAccountId']=_0x1f6abc[_0xf361('0x44')][_0xf361('0x48')];}else if(_0x1f6abc[_0xf361('0x44')][_0xf361('0x49')]){_0x3c7aa8[_0xf361('0x49')]=_0x1f6abc['body'][_0xf361('0x49')];}else if(_0x1f6abc[_0xf361('0x44')][_0xf361('0x4a')]){_0x3c7aa8[_0xf361('0x4a')]=_0x1f6abc[_0xf361('0x44')][_0xf361('0x4a')];}return db[_0xf361('0x29')][_0xf361('0x45')]({'where':_0x3c7aa8})[_0xf361('0x20')](function(_0x3fef41){if(_0x3fef41){throw new db[(_0xf361('0x4b'))][(_0xf361('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xf361('0x46')](_0x1f6abc['body']);})[_0xf361('0x20')](function(_0x5e5c2e){var _0x43c126=_0x1f6abc[_0xf361('0x4d')][_0xf361('0x22')]({'plain':!![]});if(!_0x43c126)throw new Error(_0xf361('0x4e'));if(_0x43c126[_0xf361('0x4f')]===_0xf361('0x4d')){var _0x1314e9=_0x5e5c2e['get']({'plain':!![]});return db['UserProfileSection'][_0xf361('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x43c126[_0xf361('0x50')]},'raw':!![]})[_0xf361('0x20')](function(_0x5ce6a2){if(_0x5ce6a2&&_0x5ce6a2[_0xf361('0x51')]===0x0){return db[_0xf361('0x23')][_0xf361('0x46')]({'name':_0x1314e9['name'],'resourceId':_0x1314e9['id'],'type':_0x5ce6a2[_0xf361('0x26')],'sectionId':_0x5ce6a2['id']},{})[_0xf361('0x20')](function(){return _0x5e5c2e;});}else{return _0x5e5c2e;}})[_0xf361('0x40')](function(_0x170712){logger[_0xf361('0x24')](_0xf361('0x52'),_0x170712);throw _0x170712;});}return _0x5e5c2e;})[_0xf361('0x20')](respondWithResult(_0x331bbe,0xc9))[_0xf361('0x40')](handleError(_0x331bbe,null));}; \ No newline at end of file +var _0x0b22=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','CannedAnswers','destroy','end','error','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x4812c9,_0x154b76){var _0x4de61f=function(_0x42cd33){while(--_0x42cd33){_0x4812c9['push'](_0x4812c9['shift']());}};_0x4de61f(++_0x154b76);}(_0x0b22,0x16c));var _0x20b2=function(_0x4e9eb3,_0x2988b9){_0x4e9eb3=_0x4e9eb3-0x0;var _0xe62fab=_0x0b22[_0x4e9eb3];return _0xe62fab;};'use strict';var emlformat=require(_0x20b2('0x0'));var rimraf=require(_0x20b2('0x1'));var zipdir=require(_0x20b2('0x2'));var jsonpatch=require(_0x20b2('0x3'));var rp=require(_0x20b2('0x4'));var moment=require('moment');var BPromise=require(_0x20b2('0x5'));var Mustache=require(_0x20b2('0x6'));var util=require(_0x20b2('0x7'));var path=require(_0x20b2('0x8'));var sox=require(_0x20b2('0x9'));var csv=require(_0x20b2('0xa'));var ejs=require(_0x20b2('0xb'));var fs=require('fs');var fs_extra=require(_0x20b2('0xc'));var _=require(_0x20b2('0xd'));var squel=require(_0x20b2('0xe'));var crypto=require(_0x20b2('0xf'));var jsforce=require(_0x20b2('0x10'));var deskjs=require(_0x20b2('0x11'));var toCsv=require(_0x20b2('0xa'));var querystring=require(_0x20b2('0x12'));var Papa=require(_0x20b2('0x13'));var Redis=require(_0x20b2('0x14'));var authService=require(_0x20b2('0x15'));var qs=require(_0x20b2('0x16'));var as=require(_0x20b2('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20b2('0x18'))('api');var utils=require(_0x20b2('0x19'));var config=require(_0x20b2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x20b2('0x1b'))['db'];function respondWithStatusCode(_0x144ab7,_0x91bd0e){_0x91bd0e=_0x91bd0e||0xcc;return function(_0x13101e){if(_0x13101e){return _0x144ab7[_0x20b2('0x1c')](_0x91bd0e);}return _0x144ab7[_0x20b2('0x1d')](_0x91bd0e)['end']();};}function respondWithResult(_0x5b04bf,_0x2f08f5){_0x2f08f5=_0x2f08f5||0xc8;return function(_0x19f7f9){if(_0x19f7f9){return _0x5b04bf['status'](_0x2f08f5)['json'](_0x19f7f9);}};}function respondWithFilteredResult(_0x16f216,_0x1b1cac){return function(_0x38800b){if(_0x38800b){var _0x5b3d2a=typeof _0x1b1cac[_0x20b2('0x1e')]===_0x20b2('0x1f')&&typeof _0x1b1cac[_0x20b2('0x20')]===_0x20b2('0x1f');var _0x930705=_0x38800b['count'];var _0x32d451=_0x5b3d2a?0x0:_0x1b1cac['offset'];var _0x9d0c01=_0x5b3d2a?_0x38800b['count']:_0x1b1cac['offset']+_0x1b1cac['limit'];var _0x4ec6f9;if(_0x9d0c01>=_0x930705){_0x9d0c01=_0x930705;_0x4ec6f9=0xc8;}else{_0x4ec6f9=0xce;}_0x16f216['status'](_0x4ec6f9);return _0x16f216[_0x20b2('0x21')](_0x20b2('0x22'),_0x32d451+'-'+_0x9d0c01+'/'+_0x930705)['json'](_0x38800b);}return null;};}function patchUpdates(_0x58d92a){return function(_0x15a4b8){try{jsonpatch[_0x20b2('0x23')](_0x15a4b8,_0x58d92a,!![]);}catch(_0x4c3e24){return BPromise[_0x20b2('0x24')](_0x4c3e24);}return _0x15a4b8[_0x20b2('0x25')]();};}function saveUpdates(_0x3977ec,_0x5b488f){return function(_0x2ae7c1){if(_0x2ae7c1){return _0x2ae7c1[_0x20b2('0x26')](_0x3977ec)[_0x20b2('0x27')](function(_0x42f0cf){return _0x42f0cf;});}return null;};}function removeEntity(_0x59b6b0,_0x55e116){return function(_0x465d0f){if(_0x465d0f){return _0x465d0f['destroy']()[_0x20b2('0x27')](function(){var _0x2f02b1=_0x465d0f[_0x20b2('0x28')]({'plain':!![]});var _0x44358e=_0x20b2('0x29');return db['UserProfileResource'][_0x20b2('0x2a')]({'where':{'type':_0x44358e,'resourceId':_0x2f02b1['id']}})[_0x20b2('0x27')](function(){return _0x465d0f;});})[_0x20b2('0x27')](function(){_0x59b6b0[_0x20b2('0x1d')](0xcc)[_0x20b2('0x2b')]();});}};}function handleEntityNotFound(_0x44bf52,_0x5a43ce){return function(_0x178657){if(!_0x178657){_0x44bf52[_0x20b2('0x1c')](0x194);}return _0x178657;};}function handleError(_0x35eb84,_0x2417b5){_0x2417b5=_0x2417b5||0x1f4;return function(_0x23b02c){logger[_0x20b2('0x2c')](_0x23b02c['stack']);if(_0x23b02c['name']){delete _0x23b02c['name'];}_0x35eb84[_0x20b2('0x1d')](_0x2417b5)['send'](_0x23b02c);};}exports[_0x20b2('0x2d')]=function(_0x4a797a,_0x4312af){var _0x816d40={},_0x21a9c1={},_0x2f7a2a={'count':0x0,'rows':[]};var _0x1efdd0=_[_0x20b2('0x2e')](db[_0x20b2('0x2f')][_0x20b2('0x30')],function(_0x48584b){return{'name':_0x48584b[_0x20b2('0x31')],'type':_0x48584b[_0x20b2('0x32')][_0x20b2('0x33')]};});_0x21a9c1[_0x20b2('0x34')]=_['map'](_0x1efdd0,_0x20b2('0x35'));_0x21a9c1[_0x20b2('0x36')]=_[_0x20b2('0x37')](_0x4a797a[_0x20b2('0x36')]);_0x21a9c1[_0x20b2('0x38')]=_[_0x20b2('0x39')](_0x21a9c1['model'],_0x21a9c1[_0x20b2('0x36')]);_0x816d40['attributes']=_[_0x20b2('0x39')](_0x21a9c1[_0x20b2('0x34')],qs[_0x20b2('0x3a')](_0x4a797a[_0x20b2('0x36')][_0x20b2('0x3a')]));_0x816d40[_0x20b2('0x3b')]=_0x816d40[_0x20b2('0x3b')][_0x20b2('0x3c')]?_0x816d40[_0x20b2('0x3b')]:_0x21a9c1[_0x20b2('0x34')];if(!_0x4a797a[_0x20b2('0x36')][_0x20b2('0x3d')]('nolimit')){_0x816d40[_0x20b2('0x20')]=qs[_0x20b2('0x20')](_0x4a797a[_0x20b2('0x36')][_0x20b2('0x20')]);_0x816d40[_0x20b2('0x1e')]=qs['offset'](_0x4a797a['query'][_0x20b2('0x1e')]);}_0x816d40[_0x20b2('0x3e')]=qs['sort'](_0x4a797a[_0x20b2('0x36')][_0x20b2('0x3f')]);_0x816d40[_0x20b2('0x40')]=qs['filters'](_[_0x20b2('0x41')](_0x4a797a[_0x20b2('0x36')],_0x21a9c1[_0x20b2('0x38')]),_0x1efdd0);if(_0x4a797a['query'][_0x20b2('0x42')]){_0x816d40[_0x20b2('0x40')]=_[_0x20b2('0x43')](_0x816d40[_0x20b2('0x40')],{'$or':[{'key':{'$like':'%'+_0x4a797a[_0x20b2('0x36')][_0x20b2('0x42')]+'%'}},{'value':{'$like':'%'+_0x4a797a[_0x20b2('0x36')][_0x20b2('0x42')]+'%'}}]});}_0x816d40=_[_0x20b2('0x43')]({},_0x816d40,_0x4a797a[_0x20b2('0x44')]);var _0x556497={'where':_0x816d40['where']};return db['CannedAnswer'][_0x20b2('0x45')](_0x556497)[_0x20b2('0x27')](function(_0x1acbef){_0x2f7a2a['count']=_0x1acbef;if(_0x4a797a['query'][_0x20b2('0x46')]){_0x816d40['include']=[{'all':!![]}];}return db[_0x20b2('0x2f')][_0x20b2('0x47')](_0x816d40);})[_0x20b2('0x27')](function(_0x587c2a){_0x2f7a2a[_0x20b2('0x48')]=_0x587c2a;return _0x2f7a2a;})[_0x20b2('0x27')](respondWithFilteredResult(_0x4312af,_0x816d40))[_0x20b2('0x49')](handleError(_0x4312af,null));};exports[_0x20b2('0x4a')]=function(_0x2ac47c,_0x39e905){var _0x1109b9={'raw':!![],'where':{'id':_0x2ac47c[_0x20b2('0x4b')]['id']}},_0x35e124={};_0x35e124[_0x20b2('0x34')]=_[_0x20b2('0x37')](db[_0x20b2('0x2f')][_0x20b2('0x30')]);_0x35e124[_0x20b2('0x36')]=_['keys'](_0x2ac47c['query']);_0x35e124[_0x20b2('0x38')]=_[_0x20b2('0x39')](_0x35e124[_0x20b2('0x34')],_0x35e124[_0x20b2('0x36')]);_0x1109b9['attributes']=_[_0x20b2('0x39')](_0x35e124[_0x20b2('0x34')],qs[_0x20b2('0x3a')](_0x2ac47c[_0x20b2('0x36')][_0x20b2('0x3a')]));_0x1109b9['attributes']=_0x1109b9[_0x20b2('0x3b')][_0x20b2('0x3c')]?_0x1109b9['attributes']:_0x35e124[_0x20b2('0x34')];if(_0x2ac47c[_0x20b2('0x36')][_0x20b2('0x46')]){_0x1109b9['include']=[{'all':!![]}];}_0x1109b9=_['merge']({},_0x1109b9,_0x2ac47c[_0x20b2('0x44')]);return db[_0x20b2('0x2f')][_0x20b2('0x4c')](_0x1109b9)[_0x20b2('0x27')](handleEntityNotFound(_0x39e905,null))[_0x20b2('0x27')](respondWithResult(_0x39e905,null))[_0x20b2('0x49')](handleError(_0x39e905,null));};exports[_0x20b2('0x26')]=function(_0x4ed9a8,_0x5e5e87){if(_0x4ed9a8[_0x20b2('0x4d')]['id']){delete _0x4ed9a8[_0x20b2('0x4d')]['id'];}return db['CannedAnswer'][_0x20b2('0x4c')]({'where':{'id':_0x4ed9a8['params']['id']}})[_0x20b2('0x27')](handleEntityNotFound(_0x5e5e87,null))[_0x20b2('0x27')](saveUpdates(_0x4ed9a8['body'],null))['then'](respondWithResult(_0x5e5e87,null))[_0x20b2('0x49')](handleError(_0x5e5e87,null));};exports[_0x20b2('0x2a')]=function(_0x1ae59e,_0x49b595){return db['CannedAnswer'][_0x20b2('0x4c')]({'where':{'id':_0x1ae59e[_0x20b2('0x4b')]['id']}})[_0x20b2('0x27')](handleEntityNotFound(_0x49b595,null))[_0x20b2('0x27')](removeEntity(_0x49b595,null))[_0x20b2('0x49')](handleError(_0x49b595,null));};exports[_0x20b2('0x4e')]=function(_0x497747,_0x19e40a){var _0x434a0b={'key':_0x497747[_0x20b2('0x4d')][_0x20b2('0x33')]};if(_0x497747['body'][_0x20b2('0x4f')]){_0x434a0b[_0x20b2('0x4f')]=_0x497747[_0x20b2('0x4d')][_0x20b2('0x4f')];}else if(_0x497747[_0x20b2('0x4d')][_0x20b2('0x50')]){_0x434a0b['SmsAccountId']=_0x497747['body'][_0x20b2('0x50')];}else if(_0x497747[_0x20b2('0x4d')][_0x20b2('0x51')]){_0x434a0b[_0x20b2('0x51')]=_0x497747['body'][_0x20b2('0x51')];}else if(_0x497747[_0x20b2('0x4d')]['ChatWebsiteId']){_0x434a0b[_0x20b2('0x52')]=_0x497747[_0x20b2('0x4d')][_0x20b2('0x52')];}return db['CannedAnswer'][_0x20b2('0x4c')]({'where':_0x434a0b})[_0x20b2('0x27')](function(_0x34dca6){if(_0x34dca6){throw new db[(_0x20b2('0x53'))][(_0x20b2('0x54'))](_0x20b2('0x55'));}return db[_0x20b2('0x2f')][_0x20b2('0x4e')](_0x497747[_0x20b2('0x4d')]);})[_0x20b2('0x27')](function(_0x59a6fd){var _0x292a0b=_0x497747[_0x20b2('0x56')][_0x20b2('0x28')]({'plain':!![]});if(!_0x292a0b)throw new Error(_0x20b2('0x57'));if(_0x292a0b[_0x20b2('0x58')]==='user'){var _0xadc779=_0x59a6fd[_0x20b2('0x28')]({'plain':!![]});return db[_0x20b2('0x59')]['find']({'where':{'name':_0x20b2('0x29'),'userProfileId':_0x292a0b[_0x20b2('0x5a')]},'raw':!![]})[_0x20b2('0x27')](function(_0x20fc22){if(_0x20fc22&&_0x20fc22[_0x20b2('0x5b')]===0x0){return db['UserProfileResource'][_0x20b2('0x4e')]({'name':_0xadc779['name'],'resourceId':_0xadc779['id'],'type':_0x20fc22['name'],'sectionId':_0x20fc22['id']},{})['then'](function(){return _0x59a6fd;});}else{return _0x59a6fd;}})[_0x20b2('0x49')](function(_0x59fd99){logger[_0x20b2('0x2c')](_0x20b2('0x5c'),_0x59fd99);throw _0x59fd99;});}return _0x59a6fd;})[_0x20b2('0x27')](respondWithResult(_0x19e40a,0xc9))['catch'](handleError(_0x19e40a,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 93166eb..8523628 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 _0x1bdd=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x43e87d,_0x3a70f3){var _0x378640=function(_0x35cf78){while(--_0x35cf78){_0x43e87d['push'](_0x43e87d['shift']());}};_0x378640(++_0x3a70f3);}(_0x1bdd,0x168));var _0xd1bd=function(_0x379936,_0xd03c71){_0x379936=_0x379936-0x0;var _0x553745=_0x1bdd[_0x379936];return _0x553745;};'use strict';var _=require(_0xd1bd('0x0'));var util=require(_0xd1bd('0x1'));var logger=require('../../config/logger')(_0xd1bd('0x2'));var moment=require(_0xd1bd('0x3'));var BPromise=require('bluebird');var rp=require(_0xd1bd('0x4'));var fs=require('fs');var path=require(_0xd1bd('0x5'));var rimraf=require(_0xd1bd('0x6'));var config=require(_0xd1bd('0x7'));var attributes=require(_0xd1bd('0x8'));module[_0xd1bd('0x9')]=function(_0x35cf24,_0x409a88){return _0x35cf24[_0xd1bd('0xa')](_0xd1bd('0xb'),attributes,{'tableName':_0xd1bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd1bd('0xd'),'collate':_0xd1bd('0xe')});}; \ No newline at end of file +var _0xcf9d=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers'];(function(_0xde597,_0x3da70a){var _0x32de13=function(_0x596b4a){while(--_0x596b4a){_0xde597['push'](_0xde597['shift']());}};_0x32de13(++_0x3da70a);}(_0xcf9d,0x147));var _0xdcf9=function(_0x3e5879,_0x3aba17){_0x3e5879=_0x3e5879-0x0;var _0x4f0915=_0xcf9d[_0x3e5879];return _0x4f0915;};'use strict';var _=require('lodash');var util=require(_0xdcf9('0x0'));var logger=require(_0xdcf9('0x1'))(_0xdcf9('0x2'));var moment=require(_0xdcf9('0x3'));var BPromise=require(_0xdcf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcf9('0x5'));var rimraf=require('rimraf');var config=require(_0xdcf9('0x6'));var attributes=require(_0xdcf9('0x7'));module['exports']=function(_0x20db35,_0x2c08d8){return _0x20db35[_0xdcf9('0x8')](_0xdcf9('0x9'),attributes,{'tableName':_0xdcf9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdcf9('0xb'),'collate':_0xdcf9('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b252f4e..755a4c0 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(_0x214f3f,_0x39b4e5){var _0x2f15d8=function(_0x4db6bb){while(--_0x4db6bb){_0x214f3f['push'](_0x214f3f['shift']());}};_0x2f15d8(++_0x39b4e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x504e69,_0x1c66fd){var _0x1eca13=function(_0x4bf759){while(--_0x4bf759){_0x504e69['push'](_0x504e69['shift']());}};_0x1eca13(++_0x1c66fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 42c86be..7f07579 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 _0xc706=['fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x54f759,_0x4859d9){var _0x3f58ba=function(_0x337e5f){while(--_0x337e5f){_0x54f759['push'](_0x54f759['shift']());}};_0x3f58ba(++_0x4859d9);}(_0xc706,0x1dd));var _0x6c70=function(_0x3cc442,_0x4b0c53){_0x3cc442=_0x3cc442-0x0;var _0x2fed3f=_0xc706[_0x3cc442];return _0x2fed3f;};'use strict';var multer=require(_0x6c70('0x0'));var util=require(_0x6c70('0x1'));var path=require(_0x6c70('0x2'));var timeout=require(_0x6c70('0x3'));var express=require(_0x6c70('0x4'));var router=express[_0x6c70('0x5')]();var fs_extra=require(_0x6c70('0x6'));var auth=require(_0x6c70('0x7'));var interaction=require(_0x6c70('0x8'));var config=require('../../config/environment');var controller=require(_0x6c70('0x9'));router[_0x6c70('0xa')]('/',auth[_0x6c70('0xb')](),controller[_0x6c70('0xc')]);router[_0x6c70('0xa')](_0x6c70('0xd'),auth[_0x6c70('0xb')](),controller[_0x6c70('0xe')]);router[_0x6c70('0xf')]('/',auth[_0x6c70('0xb')](),controller[_0x6c70('0x10')]);router['put'](_0x6c70('0xd'),auth[_0x6c70('0xb')](),controller[_0x6c70('0x11')]);router[_0x6c70('0x12')](_0x6c70('0xd'),auth[_0x6c70('0xb')](),controller[_0x6c70('0x13')]);module[_0x6c70('0x14')]=router; \ No newline at end of file +var _0xdb72=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller'];(function(_0xe02272,_0x158c06){var _0x2cc54d=function(_0x511215){while(--_0x511215){_0xe02272['push'](_0xe02272['shift']());}};_0x2cc54d(++_0x158c06);}(_0xdb72,0x89));var _0x2db7=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0xdb72[_0x351b46];return _0x1515df;};'use strict';var multer=require('multer');var util=require(_0x2db7('0x0'));var path=require('path');var timeout=require(_0x2db7('0x1'));var express=require(_0x2db7('0x2'));var router=express[_0x2db7('0x3')]();var fs_extra=require(_0x2db7('0x4'));var auth=require(_0x2db7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2db7('0x6'));router[_0x2db7('0x7')]('/',auth[_0x2db7('0x8')](),controller[_0x2db7('0x9')]);router[_0x2db7('0x7')](_0x2db7('0xa'),auth[_0x2db7('0x8')](),controller['show']);router[_0x2db7('0xb')]('/',auth[_0x2db7('0x8')](),controller[_0x2db7('0xc')]);router[_0x2db7('0xd')](_0x2db7('0xa'),auth[_0x2db7('0x8')](),controller[_0x2db7('0xe')]);router[_0x2db7('0xf')](_0x2db7('0xa'),auth['isAuthenticated'](),controller[_0x2db7('0x10')]);module[_0x2db7('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d208251..58d8d39 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 _0xb226=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xb226,0x11c));var _0x6b22=function(_0x5ab847,_0x124c13){_0x5ab847=_0x5ab847-0x0;var _0xf6db63=_0xb226[_0x5ab847];return _0xf6db63;};'use strict';var Sequelize=require(_0x6b22('0x0'));module[_0x6b22('0x1')]={'calldate':{'type':Sequelize[_0x6b22('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x6b22('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x6b22('0x3')]},'dcontext':{'type':Sequelize[_0x6b22('0x3')]},'channel':{'type':Sequelize[_0x6b22('0x3')]},'dstchannel':{'type':Sequelize[_0x6b22('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6b22('0x3')]},'duration':{'type':Sequelize[_0x6b22('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6b22('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6b22('0x3')]},'amaflags':{'type':Sequelize[_0x6b22('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6b22('0x3')]},'userfield':{'type':Sequelize[_0x6b22('0x3')]},'uniqueid':{'type':Sequelize[_0x6b22('0x3')]},'linkedid':{'type':Sequelize[_0x6b22('0x3')]},'sequence':{'type':Sequelize[_0x6b22('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6b22('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9224=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x3c5a79,_0x565097){var _0x52835f=function(_0x139063){while(--_0x139063){_0x3c5a79['push'](_0x3c5a79['shift']());}};_0x52835f(++_0x565097);}(_0x9224,0xa3));var _0x4922=function(_0x2bcaca,_0x3b9989){_0x2bcaca=_0x2bcaca-0x0;var _0x3edd25=_0x9224[_0x2bcaca];return _0x3edd25;};'use strict';var Sequelize=require('sequelize');module[_0x4922('0x0')]={'calldate':{'type':Sequelize[_0x4922('0x1')],'allowNull':![],'defaultValue':_0x4922('0x2')},'clid':{'type':Sequelize[_0x4922('0x3')]},'src':{'type':Sequelize[_0x4922('0x3')]},'dst':{'type':Sequelize[_0x4922('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x4922('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x4922('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4922('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4922('0x3')]},'amaflags':{'type':Sequelize[_0x4922('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4922('0x3')]},'userfield':{'type':Sequelize[_0x4922('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x4922('0x3')]},'sequence':{'type':Sequelize[_0x4922('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4922('0x3')]},'tag':{'type':Sequelize[_0x4922('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index df7febe..9dfa1ff 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 _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end'];(function(_0xeb2378,_0x2d026c){var _0x367389=function(_0x3fe1f1){while(--_0x3fe1f1){_0xeb2378['push'](_0xeb2378['shift']());}};_0x367389(++_0x2d026c);}(_0x0e85,0x7c));var _0x50e8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x0e85[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file +var _0x90b5=['nolimit','limit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','then','error','stack','name','send','index','Cdr','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x2db79f,_0x51f8dd){var _0x162aac=function(_0x5c8240){while(--_0x5c8240){_0x2db79f['push'](_0x2db79f['shift']());}};_0x162aac(++_0x51f8dd);}(_0x90b5,0x139));var _0x590b=function(_0x4750da,_0x25dd7e){_0x4750da=_0x4750da-0x0;var _0x38cb4d=_0x90b5[_0x4750da];return _0x38cb4d;};'use strict';var emlformat=require(_0x590b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x590b('0x1'));var jsonpatch=require(_0x590b('0x2'));var rp=require(_0x590b('0x3'));var moment=require(_0x590b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x590b('0x5'));var path=require(_0x590b('0x6'));var sox=require('sox');var csv=require(_0x590b('0x7'));var ejs=require(_0x590b('0x8'));var fs=require('fs');var fs_extra=require(_0x590b('0x9'));var _=require('lodash');var squel=require(_0x590b('0xa'));var crypto=require(_0x590b('0xb'));var jsforce=require(_0x590b('0xc'));var deskjs=require(_0x590b('0xd'));var toCsv=require(_0x590b('0x7'));var querystring=require(_0x590b('0xe'));var Papa=require(_0x590b('0xf'));var Redis=require(_0x590b('0x10'));var authService=require(_0x590b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x590b('0x12'));var hardwareService=require(_0x590b('0x13'));var logger=require('../../config/logger')(_0x590b('0x14'));var utils=require('../../config/utils');var config=require(_0x590b('0x15'));var licenseUtil=require(_0x590b('0x16'));var db=require(_0x590b('0x17'))['db'];function respondWithStatusCode(_0x477069,_0x527487){_0x527487=_0x527487||0xcc;return function(_0xb0ca22){if(_0xb0ca22){return _0x477069[_0x590b('0x18')](_0x527487);}return _0x477069[_0x590b('0x19')](_0x527487)[_0x590b('0x1a')]();};}function respondWithResult(_0x2e85b1,_0x6ad7e7){_0x6ad7e7=_0x6ad7e7||0xc8;return function(_0x45ac04){if(_0x45ac04){return _0x2e85b1[_0x590b('0x19')](_0x6ad7e7)[_0x590b('0x1b')](_0x45ac04);}};}function respondWithFilteredResult(_0x1fbc84,_0x3fc5ca){return function(_0x260f47){if(_0x260f47){var _0x3e4723=typeof _0x3fc5ca[_0x590b('0x1c')]===_0x590b('0x1d')&&typeof _0x3fc5ca['limit']===_0x590b('0x1d');var _0x530e24=_0x260f47[_0x590b('0x1e')];var _0x115309=_0x3e4723?0x0:_0x3fc5ca[_0x590b('0x1c')];var _0x53337c=_0x3e4723?_0x260f47['count']:_0x3fc5ca[_0x590b('0x1c')]+_0x3fc5ca['limit'];var _0x21e771;if(_0x53337c>=_0x530e24){_0x53337c=_0x530e24;_0x21e771=0xc8;}else{_0x21e771=0xce;}_0x1fbc84[_0x590b('0x19')](_0x21e771);return _0x1fbc84[_0x590b('0x1f')]('Content-Range',_0x115309+'-'+_0x53337c+'/'+_0x530e24)[_0x590b('0x1b')](_0x260f47);}return null;};}function patchUpdates(_0x8ab843){return function(_0x2b8ea0){try{jsonpatch[_0x590b('0x20')](_0x2b8ea0,_0x8ab843,!![]);}catch(_0x4990ba){return BPromise[_0x590b('0x21')](_0x4990ba);}return _0x2b8ea0['save']();};}function saveUpdates(_0x10a339,_0x30dc9f){return function(_0x5bdaba){if(_0x5bdaba){return _0x5bdaba['update'](_0x10a339)[_0x590b('0x22')](function(_0x2bcfca){return _0x2bcfca;});}return null;};}function removeEntity(_0x52bdad,_0x21638c){return function(_0x1045d5){if(_0x1045d5){return _0x1045d5['destroy']()['then'](function(){_0x52bdad[_0x590b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fead,_0x520095){return function(_0x4d3ff9){if(!_0x4d3ff9){_0x39fead[_0x590b('0x18')](0x194);}return _0x4d3ff9;};}function handleError(_0x20571b,_0x5cf6b6){_0x5cf6b6=_0x5cf6b6||0x1f4;return function(_0x1febcd){logger[_0x590b('0x23')](_0x1febcd[_0x590b('0x24')]);if(_0x1febcd[_0x590b('0x25')]){delete _0x1febcd[_0x590b('0x25')];}_0x20571b['status'](_0x5cf6b6)[_0x590b('0x26')](_0x1febcd);};}exports[_0x590b('0x27')]=function(_0x333af8,_0x38a64a){var _0x1ee769={},_0x3b881f={},_0x5ee979={'count':0x0,'rows':[]};var _0x1dfce0=_['map'](db[_0x590b('0x28')][_0x590b('0x29')],function(_0x448ab3){return{'name':_0x448ab3[_0x590b('0x2a')],'type':_0x448ab3['type'][_0x590b('0x2b')]};});_0x3b881f['model']=_[_0x590b('0x2c')](_0x1dfce0,_0x590b('0x25'));_0x3b881f[_0x590b('0x2d')]=_[_0x590b('0x2e')](_0x333af8[_0x590b('0x2d')]);_0x3b881f['filters']=_[_0x590b('0x2f')](_0x3b881f[_0x590b('0x30')],_0x3b881f[_0x590b('0x2d')]);_0x1ee769[_0x590b('0x31')]=_['intersection'](_0x3b881f['model'],qs[_0x590b('0x32')](_0x333af8[_0x590b('0x2d')][_0x590b('0x32')]));_0x1ee769[_0x590b('0x31')]=_0x1ee769['attributes']['length']?_0x1ee769[_0x590b('0x31')]:_0x3b881f['model'];if(!_0x333af8[_0x590b('0x2d')][_0x590b('0x33')](_0x590b('0x34'))){_0x1ee769[_0x590b('0x35')]=qs[_0x590b('0x35')](_0x333af8[_0x590b('0x2d')][_0x590b('0x35')]);_0x1ee769[_0x590b('0x1c')]=qs[_0x590b('0x1c')](_0x333af8[_0x590b('0x2d')]['offset']);}_0x1ee769['order']=qs[_0x590b('0x36')](_0x333af8[_0x590b('0x2d')][_0x590b('0x36')]);_0x1ee769[_0x590b('0x37')]=qs[_0x590b('0x38')](_['pick'](_0x333af8[_0x590b('0x2d')],_0x3b881f[_0x590b('0x38')]),_0x1dfce0);if(_0x333af8[_0x590b('0x2d')][_0x590b('0x39')]){_0x1ee769[_0x590b('0x37')]=_['merge'](_0x1ee769[_0x590b('0x37')],{'$or':_[_0x590b('0x2c')](_0x1dfce0,function(_0x4e3f84){if(_0x4e3f84['type']!==_0x590b('0x3a')){var _0x4be52e={};_0x4be52e[_0x4e3f84[_0x590b('0x25')]]={'$like':'%'+_0x333af8[_0x590b('0x2d')][_0x590b('0x39')]+'%'};return _0x4be52e;}})});}_0x1ee769=_[_0x590b('0x3b')]({},_0x1ee769,_0x333af8[_0x590b('0x3c')]);var _0x419e6a={'where':_0x1ee769[_0x590b('0x37')]};return db[_0x590b('0x28')][_0x590b('0x1e')](_0x419e6a)[_0x590b('0x22')](function(_0x593b35){_0x5ee979[_0x590b('0x1e')]=_0x593b35;if(_0x333af8[_0x590b('0x2d')][_0x590b('0x3d')]){_0x1ee769['include']=[{'all':!![]}];}return db[_0x590b('0x28')][_0x590b('0x3e')](_0x1ee769);})[_0x590b('0x22')](function(_0x114bbe){_0x5ee979[_0x590b('0x3f')]=_0x114bbe;return _0x5ee979;})[_0x590b('0x22')](respondWithFilteredResult(_0x38a64a,_0x1ee769))[_0x590b('0x40')](handleError(_0x38a64a,null));};exports[_0x590b('0x41')]=function(_0x58c62e,_0x7da2e3){var _0x5984c0={'raw':!![],'where':{'id':_0x58c62e[_0x590b('0x42')]['id']}},_0xb345c0={};_0xb345c0[_0x590b('0x30')]=_['keys'](db[_0x590b('0x28')][_0x590b('0x29')]);_0xb345c0[_0x590b('0x2d')]=_[_0x590b('0x2e')](_0x58c62e['query']);_0xb345c0[_0x590b('0x38')]=_[_0x590b('0x2f')](_0xb345c0['model'],_0xb345c0['query']);_0x5984c0['attributes']=_[_0x590b('0x2f')](_0xb345c0[_0x590b('0x30')],qs[_0x590b('0x32')](_0x58c62e['query']['fields']));_0x5984c0[_0x590b('0x31')]=_0x5984c0[_0x590b('0x31')]['length']?_0x5984c0[_0x590b('0x31')]:_0xb345c0[_0x590b('0x30')];if(_0x58c62e[_0x590b('0x2d')][_0x590b('0x3d')]){_0x5984c0[_0x590b('0x43')]=[{'all':!![]}];}_0x5984c0=_[_0x590b('0x3b')]({},_0x5984c0,_0x58c62e[_0x590b('0x3c')]);return db[_0x590b('0x28')][_0x590b('0x44')](_0x5984c0)[_0x590b('0x22')](handleEntityNotFound(_0x7da2e3,null))[_0x590b('0x22')](respondWithResult(_0x7da2e3,null))[_0x590b('0x40')](handleError(_0x7da2e3,null));};exports[_0x590b('0x45')]=function(_0x5e10de,_0x5e79c5){return db[_0x590b('0x28')][_0x590b('0x45')](_0x5e10de[_0x590b('0x46')],{})[_0x590b('0x22')](respondWithResult(_0x5e79c5,0xc9))['catch'](handleError(_0x5e79c5,null));};exports[_0x590b('0x47')]=function(_0x11bb48,_0x2f492a){if(_0x11bb48['body']['id']){delete _0x11bb48[_0x590b('0x46')]['id'];}return db[_0x590b('0x28')]['find']({'where':{'id':_0x11bb48['params']['id']}})[_0x590b('0x22')](handleEntityNotFound(_0x2f492a,null))[_0x590b('0x22')](saveUpdates(_0x11bb48['body'],null))[_0x590b('0x22')](respondWithResult(_0x2f492a,null))[_0x590b('0x40')](handleError(_0x2f492a,null));};exports['destroy']=function(_0x67ee4f,_0xa6c336){return db[_0x590b('0x28')]['find']({'where':{'id':_0x67ee4f['params']['id']}})[_0x590b('0x22')](handleEntityNotFound(_0xa6c336,null))[_0x590b('0x22')](removeEntity(_0xa6c336,null))['catch'](handleError(_0xa6c336,null));};exports[_0x590b('0x48')]=function(_0xd409f5,_0x228203){return db[_0x590b('0x28')][_0x590b('0x48')]()[_0x590b('0x22')](respondWithResult(_0x228203,null))[_0x590b('0x40')](handleError(_0x228203,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 36b7c99..d0a3d3b 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(_0x1d805e,_0x45d767){var _0x25b6e6=function(_0x53d563){while(--_0x53d563){_0x1d805e['push'](_0x1d805e['shift']());}};_0x25b6e6(++_0x45d767);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x34c4fe,_0x22a148){var _0x18e196=function(_0x480eda){while(--_0x480eda){_0x34c4fe['push'](_0x34c4fe['shift']());}};_0x18e196(++_0x22a148);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 affbd14..581f9b5 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 _0xc84a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0xce09a,_0x537b1d){var _0x53ec17=function(_0x14ff12){while(--_0x14ff12){_0xce09a['push'](_0xce09a['shift']());}};_0x53ec17(++_0x537b1d);}(_0xc84a,0x15c));var _0xac84=function(_0x49ee56,_0x273ea6){_0x49ee56=_0x49ee56-0x0;var _0x1ec73f=_0xc84a[_0x49ee56];return _0x1ec73f;};'use strict';var _=require(_0xac84('0x0'));var util=require(_0xac84('0x1'));var moment=require('moment');var BPromise=require(_0xac84('0x2'));var rs=require(_0xac84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac84('0x4'))['db'];var utils=require(_0xac84('0x5'));var logger=require(_0xac84('0x6'))(_0xac84('0x7'));var config=require(_0xac84('0x8'));var jayson=require(_0xac84('0x9'));var client=jayson['client'][_0xac84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5afdee,_0x3be8f0,_0x14618b){return new BPromise(function(_0x1cc6b1,_0x5a962d){return client['request'](_0x5afdee,_0x14618b)[_0xac84('0xb')](function(_0xb752e7){logger['info'](_0xac84('0xc'),_0x3be8f0,_0xac84('0xd'));logger[_0xac84('0xe')](_0xac84('0xf'),_0x3be8f0,_0xac84('0xd'),JSON['stringify'](_0xb752e7));if(_0xb752e7[_0xac84('0x10')]){if(_0xb752e7[_0xac84('0x10')][_0xac84('0x11')]===0x1f4){logger[_0xac84('0x10')]('Cdr,\x20%s,\x20%s',_0x3be8f0,_0xb752e7[_0xac84('0x10')][_0xac84('0x12')]);return _0x5a962d(_0xb752e7[_0xac84('0x10')][_0xac84('0x12')]);}logger[_0xac84('0x10')](_0xac84('0xc'),_0x3be8f0,_0xb752e7[_0xac84('0x10')][_0xac84('0x12')]);return _0x1cc6b1(_0xb752e7['error'][_0xac84('0x12')]);}else{logger[_0xac84('0x13')]('Cdr,\x20%s,\x20%s',_0x3be8f0,_0xac84('0xd'));_0x1cc6b1(_0xb752e7[_0xac84('0x14')][_0xac84('0x12')]);}})[_0xac84('0x15')](function(_0x2722e3){logger['error'](_0xac84('0xc'),_0x3be8f0,_0x2722e3);_0x5a962d(_0x2722e3);});});} \ No newline at end of file +var _0x33f4=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x3852b8,_0x31c911){var _0x1d0959=function(_0x5ec33c){while(--_0x5ec33c){_0x3852b8['push'](_0x3852b8['shift']());}};_0x1d0959(++_0x31c911);}(_0x33f4,0xa1));var _0x433f=function(_0x330b65,_0x4cff41){_0x330b65=_0x330b65-0x0;var _0x5ca89a=_0x33f4[_0x330b65];return _0x5ca89a;};'use strict';var _=require(_0x433f('0x0'));var util=require(_0x433f('0x1'));var moment=require('moment');var BPromise=require(_0x433f('0x2'));var rs=require(_0x433f('0x3'));var fs=require('fs');var Redis=require(_0x433f('0x4'));var db=require(_0x433f('0x5'))['db'];var utils=require(_0x433f('0x6'));var logger=require(_0x433f('0x7'))('rpc');var config=require(_0x433f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x433f('0x9')][_0x433f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56c426,_0x5dc08d,_0x1c23fa){return new BPromise(function(_0x1df465,_0x41fa00){return client['request'](_0x56c426,_0x1c23fa)[_0x433f('0xb')](function(_0x2aa953){logger[_0x433f('0xc')](_0x433f('0xd'),_0x5dc08d,_0x433f('0xe'));logger[_0x433f('0xf')](_0x433f('0x10'),_0x5dc08d,'request\x20sent',JSON[_0x433f('0x11')](_0x2aa953));if(_0x2aa953['error']){if(_0x2aa953['error'][_0x433f('0x12')]===0x1f4){logger[_0x433f('0x13')](_0x433f('0xd'),_0x5dc08d,_0x2aa953[_0x433f('0x13')][_0x433f('0x14')]);return _0x41fa00(_0x2aa953[_0x433f('0x13')]['message']);}logger[_0x433f('0x13')]('Cdr,\x20%s,\x20%s',_0x5dc08d,_0x2aa953[_0x433f('0x13')][_0x433f('0x14')]);return _0x1df465(_0x2aa953[_0x433f('0x13')]['message']);}else{logger[_0x433f('0xc')](_0x433f('0xd'),_0x5dc08d,_0x433f('0xe'));_0x1df465(_0x2aa953[_0x433f('0x15')]['message']);}})[_0x433f('0x16')](function(_0x52b16f){logger[_0x433f('0x13')]('Cdr,\x20%s,\x20%s',_0x5dc08d,_0x52b16f);_0x41fa00(_0x52b16f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f140085..5e466c7 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x10b6ae,_0x56a559){var _0x1321e9=function(_0x9b0eb2){while(--_0x9b0eb2){_0x10b6ae['push'](_0x10b6ae['shift']());}};_0x1321e9(++_0x56a559);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x17bccc,_0x4cc003){var _0x16e5fe=function(_0x3f7b2a){while(--_0x3f7b2a){_0x17bccc['push'](_0x17bccc['shift']());}};_0x16e5fe(++_0x4cc003);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e6ea0e9..adc6b95 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 _0x9620=['TEXT','sequelize','exports','STRING'];(function(_0x92716b,_0x34d560){var _0x1c6218=function(_0x409ca5){while(--_0x409ca5){_0x92716b['push'](_0x92716b['shift']());}};_0x1c6218(++_0x34d560);}(_0x9620,0x189));var _0x0962=function(_0x22e533,_0x5f46bb){_0x22e533=_0x22e533-0x0;var _0x488146=_0x9620[_0x22e533];return _0x488146;};'use strict';var Sequelize=require(_0x0962('0x0'));module[_0x0962('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0962('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0962('0x3')]()},'description':{'type':Sequelize[_0x0962('0x2')]},'interval':{'type':Sequelize[_0x0962('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8ac7=['exports','STRING','*,*,*,*','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8ac7,0xf7));var _0x78ac=function(_0x1c66d6,_0x3e8697){_0x1c66d6=_0x1c66d6-0x0;var _0xe7c08c=_0x8ac7[_0x1c66d6];return _0xe7c08c;};'use strict';var Sequelize=require(_0x78ac('0x0'));module[_0x78ac('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x78ac('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x78ac('0x2')]},'interval':{'type':Sequelize[_0x78ac('0x2')],'defaultValue':_0x78ac('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c5cc4c4..3a47db2 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 _0x22a4=['offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','show','model','keys','filters','intersection','query','attributes','fields','length','includeAll','include','options','find','catch','body','ChatApplication','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x16ccc4,_0x439e40){var _0x2d3fd0=function(_0x16c8e2){while(--_0x16c8e2){_0x16ccc4['push'](_0x16ccc4['shift']());}};_0x2d3fd0(++_0x439e40);}(_0x22a4,0x1cb));var _0x422a=function(_0x14d413,_0x4ab482){_0x14d413=_0x14d413-0x0;var _0x44bc1e=_0x22a4[_0x14d413];return _0x44bc1e;};'use strict';var emlformat=require(_0x422a('0x0'));var rimraf=require(_0x422a('0x1'));var zipdir=require(_0x422a('0x2'));var jsonpatch=require(_0x422a('0x3'));var rp=require(_0x422a('0x4'));var moment=require(_0x422a('0x5'));var BPromise=require(_0x422a('0x6'));var Mustache=require(_0x422a('0x7'));var util=require('util');var path=require(_0x422a('0x8'));var sox=require(_0x422a('0x9'));var csv=require(_0x422a('0xa'));var ejs=require(_0x422a('0xb'));var fs=require('fs');var fs_extra=require(_0x422a('0xc'));var _=require('lodash');var squel=require(_0x422a('0xd'));var crypto=require(_0x422a('0xe'));var jsforce=require(_0x422a('0xf'));var deskjs=require(_0x422a('0x10'));var toCsv=require(_0x422a('0xa'));var querystring=require(_0x422a('0x11'));var Papa=require(_0x422a('0x12'));var Redis=require(_0x422a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x422a('0x14'));var hardwareService=require(_0x422a('0x15'));var logger=require(_0x422a('0x16'))(_0x422a('0x17'));var utils=require(_0x422a('0x18'));var config=require(_0x422a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xebe70d,_0x4dbed1){_0x4dbed1=_0x4dbed1||0xcc;return function(_0x5a0c59){if(_0x5a0c59){return _0xebe70d['sendStatus'](_0x4dbed1);}return _0xebe70d[_0x422a('0x1a')](_0x4dbed1)[_0x422a('0x1b')]();};}function respondWithResult(_0x11af1f,_0x2dc9b2){_0x2dc9b2=_0x2dc9b2||0xc8;return function(_0x147af5){if(_0x147af5){return _0x11af1f[_0x422a('0x1a')](_0x2dc9b2)[_0x422a('0x1c')](_0x147af5);}};}function respondWithFilteredResult(_0x3504bb,_0xf9fcf7){return function(_0x2ba53b){if(_0x2ba53b){var _0x30b6e9=typeof _0xf9fcf7[_0x422a('0x1d')]===_0x422a('0x1e')&&typeof _0xf9fcf7[_0x422a('0x1f')]===_0x422a('0x1e');var _0x2e8163=_0x2ba53b[_0x422a('0x20')];var _0x5e2507=_0x30b6e9?0x0:_0xf9fcf7[_0x422a('0x1d')];var _0x3c5d86=_0x30b6e9?_0x2ba53b['count']:_0xf9fcf7[_0x422a('0x1d')]+_0xf9fcf7['limit'];var _0x552048;if(_0x3c5d86>=_0x2e8163){_0x3c5d86=_0x2e8163;_0x552048=0xc8;}else{_0x552048=0xce;}_0x3504bb[_0x422a('0x1a')](_0x552048);return _0x3504bb[_0x422a('0x21')](_0x422a('0x22'),_0x5e2507+'-'+_0x3c5d86+'/'+_0x2e8163)[_0x422a('0x1c')](_0x2ba53b);}return null;};}function patchUpdates(_0x194c25){return function(_0x5f9720){try{jsonpatch[_0x422a('0x23')](_0x5f9720,_0x194c25,!![]);}catch(_0x26922a){return BPromise['reject'](_0x26922a);}return _0x5f9720[_0x422a('0x24')]();};}function saveUpdates(_0x3284ed,_0x211d93){return function(_0x3d3213){if(_0x3d3213){return _0x3d3213[_0x422a('0x25')](_0x3284ed)['then'](function(_0x837c81){return _0x837c81;});}return null;};}function removeEntity(_0x33bc88,_0x6e209d){return function(_0x5e3138){if(_0x5e3138){return _0x5e3138[_0x422a('0x26')]()[_0x422a('0x27')](function(){_0x33bc88[_0x422a('0x1a')](0xcc)[_0x422a('0x1b')]();});}};}function handleEntityNotFound(_0xfc8699,_0xa7e1dd){return function(_0xca7e3c){if(!_0xca7e3c){_0xfc8699[_0x422a('0x28')](0x194);}return _0xca7e3c;};}function handleError(_0x535888,_0x911cc9){_0x911cc9=_0x911cc9||0x1f4;return function(_0x15d2ab){logger['error'](_0x15d2ab[_0x422a('0x29')]);if(_0x15d2ab['name']){delete _0x15d2ab[_0x422a('0x2a')];}_0x535888[_0x422a('0x1a')](_0x911cc9)[_0x422a('0x2b')](_0x15d2ab);};}exports[_0x422a('0x2c')]=function(_0x4badf8,_0x3cb362){var _0x2f833e={'raw':!![],'where':{'id':_0x4badf8['params']['id']}},_0x50cc29={};_0x50cc29[_0x422a('0x2d')]=_[_0x422a('0x2e')](db['ChatApplication']['rawAttributes']);_0x50cc29['query']=_['keys'](_0x4badf8['query']);_0x50cc29[_0x422a('0x2f')]=_[_0x422a('0x30')](_0x50cc29[_0x422a('0x2d')],_0x50cc29[_0x422a('0x31')]);_0x2f833e[_0x422a('0x32')]=_['intersection'](_0x50cc29[_0x422a('0x2d')],qs[_0x422a('0x33')](_0x4badf8[_0x422a('0x31')][_0x422a('0x33')]));_0x2f833e[_0x422a('0x32')]=_0x2f833e[_0x422a('0x32')][_0x422a('0x34')]?_0x2f833e['attributes']:_0x50cc29[_0x422a('0x2d')];if(_0x4badf8[_0x422a('0x31')][_0x422a('0x35')]){_0x2f833e[_0x422a('0x36')]=[{'all':!![]}];}_0x2f833e=_['merge']({},_0x2f833e,_0x4badf8[_0x422a('0x37')]);return db['ChatApplication'][_0x422a('0x38')](_0x2f833e)[_0x422a('0x27')](handleEntityNotFound(_0x3cb362,null))['then'](respondWithResult(_0x3cb362,null))[_0x422a('0x39')](handleError(_0x3cb362,null));};exports[_0x422a('0x25')]=function(_0x561040,_0x1fd498){if(_0x561040[_0x422a('0x3a')]['id']){delete _0x561040[_0x422a('0x3a')]['id'];}return db[_0x422a('0x3b')][_0x422a('0x38')]({'where':{'id':_0x561040[_0x422a('0x3c')]['id']}})[_0x422a('0x27')](handleEntityNotFound(_0x1fd498,null))[_0x422a('0x27')](saveUpdates(_0x561040['body'],null))['then'](respondWithResult(_0x1fd498,null))[_0x422a('0x39')](handleError(_0x1fd498,null));};exports[_0x422a('0x26')]=function(_0x45134b,_0x4beffb){return db[_0x422a('0x3b')][_0x422a('0x38')]({'where':{'id':_0x45134b['params']['id']}})['then'](handleEntityNotFound(_0x4beffb,null))[_0x422a('0x27')](removeEntity(_0x4beffb,null))['catch'](handleError(_0x4beffb,null));}; \ No newline at end of file +var _0xb98f=['lodash','crypto','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','query','keys','intersection','model','attributes','fields','includeAll','include','merge','options','ChatApplication','find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra'];(function(_0x6697b5,_0x263310){var _0x4d8c4e=function(_0x171203){while(--_0x171203){_0x6697b5['push'](_0x6697b5['shift']());}};_0x4d8c4e(++_0x263310);}(_0xb98f,0xce));var _0xfb98=function(_0x230994,_0x4afa4e){_0x230994=_0x230994-0x0;var _0x267bdc=_0xb98f[_0x230994];return _0x267bdc;};'use strict';var emlformat=require(_0xfb98('0x0'));var rimraf=require(_0xfb98('0x1'));var zipdir=require(_0xfb98('0x2'));var jsonpatch=require(_0xfb98('0x3'));var rp=require(_0xfb98('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb98('0x5'));var path=require(_0xfb98('0x6'));var sox=require(_0xfb98('0x7'));var csv=require(_0xfb98('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb98('0x9'));var _=require(_0xfb98('0xa'));var squel=require('squel');var crypto=require(_0xfb98('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb98('0xc'));var authService=require(_0xfb98('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb98('0xe'));var logger=require('../../config/logger')(_0xfb98('0xf'));var utils=require(_0xfb98('0x10'));var config=require(_0xfb98('0x11'));var licenseUtil=require(_0xfb98('0x12'));var db=require(_0xfb98('0x13'))['db'];function respondWithStatusCode(_0x3cc48e,_0x77a949){_0x77a949=_0x77a949||0xcc;return function(_0x1c9933){if(_0x1c9933){return _0x3cc48e[_0xfb98('0x14')](_0x77a949);}return _0x3cc48e[_0xfb98('0x15')](_0x77a949)[_0xfb98('0x16')]();};}function respondWithResult(_0x3cdeb9,_0x14c9a3){_0x14c9a3=_0x14c9a3||0xc8;return function(_0x201b04){if(_0x201b04){return _0x3cdeb9['status'](_0x14c9a3)[_0xfb98('0x17')](_0x201b04);}};}function respondWithFilteredResult(_0x515864,_0x3e7e25){return function(_0x2d4efd){if(_0x2d4efd){var _0x3c6ca5=typeof _0x3e7e25[_0xfb98('0x18')]===_0xfb98('0x19')&&typeof _0x3e7e25['limit']===_0xfb98('0x19');var _0x174e4d=_0x2d4efd[_0xfb98('0x1a')];var _0x14b206=_0x3c6ca5?0x0:_0x3e7e25[_0xfb98('0x18')];var _0x15c4fa=_0x3c6ca5?_0x2d4efd[_0xfb98('0x1a')]:_0x3e7e25[_0xfb98('0x18')]+_0x3e7e25[_0xfb98('0x1b')];var _0x15932f;if(_0x15c4fa>=_0x174e4d){_0x15c4fa=_0x174e4d;_0x15932f=0xc8;}else{_0x15932f=0xce;}_0x515864[_0xfb98('0x15')](_0x15932f);return _0x515864[_0xfb98('0x1c')](_0xfb98('0x1d'),_0x14b206+'-'+_0x15c4fa+'/'+_0x174e4d)[_0xfb98('0x17')](_0x2d4efd);}return null;};}function patchUpdates(_0x23bc24){return function(_0x46a120){try{jsonpatch[_0xfb98('0x1e')](_0x46a120,_0x23bc24,!![]);}catch(_0x50c0d6){return BPromise[_0xfb98('0x1f')](_0x50c0d6);}return _0x46a120[_0xfb98('0x20')]();};}function saveUpdates(_0x14eaff,_0x284b59){return function(_0x4c3f10){if(_0x4c3f10){return _0x4c3f10[_0xfb98('0x21')](_0x14eaff)[_0xfb98('0x22')](function(_0xfa10fc){return _0xfa10fc;});}return null;};}function removeEntity(_0x5078aa,_0x568d6c){return function(_0x433fce){if(_0x433fce){return _0x433fce[_0xfb98('0x23')]()['then'](function(){_0x5078aa[_0xfb98('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x383057,_0x3f97fb){return function(_0x5727b4){if(!_0x5727b4){_0x383057['sendStatus'](0x194);}return _0x5727b4;};}function handleError(_0x25480d,_0x18e638){_0x18e638=_0x18e638||0x1f4;return function(_0x5136a3){logger[_0xfb98('0x24')](_0x5136a3['stack']);if(_0x5136a3[_0xfb98('0x25')]){delete _0x5136a3[_0xfb98('0x25')];}_0x25480d[_0xfb98('0x15')](_0x18e638)[_0xfb98('0x26')](_0x5136a3);};}exports['show']=function(_0x239705,_0x106602){var _0x5cdb18={'raw':!![],'where':{'id':_0x239705['params']['id']}},_0x3c6e77={};_0x3c6e77['model']=_['keys'](db['ChatApplication']['rawAttributes']);_0x3c6e77[_0xfb98('0x27')]=_[_0xfb98('0x28')](_0x239705[_0xfb98('0x27')]);_0x3c6e77['filters']=_[_0xfb98('0x29')](_0x3c6e77[_0xfb98('0x2a')],_0x3c6e77['query']);_0x5cdb18[_0xfb98('0x2b')]=_[_0xfb98('0x29')](_0x3c6e77[_0xfb98('0x2a')],qs[_0xfb98('0x2c')](_0x239705['query'][_0xfb98('0x2c')]));_0x5cdb18[_0xfb98('0x2b')]=_0x5cdb18[_0xfb98('0x2b')]['length']?_0x5cdb18['attributes']:_0x3c6e77[_0xfb98('0x2a')];if(_0x239705['query'][_0xfb98('0x2d')]){_0x5cdb18[_0xfb98('0x2e')]=[{'all':!![]}];}_0x5cdb18=_[_0xfb98('0x2f')]({},_0x5cdb18,_0x239705[_0xfb98('0x30')]);return db[_0xfb98('0x31')][_0xfb98('0x32')](_0x5cdb18)[_0xfb98('0x22')](handleEntityNotFound(_0x106602,null))[_0xfb98('0x22')](respondWithResult(_0x106602,null))[_0xfb98('0x33')](handleError(_0x106602,null));};exports[_0xfb98('0x21')]=function(_0x35bbd4,_0x35100d){if(_0x35bbd4[_0xfb98('0x34')]['id']){delete _0x35bbd4['body']['id'];}return db[_0xfb98('0x31')][_0xfb98('0x32')]({'where':{'id':_0x35bbd4[_0xfb98('0x35')]['id']}})[_0xfb98('0x22')](handleEntityNotFound(_0x35100d,null))[_0xfb98('0x22')](saveUpdates(_0x35bbd4[_0xfb98('0x34')],null))['then'](respondWithResult(_0x35100d,null))['catch'](handleError(_0x35100d,null));};exports[_0xfb98('0x23')]=function(_0x5063aa,_0x538782){return db['ChatApplication']['find']({'where':{'id':_0x5063aa[_0xfb98('0x35')]['id']}})[_0xfb98('0x22')](handleEntityNotFound(_0x538782,null))['then'](removeEntity(_0x538782,null))[_0xfb98('0x33')](handleError(_0x538782,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 55dad53..0be5c04 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 _0xda79=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x29631f,_0xdb767){var _0x486d87=function(_0x33a1bb){while(--_0x33a1bb){_0x29631f['push'](_0x29631f['shift']());}};_0x486d87(++_0xdb767);}(_0xda79,0x6f));var _0x9da7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xda79[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var logger=require(_0x9da7('0x2'))(_0x9da7('0x3'));var moment=require(_0x9da7('0x4'));var BPromise=require(_0x9da7('0x5'));var rp=require(_0x9da7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da7('0x7'));var config=require(_0x9da7('0x8'));var attributes=require(_0x9da7('0x9'));module[_0x9da7('0xa')]=function(_0x55f90a,_0x260bbd){return _0x55f90a[_0x9da7('0xb')](_0x9da7('0xc'),attributes,{'tableName':_0x9da7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9da7('0xe'),'collate':_0x9da7('0xf')});}; \ No newline at end of file +var _0x4d7f=['path','rimraf','./chatApplication.attributes','define','chat_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x46cb78,_0x3d1e23){var _0x163244=function(_0x53c7f8){while(--_0x53c7f8){_0x46cb78['push'](_0x46cb78['shift']());}};_0x163244(++_0x3d1e23);}(_0x4d7f,0xc1));var _0xf4d7=function(_0x425107,_0x44ec5a){_0x425107=_0x425107-0x0;var _0x33db0f=_0x4d7f[_0x425107];return _0x33db0f;};'use strict';var _=require(_0xf4d7('0x0'));var util=require('util');var logger=require(_0xf4d7('0x1'))('api');var moment=require(_0xf4d7('0x2'));var BPromise=require(_0xf4d7('0x3'));var rp=require(_0xf4d7('0x4'));var fs=require('fs');var path=require(_0xf4d7('0x5'));var rimraf=require(_0xf4d7('0x6'));var config=require('../../config/environment');var attributes=require(_0xf4d7('0x7'));module['exports']=function(_0x2c7ad0,_0x18051f){return _0x2c7ad0[_0xf4d7('0x8')]('ChatApplication',attributes,{'tableName':_0xf4d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf4d7('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e285e99..b6f19bc 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 _0xcc3f=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x6d56e9,_0x2589e8){var _0x1bd9ae=function(_0x162f18){while(--_0x162f18){_0x6d56e9['push'](_0x6d56e9['shift']());}};_0x1bd9ae(++_0x2589e8);}(_0xcc3f,0x16b));var _0xfcc3=function(_0x4c9763,_0x2ff3fe){_0x4c9763=_0x4c9763-0x0;var _0x4f2df8=_0xcc3f[_0x4c9763];return _0x4f2df8;};'use strict';var _=require('lodash');var util=require(_0xfcc3('0x0'));var moment=require('moment');var BPromise=require(_0xfcc3('0x1'));var rs=require(_0xfcc3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcc3('0x3'))['db'];var utils=require(_0xfcc3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfcc3('0x5'));var jayson=require(_0xfcc3('0x6'));var client=jayson[_0xfcc3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38be46,_0x3af7ca,_0xf3235a){return new BPromise(function(_0x30576a,_0x25ab4b){return client[_0xfcc3('0x8')](_0x38be46,_0xf3235a)['then'](function(_0x2c1b82){logger[_0xfcc3('0x9')](_0xfcc3('0xa'),_0x3af7ca,_0xfcc3('0xb'));logger[_0xfcc3('0xc')](_0xfcc3('0xd'),_0x3af7ca,'request\x20sent',JSON[_0xfcc3('0xe')](_0x2c1b82));if(_0x2c1b82[_0xfcc3('0xf')]){if(_0x2c1b82[_0xfcc3('0xf')]['code']===0x1f4){logger[_0xfcc3('0xf')]('ChatApplication,\x20%s,\x20%s',_0x3af7ca,_0x2c1b82[_0xfcc3('0xf')][_0xfcc3('0x10')]);return _0x25ab4b(_0x2c1b82[_0xfcc3('0xf')][_0xfcc3('0x10')]);}logger[_0xfcc3('0xf')](_0xfcc3('0xa'),_0x3af7ca,_0x2c1b82[_0xfcc3('0xf')][_0xfcc3('0x10')]);return _0x30576a(_0x2c1b82['error'][_0xfcc3('0x10')]);}else{logger[_0xfcc3('0x9')](_0xfcc3('0xa'),_0x3af7ca,'request\x20sent');_0x30576a(_0x2c1b82[_0xfcc3('0x11')][_0xfcc3('0x10')]);}})[_0xfcc3('0x12')](function(_0x4977c1){logger['error'](_0xfcc3('0xa'),_0x3af7ca,_0x4977c1);_0x25ab4b(_0x4977c1);});});} \ No newline at end of file +var _0x0155=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4eecb8,_0x4fafc3){var _0x4dd587=function(_0x449b2a){while(--_0x449b2a){_0x4eecb8['push'](_0x4eecb8['shift']());}};_0x4dd587(++_0x4fafc3);}(_0x0155,0x10f));var _0x5015=function(_0x54effc,_0x58f6e4){_0x54effc=_0x54effc-0x0;var _0xf045b2=_0x0155[_0x54effc];return _0xf045b2;};'use strict';var _=require(_0x5015('0x0'));var util=require('util');var moment=require(_0x5015('0x1'));var BPromise=require(_0x5015('0x2'));var rs=require(_0x5015('0x3'));var fs=require('fs');var Redis=require(_0x5015('0x4'));var db=require(_0x5015('0x5'))['db'];var utils=require(_0x5015('0x6'));var logger=require(_0x5015('0x7'))(_0x5015('0x8'));var config=require(_0x5015('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5015('0xa')][_0x5015('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf19f5d,_0x5da182,_0x452d2c){return new BPromise(function(_0xa7bf92,_0x29fabd){return client[_0x5015('0xc')](_0xf19f5d,_0x452d2c)[_0x5015('0xd')](function(_0x2eaf6d){logger[_0x5015('0xe')]('ChatApplication,\x20%s,\x20%s',_0x5da182,_0x5015('0xf'));logger[_0x5015('0x10')](_0x5015('0x11'),_0x5da182,_0x5015('0xf'),JSON[_0x5015('0x12')](_0x2eaf6d));if(_0x2eaf6d[_0x5015('0x13')]){if(_0x2eaf6d[_0x5015('0x13')][_0x5015('0x14')]===0x1f4){logger['error'](_0x5015('0x15'),_0x5da182,_0x2eaf6d['error'][_0x5015('0x16')]);return _0x29fabd(_0x2eaf6d[_0x5015('0x13')]['message']);}logger[_0x5015('0x13')](_0x5015('0x15'),_0x5da182,_0x2eaf6d['error'][_0x5015('0x16')]);return _0xa7bf92(_0x2eaf6d[_0x5015('0x13')][_0x5015('0x16')]);}else{logger[_0x5015('0xe')](_0x5015('0x15'),_0x5da182,_0x5015('0xf'));_0xa7bf92(_0x2eaf6d[_0x5015('0x17')]['message']);}})[_0x5015('0x18')](function(_0x51f04f){logger[_0x5015('0x13')](_0x5015('0x15'),_0x5da182,_0x51f04f);_0x29fabd(_0x51f04f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 17c3ef5..8513772 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 _0x399e=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','isAuthenticated','delete','destroy','multer','path'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x399e,0x9a));var _0xe399=function(_0x39f5b,_0x224393){_0x39f5b=_0x39f5b-0x0;var _0x29c795=_0x399e[_0x39f5b];return _0x29c795;};'use strict';var multer=require(_0xe399('0x0'));var util=require('util');var path=require(_0xe399('0x1'));var timeout=require(_0xe399('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe399('0x3'));var interaction=require(_0xe399('0x4'));var config=require(_0xe399('0x5'));var controller=require(_0xe399('0x6'));router[_0xe399('0x7')](_0xe399('0x8'),auth['isAuthenticated'](),controller[_0xe399('0x9')]);router['put'](_0xe399('0x8'),auth[_0xe399('0xa')](),controller['update']);router[_0xe399('0xb')](_0xe399('0x8'),auth[_0xe399('0xa')](),controller[_0xe399('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1a48=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put','delete','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1a48,0xb6));var _0x81a4=function(_0x48661f,_0x92ed0){_0x48661f=_0x48661f-0x0;var _0x1b79bd=_0x1a48[_0x48661f];return _0x1b79bd;};'use strict';var multer=require(_0x81a4('0x0'));var util=require('util');var path=require(_0x81a4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x81a4('0x2')]();var fs_extra=require(_0x81a4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x81a4('0x4'));var config=require(_0x81a4('0x5'));var controller=require(_0x81a4('0x6'));router[_0x81a4('0x7')](_0x81a4('0x8'),auth[_0x81a4('0x9')](),controller['show']);router[_0x81a4('0xa')](_0x81a4('0x8'),auth[_0x81a4('0x9')](),controller['update']);router[_0x81a4('0xb')](_0x81a4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x81a4('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4c4b365..a24d2a7 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 _0x2f4a=['exports','STRING','BOOLEAN','sequelize'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x2f4a[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0xa2f4('0x0'));module[_0xa2f4('0x1')]={'name':{'type':Sequelize[_0xa2f4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa2f4('0x2')]},'write':{'type':Sequelize[_0xa2f4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9e9f=['exports','STRING','sequelize'];(function(_0x230951,_0x4dad52){var _0xeb26b1=function(_0x25776c){while(--_0x25776c){_0x230951['push'](_0x230951['shift']());}};_0xeb26b1(++_0x4dad52);}(_0x9e9f,0x1cd));var _0xf9e9=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x9e9f[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require(_0xf9e9('0x0'));module[_0xf9e9('0x1')]={'name':{'type':Sequelize[_0xf9e9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 5add183..87c8136 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 _0x89b8=['../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','find','create','body','describe','params','ids','omit','getMembers','findOne','order','pick','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x89b8,0xa2));var _0x889b=function(_0x3b2261,_0x2d09c1){_0x3b2261=_0x3b2261-0x0;var _0x4c4c01=_0x89b8[_0x3b2261];return _0x4c4c01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x889b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x889b('0x1'));var rp=require(_0x889b('0x2'));var moment=require(_0x889b('0x3'));var BPromise=require(_0x889b('0x4'));var Mustache=require(_0x889b('0x5'));var util=require(_0x889b('0x6'));var path=require(_0x889b('0x7'));var sox=require(_0x889b('0x8'));var csv=require('to-csv');var ejs=require(_0x889b('0x9'));var fs=require('fs');var fs_extra=require(_0x889b('0xa'));var _=require(_0x889b('0xb'));var squel=require('squel');var crypto=require(_0x889b('0xc'));var jsforce=require(_0x889b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x889b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x889b('0xf'));var qs=require(_0x889b('0x10'));var as=require(_0x889b('0x11'));var hardwareService=require(_0x889b('0x12'));var logger=require('../../config/logger')(_0x889b('0x13'));var utils=require(_0x889b('0x14'));var config=require(_0x889b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x889b('0x16')]=_[_0x889b('0x17')](config['redis'],{'host':_0x889b('0x18'),'port':0x18eb});var socket=require(_0x889b('0x19'))(new Redis(config[_0x889b('0x16')]));require(_0x889b('0x1a'))[_0x889b('0x1b')](socket);function respondWithStatusCode(_0x1b7500,_0x4d7073){_0x4d7073=_0x4d7073||0xcc;return function(_0x1ab687){if(_0x1ab687){return _0x1b7500[_0x889b('0x1c')](_0x4d7073);}return _0x1b7500[_0x889b('0x1d')](_0x4d7073)['end']();};}function respondWithResult(_0x5d2f88,_0x2796ea){_0x2796ea=_0x2796ea||0xc8;return function(_0x38ddf2){if(_0x38ddf2){return _0x5d2f88[_0x889b('0x1d')](_0x2796ea)['json'](_0x38ddf2);}};}function respondWithFilteredResult(_0x402fc7,_0x387a5e){return function(_0x961f43){if(_0x961f43){var _0x317013=typeof _0x387a5e[_0x889b('0x1e')]===_0x889b('0x1f')&&typeof _0x387a5e[_0x889b('0x20')]==='undefined';var _0x154a80=_0x961f43[_0x889b('0x21')];var _0x593e10=_0x317013?0x0:_0x387a5e[_0x889b('0x1e')];var _0x3fd58c=_0x317013?_0x961f43[_0x889b('0x21')]:_0x387a5e[_0x889b('0x1e')]+_0x387a5e['limit'];var _0x44f51a;if(_0x3fd58c>=_0x154a80){_0x3fd58c=_0x154a80;_0x44f51a=0xc8;}else{_0x44f51a=0xce;}_0x402fc7[_0x889b('0x1d')](_0x44f51a);return _0x402fc7[_0x889b('0x22')](_0x889b('0x23'),_0x593e10+'-'+_0x3fd58c+'/'+_0x154a80)[_0x889b('0x24')](_0x961f43);}return null;};}function patchUpdates(_0x185d05){return function(_0x212fbf){try{jsonpatch[_0x889b('0x25')](_0x212fbf,_0x185d05,!![]);}catch(_0x40c2ff){return BPromise['reject'](_0x40c2ff);}return _0x212fbf[_0x889b('0x26')]();};}function saveUpdates(_0x3f1587,_0x2bc8a5){return function(_0xf77784){if(_0xf77784){return _0xf77784[_0x889b('0x27')](_0x3f1587)[_0x889b('0x28')](function(_0x42bb50){return _0x42bb50;});}return null;};}function removeEntity(_0x5a3437,_0x176929){return function(_0x4c5ed7){if(_0x4c5ed7){return _0x4c5ed7[_0x889b('0x29')]()[_0x889b('0x28')](function(){_0x5a3437[_0x889b('0x1d')](0xcc)[_0x889b('0x2a')]();});}};}function handleEntityNotFound(_0x5c938e,_0x238d63){return function(_0x152ca9){if(!_0x152ca9){_0x5c938e['sendStatus'](0x194);}return _0x152ca9;};}function handleError(_0xa900a4,_0x33b8f){_0x33b8f=_0x33b8f||0x1f4;return function(_0x314b2b){logger[_0x889b('0x2b')](_0x314b2b[_0x889b('0x2c')]);if(_0x314b2b[_0x889b('0x2d')]){delete _0x314b2b[_0x889b('0x2d')];}_0xa900a4[_0x889b('0x1d')](_0x33b8f)[_0x889b('0x2e')](_0x314b2b);};}exports[_0x889b('0x2f')]=function(_0x48fba4,_0x496c17){var _0x1155d2={},_0x142aa1={},_0x35cc76={'count':0x0,'rows':[]};var _0x388378=_['map'](db[_0x889b('0x30')][_0x889b('0x31')],function(_0x27956b){return{'name':_0x27956b[_0x889b('0x32')],'type':_0x27956b[_0x889b('0x33')]['key']};});_0x142aa1[_0x889b('0x34')]=_[_0x889b('0x35')](_0x388378,_0x889b('0x2d'));_0x142aa1['query']=_[_0x889b('0x36')](_0x48fba4[_0x889b('0x37')]);_0x142aa1[_0x889b('0x38')]=_[_0x889b('0x39')](_0x142aa1[_0x889b('0x34')],_0x142aa1['query']);_0x1155d2[_0x889b('0x3a')]=_['intersection'](_0x142aa1[_0x889b('0x34')],qs['fields'](_0x48fba4['query'][_0x889b('0x3b')]));_0x1155d2[_0x889b('0x3a')]=_0x1155d2[_0x889b('0x3a')][_0x889b('0x3c')]?_0x1155d2['attributes']:_0x142aa1[_0x889b('0x34')];if(!_0x48fba4[_0x889b('0x37')]['hasOwnProperty'](_0x889b('0x3d'))){_0x1155d2[_0x889b('0x20')]=qs[_0x889b('0x20')](_0x48fba4[_0x889b('0x37')]['limit']);_0x1155d2['offset']=qs['offset'](_0x48fba4[_0x889b('0x37')][_0x889b('0x1e')]);}_0x1155d2['order']=qs[_0x889b('0x3e')](_0x48fba4['query'][_0x889b('0x3e')]);_0x1155d2[_0x889b('0x3f')]=qs[_0x889b('0x38')](_['pick'](_0x48fba4[_0x889b('0x37')],_0x142aa1[_0x889b('0x38')]),_0x388378);if(_0x48fba4[_0x889b('0x37')][_0x889b('0x40')]){_0x1155d2[_0x889b('0x3f')]=_['merge'](_0x1155d2[_0x889b('0x3f')],{'$or':_[_0x889b('0x35')](_0x388378,function(_0x1f1c55){if(_0x1f1c55['type']!==_0x889b('0x41')){var _0x114d55={};_0x114d55[_0x1f1c55['name']]={'$like':'%'+_0x48fba4[_0x889b('0x37')]['filter']+'%'};return _0x114d55;}})});}_0x1155d2=_[_0x889b('0x42')]({},_0x1155d2,_0x48fba4[_0x889b('0x43')]);var _0x17e63f={'where':_0x1155d2[_0x889b('0x3f')]};return db[_0x889b('0x30')]['count'](_0x17e63f)['then'](function(_0x31921b){_0x35cc76[_0x889b('0x21')]=_0x31921b;if(_0x48fba4[_0x889b('0x37')]['includeAll']){_0x1155d2[_0x889b('0x44')]=[{'all':!![]}];}return db[_0x889b('0x30')]['findAll'](_0x1155d2);})['then'](function(_0x3bfb1f){_0x35cc76[_0x889b('0x45')]=_0x3bfb1f;return _0x35cc76;})[_0x889b('0x28')](respondWithFilteredResult(_0x496c17,_0x1155d2))[_0x889b('0x46')](handleError(_0x496c17,null));};exports[_0x889b('0x47')]=function(_0x78c9bc,_0x2aa076){var _0x41b5ef={'raw':!![],'where':{'id':_0x78c9bc['params']['id']}},_0x34f748={};_0x34f748['model']=_[_0x889b('0x36')](db[_0x889b('0x30')][_0x889b('0x31')]);_0x34f748[_0x889b('0x37')]=_['keys'](_0x78c9bc[_0x889b('0x37')]);_0x34f748['filters']=_[_0x889b('0x39')](_0x34f748[_0x889b('0x34')],_0x34f748[_0x889b('0x37')]);_0x41b5ef[_0x889b('0x3a')]=_[_0x889b('0x39')](_0x34f748['model'],qs['fields'](_0x78c9bc[_0x889b('0x37')]['fields']));_0x41b5ef[_0x889b('0x3a')]=_0x41b5ef[_0x889b('0x3a')][_0x889b('0x3c')]?_0x41b5ef['attributes']:_0x34f748[_0x889b('0x34')];if(_0x78c9bc[_0x889b('0x37')]['includeAll']){_0x41b5ef[_0x889b('0x44')]=[{'all':!![]}];}_0x41b5ef=_['merge']({},_0x41b5ef,_0x78c9bc[_0x889b('0x43')]);return db[_0x889b('0x30')][_0x889b('0x48')](_0x41b5ef)[_0x889b('0x28')](handleEntityNotFound(_0x2aa076,null))[_0x889b('0x28')](respondWithResult(_0x2aa076,null))[_0x889b('0x46')](handleError(_0x2aa076,null));};exports[_0x889b('0x49')]=function(_0x571683,_0x583081){return db[_0x889b('0x30')]['create'](_0x571683[_0x889b('0x4a')],{})[_0x889b('0x28')](respondWithResult(_0x583081,0xc9))['catch'](handleError(_0x583081,null));};exports['update']=function(_0x44a21e,_0x2a0f82){if(_0x44a21e[_0x889b('0x4a')]['id']){delete _0x44a21e['body']['id'];}return db[_0x889b('0x30')][_0x889b('0x48')]({'where':{'id':_0x44a21e['params']['id']}})[_0x889b('0x28')](handleEntityNotFound(_0x2a0f82,null))['then'](saveUpdates(_0x44a21e[_0x889b('0x4a')],null))['then'](respondWithResult(_0x2a0f82,null))[_0x889b('0x46')](handleError(_0x2a0f82,null));};exports['destroy']=function(_0x5834a4,_0x25e56c){return db[_0x889b('0x30')][_0x889b('0x48')]({'where':{'id':_0x5834a4['params']['id']}})[_0x889b('0x28')](handleEntityNotFound(_0x25e56c,null))[_0x889b('0x28')](removeEntity(_0x25e56c,null))[_0x889b('0x46')](handleError(_0x25e56c,null));};exports[_0x889b('0x4b')]=function(_0x2186e1,_0x5b8d08){return db[_0x889b('0x30')]['describe']()[_0x889b('0x28')](respondWithResult(_0x5b8d08,null))['catch'](handleError(_0x5b8d08,null));};exports['getUnread']=function(_0x354e53,_0x43c74d,_0x37e941){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x354e53['params']['id'],'ToId':_0x354e53['user']['id'],'read':![]}})[_0x889b('0x28')](function(_0x427274){return{'id':_['toInteger'](_0x354e53[_0x889b('0x4c')]['id']),'count':_0x427274};})[_0x889b('0x28')](respondWithResult(_0x43c74d,null))[_0x889b('0x46')](handleError(_0x43c74d,null));};exports['addMembers']=function(_0x15731b,_0x4e8220,_0x2c1a8b){return db[_0x889b('0x30')]['find']({'where':{'id':_0x15731b[_0x889b('0x4c')]['id']}})[_0x889b('0x28')](handleEntityNotFound(_0x4e8220,null))[_0x889b('0x28')](function(_0x32f656){if(_0x32f656){return _0x32f656['addMembers'](_0x15731b[_0x889b('0x4a')][_0x889b('0x4d')],_[_0x889b('0x4e')](_0x15731b[_0x889b('0x4a')],[_0x889b('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x4e8220,null))[_0x889b('0x46')](handleError(_0x4e8220,null));};exports[_0x889b('0x4f')]=function(_0xf08a2a,_0xdf5fd2,_0x212364){var _0x52f358={};var _0x3bd1a7={};var _0x745b91;var _0x203ae0;return db[_0x889b('0x30')][_0x889b('0x50')]({'where':{'id':_0xf08a2a[_0x889b('0x4c')]['id']}})['then'](handleEntityNotFound(_0xdf5fd2,null))[_0x889b('0x28')](function(_0x106817){if(_0x106817){_0x745b91=_0x106817;_0x3bd1a7[_0x889b('0x34')]=_[_0x889b('0x36')](db['User'][_0x889b('0x31')]);_0x3bd1a7[_0x889b('0x37')]=_[_0x889b('0x36')](_0xf08a2a[_0x889b('0x37')]);_0x3bd1a7['filters']=_[_0x889b('0x39')](_0x3bd1a7[_0x889b('0x34')],_0x3bd1a7[_0x889b('0x37')]);_0x52f358[_0x889b('0x3a')]=_[_0x889b('0x39')](_0x3bd1a7[_0x889b('0x34')],qs[_0x889b('0x3b')](_0xf08a2a[_0x889b('0x37')][_0x889b('0x3b')]));_0x52f358[_0x889b('0x3a')]=_0x52f358[_0x889b('0x3a')][_0x889b('0x3c')]?_0x52f358[_0x889b('0x3a')]:_0x3bd1a7[_0x889b('0x34')];_0x52f358[_0x889b('0x51')]=qs[_0x889b('0x3e')](_0xf08a2a[_0x889b('0x37')][_0x889b('0x3e')]);_0x52f358[_0x889b('0x3f')]=qs[_0x889b('0x38')](_[_0x889b('0x52')](_0xf08a2a[_0x889b('0x37')],_0x3bd1a7[_0x889b('0x38')]));if(_0xf08a2a['query'][_0x889b('0x40')]){_0x52f358['where']=_[_0x889b('0x42')](_0x52f358['where'],{'$or':_[_0x889b('0x35')](_0x52f358[_0x889b('0x3a')],function(_0x11454f){var _0x417833={};_0x417833[_0x11454f]={'$like':'%'+_0xf08a2a[_0x889b('0x37')][_0x889b('0x40')]+'%'};return _0x417833;})});}_0x52f358=_[_0x889b('0x42')]({},_0x52f358,_0xf08a2a[_0x889b('0x43')]);return _0x745b91['getMembers'](_0x52f358);}})[_0x889b('0x28')](function(_0x422053){if(_0x422053){_0x203ae0=_0x422053['length'];if(!_0xf08a2a['query']['hasOwnProperty'](_0x889b('0x3d'))){_0x52f358[_0x889b('0x20')]=qs[_0x889b('0x20')](_0xf08a2a[_0x889b('0x37')]['limit']);_0x52f358[_0x889b('0x1e')]=qs[_0x889b('0x1e')](_0xf08a2a['query'][_0x889b('0x1e')]);}return _0x745b91[_0x889b('0x4f')](_0x52f358);}})[_0x889b('0x28')](function(_0x432c0b){if(_0x432c0b){return _0x432c0b?{'count':_0x203ae0,'rows':_0x432c0b}:null;}})[_0x889b('0x28')](respondWithResult(_0xdf5fd2,null))[_0x889b('0x46')](handleError(_0xdf5fd2,null));};exports[_0x889b('0x53')]=function(_0x1bcae6,_0x579324,_0x51363e){return db[_0x889b('0x30')]['find']({'where':{'id':_0x1bcae6[_0x889b('0x4c')]['id']}})[_0x889b('0x28')](handleEntityNotFound(_0x579324,null))[_0x889b('0x28')](function(_0x2437fc){if(_0x2437fc){return _0x2437fc['removeMembers'](_0x1bcae6[_0x889b('0x37')][_0x889b('0x4d')]);}})[_0x889b('0x28')](respondWithStatusCode(_0x579324,null))[_0x889b('0x46')](handleError(_0x579324,null));};exports[_0x889b('0x54')]=function(_0x478fcd,_0x191a07,_0x46cc70){if(_0x478fcd['body']['id']){delete _0x478fcd[_0x889b('0x4a')]['id'];}return db[_0x889b('0x30')][_0x889b('0x48')]({'where':{'id':_0x478fcd[_0x889b('0x4c')]['id']}})[_0x889b('0x28')](handleEntityNotFound(_0x191a07,null))[_0x889b('0x28')](function(_0x2f1ac6){if(_0x2f1ac6){_0x478fcd[_0x889b('0x4a')][_0x889b('0x55')]=_0x2f1ac6['id'];return db[_0x889b('0x56')]['create'](_0x478fcd[_0x889b('0x4a')]);}})[_0x889b('0x28')](respondWithResult(_0x191a07,null))[_0x889b('0x46')](handleError(_0x191a07,null));};exports[_0x889b('0x57')]=function(_0x2e5ef2,_0x5a80e6,_0x2c3cda){var _0x2fcacb={};var _0x52d8d7={};var _0x11efa0;var _0x263432;return db[_0x889b('0x30')][_0x889b('0x50')]({'where':{'id':_0x2e5ef2[_0x889b('0x4c')]['id']}})[_0x889b('0x28')](handleEntityNotFound(_0x5a80e6,null))[_0x889b('0x28')](function(_0x4b8279){if(_0x4b8279){_0x11efa0=_0x4b8279;_0x52d8d7['model']=_['keys'](db[_0x889b('0x56')][_0x889b('0x31')]);_0x52d8d7[_0x889b('0x37')]=_[_0x889b('0x36')](_0x2e5ef2[_0x889b('0x37')]);_0x52d8d7[_0x889b('0x38')]=_[_0x889b('0x39')](_0x52d8d7[_0x889b('0x34')],_0x52d8d7[_0x889b('0x37')]);_0x2fcacb[_0x889b('0x3a')]=_['intersection'](_0x52d8d7['model'],qs[_0x889b('0x3b')](_0x2e5ef2[_0x889b('0x37')][_0x889b('0x3b')]));_0x2fcacb[_0x889b('0x3a')]=_0x2fcacb['attributes'][_0x889b('0x3c')]?_0x2fcacb[_0x889b('0x3a')]:_0x52d8d7[_0x889b('0x34')];_0x2fcacb['order']=qs[_0x889b('0x3e')](_0x2e5ef2[_0x889b('0x37')][_0x889b('0x3e')]);_0x2fcacb[_0x889b('0x3f')]=qs[_0x889b('0x38')](_['pick'](_0x2e5ef2[_0x889b('0x37')],_0x52d8d7[_0x889b('0x38')]));if(_0x2e5ef2[_0x889b('0x37')][_0x889b('0x40')]){_0x2fcacb[_0x889b('0x3f')]=_['merge'](_0x2fcacb[_0x889b('0x3f')],{'$or':_[_0x889b('0x35')](_0x2fcacb[_0x889b('0x3a')],function(_0x25ab61){var _0x26a95a={};_0x26a95a[_0x25ab61]={'$like':'%'+_0x2e5ef2[_0x889b('0x37')][_0x889b('0x40')]+'%'};return _0x26a95a;})});}if(_0x2e5ef2['query'][_0x889b('0x58')]){var _0x4688d8=_0x2e5ef2[_0x889b('0x37')][_0x889b('0x58')]['split'](',');var _0x54a060={};_0x54a060[_0x4688d8[0x0]]={'$gte':moment(_0x4688d8[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2fcacb[_0x889b('0x3f')]=_[_0x889b('0x42')](_0x2fcacb[_0x889b('0x3f')],_0x54a060);}_0x2fcacb=_[_0x889b('0x42')]({},_0x2fcacb,_0x2e5ef2[_0x889b('0x43')]);return _0x11efa0[_0x889b('0x57')](_0x2fcacb);}})[_0x889b('0x28')](function(_0x4819c2){if(_0x4819c2){_0x263432=_0x4819c2[_0x889b('0x3c')];if(!_0x2e5ef2[_0x889b('0x37')][_0x889b('0x59')]('nolimit')){_0x2fcacb[_0x889b('0x20')]=qs[_0x889b('0x20')](_0x2e5ef2[_0x889b('0x37')][_0x889b('0x20')]);_0x2fcacb[_0x889b('0x1e')]=qs[_0x889b('0x1e')](_0x2e5ef2[_0x889b('0x37')][_0x889b('0x1e')]);}return _0x11efa0[_0x889b('0x57')](_0x2fcacb);}})[_0x889b('0x28')](function(_0xcfcfc5){if(_0xcfcfc5){return _0xcfcfc5?{'count':_0x263432,'rows':_0xcfcfc5}:null;}})[_0x889b('0x28')](respondWithResult(_0x5a80e6,null))[_0x889b('0x46')](handleError(_0x5a80e6,null));}; \ No newline at end of file +var _0xa980=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','ChatGroup','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','describe','ChatInternalMessage','params','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','filter','nolimit','removeMembers','ChatGroupId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xd1ba08,_0x140501){var _0xcd13e1=function(_0x1fb6ce){while(--_0x1fb6ce){_0xd1ba08['push'](_0xd1ba08['shift']());}};_0xcd13e1(++_0x140501);}(_0xa980,0x164));var _0x0a98=function(_0x1faf7b,_0xbda798){_0x1faf7b=_0x1faf7b-0x0;var _0x4cca5b=_0xa980[_0x1faf7b];return _0x4cca5b;};'use strict';var emlformat=require(_0x0a98('0x0'));var rimraf=require(_0x0a98('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a98('0x2'));var rp=require(_0x0a98('0x3'));var moment=require('moment');var BPromise=require(_0x0a98('0x4'));var Mustache=require(_0x0a98('0x5'));var util=require(_0x0a98('0x6'));var path=require('path');var sox=require(_0x0a98('0x7'));var csv=require(_0x0a98('0x8'));var ejs=require(_0x0a98('0x9'));var fs=require('fs');var fs_extra=require(_0x0a98('0xa'));var _=require(_0x0a98('0xb'));var squel=require('squel');var crypto=require(_0x0a98('0xc'));var jsforce=require(_0x0a98('0xd'));var deskjs=require(_0x0a98('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0a98('0xf'));var Papa=require('papaparse');var Redis=require(_0x0a98('0x10'));var authService=require(_0x0a98('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a98('0x12'));var logger=require('../../config/logger')(_0x0a98('0x13'));var utils=require('../../config/utils');var config=require(_0x0a98('0x14'));var licenseUtil=require(_0x0a98('0x15'));var db=require('../../mysqldb')['db'];config[_0x0a98('0x16')]=_[_0x0a98('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a98('0x16')]));require(_0x0a98('0x18'))[_0x0a98('0x19')](socket);function respondWithStatusCode(_0x3905c9,_0x369394){_0x369394=_0x369394||0xcc;return function(_0x1fd4ff){if(_0x1fd4ff){return _0x3905c9[_0x0a98('0x1a')](_0x369394);}return _0x3905c9[_0x0a98('0x1b')](_0x369394)[_0x0a98('0x1c')]();};}function respondWithResult(_0x4f7be0,_0x5d4ba7){_0x5d4ba7=_0x5d4ba7||0xc8;return function(_0x1be2c4){if(_0x1be2c4){return _0x4f7be0[_0x0a98('0x1b')](_0x5d4ba7)[_0x0a98('0x1d')](_0x1be2c4);}};}function respondWithFilteredResult(_0x192436,_0x24a2d8){return function(_0x282b9a){if(_0x282b9a){var _0x177eef=typeof _0x24a2d8[_0x0a98('0x1e')]===_0x0a98('0x1f')&&typeof _0x24a2d8['limit']==='undefined';var _0x1f278c=_0x282b9a[_0x0a98('0x20')];var _0x253dbb=_0x177eef?0x0:_0x24a2d8[_0x0a98('0x1e')];var _0x4c8808=_0x177eef?_0x282b9a[_0x0a98('0x20')]:_0x24a2d8[_0x0a98('0x1e')]+_0x24a2d8[_0x0a98('0x21')];var _0x1143c1;if(_0x4c8808>=_0x1f278c){_0x4c8808=_0x1f278c;_0x1143c1=0xc8;}else{_0x1143c1=0xce;}_0x192436['status'](_0x1143c1);return _0x192436[_0x0a98('0x22')](_0x0a98('0x23'),_0x253dbb+'-'+_0x4c8808+'/'+_0x1f278c)[_0x0a98('0x1d')](_0x282b9a);}return null;};}function patchUpdates(_0x3b5d24){return function(_0x6fbc36){try{jsonpatch['apply'](_0x6fbc36,_0x3b5d24,!![]);}catch(_0x2fced9){return BPromise[_0x0a98('0x24')](_0x2fced9);}return _0x6fbc36[_0x0a98('0x25')]();};}function saveUpdates(_0x46ddbd,_0xccf83a){return function(_0x370793){if(_0x370793){return _0x370793[_0x0a98('0x26')](_0x46ddbd)['then'](function(_0x2fa5a3){return _0x2fa5a3;});}return null;};}function removeEntity(_0x1aa606,_0x1778a6){return function(_0x44a36b){if(_0x44a36b){return _0x44a36b[_0x0a98('0x27')]()[_0x0a98('0x28')](function(){_0x1aa606[_0x0a98('0x1b')](0xcc)[_0x0a98('0x1c')]();});}};}function handleEntityNotFound(_0x7a67a4,_0x2330e2){return function(_0x444cdf){if(!_0x444cdf){_0x7a67a4['sendStatus'](0x194);}return _0x444cdf;};}function handleError(_0x1d7061,_0x5d3274){_0x5d3274=_0x5d3274||0x1f4;return function(_0x39da62){logger[_0x0a98('0x29')](_0x39da62['stack']);if(_0x39da62[_0x0a98('0x2a')]){delete _0x39da62[_0x0a98('0x2a')];}_0x1d7061['status'](_0x5d3274)[_0x0a98('0x2b')](_0x39da62);};}exports['index']=function(_0x222c85,_0x495c5f){var _0x76de17={},_0x93d5cf={},_0x106ee3={'count':0x0,'rows':[]};var _0x1f2957=_[_0x0a98('0x2c')](db[_0x0a98('0x2d')]['rawAttributes'],function(_0x2c983a){return{'name':_0x2c983a[_0x0a98('0x2e')],'type':_0x2c983a['type'][_0x0a98('0x2f')]};});_0x93d5cf[_0x0a98('0x30')]=_[_0x0a98('0x2c')](_0x1f2957,_0x0a98('0x2a'));_0x93d5cf[_0x0a98('0x31')]=_[_0x0a98('0x32')](_0x222c85[_0x0a98('0x31')]);_0x93d5cf[_0x0a98('0x33')]=_[_0x0a98('0x34')](_0x93d5cf['model'],_0x93d5cf[_0x0a98('0x31')]);_0x76de17[_0x0a98('0x35')]=_[_0x0a98('0x34')](_0x93d5cf[_0x0a98('0x30')],qs[_0x0a98('0x36')](_0x222c85[_0x0a98('0x31')][_0x0a98('0x36')]));_0x76de17[_0x0a98('0x35')]=_0x76de17[_0x0a98('0x35')][_0x0a98('0x37')]?_0x76de17[_0x0a98('0x35')]:_0x93d5cf['model'];if(!_0x222c85[_0x0a98('0x31')][_0x0a98('0x38')]('nolimit')){_0x76de17[_0x0a98('0x21')]=qs[_0x0a98('0x21')](_0x222c85[_0x0a98('0x31')]['limit']);_0x76de17[_0x0a98('0x1e')]=qs[_0x0a98('0x1e')](_0x222c85[_0x0a98('0x31')][_0x0a98('0x1e')]);}_0x76de17['order']=qs[_0x0a98('0x39')](_0x222c85[_0x0a98('0x31')][_0x0a98('0x39')]);_0x76de17[_0x0a98('0x3a')]=qs[_0x0a98('0x33')](_[_0x0a98('0x3b')](_0x222c85[_0x0a98('0x31')],_0x93d5cf[_0x0a98('0x33')]),_0x1f2957);if(_0x222c85[_0x0a98('0x31')]['filter']){_0x76de17['where']=_[_0x0a98('0x3c')](_0x76de17['where'],{'$or':_[_0x0a98('0x2c')](_0x1f2957,function(_0x468001){if(_0x468001[_0x0a98('0x3d')]!==_0x0a98('0x3e')){var _0x17355a={};_0x17355a[_0x468001[_0x0a98('0x2a')]]={'$like':'%'+_0x222c85[_0x0a98('0x31')]['filter']+'%'};return _0x17355a;}})});}_0x76de17=_['merge']({},_0x76de17,_0x222c85[_0x0a98('0x3f')]);var _0x188f7a={'where':_0x76de17[_0x0a98('0x3a')]};return db[_0x0a98('0x2d')][_0x0a98('0x20')](_0x188f7a)[_0x0a98('0x28')](function(_0x136208){_0x106ee3['count']=_0x136208;if(_0x222c85[_0x0a98('0x31')][_0x0a98('0x40')]){_0x76de17[_0x0a98('0x41')]=[{'all':!![]}];}return db[_0x0a98('0x2d')][_0x0a98('0x42')](_0x76de17);})[_0x0a98('0x28')](function(_0x2b834e){_0x106ee3[_0x0a98('0x43')]=_0x2b834e;return _0x106ee3;})['then'](respondWithFilteredResult(_0x495c5f,_0x76de17))[_0x0a98('0x44')](handleError(_0x495c5f,null));};exports['show']=function(_0x2e2067,_0x27699b){var _0x2c80b8={'raw':!![],'where':{'id':_0x2e2067['params']['id']}},_0x493744={};_0x493744['model']=_[_0x0a98('0x32')](db['ChatGroup'][_0x0a98('0x45')]);_0x493744[_0x0a98('0x31')]=_[_0x0a98('0x32')](_0x2e2067[_0x0a98('0x31')]);_0x493744['filters']=_[_0x0a98('0x34')](_0x493744[_0x0a98('0x30')],_0x493744[_0x0a98('0x31')]);_0x2c80b8['attributes']=_[_0x0a98('0x34')](_0x493744[_0x0a98('0x30')],qs[_0x0a98('0x36')](_0x2e2067['query'][_0x0a98('0x36')]));_0x2c80b8[_0x0a98('0x35')]=_0x2c80b8[_0x0a98('0x35')][_0x0a98('0x37')]?_0x2c80b8[_0x0a98('0x35')]:_0x493744[_0x0a98('0x30')];if(_0x2e2067[_0x0a98('0x31')][_0x0a98('0x40')]){_0x2c80b8[_0x0a98('0x41')]=[{'all':!![]}];}_0x2c80b8=_[_0x0a98('0x3c')]({},_0x2c80b8,_0x2e2067[_0x0a98('0x3f')]);return db['ChatGroup'][_0x0a98('0x46')](_0x2c80b8)[_0x0a98('0x28')](handleEntityNotFound(_0x27699b,null))[_0x0a98('0x28')](respondWithResult(_0x27699b,null))[_0x0a98('0x44')](handleError(_0x27699b,null));};exports[_0x0a98('0x47')]=function(_0x2e27f3,_0x5053b7){return db[_0x0a98('0x2d')][_0x0a98('0x47')](_0x2e27f3['body'],{})[_0x0a98('0x28')](respondWithResult(_0x5053b7,0xc9))[_0x0a98('0x44')](handleError(_0x5053b7,null));};exports[_0x0a98('0x26')]=function(_0x45e3fb,_0x43668b){if(_0x45e3fb[_0x0a98('0x48')]['id']){delete _0x45e3fb[_0x0a98('0x48')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x45e3fb['params']['id']}})[_0x0a98('0x28')](handleEntityNotFound(_0x43668b,null))[_0x0a98('0x28')](saveUpdates(_0x45e3fb['body'],null))[_0x0a98('0x28')](respondWithResult(_0x43668b,null))['catch'](handleError(_0x43668b,null));};exports[_0x0a98('0x27')]=function(_0x584d64,_0x563e53){return db[_0x0a98('0x2d')][_0x0a98('0x46')]({'where':{'id':_0x584d64['params']['id']}})[_0x0a98('0x28')](handleEntityNotFound(_0x563e53,null))[_0x0a98('0x28')](removeEntity(_0x563e53,null))[_0x0a98('0x44')](handleError(_0x563e53,null));};exports[_0x0a98('0x49')]=function(_0x5db258,_0x4c0457){return db[_0x0a98('0x2d')][_0x0a98('0x49')]()[_0x0a98('0x28')](respondWithResult(_0x4c0457,null))[_0x0a98('0x44')](handleError(_0x4c0457,null));};exports['getUnread']=function(_0x240980,_0x156caa,_0x16ce9f){return db[_0x0a98('0x4a')]['count']({'where':{'ChatGroupId':_0x240980[_0x0a98('0x4b')]['id'],'ToId':_0x240980[_0x0a98('0x4c')]['id'],'read':![]}})[_0x0a98('0x28')](function(_0x1f0e35){return{'id':_[_0x0a98('0x4d')](_0x240980[_0x0a98('0x4b')]['id']),'count':_0x1f0e35};})['then'](respondWithResult(_0x156caa,null))[_0x0a98('0x44')](handleError(_0x156caa,null));};exports[_0x0a98('0x4e')]=function(_0x29e047,_0xc9535a,_0x56abbf){return db[_0x0a98('0x2d')]['find']({'where':{'id':_0x29e047[_0x0a98('0x4b')]['id']}})[_0x0a98('0x28')](handleEntityNotFound(_0xc9535a,null))['then'](function(_0x1567ec){if(_0x1567ec){return _0x1567ec['addMembers'](_0x29e047['body'][_0x0a98('0x4f')],_[_0x0a98('0x50')](_0x29e047[_0x0a98('0x48')],[_0x0a98('0x4f'),'id'])||{});}})['then'](respondWithResult(_0xc9535a,null))['catch'](handleError(_0xc9535a,null));};exports[_0x0a98('0x51')]=function(_0x276e74,_0x45b6a3,_0x5b48d8){var _0xb2475={};var _0x171d5a={};var _0x22a9c4;var _0x34ffd8;return db[_0x0a98('0x2d')][_0x0a98('0x52')]({'where':{'id':_0x276e74[_0x0a98('0x4b')]['id']}})[_0x0a98('0x28')](handleEntityNotFound(_0x45b6a3,null))[_0x0a98('0x28')](function(_0x1a493a){if(_0x1a493a){_0x22a9c4=_0x1a493a;_0x171d5a[_0x0a98('0x30')]=_[_0x0a98('0x32')](db[_0x0a98('0x53')][_0x0a98('0x45')]);_0x171d5a['query']=_[_0x0a98('0x32')](_0x276e74[_0x0a98('0x31')]);_0x171d5a[_0x0a98('0x33')]=_[_0x0a98('0x34')](_0x171d5a[_0x0a98('0x30')],_0x171d5a[_0x0a98('0x31')]);_0xb2475['attributes']=_[_0x0a98('0x34')](_0x171d5a['model'],qs[_0x0a98('0x36')](_0x276e74[_0x0a98('0x31')][_0x0a98('0x36')]));_0xb2475[_0x0a98('0x35')]=_0xb2475[_0x0a98('0x35')][_0x0a98('0x37')]?_0xb2475['attributes']:_0x171d5a[_0x0a98('0x30')];_0xb2475[_0x0a98('0x54')]=qs[_0x0a98('0x39')](_0x276e74[_0x0a98('0x31')][_0x0a98('0x39')]);_0xb2475[_0x0a98('0x3a')]=qs[_0x0a98('0x33')](_['pick'](_0x276e74[_0x0a98('0x31')],_0x171d5a[_0x0a98('0x33')]));if(_0x276e74[_0x0a98('0x31')]['filter']){_0xb2475[_0x0a98('0x3a')]=_[_0x0a98('0x3c')](_0xb2475[_0x0a98('0x3a')],{'$or':_[_0x0a98('0x2c')](_0xb2475[_0x0a98('0x35')],function(_0x3d4448){var _0x9102ce={};_0x9102ce[_0x3d4448]={'$like':'%'+_0x276e74[_0x0a98('0x31')][_0x0a98('0x55')]+'%'};return _0x9102ce;})});}_0xb2475=_[_0x0a98('0x3c')]({},_0xb2475,_0x276e74[_0x0a98('0x3f')]);return _0x22a9c4[_0x0a98('0x51')](_0xb2475);}})[_0x0a98('0x28')](function(_0x3594b0){if(_0x3594b0){_0x34ffd8=_0x3594b0['length'];if(!_0x276e74['query'][_0x0a98('0x38')](_0x0a98('0x56'))){_0xb2475[_0x0a98('0x21')]=qs[_0x0a98('0x21')](_0x276e74[_0x0a98('0x31')][_0x0a98('0x21')]);_0xb2475[_0x0a98('0x1e')]=qs[_0x0a98('0x1e')](_0x276e74['query']['offset']);}return _0x22a9c4['getMembers'](_0xb2475);}})[_0x0a98('0x28')](function(_0x341abf){if(_0x341abf){return _0x341abf?{'count':_0x34ffd8,'rows':_0x341abf}:null;}})['then'](respondWithResult(_0x45b6a3,null))[_0x0a98('0x44')](handleError(_0x45b6a3,null));};exports[_0x0a98('0x57')]=function(_0x5398c8,_0x5a64eb,_0x503254){return db[_0x0a98('0x2d')][_0x0a98('0x46')]({'where':{'id':_0x5398c8[_0x0a98('0x4b')]['id']}})[_0x0a98('0x28')](handleEntityNotFound(_0x5a64eb,null))['then'](function(_0x89ef11){if(_0x89ef11){return _0x89ef11[_0x0a98('0x57')](_0x5398c8[_0x0a98('0x31')][_0x0a98('0x4f')]);}})['then'](respondWithStatusCode(_0x5a64eb,null))[_0x0a98('0x44')](handleError(_0x5a64eb,null));};exports['addMessage']=function(_0x35003a,_0x366308,_0x3862e0){if(_0x35003a[_0x0a98('0x48')]['id']){delete _0x35003a[_0x0a98('0x48')]['id'];}return db['ChatGroup'][_0x0a98('0x46')]({'where':{'id':_0x35003a['params']['id']}})[_0x0a98('0x28')](handleEntityNotFound(_0x366308,null))[_0x0a98('0x28')](function(_0x4bf8ef){if(_0x4bf8ef){_0x35003a['body'][_0x0a98('0x58')]=_0x4bf8ef['id'];return db[_0x0a98('0x4a')][_0x0a98('0x47')](_0x35003a['body']);}})['then'](respondWithResult(_0x366308,null))['catch'](handleError(_0x366308,null));};exports[_0x0a98('0x59')]=function(_0x442f7a,_0x112516,_0x30400c){var _0x47abb3={};var _0x1a533d={};var _0x382c53;var _0x988f64;return db[_0x0a98('0x2d')][_0x0a98('0x52')]({'where':{'id':_0x442f7a[_0x0a98('0x4b')]['id']}})[_0x0a98('0x28')](handleEntityNotFound(_0x112516,null))[_0x0a98('0x28')](function(_0x22068c){if(_0x22068c){_0x382c53=_0x22068c;_0x1a533d[_0x0a98('0x30')]=_[_0x0a98('0x32')](db[_0x0a98('0x4a')][_0x0a98('0x45')]);_0x1a533d['query']=_[_0x0a98('0x32')](_0x442f7a[_0x0a98('0x31')]);_0x1a533d[_0x0a98('0x33')]=_[_0x0a98('0x34')](_0x1a533d['model'],_0x1a533d['query']);_0x47abb3['attributes']=_['intersection'](_0x1a533d[_0x0a98('0x30')],qs['fields'](_0x442f7a[_0x0a98('0x31')][_0x0a98('0x36')]));_0x47abb3['attributes']=_0x47abb3[_0x0a98('0x35')][_0x0a98('0x37')]?_0x47abb3[_0x0a98('0x35')]:_0x1a533d[_0x0a98('0x30')];_0x47abb3[_0x0a98('0x54')]=qs[_0x0a98('0x39')](_0x442f7a['query'][_0x0a98('0x39')]);_0x47abb3['where']=qs[_0x0a98('0x33')](_[_0x0a98('0x3b')](_0x442f7a[_0x0a98('0x31')],_0x1a533d[_0x0a98('0x33')]));if(_0x442f7a[_0x0a98('0x31')]['filter']){_0x47abb3[_0x0a98('0x3a')]=_[_0x0a98('0x3c')](_0x47abb3[_0x0a98('0x3a')],{'$or':_['map'](_0x47abb3['attributes'],function(_0x4859f9){var _0x4f0aa4={};_0x4f0aa4[_0x4859f9]={'$like':'%'+_0x442f7a[_0x0a98('0x31')][_0x0a98('0x55')]+'%'};return _0x4f0aa4;})});}if(_0x442f7a[_0x0a98('0x31')][_0x0a98('0x5a')]){var _0x1061e1=_0x442f7a['query'][_0x0a98('0x5a')]['split'](',');var _0x5ef5ae={};_0x5ef5ae[_0x1061e1[0x0]]={'$gte':moment(_0x1061e1[0x1])['format'](_0x0a98('0x5b'))};_0x47abb3['where']=_['merge'](_0x47abb3[_0x0a98('0x3a')],_0x5ef5ae);}_0x47abb3=_['merge']({},_0x47abb3,_0x442f7a[_0x0a98('0x3f')]);return _0x382c53['getMessages'](_0x47abb3);}})[_0x0a98('0x28')](function(_0x311a79){if(_0x311a79){_0x988f64=_0x311a79[_0x0a98('0x37')];if(!_0x442f7a['query']['hasOwnProperty'](_0x0a98('0x56'))){_0x47abb3['limit']=qs[_0x0a98('0x21')](_0x442f7a[_0x0a98('0x31')][_0x0a98('0x21')]);_0x47abb3['offset']=qs[_0x0a98('0x1e')](_0x442f7a[_0x0a98('0x31')][_0x0a98('0x1e')]);}return _0x382c53[_0x0a98('0x59')](_0x47abb3);}})[_0x0a98('0x28')](function(_0x53da17){if(_0x53da17){return _0x53da17?{'count':_0x988f64,'rows':_0x53da17}:null;}})[_0x0a98('0x28')](respondWithResult(_0x112516,null))[_0x0a98('0x44')](handleError(_0x112516,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5b74935..0c15d19 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 _0xaf97=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x4fa491,_0x3a9ad4){var _0x332aee=function(_0x59bd7b){while(--_0x59bd7b){_0x4fa491['push'](_0x4fa491['shift']());}};_0x332aee(++_0x3a9ad4);}(_0xaf97,0x15a));var _0x7af9=function(_0x4d6522,_0x21bd89){_0x4d6522=_0x4d6522-0x0;var _0x197192=_0xaf97[_0x4d6522];return _0x197192;};'use strict';var EventEmitter=require(_0x7af9('0x0'));var ChatGroup=require(_0x7af9('0x1'))['db'][_0x7af9('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7af9('0x3')](0x0);var events={'afterCreate':_0x7af9('0x4'),'afterUpdate':'update','afterDestroy':_0x7af9('0x5')};function emitEvent(_0x1d6e9f){return function(_0x3fd76e,_0x1dce1d,_0x540a77){ChatGroupEvents[_0x7af9('0x6')](_0x1d6e9f+':'+_0x3fd76e['id'],_0x3fd76e);ChatGroupEvents[_0x7af9('0x6')](_0x1d6e9f,_0x3fd76e);_0x540a77(null);};}for(var e in events){if(events[_0x7af9('0x7')](e)){var event=events[e];ChatGroup[_0x7af9('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xb334=['update','remove','hasOwnProperty','hook','events','../../mysqldb','ChatGroup'];(function(_0x28e1fb,_0x5d4528){var _0x4f64c0=function(_0x22dadf){while(--_0x22dadf){_0x28e1fb['push'](_0x28e1fb['shift']());}};_0x4f64c0(++_0x5d4528);}(_0xb334,0x1bd));var _0x4b33=function(_0x90318e,_0x48f59f){_0x90318e=_0x90318e-0x0;var _0x55e168=_0xb334[_0x90318e];return _0x55e168;};'use strict';var EventEmitter=require(_0x4b33('0x0'));var ChatGroup=require(_0x4b33('0x1'))['db'][_0x4b33('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b33('0x3'),'afterDestroy':_0x4b33('0x4')};function emitEvent(_0x38a00e){return function(_0x22407b,_0x183e61,_0x56db5e){ChatGroupEvents['emit'](_0x38a00e+':'+_0x22407b['id'],_0x22407b);ChatGroupEvents['emit'](_0x38a00e,_0x22407b);_0x56db5e(null);};}for(var e in events){if(events[_0x4b33('0x5')](e)){var event=events[e];ChatGroup[_0x4b33('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6a4cc96..2e8cad4 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 _0xb878=['request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x16bd7f,_0x4ba1cc){var _0x2a7896=function(_0x7af938){while(--_0x7af938){_0x16bd7f['push'](_0x16bd7f['shift']());}};_0x2a7896(++_0x4ba1cc);}(_0xb878,0xa3));var _0x8b87=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb878[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8b87('0x0'));var util=require(_0x8b87('0x1'));var logger=require(_0x8b87('0x2'))(_0x8b87('0x3'));var moment=require(_0x8b87('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b87('0x5'));var fs=require('fs');var path=require(_0x8b87('0x6'));var rimraf=require(_0x8b87('0x7'));var config=require(_0x8b87('0x8'));var attributes=require(_0x8b87('0x9'));module[_0x8b87('0xa')]=function(_0x5de16d,_0xbac6a8){return _0x5de16d[_0x8b87('0xb')](_0x8b87('0xc'),attributes,{'tableName':_0x8b87('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x290f=['./chatGroup.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x290f,0x162));var _0xf290=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x290f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf290('0x0'));var util=require('util');var logger=require(_0xf290('0x1'))(_0xf290('0x2'));var moment=require(_0xf290('0x3'));var BPromise=require(_0xf290('0x4'));var rp=require(_0xf290('0x5'));var fs=require('fs');var path=require(_0xf290('0x6'));var rimraf=require(_0xf290('0x7'));var config=require(_0xf290('0x8'));var attributes=require(_0xf290('0x9'));module['exports']=function(_0xb33db3,_0x5ee272){return _0xb33db3[_0xf290('0xa')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5583019..5885989 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 _0x06f4=['request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatGroup.socket','request','info'];(function(_0x9c3c94,_0x296e5a){var _0x598937=function(_0x2e3c3b){while(--_0x2e3c3b){_0x9c3c94['push'](_0x9c3c94['shift']());}};_0x598937(++_0x296e5a);}(_0x06f4,0x136));var _0x406f=function(_0x2d435d,_0x56edee){_0x2d435d=_0x2d435d-0x0;var _0x38d715=_0x06f4[_0x2d435d];return _0x38d715;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var moment=require('moment');var BPromise=require(_0x406f('0x2'));var rs=require(_0x406f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x406f('0x4'));var logger=require('../../config/logger')(_0x406f('0x5'));var config=require(_0x406f('0x6'));var jayson=require(_0x406f('0x7'));var client=jayson[_0x406f('0x8')]['http']({'port':0x232a});config[_0x406f('0x9')]=_['defaults'](config[_0x406f('0x9')],{'host':_0x406f('0xa'),'port':0x18eb});var socket=require(_0x406f('0xb'))(new Redis(config['redis']));require(_0x406f('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b46bf,_0xd817eb,_0x56edc2){return new BPromise(function(_0x28c5a5,_0x4e0e96){return client[_0x406f('0xd')](_0x5b46bf,_0x56edc2)['then'](function(_0xb2c62d){logger[_0x406f('0xe')]('ChatGroup,\x20%s,\x20%s',_0xd817eb,_0x406f('0xf'));logger[_0x406f('0x10')](_0x406f('0x11'),_0xd817eb,_0x406f('0xf'),JSON[_0x406f('0x12')](_0xb2c62d));if(_0xb2c62d[_0x406f('0x13')]){if(_0xb2c62d[_0x406f('0x13')][_0x406f('0x14')]===0x1f4){logger[_0x406f('0x13')](_0x406f('0x15'),_0xd817eb,_0xb2c62d[_0x406f('0x13')]['message']);return _0x4e0e96(_0xb2c62d[_0x406f('0x13')][_0x406f('0x16')]);}logger[_0x406f('0x13')]('ChatGroup,\x20%s,\x20%s',_0xd817eb,_0xb2c62d[_0x406f('0x13')][_0x406f('0x16')]);return _0x28c5a5(_0xb2c62d['error']['message']);}else{logger[_0x406f('0xe')](_0x406f('0x15'),_0xd817eb,'request\x20sent');_0x28c5a5(_0xb2c62d[_0x406f('0x17')]['message']);}})[_0x406f('0x18')](function(_0x3ad3fe){logger[_0x406f('0x13')](_0x406f('0x15'),_0xd817eb,_0x3ad3fe);_0x4e0e96(_0x3ad3fe);});});} \ No newline at end of file +var _0x0fda=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x1a7dc2,_0x40596a){_0x1a7dc2=_0x1a7dc2-0x0;var _0x5169cb=_0x0fda[_0x1a7dc2];return _0x5169cb;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var rs=require(_0xa0fd('0x3'));var fs=require('fs');var Redis=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];var utils=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0fd('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xa0fd('0x9')]=_[_0xa0fd('0xa')](config[_0xa0fd('0x9')],{'host':_0xa0fd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0fd('0x9')]));require(_0xa0fd('0xc'))[_0xa0fd('0xd')](socket);function respondWithRpcPromise(_0x322a1a,_0x4e1873,_0x31088d){return new BPromise(function(_0x423616,_0x36634c){return client['request'](_0x322a1a,_0x31088d)[_0xa0fd('0xe')](function(_0x332e66){logger[_0xa0fd('0xf')](_0xa0fd('0x10'),_0x4e1873,_0xa0fd('0x11'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4e1873,_0xa0fd('0x11'),JSON[_0xa0fd('0x12')](_0x332e66));if(_0x332e66['error']){if(_0x332e66[_0xa0fd('0x13')][_0xa0fd('0x14')]===0x1f4){logger[_0xa0fd('0x13')](_0xa0fd('0x10'),_0x4e1873,_0x332e66[_0xa0fd('0x13')][_0xa0fd('0x15')]);return _0x36634c(_0x332e66[_0xa0fd('0x13')]['message']);}logger[_0xa0fd('0x13')](_0xa0fd('0x10'),_0x4e1873,_0x332e66['error']['message']);return _0x423616(_0x332e66[_0xa0fd('0x13')][_0xa0fd('0x15')]);}else{logger['info'](_0xa0fd('0x10'),_0x4e1873,_0xa0fd('0x11'));_0x423616(_0x332e66[_0xa0fd('0x16')]['message']);}})['catch'](function(_0x46e15a){logger['error'](_0xa0fd('0x10'),_0x4e1873,_0x46e15a);_0x36634c(_0x46e15a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e1a914c..652687c 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 _0x5b9b=['chatGroup:','./chatGroup.events','remove','emit'];(function(_0xd04b50,_0x3d635d){var _0x5de236=function(_0x9129b1){while(--_0x9129b1){_0xd04b50['push'](_0xd04b50['shift']());}};_0x5de236(++_0x3d635d);}(_0x5b9b,0x1e9));var _0xb5b9=function(_0x147622,_0x300df4){_0x147622=_0x147622-0x0;var _0x19e095=_0x5b9b[_0x147622];return _0x19e095;};'use strict';var ChatGroupEvents=require(_0xb5b9('0x0'));var events=['save',_0xb5b9('0x1'),'update'];function createListener(_0x4ce575,_0x266895){return function(_0x3ba5f2){_0x266895[_0xb5b9('0x2')](_0x4ce575,_0x3ba5f2);};}function removeListener(_0x499ddd,_0x38d83e){return function(){ChatGroupEvents['removeListener'](_0x499ddd,_0x38d83e);};}exports['register']=function(_0x56f77b){for(var _0x15e803=0x0,_0x363cfb=events['length'];_0x15e803<_0x363cfb;_0x15e803++){var _0x19f2cb=events[_0x15e803];var _0x248e1b=createListener(_0xb5b9('0x3')+_0x19f2cb,_0x56f77b);ChatGroupEvents['on'](_0x19f2cb,_0x248e1b);}}; \ No newline at end of file +var _0x1640=['./chatGroup.events','save','update','emit','register','chatGroup:'];(function(_0x30f15d,_0x1122c6){var _0x569010=function(_0x3469b0){while(--_0x3469b0){_0x30f15d['push'](_0x30f15d['shift']());}};_0x569010(++_0x1122c6);}(_0x1640,0x126));var _0x0164=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x1640[_0x51020b];return _0x371e47;};'use strict';var ChatGroupEvents=require(_0x0164('0x0'));var events=[_0x0164('0x1'),'remove',_0x0164('0x2')];function createListener(_0xf2d6d,_0x3cd97d){return function(_0x42669b){_0x3cd97d[_0x0164('0x3')](_0xf2d6d,_0x42669b);};}function removeListener(_0xa26aa1,_0x56c8ad){return function(){ChatGroupEvents['removeListener'](_0xa26aa1,_0x56c8ad);};}exports[_0x0164('0x4')]=function(_0x45f512){for(var _0x5a4365=0x0,_0x33457b=events['length'];_0x5a4365<_0x33457b;_0x5a4365++){var _0x34fb5e=events[_0x5a4365];var _0xebfe66=createListener(_0x0164('0x5')+_0x34fb5e,_0x45f512);ChatGroupEvents['on'](_0x34fb5e,_0xebfe66);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 63452c7..c0bad4f 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 _0x90d5=['show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','create','addMembers','post','addMessage','/:id','update','delete','destroy','removeMembers','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x90d5,0x1cf));var _0x590d=function(_0x390420,_0x4b20cc){_0x390420=_0x390420-0x0;var _0x3200a0=_0x90d5[_0x390420];return _0x3200a0;};'use strict';var multer=require('multer');var util=require(_0x590d('0x0'));var path=require('path');var timeout=require(_0x590d('0x1'));var express=require(_0x590d('0x2'));var router=express[_0x590d('0x3')]();var fs_extra=require(_0x590d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x590d('0x5'));var config=require(_0x590d('0x6'));var controller=require(_0x590d('0x7'));router[_0x590d('0x8')]('/',auth[_0x590d('0x9')](),controller[_0x590d('0xa')]);router['get'](_0x590d('0xb'),auth[_0x590d('0x9')](),controller[_0x590d('0xc')]);router[_0x590d('0x8')]('/:id',auth[_0x590d('0x9')](),controller[_0x590d('0xd')]);router[_0x590d('0x8')](_0x590d('0xe'),auth[_0x590d('0x9')](),controller[_0x590d('0xf')]);router[_0x590d('0x8')](_0x590d('0x10'),auth[_0x590d('0x9')](),controller['getMembers']);router[_0x590d('0x8')](_0x590d('0x11'),auth[_0x590d('0x9')](),controller[_0x590d('0x12')]);router['post']('/',auth[_0x590d('0x9')](),controller[_0x590d('0x13')]);router['post']('/:id/members',auth[_0x590d('0x9')](),controller[_0x590d('0x14')]);router[_0x590d('0x15')](_0x590d('0x11'),auth[_0x590d('0x9')](),controller[_0x590d('0x16')]);router['put'](_0x590d('0x17'),auth[_0x590d('0x9')](),controller[_0x590d('0x18')]);router[_0x590d('0x19')](_0x590d('0x17'),auth[_0x590d('0x9')](),controller[_0x590d('0x1a')]);router[_0x590d('0x19')](_0x590d('0x10'),auth[_0x590d('0x9')](),controller[_0x590d('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x9df5=['../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','put','update','delete','/:id','removeMembers','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x9df5,0xdb));var _0x59df=function(_0x61ca21,_0x4df1c4){_0x61ca21=_0x61ca21-0x0;var _0x66c284=_0x9df5[_0x61ca21];return _0x66c284;};'use strict';var multer=require(_0x59df('0x0'));var util=require(_0x59df('0x1'));var path=require('path');var timeout=require(_0x59df('0x2'));var express=require(_0x59df('0x3'));var router=express['Router']();var fs_extra=require(_0x59df('0x4'));var auth=require(_0x59df('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x59df('0x6'));var controller=require(_0x59df('0x7'));router[_0x59df('0x8')]('/',auth[_0x59df('0x9')](),controller[_0x59df('0xa')]);router[_0x59df('0x8')](_0x59df('0xb'),auth['isAuthenticated'](),controller[_0x59df('0xc')]);router[_0x59df('0x8')]('/:id',auth[_0x59df('0x9')](),controller[_0x59df('0xd')]);router[_0x59df('0x8')](_0x59df('0xe'),auth[_0x59df('0x9')](),controller[_0x59df('0xf')]);router[_0x59df('0x8')](_0x59df('0x10'),auth['isAuthenticated'](),controller[_0x59df('0x11')]);router['get'](_0x59df('0x12'),auth['isAuthenticated'](),controller[_0x59df('0x13')]);router[_0x59df('0x14')]('/',auth[_0x59df('0x9')](),controller['create']);router[_0x59df('0x14')](_0x59df('0x10'),auth[_0x59df('0x9')](),controller[_0x59df('0x15')]);router[_0x59df('0x14')](_0x59df('0x12'),auth[_0x59df('0x9')](),controller['addMessage']);router[_0x59df('0x16')]('/:id',auth[_0x59df('0x9')](),controller[_0x59df('0x17')]);router[_0x59df('0x18')](_0x59df('0x19'),auth[_0x59df('0x9')](),controller['destroy']);router[_0x59df('0x18')](_0x59df('0x10'),auth['isAuthenticated'](),controller[_0x59df('0x1a')]);module[_0x59df('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 ed61cd4..d79019c 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 _0x0c1a=['exports','BOOLEAN','star','TEXT','STRING','DATE','out','sequelize'];(function(_0x6c85cf,_0x1cc257){var _0x4fd865=function(_0x3a06f3){while(--_0x3a06f3){_0x6c85cf['push'](_0x6c85cf['shift']());}};_0x4fd865(++_0x1cc257);}(_0x0c1a,0x127));var _0xa0c1=function(_0x46b5f1,_0x2b463f){_0x46b5f1=_0x46b5f1-0x0;var _0x1ab245=_0x0c1a[_0x46b5f1];return _0x1ab245;};'use strict';var Sequelize=require(_0xa0c1('0x0'));module[_0xa0c1('0x1')]={'closed':{'type':Sequelize[_0xa0c1('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xa0c1('0x3'),'thumb'),'defaultValue':_0xa0c1('0x3')},'ratingMessage':{'type':Sequelize[_0xa0c1('0x4')]},'pathTranscript':{'type':Sequelize[_0xa0c1('0x4')]},'mailTranscript':{'type':Sequelize[_0xa0c1('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa0c1('0x6')]},'disposition':{'type':Sequelize[_0xa0c1('0x5')]},'secondDisposition':{'type':Sequelize[_0xa0c1('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa0c1('0x5')]},'note':{'type':Sequelize[_0xa0c1('0x5')]},'browserName':{'type':Sequelize[_0xa0c1('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xa0c1('0x5')]},'osVersion':{'type':Sequelize[_0xa0c1('0x5')]},'deviceModel':{'type':Sequelize[_0xa0c1('0x5')]},'deviceVendor':{'type':Sequelize[_0xa0c1('0x5')]},'deviceType':{'type':Sequelize[_0xa0c1('0x5')]},'referer':{'type':Sequelize[_0xa0c1('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa0c1('0x4')]('long')},'read1stAt':{'type':Sequelize[_0xa0c1('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa0c1('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa0c1('0x5')]},'customerPort':{'type':Sequelize[_0xa0c1('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xa0c1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x2f68=['DATE','STRING','long','out','exports','BOOLEAN','INTEGER','ENUM','thumb','TEXT'];(function(_0x4d6675,_0x23beaa){var _0x2bd5bc=function(_0x573d07){while(--_0x573d07){_0x4d6675['push'](_0x4d6675['shift']());}};_0x2bd5bc(++_0x23beaa);}(_0x2f68,0x9a));var _0x82f6=function(_0x1d770b,_0x59ae9b){_0x1d770b=_0x1d770b-0x0;var _0x69b670=_0x2f68[_0x1d770b];return _0x69b670;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'closed':{'type':Sequelize[_0x82f6('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x82f6('0x2')]},'ratingType':{'type':Sequelize[_0x82f6('0x3')]('star',_0x82f6('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x82f6('0x5')]},'pathTranscript':{'type':Sequelize[_0x82f6('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x82f6('0x6')]},'disposition':{'type':Sequelize[_0x82f6('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x82f6('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x82f6('0x7')]},'osVersion':{'type':Sequelize[_0x82f6('0x7')]},'deviceModel':{'type':Sequelize[_0x82f6('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x82f6('0x7')]},'referer':{'type':Sequelize[_0x82f6('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x82f6('0x5')](_0x82f6('0x8'))},'read1stAt':{'type':Sequelize[_0x82f6('0x6')]},'lastMsgAt':{'type':Sequelize[_0x82f6('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x82f6('0x3')]('in',_0x82f6('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x82f6('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x82f6('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c40a398..3884de7 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 _0x8603=['Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','getMessages','nolimit','pick','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','getMyMessages','hasOwnProperty','includeAgent','addTags','setTags','spread','chatInteractionTags:save','removeTags','download','unix','server','files','attachments','Attachment','Account','Owner','mkdirSync','Chat','N.A.','closedAt','disposition','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','send','render','contact','agent','interaction','account','Users','fullname','Tags','TagIds','split','push','catch','index','map','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','Tag','forEach','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','customUpdate','abandon','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','basename','mimetype','attachmentDownload'];(function(_0xaff2d9,_0x561d58){var _0x680eb9=function(_0x2ed898){while(--_0x2ed898){_0xaff2d9['push'](_0xaff2d9['shift']());}};_0x680eb9(++_0x561d58);}(_0x8603,0x190));var _0x3860=function(_0x294bd1,_0x24e0cb){_0x294bd1=_0x294bd1-0x0;var _0x55603d=_0x8603[_0x294bd1];return _0x55603d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x3860('0x10'));var hardwareService=require(_0x3860('0x11'));var logger=require('../../config/logger')(_0x3860('0x12'));var utils=require(_0x3860('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3860('0x14'));var db=require(_0x3860('0x15'))['db'];config[_0x3860('0x16')]=_[_0x3860('0x17')](config[_0x3860('0x16')],{'host':_0x3860('0x18'),'port':0x18eb});var socket=require(_0x3860('0x19'))(new Redis(config[_0x3860('0x16')]));require(_0x3860('0x1a'))[_0x3860('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3860('0x1c')][_0x3860('0x1d')]({'port':0x232b});var client9004=jayson[_0x3860('0x1c')][_0x3860('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1055b3,_0xfa0c9a,_0x2d8a3a,_0x378305){return new BPromise(function(_0x311fdb,_0x3c0d91){var _0x3e51b4=_0x378305||client;return _0x3e51b4[_0x3860('0x1e')](_0x1055b3,_0x2d8a3a)['then'](function(_0x4863bd){logger[_0x3860('0x1f')](_0x3860('0x20'),_0xfa0c9a,_0x3860('0x21'));logger['debug'](_0x3860('0x22'),_0xfa0c9a,_0x3860('0x21'),JSON[_0x3860('0x23')](_0x4863bd));if(_0x4863bd[_0x3860('0x24')]){if(_0x4863bd[_0x3860('0x24')][_0x3860('0x25')]===0x1f4){logger[_0x3860('0x24')](_0x3860('0x20'),_0xfa0c9a,_0x4863bd[_0x3860('0x24')][_0x3860('0x26')]);return _0x3c0d91(_0x4863bd[_0x3860('0x24')][_0x3860('0x26')]);}logger[_0x3860('0x24')](_0x3860('0x20'),_0xfa0c9a,_0x4863bd[_0x3860('0x24')]['message']);return _0x311fdb(_0x4863bd[_0x3860('0x24')][_0x3860('0x26')]);}else{logger[_0x3860('0x1f')](_0x3860('0x20'),_0xfa0c9a,_0x3860('0x21'));_0x311fdb(_0x4863bd['result'][_0x3860('0x26')]);}})['catch'](function(_0x577750){logger[_0x3860('0x24')](_0x3860('0x20'),_0xfa0c9a,_0x577750);_0x3c0d91(_0x577750);});});}function respondWithStatusCode(_0x54b5ec,_0x4d9a90){_0x4d9a90=_0x4d9a90||0xcc;return function(_0x5f42d5){if(_0x5f42d5){return _0x54b5ec[_0x3860('0x27')](_0x4d9a90);}return _0x54b5ec[_0x3860('0x28')](_0x4d9a90)[_0x3860('0x29')]();};}function respondWithResult(_0x371f3a,_0x9332a5){_0x9332a5=_0x9332a5||0xc8;return function(_0x228d34){if(_0x228d34){return _0x371f3a['status'](_0x9332a5)['json'](_0x228d34);}};}function respondWithFilteredResult(_0x389bd0,_0x1f1809){return function(_0x5a9af2){if(_0x5a9af2){var _0x2551f4=typeof _0x1f1809[_0x3860('0x2a')]===_0x3860('0x2b')&&typeof _0x1f1809[_0x3860('0x2c')]===_0x3860('0x2b');var _0x4bbae9=_0x5a9af2[_0x3860('0x2d')];var _0xf624ba=_0x2551f4?0x0:_0x1f1809[_0x3860('0x2a')];var _0x4bd90c=_0x2551f4?_0x5a9af2[_0x3860('0x2d')]:_0x1f1809['offset']+_0x1f1809[_0x3860('0x2c')];var _0x4825f0;if(_0x4bd90c>=_0x4bbae9){_0x4bd90c=_0x4bbae9;_0x4825f0=0xc8;}else{_0x4825f0=0xce;}_0x389bd0[_0x3860('0x28')](_0x4825f0);return _0x389bd0[_0x3860('0x2e')](_0x3860('0x2f'),_0xf624ba+'-'+_0x4bd90c+'/'+_0x4bbae9)['json'](_0x5a9af2);}return null;};}function patchUpdates(_0x39c751){return function(_0x451b0c){try{jsonpatch['apply'](_0x451b0c,_0x39c751,!![]);}catch(_0x1c94cc){return BPromise['reject'](_0x1c94cc);}return _0x451b0c[_0x3860('0x30')]();};}function saveUpdates(_0x3a577a,_0x35185c){return function(_0x2fc231){if(_0x2fc231){return _0x2fc231[_0x3860('0x31')](_0x3a577a)[_0x3860('0x32')](function(_0x1d3fd0){return _0x1d3fd0;});}return null;};}function removeEntity(_0x4d30bc,_0x1a48b6){return function(_0x396ccf){if(_0x396ccf){return _0x396ccf['destroy']()[_0x3860('0x32')](function(){_0x4d30bc[_0x3860('0x28')](0xcc)[_0x3860('0x29')]();});}};}function handleEntityNotFound(_0x5af661,_0x523cc1){return function(_0x285b1b){if(!_0x285b1b){_0x5af661[_0x3860('0x27')](0x194);}return _0x285b1b;};}function handleError(_0x3abf18,_0xa921ed){_0xa921ed=_0xa921ed||0x1f4;return function(_0x59271f){logger['error'](_0x59271f[_0x3860('0x33')]);if(_0x59271f[_0x3860('0x34')]){delete _0x59271f[_0x3860('0x34')];}_0x3abf18[_0x3860('0x28')](_0xa921ed)[_0x3860('0x35')](_0x59271f);};}function getMustacheRender(_0x4df2a9,_0x424424){return Mustache[_0x3860('0x36')](_0x4df2a9,_['merge'](_0x424424['body'],{'contact':_0x424424[_0x3860('0x37')],'message':_0x424424[_0x3860('0x26')],'agent':_0x424424[_0x3860('0x38')],'interaction':_0x424424[_0x3860('0x39')],'account':_0x424424[_0x3860('0x3a')]}))||'';}function getInteractionUsers(_0x592311,_0x28f04d){return new BPromise(function(_0x510aef,_0x112600){try{if(_0x28f04d[_0x592311['id']]){_0x592311[_0x3860('0x3b')]=_['map'](_0x28f04d[_0x592311['id']],function(_0x36d9bd){return{'id':_0x36d9bd['id'],'fullname':_0x36d9bd[_0x3860('0x3c')]};});}}catch(_0x4f3303){_0x112600(_0x4f3303);}_0x510aef(_0x592311);});}function getInteractionTags(_0x1ef9aa,_0xc7d34d){return new BPromise(function(_0x15bd2c,_0xf346e){try{if(_0x1ef9aa['TagIds']){_0x1ef9aa[_0x3860('0x3d')]=[];_0x1ef9aa[_0x3860('0x3e')][_0x3860('0x3f')](',')['forEach'](function(_0x3a87e5){_0x1ef9aa['Tags'][_0x3860('0x40')](_0xc7d34d[_0x3a87e5]);});}delete _0x1ef9aa[_0x3860('0x3e')];}catch(_0x405bfc){_0xf346e(_0x405bfc);}_0x15bd2c(_0x1ef9aa);});}function updateChatInteraction(_0x3f613f,_0x2220c8,_0x3f4216){return new BPromise(function(_0x4e0a44,_0xbbbf01){return getInteractionUsers(_0x3f613f,_0x3f4216)[_0x3860('0x32')](function(_0x5dc78f){return getInteractionTags(_0x5dc78f,_0x2220c8);})['then'](function(_0x2938d4){_0x4e0a44(_0x2938d4);})[_0x3860('0x41')](function(_0x4f2f53){_0xbbbf01(_0x4f2f53);});});}exports[_0x3860('0x42')]=function(_0x30d8eb,_0x4c6c23){var _0xa6791a={},_0x56a650={},_0x392dc3={'count':0x0,'rows':[]};var _0x37e5c3=_[_0x3860('0x43')](db[_0x3860('0x44')][_0x3860('0x45')],function(_0x15ebbd){return{'name':_0x15ebbd[_0x3860('0x46')],'type':_0x15ebbd[_0x3860('0x47')][_0x3860('0x48')]};});_0x56a650[_0x3860('0x49')]=_[_0x3860('0x43')](_0x37e5c3,'name');_0x56a650[_0x3860('0x4a')]=_['keys'](_0x30d8eb[_0x3860('0x4a')]);_0x56a650[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0x56a650[_0x3860('0x49')],_0x56a650[_0x3860('0x4a')]);_0xa6791a[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0x56a650[_0x3860('0x49')],qs['fields'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x4e')]));_0xa6791a[_0x3860('0x4d')]=_0xa6791a['attributes'][_0x3860('0x4f')]?_0xa6791a[_0x3860('0x4d')]:_0x56a650[_0x3860('0x49')];if(!_0x30d8eb[_0x3860('0x4a')]['hasOwnProperty']('nolimit')){_0xa6791a[_0x3860('0x2c')]=qs['limit'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x2c')]);_0xa6791a[_0x3860('0x2a')]=qs['offset'](_0x30d8eb[_0x3860('0x4a')]['offset']);}_0xa6791a[_0x3860('0x50')]=qs['sort'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x51')]);_0xa6791a[_0x3860('0x52')]=qs['filters'](_['pick'](_0x30d8eb[_0x3860('0x4a')],_0x56a650[_0x3860('0x4b')]),_0x37e5c3);var _0x478dd9=[];var _0x3910f5=squel['select']()[_0x3860('0x53')]('id')[_0x3860('0x53')](_0x3860('0x34'))[_0x3860('0x53')](_0x3860('0x54'))[_0x3860('0x55')](_0x3860('0x56'));var _0x5a9987=squel[_0x3860('0x57')]()[_0x3860('0x53')](_0x3860('0x58'))[_0x3860('0x53')](_0x3860('0x59'))[_0x3860('0x53')]('ui.ChatInteractionId')[_0x3860('0x55')](_0x3860('0x5a'),'ui')[_0x3860('0x5b')](_0x3860('0x5c'),'u',_0x3860('0x5d'));var _0x1e2b5d=squel[_0x3860('0x57')]()[_0x3860('0x55')]('chat_interactions','i')[_0x3860('0x5b')](_0x3860('0x5e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3860('0x5b')](_0x3860('0x5c'),'o',_0x3860('0x5f'))['left_join'](_0x3860('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x3860('0x5b')](_0x3860('0x61'),'me',_0x3860('0x62'))[_0x3860('0x5b')](_0x3860('0x63'),'it',_0x3860('0x64'))[_0x3860('0x5b')](_0x3860('0x56'),'t',_0x3860('0x65'));var _0x151492=squel[_0x3860('0x66')]();var _0x2bac24=[];var _0x58147d=squel['expr']();var _0x5111e0;if(_0x30d8eb[_0x3860('0x4a')]['search']){_0x5111e0=as['parseSearch'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x67')]);var _0x2ff440=_0x5111e0[_0x3860('0x68')];for(var _0x3d6c17=0x0;_0x3d6c17<_0x5111e0[_0x3860('0x69')]['length'];_0x3d6c17++){var _0x49ec68=_0x5111e0['conditions'][_0x3d6c17];var _0x1d6c70='i';var _0x1c1da4=_[_0x3860('0x6a')](_0x37e5c3,['name',_0x49ec68[_0x3860('0x53')]]);if(!_0x1c1da4){switch(_0x49ec68['field']){case _0x3860('0x6b'):if(_0x49ec68[_0x3860('0x6c')]==0x1){_0x1e2b5d['having']('`'+_0x49ec68[_0x3860('0x53')]+_0x3860('0x6d'));}else{_0x1e2b5d[_0x3860('0x6e')]('`'+_0x49ec68[_0x3860('0x53')]+'`\x20>\x200');}break;case _0x3860('0x6f'):if(_0x49ec68[_0x3860('0x70')]===_0x3860('0x71')){if(_0x49ec68['value']['split']('\x20')[_0x3860('0x4f')]>0x1){_0x151492[_0x2ff440](_0x3860('0x72'),qs[_0x3860('0x73')](_0x49ec68[_0x3860('0x6c')]),null);}else{var _0x28a8b4='%'+_0x49ec68[_0x3860('0x6c')]+'%';_0x151492[_0x2ff440]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x28a8b4,_0x28a8b4,_0x28a8b4);}}else{_0x1c1da4=_[_0x3860('0x6a')](_0x37e5c3,[_0x3860('0x34'),'ContactId']);_0x49ec68[_0x3860('0x53')]=_0x3860('0x74');_0x3427a5=as[_0x3860('0x75')](_0x1d6c70,_0x1c1da4[_0x3860('0x47')],_0x49ec68);_0x151492[_0x2ff440](_0x3427a5[_0x3860('0x76')],_0x3427a5[_0x3860('0x6c')]['start'],_0x3427a5[_0x3860('0x6c')][_0x3860('0x29')]);}break;case _0x3860('0x77'):var _0x27e5ab=_0x49ec68[_0x3860('0x6c')][_0x3860('0x3f')](',')['map'](function(_0x1ae31b){return Number(_0x1ae31b);});_0x27e5ab[_0x3860('0x78')](function(_0x1c33dc){_0x58147d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1c33dc+',%');});_0x2bac24=_['union'](_0x2bac24,_0x27e5ab);break;case _0x3860('0x79'):if(_0x49ec68[_0x3860('0x70')]===_0x3860('0x71')){_0x151492[_0x2ff440](_0x3860('0x7a'),'%'+_0x49ec68[_0x3860('0x6c')]+'%',null);}else{_0x1c1da4=_['find'](_0x37e5c3,['name',_0x3860('0x7b')]);_0x49ec68[_0x3860('0x53')]='UserId';_0x3427a5=as['buildExpression'](_0x1d6c70,_0x1c1da4[_0x3860('0x47')],_0x49ec68);_0x151492[_0x2ff440](_0x3427a5[_0x3860('0x76')],_0x3427a5['value'][_0x3860('0x7c')],_0x3427a5[_0x3860('0x6c')][_0x3860('0x29')]);}break;case _0x3860('0x7d'):_0x3427a5=as['buildExpression']('me',null,_0x49ec68);_0x151492[_0x2ff440](_0x3427a5[_0x3860('0x76')],_0x3427a5[_0x3860('0x6c')]['start'],_0x3427a5['value'][_0x3860('0x29')]);break;}}else{var _0x3427a5=as['buildExpression'](_0x1d6c70,_0x1c1da4[_0x3860('0x47')],_0x49ec68);_0x151492[_0x2ff440](_0x3427a5['text'],_0x3427a5[_0x3860('0x6c')]['start'],_0x3427a5['value'][_0x3860('0x29')]);}}}else{var _0x49c356=_(_0x30d8eb[_0x3860('0x4a')])[_0x3860('0x7e')]()[_0x3860('0x43')](function(_0x2fd2f4){return _[_0x3860('0x7f')](_0x37e5c3,[_0x3860('0x34'),_0x2fd2f4])?_0x2fd2f4:undefined;})['compact']()[_0x3860('0x6c')]();if(!_[_0x3860('0x80')](_0x49c356)){_0x49c356[_0x3860('0x78')](function(_0x5d7cc4){if(_0x5d7cc4===_0x3860('0x81')){_0x1e2b5d['where'](_0x3860('0x82'),[][_0x3860('0x83')](_0x30d8eb['query'][_0x5d7cc4]));}else if(_0x5d7cc4===_0x3860('0x84')){var _0x2cd731=JSON[_0x3860('0x85')](_0x30d8eb['query'][_0x5d7cc4])['$gte'];var _0x5a282a=JSON['parse'](_0x30d8eb[_0x3860('0x4a')][_0x5d7cc4])[_0x3860('0x86')];_0x1e2b5d[_0x3860('0x52')](_0x3860('0x87'),_0x2cd731,_0x5a282a);}else{if(_0x30d8eb['query'][_0x5d7cc4]==='null'){_0x1e2b5d[_0x3860('0x52')]('i.'+_0x5d7cc4+_0x3860('0x88'));}else{_0x1e2b5d[_0x3860('0x52')]('i.'+_0x5d7cc4+_0x3860('0x89'),_0x30d8eb['query'][_0x5d7cc4]);}}});}if(_0x30d8eb[_0x3860('0x4a')][_0x3860('0x8a')]){if(_0x30d8eb['query']['read']==0x1){_0x1e2b5d[_0x3860('0x6e')](_0x3860('0x8b'));}else{_0x1e2b5d[_0x3860('0x6e')](_0x3860('0x8c'));}}if(_0x30d8eb['query']['tag']){_0x2bac24=_[_0x3860('0x8d')](_0x30d8eb['query'][_0x3860('0x8e')])?_0x30d8eb[_0x3860('0x4a')]['tag']:new Array(_0x30d8eb['query']['tag']);_0x2bac24[_0x3860('0x78')](function(_0x36116e){_0x58147d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x36116e+',%');});}if(_0x30d8eb[_0x3860('0x4a')][_0x3860('0x8f')]){var _0x2351fe=_0x30d8eb[_0x3860('0x4a')][_0x3860('0x8f')]['replace']('\x5c','\x5c\x5c')[_0x3860('0x90')](/'/g,'\x27\x27');if(qs[_0x3860('0x91')](_0x2351fe)){_0x151492['or'](_0x3860('0x92'),_0x2351fe+'%');}else{_0x151492['or'](_0x3860('0x93'),qs[_0x3860('0x73')](_0x2351fe))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2351fe+'%');}}}_0x1e2b5d[_0x3860('0x52')](_0x151492);_0x1e2b5d[_0x3860('0x94')](_0x3860('0x95'));var _0x41ee6f={'type':db[_0x3860('0x96')]['QueryTypes']['SELECT'],'raw':!![]};var _0x196c50=_0x1e2b5d[_0x3860('0x97')]();_0x196c50[_0x3860('0x53')](_0x3860('0x95'));_0x196c50[_0x3860('0x53')](_0x3860('0x98'),_0x3860('0x6b'));if(_0xa6791a['order']){_0xa6791a[_0x3860('0x50')][_0x3860('0x78')](function(_0x58eddd){var _0x1ff95b=_0x58eddd[0x0]===_0x3860('0x99')?_0x58eddd[0x0]:'i.'+_0x58eddd[0x0];_0x1e2b5d[_0x3860('0x50')](_0x1ff95b,_0x58eddd[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3860('0x80')](_0x2bac24)){_0x1e2b5d[_0x3860('0x6e')](_0x58147d);_0x196c50['where'](_0x3860('0x9a'),_0x2bac24);}BPromise['resolve']()[_0x3860('0x32')](function(){if(!_0x5111e0){if(_0x30d8eb[_0x3860('0x4a')]['ChatWebsiteId'])return;_0x196c50[_0x3860('0x52')](_0x3860('0x9b'));_0x1e2b5d[_0x3860('0x52')](_0x3860('0x9b'));return;}if(_0x30d8eb[_0x3860('0x9c')]['role']!==_0x3860('0x38'))return;return _0x30d8eb[_0x3860('0x9c')][_0x3860('0x9d')]({'attributes':['id'],'raw':!![]})[_0x3860('0x32')](function(_0x3c9837){if(_['isEmpty'](_0x3c9837)){_0x196c50['where'](_0x3860('0x9e'));_0x1e2b5d[_0x3860('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x196c50[_0x3860('0x52')](_0x3860('0x82'),_[_0x3860('0x43')](_0x3c9837,'id'));_0x1e2b5d[_0x3860('0x52')]('i.ChatWebsiteId\x20IN\x20?',_[_0x3860('0x43')](_0x3c9837,'id'));}});})['then'](function(){if(_0x30d8eb[_0x3860('0x9c')][_0x3860('0x9f')]===_0x3860('0x38')&&!_0x5111e0&&!_0x30d8eb[_0x3860('0x4a')][_0x3860('0x81')])return[];return db[_0x3860('0xa0')][_0x3860('0x4a')](_0x196c50['toString'](),_0x41ee6f);})[_0x3860('0x32')](function(_0x47396d){_0x392dc3['count']=_0x47396d['length'];if(_0x392dc3['count']===0x0)return[];return db['sequelize'][_0x3860('0x4a')](_0x3910f5[_0x3860('0xa1')](),_0x41ee6f)[_0x3860('0x32')](function(_0x1482cd){_0x478dd9=_[_0x3860('0xa2')](_0x1482cd,'id');_0x41ee6f=_[_0x3860('0xa3')](_0x41ee6f,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30d8eb[_0x3860('0x4a')]['fields']){_0xa6791a[_0x3860('0x4d')][_0x3860('0x78')](function(_0x897ea0){_0x1e2b5d[_0x3860('0x53')]('i.'+_0x897ea0);});}else{_0x1e2b5d[_0x3860('0x53')](_0x3860('0x98'),_0x3860('0x6b'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa4'),_0x3860('0xa5'));_0x1e2b5d[_0x3860('0x53')]('a.mandatoryDisposition',_0x3860('0xa6'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa7'),'contactName');_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa8'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa9'),'Contact.firstName');_0x1e2b5d[_0x3860('0x53')](_0x3860('0xaa'),_0x3860('0xab'));_0x1e2b5d['field'](_0x3860('0xac'),_0x3860('0xad'));_0x1e2b5d[_0x3860('0x53')]('c.phone',_0x3860('0xae'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xaf'),'Contact.mobile');_0x1e2b5d[_0x3860('0x53')](_0x3860('0xb0'),_0x3860('0xb1'));_0x1e2b5d['field'](_0x3860('0xb2'),_0x3860('0xb3'));_0x1e2b5d[_0x3860('0x53')]('o.internal',_0x3860('0xb4'));_0x1e2b5d['field'](_0x3860('0xb5'),'TagIds');}if(_0xa6791a[_0x3860('0x2c')])_0x1e2b5d[_0x3860('0x2c')](_0xa6791a[_0x3860('0x2c')]);if(_0xa6791a[_0x3860('0x2a')])_0x1e2b5d[_0x3860('0x2a')](_0xa6791a[_0x3860('0x2a')]);return db[_0x3860('0xa0')][_0x3860('0x4a')](_0x1e2b5d[_0x3860('0xa1')](),_0x41ee6f);})[_0x3860('0x32')](function(_0x10b4e8){if(_0x10b4e8[_0x3860('0x4f')]>0x0)_0x5a9987[_0x3860('0x52')](_0x3860('0xb6'),_[_0x3860('0x43')](_0x10b4e8,'id'));return db[_0x3860('0xa0')][_0x3860('0x4a')](_0x5a9987[_0x3860('0xa1')](),_0x41ee6f)['then'](function(_0x37575b){var _0x1d6d2b=_[_0x3860('0xb7')](_0x37575b,_0x3860('0xb8'));var _0x3e6bf8=[];_0x10b4e8[_0x3860('0x78')](function(_0xffe2a1){_0x3e6bf8[_0x3860('0x40')](updateChatInteraction(_0xffe2a1,_0x478dd9,_0x1d6d2b));});return BPromise[_0x3860('0xb9')](_0x3e6bf8);});});})[_0x3860('0x32')](function(_0x3b932d){_0x392dc3['rows']=_0x3b932d;return _0x392dc3;})[_0x3860('0x32')](respondWithFilteredResult(_0x4c6c23,_0xa6791a))[_0x3860('0x41')](handleError(_0x4c6c23,null));};exports[_0x3860('0xba')]=function(_0x6334ca,_0x4a929e){var _0x1a1994={'raw':![],'where':{'id':_0x6334ca[_0x3860('0xbb')]['id']}},_0x2ece36={};_0x2ece36[_0x3860('0x49')]=_['keys'](db[_0x3860('0x44')]['rawAttributes']);_0x2ece36['query']=_[_0x3860('0x7e')](_0x6334ca[_0x3860('0x4a')]);_0x2ece36[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0x2ece36[_0x3860('0x49')],_0x2ece36[_0x3860('0x4a')]);_0x1a1994[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0x2ece36[_0x3860('0x49')],qs[_0x3860('0x4e')](_0x6334ca[_0x3860('0x4a')][_0x3860('0x4e')]));_0x1a1994[_0x3860('0x4d')]=_0x1a1994['attributes'][_0x3860('0x4f')]?_0x1a1994['attributes']:_0x2ece36[_0x3860('0x49')];if(_0x6334ca[_0x3860('0x4a')]['includeAll']){_0x1a1994[_0x3860('0xbc')]=[{'all':!![]}];}_0x1a1994=_[_0x3860('0xa3')]({},_0x1a1994,_0x6334ca[_0x3860('0xbd')]);return db[_0x3860('0x44')][_0x3860('0x6a')](_0x1a1994)[_0x3860('0x32')](handleEntityNotFound(_0x4a929e,null))[_0x3860('0x32')](respondWithResult(_0x4a929e,null))['catch'](handleError(_0x4a929e,null));};exports[_0x3860('0xbe')]=function(_0x6d1819,_0x9e1682){return db[_0x3860('0x44')][_0x3860('0xbe')](_0x6d1819['body'],{})[_0x3860('0x32')](respondWithResult(_0x9e1682,0xc9))['catch'](handleError(_0x9e1682,null));};exports['update']=function(_0x56af8c,_0x1059a4){if(_0x56af8c[_0x3860('0x7d')]['id']){delete _0x56af8c[_0x3860('0x7d')]['id'];}return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x56af8c[_0x3860('0xbb')]['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x1059a4,null))[_0x3860('0x32')](saveUpdates(_0x56af8c['body'],null))[_0x3860('0x32')](respondWithResult(_0x1059a4,null))[_0x3860('0x41')](handleError(_0x1059a4,null));};exports['destroy']=function(_0x490884,_0x4428eb){return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x490884['params']['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x4428eb,null))['then'](removeEntity(_0x4428eb,null))[_0x3860('0x41')](handleError(_0x4428eb,null));};exports['describe']=function(_0x41fd53,_0xf91fc2){return db['ChatInteraction'][_0x3860('0xbf')]()[_0x3860('0x32')](respondWithResult(_0xf91fc2,null))['catch'](handleError(_0xf91fc2,null));};exports[_0x3860('0xc0')]=function(_0x398bc1,_0x3312c4){var _0x501519=_0x398bc1[_0x3860('0xbb')]['id'];var _0x47fba5;var _0x3e3dac;var _0x18b845;return db['ChatInteraction'][_0x3860('0xc1')]({'where':{'id':_0x501519}})[_0x3860('0x32')](function(_0x2b1dc1){_0x47fba5=_0x2b1dc1;return db[_0x3860('0xc2')][_0x3860('0xc1')]({'where':{'id':_0x2b1dc1['ChatWebsiteId']},'attributes':['id',_0x3860('0xc3'),_0x3860('0xc4'),'vidaooTopic','vidaooNote',_0x3860('0xc5')],'raw':!![]});})['then'](function(_0xe27f6b){if(_0xe27f6b&&_0xe27f6b[_0x3860('0xc3')]&&_0xe27f6b['vidaooEscalation']){_0x3e3dac=_0xe27f6b;var _0x1041bf={'interaction':{'id':_0x501519},'agent':{'id':_0x398bc1['user']['id'],'name':_0x398bc1[_0x3860('0x9c')]['name'],'fullname':_0x398bc1[_0x3860('0x9c')][_0x3860('0x3c')],'email':_0x398bc1[_0x3860('0x9c')][_0x3860('0xc6')]},'contact':_0x398bc1['body'][_0x3860('0x37')],'account':_0x398bc1[_0x3860('0x7d')][_0x3860('0x3a')]};var _0x1e1baf={'rejectUnauthorized':![],'method':'POST','url':_0x3860('0xc7'),'headers':{'X-APIKEY':_0xe27f6b[_0x3860('0xc3')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x398bc1['user'][_0x3860('0xc6')]],'buttons':null,'topic':_0x3e3dac[_0x3860('0xc8')],'note':_[_0x3860('0xc9')](_0x3e3dac[_0x3860('0xca')])?null:getMustacheRender(_0x3e3dac['vidaooNote'],_0x1041bf),'metadata':null},'redirect':_0x3860('0xcb'),'json':!![]};try{if(!_[_0x3860('0xc9')](_0x3e3dac[_0x3860('0xc5')])){var _0x1ce6e6=getMustacheRender(_0x3e3dac['vidaooMetadata'],_0x1041bf);var _0x1df44=JSON['parse'](_0x1ce6e6);_0x1e1baf['body']['metadata']=_0x1df44;}}catch(_0x15b53f){throw new db[(_0x3860('0x96'))][(_0x3860('0xcc'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x1e1baf);}else{throw new db[(_0x3860('0x96'))]['ValidationError'](_0x3860('0xcd'));}})[_0x3860('0x32')](function(_0x21c052){_0x18b845=_0x21c052;if(_0x18b845['id']){var _0x3a920b={'body':_0x18b845['join_url'],'ChatWebsiteId':_0x3e3dac['id'],'ChatInteractionId':_0x47fba5['id'],'direction':_0x3860('0xce'),'UserId':_0x398bc1[_0x3860('0x9c')]['id']};return db[_0x3860('0xcf')]['create'](_0x3a920b,{});}else{throw new db[(_0x3860('0x96'))][(_0x3860('0xcc'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x47fba5['updateAttributes']({'vidaooSessionId':_0x18b845['id']});})['then'](respondWithResult(_0x3312c4,null))[_0x3860('0x41')](handleError(_0x3312c4,null));};exports[_0x3860('0xd0')]=function(_0x2a09a2,_0x266347){if(_0x2a09a2[_0x3860('0x7d')]['id']){delete _0x2a09a2[_0x3860('0x7d')]['id'];}return db[_0x3860('0x44')]['find']({'where':{'id':_0x2a09a2['params']['id']},'include':[{'model':db['CmContact'],'as':_0x3860('0x6f')}]})[_0x3860('0x32')](handleEntityNotFound(_0x266347,null))[_0x3860('0x32')](saveUpdates(_0x2a09a2['body'],null))[_0x3860('0x32')](respondWithResult(_0x266347,null))['catch'](handleError(_0x266347,null));};exports['abandon']=function(_0x5f0700,_0x46f630,_0x505ba2){if(_0x5f0700['body']['id']){delete _0x5f0700[_0x3860('0x7d')]['id'];}return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x5f0700[_0x3860('0xbb')]['id']}})['then'](function(_0x53392b){if(!_0x53392b){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x3860('0xd1'),0x194,'entity\x20not\x20found');_0x46f630['sendStatus'](0x194);}else{if(_0x53392b[_0x3860('0x7b')]){throw new db[(_0x3860('0x96'))][(_0x3860('0xcc'))](_0x3860('0xd2'));}}return _0x53392b;})['then'](function(_0x6e541d){if(_0x6e541d){return _0x6e541d[_0x3860('0x31')]({'closed':_0x5f0700[_0x3860('0x7d')][_0x3860('0xd3')],'disposition':_0x5f0700['body']['disposition']})[_0x3860('0x32')](function(_0x55c19c){return _0x55c19c;});}})[_0x3860('0x32')](function(_0x4ab85d){return respondWithRpcPromise(_0x3860('0xd4'),_0x3860('0xd1'),_0x5f0700[_0x3860('0x7d')],client9004);})[_0x3860('0x32')](respondWithResult(_0x46f630,null))[_0x3860('0x41')](handleError(_0x46f630,null));};exports['attachmentUpload']=function(_0x5d3c4d,_0x5e3c54,_0x39e855){_0x5d3c4d[_0x3860('0x7d')][_0x3860('0x34')]=_0x5d3c4d[_0x3860('0xd5')][_0x3860('0xd6')];_0x5d3c4d['body'][_0x3860('0xd7')]=_0x5d3c4d[_0x3860('0xd5')]['filename'];_0x5d3c4d[_0x3860('0x7d')]['type']=_0x5d3c4d[_0x3860('0xd5')][_0x3860('0xd8')];return db['Attachment'][_0x3860('0xbe')](_0x5d3c4d[_0x3860('0x7d')])[_0x3860('0x32')](respondWithResult(_0x5e3c54,0xc9))[_0x3860('0x41')](handleError(_0x5e3c54,null));};exports[_0x3860('0xd9')]=function(_0x3e2dfc,_0x135e84,_0x199bbc){return db[_0x3860('0x44')][_0x3860('0xc1')]({'where':{'id':_0x3e2dfc[_0x3860('0xbb')]['id']},'raw':!![]})[_0x3860('0x32')](handleEntityNotFound(_0x135e84,null))['then'](function(_0x369a4b){if(_0x369a4b){if(_0x369a4b['closed']){return _0x135e84[_0x3860('0x28')](0x193)['json']({'status':0x193,'message':_0x3860('0xda')});}return db['Attachment'][_0x3860('0xc1')]({'where':{'id':_0x3e2dfc['query']['attachId']},'raw':!![]})[_0x3860('0x32')](handleEntityNotFound(_0x135e84,null));}})[_0x3860('0x32')](function(_0xa152b4){if(_0xa152b4){var _0x28931d=_0xa152b4[_0x3860('0xdb')]!==null;var _0x5e65a2=path[_0x3860('0xdc')](config[_0x3860('0xdd')],_0x3860('0xde'));if(_0x28931d){_0x5e65a2=path[_0x3860('0xdc')](_0x5e65a2,_0x3860('0xdf'));}var _0x268658=path['join'](_0x5e65a2,_0xa152b4[_0x3860('0xd7')]);return _0x135e84['download'](_0x268658);}})[_0x3860('0x41')](handleError(_0x135e84,null));};exports[_0x3860('0xe0')]=function(_0x118c4e,_0x471da9){var _0x244ceb=null;var _0x24f8a6=null;var _0x532349=null;var _0x17fa12=null;if(_0x118c4e[_0x3860('0x7d')]['id']){delete _0x118c4e[_0x3860('0x7d')]['id'];}if(_0x118c4e[_0x3860('0x7d')]['mailTranscript']){_0x17fa12=path[_0x3860('0xdc')](config[_0x3860('0xdd')],_0x3860('0xe1'),util[_0x3860('0xe2')](_0x3860('0xe3'),Date[_0x3860('0xe4')]()));_0x118c4e['body'][_0x3860('0xe5')]=_0x17fa12;}return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x118c4e[_0x3860('0xbb')]['id']},'include':[{'model':db[_0x3860('0xcf')],'as':_0x3860('0xe6'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x471da9,null))[_0x3860('0x32')](saveUpdates(_0x118c4e[_0x3860('0x7d')],null))['then'](function(_0x276828){if(_0x276828){_0x244ceb=_0x276828;return db[_0x3860('0xc2')][_0x3860('0x6a')]({'where':{'id':_0x244ceb[_0x3860('0x81')]}});}})[_0x3860('0x32')](function(_0x1740d0){if(_0x1740d0){_0x532349=_0x1740d0;return db[_0x3860('0xe7')][_0x3860('0x6a')]({'where':{'id':_0x244ceb[_0x3860('0x74')]}});}})[_0x3860('0x32')](function(_0x975c7f){if(_0x975c7f){_0x24f8a6=_0x975c7f;if(_0x17fa12){var _0x23207b=null;for(var _0x1a1366=0x1;_0x1a1366<_0x244ceb[_0x3860('0xe6')][_0x3860('0x4f')];++_0x1a1366){_0x23207b=_0x244ceb['Messages'][_0x1a1366];var _0x56566c=_0x23207b[_0x3860('0x7b')]?util[_0x3860('0xe2')](_0x3860('0xe8'),_0x532349[_0x3860('0xe9')],_0x23207b[_0x3860('0x7b')]):_0x3860('0xea');var _0x1290e7=_0x118c4e[_0x3860('0x7d')]['customer']||util[_0x3860('0xe2')](_0x3860('0xe8'),_0x3860('0xeb'),_0x23207b['ContactId']);switch(_0x532349[_0x3860('0xec')]){case _0x3860('0xed'):_0x56566c=_0x23207b[_0x3860('0x7b')]?util[_0x3860('0xe2')](_0x3860('0xe8'),_0x532349[_0x3860('0xe9')],_0x23207b[_0x3860('0x7b')]):_0x3860('0xea');break;case _0x3860('0xee'):_0x56566c=_0x23207b['UserId']?_0x23207b[_0x3860('0x79')][_0x3860('0xef')]||_0x23207b['User'][_0x3860('0x3c')]:_0x3860('0xea');break;case _0x3860('0xf0'):_0x56566c=_0x23207b['UserId']?_0x23207b[_0x3860('0x79')][_0x3860('0x3c')]:_0x3860('0xea');break;default:_0x56566c=_0x23207b[_0x3860('0x7b')]?util['format']('%s%d',_0x532349[_0x3860('0xe9')],_0x23207b['UserId']):_0x3860('0xea');}var _0x15314d=util[_0x3860('0xe2')](_0x3860('0xf1'),moment(_0x23207b[_0x3860('0x84')])[_0x3860('0xe2')](_0x3860('0xf2')),_0x23207b[_0x3860('0xf3')]==='in'?_0x1290e7:_0x56566c,_0x23207b['body']);if(!_0x23207b[_0x3860('0xf4')]){fs[_0x3860('0xf5')](_0x17fa12,_0x15314d);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x3860('0xf6')],'as':'Smtp','raw':!![]}]});}}})[_0x3860('0x32')](function(_0x2bf644){if(_0x2bf644&&_0x2bf644[_0x3860('0xf7')]&&_0x118c4e[_0x3860('0x7d')]){var _0xd95981={'tls':{'rejectUnauthorized':![]}};if(_0x2bf644[_0x3860('0xf7')][_0x3860('0xf8')]){_0xd95981[_0x3860('0xf8')]=_0x2bf644['Smtp']['service'];}else{_0xd95981[_0x3860('0xf9')]=_0x2bf644['Smtp'][_0x3860('0xf9')];_0xd95981[_0x3860('0xfa')]=_0x2bf644[_0x3860('0xf7')][_0x3860('0xfa')];_0xd95981[_0x3860('0xfb')]=_0x2bf644[_0x3860('0xf7')][_0x3860('0xfb')];}if(_0x2bf644['Smtp']['authentication']){_0xd95981[_0x3860('0xfc')]={'user':_0x2bf644[_0x3860('0xf7')][_0x3860('0x9c')],'pass':_0x2bf644['Smtp'][_0x3860('0xfd')]};}return respondWithRpcPromise(_0x3860('0xfe'),_0x3860('0xff'),{'account':_0xd95981,'message':{'from':util['format'](_0x3860('0x100'),_0x2bf644[_0x3860('0x34')],_0x2bf644['email']||_0x2bf644['Smtp']['user']),'to':_0x118c4e['body']['mailTranscript'],'subject':_0x3860('0x101'),'text':util[_0x3860('0xe2')](_0x3860('0x102'),_0x118c4e[_0x3860('0x7d')][_0x3860('0x103')]),'attachments':[{'path':_0x17fa12}]}})['then'](function(){return _0x244ceb;})[_0x3860('0x41')](function(_0x5235e){console['error'](_0x5235e);});}else{return _0x244ceb;}})[_0x3860('0x32')](respondWithStatusCode(_0x471da9,0xc8))[_0x3860('0x41')](handleError(_0x471da9,null));};exports[_0x3860('0x104')]=function(_0x38cdf1,_0x4ab7b2,_0x4c8a10){return db['ChatMessage'][_0x3860('0x6a')]({'where':{'id':_0x38cdf1['params']['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x4ab7b2,null))[_0x3860('0x32')](function(_0x2adf67){if(_0x2adf67){return _0x2adf67[_0x3860('0x104')](_0x38cdf1[_0x3860('0x7d')][_0x3860('0x105')],_[_0x3860('0x106')](_0x38cdf1[_0x3860('0x7d')],[_0x3860('0x105'),'id'])||{});}})[_0x3860('0x32')](respondWithResult(_0x4ab7b2,null))[_0x3860('0x41')](handleError(_0x4ab7b2,null));};exports[_0x3860('0x107')]=function(_0x173790,_0x20d0d2,_0x8d3ad7){var _0xf1e9ab={'raw':![],'where':{}};var _0xcf350b={};var _0x1348e0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3860('0xc1')]({'where':{'id':_0x173790['params']['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x20d0d2,null))[_0x3860('0x32')](function(_0x11d0ab){if(_0x11d0ab){_0xcf350b[_0x3860('0x49')]=_[_0x3860('0x7e')](db[_0x3860('0xcf')][_0x3860('0x45')]);_0xcf350b[_0x3860('0x4a')]=_[_0x3860('0x7e')](_0x173790['query']);_0xcf350b[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0xcf350b[_0x3860('0x49')],_0xcf350b[_0x3860('0x4a')]);_0xf1e9ab[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0xcf350b[_0x3860('0x49')],qs['fields'](_0x173790[_0x3860('0x4a')][_0x3860('0x4e')]));_0xf1e9ab[_0x3860('0x4d')]=_0xf1e9ab['attributes'][_0x3860('0x4f')]?_0xf1e9ab[_0x3860('0x4d')]:_0xcf350b[_0x3860('0x49')];if(!_0x173790['query']['hasOwnProperty'](_0x3860('0x108'))){_0xf1e9ab[_0x3860('0x2c')]=qs['limit'](_0x173790[_0x3860('0x4a')]['limit']);_0xf1e9ab[_0x3860('0x2a')]=qs[_0x3860('0x2a')](_0x173790['query'][_0x3860('0x2a')]);}_0xf1e9ab['order']=qs[_0x3860('0x51')](_0x173790[_0x3860('0x4a')][_0x3860('0x51')]);_0xf1e9ab[_0x3860('0x52')]=qs[_0x3860('0x4b')](_[_0x3860('0x109')](_0x173790[_0x3860('0x4a')],_0xcf350b['filters']));_0xf1e9ab[_0x3860('0x52')]['ChatInteractionId']=_0x11d0ab['id'];if(_0x173790[_0x3860('0x4a')][_0x3860('0x8f')]){_0xf1e9ab['where']=_['merge'](_0xf1e9ab[_0x3860('0x52')],{'$or':_[_0x3860('0x43')](_0xf1e9ab[_0x3860('0x4d')],function(_0x234f93){var _0x5ed001={};_0x5ed001[_0x234f93]={'$like':'%'+_0x173790[_0x3860('0x4a')][_0x3860('0x8f')]+'%'};return _0x5ed001;})});}if(_0x173790[_0x3860('0x4a')]['$gte']){var _0x1ac962=_0x173790[_0x3860('0x4a')]['$gte'][_0x3860('0x3f')](',');var _0x35dbfe={};_0x35dbfe[_0x1ac962[0x0]]={'$gte':moment(_0x1ac962[0x1])[_0x3860('0xe2')](_0x3860('0x10a'))};_0xf1e9ab[_0x3860('0x52')]=_[_0x3860('0xa3')](_0xf1e9ab[_0x3860('0x52')],_0x35dbfe);}_0xf1e9ab=_['merge']({},_0xf1e9ab,_0x173790[_0x3860('0xbd')]);return db[_0x3860('0xcf')][_0x3860('0x2d')]({'where':_0xf1e9ab[_0x3860('0x52')]})[_0x3860('0x32')](function(_0x54ebd7){_0x1348e0[_0x3860('0x2d')]=_0x54ebd7;if(_0x173790[_0x3860('0x4a')][_0x3860('0x10b')]){_0xf1e9ab[_0x3860('0xbc')]=[{'all':!![]}];}return db[_0x3860('0xcf')][_0x3860('0x10c')](_0xf1e9ab);})['then'](function(_0x16457e){_0x1348e0[_0x3860('0x10d')]=_0x16457e;return _0x1348e0;});}})[_0x3860('0x32')](respondWithFilteredResult(_0x20d0d2,_0xf1e9ab))[_0x3860('0x41')](handleError(_0x20d0d2,null));};exports[_0x3860('0x10e')]=function(_0x2b6605,_0x11409b,_0x187e3b){var _0x4fb4f3={'where':{}},_0x21b179={},_0x28b7a2={'count':0x0,'rows':[]};return db[_0x3860('0x44')][_0x3860('0xc1')]({'where':{'id':_0x2b6605[_0x3860('0xbb')]['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x11409b,null))[_0x3860('0x32')](function(_0x2ca2e7){if(_0x2ca2e7){_0x21b179[_0x3860('0x49')]=_['keys'](db[_0x3860('0xcf')][_0x3860('0x45')]);_0x21b179[_0x3860('0x4a')]=_[_0x3860('0x7e')](_0x2b6605[_0x3860('0x4a')]);_0x21b179[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0x21b179[_0x3860('0x49')],_0x21b179[_0x3860('0x4a')]);_0x4fb4f3[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0x21b179[_0x3860('0x49')],qs[_0x3860('0x4e')](_0x2b6605[_0x3860('0x4a')][_0x3860('0x4e')]));_0x4fb4f3['attributes']=_0x4fb4f3[_0x3860('0x4d')][_0x3860('0x4f')]?_0x4fb4f3[_0x3860('0x4d')]:_0x21b179[_0x3860('0x49')];if(!_0x2b6605[_0x3860('0x4a')][_0x3860('0x10f')](_0x3860('0x108'))){_0x4fb4f3[_0x3860('0x2c')]=qs[_0x3860('0x2c')](_0x2b6605[_0x3860('0x4a')][_0x3860('0x2c')]);_0x4fb4f3[_0x3860('0x2a')]=qs['offset'](_0x2b6605[_0x3860('0x4a')]['offset']);}_0x4fb4f3[_0x3860('0x50')]=qs['sort'](_0x2b6605[_0x3860('0x4a')]['sort']);_0x4fb4f3[_0x3860('0x52')]=qs[_0x3860('0x4b')](_['pick'](_0x2b6605[_0x3860('0x4a')],_0x21b179[_0x3860('0x4b')]));_0x4fb4f3[_0x3860('0x52')][_0x3860('0xb8')]=_0x2ca2e7['id'];if(_0x2b6605[_0x3860('0x4a')]['filter']){_0x4fb4f3['where']=_[_0x3860('0xa3')](_0x4fb4f3[_0x3860('0x52')],{'$or':_[_0x3860('0x43')](_0x4fb4f3[_0x3860('0x4d')],function(_0x31a537){var _0x438121={};_0x438121[_0x31a537]={'$like':'%'+_0x2b6605[_0x3860('0x4a')]['filter']+'%'};return _0x438121;})});}_0x4fb4f3[_0x3860('0x52')]['secret']=![];if(_0x2b6605[_0x3860('0x4a')]['id']){_0x4fb4f3[_0x3860('0x52')]['id']={'$gt':_0x2b6605[_0x3860('0x4a')]['id']};}_0x4fb4f3=_[_0x3860('0xa3')]({},_0x4fb4f3,_0x2b6605['options']);return db[_0x3860('0xcf')][_0x3860('0x2d')]({'where':_0x4fb4f3['where']})[_0x3860('0x32')](function(_0x4d4366){_0x28b7a2[_0x3860('0x2d')]=_0x4d4366;_0x4fb4f3[_0x3860('0xbc')]=[];if(_0x2b6605[_0x3860('0x4a')][_0x3860('0x110')]){_0x4fb4f3[_0x3860('0xbc')][_0x3860('0x40')]({'model':db[_0x3860('0x79')],'as':_0x3860('0x79'),'attributes':['id',_0x3860('0x3c'),'alias']});}if(_0x2b6605[_0x3860('0x4a')][_0x3860('0x10b')]){_0x4fb4f3[_0x3860('0xbc')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4fb4f3);})['then'](function(_0x39c52e){_0x28b7a2[_0x3860('0x10d')]=_0x39c52e;return _0x28b7a2;});}})[_0x3860('0x32')](respondWithFilteredResult(_0x11409b,_0x4fb4f3))[_0x3860('0x41')](handleError(_0x11409b,null));};exports[_0x3860('0x111')]=function(_0x185040,_0x14cef9,_0x5e1ed4){return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x185040[_0x3860('0xbb')]['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x14cef9,null))['then'](function(_0xbc013a){if(_0xbc013a){return _0xbc013a[_0x3860('0x112')](_0x185040['body'][_0x3860('0x105')],_[_0x3860('0x106')](_0x185040[_0x3860('0x7d')],[_0x3860('0x105'),'id'])||{})[_0x3860('0x113')](function(){return db[_0x3860('0x77')][_0x3860('0x10c')]({'attributes':['id',_0x3860('0x34'),_0x3860('0x54')],'where':{'id':_0x185040[_0x3860('0x7d')][_0x3860('0x105')]}});})[_0x3860('0x32')](function(_0x57f603){socket['emit'](_0x3860('0x114'),{'id':Number(_0x185040['params']['id']),'tags':_0x57f603||[]});return{'id':Number(_0x185040['params']['id']),'tags':_0x57f603||[]};});}})[_0x3860('0x32')](respondWithResult(_0x14cef9,null))[_0x3860('0x41')](handleError(_0x14cef9,null));};exports[_0x3860('0x115')]=function(_0x2e2ff3,_0x27c591,_0x8b9a7a){return db['ChatInteraction'][_0x3860('0x6a')]({'where':{'id':_0x2e2ff3[_0x3860('0xbb')]['id']}})['then'](handleEntityNotFound(_0x27c591,null))[_0x3860('0x32')](function(_0x5ecd57){if(_0x5ecd57){return _0x5ecd57['removeTags'](_0x2e2ff3['query'][_0x3860('0x105')]);}})[_0x3860('0x32')](respondWithStatusCode(_0x27c591,null))[_0x3860('0x41')](handleError(_0x27c591,null));};exports[_0x3860('0x116')]=function(_0x39524a,_0xa0492b){var _0x4d44de=moment()[_0x3860('0x117')]()[_0x3860('0xa1')]();var _0x1dcd01=path['join'](config[_0x3860('0xdd')],_0x3860('0x118'),_0x3860('0x119'),'tmp');var _0x198422=path['join'](config[_0x3860('0xdd')],'server',_0x3860('0x119'),_0x3860('0x11a'));var _0x1a97c1=path[_0x3860('0xdc')](_0x1dcd01,_0x4d44de);var _0x4cc748=util[_0x3860('0xe2')]('transcript-%d-%s.zip',_0x39524a[_0x3860('0xbb')]['id'],_0x4d44de);var _0x18fd61=path['join'](_0x1dcd01,_0x4cc748);var _0x39eb63=[];_0x39eb63[_0x3860('0x40')]({'model':db['User'],'as':_0x3860('0x79'),'attributes':['id',_0x3860('0x3c')],'raw':!![]});_0x39eb63[_0x3860('0x40')]({'model':db[_0x3860('0xe7')],'as':_0x3860('0x6f'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x39524a[_0x3860('0x4a')]['attachments']){_0x39eb63[_0x3860('0x40')]({'model':db[_0x3860('0x11b')],'as':'Attachment','raw':!![]});}var _0x134dfd=[{'model':db[_0x3860('0xcf')],'as':_0x3860('0xe6'),'attributes':['id','body',_0x3860('0x84'),'direction','secret','read'],'include':_0x39eb63}];_0x134dfd['push']({'model':db['ChatWebsite'],'as':_0x3860('0x11c'),'attributes':['id',_0x3860('0x34')]});_0x134dfd['push']({'model':db[_0x3860('0x79')],'as':_0x3860('0x11d'),'attributes':['id',_0x3860('0x3c')]});return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x39524a[_0x3860('0xbb')]['id']},'include':_0x134dfd})[_0x3860('0x32')](handleEntityNotFound(_0xa0492b,null))['then'](function(_0x2fe51b){if(_0x2fe51b){var _0x51bf5a=_0x2fe51b['get']({'plain':!![]});fs[_0x3860('0x11e')](_0x1a97c1);var _0x33abf1={'channel':_0x3860('0x11f'),'account':_0x51bf5a[_0x3860('0x11c')][_0x3860('0x34')],'agent':_0x51bf5a['Owner']?_0x51bf5a[_0x3860('0x11d')]['fullname']:_0x3860('0x120'),'createdAt':moment(_0x51bf5a['createdAt'])[_0x3860('0xe2')](_0x3860('0x10a'))[_0x3860('0xa1')](),'closedAt':_0x51bf5a[_0x3860('0xd3')]?moment(_0x51bf5a[_0x3860('0x121')])[_0x3860('0xe2')](_0x3860('0x10a'))[_0x3860('0xa1')]():'','disposition':_0x51bf5a[_0x3860('0x122')],'chatInfo':{'browser':_0x51bf5a['browserName'],'os':_0x51bf5a[_0x3860('0x123')],'referer':_0x51bf5a[_0x3860('0x124')],'customerIp':_0x51bf5a[_0x3860('0x125')],'customerPort':_0x51bf5a[_0x3860('0x126')]?_0x51bf5a[_0x3860('0x126')]:'N.A.'},'messages':_(_0x51bf5a[_0x3860('0xe6')])[_0x3860('0x127')]()['filter']({'secret':![]})['map'](function(_0x5b23d2){if(_0x5b23d2[_0x3860('0x11b')]){var _0x409781=path[_0x3860('0xdc')](_0x198422,_0x5b23d2[_0x3860('0x11b')][_0x3860('0xd7')]);if(fs[_0x3860('0x128')](_0x409781)){fs[_0x3860('0x129')](_0x409781)[_0x3860('0x12a')](fs[_0x3860('0x12b')](path[_0x3860('0xdc')](_0x1a97c1,_0x5b23d2[_0x3860('0x11b')][_0x3860('0xd7')])));}}return{'date':moment(_0x5b23d2[_0x3860('0x84')])[_0x3860('0xe2')](_0x3860('0x10a'))[_0x3860('0xa1')](),'sender':_0x5b23d2[_0x3860('0xf3')]===_0x3860('0xce')?_0x5b23d2[_0x3860('0x79')]?_0x5b23d2['User'][_0x3860('0x3c')]:_0x3860('0xea'):_0x5b23d2[_0x3860('0x6f')]['firstName']+(_0x5b23d2[_0x3860('0x6f')][_0x3860('0x12c')]?'\x20'+_0x5b23d2['Contact'][_0x3860('0x12c')]:''),'body':_0x5b23d2['Attachment']?_0x5b23d2['Attachment'][_0x3860('0xd7')]:_0x5b23d2[_0x3860('0x7d')],'direction':_0x5b23d2[_0x3860('0xf3')]===_0x3860('0xce')?'A':'C','secret':_0x5b23d2[_0x3860('0xf4')],'read':_0x5b23d2[_0x3860('0x8a')],'attachment':_0x5b23d2['Attachment']};})[_0x3860('0x6c')]()};return ejs[_0x3860('0x12d')](path[_0x3860('0xdc')](config['root'],_0x3860('0x118'),_0x3860('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x33abf1})[_0x3860('0x32')](function(_0x5c5755){var _0x5dfb3b=path[_0x3860('0xdc')](_0x1a97c1,_0x3860('0x12f')+_0x51bf5a['id']+'-'+_0x4d44de+_0x3860('0x130'));var _0x1eba76={'path':_0x5dfb3b,'channel':'Chat','interactionId':_0x51bf5a['id']};return pdf[_0x3860('0x131')](_0x5c5755,_0x1eba76);})['then'](function(){return new BPromise(function(_0x34ad82,_0x44ac65){zipdir(_0x1a97c1,{'saveTo':_0x18fd61},function(_0x43cc98,_0xd9ff70){if(_0x43cc98)return _0x44ac65(_0x43cc98);return _0x34ad82(_0xd9ff70);});})['then'](function(){return new BPromise(function(_0x52e611,_0x4ccefa){rimraf(_0x1a97c1,function(_0x2c90b){if(_0x2c90b)_0x4ccefa(_0x2c90b);return _0x52e611();});});})[_0x3860('0x32')](function(){return _0xa0492b[_0x3860('0x116')](_0x18fd61,_0x4cc748,function(_0x3046f4){if(_0x3046f4){console[_0x3860('0x132')](_0x3860('0x133'),_0x3046f4);}else{fs[_0x3860('0x134')](_0x18fd61);}});});});}else{return _0xa0492b['sendStatus'](0xc8);}})[_0x3860('0x41')](handleError(_0xa0492b,null));}; \ No newline at end of file +var _0xea28=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','sendStatus','stack','name','merge','contact','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','params','includeAll','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailServerOut','Smtp','service','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','include','findAll','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','emit','removeTags','files','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','read','Account','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','log','unlinkSync','eml-format','rimraf','zip-dir'];(function(_0x2eb318,_0xa45186){var _0x3ff206=function(_0x5861e6){while(--_0x5861e6){_0x2eb318['push'](_0x2eb318['shift']());}};_0x3ff206(++_0xa45186);}(_0xea28,0x13a));var _0x8ea2=function(_0x1991a2,_0xd4a778){_0x1991a2=_0x1991a2-0x0;var _0x307dde=_0xea28[_0x1991a2];return _0x307dde;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x8ea2('0x16'));var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require('../../config/utils');var config=require(_0x8ea2('0x19'));var licenseUtil=require(_0x8ea2('0x1a'));var db=require(_0x8ea2('0x1b'))['db'];config[_0x8ea2('0x1c')]=_[_0x8ea2('0x1d')](config['redis'],{'host':_0x8ea2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ea2('0x1f'))[_0x8ea2('0x20')](socket);var jayson=require(_0x8ea2('0x21'));var client=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232b});var client9004=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x11f5e8,_0x474873,_0x396aab,_0x2dfa7c){return new BPromise(function(_0x1c1715,_0x3bc774){var _0xaa8abf=_0x2dfa7c||client;return _0xaa8abf[_0x8ea2('0x24')](_0x11f5e8,_0x396aab)[_0x8ea2('0x25')](function(_0x467045){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x474873,_0x8ea2('0x28'));logger[_0x8ea2('0x29')](_0x8ea2('0x2a'),_0x474873,'request\x20sent',JSON['stringify'](_0x467045));if(_0x467045[_0x8ea2('0x2b')]){if(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2c')]===0x1f4){logger['error'](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')]['message']);return _0x3bc774(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}logger[_0x8ea2('0x2b')](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);return _0x1c1715(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}else{logger[_0x8ea2('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x8ea2('0x28'));_0x1c1715(_0x467045['result'][_0x8ea2('0x2d')]);}})[_0x8ea2('0x2e')](function(_0x29b38f){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x29b38f);_0x3bc774(_0x29b38f);});});}function respondWithStatusCode(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0xcc;return function(_0x200a49){if(_0x200a49){return _0x2e4da3['sendStatus'](_0x4dc7bf);}return _0x2e4da3[_0x8ea2('0x2f')](_0x4dc7bf)[_0x8ea2('0x30')]();};}function respondWithResult(_0x21c526,_0x266db8){_0x266db8=_0x266db8||0xc8;return function(_0x4e1b90){if(_0x4e1b90){return _0x21c526['status'](_0x266db8)[_0x8ea2('0x31')](_0x4e1b90);}};}function respondWithFilteredResult(_0x4da5b3,_0x4a9875){return function(_0x287078){if(_0x287078){var _0x24f187=typeof _0x4a9875[_0x8ea2('0x32')]===_0x8ea2('0x33')&&typeof _0x4a9875[_0x8ea2('0x34')]===_0x8ea2('0x33');var _0x316707=_0x287078[_0x8ea2('0x35')];var _0x9c5fac=_0x24f187?0x0:_0x4a9875['offset'];var _0x5b7ff9=_0x24f187?_0x287078[_0x8ea2('0x35')]:_0x4a9875[_0x8ea2('0x32')]+_0x4a9875['limit'];var _0x4a110f;if(_0x5b7ff9>=_0x316707){_0x5b7ff9=_0x316707;_0x4a110f=0xc8;}else{_0x4a110f=0xce;}_0x4da5b3[_0x8ea2('0x2f')](_0x4a110f);return _0x4da5b3['set'](_0x8ea2('0x36'),_0x9c5fac+'-'+_0x5b7ff9+'/'+_0x316707)[_0x8ea2('0x31')](_0x287078);}return null;};}function patchUpdates(_0x53fd06){return function(_0x17b21c){try{jsonpatch[_0x8ea2('0x37')](_0x17b21c,_0x53fd06,!![]);}catch(_0x33abc8){return BPromise['reject'](_0x33abc8);}return _0x17b21c['save']();};}function saveUpdates(_0x49a252,_0x3880c3){return function(_0x233e12){if(_0x233e12){return _0x233e12[_0x8ea2('0x38')](_0x49a252)['then'](function(_0x456487){return _0x456487;});}return null;};}function removeEntity(_0x391b08,_0x3d5bf0){return function(_0x278e5d){if(_0x278e5d){return _0x278e5d[_0x8ea2('0x39')]()[_0x8ea2('0x25')](function(){_0x391b08[_0x8ea2('0x2f')](0xcc)[_0x8ea2('0x30')]();});}};}function handleEntityNotFound(_0x5e9b1f,_0x955ef3){return function(_0x29e3f5){if(!_0x29e3f5){_0x5e9b1f[_0x8ea2('0x3a')](0x194);}return _0x29e3f5;};}function handleError(_0x467d97,_0x4eebc1){_0x4eebc1=_0x4eebc1||0x1f4;return function(_0x2a1f14){logger['error'](_0x2a1f14[_0x8ea2('0x3b')]);if(_0x2a1f14[_0x8ea2('0x3c')]){delete _0x2a1f14[_0x8ea2('0x3c')];}_0x467d97[_0x8ea2('0x2f')](_0x4eebc1)['send'](_0x2a1f14);};}function getMustacheRender(_0x2bed24,_0x531979){return Mustache['render'](_0x2bed24,_[_0x8ea2('0x3d')](_0x531979['body'],{'contact':_0x531979[_0x8ea2('0x3e')],'message':_0x531979[_0x8ea2('0x2d')],'agent':_0x531979[_0x8ea2('0x3f')],'interaction':_0x531979[_0x8ea2('0x40')],'account':_0x531979[_0x8ea2('0x41')]}))||'';}function getInteractionUsers(_0x4ae536,_0x84685d){return new BPromise(function(_0x5c5d2d,_0x12a6c2){try{if(_0x84685d[_0x4ae536['id']]){_0x4ae536[_0x8ea2('0x42')]=_[_0x8ea2('0x43')](_0x84685d[_0x4ae536['id']],function(_0x3995ff){return{'id':_0x3995ff['id'],'fullname':_0x3995ff['fullname']};});}}catch(_0x44e8bc){_0x12a6c2(_0x44e8bc);}_0x5c5d2d(_0x4ae536);});}function getInteractionTags(_0x57a6b8,_0x3f0c78){return new BPromise(function(_0x5ba351,_0x2ee78b){try{if(_0x57a6b8[_0x8ea2('0x44')]){_0x57a6b8[_0x8ea2('0x45')]=[];_0x57a6b8[_0x8ea2('0x44')][_0x8ea2('0x46')](',')[_0x8ea2('0x47')](function(_0x2f4fa8){_0x57a6b8['Tags']['push'](_0x3f0c78[_0x2f4fa8]);});}delete _0x57a6b8[_0x8ea2('0x44')];}catch(_0x53455a){_0x2ee78b(_0x53455a);}_0x5ba351(_0x57a6b8);});}function updateChatInteraction(_0x4b03fa,_0x59e2fa,_0x3cbc09){return new BPromise(function(_0x5d9ba0,_0x40a532){return getInteractionUsers(_0x4b03fa,_0x3cbc09)[_0x8ea2('0x25')](function(_0x39c944){return getInteractionTags(_0x39c944,_0x59e2fa);})[_0x8ea2('0x25')](function(_0x989d9b){_0x5d9ba0(_0x989d9b);})[_0x8ea2('0x2e')](function(_0x3b2219){_0x40a532(_0x3b2219);});});}exports[_0x8ea2('0x48')]=function(_0x5352b9,_0x3afb80){var _0x1ef615={},_0x1db25c={},_0x5cb6ad={'count':0x0,'rows':[]};var _0x2d6bbb=_[_0x8ea2('0x43')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')],function(_0x20992d){return{'name':_0x20992d['fieldName'],'type':_0x20992d[_0x8ea2('0x4b')][_0x8ea2('0x4c')]};});_0x1db25c[_0x8ea2('0x4d')]=_['map'](_0x2d6bbb,_0x8ea2('0x3c'));_0x1db25c[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x5352b9[_0x8ea2('0x4e')]);_0x1db25c[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],_0x1db25c[_0x8ea2('0x4e')]);_0x1ef615[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x1ef615['attributes']=_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x1ef615[_0x8ea2('0x52')]:_0x1db25c[_0x8ea2('0x4d')];if(!_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x55')](_0x8ea2('0x56'))){_0x1ef615[_0x8ea2('0x34')]=qs['limit'](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x34')]);_0x1ef615[_0x8ea2('0x32')]=qs['offset'](_0x5352b9['query'][_0x8ea2('0x32')]);}_0x1ef615[_0x8ea2('0x57')]=qs[_0x8ea2('0x58')](_0x5352b9['query'][_0x8ea2('0x58')]);_0x1ef615[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x5352b9[_0x8ea2('0x4e')],_0x1db25c['filters']),_0x2d6bbb);var _0x4afd85=[];var _0x24a22a=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x5c')]('id')['field'](_0x8ea2('0x3c'))[_0x8ea2('0x5c')](_0x8ea2('0x5d'))['from']('tools_tags');var _0x48aebf=squel['select']()['field'](_0x8ea2('0x5e'))[_0x8ea2('0x5c')]('u.fullname')['field'](_0x8ea2('0x5f'))[_0x8ea2('0x60')](_0x8ea2('0x61'),'ui')['left_join'](_0x8ea2('0x62'),'u',_0x8ea2('0x63'));var _0x59e3df=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x60')](_0x8ea2('0x64'),'i')[_0x8ea2('0x65')](_0x8ea2('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x8ea2('0x67'))[_0x8ea2('0x65')](_0x8ea2('0x68'),'a',_0x8ea2('0x69'))[_0x8ea2('0x65')](_0x8ea2('0x6a'),'me',_0x8ea2('0x6b'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x8ea2('0x65')](_0x8ea2('0x6c'),'t',_0x8ea2('0x6d'));var _0x2bbec0=squel['expr']();var _0x11824e=[];var _0x2b8662=squel['expr']();var _0x21485a;if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x6e')]){_0x21485a=as[_0x8ea2('0x6f')](_0x5352b9[_0x8ea2('0x4e')]['search']);var _0x479c05=_0x21485a['sqlOperator'];for(var _0x53a62c=0x0;_0x53a62c<_0x21485a[_0x8ea2('0x70')][_0x8ea2('0x54')];_0x53a62c++){var _0x2d8221=_0x21485a[_0x8ea2('0x70')][_0x53a62c];var _0x491d3d='i';var _0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x2d8221[_0x8ea2('0x5c')]]);if(!_0x461d32){switch(_0x2d8221['field']){case _0x8ea2('0x72'):if(_0x2d8221['value']==0x1){_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+_0x8ea2('0x74'));}else{_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+'`\x20>\x200');}break;case _0x8ea2('0x75'):if(_0x2d8221['operator']===_0x8ea2('0x76')){if(_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')]('\x20')[_0x8ea2('0x54')]>0x1){_0x2bbec0[_0x479c05]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ea2('0x78')](_0x2d8221[_0x8ea2('0x77')]),null);}else{var _0x39776d='%'+_0x2d8221[_0x8ea2('0x77')]+'%';_0x2bbec0[_0x479c05](_0x8ea2('0x79'),_0x39776d,_0x39776d,_0x39776d);}}else{_0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x8ea2('0x7a')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x7a');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db['text'],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);}break;case _0x8ea2('0x7d'):var _0x219f78=_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')](',')[_0x8ea2('0x43')](function(_0xefb7b){return Number(_0xefb7b);});_0x219f78[_0x8ea2('0x47')](function(_0x35cfc5){_0x2b8662['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35cfc5+',%');});_0x11824e=_[_0x8ea2('0x7e')](_0x11824e,_0x219f78);break;case _0x8ea2('0x7f'):if(_0x2d8221[_0x8ea2('0x80')]===_0x8ea2('0x76')){_0x2bbec0[_0x479c05](_0x8ea2('0x81'),'%'+_0x2d8221['value']+'%',null);}else{_0x461d32=_['find'](_0x2d6bbb,['name',_0x8ea2('0x82')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x82');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db['value'][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')]['end']);}break;case'body':_0x3d55db=as[_0x8ea2('0x7b')]('me',null,_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);break;}}else{var _0x3d55db=as['buildExpression'](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db['value'][_0x8ea2('0x30')]);}}}else{var _0x356099=_(_0x5352b9[_0x8ea2('0x4e')])['keys']()[_0x8ea2('0x43')](function(_0x5c2d05){return _['some'](_0x2d6bbb,[_0x8ea2('0x3c'),_0x5c2d05])?_0x5c2d05:undefined;})[_0x8ea2('0x84')]()['value']();if(!_['isEmpty'](_0x356099)){_0x356099['forEach'](function(_0x167f15){if(_0x167f15==='ChatWebsiteId'){_0x59e3df['where'](_0x8ea2('0x85'),[][_0x8ea2('0x86')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15]));}else if(_0x167f15===_0x8ea2('0x87')){var _0x1681d8=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x89')];var _0x14a5de=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x8a')];_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0x8b'),_0x1681d8,_0x14a5de);}else{if(_0x5352b9['query'][_0x167f15]===_0x8ea2('0x8c')){_0x59e3df[_0x8ea2('0x59')]('i.'+_0x167f15+_0x8ea2('0x8d'));}else{_0x59e3df['where']('i.'+_0x167f15+_0x8ea2('0x8e'),_0x5352b9['query'][_0x167f15]);}}});}if(_0x5352b9[_0x8ea2('0x4e')]['read']){if(_0x5352b9[_0x8ea2('0x4e')]['read']==0x1){_0x59e3df[_0x8ea2('0x73')](_0x8ea2('0x8f'));}else{_0x59e3df['having'](_0x8ea2('0x90'));}}if(_0x5352b9['query'][_0x8ea2('0x91')]){_0x11824e=_[_0x8ea2('0x92')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x91')])?_0x5352b9[_0x8ea2('0x4e')]['tag']:new Array(_0x5352b9['query'][_0x8ea2('0x91')]);_0x11824e['forEach'](function(_0x410f78){_0x2b8662['or'](_0x8ea2('0x93'),'%,'+_0x410f78+',%');});}if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x94')]){var _0x262cef=_0x5352b9[_0x8ea2('0x4e')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8ea2('0x95')](_0x262cef)){_0x2bbec0['or']('i.id\x20LIKE\x20?',_0x262cef+'%');}else{_0x2bbec0['or'](_0x8ea2('0x96'),qs[_0x8ea2('0x78')](_0x262cef))['or'](_0x8ea2('0x97'),_0x262cef+'%');}}}_0x59e3df[_0x8ea2('0x59')](_0x2bbec0);_0x59e3df[_0x8ea2('0x98')](_0x8ea2('0x99'));var _0x4b4d64={'type':db[_0x8ea2('0x9a')][_0x8ea2('0x9b')][_0x8ea2('0x9c')],'raw':!![]};var _0x335a96=_0x59e3df[_0x8ea2('0x9d')]();_0x335a96['field']('i.id');_0x335a96[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));if(_0x1ef615[_0x8ea2('0x57')]){_0x1ef615[_0x8ea2('0x57')][_0x8ea2('0x47')](function(_0x2e0bbe){var _0x9c4960=_0x2e0bbe[0x0]===_0x8ea2('0x9f')?_0x2e0bbe[0x0]:'i.'+_0x2e0bbe[0x0];_0x59e3df[_0x8ea2('0x57')](_0x9c4960,_0x2e0bbe[0x1]===_0x8ea2('0xa0')?![]:!![]);});}if(!_[_0x8ea2('0xa1')](_0x11824e)){_0x59e3df[_0x8ea2('0x73')](_0x2b8662);_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa2'),_0x11824e);}BPromise[_0x8ea2('0xa3')]()[_0x8ea2('0x25')](function(){if(!_0x21485a){if(_0x5352b9['query']['ChatWebsiteId'])return;_0x335a96[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa4'));return;}if(_0x5352b9['user'][_0x8ea2('0xa5')]!=='agent')return;return _0x5352b9[_0x8ea2('0xa6')][_0x8ea2('0xa7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17dee8){if(_[_0x8ea2('0xa1')](_0x17dee8)){_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa8'));_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa8'));}else{_0x335a96[_0x8ea2('0x59')](_0x8ea2('0x85'),_[_0x8ea2('0x43')](_0x17dee8,'id'));_0x59e3df[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IN\x20?',_[_0x8ea2('0x43')](_0x17dee8,'id'));}});})[_0x8ea2('0x25')](function(){if(_0x5352b9['user'][_0x8ea2('0xa5')]==='agent'&&!_0x21485a&&!_0x5352b9['query']['ChatWebsiteId'])return[];return db[_0x8ea2('0xa9')]['query'](_0x335a96[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x12ed20){_0x5cb6ad[_0x8ea2('0x35')]=_0x12ed20[_0x8ea2('0x54')];if(_0x5cb6ad[_0x8ea2('0x35')]===0x0)return[];return db['sequelize'][_0x8ea2('0x4e')](_0x24a22a['toString'](),_0x4b4d64)[_0x8ea2('0x25')](function(_0x18aa81){_0x4afd85=_[_0x8ea2('0xab')](_0x18aa81,'id');_0x4b4d64=_[_0x8ea2('0x3d')](_0x4b4d64,{'model':db[_0x8ea2('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5352b9['query'][_0x8ea2('0x53')]){_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x47')](function(_0x2a82b2){_0x59e3df[_0x8ea2('0x5c')]('i.'+_0x2a82b2);});}else{_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xac'),_0x8ea2('0xad'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xae'),_0x8ea2('0xaf'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb0'),_0x8ea2('0x9f'));_0x59e3df['field'](_0x8ea2('0xb1'));_0x59e3df['field']('c.firstName',_0x8ea2('0xb2'));_0x59e3df[_0x8ea2('0x5c')]('c.lastName',_0x8ea2('0xb3'));_0x59e3df[_0x8ea2('0x5c')]('c.email',_0x8ea2('0xb4'));_0x59e3df[_0x8ea2('0x5c')]('c.phone',_0x8ea2('0xb5'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb6'),_0x8ea2('0xb7'));_0x59e3df[_0x8ea2('0x5c')]('c.fax',_0x8ea2('0xb8'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb9'),_0x8ea2('0xba'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbb'),_0x8ea2('0xbc'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbd'),'TagIds');}if(_0x1ef615[_0x8ea2('0x34')])_0x59e3df['limit'](_0x1ef615[_0x8ea2('0x34')]);if(_0x1ef615[_0x8ea2('0x32')])_0x59e3df[_0x8ea2('0x32')](_0x1ef615[_0x8ea2('0x32')]);return db[_0x8ea2('0xa9')]['query'](_0x59e3df[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x4fdd16){if(_0x4fdd16['length']>0x0)_0x48aebf[_0x8ea2('0x59')](_0x8ea2('0xbe'),_['map'](_0x4fdd16,'id'));return db['sequelize'][_0x8ea2('0x4e')](_0x48aebf[_0x8ea2('0xaa')](),_0x4b4d64)['then'](function(_0x2b7e80){var _0x2f6673=_[_0x8ea2('0xbf')](_0x2b7e80,_0x8ea2('0xc0'));var _0xdf4de9=[];_0x4fdd16['forEach'](function(_0x2e3a5d){_0xdf4de9[_0x8ea2('0xc1')](updateChatInteraction(_0x2e3a5d,_0x4afd85,_0x2f6673));});return BPromise[_0x8ea2('0xc2')](_0xdf4de9);});});})[_0x8ea2('0x25')](function(_0x412af1){_0x5cb6ad['rows']=_0x412af1;return _0x5cb6ad;})[_0x8ea2('0x25')](respondWithFilteredResult(_0x3afb80,_0x1ef615))['catch'](handleError(_0x3afb80,null));};exports['show']=function(_0x9468be,_0x17e9fc){var _0x5c95ec={'raw':![],'where':{'id':_0x9468be[_0x8ea2('0xc3')]['id']}},_0x239516={};_0x239516[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')]);_0x239516['query']=_[_0x8ea2('0x4f')](_0x9468be[_0x8ea2('0x4e')]);_0x239516[_0x8ea2('0x50')]=_['intersection'](_0x239516[_0x8ea2('0x4d')],_0x239516[_0x8ea2('0x4e')]);_0x5c95ec[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x239516[_0x8ea2('0x4d')],qs['fields'](_0x9468be[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x5c95ec[_0x8ea2('0x52')]=_0x5c95ec[_0x8ea2('0x52')]['length']?_0x5c95ec['attributes']:_0x239516[_0x8ea2('0x4d')];if(_0x9468be['query'][_0x8ea2('0xc4')]){_0x5c95ec['include']=[{'all':!![]}];}_0x5c95ec=_[_0x8ea2('0x3d')]({},_0x5c95ec,_0x9468be[_0x8ea2('0xc5')]);return db[_0x8ea2('0x49')][_0x8ea2('0x71')](_0x5c95ec)[_0x8ea2('0x25')](handleEntityNotFound(_0x17e9fc,null))[_0x8ea2('0x25')](respondWithResult(_0x17e9fc,null))[_0x8ea2('0x2e')](handleError(_0x17e9fc,null));};exports['create']=function(_0x2c5677,_0x224fca){return db[_0x8ea2('0x49')][_0x8ea2('0xc6')](_0x2c5677[_0x8ea2('0xc7')],{})[_0x8ea2('0x25')](respondWithResult(_0x224fca,0xc9))['catch'](handleError(_0x224fca,null));};exports[_0x8ea2('0x38')]=function(_0x463372,_0x76085){if(_0x463372[_0x8ea2('0xc7')]['id']){delete _0x463372['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x463372[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x76085,null))[_0x8ea2('0x25')](saveUpdates(_0x463372['body'],null))[_0x8ea2('0x25')](respondWithResult(_0x76085,null))[_0x8ea2('0x2e')](handleError(_0x76085,null));};exports[_0x8ea2('0x39')]=function(_0x500b47,_0x331019){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x500b47[_0x8ea2('0xc3')]['id']}})['then'](handleEntityNotFound(_0x331019,null))['then'](removeEntity(_0x331019,null))[_0x8ea2('0x2e')](handleError(_0x331019,null));};exports[_0x8ea2('0xc8')]=function(_0x405020,_0x5c9359){return db[_0x8ea2('0x49')][_0x8ea2('0xc8')]()[_0x8ea2('0x25')](respondWithResult(_0x5c9359,null))[_0x8ea2('0x2e')](handleError(_0x5c9359,null));};exports[_0x8ea2('0xc9')]=function(_0x11c59e,_0x11b02a){var _0x5ab2c4=_0x11c59e[_0x8ea2('0xc3')]['id'];var _0x111f97;var _0xf76d70;var _0x384500;return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x5ab2c4}})[_0x8ea2('0x25')](function(_0x568581){_0x111f97=_0x568581;return db[_0x8ea2('0xcb')][_0x8ea2('0xca')]({'where':{'id':_0x568581[_0x8ea2('0xcc')]},'attributes':['id',_0x8ea2('0xcd'),_0x8ea2('0xce'),'vidaooTopic',_0x8ea2('0xcf'),_0x8ea2('0xd0')],'raw':!![]});})[_0x8ea2('0x25')](function(_0x1c336e){if(_0x1c336e&&_0x1c336e[_0x8ea2('0xcd')]&&_0x1c336e[_0x8ea2('0xce')]){_0xf76d70=_0x1c336e;var _0x473ae2={'interaction':{'id':_0x5ab2c4},'agent':{'id':_0x11c59e[_0x8ea2('0xa6')]['id'],'name':_0x11c59e[_0x8ea2('0xa6')]['name'],'fullname':_0x11c59e['user']['fullname'],'email':_0x11c59e[_0x8ea2('0xa6')]['email']},'contact':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x3e')],'account':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x41')]};var _0x6c0ccc={'rejectUnauthorized':![],'method':_0x8ea2('0xd1'),'url':_0x8ea2('0xd2'),'headers':{'X-APIKEY':_0x1c336e[_0x8ea2('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x11c59e[_0x8ea2('0xa6')][_0x8ea2('0xd3')]],'buttons':null,'topic':_0xf76d70['vidaooTopic'],'note':_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xcf')])?null:getMustacheRender(_0xf76d70[_0x8ea2('0xcf')],_0x473ae2),'metadata':null},'redirect':_0x8ea2('0xd5'),'json':!![]};try{if(!_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xd0')])){var _0xc6888c=getMustacheRender(_0xf76d70[_0x8ea2('0xd0')],_0x473ae2);var _0x152d46=JSON[_0x8ea2('0x88')](_0xc6888c);_0x6c0ccc[_0x8ea2('0xc7')][_0x8ea2('0xd6')]=_0x152d46;}}catch(_0x465e7f){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xd8'));}return rp(_0x6c0ccc);}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x4b2c0f){_0x384500=_0x4b2c0f;if(_0x384500['id']){var _0x2fcddc={'body':_0x384500[_0x8ea2('0xd9')],'ChatWebsiteId':_0xf76d70['id'],'ChatInteractionId':_0x111f97['id'],'direction':'out','UserId':_0x11c59e[_0x8ea2('0xa6')]['id']};return db[_0x8ea2('0xda')][_0x8ea2('0xc6')](_0x2fcddc,{});}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError'](_0x8ea2('0xdb'));}})['then'](function(){return _0x111f97[_0x8ea2('0xdc')]({'vidaooSessionId':_0x384500['id']});})[_0x8ea2('0x25')](respondWithResult(_0x11b02a,null))[_0x8ea2('0x2e')](handleError(_0x11b02a,null));};exports[_0x8ea2('0xdd')]=function(_0x3b6b03,_0x3292bc){if(_0x3b6b03['body']['id']){delete _0x3b6b03['body']['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x3b6b03['params']['id']},'include':[{'model':db[_0x8ea2('0xde')],'as':'Contact'}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x3292bc,null))[_0x8ea2('0x25')](saveUpdates(_0x3b6b03[_0x8ea2('0xc7')],null))[_0x8ea2('0x25')](respondWithResult(_0x3292bc,null))[_0x8ea2('0x2e')](handleError(_0x3292bc,null));};exports[_0x8ea2('0xdf')]=function(_0x1383b4,_0x4c1b9d,_0x3f3822){if(_0x1383b4[_0x8ea2('0xc7')]['id']){delete _0x1383b4[_0x8ea2('0xc7')]['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x1383b4[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](function(_0x1c974d){if(!_0x1c974d){logger[_0x8ea2('0x2b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x8ea2('0xdf'),0x194,_0x8ea2('0xe0'));_0x4c1b9d[_0x8ea2('0x3a')](0x194);}else{if(_0x1c974d['UserId']){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xe1'));}}return _0x1c974d;})[_0x8ea2('0x25')](function(_0xe18090){if(_0xe18090){return _0xe18090[_0x8ea2('0x38')]({'closed':_0x1383b4['body']['closed'],'disposition':_0x1383b4[_0x8ea2('0xc7')][_0x8ea2('0xe2')]})[_0x8ea2('0x25')](function(_0x695f4a){return _0x695f4a;});}})[_0x8ea2('0x25')](function(_0x57ff72){return respondWithRpcPromise(_0x8ea2('0xe3'),'abandon',_0x1383b4[_0x8ea2('0xc7')],client9004);})[_0x8ea2('0x25')](respondWithResult(_0x4c1b9d,null))['catch'](handleError(_0x4c1b9d,null));};exports[_0x8ea2('0xe4')]=function(_0x254b51,_0x2c11d2,_0x2aaa88){_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x3c')]=_0x254b51[_0x8ea2('0xe5')][_0x8ea2('0xe6')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0xe7')]=_0x254b51['file'][_0x8ea2('0xe8')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x4b')]=_0x254b51['file'][_0x8ea2('0xe9')];return db['Attachment'][_0x8ea2('0xc6')](_0x254b51[_0x8ea2('0xc7')])[_0x8ea2('0x25')](respondWithResult(_0x2c11d2,0xc9))[_0x8ea2('0x2e')](handleError(_0x2c11d2,null));};exports[_0x8ea2('0xea')]=function(_0x1786ac,_0x7a45a8,_0x3a68e2){return db[_0x8ea2('0x49')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0xc3')]['id']},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null))[_0x8ea2('0x25')](function(_0x8d4abd){if(_0x8d4abd){if(_0x8d4abd[_0x8ea2('0xeb')]){return _0x7a45a8[_0x8ea2('0x2f')](0x193)[_0x8ea2('0x31')]({'status':0x193,'message':_0x8ea2('0xec')});}return db[_0x8ea2('0xed')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0x4e')][_0x8ea2('0xee')]},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null));}})[_0x8ea2('0x25')](function(_0xcbb6b3){if(_0xcbb6b3){var _0x4bdbe0=_0xcbb6b3[_0x8ea2('0xef')]!==null;var _0x44791f=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf2'));if(_0x4bdbe0){_0x44791f=path['join'](_0x44791f,_0x8ea2('0xf3'));}var _0x4e7aff=path[_0x8ea2('0xf0')](_0x44791f,_0xcbb6b3[_0x8ea2('0xe7')]);return _0x7a45a8[_0x8ea2('0xf4')](_0x4e7aff);}})['catch'](handleError(_0x7a45a8,null));};exports[_0x8ea2('0xf5')]=function(_0x48a2e2,_0x4e804c){var _0x487bab=null;var _0x1a0966=null;var _0x50087b=null;var _0x196b89=null;if(_0x48a2e2[_0x8ea2('0xc7')]['id']){delete _0x48a2e2[_0x8ea2('0xc7')]['id'];}if(_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')]){_0x196b89=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf7'),util['format']('transcript-%s.txt',Date[_0x8ea2('0xf8')]()));_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf9')]=_0x196b89;}return db['ChatInteraction']['find']({'where':{'id':_0x48a2e2['params']['id']},'include':[{'model':db[_0x8ea2('0xda')],'as':'Messages','include':[{'model':db['User'],'as':_0x8ea2('0x7f')}]}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x4e804c,null))['then'](saveUpdates(_0x48a2e2['body'],null))[_0x8ea2('0x25')](function(_0x48eac8){if(_0x48eac8){_0x487bab=_0x48eac8;return db['ChatWebsite'][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0xcc')]}});}})[_0x8ea2('0x25')](function(_0x54da21){if(_0x54da21){_0x50087b=_0x54da21;return db[_0x8ea2('0xde')][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0x7a')]}});}})[_0x8ea2('0x25')](function(_0x3a43d5){if(_0x3a43d5){_0x1a0966=_0x3a43d5;if(_0x196b89){var _0x535b01=null;for(var _0x22e4cd=0x1;_0x22e4cd<_0x487bab['Messages'][_0x8ea2('0x54')];++_0x22e4cd){_0x535b01=_0x487bab['Messages'][_0x22e4cd];var _0x230a70=_0x535b01['UserId']?util['format'](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');var _0x332670=_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xfd')]||util[_0x8ea2('0xfe')]('%s%d',_0x8ea2('0xff'),_0x535b01[_0x8ea2('0x7a')]);switch(_0x50087b[_0x8ea2('0x100')]){case _0x8ea2('0x101'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?util['format'](_0x8ea2('0xfa'),_0x50087b['agentAlias'],_0x535b01[_0x8ea2('0x82')]):'System';break;case _0x8ea2('0x102'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01[_0x8ea2('0x7f')][_0x8ea2('0x103')]||_0x535b01['User']['fullname']:'System';break;case _0x8ea2('0x104'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01['User'][_0x8ea2('0x105')]:_0x8ea2('0xfc');break;default:_0x230a70=_0x535b01[_0x8ea2('0x82')]?util[_0x8ea2('0xfe')](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');}var _0x422280=util[_0x8ea2('0xfe')](_0x8ea2('0x106'),moment(_0x535b01[_0x8ea2('0x87')])[_0x8ea2('0xfe')]('MM/DD/YYYY\x20HH:mm:ss'),_0x535b01[_0x8ea2('0x107')]==='in'?_0x332670:_0x230a70,_0x535b01['body']);if(!_0x535b01['secret']){fs[_0x8ea2('0x108')](_0x196b89,_0x422280);}}return db['MailAccount'][_0x8ea2('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0x8ea2('0x109')],'as':_0x8ea2('0x10a'),'raw':!![]}]});}}})[_0x8ea2('0x25')](function(_0xff0fae){if(_0xff0fae&&_0xff0fae['Smtp']&&_0x48a2e2[_0x8ea2('0xc7')]){var _0x3f5688={'tls':{'rejectUnauthorized':![]}};if(_0xff0fae[_0x8ea2('0x10a')]['service']){_0x3f5688['service']=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10b')];}else{_0x3f5688['host']=_0xff0fae[_0x8ea2('0x10a')]['host'];_0x3f5688[_0x8ea2('0x10c')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10c')];_0x3f5688[_0x8ea2('0x10d')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10d')];}if(_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10e')]){_0x3f5688[_0x8ea2('0x10f')]={'user':_0xff0fae['Smtp']['user'],'pass':_0xff0fae[_0x8ea2('0x10a')]['pass']};}return respondWithRpcPromise(_0x8ea2('0x110'),_0x8ea2('0x111'),{'account':_0x3f5688,'message':{'from':util[_0x8ea2('0xfe')](_0x8ea2('0x112'),_0xff0fae['name'],_0xff0fae[_0x8ea2('0xd3')]||_0xff0fae[_0x8ea2('0x10a')]['user']),'to':_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')],'subject':_0x8ea2('0x113'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x48a2e2['body'][_0x8ea2('0xf6')]),'attachments':[{'path':_0x196b89}]}})['then'](function(){return _0x487bab;})[_0x8ea2('0x2e')](function(_0x488acb){console[_0x8ea2('0x2b')](_0x488acb);});}else{return _0x487bab;}})[_0x8ea2('0x25')](respondWithStatusCode(_0x4e804c,0xc8))[_0x8ea2('0x2e')](handleError(_0x4e804c,null));};exports[_0x8ea2('0x114')]=function(_0x54925a,_0x295339,_0x55c23c){return db['ChatMessage']['find']({'where':{'id':_0x54925a[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x295339,null))[_0x8ea2('0x25')](function(_0x48b51d){if(_0x48b51d){return _0x48b51d[_0x8ea2('0x114')](_0x54925a[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x54925a[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{});}})[_0x8ea2('0x25')](respondWithResult(_0x295339,null))[_0x8ea2('0x2e')](handleError(_0x295339,null));};exports[_0x8ea2('0x117')]=function(_0x102d70,_0x2b014d,_0xc35654){var _0x355b91={'raw':![],'where':{}};var _0x1cf414={};var _0x48e543={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8ea2('0xca')]({'where':{'id':_0x102d70['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x2b014d,null))[_0x8ea2('0x25')](function(_0x3ebbc8){if(_0x3ebbc8){_0x1cf414['model']=_[_0x8ea2('0x4f')](db['ChatMessage']['rawAttributes']);_0x1cf414[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x102d70[_0x8ea2('0x4e')]);_0x1cf414[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],_0x1cf414[_0x8ea2('0x4e')]);_0x355b91['attributes']=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x102d70['query'][_0x8ea2('0x53')]));_0x355b91[_0x8ea2('0x52')]=_0x355b91[_0x8ea2('0x52')]['length']?_0x355b91[_0x8ea2('0x52')]:_0x1cf414[_0x8ea2('0x4d')];if(!_0x102d70[_0x8ea2('0x4e')]['hasOwnProperty']('nolimit')){_0x355b91[_0x8ea2('0x34')]=qs['limit'](_0x102d70[_0x8ea2('0x4e')]['limit']);_0x355b91[_0x8ea2('0x32')]=qs[_0x8ea2('0x32')](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x32')]);}_0x355b91[_0x8ea2('0x57')]=qs['sort'](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x355b91[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x102d70[_0x8ea2('0x4e')],_0x1cf414['filters']));_0x355b91['where'][_0x8ea2('0xc0')]=_0x3ebbc8['id'];if(_0x102d70[_0x8ea2('0x4e')]['filter']){_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],{'$or':_[_0x8ea2('0x43')](_0x355b91['attributes'],function(_0x19ea2b){var _0x4450e8={};_0x4450e8[_0x19ea2b]={'$like':'%'+_0x102d70['query'][_0x8ea2('0x94')]+'%'};return _0x4450e8;})});}if(_0x102d70['query'][_0x8ea2('0x89')]){var _0x479b40=_0x102d70['query'][_0x8ea2('0x89')][_0x8ea2('0x46')](',');var _0xbb5964={};_0xbb5964[_0x479b40[0x0]]={'$gte':moment(_0x479b40[0x1])[_0x8ea2('0xfe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],_0xbb5964);}_0x355b91=_['merge']({},_0x355b91,_0x102d70[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x355b91[_0x8ea2('0x59')]})[_0x8ea2('0x25')](function(_0x46d38e){_0x48e543[_0x8ea2('0x35')]=_0x46d38e;if(_0x102d70['query'][_0x8ea2('0xc4')]){_0x355b91[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x355b91);})[_0x8ea2('0x25')](function(_0x23f247){_0x48e543[_0x8ea2('0x11a')]=_0x23f247;return _0x48e543;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x2b014d,_0x355b91))[_0x8ea2('0x2e')](handleError(_0x2b014d,null));};exports[_0x8ea2('0x11b')]=function(_0x3a37fb,_0x455009,_0x556919){var _0x58a0e5={'where':{}},_0x3be2ce={},_0x56a973={'count':0x0,'rows':[]};return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x3a37fb[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x455009,null))[_0x8ea2('0x25')](function(_0x515381){if(_0x515381){_0x3be2ce[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db['ChatMessage'][_0x8ea2('0x4a')]);_0x3be2ce[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x3a37fb[_0x8ea2('0x4e')]);_0x3be2ce['filters']=_[_0x8ea2('0x51')](_0x3be2ce[_0x8ea2('0x4d')],_0x3be2ce[_0x8ea2('0x4e')]);_0x58a0e5[_0x8ea2('0x52')]=_['intersection'](_0x3be2ce[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x3a37fb[_0x8ea2('0x4e')]['fields']));_0x58a0e5[_0x8ea2('0x52')]=_0x58a0e5[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x58a0e5['attributes']:_0x3be2ce['model'];if(!_0x3a37fb[_0x8ea2('0x4e')]['hasOwnProperty'](_0x8ea2('0x56'))){_0x58a0e5[_0x8ea2('0x34')]=qs[_0x8ea2('0x34')](_0x3a37fb[_0x8ea2('0x4e')]['limit']);_0x58a0e5[_0x8ea2('0x32')]=qs['offset'](_0x3a37fb['query']['offset']);}_0x58a0e5['order']=qs[_0x8ea2('0x58')](_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x58a0e5[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_['pick'](_0x3a37fb['query'],_0x3be2ce[_0x8ea2('0x50')]));_0x58a0e5['where']['ChatInteractionId']=_0x515381['id'];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]){_0x58a0e5[_0x8ea2('0x59')]=_['merge'](_0x58a0e5[_0x8ea2('0x59')],{'$or':_['map'](_0x58a0e5[_0x8ea2('0x52')],function(_0x4041ec){var _0x56178b={};_0x56178b[_0x4041ec]={'$like':'%'+_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]+'%'};return _0x56178b;})});}_0x58a0e5['where'][_0x8ea2('0x11c')]=![];if(_0x3a37fb[_0x8ea2('0x4e')]['id']){_0x58a0e5[_0x8ea2('0x59')]['id']={'$gt':_0x3a37fb[_0x8ea2('0x4e')]['id']};}_0x58a0e5=_[_0x8ea2('0x3d')]({},_0x58a0e5,_0x3a37fb[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x58a0e5[_0x8ea2('0x59')]})['then'](function(_0xcedece){_0x56a973['count']=_0xcedece;_0x58a0e5[_0x8ea2('0x118')]=[];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x11d')]){_0x58a0e5[_0x8ea2('0x118')][_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':_0x8ea2('0x7f'),'attributes':['id',_0x8ea2('0x105'),'alias']});}if(_0x3a37fb['query'][_0x8ea2('0xc4')]){_0x58a0e5[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x58a0e5);})[_0x8ea2('0x25')](function(_0x52bf7c){_0x56a973[_0x8ea2('0x11a')]=_0x52bf7c;return _0x56a973;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x455009,_0x58a0e5))['catch'](handleError(_0x455009,null));};exports[_0x8ea2('0x11e')]=function(_0x3be5d0,_0x3ac848,_0x52ce76){return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x3be5d0['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x3ac848,null))[_0x8ea2('0x25')](function(_0x1030c9){if(_0x1030c9){return _0x1030c9[_0x8ea2('0x11f')](_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x3be5d0[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{})[_0x8ea2('0x120')](function(){return db[_0x8ea2('0x7d')][_0x8ea2('0x119')]({'attributes':['id',_0x8ea2('0x3c'),_0x8ea2('0x5d')],'where':{'id':_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')]}});})[_0x8ea2('0x25')](function(_0x452b94){socket[_0x8ea2('0x121')]('chatInteractionTags:save',{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]});return{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]};});}})[_0x8ea2('0x25')](respondWithResult(_0x3ac848,null))[_0x8ea2('0x2e')](handleError(_0x3ac848,null));};exports[_0x8ea2('0x122')]=function(_0x9410dd,_0x497671,_0x5e3e8d){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x9410dd[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x497671,null))[_0x8ea2('0x25')](function(_0x19b042){if(_0x19b042){return _0x19b042[_0x8ea2('0x122')](_0x9410dd[_0x8ea2('0x4e')][_0x8ea2('0x115')]);}})['then'](respondWithStatusCode(_0x497671,null))[_0x8ea2('0x2e')](handleError(_0x497671,null));};exports[_0x8ea2('0xf4')]=function(_0x2dc450,_0x34e1c5){var _0x5b929c=moment()['unix']()[_0x8ea2('0xaa')]();var _0x263123=path[_0x8ea2('0xf0')](config['root'],'server',_0x8ea2('0x123'),'tmp');var _0x40e8e6=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x123'),_0x8ea2('0x124'));var _0x2dfabc=path[_0x8ea2('0xf0')](_0x263123,_0x5b929c);var _0x515049=util['format'](_0x8ea2('0x125'),_0x2dc450[_0x8ea2('0xc3')]['id'],_0x5b929c);var _0x39000d=path['join'](_0x263123,_0x515049);var _0x3a1752=[];_0x3a1752['push']({'model':db[_0x8ea2('0x7f')],'as':'User','attributes':['id',_0x8ea2('0x105')],'raw':!![]});_0x3a1752['push']({'model':db[_0x8ea2('0xde')],'as':_0x8ea2('0x75'),'attributes':['id',_0x8ea2('0x126'),_0x8ea2('0x127')],'raw':!![]});if(_0x2dc450['query'][_0x8ea2('0x124')]){_0x3a1752[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xed')],'as':_0x8ea2('0xed'),'raw':!![]});}var _0x5ba508=[{'model':db[_0x8ea2('0xda')],'as':_0x8ea2('0x128'),'attributes':['id',_0x8ea2('0xc7'),_0x8ea2('0x87'),_0x8ea2('0x107'),'secret',_0x8ea2('0x129')],'include':_0x3a1752}];_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xcb')],'as':_0x8ea2('0x12a'),'attributes':['id','name']});_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x2dc450[_0x8ea2('0xc3')]['id']},'include':_0x5ba508})[_0x8ea2('0x25')](handleEntityNotFound(_0x34e1c5,null))[_0x8ea2('0x25')](function(_0x3c9013){if(_0x3c9013){var _0x103c43=_0x3c9013['get']({'plain':!![]});fs['mkdirSync'](_0x2dfabc);var _0xc099b6={'channel':_0x8ea2('0x12b'),'account':_0x103c43[_0x8ea2('0x12a')]['name'],'agent':_0x103c43['Owner']?_0x103c43[_0x8ea2('0x12c')][_0x8ea2('0x105')]:'N.A.','createdAt':moment(_0x103c43[_0x8ea2('0x87')])['format'](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'closedAt':_0x103c43[_0x8ea2('0xeb')]?moment(_0x103c43['closedAt'])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))['toString']():'','disposition':_0x103c43[_0x8ea2('0xe2')],'chatInfo':{'browser':_0x103c43[_0x8ea2('0x12e')],'os':_0x103c43['osName'],'referer':_0x103c43['referer'],'customerIp':_0x103c43[_0x8ea2('0x12f')],'customerPort':_0x103c43[_0x8ea2('0x130')]?_0x103c43[_0x8ea2('0x130')]:'N.A.'},'messages':_(_0x103c43[_0x8ea2('0x128')])[_0x8ea2('0x131')]()[_0x8ea2('0x94')]({'secret':![]})[_0x8ea2('0x43')](function(_0x36799a){if(_0x36799a['Attachment']){var _0x1cc1d9=path['join'](_0x40e8e6,_0x36799a[_0x8ea2('0xed')]['basename']);if(fs[_0x8ea2('0x132')](_0x1cc1d9)){fs[_0x8ea2('0x133')](_0x1cc1d9)[_0x8ea2('0x134')](fs[_0x8ea2('0x135')](path['join'](_0x2dfabc,_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')])));}}return{'date':moment(_0x36799a[_0x8ea2('0x87')])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'sender':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?_0x36799a[_0x8ea2('0x7f')]?_0x36799a[_0x8ea2('0x7f')][_0x8ea2('0x105')]:'System':_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x126')]+(_0x36799a[_0x8ea2('0x75')]['lastName']?'\x20'+_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x127')]:''),'body':_0x36799a[_0x8ea2('0xed')]?_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')]:_0x36799a[_0x8ea2('0xc7')],'direction':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?'A':'C','secret':_0x36799a[_0x8ea2('0x11c')],'read':_0x36799a[_0x8ea2('0x129')],'attachment':_0x36799a['Attachment']};})[_0x8ea2('0x77')]()};return ejs[_0x8ea2('0x137')](path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x138'),_0x8ea2('0x139')),{'interaction':_0xc099b6})[_0x8ea2('0x25')](function(_0x10d2b3){var _0x12a217=path[_0x8ea2('0xf0')](_0x2dfabc,_0x8ea2('0x13a')+_0x103c43['id']+'-'+_0x5b929c+'.pdf');var _0x44b0dc={'path':_0x12a217,'channel':_0x8ea2('0x12b'),'interactionId':_0x103c43['id']};return pdf['createPdfFromHTML'](_0x10d2b3,_0x44b0dc);})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x27f5e9,_0x19b678){zipdir(_0x2dfabc,{'saveTo':_0x39000d},function(_0x50ebcd,_0x5d6c63){if(_0x50ebcd)return _0x19b678(_0x50ebcd);return _0x27f5e9(_0x5d6c63);});})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x55b3a1,_0x57e228){rimraf(_0x2dfabc,function(_0x3c669b){if(_0x3c669b)_0x57e228(_0x3c669b);return _0x55b3a1();});});})[_0x8ea2('0x25')](function(){return _0x34e1c5['download'](_0x39000d,_0x515049,function(_0x688d21){if(_0x688d21){console[_0x8ea2('0x13b')]('err',_0x688d21);}else{fs[_0x8ea2('0x13c')](_0x39000d);}});});});}else{return _0x34e1c5['sendStatus'](0xc8);}})[_0x8ea2('0x2e')](handleError(_0x34e1c5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 38de980..8bb45e7 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 _0xebf5=['update','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x582d37,_0xc34a90){var _0x4aa6b6=function(_0x47224a){while(--_0x47224a){_0x582d37['push'](_0x582d37['shift']());}};_0x4aa6b6(++_0xc34a90);}(_0xebf5,0xe9));var _0x5ebf=function(_0x5d2d25,_0x432a4c){_0x5d2d25=_0x5d2d25-0x0;var _0x39b068=_0xebf5[_0x5d2d25];return _0x39b068;};'use strict';var EventEmitter=require(_0x5ebf('0x0'));var ChatInteraction=require(_0x5ebf('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x5ebf('0x1'))['db'][_0x5ebf('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5ebf('0x3')](0x0);var events={'afterCreate':_0x5ebf('0x4'),'afterUpdate':_0x5ebf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x36d45f){return function(_0x64e13b,_0x48b318,_0x31ff1b){_0x64e13b['getUsers']({'attributes':['id'],'raw':!![]})[_0x5ebf('0x6')](function(_0x321a50){_0x64e13b[_0x5ebf('0x7')](_0x5ebf('0x8'),_0x321a50[_0x5ebf('0x9')](function(_0x3bb40c){return{'id':_0x3bb40c['id']};}));return ChatMessage[_0x5ebf('0xa')]({'where':{'ChatInteractionId':_0x64e13b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x157c32){_0x64e13b[_0x5ebf('0x7')]('unreadMessages',_0x157c32[_0x5ebf('0xb')]);ChatInteractionEvents[_0x5ebf('0xc')](_0x36d45f+':'+_0x64e13b['id'],_0x64e13b);ChatInteractionEvents['emit'](_0x36d45f,_0x64e13b);_0x31ff1b(null);})[_0x5ebf('0xd')](_0x31ff1b(null));};}for(var e in events){if(events[_0x5ebf('0xe')](e)){var event=events[e];ChatInteraction[_0x5ebf('0xf')](e,emitEvent(event));}}module[_0x5ebf('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xc813=['setMaxListeners','save','update','remove','then','setDataValue','map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x5cb96c,_0xddb4e9){var _0xb1ea47=function(_0x315896){while(--_0x315896){_0x5cb96c['push'](_0x5cb96c['shift']());}};_0xb1ea47(++_0xddb4e9);}(_0xc813,0x1bd));var _0x3c81=function(_0x30584f,_0x4a1f96){_0x30584f=_0x30584f-0x0;var _0x2a31e1=_0xc813[_0x30584f];return _0x2a31e1;};'use strict';var EventEmitter=require(_0x3c81('0x0'));var ChatInteraction=require(_0x3c81('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x3c81('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3c81('0x3')](0x0);var events={'afterCreate':_0x3c81('0x4'),'afterUpdate':_0x3c81('0x5'),'afterDestroy':_0x3c81('0x6')};function emitEvent(_0x39f5c6){return function(_0xc68dca,_0x2dfcbb,_0x8897b4){_0xc68dca['getUsers']({'attributes':['id'],'raw':!![]})[_0x3c81('0x7')](function(_0x28f3f6){_0xc68dca[_0x3c81('0x8')]('Users',_0x28f3f6[_0x3c81('0x9')](function(_0x4ed889){return{'id':_0x4ed889['id']};}));return ChatMessage[_0x3c81('0xa')]({'where':{'ChatInteractionId':_0xc68dca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3c81('0x7')](function(_0x1bad34){_0xc68dca['setDataValue']('unreadMessages',_0x1bad34[_0x3c81('0xb')]);ChatInteractionEvents[_0x3c81('0xc')](_0x39f5c6+':'+_0xc68dca['id'],_0xc68dca);ChatInteractionEvents['emit'](_0x39f5c6,_0xc68dca);_0x8897b4(null);})['catch'](_0x8897b4(null));};}for(var e in events){if(events[_0x3c81('0xd')](e)){var event=events[e];ChatInteraction[_0x3c81('0xe')](e,emitEvent(event));}}module[_0x3c81('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c648314..a4e58ed 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 _0x1fd0=['request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b8b2a,_0x938d0f){var _0x2ab9ad=function(_0x19e14f){while(--_0x19e14f){_0x2b8b2a['push'](_0x2b8b2a['shift']());}};_0x2ab9ad(++_0x938d0f);}(_0x1fd0,0xfe));var _0x01fd=function(_0x4271c2,_0x42df11){_0x4271c2=_0x4271c2-0x0;var _0xe769df=_0x1fd0[_0x4271c2];return _0xe769df;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var logger=require(_0x01fd('0x2'))(_0x01fd('0x3'));var moment=require(_0x01fd('0x4'));var BPromise=require(_0x01fd('0x5'));var rp=require(_0x01fd('0x6'));var fs=require('fs');var path=require(_0x01fd('0x7'));var rimraf=require(_0x01fd('0x8'));var config=require(_0x01fd('0x9'));var attributes=require(_0x01fd('0xa'));module[_0x01fd('0xb')]=function(_0x5650c4,_0x280d15){return _0x5650c4[_0x01fd('0xc')](_0x01fd('0xd'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x117d75,_0x1d6a97,_0x5d6593){if(_0x117d75[_0x01fd('0xe')](_0x01fd('0xf'))){_0x117d75['closedAt']=moment()[_0x01fd('0x10')](_0x01fd('0x11'));}_0x5d6593(null,_0x117d75);}},'charset':_0x01fd('0x12'),'collate':_0x01fd('0x13')});}; \ No newline at end of file +var _0xa5dc=['define','ChatInteraction','chat_interactions','closed','format','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x17c02a,_0x806adc){var _0x142d4a=function(_0x1301c6){while(--_0x1301c6){_0x17c02a['push'](_0x17c02a['shift']());}};_0x142d4a(++_0x806adc);}(_0xa5dc,0xac));var _0xca5d=function(_0x5742c4,_0x5d94fc){_0x5742c4=_0x5742c4-0x0;var _0x3eecc9=_0xa5dc[_0x5742c4];return _0x3eecc9;};'use strict';var _=require('lodash');var util=require(_0xca5d('0x0'));var logger=require(_0xca5d('0x1'))(_0xca5d('0x2'));var moment=require(_0xca5d('0x3'));var BPromise=require('bluebird');var rp=require(_0xca5d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca5d('0x5'));var config=require(_0xca5d('0x6'));var attributes=require(_0xca5d('0x7'));module['exports']=function(_0x4657ca,_0x30d911){return _0x4657ca[_0xca5d('0x8')](_0xca5d('0x9'),attributes,{'tableName':_0xca5d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11e038,_0x1a31a5,_0xad2028){if(_0x11e038['changed'](_0xca5d('0xb'))){_0x11e038['closedAt']=moment()[_0xca5d('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0xad2028(null,_0x11e038);}},'charset':_0xca5d('0xd'),'collate':_0xca5d('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index eadc748..a5dc0e7 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 _0x088b=['find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ChatInteraction,\x20%s,\x20%s','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','limit','AddTagsToChatInteraction'];(function(_0x5a2d7c,_0x35c14f){var _0x3f2252=function(_0x213ac5){while(--_0x213ac5){_0x5a2d7c['push'](_0x5a2d7c['shift']());}};_0x3f2252(++_0x35c14f);}(_0x088b,0x13a));var _0xb088=function(_0x103277,_0x15a2a2){_0x103277=_0x103277-0x0;var _0x45c58f=_0x088b[_0x103277];return _0x45c58f;};'use strict';var _=require(_0xb088('0x0'));var util=require(_0xb088('0x1'));var moment=require(_0xb088('0x2'));var BPromise=require(_0xb088('0x3'));var rs=require(_0xb088('0x4'));var fs=require('fs');var Redis=require(_0xb088('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb088('0x6'));var logger=require(_0xb088('0x7'))(_0xb088('0x8'));var config=require(_0xb088('0x9'));var jayson=require(_0xb088('0xa'));var client=jayson[_0xb088('0xb')][_0xb088('0xc')]({'port':0x232a});config[_0xb088('0xd')]=_[_0xb088('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb088('0xf'))(new Redis(config[_0xb088('0xd')]));require(_0xb088('0x10'))[_0xb088('0x11')](socket);function respondWithRpcPromise(_0x3a98a1,_0x49b56a,_0x143d4b){return new BPromise(function(_0x4e07de,_0x1fe168){return client[_0xb088('0x12')](_0x3a98a1,_0x143d4b)[_0xb088('0x13')](function(_0x211bab){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x49b56a,_0xb088('0x14'));logger[_0xb088('0x15')](_0xb088('0x16'),_0x49b56a,'request\x20sent',JSON[_0xb088('0x17')](_0x211bab));if(_0x211bab['error']){if(_0x211bab[_0xb088('0x18')][_0xb088('0x19')]===0x1f4){logger[_0xb088('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x49b56a,_0x211bab[_0xb088('0x18')]['message']);return _0x1fe168(_0x211bab[_0xb088('0x18')][_0xb088('0x1a')]);}logger[_0xb088('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x49b56a,_0x211bab[_0xb088('0x18')][_0xb088('0x1a')]);return _0x4e07de(_0x211bab['error'][_0xb088('0x1a')]);}else{logger[_0xb088('0x1b')](_0xb088('0x1c'),_0x49b56a,_0xb088('0x14'));_0x4e07de(_0x211bab['result'][_0xb088('0x1a')]);}})[_0xb088('0x1d')](function(_0x4a34e2){logger['error'](_0xb088('0x1c'),_0x49b56a,_0x4a34e2);_0x1fe168(_0x4a34e2);});});}exports[_0xb088('0x1e')]=function(_0xdf1a98){var _0x3b5db2=this;return new Promise(function(_0x20416a,_0x173801){return db[_0xb088('0x1f')][_0xb088('0x20')](_0xdf1a98['body'],{'raw':_0xdf1a98[_0xb088('0x21')]?_0xdf1a98[_0xb088('0x21')][_0xb088('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdf1a98[_0xb088('0x21')]?_0xdf1a98[_0xb088('0x21')][_0xb088('0x23')]||null:null,'attributes':_0xdf1a98[_0xb088('0x21')]?_0xdf1a98[_0xb088('0x21')]['attributes']||null:null,'limit':_0xdf1a98[_0xb088('0x21')]?_0xdf1a98[_0xb088('0x21')][_0xb088('0x24')]||null:null})['then'](function(_0x54e697){logger[_0xb088('0x1b')]('UpdateChatInteraction',_0xdf1a98);logger[_0xb088('0x15')](_0xb088('0x1e'),_0xdf1a98,JSON[_0xb088('0x17')](_0x54e697));_0x20416a(_0x54e697);})['catch'](function(_0x156bee){logger['error'](_0xb088('0x1e'),_0x156bee[_0xb088('0x1a')],_0xdf1a98);_0x173801(_0x3b5db2[_0xb088('0x18')](0x1f4,_0x156bee[_0xb088('0x1a')]));});});};exports[_0xb088('0x25')]=function(_0x4892de){return new Promise(function(_0x56d858,_0x476a37){return db[_0xb088('0x1f')][_0xb088('0x26')]({'where':_0x4892de[_0xb088('0x21')]?_0x4892de['options'][_0xb088('0x23')]||null:null})[_0xb088('0x13')](function(_0x125386){if(_0x125386){return _0x125386['addTags'](_0x4892de[_0xb088('0x27')][_0xb088('0x28')],_[_0xb088('0x29')](_0x4892de[_0xb088('0x27')],[_0xb088('0x28'),'id'])||{});}})[_0xb088('0x2a')](function(_0x16dead){logger[_0xb088('0x1b')](_0xb088('0x2b'),_0x4892de);logger[_0xb088('0x15')](_0xb088('0x2b'),_0x4892de,JSON[_0xb088('0x17')](_0x16dead));_0x56d858(_0x16dead);})[_0xb088('0x1d')](function(_0x18232a){logger[_0xb088('0x18')](_0xb088('0x2b'),_0x18232a['message'],_0x4892de);_0x476a37(_this[_0xb088('0x18')](0x1f4,_0x18232a[_0xb088('0x1a')]));});});}; \ No newline at end of file +var _0xedc4=['register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','then','UpdateChatInteraction','find','addTags','ids','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x17eb11,_0x25d8c6){var _0x559093=function(_0x1bf619){while(--_0x1bf619){_0x17eb11['push'](_0x17eb11['shift']());}};_0x559093(++_0x25d8c6);}(_0xedc4,0x166));var _0x4edc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xedc4[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x4edc('0x0'));var moment=require('moment');var BPromise=require(_0x4edc('0x1'));var rs=require(_0x4edc('0x2'));var fs=require('fs');var Redis=require(_0x4edc('0x3'));var db=require(_0x4edc('0x4'))['db'];var utils=require(_0x4edc('0x5'));var logger=require(_0x4edc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4edc('0x7')]({'port':0x232a});config[_0x4edc('0x8')]=_['defaults'](config['redis'],{'host':_0x4edc('0x9'),'port':0x18eb});var socket=require(_0x4edc('0xa'))(new Redis(config[_0x4edc('0x8')]));require(_0x4edc('0xb'))[_0x4edc('0xc')](socket);function respondWithRpcPromise(_0x1043e3,_0x58a413,_0x34f23d){return new BPromise(function(_0x37378a,_0x15f9c3){return client[_0x4edc('0xd')](_0x1043e3,_0x34f23d)['then'](function(_0x250b4b){logger[_0x4edc('0xe')](_0x4edc('0xf'),_0x58a413,_0x4edc('0x10'));logger[_0x4edc('0x11')](_0x4edc('0x12'),_0x58a413,_0x4edc('0x10'),JSON[_0x4edc('0x13')](_0x250b4b));if(_0x250b4b[_0x4edc('0x14')]){if(_0x250b4b['error']['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x58a413,_0x250b4b[_0x4edc('0x14')]['message']);return _0x15f9c3(_0x250b4b[_0x4edc('0x14')][_0x4edc('0x15')]);}logger[_0x4edc('0x14')](_0x4edc('0xf'),_0x58a413,_0x250b4b[_0x4edc('0x14')][_0x4edc('0x15')]);return _0x37378a(_0x250b4b[_0x4edc('0x14')][_0x4edc('0x15')]);}else{logger[_0x4edc('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x58a413,_0x4edc('0x10'));_0x37378a(_0x250b4b['result'][_0x4edc('0x15')]);}})[_0x4edc('0x16')](function(_0x5368b0){logger[_0x4edc('0x14')](_0x4edc('0xf'),_0x58a413,_0x5368b0);_0x15f9c3(_0x5368b0);});});}exports['UpdateChatInteraction']=function(_0x4460e3){var _0x49c652=this;return new Promise(function(_0x6ef155,_0xaa6412){return db[_0x4edc('0x17')][_0x4edc('0x18')](_0x4460e3[_0x4edc('0x19')],{'raw':_0x4460e3[_0x4edc('0x1a')]?_0x4460e3[_0x4edc('0x1a')][_0x4edc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4460e3[_0x4edc('0x1a')]?_0x4460e3[_0x4edc('0x1a')][_0x4edc('0x1c')]||null:null,'attributes':_0x4460e3[_0x4edc('0x1a')]?_0x4460e3[_0x4edc('0x1a')][_0x4edc('0x1d')]||null:null,'limit':_0x4460e3[_0x4edc('0x1a')]?_0x4460e3['options'][_0x4edc('0x1e')]||null:null})[_0x4edc('0x1f')](function(_0x447622){logger[_0x4edc('0xe')](_0x4edc('0x20'),_0x4460e3);logger['debug'](_0x4edc('0x20'),_0x4460e3,JSON[_0x4edc('0x13')](_0x447622));_0x6ef155(_0x447622);})[_0x4edc('0x16')](function(_0x37f27f){logger['error']('UpdateChatInteraction',_0x37f27f['message'],_0x4460e3);_0xaa6412(_0x49c652[_0x4edc('0x14')](0x1f4,_0x37f27f[_0x4edc('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x147358){return new Promise(function(_0x514c4b,_0x47b1e1){return db[_0x4edc('0x17')][_0x4edc('0x21')]({'where':_0x147358[_0x4edc('0x1a')]?_0x147358[_0x4edc('0x1a')][_0x4edc('0x1c')]||null:null})[_0x4edc('0x1f')](function(_0x5bd8c0){if(_0x5bd8c0){return _0x5bd8c0[_0x4edc('0x22')](_0x147358[_0x4edc('0x19')][_0x4edc('0x23')],_['omit'](_0x147358['body'],['ids','id'])||{});}})['spread'](function(_0x6086e4){logger['info']('AddTags',_0x147358);logger[_0x4edc('0x11')](_0x4edc('0x24'),_0x147358,JSON['stringify'](_0x6086e4));_0x514c4b(_0x6086e4);})[_0x4edc('0x16')](function(_0x4b649){logger[_0x4edc('0x14')](_0x4edc('0x24'),_0x4b649[_0x4edc('0x15')],_0x147358);_0x47b1e1(_this[_0x4edc('0x14')](0x1f4,_0x4b649[_0x4edc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 74d22ed..439535f 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 _0x4e40=['emit','removeListener','register','length','./chatInteraction.events','save','update'];(function(_0x3eaf5e,_0x3c9120){var _0x2e7aad=function(_0x493cef){while(--_0x493cef){_0x3eaf5e['push'](_0x3eaf5e['shift']());}};_0x2e7aad(++_0x3c9120);}(_0x4e40,0x1a8));var _0x04e4=function(_0x3944a9,_0x4fd80c){_0x3944a9=_0x3944a9-0x0;var _0x2f219d=_0x4e40[_0x3944a9];return _0x2f219d;};'use strict';var ChatInteractionEvents=require(_0x04e4('0x0'));var events=[_0x04e4('0x1'),'remove',_0x04e4('0x2')];function createListener(_0x5b6331,_0x4c6433){return function(_0x5d30a0){_0x4c6433[_0x04e4('0x3')](_0x5b6331,_0x5d30a0);};}function removeListener(_0x3b9914,_0x1abfb3){return function(){ChatInteractionEvents[_0x04e4('0x4')](_0x3b9914,_0x1abfb3);};}exports[_0x04e4('0x5')]=function(_0x5449cb){for(var _0x548e85=0x0,_0x3b5163=events[_0x04e4('0x6')];_0x548e85<_0x3b5163;_0x548e85++){var _0x33f304=events[_0x548e85];var _0x20cdc2=createListener('chatInteraction:'+_0x33f304,_0x5449cb);ChatInteractionEvents['on'](_0x33f304,_0x20cdc2);}}; \ No newline at end of file +var _0xf5af=['length','save','remove','emit','removeListener','register'];(function(_0x322652,_0x5a85c0){var _0x5d5e88=function(_0x5ce853){while(--_0x5ce853){_0x322652['push'](_0x322652['shift']());}};_0x5d5e88(++_0x5a85c0);}(_0xf5af,0x175));var _0xff5a=function(_0x4a1cb6,_0x2401f4){_0x4a1cb6=_0x4a1cb6-0x0;var _0x5c33cf=_0xf5af[_0x4a1cb6];return _0x5c33cf;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xff5a('0x0'),_0xff5a('0x1'),'update'];function createListener(_0x1430cc,_0x50b57e){return function(_0x13bee2){_0x50b57e[_0xff5a('0x2')](_0x1430cc,_0x13bee2);};}function removeListener(_0x19757e,_0x257f92){return function(){ChatInteractionEvents[_0xff5a('0x3')](_0x19757e,_0x257f92);};}exports[_0xff5a('0x4')]=function(_0x6d4e2c){for(var _0x10f065=0x0,_0x263053=events[_0xff5a('0x5')];_0x10f065<_0x263053;_0x10f065++){var _0x48f26c=events[_0x10f065];var _0x235f8d=createListener('chatInteraction:'+_0x48f26c,_0x6d4e2c);ChatInteractionEvents['on'](_0x48f26c,_0x235f8d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 88a6686..c108b2b 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 _0xc7dd=['server/files/attachments/','format','%s-%s','now','replace','single','file','addMessage','tracked','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chat','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc7dd,0x7d));var _0xdc7d=function(_0x12f451,_0x3b618f){_0x12f451=_0x12f451-0x0;var _0x5e9589=_0xc7dd[_0x12f451];return _0x5e9589;};'use strict';var multer=require(_0xdc7d('0x0'));var util=require(_0xdc7d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc7d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdc7d('0x3'));var interaction=require(_0xdc7d('0x4'));var config=require(_0xdc7d('0x5'));var controller=require('./chatInteraction.controller');router[_0xdc7d('0x6')]('/',auth['isAuthenticated'](),controller[_0xdc7d('0x7')]);router[_0xdc7d('0x6')](_0xdc7d('0x8'),auth[_0xdc7d('0x9')](),controller['describe']);router['get'](_0xdc7d('0xa'),auth['isChatInteractionAuthorized'](),controller[_0xdc7d('0xb')]);router['get']('/:id/attachment_download',auth[_0xdc7d('0xc')](),controller[_0xdc7d('0xd')]);router['get'](_0xdc7d('0xe'),auth[_0xdc7d('0x9')](),controller['getMessages']);router[_0xdc7d('0x6')](_0xdc7d('0xf'),auth[_0xdc7d('0xc')](),controller[_0xdc7d('0x10')]);router[_0xdc7d('0x6')](_0xdc7d('0x11'),auth[_0xdc7d('0x9')](),controller['download']);router[_0xdc7d('0x12')]('/',auth[_0xdc7d('0x9')](),controller[_0xdc7d('0x13')]);router['post'](_0xdc7d('0x14'),auth[_0xdc7d('0x9')](),controller[_0xdc7d('0x15')]);var upload=multer({'storage':multer[_0xdc7d('0x16')]({'destination':function(_0x272377,_0x512496,_0x1e3da3){_0x1e3da3(null,path[_0xdc7d('0x17')](config[_0xdc7d('0x18')],_0xdc7d('0x19')));},'filename':function(_0x4a1ac1,_0x559789,_0x4fb979){_0x4fb979(null,util[_0xdc7d('0x1a')](_0xdc7d('0x1b'),Date[_0xdc7d('0x1c')](),_0x559789['originalname'][_0xdc7d('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdc7d('0x12')]('/:id/attachment_upload',upload[_0xdc7d('0x1e')](_0xdc7d('0x1f')),controller['attachmentUpload']);router[_0xdc7d('0x12')]('/:id/messages',auth[_0xdc7d('0xc')](),controller[_0xdc7d('0x20')]);router[_0xdc7d('0x12')]('/:id/tags',auth[_0xdc7d('0x9')](),interaction[_0xdc7d('0x21')]('chat',_0xdc7d('0x22')),controller['addTags']);router[_0xdc7d('0x23')](_0xdc7d('0xa'),auth[_0xdc7d('0x9')](),interaction['tracked']('chat','chatinteraction:update'),controller[_0xdc7d('0x24')]);router['put'](_0xdc7d('0x25'),controller[_0xdc7d('0x26')]);router[_0xdc7d('0x23')](_0xdc7d('0x27'),auth[_0xdc7d('0xc')](),controller[_0xdc7d('0x28')]);router[_0xdc7d('0x23')](_0xdc7d('0x29'),controller[_0xdc7d('0x2a')]);router[_0xdc7d('0x2b')](_0xdc7d('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0xdc7d('0x2c'),_0xdc7d('0x2d')),controller[_0xdc7d('0x2e')]);router[_0xdc7d('0x2b')](_0xdc7d('0x2f'),auth['isAuthenticated'](),controller[_0xdc7d('0x30')]);module[_0xdc7d('0x31')]=router; \ No newline at end of file +var _0x7c59=['exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','now','replace','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags'];(function(_0x4ca78f,_0x127edb){var _0xe3729e=function(_0x4a79e7){while(--_0x4a79e7){_0x4ca78f['push'](_0x4ca78f['shift']());}};_0xe3729e(++_0x127edb);}(_0x7c59,0x1eb));var _0x97c5=function(_0x1eab31,_0x31fbe4){_0x1eab31=_0x1eab31-0x0;var _0x1335b7=_0x7c59[_0x1eab31];return _0x1335b7;};'use strict';var multer=require('multer');var util=require(_0x97c5('0x0'));var path=require(_0x97c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c5('0x2'));var router=express[_0x97c5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x97c5('0x4'));var interaction=require(_0x97c5('0x5'));var config=require('../../config/environment');var controller=require(_0x97c5('0x6'));router[_0x97c5('0x7')]('/',auth[_0x97c5('0x8')](),controller[_0x97c5('0x9')]);router[_0x97c5('0x7')](_0x97c5('0xa'),auth[_0x97c5('0x8')](),controller[_0x97c5('0xb')]);router[_0x97c5('0x7')](_0x97c5('0xc'),auth[_0x97c5('0xd')](),controller['show']);router[_0x97c5('0x7')](_0x97c5('0xe'),auth[_0x97c5('0xd')](),controller[_0x97c5('0xf')]);router[_0x97c5('0x7')](_0x97c5('0x10'),auth[_0x97c5('0x8')](),controller['getMessages']);router[_0x97c5('0x7')](_0x97c5('0x11'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x12')]);router[_0x97c5('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x97c5('0x13')]);router[_0x97c5('0x14')]('/',auth['isAuthenticated'](),controller[_0x97c5('0x15')]);router[_0x97c5('0x14')](_0x97c5('0x16'),auth['isAuthenticated'](),controller[_0x97c5('0x17')]);var upload=multer({'storage':multer[_0x97c5('0x18')]({'destination':function(_0x871c74,_0x43b242,_0x1b5e83){_0x1b5e83(null,path['join'](config['root'],_0x97c5('0x19')));},'filename':function(_0x366912,_0x16529c,_0x1c3c43){_0x1c3c43(null,util[_0x97c5('0x1a')]('%s-%s',Date[_0x97c5('0x1b')](),_0x16529c['originalname'][_0x97c5('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x97c5('0x1d'),upload['single'](_0x97c5('0x1e')),controller[_0x97c5('0x1f')]);router[_0x97c5('0x14')]('/:id/messages',auth[_0x97c5('0xd')](),controller['addMessage']);router[_0x97c5('0x14')](_0x97c5('0x20'),auth[_0x97c5('0x8')](),interaction[_0x97c5('0x21')](_0x97c5('0x22'),_0x97c5('0x23')),controller['addTags']);router[_0x97c5('0x24')](_0x97c5('0xc'),auth[_0x97c5('0x8')](),interaction['tracked'](_0x97c5('0x22'),_0x97c5('0x25')),controller[_0x97c5('0x26')]);router[_0x97c5('0x24')](_0x97c5('0x27'),controller[_0x97c5('0x28')]);router[_0x97c5('0x24')](_0x97c5('0x29'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x2a')]);router['put'](_0x97c5('0x2b'),controller['close']);router[_0x97c5('0x2c')](_0x97c5('0xc'),auth[_0x97c5('0x8')](),interaction[_0x97c5('0x21')](_0x97c5('0x22'),_0x97c5('0x2d')),controller[_0x97c5('0x2e')]);router[_0x97c5('0x2c')]('/:id/tags',auth[_0x97c5('0x8')](),controller[_0x97c5('0x2f')]);module[_0x97c5('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 10a3059..930edc6 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 _0x9c41=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2bc40d,_0x241a88){var _0x5d77d1=function(_0x4ad7be){while(--_0x4ad7be){_0x2bc40d['push'](_0x2bc40d['shift']());}};_0x5d77d1(++_0x241a88);}(_0x9c41,0x125));var _0x19c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c41[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x19c4('0x0'));module[_0x19c4('0x1')]={'body':{'type':Sequelize['TEXT'](_0x19c4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x19c4('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x19c4('0x4')]}}; \ No newline at end of file +var _0x9400=['sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x46d9cc,_0x4ec9ce){var _0xc70e83=function(_0x350790){while(--_0x350790){_0x46d9cc['push'](_0x46d9cc['shift']());}};_0xc70e83(++_0x4ec9ce);}(_0x9400,0x11d));var _0x0940=function(_0x4066e3,_0x3a8116){_0x4066e3=_0x4066e3-0x0;var _0x1fc542=_0x9400[_0x4066e3];return _0x1fc542;};'use strict';var Sequelize=require(_0x0940('0x0'));module[_0x0940('0x1')]={'body':{'type':Sequelize[_0x0940('0x2')](_0x0940('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0940('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5562b0f..ebe5d97 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 _0x0b53=['squel','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','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','ChatInternalMessage','rows','show','params','merge','find','catch','create','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash'];(function(_0x40d7f6,_0x489e50){var _0x2bfda6=function(_0x25af44){while(--_0x25af44){_0x40d7f6['push'](_0x40d7f6['shift']());}};_0x2bfda6(++_0x489e50);}(_0x0b53,0x1c7));var _0x30b5=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x0b53[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0x30b5('0x0'));var rimraf=require(_0x30b5('0x1'));var zipdir=require(_0x30b5('0x2'));var jsonpatch=require(_0x30b5('0x3'));var rp=require(_0x30b5('0x4'));var moment=require(_0x30b5('0x5'));var BPromise=require(_0x30b5('0x6'));var Mustache=require(_0x30b5('0x7'));var util=require('util');var path=require(_0x30b5('0x8'));var sox=require('sox');var csv=require(_0x30b5('0x9'));var ejs=require(_0x30b5('0xa'));var fs=require('fs');var fs_extra=require(_0x30b5('0xb'));var _=require(_0x30b5('0xc'));var squel=require(_0x30b5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x30b5('0xe'));var toCsv=require(_0x30b5('0x9'));var querystring=require(_0x30b5('0xf'));var Papa=require(_0x30b5('0x10'));var Redis=require(_0x30b5('0x11'));var authService=require(_0x30b5('0x12'));var qs=require(_0x30b5('0x13'));var as=require(_0x30b5('0x14'));var hardwareService=require(_0x30b5('0x15'));var logger=require(_0x30b5('0x16'))(_0x30b5('0x17'));var utils=require('../../config/utils');var config=require(_0x30b5('0x18'));var licenseUtil=require(_0x30b5('0x19'));var db=require(_0x30b5('0x1a'))['db'];config['redis']=_[_0x30b5('0x1b')](config[_0x30b5('0x1c')],{'host':_0x30b5('0x1d'),'port':0x18eb});var socket=require(_0x30b5('0x1e'))(new Redis(config['redis']));require(_0x30b5('0x1f'))[_0x30b5('0x20')](socket);function respondWithStatusCode(_0x482f79,_0x48335b){_0x48335b=_0x48335b||0xcc;return function(_0x149bc9){if(_0x149bc9){return _0x482f79[_0x30b5('0x21')](_0x48335b);}return _0x482f79[_0x30b5('0x22')](_0x48335b)[_0x30b5('0x23')]();};}function respondWithResult(_0xbd5afb,_0x3d58d0){_0x3d58d0=_0x3d58d0||0xc8;return function(_0x2edc5f){if(_0x2edc5f){return _0xbd5afb[_0x30b5('0x22')](_0x3d58d0)[_0x30b5('0x24')](_0x2edc5f);}};}function respondWithFilteredResult(_0x165b8,_0xba4f57){return function(_0x274d57){if(_0x274d57){var _0x37e461=typeof _0xba4f57[_0x30b5('0x25')]===_0x30b5('0x26')&&typeof _0xba4f57['limit']===_0x30b5('0x26');var _0x3dfbaa=_0x274d57[_0x30b5('0x27')];var _0xbf157c=_0x37e461?0x0:_0xba4f57[_0x30b5('0x25')];var _0x2e5e0e=_0x37e461?_0x274d57[_0x30b5('0x27')]:_0xba4f57['offset']+_0xba4f57[_0x30b5('0x28')];var _0x452f08;if(_0x2e5e0e>=_0x3dfbaa){_0x2e5e0e=_0x3dfbaa;_0x452f08=0xc8;}else{_0x452f08=0xce;}_0x165b8[_0x30b5('0x22')](_0x452f08);return _0x165b8[_0x30b5('0x29')](_0x30b5('0x2a'),_0xbf157c+'-'+_0x2e5e0e+'/'+_0x3dfbaa)[_0x30b5('0x24')](_0x274d57);}return null;};}function patchUpdates(_0xfae486){return function(_0x3585a6){try{jsonpatch[_0x30b5('0x2b')](_0x3585a6,_0xfae486,!![]);}catch(_0x111cc9){return BPromise[_0x30b5('0x2c')](_0x111cc9);}return _0x3585a6[_0x30b5('0x2d')]();};}function saveUpdates(_0x501963,_0x2b7a7f){return function(_0xfc778e){if(_0xfc778e){return _0xfc778e[_0x30b5('0x2e')](_0x501963)[_0x30b5('0x2f')](function(_0x4cb9bc){return _0x4cb9bc;});}return null;};}function removeEntity(_0x8a2127,_0x41bb9d){return function(_0x541a80){if(_0x541a80){return _0x541a80[_0x30b5('0x30')]()[_0x30b5('0x2f')](function(){_0x8a2127[_0x30b5('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1abcc8,_0x2e2a5d){return function(_0x2b03c5){if(!_0x2b03c5){_0x1abcc8[_0x30b5('0x21')](0x194);}return _0x2b03c5;};}function handleError(_0x37be5d,_0xa9855c){_0xa9855c=_0xa9855c||0x1f4;return function(_0x1ebca8){logger['error'](_0x1ebca8[_0x30b5('0x31')]);if(_0x1ebca8[_0x30b5('0x32')]){delete _0x1ebca8[_0x30b5('0x32')];}_0x37be5d[_0x30b5('0x22')](_0xa9855c)['send'](_0x1ebca8);};}exports[_0x30b5('0x33')]=function(_0x424931,_0x4b3c25){var _0x46f0a7={},_0x20b04b={},_0x2a3d90={'count':0x0,'rows':[]};var _0x177331=_[_0x30b5('0x34')](db['ChatInternalMessage'][_0x30b5('0x35')],function(_0x3d9841){return{'name':_0x3d9841[_0x30b5('0x36')],'type':_0x3d9841[_0x30b5('0x37')][_0x30b5('0x38')]};});_0x20b04b[_0x30b5('0x39')]=_[_0x30b5('0x34')](_0x177331,_0x30b5('0x32'));_0x20b04b[_0x30b5('0x3a')]=_[_0x30b5('0x3b')](_0x424931['query']);_0x20b04b[_0x30b5('0x3c')]=_[_0x30b5('0x3d')](_0x20b04b['model'],_0x20b04b[_0x30b5('0x3a')]);_0x46f0a7['attributes']=_[_0x30b5('0x3d')](_0x20b04b[_0x30b5('0x39')],qs[_0x30b5('0x3e')](_0x424931[_0x30b5('0x3a')][_0x30b5('0x3e')]));_0x46f0a7[_0x30b5('0x3f')]=_0x46f0a7[_0x30b5('0x3f')][_0x30b5('0x40')]?_0x46f0a7[_0x30b5('0x3f')]:_0x20b04b[_0x30b5('0x39')];if(!_0x424931[_0x30b5('0x3a')]['hasOwnProperty'](_0x30b5('0x41'))){_0x46f0a7[_0x30b5('0x28')]=qs[_0x30b5('0x28')](_0x424931[_0x30b5('0x3a')][_0x30b5('0x28')]);_0x46f0a7[_0x30b5('0x25')]=qs[_0x30b5('0x25')](_0x424931[_0x30b5('0x3a')]['offset']);}_0x46f0a7[_0x30b5('0x42')]=qs[_0x30b5('0x43')](_0x424931[_0x30b5('0x3a')][_0x30b5('0x43')]);_0x46f0a7['where']=qs[_0x30b5('0x3c')](_[_0x30b5('0x44')](_0x424931[_0x30b5('0x3a')],_0x20b04b['filters']),_0x177331);if(_0x424931['query'][_0x30b5('0x45')]){_0x46f0a7['where']=_['merge'](_0x46f0a7[_0x30b5('0x46')],{'$or':_[_0x30b5('0x34')](_0x177331,function(_0x1dc443){if(_0x1dc443[_0x30b5('0x37')]!==_0x30b5('0x47')){var _0x40e174={};_0x40e174[_0x1dc443['name']]={'$like':'%'+_0x424931[_0x30b5('0x3a')][_0x30b5('0x45')]+'%'};return _0x40e174;}})});}_0x46f0a7=_['merge']({},_0x46f0a7,_0x424931[_0x30b5('0x48')]);var _0x5b9c3c={'where':_0x46f0a7[_0x30b5('0x46')]};return db['ChatInternalMessage'][_0x30b5('0x27')](_0x5b9c3c)[_0x30b5('0x2f')](function(_0x54434d){_0x2a3d90[_0x30b5('0x27')]=_0x54434d;if(_0x424931[_0x30b5('0x3a')][_0x30b5('0x49')]){_0x46f0a7[_0x30b5('0x4a')]=[{'all':!![]}];}return db[_0x30b5('0x4b')]['findAll'](_0x46f0a7);})[_0x30b5('0x2f')](function(_0x2ad42a){_0x2a3d90[_0x30b5('0x4c')]=_0x2ad42a;return _0x2a3d90;})[_0x30b5('0x2f')](respondWithFilteredResult(_0x4b3c25,_0x46f0a7))['catch'](handleError(_0x4b3c25,null));};exports[_0x30b5('0x4d')]=function(_0x4dbc5b,_0x20ecc6){var _0x11026e={'raw':!![],'where':{'id':_0x4dbc5b[_0x30b5('0x4e')]['id']}},_0x2b02e0={};_0x2b02e0[_0x30b5('0x39')]=_[_0x30b5('0x3b')](db[_0x30b5('0x4b')]['rawAttributes']);_0x2b02e0['query']=_[_0x30b5('0x3b')](_0x4dbc5b[_0x30b5('0x3a')]);_0x2b02e0['filters']=_[_0x30b5('0x3d')](_0x2b02e0[_0x30b5('0x39')],_0x2b02e0[_0x30b5('0x3a')]);_0x11026e[_0x30b5('0x3f')]=_[_0x30b5('0x3d')](_0x2b02e0[_0x30b5('0x39')],qs[_0x30b5('0x3e')](_0x4dbc5b[_0x30b5('0x3a')][_0x30b5('0x3e')]));_0x11026e[_0x30b5('0x3f')]=_0x11026e[_0x30b5('0x3f')][_0x30b5('0x40')]?_0x11026e['attributes']:_0x2b02e0['model'];if(_0x4dbc5b[_0x30b5('0x3a')][_0x30b5('0x49')]){_0x11026e[_0x30b5('0x4a')]=[{'all':!![]}];}_0x11026e=_[_0x30b5('0x4f')]({},_0x11026e,_0x4dbc5b[_0x30b5('0x48')]);return db[_0x30b5('0x4b')][_0x30b5('0x50')](_0x11026e)['then'](handleEntityNotFound(_0x20ecc6,null))[_0x30b5('0x2f')](respondWithResult(_0x20ecc6,null))[_0x30b5('0x51')](handleError(_0x20ecc6,null));};exports[_0x30b5('0x52')]=function(_0x49a07a,_0x2d798f){return db[_0x30b5('0x4b')][_0x30b5('0x52')](_0x49a07a[_0x30b5('0x53')],{})[_0x30b5('0x2f')](respondWithResult(_0x2d798f,0xc9))[_0x30b5('0x51')](handleError(_0x2d798f,null));};exports['update']=function(_0x201388,_0x4bfaed){if(_0x201388[_0x30b5('0x53')]['id']){delete _0x201388[_0x30b5('0x53')]['id'];}return db[_0x30b5('0x4b')]['find']({'where':{'id':_0x201388[_0x30b5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4bfaed,null))[_0x30b5('0x2f')](saveUpdates(_0x201388[_0x30b5('0x53')],null))['then'](respondWithResult(_0x4bfaed,null))['catch'](handleError(_0x4bfaed,null));};exports[_0x30b5('0x30')]=function(_0x32055c,_0x3cb333){return db['ChatInternalMessage'][_0x30b5('0x50')]({'where':{'id':_0x32055c['params']['id']}})[_0x30b5('0x2f')](handleEntityNotFound(_0x3cb333,null))[_0x30b5('0x2f')](removeEntity(_0x3cb333,null))[_0x30b5('0x51')](handleError(_0x3cb333,null));};exports[_0x30b5('0x54')]=function(_0x4c9acc,_0x5762fa){return db[_0x30b5('0x4b')]['describe']()[_0x30b5('0x2f')](respondWithResult(_0x5762fa,null))['catch'](handleError(_0x5762fa,null));};function wrapUser(_0x515a49){return function(_0x45d2e5){var _0x17620c=_0x515a49[_0x30b5('0x55')]({'plain':!![]});_0x17620c[_0x30b5('0x56')]=[];if(_0x45d2e5){_0x17620c['lastMessageAt']=_0x45d2e5[_0x30b5('0x57')];_0x17620c[_0x30b5('0x58')]=_0x45d2e5;}else{_0x17620c[_0x30b5('0x59')]=moment(0x0)[_0x30b5('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x17620c[_0x30b5('0x58')]={};}return _0x17620c;};}exports[_0x30b5('0x5b')]=function(_0x48bfbc,_0x5e9b85,_0x2e9c14){var _0x127ee7=[];return db[_0x30b5('0x5c')][_0x30b5('0x5d')]({'where':{'role':[_0x30b5('0x5e'),_0x30b5('0x5f'),_0x30b5('0x60')]},'attributes':['id',_0x30b5('0x61'),_0x30b5('0x32'),_0x30b5('0x62'),_0x30b5('0x63'),'internal',_0x30b5('0x64'),_0x30b5('0x65'),_0x30b5('0x66'),'showWebBar'],'order':qs[_0x30b5('0x43')]('-online'),'include':[{'model':db[_0x30b5('0x67')],'as':_0x30b5('0x68'),'attributes':['id',_0x30b5('0x32'),_0x30b5('0x37')],'through':{'attributes':[]}}]})['then'](function(_0x4e9c4f){if(_0x4e9c4f){var _0x586ff6=_0x48bfbc['user'][_0x30b5('0x55')]({'plain':!![]});if(!_0x586ff6)throw new Error(_0x30b5('0x69'));if(_0x586ff6[_0x30b5('0x62')]===_0x30b5('0x60')){return db[_0x30b5('0x6a')][_0x30b5('0x50')]({'where':{'name':'Agents','userProfileId':_0x586ff6[_0x30b5('0x6b')]},'raw':!![]})[_0x30b5('0x2f')](function(_0x37b7e8){if(_0x37b7e8){if(_0x37b7e8[_0x30b5('0x6c')]===0x0){return db['UserProfileResource'][_0x30b5('0x5d')]({'where':{'sectionId':_0x37b7e8['id']},'raw':!![]})[_0x30b5('0x2f')](function(_0x46c11a){var _0x205eeb=[];if(_[_0x30b5('0x6d')](_0x46c11a)){_0x205eeb=_[_0x30b5('0x45')](_0x4e9c4f,function(_0x135800){if(_0x135800[_0x30b5('0x62')]!==_0x30b5('0x5e')){return _0x135800;}});return _0x205eeb;}else{for(var _0x54a988=0x0;_0x54a988<_0x4e9c4f[_0x30b5('0x40')];_0x54a988++){var _0x3fa41e=_0x4e9c4f[_0x54a988];if(_0x3fa41e[_0x30b5('0x62')]===_0x30b5('0x5e')){var _0x184826=_[_0x30b5('0x50')](_0x46c11a,function(_0x4b900d){return _0x4b900d[_0x30b5('0x6e')]===_0x3fa41e['id'];});if(_0x184826)_0x205eeb['push'](_0x3fa41e);}else{_0x205eeb[_0x30b5('0x6f')](_0x3fa41e);}}return _0x205eeb;}});}else{return _0x4e9c4f;}}else{var _0x1713e0=_[_0x30b5('0x45')](_0x4e9c4f,function(_0xda44f8){if(_0xda44f8[_0x30b5('0x62')]!==_0x30b5('0x5e')){return _0xda44f8;}});return _0x1713e0;}});}else{return _0x4e9c4f;}}})[_0x30b5('0x2f')](function(_0x47802d){var _0x159b5f=[];if(_0x47802d){_0x127ee7=_0x47802d;for(var _0x1026ce=0x0;_0x1026ce<_0x47802d[_0x30b5('0x40')];_0x1026ce+=0x1){_0x127ee7[_0x1026ce][_0x30b5('0x56')]=[];_0x159b5f[_0x30b5('0x6f')](db[_0x30b5('0x4b')][_0x30b5('0x50')]({'where':{'FromId':[_0x48bfbc['user']['id'],_0x47802d[_0x1026ce]['id']],'ToId':[_0x48bfbc[_0x30b5('0x60')]['id'],_0x47802d[_0x1026ce]['id']],'ChatGroupId':null},'attributes':['id',_0x30b5('0x57'),_0x30b5('0x70'),_0x30b5('0x71'),_0x30b5('0x72'),_0x30b5('0x53')],'order':qs[_0x30b5('0x43')](_0x30b5('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x30b5('0x2f')](wrapUser(_0x47802d[_0x1026ce])));}return BPromise[_0x30b5('0x74')](_0x159b5f);}return[];})[_0x30b5('0x2f')](function(_0x3cde6a){return{'rows':_0x3cde6a,'count':_0x3cde6a[_0x30b5('0x40')]};})[_0x30b5('0x2f')](respondWithResult(_0x5e9b85,null))[_0x30b5('0x51')](handleError(_0x5e9b85,null));}; \ No newline at end of file +var _0x2f54=['count','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','resourceId','FromId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','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','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x420eb0,_0x1fb312){var _0x5d80a5=function(_0x224e84){while(--_0x224e84){_0x420eb0['push'](_0x420eb0['shift']());}};_0x5d80a5(++_0x1fb312);}(_0x2f54,0x1f3));var _0x42f5=function(_0x4482af,_0x2df282){_0x4482af=_0x4482af-0x0;var _0x1874e5=_0x2f54[_0x4482af];return _0x1874e5;};'use strict';var emlformat=require(_0x42f5('0x0'));var rimraf=require(_0x42f5('0x1'));var zipdir=require(_0x42f5('0x2'));var jsonpatch=require(_0x42f5('0x3'));var rp=require(_0x42f5('0x4'));var moment=require('moment');var BPromise=require(_0x42f5('0x5'));var Mustache=require('mustache');var util=require(_0x42f5('0x6'));var path=require('path');var sox=require(_0x42f5('0x7'));var csv=require(_0x42f5('0x8'));var ejs=require(_0x42f5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x42f5('0xa'));var jsforce=require(_0x42f5('0xb'));var deskjs=require(_0x42f5('0xc'));var toCsv=require(_0x42f5('0x8'));var querystring=require(_0x42f5('0xd'));var Papa=require(_0x42f5('0xe'));var Redis=require(_0x42f5('0xf'));var authService=require(_0x42f5('0x10'));var qs=require(_0x42f5('0x11'));var as=require(_0x42f5('0x12'));var hardwareService=require(_0x42f5('0x13'));var logger=require(_0x42f5('0x14'))(_0x42f5('0x15'));var utils=require(_0x42f5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x42f5('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x42f5('0x18')](config[_0x42f5('0x19')],{'host':_0x42f5('0x1a'),'port':0x18eb});var socket=require(_0x42f5('0x1b'))(new Redis(config[_0x42f5('0x19')]));require(_0x42f5('0x1c'))[_0x42f5('0x1d')](socket);function respondWithStatusCode(_0x522284,_0x29b176){_0x29b176=_0x29b176||0xcc;return function(_0x486342){if(_0x486342){return _0x522284[_0x42f5('0x1e')](_0x29b176);}return _0x522284['status'](_0x29b176)['end']();};}function respondWithResult(_0x29c00e,_0x4a4c50){_0x4a4c50=_0x4a4c50||0xc8;return function(_0x96701e){if(_0x96701e){return _0x29c00e[_0x42f5('0x1f')](_0x4a4c50)[_0x42f5('0x20')](_0x96701e);}};}function respondWithFilteredResult(_0x144675,_0xfa92ba){return function(_0x2c2387){if(_0x2c2387){var _0x5879ae=typeof _0xfa92ba[_0x42f5('0x21')]==='undefined'&&typeof _0xfa92ba['limit']==='undefined';var _0x220104=_0x2c2387['count'];var _0x2c5ec1=_0x5879ae?0x0:_0xfa92ba['offset'];var _0x1b67a7=_0x5879ae?_0x2c2387['count']:_0xfa92ba[_0x42f5('0x21')]+_0xfa92ba[_0x42f5('0x22')];var _0xf6ecff;if(_0x1b67a7>=_0x220104){_0x1b67a7=_0x220104;_0xf6ecff=0xc8;}else{_0xf6ecff=0xce;}_0x144675['status'](_0xf6ecff);return _0x144675[_0x42f5('0x23')]('Content-Range',_0x2c5ec1+'-'+_0x1b67a7+'/'+_0x220104)[_0x42f5('0x20')](_0x2c2387);}return null;};}function patchUpdates(_0x411279){return function(_0x201d15){try{jsonpatch[_0x42f5('0x24')](_0x201d15,_0x411279,!![]);}catch(_0x5cd647){return BPromise[_0x42f5('0x25')](_0x5cd647);}return _0x201d15[_0x42f5('0x26')]();};}function saveUpdates(_0xc91c7f,_0x55367c){return function(_0x6fcd13){if(_0x6fcd13){return _0x6fcd13[_0x42f5('0x27')](_0xc91c7f)['then'](function(_0x5af1e1){return _0x5af1e1;});}return null;};}function removeEntity(_0x2b8ce9,_0x34c607){return function(_0x2868b6){if(_0x2868b6){return _0x2868b6[_0x42f5('0x28')]()[_0x42f5('0x29')](function(){_0x2b8ce9[_0x42f5('0x1f')](0xcc)[_0x42f5('0x2a')]();});}};}function handleEntityNotFound(_0x1afb9f,_0x49651a){return function(_0x3fbca3){if(!_0x3fbca3){_0x1afb9f[_0x42f5('0x1e')](0x194);}return _0x3fbca3;};}function handleError(_0x5c5ba5,_0x191a95){_0x191a95=_0x191a95||0x1f4;return function(_0x5c07fa){logger['error'](_0x5c07fa[_0x42f5('0x2b')]);if(_0x5c07fa[_0x42f5('0x2c')]){delete _0x5c07fa[_0x42f5('0x2c')];}_0x5c5ba5[_0x42f5('0x1f')](_0x191a95)[_0x42f5('0x2d')](_0x5c07fa);};}exports[_0x42f5('0x2e')]=function(_0x571bd3,_0x57b1ce){var _0x31c055={},_0xbee25={},_0x5b5d66={'count':0x0,'rows':[]};var _0x2a0763=_[_0x42f5('0x2f')](db[_0x42f5('0x30')][_0x42f5('0x31')],function(_0xba9b3d){return{'name':_0xba9b3d['fieldName'],'type':_0xba9b3d[_0x42f5('0x32')][_0x42f5('0x33')]};});_0xbee25[_0x42f5('0x34')]=_[_0x42f5('0x2f')](_0x2a0763,_0x42f5('0x2c'));_0xbee25[_0x42f5('0x35')]=_['keys'](_0x571bd3[_0x42f5('0x35')]);_0xbee25[_0x42f5('0x36')]=_[_0x42f5('0x37')](_0xbee25[_0x42f5('0x34')],_0xbee25[_0x42f5('0x35')]);_0x31c055[_0x42f5('0x38')]=_['intersection'](_0xbee25['model'],qs[_0x42f5('0x39')](_0x571bd3[_0x42f5('0x35')]['fields']));_0x31c055[_0x42f5('0x38')]=_0x31c055['attributes']['length']?_0x31c055[_0x42f5('0x38')]:_0xbee25[_0x42f5('0x34')];if(!_0x571bd3[_0x42f5('0x35')][_0x42f5('0x3a')]('nolimit')){_0x31c055[_0x42f5('0x22')]=qs[_0x42f5('0x22')](_0x571bd3[_0x42f5('0x35')][_0x42f5('0x22')]);_0x31c055[_0x42f5('0x21')]=qs[_0x42f5('0x21')](_0x571bd3[_0x42f5('0x35')][_0x42f5('0x21')]);}_0x31c055[_0x42f5('0x3b')]=qs[_0x42f5('0x3c')](_0x571bd3[_0x42f5('0x35')]['sort']);_0x31c055[_0x42f5('0x3d')]=qs[_0x42f5('0x36')](_[_0x42f5('0x3e')](_0x571bd3[_0x42f5('0x35')],_0xbee25['filters']),_0x2a0763);if(_0x571bd3[_0x42f5('0x35')][_0x42f5('0x3f')]){_0x31c055['where']=_[_0x42f5('0x40')](_0x31c055[_0x42f5('0x3d')],{'$or':_[_0x42f5('0x2f')](_0x2a0763,function(_0x9520a0){if(_0x9520a0[_0x42f5('0x32')]!==_0x42f5('0x41')){var _0xf0107e={};_0xf0107e[_0x9520a0[_0x42f5('0x2c')]]={'$like':'%'+_0x571bd3['query'][_0x42f5('0x3f')]+'%'};return _0xf0107e;}})});}_0x31c055=_[_0x42f5('0x40')]({},_0x31c055,_0x571bd3['options']);var _0x59b313={'where':_0x31c055[_0x42f5('0x3d')]};return db[_0x42f5('0x30')][_0x42f5('0x42')](_0x59b313)['then'](function(_0x16604c){_0x5b5d66[_0x42f5('0x42')]=_0x16604c;if(_0x571bd3[_0x42f5('0x35')][_0x42f5('0x43')]){_0x31c055[_0x42f5('0x44')]=[{'all':!![]}];}return db[_0x42f5('0x30')][_0x42f5('0x45')](_0x31c055);})['then'](function(_0x2727d1){_0x5b5d66['rows']=_0x2727d1;return _0x5b5d66;})[_0x42f5('0x29')](respondWithFilteredResult(_0x57b1ce,_0x31c055))[_0x42f5('0x46')](handleError(_0x57b1ce,null));};exports[_0x42f5('0x47')]=function(_0x4d8161,_0x352e62){var _0x354f7c={'raw':!![],'where':{'id':_0x4d8161[_0x42f5('0x48')]['id']}},_0x547c14={};_0x547c14[_0x42f5('0x34')]=_[_0x42f5('0x49')](db['ChatInternalMessage'][_0x42f5('0x31')]);_0x547c14[_0x42f5('0x35')]=_[_0x42f5('0x49')](_0x4d8161[_0x42f5('0x35')]);_0x547c14[_0x42f5('0x36')]=_[_0x42f5('0x37')](_0x547c14['model'],_0x547c14[_0x42f5('0x35')]);_0x354f7c[_0x42f5('0x38')]=_[_0x42f5('0x37')](_0x547c14[_0x42f5('0x34')],qs['fields'](_0x4d8161[_0x42f5('0x35')][_0x42f5('0x39')]));_0x354f7c['attributes']=_0x354f7c[_0x42f5('0x38')]['length']?_0x354f7c[_0x42f5('0x38')]:_0x547c14[_0x42f5('0x34')];if(_0x4d8161['query'][_0x42f5('0x43')]){_0x354f7c[_0x42f5('0x44')]=[{'all':!![]}];}_0x354f7c=_[_0x42f5('0x40')]({},_0x354f7c,_0x4d8161[_0x42f5('0x4a')]);return db[_0x42f5('0x30')][_0x42f5('0x4b')](_0x354f7c)['then'](handleEntityNotFound(_0x352e62,null))['then'](respondWithResult(_0x352e62,null))[_0x42f5('0x46')](handleError(_0x352e62,null));};exports['create']=function(_0x8d035c,_0x25e3a8){return db[_0x42f5('0x30')][_0x42f5('0x4c')](_0x8d035c[_0x42f5('0x4d')],{})['then'](respondWithResult(_0x25e3a8,0xc9))[_0x42f5('0x46')](handleError(_0x25e3a8,null));};exports[_0x42f5('0x27')]=function(_0x4e388f,_0x5be7fd){if(_0x4e388f[_0x42f5('0x4d')]['id']){delete _0x4e388f['body']['id'];}return db[_0x42f5('0x30')][_0x42f5('0x4b')]({'where':{'id':_0x4e388f[_0x42f5('0x48')]['id']}})['then'](handleEntityNotFound(_0x5be7fd,null))[_0x42f5('0x29')](saveUpdates(_0x4e388f[_0x42f5('0x4d')],null))['then'](respondWithResult(_0x5be7fd,null))[_0x42f5('0x46')](handleError(_0x5be7fd,null));};exports[_0x42f5('0x28')]=function(_0x172044,_0x2d5664){return db[_0x42f5('0x30')][_0x42f5('0x4b')]({'where':{'id':_0x172044[_0x42f5('0x48')]['id']}})[_0x42f5('0x29')](handleEntityNotFound(_0x2d5664,null))['then'](removeEntity(_0x2d5664,null))['catch'](handleError(_0x2d5664,null));};exports[_0x42f5('0x4e')]=function(_0x411526,_0x2874f4){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x2874f4,null))[_0x42f5('0x46')](handleError(_0x2874f4,null));};function wrapUser(_0x143fcb){return function(_0x25ea77){var _0x55b92a=_0x143fcb[_0x42f5('0x4f')]({'plain':!![]});_0x55b92a[_0x42f5('0x50')]=[];if(_0x25ea77){_0x55b92a[_0x42f5('0x51')]=_0x25ea77[_0x42f5('0x52')];_0x55b92a[_0x42f5('0x53')]=_0x25ea77;}else{_0x55b92a[_0x42f5('0x51')]=moment(0x0)['format'](_0x42f5('0x54'));_0x55b92a['lastMessage']={};}return _0x55b92a;};}exports[_0x42f5('0x55')]=function(_0x47bba6,_0x2c1542,_0x1acfca){var _0x1562c7=[];return db[_0x42f5('0x56')][_0x42f5('0x45')]({'where':{'role':[_0x42f5('0x57'),_0x42f5('0x58'),'user']},'attributes':['id',_0x42f5('0x59'),_0x42f5('0x2c'),_0x42f5('0x5a'),_0x42f5('0x5b'),_0x42f5('0x5c'),_0x42f5('0x5d'),_0x42f5('0x5e'),_0x42f5('0x5f'),_0x42f5('0x60')],'order':qs[_0x42f5('0x3c')](_0x42f5('0x61')),'include':[{'model':db[_0x42f5('0x62')],'as':_0x42f5('0x63'),'attributes':['id',_0x42f5('0x2c'),_0x42f5('0x32')],'through':{'attributes':[]}}]})[_0x42f5('0x29')](function(_0x2f5ee1){if(_0x2f5ee1){var _0x4ab09a=_0x47bba6[_0x42f5('0x64')][_0x42f5('0x4f')]({'plain':!![]});if(!_0x4ab09a)throw new Error(_0x42f5('0x65'));if(_0x4ab09a[_0x42f5('0x5a')]===_0x42f5('0x64')){return db[_0x42f5('0x66')][_0x42f5('0x4b')]({'where':{'name':_0x42f5('0x67'),'userProfileId':_0x4ab09a[_0x42f5('0x68')]},'raw':!![]})[_0x42f5('0x29')](function(_0x18e6b4){if(_0x18e6b4){if(_0x18e6b4[_0x42f5('0x69')]===0x0){return db[_0x42f5('0x6a')][_0x42f5('0x45')]({'where':{'sectionId':_0x18e6b4['id']},'raw':!![]})[_0x42f5('0x29')](function(_0x4eac96){var _0x40f2f6=[];if(_[_0x42f5('0x6b')](_0x4eac96)){_0x40f2f6=_[_0x42f5('0x3f')](_0x2f5ee1,function(_0x537bad){if(_0x537bad[_0x42f5('0x5a')]!=='agent'){return _0x537bad;}});return _0x40f2f6;}else{for(var _0x1975dd=0x0;_0x1975dd<_0x2f5ee1[_0x42f5('0x6c')];_0x1975dd++){var _0x1a7970=_0x2f5ee1[_0x1975dd];if(_0x1a7970['role']==='agent'){var _0x4753c2=_[_0x42f5('0x4b')](_0x4eac96,function(_0x14aec7){return _0x14aec7[_0x42f5('0x6d')]===_0x1a7970['id'];});if(_0x4753c2)_0x40f2f6['push'](_0x1a7970);}else{_0x40f2f6['push'](_0x1a7970);}}return _0x40f2f6;}});}else{return _0x2f5ee1;}}else{var _0x5eb00e=_[_0x42f5('0x3f')](_0x2f5ee1,function(_0x5256d0){if(_0x5256d0[_0x42f5('0x5a')]!==_0x42f5('0x57')){return _0x5256d0;}});return _0x5eb00e;}});}else{return _0x2f5ee1;}}})['then'](function(_0x3bb734){var _0x363fb7=[];if(_0x3bb734){_0x1562c7=_0x3bb734;for(var _0x2ba29c=0x0;_0x2ba29c<_0x3bb734['length'];_0x2ba29c+=0x1){_0x1562c7[_0x2ba29c]['messages']=[];_0x363fb7['push'](db['ChatInternalMessage'][_0x42f5('0x4b')]({'where':{'FromId':[_0x47bba6[_0x42f5('0x64')]['id'],_0x3bb734[_0x2ba29c]['id']],'ToId':[_0x47bba6[_0x42f5('0x64')]['id'],_0x3bb734[_0x2ba29c]['id']],'ChatGroupId':null},'attributes':['id',_0x42f5('0x52'),_0x42f5('0x6e'),'ToId',_0x42f5('0x6f'),_0x42f5('0x4d')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x42f5('0x29')](wrapUser(_0x3bb734[_0x2ba29c])));}return BPromise[_0x42f5('0x70')](_0x363fb7);}return[];})[_0x42f5('0x29')](function(_0x10cf1f){return{'rows':_0x10cf1f,'count':_0x10cf1f[_0x42f5('0x6c')]};})[_0x42f5('0x29')](respondWithResult(_0x2c1542,null))[_0x42f5('0x46')](handleError(_0x2c1542,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 29806de..4d5cc3d 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 _0xb672=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb672,0x1a2));var _0x2b67=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb672[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x2b67('0x0'));var ChatInternalMessage=require(_0x2b67('0x1'))['db'][_0x2b67('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2b67('0x3')](0x0);var events={'afterCreate':_0x2b67('0x4'),'afterUpdate':_0x2b67('0x5'),'afterDestroy':_0x2b67('0x6')};function emitEvent(_0x21f086){return function(_0x12afb0,_0x10d4c7,_0x530d41){ChatInternalMessageEvents[_0x2b67('0x7')](_0x21f086+':'+_0x12afb0['id'],_0x12afb0);ChatInternalMessageEvents[_0x2b67('0x7')](_0x21f086,_0x12afb0);_0x530d41(null);};}for(var e in events){if(events[_0x2b67('0x8')](e)){var event=events[e];ChatInternalMessage[_0x2b67('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x5f7b=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x3b5d45,_0x597509){var _0x3cbc78=function(_0x667d99){while(--_0x667d99){_0x3b5d45['push'](_0x3b5d45['shift']());}};_0x3cbc78(++_0x597509);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x5f7b[_0x3070dc];return _0x431489;};'use strict';var EventEmitter=require(_0xb5f7('0x0'));var ChatInternalMessage=require(_0xb5f7('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb5f7('0x2')](0x0);var events={'afterCreate':_0xb5f7('0x3'),'afterUpdate':_0xb5f7('0x4'),'afterDestroy':_0xb5f7('0x5')};function emitEvent(_0xf4fd79){return function(_0x42baf5,_0x29396c,_0x5f3190){ChatInternalMessageEvents[_0xb5f7('0x6')](_0xf4fd79+':'+_0x42baf5['id'],_0x42baf5);ChatInternalMessageEvents['emit'](_0xf4fd79,_0x42baf5);_0x5f3190(null);};}for(var e in events){if(events[_0xb5f7('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb5f7('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4c7400b..3fde13e 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 _0x6c5f=['utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4'];(function(_0x42a44a,_0x15ca12){var _0x1e6ab6=function(_0x5c5a3f){while(--_0x5c5a3f){_0x42a44a['push'](_0x42a44a['shift']());}};_0x1e6ab6(++_0x15ca12);}(_0x6c5f,0x17a));var _0xf6c5=function(_0x2a91f5,_0x3aa32c){_0x2a91f5=_0x2a91f5-0x0;var _0x37c730=_0x6c5f[_0x2a91f5];return _0x37c730;};'use strict';var _=require('lodash');var util=require(_0xf6c5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf6c5('0x1'));var BPromise=require(_0xf6c5('0x2'));var rp=require(_0xf6c5('0x3'));var fs=require('fs');var path=require(_0xf6c5('0x4'));var rimraf=require(_0xf6c5('0x5'));var config=require(_0xf6c5('0x6'));var attributes=require(_0xf6c5('0x7'));module[_0xf6c5('0x8')]=function(_0x92d87e,_0x193234){return _0x92d87e[_0xf6c5('0x9')](_0xf6c5('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6c5('0xb'),'collate':_0xf6c5('0xc')});}; \ No newline at end of file +var _0xf264=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x30f3b2,_0x1cb187){var _0x617eea=function(_0x5bb435){while(--_0x5bb435){_0x30f3b2['push'](_0x30f3b2['shift']());}};_0x617eea(++_0x1cb187);}(_0xf264,0xc1));var _0x4f26=function(_0x38c8e6,_0x2ef09c){_0x38c8e6=_0x38c8e6-0x0;var _0x29dc53=_0xf264[_0x38c8e6];return _0x29dc53;};'use strict';var _=require(_0x4f26('0x0'));var util=require(_0x4f26('0x1'));var logger=require(_0x4f26('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f26('0x3'));var rp=require(_0x4f26('0x4'));var fs=require('fs');var path=require(_0x4f26('0x5'));var rimraf=require('rimraf');var config=require(_0x4f26('0x6'));var attributes=require(_0x4f26('0x7'));module['exports']=function(_0x442fb9,_0x3242a7){return _0x442fb9[_0x4f26('0x8')](_0x4f26('0x9'),attributes,{'tableName':_0x4f26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4f26('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9479b09..a51e91d 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 _0x6841=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','register','request','then','info'];(function(_0x555e03,_0x2ff54f){var _0x2336ac=function(_0xeac734){while(--_0xeac734){_0x555e03['push'](_0x555e03['shift']());}};_0x2336ac(++_0x2ff54f);}(_0x6841,0xc6));var _0x1684=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x6841[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x1684('0x0'));var util=require(_0x1684('0x1'));var moment=require(_0x1684('0x2'));var BPromise=require(_0x1684('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1684('0x4'));var db=require(_0x1684('0x5'))['db'];var utils=require(_0x1684('0x6'));var logger=require(_0x1684('0x7'))(_0x1684('0x8'));var config=require(_0x1684('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1684('0xa')]['http']({'port':0x232a});config[_0x1684('0xb')]=_[_0x1684('0xc')](config['redis'],{'host':_0x1684('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1684('0xb')]));require('./chatInternalMessage.socket')[_0x1684('0xe')](socket);function respondWithRpcPromise(_0x296cbb,_0x3b624a,_0x37408f){return new BPromise(function(_0x276484,_0x1d7286){return client[_0x1684('0xf')](_0x296cbb,_0x37408f)[_0x1684('0x10')](function(_0x24fe97){logger[_0x1684('0x11')](_0x1684('0x12'),_0x3b624a,_0x1684('0x13'));logger[_0x1684('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3b624a,_0x1684('0x13'),JSON[_0x1684('0x15')](_0x24fe97));if(_0x24fe97[_0x1684('0x16')]){if(_0x24fe97[_0x1684('0x16')][_0x1684('0x17')]===0x1f4){logger[_0x1684('0x16')](_0x1684('0x12'),_0x3b624a,_0x24fe97[_0x1684('0x16')][_0x1684('0x18')]);return _0x1d7286(_0x24fe97[_0x1684('0x16')]['message']);}logger[_0x1684('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x3b624a,_0x24fe97[_0x1684('0x16')][_0x1684('0x18')]);return _0x276484(_0x24fe97[_0x1684('0x16')]['message']);}else{logger[_0x1684('0x11')](_0x1684('0x12'),_0x3b624a,_0x1684('0x13'));_0x276484(_0x24fe97[_0x1684('0x19')][_0x1684('0x18')]);}})[_0x1684('0x1a')](function(_0x2f348a){logger[_0x1684('0x16')](_0x1684('0x12'),_0x3b624a,_0x2f348a);_0x1d7286(_0x2f348a);});});} \ No newline at end of file +var _0x1da1=['localhost','./chatInternalMessage.socket','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x4368da,_0x4fb9a3){var _0x415dfc=function(_0x5e0e48){while(--_0x5e0e48){_0x4368da['push'](_0x4368da['shift']());}};_0x415dfc(++_0x4fb9a3);}(_0x1da1,0x1a4));var _0x11da=function(_0x311ada,_0xee7f0b){_0x311ada=_0x311ada-0x0;var _0x448d19=_0x1da1[_0x311ada];return _0x448d19;};'use strict';var _=require(_0x11da('0x0'));var util=require(_0x11da('0x1'));var moment=require(_0x11da('0x2'));var BPromise=require(_0x11da('0x3'));var rs=require(_0x11da('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11da('0x5'));var logger=require(_0x11da('0x6'))(_0x11da('0x7'));var config=require('../../config/environment');var jayson=require(_0x11da('0x8'));var client=jayson[_0x11da('0x9')][_0x11da('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x11da('0xb')],{'host':_0x11da('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11da('0xb')]));require(_0x11da('0xd'))['register'](socket);function respondWithRpcPromise(_0xece2e9,_0xd8df99,_0x3768d7){return new BPromise(function(_0x2848d3,_0x419fc6){return client[_0x11da('0xe')](_0xece2e9,_0x3768d7)[_0x11da('0xf')](function(_0x392c37){logger[_0x11da('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0xd8df99,_0x11da('0x11'));logger[_0x11da('0x12')](_0x11da('0x13'),_0xd8df99,_0x11da('0x11'),JSON[_0x11da('0x14')](_0x392c37));if(_0x392c37['error']){if(_0x392c37[_0x11da('0x15')][_0x11da('0x16')]===0x1f4){logger[_0x11da('0x15')](_0x11da('0x17'),_0xd8df99,_0x392c37[_0x11da('0x15')]['message']);return _0x419fc6(_0x392c37[_0x11da('0x15')]['message']);}logger[_0x11da('0x15')](_0x11da('0x17'),_0xd8df99,_0x392c37[_0x11da('0x15')][_0x11da('0x18')]);return _0x2848d3(_0x392c37[_0x11da('0x15')][_0x11da('0x18')]);}else{logger[_0x11da('0x10')](_0x11da('0x17'),_0xd8df99,_0x11da('0x11'));_0x2848d3(_0x392c37[_0x11da('0x19')][_0x11da('0x18')]);}})[_0x11da('0x1a')](function(_0x4c4cc6){logger[_0x11da('0x15')](_0x11da('0x17'),_0xd8df99,_0x4c4cc6);_0x419fc6(_0x4c4cc6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ae20e2c..b2eaed9 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 _0x8a36=['update','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x15a83d,_0xb6113c){var _0x1e083d=function(_0x556957){while(--_0x556957){_0x15a83d['push'](_0x15a83d['shift']());}};_0x1e083d(++_0xb6113c);}(_0x8a36,0x9e));var _0x68a3=function(_0x23d16b,_0x4a0b80){_0x23d16b=_0x23d16b-0x0;var _0x2c00f9=_0x8a36[_0x23d16b];return _0x2c00f9;};'use strict';var ChatInternalMessageEvents=require(_0x68a3('0x0'));var events=['save',_0x68a3('0x1'),_0x68a3('0x2')];function createListener(_0x442104,_0x498f6b){return function(_0x1eb8d6){_0x498f6b['emit'](_0x442104,_0x1eb8d6);};}function removeListener(_0x4c499f,_0x5b9bd2){return function(){ChatInternalMessageEvents['removeListener'](_0x4c499f,_0x5b9bd2);};}exports['register']=function(_0x63cd26){for(var _0x575e03=0x0,_0x573753=events['length'];_0x575e03<_0x573753;_0x575e03++){var _0x3880c1=events[_0x575e03];var _0x1ac8c5=createListener(_0x68a3('0x3')+_0x3880c1,_0x63cd26);ChatInternalMessageEvents['on'](_0x3880c1,_0x1ac8c5);}}; \ No newline at end of file +var _0x6f7f=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x138908,_0x5dc238){var _0x35275c=function(_0x4d147b){while(--_0x4d147b){_0x138908['push'](_0x138908['shift']());}};_0x35275c(++_0x5dc238);}(_0x6f7f,0x95));var _0xf6f7=function(_0x1450c2,_0x54a781){_0x1450c2=_0x1450c2-0x0;var _0x56bc56=_0x6f7f[_0x1450c2];return _0x56bc56;};'use strict';var ChatInternalMessageEvents=require(_0xf6f7('0x0'));var events=[_0xf6f7('0x1'),_0xf6f7('0x2'),_0xf6f7('0x3')];function createListener(_0x40e605,_0xc63f23){return function(_0x17c481){_0xc63f23[_0xf6f7('0x4')](_0x40e605,_0x17c481);};}function removeListener(_0x325c3d,_0x4bc63f){return function(){ChatInternalMessageEvents[_0xf6f7('0x5')](_0x325c3d,_0x4bc63f);};}exports[_0xf6f7('0x6')]=function(_0x28c1ff){for(var _0x251a9b=0x0,_0x4735b1=events[_0xf6f7('0x7')];_0x251a9b<_0x4735b1;_0x251a9b++){var _0x252e9b=events[_0x251a9b];var _0x27dcd1=createListener(_0xf6f7('0x8')+_0x252e9b,_0x28c1ff);ChatInternalMessageEvents['on'](_0x252e9b,_0x27dcd1);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7af7eb5..8de274a 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 _0x1ae8=['describe','/users','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x2b6e42,_0x21a83e){var _0x37a98e=function(_0x5546ae){while(--_0x5546ae){_0x2b6e42['push'](_0x2b6e42['shift']());}};_0x37a98e(++_0x21a83e);}(_0x1ae8,0x9b));var _0x81ae=function(_0x4fb927,_0x42f767){_0x4fb927=_0x4fb927-0x0;var _0x2178ba=_0x1ae8[_0x4fb927];return _0x2178ba;};'use strict';var multer=require(_0x81ae('0x0'));var util=require(_0x81ae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x81ae('0x2'));var router=express[_0x81ae('0x3')]();var fs_extra=require(_0x81ae('0x4'));var auth=require(_0x81ae('0x5'));var interaction=require(_0x81ae('0x6'));var config=require(_0x81ae('0x7'));var controller=require(_0x81ae('0x8'));router[_0x81ae('0x9')]('/',auth[_0x81ae('0xa')](),controller[_0x81ae('0xb')]);router[_0x81ae('0x9')](_0x81ae('0xc'),auth['isAuthenticated'](),controller[_0x81ae('0xd')]);router[_0x81ae('0x9')](_0x81ae('0xe'),auth[_0x81ae('0xa')](),controller['getUsers']);router[_0x81ae('0x9')]('/:id',auth[_0x81ae('0xa')](),controller[_0x81ae('0xf')]);router[_0x81ae('0x10')]('/',auth[_0x81ae('0xa')](),controller[_0x81ae('0x11')]);router[_0x81ae('0x12')](_0x81ae('0x13'),controller[_0x81ae('0x14')]);router[_0x81ae('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x81ae('0x16')]);module[_0x81ae('0x17')]=router; \ No newline at end of file +var _0x8ca8=['isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get'];(function(_0x2868ec,_0x29cc3a){var _0x48555c=function(_0x3b20c6){while(--_0x3b20c6){_0x2868ec['push'](_0x2868ec['shift']());}};_0x48555c(++_0x29cc3a);}(_0x8ca8,0x138));var _0x88ca=function(_0x5d5620,_0x3af923){_0x5d5620=_0x5d5620-0x0;var _0x40b9a=_0x8ca8[_0x5d5620];return _0x40b9a;};'use strict';var multer=require(_0x88ca('0x0'));var util=require(_0x88ca('0x1'));var path=require(_0x88ca('0x2'));var timeout=require(_0x88ca('0x3'));var express=require(_0x88ca('0x4'));var router=express['Router']();var fs_extra=require(_0x88ca('0x5'));var auth=require(_0x88ca('0x6'));var interaction=require(_0x88ca('0x7'));var config=require('../../config/environment');var controller=require(_0x88ca('0x8'));router[_0x88ca('0x9')]('/',auth[_0x88ca('0xa')](),controller[_0x88ca('0xb')]);router[_0x88ca('0x9')](_0x88ca('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x88ca('0xd'),auth[_0x88ca('0xa')](),controller[_0x88ca('0xe')]);router[_0x88ca('0x9')](_0x88ca('0xf'),auth[_0x88ca('0xa')](),controller[_0x88ca('0x10')]);router[_0x88ca('0x11')]('/',auth[_0x88ca('0xa')](),controller[_0x88ca('0x12')]);router[_0x88ca('0x13')](_0x88ca('0xf'),controller[_0x88ca('0x14')]);router['delete'](_0x88ca('0xf'),auth[_0x88ca('0xa')](),controller[_0x88ca('0x15')]);module[_0x88ca('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 727acf1..181775a 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 _0x9703=['ENUM','out','STRING','TEXT','medium','BOOLEAN'];(function(_0x789b5e,_0x48a84e){var _0x2922ae=function(_0x3e9817){while(--_0x3e9817){_0x789b5e['push'](_0x789b5e['shift']());}};_0x2922ae(++_0x48a84e);}(_0x9703,0xdb));var _0x3970=function(_0x2bf031,_0x2e84d8){_0x2bf031=_0x2bf031-0x0;var _0x215504=_0x9703[_0x2bf031];return _0x215504;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3970('0x0')](_0x3970('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3970('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3970('0x3')]('in','out'),'defaultValue':_0x3970('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3970('0x5')]},'providerResponse':{'type':Sequelize[_0x3970('0x0')]}}; \ No newline at end of file +var _0xc04a=['STRING','sequelize','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x2e8aac,_0x27a922){var _0xf51dcf=function(_0x16bf54){while(--_0x16bf54){_0x2e8aac['push'](_0x2e8aac['shift']());}};_0xf51dcf(++_0x27a922);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'body':{'type':Sequelize[_0xac04('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xac04('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xac04('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xac04('0x3')]('in','out'),'defaultValue':_0xac04('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xac04('0x5')]},'providerName':{'type':Sequelize[_0xac04('0x6')]},'providerResponse':{'type':Sequelize[_0xac04('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a4be0de..901fe42 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 _0x9a80=['update','destroy','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','ChatMessage','includeAll','include','findAll','rows','show','params','intersection','fields','find','body','describe','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','parse','formData','chat-interactions','RejectMessage','rejectMessage','sequelize','internal','interface','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x394d73,_0x37f6bc){var _0x226422=function(_0x2fa25b){while(--_0x2fa25b){_0x394d73['push'](_0x394d73['shift']());}};_0x226422(++_0x37f6bc);}(_0x9a80,0x1d8));var _0x09a8=function(_0xa24a55,_0x5143fe){_0xa24a55=_0xa24a55-0x0;var _0x37439c=_0x9a80[_0xa24a55];return _0x37439c;};'use strict';var emlformat=require(_0x09a8('0x0'));var rimraf=require(_0x09a8('0x1'));var zipdir=require(_0x09a8('0x2'));var jsonpatch=require(_0x09a8('0x3'));var rp=require(_0x09a8('0x4'));var moment=require(_0x09a8('0x5'));var BPromise=require(_0x09a8('0x6'));var Mustache=require(_0x09a8('0x7'));var util=require(_0x09a8('0x8'));var path=require(_0x09a8('0x9'));var sox=require(_0x09a8('0xa'));var csv=require(_0x09a8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09a8('0xc'));var _=require(_0x09a8('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x09a8('0xe'));var deskjs=require(_0x09a8('0xf'));var toCsv=require(_0x09a8('0xb'));var querystring=require(_0x09a8('0x10'));var Papa=require(_0x09a8('0x11'));var Redis=require(_0x09a8('0x12'));var authService=require(_0x09a8('0x13'));var qs=require(_0x09a8('0x14'));var as=require(_0x09a8('0x15'));var hardwareService=require(_0x09a8('0x16'));var logger=require(_0x09a8('0x17'))(_0x09a8('0x18'));var utils=require(_0x09a8('0x19'));var config=require(_0x09a8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x09a8('0x1b'))['db'];config[_0x09a8('0x1c')]=_[_0x09a8('0x1d')](config['redis'],{'host':_0x09a8('0x1e'),'port':0x18eb});var socket=require(_0x09a8('0x1f'))(new Redis(config['redis']));require(_0x09a8('0x20'))['register'](socket);var jayson=require(_0x09a8('0x21'));var client=jayson['client'][_0x09a8('0x22')]({'port':0x232c});var client9002=jayson[_0x09a8('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cb763,_0x5e86a8,_0x40fb60,_0x5e5eff){return new BPromise(function(_0x485f3b,_0x24d8c5){var _0x451347=_0x5e5eff||client;return _0x451347[_0x09a8('0x24')](_0x5cb763,_0x40fb60)[_0x09a8('0x25')](function(_0x2b7819){logger[_0x09a8('0x26')](_0x09a8('0x27'),_0x5e86a8,_0x09a8('0x28'));logger[_0x09a8('0x29')](_0x09a8('0x2a'),_0x5e86a8,_0x09a8('0x28'),JSON['stringify'](_0x2b7819));if(_0x2b7819[_0x09a8('0x2b')]){if(_0x2b7819['error'][_0x09a8('0x2c')]===0x1f4){logger[_0x09a8('0x2b')](_0x09a8('0x27'),_0x5e86a8,_0x2b7819[_0x09a8('0x2b')][_0x09a8('0x2d')]);return _0x24d8c5(_0x2b7819[_0x09a8('0x2b')][_0x09a8('0x2d')]);}logger[_0x09a8('0x2b')](_0x09a8('0x27'),_0x5e86a8,_0x2b7819['error'][_0x09a8('0x2d')]);return _0x485f3b(_0x2b7819['error'][_0x09a8('0x2d')]);}else{logger[_0x09a8('0x26')](_0x09a8('0x27'),_0x5e86a8,_0x09a8('0x28'));_0x485f3b(_0x2b7819[_0x09a8('0x2e')][_0x09a8('0x2d')]);}})[_0x09a8('0x2f')](function(_0x3cff03){logger['error'](_0x09a8('0x27'),_0x5e86a8,_0x3cff03);_0x24d8c5(_0x3cff03);});});}function respondWithStatusCode(_0x2390cb,_0xf1be){_0xf1be=_0xf1be||0xcc;return function(_0x4137fc){if(_0x4137fc){return _0x2390cb[_0x09a8('0x30')](_0xf1be);}return _0x2390cb[_0x09a8('0x31')](_0xf1be)[_0x09a8('0x32')]();};}function respondWithResult(_0xa547a2,_0xfa448b){_0xfa448b=_0xfa448b||0xc8;return function(_0x372234){if(_0x372234){return _0xa547a2['status'](_0xfa448b)[_0x09a8('0x33')](_0x372234);}};}function respondWithFilteredResult(_0x427c82,_0x36df33){return function(_0x203a36){if(_0x203a36){var _0x3df085=typeof _0x36df33[_0x09a8('0x34')]==='undefined'&&typeof _0x36df33[_0x09a8('0x35')]===_0x09a8('0x36');var _0x492da1=_0x203a36[_0x09a8('0x37')];var _0x3a57f6=_0x3df085?0x0:_0x36df33[_0x09a8('0x34')];var _0x40b2f1=_0x3df085?_0x203a36[_0x09a8('0x37')]:_0x36df33[_0x09a8('0x34')]+_0x36df33[_0x09a8('0x35')];var _0x19c83c;if(_0x40b2f1>=_0x492da1){_0x40b2f1=_0x492da1;_0x19c83c=0xc8;}else{_0x19c83c=0xce;}_0x427c82[_0x09a8('0x31')](_0x19c83c);return _0x427c82['set']('Content-Range',_0x3a57f6+'-'+_0x40b2f1+'/'+_0x492da1)[_0x09a8('0x33')](_0x203a36);}return null;};}function patchUpdates(_0x55b4a4){return function(_0x19d7d7){try{jsonpatch['apply'](_0x19d7d7,_0x55b4a4,!![]);}catch(_0x13f643){return BPromise['reject'](_0x13f643);}return _0x19d7d7['save']();};}function saveUpdates(_0x582f5b,_0xf3d35a){return function(_0x1bdafd){if(_0x1bdafd){return _0x1bdafd[_0x09a8('0x38')](_0x582f5b)['then'](function(_0x2cd4a5){return _0x2cd4a5;});}return null;};}function removeEntity(_0x253292,_0x1c04bb){return function(_0x4c0822){if(_0x4c0822){return _0x4c0822[_0x09a8('0x39')]()[_0x09a8('0x25')](function(){_0x253292[_0x09a8('0x31')](0xcc)[_0x09a8('0x32')]();});}};}function handleEntityNotFound(_0x26a646,_0x58edb2){return function(_0x9148e8){if(!_0x9148e8){_0x26a646[_0x09a8('0x30')](0x194);}return _0x9148e8;};}function handleError(_0x273227,_0x44022e){_0x44022e=_0x44022e||0x1f4;return function(_0x11dca7){logger[_0x09a8('0x2b')](_0x11dca7['stack']);if(_0x11dca7[_0x09a8('0x3a')]){delete _0x11dca7[_0x09a8('0x3a')];}_0x273227[_0x09a8('0x31')](_0x44022e)['send'](_0x11dca7);};}exports[_0x09a8('0x3b')]=function(_0x34edf5,_0x12fc13){var _0x3f3210={},_0xb9c44e={},_0x106e97={'count':0x0,'rows':[]};var _0x8e9dbc=_[_0x09a8('0x3c')](db['ChatMessage'][_0x09a8('0x3d')],function(_0x54a21a){return{'name':_0x54a21a[_0x09a8('0x3e')],'type':_0x54a21a[_0x09a8('0x3f')][_0x09a8('0x40')]};});_0xb9c44e['model']=_[_0x09a8('0x3c')](_0x8e9dbc,'name');_0xb9c44e['query']=_[_0x09a8('0x41')](_0x34edf5[_0x09a8('0x42')]);_0xb9c44e[_0x09a8('0x43')]=_['intersection'](_0xb9c44e[_0x09a8('0x44')],_0xb9c44e[_0x09a8('0x42')]);_0x3f3210[_0x09a8('0x45')]=_['intersection'](_0xb9c44e['model'],qs['fields'](_0x34edf5['query']['fields']));_0x3f3210['attributes']=_0x3f3210[_0x09a8('0x45')][_0x09a8('0x46')]?_0x3f3210[_0x09a8('0x45')]:_0xb9c44e['model'];if(!_0x34edf5[_0x09a8('0x42')][_0x09a8('0x47')](_0x09a8('0x48'))){_0x3f3210[_0x09a8('0x35')]=qs[_0x09a8('0x35')](_0x34edf5[_0x09a8('0x42')]['limit']);_0x3f3210[_0x09a8('0x34')]=qs[_0x09a8('0x34')](_0x34edf5[_0x09a8('0x42')]['offset']);}_0x3f3210[_0x09a8('0x49')]=qs[_0x09a8('0x4a')](_0x34edf5[_0x09a8('0x42')][_0x09a8('0x4a')]);_0x3f3210['where']=qs[_0x09a8('0x43')](_['pick'](_0x34edf5[_0x09a8('0x42')],_0xb9c44e['filters']),_0x8e9dbc);if(_0x34edf5[_0x09a8('0x42')][_0x09a8('0x4b')]){_0x3f3210[_0x09a8('0x4c')]=_[_0x09a8('0x4d')](_0x3f3210[_0x09a8('0x4c')],{'$or':_['map'](_0x8e9dbc,function(_0x23105f){if(_0x23105f[_0x09a8('0x3f')]!=='VIRTUAL'){var _0x16c4f5={};_0x16c4f5[_0x23105f[_0x09a8('0x3a')]]={'$like':'%'+_0x34edf5[_0x09a8('0x42')][_0x09a8('0x4b')]+'%'};return _0x16c4f5;}})});}_0x3f3210=_[_0x09a8('0x4d')]({},_0x3f3210,_0x34edf5[_0x09a8('0x4e')]);var _0x17d6c3={'where':_0x3f3210['where']};return db[_0x09a8('0x4f')][_0x09a8('0x37')](_0x17d6c3)[_0x09a8('0x25')](function(_0x16163c){_0x106e97['count']=_0x16163c;if(_0x34edf5[_0x09a8('0x42')][_0x09a8('0x50')]){_0x3f3210[_0x09a8('0x51')]=[{'all':!![]}];}return db[_0x09a8('0x4f')][_0x09a8('0x52')](_0x3f3210);})['then'](function(_0x5c5c12){_0x106e97[_0x09a8('0x53')]=_0x5c5c12;return _0x106e97;})['then'](respondWithFilteredResult(_0x12fc13,_0x3f3210))[_0x09a8('0x2f')](handleError(_0x12fc13,null));};exports[_0x09a8('0x54')]=function(_0x184526,_0x3aa36a){var _0x92ffcb={'raw':!![],'where':{'id':_0x184526[_0x09a8('0x55')]['id']}},_0x5357ed={};_0x5357ed['model']=_[_0x09a8('0x41')](db[_0x09a8('0x4f')]['rawAttributes']);_0x5357ed[_0x09a8('0x42')]=_[_0x09a8('0x41')](_0x184526['query']);_0x5357ed['filters']=_['intersection'](_0x5357ed[_0x09a8('0x44')],_0x5357ed[_0x09a8('0x42')]);_0x92ffcb[_0x09a8('0x45')]=_[_0x09a8('0x56')](_0x5357ed[_0x09a8('0x44')],qs[_0x09a8('0x57')](_0x184526[_0x09a8('0x42')][_0x09a8('0x57')]));_0x92ffcb['attributes']=_0x92ffcb[_0x09a8('0x45')]['length']?_0x92ffcb[_0x09a8('0x45')]:_0x5357ed[_0x09a8('0x44')];if(_0x184526[_0x09a8('0x42')]['includeAll']){_0x92ffcb[_0x09a8('0x51')]=[{'all':!![]}];}_0x92ffcb=_[_0x09a8('0x4d')]({},_0x92ffcb,_0x184526[_0x09a8('0x4e')]);return db[_0x09a8('0x4f')][_0x09a8('0x58')](_0x92ffcb)[_0x09a8('0x25')](handleEntityNotFound(_0x3aa36a,null))[_0x09a8('0x25')](respondWithResult(_0x3aa36a,null))[_0x09a8('0x2f')](handleError(_0x3aa36a,null));};exports['create']=function(_0x3ea283,_0x4a1e5b){return db['ChatMessage']['create'](_0x3ea283[_0x09a8('0x59')],{})[_0x09a8('0x25')](respondWithResult(_0x4a1e5b,0xc9))[_0x09a8('0x2f')](handleError(_0x4a1e5b,null));};exports['update']=function(_0x511203,_0x5b36c5){if(_0x511203[_0x09a8('0x59')]['id']){delete _0x511203['body']['id'];}return db[_0x09a8('0x4f')][_0x09a8('0x58')]({'where':{'id':_0x511203[_0x09a8('0x55')]['id']}})[_0x09a8('0x25')](handleEntityNotFound(_0x5b36c5,null))[_0x09a8('0x25')](saveUpdates(_0x511203[_0x09a8('0x59')],null))['then'](respondWithResult(_0x5b36c5,null))[_0x09a8('0x2f')](handleError(_0x5b36c5,null));};exports[_0x09a8('0x39')]=function(_0x3614c8,_0x2d5f1d){return db[_0x09a8('0x4f')]['find']({'where':{'id':_0x3614c8[_0x09a8('0x55')]['id']}})[_0x09a8('0x25')](handleEntityNotFound(_0x2d5f1d,null))[_0x09a8('0x25')](removeEntity(_0x2d5f1d,null))[_0x09a8('0x2f')](handleError(_0x2d5f1d,null));};exports[_0x09a8('0x5a')]=function(_0x2f8b5f,_0x92eb71){return db[_0x09a8('0x4f')]['describe']()[_0x09a8('0x25')](respondWithResult(_0x92eb71,null))['catch'](handleError(_0x92eb71,null));};var interaction_log=require(_0x09a8('0x17'))('chat-interactions');exports['accept']=function(_0x52b38f,_0x59cce4,_0x478146){var _0x127b26={'agent':{},'channel':_0x09a8('0x5b')};if(_0x52b38f[_0x09a8('0x59')]['id']){delete _0x52b38f['body']['id'];}_0x52b38f[_0x09a8('0x59')][_0x09a8('0x5c')]=!![];_0x52b38f[_0x09a8('0x59')][_0x09a8('0x5d')]=moment()[_0x09a8('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x52b38f[_0x09a8('0x59')]['UserId']=_0x52b38f[_0x09a8('0x59')][_0x09a8('0x5f')]||_0x52b38f[_0x09a8('0x60')]['id'];_0x127b26[_0x09a8('0x61')]['id']=_0x52b38f[_0x09a8('0x59')][_0x09a8('0x5f')];return db[_0x09a8('0x4f')][_0x09a8('0x58')]({'where':{'id':_0x52b38f[_0x09a8('0x55')]['id'],'UserId':null}})[_0x09a8('0x25')](handleEntityNotFound(_0x59cce4,null))[_0x09a8('0x25')](saveUpdates(_0x52b38f[_0x09a8('0x59')],null))[_0x09a8('0x25')](function(_0x4a6886){if(_0x4a6886){_0x127b26[_0x09a8('0x2d')]=_0x4a6886[_0x09a8('0x62')]({'plain':!![]});return db[_0x09a8('0x63')][_0x09a8('0x58')]({'where':{'id':_0x4a6886[_0x09a8('0x64')]}});}return null;})[_0x09a8('0x25')](handleEntityNotFound(_0x59cce4,null))[_0x09a8('0x25')](function(_0x377409){if(_0x377409){return _0x377409['update']({'UserId':_0x52b38f[_0x09a8('0x59')][_0x09a8('0x5f')],'read1stAt':_['isNil'](_0x377409[_0x09a8('0x65')])?moment()[_0x09a8('0x5e')](_0x09a8('0x66')):undefined});}return null;})[_0x09a8('0x25')](function(_0x145927){if(_0x145927){_0x127b26[_0x09a8('0x67')]=_0x145927[_0x09a8('0x62')]({'plain':!![]});interaction_log[_0x09a8('0x26')](_0x09a8('0x68'),_0x52b38f['user']['id'],_0x52b38f[_0x09a8('0x60')][_0x09a8('0x3a')],_0x52b38f[_0x09a8('0x60')][_0x09a8('0x69')],_0x127b26[_0x09a8('0x67')]['id'],_0x52b38f[_0x09a8('0x59')]?JSON[_0x09a8('0x6a')](_0x52b38f[_0x09a8('0x59')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x127b26);}return null;})[_0x09a8('0x25')](function(_0x437999){var _0x4009d1=_0x09a8('0x6b')+_0x437999[_0x09a8('0x2d')][_0x09a8('0x6c')];return db['sequelize']['query'](_0x4009d1,{'type':db[_0x09a8('0x6d')][_0x09a8('0x6e')][_0x09a8('0x6f')],'raw':!![]})[_0x09a8('0x25')](function(_0x1d624f){return _0x1d624f;});})[_0x09a8('0x25')](function(_0xd7e2e9){if(_0xd7e2e9){_0x127b26['message'][_0x09a8('0x70')]=_0xd7e2e9[0x0];if(!_0x52b38f[_0x09a8('0x59')][_0x09a8('0x5f')])return;return db['User'][_0x09a8('0x58')]({'where':{'id':_0x52b38f[_0x09a8('0x59')]['UserId'],'role':_0x09a8('0x61')},'attributes':['id',_0x09a8('0x3a'),_0x09a8('0x71'),_0x09a8('0x72'),'internal'],'raw':!![]});}return null;})[_0x09a8('0x25')](function(_0x17fa8f){if(!_0x17fa8f)return null;_0x127b26[_0x09a8('0x2d')]['agent']=_0x17fa8f;return _0x127b26;})[_0x09a8('0x25')](function(_0x139786){if(_0x139786){if(_0x52b38f['body'][_0x09a8('0x73')]){_0x127b26['message']['interface']=util[_0x09a8('0x5e')](_0x09a8('0x74'),_0x52b38f['user'][_0x09a8('0x3a')]);_0x127b26['message']['channel']=_0x127b26[_0x09a8('0x75')];_0x127b26['message'][_0x09a8('0x76')]=_0x127b26[_0x09a8('0x75')];_0x127b26[_0x09a8('0x2d')][_0x09a8('0x77')]=_0x09a8('0x78');return respondWithRpcPromise(_0x09a8('0x79'),_0x09a8('0x79'),{'event':'acceptmessage','message':_[_0x09a8('0x4d')](_0x127b26[_0x09a8('0x2d')],JSON[_0x09a8('0x7a')](_0x127b26[_0x09a8('0x67')][_0x09a8('0x7b')]))},client9002)['then'](function(){return _0x127b26;});}return _0x127b26;}return null;})[_0x09a8('0x25')](respondWithResult(_0x59cce4,null))['catch'](handleError(_0x59cce4,null));};var interaction_log=require(_0x09a8('0x17'))(_0x09a8('0x7c'));exports['reject']=function(_0x4d3ddb,_0x366b97,_0x434174){var _0x5adead={'agent':{},'channel':'chat'};if(_0x4d3ddb[_0x09a8('0x59')]['id']){delete _0x4d3ddb[_0x09a8('0x59')]['id'];}_0x4d3ddb['body'][_0x09a8('0x5f')]=_0x4d3ddb[_0x09a8('0x59')][_0x09a8('0x5f')]||_0x4d3ddb[_0x09a8('0x60')]['id'];_0x5adead[_0x09a8('0x61')]['id']=_0x4d3ddb[_0x09a8('0x59')][_0x09a8('0x5f')];return db['ChatMessage'][_0x09a8('0x58')]({'where':{'id':_0x4d3ddb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x366b97,null))[_0x09a8('0x25')](function(_0x1d6a21){if(_0x1d6a21){_0x5adead['message']=_0x1d6a21[_0x09a8('0x62')]({'plain':!![]});return db[_0x09a8('0x63')][_0x09a8('0x58')]({'where':{'id':_0x1d6a21[_0x09a8('0x64')]}});}return null;})[_0x09a8('0x25')](handleEntityNotFound(_0x366b97,null))[_0x09a8('0x25')](function(_0x5a65ed){if(_0x5a65ed){_0x5adead[_0x09a8('0x67')]=_0x5a65ed[_0x09a8('0x62')]({'plain':!![]});interaction_log[_0x09a8('0x26')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d3ddb[_0x09a8('0x60')]['id'],_0x4d3ddb[_0x09a8('0x60')][_0x09a8('0x3a')],_0x4d3ddb[_0x09a8('0x60')]['role'],_0x5adead[_0x09a8('0x67')]['id'],_0x4d3ddb[_0x09a8('0x59')]?JSON[_0x09a8('0x6a')](_0x4d3ddb['body']):'null');return respondWithRpcPromise(_0x09a8('0x7d'),_0x09a8('0x7e'),_0x5adead);}return null;})[_0x09a8('0x25')](function(_0x20535f){var _0x27e49a=_0x09a8('0x6b')+_0x20535f[_0x09a8('0x2d')]['ContactId'];return db[_0x09a8('0x7f')]['query'](_0x27e49a,{'type':db[_0x09a8('0x6d')][_0x09a8('0x6e')][_0x09a8('0x6f')],'raw':!![]})[_0x09a8('0x25')](function(_0xab4bf3){return _0xab4bf3;});})['then'](function(_0x1bd9f7){if(_0x1bd9f7){_0x5adead[_0x09a8('0x2d')]['contact']=_0x1bd9f7[0x0];if(!_0x4d3ddb[_0x09a8('0x59')][_0x09a8('0x5f')])return;return db['User']['find']({'where':{'id':_0x4d3ddb[_0x09a8('0x59')][_0x09a8('0x5f')],'role':_0x09a8('0x61')},'attributes':['id',_0x09a8('0x3a'),_0x09a8('0x71'),_0x09a8('0x72'),_0x09a8('0x80')],'raw':!![]});}return null;})[_0x09a8('0x25')](function(_0x5b3083){if(!_0x5b3083)return null;_0x5adead[_0x09a8('0x2d')][_0x09a8('0x61')]=_0x5b3083;return _0x5adead;})[_0x09a8('0x25')](function(_0x269cd1){if(_0x269cd1){_0x269cd1[_0x09a8('0x2d')][_0x09a8('0x81')]=util[_0x09a8('0x5e')]('SIP/%s',_0x4d3ddb[_0x09a8('0x60')][_0x09a8('0x3a')]);_0x269cd1[_0x09a8('0x2d')][_0x09a8('0x75')]=_0x5adead[_0x09a8('0x75')];_0x269cd1[_0x09a8('0x2d')][_0x09a8('0x76')]=_0x5adead[_0x09a8('0x75')];_0x269cd1[_0x09a8('0x2d')][_0x09a8('0x77')]=_0x09a8('0x82');respondWithRpcPromise(_0x09a8('0x79'),'EventManager',{'event':_0x09a8('0x83'),'message':_[_0x09a8('0x4d')](_0x5adead[_0x09a8('0x2d')],JSON[_0x09a8('0x7a')](_0x5adead[_0x09a8('0x67')][_0x09a8('0x7b')]))},client9002);return _0x5adead;}return null;})[_0x09a8('0x25')](respondWithResult(_0x366b97,null))[_0x09a8('0x2f')](handleError(_0x366b97,null));}; \ No newline at end of file +var _0x6733=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','show','rawAttributes','length','include','find','create','body','params','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','isNil','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','parse','formData','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','ContactId','internal','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','register','client','http','then','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','keys','query','filters'];(function(_0x5704b1,_0xbc7e5c){var _0x2c4b2a=function(_0x5deb10){while(--_0x5deb10){_0x5704b1['push'](_0x5704b1['shift']());}};_0x2c4b2a(++_0xbc7e5c);}(_0x6733,0x149));var _0x3673=function(_0x455ebd,_0x4aad19){_0x455ebd=_0x455ebd-0x0;var _0x188d1b=_0x6733[_0x455ebd];return _0x188d1b;};'use strict';var emlformat=require(_0x3673('0x0'));var rimraf=require(_0x3673('0x1'));var zipdir=require(_0x3673('0x2'));var jsonpatch=require(_0x3673('0x3'));var rp=require(_0x3673('0x4'));var moment=require(_0x3673('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3673('0x6'));var path=require(_0x3673('0x7'));var sox=require(_0x3673('0x8'));var csv=require(_0x3673('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3673('0xa'));var _=require(_0x3673('0xb'));var squel=require(_0x3673('0xc'));var crypto=require('crypto');var jsforce=require(_0x3673('0xd'));var deskjs=require(_0x3673('0xe'));var toCsv=require(_0x3673('0x9'));var querystring=require('querystring');var Papa=require(_0x3673('0xf'));var Redis=require(_0x3673('0x10'));var authService=require(_0x3673('0x11'));var qs=require(_0x3673('0x12'));var as=require(_0x3673('0x13'));var hardwareService=require(_0x3673('0x14'));var logger=require(_0x3673('0x15'))(_0x3673('0x16'));var utils=require('../../config/utils');var config=require(_0x3673('0x17'));var licenseUtil=require(_0x3673('0x18'));var db=require(_0x3673('0x19'))['db'];config['redis']=_[_0x3673('0x1a')](config['redis'],{'host':_0x3673('0x1b'),'port':0x18eb});var socket=require(_0x3673('0x1c'))(new Redis(config[_0x3673('0x1d')]));require(_0x3673('0x1e'))[_0x3673('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3673('0x20')][_0x3673('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x40653e,_0x2ccf82,_0x5aac5f,_0x4dbd90){return new BPromise(function(_0x5c7ff7,_0x1f48e7){var _0x169f42=_0x4dbd90||client;return _0x169f42['request'](_0x40653e,_0x5aac5f)[_0x3673('0x22')](function(_0x24ca40){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2ccf82,_0x3673('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2ccf82,_0x3673('0x23'),JSON[_0x3673('0x24')](_0x24ca40));if(_0x24ca40[_0x3673('0x25')]){if(_0x24ca40[_0x3673('0x25')][_0x3673('0x26')]===0x1f4){logger['error'](_0x3673('0x27'),_0x2ccf82,_0x24ca40[_0x3673('0x25')]['message']);return _0x1f48e7(_0x24ca40[_0x3673('0x25')]['message']);}logger[_0x3673('0x25')](_0x3673('0x27'),_0x2ccf82,_0x24ca40[_0x3673('0x25')][_0x3673('0x28')]);return _0x5c7ff7(_0x24ca40[_0x3673('0x25')][_0x3673('0x28')]);}else{logger[_0x3673('0x29')](_0x3673('0x27'),_0x2ccf82,_0x3673('0x23'));_0x5c7ff7(_0x24ca40['result'][_0x3673('0x28')]);}})[_0x3673('0x2a')](function(_0x3c1ea8){logger[_0x3673('0x25')](_0x3673('0x27'),_0x2ccf82,_0x3c1ea8);_0x1f48e7(_0x3c1ea8);});});}function respondWithStatusCode(_0x460edb,_0x5c8221){_0x5c8221=_0x5c8221||0xcc;return function(_0x3c24f3){if(_0x3c24f3){return _0x460edb[_0x3673('0x2b')](_0x5c8221);}return _0x460edb[_0x3673('0x2c')](_0x5c8221)[_0x3673('0x2d')]();};}function respondWithResult(_0x5e4e9f,_0x2aec92){_0x2aec92=_0x2aec92||0xc8;return function(_0xfbd634){if(_0xfbd634){return _0x5e4e9f[_0x3673('0x2c')](_0x2aec92)[_0x3673('0x2e')](_0xfbd634);}};}function respondWithFilteredResult(_0x4bac56,_0x22f475){return function(_0x622fc){if(_0x622fc){var _0xb9335f=typeof _0x22f475[_0x3673('0x2f')]===_0x3673('0x30')&&typeof _0x22f475[_0x3673('0x31')]===_0x3673('0x30');var _0x1a1e80=_0x622fc[_0x3673('0x32')];var _0x4bcff0=_0xb9335f?0x0:_0x22f475[_0x3673('0x2f')];var _0x44c1b4=_0xb9335f?_0x622fc[_0x3673('0x32')]:_0x22f475[_0x3673('0x2f')]+_0x22f475[_0x3673('0x31')];var _0x510cbb;if(_0x44c1b4>=_0x1a1e80){_0x44c1b4=_0x1a1e80;_0x510cbb=0xc8;}else{_0x510cbb=0xce;}_0x4bac56[_0x3673('0x2c')](_0x510cbb);return _0x4bac56['set'](_0x3673('0x33'),_0x4bcff0+'-'+_0x44c1b4+'/'+_0x1a1e80)[_0x3673('0x2e')](_0x622fc);}return null;};}function patchUpdates(_0x4f82ff){return function(_0x4d60d6){try{jsonpatch[_0x3673('0x34')](_0x4d60d6,_0x4f82ff,!![]);}catch(_0x10e854){return BPromise[_0x3673('0x35')](_0x10e854);}return _0x4d60d6[_0x3673('0x36')]();};}function saveUpdates(_0x5649bc,_0x1c686e){return function(_0x5194dc){if(_0x5194dc){return _0x5194dc[_0x3673('0x37')](_0x5649bc)[_0x3673('0x22')](function(_0xba4bff){return _0xba4bff;});}return null;};}function removeEntity(_0x1ecc52,_0x48c971){return function(_0xf14e63){if(_0xf14e63){return _0xf14e63[_0x3673('0x38')]()[_0x3673('0x22')](function(){_0x1ecc52[_0x3673('0x2c')](0xcc)[_0x3673('0x2d')]();});}};}function handleEntityNotFound(_0xb8352,_0x10a7e3){return function(_0x4d5788){if(!_0x4d5788){_0xb8352[_0x3673('0x2b')](0x194);}return _0x4d5788;};}function handleError(_0x142408,_0x59226e){_0x59226e=_0x59226e||0x1f4;return function(_0x3736c7){logger['error'](_0x3736c7[_0x3673('0x39')]);if(_0x3736c7[_0x3673('0x3a')]){delete _0x3736c7['name'];}_0x142408[_0x3673('0x2c')](_0x59226e)[_0x3673('0x3b')](_0x3736c7);};}exports[_0x3673('0x3c')]=function(_0x5ae3c2,_0x39de1d){var _0x39b4e8={},_0x12688e={},_0x5da851={'count':0x0,'rows':[]};var _0x53e4a6=_[_0x3673('0x3d')](db[_0x3673('0x3e')]['rawAttributes'],function(_0x3d7e23){return{'name':_0x3d7e23[_0x3673('0x3f')],'type':_0x3d7e23[_0x3673('0x40')][_0x3673('0x41')]};});_0x12688e[_0x3673('0x42')]=_[_0x3673('0x3d')](_0x53e4a6,'name');_0x12688e['query']=_[_0x3673('0x43')](_0x5ae3c2[_0x3673('0x44')]);_0x12688e[_0x3673('0x45')]=_[_0x3673('0x46')](_0x12688e[_0x3673('0x42')],_0x12688e[_0x3673('0x44')]);_0x39b4e8[_0x3673('0x47')]=_[_0x3673('0x46')](_0x12688e[_0x3673('0x42')],qs[_0x3673('0x48')](_0x5ae3c2[_0x3673('0x44')]['fields']));_0x39b4e8[_0x3673('0x47')]=_0x39b4e8[_0x3673('0x47')]['length']?_0x39b4e8[_0x3673('0x47')]:_0x12688e[_0x3673('0x42')];if(!_0x5ae3c2[_0x3673('0x44')][_0x3673('0x49')](_0x3673('0x4a'))){_0x39b4e8[_0x3673('0x31')]=qs[_0x3673('0x31')](_0x5ae3c2['query']['limit']);_0x39b4e8['offset']=qs[_0x3673('0x2f')](_0x5ae3c2[_0x3673('0x44')][_0x3673('0x2f')]);}_0x39b4e8[_0x3673('0x4b')]=qs[_0x3673('0x4c')](_0x5ae3c2[_0x3673('0x44')]['sort']);_0x39b4e8[_0x3673('0x4d')]=qs[_0x3673('0x45')](_['pick'](_0x5ae3c2[_0x3673('0x44')],_0x12688e['filters']),_0x53e4a6);if(_0x5ae3c2[_0x3673('0x44')][_0x3673('0x4e')]){_0x39b4e8[_0x3673('0x4d')]=_['merge'](_0x39b4e8[_0x3673('0x4d')],{'$or':_[_0x3673('0x3d')](_0x53e4a6,function(_0x591501){if(_0x591501['type']!==_0x3673('0x4f')){var _0x373c9d={};_0x373c9d[_0x591501['name']]={'$like':'%'+_0x5ae3c2[_0x3673('0x44')][_0x3673('0x4e')]+'%'};return _0x373c9d;}})});}_0x39b4e8=_[_0x3673('0x50')]({},_0x39b4e8,_0x5ae3c2[_0x3673('0x51')]);var _0x17d256={'where':_0x39b4e8[_0x3673('0x4d')]};return db[_0x3673('0x3e')][_0x3673('0x32')](_0x17d256)[_0x3673('0x22')](function(_0x454708){_0x5da851['count']=_0x454708;if(_0x5ae3c2[_0x3673('0x44')][_0x3673('0x52')]){_0x39b4e8['include']=[{'all':!![]}];}return db[_0x3673('0x3e')][_0x3673('0x53')](_0x39b4e8);})[_0x3673('0x22')](function(_0x467e4a){_0x5da851['rows']=_0x467e4a;return _0x5da851;})[_0x3673('0x22')](respondWithFilteredResult(_0x39de1d,_0x39b4e8))[_0x3673('0x2a')](handleError(_0x39de1d,null));};exports[_0x3673('0x54')]=function(_0x5f2cff,_0x3eee78){var _0x92b627={'raw':!![],'where':{'id':_0x5f2cff['params']['id']}},_0x4c2338={};_0x4c2338['model']=_[_0x3673('0x43')](db['ChatMessage'][_0x3673('0x55')]);_0x4c2338[_0x3673('0x44')]=_[_0x3673('0x43')](_0x5f2cff['query']);_0x4c2338[_0x3673('0x45')]=_[_0x3673('0x46')](_0x4c2338[_0x3673('0x42')],_0x4c2338[_0x3673('0x44')]);_0x92b627[_0x3673('0x47')]=_['intersection'](_0x4c2338[_0x3673('0x42')],qs[_0x3673('0x48')](_0x5f2cff['query']['fields']));_0x92b627[_0x3673('0x47')]=_0x92b627['attributes'][_0x3673('0x56')]?_0x92b627[_0x3673('0x47')]:_0x4c2338['model'];if(_0x5f2cff[_0x3673('0x44')][_0x3673('0x52')]){_0x92b627[_0x3673('0x57')]=[{'all':!![]}];}_0x92b627=_[_0x3673('0x50')]({},_0x92b627,_0x5f2cff[_0x3673('0x51')]);return db[_0x3673('0x3e')][_0x3673('0x58')](_0x92b627)[_0x3673('0x22')](handleEntityNotFound(_0x3eee78,null))[_0x3673('0x22')](respondWithResult(_0x3eee78,null))[_0x3673('0x2a')](handleError(_0x3eee78,null));};exports[_0x3673('0x59')]=function(_0x2929ff,_0x404a20){return db[_0x3673('0x3e')]['create'](_0x2929ff[_0x3673('0x5a')],{})[_0x3673('0x22')](respondWithResult(_0x404a20,0xc9))['catch'](handleError(_0x404a20,null));};exports['update']=function(_0x1b50f2,_0x607186){if(_0x1b50f2[_0x3673('0x5a')]['id']){delete _0x1b50f2['body']['id'];}return db[_0x3673('0x3e')][_0x3673('0x58')]({'where':{'id':_0x1b50f2['params']['id']}})[_0x3673('0x22')](handleEntityNotFound(_0x607186,null))['then'](saveUpdates(_0x1b50f2[_0x3673('0x5a')],null))['then'](respondWithResult(_0x607186,null))[_0x3673('0x2a')](handleError(_0x607186,null));};exports[_0x3673('0x38')]=function(_0x5730e7,_0x2bcf4a){return db[_0x3673('0x3e')][_0x3673('0x58')]({'where':{'id':_0x5730e7[_0x3673('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2bcf4a,null))[_0x3673('0x22')](removeEntity(_0x2bcf4a,null))[_0x3673('0x2a')](handleError(_0x2bcf4a,null));};exports[_0x3673('0x5c')]=function(_0x4152ca,_0x4fb68a){return db[_0x3673('0x3e')][_0x3673('0x5c')]()[_0x3673('0x22')](respondWithResult(_0x4fb68a,null))[_0x3673('0x2a')](handleError(_0x4fb68a,null));};var interaction_log=require(_0x3673('0x15'))(_0x3673('0x5d'));exports[_0x3673('0x5e')]=function(_0x2c77a3,_0x51f9c8,_0x1be76d){var _0x4fc6e8={'agent':{},'channel':_0x3673('0x5f')};if(_0x2c77a3[_0x3673('0x5a')]['id']){delete _0x2c77a3['body']['id'];}_0x2c77a3[_0x3673('0x5a')]['read']=!![];_0x2c77a3[_0x3673('0x5a')][_0x3673('0x60')]=moment()[_0x3673('0x61')](_0x3673('0x62'));_0x2c77a3[_0x3673('0x5a')][_0x3673('0x63')]=_0x2c77a3['body']['UserId']||_0x2c77a3[_0x3673('0x64')]['id'];_0x4fc6e8[_0x3673('0x65')]['id']=_0x2c77a3['body']['UserId'];return db[_0x3673('0x3e')][_0x3673('0x58')]({'where':{'id':_0x2c77a3[_0x3673('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51f9c8,null))[_0x3673('0x22')](saveUpdates(_0x2c77a3[_0x3673('0x5a')],null))[_0x3673('0x22')](function(_0x5371bc){if(_0x5371bc){_0x4fc6e8['message']=_0x5371bc['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x5371bc['ChatInteractionId']}});}return null;})[_0x3673('0x22')](handleEntityNotFound(_0x51f9c8,null))[_0x3673('0x22')](function(_0x19168d){if(_0x19168d){return _0x19168d[_0x3673('0x37')]({'UserId':_0x2c77a3[_0x3673('0x5a')][_0x3673('0x63')],'read1stAt':_[_0x3673('0x66')](_0x19168d['read1stAt'])?moment()['format'](_0x3673('0x62')):undefined});}return null;})[_0x3673('0x22')](function(_0x5b26ca){if(_0x5b26ca){_0x4fc6e8[_0x3673('0x67')]=_0x5b26ca['get']({'plain':!![]});interaction_log[_0x3673('0x29')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c77a3[_0x3673('0x64')]['id'],_0x2c77a3['user'][_0x3673('0x3a')],_0x2c77a3[_0x3673('0x64')][_0x3673('0x68')],_0x4fc6e8['interaction']['id'],_0x2c77a3[_0x3673('0x5a')]?JSON[_0x3673('0x24')](_0x2c77a3['body']):_0x3673('0x69'));return respondWithRpcPromise(_0x3673('0x6a'),_0x3673('0x6b'),_0x4fc6e8);}return null;})['then'](function(_0x5a1879){var _0x395acc=_0x3673('0x6c')+_0x5a1879[_0x3673('0x28')]['ContactId'];return db[_0x3673('0x6d')]['query'](_0x395acc,{'type':db[_0x3673('0x6e')][_0x3673('0x6f')][_0x3673('0x70')],'raw':!![]})[_0x3673('0x22')](function(_0x290ea8){return _0x290ea8;});})[_0x3673('0x22')](function(_0x8398ee){if(_0x8398ee){_0x4fc6e8[_0x3673('0x28')][_0x3673('0x71')]=_0x8398ee[0x0];if(!_0x2c77a3[_0x3673('0x5a')][_0x3673('0x63')])return;return db[_0x3673('0x72')][_0x3673('0x58')]({'where':{'id':_0x2c77a3['body'][_0x3673('0x63')],'role':'agent'},'attributes':['id',_0x3673('0x3a'),_0x3673('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x3673('0x22')](function(_0x543e48){if(!_0x543e48)return null;_0x4fc6e8[_0x3673('0x28')]['agent']=_0x543e48;return _0x4fc6e8;})['then'](function(_0x165d2d){if(_0x165d2d){if(_0x2c77a3[_0x3673('0x5a')][_0x3673('0x74')]){_0x4fc6e8[_0x3673('0x28')][_0x3673('0x75')]=util[_0x3673('0x61')](_0x3673('0x76'),_0x2c77a3[_0x3673('0x64')][_0x3673('0x3a')]);_0x4fc6e8[_0x3673('0x28')][_0x3673('0x77')]=_0x4fc6e8[_0x3673('0x77')];_0x4fc6e8[_0x3673('0x28')][_0x3673('0x78')]=_0x4fc6e8[_0x3673('0x77')];_0x4fc6e8[_0x3673('0x28')][_0x3673('0x79')]=_0x3673('0x5e');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x3673('0x7a'),'message':_[_0x3673('0x50')](_0x4fc6e8[_0x3673('0x28')],JSON[_0x3673('0x7b')](_0x4fc6e8[_0x3673('0x67')][_0x3673('0x7c')]))},client9002)[_0x3673('0x22')](function(){return _0x4fc6e8;});}return _0x4fc6e8;}return null;})[_0x3673('0x22')](respondWithResult(_0x51f9c8,null))['catch'](handleError(_0x51f9c8,null));};var interaction_log=require(_0x3673('0x15'))(_0x3673('0x5d'));exports[_0x3673('0x35')]=function(_0x3201b4,_0x192fe6,_0x15c21d){var _0x57c9a5={'agent':{},'channel':_0x3673('0x5f')};if(_0x3201b4[_0x3673('0x5a')]['id']){delete _0x3201b4[_0x3673('0x5a')]['id'];}_0x3201b4[_0x3673('0x5a')][_0x3673('0x63')]=_0x3201b4[_0x3673('0x5a')]['UserId']||_0x3201b4[_0x3673('0x64')]['id'];_0x57c9a5[_0x3673('0x65')]['id']=_0x3201b4[_0x3673('0x5a')]['UserId'];return db['ChatMessage'][_0x3673('0x58')]({'where':{'id':_0x3201b4[_0x3673('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x192fe6,null))[_0x3673('0x22')](function(_0x159a77){if(_0x159a77){_0x57c9a5[_0x3673('0x28')]=_0x159a77[_0x3673('0x7d')]({'plain':!![]});return db[_0x3673('0x7e')][_0x3673('0x58')]({'where':{'id':_0x159a77[_0x3673('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x192fe6,null))[_0x3673('0x22')](function(_0x4ee287){if(_0x4ee287){_0x57c9a5[_0x3673('0x67')]=_0x4ee287['get']({'plain':!![]});interaction_log['info'](_0x3673('0x80'),_0x3201b4[_0x3673('0x64')]['id'],_0x3201b4['user'][_0x3673('0x3a')],_0x3201b4[_0x3673('0x64')][_0x3673('0x68')],_0x57c9a5[_0x3673('0x67')]['id'],_0x3201b4[_0x3673('0x5a')]?JSON['stringify'](_0x3201b4['body']):_0x3673('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x57c9a5);}return null;})[_0x3673('0x22')](function(_0x17a5bc){var _0x93ac9c=_0x3673('0x6c')+_0x17a5bc[_0x3673('0x28')][_0x3673('0x81')];return db[_0x3673('0x6d')]['query'](_0x93ac9c,{'type':db[_0x3673('0x6e')][_0x3673('0x6f')][_0x3673('0x70')],'raw':!![]})[_0x3673('0x22')](function(_0x52ee59){return _0x52ee59;});})[_0x3673('0x22')](function(_0x394932){if(_0x394932){_0x57c9a5[_0x3673('0x28')][_0x3673('0x71')]=_0x394932[0x0];if(!_0x3201b4[_0x3673('0x5a')][_0x3673('0x63')])return;return db[_0x3673('0x72')][_0x3673('0x58')]({'where':{'id':_0x3201b4[_0x3673('0x5a')][_0x3673('0x63')],'role':_0x3673('0x65')},'attributes':['id',_0x3673('0x3a'),_0x3673('0x73'),'email',_0x3673('0x82')],'raw':!![]});}return null;})[_0x3673('0x22')](function(_0x3acc17){if(!_0x3acc17)return null;_0x57c9a5[_0x3673('0x28')]['agent']=_0x3acc17;return _0x57c9a5;})['then'](function(_0x5c9961){if(_0x5c9961){_0x5c9961[_0x3673('0x28')][_0x3673('0x75')]=util[_0x3673('0x61')]('SIP/%s',_0x3201b4[_0x3673('0x64')]['name']);_0x5c9961[_0x3673('0x28')][_0x3673('0x77')]=_0x57c9a5[_0x3673('0x77')];_0x5c9961[_0x3673('0x28')][_0x3673('0x78')]=_0x57c9a5['channel'];_0x5c9961[_0x3673('0x28')]['event']=_0x3673('0x35');respondWithRpcPromise('EventManager',_0x3673('0x83'),{'event':_0x3673('0x84'),'message':_[_0x3673('0x50')](_0x57c9a5['message'],JSON[_0x3673('0x7b')](_0x57c9a5[_0x3673('0x67')][_0x3673('0x7c')]))},client9002);return _0x57c9a5;}return null;})[_0x3673('0x22')](respondWithResult(_0x192fe6,null))[_0x3673('0x2a')](handleError(_0x192fe6,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1bac143..38dd240 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 _0xf702=['hasOwnProperty','exports','events','ChatMessage','setMaxListeners','save','update','emit'];(function(_0x3d20ee,_0x208821){var _0x2ad298=function(_0x2d92da){while(--_0x2d92da){_0x3d20ee['push'](_0x3d20ee['shift']());}};_0x2ad298(++_0x208821);}(_0xf702,0x16a));var _0x2f70=function(_0x83e8ae,_0x42b5cc){_0x83e8ae=_0x83e8ae-0x0;var _0x3a9c2b=_0xf702[_0x83e8ae];return _0x3a9c2b;};'use strict';var EventEmitter=require(_0x2f70('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x2f70('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2f70('0x2')](0x0);var events={'afterCreate':_0x2f70('0x3'),'afterUpdate':_0x2f70('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e5297){return function(_0x5e418c,_0x2ec4f7,_0x3532ce){ChatMessageEvents[_0x2f70('0x5')](_0x3e5297+':'+_0x5e418c['id'],_0x5e418c);ChatMessageEvents[_0x2f70('0x5')](_0x3e5297,_0x5e418c);_0x3532ce(null);};}for(var e in events){if(events[_0x2f70('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x2f70('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x808a=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x5d6180,_0x42e0c0){var _0x5a17ad=function(_0xbd76cc){while(--_0xbd76cc){_0x5d6180['push'](_0x5d6180['shift']());}};_0x5a17ad(++_0x42e0c0);}(_0x808a,0x65));var _0xa808=function(_0x265721,_0x1503f2){_0x265721=_0x265721-0x0;var _0x11ec95=_0x808a[_0x265721];return _0x11ec95;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xa808('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa808('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa808('0x2')};function emitEvent(_0x4d72d9){return function(_0x17588f,_0x32e634,_0x1e7a0f){ChatMessageEvents[_0xa808('0x3')](_0x4d72d9+':'+_0x17588f['id'],_0x17588f);ChatMessageEvents[_0xa808('0x3')](_0x4d72d9,_0x17588f);_0x1e7a0f(null);};}for(var e in events){if(events[_0xa808('0x4')](e)){var event=events[e];ChatMessage[_0xa808('0x5')](e,emitEvent(event));}}module[_0xa808('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index aa21749..639cf7a 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 _0xa486=['isNil','findOne','then','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','exports','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xa486,0xd5));var _0x6a48=function(_0xd1836d,_0x212921){_0xd1836d=_0xd1836d-0x0;var _0x94f044=_0xa486[_0xd1836d];return _0x94f044;};'use strict';var _=require(_0x6a48('0x0'));var util=require('util');var logger=require(_0x6a48('0x1'))(_0x6a48('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a48('0x3'));var fs=require('fs');var path=require(_0x6a48('0x4'));var rimraf=require(_0x6a48('0x5'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x6a48('0x6')]=function(_0x3531c6,_0x1e4059){return _0x3531c6['define'](_0x6a48('0x7'),attributes,{'tableName':_0x6a48('0x8'),'paranoid':![],'indexes':[{'name':_0x6a48('0x9'),'fields':[_0x6a48('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2839e2,_0xf2aff3,_0x2c67a0){var _0x325077=_0x3531c6[_0x6a48('0xb')];var _0x45a159=_0x2839e2[_0x6a48('0xc')]({'plain':!![]});if(_0x45a159[_0x6a48('0xd')]['toLowerCase']()==='in'||_0x45a159[_0x6a48('0xd')][_0x6a48('0xe')]()===_0x6a48('0xf')&&!_0x45a159[_0x6a48('0x10')]&&!_[_0x6a48('0x11')](_0x45a159['UserId'])){_0x325077['ChatInteraction'][_0x6a48('0x12')]({'where':{'id':_0x45a159['ChatInteractionId']}})[_0x6a48('0x13')](function(_0x1b0be2){if(_0x1b0be2){_0x1b0be2['update']({'lastMsgAt':_0x45a159[_0x6a48('0x14')],'lastMsgDirection':_0x45a159[_0x6a48('0xd')][_0x6a48('0xe')]()});}})['catch'](function(_0x3f3775){console['error'](_0x3f3775);});}_0x2c67a0();}},'charset':_0x6a48('0x15'),'collate':_0x6a48('0x16')});}; \ No newline at end of file +var _0xe29e=['catch','error','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe29e,0x188));var _0xee29=function(_0x3a9047,_0x6b36c2){_0x3a9047=_0x3a9047-0x0;var _0x2c23a3=_0xe29e[_0x3a9047];return _0x2c23a3;};'use strict';var _=require('lodash');var util=require(_0xee29('0x0'));var logger=require(_0xee29('0x1'))(_0xee29('0x2'));var moment=require(_0xee29('0x3'));var BPromise=require(_0xee29('0x4'));var rp=require(_0xee29('0x5'));var fs=require('fs');var path=require(_0xee29('0x6'));var rimraf=require(_0xee29('0x7'));var config=require(_0xee29('0x8'));var attributes=require('./chatMessage.attributes');module[_0xee29('0x9')]=function(_0x15b7c1,_0x1f503a){return _0x15b7c1[_0xee29('0xa')](_0xee29('0xb'),attributes,{'tableName':_0xee29('0xc'),'paranoid':![],'indexes':[{'name':_0xee29('0xd'),'fields':[_0xee29('0xe')],'type':_0xee29('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x291bc5,_0x2d8d74,_0x5edc84){var _0x1a6406=_0x15b7c1[_0xee29('0x10')];var _0x5788d6=_0x291bc5[_0xee29('0x11')]({'plain':!![]});if(_0x5788d6['direction'][_0xee29('0x12')]()==='in'||_0x5788d6[_0xee29('0x13')][_0xee29('0x12')]()===_0xee29('0x14')&&!_0x5788d6['secret']&&!_[_0xee29('0x15')](_0x5788d6[_0xee29('0x16')])){_0x1a6406[_0xee29('0x17')][_0xee29('0x18')]({'where':{'id':_0x5788d6[_0xee29('0x19')]}})[_0xee29('0x1a')](function(_0x18e557){if(_0x18e557){_0x18e557['update']({'lastMsgAt':_0x5788d6[_0xee29('0x1b')],'lastMsgDirection':_0x5788d6[_0xee29('0x13')][_0xee29('0x12')]()});}})[_0xee29('0x1c')](function(_0x34750e){console[_0xee29('0x1d')](_0x34750e);});}_0x5edc84();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a1723de..aa08cb3 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 _0x39f8=['stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatMessage.socket','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x45df35,_0x2a678b){var _0x296707=function(_0xc797d8){while(--_0xc797d8){_0x45df35['push'](_0x45df35['shift']());}};_0x296707(++_0x2a678b);}(_0x39f8,0x70));var _0x839f=function(_0x45a588,_0x2361a9){_0x45a588=_0x45a588-0x0;var _0x180796=_0x39f8[_0x45a588];return _0x180796;};'use strict';var _=require(_0x839f('0x0'));var util=require(_0x839f('0x1'));var moment=require(_0x839f('0x2'));var BPromise=require(_0x839f('0x3'));var rs=require(_0x839f('0x4'));var fs=require('fs');var Redis=require(_0x839f('0x5'));var db=require(_0x839f('0x6'))['db'];var utils=require(_0x839f('0x7'));var logger=require(_0x839f('0x8'))('rpc');var config=require(_0x839f('0x9'));var jayson=require(_0x839f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x839f('0xb')]=_['defaults'](config['redis'],{'host':_0x839f('0xc'),'port':0x18eb});var socket=require(_0x839f('0xd'))(new Redis(config[_0x839f('0xb')]));require(_0x839f('0xe'))['register'](socket);function respondWithRpcPromise(_0x282c01,_0x4533cb,_0x4bcf2f){return new BPromise(function(_0x229a2d,_0x3c12c3){return client[_0x839f('0xf')](_0x282c01,_0x4bcf2f)['then'](function(_0x5f14ef){logger[_0x839f('0x10')]('ChatMessage,\x20%s,\x20%s',_0x4533cb,_0x839f('0x11'));logger[_0x839f('0x12')](_0x839f('0x13'),_0x4533cb,_0x839f('0x11'),JSON[_0x839f('0x14')](_0x5f14ef));if(_0x5f14ef[_0x839f('0x15')]){if(_0x5f14ef['error'][_0x839f('0x16')]===0x1f4){logger[_0x839f('0x15')](_0x839f('0x17'),_0x4533cb,_0x5f14ef['error']['message']);return _0x3c12c3(_0x5f14ef[_0x839f('0x15')][_0x839f('0x18')]);}logger[_0x839f('0x15')](_0x839f('0x17'),_0x4533cb,_0x5f14ef[_0x839f('0x15')][_0x839f('0x18')]);return _0x229a2d(_0x5f14ef[_0x839f('0x15')][_0x839f('0x18')]);}else{logger['info'](_0x839f('0x17'),_0x4533cb,_0x839f('0x11'));_0x229a2d(_0x5f14ef[_0x839f('0x19')]['message']);}})[_0x839f('0x1a')](function(_0x1b3029){logger[_0x839f('0x15')](_0x839f('0x17'),_0x4533cb,_0x1b3029);_0x3c12c3(_0x1b3029);});});}exports[_0x839f('0x1b')]=function(_0x58fbee){var _0x55ffa2=this;return new Promise(function(_0x99d720,_0x4c2c72){return db[_0x839f('0x1c')][_0x839f('0x1d')](_0x58fbee[_0x839f('0x1e')],{'raw':_0x58fbee['options']?_0x58fbee['options'][_0x839f('0x1f')]===undefined?!![]:![]:!![]})[_0x839f('0x20')](function(_0x7cbd5b){logger[_0x839f('0x10')](_0x839f('0x1b'),_0x58fbee);logger[_0x839f('0x12')](_0x839f('0x1b'),_0x58fbee,JSON[_0x839f('0x14')](_0x7cbd5b));_0x99d720(_0x7cbd5b);})[_0x839f('0x1a')](function(_0x33df6e){logger['error']('CreateChatMessage',_0x33df6e[_0x839f('0x18')],_0x58fbee);_0x4c2c72(_0x55ffa2[_0x839f('0x15')](0x1f4,_0x33df6e[_0x839f('0x18')]));});});}; \ No newline at end of file +var _0x7fcf=['../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateChatMessage','ChatMessage','body','raw','lodash','util','bluebird','randomstring'];(function(_0x1ea301,_0x52a75e){var _0x36d758=function(_0x57eaed){while(--_0x57eaed){_0x1ea301['push'](_0x1ea301['shift']());}};_0x36d758(++_0x52a75e);}(_0x7fcf,0x128));var _0xf7fc=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7fcf[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xf7fc('0x0'));var util=require(_0xf7fc('0x1'));var moment=require('moment');var BPromise=require(_0xf7fc('0x2'));var rs=require(_0xf7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf7fc('0x4'));var logger=require(_0xf7fc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7fc('0x6'));var client=jayson[_0xf7fc('0x7')][_0xf7fc('0x8')]({'port':0x232a});config['redis']=_[_0xf7fc('0x9')](config[_0xf7fc('0xa')],{'host':_0xf7fc('0xb'),'port':0x18eb});var socket=require(_0xf7fc('0xc'))(new Redis(config['redis']));require(_0xf7fc('0xd'))[_0xf7fc('0xe')](socket);function respondWithRpcPromise(_0x3e20b9,_0x5c1f8f,_0xace7db){return new BPromise(function(_0x1d60ae,_0x1d75a3){return client[_0xf7fc('0xf')](_0x3e20b9,_0xace7db)[_0xf7fc('0x10')](function(_0x4db12e){logger['info'](_0xf7fc('0x11'),_0x5c1f8f,_0xf7fc('0x12'));logger[_0xf7fc('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5c1f8f,_0xf7fc('0x12'),JSON[_0xf7fc('0x14')](_0x4db12e));if(_0x4db12e['error']){if(_0x4db12e[_0xf7fc('0x15')][_0xf7fc('0x16')]===0x1f4){logger[_0xf7fc('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5c1f8f,_0x4db12e[_0xf7fc('0x15')][_0xf7fc('0x17')]);return _0x1d75a3(_0x4db12e[_0xf7fc('0x15')][_0xf7fc('0x17')]);}logger[_0xf7fc('0x15')](_0xf7fc('0x11'),_0x5c1f8f,_0x4db12e[_0xf7fc('0x15')][_0xf7fc('0x17')]);return _0x1d60ae(_0x4db12e['error'][_0xf7fc('0x17')]);}else{logger[_0xf7fc('0x18')](_0xf7fc('0x11'),_0x5c1f8f,_0xf7fc('0x12'));_0x1d60ae(_0x4db12e['result']['message']);}})[_0xf7fc('0x19')](function(_0x2226dc){logger[_0xf7fc('0x15')](_0xf7fc('0x11'),_0x5c1f8f,_0x2226dc);_0x1d75a3(_0x2226dc);});});}exports[_0xf7fc('0x1a')]=function(_0x493060){var _0x2634d1=this;return new Promise(function(_0x2ef355,_0x5052c0){return db[_0xf7fc('0x1b')]['create'](_0x493060[_0xf7fc('0x1c')],{'raw':_0x493060['options']?_0x493060['options'][_0xf7fc('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2926e2){logger[_0xf7fc('0x18')](_0xf7fc('0x1a'),_0x493060);logger[_0xf7fc('0x13')]('CreateChatMessage',_0x493060,JSON[_0xf7fc('0x14')](_0x2926e2));_0x2ef355(_0x2926e2);})['catch'](function(_0x43ede9){logger[_0xf7fc('0x15')](_0xf7fc('0x1a'),_0x43ede9[_0xf7fc('0x17')],_0x493060);_0x5052c0(_0x2634d1['error'](0x1f4,_0x43ede9['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index b4ef36f..c4baea4 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 _0x8ece=['update','emit','removeListener','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x3ddce0,_0x11741e){var _0x567d64=function(_0x29a45b){while(--_0x29a45b){_0x3ddce0['push'](_0x3ddce0['shift']());}};_0x567d64(++_0x11741e);}(_0x8ece,0x195));var _0xe8ec=function(_0x1f4ea0,_0xf62d9b){_0x1f4ea0=_0x1f4ea0-0x0;var _0xc3d0ca=_0x8ece[_0x1f4ea0];return _0xc3d0ca;};'use strict';var ChatMessageEvents=require(_0xe8ec('0x0'));var events=[_0xe8ec('0x1'),_0xe8ec('0x2'),_0xe8ec('0x3')];function createListener(_0x4dd5dd,_0x47b1c1){return function(_0xe18b82){_0x47b1c1[_0xe8ec('0x4')](_0x4dd5dd,_0xe18b82);};}function removeListener(_0x5047e7,_0x433734){return function(){ChatMessageEvents[_0xe8ec('0x5')](_0x5047e7,_0x433734);};}exports['register']=function(_0x346577){for(var _0x23fa35=0x0,_0x64ed4c=events[_0xe8ec('0x6')];_0x23fa35<_0x64ed4c;_0x23fa35++){var _0x3682cb=events[_0x23fa35];var _0x122f36=createListener(_0xe8ec('0x7')+_0x3682cb,_0x346577);ChatMessageEvents['on'](_0x3682cb,_0x122f36);}}; \ No newline at end of file +var _0xa41a=['emit','removeListener','./chatMessage.events','save','update'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xa41a,0x6b));var _0xaa41=function(_0xb3928,_0x16a3b5){_0xb3928=_0xb3928-0x0;var _0x5bca72=_0xa41a[_0xb3928];return _0x5bca72;};'use strict';var ChatMessageEvents=require(_0xaa41('0x0'));var events=[_0xaa41('0x1'),'remove',_0xaa41('0x2')];function createListener(_0x2a96ba,_0x43654a){return function(_0xc5ce74){_0x43654a[_0xaa41('0x3')](_0x2a96ba,_0xc5ce74);};}function removeListener(_0x3168be,_0x42896b){return function(){ChatMessageEvents[_0xaa41('0x4')](_0x3168be,_0x42896b);};}exports['register']=function(_0x2122a0){for(var _0x1ec9d4=0x0,_0x54bc5a=events['length'];_0x1ec9d4<_0x54bc5a;_0x1ec9d4++){var _0x179545=events[_0x1ec9d4];var _0x202cce=createListener('chatMessage:'+_0x179545,_0x2122a0);ChatMessageEvents['on'](_0x179545,_0x202cce);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 59f587a..7db2db0 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 _0xb314=['accept','reject','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','put','update'];(function(_0x34981e,_0x46cde5){var _0x41d93e=function(_0x22faba){while(--_0x22faba){_0x34981e['push'](_0x34981e['shift']());}};_0x41d93e(++_0x46cde5);}(_0xb314,0x173));var _0x4b31=function(_0x46b450,_0x1ba431){_0x46b450=_0x46b450-0x0;var _0x2f8c22=_0xb314[_0x46b450];return _0x2f8c22;};'use strict';var multer=require(_0x4b31('0x0'));var util=require('util');var path=require(_0x4b31('0x1'));var timeout=require(_0x4b31('0x2'));var express=require(_0x4b31('0x3'));var router=express[_0x4b31('0x4')]();var fs_extra=require(_0x4b31('0x5'));var auth=require(_0x4b31('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b31('0x7'));router[_0x4b31('0x8')]('/',auth[_0x4b31('0x9')](),controller[_0x4b31('0xa')]);router['get'](_0x4b31('0xb'),auth[_0x4b31('0x9')](),controller[_0x4b31('0xc')]);router['get'](_0x4b31('0xd'),auth[_0x4b31('0x9')](),controller[_0x4b31('0xe')]);router[_0x4b31('0xf')]('/',auth[_0x4b31('0x9')](),interaction[_0x4b31('0x10')](_0x4b31('0x11'),'chatmessage:create'),controller['create']);router[_0x4b31('0x12')]('/:id',controller[_0x4b31('0x13')]);router[_0x4b31('0x12')]('/:id/accept',auth[_0x4b31('0x9')](),controller[_0x4b31('0x14')]);router['put']('/:id/reject',auth[_0x4b31('0x9')](),controller[_0x4b31('0x15')]);router[_0x4b31('0x16')](_0x4b31('0xd'),auth[_0x4b31('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2c0d=['tracked','chat','chatmessage:create','update','put','accept','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x2c0d,0x12a));var _0xd2c0=function(_0x587b84,_0x58fd72){_0x587b84=_0x587b84-0x0;var _0x208284=_0x2c0d[_0x587b84];return _0x208284;};'use strict';var multer=require(_0xd2c0('0x0'));var util=require(_0xd2c0('0x1'));var path=require(_0xd2c0('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2c0('0x3'));var router=express[_0xd2c0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd2c0('0x5'));var config=require(_0xd2c0('0x6'));var controller=require(_0xd2c0('0x7'));router[_0xd2c0('0x8')]('/',auth[_0xd2c0('0x9')](),controller[_0xd2c0('0xa')]);router[_0xd2c0('0x8')](_0xd2c0('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xd2c0('0xc'),auth[_0xd2c0('0x9')](),controller['show']);router[_0xd2c0('0xd')]('/',auth[_0xd2c0('0x9')](),interaction[_0xd2c0('0xe')](_0xd2c0('0xf'),_0xd2c0('0x10')),controller['create']);router['put'](_0xd2c0('0xc'),controller[_0xd2c0('0x11')]);router[_0xd2c0('0x12')]('/:id/accept',auth[_0xd2c0('0x9')](),controller[_0xd2c0('0x13')]);router[_0xd2c0('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0xd2c0('0x14')]);router[_0xd2c0('0x15')]('/:id',auth[_0xd2c0('0x9')](),controller[_0xd2c0('0x16')]);module[_0xd2c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index da9adc5..fb27613 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 _0xe108=['TEXT','sequelize','exports'];(function(_0x2b0dc2,_0x22ad9b){var _0x3a5883=function(_0x1ae973){while(--_0x1ae973){_0x2b0dc2['push'](_0x2b0dc2['shift']());}};_0x3a5883(++_0x22ad9b);}(_0xe108,0xd9));var _0x8e10=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0xe108[_0x1a1b6e];return _0x571e2c;};'use strict';var Sequelize=require(_0x8e10('0x0'));module[_0x8e10('0x1')]={'body':{'type':Sequelize[_0x8e10('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x4c15=['sequelize','exports','TEXT','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c15,0x1c4));var _0x54c1=function(_0x3b04f2,_0x1e54d9){_0x3b04f2=_0x3b04f2-0x0;var _0x2ba2b4=_0x4c15[_0x3b04f2];return _0x2ba2b4;};'use strict';var Sequelize=require(_0x54c1('0x0'));module[_0x54c1('0x1')]={'body':{'type':Sequelize[_0x54c1('0x2')](_0x54c1('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 f5276fa..371361f 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x531b95,_0x17e320){var _0x4d4e0f=function(_0x1ab346){while(--_0x1ab346){_0x531b95['push'](_0x531b95['shift']());}};_0x4d4e0f(++_0x17e320);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x5c9bdc,_0x207c22){_0x5c9bdc=_0x5c9bdc-0x0;var _0x477fe1=_0x7a54[_0x5c9bdc];return _0x477fe1;};'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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 72fa32e..11ccf3a 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 _0xe535=['api','moment','path','rimraf','../../config/environment','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe535,0x6a));var _0x5e53=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xe535[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x5e53('0x0'));var util=require(_0x5e53('0x1'));var logger=require('../../config/logger')(_0x5e53('0x2'));var moment=require(_0x5e53('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e53('0x4'));var rimraf=require(_0x5e53('0x5'));var config=require(_0x5e53('0x6'));var attributes=require('./chatOfflineMessage.attributes');module[_0x5e53('0x7')]=function(_0x25725b,_0x1734bb){return _0x25725b[_0x5e53('0x8')](_0x5e53('0x9'),attributes,{'tableName':_0x5e53('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5e53('0xb')});}; \ No newline at end of file +var _0xffb3=['../../config/logger','moment','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x568bd7,_0x893b0){var _0x56844c=function(_0x512153){while(--_0x512153){_0x568bd7['push'](_0x568bd7['shift']());}};_0x56844c(++_0x893b0);}(_0xffb3,0x8d));var _0x3ffb=function(_0x47977b,_0x544e67){_0x47977b=_0x47977b-0x0;var _0x117401=_0xffb3[_0x47977b];return _0x117401;};'use strict';var _=require(_0x3ffb('0x0'));var util=require(_0x3ffb('0x1'));var logger=require(_0x3ffb('0x2'))('api');var moment=require(_0x3ffb('0x3'));var BPromise=require('bluebird');var rp=require(_0x3ffb('0x4'));var fs=require('fs');var path=require(_0x3ffb('0x5'));var rimraf=require('rimraf');var config=require(_0x3ffb('0x6'));var attributes=require(_0x3ffb('0x7'));module[_0x3ffb('0x8')]=function(_0x379c7b,_0x1de242){return _0x379c7b['define'](_0x3ffb('0x9'),attributes,{'tableName':_0x3ffb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3ffb('0xb'),'collate':_0x3ffb('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 51825f2..284acff 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 _0x0c19=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug'];(function(_0x5338ad,_0x2b68c3){var _0x1130f0=function(_0x4794e1){while(--_0x4794e1){_0x5338ad['push'](_0x5338ad['shift']());}};_0x1130f0(++_0x2b68c3);}(_0x0c19,0x168));var _0x90c1=function(_0x4ce144,_0x56dfbd){_0x4ce144=_0x4ce144-0x0;var _0x35ead8=_0x0c19[_0x4ce144];return _0x35ead8;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var moment=require(_0x90c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x90c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90c1('0x4'))['db'];var utils=require(_0x90c1('0x5'));var logger=require(_0x90c1('0x6'))(_0x90c1('0x7'));var config=require(_0x90c1('0x8'));var jayson=require(_0x90c1('0x9'));var client=jayson[_0x90c1('0xa')][_0x90c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x385df5,_0x494834,_0x497faa){return new BPromise(function(_0x4975bb,_0x186a94){return client['request'](_0x385df5,_0x497faa)['then'](function(_0x5f4e85){logger[_0x90c1('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x494834,'request\x20sent');logger[_0x90c1('0xd')](_0x90c1('0xe'),_0x494834,'request\x20sent',JSON[_0x90c1('0xf')](_0x5f4e85));if(_0x5f4e85[_0x90c1('0x10')]){if(_0x5f4e85[_0x90c1('0x10')][_0x90c1('0x11')]===0x1f4){logger[_0x90c1('0x10')](_0x90c1('0x12'),_0x494834,_0x5f4e85['error'][_0x90c1('0x13')]);return _0x186a94(_0x5f4e85[_0x90c1('0x10')][_0x90c1('0x13')]);}logger[_0x90c1('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x494834,_0x5f4e85['error'][_0x90c1('0x13')]);return _0x4975bb(_0x5f4e85['error'][_0x90c1('0x13')]);}else{logger[_0x90c1('0xc')](_0x90c1('0x12'),_0x494834,_0x90c1('0x14'));_0x4975bb(_0x5f4e85['result'][_0x90c1('0x13')]);}})[_0x90c1('0x15')](function(_0x3b31a4){logger[_0x90c1('0x10')](_0x90c1('0x12'),_0x494834,_0x3b31a4);_0x186a94(_0x3b31a4);});});} \ No newline at end of file +var _0xb40c=['request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x242838,_0x15bdc7){var _0x17309c=function(_0x502add){while(--_0x502add){_0x242838['push'](_0x242838['shift']());}};_0x17309c(++_0x15bdc7);}(_0xb40c,0x79));var _0xcb40=function(_0x213803,_0x1648a7){_0x213803=_0x213803-0x0;var _0xee5426=_0xb40c[_0x213803];return _0xee5426;};'use strict';var _=require(_0xcb40('0x0'));var util=require(_0xcb40('0x1'));var moment=require(_0xcb40('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb40('0x4'))['db'];var utils=require(_0xcb40('0x5'));var logger=require('../../config/logger')(_0xcb40('0x6'));var config=require(_0xcb40('0x7'));var jayson=require(_0xcb40('0x8'));var client=jayson[_0xcb40('0x9')][_0xcb40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3549f7,_0x5ed422,_0x51fdd8){return new BPromise(function(_0x21658c,_0x328f0a){return client[_0xcb40('0xb')](_0x3549f7,_0x51fdd8)[_0xcb40('0xc')](function(_0x23d1eb){logger['info'](_0xcb40('0xd'),_0x5ed422,_0xcb40('0xe'));logger['debug'](_0xcb40('0xf'),_0x5ed422,_0xcb40('0xe'),JSON[_0xcb40('0x10')](_0x23d1eb));if(_0x23d1eb[_0xcb40('0x11')]){if(_0x23d1eb['error'][_0xcb40('0x12')]===0x1f4){logger[_0xcb40('0x11')](_0xcb40('0xd'),_0x5ed422,_0x23d1eb[_0xcb40('0x11')][_0xcb40('0x13')]);return _0x328f0a(_0x23d1eb[_0xcb40('0x11')][_0xcb40('0x13')]);}logger[_0xcb40('0x11')](_0xcb40('0xd'),_0x5ed422,_0x23d1eb[_0xcb40('0x11')][_0xcb40('0x13')]);return _0x21658c(_0x23d1eb[_0xcb40('0x11')]['message']);}else{logger['info'](_0xcb40('0xd'),_0x5ed422,_0xcb40('0xe'));_0x21658c(_0x23d1eb[_0xcb40('0x14')][_0xcb40('0x13')]);}})[_0xcb40('0x15')](function(_0x302822){logger[_0xcb40('0x11')](_0xcb40('0xd'),_0x5ed422,_0x302822);_0x328f0a(_0x302822);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2d58efb..056ed0e 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 _0x828c=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x828c,0xbd));var _0xc828=function(_0x245b66,_0x474c4f){_0x245b66=_0x245b66-0x0;var _0x3240c9=_0x828c[_0x245b66];return _0x3240c9;};'use strict';var multer=require(_0xc828('0x0'));var util=require('util');var path=require(_0xc828('0x1'));var timeout=require(_0xc828('0x2'));var express=require(_0xc828('0x3'));var router=express[_0xc828('0x4')]();var fs_extra=require(_0xc828('0x5'));var auth=require(_0xc828('0x6'));var interaction=require(_0xc828('0x7'));var config=require(_0xc828('0x8'));var controller=require(_0xc828('0x9'));router[_0xc828('0xa')]('/',auth[_0xc828('0xb')](),controller[_0xc828('0xc')]);router[_0xc828('0xa')](_0xc828('0xd'),auth[_0xc828('0xb')](),controller[_0xc828('0xe')]);router[_0xc828('0xa')](_0xc828('0xf'),auth[_0xc828('0xb')](),controller[_0xc828('0x10')]);router[_0xc828('0x11')]('/',auth['isAuthenticated'](),controller[_0xc828('0x12')]);router[_0xc828('0x13')](_0xc828('0xf'),auth[_0xc828('0xb')](),controller[_0xc828('0x14')]);router[_0xc828('0x15')](_0xc828('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xc828('0x16')]=router; \ No newline at end of file +var _0x3984=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2d68c2,_0x10efec){var _0x4f5a47=function(_0x4109df){while(--_0x4109df){_0x2d68c2['push'](_0x2d68c2['shift']());}};_0x4f5a47(++_0x10efec);}(_0x3984,0xd8));var _0x4398=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0x3984[_0x1d04b5];return _0x161342;};'use strict';var multer=require('multer');var util=require(_0x4398('0x0'));var path=require(_0x4398('0x1'));var timeout=require(_0x4398('0x2'));var express=require(_0x4398('0x3'));var router=express[_0x4398('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4398('0x5'));var interaction=require(_0x4398('0x6'));var config=require(_0x4398('0x7'));var controller=require(_0x4398('0x8'));router[_0x4398('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4398('0xa'),auth[_0x4398('0xb')](),controller['describe']);router['get']('/:id',auth[_0x4398('0xb')](),controller[_0x4398('0xc')]);router[_0x4398('0xd')]('/',auth[_0x4398('0xb')](),controller[_0x4398('0xe')]);router[_0x4398('0xf')](_0x4398('0x10'),auth[_0x4398('0xb')](),controller['update']);router[_0x4398('0x11')](_0x4398('0x10'),auth[_0x4398('0xb')](),controller[_0x4398('0x12')]);module[_0x4398('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a5d9a2c..3da6fb3 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 _0x0cd4=['timeout','INTEGER','STRING','ENUM','mouseOver'];(function(_0x54ff45,_0x1ad967){var _0x40d81e=function(_0x35c241){while(--_0x35c241){_0x54ff45['push'](_0x54ff45['shift']());}};_0x40d81e(++_0x1ad967);}(_0x0cd4,0x93));var _0x40cd=function(_0x4e2f68,_0x490fe5){_0x4e2f68=_0x4e2f68-0x0;var _0x783f9d=_0x0cd4[_0x4e2f68];return _0x783f9d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x40cd('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x40cd('0x1')](_0x40cd('0x2'),_0x40cd('0x3')),'defaultValue':_0x40cd('0x2')},'selector':{'type':Sequelize[_0x40cd('0x0')]},'timeout':{'type':Sequelize[_0x40cd('0x4')]}}; \ No newline at end of file +var _0xfe5b=['ENUM','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0xa29b94,_0x473ccd){var _0x2da5c3=function(_0xc06bea){while(--_0xc06bea){_0xa29b94['push'](_0xa29b94['shift']());}};_0x2da5c3(++_0x473ccd);}(_0xfe5b,0x16b));var _0xbfe5=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xfe5b[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0xbfe5('0x0'));module[_0xbfe5('0x1')]={'name':{'type':Sequelize[_0xbfe5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbfe5('0x3')](_0xbfe5('0x4'),'timeout'),'defaultValue':_0xbfe5('0x4')},'selector':{'type':Sequelize[_0xbfe5('0x2')]},'timeout':{'type':Sequelize[_0xbfe5('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f491c76..9e08882 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 _0x36bb=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','show','model','ChatProactiveAction','rawAttributes','keys','query','filters','intersection','attributes','fields','length','merge','options','catch','create','body','params','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x12e509,_0x3fd09a){var _0x4bafbc=function(_0x340572){while(--_0x340572){_0x12e509['push'](_0x12e509['shift']());}};_0x4bafbc(++_0x3fd09a);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb36b('0x0'));var rimraf=require(_0xb36b('0x1'));var zipdir=require(_0xb36b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb36b('0x3'));var moment=require(_0xb36b('0x4'));var BPromise=require(_0xb36b('0x5'));var Mustache=require(_0xb36b('0x6'));var util=require(_0xb36b('0x7'));var path=require(_0xb36b('0x8'));var sox=require(_0xb36b('0x9'));var csv=require(_0xb36b('0xa'));var ejs=require(_0xb36b('0xb'));var fs=require('fs');var fs_extra=require(_0xb36b('0xc'));var _=require(_0xb36b('0xd'));var squel=require(_0xb36b('0xe'));var crypto=require(_0xb36b('0xf'));var jsforce=require(_0xb36b('0x10'));var deskjs=require(_0xb36b('0x11'));var toCsv=require(_0xb36b('0xa'));var querystring=require(_0xb36b('0x12'));var Papa=require(_0xb36b('0x13'));var Redis=require(_0xb36b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb36b('0x15'));var as=require(_0xb36b('0x16'));var hardwareService=require(_0xb36b('0x17'));var logger=require('../../config/logger')(_0xb36b('0x18'));var utils=require(_0xb36b('0x19'));var config=require(_0xb36b('0x1a'));var licenseUtil=require(_0xb36b('0x1b'));var db=require(_0xb36b('0x1c'))['db'];function respondWithStatusCode(_0x11f775,_0x1ad623){_0x1ad623=_0x1ad623||0xcc;return function(_0x1c266a){if(_0x1c266a){return _0x11f775[_0xb36b('0x1d')](_0x1ad623);}return _0x11f775[_0xb36b('0x1e')](_0x1ad623)[_0xb36b('0x1f')]();};}function respondWithResult(_0x59af21,_0x1aef0b){_0x1aef0b=_0x1aef0b||0xc8;return function(_0x4c2c46){if(_0x4c2c46){return _0x59af21['status'](_0x1aef0b)[_0xb36b('0x20')](_0x4c2c46);}};}function respondWithFilteredResult(_0x329f60,_0x23e960){return function(_0x4b74f1){if(_0x4b74f1){var _0x5c7255=typeof _0x23e960[_0xb36b('0x21')]==='undefined'&&typeof _0x23e960[_0xb36b('0x22')]===_0xb36b('0x23');var _0xfe29fc=_0x4b74f1[_0xb36b('0x24')];var _0x53ec0e=_0x5c7255?0x0:_0x23e960[_0xb36b('0x21')];var _0x211a91=_0x5c7255?_0x4b74f1[_0xb36b('0x24')]:_0x23e960['offset']+_0x23e960[_0xb36b('0x22')];var _0x572d88;if(_0x211a91>=_0xfe29fc){_0x211a91=_0xfe29fc;_0x572d88=0xc8;}else{_0x572d88=0xce;}_0x329f60[_0xb36b('0x1e')](_0x572d88);return _0x329f60[_0xb36b('0x25')](_0xb36b('0x26'),_0x53ec0e+'-'+_0x211a91+'/'+_0xfe29fc)[_0xb36b('0x20')](_0x4b74f1);}return null;};}function patchUpdates(_0x4049fa){return function(_0x5f6648){try{jsonpatch[_0xb36b('0x27')](_0x5f6648,_0x4049fa,!![]);}catch(_0x5c68de){return BPromise[_0xb36b('0x28')](_0x5c68de);}return _0x5f6648['save']();};}function saveUpdates(_0x218995,_0x52b74f){return function(_0x3b8030){if(_0x3b8030){return _0x3b8030[_0xb36b('0x29')](_0x218995)[_0xb36b('0x2a')](function(_0x174795){return _0x174795;});}return null;};}function removeEntity(_0x2fe32e,_0x5f4a25){return function(_0x474083){if(_0x474083){return _0x474083[_0xb36b('0x2b')]()[_0xb36b('0x2a')](function(){_0x2fe32e['status'](0xcc)[_0xb36b('0x1f')]();});}};}function handleEntityNotFound(_0x4a58d4,_0x5dbe3b){return function(_0x50e8e4){if(!_0x50e8e4){_0x4a58d4[_0xb36b('0x1d')](0x194);}return _0x50e8e4;};}function handleError(_0x1d904e,_0x2e8402){_0x2e8402=_0x2e8402||0x1f4;return function(_0x5c4aee){logger[_0xb36b('0x2c')](_0x5c4aee[_0xb36b('0x2d')]);if(_0x5c4aee[_0xb36b('0x2e')]){delete _0x5c4aee[_0xb36b('0x2e')];}_0x1d904e['status'](_0x2e8402)['send'](_0x5c4aee);};}exports[_0xb36b('0x2f')]=function(_0x2724bf,_0x24149b){var _0x138f74={'raw':!![],'where':{'id':_0x2724bf['params']['id']}},_0x4aabf5={};_0x4aabf5[_0xb36b('0x30')]=_['keys'](db[_0xb36b('0x31')][_0xb36b('0x32')]);_0x4aabf5['query']=_[_0xb36b('0x33')](_0x2724bf[_0xb36b('0x34')]);_0x4aabf5[_0xb36b('0x35')]=_[_0xb36b('0x36')](_0x4aabf5[_0xb36b('0x30')],_0x4aabf5[_0xb36b('0x34')]);_0x138f74[_0xb36b('0x37')]=_[_0xb36b('0x36')](_0x4aabf5[_0xb36b('0x30')],qs[_0xb36b('0x38')](_0x2724bf[_0xb36b('0x34')][_0xb36b('0x38')]));_0x138f74['attributes']=_0x138f74['attributes'][_0xb36b('0x39')]?_0x138f74[_0xb36b('0x37')]:_0x4aabf5['model'];if(_0x2724bf[_0xb36b('0x34')]['includeAll']){_0x138f74['include']=[{'all':!![]}];}_0x138f74=_[_0xb36b('0x3a')]({},_0x138f74,_0x2724bf[_0xb36b('0x3b')]);return db[_0xb36b('0x31')]['find'](_0x138f74)['then'](handleEntityNotFound(_0x24149b,null))[_0xb36b('0x2a')](respondWithResult(_0x24149b,null))[_0xb36b('0x3c')](handleError(_0x24149b,null));};exports[_0xb36b('0x3d')]=function(_0x46bde0,_0x39c80e){return db[_0xb36b('0x31')]['create'](_0x46bde0[_0xb36b('0x3e')],{})[_0xb36b('0x2a')](respondWithResult(_0x39c80e,0xc9))[_0xb36b('0x3c')](handleError(_0x39c80e,null));};exports[_0xb36b('0x29')]=function(_0x301e12,_0x185bb2){if(_0x301e12[_0xb36b('0x3e')]['id']){delete _0x301e12[_0xb36b('0x3e')]['id'];}return db[_0xb36b('0x31')]['find']({'where':{'id':_0x301e12[_0xb36b('0x3f')]['id']}})[_0xb36b('0x2a')](handleEntityNotFound(_0x185bb2,null))[_0xb36b('0x2a')](saveUpdates(_0x301e12['body'],null))[_0xb36b('0x2a')](respondWithResult(_0x185bb2,null))[_0xb36b('0x3c')](handleError(_0x185bb2,null));};exports[_0xb36b('0x2b')]=function(_0x26b77f,_0x55b694){return db['ChatProactiveAction'][_0xb36b('0x40')]({'where':{'id':_0x26b77f[_0xb36b('0x3f')]['id']}})[_0xb36b('0x2a')](handleEntityNotFound(_0x55b694,null))[_0xb36b('0x2a')](removeEntity(_0x55b694,null))[_0xb36b('0x3c')](handleError(_0x55b694,null));}; \ No newline at end of file +var _0x37c5=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','update','then','stack','name','show','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','ChatProactiveAction','body','find','params','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x37c5,0xa7));var _0x537c=function(_0x507df1,_0x48e5c3){_0x507df1=_0x507df1-0x0;var _0x45aa0d=_0x37c5[_0x507df1];return _0x45aa0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x537c('0x0'));var zipdir=require(_0x537c('0x1'));var jsonpatch=require(_0x537c('0x2'));var rp=require(_0x537c('0x3'));var moment=require(_0x537c('0x4'));var BPromise=require(_0x537c('0x5'));var Mustache=require(_0x537c('0x6'));var util=require(_0x537c('0x7'));var path=require(_0x537c('0x8'));var sox=require(_0x537c('0x9'));var csv=require('to-csv');var ejs=require(_0x537c('0xa'));var fs=require('fs');var fs_extra=require(_0x537c('0xb'));var _=require(_0x537c('0xc'));var squel=require('squel');var crypto=require(_0x537c('0xd'));var jsforce=require(_0x537c('0xe'));var deskjs=require(_0x537c('0xf'));var toCsv=require(_0x537c('0x10'));var querystring=require('querystring');var Papa=require(_0x537c('0x11'));var Redis=require(_0x537c('0x12'));var authService=require(_0x537c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x537c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x537c('0x15'));var utils=require('../../config/utils');var config=require(_0x537c('0x16'));var licenseUtil=require(_0x537c('0x17'));var db=require(_0x537c('0x18'))['db'];function respondWithStatusCode(_0x473606,_0x1ecb98){_0x1ecb98=_0x1ecb98||0xcc;return function(_0x4554be){if(_0x4554be){return _0x473606[_0x537c('0x19')](_0x1ecb98);}return _0x473606[_0x537c('0x1a')](_0x1ecb98)[_0x537c('0x1b')]();};}function respondWithResult(_0x577981,_0x8d0c3){_0x8d0c3=_0x8d0c3||0xc8;return function(_0x405e39){if(_0x405e39){return _0x577981[_0x537c('0x1a')](_0x8d0c3)[_0x537c('0x1c')](_0x405e39);}};}function respondWithFilteredResult(_0x116453,_0x392421){return function(_0x2158e2){if(_0x2158e2){var _0x3776c3=typeof _0x392421[_0x537c('0x1d')]==='undefined'&&typeof _0x392421[_0x537c('0x1e')]==='undefined';var _0x55df08=_0x2158e2[_0x537c('0x1f')];var _0x237be8=_0x3776c3?0x0:_0x392421[_0x537c('0x1d')];var _0x5f3776=_0x3776c3?_0x2158e2[_0x537c('0x1f')]:_0x392421[_0x537c('0x1d')]+_0x392421['limit'];var _0x5ca4d5;if(_0x5f3776>=_0x55df08){_0x5f3776=_0x55df08;_0x5ca4d5=0xc8;}else{_0x5ca4d5=0xce;}_0x116453[_0x537c('0x1a')](_0x5ca4d5);return _0x116453['set']('Content-Range',_0x237be8+'-'+_0x5f3776+'/'+_0x55df08)[_0x537c('0x1c')](_0x2158e2);}return null;};}function patchUpdates(_0x32be40){return function(_0x5cfd81){try{jsonpatch[_0x537c('0x20')](_0x5cfd81,_0x32be40,!![]);}catch(_0x259ab2){return BPromise['reject'](_0x259ab2);}return _0x5cfd81['save']();};}function saveUpdates(_0x1a91d1,_0x47bece){return function(_0x5d8b9e){if(_0x5d8b9e){return _0x5d8b9e[_0x537c('0x21')](_0x1a91d1)[_0x537c('0x22')](function(_0x13fd5e){return _0x13fd5e;});}return null;};}function removeEntity(_0x28a35a,_0x3698bc){return function(_0x26ab7d){if(_0x26ab7d){return _0x26ab7d['destroy']()[_0x537c('0x22')](function(){_0x28a35a[_0x537c('0x1a')](0xcc)[_0x537c('0x1b')]();});}};}function handleEntityNotFound(_0xcd7d47,_0x428e5d){return function(_0x4b6af1){if(!_0x4b6af1){_0xcd7d47['sendStatus'](0x194);}return _0x4b6af1;};}function handleError(_0x59442f,_0x403ff6){_0x403ff6=_0x403ff6||0x1f4;return function(_0x1fa0ca){logger['error'](_0x1fa0ca[_0x537c('0x23')]);if(_0x1fa0ca[_0x537c('0x24')]){delete _0x1fa0ca[_0x537c('0x24')];}_0x59442f['status'](_0x403ff6)['send'](_0x1fa0ca);};}exports[_0x537c('0x25')]=function(_0x44cc94,_0x11c11e){var _0x4e5f18={'raw':!![],'where':{'id':_0x44cc94['params']['id']}},_0x49d60b={};_0x49d60b[_0x537c('0x26')]=_[_0x537c('0x27')](db['ChatProactiveAction']['rawAttributes']);_0x49d60b['query']=_['keys'](_0x44cc94[_0x537c('0x28')]);_0x49d60b[_0x537c('0x29')]=_[_0x537c('0x2a')](_0x49d60b['model'],_0x49d60b[_0x537c('0x28')]);_0x4e5f18[_0x537c('0x2b')]=_[_0x537c('0x2a')](_0x49d60b['model'],qs[_0x537c('0x2c')](_0x44cc94[_0x537c('0x28')][_0x537c('0x2c')]));_0x4e5f18['attributes']=_0x4e5f18['attributes'][_0x537c('0x2d')]?_0x4e5f18[_0x537c('0x2b')]:_0x49d60b[_0x537c('0x26')];if(_0x44cc94[_0x537c('0x28')][_0x537c('0x2e')]){_0x4e5f18[_0x537c('0x2f')]=[{'all':!![]}];}_0x4e5f18=_[_0x537c('0x30')]({},_0x4e5f18,_0x44cc94[_0x537c('0x31')]);return db['ChatProactiveAction']['find'](_0x4e5f18)[_0x537c('0x22')](handleEntityNotFound(_0x11c11e,null))[_0x537c('0x22')](respondWithResult(_0x11c11e,null))['catch'](handleError(_0x11c11e,null));};exports[_0x537c('0x32')]=function(_0xf7a818,_0x116b5e){return db[_0x537c('0x33')][_0x537c('0x32')](_0xf7a818['body'],{})[_0x537c('0x22')](respondWithResult(_0x116b5e,0xc9))['catch'](handleError(_0x116b5e,null));};exports['update']=function(_0x552154,_0x5cea88){if(_0x552154[_0x537c('0x34')]['id']){delete _0x552154[_0x537c('0x34')]['id'];}return db[_0x537c('0x33')][_0x537c('0x35')]({'where':{'id':_0x552154[_0x537c('0x36')]['id']}})[_0x537c('0x22')](handleEntityNotFound(_0x5cea88,null))[_0x537c('0x22')](saveUpdates(_0x552154[_0x537c('0x34')],null))[_0x537c('0x22')](respondWithResult(_0x5cea88,null))[_0x537c('0x37')](handleError(_0x5cea88,null));};exports[_0x537c('0x38')]=function(_0x2dcbca,_0x28b222){return db[_0x537c('0x33')]['find']({'where':{'id':_0x2dcbca[_0x537c('0x36')]['id']}})['then'](handleEntityNotFound(_0x28b222,null))[_0x537c('0x22')](removeEntity(_0x28b222,null))[_0x537c('0x37')](handleError(_0x28b222,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2a05a5c..881d609 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 _0xd1a4=['./chatProactiveAction.attributes','exports','define','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xd1a4,0x107));var _0x4d1a=function(_0x3e1dff,_0xd692fd){_0x3e1dff=_0x3e1dff-0x0;var _0x598672=_0xd1a4[_0x3e1dff];return _0x598672;};'use strict';var _=require('lodash');var util=require(_0x4d1a('0x0'));var logger=require(_0x4d1a('0x1'))(_0x4d1a('0x2'));var moment=require('moment');var BPromise=require(_0x4d1a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d1a('0x4'));var rimraf=require(_0x4d1a('0x5'));var config=require(_0x4d1a('0x6'));var attributes=require(_0x4d1a('0x7'));module[_0x4d1a('0x8')]=function(_0x422773,_0x175f71){return _0x422773[_0x4d1a('0x9')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe833=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x301bb2,_0xc4169c){var _0x51b5ec=function(_0x3e36e7){while(--_0x3e36e7){_0x301bb2['push'](_0x301bb2['shift']());}};_0x51b5ec(++_0xc4169c);}(_0xe833,0xd3));var _0x3e83=function(_0x25865b,_0x341f3d){_0x25865b=_0x25865b-0x0;var _0x56175b=_0xe833[_0x25865b];return _0x56175b;};'use strict';var _=require(_0x3e83('0x0'));var util=require(_0x3e83('0x1'));var logger=require(_0x3e83('0x2'))(_0x3e83('0x3'));var moment=require(_0x3e83('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e83('0x5'));var fs=require('fs');var path=require(_0x3e83('0x6'));var rimraf=require(_0x3e83('0x7'));var config=require(_0x3e83('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x3e83('0x9')]=function(_0x2a28ac,_0x5e1424){return _0x2a28ac[_0x3e83('0xa')](_0x3e83('0xb'),attributes,{'tableName':_0x3e83('0xc'),'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 56a4c3c..ecd17fe 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 _0xaf3a=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x843ff,_0x339e63){var _0x20a2ce=function(_0x2677a7){while(--_0x2677a7){_0x843ff['push'](_0x843ff['shift']());}};_0x20a2ce(++_0x339e63);}(_0xaf3a,0x148));var _0xaaf3=function(_0xc9cd47,_0x35a546){_0xc9cd47=_0xc9cd47-0x0;var _0x26827e=_0xaf3a[_0xc9cd47];return _0x26827e;};'use strict';var _=require(_0xaaf3('0x0'));var util=require(_0xaaf3('0x1'));var moment=require(_0xaaf3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaf3('0x3'));var db=require(_0xaaf3('0x4'))['db'];var utils=require(_0xaaf3('0x5'));var logger=require(_0xaaf3('0x6'))(_0xaaf3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c1c1b,_0x58bb01,_0x2cd3d2){return new BPromise(function(_0x373b7e,_0xa2892a){return client[_0xaaf3('0x8')](_0x5c1c1b,_0x2cd3d2)[_0xaaf3('0x9')](function(_0x3f96cb){logger['info'](_0xaaf3('0xa'),_0x58bb01,_0xaaf3('0xb'));logger['debug'](_0xaaf3('0xc'),_0x58bb01,_0xaaf3('0xb'),JSON[_0xaaf3('0xd')](_0x3f96cb));if(_0x3f96cb[_0xaaf3('0xe')]){if(_0x3f96cb[_0xaaf3('0xe')]['code']===0x1f4){logger[_0xaaf3('0xe')](_0xaaf3('0xa'),_0x58bb01,_0x3f96cb[_0xaaf3('0xe')]['message']);return _0xa2892a(_0x3f96cb[_0xaaf3('0xe')]['message']);}logger[_0xaaf3('0xe')](_0xaaf3('0xa'),_0x58bb01,_0x3f96cb[_0xaaf3('0xe')][_0xaaf3('0xf')]);return _0x373b7e(_0x3f96cb[_0xaaf3('0xe')][_0xaaf3('0xf')]);}else{logger['info'](_0xaaf3('0xa'),_0x58bb01,'request\x20sent');_0x373b7e(_0x3f96cb[_0xaaf3('0x10')][_0xaaf3('0xf')]);}})['catch'](function(_0x2a03b0){logger[_0xaaf3('0xe')](_0xaaf3('0xa'),_0x58bb01,_0x2a03b0);_0xa2892a(_0x2a03b0);});});} \ No newline at end of file +var _0x928a=['../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x271e7d,_0x5667b7){var _0x5d8692=function(_0x34b1f0){while(--_0x34b1f0){_0x271e7d['push'](_0x271e7d['shift']());}};_0x5d8692(++_0x5667b7);}(_0x928a,0x19b));var _0xa928=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x928a[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0xa928('0x0'));var moment=require(_0xa928('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa928('0x2'));var db=require(_0xa928('0x3'))['db'];var utils=require(_0xa928('0x4'));var logger=require(_0xa928('0x5'))(_0xa928('0x6'));var config=require(_0xa928('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa928('0x8')][_0xa928('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49a47d,_0x1b9614,_0x1f5192){return new BPromise(function(_0x419d6e,_0x288dec){return client[_0xa928('0xa')](_0x49a47d,_0x1f5192)[_0xa928('0xb')](function(_0x39acdd){logger[_0xa928('0xc')](_0xa928('0xd'),_0x1b9614,_0xa928('0xe'));logger[_0xa928('0xf')](_0xa928('0x10'),_0x1b9614,_0xa928('0xe'),JSON[_0xa928('0x11')](_0x39acdd));if(_0x39acdd[_0xa928('0x12')]){if(_0x39acdd[_0xa928('0x12')]['code']===0x1f4){logger[_0xa928('0x12')](_0xa928('0xd'),_0x1b9614,_0x39acdd[_0xa928('0x12')][_0xa928('0x13')]);return _0x288dec(_0x39acdd['error'][_0xa928('0x13')]);}logger[_0xa928('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x1b9614,_0x39acdd['error'][_0xa928('0x13')]);return _0x419d6e(_0x39acdd[_0xa928('0x12')][_0xa928('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x1b9614,_0xa928('0xe'));_0x419d6e(_0x39acdd[_0xa928('0x14')]['message']);}})[_0xa928('0x15')](function(_0x1e3622){logger[_0xa928('0x12')](_0xa928('0xd'),_0x1b9614,_0x1e3622);_0x288dec(_0x1e3622);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c1304ab..a12acdd 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 _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x4f0b66,_0x2dc518){var _0x2660ee=function(_0x45b4d4){while(--_0x45b4d4){_0x4f0b66['push'](_0x4f0b66['shift']());}};_0x2660ee(++_0x2dc518);}(_0xd8fb,0x99));var _0xbd8f=function(_0x11de33,_0x2947b2){_0x11de33=_0x11de33-0x0;var _0x34ffb1=_0xd8fb[_0x11de33];return _0x34ffb1;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file +var _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','exports'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x2bd8,0x130));var _0x82bd=function(_0x1ab500,_0x3f27a8){_0x1ab500=_0x1ab500-0x0;var _0x23e01b=_0x2bd8[_0x1ab500];return _0x23e01b;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')](_0x82bd('0xa'),auth['isAuthenticated'](),controller[_0x82bd('0xb')]);router[_0x82bd('0xc')]('/',auth[_0x82bd('0xd')](),controller[_0x82bd('0xe')]);router['put'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x82bd('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b930573..c28e0c6 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 _0x2b93=['rrmemory','beepall','roundrobin','exports','name','STRING','ENUM'];(function(_0x261e64,_0x4cc616){var _0xd05e0a=function(_0x460bd1){while(--_0x460bd1){_0x261e64['push'](_0x261e64['shift']());}};_0xd05e0a(++_0x4cc616);}(_0x2b93,0xce));var _0x32b9=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x2b93[_0x52085a];return _0x5afc1a;};'use strict';var Sequelize=require('sequelize');module[_0x32b9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x32b9('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x32b9('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x32b9('0x3')](_0x32b9('0x4'),_0x32b9('0x5'),_0x32b9('0x6'))}}; \ No newline at end of file +var _0x1442=['sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x58d3a6,_0x3cae7a){var _0x242932=function(_0x1a4896){while(--_0x1a4896){_0x58d3a6['push'](_0x58d3a6['shift']());}};_0x242932(++_0x3cae7a);}(_0x1442,0xa2));var _0x2144=function(_0x37f3c4,_0x4d3cbf){_0x37f3c4=_0x37f3c4-0x0;var _0x12764a=_0x1442[_0x37f3c4];return _0x12764a;};'use strict';var Sequelize=require(_0x2144('0x0'));module[_0x2144('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2144('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2144('0x3')]},'timeout':{'type':Sequelize[_0x2144('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2144('0x5')](_0x2144('0x6'),_0x2144('0x7'),_0x2144('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 23ac0db..7349ddf 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 _0x6428=['request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','get','UserProfileResource','stack','send','index','map','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueue','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','UserChatQueue','rawAttributes','User','UserId','chatPause','updatedAt','createdAt','format','%s/%s','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','ChatQueue,\x20%s,\x20%s'];(function(_0x5af7f1,_0xe41703){var _0x377013=function(_0x2135ff){while(--_0x2135ff){_0x5af7f1['push'](_0x5af7f1['shift']());}};_0x377013(++_0xe41703);}(_0x6428,0x111));var _0x8642=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x6428[_0x54d4a8];return _0x3b321b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8642('0x0'));var jsonpatch=require(_0x8642('0x1'));var rp=require(_0x8642('0x2'));var moment=require(_0x8642('0x3'));var BPromise=require(_0x8642('0x4'));var Mustache=require('mustache');var util=require(_0x8642('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8642('0x6'));var ejs=require(_0x8642('0x7'));var fs=require('fs');var fs_extra=require(_0x8642('0x8'));var _=require('lodash');var squel=require(_0x8642('0x9'));var crypto=require(_0x8642('0xa'));var jsforce=require(_0x8642('0xb'));var deskjs=require(_0x8642('0xc'));var toCsv=require(_0x8642('0x6'));var querystring=require('querystring');var Papa=require(_0x8642('0xd'));var Redis=require(_0x8642('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8642('0xf'));var logger=require(_0x8642('0x10'))(_0x8642('0x11'));var utils=require('../../config/utils');var config=require(_0x8642('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8642('0x13'))['db'];config['redis']=_[_0x8642('0x14')](config[_0x8642('0x15')],{'host':_0x8642('0x16'),'port':0x18eb});var socket=require(_0x8642('0x17'))(new Redis(config['redis']));require(_0x8642('0x18'))[_0x8642('0x19')](socket);var jayson=require(_0x8642('0x1a'));var client=jayson['client'][_0x8642('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2f5d0f,_0x2b5abb,_0x1e8df6,_0x48c1e7){return new BPromise(function(_0x3a95b5,_0x28233c){var _0x15c6fa=_0x48c1e7||client;return _0x15c6fa[_0x8642('0x1c')](_0x2f5d0f,_0x1e8df6)[_0x8642('0x1d')](function(_0x19f6cc){logger['info'](_0x8642('0x1e'),_0x2b5abb,_0x8642('0x1f'));logger[_0x8642('0x20')](_0x8642('0x21'),_0x2b5abb,_0x8642('0x1f'),JSON[_0x8642('0x22')](_0x19f6cc));if(_0x19f6cc['error']){if(_0x19f6cc['error'][_0x8642('0x23')]===0x1f4){logger[_0x8642('0x24')](_0x8642('0x1e'),_0x2b5abb,_0x19f6cc[_0x8642('0x24')][_0x8642('0x25')]);return _0x28233c(_0x19f6cc[_0x8642('0x24')]['message']);}logger[_0x8642('0x24')](_0x8642('0x1e'),_0x2b5abb,_0x19f6cc[_0x8642('0x24')][_0x8642('0x25')]);return _0x3a95b5(_0x19f6cc[_0x8642('0x24')][_0x8642('0x25')]);}else{logger[_0x8642('0x26')](_0x8642('0x1e'),_0x2b5abb,_0x8642('0x1f'));_0x3a95b5(_0x19f6cc['result'][_0x8642('0x25')]);}})[_0x8642('0x27')](function(_0x1d8949){logger[_0x8642('0x24')](_0x8642('0x1e'),_0x2b5abb,_0x1d8949);_0x28233c(_0x1d8949);});});}function respondWithStatusCode(_0x4dd720,_0x492e7d){_0x492e7d=_0x492e7d||0xcc;return function(_0x1e66e1){if(_0x1e66e1){return _0x4dd720[_0x8642('0x28')](_0x492e7d);}return _0x4dd720[_0x8642('0x29')](_0x492e7d)[_0x8642('0x2a')]();};}function respondWithResult(_0x25418a,_0x27d04a){_0x27d04a=_0x27d04a||0xc8;return function(_0x18cec0){if(_0x18cec0){return _0x25418a['status'](_0x27d04a)[_0x8642('0x2b')](_0x18cec0);}};}function respondWithFilteredResult(_0x982e43,_0x3bd213){return function(_0x2dd7ec){if(_0x2dd7ec){var _0x44678d=typeof _0x3bd213[_0x8642('0x2c')]===_0x8642('0x2d')&&typeof _0x3bd213[_0x8642('0x2e')]===_0x8642('0x2d');var _0x1f4856=_0x2dd7ec['count'];var _0x50d605=_0x44678d?0x0:_0x3bd213[_0x8642('0x2c')];var _0x47e495=_0x44678d?_0x2dd7ec[_0x8642('0x2f')]:_0x3bd213[_0x8642('0x2c')]+_0x3bd213[_0x8642('0x2e')];var _0x2d1667;if(_0x47e495>=_0x1f4856){_0x47e495=_0x1f4856;_0x2d1667=0xc8;}else{_0x2d1667=0xce;}_0x982e43[_0x8642('0x29')](_0x2d1667);return _0x982e43[_0x8642('0x30')]('Content-Range',_0x50d605+'-'+_0x47e495+'/'+_0x1f4856)[_0x8642('0x2b')](_0x2dd7ec);}return null;};}function patchUpdates(_0x1d000c){return function(_0x9645a9){try{jsonpatch[_0x8642('0x31')](_0x9645a9,_0x1d000c,!![]);}catch(_0x7a396c){return BPromise[_0x8642('0x32')](_0x7a396c);}return _0x9645a9[_0x8642('0x33')]();};}function saveUpdates(_0x495297,_0x3012e5){return function(_0x3ec589){if(_0x3ec589){return _0x3ec589['update'](_0x495297)[_0x8642('0x1d')](function(_0x2519b6){return _0x2519b6;});}return null;};}function removeEntity(_0x463496,_0x25cc91){return function(_0x4c8e35){if(_0x4c8e35){return _0x4c8e35['destroy']()['then'](function(){var _0x1f84ba=_0x4c8e35[_0x8642('0x34')]({'plain':!![]});var _0x2872bd='ChatQueues';return db[_0x8642('0x35')]['destroy']({'where':{'type':_0x2872bd,'resourceId':_0x1f84ba['id']}})[_0x8642('0x1d')](function(){return _0x4c8e35;});})['then'](function(){_0x463496[_0x8642('0x29')](0xcc)[_0x8642('0x2a')]();});}};}function handleEntityNotFound(_0x143a3b,_0x3a2d31){return function(_0x3527f7){if(!_0x3527f7){_0x143a3b[_0x8642('0x28')](0x194);}return _0x3527f7;};}function handleError(_0x22b532,_0x7c17e1){_0x7c17e1=_0x7c17e1||0x1f4;return function(_0x4dc03b){logger[_0x8642('0x24')](_0x4dc03b[_0x8642('0x36')]);if(_0x4dc03b['name']){delete _0x4dc03b['name'];}_0x22b532[_0x8642('0x29')](_0x7c17e1)[_0x8642('0x37')](_0x4dc03b);};}exports[_0x8642('0x38')]=function(_0x36e4a3,_0x1c1168){var _0x5a5310={},_0x3c13d4={},_0x10762a={'count':0x0,'rows':[]};var _0x172b76=_[_0x8642('0x39')](db['ChatQueue']['rawAttributes'],function(_0x5c8318){return{'name':_0x5c8318[_0x8642('0x3a')],'type':_0x5c8318[_0x8642('0x3b')][_0x8642('0x3c')]};});_0x3c13d4[_0x8642('0x3d')]=_[_0x8642('0x39')](_0x172b76,'name');_0x3c13d4['query']=_[_0x8642('0x3e')](_0x36e4a3['query']);_0x3c13d4[_0x8642('0x3f')]=_[_0x8642('0x40')](_0x3c13d4[_0x8642('0x3d')],_0x3c13d4['query']);_0x5a5310[_0x8642('0x41')]=_[_0x8642('0x40')](_0x3c13d4[_0x8642('0x3d')],qs[_0x8642('0x42')](_0x36e4a3['query'][_0x8642('0x42')]));_0x5a5310[_0x8642('0x41')]=_0x5a5310['attributes'][_0x8642('0x43')]?_0x5a5310[_0x8642('0x41')]:_0x3c13d4[_0x8642('0x3d')];if(!_0x36e4a3['query'][_0x8642('0x44')](_0x8642('0x45'))){_0x5a5310['limit']=qs[_0x8642('0x2e')](_0x36e4a3[_0x8642('0x46')]['limit']);_0x5a5310[_0x8642('0x2c')]=qs[_0x8642('0x2c')](_0x36e4a3[_0x8642('0x46')][_0x8642('0x2c')]);}_0x5a5310[_0x8642('0x47')]=qs[_0x8642('0x48')](_0x36e4a3[_0x8642('0x46')][_0x8642('0x48')]);_0x5a5310[_0x8642('0x49')]=qs[_0x8642('0x3f')](_[_0x8642('0x4a')](_0x36e4a3[_0x8642('0x46')],_0x3c13d4[_0x8642('0x3f')]),_0x172b76);if(_0x36e4a3[_0x8642('0x46')][_0x8642('0x4b')]){_0x5a5310['where']=_[_0x8642('0x4c')](_0x5a5310[_0x8642('0x49')],{'$or':_[_0x8642('0x39')](_0x172b76,function(_0x3ec5f4){if(_0x3ec5f4[_0x8642('0x3b')]!==_0x8642('0x4d')){var _0x30d90e={};_0x30d90e[_0x3ec5f4['name']]={'$like':'%'+_0x36e4a3[_0x8642('0x46')][_0x8642('0x4b')]+'%'};return _0x30d90e;}})});}_0x5a5310=_[_0x8642('0x4c')]({},_0x5a5310,_0x36e4a3[_0x8642('0x4e')]);var _0x185c9b={'where':_0x5a5310[_0x8642('0x49')]};return db[_0x8642('0x4f')]['count'](_0x185c9b)['then'](function(_0x3d49a3){_0x10762a[_0x8642('0x2f')]=_0x3d49a3;if(_0x36e4a3['query'][_0x8642('0x50')]){_0x5a5310[_0x8642('0x51')]=[{'all':!![]}];}return db['ChatQueue'][_0x8642('0x52')](_0x5a5310);})[_0x8642('0x1d')](function(_0x46e29c){_0x10762a[_0x8642('0x53')]=_0x46e29c;return _0x10762a;})[_0x8642('0x1d')](respondWithFilteredResult(_0x1c1168,_0x5a5310))[_0x8642('0x27')](handleError(_0x1c1168,null));};exports[_0x8642('0x54')]=function(_0x1a5920,_0x26121f){var _0x33a398={'raw':!![],'where':{'id':_0x1a5920[_0x8642('0x55')]['id']}},_0x57f3a4={};_0x57f3a4[_0x8642('0x3d')]=_['keys'](db[_0x8642('0x4f')]['rawAttributes']);_0x57f3a4[_0x8642('0x46')]=_[_0x8642('0x3e')](_0x1a5920[_0x8642('0x46')]);_0x57f3a4[_0x8642('0x3f')]=_[_0x8642('0x40')](_0x57f3a4[_0x8642('0x3d')],_0x57f3a4[_0x8642('0x46')]);_0x33a398['attributes']=_[_0x8642('0x40')](_0x57f3a4[_0x8642('0x3d')],qs[_0x8642('0x42')](_0x1a5920[_0x8642('0x46')]['fields']));_0x33a398[_0x8642('0x41')]=_0x33a398['attributes']['length']?_0x33a398[_0x8642('0x41')]:_0x57f3a4['model'];if(_0x1a5920[_0x8642('0x46')]['includeAll']){_0x33a398[_0x8642('0x51')]=[{'all':!![]}];}_0x33a398=_[_0x8642('0x4c')]({},_0x33a398,_0x1a5920[_0x8642('0x4e')]);return db[_0x8642('0x4f')][_0x8642('0x56')](_0x33a398)[_0x8642('0x1d')](handleEntityNotFound(_0x26121f,null))[_0x8642('0x1d')](respondWithResult(_0x26121f,null))[_0x8642('0x27')](handleError(_0x26121f,null));};exports[_0x8642('0x57')]=function(_0x2ebd51,_0x45934f){return db[_0x8642('0x4f')][_0x8642('0x57')](_0x2ebd51['body'],{})[_0x8642('0x1d')](function(_0x330696){var _0x3ea73f=_0x2ebd51[_0x8642('0x58')]['get']({'plain':!![]});if(!_0x3ea73f)throw new Error(_0x8642('0x59'));if(_0x3ea73f[_0x8642('0x5a')]===_0x8642('0x58')){var _0x104c43=_0x330696[_0x8642('0x34')]({'plain':!![]});var _0x1ec3b8=_0x8642('0x5b');return db[_0x8642('0x5c')][_0x8642('0x56')]({'where':{'name':_0x1ec3b8,'userProfileId':_0x3ea73f[_0x8642('0x5d')]},'raw':!![]})['then'](function(_0x455d47){if(_0x455d47&&_0x455d47[_0x8642('0x5e')]===0x0){return db[_0x8642('0x35')][_0x8642('0x57')]({'name':_0x104c43[_0x8642('0x5f')],'resourceId':_0x104c43['id'],'type':_0x455d47[_0x8642('0x5f')],'sectionId':_0x455d47['id']},{})[_0x8642('0x1d')](function(){return _0x330696;});}else{return _0x330696;}})[_0x8642('0x27')](function(_0x224cb0){logger[_0x8642('0x24')](_0x8642('0x60'),_0x224cb0);throw _0x224cb0;});}return _0x330696;})[_0x8642('0x1d')](respondWithResult(_0x45934f,0xc9))[_0x8642('0x27')](handleError(_0x45934f,null));};exports[_0x8642('0x61')]=function(_0x5cadc8,_0x361a22){if(_0x5cadc8[_0x8642('0x62')]['id']){delete _0x5cadc8[_0x8642('0x62')]['id'];}return db[_0x8642('0x4f')][_0x8642('0x56')]({'where':{'id':_0x5cadc8[_0x8642('0x55')]['id']}})['then'](handleEntityNotFound(_0x361a22,null))[_0x8642('0x1d')](saveUpdates(_0x5cadc8[_0x8642('0x62')],null))[_0x8642('0x1d')](respondWithResult(_0x361a22,null))[_0x8642('0x27')](handleError(_0x361a22,null));};exports[_0x8642('0x63')]=function(_0x29691a,_0xf3c8d7){return db['ChatQueue'][_0x8642('0x56')]({'where':{'id':_0x29691a[_0x8642('0x55')]['id']}})[_0x8642('0x1d')](handleEntityNotFound(_0xf3c8d7,null))[_0x8642('0x1d')](removeEntity(_0xf3c8d7,null))[_0x8642('0x27')](handleError(_0xf3c8d7,null));};exports[_0x8642('0x64')]=function(_0x42a1d0,_0x3fe8e9){return db[_0x8642('0x4f')][_0x8642('0x64')]()[_0x8642('0x1d')](respondWithResult(_0x3fe8e9,null))[_0x8642('0x27')](handleError(_0x3fe8e9,null));};exports['getMembers']=function(_0x4c02fd,_0x7c3ee9,_0x491f65){var _0x3a5ef6={'raw':!![],'where':{}},_0x41ab52={},_0x337308;return db[_0x8642('0x4f')]['findOne']({'where':{'id':_0x4c02fd[_0x8642('0x55')]['id']}})['then'](handleEntityNotFound(_0x7c3ee9,null))[_0x8642('0x1d')](function(_0x427650){if(_0x427650){_0x337308=_0x427650[_0x8642('0x34')]({'plain':!![]});_0x41ab52[_0x8642('0x3d')]=_[_0x8642('0x3e')](db[_0x8642('0x65')][_0x8642('0x66')]);_0x41ab52[_0x8642('0x46')]=_[_0x8642('0x3e')](_0x4c02fd[_0x8642('0x46')]);_0x41ab52[_0x8642('0x3f')]=_[_0x8642('0x40')](_0x41ab52['model'],_0x41ab52[_0x8642('0x46')]);_0x3a5ef6[_0x8642('0x41')]=_[_0x8642('0x40')](_0x41ab52['model'],qs[_0x8642('0x42')](_0x4c02fd[_0x8642('0x46')][_0x8642('0x42')]));_0x3a5ef6[_0x8642('0x41')]=_0x3a5ef6[_0x8642('0x41')]['length']?_0x3a5ef6['attributes']:_0x41ab52[_0x8642('0x3d')];if(!_0x4c02fd['query']['hasOwnProperty'](_0x8642('0x45'))){_0x3a5ef6[_0x8642('0x2e')]=qs[_0x8642('0x2e')](_0x4c02fd[_0x8642('0x46')][_0x8642('0x2e')]);_0x3a5ef6[_0x8642('0x2c')]=qs['offset'](_0x4c02fd[_0x8642('0x46')][_0x8642('0x2c')]);}_0x3a5ef6[_0x8642('0x47')]=qs[_0x8642('0x48')](_0x4c02fd['query'][_0x8642('0x48')]);_0x3a5ef6[_0x8642('0x49')]=qs[_0x8642('0x3f')](_['pick'](_0x4c02fd[_0x8642('0x46')],_0x41ab52['filters']));_0x3a5ef6[_0x8642('0x49')]['ChatQueueId']=_0x427650['id'];if(_0x4c02fd[_0x8642('0x46')][_0x8642('0x4b')]){_0x3a5ef6[_0x8642('0x49')]=_[_0x8642('0x4c')](_0x3a5ef6['where'],{'$or':_[_0x8642('0x39')](_0x3a5ef6[_0x8642('0x41')],function(_0x42e08a){var _0x270bab={};_0x270bab[_0x42e08a]={'$like':'%'+_0x4c02fd[_0x8642('0x46')][_0x8642('0x4b')]+'%'};return _0x270bab;})});}_0x3a5ef6=_[_0x8642('0x4c')]({},_0x3a5ef6,_0x4c02fd[_0x8642('0x4e')]);return db['UserChatQueue']['findAll'](_0x3a5ef6);}})[_0x8642('0x1d')](function(_0x244e17){if(_0x244e17){return db[_0x8642('0x67')]['findAndCountAll']({'where':{'id':_[_0x8642('0x39')](_0x244e17,_0x8642('0x68')),'role':'agent'},'attributes':['id',_0x8642('0x5f'),_0x8642('0x69'),_0x8642('0x6a'),_0x8642('0x6b')]});}})[_0x8642('0x1d')](function(_0x14904f){if(_0x14904f){return{'count':_0x14904f[_0x8642('0x2f')],'rows':_[_0x8642('0x39')](_0x14904f[_0x8642('0x53')],function(_0x2307ff){return{'membername':_0x2307ff[_0x8642('0x5f')],'UserId':_0x2307ff['id'],'queue_name':_0x337308[_0x8642('0x5f')],'ChatQueueId':_0x337308['id'],'interface':util[_0x8642('0x6c')](_0x8642('0x6d'),'SIP',_0x2307ff[_0x8642('0x5f')]),'penalty':0x0,'paused':_0x2307ff[_0x8642('0x69')],'createdAt':_0x2307ff[_0x8642('0x6b')],'updatedAt':_0x2307ff['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8642('0x1d')](respondWithFilteredResult(_0x7c3ee9,_0x3a5ef6))[_0x8642('0x27')](handleError(_0x7c3ee9,null));};exports['getTeams']=function(_0x43f9da,_0x2371df,_0x174d8b){var _0x49cbc8={};var _0x3e1876={};var _0x422695;var _0x2a1a2b;return db['ChatQueue'][_0x8642('0x6e')]({'where':{'id':_0x43f9da['params']['id']}})[_0x8642('0x1d')](handleEntityNotFound(_0x2371df,null))['then'](function(_0x20b70f){if(_0x20b70f){_0x422695=_0x20b70f;_0x3e1876[_0x8642('0x3d')]=_[_0x8642('0x3e')](db[_0x8642('0x6f')][_0x8642('0x66')]);_0x3e1876[_0x8642('0x46')]=_[_0x8642('0x3e')](_0x43f9da['query']);_0x3e1876[_0x8642('0x3f')]=_['intersection'](_0x3e1876[_0x8642('0x3d')],_0x3e1876[_0x8642('0x46')]);_0x49cbc8[_0x8642('0x41')]=_[_0x8642('0x40')](_0x3e1876[_0x8642('0x3d')],qs[_0x8642('0x42')](_0x43f9da[_0x8642('0x46')][_0x8642('0x42')]));_0x49cbc8[_0x8642('0x41')]=_0x49cbc8[_0x8642('0x41')]['length']?_0x49cbc8[_0x8642('0x41')]:_0x3e1876['model'];_0x49cbc8[_0x8642('0x47')]=qs[_0x8642('0x48')](_0x43f9da['query'][_0x8642('0x48')]);_0x49cbc8[_0x8642('0x49')]=qs[_0x8642('0x3f')](_['pick'](_0x43f9da[_0x8642('0x46')],_0x3e1876[_0x8642('0x3f')]));if(_0x43f9da['query'][_0x8642('0x4b')]){_0x49cbc8[_0x8642('0x49')]=_['merge'](_0x49cbc8[_0x8642('0x49')],{'$or':_[_0x8642('0x39')](_0x49cbc8['attributes'],function(_0x24cba0){var _0x2a1c12={};_0x2a1c12[_0x24cba0]={'$like':'%'+_0x43f9da[_0x8642('0x46')][_0x8642('0x4b')]+'%'};return _0x2a1c12;})});}_0x49cbc8=_[_0x8642('0x4c')]({},_0x49cbc8,_0x43f9da[_0x8642('0x4e')]);return _0x422695[_0x8642('0x70')](_0x49cbc8);}})[_0x8642('0x1d')](function(_0x474529){if(_0x474529){_0x2a1a2b=_0x474529['length'];if(!_0x43f9da[_0x8642('0x46')][_0x8642('0x44')]('nolimit')){_0x49cbc8['limit']=qs[_0x8642('0x2e')](_0x43f9da[_0x8642('0x46')][_0x8642('0x2e')]);_0x49cbc8['offset']=qs[_0x8642('0x2c')](_0x43f9da[_0x8642('0x46')][_0x8642('0x2c')]);}return _0x422695['getTeams'](_0x49cbc8);}})[_0x8642('0x1d')](function(_0x709986){if(_0x709986){return _0x709986?{'count':_0x2a1a2b,'rows':_0x709986}:null;}})[_0x8642('0x1d')](respondWithResult(_0x2371df,null))[_0x8642('0x27')](handleError(_0x2371df,null));};exports[_0x8642('0x71')]=function(_0x1448a1,_0x182aff,_0x20bce4){var _0x5465e4=_0x1448a1[_0x8642('0x62')][_0x8642('0x72')];return db['Team'][_0x8642('0x52')]({'where':{'id':_0x5465e4},'attributes':['id'],'include':[{'model':db[_0x8642('0x67')],'as':_0x8642('0x73'),'attributes':['id','name',_0x8642('0x74'),_0x8642('0x75'),_0x8642('0x76')],'raw':!![]}]})[_0x8642('0x1d')](function(_0x3d370f){if(_0x3d370f){var _0x2b20b7=_[_0x8642('0x77')](_0x3d370f,function(_0x9cccf2){var _0x4aad68=_0x9cccf2[_0x8642('0x34')]({'plain':!![]});return _0x4aad68[_0x8642('0x73')];});return db[_0x8642('0x4f')]['find']({'where':{'id':_0x1448a1[_0x8642('0x55')]['id']}})[_0x8642('0x1d')](function(_0x3daef5){return db[_0x8642('0x78')]['transaction'](function(_0x1b6e25){return _0x3daef5['addTeams'](_0x5465e4,{'transaction':_0x1b6e25})['then'](function(){return BPromise['each'](_0x2b20b7,function(_0x27ddd6){return db[_0x8642('0x65')][_0x8642('0x79')]({'where':{'UserId':_0x27ddd6['id'],'ChatQueueId':_0x1448a1['params']['id']},'transaction':_0x1b6e25});});})[_0x8642('0x1d')](function(){_0x2b20b7[_0x8642('0x7a')](function(_0x2181a7){socket[_0x8642('0x7b')](_0x8642('0x7c'),{'UserId':_0x2181a7['id'],'ChatQueueId':_0x3daef5['id']});});});});});}})[_0x8642('0x1d')](respondWithStatusCode(_0x182aff,null))[_0x8642('0x27')](handleError(_0x182aff,null));};exports[_0x8642('0x7d')]=function(_0x13f4cb,_0x493b0b,_0xcf1060){return db[_0x8642('0x6f')][_0x8642('0x52')]({'where':{'id':_0x13f4cb['query'][_0x8642('0x72')]},'attributes':['id'],'include':[{'model':db[_0x8642('0x67')],'as':_0x8642('0x73'),'attributes':['id'],'raw':!![]}]})[_0x8642('0x1d')](handleEntityNotFound(_0x493b0b,null))[_0x8642('0x1d')](function(_0x242b42){var _0x50df4a=_[_0x8642('0x39')](_0x242b42,'id');var _0x4dbae9=[];var _0x1fe51d=[];var _0x2c7435=squel[_0x8642('0x7e')]();_0x2c7435[_0x8642('0x7f')](_0x8642('0x80'))[_0x8642('0x81')](_0x8642('0x82'),'tq')['join'](_0x8642('0x83'),'ut',_0x8642('0x84'))[_0x8642('0x49')]('ChatQueueId\x20=\x20?',_0x13f4cb[_0x8642('0x55')]['id']);for(var _0x1bfdfa=0x0;_0x1bfdfa<_0x242b42[_0x8642('0x43')];_0x1bfdfa+=0x1){let _0x58ac24=_0x242b42[_0x1bfdfa];for(var _0x144c4d=0x0;_0x144c4d<_0x58ac24[_0x8642('0x73')][_0x8642('0x43')];_0x144c4d+=0x1){let _0x20f95d=_0x58ac24['Agents'][_0x144c4d];var _0x18bb9f=_0x2c7435[_0x8642('0x85')]();_0x18bb9f[_0x8642('0x49')](_0x8642('0x86'),_0x20f95d['id']);_0x1fe51d[_0x8642('0x87')](db[_0x8642('0x78')]['query'](_0x18bb9f[_0x8642('0x88')](),{'type':db[_0x8642('0x78')][_0x8642('0x89')][_0x8642('0x8a')]})['then'](function(_0x21b643){if(_0x21b643[_0x8642('0x43')]===0x1){return _0x20f95d['id'];}else{var _0x5599ae=_[_0x8642('0x8b')](_['map'](_0x21b643,_0x8642('0x8c')),function(_0x404640){return _['includes'](_0x50df4a,_0x404640);});if(_0x5599ae){return _0x20f95d['id'];}}}));}}return BPromise[_0x8642('0x8d')](_0x1fe51d)[_0x8642('0x1d')](function(_0x501927){_0x4dbae9=_(_0x4dbae9)['union'](_0x501927)[_0x8642('0x8e')]()[_0x8642('0x8f')]();return db[_0x8642('0x4f')][_0x8642('0x56')]({'where':{'id':_0x13f4cb[_0x8642('0x55')]['id']}})[_0x8642('0x1d')](function(_0x2196f9){return db[_0x8642('0x78')]['transaction'](function(_0x400160){return _0x2196f9['removeTeams'](_0x13f4cb[_0x8642('0x46')][_0x8642('0x72')],{'transaction':_0x400160})[_0x8642('0x1d')](function(){if(!_[_0x8642('0x90')](_0x4dbae9)){return _0x2196f9['removeAgents'](_0x4dbae9,{'transaction':_0x400160});}})[_0x8642('0x1d')](function(){_0x4dbae9[_0x8642('0x7a')](function(_0x7a3c16){socket[_0x8642('0x7b')](_0x8642('0x91'),{'UserId':_0x7a3c16,'ChatQueueId':_0x2196f9['id']});});});});});});})[_0x8642('0x1d')](respondWithStatusCode(_0x493b0b,null))[_0x8642('0x27')](handleError(_0x493b0b,null));};exports[_0x8642('0x92')]=function(_0xf23fd2,_0x4bf88c,_0x5bd44f){return db[_0x8642('0x4f')][_0x8642('0x56')]({'where':{'id':_0xf23fd2[_0x8642('0x55')]['id']}})[_0x8642('0x1d')](handleEntityNotFound(_0x4bf88c,null))[_0x8642('0x1d')](function(_0x133c33){if(_0x133c33){return _0x133c33['addAgents'](_0xf23fd2[_0x8642('0x62')]['ids'],_[_0x8642('0x93')](_0xf23fd2[_0x8642('0x62')],[_0x8642('0x72'),'id'])||{})[_0x8642('0x94')](function(_0x5984d6){for(var _0x3985d7=0x0;_0x3985d7<_0xf23fd2[_0x8642('0x62')]['ids'][_0x8642('0x43')];_0x3985d7+=0x1){socket[_0x8642('0x7b')](_0x8642('0x7c'),{'UserId':Number(_0xf23fd2[_0x8642('0x62')][_0x8642('0x72')][_0x3985d7]),'ChatQueueId':Number(_0xf23fd2[_0x8642('0x55')]['id'])});}return _0x5984d6;});}})[_0x8642('0x1d')](respondWithResult(_0x4bf88c,null))[_0x8642('0x27')](handleError(_0x4bf88c,null));};exports[_0x8642('0x95')]=function(_0x335d8a,_0x300753,_0x544edb){return db[_0x8642('0x4f')]['find']({'where':{'id':_0x335d8a[_0x8642('0x55')]['id']}})[_0x8642('0x1d')](handleEntityNotFound(_0x300753,null))[_0x8642('0x1d')](function(_0x2de4c5){if(_0x2de4c5){return _0x2de4c5[_0x8642('0x95')](_0x335d8a[_0x8642('0x46')][_0x8642('0x72')])[_0x8642('0x1d')](function(){if(_[_0x8642('0x96')](_0x335d8a['query'][_0x8642('0x72')])){for(var _0x1e514c=0x0;_0x1e514c<_0x335d8a['query']['ids'][_0x8642('0x43')];_0x1e514c+=0x1){socket[_0x8642('0x7b')](_0x8642('0x91'),{'UserId':Number(_0x335d8a['query'][_0x8642('0x72')][_0x1e514c]),'ChatQueueId':Number(_0x335d8a[_0x8642('0x55')]['id'])});}}else{socket[_0x8642('0x7b')](_0x8642('0x91'),{'UserId':Number(_0x335d8a[_0x8642('0x46')]['ids']),'ChatQueueId':Number(_0x335d8a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x300753,null))[_0x8642('0x27')](handleError(_0x300753,null));};exports[_0x8642('0x97')]=function(_0x39d88d,_0x2b0d75,_0x2d2f26){var _0x5dc664={};var _0x1ad323={};var _0xcaeba6;var _0x5b1274;return db[_0x8642('0x4f')][_0x8642('0x6e')]({'where':{'id':_0x39d88d['params']['id']}})[_0x8642('0x1d')](handleEntityNotFound(_0x2b0d75,null))[_0x8642('0x1d')](function(_0x3d9832){if(_0x3d9832){_0xcaeba6=_0x3d9832;_0x1ad323['model']=_[_0x8642('0x3e')](db['User'][_0x8642('0x66')]);_0x1ad323['query']=_[_0x8642('0x3e')](_0x39d88d['query']);_0x1ad323[_0x8642('0x3f')]=_[_0x8642('0x40')](_0x1ad323[_0x8642('0x3d')],_0x1ad323[_0x8642('0x46')]);_0x5dc664[_0x8642('0x41')]=_['intersection'](_0x1ad323[_0x8642('0x3d')],qs[_0x8642('0x42')](_0x39d88d['query'][_0x8642('0x42')]));_0x5dc664['attributes']=_0x5dc664[_0x8642('0x41')][_0x8642('0x43')]?_0x5dc664['attributes']:_0x1ad323[_0x8642('0x3d')];_0x5dc664[_0x8642('0x47')]=qs[_0x8642('0x48')](_0x39d88d[_0x8642('0x46')][_0x8642('0x48')]);_0x5dc664[_0x8642('0x49')]=qs['filters'](_[_0x8642('0x4a')](_0x39d88d[_0x8642('0x46')],_0x1ad323[_0x8642('0x3f')]));if(_0x39d88d[_0x8642('0x46')][_0x8642('0x4b')]){_0x5dc664['where']=_[_0x8642('0x4c')](_0x5dc664['where'],{'$or':_[_0x8642('0x39')](_0x5dc664[_0x8642('0x41')],function(_0x260ca0){var _0x23bffa={};_0x23bffa[_0x260ca0]={'$like':'%'+_0x39d88d[_0x8642('0x46')][_0x8642('0x4b')]+'%'};return _0x23bffa;})});}_0x5dc664=_[_0x8642('0x4c')]({},_0x5dc664,_0x39d88d['options']);return _0xcaeba6[_0x8642('0x97')](_0x5dc664);}})['then'](function(_0x50e722){if(_0x50e722){_0x5b1274=_0x50e722[_0x8642('0x43')];if(!_0x39d88d[_0x8642('0x46')][_0x8642('0x44')](_0x8642('0x45'))){_0x5dc664[_0x8642('0x2e')]=qs['limit'](_0x39d88d[_0x8642('0x46')][_0x8642('0x2e')]);_0x5dc664['offset']=qs[_0x8642('0x2c')](_0x39d88d[_0x8642('0x46')][_0x8642('0x2c')]);}return _0xcaeba6[_0x8642('0x97')](_0x5dc664);}})[_0x8642('0x1d')](function(_0x22d9e8){if(_0x22d9e8){return _0x22d9e8?{'count':_0x5b1274,'rows':_0x22d9e8}:null;}})[_0x8642('0x1d')](respondWithResult(_0x2b0d75,null))[_0x8642('0x27')](handleError(_0x2b0d75,null));}; \ No newline at end of file +var _0xc667=['update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','order','sort','where','merge','filter','options','include','findAll','rows','params','intersection','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','pick','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','ids','online','voicePause','interface','Agents','transaction','addTeams','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','debug','error','code','ChatQueue,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x3357c4,_0xffb532){var _0x2c9a62=function(_0x317e58){while(--_0x317e58){_0x3357c4['push'](_0x3357c4['shift']());}};_0x2c9a62(++_0xffb532);}(_0xc667,0x66));var _0x7c66=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc667[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x7c66('0x0'));var rimraf=require(_0x7c66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7c66('0x2'));var moment=require(_0x7c66('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7c66('0x4'));var util=require(_0x7c66('0x5'));var path=require(_0x7c66('0x6'));var sox=require(_0x7c66('0x7'));var csv=require(_0x7c66('0x8'));var ejs=require(_0x7c66('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c66('0xa'));var squel=require('squel');var crypto=require(_0x7c66('0xb'));var jsforce=require(_0x7c66('0xc'));var deskjs=require(_0x7c66('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7c66('0xe'));var Papa=require(_0x7c66('0xf'));var Redis=require(_0x7c66('0x10'));var authService=require(_0x7c66('0x11'));var qs=require(_0x7c66('0x12'));var as=require(_0x7c66('0x13'));var hardwareService=require(_0x7c66('0x14'));var logger=require(_0x7c66('0x15'))('api');var utils=require(_0x7c66('0x16'));var config=require(_0x7c66('0x17'));var licenseUtil=require(_0x7c66('0x18'));var db=require(_0x7c66('0x19'))['db'];config[_0x7c66('0x1a')]=_['defaults'](config[_0x7c66('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c66('0x1b'))(new Redis(config[_0x7c66('0x1a')]));require(_0x7c66('0x1c'))[_0x7c66('0x1d')](socket);var jayson=require(_0x7c66('0x1e'));var client=jayson[_0x7c66('0x1f')][_0x7c66('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1e9315,_0x23dccf,_0x4f4da8,_0x27f9b4){return new BPromise(function(_0x2e41e8,_0x2e8d57){var _0x26fe44=_0x27f9b4||client;return _0x26fe44[_0x7c66('0x21')](_0x1e9315,_0x4f4da8)[_0x7c66('0x22')](function(_0x5b7965){logger[_0x7c66('0x23')]('ChatQueue,\x20%s,\x20%s',_0x23dccf,'request\x20sent');logger[_0x7c66('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x23dccf,'request\x20sent',JSON['stringify'](_0x5b7965));if(_0x5b7965[_0x7c66('0x25')]){if(_0x5b7965[_0x7c66('0x25')][_0x7c66('0x26')]===0x1f4){logger[_0x7c66('0x25')](_0x7c66('0x27'),_0x23dccf,_0x5b7965[_0x7c66('0x25')][_0x7c66('0x28')]);return _0x2e8d57(_0x5b7965[_0x7c66('0x25')][_0x7c66('0x28')]);}logger[_0x7c66('0x25')]('ChatQueue,\x20%s,\x20%s',_0x23dccf,_0x5b7965[_0x7c66('0x25')][_0x7c66('0x28')]);return _0x2e41e8(_0x5b7965[_0x7c66('0x25')][_0x7c66('0x28')]);}else{logger[_0x7c66('0x23')]('ChatQueue,\x20%s,\x20%s',_0x23dccf,'request\x20sent');_0x2e41e8(_0x5b7965[_0x7c66('0x29')][_0x7c66('0x28')]);}})['catch'](function(_0x3a6510){logger[_0x7c66('0x25')](_0x7c66('0x27'),_0x23dccf,_0x3a6510);_0x2e8d57(_0x3a6510);});});}function respondWithStatusCode(_0x45e187,_0x4e7681){_0x4e7681=_0x4e7681||0xcc;return function(_0x193e2c){if(_0x193e2c){return _0x45e187[_0x7c66('0x2a')](_0x4e7681);}return _0x45e187[_0x7c66('0x2b')](_0x4e7681)[_0x7c66('0x2c')]();};}function respondWithResult(_0x518288,_0x2c452a){_0x2c452a=_0x2c452a||0xc8;return function(_0x4fbcf8){if(_0x4fbcf8){return _0x518288['status'](_0x2c452a)[_0x7c66('0x2d')](_0x4fbcf8);}};}function respondWithFilteredResult(_0x3cdd8a,_0x10fad3){return function(_0xa5aa01){if(_0xa5aa01){var _0x5c641b=typeof _0x10fad3[_0x7c66('0x2e')]===_0x7c66('0x2f')&&typeof _0x10fad3[_0x7c66('0x30')]===_0x7c66('0x2f');var _0x1d8f0b=_0xa5aa01[_0x7c66('0x31')];var _0x4287a8=_0x5c641b?0x0:_0x10fad3[_0x7c66('0x2e')];var _0x23dd8a=_0x5c641b?_0xa5aa01['count']:_0x10fad3[_0x7c66('0x2e')]+_0x10fad3['limit'];var _0x407262;if(_0x23dd8a>=_0x1d8f0b){_0x23dd8a=_0x1d8f0b;_0x407262=0xc8;}else{_0x407262=0xce;}_0x3cdd8a['status'](_0x407262);return _0x3cdd8a[_0x7c66('0x32')]('Content-Range',_0x4287a8+'-'+_0x23dd8a+'/'+_0x1d8f0b)[_0x7c66('0x2d')](_0xa5aa01);}return null;};}function patchUpdates(_0x3ba427){return function(_0x2ec486){try{jsonpatch[_0x7c66('0x33')](_0x2ec486,_0x3ba427,!![]);}catch(_0x56cd2e){return BPromise[_0x7c66('0x34')](_0x56cd2e);}return _0x2ec486[_0x7c66('0x35')]();};}function saveUpdates(_0x219006,_0x53169a){return function(_0x123a91){if(_0x123a91){return _0x123a91[_0x7c66('0x36')](_0x219006)[_0x7c66('0x22')](function(_0x4eef3e){return _0x4eef3e;});}return null;};}function removeEntity(_0x127b4b,_0x359f98){return function(_0x3a64c3){if(_0x3a64c3){return _0x3a64c3[_0x7c66('0x37')]()[_0x7c66('0x22')](function(){var _0x43cd95=_0x3a64c3[_0x7c66('0x38')]({'plain':!![]});var _0x5bca7f=_0x7c66('0x39');return db[_0x7c66('0x3a')][_0x7c66('0x37')]({'where':{'type':_0x5bca7f,'resourceId':_0x43cd95['id']}})[_0x7c66('0x22')](function(){return _0x3a64c3;});})[_0x7c66('0x22')](function(){_0x127b4b['status'](0xcc)[_0x7c66('0x2c')]();});}};}function handleEntityNotFound(_0x5213ac,_0x1dd4e8){return function(_0x38b560){if(!_0x38b560){_0x5213ac['sendStatus'](0x194);}return _0x38b560;};}function handleError(_0x3a645f,_0x25c7d6){_0x25c7d6=_0x25c7d6||0x1f4;return function(_0x33e1ef){logger[_0x7c66('0x25')](_0x33e1ef[_0x7c66('0x3b')]);if(_0x33e1ef['name']){delete _0x33e1ef[_0x7c66('0x3c')];}_0x3a645f['status'](_0x25c7d6)['send'](_0x33e1ef);};}exports[_0x7c66('0x3d')]=function(_0x879892,_0x20f81c){var _0x5685ba={},_0x1c757d={},_0x1c286e={'count':0x0,'rows':[]};var _0x32d411=_[_0x7c66('0x3e')](db[_0x7c66('0x3f')][_0x7c66('0x40')],function(_0x2e95aa){return{'name':_0x2e95aa[_0x7c66('0x41')],'type':_0x2e95aa[_0x7c66('0x42')][_0x7c66('0x43')]};});_0x1c757d['model']=_[_0x7c66('0x3e')](_0x32d411,'name');_0x1c757d[_0x7c66('0x44')]=_[_0x7c66('0x45')](_0x879892['query']);_0x1c757d[_0x7c66('0x46')]=_['intersection'](_0x1c757d[_0x7c66('0x47')],_0x1c757d['query']);_0x5685ba['attributes']=_['intersection'](_0x1c757d[_0x7c66('0x47')],qs[_0x7c66('0x48')](_0x879892[_0x7c66('0x44')]['fields']));_0x5685ba['attributes']=_0x5685ba[_0x7c66('0x49')][_0x7c66('0x4a')]?_0x5685ba[_0x7c66('0x49')]:_0x1c757d['model'];if(!_0x879892[_0x7c66('0x44')]['hasOwnProperty']('nolimit')){_0x5685ba[_0x7c66('0x30')]=qs[_0x7c66('0x30')](_0x879892['query'][_0x7c66('0x30')]);_0x5685ba[_0x7c66('0x2e')]=qs[_0x7c66('0x2e')](_0x879892[_0x7c66('0x44')]['offset']);}_0x5685ba[_0x7c66('0x4b')]=qs['sort'](_0x879892[_0x7c66('0x44')][_0x7c66('0x4c')]);_0x5685ba[_0x7c66('0x4d')]=qs[_0x7c66('0x46')](_['pick'](_0x879892[_0x7c66('0x44')],_0x1c757d[_0x7c66('0x46')]),_0x32d411);if(_0x879892[_0x7c66('0x44')]['filter']){_0x5685ba[_0x7c66('0x4d')]=_[_0x7c66('0x4e')](_0x5685ba[_0x7c66('0x4d')],{'$or':_['map'](_0x32d411,function(_0x4b1e4f){if(_0x4b1e4f['type']!=='VIRTUAL'){var _0x1bcca2={};_0x1bcca2[_0x4b1e4f['name']]={'$like':'%'+_0x879892[_0x7c66('0x44')][_0x7c66('0x4f')]+'%'};return _0x1bcca2;}})});}_0x5685ba=_[_0x7c66('0x4e')]({},_0x5685ba,_0x879892[_0x7c66('0x50')]);var _0x154bc4={'where':_0x5685ba[_0x7c66('0x4d')]};return db['ChatQueue'][_0x7c66('0x31')](_0x154bc4)['then'](function(_0x13552c){_0x1c286e[_0x7c66('0x31')]=_0x13552c;if(_0x879892[_0x7c66('0x44')]['includeAll']){_0x5685ba[_0x7c66('0x51')]=[{'all':!![]}];}return db[_0x7c66('0x3f')][_0x7c66('0x52')](_0x5685ba);})['then'](function(_0x20f5d2){_0x1c286e[_0x7c66('0x53')]=_0x20f5d2;return _0x1c286e;})['then'](respondWithFilteredResult(_0x20f81c,_0x5685ba))['catch'](handleError(_0x20f81c,null));};exports['show']=function(_0x10ea50,_0x5eba9b){var _0x5d12e1={'raw':!![],'where':{'id':_0x10ea50[_0x7c66('0x54')]['id']}},_0x481e3e={};_0x481e3e[_0x7c66('0x47')]=_[_0x7c66('0x45')](db[_0x7c66('0x3f')][_0x7c66('0x40')]);_0x481e3e['query']=_[_0x7c66('0x45')](_0x10ea50[_0x7c66('0x44')]);_0x481e3e['filters']=_[_0x7c66('0x55')](_0x481e3e[_0x7c66('0x47')],_0x481e3e[_0x7c66('0x44')]);_0x5d12e1[_0x7c66('0x49')]=_[_0x7c66('0x55')](_0x481e3e[_0x7c66('0x47')],qs['fields'](_0x10ea50[_0x7c66('0x44')]['fields']));_0x5d12e1[_0x7c66('0x49')]=_0x5d12e1['attributes'][_0x7c66('0x4a')]?_0x5d12e1[_0x7c66('0x49')]:_0x481e3e[_0x7c66('0x47')];if(_0x10ea50[_0x7c66('0x44')][_0x7c66('0x56')]){_0x5d12e1['include']=[{'all':!![]}];}_0x5d12e1=_['merge']({},_0x5d12e1,_0x10ea50[_0x7c66('0x50')]);return db['ChatQueue']['find'](_0x5d12e1)['then'](handleEntityNotFound(_0x5eba9b,null))[_0x7c66('0x22')](respondWithResult(_0x5eba9b,null))[_0x7c66('0x57')](handleError(_0x5eba9b,null));};exports[_0x7c66('0x58')]=function(_0x28572f,_0xea27f){return db[_0x7c66('0x3f')][_0x7c66('0x58')](_0x28572f[_0x7c66('0x59')],{})['then'](function(_0x386160){var _0x4ac478=_0x28572f[_0x7c66('0x5a')][_0x7c66('0x38')]({'plain':!![]});if(!_0x4ac478)throw new Error(_0x7c66('0x5b'));if(_0x4ac478[_0x7c66('0x5c')]===_0x7c66('0x5a')){var _0x4751de=_0x386160['get']({'plain':!![]});var _0x78f201=_0x7c66('0x39');return db[_0x7c66('0x5d')][_0x7c66('0x5e')]({'where':{'name':_0x78f201,'userProfileId':_0x4ac478['userProfileId']},'raw':!![]})[_0x7c66('0x22')](function(_0x3a09a8){if(_0x3a09a8&&_0x3a09a8[_0x7c66('0x5f')]===0x0){return db[_0x7c66('0x3a')][_0x7c66('0x58')]({'name':_0x4751de[_0x7c66('0x3c')],'resourceId':_0x4751de['id'],'type':_0x3a09a8[_0x7c66('0x3c')],'sectionId':_0x3a09a8['id']},{})[_0x7c66('0x22')](function(){return _0x386160;});}else{return _0x386160;}})[_0x7c66('0x57')](function(_0x57e39e){logger[_0x7c66('0x25')](_0x7c66('0x60'),_0x57e39e);throw _0x57e39e;});}return _0x386160;})[_0x7c66('0x22')](respondWithResult(_0xea27f,0xc9))[_0x7c66('0x57')](handleError(_0xea27f,null));};exports['update']=function(_0x1cd2a5,_0x3981b0){if(_0x1cd2a5[_0x7c66('0x59')]['id']){delete _0x1cd2a5['body']['id'];}return db[_0x7c66('0x3f')]['find']({'where':{'id':_0x1cd2a5['params']['id']}})[_0x7c66('0x22')](handleEntityNotFound(_0x3981b0,null))['then'](saveUpdates(_0x1cd2a5[_0x7c66('0x59')],null))[_0x7c66('0x22')](respondWithResult(_0x3981b0,null))[_0x7c66('0x57')](handleError(_0x3981b0,null));};exports[_0x7c66('0x37')]=function(_0x389c67,_0x3c4879){return db[_0x7c66('0x3f')]['find']({'where':{'id':_0x389c67['params']['id']}})[_0x7c66('0x22')](handleEntityNotFound(_0x3c4879,null))[_0x7c66('0x22')](removeEntity(_0x3c4879,null))[_0x7c66('0x57')](handleError(_0x3c4879,null));};exports['describe']=function(_0x5d28e8,_0x4782e9){return db['ChatQueue'][_0x7c66('0x61')]()['then'](respondWithResult(_0x4782e9,null))[_0x7c66('0x57')](handleError(_0x4782e9,null));};exports['getMembers']=function(_0x1030d8,_0x558803,_0x4ea5ee){var _0x2fa63d={'raw':!![],'where':{}},_0x275d40={},_0x16267d;return db[_0x7c66('0x3f')][_0x7c66('0x62')]({'where':{'id':_0x1030d8[_0x7c66('0x54')]['id']}})['then'](handleEntityNotFound(_0x558803,null))[_0x7c66('0x22')](function(_0x8de73b){if(_0x8de73b){_0x16267d=_0x8de73b[_0x7c66('0x38')]({'plain':!![]});_0x275d40[_0x7c66('0x47')]=_[_0x7c66('0x45')](db[_0x7c66('0x63')]['rawAttributes']);_0x275d40[_0x7c66('0x44')]=_[_0x7c66('0x45')](_0x1030d8[_0x7c66('0x44')]);_0x275d40['filters']=_[_0x7c66('0x55')](_0x275d40[_0x7c66('0x47')],_0x275d40[_0x7c66('0x44')]);_0x2fa63d['attributes']=_[_0x7c66('0x55')](_0x275d40[_0x7c66('0x47')],qs[_0x7c66('0x48')](_0x1030d8['query'][_0x7c66('0x48')]));_0x2fa63d[_0x7c66('0x49')]=_0x2fa63d[_0x7c66('0x49')][_0x7c66('0x4a')]?_0x2fa63d[_0x7c66('0x49')]:_0x275d40[_0x7c66('0x47')];if(!_0x1030d8[_0x7c66('0x44')][_0x7c66('0x64')](_0x7c66('0x65'))){_0x2fa63d[_0x7c66('0x30')]=qs[_0x7c66('0x30')](_0x1030d8[_0x7c66('0x44')][_0x7c66('0x30')]);_0x2fa63d[_0x7c66('0x2e')]=qs[_0x7c66('0x2e')](_0x1030d8['query'][_0x7c66('0x2e')]);}_0x2fa63d['order']=qs[_0x7c66('0x4c')](_0x1030d8['query'][_0x7c66('0x4c')]);_0x2fa63d[_0x7c66('0x4d')]=qs['filters'](_[_0x7c66('0x66')](_0x1030d8[_0x7c66('0x44')],_0x275d40[_0x7c66('0x46')]));_0x2fa63d[_0x7c66('0x4d')]['ChatQueueId']=_0x8de73b['id'];if(_0x1030d8[_0x7c66('0x44')][_0x7c66('0x4f')]){_0x2fa63d[_0x7c66('0x4d')]=_[_0x7c66('0x4e')](_0x2fa63d[_0x7c66('0x4d')],{'$or':_['map'](_0x2fa63d[_0x7c66('0x49')],function(_0x2eece6){var _0x538674={};_0x538674[_0x2eece6]={'$like':'%'+_0x1030d8[_0x7c66('0x44')][_0x7c66('0x4f')]+'%'};return _0x538674;})});}_0x2fa63d=_[_0x7c66('0x4e')]({},_0x2fa63d,_0x1030d8[_0x7c66('0x50')]);return db[_0x7c66('0x63')]['findAll'](_0x2fa63d);}})[_0x7c66('0x22')](function(_0x47cf07){if(_0x47cf07){return db[_0x7c66('0x67')][_0x7c66('0x68')]({'where':{'id':_[_0x7c66('0x3e')](_0x47cf07,_0x7c66('0x69')),'role':_0x7c66('0x6a')},'attributes':['id','name','chatPause',_0x7c66('0x6b'),_0x7c66('0x6c')]});}})[_0x7c66('0x22')](function(_0x4699c4){if(_0x4699c4){return{'count':_0x4699c4[_0x7c66('0x31')],'rows':_[_0x7c66('0x3e')](_0x4699c4[_0x7c66('0x53')],function(_0x35b07b){return{'membername':_0x35b07b[_0x7c66('0x3c')],'UserId':_0x35b07b['id'],'queue_name':_0x16267d[_0x7c66('0x3c')],'ChatQueueId':_0x16267d['id'],'interface':util[_0x7c66('0x6d')](_0x7c66('0x6e'),_0x7c66('0x6f'),_0x35b07b['name']),'penalty':0x0,'paused':_0x35b07b[_0x7c66('0x70')],'createdAt':_0x35b07b[_0x7c66('0x6c')],'updatedAt':_0x35b07b[_0x7c66('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7c66('0x22')](respondWithFilteredResult(_0x558803,_0x2fa63d))[_0x7c66('0x57')](handleError(_0x558803,null));};exports[_0x7c66('0x71')]=function(_0x396e51,_0x89b920,_0x34c60d){var _0x3d7f4a={};var _0x29c6c4={};var _0x3d2b4d;var _0x14ae04;return db[_0x7c66('0x3f')]['findOne']({'where':{'id':_0x396e51['params']['id']}})[_0x7c66('0x22')](handleEntityNotFound(_0x89b920,null))[_0x7c66('0x22')](function(_0x548e90){if(_0x548e90){_0x3d2b4d=_0x548e90;_0x29c6c4['model']=_[_0x7c66('0x45')](db[_0x7c66('0x72')]['rawAttributes']);_0x29c6c4['query']=_[_0x7c66('0x45')](_0x396e51[_0x7c66('0x44')]);_0x29c6c4[_0x7c66('0x46')]=_['intersection'](_0x29c6c4['model'],_0x29c6c4[_0x7c66('0x44')]);_0x3d7f4a[_0x7c66('0x49')]=_[_0x7c66('0x55')](_0x29c6c4[_0x7c66('0x47')],qs[_0x7c66('0x48')](_0x396e51[_0x7c66('0x44')][_0x7c66('0x48')]));_0x3d7f4a[_0x7c66('0x49')]=_0x3d7f4a[_0x7c66('0x49')][_0x7c66('0x4a')]?_0x3d7f4a['attributes']:_0x29c6c4[_0x7c66('0x47')];_0x3d7f4a[_0x7c66('0x4b')]=qs[_0x7c66('0x4c')](_0x396e51[_0x7c66('0x44')][_0x7c66('0x4c')]);_0x3d7f4a[_0x7c66('0x4d')]=qs[_0x7c66('0x46')](_[_0x7c66('0x66')](_0x396e51['query'],_0x29c6c4[_0x7c66('0x46')]));if(_0x396e51[_0x7c66('0x44')][_0x7c66('0x4f')]){_0x3d7f4a[_0x7c66('0x4d')]=_[_0x7c66('0x4e')](_0x3d7f4a[_0x7c66('0x4d')],{'$or':_[_0x7c66('0x3e')](_0x3d7f4a[_0x7c66('0x49')],function(_0x154687){var _0x543482={};_0x543482[_0x154687]={'$like':'%'+_0x396e51[_0x7c66('0x44')][_0x7c66('0x4f')]+'%'};return _0x543482;})});}_0x3d7f4a=_['merge']({},_0x3d7f4a,_0x396e51[_0x7c66('0x50')]);return _0x3d2b4d['getTeams'](_0x3d7f4a);}})['then'](function(_0x2ada88){if(_0x2ada88){_0x14ae04=_0x2ada88[_0x7c66('0x4a')];if(!_0x396e51[_0x7c66('0x44')][_0x7c66('0x64')](_0x7c66('0x65'))){_0x3d7f4a['limit']=qs['limit'](_0x396e51['query'][_0x7c66('0x30')]);_0x3d7f4a['offset']=qs['offset'](_0x396e51[_0x7c66('0x44')]['offset']);}return _0x3d2b4d['getTeams'](_0x3d7f4a);}})['then'](function(_0x357070){if(_0x357070){return _0x357070?{'count':_0x14ae04,'rows':_0x357070}:null;}})[_0x7c66('0x22')](respondWithResult(_0x89b920,null))['catch'](handleError(_0x89b920,null));};exports['addTeams']=function(_0x443584,_0x58e477,_0xf60b8a){var _0x469de2=_0x443584[_0x7c66('0x59')][_0x7c66('0x73')];return db[_0x7c66('0x72')][_0x7c66('0x52')]({'where':{'id':_0x469de2},'attributes':['id'],'include':[{'model':db[_0x7c66('0x67')],'as':'Agents','attributes':['id',_0x7c66('0x3c'),_0x7c66('0x74'),_0x7c66('0x75'),_0x7c66('0x76')],'raw':!![]}]})['then'](function(_0x7094dc){if(_0x7094dc){var _0x15e8f2=_['flatMap'](_0x7094dc,function(_0x51b79c){var _0x432b10=_0x51b79c[_0x7c66('0x38')]({'plain':!![]});return _0x432b10[_0x7c66('0x77')];});return db[_0x7c66('0x3f')][_0x7c66('0x5e')]({'where':{'id':_0x443584[_0x7c66('0x54')]['id']}})[_0x7c66('0x22')](function(_0x12cd04){return db['sequelize'][_0x7c66('0x78')](function(_0x11f8d2){return _0x12cd04[_0x7c66('0x79')](_0x469de2,{'transaction':_0x11f8d2})[_0x7c66('0x22')](function(){return BPromise['each'](_0x15e8f2,function(_0x3587c9){return db['UserChatQueue'][_0x7c66('0x7a')]({'where':{'UserId':_0x3587c9['id'],'ChatQueueId':_0x443584[_0x7c66('0x54')]['id']},'transaction':_0x11f8d2});});})[_0x7c66('0x22')](function(){_0x15e8f2[_0x7c66('0x7b')](function(_0x7d5f1b){socket[_0x7c66('0x7c')](_0x7c66('0x7d'),{'UserId':_0x7d5f1b['id'],'ChatQueueId':_0x12cd04['id']});});});});});}})[_0x7c66('0x22')](respondWithStatusCode(_0x58e477,null))[_0x7c66('0x57')](handleError(_0x58e477,null));};exports[_0x7c66('0x7e')]=function(_0x30ce30,_0x471730,_0x3a3e75){return db[_0x7c66('0x72')][_0x7c66('0x52')]({'where':{'id':_0x30ce30[_0x7c66('0x44')][_0x7c66('0x73')]},'attributes':['id'],'include':[{'model':db[_0x7c66('0x67')],'as':_0x7c66('0x77'),'attributes':['id'],'raw':!![]}]})[_0x7c66('0x22')](handleEntityNotFound(_0x471730,null))[_0x7c66('0x22')](function(_0x109fda){var _0x5a1dd8=_[_0x7c66('0x3e')](_0x109fda,'id');var _0x28551b=[];var _0x175313=[];var _0x22b794=squel[_0x7c66('0x7f')]();_0x22b794[_0x7c66('0x80')](_0x7c66('0x81'))[_0x7c66('0x82')](_0x7c66('0x83'),'tq')[_0x7c66('0x84')](_0x7c66('0x85'),'ut',_0x7c66('0x86'))[_0x7c66('0x4d')](_0x7c66('0x87'),_0x30ce30[_0x7c66('0x54')]['id']);for(var _0x335568=0x0;_0x335568<_0x109fda[_0x7c66('0x4a')];_0x335568+=0x1){let _0x1a4035=_0x109fda[_0x335568];for(var _0x752323=0x0;_0x752323<_0x1a4035['Agents'][_0x7c66('0x4a')];_0x752323+=0x1){let _0x1e8c91=_0x1a4035[_0x7c66('0x77')][_0x752323];var _0x3b3887=_0x22b794[_0x7c66('0x88')]();_0x3b3887[_0x7c66('0x4d')](_0x7c66('0x89'),_0x1e8c91['id']);_0x175313[_0x7c66('0x8a')](db[_0x7c66('0x8b')][_0x7c66('0x44')](_0x3b3887[_0x7c66('0x8c')](),{'type':db[_0x7c66('0x8b')][_0x7c66('0x8d')][_0x7c66('0x8e')]})[_0x7c66('0x22')](function(_0x226047){if(_0x226047['length']===0x1){return _0x1e8c91['id'];}else{var _0x415aac=_[_0x7c66('0x8f')](_[_0x7c66('0x3e')](_0x226047,'TeamId'),function(_0x1dfa84){return _[_0x7c66('0x90')](_0x5a1dd8,_0x1dfa84);});if(_0x415aac){return _0x1e8c91['id'];}}}));}}return BPromise['all'](_0x175313)[_0x7c66('0x22')](function(_0x9538e){_0x28551b=_(_0x28551b)[_0x7c66('0x91')](_0x9538e)[_0x7c66('0x92')]()[_0x7c66('0x93')]();return db[_0x7c66('0x3f')]['find']({'where':{'id':_0x30ce30[_0x7c66('0x54')]['id']}})[_0x7c66('0x22')](function(_0x57fdfd){return db['sequelize'][_0x7c66('0x78')](function(_0x56a2d8){return _0x57fdfd[_0x7c66('0x7e')](_0x30ce30[_0x7c66('0x44')][_0x7c66('0x73')],{'transaction':_0x56a2d8})['then'](function(){if(!_[_0x7c66('0x94')](_0x28551b)){return _0x57fdfd[_0x7c66('0x95')](_0x28551b,{'transaction':_0x56a2d8});}})[_0x7c66('0x22')](function(){_0x28551b[_0x7c66('0x7b')](function(_0x38c5ca){socket[_0x7c66('0x7c')](_0x7c66('0x96'),{'UserId':_0x38c5ca,'ChatQueueId':_0x57fdfd['id']});});});});});});})[_0x7c66('0x22')](respondWithStatusCode(_0x471730,null))[_0x7c66('0x57')](handleError(_0x471730,null));};exports[_0x7c66('0x97')]=function(_0x4f12e9,_0x154e80,_0xc37258){return db[_0x7c66('0x3f')][_0x7c66('0x5e')]({'where':{'id':_0x4f12e9[_0x7c66('0x54')]['id']}})['then'](handleEntityNotFound(_0x154e80,null))[_0x7c66('0x22')](function(_0x16fa61){if(_0x16fa61){return _0x16fa61['addAgents'](_0x4f12e9['body'][_0x7c66('0x73')],_[_0x7c66('0x98')](_0x4f12e9['body'],[_0x7c66('0x73'),'id'])||{})[_0x7c66('0x99')](function(_0xd7787b){for(var _0x4c5987=0x0;_0x4c5987<_0x4f12e9[_0x7c66('0x59')][_0x7c66('0x73')][_0x7c66('0x4a')];_0x4c5987+=0x1){socket[_0x7c66('0x7c')](_0x7c66('0x7d'),{'UserId':Number(_0x4f12e9[_0x7c66('0x59')][_0x7c66('0x73')][_0x4c5987]),'ChatQueueId':Number(_0x4f12e9[_0x7c66('0x54')]['id'])});}return _0xd7787b;});}})[_0x7c66('0x22')](respondWithResult(_0x154e80,null))[_0x7c66('0x57')](handleError(_0x154e80,null));};exports[_0x7c66('0x95')]=function(_0x24efe4,_0x3b1447,_0x5c2b50){return db['ChatQueue'][_0x7c66('0x5e')]({'where':{'id':_0x24efe4[_0x7c66('0x54')]['id']}})[_0x7c66('0x22')](handleEntityNotFound(_0x3b1447,null))[_0x7c66('0x22')](function(_0xb7ba91){if(_0xb7ba91){return _0xb7ba91['removeAgents'](_0x24efe4[_0x7c66('0x44')]['ids'])['then'](function(){if(_[_0x7c66('0x9a')](_0x24efe4[_0x7c66('0x44')]['ids'])){for(var _0x3d7dbf=0x0;_0x3d7dbf<_0x24efe4[_0x7c66('0x44')][_0x7c66('0x73')]['length'];_0x3d7dbf+=0x1){socket['emit'](_0x7c66('0x96'),{'UserId':Number(_0x24efe4[_0x7c66('0x44')][_0x7c66('0x73')][_0x3d7dbf]),'ChatQueueId':Number(_0x24efe4['params']['id'])});}}else{socket[_0x7c66('0x7c')](_0x7c66('0x96'),{'UserId':Number(_0x24efe4[_0x7c66('0x44')][_0x7c66('0x73')]),'ChatQueueId':Number(_0x24efe4[_0x7c66('0x54')]['id'])});}});}})[_0x7c66('0x22')](respondWithStatusCode(_0x3b1447,null))[_0x7c66('0x57')](handleError(_0x3b1447,null));};exports[_0x7c66('0x9b')]=function(_0x220461,_0x4c432a,_0x4fd2c0){var _0x27b7e9={};var _0x522070={};var _0x5d92e1;var _0x106518;return db[_0x7c66('0x3f')][_0x7c66('0x62')]({'where':{'id':_0x220461[_0x7c66('0x54')]['id']}})['then'](handleEntityNotFound(_0x4c432a,null))[_0x7c66('0x22')](function(_0x1e7d72){if(_0x1e7d72){_0x5d92e1=_0x1e7d72;_0x522070[_0x7c66('0x47')]=_[_0x7c66('0x45')](db['User']['rawAttributes']);_0x522070[_0x7c66('0x44')]=_[_0x7c66('0x45')](_0x220461[_0x7c66('0x44')]);_0x522070[_0x7c66('0x46')]=_[_0x7c66('0x55')](_0x522070[_0x7c66('0x47')],_0x522070['query']);_0x27b7e9[_0x7c66('0x49')]=_[_0x7c66('0x55')](_0x522070[_0x7c66('0x47')],qs[_0x7c66('0x48')](_0x220461[_0x7c66('0x44')][_0x7c66('0x48')]));_0x27b7e9[_0x7c66('0x49')]=_0x27b7e9[_0x7c66('0x49')][_0x7c66('0x4a')]?_0x27b7e9[_0x7c66('0x49')]:_0x522070['model'];_0x27b7e9[_0x7c66('0x4b')]=qs[_0x7c66('0x4c')](_0x220461[_0x7c66('0x44')][_0x7c66('0x4c')]);_0x27b7e9[_0x7c66('0x4d')]=qs[_0x7c66('0x46')](_['pick'](_0x220461[_0x7c66('0x44')],_0x522070[_0x7c66('0x46')]));if(_0x220461[_0x7c66('0x44')]['filter']){_0x27b7e9['where']=_[_0x7c66('0x4e')](_0x27b7e9[_0x7c66('0x4d')],{'$or':_['map'](_0x27b7e9[_0x7c66('0x49')],function(_0x2916e4){var _0x50d3c8={};_0x50d3c8[_0x2916e4]={'$like':'%'+_0x220461[_0x7c66('0x44')][_0x7c66('0x4f')]+'%'};return _0x50d3c8;})});}_0x27b7e9=_['merge']({},_0x27b7e9,_0x220461['options']);return _0x5d92e1[_0x7c66('0x9b')](_0x27b7e9);}})[_0x7c66('0x22')](function(_0x3c4cee){if(_0x3c4cee){_0x106518=_0x3c4cee[_0x7c66('0x4a')];if(!_0x220461['query']['hasOwnProperty'](_0x7c66('0x65'))){_0x27b7e9[_0x7c66('0x30')]=qs[_0x7c66('0x30')](_0x220461[_0x7c66('0x44')][_0x7c66('0x30')]);_0x27b7e9[_0x7c66('0x2e')]=qs[_0x7c66('0x2e')](_0x220461['query']['offset']);}return _0x5d92e1[_0x7c66('0x9b')](_0x27b7e9);}})[_0x7c66('0x22')](function(_0x20302b){if(_0x20302b){return _0x20302b?{'count':_0x106518,'rows':_0x20302b}:null;}})[_0x7c66('0x22')](respondWithResult(_0x4c432a,null))[_0x7c66('0x57')](handleError(_0x4c432a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 363389c..d5d7608 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 _0x4cdb=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x29bf4,_0x7285fa){var _0x5762e0=function(_0x33fa22){while(--_0x33fa22){_0x29bf4['push'](_0x29bf4['shift']());}};_0x5762e0(++_0x7285fa);}(_0x4cdb,0x182));var _0xb4cd=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x4cdb[_0x1b1e76];return _0x3d743a;};'use strict';var EventEmitter=require(_0xb4cd('0x0'));var ChatQueue=require(_0xb4cd('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb4cd('0x2'),'afterUpdate':'update','afterDestroy':_0xb4cd('0x3')};function emitEvent(_0x2cb515){return function(_0x474e26,_0x61f3d3,_0x3c33dc){ChatQueueEvents[_0xb4cd('0x4')](_0x2cb515+':'+_0x474e26['id'],_0x474e26);ChatQueueEvents[_0xb4cd('0x4')](_0x2cb515,_0x474e26);_0x3c33dc(null);};}for(var e in events){if(events[_0xb4cd('0x5')](e)){var event=events[e];ChatQueue[_0xb4cd('0x6')](e,emitEvent(event));}}module[_0xb4cd('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x01d0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','remove'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x01d0,0x14e));var _0x001d=function(_0x5da167,_0x465e69){_0x5da167=_0x5da167-0x0;var _0x4d798c=_0x01d0[_0x5da167];return _0x4d798c;};'use strict';var EventEmitter=require(_0x001d('0x0'));var ChatQueue=require(_0x001d('0x1'))['db'][_0x001d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x001d('0x3')](0x0);var events={'afterCreate':_0x001d('0x4'),'afterUpdate':'update','afterDestroy':_0x001d('0x5')};function emitEvent(_0x1b5408){return function(_0x332a01,_0x262c10,_0x1e59fa){ChatQueueEvents[_0x001d('0x6')](_0x1b5408+':'+_0x332a01['id'],_0x332a01);ChatQueueEvents[_0x001d('0x6')](_0x1b5408,_0x332a01);_0x1e59fa(null);};}for(var e in events){if(events[_0x001d('0x7')](e)){var event=events[e];ChatQueue[_0x001d('0x8')](e,emitEvent(event));}}module[_0x001d('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6b32e13..53893c4 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 _0xe313=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','bluebird','path'];(function(_0x4b8482,_0x1c185c){var _0x24956d=function(_0x521707){while(--_0x521707){_0x4b8482['push'](_0x4b8482['shift']());}};_0x24956d(++_0x1c185c);}(_0xe313,0x133));var _0x3e31=function(_0x4265fc,_0x16308a){_0x4265fc=_0x4265fc-0x0;var _0x50acfc=_0xe313[_0x4265fc];return _0x50acfc;};'use strict';var _=require(_0x3e31('0x0'));var util=require('util');var logger=require(_0x3e31('0x1'))(_0x3e31('0x2'));var moment=require('moment');var BPromise=require(_0x3e31('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e31('0x4'));var rimraf=require(_0x3e31('0x5'));var config=require(_0x3e31('0x6'));var attributes=require(_0x3e31('0x7'));module[_0x3e31('0x8')]=function(_0x33bb0c,_0xaaa4c9){return _0x33bb0c[_0x3e31('0x9')](_0x3e31('0xa'),attributes,{'tableName':_0x3e31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f4e=['exports','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f4e,0x1f2));var _0xe7f4=function(_0x58b437,_0x2c8a17){_0x58b437=_0x58b437-0x0;var _0xa671e4=_0x7f4e[_0x58b437];return _0xa671e4;};'use strict';var _=require(_0xe7f4('0x0'));var util=require('util');var logger=require(_0xe7f4('0x1'))(_0xe7f4('0x2'));var moment=require(_0xe7f4('0x3'));var BPromise=require(_0xe7f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe7f4('0x5'));var config=require(_0xe7f4('0x6'));var attributes=require(_0xe7f4('0x7'));module[_0xe7f4('0x8')]=function(_0x16b00a,_0x37a8f4){return _0x16b00a['define'](_0xe7f4('0x9'),attributes,{'tableName':_0xe7f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index a2b328d..fbfc42a 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 _0x4cdf=['request','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','include','map','model','then','debug','ShowChatQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x4947e3,_0x21f2ee){var _0x1911e5=function(_0x193c1b){while(--_0x193c1b){_0x4947e3['push'](_0x4947e3['shift']());}};_0x1911e5(++_0x21f2ee);}(_0x4cdf,0x180));var _0xf4cd=function(_0x493f18,_0x13790f){_0x493f18=_0x493f18-0x0;var _0x593769=_0x4cdf[_0x493f18];return _0x593769;};'use strict';var _=require(_0xf4cd('0x0'));var util=require(_0xf4cd('0x1'));var moment=require(_0xf4cd('0x2'));var BPromise=require(_0xf4cd('0x3'));var rs=require(_0xf4cd('0x4'));var fs=require('fs');var Redis=require(_0xf4cd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4cd('0x6'));var logger=require(_0xf4cd('0x7'))('rpc');var config=require(_0xf4cd('0x8'));var jayson=require(_0xf4cd('0x9'));var client=jayson[_0xf4cd('0xa')][_0xf4cd('0xb')]({'port':0x232a});config[_0xf4cd('0xc')]=_['defaults'](config[_0xf4cd('0xc')],{'host':_0xf4cd('0xd'),'port':0x18eb});var socket=require(_0xf4cd('0xe'))(new Redis(config[_0xf4cd('0xc')]));require('./chatQueue.socket')[_0xf4cd('0xf')](socket);function respondWithRpcPromise(_0x8778f1,_0x1ab042,_0x3ebf3e){return new BPromise(function(_0x427676,_0x1489c5){return client[_0xf4cd('0x10')](_0x8778f1,_0x3ebf3e)['then'](function(_0x45c46f){logger[_0xf4cd('0x11')](_0xf4cd('0x12'),_0x1ab042,'request\x20sent');logger['debug'](_0xf4cd('0x13'),_0x1ab042,_0xf4cd('0x14'),JSON[_0xf4cd('0x15')](_0x45c46f));if(_0x45c46f['error']){if(_0x45c46f[_0xf4cd('0x16')][_0xf4cd('0x17')]===0x1f4){logger[_0xf4cd('0x16')](_0xf4cd('0x12'),_0x1ab042,_0x45c46f[_0xf4cd('0x16')][_0xf4cd('0x18')]);return _0x1489c5(_0x45c46f['error'][_0xf4cd('0x18')]);}logger[_0xf4cd('0x16')](_0xf4cd('0x12'),_0x1ab042,_0x45c46f[_0xf4cd('0x16')]['message']);return _0x427676(_0x45c46f[_0xf4cd('0x16')][_0xf4cd('0x18')]);}else{logger[_0xf4cd('0x11')](_0xf4cd('0x12'),_0x1ab042,'request\x20sent');_0x427676(_0x45c46f['result'][_0xf4cd('0x18')]);}})[_0xf4cd('0x19')](function(_0x50c289){logger[_0xf4cd('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1ab042,_0x50c289);_0x1489c5(_0x50c289);});});}exports[_0xf4cd('0x1a')]=function(_0x82e1e5){var _0x40de42=this;return new Promise(function(_0xea3404,_0x36ab1a){return db[_0xf4cd('0x1b')][_0xf4cd('0x1c')]({'raw':_0x82e1e5[_0xf4cd('0x1d')]?_0x82e1e5[_0xf4cd('0x1d')][_0xf4cd('0x1e')]===undefined?!![]:![]:!![],'where':_0x82e1e5['options']?_0x82e1e5[_0xf4cd('0x1d')]['where']||null:null,'attributes':_0x82e1e5['options']?_0x82e1e5[_0xf4cd('0x1d')][_0xf4cd('0x1f')]||null:null,'limit':_0x82e1e5[_0xf4cd('0x1d')]?_0x82e1e5[_0xf4cd('0x1d')]['limit']||null:null,'include':_0x82e1e5['options']?_0x82e1e5['options'][_0xf4cd('0x20')]?_[_0xf4cd('0x21')](_0x82e1e5[_0xf4cd('0x1d')][_0xf4cd('0x20')],function(_0x5617ce){return{'model':db[_0x5617ce['model']],'as':_0x5617ce['as'],'attributes':_0x5617ce[_0xf4cd('0x1f')],'include':_0x5617ce[_0xf4cd('0x20')]?_[_0xf4cd('0x21')](_0x5617ce[_0xf4cd('0x20')],function(_0x1b314c){return{'model':db[_0x1b314c['model']],'as':_0x1b314c['as'],'attributes':_0x1b314c[_0xf4cd('0x1f')],'include':_0x1b314c[_0xf4cd('0x20')]?_[_0xf4cd('0x21')](_0x1b314c[_0xf4cd('0x20')],function(_0x5348a0){return{'model':db[_0x5348a0[_0xf4cd('0x22')]],'as':_0x5348a0['as'],'attributes':_0x5348a0[_0xf4cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf4cd('0x23')](function(_0x2c2390){logger[_0xf4cd('0x11')]('GetChatQueue',_0x82e1e5);logger[_0xf4cd('0x24')]('GetChatQueue',_0x82e1e5,JSON[_0xf4cd('0x15')](_0x2c2390));_0xea3404(_0x2c2390);})[_0xf4cd('0x19')](function(_0x3fb418){logger[_0xf4cd('0x16')]('GetChatQueue',_0x3fb418['message'],_0x82e1e5);_0x36ab1a(_0x40de42['error'](0x1f4,_0x3fb418[_0xf4cd('0x18')]));});});};exports[_0xf4cd('0x25')]=function(_0x30efc3){var _0x459577=this;return new Promise(function(_0x36ccb0,_0x1e8820){return db[_0xf4cd('0x1b')][_0xf4cd('0x26')]({'raw':_0x30efc3[_0xf4cd('0x1d')]?_0x30efc3['options']['raw']===undefined?!![]:![]:!![],'where':_0x30efc3[_0xf4cd('0x1d')]?_0x30efc3[_0xf4cd('0x1d')][_0xf4cd('0x27')]||null:null,'attributes':_0x30efc3[_0xf4cd('0x1d')]?_0x30efc3['options'][_0xf4cd('0x1f')]||null:null,'include':_0x30efc3[_0xf4cd('0x1d')]?_0x30efc3[_0xf4cd('0x1d')][_0xf4cd('0x20')]?_[_0xf4cd('0x21')](_0x30efc3[_0xf4cd('0x1d')][_0xf4cd('0x20')],function(_0x2e4d3f){return{'model':db[_0x2e4d3f[_0xf4cd('0x22')]],'as':_0x2e4d3f['as'],'attributes':_0x2e4d3f[_0xf4cd('0x1f')],'include':_0x2e4d3f[_0xf4cd('0x20')]?_[_0xf4cd('0x21')](_0x2e4d3f[_0xf4cd('0x20')],function(_0x544d7d){return{'model':db[_0x544d7d[_0xf4cd('0x22')]],'as':_0x544d7d['as'],'attributes':_0x544d7d['attributes'],'include':_0x544d7d['include']?_['map'](_0x544d7d[_0xf4cd('0x20')],function(_0x1865b1){return{'model':db[_0x1865b1[_0xf4cd('0x22')]],'as':_0x1865b1['as'],'attributes':_0x1865b1[_0xf4cd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49c8c3){logger[_0xf4cd('0x11')](_0xf4cd('0x25'),_0x30efc3);logger['debug'](_0xf4cd('0x25'),_0x30efc3,JSON[_0xf4cd('0x15')](_0x49c8c3));_0x36ccb0(_0x49c8c3);})[_0xf4cd('0x19')](function(_0x2186f4){logger['error']('ShowChatQueue',_0x2186f4[_0xf4cd('0x18')],_0x30efc3);_0x1e8820(_0x459577[_0xf4cd('0x16')](0x1f4,_0x2186f4[_0xf4cd('0x18')]));});});}; \ No newline at end of file +var _0x84ae=['message','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetChatQueue','ShowChatQueue','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x1e0e09,_0x53c664){var _0x4e05a1=function(_0x53ee7e){while(--_0x53ee7e){_0x1e0e09['push'](_0x1e0e09['shift']());}};_0x4e05a1(++_0x53c664);}(_0x84ae,0x101));var _0xe84a=function(_0x5b1edc,_0xd5fa84){_0x5b1edc=_0x5b1edc-0x0;var _0xe44ac8=_0x84ae[_0x5b1edc];return _0xe44ac8;};'use strict';var _=require(_0xe84a('0x0'));var util=require(_0xe84a('0x1'));var moment=require(_0xe84a('0x2'));var BPromise=require(_0xe84a('0x3'));var rs=require(_0xe84a('0x4'));var fs=require('fs');var Redis=require(_0xe84a('0x5'));var db=require(_0xe84a('0x6'))['db'];var utils=require(_0xe84a('0x7'));var logger=require(_0xe84a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe84a('0x9')]['http']({'port':0x232a});config[_0xe84a('0xa')]=_[_0xe84a('0xb')](config[_0xe84a('0xa')],{'host':_0xe84a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe84a('0xa')]));require(_0xe84a('0xd'))[_0xe84a('0xe')](socket);function respondWithRpcPromise(_0x5c47f9,_0x2a7d97,_0x17f161){return new BPromise(function(_0x368c9f,_0xbfda9c){return client[_0xe84a('0xf')](_0x5c47f9,_0x17f161)[_0xe84a('0x10')](function(_0x57ed4e){logger[_0xe84a('0x11')](_0xe84a('0x12'),_0x2a7d97,_0xe84a('0x13'));logger[_0xe84a('0x14')](_0xe84a('0x15'),_0x2a7d97,'request\x20sent',JSON['stringify'](_0x57ed4e));if(_0x57ed4e['error']){if(_0x57ed4e[_0xe84a('0x16')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2a7d97,_0x57ed4e[_0xe84a('0x16')][_0xe84a('0x17')]);return _0xbfda9c(_0x57ed4e[_0xe84a('0x16')][_0xe84a('0x17')]);}logger[_0xe84a('0x16')](_0xe84a('0x12'),_0x2a7d97,_0x57ed4e[_0xe84a('0x16')][_0xe84a('0x17')]);return _0x368c9f(_0x57ed4e['error'][_0xe84a('0x17')]);}else{logger[_0xe84a('0x11')](_0xe84a('0x12'),_0x2a7d97,_0xe84a('0x13'));_0x368c9f(_0x57ed4e[_0xe84a('0x18')][_0xe84a('0x17')]);}})[_0xe84a('0x19')](function(_0x1ed66a){logger[_0xe84a('0x16')](_0xe84a('0x12'),_0x2a7d97,_0x1ed66a);_0xbfda9c(_0x1ed66a);});});}exports['GetChatQueue']=function(_0x5cdde7){var _0x38a40a=this;return new Promise(function(_0x5c0177,_0x5aad8a){return db[_0xe84a('0x1a')][_0xe84a('0x1b')]({'raw':_0x5cdde7[_0xe84a('0x1c')]?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x1d')]===undefined?!![]:![]:!![],'where':_0x5cdde7['options']?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x1e')]||null:null,'attributes':_0x5cdde7[_0xe84a('0x1c')]?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x1f')]||null:null,'limit':_0x5cdde7[_0xe84a('0x1c')]?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x20')]||null:null,'include':_0x5cdde7['options']?_0x5cdde7['options']['include']?_[_0xe84a('0x21')](_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x22')],function(_0x594fdd){return{'model':db[_0x594fdd[_0xe84a('0x23')]],'as':_0x594fdd['as'],'attributes':_0x594fdd[_0xe84a('0x1f')],'include':_0x594fdd[_0xe84a('0x22')]?_[_0xe84a('0x21')](_0x594fdd[_0xe84a('0x22')],function(_0x30a53c){return{'model':db[_0x30a53c[_0xe84a('0x23')]],'as':_0x30a53c['as'],'attributes':_0x30a53c['attributes'],'include':_0x30a53c[_0xe84a('0x22')]?_['map'](_0x30a53c[_0xe84a('0x22')],function(_0x2a9bf){return{'model':db[_0x2a9bf[_0xe84a('0x23')]],'as':_0x2a9bf['as'],'attributes':_0x2a9bf[_0xe84a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5da546){logger[_0xe84a('0x11')](_0xe84a('0x24'),_0x5cdde7);logger[_0xe84a('0x14')](_0xe84a('0x24'),_0x5cdde7,JSON['stringify'](_0x5da546));_0x5c0177(_0x5da546);})[_0xe84a('0x19')](function(_0x569ef4){logger['error'](_0xe84a('0x24'),_0x569ef4['message'],_0x5cdde7);_0x5aad8a(_0x38a40a[_0xe84a('0x16')](0x1f4,_0x569ef4[_0xe84a('0x17')]));});});};exports[_0xe84a('0x25')]=function(_0x2ce18e){var _0x440c64=this;return new Promise(function(_0x536896,_0x35b677){return db['ChatQueue'][_0xe84a('0x26')]({'raw':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e[_0xe84a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e[_0xe84a('0x1c')][_0xe84a('0x1e')]||null:null,'attributes':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e[_0xe84a('0x1c')]['attributes']||null:null,'include':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e['options'][_0xe84a('0x22')]?_['map'](_0x2ce18e['options'][_0xe84a('0x22')],function(_0x4e62dc){return{'model':db[_0x4e62dc[_0xe84a('0x23')]],'as':_0x4e62dc['as'],'attributes':_0x4e62dc[_0xe84a('0x1f')],'include':_0x4e62dc[_0xe84a('0x22')]?_[_0xe84a('0x21')](_0x4e62dc[_0xe84a('0x22')],function(_0xe750c5){return{'model':db[_0xe750c5[_0xe84a('0x23')]],'as':_0xe750c5['as'],'attributes':_0xe750c5[_0xe84a('0x1f')],'include':_0xe750c5[_0xe84a('0x22')]?_[_0xe84a('0x21')](_0xe750c5['include'],function(_0x4bea08){return{'model':db[_0x4bea08[_0xe84a('0x23')]],'as':_0x4bea08['as'],'attributes':_0x4bea08[_0xe84a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe84a('0x10')](function(_0x5ad492){logger['info'](_0xe84a('0x25'),_0x2ce18e);logger['debug'](_0xe84a('0x25'),_0x2ce18e,JSON[_0xe84a('0x27')](_0x5ad492));_0x536896(_0x5ad492);})[_0xe84a('0x19')](function(_0x43e172){logger[_0xe84a('0x16')](_0xe84a('0x25'),_0x43e172['message'],_0x2ce18e);_0x35b677(_0x440c64[_0xe84a('0x16')](0x1f4,_0x43e172['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0daea7d..691a370 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 _0x2123=['./chatQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x137788,_0x5bb392){var _0x4cdf67=function(_0x43a0e3){while(--_0x43a0e3){_0x137788['push'](_0x137788['shift']());}};_0x4cdf67(++_0x5bb392);}(_0x2123,0x190));var _0x3212=function(_0x122743,_0x32bc14){_0x122743=_0x122743-0x0;var _0x14fc59=_0x2123[_0x122743];return _0x14fc59;};'use strict';var ChatQueueEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x7158b8,_0x2ff863){return function(_0x8c047){_0x2ff863[_0x3212('0x4')](_0x7158b8,_0x8c047);};}function removeListener(_0x304f80,_0x6ca653){return function(){ChatQueueEvents[_0x3212('0x5')](_0x304f80,_0x6ca653);};}exports[_0x3212('0x6')]=function(_0x5d9d36){for(var _0x3859e4=0x0,_0x2b1302=events[_0x3212('0x7')];_0x3859e4<_0x2b1302;_0x3859e4++){var _0x4b35e9=events[_0x3859e4];var _0x3e17a3=createListener('chatQueue:'+_0x4b35e9,_0x5d9d36);ChatQueueEvents['on'](_0x4b35e9,_0x3e17a3);}}; \ No newline at end of file +var _0xb469=['./chatQueue.events','save','remove','update','register'];(function(_0x92cab,_0x2c51f8){var _0x426485=function(_0x1b8038){while(--_0x1b8038){_0x92cab['push'](_0x92cab['shift']());}};_0x426485(++_0x2c51f8);}(_0xb469,0x13b));var _0x9b46=function(_0x31b970,_0x513b93){_0x31b970=_0x31b970-0x0;var _0x167869=_0xb469[_0x31b970];return _0x167869;};'use strict';var ChatQueueEvents=require(_0x9b46('0x0'));var events=[_0x9b46('0x1'),_0x9b46('0x2'),_0x9b46('0x3')];function createListener(_0x1a41e8,_0x895347){return function(_0x9212ae){_0x895347['emit'](_0x1a41e8,_0x9212ae);};}function removeListener(_0x31f853,_0x45322f){return function(){ChatQueueEvents['removeListener'](_0x31f853,_0x45322f);};}exports[_0x9b46('0x4')]=function(_0x405d1c){for(var _0x50b49e=0x0,_0x1b2dd3=events['length'];_0x50b49e<_0x1b2dd3;_0x50b49e++){var _0x4c1ed9=events[_0x50b49e];var _0x34c0de=createListener('chatQueue:'+_0x4c1ed9,_0x405d1c);ChatQueueEvents['on'](_0x4c1ed9,_0x34c0de);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index d4e4b33..3fa24a5 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x5fc3[_0x5b7788];return _0x573871;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x5ba482,_0x277785){_0x5ba482=_0x5ba482-0x0;var _0x51b0a4=_0x3e74[_0x5ba482];return _0x51b0a4;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c07c6e5..f1de203 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 _0xb453=['moment','sequelize','STRING','DATE'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb453,0x1e8));var _0x3b45=function(_0xe0c67e,_0x3d62af){_0xe0c67e=_0xe0c67e-0x0;var _0x7d8e09=_0xb453[_0xe0c67e];return _0x7d8e09;};'use strict';var moment=require(_0x3b45('0x0'));var Sequelize=require(_0x3b45('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3b45('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3b45('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3b45('0x3')]},'exitAt':{'type':Sequelize[_0x3b45('0x3')]},'reason':{'type':Sequelize[_0x3b45('0x2')]}}; \ No newline at end of file +var _0xe168=['DATE','sequelize','exports','STRING'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xe168,0x79));var _0x8e16=function(_0xd2732c,_0x467e35){_0xd2732c=_0xd2732c-0x0;var _0x258f4a=_0xe168[_0xd2732c];return _0x258f4a;};'use strict';var moment=require('moment');var Sequelize=require(_0x8e16('0x0'));module[_0x8e16('0x1')]={'uniqueid':{'type':Sequelize[_0x8e16('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8e16('0x2')]},'joinAt':{'type':Sequelize[_0x8e16('0x3')]},'leaveAt':{'type':Sequelize[_0x8e16('0x3')]},'acceptAt':{'type':Sequelize[_0x8e16('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b241a2f..985b0b5 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 _0x905a=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','create','body','find','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x905a,0xeb));var _0xa905=function(_0x5107ae,_0x2a6e97){_0x5107ae=_0x5107ae-0x0;var _0xa36b8e=_0x905a[_0x5107ae];return _0xa36b8e;};'use strict';var emlformat=require(_0xa905('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa905('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa905('0x2'));var BPromise=require(_0xa905('0x3'));var Mustache=require(_0xa905('0x4'));var util=require(_0xa905('0x5'));var path=require(_0xa905('0x6'));var sox=require(_0xa905('0x7'));var csv=require(_0xa905('0x8'));var ejs=require(_0xa905('0x9'));var fs=require('fs');var fs_extra=require(_0xa905('0xa'));var _=require(_0xa905('0xb'));var squel=require(_0xa905('0xc'));var crypto=require(_0xa905('0xd'));var jsforce=require(_0xa905('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa905('0x8'));var querystring=require('querystring');var Papa=require(_0xa905('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa905('0x10'));var as=require(_0xa905('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa905('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa905('0x13'));var licenseUtil=require(_0xa905('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54e06c,_0x3272df){_0x3272df=_0x3272df||0xcc;return function(_0x1caa49){if(_0x1caa49){return _0x54e06c[_0xa905('0x15')](_0x3272df);}return _0x54e06c[_0xa905('0x16')](_0x3272df)[_0xa905('0x17')]();};}function respondWithResult(_0xbe0d64,_0x4c42a4){_0x4c42a4=_0x4c42a4||0xc8;return function(_0x3ec259){if(_0x3ec259){return _0xbe0d64['status'](_0x4c42a4)[_0xa905('0x18')](_0x3ec259);}};}function respondWithFilteredResult(_0x97332d,_0x5990c8){return function(_0x58341f){if(_0x58341f){var _0x5b7b12=typeof _0x5990c8[_0xa905('0x19')]===_0xa905('0x1a')&&typeof _0x5990c8[_0xa905('0x1b')]===_0xa905('0x1a');var _0x185c1c=_0x58341f[_0xa905('0x1c')];var _0x1439d5=_0x5b7b12?0x0:_0x5990c8[_0xa905('0x19')];var _0xa59b33=_0x5b7b12?_0x58341f[_0xa905('0x1c')]:_0x5990c8[_0xa905('0x19')]+_0x5990c8[_0xa905('0x1b')];var _0x56c09f;if(_0xa59b33>=_0x185c1c){_0xa59b33=_0x185c1c;_0x56c09f=0xc8;}else{_0x56c09f=0xce;}_0x97332d[_0xa905('0x16')](_0x56c09f);return _0x97332d[_0xa905('0x1d')](_0xa905('0x1e'),_0x1439d5+'-'+_0xa59b33+'/'+_0x185c1c)[_0xa905('0x18')](_0x58341f);}return null;};}function patchUpdates(_0x14930d){return function(_0x36e094){try{jsonpatch['apply'](_0x36e094,_0x14930d,!![]);}catch(_0x4194a8){return BPromise[_0xa905('0x1f')](_0x4194a8);}return _0x36e094[_0xa905('0x20')]();};}function saveUpdates(_0x3193ca,_0x5c4b50){return function(_0x1da420){if(_0x1da420){return _0x1da420[_0xa905('0x21')](_0x3193ca)[_0xa905('0x22')](function(_0x1689a5){return _0x1689a5;});}return null;};}function removeEntity(_0x50a44a,_0x53d476){return function(_0x23fb4e){if(_0x23fb4e){return _0x23fb4e[_0xa905('0x23')]()['then'](function(){_0x50a44a[_0xa905('0x16')](0xcc)[_0xa905('0x17')]();});}};}function handleEntityNotFound(_0x447f6c,_0x182967){return function(_0x59fb12){if(!_0x59fb12){_0x447f6c[_0xa905('0x15')](0x194);}return _0x59fb12;};}function handleError(_0x3ad10c,_0x4bed6e){_0x4bed6e=_0x4bed6e||0x1f4;return function(_0x3e3067){logger[_0xa905('0x24')](_0x3e3067[_0xa905('0x25')]);if(_0x3e3067[_0xa905('0x26')]){delete _0x3e3067[_0xa905('0x26')];}_0x3ad10c[_0xa905('0x16')](_0x4bed6e)[_0xa905('0x27')](_0x3e3067);};}exports['index']=function(_0x3f391d,_0x32cf90){var _0x38c35d={},_0x4071c0={},_0x2713db={'count':0x0,'rows':[]};var _0x5d99eb=_['map'](db[_0xa905('0x28')][_0xa905('0x29')],function(_0x951d2e){return{'name':_0x951d2e[_0xa905('0x2a')],'type':_0x951d2e['type'][_0xa905('0x2b')]};});_0x4071c0[_0xa905('0x2c')]=_[_0xa905('0x2d')](_0x5d99eb,_0xa905('0x26'));_0x4071c0[_0xa905('0x2e')]=_['keys'](_0x3f391d[_0xa905('0x2e')]);_0x4071c0[_0xa905('0x2f')]=_[_0xa905('0x30')](_0x4071c0[_0xa905('0x2c')],_0x4071c0[_0xa905('0x2e')]);_0x38c35d[_0xa905('0x31')]=_['intersection'](_0x4071c0[_0xa905('0x2c')],qs[_0xa905('0x32')](_0x3f391d[_0xa905('0x2e')][_0xa905('0x32')]));_0x38c35d[_0xa905('0x31')]=_0x38c35d['attributes'][_0xa905('0x33')]?_0x38c35d['attributes']:_0x4071c0[_0xa905('0x2c')];if(!_0x3f391d[_0xa905('0x2e')][_0xa905('0x34')](_0xa905('0x35'))){_0x38c35d['limit']=qs[_0xa905('0x1b')](_0x3f391d[_0xa905('0x2e')]['limit']);_0x38c35d[_0xa905('0x19')]=qs['offset'](_0x3f391d[_0xa905('0x2e')]['offset']);}_0x38c35d[_0xa905('0x36')]=qs['sort'](_0x3f391d[_0xa905('0x2e')][_0xa905('0x37')]);_0x38c35d[_0xa905('0x38')]=qs[_0xa905('0x2f')](_[_0xa905('0x39')](_0x3f391d[_0xa905('0x2e')],_0x4071c0[_0xa905('0x2f')]),_0x5d99eb);if(_0x3f391d[_0xa905('0x2e')][_0xa905('0x3a')]){_0x38c35d[_0xa905('0x38')]=_[_0xa905('0x3b')](_0x38c35d['where'],{'$or':_[_0xa905('0x2d')](_0x5d99eb,function(_0xe08a81){if(_0xe08a81['type']!==_0xa905('0x3c')){var _0x271c32={};_0x271c32[_0xe08a81['name']]={'$like':'%'+_0x3f391d[_0xa905('0x2e')][_0xa905('0x3a')]+'%'};return _0x271c32;}})});}_0x38c35d=_['merge']({},_0x38c35d,_0x3f391d[_0xa905('0x3d')]);var _0x4b22f9={'where':_0x38c35d[_0xa905('0x38')]};return db[_0xa905('0x28')]['count'](_0x4b22f9)[_0xa905('0x22')](function(_0x4a8f02){_0x2713db[_0xa905('0x1c')]=_0x4a8f02;if(_0x3f391d['query'][_0xa905('0x3e')]){_0x38c35d[_0xa905('0x3f')]=[{'all':!![]}];}return db[_0xa905('0x28')][_0xa905('0x40')](_0x38c35d);})[_0xa905('0x22')](function(_0x193edc){_0x2713db[_0xa905('0x41')]=_0x193edc;return _0x2713db;})[_0xa905('0x22')](respondWithFilteredResult(_0x32cf90,_0x38c35d))['catch'](handleError(_0x32cf90,null));};exports[_0xa905('0x42')]=function(_0x1e10a7,_0x5a44dc){var _0x274f7a={'raw':!![],'where':{'id':_0x1e10a7['params']['id']}},_0x1d6033={};_0x1d6033[_0xa905('0x2c')]=_[_0xa905('0x43')](db['ChatQueueReport'][_0xa905('0x29')]);_0x1d6033[_0xa905('0x2e')]=_[_0xa905('0x43')](_0x1e10a7[_0xa905('0x2e')]);_0x1d6033[_0xa905('0x2f')]=_[_0xa905('0x30')](_0x1d6033[_0xa905('0x2c')],_0x1d6033[_0xa905('0x2e')]);_0x274f7a[_0xa905('0x31')]=_[_0xa905('0x30')](_0x1d6033[_0xa905('0x2c')],qs['fields'](_0x1e10a7[_0xa905('0x2e')]['fields']));_0x274f7a['attributes']=_0x274f7a[_0xa905('0x31')]['length']?_0x274f7a[_0xa905('0x31')]:_0x1d6033['model'];if(_0x1e10a7['query'][_0xa905('0x3e')]){_0x274f7a['include']=[{'all':!![]}];}_0x274f7a=_[_0xa905('0x3b')]({},_0x274f7a,_0x1e10a7['options']);return db['ChatQueueReport']['find'](_0x274f7a)['then'](handleEntityNotFound(_0x5a44dc,null))[_0xa905('0x22')](respondWithResult(_0x5a44dc,null))[_0xa905('0x44')](handleError(_0x5a44dc,null));};exports[_0xa905('0x45')]=function(_0x2ca873,_0x5c9e8a){return db[_0xa905('0x28')]['create'](_0x2ca873['body'],{})[_0xa905('0x22')](respondWithResult(_0x5c9e8a,0xc9))[_0xa905('0x44')](handleError(_0x5c9e8a,null));};exports[_0xa905('0x21')]=function(_0x1e1089,_0x10e0b7){if(_0x1e1089[_0xa905('0x46')]['id']){delete _0x1e1089[_0xa905('0x46')]['id'];}return db[_0xa905('0x28')][_0xa905('0x47')]({'where':{'id':_0x1e1089[_0xa905('0x48')]['id']}})[_0xa905('0x22')](handleEntityNotFound(_0x10e0b7,null))[_0xa905('0x22')](saveUpdates(_0x1e1089[_0xa905('0x46')],null))[_0xa905('0x22')](respondWithResult(_0x10e0b7,null))[_0xa905('0x44')](handleError(_0x10e0b7,null));};exports[_0xa905('0x23')]=function(_0x29d44a,_0x2af289){return db[_0xa905('0x28')][_0xa905('0x47')]({'where':{'id':_0x29d44a[_0xa905('0x48')]['id']}})[_0xa905('0x22')](handleEntityNotFound(_0x2af289,null))[_0xa905('0x22')](removeEntity(_0x2af289,null))[_0xa905('0x44')](handleError(_0x2af289,null));};exports['describe']=function(_0x9d2c41,_0x3e32e6){return db['ChatQueueReport']['describe']()[_0xa905('0x22')](respondWithResult(_0x3e32e6,null))[_0xa905('0x44')](handleError(_0x3e32e6,null));}; \ No newline at end of file +var _0xbc48=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','ChatQueueReport','length','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5361a4,_0x418f91){var _0x48b674=function(_0x4c99a2){while(--_0x4c99a2){_0x5361a4['push'](_0x5361a4['shift']());}};_0x48b674(++_0x418f91);}(_0xbc48,0x111));var _0x8bc4=function(_0x28afbe,_0x4d655b){_0x28afbe=_0x28afbe-0x0;var _0x16a494=_0xbc48[_0x28afbe];return _0x16a494;};'use strict';var emlformat=require(_0x8bc4('0x0'));var rimraf=require(_0x8bc4('0x1'));var zipdir=require(_0x8bc4('0x2'));var jsonpatch=require(_0x8bc4('0x3'));var rp=require('request-promise');var moment=require(_0x8bc4('0x4'));var BPromise=require(_0x8bc4('0x5'));var Mustache=require(_0x8bc4('0x6'));var util=require(_0x8bc4('0x7'));var path=require('path');var sox=require(_0x8bc4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bc4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8bc4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8bc4('0xb'));var querystring=require(_0x8bc4('0xc'));var Papa=require(_0x8bc4('0xd'));var Redis=require(_0x8bc4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8bc4('0xf'));var as=require(_0x8bc4('0x10'));var hardwareService=require(_0x8bc4('0x11'));var logger=require(_0x8bc4('0x12'))(_0x8bc4('0x13'));var utils=require(_0x8bc4('0x14'));var config=require(_0x8bc4('0x15'));var licenseUtil=require(_0x8bc4('0x16'));var db=require(_0x8bc4('0x17'))['db'];function respondWithStatusCode(_0x1f842d,_0xf04517){_0xf04517=_0xf04517||0xcc;return function(_0x1ec0e2){if(_0x1ec0e2){return _0x1f842d[_0x8bc4('0x18')](_0xf04517);}return _0x1f842d[_0x8bc4('0x19')](_0xf04517)[_0x8bc4('0x1a')]();};}function respondWithResult(_0x55e23a,_0x2617dc){_0x2617dc=_0x2617dc||0xc8;return function(_0x198f18){if(_0x198f18){return _0x55e23a[_0x8bc4('0x19')](_0x2617dc)[_0x8bc4('0x1b')](_0x198f18);}};}function respondWithFilteredResult(_0x2e1213,_0x3e3690){return function(_0x5cd8f7){if(_0x5cd8f7){var _0x4d2530=typeof _0x3e3690['offset']===_0x8bc4('0x1c')&&typeof _0x3e3690['limit']===_0x8bc4('0x1c');var _0x45244b=_0x5cd8f7[_0x8bc4('0x1d')];var _0x5982e6=_0x4d2530?0x0:_0x3e3690[_0x8bc4('0x1e')];var _0x968929=_0x4d2530?_0x5cd8f7['count']:_0x3e3690[_0x8bc4('0x1e')]+_0x3e3690['limit'];var _0x659ae3;if(_0x968929>=_0x45244b){_0x968929=_0x45244b;_0x659ae3=0xc8;}else{_0x659ae3=0xce;}_0x2e1213['status'](_0x659ae3);return _0x2e1213['set'](_0x8bc4('0x1f'),_0x5982e6+'-'+_0x968929+'/'+_0x45244b)[_0x8bc4('0x1b')](_0x5cd8f7);}return null;};}function patchUpdates(_0x415598){return function(_0x3c5dba){try{jsonpatch[_0x8bc4('0x20')](_0x3c5dba,_0x415598,!![]);}catch(_0xf0a578){return BPromise[_0x8bc4('0x21')](_0xf0a578);}return _0x3c5dba[_0x8bc4('0x22')]();};}function saveUpdates(_0x26c5e9,_0x3b402f){return function(_0x148fda){if(_0x148fda){return _0x148fda['update'](_0x26c5e9)[_0x8bc4('0x23')](function(_0x33f5b1){return _0x33f5b1;});}return null;};}function removeEntity(_0x23329e,_0x546d83){return function(_0x327e90){if(_0x327e90){return _0x327e90[_0x8bc4('0x24')]()['then'](function(){_0x23329e[_0x8bc4('0x19')](0xcc)[_0x8bc4('0x1a')]();});}};}function handleEntityNotFound(_0x45118c,_0x4cb042){return function(_0x324e59){if(!_0x324e59){_0x45118c['sendStatus'](0x194);}return _0x324e59;};}function handleError(_0x57b437,_0xb44005){_0xb44005=_0xb44005||0x1f4;return function(_0x29aef5){logger[_0x8bc4('0x25')](_0x29aef5[_0x8bc4('0x26')]);if(_0x29aef5[_0x8bc4('0x27')]){delete _0x29aef5[_0x8bc4('0x27')];}_0x57b437[_0x8bc4('0x19')](_0xb44005)[_0x8bc4('0x28')](_0x29aef5);};}exports['index']=function(_0x56f462,_0x2f9cf4){var _0x39f657={},_0x3bada3={},_0x44fc89={'count':0x0,'rows':[]};var _0x134760=_[_0x8bc4('0x29')](db['ChatQueueReport'][_0x8bc4('0x2a')],function(_0x88f990){return{'name':_0x88f990[_0x8bc4('0x2b')],'type':_0x88f990[_0x8bc4('0x2c')]['key']};});_0x3bada3[_0x8bc4('0x2d')]=_[_0x8bc4('0x29')](_0x134760,_0x8bc4('0x27'));_0x3bada3[_0x8bc4('0x2e')]=_[_0x8bc4('0x2f')](_0x56f462['query']);_0x3bada3[_0x8bc4('0x30')]=_['intersection'](_0x3bada3[_0x8bc4('0x2d')],_0x3bada3[_0x8bc4('0x2e')]);_0x39f657[_0x8bc4('0x31')]=_[_0x8bc4('0x32')](_0x3bada3['model'],qs['fields'](_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x33')]));_0x39f657[_0x8bc4('0x31')]=_0x39f657[_0x8bc4('0x31')]['length']?_0x39f657['attributes']:_0x3bada3['model'];if(!_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x34')](_0x8bc4('0x35'))){_0x39f657['limit']=qs['limit'](_0x56f462['query']['limit']);_0x39f657['offset']=qs[_0x8bc4('0x1e')](_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x1e')]);}_0x39f657['order']=qs[_0x8bc4('0x36')](_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x36')]);_0x39f657['where']=qs[_0x8bc4('0x30')](_[_0x8bc4('0x37')](_0x56f462[_0x8bc4('0x2e')],_0x3bada3[_0x8bc4('0x30')]),_0x134760);if(_0x56f462[_0x8bc4('0x2e')]['filter']){_0x39f657[_0x8bc4('0x38')]=_[_0x8bc4('0x39')](_0x39f657[_0x8bc4('0x38')],{'$or':_['map'](_0x134760,function(_0xe9a913){if(_0xe9a913[_0x8bc4('0x2c')]!==_0x8bc4('0x3a')){var _0x14a511={};_0x14a511[_0xe9a913[_0x8bc4('0x27')]]={'$like':'%'+_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x3b')]+'%'};return _0x14a511;}})});}_0x39f657=_[_0x8bc4('0x39')]({},_0x39f657,_0x56f462[_0x8bc4('0x3c')]);var _0x2fb60d={'where':_0x39f657[_0x8bc4('0x38')]};return db['ChatQueueReport']['count'](_0x2fb60d)[_0x8bc4('0x23')](function(_0x1f89f2){_0x44fc89['count']=_0x1f89f2;if(_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x3d')]){_0x39f657[_0x8bc4('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x39f657);})[_0x8bc4('0x23')](function(_0x31be57){_0x44fc89[_0x8bc4('0x3f')]=_0x31be57;return _0x44fc89;})[_0x8bc4('0x23')](respondWithFilteredResult(_0x2f9cf4,_0x39f657))[_0x8bc4('0x40')](handleError(_0x2f9cf4,null));};exports[_0x8bc4('0x41')]=function(_0x270a7c,_0x53d524){var _0x4cceab={'raw':!![],'where':{'id':_0x270a7c['params']['id']}},_0x23f7a5={};_0x23f7a5['model']=_[_0x8bc4('0x2f')](db[_0x8bc4('0x42')][_0x8bc4('0x2a')]);_0x23f7a5[_0x8bc4('0x2e')]=_[_0x8bc4('0x2f')](_0x270a7c[_0x8bc4('0x2e')]);_0x23f7a5['filters']=_[_0x8bc4('0x32')](_0x23f7a5[_0x8bc4('0x2d')],_0x23f7a5['query']);_0x4cceab[_0x8bc4('0x31')]=_['intersection'](_0x23f7a5[_0x8bc4('0x2d')],qs['fields'](_0x270a7c[_0x8bc4('0x2e')][_0x8bc4('0x33')]));_0x4cceab[_0x8bc4('0x31')]=_0x4cceab['attributes'][_0x8bc4('0x43')]?_0x4cceab[_0x8bc4('0x31')]:_0x23f7a5[_0x8bc4('0x2d')];if(_0x270a7c[_0x8bc4('0x2e')]['includeAll']){_0x4cceab['include']=[{'all':!![]}];}_0x4cceab=_[_0x8bc4('0x39')]({},_0x4cceab,_0x270a7c[_0x8bc4('0x3c')]);return db[_0x8bc4('0x42')]['find'](_0x4cceab)['then'](handleEntityNotFound(_0x53d524,null))[_0x8bc4('0x23')](respondWithResult(_0x53d524,null))['catch'](handleError(_0x53d524,null));};exports[_0x8bc4('0x44')]=function(_0x38da9c,_0x1c758c){return db[_0x8bc4('0x42')][_0x8bc4('0x44')](_0x38da9c[_0x8bc4('0x45')],{})[_0x8bc4('0x23')](respondWithResult(_0x1c758c,0xc9))[_0x8bc4('0x40')](handleError(_0x1c758c,null));};exports[_0x8bc4('0x46')]=function(_0x2b739f,_0x188bce){if(_0x2b739f[_0x8bc4('0x45')]['id']){delete _0x2b739f[_0x8bc4('0x45')]['id'];}return db[_0x8bc4('0x42')][_0x8bc4('0x47')]({'where':{'id':_0x2b739f[_0x8bc4('0x48')]['id']}})['then'](handleEntityNotFound(_0x188bce,null))[_0x8bc4('0x23')](saveUpdates(_0x2b739f[_0x8bc4('0x45')],null))[_0x8bc4('0x23')](respondWithResult(_0x188bce,null))[_0x8bc4('0x40')](handleError(_0x188bce,null));};exports[_0x8bc4('0x24')]=function(_0x1c7b27,_0x1e6641){return db[_0x8bc4('0x42')]['find']({'where':{'id':_0x1c7b27[_0x8bc4('0x48')]['id']}})[_0x8bc4('0x23')](handleEntityNotFound(_0x1e6641,null))[_0x8bc4('0x23')](removeEntity(_0x1e6641,null))[_0x8bc4('0x40')](handleError(_0x1e6641,null));};exports['describe']=function(_0x47623a,_0x47d108){return db[_0x8bc4('0x42')]['describe']()[_0x8bc4('0x23')](respondWithResult(_0x47d108,null))[_0x8bc4('0x40')](handleError(_0x47d108,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c2b324e..03eed32 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8a976cf..12305a4 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 _0x7dab=['info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','UpdateChatQueueReport','update','where','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x7dab,0x122));var _0xb7da=function(_0xc8939d,_0x5d77c8){_0xc8939d=_0xc8939d-0x0;var _0x46f913=_0x7dab[_0xc8939d];return _0x46f913;};'use strict';var _=require(_0xb7da('0x0'));var util=require(_0xb7da('0x1'));var moment=require(_0xb7da('0x2'));var BPromise=require(_0xb7da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7da('0x5'))(_0xb7da('0x6'));var config=require(_0xb7da('0x7'));var jayson=require(_0xb7da('0x8'));var client=jayson['client'][_0xb7da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59c57e,_0x58cb99,_0x52c047){return new BPromise(function(_0xd14541,_0x1a8390){return client[_0xb7da('0xa')](_0x59c57e,_0x52c047)[_0xb7da('0xb')](function(_0x4af85c){logger['info'](_0xb7da('0xc'),_0x58cb99,'request\x20sent');logger[_0xb7da('0xd')](_0xb7da('0xe'),_0x58cb99,_0xb7da('0xf'),JSON[_0xb7da('0x10')](_0x4af85c));if(_0x4af85c[_0xb7da('0x11')]){if(_0x4af85c[_0xb7da('0x11')][_0xb7da('0x12')]===0x1f4){logger[_0xb7da('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x58cb99,_0x4af85c['error'][_0xb7da('0x13')]);return _0x1a8390(_0x4af85c[_0xb7da('0x11')][_0xb7da('0x13')]);}logger['error'](_0xb7da('0xc'),_0x58cb99,_0x4af85c['error']['message']);return _0xd14541(_0x4af85c['error'][_0xb7da('0x13')]);}else{logger[_0xb7da('0x14')](_0xb7da('0xc'),_0x58cb99,_0xb7da('0xf'));_0xd14541(_0x4af85c[_0xb7da('0x15')]['message']);}})[_0xb7da('0x16')](function(_0x147503){logger['error'](_0xb7da('0xc'),_0x58cb99,_0x147503);_0x1a8390(_0x147503);});});}exports[_0xb7da('0x17')]=function(_0x49d6d2){var _0x562525=this;return new Promise(function(_0x1ef395,_0x157bd0){return db[_0xb7da('0x18')]['create'](_0x49d6d2[_0xb7da('0x19')],{'raw':_0x49d6d2[_0xb7da('0x1a')]?_0x49d6d2[_0xb7da('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb7da('0xb')](function(_0x49457c){logger[_0xb7da('0x14')](_0xb7da('0x17'),_0x49d6d2);logger[_0xb7da('0xd')](_0xb7da('0x17'),_0x49d6d2,JSON[_0xb7da('0x10')](_0x49457c));_0x1ef395(_0x49457c);})[_0xb7da('0x16')](function(_0x19e58e){logger['error'](_0xb7da('0x17'),_0x19e58e[_0xb7da('0x13')],_0x49d6d2);_0x157bd0(_0x562525[_0xb7da('0x11')](0x1f4,_0x19e58e[_0xb7da('0x13')]));});});};exports[_0xb7da('0x1b')]=function(_0x4694a0){var _0x81f431=this;return new Promise(function(_0x3c4eab,_0xa9093d){return db[_0xb7da('0x18')][_0xb7da('0x1c')](_0x4694a0[_0xb7da('0x19')],{'raw':_0x4694a0[_0xb7da('0x1a')]?_0x4694a0[_0xb7da('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4694a0['options']?_0x4694a0[_0xb7da('0x1a')][_0xb7da('0x1d')]||null:null,'attributes':_0x4694a0['options']?_0x4694a0['options'][_0xb7da('0x1e')]||null:null,'limit':_0x4694a0[_0xb7da('0x1a')]?_0x4694a0['options']['limit']||null:null})[_0xb7da('0xb')](function(_0x428e1f){logger['info']('UpdateChatQueueReport',_0x4694a0);logger[_0xb7da('0xd')](_0xb7da('0x1b'),_0x4694a0,JSON[_0xb7da('0x10')](_0x428e1f));_0x3c4eab(_0x428e1f);})[_0xb7da('0x16')](function(_0x45a752){logger[_0xb7da('0x11')](_0xb7da('0x1b'),_0x45a752[_0xb7da('0x13')],_0x4694a0);_0xa9093d(_0x81f431[_0xb7da('0x11')](0x1f4,_0x45a752[_0xb7da('0x13')]));});});}; \ No newline at end of file +var _0xf3e5=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','options','raw','catch','ChatQueueReport','body','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf3e5,0xc3));var _0x5f3e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xf3e5[_0x411add];return _0x238242;};'use strict';var _=require(_0x5f3e('0x0'));var util=require(_0x5f3e('0x1'));var moment=require(_0x5f3e('0x2'));var BPromise=require(_0x5f3e('0x3'));var rs=require(_0x5f3e('0x4'));var fs=require('fs');var Redis=require(_0x5f3e('0x5'));var db=require(_0x5f3e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f3e('0x7'))(_0x5f3e('0x8'));var config=require(_0x5f3e('0x9'));var jayson=require(_0x5f3e('0xa'));var client=jayson[_0x5f3e('0xb')][_0x5f3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f146c,_0xd43485,_0x23c665){return new BPromise(function(_0x3b9fd3,_0x55ba3f){return client[_0x5f3e('0xd')](_0x5f146c,_0x23c665)[_0x5f3e('0xe')](function(_0x1faa10){logger[_0x5f3e('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0xd43485,_0x5f3e('0x10'));logger[_0x5f3e('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xd43485,_0x5f3e('0x10'),JSON[_0x5f3e('0x12')](_0x1faa10));if(_0x1faa10[_0x5f3e('0x13')]){if(_0x1faa10[_0x5f3e('0x13')][_0x5f3e('0x14')]===0x1f4){logger[_0x5f3e('0x13')](_0x5f3e('0x15'),_0xd43485,_0x1faa10[_0x5f3e('0x13')]['message']);return _0x55ba3f(_0x1faa10['error']['message']);}logger[_0x5f3e('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0xd43485,_0x1faa10[_0x5f3e('0x13')]['message']);return _0x3b9fd3(_0x1faa10[_0x5f3e('0x13')][_0x5f3e('0x16')]);}else{logger[_0x5f3e('0xf')](_0x5f3e('0x15'),_0xd43485,'request\x20sent');_0x3b9fd3(_0x1faa10[_0x5f3e('0x17')][_0x5f3e('0x16')]);}})['catch'](function(_0x564154){logger['error'](_0x5f3e('0x15'),_0xd43485,_0x564154);_0x55ba3f(_0x564154);});});}exports[_0x5f3e('0x18')]=function(_0x5af38d){var _0x3a643b=this;return new Promise(function(_0x45e6e0,_0x50c4c0){return db['ChatQueueReport']['create'](_0x5af38d['body'],{'raw':_0x5af38d[_0x5f3e('0x19')]?_0x5af38d['options'][_0x5f3e('0x1a')]===undefined?!![]:![]:!![]})[_0x5f3e('0xe')](function(_0x36d43d){logger['info'](_0x5f3e('0x18'),_0x5af38d);logger['debug'](_0x5f3e('0x18'),_0x5af38d,JSON[_0x5f3e('0x12')](_0x36d43d));_0x45e6e0(_0x36d43d);})[_0x5f3e('0x1b')](function(_0x892c54){logger['error'](_0x5f3e('0x18'),_0x892c54[_0x5f3e('0x16')],_0x5af38d);_0x50c4c0(_0x3a643b['error'](0x1f4,_0x892c54[_0x5f3e('0x16')]));});});};exports['UpdateChatQueueReport']=function(_0xb56463){var _0x22e90e=this;return new Promise(function(_0x3c0cba,_0x225b25){return db[_0x5f3e('0x1c')]['update'](_0xb56463[_0x5f3e('0x1d')],{'raw':_0xb56463[_0x5f3e('0x19')]?_0xb56463[_0x5f3e('0x19')][_0x5f3e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb56463['options']?_0xb56463[_0x5f3e('0x19')][_0x5f3e('0x1e')]||null:null,'attributes':_0xb56463['options']?_0xb56463[_0x5f3e('0x19')][_0x5f3e('0x1f')]||null:null,'limit':_0xb56463[_0x5f3e('0x19')]?_0xb56463[_0x5f3e('0x19')][_0x5f3e('0x20')]||null:null})[_0x5f3e('0xe')](function(_0x56ce37){logger[_0x5f3e('0xf')](_0x5f3e('0x21'),_0xb56463);logger[_0x5f3e('0x11')](_0x5f3e('0x21'),_0xb56463,JSON[_0x5f3e('0x12')](_0x56ce37));_0x3c0cba(_0x56ce37);})[_0x5f3e('0x1b')](function(_0x5f4b0e){logger['error'](_0x5f3e('0x21'),_0x5f4b0e['message'],_0xb56463);_0x225b25(_0x22e90e[_0x5f3e('0x13')](0x1f4,_0x5f4b0e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 602223e..8526dcc 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 _0xaf6e=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','put','update'];(function(_0x5c27b6,_0x4a3c28){var _0x284ce4=function(_0x29fa20){while(--_0x29fa20){_0x5c27b6['push'](_0x5c27b6['shift']());}};_0x284ce4(++_0x4a3c28);}(_0xaf6e,0xab));var _0xeaf6=function(_0x5955b5,_0x395ff7){_0x5955b5=_0x5955b5-0x0;var _0x433350=_0xaf6e[_0x5955b5];return _0x433350;};'use strict';var multer=require(_0xeaf6('0x0'));var util=require(_0xeaf6('0x1'));var path=require(_0xeaf6('0x2'));var timeout=require(_0xeaf6('0x3'));var express=require(_0xeaf6('0x4'));var router=express['Router']();var fs_extra=require(_0xeaf6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeaf6('0x6'));var config=require(_0xeaf6('0x7'));var controller=require(_0xeaf6('0x8'));router['get']('/',auth[_0xeaf6('0x9')](),controller[_0xeaf6('0xa')]);router[_0xeaf6('0xb')](_0xeaf6('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xeaf6('0xb')](_0xeaf6('0xd'),auth[_0xeaf6('0x9')](),controller[_0xeaf6('0xe')]);router[_0xeaf6('0xf')]('/',auth[_0xeaf6('0x9')](),controller['create']);router[_0xeaf6('0x10')]('/:id',auth[_0xeaf6('0x9')](),controller[_0xeaf6('0x11')]);router[_0xeaf6('0x12')](_0xeaf6('0xd'),auth['isAuthenticated'](),controller[_0xeaf6('0x13')]);module[_0xeaf6('0x14')]=router; \ No newline at end of file +var _0x3f64=['isAuthenticated','get','describe','/:id','post','create','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4c53f7,_0x58ead6){var _0x26d53a=function(_0x2cc709){while(--_0x2cc709){_0x4c53f7['push'](_0x4c53f7['shift']());}};_0x26d53a(++_0x58ead6);}(_0x3f64,0x159));var _0x43f6=function(_0x4d8cca,_0x349870){_0x4d8cca=_0x4d8cca-0x0;var _0xe6f1e1=_0x3f64[_0x4d8cca];return _0xe6f1e1;};'use strict';var multer=require('multer');var util=require(_0x43f6('0x0'));var path=require(_0x43f6('0x1'));var timeout=require(_0x43f6('0x2'));var express=require(_0x43f6('0x3'));var router=express['Router']();var fs_extra=require(_0x43f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x43f6('0x5'));var config=require(_0x43f6('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x43f6('0x7')](),controller['index']);router[_0x43f6('0x8')]('/describe',auth[_0x43f6('0x7')](),controller[_0x43f6('0x9')]);router[_0x43f6('0x8')](_0x43f6('0xa'),auth[_0x43f6('0x7')](),controller['show']);router[_0x43f6('0xb')]('/',auth['isAuthenticated'](),controller[_0x43f6('0xc')]);router['put'](_0x43f6('0xa'),auth[_0x43f6('0x7')](),controller[_0x43f6('0xd')]);router['delete'](_0x43f6('0xa'),auth[_0x43f6('0x7')](),controller[_0x43f6('0xe')]);module[_0x43f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 907b0c7..b528b80 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4abc3f,_0x1d4e88){var _0x1f0442=function(_0x597ea0){while(--_0x597ea0){_0x4abc3f['push'](_0x4abc3f['shift']());}};_0x1f0442(++_0x1d4e88);}(_0xf4eb,0xec));var _0xbf4e=function(_0x39e416,_0x1f616d){_0x39e416=_0x39e416-0x0;var _0x3665be=_0xf4eb[_0x39e416];return _0x3665be;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x154e61,_0xa11a5){var _0x323d74=function(_0x570d12){while(--_0x570d12){_0x154e61['push'](_0x154e61['shift']());}};_0x323d74(++_0xa11a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0xcb91[_0x491cbe];return _0x59449d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b348753..e2f196a 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 _0x3f35=['offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','ChatTransferReport','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','end','status'];(function(_0x1e8094,_0x10d02b){var _0x518667=function(_0x4bf45b){while(--_0x4bf45b){_0x1e8094['push'](_0x1e8094['shift']());}};_0x518667(++_0x10d02b);}(_0x3f35,0x14f));var _0x53f3=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x3f35[_0x172133];return _0x2460e5;};'use strict';var emlformat=require(_0x53f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53f3('0x1'));var jsonpatch=require(_0x53f3('0x2'));var rp=require(_0x53f3('0x3'));var moment=require(_0x53f3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53f3('0x5'));var util=require(_0x53f3('0x6'));var path=require(_0x53f3('0x7'));var sox=require(_0x53f3('0x8'));var csv=require(_0x53f3('0x9'));var ejs=require(_0x53f3('0xa'));var fs=require('fs');var fs_extra=require(_0x53f3('0xb'));var _=require('lodash');var squel=require(_0x53f3('0xc'));var crypto=require(_0x53f3('0xd'));var jsforce=require(_0x53f3('0xe'));var deskjs=require(_0x53f3('0xf'));var toCsv=require(_0x53f3('0x9'));var querystring=require('querystring');var Papa=require(_0x53f3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53f3('0x11'));var as=require(_0x53f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53f3('0x13'))(_0x53f3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53f3('0x15'));var db=require(_0x53f3('0x16'))['db'];function respondWithStatusCode(_0x3322f2,_0x2dba0a){_0x2dba0a=_0x2dba0a||0xcc;return function(_0x1a3ae9){if(_0x1a3ae9){return _0x3322f2['sendStatus'](_0x2dba0a);}return _0x3322f2['status'](_0x2dba0a)[_0x53f3('0x17')]();};}function respondWithResult(_0x4c3ed5,_0x96a463){_0x96a463=_0x96a463||0xc8;return function(_0x4be8b1){if(_0x4be8b1){return _0x4c3ed5[_0x53f3('0x18')](_0x96a463)['json'](_0x4be8b1);}};}function respondWithFilteredResult(_0x5ac285,_0x364ea5){return function(_0x52d460){if(_0x52d460){var _0x2cef1b=typeof _0x364ea5[_0x53f3('0x19')]===_0x53f3('0x1a')&&typeof _0x364ea5['limit']===_0x53f3('0x1a');var _0x431b87=_0x52d460[_0x53f3('0x1b')];var _0x4dd543=_0x2cef1b?0x0:_0x364ea5[_0x53f3('0x19')];var _0x38ff71=_0x2cef1b?_0x52d460[_0x53f3('0x1b')]:_0x364ea5['offset']+_0x364ea5[_0x53f3('0x1c')];var _0x267208;if(_0x38ff71>=_0x431b87){_0x38ff71=_0x431b87;_0x267208=0xc8;}else{_0x267208=0xce;}_0x5ac285[_0x53f3('0x18')](_0x267208);return _0x5ac285[_0x53f3('0x1d')](_0x53f3('0x1e'),_0x4dd543+'-'+_0x38ff71+'/'+_0x431b87)['json'](_0x52d460);}return null;};}function patchUpdates(_0x3ef071){return function(_0x4c1463){try{jsonpatch[_0x53f3('0x1f')](_0x4c1463,_0x3ef071,!![]);}catch(_0x485441){return BPromise[_0x53f3('0x20')](_0x485441);}return _0x4c1463[_0x53f3('0x21')]();};}function saveUpdates(_0x3b3a73,_0x284df2){return function(_0x42b550){if(_0x42b550){return _0x42b550[_0x53f3('0x22')](_0x3b3a73)[_0x53f3('0x23')](function(_0x59e6ac){return _0x59e6ac;});}return null;};}function removeEntity(_0x50b59e,_0x2f99cc){return function(_0x40d1a7){if(_0x40d1a7){return _0x40d1a7[_0x53f3('0x24')]()[_0x53f3('0x23')](function(){_0x50b59e[_0x53f3('0x18')](0xcc)[_0x53f3('0x17')]();});}};}function handleEntityNotFound(_0xbee97a,_0x9aa5d8){return function(_0x1f43cb){if(!_0x1f43cb){_0xbee97a[_0x53f3('0x25')](0x194);}return _0x1f43cb;};}function handleError(_0x4cb07c,_0x3302b2){_0x3302b2=_0x3302b2||0x1f4;return function(_0xf84f7e){logger['error'](_0xf84f7e[_0x53f3('0x26')]);if(_0xf84f7e[_0x53f3('0x27')]){delete _0xf84f7e[_0x53f3('0x27')];}_0x4cb07c[_0x53f3('0x18')](_0x3302b2)[_0x53f3('0x28')](_0xf84f7e);};}exports[_0x53f3('0x29')]=function(_0x4d4147,_0x3b9c0f){var _0x9499b3={},_0x5ba851={},_0x13bfed={'count':0x0,'rows':[]};var _0x12a7bb=_['map'](db[_0x53f3('0x2a')]['rawAttributes'],function(_0x53a056){return{'name':_0x53a056[_0x53f3('0x2b')],'type':_0x53a056[_0x53f3('0x2c')]['key']};});_0x5ba851[_0x53f3('0x2d')]=_[_0x53f3('0x2e')](_0x12a7bb,'name');_0x5ba851[_0x53f3('0x2f')]=_[_0x53f3('0x30')](_0x4d4147[_0x53f3('0x2f')]);_0x5ba851[_0x53f3('0x31')]=_['intersection'](_0x5ba851[_0x53f3('0x2d')],_0x5ba851['query']);_0x9499b3[_0x53f3('0x32')]=_[_0x53f3('0x33')](_0x5ba851[_0x53f3('0x2d')],qs['fields'](_0x4d4147[_0x53f3('0x2f')][_0x53f3('0x34')]));_0x9499b3['attributes']=_0x9499b3['attributes'][_0x53f3('0x35')]?_0x9499b3['attributes']:_0x5ba851[_0x53f3('0x2d')];if(!_0x4d4147[_0x53f3('0x2f')][_0x53f3('0x36')](_0x53f3('0x37'))){_0x9499b3[_0x53f3('0x1c')]=qs[_0x53f3('0x1c')](_0x4d4147[_0x53f3('0x2f')][_0x53f3('0x1c')]);_0x9499b3[_0x53f3('0x19')]=qs[_0x53f3('0x19')](_0x4d4147[_0x53f3('0x2f')]['offset']);}_0x9499b3['order']=qs[_0x53f3('0x38')](_0x4d4147['query']['sort']);_0x9499b3[_0x53f3('0x39')]=qs[_0x53f3('0x31')](_[_0x53f3('0x3a')](_0x4d4147[_0x53f3('0x2f')],_0x5ba851['filters']),_0x12a7bb);if(_0x4d4147[_0x53f3('0x2f')][_0x53f3('0x3b')]){_0x9499b3['where']=_[_0x53f3('0x3c')](_0x9499b3[_0x53f3('0x39')],{'$or':_['map'](_0x12a7bb,function(_0x4b13ad){if(_0x4b13ad[_0x53f3('0x2c')]!==_0x53f3('0x3d')){var _0x423357={};_0x423357[_0x4b13ad[_0x53f3('0x27')]]={'$like':'%'+_0x4d4147[_0x53f3('0x2f')][_0x53f3('0x3b')]+'%'};return _0x423357;}})});}_0x9499b3=_['merge']({},_0x9499b3,_0x4d4147[_0x53f3('0x3e')]);var _0x3cc4ff={'where':_0x9499b3[_0x53f3('0x39')]};return db[_0x53f3('0x2a')]['count'](_0x3cc4ff)[_0x53f3('0x23')](function(_0x1620b0){_0x13bfed['count']=_0x1620b0;if(_0x4d4147[_0x53f3('0x2f')][_0x53f3('0x3f')]){_0x9499b3['include']=[{'all':!![]}];}return db[_0x53f3('0x2a')]['findAll'](_0x9499b3);})['then'](function(_0x288798){_0x13bfed['rows']=_0x288798;return _0x13bfed;})[_0x53f3('0x23')](respondWithFilteredResult(_0x3b9c0f,_0x9499b3))[_0x53f3('0x40')](handleError(_0x3b9c0f,null));};exports[_0x53f3('0x41')]=function(_0x1375e2,_0x541900){var _0x5b2cdd={'raw':!![],'where':{'id':_0x1375e2[_0x53f3('0x42')]['id']}},_0x2bdc06={};_0x2bdc06[_0x53f3('0x2d')]=_[_0x53f3('0x30')](db[_0x53f3('0x2a')]['rawAttributes']);_0x2bdc06['query']=_[_0x53f3('0x30')](_0x1375e2[_0x53f3('0x2f')]);_0x2bdc06[_0x53f3('0x31')]=_[_0x53f3('0x33')](_0x2bdc06[_0x53f3('0x2d')],_0x2bdc06[_0x53f3('0x2f')]);_0x5b2cdd[_0x53f3('0x32')]=_[_0x53f3('0x33')](_0x2bdc06['model'],qs[_0x53f3('0x34')](_0x1375e2[_0x53f3('0x2f')][_0x53f3('0x34')]));_0x5b2cdd[_0x53f3('0x32')]=_0x5b2cdd[_0x53f3('0x32')][_0x53f3('0x35')]?_0x5b2cdd[_0x53f3('0x32')]:_0x2bdc06[_0x53f3('0x2d')];if(_0x1375e2[_0x53f3('0x2f')][_0x53f3('0x3f')]){_0x5b2cdd[_0x53f3('0x43')]=[{'all':!![]}];}_0x5b2cdd=_[_0x53f3('0x3c')]({},_0x5b2cdd,_0x1375e2['options']);return db[_0x53f3('0x2a')]['find'](_0x5b2cdd)['then'](handleEntityNotFound(_0x541900,null))['then'](respondWithResult(_0x541900,null))[_0x53f3('0x40')](handleError(_0x541900,null));};exports[_0x53f3('0x44')]=function(_0x4e9965,_0x9c6c68){return db[_0x53f3('0x2a')][_0x53f3('0x44')](_0x4e9965[_0x53f3('0x45')],{})[_0x53f3('0x23')](respondWithResult(_0x9c6c68,0xc9))[_0x53f3('0x40')](handleError(_0x9c6c68,null));};exports['update']=function(_0x3eaeb6,_0xc9e8e1){if(_0x3eaeb6['body']['id']){delete _0x3eaeb6['body']['id'];}return db[_0x53f3('0x2a')][_0x53f3('0x46')]({'where':{'id':_0x3eaeb6[_0x53f3('0x42')]['id']}})['then'](handleEntityNotFound(_0xc9e8e1,null))['then'](saveUpdates(_0x3eaeb6[_0x53f3('0x45')],null))[_0x53f3('0x23')](respondWithResult(_0xc9e8e1,null))[_0x53f3('0x40')](handleError(_0xc9e8e1,null));};exports[_0x53f3('0x24')]=function(_0xb695f6,_0x318acd){return db['ChatTransferReport'][_0x53f3('0x46')]({'where':{'id':_0xb695f6[_0x53f3('0x42')]['id']}})[_0x53f3('0x23')](handleEntityNotFound(_0x318acd,null))['then'](removeEntity(_0x318acd,null))[_0x53f3('0x40')](handleError(_0x318acd,null));};exports['describe']=function(_0x2e66fa,_0x31f1a3){return db[_0x53f3('0x2a')][_0x53f3('0x47')]()[_0x53f3('0x23')](respondWithResult(_0x31f1a3,null))['catch'](handleError(_0x31f1a3,null));}; \ No newline at end of file +var _0xa745=['end','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','merge','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x55516f,_0x598082){var _0x52c2b9=function(_0x1803dc){while(--_0x1803dc){_0x55516f['push'](_0x55516f['shift']());}};_0x52c2b9(++_0x598082);}(_0xa745,0xc4));var _0x5a74=function(_0xa2813,_0x223068){_0xa2813=_0xa2813-0x0;var _0x5b27d1=_0xa745[_0xa2813];return _0x5b27d1;};'use strict';var emlformat=require(_0x5a74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a74('0x1'));var jsonpatch=require(_0x5a74('0x2'));var rp=require(_0x5a74('0x3'));var moment=require('moment');var BPromise=require(_0x5a74('0x4'));var Mustache=require('mustache');var util=require(_0x5a74('0x5'));var path=require(_0x5a74('0x6'));var sox=require(_0x5a74('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a74('0x8'));var _=require(_0x5a74('0x9'));var squel=require(_0x5a74('0xa'));var crypto=require(_0x5a74('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5a74('0xc'));var toCsv=require(_0x5a74('0xd'));var querystring=require(_0x5a74('0xe'));var Papa=require(_0x5a74('0xf'));var Redis=require(_0x5a74('0x10'));var authService=require(_0x5a74('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5a74('0x12'));var hardwareService=require(_0x5a74('0x13'));var logger=require(_0x5a74('0x14'))(_0x5a74('0x15'));var utils=require(_0x5a74('0x16'));var config=require(_0x5a74('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a74('0x18'))['db'];function respondWithStatusCode(_0xed08be,_0x4b0ff3){_0x4b0ff3=_0x4b0ff3||0xcc;return function(_0x4afee9){if(_0x4afee9){return _0xed08be[_0x5a74('0x19')](_0x4b0ff3);}return _0xed08be[_0x5a74('0x1a')](_0x4b0ff3)['end']();};}function respondWithResult(_0x28c816,_0x3177d0){_0x3177d0=_0x3177d0||0xc8;return function(_0xd777ec){if(_0xd777ec){return _0x28c816[_0x5a74('0x1a')](_0x3177d0)['json'](_0xd777ec);}};}function respondWithFilteredResult(_0x4b548d,_0x34ab70){return function(_0x20988b){if(_0x20988b){var _0x545b0a=typeof _0x34ab70[_0x5a74('0x1b')]==='undefined'&&typeof _0x34ab70['limit']===_0x5a74('0x1c');var _0x412609=_0x20988b['count'];var _0x512e97=_0x545b0a?0x0:_0x34ab70['offset'];var _0x35feeb=_0x545b0a?_0x20988b[_0x5a74('0x1d')]:_0x34ab70['offset']+_0x34ab70[_0x5a74('0x1e')];var _0x4bb7a5;if(_0x35feeb>=_0x412609){_0x35feeb=_0x412609;_0x4bb7a5=0xc8;}else{_0x4bb7a5=0xce;}_0x4b548d[_0x5a74('0x1a')](_0x4bb7a5);return _0x4b548d[_0x5a74('0x1f')](_0x5a74('0x20'),_0x512e97+'-'+_0x35feeb+'/'+_0x412609)['json'](_0x20988b);}return null;};}function patchUpdates(_0x2909b0){return function(_0x54eaaa){try{jsonpatch[_0x5a74('0x21')](_0x54eaaa,_0x2909b0,!![]);}catch(_0x3cfdbd){return BPromise[_0x5a74('0x22')](_0x3cfdbd);}return _0x54eaaa[_0x5a74('0x23')]();};}function saveUpdates(_0x10eea5,_0x3382c7){return function(_0x1b5512){if(_0x1b5512){return _0x1b5512[_0x5a74('0x24')](_0x10eea5)[_0x5a74('0x25')](function(_0xc729c7){return _0xc729c7;});}return null;};}function removeEntity(_0x11eaf6,_0x18be63){return function(_0x215d58){if(_0x215d58){return _0x215d58['destroy']()['then'](function(){_0x11eaf6[_0x5a74('0x1a')](0xcc)[_0x5a74('0x26')]();});}};}function handleEntityNotFound(_0x4ef147,_0x2c5308){return function(_0x554a77){if(!_0x554a77){_0x4ef147[_0x5a74('0x19')](0x194);}return _0x554a77;};}function handleError(_0x1e59a7,_0x71d35d){_0x71d35d=_0x71d35d||0x1f4;return function(_0x14adcf){logger[_0x5a74('0x27')](_0x14adcf[_0x5a74('0x28')]);if(_0x14adcf[_0x5a74('0x29')]){delete _0x14adcf[_0x5a74('0x29')];}_0x1e59a7[_0x5a74('0x1a')](_0x71d35d)[_0x5a74('0x2a')](_0x14adcf);};}exports[_0x5a74('0x2b')]=function(_0x23f3e8,_0x598780){var _0x58f0c2={},_0x413aa1={},_0x4341ad={'count':0x0,'rows':[]};var _0x40fe3c=_[_0x5a74('0x2c')](db[_0x5a74('0x2d')]['rawAttributes'],function(_0x3a8216){return{'name':_0x3a8216[_0x5a74('0x2e')],'type':_0x3a8216[_0x5a74('0x2f')][_0x5a74('0x30')]};});_0x413aa1[_0x5a74('0x31')]=_['map'](_0x40fe3c,_0x5a74('0x29'));_0x413aa1[_0x5a74('0x32')]=_[_0x5a74('0x33')](_0x23f3e8[_0x5a74('0x32')]);_0x413aa1[_0x5a74('0x34')]=_[_0x5a74('0x35')](_0x413aa1[_0x5a74('0x31')],_0x413aa1[_0x5a74('0x32')]);_0x58f0c2[_0x5a74('0x36')]=_[_0x5a74('0x35')](_0x413aa1[_0x5a74('0x31')],qs[_0x5a74('0x37')](_0x23f3e8['query']['fields']));_0x58f0c2['attributes']=_0x58f0c2[_0x5a74('0x36')][_0x5a74('0x38')]?_0x58f0c2[_0x5a74('0x36')]:_0x413aa1['model'];if(!_0x23f3e8['query'][_0x5a74('0x39')](_0x5a74('0x3a'))){_0x58f0c2[_0x5a74('0x1e')]=qs['limit'](_0x23f3e8[_0x5a74('0x32')][_0x5a74('0x1e')]);_0x58f0c2['offset']=qs[_0x5a74('0x1b')](_0x23f3e8[_0x5a74('0x32')][_0x5a74('0x1b')]);}_0x58f0c2[_0x5a74('0x3b')]=qs['sort'](_0x23f3e8[_0x5a74('0x32')]['sort']);_0x58f0c2['where']=qs['filters'](_[_0x5a74('0x3c')](_0x23f3e8[_0x5a74('0x32')],_0x413aa1[_0x5a74('0x34')]),_0x40fe3c);if(_0x23f3e8['query'][_0x5a74('0x3d')]){_0x58f0c2[_0x5a74('0x3e')]=_['merge'](_0x58f0c2[_0x5a74('0x3e')],{'$or':_[_0x5a74('0x2c')](_0x40fe3c,function(_0x2d08e2){if(_0x2d08e2['type']!==_0x5a74('0x3f')){var _0x45ff7b={};_0x45ff7b[_0x2d08e2[_0x5a74('0x29')]]={'$like':'%'+_0x23f3e8[_0x5a74('0x32')]['filter']+'%'};return _0x45ff7b;}})});}_0x58f0c2=_['merge']({},_0x58f0c2,_0x23f3e8[_0x5a74('0x40')]);var _0x7ab4fb={'where':_0x58f0c2['where']};return db[_0x5a74('0x2d')][_0x5a74('0x1d')](_0x7ab4fb)[_0x5a74('0x25')](function(_0xa920a4){_0x4341ad['count']=_0xa920a4;if(_0x23f3e8['query']['includeAll']){_0x58f0c2[_0x5a74('0x41')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x5a74('0x42')](_0x58f0c2);})[_0x5a74('0x25')](function(_0x59521f){_0x4341ad['rows']=_0x59521f;return _0x4341ad;})[_0x5a74('0x25')](respondWithFilteredResult(_0x598780,_0x58f0c2))[_0x5a74('0x43')](handleError(_0x598780,null));};exports[_0x5a74('0x44')]=function(_0xde0a9d,_0x5c5305){var _0x24807a={'raw':!![],'where':{'id':_0xde0a9d[_0x5a74('0x45')]['id']}},_0x56254c={};_0x56254c['model']=_[_0x5a74('0x33')](db[_0x5a74('0x2d')][_0x5a74('0x46')]);_0x56254c[_0x5a74('0x32')]=_[_0x5a74('0x33')](_0xde0a9d[_0x5a74('0x32')]);_0x56254c[_0x5a74('0x34')]=_['intersection'](_0x56254c['model'],_0x56254c[_0x5a74('0x32')]);_0x24807a[_0x5a74('0x36')]=_[_0x5a74('0x35')](_0x56254c[_0x5a74('0x31')],qs['fields'](_0xde0a9d[_0x5a74('0x32')][_0x5a74('0x37')]));_0x24807a[_0x5a74('0x36')]=_0x24807a[_0x5a74('0x36')]['length']?_0x24807a['attributes']:_0x56254c[_0x5a74('0x31')];if(_0xde0a9d['query'][_0x5a74('0x47')]){_0x24807a[_0x5a74('0x41')]=[{'all':!![]}];}_0x24807a=_[_0x5a74('0x48')]({},_0x24807a,_0xde0a9d[_0x5a74('0x40')]);return db['ChatTransferReport'][_0x5a74('0x49')](_0x24807a)[_0x5a74('0x25')](handleEntityNotFound(_0x5c5305,null))['then'](respondWithResult(_0x5c5305,null))[_0x5a74('0x43')](handleError(_0x5c5305,null));};exports[_0x5a74('0x4a')]=function(_0xe47972,_0x1d1a67){return db[_0x5a74('0x2d')][_0x5a74('0x4a')](_0xe47972[_0x5a74('0x4b')],{})[_0x5a74('0x25')](respondWithResult(_0x1d1a67,0xc9))[_0x5a74('0x43')](handleError(_0x1d1a67,null));};exports['update']=function(_0x470c4a,_0x504ca0){if(_0x470c4a['body']['id']){delete _0x470c4a['body']['id'];}return db['ChatTransferReport'][_0x5a74('0x49')]({'where':{'id':_0x470c4a['params']['id']}})['then'](handleEntityNotFound(_0x504ca0,null))[_0x5a74('0x25')](saveUpdates(_0x470c4a['body'],null))[_0x5a74('0x25')](respondWithResult(_0x504ca0,null))[_0x5a74('0x43')](handleError(_0x504ca0,null));};exports[_0x5a74('0x4c')]=function(_0x430553,_0x557220){return db[_0x5a74('0x2d')][_0x5a74('0x49')]({'where':{'id':_0x430553[_0x5a74('0x45')]['id']}})['then'](handleEntityNotFound(_0x557220,null))['then'](removeEntity(_0x557220,null))[_0x5a74('0x43')](handleError(_0x557220,null));};exports[_0x5a74('0x4d')]=function(_0x3601fa,_0x47c2f8){return db['ChatTransferReport'][_0x5a74('0x4d')]()[_0x5a74('0x25')](respondWithResult(_0x47c2f8,null))[_0x5a74('0x43')](handleError(_0x47c2f8,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index af76ade..e51cf0b 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 _0x7b6e=['request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x26a706,_0x25cc80){var _0x1bcd7c=function(_0x4af445){while(--_0x4af445){_0x26a706['push'](_0x26a706['shift']());}};_0x1bcd7c(++_0x25cc80);}(_0x7b6e,0xa2));var _0xe7b6=function(_0x18515d,_0x5c442b){_0x18515d=_0x18515d-0x0;var _0x175db2=_0x7b6e[_0x18515d];return _0x175db2;};'use strict';var _=require(_0xe7b6('0x0'));var util=require(_0xe7b6('0x1'));var logger=require(_0xe7b6('0x2'))(_0xe7b6('0x3'));var moment=require(_0xe7b6('0x4'));var BPromise=require(_0xe7b6('0x5'));var rp=require(_0xe7b6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7b6('0x7'));var config=require(_0xe7b6('0x8'));var attributes=require(_0xe7b6('0x9'));module[_0xe7b6('0xa')]=function(_0x3a6593,_0x5797ca){return _0x3a6593[_0xe7b6('0xb')]('ChatTransferReport',attributes,{'tableName':_0xe7b6('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe7b6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3cf=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ChatTransferReport'];(function(_0x43ec1a,_0x50b962){var _0x2ca3a3=function(_0x48164a){while(--_0x48164a){_0x43ec1a['push'](_0x43ec1a['shift']());}};_0x2ca3a3(++_0x50b962);}(_0xa3cf,0x77));var _0xfa3c=function(_0x5ac05c,_0x103d35){_0x5ac05c=_0x5ac05c-0x0;var _0x5d19e8=_0xa3cf[_0x5ac05c];return _0x5d19e8;};'use strict';var _=require(_0xfa3c('0x0'));var util=require(_0xfa3c('0x1'));var logger=require(_0xfa3c('0x2'))(_0xfa3c('0x3'));var moment=require(_0xfa3c('0x4'));var BPromise=require(_0xfa3c('0x5'));var rp=require(_0xfa3c('0x6'));var fs=require('fs');var path=require(_0xfa3c('0x7'));var rimraf=require('rimraf');var config=require(_0xfa3c('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0xfa3c('0x9')]=function(_0x572139,_0x2eb5d6){return _0x572139['define'](_0xfa3c('0xa'),attributes,{'tableName':_0xfa3c('0xb'),'paranoid':![],'indexes':[{'name':_0xfa3c('0xc'),'fields':[_0xfa3c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 4166dc7..f607ff6 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 _0x224e=['../../config/environment','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xa5c484,_0x52348a){var _0x546e5c=function(_0xa425d){while(--_0xa425d){_0xa5c484['push'](_0xa5c484['shift']());}};_0x546e5c(++_0x52348a);}(_0x224e,0xf4));var _0xe224=function(_0x8faf50,_0x5b1919){_0x8faf50=_0x8faf50-0x0;var _0x3f0578=_0x224e[_0x8faf50];return _0x3f0578;};'use strict';var _=require(_0xe224('0x0'));var util=require(_0xe224('0x1'));var moment=require(_0xe224('0x2'));var BPromise=require(_0xe224('0x3'));var rs=require(_0xe224('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe224('0x5'))['db'];var utils=require(_0xe224('0x6'));var logger=require('../../config/logger')(_0xe224('0x7'));var config=require(_0xe224('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe224('0x9')][_0xe224('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2182f4,_0x4c5db5,_0x399f64){return new BPromise(function(_0x374d6c,_0x4ace60){return client[_0xe224('0xb')](_0x2182f4,_0x399f64)['then'](function(_0x314d97){logger[_0xe224('0xc')](_0xe224('0xd'),_0x4c5db5,_0xe224('0xe'));logger['debug'](_0xe224('0xf'),_0x4c5db5,_0xe224('0xe'),JSON['stringify'](_0x314d97));if(_0x314d97['error']){if(_0x314d97['error'][_0xe224('0x10')]===0x1f4){logger['error'](_0xe224('0xd'),_0x4c5db5,_0x314d97[_0xe224('0x11')]['message']);return _0x4ace60(_0x314d97[_0xe224('0x11')][_0xe224('0x12')]);}logger['error'](_0xe224('0xd'),_0x4c5db5,_0x314d97[_0xe224('0x11')]['message']);return _0x374d6c(_0x314d97[_0xe224('0x11')]['message']);}else{logger[_0xe224('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x4c5db5,'request\x20sent');_0x374d6c(_0x314d97[_0xe224('0x13')][_0xe224('0x12')]);}})[_0xe224('0x14')](function(_0x4ec46d){logger[_0xe224('0x11')](_0xe224('0xd'),_0x4c5db5,_0x4ec46d);_0x4ace60(_0x4ec46d);});});} \ No newline at end of file +var _0xf7cb=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x43af80,_0x1a300e){var _0x26c0ea=function(_0x3fb0b6){while(--_0x3fb0b6){_0x43af80['push'](_0x43af80['shift']());}};_0x26c0ea(++_0x1a300e);}(_0xf7cb,0xd5));var _0xbf7c=function(_0x32ab71,_0x19575d){_0x32ab71=_0x32ab71-0x0;var _0x47b4d7=_0xf7cb[_0x32ab71];return _0x47b4d7;};'use strict';var _=require(_0xbf7c('0x0'));var util=require(_0xbf7c('0x1'));var moment=require(_0xbf7c('0x2'));var BPromise=require(_0xbf7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf7c('0x4'));var db=require(_0xbf7c('0x5'))['db'];var utils=require(_0xbf7c('0x6'));var logger=require(_0xbf7c('0x7'))(_0xbf7c('0x8'));var config=require('../../config/environment');var jayson=require(_0xbf7c('0x9'));var client=jayson[_0xbf7c('0xa')][_0xbf7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25a09c,_0x3d35df,_0x3556de){return new BPromise(function(_0x3fdb69,_0x11daac){return client['request'](_0x25a09c,_0x3556de)[_0xbf7c('0xc')](function(_0x1c2187){logger[_0xbf7c('0xd')](_0xbf7c('0xe'),_0x3d35df,_0xbf7c('0xf'));logger[_0xbf7c('0x10')](_0xbf7c('0x11'),_0x3d35df,_0xbf7c('0xf'),JSON[_0xbf7c('0x12')](_0x1c2187));if(_0x1c2187[_0xbf7c('0x13')]){if(_0x1c2187[_0xbf7c('0x13')]['code']===0x1f4){logger[_0xbf7c('0x13')](_0xbf7c('0xe'),_0x3d35df,_0x1c2187[_0xbf7c('0x13')][_0xbf7c('0x14')]);return _0x11daac(_0x1c2187[_0xbf7c('0x13')][_0xbf7c('0x14')]);}logger[_0xbf7c('0x13')](_0xbf7c('0xe'),_0x3d35df,_0x1c2187[_0xbf7c('0x13')][_0xbf7c('0x14')]);return _0x3fdb69(_0x1c2187[_0xbf7c('0x13')][_0xbf7c('0x14')]);}else{logger[_0xbf7c('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x3d35df,_0xbf7c('0xf'));_0x3fdb69(_0x1c2187[_0xbf7c('0x15')][_0xbf7c('0x14')]);}})[_0xbf7c('0x16')](function(_0x3ce670){logger['error'](_0xbf7c('0xe'),_0x3d35df,_0x3ce670);_0x11daac(_0x3ce670);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 32d5f64..35e2eb4 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 _0xb3ed=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','update'];(function(_0x321c18,_0x368364){var _0x227195=function(_0x4c2783){while(--_0x4c2783){_0x321c18['push'](_0x321c18['shift']());}};_0x227195(++_0x368364);}(_0xb3ed,0xbf));var _0xdb3e=function(_0x37829f,_0x298780){_0x37829f=_0x37829f-0x0;var _0x31a547=_0xb3ed[_0x37829f];return _0x31a547;};'use strict';var multer=require(_0xdb3e('0x0'));var util=require(_0xdb3e('0x1'));var path=require(_0xdb3e('0x2'));var timeout=require(_0xdb3e('0x3'));var express=require(_0xdb3e('0x4'));var router=express[_0xdb3e('0x5')]();var fs_extra=require(_0xdb3e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb3e('0x7'));var config=require(_0xdb3e('0x8'));var controller=require(_0xdb3e('0x9'));router[_0xdb3e('0xa')]('/',auth['isAuthenticated'](),controller[_0xdb3e('0xb')]);router[_0xdb3e('0xa')](_0xdb3e('0xc'),auth[_0xdb3e('0xd')](),controller[_0xdb3e('0xe')]);router['get'](_0xdb3e('0xf'),auth[_0xdb3e('0xd')](),controller['show']);router[_0xdb3e('0x10')]('/',auth[_0xdb3e('0xd')](),controller['create']);router['put'](_0xdb3e('0xf'),auth[_0xdb3e('0xd')](),controller[_0xdb3e('0x11')]);router['delete'](_0xdb3e('0xf'),auth[_0xdb3e('0xd')](),controller[_0xdb3e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9da8=['isAuthenticated','/:id','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','get'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9da8,0x8c));var _0x89da=function(_0x4d5f9e,_0x183a41){_0x4d5f9e=_0x4d5f9e-0x0;var _0x2fc732=_0x9da8[_0x4d5f9e];return _0x2fc732;};'use strict';var multer=require('multer');var util=require(_0x89da('0x0'));var path=require(_0x89da('0x1'));var timeout=require(_0x89da('0x2'));var express=require(_0x89da('0x3'));var router=express[_0x89da('0x4')]();var fs_extra=require(_0x89da('0x5'));var auth=require(_0x89da('0x6'));var interaction=require(_0x89da('0x7'));var config=require(_0x89da('0x8'));var controller=require(_0x89da('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x89da('0xa')]);router[_0x89da('0xb')]('/describe',auth[_0x89da('0xc')](),controller['describe']);router[_0x89da('0xb')](_0x89da('0xd'),auth[_0x89da('0xc')](),controller['show']);router['post']('/',auth[_0x89da('0xc')](),controller['create']);router[_0x89da('0xe')](_0x89da('0xd'),auth[_0x89da('0xc')](),controller[_0x89da('0xf')]);router[_0x89da('0x10')](_0x89da('0xd'),auth['isAuthenticated'](),controller[_0x89da('0x11')]);module[_0x89da('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5a1904d..3b323fc 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 _0x06d8=['input','name','text','onlineForm','parse','textarea','Comments','getDataValue','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','stringify'];(function(_0x31d06c,_0x2125a6){var _0x26b12c=function(_0x4e1385){while(--_0x4e1385){_0x31d06c['push'](_0x31d06c['shift']());}};_0x26b12c(++_0x2125a6);}(_0x06d8,0x1be));var _0x806d=function(_0x499e16,_0x1e8c64){_0x499e16=_0x499e16-0x0;var _0x320e09=_0x06d8[_0x499e16];return _0x320e09;};'use strict';var Sequelize=require(_0x806d('0x0'));var rs=require(_0x806d('0x1'));module[_0x806d('0x2')]={'name':{'type':Sequelize[_0x806d('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x806d('0x3')],'allowNull':![],'unique':_0x806d('0x4')},'description':{'type':Sequelize[_0x806d('0x3')]},'mapKey':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x806d('0x5')},'key':{'type':Sequelize[_0x806d('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x806d('0x3')],'allowNull':![],'defaultValue':_0x806d('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x806d('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x806d('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x806d('0x3')]},'animation':{'type':Sequelize[_0x806d('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x806d('0xa'),_0x806d('0xb')),'defaultValue':_0x806d('0xa')},'header_online':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0xc')},'start_chat_button':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x806d('0xe')},'download_transcript':{'type':Sequelize[_0x806d('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x806d('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x806d('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x806d('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x806d('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x806d('0xd')},'skipMessageButton':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x13')},'conditionAgreement':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x14')},'ratingType':{'type':Sequelize[_0x806d('0x15')]('star',_0x806d('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x806d('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x806d('0x10')],'defaultValue':function(){return JSON[_0x806d('0x17')]({'items':[{'type':_0x806d('0x18'),'variable':null,'config':{'placeholder':_0x806d('0x19'),'type':_0x806d('0x1a'),'required':!![]},'props':{'title':_0x806d('0x19'),'helpText':''}},{'type':'input','props':{'title':_0x806d('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x806d('0x5'),'type':_0x806d('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x806d('0x1b'))?JSON[_0x806d('0x1c')](this['getDataValue']('onlineForm')):{};},'set':function(_0x3890ae){return this['setDataValue']('onlineForm',JSON[_0x806d('0x17')](_0x3890ae));}},'offlineForm':{'type':Sequelize[_0x806d('0x10')],'defaultValue':function(){return JSON[_0x806d('0x17')]({'items':[{'type':'input','props':{'title':_0x806d('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x806d('0x5')},'variable':null},{'type':_0x806d('0x1d'),'config':{'placeholder':_0x806d('0x1e')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x806d('0x1f')]('offlineForm')?JSON[_0x806d('0x1c')](this[_0x806d('0x1f')]('offlineForm')):{};},'set':function(_0x3a2110){return this['setDataValue'](_0x806d('0x20'),JSON[_0x806d('0x17')](_0x3a2110));}},'token':{'type':Sequelize[_0x806d('0x3')],'defaultValue':function(){return rs[_0x806d('0x21')]();}},'autoclose':{'type':Sequelize[_0x806d('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x806d('0x3')]},'forwardOffline':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x806d('0x3')]},'waitingTitle':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x23')},'offlineMessageBody':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x24')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x806d('0x13')},'sendUnmanaged':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x806d('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x806d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x806d('0x10')],'defaultValue':function(){return _0x806d('0x25');}},'notificationSound':{'type':Sequelize[_0x806d('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x806d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x27')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x806d('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x806d('0x3')]},'customerAvatar':{'type':Sequelize[_0x806d('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x806d('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x806d('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x806d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x806d('0x3')],'defaultValue':_0x806d('0x29')},'systemAvatar':{'type':Sequelize[_0x806d('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x806d('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![],'comment':_0x806d('0x2a'),'set':function(_0x104dc8){if(!_0x104dc8)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x806d('0x2b')](_0x806d('0x2c'),_0x104dc8);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x806d('0x3')]},'vidaooTopic':{'type':Sequelize[_0x806d('0x3')],'allowNull':![],'defaultValue':_0x806d('0x2d')},'vidaooNote':{'type':Sequelize[_0x806d('0x3')],'defaultValue':function(){return _0x806d('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0x806d('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x806d('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x806d('0x10')]}}; \ No newline at end of file +var _0xfc56=['email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','star','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','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','randomstring','exports','STRING','address'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xfc56,0xcb));var _0x6fc5=function(_0x2e3df6,_0x19b323){_0x2e3df6=_0x2e3df6-0x0;var _0x12526d=_0xfc56[_0x2e3df6];return _0x12526d;};'use strict';var Sequelize=require(_0x6fc5('0x0'));var rs=require(_0x6fc5('0x1'));module[_0x6fc5('0x2')]={'name':{'type':Sequelize[_0x6fc5('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6fc5('0x3')],'allowNull':![],'unique':_0x6fc5('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x6fc5('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x5')},'key':{'type':Sequelize[_0x6fc5('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6fc5('0x3')],'allowNull':![],'defaultValue':_0x6fc5('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6fc5('0x3')],'allowNull':![],'defaultValue':_0x6fc5('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6fc5('0x3')],'allowNull':![],'defaultValue':_0x6fc5('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6fc5('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6fc5('0x3')]},'animation':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6fc5('0xa')](_0x6fc5('0xb'),_0x6fc5('0xc')),'defaultValue':_0x6fc5('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6fc5('0xd')},'start_chat_button':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6fc5('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x12')},'noteTitle':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x13')},'placeholderMessage':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x14')},'closingMessage':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x15')},'skipMessageButton':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x6fc5('0xa')](_0x6fc5('0x17'),'thumb'),'defaultValue':_0x6fc5('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6fc5('0x18')],'defaultValue':function(){return JSON[_0x6fc5('0x19')]({'items':[{'type':_0x6fc5('0x1a'),'variable':null,'config':{'placeholder':_0x6fc5('0x1b'),'type':_0x6fc5('0x1c'),'required':!![]},'props':{'title':_0x6fc5('0x1b'),'helpText':''}},{'type':_0x6fc5('0x1a'),'props':{'title':_0x6fc5('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6fc5('0x5'),'type':_0x6fc5('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6fc5('0x1d')](_0x6fc5('0x1e'))?JSON[_0x6fc5('0x1f')](this[_0x6fc5('0x1d')]('onlineForm')):{};},'set':function(_0x81e5e5){return this[_0x6fc5('0x20')]('onlineForm',JSON[_0x6fc5('0x19')](_0x81e5e5));}},'offlineForm':{'type':Sequelize[_0x6fc5('0x18')],'defaultValue':function(){return JSON[_0x6fc5('0x19')]({'items':[{'type':'input','props':{'title':_0x6fc5('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6fc5('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x6fc5('0x21')},'props':{'title':_0x6fc5('0x21'),'helpText':_0x6fc5('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x6fc5('0x23'))?JSON[_0x6fc5('0x1f')](this[_0x6fc5('0x1d')](_0x6fc5('0x23'))):{};},'set':function(_0x5c72b4){return this[_0x6fc5('0x20')](_0x6fc5('0x23'),JSON[_0x6fc5('0x19')](_0x5c72b4));}},'token':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':function(){return rs[_0x6fc5('0x24')]();}},'autoclose':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6fc5('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6fc5('0x25')},'waitingMessage':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x6fc5('0x27')},'offlineMessageBody':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x29')},'skipUnmanaged':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6fc5('0x15')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6fc5('0x18')]},'showAgentAvatar':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6fc5('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6fc5('0x2a');}},'notificationSound':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6fc5('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':_0x6fc5('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6fc5('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6fc5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x6fc5('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6fc5('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x232caf){if(!_0x232caf)this[_0x6fc5('0x20')](_0x6fc5('0x30'),null);this['setDataValue'](_0x6fc5('0x31'),_0x232caf);}},'vidaooEscalation':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6fc5('0x3')]},'vidaooTopic':{'type':Sequelize[_0x6fc5('0x3')],'allowNull':![],'defaultValue':_0x6fc5('0x32')},'vidaooNote':{'type':Sequelize[_0x6fc5('0x3')],'defaultValue':function(){return _0x6fc5('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x6fc5('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6fc5('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 09773a7..2459f21 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 _0x41f2=['priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','originalname','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','remote','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','save','destroy','then','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','Pause','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','ChatWebsite','findAll','mandatoryDispositionPause','keys','length','create','body','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','rows','removeDispositions','ids','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy'];(function(_0x2889d4,_0x3c40b7){var _0x22bb0d=function(_0x296a3f){while(--_0x296a3f){_0x2889d4['push'](_0x2889d4['shift']());}};_0x22bb0d(++_0x3c40b7);}(_0x41f2,0x1ca));var _0x241f=function(_0x552f10,_0x4390c5){_0x552f10=_0x552f10-0x0;var _0xdab64a=_0x41f2[_0x552f10];return _0xdab64a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x241f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x241f('0x1'));var moment=require(_0x241f('0x2'));var BPromise=require(_0x241f('0x3'));var Mustache=require(_0x241f('0x4'));var util=require(_0x241f('0x5'));var path=require(_0x241f('0x6'));var sox=require('sox');var csv=require(_0x241f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x241f('0x8'));var _=require(_0x241f('0x9'));var squel=require(_0x241f('0xa'));var crypto=require(_0x241f('0xb'));var jsforce=require(_0x241f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x241f('0x7'));var querystring=require(_0x241f('0xd'));var Papa=require(_0x241f('0xe'));var Redis=require(_0x241f('0xf'));var authService=require(_0x241f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x241f('0x11'));var hardwareService=require(_0x241f('0x12'));var logger=require(_0x241f('0x13'))(_0x241f('0x14'));var utils=require(_0x241f('0x15'));var config=require(_0x241f('0x16'));var licenseUtil=require(_0x241f('0x17'));var db=require('../../mysqldb')['db'];config[_0x241f('0x18')]=_[_0x241f('0x19')](config['redis'],{'host':_0x241f('0x1a'),'port':0x18eb});var socket=require(_0x241f('0x1b'))(new Redis(config[_0x241f('0x18')]));require(_0x241f('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x241f('0x1d')][_0x241f('0x1e')]({'port':0x232c});var client9002=jayson[_0x241f('0x1d')]['http']({'port':0x232a});var client9003=jayson[_0x241f('0x1d')]['http']({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x24abc2,_0x4daa33,_0x525988,_0x3c09eb){return new BPromise(function(_0x1f4229,_0x188582){var _0x36d0c2=_0x3c09eb||client;return _0x36d0c2[_0x241f('0x1f')](_0x24abc2,_0x525988)['then'](function(_0x361472){logger['info'](_0x241f('0x20'),_0x4daa33,'request\x20sent');logger[_0x241f('0x21')](_0x241f('0x22'),_0x4daa33,_0x241f('0x23'),JSON['stringify'](_0x361472));if(_0x361472[_0x241f('0x24')]){if(_0x361472[_0x241f('0x24')][_0x241f('0x25')]===0x1f4){logger[_0x241f('0x24')](_0x241f('0x20'),_0x4daa33,_0x361472['error']['message']);return _0x188582(_0x361472[_0x241f('0x24')][_0x241f('0x26')]);}logger['error'](_0x241f('0x20'),_0x4daa33,_0x361472['error'][_0x241f('0x26')]);return _0x1f4229(_0x361472[_0x241f('0x24')][_0x241f('0x26')]);}else{logger[_0x241f('0x27')](_0x241f('0x20'),_0x4daa33,'request\x20sent');_0x1f4229(_0x361472[_0x241f('0x28')]['message']);}})[_0x241f('0x29')](function(_0x26dadc){logger[_0x241f('0x24')](_0x241f('0x20'),_0x4daa33,_0x26dadc);_0x188582(_0x26dadc);});});}function respondWithStatusCode(_0x247f0f,_0x932ecc){_0x932ecc=_0x932ecc||0xcc;return function(_0x22e151){if(_0x22e151){return _0x247f0f['sendStatus'](_0x932ecc);}return _0x247f0f['status'](_0x932ecc)[_0x241f('0x2a')]();};}function respondWithResult(_0x5ab2a1,_0x13a9de){_0x13a9de=_0x13a9de||0xc8;return function(_0x243915){if(_0x243915){return _0x5ab2a1['status'](_0x13a9de)[_0x241f('0x2b')](_0x243915);}};}function respondWithFilteredResult(_0x4e74fc,_0x1b6efd){return function(_0x269960){if(_0x269960){var _0x270d65=typeof _0x1b6efd[_0x241f('0x2c')]===_0x241f('0x2d')&&typeof _0x1b6efd[_0x241f('0x2e')]==='undefined';var _0x42d447=_0x269960['count'];var _0x18f120=_0x270d65?0x0:_0x1b6efd[_0x241f('0x2c')];var _0x4831db=_0x270d65?_0x269960[_0x241f('0x2f')]:_0x1b6efd[_0x241f('0x2c')]+_0x1b6efd[_0x241f('0x2e')];var _0x10232b;if(_0x4831db>=_0x42d447){_0x4831db=_0x42d447;_0x10232b=0xc8;}else{_0x10232b=0xce;}_0x4e74fc[_0x241f('0x30')](_0x10232b);return _0x4e74fc[_0x241f('0x31')](_0x241f('0x32'),_0x18f120+'-'+_0x4831db+'/'+_0x42d447)[_0x241f('0x2b')](_0x269960);}return null;};}function patchUpdates(_0x278996){return function(_0x75f379){try{jsonpatch['apply'](_0x75f379,_0x278996,!![]);}catch(_0x53be3f){return BPromise['reject'](_0x53be3f);}return _0x75f379[_0x241f('0x33')]();};}function saveUpdates(_0x17b5fb,_0x2ec73d){return function(_0x4f494d){if(_0x4f494d){return _0x4f494d['update'](_0x17b5fb)['then'](function(_0x7ff501){return _0x7ff501;});}return null;};}function removeEntity(_0x247024,_0x30c292){return function(_0x3be41a){if(_0x3be41a){return _0x3be41a[_0x241f('0x34')]()[_0x241f('0x35')](function(){var _0x3e4b8f=_0x3be41a[_0x241f('0x36')]({'plain':!![]});var _0x3236d3=_0x241f('0x37');return db[_0x241f('0x38')]['destroy']({'where':{'type':_0x3236d3,'resourceId':_0x3e4b8f['id']}})[_0x241f('0x35')](function(){return _0x3be41a;});})['then'](function(){_0x247024['status'](0xcc)[_0x241f('0x2a')]();});}};}function handleEntityNotFound(_0x33760d,_0x4ad5c4){return function(_0x166a59){if(!_0x166a59){_0x33760d[_0x241f('0x39')](0x194);}return _0x166a59;};}function handleError(_0x3f1569,_0x22f128){_0x22f128=_0x22f128||0x1f4;return function(_0x2caf4d){logger[_0x241f('0x24')](_0x2caf4d[_0x241f('0x3a')]);if(_0x2caf4d[_0x241f('0x3b')]){delete _0x2caf4d[_0x241f('0x3b')];}_0x3f1569[_0x241f('0x30')](_0x22f128)[_0x241f('0x3c')](_0x2caf4d);};}exports[_0x241f('0x3d')]=function(_0x356009,_0x176060){var _0x43316d={'include':[{'model':db[_0x241f('0x3e')],'as':'mandatoryDispositionPause'}]},_0x4fdcb4={},_0x2d99ab={'count':0x0,'rows':[]};var _0x1f16ee=_['map'](db['ChatWebsite'][_0x241f('0x3f')],function(_0x2ae6fd){return{'name':_0x2ae6fd['fieldName'],'type':_0x2ae6fd[_0x241f('0x40')][_0x241f('0x41')]};});_0x4fdcb4[_0x241f('0x42')]=_[_0x241f('0x43')](_0x1f16ee,'name');_0x4fdcb4[_0x241f('0x44')]=_['keys'](_0x356009[_0x241f('0x44')]);_0x4fdcb4[_0x241f('0x45')]=_[_0x241f('0x46')](_0x4fdcb4['model'],_0x4fdcb4[_0x241f('0x44')]);_0x43316d[_0x241f('0x47')]=_[_0x241f('0x46')](_0x4fdcb4['model'],qs[_0x241f('0x48')](_0x356009['query'][_0x241f('0x48')]));_0x43316d[_0x241f('0x47')]=_0x43316d[_0x241f('0x47')]['length']?_0x43316d[_0x241f('0x47')]:_0x4fdcb4[_0x241f('0x42')];if(!_0x356009[_0x241f('0x44')][_0x241f('0x49')](_0x241f('0x4a'))){_0x43316d[_0x241f('0x2e')]=qs[_0x241f('0x2e')](_0x356009[_0x241f('0x44')][_0x241f('0x2e')]);_0x43316d[_0x241f('0x2c')]=qs[_0x241f('0x2c')](_0x356009['query'][_0x241f('0x2c')]);}_0x43316d['order']=qs[_0x241f('0x4b')](_0x356009[_0x241f('0x44')]['sort']);_0x43316d['where']=qs[_0x241f('0x45')](_[_0x241f('0x4c')](_0x356009['query'],_0x4fdcb4['filters']),_0x1f16ee);if(_0x356009[_0x241f('0x44')][_0x241f('0x4d')]){_0x43316d[_0x241f('0x4e')]=_[_0x241f('0x4f')](_0x43316d['where'],{'$or':_['map'](_0x1f16ee,function(_0x31c88c){if(_0x31c88c[_0x241f('0x40')]!==_0x241f('0x50')){var _0x468593={};_0x468593[_0x31c88c[_0x241f('0x3b')]]={'$like':'%'+_0x356009[_0x241f('0x44')][_0x241f('0x4d')]+'%'};return _0x468593;}})});}_0x43316d=_[_0x241f('0x4f')]({},_0x43316d,_0x356009[_0x241f('0x51')]);var _0x49647c={'where':_0x43316d['where']};return db['ChatWebsite'][_0x241f('0x2f')](_0x49647c)['then'](function(_0x5e807e){_0x2d99ab[_0x241f('0x2f')]=_0x5e807e;if(_0x356009[_0x241f('0x44')][_0x241f('0x52')]){_0x43316d[_0x241f('0x53')]=[{'all':!![]}];}return db[_0x241f('0x54')][_0x241f('0x55')](_0x43316d);})['then'](function(_0x2b359e){_0x2d99ab['rows']=_0x2b359e;return _0x2d99ab;})[_0x241f('0x35')](respondWithFilteredResult(_0x176060,_0x43316d))[_0x241f('0x29')](handleError(_0x176060,null));};exports['show']=function(_0xd38fb5,_0x506c88){var _0x132f5b={'raw':![],'where':{'id':_0xd38fb5['params']['id']},'include':[{'model':db[_0x241f('0x3e')],'as':_0x241f('0x56')}]},_0xb90d4={};_0xb90d4[_0x241f('0x42')]=_['keys'](db[_0x241f('0x54')][_0x241f('0x3f')]);_0xb90d4['query']=_[_0x241f('0x57')](_0xd38fb5[_0x241f('0x44')]);_0xb90d4[_0x241f('0x45')]=_[_0x241f('0x46')](_0xb90d4[_0x241f('0x42')],_0xb90d4[_0x241f('0x44')]);_0x132f5b[_0x241f('0x47')]=_[_0x241f('0x46')](_0xb90d4['model'],qs['fields'](_0xd38fb5[_0x241f('0x44')][_0x241f('0x48')]));_0x132f5b[_0x241f('0x47')]=_0x132f5b[_0x241f('0x47')][_0x241f('0x58')]?_0x132f5b[_0x241f('0x47')]:_0xb90d4[_0x241f('0x42')];if(_0xd38fb5[_0x241f('0x44')][_0x241f('0x52')]){_0x132f5b[_0x241f('0x53')]=[{'all':!![]}];}_0x132f5b=_[_0x241f('0x4f')]({},_0x132f5b,_0xd38fb5['options']);return db['ChatWebsite']['find'](_0x132f5b)['then'](handleEntityNotFound(_0x506c88,null))['then'](respondWithResult(_0x506c88,null))['catch'](handleError(_0x506c88,null));};exports['create']=function(_0xf33bde,_0x2b7c94){return db[_0x241f('0x54')][_0x241f('0x59')](_0xf33bde[_0x241f('0x5a')],{})['then'](function(_0x3aa9cb){var _0x395dba=_0xf33bde['user']['get']({'plain':!![]});if(!_0x395dba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x395dba[_0x241f('0x5b')]==='user'){var _0x2caa0d=_0x3aa9cb[_0x241f('0x36')]({'plain':!![]});var _0x1443c1='ChatWebsites';return db[_0x241f('0x5c')][_0x241f('0x5d')]({'where':{'name':_0x1443c1,'userProfileId':_0x395dba[_0x241f('0x5e')]},'raw':!![]})[_0x241f('0x35')](function(_0x591a8e){if(_0x591a8e&&_0x591a8e[_0x241f('0x5f')]===0x0){return db[_0x241f('0x38')][_0x241f('0x59')]({'name':_0x2caa0d[_0x241f('0x3b')],'resourceId':_0x2caa0d['id'],'type':_0x591a8e[_0x241f('0x3b')],'sectionId':_0x591a8e['id']},{})[_0x241f('0x35')](function(){return _0x3aa9cb;});}else{return _0x3aa9cb;}})['catch'](function(_0x5d63f4){logger['error'](_0x241f('0x60'),_0x5d63f4);throw _0x5d63f4;});}return _0x3aa9cb;})[_0x241f('0x35')](respondWithResult(_0x2b7c94,0xc9))[_0x241f('0x29')](handleError(_0x2b7c94,null));};exports[_0x241f('0x61')]=function(_0x56e8c3,_0x1a4a08){if(_0x56e8c3[_0x241f('0x5a')]['id']){delete _0x56e8c3[_0x241f('0x5a')]['id'];}return db[_0x241f('0x54')]['find']({'where':{'id':_0x56e8c3[_0x241f('0x62')]['id']},'include':[{'model':db[_0x241f('0x3e')],'as':_0x241f('0x56')}]})[_0x241f('0x35')](handleEntityNotFound(_0x1a4a08,null))['then'](saveUpdates(_0x56e8c3[_0x241f('0x5a')],null))[_0x241f('0x35')](respondWithResult(_0x1a4a08,null))[_0x241f('0x29')](handleError(_0x1a4a08,null));};exports[_0x241f('0x34')]=function(_0x5ce7e2,_0x5a4e27){return db[_0x241f('0x54')]['find']({'where':{'id':_0x5ce7e2['params']['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x5a4e27,null))[_0x241f('0x35')](removeEntity(_0x5a4e27,null))[_0x241f('0x29')](handleError(_0x5a4e27,null));};exports['describe']=function(_0x43761e,_0x54b473){return db[_0x241f('0x54')][_0x241f('0x63')]()[_0x241f('0x35')](respondWithResult(_0x54b473,null))[_0x241f('0x29')](handleError(_0x54b473,null));};exports[_0x241f('0x64')]=function(_0x21148c,_0x4156e1,_0x51a00c){if(_0x21148c[_0x241f('0x5a')]['id']){delete _0x21148c['body']['id'];}return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x21148c[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x4156e1,null))['then'](function(_0x5db938){if(_0x5db938){_0x21148c[_0x241f('0x5a')][_0x241f('0x65')]=_0x5db938['id'];return db[_0x241f('0x66')]['create'](_0x21148c['body']);}})[_0x241f('0x35')](respondWithResult(_0x4156e1,null))[_0x241f('0x29')](handleError(_0x4156e1,null));};exports[_0x241f('0x67')]=function(_0x579afc,_0x4b50ba,_0x5eafb8){var _0x4d0a1e={'raw':![],'where':{}};var _0x18ef9f={};var _0x21a2aa={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x241f('0x68')]({'where':{'id':_0x579afc[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x4b50ba,null))[_0x241f('0x35')](function(_0x34eb87){if(_0x34eb87){_0x18ef9f[_0x241f('0x42')]=_[_0x241f('0x57')](db[_0x241f('0x66')][_0x241f('0x3f')]);_0x18ef9f[_0x241f('0x44')]=_[_0x241f('0x57')](_0x579afc[_0x241f('0x44')]);_0x18ef9f[_0x241f('0x45')]=_[_0x241f('0x46')](_0x18ef9f[_0x241f('0x42')],_0x18ef9f[_0x241f('0x44')]);_0x4d0a1e[_0x241f('0x47')]=_[_0x241f('0x46')](_0x18ef9f[_0x241f('0x42')],qs['fields'](_0x579afc[_0x241f('0x44')][_0x241f('0x48')]));_0x4d0a1e[_0x241f('0x47')]=_0x4d0a1e[_0x241f('0x47')][_0x241f('0x58')]?_0x4d0a1e[_0x241f('0x47')]:_0x18ef9f[_0x241f('0x42')];if(!_0x579afc[_0x241f('0x44')]['hasOwnProperty'](_0x241f('0x4a'))){_0x4d0a1e[_0x241f('0x2e')]=qs[_0x241f('0x2e')](_0x579afc[_0x241f('0x44')][_0x241f('0x2e')]);_0x4d0a1e[_0x241f('0x2c')]=qs[_0x241f('0x2c')](_0x579afc['query'][_0x241f('0x2c')]);}_0x4d0a1e[_0x241f('0x69')]=qs['sort'](_0x579afc[_0x241f('0x44')]['sort']);_0x4d0a1e[_0x241f('0x4e')]=qs[_0x241f('0x45')](_[_0x241f('0x4c')](_0x579afc[_0x241f('0x44')],_0x18ef9f[_0x241f('0x45')]));_0x4d0a1e['where']['ChatWebsiteId']=_0x34eb87['id'];if(_0x579afc[_0x241f('0x44')][_0x241f('0x4d')]){_0x4d0a1e[_0x241f('0x4e')]=_[_0x241f('0x4f')](_0x4d0a1e[_0x241f('0x4e')],{'$or':_[_0x241f('0x43')](_0x4d0a1e[_0x241f('0x47')],function(_0x3cc139){var _0x251642={};_0x251642[_0x3cc139]={'$like':'%'+_0x579afc[_0x241f('0x44')]['filter']+'%'};return _0x251642;})});}_0x4d0a1e=_[_0x241f('0x4f')]({},_0x4d0a1e,_0x579afc[_0x241f('0x51')]);return db[_0x241f('0x66')][_0x241f('0x2f')]({'where':_0x4d0a1e[_0x241f('0x4e')]})[_0x241f('0x35')](function(_0x2178ba){_0x21a2aa['count']=_0x2178ba;if(_0x579afc['query']['includeAll']){_0x4d0a1e[_0x241f('0x53')]=[{'all':!![]}];}return db[_0x241f('0x66')][_0x241f('0x55')](_0x4d0a1e);})['then'](function(_0x4eabe9){_0x21a2aa[_0x241f('0x6a')]=_0x4eabe9;return _0x21a2aa;});}})['then'](respondWithFilteredResult(_0x4b50ba,_0x4d0a1e))['catch'](handleError(_0x4b50ba,null));};exports[_0x241f('0x6b')]=function(_0x418f25,_0x57d631,_0x4797bd){return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x418f25[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x57d631,null))[_0x241f('0x35')](function(_0xeee5b5){if(_0xeee5b5){return _0xeee5b5['removeDispositions'](_0x418f25['query'][_0x241f('0x6c')]);}})[_0x241f('0x35')](respondWithStatusCode(_0x57d631,null))[_0x241f('0x29')](handleError(_0x57d631,null));};exports['addAnswer']=function(_0x3b3f00,_0x2d4b69,_0x29d16c){if(_0x3b3f00[_0x241f('0x5a')]['id']){delete _0x3b3f00[_0x241f('0x5a')]['id'];}return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x3b3f00[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x2d4b69,null))[_0x241f('0x35')](function(_0x44c64c){if(_0x44c64c){_0x3b3f00['body']['ChatWebsiteId']=_0x44c64c['id'];return db[_0x241f('0x6d')][_0x241f('0x59')](_0x3b3f00[_0x241f('0x5a')]);}})[_0x241f('0x35')](respondWithResult(_0x2d4b69,null))[_0x241f('0x29')](handleError(_0x2d4b69,null));};exports['getAnswers']=function(_0x24824e,_0x566ab0,_0xa78f36){var _0x366508={'raw':![],'where':{}};var _0x558945={};var _0xab1ad5={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x24824e['params']['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x566ab0,null))[_0x241f('0x35')](function(_0x1deea1){if(_0x1deea1){_0x558945[_0x241f('0x42')]=_[_0x241f('0x57')](db['CannedAnswer']['rawAttributes']);_0x558945[_0x241f('0x44')]=_[_0x241f('0x57')](_0x24824e[_0x241f('0x44')]);_0x558945[_0x241f('0x45')]=_[_0x241f('0x46')](_0x558945[_0x241f('0x42')],_0x558945['query']);_0x366508['attributes']=_[_0x241f('0x46')](_0x558945[_0x241f('0x42')],qs['fields'](_0x24824e['query']['fields']));_0x366508[_0x241f('0x47')]=_0x366508[_0x241f('0x47')]['length']?_0x366508[_0x241f('0x47')]:_0x558945[_0x241f('0x42')];if(!_0x24824e[_0x241f('0x44')][_0x241f('0x49')]('nolimit')){_0x366508[_0x241f('0x2e')]=qs[_0x241f('0x2e')](_0x24824e[_0x241f('0x44')]['limit']);_0x366508[_0x241f('0x2c')]=qs['offset'](_0x24824e['query'][_0x241f('0x2c')]);}_0x366508['order']=qs[_0x241f('0x4b')](_0x24824e[_0x241f('0x44')][_0x241f('0x4b')]);_0x366508[_0x241f('0x4e')]=qs['filters'](_[_0x241f('0x4c')](_0x24824e[_0x241f('0x44')],_0x558945[_0x241f('0x45')]));_0x366508['where'][_0x241f('0x65')]=_0x1deea1['id'];if(_0x24824e[_0x241f('0x44')]['filter']){_0x366508[_0x241f('0x4e')]=_['merge'](_0x366508[_0x241f('0x4e')],{'$or':_[_0x241f('0x43')](_0x366508[_0x241f('0x47')],function(_0x38df62){var _0x322233={};_0x322233[_0x38df62]={'$like':'%'+_0x24824e['query']['filter']+'%'};return _0x322233;})});}_0x366508=_[_0x241f('0x4f')]({},_0x366508,_0x24824e[_0x241f('0x51')]);return db['CannedAnswer'][_0x241f('0x2f')]({'where':_0x366508[_0x241f('0x4e')]})[_0x241f('0x35')](function(_0x4be72c){_0xab1ad5[_0x241f('0x2f')]=_0x4be72c;if(_0x24824e[_0x241f('0x44')][_0x241f('0x52')]){_0x366508[_0x241f('0x53')]=[{'all':!![]}];}return db[_0x241f('0x6d')][_0x241f('0x55')](_0x366508);})[_0x241f('0x35')](function(_0x1c528f){_0xab1ad5['rows']=_0x1c528f;return _0xab1ad5;});}})[_0x241f('0x35')](respondWithFilteredResult(_0x566ab0,_0x366508))['catch'](handleError(_0x566ab0,null));};exports[_0x241f('0x6e')]=function(_0x5a6d1b,_0x234ea3,_0x1e32e1){return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x5a6d1b[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x234ea3,null))['then'](function(_0x20a16c){if(_0x20a16c){return _0x20a16c[_0x241f('0x6e')](_0x5a6d1b[_0x241f('0x44')][_0x241f('0x6c')]);}})[_0x241f('0x35')](respondWithStatusCode(_0x234ea3,null))['catch'](handleError(_0x234ea3,null));};exports[_0x241f('0x6f')]=function(_0x12eeee,_0x3b658e,_0x15ad33){_0x12eeee[_0x241f('0x5a')][_0x241f('0x70')]=_0x12eeee[_0x241f('0x71')][_0x241f('0x72')];return db[_0x241f('0x54')]['find']({'where':{'id':_0x12eeee[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x3b658e,null))[_0x241f('0x35')](saveUpdates(_0x12eeee[_0x241f('0x5a')],null))[_0x241f('0x35')](respondWithResult(_0x3b658e,null))[_0x241f('0x29')](handleError(_0x3b658e,null));};exports['addAvatar']=function(_0x4cfb57,_0x1f9a55,_0x85cada){_0x4cfb57[_0x241f('0x5a')][_0x241f('0x73')]=_0x4cfb57['file'][_0x241f('0x72')];return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x4cfb57[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x1f9a55,null))[_0x241f('0x35')](saveUpdates(_0x4cfb57['body'],null))[_0x241f('0x35')](respondWithResult(_0x1f9a55,null))[_0x241f('0x29')](handleError(_0x1f9a55,null));};exports['addCustomerAvatar']=function(_0xb7415d,_0xbec93,_0x14401a){_0xb7415d[_0x241f('0x5a')][_0x241f('0x74')]=_0xb7415d[_0x241f('0x71')][_0x241f('0x72')];return db['ChatWebsite'][_0x241f('0x5d')]({'where':{'id':_0xb7415d[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0xbec93,null))['then'](saveUpdates(_0xb7415d[_0x241f('0x5a')],null))['then'](respondWithResult(_0xbec93,null))[_0x241f('0x29')](handleError(_0xbec93,null));};exports[_0x241f('0x75')]=function(_0x382d42,_0x17451e,_0x21f071){_0x382d42['body'][_0x241f('0x76')]=_0x382d42[_0x241f('0x71')][_0x241f('0x72')];return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x382d42['params']['id']}})['then'](handleEntityNotFound(_0x17451e,null))[_0x241f('0x35')](saveUpdates(_0x382d42[_0x241f('0x5a')],null))[_0x241f('0x35')](respondWithResult(_0x17451e,null))[_0x241f('0x29')](handleError(_0x17451e,null));};exports[_0x241f('0x77')]=function(_0x211be6,_0x481fb9,_0x3bf0b6){var _0x7967e5=path[_0x241f('0x78')](config[_0x241f('0x79')],'server/files/images/logos/default_logo.svg');var _0x54a06c={'where':{'id':_0x211be6[_0x241f('0x62')]['id']},'attributes':['id',_0x241f('0x70')],'raw':!![]};var _0x5efb82=![];return require('../../config/license/util')[_0x241f('0x7a')]()[_0x241f('0x35')](function(_0x55964f){if(_0x55964f){_0x5efb82=_0x55964f[_0x241f('0x7b')];}})[_0x241f('0x35')](function(){return db[_0x241f('0x54')][_0x241f('0x5d')](_0x54a06c);})[_0x241f('0x35')](handleEntityNotFound(_0x481fb9,null))['then'](function(_0x2fd887){if(_0x2fd887){if(!_[_0x241f('0x7c')](_0x2fd887[_0x241f('0x70')])){if(fs[_0x241f('0x7d')](path[_0x241f('0x78')](config[_0x241f('0x79')],'server/files/images/logos/',_0x2fd887[_0x241f('0x70')]))&&_0x5efb82){_0x7967e5=path[_0x241f('0x78')](config['root'],_0x241f('0x7e'),_0x2fd887[_0x241f('0x70')]);}}return _0x481fb9[_0x241f('0x7f')](_0x7967e5);}})[_0x241f('0x29')](handleError(_0x481fb9,null));};exports[_0x241f('0x80')]=function(_0x141078,_0xf4b55d,_0x55d9ca){var _0x44a70c=path[_0x241f('0x78')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x57014e={'where':{'id':_0x141078[_0x241f('0x62')]['id']},'attributes':['id',_0x241f('0x73')],'raw':!![]};return db[_0x241f('0x54')][_0x241f('0x5d')](_0x57014e)[_0x241f('0x35')](handleEntityNotFound(_0xf4b55d,null))[_0x241f('0x35')](function(_0x5057bc){if(_0x5057bc){if(!_[_0x241f('0x7c')](_0x5057bc[_0x241f('0x73')])){if(fs['existsSync'](path[_0x241f('0x78')](config[_0x241f('0x79')],_0x241f('0x81'),_0x5057bc['agentAvatar']))){_0x44a70c=path[_0x241f('0x78')](config['root'],_0x241f('0x81'),_0x5057bc[_0x241f('0x73')]);}}return _0xf4b55d[_0x241f('0x7f')](_0x44a70c);}})[_0x241f('0x29')](handleError(_0xf4b55d,null));};exports[_0x241f('0x82')]=function(_0x102d6d,_0x10e9ef,_0x159466){var _0x131c12=path[_0x241f('0x78')](config[_0x241f('0x79')],_0x241f('0x83'));var _0x28208c={'where':{'id':_0x102d6d[_0x241f('0x62')]['id']},'attributes':['id',_0x241f('0x74'),_0x241f('0x84')],'raw':!![]};return db[_0x241f('0x54')]['find'](_0x28208c)['then'](handleEntityNotFound(_0x10e9ef,null))[_0x241f('0x35')](function(_0x31c8dc){if(_0x31c8dc){if(!_[_0x241f('0x7c')](_0x31c8dc[_0x241f('0x74')])){if(fs[_0x241f('0x7d')](path[_0x241f('0x78')](config[_0x241f('0x79')],_0x241f('0x81'),_0x31c8dc[_0x241f('0x74')]))&&_0x31c8dc[_0x241f('0x84')]){_0x131c12=path[_0x241f('0x78')](config[_0x241f('0x79')],_0x241f('0x81'),_0x31c8dc[_0x241f('0x74')]);}}return _0x10e9ef[_0x241f('0x7f')](_0x131c12);}})['catch'](handleError(_0x10e9ef,null));};exports[_0x241f('0x85')]=function(_0x57d683,_0x4620c7,_0x580594){var _0x38feb7=path[_0x241f('0x78')](config['root'],_0x241f('0x86'));var _0x11dd44={'where':{'id':_0x57d683['params']['id']},'attributes':['id',_0x241f('0x76')],'raw':!![]};return db['ChatWebsite'][_0x241f('0x5d')](_0x11dd44)[_0x241f('0x35')](handleEntityNotFound(_0x4620c7,null))[_0x241f('0x35')](function(_0x1e761b){if(_0x1e761b){if(!_[_0x241f('0x7c')](_0x1e761b[_0x241f('0x76')])){if(fs[_0x241f('0x7d')](path[_0x241f('0x78')](config[_0x241f('0x79')],_0x241f('0x81'),_0x1e761b[_0x241f('0x76')]))){_0x38feb7=path[_0x241f('0x78')](config[_0x241f('0x79')],'server/files/images/avatars/',_0x1e761b[_0x241f('0x76')]);}}return _0x4620c7[_0x241f('0x7f')](_0x38feb7);}})[_0x241f('0x29')](handleError(_0x4620c7,null));};exports[_0x241f('0x87')]=function(_0x2eb418,_0x2c3086,_0x53b942){var _0xd341e0=require(_0x241f('0x88'));var _0x469d8d=new _0xd341e0();var _0xc11007=_0x469d8d[_0x241f('0x89')](_0x2eb418[_0x241f('0x8a')][_0x241f('0x8b')])[_0x241f('0x8c')]();var _0x159570={'body':_0x2eb418[_0x241f('0x5a')],'channel':_0x241f('0x8d')};var _0x52c7a7=[];var _0x22f1f2=[];var _0x5f4114={};var _0xa290d5=![];return db['CmContact'][_0x241f('0x63')]()[_0x241f('0x35')](function(_0x526f8){if(!_0x526f8){throw new db[(_0x241f('0x8e'))][(_0x241f('0x8f'))](_0x241f('0x90'));}_0x52c7a7=_[_0x241f('0x91')](_[_0x241f('0x57')](_0x526f8),[_0x241f('0x92'),_0x241f('0x93')]);_0x22f1f2=_[_0x241f('0x91')](_[_0x241f('0x57')](_0x526f8),[_0x241f('0x92'),_0x241f('0x93'),'CompanyId',_0x241f('0x94')]);if(_0x2eb418[_0x241f('0x5a')]['id']){delete _0x2eb418[_0x241f('0x5a')]['id'];}if(_[_0x241f('0x7c')](_0x2eb418[_0x241f('0x5a')][_0x241f('0x95')])){throw new db['Sequelize'][(_0x241f('0x8f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2eb418[_0x241f('0x5a')][_0x241f('0x5a')])||_0x2eb418['body'][_0x241f('0x5a')]===''){throw new db[(_0x241f('0x8e'))][(_0x241f('0x8f'))](_0x241f('0x96'));}if(_[_0x241f('0x7c')](_0x2eb418['body'][_0x241f('0x97')])){throw new db[(_0x241f('0x8e'))][(_0x241f('0x8f'))](_0x241f('0x98')+_0x22f1f2);}if(!_[_0x241f('0x99')](_0x22f1f2,_0x2eb418[_0x241f('0x5a')]['mapKey'])){throw new db[(_0x241f('0x8e'))][(_0x241f('0x8f'))](_0x241f('0x9a')+_0x22f1f2);}_0x5f4114[_0x2eb418['body'][_0x241f('0x97')]]=_0x2eb418[_0x241f('0x5a')][_0x241f('0x95')];})[_0x241f('0x35')](function(){return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x2eb418[_0x241f('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x241f('0x9b'),'include':[{'model':db[_0x241f('0x9c')],'as':_0x241f('0x9d'),'where':_0x5f4114,'limit':0x1,'order':[[_0x241f('0x93'),_0x241f('0x9e')]]}]},{'model':db[_0x241f('0x9f')],'as':_0x241f('0xa0')}]});})[_0x241f('0x35')](handleEntityNotFound(_0x2c3086,null))[_0x241f('0x35')](function(_0x46afc2){if(_0x46afc2&&_0x46afc2[_0x241f('0x9b')]){_0x159570[_0x241f('0xa1')]=_0x46afc2;_0x159570[_0x241f('0xa2')]=_0x46afc2['Applications'];_0x159570['list']=_0x46afc2[_0x241f('0x9b')];_0x159570[_0x241f('0xa2')]=_[_0x241f('0xa3')](_0x159570[_0x241f('0xa2')],[_0x241f('0xa4')],[_0x241f('0xa5')]);if(_0x159570['account'][_0x241f('0xa0')]){delete _0x159570[_0x241f('0xa1')]['Applications'];}if(_0x159570[_0x241f('0xa1')][_0x241f('0x9b')]&&_0x159570[_0x241f('0xa1')][_0x241f('0x9b')][_0x241f('0x9d')][_0x241f('0x58')]){return _0x159570[_0x241f('0xa1')][_0x241f('0x9b')][_0x241f('0x9d')][0x0];}var _0xbcc086=_[_0x241f('0x19')](_0x2eb418[_0x241f('0x5a')],{'firstName':_0x2eb418[_0x241f('0x5a')][_0x241f('0x95')],'ListId':_0x46afc2[_0x241f('0x94')]});_0xbcc086[_0x2eb418['body']['mapKey']]=_0x2eb418[_0x241f('0x5a')][_0x241f('0x95')];return db['CmContact'][_0x241f('0x59')](_0xbcc086,{'fields':_0x52c7a7,'raw':!![]});}})[_0x241f('0x35')](handleEntityNotFound(_0x2c3086,null))[_0x241f('0x35')](function(_0x3b181d){_0x159570[_0x241f('0xa6')]=_0x3b181d;var _0x3fb5b6=_0x2eb418['body'][_0x241f('0xa7')];if(_0x2eb418[_0x241f('0x8a')][_0x241f('0xa8')]){_0x3fb5b6=_0x2eb418[_0x241f('0x8a')][_0x241f('0xa8')];}else if(_0x2eb418[_0x241f('0x8a')][_0x241f('0xa9')]){_0x3fb5b6=_[_0x241f('0xaa')](_0x2eb418['headers'][_0x241f('0xa9')][_0x241f('0xab')](','));}if(_0x3b181d){var _0xc2846f={'ContactId':_0x3b181d['id'],'ChatWebsiteId':_0x2eb418[_0x241f('0x62')]['id'],'from':(_0x3b181d[_0x241f('0xac')]||'')+'\x20'+(_0x3b181d[_0x241f('0xad')]||''),'customerIp':_0x3fb5b6,'customerPort':_0x2eb418[_0x241f('0x8a')][_0x241f('0xae')]?_0x2eb418[_0x241f('0x8a')]['x-real-port']:null,'referer':_0x2eb418['body'][_0x241f('0xaf')],'browserName':_0xc11007[_0x241f('0xb0')][_0x241f('0x3b')]&&_0xc11007[_0x241f('0xb0')]['version']?util[_0x241f('0xb1')](_0x241f('0xb2'),_0xc11007['browser'][_0x241f('0x3b')],_0xc11007[_0x241f('0xb0')][_0x241f('0xb3')]):_0x241f('0xb4'),'browserVersion':_0xc11007[_0x241f('0xb0')][_0x241f('0xb3')]||_0x241f('0xb4'),'osName':util[_0x241f('0xb1')](_0x241f('0xb2'),_0xc11007['os'][_0x241f('0x3b')],_0xc11007['os']['version']),'osVersion':_0xc11007['os'][_0x241f('0xb3')],'deviceModel':_0xc11007[_0x241f('0xb5')][_0x241f('0x42')]&&_0xc11007[_0x241f('0xb5')][_0x241f('0xb6')]?util[_0x241f('0xb1')]('%s\x20%s\x20%s',_0xc11007[_0x241f('0xb5')]['model'],_0xc11007['device']['vendor'],_0xc11007[_0x241f('0xb5')][_0x241f('0x40')]):null,'deviceVendor':_0xc11007[_0x241f('0xb5')]['vendor'],'deviceType':_0xc11007[_0x241f('0xb5')][_0x241f('0x40')],'formData':JSON[_0x241f('0xb7')](_0x2eb418[_0x241f('0x5a')])};var _0x189b26={'ChatWebsiteId':_0x2eb418[_0x241f('0x62')]['id'],'closed':![]};if(_0x2eb418['body'][_0x241f('0xb8')]){_0x189b26[_0x241f('0xb8')]=_0x2eb418[_0x241f('0x5a')][_0x241f('0xb8')];return db[_0x241f('0xb9')][_0x241f('0x5d')]({'where':_0x189b26})[_0x241f('0x35')](function(_0x2c6fe1){if(_0x2c6fe1){return[_0x2c6fe1,![]];}_0xc2846f[_0x241f('0xb8')]=_0x2eb418[_0x241f('0x5a')]['threadId'];_0xc2846f[_0x241f('0xba')]=_0x2eb418['body'][_0x241f('0xba')];return db[_0x241f('0xb9')][_0x241f('0x59')](_0xc2846f)[_0x241f('0x35')](function(_0x36f4d7){return[_0x36f4d7,!![]];});});}_0x189b26[_0x241f('0xbb')]=_0x3b181d['id'];if(_0x2eb418[_0x241f('0x5a')][_0x241f('0xbc')]&&_0x2eb418[_0x241f('0x5a')][_0x241f('0xbc')]['id']){_0x189b26['id']=_0x2eb418[_0x241f('0x5a')][_0x241f('0xbc')]['id'];return db[_0x241f('0xb9')][_0x241f('0x5d')]({'where':_0x189b26})['then'](function(_0x18e71f){if(_0x18e71f){return[_0x18e71f,![]];}return db['ChatInteraction'][_0x241f('0x59')](_0xc2846f)['then'](function(_0x10b091){return[_0x10b091,!![]];});});}return db[_0x241f('0xb9')][_0x241f('0x59')](_0xc2846f)['then'](function(_0x167239){return[_0x167239,!![]];});}})[_0x241f('0xbd')](function(_0x292988,_0x40493c){if(_0x292988){_0xa290d5=_0x40493c;if(!_0x40493c){var _0x42ba20={'from':(_0x159570[_0x241f('0xa6')][_0x241f('0xac')]||'')+'\x20'+(_0x159570[_0x241f('0xa6')][_0x241f('0xad')]||'')};if(_0x2eb418[_0x241f('0x5a')][_0x241f('0xb8')]&&_0x2eb418[_0x241f('0x5a')][_0x241f('0xbe')]&&_0x2eb418[_0x241f('0x5a')][_0x241f('0xb8')]!=_0x2eb418[_0x241f('0x5a')]['messageId']){_0x42ba20[_0x241f('0xb8')]=_0x2eb418[_0x241f('0x5a')][_0x241f('0xbe')];}return _0x292988['update'](_0x42ba20);}else{return _0x292988;}}})['then'](function(_0x12d0f4){_0x159570['interaction']=_0x12d0f4[_0x241f('0x36')]({'plain':!![]});_0x159570['interaction'][_0x241f('0xbf')]=_0xa290d5;if(_0x159570['interaction']['created']){if(_0x159570['account'][_0x241f('0xc0')]){_0x159570[_0x241f('0xa2')][_0x241f('0xc1')]({'id':0x0,'priority':_0x159570[_0x241f('0xa2')][_0x241f('0x58')]+0x1,'app':_0x241f('0xc2'),'appdata':_0x241f('0xc3'),'interval':'*,*,*,*'});}}return db[_0x241f('0xc4')][_0x241f('0x59')]({'body':_0x2eb418[_0x241f('0x5a')][_0x241f('0x5a')],'ChatWebsiteId':_0x2eb418[_0x241f('0x62')]['id'],'ChatInteractionId':_0x12d0f4['id'],'direction':'in','ContactId':_0x159570['contact']['id'],'AttachmentId':_0x2eb418[_0x241f('0x5a')][_0x241f('0xc5')]});})[_0x241f('0x35')](function(_0x961a82){_0x159570[_0x241f('0x26')]=_0x961a82;if(_0x159570[_0x241f('0xbc')]['UserId']){return db[_0x241f('0xc6')][_0x241f('0x5d')]({'attributes':['id',_0x241f('0x3b')],'where':{'id':_0x159570['interaction']['UserId']}})[_0x241f('0x35')](function(_0x6fd1a1){if(_0x6fd1a1){_0x159570['applications'][_0x241f('0xc7')]({'id':0x0,'priority':0x0,'app':_0x241f('0xc8'),'appdata':_0x6fd1a1[_0x241f('0x3b')]+','+(_0x159570[_0x241f('0xa1')][_0x241f('0xc9')]||0xa),'interval':_0x241f('0xca')});_0x159570[_0x241f('0xcb')]=!![];}return respondWithRpcPromise(_0x241f('0xcc'),_0x241f('0xcd'),_0x159570);});}return respondWithRpcPromise(_0x241f('0xcc'),_0x241f('0xcd'),_0x159570);})[_0x241f('0x35')](function(_0x252605){respondWithRpcPromise(_0x241f('0xce'),'EventManager',{'event':'notify','message':_0x252605},client9002);return _0x252605;})['then'](respondWithResult(_0x2c3086,null))[_0x241f('0x29')](handleError(_0x2c3086,null));};exports[_0x241f('0xcf')]=function(_0xe27006,_0x59d5ab,_0x5c2380){var _0x261be5,_0x45a79e,_0x3894ce;var _0x5cd37b=[];var _0x3ff393=[];var _0x4eb908={};var _0x5c7963=_0xe27006[_0x241f('0xd0')]||[];var _0x4127c9=[];var _0x567cd3;return db[_0x241f('0x9c')][_0x241f('0x63')]()[_0x241f('0x35')](function(_0x26b57c){if(!_0x26b57c){throw new db[(_0x241f('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0x3ff393=_['difference'](_[_0x241f('0x57')](_0x26b57c),[_0x241f('0x92'),_0x241f('0x93')]);_0x5cd37b=_['difference'](_[_0x241f('0x57')](_0x26b57c),[_0x241f('0x92'),_0x241f('0x93'),_0x241f('0xd1'),_0x241f('0x94')]);if(_0xe27006[_0x241f('0x5a')]['id']){delete _0xe27006['body']['id'];}if(_[_0x241f('0x7c')](_0xe27006[_0x241f('0x5a')]['from'])){throw _0x59d5ab[_0x241f('0x30')](0x1f4)[_0x241f('0x3c')](new db[(_0x241f('0x8e'))][(_0x241f('0x8f'))](_0x241f('0xd2')));}if(_['isNil'](_0xe27006[_0x241f('0x5a')][_0x241f('0x5a')])||_0xe27006[_0x241f('0x5a')][_0x241f('0x5a')]===''){throw _0x59d5ab[_0x241f('0x30')](0x1f4)['send'](new db[(_0x241f('0x8e'))][(_0x241f('0x8f'))](_0x241f('0x96')));}if(_[_0x241f('0x7c')](_0xe27006[_0x241f('0x5a')][_0x241f('0xd3')])){throw _0x59d5ab[_0x241f('0x30')](0x1f4)[_0x241f('0x3c')](new db[(_0x241f('0x8e'))]['ValidationError'](_0x241f('0xd4')+_0x5cd37b));}if(!_['includes'](_0x5cd37b,_0xe27006[_0x241f('0x5a')][_0x241f('0xd3')])){throw _0x59d5ab[_0x241f('0x30')](0x1f4)[_0x241f('0x3c')](new db[(_0x241f('0x8e'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cd37b));}_0x4eb908[_0xe27006['body']['mapKeyOffline']]=_0xe27006[_0x241f('0x5a')][_0x241f('0x95')];})[_0x241f('0x35')](function(){return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0xe27006['params']['id']},'include':[{'model':db[_0x241f('0xd5')],'as':_0x241f('0x9b')},{'model':db[_0x241f('0xd6')],'as':'MailAccount'}]});})[_0x241f('0x35')](handleEntityNotFound(_0x59d5ab,null))[_0x241f('0x35')](function(_0x47f45e){if(_0x47f45e&&_0x47f45e[_0x241f('0x9b')]){_0x45a79e=_0x47f45e;var _0x4225e4=_[_0x241f('0x19')](_0xe27006[_0x241f('0x5a')],{'firstName':_0xe27006[_0x241f('0x5a')]['from'],'phone':_0xe27006[_0x241f('0x5a')][_0x241f('0x95')],'ListId':_0x47f45e[_0x241f('0x94')]});_0x4225e4[_0xe27006[_0x241f('0x5a')][_0x241f('0xd3')]]=_0xe27006[_0x241f('0x5a')][_0x241f('0x95')];return db[_0x241f('0x9c')][_0x241f('0xd7')]({'where':_0x4eb908,'defaults':_0x4225e4});}})[_0x241f('0xbd')](function(_0x229f2f){if(_0x229f2f){_0x3894ce=_0x229f2f;var _0x5bd4b9=fs[_0x241f('0xd8')](path[_0x241f('0x78')](config[_0x241f('0x79')],_0x241f('0xd9')),_0x241f('0xda'));var _0x3517fa=ejs[_0x241f('0xdb')](_0x5bd4b9,{'body':_[_0x241f('0xdc')](_0xe27006['body'][_0x241f('0x5a')]),'bodyTitle':_0x45a79e['offlineMessageBody']});return db[_0x241f('0xdd')][_0x241f('0x59')]({'body':_0x3517fa,'ContactId':_0x229f2f['id'],'ChatWebsiteId':_0x45a79e['id']});}})[_0x241f('0x35')](function(_0x2e7ba2){_0x567cd3=_0x2e7ba2;if(_0x5c7963[_0x241f('0x58')]){var _0x75e459=_0x5c7963[_0x241f('0x43')](function(_0x2d627f){return{'name':_0x2d627f[_0x241f('0xde')],'basename':_0x2d627f[_0x241f('0x72')],'type':_0x2d627f['mimetype'],'ChatOfflineMessageId':_0x2e7ba2['id']};});_0x4127c9=_0x75e459['map'](_0x4c8a3a=>{var _0x40da50={'filename':_0x4c8a3a['name'],'path':path['join'](config['root'],_0x241f('0xdf'),_0x241f('0xd0'),_0x241f('0xe0'),_0x241f('0xe1'),_0x4c8a3a[_0x241f('0xe2')])};return _0x40da50;});if(!_0x45a79e[_0x241f('0xe3')]){return db[_0x241f('0xe4')][_0x241f('0xe5')](function(_0x410ba1){return db[_0x241f('0xe6')][_0x241f('0xe7')](_0x75e459,{'transaction':_0x410ba1});});}}})[_0x241f('0x35')](function(){if(_0x567cd3){_0x261be5=_0x567cd3;return db[_0x241f('0xd6')][_0x241f('0x68')]({'where':{'active':!![]},'include':[{'model':db[_0x241f('0xe8')],'as':_0x241f('0xe9'),'raw':!![]}]});}})['then'](function(_0x1889d1){if(_0x1889d1&&_0x1889d1['Smtp']&&_0x45a79e[_0x241f('0xea')]&&_0x45a79e[_0x241f('0xeb')]){var _0x537341={'tls':{'rejectUnauthorized':![]}};if(_0x1889d1[_0x241f('0xe9')][_0x241f('0xec')]){_0x537341[_0x241f('0xec')]=_0x1889d1[_0x241f('0xe9')][_0x241f('0xec')];}else{_0x537341[_0x241f('0xed')]=_0x1889d1[_0x241f('0xe9')][_0x241f('0xed')];_0x537341[_0x241f('0xee')]=_0x1889d1[_0x241f('0xe9')]['port'];_0x537341[_0x241f('0xef')]=_0x1889d1[_0x241f('0xe9')][_0x241f('0xef')];}if(_0x1889d1[_0x241f('0xe9')][_0x241f('0xf0')]){_0x537341['auth']={'user':_0x1889d1[_0x241f('0xe9')]['user'],'pass':_0x1889d1[_0x241f('0xe9')]['pass']};}return respondWithRpcPromise(_0x241f('0xf1'),_0x241f('0xf2'),{'account':_0x537341,'message':{'from':util['format'](_0x241f('0xf3'),_0x1889d1['name'],_0x1889d1[_0x241f('0xf4')]||_0x1889d1[_0x241f('0xe9')][_0x241f('0xf5')]),'to':_0x45a79e[_0x241f('0xeb')],'subject':_0x45a79e[_0x241f('0xf6')],'html':_0x261be5[_0x241f('0x5a')],'attachments':_0x4127c9}},client9003)[_0x241f('0x35')](function(){return _0x261be5;})[_0x241f('0x29')](function(_0x1efeeb){console['error'](_0x1efeeb);});}})[_0x241f('0x35')](function(){if(_0x45a79e&&_0x45a79e[_0x241f('0xe3')]&&_0x45a79e[_0x241f('0xf7')]){var _0x2e5d93=[];if(_0x5c7963[_0x241f('0x58')]){_0x2e5d93=_0x5c7963['map'](function(_0x335bcd){return{'name':_0x335bcd[_0x241f('0xde')],'basename':_0x335bcd[_0x241f('0x72')],'type':_0x335bcd[_0x241f('0xf8')],'ChatOfflineMessageId':_0x567cd3['id']};});}var _0x249802;if(!_[_0x241f('0x7c')](_0x45a79e[_0x241f('0xf9')])){var _0x4df713=_[_0x241f('0x43')](_0xe27006[_0x241f('0x5a')],function(_0x49e6ba){return _0x49e6ba;});var _0x193c8f=_['toPairsIn'](_0x4df713)[0x0];var _0x3d1d45=_[_0x241f('0xfa')](_0x193c8f,function(_0x266cac){return _0x266cac;});_0x249802=_0x3d1d45[0x1][_0x45a79e['subjectOffline']];}var _0x25ba4d={'from':_0x3894ce['email'],'firstName':_0x3894ce['firstName'],'lastName':_0x3894ce['lastName'],'mapKey':_0x241f('0xf4'),'message':{'from':_0x3894ce[_0x241f('0xf4')],'to':_0x45a79e['MailAccount'][_0x241f('0xf4')],'cc':'','subject':_['isNil'](_0x249802)?_0x45a79e['offlineMessageSubject']:_0x249802,'messageId':'','sentAt':new Date(),'attach':_0x2e5d93['length'],'attachments':_0x2e5d93,'originChannel':_0x241f('0xfb'),'ChatWebsiteId':_0x45a79e['id'],'ChatOfflineMessageId':_0x261be5['id'],'originTo':_0x45a79e[_0x241f('0xd6')][_0x241f('0xf4')]},'body':_0x261be5[_0x241f('0x5a')]};var _0x22ccfa={'account':{'id':_0x45a79e[_0x241f('0xf7')]},'body':_0x25ba4d,'log':_0x241f('0xfc')};return respondWithRpcPromise(_0x241f('0xfc'),_0x241f('0xfd'),_0x22ccfa,client9001)['then'](function(){return _0x261be5;})['catch'](function(_0x2791c3){console[_0x241f('0x24')](_0x2791c3);});}return;})[_0x241f('0x35')](function(){if(_0x261be5){return _0x261be5;}})[_0x241f('0x35')](respondWithResult(_0x59d5ab,null))['catch'](function(_0x4324bb){console['error'](_0x241f('0x29'),_0x4324bb);for(var _0x361c57 of _0x5c7963){var _0x18d6ea=path[_0x241f('0x78')](config[_0x241f('0x79')],'server',_0x241f('0xd0'),'attachments','offline-chat',_0x361c57[_0x241f('0x72')]);fs_extra[_0x241f('0xfe')](_0x18d6ea)[_0x241f('0x29')](function(_0x55f6e2){console[_0x241f('0x24')](_0x241f('0xff'),_0x18d6ea,_0x55f6e2);});}});};exports[_0x241f('0x100')]=function(_0x30da9d,_0xf495a,_0x28987d){return db[_0x241f('0xb9')][_0x241f('0x5d')]({'where':{'id':_0x30da9d[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0xf495a,null))['then'](function(_0x46fcf3){if(_0x46fcf3){return _0x46fcf3[_0x241f('0x100')](_0x30da9d['body'][_0x241f('0x6c')],_[_0x241f('0x101')](_0x30da9d[_0x241f('0x5a')],[_0x241f('0x6c'),'id'])||{});}})[_0x241f('0x35')](respondWithResult(_0xf495a,null))['catch'](handleError(_0xf495a,null));};exports[_0x241f('0x102')]=function(_0x16b10b,_0x4e5962,_0x269ba4){var _0x3866a1={'raw':![],'where':{}};var _0x42b428={};var _0x294fe8={'count':0x0,'rows':[]};return db[_0x241f('0x54')][_0x241f('0x68')]({'where':{'id':_0x16b10b[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x4e5962,null))[_0x241f('0x35')](function(_0x12d098){if(_0x12d098){_0x42b428[_0x241f('0x42')]=_[_0x241f('0x57')](db[_0x241f('0xb9')][_0x241f('0x3f')]);_0x42b428[_0x241f('0x44')]=_[_0x241f('0x57')](_0x16b10b[_0x241f('0x44')]);_0x42b428[_0x241f('0x45')]=_[_0x241f('0x46')](_0x42b428[_0x241f('0x42')],_0x42b428[_0x241f('0x44')]);_0x3866a1['attributes']=_[_0x241f('0x46')](_0x42b428[_0x241f('0x42')],qs['fields'](_0x16b10b['query'][_0x241f('0x48')]));_0x3866a1[_0x241f('0x47')]=_0x3866a1['attributes'][_0x241f('0x58')]?_0x3866a1[_0x241f('0x47')]:_0x42b428[_0x241f('0x42')];if(!_0x16b10b['query']['hasOwnProperty']('nolimit')){_0x3866a1[_0x241f('0x2e')]=qs[_0x241f('0x2e')](_0x16b10b[_0x241f('0x44')]['limit']);_0x3866a1['offset']=qs[_0x241f('0x2c')](_0x16b10b[_0x241f('0x44')][_0x241f('0x2c')]);}_0x3866a1['order']=qs[_0x241f('0x4b')](_0x16b10b[_0x241f('0x44')]['sort']);_0x3866a1[_0x241f('0x4e')]=qs[_0x241f('0x45')](_['pick'](_0x16b10b[_0x241f('0x44')],_0x42b428[_0x241f('0x45')]));_0x3866a1[_0x241f('0x4e')][_0x241f('0x65')]=_0x12d098['id'];if(_0x16b10b['query']['filter']){_0x3866a1[_0x241f('0x4e')]=_[_0x241f('0x4f')](_0x3866a1[_0x241f('0x4e')],{'$or':_[_0x241f('0x43')](_0x3866a1['attributes'],function(_0x610cc4){var _0x2d7d21={};_0x2d7d21[_0x610cc4]={'$like':'%'+_0x16b10b[_0x241f('0x44')]['filter']+'%'};return _0x2d7d21;})});}_0x3866a1=_['merge']({},_0x3866a1,_0x16b10b[_0x241f('0x51')]);return db[_0x241f('0xb9')][_0x241f('0x2f')]({'where':_0x3866a1['where']})['then'](function(_0x232cd1){_0x294fe8[_0x241f('0x2f')]=_0x232cd1;if(_0x16b10b['query'][_0x241f('0x52')]){_0x3866a1[_0x241f('0x53')]=[{'model':db[_0x241f('0x9c')],'as':_0x241f('0x103'),'required':![]},{'model':db['User'],'as':_0x241f('0x104'),'attributes':[_0x241f('0x3b'),_0x241f('0x105'),_0x241f('0x106')],'required':![]},{'model':db['Tag'],'as':_0x241f('0x107'),'attributes':['id',_0x241f('0x3b'),_0x241f('0x108')],'where':_0x16b10b[_0x241f('0x44')][_0x241f('0x109')]?{'id':_0x16b10b['query'][_0x241f('0x109')]}:undefined,'required':_0x16b10b[_0x241f('0x44')][_0x241f('0x109')]?!![]:![]}];}return db[_0x241f('0xb9')][_0x241f('0x55')](_0x3866a1);})[_0x241f('0x35')](function(_0x49d8b1){_0x294fe8[_0x241f('0x6a')]=_0x49d8b1;return _0x294fe8;});}})[_0x241f('0x35')](respondWithFilteredResult(_0x4e5962,_0x3866a1))['catch'](handleError(_0x4e5962,null));};function iftimePromise(_0x3ed4a4,_0x110c87){return respondWithRpcPromise('Command',_0x241f('0x10a'),{'command':_0x110c87[_0x241f('0x10b')]?util[_0x241f('0xb1')](_0x241f('0x10c'),_0x3ed4a4['interval'],_0x110c87['timezone']):util['format'](_0x241f('0x10d'),_0x3ed4a4[_0x241f('0x10e')])},client9002)[_0x241f('0x35')](function(_0x3473f2){var _0xb12632=_0x3473f2&&_0x3473f2[_0x241f('0x10f')]('true')>=0x0?!![]:![];logger['info'](_0x241f('0x110'),_0x110c87['id'],_0x3ed4a4['id'],_0x3ed4a4['interval'],_0xb12632?'ONLINE':'OFFLINE',_0x110c87[_0x241f('0x10b')]?_0x110c87[_0x241f('0x10b')]:_0x241f('0x111'));return _0xb12632;})[_0x241f('0x29')](function(_0x27cfd0){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x110c87['id'],_0x3ed4a4['id'],_0x3ed4a4[_0x241f('0x10e')],util[_0x241f('0x112')](_0x27cfd0,{'showHidden':![],'depth':null}),_0x110c87[_0x241f('0x10b')]?_0x110c87[_0x241f('0x10b')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x267b58,_0x2138bb,_0x50eb66){var _0x4c4057=0x0;var _0x148ad9=0x0;var _0x197db0=![];var _0x53a523;var _0x41d733;return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x267b58[_0x241f('0x62')]['id']},'include':[{'model':db[_0x241f('0x113')],'as':_0x241f('0x113'),'include':[{'model':db[_0x241f('0x113')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x241f('0x35')](handleEntityNotFound(_0x2138bb,null))[_0x241f('0x35')](function(_0x4a1d7d){if(_0x4a1d7d){_0x53a523=_0x4a1d7d;return _0x4a1d7d[_0x241f('0x114')]({'raw':!![]});}})[_0x241f('0x35')](function(_0x5f21c5){if(_0x53a523){if(_0x5f21c5){_0x41d733=_0x5f21c5;}}return require('../../config/license/util')[_0x241f('0x7a')]();})[_0x241f('0x35')](function(_0x364fec){if(_0x364fec){_0x148ad9=_0x364fec[_0x241f('0x115')];_0x197db0=_0x364fec['custom'];}})[_0x241f('0x35')](function(){return db[_0x241f('0xb9')][_0x241f('0x2f')]({'where':{'closed':![]}});})[_0x241f('0x35')](function(_0x1ae639){_0x4c4057=_0x1ae639;if(_0x148ad9&&_0x1ae639>_0x148ad9){return db[_0x241f('0x116')]['findOne']({'where':{'id':0x1}})[_0x241f('0x35')](function(_0x55ed72){if(_0x55ed72){_0x55ed72[_0x241f('0x117')](_0x241f('0x118'));}});}})[_0x241f('0x35')](function(){if(_0x53a523['Interval']&&_0x53a523['Interval'][_0x241f('0x119')]){var _0x5cd19d=[];for(var _0x13cfb=0x0;_0x13cfb<_0x53a523[_0x241f('0x113')][_0x241f('0x119')][_0x241f('0x58')];_0x13cfb++){var _0x57c6fc=_0x53a523[_0x241f('0x113')][_0x241f('0x119')][_0x13cfb]['get']({'plain':!![]});_0x5cd19d['push'](iftimePromise(_0x57c6fc,_0x53a523));}return BPromise[_0x241f('0x11a')](_0x5cd19d)['then'](function(_0x1f5532){return _[_0x241f('0x11b')](_0x1f5532);});}else{return!![];}})[_0x241f('0x35')](function(_0x53c98f){var _0x1450f6=fs[_0x241f('0xd8')](path[_0x241f('0x78')](config['root'],'server/files/chat/iframe.ejs'),_0x241f('0xda'));var _0x42f823={'remote':_0x53a523[_0x241f('0x11c')],'query':querystring[_0x241f('0xb7')](_['merge'](_0x53a523[_0x241f('0x36')]({'plain':!![]}),{'customerIp':_0x267b58['headers']['x-forwarded-for']||_0x267b58[_0x241f('0x8a')][_0x241f('0x11d')]||_0x267b58[_0x241f('0x11e')]['remoteAddress']||_0x267b58['ip'],'referer':_0x267b58[_0x241f('0x8a')][_0x241f('0xaf')],'openedInteractions':_0x4c4057,'maxInteractions':_0x148ad9,'virtual':_0x197db0[_0x241f('0x115')],'online':_0x53c98f,'custom':_0x197db0}))[_0x241f('0x11f')](/'/g,'\x5c\x27')};_0x2138bb[_0x241f('0x3c')](ejs[_0x241f('0xdb')](Mustache['render'](_0x1450f6,_0x42f823),{'proactiveActions':_0x41d733,'alignment':_0x53a523[_0x241f('0x120')],'verticalAlignment':_0x53a523[_0x241f('0x121')],'div_color':_0x53a523[_0x241f('0x108')],'text_color':_0x53a523[_0x241f('0x122')],'button_color':_0x53a523[_0x241f('0x123')],'background_color':_0x53a523[_0x241f('0x124')]}));})[_0x241f('0x29')](handleError(_0x2138bb,null));};exports['addApplications']=function(_0x2279cd,_0x3235bf,_0x50072f){return db[_0x241f('0x54')][_0x241f('0x68')]({'where':{'id':_0x2279cd[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x3235bf,null))[_0x241f('0x35')](function(_0x37758d){if(_0x37758d){return db['sequelize'][_0x241f('0xe5')](function(_0x46df23){return db[_0x241f('0x9f')][_0x241f('0x34')]({'where':{'ChatWebsiteId':_0x2279cd[_0x241f('0x62')]['id']},'transaction':_0x46df23})['then'](function(_0x241b0f){var _0x2cf35a=_[_0x241f('0x43')](_0x2279cd[_0x241f('0x5a')],function(_0x3ba430){_0x3ba430[_0x241f('0x65')]=_0x2279cd[_0x241f('0x62')]['id'];return _0x3ba430;});return db[_0x241f('0x9f')][_0x241f('0xe7')](_0x2cf35a,{'transaction':_0x46df23});});})[_0x241f('0x35')](function(){return db[_0x241f('0x9f')][_0x241f('0x125')]({'where':{'ChatWebsiteId':_0x2279cd[_0x241f('0x62')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x3235bf,null))[_0x241f('0x29')](handleError(_0x3235bf,null));};exports[_0x241f('0x126')]=function(_0x178c70,_0x5e4002,_0x3833c9){var _0x38360d={};var _0xff423d={};var _0x5977c1;var _0x78b018;return db[_0x241f('0x54')][_0x241f('0x68')]({'where':{'id':_0x178c70[_0x241f('0x62')]['id']}})['then'](handleEntityNotFound(_0x5e4002,null))[_0x241f('0x35')](function(_0x1789a6){if(_0x1789a6){_0x5977c1=_0x1789a6;_0xff423d[_0x241f('0x42')]=_[_0x241f('0x57')](db[_0x241f('0x9f')][_0x241f('0x3f')]);_0xff423d[_0x241f('0x44')]=_['keys'](_0x178c70['query']);_0xff423d[_0x241f('0x45')]=_[_0x241f('0x46')](_0xff423d[_0x241f('0x42')],_0xff423d['query']);_0x38360d[_0x241f('0x47')]=_[_0x241f('0x46')](_0xff423d['model'],qs[_0x241f('0x48')](_0x178c70[_0x241f('0x44')][_0x241f('0x48')]));_0x38360d[_0x241f('0x47')]=_0x38360d['attributes'][_0x241f('0x58')]?_0x38360d[_0x241f('0x47')]:_0xff423d[_0x241f('0x42')];_0x38360d[_0x241f('0x69')]=qs[_0x241f('0x4b')](_0x178c70[_0x241f('0x44')][_0x241f('0x4b')]);_0x38360d[_0x241f('0x4e')]=qs[_0x241f('0x45')](_[_0x241f('0x4c')](_0x178c70[_0x241f('0x44')],_0xff423d[_0x241f('0x45')]));if(_0x178c70[_0x241f('0x44')][_0x241f('0x4d')]){_0x38360d[_0x241f('0x4e')]=_[_0x241f('0x4f')](_0x38360d['where'],{'$or':_['map'](_0x38360d['attributes'],function(_0x20403d){var _0x23f967={};_0x23f967[_0x20403d]={'$like':'%'+_0x178c70[_0x241f('0x44')][_0x241f('0x4d')]+'%'};return _0x23f967;})});}_0x38360d=_[_0x241f('0x4f')]({},_0x38360d,_0x178c70[_0x241f('0x51')]);return _0x5977c1[_0x241f('0x126')](_0x38360d);}})[_0x241f('0x35')](function(_0xa6c78d){if(_0xa6c78d){_0x78b018=_0xa6c78d[_0x241f('0x58')];if(!_0x178c70[_0x241f('0x44')][_0x241f('0x49')]('nolimit')){_0x38360d[_0x241f('0x2e')]=qs['limit'](_0x178c70['query']['limit']);_0x38360d['offset']=qs[_0x241f('0x2c')](_0x178c70[_0x241f('0x44')][_0x241f('0x2c')]);}return _0x5977c1['getApplications'](_0x38360d);}})[_0x241f('0x35')](function(_0x2f9b67){if(_0x2f9b67){return _0x2f9b67?{'count':_0x78b018,'rows':_0x2f9b67}:null;}})[_0x241f('0x35')](respondWithResult(_0x5e4002,null))[_0x241f('0x29')](handleError(_0x5e4002,null));};exports[_0x241f('0x127')]=function(_0x4004cc,_0x33a321,_0x5e20ec){return db[_0x241f('0x128')][_0x241f('0x5d')]({'where':{'id':_0x4004cc[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x33a321,null))[_0x241f('0x35')](function(_0x2d50ce){if(_0x2d50ce){return _0x2d50ce[_0x241f('0x127')](_0x4004cc[_0x241f('0x5a')]['ids'],_[_0x241f('0x101')](_0x4004cc[_0x241f('0x5a')],[_0x241f('0x6c'),'id'])||{});}})[_0x241f('0x35')](respondWithResult(_0x33a321,null))[_0x241f('0x29')](handleError(_0x33a321,null));};exports[_0x241f('0x114')]=function(_0xec58b2,_0x1074e2,_0x376b9a){var _0x20f4b0={};var _0x3e5e1e={};var _0x377b71;var _0x48a457;return db[_0x241f('0x54')][_0x241f('0x68')]({'where':{'id':_0xec58b2[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x1074e2,null))['then'](function(_0x41255c){if(_0x41255c){_0x377b71=_0x41255c;_0x3e5e1e['model']=_[_0x241f('0x57')](db[_0x241f('0x129')]['rawAttributes']);_0x3e5e1e[_0x241f('0x44')]=_[_0x241f('0x57')](_0xec58b2[_0x241f('0x44')]);_0x3e5e1e['filters']=_['intersection'](_0x3e5e1e['model'],_0x3e5e1e[_0x241f('0x44')]);_0x20f4b0[_0x241f('0x47')]=_[_0x241f('0x46')](_0x3e5e1e['model'],qs[_0x241f('0x48')](_0xec58b2[_0x241f('0x44')][_0x241f('0x48')]));_0x20f4b0['attributes']=_0x20f4b0[_0x241f('0x47')][_0x241f('0x58')]?_0x20f4b0[_0x241f('0x47')]:_0x3e5e1e[_0x241f('0x42')];_0x20f4b0[_0x241f('0x69')]=qs['sort'](_0xec58b2[_0x241f('0x44')][_0x241f('0x4b')]);_0x20f4b0[_0x241f('0x4e')]=qs[_0x241f('0x45')](_[_0x241f('0x4c')](_0xec58b2[_0x241f('0x44')],_0x3e5e1e[_0x241f('0x45')]));if(_0xec58b2['query'][_0x241f('0x4d')]){_0x20f4b0['where']=_[_0x241f('0x4f')](_0x20f4b0[_0x241f('0x4e')],{'$or':_[_0x241f('0x43')](_0x20f4b0[_0x241f('0x47')],function(_0x3c3008){var _0x2404a6={};_0x2404a6[_0x3c3008]={'$like':'%'+_0xec58b2[_0x241f('0x44')][_0x241f('0x4d')]+'%'};return _0x2404a6;})});}_0x20f4b0=_['merge']({},_0x20f4b0,_0xec58b2[_0x241f('0x51')]);return _0x377b71[_0x241f('0x114')](_0x20f4b0);}})[_0x241f('0x35')](function(_0x46cf7b){if(_0x46cf7b){_0x48a457=_0x46cf7b[_0x241f('0x58')];if(!_0xec58b2[_0x241f('0x44')][_0x241f('0x49')]('nolimit')){_0x20f4b0[_0x241f('0x2e')]=qs[_0x241f('0x2e')](_0xec58b2[_0x241f('0x44')]['limit']);_0x20f4b0['offset']=qs[_0x241f('0x2c')](_0xec58b2[_0x241f('0x44')]['offset']);}return _0x377b71[_0x241f('0x114')](_0x20f4b0);}})['then'](function(_0x16892b){if(_0x16892b){return _0x16892b?{'count':_0x48a457,'rows':_0x16892b}:null;}})[_0x241f('0x35')](respondWithResult(_0x1074e2,null))[_0x241f('0x29')](handleError(_0x1074e2,null));};exports[_0x241f('0x12a')]=function(_0x5a2e87,_0x47875a,_0x3be805){var _0x3a34e7=_0x5a2e87[_0x241f('0x44')]['online']===_0x241f('0x12b')?'offlineForm':_0x241f('0x12c');return db[_0x241f('0x54')][_0x241f('0x5d')]({'attributes':['id',_0x3a34e7],'where':{'id':_0x5a2e87[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x47875a,null))[_0x241f('0x35')](function(_0x2dc3c0){if(_0x2dc3c0){var _0x391f33=_0x2dc3c0[_0x3a34e7];var _0x345140=_0x391f33&&_0x391f33['items']?_0x391f33[_0x241f('0x12d')]:[];_0x47875a[_0x241f('0x3c')]({'fromKey':_['isNil'](_0x391f33[_0x241f('0x12e')])?undefined:_0x391f33[_0x241f('0x12e')],'count':_0x345140['length'],'rows':_0x345140});}})[_0x241f('0x29')](handleError(_0x47875a,null));};exports[_0x241f('0x12f')]=function(_0x286557,_0x496b2c,_0x459071){var _0x293289={'raw':![],'where':{}};var _0xc5704={};var _0xe87ca3={'count':0x0,'rows':[]};return db[_0x241f('0x54')][_0x241f('0x68')]({'where':{'id':_0x286557[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x496b2c,null))[_0x241f('0x35')](function(_0x5d20ff){if(_0x5d20ff){_0xc5704[_0x241f('0x42')]=_['keys'](db['ChatOfflineMessage'][_0x241f('0x3f')]);_0xc5704[_0x241f('0x44')]=_[_0x241f('0x57')](_0x286557['query']);_0xc5704[_0x241f('0x45')]=_['intersection'](_0xc5704[_0x241f('0x42')],_0xc5704[_0x241f('0x44')]);_0x293289[_0x241f('0x47')]=_['intersection'](_0xc5704[_0x241f('0x42')],qs[_0x241f('0x48')](_0x286557['query'][_0x241f('0x48')]));_0x293289[_0x241f('0x47')]=_0x293289[_0x241f('0x47')][_0x241f('0x58')]?_0x293289[_0x241f('0x47')]:_0xc5704['model'];if(!_0x286557['query'][_0x241f('0x49')](_0x241f('0x4a'))){_0x293289[_0x241f('0x2e')]=qs[_0x241f('0x2e')](_0x286557[_0x241f('0x44')]['limit']);_0x293289[_0x241f('0x2c')]=qs[_0x241f('0x2c')](_0x286557[_0x241f('0x44')][_0x241f('0x2c')]);}_0x293289[_0x241f('0x69')]=qs['sort'](_0x286557['query'][_0x241f('0x4b')]);_0x293289['where']=qs[_0x241f('0x45')](_[_0x241f('0x4c')](_0x286557[_0x241f('0x44')],_0xc5704[_0x241f('0x45')]));_0x293289['where'][_0x241f('0x65')]=_0x5d20ff['id'];if(_0x286557[_0x241f('0x44')][_0x241f('0x4d')]){_0x293289[_0x241f('0x4e')]=_[_0x241f('0x4f')](_0x293289['where'],{'$or':_[_0x241f('0x43')](_0x293289[_0x241f('0x47')],function(_0x1d48be){var _0x87df47={};_0x87df47[_0x1d48be]={'$like':'%'+_0x286557['query'][_0x241f('0x4d')]+'%'};return _0x87df47;})});}_0x293289=_[_0x241f('0x4f')]({},_0x293289,_0x286557[_0x241f('0x51')]);return db['ChatOfflineMessage'][_0x241f('0x2f')]({'where':_0x293289['where']})[_0x241f('0x35')](function(_0x4ed757){_0xe87ca3[_0x241f('0x2f')]=_0x4ed757;if(_0x286557[_0x241f('0x44')][_0x241f('0x52')]){_0x293289[_0x241f('0x53')]=[{'all':!![]}];}else{_0x293289[_0x241f('0x53')]=[{'model':db[_0x241f('0x9c')],'as':_0x241f('0x103'),'required':![]},{'model':db['Attachment'],'as':_0x241f('0x130'),'required':![]}];}return db['ChatOfflineMessage'][_0x241f('0x55')](_0x293289);})['then'](function(_0x1f6c68){_0xe87ca3[_0x241f('0x6a')]=_0x1f6c68;return _0xe87ca3;});}})[_0x241f('0x35')](respondWithFilteredResult(_0x496b2c,_0x293289))['catch'](handleError(_0x496b2c,null));};exports[_0x241f('0x131')]=function(_0x2617da,_0x1cf5d9,_0xef08d1){return db['ChatWebsite'][_0x241f('0x5d')]({'where':{'id':_0x2617da[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x1cf5d9,null))[_0x241f('0x35')](function(_0x166292){if(_0x166292){return _0x166292[_0x241f('0x131')](_0x2617da[_0x241f('0x5a')][_0x241f('0x6c')],_['omit'](_0x2617da['body'],[_0x241f('0x6c'),'id'])||{})[_0x241f('0xbd')](function(_0x38cddb){for(var _0x53482a=0x0;_0x53482a<_0x2617da['body'][_0x241f('0x6c')]['length'];_0x53482a+=0x1){socket[_0x241f('0x132')]('userChatWebsite:save',{'UserId':Number(_0x2617da[_0x241f('0x5a')][_0x241f('0x6c')][_0x53482a]),'ChatWebsiteId':Number(_0x2617da[_0x241f('0x62')]['id'])});}return _0x38cddb;});}})[_0x241f('0x35')](respondWithResult(_0x1cf5d9,null))['catch'](handleError(_0x1cf5d9,null));};exports[_0x241f('0x133')]=function(_0x188750,_0x23c88e,_0x89099f){return db[_0x241f('0x54')][_0x241f('0x5d')]({'where':{'id':_0x188750[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x23c88e,null))[_0x241f('0x35')](function(_0xb557e8){if(_0xb557e8){return _0xb557e8['removeAgents'](_0x188750[_0x241f('0x44')][_0x241f('0x6c')])[_0x241f('0x35')](function(){if(_[_0x241f('0x134')](_0x188750[_0x241f('0x44')][_0x241f('0x6c')])){for(var _0x45ef2e=0x0;_0x45ef2e<_0x188750['query']['ids'][_0x241f('0x58')];_0x45ef2e+=0x1){socket[_0x241f('0x132')](_0x241f('0x135'),{'UserId':Number(_0x188750[_0x241f('0x44')][_0x241f('0x6c')][_0x45ef2e]),'ChatWebsiteId':Number(_0x188750['params']['id'])});}}else{socket[_0x241f('0x132')](_0x241f('0x135'),{'UserId':Number(_0x188750[_0x241f('0x44')][_0x241f('0x6c')]),'ChatWebsiteId':Number(_0x188750[_0x241f('0x62')]['id'])});}});}})[_0x241f('0x35')](respondWithStatusCode(_0x23c88e,null))[_0x241f('0x29')](handleError(_0x23c88e,null));};exports[_0x241f('0x136')]=function(_0x28db6a,_0x4aa358,_0x40ef9a){var _0x487391={};var _0x55782e={};var _0x258c8c;var _0xb247ed;return db['ChatWebsite']['findOne']({'where':{'id':_0x28db6a[_0x241f('0x62')]['id']}})[_0x241f('0x35')](handleEntityNotFound(_0x4aa358,null))['then'](function(_0x541cdc){if(_0x541cdc){_0x258c8c=_0x541cdc;_0x55782e[_0x241f('0x42')]=_[_0x241f('0x57')](db[_0x241f('0xc6')][_0x241f('0x3f')]);_0x55782e[_0x241f('0x44')]=_['keys'](_0x28db6a[_0x241f('0x44')]);_0x55782e[_0x241f('0x45')]=_[_0x241f('0x46')](_0x55782e[_0x241f('0x42')],_0x55782e[_0x241f('0x44')]);_0x487391[_0x241f('0x47')]=_['intersection'](_0x55782e[_0x241f('0x42')],qs[_0x241f('0x48')](_0x28db6a[_0x241f('0x44')][_0x241f('0x48')]));_0x487391[_0x241f('0x47')]=_0x487391[_0x241f('0x47')][_0x241f('0x58')]?_0x487391['attributes']:_0x55782e[_0x241f('0x42')];_0x487391[_0x241f('0x69')]=qs[_0x241f('0x4b')](_0x28db6a[_0x241f('0x44')][_0x241f('0x4b')]);_0x487391[_0x241f('0x4e')]=qs[_0x241f('0x45')](_['pick'](_0x28db6a[_0x241f('0x44')],_0x55782e[_0x241f('0x45')]));if(_0x28db6a['query']['filter']){_0x487391['where']=_[_0x241f('0x4f')](_0x487391['where'],{'$or':_[_0x241f('0x43')](_0x487391[_0x241f('0x47')],function(_0x5a5374){var _0x35ddfe={};_0x35ddfe[_0x5a5374]={'$like':'%'+_0x28db6a[_0x241f('0x44')][_0x241f('0x4d')]+'%'};return _0x35ddfe;})});}_0x487391=_[_0x241f('0x4f')]({},_0x487391,_0x28db6a[_0x241f('0x51')]);return _0x258c8c[_0x241f('0x136')](_0x487391);}})['then'](function(_0x95c028){if(_0x95c028){_0xb247ed=_0x95c028[_0x241f('0x58')];if(!_0x28db6a[_0x241f('0x44')][_0x241f('0x49')](_0x241f('0x4a'))){_0x487391['limit']=qs[_0x241f('0x2e')](_0x28db6a['query'][_0x241f('0x2e')]);_0x487391[_0x241f('0x2c')]=qs['offset'](_0x28db6a[_0x241f('0x44')]['offset']);}return _0x258c8c[_0x241f('0x136')](_0x487391);}})['then'](function(_0x460e58){if(_0x460e58){return _0x460e58?{'count':_0xb247ed,'rows':_0x460e58}:null;}})[_0x241f('0x35')](respondWithResult(_0x4aa358,null))[_0x241f('0x29')](handleError(_0x4aa358,null));}; \ No newline at end of file +var _0x108e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','order','sort','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sitepic','filename','agentAvatar','addCustomerAvatar','customerAvatar','file','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts','DESC','Applications','account','orderBy','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','referer','browser','version','unknown','%s\x20%s','device','format','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','applications','push','unmanaged','ChatMessage','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','server','attachments','basename','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','subjectOffline','mapValues','lastName','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','files','offline-chat','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','chatLicenseExceeded','all','remote','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','color_button','addApplications','transaction','ChatApplication','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','ChatWebsites','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','where','pick','filter','merge','type','options','includeAll','include','ChatWebsite','findAll','rows','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x108e,0xd1));var _0xe108=function(_0x51b1a8,_0xe1e127){_0x51b1a8=_0x51b1a8-0x0;var _0x4379a8=_0x108e[_0x51b1a8];return _0x4379a8;};'use strict';var emlformat=require(_0xe108('0x0'));var rimraf=require(_0xe108('0x1'));var zipdir=require(_0xe108('0x2'));var jsonpatch=require(_0xe108('0x3'));var rp=require(_0xe108('0x4'));var moment=require(_0xe108('0x5'));var BPromise=require(_0xe108('0x6'));var Mustache=require(_0xe108('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe108('0x8'));var csv=require('to-csv');var ejs=require(_0xe108('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe108('0xa'));var squel=require('squel');var crypto=require(_0xe108('0xb'));var jsforce=require(_0xe108('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe108('0xd'));var querystring=require(_0xe108('0xe'));var Papa=require(_0xe108('0xf'));var Redis=require(_0xe108('0x10'));var authService=require(_0xe108('0x11'));var qs=require(_0xe108('0x12'));var as=require(_0xe108('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe108('0x14'));var utils=require(_0xe108('0x15'));var config=require(_0xe108('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe108('0x17'))['db'];config[_0xe108('0x18')]=_[_0xe108('0x19')](config[_0xe108('0x18')],{'host':_0xe108('0x1a'),'port':0x18eb});var socket=require(_0xe108('0x1b'))(new Redis(config[_0xe108('0x18')]));require(_0xe108('0x1c'))[_0xe108('0x1d')](socket);var jayson=require(_0xe108('0x1e'));var client=jayson[_0xe108('0x1f')][_0xe108('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xe108('0x20')]({'port':0x232a});var client9003=jayson[_0xe108('0x1f')][_0xe108('0x20')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x53e7f4,_0x8d15f1,_0x2755c8,_0x520d72){return new BPromise(function(_0x4c6cf3,_0x3619f1){var _0x22a394=_0x520d72||client;return _0x22a394[_0xe108('0x21')](_0x53e7f4,_0x2755c8)[_0xe108('0x22')](function(_0x87143f){logger[_0xe108('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x8d15f1,'request\x20sent');logger['debug'](_0xe108('0x24'),_0x8d15f1,_0xe108('0x25'),JSON[_0xe108('0x26')](_0x87143f));if(_0x87143f[_0xe108('0x27')]){if(_0x87143f[_0xe108('0x27')][_0xe108('0x28')]===0x1f4){logger[_0xe108('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x8d15f1,_0x87143f[_0xe108('0x27')][_0xe108('0x29')]);return _0x3619f1(_0x87143f[_0xe108('0x27')][_0xe108('0x29')]);}logger[_0xe108('0x27')](_0xe108('0x2a'),_0x8d15f1,_0x87143f['error'][_0xe108('0x29')]);return _0x4c6cf3(_0x87143f[_0xe108('0x27')][_0xe108('0x29')]);}else{logger['info'](_0xe108('0x2a'),_0x8d15f1,_0xe108('0x25'));_0x4c6cf3(_0x87143f[_0xe108('0x2b')][_0xe108('0x29')]);}})['catch'](function(_0xc5aab){logger[_0xe108('0x27')](_0xe108('0x2a'),_0x8d15f1,_0xc5aab);_0x3619f1(_0xc5aab);});});}function respondWithStatusCode(_0x4196bb,_0x1d9733){_0x1d9733=_0x1d9733||0xcc;return function(_0x6d63b1){if(_0x6d63b1){return _0x4196bb['sendStatus'](_0x1d9733);}return _0x4196bb[_0xe108('0x2c')](_0x1d9733)['end']();};}function respondWithResult(_0x3a09e6,_0x5262a5){_0x5262a5=_0x5262a5||0xc8;return function(_0x3daa01){if(_0x3daa01){return _0x3a09e6[_0xe108('0x2c')](_0x5262a5)[_0xe108('0x2d')](_0x3daa01);}};}function respondWithFilteredResult(_0x39534f,_0x40524d){return function(_0x3c7c78){if(_0x3c7c78){var _0x5a8384=typeof _0x40524d[_0xe108('0x2e')]===_0xe108('0x2f')&&typeof _0x40524d[_0xe108('0x30')]===_0xe108('0x2f');var _0x5a185c=_0x3c7c78['count'];var _0x230cbd=_0x5a8384?0x0:_0x40524d[_0xe108('0x2e')];var _0x37bdc7=_0x5a8384?_0x3c7c78[_0xe108('0x31')]:_0x40524d[_0xe108('0x2e')]+_0x40524d[_0xe108('0x30')];var _0x5b3eea;if(_0x37bdc7>=_0x5a185c){_0x37bdc7=_0x5a185c;_0x5b3eea=0xc8;}else{_0x5b3eea=0xce;}_0x39534f['status'](_0x5b3eea);return _0x39534f[_0xe108('0x32')]('Content-Range',_0x230cbd+'-'+_0x37bdc7+'/'+_0x5a185c)[_0xe108('0x2d')](_0x3c7c78);}return null;};}function patchUpdates(_0x4584f1){return function(_0x1b3357){try{jsonpatch[_0xe108('0x33')](_0x1b3357,_0x4584f1,!![]);}catch(_0x3f3894){return BPromise[_0xe108('0x34')](_0x3f3894);}return _0x1b3357[_0xe108('0x35')]();};}function saveUpdates(_0x349ca1,_0x4d3b01){return function(_0x5afbad){if(_0x5afbad){return _0x5afbad['update'](_0x349ca1)[_0xe108('0x22')](function(_0xbd688){return _0xbd688;});}return null;};}function removeEntity(_0x570424,_0x6bd226){return function(_0x3c6cf7){if(_0x3c6cf7){return _0x3c6cf7[_0xe108('0x36')]()[_0xe108('0x22')](function(){var _0x4d86f3=_0x3c6cf7[_0xe108('0x37')]({'plain':!![]});var _0x3c73c9=_0xe108('0x38');return db['UserProfileResource'][_0xe108('0x36')]({'where':{'type':_0x3c73c9,'resourceId':_0x4d86f3['id']}})[_0xe108('0x22')](function(){return _0x3c6cf7;});})['then'](function(){_0x570424[_0xe108('0x2c')](0xcc)[_0xe108('0x39')]();});}};}function handleEntityNotFound(_0x2807b1,_0x269223){return function(_0x1d5405){if(!_0x1d5405){_0x2807b1[_0xe108('0x3a')](0x194);}return _0x1d5405;};}function handleError(_0x3cf3b4,_0xe68bc1){_0xe68bc1=_0xe68bc1||0x1f4;return function(_0x2d534b){logger[_0xe108('0x27')](_0x2d534b[_0xe108('0x3b')]);if(_0x2d534b[_0xe108('0x3c')]){delete _0x2d534b[_0xe108('0x3c')];}_0x3cf3b4[_0xe108('0x2c')](_0xe68bc1)[_0xe108('0x3d')](_0x2d534b);};}exports[_0xe108('0x3e')]=function(_0x2e6c13,_0x3c1810){var _0x458102={'include':[{'model':db[_0xe108('0x3f')],'as':_0xe108('0x40')}]},_0x52e88c={},_0x5b651c={'count':0x0,'rows':[]};var _0x29127e=_[_0xe108('0x41')](db['ChatWebsite'][_0xe108('0x42')],function(_0x1460c9){return{'name':_0x1460c9[_0xe108('0x43')],'type':_0x1460c9['type'][_0xe108('0x44')]};});_0x52e88c[_0xe108('0x45')]=_[_0xe108('0x41')](_0x29127e,'name');_0x52e88c['query']=_[_0xe108('0x46')](_0x2e6c13['query']);_0x52e88c[_0xe108('0x47')]=_[_0xe108('0x48')](_0x52e88c[_0xe108('0x45')],_0x52e88c[_0xe108('0x49')]);_0x458102[_0xe108('0x4a')]=_[_0xe108('0x48')](_0x52e88c[_0xe108('0x45')],qs[_0xe108('0x4b')](_0x2e6c13['query'][_0xe108('0x4b')]));_0x458102[_0xe108('0x4a')]=_0x458102[_0xe108('0x4a')]['length']?_0x458102['attributes']:_0x52e88c['model'];if(!_0x2e6c13[_0xe108('0x49')]['hasOwnProperty']('nolimit')){_0x458102[_0xe108('0x30')]=qs['limit'](_0x2e6c13[_0xe108('0x49')][_0xe108('0x30')]);_0x458102[_0xe108('0x2e')]=qs['offset'](_0x2e6c13[_0xe108('0x49')][_0xe108('0x2e')]);}_0x458102['order']=qs['sort'](_0x2e6c13['query']['sort']);_0x458102[_0xe108('0x4c')]=qs[_0xe108('0x47')](_[_0xe108('0x4d')](_0x2e6c13[_0xe108('0x49')],_0x52e88c[_0xe108('0x47')]),_0x29127e);if(_0x2e6c13['query'][_0xe108('0x4e')]){_0x458102['where']=_[_0xe108('0x4f')](_0x458102[_0xe108('0x4c')],{'$or':_[_0xe108('0x41')](_0x29127e,function(_0x1b3a0c){if(_0x1b3a0c[_0xe108('0x50')]!=='VIRTUAL'){var _0x21871e={};_0x21871e[_0x1b3a0c[_0xe108('0x3c')]]={'$like':'%'+_0x2e6c13[_0xe108('0x49')][_0xe108('0x4e')]+'%'};return _0x21871e;}})});}_0x458102=_[_0xe108('0x4f')]({},_0x458102,_0x2e6c13[_0xe108('0x51')]);var _0x595efb={'where':_0x458102[_0xe108('0x4c')]};return db['ChatWebsite'][_0xe108('0x31')](_0x595efb)[_0xe108('0x22')](function(_0x1b5602){_0x5b651c[_0xe108('0x31')]=_0x1b5602;if(_0x2e6c13[_0xe108('0x49')][_0xe108('0x52')]){_0x458102[_0xe108('0x53')]=[{'all':!![]}];}return db[_0xe108('0x54')][_0xe108('0x55')](_0x458102);})[_0xe108('0x22')](function(_0x60c4e9){_0x5b651c[_0xe108('0x56')]=_0x60c4e9;return _0x5b651c;})[_0xe108('0x22')](respondWithFilteredResult(_0x3c1810,_0x458102))[_0xe108('0x57')](handleError(_0x3c1810,null));};exports['show']=function(_0x1fcd2a,_0x15ec3d){var _0x33ce82={'raw':![],'where':{'id':_0x1fcd2a['params']['id']},'include':[{'model':db[_0xe108('0x3f')],'as':'mandatoryDispositionPause'}]},_0x457638={};_0x457638[_0xe108('0x45')]=_[_0xe108('0x46')](db['ChatWebsite'][_0xe108('0x42')]);_0x457638['query']=_[_0xe108('0x46')](_0x1fcd2a[_0xe108('0x49')]);_0x457638[_0xe108('0x47')]=_[_0xe108('0x48')](_0x457638[_0xe108('0x45')],_0x457638[_0xe108('0x49')]);_0x33ce82[_0xe108('0x4a')]=_[_0xe108('0x48')](_0x457638[_0xe108('0x45')],qs[_0xe108('0x4b')](_0x1fcd2a['query']['fields']));_0x33ce82[_0xe108('0x4a')]=_0x33ce82['attributes'][_0xe108('0x58')]?_0x33ce82[_0xe108('0x4a')]:_0x457638[_0xe108('0x45')];if(_0x1fcd2a[_0xe108('0x49')]['includeAll']){_0x33ce82[_0xe108('0x53')]=[{'all':!![]}];}_0x33ce82=_[_0xe108('0x4f')]({},_0x33ce82,_0x1fcd2a[_0xe108('0x51')]);return db[_0xe108('0x54')][_0xe108('0x59')](_0x33ce82)['then'](handleEntityNotFound(_0x15ec3d,null))[_0xe108('0x22')](respondWithResult(_0x15ec3d,null))[_0xe108('0x57')](handleError(_0x15ec3d,null));};exports[_0xe108('0x5a')]=function(_0x42f640,_0x393bfa){return db[_0xe108('0x54')][_0xe108('0x5a')](_0x42f640['body'],{})['then'](function(_0x34a681){var _0x4264a1=_0x42f640[_0xe108('0x5b')]['get']({'plain':!![]});if(!_0x4264a1)throw new Error(_0xe108('0x5c'));if(_0x4264a1['role']===_0xe108('0x5b')){var _0x25215d=_0x34a681[_0xe108('0x37')]({'plain':!![]});var _0x5a2b7e=_0xe108('0x38');return db[_0xe108('0x5d')][_0xe108('0x59')]({'where':{'name':_0x5a2b7e,'userProfileId':_0x4264a1['userProfileId']},'raw':!![]})[_0xe108('0x22')](function(_0x165630){if(_0x165630&&_0x165630[_0xe108('0x5e')]===0x0){return db['UserProfileResource'][_0xe108('0x5a')]({'name':_0x25215d[_0xe108('0x3c')],'resourceId':_0x25215d['id'],'type':_0x165630[_0xe108('0x3c')],'sectionId':_0x165630['id']},{})['then'](function(){return _0x34a681;});}else{return _0x34a681;}})[_0xe108('0x57')](function(_0x468a5d){logger[_0xe108('0x27')](_0xe108('0x5f'),_0x468a5d);throw _0x468a5d;});}return _0x34a681;})['then'](respondWithResult(_0x393bfa,0xc9))[_0xe108('0x57')](handleError(_0x393bfa,null));};exports[_0xe108('0x60')]=function(_0x8b5975,_0x590e63){if(_0x8b5975[_0xe108('0x61')]['id']){delete _0x8b5975[_0xe108('0x61')]['id'];}return db['ChatWebsite'][_0xe108('0x59')]({'where':{'id':_0x8b5975[_0xe108('0x62')]['id']},'include':[{'model':db[_0xe108('0x3f')],'as':_0xe108('0x40')}]})[_0xe108('0x22')](handleEntityNotFound(_0x590e63,null))[_0xe108('0x22')](saveUpdates(_0x8b5975[_0xe108('0x61')],null))[_0xe108('0x22')](respondWithResult(_0x590e63,null))[_0xe108('0x57')](handleError(_0x590e63,null));};exports['destroy']=function(_0x2b2778,_0x128d81){return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x2b2778[_0xe108('0x62')]['id']}})['then'](handleEntityNotFound(_0x128d81,null))[_0xe108('0x22')](removeEntity(_0x128d81,null))[_0xe108('0x57')](handleError(_0x128d81,null));};exports[_0xe108('0x63')]=function(_0x2c127f,_0x23c138){return db[_0xe108('0x54')]['describe']()[_0xe108('0x22')](respondWithResult(_0x23c138,null))[_0xe108('0x57')](handleError(_0x23c138,null));};exports[_0xe108('0x64')]=function(_0x2a8b92,_0xcf09d,_0x557686){if(_0x2a8b92[_0xe108('0x61')]['id']){delete _0x2a8b92[_0xe108('0x61')]['id'];}return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x2a8b92[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0xcf09d,null))[_0xe108('0x22')](function(_0x3c4fd3){if(_0x3c4fd3){_0x2a8b92[_0xe108('0x61')][_0xe108('0x65')]=_0x3c4fd3['id'];return db[_0xe108('0x66')][_0xe108('0x5a')](_0x2a8b92[_0xe108('0x61')]);}})['then'](respondWithResult(_0xcf09d,null))[_0xe108('0x57')](handleError(_0xcf09d,null));};exports[_0xe108('0x67')]=function(_0x233579,_0x2e6615,_0x3a549a){var _0x3a55b9={'raw':![],'where':{}};var _0x1caca6={};var _0x26d40e={'count':0x0,'rows':[]};return db[_0xe108('0x54')][_0xe108('0x68')]({'where':{'id':_0x233579[_0xe108('0x62')]['id']}})['then'](handleEntityNotFound(_0x2e6615,null))[_0xe108('0x22')](function(_0x5d4bd6){if(_0x5d4bd6){_0x1caca6[_0xe108('0x45')]=_['keys'](db[_0xe108('0x66')]['rawAttributes']);_0x1caca6[_0xe108('0x49')]=_[_0xe108('0x46')](_0x233579[_0xe108('0x49')]);_0x1caca6[_0xe108('0x47')]=_[_0xe108('0x48')](_0x1caca6['model'],_0x1caca6[_0xe108('0x49')]);_0x3a55b9[_0xe108('0x4a')]=_[_0xe108('0x48')](_0x1caca6[_0xe108('0x45')],qs['fields'](_0x233579[_0xe108('0x49')][_0xe108('0x4b')]));_0x3a55b9['attributes']=_0x3a55b9[_0xe108('0x4a')][_0xe108('0x58')]?_0x3a55b9['attributes']:_0x1caca6['model'];if(!_0x233579[_0xe108('0x49')][_0xe108('0x69')](_0xe108('0x6a'))){_0x3a55b9['limit']=qs[_0xe108('0x30')](_0x233579[_0xe108('0x49')][_0xe108('0x30')]);_0x3a55b9['offset']=qs['offset'](_0x233579[_0xe108('0x49')]['offset']);}_0x3a55b9[_0xe108('0x6b')]=qs['sort'](_0x233579[_0xe108('0x49')][_0xe108('0x6c')]);_0x3a55b9['where']=qs['filters'](_[_0xe108('0x4d')](_0x233579['query'],_0x1caca6[_0xe108('0x47')]));_0x3a55b9[_0xe108('0x4c')][_0xe108('0x65')]=_0x5d4bd6['id'];if(_0x233579[_0xe108('0x49')][_0xe108('0x4e')]){_0x3a55b9[_0xe108('0x4c')]=_[_0xe108('0x4f')](_0x3a55b9['where'],{'$or':_[_0xe108('0x41')](_0x3a55b9[_0xe108('0x4a')],function(_0x5024e9){var _0x5bb5f2={};_0x5bb5f2[_0x5024e9]={'$like':'%'+_0x233579[_0xe108('0x49')]['filter']+'%'};return _0x5bb5f2;})});}_0x3a55b9=_[_0xe108('0x4f')]({},_0x3a55b9,_0x233579[_0xe108('0x51')]);return db[_0xe108('0x66')]['count']({'where':_0x3a55b9[_0xe108('0x4c')]})[_0xe108('0x22')](function(_0x472489){_0x26d40e['count']=_0x472489;if(_0x233579[_0xe108('0x49')][_0xe108('0x52')]){_0x3a55b9['include']=[{'all':!![]}];}return db['Disposition'][_0xe108('0x55')](_0x3a55b9);})['then'](function(_0x2a0102){_0x26d40e['rows']=_0x2a0102;return _0x26d40e;});}})[_0xe108('0x22')](respondWithFilteredResult(_0x2e6615,_0x3a55b9))[_0xe108('0x57')](handleError(_0x2e6615,null));};exports[_0xe108('0x6d')]=function(_0x159941,_0x518c49,_0x4c410c){return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x159941['params']['id']}})['then'](handleEntityNotFound(_0x518c49,null))['then'](function(_0x279b66){if(_0x279b66){return _0x279b66[_0xe108('0x6d')](_0x159941[_0xe108('0x49')][_0xe108('0x6e')]);}})[_0xe108('0x22')](respondWithStatusCode(_0x518c49,null))[_0xe108('0x57')](handleError(_0x518c49,null));};exports[_0xe108('0x6f')]=function(_0x5d42be,_0x1fc90a,_0x564461){if(_0x5d42be[_0xe108('0x61')]['id']){delete _0x5d42be['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5d42be['params']['id']}})['then'](handleEntityNotFound(_0x1fc90a,null))['then'](function(_0x263b80){if(_0x263b80){_0x5d42be[_0xe108('0x61')]['ChatWebsiteId']=_0x263b80['id'];return db[_0xe108('0x70')][_0xe108('0x5a')](_0x5d42be[_0xe108('0x61')]);}})[_0xe108('0x22')](respondWithResult(_0x1fc90a,null))[_0xe108('0x57')](handleError(_0x1fc90a,null));};exports['getAnswers']=function(_0x4a5fe8,_0x26a4f7,_0x5dc8ad){var _0x452557={'raw':![],'where':{}};var _0x2ae9bc={};var _0x482bbd={'count':0x0,'rows':[]};return db[_0xe108('0x54')][_0xe108('0x68')]({'where':{'id':_0x4a5fe8[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x26a4f7,null))[_0xe108('0x22')](function(_0x1ab958){if(_0x1ab958){_0x2ae9bc['model']=_['keys'](db['CannedAnswer'][_0xe108('0x42')]);_0x2ae9bc[_0xe108('0x49')]=_[_0xe108('0x46')](_0x4a5fe8[_0xe108('0x49')]);_0x2ae9bc['filters']=_[_0xe108('0x48')](_0x2ae9bc['model'],_0x2ae9bc[_0xe108('0x49')]);_0x452557['attributes']=_[_0xe108('0x48')](_0x2ae9bc[_0xe108('0x45')],qs[_0xe108('0x4b')](_0x4a5fe8['query'][_0xe108('0x4b')]));_0x452557[_0xe108('0x4a')]=_0x452557[_0xe108('0x4a')][_0xe108('0x58')]?_0x452557[_0xe108('0x4a')]:_0x2ae9bc[_0xe108('0x45')];if(!_0x4a5fe8[_0xe108('0x49')]['hasOwnProperty'](_0xe108('0x6a'))){_0x452557['limit']=qs['limit'](_0x4a5fe8[_0xe108('0x49')][_0xe108('0x30')]);_0x452557['offset']=qs[_0xe108('0x2e')](_0x4a5fe8[_0xe108('0x49')][_0xe108('0x2e')]);}_0x452557[_0xe108('0x6b')]=qs['sort'](_0x4a5fe8[_0xe108('0x49')][_0xe108('0x6c')]);_0x452557[_0xe108('0x4c')]=qs[_0xe108('0x47')](_['pick'](_0x4a5fe8[_0xe108('0x49')],_0x2ae9bc[_0xe108('0x47')]));_0x452557[_0xe108('0x4c')]['ChatWebsiteId']=_0x1ab958['id'];if(_0x4a5fe8['query'][_0xe108('0x4e')]){_0x452557[_0xe108('0x4c')]=_[_0xe108('0x4f')](_0x452557[_0xe108('0x4c')],{'$or':_[_0xe108('0x41')](_0x452557[_0xe108('0x4a')],function(_0x4e78e9){var _0xe7c143={};_0xe7c143[_0x4e78e9]={'$like':'%'+_0x4a5fe8[_0xe108('0x49')][_0xe108('0x4e')]+'%'};return _0xe7c143;})});}_0x452557=_[_0xe108('0x4f')]({},_0x452557,_0x4a5fe8[_0xe108('0x51')]);return db[_0xe108('0x70')]['count']({'where':_0x452557[_0xe108('0x4c')]})[_0xe108('0x22')](function(_0x5776b3){_0x482bbd[_0xe108('0x31')]=_0x5776b3;if(_0x4a5fe8[_0xe108('0x49')][_0xe108('0x52')]){_0x452557[_0xe108('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe108('0x55')](_0x452557);})[_0xe108('0x22')](function(_0x55005b){_0x482bbd[_0xe108('0x56')]=_0x55005b;return _0x482bbd;});}})[_0xe108('0x22')](respondWithFilteredResult(_0x26a4f7,_0x452557))[_0xe108('0x57')](handleError(_0x26a4f7,null));};exports[_0xe108('0x71')]=function(_0x36e1fd,_0x25c2d7,_0x547aa8){return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x36e1fd['params']['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x25c2d7,null))['then'](function(_0x8fdaa6){if(_0x8fdaa6){return _0x8fdaa6[_0xe108('0x71')](_0x36e1fd[_0xe108('0x49')][_0xe108('0x6e')]);}})[_0xe108('0x22')](respondWithStatusCode(_0x25c2d7,null))['catch'](handleError(_0x25c2d7,null));};exports['addLogo']=function(_0x3383e1,_0xbc1ff4,_0x2947da){_0x3383e1[_0xe108('0x61')][_0xe108('0x72')]=_0x3383e1['file'][_0xe108('0x73')];return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x3383e1[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0xbc1ff4,null))[_0xe108('0x22')](saveUpdates(_0x3383e1[_0xe108('0x61')],null))[_0xe108('0x22')](respondWithResult(_0xbc1ff4,null))['catch'](handleError(_0xbc1ff4,null));};exports['addAvatar']=function(_0x406bd7,_0x3dee8e,_0x27f2cc){_0x406bd7[_0xe108('0x61')][_0xe108('0x74')]=_0x406bd7['file']['filename'];return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x406bd7['params']['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x3dee8e,null))[_0xe108('0x22')](saveUpdates(_0x406bd7['body'],null))[_0xe108('0x22')](respondWithResult(_0x3dee8e,null))['catch'](handleError(_0x3dee8e,null));};exports[_0xe108('0x75')]=function(_0x217569,_0x46932d,_0x5428dc){_0x217569[_0xe108('0x61')][_0xe108('0x76')]=_0x217569[_0xe108('0x77')]['filename'];return db[_0xe108('0x54')]['find']({'where':{'id':_0x217569[_0xe108('0x62')]['id']}})['then'](handleEntityNotFound(_0x46932d,null))[_0xe108('0x22')](saveUpdates(_0x217569[_0xe108('0x61')],null))['then'](respondWithResult(_0x46932d,null))[_0xe108('0x57')](handleError(_0x46932d,null));};exports['addSystemAvatar']=function(_0x31f23c,_0x319011,_0x314cac){_0x31f23c[_0xe108('0x61')][_0xe108('0x78')]=_0x31f23c[_0xe108('0x77')]['filename'];return db[_0xe108('0x54')]['find']({'where':{'id':_0x31f23c[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x319011,null))[_0xe108('0x22')](saveUpdates(_0x31f23c['body'],null))[_0xe108('0x22')](respondWithResult(_0x319011,null))['catch'](handleError(_0x319011,null));};exports[_0xe108('0x79')]=function(_0x17b933,_0x220b03,_0x96344b){var _0x45797e=path[_0xe108('0x7a')](config[_0xe108('0x7b')],_0xe108('0x7c'));var _0x36c86f={'where':{'id':_0x17b933[_0xe108('0x62')]['id']},'attributes':['id',_0xe108('0x72')],'raw':!![]};var _0x4fe5a8=![];return require('../../config/license/util')[_0xe108('0x7d')]()[_0xe108('0x22')](function(_0x67f951){if(_0x67f951){_0x4fe5a8=_0x67f951[_0xe108('0x7e')];}})[_0xe108('0x22')](function(){return db[_0xe108('0x54')][_0xe108('0x59')](_0x36c86f);})[_0xe108('0x22')](handleEntityNotFound(_0x220b03,null))[_0xe108('0x22')](function(_0x4b4d95){if(_0x4b4d95){if(!_[_0xe108('0x7f')](_0x4b4d95['sitepic'])){if(fs[_0xe108('0x80')](path['join'](config[_0xe108('0x7b')],_0xe108('0x81'),_0x4b4d95[_0xe108('0x72')]))&&_0x4fe5a8){_0x45797e=path[_0xe108('0x7a')](config[_0xe108('0x7b')],'server/files/images/logos/',_0x4b4d95[_0xe108('0x72')]);}}return _0x220b03[_0xe108('0x82')](_0x45797e);}})['catch'](handleError(_0x220b03,null));};exports[_0xe108('0x83')]=function(_0xc1275f,_0x3efc2f,_0x1fb2cc){var _0x4f5d6c=path[_0xe108('0x7a')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x4d6f62={'where':{'id':_0xc1275f['params']['id']},'attributes':['id',_0xe108('0x74')],'raw':!![]};return db[_0xe108('0x54')][_0xe108('0x59')](_0x4d6f62)[_0xe108('0x22')](handleEntityNotFound(_0x3efc2f,null))[_0xe108('0x22')](function(_0x25f339){if(_0x25f339){if(!_[_0xe108('0x7f')](_0x25f339[_0xe108('0x74')])){if(fs[_0xe108('0x80')](path['join'](config['root'],_0xe108('0x84'),_0x25f339[_0xe108('0x74')]))){_0x4f5d6c=path['join'](config[_0xe108('0x7b')],_0xe108('0x84'),_0x25f339['agentAvatar']);}}return _0x3efc2f[_0xe108('0x82')](_0x4f5d6c);}})[_0xe108('0x57')](handleError(_0x3efc2f,null));};exports[_0xe108('0x85')]=function(_0x3dc8ca,_0x5d637a,_0x6a8bc){var _0x31b1e7=path['join'](config[_0xe108('0x7b')],_0xe108('0x86'));var _0x28fc0a={'where':{'id':_0x3dc8ca[_0xe108('0x62')]['id']},'attributes':['id',_0xe108('0x76'),'showCustomerAvatar'],'raw':!![]};return db[_0xe108('0x54')][_0xe108('0x59')](_0x28fc0a)[_0xe108('0x22')](handleEntityNotFound(_0x5d637a,null))[_0xe108('0x22')](function(_0x5ccef4){if(_0x5ccef4){if(!_[_0xe108('0x7f')](_0x5ccef4[_0xe108('0x76')])){if(fs['existsSync'](path[_0xe108('0x7a')](config[_0xe108('0x7b')],'server/files/images/avatars/',_0x5ccef4['customerAvatar']))&&_0x5ccef4[_0xe108('0x87')]){_0x31b1e7=path['join'](config[_0xe108('0x7b')],'server/files/images/avatars/',_0x5ccef4[_0xe108('0x76')]);}}return _0x5d637a[_0xe108('0x82')](_0x31b1e7);}})[_0xe108('0x57')](handleError(_0x5d637a,null));};exports[_0xe108('0x88')]=function(_0xa4352a,_0x4099c3,_0x542de5){var _0x311292=path['join'](config[_0xe108('0x7b')],_0xe108('0x89'));var _0x3ec869={'where':{'id':_0xa4352a[_0xe108('0x62')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe108('0x54')][_0xe108('0x59')](_0x3ec869)[_0xe108('0x22')](handleEntityNotFound(_0x4099c3,null))['then'](function(_0x567357){if(_0x567357){if(!_[_0xe108('0x7f')](_0x567357[_0xe108('0x78')])){if(fs[_0xe108('0x80')](path['join'](config[_0xe108('0x7b')],_0xe108('0x84'),_0x567357[_0xe108('0x78')]))){_0x311292=path[_0xe108('0x7a')](config['root'],_0xe108('0x84'),_0x567357[_0xe108('0x78')]);}}return _0x4099c3[_0xe108('0x82')](_0x311292);}})['catch'](handleError(_0x4099c3,null));};exports[_0xe108('0x8a')]=function(_0x3e22f9,_0x10809e,_0x185378){var _0x24d112=require(_0xe108('0x8b'));var _0x1ff3da=new _0x24d112();var _0x23ec1b=_0x1ff3da[_0xe108('0x8c')](_0x3e22f9[_0xe108('0x8d')][_0xe108('0x8e')])[_0xe108('0x8f')]();var _0x21ebd8={'body':_0x3e22f9[_0xe108('0x61')],'channel':_0xe108('0x90')};var _0x280d89=[];var _0x400b47=[];var _0x2c62d7={};var _0x49ddac=![];return db[_0xe108('0x91')][_0xe108('0x63')]()[_0xe108('0x22')](function(_0x4b28a0){if(!_0x4b28a0){throw new db[(_0xe108('0x92'))][(_0xe108('0x93'))]('no\x20available\x20attributes');}_0x280d89=_[_0xe108('0x94')](_['keys'](_0x4b28a0),[_0xe108('0x95'),_0xe108('0x96')]);_0x400b47=_['difference'](_['keys'](_0x4b28a0),[_0xe108('0x95'),_0xe108('0x96'),_0xe108('0x97'),'ListId']);if(_0x3e22f9[_0xe108('0x61')]['id']){delete _0x3e22f9[_0xe108('0x61')]['id'];}if(_[_0xe108('0x7f')](_0x3e22f9['body'][_0xe108('0x98')])){throw new db[(_0xe108('0x92'))]['ValidationError'](_0xe108('0x99'));}if(_['isNil'](_0x3e22f9[_0xe108('0x61')][_0xe108('0x61')])||_0x3e22f9['body'][_0xe108('0x61')]===''){throw new db['Sequelize'][(_0xe108('0x93'))](_0xe108('0x9a'));}if(_['isNil'](_0x3e22f9[_0xe108('0x61')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xe108('0x9b')+_0x400b47);}if(!_[_0xe108('0x9c')](_0x400b47,_0x3e22f9[_0xe108('0x61')]['mapKey'])){throw new db['Sequelize'][(_0xe108('0x93'))](_0xe108('0x9d')+_0x400b47);}_0x2c62d7[_0x3e22f9[_0xe108('0x61')][_0xe108('0x9e')]]=_0x3e22f9[_0xe108('0x61')]['from'];})[_0xe108('0x22')](function(){return db[_0xe108('0x54')]['find']({'where':{'id':_0x3e22f9[_0xe108('0x62')]['id']},'include':[{'model':db[_0xe108('0x9f')],'as':_0xe108('0xa0'),'include':[{'model':db[_0xe108('0x91')],'as':_0xe108('0xa1'),'where':_0x2c62d7,'limit':0x1,'order':[[_0xe108('0x96'),_0xe108('0xa2')]]}]},{'model':db['ChatApplication'],'as':_0xe108('0xa3')}]});})[_0xe108('0x22')](handleEntityNotFound(_0x10809e,null))[_0xe108('0x22')](function(_0x44975f){if(_0x44975f&&_0x44975f[_0xe108('0xa0')]){_0x21ebd8[_0xe108('0xa4')]=_0x44975f;_0x21ebd8['applications']=_0x44975f[_0xe108('0xa3')];_0x21ebd8['list']=_0x44975f['List'];_0x21ebd8['applications']=_[_0xe108('0xa5')](_0x21ebd8['applications'],['priority'],[_0xe108('0xa6')]);if(_0x21ebd8[_0xe108('0xa4')][_0xe108('0xa3')]){delete _0x21ebd8[_0xe108('0xa4')]['Applications'];}if(_0x21ebd8[_0xe108('0xa4')][_0xe108('0xa0')]&&_0x21ebd8[_0xe108('0xa4')][_0xe108('0xa0')][_0xe108('0xa1')][_0xe108('0x58')]){return _0x21ebd8[_0xe108('0xa4')][_0xe108('0xa0')][_0xe108('0xa1')][0x0];}var _0x5a9725=_[_0xe108('0x19')](_0x3e22f9[_0xe108('0x61')],{'firstName':_0x3e22f9[_0xe108('0x61')][_0xe108('0x98')],'ListId':_0x44975f['ListId']});_0x5a9725[_0x3e22f9[_0xe108('0x61')]['mapKey']]=_0x3e22f9[_0xe108('0x61')][_0xe108('0x98')];return db['CmContact']['create'](_0x5a9725,{'fields':_0x280d89,'raw':!![]});}})[_0xe108('0x22')](handleEntityNotFound(_0x10809e,null))['then'](function(_0xc7d5f3){_0x21ebd8[_0xe108('0xa7')]=_0xc7d5f3;var _0x3470c6=_0x3e22f9[_0xe108('0x61')][_0xe108('0xa8')];if(_0x3e22f9['headers'][_0xe108('0xa9')]){_0x3470c6=_0x3e22f9[_0xe108('0x8d')][_0xe108('0xa9')];}else if(_0x3e22f9[_0xe108('0x8d')][_0xe108('0xaa')]){_0x3470c6=_[_0xe108('0xab')](_0x3e22f9[_0xe108('0x8d')]['x-forwarded-for'][_0xe108('0xac')](','));}if(_0xc7d5f3){var _0x13619e={'ContactId':_0xc7d5f3['id'],'ChatWebsiteId':_0x3e22f9['params']['id'],'from':(_0xc7d5f3[_0xe108('0xad')]||'')+'\x20'+(_0xc7d5f3['lastName']||''),'customerIp':_0x3470c6,'customerPort':_0x3e22f9[_0xe108('0x8d')]['x-real-port']?_0x3e22f9['headers']['x-real-port']:null,'referer':_0x3e22f9[_0xe108('0x61')][_0xe108('0xae')],'browserName':_0x23ec1b[_0xe108('0xaf')][_0xe108('0x3c')]&&_0x23ec1b[_0xe108('0xaf')][_0xe108('0xb0')]?util['format']('%s\x20%s',_0x23ec1b['browser']['name'],_0x23ec1b[_0xe108('0xaf')][_0xe108('0xb0')]):_0xe108('0xb1'),'browserVersion':_0x23ec1b[_0xe108('0xaf')][_0xe108('0xb0')]||'unknown','osName':util['format'](_0xe108('0xb2'),_0x23ec1b['os'][_0xe108('0x3c')],_0x23ec1b['os'][_0xe108('0xb0')]),'osVersion':_0x23ec1b['os']['version'],'deviceModel':_0x23ec1b['device']['model']&&_0x23ec1b[_0xe108('0xb3')]['vendor']?util[_0xe108('0xb4')]('%s\x20%s\x20%s',_0x23ec1b[_0xe108('0xb3')][_0xe108('0x45')],_0x23ec1b[_0xe108('0xb3')]['vendor'],_0x23ec1b[_0xe108('0xb3')]['type']):null,'deviceVendor':_0x23ec1b[_0xe108('0xb3')][_0xe108('0xb5')],'deviceType':_0x23ec1b[_0xe108('0xb3')][_0xe108('0x50')],'formData':JSON[_0xe108('0x26')](_0x3e22f9[_0xe108('0x61')])};var _0x2e411c={'ChatWebsiteId':_0x3e22f9['params']['id'],'closed':![]};if(_0x3e22f9[_0xe108('0x61')][_0xe108('0xb6')]){_0x2e411c[_0xe108('0xb6')]=_0x3e22f9[_0xe108('0x61')][_0xe108('0xb6')];return db[_0xe108('0xb7')]['find']({'where':_0x2e411c})[_0xe108('0x22')](function(_0x1b303b){if(_0x1b303b){return[_0x1b303b,![]];}_0x13619e[_0xe108('0xb6')]=_0x3e22f9[_0xe108('0x61')][_0xe108('0xb6')];_0x13619e[_0xe108('0xb8')]=_0x3e22f9[_0xe108('0x61')][_0xe108('0xb8')];return db[_0xe108('0xb7')][_0xe108('0x5a')](_0x13619e)[_0xe108('0x22')](function(_0x4b1539){return[_0x4b1539,!![]];});});}_0x2e411c[_0xe108('0xb9')]=_0xc7d5f3['id'];if(_0x3e22f9[_0xe108('0x61')][_0xe108('0xba')]&&_0x3e22f9[_0xe108('0x61')][_0xe108('0xba')]['id']){_0x2e411c['id']=_0x3e22f9[_0xe108('0x61')][_0xe108('0xba')]['id'];return db['ChatInteraction'][_0xe108('0x59')]({'where':_0x2e411c})['then'](function(_0x157358){if(_0x157358){return[_0x157358,![]];}return db[_0xe108('0xb7')][_0xe108('0x5a')](_0x13619e)[_0xe108('0x22')](function(_0x13f943){return[_0x13f943,!![]];});});}return db[_0xe108('0xb7')][_0xe108('0x5a')](_0x13619e)[_0xe108('0x22')](function(_0x6aa08a){return[_0x6aa08a,!![]];});}})[_0xe108('0xbb')](function(_0x1cb3a3,_0x469c5f){if(_0x1cb3a3){_0x49ddac=_0x469c5f;if(!_0x469c5f){var _0x8aa8e6={'from':(_0x21ebd8[_0xe108('0xa7')]['firstName']||'')+'\x20'+(_0x21ebd8['contact']['lastName']||'')};if(_0x3e22f9[_0xe108('0x61')][_0xe108('0xb6')]&&_0x3e22f9['body'][_0xe108('0xbc')]&&_0x3e22f9['body'][_0xe108('0xb6')]!=_0x3e22f9['body'][_0xe108('0xbc')]){_0x8aa8e6[_0xe108('0xb6')]=_0x3e22f9[_0xe108('0x61')][_0xe108('0xbc')];}return _0x1cb3a3['update'](_0x8aa8e6);}else{return _0x1cb3a3;}}})[_0xe108('0x22')](function(_0x5c26ee){_0x21ebd8[_0xe108('0xba')]=_0x5c26ee['get']({'plain':!![]});_0x21ebd8['interaction'][_0xe108('0xbd')]=_0x49ddac;if(_0x21ebd8[_0xe108('0xba')][_0xe108('0xbd')]){if(_0x21ebd8[_0xe108('0xa4')][_0xe108('0xbe')]){_0x21ebd8[_0xe108('0xbf')][_0xe108('0xc0')]({'id':0x0,'priority':_0x21ebd8[_0xe108('0xbf')][_0xe108('0x58')]+0x1,'app':'close','appdata':_0xe108('0xc1'),'interval':'*,*,*,*'});}}return db[_0xe108('0xc2')][_0xe108('0x5a')]({'body':_0x3e22f9['body'][_0xe108('0x61')],'ChatWebsiteId':_0x3e22f9[_0xe108('0x62')]['id'],'ChatInteractionId':_0x5c26ee['id'],'direction':'in','ContactId':_0x21ebd8[_0xe108('0xa7')]['id'],'AttachmentId':_0x3e22f9[_0xe108('0x61')]['AttachmentId']});})[_0xe108('0x22')](function(_0x556dbe){_0x21ebd8[_0xe108('0x29')]=_0x556dbe;if(_0x21ebd8['interaction']['UserId']){return db[_0xe108('0xc3')][_0xe108('0x59')]({'attributes':['id',_0xe108('0x3c')],'where':{'id':_0x21ebd8[_0xe108('0xba')]['UserId']}})['then'](function(_0x38b230){if(_0x38b230){_0x21ebd8[_0xe108('0xbf')][_0xe108('0xc4')]({'id':0x0,'priority':0x0,'app':_0xe108('0xc5'),'appdata':_0x38b230[_0xe108('0x3c')]+','+(_0x21ebd8[_0xe108('0xa4')]['waitForTheAssignedAgent']||0xa),'interval':_0xe108('0xc6')});_0x21ebd8[_0xe108('0xc7')]=!![];}return respondWithRpcPromise(_0xe108('0xc8'),_0xe108('0xc9'),_0x21ebd8);});}return respondWithRpcPromise(_0xe108('0xc8'),_0xe108('0xc9'),_0x21ebd8);})[_0xe108('0x22')](function(_0x52cac4){respondWithRpcPromise(_0xe108('0xca'),_0xe108('0xca'),{'event':_0xe108('0x8a'),'message':_0x52cac4},client9002);return _0x52cac4;})['then'](respondWithResult(_0x10809e,null))[_0xe108('0x57')](handleError(_0x10809e,null));};exports[_0xe108('0xcb')]=function(_0x147b4d,_0x1e8e1c,_0x4810e3){var _0x2b2cff,_0x4ce14d,_0x118e7c;var _0x6e58bc=[];var _0xc50fd4=[];var _0x519b04={};var _0x5e1dc1=_0x147b4d['files']||[];var _0x2a4ec6=[];var _0x40ef03;return db[_0xe108('0x91')][_0xe108('0x63')]()['then'](function(_0x25765a){if(!_0x25765a){throw new db[(_0xe108('0x92'))]['ValidationError']('no\x20available\x20attributes');}_0xc50fd4=_[_0xe108('0x94')](_[_0xe108('0x46')](_0x25765a),[_0xe108('0x95'),'updatedAt']);_0x6e58bc=_[_0xe108('0x94')](_[_0xe108('0x46')](_0x25765a),[_0xe108('0x95'),_0xe108('0x96'),_0xe108('0x97'),'ListId']);if(_0x147b4d[_0xe108('0x61')]['id']){delete _0x147b4d[_0xe108('0x61')]['id'];}if(_['isNil'](_0x147b4d[_0xe108('0x61')][_0xe108('0x98')])){throw _0x1e8e1c[_0xe108('0x2c')](0x1f4)[_0xe108('0x3d')](new db[(_0xe108('0x92'))]['ValidationError'](_0xe108('0x99')));}if(_[_0xe108('0x7f')](_0x147b4d[_0xe108('0x61')][_0xe108('0x61')])||_0x147b4d[_0xe108('0x61')][_0xe108('0x61')]===''){throw _0x1e8e1c['status'](0x1f4)['send'](new db[(_0xe108('0x92'))][(_0xe108('0x93'))](_0xe108('0x9a')));}if(_['isNil'](_0x147b4d[_0xe108('0x61')][_0xe108('0xcc')])){throw _0x1e8e1c[_0xe108('0x2c')](0x1f4)[_0xe108('0x3d')](new db[(_0xe108('0x92'))][(_0xe108('0x93'))](_0xe108('0xcd')+_0x6e58bc));}if(!_[_0xe108('0x9c')](_0x6e58bc,_0x147b4d[_0xe108('0x61')]['mapKeyOffline'])){throw _0x1e8e1c[_0xe108('0x2c')](0x1f4)[_0xe108('0x3d')](new db['Sequelize'][(_0xe108('0x93'))](_0xe108('0xce')+_0x6e58bc));}_0x519b04[_0x147b4d[_0xe108('0x61')][_0xe108('0xcc')]]=_0x147b4d[_0xe108('0x61')][_0xe108('0x98')];})[_0xe108('0x22')](function(){return db[_0xe108('0x54')]['find']({'where':{'id':_0x147b4d[_0xe108('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0xe108('0xa0')},{'model':db[_0xe108('0xcf')],'as':_0xe108('0xcf')}]});})['then'](handleEntityNotFound(_0x1e8e1c,null))['then'](function(_0x1ab5cd){if(_0x1ab5cd&&_0x1ab5cd[_0xe108('0xa0')]){_0x4ce14d=_0x1ab5cd;var _0x3ba92b=_['defaults'](_0x147b4d[_0xe108('0x61')],{'firstName':_0x147b4d[_0xe108('0x61')][_0xe108('0x98')],'phone':_0x147b4d['body'][_0xe108('0x98')],'ListId':_0x1ab5cd['ListId']});_0x3ba92b[_0x147b4d[_0xe108('0x61')][_0xe108('0xcc')]]=_0x147b4d[_0xe108('0x61')]['from'];return db[_0xe108('0x91')]['findOrCreate']({'where':_0x519b04,'defaults':_0x3ba92b});}})[_0xe108('0xbb')](function(_0x47fd7e){if(_0x47fd7e){_0x118e7c=_0x47fd7e;var _0x59b44c=fs[_0xe108('0xd0')](path['join'](config[_0xe108('0x7b')],_0xe108('0xd1')),_0xe108('0xd2'));var _0x37b031=ejs[_0xe108('0xd3')](_0x59b44c,{'body':_[_0xe108('0xd4')](_0x147b4d[_0xe108('0x61')]['body']),'bodyTitle':_0x4ce14d[_0xe108('0xd5')]});return db['ChatOfflineMessage']['create']({'body':_0x37b031,'ContactId':_0x47fd7e['id'],'ChatWebsiteId':_0x4ce14d['id']});}})[_0xe108('0x22')](function(_0xb0de9f){_0x40ef03=_0xb0de9f;if(_0x5e1dc1[_0xe108('0x58')]){var _0x12b951=_0x5e1dc1[_0xe108('0x41')](function(_0x498d73){return{'name':_0x498d73[_0xe108('0xd6')],'basename':_0x498d73['filename'],'type':_0x498d73[_0xe108('0xd7')],'ChatOfflineMessageId':_0xb0de9f['id']};});_0x2a4ec6=_0x12b951['map'](_0x39fa2c=>{var _0xd8ff24={'filename':_0x39fa2c[_0xe108('0x3c')],'path':path[_0xe108('0x7a')](config[_0xe108('0x7b')],_0xe108('0xd8'),'files',_0xe108('0xd9'),'offline-chat',_0x39fa2c[_0xe108('0xda')])};return _0xd8ff24;});if(!_0x4ce14d['openNewInteraction']){return db[_0xe108('0xdb')]['transaction'](function(_0x3aa244){return db[_0xe108('0xdc')][_0xe108('0xdd')](_0x12b951,{'transaction':_0x3aa244});});}}})[_0xe108('0x22')](function(){if(_0x40ef03){_0x2b2cff=_0x40ef03;return db['MailAccount'][_0xe108('0x68')]({'where':{'active':!![]},'include':[{'model':db[_0xe108('0xde')],'as':'Smtp','raw':!![]}]});}})[_0xe108('0x22')](function(_0x19f8cb){if(_0x19f8cb&&_0x19f8cb[_0xe108('0xdf')]&&_0x4ce14d['forwardOffline']&&_0x4ce14d[_0xe108('0xe0')]){var _0x169666={'tls':{'rejectUnauthorized':![]}};if(_0x19f8cb['Smtp']['service']){_0x169666[_0xe108('0xe1')]=_0x19f8cb[_0xe108('0xdf')][_0xe108('0xe1')];}else{_0x169666[_0xe108('0xe2')]=_0x19f8cb[_0xe108('0xdf')][_0xe108('0xe2')];_0x169666[_0xe108('0xe3')]=_0x19f8cb[_0xe108('0xdf')][_0xe108('0xe3')];_0x169666[_0xe108('0xe4')]=_0x19f8cb[_0xe108('0xdf')]['secure'];}if(_0x19f8cb[_0xe108('0xdf')]['authentication']){_0x169666[_0xe108('0xe5')]={'user':_0x19f8cb['Smtp'][_0xe108('0x5b')],'pass':_0x19f8cb[_0xe108('0xdf')][_0xe108('0xe6')]};}return respondWithRpcPromise(_0xe108('0xe7'),'sendMail',{'account':_0x169666,'message':{'from':util[_0xe108('0xb4')](_0xe108('0xe8'),_0x19f8cb[_0xe108('0x3c')],_0x19f8cb[_0xe108('0xe9')]||_0x19f8cb[_0xe108('0xdf')]['user']),'to':_0x4ce14d[_0xe108('0xe0')],'subject':_0x4ce14d['offlineMessageSubject'],'html':_0x2b2cff[_0xe108('0x61')],'attachments':_0x2a4ec6}},client9003)[_0xe108('0x22')](function(){return _0x2b2cff;})[_0xe108('0x57')](function(_0x5b9bd8){console[_0xe108('0x27')](_0x5b9bd8);});}})[_0xe108('0x22')](function(){if(_0x4ce14d&&_0x4ce14d[_0xe108('0xea')]&&_0x4ce14d['MailAccountId']){var _0x3bca92=[];if(_0x5e1dc1[_0xe108('0x58')]){_0x3bca92=_0x5e1dc1[_0xe108('0x41')](function(_0x1133e1){return{'name':_0x1133e1[_0xe108('0xd6')],'basename':_0x1133e1[_0xe108('0x73')],'type':_0x1133e1[_0xe108('0xd7')],'ChatOfflineMessageId':_0x40ef03['id']};});}var _0x514616;if(!_['isNil'](_0x4ce14d[_0xe108('0xeb')])){var _0x3eccc9=_[_0xe108('0x41')](_0x147b4d[_0xe108('0x61')],function(_0xb538da){return _0xb538da;});var _0x592d43=_['toPairsIn'](_0x3eccc9)[0x0];var _0x59025b=_[_0xe108('0xec')](_0x592d43,function(_0x4613fe){return _0x4613fe;});_0x514616=_0x59025b[0x1][_0x4ce14d[_0xe108('0xeb')]];}var _0x264a92={'from':_0x118e7c[_0xe108('0xe9')],'firstName':_0x118e7c[_0xe108('0xad')],'lastName':_0x118e7c[_0xe108('0xed')],'mapKey':_0xe108('0xe9'),'message':{'from':_0x118e7c['email'],'to':_0x4ce14d[_0xe108('0xcf')]['email'],'cc':'','subject':_['isNil'](_0x514616)?_0x4ce14d[_0xe108('0xee')]:_0x514616,'messageId':'','sentAt':new Date(),'attach':_0x3bca92[_0xe108('0x58')],'attachments':_0x3bca92,'originChannel':_0xe108('0xef'),'ChatWebsiteId':_0x4ce14d['id'],'ChatOfflineMessageId':_0x2b2cff['id'],'originTo':_0x4ce14d[_0xe108('0xcf')]['email']},'body':_0x2b2cff[_0xe108('0x61')]};var _0x122c40={'account':{'id':_0x4ce14d[_0xe108('0xf0')]},'body':_0x264a92,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xe108('0xf1'),'notifyMail',_0x122c40,client9001)[_0xe108('0x22')](function(){return _0x2b2cff;})[_0xe108('0x57')](function(_0x266283){console[_0xe108('0x27')](_0x266283);});}return;})[_0xe108('0x22')](function(){if(_0x2b2cff){return _0x2b2cff;}})[_0xe108('0x22')](respondWithResult(_0x1e8e1c,null))[_0xe108('0x57')](function(_0x42692d){console[_0xe108('0x27')](_0xe108('0x57'),_0x42692d);for(var _0x5d552a of _0x5e1dc1){var _0x298578=path[_0xe108('0x7a')](config['root'],_0xe108('0xd8'),_0xe108('0xf2'),_0xe108('0xd9'),_0xe108('0xf3'),_0x5d552a[_0xe108('0x73')]);fs_extra['remove'](_0x298578)[_0xe108('0x57')](function(_0x57ec38){console[_0xe108('0x27')](_0xe108('0xf4'),_0x298578,_0x57ec38);});}});};exports[_0xe108('0xf5')]=function(_0x2388c8,_0x2d06df,_0x2ce91e){return db[_0xe108('0xb7')][_0xe108('0x59')]({'where':{'id':_0x2388c8[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x2d06df,null))[_0xe108('0x22')](function(_0x2c6215){if(_0x2c6215){return _0x2c6215['addInteraction'](_0x2388c8[_0xe108('0x61')][_0xe108('0x6e')],_['omit'](_0x2388c8['body'],['ids','id'])||{});}})[_0xe108('0x22')](respondWithResult(_0x2d06df,null))['catch'](handleError(_0x2d06df,null));};exports['getInteractions']=function(_0x2cd0c3,_0x2f89da,_0x211ef4){var _0x3b8539={'raw':![],'where':{}};var _0xe17042={};var _0x464f57={'count':0x0,'rows':[]};return db[_0xe108('0x54')]['findOne']({'where':{'id':_0x2cd0c3[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x2f89da,null))[_0xe108('0x22')](function(_0x4feba4){if(_0x4feba4){_0xe17042[_0xe108('0x45')]=_['keys'](db['ChatInteraction'][_0xe108('0x42')]);_0xe17042[_0xe108('0x49')]=_[_0xe108('0x46')](_0x2cd0c3[_0xe108('0x49')]);_0xe17042[_0xe108('0x47')]=_[_0xe108('0x48')](_0xe17042[_0xe108('0x45')],_0xe17042[_0xe108('0x49')]);_0x3b8539[_0xe108('0x4a')]=_[_0xe108('0x48')](_0xe17042['model'],qs[_0xe108('0x4b')](_0x2cd0c3[_0xe108('0x49')][_0xe108('0x4b')]));_0x3b8539[_0xe108('0x4a')]=_0x3b8539[_0xe108('0x4a')][_0xe108('0x58')]?_0x3b8539[_0xe108('0x4a')]:_0xe17042[_0xe108('0x45')];if(!_0x2cd0c3[_0xe108('0x49')][_0xe108('0x69')](_0xe108('0x6a'))){_0x3b8539[_0xe108('0x30')]=qs[_0xe108('0x30')](_0x2cd0c3['query'][_0xe108('0x30')]);_0x3b8539[_0xe108('0x2e')]=qs[_0xe108('0x2e')](_0x2cd0c3['query'][_0xe108('0x2e')]);}_0x3b8539['order']=qs[_0xe108('0x6c')](_0x2cd0c3[_0xe108('0x49')][_0xe108('0x6c')]);_0x3b8539['where']=qs['filters'](_[_0xe108('0x4d')](_0x2cd0c3[_0xe108('0x49')],_0xe17042[_0xe108('0x47')]));_0x3b8539[_0xe108('0x4c')][_0xe108('0x65')]=_0x4feba4['id'];if(_0x2cd0c3[_0xe108('0x49')][_0xe108('0x4e')]){_0x3b8539['where']=_[_0xe108('0x4f')](_0x3b8539[_0xe108('0x4c')],{'$or':_[_0xe108('0x41')](_0x3b8539[_0xe108('0x4a')],function(_0x4008ae){var _0x3358ca={};_0x3358ca[_0x4008ae]={'$like':'%'+_0x2cd0c3['query'][_0xe108('0x4e')]+'%'};return _0x3358ca;})});}_0x3b8539=_[_0xe108('0x4f')]({},_0x3b8539,_0x2cd0c3['options']);return db[_0xe108('0xb7')][_0xe108('0x31')]({'where':_0x3b8539[_0xe108('0x4c')]})['then'](function(_0x398998){_0x464f57[_0xe108('0x31')]=_0x398998;if(_0x2cd0c3[_0xe108('0x49')][_0xe108('0x52')]){_0x3b8539[_0xe108('0x53')]=[{'model':db[_0xe108('0x91')],'as':_0xe108('0xf6'),'required':![]},{'model':db[_0xe108('0xc3')],'as':'Owner','attributes':[_0xe108('0x3c'),'fullname',_0xe108('0xf7')],'required':![]},{'model':db[_0xe108('0xf8')],'as':_0xe108('0xf9'),'attributes':['id',_0xe108('0x3c'),_0xe108('0xfa')],'where':_0x2cd0c3['query'][_0xe108('0xfb')]?{'id':_0x2cd0c3[_0xe108('0x49')]['tag']}:undefined,'required':_0x2cd0c3[_0xe108('0x49')][_0xe108('0xfb')]?!![]:![]}];}return db[_0xe108('0xb7')][_0xe108('0x55')](_0x3b8539);})[_0xe108('0x22')](function(_0x2f0309){_0x464f57[_0xe108('0x56')]=_0x2f0309;return _0x464f57;});}})[_0xe108('0x22')](respondWithFilteredResult(_0x2f89da,_0x3b8539))[_0xe108('0x57')](handleError(_0x2f89da,null));};function iftimePromise(_0x30cdaa,_0x1e2233){return respondWithRpcPromise('Command',_0xe108('0xfc'),{'command':_0x1e2233[_0xe108('0xfd')]?util['format'](_0xe108('0xfe'),_0x30cdaa['interval'],_0x1e2233[_0xe108('0xfd')]):util['format'](_0xe108('0xff'),_0x30cdaa[_0xe108('0x100')])},client9002)['then'](function(_0x54a5a9){var _0x6700c4=_0x54a5a9&&_0x54a5a9['indexOf'](_0xe108('0x101'))>=0x0?!![]:![];logger[_0xe108('0x23')](_0xe108('0x102'),_0x1e2233['id'],_0x30cdaa['id'],_0x30cdaa['interval'],_0x6700c4?_0xe108('0x103'):_0xe108('0x104'),_0x1e2233[_0xe108('0xfd')]?_0x1e2233[_0xe108('0xfd')]:_0xe108('0x105'));return _0x6700c4;})[_0xe108('0x57')](function(_0x2d4763){logger['error'](_0xe108('0x102'),_0x1e2233['id'],_0x30cdaa['id'],_0x30cdaa[_0xe108('0x100')],util[_0xe108('0x106')](_0x2d4763,{'showHidden':![],'depth':null}),_0x1e2233[_0xe108('0xfd')]?_0x1e2233[_0xe108('0xfd')]:_0xe108('0x105'));return![];});}exports[_0xe108('0xfc')]=function(_0x54c17c,_0x5957b8,_0x4e0703){var _0x3e8d9c=0x0;var _0x38ee37=0x0;var _0x3f84c9=![];var _0x208c4b;var _0x3e4445;return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x54c17c['params']['id']},'include':[{'model':db[_0xe108('0x107')],'as':_0xe108('0x107'),'include':[{'model':db[_0xe108('0x107')],'as':_0xe108('0x108'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xe108('0x22')](handleEntityNotFound(_0x5957b8,null))['then'](function(_0x571dbf){if(_0x571dbf){_0x208c4b=_0x571dbf;return _0x571dbf[_0xe108('0x109')]({'raw':!![]});}})[_0xe108('0x22')](function(_0x56577b){if(_0x208c4b){if(_0x56577b){_0x3e4445=_0x56577b;}}return require(_0xe108('0x10a'))[_0xe108('0x7d')]();})[_0xe108('0x22')](function(_0x1c408f){if(_0x1c408f){_0x38ee37=_0x1c408f[_0xe108('0x10b')];_0x3f84c9=_0x1c408f[_0xe108('0x7e')];}})[_0xe108('0x22')](function(){return db[_0xe108('0xb7')][_0xe108('0x31')]({'where':{'closed':![]}});})['then'](function(_0x4b29c7){_0x3e8d9c=_0x4b29c7;if(_0x38ee37&&_0x4b29c7>_0x38ee37){return db[_0xe108('0x10c')][_0xe108('0x68')]({'where':{'id':0x1}})[_0xe108('0x22')](function(_0x1c15dc){if(_0x1c15dc){_0x1c15dc['increment'](_0xe108('0x10d'));}});}})[_0xe108('0x22')](function(){if(_0x208c4b[_0xe108('0x107')]&&_0x208c4b[_0xe108('0x107')][_0xe108('0x108')]){var _0x2c042c=[];for(var _0x70131f=0x0;_0x70131f<_0x208c4b[_0xe108('0x107')][_0xe108('0x108')][_0xe108('0x58')];_0x70131f++){var _0x546306=_0x208c4b['Interval'][_0xe108('0x108')][_0x70131f][_0xe108('0x37')]({'plain':!![]});_0x2c042c[_0xe108('0xc0')](iftimePromise(_0x546306,_0x208c4b));}return BPromise[_0xe108('0x10e')](_0x2c042c)['then'](function(_0x1d4492){return _['some'](_0x1d4492);});}else{return!![];}})['then'](function(_0x166838){var _0x271c65=fs[_0xe108('0xd0')](path[_0xe108('0x7a')](config[_0xe108('0x7b')],'server/files/chat/iframe.ejs'),_0xe108('0xd2'));var _0x4746dc={'remote':_0x208c4b[_0xe108('0x10f')],'query':querystring[_0xe108('0x26')](_[_0xe108('0x4f')](_0x208c4b['get']({'plain':!![]}),{'customerIp':_0x54c17c[_0xe108('0x8d')][_0xe108('0xaa')]||_0x54c17c['headers'][_0xe108('0x110')]||_0x54c17c[_0xe108('0x111')]['remoteAddress']||_0x54c17c['ip'],'referer':_0x54c17c['headers'][_0xe108('0xae')],'openedInteractions':_0x3e8d9c,'maxInteractions':_0x38ee37,'virtual':_0x3f84c9[_0xe108('0x10b')],'online':_0x166838,'custom':_0x3f84c9}))[_0xe108('0x112')](/'/g,'\x5c\x27')};_0x5957b8['send'](ejs[_0xe108('0xd3')](Mustache[_0xe108('0xd3')](_0x271c65,_0x4746dc),{'proactiveActions':_0x3e4445,'alignment':_0x208c4b[_0xe108('0x113')],'verticalAlignment':_0x208c4b[_0xe108('0x114')],'div_color':_0x208c4b[_0xe108('0xfa')],'text_color':_0x208c4b[_0xe108('0x115')],'button_color':_0x208c4b[_0xe108('0x116')],'background_color':_0x208c4b['backgroundColor']}));})[_0xe108('0x57')](handleError(_0x5957b8,null));};exports[_0xe108('0x117')]=function(_0x2e5984,_0x57b4b4,_0x41defb){return db[_0xe108('0x54')][_0xe108('0x68')]({'where':{'id':_0x2e5984[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x57b4b4,null))['then'](function(_0x1e9468){if(_0x1e9468){return db[_0xe108('0xdb')][_0xe108('0x118')](function(_0xb859a5){return db['ChatApplication'][_0xe108('0x36')]({'where':{'ChatWebsiteId':_0x2e5984[_0xe108('0x62')]['id']},'transaction':_0xb859a5})[_0xe108('0x22')](function(_0x454ce5){var _0x50d5a6=_[_0xe108('0x41')](_0x2e5984[_0xe108('0x61')],function(_0x3351d6){_0x3351d6['ChatWebsiteId']=_0x2e5984[_0xe108('0x62')]['id'];return _0x3351d6;});return db[_0xe108('0x119')][_0xe108('0xdd')](_0x50d5a6,{'transaction':_0xb859a5});});})[_0xe108('0x22')](function(){return db['ChatApplication'][_0xe108('0x11a')]({'where':{'ChatWebsiteId':_0x2e5984[_0xe108('0x62')]['id']},'order':_0xe108('0x11b')});});}})[_0xe108('0x22')](respondWithResult(_0x57b4b4,null))['catch'](handleError(_0x57b4b4,null));};exports[_0xe108('0x11c')]=function(_0x51e45c,_0x184bcd,_0x3d304f){var _0x395b51={};var _0x2df19e={};var _0x4f2f5f;var _0x484d40;return db['ChatWebsite'][_0xe108('0x68')]({'where':{'id':_0x51e45c[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x184bcd,null))[_0xe108('0x22')](function(_0x170966){if(_0x170966){_0x4f2f5f=_0x170966;_0x2df19e[_0xe108('0x45')]=_[_0xe108('0x46')](db[_0xe108('0x119')][_0xe108('0x42')]);_0x2df19e[_0xe108('0x49')]=_[_0xe108('0x46')](_0x51e45c[_0xe108('0x49')]);_0x2df19e[_0xe108('0x47')]=_[_0xe108('0x48')](_0x2df19e[_0xe108('0x45')],_0x2df19e[_0xe108('0x49')]);_0x395b51[_0xe108('0x4a')]=_[_0xe108('0x48')](_0x2df19e[_0xe108('0x45')],qs[_0xe108('0x4b')](_0x51e45c[_0xe108('0x49')][_0xe108('0x4b')]));_0x395b51[_0xe108('0x4a')]=_0x395b51[_0xe108('0x4a')]['length']?_0x395b51['attributes']:_0x2df19e[_0xe108('0x45')];_0x395b51[_0xe108('0x6b')]=qs['sort'](_0x51e45c[_0xe108('0x49')]['sort']);_0x395b51[_0xe108('0x4c')]=qs['filters'](_[_0xe108('0x4d')](_0x51e45c[_0xe108('0x49')],_0x2df19e['filters']));if(_0x51e45c[_0xe108('0x49')]['filter']){_0x395b51[_0xe108('0x4c')]=_['merge'](_0x395b51[_0xe108('0x4c')],{'$or':_['map'](_0x395b51[_0xe108('0x4a')],function(_0x479cf2){var _0x41407d={};_0x41407d[_0x479cf2]={'$like':'%'+_0x51e45c[_0xe108('0x49')][_0xe108('0x4e')]+'%'};return _0x41407d;})});}_0x395b51=_[_0xe108('0x4f')]({},_0x395b51,_0x51e45c[_0xe108('0x51')]);return _0x4f2f5f[_0xe108('0x11c')](_0x395b51);}})[_0xe108('0x22')](function(_0x4d5140){if(_0x4d5140){_0x484d40=_0x4d5140[_0xe108('0x58')];if(!_0x51e45c[_0xe108('0x49')]['hasOwnProperty'](_0xe108('0x6a'))){_0x395b51[_0xe108('0x30')]=qs[_0xe108('0x30')](_0x51e45c['query'][_0xe108('0x30')]);_0x395b51[_0xe108('0x2e')]=qs['offset'](_0x51e45c[_0xe108('0x49')][_0xe108('0x2e')]);}return _0x4f2f5f['getApplications'](_0x395b51);}})[_0xe108('0x22')](function(_0xe2e092){if(_0xe2e092){return _0xe2e092?{'count':_0x484d40,'rows':_0xe2e092}:null;}})[_0xe108('0x22')](respondWithResult(_0x184bcd,null))[_0xe108('0x57')](handleError(_0x184bcd,null));};exports[_0xe108('0x11d')]=function(_0x292e28,_0x559614,_0x344517){return db[_0xe108('0x11e')]['find']({'where':{'id':_0x292e28[_0xe108('0x62')]['id']}})['then'](handleEntityNotFound(_0x559614,null))[_0xe108('0x22')](function(_0x2e15ba){if(_0x2e15ba){return _0x2e15ba[_0xe108('0x11d')](_0x292e28[_0xe108('0x61')]['ids'],_['omit'](_0x292e28[_0xe108('0x61')],[_0xe108('0x6e'),'id'])||{});}})[_0xe108('0x22')](respondWithResult(_0x559614,null))[_0xe108('0x57')](handleError(_0x559614,null));};exports[_0xe108('0x109')]=function(_0x2326f2,_0x321d50,_0x4614cc){var _0x4b709b={};var _0x34b1b8={};var _0x1a86c6;var _0x17b291;return db[_0xe108('0x54')][_0xe108('0x68')]({'where':{'id':_0x2326f2['params']['id']}})['then'](handleEntityNotFound(_0x321d50,null))['then'](function(_0x223ce7){if(_0x223ce7){_0x1a86c6=_0x223ce7;_0x34b1b8['model']=_['keys'](db[_0xe108('0x11f')][_0xe108('0x42')]);_0x34b1b8['query']=_[_0xe108('0x46')](_0x2326f2[_0xe108('0x49')]);_0x34b1b8[_0xe108('0x47')]=_[_0xe108('0x48')](_0x34b1b8['model'],_0x34b1b8[_0xe108('0x49')]);_0x4b709b[_0xe108('0x4a')]=_['intersection'](_0x34b1b8[_0xe108('0x45')],qs[_0xe108('0x4b')](_0x2326f2['query'][_0xe108('0x4b')]));_0x4b709b[_0xe108('0x4a')]=_0x4b709b['attributes'][_0xe108('0x58')]?_0x4b709b['attributes']:_0x34b1b8[_0xe108('0x45')];_0x4b709b[_0xe108('0x6b')]=qs[_0xe108('0x6c')](_0x2326f2[_0xe108('0x49')]['sort']);_0x4b709b[_0xe108('0x4c')]=qs[_0xe108('0x47')](_[_0xe108('0x4d')](_0x2326f2[_0xe108('0x49')],_0x34b1b8[_0xe108('0x47')]));if(_0x2326f2[_0xe108('0x49')]['filter']){_0x4b709b[_0xe108('0x4c')]=_['merge'](_0x4b709b['where'],{'$or':_['map'](_0x4b709b['attributes'],function(_0x47d013){var _0x122145={};_0x122145[_0x47d013]={'$like':'%'+_0x2326f2[_0xe108('0x49')][_0xe108('0x4e')]+'%'};return _0x122145;})});}_0x4b709b=_['merge']({},_0x4b709b,_0x2326f2['options']);return _0x1a86c6['getProactiveActions'](_0x4b709b);}})[_0xe108('0x22')](function(_0xf265fe){if(_0xf265fe){_0x17b291=_0xf265fe[_0xe108('0x58')];if(!_0x2326f2[_0xe108('0x49')][_0xe108('0x69')](_0xe108('0x6a'))){_0x4b709b['limit']=qs[_0xe108('0x30')](_0x2326f2[_0xe108('0x49')][_0xe108('0x30')]);_0x4b709b[_0xe108('0x2e')]=qs[_0xe108('0x2e')](_0x2326f2['query'][_0xe108('0x2e')]);}return _0x1a86c6[_0xe108('0x109')](_0x4b709b);}})[_0xe108('0x22')](function(_0x15ed51){if(_0x15ed51){return _0x15ed51?{'count':_0x17b291,'rows':_0x15ed51}:null;}})[_0xe108('0x22')](respondWithResult(_0x321d50,null))[_0xe108('0x57')](handleError(_0x321d50,null));};exports[_0xe108('0x120')]=function(_0x7a49eb,_0x5e356e,_0x3e43c5){var _0x132789=_0x7a49eb['query'][_0xe108('0x121')]===_0xe108('0x122')?_0xe108('0x123'):_0xe108('0x124');return db['ChatWebsite'][_0xe108('0x59')]({'attributes':['id',_0x132789],'where':{'id':_0x7a49eb[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x5e356e,null))[_0xe108('0x22')](function(_0x41c5c2){if(_0x41c5c2){var _0x21ece8=_0x41c5c2[_0x132789];var _0x1ed51c=_0x21ece8&&_0x21ece8[_0xe108('0x125')]?_0x21ece8['items']:[];_0x5e356e[_0xe108('0x3d')]({'fromKey':_[_0xe108('0x7f')](_0x21ece8[_0xe108('0x126')])?undefined:_0x21ece8['fromKey'],'count':_0x1ed51c[_0xe108('0x58')],'rows':_0x1ed51c});}})['catch'](handleError(_0x5e356e,null));};exports['getOfflineMessages']=function(_0x5043a6,_0x7afedd,_0x4d7299){var _0x23ba23={'raw':![],'where':{}};var _0x485f90={};var _0x1a9a01={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe108('0x68')]({'where':{'id':_0x5043a6[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x7afedd,null))[_0xe108('0x22')](function(_0x5ababe){if(_0x5ababe){_0x485f90[_0xe108('0x45')]=_[_0xe108('0x46')](db[_0xe108('0x127')][_0xe108('0x42')]);_0x485f90[_0xe108('0x49')]=_[_0xe108('0x46')](_0x5043a6['query']);_0x485f90['filters']=_[_0xe108('0x48')](_0x485f90[_0xe108('0x45')],_0x485f90[_0xe108('0x49')]);_0x23ba23[_0xe108('0x4a')]=_['intersection'](_0x485f90[_0xe108('0x45')],qs['fields'](_0x5043a6[_0xe108('0x49')][_0xe108('0x4b')]));_0x23ba23[_0xe108('0x4a')]=_0x23ba23[_0xe108('0x4a')][_0xe108('0x58')]?_0x23ba23[_0xe108('0x4a')]:_0x485f90[_0xe108('0x45')];if(!_0x5043a6['query'][_0xe108('0x69')](_0xe108('0x6a'))){_0x23ba23[_0xe108('0x30')]=qs[_0xe108('0x30')](_0x5043a6[_0xe108('0x49')][_0xe108('0x30')]);_0x23ba23['offset']=qs['offset'](_0x5043a6[_0xe108('0x49')][_0xe108('0x2e')]);}_0x23ba23[_0xe108('0x6b')]=qs[_0xe108('0x6c')](_0x5043a6[_0xe108('0x49')][_0xe108('0x6c')]);_0x23ba23[_0xe108('0x4c')]=qs[_0xe108('0x47')](_['pick'](_0x5043a6[_0xe108('0x49')],_0x485f90[_0xe108('0x47')]));_0x23ba23[_0xe108('0x4c')][_0xe108('0x65')]=_0x5ababe['id'];if(_0x5043a6[_0xe108('0x49')][_0xe108('0x4e')]){_0x23ba23[_0xe108('0x4c')]=_[_0xe108('0x4f')](_0x23ba23[_0xe108('0x4c')],{'$or':_[_0xe108('0x41')](_0x23ba23[_0xe108('0x4a')],function(_0x23fb1){var _0x3751ee={};_0x3751ee[_0x23fb1]={'$like':'%'+_0x5043a6[_0xe108('0x49')][_0xe108('0x4e')]+'%'};return _0x3751ee;})});}_0x23ba23=_[_0xe108('0x4f')]({},_0x23ba23,_0x5043a6[_0xe108('0x51')]);return db[_0xe108('0x127')][_0xe108('0x31')]({'where':_0x23ba23['where']})[_0xe108('0x22')](function(_0x3eb120){_0x1a9a01[_0xe108('0x31')]=_0x3eb120;if(_0x5043a6[_0xe108('0x49')][_0xe108('0x52')]){_0x23ba23[_0xe108('0x53')]=[{'all':!![]}];}else{_0x23ba23[_0xe108('0x53')]=[{'model':db[_0xe108('0x91')],'as':_0xe108('0xf6'),'required':![]},{'model':db[_0xe108('0xdc')],'as':_0xe108('0x128'),'required':![]}];}return db[_0xe108('0x127')]['findAll'](_0x23ba23);})[_0xe108('0x22')](function(_0x35e6f2){_0x1a9a01[_0xe108('0x56')]=_0x35e6f2;return _0x1a9a01;});}})[_0xe108('0x22')](respondWithFilteredResult(_0x7afedd,_0x23ba23))[_0xe108('0x57')](handleError(_0x7afedd,null));};exports[_0xe108('0x129')]=function(_0x212d4e,_0xd3663,_0x2dad3e){return db[_0xe108('0x54')][_0xe108('0x59')]({'where':{'id':_0x212d4e[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0xd3663,null))[_0xe108('0x22')](function(_0x116e5a){if(_0x116e5a){return _0x116e5a[_0xe108('0x129')](_0x212d4e[_0xe108('0x61')][_0xe108('0x6e')],_['omit'](_0x212d4e['body'],[_0xe108('0x6e'),'id'])||{})[_0xe108('0xbb')](function(_0x124cf7){for(var _0x16d655=0x0;_0x16d655<_0x212d4e[_0xe108('0x61')][_0xe108('0x6e')]['length'];_0x16d655+=0x1){socket[_0xe108('0x12a')](_0xe108('0x12b'),{'UserId':Number(_0x212d4e[_0xe108('0x61')]['ids'][_0x16d655]),'ChatWebsiteId':Number(_0x212d4e[_0xe108('0x62')]['id'])});}return _0x124cf7;});}})[_0xe108('0x22')](respondWithResult(_0xd3663,null))[_0xe108('0x57')](handleError(_0xd3663,null));};exports[_0xe108('0x12c')]=function(_0x3890a7,_0x1c4a6f,_0x3ecdbc){return db['ChatWebsite'][_0xe108('0x59')]({'where':{'id':_0x3890a7['params']['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x1c4a6f,null))[_0xe108('0x22')](function(_0x445e3e){if(_0x445e3e){return _0x445e3e[_0xe108('0x12c')](_0x3890a7['query'][_0xe108('0x6e')])[_0xe108('0x22')](function(){if(_[_0xe108('0x12d')](_0x3890a7[_0xe108('0x49')]['ids'])){for(var _0xfa56b5=0x0;_0xfa56b5<_0x3890a7['query'][_0xe108('0x6e')]['length'];_0xfa56b5+=0x1){socket[_0xe108('0x12a')](_0xe108('0x12e'),{'UserId':Number(_0x3890a7[_0xe108('0x49')]['ids'][_0xfa56b5]),'ChatWebsiteId':Number(_0x3890a7[_0xe108('0x62')]['id'])});}}else{socket[_0xe108('0x12a')](_0xe108('0x12e'),{'UserId':Number(_0x3890a7[_0xe108('0x49')][_0xe108('0x6e')]),'ChatWebsiteId':Number(_0x3890a7[_0xe108('0x62')]['id'])});}});}})[_0xe108('0x22')](respondWithStatusCode(_0x1c4a6f,null))['catch'](handleError(_0x1c4a6f,null));};exports[_0xe108('0x12f')]=function(_0x4a023d,_0x30d75b,_0xc27c1f){var _0x4dd64c={};var _0xb28547={};var _0xd3f050;var _0x21a391;return db[_0xe108('0x54')]['findOne']({'where':{'id':_0x4a023d[_0xe108('0x62')]['id']}})[_0xe108('0x22')](handleEntityNotFound(_0x30d75b,null))['then'](function(_0x1cf7cb){if(_0x1cf7cb){_0xd3f050=_0x1cf7cb;_0xb28547[_0xe108('0x45')]=_['keys'](db['User']['rawAttributes']);_0xb28547['query']=_[_0xe108('0x46')](_0x4a023d[_0xe108('0x49')]);_0xb28547[_0xe108('0x47')]=_[_0xe108('0x48')](_0xb28547['model'],_0xb28547['query']);_0x4dd64c[_0xe108('0x4a')]=_[_0xe108('0x48')](_0xb28547[_0xe108('0x45')],qs[_0xe108('0x4b')](_0x4a023d[_0xe108('0x49')][_0xe108('0x4b')]));_0x4dd64c[_0xe108('0x4a')]=_0x4dd64c[_0xe108('0x4a')][_0xe108('0x58')]?_0x4dd64c[_0xe108('0x4a')]:_0xb28547[_0xe108('0x45')];_0x4dd64c['order']=qs['sort'](_0x4a023d['query'][_0xe108('0x6c')]);_0x4dd64c[_0xe108('0x4c')]=qs[_0xe108('0x47')](_[_0xe108('0x4d')](_0x4a023d[_0xe108('0x49')],_0xb28547[_0xe108('0x47')]));if(_0x4a023d[_0xe108('0x49')][_0xe108('0x4e')]){_0x4dd64c['where']=_[_0xe108('0x4f')](_0x4dd64c[_0xe108('0x4c')],{'$or':_['map'](_0x4dd64c[_0xe108('0x4a')],function(_0xb511ab){var _0x9f01ed={};_0x9f01ed[_0xb511ab]={'$like':'%'+_0x4a023d[_0xe108('0x49')][_0xe108('0x4e')]+'%'};return _0x9f01ed;})});}_0x4dd64c=_[_0xe108('0x4f')]({},_0x4dd64c,_0x4a023d[_0xe108('0x51')]);return _0xd3f050[_0xe108('0x12f')](_0x4dd64c);}})[_0xe108('0x22')](function(_0xb6ded0){if(_0xb6ded0){_0x21a391=_0xb6ded0[_0xe108('0x58')];if(!_0x4a023d['query'][_0xe108('0x69')](_0xe108('0x6a'))){_0x4dd64c[_0xe108('0x30')]=qs['limit'](_0x4a023d[_0xe108('0x49')][_0xe108('0x30')]);_0x4dd64c['offset']=qs[_0xe108('0x2e')](_0x4a023d[_0xe108('0x49')][_0xe108('0x2e')]);}return _0xd3f050[_0xe108('0x12f')](_0x4dd64c);}})[_0xe108('0x22')](function(_0x5f14c7){if(_0x5f14c7){return _0x5f14c7?{'count':_0x21a391,'rows':_0x5f14c7}:null;}})[_0xe108('0x22')](respondWithResult(_0x30d75b,null))[_0xe108('0x57')](handleError(_0x30d75b,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 2e4d800..cb56ffb 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 _0xf767=['exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0xf767,0x76));var _0x7f76=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xf767[_0x4c06a3];return _0x7ff53c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x7f76('0x0'))['db'][_0x7f76('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7f76('0x2')](0x0);var events={'afterCreate':_0x7f76('0x3'),'afterUpdate':_0x7f76('0x4'),'afterDestroy':'remove'};function emitEvent(_0x396137){return function(_0x2aa5e1,_0x40ba50,_0x25cd62){ChatWebsiteEvents['emit'](_0x396137+':'+_0x2aa5e1['id'],_0x2aa5e1);ChatWebsiteEvents[_0x7f76('0x5')](_0x396137,_0x2aa5e1);_0x25cd62(null);};}for(var e in events){if(events[_0x7f76('0x6')](e)){var event=events[e];ChatWebsite[_0x7f76('0x7')](e,emitEvent(event));}}module[_0x7f76('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x96a2=['events','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1a660d,_0x182bba){var _0x3c1a19=function(_0x49f149){while(--_0x49f149){_0x1a660d['push'](_0x1a660d['shift']());}};_0x3c1a19(++_0x182bba);}(_0x96a2,0x96));var _0x296a=function(_0xc8510,_0x548104){_0xc8510=_0xc8510-0x0;var _0x19920f=_0x96a2[_0xc8510];return _0x19920f;};'use strict';var EventEmitter=require(_0x296a('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x296a('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x296a('0x2')](0x0);var events={'afterCreate':_0x296a('0x3'),'afterUpdate':_0x296a('0x4'),'afterDestroy':_0x296a('0x5')};function emitEvent(_0x45919f){return function(_0x142815,_0x420fc5,_0x27edfb){ChatWebsiteEvents[_0x296a('0x6')](_0x45919f+':'+_0x142815['id'],_0x142815);ChatWebsiteEvents[_0x296a('0x6')](_0x45919f,_0x142815);_0x27edfb(null);};}for(var e in events){if(events[_0x296a('0x7')](e)){var event=events[e];ChatWebsite[_0x296a('0x8')](e,emitEvent(event));}}module[_0x296a('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e197d19..0484581 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 _0x3a2f=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','bluebird'];(function(_0x3210f9,_0x5babff){var _0x1d4783=function(_0x4806e1){while(--_0x4806e1){_0x3210f9['push'](_0x3210f9['shift']());}};_0x1d4783(++_0x5babff);}(_0x3a2f,0xb2));var _0xf3a2=function(_0x3e17c1,_0x165414){_0x3e17c1=_0x3e17c1-0x0;var _0x5f2c49=_0x3a2f[_0x3e17c1];return _0x5f2c49;};'use strict';var _=require(_0xf3a2('0x0'));var util=require(_0xf3a2('0x1'));var logger=require(_0xf3a2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf3a2('0x3'));var rp=require(_0xf3a2('0x4'));var fs=require('fs');var path=require(_0xf3a2('0x5'));var rimraf=require(_0xf3a2('0x6'));var config=require(_0xf3a2('0x7'));var attributes=require(_0xf3a2('0x8'));module[_0xf3a2('0x9')]=function(_0x3327a9,_0x25ffc0){return _0x3327a9[_0xf3a2('0xa')](_0xf3a2('0xb'),attributes,{'tableName':_0xf3a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd710=['api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','chat_websites','../../config/logger'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xd710,0xba));var _0x0d71=function(_0x173f7d,_0x2f6531){_0x173f7d=_0x173f7d-0x0;var _0x41f927=_0xd710[_0x173f7d];return _0x41f927;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d71('0x0'))(_0x0d71('0x1'));var moment=require(_0x0d71('0x2'));var BPromise=require(_0x0d71('0x3'));var rp=require(_0x0d71('0x4'));var fs=require('fs');var path=require(_0x0d71('0x5'));var rimraf=require(_0x0d71('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d71('0x7'));module[_0x0d71('0x8')]=function(_0x421cbc,_0x3bab43){return _0x421cbc[_0x0d71('0x9')]('ChatWebsite',attributes,{'tableName':_0x0d71('0xa'),'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 195549d..57e299c 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 _0x4550=['client','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4550,0x108));var _0x0455=function(_0x2fdc1a,_0x2a0a5a){_0x2fdc1a=_0x2fdc1a-0x0;var _0x51fb16=_0x4550[_0x2fdc1a];return _0x51fb16;};'use strict';var _=require(_0x0455('0x0'));var util=require(_0x0455('0x1'));var moment=require(_0x0455('0x2'));var BPromise=require(_0x0455('0x3'));var rs=require(_0x0455('0x4'));var fs=require('fs');var Redis=require(_0x0455('0x5'));var db=require(_0x0455('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0455('0x7'))(_0x0455('0x8'));var config=require(_0x0455('0x9'));var jayson=require(_0x0455('0xa'));var client=jayson[_0x0455('0xb')]['http']({'port':0x232a});config[_0x0455('0xc')]=_[_0x0455('0xd')](config['redis'],{'host':_0x0455('0xe'),'port':0x18eb});var socket=require(_0x0455('0xf'))(new Redis(config[_0x0455('0xc')]));require('./chatWebsite.socket')[_0x0455('0x10')](socket);function respondWithRpcPromise(_0x35533f,_0x190193,_0x32606e){return new BPromise(function(_0x1f57a1,_0x11bf56){return client['request'](_0x35533f,_0x32606e)[_0x0455('0x11')](function(_0x35696f){logger[_0x0455('0x12')](_0x0455('0x13'),_0x190193,'request\x20sent');logger[_0x0455('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x190193,_0x0455('0x15'),JSON['stringify'](_0x35696f));if(_0x35696f[_0x0455('0x16')]){if(_0x35696f['error'][_0x0455('0x17')]===0x1f4){logger[_0x0455('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x190193,_0x35696f[_0x0455('0x16')][_0x0455('0x18')]);return _0x11bf56(_0x35696f[_0x0455('0x16')]['message']);}logger[_0x0455('0x16')](_0x0455('0x13'),_0x190193,_0x35696f[_0x0455('0x16')][_0x0455('0x18')]);return _0x1f57a1(_0x35696f[_0x0455('0x16')][_0x0455('0x18')]);}else{logger[_0x0455('0x12')](_0x0455('0x13'),_0x190193,_0x0455('0x15'));_0x1f57a1(_0x35696f['result'][_0x0455('0x18')]);}})['catch'](function(_0x176d5f){logger['error'](_0x0455('0x13'),_0x190193,_0x176d5f);_0x11bf56(_0x176d5f);});});} \ No newline at end of file +var _0x7805=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','request','then','request\x20sent','debug','error','code','message','info','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x2d45d2,_0x4f5c12){var _0x5c4ea2=function(_0x234c21){while(--_0x234c21){_0x2d45d2['push'](_0x2d45d2['shift']());}};_0x5c4ea2(++_0x4f5c12);}(_0x7805,0x132));var _0x5780=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x7805[_0x59162a];return _0x35e50d;};'use strict';var _=require(_0x5780('0x0'));var util=require(_0x5780('0x1'));var moment=require('moment');var BPromise=require(_0x5780('0x2'));var rs=require(_0x5780('0x3'));var fs=require('fs');var Redis=require(_0x5780('0x4'));var db=require(_0x5780('0x5'))['db'];var utils=require(_0x5780('0x6'));var logger=require('../../config/logger')(_0x5780('0x7'));var config=require(_0x5780('0x8'));var jayson=require(_0x5780('0x9'));var client=jayson[_0x5780('0xa')]['http']({'port':0x232a});config['redis']=_[_0x5780('0xb')](config['redis'],{'host':_0x5780('0xc'),'port':0x18eb});var socket=require(_0x5780('0xd'))(new Redis(config[_0x5780('0xe')]));require(_0x5780('0xf'))[_0x5780('0x10')](socket);function respondWithRpcPromise(_0x2493de,_0xfff859,_0x3b7417){return new BPromise(function(_0x313bb0,_0xa05da5){return client[_0x5780('0x11')](_0x2493de,_0x3b7417)[_0x5780('0x12')](function(_0x2dadb4){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xfff859,_0x5780('0x13'));logger[_0x5780('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xfff859,'request\x20sent',JSON['stringify'](_0x2dadb4));if(_0x2dadb4[_0x5780('0x15')]){if(_0x2dadb4[_0x5780('0x15')][_0x5780('0x16')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0xfff859,_0x2dadb4[_0x5780('0x15')][_0x5780('0x17')]);return _0xa05da5(_0x2dadb4[_0x5780('0x15')][_0x5780('0x17')]);}logger[_0x5780('0x15')]('ChatWebsite,\x20%s,\x20%s',_0xfff859,_0x2dadb4[_0x5780('0x15')][_0x5780('0x17')]);return _0x313bb0(_0x2dadb4[_0x5780('0x15')][_0x5780('0x17')]);}else{logger[_0x5780('0x18')](_0x5780('0x19'),_0xfff859,'request\x20sent');_0x313bb0(_0x2dadb4[_0x5780('0x1a')][_0x5780('0x17')]);}})[_0x5780('0x1b')](function(_0x385a8d){logger[_0x5780('0x15')](_0x5780('0x19'),_0xfff859,_0x385a8d);_0xa05da5(_0x385a8d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8e1e5a5..dea1a39 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 _0x6aa4=['update','emit','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x2cf579,_0x410fac){var _0x5195cf=function(_0x44a99e){while(--_0x44a99e){_0x2cf579['push'](_0x2cf579['shift']());}};_0x5195cf(++_0x410fac);}(_0x6aa4,0x11d));var _0x46aa=function(_0x48dc02,_0x4a7530){_0x48dc02=_0x48dc02-0x0;var _0x3d8532=_0x6aa4[_0x48dc02];return _0x3d8532;};'use strict';var ChatWebsiteEvents=require(_0x46aa('0x0'));var events=[_0x46aa('0x1'),_0x46aa('0x2'),_0x46aa('0x3')];function createListener(_0x388019,_0x405e69){return function(_0x472678){_0x405e69[_0x46aa('0x4')](_0x388019,_0x472678);};}function removeListener(_0x1143f3,_0x206f15){return function(){ChatWebsiteEvents['removeListener'](_0x1143f3,_0x206f15);};}exports['register']=function(_0x47081f){for(var _0x48f0d0=0x0,_0x1eedb0=events['length'];_0x48f0d0<_0x1eedb0;_0x48f0d0++){var _0x4ae7a5=events[_0x48f0d0];var _0x5a1aca=createListener(_0x46aa('0x5')+_0x4ae7a5,_0x47081f);ChatWebsiteEvents['on'](_0x4ae7a5,_0x5a1aca);}}; \ No newline at end of file +var _0x50d6=['emit','register','length','./chatWebsite.events','save','remove','update'];(function(_0x12f6da,_0x40a24f){var _0x2af65b=function(_0x2a653b){while(--_0x2a653b){_0x12f6da['push'](_0x12f6da['shift']());}};_0x2af65b(++_0x40a24f);}(_0x50d6,0x184));var _0x650d=function(_0x1fe809,_0x433222){_0x1fe809=_0x1fe809-0x0;var _0x59c58c=_0x50d6[_0x1fe809];return _0x59c58c;};'use strict';var ChatWebsiteEvents=require(_0x650d('0x0'));var events=[_0x650d('0x1'),_0x650d('0x2'),_0x650d('0x3')];function createListener(_0x39ee8f,_0x3713a8){return function(_0x4cc4a5){_0x3713a8[_0x650d('0x4')](_0x39ee8f,_0x4cc4a5);};}function removeListener(_0x333c53,_0x5f3276){return function(){ChatWebsiteEvents['removeListener'](_0x333c53,_0x5f3276);};}exports[_0x650d('0x5')]=function(_0x128cd8){for(var _0xb42d5b=0x0,_0xf32b06=events[_0x650d('0x6')];_0xb42d5b<_0xf32b06;_0xb42d5b++){var _0x1917a3=events[_0xb42d5b];var _0x1e3a30=createListener('chatWebsite:'+_0x1917a3,_0x128cd8);ChatWebsiteEvents['on'](_0x1917a3,_0x1e3a30);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9b1aebb..b67b3a2 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 _0x4397=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','addLogo','root','server/files/images/avatars/','/:id/avatar','file','addAvatar','addCustomerAvatar','single','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x39bd33,_0x2d1d3b){var _0xd5248e=function(_0xe42359){while(--_0xe42359){_0x39bd33['push'](_0x39bd33['shift']());}};_0xd5248e(++_0x2d1d3b);}(_0x4397,0x12f));var _0x7439=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x4397[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0x7439('0x0'));var util=require(_0x7439('0x1'));var path=require(_0x7439('0x2'));var timeout=require(_0x7439('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7439('0x4'));var auth=require(_0x7439('0x5'));var interaction=require(_0x7439('0x6'));var config=require(_0x7439('0x7'));var controller=require(_0x7439('0x8'));router[_0x7439('0x9')]('/',auth[_0x7439('0xa')](),controller[_0x7439('0xb')]);router[_0x7439('0x9')](_0x7439('0xc'),auth[_0x7439('0xa')](),controller['describe']);router[_0x7439('0x9')](_0x7439('0xd'),auth[_0x7439('0xa')](),controller[_0x7439('0xe')]);router[_0x7439('0x9')](_0x7439('0xf'),auth[_0x7439('0xa')](),controller[_0x7439('0x10')]);router[_0x7439('0x9')](_0x7439('0x11'),auth[_0x7439('0xa')](),controller[_0x7439('0x12')]);router['get']('/:id/logo',controller['getLogo']);router[_0x7439('0x9')]('/:id/avatar',controller[_0x7439('0x13')]);router[_0x7439('0x9')](_0x7439('0x14'),controller[_0x7439('0x15')]);router['get'](_0x7439('0x16'),controller[_0x7439('0x17')]);router[_0x7439('0x9')]('/:id/interactions',auth[_0x7439('0xa')](),controller[_0x7439('0x18')]);router[_0x7439('0x9')]('/:id/snippet',controller['getSnippet']);router[_0x7439('0x9')](_0x7439('0x19'),auth[_0x7439('0xa')](),controller[_0x7439('0x1a')]);router[_0x7439('0x9')](_0x7439('0x1b'),auth[_0x7439('0xa')](),controller[_0x7439('0x1c')]);router['get'](_0x7439('0x1d'),controller[_0x7439('0x1e')]);router['get'](_0x7439('0x1f'),auth[_0x7439('0xa')](),controller[_0x7439('0x20')]);router['get'](_0x7439('0x21'),auth['isAuthenticated'](),controller[_0x7439('0x22')]);router[_0x7439('0x23')]('/',auth[_0x7439('0xa')](),controller[_0x7439('0x24')]);router[_0x7439('0x23')](_0x7439('0xf'),auth[_0x7439('0xa')](),controller[_0x7439('0x25')]);router['post'](_0x7439('0x11'),auth[_0x7439('0xa')](),controller[_0x7439('0x26')]);var upload=multer({'storage':multer[_0x7439('0x27')]({'destination':function(_0x9d53f9,_0x5591a4,_0x5e9a22){_0x5e9a22(null,path[_0x7439('0x28')](config['root'],_0x7439('0x29')));},'filename':function(_0x7e18ca,_0x343019,_0x13f06a){_0x13f06a(null,util[_0x7439('0x2a')](_0x7439('0x2b'),Date[_0x7439('0x2c')](),_0x343019[_0x7439('0x2d')]));}})});router['post']('/:id/logo',upload['single']('file'),controller[_0x7439('0x2e')]);var upload=multer({'storage':multer[_0x7439('0x27')]({'destination':function(_0x219133,_0x2c65e1,_0x163a22){_0x163a22(null,path[_0x7439('0x28')](config[_0x7439('0x2f')],_0x7439('0x30')));},'filename':function(_0x4f9d7e,_0x1ce3e1,_0x361097){_0x361097(null,util[_0x7439('0x2a')](_0x7439('0x2b'),Date[_0x7439('0x2c')](),_0x1ce3e1['originalname']));}})});router[_0x7439('0x23')](_0x7439('0x31'),upload['single'](_0x7439('0x32')),controller[_0x7439('0x33')]);var upload=multer({'storage':multer[_0x7439('0x27')]({'destination':function(_0x2b569b,_0x4dbe69,_0x3e743d){_0x3e743d(null,path[_0x7439('0x28')](config[_0x7439('0x2f')],_0x7439('0x30')));},'filename':function(_0x5695a0,_0xf6e438,_0x223675){_0x223675(null,util[_0x7439('0x2a')](_0x7439('0x2b'),Date[_0x7439('0x2c')](),_0xf6e438[_0x7439('0x2d')]));}})});router[_0x7439('0x23')](_0x7439('0x14'),upload['single']('file'),controller[_0x7439('0x34')]);var upload=multer({'storage':multer[_0x7439('0x27')]({'destination':function(_0x597757,_0x2a1e29,_0x26ce2a){_0x26ce2a(null,path[_0x7439('0x28')](config['root'],_0x7439('0x30')));},'filename':function(_0x1898db,_0x12ab2f,_0x18c3b3){_0x18c3b3(null,util[_0x7439('0x2a')](_0x7439('0x2b'),Date[_0x7439('0x2c')](),_0x12ab2f[_0x7439('0x2d')]));}})});router['post'](_0x7439('0x16'),upload[_0x7439('0x35')](_0x7439('0x32')),controller[_0x7439('0x36')]);router[_0x7439('0x23')]('/:id/notify',controller[_0x7439('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x7439('0x27')]({'destination':function(_0x13f5d5,_0x1feabf,_0x5d77c7){const _0x41cae9=path[_0x7439('0x28')](config['root'],_0x7439('0x38'),_0x7439('0x39'),_0x7439('0x3a'));fs_extra[_0x7439('0x3b')](_0x41cae9,function(){_0x5d77c7(null,_0x41cae9);});},'filename':function(_0x5b38aa,_0x562b24,_0x5eb33d){const _0x3472d8=_0x562b24[_0x7439('0x2d')][_0x7439('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a0b1d=path[_0x7439('0x3d')](_0x3472d8);const _0x4ce9a2=Date[_0x7439('0x2c')]()+'-'+_0x3472d8['replace'](_0x2a0b1d,'')+_0x2a0b1d;_0x5eb33d(null,_0x4ce9a2);}})});router[_0x7439('0x23')](_0x7439('0x3e'),offlineUploadMulter[_0x7439('0x3f')](),controller['offline']);router['post']('/:id/interactions',auth[_0x7439('0xa')](),controller[_0x7439('0x40')]);router[_0x7439('0x23')](_0x7439('0x19'),auth[_0x7439('0xa')](),controller[_0x7439('0x41')]);router[_0x7439('0x23')](_0x7439('0x1b'),auth['isAuthenticated'](),controller[_0x7439('0x42')]);router[_0x7439('0x23')](_0x7439('0x21'),auth['isAuthenticated'](),controller[_0x7439('0x43')]);router[_0x7439('0x44')](_0x7439('0xd'),auth[_0x7439('0xa')](),controller[_0x7439('0x45')]);router[_0x7439('0x46')](_0x7439('0xd'),auth['isAuthenticated'](),controller[_0x7439('0x47')]);router[_0x7439('0x46')](_0x7439('0xf'),auth[_0x7439('0xa')](),controller[_0x7439('0x48')]);router[_0x7439('0x46')](_0x7439('0x11'),auth[_0x7439('0xa')](),controller[_0x7439('0x49')]);router[_0x7439('0x46')](_0x7439('0x21'),auth[_0x7439('0xa')](),controller[_0x7439('0x4a')]);module[_0x7439('0x4b')]=router; \ No newline at end of file +var _0x755b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','join','root','format','%s-%s','now','originalname','single','file','diskStorage','server/files/images/avatars/','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','addInteraction','addProactiveActions','addAgents','put','/:id','update','destroy','removeDispositions','removeAnswers','delete','exports','multer','util','path','connect-timeout'];(function(_0x3deb1c,_0x14566d){var _0x4f9f4e=function(_0x39b8a2){while(--_0x39b8a2){_0x3deb1c['push'](_0x3deb1c['shift']());}};_0x4f9f4e(++_0x14566d);}(_0x755b,0x15f));var _0xb755=function(_0x998252,_0x464fbf){_0x998252=_0x998252-0x0;var _0x2c9073=_0x755b[_0x998252];return _0x2c9073;};'use strict';var multer=require(_0xb755('0x0'));var util=require(_0xb755('0x1'));var path=require(_0xb755('0x2'));var timeout=require(_0xb755('0x3'));var express=require('express');var router=express[_0xb755('0x4')]();var fs_extra=require(_0xb755('0x5'));var auth=require(_0xb755('0x6'));var interaction=require(_0xb755('0x7'));var config=require(_0xb755('0x8'));var controller=require(_0xb755('0x9'));router[_0xb755('0xa')]('/',auth[_0xb755('0xb')](),controller[_0xb755('0xc')]);router[_0xb755('0xa')](_0xb755('0xd'),auth[_0xb755('0xb')](),controller[_0xb755('0xe')]);router[_0xb755('0xa')]('/:id',auth[_0xb755('0xb')](),controller[_0xb755('0xf')]);router[_0xb755('0xa')](_0xb755('0x10'),auth[_0xb755('0xb')](),controller[_0xb755('0x11')]);router[_0xb755('0xa')]('/:id/canned_answers',auth[_0xb755('0xb')](),controller['getAnswers']);router['get'](_0xb755('0x12'),controller[_0xb755('0x13')]);router[_0xb755('0xa')](_0xb755('0x14'),controller[_0xb755('0x15')]);router[_0xb755('0xa')]('/:id/customer_avatar',controller[_0xb755('0x16')]);router[_0xb755('0xa')]('/:id/system_avatar',controller[_0xb755('0x17')]);router['get'](_0xb755('0x18'),auth[_0xb755('0xb')](),controller[_0xb755('0x19')]);router[_0xb755('0xa')](_0xb755('0x1a'),controller['getSnippet']);router['get'](_0xb755('0x1b'),auth['isAuthenticated'](),controller['getApplications']);router[_0xb755('0xa')](_0xb755('0x1c'),auth[_0xb755('0xb')](),controller[_0xb755('0x1d')]);router['get'](_0xb755('0x1e'),controller['getFields']);router[_0xb755('0xa')](_0xb755('0x1f'),auth[_0xb755('0xb')](),controller['getOfflineMessages']);router[_0xb755('0xa')](_0xb755('0x20'),auth[_0xb755('0xb')](),controller[_0xb755('0x21')]);router[_0xb755('0x22')]('/',auth[_0xb755('0xb')](),controller['create']);router[_0xb755('0x22')](_0xb755('0x10'),auth[_0xb755('0xb')](),controller['addDisposition']);router[_0xb755('0x22')](_0xb755('0x23'),auth['isAuthenticated'](),controller[_0xb755('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d8cb1,_0x326873,_0x354809){_0x354809(null,path[_0xb755('0x25')](config[_0xb755('0x26')],'server/files/images/logos/'));},'filename':function(_0x112d63,_0x5215c8,_0x4ff422){_0x4ff422(null,util[_0xb755('0x27')](_0xb755('0x28'),Date[_0xb755('0x29')](),_0x5215c8[_0xb755('0x2a')]));}})});router['post'](_0xb755('0x12'),upload[_0xb755('0x2b')](_0xb755('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0xb755('0x2d')]({'destination':function(_0x148c50,_0x5e10ff,_0xa720e){_0xa720e(null,path[_0xb755('0x25')](config[_0xb755('0x26')],_0xb755('0x2e')));},'filename':function(_0x473826,_0x59c2e7,_0x50374d){_0x50374d(null,util['format'](_0xb755('0x28'),Date[_0xb755('0x29')](),_0x59c2e7[_0xb755('0x2a')]));}})});router['post'](_0xb755('0x14'),upload['single'](_0xb755('0x2c')),controller[_0xb755('0x2f')]);var upload=multer({'storage':multer[_0xb755('0x2d')]({'destination':function(_0xdfeb7,_0x2a1be9,_0xc77551){_0xc77551(null,path[_0xb755('0x25')](config[_0xb755('0x26')],_0xb755('0x2e')));},'filename':function(_0x5d0825,_0x553a29,_0x2e579a){_0x2e579a(null,util[_0xb755('0x27')](_0xb755('0x28'),Date[_0xb755('0x29')](),_0x553a29[_0xb755('0x2a')]));}})});router[_0xb755('0x22')](_0xb755('0x30'),upload[_0xb755('0x2b')](_0xb755('0x2c')),controller[_0xb755('0x31')]);var upload=multer({'storage':multer[_0xb755('0x2d')]({'destination':function(_0x5513b8,_0x183ee6,_0xb37772){_0xb37772(null,path[_0xb755('0x25')](config[_0xb755('0x26')],_0xb755('0x2e')));},'filename':function(_0x2dc8ec,_0x3c02db,_0x4e8aad){_0x4e8aad(null,util[_0xb755('0x27')](_0xb755('0x28'),Date[_0xb755('0x29')](),_0x3c02db[_0xb755('0x2a')]));}})});router['post'](_0xb755('0x32'),upload[_0xb755('0x2b')](_0xb755('0x2c')),controller[_0xb755('0x33')]);router[_0xb755('0x22')](_0xb755('0x34'),controller[_0xb755('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x56038d,_0x38bca6,_0x2f0acb){const _0x3f1e9e=path[_0xb755('0x25')](config['root'],_0xb755('0x36'),_0xb755('0x37'),'offline-chat');fs_extra[_0xb755('0x38')](_0x3f1e9e,function(){_0x2f0acb(null,_0x3f1e9e);});},'filename':function(_0x1fd7d2,_0x15d626,_0x54be25){const _0xc52509=_0x15d626[_0xb755('0x2a')][_0xb755('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2555fe=path[_0xb755('0x3a')](_0xc52509);const _0x4c679f=Date['now']()+'-'+_0xc52509[_0xb755('0x39')](_0x2555fe,'')+_0x2555fe;_0x54be25(null,_0x4c679f);}})});router['post'](_0xb755('0x3b'),offlineUploadMulter['any'](),controller['offline']);router[_0xb755('0x22')](_0xb755('0x18'),auth[_0xb755('0xb')](),controller[_0xb755('0x3c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xb755('0x22')](_0xb755('0x1c'),auth[_0xb755('0xb')](),controller[_0xb755('0x3d')]);router[_0xb755('0x22')]('/:id/users',auth[_0xb755('0xb')](),controller[_0xb755('0x3e')]);router[_0xb755('0x3f')](_0xb755('0x40'),auth[_0xb755('0xb')](),controller[_0xb755('0x41')]);router['delete'](_0xb755('0x40'),auth[_0xb755('0xb')](),controller[_0xb755('0x42')]);router['delete']('/:id/dispositions',auth[_0xb755('0xb')](),controller[_0xb755('0x43')]);router['delete'](_0xb755('0x23'),auth[_0xb755('0xb')](),controller[_0xb755('0x44')]);router[_0xb755('0x45')](_0xb755('0x20'),auth[_0xb755('0xb')](),controller['removeAgents']);module[_0xb755('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3b560cc..09eca4c 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 _0xa498=['STRING','Google','exports'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0xa498,0x1d6));var _0x8a49=function(_0x43f552,_0x42808c){_0x43f552=_0x43f552-0x0;var _0x17911b=_0xa498[_0x43f552];return _0x17911b;};'use strict';var Sequelize=require('sequelize');module[_0x8a49('0x0')]={'name':{'type':Sequelize[_0x8a49('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x8a49('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8a49('0x1')]},'data2':{'type':Sequelize[_0x8a49('0x1')]}}; \ No newline at end of file +var _0xaa48=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x3b2737,_0xba806c){var _0x4120b7=function(_0x349ef3){while(--_0x349ef3){_0x3b2737['push'](_0x3b2737['shift']());}};_0x4120b7(++_0xba806c);}(_0xaa48,0x15a));var _0x8aa4=function(_0x5d5db4,_0x1a1cf2){_0x5d5db4=_0x5d5db4-0x0;var _0xa154ab=_0xaa48[_0x5d5db4];return _0xa154ab;};'use strict';var Sequelize=require(_0x8aa4('0x0'));module[_0x8aa4('0x1')]={'name':{'type':Sequelize[_0x8aa4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8aa4('0x3')](_0x8aa4('0x4'),_0x8aa4('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8aa4('0x2')]},'data2':{'type':Sequelize[_0x8aa4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ea56782..9acca54 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CloudProvider','fieldName','type','key'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xadb5,0xad));var _0x5adb=function(_0x139a61,_0x5dff02){_0x139a61=_0x139a61-0x0;var _0x25489a=_0xadb5[_0x139a61];return _0x25489a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CloudProvider']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0x5f66=['update','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x565c63,_0x1c67d9){var _0x517759=function(_0x54256e){while(--_0x54256e){_0x565c63['push'](_0x565c63['shift']());}};_0x517759(++_0x1c67d9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 61ad5ef..0a24fd8 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 _0x13bb=['exports','define','CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x13bb,0x19b));var _0xb13b=function(_0x22697e,_0x53f601){_0x22697e=_0x22697e-0x0;var _0xd20b6b=_0x13bb[_0x22697e];return _0xd20b6b;};'use strict';var _=require('lodash');var util=require(_0xb13b('0x0'));var logger=require(_0xb13b('0x1'))(_0xb13b('0x2'));var moment=require(_0xb13b('0x3'));var BPromise=require(_0xb13b('0x4'));var rp=require(_0xb13b('0x5'));var fs=require('fs');var path=require(_0xb13b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xb13b('0x7')]=function(_0x4e83d8,_0xb9881a){return _0x4e83d8[_0xb13b('0x8')](_0xb13b('0x9'),attributes,{'tableName':_0xb13b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c11=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0xa2778b,_0x3f70a0){var _0x2fe5d5=function(_0x10e9a3){while(--_0x10e9a3){_0xa2778b['push'](_0xa2778b['shift']());}};_0x2fe5d5(++_0x3f70a0);}(_0x5c11,0x8c));var _0x15c1=function(_0x3ace8,_0x4bf514){_0x3ace8=_0x3ace8-0x0;var _0x4968d3=_0x5c11[_0x3ace8];return _0x4968d3;};'use strict';var _=require(_0x15c1('0x0'));var util=require(_0x15c1('0x1'));var logger=require(_0x15c1('0x2'))(_0x15c1('0x3'));var moment=require(_0x15c1('0x4'));var BPromise=require(_0x15c1('0x5'));var rp=require(_0x15c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15c1('0x7'));var config=require(_0x15c1('0x8'));var attributes=require(_0x15c1('0x9'));module['exports']=function(_0x3aea19,_0x41de72){return _0x3aea19[_0x15c1('0xa')](_0x15c1('0xb'),attributes,{'tableName':_0x15c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 88f5768..cba6e9d 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 _0xd05a=['info','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd05a,0x143));var _0xad05=function(_0x5d7b78,_0x21ee2b){_0x5d7b78=_0x5d7b78-0x0;var _0x1ca2bc=_0xd05a[_0x5d7b78];return _0x1ca2bc;};'use strict';var _=require('lodash');var util=require(_0xad05('0x0'));var moment=require(_0xad05('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad05('0x2'));var logger=require(_0xad05('0x3'))(_0xad05('0x4'));var config=require(_0xad05('0x5'));var jayson=require(_0xad05('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39ddaf,_0x45303c,_0xd12d76){return new BPromise(function(_0x565f85,_0x17ec26){return client[_0xad05('0x7')](_0x39ddaf,_0xd12d76)[_0xad05('0x8')](function(_0x573acb){logger['info'](_0xad05('0x9'),_0x45303c,'request\x20sent');logger[_0xad05('0xa')](_0xad05('0xb'),_0x45303c,_0xad05('0xc'),JSON[_0xad05('0xd')](_0x573acb));if(_0x573acb[_0xad05('0xe')]){if(_0x573acb[_0xad05('0xe')][_0xad05('0xf')]===0x1f4){logger[_0xad05('0xe')](_0xad05('0x9'),_0x45303c,_0x573acb[_0xad05('0xe')]['message']);return _0x17ec26(_0x573acb[_0xad05('0xe')]['message']);}logger[_0xad05('0xe')]('CloudProvider,\x20%s,\x20%s',_0x45303c,_0x573acb[_0xad05('0xe')][_0xad05('0x10')]);return _0x565f85(_0x573acb[_0xad05('0xe')]['message']);}else{logger[_0xad05('0x11')]('CloudProvider,\x20%s,\x20%s',_0x45303c,_0xad05('0xc'));_0x565f85(_0x573acb[_0xad05('0x12')][_0xad05('0x10')]);}})[_0xad05('0x13')](function(_0x43ab03){logger[_0xad05('0xe')]('CloudProvider,\x20%s,\x20%s',_0x45303c,_0x43ab03);_0x17ec26(_0x43ab03);});});} \ No newline at end of file +var _0xb6a6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util'];(function(_0x5f50b5,_0xa8db83){var _0x54c383=function(_0x381334){while(--_0x381334){_0x5f50b5['push'](_0x5f50b5['shift']());}};_0x54c383(++_0xa8db83);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x24047a,_0x1dae10){_0x24047a=_0x24047a-0x0;var _0x5641b5=_0xb6a6[_0x24047a];return _0x5641b5;};'use strict';var _=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b6a('0x2'));var fs=require('fs');var Redis=require(_0x6b6a('0x3'));var db=require(_0x6b6a('0x4'))['db'];var utils=require(_0x6b6a('0x5'));var logger=require(_0x6b6a('0x6'))('rpc');var config=require(_0x6b6a('0x7'));var jayson=require(_0x6b6a('0x8'));var client=jayson[_0x6b6a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad201,_0x1895f7,_0x59e90c){return new BPromise(function(_0x43f878,_0x15ccc9){return client['request'](_0x3ad201,_0x59e90c)[_0x6b6a('0xa')](function(_0x58ff98){logger[_0x6b6a('0xb')](_0x6b6a('0xc'),_0x1895f7,_0x6b6a('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1895f7,_0x6b6a('0xd'),JSON[_0x6b6a('0xe')](_0x58ff98));if(_0x58ff98['error']){if(_0x58ff98['error'][_0x6b6a('0xf')]===0x1f4){logger[_0x6b6a('0x10')]('CloudProvider,\x20%s,\x20%s',_0x1895f7,_0x58ff98[_0x6b6a('0x10')][_0x6b6a('0x11')]);return _0x15ccc9(_0x58ff98['error'][_0x6b6a('0x11')]);}logger[_0x6b6a('0x10')]('CloudProvider,\x20%s,\x20%s',_0x1895f7,_0x58ff98[_0x6b6a('0x10')][_0x6b6a('0x11')]);return _0x43f878(_0x58ff98[_0x6b6a('0x10')][_0x6b6a('0x11')]);}else{logger['info'](_0x6b6a('0xc'),_0x1895f7,_0x6b6a('0xd'));_0x43f878(_0x58ff98['result'][_0x6b6a('0x11')]);}})[_0x6b6a('0x12')](function(_0x126189){logger[_0x6b6a('0x10')](_0x6b6a('0xc'),_0x1895f7,_0x126189);_0x15ccc9(_0x126189);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 3c1dd51..f7693d3 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 _0x6d37=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer'];(function(_0x18f72d,_0x9e8fd8){var _0x90e84d=function(_0x467c0d){while(--_0x467c0d){_0x18f72d['push'](_0x18f72d['shift']());}};_0x90e84d(++_0x9e8fd8);}(_0x6d37,0x18e));var _0x76d3=function(_0x11967b,_0x5511c1){_0x11967b=_0x11967b-0x0;var _0x3fa585=_0x6d37[_0x11967b];return _0x3fa585;};'use strict';var multer=require(_0x76d3('0x0'));var util=require(_0x76d3('0x1'));var path=require(_0x76d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x76d3('0x3'));var router=express[_0x76d3('0x4')]();var fs_extra=require(_0x76d3('0x5'));var auth=require(_0x76d3('0x6'));var interaction=require(_0x76d3('0x7'));var config=require(_0x76d3('0x8'));var controller=require(_0x76d3('0x9'));router[_0x76d3('0xa')]('/',auth['isAuthenticated'](),controller[_0x76d3('0xb')]);router['get'](_0x76d3('0xc'),auth[_0x76d3('0xd')](),controller[_0x76d3('0xe')]);router[_0x76d3('0xf')]('/',auth[_0x76d3('0xd')](),controller[_0x76d3('0x10')]);router[_0x76d3('0x11')](_0x76d3('0xc'),auth[_0x76d3('0xd')](),controller['update']);router[_0x76d3('0x12')]('/:id',auth[_0x76d3('0xd')](),controller[_0x76d3('0x13')]);module[_0x76d3('0x14')]=router; \ No newline at end of file +var _0xe2ab=['post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','get','show'];(function(_0x1f4a04,_0xe94ea4){var _0x571e6c=function(_0x3dc438){while(--_0x3dc438){_0x1f4a04['push'](_0x1f4a04['shift']());}};_0x571e6c(++_0xe94ea4);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x487466,_0x5ef7ca){_0x487466=_0x487466-0x0;var _0x357288=_0xe2ab[_0x487466];return _0x357288;};'use strict';var multer=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var path=require(_0xbe2a('0x2'));var timeout=require(_0xbe2a('0x3'));var express=require(_0xbe2a('0x4'));var router=express[_0xbe2a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbe2a('0x6'));var interaction=require(_0xbe2a('0x7'));var config=require(_0xbe2a('0x8'));var controller=require(_0xbe2a('0x9'));router['get']('/',auth[_0xbe2a('0xa')](),controller['index']);router[_0xbe2a('0xb')]('/:id',auth[_0xbe2a('0xa')](),controller[_0xbe2a('0xc')]);router[_0xbe2a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbe2a('0xe')](_0xbe2a('0xf'),auth['isAuthenticated'](),controller[_0xbe2a('0x10')]);router[_0xbe2a('0x11')](_0xbe2a('0xf'),auth[_0xbe2a('0xa')](),controller[_0xbe2a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 910f149..aa3e58a 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 _0x86d7=['exports','STRING','name','sequelize'];(function(_0x38fc43,_0x3f6da7){var _0x105d2b=function(_0xfdb936){while(--_0xfdb936){_0x38fc43['push'](_0x38fc43['shift']());}};_0x105d2b(++_0x3f6da7);}(_0x86d7,0x8b));var _0x786d=function(_0x220a5c,_0x28c337){_0x220a5c=_0x220a5c-0x0;var _0x17997e=_0x86d7[_0x220a5c];return _0x17997e;};'use strict';var Sequelize=require(_0x786d('0x0'));module[_0x786d('0x1')]={'name':{'type':Sequelize[_0x786d('0x2')],'unique':_0x786d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x786d('0x2')]},'companyId':{'type':Sequelize[_0x786d('0x2')]},'website':{'type':Sequelize[_0x786d('0x2')]},'phone':{'type':Sequelize[_0x786d('0x2')]},'fax':{'type':Sequelize[_0x786d('0x2')]},'type':{'type':Sequelize[_0x786d('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x786d('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x786d('0x2')]},'email':{'type':Sequelize[_0x786d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x786d('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x786d('0x2')]},'sCity':{'type':Sequelize[_0x786d('0x2')]},'sCountry':{'type':Sequelize[_0x786d('0x2')]},'description':{'type':Sequelize[_0x786d('0x2')]}}; \ No newline at end of file +var _0xa5a4=['name','sequelize','exports','STRING'];(function(_0x1e606c,_0x4660d9){var _0x6e12b9=function(_0x3bae03){while(--_0x3bae03){_0x1e606c['push'](_0x1e606c['shift']());}};_0x6e12b9(++_0x4660d9);}(_0xa5a4,0x1c5));var _0x4a5a=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xa5a4[_0x1347f8];return _0x218368;};'use strict';var Sequelize=require(_0x4a5a('0x0'));module[_0x4a5a('0x1')]={'name':{'type':Sequelize[_0x4a5a('0x2')],'unique':_0x4a5a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x4a5a('0x2')]},'website':{'type':Sequelize[_0x4a5a('0x2')]},'phone':{'type':Sequelize[_0x4a5a('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4a5a('0x2')]},'street':{'type':Sequelize[_0x4a5a('0x2')]},'postalCode':{'type':Sequelize[_0x4a5a('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4a5a('0x2')]},'email':{'type':Sequelize[_0x4a5a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4a5a('0x2')]},'sStreet':{'type':Sequelize[_0x4a5a('0x2')]},'sPostalCode':{'type':Sequelize[_0x4a5a('0x2')]},'sCity':{'type':Sequelize[_0x4a5a('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4a5a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 52542ca..9736f84 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 _0xf9dd=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','omit','getContacts','findOne','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','options','includeAll','findAll','rows','catch','show','rawAttributes','include','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x338e1c,_0x55c25d){var _0x48d1fb=function(_0x5de705){while(--_0x5de705){_0x338e1c['push'](_0x338e1c['shift']());}};_0x48d1fb(++_0x55c25d);}(_0xf9dd,0x1af));var _0xdf9d=function(_0x3cf54a,_0x358eca){_0x3cf54a=_0x3cf54a-0x0;var _0xabe334=_0xf9dd[_0x3cf54a];return _0xabe334;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf9d('0x0'));var jsonpatch=require(_0xdf9d('0x1'));var rp=require(_0xdf9d('0x2'));var moment=require('moment');var BPromise=require(_0xdf9d('0x3'));var Mustache=require(_0xdf9d('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdf9d('0x5'));var ejs=require(_0xdf9d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdf9d('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xdf9d('0x8'));var toCsv=require(_0xdf9d('0x5'));var querystring=require(_0xdf9d('0x9'));var Papa=require(_0xdf9d('0xa'));var Redis=require(_0xdf9d('0xb'));var authService=require(_0xdf9d('0xc'));var qs=require(_0xdf9d('0xd'));var as=require(_0xdf9d('0xe'));var hardwareService=require(_0xdf9d('0xf'));var logger=require(_0xdf9d('0x10'))(_0xdf9d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdf9d('0x12'));var db=require(_0xdf9d('0x13'))['db'];function respondWithStatusCode(_0x109f66,_0x45ab22){_0x45ab22=_0x45ab22||0xcc;return function(_0xed1821){if(_0xed1821){return _0x109f66[_0xdf9d('0x14')](_0x45ab22);}return _0x109f66[_0xdf9d('0x15')](_0x45ab22)[_0xdf9d('0x16')]();};}function respondWithResult(_0x3b91db,_0x5ca041){_0x5ca041=_0x5ca041||0xc8;return function(_0x523ea0){if(_0x523ea0){return _0x3b91db['status'](_0x5ca041)[_0xdf9d('0x17')](_0x523ea0);}};}function respondWithFilteredResult(_0xd115c0,_0x1de454){return function(_0x124b57){if(_0x124b57){var _0x219ca7=typeof _0x1de454[_0xdf9d('0x18')]===_0xdf9d('0x19')&&typeof _0x1de454['limit']===_0xdf9d('0x19');var _0x1c55d8=_0x124b57[_0xdf9d('0x1a')];var _0x388472=_0x219ca7?0x0:_0x1de454[_0xdf9d('0x18')];var _0x346ca8=_0x219ca7?_0x124b57[_0xdf9d('0x1a')]:_0x1de454[_0xdf9d('0x18')]+_0x1de454[_0xdf9d('0x1b')];var _0x2a27c0;if(_0x346ca8>=_0x1c55d8){_0x346ca8=_0x1c55d8;_0x2a27c0=0xc8;}else{_0x2a27c0=0xce;}_0xd115c0['status'](_0x2a27c0);return _0xd115c0[_0xdf9d('0x1c')]('Content-Range',_0x388472+'-'+_0x346ca8+'/'+_0x1c55d8)[_0xdf9d('0x17')](_0x124b57);}return null;};}function patchUpdates(_0x3b94b0){return function(_0x3cf72f){try{jsonpatch[_0xdf9d('0x1d')](_0x3cf72f,_0x3b94b0,!![]);}catch(_0x117832){return BPromise['reject'](_0x117832);}return _0x3cf72f[_0xdf9d('0x1e')]();};}function saveUpdates(_0x3b799e,_0x3e69d5){return function(_0x593e4f){if(_0x593e4f){return _0x593e4f[_0xdf9d('0x1f')](_0x3b799e)[_0xdf9d('0x20')](function(_0x16b319){return _0x16b319;});}return null;};}function removeEntity(_0x1bbd6b,_0x4da3b4){return function(_0x5c5017){if(_0x5c5017){return _0x5c5017[_0xdf9d('0x21')]()[_0xdf9d('0x20')](function(){var _0x2c9b47=_0x5c5017[_0xdf9d('0x22')]({'plain':!![]});var _0x300fd0=_0xdf9d('0x23');return db[_0xdf9d('0x24')]['destroy']({'where':{'type':_0x300fd0,'resourceId':_0x2c9b47['id']}})['then'](function(){return _0x5c5017;});})['then'](function(){_0x1bbd6b[_0xdf9d('0x15')](0xcc)[_0xdf9d('0x16')]();});}};}function handleEntityNotFound(_0x193dfd,_0x1c7537){return function(_0x388eb1){if(!_0x388eb1){_0x193dfd[_0xdf9d('0x14')](0x194);}return _0x388eb1;};}function handleError(_0x1662ab,_0x15ee2d){_0x15ee2d=_0x15ee2d||0x1f4;return function(_0x485f5f){logger[_0xdf9d('0x25')](_0x485f5f[_0xdf9d('0x26')]);if(_0x485f5f[_0xdf9d('0x27')]){delete _0x485f5f[_0xdf9d('0x27')];}_0x1662ab['status'](_0x15ee2d)['send'](_0x485f5f);};}exports[_0xdf9d('0x28')]=function(_0x52679e,_0x109142){var _0x2ebda9={},_0x5166c6={},_0x493e9c={'count':0x0,'rows':[]};return db[_0xdf9d('0x29')][_0xdf9d('0x2a')]()[_0xdf9d('0x20')](function(_0x560ed1){_0x5166c6[_0xdf9d('0x2b')]=_[_0xdf9d('0x2c')](_0x560ed1);_0x5166c6[_0xdf9d('0x2d')]=_[_0xdf9d('0x2c')](_0x52679e['query']);_0x5166c6[_0xdf9d('0x2e')]=_[_0xdf9d('0x2f')](_0x5166c6[_0xdf9d('0x2b')],_0x5166c6[_0xdf9d('0x2d')]);_0x2ebda9[_0xdf9d('0x30')]=_[_0xdf9d('0x2f')](_0x5166c6['model'],qs[_0xdf9d('0x31')](_0x52679e[_0xdf9d('0x2d')]['fields']));_0x2ebda9[_0xdf9d('0x30')]=_0x2ebda9['attributes'][_0xdf9d('0x32')]?_0x2ebda9[_0xdf9d('0x30')]:_0x5166c6['model'];if(!_0x52679e[_0xdf9d('0x2d')][_0xdf9d('0x33')](_0xdf9d('0x34'))){_0x2ebda9[_0xdf9d('0x1b')]=qs[_0xdf9d('0x1b')](_0x52679e[_0xdf9d('0x2d')][_0xdf9d('0x1b')]);_0x2ebda9[_0xdf9d('0x18')]=qs['offset'](_0x52679e[_0xdf9d('0x2d')]['offset']);}_0x2ebda9[_0xdf9d('0x35')]=qs[_0xdf9d('0x36')](_0x52679e[_0xdf9d('0x2d')]['sort']);_0x2ebda9[_0xdf9d('0x37')]=qs[_0xdf9d('0x2e')](_[_0xdf9d('0x38')](_0x52679e[_0xdf9d('0x2d')],_0x5166c6[_0xdf9d('0x2e')]),_0x560ed1);if(_0x52679e[_0xdf9d('0x2d')][_0xdf9d('0x39')]){_0x2ebda9[_0xdf9d('0x37')]=_['merge'](_0x2ebda9[_0xdf9d('0x37')],{'$or':_[_0xdf9d('0x3a')](_0x2ebda9[_0xdf9d('0x30')],function(_0x1f7a4c){var _0x372053={};_0x372053[_0x1f7a4c]={'$like':'%'+_0x52679e['query'][_0xdf9d('0x39')]+'%'};return _0x372053;})});}_0x2ebda9=_['merge']({},_0x2ebda9,_0x52679e[_0xdf9d('0x3b')]);var _0x554177={'where':_0x2ebda9['where']};return db['CmCompany'][_0xdf9d('0x1a')](_0x554177)[_0xdf9d('0x20')](function(_0x498704){_0x493e9c[_0xdf9d('0x1a')]=_0x498704;if(_0x52679e[_0xdf9d('0x2d')][_0xdf9d('0x3c')]){_0x2ebda9['include']=[{'all':!![]}];}return db[_0xdf9d('0x29')][_0xdf9d('0x3d')](_0x2ebda9);})[_0xdf9d('0x20')](function(_0xdded59){_0x493e9c[_0xdf9d('0x3e')]=_0xdded59;return _0x493e9c;})['then'](respondWithFilteredResult(_0x109142,_0x2ebda9))[_0xdf9d('0x3f')](handleError(_0x109142,null));})['catch'](handleError(_0x109142,null));};exports[_0xdf9d('0x40')]=function(_0xfa71f3,_0x9a288){var _0x4d3624={'raw':![],'where':{'id':_0xfa71f3['params']['id']}},_0x3b0e9b={};_0x3b0e9b[_0xdf9d('0x2b')]=_[_0xdf9d('0x2c')](db[_0xdf9d('0x29')][_0xdf9d('0x41')]);_0x3b0e9b[_0xdf9d('0x2d')]=_[_0xdf9d('0x2c')](_0xfa71f3[_0xdf9d('0x2d')]);_0x3b0e9b[_0xdf9d('0x2e')]=_[_0xdf9d('0x2f')](_0x3b0e9b[_0xdf9d('0x2b')],_0x3b0e9b[_0xdf9d('0x2d')]);_0x4d3624[_0xdf9d('0x30')]=_[_0xdf9d('0x2f')](_0x3b0e9b[_0xdf9d('0x2b')],qs['fields'](_0xfa71f3[_0xdf9d('0x2d')][_0xdf9d('0x31')]));_0x4d3624[_0xdf9d('0x30')]=_0x4d3624['attributes'][_0xdf9d('0x32')]?_0x4d3624[_0xdf9d('0x30')]:_0x3b0e9b[_0xdf9d('0x2b')];if(_0xfa71f3[_0xdf9d('0x2d')]['includeAll']){_0x4d3624[_0xdf9d('0x42')]=[{'all':!![]}];}_0x4d3624=_[_0xdf9d('0x43')]({},_0x4d3624,_0xfa71f3[_0xdf9d('0x3b')]);return db[_0xdf9d('0x29')][_0xdf9d('0x44')](_0x4d3624)['then'](handleEntityNotFound(_0x9a288,null))[_0xdf9d('0x20')](respondWithResult(_0x9a288,null))['catch'](handleError(_0x9a288,null));};exports['create']=function(_0x1b2518,_0x306f9f){return db[_0xdf9d('0x29')][_0xdf9d('0x45')](_0x1b2518['body'],{})[_0xdf9d('0x20')](function(_0x401dd1){var _0x9b028=_0x1b2518[_0xdf9d('0x46')][_0xdf9d('0x22')]({'plain':!![]});if(!_0x9b028)throw new Error(_0xdf9d('0x47'));if(_0x9b028[_0xdf9d('0x48')]===_0xdf9d('0x46')){var _0x1721d2=_0x401dd1['get']({'plain':!![]});var _0x26e1e5='Companies';return db[_0xdf9d('0x49')]['find']({'where':{'name':_0x26e1e5,'userProfileId':_0x9b028[_0xdf9d('0x4a')]},'raw':!![]})['then'](function(_0x10ebd4){if(_0x10ebd4&&_0x10ebd4[_0xdf9d('0x4b')]===0x0){return db[_0xdf9d('0x24')][_0xdf9d('0x45')]({'name':_0x1721d2[_0xdf9d('0x27')],'resourceId':_0x1721d2['id'],'type':_0x10ebd4['name'],'sectionId':_0x10ebd4['id']},{})['then'](function(){return _0x401dd1;});}else{return _0x401dd1;}})[_0xdf9d('0x3f')](function(_0x15d683){logger[_0xdf9d('0x25')](_0xdf9d('0x4c'),_0x15d683);throw _0x15d683;});}return _0x401dd1;})[_0xdf9d('0x20')](respondWithResult(_0x306f9f,0xc9))[_0xdf9d('0x3f')](handleError(_0x306f9f,null));};exports[_0xdf9d('0x1f')]=function(_0x24b456,_0xe5032b){if(_0x24b456['body']['id']){delete _0x24b456[_0xdf9d('0x4d')]['id'];}return db['CmCompany'][_0xdf9d('0x44')]({'where':{'id':_0x24b456[_0xdf9d('0x4e')]['id']}})[_0xdf9d('0x20')](handleEntityNotFound(_0xe5032b,null))[_0xdf9d('0x20')](saveUpdates(_0x24b456[_0xdf9d('0x4d')],null))[_0xdf9d('0x20')](respondWithResult(_0xe5032b,null))['catch'](handleError(_0xe5032b,null));};exports['destroy']=function(_0x11659c,_0x1d2344){return db[_0xdf9d('0x29')][_0xdf9d('0x44')]({'where':{'id':_0x11659c[_0xdf9d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d2344,null))[_0xdf9d('0x20')](removeEntity(_0x1d2344,null))['catch'](handleError(_0x1d2344,null));};exports[_0xdf9d('0x2a')]=function(_0x552c33,_0x36d308){return db[_0xdf9d('0x29')][_0xdf9d('0x2a')]()[_0xdf9d('0x20')](respondWithResult(_0x36d308,null))[_0xdf9d('0x3f')](handleError(_0x36d308,null));};exports[_0xdf9d('0x4f')]=function(_0x4bc8e5,_0x384335,_0x3352d7){return db[_0xdf9d('0x50')][_0xdf9d('0x44')]({'where':{'id':_0x4bc8e5[_0xdf9d('0x4e')]['id']}})[_0xdf9d('0x20')](handleEntityNotFound(_0x384335,null))[_0xdf9d('0x20')](function(_0xd8881c){if(_0xd8881c){return _0xd8881c['addContacts'](_0x4bc8e5['body']['ids'],_[_0xdf9d('0x51')](_0x4bc8e5['body'],['ids','id'])||{});}})[_0xdf9d('0x20')](respondWithResult(_0x384335,null))[_0xdf9d('0x3f')](handleError(_0x384335,null));};exports[_0xdf9d('0x52')]=function(_0xf3dea,_0x5e1439,_0x279843){var _0x3bc1ef={};var _0xc5eb28={};var _0x5327d1;var _0x540e97;return db[_0xdf9d('0x29')][_0xdf9d('0x53')]({'where':{'id':_0xf3dea[_0xdf9d('0x4e')]['id']}})[_0xdf9d('0x20')](handleEntityNotFound(_0x5e1439,null))['then'](function(_0xd76621){if(_0xd76621){_0x5327d1=_0xd76621;_0xc5eb28[_0xdf9d('0x2b')]=_[_0xdf9d('0x2c')](db[_0xdf9d('0x50')][_0xdf9d('0x41')]);_0xc5eb28[_0xdf9d('0x2d')]=_[_0xdf9d('0x2c')](_0xf3dea[_0xdf9d('0x2d')]);_0xc5eb28[_0xdf9d('0x2e')]=_['intersection'](_0xc5eb28[_0xdf9d('0x2b')],_0xc5eb28[_0xdf9d('0x2d')]);_0x3bc1ef[_0xdf9d('0x30')]=_['intersection'](_0xc5eb28[_0xdf9d('0x2b')],qs[_0xdf9d('0x31')](_0xf3dea['query'][_0xdf9d('0x31')]));_0x3bc1ef[_0xdf9d('0x30')]=_0x3bc1ef[_0xdf9d('0x30')][_0xdf9d('0x32')]?_0x3bc1ef[_0xdf9d('0x30')]:_0xc5eb28['model'];_0x3bc1ef['order']=qs[_0xdf9d('0x36')](_0xf3dea[_0xdf9d('0x2d')][_0xdf9d('0x36')]);_0x3bc1ef['where']=qs[_0xdf9d('0x2e')](_[_0xdf9d('0x38')](_0xf3dea[_0xdf9d('0x2d')],_0xc5eb28[_0xdf9d('0x2e')]));if(_0xf3dea[_0xdf9d('0x2d')]['filter']){_0x3bc1ef[_0xdf9d('0x37')]=_[_0xdf9d('0x43')](_0x3bc1ef[_0xdf9d('0x37')],{'$or':_['map'](_0x3bc1ef[_0xdf9d('0x30')],function(_0x204db3){var _0x154aba={};_0x154aba[_0x204db3]={'$like':'%'+_0xf3dea[_0xdf9d('0x2d')][_0xdf9d('0x39')]+'%'};return _0x154aba;})});}_0x3bc1ef=_[_0xdf9d('0x43')]({},_0x3bc1ef,_0xf3dea['options']);return _0x5327d1['getContacts'](_0x3bc1ef);}})[_0xdf9d('0x20')](function(_0x3cfb2f){if(_0x3cfb2f){_0x540e97=_0x3cfb2f[_0xdf9d('0x32')];if(!_0xf3dea[_0xdf9d('0x2d')][_0xdf9d('0x33')]('nolimit')){_0x3bc1ef[_0xdf9d('0x1b')]=qs[_0xdf9d('0x1b')](_0xf3dea[_0xdf9d('0x2d')][_0xdf9d('0x1b')]);_0x3bc1ef['offset']=qs['offset'](_0xf3dea[_0xdf9d('0x2d')][_0xdf9d('0x18')]);}return _0x5327d1[_0xdf9d('0x52')](_0x3bc1ef);}})['then'](function(_0x42e52b){if(_0x42e52b){return _0x42e52b?{'count':_0x540e97,'rows':_0x42e52b}:null;}})['then'](respondWithResult(_0x5e1439,null))[_0xdf9d('0x3f')](handleError(_0x5e1439,null));}; \ No newline at end of file +var _0x1030=['rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','omit','ids','findOne','CmContact','filter','getContacts','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','include','findAll','rows','catch','show','params'];(function(_0x19c5dd,_0x2a35f5){var _0x40218d=function(_0x1a07ad){while(--_0x1a07ad){_0x19c5dd['push'](_0x19c5dd['shift']());}};_0x40218d(++_0x2a35f5);}(_0x1030,0x172));var _0x0103=function(_0x3223db,_0x2088f9){_0x3223db=_0x3223db-0x0;var _0x22a13b=_0x1030[_0x3223db];return _0x22a13b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0103('0x0'));var zipdir=require(_0x0103('0x1'));var jsonpatch=require(_0x0103('0x2'));var rp=require('request-promise');var moment=require(_0x0103('0x3'));var BPromise=require(_0x0103('0x4'));var Mustache=require(_0x0103('0x5'));var util=require(_0x0103('0x6'));var path=require(_0x0103('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0103('0x8'));var _=require(_0x0103('0x9'));var squel=require('squel');var crypto=require(_0x0103('0xa'));var jsforce=require(_0x0103('0xb'));var deskjs=require(_0x0103('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0103('0xd'));var Papa=require(_0x0103('0xe'));var Redis=require(_0x0103('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0103('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0103('0x11'));var logger=require(_0x0103('0x12'))(_0x0103('0x13'));var utils=require(_0x0103('0x14'));var config=require(_0x0103('0x15'));var licenseUtil=require(_0x0103('0x16'));var db=require(_0x0103('0x17'))['db'];function respondWithStatusCode(_0x349fa4,_0x4244b7){_0x4244b7=_0x4244b7||0xcc;return function(_0xc63297){if(_0xc63297){return _0x349fa4['sendStatus'](_0x4244b7);}return _0x349fa4[_0x0103('0x18')](_0x4244b7)[_0x0103('0x19')]();};}function respondWithResult(_0x26524a,_0x2eb01d){_0x2eb01d=_0x2eb01d||0xc8;return function(_0x1dc6c0){if(_0x1dc6c0){return _0x26524a[_0x0103('0x18')](_0x2eb01d)[_0x0103('0x1a')](_0x1dc6c0);}};}function respondWithFilteredResult(_0xa54158,_0x4ebf53){return function(_0x1c7e46){if(_0x1c7e46){var _0x1a3689=typeof _0x4ebf53['offset']===_0x0103('0x1b')&&typeof _0x4ebf53[_0x0103('0x1c')]===_0x0103('0x1b');var _0x307752=_0x1c7e46['count'];var _0x4639af=_0x1a3689?0x0:_0x4ebf53[_0x0103('0x1d')];var _0x1dd112=_0x1a3689?_0x1c7e46[_0x0103('0x1e')]:_0x4ebf53[_0x0103('0x1d')]+_0x4ebf53['limit'];var _0x5dbadf;if(_0x1dd112>=_0x307752){_0x1dd112=_0x307752;_0x5dbadf=0xc8;}else{_0x5dbadf=0xce;}_0xa54158[_0x0103('0x18')](_0x5dbadf);return _0xa54158['set'](_0x0103('0x1f'),_0x4639af+'-'+_0x1dd112+'/'+_0x307752)['json'](_0x1c7e46);}return null;};}function patchUpdates(_0x2f5606){return function(_0x516c97){try{jsonpatch[_0x0103('0x20')](_0x516c97,_0x2f5606,!![]);}catch(_0x3d64bc){return BPromise[_0x0103('0x21')](_0x3d64bc);}return _0x516c97[_0x0103('0x22')]();};}function saveUpdates(_0x176be3,_0x2942bb){return function(_0x154989){if(_0x154989){return _0x154989[_0x0103('0x23')](_0x176be3)[_0x0103('0x24')](function(_0x38d979){return _0x38d979;});}return null;};}function removeEntity(_0x150673,_0x36fb75){return function(_0x330f1f){if(_0x330f1f){return _0x330f1f[_0x0103('0x25')]()['then'](function(){var _0x1c4a30=_0x330f1f['get']({'plain':!![]});var _0x2bc997=_0x0103('0x26');return db[_0x0103('0x27')][_0x0103('0x25')]({'where':{'type':_0x2bc997,'resourceId':_0x1c4a30['id']}})[_0x0103('0x24')](function(){return _0x330f1f;});})[_0x0103('0x24')](function(){_0x150673[_0x0103('0x18')](0xcc)[_0x0103('0x19')]();});}};}function handleEntityNotFound(_0x502b25,_0x456478){return function(_0x487eb4){if(!_0x487eb4){_0x502b25[_0x0103('0x28')](0x194);}return _0x487eb4;};}function handleError(_0x59c50b,_0x2e0223){_0x2e0223=_0x2e0223||0x1f4;return function(_0x531773){logger[_0x0103('0x29')](_0x531773[_0x0103('0x2a')]);if(_0x531773[_0x0103('0x2b')]){delete _0x531773[_0x0103('0x2b')];}_0x59c50b[_0x0103('0x18')](_0x2e0223)[_0x0103('0x2c')](_0x531773);};}exports[_0x0103('0x2d')]=function(_0x7f7ecf,_0x1ec31e){var _0x554382={},_0x3ccc96={},_0x1c61e9={'count':0x0,'rows':[]};return db[_0x0103('0x2e')][_0x0103('0x2f')]()[_0x0103('0x24')](function(_0x40eae3){_0x3ccc96[_0x0103('0x30')]=_[_0x0103('0x31')](_0x40eae3);_0x3ccc96[_0x0103('0x32')]=_[_0x0103('0x31')](_0x7f7ecf[_0x0103('0x32')]);_0x3ccc96[_0x0103('0x33')]=_[_0x0103('0x34')](_0x3ccc96[_0x0103('0x30')],_0x3ccc96[_0x0103('0x32')]);_0x554382[_0x0103('0x35')]=_['intersection'](_0x3ccc96[_0x0103('0x30')],qs[_0x0103('0x36')](_0x7f7ecf[_0x0103('0x32')]['fields']));_0x554382['attributes']=_0x554382['attributes'][_0x0103('0x37')]?_0x554382[_0x0103('0x35')]:_0x3ccc96['model'];if(!_0x7f7ecf['query'][_0x0103('0x38')](_0x0103('0x39'))){_0x554382[_0x0103('0x1c')]=qs[_0x0103('0x1c')](_0x7f7ecf[_0x0103('0x32')][_0x0103('0x1c')]);_0x554382[_0x0103('0x1d')]=qs[_0x0103('0x1d')](_0x7f7ecf[_0x0103('0x32')][_0x0103('0x1d')]);}_0x554382[_0x0103('0x3a')]=qs[_0x0103('0x3b')](_0x7f7ecf[_0x0103('0x32')][_0x0103('0x3b')]);_0x554382['where']=qs['filters'](_[_0x0103('0x3c')](_0x7f7ecf['query'],_0x3ccc96[_0x0103('0x33')]),_0x40eae3);if(_0x7f7ecf['query']['filter']){_0x554382[_0x0103('0x3d')]=_[_0x0103('0x3e')](_0x554382[_0x0103('0x3d')],{'$or':_[_0x0103('0x3f')](_0x554382[_0x0103('0x35')],function(_0x53afaa){var _0x41772f={};_0x41772f[_0x53afaa]={'$like':'%'+_0x7f7ecf[_0x0103('0x32')]['filter']+'%'};return _0x41772f;})});}_0x554382=_[_0x0103('0x3e')]({},_0x554382,_0x7f7ecf['options']);var _0x404fad={'where':_0x554382[_0x0103('0x3d')]};return db[_0x0103('0x2e')][_0x0103('0x1e')](_0x404fad)[_0x0103('0x24')](function(_0x1ee484){_0x1c61e9[_0x0103('0x1e')]=_0x1ee484;if(_0x7f7ecf[_0x0103('0x32')]['includeAll']){_0x554382[_0x0103('0x40')]=[{'all':!![]}];}return db[_0x0103('0x2e')][_0x0103('0x41')](_0x554382);})['then'](function(_0xf9ff09){_0x1c61e9[_0x0103('0x42')]=_0xf9ff09;return _0x1c61e9;})['then'](respondWithFilteredResult(_0x1ec31e,_0x554382))[_0x0103('0x43')](handleError(_0x1ec31e,null));})[_0x0103('0x43')](handleError(_0x1ec31e,null));};exports[_0x0103('0x44')]=function(_0x4b622d,_0xb4b019){var _0x5da0f5={'raw':![],'where':{'id':_0x4b622d[_0x0103('0x45')]['id']}},_0x8baa9a={};_0x8baa9a['model']=_[_0x0103('0x31')](db[_0x0103('0x2e')][_0x0103('0x46')]);_0x8baa9a[_0x0103('0x32')]=_['keys'](_0x4b622d[_0x0103('0x32')]);_0x8baa9a[_0x0103('0x33')]=_[_0x0103('0x34')](_0x8baa9a[_0x0103('0x30')],_0x8baa9a[_0x0103('0x32')]);_0x5da0f5[_0x0103('0x35')]=_[_0x0103('0x34')](_0x8baa9a[_0x0103('0x30')],qs[_0x0103('0x36')](_0x4b622d[_0x0103('0x32')][_0x0103('0x36')]));_0x5da0f5[_0x0103('0x35')]=_0x5da0f5[_0x0103('0x35')][_0x0103('0x37')]?_0x5da0f5[_0x0103('0x35')]:_0x8baa9a['model'];if(_0x4b622d[_0x0103('0x32')]['includeAll']){_0x5da0f5['include']=[{'all':!![]}];}_0x5da0f5=_['merge']({},_0x5da0f5,_0x4b622d['options']);return db[_0x0103('0x2e')][_0x0103('0x47')](_0x5da0f5)[_0x0103('0x24')](handleEntityNotFound(_0xb4b019,null))['then'](respondWithResult(_0xb4b019,null))['catch'](handleError(_0xb4b019,null));};exports[_0x0103('0x48')]=function(_0x3876e7,_0x4ae201){return db['CmCompany']['create'](_0x3876e7[_0x0103('0x49')],{})[_0x0103('0x24')](function(_0x1c964e){var _0x3cf65e=_0x3876e7[_0x0103('0x4a')][_0x0103('0x4b')]({'plain':!![]});if(!_0x3cf65e)throw new Error(_0x0103('0x4c'));if(_0x3cf65e[_0x0103('0x4d')]==='user'){var _0x5a118d=_0x1c964e[_0x0103('0x4b')]({'plain':!![]});var _0x34124f='Companies';return db[_0x0103('0x4e')]['find']({'where':{'name':_0x34124f,'userProfileId':_0x3cf65e[_0x0103('0x4f')]},'raw':!![]})[_0x0103('0x24')](function(_0x408b1f){if(_0x408b1f&&_0x408b1f[_0x0103('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a118d[_0x0103('0x2b')],'resourceId':_0x5a118d['id'],'type':_0x408b1f[_0x0103('0x2b')],'sectionId':_0x408b1f['id']},{})['then'](function(){return _0x1c964e;});}else{return _0x1c964e;}})[_0x0103('0x43')](function(_0x4d8eed){logger[_0x0103('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d8eed);throw _0x4d8eed;});}return _0x1c964e;})[_0x0103('0x24')](respondWithResult(_0x4ae201,0xc9))[_0x0103('0x43')](handleError(_0x4ae201,null));};exports[_0x0103('0x23')]=function(_0xccf3cb,_0x44fd83){if(_0xccf3cb['body']['id']){delete _0xccf3cb[_0x0103('0x49')]['id'];}return db[_0x0103('0x2e')]['find']({'where':{'id':_0xccf3cb[_0x0103('0x45')]['id']}})[_0x0103('0x24')](handleEntityNotFound(_0x44fd83,null))[_0x0103('0x24')](saveUpdates(_0xccf3cb[_0x0103('0x49')],null))['then'](respondWithResult(_0x44fd83,null))[_0x0103('0x43')](handleError(_0x44fd83,null));};exports[_0x0103('0x25')]=function(_0x1fe7bb,_0xa4fdb7){return db[_0x0103('0x2e')][_0x0103('0x47')]({'where':{'id':_0x1fe7bb[_0x0103('0x45')]['id']}})['then'](handleEntityNotFound(_0xa4fdb7,null))['then'](removeEntity(_0xa4fdb7,null))[_0x0103('0x43')](handleError(_0xa4fdb7,null));};exports[_0x0103('0x2f')]=function(_0xf4ced4,_0x547e27){return db['CmCompany']['describe']()[_0x0103('0x24')](respondWithResult(_0x547e27,null))['catch'](handleError(_0x547e27,null));};exports[_0x0103('0x51')]=function(_0x4440ad,_0x3df487,_0x2a2ad1){return db['CmContact']['find']({'where':{'id':_0x4440ad[_0x0103('0x45')]['id']}})[_0x0103('0x24')](handleEntityNotFound(_0x3df487,null))[_0x0103('0x24')](function(_0x2d8f98){if(_0x2d8f98){return _0x2d8f98['addContacts'](_0x4440ad[_0x0103('0x49')]['ids'],_[_0x0103('0x52')](_0x4440ad[_0x0103('0x49')],[_0x0103('0x53'),'id'])||{});}})[_0x0103('0x24')](respondWithResult(_0x3df487,null))[_0x0103('0x43')](handleError(_0x3df487,null));};exports['getContacts']=function(_0x23ecbb,_0x663d2b,_0x394e34){var _0xd2522b={};var _0x54e3e3={};var _0x8ac2cc;var _0x278b99;return db[_0x0103('0x2e')][_0x0103('0x54')]({'where':{'id':_0x23ecbb[_0x0103('0x45')]['id']}})[_0x0103('0x24')](handleEntityNotFound(_0x663d2b,null))[_0x0103('0x24')](function(_0xae7f0d){if(_0xae7f0d){_0x8ac2cc=_0xae7f0d;_0x54e3e3[_0x0103('0x30')]=_[_0x0103('0x31')](db[_0x0103('0x55')]['rawAttributes']);_0x54e3e3[_0x0103('0x32')]=_[_0x0103('0x31')](_0x23ecbb[_0x0103('0x32')]);_0x54e3e3[_0x0103('0x33')]=_[_0x0103('0x34')](_0x54e3e3[_0x0103('0x30')],_0x54e3e3['query']);_0xd2522b[_0x0103('0x35')]=_[_0x0103('0x34')](_0x54e3e3[_0x0103('0x30')],qs[_0x0103('0x36')](_0x23ecbb[_0x0103('0x32')][_0x0103('0x36')]));_0xd2522b[_0x0103('0x35')]=_0xd2522b[_0x0103('0x35')]['length']?_0xd2522b[_0x0103('0x35')]:_0x54e3e3[_0x0103('0x30')];_0xd2522b[_0x0103('0x3a')]=qs[_0x0103('0x3b')](_0x23ecbb[_0x0103('0x32')][_0x0103('0x3b')]);_0xd2522b[_0x0103('0x3d')]=qs[_0x0103('0x33')](_['pick'](_0x23ecbb[_0x0103('0x32')],_0x54e3e3[_0x0103('0x33')]));if(_0x23ecbb[_0x0103('0x32')]['filter']){_0xd2522b[_0x0103('0x3d')]=_[_0x0103('0x3e')](_0xd2522b[_0x0103('0x3d')],{'$or':_['map'](_0xd2522b[_0x0103('0x35')],function(_0x7af21d){var _0xb1a92={};_0xb1a92[_0x7af21d]={'$like':'%'+_0x23ecbb[_0x0103('0x32')][_0x0103('0x56')]+'%'};return _0xb1a92;})});}_0xd2522b=_[_0x0103('0x3e')]({},_0xd2522b,_0x23ecbb['options']);return _0x8ac2cc[_0x0103('0x57')](_0xd2522b);}})[_0x0103('0x24')](function(_0x3eda8e){if(_0x3eda8e){_0x278b99=_0x3eda8e['length'];if(!_0x23ecbb[_0x0103('0x32')][_0x0103('0x38')](_0x0103('0x39'))){_0xd2522b[_0x0103('0x1c')]=qs[_0x0103('0x1c')](_0x23ecbb[_0x0103('0x32')]['limit']);_0xd2522b[_0x0103('0x1d')]=qs['offset'](_0x23ecbb[_0x0103('0x32')][_0x0103('0x1d')]);}return _0x8ac2cc[_0x0103('0x57')](_0xd2522b);}})[_0x0103('0x24')](function(_0x152c6f){if(_0x152c6f){return _0x152c6f?{'count':_0x278b99,'rows':_0x152c6f}:null;}})[_0x0103('0x24')](respondWithResult(_0x663d2b,null))[_0x0103('0x43')](handleError(_0x663d2b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6e953ff..7901c42 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 _0xc78f=['rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4246c1,_0x5be3a8){var _0x4b4de8=function(_0x51b71e){while(--_0x51b71e){_0x4246c1['push'](_0x4246c1['shift']());}};_0x4b4de8(++_0x5be3a8);}(_0xc78f,0xea));var _0xfc78=function(_0x400999,_0x432545){_0x400999=_0x400999-0x0;var _0x30b415=_0xc78f[_0x400999];return _0x30b415;};'use strict';var _=require(_0xfc78('0x0'));var util=require(_0xfc78('0x1'));var logger=require(_0xfc78('0x2'))('api');var moment=require(_0xfc78('0x3'));var BPromise=require(_0xfc78('0x4'));var rp=require(_0xfc78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc78('0x6'));var config=require(_0xfc78('0x7'));var attributes=require(_0xfc78('0x8'));module['exports']=function(_0x2a30a0,_0x2bd4e6){return _0x2a30a0[_0xfc78('0x9')](_0xfc78('0xa'),attributes,{'tableName':_0xfc78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c5d=['moment','bluebird','request-promise','./cmCompany.attributes','define','cm_companies','lodash','../../config/logger'];(function(_0x105c57,_0x2dbbb0){var _0x1a57f9=function(_0x273817){while(--_0x273817){_0x105c57['push'](_0x105c57['shift']());}};_0x1a57f9(++_0x2dbbb0);}(_0x3c5d,0xb6));var _0xd3c5=function(_0x5db7da,_0x27b7ad){_0x5db7da=_0x5db7da-0x0;var _0x1c5330=_0x3c5d[_0x5db7da];return _0x1c5330;};'use strict';var _=require(_0xd3c5('0x0'));var util=require('util');var logger=require(_0xd3c5('0x1'))('api');var moment=require(_0xd3c5('0x2'));var BPromise=require(_0xd3c5('0x3'));var rp=require(_0xd3c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd3c5('0x5'));module['exports']=function(_0x45cb52,_0x17f8a4){return _0x45cb52[_0xd3c5('0x6')]('CmCompany',attributes,{'tableName':_0xd3c5('0x7'),'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 23d3424..4f2b874 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 _0x8c17=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4de7f7,_0x929042){var _0x396583=function(_0x40e02e){while(--_0x40e02e){_0x4de7f7['push'](_0x4de7f7['shift']());}};_0x396583(++_0x929042);}(_0x8c17,0x15d));var _0x78c1=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8c17[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x78c1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78c1('0x1'));var db=require(_0x78c1('0x2'))['db'];var utils=require(_0x78c1('0x3'));var logger=require(_0x78c1('0x4'))(_0x78c1('0x5'));var config=require(_0x78c1('0x6'));var jayson=require(_0x78c1('0x7'));var client=jayson[_0x78c1('0x8')][_0x78c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dcac7,_0x3af08c,_0x3d1b07){return new BPromise(function(_0x279449,_0x2c8c27){return client[_0x78c1('0xa')](_0x1dcac7,_0x3d1b07)['then'](function(_0x415a90){logger[_0x78c1('0xb')](_0x78c1('0xc'),_0x3af08c,_0x78c1('0xd'));logger[_0x78c1('0xe')](_0x78c1('0xf'),_0x3af08c,_0x78c1('0xd'),JSON[_0x78c1('0x10')](_0x415a90));if(_0x415a90[_0x78c1('0x11')]){if(_0x415a90[_0x78c1('0x11')][_0x78c1('0x12')]===0x1f4){logger['error'](_0x78c1('0xc'),_0x3af08c,_0x415a90[_0x78c1('0x11')][_0x78c1('0x13')]);return _0x2c8c27(_0x415a90[_0x78c1('0x11')]['message']);}logger[_0x78c1('0x11')](_0x78c1('0xc'),_0x3af08c,_0x415a90[_0x78c1('0x11')][_0x78c1('0x13')]);return _0x279449(_0x415a90[_0x78c1('0x11')][_0x78c1('0x13')]);}else{logger[_0x78c1('0xb')](_0x78c1('0xc'),_0x3af08c,_0x78c1('0xd'));_0x279449(_0x415a90['result']['message']);}})['catch'](function(_0x4b0b5e){logger[_0x78c1('0x11')](_0x78c1('0xc'),_0x3af08c,_0x4b0b5e);_0x2c8c27(_0x4b0b5e);});});} \ No newline at end of file +var _0xe5c2=['jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','message','CmCompany,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xe5c2,0x1c4));var _0x2e5c=function(_0x34b6c9,_0x243b9a){_0x34b6c9=_0x34b6c9-0x0;var _0x1b9834=_0xe5c2[_0x34b6c9];return _0x1b9834;};'use strict';var _=require(_0x2e5c('0x0'));var util=require(_0x2e5c('0x1'));var moment=require('moment');var BPromise=require(_0x2e5c('0x2'));var rs=require(_0x2e5c('0x3'));var fs=require('fs');var Redis=require(_0x2e5c('0x4'));var db=require(_0x2e5c('0x5'))['db'];var utils=require(_0x2e5c('0x6'));var logger=require(_0x2e5c('0x7'))(_0x2e5c('0x8'));var config=require(_0x2e5c('0x9'));var jayson=require(_0x2e5c('0xa'));var client=jayson['client'][_0x2e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x154c03,_0xcca93d,_0x5040f5){return new BPromise(function(_0x2a5a94,_0xeccf9d){return client[_0x2e5c('0xc')](_0x154c03,_0x5040f5)['then'](function(_0x21aced){logger[_0x2e5c('0xd')]('CmCompany,\x20%s,\x20%s',_0xcca93d,_0x2e5c('0xe'));logger[_0x2e5c('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xcca93d,'request\x20sent',JSON[_0x2e5c('0x10')](_0x21aced));if(_0x21aced[_0x2e5c('0x11')]){if(_0x21aced[_0x2e5c('0x11')][_0x2e5c('0x12')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0xcca93d,_0x21aced[_0x2e5c('0x11')][_0x2e5c('0x13')]);return _0xeccf9d(_0x21aced[_0x2e5c('0x11')]['message']);}logger['error'](_0x2e5c('0x14'),_0xcca93d,_0x21aced['error'][_0x2e5c('0x13')]);return _0x2a5a94(_0x21aced[_0x2e5c('0x11')][_0x2e5c('0x13')]);}else{logger[_0x2e5c('0xd')](_0x2e5c('0x14'),_0xcca93d,'request\x20sent');_0x2a5a94(_0x21aced['result']['message']);}})[_0x2e5c('0x15')](function(_0x75c626){logger[_0x2e5c('0x11')]('CmCompany,\x20%s,\x20%s',_0xcca93d,_0x75c626);_0xeccf9d(_0x75c626);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 05195fd..d3580ac 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 _0x434f=['/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x434f,0x8d));var _0xf434=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x434f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf434('0x0'));var util=require(_0xf434('0x1'));var path=require(_0xf434('0x2'));var timeout=require(_0xf434('0x3'));var express=require(_0xf434('0x4'));var router=express[_0xf434('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf434('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf434('0x7'));var controller=require(_0xf434('0x8'));router[_0xf434('0x9')]('/',auth[_0xf434('0xa')](),controller[_0xf434('0xb')]);router[_0xf434('0x9')](_0xf434('0xc'),auth['isAuthenticated'](),controller[_0xf434('0xd')]);router[_0xf434('0x9')]('/:id',auth[_0xf434('0xa')](),controller[_0xf434('0xe')]);router[_0xf434('0x9')](_0xf434('0xf'),auth[_0xf434('0xa')](),controller[_0xf434('0x10')]);router[_0xf434('0x11')]('/',auth['isAuthenticated'](),controller[_0xf434('0x12')]);router['post'](_0xf434('0xf'),auth[_0xf434('0xa')](),controller[_0xf434('0x13')]);router[_0xf434('0x14')](_0xf434('0x15'),auth[_0xf434('0xa')](),controller[_0xf434('0x16')]);router[_0xf434('0x17')](_0xf434('0x15'),auth[_0xf434('0xa')](),controller[_0xf434('0x18')]);module[_0xf434('0x19')]=router; \ No newline at end of file +var _0x5845=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./cmCompany.controller','index','get','/describe','isAuthenticated','/:id','/:id/contacts','post'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5845,0x173));var _0x5584=function(_0x394c35,_0x5a84b5){_0x394c35=_0x394c35-0x0;var _0xc0e7db=_0x5845[_0x394c35];return _0xc0e7db;};'use strict';var multer=require(_0x5584('0x0'));var util=require(_0x5584('0x1'));var path=require(_0x5584('0x2'));var timeout=require(_0x5584('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5584('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5584('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x5584('0x6')]);router[_0x5584('0x7')](_0x5584('0x8'),auth[_0x5584('0x9')](),controller['describe']);router[_0x5584('0x7')](_0x5584('0xa'),auth[_0x5584('0x9')](),controller['show']);router[_0x5584('0x7')](_0x5584('0xb'),auth[_0x5584('0x9')](),controller['getContacts']);router[_0x5584('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5584('0xc')](_0x5584('0xb'),auth['isAuthenticated'](),controller['addContacts']);router['put'](_0x5584('0xa'),auth[_0x5584('0x9')](),controller['update']);router[_0x5584('0xd')]('/:id',auth[_0x5584('0x9')](),controller[_0x5584('0xe')]);module[_0x5584('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5986884..675cfcb 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 _0x9b04=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0xfbbd40,_0x2d9d63){var _0x535f46=function(_0x1e2e46){while(--_0x1e2e46){_0xfbbd40['push'](_0xfbbd40['shift']());}};_0x535f46(++_0x2d9d63);}(_0x9b04,0x120));var _0x49b0=function(_0x3f5210,_0x32f195){_0x3f5210=_0x3f5210-0x0;var _0x53c3ab=_0x9b04[_0x3f5210];return _0x53c3ab;};'use strict';var _=require(_0x49b0('0x0'));var Sequelize=require(_0x49b0('0x1'));module[_0x49b0('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x49b0('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x49b0('0x3')]},'country':{'type':Sequelize[_0x49b0('0x3')]},'dateOfBirth':{'type':Sequelize[_0x49b0('0x3')]},'description':{'type':Sequelize[_0x49b0('0x4')]},'phone':{'type':Sequelize[_0x49b0('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x49b0('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x49b0('0x3')]},'facebook':{'type':Sequelize[_0x49b0('0x3')]},'fb_data':{'type':Sequelize[_0x49b0('0x3')]},'twitter':{'type':Sequelize[_0x49b0('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x49b0('0x3')]},'viber':{'type':Sequelize[_0x49b0('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x49b0('0x3')]},'UserId':{'type':Sequelize[_0x49b0('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x49b0('0x6')],'defaultValue':Sequelize[_0x49b0('0x7')]}}; \ No newline at end of file +var _0x0fd0=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x110dbf,_0x16a620){var _0x49e064=function(_0x7bc62e){while(--_0x7bc62e){_0x110dbf['push'](_0x110dbf['shift']());}};_0x49e064(++_0x16a620);}(_0x0fd0,0x159));var _0x00fd=function(_0x1ddbe1,_0x31d3a9){_0x1ddbe1=_0x1ddbe1-0x0;var _0x596bf4=_0x0fd0[_0x1ddbe1];return _0x596bf4;};'use strict';var _=require(_0x00fd('0x0'));var Sequelize=require(_0x00fd('0x1'));module[_0x00fd('0x2')]={'firstName':{'type':Sequelize[_0x00fd('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x00fd('0x3')]},'street':{'type':Sequelize[_0x00fd('0x3')]},'postalCode':{'type':Sequelize[_0x00fd('0x3')]},'city':{'type':Sequelize[_0x00fd('0x3')]},'country':{'type':Sequelize[_0x00fd('0x3')]},'dateOfBirth':{'type':Sequelize[_0x00fd('0x3')]},'description':{'type':Sequelize[_0x00fd('0x4')]},'phone':{'type':Sequelize[_0x00fd('0x3')]},'mobile':{'type':Sequelize[_0x00fd('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x00fd('0x3')]},'url':{'type':Sequelize[_0x00fd('0x3')]},'facebook':{'type':Sequelize[_0x00fd('0x3')]},'fb_data':{'type':Sequelize[_0x00fd('0x3')]},'twitter':{'type':Sequelize[_0x00fd('0x3')]},'skype':{'type':Sequelize[_0x00fd('0x3')]},'teams':{'type':Sequelize[_0x00fd('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x00fd('0x3')]},'wechat':{'type':Sequelize[_0x00fd('0x3')]},'telegram':{'type':Sequelize[_0x00fd('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x00fd('0x5')](0x2)[_0x00fd('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x00fd('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 857071c..b636552 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 _0xba6e=['clone','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','user','role','agent','some','User','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.fax','c.ListId','c.deletedAt','c.CompanyId','TagIds','Tags','find','params','catch','tags','columnName','displayName','findAll','body','get','mergeWith','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','duplicates','$or','ListId','findOrCreate','show','Tag','format','$and','omit','pickBy','cf_%d','id\x20=\x20?','toParam','values','phone','getTags','rawAttributes','options','hasOwnProperty','setTags','ids','getHoppers','ContactId','includeAll','rows','getHopperHistories','CmHopperHistory','include','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','chat','sms','openchannel','fax','whatsapp','voice','channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userThirdDisposition','UserId','fullname','alias','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','customerIp','deviceModel','osName','ratingType','ratingValue','referer','mail','subject','threadId','Interaction','findAndCountAll','Owner','flatten','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','offset','undefined','count','limit','status','set','json','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','fieldType','type','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','datetime','DATE','buildExpression','start','isNil','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','filter','replace','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT'];(function(_0x262f02,_0x142ce5){var _0x2760ff=function(_0x597906){while(--_0x597906){_0x262f02['push'](_0x262f02['shift']());}};_0x2760ff(++_0x142ce5);}(_0xba6e,0xb0));var _0xeba6=function(_0x46e824,_0x260243){_0x46e824=_0x46e824-0x0;var _0x5b6e78=_0xba6e[_0x46e824];return _0x5b6e78;};'use strict';var moment=require(_0xeba6('0x0'));var BPromise=require(_0xeba6('0x1'));var util=require(_0xeba6('0x2'));var path=require(_0xeba6('0x3'));var fs=require('fs');var _=require(_0xeba6('0x4'));var squel=require(_0xeba6('0x5'));var Papa=require(_0xeba6('0x6'));var Redis=require(_0xeba6('0x7'));var qs=require('../../components/parsers/qs');var as=require(_0xeba6('0x8'));var logger=require(_0xeba6('0x9'))(_0xeba6('0xa'));var config=require(_0xeba6('0xb'));var db=require(_0xeba6('0xc'))['db'];config[_0xeba6('0xd')]=_[_0xeba6('0xe')](config[_0xeba6('0xd')],{'host':_0xeba6('0xf'),'port':0x18eb});var socket=require(_0xeba6('0x10'))(new Redis(config[_0xeba6('0xd')]));require(_0xeba6('0x11'))[_0xeba6('0x12')](socket);function respondWithResult(_0x122e89,_0x5b740b){_0x5b740b=_0x5b740b||0xc8;return function(_0x4c4cf8){if(_0x4c4cf8){return _0x122e89['status'](_0x5b740b)['json'](_0x4c4cf8);}};}function respondWithFilteredResult(_0x5b8624,_0x1190f4){return function(_0x4438b9){if(_0x4438b9){var _0x59c5a6=typeof _0x1190f4[_0xeba6('0x13')]===_0xeba6('0x14')&&typeof _0x1190f4['limit']===_0xeba6('0x14');var _0xc7add4=_0x4438b9[_0xeba6('0x15')];var _0x2169e1=_0x59c5a6?0x0:_0x1190f4[_0xeba6('0x13')];var _0x2bb2d2=_0x59c5a6?_0x4438b9[_0xeba6('0x15')]:_0x1190f4[_0xeba6('0x13')]+_0x1190f4[_0xeba6('0x16')];var _0x63dd4a;if(_0x2bb2d2>=_0xc7add4){_0x2bb2d2=_0xc7add4;_0x63dd4a=0xc8;}else{_0x63dd4a=0xce;}_0x5b8624[_0xeba6('0x17')](_0x63dd4a);return _0x5b8624[_0xeba6('0x18')]('Content-Range',_0x2169e1+'-'+_0x2bb2d2+'/'+_0xc7add4)[_0xeba6('0x19')](_0x4438b9);}return null;};}function saveUpdates(_0x56d281){return function(_0x4342a8){if(_0x4342a8){return _0x4342a8['update'](_0x56d281)[_0xeba6('0x1a')](function(_0x3a998f){return _0x3a998f;});}return null;};}function removeEntity(_0x57a93f){return function(_0x2aef9d){if(_0x2aef9d){return _0x2aef9d[_0xeba6('0x1b')]()['then'](function(){_0x57a93f['status'](0xcc)[_0xeba6('0x1c')]();});}};}function handleEntityNotFound(_0x482eec){return function(_0x248197){if(!_0x248197){_0x482eec[_0xeba6('0x1d')](0x194);}return _0x248197;};}function handleError(_0xb186ad,_0xc96129){_0xc96129=_0xc96129||0x1f4;return function(_0xcfb763){logger[_0xeba6('0x1e')](_0xcfb763[_0xeba6('0x1f')]);if(_0xcfb763[_0xeba6('0x20')]){delete _0xcfb763[_0xeba6('0x20')];}_0xb186ad[_0xeba6('0x17')](_0xc96129)[_0xeba6('0x21')](_0xcfb763);};}exports[_0xeba6('0x22')]=function(_0x195967,_0x1f7d7d){var _0x10454a={},_0xf056a0={},_0x5164ce={'count':0x0,'rows':[]};return db[_0xeba6('0x23')][_0xeba6('0x24')]()[_0xeba6('0x1a')](function(_0x530eb3){var _0x12af9c=[];for(var _0x1098fc=0x0;_0x1098fc0x1){_0x260aab['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xeba6('0x63')](_0xa369d0),null);}else{if(qs[_0xeba6('0x64')](_0xa369d0)){_0x260aab['or']('c.id\x20LIKE\x20?',_0xa369d0+'%');_0x260aab['or'](_0xeba6('0x65'),_0xa369d0+'%');_0x260aab['or'](_0xeba6('0x66'),_0xa369d0+'%');_0x260aab['or'](_0xeba6('0x67'),_0xa369d0+'%');}else if(qs[_0xeba6('0x68')](_0xa369d0)){_0x260aab['or'](_0xeba6('0x69'),_0xa369d0+'%');}else{_0x260aab['or']('c.firstName\x20LIKE\x20?','%'+_0xa369d0+'%');_0x260aab['or'](_0xeba6('0x6a'),'%'+_0xa369d0+'%');_0x260aab['or'](_0xeba6('0x69'),'%'+_0xa369d0+'%');}}}}_0x38382b['where'](_0x260aab);_0x38382b['group'](_0xeba6('0x6b'));var _0x360008={'type':db[_0xeba6('0x6c')][_0xeba6('0x6d')][_0xeba6('0x6e')],'raw':!![]};var _0x299fec=_0x38382b[_0xeba6('0x6f')]()[_0xeba6('0x3c')]('c.id');if(_0x10454a[_0xeba6('0x37')]){_0x10454a['order'][_0xeba6('0x50')](function(_0x4db37b){_0x38382b[_0xeba6('0x37')]('c.'+_0x4db37b[0x0],_0x4db37b[0x1]===_0xeba6('0x70')?![]:!![]);});}if(!_[_0xeba6('0x71')](_0x49eb5d)){_0x38382b[_0xeba6('0x72')](_0x13256d);_0x299fec[_0xeba6('0x39')](_0xeba6('0x73'),_0x49eb5d);}BPromise[_0xeba6('0x74')]()[_0xeba6('0x1a')](function(){if(!_0xb443b1)return;if(_0x195967[_0xeba6('0x75')][_0xeba6('0x76')]!==_0xeba6('0x77'))return;if(!_[_0xeba6('0x78')](_0xb443b1[_0xeba6('0x4c')],[_0xeba6('0x3c'),_0xeba6('0x79')])){return _0x195967[_0xeba6('0x75')][_0xeba6('0x7a')]({'attributes':['id'],'raw':!![]})[_0xeba6('0x1a')](function(_0x51cd30){if(_[_0xeba6('0x71')](_0x51cd30)){_0x299fec[_0xeba6('0x39')](_0xeba6('0x7b'));_0x38382b[_0xeba6('0x39')]('c.ListId\x20IS\x20NULL');}else{_0x299fec[_0xeba6('0x39')]('c.ListId\x20IN\x20?',_[_0xeba6('0x4f')](_0x51cd30,'id'));_0x38382b[_0xeba6('0x39')]('c.ListId\x20IN\x20?',_[_0xeba6('0x4f')](_0x51cd30,'id'));}});}})['then'](function(){if(_0x195967[_0xeba6('0x75')][_0xeba6('0x76')]===_0xeba6('0x77')&&!_0xb443b1&&!_0x195967[_0xeba6('0x32')]['ListId'])return[];return db[_0xeba6('0x7c')][_0xeba6('0x32')](_0x299fec['toString'](),_0x360008);})[_0xeba6('0x1a')](function(_0x853d60){_0x5164ce[_0xeba6('0x15')]=_0x853d60[_0xeba6('0x35')];if(_0x5164ce[_0xeba6('0x15')]===0x0)return[];return db[_0xeba6('0x7c')][_0xeba6('0x32')](_0x4fcbc1[_0xeba6('0x7d')](),_0x360008)[_0xeba6('0x1a')](function(_0x8341e3){_0x2b948e=_[_0xeba6('0x7e')](_0x8341e3,'id');_0x360008=_[_0xeba6('0x7f')](_0x360008,{'model':db[_0xeba6('0x23')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x195967['query'][_0xeba6('0x34')]){_0x10454a['attributes'][_0xeba6('0x50')](function(_0x3740c2){_0x38382b[_0xeba6('0x3c')]('c.'+_0x3740c2);});}else{_0x38382b['field'](_0xeba6('0x6b'));_0x38382b['field']('c.firstName');_0x38382b[_0xeba6('0x3c')](_0xeba6('0x80'));_0x38382b[_0xeba6('0x3c')](_0xeba6('0x81'));_0x38382b[_0xeba6('0x3c')]('c.mobile');_0x38382b['field'](_0xeba6('0x82'));_0x38382b[_0xeba6('0x3c')]('c.email');_0x38382b[_0xeba6('0x3c')](_0xeba6('0x83'));_0x38382b[_0xeba6('0x3c')]('c.createdAt');_0x38382b[_0xeba6('0x3c')](_0xeba6('0x84'));_0x38382b[_0xeba6('0x3c')](_0xeba6('0x85'));_0x38382b[_0xeba6('0x3c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeba6('0x86'));}if(_0x10454a[_0xeba6('0x16')])_0x38382b[_0xeba6('0x16')](_0x10454a[_0xeba6('0x16')]);if(_0x10454a[_0xeba6('0x13')])_0x38382b[_0xeba6('0x13')](_0x10454a[_0xeba6('0x13')]);return db['sequelize']['query'](_0x38382b[_0xeba6('0x7d')](),_0x360008);});})[_0xeba6('0x1a')](function(_0x2dd377){_0x2dd377[_0xeba6('0x50')](function(_0x3c44fb){if(_0x3c44fb[_0xeba6('0x86')]){_0x3c44fb[_0xeba6('0x87')]=[];_0x3c44fb['TagIds'][_0xeba6('0x4e')](',')[_0xeba6('0x50')](function(_0x40ce88){_0x3c44fb[_0xeba6('0x87')]['push'](_0x2b948e[_0x40ce88]);});}delete _0x3c44fb[_0xeba6('0x86')];});_0x5164ce['rows']=_0x2dd377;return _0x5164ce;})['then'](respondWithFilteredResult(_0x1f7d7d,_0x10454a));})['catch'](handleError(_0x1f7d7d,null));};exports[_0xeba6('0x1b')]=function(_0x5ea398,_0x48df48){return db[_0xeba6('0x23')][_0xeba6('0x88')]({'where':{'id':_0x5ea398[_0xeba6('0x89')]['id']}})[_0xeba6('0x1a')](handleEntityNotFound(_0x48df48,null))[_0xeba6('0x1a')](removeEntity(_0x48df48,null))[_0xeba6('0x8a')](handleError(_0x48df48,null));};exports[_0xeba6('0x24')]=function(_0x10389d,_0xb60956){return db[_0xeba6('0x23')][_0xeba6('0x24')]()['then'](function(_0x6f5165){delete _0x6f5165[_0xeba6('0x8b')];for(var _0x25ef44=0x0;_0x25ef44=_0x5c2e14){_0x3d1765=_0x5c2e14;_0xcdb065=0xc8;}else{_0xcdb065=0xce;}_0x208e95[_0x6713('0x10')](_0xcdb065);return _0x208e95['set'](_0x6713('0x16'),_0x46dedc+'-'+_0x3d1765+'/'+_0x5c2e14)[_0x6713('0x11')](_0x13f79f);}return null;};}function saveUpdates(_0x2f8861){return function(_0x211d09){if(_0x211d09){return _0x211d09[_0x6713('0x17')](_0x2f8861)[_0x6713('0x18')](function(_0x2e61fb){return _0x2e61fb;});}return null;};}function removeEntity(_0xd8c199){return function(_0x4ba28b){if(_0x4ba28b){return _0x4ba28b['destroy']()[_0x6713('0x18')](function(){_0xd8c199[_0x6713('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225f1a){return function(_0x2d99b2){if(!_0x2d99b2){_0x225f1a[_0x6713('0x19')](0x194);}return _0x2d99b2;};}function handleError(_0xe51fe6,_0x2cfd4e){_0x2cfd4e=_0x2cfd4e||0x1f4;return function(_0x4b4653){logger[_0x6713('0x1a')](_0x4b4653[_0x6713('0x1b')]);if(_0x4b4653[_0x6713('0x1c')]){delete _0x4b4653[_0x6713('0x1c')];}_0xe51fe6[_0x6713('0x10')](_0x2cfd4e)[_0x6713('0x1d')](_0x4b4653);};}exports[_0x6713('0x1e')]=function(_0x1502f5,_0x39ec2c){var _0x4bcc8d={},_0x57bdff={},_0x5483e2={'count':0x0,'rows':[]};return db[_0x6713('0x1f')]['describe']()[_0x6713('0x18')](function(_0x3f43f3){var _0x5008a8=[];for(var _0x141852=0x0;_0x1418520x1){_0x21c1cc['or'](_0x6713('0x5f'),qs[_0x6713('0x60')](_0x358062),null);}else{if(qs[_0x6713('0x61')](_0x358062)){_0x21c1cc['or']('c.id\x20LIKE\x20?',_0x358062+'%');_0x21c1cc['or']('c.phone\x20LIKE\x20?',_0x358062+'%');_0x21c1cc['or']('c.mobile\x20LIKE\x20?',_0x358062+'%');_0x21c1cc['or'](_0x6713('0x62'),_0x358062+'%');}else if(qs[_0x6713('0x63')](_0x358062)){_0x21c1cc['or'](_0x6713('0x64'),_0x358062+'%');}else{_0x21c1cc['or'](_0x6713('0x65'),'%'+_0x358062+'%');_0x21c1cc['or'](_0x6713('0x66'),'%'+_0x358062+'%');_0x21c1cc['or'](_0x6713('0x64'),'%'+_0x358062+'%');}}}}_0x378109[_0x6713('0x3b')](_0x21c1cc);_0x378109[_0x6713('0x67')](_0x6713('0x68'));var _0x268d1f={'type':db['Sequelize']['QueryTypes'][_0x6713('0x69')],'raw':!![]};var _0x415b65=_0x378109[_0x6713('0x6a')]()['field'](_0x6713('0x68'));if(_0x4bcc8d[_0x6713('0x2d')]){_0x4bcc8d[_0x6713('0x2d')][_0x6713('0x46')](function(_0x55276f){_0x378109['order']('c.'+_0x55276f[0x0],_0x55276f[0x1]===_0x6713('0x6b')?![]:!![]);});}if(!_[_0x6713('0x6c')](_0x28f524)){_0x378109[_0x6713('0x6d')](_0x372ea6);_0x415b65[_0x6713('0x3b')](_0x6713('0x6e'),_0x28f524);}BPromise[_0x6713('0x6f')]()[_0x6713('0x18')](function(){if(!_0x4b56db)return;if(_0x1502f5['user']['role']!==_0x6713('0x70'))return;if(!_[_0x6713('0x71')](_0x4b56db[_0x6713('0x41')],[_0x6713('0x32'),'User'])){return _0x1502f5[_0x6713('0x72')]['getLists']({'attributes':['id'],'raw':!![]})[_0x6713('0x18')](function(_0x1e339d){if(_[_0x6713('0x6c')](_0x1e339d)){_0x415b65[_0x6713('0x3b')](_0x6713('0x73'));_0x378109[_0x6713('0x3b')](_0x6713('0x73'));}else{_0x415b65[_0x6713('0x3b')](_0x6713('0x58'),_[_0x6713('0x45')](_0x1e339d,'id'));_0x378109[_0x6713('0x3b')]('c.ListId\x20IN\x20?',_[_0x6713('0x45')](_0x1e339d,'id'));}});}})[_0x6713('0x18')](function(){if(_0x1502f5[_0x6713('0x72')][_0x6713('0x74')]===_0x6713('0x70')&&!_0x4b56db&&!_0x1502f5['query']['ListId'])return[];return db[_0x6713('0x75')][_0x6713('0x28')](_0x415b65[_0x6713('0x76')](),_0x268d1f);})[_0x6713('0x18')](function(_0x309a0a){_0x5483e2[_0x6713('0x15')]=_0x309a0a[_0x6713('0x21')];if(_0x5483e2[_0x6713('0x15')]===0x0)return[];return db[_0x6713('0x75')][_0x6713('0x28')](_0x527d9c[_0x6713('0x76')](),_0x268d1f)['then'](function(_0x43c876){_0x1867c6=_[_0x6713('0x77')](_0x43c876,'id');_0x268d1f=_['merge'](_0x268d1f,{'model':db[_0x6713('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1502f5[_0x6713('0x28')][_0x6713('0x78')]){_0x4bcc8d[_0x6713('0x2a')][_0x6713('0x46')](function(_0xc3d210){_0x378109[_0x6713('0x32')]('c.'+_0xc3d210);});}else{_0x378109[_0x6713('0x32')]('c.id');_0x378109[_0x6713('0x32')]('c.firstName');_0x378109[_0x6713('0x32')]('c.lastName');_0x378109[_0x6713('0x32')](_0x6713('0x79'));_0x378109[_0x6713('0x32')]('c.mobile');_0x378109[_0x6713('0x32')](_0x6713('0x7a'));_0x378109['field'](_0x6713('0x7b'));_0x378109['field'](_0x6713('0x7c'));_0x378109[_0x6713('0x32')](_0x6713('0x7d'));_0x378109[_0x6713('0x32')]('c.deletedAt');_0x378109[_0x6713('0x32')]('c.CompanyId');_0x378109[_0x6713('0x32')](_0x6713('0x7e'),_0x6713('0x7f'));}if(_0x4bcc8d['limit'])_0x378109[_0x6713('0x14')](_0x4bcc8d['limit']);if(_0x4bcc8d[_0x6713('0x12')])_0x378109[_0x6713('0x12')](_0x4bcc8d[_0x6713('0x12')]);return db[_0x6713('0x75')][_0x6713('0x28')](_0x378109[_0x6713('0x76')](),_0x268d1f);});})[_0x6713('0x18')](function(_0x32cee6){_0x32cee6[_0x6713('0x46')](function(_0x1c87c4){if(_0x1c87c4['TagIds']){_0x1c87c4[_0x6713('0x80')]=[];_0x1c87c4[_0x6713('0x7f')]['split'](',')[_0x6713('0x46')](function(_0x2fb15b){_0x1c87c4[_0x6713('0x80')][_0x6713('0x81')](_0x1867c6[_0x2fb15b]);});}delete _0x1c87c4['TagIds'];});_0x5483e2['rows']=_0x32cee6;return _0x5483e2;})[_0x6713('0x18')](respondWithFilteredResult(_0x39ec2c,_0x4bcc8d));})[_0x6713('0x82')](handleError(_0x39ec2c,null));};exports['destroy']=function(_0x1c3402,_0x3b58e4){return db['CmContact']['find']({'where':{'id':_0x1c3402[_0x6713('0x83')]['id']}})[_0x6713('0x18')](handleEntityNotFound(_0x3b58e4,null))[_0x6713('0x18')](removeEntity(_0x3b58e4,null))['catch'](handleError(_0x3b58e4,null));};exports[_0x6713('0x84')]=function(_0x47dfcc,_0x3dc113){return db[_0x6713('0x1f')]['describe']()['then'](function(_0x866214){delete _0x866214['tags'];for(var _0x37efaf=0x0;_0x37efaf{}\s\\|]/g,'-');_0x55f6b9(null,util[_0x7062('0x21')](_0x7062('0x22'),path['basename'](_0xd99d0a[_0x7062('0x1f')],path[_0x7062('0x23')](_0xd99d0a['originalname'])),Date[_0x7062('0x24')](),path[_0x7062('0x23')](_0xd99d0a['originalname'])));}})});router[_0x7062('0x18')]('/csv',upload[_0x7062('0x25')](_0x7062('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x7062('0x27')]({'destination':function(_0x1bf622,_0xeb7921,_0x5db3c5){_0x5db3c5(null,path[_0x7062('0x28')](config[_0x7062('0x1e')],'server/files/tmp'));},'filename':function(_0x254090,_0x55e89b,_0x1c7bc0){_0x55e89b['originalname']=_0x55e89b['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c7bc0(null,util[_0x7062('0x21')](_0x7062('0x22'),path['basename'](_0x55e89b[_0x7062('0x1f')],path['extname'](_0x55e89b[_0x7062('0x1f')])),Date[_0x7062('0x24')](),path['extname'](_0x55e89b[_0x7062('0x1f')])));}})});router[_0x7062('0x18')](_0x7062('0x29'),upload[_0x7062('0x25')](_0x7062('0x26')),controller[_0x7062('0x2a')]);router['post'](_0x7062('0x2b'),auth[_0x7062('0x9')](),controller[_0x7062('0x2c')]);router[_0x7062('0x2d')](_0x7062('0xe'),auth['isAuthenticated'](),controller[_0x7062('0x2e')]);router[_0x7062('0x2f')](_0x7062('0xe'),auth[_0x7062('0x9')](),controller[_0x7062('0x30')]);module[_0x7062('0x31')]=router; \ No newline at end of file +var _0xea0e=['getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','/upload','/upload/:id','import','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x574c8a,_0x2d545c){var _0x33a9d9=function(_0x702b05){while(--_0x702b05){_0x574c8a['push'](_0x574c8a['shift']());}};_0x33a9d9(++_0x2d545c);}(_0xea0e,0xf5));var _0xeea0=function(_0x19ab4c,_0x76335b){_0x19ab4c=_0x19ab4c-0x0;var _0x45ca96=_0xea0e[_0x19ab4c];return _0x45ca96;};'use strict';var multer=require(_0xeea0('0x0'));var util=require('util');var path=require(_0xeea0('0x1'));var timeout=require(_0xeea0('0x2'));var express=require(_0xeea0('0x3'));var router=express[_0xeea0('0x4')]();var fs_extra=require(_0xeea0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeea0('0x6'));var config=require(_0xeea0('0x7'));var controller=require('./cmContact.controller');router[_0xeea0('0x8')]('/',auth[_0xeea0('0x9')](),controller['index']);router[_0xeea0('0x8')](_0xeea0('0xa'),auth[_0xeea0('0x9')](),controller[_0xeea0('0xb')]);router[_0xeea0('0x8')](_0xeea0('0xc'),auth[_0xeea0('0x9')](),controller[_0xeea0('0xd')]);router[_0xeea0('0x8')](_0xeea0('0xe'),auth[_0xeea0('0x9')](),controller[_0xeea0('0xf')]);router[_0xeea0('0x8')](_0xeea0('0x10'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xeea0('0x8')](_0xeea0('0x11'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x12')]);router[_0xeea0('0x8')](_0xeea0('0x13'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x14')]);router[_0xeea0('0x8')](_0xeea0('0x15'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x16')]);router['get'](_0xeea0('0x17'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x18')]);router[_0xeea0('0x19')](_0xeea0('0x1a'),auth['isAuthenticated'](),controller[_0xeea0('0x1b')]);router[_0xeea0('0x19')]('/',auth['isAuthenticated'](),controller[_0xeea0('0x1c')]);router[_0xeea0('0x19')](_0xeea0('0x1d'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x1e')]);router[_0xeea0('0x19')](_0xeea0('0xe'),auth[_0xeea0('0x9')](),controller['setTags']);var upload=multer({'storage':multer[_0xeea0('0x1f')]({'destination':function(_0x20b506,_0xa3fe7a,_0x408e3f){_0x408e3f(null,path[_0xeea0('0x20')](config[_0xeea0('0x21')],_0xeea0('0x22')));},'filename':function(_0x7f4ac5,_0x27a731,_0x57994d){_0x27a731[_0xeea0('0x23')]=_0x27a731[_0xeea0('0x23')][_0xeea0('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57994d(null,util[_0xeea0('0x25')](_0xeea0('0x26'),path[_0xeea0('0x27')](_0x27a731[_0xeea0('0x23')],path[_0xeea0('0x28')](_0x27a731[_0xeea0('0x23')])),Date[_0xeea0('0x29')](),path[_0xeea0('0x28')](_0x27a731[_0xeea0('0x23')])));}})});router[_0xeea0('0x19')](_0xeea0('0x2a'),upload[_0xeea0('0x2b')](_0xeea0('0x2c')),controller[_0xeea0('0x2d')]);var upload=multer({'storage':multer[_0xeea0('0x1f')]({'destination':function(_0x5f0e39,_0x37d53d,_0x3720ef){_0x3720ef(null,path[_0xeea0('0x20')](config[_0xeea0('0x21')],_0xeea0('0x22')));},'filename':function(_0xe8db8b,_0x4c0279,_0x462707){_0x4c0279[_0xeea0('0x23')]=_0x4c0279['originalname'][_0xeea0('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x462707(null,util[_0xeea0('0x25')](_0xeea0('0x26'),path[_0xeea0('0x27')](_0x4c0279[_0xeea0('0x23')],path[_0xeea0('0x28')](_0x4c0279[_0xeea0('0x23')])),Date[_0xeea0('0x29')](),path[_0xeea0('0x28')](_0x4c0279[_0xeea0('0x23')])));}})});router[_0xeea0('0x19')](_0xeea0('0x2e'),upload[_0xeea0('0x2b')]('file'),controller['upload']);router[_0xeea0('0x19')](_0xeea0('0x2f'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x30')]);router[_0xeea0('0x31')](_0xeea0('0xc'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x32')]);router['delete'](_0xeea0('0xc'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x33')]);module[_0xeea0('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 04068d3..b1747e2 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 _0xf611=['STRING','setDataValue','getDataValue','TEXT','long','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','alias'];(function(_0x3d49bc,_0x1ce1e4){var _0x4d3f6a=function(_0x3fdd06){while(--_0x3fdd06){_0x3d49bc['push'](_0x3d49bc['shift']());}};_0x4d3f6a(++_0x1ce1e4);}(_0xf611,0x1cc));var _0x1f61=function(_0x2bbdc4,_0x2cb88e){_0x2bbdc4=_0x2bbdc4-0x0;var _0x482d0c=_0xf611[_0x2bbdc4];return _0x482d0c;};'use strict';var Sequelize=require(_0x1f61('0x0'));var _=require(_0x1f61('0x1'));module[_0x1f61('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x15380e){return this['getDataValue'](_0x1f61('0x3'));}},'alias':{'type':Sequelize[_0x1f61('0x4')],'allowNull':![],'set':function(_0x330e2c){this[_0x1f61('0x5')](_0x1f61('0x3'),_0x330e2c?_0x330e2c:this[_0x1f61('0x6')]('name'));}},'type':{'type':Sequelize[_0x1f61('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x1f61('0x7')](_0x1f61('0x8')),'get':function(){if(this[_0x1f61('0x6')]('type')==='select'){return JSON[_0x1f61('0x9')](this[_0x1f61('0x6')]('values'));}else{return this[_0x1f61('0x6')](_0x1f61('0xa'));}},'set':function(_0x211a36){if(Array[_0x1f61('0xb')](_0x211a36)){this[_0x1f61('0x5')]('values',JSON[_0x1f61('0xc')](_0x211a36));}else{this['setDataValue'](_0x1f61('0xa'),_0x211a36);}}},'required':{'type':Sequelize[_0x1f61('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1f61('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1f61('0xe')](_0x1f61('0xf'))}}; \ No newline at end of file +var _0x0713=['long','type','select','parse','values','isArray','BOOLEAN','ENUM','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT'];(function(_0xdedbff,_0x9b8d56){var _0x2d71f9=function(_0x81e1df){while(--_0x81e1df){_0xdedbff['push'](_0xdedbff['shift']());}};_0x2d71f9(++_0x9b8d56);}(_0x0713,0xc3));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3071('0x0'));module[_0x3071('0x1')]={'name':{'type':Sequelize[_0x3071('0x2')],'get':function(_0x598c37){return this[_0x3071('0x3')](_0x3071('0x4'));}},'alias':{'type':Sequelize[_0x3071('0x5')],'allowNull':![],'set':function(_0x1c8024){this[_0x3071('0x6')]('alias',_0x1c8024?_0x1c8024:this[_0x3071('0x3')](_0x3071('0x7')));}},'type':{'type':Sequelize[_0x3071('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9')),'get':function(){if(this[_0x3071('0x3')](_0x3071('0xa'))===_0x3071('0xb')){return JSON[_0x3071('0xc')](this[_0x3071('0x3')](_0x3071('0xd')));}else{return this['getDataValue']('values');}},'set':function(_0xc7bfe5){if(Array[_0x3071('0xe')](_0xc7bfe5)){this[_0x3071('0x6')](_0x3071('0xd'),JSON['stringify'](_0xc7bfe5));}else{this[_0x3071('0x6')](_0x3071('0xd'),_0xc7bfe5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3071('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3071('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 28c2441..caf6299 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 _0xef45=['squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','apply','reject','save','update','then','destroy','stack','name','index','map','CmCustomField','rawAttributes','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','body','params','create','TEXT','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash'];(function(_0x34e52a,_0x1aa97d){var _0x27ecc9=function(_0x3fca83){while(--_0x3fca83){_0x34e52a['push'](_0x34e52a['shift']());}};_0x27ecc9(++_0x1aa97d);}(_0xef45,0x9f));var _0x5ef4=function(_0x22e63f,_0x233956){_0x22e63f=_0x22e63f-0x0;var _0x51339d=_0xef45[_0x22e63f];return _0x51339d;};'use strict';var emlformat=require(_0x5ef4('0x0'));var rimraf=require(_0x5ef4('0x1'));var zipdir=require(_0x5ef4('0x2'));var jsonpatch=require(_0x5ef4('0x3'));var rp=require(_0x5ef4('0x4'));var moment=require(_0x5ef4('0x5'));var BPromise=require(_0x5ef4('0x6'));var Mustache=require(_0x5ef4('0x7'));var util=require('util');var path=require(_0x5ef4('0x8'));var sox=require(_0x5ef4('0x9'));var csv=require(_0x5ef4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ef4('0xb'));var _=require(_0x5ef4('0xc'));var squel=require(_0x5ef4('0xd'));var crypto=require('crypto');var jsforce=require(_0x5ef4('0xe'));var deskjs=require(_0x5ef4('0xf'));var toCsv=require(_0x5ef4('0xa'));var querystring=require(_0x5ef4('0x10'));var Papa=require('papaparse');var Redis=require(_0x5ef4('0x11'));var authService=require(_0x5ef4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5ef4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ef4('0x14'))(_0x5ef4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ef4('0x16'));var db=require(_0x5ef4('0x17'))['db'];function respondWithStatusCode(_0x24a484,_0x22f92d){_0x22f92d=_0x22f92d||0xcc;return function(_0xdfa3f2){if(_0xdfa3f2){return _0x24a484[_0x5ef4('0x18')](_0x22f92d);}return _0x24a484['status'](_0x22f92d)[_0x5ef4('0x19')]();};}function respondWithResult(_0x4e23e2,_0xae6835){_0xae6835=_0xae6835||0xc8;return function(_0x3d575c){if(_0x3d575c){return _0x4e23e2[_0x5ef4('0x1a')](_0xae6835)[_0x5ef4('0x1b')](_0x3d575c);}};}function respondWithFilteredResult(_0x165254,_0x56cce0){return function(_0x2724a4){if(_0x2724a4){var _0x353f5a=typeof _0x56cce0['offset']===_0x5ef4('0x1c')&&typeof _0x56cce0[_0x5ef4('0x1d')]===_0x5ef4('0x1c');var _0x54e639=_0x2724a4['count'];var _0x1db3ae=_0x353f5a?0x0:_0x56cce0[_0x5ef4('0x1e')];var _0x2d4fcc=_0x353f5a?_0x2724a4['count']:_0x56cce0[_0x5ef4('0x1e')]+_0x56cce0[_0x5ef4('0x1d')];var _0x2f8731;if(_0x2d4fcc>=_0x54e639){_0x2d4fcc=_0x54e639;_0x2f8731=0xc8;}else{_0x2f8731=0xce;}_0x165254[_0x5ef4('0x1a')](_0x2f8731);return _0x165254[_0x5ef4('0x1f')]('Content-Range',_0x1db3ae+'-'+_0x2d4fcc+'/'+_0x54e639)[_0x5ef4('0x1b')](_0x2724a4);}return null;};}function patchUpdates(_0x3d617e){return function(_0x556791){try{jsonpatch[_0x5ef4('0x20')](_0x556791,_0x3d617e,!![]);}catch(_0x591281){return BPromise[_0x5ef4('0x21')](_0x591281);}return _0x556791[_0x5ef4('0x22')]();};}function saveUpdates(_0x4389da,_0x5b640d){return function(_0x4e0e69){if(_0x4e0e69){return _0x4e0e69[_0x5ef4('0x23')](_0x4389da)[_0x5ef4('0x24')](function(_0x4fcb82){return _0x4fcb82;});}return null;};}function removeEntity(_0x462a98,_0x523c94){return function(_0x50610d){if(_0x50610d){return _0x50610d[_0x5ef4('0x25')]()[_0x5ef4('0x24')](function(){_0x462a98[_0x5ef4('0x1a')](0xcc)[_0x5ef4('0x19')]();});}};}function handleEntityNotFound(_0x39619e,_0x1d96d2){return function(_0x4e537e){if(!_0x4e537e){_0x39619e[_0x5ef4('0x18')](0x194);}return _0x4e537e;};}function handleError(_0x58eb58,_0x4fa87e){_0x4fa87e=_0x4fa87e||0x1f4;return function(_0x50c447){logger['error'](_0x50c447[_0x5ef4('0x26')]);if(_0x50c447['name']){delete _0x50c447[_0x5ef4('0x27')];}_0x58eb58[_0x5ef4('0x1a')](_0x4fa87e)['send'](_0x50c447);};}exports[_0x5ef4('0x28')]=function(_0x256378,_0x17df64){var _0x47b6d3={},_0x2b32b5={},_0x49ecc5={'count':0x0,'rows':[]};var _0x318925=_[_0x5ef4('0x29')](db[_0x5ef4('0x2a')][_0x5ef4('0x2b')],function(_0xafb3fd){return{'name':_0xafb3fd['fieldName'],'type':_0xafb3fd[_0x5ef4('0x2c')]['key']};});_0x2b32b5[_0x5ef4('0x2d')]=_[_0x5ef4('0x2e')](_[_0x5ef4('0x29')](_0x318925,_0x5ef4('0x27')),[_0x5ef4('0x27')]);_0x2b32b5[_0x5ef4('0x2f')]=_[_0x5ef4('0x30')](_0x256378[_0x5ef4('0x2f')]);_0x2b32b5[_0x5ef4('0x31')]=_[_0x5ef4('0x32')](_0x2b32b5[_0x5ef4('0x2d')],_0x2b32b5[_0x5ef4('0x2f')]);_0x47b6d3[_0x5ef4('0x33')]=_[_0x5ef4('0x32')](_0x2b32b5[_0x5ef4('0x2d')],qs[_0x5ef4('0x34')](_0x256378[_0x5ef4('0x2f')][_0x5ef4('0x34')]));_0x47b6d3[_0x5ef4('0x33')]=_0x47b6d3[_0x5ef4('0x33')][_0x5ef4('0x35')]?_0x47b6d3[_0x5ef4('0x33')]:_0x2b32b5['model'];if(!_0x256378[_0x5ef4('0x2f')][_0x5ef4('0x36')]('nolimit')){_0x47b6d3[_0x5ef4('0x1d')]=qs['limit'](_0x256378['query'][_0x5ef4('0x1d')]);_0x47b6d3[_0x5ef4('0x1e')]=qs[_0x5ef4('0x1e')](_0x256378[_0x5ef4('0x2f')][_0x5ef4('0x1e')]);}_0x47b6d3[_0x5ef4('0x37')]=qs[_0x5ef4('0x38')](_0x256378['query'][_0x5ef4('0x38')]);_0x47b6d3['where']=qs[_0x5ef4('0x31')](_[_0x5ef4('0x39')](_0x256378[_0x5ef4('0x2f')],_0x2b32b5[_0x5ef4('0x31')]),_0x318925);if(_0x256378[_0x5ef4('0x2f')][_0x5ef4('0x3a')]){_0x47b6d3['where']=_[_0x5ef4('0x3b')](_0x47b6d3[_0x5ef4('0x3c')],{'$or':_[_0x5ef4('0x29')](_0x318925,function(_0x3dc73d){if(_0x3dc73d[_0x5ef4('0x2c')]!==_0x5ef4('0x3d')){var _0x7aaf79={};_0x7aaf79[_0x3dc73d[_0x5ef4('0x27')]]={'$like':'%'+_0x256378[_0x5ef4('0x2f')][_0x5ef4('0x3a')]+'%'};return _0x7aaf79;}})});}_0x47b6d3=_[_0x5ef4('0x3b')]({},_0x47b6d3,_0x256378['options']);var _0x4ea4a6={'where':_0x47b6d3[_0x5ef4('0x3c')]};return db['CmCustomField']['count'](_0x4ea4a6)[_0x5ef4('0x24')](function(_0x4ae437){_0x49ecc5[_0x5ef4('0x3e')]=_0x4ae437;if(_0x256378[_0x5ef4('0x2f')][_0x5ef4('0x3f')]){_0x47b6d3[_0x5ef4('0x40')]=[{'all':!![]}];}return db[_0x5ef4('0x2a')][_0x5ef4('0x41')](_0x47b6d3);})[_0x5ef4('0x24')](function(_0x4e3204){_0x49ecc5[_0x5ef4('0x42')]=_0x4e3204;return _0x49ecc5;})[_0x5ef4('0x24')](respondWithFilteredResult(_0x17df64,_0x47b6d3))[_0x5ef4('0x43')](handleError(_0x17df64,null));};exports[_0x5ef4('0x44')]=function(_0x1eb2b2,_0x36c759){var _0x50b0aa={'raw':!![],'where':{'id':_0x1eb2b2['params']['id']}},_0x119259={};_0x119259['model']=_[_0x5ef4('0x30')](db[_0x5ef4('0x2a')][_0x5ef4('0x2b')]);_0x119259[_0x5ef4('0x2f')]=_['keys'](_0x1eb2b2['query']);_0x119259[_0x5ef4('0x31')]=_['intersection'](_0x119259[_0x5ef4('0x2d')],_0x119259[_0x5ef4('0x2f')]);_0x50b0aa[_0x5ef4('0x33')]=_[_0x5ef4('0x32')](_0x119259['model'],qs[_0x5ef4('0x34')](_0x1eb2b2[_0x5ef4('0x2f')]['fields']));_0x50b0aa['attributes']=_0x50b0aa['attributes'][_0x5ef4('0x35')]?_0x50b0aa[_0x5ef4('0x33')]:_0x119259[_0x5ef4('0x2d')];if(_0x1eb2b2[_0x5ef4('0x2f')][_0x5ef4('0x3f')]){_0x50b0aa[_0x5ef4('0x40')]=[{'all':!![]}];}_0x50b0aa=_[_0x5ef4('0x3b')]({},_0x50b0aa,_0x1eb2b2[_0x5ef4('0x45')]);return db['CmCustomField'][_0x5ef4('0x46')](_0x50b0aa)[_0x5ef4('0x24')](handleEntityNotFound(_0x36c759,null))[_0x5ef4('0x24')](respondWithResult(_0x36c759,null))['catch'](handleError(_0x36c759,null));};exports[_0x5ef4('0x23')]=function(_0x28b447,_0x1597a9){if(_0x28b447[_0x5ef4('0x47')]['id']){delete _0x28b447[_0x5ef4('0x47')]['id'];}return db[_0x5ef4('0x2a')][_0x5ef4('0x46')]({'where':{'id':_0x28b447['params']['id']}})[_0x5ef4('0x24')](handleEntityNotFound(_0x1597a9,null))['then'](saveUpdates(_0x28b447[_0x5ef4('0x47')],null))[_0x5ef4('0x24')](respondWithResult(_0x1597a9,null))['catch'](handleError(_0x1597a9,null));};exports['destroy']=function(_0x25a2fd,_0x1f528f){return db[_0x5ef4('0x2a')][_0x5ef4('0x46')]({'where':{'id':_0x25a2fd[_0x5ef4('0x48')]['id']}})[_0x5ef4('0x24')](handleEntityNotFound(_0x1f528f,null))[_0x5ef4('0x24')](removeEntity(_0x1f528f,null))[_0x5ef4('0x43')](handleError(_0x1f528f,null));};exports[_0x5ef4('0x49')]=function(_0x3eefdd,_0x269750){var _0x206d58;return db['sequelize']['transaction'](function(_0x26d106){return db[_0x5ef4('0x2a')]['create'](_0x3eefdd[_0x5ef4('0x47')],{'transaction':_0x26d106})['then'](function(_0xef113c){_0x206d58=_0xef113c;var _0x42e55b={'type':db['Sequelize'][_0x5ef4('0x4a')],'transaction':_0x26d106};switch(_0x3eefdd['body'][_0x5ef4('0x2c')]){case'text':_0x42e55b[_0x5ef4('0x2c')]=db['Sequelize'][_0x5ef4('0x4a')];break;case'number':_0x42e55b[_0x5ef4('0x2c')]=db[_0x5ef4('0x4b')][_0x5ef4('0x4c')];break;case _0x5ef4('0x4d'):_0x42e55b[_0x5ef4('0x2c')]=db['Sequelize'][_0x5ef4('0x4e')];_0x42e55b[_0x5ef4('0x4f')]=![];break;default:}return db[_0x5ef4('0x50')][_0x5ef4('0x51')][_0x5ef4('0x52')](_0x5ef4('0x53'),util[_0x5ef4('0x54')](_0x5ef4('0x55'),_0x206d58['id']),_0x42e55b);})['then'](function(){return _0x206d58;});})[_0x5ef4('0x24')](respondWithResult(_0x269750,0xc9))[_0x5ef4('0x43')](handleError(_0x269750,null));}; \ No newline at end of file +var _0xd05e=['filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd05e,0x75));var _0xed05=function(_0x359b13,_0x520ff4){_0x359b13=_0x359b13-0x0;var _0x131cb1=_0xd05e[_0x359b13];return _0x131cb1;};'use strict';var emlformat=require(_0xed05('0x0'));var rimraf=require(_0xed05('0x1'));var zipdir=require(_0xed05('0x2'));var jsonpatch=require(_0xed05('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xed05('0x4'));var Mustache=require(_0xed05('0x5'));var util=require(_0xed05('0x6'));var path=require(_0xed05('0x7'));var sox=require(_0xed05('0x8'));var csv=require(_0xed05('0x9'));var ejs=require(_0xed05('0xa'));var fs=require('fs');var fs_extra=require(_0xed05('0xb'));var _=require(_0xed05('0xc'));var squel=require(_0xed05('0xd'));var crypto=require(_0xed05('0xe'));var jsforce=require(_0xed05('0xf'));var deskjs=require(_0xed05('0x10'));var toCsv=require(_0xed05('0x9'));var querystring=require(_0xed05('0x11'));var Papa=require(_0xed05('0x12'));var Redis=require(_0xed05('0x13'));var authService=require(_0xed05('0x14'));var qs=require(_0xed05('0x15'));var as=require(_0xed05('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed05('0x17'));var utils=require(_0xed05('0x18'));var config=require(_0xed05('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xed05('0x1a'))['db'];function respondWithStatusCode(_0x21d0bb,_0xa4e199){_0xa4e199=_0xa4e199||0xcc;return function(_0x5221da){if(_0x5221da){return _0x21d0bb[_0xed05('0x1b')](_0xa4e199);}return _0x21d0bb[_0xed05('0x1c')](_0xa4e199)[_0xed05('0x1d')]();};}function respondWithResult(_0x5ea9f3,_0x4d47f4){_0x4d47f4=_0x4d47f4||0xc8;return function(_0x38d8aa){if(_0x38d8aa){return _0x5ea9f3[_0xed05('0x1c')](_0x4d47f4)[_0xed05('0x1e')](_0x38d8aa);}};}function respondWithFilteredResult(_0x5d1b17,_0x367835){return function(_0x18774c){if(_0x18774c){var _0x3948ac=typeof _0x367835[_0xed05('0x1f')]===_0xed05('0x20')&&typeof _0x367835[_0xed05('0x21')]==='undefined';var _0x2e2847=_0x18774c[_0xed05('0x22')];var _0x3a636e=_0x3948ac?0x0:_0x367835[_0xed05('0x1f')];var _0xf7df65=_0x3948ac?_0x18774c[_0xed05('0x22')]:_0x367835[_0xed05('0x1f')]+_0x367835[_0xed05('0x21')];var _0x45b8f7;if(_0xf7df65>=_0x2e2847){_0xf7df65=_0x2e2847;_0x45b8f7=0xc8;}else{_0x45b8f7=0xce;}_0x5d1b17[_0xed05('0x1c')](_0x45b8f7);return _0x5d1b17[_0xed05('0x23')](_0xed05('0x24'),_0x3a636e+'-'+_0xf7df65+'/'+_0x2e2847)[_0xed05('0x1e')](_0x18774c);}return null;};}function patchUpdates(_0x46d45f){return function(_0x3ad874){try{jsonpatch[_0xed05('0x25')](_0x3ad874,_0x46d45f,!![]);}catch(_0x3c9158){return BPromise[_0xed05('0x26')](_0x3c9158);}return _0x3ad874[_0xed05('0x27')]();};}function saveUpdates(_0x5aa78d,_0x5b4604){return function(_0x4376a0){if(_0x4376a0){return _0x4376a0[_0xed05('0x28')](_0x5aa78d)[_0xed05('0x29')](function(_0x124cf1){return _0x124cf1;});}return null;};}function removeEntity(_0x381cc4,_0x204f06){return function(_0x9ad4f2){if(_0x9ad4f2){return _0x9ad4f2[_0xed05('0x2a')]()[_0xed05('0x29')](function(){_0x381cc4[_0xed05('0x1c')](0xcc)[_0xed05('0x1d')]();});}};}function handleEntityNotFound(_0x56493e,_0x136b0b){return function(_0x23b936){if(!_0x23b936){_0x56493e[_0xed05('0x1b')](0x194);}return _0x23b936;};}function handleError(_0x42fd9a,_0x7a45fd){_0x7a45fd=_0x7a45fd||0x1f4;return function(_0x1d1c4f){logger[_0xed05('0x2b')](_0x1d1c4f['stack']);if(_0x1d1c4f[_0xed05('0x2c')]){delete _0x1d1c4f[_0xed05('0x2c')];}_0x42fd9a[_0xed05('0x1c')](_0x7a45fd)['send'](_0x1d1c4f);};}exports[_0xed05('0x2d')]=function(_0xe3f8af,_0x205cac){var _0x1703ea={},_0x2b2480={},_0x4b8ef6={'count':0x0,'rows':[]};var _0xfbb219=_[_0xed05('0x2e')](db[_0xed05('0x2f')][_0xed05('0x30')],function(_0x219bd7){return{'name':_0x219bd7[_0xed05('0x31')],'type':_0x219bd7[_0xed05('0x32')][_0xed05('0x33')]};});_0x2b2480[_0xed05('0x34')]=_['differenceBy'](_[_0xed05('0x2e')](_0xfbb219,_0xed05('0x2c')),[_0xed05('0x2c')]);_0x2b2480[_0xed05('0x35')]=_[_0xed05('0x36')](_0xe3f8af[_0xed05('0x35')]);_0x2b2480['filters']=_['intersection'](_0x2b2480[_0xed05('0x34')],_0x2b2480[_0xed05('0x35')]);_0x1703ea[_0xed05('0x37')]=_['intersection'](_0x2b2480['model'],qs['fields'](_0xe3f8af['query'][_0xed05('0x38')]));_0x1703ea[_0xed05('0x37')]=_0x1703ea['attributes'][_0xed05('0x39')]?_0x1703ea['attributes']:_0x2b2480[_0xed05('0x34')];if(!_0xe3f8af[_0xed05('0x35')][_0xed05('0x3a')]('nolimit')){_0x1703ea['limit']=qs[_0xed05('0x21')](_0xe3f8af[_0xed05('0x35')][_0xed05('0x21')]);_0x1703ea['offset']=qs[_0xed05('0x1f')](_0xe3f8af[_0xed05('0x35')][_0xed05('0x1f')]);}_0x1703ea['order']=qs[_0xed05('0x3b')](_0xe3f8af[_0xed05('0x35')][_0xed05('0x3b')]);_0x1703ea[_0xed05('0x3c')]=qs[_0xed05('0x3d')](_[_0xed05('0x3e')](_0xe3f8af[_0xed05('0x35')],_0x2b2480[_0xed05('0x3d')]),_0xfbb219);if(_0xe3f8af[_0xed05('0x35')][_0xed05('0x3f')]){_0x1703ea[_0xed05('0x3c')]=_[_0xed05('0x40')](_0x1703ea[_0xed05('0x3c')],{'$or':_[_0xed05('0x2e')](_0xfbb219,function(_0x5d67a7){if(_0x5d67a7[_0xed05('0x32')]!=='VIRTUAL'){var _0x3e28cc={};_0x3e28cc[_0x5d67a7[_0xed05('0x2c')]]={'$like':'%'+_0xe3f8af['query']['filter']+'%'};return _0x3e28cc;}})});}_0x1703ea=_[_0xed05('0x40')]({},_0x1703ea,_0xe3f8af[_0xed05('0x41')]);var _0x160508={'where':_0x1703ea[_0xed05('0x3c')]};return db[_0xed05('0x2f')][_0xed05('0x22')](_0x160508)['then'](function(_0x4b610e){_0x4b8ef6[_0xed05('0x22')]=_0x4b610e;if(_0xe3f8af[_0xed05('0x35')]['includeAll']){_0x1703ea[_0xed05('0x42')]=[{'all':!![]}];}return db[_0xed05('0x2f')][_0xed05('0x43')](_0x1703ea);})[_0xed05('0x29')](function(_0x15150b){_0x4b8ef6[_0xed05('0x44')]=_0x15150b;return _0x4b8ef6;})['then'](respondWithFilteredResult(_0x205cac,_0x1703ea))[_0xed05('0x45')](handleError(_0x205cac,null));};exports[_0xed05('0x46')]=function(_0x153aab,_0x1e9054){var _0x7258ce={'raw':!![],'where':{'id':_0x153aab[_0xed05('0x47')]['id']}},_0x2d72b9={};_0x2d72b9[_0xed05('0x34')]=_['keys'](db[_0xed05('0x2f')][_0xed05('0x30')]);_0x2d72b9[_0xed05('0x35')]=_['keys'](_0x153aab[_0xed05('0x35')]);_0x2d72b9[_0xed05('0x3d')]=_[_0xed05('0x48')](_0x2d72b9[_0xed05('0x34')],_0x2d72b9['query']);_0x7258ce['attributes']=_['intersection'](_0x2d72b9[_0xed05('0x34')],qs[_0xed05('0x38')](_0x153aab[_0xed05('0x35')]['fields']));_0x7258ce[_0xed05('0x37')]=_0x7258ce[_0xed05('0x37')]['length']?_0x7258ce['attributes']:_0x2d72b9[_0xed05('0x34')];if(_0x153aab[_0xed05('0x35')][_0xed05('0x49')]){_0x7258ce[_0xed05('0x42')]=[{'all':!![]}];}_0x7258ce=_['merge']({},_0x7258ce,_0x153aab['options']);return db['CmCustomField'][_0xed05('0x4a')](_0x7258ce)[_0xed05('0x29')](handleEntityNotFound(_0x1e9054,null))[_0xed05('0x29')](respondWithResult(_0x1e9054,null))[_0xed05('0x45')](handleError(_0x1e9054,null));};exports[_0xed05('0x28')]=function(_0x532246,_0x5bf6ce){if(_0x532246[_0xed05('0x4b')]['id']){delete _0x532246[_0xed05('0x4b')]['id'];}return db[_0xed05('0x2f')][_0xed05('0x4a')]({'where':{'id':_0x532246[_0xed05('0x47')]['id']}})[_0xed05('0x29')](handleEntityNotFound(_0x5bf6ce,null))[_0xed05('0x29')](saveUpdates(_0x532246[_0xed05('0x4b')],null))[_0xed05('0x29')](respondWithResult(_0x5bf6ce,null))[_0xed05('0x45')](handleError(_0x5bf6ce,null));};exports[_0xed05('0x2a')]=function(_0x56d98a,_0x17f13e){return db[_0xed05('0x2f')][_0xed05('0x4a')]({'where':{'id':_0x56d98a[_0xed05('0x47')]['id']}})[_0xed05('0x29')](handleEntityNotFound(_0x17f13e,null))[_0xed05('0x29')](removeEntity(_0x17f13e,null))['catch'](handleError(_0x17f13e,null));};exports[_0xed05('0x4c')]=function(_0x1cfb21,_0x27b03e){var _0x5778bc;return db[_0xed05('0x4d')][_0xed05('0x4e')](function(_0x15400a){return db[_0xed05('0x2f')]['create'](_0x1cfb21['body'],{'transaction':_0x15400a})[_0xed05('0x29')](function(_0x5d387d){_0x5778bc=_0x5d387d;var _0x57994d={'type':db[_0xed05('0x4f')][_0xed05('0x50')],'transaction':_0x15400a};switch(_0x1cfb21[_0xed05('0x4b')][_0xed05('0x32')]){case'text':_0x57994d[_0xed05('0x32')]=db[_0xed05('0x4f')][_0xed05('0x50')];break;case _0xed05('0x51'):_0x57994d['type']=db[_0xed05('0x4f')][_0xed05('0x52')];break;case'switch':_0x57994d['type']=db[_0xed05('0x4f')][_0xed05('0x53')];_0x57994d['defaultValue']=![];break;default:}return db[_0xed05('0x4d')][_0xed05('0x54')][_0xed05('0x55')](_0xed05('0x56'),util[_0xed05('0x57')](_0xed05('0x58'),_0x5778bc['id']),_0x57994d);})[_0xed05('0x29')](function(){return _0x5778bc;});})['then'](respondWithResult(_0x27b03e,0xc9))['catch'](handleError(_0x27b03e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8b11cb2..5e34cb5 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 _0x6930=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x1f2422,_0x125fd2){var _0x4fb420=function(_0x1b8cc6){while(--_0x1b8cc6){_0x1f2422['push'](_0x1f2422['shift']());}};_0x4fb420(++_0x125fd2);}(_0x6930,0xf9));var _0x0693=function(_0x13fd65,_0x5d5208){_0x13fd65=_0x13fd65-0x0;var _0x2fc899=_0x6930[_0x13fd65];return _0x2fc899;};'use strict';var _=require(_0x0693('0x0'));var util=require(_0x0693('0x1'));var logger=require(_0x0693('0x2'))(_0x0693('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0693('0x4'));var fs=require('fs');var path=require(_0x0693('0x5'));var rimraf=require(_0x0693('0x6'));var config=require(_0x0693('0x7'));var attributes=require(_0x0693('0x8'));module[_0x0693('0x9')]=function(_0x55380b,_0x498812){return _0x55380b[_0x0693('0xa')](_0x0693('0xb'),attributes,{'tableName':_0x0693('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56b8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField'];(function(_0x166c30,_0x308b9b){var _0x34cf80=function(_0x4a9872){while(--_0x4a9872){_0x166c30['push'](_0x166c30['shift']());}};_0x34cf80(++_0x308b9b);}(_0x56b8,0x1a4));var _0x856b=function(_0x55e189,_0x5b53da){_0x55e189=_0x55e189-0x0;var _0x5db261=_0x56b8[_0x55e189];return _0x5db261;};'use strict';var _=require('lodash');var util=require(_0x856b('0x0'));var logger=require(_0x856b('0x1'))(_0x856b('0x2'));var moment=require(_0x856b('0x3'));var BPromise=require(_0x856b('0x4'));var rp=require(_0x856b('0x5'));var fs=require('fs');var path=require(_0x856b('0x6'));var rimraf=require(_0x856b('0x7'));var config=require(_0x856b('0x8'));var attributes=require(_0x856b('0x9'));module[_0x856b('0xa')]=function(_0x4b6a08,_0x28a416){return _0x4b6a08['define'](_0x856b('0xb'),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 ed63896..55a33da 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 _0x268d=['rpc','http','request','then','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x3f8ff4,_0x5c3c84){var _0x4a459b=function(_0x494853){while(--_0x494853){_0x3f8ff4['push'](_0x3f8ff4['shift']());}};_0x4a459b(++_0x5c3c84);}(_0x268d,0x12d));var _0xd268=function(_0x4644b6,_0x41e54b){_0x4644b6=_0x4644b6-0x0;var _0x2cce85=_0x268d[_0x4644b6];return _0x2cce85;};'use strict';var _=require(_0xd268('0x0'));var util=require('util');var moment=require(_0xd268('0x1'));var BPromise=require('bluebird');var rs=require(_0xd268('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd268('0x3'));var logger=require(_0xd268('0x4'))(_0xd268('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd268('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x8dae9b,_0x47dd3e,_0xf631c){return new BPromise(function(_0x409665,_0x1269f){return client[_0xd268('0x7')](_0x8dae9b,_0xf631c)[_0xd268('0x8')](function(_0x34dc9f){logger['info'](_0xd268('0x9'),_0x47dd3e,'request\x20sent');logger['debug'](_0xd268('0xa'),_0x47dd3e,_0xd268('0xb'),JSON[_0xd268('0xc')](_0x34dc9f));if(_0x34dc9f['error']){if(_0x34dc9f['error'][_0xd268('0xd')]===0x1f4){logger[_0xd268('0xe')](_0xd268('0x9'),_0x47dd3e,_0x34dc9f['error'][_0xd268('0xf')]);return _0x1269f(_0x34dc9f['error']['message']);}logger[_0xd268('0xe')]('CmCustomField,\x20%s,\x20%s',_0x47dd3e,_0x34dc9f[_0xd268('0xe')][_0xd268('0xf')]);return _0x409665(_0x34dc9f['error'][_0xd268('0xf')]);}else{logger['info'](_0xd268('0x9'),_0x47dd3e,'request\x20sent');_0x409665(_0x34dc9f[_0xd268('0x10')][_0xd268('0xf')]);}})[_0xd268('0x11')](function(_0x474212){logger[_0xd268('0xe')](_0xd268('0x9'),_0x47dd3e,_0x474212);_0x1269f(_0x474212);});});} \ No newline at end of file +var _0xeb33=['moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x4d08d5,_0x4517e0){var _0x4e5a66=function(_0x48601c){while(--_0x48601c){_0x4d08d5['push'](_0x4d08d5['shift']());}};_0x4e5a66(++_0x4517e0);}(_0xeb33,0xf0));var _0x3eb3=function(_0x227b61,_0x43d699){_0x227b61=_0x227b61-0x0;var _0xa5c06c=_0xeb33[_0x227b61];return _0xa5c06c;};'use strict';var _=require(_0x3eb3('0x0'));var util=require(_0x3eb3('0x1'));var moment=require(_0x3eb3('0x2'));var BPromise=require('bluebird');var rs=require(_0x3eb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3eb3('0x4'))(_0x3eb3('0x5'));var config=require(_0x3eb3('0x6'));var jayson=require(_0x3eb3('0x7'));var client=jayson['client'][_0x3eb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf76efb,_0x4deb69,_0x2bd7f2){return new BPromise(function(_0xb2463c,_0x36c63b){return client[_0x3eb3('0x9')](_0xf76efb,_0x2bd7f2)[_0x3eb3('0xa')](function(_0x4bacce){logger[_0x3eb3('0xb')]('CmCustomField,\x20%s,\x20%s',_0x4deb69,'request\x20sent');logger[_0x3eb3('0xc')](_0x3eb3('0xd'),_0x4deb69,_0x3eb3('0xe'),JSON[_0x3eb3('0xf')](_0x4bacce));if(_0x4bacce[_0x3eb3('0x10')]){if(_0x4bacce['error'][_0x3eb3('0x11')]===0x1f4){logger[_0x3eb3('0x10')]('CmCustomField,\x20%s,\x20%s',_0x4deb69,_0x4bacce[_0x3eb3('0x10')]['message']);return _0x36c63b(_0x4bacce[_0x3eb3('0x10')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x4deb69,_0x4bacce['error']['message']);return _0xb2463c(_0x4bacce['error'][_0x3eb3('0x12')]);}else{logger['info'](_0x3eb3('0x13'),_0x4deb69,_0x3eb3('0xe'));_0xb2463c(_0x4bacce[_0x3eb3('0x14')]['message']);}})[_0x3eb3('0x15')](function(_0x44362f){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4deb69,_0x44362f);_0x36c63b(_0x44362f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0271f64..e72edb6 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 _0x3d2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','show','post','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x40eea5,_0x366541){var _0x1dc8ea=function(_0x26c3ff){while(--_0x26c3ff){_0x40eea5['push'](_0x40eea5['shift']());}};_0x1dc8ea(++_0x366541);}(_0x3d2f,0x78));var _0xf3d2=function(_0x1c16c8,_0x134fe3){_0x1c16c8=_0x1c16c8-0x0;var _0x2e9719=_0x3d2f[_0x1c16c8];return _0x2e9719;};'use strict';var multer=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var path=require(_0xf3d2('0x2'));var timeout=require(_0xf3d2('0x3'));var express=require(_0xf3d2('0x4'));var router=express['Router']();var fs_extra=require(_0xf3d2('0x5'));var auth=require(_0xf3d2('0x6'));var interaction=require(_0xf3d2('0x7'));var config=require(_0xf3d2('0x8'));var controller=require(_0xf3d2('0x9'));router[_0xf3d2('0xa')]('/',auth['isAuthenticated'](),controller[_0xf3d2('0xb')]);router[_0xf3d2('0xa')]('/:id',auth[_0xf3d2('0xc')](),controller[_0xf3d2('0xd')]);router[_0xf3d2('0xe')]('/',auth[_0xf3d2('0xc')](),controller['create']);router['put'](_0xf3d2('0xf'),auth[_0xf3d2('0xc')](),controller[_0xf3d2('0x10')]);router[_0xf3d2('0x11')](_0xf3d2('0xf'),auth[_0xf3d2('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x12e9=['../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','exports','path','express','Router'];(function(_0x535ceb,_0x4e6ee8){var _0x5a0ebd=function(_0x1f60e1){while(--_0x1f60e1){_0x535ceb['push'](_0x535ceb['shift']());}};_0x5a0ebd(++_0x4e6ee8);}(_0x12e9,0x66));var _0x912e=function(_0x3c2557,_0x2b3dab){_0x3c2557=_0x3c2557-0x0;var _0x20902d=_0x12e9[_0x3c2557];return _0x20902d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x912e('0x0'));var timeout=require('connect-timeout');var express=require(_0x912e('0x1'));var router=express[_0x912e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x912e('0x3'));var interaction=require(_0x912e('0x4'));var config=require('../../config/environment');var controller=require(_0x912e('0x5'));router[_0x912e('0x6')]('/',auth[_0x912e('0x7')](),controller[_0x912e('0x8')]);router['get'](_0x912e('0x9'),auth[_0x912e('0x7')](),controller[_0x912e('0xa')]);router[_0x912e('0xb')]('/',auth[_0x912e('0x7')](),controller['create']);router['put']('/:id',auth[_0x912e('0x7')](),controller[_0x912e('0xc')]);router[_0x912e('0xd')](_0x912e('0x9'),auth[_0x912e('0x7')](),controller['destroy']);module[_0x912e('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5e59547..524c650 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 _0x85f8=['BOOLEAN','format','INTEGER','DATE','UNSIGNED','contactListQueue','moment','exports','STRING'];(function(_0x1bff03,_0x5adfe3){var _0x3ec629=function(_0x354cff){while(--_0x354cff){_0x1bff03['push'](_0x1bff03['shift']());}};_0x3ec629(++_0x5adfe3);}(_0x85f8,0x138));var _0x885f=function(_0xa0ba25,_0x65859c){_0xa0ba25=_0xa0ba25-0x0;var _0x3428b6=_0x85f8[_0xa0ba25];return _0x3428b6;};'use strict';var moment=require(_0x885f('0x0'));var Sequelize=require('sequelize');module[_0x885f('0x1')]={'phone':{'type':Sequelize[_0x885f('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x885f('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x885f('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x885f('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x885f('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x885f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x885f('0x6')]},'priority':{'type':Sequelize[_0x885f('0x5')](0x2)[_0x885f('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x885f('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x885f('0x5')],'unique':_0x885f('0x8')},'ListId':{'type':Sequelize[_0x885f('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x885f('0x5')],'unique':_0x885f('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x885f('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x885f('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x885f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x885f('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc524=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','DATE'];(function(_0x3f9a15,_0x2c442a){var _0x34a1cf=function(_0x241d40){while(--_0x241d40){_0x3f9a15['push'](_0x3f9a15['shift']());}};_0x34a1cf(++_0x2c442a);}(_0xc524,0x71));var _0x4c52=function(_0x453c23,_0x2c213c){_0x453c23=_0x453c23-0x0;var _0x339615=_0xc524[_0x453c23];return _0x339615;};'use strict';var moment=require('moment');var Sequelize=require(_0x4c52('0x0'));module[_0x4c52('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4c52('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4c52('0x3')],'defaultValue':moment()['format'](_0x4c52('0x4'))},'countbusyretry':{'type':Sequelize[_0x4c52('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4c52('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4c52('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4c52('0x3')]},'priority':{'type':Sequelize[_0x4c52('0x5')](0x2)[_0x4c52('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4c52('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4c52('0x5')],'unique':_0x4c52('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4c52('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4c52('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4c52('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4c52('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4c52('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4c52('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4c52('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index a2fa3d8..28b0808 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 _0xd1ee=['options','includeAll','findAll','rows','show','params','keys','intersection','catch','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','outbound','preview','dialOrderByScheduledAt','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','Queue','dialActive','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','key','model','query','filters','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x16e8b9,_0xcf89d2){var _0x20f455=function(_0x33c318){while(--_0x33c318){_0x16e8b9['push'](_0x16e8b9['shift']());}};_0x20f455(++_0xcf89d2);}(_0xd1ee,0x15a));var _0xed1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1ee[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xed1e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed1e('0x1'));var rp=require('request-promise');var moment=require(_0xed1e('0x2'));var BPromise=require(_0xed1e('0x3'));var Mustache=require('mustache');var util=require(_0xed1e('0x4'));var path=require(_0xed1e('0x5'));var sox=require(_0xed1e('0x6'));var csv=require(_0xed1e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed1e('0x8'));var squel=require(_0xed1e('0x9'));var crypto=require(_0xed1e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xed1e('0xb'));var toCsv=require(_0xed1e('0x7'));var querystring=require(_0xed1e('0xc'));var Papa=require('papaparse');var Redis=require(_0xed1e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed1e('0xe'));var hardwareService=require(_0xed1e('0xf'));var logger=require(_0xed1e('0x10'))('api');var utils=require(_0xed1e('0x11'));var config=require(_0xed1e('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f8e68,_0xd34a14){_0xd34a14=_0xd34a14||0xcc;return function(_0x4224e2){if(_0x4224e2){return _0x1f8e68['sendStatus'](_0xd34a14);}return _0x1f8e68[_0xed1e('0x13')](_0xd34a14)[_0xed1e('0x14')]();};}function respondWithResult(_0x3ce002,_0x107bbf){_0x107bbf=_0x107bbf||0xc8;return function(_0x438df2){if(_0x438df2){return _0x3ce002[_0xed1e('0x13')](_0x107bbf)[_0xed1e('0x15')](_0x438df2);}};}function respondWithFilteredResult(_0xd198f5,_0x31d22a){return function(_0x527c3d){if(_0x527c3d){var _0x21d55a=typeof _0x31d22a['offset']===_0xed1e('0x16')&&typeof _0x31d22a[_0xed1e('0x17')]===_0xed1e('0x16');var _0x4bbc5a=_0x527c3d[_0xed1e('0x18')];var _0x15ea64=_0x21d55a?0x0:_0x31d22a[_0xed1e('0x19')];var _0x19acec=_0x21d55a?_0x527c3d[_0xed1e('0x18')]:_0x31d22a[_0xed1e('0x19')]+_0x31d22a['limit'];var _0x5f0403;if(_0x19acec>=_0x4bbc5a){_0x19acec=_0x4bbc5a;_0x5f0403=0xc8;}else{_0x5f0403=0xce;}_0xd198f5[_0xed1e('0x13')](_0x5f0403);return _0xd198f5[_0xed1e('0x1a')]('Content-Range',_0x15ea64+'-'+_0x19acec+'/'+_0x4bbc5a)[_0xed1e('0x15')](_0x527c3d);}return null;};}function patchUpdates(_0x15d082){return function(_0x51e2a1){try{jsonpatch[_0xed1e('0x1b')](_0x51e2a1,_0x15d082,!![]);}catch(_0x51ddd4){return BPromise['reject'](_0x51ddd4);}return _0x51e2a1[_0xed1e('0x1c')]();};}function saveUpdates(_0x5d96f0,_0x2e1954){return function(_0x41d06c){if(_0x41d06c){return _0x41d06c[_0xed1e('0x1d')](_0x5d96f0)['then'](function(_0x5d83fe){return _0x5d83fe;});}return null;};}function removeEntity(_0xe91d1b,_0x2c266f){return function(_0x57c4d9){if(_0x57c4d9){return _0x57c4d9[_0xed1e('0x1e')]()[_0xed1e('0x1f')](function(){_0xe91d1b[_0xed1e('0x13')](0xcc)[_0xed1e('0x14')]();});}};}function handleEntityNotFound(_0x4c74e5,_0x3e06d6){return function(_0x84247b){if(!_0x84247b){_0x4c74e5[_0xed1e('0x20')](0x194);}return _0x84247b;};}function handleError(_0x5b8104,_0x583b43){_0x583b43=_0x583b43||0x1f4;return function(_0x29a0db){logger[_0xed1e('0x21')](_0x29a0db[_0xed1e('0x22')]);if(_0x29a0db[_0xed1e('0x23')]){delete _0x29a0db[_0xed1e('0x23')];}_0x5b8104[_0xed1e('0x13')](_0x583b43)[_0xed1e('0x24')](_0x29a0db);};}exports[_0xed1e('0x25')]=function(_0x22b867,_0x453f18){var _0x2473ce={},_0x442738={},_0x2806f3={'count':0x0,'rows':[]};var _0x4dad8d=_[_0xed1e('0x26')](db[_0xed1e('0x27')][_0xed1e('0x28')],function(_0x19b8f3){return{'name':_0x19b8f3['fieldName'],'type':_0x19b8f3['type'][_0xed1e('0x29')]};});_0x442738[_0xed1e('0x2a')]=_[_0xed1e('0x26')](_0x4dad8d,_0xed1e('0x23'));_0x442738['query']=_['keys'](_0x22b867['query']);_0x442738['filters']=_['intersection'](_0x442738[_0xed1e('0x2a')],_0x442738[_0xed1e('0x2b')]);_0x442738[_0xed1e('0x2c')]=_['concat'](_0x442738['filters'],[_0xed1e('0x2d'),_0xed1e('0x2e'),_0xed1e('0x2f'),_0xed1e('0x30'),_0xed1e('0x31'),_0xed1e('0x32'),'$ne',_0xed1e('0x33'),_0xed1e('0x34'),_0xed1e('0x35'),_0xed1e('0x36'),_0xed1e('0x37'),'$notIn',_0xed1e('0x38'),_0xed1e('0x39'),_0xed1e('0x3a'),_0xed1e('0x3b'),'$like',_0xed1e('0x3c'),'$contains',_0xed1e('0x3d'),'$any']);_0x2473ce[_0xed1e('0x3e')]=_['intersection'](_0x442738[_0xed1e('0x2a')],qs[_0xed1e('0x3f')](_0x22b867[_0xed1e('0x2b')]['fields']));_0x2473ce[_0xed1e('0x3e')]=_0x2473ce[_0xed1e('0x3e')][_0xed1e('0x40')]?_0x2473ce[_0xed1e('0x3e')]:_0x442738[_0xed1e('0x2a')];if(!_0x22b867[_0xed1e('0x2b')]['hasOwnProperty'](_0xed1e('0x41'))){_0x2473ce[_0xed1e('0x17')]=qs[_0xed1e('0x17')](_0x22b867[_0xed1e('0x2b')]['limit']);_0x2473ce[_0xed1e('0x19')]=qs['offset'](_0x22b867['query'][_0xed1e('0x19')]);}_0x2473ce[_0xed1e('0x42')]=qs[_0xed1e('0x43')](_0x22b867[_0xed1e('0x2b')][_0xed1e('0x43')]);_0x2473ce[_0xed1e('0x44')]=qs[_0xed1e('0x2c')](_[_0xed1e('0x45')](_0x22b867[_0xed1e('0x2b')],_0x442738[_0xed1e('0x2c')]),_0x4dad8d);if(_0x22b867[_0xed1e('0x2b')][_0xed1e('0x46')]){_0x2473ce[_0xed1e('0x44')]=_[_0xed1e('0x47')](_0x2473ce[_0xed1e('0x44')],{'$or':_[_0xed1e('0x26')](_0x4dad8d,function(_0x1f81bc){if(_0x1f81bc[_0xed1e('0x48')]!==_0xed1e('0x49')){var _0x2d9cf5={};_0x2d9cf5[_0x1f81bc[_0xed1e('0x23')]]={'$like':'%'+_0x22b867[_0xed1e('0x2b')]['filter']+'%'};return _0x2d9cf5;}})});}_0x2473ce=_[_0xed1e('0x47')]({},_0x2473ce,_0x22b867[_0xed1e('0x4a')]);var _0x44c0e5={'where':_0x2473ce[_0xed1e('0x44')]};return db[_0xed1e('0x27')]['count'](_0x44c0e5)['then'](function(_0x488464){_0x2806f3[_0xed1e('0x18')]=_0x488464;if(_0x22b867[_0xed1e('0x2b')][_0xed1e('0x4b')]){_0x2473ce['include']=[{'all':!![]}];}return db[_0xed1e('0x27')][_0xed1e('0x4c')](_0x2473ce);})[_0xed1e('0x1f')](function(_0x1fa503){_0x2806f3[_0xed1e('0x4d')]=_0x1fa503;return _0x2806f3;})['then'](respondWithFilteredResult(_0x453f18,_0x2473ce))['catch'](handleError(_0x453f18,null));};exports[_0xed1e('0x4e')]=function(_0x15d199,_0x16c818){var _0x510875={'raw':!![],'where':{'id':_0x15d199[_0xed1e('0x4f')]['id']}},_0x9743fe={};_0x9743fe[_0xed1e('0x2a')]=_[_0xed1e('0x50')](db[_0xed1e('0x27')][_0xed1e('0x28')]);_0x9743fe[_0xed1e('0x2b')]=_['keys'](_0x15d199['query']);_0x9743fe[_0xed1e('0x2c')]=_['intersection'](_0x9743fe[_0xed1e('0x2a')],_0x9743fe[_0xed1e('0x2b')]);_0x510875['attributes']=_[_0xed1e('0x51')](_0x9743fe['model'],qs[_0xed1e('0x3f')](_0x15d199[_0xed1e('0x2b')]['fields']));_0x510875[_0xed1e('0x3e')]=_0x510875['attributes'][_0xed1e('0x40')]?_0x510875[_0xed1e('0x3e')]:_0x9743fe[_0xed1e('0x2a')];if(_0x15d199[_0xed1e('0x2b')][_0xed1e('0x4b')]){_0x510875['include']=[{'all':!![]}];}_0x510875=_[_0xed1e('0x47')]({},_0x510875,_0x15d199['options']);return db['CmHopper']['find'](_0x510875)['then'](handleEntityNotFound(_0x16c818,null))[_0xed1e('0x1f')](respondWithResult(_0x16c818,null))[_0xed1e('0x52')](handleError(_0x16c818,null));};exports[_0xed1e('0x53')]=function(_0x2d5a02,_0x4ed350){return db[_0xed1e('0x27')][_0xed1e('0x53')](_0x2d5a02[_0xed1e('0x54')],{})[_0xed1e('0x1f')](respondWithResult(_0x4ed350,0xc9))[_0xed1e('0x52')](handleError(_0x4ed350,null));};exports[_0xed1e('0x1d')]=function(_0x338094,_0x21391b){if(_0x338094[_0xed1e('0x54')]['id']){delete _0x338094[_0xed1e('0x54')]['id'];}return db[_0xed1e('0x27')][_0xed1e('0x55')]({'where':{'id':_0x338094[_0xed1e('0x4f')]['id']}})[_0xed1e('0x1f')](handleEntityNotFound(_0x21391b,null))[_0xed1e('0x1f')](saveUpdates(_0x338094[_0xed1e('0x54')],null))[_0xed1e('0x1f')](respondWithResult(_0x21391b,null))[_0xed1e('0x52')](handleError(_0x21391b,null));};exports[_0xed1e('0x56')]=function(_0x338ed6,_0x18dac0){return db[_0xed1e('0x27')][_0xed1e('0x56')]()[_0xed1e('0x1f')](respondWithResult(_0x18dac0,null))[_0xed1e('0x52')](handleError(_0x18dac0,null));};exports[_0xed1e('0x1e')]=function(_0x10d2e1,_0x319c97){var _0x560fcf;return db[_0xed1e('0x27')]['find']({'where':{'id':_0x10d2e1[_0xed1e('0x4f')]['id']}})[_0xed1e('0x1f')](handleEntityNotFound(_0x319c97,null))[_0xed1e('0x1f')](function(_0x244a43){if(_0x244a43){return _0x244a43[_0xed1e('0x1e')]()[_0xed1e('0x1f')](function(_0x142b19){return _0x142b19;});}})[_0xed1e('0x1f')](function(_0xa3d2c5){_0x560fcf=_0xa3d2c5;if(_0xa3d2c5){if(_0xa3d2c5[_0xed1e('0x57')]||_0xa3d2c5[_0xed1e('0x58')]){return db[_0xa3d2c5[_0xed1e('0x57')]?_0xed1e('0x59'):_0xed1e('0x5a')]['find']({'where':{'id':_0xa3d2c5[_0xed1e('0x57')]?_0xa3d2c5['VoiceQueueId']:_0xa3d2c5[_0xed1e('0x58')]},'attributes':['id',_0xed1e('0x23')],'raw':!![]});}}})['then'](function(_0x11b5ba){var _0x4d4db9={};if(_0x11b5ba){_['merge'](_0x4d4db9,_[_0xed1e('0x5b')](_0x560fcf['dataValues'],[_0xed1e('0x5c'),_0xed1e('0x5d'),'id']));_0x4d4db9[_0xed1e('0x5e')]=0x15;_0x4d4db9[_0xed1e('0x5f')]='deleted';_0x4d4db9[_0xed1e('0x60')]=_0x11b5ba['name'];_0x4d4db9['membername']=_0x10d2e1[_0xed1e('0x61')][_0xed1e('0x23')];_0x4d4db9[_0xed1e('0x62')]=_0x10d2e1[_0xed1e('0x61')]['id'];_0x4d4db9['deleted']=!![];_0x4d4db9[_0xed1e('0x63')]=moment()[_0xed1e('0x64')](_0xed1e('0x65'));_0x4d4db9['calleridnum']=_0x560fcf[_0xed1e('0x66')];_0x4d4db9[_0xed1e('0x67')]=_0x560fcf['VoiceQueueId']?_0xed1e('0x68'):_0xed1e('0x69');return db[_0xed1e('0x6a')][_0xed1e('0x55')]({'where':{'id':_0x4d4db9[_0xed1e('0x6b')]},'attributes':[_0xed1e('0x6c'),_0xed1e('0x6d')]})[_0xed1e('0x1f')](function(_0x179b99){if(!_[_0xed1e('0x6e')](_0x319c97)&&!_[_0xed1e('0x6e')](_0x179b99[_0xed1e('0x6c')])){_0x4d4db9[_0xed1e('0x6f')]=_0x179b99[_0xed1e('0x6c')];if(!_[_0xed1e('0x6e')](_0x179b99[_0xed1e('0x6d')])){_0x4d4db9[_0xed1e('0x6f')]+='\x20'+_0x179b99[_0xed1e('0x6d')];}}})[_0xed1e('0x70')](function(){return db['CmHopperFinal'][_0xed1e('0x53')](_0x4d4db9);});}})['then'](function(){return _0x319c97['status'](0xcc)[_0xed1e('0x14')]();})[_0xed1e('0x52')](handleError(_0x319c97,null));};exports[_0xed1e('0x71')]=function(_0x1d0ad8,_0xf52e8d,_0x512996){var _0x520ab0=[];return db[_0xed1e('0x6a')][_0xed1e('0x56')]()[_0xed1e('0x1f')](function(_0x4364e6){_0x520ab0=_[_0xed1e('0x50')](_0x4364e6);return _0x1d0ad8[_0xed1e('0x61')]['getVoiceQueues']({'where':{'type':_0xed1e('0x72'),'dialActive':!![],'dialMethod':_0xed1e('0x73')},'attributes':['id',_0xed1e('0x74')],'raw':!![]});})[_0xed1e('0x1f')](function(_0x46d761){if(_0x46d761&&_0x46d761['length']){return db['sequelize']['transaction'](function(_0x1f47be){var _0x38d87a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xed1e('0x64')](_0xed1e('0x65'))},'VoiceQueueId':{'$in':_[_0xed1e('0x26')](_0x46d761,'id')},'$or':[{'UserId':null},{'UserId':_0x1d0ad8[_0xed1e('0x61')]['id']}]};var _0x450062=[];if(_0x1d0ad8[_0xed1e('0x54')]['direction']&&_0x1d0ad8[_0xed1e('0x54')][_0xed1e('0x75')]===_0xed1e('0x76')){if(!_[_0xed1e('0x77')](_0x1d0ad8[_0xed1e('0x54')][_0xed1e('0x78')])){_0x38d87a['id']={'$in':_0x1d0ad8[_0xed1e('0x54')]['hopperIds']};}_0x450062=[['priority',_0xed1e('0x79')],[_0xed1e('0x7a'),_0x46d761[0x0][_0xed1e('0x74')]==='ASC'?_0xed1e('0x7b'):_0xed1e('0x79')],db['sequelize'][_0xed1e('0x7c')](_0xed1e('0x7d')),['id',_0xed1e('0x7b')]];}else{if(!_['isEmpty'](_0x1d0ad8['body'][_0xed1e('0x78')])){_0x38d87a['id']={'$notIn':_0x1d0ad8[_0xed1e('0x54')]['hopperIds']};}_0x450062=[['priority',_0xed1e('0x7b')],[_0xed1e('0x7a'),_0x46d761[0x0][_0xed1e('0x74')]],db[_0xed1e('0x7e')][_0xed1e('0x7c')](_0xed1e('0x7f')),['id',_0xed1e('0x79')]];}return db[_0xed1e('0x27')][_0xed1e('0x80')]({'attributes':['id',_0xed1e('0x81')],'where':_0x38d87a,'order':_0x450062,'transaction':_0x1f47be,'lock':_0x1f47be[_0xed1e('0x82')][_0xed1e('0x83')],'include':[{'model':db[_0xed1e('0x6a')],'as':'Contact','attributes':_0x520ab0,'include':[{'model':db[_0xed1e('0x84')],'as':_0xed1e('0x85'),'attributes':['id',_0xed1e('0x23')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xed1e('0x23')]},{'model':db['VoiceQueue'],'as':_0xed1e('0x86'),'attributes':['id',_0xed1e('0x23'),_0xed1e('0x87')]}]})[_0xed1e('0x1f')](function(_0x155e36){if(_0x155e36){return _0x155e36[_0xed1e('0x1d')]({'UserId':_0x1d0ad8[_0xed1e('0x61')]['id']},{'transaction':_0x1f47be});}});});}})[_0xed1e('0x1f')](handleEntityNotFound(_0xf52e8d,null))[_0xed1e('0x1f')](respondWithResult(_0xf52e8d,null))[_0xed1e('0x52')](handleError(_0xf52e8d,null));};exports[_0xed1e('0x88')]=function(_0x220751,_0x43d4ed,_0x2f98ad){return _0x220751['user'][_0xed1e('0x89')]({'where':{'type':_0xed1e('0x72'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x4ed8cc){if(_0x4ed8cc&&_0x4ed8cc['length']){return db[_0xed1e('0x27')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xed1e('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xed1e('0x26')](_0x4ed8cc,'id')},'$or':[{'UserId':null},{'UserId':_0x220751[_0xed1e('0x61')]['id']}]}});}return 0x0;})[_0xed1e('0x1f')](function(_0x3d510b){if(!_[_0xed1e('0x6e')](_0x3d510b)&&_['isNumber'](_0x3d510b)){return _0x43d4ed[_0xed1e('0x13')](0xc8)['json']({'contacts':_0x3d510b});}else{logger['error'](_0xed1e('0x8a'),_0xed1e('0x88'),0x194,_0xed1e('0x8b'));_0x43d4ed[_0xed1e('0x20')](0x194);}})[_0xed1e('0x52')](handleError(_0x43d4ed,null));}; \ No newline at end of file +var _0xbacd=['Content-Range','apply','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','$and','$or','$gt','$gte','$lt','$eq','$between','$in','$notIn','$notLike','$notILike','$like','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','create','body','update','find','params','describe','VoiceQueueId','CampaignId','Campaign','omit','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','calleridname','isNil','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','VoiceQueue','Queue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','fast-json-patch','moment','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count'];(function(_0x3b2a6d,_0x4069fb){var _0x30d5ac=function(_0x1725ed){while(--_0x1725ed){_0x3b2a6d['push'](_0x3b2a6d['shift']());}};_0x30d5ac(++_0x4069fb);}(_0xbacd,0x198));var _0xdbac=function(_0xe9946,_0x5e7b76){_0xe9946=_0xe9946-0x0;var _0x450715=_0xbacd[_0xe9946];return _0x450715;};'use strict';var emlformat=require(_0xdbac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdbac('0x1'));var rp=require('request-promise');var moment=require(_0xdbac('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdbac('0x3'));var util=require('util');var path=require('path');var sox=require(_0xdbac('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbac('0x5'));var _=require(_0xdbac('0x6'));var squel=require(_0xdbac('0x7'));var crypto=require(_0xdbac('0x8'));var jsforce=require(_0xdbac('0x9'));var deskjs=require(_0xdbac('0xa'));var toCsv=require(_0xdbac('0xb'));var querystring=require('querystring');var Papa=require(_0xdbac('0xc'));var Redis=require(_0xdbac('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdbac('0xe'));var as=require(_0xdbac('0xf'));var hardwareService=require(_0xdbac('0x10'));var logger=require(_0xdbac('0x11'))(_0xdbac('0x12'));var utils=require(_0xdbac('0x13'));var config=require(_0xdbac('0x14'));var licenseUtil=require(_0xdbac('0x15'));var db=require(_0xdbac('0x16'))['db'];function respondWithStatusCode(_0x29a406,_0x4b6cce){_0x4b6cce=_0x4b6cce||0xcc;return function(_0x36bcbb){if(_0x36bcbb){return _0x29a406['sendStatus'](_0x4b6cce);}return _0x29a406[_0xdbac('0x17')](_0x4b6cce)[_0xdbac('0x18')]();};}function respondWithResult(_0xc3a858,_0x3de887){_0x3de887=_0x3de887||0xc8;return function(_0x30f52e){if(_0x30f52e){return _0xc3a858[_0xdbac('0x17')](_0x3de887)[_0xdbac('0x19')](_0x30f52e);}};}function respondWithFilteredResult(_0x2221f0,_0x2cb0e3){return function(_0x118346){if(_0x118346){var _0x3f4de1=typeof _0x2cb0e3[_0xdbac('0x1a')]==='undefined'&&typeof _0x2cb0e3[_0xdbac('0x1b')]===_0xdbac('0x1c');var _0x512108=_0x118346[_0xdbac('0x1d')];var _0x5702b6=_0x3f4de1?0x0:_0x2cb0e3[_0xdbac('0x1a')];var _0x48a56b=_0x3f4de1?_0x118346[_0xdbac('0x1d')]:_0x2cb0e3[_0xdbac('0x1a')]+_0x2cb0e3['limit'];var _0x5e4cb0;if(_0x48a56b>=_0x512108){_0x48a56b=_0x512108;_0x5e4cb0=0xc8;}else{_0x5e4cb0=0xce;}_0x2221f0[_0xdbac('0x17')](_0x5e4cb0);return _0x2221f0['set'](_0xdbac('0x1e'),_0x5702b6+'-'+_0x48a56b+'/'+_0x512108)[_0xdbac('0x19')](_0x118346);}return null;};}function patchUpdates(_0x4244bc){return function(_0x17af04){try{jsonpatch[_0xdbac('0x1f')](_0x17af04,_0x4244bc,!![]);}catch(_0x881da9){return BPromise['reject'](_0x881da9);}return _0x17af04['save']();};}function saveUpdates(_0x10d86d,_0x19933c){return function(_0x249638){if(_0x249638){return _0x249638['update'](_0x10d86d)[_0xdbac('0x20')](function(_0x7178a6){return _0x7178a6;});}return null;};}function removeEntity(_0x4377ea,_0xde72d3){return function(_0x3c812b){if(_0x3c812b){return _0x3c812b[_0xdbac('0x21')]()[_0xdbac('0x20')](function(){_0x4377ea[_0xdbac('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x395052,_0x2b9f24){return function(_0x15b796){if(!_0x15b796){_0x395052[_0xdbac('0x22')](0x194);}return _0x15b796;};}function handleError(_0x5419b7,_0x4f3d14){_0x4f3d14=_0x4f3d14||0x1f4;return function(_0x5b016a){logger[_0xdbac('0x23')](_0x5b016a[_0xdbac('0x24')]);if(_0x5b016a[_0xdbac('0x25')]){delete _0x5b016a[_0xdbac('0x25')];}_0x5419b7[_0xdbac('0x17')](_0x4f3d14)[_0xdbac('0x26')](_0x5b016a);};}exports[_0xdbac('0x27')]=function(_0x357b3d,_0x282120){var _0x111929={},_0x3936d6={},_0x4d58ac={'count':0x0,'rows':[]};var _0x4c029f=_[_0xdbac('0x28')](db[_0xdbac('0x29')][_0xdbac('0x2a')],function(_0x16a2ec){return{'name':_0x16a2ec[_0xdbac('0x2b')],'type':_0x16a2ec[_0xdbac('0x2c')][_0xdbac('0x2d')]};});_0x3936d6[_0xdbac('0x2e')]=_[_0xdbac('0x28')](_0x4c029f,'name');_0x3936d6['query']=_[_0xdbac('0x2f')](_0x357b3d['query']);_0x3936d6[_0xdbac('0x30')]=_[_0xdbac('0x31')](_0x3936d6[_0xdbac('0x2e')],_0x3936d6[_0xdbac('0x32')]);_0x3936d6[_0xdbac('0x30')]=_['concat'](_0x3936d6[_0xdbac('0x30')],[_0xdbac('0x33'),_0xdbac('0x34'),_0xdbac('0x35'),_0xdbac('0x36'),_0xdbac('0x37'),'$lte','$ne',_0xdbac('0x38'),'$not',_0xdbac('0x39'),'$notBetween',_0xdbac('0x3a'),_0xdbac('0x3b'),'$like',_0xdbac('0x3c'),'$iLike',_0xdbac('0x3d'),_0xdbac('0x3e'),_0xdbac('0x3f'),'$contains',_0xdbac('0x40'),_0xdbac('0x41')]);_0x111929[_0xdbac('0x42')]=_[_0xdbac('0x31')](_0x3936d6[_0xdbac('0x2e')],qs[_0xdbac('0x43')](_0x357b3d[_0xdbac('0x32')][_0xdbac('0x43')]));_0x111929['attributes']=_0x111929[_0xdbac('0x42')][_0xdbac('0x44')]?_0x111929[_0xdbac('0x42')]:_0x3936d6[_0xdbac('0x2e')];if(!_0x357b3d[_0xdbac('0x32')][_0xdbac('0x45')](_0xdbac('0x46'))){_0x111929[_0xdbac('0x1b')]=qs[_0xdbac('0x1b')](_0x357b3d[_0xdbac('0x32')][_0xdbac('0x1b')]);_0x111929[_0xdbac('0x1a')]=qs[_0xdbac('0x1a')](_0x357b3d[_0xdbac('0x32')]['offset']);}_0x111929[_0xdbac('0x47')]=qs[_0xdbac('0x48')](_0x357b3d[_0xdbac('0x32')][_0xdbac('0x48')]);_0x111929[_0xdbac('0x49')]=qs[_0xdbac('0x30')](_[_0xdbac('0x4a')](_0x357b3d[_0xdbac('0x32')],_0x3936d6[_0xdbac('0x30')]),_0x4c029f);if(_0x357b3d['query'][_0xdbac('0x4b')]){_0x111929[_0xdbac('0x49')]=_[_0xdbac('0x4c')](_0x111929[_0xdbac('0x49')],{'$or':_['map'](_0x4c029f,function(_0x4af3c1){if(_0x4af3c1[_0xdbac('0x2c')]!==_0xdbac('0x4d')){var _0x3920a0={};_0x3920a0[_0x4af3c1[_0xdbac('0x25')]]={'$like':'%'+_0x357b3d[_0xdbac('0x32')][_0xdbac('0x4b')]+'%'};return _0x3920a0;}})});}_0x111929=_['merge']({},_0x111929,_0x357b3d[_0xdbac('0x4e')]);var _0x4f2b3e={'where':_0x111929['where']};return db[_0xdbac('0x29')][_0xdbac('0x1d')](_0x4f2b3e)[_0xdbac('0x20')](function(_0x50183a){_0x4d58ac['count']=_0x50183a;if(_0x357b3d[_0xdbac('0x32')]['includeAll']){_0x111929['include']=[{'all':!![]}];}return db[_0xdbac('0x29')][_0xdbac('0x4f')](_0x111929);})[_0xdbac('0x20')](function(_0x1c07fc){_0x4d58ac[_0xdbac('0x50')]=_0x1c07fc;return _0x4d58ac;})['then'](respondWithFilteredResult(_0x282120,_0x111929))[_0xdbac('0x51')](handleError(_0x282120,null));};exports[_0xdbac('0x52')]=function(_0x2d0650,_0x3e607f){var _0x6e9147={'raw':!![],'where':{'id':_0x2d0650['params']['id']}},_0x1ff8c7={};_0x1ff8c7['model']=_[_0xdbac('0x2f')](db[_0xdbac('0x29')][_0xdbac('0x2a')]);_0x1ff8c7[_0xdbac('0x32')]=_[_0xdbac('0x2f')](_0x2d0650[_0xdbac('0x32')]);_0x1ff8c7[_0xdbac('0x30')]=_[_0xdbac('0x31')](_0x1ff8c7[_0xdbac('0x2e')],_0x1ff8c7['query']);_0x6e9147['attributes']=_[_0xdbac('0x31')](_0x1ff8c7['model'],qs[_0xdbac('0x43')](_0x2d0650[_0xdbac('0x32')][_0xdbac('0x43')]));_0x6e9147['attributes']=_0x6e9147[_0xdbac('0x42')][_0xdbac('0x44')]?_0x6e9147[_0xdbac('0x42')]:_0x1ff8c7['model'];if(_0x2d0650['query'][_0xdbac('0x53')]){_0x6e9147[_0xdbac('0x54')]=[{'all':!![]}];}_0x6e9147=_[_0xdbac('0x4c')]({},_0x6e9147,_0x2d0650[_0xdbac('0x4e')]);return db['CmHopper']['find'](_0x6e9147)[_0xdbac('0x20')](handleEntityNotFound(_0x3e607f,null))['then'](respondWithResult(_0x3e607f,null))[_0xdbac('0x51')](handleError(_0x3e607f,null));};exports[_0xdbac('0x55')]=function(_0x6a2567,_0x3162d4){return db['CmHopper'][_0xdbac('0x55')](_0x6a2567[_0xdbac('0x56')],{})[_0xdbac('0x20')](respondWithResult(_0x3162d4,0xc9))[_0xdbac('0x51')](handleError(_0x3162d4,null));};exports[_0xdbac('0x57')]=function(_0x322d7e,_0x52d76b){if(_0x322d7e['body']['id']){delete _0x322d7e[_0xdbac('0x56')]['id'];}return db['CmHopper'][_0xdbac('0x58')]({'where':{'id':_0x322d7e[_0xdbac('0x59')]['id']}})[_0xdbac('0x20')](handleEntityNotFound(_0x52d76b,null))[_0xdbac('0x20')](saveUpdates(_0x322d7e['body'],null))['then'](respondWithResult(_0x52d76b,null))[_0xdbac('0x51')](handleError(_0x52d76b,null));};exports[_0xdbac('0x5a')]=function(_0x3ce68c,_0x377c18){return db['CmHopper'][_0xdbac('0x5a')]()[_0xdbac('0x20')](respondWithResult(_0x377c18,null))['catch'](handleError(_0x377c18,null));};exports[_0xdbac('0x21')]=function(_0x28d542,_0x268217){var _0x3f9fc3;return db[_0xdbac('0x29')][_0xdbac('0x58')]({'where':{'id':_0x28d542[_0xdbac('0x59')]['id']}})[_0xdbac('0x20')](handleEntityNotFound(_0x268217,null))[_0xdbac('0x20')](function(_0x2e189b){if(_0x2e189b){return _0x2e189b['destroy']()[_0xdbac('0x20')](function(_0x198d5e){return _0x198d5e;});}})[_0xdbac('0x20')](function(_0x295674){_0x3f9fc3=_0x295674;if(_0x295674){if(_0x295674[_0xdbac('0x5b')]||_0x295674[_0xdbac('0x5c')]){return db[_0x295674[_0xdbac('0x5b')]?'VoiceQueue':_0xdbac('0x5d')]['find']({'where':{'id':_0x295674['VoiceQueueId']?_0x295674[_0xdbac('0x5b')]:_0x295674['CampaignId']},'attributes':['id',_0xdbac('0x25')],'raw':!![]});}}})['then'](function(_0x58612f){var _0x4551ec={};if(_0x58612f){_[_0xdbac('0x4c')](_0x4551ec,_[_0xdbac('0x5e')](_0x3f9fc3['dataValues'],[_0xdbac('0x5f'),'updatedAt','id']));_0x4551ec[_0xdbac('0x60')]=0x15;_0x4551ec[_0xdbac('0x61')]=_0xdbac('0x62');_0x4551ec[_0xdbac('0x63')]=_0x58612f[_0xdbac('0x25')];_0x4551ec[_0xdbac('0x64')]=_0x28d542[_0xdbac('0x65')][_0xdbac('0x25')];_0x4551ec[_0xdbac('0x66')]=_0x28d542[_0xdbac('0x65')]['id'];_0x4551ec[_0xdbac('0x62')]=!![];_0x4551ec[_0xdbac('0x67')]=moment()[_0xdbac('0x68')](_0xdbac('0x69'));_0x4551ec['calleridnum']=_0x3f9fc3[_0xdbac('0x6a')];_0x4551ec[_0xdbac('0x6b')]=_0x3f9fc3[_0xdbac('0x5b')]?'queue':_0xdbac('0x6c');return db[_0xdbac('0x6d')][_0xdbac('0x58')]({'where':{'id':_0x4551ec[_0xdbac('0x6e')]},'attributes':[_0xdbac('0x6f'),'lastName']})[_0xdbac('0x20')](function(_0x5d6c79){if(!_['isNil'](_0x268217)&&!_['isNil'](_0x5d6c79['firstName'])){_0x4551ec[_0xdbac('0x70')]=_0x5d6c79[_0xdbac('0x6f')];if(!_[_0xdbac('0x71')](_0x5d6c79['lastName'])){_0x4551ec[_0xdbac('0x70')]+='\x20'+_0x5d6c79['lastName'];}}})[_0xdbac('0x72')](function(){return db['CmHopperFinal'][_0xdbac('0x55')](_0x4551ec);});}})[_0xdbac('0x20')](function(){return _0x268217['status'](0xcc)[_0xdbac('0x18')]();})[_0xdbac('0x51')](handleError(_0x268217,null));};exports[_0xdbac('0x73')]=function(_0xaac572,_0x303e59,_0x4fdd2c){var _0x5d2069=[];return db['CmContact'][_0xdbac('0x5a')]()['then'](function(_0x6b7782){_0x5d2069=_[_0xdbac('0x2f')](_0x6b7782);return _0xaac572[_0xdbac('0x65')][_0xdbac('0x74')]({'where':{'type':_0xdbac('0x75'),'dialActive':!![],'dialMethod':_0xdbac('0x76')},'attributes':['id',_0xdbac('0x77')],'raw':!![]});})[_0xdbac('0x20')](function(_0x126591){if(_0x126591&&_0x126591[_0xdbac('0x44')]){return db[_0xdbac('0x78')][_0xdbac('0x79')](function(_0x5b12f8){var _0x14791f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdbac('0x68')](_0xdbac('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x126591,'id')},'$or':[{'UserId':null},{'UserId':_0xaac572[_0xdbac('0x65')]['id']}]};var _0x2a9371=[];if(_0xaac572[_0xdbac('0x56')]['direction']&&_0xaac572['body'][_0xdbac('0x7a')]===_0xdbac('0x7b')){if(!_[_0xdbac('0x7c')](_0xaac572[_0xdbac('0x56')][_0xdbac('0x7d')])){_0x14791f['id']={'$in':_0xaac572[_0xdbac('0x56')]['hopperIds']};}_0x2a9371=[[_0xdbac('0x7e'),_0xdbac('0x7f')],[_0xdbac('0x80'),_0x126591[0x0][_0xdbac('0x77')]===_0xdbac('0x7f')?_0xdbac('0x81'):_0xdbac('0x7f')],db[_0xdbac('0x78')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xdbac('0x81')]];}else{if(!_[_0xdbac('0x7c')](_0xaac572['body']['hopperIds'])){_0x14791f['id']={'$notIn':_0xaac572[_0xdbac('0x56')][_0xdbac('0x7d')]};}_0x2a9371=[[_0xdbac('0x7e'),_0xdbac('0x81')],[_0xdbac('0x80'),_0x126591[0x0][_0xdbac('0x77')]],db[_0xdbac('0x78')][_0xdbac('0x82')](_0xdbac('0x83')),['id','ASC']];}return db['CmHopper'][_0xdbac('0x84')]({'attributes':['id',_0xdbac('0x85')],'where':_0x14791f,'order':_0x2a9371,'transaction':_0x5b12f8,'lock':_0x5b12f8[_0xdbac('0x86')][_0xdbac('0x87')],'include':[{'model':db[_0xdbac('0x6d')],'as':_0xdbac('0x88'),'attributes':_0x5d2069,'include':[{'model':db['CmCompany'],'as':_0xdbac('0x89'),'attributes':['id','name']}]},{'model':db[_0xdbac('0x8a')],'as':'List','attributes':['id',_0xdbac('0x25')]},{'model':db[_0xdbac('0x8b')],'as':_0xdbac('0x8c'),'attributes':['id',_0xdbac('0x25'),_0xdbac('0x8d')]}]})[_0xdbac('0x20')](function(_0x118b4b){if(_0x118b4b){return _0x118b4b[_0xdbac('0x57')]({'UserId':_0xaac572[_0xdbac('0x65')]['id']},{'transaction':_0x5b12f8});}});});}})[_0xdbac('0x20')](handleEntityNotFound(_0x303e59,null))[_0xdbac('0x20')](respondWithResult(_0x303e59,null))['catch'](handleError(_0x303e59,null));};exports['getOpenContacts']=function(_0x290e99,_0x4cb06e,_0x16efd9){return _0x290e99[_0xdbac('0x65')][_0xdbac('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xdbac('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x3f4376){if(_0x3f4376&&_0x3f4376[_0xdbac('0x44')]){return db[_0xdbac('0x29')][_0xdbac('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdbac('0x68')](_0xdbac('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x3f4376,'id')},'$or':[{'UserId':null},{'UserId':_0x290e99['user']['id']}]}});}return 0x0;})[_0xdbac('0x20')](function(_0x5572b9){if(!_[_0xdbac('0x71')](_0x5572b9)&&_[_0xdbac('0x8e')](_0x5572b9)){return _0x4cb06e[_0xdbac('0x17')](0xc8)[_0xdbac('0x19')]({'contacts':_0x5572b9});}else{logger[_0xdbac('0x23')](_0xdbac('0x8f'),_0xdbac('0x90'),0x194,_0xdbac('0x91'));_0x4cb06e[_0xdbac('0x22')](0x194);}})[_0xdbac('0x51')](handleError(_0x4cb06e,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f8dbf20..859a668 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x344d9d,_0x3f7e59){var _0x3a53fd=function(_0x2ee148){while(--_0x2ee148){_0x344d9d['push'](_0x344d9d['shift']());}};_0x3a53fd(++_0x3f7e59);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['phone','priority','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat'];(function(_0x185ed2,_0xb1564a){var _0x11d850=function(_0xfecc87){while(--_0xfecc87){_0x185ed2['push'](_0x185ed2['shift']());}};_0x11d850(++_0xb1564a);}(_0x814b,0x1a2));var _0xb814=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x814b[_0x128450];return _0x4d80ed;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]},{'name':_0xb814('0xe'),'fields':[_0xb814('0xe')]},{'name':_0xb814('0xf'),'fields':[_0xb814('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 7762f0d..e7126c2 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 _0x607a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','model','map','debug','ShowCmHopper','find','raw','create','CreateCmHopper','update','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','Contact','User','name','length','push','body','includes','all','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','UserId','UPDATE','GetCmHopperPreview','lodash','util','bluebird','ioredis'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x607a,0x120));var _0xa607=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x607a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa607('0x0'));var util=require(_0xa607('0x1'));var moment=require('moment');var BPromise=require(_0xa607('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa607('0x3'));var db=require(_0xa607('0x4'))['db'];var utils=require(_0xa607('0x5'));var logger=require(_0xa607('0x6'))(_0xa607('0x7'));var config=require('../../config/environment');var jayson=require(_0xa607('0x8'));var client=jayson[_0xa607('0x9')][_0xa607('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x558b7f,_0x43ded5,_0x50127b){return new BPromise(function(_0x2e37cf,_0x2cfb19){return client[_0xa607('0xb')](_0x558b7f,_0x50127b)[_0xa607('0xc')](function(_0x7c0eb1){logger[_0xa607('0xd')](_0xa607('0xe'),_0x43ded5,'request\x20sent');logger['debug'](_0xa607('0xf'),_0x43ded5,_0xa607('0x10'),JSON[_0xa607('0x11')](_0x7c0eb1));if(_0x7c0eb1[_0xa607('0x12')]){if(_0x7c0eb1['error'][_0xa607('0x13')]===0x1f4){logger[_0xa607('0x12')]('CmHopper,\x20%s,\x20%s',_0x43ded5,_0x7c0eb1[_0xa607('0x12')]['message']);return _0x2cfb19(_0x7c0eb1[_0xa607('0x12')][_0xa607('0x14')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x43ded5,_0x7c0eb1[_0xa607('0x12')][_0xa607('0x14')]);return _0x2e37cf(_0x7c0eb1[_0xa607('0x12')][_0xa607('0x14')]);}else{logger[_0xa607('0xd')](_0xa607('0xe'),_0x43ded5,_0xa607('0x10'));_0x2e37cf(_0x7c0eb1[_0xa607('0x15')]['message']);}})[_0xa607('0x16')](function(_0x43525d){logger[_0xa607('0x12')](_0xa607('0xe'),_0x43ded5,_0x43525d);_0x2cfb19(_0x43525d);});});}exports[_0xa607('0x17')]=function(_0x321447){var _0xed456f=this;return new Promise(function(_0x16724e,_0x42fc2b){return db[_0xa607('0x18')][_0xa607('0x19')]({'raw':_0x321447[_0xa607('0x1a')]?_0x321447[_0xa607('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x321447[_0xa607('0x1a')]?_0x321447[_0xa607('0x1a')][_0xa607('0x1b')]||null:null,'attributes':_0x321447['options']?_0x321447['options'][_0xa607('0x1c')]||null:null,'limit':_0x321447[_0xa607('0x1a')]?_0x321447[_0xa607('0x1a')][_0xa607('0x1d')]||null:null,'include':_0x321447[_0xa607('0x1a')]?_0x321447['options'][_0xa607('0x1e')]?_['map'](_0x321447[_0xa607('0x1a')][_0xa607('0x1e')],function(_0x302ae0){return{'model':db[_0x302ae0[_0xa607('0x1f')]],'as':_0x302ae0['as'],'attributes':_0x302ae0['attributes'],'include':_0x302ae0[_0xa607('0x1e')]?_[_0xa607('0x20')](_0x302ae0[_0xa607('0x1e')],function(_0x551fc9){return{'model':db[_0x551fc9[_0xa607('0x1f')]],'as':_0x551fc9['as'],'attributes':_0x551fc9[_0xa607('0x1c')],'include':_0x551fc9[_0xa607('0x1e')]?_[_0xa607('0x20')](_0x551fc9['include'],function(_0x1af4d7){return{'model':db[_0x1af4d7[_0xa607('0x1f')]],'as':_0x1af4d7['as'],'attributes':_0x1af4d7[_0xa607('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa607('0xc')](function(_0x541b48){logger[_0xa607('0xd')](_0xa607('0x17'),_0x321447);logger[_0xa607('0x21')](_0xa607('0x17'),_0x321447,JSON[_0xa607('0x11')](_0x541b48));_0x16724e(_0x541b48);})[_0xa607('0x16')](function(_0x1481c9){logger[_0xa607('0x12')](_0xa607('0x17'),_0x1481c9['message'],_0x321447);_0x42fc2b(_0xed456f[_0xa607('0x12')](0x1f4,_0x1481c9[_0xa607('0x14')]));});});};exports[_0xa607('0x22')]=function(_0x986c31){var _0x1534ba=this;return new Promise(function(_0x53d37e,_0x26b3ad){return db[_0xa607('0x18')][_0xa607('0x23')]({'raw':_0x986c31['options']?_0x986c31['options'][_0xa607('0x24')]===undefined?!![]:![]:!![],'where':_0x986c31[_0xa607('0x1a')]?_0x986c31[_0xa607('0x1a')][_0xa607('0x1b')]||null:null,'attributes':_0x986c31[_0xa607('0x1a')]?_0x986c31[_0xa607('0x1a')][_0xa607('0x1c')]||null:null,'include':_0x986c31[_0xa607('0x1a')]?_0x986c31[_0xa607('0x1a')]['include']?_[_0xa607('0x20')](_0x986c31[_0xa607('0x1a')][_0xa607('0x1e')],function(_0xeb0a33){return{'model':db[_0xeb0a33['model']],'as':_0xeb0a33['as'],'attributes':_0xeb0a33[_0xa607('0x1c')],'include':_0xeb0a33[_0xa607('0x1e')]?_[_0xa607('0x20')](_0xeb0a33[_0xa607('0x1e')],function(_0x2be6f8){return{'model':db[_0x2be6f8[_0xa607('0x1f')]],'as':_0x2be6f8['as'],'attributes':_0x2be6f8[_0xa607('0x1c')],'include':_0x2be6f8['include']?_[_0xa607('0x20')](_0x2be6f8[_0xa607('0x1e')],function(_0x174e59){return{'model':db[_0x174e59[_0xa607('0x1f')]],'as':_0x174e59['as'],'attributes':_0x174e59['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c5c8f){logger[_0xa607('0xd')]('ShowCmHopper',_0x986c31);logger['debug']('ShowCmHopper',_0x986c31,JSON[_0xa607('0x11')](_0x4c5c8f));_0x53d37e(_0x4c5c8f);})[_0xa607('0x16')](function(_0x58efd3){logger[_0xa607('0x12')](_0xa607('0x22'),_0x58efd3[_0xa607('0x14')],_0x986c31);_0x26b3ad(_0x1534ba['error'](0x1f4,_0x58efd3[_0xa607('0x14')]));});});};exports['CreateCmHopper']=function(_0x442a68){var _0x685b3c=this;return new Promise(function(_0x4462eb,_0x317829){return db['CmHopper'][_0xa607('0x25')](_0x442a68['body'],{'raw':_0x442a68[_0xa607('0x1a')]?_0x442a68[_0xa607('0x1a')][_0xa607('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x3d08e8){logger[_0xa607('0xd')]('CreateCmHopper',_0x442a68);logger[_0xa607('0x21')]('CreateCmHopper',_0x442a68,JSON[_0xa607('0x11')](_0x3d08e8));_0x4462eb(_0x3d08e8);})[_0xa607('0x16')](function(_0x2c9975){logger[_0xa607('0x12')](_0xa607('0x26'),_0x2c9975[_0xa607('0x14')],_0x442a68);_0x317829(_0x685b3c[_0xa607('0x12')](0x1f4,_0x2c9975[_0xa607('0x14')]));});});};exports['UpdateCmHopper']=function(_0x10b530){var _0x53d9cb=this;return new Promise(function(_0x5bd698,_0xfb6c94){return db[_0xa607('0x18')][_0xa607('0x27')](_0x10b530['body'],{'raw':_0x10b530[_0xa607('0x1a')]?_0x10b530['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10b530['options']?_0x10b530['options'][_0xa607('0x1b')]||null:null,'attributes':_0x10b530['options']?_0x10b530[_0xa607('0x1a')][_0xa607('0x1c')]||null:null,'limit':_0x10b530[_0xa607('0x1a')]?_0x10b530[_0xa607('0x1a')][_0xa607('0x1d')]||null:null})[_0xa607('0xc')](function(_0x26ca51){logger[_0xa607('0xd')](_0xa607('0x28'),_0x10b530);logger[_0xa607('0x21')](_0xa607('0x28'),_0x10b530,JSON[_0xa607('0x11')](_0x26ca51));_0x5bd698(_0x26ca51);})[_0xa607('0x16')](function(_0xc50868){logger[_0xa607('0x12')](_0xa607('0x28'),_0xc50868['message'],_0x10b530);_0xfb6c94(_0x53d9cb[_0xa607('0x12')](0x1f4,_0xc50868['message']));});});};exports['DestroyCmHopper']=function(_0x593baa){var _0x3f8b42=this;return new Promise(function(_0x1a1a34,_0x3605a4){return db[_0xa607('0x18')][_0xa607('0x29')]({'where':_0x593baa['options']?_0x593baa[_0xa607('0x1a')][_0xa607('0x1b')]||null:null})['then'](function(_0x1bd00e){logger[_0xa607('0xd')]('DestroyCmHopper',_0x593baa);logger[_0xa607('0x21')](_0xa607('0x2a'),_0x593baa,JSON[_0xa607('0x11')](_0x1bd00e));_0x1a1a34(_0x1bd00e);})[_0xa607('0x16')](function(_0x5b051d){logger['error'](_0xa607('0x2a'),_0x5b051d['message'],_0x593baa);_0x3605a4(_0x3f8b42[_0xa607('0x12')](0x1f4,_0x5b051d[_0xa607('0x14')]));});});};exports[_0xa607('0x2b')]=function(_0x4d80cf){var _0x5d9c7c=this;return new Promise(function(_0x2d1833,_0x36c812){return db[_0xa607('0x2c')][_0xa607('0x2d')]()[_0xa607('0xc')](function(_0x120a0d){return db[_0xa607('0x2e')][_0xa607('0x2f')](function(_0x5ec15e){return db[_0xa607('0x18')]['findAll']({'where':_0x4d80cf[_0xa607('0x1a')]?_0x4d80cf[_0xa607('0x1a')][_0xa607('0x1b')]||null:null,'attributes':_0x4d80cf[_0xa607('0x1a')]?_0x4d80cf[_0xa607('0x1a')]['attributes']||null:null,'limit':_0x4d80cf[_0xa607('0x1a')]?_0x4d80cf[_0xa607('0x1a')]['limit']||null:null,'order':_0x4d80cf[_0xa607('0x1a')]?_0x4d80cf['options']['order']||null:null,'transaction':_0x5ec15e,'lock':_0x5ec15e[_0xa607('0x30')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa607('0x31'),'attributes':_['keys'](_0x120a0d)},{'model':db[_0xa607('0x32')],'as':'Agent','attributes':['id',_0xa607('0x33'),'voicePause']}]})[_0xa607('0xc')](function(_0x35f28d){var _0x47f586=[];var _0x54f2fb=[];for(var _0x5e8607=0x0;_0x5e8607<_0x35f28d[_0xa607('0x34')];_0x5e8607+=0x1){var _0x5d6a29=_0x35f28d[_0x5e8607]['UserId'];if(_0x5d6a29===null){_0x47f586[_0xa607('0x35')](_0x35f28d[_0x5e8607][_0xa607('0x27')](_0x4d80cf[_0xa607('0x36')],{'transaction':_0x5ec15e}));}else if(!_0x54f2fb[_0xa607('0x37')](_0x5d6a29)){_0x54f2fb[_0xa607('0x35')](_0x5d6a29);_0x47f586[_0xa607('0x35')](_0x35f28d[_0x5e8607][_0xa607('0x27')](_0x4d80cf['body'],{'transaction':_0x5ec15e}));}}return BPromise[_0xa607('0x38')](_0x47f586);});})[_0xa607('0xc')](function(_0x4e05b2){logger[_0xa607('0xd')](_0xa607('0x2b'),_0x4d80cf);logger[_0xa607('0x21')](_0xa607('0x2b'),_0x4d80cf,JSON[_0xa607('0x11')](_0x4e05b2));_0x2d1833(_0x4e05b2);})[_0xa607('0x16')](function(_0x3bccb8){logger['error'](_0xa607('0x2b'),_0x3bccb8[_0xa607('0x14')],_0x4d80cf);_0x36c812(_0x5d9c7c[_0xa607('0x12')](0x1f4,_0x3bccb8[_0xa607('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x3e11bd){var _0x2b775f=this;return new Promise(function(_0x1e8915,_0x4530d7){return db[_0xa607('0x2e')][_0xa607('0x2f')](function(_0x2cf1c4){return db[_0xa607('0x39')][_0xa607('0x25')](_0x3e11bd[_0xa607('0x36')],{'raw':_0x3e11bd[_0xa607('0x1a')]?_0x3e11bd['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x2cf1c4})[_0xa607('0xc')](function(){return db[_0xa607('0x18')]['destroy']({'where':_0x3e11bd['options']?_0x3e11bd['options'][_0xa607('0x1b')]||null:null,'transaction':_0x2cf1c4});});})[_0xa607('0xc')](function(_0x14e41d){logger[_0xa607('0xd')](_0xa607('0x3a'),_0x3e11bd);logger[_0xa607('0x21')](_0xa607('0x3a'),_0x3e11bd,JSON['stringify'](_0x14e41d));_0x1e8915(_0x14e41d);})[_0xa607('0x16')](function(_0x197f40){logger[_0xa607('0x12')](_0xa607('0x3a'),_0x197f40[_0xa607('0x14')],_0x3e11bd);_0x4530d7(_0x2b775f[_0xa607('0x12')](0x1f4,_0x197f40['message']));});});};exports[_0xa607('0x3b')]=function(_0x52e042){var _0x3b586c=this;return new Promise(function(_0x14c99f,_0x29b742){return db[_0xa607('0x18')][_0xa607('0x19')]({'raw':_0x52e042[_0xa607('0x1a')]?_0x52e042['options'][_0xa607('0x24')]===undefined?!![]:![]:!![],'where':_0x52e042['options']?_0x52e042[_0xa607('0x1a')][_0xa607('0x1b')]||null:null,'attributes':[[db[_0xa607('0x2e')]['fn'](_0xa607('0x3c'),db[_0xa607('0x2e')]['fn']('IF',db[_0xa607('0x2e')][_0xa607('0x3d')](_0xa607('0x3e')+util[_0xa607('0x3f')](_0xa607('0x40'),moment()['format'](_0xa607('0x41')))+_0xa607('0x42')))),_0xa607('0x43')]]})[_0xa607('0xc')](function(_0x349721){logger[_0xa607('0xd')](_0xa607('0x3b'),_0x52e042);logger[_0xa607('0x21')](_0xa607('0x3b'),_0x52e042,JSON[_0xa607('0x11')](_0x349721));_0x14c99f(_0x349721);})[_0xa607('0x16')](function(_0x4e3e89){logger[_0xa607('0x12')]('CountReScheduled',_0x4e3e89['message'],_0x52e042);_0x29b742(_0x3b586c[_0xa607('0x12')](0x1f4,_0x4e3e89[_0xa607('0x14')]));});});};exports[_0xa607('0x44')]=function(_0x2a25dc){var _0x4f1d57=this;return new Promise(function(_0x43e8be,_0x57d746){return db[_0xa607('0x2c')][_0xa607('0x2d')]()[_0xa607('0xc')](function(_0x1d3a3d){return db[_0xa607('0x2e')][_0xa607('0x2f')](function(_0xaad10f){return db['CmHopper']['findAll']({'where':_0x2a25dc[_0xa607('0x1a')]?_0x2a25dc[_0xa607('0x1a')][_0xa607('0x1b')]||null:null,'attributes':_0x2a25dc['options']?_0x2a25dc['options'][_0xa607('0x1c')]||null:null,'limit':0x1,'order':_0x2a25dc[_0xa607('0x1a')]?_0x2a25dc[_0xa607('0x1a')][_0xa607('0x45')]||null:null,'group':db[_0xa607('0x18')][_0xa607('0x46')],'transaction':_0xaad10f,'lock':_0xaad10f[_0xa607('0x30')][_0xa607('0x47')],'include':_0x2a25dc['options']?_0x2a25dc[_0xa607('0x1a')][_0xa607('0x1e')]?_[_0xa607('0x20')](_0x2a25dc[_0xa607('0x1a')][_0xa607('0x1e')],function(_0x19c1a6){return{'model':db[_0x19c1a6[_0xa607('0x1f')]],'as':_0x19c1a6['as'],'attributes':_0x19c1a6[_0xa607('0x1c')],'include':_0x19c1a6[_0xa607('0x1e')]?_[_0xa607('0x20')](_0x19c1a6[_0xa607('0x1e')],function(_0x3926e4){return{'model':db[_0x3926e4[_0xa607('0x1f')]],'as':_0x3926e4['as'],'attributes':_0x3926e4['attributes'],'include':_0x3926e4[_0xa607('0x1e')]?_[_0xa607('0x20')](_0x3926e4['include'],function(_0xa8c58d){return{'model':db[_0xa8c58d[_0xa607('0x1f')]],'as':_0xa8c58d['as'],'attributes':_0xa8c58d[_0xa607('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa607('0xc')](function(_0x201d04){var _0x3a5945=[];for(var _0x1f6c32=0x0;_0x1f6c32<_0x201d04[_0xa607('0x34')];_0x1f6c32+=0x1){_0x3a5945[_0xa607('0x35')](_0x201d04[_0x1f6c32][_0xa607('0x27')](_0x2a25dc[_0xa607('0x36')],{'transaction':_0xaad10f}));}return BPromise[_0xa607('0x38')](_0x3a5945);});})[_0xa607('0xc')](function(_0x121d63){logger[_0xa607('0xd')](_0xa607('0x44'),_0x2a25dc);logger[_0xa607('0x21')](_0xa607('0x44'),_0x2a25dc,JSON['stringify'](_0x121d63));_0x43e8be(_0x121d63);})[_0xa607('0x16')](function(_0x514c17){logger[_0xa607('0x12')](_0xa607('0x44'),_0x514c17[_0xa607('0x14')],_0x2a25dc);_0x57d746(_0x4f1d57[_0xa607('0x12')](0x1f4,_0x514c17[_0xa607('0x14')]));});});});};exports[_0xa607('0x48')]=function(_0x1a18da){var _0x25fecf=this;return new Promise(function(_0xa48e5b,_0x1ba34a){db[_0xa607('0x2c')]['describe']()['then'](function(_0x5c420d){return db[_0xa607('0x18')]['findAll']({'raw':_0x1a18da[_0xa607('0x1a')]?_0x1a18da[_0xa607('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a18da[_0xa607('0x1a')]?_0x1a18da[_0xa607('0x1a')][_0xa607('0x1b')]||null:null,'attributes':_0x1a18da[_0xa607('0x1a')]?_0x1a18da[_0xa607('0x1a')][_0xa607('0x1c')]||null:null,'limit':_0x1a18da[_0xa607('0x1a')]?_0x1a18da['options'][_0xa607('0x1d')]||null:null,'include':_0x1a18da['options']?_0x1a18da[_0xa607('0x1a')][_0xa607('0x1e')]?_['map'](_0x1a18da[_0xa607('0x1a')][_0xa607('0x1e')],function(_0x55916f){return{'model':db[_0x55916f[_0xa607('0x1f')]],'as':_0x55916f['as'],'attributes':_0x55916f['as']===_0xa607('0x31')?_['keys'](_0x5c420d):_0x55916f[_0xa607('0x1c')],'include':_0x55916f['include']?_['map'](_0x55916f['include'],function(_0x2e5373){return{'model':db[_0x2e5373[_0xa607('0x1f')]],'as':_0x2e5373['as'],'attributes':_0x2e5373[_0xa607('0x1c')],'include':_0x2e5373[_0xa607('0x1e')]?_['map'](_0x2e5373[_0xa607('0x1e')],function(_0x540c85){return{'model':db[_0x540c85[_0xa607('0x1f')]],'as':_0x540c85['as'],'attributes':_0x540c85[_0xa607('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa607('0xc')](function(_0x188f43){logger['info'](_0xa607('0x17'),_0x1a18da);logger[_0xa607('0x21')](_0xa607('0x17'),_0x1a18da,JSON[_0xa607('0x11')](_0x188f43));_0xa48e5b(_0x188f43);})[_0xa607('0x16')](function(_0x474517){logger['error']('GetCmHopper',_0x474517[_0xa607('0x14')],_0x1a18da);_0x1ba34a(_0x25fecf[_0xa607('0x12')](0x1f4,_0x474517['message']));});});});}; \ No newline at end of file +var _0xde89=['jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','findAll','options','raw','where','limit','include','map','attributes','model','GetCmHopper','debug','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','name','voicePause','push','MoveContactManagedDialer','destroy','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','UserId','length','all','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xde89,0x147));var _0x9de8=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xde89[_0x2db12b];return _0x20990b;};'use strict';var _=require('lodash');var util=require(_0x9de8('0x0'));var moment=require(_0x9de8('0x1'));var BPromise=require('bluebird');var rs=require(_0x9de8('0x2'));var fs=require('fs');var Redis=require(_0x9de8('0x3'));var db=require(_0x9de8('0x4'))['db'];var utils=require(_0x9de8('0x5'));var logger=require(_0x9de8('0x6'))(_0x9de8('0x7'));var config=require('../../config/environment');var jayson=require(_0x9de8('0x8'));var client=jayson['client'][_0x9de8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1818ec,_0xcf7ab5,_0x291f4b){return new BPromise(function(_0x138d70,_0x525c08){return client[_0x9de8('0xa')](_0x1818ec,_0x291f4b)[_0x9de8('0xb')](function(_0x54d542){logger[_0x9de8('0xc')](_0x9de8('0xd'),_0xcf7ab5,_0x9de8('0xe'));logger['debug'](_0x9de8('0xf'),_0xcf7ab5,_0x9de8('0xe'),JSON[_0x9de8('0x10')](_0x54d542));if(_0x54d542[_0x9de8('0x11')]){if(_0x54d542[_0x9de8('0x11')][_0x9de8('0x12')]===0x1f4){logger[_0x9de8('0x11')](_0x9de8('0xd'),_0xcf7ab5,_0x54d542['error'][_0x9de8('0x13')]);return _0x525c08(_0x54d542[_0x9de8('0x11')][_0x9de8('0x13')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0xcf7ab5,_0x54d542['error'][_0x9de8('0x13')]);return _0x138d70(_0x54d542[_0x9de8('0x11')]['message']);}else{logger[_0x9de8('0xc')](_0x9de8('0xd'),_0xcf7ab5,'request\x20sent');_0x138d70(_0x54d542[_0x9de8('0x14')][_0x9de8('0x13')]);}})[_0x9de8('0x15')](function(_0x1a1f90){logger[_0x9de8('0x11')](_0x9de8('0xd'),_0xcf7ab5,_0x1a1f90);_0x525c08(_0x1a1f90);});});}exports['GetCmHopper']=function(_0x463eec){var _0x5ad4f0=this;return new Promise(function(_0x39c9c,_0x2905e7){return db[_0x9de8('0x16')][_0x9de8('0x17')]({'raw':_0x463eec[_0x9de8('0x18')]?_0x463eec['options'][_0x9de8('0x19')]===undefined?!![]:![]:!![],'where':_0x463eec['options']?_0x463eec[_0x9de8('0x18')][_0x9de8('0x1a')]||null:null,'attributes':_0x463eec['options']?_0x463eec['options']['attributes']||null:null,'limit':_0x463eec['options']?_0x463eec[_0x9de8('0x18')][_0x9de8('0x1b')]||null:null,'include':_0x463eec[_0x9de8('0x18')]?_0x463eec[_0x9de8('0x18')][_0x9de8('0x1c')]?_[_0x9de8('0x1d')](_0x463eec[_0x9de8('0x18')][_0x9de8('0x1c')],function(_0x5817a5){return{'model':db[_0x5817a5['model']],'as':_0x5817a5['as'],'attributes':_0x5817a5[_0x9de8('0x1e')],'include':_0x5817a5['include']?_[_0x9de8('0x1d')](_0x5817a5['include'],function(_0x105848){return{'model':db[_0x105848['model']],'as':_0x105848['as'],'attributes':_0x105848[_0x9de8('0x1e')],'include':_0x105848[_0x9de8('0x1c')]?_[_0x9de8('0x1d')](_0x105848[_0x9de8('0x1c')],function(_0x1d600c){return{'model':db[_0x1d600c[_0x9de8('0x1f')]],'as':_0x1d600c['as'],'attributes':_0x1d600c[_0x9de8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9de8('0xb')](function(_0x364a0d){logger[_0x9de8('0xc')](_0x9de8('0x20'),_0x463eec);logger[_0x9de8('0x21')]('GetCmHopper',_0x463eec,JSON[_0x9de8('0x10')](_0x364a0d));_0x39c9c(_0x364a0d);})[_0x9de8('0x15')](function(_0x159a05){logger['error']('GetCmHopper',_0x159a05[_0x9de8('0x13')],_0x463eec);_0x2905e7(_0x5ad4f0[_0x9de8('0x11')](0x1f4,_0x159a05[_0x9de8('0x13')]));});});};exports[_0x9de8('0x22')]=function(_0x1ccce6){var _0x256577=this;return new Promise(function(_0x2144af,_0x445940){return db['CmHopper'][_0x9de8('0x23')]({'raw':_0x1ccce6[_0x9de8('0x18')]?_0x1ccce6[_0x9de8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1ccce6['options']?_0x1ccce6[_0x9de8('0x18')][_0x9de8('0x1a')]||null:null,'attributes':_0x1ccce6['options']?_0x1ccce6[_0x9de8('0x18')][_0x9de8('0x1e')]||null:null,'include':_0x1ccce6['options']?_0x1ccce6[_0x9de8('0x18')][_0x9de8('0x1c')]?_[_0x9de8('0x1d')](_0x1ccce6[_0x9de8('0x18')][_0x9de8('0x1c')],function(_0x51c0e9){return{'model':db[_0x51c0e9[_0x9de8('0x1f')]],'as':_0x51c0e9['as'],'attributes':_0x51c0e9[_0x9de8('0x1e')],'include':_0x51c0e9[_0x9de8('0x1c')]?_[_0x9de8('0x1d')](_0x51c0e9[_0x9de8('0x1c')],function(_0x46bf3e){return{'model':db[_0x46bf3e[_0x9de8('0x1f')]],'as':_0x46bf3e['as'],'attributes':_0x46bf3e['attributes'],'include':_0x46bf3e[_0x9de8('0x1c')]?_['map'](_0x46bf3e[_0x9de8('0x1c')],function(_0x23d1df){return{'model':db[_0x23d1df[_0x9de8('0x1f')]],'as':_0x23d1df['as'],'attributes':_0x23d1df[_0x9de8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9de8('0xb')](function(_0x58f462){logger[_0x9de8('0xc')](_0x9de8('0x22'),_0x1ccce6);logger[_0x9de8('0x21')]('ShowCmHopper',_0x1ccce6,JSON['stringify'](_0x58f462));_0x2144af(_0x58f462);})[_0x9de8('0x15')](function(_0x3187cb){logger[_0x9de8('0x11')](_0x9de8('0x22'),_0x3187cb[_0x9de8('0x13')],_0x1ccce6);_0x445940(_0x256577['error'](0x1f4,_0x3187cb[_0x9de8('0x13')]));});});};exports[_0x9de8('0x24')]=function(_0x35f9d7){var _0x15329f=this;return new Promise(function(_0x42a4e2,_0x12d39a){return db[_0x9de8('0x16')][_0x9de8('0x25')](_0x35f9d7[_0x9de8('0x26')],{'raw':_0x35f9d7[_0x9de8('0x18')]?_0x35f9d7[_0x9de8('0x18')][_0x9de8('0x19')]===undefined?!![]:![]:!![]})[_0x9de8('0xb')](function(_0x270fb0){logger[_0x9de8('0xc')](_0x9de8('0x24'),_0x35f9d7);logger[_0x9de8('0x21')](_0x9de8('0x24'),_0x35f9d7,JSON[_0x9de8('0x10')](_0x270fb0));_0x42a4e2(_0x270fb0);})['catch'](function(_0x3b94ff){logger[_0x9de8('0x11')](_0x9de8('0x24'),_0x3b94ff[_0x9de8('0x13')],_0x35f9d7);_0x12d39a(_0x15329f[_0x9de8('0x11')](0x1f4,_0x3b94ff[_0x9de8('0x13')]));});});};exports[_0x9de8('0x27')]=function(_0x3b6a13){var _0x18ce5d=this;return new Promise(function(_0x4cc6c8,_0x4bee6c){return db[_0x9de8('0x16')][_0x9de8('0x28')](_0x3b6a13[_0x9de8('0x26')],{'raw':_0x3b6a13[_0x9de8('0x18')]?_0x3b6a13['options'][_0x9de8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6a13[_0x9de8('0x18')]?_0x3b6a13[_0x9de8('0x18')][_0x9de8('0x1a')]||null:null,'attributes':_0x3b6a13['options']?_0x3b6a13[_0x9de8('0x18')][_0x9de8('0x1e')]||null:null,'limit':_0x3b6a13['options']?_0x3b6a13[_0x9de8('0x18')][_0x9de8('0x1b')]||null:null})[_0x9de8('0xb')](function(_0x5ebb7f){logger[_0x9de8('0xc')](_0x9de8('0x27'),_0x3b6a13);logger[_0x9de8('0x21')](_0x9de8('0x27'),_0x3b6a13,JSON[_0x9de8('0x10')](_0x5ebb7f));_0x4cc6c8(_0x5ebb7f);})['catch'](function(_0x3e8093){logger[_0x9de8('0x11')](_0x9de8('0x27'),_0x3e8093[_0x9de8('0x13')],_0x3b6a13);_0x4bee6c(_0x18ce5d[_0x9de8('0x11')](0x1f4,_0x3e8093[_0x9de8('0x13')]));});});};exports['DestroyCmHopper']=function(_0x6d6796){var _0x24bc6f=this;return new Promise(function(_0x55b54e,_0x2797a9){return db['CmHopper']['destroy']({'where':_0x6d6796['options']?_0x6d6796['options'][_0x9de8('0x1a')]||null:null})[_0x9de8('0xb')](function(_0x22f852){logger[_0x9de8('0xc')]('DestroyCmHopper',_0x6d6796);logger[_0x9de8('0x21')](_0x9de8('0x29'),_0x6d6796,JSON['stringify'](_0x22f852));_0x55b54e(_0x22f852);})[_0x9de8('0x15')](function(_0x1bd396){logger[_0x9de8('0x11')](_0x9de8('0x29'),_0x1bd396[_0x9de8('0x13')],_0x6d6796);_0x2797a9(_0x24bc6f['error'](0x1f4,_0x1bd396[_0x9de8('0x13')]));});});};exports[_0x9de8('0x2a')]=function(_0x5c49ae){var _0x324c00=this;return new Promise(function(_0x242705,_0x294500){return db[_0x9de8('0x2b')][_0x9de8('0x2c')]()[_0x9de8('0xb')](function(_0x19d5b9){return db[_0x9de8('0x2d')][_0x9de8('0x2e')](function(_0x8f64af){return db[_0x9de8('0x16')]['findAll']({'where':_0x5c49ae[_0x9de8('0x18')]?_0x5c49ae[_0x9de8('0x18')][_0x9de8('0x1a')]||null:null,'attributes':_0x5c49ae[_0x9de8('0x18')]?_0x5c49ae[_0x9de8('0x18')][_0x9de8('0x1e')]||null:null,'limit':_0x5c49ae['options']?_0x5c49ae[_0x9de8('0x18')][_0x9de8('0x1b')]||null:null,'order':_0x5c49ae[_0x9de8('0x18')]?_0x5c49ae['options'][_0x9de8('0x2f')]||null:null,'transaction':_0x8f64af,'lock':_0x8f64af[_0x9de8('0x30')][_0x9de8('0x31')],'include':[{'model':db[_0x9de8('0x2b')],'as':_0x9de8('0x32'),'attributes':_[_0x9de8('0x33')](_0x19d5b9)},{'model':db['User'],'as':'Agent','attributes':['id',_0x9de8('0x34'),_0x9de8('0x35')]}]})[_0x9de8('0xb')](function(_0x43d8de){var _0x4c5eab=[];var _0x2f3d95=[];for(var _0x444d83=0x0;_0x444d83<_0x43d8de['length'];_0x444d83+=0x1){var _0x3d3263=_0x43d8de[_0x444d83]['UserId'];if(_0x3d3263===null){_0x4c5eab['push'](_0x43d8de[_0x444d83]['update'](_0x5c49ae['body'],{'transaction':_0x8f64af}));}else if(!_0x2f3d95['includes'](_0x3d3263)){_0x2f3d95[_0x9de8('0x36')](_0x3d3263);_0x4c5eab[_0x9de8('0x36')](_0x43d8de[_0x444d83][_0x9de8('0x28')](_0x5c49ae[_0x9de8('0x26')],{'transaction':_0x8f64af}));}}return BPromise['all'](_0x4c5eab);});})['then'](function(_0x5e5106){logger[_0x9de8('0xc')](_0x9de8('0x2a'),_0x5c49ae);logger[_0x9de8('0x21')](_0x9de8('0x2a'),_0x5c49ae,JSON['stringify'](_0x5e5106));_0x242705(_0x5e5106);})[_0x9de8('0x15')](function(_0x2319bf){logger[_0x9de8('0x11')](_0x9de8('0x2a'),_0x2319bf['message'],_0x5c49ae);_0x294500(_0x324c00[_0x9de8('0x11')](0x1f4,_0x2319bf[_0x9de8('0x13')]));});});});};exports[_0x9de8('0x37')]=function(_0x4f1f8){var _0x570599=this;return new Promise(function(_0x113856,_0x4f80ed){return db[_0x9de8('0x2d')][_0x9de8('0x2e')](function(_0x5001c1){return db['CmHopperFinal'][_0x9de8('0x25')](_0x4f1f8[_0x9de8('0x26')],{'raw':_0x4f1f8[_0x9de8('0x18')]?_0x4f1f8[_0x9de8('0x18')][_0x9de8('0x19')]===undefined?!![]:![]:!![],'transaction':_0x5001c1})[_0x9de8('0xb')](function(){return db[_0x9de8('0x16')][_0x9de8('0x38')]({'where':_0x4f1f8[_0x9de8('0x18')]?_0x4f1f8[_0x9de8('0x18')]['where']||null:null,'transaction':_0x5001c1});});})[_0x9de8('0xb')](function(_0x18fca5){logger[_0x9de8('0xc')]('MoveContactManagedDialer',_0x4f1f8);logger[_0x9de8('0x21')]('MoveContactManagedDialer',_0x4f1f8,JSON[_0x9de8('0x10')](_0x18fca5));_0x113856(_0x18fca5);})['catch'](function(_0x2cdcd8){logger['error'](_0x9de8('0x37'),_0x2cdcd8['message'],_0x4f1f8);_0x4f80ed(_0x570599['error'](0x1f4,_0x2cdcd8[_0x9de8('0x13')]));});});};exports['CountReScheduled']=function(_0x51e961){var _0x175d0e=this;return new Promise(function(_0x560d04,_0x23cce0){return db['CmHopper'][_0x9de8('0x17')]({'raw':_0x51e961[_0x9de8('0x18')]?_0x51e961[_0x9de8('0x18')][_0x9de8('0x19')]===undefined?!![]:![]:!![],'where':_0x51e961[_0x9de8('0x18')]?_0x51e961[_0x9de8('0x18')][_0x9de8('0x1a')]||null:null,'attributes':[[db[_0x9de8('0x2d')]['fn']('COUNT',db[_0x9de8('0x2d')]['fn']('IF',db[_0x9de8('0x2d')]['literal'](_0x9de8('0x39')+util[_0x9de8('0x3a')](_0x9de8('0x3b'),moment()['format'](_0x9de8('0x3c')))+_0x9de8('0x3d')))),'contactsRescheduled']]})[_0x9de8('0xb')](function(_0x170c8d){logger[_0x9de8('0xc')](_0x9de8('0x3e'),_0x51e961);logger['debug'](_0x9de8('0x3e'),_0x51e961,JSON[_0x9de8('0x10')](_0x170c8d));_0x560d04(_0x170c8d);})[_0x9de8('0x15')](function(_0x17d182){logger[_0x9de8('0x11')](_0x9de8('0x3e'),_0x17d182['message'],_0x51e961);_0x23cce0(_0x175d0e[_0x9de8('0x11')](0x1f4,_0x17d182['message']));});});};exports[_0x9de8('0x3f')]=function(_0xf4b754){var _0x80e7eb=this;return new Promise(function(_0x10c369,_0x49036f){return db[_0x9de8('0x2b')]['describe']()[_0x9de8('0xb')](function(_0x13c229){return db[_0x9de8('0x2d')][_0x9de8('0x2e')](function(_0xafa8ce){return db[_0x9de8('0x16')]['findAll']({'where':_0xf4b754[_0x9de8('0x18')]?_0xf4b754[_0x9de8('0x18')][_0x9de8('0x1a')]||null:null,'attributes':_0xf4b754[_0x9de8('0x18')]?_0xf4b754['options'][_0x9de8('0x1e')]||null:null,'limit':0x1,'order':_0xf4b754[_0x9de8('0x18')]?_0xf4b754[_0x9de8('0x18')][_0x9de8('0x2f')]||null:null,'group':db[_0x9de8('0x16')][_0x9de8('0x40')],'transaction':_0xafa8ce,'lock':_0xafa8ce[_0x9de8('0x30')][_0x9de8('0x31')],'include':_0xf4b754['options']?_0xf4b754['options'][_0x9de8('0x1c')]?_[_0x9de8('0x1d')](_0xf4b754['options'][_0x9de8('0x1c')],function(_0x486eb3){return{'model':db[_0x486eb3[_0x9de8('0x1f')]],'as':_0x486eb3['as'],'attributes':_0x486eb3[_0x9de8('0x1e')],'include':_0x486eb3[_0x9de8('0x1c')]?_[_0x9de8('0x1d')](_0x486eb3['include'],function(_0x503fff){return{'model':db[_0x503fff[_0x9de8('0x1f')]],'as':_0x503fff['as'],'attributes':_0x503fff['attributes'],'include':_0x503fff[_0x9de8('0x1c')]?_['map'](_0x503fff['include'],function(_0x2c0052){return{'model':db[_0x2c0052[_0x9de8('0x1f')]],'as':_0x2c0052['as'],'attributes':_0x2c0052[_0x9de8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a2aa9){var _0x439145=[];for(var _0x2b5f3f=0x0;_0x2b5f3f<_0x3a2aa9[_0x9de8('0x41')];_0x2b5f3f+=0x1){_0x439145[_0x9de8('0x36')](_0x3a2aa9[_0x2b5f3f]['update'](_0xf4b754[_0x9de8('0x26')],{'transaction':_0xafa8ce}));}return BPromise[_0x9de8('0x42')](_0x439145);});})[_0x9de8('0xb')](function(_0x5dee8f){logger[_0x9de8('0xc')](_0x9de8('0x3f'),_0xf4b754);logger[_0x9de8('0x21')]('GetContactRecallMe',_0xf4b754,JSON[_0x9de8('0x10')](_0x5dee8f));_0x10c369(_0x5dee8f);})[_0x9de8('0x15')](function(_0x44f296){logger[_0x9de8('0x11')](_0x9de8('0x3f'),_0x44f296[_0x9de8('0x13')],_0xf4b754);_0x49036f(_0x80e7eb[_0x9de8('0x11')](0x1f4,_0x44f296[_0x9de8('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x191c91){var _0x4f6625=this;return new Promise(function(_0x59b688,_0x24a5a1){db[_0x9de8('0x2b')]['describe']()[_0x9de8('0xb')](function(_0x2326a7){return db[_0x9de8('0x16')][_0x9de8('0x17')]({'raw':_0x191c91[_0x9de8('0x18')]?_0x191c91[_0x9de8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x191c91['options']?_0x191c91['options'][_0x9de8('0x1a')]||null:null,'attributes':_0x191c91['options']?_0x191c91[_0x9de8('0x18')][_0x9de8('0x1e')]||null:null,'limit':_0x191c91[_0x9de8('0x18')]?_0x191c91[_0x9de8('0x18')][_0x9de8('0x1b')]||null:null,'include':_0x191c91[_0x9de8('0x18')]?_0x191c91[_0x9de8('0x18')][_0x9de8('0x1c')]?_[_0x9de8('0x1d')](_0x191c91[_0x9de8('0x18')][_0x9de8('0x1c')],function(_0x1506e8){return{'model':db[_0x1506e8[_0x9de8('0x1f')]],'as':_0x1506e8['as'],'attributes':_0x1506e8['as']===_0x9de8('0x32')?_['keys'](_0x2326a7):_0x1506e8[_0x9de8('0x1e')],'include':_0x1506e8['include']?_[_0x9de8('0x1d')](_0x1506e8[_0x9de8('0x1c')],function(_0x3d221b){return{'model':db[_0x3d221b[_0x9de8('0x1f')]],'as':_0x3d221b['as'],'attributes':_0x3d221b['attributes'],'include':_0x3d221b[_0x9de8('0x1c')]?_['map'](_0x3d221b[_0x9de8('0x1c')],function(_0x50c0ca){return{'model':db[_0x50c0ca['model']],'as':_0x50c0ca['as'],'attributes':_0x50c0ca[_0x9de8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9de8('0xb')](function(_0x105a7a){logger['info'](_0x9de8('0x20'),_0x191c91);logger[_0x9de8('0x21')](_0x9de8('0x20'),_0x191c91,JSON[_0x9de8('0x10')](_0x105a7a));_0x59b688(_0x105a7a);})[_0x9de8('0x15')](function(_0x5067ad){logger[_0x9de8('0x11')](_0x9de8('0x20'),_0x5067ad[_0x9de8('0x13')],_0x191c91);_0x24a5a1(_0x4f6625['error'](0x1f4,_0x5067ad[_0x9de8('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 8405281..8f1828c 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 _0xd5b6=['../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','show','post','create','/preview','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x355152,_0x38e875){var _0x599d7d=function(_0x45840d){while(--_0x45840d){_0x355152['push'](_0x355152['shift']());}};_0x599d7d(++_0x38e875);}(_0xd5b6,0x179));var _0x6d5b=function(_0x10d161,_0x5ee7ac){_0x10d161=_0x10d161-0x0;var _0x54d23a=_0xd5b6[_0x10d161];return _0x54d23a;};'use strict';var multer=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var path=require(_0x6d5b('0x2'));var timeout=require(_0x6d5b('0x3'));var express=require(_0x6d5b('0x4'));var router=express['Router']();var fs_extra=require(_0x6d5b('0x5'));var auth=require(_0x6d5b('0x6'));var interaction=require(_0x6d5b('0x7'));var config=require('../../config/environment');var controller=require(_0x6d5b('0x8'));router[_0x6d5b('0x9')]('/',auth[_0x6d5b('0xa')](),controller[_0x6d5b('0xb')]);router[_0x6d5b('0x9')](_0x6d5b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6d5b('0x9')](_0x6d5b('0xd'),auth[_0x6d5b('0xa')](),controller[_0x6d5b('0xe')]);router[_0x6d5b('0x9')]('/:id',auth[_0x6d5b('0xa')](),controller[_0x6d5b('0xf')]);router[_0x6d5b('0x10')]('/',auth[_0x6d5b('0xa')](),controller[_0x6d5b('0x11')]);router[_0x6d5b('0x10')](_0x6d5b('0x12'),auth[_0x6d5b('0xa')](),controller['getPreview']);router[_0x6d5b('0x13')](_0x6d5b('0x14'),auth[_0x6d5b('0xa')](),controller[_0x6d5b('0x15')]);router[_0x6d5b('0x16')]('/:id',auth[_0x6d5b('0xa')](),controller[_0x6d5b('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe5cc=['./cmHopper.controller','get','index','describe','/opencontacts','isAuthenticated','getOpenContacts','/:id','post','create','/preview','getPreview','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe5cc,0x82));var _0xce5c=function(_0x10a607,_0x34e28c){_0x10a607=_0x10a607-0x0;var _0x5c6d3=_0xe5cc[_0x10a607];return _0x5c6d3;};'use strict';var multer=require('multer');var util=require(_0xce5c('0x0'));var path=require(_0xce5c('0x1'));var timeout=require(_0xce5c('0x2'));var express=require(_0xce5c('0x3'));var router=express[_0xce5c('0x4')]();var fs_extra=require(_0xce5c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xce5c('0x6'));var config=require(_0xce5c('0x7'));var controller=require(_0xce5c('0x8'));router[_0xce5c('0x9')]('/',auth['isAuthenticated'](),controller[_0xce5c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xce5c('0xb')]);router[_0xce5c('0x9')](_0xce5c('0xc'),auth[_0xce5c('0xd')](),controller[_0xce5c('0xe')]);router[_0xce5c('0x9')](_0xce5c('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xce5c('0x10')]('/',auth[_0xce5c('0xd')](),controller[_0xce5c('0x11')]);router[_0xce5c('0x10')](_0xce5c('0x12'),auth[_0xce5c('0xd')](),controller[_0xce5c('0x13')]);router[_0xce5c('0x14')](_0xce5c('0xf'),auth[_0xce5c('0xd')](),controller[_0xce5c('0x15')]);router['delete'](_0xce5c('0xf'),auth[_0xce5c('0xd')](),controller['destroy']);module[_0xce5c('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2cdd033..a9131ec 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 _0x8cce=['INTEGER','contactListQueue','moment','sequelize'];(function(_0x29adb2,_0x48616f){var _0x250229=function(_0x22a883){while(--_0x22a883){_0x29adb2['push'](_0x29adb2['shift']());}};_0x250229(++_0x48616f);}(_0x8cce,0xee));var _0xe8cc=function(_0xb5a8c0,_0x420492){_0xb5a8c0=_0xb5a8c0-0x0;var _0x211882=_0x8cce[_0xb5a8c0];return _0x211882;};'use strict';var moment=require(_0xe8cc('0x0'));var Sequelize=require(_0xe8cc('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe8cc('0x2')],'unique':_0xe8cc('0x3')},'ListId':{'type':Sequelize[_0xe8cc('0x2')],'unique':_0xe8cc('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe8cc('0x2')],'unique':_0xe8cc('0x3')}}; \ No newline at end of file +var _0xb6ac=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x19b351,_0x547358){var _0x104803=function(_0x412161){while(--_0x412161){_0x19b351['push'](_0x19b351['shift']());}};_0x104803(++_0x547358);}(_0xb6ac,0x86));var _0xcb6a=function(_0x11e096,_0x26c11d){_0x11e096=_0x11e096-0x0;var _0x437ebf=_0xb6ac[_0x11e096];return _0x437ebf;};'use strict';var moment=require('moment');var Sequelize=require(_0xcb6a('0x0'));module[_0xcb6a('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcb6a('0x2')],'unique':_0xcb6a('0x3')},'ListId':{'type':Sequelize[_0xcb6a('0x2')],'unique':_0xcb6a('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xcb6a('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9ada210..9fb591c 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 _0xecfc=['merge','VIRTUAL','options','includeAll','include','CmHopperBlack','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','status','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x401348,_0x201478){var _0x75e0b6=function(_0x1e2e57){while(--_0x1e2e57){_0x401348['push'](_0x401348['shift']());}};_0x75e0b6(++_0x201478);}(_0xecfc,0x139));var _0xcecf=function(_0xf56d54,_0x3dc48a){_0xf56d54=_0xf56d54-0x0;var _0x1ecd51=_0xecfc[_0xf56d54];return _0x1ecd51;};'use strict';var emlformat=require(_0xcecf('0x0'));var rimraf=require(_0xcecf('0x1'));var zipdir=require(_0xcecf('0x2'));var jsonpatch=require(_0xcecf('0x3'));var rp=require(_0xcecf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcecf('0x5'));var util=require('util');var path=require(_0xcecf('0x6'));var sox=require(_0xcecf('0x7'));var csv=require(_0xcecf('0x8'));var ejs=require(_0xcecf('0x9'));var fs=require('fs');var fs_extra=require(_0xcecf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcecf('0xb'));var jsforce=require(_0xcecf('0xc'));var deskjs=require(_0xcecf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcecf('0xe'));var Papa=require(_0xcecf('0xf'));var Redis=require(_0xcecf('0x10'));var authService=require(_0xcecf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcecf('0x12'));var hardwareService=require(_0xcecf('0x13'));var logger=require(_0xcecf('0x14'))(_0xcecf('0x15'));var utils=require(_0xcecf('0x16'));var config=require(_0xcecf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcecf('0x18'))['db'];function respondWithStatusCode(_0x189d94,_0x141982){_0x141982=_0x141982||0xcc;return function(_0x5c04d3){if(_0x5c04d3){return _0x189d94['sendStatus'](_0x141982);}return _0x189d94['status'](_0x141982)[_0xcecf('0x19')]();};}function respondWithResult(_0x8c30d3,_0x14a369){_0x14a369=_0x14a369||0xc8;return function(_0xcf86df){if(_0xcf86df){return _0x8c30d3['status'](_0x14a369)[_0xcecf('0x1a')](_0xcf86df);}};}function respondWithFilteredResult(_0x2ae060,_0xe72040){return function(_0x2330ad){if(_0x2330ad){var _0x49a933=typeof _0xe72040['offset']===_0xcecf('0x1b')&&typeof _0xe72040[_0xcecf('0x1c')]===_0xcecf('0x1b');var _0x4b7953=_0x2330ad[_0xcecf('0x1d')];var _0x5570a7=_0x49a933?0x0:_0xe72040[_0xcecf('0x1e')];var _0x25d027=_0x49a933?_0x2330ad[_0xcecf('0x1d')]:_0xe72040[_0xcecf('0x1e')]+_0xe72040[_0xcecf('0x1c')];var _0x3bc618;if(_0x25d027>=_0x4b7953){_0x25d027=_0x4b7953;_0x3bc618=0xc8;}else{_0x3bc618=0xce;}_0x2ae060['status'](_0x3bc618);return _0x2ae060[_0xcecf('0x1f')](_0xcecf('0x20'),_0x5570a7+'-'+_0x25d027+'/'+_0x4b7953)[_0xcecf('0x1a')](_0x2330ad);}return null;};}function patchUpdates(_0x29b059){return function(_0x14cd57){try{jsonpatch[_0xcecf('0x21')](_0x14cd57,_0x29b059,!![]);}catch(_0x2c9a2a){return BPromise[_0xcecf('0x22')](_0x2c9a2a);}return _0x14cd57['save']();};}function saveUpdates(_0xe7720a,_0x5ac678){return function(_0x55cd3e){if(_0x55cd3e){return _0x55cd3e[_0xcecf('0x23')](_0xe7720a)[_0xcecf('0x24')](function(_0x3cc6d8){return _0x3cc6d8;});}return null;};}function removeEntity(_0x5a4230,_0x77c5a){return function(_0x2625e2){if(_0x2625e2){return _0x2625e2['destroy']()[_0xcecf('0x24')](function(){_0x5a4230[_0xcecf('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44ecd8,_0x3d0b3c){return function(_0x3e469e){if(!_0x3e469e){_0x44ecd8[_0xcecf('0x26')](0x194);}return _0x3e469e;};}function handleError(_0x2b4be7,_0x39dcf3){_0x39dcf3=_0x39dcf3||0x1f4;return function(_0x454b7a){logger[_0xcecf('0x27')](_0x454b7a[_0xcecf('0x28')]);if(_0x454b7a[_0xcecf('0x29')]){delete _0x454b7a['name'];}_0x2b4be7['status'](_0x39dcf3)[_0xcecf('0x2a')](_0x454b7a);};}exports[_0xcecf('0x2b')]=function(_0x458de2,_0x7437d1){var _0x92fbec={},_0x57b2e3={},_0x2073c4={'count':0x0,'rows':[]};var _0x5d2158=_[_0xcecf('0x2c')](db['CmHopperBlack'][_0xcecf('0x2d')],function(_0x9e7412){return{'name':_0x9e7412[_0xcecf('0x2e')],'type':_0x9e7412[_0xcecf('0x2f')]['key']};});_0x57b2e3[_0xcecf('0x30')]=_['map'](_0x5d2158,_0xcecf('0x29'));_0x57b2e3[_0xcecf('0x31')]=_[_0xcecf('0x32')](_0x458de2[_0xcecf('0x31')]);_0x57b2e3[_0xcecf('0x33')]=_['intersection'](_0x57b2e3[_0xcecf('0x30')],_0x57b2e3[_0xcecf('0x31')]);_0x92fbec[_0xcecf('0x34')]=_[_0xcecf('0x35')](_0x57b2e3['model'],qs[_0xcecf('0x36')](_0x458de2[_0xcecf('0x31')][_0xcecf('0x36')]));_0x92fbec[_0xcecf('0x34')]=_0x92fbec[_0xcecf('0x34')][_0xcecf('0x37')]?_0x92fbec[_0xcecf('0x34')]:_0x57b2e3[_0xcecf('0x30')];if(!_0x458de2[_0xcecf('0x31')][_0xcecf('0x38')](_0xcecf('0x39'))){_0x92fbec[_0xcecf('0x1c')]=qs['limit'](_0x458de2['query'][_0xcecf('0x1c')]);_0x92fbec[_0xcecf('0x1e')]=qs[_0xcecf('0x1e')](_0x458de2[_0xcecf('0x31')][_0xcecf('0x1e')]);}_0x92fbec[_0xcecf('0x3a')]=qs[_0xcecf('0x3b')](_0x458de2[_0xcecf('0x31')][_0xcecf('0x3b')]);_0x92fbec[_0xcecf('0x3c')]=qs['filters'](_['pick'](_0x458de2[_0xcecf('0x31')],_0x57b2e3[_0xcecf('0x33')]),_0x5d2158);if(_0x458de2[_0xcecf('0x31')][_0xcecf('0x3d')]){_0x92fbec[_0xcecf('0x3c')]=_[_0xcecf('0x3e')](_0x92fbec[_0xcecf('0x3c')],{'$or':_[_0xcecf('0x2c')](_0x5d2158,function(_0x59b8b3){if(_0x59b8b3['type']!==_0xcecf('0x3f')){var _0x1a654f={};_0x1a654f[_0x59b8b3[_0xcecf('0x29')]]={'$like':'%'+_0x458de2[_0xcecf('0x31')][_0xcecf('0x3d')]+'%'};return _0x1a654f;}})});}_0x92fbec=_['merge']({},_0x92fbec,_0x458de2[_0xcecf('0x40')]);var _0xf41b3d={'where':_0x92fbec[_0xcecf('0x3c')]};return db['CmHopperBlack'][_0xcecf('0x1d')](_0xf41b3d)[_0xcecf('0x24')](function(_0x2e9504){_0x2073c4[_0xcecf('0x1d')]=_0x2e9504;if(_0x458de2['query'][_0xcecf('0x41')]){_0x92fbec[_0xcecf('0x42')]=[{'all':!![]}];}return db[_0xcecf('0x43')][_0xcecf('0x44')](_0x92fbec);})[_0xcecf('0x24')](function(_0x24206){_0x2073c4[_0xcecf('0x45')]=_0x24206;return _0x2073c4;})['then'](respondWithFilteredResult(_0x7437d1,_0x92fbec))[_0xcecf('0x46')](handleError(_0x7437d1,null));};exports['show']=function(_0x55a939,_0x4df1bd){var _0x347cfa={'raw':!![],'where':{'id':_0x55a939[_0xcecf('0x47')]['id']}},_0x224669={};_0x224669[_0xcecf('0x30')]=_[_0xcecf('0x32')](db['CmHopperBlack'][_0xcecf('0x2d')]);_0x224669[_0xcecf('0x31')]=_['keys'](_0x55a939[_0xcecf('0x31')]);_0x224669[_0xcecf('0x33')]=_[_0xcecf('0x35')](_0x224669['model'],_0x224669[_0xcecf('0x31')]);_0x347cfa['attributes']=_[_0xcecf('0x35')](_0x224669['model'],qs[_0xcecf('0x36')](_0x55a939[_0xcecf('0x31')][_0xcecf('0x36')]));_0x347cfa[_0xcecf('0x34')]=_0x347cfa[_0xcecf('0x34')][_0xcecf('0x37')]?_0x347cfa[_0xcecf('0x34')]:_0x224669['model'];if(_0x55a939['query'][_0xcecf('0x41')]){_0x347cfa[_0xcecf('0x42')]=[{'all':!![]}];}_0x347cfa=_[_0xcecf('0x3e')]({},_0x347cfa,_0x55a939[_0xcecf('0x40')]);return db[_0xcecf('0x43')][_0xcecf('0x48')](_0x347cfa)[_0xcecf('0x24')](handleEntityNotFound(_0x4df1bd,null))[_0xcecf('0x24')](respondWithResult(_0x4df1bd,null))[_0xcecf('0x46')](handleError(_0x4df1bd,null));};exports['update']=function(_0x42ac0d,_0x332416){if(_0x42ac0d[_0xcecf('0x49')]['id']){delete _0x42ac0d['body']['id'];}return db[_0xcecf('0x43')][_0xcecf('0x48')]({'where':{'id':_0x42ac0d[_0xcecf('0x47')]['id']}})['then'](handleEntityNotFound(_0x332416,null))[_0xcecf('0x24')](saveUpdates(_0x42ac0d[_0xcecf('0x49')],null))['then'](respondWithResult(_0x332416,null))[_0xcecf('0x46')](handleError(_0x332416,null));};exports['destroy']=function(_0x50ebb5,_0x2e56b7){return db[_0xcecf('0x43')][_0xcecf('0x48')]({'where':{'id':_0x50ebb5[_0xcecf('0x47')]['id']}})[_0xcecf('0x24')](handleEntityNotFound(_0x2e56b7,null))['then'](removeEntity(_0x2e56b7,null))[_0xcecf('0x46')](handleError(_0x2e56b7,null));};exports[_0xcecf('0x4a')]=function(_0x1c8791,_0x478fa2){return db[_0xcecf('0x43')][_0xcecf('0x4a')]()[_0xcecf('0x24')](respondWithResult(_0x478fa2,null))['catch'](handleError(_0x478fa2,null));}; \ No newline at end of file +var _0x3308=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','stack','index','map','CmHopperBlack','rawAttributes','type','model','name','keys','query'];(function(_0x23932c,_0x13a123){var _0x276fb7=function(_0x346800){while(--_0x346800){_0x23932c['push'](_0x23932c['shift']());}};_0x276fb7(++_0x13a123);}(_0x3308,0x17c));var _0x8330=function(_0x2baa2f,_0x222b1f){_0x2baa2f=_0x2baa2f-0x0;var _0x242520=_0x3308[_0x2baa2f];return _0x242520;};'use strict';var emlformat=require(_0x8330('0x0'));var rimraf=require(_0x8330('0x1'));var zipdir=require(_0x8330('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8330('0x3'));var moment=require(_0x8330('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8330('0x5'));var path=require(_0x8330('0x6'));var sox=require(_0x8330('0x7'));var csv=require('to-csv');var ejs=require(_0x8330('0x8'));var fs=require('fs');var fs_extra=require(_0x8330('0x9'));var _=require('lodash');var squel=require(_0x8330('0xa'));var crypto=require(_0x8330('0xb'));var jsforce=require(_0x8330('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8330('0xd'));var Papa=require(_0x8330('0xe'));var Redis=require(_0x8330('0xf'));var authService=require(_0x8330('0x10'));var qs=require(_0x8330('0x11'));var as=require(_0x8330('0x12'));var hardwareService=require(_0x8330('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8330('0x14'));var config=require(_0x8330('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6274,_0xfd3459){_0xfd3459=_0xfd3459||0xcc;return function(_0x1e4b08){if(_0x1e4b08){return _0x5d6274[_0x8330('0x16')](_0xfd3459);}return _0x5d6274[_0x8330('0x17')](_0xfd3459)[_0x8330('0x18')]();};}function respondWithResult(_0x2df17b,_0x409174){_0x409174=_0x409174||0xc8;return function(_0x1da931){if(_0x1da931){return _0x2df17b[_0x8330('0x17')](_0x409174)[_0x8330('0x19')](_0x1da931);}};}function respondWithFilteredResult(_0x46a2bf,_0x38e9f6){return function(_0x25e9a3){if(_0x25e9a3){var _0x3e3f69=typeof _0x38e9f6[_0x8330('0x1a')]===_0x8330('0x1b')&&typeof _0x38e9f6[_0x8330('0x1c')]===_0x8330('0x1b');var _0x3d363d=_0x25e9a3['count'];var _0xde11ec=_0x3e3f69?0x0:_0x38e9f6[_0x8330('0x1a')];var _0x160bee=_0x3e3f69?_0x25e9a3['count']:_0x38e9f6['offset']+_0x38e9f6[_0x8330('0x1c')];var _0x490cb8;if(_0x160bee>=_0x3d363d){_0x160bee=_0x3d363d;_0x490cb8=0xc8;}else{_0x490cb8=0xce;}_0x46a2bf[_0x8330('0x17')](_0x490cb8);return _0x46a2bf[_0x8330('0x1d')]('Content-Range',_0xde11ec+'-'+_0x160bee+'/'+_0x3d363d)[_0x8330('0x19')](_0x25e9a3);}return null;};}function patchUpdates(_0x327a11){return function(_0x1dfc2a){try{jsonpatch[_0x8330('0x1e')](_0x1dfc2a,_0x327a11,!![]);}catch(_0x552ad4){return BPromise[_0x8330('0x1f')](_0x552ad4);}return _0x1dfc2a[_0x8330('0x20')]();};}function saveUpdates(_0x128a8e,_0x325722){return function(_0x233033){if(_0x233033){return _0x233033[_0x8330('0x21')](_0x128a8e)[_0x8330('0x22')](function(_0x4a099f){return _0x4a099f;});}return null;};}function removeEntity(_0x52151e,_0x411498){return function(_0x139f53){if(_0x139f53){return _0x139f53[_0x8330('0x23')]()['then'](function(){_0x52151e['status'](0xcc)[_0x8330('0x18')]();});}};}function handleEntityNotFound(_0x2fc96d,_0x442746){return function(_0x1b6754){if(!_0x1b6754){_0x2fc96d[_0x8330('0x16')](0x194);}return _0x1b6754;};}function handleError(_0x11f7f9,_0x81ce1e){_0x81ce1e=_0x81ce1e||0x1f4;return function(_0x578528){logger['error'](_0x578528[_0x8330('0x24')]);if(_0x578528['name']){delete _0x578528['name'];}_0x11f7f9[_0x8330('0x17')](_0x81ce1e)['send'](_0x578528);};}exports[_0x8330('0x25')]=function(_0x31f171,_0x11df52){var _0x42b4c5={},_0x873ceb={},_0x1905fb={'count':0x0,'rows':[]};var _0x37cd82=_[_0x8330('0x26')](db[_0x8330('0x27')][_0x8330('0x28')],function(_0x529656){return{'name':_0x529656['fieldName'],'type':_0x529656[_0x8330('0x29')]['key']};});_0x873ceb[_0x8330('0x2a')]=_[_0x8330('0x26')](_0x37cd82,_0x8330('0x2b'));_0x873ceb['query']=_[_0x8330('0x2c')](_0x31f171[_0x8330('0x2d')]);_0x873ceb[_0x8330('0x2e')]=_[_0x8330('0x2f')](_0x873ceb[_0x8330('0x2a')],_0x873ceb[_0x8330('0x2d')]);_0x42b4c5[_0x8330('0x30')]=_[_0x8330('0x2f')](_0x873ceb[_0x8330('0x2a')],qs[_0x8330('0x31')](_0x31f171['query']['fields']));_0x42b4c5['attributes']=_0x42b4c5[_0x8330('0x30')][_0x8330('0x32')]?_0x42b4c5[_0x8330('0x30')]:_0x873ceb[_0x8330('0x2a')];if(!_0x31f171[_0x8330('0x2d')][_0x8330('0x33')]('nolimit')){_0x42b4c5[_0x8330('0x1c')]=qs['limit'](_0x31f171[_0x8330('0x2d')]['limit']);_0x42b4c5[_0x8330('0x1a')]=qs[_0x8330('0x1a')](_0x31f171[_0x8330('0x2d')]['offset']);}_0x42b4c5[_0x8330('0x34')]=qs[_0x8330('0x35')](_0x31f171[_0x8330('0x2d')][_0x8330('0x35')]);_0x42b4c5['where']=qs[_0x8330('0x2e')](_[_0x8330('0x36')](_0x31f171[_0x8330('0x2d')],_0x873ceb[_0x8330('0x2e')]),_0x37cd82);if(_0x31f171['query'][_0x8330('0x37')]){_0x42b4c5[_0x8330('0x38')]=_[_0x8330('0x39')](_0x42b4c5[_0x8330('0x38')],{'$or':_['map'](_0x37cd82,function(_0x4a5249){if(_0x4a5249['type']!==_0x8330('0x3a')){var _0x409004={};_0x409004[_0x4a5249[_0x8330('0x2b')]]={'$like':'%'+_0x31f171[_0x8330('0x2d')][_0x8330('0x37')]+'%'};return _0x409004;}})});}_0x42b4c5=_[_0x8330('0x39')]({},_0x42b4c5,_0x31f171['options']);var _0x13fb7c={'where':_0x42b4c5['where']};return db[_0x8330('0x27')][_0x8330('0x3b')](_0x13fb7c)[_0x8330('0x22')](function(_0x18c4c0){_0x1905fb[_0x8330('0x3b')]=_0x18c4c0;if(_0x31f171['query'][_0x8330('0x3c')]){_0x42b4c5[_0x8330('0x3d')]=[{'all':!![]}];}return db[_0x8330('0x27')][_0x8330('0x3e')](_0x42b4c5);})[_0x8330('0x22')](function(_0x3758df){_0x1905fb[_0x8330('0x3f')]=_0x3758df;return _0x1905fb;})['then'](respondWithFilteredResult(_0x11df52,_0x42b4c5))['catch'](handleError(_0x11df52,null));};exports[_0x8330('0x40')]=function(_0x48b61e,_0x593ff8){var _0x5ad3a7={'raw':!![],'where':{'id':_0x48b61e[_0x8330('0x41')]['id']}},_0x245c0b={};_0x245c0b[_0x8330('0x2a')]=_['keys'](db[_0x8330('0x27')][_0x8330('0x28')]);_0x245c0b['query']=_[_0x8330('0x2c')](_0x48b61e[_0x8330('0x2d')]);_0x245c0b[_0x8330('0x2e')]=_['intersection'](_0x245c0b[_0x8330('0x2a')],_0x245c0b['query']);_0x5ad3a7[_0x8330('0x30')]=_[_0x8330('0x2f')](_0x245c0b['model'],qs['fields'](_0x48b61e['query'][_0x8330('0x31')]));_0x5ad3a7[_0x8330('0x30')]=_0x5ad3a7[_0x8330('0x30')][_0x8330('0x32')]?_0x5ad3a7['attributes']:_0x245c0b[_0x8330('0x2a')];if(_0x48b61e['query'][_0x8330('0x3c')]){_0x5ad3a7[_0x8330('0x3d')]=[{'all':!![]}];}_0x5ad3a7=_[_0x8330('0x39')]({},_0x5ad3a7,_0x48b61e[_0x8330('0x42')]);return db['CmHopperBlack'][_0x8330('0x43')](_0x5ad3a7)[_0x8330('0x22')](handleEntityNotFound(_0x593ff8,null))[_0x8330('0x22')](respondWithResult(_0x593ff8,null))[_0x8330('0x44')](handleError(_0x593ff8,null));};exports[_0x8330('0x21')]=function(_0x3e3b1b,_0x5776ab){if(_0x3e3b1b[_0x8330('0x45')]['id']){delete _0x3e3b1b[_0x8330('0x45')]['id'];}return db[_0x8330('0x27')][_0x8330('0x43')]({'where':{'id':_0x3e3b1b[_0x8330('0x41')]['id']}})[_0x8330('0x22')](handleEntityNotFound(_0x5776ab,null))[_0x8330('0x22')](saveUpdates(_0x3e3b1b[_0x8330('0x45')],null))[_0x8330('0x22')](respondWithResult(_0x5776ab,null))[_0x8330('0x44')](handleError(_0x5776ab,null));};exports[_0x8330('0x23')]=function(_0x37773d,_0x1e4b0c){return db[_0x8330('0x27')][_0x8330('0x43')]({'where':{'id':_0x37773d[_0x8330('0x41')]['id']}})[_0x8330('0x22')](handleEntityNotFound(_0x1e4b0c,null))[_0x8330('0x22')](removeEntity(_0x1e4b0c,null))[_0x8330('0x44')](handleError(_0x1e4b0c,null));};exports['describe']=function(_0x3eb2b2,_0x197830){return db[_0x8330('0x27')][_0x8330('0x46')]()[_0x8330('0x22')](respondWithResult(_0x197830,null))[_0x8330('0x44')](handleError(_0x197830,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bdcf6ae..301427f 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 _0x9fa0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack'];(function(_0x121493,_0x1d9b35){var _0x353b99=function(_0x4f07ee){while(--_0x4f07ee){_0x121493['push'](_0x121493['shift']());}};_0x353b99(++_0x1d9b35);}(_0x9fa0,0xfc));var _0x09fa=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x9fa0[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require(_0x09fa('0x0'));var logger=require(_0x09fa('0x1'))(_0x09fa('0x2'));var moment=require(_0x09fa('0x3'));var BPromise=require(_0x09fa('0x4'));var rp=require(_0x09fa('0x5'));var fs=require('fs');var path=require(_0x09fa('0x6'));var rimraf=require(_0x09fa('0x7'));var config=require(_0x09fa('0x8'));var attributes=require(_0x09fa('0x9'));module[_0x09fa('0xa')]=function(_0x3d2f4b,_0x1346b8){return _0x3d2f4b['define'](_0x09fa('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7fe=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black'];(function(_0x5e0d19,_0x3b60d7){var _0x3ddf47=function(_0x3c7b2c){while(--_0x3c7b2c){_0x5e0d19['push'](_0x5e0d19['shift']());}};_0x3ddf47(++_0x3b60d7);}(_0xd7fe,0x19a));var _0xed7f=function(_0xeb39af,_0x1acbc4){_0xeb39af=_0xeb39af-0x0;var _0x4bba8b=_0xd7fe[_0xeb39af];return _0x4bba8b;};'use strict';var _=require(_0xed7f('0x0'));var util=require('util');var logger=require(_0xed7f('0x1'))(_0xed7f('0x2'));var moment=require(_0xed7f('0x3'));var BPromise=require(_0xed7f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed7f('0x5'));var rimraf=require(_0xed7f('0x6'));var config=require('../../config/environment');var attributes=require(_0xed7f('0x7'));module['exports']=function(_0x32d818,_0x1ef131){return _0x32d818['define'](_0xed7f('0x8'),attributes,{'tableName':_0xed7f('0x9'),'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 cefb61f..c8aad70 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 _0xefa8=['rpc','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','update','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52975d,_0x127968){var _0x3baabc=function(_0x3b80e6){while(--_0x3b80e6){_0x52975d['push'](_0x52975d['shift']());}};_0x3baabc(++_0x127968);}(_0xefa8,0x17e));var _0x8efa=function(_0x20f049,_0x280faa){_0x20f049=_0x20f049-0x0;var _0x1f3188=_0xefa8[_0x20f049];return _0x1f3188;};'use strict';var _=require(_0x8efa('0x0'));var util=require('util');var moment=require(_0x8efa('0x1'));var BPromise=require(_0x8efa('0x2'));var rs=require(_0x8efa('0x3'));var fs=require('fs');var Redis=require(_0x8efa('0x4'));var db=require(_0x8efa('0x5'))['db'];var utils=require(_0x8efa('0x6'));var logger=require(_0x8efa('0x7'))(_0x8efa('0x8'));var config=require('../../config/environment');var jayson=require(_0x8efa('0x9'));var client=jayson[_0x8efa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1616ae,_0x331535,_0x4689e3){return new BPromise(function(_0x5bad52,_0xd413b){return client[_0x8efa('0xb')](_0x1616ae,_0x4689e3)[_0x8efa('0xc')](function(_0x3a38b3){logger[_0x8efa('0xd')](_0x8efa('0xe'),_0x331535,'request\x20sent');logger[_0x8efa('0xf')](_0x8efa('0x10'),_0x331535,_0x8efa('0x11'),JSON[_0x8efa('0x12')](_0x3a38b3));if(_0x3a38b3['error']){if(_0x3a38b3[_0x8efa('0x13')][_0x8efa('0x14')]===0x1f4){logger[_0x8efa('0x13')](_0x8efa('0xe'),_0x331535,_0x3a38b3[_0x8efa('0x13')][_0x8efa('0x15')]);return _0xd413b(_0x3a38b3['error'][_0x8efa('0x15')]);}logger[_0x8efa('0x13')](_0x8efa('0xe'),_0x331535,_0x3a38b3[_0x8efa('0x13')][_0x8efa('0x15')]);return _0x5bad52(_0x3a38b3['error']['message']);}else{logger[_0x8efa('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x331535,_0x8efa('0x11'));_0x5bad52(_0x3a38b3[_0x8efa('0x16')][_0x8efa('0x15')]);}})[_0x8efa('0x17')](function(_0x2ecdf7){logger[_0x8efa('0x13')](_0x8efa('0xe'),_0x331535,_0x2ecdf7);_0xd413b(_0x2ecdf7);});});}exports[_0x8efa('0x18')]=function(_0x635071){var _0x386e39=this;return new Promise(function(_0x3f873e,_0x10e879){return db[_0x8efa('0x19')][_0x8efa('0x1a')]({'raw':_0x635071[_0x8efa('0x1b')]?_0x635071[_0x8efa('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x635071[_0x8efa('0x1b')]?_0x635071[_0x8efa('0x1b')][_0x8efa('0x1c')]||null:null,'attributes':_0x635071[_0x8efa('0x1b')]?_0x635071[_0x8efa('0x1b')][_0x8efa('0x1d')]||null:null,'limit':_0x635071[_0x8efa('0x1b')]?_0x635071['options'][_0x8efa('0x1e')]||null:null,'include':_0x635071[_0x8efa('0x1b')]?_0x635071[_0x8efa('0x1b')][_0x8efa('0x1f')]?_['map'](_0x635071[_0x8efa('0x1b')][_0x8efa('0x1f')],function(_0x572af7){return{'model':db[_0x572af7[_0x8efa('0x20')]],'as':_0x572af7['as'],'attributes':_0x572af7[_0x8efa('0x1d')],'include':_0x572af7[_0x8efa('0x1f')]?_[_0x8efa('0x21')](_0x572af7[_0x8efa('0x1f')],function(_0x1b578e){return{'model':db[_0x1b578e[_0x8efa('0x20')]],'as':_0x1b578e['as'],'attributes':_0x1b578e[_0x8efa('0x1d')],'include':_0x1b578e[_0x8efa('0x1f')]?_[_0x8efa('0x21')](_0x1b578e[_0x8efa('0x1f')],function(_0xc8c00f){return{'model':db[_0xc8c00f[_0x8efa('0x20')]],'as':_0xc8c00f['as'],'attributes':_0xc8c00f[_0x8efa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8efa('0xc')](function(_0x46c9df){logger['info'](_0x8efa('0x18'),_0x635071);logger[_0x8efa('0xf')](_0x8efa('0x18'),_0x635071,JSON[_0x8efa('0x12')](_0x46c9df));_0x3f873e(_0x46c9df);})['catch'](function(_0x195648){logger[_0x8efa('0x13')]('GetCmHopperBlack',_0x195648[_0x8efa('0x15')],_0x635071);_0x10e879(_0x386e39[_0x8efa('0x13')](0x1f4,_0x195648[_0x8efa('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x52d7c7){var _0x9abffa=this;return new Promise(function(_0x3f7139,_0x225494){return db['CmHopperBlack'][_0x8efa('0x22')](_0x52d7c7['body'],{'raw':_0x52d7c7[_0x8efa('0x1b')]?_0x52d7c7['options'][_0x8efa('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d7c7[_0x8efa('0x1b')]?_0x52d7c7[_0x8efa('0x1b')][_0x8efa('0x1c')]||null:null,'attributes':_0x52d7c7[_0x8efa('0x1b')]?_0x52d7c7[_0x8efa('0x1b')][_0x8efa('0x1d')]||null:null,'limit':_0x52d7c7[_0x8efa('0x1b')]?_0x52d7c7[_0x8efa('0x1b')][_0x8efa('0x1e')]||null:null})[_0x8efa('0xc')](function(_0x126e12){logger[_0x8efa('0xd')](_0x8efa('0x24'),_0x52d7c7);logger[_0x8efa('0xf')]('UpdateCmHopperBlack',_0x52d7c7,JSON[_0x8efa('0x12')](_0x126e12));_0x3f7139(_0x126e12);})[_0x8efa('0x17')](function(_0x5e7463){logger['error'](_0x8efa('0x24'),_0x5e7463[_0x8efa('0x15')],_0x52d7c7);_0x225494(_0x9abffa[_0x8efa('0x13')](0x1f4,_0x5e7463['message']));});});};exports[_0x8efa('0x25')]=function(_0x507bb4){var _0x4eeceb=this;return new Promise(function(_0x4417e4,_0x9dd8e8){return db['CmHopperBlack'][_0x8efa('0x26')]({'where':_0x507bb4[_0x8efa('0x1b')]?_0x507bb4[_0x8efa('0x1b')]['where']||null:null})[_0x8efa('0xc')](function(_0x273929){logger[_0x8efa('0xd')]('DestroyCmHopperBlack',_0x507bb4);logger['debug'](_0x8efa('0x25'),_0x507bb4,JSON[_0x8efa('0x12')](_0x273929));_0x4417e4(_0x273929);})[_0x8efa('0x17')](function(_0x5a5861){logger[_0x8efa('0x13')](_0x8efa('0x25'),_0x5a5861[_0x8efa('0x15')],_0x507bb4);_0x9dd8e8(_0x4eeceb['error'](0x1f4,_0x5a5861[_0x8efa('0x15')]));});});}; \ No newline at end of file +var _0x1a33=['update','raw','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','limit','include','map','model'];(function(_0x36817b,_0x2b3388){var _0x5bf1ac=function(_0x1c62c0){while(--_0x1c62c0){_0x36817b['push'](_0x36817b['shift']());}};_0x5bf1ac(++_0x2b3388);}(_0x1a33,0x15b));var _0x31a3=function(_0x162c67,_0x5486e1){_0x162c67=_0x162c67-0x0;var _0x25e34d=_0x1a33[_0x162c67];return _0x25e34d;};'use strict';var _=require(_0x31a3('0x0'));var util=require('util');var moment=require(_0x31a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x31a3('0x2'));var fs=require('fs');var Redis=require(_0x31a3('0x3'));var db=require(_0x31a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31a3('0x5'))(_0x31a3('0x6'));var config=require(_0x31a3('0x7'));var jayson=require(_0x31a3('0x8'));var client=jayson[_0x31a3('0x9')][_0x31a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbbd206,_0xb35d0e,_0x300ff1){return new BPromise(function(_0x4ec6e8,_0x3adebb){return client[_0x31a3('0xb')](_0xbbd206,_0x300ff1)[_0x31a3('0xc')](function(_0x15d46b){logger['info'](_0x31a3('0xd'),_0xb35d0e,'request\x20sent');logger[_0x31a3('0xe')](_0x31a3('0xf'),_0xb35d0e,_0x31a3('0x10'),JSON[_0x31a3('0x11')](_0x15d46b));if(_0x15d46b['error']){if(_0x15d46b[_0x31a3('0x12')][_0x31a3('0x13')]===0x1f4){logger[_0x31a3('0x12')](_0x31a3('0xd'),_0xb35d0e,_0x15d46b[_0x31a3('0x12')][_0x31a3('0x14')]);return _0x3adebb(_0x15d46b[_0x31a3('0x12')][_0x31a3('0x14')]);}logger[_0x31a3('0x12')](_0x31a3('0xd'),_0xb35d0e,_0x15d46b[_0x31a3('0x12')][_0x31a3('0x14')]);return _0x4ec6e8(_0x15d46b[_0x31a3('0x12')][_0x31a3('0x14')]);}else{logger[_0x31a3('0x15')](_0x31a3('0xd'),_0xb35d0e,_0x31a3('0x10'));_0x4ec6e8(_0x15d46b[_0x31a3('0x16')][_0x31a3('0x14')]);}})[_0x31a3('0x17')](function(_0x59e7bf){logger['error'](_0x31a3('0xd'),_0xb35d0e,_0x59e7bf);_0x3adebb(_0x59e7bf);});});}exports[_0x31a3('0x18')]=function(_0x1b8679){var _0x438943=this;return new Promise(function(_0x1898b3,_0x2b9938){return db[_0x31a3('0x19')][_0x31a3('0x1a')]({'raw':_0x1b8679['options']?_0x1b8679[_0x31a3('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1b8679[_0x31a3('0x1b')]?_0x1b8679['options']['where']||null:null,'attributes':_0x1b8679['options']?_0x1b8679[_0x31a3('0x1b')][_0x31a3('0x1c')]||null:null,'limit':_0x1b8679[_0x31a3('0x1b')]?_0x1b8679[_0x31a3('0x1b')][_0x31a3('0x1d')]||null:null,'include':_0x1b8679['options']?_0x1b8679[_0x31a3('0x1b')][_0x31a3('0x1e')]?_[_0x31a3('0x1f')](_0x1b8679[_0x31a3('0x1b')][_0x31a3('0x1e')],function(_0x1889a7){return{'model':db[_0x1889a7[_0x31a3('0x20')]],'as':_0x1889a7['as'],'attributes':_0x1889a7['attributes'],'include':_0x1889a7[_0x31a3('0x1e')]?_['map'](_0x1889a7[_0x31a3('0x1e')],function(_0x5bc054){return{'model':db[_0x5bc054[_0x31a3('0x20')]],'as':_0x5bc054['as'],'attributes':_0x5bc054[_0x31a3('0x1c')],'include':_0x5bc054[_0x31a3('0x1e')]?_['map'](_0x5bc054[_0x31a3('0x1e')],function(_0x2b82aa){return{'model':db[_0x2b82aa[_0x31a3('0x20')]],'as':_0x2b82aa['as'],'attributes':_0x2b82aa[_0x31a3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x31a3('0xc')](function(_0x8b2531){logger['info'](_0x31a3('0x18'),_0x1b8679);logger[_0x31a3('0xe')](_0x31a3('0x18'),_0x1b8679,JSON[_0x31a3('0x11')](_0x8b2531));_0x1898b3(_0x8b2531);})['catch'](function(_0x2d195a){logger[_0x31a3('0x12')](_0x31a3('0x18'),_0x2d195a[_0x31a3('0x14')],_0x1b8679);_0x2b9938(_0x438943[_0x31a3('0x12')](0x1f4,_0x2d195a['message']));});});};exports['UpdateCmHopperBlack']=function(_0x4afa7a){var _0x5ec285=this;return new Promise(function(_0x1c8a4a,_0x23b2e4){return db[_0x31a3('0x19')][_0x31a3('0x21')](_0x4afa7a['body'],{'raw':_0x4afa7a[_0x31a3('0x1b')]?_0x4afa7a[_0x31a3('0x1b')][_0x31a3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4afa7a[_0x31a3('0x1b')]?_0x4afa7a['options']['where']||null:null,'attributes':_0x4afa7a['options']?_0x4afa7a[_0x31a3('0x1b')][_0x31a3('0x1c')]||null:null,'limit':_0x4afa7a[_0x31a3('0x1b')]?_0x4afa7a['options'][_0x31a3('0x1d')]||null:null})[_0x31a3('0xc')](function(_0x47db1e){logger['info']('UpdateCmHopperBlack',_0x4afa7a);logger[_0x31a3('0xe')]('UpdateCmHopperBlack',_0x4afa7a,JSON[_0x31a3('0x11')](_0x47db1e));_0x1c8a4a(_0x47db1e);})[_0x31a3('0x17')](function(_0x5b1e8e){logger[_0x31a3('0x12')](_0x31a3('0x23'),_0x5b1e8e['message'],_0x4afa7a);_0x23b2e4(_0x5ec285['error'](0x1f4,_0x5b1e8e[_0x31a3('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x52152f){var _0x4def02=this;return new Promise(function(_0x614bce,_0xd096e8){return db[_0x31a3('0x19')][_0x31a3('0x24')]({'where':_0x52152f[_0x31a3('0x1b')]?_0x52152f[_0x31a3('0x1b')]['where']||null:null})[_0x31a3('0xc')](function(_0x4c7ac0){logger['info'](_0x31a3('0x25'),_0x52152f);logger[_0x31a3('0xe')](_0x31a3('0x25'),_0x52152f,JSON[_0x31a3('0x11')](_0x4c7ac0));_0x614bce(_0x4c7ac0);})['catch'](function(_0x31f5a8){logger['error'](_0x31a3('0x25'),_0x31f5a8[_0x31a3('0x14')],_0x52152f);_0xd096e8(_0x4def02['error'](0x1f4,_0x31f5a8[_0x31a3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 39f933c..b3ee784 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 _0xaa3f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x49c615,_0x4fe7a1){var _0xd39352=function(_0x23b1b6){while(--_0x23b1b6){_0x49c615['push'](_0x49c615['shift']());}};_0xd39352(++_0x4fe7a1);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x58b666,_0x233adc){_0x58b666=_0x58b666-0x0;var _0x47bbbb=_0xaa3f[_0x58b666];return _0x47bbbb;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x11')]);router[_0xfaa3('0x12')](_0xfaa3('0xe'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x13')]);module[_0xfaa3('0x14')]=router; \ No newline at end of file +var _0x741c=['get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x4bb10c,_0x2ecb01){var _0x18ad3f=function(_0x13388d){while(--_0x13388d){_0x4bb10c['push'](_0x4bb10c['shift']());}};_0x18ad3f(++_0x2ecb01);}(_0x741c,0x196));var _0xc741=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x741c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['put']('/:id',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);module[_0xc741('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8069268..5e8c59e 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 _0x5664=['followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x5c6828,_0x2604a9){var _0x274aab=function(_0x1b598b){while(--_0x1b598b){_0x5c6828['push'](_0x5c6828['shift']());}};_0x274aab(++_0x2604a9);}(_0x5664,0xfb));var _0x4566=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x5664[_0x54b283];return _0x2462b3;};'use strict';var Sequelize=require(_0x4566('0x0'));var moment=require(_0x4566('0x1'));module[_0x4566('0x2')]={'state':{'type':Sequelize[_0x4566('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4566('0x4')]},'originatecalleridname':{'type':Sequelize[_0x4566('0x4')]},'calleridnum':{'type':Sequelize[_0x4566('0x4')]},'calleridname':{'type':Sequelize[_0x4566('0x4')]},'starttime':{'type':Sequelize[_0x4566('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x4566('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4566('0x4')]},'campaign':{'type':Sequelize[_0x4566('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4566('0x4')]},'reason':{'type':Sequelize[_0x4566('0x4')]},'disposition':{'type':Sequelize[_0x4566('0x4')]},'secondDisposition':{'type':Sequelize[_0x4566('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4566('0x4')]},'dispositionat':{'type':Sequelize[_0x4566('0x5')],'set':function(_0x4ff51d){var _0x4f30de=this[_0x4566('0x6')](_0x4566('0x7'));if(_0x4f30de&&_0x4ff51d){this[_0x4566('0x8')](_0x4566('0x9'),moment(_0x4ff51d)[_0x4566('0xa')](moment(_0x4f30de),'seconds'));}return this[_0x4566('0x8')](_0x4566('0xb'),_0x4ff51d);}},'amd':{'type':Sequelize[_0x4566('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4566('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4566('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4566('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4566('0x5')]},'callback':{'type':Sequelize[_0x4566('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4566('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4566('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4566('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b24=['moment','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','BOOLEAN'];(function(_0x40955e,_0x5abf6a){var _0x242682=function(_0x31b5d1){while(--_0x31b5d1){_0x40955e['push'](_0x40955e['shift']());}};_0x242682(++_0x5abf6a);}(_0x9b24,0x19a));var _0x49b2=function(_0x58b142,_0x3e4145){_0x58b142=_0x58b142-0x0;var _0x545397=_0x9b24[_0x58b142];return _0x545397;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x49b2('0x0'));module[_0x49b2('0x1')]={'state':{'type':Sequelize[_0x49b2('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x49b2('0x3')]},'countbusyretry':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x49b2('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x49b2('0x4')]},'originatecalleridname':{'type':Sequelize[_0x49b2('0x4')]},'calleridnum':{'type':Sequelize[_0x49b2('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x49b2('0x3')]},'answertime':{'type':Sequelize[_0x49b2('0x3')]},'droptime':{'type':Sequelize[_0x49b2('0x3')]},'endtime':{'type':Sequelize[_0x49b2('0x3')]},'ringtime':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x49b2('0x4')]},'campaigntype':{'type':Sequelize[_0x49b2('0x4')]},'membername':{'type':Sequelize[_0x49b2('0x4')]},'reason':{'type':Sequelize[_0x49b2('0x4')]},'disposition':{'type':Sequelize[_0x49b2('0x4')]},'secondDisposition':{'type':Sequelize[_0x49b2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x49b2('0x3')],'set':function(_0x3115d6){var _0x170948=this[_0x49b2('0x5')](_0x49b2('0x6'));if(_0x170948&&_0x3115d6){this[_0x49b2('0x7')](_0x49b2('0x8'),moment(_0x3115d6)['diff'](moment(_0x170948),'seconds'));}return this['setDataValue']('dispositionat',_0x3115d6);}},'amd':{'type':Sequelize[_0x49b2('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x49b2('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x49b2('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x49b2('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x49b2('0x3')]},'callback':{'type':Sequelize[_0x49b2('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x49b2('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x49b2('0x3')]},'deleted':{'type':Sequelize[_0x49b2('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x49b2('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x49b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index ab57ba3..6d9963e 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 _0xc1c6=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x152f6f,_0xf0194d){_0x152f6f=_0x152f6f-0x0;var _0x24077b=_0xc1c6[_0x152f6f];return _0x24077b;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['CmHopperFinal'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,null));}; \ No newline at end of file +var _0xf494=['find','describe','body','uniqueid','params','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','COUNT','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','ANY_VALUE(calleridnum)','field','NOW()','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','rows','catch','length'];(function(_0x1bc915,_0x10a345){var _0x174788=function(_0x1abbeb){while(--_0x1abbeb){_0x1bc915['push'](_0x1bc915['shift']());}};_0x174788(++_0x10a345);}(_0xf494,0x1c6));var _0x4f49=function(_0x424b64,_0x8463ed){_0x424b64=_0x424b64-0x0;var _0x2d9679=_0xf494[_0x424b64];return _0x2d9679;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}exports[_0x4f49('0x29')]=function(_0x2c00ee,_0x605c91){var _0x560050={},_0x3cbfbd={},_0x206203={'count':0x0,'rows':[]};var _0x43d8e3=_['map'](db['CmHopperFinal'][_0x4f49('0x2a')],function(_0x27d004){return{'name':_0x27d004[_0x4f49('0x2b')],'type':_0x27d004['type'][_0x4f49('0x2c')]};});_0x3cbfbd[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x43d8e3,_0x4f49('0x28'));_0x3cbfbd[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x2c00ee[_0x4f49('0x2f')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],_0x3cbfbd[_0x4f49('0x2f')]);_0x560050[_0x4f49('0x33')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x34')]));_0x560050[_0x4f49('0x33')]=_0x560050[_0x4f49('0x33')]['length']?_0x560050[_0x4f49('0x33')]:_0x3cbfbd[_0x4f49('0x2d')];if(!_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x35')](_0x4f49('0x36'))){_0x560050[_0x4f49('0x1f')]=qs[_0x4f49('0x1f')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1f')]);_0x560050[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1d')]);}_0x560050['order']=qs[_0x4f49('0x37')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x37')]);_0x560050[_0x4f49('0x38')]=qs[_0x4f49('0x31')](_[_0x4f49('0x39')](_0x2c00ee[_0x4f49('0x2f')],_0x3cbfbd[_0x4f49('0x31')]),_0x43d8e3);if(_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x3a')]){_0x560050[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0x560050[_0x4f49('0x38')],{'$or':_[_0x4f49('0x2e')](_0x43d8e3,function(_0x4e3f72){if(_0x4e3f72[_0x4f49('0x3c')]!==_0x4f49('0x3d')){var _0x543605={};_0x543605[_0x4e3f72[_0x4f49('0x28')]]={'$like':'%'+_0x2c00ee[_0x4f49('0x2f')]['filter']+'%'};return _0x543605;}})});}_0x560050=_[_0x4f49('0x3b')]({},_0x560050,_0x2c00ee[_0x4f49('0x3e')]);var _0x2548ad={'where':_0x560050[_0x4f49('0x38')]};return db[_0x4f49('0x3f')][_0x4f49('0x20')](_0x2548ad)[_0x4f49('0x25')](function(_0x5d464e){_0x206203['count']=_0x5d464e;if(_0x2c00ee['query'][_0x4f49('0x40')]){_0x560050[_0x4f49('0x41')]=[{'all':!![]}];}return db[_0x4f49('0x3f')][_0x4f49('0x42')](_0x560050);})[_0x4f49('0x25')](function(_0x1ecf6c){_0x206203[_0x4f49('0x43')]=_0x1ecf6c;return _0x206203;})[_0x4f49('0x25')](respondWithFilteredResult(_0x605c91,_0x560050))[_0x4f49('0x44')](handleError(_0x605c91,null));};exports['show']=function(_0x5238a3,_0x412395){var _0x432b5d={'raw':!![],'where':{'id':_0x5238a3['params']['id']}},_0x159642={};_0x159642[_0x4f49('0x2d')]=_['keys'](db['CmHopperFinal'][_0x4f49('0x2a')]);_0x159642[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x5238a3['query']);_0x159642[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x159642['model'],_0x159642[_0x4f49('0x2f')]);_0x432b5d['attributes']=_[_0x4f49('0x32')](_0x159642[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x5238a3['query'][_0x4f49('0x34')]));_0x432b5d[_0x4f49('0x33')]=_0x432b5d[_0x4f49('0x33')][_0x4f49('0x45')]?_0x432b5d[_0x4f49('0x33')]:_0x159642[_0x4f49('0x2d')];if(_0x5238a3[_0x4f49('0x2f')][_0x4f49('0x40')]){_0x432b5d[_0x4f49('0x41')]=[{'all':!![]}];}_0x432b5d=_[_0x4f49('0x3b')]({},_0x432b5d,_0x5238a3['options']);return db[_0x4f49('0x3f')][_0x4f49('0x46')](_0x432b5d)['then'](handleEntityNotFound(_0x412395,null))[_0x4f49('0x25')](respondWithResult(_0x412395,null))['catch'](handleError(_0x412395,null));};exports[_0x4f49('0x47')]=function(_0x41c580,_0x2d3dcd){return db[_0x4f49('0x3f')]['describe']()[_0x4f49('0x25')](respondWithResult(_0x2d3dcd,null))[_0x4f49('0x44')](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x24')]=function(_0x973099,_0x3ec266){if(_0x973099[_0x4f49('0x48')][_0x4f49('0x49')]){delete _0x973099[_0x4f49('0x48')][_0x4f49('0x49')];}return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'uniqueid':_0x973099[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x3ec266,null))[_0x4f49('0x25')](saveUpdates(_0x973099[_0x4f49('0x48')],null))[_0x4f49('0x25')](respondWithResult(_0x3ec266,null))['catch'](handleError(_0x3ec266,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xce5121,_0x197670,_0x36bcc2){return db[_0x4f49('0x3f')][_0x4f49('0x42')]({'raw':![],'where':{'VoiceQueueId':_0xce5121[_0x4f49('0x4a')]['id']},'attributes':[[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x4d')))),_0x4f49('0x4e')],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x4f49('0x4f')))),_0x4f49('0x50')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x52')))),'busyContacts'],[db[_0x4f49('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4f49('0x4b')]['literal'](_0x4f49('0x53')))),'congestionContacts'],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x54')))),_0x4f49('0x55')],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x56')))),_0x4f49('0x57')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x59')))),'answeringMachine']]})[_0x4f49('0x25')](handleEntityNotFound(_0x197670,null))['then'](respondWithResult(_0x197670,null))[_0x4f49('0x44')](handleError(_0x197670,null));};exports[_0x4f49('0x5a')]=function(_0x2a2b0d,_0x4aae7c,_0x1dade6){return db[_0x4f49('0x3f')][_0x4f49('0x42')]({'raw':![],'where':{'CampaignId':_0x2a2b0d[_0x4f49('0x4a')]['id']},'attributes':[[db['sequelize']['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize'][_0x4f49('0x4c')](_0x4f49('0x4d')))),_0x4f49('0x4e')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0x4f49('0x50')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x52')))),'busyContacts'],[db[_0x4f49('0x4b')]['fn']('COUNT',db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x53')))),_0x4f49('0x5b')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4f49('0x55')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x4f49('0x56')))),'abandonedContacts'],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x58')))),_0x4f49('0x5c')],[db[_0x4f49('0x4b')]['fn'](_0x4f49('0x51'),db[_0x4f49('0x4b')]['fn']('IF',db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x4f49('0x59')))),_0x4f49('0x5d')]]})[_0x4f49('0x25')](handleEntityNotFound(_0x4aae7c,null))[_0x4f49('0x25')](respondWithResult(_0x4aae7c,null))[_0x4f49('0x44')](handleError(_0x4aae7c,null));};exports[_0x4f49('0x5e')]=function(_0x1f9161,_0x1434ea,_0x2c3962){return db[_0x4f49('0x5f')][_0x4f49('0x46')]({'where':{'id':_0x1f9161[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x3e9460){var _0x4ff0c1;if(_0x3e9460){_0x4ff0c1=squel[_0x4f49('0x60')]()[_0x4f49('0x61')](_0x4f49('0x62'))[_0x4f49('0x63')]([_0x4f49('0x64'),_0x4f49('0x65'),_0x4f49('0x66'),_0x4f49('0x67'),_0x4f49('0x68'),'createdAt','updatedAt'],squel[_0x4f49('0x69')]()['field'](_0x4f49('0x6a'),_0x4f49('0x64'))[_0x4f49('0x6b')](_0x4f49('0x6c'),_0x4f49('0x65'))['field']('ANY_VALUE(ContactId)',_0x4f49('0x66'))[_0x4f49('0x6b')]('ANY_VALUE(ListId)',_0x4f49('0x67'))[_0x4f49('0x6b')]('ANY_VALUE(VoiceQueueId)',_0x4f49('0x68'))['field'](_0x4f49('0x6c'),_0x4f49('0x6d'))['field'](_0x4f49('0x6c'),_0x4f49('0x6e'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x71'),_0x1f9161['params']['id'][_0x4f49('0x72')]())['where'](_0x4f49('0x73'),_0x1f9161['body'][_0x4f49('0x74')]['toString']())[_0x4f49('0x38')](_0x4f49('0x75'))[_0x4f49('0x38')](_0x4f49('0x76'),squel['select']()[_0x4f49('0x6b')]('phone')[_0x4f49('0x6f')]('cm_hopper')[_0x4f49('0x38')]('VoiceQueueId\x20=\x20?',_0x1f9161['params']['id'][_0x4f49('0x72')]()))[_0x4f49('0x38')](_0x4f49('0x76'),squel['select']()[_0x4f49('0x6b')](_0x4f49('0x77'))['from']('cm_hopper_final')['where'](_0x4f49('0x71'),_0x1f9161[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]())[_0x4f49('0x38')](_0x4f49('0x78')))['group'](_0x4f49('0x66')))[_0x4f49('0x72')]();return db[_0x4f49('0x4b')]['query'](_0x4ff0c1);}return[];})[_0x4f49('0x25')](respondWithResult(_0x1434ea,null))[_0x4f49('0x44')](handleError(_0x1434ea,null));};exports[_0x4f49('0x79')]=function(_0x2902a1,_0x5ea6b4,_0x249799){return db[_0x4f49('0x7a')][_0x4f49('0x46')]({'where':{'id':_0x2902a1[_0x4f49('0x4a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x5ea6b4,null))['then'](function(_0x2409a8){var _0x32539c;if(_0x2409a8){_0x32539c=squel['insert']()[_0x4f49('0x61')]('cm_hopper')[_0x4f49('0x63')](['phone',_0x4f49('0x65'),_0x4f49('0x66'),_0x4f49('0x67'),_0x4f49('0x7b'),_0x4f49('0x6d'),'updatedAt'],squel[_0x4f49('0x69')]()[_0x4f49('0x6b')](_0x4f49('0x6a'),_0x4f49('0x64'))['field'](_0x4f49('0x6c'),'scheduledAt')[_0x4f49('0x6b')]('ANY_VALUE(ContactId)',_0x4f49('0x66'))[_0x4f49('0x6b')](_0x4f49('0x7c'),_0x4f49('0x67'))[_0x4f49('0x6b')](_0x4f49('0x7d'),_0x4f49('0x7b'))[_0x4f49('0x6b')](_0x4f49('0x6c'),_0x4f49('0x6d'))['field'](_0x4f49('0x6c'),_0x4f49('0x6e'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1['params']['id'][_0x4f49('0x72')]())[_0x4f49('0x38')](_0x4f49('0x73'),_0x2902a1[_0x4f49('0x48')]['state'][_0x4f49('0x72')]())['where'](_0x4f49('0x75'))[_0x4f49('0x38')](_0x4f49('0x76'),squel[_0x4f49('0x69')]()['field'](_0x4f49('0x64'))[_0x4f49('0x6f')](_0x4f49('0x62'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]()))[_0x4f49('0x38')](_0x4f49('0x76'),squel[_0x4f49('0x69')]()[_0x4f49('0x6b')](_0x4f49('0x77'))[_0x4f49('0x6f')](_0x4f49('0x70'))[_0x4f49('0x38')](_0x4f49('0x7e'),_0x2902a1[_0x4f49('0x4a')]['id'][_0x4f49('0x72')]())['where'](_0x4f49('0x78')))[_0x4f49('0x7f')](_0x4f49('0x66')))[_0x4f49('0x72')]();return db['sequelize'][_0x4f49('0x2f')](_0x32539c);}return[];})[_0x4f49('0x25')](respondWithResult(_0x5ea6b4,null))['catch'](handleError(_0x5ea6b4,null));};exports[_0x4f49('0x80')]=function(_0x57c86c,_0xf6bc4c,_0x3bc245){return db[_0x4f49('0x81')][_0x4f49('0x82')]({'where':{'VoiceQueueId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x68')],'CampaignId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x7b')],'ContactId':_0x57c86c[_0x4f49('0x48')][_0x4f49('0x66')]}})['then'](handleEntityNotFound(_0xf6bc4c,null))['then'](function(_0x32b4b4){if(_0x32b4b4){return _0x32b4b4;}return null;})['then'](respondWithResult(_0xf6bc4c,null))[_0x4f49('0x44')](handleError(_0xf6bc4c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ec99653..16fc135 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 _0xe5e4=['uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0xdd4f11,_0x274420){var _0x50a0a1=function(_0x3fc1f7){while(--_0x3fc1f7){_0xdd4f11['push'](_0xdd4f11['shift']());}};_0x50a0a1(++_0x274420);}(_0xe5e4,0x97));var _0x4e5e=function(_0x9215e2,_0x227699){_0x9215e2=_0x9215e2-0x0;var _0x135e0b=_0xe5e4[_0x9215e2];return _0x135e0b;};'use strict';var _=require(_0x4e5e('0x0'));var util=require(_0x4e5e('0x1'));var logger=require('../../config/logger')(_0x4e5e('0x2'));var moment=require(_0x4e5e('0x3'));var BPromise=require(_0x4e5e('0x4'));var rp=require(_0x4e5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e5e('0x6'));var config=require(_0x4e5e('0x7'));var attributes=require(_0x4e5e('0x8'));module[_0x4e5e('0x9')]=function(_0x4c6b98,_0x3089a8){return _0x4c6b98[_0x4e5e('0xa')](_0x4e5e('0xb'),attributes,{'tableName':_0x4e5e('0xc'),'paranoid':![],'indexes':[{'name':_0x4e5e('0xd'),'fields':[_0x4e5e('0xd')]},{'name':'uniqueid','fields':[_0x4e5e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1225=['exports','define','cm_hopper_final','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes'];(function(_0x407ea5,_0x542a5a){var _0x46ec22=function(_0x2a4bae){while(--_0x2a4bae){_0x407ea5['push'](_0x407ea5['shift']());}};_0x46ec22(++_0x542a5a);}(_0x1225,0x122));var _0x5122=function(_0x4fbbe5,_0x141905){_0x4fbbe5=_0x4fbbe5-0x0;var _0x54b708=_0x1225[_0x4fbbe5];return _0x54b708;};'use strict';var _=require(_0x5122('0x0'));var util=require(_0x5122('0x1'));var logger=require(_0x5122('0x2'))(_0x5122('0x3'));var moment=require('moment');var BPromise=require(_0x5122('0x4'));var rp=require(_0x5122('0x5'));var fs=require('fs');var path=require(_0x5122('0x6'));var rimraf=require('rimraf');var config=require(_0x5122('0x7'));var attributes=require(_0x5122('0x8'));module[_0x5122('0x9')]=function(_0x2891bc,_0x118b9c){return _0x2891bc[_0x5122('0xa')]('CmHopperFinal',attributes,{'tableName':_0x5122('0xb'),'paranoid':![],'indexes':[{'name':_0x5122('0xc'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d935a3d..2f55951 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(_0x36e769,_0xf44847){var _0x3b4317=function(_0x22e069){while(--_0x22e069){_0x36e769['push'](_0x36e769['shift']());}};_0x3b4317(++_0xf44847);}(_0xb10b,0x12a));var _0xbb10=function(_0x490cd3,_0x97d5ee){_0x490cd3=_0x490cd3-0x0;var _0x3320d7=_0xb10b[_0x490cd3];return _0x3320d7;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x86dbdc,_0x31693b){var _0x42c1fd=function(_0x1c9cd9){while(--_0x1c9cd9){_0x86dbdc['push'](_0x86dbdc['shift']());}};_0x42c1fd(++_0x31693b);}(_0xb10b,0x12a));var _0xbb10=function(_0x284174,_0x1dd400){_0x284174=_0x284174-0x0;var _0x58b7fb=_0xb10b[_0x284174];return _0x58b7fb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index a731e63..b51fdc4 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 _0x434b=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','path'];(function(_0x323920,_0x389e2f){var _0x514756=function(_0x5c70d3){while(--_0x5c70d3){_0x323920['push'](_0x323920['shift']());}};_0x514756(++_0x389e2f);}(_0x434b,0x17f));var _0xb434=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0x434b[_0x309d93];return _0x2dd61d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb434('0x0'));var timeout=require(_0xb434('0x1'));var express=require('express');var router=express[_0xb434('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb434('0x3'));var interaction=require(_0xb434('0x4'));var config=require(_0xb434('0x5'));var controller=require(_0xb434('0x6'));router[_0xb434('0x7')]('/',auth[_0xb434('0x8')](),controller[_0xb434('0x9')]);router[_0xb434('0x7')](_0xb434('0xa'),auth['isAuthenticated'](),controller[_0xb434('0xb')]);router[_0xb434('0x7')](_0xb434('0xc'),auth[_0xb434('0x8')](),controller[_0xb434('0xd')]);router[_0xb434('0x7')](_0xb434('0xe'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xb434('0x7')](_0xb434('0xf'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xb434('0x10')](_0xb434('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb434('0x10')](_0xb434('0x12'),auth['isAuthenticated'](),controller[_0xb434('0x13')]);router[_0xb434('0x10')](_0xb434('0x14'),auth[_0xb434('0x8')](),controller[_0xb434('0x15')]);router[_0xb434('0x16')](_0xb434('0xc'),auth[_0xb434('0x8')](),controller['update']);module[_0xb434('0x17')]=router; \ No newline at end of file +var _0xdd2e=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','put','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x27fce6,_0x5ea6b1){var _0x2cd0ab=function(_0x436043){while(--_0x436043){_0x27fce6['push'](_0x27fce6['shift']());}};_0x2cd0ab(++_0x5ea6b1);}(_0xdd2e,0x13d));var _0xedd2=function(_0x2e3ad4,_0x3dd195){_0x2e3ad4=_0x2e3ad4-0x0;var _0x3f217c=_0xdd2e[_0x2e3ad4];return _0x3f217c;};'use strict';var multer=require(_0xedd2('0x0'));var util=require(_0xedd2('0x1'));var path=require('path');var timeout=require(_0xedd2('0x2'));var express=require(_0xedd2('0x3'));var router=express['Router']();var fs_extra=require(_0xedd2('0x4'));var auth=require(_0xedd2('0x5'));var interaction=require(_0xedd2('0x6'));var config=require(_0xedd2('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xedd2('0x8')](),controller[_0xedd2('0x9')]);router[_0xedd2('0xa')](_0xedd2('0xb'),auth[_0xedd2('0x8')](),controller[_0xedd2('0xc')]);router[_0xedd2('0xa')]('/:id',auth[_0xedd2('0x8')](),controller['show']);router[_0xedd2('0xa')](_0xedd2('0xd'),auth[_0xedd2('0x8')](),controller[_0xedd2('0xe')]);router[_0xedd2('0xa')](_0xedd2('0xf'),auth[_0xedd2('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xedd2('0x10'),auth[_0xedd2('0x8')](),controller[_0xedd2('0x11')]);router[_0xedd2('0x12')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0xedd2('0x13')]);router['post']('/checkContactHopper',auth[_0xedd2('0x8')](),controller['checkContactHopper']);router[_0xedd2('0x14')]('/:id',auth[_0xedd2('0x8')](),controller['update']);module[_0xedd2('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d571949..fb6c23a 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 _0xc3b3=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x53cf36,_0x5aae4a){var _0xa10168=function(_0x5a9005){while(--_0x5a9005){_0x53cf36['push'](_0x53cf36['shift']());}};_0xa10168(++_0x5aae4a);}(_0xc3b3,0x1c0));var _0x3c3b=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xc3b3[_0x49d41c];return _0xb64c5f;};'use strict';var Sequelize=require(_0x3c3b('0x0'));module[_0x3c3b('0x1')]={'state':{'type':Sequelize[_0x3c3b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3c3b('0x3')]},'scheduledat':{'type':Sequelize[_0x3c3b('0x4')]},'countbusyretry':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3c3b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3c3b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3c3b('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3c3b('0x4')]},'droptime':{'type':Sequelize[_0x3c3b('0x4')]},'endtime':{'type':Sequelize[_0x3c3b('0x4')]},'ringtime':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3c3b('0x3')]},'campaign':{'type':Sequelize[_0x3c3b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3c3b('0x3')]},'reason':{'type':Sequelize[_0x3c3b('0x3')]},'amd':{'type':Sequelize[_0x3c3b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3c3b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3c3b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3c3b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3c3b('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x3c3b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3c3b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x45f6=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x74ec7e,_0x346a6d){var _0x53e75d=function(_0x548090){while(--_0x548090){_0x74ec7e['push'](_0x74ec7e['shift']());}};_0x53e75d(++_0x346a6d);}(_0x45f6,0xb3));var _0x645f=function(_0x389c94,_0x2a93d9){_0x389c94=_0x389c94-0x0;var _0x1455cb=_0x45f6[_0x389c94];return _0x1455cb;};'use strict';var Sequelize=require(_0x645f('0x0'));module['exports']={'state':{'type':Sequelize[_0x645f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x645f('0x2')]},'scheduledat':{'type':Sequelize[_0x645f('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x645f('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x645f('0x2')]},'originatecalleridname':{'type':Sequelize[_0x645f('0x2')]},'calleridnum':{'type':Sequelize[_0x645f('0x2')]},'calleridname':{'type':Sequelize[_0x645f('0x2')]},'starttime':{'type':Sequelize[_0x645f('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x645f('0x3')]},'droptime':{'type':Sequelize[_0x645f('0x3')]},'endtime':{'type':Sequelize[_0x645f('0x3')]},'ringtime':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x645f('0x2')]},'campaign':{'type':Sequelize[_0x645f('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x645f('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x645f('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x645f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x645f('0x3')]},'recallme':{'type':Sequelize[_0x645f('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x645f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x645f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index b630b5e..75a6c17 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 _0x3960=['limit','count','offset','Content-Range','json','apply','save','update','then','sendStatus','name','send','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','moment','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined'];(function(_0x379761,_0x5e4b81){var _0xc5a577=function(_0xaf5ce6){while(--_0xaf5ce6){_0x379761['push'](_0x379761['shift']());}};_0xc5a577(++_0x5e4b81);}(_0x3960,0x75));var _0x0396=function(_0x1dc0d9,_0x4071d6){_0x1dc0d9=_0x1dc0d9-0x0;var _0x53efe9=_0x3960[_0x1dc0d9];return _0x53efe9;};'use strict';var emlformat=require(_0x0396('0x0'));var rimraf=require(_0x0396('0x1'));var zipdir=require(_0x0396('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0396('0x3'));var BPromise=require(_0x0396('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0396('0x5'));var csv=require(_0x0396('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0396('0x7'));var _=require('lodash');var squel=require(_0x0396('0x8'));var crypto=require(_0x0396('0x9'));var jsforce=require(_0x0396('0xa'));var deskjs=require(_0x0396('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0396('0xc'));var authService=require(_0x0396('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0396('0xe'));var logger=require(_0x0396('0xf'))(_0x0396('0x10'));var utils=require(_0x0396('0x11'));var config=require(_0x0396('0x12'));var licenseUtil=require(_0x0396('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5430fa,_0x33deba){_0x33deba=_0x33deba||0xcc;return function(_0x4ca392){if(_0x4ca392){return _0x5430fa['sendStatus'](_0x33deba);}return _0x5430fa[_0x0396('0x14')](_0x33deba)[_0x0396('0x15')]();};}function respondWithResult(_0x24211c,_0x31d1c4){_0x31d1c4=_0x31d1c4||0xc8;return function(_0x211c4e){if(_0x211c4e){return _0x24211c[_0x0396('0x14')](_0x31d1c4)['json'](_0x211c4e);}};}function respondWithFilteredResult(_0x3bcad0,_0x3a7dbc){return function(_0x178af7){if(_0x178af7){var _0x37aed0=typeof _0x3a7dbc['offset']===_0x0396('0x16')&&typeof _0x3a7dbc[_0x0396('0x17')]===_0x0396('0x16');var _0x2a0ca7=_0x178af7[_0x0396('0x18')];var _0x372edc=_0x37aed0?0x0:_0x3a7dbc[_0x0396('0x19')];var _0x5b2bce=_0x37aed0?_0x178af7[_0x0396('0x18')]:_0x3a7dbc[_0x0396('0x19')]+_0x3a7dbc[_0x0396('0x17')];var _0x25f5bd;if(_0x5b2bce>=_0x2a0ca7){_0x5b2bce=_0x2a0ca7;_0x25f5bd=0xc8;}else{_0x25f5bd=0xce;}_0x3bcad0[_0x0396('0x14')](_0x25f5bd);return _0x3bcad0['set'](_0x0396('0x1a'),_0x372edc+'-'+_0x5b2bce+'/'+_0x2a0ca7)[_0x0396('0x1b')](_0x178af7);}return null;};}function patchUpdates(_0x58ae4e){return function(_0xbddafc){try{jsonpatch[_0x0396('0x1c')](_0xbddafc,_0x58ae4e,!![]);}catch(_0x38b2be){return BPromise['reject'](_0x38b2be);}return _0xbddafc[_0x0396('0x1d')]();};}function saveUpdates(_0x95bf15,_0x5e7b6b){return function(_0x1b4568){if(_0x1b4568){return _0x1b4568[_0x0396('0x1e')](_0x95bf15)['then'](function(_0x50f8e7){return _0x50f8e7;});}return null;};}function removeEntity(_0x40fe67,_0x1cdc64){return function(_0x1156a9){if(_0x1156a9){return _0x1156a9['destroy']()[_0x0396('0x1f')](function(){_0x40fe67[_0x0396('0x14')](0xcc)[_0x0396('0x15')]();});}};}function handleEntityNotFound(_0x2c9baf,_0x2bd861){return function(_0x23b889){if(!_0x23b889){_0x2c9baf[_0x0396('0x20')](0x194);}return _0x23b889;};}function handleError(_0xbe8f91,_0x4720aa){_0x4720aa=_0x4720aa||0x1f4;return function(_0x1ead36){logger['error'](_0x1ead36['stack']);if(_0x1ead36[_0x0396('0x21')]){delete _0x1ead36[_0x0396('0x21')];}_0xbe8f91[_0x0396('0x14')](_0x4720aa)[_0x0396('0x22')](_0x1ead36);};}exports['index']=function(_0x57631c,_0x40e3b6){var _0x537eaf={},_0x3eabde={},_0x40d651={'count':0x0,'rows':[]};var _0x546c5b=_[_0x0396('0x23')](db[_0x0396('0x24')][_0x0396('0x25')],function(_0x235df7){return{'name':_0x235df7[_0x0396('0x26')],'type':_0x235df7['type'][_0x0396('0x27')]};});_0x3eabde[_0x0396('0x28')]=_['map'](_0x546c5b,_0x0396('0x21'));_0x3eabde[_0x0396('0x29')]=_['keys'](_0x57631c[_0x0396('0x29')]);_0x3eabde[_0x0396('0x2a')]=_[_0x0396('0x2b')](_0x3eabde['model'],_0x3eabde[_0x0396('0x29')]);_0x537eaf[_0x0396('0x2c')]=_['intersection'](_0x3eabde[_0x0396('0x28')],qs['fields'](_0x57631c[_0x0396('0x29')][_0x0396('0x2d')]));_0x537eaf[_0x0396('0x2c')]=_0x537eaf[_0x0396('0x2c')][_0x0396('0x2e')]?_0x537eaf['attributes']:_0x3eabde[_0x0396('0x28')];if(!_0x57631c[_0x0396('0x29')][_0x0396('0x2f')](_0x0396('0x30'))){_0x537eaf['limit']=qs[_0x0396('0x17')](_0x57631c[_0x0396('0x29')][_0x0396('0x17')]);_0x537eaf[_0x0396('0x19')]=qs[_0x0396('0x19')](_0x57631c['query'][_0x0396('0x19')]);}_0x537eaf['order']=qs[_0x0396('0x31')](_0x57631c[_0x0396('0x29')]['sort']);_0x537eaf['where']=qs[_0x0396('0x2a')](_[_0x0396('0x32')](_0x57631c['query'],_0x3eabde['filters']),_0x546c5b);if(_0x57631c[_0x0396('0x29')][_0x0396('0x33')]){_0x537eaf[_0x0396('0x34')]=_[_0x0396('0x35')](_0x537eaf[_0x0396('0x34')],{'$or':_['map'](_0x546c5b,function(_0x1804d5){if(_0x1804d5[_0x0396('0x36')]!==_0x0396('0x37')){var _0x470046={};_0x470046[_0x1804d5[_0x0396('0x21')]]={'$like':'%'+_0x57631c[_0x0396('0x29')][_0x0396('0x33')]+'%'};return _0x470046;}})});}_0x537eaf=_[_0x0396('0x35')]({},_0x537eaf,_0x57631c[_0x0396('0x38')]);var _0x5011cb={'where':_0x537eaf[_0x0396('0x34')]};return db[_0x0396('0x24')][_0x0396('0x18')](_0x5011cb)[_0x0396('0x1f')](function(_0x24ebe4){_0x40d651['count']=_0x24ebe4;if(_0x57631c['query'][_0x0396('0x39')]){_0x537eaf[_0x0396('0x3a')]=[{'all':!![]}];}return db[_0x0396('0x24')][_0x0396('0x3b')](_0x537eaf);})['then'](function(_0x39b786){_0x40d651[_0x0396('0x3c')]=_0x39b786;return _0x40d651;})['then'](respondWithFilteredResult(_0x40e3b6,_0x537eaf))[_0x0396('0x3d')](handleError(_0x40e3b6,null));};exports[_0x0396('0x3e')]=function(_0x1b0d77,_0x4ead4b){var _0x5235c7={'raw':!![],'where':{'id':_0x1b0d77[_0x0396('0x3f')]['id']}},_0x4a8140={};_0x4a8140[_0x0396('0x28')]=_[_0x0396('0x40')](db[_0x0396('0x24')][_0x0396('0x25')]);_0x4a8140['query']=_[_0x0396('0x40')](_0x1b0d77[_0x0396('0x29')]);_0x4a8140[_0x0396('0x2a')]=_[_0x0396('0x2b')](_0x4a8140['model'],_0x4a8140[_0x0396('0x29')]);_0x5235c7['attributes']=_['intersection'](_0x4a8140[_0x0396('0x28')],qs[_0x0396('0x2d')](_0x1b0d77[_0x0396('0x29')][_0x0396('0x2d')]));_0x5235c7[_0x0396('0x2c')]=_0x5235c7[_0x0396('0x2c')][_0x0396('0x2e')]?_0x5235c7[_0x0396('0x2c')]:_0x4a8140[_0x0396('0x28')];if(_0x1b0d77[_0x0396('0x29')][_0x0396('0x39')]){_0x5235c7[_0x0396('0x3a')]=[{'all':!![]}];}_0x5235c7=_[_0x0396('0x35')]({},_0x5235c7,_0x1b0d77[_0x0396('0x38')]);return db[_0x0396('0x24')][_0x0396('0x41')](_0x5235c7)[_0x0396('0x1f')](handleEntityNotFound(_0x4ead4b,null))[_0x0396('0x1f')](respondWithResult(_0x4ead4b,null))[_0x0396('0x3d')](handleError(_0x4ead4b,null));};exports[_0x0396('0x42')]=function(_0x343874,_0x540b7e){return db[_0x0396('0x24')]['create'](_0x343874[_0x0396('0x43')],{})['then'](respondWithResult(_0x540b7e,0xc9))[_0x0396('0x3d')](handleError(_0x540b7e,null));};exports[_0x0396('0x44')]=function(_0x2845fe,_0x4fed96){return db['CmHopperHistory'][_0x0396('0x44')]()['then'](respondWithResult(_0x4fed96,null))['catch'](handleError(_0x4fed96,null));};exports[_0x0396('0x1e')]=function(_0x292ffb,_0x1c3bfd){if(_0x292ffb[_0x0396('0x43')]['uniqueid']){delete _0x292ffb[_0x0396('0x43')][_0x0396('0x45')];}return db[_0x0396('0x24')][_0x0396('0x41')]({'where':{'uniqueid':_0x292ffb[_0x0396('0x3f')]['id']}})[_0x0396('0x1f')](handleEntityNotFound(_0x1c3bfd,null))['then'](saveUpdates(_0x292ffb[_0x0396('0x43')],null))[_0x0396('0x1f')](respondWithResult(_0x1c3bfd,null))[_0x0396('0x3d')](handleError(_0x1c3bfd,null));}; \ No newline at end of file +var _0x7f56=['where','pick','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','merge','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3c7049,_0x4e7870){var _0x497249=function(_0x2019fe){while(--_0x2019fe){_0x3c7049['push'](_0x3c7049['shift']());}};_0x497249(++_0x4e7870);}(_0x7f56,0xae));var _0x67f5=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0x7f56[_0x2a7c2a];return _0x195732;};'use strict';var emlformat=require(_0x67f5('0x0'));var rimraf=require(_0x67f5('0x1'));var zipdir=require(_0x67f5('0x2'));var jsonpatch=require(_0x67f5('0x3'));var rp=require('request-promise');var moment=require(_0x67f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x67f5('0x5'));var util=require(_0x67f5('0x6'));var path=require(_0x67f5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x67f5('0x8'));var fs=require('fs');var fs_extra=require(_0x67f5('0x9'));var _=require('lodash');var squel=require(_0x67f5('0xa'));var crypto=require(_0x67f5('0xb'));var jsforce=require(_0x67f5('0xc'));var deskjs=require(_0x67f5('0xd'));var toCsv=require(_0x67f5('0xe'));var querystring=require(_0x67f5('0xf'));var Papa=require(_0x67f5('0x10'));var Redis=require('ioredis');var authService=require(_0x67f5('0x11'));var qs=require(_0x67f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67f5('0x13'));var logger=require(_0x67f5('0x14'))('api');var utils=require(_0x67f5('0x15'));var config=require(_0x67f5('0x16'));var licenseUtil=require(_0x67f5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x117d5c,_0x58850e){_0x58850e=_0x58850e||0xcc;return function(_0x28d0ff){if(_0x28d0ff){return _0x117d5c[_0x67f5('0x18')](_0x58850e);}return _0x117d5c[_0x67f5('0x19')](_0x58850e)[_0x67f5('0x1a')]();};}function respondWithResult(_0x319c1c,_0x3d66ed){_0x3d66ed=_0x3d66ed||0xc8;return function(_0x5b4e48){if(_0x5b4e48){return _0x319c1c[_0x67f5('0x19')](_0x3d66ed)[_0x67f5('0x1b')](_0x5b4e48);}};}function respondWithFilteredResult(_0x361a1b,_0x3d4ef5){return function(_0x1fdd65){if(_0x1fdd65){var _0x144474=typeof _0x3d4ef5[_0x67f5('0x1c')]==='undefined'&&typeof _0x3d4ef5[_0x67f5('0x1d')]==='undefined';var _0x140fc5=_0x1fdd65['count'];var _0x4451c7=_0x144474?0x0:_0x3d4ef5[_0x67f5('0x1c')];var _0x4c575a=_0x144474?_0x1fdd65[_0x67f5('0x1e')]:_0x3d4ef5[_0x67f5('0x1c')]+_0x3d4ef5[_0x67f5('0x1d')];var _0x254e9a;if(_0x4c575a>=_0x140fc5){_0x4c575a=_0x140fc5;_0x254e9a=0xc8;}else{_0x254e9a=0xce;}_0x361a1b[_0x67f5('0x19')](_0x254e9a);return _0x361a1b[_0x67f5('0x1f')](_0x67f5('0x20'),_0x4451c7+'-'+_0x4c575a+'/'+_0x140fc5)[_0x67f5('0x1b')](_0x1fdd65);}return null;};}function patchUpdates(_0x36ccd7){return function(_0x27cca1){try{jsonpatch[_0x67f5('0x21')](_0x27cca1,_0x36ccd7,!![]);}catch(_0x206d06){return BPromise[_0x67f5('0x22')](_0x206d06);}return _0x27cca1[_0x67f5('0x23')]();};}function saveUpdates(_0x4b848e,_0xa53b60){return function(_0x64fe8e){if(_0x64fe8e){return _0x64fe8e[_0x67f5('0x24')](_0x4b848e)[_0x67f5('0x25')](function(_0x3fdabf){return _0x3fdabf;});}return null;};}function removeEntity(_0x1f064b,_0x4a466a){return function(_0xc9f650){if(_0xc9f650){return _0xc9f650[_0x67f5('0x26')]()['then'](function(){_0x1f064b[_0x67f5('0x19')](0xcc)[_0x67f5('0x1a')]();});}};}function handleEntityNotFound(_0x5ea2d4,_0x2b9be4){return function(_0x2955b2){if(!_0x2955b2){_0x5ea2d4[_0x67f5('0x18')](0x194);}return _0x2955b2;};}function handleError(_0xea3ce3,_0x306516){_0x306516=_0x306516||0x1f4;return function(_0xe97243){logger['error'](_0xe97243['stack']);if(_0xe97243[_0x67f5('0x27')]){delete _0xe97243[_0x67f5('0x27')];}_0xea3ce3[_0x67f5('0x19')](_0x306516)[_0x67f5('0x28')](_0xe97243);};}exports[_0x67f5('0x29')]=function(_0x32441e,_0x45fa77){var _0x5e9be5={},_0x3ff3d6={},_0x1f536b={'count':0x0,'rows':[]};var _0x4e850e=_[_0x67f5('0x2a')](db[_0x67f5('0x2b')][_0x67f5('0x2c')],function(_0x369d1a){return{'name':_0x369d1a[_0x67f5('0x2d')],'type':_0x369d1a['type'][_0x67f5('0x2e')]};});_0x3ff3d6[_0x67f5('0x2f')]=_[_0x67f5('0x2a')](_0x4e850e,'name');_0x3ff3d6[_0x67f5('0x30')]=_['keys'](_0x32441e[_0x67f5('0x30')]);_0x3ff3d6[_0x67f5('0x31')]=_[_0x67f5('0x32')](_0x3ff3d6[_0x67f5('0x2f')],_0x3ff3d6[_0x67f5('0x30')]);_0x5e9be5[_0x67f5('0x33')]=_[_0x67f5('0x32')](_0x3ff3d6['model'],qs[_0x67f5('0x34')](_0x32441e['query'][_0x67f5('0x34')]));_0x5e9be5[_0x67f5('0x33')]=_0x5e9be5[_0x67f5('0x33')]['length']?_0x5e9be5['attributes']:_0x3ff3d6[_0x67f5('0x2f')];if(!_0x32441e['query'][_0x67f5('0x35')](_0x67f5('0x36'))){_0x5e9be5[_0x67f5('0x1d')]=qs['limit'](_0x32441e[_0x67f5('0x30')][_0x67f5('0x1d')]);_0x5e9be5[_0x67f5('0x1c')]=qs[_0x67f5('0x1c')](_0x32441e[_0x67f5('0x30')][_0x67f5('0x1c')]);}_0x5e9be5[_0x67f5('0x37')]=qs[_0x67f5('0x38')](_0x32441e[_0x67f5('0x30')][_0x67f5('0x38')]);_0x5e9be5[_0x67f5('0x39')]=qs['filters'](_[_0x67f5('0x3a')](_0x32441e[_0x67f5('0x30')],_0x3ff3d6[_0x67f5('0x31')]),_0x4e850e);if(_0x32441e[_0x67f5('0x30')]['filter']){_0x5e9be5[_0x67f5('0x39')]=_['merge'](_0x5e9be5['where'],{'$or':_[_0x67f5('0x2a')](_0x4e850e,function(_0x55460b){if(_0x55460b[_0x67f5('0x3b')]!==_0x67f5('0x3c')){var _0x54c313={};_0x54c313[_0x55460b[_0x67f5('0x27')]]={'$like':'%'+_0x32441e['query']['filter']+'%'};return _0x54c313;}})});}_0x5e9be5=_['merge']({},_0x5e9be5,_0x32441e[_0x67f5('0x3d')]);var _0x82a4bc={'where':_0x5e9be5['where']};return db[_0x67f5('0x2b')][_0x67f5('0x1e')](_0x82a4bc)[_0x67f5('0x25')](function(_0x109621){_0x1f536b['count']=_0x109621;if(_0x32441e[_0x67f5('0x30')][_0x67f5('0x3e')]){_0x5e9be5['include']=[{'all':!![]}];}return db[_0x67f5('0x2b')][_0x67f5('0x3f')](_0x5e9be5);})[_0x67f5('0x25')](function(_0x316497){_0x1f536b[_0x67f5('0x40')]=_0x316497;return _0x1f536b;})[_0x67f5('0x25')](respondWithFilteredResult(_0x45fa77,_0x5e9be5))[_0x67f5('0x41')](handleError(_0x45fa77,null));};exports[_0x67f5('0x42')]=function(_0x2e7109,_0x3aa842){var _0x524e7e={'raw':!![],'where':{'id':_0x2e7109[_0x67f5('0x43')]['id']}},_0x31ac75={};_0x31ac75[_0x67f5('0x2f')]=_[_0x67f5('0x44')](db['CmHopperHistory'][_0x67f5('0x2c')]);_0x31ac75['query']=_[_0x67f5('0x44')](_0x2e7109[_0x67f5('0x30')]);_0x31ac75[_0x67f5('0x31')]=_[_0x67f5('0x32')](_0x31ac75[_0x67f5('0x2f')],_0x31ac75['query']);_0x524e7e[_0x67f5('0x33')]=_[_0x67f5('0x32')](_0x31ac75[_0x67f5('0x2f')],qs['fields'](_0x2e7109['query'][_0x67f5('0x34')]));_0x524e7e[_0x67f5('0x33')]=_0x524e7e[_0x67f5('0x33')][_0x67f5('0x45')]?_0x524e7e[_0x67f5('0x33')]:_0x31ac75[_0x67f5('0x2f')];if(_0x2e7109['query']['includeAll']){_0x524e7e[_0x67f5('0x46')]=[{'all':!![]}];}_0x524e7e=_[_0x67f5('0x47')]({},_0x524e7e,_0x2e7109[_0x67f5('0x3d')]);return db[_0x67f5('0x2b')][_0x67f5('0x48')](_0x524e7e)[_0x67f5('0x25')](handleEntityNotFound(_0x3aa842,null))['then'](respondWithResult(_0x3aa842,null))[_0x67f5('0x41')](handleError(_0x3aa842,null));};exports[_0x67f5('0x49')]=function(_0x786276,_0x96635){return db['CmHopperHistory'][_0x67f5('0x49')](_0x786276[_0x67f5('0x4a')],{})[_0x67f5('0x25')](respondWithResult(_0x96635,0xc9))['catch'](handleError(_0x96635,null));};exports[_0x67f5('0x4b')]=function(_0x1fc119,_0x58c6f8){return db[_0x67f5('0x2b')][_0x67f5('0x4b')]()[_0x67f5('0x25')](respondWithResult(_0x58c6f8,null))[_0x67f5('0x41')](handleError(_0x58c6f8,null));};exports[_0x67f5('0x24')]=function(_0x5b99f4,_0x42e34d){if(_0x5b99f4['body'][_0x67f5('0x4c')]){delete _0x5b99f4[_0x67f5('0x4a')][_0x67f5('0x4c')];}return db['CmHopperHistory'][_0x67f5('0x48')]({'where':{'uniqueid':_0x5b99f4[_0x67f5('0x43')]['id']}})[_0x67f5('0x25')](handleEntityNotFound(_0x42e34d,null))['then'](saveUpdates(_0x5b99f4[_0x67f5('0x4a')],null))[_0x67f5('0x25')](respondWithResult(_0x42e34d,null))['catch'](handleError(_0x42e34d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 6cf0be4..2d235e0 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 _0xc0d7=['uniqueid','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0xe6f94e,_0x359b4b){var _0x1848e5=function(_0x5cb45a){while(--_0x5cb45a){_0xe6f94e['push'](_0xe6f94e['shift']());}};_0x1848e5(++_0x359b4b);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x285ea,_0x41839b){_0x285ea=_0x285ea-0x0;var _0x44a874=_0xc0d7[_0x285ea];return _0x44a874;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c0d('0x0'));var moment=require(_0x7c0d('0x1'));var BPromise=require(_0x7c0d('0x2'));var rp=require(_0x7c0d('0x3'));var fs=require('fs');var path=require(_0x7c0d('0x4'));var rimraf=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var attributes=require(_0x7c0d('0x7'));module[_0x7c0d('0x8')]=function(_0x5a6a70,_0x507bc0){return _0x5a6a70[_0x7c0d('0x9')](_0x7c0d('0xa'),attributes,{'tableName':_0x7c0d('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7c0d('0xc')]},{'name':_0x7c0d('0xd'),'fields':[_0x7c0d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f2e=['./cmHopperHistory.attributes','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x20c290,_0x47e736){_0x20c290=_0x20c290-0x0;var _0x3d7b3b=_0x3f2e[_0x20c290];return _0x3d7b3b;};'use strict';var _=require(_0xe3f2('0x0'));var util=require('util');var logger=require(_0xe3f2('0x1'))(_0xe3f2('0x2'));var moment=require(_0xe3f2('0x3'));var BPromise=require(_0xe3f2('0x4'));var rp=require(_0xe3f2('0x5'));var fs=require('fs');var path=require(_0xe3f2('0x6'));var rimraf=require(_0xe3f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xe3f2('0x8'));module['exports']=function(_0x7cdd2e,_0x2d6460){return _0x7cdd2e['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xe3f2('0x9'),'fields':[_0xe3f2('0x9')]},{'name':_0xe3f2('0xa'),'fields':[_0xe3f2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0cddcfa..b96e5b6 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 _0x2572=['http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','catch','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x267de4,_0x5a0362){var _0x22ef73=function(_0x1cd37d){while(--_0x1cd37d){_0x267de4['push'](_0x267de4['shift']());}};_0x22ef73(++_0x5a0362);}(_0x2572,0x110));var _0x2257=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x2572[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var moment=require(_0x2257('0x2'));var BPromise=require(_0x2257('0x3'));var rs=require(_0x2257('0x4'));var fs=require('fs');var Redis=require(_0x2257('0x5'));var db=require(_0x2257('0x6'))['db'];var utils=require(_0x2257('0x7'));var logger=require(_0x2257('0x8'))('rpc');var config=require(_0x2257('0x9'));var jayson=require(_0x2257('0xa'));var client=jayson[_0x2257('0xb')][_0x2257('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26b2c6,_0x339619,_0x74aec6){return new BPromise(function(_0x380460,_0xee7249){return client['request'](_0x26b2c6,_0x74aec6)[_0x2257('0xd')](function(_0x3e088a){logger['info'](_0x2257('0xe'),_0x339619,_0x2257('0xf'));logger[_0x2257('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x339619,_0x2257('0xf'),JSON[_0x2257('0x11')](_0x3e088a));if(_0x3e088a[_0x2257('0x12')]){if(_0x3e088a[_0x2257('0x12')]['code']===0x1f4){logger[_0x2257('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x339619,_0x3e088a['error'][_0x2257('0x13')]);return _0xee7249(_0x3e088a[_0x2257('0x12')][_0x2257('0x13')]);}logger[_0x2257('0x12')](_0x2257('0xe'),_0x339619,_0x3e088a[_0x2257('0x12')][_0x2257('0x13')]);return _0x380460(_0x3e088a['error']['message']);}else{logger[_0x2257('0x14')](_0x2257('0xe'),_0x339619,_0x2257('0xf'));_0x380460(_0x3e088a[_0x2257('0x15')]['message']);}})['catch'](function(_0x330216){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x339619,_0x330216);_0xee7249(_0x330216);});});}exports['CreateCmHopperHistory']=function(_0x31c8c6){var _0x2d51e7=this;return new Promise(function(_0x31e8d0,_0x2c3c79){return db[_0x2257('0x16')][_0x2257('0x17')](_0x31c8c6[_0x2257('0x18')],{'raw':_0x31c8c6[_0x2257('0x19')]?_0x31c8c6[_0x2257('0x19')][_0x2257('0x1a')]===undefined?!![]:![]:!![]})[_0x2257('0xd')](function(_0x263108){logger['info'](_0x2257('0x1b'),_0x31c8c6);logger[_0x2257('0x10')]('CreateCmHopperHistory',_0x31c8c6,JSON['stringify'](_0x263108));_0x31e8d0(_0x263108);})[_0x2257('0x1c')](function(_0x5ae577){logger[_0x2257('0x12')](_0x2257('0x1b'),_0x5ae577[_0x2257('0x13')],_0x31c8c6);_0x2c3c79(_0x2d51e7[_0x2257('0x12')](0x1f4,_0x5ae577[_0x2257('0x13')]));});});};exports[_0x2257('0x1d')]=function(_0x1549aa){var _0x18fec2=this;return new Promise(function(_0x8032e3,_0x27a619){return db['CmHopperHistory'][_0x2257('0x1e')]({'raw':_0x1549aa[_0x2257('0x19')]?_0x1549aa['options'][_0x2257('0x1a')]===undefined?!![]:![]:!![],'where':_0x1549aa[_0x2257('0x19')]?_0x1549aa['options'][_0x2257('0x1f')]||null:null,'attributes':[[db[_0x2257('0x20')]['fn']('COUNT',db[_0x2257('0x20')][_0x2257('0x21')]('id')),_0x2257('0x22')],[db[_0x2257('0x20')]['fn']('COUNT',db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')]['literal'](_0x2257('0x23')))),_0x2257('0x24')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')](_0x2257('0x27')))),_0x2257('0x28')],[db['sequelize']['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db['sequelize']['literal'](_0x2257('0x29')))),_0x2257('0x2a')],[db[_0x2257('0x20')]['fn'](_0x2257('0x2b'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')]['literal'](_0x2257('0x2c')))),_0x2257('0x2d')],[db[_0x2257('0x20')]['fn'](_0x2257('0x2b'),db['sequelize']['fn']('IF',db[_0x2257('0x20')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x2257('0x2e')]]})[_0x2257('0xd')](function(_0x388bd6){logger[_0x2257('0x14')](_0x2257('0x1d'),_0x1549aa);logger[_0x2257('0x10')](_0x2257('0x1d'),_0x1549aa,JSON[_0x2257('0x11')](_0x388bd6));_0x8032e3(_0x388bd6);})[_0x2257('0x1c')](function(_0x3fde10){logger[_0x2257('0x12')](_0x2257('0x1d'),_0x3fde10[_0x2257('0x13')],_0x1549aa);_0x27a619(_0x18fec2[_0x2257('0x12')](0x1f4,_0x3fde10['message']));});});};exports[_0x2257('0x2f')]=function(_0xb330a4){var _0x1717a1=this;return new Promise(function(_0xf4780c,_0x24edea){return db['CmHopperHistory'][_0x2257('0x1e')]({'raw':_0xb330a4[_0x2257('0x19')]?_0xb330a4[_0x2257('0x19')][_0x2257('0x1a')]===undefined?!![]:![]:!![],'where':_0xb330a4[_0x2257('0x19')]?_0xb330a4[_0x2257('0x19')][_0x2257('0x1f')]||null:null,'attributes':[[_0x2257('0x30'),_0x2257('0x31')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')]['literal'](_0x2257('0x32')))),_0x2257('0x33')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')](_0x2257('0x34')))),_0x2257('0x35')],[db[_0x2257('0x20')]['fn']('COUNT',db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0x2257('0x36')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')]('`state`\x20=\x205,\x201,\x20null'))),_0x2257('0x37')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x2257('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2257('0x20')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')](_0x2257('0x38')))),_0x2257('0x39')],[db['sequelize']['fn'](_0x2257('0x25'),db['sequelize']['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')](_0x2257('0x3a')))),_0x2257('0x3b')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db['sequelize'][_0x2257('0x26')](_0x2257('0x3c')))),'outboundBlacklistCallsDay'],[db[_0x2257('0x20')]['fn']('COUNT',db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')](_0x2257('0x3d')))),_0x2257('0x3e')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db['sequelize']['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')]('`state`\x20=\x2018,\x201,\x20null'))),_0x2257('0x3f')],[db['sequelize']['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')]('`state`\x20=\x2016,\x201,\x20null'))),_0x2257('0x40')],[db['sequelize']['fn'](_0x2257('0x25'),db['sequelize']['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')](_0x2257('0x41')))),_0x2257('0x3f')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')]['literal'](_0x2257('0x42')))),_0x2257('0x43')]],'group':[_0x2257('0x30')]})[_0x2257('0xd')](function(_0x3ae279){logger[_0x2257('0x14')](_0x2257('0x2f'),_0xb330a4);logger[_0x2257('0x10')](_0x2257('0x2f'),_0xb330a4,JSON[_0x2257('0x11')](_0x3ae279));_0xf4780c(_0x3ae279);})[_0x2257('0x1c')](function(_0x3aa4bb){logger[_0x2257('0x12')]('GetVoiceQueueHopperHistory',_0x3aa4bb[_0x2257('0x13')],_0xb330a4);_0x24edea(_0x1717a1[_0x2257('0x12')](0x1f4,_0x3aa4bb[_0x2257('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x260bb6){var _0x2a8135=this;return new Promise(function(_0x1f6ea2,_0x50a3f6){return db[_0x2257('0x16')][_0x2257('0x1e')]({'raw':_0x260bb6[_0x2257('0x19')]?_0x260bb6[_0x2257('0x19')][_0x2257('0x1a')]===undefined?!![]:![]:!![],'where':_0x260bb6[_0x2257('0x19')]?_0x260bb6['options']['where']||null:null,'attributes':[[_0x2257('0x30'),_0x2257('0x31')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')][_0x2257('0x21')]('id')),_0x2257('0x44')],[db[_0x2257('0x20')]['fn'](_0x2257('0x25'),db[_0x2257('0x20')]['fn']('IF',db[_0x2257('0x20')][_0x2257('0x26')](_0x2257('0x23')))),_0x2257('0x45')]],'group':[_0x2257('0x30')]})[_0x2257('0xd')](function(_0x3da7ca){logger[_0x2257('0x14')](_0x2257('0x46'),_0x260bb6);logger['debug']('GetCampaignHopperHistory',_0x260bb6,JSON['stringify'](_0x3da7ca));_0x1f6ea2(_0x3da7ca);})[_0x2257('0x1c')](function(_0x2a0135){logger[_0x2257('0x12')](_0x2257('0x46'),_0x2a0135[_0x2257('0x13')],_0x260bb6);_0x50a3f6(_0x2a8135[_0x2257('0x12')](0x1f4,_0x2a0135[_0x2257('0x13')]));});});}; \ No newline at end of file +var _0x4322=['`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','findAll','where','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','AvgHandleTime','raw','col','predictiveIntervalTotalCalls','sequelize'];(function(_0x394581,_0xfb87b){var _0x4d3757=function(_0x5d562f){while(--_0x5d562f){_0x394581['push'](_0x394581['shift']());}};_0x4d3757(++_0xfb87b);}(_0x4322,0x174));var _0x2432=function(_0x1a0ca7,_0x57451b){_0x1a0ca7=_0x1a0ca7-0x0;var _0x504fb5=_0x4322[_0x1a0ca7];return _0x504fb5;};'use strict';var _=require(_0x2432('0x0'));var util=require('util');var moment=require(_0x2432('0x1'));var BPromise=require(_0x2432('0x2'));var rs=require(_0x2432('0x3'));var fs=require('fs');var Redis=require(_0x2432('0x4'));var db=require(_0x2432('0x5'))['db'];var utils=require(_0x2432('0x6'));var logger=require(_0x2432('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2432('0x8')][_0x2432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50447b,_0x21ce1f,_0x1c87c6){return new BPromise(function(_0xa4dcf5,_0x29c7e6){return client['request'](_0x50447b,_0x1c87c6)['then'](function(_0x3726be){logger['info'](_0x2432('0xa'),_0x21ce1f,'request\x20sent');logger[_0x2432('0xb')](_0x2432('0xc'),_0x21ce1f,_0x2432('0xd'),JSON[_0x2432('0xe')](_0x3726be));if(_0x3726be['error']){if(_0x3726be[_0x2432('0xf')][_0x2432('0x10')]===0x1f4){logger['error'](_0x2432('0xa'),_0x21ce1f,_0x3726be[_0x2432('0xf')][_0x2432('0x11')]);return _0x29c7e6(_0x3726be[_0x2432('0xf')]['message']);}logger[_0x2432('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x21ce1f,_0x3726be[_0x2432('0xf')][_0x2432('0x11')]);return _0xa4dcf5(_0x3726be['error'][_0x2432('0x11')]);}else{logger[_0x2432('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x21ce1f,_0x2432('0xd'));_0xa4dcf5(_0x3726be[_0x2432('0x13')][_0x2432('0x11')]);}})[_0x2432('0x14')](function(_0x372f84){logger['error'](_0x2432('0xa'),_0x21ce1f,_0x372f84);_0x29c7e6(_0x372f84);});});}exports[_0x2432('0x15')]=function(_0x1719d8){var _0x3fade9=this;return new Promise(function(_0x47f997,_0x542480){return db[_0x2432('0x16')]['create'](_0x1719d8[_0x2432('0x17')],{'raw':_0x1719d8[_0x2432('0x18')]?_0x1719d8[_0x2432('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x37841b){logger[_0x2432('0x12')](_0x2432('0x15'),_0x1719d8);logger['debug'](_0x2432('0x15'),_0x1719d8,JSON[_0x2432('0xe')](_0x37841b));_0x47f997(_0x37841b);})[_0x2432('0x14')](function(_0x2ba6c1){logger[_0x2432('0xf')](_0x2432('0x15'),_0x2ba6c1[_0x2432('0x11')],_0x1719d8);_0x542480(_0x3fade9[_0x2432('0xf')](0x1f4,_0x2ba6c1[_0x2432('0x11')]));});});};exports[_0x2432('0x19')]=function(_0x39f067){var _0x4bd4b2=this;return new Promise(function(_0x1f1ab4,_0x19ce1a){return db[_0x2432('0x16')]['findAll']({'raw':_0x39f067[_0x2432('0x18')]?_0x39f067[_0x2432('0x18')][_0x2432('0x1a')]===undefined?!![]:![]:!![],'where':_0x39f067['options']?_0x39f067['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x2432('0x1b')]('id')),_0x2432('0x1c')],[db[_0x2432('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2432('0x1d')]['literal'](_0x2432('0x1e')))),_0x2432('0x1f')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db['sequelize']['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0x2432('0x22')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x23')))),_0x2432('0x24')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x25'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x26')))),_0x2432('0x27')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x25'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x28')))),_0x2432('0x29')]]})[_0x2432('0x2a')](function(_0x2b1d54){logger['info'](_0x2432('0x19'),_0x39f067);logger[_0x2432('0xb')]('AvgHandleTime',_0x39f067,JSON[_0x2432('0xe')](_0x2b1d54));_0x1f1ab4(_0x2b1d54);})[_0x2432('0x14')](function(_0x327ba5){logger[_0x2432('0xf')](_0x2432('0x19'),_0x327ba5['message'],_0x39f067);_0x19ce1a(_0x4bd4b2[_0x2432('0xf')](0x1f4,_0x327ba5['message']));});});};exports[_0x2432('0x2b')]=function(_0x28f36d){var _0xe19318=this;return new Promise(function(_0x4a1125,_0x12c953){return db[_0x2432('0x16')]['findAll']({'raw':_0x28f36d['options']?_0x28f36d[_0x2432('0x18')][_0x2432('0x1a')]===undefined?!![]:![]:!![],'where':_0x28f36d[_0x2432('0x18')]?_0x28f36d[_0x2432('0x18')]['where']||null:null,'attributes':[[_0x2432('0x2c'),_0x2432('0x2d')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db['sequelize']['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x2e')))),_0x2432('0x2f')],[db[_0x2432('0x1d')]['fn']('COUNT',db[_0x2432('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x2432('0x30')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x1e')))),_0x2432('0x31')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db['sequelize'][_0x2432('0x21')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x32')))),_0x2432('0x33')],[db['sequelize']['fn'](_0x2432('0x20'),db['sequelize']['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x35')))),_0x2432('0x36')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db['sequelize'][_0x2432('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x37')))),'outboundBlacklistCallsDay'],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db['sequelize'][_0x2432('0x21')](_0x2432('0x39')))),_0x2432('0x3a')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db['sequelize'][_0x2432('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x2432('0x3b')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db['sequelize']['fn']('IF',db[_0x2432('0x1d')]['literal'](_0x2432('0x3c')))),_0x2432('0x3a')],[db['sequelize']['fn'](_0x2432('0x20'),db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')]['literal'](_0x2432('0x3d')))),'outboundReCallsDay']],'group':['campaign']})[_0x2432('0x2a')](function(_0x59798c){logger[_0x2432('0x12')](_0x2432('0x2b'),_0x28f36d);logger[_0x2432('0xb')](_0x2432('0x2b'),_0x28f36d,JSON[_0x2432('0xe')](_0x59798c));_0x4a1125(_0x59798c);})[_0x2432('0x14')](function(_0x4ef302){logger[_0x2432('0xf')]('GetVoiceQueueHopperHistory',_0x4ef302[_0x2432('0x11')],_0x28f36d);_0x12c953(_0xe19318['error'](0x1f4,_0x4ef302[_0x2432('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x195127){var _0x1bef94=this;return new Promise(function(_0x46c4e2,_0x43ab2e){return db[_0x2432('0x16')][_0x2432('0x3e')]({'raw':_0x195127['options']?_0x195127[_0x2432('0x18')][_0x2432('0x1a')]===undefined?!![]:![]:!![],'where':_0x195127[_0x2432('0x18')]?_0x195127[_0x2432('0x18')][_0x2432('0x3f')]||null:null,'attributes':[['campaign',_0x2432('0x2d')],[db[_0x2432('0x1d')]['fn'](_0x2432('0x20'),db[_0x2432('0x1d')][_0x2432('0x1b')]('id')),_0x2432('0x40')],[db[_0x2432('0x1d')]['fn']('COUNT',db[_0x2432('0x1d')]['fn']('IF',db[_0x2432('0x1d')][_0x2432('0x21')](_0x2432('0x1e')))),_0x2432('0x41')]],'group':[_0x2432('0x2c')]})[_0x2432('0x2a')](function(_0x57cb0a){logger[_0x2432('0x12')](_0x2432('0x42'),_0x195127);logger[_0x2432('0xb')]('GetCampaignHopperHistory',_0x195127,JSON[_0x2432('0xe')](_0x57cb0a));_0x46c4e2(_0x57cb0a);})['catch'](function(_0x597af8){logger[_0x2432('0xf')](_0x2432('0x42'),_0x597af8[_0x2432('0x11')],_0x195127);_0x43ab2e(_0x1bef94[_0x2432('0xf')](0x1f4,_0x597af8['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 455cccc..af185ab 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 _0x97f2=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','create','put'];(function(_0x3ea513,_0x28dcc6){var _0x5c4497=function(_0x4c0f69){while(--_0x4c0f69){_0x3ea513['push'](_0x3ea513['shift']());}};_0x5c4497(++_0x28dcc6);}(_0x97f2,0x187));var _0x297f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97f2[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0x297f('0x0'));var path=require(_0x297f('0x1'));var timeout=require(_0x297f('0x2'));var express=require(_0x297f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x297f('0x4'));var interaction=require(_0x297f('0x5'));var config=require(_0x297f('0x6'));var controller=require(_0x297f('0x7'));router[_0x297f('0x8')]('/',auth[_0x297f('0x9')](),controller['index']);router[_0x297f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x297f('0x8')]('/:id',auth[_0x297f('0x9')](),controller['show']);router['post']('/',auth[_0x297f('0x9')](),controller[_0x297f('0xa')]);router[_0x297f('0xb')]('/:id',auth[_0x297f('0x9')](),controller['update']);module[_0x297f('0xc')]=router; \ No newline at end of file +var _0x5300=['../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','multer','util','express','Router','fs-extra'];(function(_0x578710,_0x38f572){var _0x47b46c=function(_0x10acfb){while(--_0x10acfb){_0x578710['push'](_0x578710['shift']());}};_0x47b46c(++_0x38f572);}(_0x5300,0x13f));var _0x0530=function(_0xc0a94a,_0x236e0e){_0xc0a94a=_0xc0a94a-0x0;var _0x527a3b=_0x5300[_0xc0a94a];return _0x527a3b;};'use strict';var multer=require(_0x0530('0x0'));var util=require(_0x0530('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0530('0x2'));var router=express[_0x0530('0x3')]();var fs_extra=require(_0x0530('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0530('0x5'));var config=require(_0x0530('0x6'));var controller=require(_0x0530('0x7'));router[_0x0530('0x8')]('/',auth[_0x0530('0x9')](),controller[_0x0530('0xa')]);router['get'](_0x0530('0xb'),auth[_0x0530('0x9')](),controller[_0x0530('0xc')]);router[_0x0530('0x8')](_0x0530('0xd'),auth[_0x0530('0x9')](),controller[_0x0530('0xe')]);router[_0x0530('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0530('0x10')](_0x0530('0xd'),auth['isAuthenticated'](),controller[_0x0530('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1f403c5..2facae9 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 _0x8c52=['sequelize','STRING','name'];(function(_0x51d22e,_0x276640){var _0x275be3=function(_0x52d368){while(--_0x52d368){_0x51d22e['push'](_0x51d22e['shift']());}};_0x275be3(++_0x276640);}(_0x8c52,0x7e));var _0x28c5=function(_0x58ad1d,_0xefa109){_0x58ad1d=_0x58ad1d-0x0;var _0x57c158=_0x8c52[_0x58ad1d];return _0x57c158;};'use strict';var Sequelize=require(_0x28c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x28c5('0x1')],'unique':_0x28c5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x28c5('0x1')]},'dialPrefix':{'type':Sequelize[_0x28c5('0x1')]}}; \ No newline at end of file +var _0x2821=['exports','STRING','name','sequelize'];(function(_0x3168df,_0x254ce5){var _0x54e72d=function(_0x287b61){while(--_0x287b61){_0x3168df['push'](_0x3168df['shift']());}};_0x54e72d(++_0x254ce5);}(_0x2821,0xc3));var _0x1282=function(_0x3ed984,_0x2d2e2a){_0x3ed984=_0x3ed984-0x0;var _0x2f989f=_0x2821[_0x3ed984];return _0x2f989f;};'use strict';var Sequelize=require(_0x1282('0x0'));module[_0x1282('0x1')]={'name':{'type':Sequelize[_0x1282('0x2')],'unique':_0x1282('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1282('0x2')]},'dialPrefix':{'type':Sequelize[_0x1282('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a1c7013..1c63ff0 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 _0x31ee=['stack','name','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','now','writeFileSync','setHeader','Content-disposition','Content-type','download','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','type','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x4f7911,_0xb5e9da){var _0x495148=function(_0x5a712a){while(--_0x5a712a){_0x4f7911['push'](_0x4f7911['shift']());}};_0x495148(++_0xb5e9da);}(_0x31ee,0x181));var _0xe31e=function(_0x5bd2d6,_0x2d11b1){_0x5bd2d6=_0x5bd2d6-0x0;var _0x4ddd85=_0x31ee[_0x5bd2d6];return _0x4ddd85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe31e('0x0'));var zipdir=require(_0xe31e('0x1'));var jsonpatch=require(_0xe31e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe31e('0x3'));var Mustache=require('mustache');var util=require(_0xe31e('0x4'));var path=require('path');var sox=require(_0xe31e('0x5'));var csv=require(_0xe31e('0x6'));var ejs=require(_0xe31e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe31e('0x8'));var squel=require(_0xe31e('0x9'));var crypto=require(_0xe31e('0xa'));var jsforce=require(_0xe31e('0xb'));var deskjs=require(_0xe31e('0xc'));var toCsv=require(_0xe31e('0x6'));var querystring=require(_0xe31e('0xd'));var Papa=require(_0xe31e('0xe'));var Redis=require('ioredis');var authService=require(_0xe31e('0xf'));var qs=require(_0xe31e('0x10'));var as=require(_0xe31e('0x11'));var hardwareService=require(_0xe31e('0x12'));var logger=require(_0xe31e('0x13'))('api');var utils=require(_0xe31e('0x14'));var config=require(_0xe31e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe31e('0x16'))['db'];config[_0xe31e('0x17')]=_[_0xe31e('0x18')](config[_0xe31e('0x17')],{'host':_0xe31e('0x19'),'port':0x18eb});var socket=require(_0xe31e('0x1a'))(new Redis(config[_0xe31e('0x17')]));require(_0xe31e('0x1b'))[_0xe31e('0x1c')](socket);function respondWithStatusCode(_0x3ea0ea,_0x520c13){_0x520c13=_0x520c13||0xcc;return function(_0x672cdc){if(_0x672cdc){return _0x3ea0ea[_0xe31e('0x1d')](_0x520c13);}return _0x3ea0ea[_0xe31e('0x1e')](_0x520c13)[_0xe31e('0x1f')]();};}function respondWithResult(_0xa25d05,_0x36a15a){_0x36a15a=_0x36a15a||0xc8;return function(_0x4d78b2){if(_0x4d78b2){return _0xa25d05[_0xe31e('0x1e')](_0x36a15a)[_0xe31e('0x20')](_0x4d78b2);}};}function respondWithFilteredResult(_0xeacaee,_0x38aca7){return function(_0x550169){if(_0x550169){var _0xf46f82=typeof _0x38aca7[_0xe31e('0x21')]==='undefined'&&typeof _0x38aca7['limit']===_0xe31e('0x22');var _0x1a0cea=_0x550169[_0xe31e('0x23')];var _0x485c25=_0xf46f82?0x0:_0x38aca7[_0xe31e('0x21')];var _0x52c112=_0xf46f82?_0x550169[_0xe31e('0x23')]:_0x38aca7[_0xe31e('0x21')]+_0x38aca7['limit'];var _0x5db8da;if(_0x52c112>=_0x1a0cea){_0x52c112=_0x1a0cea;_0x5db8da=0xc8;}else{_0x5db8da=0xce;}_0xeacaee['status'](_0x5db8da);return _0xeacaee[_0xe31e('0x24')](_0xe31e('0x25'),_0x485c25+'-'+_0x52c112+'/'+_0x1a0cea)[_0xe31e('0x20')](_0x550169);}return null;};}function patchUpdates(_0x290c99){return function(_0x47c075){try{jsonpatch[_0xe31e('0x26')](_0x47c075,_0x290c99,!![]);}catch(_0x45e979){return BPromise[_0xe31e('0x27')](_0x45e979);}return _0x47c075[_0xe31e('0x28')]();};}function saveUpdates(_0x4dd0f5,_0x4fc0e7){return function(_0x194913){if(_0x194913){return _0x194913[_0xe31e('0x29')](_0x4dd0f5)[_0xe31e('0x2a')](function(_0x30a19a){return _0x30a19a;});}return null;};}function removeEntity(_0x2c91f7,_0x1f852c){return function(_0x4baf83){if(_0x4baf83){return _0x4baf83[_0xe31e('0x2b')]()[_0xe31e('0x2a')](function(){var _0x3e46f8=_0x4baf83[_0xe31e('0x2c')]({'plain':!![]});var _0x26fede='Lists';return db[_0xe31e('0x2d')]['destroy']({'where':{'type':_0x26fede,'resourceId':_0x3e46f8['id']}})['then'](function(){return _0x4baf83;});})['then'](function(){_0x2c91f7['status'](0xcc)[_0xe31e('0x1f')]();});}};}function handleEntityNotFound(_0x3d9228,_0x5679bc){return function(_0x10419c){if(!_0x10419c){_0x3d9228[_0xe31e('0x1d')](0x194);}return _0x10419c;};}function handleError(_0x2c51a5,_0x1714ba){_0x1714ba=_0x1714ba||0x1f4;return function(_0x4fdaab){logger[_0xe31e('0x2e')](_0x4fdaab[_0xe31e('0x2f')]);if(_0x4fdaab[_0xe31e('0x30')]){delete _0x4fdaab['name'];}_0x2c51a5['status'](_0x1714ba)['send'](_0x4fdaab);};}exports[_0xe31e('0x31')]=function(_0x10b913,_0x8a2ae9){var _0x3cbd64={},_0x4a3d75={},_0x1075b9={'count':0x0,'rows':[]};var _0x38e29b=_[_0xe31e('0x32')](db[_0xe31e('0x33')][_0xe31e('0x34')],function(_0x1c06d6){return{'name':_0x1c06d6[_0xe31e('0x35')],'type':_0x1c06d6['type'][_0xe31e('0x36')]};});_0x4a3d75[_0xe31e('0x37')]=_[_0xe31e('0x32')](_0x38e29b,_0xe31e('0x30'));_0x4a3d75[_0xe31e('0x38')]=_[_0xe31e('0x39')](_0x10b913['query']);_0x4a3d75[_0xe31e('0x3a')]=_[_0xe31e('0x3b')](_0x4a3d75[_0xe31e('0x37')],_0x4a3d75[_0xe31e('0x38')]);_0x3cbd64[_0xe31e('0x3c')]=_[_0xe31e('0x3b')](_0x4a3d75[_0xe31e('0x37')],qs['fields'](_0x10b913['query'][_0xe31e('0x3d')]));_0x3cbd64[_0xe31e('0x3c')]=_0x3cbd64[_0xe31e('0x3c')][_0xe31e('0x3e')]?_0x3cbd64[_0xe31e('0x3c')]:_0x4a3d75[_0xe31e('0x37')];if(!_0x10b913[_0xe31e('0x38')][_0xe31e('0x3f')](_0xe31e('0x40'))){_0x3cbd64[_0xe31e('0x41')]=qs[_0xe31e('0x41')](_0x10b913[_0xe31e('0x38')][_0xe31e('0x41')]);_0x3cbd64[_0xe31e('0x21')]=qs[_0xe31e('0x21')](_0x10b913[_0xe31e('0x38')]['offset']);}_0x3cbd64[_0xe31e('0x42')]=qs[_0xe31e('0x43')](_0x10b913[_0xe31e('0x38')]['sort']);_0x3cbd64['where']=qs[_0xe31e('0x3a')](_[_0xe31e('0x44')](_0x10b913['query'],_0x4a3d75[_0xe31e('0x3a')]),_0x38e29b);if(_0x10b913['query'][_0xe31e('0x45')]){_0x3cbd64[_0xe31e('0x46')]=_['merge'](_0x3cbd64[_0xe31e('0x46')],{'$or':_[_0xe31e('0x32')](_0x38e29b,function(_0xea8d56){if(_0xea8d56['type']!==_0xe31e('0x47')){var _0x51702f={};_0x51702f[_0xea8d56[_0xe31e('0x30')]]={'$like':'%'+_0x10b913[_0xe31e('0x38')][_0xe31e('0x45')]+'%'};return _0x51702f;}})});}_0x3cbd64=_[_0xe31e('0x48')]({},_0x3cbd64,_0x10b913[_0xe31e('0x49')]);var _0xbd8084={'where':_0x3cbd64[_0xe31e('0x46')]};return db[_0xe31e('0x33')]['count'](_0xbd8084)[_0xe31e('0x2a')](function(_0x1fac59){_0x1075b9[_0xe31e('0x23')]=_0x1fac59;if(_0x10b913[_0xe31e('0x38')][_0xe31e('0x4a')]){_0x3cbd64[_0xe31e('0x4b')]=[{'all':!![]}];}return db[_0xe31e('0x33')]['findAll'](_0x3cbd64);})[_0xe31e('0x2a')](function(_0x198625){_0x1075b9[_0xe31e('0x4c')]=_0x198625;return _0x1075b9;})['then'](respondWithFilteredResult(_0x8a2ae9,_0x3cbd64))[_0xe31e('0x4d')](handleError(_0x8a2ae9,null));};exports['show']=function(_0x269193,_0x5af882){var _0x1fadce={'raw':![],'where':{'id':_0x269193[_0xe31e('0x4e')]['id']}},_0x505ab7={};_0x505ab7[_0xe31e('0x37')]=_[_0xe31e('0x39')](db['CmList'][_0xe31e('0x34')]);_0x505ab7['query']=_[_0xe31e('0x39')](_0x269193[_0xe31e('0x38')]);_0x505ab7['filters']=_[_0xe31e('0x3b')](_0x505ab7[_0xe31e('0x37')],_0x505ab7[_0xe31e('0x38')]);_0x1fadce[_0xe31e('0x3c')]=_['intersection'](_0x505ab7[_0xe31e('0x37')],qs[_0xe31e('0x3d')](_0x269193[_0xe31e('0x38')][_0xe31e('0x3d')]));_0x1fadce[_0xe31e('0x3c')]=_0x1fadce[_0xe31e('0x3c')][_0xe31e('0x3e')]?_0x1fadce['attributes']:_0x505ab7[_0xe31e('0x37')];if(_0x269193[_0xe31e('0x38')]['includeAll']){_0x1fadce[_0xe31e('0x4b')]=[{'all':!![]}];}_0x1fadce=_['merge']({},_0x1fadce,_0x269193[_0xe31e('0x49')]);return db['CmList'][_0xe31e('0x4f')](_0x1fadce)[_0xe31e('0x2a')](handleEntityNotFound(_0x5af882,null))[_0xe31e('0x2a')](respondWithResult(_0x5af882,null))[_0xe31e('0x4d')](handleError(_0x5af882,null));};exports[_0xe31e('0x50')]=function(_0x1deefb,_0x435655){return db['CmList']['create'](_0x1deefb[_0xe31e('0x51')],{})['then'](function(_0x4ac230){var _0x3467f9=_0x1deefb[_0xe31e('0x52')][_0xe31e('0x2c')]({'plain':!![]});if(!_0x3467f9)throw new Error(_0xe31e('0x53'));if(_0x3467f9[_0xe31e('0x54')]==='user'){var _0x47894c=_0x4ac230['get']({'plain':!![]});var _0x27b714=_0xe31e('0x55');return db[_0xe31e('0x56')][_0xe31e('0x4f')]({'where':{'name':_0x27b714,'userProfileId':_0x3467f9['userProfileId']},'raw':!![]})['then'](function(_0x5ce21c){if(_0x5ce21c&&_0x5ce21c[_0xe31e('0x57')]===0x0){return db[_0xe31e('0x2d')][_0xe31e('0x50')]({'name':_0x47894c[_0xe31e('0x30')],'resourceId':_0x47894c['id'],'type':_0x5ce21c[_0xe31e('0x30')],'sectionId':_0x5ce21c['id']},{})[_0xe31e('0x2a')](function(){return _0x4ac230;});}else{return _0x4ac230;}})[_0xe31e('0x4d')](function(_0x222dd6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x222dd6);throw _0x222dd6;});}return _0x4ac230;})['then'](respondWithResult(_0x435655,0xc9))['catch'](handleError(_0x435655,null));};exports[_0xe31e('0x29')]=function(_0x2255e7,_0x358b76){if(_0x2255e7[_0xe31e('0x51')]['id']){delete _0x2255e7[_0xe31e('0x51')]['id'];}return db[_0xe31e('0x33')][_0xe31e('0x4f')]({'where':{'id':_0x2255e7[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x358b76,null))['then'](saveUpdates(_0x2255e7[_0xe31e('0x51')],null))[_0xe31e('0x2a')](respondWithResult(_0x358b76,null))[_0xe31e('0x4d')](handleError(_0x358b76,null));};exports[_0xe31e('0x2b')]=function(_0xc93e44,_0x5d1f1d){return db[_0xe31e('0x33')][_0xe31e('0x4f')]({'where':{'id':_0xc93e44[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x5d1f1d,null))[_0xe31e('0x2a')](removeEntity(_0x5d1f1d,null))['catch'](handleError(_0x5d1f1d,null));};exports['describe']=function(_0x2bb000,_0x19da31){return db['CmList'][_0xe31e('0x58')]()[_0xe31e('0x2a')](respondWithResult(_0x19da31,null))[_0xe31e('0x4d')](handleError(_0x19da31,null));};exports[_0xe31e('0x59')]=function(_0x29eea3,_0x2b43d1,_0x16b054){if(_0x29eea3[_0xe31e('0x51')]['id']){delete _0x29eea3[_0xe31e('0x51')]['id'];}return db['CmList']['find']({'where':{'id':_0x29eea3[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x2b43d1,null))[_0xe31e('0x2a')](function(_0x44a6cc){if(_0x44a6cc){_0x29eea3[_0xe31e('0x51')][_0xe31e('0x5a')]=_0x44a6cc['id'];return db[_0xe31e('0x5b')][_0xe31e('0x50')](_0x29eea3[_0xe31e('0x51')]);}})[_0xe31e('0x2a')](respondWithResult(_0x2b43d1,null))[_0xe31e('0x4d')](handleError(_0x2b43d1,null));};exports[_0xe31e('0x5c')]=function(_0x22e097,_0x3243ac,_0x5380f3){var _0x150080={'raw':![],'where':{}};var _0x2452e7={};var _0x101149={'count':0x0,'rows':[]};return db[_0xe31e('0x33')][_0xe31e('0x5d')]({'where':{'id':_0x22e097[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x3243ac,null))[_0xe31e('0x2a')](function(_0x27bf38){if(_0x27bf38){_0x2452e7[_0xe31e('0x37')]=_[_0xe31e('0x39')](db['Disposition']['rawAttributes']);_0x2452e7[_0xe31e('0x38')]=_[_0xe31e('0x39')](_0x22e097[_0xe31e('0x38')]);_0x2452e7[_0xe31e('0x3a')]=_['intersection'](_0x2452e7[_0xe31e('0x37')],_0x2452e7[_0xe31e('0x38')]);_0x150080['attributes']=_['intersection'](_0x2452e7[_0xe31e('0x37')],qs[_0xe31e('0x3d')](_0x22e097['query'][_0xe31e('0x3d')]));_0x150080[_0xe31e('0x3c')]=_0x150080[_0xe31e('0x3c')]['length']?_0x150080[_0xe31e('0x3c')]:_0x2452e7[_0xe31e('0x37')];if(!_0x22e097[_0xe31e('0x38')][_0xe31e('0x3f')](_0xe31e('0x40'))){_0x150080['limit']=qs['limit'](_0x22e097[_0xe31e('0x38')][_0xe31e('0x41')]);_0x150080['offset']=qs['offset'](_0x22e097[_0xe31e('0x38')][_0xe31e('0x21')]);}_0x150080[_0xe31e('0x42')]=qs[_0xe31e('0x43')](_0x22e097['query'][_0xe31e('0x43')]);_0x150080[_0xe31e('0x46')]=qs[_0xe31e('0x3a')](_[_0xe31e('0x44')](_0x22e097[_0xe31e('0x38')],_0x2452e7[_0xe31e('0x3a')]));_0x150080[_0xe31e('0x46')][_0xe31e('0x5a')]=_0x27bf38['id'];if(_0x22e097[_0xe31e('0x38')][_0xe31e('0x45')]){_0x150080['where']=_[_0xe31e('0x48')](_0x150080[_0xe31e('0x46')],{'$or':_[_0xe31e('0x32')](_0x150080[_0xe31e('0x3c')],function(_0x3e4631){var _0x5d8ea9={};_0x5d8ea9[_0x3e4631]={'$like':'%'+_0x22e097['query'][_0xe31e('0x45')]+'%'};return _0x5d8ea9;})});}_0x150080=_[_0xe31e('0x48')]({},_0x150080,_0x22e097[_0xe31e('0x49')]);return db['Disposition'][_0xe31e('0x23')]({'where':_0x150080[_0xe31e('0x46')]})['then'](function(_0x321886){_0x101149[_0xe31e('0x23')]=_0x321886;if(_0x22e097[_0xe31e('0x38')][_0xe31e('0x4a')]){_0x150080[_0xe31e('0x4b')]=[{'all':!![]}];}return db[_0xe31e('0x5b')]['findAll'](_0x150080);})[_0xe31e('0x2a')](function(_0x518e61){_0x101149[_0xe31e('0x4c')]=_0x518e61;return _0x101149;});}})[_0xe31e('0x2a')](respondWithFilteredResult(_0x3243ac,_0x150080))[_0xe31e('0x4d')](handleError(_0x3243ac,null));};exports['removeDispositions']=function(_0x547af7,_0x3ba8a0,_0x23bf5b){return db['CmList']['find']({'where':{'id':_0x547af7[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x3ba8a0,null))['then'](function(_0x2f0685){if(_0x2f0685){return _0x2f0685[_0xe31e('0x5e')](_0x547af7[_0xe31e('0x38')][_0xe31e('0x5f')]);}})[_0xe31e('0x2a')](respondWithStatusCode(_0x3ba8a0,null))['catch'](handleError(_0x3ba8a0,null));};exports[_0xe31e('0x60')]=function(_0x4db964,_0x3b22db,_0x236407){return db[_0xe31e('0x33')][_0xe31e('0x4f')]({'where':{'id':_0x4db964['params']['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x3b22db,null))[_0xe31e('0x2a')](function(_0x29bb39){if(_0x29bb39){var _0xc5dcb6=[];var _0x2d8399={'success':[],'errors':[]};return db[_0xe31e('0x61')][_0xe31e('0x58')]()[_0xe31e('0x2a')](function(_0x1aa950){if(_0x4db964[_0xe31e('0x51')][_0xe31e('0x62')]&&_['isArray'](_0x4db964['body'][_0xe31e('0x62')])){if(_0x4db964[_0xe31e('0x51')]['tags']['length']){_0x4db964[_0xe31e('0x51')][_0xe31e('0x62')]=_0x4db964['body'][_0xe31e('0x62')][_0xe31e('0x63')](';')+';';}else{_0x4db964[_0xe31e('0x51')][_0xe31e('0x62')]=null;}}else{_0x4db964[_0xe31e('0x51')]['tags']=null;}if(_0x4db964['body']&&_[_0xe31e('0x64')](_0x4db964[_0xe31e('0x51')])){for(var _0x56adfe=0x0;_0x56adfe<_0x4db964['body'][_0xe31e('0x3e')];_0x56adfe+=0x1){_0x4db964[_0xe31e('0x51')][_0x56adfe][_0xe31e('0x5a')]=_0x4db964[_0xe31e('0x4e')]['id'];_0xc5dcb6[_0xe31e('0x65')](_0x4db964[_0xe31e('0x51')][_0x56adfe]);}return BPromise[_0xe31e('0x66')](_0xc5dcb6,function(_0x11f508){return db[_0xe31e('0x61')]['create'](_[_0xe31e('0x67')](_0x11f508,[_0xe31e('0x5f'),'id'])||{},{'fields':_[_0xe31e('0x39')](_0x1aa950),'raw':!![]})[_0xe31e('0x2a')](function(_0x5f4f10){_0x2d8399['success'][_0xe31e('0x65')](_0x5f4f10[_0xe31e('0x68')]);})[_0xe31e('0x4d')](function(_0x483408){_0x2d8399[_0xe31e('0x69')][_0xe31e('0x65')]({'data':_0x11f508,'error':_0x483408['message']});});})[_0xe31e('0x2a')](function(_0x472397){return _0x2d8399;})[_0xe31e('0x4d')](function(_0x2e1a63){return _0x2e1a63;});}else{_0x3b22db[_0xe31e('0x1e')](0x190)[_0xe31e('0x20')]({'message':_0xe31e('0x6a')});}});}})['then'](respondWithResult(_0x3b22db,null))[_0xe31e('0x4d')](handleError(_0x3b22db,null));};exports[_0xe31e('0x6b')]=function(_0x1e48bb,_0x43bafc,_0x428f8a){var _0x3f13bd;return db[_0xe31e('0x33')]['find']({'where':{'id':_0x1e48bb[_0xe31e('0x4e')]['id']},'include':[{'model':db[_0xe31e('0x6c')],'as':_0xe31e('0x6d')}]})[_0xe31e('0x2a')](handleEntityNotFound(_0x43bafc,null))[_0xe31e('0x2a')](function(_0x51b195){if(_0x51b195){_0x3f13bd=_0x51b195;return db[_0xe31e('0x61')][_0xe31e('0x34')];}})[_0xe31e('0x2a')](function(_0x4f9102){if(_0x4f9102){var _0x161eb6={};var _0x89d13={};_0x89d13[_0xe31e('0x37')]=_[_0xe31e('0x6e')](_[_0xe31e('0x39')](_0x4f9102),_['map'](_0x3f13bd[_0xe31e('0x6d')],function(_0x5db058){return util[_0xe31e('0x6f')](_0xe31e('0x70'),_0x5db058['id']);}));_0x89d13['query']=_[_0xe31e('0x39')](_0x1e48bb[_0xe31e('0x38')]);_0x89d13[_0xe31e('0x3a')]=_[_0xe31e('0x3b')](_0x89d13[_0xe31e('0x37')],_0x89d13[_0xe31e('0x38')]);_0x161eb6[_0xe31e('0x3c')]=_[_0xe31e('0x3b')](_0x89d13[_0xe31e('0x37')],qs[_0xe31e('0x3d')](_0x1e48bb[_0xe31e('0x38')][_0xe31e('0x3d')]));_0x161eb6[_0xe31e('0x3c')]=_0x161eb6[_0xe31e('0x3c')]['length']?_0x161eb6[_0xe31e('0x3c')]:_0x89d13[_0xe31e('0x37')];if(!_0x1e48bb['query'][_0xe31e('0x3f')](_0xe31e('0x40'))){_0x161eb6[_0xe31e('0x41')]=qs['limit'](_0x1e48bb[_0xe31e('0x38')][_0xe31e('0x41')]);_0x161eb6['offset']=qs['offset'](_0x1e48bb['query'][_0xe31e('0x21')]);}_0x161eb6[_0xe31e('0x42')]=qs[_0xe31e('0x43')](_0x1e48bb[_0xe31e('0x38')][_0xe31e('0x43')]);_0x161eb6[_0xe31e('0x46')]=qs[_0xe31e('0x3a')](_[_0xe31e('0x44')](_0x1e48bb[_0xe31e('0x38')],_0x89d13[_0xe31e('0x3a')]));_0x161eb6[_0xe31e('0x71')]=!![];if(_0x1e48bb['query']['filter']){_0x161eb6['where']=_[_0xe31e('0x48')](_0x161eb6['where'],{'$or':_['map'](_0x161eb6[_0xe31e('0x3c')],function(_0x1ea80d){var _0x4c4c88={};_0x4c4c88[_0x1ea80d]={'$like':'%'+_0x1e48bb[_0xe31e('0x38')][_0xe31e('0x45')]+'%'};return _0x4c4c88;})});}_0x161eb6=_[_0xe31e('0x48')]({},_0x161eb6,_0x1e48bb['options']);return _0x3f13bd[_0xe31e('0x6b')](_0x161eb6);}})[_0xe31e('0x2a')](respondWithResult(_0x43bafc,null))[_0xe31e('0x4d')](handleError(_0x43bafc,null));};exports[_0xe31e('0x72')]=function(_0x26722b,_0x2da85f,_0xe4c25){var _0x27b769;return db['CmList'][_0xe31e('0x4f')]({'where':{'id':_0x26722b[_0xe31e('0x4e')]['id']},'include':[{'model':db[_0xe31e('0x6c')],'as':_0xe31e('0x6d')}]})[_0xe31e('0x2a')](handleEntityNotFound(_0x2da85f,null))['then'](function(_0x2aa683){if(_0x2aa683){_0x27b769=_0x2aa683;return db[_0xe31e('0x61')][_0xe31e('0x34')];}})[_0xe31e('0x2a')](function(_0x33ff93){if(_0x33ff93){var _0x5b3932={};var _0x1a75d3={};_0x1a75d3[_0xe31e('0x37')]=_[_0xe31e('0x6e')](_[_0xe31e('0x39')](_0x33ff93),_[_0xe31e('0x32')](_0x27b769['CustomFields'],function(_0x448470){return util[_0xe31e('0x6f')](_0xe31e('0x70'),_0x448470['id']);}));_0x1a75d3[_0xe31e('0x38')]=_[_0xe31e('0x39')](_0x26722b['query']);_0x1a75d3['filters']=_[_0xe31e('0x3b')](_0x1a75d3['model'],_0x1a75d3[_0xe31e('0x38')]);_0x5b3932[_0xe31e('0x3c')]=_[_0xe31e('0x3b')](_0x1a75d3[_0xe31e('0x37')],qs[_0xe31e('0x3d')](_0x26722b['query'][_0xe31e('0x3d')]));_0x5b3932[_0xe31e('0x3c')]=_0x5b3932[_0xe31e('0x3c')][_0xe31e('0x3e')]?_0x5b3932['attributes']:_0x1a75d3['model'];if(!_0x26722b[_0xe31e('0x38')]['hasOwnProperty']('nolimit')){_0x5b3932['limit']=qs[_0xe31e('0x41')](_0x26722b[_0xe31e('0x38')][_0xe31e('0x41')]);_0x5b3932[_0xe31e('0x21')]=qs['offset'](_0x26722b[_0xe31e('0x38')]['offset']);}_0x5b3932[_0xe31e('0x42')]=qs['sort'](_0x26722b[_0xe31e('0x38')][_0xe31e('0x43')]);_0x5b3932[_0xe31e('0x46')]=qs[_0xe31e('0x3a')](_['pick'](_0x26722b[_0xe31e('0x38')],_0x1a75d3['filters']));_0x5b3932[_0xe31e('0x71')]=!![];if(_0x26722b[_0xe31e('0x38')][_0xe31e('0x45')]){_0x5b3932[_0xe31e('0x46')]=_[_0xe31e('0x48')](_0x5b3932['where'],{'$or':_[_0xe31e('0x32')](_0x5b3932[_0xe31e('0x3c')],function(_0x4f7417){var _0x5c06ab={};_0x5c06ab[_0x4f7417]={'$like':'%'+_0x26722b[_0xe31e('0x38')][_0xe31e('0x45')]+'%'};return _0x5c06ab;})});}_0x5b3932=_[_0xe31e('0x48')]({},_0x5b3932,_0x26722b[_0xe31e('0x49')]);return _0x27b769['getContacts'](_0x5b3932);}})[_0xe31e('0x2a')](function(_0x2557e1){if(!_['isEmpty'](_0x2557e1)){var _0x21e43d=toCsv(_0x2557e1);var _0x5386c0=Date[_0xe31e('0x73')]();fs[_0xe31e('0x74')](util[_0xe31e('0x6f')]('/tmp/list_%d_%s.csv',_0x27b769['id'],_0x5386c0),_0x21e43d);_0x2da85f[_0xe31e('0x75')](_0xe31e('0x76'),'attachment;\x20filename='+util[_0xe31e('0x6f')]('list_%d_%s.csv',_0x27b769['id'],_0x5386c0));_0x2da85f['setHeader'](_0xe31e('0x77'),'text/csv');return _0x2da85f[_0xe31e('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x27b769['id'],_0x5386c0));}else{return _0x2da85f['sendStatus'](0xcc);}})[_0xe31e('0x4d')](handleError(_0x2da85f,null));};exports['addCustomField']=function(_0x48d5ff,_0x5b13e3,_0x36e35b){var _0x55d71a;delete _0x48d5ff[_0xe31e('0x51')]['id'];return db[_0xe31e('0x33')][_0xe31e('0x5d')]({'where':{'id':_0x48d5ff[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x5b13e3,null))[_0xe31e('0x2a')](function(_0x144840){if(_0x144840){return db[_0xe31e('0x79')][_0xe31e('0x7a')](function(_0x53d17b){return db[_0xe31e('0x6c')][_0xe31e('0x50')](_0x48d5ff[_0xe31e('0x51')],{'transaction':_0x53d17b})[_0xe31e('0x2a')](function(_0x4c5a45){_0x55d71a=_0x4c5a45;return _0x144840[_0xe31e('0x7b')](_0x4c5a45,{'transaction':_0x53d17b});})[_0xe31e('0x2a')](function(){var _0x51b370={'type':db[_0xe31e('0x7c')]['TEXT'],'transaction':_0x53d17b};switch(_0x48d5ff[_0xe31e('0x51')]['type']){case _0xe31e('0x7d'):_0x51b370['type']=db[_0xe31e('0x7c')][_0xe31e('0x7e')];break;case _0xe31e('0x7f'):_0x51b370['type']=db[_0xe31e('0x7c')][_0xe31e('0x80')];break;case _0xe31e('0x81'):_0x51b370[_0xe31e('0x82')]=db[_0xe31e('0x7c')][_0xe31e('0x83')];_0x51b370[_0xe31e('0x84')]=![];break;default:}return db[_0xe31e('0x79')][_0xe31e('0x85')][_0xe31e('0x86')]('cm_contacts',util[_0xe31e('0x6f')]('cf_%s',_0x55d71a['id']),_0x51b370);})['then'](function(){return _0x55d71a;});});}})[_0xe31e('0x2a')](respondWithResult(_0x5b13e3,null))[_0xe31e('0x4d')](handleError(_0x5b13e3,null));};exports[_0xe31e('0x87')]=function(_0x4c7561,_0x386016,_0x3ce60b){var _0x409ba5={};var _0xcd1786={};var _0x2c0119;var _0x271ec0;return db[_0xe31e('0x33')]['findOne']({'where':{'id':_0x4c7561[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x386016,null))[_0xe31e('0x2a')](function(_0x5b7d24){if(_0x5b7d24){_0x2c0119=_0x5b7d24;_0xcd1786['model']=_[_0xe31e('0x39')](db[_0xe31e('0x6c')]['rawAttributes']);_0xcd1786[_0xe31e('0x38')]=_[_0xe31e('0x39')](_0x4c7561[_0xe31e('0x38')]);_0xcd1786[_0xe31e('0x3a')]=_[_0xe31e('0x3b')](_0xcd1786['model'],_0xcd1786[_0xe31e('0x38')]);_0x409ba5[_0xe31e('0x3c')]=_[_0xe31e('0x3b')](_0xcd1786[_0xe31e('0x37')],qs['fields'](_0x4c7561[_0xe31e('0x38')]['fields']));_0x409ba5[_0xe31e('0x3c')]=_0x409ba5[_0xe31e('0x3c')]['length']?_0x409ba5['attributes']:_0xcd1786['model'];_0x409ba5[_0xe31e('0x42')]=qs[_0xe31e('0x43')](_0x4c7561[_0xe31e('0x38')][_0xe31e('0x43')]);_0x409ba5['where']=qs[_0xe31e('0x3a')](_[_0xe31e('0x44')](_0x4c7561[_0xe31e('0x38')],_0xcd1786[_0xe31e('0x3a')]));_0x409ba5[_0xe31e('0x46')]=_[_0xe31e('0x48')](_0x409ba5[_0xe31e('0x46')],{'$or':[{'ListId':_0x5b7d24['id']},{'ListId':null}]});if(_0x4c7561[_0xe31e('0x38')][_0xe31e('0x45')]){_0x409ba5[_0xe31e('0x46')]=_[_0xe31e('0x48')](_0x409ba5['where'],{'$or':_[_0xe31e('0x32')](_0x409ba5[_0xe31e('0x3c')],function(_0x59033f){var _0x484e5c={};_0x484e5c[_0x59033f]={'$like':'%'+_0x4c7561[_0xe31e('0x38')][_0xe31e('0x45')]+'%'};return _0x484e5c;})});}_0x409ba5=_[_0xe31e('0x48')]({},_0x409ba5,_0x4c7561[_0xe31e('0x49')]);return db[_0xe31e('0x6c')]['findAndCountAll'](_0x409ba5);}})[_0xe31e('0x2a')](respondWithResult(_0x386016,null))[_0xe31e('0x4d')](handleError(_0x386016,null));};exports[_0xe31e('0x88')]=function(_0x19e839,_0x4a58fe,_0x564c24){return db['CmList'][_0xe31e('0x4f')]({'where':{'id':_0x19e839[_0xe31e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4a58fe,null))[_0xe31e('0x2a')](function(_0x4a0bff){if(_0x4a0bff){return _0x4a0bff[_0xe31e('0x88')](_0x19e839[_0xe31e('0x51')][_0xe31e('0x5f')],_['omit'](_0x19e839[_0xe31e('0x51')],[_0xe31e('0x5f'),'id'])||{})[_0xe31e('0x89')](function(_0x41b716){for(var _0x30b442=0x0;_0x30b442<_0x19e839[_0xe31e('0x51')][_0xe31e('0x5f')][_0xe31e('0x3e')];_0x30b442+=0x1){socket[_0xe31e('0x8a')](_0xe31e('0x8b'),{'UserId':Number(_0x19e839[_0xe31e('0x51')]['ids'][_0x30b442]),'CmListId':Number(_0x19e839['params']['id'])});}return _0x41b716;});}})[_0xe31e('0x2a')](respondWithResult(_0x4a58fe,null))[_0xe31e('0x4d')](handleError(_0x4a58fe,null));};exports[_0xe31e('0x8c')]=function(_0x951152,_0x3d1b6e,_0x150c4c){return db[_0xe31e('0x33')][_0xe31e('0x4f')]({'where':{'id':_0x951152[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x3d1b6e,null))[_0xe31e('0x2a')](function(_0x3876c0){if(_0x3876c0){return _0x3876c0[_0xe31e('0x8c')](_0x951152[_0xe31e('0x38')]['ids'])[_0xe31e('0x2a')](function(){if(_[_0xe31e('0x64')](_0x951152[_0xe31e('0x38')]['ids'])){for(var _0x3ea212=0x0;_0x3ea212<_0x951152[_0xe31e('0x38')][_0xe31e('0x5f')]['length'];_0x3ea212+=0x1){socket[_0xe31e('0x8a')](_0xe31e('0x8d'),{'UserId':Number(_0x951152[_0xe31e('0x38')][_0xe31e('0x5f')][_0x3ea212]),'CmListId':Number(_0x951152[_0xe31e('0x4e')]['id'])});}}else{socket[_0xe31e('0x8a')](_0xe31e('0x8d'),{'UserId':Number(_0x951152['query']['ids']),'CmListId':Number(_0x951152[_0xe31e('0x4e')]['id'])});}});}})[_0xe31e('0x2a')](respondWithStatusCode(_0x3d1b6e,null))[_0xe31e('0x4d')](handleError(_0x3d1b6e,null));};exports[_0xe31e('0x8e')]=function(_0xea23a2,_0x315033,_0xebb2f8){var _0x590de3={};var _0x463586={};var _0x20e9b4;var _0x328239;return db[_0xe31e('0x33')][_0xe31e('0x5d')]({'where':{'id':_0xea23a2[_0xe31e('0x4e')]['id']}})[_0xe31e('0x2a')](handleEntityNotFound(_0x315033,null))[_0xe31e('0x2a')](function(_0x165e3a){if(_0x165e3a){_0x20e9b4=_0x165e3a;_0x463586['model']=_[_0xe31e('0x39')](db[_0xe31e('0x8f')][_0xe31e('0x34')]);_0x463586[_0xe31e('0x38')]=_[_0xe31e('0x39')](_0xea23a2[_0xe31e('0x38')]);_0x463586[_0xe31e('0x3a')]=_[_0xe31e('0x3b')](_0x463586['model'],_0x463586['query']);_0x590de3[_0xe31e('0x3c')]=_[_0xe31e('0x3b')](_0x463586[_0xe31e('0x37')],qs[_0xe31e('0x3d')](_0xea23a2['query']['fields']));_0x590de3[_0xe31e('0x3c')]=_0x590de3['attributes'][_0xe31e('0x3e')]?_0x590de3[_0xe31e('0x3c')]:_0x463586[_0xe31e('0x37')];_0x590de3['order']=qs[_0xe31e('0x43')](_0xea23a2[_0xe31e('0x38')][_0xe31e('0x43')]);_0x590de3['where']=qs[_0xe31e('0x3a')](_[_0xe31e('0x44')](_0xea23a2[_0xe31e('0x38')],_0x463586[_0xe31e('0x3a')]));if(_0xea23a2[_0xe31e('0x38')]['filter']){_0x590de3[_0xe31e('0x46')]=_[_0xe31e('0x48')](_0x590de3[_0xe31e('0x46')],{'$or':_[_0xe31e('0x32')](_0x590de3[_0xe31e('0x3c')],function(_0x12d9ec){var _0xb345bd={};_0xb345bd[_0x12d9ec]={'$like':'%'+_0xea23a2['query'][_0xe31e('0x45')]+'%'};return _0xb345bd;})});}_0x590de3=_[_0xe31e('0x48')]({},_0x590de3,_0xea23a2['options']);return _0x20e9b4[_0xe31e('0x8e')](_0x590de3);}})[_0xe31e('0x2a')](function(_0x2c53f1){if(_0x2c53f1){_0x328239=_0x2c53f1['length'];if(!_0xea23a2[_0xe31e('0x38')][_0xe31e('0x3f')](_0xe31e('0x40'))){_0x590de3[_0xe31e('0x41')]=qs['limit'](_0xea23a2[_0xe31e('0x38')][_0xe31e('0x41')]);_0x590de3[_0xe31e('0x21')]=qs[_0xe31e('0x21')](_0xea23a2[_0xe31e('0x38')][_0xe31e('0x21')]);}return _0x20e9b4['getAgents'](_0x590de3);}})[_0xe31e('0x2a')](function(_0x21ccdb){if(_0x21ccdb){return _0x21ccdb?{'count':_0x328239,'rows':_0x21ccdb}:null;}})[_0xe31e('0x2a')](respondWithResult(_0x315033,null))[_0xe31e('0x4d')](handleError(_0x315033,null));}; \ No newline at end of file +var _0x03f9=['type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','sort','ListId','rows','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','sequelize','transaction','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','emit','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./cmList.socket','register','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','update','then','get','Lists','UserProfileResource','destroy','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','filter','merge'];(function(_0x41a0f5,_0x12b1a0){var _0x13ce42=function(_0x12dee8){while(--_0x12dee8){_0x41a0f5['push'](_0x41a0f5['shift']());}};_0x13ce42(++_0x12b1a0);}(_0x03f9,0x17b));var _0x903f=function(_0x58f1ef,_0x4cf4d5){_0x58f1ef=_0x58f1ef-0x0;var _0x2ef772=_0x03f9[_0x58f1ef];return _0x2ef772;};'use strict';var emlformat=require(_0x903f('0x0'));var rimraf=require(_0x903f('0x1'));var zipdir=require(_0x903f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x903f('0x3'));var moment=require('moment');var BPromise=require(_0x903f('0x4'));var Mustache=require(_0x903f('0x5'));var util=require(_0x903f('0x6'));var path=require(_0x903f('0x7'));var sox=require(_0x903f('0x8'));var csv=require(_0x903f('0x9'));var ejs=require(_0x903f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x903f('0xb'));var squel=require(_0x903f('0xc'));var crypto=require(_0x903f('0xd'));var jsforce=require(_0x903f('0xe'));var deskjs=require(_0x903f('0xf'));var toCsv=require(_0x903f('0x9'));var querystring=require(_0x903f('0x10'));var Papa=require(_0x903f('0x11'));var Redis=require(_0x903f('0x12'));var authService=require(_0x903f('0x13'));var qs=require(_0x903f('0x14'));var as=require(_0x903f('0x15'));var hardwareService=require(_0x903f('0x16'));var logger=require(_0x903f('0x17'))(_0x903f('0x18'));var utils=require(_0x903f('0x19'));var config=require(_0x903f('0x1a'));var licenseUtil=require(_0x903f('0x1b'));var db=require(_0x903f('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x903f('0x1d'))(new Redis(config[_0x903f('0x1e')]));require(_0x903f('0x1f'))[_0x903f('0x20')](socket);function respondWithStatusCode(_0xa0b77c,_0x1f108b){_0x1f108b=_0x1f108b||0xcc;return function(_0x1c6882){if(_0x1c6882){return _0xa0b77c[_0x903f('0x21')](_0x1f108b);}return _0xa0b77c[_0x903f('0x22')](_0x1f108b)['end']();};}function respondWithResult(_0x4f15ff,_0x160982){_0x160982=_0x160982||0xc8;return function(_0x492bc1){if(_0x492bc1){return _0x4f15ff[_0x903f('0x22')](_0x160982)['json'](_0x492bc1);}};}function respondWithFilteredResult(_0x552119,_0x53d3fd){return function(_0xfc2e80){if(_0xfc2e80){var _0x135068=typeof _0x53d3fd[_0x903f('0x23')]==='undefined'&&typeof _0x53d3fd[_0x903f('0x24')]===_0x903f('0x25');var _0x103eb2=_0xfc2e80['count'];var _0x534ece=_0x135068?0x0:_0x53d3fd[_0x903f('0x23')];var _0xc66b48=_0x135068?_0xfc2e80[_0x903f('0x26')]:_0x53d3fd[_0x903f('0x23')]+_0x53d3fd[_0x903f('0x24')];var _0x541a56;if(_0xc66b48>=_0x103eb2){_0xc66b48=_0x103eb2;_0x541a56=0xc8;}else{_0x541a56=0xce;}_0x552119[_0x903f('0x22')](_0x541a56);return _0x552119[_0x903f('0x27')]('Content-Range',_0x534ece+'-'+_0xc66b48+'/'+_0x103eb2)[_0x903f('0x28')](_0xfc2e80);}return null;};}function patchUpdates(_0x5261a9){return function(_0x283404){try{jsonpatch[_0x903f('0x29')](_0x283404,_0x5261a9,!![]);}catch(_0x916c1){return BPromise[_0x903f('0x2a')](_0x916c1);}return _0x283404['save']();};}function saveUpdates(_0x39dde7,_0x291f61){return function(_0x26682b){if(_0x26682b){return _0x26682b[_0x903f('0x2b')](_0x39dde7)['then'](function(_0xc609ca){return _0xc609ca;});}return null;};}function removeEntity(_0x276abd,_0x3dfc63){return function(_0x2bee28){if(_0x2bee28){return _0x2bee28['destroy']()[_0x903f('0x2c')](function(){var _0x316cfd=_0x2bee28[_0x903f('0x2d')]({'plain':!![]});var _0x179402=_0x903f('0x2e');return db[_0x903f('0x2f')][_0x903f('0x30')]({'where':{'type':_0x179402,'resourceId':_0x316cfd['id']}})[_0x903f('0x2c')](function(){return _0x2bee28;});})['then'](function(){_0x276abd[_0x903f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32f08c,_0x3ce334){return function(_0x238735){if(!_0x238735){_0x32f08c[_0x903f('0x21')](0x194);}return _0x238735;};}function handleError(_0x3d8db3,_0x1f2e13){_0x1f2e13=_0x1f2e13||0x1f4;return function(_0x4d19ca){logger['error'](_0x4d19ca[_0x903f('0x31')]);if(_0x4d19ca[_0x903f('0x32')]){delete _0x4d19ca['name'];}_0x3d8db3[_0x903f('0x22')](_0x1f2e13)[_0x903f('0x33')](_0x4d19ca);};}exports[_0x903f('0x34')]=function(_0x3c50eb,_0x445ac4){var _0x418ed7={},_0x10e20e={},_0x4d20c2={'count':0x0,'rows':[]};var _0x39c3c8=_[_0x903f('0x35')](db[_0x903f('0x36')][_0x903f('0x37')],function(_0x4a4283){return{'name':_0x4a4283[_0x903f('0x38')],'type':_0x4a4283['type'][_0x903f('0x39')]};});_0x10e20e[_0x903f('0x3a')]=_[_0x903f('0x35')](_0x39c3c8,_0x903f('0x32'));_0x10e20e[_0x903f('0x3b')]=_['keys'](_0x3c50eb[_0x903f('0x3b')]);_0x10e20e['filters']=_[_0x903f('0x3c')](_0x10e20e[_0x903f('0x3a')],_0x10e20e[_0x903f('0x3b')]);_0x418ed7['attributes']=_[_0x903f('0x3c')](_0x10e20e['model'],qs['fields'](_0x3c50eb[_0x903f('0x3b')][_0x903f('0x3d')]));_0x418ed7[_0x903f('0x3e')]=_0x418ed7[_0x903f('0x3e')][_0x903f('0x3f')]?_0x418ed7['attributes']:_0x10e20e[_0x903f('0x3a')];if(!_0x3c50eb[_0x903f('0x3b')][_0x903f('0x40')]('nolimit')){_0x418ed7['limit']=qs['limit'](_0x3c50eb[_0x903f('0x3b')][_0x903f('0x24')]);_0x418ed7[_0x903f('0x23')]=qs[_0x903f('0x23')](_0x3c50eb[_0x903f('0x3b')]['offset']);}_0x418ed7[_0x903f('0x41')]=qs['sort'](_0x3c50eb[_0x903f('0x3b')]['sort']);_0x418ed7[_0x903f('0x42')]=qs[_0x903f('0x43')](_[_0x903f('0x44')](_0x3c50eb[_0x903f('0x3b')],_0x10e20e[_0x903f('0x43')]),_0x39c3c8);if(_0x3c50eb['query'][_0x903f('0x45')]){_0x418ed7[_0x903f('0x42')]=_[_0x903f('0x46')](_0x418ed7[_0x903f('0x42')],{'$or':_['map'](_0x39c3c8,function(_0x35f803){if(_0x35f803[_0x903f('0x47')]!==_0x903f('0x48')){var _0x297b54={};_0x297b54[_0x35f803['name']]={'$like':'%'+_0x3c50eb[_0x903f('0x3b')][_0x903f('0x45')]+'%'};return _0x297b54;}})});}_0x418ed7=_['merge']({},_0x418ed7,_0x3c50eb['options']);var _0x3bfa49={'where':_0x418ed7['where']};return db[_0x903f('0x36')][_0x903f('0x26')](_0x3bfa49)[_0x903f('0x2c')](function(_0x37f0f6){_0x4d20c2[_0x903f('0x26')]=_0x37f0f6;if(_0x3c50eb['query'][_0x903f('0x49')]){_0x418ed7[_0x903f('0x4a')]=[{'all':!![]}];}return db[_0x903f('0x36')][_0x903f('0x4b')](_0x418ed7);})['then'](function(_0x50d812){_0x4d20c2['rows']=_0x50d812;return _0x4d20c2;})['then'](respondWithFilteredResult(_0x445ac4,_0x418ed7))[_0x903f('0x4c')](handleError(_0x445ac4,null));};exports[_0x903f('0x4d')]=function(_0x5a84f7,_0x35b7a0){var _0x15af40={'raw':![],'where':{'id':_0x5a84f7[_0x903f('0x4e')]['id']}},_0x3134d7={};_0x3134d7[_0x903f('0x3a')]=_[_0x903f('0x4f')](db['CmList'][_0x903f('0x37')]);_0x3134d7['query']=_[_0x903f('0x4f')](_0x5a84f7[_0x903f('0x3b')]);_0x3134d7['filters']=_[_0x903f('0x3c')](_0x3134d7['model'],_0x3134d7[_0x903f('0x3b')]);_0x15af40[_0x903f('0x3e')]=_['intersection'](_0x3134d7[_0x903f('0x3a')],qs[_0x903f('0x3d')](_0x5a84f7[_0x903f('0x3b')][_0x903f('0x3d')]));_0x15af40[_0x903f('0x3e')]=_0x15af40[_0x903f('0x3e')][_0x903f('0x3f')]?_0x15af40['attributes']:_0x3134d7[_0x903f('0x3a')];if(_0x5a84f7[_0x903f('0x3b')][_0x903f('0x49')]){_0x15af40[_0x903f('0x4a')]=[{'all':!![]}];}_0x15af40=_[_0x903f('0x46')]({},_0x15af40,_0x5a84f7[_0x903f('0x50')]);return db[_0x903f('0x36')][_0x903f('0x51')](_0x15af40)[_0x903f('0x2c')](handleEntityNotFound(_0x35b7a0,null))[_0x903f('0x2c')](respondWithResult(_0x35b7a0,null))[_0x903f('0x4c')](handleError(_0x35b7a0,null));};exports[_0x903f('0x52')]=function(_0x1456eb,_0x5c86c4){return db[_0x903f('0x36')]['create'](_0x1456eb[_0x903f('0x53')],{})[_0x903f('0x2c')](function(_0x3e78e0){var _0x1fd50b=_0x1456eb[_0x903f('0x54')][_0x903f('0x2d')]({'plain':!![]});if(!_0x1fd50b)throw new Error(_0x903f('0x55'));if(_0x1fd50b[_0x903f('0x56')]==='user'){var _0x264a11=_0x3e78e0[_0x903f('0x2d')]({'plain':!![]});var _0x2e076f=_0x903f('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x2e076f,'userProfileId':_0x1fd50b[_0x903f('0x57')]},'raw':!![]})[_0x903f('0x2c')](function(_0x3f8753){if(_0x3f8753&&_0x3f8753[_0x903f('0x58')]===0x0){return db[_0x903f('0x2f')][_0x903f('0x52')]({'name':_0x264a11[_0x903f('0x32')],'resourceId':_0x264a11['id'],'type':_0x3f8753['name'],'sectionId':_0x3f8753['id']},{})[_0x903f('0x2c')](function(){return _0x3e78e0;});}else{return _0x3e78e0;}})[_0x903f('0x4c')](function(_0x1dad95){logger[_0x903f('0x59')](_0x903f('0x5a'),_0x1dad95);throw _0x1dad95;});}return _0x3e78e0;})[_0x903f('0x2c')](respondWithResult(_0x5c86c4,0xc9))['catch'](handleError(_0x5c86c4,null));};exports[_0x903f('0x2b')]=function(_0x21feef,_0x3feea5){if(_0x21feef[_0x903f('0x53')]['id']){delete _0x21feef['body']['id'];}return db['CmList'][_0x903f('0x51')]({'where':{'id':_0x21feef[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x3feea5,null))[_0x903f('0x2c')](saveUpdates(_0x21feef[_0x903f('0x53')],null))['then'](respondWithResult(_0x3feea5,null))['catch'](handleError(_0x3feea5,null));};exports[_0x903f('0x30')]=function(_0x810c4a,_0x5a5f88){return db[_0x903f('0x36')][_0x903f('0x51')]({'where':{'id':_0x810c4a[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x5a5f88,null))['then'](removeEntity(_0x5a5f88,null))['catch'](handleError(_0x5a5f88,null));};exports['describe']=function(_0x36cb6d,_0x9c7db2){return db[_0x903f('0x36')][_0x903f('0x5b')]()[_0x903f('0x2c')](respondWithResult(_0x9c7db2,null))[_0x903f('0x4c')](handleError(_0x9c7db2,null));};exports[_0x903f('0x5c')]=function(_0x22eb34,_0x4a4ce2,_0x2615b2){if(_0x22eb34[_0x903f('0x53')]['id']){delete _0x22eb34[_0x903f('0x53')]['id'];}return db[_0x903f('0x36')][_0x903f('0x51')]({'where':{'id':_0x22eb34[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x4a4ce2,null))[_0x903f('0x2c')](function(_0x2dcb05){if(_0x2dcb05){_0x22eb34[_0x903f('0x53')]['ListId']=_0x2dcb05['id'];return db[_0x903f('0x5d')][_0x903f('0x52')](_0x22eb34[_0x903f('0x53')]);}})[_0x903f('0x2c')](respondWithResult(_0x4a4ce2,null))[_0x903f('0x4c')](handleError(_0x4a4ce2,null));};exports[_0x903f('0x5e')]=function(_0x59132a,_0x3aaceb,_0x773fce){var _0x44186a={'raw':![],'where':{}};var _0x416a44={};var _0x217312={'count':0x0,'rows':[]};return db[_0x903f('0x36')][_0x903f('0x5f')]({'where':{'id':_0x59132a[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x3aaceb,null))[_0x903f('0x2c')](function(_0x189bfb){if(_0x189bfb){_0x416a44[_0x903f('0x3a')]=_[_0x903f('0x4f')](db[_0x903f('0x5d')]['rawAttributes']);_0x416a44[_0x903f('0x3b')]=_[_0x903f('0x4f')](_0x59132a[_0x903f('0x3b')]);_0x416a44[_0x903f('0x43')]=_[_0x903f('0x3c')](_0x416a44[_0x903f('0x3a')],_0x416a44['query']);_0x44186a[_0x903f('0x3e')]=_['intersection'](_0x416a44['model'],qs[_0x903f('0x3d')](_0x59132a[_0x903f('0x3b')]['fields']));_0x44186a['attributes']=_0x44186a[_0x903f('0x3e')][_0x903f('0x3f')]?_0x44186a[_0x903f('0x3e')]:_0x416a44[_0x903f('0x3a')];if(!_0x59132a[_0x903f('0x3b')][_0x903f('0x40')](_0x903f('0x60'))){_0x44186a[_0x903f('0x24')]=qs[_0x903f('0x24')](_0x59132a[_0x903f('0x3b')][_0x903f('0x24')]);_0x44186a['offset']=qs['offset'](_0x59132a[_0x903f('0x3b')][_0x903f('0x23')]);}_0x44186a[_0x903f('0x41')]=qs[_0x903f('0x61')](_0x59132a[_0x903f('0x3b')][_0x903f('0x61')]);_0x44186a[_0x903f('0x42')]=qs[_0x903f('0x43')](_[_0x903f('0x44')](_0x59132a[_0x903f('0x3b')],_0x416a44['filters']));_0x44186a[_0x903f('0x42')][_0x903f('0x62')]=_0x189bfb['id'];if(_0x59132a['query']['filter']){_0x44186a[_0x903f('0x42')]=_[_0x903f('0x46')](_0x44186a[_0x903f('0x42')],{'$or':_[_0x903f('0x35')](_0x44186a[_0x903f('0x3e')],function(_0xcdea18){var _0x4e5bc6={};_0x4e5bc6[_0xcdea18]={'$like':'%'+_0x59132a[_0x903f('0x3b')][_0x903f('0x45')]+'%'};return _0x4e5bc6;})});}_0x44186a=_[_0x903f('0x46')]({},_0x44186a,_0x59132a[_0x903f('0x50')]);return db[_0x903f('0x5d')][_0x903f('0x26')]({'where':_0x44186a[_0x903f('0x42')]})[_0x903f('0x2c')](function(_0x1c789e){_0x217312[_0x903f('0x26')]=_0x1c789e;if(_0x59132a['query'][_0x903f('0x49')]){_0x44186a[_0x903f('0x4a')]=[{'all':!![]}];}return db[_0x903f('0x5d')][_0x903f('0x4b')](_0x44186a);})[_0x903f('0x2c')](function(_0x1effdc){_0x217312[_0x903f('0x63')]=_0x1effdc;return _0x217312;});}})[_0x903f('0x2c')](respondWithFilteredResult(_0x3aaceb,_0x44186a))['catch'](handleError(_0x3aaceb,null));};exports[_0x903f('0x64')]=function(_0x5818f1,_0x178e61,_0x57aa0f){return db[_0x903f('0x36')][_0x903f('0x51')]({'where':{'id':_0x5818f1[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x178e61,null))['then'](function(_0x3bb4ba){if(_0x3bb4ba){return _0x3bb4ba[_0x903f('0x64')](_0x5818f1[_0x903f('0x3b')][_0x903f('0x65')]);}})[_0x903f('0x2c')](respondWithStatusCode(_0x178e61,null))[_0x903f('0x4c')](handleError(_0x178e61,null));};exports[_0x903f('0x66')]=function(_0x54af63,_0x5517e8,_0x3cba5c){return db[_0x903f('0x36')]['find']({'where':{'id':_0x54af63[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x5517e8,null))['then'](function(_0x1f637c){if(_0x1f637c){var _0x43ce65=[];var _0xaec353={'success':[],'errors':[]};return db[_0x903f('0x67')][_0x903f('0x5b')]()[_0x903f('0x2c')](function(_0x5959b9){if(_0x54af63[_0x903f('0x53')]['tags']&&_[_0x903f('0x68')](_0x54af63['body'][_0x903f('0x69')])){if(_0x54af63[_0x903f('0x53')][_0x903f('0x69')][_0x903f('0x3f')]){_0x54af63['body'][_0x903f('0x69')]=_0x54af63[_0x903f('0x53')][_0x903f('0x69')][_0x903f('0x6a')](';')+';';}else{_0x54af63[_0x903f('0x53')]['tags']=null;}}else{_0x54af63[_0x903f('0x53')][_0x903f('0x69')]=null;}if(_0x54af63[_0x903f('0x53')]&&_[_0x903f('0x68')](_0x54af63[_0x903f('0x53')])){for(var _0x528e1e=0x0;_0x528e1e<_0x54af63[_0x903f('0x53')][_0x903f('0x3f')];_0x528e1e+=0x1){_0x54af63['body'][_0x528e1e][_0x903f('0x62')]=_0x54af63[_0x903f('0x4e')]['id'];_0x43ce65[_0x903f('0x6b')](_0x54af63[_0x903f('0x53')][_0x528e1e]);}return BPromise[_0x903f('0x6c')](_0x43ce65,function(_0x3407b7){return db['CmContact'][_0x903f('0x52')](_['omit'](_0x3407b7,[_0x903f('0x65'),'id'])||{},{'fields':_[_0x903f('0x4f')](_0x5959b9),'raw':!![]})['then'](function(_0x347e95){_0xaec353[_0x903f('0x6d')][_0x903f('0x6b')](_0x347e95[_0x903f('0x6e')]);})[_0x903f('0x4c')](function(_0x4df335){_0xaec353[_0x903f('0x6f')]['push']({'data':_0x3407b7,'error':_0x4df335[_0x903f('0x70')]});});})[_0x903f('0x2c')](function(_0x505e5b){return _0xaec353;})[_0x903f('0x4c')](function(_0x23073f){return _0x23073f;});}else{_0x5517e8[_0x903f('0x22')](0x190)[_0x903f('0x28')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x5517e8,null))[_0x903f('0x4c')](handleError(_0x5517e8,null));};exports[_0x903f('0x71')]=function(_0x2f4b12,_0x36e949,_0x288d1a){var _0x4b8ee7;return db[_0x903f('0x36')][_0x903f('0x51')]({'where':{'id':_0x2f4b12[_0x903f('0x4e')]['id']},'include':[{'model':db[_0x903f('0x72')],'as':_0x903f('0x73')}]})[_0x903f('0x2c')](handleEntityNotFound(_0x36e949,null))[_0x903f('0x2c')](function(_0x3fc95e){if(_0x3fc95e){_0x4b8ee7=_0x3fc95e;return db[_0x903f('0x67')][_0x903f('0x37')];}})[_0x903f('0x2c')](function(_0x1a8008){if(_0x1a8008){var _0x107c44={};var _0x3c3bbc={};_0x3c3bbc[_0x903f('0x3a')]=_[_0x903f('0x74')](_[_0x903f('0x4f')](_0x1a8008),_[_0x903f('0x35')](_0x4b8ee7[_0x903f('0x73')],function(_0x51296f){return util[_0x903f('0x75')](_0x903f('0x76'),_0x51296f['id']);}));_0x3c3bbc[_0x903f('0x3b')]=_[_0x903f('0x4f')](_0x2f4b12['query']);_0x3c3bbc['filters']=_[_0x903f('0x3c')](_0x3c3bbc[_0x903f('0x3a')],_0x3c3bbc[_0x903f('0x3b')]);_0x107c44[_0x903f('0x3e')]=_[_0x903f('0x3c')](_0x3c3bbc[_0x903f('0x3a')],qs[_0x903f('0x3d')](_0x2f4b12[_0x903f('0x3b')][_0x903f('0x3d')]));_0x107c44[_0x903f('0x3e')]=_0x107c44[_0x903f('0x3e')][_0x903f('0x3f')]?_0x107c44[_0x903f('0x3e')]:_0x3c3bbc[_0x903f('0x3a')];if(!_0x2f4b12[_0x903f('0x3b')][_0x903f('0x40')](_0x903f('0x60'))){_0x107c44['limit']=qs['limit'](_0x2f4b12[_0x903f('0x3b')][_0x903f('0x24')]);_0x107c44[_0x903f('0x23')]=qs['offset'](_0x2f4b12[_0x903f('0x3b')][_0x903f('0x23')]);}_0x107c44['order']=qs[_0x903f('0x61')](_0x2f4b12['query']['sort']);_0x107c44[_0x903f('0x42')]=qs['filters'](_['pick'](_0x2f4b12['query'],_0x3c3bbc['filters']));_0x107c44[_0x903f('0x77')]=!![];if(_0x2f4b12[_0x903f('0x3b')][_0x903f('0x45')]){_0x107c44['where']=_[_0x903f('0x46')](_0x107c44['where'],{'$or':_['map'](_0x107c44['attributes'],function(_0x58ad2b){var _0x446b95={};_0x446b95[_0x58ad2b]={'$like':'%'+_0x2f4b12[_0x903f('0x3b')][_0x903f('0x45')]+'%'};return _0x446b95;})});}_0x107c44=_[_0x903f('0x46')]({},_0x107c44,_0x2f4b12[_0x903f('0x50')]);return _0x4b8ee7[_0x903f('0x71')](_0x107c44);}})[_0x903f('0x2c')](respondWithResult(_0x36e949,null))['catch'](handleError(_0x36e949,null));};exports[_0x903f('0x78')]=function(_0x3ae85c,_0x7693e2,_0x2c5ede){var _0x427aa4;return db[_0x903f('0x36')][_0x903f('0x51')]({'where':{'id':_0x3ae85c['params']['id']},'include':[{'model':db[_0x903f('0x72')],'as':_0x903f('0x73')}]})[_0x903f('0x2c')](handleEntityNotFound(_0x7693e2,null))['then'](function(_0x3f7b5a){if(_0x3f7b5a){_0x427aa4=_0x3f7b5a;return db[_0x903f('0x67')][_0x903f('0x37')];}})[_0x903f('0x2c')](function(_0xa553d6){if(_0xa553d6){var _0x3a03f0={};var _0x147afe={};_0x147afe[_0x903f('0x3a')]=_[_0x903f('0x74')](_[_0x903f('0x4f')](_0xa553d6),_[_0x903f('0x35')](_0x427aa4['CustomFields'],function(_0x444b5e){return util[_0x903f('0x75')](_0x903f('0x76'),_0x444b5e['id']);}));_0x147afe['query']=_[_0x903f('0x4f')](_0x3ae85c[_0x903f('0x3b')]);_0x147afe[_0x903f('0x43')]=_[_0x903f('0x3c')](_0x147afe[_0x903f('0x3a')],_0x147afe[_0x903f('0x3b')]);_0x3a03f0[_0x903f('0x3e')]=_[_0x903f('0x3c')](_0x147afe[_0x903f('0x3a')],qs['fields'](_0x3ae85c['query']['fields']));_0x3a03f0[_0x903f('0x3e')]=_0x3a03f0[_0x903f('0x3e')][_0x903f('0x3f')]?_0x3a03f0[_0x903f('0x3e')]:_0x147afe['model'];if(!_0x3ae85c[_0x903f('0x3b')][_0x903f('0x40')](_0x903f('0x60'))){_0x3a03f0[_0x903f('0x24')]=qs[_0x903f('0x24')](_0x3ae85c[_0x903f('0x3b')][_0x903f('0x24')]);_0x3a03f0[_0x903f('0x23')]=qs[_0x903f('0x23')](_0x3ae85c[_0x903f('0x3b')][_0x903f('0x23')]);}_0x3a03f0['order']=qs[_0x903f('0x61')](_0x3ae85c[_0x903f('0x3b')][_0x903f('0x61')]);_0x3a03f0['where']=qs[_0x903f('0x43')](_[_0x903f('0x44')](_0x3ae85c[_0x903f('0x3b')],_0x147afe['filters']));_0x3a03f0['raw']=!![];if(_0x3ae85c['query'][_0x903f('0x45')]){_0x3a03f0[_0x903f('0x42')]=_['merge'](_0x3a03f0[_0x903f('0x42')],{'$or':_[_0x903f('0x35')](_0x3a03f0['attributes'],function(_0x39b52d){var _0x331b08={};_0x331b08[_0x39b52d]={'$like':'%'+_0x3ae85c['query'][_0x903f('0x45')]+'%'};return _0x331b08;})});}_0x3a03f0=_[_0x903f('0x46')]({},_0x3a03f0,_0x3ae85c[_0x903f('0x50')]);return _0x427aa4[_0x903f('0x71')](_0x3a03f0);}})[_0x903f('0x2c')](function(_0x3bdf97){if(!_[_0x903f('0x79')](_0x3bdf97)){var _0x200322=toCsv(_0x3bdf97);var _0x2f23f5=Date[_0x903f('0x7a')]();fs[_0x903f('0x7b')](util['format'](_0x903f('0x7c'),_0x427aa4['id'],_0x2f23f5),_0x200322);_0x7693e2[_0x903f('0x7d')]('Content-disposition',_0x903f('0x7e')+util[_0x903f('0x75')](_0x903f('0x7f'),_0x427aa4['id'],_0x2f23f5));_0x7693e2[_0x903f('0x7d')](_0x903f('0x80'),_0x903f('0x81'));return _0x7693e2['download'](util[_0x903f('0x75')]('/tmp/list_%d_%s.csv',_0x427aa4['id'],_0x2f23f5));}else{return _0x7693e2[_0x903f('0x21')](0xcc);}})[_0x903f('0x4c')](handleError(_0x7693e2,null));};exports['addCustomField']=function(_0x2820a,_0x42bf8e,_0x757556){var _0x59e0a0;delete _0x2820a['body']['id'];return db[_0x903f('0x36')]['findOne']({'where':{'id':_0x2820a[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x42bf8e,null))[_0x903f('0x2c')](function(_0x22f9ec){if(_0x22f9ec){return db[_0x903f('0x82')][_0x903f('0x83')](function(_0x5468f7){return db[_0x903f('0x72')]['create'](_0x2820a[_0x903f('0x53')],{'transaction':_0x5468f7})[_0x903f('0x2c')](function(_0x242eef){_0x59e0a0=_0x242eef;return _0x22f9ec['addCustomFields'](_0x242eef,{'transaction':_0x5468f7});})[_0x903f('0x2c')](function(){var _0x708c32={'type':db[_0x903f('0x84')]['TEXT'],'transaction':_0x5468f7};switch(_0x2820a[_0x903f('0x53')][_0x903f('0x47')]){case'text':_0x708c32[_0x903f('0x47')]=db[_0x903f('0x84')]['TEXT'];break;case _0x903f('0x85'):_0x708c32[_0x903f('0x47')]=db['Sequelize'][_0x903f('0x86')];break;case _0x903f('0x87'):_0x708c32[_0x903f('0x47')]=db[_0x903f('0x84')]['BOOLEAN'];_0x708c32[_0x903f('0x88')]=![];break;default:}return db[_0x903f('0x82')][_0x903f('0x89')][_0x903f('0x8a')](_0x903f('0x8b'),util[_0x903f('0x75')](_0x903f('0x8c'),_0x59e0a0['id']),_0x708c32);})[_0x903f('0x2c')](function(){return _0x59e0a0;});});}})['then'](respondWithResult(_0x42bf8e,null))['catch'](handleError(_0x42bf8e,null));};exports[_0x903f('0x8d')]=function(_0x35e81d,_0x1022ba,_0x3f2bf8){var _0x559a71={};var _0x5d1b79={};var _0x6c59f5;var _0x4a2a82;return db['CmList'][_0x903f('0x5f')]({'where':{'id':_0x35e81d[_0x903f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1022ba,null))[_0x903f('0x2c')](function(_0x243c01){if(_0x243c01){_0x6c59f5=_0x243c01;_0x5d1b79['model']=_['keys'](db[_0x903f('0x72')][_0x903f('0x37')]);_0x5d1b79[_0x903f('0x3b')]=_[_0x903f('0x4f')](_0x35e81d[_0x903f('0x3b')]);_0x5d1b79['filters']=_['intersection'](_0x5d1b79[_0x903f('0x3a')],_0x5d1b79[_0x903f('0x3b')]);_0x559a71['attributes']=_[_0x903f('0x3c')](_0x5d1b79['model'],qs[_0x903f('0x3d')](_0x35e81d['query'][_0x903f('0x3d')]));_0x559a71[_0x903f('0x3e')]=_0x559a71[_0x903f('0x3e')][_0x903f('0x3f')]?_0x559a71[_0x903f('0x3e')]:_0x5d1b79[_0x903f('0x3a')];_0x559a71['order']=qs[_0x903f('0x61')](_0x35e81d[_0x903f('0x3b')][_0x903f('0x61')]);_0x559a71[_0x903f('0x42')]=qs[_0x903f('0x43')](_[_0x903f('0x44')](_0x35e81d[_0x903f('0x3b')],_0x5d1b79[_0x903f('0x43')]));_0x559a71[_0x903f('0x42')]=_[_0x903f('0x46')](_0x559a71[_0x903f('0x42')],{'$or':[{'ListId':_0x243c01['id']},{'ListId':null}]});if(_0x35e81d['query'][_0x903f('0x45')]){_0x559a71[_0x903f('0x42')]=_['merge'](_0x559a71[_0x903f('0x42')],{'$or':_[_0x903f('0x35')](_0x559a71[_0x903f('0x3e')],function(_0x5b0b9c){var _0x2f9bb0={};_0x2f9bb0[_0x5b0b9c]={'$like':'%'+_0x35e81d['query'][_0x903f('0x45')]+'%'};return _0x2f9bb0;})});}_0x559a71=_[_0x903f('0x46')]({},_0x559a71,_0x35e81d[_0x903f('0x50')]);return db[_0x903f('0x72')][_0x903f('0x8e')](_0x559a71);}})['then'](respondWithResult(_0x1022ba,null))[_0x903f('0x4c')](handleError(_0x1022ba,null));};exports[_0x903f('0x8f')]=function(_0x387df1,_0x504360,_0x10eb51){return db[_0x903f('0x36')][_0x903f('0x51')]({'where':{'id':_0x387df1['params']['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x504360,null))[_0x903f('0x2c')](function(_0x39005e){if(_0x39005e){return _0x39005e[_0x903f('0x8f')](_0x387df1[_0x903f('0x53')][_0x903f('0x65')],_[_0x903f('0x90')](_0x387df1['body'],[_0x903f('0x65'),'id'])||{})['spread'](function(_0x1f0923){for(var _0x30b738=0x0;_0x30b738<_0x387df1[_0x903f('0x53')][_0x903f('0x65')][_0x903f('0x3f')];_0x30b738+=0x1){socket[_0x903f('0x91')]('userCmList:save',{'UserId':Number(_0x387df1[_0x903f('0x53')][_0x903f('0x65')][_0x30b738]),'CmListId':Number(_0x387df1[_0x903f('0x4e')]['id'])});}return _0x1f0923;});}})['then'](respondWithResult(_0x504360,null))[_0x903f('0x4c')](handleError(_0x504360,null));};exports[_0x903f('0x92')]=function(_0x10e41b,_0x110af4,_0x765017){return db['CmList']['find']({'where':{'id':_0x10e41b[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x110af4,null))[_0x903f('0x2c')](function(_0x23bc53){if(_0x23bc53){return _0x23bc53[_0x903f('0x92')](_0x10e41b['query'][_0x903f('0x65')])[_0x903f('0x2c')](function(){if(_['isArray'](_0x10e41b[_0x903f('0x3b')][_0x903f('0x65')])){for(var _0x1c582d=0x0;_0x1c582d<_0x10e41b[_0x903f('0x3b')][_0x903f('0x65')][_0x903f('0x3f')];_0x1c582d+=0x1){socket['emit'](_0x903f('0x93'),{'UserId':Number(_0x10e41b[_0x903f('0x3b')][_0x903f('0x65')][_0x1c582d]),'CmListId':Number(_0x10e41b[_0x903f('0x4e')]['id'])});}}else{socket[_0x903f('0x91')](_0x903f('0x93'),{'UserId':Number(_0x10e41b[_0x903f('0x3b')][_0x903f('0x65')]),'CmListId':Number(_0x10e41b[_0x903f('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x110af4,null))[_0x903f('0x4c')](handleError(_0x110af4,null));};exports['getAgents']=function(_0x2c9109,_0x57e628,_0xc253a5){var _0x4ddb8d={};var _0x5c5181={};var _0x21bcec;var _0x7f3a80;return db[_0x903f('0x36')]['findOne']({'where':{'id':_0x2c9109[_0x903f('0x4e')]['id']}})[_0x903f('0x2c')](handleEntityNotFound(_0x57e628,null))[_0x903f('0x2c')](function(_0x572a19){if(_0x572a19){_0x21bcec=_0x572a19;_0x5c5181[_0x903f('0x3a')]=_[_0x903f('0x4f')](db[_0x903f('0x94')][_0x903f('0x37')]);_0x5c5181[_0x903f('0x3b')]=_[_0x903f('0x4f')](_0x2c9109['query']);_0x5c5181[_0x903f('0x43')]=_['intersection'](_0x5c5181[_0x903f('0x3a')],_0x5c5181['query']);_0x4ddb8d[_0x903f('0x3e')]=_[_0x903f('0x3c')](_0x5c5181[_0x903f('0x3a')],qs[_0x903f('0x3d')](_0x2c9109[_0x903f('0x3b')][_0x903f('0x3d')]));_0x4ddb8d[_0x903f('0x3e')]=_0x4ddb8d[_0x903f('0x3e')][_0x903f('0x3f')]?_0x4ddb8d['attributes']:_0x5c5181[_0x903f('0x3a')];_0x4ddb8d['order']=qs[_0x903f('0x61')](_0x2c9109[_0x903f('0x3b')][_0x903f('0x61')]);_0x4ddb8d['where']=qs['filters'](_['pick'](_0x2c9109[_0x903f('0x3b')],_0x5c5181[_0x903f('0x43')]));if(_0x2c9109[_0x903f('0x3b')][_0x903f('0x45')]){_0x4ddb8d['where']=_[_0x903f('0x46')](_0x4ddb8d['where'],{'$or':_[_0x903f('0x35')](_0x4ddb8d['attributes'],function(_0x1d4c68){var _0x35144c={};_0x35144c[_0x1d4c68]={'$like':'%'+_0x2c9109[_0x903f('0x3b')][_0x903f('0x45')]+'%'};return _0x35144c;})});}_0x4ddb8d=_[_0x903f('0x46')]({},_0x4ddb8d,_0x2c9109[_0x903f('0x50')]);return _0x21bcec['getAgents'](_0x4ddb8d);}})[_0x903f('0x2c')](function(_0x26c3a6){if(_0x26c3a6){_0x7f3a80=_0x26c3a6[_0x903f('0x3f')];if(!_0x2c9109[_0x903f('0x3b')][_0x903f('0x40')](_0x903f('0x60'))){_0x4ddb8d[_0x903f('0x24')]=qs[_0x903f('0x24')](_0x2c9109[_0x903f('0x3b')][_0x903f('0x24')]);_0x4ddb8d[_0x903f('0x23')]=qs[_0x903f('0x23')](_0x2c9109['query'][_0x903f('0x23')]);}return _0x21bcec[_0x903f('0x95')](_0x4ddb8d);}})[_0x903f('0x2c')](function(_0x5bb2a6){if(_0x5bb2a6){return _0x5bb2a6?{'count':_0x7f3a80,'rows':_0x5bb2a6}:null;}})[_0x903f('0x2c')](respondWithResult(_0x57e628,null))[_0x903f('0x4c')](handleError(_0x57e628,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b5014d4..767e7e1 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x4757e7,_0x324ec3){_0x4757e7=_0x4757e7-0x0;var _0x38301c=_0x3e74[_0x4757e7];return _0x38301c;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x216fa8,_0x31b7c5){_0x216fa8=_0x216fa8-0x0;var _0x3b6900=_0xe14b[_0x216fa8];return _0x3b6900;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4d9f034..c0d958a 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','api','bluebird'];(function(_0x561a85,_0x1601b2){var _0x31b2e8=function(_0x17e71d){while(--_0x17e71d){_0x561a85['push'](_0x561a85['shift']());}};_0x31b2e8(++_0x1601b2);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1e09ad,_0x4a61cf){_0x1e09ad=_0x1e09ad-0x0;var _0x1206d7=_0x9bde[_0x1e09ad];return _0x1206d7;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x668b=['cm_lists','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cmList.attributes','define','CmList'];(function(_0x46db2,_0x298356){var _0x643fed=function(_0x493dde){while(--_0x493dde){_0x46db2['push'](_0x46db2['shift']());}};_0x643fed(++_0x298356);}(_0x668b,0x140));var _0xb668=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0x668b[_0x2fff83];return _0xa2a722;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('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 66ae185..74af868 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 _0x304c=['error','code','CmList,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x304c,0x1e8));var _0xc304=function(_0x12f2b9,_0x13e3b5){_0x12f2b9=_0x12f2b9-0x0;var _0x4fef03=_0x304c[_0x12f2b9];return _0x4fef03;};'use strict';var _=require(_0xc304('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc304('0x1'));var rs=require(_0xc304('0x2'));var fs=require('fs');var Redis=require(_0xc304('0x3'));var db=require(_0xc304('0x4'))['db'];var utils=require(_0xc304('0x5'));var logger=require(_0xc304('0x6'))('rpc');var config=require(_0xc304('0x7'));var jayson=require(_0xc304('0x8'));var client=jayson[_0xc304('0x9')]['http']({'port':0x232a});config[_0xc304('0xa')]=_[_0xc304('0xb')](config[_0xc304('0xa')],{'host':_0xc304('0xc'),'port':0x18eb});var socket=require(_0xc304('0xd'))(new Redis(config[_0xc304('0xa')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x56300a,_0x5a7a52,_0x352cf6){return new BPromise(function(_0x431c1e,_0x4b6682){return client['request'](_0x56300a,_0x352cf6)[_0xc304('0xe')](function(_0x53a06f){logger['info']('CmList,\x20%s,\x20%s',_0x5a7a52,'request\x20sent');logger[_0xc304('0xf')](_0xc304('0x10'),_0x5a7a52,_0xc304('0x11'),JSON['stringify'](_0x53a06f));if(_0x53a06f[_0xc304('0x12')]){if(_0x53a06f[_0xc304('0x12')][_0xc304('0x13')]===0x1f4){logger[_0xc304('0x12')](_0xc304('0x14'),_0x5a7a52,_0x53a06f['error'][_0xc304('0x15')]);return _0x4b6682(_0x53a06f['error'][_0xc304('0x15')]);}logger[_0xc304('0x12')](_0xc304('0x14'),_0x5a7a52,_0x53a06f[_0xc304('0x12')][_0xc304('0x15')]);return _0x431c1e(_0x53a06f[_0xc304('0x12')][_0xc304('0x15')]);}else{logger['info'](_0xc304('0x14'),_0x5a7a52,_0xc304('0x11'));_0x431c1e(_0x53a06f[_0xc304('0x16')]['message']);}})['catch'](function(_0x22e954){logger[_0xc304('0x12')](_0xc304('0x14'),_0x5a7a52,_0x22e954);_0x4b6682(_0x22e954);});});} \ No newline at end of file +var _0x1552=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0xf11008,_0x4b9d07){var _0x28a0c6=function(_0x5b00df){while(--_0x5b00df){_0xf11008['push'](_0xf11008['shift']());}};_0x28a0c6(++_0x4b9d07);}(_0x1552,0x116));var _0x2155=function(_0x304e0e,_0x2654a3){_0x304e0e=_0x304e0e-0x0;var _0x4449c8=_0x1552[_0x304e0e];return _0x4449c8;};'use strict';var _=require('lodash');var util=require(_0x2155('0x0'));var moment=require(_0x2155('0x1'));var BPromise=require(_0x2155('0x2'));var rs=require(_0x2155('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2155('0x4'))['db'];var utils=require(_0x2155('0x5'));var logger=require('../../config/logger')(_0x2155('0x6'));var config=require(_0x2155('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2155('0x8')][_0x2155('0x9')]({'port':0x232a});config[_0x2155('0xa')]=_[_0x2155('0xb')](config['redis'],{'host':_0x2155('0xc'),'port':0x18eb});var socket=require(_0x2155('0xd'))(new Redis(config[_0x2155('0xa')]));require(_0x2155('0xe'))[_0x2155('0xf')](socket);function respondWithRpcPromise(_0x273850,_0x5960c1,_0x184c8e){return new BPromise(function(_0x5039d4,_0x2b32d7){return client[_0x2155('0x10')](_0x273850,_0x184c8e)[_0x2155('0x11')](function(_0x51ebc8){logger[_0x2155('0x12')](_0x2155('0x13'),_0x5960c1,'request\x20sent');logger['debug'](_0x2155('0x14'),_0x5960c1,_0x2155('0x15'),JSON[_0x2155('0x16')](_0x51ebc8));if(_0x51ebc8[_0x2155('0x17')]){if(_0x51ebc8[_0x2155('0x17')][_0x2155('0x18')]===0x1f4){logger[_0x2155('0x17')]('CmList,\x20%s,\x20%s',_0x5960c1,_0x51ebc8[_0x2155('0x17')][_0x2155('0x19')]);return _0x2b32d7(_0x51ebc8[_0x2155('0x17')][_0x2155('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0x5960c1,_0x51ebc8['error']['message']);return _0x5039d4(_0x51ebc8[_0x2155('0x17')][_0x2155('0x19')]);}else{logger[_0x2155('0x12')](_0x2155('0x13'),_0x5960c1,_0x2155('0x15'));_0x5039d4(_0x51ebc8[_0x2155('0x1a')][_0x2155('0x19')]);}})[_0x2155('0x1b')](function(_0xe30367){logger[_0x2155('0x17')]('CmList,\x20%s,\x20%s',_0x5960c1,_0xe30367);_0x2b32d7(_0xe30367);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a45037f..6ec95cb 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 _0x2cc7=['./cmList.events','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x2b8f9a,_0x323996){var _0x5e4b9f=function(_0x1529de){while(--_0x1529de){_0x2b8f9a['push'](_0x2b8f9a['shift']());}};_0x5e4b9f(++_0x323996);}(_0x2cc7,0x70));var _0x72cc=function(_0x269879,_0x26e3ea){_0x269879=_0x269879-0x0;var _0x1ed318=_0x2cc7[_0x269879];return _0x1ed318;};'use strict';var CmListEvents=require(_0x72cc('0x0'));var events=['save',_0x72cc('0x1'),_0x72cc('0x2')];function createListener(_0x476229,_0x4a78f9){return function(_0x4cf6d6){_0x4a78f9[_0x72cc('0x3')](_0x476229,_0x4cf6d6);};}function removeListener(_0x277e52,_0x1c712a){return function(){CmListEvents[_0x72cc('0x4')](_0x277e52,_0x1c712a);};}exports[_0x72cc('0x5')]=function(_0x4ea770){for(var _0x541988=0x0,_0x1ef319=events[_0x72cc('0x6')];_0x541988<_0x1ef319;_0x541988++){var _0x260adb=events[_0x541988];var _0x2ccf5e=createListener(_0x72cc('0x7')+_0x260adb,_0x4ea770);CmListEvents['on'](_0x260adb,_0x2ccf5e);}}; \ No newline at end of file +var _0xdd41=['./cmList.events','save','remove','update','removeListener','length'];(function(_0x3c68e4,_0x20e968){var _0x2b35e7=function(_0x1732a7){while(--_0x1732a7){_0x3c68e4['push'](_0x3c68e4['shift']());}};_0x2b35e7(++_0x20e968);}(_0xdd41,0x1f2));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0x1dd4('0x0'));var events=[_0x1dd4('0x1'),_0x1dd4('0x2'),_0x1dd4('0x3')];function createListener(_0x53c761,_0x14079d){return function(_0x101e25){_0x14079d['emit'](_0x53c761,_0x101e25);};}function removeListener(_0x4d2603,_0x43f80a){return function(){CmListEvents[_0x1dd4('0x4')](_0x4d2603,_0x43f80a);};}exports['register']=function(_0xaa0c85){for(var _0x1e6287=0x0,_0x5661bf=events[_0x1dd4('0x5')];_0x1e6287<_0x5661bf;_0x1e6287++){var _0x581693=events[_0x1e6287];var _0x489b97=createListener('cmList:'+_0x581693,_0xaa0c85);CmListEvents['on'](_0x581693,_0x489b97);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fa22bea..581ad9f 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 _0xcf97=['../../config/environment','./cmList.controller','isAuthenticated','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/fields','/:id/users','getAgents','create','post','addContacts','addCustomField','addAgents','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2529c6,_0x98713){var _0x24af6d=function(_0x492b6e){while(--_0x492b6e){_0x2529c6['push'](_0x2529c6['shift']());}};_0x24af6d(++_0x98713);}(_0xcf97,0x94));var _0x7cf9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcf97[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x7cf9('0x0'));var util=require('util');var path=require(_0x7cf9('0x1'));var timeout=require(_0x7cf9('0x2'));var express=require(_0x7cf9('0x3'));var router=express[_0x7cf9('0x4')]();var fs_extra=require(_0x7cf9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7cf9('0x6'));var config=require(_0x7cf9('0x7'));var controller=require(_0x7cf9('0x8'));router['get']('/',auth[_0x7cf9('0x9')](),controller['index']);router[_0x7cf9('0xa')](_0x7cf9('0xb'),auth[_0x7cf9('0x9')](),controller[_0x7cf9('0xc')]);router['get'](_0x7cf9('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7cf9('0xa')](_0x7cf9('0xe'),auth[_0x7cf9('0x9')](),controller[_0x7cf9('0xf')]);router['get'](_0x7cf9('0x10'),auth['isAuthenticated'](),controller[_0x7cf9('0x11')]);router[_0x7cf9('0xa')]('/:id/contacts/csv',auth[_0x7cf9('0x9')](),controller['getContactsCsv']);router[_0x7cf9('0xa')](_0x7cf9('0x12'),auth[_0x7cf9('0x9')](),controller['getCustomFields']);router[_0x7cf9('0xa')](_0x7cf9('0x13'),auth['isAuthenticated'](),controller[_0x7cf9('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7cf9('0x15')]);router[_0x7cf9('0x16')](_0x7cf9('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x7cf9('0x16')]('/:id/contacts',auth[_0x7cf9('0x9')](),controller[_0x7cf9('0x17')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0x7cf9('0x18')]);router[_0x7cf9('0x16')](_0x7cf9('0x13'),auth[_0x7cf9('0x9')](),controller[_0x7cf9('0x19')]);router['put'](_0x7cf9('0xd'),auth[_0x7cf9('0x9')](),controller['update']);router[_0x7cf9('0x1a')](_0x7cf9('0xd'),auth[_0x7cf9('0x9')](),controller[_0x7cf9('0x1b')]);router[_0x7cf9('0x1a')](_0x7cf9('0xe'),auth[_0x7cf9('0x9')](),controller[_0x7cf9('0x1c')]);router[_0x7cf9('0x1a')](_0x7cf9('0x13'),auth[_0x7cf9('0x9')](),controller[_0x7cf9('0x1d')]);module[_0x7cf9('0x1e')]=router; \ No newline at end of file +var _0xd127=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','/:id/fields','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x27709a,_0x220bcf){var _0x38e0fd=function(_0x527fd1){while(--_0x527fd1){_0x27709a['push'](_0x27709a['shift']());}};_0x38e0fd(++_0x220bcf);}(_0xd127,0x156));var _0x7d12=function(_0x3a4a43,_0x11af35){_0x3a4a43=_0x3a4a43-0x0;var _0x59b9f9=_0xd127[_0x3a4a43];return _0x59b9f9;};'use strict';var multer=require(_0x7d12('0x0'));var util=require(_0x7d12('0x1'));var path=require(_0x7d12('0x2'));var timeout=require(_0x7d12('0x3'));var express=require(_0x7d12('0x4'));var router=express['Router']();var fs_extra=require(_0x7d12('0x5'));var auth=require(_0x7d12('0x6'));var interaction=require(_0x7d12('0x7'));var config=require(_0x7d12('0x8'));var controller=require(_0x7d12('0x9'));router[_0x7d12('0xa')]('/',auth[_0x7d12('0xb')](),controller[_0x7d12('0xc')]);router[_0x7d12('0xa')](_0x7d12('0xd'),auth['isAuthenticated'](),controller[_0x7d12('0xe')]);router['get'](_0x7d12('0xf'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x10')]);router[_0x7d12('0xa')](_0x7d12('0x11'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x12')]);router[_0x7d12('0xa')]('/:id/contacts',auth[_0x7d12('0xb')](),controller[_0x7d12('0x13')]);router[_0x7d12('0xa')](_0x7d12('0x14'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x15')]);router[_0x7d12('0xa')]('/:id/fields',auth[_0x7d12('0xb')](),controller['getCustomFields']);router['get'](_0x7d12('0x16'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x17')]);router[_0x7d12('0x18')]('/',auth[_0x7d12('0xb')](),controller[_0x7d12('0x19')]);router['post']('/:id/dispositions',auth[_0x7d12('0xb')](),controller[_0x7d12('0x1a')]);router['post'](_0x7d12('0x1b'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x1c')]);router['post'](_0x7d12('0x1d'),auth[_0x7d12('0xb')](),controller['addCustomField']);router[_0x7d12('0x18')](_0x7d12('0x16'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x1e')]);router[_0x7d12('0x1f')]('/:id',auth[_0x7d12('0xb')](),controller[_0x7d12('0x20')]);router[_0x7d12('0x21')]('/:id',auth[_0x7d12('0xb')](),controller[_0x7d12('0x22')]);router['delete'](_0x7d12('0x11'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x23')]);router[_0x7d12('0x21')](_0x7d12('0x16'),auth[_0x7d12('0xb')](),controller[_0x7d12('0x24')]);module[_0x7d12('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7a20394..0185349 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 _0xd4db=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x5e5abc,_0xaadd80){var _0x954586=function(_0x5e23b0){while(--_0x5e23b0){_0x5e5abc['push'](_0x5e5abc['shift']());}};_0x954586(++_0xaadd80);}(_0xd4db,0x81));var _0xbd4d=function(_0x2f5ac2,_0x189d01){_0x2f5ac2=_0x2f5ac2-0x0;var _0x27bda1=_0xd4db[_0x2f5ac2];return _0x27bda1;};'use strict';var Sequelize=require(_0xbd4d('0x0'));module[_0xbd4d('0x1')]={'name':{'type':Sequelize[_0xbd4d('0x2')],'get':function(_0x3112a1){return this[_0xbd4d('0x3')](_0xbd4d('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xbd4d('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xbd75=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x527a20,_0x347399){var _0x21f5e0=function(_0x2e01f8){while(--_0x2e01f8){_0x527a20['push'](_0x527a20['shift']());}};_0x21f5e0(++_0x347399);}(_0xbd75,0x13f));var _0x5bd7=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xbd75[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x5bd7('0x0'));module[_0x5bd7('0x1')]={'name':{'type':Sequelize[_0x5bd7('0x2')],'get':function(_0x2258b0){return this[_0x5bd7('0x3')](_0x5bd7('0x4'));}},'field':{'type':Sequelize[_0x5bd7('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x5bd7('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index f0c49e1..ccbc002 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(_0x5a7128,_0xf05723){var _0x4e0695=function(_0x445fde){while(--_0x445fde){_0x5a7128['push'](_0x5a7128['shift']());}};_0x4e0695(++_0xf05723);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0xfafd73,_0x10ae02){var _0x2a4172=function(_0x590485){while(--_0x590485){_0xfafd73['push'](_0xfafd73['shift']());}};_0x2a4172(++_0x10ae02);}(_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 938b63e..05601b6 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 _0x54f1=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0xe70cb7,_0x497285){var _0x19fdfa=function(_0xe5efd6){while(--_0xe5efd6){_0xe70cb7['push'](_0xe70cb7['shift']());}};_0x19fdfa(++_0x497285);}(_0x54f1,0x18b));var _0x154f=function(_0x1ca754,_0x1b5bf8){_0x1ca754=_0x1ca754-0x0;var _0x5e0d92=_0x54f1[_0x1ca754];return _0x5e0d92;};'use strict';var _=require(_0x154f('0x0'));var util=require(_0x154f('0x1'));var logger=require(_0x154f('0x2'))(_0x154f('0x3'));var moment=require('moment');var BPromise=require(_0x154f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x154f('0x5'));var rimraf=require(_0x154f('0x6'));var config=require(_0x154f('0x7'));var attributes=require(_0x154f('0x8'));module[_0x154f('0x9')]=function(_0xe4f5d1,_0x627722){return _0xe4f5d1['define'](_0x154f('0xa'),attributes,{'tableName':_0x154f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa25=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x1d19f6,_0x24a630){var _0x3dedb7=function(_0x21ab19){while(--_0x21ab19){_0x1d19f6['push'](_0x1d19f6['shift']());}};_0x3dedb7(++_0x24a630);}(_0xaa25,0x178));var _0x5aa2=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xaa25[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x5aa2('0x0'));var util=require(_0x5aa2('0x1'));var logger=require(_0x5aa2('0x2'))('api');var moment=require(_0x5aa2('0x3'));var BPromise=require(_0x5aa2('0x4'));var rp=require(_0x5aa2('0x5'));var fs=require('fs');var path=require(_0x5aa2('0x6'));var rimraf=require(_0x5aa2('0x7'));var config=require(_0x5aa2('0x8'));var attributes=require(_0x5aa2('0x9'));module[_0x5aa2('0xa')]=function(_0x5ab14b,_0x5a4980){return _0x5ab14b[_0x5aa2('0xb')](_0x5aa2('0xc'),attributes,{'tableName':_0x5aa2('0xd'),'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 61a15a2..df2c85b 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 _0x092f=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x248e8c,_0x51b0a4){var _0x594df5=function(_0x591cdd){while(--_0x591cdd){_0x248e8c['push'](_0x248e8c['shift']());}};_0x594df5(++_0x51b0a4);}(_0x092f,0x11e));var _0xf092=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x092f[_0x5e3701];return _0x345dcf;};'use strict';var _=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var moment=require(_0xf092('0x2'));var BPromise=require(_0xf092('0x3'));var rs=require(_0xf092('0x4'));var fs=require('fs');var Redis=require(_0xf092('0x5'));var db=require(_0xf092('0x6'))['db'];var utils=require(_0xf092('0x7'));var logger=require(_0xf092('0x8'))(_0xf092('0x9'));var config=require(_0xf092('0xa'));var jayson=require(_0xf092('0xb'));var client=jayson[_0xf092('0xc')][_0xf092('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1cf0a9,_0x4de116,_0x3cfda7){return new BPromise(function(_0x15c52d,_0x28ee2c){return client[_0xf092('0xe')](_0x1cf0a9,_0x3cfda7)[_0xf092('0xf')](function(_0xe5e2f0){logger[_0xf092('0x10')](_0xf092('0x11'),_0x4de116,_0xf092('0x12'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x4de116,_0xf092('0x12'),JSON[_0xf092('0x13')](_0xe5e2f0));if(_0xe5e2f0[_0xf092('0x14')]){if(_0xe5e2f0[_0xf092('0x14')][_0xf092('0x15')]===0x1f4){logger['error'](_0xf092('0x11'),_0x4de116,_0xe5e2f0['error'][_0xf092('0x16')]);return _0x28ee2c(_0xe5e2f0[_0xf092('0x14')][_0xf092('0x16')]);}logger['error'](_0xf092('0x11'),_0x4de116,_0xe5e2f0[_0xf092('0x14')]['message']);return _0x15c52d(_0xe5e2f0[_0xf092('0x14')]['message']);}else{logger[_0xf092('0x10')](_0xf092('0x11'),_0x4de116,_0xf092('0x12'));_0x15c52d(_0xe5e2f0[_0xf092('0x17')][_0xf092('0x16')]);}})[_0xf092('0x18')](function(_0x355b16){logger[_0xf092('0x14')]('Condition,\x20%s,\x20%s',_0x4de116,_0x355b16);_0x28ee2c(_0x355b16);});});} \ No newline at end of file +var _0x94d9=['request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s','message'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x94d9,0x1e7));var _0x994d=function(_0x3b79fd,_0x3d0e0c){_0x3b79fd=_0x3b79fd-0x0;var _0x19583a=_0x94d9[_0x3b79fd];return _0x19583a;};'use strict';var _=require(_0x994d('0x0'));var util=require(_0x994d('0x1'));var moment=require(_0x994d('0x2'));var BPromise=require(_0x994d('0x3'));var rs=require(_0x994d('0x4'));var fs=require('fs');var Redis=require(_0x994d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x994d('0x6'));var logger=require(_0x994d('0x7'))(_0x994d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x994d('0x9')][_0x994d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a2ee3,_0x378080,_0x3d0e7b){return new BPromise(function(_0x2baf9d,_0x44de25){return client['request'](_0x8a2ee3,_0x3d0e7b)[_0x994d('0xb')](function(_0xeec8bc){logger[_0x994d('0xc')]('Condition,\x20%s,\x20%s',_0x378080,'request\x20sent');logger[_0x994d('0xd')](_0x994d('0xe'),_0x378080,'request\x20sent',JSON['stringify'](_0xeec8bc));if(_0xeec8bc[_0x994d('0xf')]){if(_0xeec8bc[_0x994d('0xf')][_0x994d('0x10')]===0x1f4){logger[_0x994d('0xf')](_0x994d('0x11'),_0x378080,_0xeec8bc[_0x994d('0xf')][_0x994d('0x12')]);return _0x44de25(_0xeec8bc[_0x994d('0xf')][_0x994d('0x12')]);}logger[_0x994d('0xf')](_0x994d('0x11'),_0x378080,_0xeec8bc[_0x994d('0xf')]['message']);return _0x2baf9d(_0xeec8bc[_0x994d('0xf')][_0x994d('0x12')]);}else{logger[_0x994d('0xc')]('Condition,\x20%s,\x20%s',_0x378080,_0x994d('0x13'));_0x2baf9d(_0xeec8bc[_0x994d('0x14')]['message']);}})[_0x994d('0x15')](function(_0x404260){logger[_0x994d('0xf')]('Condition,\x20%s,\x20%s',_0x378080,_0x404260);_0x44de25(_0x404260);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e9cc672..44574b1 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 _0xecfe=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x31421c,_0x5c7126){var _0x59919c=function(_0x137ce5){while(--_0x137ce5){_0x31421c['push'](_0x31421c['shift']());}};_0x59919c(++_0x5c7126);}(_0xecfe,0xa5));var _0xeecf=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xecfe[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require(_0xeecf('0x0'));var util=require(_0xeecf('0x1'));var path=require(_0xeecf('0x2'));var timeout=require(_0xeecf('0x3'));var express=require(_0xeecf('0x4'));var router=express[_0xeecf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeecf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeecf('0x7'));var controller=require(_0xeecf('0x8'));router['put'](_0xeecf('0x9'),auth[_0xeecf('0xa')](),controller[_0xeecf('0xb')]);router[_0xeecf('0xc')]('/:id',auth[_0xeecf('0xa')](),controller[_0xeecf('0xd')]);module[_0xeecf('0xe')]=router; \ No newline at end of file +var _0xa41a=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated','delete','/:id','destroy','exports','util'];(function(_0x592726,_0x4430eb){var _0x436a50=function(_0x2346b2){while(--_0x2346b2){_0x592726['push'](_0x592726['shift']());}};_0x436a50(++_0x4430eb);}(_0xa41a,0x1b9));var _0xaa41=function(_0x23ef4a,_0x275e4d){_0x23ef4a=_0x23ef4a-0x0;var _0x17bec7=_0xa41a[_0x23ef4a];return _0x17bec7;};'use strict';var multer=require('multer');var util=require(_0xaa41('0x0'));var path=require(_0xaa41('0x1'));var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaa41('0x4'));var interaction=require(_0xaa41('0x5'));var config=require('../../config/environment');var controller=require(_0xaa41('0x6'));router[_0xaa41('0x7')]('/:id',auth[_0xaa41('0x8')](),controller['update']);router[_0xaa41('0x9')](_0xaa41('0xa'),auth[_0xaa41('0x8')](),controller[_0xaa41('0xb')]);module[_0xaa41('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a188d71..b7225e9 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 _0xe706=['STRING','sequelize','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe706,0xa3));var _0x6e70=function(_0x55cc6a,_0x5dbd65){_0x55cc6a=_0x55cc6a-0x0;var _0x26e2cd=_0xe706[_0x55cc6a];return _0x26e2cd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb7e7[_0x1d24eb];return _0x1dc576;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b4738b2..5b401d9 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 _0x5acd=['fast-json-patch','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','CustomDashboards','UserProfileResource','destroy','error','name','index','map','Dashboard','rawAttributes','type','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','intersection','options','omit','updatedAt','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x5acd,0x1f1));var _0xd5ac=function(_0x5f3f26,_0x42264c){_0x5f3f26=_0x5f3f26-0x0;var _0x590fb4=_0x5acd[_0x5f3f26];return _0x590fb4;};'use strict';var emlformat=require(_0xd5ac('0x0'));var rimraf=require(_0xd5ac('0x1'));var zipdir=require(_0xd5ac('0x2'));var jsonpatch=require(_0xd5ac('0x3'));var rp=require('request-promise');var moment=require(_0xd5ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd5ac('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd5ac('0x6'));var csv=require('to-csv');var ejs=require(_0xd5ac('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5ac('0x8'));var squel=require(_0xd5ac('0x9'));var crypto=require(_0xd5ac('0xa'));var jsforce=require(_0xd5ac('0xb'));var deskjs=require(_0xd5ac('0xc'));var toCsv=require(_0xd5ac('0xd'));var querystring=require(_0xd5ac('0xe'));var Papa=require(_0xd5ac('0xf'));var Redis=require(_0xd5ac('0x10'));var authService=require(_0xd5ac('0x11'));var qs=require(_0xd5ac('0x12'));var as=require(_0xd5ac('0x13'));var hardwareService=require(_0xd5ac('0x14'));var logger=require(_0xd5ac('0x15'))(_0xd5ac('0x16'));var utils=require(_0xd5ac('0x17'));var config=require(_0xd5ac('0x18'));var licenseUtil=require(_0xd5ac('0x19'));var db=require(_0xd5ac('0x1a'))['db'];config[_0xd5ac('0x1b')]=_[_0xd5ac('0x1c')](config[_0xd5ac('0x1b')],{'host':_0xd5ac('0x1d'),'port':0x18eb});var socket=require(_0xd5ac('0x1e'))(new Redis(config[_0xd5ac('0x1b')]));require(_0xd5ac('0x1f'))[_0xd5ac('0x20')](socket);function respondWithStatusCode(_0x26401a,_0xbf0862){_0xbf0862=_0xbf0862||0xcc;return function(_0x35413f){if(_0x35413f){return _0x26401a[_0xd5ac('0x21')](_0xbf0862);}return _0x26401a[_0xd5ac('0x22')](_0xbf0862)[_0xd5ac('0x23')]();};}function respondWithResult(_0x5ee78e,_0x52dd19){_0x52dd19=_0x52dd19||0xc8;return function(_0xc8256a){if(_0xc8256a){return _0x5ee78e['status'](_0x52dd19)['json'](_0xc8256a);}};}function respondWithFilteredResult(_0x1eca01,_0x5b0b28){return function(_0x3fbaf5){if(_0x3fbaf5){var _0x25b703=typeof _0x5b0b28[_0xd5ac('0x24')]==='undefined'&&typeof _0x5b0b28[_0xd5ac('0x25')]==='undefined';var _0x4fee46=_0x3fbaf5[_0xd5ac('0x26')];var _0x19bf6f=_0x25b703?0x0:_0x5b0b28['offset'];var _0x121e91=_0x25b703?_0x3fbaf5[_0xd5ac('0x26')]:_0x5b0b28[_0xd5ac('0x24')]+_0x5b0b28['limit'];var _0x4cacf0;if(_0x121e91>=_0x4fee46){_0x121e91=_0x4fee46;_0x4cacf0=0xc8;}else{_0x4cacf0=0xce;}_0x1eca01[_0xd5ac('0x22')](_0x4cacf0);return _0x1eca01[_0xd5ac('0x27')](_0xd5ac('0x28'),_0x19bf6f+'-'+_0x121e91+'/'+_0x4fee46)[_0xd5ac('0x29')](_0x3fbaf5);}return null;};}function patchUpdates(_0xe95373){return function(_0xe7c00){try{jsonpatch[_0xd5ac('0x2a')](_0xe7c00,_0xe95373,!![]);}catch(_0x4e9873){return BPromise[_0xd5ac('0x2b')](_0x4e9873);}return _0xe7c00[_0xd5ac('0x2c')]();};}function saveUpdates(_0x22888f,_0xd5e590){return function(_0x2a5380){if(_0x2a5380){return _0x2a5380[_0xd5ac('0x2d')](_0x22888f)['then'](function(_0x4f7bb3){return _0x4f7bb3;});}return null;};}function removeEntity(_0x4982f3,_0x478206){return function(_0x1dda56){if(_0x1dda56){return _0x1dda56['destroy']()[_0xd5ac('0x2e')](function(){var _0x2f5e48=_0x1dda56['get']({'plain':!![]});var _0x2ca31c=_0xd5ac('0x2f');return db[_0xd5ac('0x30')][_0xd5ac('0x31')]({'where':{'type':_0x2ca31c,'resourceId':_0x2f5e48['id']}})[_0xd5ac('0x2e')](function(){return _0x1dda56;});})[_0xd5ac('0x2e')](function(){_0x4982f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ea5a,_0x44ab4d){return function(_0xc85da9){if(!_0xc85da9){_0x45ea5a[_0xd5ac('0x21')](0x194);}return _0xc85da9;};}function handleError(_0x5a690e,_0x4fd8e1){_0x4fd8e1=_0x4fd8e1||0x1f4;return function(_0xecc491){logger[_0xd5ac('0x32')](_0xecc491['stack']);if(_0xecc491[_0xd5ac('0x33')]){delete _0xecc491['name'];}_0x5a690e['status'](_0x4fd8e1)['send'](_0xecc491);};}exports[_0xd5ac('0x34')]=function(_0x16d38d,_0x1efaf2){var _0x4e09ca={},_0x2f7f75={},_0x2ac322={'count':0x0,'rows':[]};var _0x9a90f8=_[_0xd5ac('0x35')](db[_0xd5ac('0x36')][_0xd5ac('0x37')],function(_0x3262fb){return{'name':_0x3262fb['fieldName'],'type':_0x3262fb[_0xd5ac('0x38')]['key']};});_0x2f7f75[_0xd5ac('0x39')]=_[_0xd5ac('0x35')](_0x9a90f8,'name');_0x2f7f75['query']=_[_0xd5ac('0x3a')](_0x16d38d['query']);_0x2f7f75['filters']=_['intersection'](_0x2f7f75['model'],_0x2f7f75[_0xd5ac('0x3b')]);_0x4e09ca[_0xd5ac('0x3c')]=_['intersection'](_0x2f7f75[_0xd5ac('0x39')],qs[_0xd5ac('0x3d')](_0x16d38d[_0xd5ac('0x3b')][_0xd5ac('0x3d')]));_0x4e09ca[_0xd5ac('0x3c')]=_0x4e09ca[_0xd5ac('0x3c')]['length']?_0x4e09ca['attributes']:_0x2f7f75[_0xd5ac('0x39')];if(!_0x16d38d[_0xd5ac('0x3b')][_0xd5ac('0x3e')](_0xd5ac('0x3f'))){_0x4e09ca[_0xd5ac('0x25')]=qs[_0xd5ac('0x25')](_0x16d38d[_0xd5ac('0x3b')]['limit']);_0x4e09ca[_0xd5ac('0x24')]=qs['offset'](_0x16d38d[_0xd5ac('0x3b')][_0xd5ac('0x24')]);}_0x4e09ca[_0xd5ac('0x40')]=qs['sort'](_0x16d38d[_0xd5ac('0x3b')][_0xd5ac('0x41')]);_0x4e09ca[_0xd5ac('0x42')]=qs[_0xd5ac('0x43')](_[_0xd5ac('0x44')](_0x16d38d[_0xd5ac('0x3b')],_0x2f7f75[_0xd5ac('0x43')]),_0x9a90f8);if(_0x16d38d[_0xd5ac('0x3b')][_0xd5ac('0x45')]){_0x4e09ca[_0xd5ac('0x42')]=_['merge'](_0x4e09ca[_0xd5ac('0x42')],{'$or':_[_0xd5ac('0x35')](_0x9a90f8,function(_0x3c66a7){if(_0x3c66a7[_0xd5ac('0x38')]!==_0xd5ac('0x46')){var _0x49ad6e={};_0x49ad6e[_0x3c66a7[_0xd5ac('0x33')]]={'$like':'%'+_0x16d38d[_0xd5ac('0x3b')][_0xd5ac('0x45')]+'%'};return _0x49ad6e;}})});}_0x4e09ca=_[_0xd5ac('0x47')]({},_0x4e09ca,_0x16d38d['options']);var _0x51904d={'where':_0x4e09ca[_0xd5ac('0x42')]};return db['Dashboard'][_0xd5ac('0x26')](_0x51904d)[_0xd5ac('0x2e')](function(_0x23f009){_0x2ac322[_0xd5ac('0x26')]=_0x23f009;if(_0x16d38d[_0xd5ac('0x3b')][_0xd5ac('0x48')]){_0x4e09ca[_0xd5ac('0x49')]=[{'all':!![]}];}return db[_0xd5ac('0x36')][_0xd5ac('0x4a')](_0x4e09ca);})[_0xd5ac('0x2e')](function(_0x401b72){_0x2ac322['rows']=_0x401b72;return _0x2ac322;})[_0xd5ac('0x2e')](respondWithFilteredResult(_0x1efaf2,_0x4e09ca))[_0xd5ac('0x4b')](handleError(_0x1efaf2,null));};exports['show']=function(_0x1ca2f8,_0x235de9){var _0x5768f1={'raw':![],'where':{'id':_0x1ca2f8['params']['id']}},_0x3e71e1={};_0x3e71e1[_0xd5ac('0x39')]=_[_0xd5ac('0x3a')](db[_0xd5ac('0x36')][_0xd5ac('0x37')]);_0x3e71e1[_0xd5ac('0x3b')]=_[_0xd5ac('0x3a')](_0x1ca2f8[_0xd5ac('0x3b')]);_0x3e71e1[_0xd5ac('0x43')]=_['intersection'](_0x3e71e1[_0xd5ac('0x39')],_0x3e71e1['query']);_0x5768f1[_0xd5ac('0x3c')]=_['intersection'](_0x3e71e1[_0xd5ac('0x39')],qs[_0xd5ac('0x3d')](_0x1ca2f8[_0xd5ac('0x3b')]['fields']));_0x5768f1[_0xd5ac('0x3c')]=_0x5768f1[_0xd5ac('0x3c')][_0xd5ac('0x4c')]?_0x5768f1[_0xd5ac('0x3c')]:_0x3e71e1['model'];if(_0x1ca2f8['query'][_0xd5ac('0x48')]){_0x5768f1[_0xd5ac('0x49')]=[{'all':!![]}];}_0x5768f1=_[_0xd5ac('0x47')]({},_0x5768f1,_0x1ca2f8['options']);return db['Dashboard'][_0xd5ac('0x4d')](_0x5768f1)['then'](handleEntityNotFound(_0x235de9,null))[_0xd5ac('0x2e')](respondWithResult(_0x235de9,null))[_0xd5ac('0x4b')](handleError(_0x235de9,null));};exports[_0xd5ac('0x4e')]=function(_0x33f87e,_0x120786){return db[_0xd5ac('0x36')][_0xd5ac('0x4e')](_0x33f87e[_0xd5ac('0x4f')],{})[_0xd5ac('0x2e')](function(_0xd6a0e4){var _0x53ad39=_0x33f87e[_0xd5ac('0x50')][_0xd5ac('0x51')]({'plain':!![]});if(!_0x53ad39)throw new Error(_0xd5ac('0x52'));if(_0x53ad39[_0xd5ac('0x53')]==='user'){var _0x364905=_0xd6a0e4['get']({'plain':!![]});var _0x237f39=_0xd5ac('0x2f');return db[_0xd5ac('0x54')]['find']({'where':{'name':_0x237f39,'userProfileId':_0x53ad39[_0xd5ac('0x55')]},'raw':!![]})[_0xd5ac('0x2e')](function(_0x41866c){if(_0x41866c&&_0x41866c[_0xd5ac('0x56')]===0x0){return db[_0xd5ac('0x30')][_0xd5ac('0x4e')]({'name':_0x364905[_0xd5ac('0x33')],'resourceId':_0x364905['id'],'type':_0x41866c['name'],'sectionId':_0x41866c['id']},{})[_0xd5ac('0x2e')](function(){return _0xd6a0e4;});}else{return _0xd6a0e4;}})['catch'](function(_0x1baeca){logger[_0xd5ac('0x32')](_0xd5ac('0x57'),_0x1baeca);throw _0x1baeca;});}return _0xd6a0e4;})['then'](respondWithResult(_0x120786,0xc9))[_0xd5ac('0x4b')](handleError(_0x120786,null));};exports['clone']=function(_0xc02f7f,_0xd54b9f){var _0x3c0a8a={'where':{'id':_0xc02f7f[_0xd5ac('0x58')]['id']}},_0x259839={};_0x259839['model']=_[_0xd5ac('0x3a')](db[_0xd5ac('0x36')][_0xd5ac('0x37')]);_0x3c0a8a[_0xd5ac('0x3c')]=_[_0xd5ac('0x59')](_0x259839[_0xd5ac('0x39')],qs[_0xd5ac('0x3d')](_0xc02f7f[_0xd5ac('0x3b')][_0xd5ac('0x3d')]));_0x3c0a8a[_0xd5ac('0x3c')]=_0x3c0a8a[_0xd5ac('0x3c')][_0xd5ac('0x4c')]?_0x3c0a8a[_0xd5ac('0x3c')]:_0x259839['model'];if(_0xc02f7f['query'][_0xd5ac('0x48')]){_0x3c0a8a[_0xd5ac('0x49')]=[{'all':!![]}];}_0x3c0a8a=_['merge']({},_0x3c0a8a,_0xc02f7f[_0xd5ac('0x5a')]);return db[_0xd5ac('0x36')]['find'](_0x3c0a8a)[_0xd5ac('0x2e')](handleEntityNotFound(_0xd54b9f,null))[_0xd5ac('0x2e')](function(_0x4cde3e){if(_0x4cde3e){var _0x24d4d5=_0x4cde3e['get']({'plain':!![]});_0x24d4d5=qs[_0xd5ac('0x5b')](_0x24d4d5,['id','createdAt',_0xd5ac('0x5c')]);_0xc02f7f[_0xd5ac('0x4f')]=_[_0xd5ac('0x5b')](_0xc02f7f[_0xd5ac('0x4f')],['id','createdAt',_0xd5ac('0x5c')]);return db[_0xd5ac('0x36')][_0xd5ac('0x4e')](_['merge'](_0x24d4d5,_0xc02f7f[_0xd5ac('0x4f')]),{'include':_0xc02f7f[_0xd5ac('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xd5ac('0x2e')](function(_0x4fac5a){var _0x4a57c8=_0xc02f7f[_0xd5ac('0x50')][_0xd5ac('0x51')]({'plain':!![]});if(!_0x4a57c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a57c8[_0xd5ac('0x53')]==='user'){var _0x24f2de=_0x4fac5a[_0xd5ac('0x51')]({'plain':!![]});var _0x2d95fd=_0xd5ac('0x2f');return db[_0xd5ac('0x54')][_0xd5ac('0x4d')]({'where':{'name':_0x2d95fd,'userProfileId':_0x4a57c8['userProfileId']},'raw':!![]})[_0xd5ac('0x2e')](function(_0x577295){if(_0x577295&&_0x577295['autoAssociation']===0x0){return db[_0xd5ac('0x30')][_0xd5ac('0x4e')]({'name':_0x24f2de[_0xd5ac('0x33')],'resourceId':_0x24f2de['id'],'type':_0x577295[_0xd5ac('0x33')],'sectionId':_0x577295['id']},{})[_0xd5ac('0x2e')](function(){return _0x4fac5a;});}else{return _0x4fac5a;}})[_0xd5ac('0x4b')](function(_0x30c507){logger[_0xd5ac('0x32')](_0xd5ac('0x57'),_0x30c507);throw _0x30c507;});}return _0x4fac5a;});}})[_0xd5ac('0x2e')](respondWithResult(_0xd54b9f,0xc9))[_0xd5ac('0x4b')](handleError(_0xd54b9f,null));};exports[_0xd5ac('0x2d')]=function(_0x42b62e,_0x5ac36f){if(_0x42b62e[_0xd5ac('0x4f')]['id']){delete _0x42b62e[_0xd5ac('0x4f')]['id'];}return db[_0xd5ac('0x36')]['find']({'where':{'id':_0x42b62e[_0xd5ac('0x58')]['id']}})[_0xd5ac('0x2e')](handleEntityNotFound(_0x5ac36f,null))[_0xd5ac('0x2e')](saveUpdates(_0x42b62e[_0xd5ac('0x4f')],null))['then'](respondWithResult(_0x5ac36f,null))[_0xd5ac('0x4b')](handleError(_0x5ac36f,null));};exports[_0xd5ac('0x31')]=function(_0x14c1c1,_0x362385){return db[_0xd5ac('0x36')]['find']({'where':{'id':_0x14c1c1[_0xd5ac('0x58')]['id']}})[_0xd5ac('0x2e')](handleEntityNotFound(_0x362385,null))[_0xd5ac('0x2e')](removeEntity(_0x362385,null))[_0xd5ac('0x4b')](handleError(_0x362385,null));};function widgetAttributes(_0x2c0481){try{switch(_0x2c0481[_0xd5ac('0x38')]){case _0xd5ac('0x5d'):return[{'name':_0xd5ac('0x5e'),'value':_0x2c0481[_0xd5ac('0x5e')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481['attrs'][0x0]?_0x2c0481[_0xd5ac('0x5f')][0x0]['value']:undefined)||_0xd5ac('0x60')}];case _0xd5ac('0x61'):return[{'name':_0xd5ac('0x62'),'value':_0x2c0481[_0xd5ac('0x62')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x0]?_0x2c0481[_0xd5ac('0x5f')][0x0][_0xd5ac('0x63')]:undefined)||''}];case _0xd5ac('0x64'):return[{'name':'attrHourFormat','value':_0x2c0481[_0xd5ac('0x65')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x0]?_0x2c0481[_0xd5ac('0x5f')][0x0]['value']:undefined)||_0xd5ac('0x66')},{'name':'attrTimezone','value':_0x2c0481[_0xd5ac('0x67')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x1]?_0x2c0481[_0xd5ac('0x5f')][0x1][_0xd5ac('0x63')]:undefined)||_0xd5ac('0x68')},{'name':_0xd5ac('0x69'),'value':_0x2c0481[_0xd5ac('0x69')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481['attrs'][0x2]?_0x2c0481[_0xd5ac('0x5f')][0x2][_0xd5ac('0x63')]:undefined)||0xc}];case _0xd5ac('0x6a'):return[{'name':_0xd5ac('0x6b'),'value':_0x2c0481[_0xd5ac('0x6b')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x0]?_0x2c0481[_0xd5ac('0x5f')][0x0][_0xd5ac('0x63')]:undefined)||_0xd5ac('0x6c')},{'name':_0xd5ac('0x6d'),'value':_0x2c0481[_0xd5ac('0x6d')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x1]?_0x2c0481[_0xd5ac('0x5f')][0x1][_0xd5ac('0x63')]:undefined)||[]},{'name':_0xd5ac('0x69'),'value':_0x2c0481['attrFontSize']||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481['attrs'][0x2]?_0x2c0481[_0xd5ac('0x5f')][0x2][_0xd5ac('0x63')]:undefined)||0x14}];case'multibar-chart':case _0xd5ac('0x6e'):return[{'name':'attrSerie1','value':_0x2c0481[_0xd5ac('0x6f')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481['attrs'][0x0]?_0x2c0481[_0xd5ac('0x5f')][0x0][_0xd5ac('0x63')]:undefined)||_0xd5ac('0x6c')},{'name':_0xd5ac('0x70'),'value':_0x2c0481['attrSerie2']||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x1]?_0x2c0481[_0xd5ac('0x5f')][0x1][_0xd5ac('0x63')]:undefined)||null},{'name':_0xd5ac('0x71'),'value':_0x2c0481[_0xd5ac('0x71')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481['attrs'][0x2]?_0x2c0481[_0xd5ac('0x5f')][0x2]['value']:undefined)||null},{'name':_0xd5ac('0x6d'),'value':_0x2c0481[_0xd5ac('0x6d')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x3]?_0x2c0481[_0xd5ac('0x5f')][0x3][_0xd5ac('0x63')]:undefined)||[]}];case _0xd5ac('0x72'):return[{'name':'attrReport','type':_0x2c0481[_0xd5ac('0x73')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x0]?_0x2c0481['attrs'][0x0][_0xd5ac('0x38')]:undefined)||null,'value':_0x2c0481[_0xd5ac('0x74')]||(_0x2c0481[_0xd5ac('0x5f')]&&_0x2c0481[_0xd5ac('0x5f')][0x0]?_0x2c0481[_0xd5ac('0x5f')][0x0]['value']:undefined)||null},{'name':_0xd5ac('0x75'),'value':_0x2c0481[_0xd5ac('0x75')]||(_0x2c0481['attrs']&&_0x2c0481[_0xd5ac('0x5f')][0x1]?_0x2c0481[_0xd5ac('0x5f')][0x1][_0xd5ac('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x6380be){logger[_0xd5ac('0x32')](_0xd5ac('0x76'),JSON[_0xd5ac('0x77')](_0x6380be));return[];}}exports[_0xd5ac('0x78')]=function(_0x5d9433,_0x1a53c4,_0x1501b2){if(_0x5d9433[_0xd5ac('0x4f')]['id']){delete _0x5d9433['body']['id'];}return db['Dashboard'][_0xd5ac('0x4d')]({'where':{'id':_0x5d9433[_0xd5ac('0x58')]['id']}})[_0xd5ac('0x2e')](handleEntityNotFound(_0x1a53c4,null))[_0xd5ac('0x2e')](function(_0x38247e){if(_0x38247e){_0x5d9433[_0xd5ac('0x4f')][_0xd5ac('0x79')]=_0x38247e['id'];_0x5d9433[_0xd5ac('0x4f')][_0xd5ac('0x5f')]=widgetAttributes(_0x5d9433[_0xd5ac('0x4f')]);return db[_0xd5ac('0x7a')][_0xd5ac('0x4e')](_0x5d9433[_0xd5ac('0x4f')]);}})[_0xd5ac('0x2e')](respondWithResult(_0x1a53c4,null))[_0xd5ac('0x4b')](handleError(_0x1a53c4,null));};exports['getItems']=function(_0x5401fe,_0x1099ec,_0x167731){var _0x408add={};var _0x9e5f0f={};var _0x340990;var _0x1d45b0;return db[_0xd5ac('0x36')][_0xd5ac('0x7b')]({'where':{'id':_0x5401fe['params']['id']}})[_0xd5ac('0x2e')](handleEntityNotFound(_0x1099ec,null))['then'](function(_0x156908){if(_0x156908){_0x340990=_0x156908;_0x9e5f0f[_0xd5ac('0x39')]=_['keys'](db[_0xd5ac('0x7a')][_0xd5ac('0x37')]);_0x9e5f0f[_0xd5ac('0x3b')]=_[_0xd5ac('0x3a')](_0x5401fe[_0xd5ac('0x3b')]);_0x9e5f0f[_0xd5ac('0x43')]=_[_0xd5ac('0x59')](_0x9e5f0f['model'],_0x9e5f0f[_0xd5ac('0x3b')]);_0x408add[_0xd5ac('0x3c')]=_[_0xd5ac('0x59')](_0x9e5f0f[_0xd5ac('0x39')],qs[_0xd5ac('0x3d')](_0x5401fe[_0xd5ac('0x3b')][_0xd5ac('0x3d')]));_0x408add[_0xd5ac('0x3c')]=_0x408add[_0xd5ac('0x3c')][_0xd5ac('0x4c')]?_0x408add[_0xd5ac('0x3c')]:_0x9e5f0f[_0xd5ac('0x39')];_0x408add[_0xd5ac('0x40')]=qs[_0xd5ac('0x41')](_0x5401fe[_0xd5ac('0x3b')][_0xd5ac('0x41')]);_0x408add['where']=qs[_0xd5ac('0x43')](_['pick'](_0x5401fe[_0xd5ac('0x3b')],_0x9e5f0f['filters']));if(_0x5401fe[_0xd5ac('0x3b')][_0xd5ac('0x45')]){_0x408add[_0xd5ac('0x42')]=_['merge'](_0x408add[_0xd5ac('0x42')],{'$or':_['map'](_0x408add['attributes'],function(_0x510fc1){var _0x2a83cb={};_0x2a83cb[_0x510fc1]={'$like':'%'+_0x5401fe[_0xd5ac('0x3b')][_0xd5ac('0x45')]+'%'};return _0x2a83cb;})});}_0x408add=_[_0xd5ac('0x47')]({},_0x408add,_0x5401fe[_0xd5ac('0x5a')]);return _0x340990[_0xd5ac('0x7c')](_0x408add);}})['then'](function(_0x30d982){if(_0x30d982){_0x1d45b0=_0x30d982[_0xd5ac('0x4c')];if(!_0x5401fe['query'][_0xd5ac('0x3e')]('nolimit')){_0x408add[_0xd5ac('0x25')]=qs['limit'](_0x5401fe[_0xd5ac('0x3b')][_0xd5ac('0x25')]);_0x408add[_0xd5ac('0x24')]=qs['offset'](_0x5401fe[_0xd5ac('0x3b')][_0xd5ac('0x24')]);}return _0x340990[_0xd5ac('0x7c')](_0x408add);}})[_0xd5ac('0x2e')](function(_0x332dbb){if(_0x332dbb){return _0x332dbb?{'count':_0x1d45b0,'rows':_0x332dbb}:null;}})[_0xd5ac('0x2e')](respondWithResult(_0x1099ec,null))[_0xd5ac('0x4b')](handleError(_0x1099ec,null));}; \ No newline at end of file +var _0xea04=['Dashboard','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','pick','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./dashboard.socket','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','stack','name','send','index','map'];(function(_0x42f09f,_0x5cc2f7){var _0x431196=function(_0x162d2f){while(--_0x162d2f){_0x42f09f['push'](_0x42f09f['shift']());}};_0x431196(++_0x5cc2f7);}(_0xea04,0x138));var _0x4ea0=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0xea04[_0x43f47b];return _0x4af9a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ea0('0x0'));var zipdir=require(_0x4ea0('0x1'));var jsonpatch=require(_0x4ea0('0x2'));var rp=require(_0x4ea0('0x3'));var moment=require('moment');var BPromise=require(_0x4ea0('0x4'));var Mustache=require('mustache');var util=require(_0x4ea0('0x5'));var path=require('path');var sox=require(_0x4ea0('0x6'));var csv=require(_0x4ea0('0x7'));var ejs=require(_0x4ea0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ea0('0x9'));var squel=require(_0x4ea0('0xa'));var crypto=require(_0x4ea0('0xb'));var jsforce=require(_0x4ea0('0xc'));var deskjs=require(_0x4ea0('0xd'));var toCsv=require(_0x4ea0('0x7'));var querystring=require(_0x4ea0('0xe'));var Papa=require(_0x4ea0('0xf'));var Redis=require(_0x4ea0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ea0('0x11'));var as=require(_0x4ea0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ea0('0x13'));var utils=require(_0x4ea0('0x14'));var config=require(_0x4ea0('0x15'));var licenseUtil=require(_0x4ea0('0x16'));var db=require(_0x4ea0('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4ea0('0x18'),'port':0x18eb});var socket=require(_0x4ea0('0x19'))(new Redis(config[_0x4ea0('0x1a')]));require(_0x4ea0('0x1b'))['register'](socket);function respondWithStatusCode(_0x41a1be,_0x2774ef){_0x2774ef=_0x2774ef||0xcc;return function(_0x484276){if(_0x484276){return _0x41a1be[_0x4ea0('0x1c')](_0x2774ef);}return _0x41a1be[_0x4ea0('0x1d')](_0x2774ef)['end']();};}function respondWithResult(_0x41a707,_0x3849f3){_0x3849f3=_0x3849f3||0xc8;return function(_0x28e490){if(_0x28e490){return _0x41a707[_0x4ea0('0x1d')](_0x3849f3)[_0x4ea0('0x1e')](_0x28e490);}};}function respondWithFilteredResult(_0x31cb5d,_0x39b254){return function(_0x56db4c){if(_0x56db4c){var _0x193fb7=typeof _0x39b254['offset']===_0x4ea0('0x1f')&&typeof _0x39b254[_0x4ea0('0x20')]===_0x4ea0('0x1f');var _0x5adece=_0x56db4c[_0x4ea0('0x21')];var _0x478daf=_0x193fb7?0x0:_0x39b254[_0x4ea0('0x22')];var _0x33c328=_0x193fb7?_0x56db4c['count']:_0x39b254[_0x4ea0('0x22')]+_0x39b254['limit'];var _0x1fa5bb;if(_0x33c328>=_0x5adece){_0x33c328=_0x5adece;_0x1fa5bb=0xc8;}else{_0x1fa5bb=0xce;}_0x31cb5d['status'](_0x1fa5bb);return _0x31cb5d[_0x4ea0('0x23')]('Content-Range',_0x478daf+'-'+_0x33c328+'/'+_0x5adece)[_0x4ea0('0x1e')](_0x56db4c);}return null;};}function patchUpdates(_0x6d213){return function(_0x329573){try{jsonpatch[_0x4ea0('0x24')](_0x329573,_0x6d213,!![]);}catch(_0x17b459){return BPromise[_0x4ea0('0x25')](_0x17b459);}return _0x329573[_0x4ea0('0x26')]();};}function saveUpdates(_0xe6a9a1,_0x219499){return function(_0x21f2cc){if(_0x21f2cc){return _0x21f2cc[_0x4ea0('0x27')](_0xe6a9a1)[_0x4ea0('0x28')](function(_0x1a7dde){return _0x1a7dde;});}return null;};}function removeEntity(_0xfc64bc,_0x2c71f1){return function(_0x344680){if(_0x344680){return _0x344680[_0x4ea0('0x29')]()[_0x4ea0('0x28')](function(){var _0x15cd54=_0x344680[_0x4ea0('0x2a')]({'plain':!![]});var _0xb03e3d=_0x4ea0('0x2b');return db[_0x4ea0('0x2c')][_0x4ea0('0x29')]({'where':{'type':_0xb03e3d,'resourceId':_0x15cd54['id']}})[_0x4ea0('0x28')](function(){return _0x344680;});})[_0x4ea0('0x28')](function(){_0xfc64bc[_0x4ea0('0x1d')](0xcc)[_0x4ea0('0x2d')]();});}};}function handleEntityNotFound(_0x4f940a,_0x163536){return function(_0x7244f5){if(!_0x7244f5){_0x4f940a[_0x4ea0('0x1c')](0x194);}return _0x7244f5;};}function handleError(_0x231fe0,_0x572d91){_0x572d91=_0x572d91||0x1f4;return function(_0x177908){logger['error'](_0x177908[_0x4ea0('0x2e')]);if(_0x177908[_0x4ea0('0x2f')]){delete _0x177908['name'];}_0x231fe0[_0x4ea0('0x1d')](_0x572d91)[_0x4ea0('0x30')](_0x177908);};}exports[_0x4ea0('0x31')]=function(_0x466e0f,_0x28e2e7){var _0x52c3aa={},_0x58a63c={},_0x41e72f={'count':0x0,'rows':[]};var _0x2f41d8=_[_0x4ea0('0x32')](db[_0x4ea0('0x33')][_0x4ea0('0x34')],function(_0x1c6654){return{'name':_0x1c6654[_0x4ea0('0x35')],'type':_0x1c6654['type'][_0x4ea0('0x36')]};});_0x58a63c['model']=_[_0x4ea0('0x32')](_0x2f41d8,_0x4ea0('0x2f'));_0x58a63c[_0x4ea0('0x37')]=_['keys'](_0x466e0f[_0x4ea0('0x37')]);_0x58a63c['filters']=_['intersection'](_0x58a63c[_0x4ea0('0x38')],_0x58a63c[_0x4ea0('0x37')]);_0x52c3aa[_0x4ea0('0x39')]=_[_0x4ea0('0x3a')](_0x58a63c[_0x4ea0('0x38')],qs[_0x4ea0('0x3b')](_0x466e0f[_0x4ea0('0x37')][_0x4ea0('0x3b')]));_0x52c3aa[_0x4ea0('0x39')]=_0x52c3aa['attributes'][_0x4ea0('0x3c')]?_0x52c3aa[_0x4ea0('0x39')]:_0x58a63c[_0x4ea0('0x38')];if(!_0x466e0f[_0x4ea0('0x37')][_0x4ea0('0x3d')]('nolimit')){_0x52c3aa[_0x4ea0('0x20')]=qs['limit'](_0x466e0f[_0x4ea0('0x37')][_0x4ea0('0x20')]);_0x52c3aa['offset']=qs[_0x4ea0('0x22')](_0x466e0f['query'][_0x4ea0('0x22')]);}_0x52c3aa[_0x4ea0('0x3e')]=qs[_0x4ea0('0x3f')](_0x466e0f[_0x4ea0('0x37')]['sort']);_0x52c3aa['where']=qs[_0x4ea0('0x40')](_['pick'](_0x466e0f[_0x4ea0('0x37')],_0x58a63c[_0x4ea0('0x40')]),_0x2f41d8);if(_0x466e0f[_0x4ea0('0x37')][_0x4ea0('0x41')]){_0x52c3aa[_0x4ea0('0x42')]=_[_0x4ea0('0x43')](_0x52c3aa[_0x4ea0('0x42')],{'$or':_['map'](_0x2f41d8,function(_0x23caed){if(_0x23caed[_0x4ea0('0x44')]!==_0x4ea0('0x45')){var _0x495548={};_0x495548[_0x23caed[_0x4ea0('0x2f')]]={'$like':'%'+_0x466e0f[_0x4ea0('0x37')]['filter']+'%'};return _0x495548;}})});}_0x52c3aa=_['merge']({},_0x52c3aa,_0x466e0f[_0x4ea0('0x46')]);var _0x560ebe={'where':_0x52c3aa[_0x4ea0('0x42')]};return db[_0x4ea0('0x33')][_0x4ea0('0x21')](_0x560ebe)[_0x4ea0('0x28')](function(_0x1c2cce){_0x41e72f[_0x4ea0('0x21')]=_0x1c2cce;if(_0x466e0f[_0x4ea0('0x37')][_0x4ea0('0x47')]){_0x52c3aa[_0x4ea0('0x48')]=[{'all':!![]}];}return db[_0x4ea0('0x33')][_0x4ea0('0x49')](_0x52c3aa);})[_0x4ea0('0x28')](function(_0x48a982){_0x41e72f[_0x4ea0('0x4a')]=_0x48a982;return _0x41e72f;})[_0x4ea0('0x28')](respondWithFilteredResult(_0x28e2e7,_0x52c3aa))[_0x4ea0('0x4b')](handleError(_0x28e2e7,null));};exports['show']=function(_0x2e315a,_0x2907d6){var _0x201392={'raw':![],'where':{'id':_0x2e315a['params']['id']}},_0x2fae22={};_0x2fae22[_0x4ea0('0x38')]=_['keys'](db['Dashboard'][_0x4ea0('0x34')]);_0x2fae22[_0x4ea0('0x37')]=_[_0x4ea0('0x4c')](_0x2e315a['query']);_0x2fae22['filters']=_[_0x4ea0('0x3a')](_0x2fae22['model'],_0x2fae22[_0x4ea0('0x37')]);_0x201392[_0x4ea0('0x39')]=_[_0x4ea0('0x3a')](_0x2fae22[_0x4ea0('0x38')],qs[_0x4ea0('0x3b')](_0x2e315a['query'][_0x4ea0('0x3b')]));_0x201392[_0x4ea0('0x39')]=_0x201392['attributes'][_0x4ea0('0x3c')]?_0x201392['attributes']:_0x2fae22[_0x4ea0('0x38')];if(_0x2e315a[_0x4ea0('0x37')]['includeAll']){_0x201392[_0x4ea0('0x48')]=[{'all':!![]}];}_0x201392=_['merge']({},_0x201392,_0x2e315a['options']);return db['Dashboard'][_0x4ea0('0x4d')](_0x201392)[_0x4ea0('0x28')](handleEntityNotFound(_0x2907d6,null))['then'](respondWithResult(_0x2907d6,null))[_0x4ea0('0x4b')](handleError(_0x2907d6,null));};exports[_0x4ea0('0x4e')]=function(_0x4ab6cd,_0x15cd0e){return db['Dashboard']['create'](_0x4ab6cd[_0x4ea0('0x4f')],{})[_0x4ea0('0x28')](function(_0x579f46){var _0x281c77=_0x4ab6cd['user'][_0x4ea0('0x2a')]({'plain':!![]});if(!_0x281c77)throw new Error(_0x4ea0('0x50'));if(_0x281c77[_0x4ea0('0x51')]===_0x4ea0('0x52')){var _0x13ed2c=_0x579f46[_0x4ea0('0x2a')]({'plain':!![]});var _0x302962=_0x4ea0('0x2b');return db[_0x4ea0('0x53')]['find']({'where':{'name':_0x302962,'userProfileId':_0x281c77[_0x4ea0('0x54')]},'raw':!![]})[_0x4ea0('0x28')](function(_0x3b9caf){if(_0x3b9caf&&_0x3b9caf[_0x4ea0('0x55')]===0x0){return db[_0x4ea0('0x2c')]['create']({'name':_0x13ed2c[_0x4ea0('0x2f')],'resourceId':_0x13ed2c['id'],'type':_0x3b9caf[_0x4ea0('0x2f')],'sectionId':_0x3b9caf['id']},{})[_0x4ea0('0x28')](function(){return _0x579f46;});}else{return _0x579f46;}})['catch'](function(_0x4efeba){logger['error'](_0x4ea0('0x56'),_0x4efeba);throw _0x4efeba;});}return _0x579f46;})[_0x4ea0('0x28')](respondWithResult(_0x15cd0e,0xc9))[_0x4ea0('0x4b')](handleError(_0x15cd0e,null));};exports[_0x4ea0('0x57')]=function(_0x295875,_0x516f04){var _0x217d76={'where':{'id':_0x295875[_0x4ea0('0x58')]['id']}},_0xe7cce2={};_0xe7cce2['model']=_[_0x4ea0('0x4c')](db[_0x4ea0('0x33')]['rawAttributes']);_0x217d76[_0x4ea0('0x39')]=_[_0x4ea0('0x3a')](_0xe7cce2[_0x4ea0('0x38')],qs[_0x4ea0('0x3b')](_0x295875['query']['fields']));_0x217d76[_0x4ea0('0x39')]=_0x217d76['attributes']['length']?_0x217d76[_0x4ea0('0x39')]:_0xe7cce2['model'];if(_0x295875[_0x4ea0('0x37')][_0x4ea0('0x47')]){_0x217d76['include']=[{'all':!![]}];}_0x217d76=_[_0x4ea0('0x43')]({},_0x217d76,_0x295875[_0x4ea0('0x46')]);return db[_0x4ea0('0x33')][_0x4ea0('0x4d')](_0x217d76)[_0x4ea0('0x28')](handleEntityNotFound(_0x516f04,null))[_0x4ea0('0x28')](function(_0x5595e9){if(_0x5595e9){var _0x44ca57=_0x5595e9['get']({'plain':!![]});_0x44ca57=qs[_0x4ea0('0x59')](_0x44ca57,['id',_0x4ea0('0x5a'),_0x4ea0('0x5b')]);_0x295875[_0x4ea0('0x4f')]=_[_0x4ea0('0x59')](_0x295875[_0x4ea0('0x4f')],['id',_0x4ea0('0x5a'),_0x4ea0('0x5b')]);return db[_0x4ea0('0x33')][_0x4ea0('0x4e')](_['merge'](_0x44ca57,_0x295875[_0x4ea0('0x4f')]),{'include':_0x295875[_0x4ea0('0x37')][_0x4ea0('0x47')]?[{'all':!![]}]:undefined})[_0x4ea0('0x28')](function(_0x401545){var _0xc15b45=_0x295875[_0x4ea0('0x52')]['get']({'plain':!![]});if(!_0xc15b45)throw new Error(_0x4ea0('0x50'));if(_0xc15b45[_0x4ea0('0x51')]==='user'){var _0x327b49=_0x401545[_0x4ea0('0x2a')]({'plain':!![]});var _0x47d54a=_0x4ea0('0x2b');return db[_0x4ea0('0x53')][_0x4ea0('0x4d')]({'where':{'name':_0x47d54a,'userProfileId':_0xc15b45['userProfileId']},'raw':!![]})[_0x4ea0('0x28')](function(_0x110b81){if(_0x110b81&&_0x110b81['autoAssociation']===0x0){return db[_0x4ea0('0x2c')][_0x4ea0('0x4e')]({'name':_0x327b49[_0x4ea0('0x2f')],'resourceId':_0x327b49['id'],'type':_0x110b81[_0x4ea0('0x2f')],'sectionId':_0x110b81['id']},{})[_0x4ea0('0x28')](function(){return _0x401545;});}else{return _0x401545;}})['catch'](function(_0xc6dc48){logger['error'](_0x4ea0('0x56'),_0xc6dc48);throw _0xc6dc48;});}return _0x401545;});}})['then'](respondWithResult(_0x516f04,0xc9))['catch'](handleError(_0x516f04,null));};exports[_0x4ea0('0x27')]=function(_0x1dc42e,_0x53d1ea){if(_0x1dc42e[_0x4ea0('0x4f')]['id']){delete _0x1dc42e[_0x4ea0('0x4f')]['id'];}return db[_0x4ea0('0x33')]['find']({'where':{'id':_0x1dc42e['params']['id']}})[_0x4ea0('0x28')](handleEntityNotFound(_0x53d1ea,null))[_0x4ea0('0x28')](saveUpdates(_0x1dc42e[_0x4ea0('0x4f')],null))[_0x4ea0('0x28')](respondWithResult(_0x53d1ea,null))[_0x4ea0('0x4b')](handleError(_0x53d1ea,null));};exports[_0x4ea0('0x29')]=function(_0x331bea,_0xd6f3d0){return db[_0x4ea0('0x33')][_0x4ea0('0x4d')]({'where':{'id':_0x331bea['params']['id']}})[_0x4ea0('0x28')](handleEntityNotFound(_0xd6f3d0,null))['then'](removeEntity(_0xd6f3d0,null))[_0x4ea0('0x4b')](handleError(_0xd6f3d0,null));};function widgetAttributes(_0x2530fd){try{switch(_0x2530fd[_0x4ea0('0x44')]){case'iframe':return[{'name':_0x4ea0('0x5c'),'value':_0x2530fd['attrUrl']||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd[_0x4ea0('0x5d')][0x0]?_0x2530fd[_0x4ea0('0x5d')][0x0][_0x4ea0('0x5e')]:undefined)||_0x4ea0('0x5f')}];case _0x4ea0('0x60'):return[{'name':_0x4ea0('0x61'),'value':_0x2530fd[_0x4ea0('0x61')]||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd['attrs'][0x0]?_0x2530fd[_0x4ea0('0x5d')][0x0][_0x4ea0('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x4ea0('0x62'),'value':_0x2530fd[_0x4ea0('0x62')]||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd['attrs'][0x0]?_0x2530fd[_0x4ea0('0x5d')][0x0][_0x4ea0('0x5e')]:undefined)||'HH:mm:ss'},{'name':_0x4ea0('0x63'),'value':_0x2530fd[_0x4ea0('0x63')]||(_0x2530fd['attrs']&&_0x2530fd[_0x4ea0('0x5d')][0x1]?_0x2530fd[_0x4ea0('0x5d')][0x1][_0x4ea0('0x5e')]:undefined)||_0x4ea0('0x64')},{'name':'attrFontSize','value':_0x2530fd['attrFontSize']||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd['attrs'][0x2]?_0x2530fd[_0x4ea0('0x5d')][0x2][_0x4ea0('0x5e')]:undefined)||0xc}];case _0x4ea0('0x65'):return[{'name':_0x4ea0('0x66'),'value':_0x2530fd[_0x4ea0('0x66')]||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd['attrs'][0x0]?_0x2530fd[_0x4ea0('0x5d')][0x0][_0x4ea0('0x5e')]:undefined)||'total'},{'name':_0x4ea0('0x67'),'value':_0x2530fd['attrVoiceQueues']||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd[_0x4ea0('0x5d')][0x1]?_0x2530fd[_0x4ea0('0x5d')][0x1][_0x4ea0('0x5e')]:undefined)||[]},{'name':_0x4ea0('0x68'),'value':_0x2530fd['attrFontSize']||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd[_0x4ea0('0x5d')][0x2]?_0x2530fd[_0x4ea0('0x5d')][0x2][_0x4ea0('0x5e')]:undefined)||0x14}];case'multibar-chart':case _0x4ea0('0x69'):return[{'name':_0x4ea0('0x6a'),'value':_0x2530fd[_0x4ea0('0x6a')]||(_0x2530fd['attrs']&&_0x2530fd[_0x4ea0('0x5d')][0x0]?_0x2530fd['attrs'][0x0][_0x4ea0('0x5e')]:undefined)||_0x4ea0('0x6b')},{'name':_0x4ea0('0x6c'),'value':_0x2530fd[_0x4ea0('0x6c')]||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd[_0x4ea0('0x5d')][0x1]?_0x2530fd[_0x4ea0('0x5d')][0x1]['value']:undefined)||null},{'name':_0x4ea0('0x6d'),'value':_0x2530fd[_0x4ea0('0x6d')]||(_0x2530fd['attrs']&&_0x2530fd['attrs'][0x2]?_0x2530fd[_0x4ea0('0x5d')][0x2][_0x4ea0('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2530fd['attrVoiceQueues']||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd[_0x4ea0('0x5d')][0x3]?_0x2530fd[_0x4ea0('0x5d')][0x3][_0x4ea0('0x5e')]:undefined)||[]}];case _0x4ea0('0x6e'):return[{'name':'attrReport','type':_0x2530fd[_0x4ea0('0x6f')]||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd[_0x4ea0('0x5d')][0x0]?_0x2530fd[_0x4ea0('0x5d')][0x0][_0x4ea0('0x44')]:undefined)||null,'value':_0x2530fd[_0x4ea0('0x70')]||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd['attrs'][0x0]?_0x2530fd['attrs'][0x0]['value']:undefined)||null},{'name':_0x4ea0('0x71'),'value':_0x2530fd['attrRefresh']||(_0x2530fd[_0x4ea0('0x5d')]&&_0x2530fd[_0x4ea0('0x5d')][0x1]?_0x2530fd['attrs'][0x1][_0x4ea0('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x59a82b){logger['error']('widgetAttributes:\x20%s',JSON[_0x4ea0('0x72')](_0x59a82b));return[];}}exports[_0x4ea0('0x73')]=function(_0x20eb42,_0x504dfb,_0x5317ac){if(_0x20eb42['body']['id']){delete _0x20eb42['body']['id'];}return db[_0x4ea0('0x33')][_0x4ea0('0x4d')]({'where':{'id':_0x20eb42[_0x4ea0('0x58')]['id']}})[_0x4ea0('0x28')](handleEntityNotFound(_0x504dfb,null))[_0x4ea0('0x28')](function(_0x3b8528){if(_0x3b8528){_0x20eb42[_0x4ea0('0x4f')][_0x4ea0('0x74')]=_0x3b8528['id'];_0x20eb42[_0x4ea0('0x4f')][_0x4ea0('0x5d')]=widgetAttributes(_0x20eb42[_0x4ea0('0x4f')]);return db[_0x4ea0('0x75')]['create'](_0x20eb42[_0x4ea0('0x4f')]);}})['then'](respondWithResult(_0x504dfb,null))[_0x4ea0('0x4b')](handleError(_0x504dfb,null));};exports[_0x4ea0('0x76')]=function(_0x1f2d95,_0x39962b,_0x4b83a2){var _0x5578eb={};var _0x5c32ba={};var _0x2cdb63;var _0x14aa52;return db[_0x4ea0('0x33')]['findOne']({'where':{'id':_0x1f2d95[_0x4ea0('0x58')]['id']}})[_0x4ea0('0x28')](handleEntityNotFound(_0x39962b,null))[_0x4ea0('0x28')](function(_0x56fe65){if(_0x56fe65){_0x2cdb63=_0x56fe65;_0x5c32ba[_0x4ea0('0x38')]=_[_0x4ea0('0x4c')](db['DashboardItem'][_0x4ea0('0x34')]);_0x5c32ba[_0x4ea0('0x37')]=_['keys'](_0x1f2d95['query']);_0x5c32ba[_0x4ea0('0x40')]=_[_0x4ea0('0x3a')](_0x5c32ba[_0x4ea0('0x38')],_0x5c32ba[_0x4ea0('0x37')]);_0x5578eb[_0x4ea0('0x39')]=_[_0x4ea0('0x3a')](_0x5c32ba[_0x4ea0('0x38')],qs[_0x4ea0('0x3b')](_0x1f2d95['query'][_0x4ea0('0x3b')]));_0x5578eb['attributes']=_0x5578eb[_0x4ea0('0x39')][_0x4ea0('0x3c')]?_0x5578eb['attributes']:_0x5c32ba[_0x4ea0('0x38')];_0x5578eb[_0x4ea0('0x3e')]=qs[_0x4ea0('0x3f')](_0x1f2d95[_0x4ea0('0x37')]['sort']);_0x5578eb[_0x4ea0('0x42')]=qs[_0x4ea0('0x40')](_[_0x4ea0('0x77')](_0x1f2d95[_0x4ea0('0x37')],_0x5c32ba['filters']));if(_0x1f2d95[_0x4ea0('0x37')][_0x4ea0('0x41')]){_0x5578eb[_0x4ea0('0x42')]=_[_0x4ea0('0x43')](_0x5578eb[_0x4ea0('0x42')],{'$or':_[_0x4ea0('0x32')](_0x5578eb[_0x4ea0('0x39')],function(_0x3c1756){var _0x4f1f7d={};_0x4f1f7d[_0x3c1756]={'$like':'%'+_0x1f2d95[_0x4ea0('0x37')][_0x4ea0('0x41')]+'%'};return _0x4f1f7d;})});}_0x5578eb=_[_0x4ea0('0x43')]({},_0x5578eb,_0x1f2d95[_0x4ea0('0x46')]);return _0x2cdb63[_0x4ea0('0x76')](_0x5578eb);}})[_0x4ea0('0x28')](function(_0x158bd3){if(_0x158bd3){_0x14aa52=_0x158bd3[_0x4ea0('0x3c')];if(!_0x1f2d95[_0x4ea0('0x37')][_0x4ea0('0x3d')](_0x4ea0('0x78'))){_0x5578eb[_0x4ea0('0x20')]=qs[_0x4ea0('0x20')](_0x1f2d95[_0x4ea0('0x37')][_0x4ea0('0x20')]);_0x5578eb['offset']=qs['offset'](_0x1f2d95[_0x4ea0('0x37')][_0x4ea0('0x22')]);}return _0x2cdb63[_0x4ea0('0x76')](_0x5578eb);}})[_0x4ea0('0x28')](function(_0x1f94d4){if(_0x1f94d4){return _0x1f94d4?{'count':_0x14aa52,'rows':_0x1f94d4}:null;}})[_0x4ea0('0x28')](respondWithResult(_0x39962b,null))[_0x4ea0('0x4b')](handleError(_0x39962b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a28123e..f6ff336 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 _0x3068=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x240101,_0x2c5167){var _0x4a10f5=function(_0x3a15ff){while(--_0x3a15ff){_0x240101['push'](_0x240101['shift']());}};_0x4a10f5(++_0x2c5167);}(_0x3068,0xe7));var _0x8306=function(_0x19e96f,_0x27ceda){_0x19e96f=_0x19e96f-0x0;var _0x3a4cda=_0x3068[_0x19e96f];return _0x3a4cda;};'use strict';var EventEmitter=require(_0x8306('0x0'));var Dashboard=require(_0x8306('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8306('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8306('0x3')};function emitEvent(_0x18f399){return function(_0x36df21,_0x31aa82,_0x5ab6e2){DashboardEvents[_0x8306('0x4')](_0x18f399+':'+_0x36df21['id'],_0x36df21);DashboardEvents['emit'](_0x18f399,_0x36df21);_0x5ab6e2(null);};}for(var e in events){if(events[_0x8306('0x5')](e)){var event=events[e];Dashboard[_0x8306('0x6')](e,emitEvent(event));}}module[_0x8306('0x7')]=DashboardEvents; \ No newline at end of file +var _0xf935=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x5becbf,_0x2ff661){var _0x11c638=function(_0x3abcb1){while(--_0x3abcb1){_0x5becbf['push'](_0x5becbf['shift']());}};_0x11c638(++_0x2ff661);}(_0xf935,0x1ef));var _0x5f93=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf935[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x5f93('0x0'));var Dashboard=require(_0x5f93('0x1'))['db'][_0x5f93('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5f93('0x3')](0x0);var events={'afterCreate':_0x5f93('0x4'),'afterUpdate':_0x5f93('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5616a){return function(_0x530f76,_0x398632,_0x5f40be){DashboardEvents[_0x5f93('0x6')](_0x5616a+':'+_0x530f76['id'],_0x530f76);DashboardEvents[_0x5f93('0x6')](_0x5616a,_0x530f76);_0x5f40be(null);};}for(var e in events){if(events[_0x5f93('0x7')](e)){var event=events[e];Dashboard[_0x5f93('0x8')](e,emitEvent(event));}}module[_0x5f93('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8c0dbb8..1d80bf1 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 _0xd110=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','util','../../config/logger','moment'];(function(_0x292eec,_0xe1aff1){var _0xf243a5=function(_0x2ea8ba){while(--_0x2ea8ba){_0x292eec['push'](_0x292eec['shift']());}};_0xf243a5(++_0xe1aff1);}(_0xd110,0x1e8));var _0x0d11=function(_0x35fea9,_0x570df3){_0x35fea9=_0x35fea9-0x0;var _0x4510d3=_0xd110[_0x35fea9];return _0x4510d3;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var logger=require(_0x0d11('0x2'))('api');var moment=require(_0x0d11('0x3'));var BPromise=require(_0x0d11('0x4'));var rp=require(_0x0d11('0x5'));var fs=require('fs');var path=require(_0x0d11('0x6'));var rimraf=require(_0x0d11('0x7'));var config=require(_0x0d11('0x8'));var attributes=require(_0x0d11('0x9'));module[_0x0d11('0xa')]=function(_0x578537,_0xf61dad){return _0x578537['define'](_0x0d11('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fe0=['rimraf','../../config/environment','./dashboard.attributes','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0x4fe0,0x1d8));var _0x04fe=function(_0x3839d0,_0x3bcdb5){_0x3839d0=_0x3839d0-0x0;var _0x20eb7c=_0x4fe0[_0x3839d0];return _0x20eb7c;};'use strict';var _=require(_0x04fe('0x0'));var util=require(_0x04fe('0x1'));var logger=require(_0x04fe('0x2'))(_0x04fe('0x3'));var moment=require(_0x04fe('0x4'));var BPromise=require(_0x04fe('0x5'));var rp=require(_0x04fe('0x6'));var fs=require('fs');var path=require(_0x04fe('0x7'));var rimraf=require(_0x04fe('0x8'));var config=require(_0x04fe('0x9'));var attributes=require(_0x04fe('0xa'));module['exports']=function(_0x2d049e,_0x352e4b){return _0x2d049e['define']('Dashboard',attributes,{'tableName':_0x04fe('0xb'),'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 c207ab2..34e1520 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 _0x7fbe=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x235884,_0x1c4355){_0x235884=_0x235884-0x0;var _0x211158=_0x7fbe[_0x235884];return _0x211158;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});config[_0xe7fb('0xc')]=_[_0xe7fb('0xd')](config['redis'],{'host':_0xe7fb('0xe'),'port':0x18eb});var socket=require(_0xe7fb('0xf'))(new Redis(config[_0xe7fb('0xc')]));require(_0xe7fb('0x10'))['register'](socket);function respondWithRpcPromise(_0x558857,_0x29edb2,_0x2f2ea0){return new BPromise(function(_0x41a514,_0x348a73){return client[_0xe7fb('0x11')](_0x558857,_0x2f2ea0)[_0xe7fb('0x12')](function(_0x3e934b){logger[_0xe7fb('0x13')](_0xe7fb('0x14'),_0x29edb2,_0xe7fb('0x15'));logger[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x29edb2,_0xe7fb('0x15'),JSON[_0xe7fb('0x18')](_0x3e934b));if(_0x3e934b[_0xe7fb('0x19')]){if(_0x3e934b['error'][_0xe7fb('0x1a')]===0x1f4){logger[_0xe7fb('0x19')]('Dashboard,\x20%s,\x20%s',_0x29edb2,_0x3e934b[_0xe7fb('0x19')][_0xe7fb('0x1b')]);return _0x348a73(_0x3e934b['error'][_0xe7fb('0x1b')]);}logger['error'](_0xe7fb('0x14'),_0x29edb2,_0x3e934b[_0xe7fb('0x19')][_0xe7fb('0x1b')]);return _0x41a514(_0x3e934b[_0xe7fb('0x19')]['message']);}else{logger[_0xe7fb('0x13')]('Dashboard,\x20%s,\x20%s',_0x29edb2,_0xe7fb('0x15'));_0x41a514(_0x3e934b['result'][_0xe7fb('0x1b')]);}})[_0xe7fb('0x1c')](function(_0x3f96a7){logger[_0xe7fb('0x19')]('Dashboard,\x20%s,\x20%s',_0x29edb2,_0x3f96a7);_0x348a73(_0x3f96a7);});});} \ No newline at end of file +var _0xeaac=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x31c3ec,_0x41a015){var _0x319164=function(_0x52c298){while(--_0x52c298){_0x31c3ec['push'](_0x31c3ec['shift']());}};_0x319164(++_0x41a015);}(_0xeaac,0x171));var _0xceaa=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xeaac[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xceaa('0x0'));var util=require('util');var moment=require(_0xceaa('0x1'));var BPromise=require(_0xceaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xceaa('0x3'));var db=require(_0xceaa('0x4'))['db'];var utils=require(_0xceaa('0x5'));var logger=require('../../config/logger')(_0xceaa('0x6'));var config=require(_0xceaa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xceaa('0x8')][_0xceaa('0x9')]({'port':0x232a});config[_0xceaa('0xa')]=_['defaults'](config[_0xceaa('0xa')],{'host':_0xceaa('0xb'),'port':0x18eb});var socket=require(_0xceaa('0xc'))(new Redis(config[_0xceaa('0xa')]));require(_0xceaa('0xd'))[_0xceaa('0xe')](socket);function respondWithRpcPromise(_0x5bd31b,_0x131a82,_0x4185b0){return new BPromise(function(_0x36128f,_0x3d054e){return client['request'](_0x5bd31b,_0x4185b0)[_0xceaa('0xf')](function(_0x5af961){logger[_0xceaa('0x10')](_0xceaa('0x11'),_0x131a82,_0xceaa('0x12'));logger['debug'](_0xceaa('0x13'),_0x131a82,_0xceaa('0x12'),JSON[_0xceaa('0x14')](_0x5af961));if(_0x5af961['error']){if(_0x5af961[_0xceaa('0x15')][_0xceaa('0x16')]===0x1f4){logger[_0xceaa('0x15')](_0xceaa('0x11'),_0x131a82,_0x5af961['error'][_0xceaa('0x17')]);return _0x3d054e(_0x5af961[_0xceaa('0x15')][_0xceaa('0x17')]);}logger[_0xceaa('0x15')]('Dashboard,\x20%s,\x20%s',_0x131a82,_0x5af961[_0xceaa('0x15')][_0xceaa('0x17')]);return _0x36128f(_0x5af961[_0xceaa('0x15')][_0xceaa('0x17')]);}else{logger[_0xceaa('0x10')](_0xceaa('0x11'),_0x131a82,_0xceaa('0x12'));_0x36128f(_0x5af961[_0xceaa('0x18')][_0xceaa('0x17')]);}})['catch'](function(_0x1f2444){logger[_0xceaa('0x15')]('Dashboard,\x20%s,\x20%s',_0x131a82,_0x1f2444);_0x3d054e(_0x1f2444);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ccdd1ca..acfad4c 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 _0x9ecd=['update','emit','removeListener','length','dashboard:','./dashboard.events'];(function(_0x5a89ea,_0x55c3bc){var _0x36bcf0=function(_0x105c22){while(--_0x105c22){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x36bcf0(++_0x55c3bc);}(_0x9ecd,0xfb));var _0xd9ec=function(_0x2fc9a5,_0x289953){_0x2fc9a5=_0x2fc9a5-0x0;var _0x2777a8=_0x9ecd[_0x2fc9a5];return _0x2777a8;};'use strict';var DashboardEvents=require(_0xd9ec('0x0'));var events=['save','remove',_0xd9ec('0x1')];function createListener(_0x49f7da,_0x5ed8ef){return function(_0x583893){_0x5ed8ef[_0xd9ec('0x2')](_0x49f7da,_0x583893);};}function removeListener(_0x28c4e4,_0x4eb683){return function(){DashboardEvents[_0xd9ec('0x3')](_0x28c4e4,_0x4eb683);};}exports['register']=function(_0xdf1efd){for(var _0x16eb9d=0x0,_0x3ecdba=events[_0xd9ec('0x4')];_0x16eb9d<_0x3ecdba;_0x16eb9d++){var _0xa2ab74=events[_0x16eb9d];var _0x19530b=createListener(_0xd9ec('0x5')+_0xa2ab74,_0xdf1efd);DashboardEvents['on'](_0xa2ab74,_0x19530b);}}; \ No newline at end of file +var _0x591d=['update','emit','length','dashboard:','save'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x591d,0x176));var _0xd591=function(_0x33e2ec,_0xa04eb){_0x33e2ec=_0x33e2ec-0x0;var _0x5f031f=_0x591d[_0x33e2ec];return _0x5f031f;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xd591('0x0'),'remove',_0xd591('0x1')];function createListener(_0x5c1b3e,_0x1ae044){return function(_0x142ee6){_0x1ae044[_0xd591('0x2')](_0x5c1b3e,_0x142ee6);};}function removeListener(_0x18982a,_0x18d613){return function(){DashboardEvents['removeListener'](_0x18982a,_0x18d613);};}exports['register']=function(_0x2d027a){for(var _0x441605=0x0,_0x4d17d8=events[_0xd591('0x3')];_0x441605<_0x4d17d8;_0x441605++){var _0x43a1ea=events[_0x441605];var _0x2bd7ab=createListener(_0xd591('0x4')+_0x43a1ea,_0x2d027a);DashboardEvents['on'](_0x43a1ea,_0x2bd7ab);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 50642ec..a188118 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 _0xce11=['../../components/interaction/service','./dashboard.controller','get','isAuthenticated','show','/:id/items','post','create','/:id/clone','clone','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20fc69,_0xb93443){var _0x291e48=function(_0x17da51){while(--_0x17da51){_0x20fc69['push'](_0x20fc69['shift']());}};_0x291e48(++_0xb93443);}(_0xce11,0x92));var _0x1ce1=function(_0x8f208c,_0xc4d292){_0x8f208c=_0x8f208c-0x0;var _0xf33280=_0xce11[_0x8f208c];return _0xf33280;};'use strict';var multer=require(_0x1ce1('0x0'));var util=require(_0x1ce1('0x1'));var path=require(_0x1ce1('0x2'));var timeout=require(_0x1ce1('0x3'));var express=require(_0x1ce1('0x4'));var router=express[_0x1ce1('0x5')]();var fs_extra=require(_0x1ce1('0x6'));var auth=require(_0x1ce1('0x7'));var interaction=require(_0x1ce1('0x8'));var config=require('../../config/environment');var controller=require(_0x1ce1('0x9'));router[_0x1ce1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ce1('0xa')]('/:id',auth[_0x1ce1('0xb')](),controller[_0x1ce1('0xc')]);router[_0x1ce1('0xa')](_0x1ce1('0xd'),auth[_0x1ce1('0xb')](),controller['getItems']);router[_0x1ce1('0xe')]('/',auth['isAuthenticated'](),controller[_0x1ce1('0xf')]);router['post'](_0x1ce1('0x10'),auth[_0x1ce1('0xb')](),controller[_0x1ce1('0x11')]);router['post'](_0x1ce1('0xd'),auth['isAuthenticated'](),controller['addItem']);router[_0x1ce1('0x12')](_0x1ce1('0x13'),auth[_0x1ce1('0xb')](),controller['update']);router[_0x1ce1('0x14')](_0x1ce1('0x13'),auth[_0x1ce1('0xb')](),controller[_0x1ce1('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe929=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','create','/:id/clone','clone','addItem','put'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xe929,0xe8));var _0x9e92=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0xe929[_0x9be28f];return _0xa9f52d;};'use strict';var multer=require(_0x9e92('0x0'));var util=require(_0x9e92('0x1'));var path=require('path');var timeout=require(_0x9e92('0x2'));var express=require(_0x9e92('0x3'));var router=express[_0x9e92('0x4')]();var fs_extra=require(_0x9e92('0x5'));var auth=require(_0x9e92('0x6'));var interaction=require(_0x9e92('0x7'));var config=require(_0x9e92('0x8'));var controller=require(_0x9e92('0x9'));router[_0x9e92('0xa')]('/',auth[_0x9e92('0xb')](),controller[_0x9e92('0xc')]);router[_0x9e92('0xa')](_0x9e92('0xd'),auth[_0x9e92('0xb')](),controller[_0x9e92('0xe')]);router[_0x9e92('0xa')](_0x9e92('0xf'),auth[_0x9e92('0xb')](),controller['getItems']);router['post']('/',auth[_0x9e92('0xb')](),controller[_0x9e92('0x10')]);router['post'](_0x9e92('0x11'),auth[_0x9e92('0xb')](),controller[_0x9e92('0x12')]);router['post']('/:id/items',auth[_0x9e92('0xb')](),controller[_0x9e92('0x13')]);router[_0x9e92('0x14')](_0x9e92('0xd'),auth[_0x9e92('0xb')](),controller['update']);router['delete']('/:id',auth[_0x9e92('0xb')](),controller[_0x9e92('0x15')]);module[_0x9e92('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index c01c60f..cf1baab 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 _0xc4aa=['getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x5722b5,_0x14b788){var _0x5570de=function(_0x520f6e){while(--_0x520f6e){_0x5722b5['push'](_0x5722b5['shift']());}};_0x5570de(++_0x14b788);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xac4a('0x0'));var squel=require(_0xac4a('0x1'));var _=require(_0xac4a('0x2'));module[_0xac4a('0x3')]={'title':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xac4a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this[_0xac4a('0x5')](_0xac4a('0x6')));}catch(_0x730a38){return[];}},'set':function(_0x215f39){try{this[_0xac4a('0x7')](_0xac4a('0x6'),JSON[_0xac4a('0x8')](_0x215f39));}catch(_0x10525b){this['setDataValue']('attrs',JSON[_0xac4a('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xac4a('0x9')]},'background':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![],'defaultValue':_0xac4a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xac4a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xac4a('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xdbf5=['squel','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x2d0302,_0x7fe853){var _0x92369f=function(_0x409366){while(--_0x409366){_0x2d0302['push'](_0x2d0302['shift']());}};_0x92369f(++_0x7fe853);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x317d26,_0x54aac5){_0x317d26=_0x317d26-0x0;var _0x3aa817=_0xdbf5[_0x317d26];return _0x3aa817;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5dbf('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dbf('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5dbf('0x2')](_0x5dbf('0x3')),'get':function(){try{return JSON[_0x5dbf('0x4')](this[_0x5dbf('0x5')](_0x5dbf('0x6')));}catch(_0x1decd2){return[];}},'set':function(_0x3f8628){try{this[_0x5dbf('0x7')](_0x5dbf('0x6'),JSON[_0x5dbf('0x8')](_0x3f8628));}catch(_0x93e657){this['setDataValue'](_0x5dbf('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5dbf('0x9')]},'col':{'type':Sequelize[_0x5dbf('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dbf('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5dbf('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 6701636..857db95 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 _0xb02a=['request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','update','then','error','stack','send','show','params','DashboardItem','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','merge','options','find','catch','destroy','type','iframe','attrUrl','attrs','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','zip-dir'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb02a,0xb0));var _0xab02=function(_0x287aa5,_0x125a8b){_0x287aa5=_0x287aa5-0x0;var _0x303ed0=_0xb02a[_0x287aa5];return _0x303ed0;};'use strict';var emlformat=require(_0xab02('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab02('0x2'));var moment=require(_0xab02('0x3'));var BPromise=require(_0xab02('0x4'));var Mustache=require('mustache');var util=require(_0xab02('0x5'));var path=require(_0xab02('0x6'));var sox=require(_0xab02('0x7'));var csv=require(_0xab02('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab02('0x9'));var _=require(_0xab02('0xa'));var squel=require(_0xab02('0xb'));var crypto=require(_0xab02('0xc'));var jsforce=require(_0xab02('0xd'));var deskjs=require(_0xab02('0xe'));var toCsv=require(_0xab02('0x8'));var querystring=require(_0xab02('0xf'));var Papa=require('papaparse');var Redis=require(_0xab02('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xab02('0x11'));var as=require(_0xab02('0x12'));var hardwareService=require(_0xab02('0x13'));var logger=require('../../config/logger')(_0xab02('0x14'));var utils=require(_0xab02('0x15'));var config=require(_0xab02('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xab02('0x17'))['db'];config[_0xab02('0x18')]=_[_0xab02('0x19')](config[_0xab02('0x18')],{'host':_0xab02('0x1a'),'port':0x18eb});var socket=require(_0xab02('0x1b'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xab02('0x1c')](socket);function respondWithStatusCode(_0x1de92f,_0xfe257c){_0xfe257c=_0xfe257c||0xcc;return function(_0x3affcf){if(_0x3affcf){return _0x1de92f[_0xab02('0x1d')](_0xfe257c);}return _0x1de92f[_0xab02('0x1e')](_0xfe257c)[_0xab02('0x1f')]();};}function respondWithResult(_0x37a3d5,_0x5e376c){_0x5e376c=_0x5e376c||0xc8;return function(_0x5ceb6b){if(_0x5ceb6b){return _0x37a3d5['status'](_0x5e376c)['json'](_0x5ceb6b);}};}function respondWithFilteredResult(_0x25e1f5,_0x4397d4){return function(_0x32ec21){if(_0x32ec21){var _0x1daa85=typeof _0x4397d4[_0xab02('0x20')]==='undefined'&&typeof _0x4397d4['limit']===_0xab02('0x21');var _0xfb8772=_0x32ec21['count'];var _0x15c2ee=_0x1daa85?0x0:_0x4397d4[_0xab02('0x20')];var _0x53ee86=_0x1daa85?_0x32ec21[_0xab02('0x22')]:_0x4397d4[_0xab02('0x20')]+_0x4397d4[_0xab02('0x23')];var _0x51afe9;if(_0x53ee86>=_0xfb8772){_0x53ee86=_0xfb8772;_0x51afe9=0xc8;}else{_0x51afe9=0xce;}_0x25e1f5[_0xab02('0x1e')](_0x51afe9);return _0x25e1f5[_0xab02('0x24')]('Content-Range',_0x15c2ee+'-'+_0x53ee86+'/'+_0xfb8772)['json'](_0x32ec21);}return null;};}function patchUpdates(_0xa9b509){return function(_0x2596bc){try{jsonpatch[_0xab02('0x25')](_0x2596bc,_0xa9b509,!![]);}catch(_0x3e6a51){return BPromise[_0xab02('0x26')](_0x3e6a51);}return _0x2596bc['save']();};}function saveUpdates(_0x4f1b98,_0x2b4f8a){return function(_0x4584ef){if(_0x4584ef){return _0x4584ef[_0xab02('0x27')](_0x4f1b98)[_0xab02('0x28')](function(_0x342733){return _0x342733;});}return null;};}function removeEntity(_0x13df11,_0xebe382){return function(_0xca5846){if(_0xca5846){return _0xca5846['destroy']()[_0xab02('0x28')](function(){_0x13df11[_0xab02('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28463f,_0x3dfe62){return function(_0x2395b3){if(!_0x2395b3){_0x28463f['sendStatus'](0x194);}return _0x2395b3;};}function handleError(_0xc8c264,_0x3feeab){_0x3feeab=_0x3feeab||0x1f4;return function(_0x50353c){logger[_0xab02('0x29')](_0x50353c[_0xab02('0x2a')]);if(_0x50353c['name']){delete _0x50353c['name'];}_0xc8c264[_0xab02('0x1e')](_0x3feeab)[_0xab02('0x2b')](_0x50353c);};}exports[_0xab02('0x2c')]=function(_0x27451d,_0x23ab22){var _0x356e13={'raw':![],'where':{'id':_0x27451d[_0xab02('0x2d')]['id']}},_0x58637f={};_0x58637f['model']=_['keys'](db[_0xab02('0x2e')][_0xab02('0x2f')]);_0x58637f[_0xab02('0x30')]=_[_0xab02('0x31')](_0x27451d['query']);_0x58637f[_0xab02('0x32')]=_[_0xab02('0x33')](_0x58637f[_0xab02('0x34')],_0x58637f[_0xab02('0x30')]);_0x356e13['attributes']=_[_0xab02('0x33')](_0x58637f[_0xab02('0x34')],qs[_0xab02('0x35')](_0x27451d[_0xab02('0x30')]['fields']));_0x356e13[_0xab02('0x36')]=_0x356e13[_0xab02('0x36')][_0xab02('0x37')]?_0x356e13[_0xab02('0x36')]:_0x58637f[_0xab02('0x34')];if(_0x27451d[_0xab02('0x30')]['includeAll']){_0x356e13['include']=[{'all':!![]}];}_0x356e13=_[_0xab02('0x38')]({},_0x356e13,_0x27451d[_0xab02('0x39')]);return db[_0xab02('0x2e')][_0xab02('0x3a')](_0x356e13)['then'](handleEntityNotFound(_0x23ab22,null))[_0xab02('0x28')](respondWithResult(_0x23ab22,null))[_0xab02('0x3b')](handleError(_0x23ab22,null));};exports[_0xab02('0x3c')]=function(_0x5b1550,_0x3f95bd){return db[_0xab02('0x2e')][_0xab02('0x3a')]({'where':{'id':_0x5b1550[_0xab02('0x2d')]['id']}})[_0xab02('0x28')](handleEntityNotFound(_0x3f95bd,null))[_0xab02('0x28')](removeEntity(_0x3f95bd,null))[_0xab02('0x3b')](handleError(_0x3f95bd,null));};function widgetAttributes(_0x624591){try{switch(_0x624591[_0xab02('0x3d')]){case _0xab02('0x3e'):return[{'name':_0xab02('0x3f'),'value':_0x624591['attrUrl']||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x0]?_0x624591[_0xab02('0x40')][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0xab02('0x41'),'value':_0x624591['attrPath']||(_0x624591[_0xab02('0x40')]&&_0x624591['attrs'][0x0]?_0x624591[_0xab02('0x40')][0x0][_0xab02('0x42')]:undefined)||''}];case _0xab02('0x43'):return[{'name':_0xab02('0x44'),'value':_0x624591[_0xab02('0x44')]||(_0x624591[_0xab02('0x40')]&&_0x624591['attrs'][0x0]?_0x624591[_0xab02('0x40')][0x0][_0xab02('0x42')]:undefined)||_0xab02('0x45')},{'name':_0xab02('0x46'),'value':_0x624591[_0xab02('0x46')]||(_0x624591['attrs']&&_0x624591[_0xab02('0x40')][0x1]?_0x624591['attrs'][0x1]['value']:undefined)||_0xab02('0x47')},{'name':_0xab02('0x48'),'value':_0x624591[_0xab02('0x48')]||(_0x624591['attrs']&&_0x624591[_0xab02('0x40')][0x2]?_0x624591[_0xab02('0x40')][0x2][_0xab02('0x42')]:undefined)||0xc}];case _0xab02('0x49'):return[{'name':'attrMetric','value':_0x624591[_0xab02('0x4a')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x0]?_0x624591[_0xab02('0x40')][0x0][_0xab02('0x42')]:undefined)||_0xab02('0x4b')},{'name':'attrVoiceQueues','value':_0x624591[_0xab02('0x4c')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x1]?_0x624591['attrs'][0x1][_0xab02('0x42')]:undefined)||[]},{'name':_0xab02('0x48'),'value':_0x624591[_0xab02('0x48')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x2]?_0x624591[_0xab02('0x40')][0x2][_0xab02('0x42')]:undefined)||0x14}];case _0xab02('0x4d'):case _0xab02('0x4e'):return[{'name':_0xab02('0x4f'),'value':_0x624591[_0xab02('0x4f')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x0]?_0x624591[_0xab02('0x40')][0x0][_0xab02('0x42')]:undefined)||_0xab02('0x4b')},{'name':_0xab02('0x50'),'value':_0x624591[_0xab02('0x50')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x1]?_0x624591['attrs'][0x1]['value']:undefined)||null},{'name':_0xab02('0x51'),'value':_0x624591['attrSerie3']||(_0x624591[_0xab02('0x40')]&&_0x624591['attrs'][0x2]?_0x624591[_0xab02('0x40')][0x2][_0xab02('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x624591[_0xab02('0x4c')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x3]?_0x624591['attrs'][0x3]['value']:undefined)||[]}];case _0xab02('0x52'):return[{'name':_0xab02('0x53'),'type':_0x624591[_0xab02('0x54')]||(_0x624591[_0xab02('0x40')]&&_0x624591['attrs'][0x0]?_0x624591[_0xab02('0x40')][0x0][_0xab02('0x3d')]:undefined)||null,'value':_0x624591[_0xab02('0x53')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x0]?_0x624591[_0xab02('0x40')][0x0][_0xab02('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x624591[_0xab02('0x55')]||(_0x624591[_0xab02('0x40')]&&_0x624591[_0xab02('0x40')][0x1]?_0x624591['attrs'][0x1][_0xab02('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x53b669){logger[_0xab02('0x29')]('widgetAttributes:\x20%s',JSON[_0xab02('0x56')](_0x53b669));return[];}}exports[_0xab02('0x57')]=function(_0x1bdb0e,_0x567110){if(_0x1bdb0e[_0xab02('0x58')]){_0x1bdb0e[_0xab02('0x58')]['attrs']=widgetAttributes(_0x1bdb0e[_0xab02('0x58')]);}return db[_0xab02('0x2e')][_0xab02('0x57')](_0x1bdb0e[_0xab02('0x58')],{})[_0xab02('0x28')](respondWithResult(_0x567110,0xc9))[_0xab02('0x3b')](handleError(_0x567110,null));};exports[_0xab02('0x27')]=function(_0x4d70a6,_0x307f04){if(_0x4d70a6[_0xab02('0x58')]['id']){delete _0x4d70a6[_0xab02('0x58')]['id'];}_0x4d70a6[_0xab02('0x58')][_0xab02('0x40')]=widgetAttributes(_0x4d70a6[_0xab02('0x58')]);return db[_0xab02('0x2e')][_0xab02('0x3a')]({'where':{'id':_0x4d70a6['params']['id']}})[_0xab02('0x28')](handleEntityNotFound(_0x307f04,null))[_0xab02('0x28')](saveUpdates(_0x4d70a6[_0xab02('0x58')],null))[_0xab02('0x28')](respondWithResult(_0x307f04,null))[_0xab02('0x3b')](handleError(_0x307f04,null));}; \ No newline at end of file +var _0xd99b=['reject','update','then','destroy','end','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','params','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','body','catch','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x17d76b,_0x54345b){var _0x16f3ac=function(_0x315442){while(--_0x315442){_0x17d76b['push'](_0x17d76b['shift']());}};_0x16f3ac(++_0x54345b);}(_0xd99b,0x1f3));var _0xbd99=function(_0x39ef71,_0x185671){_0x39ef71=_0x39ef71-0x0;var _0x2b3da5=_0xd99b[_0x39ef71];return _0x2b3da5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd99('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd99('0x1'));var rp=require(_0xbd99('0x2'));var moment=require('moment');var BPromise=require(_0xbd99('0x3'));var Mustache=require('mustache');var util=require(_0xbd99('0x4'));var path=require(_0xbd99('0x5'));var sox=require(_0xbd99('0x6'));var csv=require(_0xbd99('0x7'));var ejs=require(_0xbd99('0x8'));var fs=require('fs');var fs_extra=require(_0xbd99('0x9'));var _=require(_0xbd99('0xa'));var squel=require(_0xbd99('0xb'));var crypto=require(_0xbd99('0xc'));var jsforce=require(_0xbd99('0xd'));var deskjs=require(_0xbd99('0xe'));var toCsv=require(_0xbd99('0x7'));var querystring=require(_0xbd99('0xf'));var Papa=require(_0xbd99('0x10'));var Redis=require(_0xbd99('0x11'));var authService=require(_0xbd99('0x12'));var qs=require(_0xbd99('0x13'));var as=require(_0xbd99('0x14'));var hardwareService=require(_0xbd99('0x15'));var logger=require('../../config/logger')(_0xbd99('0x16'));var utils=require(_0xbd99('0x17'));var config=require(_0xbd99('0x18'));var licenseUtil=require(_0xbd99('0x19'));var db=require('../../mysqldb')['db'];config[_0xbd99('0x1a')]=_[_0xbd99('0x1b')](config['redis'],{'host':_0xbd99('0x1c'),'port':0x18eb});var socket=require(_0xbd99('0x1d'))(new Redis(config['redis']));require(_0xbd99('0x1e'))[_0xbd99('0x1f')](socket);function respondWithStatusCode(_0x1c2336,_0x47b240){_0x47b240=_0x47b240||0xcc;return function(_0x1db7f9){if(_0x1db7f9){return _0x1c2336[_0xbd99('0x20')](_0x47b240);}return _0x1c2336[_0xbd99('0x21')](_0x47b240)['end']();};}function respondWithResult(_0x175fb7,_0x26faa3){_0x26faa3=_0x26faa3||0xc8;return function(_0x82b8b0){if(_0x82b8b0){return _0x175fb7['status'](_0x26faa3)[_0xbd99('0x22')](_0x82b8b0);}};}function respondWithFilteredResult(_0x522012,_0x285746){return function(_0x2657d1){if(_0x2657d1){var _0x39d85a=typeof _0x285746[_0xbd99('0x23')]===_0xbd99('0x24')&&typeof _0x285746['limit']==='undefined';var _0xe272e8=_0x2657d1['count'];var _0x1a2479=_0x39d85a?0x0:_0x285746[_0xbd99('0x23')];var _0x460328=_0x39d85a?_0x2657d1[_0xbd99('0x25')]:_0x285746[_0xbd99('0x23')]+_0x285746[_0xbd99('0x26')];var _0x51ff83;if(_0x460328>=_0xe272e8){_0x460328=_0xe272e8;_0x51ff83=0xc8;}else{_0x51ff83=0xce;}_0x522012[_0xbd99('0x21')](_0x51ff83);return _0x522012[_0xbd99('0x27')](_0xbd99('0x28'),_0x1a2479+'-'+_0x460328+'/'+_0xe272e8)['json'](_0x2657d1);}return null;};}function patchUpdates(_0x52ae48){return function(_0x12e409){try{jsonpatch['apply'](_0x12e409,_0x52ae48,!![]);}catch(_0x4dfa32){return BPromise[_0xbd99('0x29')](_0x4dfa32);}return _0x12e409['save']();};}function saveUpdates(_0x4228e1,_0x50884e){return function(_0x41d309){if(_0x41d309){return _0x41d309[_0xbd99('0x2a')](_0x4228e1)[_0xbd99('0x2b')](function(_0x4e19c2){return _0x4e19c2;});}return null;};}function removeEntity(_0x2f9eda,_0x1d3bc9){return function(_0x476370){if(_0x476370){return _0x476370[_0xbd99('0x2c')]()[_0xbd99('0x2b')](function(){_0x2f9eda[_0xbd99('0x21')](0xcc)[_0xbd99('0x2d')]();});}};}function handleEntityNotFound(_0x2dd61c,_0x14a3e9){return function(_0xb41daf){if(!_0xb41daf){_0x2dd61c['sendStatus'](0x194);}return _0xb41daf;};}function handleError(_0x56eec2,_0x492ca1){_0x492ca1=_0x492ca1||0x1f4;return function(_0x1d4fd7){logger[_0xbd99('0x2e')](_0x1d4fd7[_0xbd99('0x2f')]);if(_0x1d4fd7[_0xbd99('0x30')]){delete _0x1d4fd7[_0xbd99('0x30')];}_0x56eec2[_0xbd99('0x21')](_0x492ca1)[_0xbd99('0x31')](_0x1d4fd7);};}exports[_0xbd99('0x32')]=function(_0x88d44c,_0x4bbbdd){var _0x1f7562={'raw':![],'where':{'id':_0x88d44c['params']['id']}},_0x5780ee={};_0x5780ee[_0xbd99('0x33')]=_[_0xbd99('0x34')](db[_0xbd99('0x35')][_0xbd99('0x36')]);_0x5780ee[_0xbd99('0x37')]=_[_0xbd99('0x34')](_0x88d44c['query']);_0x5780ee[_0xbd99('0x38')]=_[_0xbd99('0x39')](_0x5780ee['model'],_0x5780ee[_0xbd99('0x37')]);_0x1f7562[_0xbd99('0x3a')]=_['intersection'](_0x5780ee[_0xbd99('0x33')],qs['fields'](_0x88d44c[_0xbd99('0x37')][_0xbd99('0x3b')]));_0x1f7562[_0xbd99('0x3a')]=_0x1f7562['attributes'][_0xbd99('0x3c')]?_0x1f7562[_0xbd99('0x3a')]:_0x5780ee[_0xbd99('0x33')];if(_0x88d44c[_0xbd99('0x37')][_0xbd99('0x3d')]){_0x1f7562[_0xbd99('0x3e')]=[{'all':!![]}];}_0x1f7562=_[_0xbd99('0x3f')]({},_0x1f7562,_0x88d44c[_0xbd99('0x40')]);return db[_0xbd99('0x35')][_0xbd99('0x41')](_0x1f7562)[_0xbd99('0x2b')](handleEntityNotFound(_0x4bbbdd,null))[_0xbd99('0x2b')](respondWithResult(_0x4bbbdd,null))['catch'](handleError(_0x4bbbdd,null));};exports[_0xbd99('0x2c')]=function(_0x73e8b0,_0x4e8c69){return db[_0xbd99('0x35')][_0xbd99('0x41')]({'where':{'id':_0x73e8b0[_0xbd99('0x42')]['id']}})[_0xbd99('0x2b')](handleEntityNotFound(_0x4e8c69,null))[_0xbd99('0x2b')](removeEntity(_0x4e8c69,null))['catch'](handleError(_0x4e8c69,null));};function widgetAttributes(_0x29d2fa){try{switch(_0x29d2fa['type']){case'iframe':return[{'name':_0xbd99('0x43'),'value':_0x29d2fa[_0xbd99('0x43')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x0]?_0x29d2fa['attrs'][0x0]['value']:undefined)||_0xbd99('0x45')}];case _0xbd99('0x46'):return[{'name':_0xbd99('0x47'),'value':_0x29d2fa[_0xbd99('0x47')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x0]?_0x29d2fa[_0xbd99('0x44')][0x0][_0xbd99('0x48')]:undefined)||''}];case'clock':return[{'name':_0xbd99('0x49'),'value':_0x29d2fa[_0xbd99('0x49')]||(_0x29d2fa['attrs']&&_0x29d2fa[_0xbd99('0x44')][0x0]?_0x29d2fa['attrs'][0x0][_0xbd99('0x48')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x29d2fa[_0xbd99('0x4a')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x1]?_0x29d2fa['attrs'][0x1][_0xbd99('0x48')]:undefined)||'0.00'},{'name':_0xbd99('0x4b'),'value':_0x29d2fa[_0xbd99('0x4b')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x2]?_0x29d2fa[_0xbd99('0x44')][0x2][_0xbd99('0x48')]:undefined)||0xc}];case _0xbd99('0x4c'):return[{'name':_0xbd99('0x4d'),'value':_0x29d2fa['attrMetric']||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x0]?_0x29d2fa[_0xbd99('0x44')][0x0][_0xbd99('0x48')]:undefined)||_0xbd99('0x4e')},{'name':_0xbd99('0x4f'),'value':_0x29d2fa[_0xbd99('0x4f')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x1]?_0x29d2fa['attrs'][0x1][_0xbd99('0x48')]:undefined)||[]},{'name':_0xbd99('0x4b'),'value':_0x29d2fa[_0xbd99('0x4b')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x2]?_0x29d2fa[_0xbd99('0x44')][0x2]['value']:undefined)||0x14}];case _0xbd99('0x50'):case'pie-chart':return[{'name':_0xbd99('0x51'),'value':_0x29d2fa[_0xbd99('0x51')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x0]?_0x29d2fa['attrs'][0x0]['value']:undefined)||_0xbd99('0x4e')},{'name':_0xbd99('0x52'),'value':_0x29d2fa['attrSerie2']||(_0x29d2fa['attrs']&&_0x29d2fa[_0xbd99('0x44')][0x1]?_0x29d2fa[_0xbd99('0x44')][0x1]['value']:undefined)||null},{'name':_0xbd99('0x53'),'value':_0x29d2fa[_0xbd99('0x53')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa['attrs'][0x2]?_0x29d2fa[_0xbd99('0x44')][0x2][_0xbd99('0x48')]:undefined)||null},{'name':_0xbd99('0x4f'),'value':_0x29d2fa[_0xbd99('0x4f')]||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa[_0xbd99('0x44')][0x3]?_0x29d2fa[_0xbd99('0x44')][0x3]['value']:undefined)||[]}];case _0xbd99('0x54'):return[{'name':_0xbd99('0x55'),'type':_0x29d2fa['reportType']||(_0x29d2fa[_0xbd99('0x44')]&&_0x29d2fa['attrs'][0x0]?_0x29d2fa[_0xbd99('0x44')][0x0]['type']:undefined)||null,'value':_0x29d2fa['attrReport']||(_0x29d2fa['attrs']&&_0x29d2fa[_0xbd99('0x44')][0x0]?_0x29d2fa[_0xbd99('0x44')][0x0][_0xbd99('0x48')]:undefined)||null},{'name':_0xbd99('0x56'),'value':_0x29d2fa[_0xbd99('0x56')]||(_0x29d2fa['attrs']&&_0x29d2fa[_0xbd99('0x44')][0x1]?_0x29d2fa[_0xbd99('0x44')][0x1][_0xbd99('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x1ce3bf){logger['error'](_0xbd99('0x57'),JSON['stringify'](_0x1ce3bf));return[];}}exports['create']=function(_0x202a0a,_0x556493){if(_0x202a0a['body']){_0x202a0a[_0xbd99('0x58')][_0xbd99('0x44')]=widgetAttributes(_0x202a0a[_0xbd99('0x58')]);}return db[_0xbd99('0x35')]['create'](_0x202a0a[_0xbd99('0x58')],{})[_0xbd99('0x2b')](respondWithResult(_0x556493,0xc9))[_0xbd99('0x59')](handleError(_0x556493,null));};exports[_0xbd99('0x2a')]=function(_0x24143e,_0x36eb9b){if(_0x24143e[_0xbd99('0x58')]['id']){delete _0x24143e[_0xbd99('0x58')]['id'];}_0x24143e['body']['attrs']=widgetAttributes(_0x24143e[_0xbd99('0x58')]);return db[_0xbd99('0x35')][_0xbd99('0x41')]({'where':{'id':_0x24143e[_0xbd99('0x42')]['id']}})['then'](handleEntityNotFound(_0x36eb9b,null))['then'](saveUpdates(_0x24143e[_0xbd99('0x58')],null))[_0xbd99('0x2b')](respondWithResult(_0x36eb9b,null))[_0xbd99('0x59')](handleError(_0x36eb9b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f00f90a..f8803b9 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 _0x6263=['save','update','remove','emit','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x37d35f,_0x5b5292){var _0x33f31a=function(_0x3cef57){while(--_0x3cef57){_0x37d35f['push'](_0x37d35f['shift']());}};_0x33f31a(++_0x5b5292);}(_0x6263,0x100));var _0x3626=function(_0x32cf9b,_0x4b0dca){_0x32cf9b=_0x32cf9b-0x0;var _0x3af8c6=_0x6263[_0x32cf9b];return _0x3af8c6;};'use strict';var EventEmitter=require(_0x3626('0x0'));var DashboardItem=require(_0x3626('0x1'))['db'][_0x3626('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3626('0x3')](0x0);var events={'afterCreate':_0x3626('0x4'),'afterUpdate':_0x3626('0x5'),'afterDestroy':_0x3626('0x6')};function emitEvent(_0x9c35b3){return function(_0x21a462,_0x5eb8f6,_0x57c086){DashboardItemEvents[_0x3626('0x7')](_0x9c35b3+':'+_0x21a462['id'],_0x21a462);DashboardItemEvents[_0x3626('0x7')](_0x9c35b3,_0x21a462);_0x57c086(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x3626('0x8')](e,emitEvent(event));}}module[_0x3626('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xda48=['hook','exports','events','DashboardItem','setMaxListeners','emit'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xda48,0xc2));var _0x8da4=function(_0x4dd3aa,_0x31c21d){_0x4dd3aa=_0x4dd3aa-0x0;var _0x2ca7b1=_0xda48[_0x4dd3aa];return _0x2ca7b1;};'use strict';var EventEmitter=require(_0x8da4('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x8da4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8da4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x25869d){return function(_0x2f0332,_0x3016fb,_0xc03319){DashboardItemEvents[_0x8da4('0x3')](_0x25869d+':'+_0x2f0332['id'],_0x2f0332);DashboardItemEvents[_0x8da4('0x3')](_0x25869d,_0x2f0332);_0xc03319(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x8da4('0x4')](e,emitEvent(event));}}module[_0x8da4('0x5')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 7e4b26b..debcff5 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 _0x8ba3=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items','util','api','bluebird'];(function(_0x2c2d03,_0x53bff6){var _0x1d423d=function(_0x42efd9){while(--_0x42efd9){_0x2c2d03['push'](_0x2c2d03['shift']());}};_0x1d423d(++_0x53bff6);}(_0x8ba3,0x1bf));var _0x38ba=function(_0x4ab16f,_0x5e73fe){_0x4ab16f=_0x4ab16f-0x0;var _0x2f929d=_0x8ba3[_0x4ab16f];return _0x2f929d;};'use strict';var _=require('lodash');var util=require(_0x38ba('0x0'));var logger=require('../../config/logger')(_0x38ba('0x1'));var moment=require('moment');var BPromise=require(_0x38ba('0x2'));var rp=require(_0x38ba('0x3'));var fs=require('fs');var path=require(_0x38ba('0x4'));var rimraf=require(_0x38ba('0x5'));var config=require(_0x38ba('0x6'));var attributes=require(_0x38ba('0x7'));module['exports']=function(_0x3e557d,_0x2afb75){return _0x3e557d[_0x38ba('0x8')]('DashboardItem',attributes,{'tableName':_0x38ba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9428=['lodash','util','../../config/logger','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x2a56bc,_0x49ba0f){var _0x76cb14=function(_0xeb6395){while(--_0xeb6395){_0x2a56bc['push'](_0x2a56bc['shift']());}};_0x76cb14(++_0x49ba0f);}(_0x9428,0xa5));var _0x8942=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x9428[_0x4de9e8];return _0x4db0de;};'use strict';var _=require(_0x8942('0x0'));var util=require(_0x8942('0x1'));var logger=require(_0x8942('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8942('0x3'));var fs=require('fs');var path=require(_0x8942('0x4'));var rimraf=require('rimraf');var config=require(_0x8942('0x5'));var attributes=require(_0x8942('0x6'));module[_0x8942('0x7')]=function(_0x2cc0a9,_0x4be0f5){return _0x2cc0a9[_0x8942('0x8')](_0x8942('0x9'),attributes,{'tableName':_0x8942('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 246705f..34f8b30 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 _0x0281=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','DashboardItem,\x20%s,\x20%s','message','result'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0x0281,0x1ef));var _0x1028=function(_0x43a251,_0x2ca1b8){_0x43a251=_0x43a251-0x0;var _0x15f782=_0x0281[_0x43a251];return _0x15f782;};'use strict';var _=require(_0x1028('0x0'));var util=require('util');var moment=require(_0x1028('0x1'));var BPromise=require('bluebird');var rs=require(_0x1028('0x2'));var fs=require('fs');var Redis=require(_0x1028('0x3'));var db=require(_0x1028('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1028('0x5'))(_0x1028('0x6'));var config=require(_0x1028('0x7'));var jayson=require(_0x1028('0x8'));var client=jayson[_0x1028('0x9')][_0x1028('0xa')]({'port':0x232a});config[_0x1028('0xb')]=_[_0x1028('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1028('0xd'))(new Redis(config[_0x1028('0xb')]));require(_0x1028('0xe'))[_0x1028('0xf')](socket);function respondWithRpcPromise(_0x3170a3,_0x2d0dd8,_0x5a8121){return new BPromise(function(_0x49738a,_0x25a4a6){return client['request'](_0x3170a3,_0x5a8121)[_0x1028('0x10')](function(_0x253590){logger[_0x1028('0x11')]('DashboardItem,\x20%s,\x20%s',_0x2d0dd8,_0x1028('0x12'));logger['debug'](_0x1028('0x13'),_0x2d0dd8,_0x1028('0x12'),JSON[_0x1028('0x14')](_0x253590));if(_0x253590[_0x1028('0x15')]){if(_0x253590['error']['code']===0x1f4){logger[_0x1028('0x15')](_0x1028('0x16'),_0x2d0dd8,_0x253590[_0x1028('0x15')][_0x1028('0x17')]);return _0x25a4a6(_0x253590[_0x1028('0x15')][_0x1028('0x17')]);}logger[_0x1028('0x15')](_0x1028('0x16'),_0x2d0dd8,_0x253590[_0x1028('0x15')]['message']);return _0x49738a(_0x253590['error'][_0x1028('0x17')]);}else{logger[_0x1028('0x11')](_0x1028('0x16'),_0x2d0dd8,_0x1028('0x12'));_0x49738a(_0x253590[_0x1028('0x18')][_0x1028('0x17')]);}})[_0x1028('0x19')](function(_0x5481ed){logger['error'](_0x1028('0x16'),_0x2d0dd8,_0x5481ed);_0x25a4a6(_0x5481ed);});});} \ No newline at end of file +var _0xbaf1=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x567135,_0x1b596b){var _0x16bcb2=function(_0x431771){while(--_0x431771){_0x567135['push'](_0x567135['shift']());}};_0x16bcb2(++_0x1b596b);}(_0xbaf1,0x1df));var _0x1baf=function(_0x3a4edc,_0x543779){_0x3a4edc=_0x3a4edc-0x0;var _0x3ebcd2=_0xbaf1[_0x3a4edc];return _0x3ebcd2;};'use strict';var _=require(_0x1baf('0x0'));var util=require(_0x1baf('0x1'));var moment=require(_0x1baf('0x2'));var BPromise=require(_0x1baf('0x3'));var rs=require(_0x1baf('0x4'));var fs=require('fs');var Redis=require(_0x1baf('0x5'));var db=require(_0x1baf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1baf('0x7'))(_0x1baf('0x8'));var config=require('../../config/environment');var jayson=require(_0x1baf('0x9'));var client=jayson[_0x1baf('0xa')][_0x1baf('0xb')]({'port':0x232a});config[_0x1baf('0xc')]=_[_0x1baf('0xd')](config['redis'],{'host':_0x1baf('0xe'),'port':0x18eb});var socket=require(_0x1baf('0xf'))(new Redis(config[_0x1baf('0xc')]));require(_0x1baf('0x10'))[_0x1baf('0x11')](socket);function respondWithRpcPromise(_0x20cdef,_0x35aace,_0x166f15){return new BPromise(function(_0x12fada,_0x2d415b){return client[_0x1baf('0x12')](_0x20cdef,_0x166f15)[_0x1baf('0x13')](function(_0x406612){logger['info'](_0x1baf('0x14'),_0x35aace,'request\x20sent');logger[_0x1baf('0x15')](_0x1baf('0x16'),_0x35aace,'request\x20sent',JSON['stringify'](_0x406612));if(_0x406612[_0x1baf('0x17')]){if(_0x406612[_0x1baf('0x17')][_0x1baf('0x18')]===0x1f4){logger[_0x1baf('0x17')]('DashboardItem,\x20%s,\x20%s',_0x35aace,_0x406612[_0x1baf('0x17')]['message']);return _0x2d415b(_0x406612['error']['message']);}logger[_0x1baf('0x17')](_0x1baf('0x14'),_0x35aace,_0x406612[_0x1baf('0x17')][_0x1baf('0x19')]);return _0x12fada(_0x406612[_0x1baf('0x17')][_0x1baf('0x19')]);}else{logger[_0x1baf('0x1a')](_0x1baf('0x14'),_0x35aace,'request\x20sent');_0x12fada(_0x406612['result'][_0x1baf('0x19')]);}})[_0x1baf('0x1b')](function(_0x30670f){logger[_0x1baf('0x17')](_0x1baf('0x14'),_0x35aace,_0x30670f);_0x2d415b(_0x30670f);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 37cbefe..6882ab8 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 _0x604b=['dashboardItem:','save','remove','update','emit','register'];(function(_0x57219f,_0xfaeac7){var _0x34c3e5=function(_0x4c6384){while(--_0x4c6384){_0x57219f['push'](_0x57219f['shift']());}};_0x34c3e5(++_0xfaeac7);}(_0x604b,0xd9));var _0xb604=function(_0x5978cb,_0x4eb380){_0x5978cb=_0x5978cb-0x0;var _0x245627=_0x604b[_0x5978cb];return _0x245627;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xb604('0x0'),_0xb604('0x1'),_0xb604('0x2')];function createListener(_0x2ad5d8,_0x5a4729){return function(_0x2844a5){_0x5a4729[_0xb604('0x3')](_0x2ad5d8,_0x2844a5);};}function removeListener(_0x5e4275,_0x554da6){return function(){DashboardItemEvents['removeListener'](_0x5e4275,_0x554da6);};}exports[_0xb604('0x4')]=function(_0x4bab39){for(var _0x2f187a=0x0,_0xaebf8f=events['length'];_0x2f187a<_0xaebf8f;_0x2f187a++){var _0x115db5=events[_0x2f187a];var _0x10ebb4=createListener(_0xb604('0x5')+_0x115db5,_0x4bab39);DashboardItemEvents['on'](_0x115db5,_0x10ebb4);}}; \ No newline at end of file +var _0x47cd=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x5178a6,_0x3ff485){var _0x97fea7=function(_0x4d13a1){while(--_0x4d13a1){_0x5178a6['push'](_0x5178a6['shift']());}};_0x97fea7(++_0x3ff485);}(_0x47cd,0x1c6));var _0xd47c=function(_0x3e2a86,_0x1df108){_0x3e2a86=_0x3e2a86-0x0;var _0x2b94ea=_0x47cd[_0x3e2a86];return _0x2b94ea;};'use strict';var DashboardItemEvents=require(_0xd47c('0x0'));var events=[_0xd47c('0x1'),_0xd47c('0x2'),_0xd47c('0x3')];function createListener(_0x4a3f71,_0x4474db){return function(_0x1191a1){_0x4474db['emit'](_0x4a3f71,_0x1191a1);};}function removeListener(_0x1932df,_0x3bb945){return function(){DashboardItemEvents[_0xd47c('0x4')](_0x1932df,_0x3bb945);};}exports[_0xd47c('0x5')]=function(_0x4a8bee){for(var _0x1c6236=0x0,_0x51d79e=events[_0xd47c('0x6')];_0x1c6236<_0x51d79e;_0x1c6236++){var _0x12889f=events[_0x1c6236];var _0x4cb62d=createListener(_0xd47c('0x7')+_0x12889f,_0x4a8bee);DashboardItemEvents['on'](_0x12889f,_0x4cb62d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 6bf7ba3..4dc77c6 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 _0xff5f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','isAuthenticated','create','/:id','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff5f,0x190));var _0xfff5=function(_0x3e18cf,_0x57a720){_0x3e18cf=_0x3e18cf-0x0;var _0x36038c=_0xff5f[_0x3e18cf];return _0x36038c;};'use strict';var multer=require(_0xfff5('0x0'));var util=require(_0xfff5('0x1'));var path=require('path');var timeout=require(_0xfff5('0x2'));var express=require(_0xfff5('0x3'));var router=express['Router']();var fs_extra=require(_0xfff5('0x4'));var auth=require(_0xfff5('0x5'));var interaction=require(_0xfff5('0x6'));var config=require(_0xfff5('0x7'));var controller=require(_0xfff5('0x8'));router[_0xfff5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xfff5('0xa')]);router['post']('/',auth[_0xfff5('0xb')](),controller[_0xfff5('0xc')]);router['put'](_0xfff5('0xd'),auth[_0xfff5('0xb')](),controller['update']);router['delete'](_0xfff5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfff5('0xe')]=router; \ No newline at end of file +var _0xa89f=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put','delete','/:id','multer'];(function(_0x5d2110,_0x1e1200){var _0x211a6f=function(_0x3517c2){while(--_0x3517c2){_0x5d2110['push'](_0x5d2110['shift']());}};_0x211a6f(++_0x1e1200);}(_0xa89f,0x120));var _0xfa89=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0xa89f[_0x575057];return _0x49dbc8;};'use strict';var multer=require(_0xfa89('0x0'));var util=require(_0xfa89('0x1'));var path=require(_0xfa89('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa89('0x3'));var router=express[_0xfa89('0x4')]();var fs_extra=require(_0xfa89('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfa89('0x6'));var config=require(_0xfa89('0x7'));var controller=require(_0xfa89('0x8'));router[_0xfa89('0x9')]('/:id',auth[_0xfa89('0xa')](),controller[_0xfa89('0xb')]);router[_0xfa89('0xc')]('/',auth['isAuthenticated'](),controller[_0xfa89('0xd')]);router[_0xfa89('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfa89('0xf')](_0xfa89('0x10'),auth[_0xfa89('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d02ddc0..212f8e7 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 _0xfc70=['third','first','sequelize','exports','STRING','ENUM','second'];(function(_0x4d1f59,_0x4483ec){var _0x468441=function(_0x183185){while(--_0x183185){_0x4d1f59['push'](_0x4d1f59['shift']());}};_0x468441(++_0x4483ec);}(_0xfc70,0x16e));var _0x0fc7=function(_0xb7c104,_0x1bf42d){_0xb7c104=_0xb7c104-0x0;var _0x5e6603=_0xfc70[_0xb7c104];return _0x5e6603;};'use strict';var Sequelize=require(_0x0fc7('0x0'));module[_0x0fc7('0x1')]={'name':{'type':Sequelize[_0x0fc7('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x0fc7('0x3')]('first',_0x0fc7('0x4'),_0x0fc7('0x5')),'allowNull':![],'defaultValue':_0x0fc7('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xced8=['first','STRING','exports','ENUM','second','third'];(function(_0x30930b,_0x4b0d1a){var _0x30f29b=function(_0x3198){while(--_0x3198){_0x30930b['push'](_0x30930b['shift']());}};_0x30f29b(++_0x4b0d1a);}(_0xced8,0xe0));var _0x8ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8ced('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x8ced('0x1')]('first',_0x8ced('0x2'),_0x8ced('0x3')),'allowNull':![],'defaultValue':_0x8ced('0x4')},'description':{'type':Sequelize[_0x8ced('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 982f278..0253d46 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 _0x2dcc=['UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Dispositions'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0x2dcc,0x88));var _0xc2dc=function(_0x57862b,_0xddbe7f){_0x57862b=_0x57862b-0x0;var _0x522e4c=_0x2dcc[_0x57862b];return _0x522e4c;};'use strict';var emlformat=require(_0xc2dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2dc('0x1'));var jsonpatch=require(_0xc2dc('0x2'));var rp=require(_0xc2dc('0x3'));var moment=require(_0xc2dc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc2dc('0x5'));var path=require(_0xc2dc('0x6'));var sox=require('sox');var csv=require(_0xc2dc('0x7'));var ejs=require(_0xc2dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc2dc('0x9'));var _=require('lodash');var squel=require(_0xc2dc('0xa'));var crypto=require(_0xc2dc('0xb'));var jsforce=require(_0xc2dc('0xc'));var deskjs=require(_0xc2dc('0xd'));var toCsv=require(_0xc2dc('0x7'));var querystring=require(_0xc2dc('0xe'));var Papa=require(_0xc2dc('0xf'));var Redis=require('ioredis');var authService=require(_0xc2dc('0x10'));var qs=require(_0xc2dc('0x11'));var as=require(_0xc2dc('0x12'));var hardwareService=require(_0xc2dc('0x13'));var logger=require(_0xc2dc('0x14'))(_0xc2dc('0x15'));var utils=require(_0xc2dc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc2dc('0x17'));var db=require(_0xc2dc('0x18'))['db'];function respondWithStatusCode(_0x192ae1,_0x53b2d8){_0x53b2d8=_0x53b2d8||0xcc;return function(_0x1dce2d){if(_0x1dce2d){return _0x192ae1[_0xc2dc('0x19')](_0x53b2d8);}return _0x192ae1[_0xc2dc('0x1a')](_0x53b2d8)[_0xc2dc('0x1b')]();};}function respondWithResult(_0x223b35,_0x251877){_0x251877=_0x251877||0xc8;return function(_0x2f116a){if(_0x2f116a){return _0x223b35[_0xc2dc('0x1a')](_0x251877)['json'](_0x2f116a);}};}function respondWithFilteredResult(_0x1a14e4,_0x27582e){return function(_0x2838ba){if(_0x2838ba){var _0x389c5f=typeof _0x27582e['offset']===_0xc2dc('0x1c')&&typeof _0x27582e['limit']===_0xc2dc('0x1c');var _0x3f1d63=_0x2838ba[_0xc2dc('0x1d')];var _0x1d06fd=_0x389c5f?0x0:_0x27582e['offset'];var _0x35cec9=_0x389c5f?_0x2838ba[_0xc2dc('0x1d')]:_0x27582e[_0xc2dc('0x1e')]+_0x27582e[_0xc2dc('0x1f')];var _0x135c93;if(_0x35cec9>=_0x3f1d63){_0x35cec9=_0x3f1d63;_0x135c93=0xc8;}else{_0x135c93=0xce;}_0x1a14e4[_0xc2dc('0x1a')](_0x135c93);return _0x1a14e4[_0xc2dc('0x20')](_0xc2dc('0x21'),_0x1d06fd+'-'+_0x35cec9+'/'+_0x3f1d63)['json'](_0x2838ba);}return null;};}function patchUpdates(_0x479627){return function(_0x26aa89){try{jsonpatch[_0xc2dc('0x22')](_0x26aa89,_0x479627,!![]);}catch(_0x568796){return BPromise[_0xc2dc('0x23')](_0x568796);}return _0x26aa89['save']();};}function saveUpdates(_0x2e17f4,_0x2ea853){return function(_0x270f09){if(_0x270f09){return _0x270f09[_0xc2dc('0x24')](_0x2e17f4)[_0xc2dc('0x25')](function(_0x4c7221){return _0x4c7221;});}return null;};}function removeEntity(_0x1249ca,_0x4d1237){return function(_0x377ba8){if(_0x377ba8){return _0x377ba8[_0xc2dc('0x26')]()['then'](function(){var _0x47b5b3=_0x377ba8['get']({'plain':!![]});var _0x2bffa1=_0xc2dc('0x27');return db[_0xc2dc('0x28')]['destroy']({'where':{'type':_0x2bffa1,'resourceId':_0x47b5b3['id']}})[_0xc2dc('0x25')](function(){return _0x377ba8;});})[_0xc2dc('0x25')](function(){_0x1249ca[_0xc2dc('0x1a')](0xcc)[_0xc2dc('0x1b')]();});}};}function handleEntityNotFound(_0x1ff346,_0x41af14){return function(_0x19f643){if(!_0x19f643){_0x1ff346[_0xc2dc('0x19')](0x194);}return _0x19f643;};}function handleError(_0x52f8d4,_0x3d5d95){_0x3d5d95=_0x3d5d95||0x1f4;return function(_0x52c12b){logger[_0xc2dc('0x29')](_0x52c12b[_0xc2dc('0x2a')]);if(_0x52c12b['name']){delete _0x52c12b[_0xc2dc('0x2b')];}_0x52f8d4[_0xc2dc('0x1a')](_0x3d5d95)[_0xc2dc('0x2c')](_0x52c12b);};}exports[_0xc2dc('0x2d')]=function(_0x518cab,_0x19999e){var _0x273801={},_0x385c93={},_0x5e48db={'count':0x0,'rows':[]};var _0x1cc08a=_[_0xc2dc('0x2e')](db[_0xc2dc('0x2f')][_0xc2dc('0x30')],function(_0x17c1f5){return{'name':_0x17c1f5[_0xc2dc('0x31')],'type':_0x17c1f5[_0xc2dc('0x32')][_0xc2dc('0x33')]};});_0x385c93[_0xc2dc('0x34')]=_[_0xc2dc('0x2e')](_0x1cc08a,_0xc2dc('0x2b'));_0x385c93[_0xc2dc('0x35')]=_[_0xc2dc('0x36')](_0x518cab[_0xc2dc('0x35')]);_0x385c93[_0xc2dc('0x37')]=_[_0xc2dc('0x38')](_0x385c93[_0xc2dc('0x34')],_0x385c93[_0xc2dc('0x35')]);_0x273801[_0xc2dc('0x39')]=_[_0xc2dc('0x38')](_0x385c93[_0xc2dc('0x34')],qs[_0xc2dc('0x3a')](_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x3a')]));_0x273801[_0xc2dc('0x39')]=_0x273801[_0xc2dc('0x39')][_0xc2dc('0x3b')]?_0x273801['attributes']:_0x385c93[_0xc2dc('0x34')];if(!_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x3c')](_0xc2dc('0x3d'))){_0x273801['limit']=qs[_0xc2dc('0x1f')](_0x518cab['query'][_0xc2dc('0x1f')]);_0x273801[_0xc2dc('0x1e')]=qs[_0xc2dc('0x1e')](_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x1e')]);}_0x273801[_0xc2dc('0x3e')]=qs[_0xc2dc('0x3f')](_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x3f')]);_0x273801['where']=qs[_0xc2dc('0x37')](_[_0xc2dc('0x40')](_0x518cab['query'],_0x385c93[_0xc2dc('0x37')]),_0x1cc08a);if(_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x41')]){_0x273801[_0xc2dc('0x42')]=_['merge'](_0x273801[_0xc2dc('0x42')],{'$or':_[_0xc2dc('0x2e')](_0x1cc08a,function(_0x59057c){if(_0x59057c[_0xc2dc('0x32')]!==_0xc2dc('0x43')){var _0xa16af3={};_0xa16af3[_0x59057c[_0xc2dc('0x2b')]]={'$like':'%'+_0x518cab[_0xc2dc('0x35')]['filter']+'%'};return _0xa16af3;}})});}_0x273801=_[_0xc2dc('0x44')]({},_0x273801,_0x518cab[_0xc2dc('0x45')]);var _0x51d9fd={'where':_0x273801[_0xc2dc('0x42')]};return db[_0xc2dc('0x2f')][_0xc2dc('0x1d')](_0x51d9fd)[_0xc2dc('0x25')](function(_0x5f2ea3){_0x5e48db[_0xc2dc('0x1d')]=_0x5f2ea3;if(_0x518cab['query'][_0xc2dc('0x46')]){_0x273801[_0xc2dc('0x47')]=[{'all':!![]}];}return db['Disposition'][_0xc2dc('0x48')](_0x273801);})[_0xc2dc('0x25')](function(_0x531714){_0x5e48db[_0xc2dc('0x49')]=_0x531714;return _0x5e48db;})[_0xc2dc('0x25')](respondWithFilteredResult(_0x19999e,_0x273801))[_0xc2dc('0x4a')](handleError(_0x19999e,null));};exports[_0xc2dc('0x4b')]=function(_0x290453,_0x3bcf81){var _0x725b45={'raw':!![],'where':{'id':_0x290453[_0xc2dc('0x4c')]['id']}},_0x140cb9={};_0x140cb9[_0xc2dc('0x34')]=_[_0xc2dc('0x36')](db[_0xc2dc('0x2f')][_0xc2dc('0x30')]);_0x140cb9[_0xc2dc('0x35')]=_['keys'](_0x290453[_0xc2dc('0x35')]);_0x140cb9[_0xc2dc('0x37')]=_[_0xc2dc('0x38')](_0x140cb9[_0xc2dc('0x34')],_0x140cb9[_0xc2dc('0x35')]);_0x725b45[_0xc2dc('0x39')]=_[_0xc2dc('0x38')](_0x140cb9[_0xc2dc('0x34')],qs[_0xc2dc('0x3a')](_0x290453[_0xc2dc('0x35')][_0xc2dc('0x3a')]));_0x725b45[_0xc2dc('0x39')]=_0x725b45[_0xc2dc('0x39')][_0xc2dc('0x3b')]?_0x725b45[_0xc2dc('0x39')]:_0x140cb9[_0xc2dc('0x34')];if(_0x290453[_0xc2dc('0x35')][_0xc2dc('0x46')]){_0x725b45[_0xc2dc('0x47')]=[{'all':!![]}];}_0x725b45=_[_0xc2dc('0x44')]({},_0x725b45,_0x290453['options']);return db[_0xc2dc('0x2f')][_0xc2dc('0x4d')](_0x725b45)[_0xc2dc('0x25')](handleEntityNotFound(_0x3bcf81,null))[_0xc2dc('0x25')](respondWithResult(_0x3bcf81,null))[_0xc2dc('0x4a')](handleError(_0x3bcf81,null));};exports[_0xc2dc('0x4e')]=function(_0x4b9043,_0x1bf9f8){return db[_0xc2dc('0x2f')][_0xc2dc('0x4e')](_0x4b9043[_0xc2dc('0x4f')],{})[_0xc2dc('0x25')](function(_0x4b33df){var _0x29d866=_0x4b9043[_0xc2dc('0x50')][_0xc2dc('0x51')]({'plain':!![]});if(!_0x29d866)throw new Error(_0xc2dc('0x52'));if(_0x29d866[_0xc2dc('0x53')]===_0xc2dc('0x50')){var _0x5d760a=_0x4b33df['get']({'plain':!![]});var _0x117624=_0xc2dc('0x27');return db[_0xc2dc('0x54')][_0xc2dc('0x4d')]({'where':{'name':_0x117624,'userProfileId':_0x29d866[_0xc2dc('0x55')]},'raw':!![]})['then'](function(_0x4bf1b8){if(_0x4bf1b8&&_0x4bf1b8[_0xc2dc('0x56')]===0x0){return db[_0xc2dc('0x28')]['create']({'name':_0x5d760a['name'],'resourceId':_0x5d760a['id'],'type':_0x4bf1b8[_0xc2dc('0x2b')],'sectionId':_0x4bf1b8['id']},{})['then'](function(){return _0x4b33df;});}else{return _0x4b33df;}})['catch'](function(_0xa4bb62){logger[_0xc2dc('0x29')](_0xc2dc('0x57'),_0xa4bb62);throw _0xa4bb62;});}return _0x4b33df;})[_0xc2dc('0x25')](respondWithResult(_0x1bf9f8,0xc9))['catch'](handleError(_0x1bf9f8,null));};exports[_0xc2dc('0x24')]=function(_0x57923a,_0x366833){if(_0x57923a[_0xc2dc('0x4f')]['id']){delete _0x57923a[_0xc2dc('0x4f')]['id'];}return db[_0xc2dc('0x2f')][_0xc2dc('0x4d')]({'where':{'id':_0x57923a['params']['id']}})[_0xc2dc('0x25')](handleEntityNotFound(_0x366833,null))['then'](saveUpdates(_0x57923a[_0xc2dc('0x4f')],null))[_0xc2dc('0x25')](respondWithResult(_0x366833,null))['catch'](handleError(_0x366833,null));};exports[_0xc2dc('0x26')]=function(_0xd67840,_0x4f88aa){return db[_0xc2dc('0x2f')][_0xc2dc('0x4d')]({'where':{'id':_0xd67840[_0xc2dc('0x4c')]['id']}})[_0xc2dc('0x25')](handleEntityNotFound(_0x4f88aa,null))[_0xc2dc('0x25')](removeEntity(_0x4f88aa,null))[_0xc2dc('0x4a')](handleError(_0x4f88aa,null));}; \ No newline at end of file +var _0xb41c=['filter','options','rows','show','rawAttributes','includeAll','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Dispositions','error','stack','name','map','Disposition','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL'];(function(_0x2ea990,_0x38c127){var _0x25c3b2=function(_0x3f2fbc){while(--_0x3f2fbc){_0x2ea990['push'](_0x2ea990['shift']());}};_0x25c3b2(++_0x38c127);}(_0xb41c,0x167));var _0xcb41=function(_0x3b527a,_0x5a933e){_0x3b527a=_0x3b527a-0x0;var _0x485027=_0xb41c[_0x3b527a];return _0x485027;};'use strict';var emlformat=require(_0xcb41('0x0'));var rimraf=require(_0xcb41('0x1'));var zipdir=require(_0xcb41('0x2'));var jsonpatch=require(_0xcb41('0x3'));var rp=require(_0xcb41('0x4'));var moment=require('moment');var BPromise=require(_0xcb41('0x5'));var Mustache=require(_0xcb41('0x6'));var util=require(_0xcb41('0x7'));var path=require(_0xcb41('0x8'));var sox=require(_0xcb41('0x9'));var csv=require(_0xcb41('0xa'));var ejs=require(_0xcb41('0xb'));var fs=require('fs');var fs_extra=require(_0xcb41('0xc'));var _=require(_0xcb41('0xd'));var squel=require(_0xcb41('0xe'));var crypto=require(_0xcb41('0xf'));var jsforce=require(_0xcb41('0x10'));var deskjs=require(_0xcb41('0x11'));var toCsv=require(_0xcb41('0xa'));var querystring=require(_0xcb41('0x12'));var Papa=require(_0xcb41('0x13'));var Redis=require(_0xcb41('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xcb41('0x15'));var as=require(_0xcb41('0x16'));var hardwareService=require(_0xcb41('0x17'));var logger=require(_0xcb41('0x18'))(_0xcb41('0x19'));var utils=require('../../config/utils');var config=require(_0xcb41('0x1a'));var licenseUtil=require(_0xcb41('0x1b'));var db=require(_0xcb41('0x1c'))['db'];function respondWithStatusCode(_0x1a549b,_0x3fe483){_0x3fe483=_0x3fe483||0xcc;return function(_0x1a2754){if(_0x1a2754){return _0x1a549b['sendStatus'](_0x3fe483);}return _0x1a549b[_0xcb41('0x1d')](_0x3fe483)[_0xcb41('0x1e')]();};}function respondWithResult(_0x5bdaf8,_0x3dfae2){_0x3dfae2=_0x3dfae2||0xc8;return function(_0x31d6df){if(_0x31d6df){return _0x5bdaf8[_0xcb41('0x1d')](_0x3dfae2)[_0xcb41('0x1f')](_0x31d6df);}};}function respondWithFilteredResult(_0x23d928,_0x38df25){return function(_0x4c9f8c){if(_0x4c9f8c){var _0x1e9a28=typeof _0x38df25[_0xcb41('0x20')]===_0xcb41('0x21')&&typeof _0x38df25[_0xcb41('0x22')]==='undefined';var _0x193a95=_0x4c9f8c['count'];var _0x322fa2=_0x1e9a28?0x0:_0x38df25[_0xcb41('0x20')];var _0xbccffa=_0x1e9a28?_0x4c9f8c[_0xcb41('0x23')]:_0x38df25[_0xcb41('0x20')]+_0x38df25['limit'];var _0x2dd36e;if(_0xbccffa>=_0x193a95){_0xbccffa=_0x193a95;_0x2dd36e=0xc8;}else{_0x2dd36e=0xce;}_0x23d928['status'](_0x2dd36e);return _0x23d928[_0xcb41('0x24')](_0xcb41('0x25'),_0x322fa2+'-'+_0xbccffa+'/'+_0x193a95)[_0xcb41('0x1f')](_0x4c9f8c);}return null;};}function patchUpdates(_0x377ad2){return function(_0x7066b0){try{jsonpatch['apply'](_0x7066b0,_0x377ad2,!![]);}catch(_0x1cccdf){return BPromise[_0xcb41('0x26')](_0x1cccdf);}return _0x7066b0['save']();};}function saveUpdates(_0x410e73,_0x4fdbdc){return function(_0x25daae){if(_0x25daae){return _0x25daae[_0xcb41('0x27')](_0x410e73)[_0xcb41('0x28')](function(_0x1ed575){return _0x1ed575;});}return null;};}function removeEntity(_0x2ecc06,_0x913cbe){return function(_0x3e18a1){if(_0x3e18a1){return _0x3e18a1[_0xcb41('0x29')]()['then'](function(){var _0xc2f960=_0x3e18a1[_0xcb41('0x2a')]({'plain':!![]});var _0x342dca=_0xcb41('0x2b');return db['UserProfileResource'][_0xcb41('0x29')]({'where':{'type':_0x342dca,'resourceId':_0xc2f960['id']}})[_0xcb41('0x28')](function(){return _0x3e18a1;});})[_0xcb41('0x28')](function(){_0x2ecc06['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a66c4,_0x46c07f){return function(_0x388fd2){if(!_0x388fd2){_0x1a66c4['sendStatus'](0x194);}return _0x388fd2;};}function handleError(_0x6d35cd,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x52f53c){logger[_0xcb41('0x2c')](_0x52f53c[_0xcb41('0x2d')]);if(_0x52f53c[_0xcb41('0x2e')]){delete _0x52f53c[_0xcb41('0x2e')];}_0x6d35cd[_0xcb41('0x1d')](_0x27b695)['send'](_0x52f53c);};}exports['index']=function(_0x848426,_0x108a94){var _0x47d723={},_0x242392={},_0x43584e={'count':0x0,'rows':[]};var _0x47897a=_[_0xcb41('0x2f')](db[_0xcb41('0x30')]['rawAttributes'],function(_0x3f0a0f){return{'name':_0x3f0a0f[_0xcb41('0x31')],'type':_0x3f0a0f['type'][_0xcb41('0x32')]};});_0x242392[_0xcb41('0x33')]=_[_0xcb41('0x2f')](_0x47897a,_0xcb41('0x2e'));_0x242392[_0xcb41('0x34')]=_[_0xcb41('0x35')](_0x848426[_0xcb41('0x34')]);_0x242392[_0xcb41('0x36')]=_['intersection'](_0x242392[_0xcb41('0x33')],_0x242392[_0xcb41('0x34')]);_0x47d723['attributes']=_[_0xcb41('0x37')](_0x242392['model'],qs['fields'](_0x848426[_0xcb41('0x34')][_0xcb41('0x38')]));_0x47d723[_0xcb41('0x39')]=_0x47d723[_0xcb41('0x39')]['length']?_0x47d723[_0xcb41('0x39')]:_0x242392['model'];if(!_0x848426['query'][_0xcb41('0x3a')]('nolimit')){_0x47d723['limit']=qs[_0xcb41('0x22')](_0x848426[_0xcb41('0x34')]['limit']);_0x47d723['offset']=qs[_0xcb41('0x20')](_0x848426[_0xcb41('0x34')]['offset']);}_0x47d723[_0xcb41('0x3b')]=qs[_0xcb41('0x3c')](_0x848426['query'][_0xcb41('0x3c')]);_0x47d723['where']=qs[_0xcb41('0x36')](_[_0xcb41('0x3d')](_0x848426[_0xcb41('0x34')],_0x242392[_0xcb41('0x36')]),_0x47897a);if(_0x848426[_0xcb41('0x34')]['filter']){_0x47d723[_0xcb41('0x3e')]=_[_0xcb41('0x3f')](_0x47d723['where'],{'$or':_['map'](_0x47897a,function(_0x43928a){if(_0x43928a[_0xcb41('0x40')]!==_0xcb41('0x41')){var _0x165c01={};_0x165c01[_0x43928a[_0xcb41('0x2e')]]={'$like':'%'+_0x848426['query'][_0xcb41('0x42')]+'%'};return _0x165c01;}})});}_0x47d723=_['merge']({},_0x47d723,_0x848426[_0xcb41('0x43')]);var _0x3dd533={'where':_0x47d723[_0xcb41('0x3e')]};return db[_0xcb41('0x30')][_0xcb41('0x23')](_0x3dd533)[_0xcb41('0x28')](function(_0x37ebe8){_0x43584e[_0xcb41('0x23')]=_0x37ebe8;if(_0x848426[_0xcb41('0x34')]['includeAll']){_0x47d723['include']=[{'all':!![]}];}return db[_0xcb41('0x30')]['findAll'](_0x47d723);})[_0xcb41('0x28')](function(_0x569840){_0x43584e[_0xcb41('0x44')]=_0x569840;return _0x43584e;})[_0xcb41('0x28')](respondWithFilteredResult(_0x108a94,_0x47d723))['catch'](handleError(_0x108a94,null));};exports[_0xcb41('0x45')]=function(_0x8953c3,_0x5df573){var _0x2e25e0={'raw':!![],'where':{'id':_0x8953c3['params']['id']}},_0x2d9885={};_0x2d9885['model']=_[_0xcb41('0x35')](db[_0xcb41('0x30')][_0xcb41('0x46')]);_0x2d9885[_0xcb41('0x34')]=_[_0xcb41('0x35')](_0x8953c3[_0xcb41('0x34')]);_0x2d9885[_0xcb41('0x36')]=_['intersection'](_0x2d9885[_0xcb41('0x33')],_0x2d9885[_0xcb41('0x34')]);_0x2e25e0[_0xcb41('0x39')]=_['intersection'](_0x2d9885[_0xcb41('0x33')],qs['fields'](_0x8953c3['query']['fields']));_0x2e25e0[_0xcb41('0x39')]=_0x2e25e0[_0xcb41('0x39')]['length']?_0x2e25e0[_0xcb41('0x39')]:_0x2d9885['model'];if(_0x8953c3['query'][_0xcb41('0x47')]){_0x2e25e0[_0xcb41('0x48')]=[{'all':!![]}];}_0x2e25e0=_[_0xcb41('0x3f')]({},_0x2e25e0,_0x8953c3[_0xcb41('0x43')]);return db[_0xcb41('0x30')][_0xcb41('0x49')](_0x2e25e0)[_0xcb41('0x28')](handleEntityNotFound(_0x5df573,null))[_0xcb41('0x28')](respondWithResult(_0x5df573,null))[_0xcb41('0x4a')](handleError(_0x5df573,null));};exports['create']=function(_0x20dd1f,_0x13194c){return db[_0xcb41('0x30')][_0xcb41('0x4b')](_0x20dd1f['body'],{})[_0xcb41('0x28')](function(_0x54657c){var _0x18ef7e=_0x20dd1f[_0xcb41('0x4c')][_0xcb41('0x2a')]({'plain':!![]});if(!_0x18ef7e)throw new Error(_0xcb41('0x4d'));if(_0x18ef7e[_0xcb41('0x4e')]===_0xcb41('0x4c')){var _0x59701f=_0x54657c[_0xcb41('0x2a')]({'plain':!![]});var _0x2120f8=_0xcb41('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2120f8,'userProfileId':_0x18ef7e[_0xcb41('0x4f')]},'raw':!![]})[_0xcb41('0x28')](function(_0x2344a9){if(_0x2344a9&&_0x2344a9[_0xcb41('0x50')]===0x0){return db[_0xcb41('0x51')][_0xcb41('0x4b')]({'name':_0x59701f[_0xcb41('0x2e')],'resourceId':_0x59701f['id'],'type':_0x2344a9['name'],'sectionId':_0x2344a9['id']},{})[_0xcb41('0x28')](function(){return _0x54657c;});}else{return _0x54657c;}})[_0xcb41('0x4a')](function(_0x1f3779){logger[_0xcb41('0x2c')](_0xcb41('0x52'),_0x1f3779);throw _0x1f3779;});}return _0x54657c;})[_0xcb41('0x28')](respondWithResult(_0x13194c,0xc9))[_0xcb41('0x4a')](handleError(_0x13194c,null));};exports[_0xcb41('0x27')]=function(_0x413dc0,_0x1ccf5a){if(_0x413dc0[_0xcb41('0x53')]['id']){delete _0x413dc0[_0xcb41('0x53')]['id'];}return db[_0xcb41('0x30')][_0xcb41('0x49')]({'where':{'id':_0x413dc0['params']['id']}})['then'](handleEntityNotFound(_0x1ccf5a,null))[_0xcb41('0x28')](saveUpdates(_0x413dc0['body'],null))['then'](respondWithResult(_0x1ccf5a,null))[_0xcb41('0x4a')](handleError(_0x1ccf5a,null));};exports[_0xcb41('0x29')]=function(_0x2ac371,_0x20556b){return db['Disposition'][_0xcb41('0x49')]({'where':{'id':_0x2ac371[_0xcb41('0x54')]['id']}})['then'](handleEntityNotFound(_0x20556b,null))[_0xcb41('0x28')](removeEntity(_0x20556b,null))['catch'](handleError(_0x20556b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 04fb93f..a642d7f 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 _0x0072=['path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0072,0xa4));var _0x2007=function(_0x3b4783,_0x4e663e){_0x3b4783=_0x3b4783-0x0;var _0x82553e=_0x0072[_0x3b4783];return _0x82553e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2007('0x0'));var moment=require(_0x2007('0x1'));var BPromise=require(_0x2007('0x2'));var rp=require(_0x2007('0x3'));var fs=require('fs');var path=require(_0x2007('0x4'));var rimraf=require(_0x2007('0x5'));var config=require(_0x2007('0x6'));var attributes=require(_0x2007('0x7'));module['exports']=function(_0x5ebc22,_0x4d38a7){return _0x5ebc22[_0x2007('0x8')](_0x2007('0x9'),attributes,{'tableName':_0x2007('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x2007('0xb'),_0x2007('0xc')]},{'unique':!![],'name':_0x2007('0xd'),'fields':[_0x2007('0xb'),_0x2007('0xe')]},{'unique':!![],'name':_0x2007('0xf'),'fields':[_0x2007('0xb'),'MailAccountId']},{'unique':!![],'name':_0x2007('0x10'),'fields':[_0x2007('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x2007('0x11'),'fields':[_0x2007('0xb'),_0x2007('0x12')]},{'unique':!![],'name':_0x2007('0x13'),'fields':[_0x2007('0xb'),_0x2007('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x2007('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb557=['OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','Disposition','tools_dispositions','name_voice','ListId','name','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel'];(function(_0x2477c7,_0x56ced0){var _0x3109a6=function(_0x37e40a){while(--_0x37e40a){_0x2477c7['push'](_0x2477c7['shift']());}};_0x3109a6(++_0x56ced0);}(_0xb557,0x12e));var _0x7b55=function(_0xda6ba1,_0x4a26ef){_0xda6ba1=_0xda6ba1-0x0;var _0x571599=_0xb557[_0xda6ba1];return _0x571599;};'use strict';var _=require(_0x7b55('0x0'));var util=require(_0x7b55('0x1'));var logger=require(_0x7b55('0x2'))(_0x7b55('0x3'));var moment=require(_0x7b55('0x4'));var BPromise=require(_0x7b55('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b55('0x6'));var rimraf=require(_0x7b55('0x7'));var config=require(_0x7b55('0x8'));var attributes=require('./disposition.attributes');module['exports']=function(_0x9a35ec,_0x506e2c){return _0x9a35ec[_0x7b55('0x9')](_0x7b55('0xa'),attributes,{'tableName':_0x7b55('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7b55('0xc'),'fields':['name',_0x7b55('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x7b55('0xe'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x7b55('0xe'),_0x7b55('0xf')]},{'unique':!![],'name':_0x7b55('0x10'),'fields':['name',_0x7b55('0x11')]},{'unique':!![],'name':_0x7b55('0x12'),'fields':[_0x7b55('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x7b55('0x13'),'fields':[_0x7b55('0xe'),_0x7b55('0x14')]},{'unique':!![],'name':_0x7b55('0x15'),'fields':[_0x7b55('0xe'),_0x7b55('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index ed9478a..5a7c0ae 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(_0x25214a,_0xbbeb76){var _0x75811b=function(_0x4bdaf9){while(--_0x4bdaf9){_0x25214a['push'](_0x25214a['shift']());}};_0x75811b(++_0xbbeb76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x2e9cb5,_0x51c504){var _0x1605c0=function(_0x865a8b){while(--_0x865a8b){_0x2e9cb5['push'](_0x2e9cb5['shift']());}};_0x1605c0(++_0x51c504);}(_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/disposition/index.js b/server/api/disposition/index.js index 16b951a..473a857 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 _0x9be8=['post','create','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','index','get','show'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9be8,0xe9));var _0x89be=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x9be8[_0x25a42a];return _0x1129b1;};'use strict';var multer=require(_0x89be('0x0'));var util=require(_0x89be('0x1'));var path=require(_0x89be('0x2'));var timeout=require(_0x89be('0x3'));var express=require(_0x89be('0x4'));var router=express[_0x89be('0x5')]();var fs_extra=require(_0x89be('0x6'));var auth=require(_0x89be('0x7'));var interaction=require(_0x89be('0x8'));var config=require('../../config/environment');var controller=require(_0x89be('0x9'));router['get']('/',auth[_0x89be('0xa')](),controller[_0x89be('0xb')]);router[_0x89be('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x89be('0xd')]);router[_0x89be('0xe')]('/',auth[_0x89be('0xa')](),controller[_0x89be('0xf')]);router['put']('/:id',auth[_0x89be('0xa')](),controller['update']);router[_0x89be('0x10')](_0x89be('0x11'),auth[_0x89be('0xa')](),controller['destroy']);module[_0x89be('0x12')]=router; \ No newline at end of file +var _0xb064=['multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xa3c6ed,_0x2d35d3){var _0x371a96=function(_0x41c2fa){while(--_0x41c2fa){_0xa3c6ed['push'](_0xa3c6ed['shift']());}};_0x371a96(++_0x2d35d3);}(_0xb064,0x19e));var _0x4b06=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xb064[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x4b06('0x0'));var util=require(_0x4b06('0x1'));var path=require('path');var timeout=require(_0x4b06('0x2'));var express=require('express');var router=express[_0x4b06('0x3')]();var fs_extra=require(_0x4b06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4b06('0x5'));var config=require('../../config/environment');var controller=require(_0x4b06('0x6'));router[_0x4b06('0x7')]('/',auth[_0x4b06('0x8')](),controller['index']);router['get'](_0x4b06('0x9'),auth[_0x4b06('0x8')](),controller[_0x4b06('0xa')]);router[_0x4b06('0xb')]('/',auth[_0x4b06('0x8')](),controller[_0x4b06('0xc')]);router[_0x4b06('0xd')]('/:id',auth[_0x4b06('0x8')](),controller[_0x4b06('0xe')]);router[_0x4b06('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4b06('0x10')]);module[_0x4b06('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 9b5795d..12e5a09 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 _0xcea7=['DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','4800','9600','12000','14400','2400','7200','v17,v27,v29','INTEGER','SIP','IAX'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xcea7,0xd1));var _0x7cea=function(_0x145283,_0x494d0a){_0x145283=_0x145283-0x0;var _0x1b97f0=_0xcea7[_0x145283];return _0x1b97f0;};'use strict';var Sequelize=require(_0x7cea('0x0'));module[_0x7cea('0x1')]={'name':{'type':Sequelize[_0x7cea('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x7cea('0x3')](_0x7cea('0x4'),'no'),'defaultValue':_0x7cea('0x4')},'headerinfo':{'type':Sequelize[_0x7cea('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x7cea('0x2')],'unique':_0x7cea('0x5')},'minrate':{'type':Sequelize[_0x7cea('0x3')]('2400',_0x7cea('0x6'),'7200',_0x7cea('0x7'),_0x7cea('0x8'),_0x7cea('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x7cea('0xa'),_0x7cea('0x6'),_0x7cea('0xb'),_0x7cea('0x7'),_0x7cea('0x8'),_0x7cea('0x9')),'defaultValue':_0x7cea('0x9')},'modem':{'type':Sequelize[_0x7cea('0x2')],'defaultValue':_0x7cea('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7cea('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7cea('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7cea('0x3')](_0x7cea('0xe'),_0x7cea('0xf'),_0x7cea('0x10'),_0x7cea('0x11')),'defaultValue':_0x7cea('0xe')},'key':{'type':Sequelize[_0x7cea('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7cea('0x12')],'defaultValue':function(){return _0x7cea('0x13');}},'notificationSound':{'type':Sequelize[_0x7cea('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7cea('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7cea('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7cea('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7cea('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7cea('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7cea('0x14')],'defaultValue':![],'comment':_0x7cea('0x15'),'set':function(_0x25eb5c){if(!_0x25eb5c)this[_0x7cea('0x16')](_0x7cea('0x17'),null);this[_0x7cea('0x16')](_0x7cea('0x18'),_0x25eb5c);}}}; \ No newline at end of file +var _0x85a7=['exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','INTEGER','IAX','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5a7a93,_0x45017d){var _0x12677d=function(_0x411d2f){while(--_0x411d2f){_0x5a7a93['push'](_0x5a7a93['shift']());}};_0x12677d(++_0x45017d);}(_0x85a7,0x180));var _0x785a=function(_0x30e71e,_0x3244e9){_0x30e71e=_0x30e71e-0x0;var _0x4b73f6=_0x85a7[_0x30e71e];return _0x4b73f6;};'use strict';var Sequelize=require('sequelize');module[_0x785a('0x0')]={'name':{'type':Sequelize[_0x785a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x785a('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x785a('0x2'),'no'),'defaultValue':_0x785a('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x785a('0x3')},'localstationid':{'type':Sequelize[_0x785a('0x1')],'unique':_0x785a('0x4')},'minrate':{'type':Sequelize[_0x785a('0x5')](_0x785a('0x6'),_0x785a('0x7'),_0x785a('0x8'),_0x785a('0x9'),_0x785a('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x785a('0x5')](_0x785a('0x6'),'4800',_0x785a('0x8'),'9600',_0x785a('0xa'),'14400'),'defaultValue':_0x785a('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x785a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x785a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x785a('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x785a('0x5')]('SIP',_0x785a('0xd'),_0x785a('0xe'),'KHOMP'),'defaultValue':_0x785a('0xf')},'key':{'type':Sequelize[_0x785a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x785a('0x10')],'defaultValue':function(){return _0x785a('0x11');}},'notificationSound':{'type':Sequelize[_0x785a('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x785a('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x785a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x785a('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x785a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x785a('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x785a('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x785a('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x785a('0x12')],'defaultValue':![],'comment':_0x785a('0x14'),'set':function(_0x4c4938){if(!_0x4c4938)this[_0x785a('0x15')](_0x785a('0x16'),null);this[_0x785a('0x15')](_0x785a('0x17'),_0x4c4938);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ce9c544..8d9ec03 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 _0x6abc=['addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','localstationid','app','system','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','DESC','attachments','join','root','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','ListId','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','FaxAccounts','UserProfileResource','stack','send','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','FaxAccount','include','findAll','rows','params','Pause','length','includeAll','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','order','sort','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers'];(function(_0x28a9bb,_0x4d005d){var _0x580c58=function(_0x430f41){while(--_0x430f41){_0x28a9bb['push'](_0x28a9bb['shift']());}};_0x580c58(++_0x4d005d);}(_0x6abc,0x1df));var _0xc6ab=function(_0x49319a,_0x1059cf){_0x49319a=_0x49319a-0x0;var _0x42c021=_0x6abc[_0x49319a];return _0x42c021;};'use strict';var emlformat=require(_0xc6ab('0x0'));var rimraf=require(_0xc6ab('0x1'));var zipdir=require(_0xc6ab('0x2'));var jsonpatch=require(_0xc6ab('0x3'));var rp=require(_0xc6ab('0x4'));var moment=require('moment');var BPromise=require(_0xc6ab('0x5'));var Mustache=require(_0xc6ab('0x6'));var util=require(_0xc6ab('0x7'));var path=require(_0xc6ab('0x8'));var sox=require(_0xc6ab('0x9'));var csv=require(_0xc6ab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6ab('0xb'));var _=require(_0xc6ab('0xc'));var squel=require(_0xc6ab('0xd'));var crypto=require(_0xc6ab('0xe'));var jsforce=require(_0xc6ab('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc6ab('0xa'));var querystring=require(_0xc6ab('0x10'));var Papa=require(_0xc6ab('0x11'));var Redis=require(_0xc6ab('0x12'));var authService=require(_0xc6ab('0x13'));var qs=require(_0xc6ab('0x14'));var as=require(_0xc6ab('0x15'));var hardwareService=require(_0xc6ab('0x16'));var logger=require('../../config/logger')(_0xc6ab('0x17'));var utils=require(_0xc6ab('0x18'));var config=require(_0xc6ab('0x19'));var licenseUtil=require(_0xc6ab('0x1a'));var db=require(_0xc6ab('0x1b'))['db'];config[_0xc6ab('0x1c')]=_[_0xc6ab('0x1d')](config['redis'],{'host':_0xc6ab('0x1e'),'port':0x18eb});var socket=require(_0xc6ab('0x1f'))(new Redis(config['redis']));require(_0xc6ab('0x20'))['register'](socket);var jayson=require(_0xc6ab('0x21'));var client=jayson[_0xc6ab('0x22')][_0xc6ab('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xc6ab('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x5f0356,_0x4fd0a5,_0x4bb467,_0x9d4359){return new BPromise(function(_0x31b8ca,_0x5c6b7b){var _0xabbcfc=_0x9d4359||client;return _0xabbcfc['request'](_0x5f0356,_0x4bb467)[_0xc6ab('0x24')](function(_0x3aa87b){logger[_0xc6ab('0x25')](_0xc6ab('0x26'),_0x4fd0a5,_0xc6ab('0x27'));logger[_0xc6ab('0x28')](_0xc6ab('0x29'),_0x4fd0a5,_0xc6ab('0x27'),JSON[_0xc6ab('0x2a')](_0x3aa87b));if(_0x3aa87b['error']){if(_0x3aa87b['error'][_0xc6ab('0x2b')]===0x1f4){logger[_0xc6ab('0x2c')](_0xc6ab('0x26'),_0x4fd0a5,_0x3aa87b[_0xc6ab('0x2c')]['message']);return _0x5c6b7b(_0x3aa87b[_0xc6ab('0x2c')][_0xc6ab('0x2d')]);}logger[_0xc6ab('0x2c')](_0xc6ab('0x26'),_0x4fd0a5,_0x3aa87b[_0xc6ab('0x2c')][_0xc6ab('0x2d')]);return _0x31b8ca(_0x3aa87b[_0xc6ab('0x2c')][_0xc6ab('0x2d')]);}else{logger[_0xc6ab('0x25')](_0xc6ab('0x26'),_0x4fd0a5,_0xc6ab('0x27'));_0x31b8ca(_0x3aa87b['result']['message']);}})['catch'](function(_0x3d1105){logger[_0xc6ab('0x2c')](_0xc6ab('0x26'),_0x4fd0a5,_0x3d1105);_0x5c6b7b(_0x3d1105);});});}function respondWithStatusCode(_0x4691eb,_0x55ae16){_0x55ae16=_0x55ae16||0xcc;return function(_0x3a2ce6){if(_0x3a2ce6){return _0x4691eb[_0xc6ab('0x2e')](_0x55ae16);}return _0x4691eb[_0xc6ab('0x2f')](_0x55ae16)[_0xc6ab('0x30')]();};}function respondWithResult(_0x5430f4,_0x1f8791){_0x1f8791=_0x1f8791||0xc8;return function(_0xb4418e){if(_0xb4418e){return _0x5430f4[_0xc6ab('0x2f')](_0x1f8791)[_0xc6ab('0x31')](_0xb4418e);}};}function respondWithFilteredResult(_0x1852a6,_0x230841){return function(_0xf3e2b){if(_0xf3e2b){var _0x388916=typeof _0x230841[_0xc6ab('0x32')]===_0xc6ab('0x33')&&typeof _0x230841[_0xc6ab('0x34')]===_0xc6ab('0x33');var _0x4ddfd0=_0xf3e2b[_0xc6ab('0x35')];var _0x451eb4=_0x388916?0x0:_0x230841[_0xc6ab('0x32')];var _0x3a4e10=_0x388916?_0xf3e2b['count']:_0x230841[_0xc6ab('0x32')]+_0x230841[_0xc6ab('0x34')];var _0x33f410;if(_0x3a4e10>=_0x4ddfd0){_0x3a4e10=_0x4ddfd0;_0x33f410=0xc8;}else{_0x33f410=0xce;}_0x1852a6[_0xc6ab('0x2f')](_0x33f410);return _0x1852a6[_0xc6ab('0x36')](_0xc6ab('0x37'),_0x451eb4+'-'+_0x3a4e10+'/'+_0x4ddfd0)[_0xc6ab('0x31')](_0xf3e2b);}return null;};}function patchUpdates(_0x2de3e5){return function(_0x5f3534){try{jsonpatch[_0xc6ab('0x38')](_0x5f3534,_0x2de3e5,!![]);}catch(_0x3f392f){return BPromise[_0xc6ab('0x39')](_0x3f392f);}return _0x5f3534['save']();};}function saveUpdates(_0x49d3cc,_0x3d645a){return function(_0x3f584e){if(_0x3f584e){return _0x3f584e['update'](_0x49d3cc)[_0xc6ab('0x24')](function(_0x58fced){return _0x58fced;});}return null;};}function removeEntity(_0xf20585,_0x17ada7){return function(_0x31ce2d){if(_0x31ce2d){return _0x31ce2d[_0xc6ab('0x3a')]()['then'](function(){var _0x3fc978=_0x31ce2d[_0xc6ab('0x3b')]({'plain':!![]});var _0xaf7908=_0xc6ab('0x3c');return db[_0xc6ab('0x3d')][_0xc6ab('0x3a')]({'where':{'type':_0xaf7908,'resourceId':_0x3fc978['id']}})[_0xc6ab('0x24')](function(){return _0x31ce2d;});})['then'](function(){_0xf20585[_0xc6ab('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d1f4e,_0x3b7741){return function(_0x50cd27){if(!_0x50cd27){_0x5d1f4e[_0xc6ab('0x2e')](0x194);}return _0x50cd27;};}function handleError(_0xbf58f3,_0x432da0){_0x432da0=_0x432da0||0x1f4;return function(_0x54be5b){logger['error'](_0x54be5b[_0xc6ab('0x3e')]);if(_0x54be5b['name']){delete _0x54be5b['name'];}_0xbf58f3[_0xc6ab('0x2f')](_0x432da0)[_0xc6ab('0x3f')](_0x54be5b);};}exports['index']=function(_0x459195,_0x2ebd31){var _0x128593={'include':[{'model':db['Pause'],'as':_0xc6ab('0x40')}]},_0x5e7c3d={},_0x276f07={'count':0x0,'rows':[]};var _0x73ed9e=_[_0xc6ab('0x41')](db['FaxAccount'][_0xc6ab('0x42')],function(_0xc20f5e){return{'name':_0xc20f5e[_0xc6ab('0x43')],'type':_0xc20f5e[_0xc6ab('0x44')][_0xc6ab('0x45')]};});_0x5e7c3d[_0xc6ab('0x46')]=_['map'](_0x73ed9e,_0xc6ab('0x47'));_0x5e7c3d[_0xc6ab('0x48')]=_[_0xc6ab('0x49')](_0x459195[_0xc6ab('0x48')]);_0x5e7c3d[_0xc6ab('0x4a')]=_[_0xc6ab('0x4b')](_0x5e7c3d[_0xc6ab('0x46')],_0x5e7c3d[_0xc6ab('0x48')]);_0x128593[_0xc6ab('0x4c')]=_[_0xc6ab('0x4b')](_0x5e7c3d[_0xc6ab('0x46')],qs[_0xc6ab('0x4d')](_0x459195[_0xc6ab('0x48')][_0xc6ab('0x4d')]));_0x128593['attributes']=_0x128593['attributes']['length']?_0x128593[_0xc6ab('0x4c')]:_0x5e7c3d['model'];if(!_0x459195[_0xc6ab('0x48')]['hasOwnProperty'](_0xc6ab('0x4e'))){_0x128593[_0xc6ab('0x34')]=qs[_0xc6ab('0x34')](_0x459195[_0xc6ab('0x48')][_0xc6ab('0x34')]);_0x128593['offset']=qs[_0xc6ab('0x32')](_0x459195[_0xc6ab('0x48')]['offset']);}_0x128593['order']=qs['sort'](_0x459195[_0xc6ab('0x48')]['sort']);_0x128593[_0xc6ab('0x4f')]=qs[_0xc6ab('0x4a')](_[_0xc6ab('0x50')](_0x459195['query'],_0x5e7c3d['filters']),_0x73ed9e);if(_0x459195['query'][_0xc6ab('0x51')]){_0x128593[_0xc6ab('0x4f')]=_[_0xc6ab('0x52')](_0x128593['where'],{'$or':_[_0xc6ab('0x41')](_0x73ed9e,function(_0x2aea0e){if(_0x2aea0e[_0xc6ab('0x44')]!==_0xc6ab('0x53')){var _0x265e2a={};_0x265e2a[_0x2aea0e[_0xc6ab('0x47')]]={'$like':'%'+_0x459195['query'][_0xc6ab('0x51')]+'%'};return _0x265e2a;}})});}_0x128593=_[_0xc6ab('0x52')]({},_0x128593,_0x459195[_0xc6ab('0x54')]);var _0x5eb1f5={'where':_0x128593[_0xc6ab('0x4f')]};return db[_0xc6ab('0x55')][_0xc6ab('0x35')](_0x5eb1f5)[_0xc6ab('0x24')](function(_0x30cdd3){_0x276f07[_0xc6ab('0x35')]=_0x30cdd3;if(_0x459195[_0xc6ab('0x48')]['includeAll']){_0x128593[_0xc6ab('0x56')]=[{'all':!![]}];}return db[_0xc6ab('0x55')][_0xc6ab('0x57')](_0x128593);})[_0xc6ab('0x24')](function(_0x503263){_0x276f07[_0xc6ab('0x58')]=_0x503263;return _0x276f07;})[_0xc6ab('0x24')](respondWithFilteredResult(_0x2ebd31,_0x128593))['catch'](handleError(_0x2ebd31,null));};exports['show']=function(_0x54ce4e,_0x1b6a8c){var _0x5c62cb={'raw':![],'where':{'id':_0x54ce4e[_0xc6ab('0x59')]['id']},'include':[{'model':db[_0xc6ab('0x5a')],'as':_0xc6ab('0x40')}]},_0x1bb320={};_0x1bb320[_0xc6ab('0x46')]=_['keys'](db['FaxAccount']['rawAttributes']);_0x1bb320['query']=_['keys'](_0x54ce4e[_0xc6ab('0x48')]);_0x1bb320[_0xc6ab('0x4a')]=_[_0xc6ab('0x4b')](_0x1bb320['model'],_0x1bb320['query']);_0x5c62cb[_0xc6ab('0x4c')]=_['intersection'](_0x1bb320[_0xc6ab('0x46')],qs[_0xc6ab('0x4d')](_0x54ce4e[_0xc6ab('0x48')][_0xc6ab('0x4d')]));_0x5c62cb[_0xc6ab('0x4c')]=_0x5c62cb[_0xc6ab('0x4c')][_0xc6ab('0x5b')]?_0x5c62cb['attributes']:_0x1bb320['model'];if(_0x54ce4e[_0xc6ab('0x48')][_0xc6ab('0x5c')]){_0x5c62cb['include']=[{'all':!![]}];}_0x5c62cb=_[_0xc6ab('0x52')]({},_0x5c62cb,_0x54ce4e[_0xc6ab('0x54')]);return db[_0xc6ab('0x55')][_0xc6ab('0x5d')](_0x5c62cb)['then'](handleEntityNotFound(_0x1b6a8c,null))['then'](respondWithResult(_0x1b6a8c,null))[_0xc6ab('0x5e')](handleError(_0x1b6a8c,null));};exports[_0xc6ab('0x5f')]=function(_0x458549,_0x5661b9){return db[_0xc6ab('0x55')][_0xc6ab('0x5f')](_0x458549['body'],{})['then'](function(_0x346d68){var _0x37907b=_0x458549['user']['get']({'plain':!![]});if(!_0x37907b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37907b['role']===_0xc6ab('0x60')){var _0x1a7245=_0x346d68[_0xc6ab('0x3b')]({'plain':!![]});var _0x32dfc2='FaxAccounts';return db[_0xc6ab('0x61')][_0xc6ab('0x5d')]({'where':{'name':_0x32dfc2,'userProfileId':_0x37907b[_0xc6ab('0x62')]},'raw':!![]})[_0xc6ab('0x24')](function(_0x1713fe){if(_0x1713fe&&_0x1713fe[_0xc6ab('0x63')]===0x0){return db['UserProfileResource'][_0xc6ab('0x5f')]({'name':_0x1a7245['name'],'resourceId':_0x1a7245['id'],'type':_0x1713fe['name'],'sectionId':_0x1713fe['id']},{})[_0xc6ab('0x24')](function(){return _0x346d68;});}else{return _0x346d68;}})[_0xc6ab('0x5e')](function(_0x180e1f){logger['error'](_0xc6ab('0x64'),_0x180e1f);throw _0x180e1f;});}return _0x346d68;})[_0xc6ab('0x24')](respondWithResult(_0x5661b9,0xc9))[_0xc6ab('0x5e')](handleError(_0x5661b9,null));};exports[_0xc6ab('0x65')]=function(_0x519658,_0xc527b9){if(_0x519658[_0xc6ab('0x66')]['id']){delete _0x519658[_0xc6ab('0x66')]['id'];}return db[_0xc6ab('0x55')][_0xc6ab('0x5d')]({'where':{'id':_0x519658[_0xc6ab('0x59')]['id']},'include':[{'model':db[_0xc6ab('0x5a')],'as':_0xc6ab('0x40')}]})[_0xc6ab('0x24')](handleEntityNotFound(_0xc527b9,null))['then'](saveUpdates(_0x519658[_0xc6ab('0x66')],null))[_0xc6ab('0x24')](respondWithResult(_0xc527b9,null))[_0xc6ab('0x5e')](handleError(_0xc527b9,null));};exports['destroy']=function(_0x397989,_0x4640d1){return db[_0xc6ab('0x55')][_0xc6ab('0x5d')]({'where':{'id':_0x397989['params']['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x4640d1,null))[_0xc6ab('0x24')](removeEntity(_0x4640d1,null))[_0xc6ab('0x5e')](handleError(_0x4640d1,null));};exports[_0xc6ab('0x67')]=function(_0x43d499,_0x4a2c77){return db[_0xc6ab('0x55')][_0xc6ab('0x67')]()[_0xc6ab('0x24')](respondWithResult(_0x4a2c77,null))['catch'](handleError(_0x4a2c77,null));};exports[_0xc6ab('0x68')]=function(_0x5a47c4,_0x5b4be7,_0x5c3799){if(_0x5a47c4[_0xc6ab('0x66')]['id']){delete _0x5a47c4[_0xc6ab('0x66')]['id'];}return db[_0xc6ab('0x55')][_0xc6ab('0x5d')]({'where':{'id':_0x5a47c4[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x5b4be7,null))[_0xc6ab('0x24')](function(_0x27a899){if(_0x27a899){_0x5a47c4[_0xc6ab('0x66')][_0xc6ab('0x69')]=_0x27a899['id'];return db[_0xc6ab('0x6a')][_0xc6ab('0x5f')](_0x5a47c4[_0xc6ab('0x66')]);}})[_0xc6ab('0x24')](respondWithResult(_0x5b4be7,null))[_0xc6ab('0x5e')](handleError(_0x5b4be7,null));};exports[_0xc6ab('0x6b')]=function(_0x50d9d8,_0x1d46f1,_0x5f21d5){var _0x48107e={'raw':![],'where':{}};var _0x1e008e={};var _0x382629={'count':0x0,'rows':[]};return db[_0xc6ab('0x55')]['findOne']({'where':{'id':_0x50d9d8[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x1d46f1,null))[_0xc6ab('0x24')](function(_0x41d3e8){if(_0x41d3e8){_0x1e008e[_0xc6ab('0x46')]=_[_0xc6ab('0x49')](db[_0xc6ab('0x6a')]['rawAttributes']);_0x1e008e[_0xc6ab('0x48')]=_['keys'](_0x50d9d8['query']);_0x1e008e[_0xc6ab('0x4a')]=_[_0xc6ab('0x4b')](_0x1e008e[_0xc6ab('0x46')],_0x1e008e[_0xc6ab('0x48')]);_0x48107e['attributes']=_[_0xc6ab('0x4b')](_0x1e008e[_0xc6ab('0x46')],qs[_0xc6ab('0x4d')](_0x50d9d8[_0xc6ab('0x48')]['fields']));_0x48107e[_0xc6ab('0x4c')]=_0x48107e[_0xc6ab('0x4c')][_0xc6ab('0x5b')]?_0x48107e[_0xc6ab('0x4c')]:_0x1e008e['model'];if(!_0x50d9d8[_0xc6ab('0x48')][_0xc6ab('0x6c')]('nolimit')){_0x48107e[_0xc6ab('0x34')]=qs['limit'](_0x50d9d8[_0xc6ab('0x48')]['limit']);_0x48107e[_0xc6ab('0x32')]=qs[_0xc6ab('0x32')](_0x50d9d8[_0xc6ab('0x48')][_0xc6ab('0x32')]);}_0x48107e[_0xc6ab('0x6d')]=qs[_0xc6ab('0x6e')](_0x50d9d8[_0xc6ab('0x48')]['sort']);_0x48107e[_0xc6ab('0x4f')]=qs[_0xc6ab('0x4a')](_[_0xc6ab('0x50')](_0x50d9d8[_0xc6ab('0x48')],_0x1e008e['filters']));_0x48107e[_0xc6ab('0x4f')][_0xc6ab('0x69')]=_0x41d3e8['id'];if(_0x50d9d8[_0xc6ab('0x48')][_0xc6ab('0x51')]){_0x48107e[_0xc6ab('0x4f')]=_['merge'](_0x48107e[_0xc6ab('0x4f')],{'$or':_[_0xc6ab('0x41')](_0x48107e[_0xc6ab('0x4c')],function(_0x55a9ee){var _0x1100c4={};_0x1100c4[_0x55a9ee]={'$like':'%'+_0x50d9d8['query'][_0xc6ab('0x51')]+'%'};return _0x1100c4;})});}_0x48107e=_[_0xc6ab('0x52')]({},_0x48107e,_0x50d9d8[_0xc6ab('0x54')]);return db[_0xc6ab('0x6a')][_0xc6ab('0x35')]({'where':_0x48107e[_0xc6ab('0x4f')]})['then'](function(_0x491222){_0x382629[_0xc6ab('0x35')]=_0x491222;if(_0x50d9d8[_0xc6ab('0x48')]['includeAll']){_0x48107e[_0xc6ab('0x56')]=[{'all':!![]}];}return db[_0xc6ab('0x6a')][_0xc6ab('0x57')](_0x48107e);})[_0xc6ab('0x24')](function(_0x4ffafe){_0x382629['rows']=_0x4ffafe;return _0x382629;});}})['then'](respondWithFilteredResult(_0x1d46f1,_0x48107e))[_0xc6ab('0x5e')](handleError(_0x1d46f1,null));};exports['removeDispositions']=function(_0x35ea14,_0x2bd142,_0x1553a3){return db[_0xc6ab('0x55')]['find']({'where':{'id':_0x35ea14['params']['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x2bd142,null))[_0xc6ab('0x24')](function(_0x271c21){if(_0x271c21){return _0x271c21[_0xc6ab('0x6f')](_0x35ea14[_0xc6ab('0x48')][_0xc6ab('0x70')]);}})[_0xc6ab('0x24')](respondWithStatusCode(_0x2bd142,null))[_0xc6ab('0x5e')](handleError(_0x2bd142,null));};exports[_0xc6ab('0x71')]=function(_0x1d0e24,_0x2166e9,_0x280f21){if(_0x1d0e24[_0xc6ab('0x66')]['id']){delete _0x1d0e24[_0xc6ab('0x66')]['id'];}return db[_0xc6ab('0x55')][_0xc6ab('0x5d')]({'where':{'id':_0x1d0e24[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x2166e9,null))[_0xc6ab('0x24')](function(_0x143a3a){if(_0x143a3a){_0x1d0e24[_0xc6ab('0x66')][_0xc6ab('0x69')]=_0x143a3a['id'];return db['CannedAnswer'][_0xc6ab('0x5f')](_0x1d0e24[_0xc6ab('0x66')]);}})[_0xc6ab('0x24')](respondWithResult(_0x2166e9,null))[_0xc6ab('0x5e')](handleError(_0x2166e9,null));};exports[_0xc6ab('0x72')]=function(_0x179c3c,_0x174958,_0x4124e9){var _0x2e1dc8={'raw':![],'where':{}};var _0x38854d={};var _0x3bde8f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc6ab('0x73')]({'where':{'id':_0x179c3c[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x174958,null))['then'](function(_0x1429f9){if(_0x1429f9){_0x38854d[_0xc6ab('0x46')]=_[_0xc6ab('0x49')](db[_0xc6ab('0x74')][_0xc6ab('0x42')]);_0x38854d[_0xc6ab('0x48')]=_[_0xc6ab('0x49')](_0x179c3c[_0xc6ab('0x48')]);_0x38854d[_0xc6ab('0x4a')]=_[_0xc6ab('0x4b')](_0x38854d[_0xc6ab('0x46')],_0x38854d['query']);_0x2e1dc8['attributes']=_[_0xc6ab('0x4b')](_0x38854d[_0xc6ab('0x46')],qs['fields'](_0x179c3c[_0xc6ab('0x48')][_0xc6ab('0x4d')]));_0x2e1dc8['attributes']=_0x2e1dc8[_0xc6ab('0x4c')][_0xc6ab('0x5b')]?_0x2e1dc8['attributes']:_0x38854d[_0xc6ab('0x46')];if(!_0x179c3c[_0xc6ab('0x48')][_0xc6ab('0x6c')](_0xc6ab('0x4e'))){_0x2e1dc8[_0xc6ab('0x34')]=qs[_0xc6ab('0x34')](_0x179c3c[_0xc6ab('0x48')][_0xc6ab('0x34')]);_0x2e1dc8[_0xc6ab('0x32')]=qs[_0xc6ab('0x32')](_0x179c3c['query']['offset']);}_0x2e1dc8[_0xc6ab('0x6d')]=qs[_0xc6ab('0x6e')](_0x179c3c[_0xc6ab('0x48')][_0xc6ab('0x6e')]);_0x2e1dc8[_0xc6ab('0x4f')]=qs[_0xc6ab('0x4a')](_[_0xc6ab('0x50')](_0x179c3c[_0xc6ab('0x48')],_0x38854d[_0xc6ab('0x4a')]));_0x2e1dc8[_0xc6ab('0x4f')]['FaxAccountId']=_0x1429f9['id'];if(_0x179c3c[_0xc6ab('0x48')][_0xc6ab('0x51')]){_0x2e1dc8[_0xc6ab('0x4f')]=_[_0xc6ab('0x52')](_0x2e1dc8[_0xc6ab('0x4f')],{'$or':_[_0xc6ab('0x41')](_0x2e1dc8['attributes'],function(_0x77263b){var _0x183faf={};_0x183faf[_0x77263b]={'$like':'%'+_0x179c3c['query'][_0xc6ab('0x51')]+'%'};return _0x183faf;})});}_0x2e1dc8=_['merge']({},_0x2e1dc8,_0x179c3c[_0xc6ab('0x54')]);return db[_0xc6ab('0x74')][_0xc6ab('0x35')]({'where':_0x2e1dc8[_0xc6ab('0x4f')]})[_0xc6ab('0x24')](function(_0x50b217){_0x3bde8f['count']=_0x50b217;if(_0x179c3c['query']['includeAll']){_0x2e1dc8[_0xc6ab('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc6ab('0x57')](_0x2e1dc8);})[_0xc6ab('0x24')](function(_0x2bc3a7){_0x3bde8f[_0xc6ab('0x58')]=_0x2bc3a7;return _0x3bde8f;});}})[_0xc6ab('0x24')](respondWithFilteredResult(_0x174958,_0x2e1dc8))[_0xc6ab('0x5e')](handleError(_0x174958,null));};exports[_0xc6ab('0x75')]=function(_0xbf6d02,_0xb15665,_0x2e68f3){return db[_0xc6ab('0x55')]['find']({'where':{'id':_0xbf6d02[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0xb15665,null))['then'](function(_0x464e9e){if(_0x464e9e){return _0x464e9e[_0xc6ab('0x75')](_0xbf6d02['query'][_0xc6ab('0x70')]);}})[_0xc6ab('0x24')](respondWithStatusCode(_0xb15665,null))['catch'](handleError(_0xb15665,null));};exports[_0xc6ab('0x76')]=function(_0x3a6d4f,_0x1e472e,_0x15c005){return db[_0xc6ab('0x77')]['find']({'where':{'id':_0x3a6d4f[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x1e472e,null))['then'](function(_0xadbd6d){if(_0xadbd6d){return _0xadbd6d['addInteraction'](_0x3a6d4f[_0xc6ab('0x66')]['ids'],_[_0xc6ab('0x78')](_0x3a6d4f['body'],['ids','id'])||{});}})[_0xc6ab('0x24')](respondWithResult(_0x1e472e,null))[_0xc6ab('0x5e')](handleError(_0x1e472e,null));};exports[_0xc6ab('0x79')]=function(_0x497d17,_0x3512c2,_0x32e84d){var _0x19a994={'raw':![],'where':{}};var _0x50c19e={};var _0x16edf9={'count':0x0,'rows':[]};return db[_0xc6ab('0x55')][_0xc6ab('0x73')]({'where':{'id':_0x497d17[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x3512c2,null))[_0xc6ab('0x24')](function(_0x14a2d6){if(_0x14a2d6){_0x50c19e[_0xc6ab('0x46')]=_[_0xc6ab('0x49')](db[_0xc6ab('0x77')]['rawAttributes']);_0x50c19e[_0xc6ab('0x48')]=_[_0xc6ab('0x49')](_0x497d17['query']);_0x50c19e['filters']=_[_0xc6ab('0x4b')](_0x50c19e[_0xc6ab('0x46')],_0x50c19e[_0xc6ab('0x48')]);_0x19a994[_0xc6ab('0x4c')]=_[_0xc6ab('0x4b')](_0x50c19e[_0xc6ab('0x46')],qs['fields'](_0x497d17[_0xc6ab('0x48')][_0xc6ab('0x4d')]));_0x19a994[_0xc6ab('0x4c')]=_0x19a994['attributes'][_0xc6ab('0x5b')]?_0x19a994[_0xc6ab('0x4c')]:_0x50c19e[_0xc6ab('0x46')];if(!_0x497d17[_0xc6ab('0x48')]['hasOwnProperty'](_0xc6ab('0x4e'))){_0x19a994[_0xc6ab('0x34')]=qs[_0xc6ab('0x34')](_0x497d17[_0xc6ab('0x48')][_0xc6ab('0x34')]);_0x19a994[_0xc6ab('0x32')]=qs[_0xc6ab('0x32')](_0x497d17[_0xc6ab('0x48')]['offset']);}_0x19a994[_0xc6ab('0x6d')]=qs[_0xc6ab('0x6e')](_0x497d17[_0xc6ab('0x48')][_0xc6ab('0x6e')]);_0x19a994[_0xc6ab('0x4f')]=qs[_0xc6ab('0x4a')](_[_0xc6ab('0x50')](_0x497d17[_0xc6ab('0x48')],_0x50c19e[_0xc6ab('0x4a')]));_0x19a994[_0xc6ab('0x4f')][_0xc6ab('0x69')]=_0x14a2d6['id'];if(_0x497d17['query']['filter']){_0x19a994[_0xc6ab('0x4f')]=_[_0xc6ab('0x52')](_0x19a994['where'],{'$or':_[_0xc6ab('0x41')](_0x19a994['attributes'],function(_0x824683){var _0x30fd97={};_0x30fd97[_0x824683]={'$like':'%'+_0x497d17[_0xc6ab('0x48')][_0xc6ab('0x51')]+'%'};return _0x30fd97;})});}_0x19a994=_[_0xc6ab('0x52')]({},_0x19a994,_0x497d17[_0xc6ab('0x54')]);return db['FaxInteraction']['count']({'where':_0x19a994[_0xc6ab('0x4f')]})[_0xc6ab('0x24')](function(_0x4ad110){_0x16edf9[_0xc6ab('0x35')]=_0x4ad110;if(_0x497d17[_0xc6ab('0x48')][_0xc6ab('0x5c')]){_0x19a994[_0xc6ab('0x56')]=[{'model':db[_0xc6ab('0x7a')],'as':_0xc6ab('0x7b'),'required':![]},{'model':db['User'],'as':_0xc6ab('0x7c'),'attributes':[_0xc6ab('0x47'),_0xc6ab('0x7d'),'internal'],'required':![]},{'model':db[_0xc6ab('0x7e')],'as':_0xc6ab('0x7f'),'attributes':['id',_0xc6ab('0x47'),_0xc6ab('0x80')],'where':_0x497d17[_0xc6ab('0x48')][_0xc6ab('0x81')]?{'id':_0x497d17['query']['tag']}:undefined,'required':_0x497d17[_0xc6ab('0x48')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xc6ab('0x57')](_0x19a994);})[_0xc6ab('0x24')](function(_0x37d0e3){_0x16edf9[_0xc6ab('0x58')]=_0x37d0e3;return _0x16edf9;});}})[_0xc6ab('0x24')](respondWithFilteredResult(_0x3512c2,_0x19a994))['catch'](handleError(_0x3512c2,null));};exports[_0xc6ab('0x82')]=function(_0x2b9be8,_0x2169d0,_0x329c2e){return db[_0xc6ab('0x55')][_0xc6ab('0x73')]({'where':{'id':_0x2b9be8['params']['id']}})['then'](handleEntityNotFound(_0x2169d0,null))[_0xc6ab('0x24')](function(_0x2262de){if(_0x2262de){return db[_0xc6ab('0x83')][_0xc6ab('0x84')](function(_0x471291){return db[_0xc6ab('0x85')][_0xc6ab('0x3a')]({'where':{'FaxAccountId':_0x2b9be8[_0xc6ab('0x59')]['id']},'transaction':_0x471291})[_0xc6ab('0x24')](function(_0x560093){var _0x89ba1e=_[_0xc6ab('0x41')](_0x2b9be8['body'],function(_0x53629e){_0x53629e[_0xc6ab('0x69')]=_0x2b9be8[_0xc6ab('0x59')]['id'];return _0x53629e;});return db[_0xc6ab('0x85')][_0xc6ab('0x86')](_0x89ba1e,{'transaction':_0x471291});});})[_0xc6ab('0x24')](function(){return db[_0xc6ab('0x85')]['findAndCountAll']({'where':{'FaxAccountId':_0x2b9be8[_0xc6ab('0x59')]['id']},'order':_0xc6ab('0x87')});});}})[_0xc6ab('0x24')](respondWithResult(_0x2169d0,null))[_0xc6ab('0x5e')](handleError(_0x2169d0,null));};exports[_0xc6ab('0x88')]=function(_0x4f8848,_0x34bbd9,_0x1b6dd4){var _0x17b0f2={};var _0x2617d2={};var _0x71d0e9;var _0x99bc2d;return db['FaxAccount'][_0xc6ab('0x73')]({'where':{'id':_0x4f8848[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x34bbd9,null))[_0xc6ab('0x24')](function(_0x34325d){if(_0x34325d){_0x71d0e9=_0x34325d;_0x2617d2[_0xc6ab('0x46')]=_[_0xc6ab('0x49')](db['FaxApplication'][_0xc6ab('0x42')]);_0x2617d2[_0xc6ab('0x48')]=_[_0xc6ab('0x49')](_0x4f8848[_0xc6ab('0x48')]);_0x2617d2[_0xc6ab('0x4a')]=_[_0xc6ab('0x4b')](_0x2617d2[_0xc6ab('0x46')],_0x2617d2[_0xc6ab('0x48')]);_0x17b0f2[_0xc6ab('0x4c')]=_[_0xc6ab('0x4b')](_0x2617d2[_0xc6ab('0x46')],qs[_0xc6ab('0x4d')](_0x4f8848['query'][_0xc6ab('0x4d')]));_0x17b0f2['attributes']=_0x17b0f2[_0xc6ab('0x4c')][_0xc6ab('0x5b')]?_0x17b0f2[_0xc6ab('0x4c')]:_0x2617d2[_0xc6ab('0x46')];_0x17b0f2[_0xc6ab('0x6d')]=qs[_0xc6ab('0x6e')](_0x4f8848[_0xc6ab('0x48')]['sort']);_0x17b0f2[_0xc6ab('0x4f')]=qs['filters'](_[_0xc6ab('0x50')](_0x4f8848[_0xc6ab('0x48')],_0x2617d2[_0xc6ab('0x4a')]));if(_0x4f8848[_0xc6ab('0x48')][_0xc6ab('0x51')]){_0x17b0f2[_0xc6ab('0x4f')]=_[_0xc6ab('0x52')](_0x17b0f2['where'],{'$or':_[_0xc6ab('0x41')](_0x17b0f2['attributes'],function(_0x20b523){var _0xb8bf56={};_0xb8bf56[_0x20b523]={'$like':'%'+_0x4f8848[_0xc6ab('0x48')][_0xc6ab('0x51')]+'%'};return _0xb8bf56;})});}_0x17b0f2=_[_0xc6ab('0x52')]({},_0x17b0f2,_0x4f8848[_0xc6ab('0x54')]);return _0x71d0e9[_0xc6ab('0x88')](_0x17b0f2);}})['then'](function(_0x58ed7e){if(_0x58ed7e){_0x99bc2d=_0x58ed7e[_0xc6ab('0x5b')];if(!_0x4f8848['query']['hasOwnProperty']('nolimit')){_0x17b0f2[_0xc6ab('0x34')]=qs[_0xc6ab('0x34')](_0x4f8848[_0xc6ab('0x48')][_0xc6ab('0x34')]);_0x17b0f2['offset']=qs[_0xc6ab('0x32')](_0x4f8848['query']['offset']);}return _0x71d0e9[_0xc6ab('0x88')](_0x17b0f2);}})[_0xc6ab('0x24')](function(_0x3b0460){if(_0x3b0460){return _0x3b0460?{'count':_0x99bc2d,'rows':_0x3b0460}:null;}})['then'](respondWithResult(_0x34bbd9,null))[_0xc6ab('0x5e')](handleError(_0x34bbd9,null));};function Extension(_0x1676e7,_0x1352e3,_0x3dbdf7,_0xd296ac){this[_0xc6ab('0x89')]=_0xc6ab('0x8a');this['exten']=_0x1676e7[_0xc6ab('0x8b')];this[_0xc6ab('0x8c')]=_0xd296ac;this[_0xc6ab('0x44')]=_0xc6ab('0x8d');this['description']=_0xc6ab('0x8e');this['FaxAccountId']=_0x1676e7['id'];this[_0xc6ab('0x87')]=_0x1352e3;this['appdata']=_0x3dbdf7;}function createExtensionsReciveFax(_0x40462c){var _0x224060=0x1;var _0x45ad5a=[];_0x45ad5a[_0xc6ab('0x8f')](new Extension(_0x40462c,_0x224060,'',_0xc6ab('0x90')));_0x224060+=0x1;_0x45ad5a[_0xc6ab('0x8f')](new Extension(_0x40462c,_0x224060,_0xc6ab('0x91'),'Set'));_0x224060+=0x1;for(var _0x98d57c in _0x40462c){if(_0x40462c[_0xc6ab('0x6c')](_0x98d57c)&&(_0x98d57c===_0xc6ab('0x92')||_0x98d57c===_0xc6ab('0x8b')||_0x98d57c===_0xc6ab('0x93')||_0x98d57c===_0xc6ab('0x94')||_0x98d57c===_0xc6ab('0x95')||_0x98d57c===_0xc6ab('0x96')||_0x98d57c===_0xc6ab('0x97')||_0x98d57c==='modem'||_0x98d57c===_0xc6ab('0x98'))){_0x45ad5a['push'](new Extension(_0x40462c,_0x224060,_0xc6ab('0x99')+_0x98d57c+')='+_0x40462c[_0x98d57c],_0xc6ab('0x9a')));_0x224060+=0x1;}}_0x45ad5a[_0xc6ab('0x8f')](new Extension(_0x40462c,_0x224060,'6',_0xc6ab('0x9b')));_0x224060+=0x1;_0x45ad5a[_0xc6ab('0x8f')](new Extension(_0x40462c,_0x224060,_0xc6ab('0x9c'),_0xc6ab('0x9d')));_0x224060=0x0;return _0x45ad5a;}exports[_0xc6ab('0x9e')]=function(_0x1ef03b,_0x342a4f,_0xaf4c05){var _0xc1eec6;return db[_0xc6ab('0x83')][_0xc6ab('0x84')](function(_0x399ac0){return db[_0xc6ab('0x55')]['create'](_0x1ef03b[_0xc6ab('0x66')],{'transaction':_0x399ac0})[_0xc6ab('0x24')](function(_0x3900d9){_0xc1eec6=_0x3900d9[_0xc6ab('0x3b')]({'plain':!![]});return db[_0xc6ab('0x9f')]['bulkCreate'](createExtensionsReciveFax(_0xc1eec6),{'transaction':_0x399ac0});});})[_0xc6ab('0x24')](function(){return _0xc1eec6;})[_0xc6ab('0x24')](respondWithResult(_0x342a4f,null))[_0xc6ab('0x5e')](handleError(_0x342a4f,null));};exports[_0xc6ab('0xa0')]=function(_0x275e8b,_0x4c5ea5,_0x2881f4){var _0x5a4009;return db[_0xc6ab('0x83')][_0xc6ab('0x84')](function(_0x5f16fa){return db[_0xc6ab('0x55')]['update'](_0x275e8b[_0xc6ab('0x66')],{'where':{'id':_0x275e8b[_0xc6ab('0x66')]['id']},'transaction':_0x5f16fa})['then'](function(_0x567f65){return db[_0xc6ab('0x9f')]['destroy']({'where':{'FaxAccountId':_0x275e8b[_0xc6ab('0x66')]['id']},'transaction':_0x5f16fa})[_0xc6ab('0x24')](function(_0x3ef085){return db[_0xc6ab('0x9f')][_0xc6ab('0x86')](createExtensionsReciveFax(_[_0xc6ab('0x78')](_0x275e8b['body'],['tech','key',_0xc6ab('0xa1'),_0xc6ab('0xa2'),_0xc6ab('0xa3'),'ListId'])),{'transaction':_0x5f16fa});});});})['then'](function(){return db[_0xc6ab('0x55')][_0xc6ab('0xa4')](_0x275e8b[_0xc6ab('0x66')]['id']);})['then'](respondWithResult(_0x4c5ea5,null))[_0xc6ab('0x5e')](handleError(_0x4c5ea5,null));};exports[_0xc6ab('0xa5')]=function(_0x59045e,_0xe5770b,_0x5b6bf6){var _0x38b0d2={'raw':!![],'where':{}};var _0x1bccb7={};var _0x17684f={'count':0x0,'rows':[]};return db[_0xc6ab('0x55')][_0xc6ab('0x73')]({'where':{'id':_0x59045e[_0xc6ab('0x59')]['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0xe5770b,null))[_0xc6ab('0x24')](function(_0x78894c){if(_0x78894c){_0x1bccb7['model']=_[_0xc6ab('0x49')](db[_0xc6ab('0xa6')][_0xc6ab('0x42')]);_0x1bccb7[_0xc6ab('0x48')]=_['keys'](_0x59045e[_0xc6ab('0x48')]);_0x1bccb7['filters']=_[_0xc6ab('0x4b')](_0x1bccb7[_0xc6ab('0x46')],_0x1bccb7['query']);_0x38b0d2[_0xc6ab('0x4c')]=_[_0xc6ab('0x4b')](_0x1bccb7[_0xc6ab('0x46')],qs[_0xc6ab('0x4d')](_0x59045e['query'][_0xc6ab('0x4d')]));_0x38b0d2[_0xc6ab('0x4c')]=_0x38b0d2['attributes']['length']?_0x38b0d2['attributes']:_0x1bccb7[_0xc6ab('0x46')];if(!_0x59045e[_0xc6ab('0x48')][_0xc6ab('0x6c')](_0xc6ab('0x4e'))){_0x38b0d2['limit']=qs[_0xc6ab('0x34')](_0x59045e['query']['limit']);_0x38b0d2['offset']=qs['offset'](_0x59045e[_0xc6ab('0x48')][_0xc6ab('0x32')]);}_0x38b0d2['order']=qs['sort'](_0x59045e[_0xc6ab('0x48')][_0xc6ab('0x6e')]);_0x38b0d2[_0xc6ab('0x4f')]=qs[_0xc6ab('0x4a')](_[_0xc6ab('0x50')](_0x59045e[_0xc6ab('0x48')],_0x1bccb7[_0xc6ab('0x4a')]));_0x38b0d2[_0xc6ab('0x4f')][_0xc6ab('0x69')]=_0x78894c['id'];if(_0x59045e['query']['filter']){_0x38b0d2[_0xc6ab('0x4f')]=_[_0xc6ab('0x52')](_0x38b0d2['where'],{'$or':_['map'](_0x38b0d2[_0xc6ab('0x4c')],function(_0x3d42f6){var _0x32ac76={};_0x32ac76[_0x3d42f6]={'$like':'%'+_0x59045e['query'][_0xc6ab('0x51')]+'%'};return _0x32ac76;})});}if(_0x59045e[_0xc6ab('0x48')][_0xc6ab('0xa7')]){var _0x9e73cd=_0x59045e[_0xc6ab('0x48')][_0xc6ab('0xa7')][_0xc6ab('0xa8')](',');var _0x54f072={};_0x54f072[_0x9e73cd[0x0]]={'$gte':moment(_0x9e73cd[0x1])[_0xc6ab('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x38b0d2[_0xc6ab('0x4f')]=_[_0xc6ab('0x52')](_0x38b0d2[_0xc6ab('0x4f')],_0x54f072);}_0x38b0d2=_['merge']({},_0x38b0d2,_0x59045e['options']);return db[_0xc6ab('0xa6')][_0xc6ab('0x35')]({'where':_0x38b0d2['where']})['then'](function(_0x3215ce){_0x17684f['count']=_0x3215ce;if(_0x59045e[_0xc6ab('0x48')][_0xc6ab('0x5c')]){_0x38b0d2[_0xc6ab('0x56')]=[{'all':!![]}];}return db[_0xc6ab('0xa6')][_0xc6ab('0x57')](_0x38b0d2);})[_0xc6ab('0x24')](function(_0x2b500c){_0x17684f[_0xc6ab('0x58')]=_0x2b500c;return _0x17684f;});}})[_0xc6ab('0x24')](respondWithFilteredResult(_0xe5770b,_0x38b0d2))[_0xc6ab('0x5e')](handleError(_0xe5770b,null));};exports[_0xc6ab('0x3f')]=function(_0x4d64a1,_0x272c5f,_0x3d47d4){var _0x447946,_0x1dd1fe={},_0x21fc1b;if(_0x4d64a1[_0xc6ab('0x66')]['to']){_0x21fc1b=_0x4d64a1[_0xc6ab('0x66')]['to'][0x0];}return db[_0xc6ab('0x55')]['find']({'where':{'id':_0x4d64a1['params']['id']},'include':[{'model':db[_0xc6ab('0xaa')],'as':_0xc6ab('0xab'),'include':[{'model':db[_0xc6ab('0x7a')],'as':'Contacts','where':{'fax':_0x21fc1b},'limit':0x1,'order':[[_0xc6ab('0xa2'),_0xc6ab('0xac')]]}]}]})[_0xc6ab('0x24')](handleEntityNotFound(_0x272c5f,null))[_0xc6ab('0x24')](function(_0x19b71f){_0x447946=_0x19b71f;if(_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')]&&_0x4d64a1['body'][_0xc6ab('0xad')][_0xc6ab('0x5b')]){for(var _0x560cb9=0x0;_0x560cb9<_0x4d64a1['body']['attachments'][_0xc6ab('0x5b')];_0x560cb9+=0x1){_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][_0x560cb9]={'filename':_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][_0x560cb9][_0xc6ab('0x47')],'id':_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][_0x560cb9]['id'],'path':path[_0xc6ab('0xae')](config[_0xc6ab('0xaf')],'server/files/attachments',_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][_0x560cb9]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xc6ab('0xb0')](_0x4d64a1[_0xc6ab('0x59')]['id'])?undefined:_0x4d64a1['params']['id'],'path':_['isNil'](_0x4d64a1[_0xc6ab('0x66')]['attachments'][0x0][_0xc6ab('0x8')])?undefined:_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][0x0][_0xc6ab('0x8')],'fax':_[_0xc6ab('0xb0')](_0x4d64a1['body']['to'][0x0])?undefined:_0x4d64a1[_0xc6ab('0x66')]['to'][0x0]},client9002);})[_0xc6ab('0x24')](function(){if(_0x447946){if(_[_0xc6ab('0xb0')](_0x4d64a1['body']['from'])){_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xb1')]=util[_0xc6ab('0xa9')](_0xc6ab('0xb2'),_0x447946[_0xc6ab('0x47')],_0x447946[_0xc6ab('0xb3')]);}if(_0x447946[_0xc6ab('0xab')]){if(_0x447946[_0xc6ab('0xab')][_0xc6ab('0xb4')][_0xc6ab('0x5b')]){return _0x447946[_0xc6ab('0xab')][_0xc6ab('0xb4')][0x0];}else{return db[_0xc6ab('0x7a')]['create'](_[_0xc6ab('0x1d')](_0x4d64a1[_0xc6ab('0x66')],{'firstName':_0x4d64a1[_0xc6ab('0x66')]['to'][0x0],'phone':_0x4d64a1[_0xc6ab('0x66')]['to'][0x0],'fax':_0x4d64a1[_0xc6ab('0x66')]['to'][0x0],'ListId':_0x447946[_0xc6ab('0xb5')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xc6ab('0xb6'));}})[_0xc6ab('0x24')](function(_0x5d387a){if(_0x5d387a){return db['FaxInteraction']['find']({'where':{'ContactId':_0x5d387a['id'],'closed':![],'FaxAccountId':_0x447946['id']}})['then'](function(_0x47d189){if(_0x47d189){return[_0x47d189,![]];}return db[_0xc6ab('0x77')][_0xc6ab('0x5f')]({'UserId':_0x4d64a1[_0xc6ab('0x60')]['id'],'ContactId':_0x5d387a['id'],'FaxAccountId':_0x447946['id'],'fax':_0x4d64a1[_0xc6ab('0x66')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xc6ab('0x52')](_0x4d64a1[_0xc6ab('0x66')],{'read':![],'body':_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][0x0][_0xc6ab('0xb7')],'FaxAccountId':_0x447946['id'],'UserId':_0x4d64a1['user']['id'],'ContactId':_0x5d387a['id'],'AttachmentId':_0x4d64a1[_0xc6ab('0x66')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xc6ab('0xa6')],'as':'Messages'}]})[_0xc6ab('0x24')](function(_0x514816){return[_0x514816,!![]];});});}else{throw new Error(_0xc6ab('0xb8'));}})['spread'](function(_0x3e788a,_0x39b053){if(_0x39b053){return _0x3e788a;}return db[_0xc6ab('0xa6')][_0xc6ab('0x5f')]({'direction':_0xc6ab('0xb9'),'read':![],'body':_0x4d64a1['body'][_0xc6ab('0xad')][0x0][_0xc6ab('0xb7')],'FaxAccountId':_0x447946['id'],'FaxInteractionId':_0x3e788a['id'],'UserId':_0x4d64a1[_0xc6ab('0x60')]['id'],'ContactId':_0x3e788a[_0xc6ab('0xba')],'AttachmentId':_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][0x0]['id']})[_0xc6ab('0x24')](function(_0x2708c7){_0x3e788a[_0xc6ab('0xbb')]['Messages']=[];_0x3e788a[_0xc6ab('0xbb')][_0xc6ab('0xbc')][_0xc6ab('0x8f')](_0x2708c7[_0xc6ab('0xbb')]);return _0x3e788a;});})['then'](function(_0x406cfa){respondWithRpcPromise('SendFax',_0xc6ab('0xbd'),{'FaxAccountId':_[_0xc6ab('0xb0')](_0x4d64a1['params']['id'])?undefined:_0x4d64a1['params']['id'],'path':_[_0xc6ab('0xb0')](_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][0x0][_0xc6ab('0x8')])?undefined:_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][0x0]['path'],'fax':_[_0xc6ab('0xb0')](_0x4d64a1['body']['to'][0x0])?undefined:_0x4d64a1[_0xc6ab('0x66')]['to'][0x0],'AttachmentId':_0x4d64a1[_0xc6ab('0x66')][_0xc6ab('0xad')][0x0]['id']},client9002)[_0xc6ab('0x24')](function(_0x3194f4){logger[_0xc6ab('0x25')]('SendFaxRpc,\x20%s',_0x3194f4);})['catch'](function(_0xa496c8){logger[_0xc6ab('0x25')](_0xc6ab('0xbe'),_0xa496c8);});return _0x406cfa;})[_0xc6ab('0x24')](respondWithResult(_0x272c5f,null))[_0xc6ab('0x5e')](handleError(_0x272c5f,null));};exports[_0xc6ab('0xbf')]=function(_0x373140,_0x4efe0c,_0x5d34be){return db[_0xc6ab('0x55')]['find']({'where':{'id':_0x373140['params']['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x4efe0c,null))['then'](function(_0x2c392a){if(_0x2c392a){return _0x2c392a[_0xc6ab('0xbf')](_0x373140[_0xc6ab('0x66')][_0xc6ab('0x70')],_[_0xc6ab('0x78')](_0x373140[_0xc6ab('0x66')],[_0xc6ab('0x70'),'id'])||{})[_0xc6ab('0xc0')](function(_0x2fde89){for(var _0x387ac6=0x0;_0x387ac6<_0x373140[_0xc6ab('0x66')][_0xc6ab('0x70')][_0xc6ab('0x5b')];_0x387ac6+=0x1){socket[_0xc6ab('0xc1')]('userFaxAccount:save',{'UserId':Number(_0x373140[_0xc6ab('0x66')][_0xc6ab('0x70')][_0x387ac6]),'FaxAccountId':Number(_0x373140[_0xc6ab('0x59')]['id'])});}return _0x2fde89;});}})['then'](respondWithResult(_0x4efe0c,null))[_0xc6ab('0x5e')](handleError(_0x4efe0c,null));};exports['removeAgents']=function(_0x430c9d,_0x32981d,_0x49b7a4){return db[_0xc6ab('0x55')][_0xc6ab('0x5d')]({'where':{'id':_0x430c9d['params']['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x32981d,null))[_0xc6ab('0x24')](function(_0x1c6d63){if(_0x1c6d63){return _0x1c6d63[_0xc6ab('0xc2')](_0x430c9d['query'][_0xc6ab('0x70')])[_0xc6ab('0x24')](function(){if(_[_0xc6ab('0xc3')](_0x430c9d[_0xc6ab('0x48')][_0xc6ab('0x70')])){for(var _0x1d74d6=0x0;_0x1d74d6<_0x430c9d['query']['ids']['length'];_0x1d74d6+=0x1){socket[_0xc6ab('0xc1')](_0xc6ab('0xc4'),{'UserId':Number(_0x430c9d['query'][_0xc6ab('0x70')][_0x1d74d6]),'FaxAccountId':Number(_0x430c9d[_0xc6ab('0x59')]['id'])});}}else{socket[_0xc6ab('0xc1')](_0xc6ab('0xc4'),{'UserId':Number(_0x430c9d[_0xc6ab('0x48')][_0xc6ab('0x70')]),'FaxAccountId':Number(_0x430c9d[_0xc6ab('0x59')]['id'])});}});}})[_0xc6ab('0x24')](respondWithStatusCode(_0x32981d,null))['catch'](handleError(_0x32981d,null));};exports[_0xc6ab('0xc5')]=function(_0x51e7d3,_0x217dba,_0x4e5db8){var _0x2acd69={};var _0x318dcc={};var _0x33a288;var _0x1c186a;return db[_0xc6ab('0x55')][_0xc6ab('0x73')]({'where':{'id':_0x51e7d3['params']['id']}})[_0xc6ab('0x24')](handleEntityNotFound(_0x217dba,null))[_0xc6ab('0x24')](function(_0x11ea53){if(_0x11ea53){_0x33a288=_0x11ea53;_0x318dcc[_0xc6ab('0x46')]=_['keys'](db[_0xc6ab('0xc6')]['rawAttributes']);_0x318dcc['query']=_[_0xc6ab('0x49')](_0x51e7d3['query']);_0x318dcc[_0xc6ab('0x4a')]=_[_0xc6ab('0x4b')](_0x318dcc[_0xc6ab('0x46')],_0x318dcc['query']);_0x2acd69[_0xc6ab('0x4c')]=_[_0xc6ab('0x4b')](_0x318dcc['model'],qs[_0xc6ab('0x4d')](_0x51e7d3[_0xc6ab('0x48')]['fields']));_0x2acd69[_0xc6ab('0x4c')]=_0x2acd69['attributes'][_0xc6ab('0x5b')]?_0x2acd69[_0xc6ab('0x4c')]:_0x318dcc[_0xc6ab('0x46')];_0x2acd69[_0xc6ab('0x6d')]=qs[_0xc6ab('0x6e')](_0x51e7d3[_0xc6ab('0x48')][_0xc6ab('0x6e')]);_0x2acd69[_0xc6ab('0x4f')]=qs[_0xc6ab('0x4a')](_[_0xc6ab('0x50')](_0x51e7d3['query'],_0x318dcc[_0xc6ab('0x4a')]));if(_0x51e7d3[_0xc6ab('0x48')][_0xc6ab('0x51')]){_0x2acd69[_0xc6ab('0x4f')]=_[_0xc6ab('0x52')](_0x2acd69[_0xc6ab('0x4f')],{'$or':_[_0xc6ab('0x41')](_0x2acd69['attributes'],function(_0x27511d){var _0x45d48c={};_0x45d48c[_0x27511d]={'$like':'%'+_0x51e7d3[_0xc6ab('0x48')][_0xc6ab('0x51')]+'%'};return _0x45d48c;})});}_0x2acd69=_[_0xc6ab('0x52')]({},_0x2acd69,_0x51e7d3[_0xc6ab('0x54')]);return _0x33a288[_0xc6ab('0xc5')](_0x2acd69);}})[_0xc6ab('0x24')](function(_0x16b833){if(_0x16b833){_0x1c186a=_0x16b833[_0xc6ab('0x5b')];if(!_0x51e7d3[_0xc6ab('0x48')][_0xc6ab('0x6c')]('nolimit')){_0x2acd69[_0xc6ab('0x34')]=qs['limit'](_0x51e7d3[_0xc6ab('0x48')][_0xc6ab('0x34')]);_0x2acd69[_0xc6ab('0x32')]=qs[_0xc6ab('0x32')](_0x51e7d3[_0xc6ab('0x48')][_0xc6ab('0x32')]);}return _0x33a288['getAgents'](_0x2acd69);}})[_0xc6ab('0x24')](function(_0x3e7b66){if(_0x3e7b66){return _0x3e7b66?{'count':_0x1c186a,'rows':_0x3e7b66}:null;}})['then'](respondWithResult(_0x217dba,null))[_0xc6ab('0x5e')](handleError(_0x217dba,null));}; \ No newline at end of file +var _0x0411=['context','exten','type','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','minrate','modem','FAXOPT(','Wait','ReceiveFax','VoiceExtension','bulkCreate','updateAccountApplications','tech','key','createdAt','TrunkId','findById','$gte','format','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','FaxAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x0411,0x1a5));var _0x1041=function(_0x57f590,_0x31e929){_0x57f590=_0x57f590-0x0;var _0x3181dd=_0x0411[_0x57f590];return _0x3181dd;};'use strict';var emlformat=require(_0x1041('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1041('0x1'));var jsonpatch=require(_0x1041('0x2'));var rp=require(_0x1041('0x3'));var moment=require(_0x1041('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1041('0x5'));var util=require(_0x1041('0x6'));var path=require('path');var sox=require(_0x1041('0x7'));var csv=require('to-csv');var ejs=require(_0x1041('0x8'));var fs=require('fs');var fs_extra=require(_0x1041('0x9'));var _=require(_0x1041('0xa'));var squel=require(_0x1041('0xb'));var crypto=require(_0x1041('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1041('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1041('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1041('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1041('0x10'));var utils=require(_0x1041('0x11'));var config=require(_0x1041('0x12'));var licenseUtil=require(_0x1041('0x13'));var db=require('../../mysqldb')['db'];config[_0x1041('0x14')]=_['defaults'](config[_0x1041('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x1041('0x15'))(new Redis(config['redis']));require(_0x1041('0x16'))[_0x1041('0x17')](socket);var jayson=require(_0x1041('0x18'));var client=jayson[_0x1041('0x19')][_0x1041('0x1a')]({'port':0x232c});var client9002=jayson[_0x1041('0x19')][_0x1041('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x14bbe,_0x2b2622,_0x43c589,_0x3beddd){return new BPromise(function(_0x312768,_0x4c1f51){var _0x118cd0=_0x3beddd||client;return _0x118cd0['request'](_0x14bbe,_0x43c589)[_0x1041('0x1b')](function(_0x56479f){logger[_0x1041('0x1c')](_0x1041('0x1d'),_0x2b2622,_0x1041('0x1e'));logger['debug'](_0x1041('0x1f'),_0x2b2622,'request\x20sent',JSON[_0x1041('0x20')](_0x56479f));if(_0x56479f['error']){if(_0x56479f['error'][_0x1041('0x21')]===0x1f4){logger[_0x1041('0x22')](_0x1041('0x1d'),_0x2b2622,_0x56479f[_0x1041('0x22')][_0x1041('0x23')]);return _0x4c1f51(_0x56479f[_0x1041('0x22')][_0x1041('0x23')]);}logger[_0x1041('0x22')](_0x1041('0x1d'),_0x2b2622,_0x56479f['error'][_0x1041('0x23')]);return _0x312768(_0x56479f[_0x1041('0x22')][_0x1041('0x23')]);}else{logger[_0x1041('0x1c')](_0x1041('0x1d'),_0x2b2622,_0x1041('0x1e'));_0x312768(_0x56479f['result'][_0x1041('0x23')]);}})[_0x1041('0x24')](function(_0x4d243e){logger[_0x1041('0x22')](_0x1041('0x1d'),_0x2b2622,_0x4d243e);_0x4c1f51(_0x4d243e);});});}function respondWithStatusCode(_0x2811d5,_0x62a3ae){_0x62a3ae=_0x62a3ae||0xcc;return function(_0x2fa61d){if(_0x2fa61d){return _0x2811d5[_0x1041('0x25')](_0x62a3ae);}return _0x2811d5[_0x1041('0x26')](_0x62a3ae)[_0x1041('0x27')]();};}function respondWithResult(_0x6e4e90,_0x1d0c06){_0x1d0c06=_0x1d0c06||0xc8;return function(_0x256272){if(_0x256272){return _0x6e4e90['status'](_0x1d0c06)['json'](_0x256272);}};}function respondWithFilteredResult(_0x5062b9,_0x4a3f06){return function(_0x10c2b1){if(_0x10c2b1){var _0x390485=typeof _0x4a3f06[_0x1041('0x28')]===_0x1041('0x29')&&typeof _0x4a3f06[_0x1041('0x2a')]===_0x1041('0x29');var _0x279353=_0x10c2b1[_0x1041('0x2b')];var _0x1b3094=_0x390485?0x0:_0x4a3f06['offset'];var _0x20eefc=_0x390485?_0x10c2b1[_0x1041('0x2b')]:_0x4a3f06[_0x1041('0x28')]+_0x4a3f06['limit'];var _0x176980;if(_0x20eefc>=_0x279353){_0x20eefc=_0x279353;_0x176980=0xc8;}else{_0x176980=0xce;}_0x5062b9[_0x1041('0x26')](_0x176980);return _0x5062b9['set'](_0x1041('0x2c'),_0x1b3094+'-'+_0x20eefc+'/'+_0x279353)[_0x1041('0x2d')](_0x10c2b1);}return null;};}function patchUpdates(_0x138518){return function(_0x1bf2f8){try{jsonpatch[_0x1041('0x2e')](_0x1bf2f8,_0x138518,!![]);}catch(_0x1e522e){return BPromise['reject'](_0x1e522e);}return _0x1bf2f8['save']();};}function saveUpdates(_0x546eec,_0x4e445e){return function(_0x416db8){if(_0x416db8){return _0x416db8['update'](_0x546eec)[_0x1041('0x1b')](function(_0x3d28b3){return _0x3d28b3;});}return null;};}function removeEntity(_0x38b7a0,_0x10bcfd){return function(_0x4f64e0){if(_0x4f64e0){return _0x4f64e0['destroy']()['then'](function(){var _0x22f780=_0x4f64e0['get']({'plain':!![]});var _0x15f775=_0x1041('0x2f');return db[_0x1041('0x30')][_0x1041('0x31')]({'where':{'type':_0x15f775,'resourceId':_0x22f780['id']}})[_0x1041('0x1b')](function(){return _0x4f64e0;});})[_0x1041('0x1b')](function(){_0x38b7a0[_0x1041('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x499b1f,_0x5f4081){return function(_0x34a930){if(!_0x34a930){_0x499b1f[_0x1041('0x25')](0x194);}return _0x34a930;};}function handleError(_0x4184e5,_0x5a74cc){_0x5a74cc=_0x5a74cc||0x1f4;return function(_0x1dc64c){logger[_0x1041('0x22')](_0x1dc64c[_0x1041('0x32')]);if(_0x1dc64c[_0x1041('0x33')]){delete _0x1dc64c[_0x1041('0x33')];}_0x4184e5['status'](_0x5a74cc)[_0x1041('0x34')](_0x1dc64c);};}exports['index']=function(_0xf2471,_0x54252e){var _0x47649e={'include':[{'model':db[_0x1041('0x35')],'as':_0x1041('0x36')}]},_0x46524b={},_0x265738={'count':0x0,'rows':[]};var _0x346cf9=_[_0x1041('0x37')](db[_0x1041('0x38')][_0x1041('0x39')],function(_0x30cdf4){return{'name':_0x30cdf4[_0x1041('0x3a')],'type':_0x30cdf4['type']['key']};});_0x46524b['model']=_[_0x1041('0x37')](_0x346cf9,'name');_0x46524b[_0x1041('0x3b')]=_[_0x1041('0x3c')](_0xf2471['query']);_0x46524b[_0x1041('0x3d')]=_[_0x1041('0x3e')](_0x46524b[_0x1041('0x3f')],_0x46524b[_0x1041('0x3b')]);_0x47649e['attributes']=_[_0x1041('0x3e')](_0x46524b[_0x1041('0x3f')],qs['fields'](_0xf2471[_0x1041('0x3b')][_0x1041('0x40')]));_0x47649e[_0x1041('0x41')]=_0x47649e[_0x1041('0x41')][_0x1041('0x42')]?_0x47649e[_0x1041('0x41')]:_0x46524b['model'];if(!_0xf2471['query']['hasOwnProperty'](_0x1041('0x43'))){_0x47649e[_0x1041('0x2a')]=qs[_0x1041('0x2a')](_0xf2471['query']['limit']);_0x47649e['offset']=qs[_0x1041('0x28')](_0xf2471[_0x1041('0x3b')][_0x1041('0x28')]);}_0x47649e[_0x1041('0x44')]=qs[_0x1041('0x45')](_0xf2471[_0x1041('0x3b')][_0x1041('0x45')]);_0x47649e[_0x1041('0x46')]=qs[_0x1041('0x3d')](_[_0x1041('0x47')](_0xf2471[_0x1041('0x3b')],_0x46524b[_0x1041('0x3d')]),_0x346cf9);if(_0xf2471[_0x1041('0x3b')][_0x1041('0x48')]){_0x47649e[_0x1041('0x46')]=_[_0x1041('0x49')](_0x47649e['where'],{'$or':_[_0x1041('0x37')](_0x346cf9,function(_0x100a50){if(_0x100a50['type']!==_0x1041('0x4a')){var _0x2e9dab={};_0x2e9dab[_0x100a50[_0x1041('0x33')]]={'$like':'%'+_0xf2471[_0x1041('0x3b')]['filter']+'%'};return _0x2e9dab;}})});}_0x47649e=_[_0x1041('0x49')]({},_0x47649e,_0xf2471[_0x1041('0x4b')]);var _0x91694a={'where':_0x47649e['where']};return db[_0x1041('0x38')][_0x1041('0x2b')](_0x91694a)[_0x1041('0x1b')](function(_0x41bbaf){_0x265738[_0x1041('0x2b')]=_0x41bbaf;if(_0xf2471['query'][_0x1041('0x4c')]){_0x47649e[_0x1041('0x4d')]=[{'all':!![]}];}return db[_0x1041('0x38')][_0x1041('0x4e')](_0x47649e);})[_0x1041('0x1b')](function(_0x1b93e8){_0x265738[_0x1041('0x4f')]=_0x1b93e8;return _0x265738;})[_0x1041('0x1b')](respondWithFilteredResult(_0x54252e,_0x47649e))[_0x1041('0x24')](handleError(_0x54252e,null));};exports['show']=function(_0x3efe65,_0x31b7ae){var _0x29353d={'raw':![],'where':{'id':_0x3efe65[_0x1041('0x50')]['id']},'include':[{'model':db[_0x1041('0x35')],'as':_0x1041('0x36')}]},_0x170d0a={};_0x170d0a[_0x1041('0x3f')]=_[_0x1041('0x3c')](db[_0x1041('0x38')]['rawAttributes']);_0x170d0a[_0x1041('0x3b')]=_['keys'](_0x3efe65[_0x1041('0x3b')]);_0x170d0a[_0x1041('0x3d')]=_[_0x1041('0x3e')](_0x170d0a[_0x1041('0x3f')],_0x170d0a[_0x1041('0x3b')]);_0x29353d[_0x1041('0x41')]=_['intersection'](_0x170d0a[_0x1041('0x3f')],qs['fields'](_0x3efe65[_0x1041('0x3b')][_0x1041('0x40')]));_0x29353d[_0x1041('0x41')]=_0x29353d[_0x1041('0x41')]['length']?_0x29353d['attributes']:_0x170d0a[_0x1041('0x3f')];if(_0x3efe65[_0x1041('0x3b')]['includeAll']){_0x29353d[_0x1041('0x4d')]=[{'all':!![]}];}_0x29353d=_[_0x1041('0x49')]({},_0x29353d,_0x3efe65['options']);return db[_0x1041('0x38')][_0x1041('0x51')](_0x29353d)[_0x1041('0x1b')](handleEntityNotFound(_0x31b7ae,null))[_0x1041('0x1b')](respondWithResult(_0x31b7ae,null))[_0x1041('0x24')](handleError(_0x31b7ae,null));};exports['create']=function(_0x49e4cd,_0x142007){return db['FaxAccount'][_0x1041('0x52')](_0x49e4cd[_0x1041('0x53')],{})[_0x1041('0x1b')](function(_0x456368){var _0x59b01c=_0x49e4cd[_0x1041('0x54')][_0x1041('0x55')]({'plain':!![]});if(!_0x59b01c)throw new Error(_0x1041('0x56'));if(_0x59b01c[_0x1041('0x57')]==='user'){var _0x275b26=_0x456368[_0x1041('0x55')]({'plain':!![]});var _0x5e9827=_0x1041('0x2f');return db[_0x1041('0x58')][_0x1041('0x51')]({'where':{'name':_0x5e9827,'userProfileId':_0x59b01c[_0x1041('0x59')]},'raw':!![]})['then'](function(_0x135111){if(_0x135111&&_0x135111[_0x1041('0x5a')]===0x0){return db[_0x1041('0x30')]['create']({'name':_0x275b26[_0x1041('0x33')],'resourceId':_0x275b26['id'],'type':_0x135111['name'],'sectionId':_0x135111['id']},{})[_0x1041('0x1b')](function(){return _0x456368;});}else{return _0x456368;}})[_0x1041('0x24')](function(_0x3ab732){logger[_0x1041('0x22')](_0x1041('0x5b'),_0x3ab732);throw _0x3ab732;});}return _0x456368;})[_0x1041('0x1b')](respondWithResult(_0x142007,0xc9))[_0x1041('0x24')](handleError(_0x142007,null));};exports[_0x1041('0x5c')]=function(_0x12134c,_0xd72355){if(_0x12134c[_0x1041('0x53')]['id']){delete _0x12134c['body']['id'];}return db['FaxAccount'][_0x1041('0x51')]({'where':{'id':_0x12134c[_0x1041('0x50')]['id']},'include':[{'model':db[_0x1041('0x35')],'as':_0x1041('0x36')}]})[_0x1041('0x1b')](handleEntityNotFound(_0xd72355,null))['then'](saveUpdates(_0x12134c[_0x1041('0x53')],null))[_0x1041('0x1b')](respondWithResult(_0xd72355,null))[_0x1041('0x24')](handleError(_0xd72355,null));};exports[_0x1041('0x31')]=function(_0x349d63,_0x90a87){return db[_0x1041('0x38')][_0x1041('0x51')]({'where':{'id':_0x349d63[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x90a87,null))[_0x1041('0x1b')](removeEntity(_0x90a87,null))[_0x1041('0x24')](handleError(_0x90a87,null));};exports[_0x1041('0x5d')]=function(_0x3592c0,_0x448f93){return db['FaxAccount'][_0x1041('0x5d')]()['then'](respondWithResult(_0x448f93,null))[_0x1041('0x24')](handleError(_0x448f93,null));};exports[_0x1041('0x5e')]=function(_0x185aa5,_0x47fddc,_0x365b10){if(_0x185aa5[_0x1041('0x53')]['id']){delete _0x185aa5['body']['id'];}return db[_0x1041('0x38')]['find']({'where':{'id':_0x185aa5['params']['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x47fddc,null))['then'](function(_0x5030dc){if(_0x5030dc){_0x185aa5['body'][_0x1041('0x5f')]=_0x5030dc['id'];return db[_0x1041('0x60')]['create'](_0x185aa5[_0x1041('0x53')]);}})[_0x1041('0x1b')](respondWithResult(_0x47fddc,null))[_0x1041('0x24')](handleError(_0x47fddc,null));};exports[_0x1041('0x61')]=function(_0x46dc03,_0x534c91,_0x5aefb8){var _0x21a375={'raw':![],'where':{}};var _0x35694a={};var _0x662087={'count':0x0,'rows':[]};return db[_0x1041('0x38')][_0x1041('0x62')]({'where':{'id':_0x46dc03[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x534c91,null))[_0x1041('0x1b')](function(_0x29ee20){if(_0x29ee20){_0x35694a['model']=_['keys'](db[_0x1041('0x60')][_0x1041('0x39')]);_0x35694a[_0x1041('0x3b')]=_[_0x1041('0x3c')](_0x46dc03[_0x1041('0x3b')]);_0x35694a[_0x1041('0x3d')]=_[_0x1041('0x3e')](_0x35694a[_0x1041('0x3f')],_0x35694a[_0x1041('0x3b')]);_0x21a375[_0x1041('0x41')]=_[_0x1041('0x3e')](_0x35694a[_0x1041('0x3f')],qs['fields'](_0x46dc03[_0x1041('0x3b')][_0x1041('0x40')]));_0x21a375[_0x1041('0x41')]=_0x21a375[_0x1041('0x41')][_0x1041('0x42')]?_0x21a375[_0x1041('0x41')]:_0x35694a[_0x1041('0x3f')];if(!_0x46dc03[_0x1041('0x3b')][_0x1041('0x63')](_0x1041('0x43'))){_0x21a375[_0x1041('0x2a')]=qs['limit'](_0x46dc03[_0x1041('0x3b')][_0x1041('0x2a')]);_0x21a375[_0x1041('0x28')]=qs['offset'](_0x46dc03[_0x1041('0x3b')][_0x1041('0x28')]);}_0x21a375['order']=qs['sort'](_0x46dc03[_0x1041('0x3b')][_0x1041('0x45')]);_0x21a375[_0x1041('0x46')]=qs['filters'](_['pick'](_0x46dc03[_0x1041('0x3b')],_0x35694a[_0x1041('0x3d')]));_0x21a375[_0x1041('0x46')]['FaxAccountId']=_0x29ee20['id'];if(_0x46dc03[_0x1041('0x3b')][_0x1041('0x48')]){_0x21a375[_0x1041('0x46')]=_[_0x1041('0x49')](_0x21a375[_0x1041('0x46')],{'$or':_[_0x1041('0x37')](_0x21a375['attributes'],function(_0x18b084){var _0x4e9bef={};_0x4e9bef[_0x18b084]={'$like':'%'+_0x46dc03[_0x1041('0x3b')]['filter']+'%'};return _0x4e9bef;})});}_0x21a375=_[_0x1041('0x49')]({},_0x21a375,_0x46dc03[_0x1041('0x4b')]);return db[_0x1041('0x60')][_0x1041('0x2b')]({'where':_0x21a375[_0x1041('0x46')]})[_0x1041('0x1b')](function(_0x5718d4){_0x662087[_0x1041('0x2b')]=_0x5718d4;if(_0x46dc03[_0x1041('0x3b')][_0x1041('0x4c')]){_0x21a375[_0x1041('0x4d')]=[{'all':!![]}];}return db[_0x1041('0x60')][_0x1041('0x4e')](_0x21a375);})[_0x1041('0x1b')](function(_0x4ed72d){_0x662087['rows']=_0x4ed72d;return _0x662087;});}})[_0x1041('0x1b')](respondWithFilteredResult(_0x534c91,_0x21a375))[_0x1041('0x24')](handleError(_0x534c91,null));};exports[_0x1041('0x64')]=function(_0x2f3b4e,_0x1e5b7,_0xfb94cf){return db[_0x1041('0x38')][_0x1041('0x51')]({'where':{'id':_0x2f3b4e[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x1e5b7,null))[_0x1041('0x1b')](function(_0x3ead90){if(_0x3ead90){return _0x3ead90['removeDispositions'](_0x2f3b4e['query'][_0x1041('0x65')]);}})[_0x1041('0x1b')](respondWithStatusCode(_0x1e5b7,null))['catch'](handleError(_0x1e5b7,null));};exports[_0x1041('0x66')]=function(_0x3e753b,_0x31cbc9,_0x4e4209){if(_0x3e753b[_0x1041('0x53')]['id']){delete _0x3e753b[_0x1041('0x53')]['id'];}return db[_0x1041('0x38')][_0x1041('0x51')]({'where':{'id':_0x3e753b['params']['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x31cbc9,null))[_0x1041('0x1b')](function(_0x2da363){if(_0x2da363){_0x3e753b['body'][_0x1041('0x5f')]=_0x2da363['id'];return db['CannedAnswer'][_0x1041('0x52')](_0x3e753b[_0x1041('0x53')]);}})['then'](respondWithResult(_0x31cbc9,null))[_0x1041('0x24')](handleError(_0x31cbc9,null));};exports[_0x1041('0x67')]=function(_0x5eacaa,_0x54fcbb,_0x347d01){var _0xab8183={'raw':![],'where':{}};var _0x553661={};var _0x1b9bbe={'count':0x0,'rows':[]};return db[_0x1041('0x38')][_0x1041('0x62')]({'where':{'id':_0x5eacaa[_0x1041('0x50')]['id']}})['then'](handleEntityNotFound(_0x54fcbb,null))[_0x1041('0x1b')](function(_0x40fc83){if(_0x40fc83){_0x553661[_0x1041('0x3f')]=_['keys'](db[_0x1041('0x68')][_0x1041('0x39')]);_0x553661[_0x1041('0x3b')]=_[_0x1041('0x3c')](_0x5eacaa[_0x1041('0x3b')]);_0x553661['filters']=_[_0x1041('0x3e')](_0x553661[_0x1041('0x3f')],_0x553661['query']);_0xab8183[_0x1041('0x41')]=_[_0x1041('0x3e')](_0x553661['model'],qs[_0x1041('0x40')](_0x5eacaa['query'][_0x1041('0x40')]));_0xab8183[_0x1041('0x41')]=_0xab8183[_0x1041('0x41')][_0x1041('0x42')]?_0xab8183[_0x1041('0x41')]:_0x553661['model'];if(!_0x5eacaa['query'][_0x1041('0x63')](_0x1041('0x43'))){_0xab8183[_0x1041('0x2a')]=qs[_0x1041('0x2a')](_0x5eacaa[_0x1041('0x3b')][_0x1041('0x2a')]);_0xab8183[_0x1041('0x28')]=qs[_0x1041('0x28')](_0x5eacaa[_0x1041('0x3b')]['offset']);}_0xab8183[_0x1041('0x44')]=qs['sort'](_0x5eacaa[_0x1041('0x3b')][_0x1041('0x45')]);_0xab8183[_0x1041('0x46')]=qs[_0x1041('0x3d')](_['pick'](_0x5eacaa[_0x1041('0x3b')],_0x553661[_0x1041('0x3d')]));_0xab8183[_0x1041('0x46')][_0x1041('0x5f')]=_0x40fc83['id'];if(_0x5eacaa[_0x1041('0x3b')]['filter']){_0xab8183[_0x1041('0x46')]=_['merge'](_0xab8183[_0x1041('0x46')],{'$or':_[_0x1041('0x37')](_0xab8183[_0x1041('0x41')],function(_0x310e5d){var _0x46978a={};_0x46978a[_0x310e5d]={'$like':'%'+_0x5eacaa[_0x1041('0x3b')][_0x1041('0x48')]+'%'};return _0x46978a;})});}_0xab8183=_[_0x1041('0x49')]({},_0xab8183,_0x5eacaa[_0x1041('0x4b')]);return db['CannedAnswer']['count']({'where':_0xab8183[_0x1041('0x46')]})['then'](function(_0x576ac8){_0x1b9bbe[_0x1041('0x2b')]=_0x576ac8;if(_0x5eacaa[_0x1041('0x3b')]['includeAll']){_0xab8183[_0x1041('0x4d')]=[{'all':!![]}];}return db[_0x1041('0x68')][_0x1041('0x4e')](_0xab8183);})[_0x1041('0x1b')](function(_0x2fee9e){_0x1b9bbe[_0x1041('0x4f')]=_0x2fee9e;return _0x1b9bbe;});}})[_0x1041('0x1b')](respondWithFilteredResult(_0x54fcbb,_0xab8183))[_0x1041('0x24')](handleError(_0x54fcbb,null));};exports[_0x1041('0x69')]=function(_0x4ff2a3,_0x36a3d1,_0x11d2bc){return db['FaxAccount'][_0x1041('0x51')]({'where':{'id':_0x4ff2a3[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x36a3d1,null))[_0x1041('0x1b')](function(_0xdb35fd){if(_0xdb35fd){return _0xdb35fd['removeAnswers'](_0x4ff2a3[_0x1041('0x3b')][_0x1041('0x65')]);}})[_0x1041('0x1b')](respondWithStatusCode(_0x36a3d1,null))[_0x1041('0x24')](handleError(_0x36a3d1,null));};exports[_0x1041('0x6a')]=function(_0xcfc14a,_0x4c668f,_0x34852b){return db[_0x1041('0x6b')][_0x1041('0x51')]({'where':{'id':_0xcfc14a[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x4c668f,null))['then'](function(_0x489c7a){if(_0x489c7a){return _0x489c7a['addInteraction'](_0xcfc14a[_0x1041('0x53')][_0x1041('0x65')],_[_0x1041('0x6c')](_0xcfc14a['body'],[_0x1041('0x65'),'id'])||{});}})[_0x1041('0x1b')](respondWithResult(_0x4c668f,null))[_0x1041('0x24')](handleError(_0x4c668f,null));};exports[_0x1041('0x6d')]=function(_0x58d8c8,_0x502a91,_0xc04118){var _0x4c1837={'raw':![],'where':{}};var _0x2387f1={};var _0x19459={'count':0x0,'rows':[]};return db[_0x1041('0x38')][_0x1041('0x62')]({'where':{'id':_0x58d8c8[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x502a91,null))['then'](function(_0x2fc989){if(_0x2fc989){_0x2387f1[_0x1041('0x3f')]=_['keys'](db[_0x1041('0x6b')][_0x1041('0x39')]);_0x2387f1[_0x1041('0x3b')]=_[_0x1041('0x3c')](_0x58d8c8[_0x1041('0x3b')]);_0x2387f1['filters']=_[_0x1041('0x3e')](_0x2387f1[_0x1041('0x3f')],_0x2387f1[_0x1041('0x3b')]);_0x4c1837[_0x1041('0x41')]=_[_0x1041('0x3e')](_0x2387f1[_0x1041('0x3f')],qs['fields'](_0x58d8c8[_0x1041('0x3b')][_0x1041('0x40')]));_0x4c1837[_0x1041('0x41')]=_0x4c1837[_0x1041('0x41')][_0x1041('0x42')]?_0x4c1837[_0x1041('0x41')]:_0x2387f1['model'];if(!_0x58d8c8[_0x1041('0x3b')][_0x1041('0x63')](_0x1041('0x43'))){_0x4c1837[_0x1041('0x2a')]=qs['limit'](_0x58d8c8['query'][_0x1041('0x2a')]);_0x4c1837[_0x1041('0x28')]=qs[_0x1041('0x28')](_0x58d8c8['query'][_0x1041('0x28')]);}_0x4c1837[_0x1041('0x44')]=qs[_0x1041('0x45')](_0x58d8c8[_0x1041('0x3b')][_0x1041('0x45')]);_0x4c1837[_0x1041('0x46')]=qs[_0x1041('0x3d')](_[_0x1041('0x47')](_0x58d8c8[_0x1041('0x3b')],_0x2387f1[_0x1041('0x3d')]));_0x4c1837[_0x1041('0x46')][_0x1041('0x5f')]=_0x2fc989['id'];if(_0x58d8c8['query'][_0x1041('0x48')]){_0x4c1837[_0x1041('0x46')]=_[_0x1041('0x49')](_0x4c1837[_0x1041('0x46')],{'$or':_[_0x1041('0x37')](_0x4c1837[_0x1041('0x41')],function(_0x37ae04){var _0x22d320={};_0x22d320[_0x37ae04]={'$like':'%'+_0x58d8c8[_0x1041('0x3b')][_0x1041('0x48')]+'%'};return _0x22d320;})});}_0x4c1837=_['merge']({},_0x4c1837,_0x58d8c8[_0x1041('0x4b')]);return db[_0x1041('0x6b')]['count']({'where':_0x4c1837[_0x1041('0x46')]})[_0x1041('0x1b')](function(_0x3935b6){_0x19459['count']=_0x3935b6;if(_0x58d8c8[_0x1041('0x3b')][_0x1041('0x4c')]){_0x4c1837[_0x1041('0x4d')]=[{'model':db[_0x1041('0x6e')],'as':_0x1041('0x6f'),'required':![]},{'model':db[_0x1041('0x70')],'as':'Owner','attributes':[_0x1041('0x33'),_0x1041('0x71'),'internal'],'required':![]},{'model':db[_0x1041('0x72')],'as':_0x1041('0x73'),'attributes':['id',_0x1041('0x33'),_0x1041('0x74')],'where':_0x58d8c8[_0x1041('0x3b')][_0x1041('0x75')]?{'id':_0x58d8c8[_0x1041('0x3b')][_0x1041('0x75')]}:undefined,'required':_0x58d8c8[_0x1041('0x3b')][_0x1041('0x75')]?!![]:![]}];}return db[_0x1041('0x6b')][_0x1041('0x4e')](_0x4c1837);})[_0x1041('0x1b')](function(_0x32687e){_0x19459['rows']=_0x32687e;return _0x19459;});}})[_0x1041('0x1b')](respondWithFilteredResult(_0x502a91,_0x4c1837))[_0x1041('0x24')](handleError(_0x502a91,null));};exports[_0x1041('0x76')]=function(_0x34b058,_0x2cc912,_0x4df3e0){return db[_0x1041('0x38')][_0x1041('0x62')]({'where':{'id':_0x34b058[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x2cc912,null))['then'](function(_0x40c364){if(_0x40c364){return db[_0x1041('0x77')][_0x1041('0x78')](function(_0x5baff4){return db[_0x1041('0x79')][_0x1041('0x31')]({'where':{'FaxAccountId':_0x34b058[_0x1041('0x50')]['id']},'transaction':_0x5baff4})['then'](function(_0x5b4136){var _0x42901e=_[_0x1041('0x37')](_0x34b058['body'],function(_0xe8aac3){_0xe8aac3[_0x1041('0x5f')]=_0x34b058[_0x1041('0x50')]['id'];return _0xe8aac3;});return db[_0x1041('0x79')]['bulkCreate'](_0x42901e,{'transaction':_0x5baff4});});})[_0x1041('0x1b')](function(){return db['FaxApplication'][_0x1041('0x7a')]({'where':{'FaxAccountId':_0x34b058['params']['id']},'order':_0x1041('0x7b')});});}})[_0x1041('0x1b')](respondWithResult(_0x2cc912,null))[_0x1041('0x24')](handleError(_0x2cc912,null));};exports[_0x1041('0x7c')]=function(_0x55a418,_0x3e46f8,_0x59e417){var _0x5a59d7={};var _0xbeda56={};var _0x4d0aec;var _0x5f5516;return db['FaxAccount'][_0x1041('0x62')]({'where':{'id':_0x55a418[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x3e46f8,null))['then'](function(_0x476deb){if(_0x476deb){_0x4d0aec=_0x476deb;_0xbeda56[_0x1041('0x3f')]=_['keys'](db['FaxApplication'][_0x1041('0x39')]);_0xbeda56['query']=_[_0x1041('0x3c')](_0x55a418[_0x1041('0x3b')]);_0xbeda56[_0x1041('0x3d')]=_['intersection'](_0xbeda56[_0x1041('0x3f')],_0xbeda56[_0x1041('0x3b')]);_0x5a59d7[_0x1041('0x41')]=_['intersection'](_0xbeda56[_0x1041('0x3f')],qs[_0x1041('0x40')](_0x55a418[_0x1041('0x3b')]['fields']));_0x5a59d7[_0x1041('0x41')]=_0x5a59d7[_0x1041('0x41')]['length']?_0x5a59d7[_0x1041('0x41')]:_0xbeda56[_0x1041('0x3f')];_0x5a59d7[_0x1041('0x44')]=qs['sort'](_0x55a418[_0x1041('0x3b')][_0x1041('0x45')]);_0x5a59d7[_0x1041('0x46')]=qs[_0x1041('0x3d')](_['pick'](_0x55a418[_0x1041('0x3b')],_0xbeda56[_0x1041('0x3d')]));if(_0x55a418['query'][_0x1041('0x48')]){_0x5a59d7['where']=_[_0x1041('0x49')](_0x5a59d7['where'],{'$or':_['map'](_0x5a59d7['attributes'],function(_0x336277){var _0x432f40={};_0x432f40[_0x336277]={'$like':'%'+_0x55a418[_0x1041('0x3b')][_0x1041('0x48')]+'%'};return _0x432f40;})});}_0x5a59d7=_['merge']({},_0x5a59d7,_0x55a418[_0x1041('0x4b')]);return _0x4d0aec[_0x1041('0x7c')](_0x5a59d7);}})['then'](function(_0x2a75c8){if(_0x2a75c8){_0x5f5516=_0x2a75c8[_0x1041('0x42')];if(!_0x55a418[_0x1041('0x3b')][_0x1041('0x63')](_0x1041('0x43'))){_0x5a59d7['limit']=qs[_0x1041('0x2a')](_0x55a418[_0x1041('0x3b')][_0x1041('0x2a')]);_0x5a59d7[_0x1041('0x28')]=qs[_0x1041('0x28')](_0x55a418[_0x1041('0x3b')][_0x1041('0x28')]);}return _0x4d0aec[_0x1041('0x7c')](_0x5a59d7);}})['then'](function(_0x6c2dbe){if(_0x6c2dbe){return _0x6c2dbe?{'count':_0x5f5516,'rows':_0x6c2dbe}:null;}})['then'](respondWithResult(_0x3e46f8,null))['catch'](handleError(_0x3e46f8,null));};function Extension(_0x3650b6,_0x2f36c4,_0x2fd64b,_0x98a5ec){this[_0x1041('0x7d')]='from-voip-provider';this[_0x1041('0x7e')]=_0x3650b6['localstationid'];this['app']=_0x98a5ec;this[_0x1041('0x7f')]='system';this['description']='Fax\x20Extension';this[_0x1041('0x5f')]=_0x3650b6['id'];this['priority']=_0x2f36c4;this[_0x1041('0x80')]=_0x2fd64b;}function createExtensionsReciveFax(_0x15a292){var _0x35bded=0x1;var _0x2def80=[];_0x2def80['push'](new Extension(_0x15a292,_0x35bded,'',_0x1041('0x81')));_0x35bded+=0x1;_0x2def80[_0x1041('0x82')](new Extension(_0x15a292,_0x35bded,_0x1041('0x83'),_0x1041('0x84')));_0x35bded+=0x1;for(var _0x24892d in _0x15a292){if(_0x15a292[_0x1041('0x63')](_0x24892d)&&(_0x24892d===_0x1041('0x85')||_0x24892d==='localstationid'||_0x24892d==='gateway'||_0x24892d===_0x1041('0x86')||_0x24892d==='headerinfo'||_0x24892d==='maxrate'||_0x24892d===_0x1041('0x87')||_0x24892d===_0x1041('0x88')||_0x24892d==='t38timeout')){_0x2def80['push'](new Extension(_0x15a292,_0x35bded,_0x1041('0x89')+_0x24892d+')='+_0x15a292[_0x24892d],'Set'));_0x35bded+=0x1;}}_0x2def80['push'](new Extension(_0x15a292,_0x35bded,'6',_0x1041('0x8a')));_0x35bded+=0x1;_0x2def80[_0x1041('0x82')](new Extension(_0x15a292,_0x35bded,'/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',_0x1041('0x8b')));_0x35bded=0x0;return _0x2def80;}exports['addAccountApplications']=function(_0x30aa8d,_0x2c3ecb,_0x23426e){var _0x2db9f8;return db[_0x1041('0x77')]['transaction'](function(_0x3db32d){return db[_0x1041('0x38')][_0x1041('0x52')](_0x30aa8d[_0x1041('0x53')],{'transaction':_0x3db32d})[_0x1041('0x1b')](function(_0x5ac3d5){_0x2db9f8=_0x5ac3d5[_0x1041('0x55')]({'plain':!![]});return db[_0x1041('0x8c')][_0x1041('0x8d')](createExtensionsReciveFax(_0x2db9f8),{'transaction':_0x3db32d});});})['then'](function(){return _0x2db9f8;})[_0x1041('0x1b')](respondWithResult(_0x2c3ecb,null))['catch'](handleError(_0x2c3ecb,null));};exports[_0x1041('0x8e')]=function(_0x5b5e1e,_0x16ea83,_0x932e1a){var _0x2a56a0;return db[_0x1041('0x77')][_0x1041('0x78')](function(_0x166ef4){return db['FaxAccount'][_0x1041('0x5c')](_0x5b5e1e[_0x1041('0x53')],{'where':{'id':_0x5b5e1e[_0x1041('0x53')]['id']},'transaction':_0x166ef4})[_0x1041('0x1b')](function(_0x59cd4d){return db['VoiceExtension'][_0x1041('0x31')]({'where':{'FaxAccountId':_0x5b5e1e[_0x1041('0x53')]['id']},'transaction':_0x166ef4})[_0x1041('0x1b')](function(_0x643cd5){return db['VoiceExtension'][_0x1041('0x8d')](createExtensionsReciveFax(_[_0x1041('0x6c')](_0x5b5e1e[_0x1041('0x53')],[_0x1041('0x8f'),_0x1041('0x90'),_0x1041('0x91'),'updatedAt',_0x1041('0x92'),'ListId'])),{'transaction':_0x166ef4});});});})[_0x1041('0x1b')](function(){return db[_0x1041('0x38')][_0x1041('0x93')](_0x5b5e1e['body']['id']);})[_0x1041('0x1b')](respondWithResult(_0x16ea83,null))[_0x1041('0x24')](handleError(_0x16ea83,null));};exports['getMessages']=function(_0x493a8f,_0x14565b,_0x301659){var _0x52c534={'raw':!![],'where':{}};var _0x3141f3={};var _0x4f2fe3={'count':0x0,'rows':[]};return db[_0x1041('0x38')][_0x1041('0x62')]({'where':{'id':_0x493a8f['params']['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x14565b,null))['then'](function(_0x42c7c3){if(_0x42c7c3){_0x3141f3[_0x1041('0x3f')]=_[_0x1041('0x3c')](db['FaxMessage'][_0x1041('0x39')]);_0x3141f3['query']=_['keys'](_0x493a8f[_0x1041('0x3b')]);_0x3141f3['filters']=_[_0x1041('0x3e')](_0x3141f3[_0x1041('0x3f')],_0x3141f3[_0x1041('0x3b')]);_0x52c534[_0x1041('0x41')]=_[_0x1041('0x3e')](_0x3141f3['model'],qs[_0x1041('0x40')](_0x493a8f['query'][_0x1041('0x40')]));_0x52c534['attributes']=_0x52c534[_0x1041('0x41')][_0x1041('0x42')]?_0x52c534[_0x1041('0x41')]:_0x3141f3[_0x1041('0x3f')];if(!_0x493a8f[_0x1041('0x3b')][_0x1041('0x63')](_0x1041('0x43'))){_0x52c534['limit']=qs[_0x1041('0x2a')](_0x493a8f[_0x1041('0x3b')]['limit']);_0x52c534[_0x1041('0x28')]=qs[_0x1041('0x28')](_0x493a8f[_0x1041('0x3b')][_0x1041('0x28')]);}_0x52c534[_0x1041('0x44')]=qs[_0x1041('0x45')](_0x493a8f['query'][_0x1041('0x45')]);_0x52c534[_0x1041('0x46')]=qs['filters'](_[_0x1041('0x47')](_0x493a8f['query'],_0x3141f3[_0x1041('0x3d')]));_0x52c534['where'][_0x1041('0x5f')]=_0x42c7c3['id'];if(_0x493a8f[_0x1041('0x3b')][_0x1041('0x48')]){_0x52c534[_0x1041('0x46')]=_['merge'](_0x52c534['where'],{'$or':_[_0x1041('0x37')](_0x52c534[_0x1041('0x41')],function(_0x166749){var _0xad4ff0={};_0xad4ff0[_0x166749]={'$like':'%'+_0x493a8f['query'][_0x1041('0x48')]+'%'};return _0xad4ff0;})});}if(_0x493a8f[_0x1041('0x3b')][_0x1041('0x94')]){var _0x2513c6=_0x493a8f[_0x1041('0x3b')]['$gte']['split'](',');var _0x3e3fe1={};_0x3e3fe1[_0x2513c6[0x0]]={'$gte':moment(_0x2513c6[0x1])[_0x1041('0x95')]('YYYY-MM-DD\x20HH:mm:ss')};_0x52c534[_0x1041('0x46')]=_[_0x1041('0x49')](_0x52c534[_0x1041('0x46')],_0x3e3fe1);}_0x52c534=_[_0x1041('0x49')]({},_0x52c534,_0x493a8f[_0x1041('0x4b')]);return db[_0x1041('0x96')][_0x1041('0x2b')]({'where':_0x52c534[_0x1041('0x46')]})[_0x1041('0x1b')](function(_0x2be81b){_0x4f2fe3[_0x1041('0x2b')]=_0x2be81b;if(_0x493a8f['query'][_0x1041('0x4c')]){_0x52c534[_0x1041('0x4d')]=[{'all':!![]}];}return db[_0x1041('0x96')][_0x1041('0x4e')](_0x52c534);})[_0x1041('0x1b')](function(_0x435b5f){_0x4f2fe3[_0x1041('0x4f')]=_0x435b5f;return _0x4f2fe3;});}})['then'](respondWithFilteredResult(_0x14565b,_0x52c534))[_0x1041('0x24')](handleError(_0x14565b,null));};exports[_0x1041('0x34')]=function(_0xb13bad,_0x776510,_0x2f8809){var _0x5b3c3a,_0x19ca33={},_0x57607a;if(_0xb13bad['body']['to']){_0x57607a=_0xb13bad[_0x1041('0x53')]['to'][0x0];}return db[_0x1041('0x38')][_0x1041('0x51')]({'where':{'id':_0xb13bad[_0x1041('0x50')]['id']},'include':[{'model':db[_0x1041('0x97')],'as':_0x1041('0x98'),'include':[{'model':db[_0x1041('0x6e')],'as':_0x1041('0x99'),'where':{'fax':_0x57607a},'limit':0x1,'order':[['updatedAt',_0x1041('0x9a')]]}]}]})[_0x1041('0x1b')](handleEntityNotFound(_0x776510,null))['then'](function(_0x44644a){_0x5b3c3a=_0x44644a;if(_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')]&&_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][_0x1041('0x42')]){for(var _0x1e2930=0x0;_0x1e2930<_0xb13bad[_0x1041('0x53')]['attachments']['length'];_0x1e2930+=0x1){_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][_0x1e2930]={'filename':_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][_0x1e2930][_0x1041('0x33')],'id':_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][_0x1e2930]['id'],'path':path[_0x1041('0x9c')](config[_0x1041('0x9d')],_0x1041('0x9e'),_0xb13bad['body'][_0x1041('0x9b')][_0x1e2930][_0x1041('0x9f')])};}}return respondWithRpcPromise(_0x1041('0xa0'),_0x1041('0xa0'),{'FaxAccountId':_[_0x1041('0xa1')](_0xb13bad['params']['id'])?undefined:_0xb13bad[_0x1041('0x50')]['id'],'path':_[_0x1041('0xa1')](_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][0x0]['path'])?undefined:_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][0x0][_0x1041('0xa2')],'fax':_[_0x1041('0xa1')](_0xb13bad['body']['to'][0x0])?undefined:_0xb13bad[_0x1041('0x53')]['to'][0x0]},client9002);})[_0x1041('0x1b')](function(){if(_0x5b3c3a){if(_[_0x1041('0xa1')](_0xb13bad[_0x1041('0x53')]['from'])){_0xb13bad[_0x1041('0x53')][_0x1041('0xa3')]=util[_0x1041('0x95')](_0x1041('0xa4'),_0x5b3c3a['name'],_0x5b3c3a[_0x1041('0xa5')]);}if(_0x5b3c3a[_0x1041('0x98')]){if(_0x5b3c3a['List'][_0x1041('0x99')][_0x1041('0x42')]){return _0x5b3c3a[_0x1041('0x98')]['Contacts'][0x0];}else{return db['CmContact']['create'](_['defaults'](_0xb13bad[_0x1041('0x53')],{'firstName':_0xb13bad[_0x1041('0x53')]['to'][0x0],'phone':_0xb13bad[_0x1041('0x53')]['to'][0x0],'fax':_0xb13bad[_0x1041('0x53')]['to'][0x0],'ListId':_0x5b3c3a['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x1041('0xa6'));}})[_0x1041('0x1b')](function(_0x3535ac){if(_0x3535ac){return db[_0x1041('0x6b')][_0x1041('0x51')]({'where':{'ContactId':_0x3535ac['id'],'closed':![],'FaxAccountId':_0x5b3c3a['id']}})['then'](function(_0x242d11){if(_0x242d11){return[_0x242d11,![]];}return db['FaxInteraction'][_0x1041('0x52')]({'UserId':_0xb13bad[_0x1041('0x54')]['id'],'ContactId':_0x3535ac['id'],'FaxAccountId':_0x5b3c3a['id'],'fax':_0xb13bad['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x1041('0x49')](_0xb13bad[_0x1041('0x53')],{'read':![],'body':_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][0x0]['filename'],'FaxAccountId':_0x5b3c3a['id'],'UserId':_0xb13bad[_0x1041('0x54')]['id'],'ContactId':_0x3535ac['id'],'AttachmentId':_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1041('0xa7')}]})[_0x1041('0x1b')](function(_0x4f9cf6){return[_0x4f9cf6,!![]];});});}else{throw new Error(_0x1041('0xa8'));}})[_0x1041('0xa9')](function(_0x2cd047,_0x2ea4f7){if(_0x2ea4f7){return _0x2cd047;}return db['FaxMessage'][_0x1041('0x52')]({'direction':'out','read':![],'body':_0xb13bad[_0x1041('0x53')]['attachments'][0x0][_0x1041('0xaa')],'FaxAccountId':_0x5b3c3a['id'],'FaxInteractionId':_0x2cd047['id'],'UserId':_0xb13bad[_0x1041('0x54')]['id'],'ContactId':_0x2cd047[_0x1041('0xab')],'AttachmentId':_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][0x0]['id']})[_0x1041('0x1b')](function(_0x2a4726){_0x2cd047[_0x1041('0xac')]['Messages']=[];_0x2cd047[_0x1041('0xac')][_0x1041('0xa7')][_0x1041('0x82')](_0x2a4726['dataValues']);return _0x2cd047;});})['then'](function(_0x5aeb1e){respondWithRpcPromise(_0x1041('0xad'),_0x1041('0xad'),{'FaxAccountId':_['isNil'](_0xb13bad['params']['id'])?undefined:_0xb13bad[_0x1041('0x50')]['id'],'path':_[_0x1041('0xa1')](_0xb13bad['body'][_0x1041('0x9b')][0x0]['path'])?undefined:_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][0x0][_0x1041('0xa2')],'fax':_[_0x1041('0xa1')](_0xb13bad[_0x1041('0x53')]['to'][0x0])?undefined:_0xb13bad[_0x1041('0x53')]['to'][0x0],'AttachmentId':_0xb13bad[_0x1041('0x53')][_0x1041('0x9b')][0x0]['id']},client9002)[_0x1041('0x1b')](function(_0xc95b13){logger[_0x1041('0x1c')](_0x1041('0xae'),_0xc95b13);})[_0x1041('0x24')](function(_0x36c7ca){logger[_0x1041('0x1c')](_0x1041('0xae'),_0x36c7ca);});return _0x5aeb1e;})['then'](respondWithResult(_0x776510,null))[_0x1041('0x24')](handleError(_0x776510,null));};exports[_0x1041('0xaf')]=function(_0x4feca8,_0x5d14ec,_0x305dec){return db[_0x1041('0x38')][_0x1041('0x51')]({'where':{'id':_0x4feca8[_0x1041('0x50')]['id']}})['then'](handleEntityNotFound(_0x5d14ec,null))[_0x1041('0x1b')](function(_0x93cb6f){if(_0x93cb6f){return _0x93cb6f[_0x1041('0xaf')](_0x4feca8[_0x1041('0x53')][_0x1041('0x65')],_[_0x1041('0x6c')](_0x4feca8[_0x1041('0x53')],[_0x1041('0x65'),'id'])||{})['spread'](function(_0x2b2f0a){for(var _0x1286a8=0x0;_0x1286a8<_0x4feca8['body'][_0x1041('0x65')][_0x1041('0x42')];_0x1286a8+=0x1){socket[_0x1041('0xb0')](_0x1041('0xb1'),{'UserId':Number(_0x4feca8[_0x1041('0x53')][_0x1041('0x65')][_0x1286a8]),'FaxAccountId':Number(_0x4feca8[_0x1041('0x50')]['id'])});}return _0x2b2f0a;});}})[_0x1041('0x1b')](respondWithResult(_0x5d14ec,null))[_0x1041('0x24')](handleError(_0x5d14ec,null));};exports['removeAgents']=function(_0x387196,_0x3acc02,_0x420243){return db[_0x1041('0x38')][_0x1041('0x51')]({'where':{'id':_0x387196[_0x1041('0x50')]['id']}})[_0x1041('0x1b')](handleEntityNotFound(_0x3acc02,null))[_0x1041('0x1b')](function(_0x5e158d){if(_0x5e158d){return _0x5e158d[_0x1041('0xb2')](_0x387196[_0x1041('0x3b')][_0x1041('0x65')])[_0x1041('0x1b')](function(){if(_[_0x1041('0xb3')](_0x387196[_0x1041('0x3b')][_0x1041('0x65')])){for(var _0x191173=0x0;_0x191173<_0x387196[_0x1041('0x3b')][_0x1041('0x65')][_0x1041('0x42')];_0x191173+=0x1){socket[_0x1041('0xb0')](_0x1041('0xb4'),{'UserId':Number(_0x387196[_0x1041('0x3b')]['ids'][_0x191173]),'FaxAccountId':Number(_0x387196['params']['id'])});}}else{socket[_0x1041('0xb0')](_0x1041('0xb4'),{'UserId':Number(_0x387196[_0x1041('0x3b')]['ids']),'FaxAccountId':Number(_0x387196[_0x1041('0x50')]['id'])});}});}})[_0x1041('0x1b')](respondWithStatusCode(_0x3acc02,null))[_0x1041('0x24')](handleError(_0x3acc02,null));};exports['getAgents']=function(_0x3241f3,_0x1975ad,_0x344255){var _0x1aa1f2={};var _0x5aed3b={};var _0x562850;var _0x29e23e;return db[_0x1041('0x38')][_0x1041('0x62')]({'where':{'id':_0x3241f3[_0x1041('0x50')]['id']}})['then'](handleEntityNotFound(_0x1975ad,null))[_0x1041('0x1b')](function(_0x53854){if(_0x53854){_0x562850=_0x53854;_0x5aed3b[_0x1041('0x3f')]=_[_0x1041('0x3c')](db['User'][_0x1041('0x39')]);_0x5aed3b[_0x1041('0x3b')]=_['keys'](_0x3241f3[_0x1041('0x3b')]);_0x5aed3b[_0x1041('0x3d')]=_[_0x1041('0x3e')](_0x5aed3b[_0x1041('0x3f')],_0x5aed3b['query']);_0x1aa1f2[_0x1041('0x41')]=_['intersection'](_0x5aed3b['model'],qs['fields'](_0x3241f3[_0x1041('0x3b')][_0x1041('0x40')]));_0x1aa1f2['attributes']=_0x1aa1f2['attributes'][_0x1041('0x42')]?_0x1aa1f2[_0x1041('0x41')]:_0x5aed3b['model'];_0x1aa1f2[_0x1041('0x44')]=qs[_0x1041('0x45')](_0x3241f3['query'][_0x1041('0x45')]);_0x1aa1f2[_0x1041('0x46')]=qs[_0x1041('0x3d')](_[_0x1041('0x47')](_0x3241f3['query'],_0x5aed3b['filters']));if(_0x3241f3[_0x1041('0x3b')][_0x1041('0x48')]){_0x1aa1f2[_0x1041('0x46')]=_['merge'](_0x1aa1f2[_0x1041('0x46')],{'$or':_[_0x1041('0x37')](_0x1aa1f2['attributes'],function(_0x45b2bc){var _0x1337cc={};_0x1337cc[_0x45b2bc]={'$like':'%'+_0x3241f3[_0x1041('0x3b')]['filter']+'%'};return _0x1337cc;})});}_0x1aa1f2=_[_0x1041('0x49')]({},_0x1aa1f2,_0x3241f3['options']);return _0x562850[_0x1041('0xb5')](_0x1aa1f2);}})[_0x1041('0x1b')](function(_0x102db2){if(_0x102db2){_0x29e23e=_0x102db2[_0x1041('0x42')];if(!_0x3241f3[_0x1041('0x3b')][_0x1041('0x63')]('nolimit')){_0x1aa1f2[_0x1041('0x2a')]=qs[_0x1041('0x2a')](_0x3241f3[_0x1041('0x3b')][_0x1041('0x2a')]);_0x1aa1f2[_0x1041('0x28')]=qs[_0x1041('0x28')](_0x3241f3['query'][_0x1041('0x28')]);}return _0x562850['getAgents'](_0x1aa1f2);}})[_0x1041('0x1b')](function(_0x528903){if(_0x528903){return _0x528903?{'count':_0x29e23e,'rows':_0x528903}:null;}})[_0x1041('0x1b')](respondWithResult(_0x1975ad,null))['catch'](handleError(_0x1975ad,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a5ee055..4e71466 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 _0xf6bc=['emit','hasOwnProperty','../../mysqldb','FaxAccount','setMaxListeners','update'];(function(_0x5d6a07,_0x3e8dae){var _0x287d3b=function(_0x451ff6){while(--_0x451ff6){_0x5d6a07['push'](_0x5d6a07['shift']());}};_0x287d3b(++_0x3e8dae);}(_0xf6bc,0x188));var _0xcf6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6bc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xcf6b('0x0'))['db'][_0xcf6b('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcf6b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf6b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3da866){return function(_0x21ae57,_0x50ba5f,_0x3cc8f){FaxAccountEvents[_0xcf6b('0x4')](_0x3da866+':'+_0x21ae57['id'],_0x21ae57);FaxAccountEvents[_0xcf6b('0x4')](_0x3da866,_0x21ae57);_0x3cc8f(null);};}for(var e in events){if(events[_0xcf6b('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x001b=['events','../../mysqldb','FaxAccount','save','remove','emit','hasOwnProperty','hook'];(function(_0x42eb9a,_0x5ade90){var _0x4f36d0=function(_0x5c22ec){while(--_0x5c22ec){_0x42eb9a['push'](_0x42eb9a['shift']());}};_0x4f36d0(++_0x5ade90);}(_0x001b,0x118));var _0xb001=function(_0x2294b3,_0xf21835){_0x2294b3=_0x2294b3-0x0;var _0x1fc85d=_0x001b[_0x2294b3];return _0x1fc85d;};'use strict';var EventEmitter=require(_0xb001('0x0'));var FaxAccount=require(_0xb001('0x1'))['db'][_0xb001('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb001('0x3'),'afterUpdate':'update','afterDestroy':_0xb001('0x4')};function emitEvent(_0x3d5369){return function(_0x5a3757,_0xd7b7f7,_0x10b191){FaxAccountEvents[_0xb001('0x5')](_0x3d5369+':'+_0x5a3757['id'],_0x5a3757);FaxAccountEvents[_0xb001('0x5')](_0x3d5369,_0x5a3757);_0x10b191(null);};}for(var e in events){if(events[_0xb001('0x6')](e)){var event=events[e];FaxAccount[_0xb001('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index cc06d25..4d3304f 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 _0x428f=['../../config/environment','exports','define','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x428f,0x143));var _0xf428=function(_0x59dd0b,_0x2d01ff){_0x59dd0b=_0x59dd0b-0x0;var _0x582eca=_0x428f[_0x59dd0b];return _0x582eca;};'use strict';var _=require(_0xf428('0x0'));var util=require(_0xf428('0x1'));var logger=require('../../config/logger')(_0xf428('0x2'));var moment=require('moment');var BPromise=require(_0xf428('0x3'));var rp=require(_0xf428('0x4'));var fs=require('fs');var path=require(_0xf428('0x5'));var rimraf=require(_0xf428('0x6'));var config=require(_0xf428('0x7'));var attributes=require('./faxAccount.attributes');module[_0xf428('0x8')]=function(_0x186f0a,_0x1b20da){return _0x186f0a[_0xf428('0x9')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb34b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxAccount.attributes','exports','FaxAccount'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0xb34b,0xdc));var _0xbb34=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb34b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xbb34('0x0'));var logger=require(_0xbb34('0x1'))(_0xbb34('0x2'));var moment=require(_0xbb34('0x3'));var BPromise=require(_0xbb34('0x4'));var rp=require(_0xbb34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb34('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb34('0x7'));module[_0xbb34('0x8')]=function(_0x5c09b6,_0x3960bd){return _0x5c09b6['define'](_0xbb34('0x9'),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 32884e3..b5f7a57 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 _0xa5e7=['close','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','redis','defaults','localhost','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','options','raw','attributes','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','priority','length','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push'];(function(_0x4a09bf,_0x45b7c0){var _0x5cbad8=function(_0x28a15f){while(--_0x28a15f){_0x4a09bf['push'](_0x4a09bf['shift']());}};_0x5cbad8(++_0x45b7c0);}(_0xa5e7,0x159));var _0x7a5e=function(_0x3c7c5b,_0x6eeb7){_0x3c7c5b=_0x3c7c5b-0x0;var _0x5759fb=_0xa5e7[_0x3c7c5b];return _0x5759fb;};'use strict';var _=require(_0x7a5e('0x0'));var util=require('util');var moment=require(_0x7a5e('0x1'));var BPromise=require(_0x7a5e('0x2'));var rs=require(_0x7a5e('0x3'));var fs=require('fs');var Redis=require(_0x7a5e('0x4'));var db=require(_0x7a5e('0x5'))['db'];var utils=require(_0x7a5e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7a5e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config[_0x7a5e('0x8')]=_[_0x7a5e('0x9')](config['redis'],{'host':_0x7a5e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a5e('0x8')]));require('./faxAccount.socket')[_0x7a5e('0xb')](socket);function respondWithRpcPromise(_0x4634d1,_0xd3fffb,_0x2bf3d0){return new BPromise(function(_0x13329e,_0x4d7f24){return client[_0x7a5e('0xc')](_0x4634d1,_0x2bf3d0)[_0x7a5e('0xd')](function(_0x47fb66){logger[_0x7a5e('0xe')](_0x7a5e('0xf'),_0xd3fffb,_0x7a5e('0x10'));logger[_0x7a5e('0x11')](_0x7a5e('0x12'),_0xd3fffb,_0x7a5e('0x10'),JSON[_0x7a5e('0x13')](_0x47fb66));if(_0x47fb66['error']){if(_0x47fb66[_0x7a5e('0x14')][_0x7a5e('0x15')]===0x1f4){logger['error'](_0x7a5e('0xf'),_0xd3fffb,_0x47fb66[_0x7a5e('0x14')][_0x7a5e('0x16')]);return _0x4d7f24(_0x47fb66[_0x7a5e('0x14')]['message']);}logger['error'](_0x7a5e('0xf'),_0xd3fffb,_0x47fb66[_0x7a5e('0x14')][_0x7a5e('0x16')]);return _0x13329e(_0x47fb66[_0x7a5e('0x14')][_0x7a5e('0x16')]);}else{logger[_0x7a5e('0xe')](_0x7a5e('0xf'),_0xd3fffb,_0x7a5e('0x10'));_0x13329e(_0x47fb66[_0x7a5e('0x17')][_0x7a5e('0x16')]);}})['catch'](function(_0x3e4fe7){logger['error']('FaxAccount,\x20%s,\x20%s',_0xd3fffb,_0x3e4fe7);_0x4d7f24(_0x3e4fe7);});});}exports[_0x7a5e('0x18')]=function(_0x1d6322){var _0x227dea=this;return new Promise(function(_0x5c07e9,_0x4e75fb){return db[_0x7a5e('0x19')]['findAll']({'raw':_0x1d6322['options']?_0x1d6322[_0x7a5e('0x1a')][_0x7a5e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d6322['options']?_0x1d6322['options']['where']||null:null,'attributes':_0x1d6322['options']?_0x1d6322['options'][_0x7a5e('0x1c')]||null:null,'limit':_0x1d6322[_0x7a5e('0x1a')]?_0x1d6322[_0x7a5e('0x1a')]['limit']||null:null,'include':_0x1d6322[_0x7a5e('0x1a')]?_0x1d6322[_0x7a5e('0x1a')][_0x7a5e('0x1d')]?_[_0x7a5e('0x1e')](_0x1d6322[_0x7a5e('0x1a')][_0x7a5e('0x1d')],function(_0x2a6439){return{'model':db[_0x2a6439[_0x7a5e('0x1f')]],'as':_0x2a6439['as'],'attributes':_0x2a6439[_0x7a5e('0x1c')],'include':_0x2a6439['include']?_[_0x7a5e('0x1e')](_0x2a6439[_0x7a5e('0x1d')],function(_0x3f46d9){return{'model':db[_0x3f46d9[_0x7a5e('0x1f')]],'as':_0x3f46d9['as'],'attributes':_0x3f46d9[_0x7a5e('0x1c')],'include':_0x3f46d9['include']?_[_0x7a5e('0x1e')](_0x3f46d9[_0x7a5e('0x1d')],function(_0x3c428a){return{'model':db[_0x3c428a[_0x7a5e('0x1f')]],'as':_0x3c428a['as'],'attributes':_0x3c428a[_0x7a5e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a5e('0xd')](function(_0x2f016a){logger[_0x7a5e('0xe')](_0x7a5e('0x18'),_0x1d6322);logger[_0x7a5e('0x11')](_0x7a5e('0x18'),_0x1d6322,JSON['stringify'](_0x2f016a));_0x5c07e9(_0x2f016a);})[_0x7a5e('0x20')](function(_0xf17170){logger[_0x7a5e('0x14')](_0x7a5e('0x18'),_0xf17170[_0x7a5e('0x16')],_0x1d6322);_0x4e75fb(_0x227dea['error'](0x1f4,_0xf17170[_0x7a5e('0x16')]));});});};exports[_0x7a5e('0x21')]=function(_0xd80db3,_0x1b3f51,_0x2aa863){var _0x39e711=this;return new Promise(function(_0x24448c,_0x53f31c){var _0x3e046b={'body':_0xd80db3[_0x7a5e('0x22')],'channel':_0x7a5e('0x23')};var _0x45829a=[];var _0x48b11a=[];var _0x23d68b={};return db[_0x7a5e('0x24')][_0x7a5e('0x25')]()['then'](function(_0x3d3d93){if(!_0x3d3d93){throw new db[(_0x7a5e('0x26'))][(_0x7a5e('0x27'))]('no\x20available\x20attributes');}_0x45829a=_[_0x7a5e('0x28')](_[_0x7a5e('0x29')](_0x3d3d93),[_0x7a5e('0x2a'),_0x7a5e('0x2b')]);_0x48b11a=_[_0x7a5e('0x28')](_[_0x7a5e('0x29')](_0x3d3d93),[_0x7a5e('0x2a'),_0x7a5e('0x2b'),'CompanyId',_0x7a5e('0x2c')]);if(_0xd80db3[_0x7a5e('0x22')]['id']){delete _0xd80db3[_0x7a5e('0x22')]['id'];}if(_['isNil'](_0xd80db3[_0x7a5e('0x22')][_0x7a5e('0x2d')])){throw new db[(_0x7a5e('0x26'))][(_0x7a5e('0x27'))](_0x7a5e('0x2e'));}if(_[_0x7a5e('0x2f')](_0xd80db3[_0x7a5e('0x22')]['body'])||_0xd80db3[_0x7a5e('0x22')]['body']===''){throw new db[(_0x7a5e('0x26'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xd80db3[_0x7a5e('0x22')][_0x7a5e('0x30')])){throw new db[(_0x7a5e('0x26'))]['ValidationError'](_0x7a5e('0x31')+_0x48b11a);}if(!_['includes'](_0x48b11a,_0xd80db3['body'][_0x7a5e('0x30')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48b11a);}_0x23d68b[_0xd80db3['body'][_0x7a5e('0x30')]]=_0xd80db3[_0x7a5e('0x22')][_0x7a5e('0x2d')];})[_0x7a5e('0xd')](function(){return db['FaxAccount'][_0x7a5e('0x32')]({'where':{'id':_0xd80db3[_0x7a5e('0x33')]['id']},'include':[{'model':db[_0x7a5e('0x34')],'as':_0x7a5e('0x35'),'include':[{'model':db[_0x7a5e('0x24')],'as':'Contacts','where':_0x23d68b,'limit':0x1,'order':[[_0x7a5e('0x2b'),_0x7a5e('0x36')]]}]},{'model':db[_0x7a5e('0x37')],'as':_0x7a5e('0x38')}]});})[_0x7a5e('0xd')](function(_0x3021f3){if(_0x3021f3&&_0x3021f3[_0x7a5e('0x35')]){var _0xc42c8f=_0x3021f3[_0x7a5e('0x39')]({'plain':!![]});_0x3e046b[_0x7a5e('0x33')]=_0xc42c8f;_0x3e046b[_0x7a5e('0x3a')]=_0xc42c8f[_0x7a5e('0x38')];_0x3e046b[_0x7a5e('0x3b')]=_0xc42c8f['List'];_0x3e046b[_0x7a5e('0x3a')]=_['orderBy'](_0x3e046b['applications'],[_0x7a5e('0x3c')],['asc']);if(_0x3e046b[_0x7a5e('0x33')]['Applications']){delete _0x3e046b[_0x7a5e('0x33')]['Applications'];}if(_0x3e046b[_0x7a5e('0x33')]['List']&&_0x3e046b[_0x7a5e('0x33')][_0x7a5e('0x35')]['Contacts'][_0x7a5e('0x3d')]){return _0x3e046b[_0x7a5e('0x33')]['List'][_0x7a5e('0x3e')][0x0];}var _0x406f3a=_[_0x7a5e('0x9')](_0xd80db3[_0x7a5e('0x22')],{'firstName':_0xd80db3[_0x7a5e('0x22')]['from'],'ListId':_0xc42c8f[_0x7a5e('0x2c')]});_0x406f3a[_0xd80db3[_0x7a5e('0x22')][_0x7a5e('0x30')]]=_0xd80db3[_0x7a5e('0x22')]['from'];return db[_0x7a5e('0x24')][_0x7a5e('0x3f')](_0x406f3a,{'fields':_0x45829a,'raw':!![]});}})[_0x7a5e('0xd')](function(_0x50aec7){_0x3e046b[_0x7a5e('0x40')]=_0x50aec7;if(_0x50aec7){var _0x16d98c={'ContactId':_0x50aec7['id'],'FaxAccountId':_0xd80db3[_0x7a5e('0x33')]['id'],'fax':_0x50aec7[_0x7a5e('0x23')]};return db[_0x7a5e('0x41')][_0x7a5e('0x32')]({'where':{'ContactId':_0x50aec7['id'],'closed':![],'FaxAccountId':_0xd80db3[_0x7a5e('0x33')]['id']}})[_0x7a5e('0xd')](function(_0x1fbe93){if(_0x1fbe93){return[_0x1fbe93,![]];}return db['FaxInteraction'][_0x7a5e('0x3f')](_0x16d98c)['then'](function(_0x135a97){return[_0x135a97,!![]];});});}else{throw new Error(_0x7a5e('0x42'));}})[_0x7a5e('0x43')](function(_0x44312a,_0x5856d9){var _0x4160ad=_0x44312a[_0x7a5e('0x39')]({'plain':!![]});if(_0x5856d9){if(_0x3e046b[_0x7a5e('0x33')][_0x7a5e('0x44')]){_0x3e046b[_0x7a5e('0x3a')][_0x7a5e('0x45')]({'id':0x0,'priority':_0x3e046b[_0x7a5e('0x3a')][_0x7a5e('0x3d')]+0x1,'app':_0x7a5e('0x46'),'appdata':'unmanaged','interval':_0x7a5e('0x47')});}_0x4160ad[_0x7a5e('0x48')]=!![];}else{_0x4160ad[_0x7a5e('0x48')]=![];}_0x3e046b['interaction']=_0x4160ad;return db[_0x7a5e('0x49')][_0x7a5e('0x3f')]({'body':_0xd80db3[_0x7a5e('0x22')][_0x7a5e('0x22')],'FaxAccountId':_0xd80db3[_0x7a5e('0x33')]['id'],'FaxInteractionId':_0x44312a['id'],'direction':'in','ContactId':_0x44312a[_0x7a5e('0x4a')],'AttachmentId':_0xd80db3[_0x7a5e('0x22')]['AttachmentId']});})[_0x7a5e('0xd')](function(_0x533284){_0x3e046b[_0x7a5e('0x16')]=_0x533284;if(_0x3e046b[_0x7a5e('0x4b')][_0x7a5e('0x4c')]){return db[_0x7a5e('0x4d')][_0x7a5e('0x32')]({'attributes':['id',_0x7a5e('0x4e')],'where':{'id':_0x3e046b[_0x7a5e('0x4b')]['UserId']}})[_0x7a5e('0xd')](function(_0x2fcb4e){if(_0x2fcb4e){_0x3e046b[_0x7a5e('0x3a')][_0x7a5e('0x4f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2fcb4e['name']+','+(_0x3e046b[_0x7a5e('0x33')][_0x7a5e('0x50')]||0xa),'interval':_0x7a5e('0x47')});}return respondWithRpcPromise(_0x7a5e('0x51'),'startRouting',_0x3e046b);});}return respondWithRpcPromise(_0x7a5e('0x51'),_0x7a5e('0x52'),_0x3e046b);})[_0x7a5e('0xd')](function(_0x14e4a2){_0x24448c(_0x14e4a2);})[_0x7a5e('0x20')](function(_0x589df4){_0x53f31c(_0x39e711[_0x7a5e('0x14')](0x1f4,_0x589df4[_0x7a5e('0x16')]));});});}; \ No newline at end of file +var _0x31a7=['get','applications','priority','asc','length','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','agent','waitForTheAssignedAgent','startRouting','Start','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','findAll','options','raw','attributes','limit','include','map','model','fax','CmContact','describe','ValidationError','difference','keys','updatedAt','createdAt','ListId','body','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','FaxApplication','Applications'];(function(_0x27f643,_0x297205){var _0x1db998=function(_0x57b793){while(--_0x57b793){_0x27f643['push'](_0x27f643['shift']());}};_0x1db998(++_0x297205);}(_0x31a7,0x127));var _0x731a=function(_0x46c2d5,_0x5d4cb3){_0x46c2d5=_0x46c2d5-0x0;var _0x19a26d=_0x31a7[_0x46c2d5];return _0x19a26d;};'use strict';var _=require(_0x731a('0x0'));var util=require(_0x731a('0x1'));var moment=require(_0x731a('0x2'));var BPromise=require(_0x731a('0x3'));var rs=require(_0x731a('0x4'));var fs=require('fs');var Redis=require(_0x731a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x731a('0x6'));var logger=require(_0x731a('0x7'))(_0x731a('0x8'));var config=require(_0x731a('0x9'));var jayson=require(_0x731a('0xa'));var client=jayson[_0x731a('0xb')][_0x731a('0xc')]({'port':0x232c});config[_0x731a('0xd')]=_[_0x731a('0xe')](config[_0x731a('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x731a('0xd')]));require(_0x731a('0xf'))['register'](socket);function respondWithRpcPromise(_0x43a5e3,_0x28714d,_0x470562){return new BPromise(function(_0x249473,_0x2d6e50){return client[_0x731a('0x10')](_0x43a5e3,_0x470562)[_0x731a('0x11')](function(_0x2f04cc){logger[_0x731a('0x12')](_0x731a('0x13'),_0x28714d,_0x731a('0x14'));logger[_0x731a('0x15')](_0x731a('0x16'),_0x28714d,_0x731a('0x14'),JSON[_0x731a('0x17')](_0x2f04cc));if(_0x2f04cc[_0x731a('0x18')]){if(_0x2f04cc[_0x731a('0x18')][_0x731a('0x19')]===0x1f4){logger[_0x731a('0x18')](_0x731a('0x13'),_0x28714d,_0x2f04cc[_0x731a('0x18')][_0x731a('0x1a')]);return _0x2d6e50(_0x2f04cc['error'][_0x731a('0x1a')]);}logger[_0x731a('0x18')](_0x731a('0x13'),_0x28714d,_0x2f04cc[_0x731a('0x18')][_0x731a('0x1a')]);return _0x249473(_0x2f04cc[_0x731a('0x18')][_0x731a('0x1a')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x28714d,_0x731a('0x14'));_0x249473(_0x2f04cc[_0x731a('0x1b')][_0x731a('0x1a')]);}})['catch'](function(_0x135263){logger[_0x731a('0x18')](_0x731a('0x13'),_0x28714d,_0x135263);_0x2d6e50(_0x135263);});});}exports[_0x731a('0x1c')]=function(_0xe8fffc){var _0x1d663d=this;return new Promise(function(_0x12d71d,_0x5596dd){return db['FaxAccount'][_0x731a('0x1d')]({'raw':_0xe8fffc['options']?_0xe8fffc[_0x731a('0x1e')][_0x731a('0x1f')]===undefined?!![]:![]:!![],'where':_0xe8fffc[_0x731a('0x1e')]?_0xe8fffc['options']['where']||null:null,'attributes':_0xe8fffc[_0x731a('0x1e')]?_0xe8fffc[_0x731a('0x1e')][_0x731a('0x20')]||null:null,'limit':_0xe8fffc[_0x731a('0x1e')]?_0xe8fffc[_0x731a('0x1e')][_0x731a('0x21')]||null:null,'include':_0xe8fffc[_0x731a('0x1e')]?_0xe8fffc['options'][_0x731a('0x22')]?_[_0x731a('0x23')](_0xe8fffc[_0x731a('0x1e')]['include'],function(_0xcb1c2c){return{'model':db[_0xcb1c2c[_0x731a('0x24')]],'as':_0xcb1c2c['as'],'attributes':_0xcb1c2c[_0x731a('0x20')],'include':_0xcb1c2c[_0x731a('0x22')]?_[_0x731a('0x23')](_0xcb1c2c[_0x731a('0x22')],function(_0x2d60ff){return{'model':db[_0x2d60ff[_0x731a('0x24')]],'as':_0x2d60ff['as'],'attributes':_0x2d60ff[_0x731a('0x20')],'include':_0x2d60ff[_0x731a('0x22')]?_[_0x731a('0x23')](_0x2d60ff[_0x731a('0x22')],function(_0x1c1684){return{'model':db[_0x1c1684[_0x731a('0x24')]],'as':_0x1c1684['as'],'attributes':_0x1c1684[_0x731a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x731a('0x11')](function(_0x66edfe){logger[_0x731a('0x12')](_0x731a('0x1c'),_0xe8fffc);logger[_0x731a('0x15')](_0x731a('0x1c'),_0xe8fffc,JSON[_0x731a('0x17')](_0x66edfe));_0x12d71d(_0x66edfe);})['catch'](function(_0x1b6d89){logger[_0x731a('0x18')](_0x731a('0x1c'),_0x1b6d89[_0x731a('0x1a')],_0xe8fffc);_0x5596dd(_0x1d663d[_0x731a('0x18')](0x1f4,_0x1b6d89[_0x731a('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x215631,_0x4d29e5,_0x16bc62){var _0x4eb643=this;return new Promise(function(_0x44c3cd,_0xe74353){var _0x11cf60={'body':_0x215631['body'],'channel':_0x731a('0x25')};var _0x4cd2b3=[];var _0x30890e=[];var _0x1e5a05={};return db[_0x731a('0x26')][_0x731a('0x27')]()[_0x731a('0x11')](function(_0x123f11){if(!_0x123f11){throw new db['Sequelize'][(_0x731a('0x28'))]('no\x20available\x20attributes');}_0x4cd2b3=_[_0x731a('0x29')](_[_0x731a('0x2a')](_0x123f11),['createdAt',_0x731a('0x2b')]);_0x30890e=_[_0x731a('0x29')](_[_0x731a('0x2a')](_0x123f11),[_0x731a('0x2c'),_0x731a('0x2b'),'CompanyId',_0x731a('0x2d')]);if(_0x215631['body']['id']){delete _0x215631[_0x731a('0x2e')]['id'];}if(_[_0x731a('0x2f')](_0x215631['body'][_0x731a('0x30')])){throw new db[(_0x731a('0x31'))][(_0x731a('0x28'))]('from\x20is\x20mandatory');}if(_[_0x731a('0x2f')](_0x215631[_0x731a('0x2e')]['body'])||_0x215631['body']['body']===''){throw new db[(_0x731a('0x31'))][(_0x731a('0x28'))](_0x731a('0x32'));}if(_[_0x731a('0x2f')](_0x215631[_0x731a('0x2e')][_0x731a('0x33')])){throw new db[(_0x731a('0x31'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x30890e);}if(!_[_0x731a('0x34')](_0x30890e,_0x215631['body'][_0x731a('0x33')])){throw new db[(_0x731a('0x31'))][(_0x731a('0x28'))](_0x731a('0x35')+_0x30890e);}_0x1e5a05[_0x215631[_0x731a('0x2e')]['mapKey']]=_0x215631['body'][_0x731a('0x30')];})[_0x731a('0x11')](function(){return db[_0x731a('0x36')][_0x731a('0x37')]({'where':{'id':_0x215631[_0x731a('0x38')]['id']},'include':[{'model':db[_0x731a('0x39')],'as':_0x731a('0x3a'),'include':[{'model':db[_0x731a('0x26')],'as':'Contacts','where':_0x1e5a05,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x731a('0x3b')],'as':_0x731a('0x3c')}]});})[_0x731a('0x11')](function(_0x3274c1){if(_0x3274c1&&_0x3274c1[_0x731a('0x3a')]){var _0x31b2d1=_0x3274c1[_0x731a('0x3d')]({'plain':!![]});_0x11cf60[_0x731a('0x38')]=_0x31b2d1;_0x11cf60[_0x731a('0x3e')]=_0x31b2d1[_0x731a('0x3c')];_0x11cf60['list']=_0x31b2d1[_0x731a('0x3a')];_0x11cf60[_0x731a('0x3e')]=_['orderBy'](_0x11cf60[_0x731a('0x3e')],[_0x731a('0x3f')],[_0x731a('0x40')]);if(_0x11cf60[_0x731a('0x38')][_0x731a('0x3c')]){delete _0x11cf60['account'][_0x731a('0x3c')];}if(_0x11cf60[_0x731a('0x38')][_0x731a('0x3a')]&&_0x11cf60[_0x731a('0x38')][_0x731a('0x3a')]['Contacts'][_0x731a('0x41')]){return _0x11cf60[_0x731a('0x38')][_0x731a('0x3a')][_0x731a('0x42')][0x0];}var _0x54d9d5=_[_0x731a('0xe')](_0x215631[_0x731a('0x2e')],{'firstName':_0x215631['body'][_0x731a('0x30')],'ListId':_0x31b2d1[_0x731a('0x2d')]});_0x54d9d5[_0x215631[_0x731a('0x2e')][_0x731a('0x33')]]=_0x215631['body']['from'];return db[_0x731a('0x26')][_0x731a('0x43')](_0x54d9d5,{'fields':_0x4cd2b3,'raw':!![]});}})[_0x731a('0x11')](function(_0x169d83){_0x11cf60[_0x731a('0x44')]=_0x169d83;if(_0x169d83){var _0x3c0fe8={'ContactId':_0x169d83['id'],'FaxAccountId':_0x215631[_0x731a('0x38')]['id'],'fax':_0x169d83[_0x731a('0x25')]};return db[_0x731a('0x45')][_0x731a('0x37')]({'where':{'ContactId':_0x169d83['id'],'closed':![],'FaxAccountId':_0x215631[_0x731a('0x38')]['id']}})['then'](function(_0x11a8b3){if(_0x11a8b3){return[_0x11a8b3,![]];}return db[_0x731a('0x45')][_0x731a('0x43')](_0x3c0fe8)[_0x731a('0x11')](function(_0x33b1e9){return[_0x33b1e9,!![]];});});}else{throw new Error(_0x731a('0x46'));}})[_0x731a('0x47')](function(_0xdd1c03,_0x3df80c){var _0x35c536=_0xdd1c03[_0x731a('0x3d')]({'plain':!![]});if(_0x3df80c){if(_0x11cf60[_0x731a('0x38')][_0x731a('0x48')]){_0x11cf60[_0x731a('0x3e')][_0x731a('0x49')]({'id':0x0,'priority':_0x11cf60[_0x731a('0x3e')][_0x731a('0x41')]+0x1,'app':'close','appdata':_0x731a('0x4a'),'interval':_0x731a('0x4b')});}_0x35c536[_0x731a('0x4c')]=!![];}else{_0x35c536[_0x731a('0x4c')]=![];}_0x11cf60[_0x731a('0x4d')]=_0x35c536;return db[_0x731a('0x4e')]['create']({'body':_0x215631[_0x731a('0x2e')][_0x731a('0x2e')],'FaxAccountId':_0x215631[_0x731a('0x38')]['id'],'FaxInteractionId':_0xdd1c03['id'],'direction':'in','ContactId':_0xdd1c03[_0x731a('0x4f')],'AttachmentId':_0x215631[_0x731a('0x2e')][_0x731a('0x50')]});})[_0x731a('0x11')](function(_0x1f1c01){_0x11cf60[_0x731a('0x1a')]=_0x1f1c01;if(_0x11cf60['interaction']['UserId']){return db[_0x731a('0x51')]['find']({'attributes':['id',_0x731a('0x52')],'where':{'id':_0x11cf60['interaction'][_0x731a('0x53')]}})[_0x731a('0x11')](function(_0xb5e65c){if(_0xb5e65c){_0x11cf60[_0x731a('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x731a('0x54'),'appdata':_0xb5e65c[_0x731a('0x52')]+','+(_0x11cf60['account'][_0x731a('0x55')]||0xa),'interval':_0x731a('0x4b')});}return respondWithRpcPromise('Start',_0x731a('0x56'),_0x11cf60);});}return respondWithRpcPromise(_0x731a('0x57'),_0x731a('0x56'),_0x11cf60);})[_0x731a('0x11')](function(_0x1f2330){_0x44c3cd(_0x1f2330);})[_0x731a('0x58')](function(_0x4a5ede){_0xe74353(_0x4eb643[_0x731a('0x18')](0x1f4,_0x4a5ede[_0x731a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c2c0ade..72c79c8 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 _0xfdda=['register','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0xf1cfd3,_0x5d1472){var _0x54b56d=function(_0x5e42a6){while(--_0x5e42a6){_0xf1cfd3['push'](_0xf1cfd3['shift']());}};_0x54b56d(++_0x5d1472);}(_0xfdda,0x11a));var _0xafdd=function(_0x5991d7,_0x3ca7f8){_0x5991d7=_0x5991d7-0x0;var _0x5b299d=_0xfdda[_0x5991d7];return _0x5b299d;};'use strict';var FaxAccountEvents=require(_0xafdd('0x0'));var events=[_0xafdd('0x1'),_0xafdd('0x2'),_0xafdd('0x3')];function createListener(_0xa8d22f,_0x4fef6a){return function(_0x5a4e68){_0x4fef6a[_0xafdd('0x4')](_0xa8d22f,_0x5a4e68);};}function removeListener(_0x5416cf,_0x55f920){return function(){FaxAccountEvents[_0xafdd('0x5')](_0x5416cf,_0x55f920);};}exports[_0xafdd('0x6')]=function(_0xcefcce){for(var _0x54593a=0x0,_0x1a730b=events['length'];_0x54593a<_0x1a730b;_0x54593a++){var _0x9572eb=events[_0x54593a];var _0x28c798=createListener(_0xafdd('0x7')+_0x9572eb,_0xcefcce);FaxAccountEvents['on'](_0x9572eb,_0x28c798);}}; \ No newline at end of file +var _0xc96f=['remove','emit','register','length','./faxAccount.events','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc96f,0x1f0));var _0xfc96=function(_0x1dcf81,_0x5685aa){_0x1dcf81=_0x1dcf81-0x0;var _0x1fce45=_0xc96f[_0x1dcf81];return _0x1fce45;};'use strict';var FaxAccountEvents=require(_0xfc96('0x0'));var events=[_0xfc96('0x1'),_0xfc96('0x2'),'update'];function createListener(_0x1c759f,_0x353d08){return function(_0x2d7d41){_0x353d08[_0xfc96('0x3')](_0x1c759f,_0x2d7d41);};}function removeListener(_0x3d676c,_0x3d85ae){return function(){FaxAccountEvents['removeListener'](_0x3d676c,_0x3d85ae);};}exports[_0xfc96('0x4')]=function(_0x5a7fa4){for(var _0x259516=0x0,_0x58b64d=events[_0xfc96('0x5')];_0x259516<_0x58b64d;_0x259516++){var _0x452da9=events[_0x259516];var _0x4682e4=createListener('faxAccount:'+_0x452da9,_0x5a7fa4);FaxAccountEvents['on'](_0x452da9,_0x4682e4);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f896d98..4f321c9 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x308ca1,_0xf8eb57){var _0x1c589e=function(_0x1489b7){while(--_0x1489b7){_0x308ca1['push'](_0x308ca1['shift']());}};_0x1c589e(++_0xf8eb57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x48e6ec,_0x48dc89){var _0x1d8310=function(_0x1a75e1){while(--_0x1a75e1){_0x48e6ec['push'](_0x48e6ec['shift']());}};_0x1d8310(++_0x48dc89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e16ae09..9430eab 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 _0xeeb6=['*,*,*,*','sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x58c513,_0x15deec){var _0x4da4c4=function(_0x112a83){while(--_0x112a83){_0x58c513['push'](_0x58c513['shift']());}};_0x4da4c4(++_0x15deec);}(_0xeeb6,0x6d));var _0x6eeb=function(_0x53724b,_0x25c8da){_0x53724b=_0x53724b-0x0;var _0x42f6e1=_0xeeb6[_0x53724b];return _0x42f6e1;};'use strict';var Sequelize=require(_0x6eeb('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6eeb('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6eeb('0x2')},'appdata':{'type':Sequelize[_0x6eeb('0x3')]()},'description':{'type':Sequelize[_0x6eeb('0x4')]},'interval':{'type':Sequelize[_0x6eeb('0x4')],'defaultValue':_0x6eeb('0x5')}}; \ No newline at end of file +var _0x5804=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x4477ff,_0x5c885a){var _0x291222=function(_0x31a543){while(--_0x31a543){_0x4477ff['push'](_0x4477ff['shift']());}};_0x291222(++_0x5c885a);}(_0x5804,0xa8));var _0x4580=function(_0x3018fb,_0x507e28){_0x3018fb=_0x3018fb-0x0;var _0x557c8c=_0x5804[_0x3018fb];return _0x557c8c;};'use strict';var Sequelize=require(_0x4580('0x0'));module[_0x4580('0x1')]={'priority':{'type':Sequelize[_0x4580('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4580('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4580('0x4')]},'interval':{'type':Sequelize[_0x4580('0x4')],'defaultValue':_0x4580('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 002b7e7..5e09c08 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 _0x443e=['intersection','attributes','fields','hasOwnProperty','sort','filter','where','VIRTUAL','options','FaxApplication','then','include','findAll','rows','show','params','keys','filters','includeAll','merge','find','catch','create','body','destroy','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','error','stack','name','map','rawAttributes','type','key','model','query'];(function(_0x4f64de,_0x11e6c3){var _0x2ceb01=function(_0x2e85ef){while(--_0x2e85ef){_0x4f64de['push'](_0x4f64de['shift']());}};_0x2ceb01(++_0x11e6c3);}(_0x443e,0x121));var _0xe443=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x443e[_0x996bc8];return _0x20b0ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe443('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe443('0x1'));var moment=require(_0xe443('0x2'));var BPromise=require(_0xe443('0x3'));var Mustache=require('mustache');var util=require(_0xe443('0x4'));var path=require(_0xe443('0x5'));var sox=require(_0xe443('0x6'));var csv=require(_0xe443('0x7'));var ejs=require(_0xe443('0x8'));var fs=require('fs');var fs_extra=require(_0xe443('0x9'));var _=require(_0xe443('0xa'));var squel=require(_0xe443('0xb'));var crypto=require(_0xe443('0xc'));var jsforce=require(_0xe443('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe443('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe443('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe443('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe443('0x10'))('api');var utils=require(_0xe443('0x11'));var config=require(_0xe443('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe443('0x13'))['db'];function respondWithStatusCode(_0x3db6ec,_0x5693b3){_0x5693b3=_0x5693b3||0xcc;return function(_0x27ac14){if(_0x27ac14){return _0x3db6ec[_0xe443('0x14')](_0x5693b3);}return _0x3db6ec[_0xe443('0x15')](_0x5693b3)['end']();};}function respondWithResult(_0x75895b,_0xe464de){_0xe464de=_0xe464de||0xc8;return function(_0x4f2a9d){if(_0x4f2a9d){return _0x75895b[_0xe443('0x15')](_0xe464de)[_0xe443('0x16')](_0x4f2a9d);}};}function respondWithFilteredResult(_0x6f96fb,_0x301dc5){return function(_0x8947f){if(_0x8947f){var _0x342385=typeof _0x301dc5[_0xe443('0x17')]===_0xe443('0x18')&&typeof _0x301dc5[_0xe443('0x19')]===_0xe443('0x18');var _0x2e700a=_0x8947f[_0xe443('0x1a')];var _0x5e4162=_0x342385?0x0:_0x301dc5['offset'];var _0x202c89=_0x342385?_0x8947f[_0xe443('0x1a')]:_0x301dc5['offset']+_0x301dc5[_0xe443('0x19')];var _0x11cfd1;if(_0x202c89>=_0x2e700a){_0x202c89=_0x2e700a;_0x11cfd1=0xc8;}else{_0x11cfd1=0xce;}_0x6f96fb[_0xe443('0x15')](_0x11cfd1);return _0x6f96fb['set'](_0xe443('0x1b'),_0x5e4162+'-'+_0x202c89+'/'+_0x2e700a)[_0xe443('0x16')](_0x8947f);}return null;};}function patchUpdates(_0x382f23){return function(_0x10eb76){try{jsonpatch[_0xe443('0x1c')](_0x10eb76,_0x382f23,!![]);}catch(_0x4c65ba){return BPromise[_0xe443('0x1d')](_0x4c65ba);}return _0x10eb76[_0xe443('0x1e')]();};}function saveUpdates(_0x4e98fe,_0x5824fd){return function(_0x315bc0){if(_0x315bc0){return _0x315bc0[_0xe443('0x1f')](_0x4e98fe)['then'](function(_0x29d8da){return _0x29d8da;});}return null;};}function removeEntity(_0x44d8ac,_0x4c2c11){return function(_0x91a1a8){if(_0x91a1a8){return _0x91a1a8['destroy']()['then'](function(){_0x44d8ac[_0xe443('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa85653,_0x47f07c){return function(_0x218749){if(!_0x218749){_0xa85653[_0xe443('0x14')](0x194);}return _0x218749;};}function handleError(_0x383635,_0x235e01){_0x235e01=_0x235e01||0x1f4;return function(_0x4e56c7){logger[_0xe443('0x20')](_0x4e56c7[_0xe443('0x21')]);if(_0x4e56c7[_0xe443('0x22')]){delete _0x4e56c7[_0xe443('0x22')];}_0x383635[_0xe443('0x15')](_0x235e01)['send'](_0x4e56c7);};}exports['index']=function(_0xfb8b42,_0x435c41){var _0x3a138d={},_0x490f7c={},_0x336566={'count':0x0,'rows':[]};var _0x4ca521=_[_0xe443('0x23')](db['FaxApplication'][_0xe443('0x24')],function(_0x4757dd){return{'name':_0x4757dd['fieldName'],'type':_0x4757dd[_0xe443('0x25')][_0xe443('0x26')]};});_0x490f7c[_0xe443('0x27')]=_['map'](_0x4ca521,'name');_0x490f7c['query']=_['keys'](_0xfb8b42[_0xe443('0x28')]);_0x490f7c['filters']=_[_0xe443('0x29')](_0x490f7c[_0xe443('0x27')],_0x490f7c[_0xe443('0x28')]);_0x3a138d[_0xe443('0x2a')]=_[_0xe443('0x29')](_0x490f7c[_0xe443('0x27')],qs[_0xe443('0x2b')](_0xfb8b42['query'][_0xe443('0x2b')]));_0x3a138d[_0xe443('0x2a')]=_0x3a138d[_0xe443('0x2a')]['length']?_0x3a138d['attributes']:_0x490f7c[_0xe443('0x27')];if(!_0xfb8b42[_0xe443('0x28')][_0xe443('0x2c')]('nolimit')){_0x3a138d['limit']=qs[_0xe443('0x19')](_0xfb8b42[_0xe443('0x28')]['limit']);_0x3a138d['offset']=qs['offset'](_0xfb8b42[_0xe443('0x28')][_0xe443('0x17')]);}_0x3a138d['order']=qs[_0xe443('0x2d')](_0xfb8b42[_0xe443('0x28')][_0xe443('0x2d')]);_0x3a138d['where']=qs['filters'](_['pick'](_0xfb8b42[_0xe443('0x28')],_0x490f7c['filters']),_0x4ca521);if(_0xfb8b42[_0xe443('0x28')][_0xe443('0x2e')]){_0x3a138d[_0xe443('0x2f')]=_['merge'](_0x3a138d[_0xe443('0x2f')],{'$or':_[_0xe443('0x23')](_0x4ca521,function(_0x28f4d3){if(_0x28f4d3['type']!==_0xe443('0x30')){var _0x34b113={};_0x34b113[_0x28f4d3[_0xe443('0x22')]]={'$like':'%'+_0xfb8b42[_0xe443('0x28')]['filter']+'%'};return _0x34b113;}})});}_0x3a138d=_['merge']({},_0x3a138d,_0xfb8b42[_0xe443('0x31')]);var _0x526c24={'where':_0x3a138d['where']};return db[_0xe443('0x32')][_0xe443('0x1a')](_0x526c24)[_0xe443('0x33')](function(_0x147b26){_0x336566[_0xe443('0x1a')]=_0x147b26;if(_0xfb8b42[_0xe443('0x28')]['includeAll']){_0x3a138d[_0xe443('0x34')]=[{'all':!![]}];}return db['FaxApplication'][_0xe443('0x35')](_0x3a138d);})[_0xe443('0x33')](function(_0x1e77ee){_0x336566[_0xe443('0x36')]=_0x1e77ee;return _0x336566;})[_0xe443('0x33')](respondWithFilteredResult(_0x435c41,_0x3a138d))['catch'](handleError(_0x435c41,null));};exports[_0xe443('0x37')]=function(_0x464169,_0x1b7662){var _0x56695a={'raw':!![],'where':{'id':_0x464169[_0xe443('0x38')]['id']}},_0x316a5f={};_0x316a5f['model']=_[_0xe443('0x39')](db[_0xe443('0x32')]['rawAttributes']);_0x316a5f[_0xe443('0x28')]=_[_0xe443('0x39')](_0x464169[_0xe443('0x28')]);_0x316a5f[_0xe443('0x3a')]=_[_0xe443('0x29')](_0x316a5f[_0xe443('0x27')],_0x316a5f[_0xe443('0x28')]);_0x56695a[_0xe443('0x2a')]=_[_0xe443('0x29')](_0x316a5f[_0xe443('0x27')],qs[_0xe443('0x2b')](_0x464169['query']['fields']));_0x56695a[_0xe443('0x2a')]=_0x56695a[_0xe443('0x2a')]['length']?_0x56695a[_0xe443('0x2a')]:_0x316a5f['model'];if(_0x464169[_0xe443('0x28')][_0xe443('0x3b')]){_0x56695a[_0xe443('0x34')]=[{'all':!![]}];}_0x56695a=_[_0xe443('0x3c')]({},_0x56695a,_0x464169[_0xe443('0x31')]);return db['FaxApplication'][_0xe443('0x3d')](_0x56695a)[_0xe443('0x33')](handleEntityNotFound(_0x1b7662,null))[_0xe443('0x33')](respondWithResult(_0x1b7662,null))[_0xe443('0x3e')](handleError(_0x1b7662,null));};exports[_0xe443('0x3f')]=function(_0x2149a1,_0x2c9ed1){return db[_0xe443('0x32')]['create'](_0x2149a1[_0xe443('0x40')],{})[_0xe443('0x33')](respondWithResult(_0x2c9ed1,0xc9))[_0xe443('0x3e')](handleError(_0x2c9ed1,null));};exports[_0xe443('0x1f')]=function(_0x2bac23,_0x28da70){if(_0x2bac23[_0xe443('0x40')]['id']){delete _0x2bac23[_0xe443('0x40')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x2bac23[_0xe443('0x38')]['id']}})[_0xe443('0x33')](handleEntityNotFound(_0x28da70,null))['then'](saveUpdates(_0x2bac23['body'],null))[_0xe443('0x33')](respondWithResult(_0x28da70,null))['catch'](handleError(_0x28da70,null));};exports[_0xe443('0x41')]=function(_0x3db219,_0x54624a){return db[_0xe443('0x32')]['find']({'where':{'id':_0x3db219['params']['id']}})['then'](handleEntityNotFound(_0x54624a,null))['then'](removeEntity(_0x54624a,null))[_0xe443('0x3e')](handleError(_0x54624a,null));}; \ No newline at end of file +var _0x7f96=['catch','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','FaxApplication','rawAttributes','type','model','map','keys','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x7f96,0x178));var _0x67f9=function(_0x236ded,_0x23a35c){_0x236ded=_0x236ded-0x0;var _0x2f608a=_0x7f96[_0x236ded];return _0x2f608a;};'use strict';var emlformat=require(_0x67f9('0x0'));var rimraf=require(_0x67f9('0x1'));var zipdir=require(_0x67f9('0x2'));var jsonpatch=require(_0x67f9('0x3'));var rp=require(_0x67f9('0x4'));var moment=require('moment');var BPromise=require(_0x67f9('0x5'));var Mustache=require(_0x67f9('0x6'));var util=require(_0x67f9('0x7'));var path=require(_0x67f9('0x8'));var sox=require(_0x67f9('0x9'));var csv=require(_0x67f9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67f9('0xb'));var _=require(_0x67f9('0xc'));var squel=require(_0x67f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x67f9('0xe'));var deskjs=require(_0x67f9('0xf'));var toCsv=require(_0x67f9('0xa'));var querystring=require(_0x67f9('0x10'));var Papa=require(_0x67f9('0x11'));var Redis=require('ioredis');var authService=require(_0x67f9('0x12'));var qs=require(_0x67f9('0x13'));var as=require(_0x67f9('0x14'));var hardwareService=require(_0x67f9('0x15'));var logger=require(_0x67f9('0x16'))(_0x67f9('0x17'));var utils=require(_0x67f9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x67f9('0x19'));var db=require(_0x67f9('0x1a'))['db'];function respondWithStatusCode(_0x135741,_0x5e6ce3){_0x5e6ce3=_0x5e6ce3||0xcc;return function(_0x558b19){if(_0x558b19){return _0x135741[_0x67f9('0x1b')](_0x5e6ce3);}return _0x135741['status'](_0x5e6ce3)[_0x67f9('0x1c')]();};}function respondWithResult(_0x4ca08d,_0x4a878d){_0x4a878d=_0x4a878d||0xc8;return function(_0x1537d6){if(_0x1537d6){return _0x4ca08d[_0x67f9('0x1d')](_0x4a878d)['json'](_0x1537d6);}};}function respondWithFilteredResult(_0x24e31e,_0x16dbcb){return function(_0x48d65b){if(_0x48d65b){var _0x47288f=typeof _0x16dbcb[_0x67f9('0x1e')]===_0x67f9('0x1f')&&typeof _0x16dbcb[_0x67f9('0x20')]==='undefined';var _0x5a85c2=_0x48d65b[_0x67f9('0x21')];var _0x442cd2=_0x47288f?0x0:_0x16dbcb['offset'];var _0x44467a=_0x47288f?_0x48d65b['count']:_0x16dbcb[_0x67f9('0x1e')]+_0x16dbcb[_0x67f9('0x20')];var _0x4f21a7;if(_0x44467a>=_0x5a85c2){_0x44467a=_0x5a85c2;_0x4f21a7=0xc8;}else{_0x4f21a7=0xce;}_0x24e31e[_0x67f9('0x1d')](_0x4f21a7);return _0x24e31e[_0x67f9('0x22')](_0x67f9('0x23'),_0x442cd2+'-'+_0x44467a+'/'+_0x5a85c2)['json'](_0x48d65b);}return null;};}function patchUpdates(_0x4a5fa8){return function(_0x540acb){try{jsonpatch[_0x67f9('0x24')](_0x540acb,_0x4a5fa8,!![]);}catch(_0x2c1a24){return BPromise[_0x67f9('0x25')](_0x2c1a24);}return _0x540acb[_0x67f9('0x26')]();};}function saveUpdates(_0x403446,_0x1692ce){return function(_0x5bf6e8){if(_0x5bf6e8){return _0x5bf6e8[_0x67f9('0x27')](_0x403446)[_0x67f9('0x28')](function(_0x3fc2a5){return _0x3fc2a5;});}return null;};}function removeEntity(_0x33b702,_0x2959d6){return function(_0x43f3fd){if(_0x43f3fd){return _0x43f3fd['destroy']()[_0x67f9('0x28')](function(){_0x33b702[_0x67f9('0x1d')](0xcc)[_0x67f9('0x1c')]();});}};}function handleEntityNotFound(_0x1fcd9c,_0xab57d5){return function(_0x27ae35){if(!_0x27ae35){_0x1fcd9c['sendStatus'](0x194);}return _0x27ae35;};}function handleError(_0x255a50,_0x3fb45f){_0x3fb45f=_0x3fb45f||0x1f4;return function(_0x155f25){logger['error'](_0x155f25[_0x67f9('0x29')]);if(_0x155f25[_0x67f9('0x2a')]){delete _0x155f25[_0x67f9('0x2a')];}_0x255a50[_0x67f9('0x1d')](_0x3fb45f)[_0x67f9('0x2b')](_0x155f25);};}exports[_0x67f9('0x2c')]=function(_0x19dddd,_0x2be6a3){var _0x400b3f={},_0x4871a5={},_0x2cf801={'count':0x0,'rows':[]};var _0x249dde=_['map'](db[_0x67f9('0x2d')][_0x67f9('0x2e')],function(_0x92e96e){return{'name':_0x92e96e['fieldName'],'type':_0x92e96e[_0x67f9('0x2f')]['key']};});_0x4871a5[_0x67f9('0x30')]=_[_0x67f9('0x31')](_0x249dde,_0x67f9('0x2a'));_0x4871a5['query']=_[_0x67f9('0x32')](_0x19dddd[_0x67f9('0x33')]);_0x4871a5['filters']=_['intersection'](_0x4871a5[_0x67f9('0x30')],_0x4871a5['query']);_0x400b3f[_0x67f9('0x34')]=_[_0x67f9('0x35')](_0x4871a5['model'],qs[_0x67f9('0x36')](_0x19dddd[_0x67f9('0x33')]['fields']));_0x400b3f[_0x67f9('0x34')]=_0x400b3f['attributes'][_0x67f9('0x37')]?_0x400b3f[_0x67f9('0x34')]:_0x4871a5['model'];if(!_0x19dddd[_0x67f9('0x33')]['hasOwnProperty'](_0x67f9('0x38'))){_0x400b3f['limit']=qs[_0x67f9('0x20')](_0x19dddd[_0x67f9('0x33')][_0x67f9('0x20')]);_0x400b3f[_0x67f9('0x1e')]=qs[_0x67f9('0x1e')](_0x19dddd['query']['offset']);}_0x400b3f['order']=qs[_0x67f9('0x39')](_0x19dddd['query']['sort']);_0x400b3f[_0x67f9('0x3a')]=qs['filters'](_[_0x67f9('0x3b')](_0x19dddd[_0x67f9('0x33')],_0x4871a5[_0x67f9('0x3c')]),_0x249dde);if(_0x19dddd[_0x67f9('0x33')][_0x67f9('0x3d')]){_0x400b3f['where']=_[_0x67f9('0x3e')](_0x400b3f[_0x67f9('0x3a')],{'$or':_[_0x67f9('0x31')](_0x249dde,function(_0x5f26bd){if(_0x5f26bd[_0x67f9('0x2f')]!==_0x67f9('0x3f')){var _0x4063ee={};_0x4063ee[_0x5f26bd[_0x67f9('0x2a')]]={'$like':'%'+_0x19dddd['query'][_0x67f9('0x3d')]+'%'};return _0x4063ee;}})});}_0x400b3f=_[_0x67f9('0x3e')]({},_0x400b3f,_0x19dddd[_0x67f9('0x40')]);var _0x1081f3={'where':_0x400b3f[_0x67f9('0x3a')]};return db[_0x67f9('0x2d')][_0x67f9('0x21')](_0x1081f3)[_0x67f9('0x28')](function(_0x186f49){_0x2cf801[_0x67f9('0x21')]=_0x186f49;if(_0x19dddd['query'][_0x67f9('0x41')]){_0x400b3f[_0x67f9('0x42')]=[{'all':!![]}];}return db[_0x67f9('0x2d')][_0x67f9('0x43')](_0x400b3f);})[_0x67f9('0x28')](function(_0xd4d0a){_0x2cf801['rows']=_0xd4d0a;return _0x2cf801;})[_0x67f9('0x28')](respondWithFilteredResult(_0x2be6a3,_0x400b3f))[_0x67f9('0x44')](handleError(_0x2be6a3,null));};exports['show']=function(_0x11fd94,_0x5a3e18){var _0x4841e1={'raw':!![],'where':{'id':_0x11fd94['params']['id']}},_0xee041={};_0xee041[_0x67f9('0x30')]=_[_0x67f9('0x32')](db[_0x67f9('0x2d')]['rawAttributes']);_0xee041[_0x67f9('0x33')]=_[_0x67f9('0x32')](_0x11fd94[_0x67f9('0x33')]);_0xee041[_0x67f9('0x3c')]=_[_0x67f9('0x35')](_0xee041[_0x67f9('0x30')],_0xee041[_0x67f9('0x33')]);_0x4841e1[_0x67f9('0x34')]=_[_0x67f9('0x35')](_0xee041[_0x67f9('0x30')],qs[_0x67f9('0x36')](_0x11fd94[_0x67f9('0x33')][_0x67f9('0x36')]));_0x4841e1[_0x67f9('0x34')]=_0x4841e1[_0x67f9('0x34')][_0x67f9('0x37')]?_0x4841e1[_0x67f9('0x34')]:_0xee041[_0x67f9('0x30')];if(_0x11fd94[_0x67f9('0x33')]['includeAll']){_0x4841e1[_0x67f9('0x42')]=[{'all':!![]}];}_0x4841e1=_[_0x67f9('0x3e')]({},_0x4841e1,_0x11fd94[_0x67f9('0x40')]);return db[_0x67f9('0x2d')][_0x67f9('0x45')](_0x4841e1)[_0x67f9('0x28')](handleEntityNotFound(_0x5a3e18,null))['then'](respondWithResult(_0x5a3e18,null))[_0x67f9('0x44')](handleError(_0x5a3e18,null));};exports['create']=function(_0x437c86,_0x5434c0){return db[_0x67f9('0x2d')][_0x67f9('0x46')](_0x437c86[_0x67f9('0x47')],{})[_0x67f9('0x28')](respondWithResult(_0x5434c0,0xc9))['catch'](handleError(_0x5434c0,null));};exports[_0x67f9('0x27')]=function(_0x48497f,_0x35fecc){if(_0x48497f[_0x67f9('0x47')]['id']){delete _0x48497f['body']['id'];}return db['FaxApplication'][_0x67f9('0x45')]({'where':{'id':_0x48497f[_0x67f9('0x48')]['id']}})['then'](handleEntityNotFound(_0x35fecc,null))[_0x67f9('0x28')](saveUpdates(_0x48497f['body'],null))[_0x67f9('0x28')](respondWithResult(_0x35fecc,null))['catch'](handleError(_0x35fecc,null));};exports[_0x67f9('0x49')]=function(_0x574d3c,_0x47fdd2){return db['FaxApplication']['find']({'where':{'id':_0x574d3c[_0x67f9('0x48')]['id']}})[_0x67f9('0x28')](handleEntityNotFound(_0x47fdd2,null))[_0x67f9('0x28')](removeEntity(_0x47fdd2,null))[_0x67f9('0x44')](handleError(_0x47fdd2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index c936323..794bb1f 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 _0xe2ad=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2ad,0xe2));var _0xde2a=function(_0x347ed4,_0x1d35be){_0x347ed4=_0x347ed4-0x0;var _0x2dedcf=_0xe2ad[_0x347ed4];return _0x2dedcf;};'use strict';var _=require(_0xde2a('0x0'));var util=require(_0xde2a('0x1'));var logger=require('../../config/logger')(_0xde2a('0x2'));var moment=require(_0xde2a('0x3'));var BPromise=require(_0xde2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde2a('0x5'));var rimraf=require(_0xde2a('0x6'));var config=require(_0xde2a('0x7'));var attributes=require(_0xde2a('0x8'));module[_0xde2a('0x9')]=function(_0xc13d23,_0x1718ec){return _0xc13d23[_0xde2a('0xa')](_0xde2a('0xb'),attributes,{'tableName':_0xde2a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde2a('0xd'),'collate':_0xde2a('0xe')});}; \ No newline at end of file +var _0x9aa6=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4'];(function(_0x332156,_0x3c2e8a){var _0x2eec59=function(_0x38cf06){while(--_0x38cf06){_0x332156['push'](_0x332156['shift']());}};_0x2eec59(++_0x3c2e8a);}(_0x9aa6,0xde));var _0x69aa=function(_0x5502f6,_0x19d829){_0x5502f6=_0x5502f6-0x0;var _0x34d7f0=_0x9aa6[_0x5502f6];return _0x34d7f0;};'use strict';var _=require(_0x69aa('0x0'));var util=require(_0x69aa('0x1'));var logger=require(_0x69aa('0x2'))('api');var moment=require(_0x69aa('0x3'));var BPromise=require(_0x69aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69aa('0x5'));var rimraf=require(_0x69aa('0x6'));var config=require(_0x69aa('0x7'));var attributes=require(_0x69aa('0x8'));module['exports']=function(_0x24300e,_0x976a9d){return _0x24300e['define'](_0x69aa('0x9'),attributes,{'tableName':_0x69aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x69aa('0xb'),'collate':_0x69aa('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index dda94af..4de151f 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 _0x63a5=['debug','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0x63a5,0x138));var _0x563a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x63a5[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require(_0x563a('0x3'));var rs=require(_0x563a('0x4'));var fs=require('fs');var Redis=require(_0x563a('0x5'));var db=require(_0x563a('0x6'))['db'];var utils=require(_0x563a('0x7'));var logger=require(_0x563a('0x8'))(_0x563a('0x9'));var config=require(_0x563a('0xa'));var jayson=require(_0x563a('0xb'));var client=jayson[_0x563a('0xc')][_0x563a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x37de4c,_0x33fc9d,_0x5af075){return new BPromise(function(_0xf26585,_0x21a0e4){return client[_0x563a('0xe')](_0x37de4c,_0x5af075)[_0x563a('0xf')](function(_0x3ecf43){logger[_0x563a('0x10')](_0x563a('0x11'),_0x33fc9d,'request\x20sent');logger[_0x563a('0x12')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x33fc9d,'request\x20sent',JSON['stringify'](_0x3ecf43));if(_0x3ecf43[_0x563a('0x13')]){if(_0x3ecf43[_0x563a('0x13')][_0x563a('0x14')]===0x1f4){logger['error'](_0x563a('0x11'),_0x33fc9d,_0x3ecf43[_0x563a('0x13')]['message']);return _0x21a0e4(_0x3ecf43[_0x563a('0x13')]['message']);}logger[_0x563a('0x13')](_0x563a('0x11'),_0x33fc9d,_0x3ecf43[_0x563a('0x13')][_0x563a('0x15')]);return _0xf26585(_0x3ecf43['error'][_0x563a('0x15')]);}else{logger['info'](_0x563a('0x11'),_0x33fc9d,'request\x20sent');_0xf26585(_0x3ecf43[_0x563a('0x16')][_0x563a('0x15')]);}})['catch'](function(_0x4bb160){logger['error'](_0x563a('0x11'),_0x33fc9d,_0x4bb160);_0x21a0e4(_0x4bb160);});});}exports[_0x563a('0x17')]=function(_0x5e51ff){var _0x2ba0cf=this;return new Promise(function(_0x55d1ed,_0x3ea2f1){return db[_0x563a('0x18')][_0x563a('0x19')](_0x5e51ff['body'],{'raw':_0x5e51ff['options']?_0x5e51ff[_0x563a('0x1a')][_0x563a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e51ff[_0x563a('0x1a')]?_0x5e51ff['options'][_0x563a('0x1c')]||null:null,'attributes':_0x5e51ff[_0x563a('0x1a')]?_0x5e51ff[_0x563a('0x1a')][_0x563a('0x1d')]||null:null,'limit':_0x5e51ff['options']?_0x5e51ff[_0x563a('0x1a')][_0x563a('0x1e')]||null:null})[_0x563a('0xf')](function(_0xcb7d4d){logger[_0x563a('0x10')]('UpdateFaxApplication',_0x5e51ff);logger[_0x563a('0x12')]('UpdateFaxApplication',_0x5e51ff,JSON[_0x563a('0x1f')](_0xcb7d4d));_0x55d1ed(_0xcb7d4d);})[_0x563a('0x20')](function(_0x2c1894){logger['error'](_0x563a('0x17'),_0x2c1894['message'],_0x5e51ff);_0x3ea2f1(_0x2ba0cf[_0x563a('0x13')](0x1f4,_0x2c1894[_0x563a('0x15')]));});});}; \ No newline at end of file +var _0xf452=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xf452,0x13b));var _0x2f45=function(_0x4e8607,_0xf317bd){_0x4e8607=_0x4e8607-0x0;var _0x185167=_0xf452[_0x4e8607];return _0x185167;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var moment=require('moment');var BPromise=require(_0x2f45('0x2'));var rs=require(_0x2f45('0x3'));var fs=require('fs');var Redis=require(_0x2f45('0x4'));var db=require(_0x2f45('0x5'))['db'];var utils=require(_0x2f45('0x6'));var logger=require(_0x2f45('0x7'))(_0x2f45('0x8'));var config=require(_0x2f45('0x9'));var jayson=require(_0x2f45('0xa'));var client=jayson[_0x2f45('0xb')][_0x2f45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f0a92,_0x1b3c99,_0xc30636){return new BPromise(function(_0xf12ae7,_0x20a6ad){return client[_0x2f45('0xd')](_0x3f0a92,_0xc30636)[_0x2f45('0xe')](function(_0x2e5e29){logger[_0x2f45('0xf')](_0x2f45('0x10'),_0x1b3c99,_0x2f45('0x11'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1b3c99,_0x2f45('0x11'),JSON[_0x2f45('0x12')](_0x2e5e29));if(_0x2e5e29[_0x2f45('0x13')]){if(_0x2e5e29[_0x2f45('0x13')][_0x2f45('0x14')]===0x1f4){logger['error'](_0x2f45('0x10'),_0x1b3c99,_0x2e5e29['error'][_0x2f45('0x15')]);return _0x20a6ad(_0x2e5e29[_0x2f45('0x13')]['message']);}logger[_0x2f45('0x13')](_0x2f45('0x10'),_0x1b3c99,_0x2e5e29[_0x2f45('0x13')]['message']);return _0xf12ae7(_0x2e5e29[_0x2f45('0x13')]['message']);}else{logger[_0x2f45('0xf')](_0x2f45('0x10'),_0x1b3c99,'request\x20sent');_0xf12ae7(_0x2e5e29[_0x2f45('0x16')][_0x2f45('0x15')]);}})[_0x2f45('0x17')](function(_0x5694ee){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1b3c99,_0x5694ee);_0x20a6ad(_0x5694ee);});});}exports[_0x2f45('0x18')]=function(_0xe4db0){var _0x3ea332=this;return new Promise(function(_0x103542,_0x589c2f){return db[_0x2f45('0x19')][_0x2f45('0x1a')](_0xe4db0[_0x2f45('0x1b')],{'raw':_0xe4db0[_0x2f45('0x1c')]?_0xe4db0[_0x2f45('0x1c')][_0x2f45('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe4db0['options']?_0xe4db0['options'][_0x2f45('0x1e')]||null:null,'attributes':_0xe4db0[_0x2f45('0x1c')]?_0xe4db0[_0x2f45('0x1c')][_0x2f45('0x1f')]||null:null,'limit':_0xe4db0[_0x2f45('0x1c')]?_0xe4db0[_0x2f45('0x1c')][_0x2f45('0x20')]||null:null})[_0x2f45('0xe')](function(_0x5c5e6f){logger[_0x2f45('0xf')](_0x2f45('0x18'),_0xe4db0);logger['debug'](_0x2f45('0x18'),_0xe4db0,JSON[_0x2f45('0x12')](_0x5c5e6f));_0x103542(_0x5c5e6f);})['catch'](function(_0x1b8870){logger[_0x2f45('0x13')](_0x2f45('0x18'),_0x1b8870[_0x2f45('0x15')],_0xe4db0);_0x589c2f(_0x3ea332[_0x2f45('0x13')](0x1f4,_0x1b8870['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 16f0a72..10a15dd 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 _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x4880a7,_0x54a79a){var _0x2824f2=function(_0x5ee202){while(--_0x5ee202){_0x4880a7['push'](_0x4880a7['shift']());}};_0x2824f2(++_0x54a79a);}(_0x13f6,0x124));var _0x613f=function(_0x1af48d,_0x57844e){_0x1af48d=_0x1af48d-0x0;var _0x5d656d=_0x13f6[_0x1af48d];return _0x5d656d;};'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']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file +var _0x6e6c=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'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('./faxApplication.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xe')]);module[_0xc6e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e550cab..8f763fe 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 _0x8eb6=['DATE','STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0xbe2ed2,_0x32f942){var _0x2b6d58=function(_0x35cd3e){while(--_0x35cd3e){_0xbe2ed2['push'](_0xbe2ed2['shift']());}};_0x2b6d58(++_0x32f942);}(_0x8eb6,0xf2));var _0x68eb=function(_0x282c62,_0x218f13){_0x282c62=_0x282c62-0x0;var _0xf521c5=_0x8eb6[_0x282c62];return _0xf521c5;};'use strict';var Sequelize=require(_0x68eb('0x0'));module[_0x68eb('0x1')]={'closed':{'type':Sequelize[_0x68eb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x68eb('0x3')]},'disposition':{'type':Sequelize[_0x68eb('0x4')]},'secondDisposition':{'type':Sequelize[_0x68eb('0x4')]},'thirdDisposition':{'type':Sequelize[_0x68eb('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x68eb('0x3')]},'fax':{'type':Sequelize[_0x68eb('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x68eb('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x68eb('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x68eb('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6ce1=['STRING','DATE','ENUM','out','exports','BOOLEAN'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x6ce1,0xca));var _0x16ce=function(_0x2105a5,_0x1afbdd){_0x2105a5=_0x2105a5-0x0;var _0x5bfc3d=_0x6ce1[_0x2105a5];return _0x5bfc3d;};'use strict';var Sequelize=require('sequelize');module[_0x16ce('0x0')]={'closed':{'type':Sequelize[_0x16ce('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x16ce('0x2')]},'thirdDisposition':{'type':Sequelize[_0x16ce('0x2')]},'note':{'type':Sequelize[_0x16ce('0x2')]},'read1stAt':{'type':Sequelize[_0x16ce('0x3')]},'fax':{'type':Sequelize[_0x16ce('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x16ce('0x4')]('in',_0x16ce('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x16ce('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x16ce('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9b6a155..4c41e4a 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 _0x9451=['length','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','ContactId','buildExpression','text','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','FaxAccountId','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','FaxInteraction','fields','a.key','Account.key','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','catch','show','params','include','options','create','destroy','describe','FaxMessage','addMessage','ids','getMessages','FaxInteractionId','merge','includeAll','addTags','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','format','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','undefined','limit','offset','Content-Range','apply','save','update','then','end','error','stack','name','send','Users','map','TagIds','Tags','push','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions'];(function(_0x34acb2,_0x4b786c){var _0xf7f8f7=function(_0x3e8df6){while(--_0x3e8df6){_0x34acb2['push'](_0x34acb2['shift']());}};_0xf7f8f7(++_0x4b786c);}(_0x9451,0x7b));var _0x1945=function(_0x376432,_0x363a54){_0x376432=_0x376432-0x0;var _0x110efa=_0x9451[_0x376432];return _0x110efa;};'use strict';var emlformat=require(_0x1945('0x0'));var rimraf=require(_0x1945('0x1'));var zipdir=require(_0x1945('0x2'));var jsonpatch=require(_0x1945('0x3'));var rp=require(_0x1945('0x4'));var moment=require('moment');var BPromise=require(_0x1945('0x5'));var Mustache=require(_0x1945('0x6'));var util=require(_0x1945('0x7'));var path=require(_0x1945('0x8'));var sox=require(_0x1945('0x9'));var csv=require(_0x1945('0xa'));var ejs=require(_0x1945('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1945('0xc'));var squel=require(_0x1945('0xd'));var crypto=require('crypto');var jsforce=require(_0x1945('0xe'));var deskjs=require(_0x1945('0xf'));var toCsv=require(_0x1945('0xa'));var querystring=require(_0x1945('0x10'));var Papa=require(_0x1945('0x11'));var Redis=require(_0x1945('0x12'));var authService=require(_0x1945('0x13'));var qs=require(_0x1945('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1945('0x15'));var logger=require(_0x1945('0x16'))(_0x1945('0x17'));var utils=require('../../config/utils');var config=require(_0x1945('0x18'));var licenseUtil=require(_0x1945('0x19'));var db=require(_0x1945('0x1a'))['db'];config[_0x1945('0x1b')]=_[_0x1945('0x1c')](config[_0x1945('0x1b')],{'host':_0x1945('0x1d'),'port':0x18eb});var socket=require(_0x1945('0x1e'))(new Redis(config['redis']));require(_0x1945('0x1f'))[_0x1945('0x20')](socket);function respondWithStatusCode(_0x1f9227,_0x531087){_0x531087=_0x531087||0xcc;return function(_0x3d0bc2){if(_0x3d0bc2){return _0x1f9227[_0x1945('0x21')](_0x531087);}return _0x1f9227[_0x1945('0x22')](_0x531087)['end']();};}function respondWithResult(_0x47b3a4,_0x5cc400){_0x5cc400=_0x5cc400||0xc8;return function(_0x3b65dd){if(_0x3b65dd){return _0x47b3a4[_0x1945('0x22')](_0x5cc400)[_0x1945('0x23')](_0x3b65dd);}};}function respondWithFilteredResult(_0x31d718,_0x3b009c){return function(_0x27956c){if(_0x27956c){var _0x998bb=typeof _0x3b009c['offset']===_0x1945('0x24')&&typeof _0x3b009c[_0x1945('0x25')]===_0x1945('0x24');var _0x3c7188=_0x27956c['count'];var _0x29c990=_0x998bb?0x0:_0x3b009c[_0x1945('0x26')];var _0x4968fe=_0x998bb?_0x27956c['count']:_0x3b009c['offset']+_0x3b009c[_0x1945('0x25')];var _0x37cd26;if(_0x4968fe>=_0x3c7188){_0x4968fe=_0x3c7188;_0x37cd26=0xc8;}else{_0x37cd26=0xce;}_0x31d718[_0x1945('0x22')](_0x37cd26);return _0x31d718['set'](_0x1945('0x27'),_0x29c990+'-'+_0x4968fe+'/'+_0x3c7188)[_0x1945('0x23')](_0x27956c);}return null;};}function patchUpdates(_0x4e2a0f){return function(_0x25d6fe){try{jsonpatch[_0x1945('0x28')](_0x25d6fe,_0x4e2a0f,!![]);}catch(_0x3e0e20){return BPromise['reject'](_0x3e0e20);}return _0x25d6fe[_0x1945('0x29')]();};}function saveUpdates(_0x46eb5c,_0x3ffd73){return function(_0x462fd2){if(_0x462fd2){return _0x462fd2[_0x1945('0x2a')](_0x46eb5c)[_0x1945('0x2b')](function(_0x1a98f5){return _0x1a98f5;});}return null;};}function removeEntity(_0x1af947,_0x468c7e){return function(_0x444094){if(_0x444094){return _0x444094['destroy']()['then'](function(){_0x1af947[_0x1945('0x22')](0xcc)[_0x1945('0x2c')]();});}};}function handleEntityNotFound(_0x35ade7,_0x193931){return function(_0x3a3fbe){if(!_0x3a3fbe){_0x35ade7[_0x1945('0x21')](0x194);}return _0x3a3fbe;};}function handleError(_0x3512d1,_0x511aa0){_0x511aa0=_0x511aa0||0x1f4;return function(_0x660286){logger[_0x1945('0x2d')](_0x660286[_0x1945('0x2e')]);if(_0x660286[_0x1945('0x2f')]){delete _0x660286[_0x1945('0x2f')];}_0x3512d1[_0x1945('0x22')](_0x511aa0)[_0x1945('0x30')](_0x660286);};}function getInteractionUsers(_0x34954e,_0x2d7e4c){return new BPromise(function(_0x24ac28,_0x2a9219){try{if(_0x2d7e4c[_0x34954e['id']]){_0x34954e[_0x1945('0x31')]=_[_0x1945('0x32')](_0x2d7e4c[_0x34954e['id']],function(_0x31e8f5){return{'id':_0x31e8f5['id'],'fullname':_0x31e8f5['fullname']};});}}catch(_0x5917eb){_0x2a9219(_0x5917eb);}_0x24ac28(_0x34954e);});}function getInteractionTags(_0x1d1577,_0x271747){return new BPromise(function(_0x4ec13b,_0x37c65f){try{if(_0x1d1577[_0x1945('0x33')]){_0x1d1577[_0x1945('0x34')]=[];_0x1d1577[_0x1945('0x33')]['split'](',')['forEach'](function(_0x412d44){_0x1d1577[_0x1945('0x34')][_0x1945('0x35')](_0x271747[_0x412d44]);});}delete _0x1d1577['TagIds'];}catch(_0xb7b889){_0x37c65f(_0xb7b889);}_0x4ec13b(_0x1d1577);});}function updateFaxInteraction(_0x59a883,_0x1688df,_0x50d37f){return new BPromise(function(_0x5f31ca,_0x393eca){return getInteractionUsers(_0x59a883,_0x50d37f)[_0x1945('0x2b')](function(_0xdb1e93){return getInteractionTags(_0xdb1e93,_0x1688df);})[_0x1945('0x2b')](function(_0x311d9c){_0x5f31ca(_0x311d9c);})['catch'](function(_0x2ed1f2){_0x393eca(_0x2ed1f2);});});}exports[_0x1945('0x36')]=function(_0x1b5987,_0xac317d){var _0x5e4e7a={},_0x41dcbc={},_0x4d2488={'count':0x0,'rows':[]};var _0x2bff7f=_[_0x1945('0x32')](db['FaxInteraction'][_0x1945('0x37')],function(_0x119c6f){return{'name':_0x119c6f[_0x1945('0x38')],'type':_0x119c6f[_0x1945('0x39')][_0x1945('0x3a')]};});_0x41dcbc[_0x1945('0x3b')]=_[_0x1945('0x32')](_0x2bff7f,_0x1945('0x2f'));_0x41dcbc['query']=_[_0x1945('0x3c')](_0x1b5987[_0x1945('0x3d')]);_0x41dcbc[_0x1945('0x3e')]=_[_0x1945('0x3f')](_0x41dcbc[_0x1945('0x3b')],_0x41dcbc[_0x1945('0x3d')]);_0x5e4e7a['attributes']=_[_0x1945('0x3f')](_0x41dcbc[_0x1945('0x3b')],qs['fields'](_0x1b5987[_0x1945('0x3d')]['fields']));_0x5e4e7a[_0x1945('0x40')]=_0x5e4e7a[_0x1945('0x40')]['length']?_0x5e4e7a[_0x1945('0x40')]:_0x41dcbc[_0x1945('0x3b')];if(!_0x1b5987['query'][_0x1945('0x41')](_0x1945('0x42'))){_0x5e4e7a[_0x1945('0x25')]=qs[_0x1945('0x25')](_0x1b5987['query']['limit']);_0x5e4e7a[_0x1945('0x26')]=qs[_0x1945('0x26')](_0x1b5987[_0x1945('0x3d')]['offset']);}_0x5e4e7a[_0x1945('0x43')]=qs[_0x1945('0x44')](_0x1b5987[_0x1945('0x3d')][_0x1945('0x44')]);_0x5e4e7a[_0x1945('0x45')]=qs[_0x1945('0x3e')](_['pick'](_0x1b5987[_0x1945('0x3d')],_0x41dcbc['filters']),_0x2bff7f);var _0x35cbd1=[];var _0x26859c=squel['select']()[_0x1945('0x46')]('id')['field'](_0x1945('0x2f'))['field'](_0x1945('0x47'))[_0x1945('0x48')](_0x1945('0x49'));var _0x2f9e93=squel[_0x1945('0x4a')]()[_0x1945('0x46')]('u.id')[_0x1945('0x46')](_0x1945('0x4b'))['field'](_0x1945('0x4c'))[_0x1945('0x48')]('user_has_fax_interactions','ui')['left_join'](_0x1945('0x4d'),'u',_0x1945('0x4e'));var _0x40efbd=squel[_0x1945('0x4a')]()['from']('fax_interactions','i')['left_join'](_0x1945('0x4f'),'c',_0x1945('0x50'))['left_join'](_0x1945('0x4d'),'o','o.id\x20=\x20i.UserId')[_0x1945('0x51')](_0x1945('0x52'),'a',_0x1945('0x53'))['left_join'](_0x1945('0x54'),'me',_0x1945('0x55'))[_0x1945('0x51')](_0x1945('0x56'),'it',_0x1945('0x57'))[_0x1945('0x51')]('tools_tags','t',_0x1945('0x58'));var _0x4ec029=squel['expr']();var _0x463730=[];var _0x16908d=squel[_0x1945('0x59')]();var _0xd7a349;if(_0x1b5987[_0x1945('0x3d')][_0x1945('0x5a')]){_0xd7a349=as[_0x1945('0x5b')](_0x1b5987[_0x1945('0x3d')]['search']);var _0x3ffd4a=_0xd7a349['sqlOperator'];for(var _0x1e3e7c=0x0;_0x1e3e7c<_0xd7a349[_0x1945('0x5c')][_0x1945('0x5d')];_0x1e3e7c++){var _0x5f0186=_0xd7a349[_0x1945('0x5c')][_0x1e3e7c];var _0x1178d0='i';var _0x307627=_[_0x1945('0x5e')](_0x2bff7f,[_0x1945('0x2f'),_0x5f0186[_0x1945('0x46')]]);if(!_0x307627){switch(_0x5f0186[_0x1945('0x46')]){case _0x1945('0x5f'):if(_0x5f0186[_0x1945('0x60')]==0x1){_0x40efbd['having']('`'+_0x5f0186[_0x1945('0x46')]+_0x1945('0x61'));}else{_0x40efbd[_0x1945('0x62')]('`'+_0x5f0186[_0x1945('0x46')]+_0x1945('0x63'));}break;case _0x1945('0x64'):if(_0x5f0186[_0x1945('0x65')]===_0x1945('0x66')){if(_0x5f0186['value'][_0x1945('0x67')]('\x20')[_0x1945('0x5d')]>0x1){_0x4ec029[_0x3ffd4a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1945('0x68')](_0x5f0186[_0x1945('0x60')]),null);}else{var _0x35185a='%'+_0x5f0186[_0x1945('0x60')]+'%';_0x4ec029[_0x3ffd4a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x35185a,_0x35185a,_0x35185a);}}else{_0x307627=_[_0x1945('0x5e')](_0x2bff7f,[_0x1945('0x2f'),_0x1945('0x69')]);_0x5f0186[_0x1945('0x46')]='ContactId';_0x1f10db=as[_0x1945('0x6a')](_0x1178d0,_0x307627[_0x1945('0x39')],_0x5f0186);_0x4ec029[_0x3ffd4a](_0x1f10db[_0x1945('0x6b')],_0x1f10db[_0x1945('0x60')]['start'],_0x1f10db[_0x1945('0x60')][_0x1945('0x2c')]);}break;case _0x1945('0x6c'):var _0x38e459=_0x5f0186[_0x1945('0x60')]['split'](',')[_0x1945('0x32')](function(_0x45866d){return Number(_0x45866d);});_0x38e459[_0x1945('0x6d')](function(_0x9391ad){_0x16908d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x9391ad+',%');});_0x463730=_[_0x1945('0x6e')](_0x463730,_0x38e459);break;case _0x1945('0x6f'):if(_0x5f0186[_0x1945('0x65')]===_0x1945('0x66')){_0x4ec029[_0x3ffd4a](_0x1945('0x70'),'%'+_0x5f0186[_0x1945('0x60')]+'%',null);}else{_0x307627=_[_0x1945('0x5e')](_0x2bff7f,['name',_0x1945('0x71')]);_0x5f0186['field']=_0x1945('0x71');_0x1f10db=as[_0x1945('0x6a')](_0x1178d0,_0x307627['type'],_0x5f0186);_0x4ec029[_0x3ffd4a](_0x1f10db[_0x1945('0x6b')],_0x1f10db['value'][_0x1945('0x72')],_0x1f10db[_0x1945('0x60')][_0x1945('0x2c')]);}break;case _0x1945('0x73'):_0x1f10db=as[_0x1945('0x6a')]('me',null,_0x5f0186);_0x4ec029[_0x3ffd4a](_0x1f10db[_0x1945('0x6b')],_0x1f10db['value'][_0x1945('0x72')],_0x1f10db[_0x1945('0x60')][_0x1945('0x2c')]);break;}}else{var _0x1f10db=as['buildExpression'](_0x1178d0,_0x307627[_0x1945('0x39')],_0x5f0186);_0x4ec029[_0x3ffd4a](_0x1f10db[_0x1945('0x6b')],_0x1f10db[_0x1945('0x60')][_0x1945('0x72')],_0x1f10db[_0x1945('0x60')][_0x1945('0x2c')]);}}}else{var _0x439957=_(_0x1b5987['query'])['keys']()[_0x1945('0x32')](function(_0x4ce60e){return _[_0x1945('0x74')](_0x2bff7f,[_0x1945('0x2f'),_0x4ce60e])?_0x4ce60e:undefined;})[_0x1945('0x75')]()['value']();if(!_[_0x1945('0x76')](_0x439957)){_0x439957[_0x1945('0x6d')](function(_0x2d50dc){if(_0x2d50dc===_0x1945('0x77')){_0x40efbd[_0x1945('0x45')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x1b5987['query'][_0x2d50dc]));}else if(_0x2d50dc===_0x1945('0x78')){var _0x3e95b4=JSON[_0x1945('0x79')](_0x1b5987[_0x1945('0x3d')][_0x2d50dc])[_0x1945('0x7a')];var _0x32be9d=JSON[_0x1945('0x79')](_0x1b5987['query'][_0x2d50dc])[_0x1945('0x7b')];_0x40efbd['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3e95b4,_0x32be9d);}else{if(_0x1b5987[_0x1945('0x3d')][_0x2d50dc]===_0x1945('0x7c')){_0x40efbd[_0x1945('0x45')]('i.'+_0x2d50dc+_0x1945('0x7d'));}else{_0x40efbd['where']('i.'+_0x2d50dc+_0x1945('0x7e'),_0x1b5987[_0x1945('0x3d')][_0x2d50dc]);}}});}if(_0x1b5987['query']['read']){if(_0x1b5987[_0x1945('0x3d')][_0x1945('0x7f')]==0x1){_0x40efbd[_0x1945('0x62')](_0x1945('0x80'));}else{_0x40efbd[_0x1945('0x62')](_0x1945('0x81'));}}if(_0x1b5987[_0x1945('0x3d')][_0x1945('0x82')]){_0x463730=_[_0x1945('0x83')](_0x1b5987[_0x1945('0x3d')]['tag'])?_0x1b5987[_0x1945('0x3d')][_0x1945('0x82')]:new Array(_0x1b5987[_0x1945('0x3d')][_0x1945('0x82')]);_0x463730[_0x1945('0x6d')](function(_0x104c34){_0x16908d['or'](_0x1945('0x84'),'%,'+_0x104c34+',%');});}if(_0x1b5987[_0x1945('0x3d')]['filter']){var _0x5ac603=_0x1b5987[_0x1945('0x3d')][_0x1945('0x85')][_0x1945('0x86')]('\x5c','\x5c\x5c')[_0x1945('0x86')](/'/g,'\x27\x27');if(qs[_0x1945('0x87')](_0x5ac603)){_0x4ec029['or'](_0x1945('0x88'),_0x5ac603+'%')['or'](_0x1945('0x89'),_0x5ac603+'%');}_0x4ec029['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5ac603+'%');}}_0x40efbd['where'](_0x4ec029);_0x40efbd['group'](_0x1945('0x8a'));var _0x332a73={'type':db[_0x1945('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x5d7f94=_0x40efbd[_0x1945('0x8c')]();_0x5d7f94[_0x1945('0x46')]('i.id');_0x5d7f94['field'](_0x1945('0x8d'),_0x1945('0x5f'));if(_0x5e4e7a[_0x1945('0x43')]){_0x5e4e7a[_0x1945('0x43')][_0x1945('0x6d')](function(_0x1031e7){var _0x36fe23=_0x1031e7[0x0]===_0x1945('0x8e')?_0x1031e7[0x0]:'i.'+_0x1031e7[0x0];_0x40efbd['order'](_0x36fe23,_0x1031e7[0x1]===_0x1945('0x8f')?![]:!![]);});}if(!_[_0x1945('0x76')](_0x463730)){_0x40efbd[_0x1945('0x62')](_0x16908d);_0x5d7f94['where'](_0x1945('0x90'),_0x463730);}BPromise[_0x1945('0x91')]()['then'](function(){if(!_0xd7a349){if(_0x1b5987[_0x1945('0x3d')][_0x1945('0x77')])return;_0x5d7f94[_0x1945('0x45')](_0x1945('0x92'));_0x40efbd[_0x1945('0x45')](_0x1945('0x92'));return;}if(_0x1b5987['user'][_0x1945('0x93')]!==_0x1945('0x94'))return;return _0x1b5987[_0x1945('0x95')][_0x1945('0x96')]({'attributes':['id'],'raw':!![]})[_0x1945('0x2b')](function(_0x5addd7){if(_[_0x1945('0x76')](_0x5addd7)){_0x5d7f94[_0x1945('0x45')](_0x1945('0x97'));_0x40efbd[_0x1945('0x45')](_0x1945('0x97'));}else{_0x5d7f94['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x5addd7,'id'));_0x40efbd[_0x1945('0x45')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x5addd7,'id'));}});})['then'](function(){if(_0x1b5987['user'][_0x1945('0x93')]===_0x1945('0x94')&&!_0xd7a349&&!_0x1b5987['query']['FaxAccountId'])return[];return db[_0x1945('0x98')][_0x1945('0x3d')](_0x5d7f94[_0x1945('0x99')](),_0x332a73);})[_0x1945('0x2b')](function(_0x3336cd){_0x4d2488[_0x1945('0x9a')]=_0x3336cd[_0x1945('0x5d')];if(_0x4d2488[_0x1945('0x9a')]===0x0)return[];return db[_0x1945('0x98')][_0x1945('0x3d')](_0x26859c[_0x1945('0x99')](),_0x332a73)[_0x1945('0x2b')](function(_0x264cbc){_0x35cbd1=_[_0x1945('0x9b')](_0x264cbc,'id');_0x332a73=_['merge'](_0x332a73,{'model':db[_0x1945('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b5987[_0x1945('0x3d')][_0x1945('0x9d')]){_0x5e4e7a[_0x1945('0x40')][_0x1945('0x6d')](function(_0x177f26){_0x40efbd['field']('i.'+_0x177f26);});}else{_0x40efbd[_0x1945('0x46')](_0x1945('0x8d'),_0x1945('0x5f'));_0x40efbd[_0x1945('0x46')](_0x1945('0x9e'),_0x1945('0x9f'));_0x40efbd[_0x1945('0x46')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x40efbd[_0x1945('0x46')]('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',_0x1945('0x8e'));_0x40efbd[_0x1945('0x46')]('i.*');_0x40efbd['field'](_0x1945('0xa0'),'Contact.firstName');_0x40efbd[_0x1945('0x46')](_0x1945('0xa1'),_0x1945('0xa2'));_0x40efbd[_0x1945('0x46')](_0x1945('0xa3'),_0x1945('0xa4'));_0x40efbd[_0x1945('0x46')]('c.phone',_0x1945('0xa5'));_0x40efbd[_0x1945('0x46')](_0x1945('0xa6'),'Contact.mobile');_0x40efbd['field'](_0x1945('0xa7'),_0x1945('0xa8'));_0x40efbd['field'](_0x1945('0xa9'),_0x1945('0xaa'));_0x40efbd[_0x1945('0x46')]('o.internal',_0x1945('0xab'));_0x40efbd[_0x1945('0x46')](_0x1945('0xac'),_0x1945('0x33'));}if(_0x5e4e7a['limit'])_0x40efbd[_0x1945('0x25')](_0x5e4e7a[_0x1945('0x25')]);if(_0x5e4e7a[_0x1945('0x26')])_0x40efbd[_0x1945('0x26')](_0x5e4e7a[_0x1945('0x26')]);return db[_0x1945('0x98')]['query'](_0x40efbd['toString'](),_0x332a73);})[_0x1945('0x2b')](function(_0x244cc6){if(_0x244cc6[_0x1945('0x5d')]>0x0)_0x2f9e93[_0x1945('0x45')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x244cc6,'id'));return db[_0x1945('0x98')][_0x1945('0x3d')](_0x2f9e93[_0x1945('0x99')](),_0x332a73)[_0x1945('0x2b')](function(_0x27b4a3){var _0x2f4738=_[_0x1945('0xad')](_0x27b4a3,'FaxInteractionId');var _0x41f603=[];_0x244cc6[_0x1945('0x6d')](function(_0xc1f70f){_0x41f603[_0x1945('0x35')](updateFaxInteraction(_0xc1f70f,_0x35cbd1,_0x2f4738));});return BPromise[_0x1945('0xae')](_0x41f603);});});})[_0x1945('0x2b')](function(_0x4ddb6d){_0x4d2488['rows']=_0x4ddb6d;return _0x4d2488;})[_0x1945('0x2b')](respondWithFilteredResult(_0xac317d,_0x5e4e7a))[_0x1945('0xaf')](handleError(_0xac317d,null));};exports[_0x1945('0xb0')]=function(_0x13e861,_0x5f41d7){var _0x21eb6a={'raw':![],'where':{'id':_0x13e861[_0x1945('0xb1')]['id']}},_0xd525ff={};_0xd525ff[_0x1945('0x3b')]=_[_0x1945('0x3c')](db[_0x1945('0x9c')]['rawAttributes']);_0xd525ff['query']=_[_0x1945('0x3c')](_0x13e861[_0x1945('0x3d')]);_0xd525ff['filters']=_[_0x1945('0x3f')](_0xd525ff['model'],_0xd525ff[_0x1945('0x3d')]);_0x21eb6a['attributes']=_[_0x1945('0x3f')](_0xd525ff[_0x1945('0x3b')],qs[_0x1945('0x9d')](_0x13e861[_0x1945('0x3d')][_0x1945('0x9d')]));_0x21eb6a[_0x1945('0x40')]=_0x21eb6a[_0x1945('0x40')][_0x1945('0x5d')]?_0x21eb6a[_0x1945('0x40')]:_0xd525ff[_0x1945('0x3b')];if(_0x13e861[_0x1945('0x3d')]['includeAll']){_0x21eb6a[_0x1945('0xb2')]=[{'all':!![]}];}_0x21eb6a=_['merge']({},_0x21eb6a,_0x13e861[_0x1945('0xb3')]);return db[_0x1945('0x9c')]['find'](_0x21eb6a)[_0x1945('0x2b')](handleEntityNotFound(_0x5f41d7,null))[_0x1945('0x2b')](respondWithResult(_0x5f41d7,null))[_0x1945('0xaf')](handleError(_0x5f41d7,null));};exports[_0x1945('0xb4')]=function(_0x15c63e,_0x3fe8df){return db[_0x1945('0x9c')]['create'](_0x15c63e[_0x1945('0x73')],{})[_0x1945('0x2b')](respondWithResult(_0x3fe8df,0xc9))[_0x1945('0xaf')](handleError(_0x3fe8df,null));};exports[_0x1945('0x2a')]=function(_0x42c60b,_0x403965){if(_0x42c60b[_0x1945('0x73')]['id']){delete _0x42c60b[_0x1945('0x73')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x42c60b[_0x1945('0xb1')]['id']}})[_0x1945('0x2b')](handleEntityNotFound(_0x403965,null))[_0x1945('0x2b')](saveUpdates(_0x42c60b[_0x1945('0x73')],null))[_0x1945('0x2b')](respondWithResult(_0x403965,null))[_0x1945('0xaf')](handleError(_0x403965,null));};exports[_0x1945('0xb5')]=function(_0x111a3a,_0x305335){return db[_0x1945('0x9c')][_0x1945('0x5e')]({'where':{'id':_0x111a3a[_0x1945('0xb1')]['id']}})[_0x1945('0x2b')](handleEntityNotFound(_0x305335,null))[_0x1945('0x2b')](removeEntity(_0x305335,null))[_0x1945('0xaf')](handleError(_0x305335,null));};exports[_0x1945('0xb6')]=function(_0x2abceb,_0x2779df){return db['FaxInteraction'][_0x1945('0xb6')]()[_0x1945('0x2b')](respondWithResult(_0x2779df,null))[_0x1945('0xaf')](handleError(_0x2779df,null));};exports['addMessage']=function(_0x18c3cb,_0x4e91e8,_0x1874bc){return db[_0x1945('0xb7')]['find']({'where':{'id':_0x18c3cb[_0x1945('0xb1')]['id']}})[_0x1945('0x2b')](handleEntityNotFound(_0x4e91e8,null))[_0x1945('0x2b')](function(_0x3bb929){if(_0x3bb929){return _0x3bb929[_0x1945('0xb8')](_0x18c3cb[_0x1945('0x73')][_0x1945('0xb9')],_['omit'](_0x18c3cb['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4e91e8,null))[_0x1945('0xaf')](handleError(_0x4e91e8,null));};exports[_0x1945('0xba')]=function(_0x4d1265,_0x3fc2ce,_0xe7658){var _0x2c39f5={'raw':![],'where':{}};var _0x20aea8={};var _0x2e7bf6={'count':0x0,'rows':[]};return db[_0x1945('0x9c')]['findOne']({'where':{'id':_0x4d1265[_0x1945('0xb1')]['id']}})[_0x1945('0x2b')](handleEntityNotFound(_0x3fc2ce,null))['then'](function(_0x570512){if(_0x570512){_0x20aea8[_0x1945('0x3b')]=_[_0x1945('0x3c')](db['FaxMessage']['rawAttributes']);_0x20aea8[_0x1945('0x3d')]=_['keys'](_0x4d1265[_0x1945('0x3d')]);_0x20aea8[_0x1945('0x3e')]=_['intersection'](_0x20aea8['model'],_0x20aea8[_0x1945('0x3d')]);_0x2c39f5['attributes']=_[_0x1945('0x3f')](_0x20aea8[_0x1945('0x3b')],qs[_0x1945('0x9d')](_0x4d1265[_0x1945('0x3d')]['fields']));_0x2c39f5['attributes']=_0x2c39f5[_0x1945('0x40')][_0x1945('0x5d')]?_0x2c39f5[_0x1945('0x40')]:_0x20aea8[_0x1945('0x3b')];if(!_0x4d1265[_0x1945('0x3d')][_0x1945('0x41')](_0x1945('0x42'))){_0x2c39f5['limit']=qs['limit'](_0x4d1265['query'][_0x1945('0x25')]);_0x2c39f5[_0x1945('0x26')]=qs['offset'](_0x4d1265[_0x1945('0x3d')]['offset']);}_0x2c39f5['order']=qs[_0x1945('0x44')](_0x4d1265[_0x1945('0x3d')][_0x1945('0x44')]);_0x2c39f5[_0x1945('0x45')]=qs[_0x1945('0x3e')](_['pick'](_0x4d1265[_0x1945('0x3d')],_0x20aea8[_0x1945('0x3e')]));_0x2c39f5['where'][_0x1945('0xbb')]=_0x570512['id'];if(_0x4d1265[_0x1945('0x3d')]['filter']){_0x2c39f5[_0x1945('0x45')]=_[_0x1945('0xbc')](_0x2c39f5['where'],{'$or':_[_0x1945('0x32')](_0x2c39f5[_0x1945('0x40')],function(_0xb572b6){var _0x39e69f={};_0x39e69f[_0xb572b6]={'$like':'%'+_0x4d1265[_0x1945('0x3d')][_0x1945('0x85')]+'%'};return _0x39e69f;})});}if(_0x4d1265[_0x1945('0x3d')][_0x1945('0x7a')]){var _0x39fa93=_0x4d1265[_0x1945('0x3d')]['$gte'][_0x1945('0x67')](',');var _0x5b65fd={};_0x5b65fd[_0x39fa93[0x0]]={'$gte':moment(_0x39fa93[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2c39f5[_0x1945('0x45')]=_['merge'](_0x2c39f5[_0x1945('0x45')],_0x5b65fd);}_0x2c39f5=_[_0x1945('0xbc')]({},_0x2c39f5,_0x4d1265['options']);return db[_0x1945('0xb7')][_0x1945('0x9a')]({'where':_0x2c39f5[_0x1945('0x45')]})[_0x1945('0x2b')](function(_0x26c2c2){_0x2e7bf6[_0x1945('0x9a')]=_0x26c2c2;if(_0x4d1265[_0x1945('0x3d')][_0x1945('0xbd')]){_0x2c39f5[_0x1945('0xb2')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2c39f5);})['then'](function(_0x82ca29){_0x2e7bf6['rows']=_0x82ca29;return _0x2e7bf6;});}})[_0x1945('0x2b')](respondWithFilteredResult(_0x3fc2ce,_0x2c39f5))[_0x1945('0xaf')](handleError(_0x3fc2ce,null));};exports[_0x1945('0xbe')]=function(_0x1da562,_0x519176,_0x1de478){return db[_0x1945('0x9c')][_0x1945('0x5e')]({'where':{'id':_0x1da562[_0x1945('0xb1')]['id']}})[_0x1945('0x2b')](handleEntityNotFound(_0x519176,null))[_0x1945('0x2b')](function(_0x235861){if(_0x235861){return _0x235861[_0x1945('0xbf')](_0x1da562['body'][_0x1945('0xb9')],_[_0x1945('0xc0')](_0x1da562[_0x1945('0x73')],[_0x1945('0xb9'),'id'])||{})[_0x1945('0xc1')](function(){return db[_0x1945('0x6c')]['findAll']({'attributes':['id',_0x1945('0x2f'),_0x1945('0x47')],'where':{'id':_0x1da562[_0x1945('0x73')][_0x1945('0xb9')]}});})['then'](function(_0x36cf22){socket[_0x1945('0xc2')](_0x1945('0xc3'),{'id':Number(_0x1da562[_0x1945('0xb1')]['id']),'tags':_0x36cf22||[]});return{'id':Number(_0x1da562[_0x1945('0xb1')]['id']),'tags':_0x36cf22||[]};});}})[_0x1945('0x2b')](respondWithResult(_0x519176,null))[_0x1945('0xaf')](handleError(_0x519176,null));};exports[_0x1945('0xc4')]=function(_0x5254e2,_0x20c678,_0xb508a0){return db[_0x1945('0x9c')][_0x1945('0x5e')]({'where':{'id':_0x5254e2[_0x1945('0xb1')]['id']}})['then'](handleEntityNotFound(_0x20c678,null))['then'](function(_0x59890d){if(_0x59890d){return _0x59890d['removeTags'](_0x5254e2['query'][_0x1945('0xb9')]);}})[_0x1945('0x2b')](respondWithStatusCode(_0x20c678,null))[_0x1945('0xaf')](handleError(_0x20c678,null));};exports[_0x1945('0xc5')]=function(_0x52fb6b,_0x14d6ff){var _0xcbd25=moment()[_0x1945('0xc6')]()[_0x1945('0x99')]();var _0x3a20bd=path[_0x1945('0xc7')](config['root'],_0x1945('0xc8'),_0x1945('0xc9'),_0x1945('0xca'));var _0x4bdee3=path[_0x1945('0xc7')](config[_0x1945('0xcb')],_0x1945('0xc8'),_0x1945('0xc9'),'attachments');var _0x20d6d8=path['join'](_0x3a20bd,_0xcbd25);var _0x4cfce4=util[_0x1945('0xcc')]('transcript-%d-%s.zip',_0x52fb6b['params']['id'],_0xcbd25);var _0x2cdb6a=path[_0x1945('0xc7')](_0x3a20bd,_0x4cfce4);var _0x2bf203=[];_0x2bf203[_0x1945('0x35')]({'model':db['Attachment'],'as':_0x1945('0xcd'),'raw':!![]});var _0x3e1b65=[{'model':db[_0x1945('0xb7')],'as':_0x1945('0xce'),'attributes':['id','body',_0x1945('0x78')],'include':_0x2bf203}];return db[_0x1945('0x9c')]['find']({'where':{'id':_0x52fb6b[_0x1945('0xb1')]['id']},'include':_0x3e1b65})[_0x1945('0x2b')](handleEntityNotFound(_0x14d6ff,null))['then'](function(_0x11ca98){if(_0x11ca98&&_0x11ca98['Messages']){var _0x152ebd=_0x11ca98[_0x1945('0xcf')]({'plain':!![]});fs[_0x1945('0xd0')](_0x20d6d8);for(var _0x403f34=0x0;_0x403f34<_0x152ebd[_0x1945('0xce')][_0x1945('0x5d')];_0x403f34++){var _0x359da5=_0x152ebd[_0x1945('0xce')][_0x403f34][_0x1945('0xcd')];if(_0x359da5){var _0x170212=path[_0x1945('0xc7')](_0x4bdee3,_0x359da5[_0x1945('0xd1')]);if(fs[_0x1945('0xd2')](_0x170212)){fs[_0x1945('0xd3')](_0x170212)[_0x1945('0xd4')](fs[_0x1945('0xd5')](path['join'](_0x20d6d8,_0x359da5['basename'])));}}}return BPromise['resolve']()[_0x1945('0x2b')](function(){return new BPromise(function(_0x42e4e5,_0x2d6230){zipdir(_0x20d6d8,{'saveTo':_0x2cdb6a},function(_0x27b787,_0x297ac9){if(_0x27b787)return _0x2d6230(_0x27b787);return _0x42e4e5(_0x297ac9);});})[_0x1945('0x2b')](function(){return new BPromise(function(_0x7a9aed,_0x3ddeb6){rimraf(_0x20d6d8,function(_0x4d48a7){if(_0x4d48a7)_0x3ddeb6(_0x4d48a7);return _0x7a9aed();});});})[_0x1945('0x2b')](function(){return _0x14d6ff[_0x1945('0xc5')](_0x2cdb6a,_0x4cfce4,function(_0x43f474){if(_0x43f474){console['log'](_0x1945('0xd6'),_0x43f474);}else{fs[_0x1945('0xd7')](_0x2cdb6a);}});});});}else{return _0x14d6ff[_0x1945('0x21')](0xc8);}})[_0x1945('0xaf')](handleError(_0x14d6ff,null));}; \ No newline at end of file +var _0x0ee3=['me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','expr','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','i.FaxAccountId\x20IS\x20NULL','user','role','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','all','rows','show','params','include','merge','options','create','describe','addMessage','ids','omit','getMessages','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','unlinkSync','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','Users','fullname','TagIds','Tags','split','forEach','catch','map','FaxInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','field','color','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','fax_messages'];(function(_0x538bd5,_0x182492){var _0x49f4c3=function(_0x19344e){while(--_0x19344e){_0x538bd5['push'](_0x538bd5['shift']());}};_0x49f4c3(++_0x182492);}(_0x0ee3,0x7e));var _0x30ee=function(_0x5c0867,_0x3a992b){_0x5c0867=_0x5c0867-0x0;var _0x5933e7=_0x0ee3[_0x5c0867];return _0x5933e7;};'use strict';var emlformat=require(_0x30ee('0x0'));var rimraf=require(_0x30ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x30ee('0x2'));var Mustache=require(_0x30ee('0x3'));var util=require(_0x30ee('0x4'));var path=require(_0x30ee('0x5'));var sox=require(_0x30ee('0x6'));var csv=require(_0x30ee('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30ee('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x30ee('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x30ee('0x7'));var querystring=require(_0x30ee('0xa'));var Papa=require(_0x30ee('0xb'));var Redis=require(_0x30ee('0xc'));var authService=require(_0x30ee('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x30ee('0xe'));var config=require(_0x30ee('0xf'));var licenseUtil=require(_0x30ee('0x10'));var db=require(_0x30ee('0x11'))['db'];config[_0x30ee('0x12')]=_[_0x30ee('0x13')](config['redis'],{'host':_0x30ee('0x14'),'port':0x18eb});var socket=require(_0x30ee('0x15'))(new Redis(config[_0x30ee('0x12')]));require(_0x30ee('0x16'))['register'](socket);function respondWithStatusCode(_0xecd9db,_0x3ed037){_0x3ed037=_0x3ed037||0xcc;return function(_0x1c2aa8){if(_0x1c2aa8){return _0xecd9db[_0x30ee('0x17')](_0x3ed037);}return _0xecd9db['status'](_0x3ed037)[_0x30ee('0x18')]();};}function respondWithResult(_0x1f10d4,_0x5aa9cb){_0x5aa9cb=_0x5aa9cb||0xc8;return function(_0x33812e){if(_0x33812e){return _0x1f10d4[_0x30ee('0x19')](_0x5aa9cb)[_0x30ee('0x1a')](_0x33812e);}};}function respondWithFilteredResult(_0xc26de3,_0x808dcc){return function(_0x3cced1){if(_0x3cced1){var _0x71dd2c=typeof _0x808dcc['offset']===_0x30ee('0x1b')&&typeof _0x808dcc[_0x30ee('0x1c')]==='undefined';var _0x1f6b90=_0x3cced1[_0x30ee('0x1d')];var _0x46dce6=_0x71dd2c?0x0:_0x808dcc[_0x30ee('0x1e')];var _0x50ac5d=_0x71dd2c?_0x3cced1['count']:_0x808dcc[_0x30ee('0x1e')]+_0x808dcc['limit'];var _0x2c715d;if(_0x50ac5d>=_0x1f6b90){_0x50ac5d=_0x1f6b90;_0x2c715d=0xc8;}else{_0x2c715d=0xce;}_0xc26de3[_0x30ee('0x19')](_0x2c715d);return _0xc26de3[_0x30ee('0x1f')](_0x30ee('0x20'),_0x46dce6+'-'+_0x50ac5d+'/'+_0x1f6b90)['json'](_0x3cced1);}return null;};}function patchUpdates(_0x550bca){return function(_0x3c2a9e){try{jsonpatch[_0x30ee('0x21')](_0x3c2a9e,_0x550bca,!![]);}catch(_0x2b3f33){return BPromise[_0x30ee('0x22')](_0x2b3f33);}return _0x3c2a9e[_0x30ee('0x23')]();};}function saveUpdates(_0x80b01d,_0x588e9f){return function(_0x5c5d0b){if(_0x5c5d0b){return _0x5c5d0b['update'](_0x80b01d)[_0x30ee('0x24')](function(_0x25dc71){return _0x25dc71;});}return null;};}function removeEntity(_0xfd39c8,_0x118f1a){return function(_0x15641c){if(_0x15641c){return _0x15641c[_0x30ee('0x25')]()[_0x30ee('0x24')](function(){_0xfd39c8['status'](0xcc)[_0x30ee('0x18')]();});}};}function handleEntityNotFound(_0x44bb88,_0x49b755){return function(_0x4f082f){if(!_0x4f082f){_0x44bb88['sendStatus'](0x194);}return _0x4f082f;};}function handleError(_0x4bc2e8,_0x4e88da){_0x4e88da=_0x4e88da||0x1f4;return function(_0x553a14){logger[_0x30ee('0x26')](_0x553a14[_0x30ee('0x27')]);if(_0x553a14[_0x30ee('0x28')]){delete _0x553a14[_0x30ee('0x28')];}_0x4bc2e8['status'](_0x4e88da)['send'](_0x553a14);};}function getInteractionUsers(_0xd4143c,_0x2b2d66){return new BPromise(function(_0x32585e,_0x32c992){try{if(_0x2b2d66[_0xd4143c['id']]){_0xd4143c[_0x30ee('0x29')]=_['map'](_0x2b2d66[_0xd4143c['id']],function(_0x265e1f){return{'id':_0x265e1f['id'],'fullname':_0x265e1f[_0x30ee('0x2a')]};});}}catch(_0x2a99fe){_0x32c992(_0x2a99fe);}_0x32585e(_0xd4143c);});}function getInteractionTags(_0x3fe587,_0x125dd7){return new BPromise(function(_0x36eb08,_0x106106){try{if(_0x3fe587[_0x30ee('0x2b')]){_0x3fe587[_0x30ee('0x2c')]=[];_0x3fe587['TagIds'][_0x30ee('0x2d')](',')[_0x30ee('0x2e')](function(_0x1cd352){_0x3fe587[_0x30ee('0x2c')]['push'](_0x125dd7[_0x1cd352]);});}delete _0x3fe587[_0x30ee('0x2b')];}catch(_0x4a9662){_0x106106(_0x4a9662);}_0x36eb08(_0x3fe587);});}function updateFaxInteraction(_0x3d88a8,_0x4dcc71,_0x1393ee){return new BPromise(function(_0x2157c6,_0x5ec0e7){return getInteractionUsers(_0x3d88a8,_0x1393ee)[_0x30ee('0x24')](function(_0x361f06){return getInteractionTags(_0x361f06,_0x4dcc71);})['then'](function(_0x3fbc28){_0x2157c6(_0x3fbc28);})[_0x30ee('0x2f')](function(_0x293fb2){_0x5ec0e7(_0x293fb2);});});}exports['index']=function(_0xa197b6,_0x11d02d){var _0x1b9ab9={},_0x5aabfc={},_0x46c85e={'count':0x0,'rows':[]};var _0x1d3584=_[_0x30ee('0x30')](db[_0x30ee('0x31')][_0x30ee('0x32')],function(_0x44c253){return{'name':_0x44c253[_0x30ee('0x33')],'type':_0x44c253[_0x30ee('0x34')]['key']};});_0x5aabfc[_0x30ee('0x35')]=_[_0x30ee('0x30')](_0x1d3584,_0x30ee('0x28'));_0x5aabfc[_0x30ee('0x36')]=_[_0x30ee('0x37')](_0xa197b6['query']);_0x5aabfc[_0x30ee('0x38')]=_[_0x30ee('0x39')](_0x5aabfc[_0x30ee('0x35')],_0x5aabfc[_0x30ee('0x36')]);_0x1b9ab9[_0x30ee('0x3a')]=_[_0x30ee('0x39')](_0x5aabfc['model'],qs[_0x30ee('0x3b')](_0xa197b6[_0x30ee('0x36')][_0x30ee('0x3b')]));_0x1b9ab9[_0x30ee('0x3a')]=_0x1b9ab9[_0x30ee('0x3a')][_0x30ee('0x3c')]?_0x1b9ab9['attributes']:_0x5aabfc['model'];if(!_0xa197b6[_0x30ee('0x36')][_0x30ee('0x3d')](_0x30ee('0x3e'))){_0x1b9ab9[_0x30ee('0x1c')]=qs[_0x30ee('0x1c')](_0xa197b6[_0x30ee('0x36')][_0x30ee('0x1c')]);_0x1b9ab9['offset']=qs['offset'](_0xa197b6[_0x30ee('0x36')][_0x30ee('0x1e')]);}_0x1b9ab9['order']=qs[_0x30ee('0x3f')](_0xa197b6[_0x30ee('0x36')][_0x30ee('0x3f')]);_0x1b9ab9[_0x30ee('0x40')]=qs[_0x30ee('0x38')](_[_0x30ee('0x41')](_0xa197b6[_0x30ee('0x36')],_0x5aabfc[_0x30ee('0x38')]),_0x1d3584);var _0x2b8f44=[];var _0x52c5a0=squel['select']()[_0x30ee('0x42')]('id')[_0x30ee('0x42')]('name')[_0x30ee('0x42')](_0x30ee('0x43'))['from'](_0x30ee('0x44'));var _0x453391=squel[_0x30ee('0x45')]()['field'](_0x30ee('0x46'))[_0x30ee('0x42')](_0x30ee('0x47'))['field'](_0x30ee('0x48'))[_0x30ee('0x49')](_0x30ee('0x4a'),'ui')[_0x30ee('0x4b')](_0x30ee('0x4c'),'u',_0x30ee('0x4d'));var _0x3c2c8e=squel['select']()['from'](_0x30ee('0x4e'),'i')['left_join'](_0x30ee('0x4f'),'c',_0x30ee('0x50'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x30ee('0x4b')](_0x30ee('0x51'),'a','a.id\x20=\x20i.FaxAccountId')[_0x30ee('0x4b')](_0x30ee('0x52'),'me',_0x30ee('0x53'))[_0x30ee('0x4b')](_0x30ee('0x54'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x30ee('0x4b')](_0x30ee('0x44'),'t','t.id\x20=\x20it.TagId');var _0x47e68a=squel[_0x30ee('0x55')]();var _0x3b5a73=[];var _0x3eb885=squel[_0x30ee('0x55')]();var _0xe636bb;if(_0xa197b6['query'][_0x30ee('0x56')]){_0xe636bb=as['parseSearch'](_0xa197b6[_0x30ee('0x36')][_0x30ee('0x56')]);var _0x1b61e0=_0xe636bb['sqlOperator'];for(var _0x4390db=0x0;_0x4390db<_0xe636bb['conditions'][_0x30ee('0x3c')];_0x4390db++){var _0x3a5fbc=_0xe636bb[_0x30ee('0x57')][_0x4390db];var _0x56a3af='i';var _0x289bd0=_[_0x30ee('0x58')](_0x1d3584,[_0x30ee('0x28'),_0x3a5fbc[_0x30ee('0x42')]]);if(!_0x289bd0){switch(_0x3a5fbc[_0x30ee('0x42')]){case _0x30ee('0x59'):if(_0x3a5fbc[_0x30ee('0x5a')]==0x1){_0x3c2c8e[_0x30ee('0x5b')]('`'+_0x3a5fbc[_0x30ee('0x42')]+'`\x20=\x200');}else{_0x3c2c8e[_0x30ee('0x5b')]('`'+_0x3a5fbc[_0x30ee('0x42')]+_0x30ee('0x5c'));}break;case _0x30ee('0x5d'):if(_0x3a5fbc[_0x30ee('0x5e')]===_0x30ee('0x5f')){if(_0x3a5fbc[_0x30ee('0x5a')][_0x30ee('0x2d')]('\x20')['length']>0x1){_0x47e68a[_0x1b61e0](_0x30ee('0x60'),qs[_0x30ee('0x61')](_0x3a5fbc[_0x30ee('0x5a')]),null);}else{var _0x10774d='%'+_0x3a5fbc[_0x30ee('0x5a')]+'%';_0x47e68a[_0x1b61e0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x10774d,_0x10774d,_0x10774d);}}else{_0x289bd0=_[_0x30ee('0x58')](_0x1d3584,['name',_0x30ee('0x62')]);_0x3a5fbc[_0x30ee('0x42')]=_0x30ee('0x62');_0x483e31=as[_0x30ee('0x63')](_0x56a3af,_0x289bd0[_0x30ee('0x34')],_0x3a5fbc);_0x47e68a[_0x1b61e0](_0x483e31[_0x30ee('0x64')],_0x483e31['value'][_0x30ee('0x65')],_0x483e31['value'][_0x30ee('0x18')]);}break;case _0x30ee('0x66'):var _0x278752=_0x3a5fbc[_0x30ee('0x5a')][_0x30ee('0x2d')](',')[_0x30ee('0x30')](function(_0x59c1ac){return Number(_0x59c1ac);});_0x278752[_0x30ee('0x2e')](function(_0x565ac3){_0x3eb885['or'](_0x30ee('0x67'),'%,'+_0x565ac3+',%');});_0x3b5a73=_[_0x30ee('0x68')](_0x3b5a73,_0x278752);break;case _0x30ee('0x69'):if(_0x3a5fbc[_0x30ee('0x5e')]==='$substring'){_0x47e68a[_0x1b61e0](_0x30ee('0x6a'),'%'+_0x3a5fbc[_0x30ee('0x5a')]+'%',null);}else{_0x289bd0=_[_0x30ee('0x58')](_0x1d3584,[_0x30ee('0x28'),_0x30ee('0x6b')]);_0x3a5fbc[_0x30ee('0x42')]=_0x30ee('0x6b');_0x483e31=as['buildExpression'](_0x56a3af,_0x289bd0['type'],_0x3a5fbc);_0x47e68a[_0x1b61e0](_0x483e31['text'],_0x483e31[_0x30ee('0x5a')]['start'],_0x483e31[_0x30ee('0x5a')]['end']);}break;case _0x30ee('0x6c'):_0x483e31=as[_0x30ee('0x63')]('me',null,_0x3a5fbc);_0x47e68a[_0x1b61e0](_0x483e31[_0x30ee('0x64')],_0x483e31[_0x30ee('0x5a')][_0x30ee('0x65')],_0x483e31[_0x30ee('0x5a')]['end']);break;}}else{var _0x483e31=as[_0x30ee('0x63')](_0x56a3af,_0x289bd0[_0x30ee('0x34')],_0x3a5fbc);_0x47e68a[_0x1b61e0](_0x483e31[_0x30ee('0x64')],_0x483e31[_0x30ee('0x5a')][_0x30ee('0x65')],_0x483e31[_0x30ee('0x5a')][_0x30ee('0x18')]);}}}else{var _0x2470b0=_(_0xa197b6[_0x30ee('0x36')])['keys']()['map'](function(_0x2bc5ec){return _['some'](_0x1d3584,[_0x30ee('0x28'),_0x2bc5ec])?_0x2bc5ec:undefined;})[_0x30ee('0x6d')]()[_0x30ee('0x5a')]();if(!_[_0x30ee('0x6e')](_0x2470b0)){_0x2470b0['forEach'](function(_0x2400f1){if(_0x2400f1==='FaxAccountId'){_0x3c2c8e['where'](_0x30ee('0x6f'),[][_0x30ee('0x70')](_0xa197b6[_0x30ee('0x36')][_0x2400f1]));}else if(_0x2400f1===_0x30ee('0x71')){var _0xcb1e9b=JSON[_0x30ee('0x72')](_0xa197b6['query'][_0x2400f1])[_0x30ee('0x73')];var _0x206beb=JSON[_0x30ee('0x72')](_0xa197b6[_0x30ee('0x36')][_0x2400f1])['$lte'];_0x3c2c8e[_0x30ee('0x40')](_0x30ee('0x74'),_0xcb1e9b,_0x206beb);}else{if(_0xa197b6[_0x30ee('0x36')][_0x2400f1]===_0x30ee('0x75')){_0x3c2c8e[_0x30ee('0x40')]('i.'+_0x2400f1+_0x30ee('0x76'));}else{_0x3c2c8e[_0x30ee('0x40')]('i.'+_0x2400f1+_0x30ee('0x77'),_0xa197b6['query'][_0x2400f1]);}}});}if(_0xa197b6[_0x30ee('0x36')]['read']){if(_0xa197b6['query'][_0x30ee('0x78')]==0x1){_0x3c2c8e[_0x30ee('0x5b')](_0x30ee('0x79'));}else{_0x3c2c8e[_0x30ee('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0xa197b6['query'][_0x30ee('0x7a')]){_0x3b5a73=_['isArray'](_0xa197b6[_0x30ee('0x36')][_0x30ee('0x7a')])?_0xa197b6[_0x30ee('0x36')][_0x30ee('0x7a')]:new Array(_0xa197b6[_0x30ee('0x36')][_0x30ee('0x7a')]);_0x3b5a73['forEach'](function(_0x523b43){_0x3eb885['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x523b43+',%');});}if(_0xa197b6[_0x30ee('0x36')][_0x30ee('0x7b')]){var _0x445fa7=_0xa197b6[_0x30ee('0x36')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x30ee('0x7c')](_0x445fa7)){_0x47e68a['or']('i.id\x20LIKE\x20?',_0x445fa7+'%')['or']('i.fax\x20LIKE\x20?',_0x445fa7+'%');}_0x47e68a['or'](_0x30ee('0x7d'),_0x445fa7+'%');}}_0x3c2c8e['where'](_0x47e68a);_0x3c2c8e[_0x30ee('0x7e')](_0x30ee('0x7f'));var _0xfa264e={'type':db[_0x30ee('0x80')]['QueryTypes'][_0x30ee('0x81')],'raw':!![]};var _0x4dfa81=_0x3c2c8e[_0x30ee('0x82')]();_0x4dfa81[_0x30ee('0x42')](_0x30ee('0x7f'));_0x4dfa81[_0x30ee('0x42')](_0x30ee('0x83'),_0x30ee('0x59'));if(_0x1b9ab9['order']){_0x1b9ab9[_0x30ee('0x84')][_0x30ee('0x2e')](function(_0x8196bd){var _0x4d833c=_0x8196bd[0x0]===_0x30ee('0x85')?_0x8196bd[0x0]:'i.'+_0x8196bd[0x0];_0x3c2c8e[_0x30ee('0x84')](_0x4d833c,_0x8196bd[0x1]===_0x30ee('0x86')?![]:!![]);});}if(!_['isEmpty'](_0x3b5a73)){_0x3c2c8e['having'](_0x3eb885);_0x4dfa81['where']('t.id\x20IN\x20?',_0x3b5a73);}BPromise[_0x30ee('0x87')]()[_0x30ee('0x24')](function(){if(!_0xe636bb){if(_0xa197b6['query'][_0x30ee('0x88')])return;_0x4dfa81[_0x30ee('0x40')](_0x30ee('0x89'));_0x3c2c8e['where'](_0x30ee('0x89'));return;}if(_0xa197b6['user']['role']!==_0x30ee('0x8a'))return;return _0xa197b6['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x30ee('0x24')](function(_0x5cd773){if(_['isEmpty'](_0x5cd773)){_0x4dfa81['where'](_0x30ee('0x8b'));_0x3c2c8e[_0x30ee('0x40')](_0x30ee('0x8b'));}else{_0x4dfa81[_0x30ee('0x40')](_0x30ee('0x6f'),_[_0x30ee('0x30')](_0x5cd773,'id'));_0x3c2c8e[_0x30ee('0x40')](_0x30ee('0x6f'),_[_0x30ee('0x30')](_0x5cd773,'id'));}});})[_0x30ee('0x24')](function(){if(_0xa197b6[_0x30ee('0x8c')][_0x30ee('0x8d')]===_0x30ee('0x8a')&&!_0xe636bb&&!_0xa197b6[_0x30ee('0x36')][_0x30ee('0x88')])return[];return db[_0x30ee('0x8e')][_0x30ee('0x36')](_0x4dfa81[_0x30ee('0x8f')](),_0xfa264e);})['then'](function(_0xf55172){_0x46c85e[_0x30ee('0x1d')]=_0xf55172['length'];if(_0x46c85e[_0x30ee('0x1d')]===0x0)return[];return db[_0x30ee('0x8e')][_0x30ee('0x36')](_0x52c5a0[_0x30ee('0x8f')](),_0xfa264e)[_0x30ee('0x24')](function(_0x354e0c){_0x2b8f44=_[_0x30ee('0x90')](_0x354e0c,'id');_0xfa264e=_['merge'](_0xfa264e,{'model':db[_0x30ee('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa197b6['query']['fields']){_0x1b9ab9[_0x30ee('0x3a')][_0x30ee('0x2e')](function(_0x3798a4){_0x3c2c8e[_0x30ee('0x42')]('i.'+_0x3798a4);});}else{_0x3c2c8e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3c2c8e[_0x30ee('0x42')]('a.key',_0x30ee('0x91'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x92'),_0x30ee('0x93'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x94'),_0x30ee('0x85'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x95'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x96'),'Contact.firstName');_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x97'),_0x30ee('0x98'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x99'),_0x30ee('0x9a'));_0x3c2c8e[_0x30ee('0x42')]('c.phone',_0x30ee('0x9b'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x9c'),_0x30ee('0x9d'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0x9e'),_0x30ee('0x9f'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0xa0'),'Owner.fullname');_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0xa1'),_0x30ee('0xa2'));_0x3c2c8e[_0x30ee('0x42')](_0x30ee('0xa3'),_0x30ee('0x2b'));}if(_0x1b9ab9[_0x30ee('0x1c')])_0x3c2c8e['limit'](_0x1b9ab9[_0x30ee('0x1c')]);if(_0x1b9ab9['offset'])_0x3c2c8e[_0x30ee('0x1e')](_0x1b9ab9[_0x30ee('0x1e')]);return db['sequelize'][_0x30ee('0x36')](_0x3c2c8e[_0x30ee('0x8f')](),_0xfa264e);})[_0x30ee('0x24')](function(_0x4f4157){if(_0x4f4157[_0x30ee('0x3c')]>0x0)_0x453391[_0x30ee('0x40')](_0x30ee('0xa4'),_[_0x30ee('0x30')](_0x4f4157,'id'));return db['sequelize'][_0x30ee('0x36')](_0x453391[_0x30ee('0x8f')](),_0xfa264e)['then'](function(_0x12ea91){var _0x21ce63=_[_0x30ee('0xa5')](_0x12ea91,_0x30ee('0xa6'));var _0x3aa2f8=[];_0x4f4157[_0x30ee('0x2e')](function(_0x21a743){_0x3aa2f8[_0x30ee('0xa7')](updateFaxInteraction(_0x21a743,_0x2b8f44,_0x21ce63));});return BPromise[_0x30ee('0xa8')](_0x3aa2f8);});});})['then'](function(_0x5f3a8f){_0x46c85e[_0x30ee('0xa9')]=_0x5f3a8f;return _0x46c85e;})[_0x30ee('0x24')](respondWithFilteredResult(_0x11d02d,_0x1b9ab9))['catch'](handleError(_0x11d02d,null));};exports[_0x30ee('0xaa')]=function(_0x47e023,_0xa24ee5){var _0x254392={'raw':![],'where':{'id':_0x47e023[_0x30ee('0xab')]['id']}},_0x2a0198={};_0x2a0198[_0x30ee('0x35')]=_['keys'](db[_0x30ee('0x31')]['rawAttributes']);_0x2a0198[_0x30ee('0x36')]=_[_0x30ee('0x37')](_0x47e023[_0x30ee('0x36')]);_0x2a0198[_0x30ee('0x38')]=_[_0x30ee('0x39')](_0x2a0198[_0x30ee('0x35')],_0x2a0198[_0x30ee('0x36')]);_0x254392[_0x30ee('0x3a')]=_[_0x30ee('0x39')](_0x2a0198['model'],qs['fields'](_0x47e023[_0x30ee('0x36')][_0x30ee('0x3b')]));_0x254392['attributes']=_0x254392['attributes'][_0x30ee('0x3c')]?_0x254392[_0x30ee('0x3a')]:_0x2a0198[_0x30ee('0x35')];if(_0x47e023[_0x30ee('0x36')]['includeAll']){_0x254392[_0x30ee('0xac')]=[{'all':!![]}];}_0x254392=_[_0x30ee('0xad')]({},_0x254392,_0x47e023[_0x30ee('0xae')]);return db['FaxInteraction'][_0x30ee('0x58')](_0x254392)[_0x30ee('0x24')](handleEntityNotFound(_0xa24ee5,null))[_0x30ee('0x24')](respondWithResult(_0xa24ee5,null))[_0x30ee('0x2f')](handleError(_0xa24ee5,null));};exports['create']=function(_0x357862,_0x2a15ec){return db[_0x30ee('0x31')][_0x30ee('0xaf')](_0x357862[_0x30ee('0x6c')],{})[_0x30ee('0x24')](respondWithResult(_0x2a15ec,0xc9))[_0x30ee('0x2f')](handleError(_0x2a15ec,null));};exports['update']=function(_0x4c6ec0,_0x54e2a3){if(_0x4c6ec0['body']['id']){delete _0x4c6ec0['body']['id'];}return db[_0x30ee('0x31')][_0x30ee('0x58')]({'where':{'id':_0x4c6ec0[_0x30ee('0xab')]['id']}})[_0x30ee('0x24')](handleEntityNotFound(_0x54e2a3,null))[_0x30ee('0x24')](saveUpdates(_0x4c6ec0[_0x30ee('0x6c')],null))[_0x30ee('0x24')](respondWithResult(_0x54e2a3,null))['catch'](handleError(_0x54e2a3,null));};exports['destroy']=function(_0x2aafd2,_0x330144){return db[_0x30ee('0x31')][_0x30ee('0x58')]({'where':{'id':_0x2aafd2['params']['id']}})[_0x30ee('0x24')](handleEntityNotFound(_0x330144,null))['then'](removeEntity(_0x330144,null))[_0x30ee('0x2f')](handleError(_0x330144,null));};exports[_0x30ee('0xb0')]=function(_0x1c10c0,_0x268dd7){return db['FaxInteraction'][_0x30ee('0xb0')]()['then'](respondWithResult(_0x268dd7,null))[_0x30ee('0x2f')](handleError(_0x268dd7,null));};exports[_0x30ee('0xb1')]=function(_0x2ff0b2,_0x2885a6,_0x11c06d){return db['FaxMessage'][_0x30ee('0x58')]({'where':{'id':_0x2ff0b2['params']['id']}})[_0x30ee('0x24')](handleEntityNotFound(_0x2885a6,null))[_0x30ee('0x24')](function(_0x435abd){if(_0x435abd){return _0x435abd['addMessage'](_0x2ff0b2[_0x30ee('0x6c')][_0x30ee('0xb2')],_[_0x30ee('0xb3')](_0x2ff0b2[_0x30ee('0x6c')],[_0x30ee('0xb2'),'id'])||{});}})[_0x30ee('0x24')](respondWithResult(_0x2885a6,null))[_0x30ee('0x2f')](handleError(_0x2885a6,null));};exports[_0x30ee('0xb4')]=function(_0x38d035,_0x5652be,_0x3ed08b){var _0xb737c={'raw':![],'where':{}};var _0x34973c={};var _0x24d0e8={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x38d035[_0x30ee('0xab')]['id']}})[_0x30ee('0x24')](handleEntityNotFound(_0x5652be,null))[_0x30ee('0x24')](function(_0xbd3a80){if(_0xbd3a80){_0x34973c[_0x30ee('0x35')]=_[_0x30ee('0x37')](db[_0x30ee('0xb5')][_0x30ee('0x32')]);_0x34973c['query']=_[_0x30ee('0x37')](_0x38d035[_0x30ee('0x36')]);_0x34973c[_0x30ee('0x38')]=_['intersection'](_0x34973c[_0x30ee('0x35')],_0x34973c[_0x30ee('0x36')]);_0xb737c[_0x30ee('0x3a')]=_[_0x30ee('0x39')](_0x34973c[_0x30ee('0x35')],qs[_0x30ee('0x3b')](_0x38d035['query'][_0x30ee('0x3b')]));_0xb737c['attributes']=_0xb737c[_0x30ee('0x3a')][_0x30ee('0x3c')]?_0xb737c[_0x30ee('0x3a')]:_0x34973c[_0x30ee('0x35')];if(!_0x38d035[_0x30ee('0x36')][_0x30ee('0x3d')](_0x30ee('0x3e'))){_0xb737c[_0x30ee('0x1c')]=qs[_0x30ee('0x1c')](_0x38d035['query'][_0x30ee('0x1c')]);_0xb737c[_0x30ee('0x1e')]=qs[_0x30ee('0x1e')](_0x38d035[_0x30ee('0x36')][_0x30ee('0x1e')]);}_0xb737c[_0x30ee('0x84')]=qs['sort'](_0x38d035[_0x30ee('0x36')]['sort']);_0xb737c[_0x30ee('0x40')]=qs[_0x30ee('0x38')](_[_0x30ee('0x41')](_0x38d035[_0x30ee('0x36')],_0x34973c['filters']));_0xb737c['where'][_0x30ee('0xa6')]=_0xbd3a80['id'];if(_0x38d035[_0x30ee('0x36')][_0x30ee('0x7b')]){_0xb737c[_0x30ee('0x40')]=_[_0x30ee('0xad')](_0xb737c['where'],{'$or':_[_0x30ee('0x30')](_0xb737c[_0x30ee('0x3a')],function(_0x1f2cea){var _0x573cf4={};_0x573cf4[_0x1f2cea]={'$like':'%'+_0x38d035[_0x30ee('0x36')]['filter']+'%'};return _0x573cf4;})});}if(_0x38d035[_0x30ee('0x36')][_0x30ee('0x73')]){var _0x352e5b=_0x38d035[_0x30ee('0x36')][_0x30ee('0x73')][_0x30ee('0x2d')](',');var _0x31dd6f={};_0x31dd6f[_0x352e5b[0x0]]={'$gte':moment(_0x352e5b[0x1])[_0x30ee('0xb6')](_0x30ee('0xb7'))};_0xb737c[_0x30ee('0x40')]=_[_0x30ee('0xad')](_0xb737c['where'],_0x31dd6f);}_0xb737c=_[_0x30ee('0xad')]({},_0xb737c,_0x38d035[_0x30ee('0xae')]);return db[_0x30ee('0xb5')][_0x30ee('0x1d')]({'where':_0xb737c[_0x30ee('0x40')]})[_0x30ee('0x24')](function(_0x2fda7e){_0x24d0e8['count']=_0x2fda7e;if(_0x38d035[_0x30ee('0x36')][_0x30ee('0xb8')]){_0xb737c['include']=[{'all':!![]}];}return db[_0x30ee('0xb5')][_0x30ee('0xb9')](_0xb737c);})[_0x30ee('0x24')](function(_0xfe423f){_0x24d0e8['rows']=_0xfe423f;return _0x24d0e8;});}})[_0x30ee('0x24')](respondWithFilteredResult(_0x5652be,_0xb737c))[_0x30ee('0x2f')](handleError(_0x5652be,null));};exports[_0x30ee('0xba')]=function(_0x4b76ef,_0x2a32af,_0x525407){return db['FaxInteraction'][_0x30ee('0x58')]({'where':{'id':_0x4b76ef[_0x30ee('0xab')]['id']}})[_0x30ee('0x24')](handleEntityNotFound(_0x2a32af,null))[_0x30ee('0x24')](function(_0x34b5f4){if(_0x34b5f4){return _0x34b5f4[_0x30ee('0xbb')](_0x4b76ef[_0x30ee('0x6c')]['ids'],_['omit'](_0x4b76ef[_0x30ee('0x6c')],['ids','id'])||{})[_0x30ee('0xbc')](function(){return db[_0x30ee('0x66')]['findAll']({'attributes':['id',_0x30ee('0x28'),_0x30ee('0x43')],'where':{'id':_0x4b76ef[_0x30ee('0x6c')][_0x30ee('0xb2')]}});})['then'](function(_0x5c0c1d){socket[_0x30ee('0xbd')](_0x30ee('0xbe'),{'id':Number(_0x4b76ef[_0x30ee('0xab')]['id']),'tags':_0x5c0c1d||[]});return{'id':Number(_0x4b76ef[_0x30ee('0xab')]['id']),'tags':_0x5c0c1d||[]};});}})[_0x30ee('0x24')](respondWithResult(_0x2a32af,null))[_0x30ee('0x2f')](handleError(_0x2a32af,null));};exports[_0x30ee('0xbf')]=function(_0x48237e,_0x2b3149,_0x1e6bb6){return db[_0x30ee('0x31')][_0x30ee('0x58')]({'where':{'id':_0x48237e[_0x30ee('0xab')]['id']}})[_0x30ee('0x24')](handleEntityNotFound(_0x2b3149,null))[_0x30ee('0x24')](function(_0x4a73b9){if(_0x4a73b9){return _0x4a73b9[_0x30ee('0xbf')](_0x48237e[_0x30ee('0x36')]['ids']);}})[_0x30ee('0x24')](respondWithStatusCode(_0x2b3149,null))[_0x30ee('0x2f')](handleError(_0x2b3149,null));};exports[_0x30ee('0xc0')]=function(_0x86ed82,_0x342059){var _0x8f09b6=moment()[_0x30ee('0xc1')]()[_0x30ee('0x8f')]();var _0x452629=path[_0x30ee('0xc2')](config['root'],_0x30ee('0xc3'),_0x30ee('0xc4'),_0x30ee('0xc5'));var _0x444752=path[_0x30ee('0xc2')](config[_0x30ee('0xc6')],_0x30ee('0xc3'),_0x30ee('0xc4'),_0x30ee('0xc7'));var _0x1a054c=path['join'](_0x452629,_0x8f09b6);var _0xcb6307=util[_0x30ee('0xb6')]('transcript-%d-%s.zip',_0x86ed82['params']['id'],_0x8f09b6);var _0x2808df=path[_0x30ee('0xc2')](_0x452629,_0xcb6307);var _0xe49265=[];_0xe49265[_0x30ee('0xa7')]({'model':db[_0x30ee('0xc8')],'as':'Attachment','raw':!![]});var _0x39f9bd=[{'model':db[_0x30ee('0xb5')],'as':_0x30ee('0xc9'),'attributes':['id','body','createdAt'],'include':_0xe49265}];return db[_0x30ee('0x31')][_0x30ee('0x58')]({'where':{'id':_0x86ed82[_0x30ee('0xab')]['id']},'include':_0x39f9bd})['then'](handleEntityNotFound(_0x342059,null))['then'](function(_0x4e30fc){if(_0x4e30fc&&_0x4e30fc[_0x30ee('0xc9')]){var _0x4908a7=_0x4e30fc['get']({'plain':!![]});fs[_0x30ee('0xca')](_0x1a054c);for(var _0x50d577=0x0;_0x50d577<_0x4908a7[_0x30ee('0xc9')]['length'];_0x50d577++){var _0x707cd7=_0x4908a7[_0x30ee('0xc9')][_0x50d577]['Attachment'];if(_0x707cd7){var _0x3697a0=path[_0x30ee('0xc2')](_0x444752,_0x707cd7[_0x30ee('0xcb')]);if(fs[_0x30ee('0xcc')](_0x3697a0)){fs[_0x30ee('0xcd')](_0x3697a0)[_0x30ee('0xce')](fs[_0x30ee('0xcf')](path[_0x30ee('0xc2')](_0x1a054c,_0x707cd7[_0x30ee('0xcb')])));}}}return BPromise[_0x30ee('0x87')]()[_0x30ee('0x24')](function(){return new BPromise(function(_0x25b860,_0x1bc3f3){zipdir(_0x1a054c,{'saveTo':_0x2808df},function(_0x421ce8,_0x37883b){if(_0x421ce8)return _0x1bc3f3(_0x421ce8);return _0x25b860(_0x37883b);});})['then'](function(){return new BPromise(function(_0x4d256c,_0x9b2514){rimraf(_0x1a054c,function(_0x4e14ef){if(_0x4e14ef)_0x9b2514(_0x4e14ef);return _0x4d256c();});});})[_0x30ee('0x24')](function(){return _0x342059[_0x30ee('0xc0')](_0x2808df,_0xcb6307,function(_0x421144){if(_0x421144){console['log']('err',_0x421144);}else{fs[_0x30ee('0xd0')](_0x2808df);}});});});}else{return _0x342059[_0x30ee('0x17')](0xc8);}})['catch'](handleError(_0x342059,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index cdf1ea7..2b9f6c2 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 _0x842a=['setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','FaxMessage'];(function(_0x398389,_0x405c29){var _0x2305f9=function(_0x523002){while(--_0x523002){_0x398389['push'](_0x398389['shift']());}};_0x2305f9(++_0x405c29);}(_0x842a,0x1dd));var _0xa842=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0x842a[_0x295a3d];return _0x23a732;};'use strict';var EventEmitter=require(_0xa842('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xa842('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xa842('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa842('0x3')](0x0);var events={'afterCreate':_0xa842('0x4'),'afterUpdate':_0xa842('0x5'),'afterDestroy':_0xa842('0x6')};function emitEvent(_0x1da47c){return function(_0x113df5,_0x40ac04,_0x2868de){_0x113df5[_0xa842('0x7')]({'attributes':['id'],'raw':!![]})[_0xa842('0x8')](function(_0x1ab83d){_0x113df5['setDataValue'](_0xa842('0x9'),_0x1ab83d[_0xa842('0xa')](function(_0x2660f0){return{'id':_0x2660f0['id']};}));return FaxMessage[_0xa842('0xb')]({'where':{'FaxInteractionId':_0x113df5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4c4e55){_0x113df5[_0xa842('0xc')](_0xa842('0xd'),_0x4c4e55[_0xa842('0xe')]);FaxInteractionEvents['emit'](_0x1da47c+':'+_0x113df5['id'],_0x113df5);FaxInteractionEvents[_0xa842('0xf')](_0x1da47c,_0x113df5);_0x2868de(null);})[_0xa842('0x10')](_0x2868de(null));};}for(var e in events){if(events[_0xa842('0x11')](e)){var event=events[e];FaxInteraction[_0xa842('0x12')](e,emitEvent(event));}}module[_0xa842('0x13')]=FaxInteractionEvents; \ No newline at end of file +var _0x083f=['hook','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5a3674,_0x586d0c){var _0x144f53=function(_0x21821a){while(--_0x21821a){_0x5a3674['push'](_0x5a3674['shift']());}};_0x144f53(++_0x586d0c);}(_0x083f,0x190));var _0xf083=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x083f[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xf083('0x0'));var FaxInteraction=require(_0xf083('0x1'))['db'][_0xf083('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xf083('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf083('0x4'),'afterUpdate':_0xf083('0x5'),'afterDestroy':_0xf083('0x6')};function emitEvent(_0x5e70cd){return function(_0x452160,_0x11c226,_0x548088){_0x452160[_0xf083('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x402bf2){_0x452160[_0xf083('0x8')](_0xf083('0x9'),_0x402bf2[_0xf083('0xa')](function(_0x31e829){return{'id':_0x31e829['id']};}));return FaxMessage[_0xf083('0xb')]({'where':{'FaxInteractionId':_0x452160['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf083('0xc')](function(_0x2a856c){_0x452160[_0xf083('0x8')](_0xf083('0xd'),_0x2a856c[_0xf083('0xe')]);FaxInteractionEvents['emit'](_0x5e70cd+':'+_0x452160['id'],_0x452160);FaxInteractionEvents[_0xf083('0xf')](_0x5e70cd,_0x452160);_0x548088(null);})[_0xf083('0x10')](_0x548088(null));};}for(var e in events){if(events[_0xf083('0x11')](e)){var event=events[e];FaxInteraction[_0xf083('0x12')](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 3e702fc..82329ff 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 _0xa24f=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','request-promise','path'];(function(_0x103c2b,_0x3fed1d){var _0x24162a=function(_0x329cf8){while(--_0x329cf8){_0x103c2b['push'](_0x103c2b['shift']());}};_0x24162a(++_0x3fed1d);}(_0xa24f,0x118));var _0xfa24=function(_0x19f670,_0x36d23f){_0x19f670=_0x19f670-0x0;var _0x3ffd49=_0xa24f[_0x19f670];return _0x3ffd49;};'use strict';var _=require('lodash');var util=require(_0xfa24('0x0'));var logger=require(_0xfa24('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfa24('0x2'));var rp=require(_0xfa24('0x3'));var fs=require('fs');var path=require(_0xfa24('0x4'));var rimraf=require(_0xfa24('0x5'));var config=require(_0xfa24('0x6'));var attributes=require(_0xfa24('0x7'));module[_0xfa24('0x8')]=function(_0x5492e5,_0x487697){return _0x5492e5[_0xfa24('0x9')]('FaxInteraction',attributes,{'tableName':_0xfa24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x831fd1,_0x334511,_0x3ba1a9){if(_0x831fd1[_0xfa24('0xb')](_0xfa24('0xc'))){_0x831fd1[_0xfa24('0xd')]=moment()['format'](_0xfa24('0xe'));}_0x3ba1a9(null,_0x831fd1);}}});}; \ No newline at end of file +var _0x5330=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','closedAt','format'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x5330,0x13c));var _0x0533=function(_0x334391,_0x34153d){_0x334391=_0x334391-0x0;var _0x349941=_0x5330[_0x334391];return _0x349941;};'use strict';var _=require(_0x0533('0x0'));var util=require(_0x0533('0x1'));var logger=require(_0x0533('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0533('0x3'));var rimraf=require(_0x0533('0x4'));var config=require(_0x0533('0x5'));var attributes=require(_0x0533('0x6'));module[_0x0533('0x7')]=function(_0x3f22f4,_0x52f80b){return _0x3f22f4[_0x0533('0x8')](_0x0533('0x9'),attributes,{'tableName':_0x0533('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x245a50,_0x2e90ba,_0x3f83e8){if(_0x245a50['changed'](_0x0533('0xb'))){_0x245a50[_0x0533('0xc')]=moment()[_0x0533('0xd')](_0x0533('0xe'));}_0x3f83e8(null,_0x245a50);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 8dbf4f1..ca7a75d 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 _0xfd0b=['catch','AddTagsToFaxInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','debug'];(function(_0x3bfe87,_0x5db6d9){var _0x40a2db=function(_0x53a208){while(--_0x53a208){_0x3bfe87['push'](_0x3bfe87['shift']());}};_0x40a2db(++_0x5db6d9);}(_0xfd0b,0x1cb));var _0xbfd0=function(_0x5c41f5,_0xf1ff1a){_0x5c41f5=_0x5c41f5-0x0;var _0x213d67=_0xfd0b[_0x5c41f5];return _0x213d67;};'use strict';var _=require(_0xbfd0('0x0'));var util=require(_0xbfd0('0x1'));var moment=require(_0xbfd0('0x2'));var BPromise=require(_0xbfd0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfd0('0x4'));var db=require(_0xbfd0('0x5'))['db'];var utils=require(_0xbfd0('0x6'));var logger=require(_0xbfd0('0x7'))(_0xbfd0('0x8'));var config=require(_0xbfd0('0x9'));var jayson=require(_0xbfd0('0xa'));var client=jayson[_0xbfd0('0xb')][_0xbfd0('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xbfd0('0xd'),'port':0x18eb});var socket=require(_0xbfd0('0xe'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xbfd0('0xf')](socket);function respondWithRpcPromise(_0x31788e,_0x2eb8ec,_0x5ee5fd){return new BPromise(function(_0xb16f5f,_0x5c5912){return client[_0xbfd0('0x10')](_0x31788e,_0x5ee5fd)[_0xbfd0('0x11')](function(_0x3d6628){logger[_0xbfd0('0x12')](_0xbfd0('0x13'),_0x2eb8ec,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2eb8ec,_0xbfd0('0x14'),JSON[_0xbfd0('0x15')](_0x3d6628));if(_0x3d6628[_0xbfd0('0x16')]){if(_0x3d6628[_0xbfd0('0x16')]['code']===0x1f4){logger['error'](_0xbfd0('0x13'),_0x2eb8ec,_0x3d6628[_0xbfd0('0x16')][_0xbfd0('0x17')]);return _0x5c5912(_0x3d6628[_0xbfd0('0x16')][_0xbfd0('0x17')]);}logger[_0xbfd0('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x2eb8ec,_0x3d6628['error'][_0xbfd0('0x17')]);return _0xb16f5f(_0x3d6628['error'][_0xbfd0('0x17')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x2eb8ec,_0xbfd0('0x14'));_0xb16f5f(_0x3d6628[_0xbfd0('0x18')][_0xbfd0('0x17')]);}})['catch'](function(_0x1e074d){logger[_0xbfd0('0x16')](_0xbfd0('0x13'),_0x2eb8ec,_0x1e074d);_0x5c5912(_0x1e074d);});});}exports[_0xbfd0('0x19')]=function(_0x69512f){var _0x1f57ae=this;return new Promise(function(_0x54f852,_0x4be10b){return db[_0xbfd0('0x1a')][_0xbfd0('0x1b')](_0x69512f['body'],{'raw':_0x69512f[_0xbfd0('0x1c')]?_0x69512f[_0xbfd0('0x1c')][_0xbfd0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x69512f[_0xbfd0('0x1c')]?_0x69512f[_0xbfd0('0x1c')][_0xbfd0('0x1e')]||null:null,'attributes':_0x69512f[_0xbfd0('0x1c')]?_0x69512f[_0xbfd0('0x1c')][_0xbfd0('0x1f')]||null:null,'limit':_0x69512f[_0xbfd0('0x1c')]?_0x69512f[_0xbfd0('0x1c')]['limit']||null:null})[_0xbfd0('0x11')](function(_0x52106d){logger[_0xbfd0('0x12')](_0xbfd0('0x19'),_0x69512f);logger[_0xbfd0('0x20')](_0xbfd0('0x19'),_0x69512f,JSON['stringify'](_0x52106d));_0x54f852(_0x52106d);})[_0xbfd0('0x21')](function(_0xa4fe33){logger['error'](_0xbfd0('0x19'),_0xa4fe33[_0xbfd0('0x17')],_0x69512f);_0x4be10b(_0x1f57ae[_0xbfd0('0x16')](0x1f4,_0xa4fe33[_0xbfd0('0x17')]));});});};exports[_0xbfd0('0x22')]=function(_0x3ddbfc){return new Promise(function(_0x145b93,_0x2d5400){return db[_0xbfd0('0x1a')][_0xbfd0('0x23')]({'where':_0x3ddbfc['options']?_0x3ddbfc['options'][_0xbfd0('0x1e')]||null:null})[_0xbfd0('0x11')](function(_0x553d4f){if(_0x553d4f){return _0x553d4f[_0xbfd0('0x24')](_0x3ddbfc[_0xbfd0('0x25')][_0xbfd0('0x26')],_[_0xbfd0('0x27')](_0x3ddbfc[_0xbfd0('0x25')],['ids','id'])||{});}})['spread'](function(_0x12a26e){logger[_0xbfd0('0x12')](_0xbfd0('0x28'),_0x3ddbfc);logger[_0xbfd0('0x20')](_0xbfd0('0x28'),_0x3ddbfc,JSON[_0xbfd0('0x15')](_0x12a26e));_0x145b93(_0x12a26e);})[_0xbfd0('0x21')](function(_0x5dd79f){logger[_0xbfd0('0x16')](_0xbfd0('0x28'),_0x5dd79f[_0xbfd0('0x17')],_0x3ddbfc);_0x2d5400(_this[_0xbfd0('0x16')](0x1f4,_0x5dd79f[_0xbfd0('0x17')]));});});}; \ No newline at end of file +var _0x7a11=['AddTagsToFaxInteraction','find','addTags','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','where','limit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x7a11,0x1c0));var _0x17a1=function(_0x295c6d,_0x11a9fb){_0x295c6d=_0x295c6d-0x0;var _0xa31b90=_0x7a11[_0x295c6d];return _0xa31b90;};'use strict';var _=require(_0x17a1('0x0'));var util=require(_0x17a1('0x1'));var moment=require(_0x17a1('0x2'));var BPromise=require(_0x17a1('0x3'));var rs=require(_0x17a1('0x4'));var fs=require('fs');var Redis=require(_0x17a1('0x5'));var db=require(_0x17a1('0x6'))['db'];var utils=require(_0x17a1('0x7'));var logger=require(_0x17a1('0x8'))(_0x17a1('0x9'));var config=require(_0x17a1('0xa'));var jayson=require(_0x17a1('0xb'));var client=jayson[_0x17a1('0xc')][_0x17a1('0xd')]({'port':0x232a});config['redis']=_[_0x17a1('0xe')](config[_0x17a1('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x17a1('0x10'))(new Redis(config[_0x17a1('0xf')]));require(_0x17a1('0x11'))['register'](socket);function respondWithRpcPromise(_0x45bea5,_0x2afe31,_0x4edab2){return new BPromise(function(_0x465c87,_0x374765){return client['request'](_0x45bea5,_0x4edab2)[_0x17a1('0x12')](function(_0x3f6418){logger['info'](_0x17a1('0x13'),_0x2afe31,_0x17a1('0x14'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2afe31,_0x17a1('0x14'),JSON[_0x17a1('0x15')](_0x3f6418));if(_0x3f6418['error']){if(_0x3f6418[_0x17a1('0x16')][_0x17a1('0x17')]===0x1f4){logger[_0x17a1('0x16')](_0x17a1('0x13'),_0x2afe31,_0x3f6418[_0x17a1('0x16')][_0x17a1('0x18')]);return _0x374765(_0x3f6418[_0x17a1('0x16')]['message']);}logger[_0x17a1('0x16')](_0x17a1('0x13'),_0x2afe31,_0x3f6418['error'][_0x17a1('0x18')]);return _0x465c87(_0x3f6418['error'][_0x17a1('0x18')]);}else{logger[_0x17a1('0x19')](_0x17a1('0x13'),_0x2afe31,_0x17a1('0x14'));_0x465c87(_0x3f6418[_0x17a1('0x1a')][_0x17a1('0x18')]);}})[_0x17a1('0x1b')](function(_0x41f9aa){logger[_0x17a1('0x16')](_0x17a1('0x13'),_0x2afe31,_0x41f9aa);_0x374765(_0x41f9aa);});});}exports[_0x17a1('0x1c')]=function(_0x1a3bfa){var _0x250dda=this;return new Promise(function(_0x206127,_0x137a88){return db[_0x17a1('0x1d')][_0x17a1('0x1e')](_0x1a3bfa[_0x17a1('0x1f')],{'raw':_0x1a3bfa['options']?_0x1a3bfa['options'][_0x17a1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a3bfa['options']?_0x1a3bfa[_0x17a1('0x21')][_0x17a1('0x22')]||null:null,'attributes':_0x1a3bfa[_0x17a1('0x21')]?_0x1a3bfa['options']['attributes']||null:null,'limit':_0x1a3bfa['options']?_0x1a3bfa[_0x17a1('0x21')][_0x17a1('0x23')]||null:null})['then'](function(_0x2ebc77){logger['info'](_0x17a1('0x1c'),_0x1a3bfa);logger['debug'](_0x17a1('0x1c'),_0x1a3bfa,JSON[_0x17a1('0x15')](_0x2ebc77));_0x206127(_0x2ebc77);})[_0x17a1('0x1b')](function(_0x311c6b){logger[_0x17a1('0x16')](_0x17a1('0x1c'),_0x311c6b[_0x17a1('0x18')],_0x1a3bfa);_0x137a88(_0x250dda[_0x17a1('0x16')](0x1f4,_0x311c6b[_0x17a1('0x18')]));});});};exports[_0x17a1('0x24')]=function(_0x4ca5f3){return new Promise(function(_0x4d52f0,_0x11b004){return db[_0x17a1('0x1d')][_0x17a1('0x25')]({'where':_0x4ca5f3[_0x17a1('0x21')]?_0x4ca5f3['options'][_0x17a1('0x22')]||null:null})[_0x17a1('0x12')](function(_0x2334fd){if(_0x2334fd){return _0x2334fd[_0x17a1('0x26')](_0x4ca5f3[_0x17a1('0x1f')][_0x17a1('0x27')],_[_0x17a1('0x28')](_0x4ca5f3['body'],[_0x17a1('0x27'),'id'])||{});}})[_0x17a1('0x29')](function(_0x5be687){logger[_0x17a1('0x19')]('AddTags',_0x4ca5f3);logger[_0x17a1('0x2a')](_0x17a1('0x2b'),_0x4ca5f3,JSON[_0x17a1('0x15')](_0x5be687));_0x4d52f0(_0x5be687);})[_0x17a1('0x1b')](function(_0x52b3ad){logger[_0x17a1('0x16')](_0x17a1('0x2b'),_0x52b3ad[_0x17a1('0x18')],_0x4ca5f3);_0x11b004(_this['error'](0x1f4,_0x52b3ad[_0x17a1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4f46988..2d77d5f 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 _0x6965=['emit','register','length','./faxInteraction.events','remove','update'];(function(_0x3fee2a,_0x209a41){var _0x56c00f=function(_0x52f190){while(--_0x52f190){_0x3fee2a['push'](_0x3fee2a['shift']());}};_0x56c00f(++_0x209a41);}(_0x6965,0x1cb));var _0x5696=function(_0x3d8b4c,_0x4e4a7c){_0x3d8b4c=_0x3d8b4c-0x0;var _0xddaeac=_0x6965[_0x3d8b4c];return _0xddaeac;};'use strict';var FaxInteractionEvents=require(_0x5696('0x0'));var events=['save',_0x5696('0x1'),_0x5696('0x2')];function createListener(_0x5ebec2,_0x173624){return function(_0x4b9c12){_0x173624[_0x5696('0x3')](_0x5ebec2,_0x4b9c12);};}function removeListener(_0xc9771c,_0x333ad2){return function(){FaxInteractionEvents['removeListener'](_0xc9771c,_0x333ad2);};}exports[_0x5696('0x4')]=function(_0x55985a){for(var _0x48f393=0x0,_0x1b4be2=events[_0x5696('0x5')];_0x48f393<_0x1b4be2;_0x48f393++){var _0x35ae2d=events[_0x48f393];var _0x240b07=createListener('faxInteraction:'+_0x35ae2d,_0x55985a);FaxInteractionEvents['on'](_0x35ae2d,_0x240b07);}}; \ No newline at end of file +var _0xa223=['update','length','./faxInteraction.events','save','remove'];(function(_0x47f153,_0x22d502){var _0x1bfc1c=function(_0xa95e23){while(--_0xa95e23){_0x47f153['push'](_0x47f153['shift']());}};_0x1bfc1c(++_0x22d502);}(_0xa223,0x115));var _0x3a22=function(_0x537b9b,_0x64d0c6){_0x537b9b=_0x537b9b-0x0;var _0x394e63=_0xa223[_0x537b9b];return _0x394e63;};'use strict';var FaxInteractionEvents=require(_0x3a22('0x0'));var events=[_0x3a22('0x1'),_0x3a22('0x2'),_0x3a22('0x3')];function createListener(_0x53cffe,_0x51356b){return function(_0x55e4c2){_0x51356b['emit'](_0x53cffe,_0x55e4c2);};}function removeListener(_0x35588d,_0x29bf7f){return function(){FaxInteractionEvents['removeListener'](_0x35588d,_0x29bf7f);};}exports['register']=function(_0x12e200){for(var _0x54ad55=0x0,_0x9b5a78=events[_0x3a22('0x4')];_0x54ad55<_0x9b5a78;_0x54ad55++){var _0x4a0c42=events[_0x54ad55];var _0x24c41b=createListener('faxInteraction:'+_0x4a0c42,_0x12e200);FaxInteractionEvents['on'](_0x4a0c42,_0x24c41b);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e232fcc..9dc138a 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 _0x901c=['/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','update','delete','removeTags','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x214093,_0x59fd9a){var _0x225fe6=function(_0x48a536){while(--_0x48a536){_0x214093['push'](_0x214093['shift']());}};_0x225fe6(++_0x59fd9a);}(_0x901c,0x119));var _0xc901=function(_0x4592e6,_0x3f2b0b){_0x4592e6=_0x4592e6-0x0;var _0x5eb414=_0x901c[_0x4592e6];return _0x5eb414;};'use strict';var multer=require(_0xc901('0x0'));var util=require('util');var path=require(_0xc901('0x1'));var timeout=require('connect-timeout');var express=require(_0xc901('0x2'));var router=express[_0xc901('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc901('0x4'));var interaction=require(_0xc901('0x5'));var config=require('../../config/environment');var controller=require(_0xc901('0x6'));router[_0xc901('0x7')]('/',auth[_0xc901('0x8')](),controller['index']);router[_0xc901('0x7')](_0xc901('0x9'),auth[_0xc901('0x8')](),controller[_0xc901('0xa')]);router['get'](_0xc901('0xb'),auth[_0xc901('0x8')](),controller[_0xc901('0xc')]);router[_0xc901('0x7')]('/:id/messages',auth[_0xc901('0x8')](),controller[_0xc901('0xd')]);router[_0xc901('0x7')](_0xc901('0xe'),auth[_0xc901('0x8')](),controller[_0xc901('0xf')]);router[_0xc901('0x10')]('/',auth['isAuthenticated'](),controller[_0xc901('0x11')]);router[_0xc901('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc901('0x12')]);router[_0xc901('0x10')](_0xc901('0x13'),auth[_0xc901('0x8')](),interaction[_0xc901('0x14')]('fax',_0xc901('0x15')),controller[_0xc901('0x16')]);router[_0xc901('0x17')](_0xc901('0xb'),auth['isAuthenticated'](),interaction[_0xc901('0x14')](_0xc901('0x18'),_0xc901('0x19')),controller[_0xc901('0x1a')]);router[_0xc901('0x1b')]('/:id',auth[_0xc901('0x8')](),interaction[_0xc901('0x14')](_0xc901('0x18'),'faxinteraction:destroy'),controller['destroy']);router[_0xc901('0x1b')](_0xc901('0x13'),auth[_0xc901('0x8')](),controller[_0xc901('0x1c')]);module[_0xc901('0x1d')]=router; \ No newline at end of file +var _0x6531=['util','connect-timeout','Router','../../components/interaction/service','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','create','addMessage','post','/:id/tags','tracked','fax','addTags','faxinteraction:update','update','faxinteraction:destroy','delete','removeTags','exports','multer'];(function(_0x376ffe,_0x2a7ec7){var _0x327b9f=function(_0x2ff0eb){while(--_0x2ff0eb){_0x376ffe['push'](_0x376ffe['shift']());}};_0x327b9f(++_0x2a7ec7);}(_0x6531,0xa7));var _0x1653=function(_0x4254dd,_0x22dbd0){_0x4254dd=_0x4254dd-0x0;var _0x2291d1=_0x6531[_0x4254dd];return _0x2291d1;};'use strict';var multer=require(_0x1653('0x0'));var util=require(_0x1653('0x1'));var path=require('path');var timeout=require(_0x1653('0x2'));var express=require('express');var router=express[_0x1653('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1653('0x4'));var config=require('../../config/environment');var controller=require(_0x1653('0x5'));router[_0x1653('0x6')]('/',auth['isAuthenticated'](),controller[_0x1653('0x7')]);router[_0x1653('0x6')](_0x1653('0x8'),auth[_0x1653('0x9')](),controller[_0x1653('0xa')]);router[_0x1653('0x6')](_0x1653('0xb'),auth[_0x1653('0x9')](),controller[_0x1653('0xc')]);router[_0x1653('0x6')](_0x1653('0xd'),auth[_0x1653('0x9')](),controller[_0x1653('0xe')]);router[_0x1653('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x1653('0xf')]);router['post'](_0x1653('0xd'),auth[_0x1653('0x9')](),controller[_0x1653('0x10')]);router[_0x1653('0x11')](_0x1653('0x12'),auth['isAuthenticated'](),interaction[_0x1653('0x13')](_0x1653('0x14'),'faxinteraction:addtags'),controller[_0x1653('0x15')]);router['put'](_0x1653('0xb'),auth['isAuthenticated'](),interaction[_0x1653('0x13')]('fax',_0x1653('0x16')),controller[_0x1653('0x17')]);router['delete'](_0x1653('0xb'),auth[_0x1653('0x9')](),interaction[_0x1653('0x13')]('fax',_0x1653('0x18')),controller['destroy']);router[_0x1653('0x19')](_0x1653('0x12'),auth[_0x1653('0x9')](),controller[_0x1653('0x1a')]);module[_0x1653('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index da0165d..3718bca 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 _0x9221=['BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x5d9c95,_0x22517f){var _0x299003=function(_0x24a5b2){while(--_0x24a5b2){_0x5d9c95['push'](_0x5d9c95['shift']());}};_0x299003(++_0x22517f);}(_0x9221,0x64));var _0x1922=function(_0x2881e2,_0x341293){_0x2881e2=_0x2881e2-0x0;var _0x5c1e1f=_0x9221[_0x2881e2];return _0x5c1e1f;};'use strict';var Sequelize=require('sequelize');module[_0x1922('0x0')]={'body':{'type':Sequelize[_0x1922('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1922('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1922('0x3')]('in','out'),'defaultValue':_0x1922('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1922('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1922('0x5')]}}; \ No newline at end of file +var _0x5c12=['out','DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x5c12,0x188));var _0x25c1=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x5c12[_0x5dbb84];return _0x1d6eae;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'body':{'type':Sequelize[_0x25c1('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x25c1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x25c1('0x3')]('in',_0x25c1('0x4')),'defaultValue':_0x25c1('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x25c1('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x25c1('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 46b6b94..318a73c 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 _0xfeb3=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','end','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','includeAll','catch','params','intersection','find','body','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','User','agent','interface','channel','motionChannel','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','contact','email','internal','SIP/%s','event','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x28f1dd,_0x1ab556){var _0x597154=function(_0x31336c){while(--_0x31336c){_0x28f1dd['push'](_0x28f1dd['shift']());}};_0x597154(++_0x1ab556);}(_0xfeb3,0x110));var _0x3feb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfeb3[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3feb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3feb('0x1'));var jsonpatch=require(_0x3feb('0x2'));var rp=require(_0x3feb('0x3'));var moment=require(_0x3feb('0x4'));var BPromise=require(_0x3feb('0x5'));var Mustache=require(_0x3feb('0x6'));var util=require(_0x3feb('0x7'));var path=require(_0x3feb('0x8'));var sox=require('sox');var csv=require(_0x3feb('0x9'));var ejs=require(_0x3feb('0xa'));var fs=require('fs');var fs_extra=require(_0x3feb('0xb'));var _=require('lodash');var squel=require(_0x3feb('0xc'));var crypto=require(_0x3feb('0xd'));var jsforce=require(_0x3feb('0xe'));var deskjs=require(_0x3feb('0xf'));var toCsv=require(_0x3feb('0x9'));var querystring=require(_0x3feb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3feb('0x11'));var qs=require(_0x3feb('0x12'));var as=require(_0x3feb('0x13'));var hardwareService=require(_0x3feb('0x14'));var logger=require(_0x3feb('0x15'))(_0x3feb('0x16'));var utils=require(_0x3feb('0x17'));var config=require(_0x3feb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3feb('0x19'))['db'];config[_0x3feb('0x1a')]=_[_0x3feb('0x1b')](config['redis'],{'host':_0x3feb('0x1c'),'port':0x18eb});var socket=require(_0x3feb('0x1d'))(new Redis(config['redis']));require(_0x3feb('0x1e'))[_0x3feb('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3feb('0x20')][_0x3feb('0x21')]({'port':0x232c});var client9002=jayson[_0x3feb('0x20')][_0x3feb('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x422328,_0x30b331,_0xb59e8d,_0x5149ca){return new BPromise(function(_0x1b36ed,_0x20c8e0){var _0x1c1d87=_0x5149ca||client;return _0x1c1d87[_0x3feb('0x22')](_0x422328,_0xb59e8d)[_0x3feb('0x23')](function(_0x3ad16f){logger['info'](_0x3feb('0x24'),_0x30b331,_0x3feb('0x25'));logger[_0x3feb('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x30b331,'request\x20sent',JSON[_0x3feb('0x27')](_0x3ad16f));if(_0x3ad16f['error']){if(_0x3ad16f[_0x3feb('0x28')][_0x3feb('0x29')]===0x1f4){logger[_0x3feb('0x28')](_0x3feb('0x24'),_0x30b331,_0x3ad16f[_0x3feb('0x28')]['message']);return _0x20c8e0(_0x3ad16f[_0x3feb('0x28')][_0x3feb('0x2a')]);}logger[_0x3feb('0x28')](_0x3feb('0x24'),_0x30b331,_0x3ad16f[_0x3feb('0x28')]['message']);return _0x1b36ed(_0x3ad16f[_0x3feb('0x28')][_0x3feb('0x2a')]);}else{logger[_0x3feb('0x2b')](_0x3feb('0x24'),_0x30b331,'request\x20sent');_0x1b36ed(_0x3ad16f['result'][_0x3feb('0x2a')]);}})['catch'](function(_0x366051){logger[_0x3feb('0x28')](_0x3feb('0x24'),_0x30b331,_0x366051);_0x20c8e0(_0x366051);});});}function respondWithStatusCode(_0x2293b7,_0xcf6efa){_0xcf6efa=_0xcf6efa||0xcc;return function(_0x518655){if(_0x518655){return _0x2293b7[_0x3feb('0x2c')](_0xcf6efa);}return _0x2293b7[_0x3feb('0x2d')](_0xcf6efa)['end']();};}function respondWithResult(_0x2b7143,_0x36fcb2){_0x36fcb2=_0x36fcb2||0xc8;return function(_0x35934b){if(_0x35934b){return _0x2b7143['status'](_0x36fcb2)['json'](_0x35934b);}};}function respondWithFilteredResult(_0x795f82,_0x186bc6){return function(_0x5e509d){if(_0x5e509d){var _0x472f48=typeof _0x186bc6[_0x3feb('0x2e')]===_0x3feb('0x2f')&&typeof _0x186bc6[_0x3feb('0x30')]===_0x3feb('0x2f');var _0x30aa90=_0x5e509d[_0x3feb('0x31')];var _0x191761=_0x472f48?0x0:_0x186bc6['offset'];var _0x4a3ab3=_0x472f48?_0x5e509d['count']:_0x186bc6[_0x3feb('0x2e')]+_0x186bc6[_0x3feb('0x30')];var _0x229f25;if(_0x4a3ab3>=_0x30aa90){_0x4a3ab3=_0x30aa90;_0x229f25=0xc8;}else{_0x229f25=0xce;}_0x795f82[_0x3feb('0x2d')](_0x229f25);return _0x795f82[_0x3feb('0x32')](_0x3feb('0x33'),_0x191761+'-'+_0x4a3ab3+'/'+_0x30aa90)[_0x3feb('0x34')](_0x5e509d);}return null;};}function patchUpdates(_0x9f3639){return function(_0x455cf2){try{jsonpatch[_0x3feb('0x35')](_0x455cf2,_0x9f3639,!![]);}catch(_0x2981d2){return BPromise['reject'](_0x2981d2);}return _0x455cf2['save']();};}function saveUpdates(_0x55bf07,_0x494050){return function(_0xdb1e7b){if(_0xdb1e7b){return _0xdb1e7b[_0x3feb('0x36')](_0x55bf07)[_0x3feb('0x23')](function(_0x417511){return _0x417511;});}return null;};}function removeEntity(_0x5da08b,_0x5ec273){return function(_0x4ba765){if(_0x4ba765){return _0x4ba765[_0x3feb('0x37')]()[_0x3feb('0x23')](function(){_0x5da08b[_0x3feb('0x2d')](0xcc)[_0x3feb('0x38')]();});}};}function handleEntityNotFound(_0x61905e,_0x38f7c9){return function(_0x5f92bf){if(!_0x5f92bf){_0x61905e[_0x3feb('0x2c')](0x194);}return _0x5f92bf;};}function handleError(_0xc5f377,_0x31ac0f){_0x31ac0f=_0x31ac0f||0x1f4;return function(_0x4a77b1){logger[_0x3feb('0x28')](_0x4a77b1[_0x3feb('0x39')]);if(_0x4a77b1[_0x3feb('0x3a')]){delete _0x4a77b1[_0x3feb('0x3a')];}_0xc5f377[_0x3feb('0x2d')](_0x31ac0f)[_0x3feb('0x3b')](_0x4a77b1);};}exports[_0x3feb('0x3c')]=function(_0x3b5d96,_0x4293fd){var _0x253af5={},_0x4a9355={},_0x191bda={'count':0x0,'rows':[]};var _0x51df11=_['map'](db[_0x3feb('0x3d')][_0x3feb('0x3e')],function(_0x303a2e){return{'name':_0x303a2e[_0x3feb('0x3f')],'type':_0x303a2e[_0x3feb('0x40')][_0x3feb('0x41')]};});_0x4a9355[_0x3feb('0x42')]=_['map'](_0x51df11,'name');_0x4a9355[_0x3feb('0x43')]=_[_0x3feb('0x44')](_0x3b5d96[_0x3feb('0x43')]);_0x4a9355[_0x3feb('0x45')]=_['intersection'](_0x4a9355[_0x3feb('0x42')],_0x4a9355[_0x3feb('0x43')]);_0x253af5[_0x3feb('0x46')]=_['intersection'](_0x4a9355[_0x3feb('0x42')],qs[_0x3feb('0x47')](_0x3b5d96['query'][_0x3feb('0x47')]));_0x253af5[_0x3feb('0x46')]=_0x253af5[_0x3feb('0x46')][_0x3feb('0x48')]?_0x253af5[_0x3feb('0x46')]:_0x4a9355[_0x3feb('0x42')];if(!_0x3b5d96[_0x3feb('0x43')][_0x3feb('0x49')](_0x3feb('0x4a'))){_0x253af5[_0x3feb('0x30')]=qs['limit'](_0x3b5d96[_0x3feb('0x43')][_0x3feb('0x30')]);_0x253af5[_0x3feb('0x2e')]=qs[_0x3feb('0x2e')](_0x3b5d96[_0x3feb('0x43')][_0x3feb('0x2e')]);}_0x253af5[_0x3feb('0x4b')]=qs[_0x3feb('0x4c')](_0x3b5d96[_0x3feb('0x43')][_0x3feb('0x4c')]);_0x253af5['where']=qs[_0x3feb('0x45')](_['pick'](_0x3b5d96[_0x3feb('0x43')],_0x4a9355[_0x3feb('0x45')]),_0x51df11);if(_0x3b5d96['query']['filter']){_0x253af5[_0x3feb('0x4d')]=_[_0x3feb('0x4e')](_0x253af5[_0x3feb('0x4d')],{'$or':_[_0x3feb('0x4f')](_0x51df11,function(_0x39837e){if(_0x39837e[_0x3feb('0x40')]!=='VIRTUAL'){var _0x3b4c70={};_0x3b4c70[_0x39837e[_0x3feb('0x3a')]]={'$like':'%'+_0x3b5d96[_0x3feb('0x43')][_0x3feb('0x50')]+'%'};return _0x3b4c70;}})});}_0x253af5=_[_0x3feb('0x4e')]({},_0x253af5,_0x3b5d96[_0x3feb('0x51')]);var _0x4c9898={'where':_0x253af5[_0x3feb('0x4d')]};return db[_0x3feb('0x3d')]['count'](_0x4c9898)[_0x3feb('0x23')](function(_0x41f2f0){_0x191bda['count']=_0x41f2f0;if(_0x3b5d96[_0x3feb('0x43')][_0x3feb('0x52')]){_0x253af5['include']=[{'all':!![]}];}return db[_0x3feb('0x3d')]['findAll'](_0x253af5);})['then'](function(_0x35c2f3){_0x191bda['rows']=_0x35c2f3;return _0x191bda;})[_0x3feb('0x23')](respondWithFilteredResult(_0x4293fd,_0x253af5))[_0x3feb('0x53')](handleError(_0x4293fd,null));};exports['show']=function(_0xafa468,_0x372232){var _0x95f157={'raw':!![],'where':{'id':_0xafa468[_0x3feb('0x54')]['id']}},_0x91bf32={};_0x91bf32[_0x3feb('0x42')]=_[_0x3feb('0x44')](db[_0x3feb('0x3d')][_0x3feb('0x3e')]);_0x91bf32['query']=_[_0x3feb('0x44')](_0xafa468[_0x3feb('0x43')]);_0x91bf32[_0x3feb('0x45')]=_[_0x3feb('0x55')](_0x91bf32['model'],_0x91bf32[_0x3feb('0x43')]);_0x95f157[_0x3feb('0x46')]=_[_0x3feb('0x55')](_0x91bf32[_0x3feb('0x42')],qs['fields'](_0xafa468[_0x3feb('0x43')][_0x3feb('0x47')]));_0x95f157[_0x3feb('0x46')]=_0x95f157[_0x3feb('0x46')][_0x3feb('0x48')]?_0x95f157[_0x3feb('0x46')]:_0x91bf32[_0x3feb('0x42')];if(_0xafa468[_0x3feb('0x43')][_0x3feb('0x52')]){_0x95f157['include']=[{'all':!![]}];}_0x95f157=_[_0x3feb('0x4e')]({},_0x95f157,_0xafa468[_0x3feb('0x51')]);return db[_0x3feb('0x3d')][_0x3feb('0x56')](_0x95f157)[_0x3feb('0x23')](handleEntityNotFound(_0x372232,null))[_0x3feb('0x23')](respondWithResult(_0x372232,null))[_0x3feb('0x53')](handleError(_0x372232,null));};exports[_0x3feb('0x36')]=function(_0x3ae89d,_0x600a66){if(_0x3ae89d['body']['id']){delete _0x3ae89d[_0x3feb('0x57')]['id'];}return db[_0x3feb('0x3d')]['find']({'where':{'id':_0x3ae89d['params']['id']}})['then'](handleEntityNotFound(_0x600a66,null))[_0x3feb('0x23')](saveUpdates(_0x3ae89d[_0x3feb('0x57')],null))[_0x3feb('0x23')](respondWithResult(_0x600a66,null))['catch'](handleError(_0x600a66,null));};exports[_0x3feb('0x37')]=function(_0x10766c,_0x5e3803){return db['FaxMessage'][_0x3feb('0x56')]({'where':{'id':_0x10766c[_0x3feb('0x54')]['id']}})[_0x3feb('0x23')](handleEntityNotFound(_0x5e3803,null))[_0x3feb('0x23')](removeEntity(_0x5e3803,null))[_0x3feb('0x53')](handleError(_0x5e3803,null));};exports[_0x3feb('0x58')]=function(_0x5a221d,_0x3552e4){return db[_0x3feb('0x3d')][_0x3feb('0x58')]()[_0x3feb('0x23')](respondWithResult(_0x3552e4,null))['catch'](handleError(_0x3552e4,null));};var interaction_log=require(_0x3feb('0x15'))(_0x3feb('0x59'));exports[_0x3feb('0x5a')]=function(_0x595743,_0x292842,_0x289ded){var _0x4570f8={'agent':{},'channel':_0x3feb('0x5b')};if(_0x595743['body']['id']){delete _0x595743[_0x3feb('0x57')]['id'];}_0x595743[_0x3feb('0x57')]['read']=!![];_0x595743['body'][_0x3feb('0x5c')]=moment()[_0x3feb('0x5d')](_0x3feb('0x5e'));_0x595743[_0x3feb('0x57')][_0x3feb('0x5f')]=_0x595743[_0x3feb('0x57')][_0x3feb('0x5f')]||_0x595743[_0x3feb('0x60')]['id'];_0x4570f8['agent']['id']=_0x595743['body'][_0x3feb('0x5f')];return db[_0x3feb('0x3d')][_0x3feb('0x56')]({'where':{'id':_0x595743[_0x3feb('0x54')]['id'],'UserId':null}})[_0x3feb('0x23')](handleEntityNotFound(_0x292842,null))[_0x3feb('0x23')](saveUpdates(_0x595743[_0x3feb('0x57')],null))[_0x3feb('0x23')](function(_0x2558d3){if(_0x2558d3){_0x4570f8[_0x3feb('0x2a')]=_0x2558d3['get']({'plain':!![]});return db[_0x3feb('0x61')][_0x3feb('0x56')]({'where':{'id':_0x2558d3[_0x3feb('0x62')]}});}return null;})[_0x3feb('0x23')](handleEntityNotFound(_0x292842,null))['then'](function(_0x37ca7f){if(_0x37ca7f){return _0x37ca7f[_0x3feb('0x36')]({'UserId':_0x595743['body'][_0x3feb('0x5f')],'read1stAt':_['isNil'](_0x37ca7f[_0x3feb('0x63')])?moment()[_0x3feb('0x5d')](_0x3feb('0x5e')):undefined});}return null;})['then'](function(_0x10d057){if(_0x10d057){_0x4570f8[_0x3feb('0x64')]=_0x10d057[_0x3feb('0x65')]({'plain':!![]});interaction_log[_0x3feb('0x2b')](_0x3feb('0x66'),_0x595743['user']['id'],_0x595743[_0x3feb('0x60')][_0x3feb('0x3a')],_0x595743[_0x3feb('0x60')]['role'],_0x4570f8['interaction']['id'],_0x595743[_0x3feb('0x57')]?JSON[_0x3feb('0x27')](_0x595743['body']):_0x3feb('0x67'));return respondWithRpcPromise(_0x3feb('0x68'),_0x3feb('0x69'),_0x4570f8);}return null;})['then'](function(_0x5a2209){var _0x4f4e34=_0x3feb('0x6a')+_0x5a2209[_0x3feb('0x2a')][_0x3feb('0x6b')];return db['sequelize'][_0x3feb('0x43')](_0x4f4e34,{'type':db[_0x3feb('0x6c')]['QueryTypes'][_0x3feb('0x6d')],'raw':!![]})[_0x3feb('0x23')](function(_0x56a8d4){return _0x56a8d4;});})['then'](function(_0x4e5192){if(_0x4e5192){_0x4570f8['message']['contact']=_0x4e5192[0x0];if(!_0x595743['body'][_0x3feb('0x5f')])return;return db[_0x3feb('0x6e')]['find']({'where':{'id':_0x595743[_0x3feb('0x57')][_0x3feb('0x5f')],'role':_0x3feb('0x6f')},'attributes':['id',_0x3feb('0x3a'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x3feb('0x23')](function(_0x273899){if(!_0x273899)return null;_0x4570f8['message']['agent']=_0x273899;return _0x4570f8;})[_0x3feb('0x23')](function(_0x9e7425){if(_0x9e7425){if(_0x595743[_0x3feb('0x57')]['manual']){_0x4570f8[_0x3feb('0x2a')][_0x3feb('0x70')]=util['format']('SIP/%s',_0x595743['user'][_0x3feb('0x3a')]);_0x4570f8[_0x3feb('0x2a')][_0x3feb('0x71')]=_0x4570f8[_0x3feb('0x71')];_0x4570f8['message'][_0x3feb('0x72')]=_0x4570f8[_0x3feb('0x71')];_0x4570f8[_0x3feb('0x2a')]['event']=_0x3feb('0x5a');return respondWithRpcPromise(_0x3feb('0x73'),_0x3feb('0x73'),{'event':_0x3feb('0x74'),'message':_0x4570f8[_0x3feb('0x2a')]},client9002)[_0x3feb('0x23')](function(){return _0x4570f8;});}return _0x4570f8;}return null;})[_0x3feb('0x23')](respondWithResult(_0x292842,null))[_0x3feb('0x53')](handleError(_0x292842,null));};var interaction_log=require(_0x3feb('0x15'))(_0x3feb('0x59'));exports[_0x3feb('0x75')]=function(_0x4e2dca,_0x48cd64,_0x203ef4){var _0x2f12fb={'agent':{},'channel':_0x3feb('0x5b')};if(_0x4e2dca['body']['id']){delete _0x4e2dca[_0x3feb('0x57')]['id'];}_0x4e2dca['body']['UserId']=_0x4e2dca[_0x3feb('0x57')][_0x3feb('0x5f')]||_0x4e2dca['user']['id'];_0x2f12fb[_0x3feb('0x6f')]['id']=_0x4e2dca[_0x3feb('0x57')][_0x3feb('0x5f')];return db[_0x3feb('0x3d')][_0x3feb('0x56')]({'where':{'id':_0x4e2dca[_0x3feb('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x48cd64,null))['then'](function(_0x54f450){if(_0x54f450){_0x2f12fb[_0x3feb('0x2a')]=_0x54f450[_0x3feb('0x65')]({'plain':!![]});return db[_0x3feb('0x61')]['find']({'where':{'id':_0x54f450[_0x3feb('0x62')]}});}return null;})[_0x3feb('0x23')](handleEntityNotFound(_0x48cd64,null))[_0x3feb('0x23')](function(_0x29e853){if(_0x29e853){_0x2f12fb['interaction']=_0x29e853['get']({'plain':!![]});interaction_log[_0x3feb('0x2b')](_0x3feb('0x76'),_0x4e2dca['user']['id'],_0x4e2dca[_0x3feb('0x60')][_0x3feb('0x3a')],_0x4e2dca[_0x3feb('0x60')][_0x3feb('0x77')],_0x2f12fb['interaction']['id'],_0x4e2dca[_0x3feb('0x57')]?JSON[_0x3feb('0x27')](_0x4e2dca[_0x3feb('0x57')]):_0x3feb('0x67'));return respondWithRpcPromise(_0x3feb('0x78'),_0x3feb('0x79'),_0x2f12fb);}return null;})['then'](function(_0x3cb662){var _0x4460e9=_0x3feb('0x6a')+_0x3cb662['message']['ContactId'];return db['sequelize'][_0x3feb('0x43')](_0x4460e9,{'type':db[_0x3feb('0x6c')][_0x3feb('0x7a')][_0x3feb('0x6d')],'raw':!![]})[_0x3feb('0x23')](function(_0x43cd03){return _0x43cd03;});})[_0x3feb('0x23')](function(_0x2699eb){if(_0x2699eb){_0x2f12fb['message'][_0x3feb('0x7b')]=_0x2699eb[0x0];if(!_0x4e2dca[_0x3feb('0x57')]['UserId'])return;return db[_0x3feb('0x6e')][_0x3feb('0x56')]({'where':{'id':_0x4e2dca[_0x3feb('0x57')]['UserId'],'role':_0x3feb('0x6f')},'attributes':['id',_0x3feb('0x3a'),'fullname',_0x3feb('0x7c'),_0x3feb('0x7d')],'raw':!![]});}return null;})['then'](function(_0x38654e){if(!_0x38654e)return null;_0x2f12fb[_0x3feb('0x2a')]['agent']=_0x38654e;return _0x2f12fb;})['then'](function(_0x387805){if(_0x387805){_0x387805[_0x3feb('0x2a')][_0x3feb('0x70')]=util[_0x3feb('0x5d')](_0x3feb('0x7e'),_0x4e2dca[_0x3feb('0x60')]['name']);_0x387805[_0x3feb('0x2a')][_0x3feb('0x71')]=_0x2f12fb[_0x3feb('0x71')];_0x387805[_0x3feb('0x2a')][_0x3feb('0x72')]=_0x2f12fb['channel'];_0x387805[_0x3feb('0x2a')][_0x3feb('0x7f')]=_0x3feb('0x75');respondWithRpcPromise(_0x3feb('0x73'),_0x3feb('0x73'),{'event':_0x3feb('0x80'),'message':_0x387805[_0x3feb('0x2a')]},client9002);return _0x2f12fb;}return null;})['then'](respondWithResult(_0x48cd64,null))[_0x3feb('0x53')](handleError(_0x48cd64,null));};exports[_0x3feb('0x81')]=function(_0x58b0ce,_0x482e94){var _0x30b3f0;return db[_0x3feb('0x3d')]['create'](_0x58b0ce['body'],{})['then'](function(_0x4402bf){_0x30b3f0=_0x4402bf;return db['CmContact'][_0x3feb('0x82')]({'where':{'id':_0x30b3f0['ContactId']}});})[_0x3feb('0x23')](function(_0x773ae0){if(_[_0x3feb('0x83')](_0x773ae0)){return;}else{_0x30b3f0[_0x3feb('0x5b')]=_0x773ae0[_0x3feb('0x5b')];return db[_0x3feb('0x84')][_0x3feb('0x82')]({'where':{'id':_0x30b3f0[_0x3feb('0x85')]}});}})[_0x3feb('0x23')](function(_0x5d2a0d){return respondWithRpcPromise(_0x3feb('0x86'),'SendFax',{'FaxAccountId':_[_0x3feb('0x83')](_0x58b0ce['body'])?undefined:_0x58b0ce['body'][_0x3feb('0x87')],'path':_[_0x3feb('0x83')](_0x5d2a0d)?undefined:util[_0x3feb('0x5d')](_0x3feb('0x88'),_0x5d2a0d[_0x3feb('0x89')]),'fax':_['isNil'](_0x30b3f0[_0x3feb('0x5b')])?undefined:_0x30b3f0['fax'],'AttachmentId':_0x30b3f0[_0x3feb('0x85')]},client9002);})['then'](respondWithResult(_0x482e94,0xc9))['catch'](handleError(_0x482e94,null));};exports[_0x3feb('0x8a')]=function(_0x5ebe6b,_0x2883d9){var _0x2c11ec=path[_0x3feb('0x8b')](config[_0x3feb('0x8c')],'server',_0x3feb('0x8d'),_0x3feb('0x8e'));return db['FaxMessage']['find']({'where':{'id':_0x5ebe6b[_0x3feb('0x54')]['id']},'include':[{'model':db['Attachment'],'as':_0x3feb('0x84')}]})[_0x3feb('0x23')](handleEntityNotFound(_0x2883d9,null))['then'](function(_0x159d3a){if(_0x159d3a){return _0x2883d9[_0x3feb('0x8a')](path[_0x3feb('0x8b')](_0x2c11ec,_0x159d3a['Attachment'][_0x3feb('0x89')]));}})[_0x3feb('0x53')](handleError(_0x2883d9,null));}; \ No newline at end of file +var _0xf966=['Attachment','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','status','end','json','offset','undefined','count','limit','apply','reject','save','then','stack','name','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','update','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','FaxInteraction','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server'];(function(_0x45f6c5,_0xafb71d){var _0x46bc15=function(_0x2e571c){while(--_0x2e571c){_0x45f6c5['push'](_0x45f6c5['shift']());}};_0x46bc15(++_0xafb71d);}(_0xf966,0x199));var _0x6f96=function(_0xfda82b,_0x3eb6e2){_0xfda82b=_0xfda82b-0x0;var _0x2624b1=_0xf966[_0xfda82b];return _0x2624b1;};'use strict';var emlformat=require(_0x6f96('0x0'));var rimraf=require(_0x6f96('0x1'));var zipdir=require(_0x6f96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f96('0x3'));var moment=require(_0x6f96('0x4'));var BPromise=require(_0x6f96('0x5'));var Mustache=require('mustache');var util=require(_0x6f96('0x6'));var path=require(_0x6f96('0x7'));var sox=require(_0x6f96('0x8'));var csv=require(_0x6f96('0x9'));var ejs=require(_0x6f96('0xa'));var fs=require('fs');var fs_extra=require(_0x6f96('0xb'));var _=require(_0x6f96('0xc'));var squel=require(_0x6f96('0xd'));var crypto=require(_0x6f96('0xe'));var jsforce=require(_0x6f96('0xf'));var deskjs=require(_0x6f96('0x10'));var toCsv=require(_0x6f96('0x9'));var querystring=require(_0x6f96('0x11'));var Papa=require('papaparse');var Redis=require(_0x6f96('0x12'));var authService=require(_0x6f96('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6f96('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f96('0x15'))('api');var utils=require(_0x6f96('0x16'));var config=require(_0x6f96('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6f96('0x18')]=_['defaults'](config['redis'],{'host':_0x6f96('0x19'),'port':0x18eb});var socket=require(_0x6f96('0x1a'))(new Redis(config[_0x6f96('0x18')]));require(_0x6f96('0x1b'))['register'](socket);var jayson=require(_0x6f96('0x1c'));var client=jayson[_0x6f96('0x1d')][_0x6f96('0x1e')]({'port':0x232c});var client9002=jayson[_0x6f96('0x1d')][_0x6f96('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x120c6e,_0x3af735,_0x3d1c3a,_0x2a3888){return new BPromise(function(_0x3d57b3,_0x1bcbf2){var _0x301c54=_0x2a3888||client;return _0x301c54['request'](_0x120c6e,_0x3d1c3a)['then'](function(_0x5c4bfd){logger['info'](_0x6f96('0x1f'),_0x3af735,_0x6f96('0x20'));logger[_0x6f96('0x21')](_0x6f96('0x22'),_0x3af735,_0x6f96('0x20'),JSON[_0x6f96('0x23')](_0x5c4bfd));if(_0x5c4bfd[_0x6f96('0x24')]){if(_0x5c4bfd[_0x6f96('0x24')]['code']===0x1f4){logger[_0x6f96('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3af735,_0x5c4bfd[_0x6f96('0x24')][_0x6f96('0x25')]);return _0x1bcbf2(_0x5c4bfd[_0x6f96('0x24')][_0x6f96('0x25')]);}logger['error'](_0x6f96('0x1f'),_0x3af735,_0x5c4bfd[_0x6f96('0x24')][_0x6f96('0x25')]);return _0x3d57b3(_0x5c4bfd[_0x6f96('0x24')]['message']);}else{logger[_0x6f96('0x26')](_0x6f96('0x1f'),_0x3af735,'request\x20sent');_0x3d57b3(_0x5c4bfd[_0x6f96('0x27')][_0x6f96('0x25')]);}})['catch'](function(_0x5d2e2c){logger[_0x6f96('0x24')](_0x6f96('0x1f'),_0x3af735,_0x5d2e2c);_0x1bcbf2(_0x5d2e2c);});});}function respondWithStatusCode(_0x18345e,_0xab00b9){_0xab00b9=_0xab00b9||0xcc;return function(_0x5004b8){if(_0x5004b8){return _0x18345e['sendStatus'](_0xab00b9);}return _0x18345e[_0x6f96('0x28')](_0xab00b9)[_0x6f96('0x29')]();};}function respondWithResult(_0x10c3f3,_0x260409){_0x260409=_0x260409||0xc8;return function(_0x1058ec){if(_0x1058ec){return _0x10c3f3['status'](_0x260409)[_0x6f96('0x2a')](_0x1058ec);}};}function respondWithFilteredResult(_0x39adf9,_0x24f758){return function(_0x5bd82e){if(_0x5bd82e){var _0x538448=typeof _0x24f758[_0x6f96('0x2b')]===_0x6f96('0x2c')&&typeof _0x24f758['limit']===_0x6f96('0x2c');var _0x341f13=_0x5bd82e[_0x6f96('0x2d')];var _0x1ea3cb=_0x538448?0x0:_0x24f758[_0x6f96('0x2b')];var _0x3527b0=_0x538448?_0x5bd82e[_0x6f96('0x2d')]:_0x24f758['offset']+_0x24f758[_0x6f96('0x2e')];var _0x27ba90;if(_0x3527b0>=_0x341f13){_0x3527b0=_0x341f13;_0x27ba90=0xc8;}else{_0x27ba90=0xce;}_0x39adf9[_0x6f96('0x28')](_0x27ba90);return _0x39adf9['set']('Content-Range',_0x1ea3cb+'-'+_0x3527b0+'/'+_0x341f13)[_0x6f96('0x2a')](_0x5bd82e);}return null;};}function patchUpdates(_0x213798){return function(_0x117e2a){try{jsonpatch[_0x6f96('0x2f')](_0x117e2a,_0x213798,!![]);}catch(_0x1c3324){return BPromise[_0x6f96('0x30')](_0x1c3324);}return _0x117e2a[_0x6f96('0x31')]();};}function saveUpdates(_0x2ae1e8,_0x5e9492){return function(_0x3c8e7b){if(_0x3c8e7b){return _0x3c8e7b['update'](_0x2ae1e8)[_0x6f96('0x32')](function(_0x647c53){return _0x647c53;});}return null;};}function removeEntity(_0x38d1e8,_0x4d2add){return function(_0x29189d){if(_0x29189d){return _0x29189d['destroy']()[_0x6f96('0x32')](function(){_0x38d1e8[_0x6f96('0x28')](0xcc)[_0x6f96('0x29')]();});}};}function handleEntityNotFound(_0x5986da,_0x24937d){return function(_0x5d85b9){if(!_0x5d85b9){_0x5986da['sendStatus'](0x194);}return _0x5d85b9;};}function handleError(_0x42eebc,_0x5d2d6d){_0x5d2d6d=_0x5d2d6d||0x1f4;return function(_0x225013){logger[_0x6f96('0x24')](_0x225013[_0x6f96('0x33')]);if(_0x225013['name']){delete _0x225013[_0x6f96('0x34')];}_0x42eebc[_0x6f96('0x28')](_0x5d2d6d)['send'](_0x225013);};}exports['index']=function(_0x3d8d36,_0x1829e9){var _0x48bf64={},_0x56f063={},_0x5b11c2={'count':0x0,'rows':[]};var _0xfd6c6d=_[_0x6f96('0x35')](db[_0x6f96('0x36')][_0x6f96('0x37')],function(_0x4d9def){return{'name':_0x4d9def[_0x6f96('0x38')],'type':_0x4d9def[_0x6f96('0x39')][_0x6f96('0x3a')]};});_0x56f063[_0x6f96('0x3b')]=_['map'](_0xfd6c6d,'name');_0x56f063[_0x6f96('0x3c')]=_[_0x6f96('0x3d')](_0x3d8d36[_0x6f96('0x3c')]);_0x56f063[_0x6f96('0x3e')]=_[_0x6f96('0x3f')](_0x56f063[_0x6f96('0x3b')],_0x56f063['query']);_0x48bf64[_0x6f96('0x40')]=_[_0x6f96('0x3f')](_0x56f063['model'],qs[_0x6f96('0x41')](_0x3d8d36['query'][_0x6f96('0x41')]));_0x48bf64['attributes']=_0x48bf64[_0x6f96('0x40')]['length']?_0x48bf64[_0x6f96('0x40')]:_0x56f063[_0x6f96('0x3b')];if(!_0x3d8d36[_0x6f96('0x3c')][_0x6f96('0x42')]('nolimit')){_0x48bf64['limit']=qs[_0x6f96('0x2e')](_0x3d8d36[_0x6f96('0x3c')][_0x6f96('0x2e')]);_0x48bf64[_0x6f96('0x2b')]=qs[_0x6f96('0x2b')](_0x3d8d36['query'][_0x6f96('0x2b')]);}_0x48bf64['order']=qs[_0x6f96('0x43')](_0x3d8d36['query']['sort']);_0x48bf64['where']=qs[_0x6f96('0x3e')](_['pick'](_0x3d8d36['query'],_0x56f063[_0x6f96('0x3e')]),_0xfd6c6d);if(_0x3d8d36[_0x6f96('0x3c')][_0x6f96('0x44')]){_0x48bf64[_0x6f96('0x45')]=_[_0x6f96('0x46')](_0x48bf64['where'],{'$or':_[_0x6f96('0x35')](_0xfd6c6d,function(_0x5aa3b0){if(_0x5aa3b0[_0x6f96('0x39')]!==_0x6f96('0x47')){var _0x4fa9be={};_0x4fa9be[_0x5aa3b0[_0x6f96('0x34')]]={'$like':'%'+_0x3d8d36[_0x6f96('0x3c')]['filter']+'%'};return _0x4fa9be;}})});}_0x48bf64=_['merge']({},_0x48bf64,_0x3d8d36[_0x6f96('0x48')]);var _0x594a71={'where':_0x48bf64[_0x6f96('0x45')]};return db[_0x6f96('0x36')][_0x6f96('0x2d')](_0x594a71)[_0x6f96('0x32')](function(_0x5b3d9f){_0x5b11c2[_0x6f96('0x2d')]=_0x5b3d9f;if(_0x3d8d36[_0x6f96('0x3c')][_0x6f96('0x49')]){_0x48bf64[_0x6f96('0x4a')]=[{'all':!![]}];}return db[_0x6f96('0x36')][_0x6f96('0x4b')](_0x48bf64);})[_0x6f96('0x32')](function(_0x3e99cd){_0x5b11c2['rows']=_0x3e99cd;return _0x5b11c2;})[_0x6f96('0x32')](respondWithFilteredResult(_0x1829e9,_0x48bf64))[_0x6f96('0x4c')](handleError(_0x1829e9,null));};exports[_0x6f96('0x4d')]=function(_0x2c1be9,_0x5b211e){var _0x2143e6={'raw':!![],'where':{'id':_0x2c1be9[_0x6f96('0x4e')]['id']}},_0x2d0ea0={};_0x2d0ea0['model']=_[_0x6f96('0x3d')](db[_0x6f96('0x36')][_0x6f96('0x37')]);_0x2d0ea0[_0x6f96('0x3c')]=_[_0x6f96('0x3d')](_0x2c1be9[_0x6f96('0x3c')]);_0x2d0ea0[_0x6f96('0x3e')]=_[_0x6f96('0x3f')](_0x2d0ea0[_0x6f96('0x3b')],_0x2d0ea0['query']);_0x2143e6[_0x6f96('0x40')]=_[_0x6f96('0x3f')](_0x2d0ea0[_0x6f96('0x3b')],qs[_0x6f96('0x41')](_0x2c1be9['query'][_0x6f96('0x41')]));_0x2143e6[_0x6f96('0x40')]=_0x2143e6['attributes'][_0x6f96('0x4f')]?_0x2143e6['attributes']:_0x2d0ea0['model'];if(_0x2c1be9[_0x6f96('0x3c')]['includeAll']){_0x2143e6[_0x6f96('0x4a')]=[{'all':!![]}];}_0x2143e6=_[_0x6f96('0x46')]({},_0x2143e6,_0x2c1be9[_0x6f96('0x48')]);return db[_0x6f96('0x36')][_0x6f96('0x50')](_0x2143e6)[_0x6f96('0x32')](handleEntityNotFound(_0x5b211e,null))[_0x6f96('0x32')](respondWithResult(_0x5b211e,null))[_0x6f96('0x4c')](handleError(_0x5b211e,null));};exports[_0x6f96('0x51')]=function(_0x4ab5c3,_0x1a1388){if(_0x4ab5c3[_0x6f96('0x52')]['id']){delete _0x4ab5c3[_0x6f96('0x52')]['id'];}return db[_0x6f96('0x36')]['find']({'where':{'id':_0x4ab5c3[_0x6f96('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a1388,null))[_0x6f96('0x32')](saveUpdates(_0x4ab5c3[_0x6f96('0x52')],null))[_0x6f96('0x32')](respondWithResult(_0x1a1388,null))[_0x6f96('0x4c')](handleError(_0x1a1388,null));};exports[_0x6f96('0x53')]=function(_0x4d940b,_0x350b69){return db[_0x6f96('0x36')]['find']({'where':{'id':_0x4d940b['params']['id']}})['then'](handleEntityNotFound(_0x350b69,null))['then'](removeEntity(_0x350b69,null))[_0x6f96('0x4c')](handleError(_0x350b69,null));};exports[_0x6f96('0x54')]=function(_0x45aa4c,_0x7a269e){return db['FaxMessage'][_0x6f96('0x54')]()['then'](respondWithResult(_0x7a269e,null))[_0x6f96('0x4c')](handleError(_0x7a269e,null));};var interaction_log=require(_0x6f96('0x15'))(_0x6f96('0x55'));exports[_0x6f96('0x56')]=function(_0xee5474,_0x50a5e6,_0x19837f){var _0x503973={'agent':{},'channel':_0x6f96('0x57')};if(_0xee5474['body']['id']){delete _0xee5474['body']['id'];}_0xee5474['body'][_0x6f96('0x58')]=!![];_0xee5474[_0x6f96('0x52')][_0x6f96('0x59')]=moment()[_0x6f96('0x5a')](_0x6f96('0x5b'));_0xee5474[_0x6f96('0x52')][_0x6f96('0x5c')]=_0xee5474['body']['UserId']||_0xee5474[_0x6f96('0x5d')]['id'];_0x503973[_0x6f96('0x5e')]['id']=_0xee5474['body'][_0x6f96('0x5c')];return db[_0x6f96('0x36')][_0x6f96('0x50')]({'where':{'id':_0xee5474[_0x6f96('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x50a5e6,null))[_0x6f96('0x32')](saveUpdates(_0xee5474[_0x6f96('0x52')],null))[_0x6f96('0x32')](function(_0x5c975a){if(_0x5c975a){_0x503973['message']=_0x5c975a[_0x6f96('0x5f')]({'plain':!![]});return db['FaxInteraction'][_0x6f96('0x50')]({'where':{'id':_0x5c975a[_0x6f96('0x60')]}});}return null;})[_0x6f96('0x32')](handleEntityNotFound(_0x50a5e6,null))['then'](function(_0x593862){if(_0x593862){return _0x593862[_0x6f96('0x51')]({'UserId':_0xee5474[_0x6f96('0x52')][_0x6f96('0x5c')],'read1stAt':_['isNil'](_0x593862[_0x6f96('0x61')])?moment()[_0x6f96('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1ee5e1){if(_0x1ee5e1){_0x503973['interaction']=_0x1ee5e1[_0x6f96('0x5f')]({'plain':!![]});interaction_log['info'](_0x6f96('0x62'),_0xee5474[_0x6f96('0x5d')]['id'],_0xee5474[_0x6f96('0x5d')]['name'],_0xee5474[_0x6f96('0x5d')][_0x6f96('0x63')],_0x503973['interaction']['id'],_0xee5474[_0x6f96('0x52')]?JSON[_0x6f96('0x23')](_0xee5474[_0x6f96('0x52')]):_0x6f96('0x64'));return respondWithRpcPromise(_0x6f96('0x65'),'acceptMessage',_0x503973);}return null;})[_0x6f96('0x32')](function(_0x1131a9){var _0x58d9a9=_0x6f96('0x66')+_0x1131a9[_0x6f96('0x25')]['ContactId'];return db['sequelize'][_0x6f96('0x3c')](_0x58d9a9,{'type':db[_0x6f96('0x67')][_0x6f96('0x68')][_0x6f96('0x69')],'raw':!![]})[_0x6f96('0x32')](function(_0x2c805a){return _0x2c805a;});})[_0x6f96('0x32')](function(_0x56d494){if(_0x56d494){_0x503973[_0x6f96('0x25')][_0x6f96('0x6a')]=_0x56d494[0x0];if(!_0xee5474[_0x6f96('0x52')][_0x6f96('0x5c')])return;return db[_0x6f96('0x6b')][_0x6f96('0x50')]({'where':{'id':_0xee5474[_0x6f96('0x52')][_0x6f96('0x5c')],'role':_0x6f96('0x5e')},'attributes':['id',_0x6f96('0x34'),_0x6f96('0x6c'),_0x6f96('0x6d'),_0x6f96('0x6e')],'raw':!![]});}return null;})[_0x6f96('0x32')](function(_0xee31e2){if(!_0xee31e2)return null;_0x503973[_0x6f96('0x25')]['agent']=_0xee31e2;return _0x503973;})[_0x6f96('0x32')](function(_0x480b65){if(_0x480b65){if(_0xee5474['body'][_0x6f96('0x6f')]){_0x503973[_0x6f96('0x25')][_0x6f96('0x70')]=util[_0x6f96('0x5a')](_0x6f96('0x71'),_0xee5474[_0x6f96('0x5d')]['name']);_0x503973['message'][_0x6f96('0x72')]=_0x503973[_0x6f96('0x72')];_0x503973[_0x6f96('0x25')][_0x6f96('0x73')]=_0x503973[_0x6f96('0x72')];_0x503973[_0x6f96('0x25')][_0x6f96('0x74')]=_0x6f96('0x56');return respondWithRpcPromise(_0x6f96('0x75'),_0x6f96('0x75'),{'event':'acceptmessage','message':_0x503973[_0x6f96('0x25')]},client9002)[_0x6f96('0x32')](function(){return _0x503973;});}return _0x503973;}return null;})[_0x6f96('0x32')](respondWithResult(_0x50a5e6,null))[_0x6f96('0x4c')](handleError(_0x50a5e6,null));};var interaction_log=require(_0x6f96('0x15'))(_0x6f96('0x55'));exports['reject']=function(_0xd0ebc0,_0x28b13d,_0x41de5d){var _0x1f9fd2={'agent':{},'channel':_0x6f96('0x57')};if(_0xd0ebc0[_0x6f96('0x52')]['id']){delete _0xd0ebc0[_0x6f96('0x52')]['id'];}_0xd0ebc0[_0x6f96('0x52')][_0x6f96('0x5c')]=_0xd0ebc0[_0x6f96('0x52')][_0x6f96('0x5c')]||_0xd0ebc0['user']['id'];_0x1f9fd2[_0x6f96('0x5e')]['id']=_0xd0ebc0[_0x6f96('0x52')][_0x6f96('0x5c')];return db['FaxMessage'][_0x6f96('0x50')]({'where':{'id':_0xd0ebc0['params']['id'],'UserId':null}})[_0x6f96('0x32')](handleEntityNotFound(_0x28b13d,null))[_0x6f96('0x32')](function(_0x29ec1c){if(_0x29ec1c){_0x1f9fd2[_0x6f96('0x25')]=_0x29ec1c[_0x6f96('0x5f')]({'plain':!![]});return db[_0x6f96('0x76')][_0x6f96('0x50')]({'where':{'id':_0x29ec1c['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x28b13d,null))[_0x6f96('0x32')](function(_0x1c940d){if(_0x1c940d){_0x1f9fd2[_0x6f96('0x77')]=_0x1c940d[_0x6f96('0x5f')]({'plain':!![]});interaction_log['info'](_0x6f96('0x78'),_0xd0ebc0['user']['id'],_0xd0ebc0[_0x6f96('0x5d')]['name'],_0xd0ebc0[_0x6f96('0x5d')][_0x6f96('0x63')],_0x1f9fd2[_0x6f96('0x77')]['id'],_0xd0ebc0[_0x6f96('0x52')]?JSON['stringify'](_0xd0ebc0[_0x6f96('0x52')]):_0x6f96('0x64'));return respondWithRpcPromise('RejectMessage',_0x6f96('0x79'),_0x1f9fd2);}return null;})['then'](function(_0x47f860){var _0x787b11=_0x6f96('0x66')+_0x47f860[_0x6f96('0x25')]['ContactId'];return db['sequelize'][_0x6f96('0x3c')](_0x787b11,{'type':db[_0x6f96('0x67')][_0x6f96('0x68')][_0x6f96('0x69')],'raw':!![]})[_0x6f96('0x32')](function(_0x1f1db4){return _0x1f1db4;});})['then'](function(_0x15e6ee){if(_0x15e6ee){_0x1f9fd2[_0x6f96('0x25')][_0x6f96('0x6a')]=_0x15e6ee[0x0];if(!_0xd0ebc0[_0x6f96('0x52')]['UserId'])return;return db[_0x6f96('0x6b')]['find']({'where':{'id':_0xd0ebc0[_0x6f96('0x52')][_0x6f96('0x5c')],'role':'agent'},'attributes':['id',_0x6f96('0x34'),'fullname',_0x6f96('0x6d'),_0x6f96('0x6e')],'raw':!![]});}return null;})['then'](function(_0x7094f0){if(!_0x7094f0)return null;_0x1f9fd2[_0x6f96('0x25')]['agent']=_0x7094f0;return _0x1f9fd2;})[_0x6f96('0x32')](function(_0x2a31d5){if(_0x2a31d5){_0x2a31d5['message']['interface']=util[_0x6f96('0x5a')](_0x6f96('0x71'),_0xd0ebc0[_0x6f96('0x5d')][_0x6f96('0x34')]);_0x2a31d5[_0x6f96('0x25')][_0x6f96('0x72')]=_0x1f9fd2[_0x6f96('0x72')];_0x2a31d5[_0x6f96('0x25')][_0x6f96('0x73')]=_0x1f9fd2[_0x6f96('0x72')];_0x2a31d5[_0x6f96('0x25')][_0x6f96('0x74')]=_0x6f96('0x30');respondWithRpcPromise(_0x6f96('0x75'),_0x6f96('0x75'),{'event':_0x6f96('0x7a'),'message':_0x2a31d5[_0x6f96('0x25')]},client9002);return _0x1f9fd2;}return null;})['then'](respondWithResult(_0x28b13d,null))[_0x6f96('0x4c')](handleError(_0x28b13d,null));};exports[_0x6f96('0x7b')]=function(_0x49d903,_0x2db67a){var _0x186521;return db['FaxMessage'][_0x6f96('0x7b')](_0x49d903[_0x6f96('0x52')],{})[_0x6f96('0x32')](function(_0x4780df){_0x186521=_0x4780df;return db[_0x6f96('0x7c')][_0x6f96('0x7d')]({'where':{'id':_0x186521['ContactId']}});})[_0x6f96('0x32')](function(_0x11b9c1){if(_[_0x6f96('0x7e')](_0x11b9c1)){return;}else{_0x186521[_0x6f96('0x57')]=_0x11b9c1[_0x6f96('0x57')];return db['Attachment'][_0x6f96('0x7d')]({'where':{'id':_0x186521[_0x6f96('0x7f')]}});}})[_0x6f96('0x32')](function(_0x5ee92c){return respondWithRpcPromise(_0x6f96('0x80'),_0x6f96('0x80'),{'FaxAccountId':_['isNil'](_0x49d903[_0x6f96('0x52')])?undefined:_0x49d903['body'][_0x6f96('0x81')],'path':_[_0x6f96('0x7e')](_0x5ee92c)?undefined:util[_0x6f96('0x5a')]('/var/opt/motion2/server/files/attachments/%s',_0x5ee92c[_0x6f96('0x82')]),'fax':_[_0x6f96('0x7e')](_0x186521[_0x6f96('0x57')])?undefined:_0x186521['fax'],'AttachmentId':_0x186521[_0x6f96('0x7f')]},client9002);})[_0x6f96('0x32')](respondWithResult(_0x2db67a,0xc9))['catch'](handleError(_0x2db67a,null));};exports[_0x6f96('0x83')]=function(_0x434180,_0xa7cdc4){var _0x5d5393=path[_0x6f96('0x84')](config[_0x6f96('0x85')],_0x6f96('0x86'),'files','attachments');return db['FaxMessage']['find']({'where':{'id':_0x434180['params']['id']},'include':[{'model':db['Attachment'],'as':_0x6f96('0x87')}]})[_0x6f96('0x32')](handleEntityNotFound(_0xa7cdc4,null))[_0x6f96('0x32')](function(_0x21bee4){if(_0x21bee4){return _0xa7cdc4['download'](path[_0x6f96('0x84')](_0x5d5393,_0x21bee4[_0x6f96('0x87')][_0x6f96('0x82')]));}})[_0x6f96('0x4c')](handleError(_0xa7cdc4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c7f08cf..114e74a 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 _0xe978=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','update','remove'];(function(_0x1a0ccd,_0x42629d){var _0x394599=function(_0x22bd6c){while(--_0x22bd6c){_0x1a0ccd['push'](_0x1a0ccd['shift']());}};_0x394599(++_0x42629d);}(_0xe978,0x70));var _0x8e97=function(_0x3add49,_0x381992){_0x3add49=_0x3add49-0x0;var _0x23793c=_0xe978[_0x3add49];return _0x23793c;};'use strict';var EventEmitter=require(_0x8e97('0x0'));var FaxMessage=require(_0x8e97('0x1'))['db'][_0x8e97('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e97('0x3'),'afterDestroy':_0x8e97('0x4')};function emitEvent(_0x16e587){return function(_0x3e3a3a,_0x1e27f7,_0x4f11c9){FaxMessageEvents[_0x8e97('0x5')](_0x16e587+':'+_0x3e3a3a['id'],_0x3e3a3a);FaxMessageEvents[_0x8e97('0x5')](_0x16e587,_0x3e3a3a);_0x4f11c9(null);};}for(var e in events){if(events[_0x8e97('0x6')](e)){var event=events[e];FaxMessage[_0x8e97('0x7')](e,emitEvent(event));}}module[_0x8e97('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x4bd3=['events','FaxMessage','setMaxListeners','emit','hook','exports'];(function(_0x3f670a,_0x46b3a8){var _0x20f09c=function(_0x2a5182){while(--_0x2a5182){_0x3f670a['push'](_0x3f670a['shift']());}};_0x20f09c(++_0x46b3a8);}(_0x4bd3,0x174));var _0x34bd=function(_0x191aed,_0x30e1c0){_0x191aed=_0x191aed-0x0;var _0x227b4d=_0x4bd3[_0x191aed];return _0x227b4d;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x34bd('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){FaxMessageEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);FaxMessageEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ceb6a44..928aa7e 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 _0xca74=['direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','then','update','catch','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get'];(function(_0x23c6a0,_0x84f87a){var _0x4060ec=function(_0x1e4300){while(--_0x1e4300){_0x23c6a0['push'](_0x23c6a0['shift']());}};_0x4060ec(++_0x84f87a);}(_0xca74,0xb3));var _0x4ca7=function(_0x5a7da7,_0x4f132a){_0x5a7da7=_0x5a7da7-0x0;var _0x14459e=_0xca74[_0x5a7da7];return _0x14459e;};'use strict';var _=require(_0x4ca7('0x0'));var util=require(_0x4ca7('0x1'));var logger=require(_0x4ca7('0x2'))('api');var moment=require(_0x4ca7('0x3'));var BPromise=require(_0x4ca7('0x4'));var rp=require(_0x4ca7('0x5'));var fs=require('fs');var path=require(_0x4ca7('0x6'));var rimraf=require('rimraf');var config=require(_0x4ca7('0x7'));var attributes=require(_0x4ca7('0x8'));module[_0x4ca7('0x9')]=function(_0x493991,_0x40267b){return _0x493991[_0x4ca7('0xa')](_0x4ca7('0xb'),attributes,{'tableName':_0x4ca7('0xc'),'paranoid':![],'indexes':[{'name':_0x4ca7('0xd'),'fields':[_0x4ca7('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37f588,_0x4e0bd3,_0x51991a){var _0x1443e7=_0x493991[_0x4ca7('0xf')];var _0x364b66=_0x37f588[_0x4ca7('0x10')]({'plain':!![]});if(_0x364b66[_0x4ca7('0x11')][_0x4ca7('0x12')]()==='in'||_0x364b66['direction']['toLowerCase']()===_0x4ca7('0x13')&&!_0x364b66[_0x4ca7('0x14')]&&!_[_0x4ca7('0x15')](_0x364b66[_0x4ca7('0x16')])){_0x1443e7[_0x4ca7('0x17')]['findOne']({'where':{'id':_0x364b66['FaxInteractionId']}})[_0x4ca7('0x18')](function(_0x50ee50){if(_0x50ee50){_0x50ee50[_0x4ca7('0x19')]({'lastMsgAt':_0x364b66['createdAt'],'lastMsgDirection':_0x364b66[_0x4ca7('0x11')][_0x4ca7('0x12')]()});}})[_0x4ca7('0x1a')](function(_0x241d51){console['error'](_0x241d51);});}_0x51991a();}},'charset':_0x4ca7('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf185=['secret','isNil','UserId','FaxInteractionId','then','createdAt','utf8mb4','lodash','../../config/logger','api','moment','bluebird','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out'];(function(_0xab55c4,_0x3e3e4e){var _0x4cdbda=function(_0x3cf063){while(--_0x3cf063){_0xab55c4['push'](_0xab55c4['shift']());}};_0x4cdbda(++_0x3e3e4e);}(_0xf185,0x19f));var _0x5f18=function(_0x4028a6,_0x7a3bbc){_0x4028a6=_0x4028a6-0x0;var _0x5c6737=_0xf185[_0x4028a6];return _0x5c6737;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var logger=require(_0x5f18('0x1'))(_0x5f18('0x2'));var moment=require(_0x5f18('0x3'));var BPromise=require(_0x5f18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5f18('0x5'));module[_0x5f18('0x6')]=function(_0x473d5c,_0x2ab73a){return _0x473d5c[_0x5f18('0x7')](_0x5f18('0x8'),attributes,{'tableName':_0x5f18('0x9'),'paranoid':![],'indexes':[{'name':_0x5f18('0xa'),'fields':[_0x5f18('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x265b9c,_0x4cf115,_0xe07400){var _0x18745b=_0x473d5c[_0x5f18('0xc')];var _0x7beab3=_0x265b9c[_0x5f18('0xd')]({'plain':!![]});if(_0x7beab3[_0x5f18('0xe')][_0x5f18('0xf')]()==='in'||_0x7beab3[_0x5f18('0xe')][_0x5f18('0xf')]()===_0x5f18('0x10')&&!_0x7beab3[_0x5f18('0x11')]&&!_[_0x5f18('0x12')](_0x7beab3[_0x5f18('0x13')])){_0x18745b['FaxInteraction']['findOne']({'where':{'id':_0x7beab3[_0x5f18('0x14')]}})[_0x5f18('0x15')](function(_0x2b5dd0){if(_0x2b5dd0){_0x2b5dd0['update']({'lastMsgAt':_0x7beab3[_0x5f18('0x16')],'lastMsgDirection':_0x7beab3[_0x5f18('0xe')][_0x5f18('0xf')]()});}})['catch'](function(_0x28e413){console['error'](_0x28e413);});}_0xe07400();}},'charset':_0x5f18('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 761d1ba..5b9f423 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 _0x668b=['./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x251265,_0xd2859f){var _0x2d943a=function(_0x3e756e){while(--_0x3e756e){_0x251265['push'](_0x251265['shift']());}};_0x2d943a(++_0xd2859f);}(_0x668b,0x140));var _0xb668=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x668b[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});config[_0xb668('0xa')]=_[_0xb668('0xb')](config[_0xb668('0xa')],{'host':_0xb668('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb668('0xa')]));require(_0xb668('0xd'))[_0xb668('0xe')](socket);function respondWithRpcPromise(_0x16d50d,_0x39b79c,_0x3606a7){return new BPromise(function(_0x45bc39,_0x3616e9){return client['request'](_0x16d50d,_0x3606a7)[_0xb668('0xf')](function(_0x27dbf7){logger[_0xb668('0x10')](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));logger[_0xb668('0x13')](_0xb668('0x14'),_0x39b79c,_0xb668('0x12'),JSON[_0xb668('0x15')](_0x27dbf7));if(_0x27dbf7[_0xb668('0x16')]){if(_0x27dbf7[_0xb668('0x16')][_0xb668('0x17')]===0x1f4){logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x3616e9(_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);}logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x45bc39(_0x27dbf7['error'][_0xb668('0x18')]);}else{logger['info'](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));_0x45bc39(_0x27dbf7['result'][_0xb668('0x18')]);}})[_0xb668('0x19')](function(_0x53ff78){logger[_0xb668('0x16')]('FaxMessage,\x20%s,\x20%s',_0x39b79c,_0x53ff78);_0x3616e9(_0x53ff78);});});}exports[_0xb668('0x1a')]=function(_0x178a5d){var _0x253ba5=this;return new Promise(function(_0x12805a,_0x5d33ae){return db[_0xb668('0x1b')][_0xb668('0x1c')](_0x178a5d[_0xb668('0x1d')],{'raw':_0x178a5d['options']?_0x178a5d['options'][_0xb668('0x1e')]===undefined?!![]:![]:!![]})[_0xb668('0xf')](function(_0x517eee){logger[_0xb668('0x10')]('CreateFaxMessage',_0x178a5d);logger[_0xb668('0x13')]('CreateFaxMessage',_0x178a5d,JSON[_0xb668('0x15')](_0x517eee));_0x12805a(_0x517eee);})[_0xb668('0x19')](function(_0x3f84c7){logger[_0xb668('0x16')](_0xb668('0x1a'),_0x3f84c7[_0xb668('0x18')],_0x178a5d);_0x5d33ae(_0x253ba5['error'](0x1f4,_0x3f84c7[_0xb668('0x18')]));});});};exports[_0xb668('0x1f')]=function(_0x2ab8c2){var _0x49abfd=this;return new Promise(function(_0x5e0cee,_0xe62fce){return db[_0xb668('0x1b')][_0xb668('0x20')](_0x2ab8c2['body'],{'raw':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab8c2['options']?_0x2ab8c2['options'][_0xb668('0x22')]||null:null,'attributes':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2['options'][_0xb668('0x23')]||null:null,'limit':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x24')]||null:null})[_0xb668('0xf')](function(_0x5f36b5){logger[_0xb668('0x10')](_0xb668('0x1f'),_0x2ab8c2);logger['debug'](_0xb668('0x1f'),_0x2ab8c2,JSON['stringify'](_0x5f36b5));_0x5e0cee(_0x5f36b5);})[_0xb668('0x19')](function(_0x406cc5){logger[_0xb668('0x16')](_0xb668('0x1f'),_0x406cc5[_0xb668('0x18')],_0x2ab8c2);_0xe62fce(_0x49abfd[_0xb668('0x16')](0x1f4,_0x406cc5[_0xb668('0x18')]));});});}; \ No newline at end of file +var _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x354f02,_0x4f2ac4){var _0x2d929b=function(_0x413a38){while(--_0x413a38){_0x354f02['push'](_0x354f02['shift']());}};_0x2d929b(++_0x4f2ac4);}(_0x032e,0x124));var _0xe032=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x032e[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c904ec1..37c24ff 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 _0x7fa0=['removeListener','register','length','./faxMessage.events','remove','update','emit'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x7fa0,0x11b));var _0x07fa=function(_0x87eff8,_0x17ee9a){_0x87eff8=_0x87eff8-0x0;var _0x585883=_0x7fa0[_0x87eff8];return _0x585883;};'use strict';var FaxMessageEvents=require(_0x07fa('0x0'));var events=['save',_0x07fa('0x1'),_0x07fa('0x2')];function createListener(_0x35db09,_0x1b7f76){return function(_0x3820aa){_0x1b7f76[_0x07fa('0x3')](_0x35db09,_0x3820aa);};}function removeListener(_0x4e8cce,_0x404946){return function(){FaxMessageEvents[_0x07fa('0x4')](_0x4e8cce,_0x404946);};}exports[_0x07fa('0x5')]=function(_0x508be3){for(var _0x1438cc=0x0,_0x57215b=events[_0x07fa('0x6')];_0x1438cc<_0x57215b;_0x1438cc++){var _0x3156a3=events[_0x1438cc];var _0x424205=createListener('faxMessage:'+_0x3156a3,_0x508be3);FaxMessageEvents['on'](_0x3156a3,_0x424205);}}; \ No newline at end of file +var _0x5e2a=['save','emit','removeListener','length','./faxMessage.events'];(function(_0x2553c0,_0x57b11e){var _0x24c80f=function(_0x449dcb){while(--_0x449dcb){_0x2553c0['push'](_0x2553c0['shift']());}};_0x24c80f(++_0x57b11e);}(_0x5e2a,0x1e4));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require(_0xa5e2('0x0'));var events=[_0xa5e2('0x1'),'remove','update'];function createListener(_0x462045,_0x256950){return function(_0x16abb2){_0x256950[_0xa5e2('0x2')](_0x462045,_0x16abb2);};}function removeListener(_0x64ce1a,_0x51e342){return function(){FaxMessageEvents[_0xa5e2('0x3')](_0x64ce1a,_0x51e342);};}exports['register']=function(_0x2c8477){for(var _0x27b15c=0x0,_0x83988c=events[_0xa5e2('0x4')];_0x27b15c<_0x83988c;_0x27b15c++){var _0x59cb3a=events[_0x27b15c];var _0x1535b9=createListener('faxMessage:'+_0x59cb3a,_0x2c8477);FaxMessageEvents['on'](_0x59cb3a,_0x1535b9);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ff4dca9..f25d305 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 _0x9348=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer'];(function(_0x2046e9,_0x49ecdd){var _0x1aebb0=function(_0x1f6eee){while(--_0x1f6eee){_0x2046e9['push'](_0x2046e9['shift']());}};_0x1aebb0(++_0x49ecdd);}(_0x9348,0x10d));var _0x8934=function(_0x314148,_0x50e34b){_0x314148=_0x314148-0x0;var _0x5703c4=_0x9348[_0x314148];return _0x5703c4;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/describe',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0xf')]('/',auth[_0x8934('0xa')](),interaction[_0x8934('0x10')](_0x8934('0x11'),_0x8934('0x12')),controller[_0x8934('0x13')]);router[_0x8934('0x14')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0x15')]);router[_0x8934('0x14')](_0x8934('0x16'),auth[_0x8934('0xa')](),controller[_0x8934('0x17')]);router['put'](_0x8934('0x18'),auth[_0x8934('0xa')](),controller[_0x8934('0x19')]);router[_0x8934('0x1a')](_0x8934('0x1b'),auth[_0x8934('0xa')](),controller[_0x8934('0x1c')]);module[_0x8934('0x1d')]=router; \ No newline at end of file +var _0x1be1=['create','put','update','/:id/accept','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','faxmessage:create'];(function(_0x1b8b95,_0x3ea343){var _0x3657ae=function(_0x3703e1){while(--_0x3703e1){_0x1b8b95['push'](_0x1b8b95['shift']());}};_0x3657ae(++_0x3ea343);}(_0x1be1,0x192));var _0x11be=function(_0x30fdfc,_0x1128b5){_0x30fdfc=_0x30fdfc-0x0;var _0x73e6dc=_0x1be1[_0x30fdfc];return _0x73e6dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),interaction[_0x11be('0xe')]('fax',_0x11be('0xf')),controller[_0x11be('0x10')]);router[_0x11be('0x11')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x12')]);router['put'](_0x11be('0x13'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x11be('0xa'),auth['isAuthenticated'](),controller[_0x11be('0x14')]);module[_0x11be('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b4a68c3..03a6631 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 _0x96fd=['name','STRING','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x96fd,0x1e9));var _0xd96f=function(_0x201de4,_0x3fb35d){_0x201de4=_0x201de4-0x0;var _0x15e333=_0x96fd[_0x201de4];return _0x15e333;};'use strict';var Sequelize=require('sequelize');module[_0xd96f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd96f('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd96f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd96f('0x3')](_0xd96f('0x4'),_0xd96f('0x5'),_0xd96f('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x048f=['exports','name','INTEGER','ENUM','beepall','sequelize'];(function(_0x20744c,_0x327e08){var _0x385299=function(_0x5191ef){while(--_0x5191ef){_0x20744c['push'](_0x20744c['shift']());}};_0x385299(++_0x327e08);}(_0x048f,0x1c7));var _0xf048=function(_0x49ef82,_0x300f00){_0x49ef82=_0x49ef82-0x0;var _0x4a3115=_0x048f[_0x49ef82];return _0x4a3115;};'use strict';var Sequelize=require(_0xf048('0x0'));module[_0xf048('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf048('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf048('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf048('0x4')]('rrmemory',_0xf048('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf048('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 7128aec..1d8f7a4 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 _0xd1f1=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userFaxQueue:remove','addAgents','omit','emit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','FaxQueue','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x24fd69,_0x328118){var _0x3750b3=function(_0x3441e7){while(--_0x3441e7){_0x24fd69['push'](_0x24fd69['shift']());}};_0x3750b3(++_0x328118);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x3c2a3a,_0x23b601){_0x3c2a3a=_0x3c2a3a-0x0;var _0x3c5e96=_0xd1f1[_0x3c2a3a];return _0x3c5e96;};'use strict';var emlformat=require(_0x1d1f('0x0'));var rimraf=require(_0x1d1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d1f('0x2'));var rp=require(_0x1d1f('0x3'));var moment=require(_0x1d1f('0x4'));var BPromise=require(_0x1d1f('0x5'));var Mustache=require(_0x1d1f('0x6'));var util=require(_0x1d1f('0x7'));var path=require(_0x1d1f('0x8'));var sox=require('sox');var csv=require(_0x1d1f('0x9'));var ejs=require(_0x1d1f('0xa'));var fs=require('fs');var fs_extra=require(_0x1d1f('0xb'));var _=require(_0x1d1f('0xc'));var squel=require(_0x1d1f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d1f('0x9'));var querystring=require(_0x1d1f('0xe'));var Papa=require(_0x1d1f('0xf'));var Redis=require(_0x1d1f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d1f('0x11'));var as=require(_0x1d1f('0x12'));var hardwareService=require(_0x1d1f('0x13'));var logger=require(_0x1d1f('0x14'))(_0x1d1f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d1f('0x16'));var db=require(_0x1d1f('0x17'))['db'];config['redis']=_[_0x1d1f('0x18')](config[_0x1d1f('0x19')],{'host':_0x1d1f('0x1a'),'port':0x18eb});var socket=require(_0x1d1f('0x1b'))(new Redis(config['redis']));require(_0x1d1f('0x1c'))[_0x1d1f('0x1d')](socket);function respondWithStatusCode(_0x3db906,_0x2599e5){_0x2599e5=_0x2599e5||0xcc;return function(_0x465f39){if(_0x465f39){return _0x3db906[_0x1d1f('0x1e')](_0x2599e5);}return _0x3db906[_0x1d1f('0x1f')](_0x2599e5)[_0x1d1f('0x20')]();};}function respondWithResult(_0x3f66c7,_0xb638a2){_0xb638a2=_0xb638a2||0xc8;return function(_0x289f56){if(_0x289f56){return _0x3f66c7[_0x1d1f('0x1f')](_0xb638a2)[_0x1d1f('0x21')](_0x289f56);}};}function respondWithFilteredResult(_0x3a9c75,_0x5c0339){return function(_0x53ff5f){if(_0x53ff5f){var _0x498fd0=typeof _0x5c0339[_0x1d1f('0x22')]==='undefined'&&typeof _0x5c0339[_0x1d1f('0x23')]==='undefined';var _0x4938d6=_0x53ff5f['count'];var _0x49f175=_0x498fd0?0x0:_0x5c0339['offset'];var _0x46bfa2=_0x498fd0?_0x53ff5f[_0x1d1f('0x24')]:_0x5c0339[_0x1d1f('0x22')]+_0x5c0339[_0x1d1f('0x23')];var _0x507ee0;if(_0x46bfa2>=_0x4938d6){_0x46bfa2=_0x4938d6;_0x507ee0=0xc8;}else{_0x507ee0=0xce;}_0x3a9c75['status'](_0x507ee0);return _0x3a9c75[_0x1d1f('0x25')]('Content-Range',_0x49f175+'-'+_0x46bfa2+'/'+_0x4938d6)[_0x1d1f('0x21')](_0x53ff5f);}return null;};}function patchUpdates(_0x2c2518){return function(_0x388092){try{jsonpatch[_0x1d1f('0x26')](_0x388092,_0x2c2518,!![]);}catch(_0x23189b){return BPromise[_0x1d1f('0x27')](_0x23189b);}return _0x388092['save']();};}function saveUpdates(_0x3fe260,_0xc57589){return function(_0x596c1a){if(_0x596c1a){return _0x596c1a[_0x1d1f('0x28')](_0x3fe260)[_0x1d1f('0x29')](function(_0x2aabc7){return _0x2aabc7;});}return null;};}function removeEntity(_0x585ec7,_0x2aebd3){return function(_0x1d4161){if(_0x1d4161){return _0x1d4161[_0x1d1f('0x2a')]()['then'](function(){var _0x238db7=_0x1d4161[_0x1d1f('0x2b')]({'plain':!![]});var _0x34f89a='FaxQueues';return db[_0x1d1f('0x2c')][_0x1d1f('0x2a')]({'where':{'type':_0x34f89a,'resourceId':_0x238db7['id']}})[_0x1d1f('0x29')](function(){return _0x1d4161;});})[_0x1d1f('0x29')](function(){_0x585ec7[_0x1d1f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4989de,_0x2cc444){return function(_0x26b533){if(!_0x26b533){_0x4989de[_0x1d1f('0x1e')](0x194);}return _0x26b533;};}function handleError(_0x52c05e,_0x292c89){_0x292c89=_0x292c89||0x1f4;return function(_0xaf069f){logger['error'](_0xaf069f[_0x1d1f('0x2d')]);if(_0xaf069f[_0x1d1f('0x2e')]){delete _0xaf069f['name'];}_0x52c05e[_0x1d1f('0x1f')](_0x292c89)[_0x1d1f('0x2f')](_0xaf069f);};}exports[_0x1d1f('0x30')]=function(_0x3aba6a,_0x3a2cd3){var _0x148a51={},_0x30a998={},_0xa7bb56={'count':0x0,'rows':[]};var _0x306765=_['map'](db[_0x1d1f('0x31')]['rawAttributes'],function(_0x286671){return{'name':_0x286671['fieldName'],'type':_0x286671['type']['key']};});_0x30a998[_0x1d1f('0x32')]=_[_0x1d1f('0x33')](_0x306765,_0x1d1f('0x2e'));_0x30a998[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x3aba6a['query']);_0x30a998[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0x30a998[_0x1d1f('0x32')],_0x30a998[_0x1d1f('0x34')]);_0x148a51[_0x1d1f('0x38')]=_[_0x1d1f('0x37')](_0x30a998[_0x1d1f('0x32')],qs[_0x1d1f('0x39')](_0x3aba6a[_0x1d1f('0x34')]['fields']));_0x148a51[_0x1d1f('0x38')]=_0x148a51[_0x1d1f('0x38')][_0x1d1f('0x3a')]?_0x148a51[_0x1d1f('0x38')]:_0x30a998['model'];if(!_0x3aba6a[_0x1d1f('0x34')][_0x1d1f('0x3b')](_0x1d1f('0x3c'))){_0x148a51[_0x1d1f('0x23')]=qs[_0x1d1f('0x23')](_0x3aba6a['query']['limit']);_0x148a51[_0x1d1f('0x22')]=qs[_0x1d1f('0x22')](_0x3aba6a[_0x1d1f('0x34')][_0x1d1f('0x22')]);}_0x148a51[_0x1d1f('0x3d')]=qs[_0x1d1f('0x3e')](_0x3aba6a[_0x1d1f('0x34')][_0x1d1f('0x3e')]);_0x148a51[_0x1d1f('0x3f')]=qs[_0x1d1f('0x36')](_[_0x1d1f('0x40')](_0x3aba6a[_0x1d1f('0x34')],_0x30a998[_0x1d1f('0x36')]),_0x306765);if(_0x3aba6a[_0x1d1f('0x34')]['filter']){_0x148a51[_0x1d1f('0x3f')]=_[_0x1d1f('0x41')](_0x148a51[_0x1d1f('0x3f')],{'$or':_[_0x1d1f('0x33')](_0x306765,function(_0x75039a){if(_0x75039a[_0x1d1f('0x42')]!==_0x1d1f('0x43')){var _0x2a11b4={};_0x2a11b4[_0x75039a[_0x1d1f('0x2e')]]={'$like':'%'+_0x3aba6a[_0x1d1f('0x34')][_0x1d1f('0x44')]+'%'};return _0x2a11b4;}})});}_0x148a51=_[_0x1d1f('0x41')]({},_0x148a51,_0x3aba6a[_0x1d1f('0x45')]);var _0x2b7f4d={'where':_0x148a51[_0x1d1f('0x3f')]};return db[_0x1d1f('0x31')][_0x1d1f('0x24')](_0x2b7f4d)[_0x1d1f('0x29')](function(_0x911278){_0xa7bb56['count']=_0x911278;if(_0x3aba6a[_0x1d1f('0x34')][_0x1d1f('0x46')]){_0x148a51['include']=[{'all':!![]}];}return db[_0x1d1f('0x31')][_0x1d1f('0x47')](_0x148a51);})[_0x1d1f('0x29')](function(_0x5d7cb4){_0xa7bb56[_0x1d1f('0x48')]=_0x5d7cb4;return _0xa7bb56;})['then'](respondWithFilteredResult(_0x3a2cd3,_0x148a51))[_0x1d1f('0x49')](handleError(_0x3a2cd3,null));};exports[_0x1d1f('0x4a')]=function(_0x9ff313,_0x12ed09){var _0x89d680={'raw':!![],'where':{'id':_0x9ff313[_0x1d1f('0x4b')]['id']}},_0x3e9393={};_0x3e9393['model']=_[_0x1d1f('0x35')](db[_0x1d1f('0x31')][_0x1d1f('0x4c')]);_0x3e9393[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x9ff313[_0x1d1f('0x34')]);_0x3e9393['filters']=_[_0x1d1f('0x37')](_0x3e9393[_0x1d1f('0x32')],_0x3e9393[_0x1d1f('0x34')]);_0x89d680['attributes']=_[_0x1d1f('0x37')](_0x3e9393[_0x1d1f('0x32')],qs[_0x1d1f('0x39')](_0x9ff313[_0x1d1f('0x34')][_0x1d1f('0x39')]));_0x89d680[_0x1d1f('0x38')]=_0x89d680[_0x1d1f('0x38')][_0x1d1f('0x3a')]?_0x89d680[_0x1d1f('0x38')]:_0x3e9393[_0x1d1f('0x32')];if(_0x9ff313['query'][_0x1d1f('0x46')]){_0x89d680[_0x1d1f('0x4d')]=[{'all':!![]}];}_0x89d680=_['merge']({},_0x89d680,_0x9ff313[_0x1d1f('0x45')]);return db[_0x1d1f('0x31')][_0x1d1f('0x4e')](_0x89d680)[_0x1d1f('0x29')](handleEntityNotFound(_0x12ed09,null))[_0x1d1f('0x29')](respondWithResult(_0x12ed09,null))[_0x1d1f('0x49')](handleError(_0x12ed09,null));};exports[_0x1d1f('0x4f')]=function(_0x4728a5,_0x593d4e){return db[_0x1d1f('0x31')][_0x1d1f('0x4f')](_0x4728a5[_0x1d1f('0x50')],{})['then'](function(_0x49e092){var _0x7bef75=_0x4728a5['user']['get']({'plain':!![]});if(!_0x7bef75)throw new Error(_0x1d1f('0x51'));if(_0x7bef75[_0x1d1f('0x52')]==='user'){var _0x263242=_0x49e092['get']({'plain':!![]});var _0x20f5bc='FaxQueues';return db[_0x1d1f('0x53')][_0x1d1f('0x4e')]({'where':{'name':_0x20f5bc,'userProfileId':_0x7bef75['userProfileId']},'raw':!![]})[_0x1d1f('0x29')](function(_0x77a0ea){if(_0x77a0ea&&_0x77a0ea[_0x1d1f('0x54')]===0x0){return db['UserProfileResource'][_0x1d1f('0x4f')]({'name':_0x263242[_0x1d1f('0x2e')],'resourceId':_0x263242['id'],'type':_0x77a0ea[_0x1d1f('0x2e')],'sectionId':_0x77a0ea['id']},{})['then'](function(){return _0x49e092;});}else{return _0x49e092;}})[_0x1d1f('0x49')](function(_0x30b3b1){logger['error'](_0x1d1f('0x55'),_0x30b3b1);throw _0x30b3b1;});}return _0x49e092;})[_0x1d1f('0x29')](respondWithResult(_0x593d4e,0xc9))[_0x1d1f('0x49')](handleError(_0x593d4e,null));};exports[_0x1d1f('0x28')]=function(_0x299d44,_0x1a9a51){if(_0x299d44['body']['id']){delete _0x299d44[_0x1d1f('0x50')]['id'];}return db[_0x1d1f('0x31')][_0x1d1f('0x4e')]({'where':{'id':_0x299d44[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x1a9a51,null))['then'](saveUpdates(_0x299d44[_0x1d1f('0x50')],null))[_0x1d1f('0x29')](respondWithResult(_0x1a9a51,null))[_0x1d1f('0x49')](handleError(_0x1a9a51,null));};exports[_0x1d1f('0x2a')]=function(_0x224aeb,_0x424b71){return db[_0x1d1f('0x31')][_0x1d1f('0x4e')]({'where':{'id':_0x224aeb[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x424b71,null))[_0x1d1f('0x29')](removeEntity(_0x424b71,null))[_0x1d1f('0x49')](handleError(_0x424b71,null));};exports[_0x1d1f('0x56')]=function(_0x270ce8,_0x564be0){return db[_0x1d1f('0x31')][_0x1d1f('0x56')]()[_0x1d1f('0x29')](respondWithResult(_0x564be0,null))[_0x1d1f('0x49')](handleError(_0x564be0,null));};exports['getMembers']=function(_0x4837bc,_0x105b47,_0x59b990){var _0x31d9d7={'raw':!![],'where':{}},_0x5a2016={},_0xe7555a;return db['FaxQueue'][_0x1d1f('0x57')]({'where':{'id':_0x4837bc[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x105b47,null))[_0x1d1f('0x29')](function(_0x49a3b9){if(_0x49a3b9){_0xe7555a=_0x49a3b9[_0x1d1f('0x2b')]({'plain':!![]});_0x5a2016['model']=_[_0x1d1f('0x35')](db[_0x1d1f('0x58')][_0x1d1f('0x4c')]);_0x5a2016[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x4837bc[_0x1d1f('0x34')]);_0x5a2016['filters']=_[_0x1d1f('0x37')](_0x5a2016['model'],_0x5a2016[_0x1d1f('0x34')]);_0x31d9d7[_0x1d1f('0x38')]=_[_0x1d1f('0x37')](_0x5a2016['model'],qs[_0x1d1f('0x39')](_0x4837bc[_0x1d1f('0x34')]['fields']));_0x31d9d7[_0x1d1f('0x38')]=_0x31d9d7[_0x1d1f('0x38')][_0x1d1f('0x3a')]?_0x31d9d7[_0x1d1f('0x38')]:_0x5a2016[_0x1d1f('0x32')];if(!_0x4837bc['query'][_0x1d1f('0x3b')](_0x1d1f('0x3c'))){_0x31d9d7['limit']=qs[_0x1d1f('0x23')](_0x4837bc['query'][_0x1d1f('0x23')]);_0x31d9d7[_0x1d1f('0x22')]=qs['offset'](_0x4837bc[_0x1d1f('0x34')][_0x1d1f('0x22')]);}_0x31d9d7[_0x1d1f('0x3d')]=qs['sort'](_0x4837bc[_0x1d1f('0x34')]['sort']);_0x31d9d7['where']=qs['filters'](_['pick'](_0x4837bc['query'],_0x5a2016[_0x1d1f('0x36')]));_0x31d9d7[_0x1d1f('0x3f')][_0x1d1f('0x59')]=_0x49a3b9['id'];if(_0x4837bc['query']['filter']){_0x31d9d7[_0x1d1f('0x3f')]=_[_0x1d1f('0x41')](_0x31d9d7[_0x1d1f('0x3f')],{'$or':_[_0x1d1f('0x33')](_0x31d9d7['attributes'],function(_0x374962){var _0x1fe7c3={};_0x1fe7c3[_0x374962]={'$like':'%'+_0x4837bc[_0x1d1f('0x34')][_0x1d1f('0x44')]+'%'};return _0x1fe7c3;})});}_0x31d9d7=_['merge']({},_0x31d9d7,_0x4837bc[_0x1d1f('0x45')]);return db['UserFaxQueue'][_0x1d1f('0x47')](_0x31d9d7);}})[_0x1d1f('0x29')](function(_0x80a388){if(_0x80a388){return db[_0x1d1f('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x80a388,_0x1d1f('0x5b')),'role':_0x1d1f('0x5c')},'attributes':['id',_0x1d1f('0x2e'),_0x1d1f('0x5d'),_0x1d1f('0x5e'),_0x1d1f('0x5f')]});}})[_0x1d1f('0x29')](function(_0x286511){if(_0x286511){return{'count':_0x286511[_0x1d1f('0x24')],'rows':_['map'](_0x286511[_0x1d1f('0x48')],function(_0x3b49d8){return{'membername':_0x3b49d8[_0x1d1f('0x2e')],'UserId':_0x3b49d8['id'],'queue_name':_0xe7555a[_0x1d1f('0x2e')],'FaxQueueId':_0xe7555a['id'],'interface':util[_0x1d1f('0x60')]('%s/%s','SIP',_0x3b49d8[_0x1d1f('0x2e')]),'penalty':0x0,'paused':_0x3b49d8[_0x1d1f('0x5d')],'createdAt':_0x3b49d8[_0x1d1f('0x5f')],'updatedAt':_0x3b49d8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1d1f('0x29')](respondWithFilteredResult(_0x105b47,_0x31d9d7))[_0x1d1f('0x49')](handleError(_0x105b47,null));};exports[_0x1d1f('0x61')]=function(_0x214bce,_0x73ad17,_0x97f00b){var _0x2640ca={};var _0x16a6d9={};var _0x5dfdd8;var _0x376603;return db[_0x1d1f('0x31')][_0x1d1f('0x57')]({'where':{'id':_0x214bce['params']['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x73ad17,null))[_0x1d1f('0x29')](function(_0xbe24d6){if(_0xbe24d6){_0x5dfdd8=_0xbe24d6;_0x16a6d9[_0x1d1f('0x32')]=_['keys'](db[_0x1d1f('0x62')]['rawAttributes']);_0x16a6d9[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x214bce[_0x1d1f('0x34')]);_0x16a6d9[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0x16a6d9['model'],_0x16a6d9[_0x1d1f('0x34')]);_0x2640ca['attributes']=_[_0x1d1f('0x37')](_0x16a6d9[_0x1d1f('0x32')],qs['fields'](_0x214bce[_0x1d1f('0x34')][_0x1d1f('0x39')]));_0x2640ca['attributes']=_0x2640ca[_0x1d1f('0x38')][_0x1d1f('0x3a')]?_0x2640ca[_0x1d1f('0x38')]:_0x16a6d9[_0x1d1f('0x32')];_0x2640ca[_0x1d1f('0x3d')]=qs[_0x1d1f('0x3e')](_0x214bce[_0x1d1f('0x34')][_0x1d1f('0x3e')]);_0x2640ca[_0x1d1f('0x3f')]=qs[_0x1d1f('0x36')](_[_0x1d1f('0x40')](_0x214bce[_0x1d1f('0x34')],_0x16a6d9[_0x1d1f('0x36')]));if(_0x214bce[_0x1d1f('0x34')][_0x1d1f('0x44')]){_0x2640ca['where']=_[_0x1d1f('0x41')](_0x2640ca[_0x1d1f('0x3f')],{'$or':_['map'](_0x2640ca[_0x1d1f('0x38')],function(_0x9daf08){var _0x3d4971={};_0x3d4971[_0x9daf08]={'$like':'%'+_0x214bce[_0x1d1f('0x34')][_0x1d1f('0x44')]+'%'};return _0x3d4971;})});}_0x2640ca=_[_0x1d1f('0x41')]({},_0x2640ca,_0x214bce[_0x1d1f('0x45')]);return _0x5dfdd8[_0x1d1f('0x61')](_0x2640ca);}})[_0x1d1f('0x29')](function(_0x506e4e){if(_0x506e4e){_0x376603=_0x506e4e[_0x1d1f('0x3a')];if(!_0x214bce[_0x1d1f('0x34')][_0x1d1f('0x3b')]('nolimit')){_0x2640ca[_0x1d1f('0x23')]=qs[_0x1d1f('0x23')](_0x214bce[_0x1d1f('0x34')]['limit']);_0x2640ca['offset']=qs[_0x1d1f('0x22')](_0x214bce['query'][_0x1d1f('0x22')]);}return _0x5dfdd8['getTeams'](_0x2640ca);}})[_0x1d1f('0x29')](function(_0x152ca4){if(_0x152ca4){return _0x152ca4?{'count':_0x376603,'rows':_0x152ca4}:null;}})['then'](respondWithResult(_0x73ad17,null))[_0x1d1f('0x49')](handleError(_0x73ad17,null));};exports[_0x1d1f('0x63')]=function(_0x18cc48,_0x24e722,_0x2f7f66){var _0x1443fd=_0x18cc48[_0x1d1f('0x50')][_0x1d1f('0x64')];return db['Team'][_0x1d1f('0x47')]({'where':{'id':_0x1443fd},'attributes':['id'],'include':[{'model':db[_0x1d1f('0x5a')],'as':_0x1d1f('0x65'),'attributes':['id',_0x1d1f('0x2e'),_0x1d1f('0x66'),_0x1d1f('0x67'),'interface'],'raw':!![]}]})[_0x1d1f('0x29')](function(_0x50b96d){if(_0x50b96d){var _0x4f640b=_[_0x1d1f('0x68')](_0x50b96d,function(_0x3beec8){var _0x8d1062=_0x3beec8['get']({'plain':!![]});return _0x8d1062[_0x1d1f('0x65')];});return db[_0x1d1f('0x31')][_0x1d1f('0x4e')]({'where':{'id':_0x18cc48[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x29')](function(_0x230beb){return db[_0x1d1f('0x69')][_0x1d1f('0x6a')](function(_0x2a6d52){return _0x230beb[_0x1d1f('0x63')](_0x1443fd,{'transaction':_0x2a6d52})[_0x1d1f('0x29')](function(){return BPromise[_0x1d1f('0x6b')](_0x4f640b,function(_0x189c57){return db[_0x1d1f('0x58')][_0x1d1f('0x6c')]({'where':{'UserId':_0x189c57['id'],'FaxQueueId':_0x18cc48[_0x1d1f('0x4b')]['id']},'transaction':_0x2a6d52});});})['then'](function(){_0x4f640b[_0x1d1f('0x6d')](function(_0xabd517){socket['emit'](_0x1d1f('0x6e'),{'UserId':_0xabd517['id'],'FaxQueueId':_0x230beb['id']});});});});});}})[_0x1d1f('0x29')](respondWithStatusCode(_0x24e722,null))[_0x1d1f('0x49')](handleError(_0x24e722,null));};exports['removeTeams']=function(_0x4cba78,_0x2280b3,_0x479528){return db[_0x1d1f('0x62')][_0x1d1f('0x47')]({'where':{'id':_0x4cba78[_0x1d1f('0x34')][_0x1d1f('0x64')]},'attributes':['id'],'include':[{'model':db[_0x1d1f('0x5a')],'as':_0x1d1f('0x65'),'attributes':['id'],'raw':!![]}]})[_0x1d1f('0x29')](handleEntityNotFound(_0x2280b3,null))[_0x1d1f('0x29')](function(_0x38421d){var _0x1bf8e9=_['map'](_0x38421d,'id');var _0x3da0cd=[];var _0x5d855b=[];var _0x29cea3=squel[_0x1d1f('0x6f')]();_0x29cea3[_0x1d1f('0x70')](_0x1d1f('0x71'))['from'](_0x1d1f('0x72'),'tq')['join']('user_has_teams','ut',_0x1d1f('0x73'))[_0x1d1f('0x3f')](_0x1d1f('0x74'),_0x4cba78[_0x1d1f('0x4b')]['id']);for(var _0x17e6d8=0x0;_0x17e6d8<_0x38421d[_0x1d1f('0x3a')];_0x17e6d8+=0x1){let _0x2a0d76=_0x38421d[_0x17e6d8];for(var _0x705764=0x0;_0x705764<_0x2a0d76['Agents'][_0x1d1f('0x3a')];_0x705764+=0x1){let _0x2e54e6=_0x2a0d76['Agents'][_0x705764];var _0x3e48ea=_0x29cea3[_0x1d1f('0x75')]();_0x3e48ea[_0x1d1f('0x3f')]('ut.UserId\x20=\x20?',_0x2e54e6['id']);_0x5d855b[_0x1d1f('0x76')](db[_0x1d1f('0x69')]['query'](_0x3e48ea[_0x1d1f('0x77')](),{'type':db[_0x1d1f('0x69')][_0x1d1f('0x78')][_0x1d1f('0x79')]})[_0x1d1f('0x29')](function(_0x3325ab){if(_0x3325ab[_0x1d1f('0x3a')]===0x1){return _0x2e54e6['id'];}else{var _0x2f7ba4=_['every'](_[_0x1d1f('0x33')](_0x3325ab,_0x1d1f('0x7a')),function(_0xce3b8b){return _[_0x1d1f('0x7b')](_0x1bf8e9,_0xce3b8b);});if(_0x2f7ba4){return _0x2e54e6['id'];}}}));}}return BPromise[_0x1d1f('0x7c')](_0x5d855b)[_0x1d1f('0x29')](function(_0x3d85df){_0x3da0cd=_(_0x3da0cd)[_0x1d1f('0x7d')](_0x3d85df)[_0x1d1f('0x7e')]()[_0x1d1f('0x7f')]();return db['FaxQueue'][_0x1d1f('0x4e')]({'where':{'id':_0x4cba78[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x29')](function(_0x51c8c2){return db['sequelize'][_0x1d1f('0x6a')](function(_0x1e3072){return _0x51c8c2[_0x1d1f('0x80')](_0x4cba78['query'][_0x1d1f('0x64')],{'transaction':_0x1e3072})[_0x1d1f('0x29')](function(){if(!_['isEmpty'](_0x3da0cd)){return _0x51c8c2[_0x1d1f('0x81')](_0x3da0cd,{'transaction':_0x1e3072});}})['then'](function(){_0x3da0cd['forEach'](function(_0x21f5f4){socket['emit'](_0x1d1f('0x82'),{'UserId':_0x21f5f4,'FaxQueueId':_0x51c8c2['id']});});});});});});})[_0x1d1f('0x29')](respondWithStatusCode(_0x2280b3,null))['catch'](handleError(_0x2280b3,null));};exports[_0x1d1f('0x83')]=function(_0x1c8c38,_0x39d5f,_0x1ecbe7){return db[_0x1d1f('0x31')]['find']({'where':{'id':_0x1c8c38[_0x1d1f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39d5f,null))[_0x1d1f('0x29')](function(_0x193219){if(_0x193219){return _0x193219[_0x1d1f('0x83')](_0x1c8c38[_0x1d1f('0x50')][_0x1d1f('0x64')],_[_0x1d1f('0x84')](_0x1c8c38[_0x1d1f('0x50')],[_0x1d1f('0x64'),'id'])||{})['spread'](function(_0x96c8e5){for(var _0x2aca9d=0x0;_0x2aca9d<_0x1c8c38[_0x1d1f('0x50')][_0x1d1f('0x64')][_0x1d1f('0x3a')];_0x2aca9d+=0x1){socket[_0x1d1f('0x85')](_0x1d1f('0x6e'),{'UserId':Number(_0x1c8c38[_0x1d1f('0x50')]['ids'][_0x2aca9d]),'FaxQueueId':Number(_0x1c8c38[_0x1d1f('0x4b')]['id'])});}return _0x96c8e5;});}})['then'](respondWithResult(_0x39d5f,null))[_0x1d1f('0x49')](handleError(_0x39d5f,null));};exports[_0x1d1f('0x81')]=function(_0x34b27f,_0x11c6a2,_0x39e040){return db[_0x1d1f('0x31')][_0x1d1f('0x4e')]({'where':{'id':_0x34b27f[_0x1d1f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11c6a2,null))['then'](function(_0x5b6bc2){if(_0x5b6bc2){return _0x5b6bc2[_0x1d1f('0x81')](_0x34b27f[_0x1d1f('0x34')][_0x1d1f('0x64')])['then'](function(){if(_[_0x1d1f('0x86')](_0x34b27f['query'][_0x1d1f('0x64')])){for(var _0x25a36a=0x0;_0x25a36a<_0x34b27f[_0x1d1f('0x34')][_0x1d1f('0x64')][_0x1d1f('0x3a')];_0x25a36a+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x34b27f[_0x1d1f('0x34')][_0x1d1f('0x64')][_0x25a36a]),'FaxQueueId':Number(_0x34b27f[_0x1d1f('0x4b')]['id'])});}}else{socket[_0x1d1f('0x85')](_0x1d1f('0x82'),{'UserId':Number(_0x34b27f[_0x1d1f('0x34')][_0x1d1f('0x64')]),'FaxQueueId':Number(_0x34b27f[_0x1d1f('0x4b')]['id'])});}});}})[_0x1d1f('0x29')](respondWithStatusCode(_0x11c6a2,null))[_0x1d1f('0x49')](handleError(_0x11c6a2,null));};exports[_0x1d1f('0x87')]=function(_0x1aedcf,_0x360b8c,_0x58daa0){var _0x11efff={};var _0x17265d={};var _0x2350af;var _0x4e2dd0;return db['FaxQueue']['findOne']({'where':{'id':_0x1aedcf['params']['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x360b8c,null))[_0x1d1f('0x29')](function(_0x4c66a6){if(_0x4c66a6){_0x2350af=_0x4c66a6;_0x17265d[_0x1d1f('0x32')]=_['keys'](db[_0x1d1f('0x5a')][_0x1d1f('0x4c')]);_0x17265d[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x1aedcf[_0x1d1f('0x34')]);_0x17265d[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0x17265d[_0x1d1f('0x32')],_0x17265d[_0x1d1f('0x34')]);_0x11efff[_0x1d1f('0x38')]=_['intersection'](_0x17265d[_0x1d1f('0x32')],qs[_0x1d1f('0x39')](_0x1aedcf['query'][_0x1d1f('0x39')]));_0x11efff[_0x1d1f('0x38')]=_0x11efff[_0x1d1f('0x38')]['length']?_0x11efff[_0x1d1f('0x38')]:_0x17265d['model'];_0x11efff['order']=qs[_0x1d1f('0x3e')](_0x1aedcf['query'][_0x1d1f('0x3e')]);_0x11efff[_0x1d1f('0x3f')]=qs['filters'](_[_0x1d1f('0x40')](_0x1aedcf[_0x1d1f('0x34')],_0x17265d['filters']));if(_0x1aedcf['query'][_0x1d1f('0x44')]){_0x11efff[_0x1d1f('0x3f')]=_[_0x1d1f('0x41')](_0x11efff[_0x1d1f('0x3f')],{'$or':_['map'](_0x11efff[_0x1d1f('0x38')],function(_0x4c8fbf){var _0x5d926d={};_0x5d926d[_0x4c8fbf]={'$like':'%'+_0x1aedcf[_0x1d1f('0x34')]['filter']+'%'};return _0x5d926d;})});}_0x11efff=_[_0x1d1f('0x41')]({},_0x11efff,_0x1aedcf[_0x1d1f('0x45')]);return _0x2350af[_0x1d1f('0x87')](_0x11efff);}})[_0x1d1f('0x29')](function(_0x5d33ad){if(_0x5d33ad){_0x4e2dd0=_0x5d33ad['length'];if(!_0x1aedcf[_0x1d1f('0x34')][_0x1d1f('0x3b')]('nolimit')){_0x11efff['limit']=qs[_0x1d1f('0x23')](_0x1aedcf['query']['limit']);_0x11efff[_0x1d1f('0x22')]=qs[_0x1d1f('0x22')](_0x1aedcf[_0x1d1f('0x34')][_0x1d1f('0x22')]);}return _0x2350af[_0x1d1f('0x87')](_0x11efff);}})[_0x1d1f('0x29')](function(_0x359a72){if(_0x359a72){return _0x359a72?{'count':_0x4e2dd0,'rows':_0x359a72}:null;}})['then'](respondWithResult(_0x360b8c,null))['catch'](handleError(_0x360b8c,null));}; \ No newline at end of file +var _0x5d53=['register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','FaxQueues','UserProfileResource','sendStatus','stack','name','send','index','FaxQueue','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','UserFaxQueue','nolimit','sort','FaxQueueId','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','rawAttributes','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxQueue.socket'];(function(_0x11b3b6,_0xe05f10){var _0x5b6c8b=function(_0x530c93){while(--_0x530c93){_0x11b3b6['push'](_0x11b3b6['shift']());}};_0x5b6c8b(++_0xe05f10);}(_0x5d53,0x104));var _0x35d5=function(_0x46e1b0,_0x145a6d){_0x46e1b0=_0x46e1b0-0x0;var _0x31520a=_0x5d53[_0x46e1b0];return _0x31520a;};'use strict';var emlformat=require(_0x35d5('0x0'));var rimraf=require(_0x35d5('0x1'));var zipdir=require(_0x35d5('0x2'));var jsonpatch=require(_0x35d5('0x3'));var rp=require(_0x35d5('0x4'));var moment=require('moment');var BPromise=require(_0x35d5('0x5'));var Mustache=require(_0x35d5('0x6'));var util=require(_0x35d5('0x7'));var path=require(_0x35d5('0x8'));var sox=require(_0x35d5('0x9'));var csv=require(_0x35d5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35d5('0xb'));var _=require(_0x35d5('0xc'));var squel=require('squel');var crypto=require(_0x35d5('0xd'));var jsforce=require(_0x35d5('0xe'));var deskjs=require(_0x35d5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x35d5('0x10'));var Papa=require(_0x35d5('0x11'));var Redis=require(_0x35d5('0x12'));var authService=require(_0x35d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x35d5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35d5('0x15'))(_0x35d5('0x16'));var utils=require('../../config/utils');var config=require(_0x35d5('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x35d5('0x18')]=_[_0x35d5('0x19')](config[_0x35d5('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x35d5('0x1a'))(new Redis(config['redis']));require(_0x35d5('0x1b'))[_0x35d5('0x1c')](socket);function respondWithStatusCode(_0x10760b,_0x17245a){_0x17245a=_0x17245a||0xcc;return function(_0x384d6d){if(_0x384d6d){return _0x10760b['sendStatus'](_0x17245a);}return _0x10760b[_0x35d5('0x1d')](_0x17245a)[_0x35d5('0x1e')]();};}function respondWithResult(_0x2fb6f5,_0x9420fe){_0x9420fe=_0x9420fe||0xc8;return function(_0x46e8ba){if(_0x46e8ba){return _0x2fb6f5[_0x35d5('0x1d')](_0x9420fe)[_0x35d5('0x1f')](_0x46e8ba);}};}function respondWithFilteredResult(_0x1729b7,_0x497490){return function(_0x546a82){if(_0x546a82){var _0x417959=typeof _0x497490['offset']===_0x35d5('0x20')&&typeof _0x497490[_0x35d5('0x21')]===_0x35d5('0x20');var _0x43b237=_0x546a82[_0x35d5('0x22')];var _0x552c30=_0x417959?0x0:_0x497490[_0x35d5('0x23')];var _0x14f69d=_0x417959?_0x546a82['count']:_0x497490['offset']+_0x497490[_0x35d5('0x21')];var _0x2a194b;if(_0x14f69d>=_0x43b237){_0x14f69d=_0x43b237;_0x2a194b=0xc8;}else{_0x2a194b=0xce;}_0x1729b7[_0x35d5('0x1d')](_0x2a194b);return _0x1729b7[_0x35d5('0x24')](_0x35d5('0x25'),_0x552c30+'-'+_0x14f69d+'/'+_0x43b237)[_0x35d5('0x1f')](_0x546a82);}return null;};}function patchUpdates(_0x4a792a){return function(_0x569398){try{jsonpatch[_0x35d5('0x26')](_0x569398,_0x4a792a,!![]);}catch(_0x4ab73f){return BPromise['reject'](_0x4ab73f);}return _0x569398[_0x35d5('0x27')]();};}function saveUpdates(_0x5d427f,_0x52f216){return function(_0x51c7e4){if(_0x51c7e4){return _0x51c7e4['update'](_0x5d427f)['then'](function(_0x569981){return _0x569981;});}return null;};}function removeEntity(_0x288f2a,_0x59f3ce){return function(_0x4c93f5){if(_0x4c93f5){return _0x4c93f5['destroy']()[_0x35d5('0x28')](function(){var _0xbd8a7a=_0x4c93f5['get']({'plain':!![]});var _0x45258d=_0x35d5('0x29');return db[_0x35d5('0x2a')]['destroy']({'where':{'type':_0x45258d,'resourceId':_0xbd8a7a['id']}})[_0x35d5('0x28')](function(){return _0x4c93f5;});})[_0x35d5('0x28')](function(){_0x288f2a['status'](0xcc)[_0x35d5('0x1e')]();});}};}function handleEntityNotFound(_0x4dca23,_0x1f314f){return function(_0x540a39){if(!_0x540a39){_0x4dca23[_0x35d5('0x2b')](0x194);}return _0x540a39;};}function handleError(_0x48022e,_0x12d8c3){_0x12d8c3=_0x12d8c3||0x1f4;return function(_0x46e1){logger['error'](_0x46e1[_0x35d5('0x2c')]);if(_0x46e1[_0x35d5('0x2d')]){delete _0x46e1['name'];}_0x48022e[_0x35d5('0x1d')](_0x12d8c3)[_0x35d5('0x2e')](_0x46e1);};}exports[_0x35d5('0x2f')]=function(_0x2a102e,_0x148ea8){var _0x4b6542={},_0x1bcbc6={},_0x4c5dcc={'count':0x0,'rows':[]};var _0x2f4052=_['map'](db[_0x35d5('0x30')]['rawAttributes'],function(_0x2b7639){return{'name':_0x2b7639['fieldName'],'type':_0x2b7639[_0x35d5('0x31')][_0x35d5('0x32')]};});_0x1bcbc6['model']=_[_0x35d5('0x33')](_0x2f4052,'name');_0x1bcbc6[_0x35d5('0x34')]=_[_0x35d5('0x35')](_0x2a102e[_0x35d5('0x34')]);_0x1bcbc6[_0x35d5('0x36')]=_[_0x35d5('0x37')](_0x1bcbc6[_0x35d5('0x38')],_0x1bcbc6['query']);_0x4b6542[_0x35d5('0x39')]=_[_0x35d5('0x37')](_0x1bcbc6[_0x35d5('0x38')],qs['fields'](_0x2a102e['query'][_0x35d5('0x3a')]));_0x4b6542[_0x35d5('0x39')]=_0x4b6542[_0x35d5('0x39')][_0x35d5('0x3b')]?_0x4b6542[_0x35d5('0x39')]:_0x1bcbc6[_0x35d5('0x38')];if(!_0x2a102e[_0x35d5('0x34')][_0x35d5('0x3c')]('nolimit')){_0x4b6542[_0x35d5('0x21')]=qs['limit'](_0x2a102e[_0x35d5('0x34')][_0x35d5('0x21')]);_0x4b6542[_0x35d5('0x23')]=qs[_0x35d5('0x23')](_0x2a102e[_0x35d5('0x34')][_0x35d5('0x23')]);}_0x4b6542[_0x35d5('0x3d')]=qs['sort'](_0x2a102e[_0x35d5('0x34')]['sort']);_0x4b6542['where']=qs['filters'](_[_0x35d5('0x3e')](_0x2a102e['query'],_0x1bcbc6['filters']),_0x2f4052);if(_0x2a102e[_0x35d5('0x34')][_0x35d5('0x3f')]){_0x4b6542[_0x35d5('0x40')]=_[_0x35d5('0x41')](_0x4b6542[_0x35d5('0x40')],{'$or':_[_0x35d5('0x33')](_0x2f4052,function(_0x339b08){if(_0x339b08[_0x35d5('0x31')]!==_0x35d5('0x42')){var _0x12cf02={};_0x12cf02[_0x339b08['name']]={'$like':'%'+_0x2a102e['query']['filter']+'%'};return _0x12cf02;}})});}_0x4b6542=_['merge']({},_0x4b6542,_0x2a102e[_0x35d5('0x43')]);var _0x5e3bde={'where':_0x4b6542[_0x35d5('0x40')]};return db['FaxQueue']['count'](_0x5e3bde)[_0x35d5('0x28')](function(_0x117b9f){_0x4c5dcc['count']=_0x117b9f;if(_0x2a102e[_0x35d5('0x34')][_0x35d5('0x44')]){_0x4b6542[_0x35d5('0x45')]=[{'all':!![]}];}return db[_0x35d5('0x30')][_0x35d5('0x46')](_0x4b6542);})[_0x35d5('0x28')](function(_0x2a6e5d){_0x4c5dcc[_0x35d5('0x47')]=_0x2a6e5d;return _0x4c5dcc;})[_0x35d5('0x28')](respondWithFilteredResult(_0x148ea8,_0x4b6542))[_0x35d5('0x48')](handleError(_0x148ea8,null));};exports[_0x35d5('0x49')]=function(_0x5b77e3,_0x3ebd7c){var _0x3f3534={'raw':!![],'where':{'id':_0x5b77e3['params']['id']}},_0x4c64a2={};_0x4c64a2['model']=_[_0x35d5('0x35')](db[_0x35d5('0x30')]['rawAttributes']);_0x4c64a2[_0x35d5('0x34')]=_[_0x35d5('0x35')](_0x5b77e3['query']);_0x4c64a2[_0x35d5('0x36')]=_['intersection'](_0x4c64a2['model'],_0x4c64a2['query']);_0x3f3534[_0x35d5('0x39')]=_[_0x35d5('0x37')](_0x4c64a2[_0x35d5('0x38')],qs['fields'](_0x5b77e3[_0x35d5('0x34')][_0x35d5('0x3a')]));_0x3f3534[_0x35d5('0x39')]=_0x3f3534[_0x35d5('0x39')][_0x35d5('0x3b')]?_0x3f3534[_0x35d5('0x39')]:_0x4c64a2['model'];if(_0x5b77e3['query'][_0x35d5('0x44')]){_0x3f3534[_0x35d5('0x45')]=[{'all':!![]}];}_0x3f3534=_[_0x35d5('0x41')]({},_0x3f3534,_0x5b77e3['options']);return db['FaxQueue'][_0x35d5('0x4a')](_0x3f3534)[_0x35d5('0x28')](handleEntityNotFound(_0x3ebd7c,null))[_0x35d5('0x28')](respondWithResult(_0x3ebd7c,null))[_0x35d5('0x48')](handleError(_0x3ebd7c,null));};exports[_0x35d5('0x4b')]=function(_0x2071d3,_0x59f434){return db['FaxQueue'][_0x35d5('0x4b')](_0x2071d3['body'],{})[_0x35d5('0x28')](function(_0x51cec0){var _0x1af30d=_0x2071d3[_0x35d5('0x4c')][_0x35d5('0x4d')]({'plain':!![]});if(!_0x1af30d)throw new Error(_0x35d5('0x4e'));if(_0x1af30d[_0x35d5('0x4f')]===_0x35d5('0x4c')){var _0x14899=_0x51cec0[_0x35d5('0x4d')]({'plain':!![]});var _0x28e85a='FaxQueues';return db[_0x35d5('0x50')][_0x35d5('0x4a')]({'where':{'name':_0x28e85a,'userProfileId':_0x1af30d[_0x35d5('0x51')]},'raw':!![]})[_0x35d5('0x28')](function(_0x19bcf3){if(_0x19bcf3&&_0x19bcf3[_0x35d5('0x52')]===0x0){return db[_0x35d5('0x2a')][_0x35d5('0x4b')]({'name':_0x14899[_0x35d5('0x2d')],'resourceId':_0x14899['id'],'type':_0x19bcf3['name'],'sectionId':_0x19bcf3['id']},{})['then'](function(){return _0x51cec0;});}else{return _0x51cec0;}})['catch'](function(_0x19dc1f){logger[_0x35d5('0x53')](_0x35d5('0x54'),_0x19dc1f);throw _0x19dc1f;});}return _0x51cec0;})[_0x35d5('0x28')](respondWithResult(_0x59f434,0xc9))[_0x35d5('0x48')](handleError(_0x59f434,null));};exports[_0x35d5('0x55')]=function(_0x342e2b,_0x4a861f){if(_0x342e2b[_0x35d5('0x56')]['id']){delete _0x342e2b[_0x35d5('0x56')]['id'];}return db[_0x35d5('0x30')][_0x35d5('0x4a')]({'where':{'id':_0x342e2b[_0x35d5('0x57')]['id']}})[_0x35d5('0x28')](handleEntityNotFound(_0x4a861f,null))[_0x35d5('0x28')](saveUpdates(_0x342e2b[_0x35d5('0x56')],null))[_0x35d5('0x28')](respondWithResult(_0x4a861f,null))[_0x35d5('0x48')](handleError(_0x4a861f,null));};exports['destroy']=function(_0x136cd4,_0x3a4b39){return db['FaxQueue'][_0x35d5('0x4a')]({'where':{'id':_0x136cd4[_0x35d5('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a4b39,null))['then'](removeEntity(_0x3a4b39,null))[_0x35d5('0x48')](handleError(_0x3a4b39,null));};exports[_0x35d5('0x58')]=function(_0x52f99c,_0x16ee98){return db[_0x35d5('0x30')][_0x35d5('0x58')]()['then'](respondWithResult(_0x16ee98,null))['catch'](handleError(_0x16ee98,null));};exports[_0x35d5('0x59')]=function(_0x571f8d,_0x4e8fb0,_0x3bfdca){var _0x43a61a={'raw':!![],'where':{}},_0x56d7be={},_0x3e2843;return db[_0x35d5('0x30')]['findOne']({'where':{'id':_0x571f8d[_0x35d5('0x57')]['id']}})['then'](handleEntityNotFound(_0x4e8fb0,null))[_0x35d5('0x28')](function(_0x232caf){if(_0x232caf){_0x3e2843=_0x232caf[_0x35d5('0x4d')]({'plain':!![]});_0x56d7be['model']=_[_0x35d5('0x35')](db[_0x35d5('0x5a')]['rawAttributes']);_0x56d7be[_0x35d5('0x34')]=_[_0x35d5('0x35')](_0x571f8d[_0x35d5('0x34')]);_0x56d7be[_0x35d5('0x36')]=_[_0x35d5('0x37')](_0x56d7be[_0x35d5('0x38')],_0x56d7be[_0x35d5('0x34')]);_0x43a61a[_0x35d5('0x39')]=_[_0x35d5('0x37')](_0x56d7be['model'],qs[_0x35d5('0x3a')](_0x571f8d[_0x35d5('0x34')][_0x35d5('0x3a')]));_0x43a61a['attributes']=_0x43a61a[_0x35d5('0x39')][_0x35d5('0x3b')]?_0x43a61a[_0x35d5('0x39')]:_0x56d7be['model'];if(!_0x571f8d[_0x35d5('0x34')][_0x35d5('0x3c')](_0x35d5('0x5b'))){_0x43a61a[_0x35d5('0x21')]=qs[_0x35d5('0x21')](_0x571f8d[_0x35d5('0x34')]['limit']);_0x43a61a[_0x35d5('0x23')]=qs['offset'](_0x571f8d[_0x35d5('0x34')]['offset']);}_0x43a61a[_0x35d5('0x3d')]=qs[_0x35d5('0x5c')](_0x571f8d[_0x35d5('0x34')]['sort']);_0x43a61a[_0x35d5('0x40')]=qs[_0x35d5('0x36')](_['pick'](_0x571f8d[_0x35d5('0x34')],_0x56d7be[_0x35d5('0x36')]));_0x43a61a[_0x35d5('0x40')][_0x35d5('0x5d')]=_0x232caf['id'];if(_0x571f8d[_0x35d5('0x34')][_0x35d5('0x3f')]){_0x43a61a[_0x35d5('0x40')]=_[_0x35d5('0x41')](_0x43a61a[_0x35d5('0x40')],{'$or':_[_0x35d5('0x33')](_0x43a61a['attributes'],function(_0x5f34a7){var _0x3d6e13={};_0x3d6e13[_0x5f34a7]={'$like':'%'+_0x571f8d[_0x35d5('0x34')][_0x35d5('0x3f')]+'%'};return _0x3d6e13;})});}_0x43a61a=_[_0x35d5('0x41')]({},_0x43a61a,_0x571f8d['options']);return db['UserFaxQueue'][_0x35d5('0x46')](_0x43a61a);}})[_0x35d5('0x28')](function(_0x15f67c){if(_0x15f67c){return db['User'][_0x35d5('0x5e')]({'where':{'id':_[_0x35d5('0x33')](_0x15f67c,_0x35d5('0x5f')),'role':_0x35d5('0x60')},'attributes':['id',_0x35d5('0x2d'),'faxPause','updatedAt',_0x35d5('0x61')]});}})[_0x35d5('0x28')](function(_0x189e2e){if(_0x189e2e){return{'count':_0x189e2e[_0x35d5('0x22')],'rows':_[_0x35d5('0x33')](_0x189e2e[_0x35d5('0x47')],function(_0x44987a){return{'membername':_0x44987a[_0x35d5('0x2d')],'UserId':_0x44987a['id'],'queue_name':_0x3e2843[_0x35d5('0x2d')],'FaxQueueId':_0x3e2843['id'],'interface':util[_0x35d5('0x62')](_0x35d5('0x63'),_0x35d5('0x64'),_0x44987a[_0x35d5('0x2d')]),'penalty':0x0,'paused':_0x44987a['faxPause'],'createdAt':_0x44987a[_0x35d5('0x61')],'updatedAt':_0x44987a[_0x35d5('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x35d5('0x28')](respondWithFilteredResult(_0x4e8fb0,_0x43a61a))[_0x35d5('0x48')](handleError(_0x4e8fb0,null));};exports[_0x35d5('0x66')]=function(_0x13af6e,_0x5a1960,_0x342623){var _0x19425c={};var _0x3e5db4={};var _0x3eadc5;var _0xc6b7f9;return db[_0x35d5('0x30')][_0x35d5('0x67')]({'where':{'id':_0x13af6e[_0x35d5('0x57')]['id']}})[_0x35d5('0x28')](handleEntityNotFound(_0x5a1960,null))[_0x35d5('0x28')](function(_0x1ea7c5){if(_0x1ea7c5){_0x3eadc5=_0x1ea7c5;_0x3e5db4[_0x35d5('0x38')]=_[_0x35d5('0x35')](db[_0x35d5('0x68')][_0x35d5('0x69')]);_0x3e5db4[_0x35d5('0x34')]=_[_0x35d5('0x35')](_0x13af6e['query']);_0x3e5db4[_0x35d5('0x36')]=_[_0x35d5('0x37')](_0x3e5db4['model'],_0x3e5db4[_0x35d5('0x34')]);_0x19425c[_0x35d5('0x39')]=_[_0x35d5('0x37')](_0x3e5db4['model'],qs[_0x35d5('0x3a')](_0x13af6e[_0x35d5('0x34')][_0x35d5('0x3a')]));_0x19425c['attributes']=_0x19425c[_0x35d5('0x39')]['length']?_0x19425c[_0x35d5('0x39')]:_0x3e5db4[_0x35d5('0x38')];_0x19425c[_0x35d5('0x3d')]=qs[_0x35d5('0x5c')](_0x13af6e[_0x35d5('0x34')][_0x35d5('0x5c')]);_0x19425c[_0x35d5('0x40')]=qs[_0x35d5('0x36')](_[_0x35d5('0x3e')](_0x13af6e[_0x35d5('0x34')],_0x3e5db4[_0x35d5('0x36')]));if(_0x13af6e[_0x35d5('0x34')][_0x35d5('0x3f')]){_0x19425c[_0x35d5('0x40')]=_['merge'](_0x19425c[_0x35d5('0x40')],{'$or':_[_0x35d5('0x33')](_0x19425c['attributes'],function(_0x1d4303){var _0x4afdd0={};_0x4afdd0[_0x1d4303]={'$like':'%'+_0x13af6e['query']['filter']+'%'};return _0x4afdd0;})});}_0x19425c=_['merge']({},_0x19425c,_0x13af6e['options']);return _0x3eadc5[_0x35d5('0x66')](_0x19425c);}})[_0x35d5('0x28')](function(_0x52e4da){if(_0x52e4da){_0xc6b7f9=_0x52e4da[_0x35d5('0x3b')];if(!_0x13af6e[_0x35d5('0x34')][_0x35d5('0x3c')](_0x35d5('0x5b'))){_0x19425c[_0x35d5('0x21')]=qs[_0x35d5('0x21')](_0x13af6e[_0x35d5('0x34')][_0x35d5('0x21')]);_0x19425c[_0x35d5('0x23')]=qs['offset'](_0x13af6e[_0x35d5('0x34')][_0x35d5('0x23')]);}return _0x3eadc5[_0x35d5('0x66')](_0x19425c);}})[_0x35d5('0x28')](function(_0x4bbb25){if(_0x4bbb25){return _0x4bbb25?{'count':_0xc6b7f9,'rows':_0x4bbb25}:null;}})[_0x35d5('0x28')](respondWithResult(_0x5a1960,null))[_0x35d5('0x48')](handleError(_0x5a1960,null));};exports[_0x35d5('0x6a')]=function(_0x441e7d,_0x1de439,_0x2b273f){var _0x5aaf87=_0x441e7d['body'][_0x35d5('0x6b')];return db['Team'][_0x35d5('0x46')]({'where':{'id':_0x5aaf87},'attributes':['id'],'include':[{'model':db[_0x35d5('0x6c')],'as':'Agents','attributes':['id',_0x35d5('0x2d'),_0x35d5('0x6d'),_0x35d5('0x6e'),_0x35d5('0x6f')],'raw':!![]}]})[_0x35d5('0x28')](function(_0x2084ed){if(_0x2084ed){var _0x48b11a=_[_0x35d5('0x70')](_0x2084ed,function(_0x2331d2){var _0x161482=_0x2331d2[_0x35d5('0x4d')]({'plain':!![]});return _0x161482[_0x35d5('0x71')];});return db['FaxQueue'][_0x35d5('0x4a')]({'where':{'id':_0x441e7d[_0x35d5('0x57')]['id']}})[_0x35d5('0x28')](function(_0x16caa9){return db[_0x35d5('0x72')][_0x35d5('0x73')](function(_0x5e4d4f){return _0x16caa9[_0x35d5('0x6a')](_0x5aaf87,{'transaction':_0x5e4d4f})[_0x35d5('0x28')](function(){return BPromise[_0x35d5('0x74')](_0x48b11a,function(_0x528e45){return db[_0x35d5('0x5a')][_0x35d5('0x75')]({'where':{'UserId':_0x528e45['id'],'FaxQueueId':_0x441e7d['params']['id']},'transaction':_0x5e4d4f});});})[_0x35d5('0x28')](function(){_0x48b11a['forEach'](function(_0x15486a){socket[_0x35d5('0x76')](_0x35d5('0x77'),{'UserId':_0x15486a['id'],'FaxQueueId':_0x16caa9['id']});});});});});}})['then'](respondWithStatusCode(_0x1de439,null))['catch'](handleError(_0x1de439,null));};exports[_0x35d5('0x78')]=function(_0x2103f6,_0x534020,_0x3b88cd){return db['Team'][_0x35d5('0x46')]({'where':{'id':_0x2103f6[_0x35d5('0x34')][_0x35d5('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35d5('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x534020,null))[_0x35d5('0x28')](function(_0xbcab10){var _0x1dd573=_[_0x35d5('0x33')](_0xbcab10,'id');var _0x1f99d6=[];var _0x3ff2bf=[];var _0xcb9caa=squel[_0x35d5('0x79')]();_0xcb9caa[_0x35d5('0x7a')](_0x35d5('0x7b'))['from'](_0x35d5('0x7c'),'tq')[_0x35d5('0x7d')](_0x35d5('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x35d5('0x40')]('FaxQueueId\x20=\x20?',_0x2103f6[_0x35d5('0x57')]['id']);for(var _0x55bb68=0x0;_0x55bb68<_0xbcab10[_0x35d5('0x3b')];_0x55bb68+=0x1){let _0x478b3d=_0xbcab10[_0x55bb68];for(var _0x550e41=0x0;_0x550e41<_0x478b3d[_0x35d5('0x71')]['length'];_0x550e41+=0x1){let _0xaf6125=_0x478b3d[_0x35d5('0x71')][_0x550e41];var _0x3af0a2=_0xcb9caa[_0x35d5('0x7f')]();_0x3af0a2[_0x35d5('0x40')](_0x35d5('0x80'),_0xaf6125['id']);_0x3ff2bf['push'](db[_0x35d5('0x72')][_0x35d5('0x34')](_0x3af0a2[_0x35d5('0x81')](),{'type':db[_0x35d5('0x72')]['QueryTypes'][_0x35d5('0x82')]})[_0x35d5('0x28')](function(_0x57b9a8){if(_0x57b9a8[_0x35d5('0x3b')]===0x1){return _0xaf6125['id'];}else{var _0xa026de=_[_0x35d5('0x83')](_[_0x35d5('0x33')](_0x57b9a8,_0x35d5('0x84')),function(_0x1730dd){return _['includes'](_0x1dd573,_0x1730dd);});if(_0xa026de){return _0xaf6125['id'];}}}));}}return BPromise[_0x35d5('0x85')](_0x3ff2bf)[_0x35d5('0x28')](function(_0x23a88b){_0x1f99d6=_(_0x1f99d6)[_0x35d5('0x86')](_0x23a88b)[_0x35d5('0x87')]()[_0x35d5('0x88')]();return db[_0x35d5('0x30')][_0x35d5('0x4a')]({'where':{'id':_0x2103f6[_0x35d5('0x57')]['id']}})['then'](function(_0x5b8fc5){return db['sequelize']['transaction'](function(_0x350c4a){return _0x5b8fc5[_0x35d5('0x78')](_0x2103f6[_0x35d5('0x34')][_0x35d5('0x6b')],{'transaction':_0x350c4a})[_0x35d5('0x28')](function(){if(!_[_0x35d5('0x89')](_0x1f99d6)){return _0x5b8fc5[_0x35d5('0x8a')](_0x1f99d6,{'transaction':_0x350c4a});}})['then'](function(){_0x1f99d6[_0x35d5('0x8b')](function(_0x2192e4){socket[_0x35d5('0x76')](_0x35d5('0x8c'),{'UserId':_0x2192e4,'FaxQueueId':_0x5b8fc5['id']});});});});});});})['then'](respondWithStatusCode(_0x534020,null))[_0x35d5('0x48')](handleError(_0x534020,null));};exports['addAgents']=function(_0x2d22f5,_0x46e4a1,_0x36f5a6){return db[_0x35d5('0x30')][_0x35d5('0x4a')]({'where':{'id':_0x2d22f5[_0x35d5('0x57')]['id']}})[_0x35d5('0x28')](handleEntityNotFound(_0x46e4a1,null))[_0x35d5('0x28')](function(_0x16a2ef){if(_0x16a2ef){return _0x16a2ef['addAgents'](_0x2d22f5[_0x35d5('0x56')]['ids'],_[_0x35d5('0x8d')](_0x2d22f5['body'],[_0x35d5('0x6b'),'id'])||{})['spread'](function(_0x16d118){for(var _0x1b8e58=0x0;_0x1b8e58<_0x2d22f5[_0x35d5('0x56')][_0x35d5('0x6b')][_0x35d5('0x3b')];_0x1b8e58+=0x1){socket[_0x35d5('0x76')]('userFaxQueue:save',{'UserId':Number(_0x2d22f5[_0x35d5('0x56')]['ids'][_0x1b8e58]),'FaxQueueId':Number(_0x2d22f5[_0x35d5('0x57')]['id'])});}return _0x16d118;});}})[_0x35d5('0x28')](respondWithResult(_0x46e4a1,null))[_0x35d5('0x48')](handleError(_0x46e4a1,null));};exports['removeAgents']=function(_0x1505b4,_0x16ee78,_0x51a45b){return db['FaxQueue'][_0x35d5('0x4a')]({'where':{'id':_0x1505b4['params']['id']}})[_0x35d5('0x28')](handleEntityNotFound(_0x16ee78,null))[_0x35d5('0x28')](function(_0x5f2a02){if(_0x5f2a02){return _0x5f2a02['removeAgents'](_0x1505b4[_0x35d5('0x34')][_0x35d5('0x6b')])['then'](function(){if(_[_0x35d5('0x8e')](_0x1505b4[_0x35d5('0x34')]['ids'])){for(var _0x57eefd=0x0;_0x57eefd<_0x1505b4[_0x35d5('0x34')][_0x35d5('0x6b')][_0x35d5('0x3b')];_0x57eefd+=0x1){socket[_0x35d5('0x76')]('userFaxQueue:remove',{'UserId':Number(_0x1505b4[_0x35d5('0x34')]['ids'][_0x57eefd]),'FaxQueueId':Number(_0x1505b4[_0x35d5('0x57')]['id'])});}}else{socket[_0x35d5('0x76')]('userFaxQueue:remove',{'UserId':Number(_0x1505b4[_0x35d5('0x34')][_0x35d5('0x6b')]),'FaxQueueId':Number(_0x1505b4[_0x35d5('0x57')]['id'])});}});}})[_0x35d5('0x28')](respondWithStatusCode(_0x16ee78,null))[_0x35d5('0x48')](handleError(_0x16ee78,null));};exports[_0x35d5('0x8f')]=function(_0x1fece3,_0x53aef3,_0x162b24){var _0x12ec98={};var _0x461ae3={};var _0x39a50a;var _0x4f7ad9;return db['FaxQueue'][_0x35d5('0x67')]({'where':{'id':_0x1fece3[_0x35d5('0x57')]['id']}})['then'](handleEntityNotFound(_0x53aef3,null))[_0x35d5('0x28')](function(_0x838079){if(_0x838079){_0x39a50a=_0x838079;_0x461ae3[_0x35d5('0x38')]=_[_0x35d5('0x35')](db[_0x35d5('0x6c')][_0x35d5('0x69')]);_0x461ae3[_0x35d5('0x34')]=_[_0x35d5('0x35')](_0x1fece3[_0x35d5('0x34')]);_0x461ae3[_0x35d5('0x36')]=_['intersection'](_0x461ae3[_0x35d5('0x38')],_0x461ae3[_0x35d5('0x34')]);_0x12ec98[_0x35d5('0x39')]=_['intersection'](_0x461ae3['model'],qs[_0x35d5('0x3a')](_0x1fece3[_0x35d5('0x34')][_0x35d5('0x3a')]));_0x12ec98['attributes']=_0x12ec98[_0x35d5('0x39')][_0x35d5('0x3b')]?_0x12ec98[_0x35d5('0x39')]:_0x461ae3[_0x35d5('0x38')];_0x12ec98[_0x35d5('0x3d')]=qs['sort'](_0x1fece3[_0x35d5('0x34')][_0x35d5('0x5c')]);_0x12ec98['where']=qs[_0x35d5('0x36')](_['pick'](_0x1fece3[_0x35d5('0x34')],_0x461ae3[_0x35d5('0x36')]));if(_0x1fece3[_0x35d5('0x34')][_0x35d5('0x3f')]){_0x12ec98['where']=_[_0x35d5('0x41')](_0x12ec98['where'],{'$or':_[_0x35d5('0x33')](_0x12ec98[_0x35d5('0x39')],function(_0x5c5640){var _0x393d81={};_0x393d81[_0x5c5640]={'$like':'%'+_0x1fece3[_0x35d5('0x34')][_0x35d5('0x3f')]+'%'};return _0x393d81;})});}_0x12ec98=_[_0x35d5('0x41')]({},_0x12ec98,_0x1fece3[_0x35d5('0x43')]);return _0x39a50a[_0x35d5('0x8f')](_0x12ec98);}})[_0x35d5('0x28')](function(_0x45c950){if(_0x45c950){_0x4f7ad9=_0x45c950[_0x35d5('0x3b')];if(!_0x1fece3[_0x35d5('0x34')][_0x35d5('0x3c')](_0x35d5('0x5b'))){_0x12ec98['limit']=qs[_0x35d5('0x21')](_0x1fece3['query']['limit']);_0x12ec98[_0x35d5('0x23')]=qs[_0x35d5('0x23')](_0x1fece3[_0x35d5('0x34')]['offset']);}return _0x39a50a[_0x35d5('0x8f')](_0x12ec98);}})[_0x35d5('0x28')](function(_0x2ba459){if(_0x2ba459){return _0x2ba459?{'count':_0x4f7ad9,'rows':_0x2ba459}:null;}})[_0x35d5('0x28')](respondWithResult(_0x53aef3,null))[_0x35d5('0x48')](handleError(_0x53aef3,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6d76ff5..1eac76e 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 _0x5bce=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue'];(function(_0x1edbab,_0x47d640){var _0x2ba204=function(_0x15dd0d){while(--_0x15dd0d){_0x1edbab['push'](_0x1edbab['shift']());}};_0x2ba204(++_0x47d640);}(_0x5bce,0x192));var _0xe5bc=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x5bce[_0x5eef05];return _0x56d4b8;};'use strict';var EventEmitter=require(_0xe5bc('0x0'));var FaxQueue=require(_0xe5bc('0x1'))['db'][_0xe5bc('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe5bc('0x3')](0x0);var events={'afterCreate':_0xe5bc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xaca434){return function(_0x4643a4,_0x25b7b0,_0x26a4f2){FaxQueueEvents[_0xe5bc('0x5')](_0xaca434+':'+_0x4643a4['id'],_0x4643a4);FaxQueueEvents[_0xe5bc('0x5')](_0xaca434,_0x4643a4);_0x26a4f2(null);};}for(var e in events){if(events[_0xe5bc('0x6')](e)){var event=events[e];FaxQueue[_0xe5bc('0x7')](e,emitEvent(event));}}module[_0xe5bc('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xe284=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0xe284,0x1cf));var _0x4e28=function(_0x15f455,_0x1ec373){_0x15f455=_0x15f455-0x0;var _0x45f542=_0xe284[_0x15f455];return _0x45f542;};'use strict';var EventEmitter=require(_0x4e28('0x0'));var FaxQueue=require(_0x4e28('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e28('0x2'),'afterDestroy':_0x4e28('0x3')};function emitEvent(_0x2c8926){return function(_0x4959ed,_0x2a737b,_0xc1df76){FaxQueueEvents[_0x4e28('0x4')](_0x2c8926+':'+_0x4959ed['id'],_0x4959ed);FaxQueueEvents[_0x4e28('0x4')](_0x2c8926,_0x4959ed);_0xc1df76(null);};}for(var e in events){if(events[_0x4e28('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x4e28('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0aef76d..fa3557b 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 _0x7c43=['request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x553e14,_0x683bd6){var _0x45cba8=function(_0x3c8ca2){while(--_0x3c8ca2){_0x553e14['push'](_0x553e14['shift']());}};_0x45cba8(++_0x683bd6);}(_0x7c43,0x1cf));var _0x37c4=function(_0x178417,_0x4b6554){_0x178417=_0x178417-0x0;var _0x1aa024=_0x7c43[_0x178417];return _0x1aa024;};'use strict';var _=require(_0x37c4('0x0'));var util=require(_0x37c4('0x1'));var logger=require(_0x37c4('0x2'))(_0x37c4('0x3'));var moment=require(_0x37c4('0x4'));var BPromise=require('bluebird');var rp=require(_0x37c4('0x5'));var fs=require('fs');var path=require(_0x37c4('0x6'));var rimraf=require('rimraf');var config=require(_0x37c4('0x7'));var attributes=require(_0x37c4('0x8'));module[_0x37c4('0x9')]=function(_0x52eb24,_0x182f25){return _0x52eb24[_0x37c4('0xa')]('FaxQueue',attributes,{'tableName':_0x37c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb673=['./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x473fa3,_0x2bb78c){var _0x397410=function(_0x3a25b1){while(--_0x3a25b1){_0x473fa3['push'](_0x473fa3['shift']());}};_0x397410(++_0x2bb78c);}(_0xb673,0x1d0));var _0x3b67=function(_0x1c9ac9,_0x137ab5){_0x1c9ac9=_0x1c9ac9-0x0;var _0x54ab9b=_0xb673[_0x1c9ac9];return _0x54ab9b;};'use strict';var _=require(_0x3b67('0x0'));var util=require(_0x3b67('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3b67('0x2'));var rp=require(_0x3b67('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b67('0x4'));var config=require(_0x3b67('0x5'));var attributes=require(_0x3b67('0x6'));module['exports']=function(_0xdf3ce2,_0x585619){return _0xdf3ce2[_0x3b67('0x7')](_0x3b67('0x8'),attributes,{'tableName':_0x3b67('0x9'),'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 c68ae54..746746c 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 _0x3be1=['findAll','options','raw','where','map','include','model','attributes','debug','catch','ShowFaxQueue','FaxQueue','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetFaxQueue'];(function(_0x5d01c0,_0x4b422b){var _0x21b818=function(_0x3a0400){while(--_0x3a0400){_0x5d01c0['push'](_0x5d01c0['shift']());}};_0x21b818(++_0x4b422b);}(_0x3be1,0x103));var _0x13be=function(_0x55958a,_0x167a91){_0x55958a=_0x55958a-0x0;var _0x50e19f=_0x3be1[_0x55958a];return _0x50e19f;};'use strict';var _=require('lodash');var util=require(_0x13be('0x0'));var moment=require(_0x13be('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13be('0x2'));var db=require(_0x13be('0x3'))['db'];var utils=require(_0x13be('0x4'));var logger=require(_0x13be('0x5'))(_0x13be('0x6'));var config=require(_0x13be('0x7'));var jayson=require(_0x13be('0x8'));var client=jayson[_0x13be('0x9')][_0x13be('0xa')]({'port':0x232a});config[_0x13be('0xb')]=_[_0x13be('0xc')](config[_0x13be('0xb')],{'host':_0x13be('0xd'),'port':0x18eb});var socket=require(_0x13be('0xe'))(new Redis(config[_0x13be('0xb')]));require(_0x13be('0xf'))[_0x13be('0x10')](socket);function respondWithRpcPromise(_0x5db3b8,_0x47dc96,_0x383642){return new BPromise(function(_0x485141,_0x3fdb3e){return client[_0x13be('0x11')](_0x5db3b8,_0x383642)[_0x13be('0x12')](function(_0x213cc7){logger['info'](_0x13be('0x13'),_0x47dc96,_0x13be('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x47dc96,_0x13be('0x14'),JSON[_0x13be('0x15')](_0x213cc7));if(_0x213cc7['error']){if(_0x213cc7[_0x13be('0x16')][_0x13be('0x17')]===0x1f4){logger[_0x13be('0x16')](_0x13be('0x13'),_0x47dc96,_0x213cc7['error'][_0x13be('0x18')]);return _0x3fdb3e(_0x213cc7[_0x13be('0x16')][_0x13be('0x18')]);}logger[_0x13be('0x16')](_0x13be('0x13'),_0x47dc96,_0x213cc7[_0x13be('0x16')][_0x13be('0x18')]);return _0x485141(_0x213cc7['error'][_0x13be('0x18')]);}else{logger[_0x13be('0x19')](_0x13be('0x13'),_0x47dc96,_0x13be('0x14'));_0x485141(_0x213cc7[_0x13be('0x1a')][_0x13be('0x18')]);}})['catch'](function(_0x3741a3){logger['error'](_0x13be('0x13'),_0x47dc96,_0x3741a3);_0x3fdb3e(_0x3741a3);});});}exports[_0x13be('0x1b')]=function(_0x50b94a){var _0x8dd8a3=this;return new Promise(function(_0x4832fd,_0x59a5df){return db['FaxQueue'][_0x13be('0x1c')]({'raw':_0x50b94a[_0x13be('0x1d')]?_0x50b94a['options'][_0x13be('0x1e')]===undefined?!![]:![]:!![],'where':_0x50b94a[_0x13be('0x1d')]?_0x50b94a[_0x13be('0x1d')][_0x13be('0x1f')]||null:null,'attributes':_0x50b94a[_0x13be('0x1d')]?_0x50b94a[_0x13be('0x1d')]['attributes']||null:null,'limit':_0x50b94a[_0x13be('0x1d')]?_0x50b94a[_0x13be('0x1d')]['limit']||null:null,'include':_0x50b94a['options']?_0x50b94a['options']['include']?_[_0x13be('0x20')](_0x50b94a[_0x13be('0x1d')][_0x13be('0x21')],function(_0x19e98c){return{'model':db[_0x19e98c[_0x13be('0x22')]],'as':_0x19e98c['as'],'attributes':_0x19e98c[_0x13be('0x23')],'include':_0x19e98c[_0x13be('0x21')]?_[_0x13be('0x20')](_0x19e98c[_0x13be('0x21')],function(_0x1b15f0){return{'model':db[_0x1b15f0[_0x13be('0x22')]],'as':_0x1b15f0['as'],'attributes':_0x1b15f0[_0x13be('0x23')],'include':_0x1b15f0[_0x13be('0x21')]?_[_0x13be('0x20')](_0x1b15f0[_0x13be('0x21')],function(_0x6d1613){return{'model':db[_0x6d1613['model']],'as':_0x6d1613['as'],'attributes':_0x6d1613[_0x13be('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19cdaa){logger[_0x13be('0x19')](_0x13be('0x1b'),_0x50b94a);logger[_0x13be('0x24')](_0x13be('0x1b'),_0x50b94a,JSON[_0x13be('0x15')](_0x19cdaa));_0x4832fd(_0x19cdaa);})[_0x13be('0x25')](function(_0x34647b){logger[_0x13be('0x16')]('GetFaxQueue',_0x34647b['message'],_0x50b94a);_0x59a5df(_0x8dd8a3[_0x13be('0x16')](0x1f4,_0x34647b[_0x13be('0x18')]));});});};exports[_0x13be('0x26')]=function(_0x31f26c){var _0x173019=this;return new Promise(function(_0x26c421,_0x11368d){return db[_0x13be('0x27')][_0x13be('0x28')]({'raw':_0x31f26c[_0x13be('0x1d')]?_0x31f26c[_0x13be('0x1d')][_0x13be('0x1e')]===undefined?!![]:![]:!![],'where':_0x31f26c[_0x13be('0x1d')]?_0x31f26c[_0x13be('0x1d')][_0x13be('0x1f')]||null:null,'attributes':_0x31f26c[_0x13be('0x1d')]?_0x31f26c['options']['attributes']||null:null,'include':_0x31f26c['options']?_0x31f26c[_0x13be('0x1d')][_0x13be('0x21')]?_[_0x13be('0x20')](_0x31f26c[_0x13be('0x1d')][_0x13be('0x21')],function(_0xcc4cf){return{'model':db[_0xcc4cf[_0x13be('0x22')]],'as':_0xcc4cf['as'],'attributes':_0xcc4cf[_0x13be('0x23')],'include':_0xcc4cf[_0x13be('0x21')]?_[_0x13be('0x20')](_0xcc4cf[_0x13be('0x21')],function(_0xe5c96c){return{'model':db[_0xe5c96c[_0x13be('0x22')]],'as':_0xe5c96c['as'],'attributes':_0xe5c96c[_0x13be('0x23')],'include':_0xe5c96c[_0x13be('0x21')]?_['map'](_0xe5c96c[_0x13be('0x21')],function(_0x27aa5e){return{'model':db[_0x27aa5e[_0x13be('0x22')]],'as':_0x27aa5e['as'],'attributes':_0x27aa5e[_0x13be('0x23')]};}):[]};}):[]};}):[]:[]})[_0x13be('0x12')](function(_0x119242){logger[_0x13be('0x19')](_0x13be('0x26'),_0x31f26c);logger['debug'](_0x13be('0x26'),_0x31f26c,JSON[_0x13be('0x15')](_0x119242));_0x26c421(_0x119242);})['catch'](function(_0x1fbc02){logger[_0x13be('0x16')](_0x13be('0x26'),_0x1fbc02[_0x13be('0x18')],_0x31f26c);_0x11368d(_0x173019[_0x13be('0x16')](0x1f4,_0x1fbc02[_0x13be('0x18')]));});});}; \ No newline at end of file +var _0xc744=['error','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowFaxQueue','find','debug','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a286e,_0x4f97b2){var _0x453278=function(_0x3086c9){while(--_0x3086c9){_0x2a286e['push'](_0x2a286e['shift']());}};_0x453278(++_0x4f97b2);}(_0xc744,0x18f));var _0x4c74=function(_0x58d5a3,_0x1a2f5a){_0x58d5a3=_0x58d5a3-0x0;var _0x597721=_0xc744[_0x58d5a3];return _0x597721;};'use strict';var _=require(_0x4c74('0x0'));var util=require('util');var moment=require(_0x4c74('0x1'));var BPromise=require(_0x4c74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c74('0x4'));var logger=require(_0x4c74('0x5'))('rpc');var config=require(_0x4c74('0x6'));var jayson=require(_0x4c74('0x7'));var client=jayson[_0x4c74('0x8')]['http']({'port':0x232a});config[_0x4c74('0x9')]=_[_0x4c74('0xa')](config[_0x4c74('0x9')],{'host':_0x4c74('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0x4c74('0xc')](socket);function respondWithRpcPromise(_0x3817be,_0x37b783,_0x30b55b){return new BPromise(function(_0x3127d9,_0x2ee0fd){return client[_0x4c74('0xd')](_0x3817be,_0x30b55b)['then'](function(_0x2e2c9c){logger[_0x4c74('0xe')](_0x4c74('0xf'),_0x37b783,_0x4c74('0x10'));logger['debug'](_0x4c74('0x11'),_0x37b783,_0x4c74('0x10'),JSON[_0x4c74('0x12')](_0x2e2c9c));if(_0x2e2c9c[_0x4c74('0x13')]){if(_0x2e2c9c[_0x4c74('0x13')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x37b783,_0x2e2c9c['error'][_0x4c74('0x14')]);return _0x2ee0fd(_0x2e2c9c[_0x4c74('0x13')][_0x4c74('0x14')]);}logger[_0x4c74('0x13')](_0x4c74('0xf'),_0x37b783,_0x2e2c9c[_0x4c74('0x13')][_0x4c74('0x14')]);return _0x3127d9(_0x2e2c9c[_0x4c74('0x13')][_0x4c74('0x14')]);}else{logger[_0x4c74('0xe')](_0x4c74('0xf'),_0x37b783,_0x4c74('0x10'));_0x3127d9(_0x2e2c9c[_0x4c74('0x15')][_0x4c74('0x14')]);}})['catch'](function(_0x2e19d4){logger[_0x4c74('0x13')](_0x4c74('0xf'),_0x37b783,_0x2e19d4);_0x2ee0fd(_0x2e19d4);});});}exports[_0x4c74('0x16')]=function(_0x43c84c){var _0x3816d3=this;return new Promise(function(_0x2a5b85,_0x15324b){return db[_0x4c74('0x17')][_0x4c74('0x18')]({'raw':_0x43c84c['options']?_0x43c84c[_0x4c74('0x19')][_0x4c74('0x1a')]===undefined?!![]:![]:!![],'where':_0x43c84c[_0x4c74('0x19')]?_0x43c84c[_0x4c74('0x19')][_0x4c74('0x1b')]||null:null,'attributes':_0x43c84c[_0x4c74('0x19')]?_0x43c84c[_0x4c74('0x19')][_0x4c74('0x1c')]||null:null,'limit':_0x43c84c[_0x4c74('0x19')]?_0x43c84c[_0x4c74('0x19')][_0x4c74('0x1d')]||null:null,'include':_0x43c84c[_0x4c74('0x19')]?_0x43c84c[_0x4c74('0x19')][_0x4c74('0x1e')]?_[_0x4c74('0x1f')](_0x43c84c[_0x4c74('0x19')][_0x4c74('0x1e')],function(_0x170654){return{'model':db[_0x170654[_0x4c74('0x20')]],'as':_0x170654['as'],'attributes':_0x170654['attributes'],'include':_0x170654['include']?_[_0x4c74('0x1f')](_0x170654[_0x4c74('0x1e')],function(_0xf9c43a){return{'model':db[_0xf9c43a[_0x4c74('0x20')]],'as':_0xf9c43a['as'],'attributes':_0xf9c43a[_0x4c74('0x1c')],'include':_0xf9c43a['include']?_['map'](_0xf9c43a[_0x4c74('0x1e')],function(_0x17ece1){return{'model':db[_0x17ece1[_0x4c74('0x20')]],'as':_0x17ece1['as'],'attributes':_0x17ece1[_0x4c74('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c74('0x21')](function(_0x40d3f8){logger[_0x4c74('0xe')]('GetFaxQueue',_0x43c84c);logger['debug']('GetFaxQueue',_0x43c84c,JSON[_0x4c74('0x12')](_0x40d3f8));_0x2a5b85(_0x40d3f8);})['catch'](function(_0xf0d94b){logger[_0x4c74('0x13')](_0x4c74('0x16'),_0xf0d94b[_0x4c74('0x14')],_0x43c84c);_0x15324b(_0x3816d3['error'](0x1f4,_0xf0d94b[_0x4c74('0x14')]));});});};exports[_0x4c74('0x22')]=function(_0x363ebd){var _0x174bbb=this;return new Promise(function(_0x5f42a5,_0x479192){return db['FaxQueue'][_0x4c74('0x23')]({'raw':_0x363ebd[_0x4c74('0x19')]?_0x363ebd['options'][_0x4c74('0x1a')]===undefined?!![]:![]:!![],'where':_0x363ebd[_0x4c74('0x19')]?_0x363ebd['options'][_0x4c74('0x1b')]||null:null,'attributes':_0x363ebd[_0x4c74('0x19')]?_0x363ebd[_0x4c74('0x19')][_0x4c74('0x1c')]||null:null,'include':_0x363ebd['options']?_0x363ebd[_0x4c74('0x19')][_0x4c74('0x1e')]?_[_0x4c74('0x1f')](_0x363ebd[_0x4c74('0x19')][_0x4c74('0x1e')],function(_0x497b21){return{'model':db[_0x497b21[_0x4c74('0x20')]],'as':_0x497b21['as'],'attributes':_0x497b21[_0x4c74('0x1c')],'include':_0x497b21[_0x4c74('0x1e')]?_[_0x4c74('0x1f')](_0x497b21[_0x4c74('0x1e')],function(_0x7fa977){return{'model':db[_0x7fa977[_0x4c74('0x20')]],'as':_0x7fa977['as'],'attributes':_0x7fa977[_0x4c74('0x1c')],'include':_0x7fa977[_0x4c74('0x1e')]?_['map'](_0x7fa977[_0x4c74('0x1e')],function(_0x341f04){return{'model':db[_0x341f04[_0x4c74('0x20')]],'as':_0x341f04['as'],'attributes':_0x341f04[_0x4c74('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c74('0x21')](function(_0x36fbc9){logger[_0x4c74('0xe')]('ShowFaxQueue',_0x363ebd);logger[_0x4c74('0x24')]('ShowFaxQueue',_0x363ebd,JSON[_0x4c74('0x12')](_0x36fbc9));_0x5f42a5(_0x36fbc9);})[_0x4c74('0x25')](function(_0x1ecf6c){logger[_0x4c74('0x13')](_0x4c74('0x22'),_0x1ecf6c[_0x4c74('0x14')],_0x363ebd);_0x479192(_0x174bbb[_0x4c74('0x13')](0x1f4,_0x1ecf6c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index be0a397..d5e9a1c 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 _0xe74d=['length','faxQueue:','./faxQueue.events','save','emit','removeListener','register'];(function(_0xa669bb,_0x4ac155){var _0x59dfef=function(_0x49d655){while(--_0x49d655){_0xa669bb['push'](_0xa669bb['shift']());}};_0x59dfef(++_0x4ac155);}(_0xe74d,0x16e));var _0xde74=function(_0x40cb7a,_0x505484){_0x40cb7a=_0x40cb7a-0x0;var _0x246f9c=_0xe74d[_0x40cb7a];return _0x246f9c;};'use strict';var FaxQueueEvents=require(_0xde74('0x0'));var events=[_0xde74('0x1'),'remove','update'];function createListener(_0x2efe3a,_0x1158e9){return function(_0x25e460){_0x1158e9[_0xde74('0x2')](_0x2efe3a,_0x25e460);};}function removeListener(_0x5792c7,_0x428fc7){return function(){FaxQueueEvents[_0xde74('0x3')](_0x5792c7,_0x428fc7);};}exports[_0xde74('0x4')]=function(_0x328c43){for(var _0x4800a3=0x0,_0x327f7d=events[_0xde74('0x5')];_0x4800a3<_0x327f7d;_0x4800a3++){var _0x4724a0=events[_0x4800a3];var _0x12988d=createListener(_0xde74('0x6')+_0x4724a0,_0x328c43);FaxQueueEvents['on'](_0x4724a0,_0x12988d);}}; \ No newline at end of file +var _0xff16=['emit','removeListener','register','length','faxQueue:','save','update'];(function(_0x2390ed,_0x5121fe){var _0x50a7ad=function(_0x1f34e6){while(--_0x1f34e6){_0x2390ed['push'](_0x2390ed['shift']());}};_0x50a7ad(++_0x5121fe);}(_0xff16,0xa6));var _0x6ff1=function(_0x963b84,_0xe996bb){_0x963b84=_0x963b84-0x0;var _0x42c13a=_0xff16[_0x963b84];return _0x42c13a;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x6ff1('0x0'),'remove',_0x6ff1('0x1')];function createListener(_0x129297,_0x5dc05e){return function(_0xc0c3b3){_0x5dc05e[_0x6ff1('0x2')](_0x129297,_0xc0c3b3);};}function removeListener(_0x56c49c,_0x47a853){return function(){FaxQueueEvents[_0x6ff1('0x3')](_0x56c49c,_0x47a853);};}exports[_0x6ff1('0x4')]=function(_0x7ee38f){for(var _0x1105eb=0x0,_0xa22863=events[_0x6ff1('0x5')];_0x1105eb<_0xa22863;_0x1105eb++){var _0x2f539e=events[_0x1105eb];var _0x22d061=createListener(_0x6ff1('0x6')+_0x2f539e,_0x7ee38f);FaxQueueEvents['on'](_0x2f539e,_0x22d061);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6917b17..35004d9 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 _0x5d58=['put','update','delete','destroy','removeTeams','removeAgents','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x47bf9d,_0x30a808){var _0x537c58=function(_0x49fbc5){while(--_0x49fbc5){_0x47bf9d['push'](_0x47bf9d['shift']());}};_0x537c58(++_0x30a808);}(_0x5d58,0x187));var _0x85d5=function(_0x3b824a,_0x49acfe){_0x3b824a=_0x3b824a-0x0;var _0x5f1e09=_0x5d58[_0x3b824a];return _0x5f1e09;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./faxQueue.controller');router[_0x85d5('0x4')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0x6')]);router[_0x85d5('0x4')]('/describe',auth[_0x85d5('0x5')](),controller[_0x85d5('0x7')]);router['get'](_0x85d5('0x8'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0x4')](_0x85d5('0xa'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xc')]);router[_0x85d5('0x4')](_0x85d5('0xd'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x85d5('0xf')](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x10')]);router[_0x85d5('0xf')](_0x85d5('0xd'),auth[_0x85d5('0x5')](),controller['addAgents']);router[_0x85d5('0x11')](_0x85d5('0x8'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x12')]);router[_0x85d5('0x13')](_0x85d5('0x8'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x14')]);router[_0x85d5('0x13')](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x15')]);router[_0x85d5('0x13')](_0x85d5('0xd'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x16')]);module[_0x85d5('0x17')]=router; \ No newline at end of file +var _0xf072=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','multer'];(function(_0x382987,_0x58058b){var _0x29eb57=function(_0x646f43){while(--_0x646f43){_0x382987['push'](_0x382987['shift']());}};_0x29eb57(++_0x58058b);}(_0xf072,0x1cf));var _0x2f07=function(_0x1d6d8b,_0x6aa327){_0x1d6d8b=_0x1d6d8b-0x0;var _0x20bcd6=_0xf072[_0x1d6d8b];return _0x20bcd6;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0x8')](_0x2f07('0xf'),auth[_0x2f07('0x9')](),controller['getMembers']);router[_0x2f07('0x8')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router['get']('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x12')]);router['post']('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x13')]);router[_0x2f07('0x14')]('/:id/teams',auth[_0x2f07('0x9')](),controller[_0x2f07('0x15')]);router[_0x2f07('0x14')](_0x2f07('0x16'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x17')]);router['put'](_0x2f07('0xd'),auth['isAuthenticated'](),controller[_0x2f07('0x18')]);router[_0x2f07('0x19')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x1a')]);router[_0x2f07('0x19')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller['removeTeams']);router[_0x2f07('0x19')]('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x1b')]);module[_0x2f07('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a7b8f48..7c93f5c 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 _0xa13e=['sequelize','exports','STRING','DATE','moment'];(function(_0x527cf1,_0x45f3a6){var _0x2d3d04=function(_0x43b9f){while(--_0x43b9f){_0x527cf1['push'](_0x527cf1['shift']());}};_0x2d3d04(++_0x45f3a6);}(_0xa13e,0xc7));var _0xea13=function(_0xd370f5,_0x73fd8e){_0xd370f5=_0xd370f5-0x0;var _0x2c28e6=_0xa13e[_0xd370f5];return _0x2c28e6;};'use strict';var moment=require(_0xea13('0x0'));var Sequelize=require(_0xea13('0x1'));module[_0xea13('0x2')]={'uniqueid':{'type':Sequelize[_0xea13('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xea13('0x4')]},'leaveAt':{'type':Sequelize[_0xea13('0x4')]},'acceptAt':{'type':Sequelize[_0xea13('0x4')]},'exitAt':{'type':Sequelize[_0xea13('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3544=['DATE','moment','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3544,0x121));var _0x4354=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x3544[_0x365be9];return _0x185c12;};'use strict';var moment=require(_0x4354('0x0'));var Sequelize=require('sequelize');module[_0x4354('0x1')]={'uniqueid':{'type':Sequelize[_0x4354('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4354('0x3')]},'leaveAt':{'type':Sequelize[_0x4354('0x3')]},'acceptAt':{'type':Sequelize[_0x4354('0x3')]},'exitAt':{'type':Sequelize[_0x4354('0x3')]},'reason':{'type':Sequelize[_0x4354('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4c2219c..7d056af 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 _0x54f3=['create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','stack','name','send','map','FaxQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x54f3,0x120));var _0x354f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x54f3[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){_0xc0d4ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22594b,_0x4c9b18){return function(_0x4b1820){if(!_0x4b1820){_0x22594b[_0x354f('0x15')](0x194);}return _0x4b1820;};}function handleError(_0x4e2ad6,_0x3f0bfe){_0x3f0bfe=_0x3f0bfe||0x1f4;return function(_0x393622){logger['error'](_0x393622[_0x354f('0x22')]);if(_0x393622[_0x354f('0x23')]){delete _0x393622[_0x354f('0x23')];}_0x4e2ad6['status'](_0x3f0bfe)[_0x354f('0x24')](_0x393622);};}exports['index']=function(_0x227d9b,_0x26373d){var _0x16a376={},_0x2816cf={},_0x596b48={'count':0x0,'rows':[]};var _0x21c121=_[_0x354f('0x25')](db[_0x354f('0x26')][_0x354f('0x27')],function(_0x223464){return{'name':_0x223464['fieldName'],'type':_0x223464['type'][_0x354f('0x28')]};});_0x2816cf[_0x354f('0x29')]=_[_0x354f('0x25')](_0x21c121,_0x354f('0x23'));_0x2816cf['query']=_['keys'](_0x227d9b[_0x354f('0x2a')]);_0x2816cf[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],_0x2816cf['query']);_0x16a376[_0x354f('0x2d')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x227d9b['query']['fields']));_0x16a376[_0x354f('0x2d')]=_0x16a376[_0x354f('0x2d')][_0x354f('0x2f')]?_0x16a376[_0x354f('0x2d')]:_0x2816cf[_0x354f('0x29')];if(!_0x227d9b[_0x354f('0x2a')][_0x354f('0x30')](_0x354f('0x31'))){_0x16a376[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x227d9b[_0x354f('0x2a')]['limit']);_0x16a376[_0x354f('0x1b')]=qs['offset'](_0x227d9b[_0x354f('0x2a')][_0x354f('0x1b')]);}_0x16a376[_0x354f('0x32')]=qs[_0x354f('0x33')](_0x227d9b[_0x354f('0x2a')][_0x354f('0x33')]);_0x16a376['where']=qs[_0x354f('0x2b')](_[_0x354f('0x34')](_0x227d9b['query'],_0x2816cf[_0x354f('0x2b')]),_0x21c121);if(_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]){_0x16a376['where']=_[_0x354f('0x36')](_0x16a376[_0x354f('0x37')],{'$or':_[_0x354f('0x25')](_0x21c121,function(_0x389f82){if(_0x389f82['type']!==_0x354f('0x38')){var _0x4db9a4={};_0x4db9a4[_0x389f82[_0x354f('0x23')]]={'$like':'%'+_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]+'%'};return _0x4db9a4;}})});}_0x16a376=_[_0x354f('0x36')]({},_0x16a376,_0x227d9b[_0x354f('0x39')]);var _0x589c69={'where':_0x16a376['where']};return db[_0x354f('0x26')][_0x354f('0x1a')](_0x589c69)[_0x354f('0x21')](function(_0x327fb2){_0x596b48[_0x354f('0x1a')]=_0x327fb2;if(_0x227d9b[_0x354f('0x2a')]['includeAll']){_0x16a376[_0x354f('0x3a')]=[{'all':!![]}];}return db[_0x354f('0x26')][_0x354f('0x3b')](_0x16a376);})[_0x354f('0x21')](function(_0x512592){_0x596b48[_0x354f('0x3c')]=_0x512592;return _0x596b48;})[_0x354f('0x21')](respondWithFilteredResult(_0x26373d,_0x16a376))[_0x354f('0x3d')](handleError(_0x26373d,null));};exports[_0x354f('0x3e')]=function(_0x1da53d,_0x344666){var _0x5f33b2={'raw':!![],'where':{'id':_0x1da53d[_0x354f('0x3f')]['id']}},_0x66b4cc={};_0x66b4cc[_0x354f('0x29')]=_['keys'](db['FaxQueueReport'][_0x354f('0x27')]);_0x66b4cc[_0x354f('0x2a')]=_[_0x354f('0x40')](_0x1da53d[_0x354f('0x2a')]);_0x66b4cc[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],_0x66b4cc[_0x354f('0x2a')]);_0x5f33b2['attributes']=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x1da53d[_0x354f('0x2a')][_0x354f('0x2e')]));_0x5f33b2[_0x354f('0x2d')]=_0x5f33b2[_0x354f('0x2d')][_0x354f('0x2f')]?_0x5f33b2[_0x354f('0x2d')]:_0x66b4cc['model'];if(_0x1da53d[_0x354f('0x2a')][_0x354f('0x41')]){_0x5f33b2['include']=[{'all':!![]}];}_0x5f33b2=_['merge']({},_0x5f33b2,_0x1da53d[_0x354f('0x39')]);return db[_0x354f('0x26')][_0x354f('0x42')](_0x5f33b2)[_0x354f('0x21')](handleEntityNotFound(_0x344666,null))[_0x354f('0x21')](respondWithResult(_0x344666,null))[_0x354f('0x3d')](handleError(_0x344666,null));};exports['create']=function(_0x558332,_0x178313){return db[_0x354f('0x26')][_0x354f('0x43')](_0x558332[_0x354f('0x44')],{})[_0x354f('0x21')](respondWithResult(_0x178313,0xc9))[_0x354f('0x3d')](handleError(_0x178313,null));};exports['update']=function(_0x55f2c9,_0x6b7a2c){if(_0x55f2c9['body']['id']){delete _0x55f2c9[_0x354f('0x44')]['id'];}return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0x55f2c9['params']['id']}})['then'](handleEntityNotFound(_0x6b7a2c,null))[_0x354f('0x21')](saveUpdates(_0x55f2c9[_0x354f('0x44')],null))['then'](respondWithResult(_0x6b7a2c,null))[_0x354f('0x3d')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x45')]=function(_0xf71a4f,_0x2dd012){return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0xf71a4f[_0x354f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2dd012,null))[_0x354f('0x21')](removeEntity(_0x2dd012,null))[_0x354f('0x3d')](handleError(_0x2dd012,null));};exports[_0x354f('0x46')]=function(_0x3edef3,_0x23af1b){return db['FaxQueueReport'][_0x354f('0x46')]()[_0x354f('0x21')](respondWithResult(_0x23af1b,null))['catch'](handleError(_0x23af1b,null));}; \ No newline at end of file +var _0x1cc7=['count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined'];(function(_0x465e1d,_0x18a171){var _0x43d904=function(_0xd214a3){while(--_0xd214a3){_0x465e1d['push'](_0x465e1d['shift']());}};_0x43d904(++_0x18a171);}(_0x1cc7,0x15a));var _0x71cc=function(_0x2b4d26,_0x279b45){_0x2b4d26=_0x2b4d26-0x0;var _0x1b5a40=_0x1cc7[_0x2b4d26];return _0x1b5a40;};'use strict';var emlformat=require(_0x71cc('0x0'));var rimraf=require(_0x71cc('0x1'));var zipdir=require(_0x71cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71cc('0x3'));var Mustache=require(_0x71cc('0x4'));var util=require(_0x71cc('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x71cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71cc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad83,_0x4f9c5c){_0x4f9c5c=_0x4f9c5c||0xcc;return function(_0x1a7c58){if(_0x1a7c58){return _0x1aad83['sendStatus'](_0x4f9c5c);}return _0x1aad83[_0x71cc('0x13')](_0x4f9c5c)[_0x71cc('0x14')]();};}function respondWithResult(_0x3cee23,_0xd16032){_0xd16032=_0xd16032||0xc8;return function(_0x33070e){if(_0x33070e){return _0x3cee23['status'](_0xd16032)[_0x71cc('0x15')](_0x33070e);}};}function respondWithFilteredResult(_0x292d0c,_0x3b26d1){return function(_0x14d5ab){if(_0x14d5ab){var _0x3875b8=typeof _0x3b26d1[_0x71cc('0x16')]===_0x71cc('0x17')&&typeof _0x3b26d1['limit']===_0x71cc('0x17');var _0x14788d=_0x14d5ab[_0x71cc('0x18')];var _0x1d1da8=_0x3875b8?0x0:_0x3b26d1[_0x71cc('0x16')];var _0x10da0a=_0x3875b8?_0x14d5ab['count']:_0x3b26d1[_0x71cc('0x16')]+_0x3b26d1[_0x71cc('0x19')];var _0x4fc0a9;if(_0x10da0a>=_0x14788d){_0x10da0a=_0x14788d;_0x4fc0a9=0xc8;}else{_0x4fc0a9=0xce;}_0x292d0c['status'](_0x4fc0a9);return _0x292d0c[_0x71cc('0x1a')](_0x71cc('0x1b'),_0x1d1da8+'-'+_0x10da0a+'/'+_0x14788d)[_0x71cc('0x15')](_0x14d5ab);}return null;};}function patchUpdates(_0x11299c){return function(_0x258d30){try{jsonpatch[_0x71cc('0x1c')](_0x258d30,_0x11299c,!![]);}catch(_0x363ecb){return BPromise[_0x71cc('0x1d')](_0x363ecb);}return _0x258d30['save']();};}function saveUpdates(_0x1442ef,_0x109239){return function(_0x587a0b){if(_0x587a0b){return _0x587a0b[_0x71cc('0x1e')](_0x1442ef)[_0x71cc('0x1f')](function(_0x38f58e){return _0x38f58e;});}return null;};}function removeEntity(_0x1a9b4f,_0x1bc67c){return function(_0x887399){if(_0x887399){return _0x887399['destroy']()[_0x71cc('0x1f')](function(){_0x1a9b4f[_0x71cc('0x13')](0xcc)[_0x71cc('0x14')]();});}};}function handleEntityNotFound(_0x180cd2,_0x36367b){return function(_0x5fa323){if(!_0x5fa323){_0x180cd2[_0x71cc('0x20')](0x194);}return _0x5fa323;};}function handleError(_0x42e6ec,_0xbce208){_0xbce208=_0xbce208||0x1f4;return function(_0x4d4529){logger[_0x71cc('0x21')](_0x4d4529[_0x71cc('0x22')]);if(_0x4d4529[_0x71cc('0x23')]){delete _0x4d4529[_0x71cc('0x23')];}_0x42e6ec[_0x71cc('0x13')](_0xbce208)[_0x71cc('0x24')](_0x4d4529);};}exports[_0x71cc('0x25')]=function(_0x9a7ca3,_0x3cc813){var _0x1fc046={},_0x30f94d={},_0x35f723={'count':0x0,'rows':[]};var _0x1d5805=_[_0x71cc('0x26')](db[_0x71cc('0x27')][_0x71cc('0x28')],function(_0x4fa63e){return{'name':_0x4fa63e[_0x71cc('0x29')],'type':_0x4fa63e[_0x71cc('0x2a')][_0x71cc('0x2b')]};});_0x30f94d[_0x71cc('0x2c')]=_[_0x71cc('0x26')](_0x1d5805,_0x71cc('0x23'));_0x30f94d['query']=_[_0x71cc('0x2d')](_0x9a7ca3[_0x71cc('0x2e')]);_0x30f94d[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x30f94d[_0x71cc('0x2c')],_0x30f94d[_0x71cc('0x2e')]);_0x1fc046[_0x71cc('0x31')]=_['intersection'](_0x30f94d[_0x71cc('0x2c')],qs['fields'](_0x9a7ca3['query'][_0x71cc('0x32')]));_0x1fc046['attributes']=_0x1fc046['attributes'][_0x71cc('0x33')]?_0x1fc046['attributes']:_0x30f94d[_0x71cc('0x2c')];if(!_0x9a7ca3['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x1fc046['limit']=qs[_0x71cc('0x19')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1fc046[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x16')]);}_0x1fc046[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x9a7ca3[_0x71cc('0x2e')]['sort']);_0x1fc046[_0x71cc('0x38')]=qs['filters'](_[_0x71cc('0x39')](_0x9a7ca3[_0x71cc('0x2e')],_0x30f94d[_0x71cc('0x2f')]),_0x1d5805);if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x1fc046[_0x71cc('0x38')]=_['merge'](_0x1fc046[_0x71cc('0x38')],{'$or':_['map'](_0x1d5805,function(_0x468b4b){if(_0x468b4b[_0x71cc('0x2a')]!==_0x71cc('0x3b')){var _0x487e13={};_0x487e13[_0x468b4b[_0x71cc('0x23')]]={'$like':'%'+_0x9a7ca3['query'][_0x71cc('0x3a')]+'%'};return _0x487e13;}})});}_0x1fc046=_[_0x71cc('0x3c')]({},_0x1fc046,_0x9a7ca3[_0x71cc('0x3d')]);var _0x92389={'where':_0x1fc046[_0x71cc('0x38')]};return db[_0x71cc('0x27')][_0x71cc('0x18')](_0x92389)[_0x71cc('0x1f')](function(_0x3c3fae){_0x35f723[_0x71cc('0x18')]=_0x3c3fae;if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x1fc046['include']=[{'all':!![]}];}return db[_0x71cc('0x27')][_0x71cc('0x3f')](_0x1fc046);})['then'](function(_0x54fc85){_0x35f723[_0x71cc('0x40')]=_0x54fc85;return _0x35f723;})[_0x71cc('0x1f')](respondWithFilteredResult(_0x3cc813,_0x1fc046))['catch'](handleError(_0x3cc813,null));};exports[_0x71cc('0x41')]=function(_0x3b9eec,_0x2fbe5e){var _0x19d7c8={'raw':!![],'where':{'id':_0x3b9eec['params']['id']}},_0x21ef21={};_0x21ef21['model']=_['keys'](db[_0x71cc('0x27')]['rawAttributes']);_0x21ef21[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x3b9eec[_0x71cc('0x2e')]);_0x21ef21[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],_0x21ef21[_0x71cc('0x2e')]);_0x19d7c8[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x19d7c8['attributes']=_0x19d7c8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x19d7c8[_0x71cc('0x31')]:_0x21ef21['model'];if(_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x19d7c8[_0x71cc('0x42')]=[{'all':!![]}];}_0x19d7c8=_[_0x71cc('0x3c')]({},_0x19d7c8,_0x3b9eec[_0x71cc('0x3d')]);return db[_0x71cc('0x27')][_0x71cc('0x43')](_0x19d7c8)[_0x71cc('0x1f')](handleEntityNotFound(_0x2fbe5e,null))[_0x71cc('0x1f')](respondWithResult(_0x2fbe5e,null))[_0x71cc('0x44')](handleError(_0x2fbe5e,null));};exports[_0x71cc('0x45')]=function(_0xbb951c,_0x47cefc){return db[_0x71cc('0x27')][_0x71cc('0x45')](_0xbb951c[_0x71cc('0x46')],{})[_0x71cc('0x1f')](respondWithResult(_0x47cefc,0xc9))[_0x71cc('0x44')](handleError(_0x47cefc,null));};exports[_0x71cc('0x1e')]=function(_0x430387,_0x51cd49){if(_0x430387[_0x71cc('0x46')]['id']){delete _0x430387[_0x71cc('0x46')]['id'];}return db['FaxQueueReport'][_0x71cc('0x43')]({'where':{'id':_0x430387[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x51cd49,null))[_0x71cc('0x1f')](saveUpdates(_0x430387[_0x71cc('0x46')],null))[_0x71cc('0x1f')](respondWithResult(_0x51cd49,null))[_0x71cc('0x44')](handleError(_0x51cd49,null));};exports[_0x71cc('0x48')]=function(_0x3cf0bf,_0x1647ce){return db[_0x71cc('0x27')]['find']({'where':{'id':_0x3cf0bf[_0x71cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1647ce,null))[_0x71cc('0x1f')](removeEntity(_0x1647ce,null))['catch'](handleError(_0x1647ce,null));};exports[_0x71cc('0x49')]=function(_0x36c71e,_0x5c9ac5){return db[_0x71cc('0x27')][_0x71cc('0x49')]()['then'](respondWithResult(_0x5c9ac5,null))[_0x71cc('0x44')](handleError(_0x5c9ac5,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f65a80b..586223d 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5575ca,_0x5ed324){var _0xb9f07b=function(_0xd9c027){while(--_0xd9c027){_0x5575ca['push'](_0x5575ca['shift']());}};_0xb9f07b(++_0x5ed324);}(_0x53ec,0x192));var _0xc53e=function(_0x314e22,_0x891517){_0x314e22=_0x314e22-0x0;var _0x4ac0f5=_0x53ec[_0x314e22];return _0x4ac0f5;};'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':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x3329dc,_0x33c413){var _0x3c3cf3=function(_0x49ee9f){while(--_0x49ee9f){_0x3329dc['push'](_0x3329dc['shift']());}};_0x3c3cf3(++_0x33c413);}(_0x7a54,0x106));var _0x47a5=function(_0x38b887,_0x37e4a7){_0x38b887=_0x38b887-0x0;var _0x239e5f=_0x7a54[_0x38b887];return _0x239e5f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b8dfad3..6a12590 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 _0x13c2=['../../config/environment','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','raw','then','UpdateFaxQueueReport','update','options','where','attributes','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x6b7342,_0x46e956){var _0x5b8771=function(_0x12790a){while(--_0x12790a){_0x6b7342['push'](_0x6b7342['shift']());}};_0x5b8771(++_0x46e956);}(_0x13c2,0xf9));var _0x213c=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x13c2[_0x37c22c];return _0x119d79;};'use strict';var _=require('lodash');var util=require(_0x213c('0x0'));var moment=require('moment');var BPromise=require(_0x213c('0x1'));var rs=require(_0x213c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x213c('0x3'))['db'];var utils=require(_0x213c('0x4'));var logger=require(_0x213c('0x5'))(_0x213c('0x6'));var config=require(_0x213c('0x7'));var jayson=require(_0x213c('0x8'));var client=jayson[_0x213c('0x9')][_0x213c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x781535,_0x18a6a0,_0x15c476){return new BPromise(function(_0x2317c1,_0xd7e08a){return client['request'](_0x781535,_0x15c476)['then'](function(_0x4ad4fc){logger[_0x213c('0xb')](_0x213c('0xc'),_0x18a6a0,_0x213c('0xd'));logger[_0x213c('0xe')](_0x213c('0xf'),_0x18a6a0,_0x213c('0xd'),JSON[_0x213c('0x10')](_0x4ad4fc));if(_0x4ad4fc[_0x213c('0x11')]){if(_0x4ad4fc[_0x213c('0x11')][_0x213c('0x12')]===0x1f4){logger[_0x213c('0x11')](_0x213c('0xc'),_0x18a6a0,_0x4ad4fc[_0x213c('0x11')]['message']);return _0xd7e08a(_0x4ad4fc[_0x213c('0x11')][_0x213c('0x13')]);}logger['error'](_0x213c('0xc'),_0x18a6a0,_0x4ad4fc['error'][_0x213c('0x13')]);return _0x2317c1(_0x4ad4fc['error'][_0x213c('0x13')]);}else{logger[_0x213c('0xb')](_0x213c('0xc'),_0x18a6a0,_0x213c('0xd'));_0x2317c1(_0x4ad4fc[_0x213c('0x14')]['message']);}})[_0x213c('0x15')](function(_0x2fa2ce){logger[_0x213c('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x18a6a0,_0x2fa2ce);_0xd7e08a(_0x2fa2ce);});});}exports[_0x213c('0x16')]=function(_0x408f2d){var _0x1e9673=this;return new Promise(function(_0x57b82d,_0x3f6586){return db[_0x213c('0x17')][_0x213c('0x18')](_0x408f2d['body'],{'raw':_0x408f2d['options']?_0x408f2d['options'][_0x213c('0x19')]===undefined?!![]:![]:!![]})[_0x213c('0x1a')](function(_0x4a797e){logger[_0x213c('0xb')](_0x213c('0x16'),_0x408f2d);logger[_0x213c('0xe')]('CreateFaxQueueReport',_0x408f2d,JSON[_0x213c('0x10')](_0x4a797e));_0x57b82d(_0x4a797e);})[_0x213c('0x15')](function(_0x2e5fa1){logger['error'](_0x213c('0x16'),_0x2e5fa1[_0x213c('0x13')],_0x408f2d);_0x3f6586(_0x1e9673['error'](0x1f4,_0x2e5fa1[_0x213c('0x13')]));});});};exports[_0x213c('0x1b')]=function(_0x5a6bb0){var _0x4438e0=this;return new Promise(function(_0x361a40,_0x1e64db){return db['FaxQueueReport'][_0x213c('0x1c')](_0x5a6bb0['body'],{'raw':_0x5a6bb0[_0x213c('0x1d')]?_0x5a6bb0[_0x213c('0x1d')][_0x213c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6bb0[_0x213c('0x1d')]?_0x5a6bb0[_0x213c('0x1d')][_0x213c('0x1e')]||null:null,'attributes':_0x5a6bb0[_0x213c('0x1d')]?_0x5a6bb0['options'][_0x213c('0x1f')]||null:null,'limit':_0x5a6bb0[_0x213c('0x1d')]?_0x5a6bb0[_0x213c('0x1d')]['limit']||null:null})[_0x213c('0x1a')](function(_0x4a961e){logger[_0x213c('0xb')]('UpdateFaxQueueReport',_0x5a6bb0);logger['debug'](_0x213c('0x1b'),_0x5a6bb0,JSON[_0x213c('0x10')](_0x4a961e));_0x361a40(_0x4a961e);})[_0x213c('0x15')](function(_0x2c3ba9){logger[_0x213c('0x11')](_0x213c('0x1b'),_0x2c3ba9[_0x213c('0x13')],_0x5a6bb0);_0x1e64db(_0x4438e0[_0x213c('0x11')](0x1f4,_0x2c3ba9[_0x213c('0x13')]));});});}; \ No newline at end of file +var _0x0c5a=['update','body','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','options','FaxQueueReport'];(function(_0xa92e8b,_0x403282){var _0x2ec542=function(_0x59b1c2){while(--_0x59b1c2){_0xa92e8b['push'](_0xa92e8b['shift']());}};_0x2ec542(++_0x403282);}(_0x0c5a,0x1ab));var _0xa0c5=function(_0x57787e,_0x120aea){_0x57787e=_0x57787e-0x0;var _0x518830=_0x0c5a[_0x57787e];return _0x518830;};'use strict';var _=require(_0xa0c5('0x0'));var util=require('util');var moment=require(_0xa0c5('0x1'));var BPromise=require(_0xa0c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0c5('0x3'))['db'];var utils=require(_0xa0c5('0x4'));var logger=require(_0xa0c5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0c5('0x6'));var client=jayson[_0xa0c5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526e31,_0x445be6,_0x3eecbf){return new BPromise(function(_0xc68b77,_0x181e38){return client['request'](_0x526e31,_0x3eecbf)[_0xa0c5('0x8')](function(_0x21e49e){logger[_0xa0c5('0x9')]('FaxQueueReport,\x20%s,\x20%s',_0x445be6,_0xa0c5('0xa'));logger[_0xa0c5('0xb')](_0xa0c5('0xc'),_0x445be6,_0xa0c5('0xa'),JSON[_0xa0c5('0xd')](_0x21e49e));if(_0x21e49e[_0xa0c5('0xe')]){if(_0x21e49e[_0xa0c5('0xe')]['code']===0x1f4){logger['error'](_0xa0c5('0xf'),_0x445be6,_0x21e49e[_0xa0c5('0xe')][_0xa0c5('0x10')]);return _0x181e38(_0x21e49e['error'][_0xa0c5('0x10')]);}logger[_0xa0c5('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x445be6,_0x21e49e[_0xa0c5('0xe')][_0xa0c5('0x10')]);return _0xc68b77(_0x21e49e['error'][_0xa0c5('0x10')]);}else{logger[_0xa0c5('0x9')](_0xa0c5('0xf'),_0x445be6,_0xa0c5('0xa'));_0xc68b77(_0x21e49e[_0xa0c5('0x11')][_0xa0c5('0x10')]);}})[_0xa0c5('0x12')](function(_0x523ec3){logger[_0xa0c5('0xe')](_0xa0c5('0xf'),_0x445be6,_0x523ec3);_0x181e38(_0x523ec3);});});}exports[_0xa0c5('0x13')]=function(_0x35a5f3){var _0x564a21=this;return new Promise(function(_0x3ed40f,_0x5efd75){return db['FaxQueueReport'][_0xa0c5('0x14')](_0x35a5f3['body'],{'raw':_0x35a5f3[_0xa0c5('0x15')]?_0x35a5f3['options']['raw']===undefined?!![]:![]:!![]})[_0xa0c5('0x8')](function(_0xd8f216){logger[_0xa0c5('0x9')](_0xa0c5('0x13'),_0x35a5f3);logger[_0xa0c5('0xb')](_0xa0c5('0x13'),_0x35a5f3,JSON[_0xa0c5('0xd')](_0xd8f216));_0x3ed40f(_0xd8f216);})[_0xa0c5('0x12')](function(_0x1da05a){logger[_0xa0c5('0xe')](_0xa0c5('0x13'),_0x1da05a[_0xa0c5('0x10')],_0x35a5f3);_0x5efd75(_0x564a21['error'](0x1f4,_0x1da05a[_0xa0c5('0x10')]));});});};exports['UpdateFaxQueueReport']=function(_0xf39d58){var _0x210f61=this;return new Promise(function(_0x22bca9,_0x2e8614){return db[_0xa0c5('0x16')][_0xa0c5('0x17')](_0xf39d58[_0xa0c5('0x18')],{'raw':_0xf39d58[_0xa0c5('0x15')]?_0xf39d58[_0xa0c5('0x15')][_0xa0c5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf39d58[_0xa0c5('0x15')]?_0xf39d58[_0xa0c5('0x15')][_0xa0c5('0x1a')]||null:null,'attributes':_0xf39d58[_0xa0c5('0x15')]?_0xf39d58['options'][_0xa0c5('0x1b')]||null:null,'limit':_0xf39d58[_0xa0c5('0x15')]?_0xf39d58[_0xa0c5('0x15')][_0xa0c5('0x1c')]||null:null})[_0xa0c5('0x8')](function(_0x4755d1){logger[_0xa0c5('0x9')](_0xa0c5('0x1d'),_0xf39d58);logger['debug'](_0xa0c5('0x1d'),_0xf39d58,JSON[_0xa0c5('0xd')](_0x4755d1));_0x22bca9(_0x4755d1);})[_0xa0c5('0x12')](function(_0x361530){logger[_0xa0c5('0xe')]('UpdateFaxQueueReport',_0x361530['message'],_0xf39d58);_0x2e8614(_0x210f61[_0xa0c5('0xe')](0x1f4,_0x361530[_0xa0c5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 24aec60..14478ae 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 _0x3dbb=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3dbb,0x97));var _0xb3db=function(_0x1cc294,_0x5d677d){_0x1cc294=_0x1cc294-0x0;var _0x9af5f=_0x3dbb[_0x1cc294];return _0x9af5f;};'use strict';var multer=require(_0xb3db('0x0'));var util=require('util');var path=require(_0xb3db('0x1'));var timeout=require('connect-timeout');var express=require(_0xb3db('0x2'));var router=express[_0xb3db('0x3')]();var fs_extra=require(_0xb3db('0x4'));var auth=require(_0xb3db('0x5'));var interaction=require(_0xb3db('0x6'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0xb3db('0x7')](),controller[_0xb3db('0x8')]);router[_0xb3db('0x9')](_0xb3db('0xa'),auth['isAuthenticated'](),controller[_0xb3db('0xb')]);router[_0xb3db('0x9')](_0xb3db('0xc'),auth[_0xb3db('0x7')](),controller[_0xb3db('0xd')]);router['post']('/',auth[_0xb3db('0x7')](),controller[_0xb3db('0xe')]);router[_0xb3db('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb3db('0x10')]);router['delete'](_0xb3db('0xc'),auth['isAuthenticated'](),controller[_0xb3db('0x11')]);module[_0xb3db('0x12')]=router; \ No newline at end of file +var _0x0444=['connect-timeout','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0444,0x8b));var _0x4044=function(_0x27565c,_0x5879eb){_0x27565c=_0x27565c-0x0;var _0x56025f=_0x0444[_0x27565c];return _0x56025f;};'use strict';var multer=require(_0x4044('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4044('0x1'));var express=require(_0x4044('0x2'));var router=express[_0x4044('0x3')]();var fs_extra=require(_0x4044('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4044('0x5'));var controller=require(_0x4044('0x6'));router[_0x4044('0x7')]('/',auth[_0x4044('0x8')](),controller[_0x4044('0x9')]);router['get']('/describe',auth[_0x4044('0x8')](),controller[_0x4044('0xa')]);router['get'](_0x4044('0xb'),auth['isAuthenticated'](),controller[_0x4044('0xc')]);router[_0x4044('0xd')]('/',auth[_0x4044('0x8')](),controller[_0x4044('0xe')]);router[_0x4044('0xf')]('/:id',auth[_0x4044('0x8')](),controller[_0x4044('0x10')]);router[_0x4044('0x11')](_0x4044('0xb'),auth['isAuthenticated'](),controller[_0x4044('0x12')]);module[_0x4044('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 a48663c..b4cebe4 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3a2bc6,_0xb3d543){var _0x2781d8=function(_0x4321af){while(--_0x4321af){_0x3a2bc6['push'](_0x3a2bc6['shift']());}};_0x2781d8(++_0xb3d543);}(_0x54ef,0x112));var _0xf54e=function(_0x2b68be,_0x3a3086){_0x2b68be=_0x2b68be-0x0;var _0x20048c=_0x54ef[_0x2b68be];return _0x20048c;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x3cff61,_0x59132c){var _0x18cd71=function(_0x2e7266){while(--_0x2e7266){_0x3cff61['push'](_0x3cff61['shift']());}};_0x18cd71(++_0x59132c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x4b84[_0x5be7aa];return _0x215408;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 9586735..c060608 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 _0xaa42=['json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','map','FaxTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','rawAttributes','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa42,0x173));var _0x2aa4=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xaa42[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0x2aa4('0x0'));var rimraf=require(_0x2aa4('0x1'));var zipdir=require(_0x2aa4('0x2'));var jsonpatch=require(_0x2aa4('0x3'));var rp=require(_0x2aa4('0x4'));var moment=require(_0x2aa4('0x5'));var BPromise=require(_0x2aa4('0x6'));var Mustache=require(_0x2aa4('0x7'));var util=require(_0x2aa4('0x8'));var path=require(_0x2aa4('0x9'));var sox=require(_0x2aa4('0xa'));var csv=require(_0x2aa4('0xb'));var ejs=require(_0x2aa4('0xc'));var fs=require('fs');var fs_extra=require(_0x2aa4('0xd'));var _=require(_0x2aa4('0xe'));var squel=require(_0x2aa4('0xf'));var crypto=require(_0x2aa4('0x10'));var jsforce=require(_0x2aa4('0x11'));var deskjs=require(_0x2aa4('0x12'));var toCsv=require('to-csv');var querystring=require(_0x2aa4('0x13'));var Papa=require(_0x2aa4('0x14'));var Redis=require('ioredis');var authService=require(_0x2aa4('0x15'));var qs=require(_0x2aa4('0x16'));var as=require(_0x2aa4('0x17'));var hardwareService=require(_0x2aa4('0x18'));var logger=require(_0x2aa4('0x19'))(_0x2aa4('0x1a'));var utils=require(_0x2aa4('0x1b'));var config=require(_0x2aa4('0x1c'));var licenseUtil=require(_0x2aa4('0x1d'));var db=require(_0x2aa4('0x1e'))['db'];function respondWithStatusCode(_0x4b3d82,_0x15dc8a){_0x15dc8a=_0x15dc8a||0xcc;return function(_0x3cf4ab){if(_0x3cf4ab){return _0x4b3d82[_0x2aa4('0x1f')](_0x15dc8a);}return _0x4b3d82[_0x2aa4('0x20')](_0x15dc8a)[_0x2aa4('0x21')]();};}function respondWithResult(_0x2fa093,_0x435ff2){_0x435ff2=_0x435ff2||0xc8;return function(_0x1a7810){if(_0x1a7810){return _0x2fa093[_0x2aa4('0x20')](_0x435ff2)[_0x2aa4('0x22')](_0x1a7810);}};}function respondWithFilteredResult(_0x355a38,_0x46b3d9){return function(_0x139ea5){if(_0x139ea5){var _0x503558=typeof _0x46b3d9[_0x2aa4('0x23')]===_0x2aa4('0x24')&&typeof _0x46b3d9[_0x2aa4('0x25')]===_0x2aa4('0x24');var _0x1b30f9=_0x139ea5[_0x2aa4('0x26')];var _0x5d9297=_0x503558?0x0:_0x46b3d9[_0x2aa4('0x23')];var _0x417063=_0x503558?_0x139ea5[_0x2aa4('0x26')]:_0x46b3d9[_0x2aa4('0x23')]+_0x46b3d9[_0x2aa4('0x25')];var _0x10db39;if(_0x417063>=_0x1b30f9){_0x417063=_0x1b30f9;_0x10db39=0xc8;}else{_0x10db39=0xce;}_0x355a38['status'](_0x10db39);return _0x355a38[_0x2aa4('0x27')]('Content-Range',_0x5d9297+'-'+_0x417063+'/'+_0x1b30f9)[_0x2aa4('0x22')](_0x139ea5);}return null;};}function patchUpdates(_0x3761e5){return function(_0x2afee7){try{jsonpatch[_0x2aa4('0x28')](_0x2afee7,_0x3761e5,!![]);}catch(_0x2a47a4){return BPromise[_0x2aa4('0x29')](_0x2a47a4);}return _0x2afee7['save']();};}function saveUpdates(_0x1947d8,_0x14faef){return function(_0x51d02d){if(_0x51d02d){return _0x51d02d[_0x2aa4('0x2a')](_0x1947d8)[_0x2aa4('0x2b')](function(_0x59d564){return _0x59d564;});}return null;};}function removeEntity(_0x80bbd1,_0x245a73){return function(_0x369093){if(_0x369093){return _0x369093[_0x2aa4('0x2c')]()[_0x2aa4('0x2b')](function(){_0x80bbd1[_0x2aa4('0x20')](0xcc)[_0x2aa4('0x21')]();});}};}function handleEntityNotFound(_0x28fbac,_0x13d857){return function(_0x3a9889){if(!_0x3a9889){_0x28fbac[_0x2aa4('0x1f')](0x194);}return _0x3a9889;};}function handleError(_0xf2e6f,_0x1ec822){_0x1ec822=_0x1ec822||0x1f4;return function(_0x3e1ee9){logger['error'](_0x3e1ee9[_0x2aa4('0x2d')]);if(_0x3e1ee9[_0x2aa4('0x2e')]){delete _0x3e1ee9[_0x2aa4('0x2e')];}_0xf2e6f[_0x2aa4('0x20')](_0x1ec822)['send'](_0x3e1ee9);};}exports['index']=function(_0x557587,_0x1370cf){var _0x1c5c96={},_0xd7634b={},_0x3db88b={'count':0x0,'rows':[]};var _0xebb796=_[_0x2aa4('0x2f')](db[_0x2aa4('0x30')]['rawAttributes'],function(_0x183d29){return{'name':_0x183d29[_0x2aa4('0x31')],'type':_0x183d29['type'][_0x2aa4('0x32')]};});_0xd7634b[_0x2aa4('0x33')]=_['map'](_0xebb796,_0x2aa4('0x2e'));_0xd7634b[_0x2aa4('0x34')]=_[_0x2aa4('0x35')](_0x557587[_0x2aa4('0x34')]);_0xd7634b[_0x2aa4('0x36')]=_[_0x2aa4('0x37')](_0xd7634b[_0x2aa4('0x33')],_0xd7634b['query']);_0x1c5c96[_0x2aa4('0x38')]=_['intersection'](_0xd7634b[_0x2aa4('0x33')],qs[_0x2aa4('0x39')](_0x557587[_0x2aa4('0x34')][_0x2aa4('0x39')]));_0x1c5c96[_0x2aa4('0x38')]=_0x1c5c96[_0x2aa4('0x38')][_0x2aa4('0x3a')]?_0x1c5c96[_0x2aa4('0x38')]:_0xd7634b[_0x2aa4('0x33')];if(!_0x557587[_0x2aa4('0x34')][_0x2aa4('0x3b')](_0x2aa4('0x3c'))){_0x1c5c96[_0x2aa4('0x25')]=qs['limit'](_0x557587[_0x2aa4('0x34')]['limit']);_0x1c5c96[_0x2aa4('0x23')]=qs[_0x2aa4('0x23')](_0x557587['query']['offset']);}_0x1c5c96[_0x2aa4('0x3d')]=qs[_0x2aa4('0x3e')](_0x557587['query'][_0x2aa4('0x3e')]);_0x1c5c96[_0x2aa4('0x3f')]=qs[_0x2aa4('0x36')](_[_0x2aa4('0x40')](_0x557587[_0x2aa4('0x34')],_0xd7634b[_0x2aa4('0x36')]),_0xebb796);if(_0x557587[_0x2aa4('0x34')][_0x2aa4('0x41')]){_0x1c5c96['where']=_[_0x2aa4('0x42')](_0x1c5c96[_0x2aa4('0x3f')],{'$or':_[_0x2aa4('0x2f')](_0xebb796,function(_0x34e311){if(_0x34e311[_0x2aa4('0x43')]!==_0x2aa4('0x44')){var _0x192f80={};_0x192f80[_0x34e311[_0x2aa4('0x2e')]]={'$like':'%'+_0x557587[_0x2aa4('0x34')]['filter']+'%'};return _0x192f80;}})});}_0x1c5c96=_['merge']({},_0x1c5c96,_0x557587['options']);var _0x41857f={'where':_0x1c5c96['where']};return db[_0x2aa4('0x30')]['count'](_0x41857f)[_0x2aa4('0x2b')](function(_0xe01667){_0x3db88b[_0x2aa4('0x26')]=_0xe01667;if(_0x557587[_0x2aa4('0x34')][_0x2aa4('0x45')]){_0x1c5c96[_0x2aa4('0x46')]=[{'all':!![]}];}return db[_0x2aa4('0x30')]['findAll'](_0x1c5c96);})[_0x2aa4('0x2b')](function(_0x412714){_0x3db88b[_0x2aa4('0x47')]=_0x412714;return _0x3db88b;})[_0x2aa4('0x2b')](respondWithFilteredResult(_0x1370cf,_0x1c5c96))['catch'](handleError(_0x1370cf,null));};exports[_0x2aa4('0x48')]=function(_0x6c7b44,_0x21200f){var _0xfb6eec={'raw':!![],'where':{'id':_0x6c7b44['params']['id']}},_0x2aae7a={};_0x2aae7a[_0x2aa4('0x33')]=_[_0x2aa4('0x35')](db[_0x2aa4('0x30')][_0x2aa4('0x49')]);_0x2aae7a[_0x2aa4('0x34')]=_[_0x2aa4('0x35')](_0x6c7b44[_0x2aa4('0x34')]);_0x2aae7a[_0x2aa4('0x36')]=_[_0x2aa4('0x37')](_0x2aae7a[_0x2aa4('0x33')],_0x2aae7a['query']);_0xfb6eec[_0x2aa4('0x38')]=_[_0x2aa4('0x37')](_0x2aae7a['model'],qs[_0x2aa4('0x39')](_0x6c7b44[_0x2aa4('0x34')][_0x2aa4('0x39')]));_0xfb6eec[_0x2aa4('0x38')]=_0xfb6eec[_0x2aa4('0x38')][_0x2aa4('0x3a')]?_0xfb6eec[_0x2aa4('0x38')]:_0x2aae7a[_0x2aa4('0x33')];if(_0x6c7b44[_0x2aa4('0x34')][_0x2aa4('0x45')]){_0xfb6eec[_0x2aa4('0x46')]=[{'all':!![]}];}_0xfb6eec=_[_0x2aa4('0x42')]({},_0xfb6eec,_0x6c7b44[_0x2aa4('0x4a')]);return db[_0x2aa4('0x30')][_0x2aa4('0x4b')](_0xfb6eec)[_0x2aa4('0x2b')](handleEntityNotFound(_0x21200f,null))[_0x2aa4('0x2b')](respondWithResult(_0x21200f,null))[_0x2aa4('0x4c')](handleError(_0x21200f,null));};exports[_0x2aa4('0x4d')]=function(_0x2b24fc,_0x2db0af){return db[_0x2aa4('0x30')][_0x2aa4('0x4d')](_0x2b24fc[_0x2aa4('0x4e')],{})['then'](respondWithResult(_0x2db0af,0xc9))[_0x2aa4('0x4c')](handleError(_0x2db0af,null));};exports[_0x2aa4('0x2a')]=function(_0x1a502d,_0x4ea272){if(_0x1a502d[_0x2aa4('0x4e')]['id']){delete _0x1a502d[_0x2aa4('0x4e')]['id'];}return db[_0x2aa4('0x30')]['find']({'where':{'id':_0x1a502d[_0x2aa4('0x4f')]['id']}})[_0x2aa4('0x2b')](handleEntityNotFound(_0x4ea272,null))[_0x2aa4('0x2b')](saveUpdates(_0x1a502d['body'],null))[_0x2aa4('0x2b')](respondWithResult(_0x4ea272,null))[_0x2aa4('0x4c')](handleError(_0x4ea272,null));};exports[_0x2aa4('0x2c')]=function(_0x40d57b,_0xa44061){return db[_0x2aa4('0x30')]['find']({'where':{'id':_0x40d57b[_0x2aa4('0x4f')]['id']}})[_0x2aa4('0x2b')](handleEntityNotFound(_0xa44061,null))[_0x2aa4('0x2b')](removeEntity(_0xa44061,null))['catch'](handleError(_0xa44061,null));};exports[_0x2aa4('0x50')]=function(_0x570592,_0x25eb6d){return db['FaxTransferReport'][_0x2aa4('0x50')]()[_0x2aa4('0x2b')](respondWithResult(_0x25eb6d,null))[_0x2aa4('0x4c')](handleError(_0x25eb6d,null));}; \ No newline at end of file +var _0x2b28=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3f4313,_0x35f7bc){var _0x18056f=function(_0x37e13c){while(--_0x37e13c){_0x3f4313['push'](_0x3f4313['shift']());}};_0x18056f(++_0x35f7bc);}(_0x2b28,0x121));var _0x82b2=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x2b28[_0x59bcb1];return _0x4a737f;};'use strict';var emlformat=require(_0x82b2('0x0'));var rimraf=require(_0x82b2('0x1'));var zipdir=require(_0x82b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82b2('0x3'));var moment=require(_0x82b2('0x4'));var BPromise=require(_0x82b2('0x5'));var Mustache=require(_0x82b2('0x6'));var util=require(_0x82b2('0x7'));var path=require('path');var sox=require(_0x82b2('0x8'));var csv=require(_0x82b2('0x9'));var ejs=require(_0x82b2('0xa'));var fs=require('fs');var fs_extra=require(_0x82b2('0xb'));var _=require(_0x82b2('0xc'));var squel=require('squel');var crypto=require(_0x82b2('0xd'));var jsforce=require(_0x82b2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x82b2('0x9'));var querystring=require(_0x82b2('0xf'));var Papa=require(_0x82b2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82b2('0x11'));var as=require(_0x82b2('0x12'));var hardwareService=require(_0x82b2('0x13'));var logger=require(_0x82b2('0x14'))(_0x82b2('0x15'));var utils=require(_0x82b2('0x16'));var config=require(_0x82b2('0x17'));var licenseUtil=require(_0x82b2('0x18'));var db=require(_0x82b2('0x19'))['db'];function respondWithStatusCode(_0x317ed3,_0x29c9ba){_0x29c9ba=_0x29c9ba||0xcc;return function(_0xcf6d9e){if(_0xcf6d9e){return _0x317ed3[_0x82b2('0x1a')](_0x29c9ba);}return _0x317ed3[_0x82b2('0x1b')](_0x29c9ba)[_0x82b2('0x1c')]();};}function respondWithResult(_0x42ff61,_0x2df339){_0x2df339=_0x2df339||0xc8;return function(_0xb34043){if(_0xb34043){return _0x42ff61['status'](_0x2df339)['json'](_0xb34043);}};}function respondWithFilteredResult(_0xe6d363,_0x3265fa){return function(_0x1f4f21){if(_0x1f4f21){var _0x221369=typeof _0x3265fa[_0x82b2('0x1d')]===_0x82b2('0x1e')&&typeof _0x3265fa['limit']===_0x82b2('0x1e');var _0x21d8cd=_0x1f4f21[_0x82b2('0x1f')];var _0x4d84b5=_0x221369?0x0:_0x3265fa[_0x82b2('0x1d')];var _0x1b567e=_0x221369?_0x1f4f21[_0x82b2('0x1f')]:_0x3265fa['offset']+_0x3265fa[_0x82b2('0x20')];var _0xcb6c96;if(_0x1b567e>=_0x21d8cd){_0x1b567e=_0x21d8cd;_0xcb6c96=0xc8;}else{_0xcb6c96=0xce;}_0xe6d363[_0x82b2('0x1b')](_0xcb6c96);return _0xe6d363['set'](_0x82b2('0x21'),_0x4d84b5+'-'+_0x1b567e+'/'+_0x21d8cd)['json'](_0x1f4f21);}return null;};}function patchUpdates(_0x54d3ae){return function(_0x4db542){try{jsonpatch[_0x82b2('0x22')](_0x4db542,_0x54d3ae,!![]);}catch(_0x42f829){return BPromise['reject'](_0x42f829);}return _0x4db542[_0x82b2('0x23')]();};}function saveUpdates(_0x3e61ba,_0x81d41a){return function(_0x290c58){if(_0x290c58){return _0x290c58[_0x82b2('0x24')](_0x3e61ba)[_0x82b2('0x25')](function(_0x37b55c){return _0x37b55c;});}return null;};}function removeEntity(_0x2ca94b,_0x3394cc){return function(_0x3954a5){if(_0x3954a5){return _0x3954a5[_0x82b2('0x26')]()[_0x82b2('0x25')](function(){_0x2ca94b['status'](0xcc)[_0x82b2('0x1c')]();});}};}function handleEntityNotFound(_0x4ee451,_0x5e935e){return function(_0xab6f73){if(!_0xab6f73){_0x4ee451[_0x82b2('0x1a')](0x194);}return _0xab6f73;};}function handleError(_0x14783d,_0x319a6e){_0x319a6e=_0x319a6e||0x1f4;return function(_0x17dc90){logger[_0x82b2('0x27')](_0x17dc90[_0x82b2('0x28')]);if(_0x17dc90[_0x82b2('0x29')]){delete _0x17dc90['name'];}_0x14783d[_0x82b2('0x1b')](_0x319a6e)[_0x82b2('0x2a')](_0x17dc90);};}exports['index']=function(_0x49376d,_0xca8ad3){var _0x221d45={},_0x53f55e={},_0x28dac4={'count':0x0,'rows':[]};var _0x4f6de9=_[_0x82b2('0x2b')](db[_0x82b2('0x2c')][_0x82b2('0x2d')],function(_0x3aeefb){return{'name':_0x3aeefb[_0x82b2('0x2e')],'type':_0x3aeefb[_0x82b2('0x2f')][_0x82b2('0x30')]};});_0x53f55e[_0x82b2('0x31')]=_[_0x82b2('0x2b')](_0x4f6de9,_0x82b2('0x29'));_0x53f55e[_0x82b2('0x32')]=_['keys'](_0x49376d['query']);_0x53f55e[_0x82b2('0x33')]=_[_0x82b2('0x34')](_0x53f55e[_0x82b2('0x31')],_0x53f55e['query']);_0x221d45[_0x82b2('0x35')]=_['intersection'](_0x53f55e[_0x82b2('0x31')],qs[_0x82b2('0x36')](_0x49376d[_0x82b2('0x32')][_0x82b2('0x36')]));_0x221d45['attributes']=_0x221d45['attributes'][_0x82b2('0x37')]?_0x221d45['attributes']:_0x53f55e['model'];if(!_0x49376d[_0x82b2('0x32')][_0x82b2('0x38')](_0x82b2('0x39'))){_0x221d45[_0x82b2('0x20')]=qs[_0x82b2('0x20')](_0x49376d['query'][_0x82b2('0x20')]);_0x221d45[_0x82b2('0x1d')]=qs['offset'](_0x49376d[_0x82b2('0x32')][_0x82b2('0x1d')]);}_0x221d45[_0x82b2('0x3a')]=qs['sort'](_0x49376d[_0x82b2('0x32')][_0x82b2('0x3b')]);_0x221d45[_0x82b2('0x3c')]=qs[_0x82b2('0x33')](_[_0x82b2('0x3d')](_0x49376d[_0x82b2('0x32')],_0x53f55e[_0x82b2('0x33')]),_0x4f6de9);if(_0x49376d['query'][_0x82b2('0x3e')]){_0x221d45[_0x82b2('0x3c')]=_[_0x82b2('0x3f')](_0x221d45[_0x82b2('0x3c')],{'$or':_[_0x82b2('0x2b')](_0x4f6de9,function(_0x2cd525){if(_0x2cd525[_0x82b2('0x2f')]!==_0x82b2('0x40')){var _0x4e1e1e={};_0x4e1e1e[_0x2cd525[_0x82b2('0x29')]]={'$like':'%'+_0x49376d['query'][_0x82b2('0x3e')]+'%'};return _0x4e1e1e;}})});}_0x221d45=_[_0x82b2('0x3f')]({},_0x221d45,_0x49376d[_0x82b2('0x41')]);var _0x5d1b61={'where':_0x221d45['where']};return db[_0x82b2('0x2c')][_0x82b2('0x1f')](_0x5d1b61)[_0x82b2('0x25')](function(_0x5cc070){_0x28dac4[_0x82b2('0x1f')]=_0x5cc070;if(_0x49376d[_0x82b2('0x32')][_0x82b2('0x42')]){_0x221d45[_0x82b2('0x43')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x82b2('0x44')](_0x221d45);})['then'](function(_0x3603f8){_0x28dac4[_0x82b2('0x45')]=_0x3603f8;return _0x28dac4;})[_0x82b2('0x25')](respondWithFilteredResult(_0xca8ad3,_0x221d45))[_0x82b2('0x46')](handleError(_0xca8ad3,null));};exports[_0x82b2('0x47')]=function(_0x13130e,_0x3499e7){var _0x1bfde0={'raw':!![],'where':{'id':_0x13130e['params']['id']}},_0x4d973a={};_0x4d973a[_0x82b2('0x31')]=_[_0x82b2('0x48')](db['FaxTransferReport'][_0x82b2('0x2d')]);_0x4d973a[_0x82b2('0x32')]=_[_0x82b2('0x48')](_0x13130e[_0x82b2('0x32')]);_0x4d973a[_0x82b2('0x33')]=_[_0x82b2('0x34')](_0x4d973a['model'],_0x4d973a['query']);_0x1bfde0[_0x82b2('0x35')]=_[_0x82b2('0x34')](_0x4d973a[_0x82b2('0x31')],qs['fields'](_0x13130e[_0x82b2('0x32')]['fields']));_0x1bfde0[_0x82b2('0x35')]=_0x1bfde0[_0x82b2('0x35')]['length']?_0x1bfde0[_0x82b2('0x35')]:_0x4d973a[_0x82b2('0x31')];if(_0x13130e[_0x82b2('0x32')]['includeAll']){_0x1bfde0[_0x82b2('0x43')]=[{'all':!![]}];}_0x1bfde0=_[_0x82b2('0x3f')]({},_0x1bfde0,_0x13130e[_0x82b2('0x41')]);return db[_0x82b2('0x2c')][_0x82b2('0x49')](_0x1bfde0)[_0x82b2('0x25')](handleEntityNotFound(_0x3499e7,null))[_0x82b2('0x25')](respondWithResult(_0x3499e7,null))['catch'](handleError(_0x3499e7,null));};exports[_0x82b2('0x4a')]=function(_0x59a57a,_0x3e02cb){return db[_0x82b2('0x2c')][_0x82b2('0x4a')](_0x59a57a[_0x82b2('0x4b')],{})[_0x82b2('0x25')](respondWithResult(_0x3e02cb,0xc9))[_0x82b2('0x46')](handleError(_0x3e02cb,null));};exports[_0x82b2('0x24')]=function(_0x67786e,_0x37cafc){if(_0x67786e[_0x82b2('0x4b')]['id']){delete _0x67786e[_0x82b2('0x4b')]['id'];}return db['FaxTransferReport'][_0x82b2('0x49')]({'where':{'id':_0x67786e['params']['id']}})[_0x82b2('0x25')](handleEntityNotFound(_0x37cafc,null))['then'](saveUpdates(_0x67786e[_0x82b2('0x4b')],null))['then'](respondWithResult(_0x37cafc,null))[_0x82b2('0x46')](handleError(_0x37cafc,null));};exports[_0x82b2('0x26')]=function(_0x31418e,_0x46b46e){return db[_0x82b2('0x2c')][_0x82b2('0x49')]({'where':{'id':_0x31418e[_0x82b2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46b46e,null))[_0x82b2('0x25')](removeEntity(_0x46b46e,null))['catch'](handleError(_0x46b46e,null));};exports[_0x82b2('0x4d')]=function(_0x45cca4,_0x1d5eb8){return db['FaxTransferReport'][_0x82b2('0x4d')]()['then'](respondWithResult(_0x1d5eb8,null))[_0x82b2('0x46')](handleError(_0x1d5eb8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index b03e009..40e232f 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 _0x757a=['report_fax_transfer','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x2e7e42,_0x937b7c){var _0x1bd5a0=function(_0x3b8ebe){while(--_0x3b8ebe){_0x2e7e42['push'](_0x2e7e42['shift']());}};_0x1bd5a0(++_0x937b7c);}(_0x757a,0xde));var _0xa757=function(_0x2bbff3,_0x3c80d4){_0x2bbff3=_0x2bbff3-0x0;var _0x3ec892=_0x757a[_0x2bbff3];return _0x3ec892;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('FaxTransferReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1903=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x1297c7,_0x1ff2a5){var _0x5c1916=function(_0x5a757c){while(--_0x5a757c){_0x1297c7['push'](_0x1297c7['shift']());}};_0x5c1916(++_0x1ff2a5);}(_0x1903,0x7a));var _0x3190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1903[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3190('0x0'));var logger=require(_0x3190('0x1'))(_0x3190('0x2'));var moment=require(_0x3190('0x3'));var BPromise=require(_0x3190('0x4'));var rp=require(_0x3190('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3190('0x6'));var attributes=require(_0x3190('0x7'));module['exports']=function(_0x4ba830,_0x231f63){return _0x4ba830[_0x3190('0x8')](_0x3190('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x3190('0xa'),'fields':[_0x3190('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 30cdfa6..16965a2 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 _0x115c=['FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','FaxTransferReport,\x20%s,\x20%s'];(function(_0x28666a,_0x3dc25d){var _0x19d752=function(_0x551e47){while(--_0x551e47){_0x28666a['push'](_0x28666a['shift']());}};_0x19d752(++_0x3dc25d);}(_0x115c,0x10c));var _0xc115=function(_0x4a0774,_0x29857){_0x4a0774=_0x4a0774-0x0;var _0x5ba23f=_0x115c[_0x4a0774];return _0x5ba23f;};'use strict';var _=require(_0xc115('0x0'));var util=require(_0xc115('0x1'));var moment=require('moment');var BPromise=require(_0xc115('0x2'));var rs=require(_0xc115('0x3'));var fs=require('fs');var Redis=require(_0xc115('0x4'));var db=require(_0xc115('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc115('0x6'))(_0xc115('0x7'));var config=require(_0xc115('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc115('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ee1c4,_0x2cb429,_0x48a696){return new BPromise(function(_0x1af72b,_0x9d5136){return client['request'](_0x3ee1c4,_0x48a696)[_0xc115('0xa')](function(_0xcf12ba){logger['info'](_0xc115('0xb'),_0x2cb429,'request\x20sent');logger['debug'](_0xc115('0xc'),_0x2cb429,_0xc115('0xd'),JSON[_0xc115('0xe')](_0xcf12ba));if(_0xcf12ba[_0xc115('0xf')]){if(_0xcf12ba[_0xc115('0xf')]['code']===0x1f4){logger[_0xc115('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x2cb429,_0xcf12ba[_0xc115('0xf')][_0xc115('0x10')]);return _0x9d5136(_0xcf12ba['error'][_0xc115('0x10')]);}logger[_0xc115('0xf')](_0xc115('0xb'),_0x2cb429,_0xcf12ba[_0xc115('0xf')][_0xc115('0x10')]);return _0x1af72b(_0xcf12ba[_0xc115('0xf')][_0xc115('0x10')]);}else{logger[_0xc115('0x11')](_0xc115('0xb'),_0x2cb429,_0xc115('0xd'));_0x1af72b(_0xcf12ba[_0xc115('0x12')][_0xc115('0x10')]);}})[_0xc115('0x13')](function(_0x22c487){logger[_0xc115('0xf')](_0xc115('0xb'),_0x2cb429,_0x22c487);_0x9d5136(_0x22c487);});});} \ No newline at end of file +var _0x1564=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x36ce5e,_0x5c68e2){var _0x3eb15d=function(_0x573b1c){while(--_0x573b1c){_0x36ce5e['push'](_0x36ce5e['shift']());}};_0x3eb15d(++_0x5c68e2);}(_0x1564,0x130));var _0x4156=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x1564[_0x450bf9];return _0x268350;};'use strict';var _=require(_0x4156('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4156('0x1'));var db=require(_0x4156('0x2'))['db'];var utils=require(_0x4156('0x3'));var logger=require(_0x4156('0x4'))(_0x4156('0x5'));var config=require(_0x4156('0x6'));var jayson=require(_0x4156('0x7'));var client=jayson[_0x4156('0x8')][_0x4156('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x545f53,_0x1b2ad2,_0x1cbf63){return new BPromise(function(_0x410696,_0x5f50fe){return client[_0x4156('0xa')](_0x545f53,_0x1cbf63)['then'](function(_0x4b207f){logger['info'](_0x4156('0xb'),_0x1b2ad2,_0x4156('0xc'));logger[_0x4156('0xd')](_0x4156('0xe'),_0x1b2ad2,'request\x20sent',JSON[_0x4156('0xf')](_0x4b207f));if(_0x4b207f[_0x4156('0x10')]){if(_0x4b207f['error'][_0x4156('0x11')]===0x1f4){logger['error'](_0x4156('0xb'),_0x1b2ad2,_0x4b207f[_0x4156('0x10')]['message']);return _0x5f50fe(_0x4b207f[_0x4156('0x10')][_0x4156('0x12')]);}logger['error'](_0x4156('0xb'),_0x1b2ad2,_0x4b207f[_0x4156('0x10')][_0x4156('0x12')]);return _0x410696(_0x4b207f[_0x4156('0x10')][_0x4156('0x12')]);}else{logger[_0x4156('0x13')](_0x4156('0xb'),_0x1b2ad2,_0x4156('0xc'));_0x410696(_0x4b207f[_0x4156('0x14')][_0x4156('0x12')]);}})[_0x4156('0x15')](function(_0x5b53b3){logger['error'](_0x4156('0xb'),_0x1b2ad2,_0x5b53b3);_0x5f50fe(_0x5b53b3);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 12db20e..0a7b13a 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 _0x02d5=['delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','create','update'];(function(_0x24f399,_0xec1e9){var _0x358c39=function(_0x2696d7){while(--_0x2696d7){_0x24f399['push'](_0x24f399['shift']());}};_0x358c39(++_0xec1e9);}(_0x02d5,0x134));var _0x502d=function(_0x42f247,_0x5bbeca){_0x42f247=_0x42f247-0x0;var _0x411317=_0x02d5[_0x42f247];return _0x411317;};'use strict';var multer=require('multer');var util=require(_0x502d('0x0'));var path=require('path');var timeout=require(_0x502d('0x1'));var express=require(_0x502d('0x2'));var router=express[_0x502d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x502d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x502d('0x5'));var controller=require('./faxTransferReport.controller');router[_0x502d('0x6')]('/',auth[_0x502d('0x7')](),controller[_0x502d('0x8')]);router[_0x502d('0x6')](_0x502d('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x502d('0x6')]('/:id',auth[_0x502d('0x7')](),controller['show']);router['post']('/',auth[_0x502d('0x7')](),controller[_0x502d('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x502d('0xb')]);router[_0x502d('0xc')](_0x502d('0xd'),auth['isAuthenticated'](),controller[_0x502d('0xe')]);module[_0x502d('0xf')]=router; \ No newline at end of file +var _0x1f38=['exports','multer','util','fs-extra','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x1f38,0x1ee));var _0x81f3=function(_0xc2869e,_0x105457){_0xc2869e=_0xc2869e-0x0;var _0x243be2=_0x1f38[_0xc2869e];return _0x243be2;};'use strict';var multer=require(_0x81f3('0x0'));var util=require(_0x81f3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x81f3('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x81f3('0x3'));router[_0x81f3('0x4')]('/',auth[_0x81f3('0x5')](),controller[_0x81f3('0x6')]);router['get'](_0x81f3('0x7'),auth[_0x81f3('0x5')](),controller[_0x81f3('0x8')]);router[_0x81f3('0x4')](_0x81f3('0x9'),auth[_0x81f3('0x5')](),controller[_0x81f3('0xa')]);router[_0x81f3('0xb')]('/',auth[_0x81f3('0x5')](),controller[_0x81f3('0xc')]);router[_0x81f3('0xd')](_0x81f3('0x9'),auth[_0x81f3('0x5')](),controller[_0x81f3('0xe')]);router['delete'](_0x81f3('0x9'),auth[_0x81f3('0x5')](),controller[_0x81f3('0xf')]);module[_0x81f3('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d11d14f..1ec6600 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 _0xe81d=['delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getFields','create','post','addConfiguration','update'];(function(_0x182d90,_0x1570cc){var _0x4872f0=function(_0x23a687){while(--_0x23a687){_0x182d90['push'](_0x182d90['shift']());}};_0x4872f0(++_0x1570cc);}(_0xe81d,0x14c));var _0xde81=function(_0x535e05,_0x19d276){_0x535e05=_0x535e05-0x0;var _0x1efe2f=_0xe81d[_0x535e05];return _0x1efe2f;};'use strict';var multer=require(_0xde81('0x0'));var util=require('util');var path=require(_0xde81('0x1'));var timeout=require(_0xde81('0x2'));var express=require(_0xde81('0x3'));var router=express['Router']();var fs_extra=require(_0xde81('0x4'));var auth=require(_0xde81('0x5'));var interaction=require(_0xde81('0x6'));var config=require(_0xde81('0x7'));var controller=require(_0xde81('0x8'));router[_0xde81('0x9')]('/',auth['isAuthenticated'](),controller[_0xde81('0xa')]);router[_0xde81('0x9')](_0xde81('0xb'),auth['isAuthenticated'](),controller[_0xde81('0xc')]);router['get'](_0xde81('0xd'),auth[_0xde81('0xe')](),controller['getConfigurations']);router[_0xde81('0x9')]('/:id/fields',auth[_0xde81('0xe')](),controller[_0xde81('0xf')]);router['post']('/',auth[_0xde81('0xe')](),controller[_0xde81('0x10')]);router[_0xde81('0x11')]('/:id/configurations',auth[_0xde81('0xe')](),controller[_0xde81('0x12')]);router['put']('/:id',auth[_0xde81('0xe')](),controller[_0xde81('0x13')]);router[_0xde81('0x14')](_0xde81('0xb'),auth[_0xde81('0xe')](),controller[_0xde81('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfaee=['addConfiguration','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations'];(function(_0x3630b4,_0x70d961){var _0x1301ee=function(_0x3e6175){while(--_0x3e6175){_0x3630b4['push'](_0x3630b4['shift']());}};_0x1301ee(++_0x70d961);}(_0xfaee,0x15d));var _0xefae=function(_0x38a62f,_0x26b533){_0x38a62f=_0x38a62f-0x0;var _0x1f734b=_0xfaee[_0x38a62f];return _0x1f734b;};'use strict';var multer=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var path=require('path');var timeout=require(_0xefae('0x2'));var express=require(_0xefae('0x3'));var router=express[_0xefae('0x4')]();var fs_extra=require(_0xefae('0x5'));var auth=require(_0xefae('0x6'));var interaction=require(_0xefae('0x7'));var config=require(_0xefae('0x8'));var controller=require(_0xefae('0x9'));router[_0xefae('0xa')]('/',auth[_0xefae('0xb')](),controller['index']);router[_0xefae('0xa')](_0xefae('0xc'),auth[_0xefae('0xb')](),controller[_0xefae('0xd')]);router[_0xefae('0xa')]('/:id/configurations',auth[_0xefae('0xb')](),controller[_0xefae('0xe')]);router[_0xefae('0xa')](_0xefae('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xefae('0x10')]('/',auth[_0xefae('0xb')](),controller[_0xefae('0x11')]);router[_0xefae('0x10')](_0xefae('0x12'),auth['isAuthenticated'](),controller[_0xefae('0x13')]);router[_0xefae('0x14')](_0xefae('0xc'),auth[_0xefae('0xb')](),controller['update']);router[_0xefae('0x15')](_0xefae('0xc'),auth[_0xefae('0xb')](),controller['destroy']);module[_0xefae('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5b08e20..3382604 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 _0xf37b=['integrationTab','newTab','STRING','ENUM','basic'];(function(_0x50312c,_0x128374){var _0x5aac79=function(_0x44e44f){while(--_0x44e44f){_0x50312c['push'](_0x50312c['shift']());}};_0x5aac79(++_0x128374);}(_0xf37b,0x110));var _0xbf37=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xf37b[_0x55821d];return _0x58ea8a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbf37('0x0')]},'description':{'type':Sequelize[_0xbf37('0x0')]},'username':{'type':Sequelize[_0xbf37('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xbf37('0x1')](_0xbf37('0x2')),'defaultValue':_0xbf37('0x2')},'password':{'type':Sequelize[_0xbf37('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xbf37('0x0')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xbf37('0x0')]},'serverUrl':{'type':Sequelize[_0xbf37('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xbf37('0x1')](_0xbf37('0x3'),_0xbf37('0x4')),'defaultValue':_0xbf37('0x3')}}; \ No newline at end of file +var _0xcffb=['basic','sequelize','exports','STRING','ENUM'];(function(_0x11528c,_0xcf3fd7){var _0x37a5c8=function(_0x246d8b){while(--_0x246d8b){_0x11528c['push'](_0x11528c['shift']());}};_0x37a5c8(++_0xcf3fd7);}(_0xcffb,0xf1));var _0xbcff=function(_0x537ac3,_0x1fe6c3){_0x537ac3=_0x537ac3-0x0;var _0x5a3647=_0xcffb[_0x537ac3];return _0x5a3647;};'use strict';var Sequelize=require(_0xbcff('0x0'));module[_0xbcff('0x1')]={'name':{'type':Sequelize[_0xbcff('0x2')]},'description':{'type':Sequelize[_0xbcff('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbcff('0x2')]},'authType':{'type':Sequelize[_0xbcff('0x3')](_0xbcff('0x4')),'defaultValue':_0xbcff('0x4')},'password':{'type':Sequelize[_0xbcff('0x2')]},'consumerKey':{'type':Sequelize[_0xbcff('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbcff('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbcff('0x3')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 978c0bf..136beb2 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 _0x7532=['attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','then','includeAll','findAll','rows','show','keys','intersection','include','create','catch','body','find','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','username','password','consumerKey','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','toString','concat','_embedded','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','apply','save','update','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','fields'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7532,0xb0));var _0x2753=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7532[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x2753('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2753('0x1'));var jsonpatch=require(_0x2753('0x2'));var rp=require(_0x2753('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2753('0x4'));var util=require(_0x2753('0x5'));var path=require('path');var sox=require(_0x2753('0x6'));var csv=require(_0x2753('0x7'));var ejs=require(_0x2753('0x8'));var fs=require('fs');var fs_extra=require(_0x2753('0x9'));var _=require(_0x2753('0xa'));var squel=require(_0x2753('0xb'));var crypto=require(_0x2753('0xc'));var jsforce=require(_0x2753('0xd'));var deskjs=require(_0x2753('0xe'));var toCsv=require(_0x2753('0x7'));var querystring=require(_0x2753('0xf'));var Papa=require('papaparse');var Redis=require(_0x2753('0x10'));var authService=require(_0x2753('0x11'));var qs=require(_0x2753('0x12'));var as=require(_0x2753('0x13'));var hardwareService=require(_0x2753('0x14'));var logger=require(_0x2753('0x15'))(_0x2753('0x16'));var utils=require(_0x2753('0x17'));var config=require(_0x2753('0x18'));var licenseUtil=require(_0x2753('0x19'));var db=require(_0x2753('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x36bb53,_0xe93625){_0xe93625=_0xe93625||0xcc;return function(_0x5d696a){if(_0x5d696a){return _0x36bb53[_0x2753('0x1b')](_0xe93625);}return _0x36bb53[_0x2753('0x1c')](_0xe93625)['end']();};}function respondWithResult(_0x40834f,_0x536649){_0x536649=_0x536649||0xc8;return function(_0x1221f1){if(_0x1221f1){return _0x40834f[_0x2753('0x1c')](_0x536649)[_0x2753('0x1d')](_0x1221f1);}};}function respondWithFilteredResult(_0x186ab1,_0x53ea43){return function(_0x4bfb33){if(_0x4bfb33){var _0x18d27c=typeof _0x53ea43[_0x2753('0x1e')]==='undefined'&&typeof _0x53ea43['limit']==='undefined';var _0x311b80=_0x4bfb33[_0x2753('0x1f')];var _0x313b0c=_0x18d27c?0x0:_0x53ea43[_0x2753('0x1e')];var _0x26f4a2=_0x18d27c?_0x4bfb33[_0x2753('0x1f')]:_0x53ea43[_0x2753('0x1e')]+_0x53ea43['limit'];var _0x4234d1;if(_0x26f4a2>=_0x311b80){_0x26f4a2=_0x311b80;_0x4234d1=0xc8;}else{_0x4234d1=0xce;}_0x186ab1[_0x2753('0x1c')](_0x4234d1);return _0x186ab1[_0x2753('0x20')]('Content-Range',_0x313b0c+'-'+_0x26f4a2+'/'+_0x311b80)[_0x2753('0x1d')](_0x4bfb33);}return null;};}function patchUpdates(_0x4dc27e){return function(_0xd543ec){try{jsonpatch[_0x2753('0x21')](_0xd543ec,_0x4dc27e,!![]);}catch(_0x4579d5){return BPromise['reject'](_0x4579d5);}return _0xd543ec[_0x2753('0x22')]();};}function saveUpdates(_0x13e060,_0x4171fa){return function(_0x44ed27){if(_0x44ed27){return _0x44ed27[_0x2753('0x23')](_0x13e060)['then'](function(_0x48e2f7){return _0x48e2f7;});}return null;};}function removeEntity(_0x111bca,_0x3048b1){return function(_0x3e7293){if(_0x3e7293){return _0x3e7293[_0x2753('0x24')]()['then'](function(){_0x111bca[_0x2753('0x1c')](0xcc)[_0x2753('0x25')]();});}};}function handleEntityNotFound(_0xa838bc,_0x9a4fa1){return function(_0x1328a7){if(!_0x1328a7){_0xa838bc[_0x2753('0x1b')](0x194);}return _0x1328a7;};}function handleError(_0x2071dd,_0x9e7e17){_0x9e7e17=_0x9e7e17||0x1f4;return function(_0x49aa11){logger[_0x2753('0x26')](_0x49aa11[_0x2753('0x27')]);if(_0x49aa11[_0x2753('0x28')]){delete _0x49aa11[_0x2753('0x28')];}_0x2071dd[_0x2753('0x1c')](_0x9e7e17)[_0x2753('0x29')](_0x49aa11);};}exports[_0x2753('0x2a')]=function(_0xfab42a,_0x2d1155){var _0x4c9f49={},_0x37164e={},_0x2b9ddb={'count':0x0,'rows':[]};var _0x459c55=_['map'](db['DeskAccount'][_0x2753('0x2b')],function(_0x2f7a46){return{'name':_0x2f7a46[_0x2753('0x2c')],'type':_0x2f7a46[_0x2753('0x2d')][_0x2753('0x2e')]};});_0x37164e[_0x2753('0x2f')]=_[_0x2753('0x30')](_0x459c55,_0x2753('0x28'));_0x37164e[_0x2753('0x31')]=_['keys'](_0xfab42a[_0x2753('0x31')]);_0x37164e[_0x2753('0x32')]=_['intersection'](_0x37164e['model'],_0x37164e[_0x2753('0x31')]);_0x4c9f49['attributes']=_['intersection'](_0x37164e[_0x2753('0x2f')],qs[_0x2753('0x33')](_0xfab42a[_0x2753('0x31')][_0x2753('0x33')]));_0x4c9f49[_0x2753('0x34')]=_0x4c9f49[_0x2753('0x34')][_0x2753('0x35')]?_0x4c9f49['attributes']:_0x37164e[_0x2753('0x2f')];if(!_0xfab42a[_0x2753('0x31')][_0x2753('0x36')]('nolimit')){_0x4c9f49[_0x2753('0x37')]=qs['limit'](_0xfab42a[_0x2753('0x31')][_0x2753('0x37')]);_0x4c9f49['offset']=qs[_0x2753('0x1e')](_0xfab42a[_0x2753('0x31')][_0x2753('0x1e')]);}_0x4c9f49[_0x2753('0x38')]=qs[_0x2753('0x39')](_0xfab42a[_0x2753('0x31')][_0x2753('0x39')]);_0x4c9f49[_0x2753('0x3a')]=qs[_0x2753('0x32')](_[_0x2753('0x3b')](_0xfab42a['query'],_0x37164e[_0x2753('0x32')]),_0x459c55);if(_0xfab42a[_0x2753('0x31')][_0x2753('0x3c')]){_0x4c9f49[_0x2753('0x3a')]=_[_0x2753('0x3d')](_0x4c9f49[_0x2753('0x3a')],{'$or':_['map'](_0x459c55,function(_0x52b9eb){if(_0x52b9eb[_0x2753('0x2d')]!==_0x2753('0x3e')){var _0x344a45={};_0x344a45[_0x52b9eb[_0x2753('0x28')]]={'$like':'%'+_0xfab42a[_0x2753('0x31')][_0x2753('0x3c')]+'%'};return _0x344a45;}})});}_0x4c9f49=_[_0x2753('0x3d')]({},_0x4c9f49,_0xfab42a[_0x2753('0x3f')]);var _0x180b1e={'where':_0x4c9f49[_0x2753('0x3a')]};return db[_0x2753('0x40')][_0x2753('0x1f')](_0x180b1e)[_0x2753('0x41')](function(_0x41835b){_0x2b9ddb[_0x2753('0x1f')]=_0x41835b;if(_0xfab42a[_0x2753('0x31')][_0x2753('0x42')]){_0x4c9f49['include']=[{'all':!![]}];}return db[_0x2753('0x40')][_0x2753('0x43')](_0x4c9f49);})[_0x2753('0x41')](function(_0x4e209a){_0x2b9ddb[_0x2753('0x44')]=_0x4e209a;return _0x2b9ddb;})[_0x2753('0x41')](respondWithFilteredResult(_0x2d1155,_0x4c9f49))['catch'](handleError(_0x2d1155,null));};exports[_0x2753('0x45')]=function(_0x50721e,_0x547c07){var _0x5ea74d={'raw':![],'where':{'id':_0x50721e['params']['id']}},_0x3a4ec7={};_0x3a4ec7[_0x2753('0x2f')]=_[_0x2753('0x46')](db[_0x2753('0x40')][_0x2753('0x2b')]);_0x3a4ec7['query']=_[_0x2753('0x46')](_0x50721e[_0x2753('0x31')]);_0x3a4ec7[_0x2753('0x32')]=_[_0x2753('0x47')](_0x3a4ec7['model'],_0x3a4ec7[_0x2753('0x31')]);_0x5ea74d[_0x2753('0x34')]=_[_0x2753('0x47')](_0x3a4ec7[_0x2753('0x2f')],qs['fields'](_0x50721e[_0x2753('0x31')][_0x2753('0x33')]));_0x5ea74d[_0x2753('0x34')]=_0x5ea74d[_0x2753('0x34')]['length']?_0x5ea74d[_0x2753('0x34')]:_0x3a4ec7[_0x2753('0x2f')];if(_0x50721e['query'][_0x2753('0x42')]){_0x5ea74d[_0x2753('0x48')]=[{'all':!![]}];}_0x5ea74d=_[_0x2753('0x3d')]({},_0x5ea74d,_0x50721e[_0x2753('0x3f')]);return db[_0x2753('0x40')]['find'](_0x5ea74d)['then'](handleEntityNotFound(_0x547c07,null))[_0x2753('0x41')](respondWithResult(_0x547c07,null))['catch'](handleError(_0x547c07,null));};exports[_0x2753('0x49')]=function(_0x2e6a82,_0x5a725a){return db[_0x2753('0x40')][_0x2753('0x49')](_0x2e6a82['body'],{})['then'](respondWithResult(_0x5a725a,0xc9))[_0x2753('0x4a')](handleError(_0x5a725a,null));};exports[_0x2753('0x23')]=function(_0x1fada9,_0x5c92d6){if(_0x1fada9[_0x2753('0x4b')]['id']){delete _0x1fada9[_0x2753('0x4b')]['id'];}return db['DeskAccount'][_0x2753('0x4c')]({'where':{'id':_0x1fada9['params']['id']}})[_0x2753('0x41')](handleEntityNotFound(_0x5c92d6,null))[_0x2753('0x41')](saveUpdates(_0x1fada9[_0x2753('0x4b')],null))[_0x2753('0x41')](respondWithResult(_0x5c92d6,null))[_0x2753('0x4a')](handleError(_0x5c92d6,null));};exports['destroy']=function(_0x3fda84,_0x2ddb06){return db[_0x2753('0x40')][_0x2753('0x4c')]({'where':{'id':_0x3fda84[_0x2753('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2ddb06,null))['then'](removeEntity(_0x2ddb06,null))[_0x2753('0x4a')](handleError(_0x2ddb06,null));};exports[_0x2753('0x4e')]=function(_0x5353cc,_0x5a4fc5,_0x393759){var _0x2da2fd={};var _0x5b48b2={};var _0x24180a;var _0x24570a;return db['DeskAccount'][_0x2753('0x4f')]({'where':{'id':_0x5353cc[_0x2753('0x4d')]['id']}})[_0x2753('0x41')](handleEntityNotFound(_0x5a4fc5,null))['then'](function(_0x665364){if(_0x665364){_0x24180a=_0x665364;_0x5b48b2['model']=_['keys'](db['DeskConfiguration'][_0x2753('0x2b')]);_0x5b48b2[_0x2753('0x31')]=_[_0x2753('0x46')](_0x5353cc[_0x2753('0x31')]);_0x5b48b2[_0x2753('0x32')]=_[_0x2753('0x47')](_0x5b48b2[_0x2753('0x2f')],_0x5b48b2[_0x2753('0x31')]);_0x2da2fd[_0x2753('0x34')]=_['intersection'](_0x5b48b2[_0x2753('0x2f')],qs['fields'](_0x5353cc[_0x2753('0x31')][_0x2753('0x33')]));_0x2da2fd['attributes']=_0x2da2fd[_0x2753('0x34')][_0x2753('0x35')]?_0x2da2fd[_0x2753('0x34')]:_0x5b48b2[_0x2753('0x2f')];_0x2da2fd[_0x2753('0x38')]=qs[_0x2753('0x39')](_0x5353cc[_0x2753('0x31')][_0x2753('0x39')]);_0x2da2fd['where']=qs[_0x2753('0x32')](_[_0x2753('0x3b')](_0x5353cc['query'],_0x5b48b2[_0x2753('0x32')]));if(_0x5353cc[_0x2753('0x31')][_0x2753('0x3c')]){_0x2da2fd[_0x2753('0x3a')]=_[_0x2753('0x3d')](_0x2da2fd[_0x2753('0x3a')],{'$or':_['map'](_0x2da2fd['attributes'],function(_0x440acf){var _0xde3f5f={};_0xde3f5f[_0x440acf]={'$like':'%'+_0x5353cc[_0x2753('0x31')][_0x2753('0x3c')]+'%'};return _0xde3f5f;})});}_0x2da2fd=_[_0x2753('0x3d')]({},_0x2da2fd,_0x5353cc[_0x2753('0x3f')]);return _0x24180a[_0x2753('0x4e')](_0x2da2fd);}})[_0x2753('0x41')](function(_0x51acf9){if(_0x51acf9){_0x24570a=_0x51acf9['length'];if(!_0x5353cc['query'][_0x2753('0x36')](_0x2753('0x50'))){_0x2da2fd[_0x2753('0x37')]=qs[_0x2753('0x37')](_0x5353cc[_0x2753('0x31')][_0x2753('0x37')]);_0x2da2fd['offset']=qs[_0x2753('0x1e')](_0x5353cc[_0x2753('0x31')][_0x2753('0x1e')]);}return _0x24180a[_0x2753('0x4e')](_0x2da2fd);}})[_0x2753('0x41')](function(_0x177ea2){if(_0x177ea2){return _0x177ea2?{'count':_0x24570a,'rows':_0x177ea2}:null;}})['then'](respondWithResult(_0x5a4fc5,null))[_0x2753('0x4a')](handleError(_0x5a4fc5,null));};exports[_0x2753('0x51')]=function(_0x45e90c,_0x19ca13,_0x9e51d1){if(_0x45e90c[_0x2753('0x4b')]['id']){delete _0x45e90c['body']['id'];}return db[_0x2753('0x40')][_0x2753('0x4f')]({'where':{'id':_0x45e90c[_0x2753('0x4d')]['id']}})[_0x2753('0x41')](handleEntityNotFound(_0x19ca13,null))[_0x2753('0x41')](function(_0x477394){if(_0x477394){_0x45e90c['body'][_0x2753('0x52')]=_0x477394['id'];_0x45e90c[_0x2753('0x4b')][_0x2753('0x53')]=integrations[_0x2753('0x54')](_0x45e90c[_0x2753('0x4b')]['channel'],_0x45e90c['body'][_0x2753('0x2d')]);_0x45e90c[_0x2753('0x4b')][_0x2753('0x55')]=integrations[_0x2753('0x56')](_0x45e90c[_0x2753('0x4b')][_0x2753('0x57')],_0x45e90c['body']['type']);return db['DeskConfiguration']['create'](_0x45e90c[_0x2753('0x4b')],{'include':[{'model':db[_0x2753('0x58')],'as':_0x2753('0x53')},{'model':db['DeskField'],'as':_0x2753('0x55')}]});}return null;})[_0x2753('0x41')](respondWithResult(_0x19ca13,null))['catch'](handleError(_0x19ca13,null));};exports[_0x2753('0x59')]=function(_0x14814b,_0x4edd64,_0x466a38){var _0x416140=[{'name':_0x2753('0x5a'),'label':_0x2753('0x5a'),'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 _0x2be389='';return db[_0x2753('0x40')]['findOne']({'where':{'id':_0x14814b[_0x2753('0x4d')]['id']},'attributes':['id',_0x2753('0x5b'),'authType',_0x2753('0x5c'),_0x2753('0x5d'),_0x2753('0x5e'),'consumerSecret','token','tokenSecret']})[_0x2753('0x41')](handleEntityNotFound(_0x4edd64,null))[_0x2753('0x41')](function(_0x4a2842){if(_0x4a2842){_0x2be389=_0x4a2842[_0x2753('0x5b')];var _0x1d0e7e=_0x2be389[_0x2753('0x5f')](-0x1);if(_0x1d0e7e==='/'){_0x2be389=_0x2be389[_0x2753('0x60')](0x0,_0x2be389[_0x2753('0x61')](_0x1d0e7e));}var _0x45b963={'method':'GET','uri':util[_0x2753('0x62')](_0x2753('0x63'),_0x2be389),'headers':{'Content-Type':_0x2753('0x64'),'Accept':'application/json'},'json':!![]};if(_0x4a2842[_0x2753('0x65')]===_0x2753('0x66')){_0x45b963[_0x2753('0x67')][_0x2753('0x68')]=util['format'](_0x2753('0x69'),new Buffer(util['format']('%s:%s',_0x4a2842[_0x2753('0x5c')],_0x4a2842['password']))[_0x2753('0x6a')]('base64'));}return rp(_0x45b963)[_0x2753('0x41')](function(_0x1ef6fc){return _0x416140[_0x2753('0x6b')](_['map'](_0x1ef6fc[_0x2753('0x6c')]['entries'],function(_0x45c442){return{'id':_0x45c442[_0x2753('0x28')],'name':_0x45c442[_0x2753('0x28')],'type':_0x45c442[_0x2753('0x2d')],'active':_0x45c442['active'],'label':_0x45c442[_0x2753('0x6d')],'custom':!![]};}));});}})[_0x2753('0x41')](function(_0x218bf7){return{'count':_0x218bf7[_0x2753('0x35')],'rows':_0x218bf7};})[_0x2753('0x41')](respondWithResult(_0x4edd64,null))[_0x2753('0x4a')](function(_0x297084){var _0x1c06a9=_0x14814b['query']['test']?0x1f4:_0x297084[_0x2753('0x6e')]||0x1f4;logger[_0x2753('0x26')](_0x2753('0x6f'),_0x2753('0x59'),_0x1c06a9,JSON[_0x2753('0x70')](_0x297084));delete _0x297084[_0x2753('0x28')];if(_0x1c06a9===0x191){_0x1c06a9=0x190;}_0x4edd64[_0x2753('0x1c')](_0x1c06a9)[_0x2753('0x29')](_0x14814b[_0x2753('0x31')][_0x2753('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x297084['statusCode']}:_0x297084);});}; \ No newline at end of file +var _0x060a=['remoteUri','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','DeskField','Subjects','Descriptions','getFields','priority','authType','username','consumerSecret','token','tokenSecret'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x060a,0x108));var _0xa060=function(_0x595f92,_0x59c254){_0x595f92=_0x595f92-0x0;var _0x208574=_0x060a[_0x595f92];return _0x208574;};'use strict';var emlformat=require(_0xa060('0x0'));var rimraf=require(_0xa060('0x1'));var zipdir=require(_0xa060('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa060('0x3'));var moment=require(_0xa060('0x4'));var BPromise=require(_0xa060('0x5'));var Mustache=require(_0xa060('0x6'));var util=require(_0xa060('0x7'));var path=require(_0xa060('0x8'));var sox=require(_0xa060('0x9'));var csv=require('to-csv');var ejs=require(_0xa060('0xa'));var fs=require('fs');var fs_extra=require(_0xa060('0xb'));var _=require(_0xa060('0xc'));var squel=require(_0xa060('0xd'));var crypto=require(_0xa060('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa060('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa060('0x10'));var Papa=require(_0xa060('0x11'));var Redis=require('ioredis');var authService=require(_0xa060('0x12'));var qs=require(_0xa060('0x13'));var as=require(_0xa060('0x14'));var hardwareService=require(_0xa060('0x15'));var logger=require(_0xa060('0x16'))(_0xa060('0x17'));var utils=require(_0xa060('0x18'));var config=require(_0xa060('0x19'));var licenseUtil=require(_0xa060('0x1a'));var db=require(_0xa060('0x1b'))['db'];var integrations=require(_0xa060('0x1c'));function respondWithStatusCode(_0x451287,_0x3964b5){_0x3964b5=_0x3964b5||0xcc;return function(_0x1d2291){if(_0x1d2291){return _0x451287[_0xa060('0x1d')](_0x3964b5);}return _0x451287['status'](_0x3964b5)[_0xa060('0x1e')]();};}function respondWithResult(_0x211f14,_0x53f9d0){_0x53f9d0=_0x53f9d0||0xc8;return function(_0x227242){if(_0x227242){return _0x211f14[_0xa060('0x1f')](_0x53f9d0)['json'](_0x227242);}};}function respondWithFilteredResult(_0x4c23a8,_0x5f77d7){return function(_0x17ee07){if(_0x17ee07){var _0x186e6f=typeof _0x5f77d7['offset']===_0xa060('0x20')&&typeof _0x5f77d7['limit']==='undefined';var _0x1e0dc6=_0x17ee07[_0xa060('0x21')];var _0x3b7962=_0x186e6f?0x0:_0x5f77d7[_0xa060('0x22')];var _0x46c53a=_0x186e6f?_0x17ee07[_0xa060('0x21')]:_0x5f77d7['offset']+_0x5f77d7['limit'];var _0x36e7e5;if(_0x46c53a>=_0x1e0dc6){_0x46c53a=_0x1e0dc6;_0x36e7e5=0xc8;}else{_0x36e7e5=0xce;}_0x4c23a8[_0xa060('0x1f')](_0x36e7e5);return _0x4c23a8[_0xa060('0x23')](_0xa060('0x24'),_0x3b7962+'-'+_0x46c53a+'/'+_0x1e0dc6)[_0xa060('0x25')](_0x17ee07);}return null;};}function patchUpdates(_0x2fa0dd){return function(_0x3ad05c){try{jsonpatch[_0xa060('0x26')](_0x3ad05c,_0x2fa0dd,!![]);}catch(_0x30d8c3){return BPromise[_0xa060('0x27')](_0x30d8c3);}return _0x3ad05c[_0xa060('0x28')]();};}function saveUpdates(_0x2f0469,_0x4285c0){return function(_0x341ecc){if(_0x341ecc){return _0x341ecc['update'](_0x2f0469)[_0xa060('0x29')](function(_0x183a80){return _0x183a80;});}return null;};}function removeEntity(_0x1df055,_0x33926e){return function(_0x123a75){if(_0x123a75){return _0x123a75[_0xa060('0x2a')]()[_0xa060('0x29')](function(){_0x1df055[_0xa060('0x1f')](0xcc)[_0xa060('0x1e')]();});}};}function handleEntityNotFound(_0x29103d,_0x1167d9){return function(_0x2a2e31){if(!_0x2a2e31){_0x29103d['sendStatus'](0x194);}return _0x2a2e31;};}function handleError(_0x1fa457,_0x1c983a){_0x1c983a=_0x1c983a||0x1f4;return function(_0x212f31){logger[_0xa060('0x2b')](_0x212f31[_0xa060('0x2c')]);if(_0x212f31[_0xa060('0x2d')]){delete _0x212f31[_0xa060('0x2d')];}_0x1fa457[_0xa060('0x1f')](_0x1c983a)[_0xa060('0x2e')](_0x212f31);};}exports[_0xa060('0x2f')]=function(_0x2f644e,_0x43e876){var _0x188b54={},_0x4d063a={},_0x30e075={'count':0x0,'rows':[]};var _0x5c7ebe=_[_0xa060('0x30')](db['DeskAccount'][_0xa060('0x31')],function(_0x8da4c7){return{'name':_0x8da4c7[_0xa060('0x32')],'type':_0x8da4c7[_0xa060('0x33')]['key']};});_0x4d063a[_0xa060('0x34')]=_[_0xa060('0x30')](_0x5c7ebe,_0xa060('0x2d'));_0x4d063a[_0xa060('0x35')]=_[_0xa060('0x36')](_0x2f644e[_0xa060('0x35')]);_0x4d063a[_0xa060('0x37')]=_[_0xa060('0x38')](_0x4d063a[_0xa060('0x34')],_0x4d063a[_0xa060('0x35')]);_0x188b54['attributes']=_[_0xa060('0x38')](_0x4d063a[_0xa060('0x34')],qs[_0xa060('0x39')](_0x2f644e[_0xa060('0x35')]['fields']));_0x188b54[_0xa060('0x3a')]=_0x188b54[_0xa060('0x3a')][_0xa060('0x3b')]?_0x188b54[_0xa060('0x3a')]:_0x4d063a[_0xa060('0x34')];if(!_0x2f644e[_0xa060('0x35')][_0xa060('0x3c')](_0xa060('0x3d'))){_0x188b54[_0xa060('0x3e')]=qs[_0xa060('0x3e')](_0x2f644e[_0xa060('0x35')][_0xa060('0x3e')]);_0x188b54[_0xa060('0x22')]=qs[_0xa060('0x22')](_0x2f644e['query']['offset']);}_0x188b54[_0xa060('0x3f')]=qs[_0xa060('0x40')](_0x2f644e[_0xa060('0x35')]['sort']);_0x188b54[_0xa060('0x41')]=qs[_0xa060('0x37')](_[_0xa060('0x42')](_0x2f644e[_0xa060('0x35')],_0x4d063a[_0xa060('0x37')]),_0x5c7ebe);if(_0x2f644e['query'][_0xa060('0x43')]){_0x188b54[_0xa060('0x41')]=_[_0xa060('0x44')](_0x188b54[_0xa060('0x41')],{'$or':_[_0xa060('0x30')](_0x5c7ebe,function(_0x553c00){if(_0x553c00[_0xa060('0x33')]!==_0xa060('0x45')){var _0x539aa1={};_0x539aa1[_0x553c00[_0xa060('0x2d')]]={'$like':'%'+_0x2f644e['query'][_0xa060('0x43')]+'%'};return _0x539aa1;}})});}_0x188b54=_[_0xa060('0x44')]({},_0x188b54,_0x2f644e[_0xa060('0x46')]);var _0x2cdfd1={'where':_0x188b54['where']};return db[_0xa060('0x47')][_0xa060('0x21')](_0x2cdfd1)['then'](function(_0x22ae16){_0x30e075[_0xa060('0x21')]=_0x22ae16;if(_0x2f644e[_0xa060('0x35')][_0xa060('0x48')]){_0x188b54[_0xa060('0x49')]=[{'all':!![]}];}return db[_0xa060('0x47')][_0xa060('0x4a')](_0x188b54);})[_0xa060('0x29')](function(_0x1f34df){_0x30e075[_0xa060('0x4b')]=_0x1f34df;return _0x30e075;})[_0xa060('0x29')](respondWithFilteredResult(_0x43e876,_0x188b54))[_0xa060('0x4c')](handleError(_0x43e876,null));};exports[_0xa060('0x4d')]=function(_0x1f582a,_0x4d2b5e){var _0x43bfd6={'raw':![],'where':{'id':_0x1f582a[_0xa060('0x4e')]['id']}},_0x1f5fe7={};_0x1f5fe7[_0xa060('0x34')]=_['keys'](db[_0xa060('0x47')][_0xa060('0x31')]);_0x1f5fe7[_0xa060('0x35')]=_['keys'](_0x1f582a[_0xa060('0x35')]);_0x1f5fe7[_0xa060('0x37')]=_['intersection'](_0x1f5fe7[_0xa060('0x34')],_0x1f5fe7[_0xa060('0x35')]);_0x43bfd6['attributes']=_[_0xa060('0x38')](_0x1f5fe7[_0xa060('0x34')],qs[_0xa060('0x39')](_0x1f582a['query'][_0xa060('0x39')]));_0x43bfd6[_0xa060('0x3a')]=_0x43bfd6[_0xa060('0x3a')][_0xa060('0x3b')]?_0x43bfd6[_0xa060('0x3a')]:_0x1f5fe7['model'];if(_0x1f582a['query'][_0xa060('0x48')]){_0x43bfd6[_0xa060('0x49')]=[{'all':!![]}];}_0x43bfd6=_['merge']({},_0x43bfd6,_0x1f582a[_0xa060('0x46')]);return db['DeskAccount'][_0xa060('0x4f')](_0x43bfd6)['then'](handleEntityNotFound(_0x4d2b5e,null))[_0xa060('0x29')](respondWithResult(_0x4d2b5e,null))[_0xa060('0x4c')](handleError(_0x4d2b5e,null));};exports['create']=function(_0x2043a6,_0x2818a2){return db['DeskAccount'][_0xa060('0x50')](_0x2043a6[_0xa060('0x51')],{})[_0xa060('0x29')](respondWithResult(_0x2818a2,0xc9))['catch'](handleError(_0x2818a2,null));};exports['update']=function(_0x47ba34,_0xc90dd){if(_0x47ba34['body']['id']){delete _0x47ba34[_0xa060('0x51')]['id'];}return db[_0xa060('0x47')]['find']({'where':{'id':_0x47ba34[_0xa060('0x4e')]['id']}})[_0xa060('0x29')](handleEntityNotFound(_0xc90dd,null))[_0xa060('0x29')](saveUpdates(_0x47ba34[_0xa060('0x51')],null))[_0xa060('0x29')](respondWithResult(_0xc90dd,null))[_0xa060('0x4c')](handleError(_0xc90dd,null));};exports[_0xa060('0x2a')]=function(_0x525673,_0x4eaae6){return db[_0xa060('0x47')][_0xa060('0x4f')]({'where':{'id':_0x525673[_0xa060('0x4e')]['id']}})[_0xa060('0x29')](handleEntityNotFound(_0x4eaae6,null))[_0xa060('0x29')](removeEntity(_0x4eaae6,null))['catch'](handleError(_0x4eaae6,null));};exports['getConfigurations']=function(_0x3ced63,_0x53d783,_0x23fab0){var _0x318b71={};var _0x59be1b={};var _0x55937e;var _0xc303a6;return db[_0xa060('0x47')][_0xa060('0x52')]({'where':{'id':_0x3ced63[_0xa060('0x4e')]['id']}})[_0xa060('0x29')](handleEntityNotFound(_0x53d783,null))[_0xa060('0x29')](function(_0x2afee4){if(_0x2afee4){_0x55937e=_0x2afee4;_0x59be1b[_0xa060('0x34')]=_[_0xa060('0x36')](db[_0xa060('0x53')]['rawAttributes']);_0x59be1b[_0xa060('0x35')]=_['keys'](_0x3ced63[_0xa060('0x35')]);_0x59be1b[_0xa060('0x37')]=_[_0xa060('0x38')](_0x59be1b[_0xa060('0x34')],_0x59be1b['query']);_0x318b71[_0xa060('0x3a')]=_[_0xa060('0x38')](_0x59be1b[_0xa060('0x34')],qs[_0xa060('0x39')](_0x3ced63['query']['fields']));_0x318b71[_0xa060('0x3a')]=_0x318b71[_0xa060('0x3a')][_0xa060('0x3b')]?_0x318b71[_0xa060('0x3a')]:_0x59be1b[_0xa060('0x34')];_0x318b71[_0xa060('0x3f')]=qs[_0xa060('0x40')](_0x3ced63[_0xa060('0x35')][_0xa060('0x40')]);_0x318b71[_0xa060('0x41')]=qs[_0xa060('0x37')](_['pick'](_0x3ced63[_0xa060('0x35')],_0x59be1b[_0xa060('0x37')]));if(_0x3ced63['query'][_0xa060('0x43')]){_0x318b71[_0xa060('0x41')]=_[_0xa060('0x44')](_0x318b71[_0xa060('0x41')],{'$or':_[_0xa060('0x30')](_0x318b71[_0xa060('0x3a')],function(_0x58f56d){var _0x31bece={};_0x31bece[_0x58f56d]={'$like':'%'+_0x3ced63[_0xa060('0x35')][_0xa060('0x43')]+'%'};return _0x31bece;})});}_0x318b71=_['merge']({},_0x318b71,_0x3ced63[_0xa060('0x46')]);return _0x55937e[_0xa060('0x54')](_0x318b71);}})[_0xa060('0x29')](function(_0x1a1600){if(_0x1a1600){_0xc303a6=_0x1a1600['length'];if(!_0x3ced63[_0xa060('0x35')]['hasOwnProperty']('nolimit')){_0x318b71['limit']=qs[_0xa060('0x3e')](_0x3ced63['query'][_0xa060('0x3e')]);_0x318b71[_0xa060('0x22')]=qs[_0xa060('0x22')](_0x3ced63[_0xa060('0x35')][_0xa060('0x22')]);}return _0x55937e[_0xa060('0x54')](_0x318b71);}})[_0xa060('0x29')](function(_0xa01715){if(_0xa01715){return _0xa01715?{'count':_0xc303a6,'rows':_0xa01715}:null;}})['then'](respondWithResult(_0x53d783,null))[_0xa060('0x4c')](handleError(_0x53d783,null));};exports[_0xa060('0x55')]=function(_0x46ad4e,_0xb96e91,_0x776eb6){if(_0x46ad4e[_0xa060('0x51')]['id']){delete _0x46ad4e[_0xa060('0x51')]['id'];}return db['DeskAccount'][_0xa060('0x52')]({'where':{'id':_0x46ad4e['params']['id']}})[_0xa060('0x29')](handleEntityNotFound(_0xb96e91,null))['then'](function(_0x4beb97){if(_0x4beb97){_0x46ad4e[_0xa060('0x51')][_0xa060('0x56')]=_0x4beb97['id'];_0x46ad4e[_0xa060('0x51')]['Subjects']=integrations[_0xa060('0x57')](_0x46ad4e[_0xa060('0x51')][_0xa060('0x58')],_0x46ad4e[_0xa060('0x51')][_0xa060('0x33')]);_0x46ad4e[_0xa060('0x51')]['Descriptions']=integrations['getDescriptions'](_0x46ad4e[_0xa060('0x51')]['channel'],_0x46ad4e[_0xa060('0x51')][_0xa060('0x33')]);return db[_0xa060('0x53')][_0xa060('0x50')](_0x46ad4e[_0xa060('0x51')],{'include':[{'model':db[_0xa060('0x59')],'as':_0xa060('0x5a')},{'model':db[_0xa060('0x59')],'as':_0xa060('0x5b')}]});}return null;})[_0xa060('0x29')](respondWithResult(_0xb96e91,null))[_0xa060('0x4c')](handleError(_0xb96e91,null));};exports[_0xa060('0x5c')]=function(_0x243976,_0x21664e,_0x364270){var _0x23ef8a=[{'name':'priority','label':_0xa060('0x5d'),'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 _0x5a17fd='';return db[_0xa060('0x47')][_0xa060('0x52')]({'where':{'id':_0x243976[_0xa060('0x4e')]['id']},'attributes':['id','remoteUri',_0xa060('0x5e'),_0xa060('0x5f'),'password','consumerKey',_0xa060('0x60'),_0xa060('0x61'),_0xa060('0x62')]})['then'](handleEntityNotFound(_0x21664e,null))[_0xa060('0x29')](function(_0x979b51){if(_0x979b51){_0x5a17fd=_0x979b51[_0xa060('0x63')];var _0x30c610=_0x5a17fd[_0xa060('0x64')](-0x1);if(_0x30c610==='/'){_0x5a17fd=_0x5a17fd[_0xa060('0x65')](0x0,_0x5a17fd[_0xa060('0x66')](_0x30c610));}var _0x5be7d4={'method':_0xa060('0x67'),'uri':util[_0xa060('0x68')]('%s/custom_fields',_0x5a17fd),'headers':{'Content-Type':_0xa060('0x69'),'Accept':_0xa060('0x69')},'json':!![]};if(_0x979b51[_0xa060('0x5e')]===_0xa060('0x6a')){_0x5be7d4[_0xa060('0x6b')][_0xa060('0x6c')]=util[_0xa060('0x68')](_0xa060('0x6d'),new Buffer(util['format'](_0xa060('0x6e'),_0x979b51['username'],_0x979b51['password']))[_0xa060('0x6f')](_0xa060('0x70')));}return rp(_0x5be7d4)[_0xa060('0x29')](function(_0xd55d45){return _0x23ef8a['concat'](_[_0xa060('0x30')](_0xd55d45[_0xa060('0x71')][_0xa060('0x72')],function(_0x179597){return{'id':_0x179597['name'],'name':_0x179597[_0xa060('0x2d')],'type':_0x179597['type'],'active':_0x179597[_0xa060('0x73')],'label':_0x179597[_0xa060('0x74')],'custom':!![]};}));});}})[_0xa060('0x29')](function(_0x265441){return{'count':_0x265441[_0xa060('0x3b')],'rows':_0x265441};})[_0xa060('0x29')](respondWithResult(_0x21664e,null))['catch'](function(_0x363e42){var _0x4cf923=_0x243976[_0xa060('0x35')][_0xa060('0x75')]?0x1f4:_0x363e42['statusCode']||0x1f4;logger[_0xa060('0x2b')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4cf923,JSON[_0xa060('0x76')](_0x363e42));delete _0x363e42[_0xa060('0x2d')];if(_0x4cf923===0x191){_0x4cf923=0x190;}_0x21664e[_0xa060('0x1f')](_0x4cf923)['send'](_0x243976['query'][_0xa060('0x75')]?{'message':_0xa060('0x77'),'statusCode':_0x363e42[_0xa060('0x78')]}:_0x363e42);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 18d622f..d211a78 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 _0x48ac=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x35a2a7,_0x21fc07){var _0x36bb1e=function(_0x24e74a){while(--_0x24e74a){_0x35a2a7['push'](_0x35a2a7['shift']());}};_0x36bb1e(++_0x21fc07);}(_0x48ac,0x69));var _0xc48a=function(_0x33fe56,_0x4c3e0c){_0x33fe56=_0x33fe56-0x0;var _0x756976=_0x48ac[_0x33fe56];return _0x756976;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc48a('0x0'))(_0xc48a('0x1'));var moment=require(_0xc48a('0x2'));var BPromise=require(_0xc48a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc48a('0x4'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xc48a('0x5'));module[_0xc48a('0x6')]=function(_0x43c778,_0x57fa11){return _0x43c778[_0xc48a('0x7')](_0xc48a('0x8'),attributes,{'tableName':_0xc48a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b51=['request-promise','path','rimraf','../../config/environment','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x53d06a,_0x27f7fc){var _0x186990=function(_0x4d0687){while(--_0x4d0687){_0x53d06a['push'](_0x53d06a['shift']());}};_0x186990(++_0x27f7fc);}(_0x8b51,0xf2));var _0x18b5=function(_0x3ec620,_0x586bd0){_0x3ec620=_0x3ec620-0x0;var _0x1b0a10=_0x8b51[_0x3ec620];return _0x1b0a10;};'use strict';var _=require('lodash');var util=require(_0x18b5('0x0'));var logger=require(_0x18b5('0x1'))(_0x18b5('0x2'));var moment=require(_0x18b5('0x3'));var BPromise=require(_0x18b5('0x4'));var rp=require(_0x18b5('0x5'));var fs=require('fs');var path=require(_0x18b5('0x6'));var rimraf=require(_0x18b5('0x7'));var config=require(_0x18b5('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x18b5('0x9')]=function(_0xaf3e53,_0x2e3c66){return _0xaf3e53[_0x18b5('0xa')](_0x18b5('0xb'),attributes,{'tableName':_0x18b5('0xc'),'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 7811809..293aac0 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 _0x6395=['find','raw','ShowDeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','DeskAccount','findAll','options','where','limit','include','map','model','attributes','GetDeskAccount','catch'];(function(_0x1b7bd3,_0x273774){var _0x340a98=function(_0x35967f){while(--_0x35967f){_0x1b7bd3['push'](_0x1b7bd3['shift']());}};_0x340a98(++_0x273774);}(_0x6395,0x123));var _0x5639=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6395[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5639('0x0'));var util=require('util');var moment=require(_0x5639('0x1'));var BPromise=require(_0x5639('0x2'));var rs=require(_0x5639('0x3'));var fs=require('fs');var Redis=require(_0x5639('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5639('0x5'));var logger=require(_0x5639('0x6'))(_0x5639('0x7'));var config=require(_0x5639('0x8'));var jayson=require(_0x5639('0x9'));var client=jayson[_0x5639('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a53e,_0x1f7678,_0x145df8){return new BPromise(function(_0x3ad988,_0x5c6264){return client[_0x5639('0xb')](_0x31a53e,_0x145df8)[_0x5639('0xc')](function(_0x443ac7){logger[_0x5639('0xd')](_0x5639('0xe'),_0x1f7678,'request\x20sent');logger[_0x5639('0xf')](_0x5639('0x10'),_0x1f7678,_0x5639('0x11'),JSON[_0x5639('0x12')](_0x443ac7));if(_0x443ac7[_0x5639('0x13')]){if(_0x443ac7[_0x5639('0x13')]['code']===0x1f4){logger['error'](_0x5639('0xe'),_0x1f7678,_0x443ac7['error'][_0x5639('0x14')]);return _0x5c6264(_0x443ac7[_0x5639('0x13')][_0x5639('0x14')]);}logger[_0x5639('0x13')](_0x5639('0xe'),_0x1f7678,_0x443ac7[_0x5639('0x13')][_0x5639('0x14')]);return _0x3ad988(_0x443ac7[_0x5639('0x13')]['message']);}else{logger[_0x5639('0xd')](_0x5639('0xe'),_0x1f7678,'request\x20sent');_0x3ad988(_0x443ac7[_0x5639('0x15')]['message']);}})['catch'](function(_0x5bac6a){logger[_0x5639('0x13')](_0x5639('0xe'),_0x1f7678,_0x5bac6a);_0x5c6264(_0x5bac6a);});});}exports['GetDeskAccount']=function(_0x19a456){var _0x42f291=this;return new Promise(function(_0x408e74,_0x113dbd){return db[_0x5639('0x16')][_0x5639('0x17')]({'raw':_0x19a456[_0x5639('0x18')]?_0x19a456['options']['raw']===undefined?!![]:![]:!![],'where':_0x19a456[_0x5639('0x18')]?_0x19a456[_0x5639('0x18')][_0x5639('0x19')]||null:null,'attributes':_0x19a456[_0x5639('0x18')]?_0x19a456[_0x5639('0x18')]['attributes']||null:null,'limit':_0x19a456[_0x5639('0x18')]?_0x19a456[_0x5639('0x18')][_0x5639('0x1a')]||null:null,'include':_0x19a456[_0x5639('0x18')]?_0x19a456[_0x5639('0x18')][_0x5639('0x1b')]?_[_0x5639('0x1c')](_0x19a456[_0x5639('0x18')][_0x5639('0x1b')],function(_0x3f9c11){return{'model':db[_0x3f9c11[_0x5639('0x1d')]],'as':_0x3f9c11['as'],'attributes':_0x3f9c11[_0x5639('0x1e')],'include':_0x3f9c11['include']?_[_0x5639('0x1c')](_0x3f9c11[_0x5639('0x1b')],function(_0xc2bc5e){return{'model':db[_0xc2bc5e[_0x5639('0x1d')]],'as':_0xc2bc5e['as'],'attributes':_0xc2bc5e[_0x5639('0x1e')],'include':_0xc2bc5e[_0x5639('0x1b')]?_['map'](_0xc2bc5e[_0x5639('0x1b')],function(_0x81203b){return{'model':db[_0x81203b[_0x5639('0x1d')]],'as':_0x81203b['as'],'attributes':_0x81203b[_0x5639('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5639('0xc')](function(_0x19778d){logger[_0x5639('0xd')](_0x5639('0x1f'),_0x19a456);logger[_0x5639('0xf')](_0x5639('0x1f'),_0x19a456,JSON[_0x5639('0x12')](_0x19778d));_0x408e74(_0x19778d);})[_0x5639('0x20')](function(_0x24cf50){logger[_0x5639('0x13')](_0x5639('0x1f'),_0x24cf50[_0x5639('0x14')],_0x19a456);_0x113dbd(_0x42f291[_0x5639('0x13')](0x1f4,_0x24cf50[_0x5639('0x14')]));});});};exports['ShowDeskAccount']=function(_0x65a18d){var _0x26547b=this;return new Promise(function(_0x748f11,_0x7db082){return db[_0x5639('0x16')][_0x5639('0x21')]({'raw':_0x65a18d[_0x5639('0x18')]?_0x65a18d[_0x5639('0x18')][_0x5639('0x22')]===undefined?!![]:![]:!![],'where':_0x65a18d[_0x5639('0x18')]?_0x65a18d[_0x5639('0x18')][_0x5639('0x19')]||null:null,'attributes':_0x65a18d[_0x5639('0x18')]?_0x65a18d['options'][_0x5639('0x1e')]||null:null,'include':_0x65a18d[_0x5639('0x18')]?_0x65a18d['options'][_0x5639('0x1b')]?_[_0x5639('0x1c')](_0x65a18d[_0x5639('0x18')][_0x5639('0x1b')],function(_0x8be994){return{'model':db[_0x8be994[_0x5639('0x1d')]],'as':_0x8be994['as'],'attributes':_0x8be994[_0x5639('0x1e')],'include':_0x8be994['include']?_[_0x5639('0x1c')](_0x8be994[_0x5639('0x1b')],function(_0x451af9){return{'model':db[_0x451af9[_0x5639('0x1d')]],'as':_0x451af9['as'],'attributes':_0x451af9[_0x5639('0x1e')],'include':_0x451af9['include']?_[_0x5639('0x1c')](_0x451af9[_0x5639('0x1b')],function(_0x115b55){return{'model':db[_0x115b55[_0x5639('0x1d')]],'as':_0x115b55['as'],'attributes':_0x115b55[_0x5639('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5639('0xc')](function(_0x260853){logger[_0x5639('0xd')](_0x5639('0x23'),_0x65a18d);logger['debug'](_0x5639('0x23'),_0x65a18d,JSON[_0x5639('0x12')](_0x260853));_0x748f11(_0x260853);})['catch'](function(_0x46cffa){logger[_0x5639('0x13')]('ShowDeskAccount',_0x46cffa['message'],_0x65a18d);_0x7db082(_0x26547b[_0x5639('0x13')](0x1f4,_0x46cffa[_0x5639('0x14')]));});});}; \ No newline at end of file +var _0xfbf7=['where','limit','map','include','model','attributes','GetDeskAccount','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','raw'];(function(_0x1734e9,_0x14bfe2){var _0x22e31f=function(_0x3e7c1a){while(--_0x3e7c1a){_0x1734e9['push'](_0x1734e9['shift']());}};_0x22e31f(++_0x14bfe2);}(_0xfbf7,0xf3));var _0x7fbf=function(_0x38eec6,_0x5a7765){_0x38eec6=_0x38eec6-0x0;var _0x558819=_0xfbf7[_0x38eec6];return _0x558819;};'use strict';var _=require(_0x7fbf('0x0'));var util=require(_0x7fbf('0x1'));var moment=require(_0x7fbf('0x2'));var BPromise=require(_0x7fbf('0x3'));var rs=require(_0x7fbf('0x4'));var fs=require('fs');var Redis=require(_0x7fbf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fbf('0x6'));var logger=require(_0x7fbf('0x7'))(_0x7fbf('0x8'));var config=require(_0x7fbf('0x9'));var jayson=require(_0x7fbf('0xa'));var client=jayson[_0x7fbf('0xb')][_0x7fbf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3025c2,_0x520309,_0x18d71c){return new BPromise(function(_0x5991b5,_0x286e01){return client[_0x7fbf('0xd')](_0x3025c2,_0x18d71c)[_0x7fbf('0xe')](function(_0x1fced3){logger[_0x7fbf('0xf')](_0x7fbf('0x10'),_0x520309,_0x7fbf('0x11'));logger[_0x7fbf('0x12')](_0x7fbf('0x13'),_0x520309,_0x7fbf('0x11'),JSON[_0x7fbf('0x14')](_0x1fced3));if(_0x1fced3[_0x7fbf('0x15')]){if(_0x1fced3[_0x7fbf('0x15')][_0x7fbf('0x16')]===0x1f4){logger[_0x7fbf('0x15')](_0x7fbf('0x10'),_0x520309,_0x1fced3[_0x7fbf('0x15')][_0x7fbf('0x17')]);return _0x286e01(_0x1fced3[_0x7fbf('0x15')][_0x7fbf('0x17')]);}logger['error'](_0x7fbf('0x10'),_0x520309,_0x1fced3[_0x7fbf('0x15')][_0x7fbf('0x17')]);return _0x5991b5(_0x1fced3[_0x7fbf('0x15')][_0x7fbf('0x17')]);}else{logger['info'](_0x7fbf('0x10'),_0x520309,_0x7fbf('0x11'));_0x5991b5(_0x1fced3[_0x7fbf('0x18')]['message']);}})[_0x7fbf('0x19')](function(_0x4ffa7e){logger[_0x7fbf('0x15')](_0x7fbf('0x10'),_0x520309,_0x4ffa7e);_0x286e01(_0x4ffa7e);});});}exports['GetDeskAccount']=function(_0x3a678b){var _0x2f5ac9=this;return new Promise(function(_0x22cdc0,_0x58cf13){return db[_0x7fbf('0x1a')][_0x7fbf('0x1b')]({'raw':_0x3a678b[_0x7fbf('0x1c')]?_0x3a678b['options'][_0x7fbf('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a678b[_0x7fbf('0x1c')]?_0x3a678b[_0x7fbf('0x1c')][_0x7fbf('0x1e')]||null:null,'attributes':_0x3a678b[_0x7fbf('0x1c')]?_0x3a678b['options']['attributes']||null:null,'limit':_0x3a678b[_0x7fbf('0x1c')]?_0x3a678b[_0x7fbf('0x1c')][_0x7fbf('0x1f')]||null:null,'include':_0x3a678b[_0x7fbf('0x1c')]?_0x3a678b[_0x7fbf('0x1c')]['include']?_[_0x7fbf('0x20')](_0x3a678b['options'][_0x7fbf('0x21')],function(_0x37c7cc){return{'model':db[_0x37c7cc[_0x7fbf('0x22')]],'as':_0x37c7cc['as'],'attributes':_0x37c7cc[_0x7fbf('0x23')],'include':_0x37c7cc[_0x7fbf('0x21')]?_[_0x7fbf('0x20')](_0x37c7cc[_0x7fbf('0x21')],function(_0x10b18f){return{'model':db[_0x10b18f[_0x7fbf('0x22')]],'as':_0x10b18f['as'],'attributes':_0x10b18f[_0x7fbf('0x23')],'include':_0x10b18f[_0x7fbf('0x21')]?_[_0x7fbf('0x20')](_0x10b18f[_0x7fbf('0x21')],function(_0x5d62b9){return{'model':db[_0x5d62b9[_0x7fbf('0x22')]],'as':_0x5d62b9['as'],'attributes':_0x5d62b9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bc501){logger[_0x7fbf('0xf')]('GetDeskAccount',_0x3a678b);logger[_0x7fbf('0x12')]('GetDeskAccount',_0x3a678b,JSON[_0x7fbf('0x14')](_0x4bc501));_0x22cdc0(_0x4bc501);})['catch'](function(_0x2235e1){logger[_0x7fbf('0x15')](_0x7fbf('0x24'),_0x2235e1['message'],_0x3a678b);_0x58cf13(_0x2f5ac9[_0x7fbf('0x15')](0x1f4,_0x2235e1[_0x7fbf('0x17')]));});});};exports[_0x7fbf('0x25')]=function(_0x503d87){var _0x589975=this;return new Promise(function(_0x475732,_0x831225){return db[_0x7fbf('0x1a')][_0x7fbf('0x26')]({'raw':_0x503d87[_0x7fbf('0x1c')]?_0x503d87[_0x7fbf('0x1c')][_0x7fbf('0x1d')]===undefined?!![]:![]:!![],'where':_0x503d87[_0x7fbf('0x1c')]?_0x503d87[_0x7fbf('0x1c')][_0x7fbf('0x1e')]||null:null,'attributes':_0x503d87[_0x7fbf('0x1c')]?_0x503d87[_0x7fbf('0x1c')][_0x7fbf('0x23')]||null:null,'include':_0x503d87[_0x7fbf('0x1c')]?_0x503d87['options']['include']?_[_0x7fbf('0x20')](_0x503d87[_0x7fbf('0x1c')][_0x7fbf('0x21')],function(_0x21637b){return{'model':db[_0x21637b[_0x7fbf('0x22')]],'as':_0x21637b['as'],'attributes':_0x21637b[_0x7fbf('0x23')],'include':_0x21637b[_0x7fbf('0x21')]?_[_0x7fbf('0x20')](_0x21637b['include'],function(_0x55ba75){return{'model':db[_0x55ba75[_0x7fbf('0x22')]],'as':_0x55ba75['as'],'attributes':_0x55ba75[_0x7fbf('0x23')],'include':_0x55ba75[_0x7fbf('0x21')]?_[_0x7fbf('0x20')](_0x55ba75[_0x7fbf('0x21')],function(_0x205833){return{'model':db[_0x205833[_0x7fbf('0x22')]],'as':_0x205833['as'],'attributes':_0x205833[_0x7fbf('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7fbf('0xe')](function(_0x3ac939){logger['info'](_0x7fbf('0x25'),_0x503d87);logger[_0x7fbf('0x12')](_0x7fbf('0x25'),_0x503d87,JSON[_0x7fbf('0x14')](_0x3ac939));_0x475732(_0x3ac939);})[_0x7fbf('0x19')](function(_0x416bb0){logger[_0x7fbf('0x15')](_0x7fbf('0x25'),_0x416bb0[_0x7fbf('0x17')],_0x503d87);_0x831225(_0x589975[_0x7fbf('0x15')](0x1f4,_0x416bb0[_0x7fbf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5a73490..de1b6be 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(_0x1c58f2,_0x52f495){var _0x3959c0=function(_0x3d443e){while(--_0x3d443e){_0x1c58f2['push'](_0x1c58f2['shift']());}};_0x3959c0(++_0x52f495);}(_0x008c,0x188));var _0xc008=function(_0x42e887,_0xd64733){_0x42e887=_0x42e887-0x0;var _0x226761=_0x008c[_0x42e887];return _0x226761;};'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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20f7f5,_0x4f6102){var _0x4b07c5=function(_0x5b08c7){while(--_0x5b08c7){_0x20f7f5['push'](_0x20f7f5['shift']());}};_0x4b07c5(++_0x4f6102);}(_0x34e8,0x12c));var _0x834e=function(_0x3f2b1b,_0x57be55){_0x3f2b1b=_0x3f2b1b-0x0;var _0x2e9aad=_0x34e8[_0x3f2b1b];return _0x2e9aad;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a3d134c..6cc8a8d 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 _0x57d5=['exports','STRING','sequelize'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x57d5,0xda));var _0x557d=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x57d5[_0x420b24];return _0x4da552;};'use strict';var Sequelize=require(_0x557d('0x0'));module[_0x557d('0x1')]={'name':{'type':Sequelize[_0x557d('0x2')]},'description':{'type':Sequelize[_0x557d('0x2')]}}; \ No newline at end of file +var _0xc743=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc743,0x11b));var _0x3c74=function(_0x340cc6,_0x116869){_0x340cc6=_0x340cc6-0x0;var _0x54f3d9=_0xc743[_0x340cc6];return _0x54f3d9;};'use strict';var Sequelize=require(_0x3c74('0x0'));module[_0x3c74('0x1')]={'name':{'type':Sequelize[_0x3c74('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b59530c..467e052 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 _0x6df0=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','getFields','DeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query'];(function(_0x506620,_0x5da690){var _0x4c3e71=function(_0x3d849e){while(--_0x3d849e){_0x506620['push'](_0x506620['shift']());}};_0x4c3e71(++_0x5da690);}(_0x6df0,0xc5));var _0x06df=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x6df0[_0x4cbf20];return _0x582ae4;};'use strict';var emlformat=require(_0x06df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06df('0x1'));var jsonpatch=require(_0x06df('0x2'));var rp=require('request-promise');var moment=require(_0x06df('0x3'));var BPromise=require(_0x06df('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x06df('0x5'));var sox=require(_0x06df('0x6'));var csv=require(_0x06df('0x7'));var ejs=require(_0x06df('0x8'));var fs=require('fs');var fs_extra=require(_0x06df('0x9'));var _=require(_0x06df('0xa'));var squel=require(_0x06df('0xb'));var crypto=require(_0x06df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x06df('0xd'));var toCsv=require(_0x06df('0x7'));var querystring=require(_0x06df('0xe'));var Papa=require(_0x06df('0xf'));var Redis=require(_0x06df('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x06df('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06df('0x12'));var logger=require(_0x06df('0x13'))(_0x06df('0x14'));var utils=require(_0x06df('0x15'));var config=require(_0x06df('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x06df('0x17'))['db'];function respondWithStatusCode(_0x18770b,_0x5195b9){_0x5195b9=_0x5195b9||0xcc;return function(_0x4d2a8f){if(_0x4d2a8f){return _0x18770b['sendStatus'](_0x5195b9);}return _0x18770b[_0x06df('0x18')](_0x5195b9)['end']();};}function respondWithResult(_0x167d95,_0x3221c1){_0x3221c1=_0x3221c1||0xc8;return function(_0x4f34c0){if(_0x4f34c0){return _0x167d95[_0x06df('0x18')](_0x3221c1)[_0x06df('0x19')](_0x4f34c0);}};}function respondWithFilteredResult(_0x2375b2,_0x490127){return function(_0x58578f){if(_0x58578f){var _0x502965=typeof _0x490127[_0x06df('0x1a')]==='undefined'&&typeof _0x490127[_0x06df('0x1b')]===_0x06df('0x1c');var _0x5d6271=_0x58578f[_0x06df('0x1d')];var _0x387b0e=_0x502965?0x0:_0x490127[_0x06df('0x1a')];var _0x54d545=_0x502965?_0x58578f[_0x06df('0x1d')]:_0x490127[_0x06df('0x1a')]+_0x490127[_0x06df('0x1b')];var _0x32eeb8;if(_0x54d545>=_0x5d6271){_0x54d545=_0x5d6271;_0x32eeb8=0xc8;}else{_0x32eeb8=0xce;}_0x2375b2['status'](_0x32eeb8);return _0x2375b2[_0x06df('0x1e')](_0x06df('0x1f'),_0x387b0e+'-'+_0x54d545+'/'+_0x5d6271)[_0x06df('0x19')](_0x58578f);}return null;};}function patchUpdates(_0x1105be){return function(_0x178409){try{jsonpatch[_0x06df('0x20')](_0x178409,_0x1105be,!![]);}catch(_0x3b9e8f){return BPromise[_0x06df('0x21')](_0x3b9e8f);}return _0x178409[_0x06df('0x22')]();};}function saveUpdates(_0x3ba332,_0x4e0e15){return function(_0x17454d){if(_0x17454d){return _0x17454d[_0x06df('0x23')](_0x3ba332)['then'](function(_0x501fb4){return _0x501fb4;});}return null;};}function removeEntity(_0x14d925,_0x4f4234){return function(_0x30fc0b){if(_0x30fc0b){return _0x30fc0b[_0x06df('0x24')]()[_0x06df('0x25')](function(){_0x14d925[_0x06df('0x18')](0xcc)[_0x06df('0x26')]();});}};}function handleEntityNotFound(_0x515f30,_0x2c69f2){return function(_0x4cbfca){if(!_0x4cbfca){_0x515f30['sendStatus'](0x194);}return _0x4cbfca;};}function handleError(_0x19ae3b,_0x2e4742){_0x2e4742=_0x2e4742||0x1f4;return function(_0x2161b0){logger['error'](_0x2161b0['stack']);if(_0x2161b0[_0x06df('0x27')]){delete _0x2161b0['name'];}_0x19ae3b[_0x06df('0x18')](_0x2e4742)[_0x06df('0x28')](_0x2161b0);};}exports[_0x06df('0x29')]=function(_0x46e9c4,_0xc8a36c){var _0x173145={},_0x31ac9d={},_0x1a535f={'count':0x0,'rows':[]};var _0x2361d4=_[_0x06df('0x2a')](db[_0x06df('0x2b')][_0x06df('0x2c')],function(_0x5d1169){return{'name':_0x5d1169['fieldName'],'type':_0x5d1169[_0x06df('0x2d')][_0x06df('0x2e')]};});_0x31ac9d[_0x06df('0x2f')]=_[_0x06df('0x2a')](_0x2361d4,_0x06df('0x27'));_0x31ac9d[_0x06df('0x30')]=_[_0x06df('0x31')](_0x46e9c4[_0x06df('0x30')]);_0x31ac9d[_0x06df('0x32')]=_[_0x06df('0x33')](_0x31ac9d['model'],_0x31ac9d[_0x06df('0x30')]);_0x173145[_0x06df('0x34')]=_[_0x06df('0x33')](_0x31ac9d[_0x06df('0x2f')],qs[_0x06df('0x35')](_0x46e9c4['query'][_0x06df('0x35')]));_0x173145[_0x06df('0x34')]=_0x173145[_0x06df('0x34')][_0x06df('0x36')]?_0x173145[_0x06df('0x34')]:_0x31ac9d['model'];if(!_0x46e9c4[_0x06df('0x30')]['hasOwnProperty'](_0x06df('0x37'))){_0x173145[_0x06df('0x1b')]=qs['limit'](_0x46e9c4[_0x06df('0x30')][_0x06df('0x1b')]);_0x173145[_0x06df('0x1a')]=qs[_0x06df('0x1a')](_0x46e9c4['query']['offset']);}_0x173145[_0x06df('0x38')]=qs[_0x06df('0x39')](_0x46e9c4[_0x06df('0x30')][_0x06df('0x39')]);_0x173145[_0x06df('0x3a')]=qs[_0x06df('0x32')](_[_0x06df('0x3b')](_0x46e9c4[_0x06df('0x30')],_0x31ac9d[_0x06df('0x32')]),_0x2361d4);if(_0x46e9c4[_0x06df('0x30')][_0x06df('0x3c')]){_0x173145[_0x06df('0x3a')]=_[_0x06df('0x3d')](_0x173145['where'],{'$or':_[_0x06df('0x2a')](_0x2361d4,function(_0x5976c7){if(_0x5976c7[_0x06df('0x2d')]!==_0x06df('0x3e')){var _0x1bbfb2={};_0x1bbfb2[_0x5976c7[_0x06df('0x27')]]={'$like':'%'+_0x46e9c4['query'][_0x06df('0x3c')]+'%'};return _0x1bbfb2;}})});}_0x173145=_['merge']({},_0x173145,_0x46e9c4[_0x06df('0x3f')]);var _0x50a9c1={'where':_0x173145[_0x06df('0x3a')]};return db[_0x06df('0x2b')][_0x06df('0x1d')](_0x50a9c1)['then'](function(_0x21d775){_0x1a535f[_0x06df('0x1d')]=_0x21d775;if(_0x46e9c4[_0x06df('0x30')][_0x06df('0x40')]){_0x173145[_0x06df('0x41')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x173145);})[_0x06df('0x25')](function(_0x4e902b){_0x1a535f[_0x06df('0x42')]=_0x4e902b;return _0x1a535f;})[_0x06df('0x25')](respondWithFilteredResult(_0xc8a36c,_0x173145))[_0x06df('0x43')](handleError(_0xc8a36c,null));};exports[_0x06df('0x44')]=function(_0x3757c0,_0x837e1d){var _0x4638f5={'raw':![],'where':{'id':_0x3757c0[_0x06df('0x45')]['id']}},_0x426799={};_0x426799[_0x06df('0x2f')]=_[_0x06df('0x31')](db[_0x06df('0x2b')][_0x06df('0x2c')]);_0x426799[_0x06df('0x30')]=_[_0x06df('0x31')](_0x3757c0['query']);_0x426799[_0x06df('0x32')]=_[_0x06df('0x33')](_0x426799['model'],_0x426799[_0x06df('0x30')]);_0x4638f5[_0x06df('0x34')]=_['intersection'](_0x426799[_0x06df('0x2f')],qs[_0x06df('0x35')](_0x3757c0[_0x06df('0x30')]['fields']));_0x4638f5[_0x06df('0x34')]=_0x4638f5['attributes'][_0x06df('0x36')]?_0x4638f5['attributes']:_0x426799['model'];if(_0x3757c0[_0x06df('0x30')]['includeAll']){_0x4638f5['include']=[{'all':!![]}];}_0x4638f5=_[_0x06df('0x3d')]({},_0x4638f5,_0x3757c0[_0x06df('0x3f')]);return db[_0x06df('0x2b')]['find'](_0x4638f5)[_0x06df('0x25')](handleEntityNotFound(_0x837e1d,null))[_0x06df('0x25')](respondWithResult(_0x837e1d,null))[_0x06df('0x43')](handleError(_0x837e1d,null));};exports[_0x06df('0x46')]=function(_0x49e560,_0x4d95c1){return db[_0x06df('0x2b')]['create'](_0x49e560[_0x06df('0x47')],{})[_0x06df('0x25')](respondWithResult(_0x4d95c1,0xc9))[_0x06df('0x43')](handleError(_0x4d95c1,null));};exports[_0x06df('0x23')]=function(_0x411dba,_0x4afd16){if(_0x411dba[_0x06df('0x47')]['id']){delete _0x411dba[_0x06df('0x47')]['id'];}return db['DeskConfiguration'][_0x06df('0x48')]({'where':{'id':_0x411dba[_0x06df('0x45')]['id']}})[_0x06df('0x25')](handleEntityNotFound(_0x4afd16,null))[_0x06df('0x25')](saveUpdates(_0x411dba['body'],null))[_0x06df('0x25')](respondWithResult(_0x4afd16,null))[_0x06df('0x43')](handleError(_0x4afd16,null));};exports[_0x06df('0x24')]=function(_0x1ac6d0,_0x26a987){return db['DeskConfiguration']['find']({'where':{'id':_0x1ac6d0['params']['id']}})['then'](handleEntityNotFound(_0x26a987,null))[_0x06df('0x25')](removeEntity(_0x26a987,null))['catch'](handleError(_0x26a987,null));};exports[_0x06df('0x49')]=function(_0x5cd444,_0x15c0a2,_0x5a6707){var _0x65cb80={};var _0x34714d={};var _0x54e852;var _0x113629;return db[_0x06df('0x2b')]['findOne']({'where':{'id':_0x5cd444['params']['id']}})['then'](handleEntityNotFound(_0x15c0a2,null))['then'](function(_0x2493c7){if(_0x2493c7){_0x54e852=_0x2493c7;_0x34714d['model']=_['keys'](db[_0x06df('0x4a')]['rawAttributes']);_0x34714d[_0x06df('0x30')]=_[_0x06df('0x31')](_0x5cd444['query']);_0x34714d[_0x06df('0x32')]=_[_0x06df('0x33')](_0x34714d['model'],_0x34714d[_0x06df('0x30')]);_0x65cb80[_0x06df('0x34')]=_[_0x06df('0x33')](_0x34714d[_0x06df('0x2f')],qs['fields'](_0x5cd444[_0x06df('0x30')][_0x06df('0x35')]));_0x65cb80[_0x06df('0x34')]=_0x65cb80['attributes']['length']?_0x65cb80[_0x06df('0x34')]:_0x34714d['model'];_0x65cb80[_0x06df('0x38')]=qs[_0x06df('0x39')](_0x5cd444[_0x06df('0x30')][_0x06df('0x39')]);_0x65cb80[_0x06df('0x3a')]=qs[_0x06df('0x32')](_[_0x06df('0x3b')](_0x5cd444['query'],_0x34714d[_0x06df('0x32')]));if(_0x5cd444[_0x06df('0x30')]['filter']){_0x65cb80['where']=_[_0x06df('0x3d')](_0x65cb80[_0x06df('0x3a')],{'$or':_[_0x06df('0x2a')](_0x65cb80['attributes'],function(_0x2a5faa){var _0x147ca3={};_0x147ca3[_0x2a5faa]={'$like':'%'+_0x5cd444[_0x06df('0x30')][_0x06df('0x3c')]+'%'};return _0x147ca3;})});}_0x65cb80=_[_0x06df('0x3d')]({},_0x65cb80,_0x5cd444[_0x06df('0x3f')]);return _0x54e852['getFields'](_0x65cb80);}})[_0x06df('0x25')](function(_0x3c75fc){if(_0x3c75fc){_0x113629=_0x3c75fc[_0x06df('0x36')];if(!_0x5cd444[_0x06df('0x30')][_0x06df('0x4b')]('nolimit')){_0x65cb80[_0x06df('0x1b')]=qs['limit'](_0x5cd444['query'][_0x06df('0x1b')]);_0x65cb80[_0x06df('0x1a')]=qs['offset'](_0x5cd444[_0x06df('0x30')]['offset']);}return _0x54e852[_0x06df('0x49')](_0x65cb80);}})['then'](function(_0x225f89){if(_0x225f89){return _0x225f89?{'count':_0x113629,'rows':_0x225f89}:null;}})[_0x06df('0x25')](respondWithResult(_0x15c0a2,null))[_0x06df('0x43')](handleError(_0x15c0a2,null));};exports[_0x06df('0x4c')]=function(_0x59e5cd,_0x2cfa00,_0x1433e2){var _0x14c667={};var _0x5df659={};var _0x34f438;var _0x2d980a;return db[_0x06df('0x2b')][_0x06df('0x4d')]({'where':{'id':_0x59e5cd[_0x06df('0x45')]['id']}})[_0x06df('0x25')](handleEntityNotFound(_0x2cfa00,null))[_0x06df('0x25')](function(_0x1eb3d6){if(_0x1eb3d6){_0x34f438=_0x1eb3d6;_0x5df659[_0x06df('0x2f')]=_['keys'](db[_0x06df('0x4a')]['rawAttributes']);_0x5df659[_0x06df('0x30')]=_[_0x06df('0x31')](_0x59e5cd[_0x06df('0x30')]);_0x5df659[_0x06df('0x32')]=_[_0x06df('0x33')](_0x5df659[_0x06df('0x2f')],_0x5df659[_0x06df('0x30')]);_0x14c667['attributes']=_[_0x06df('0x33')](_0x5df659[_0x06df('0x2f')],qs[_0x06df('0x35')](_0x59e5cd['query'][_0x06df('0x35')]));_0x14c667[_0x06df('0x34')]=_0x14c667[_0x06df('0x34')]['length']?_0x14c667['attributes']:_0x5df659[_0x06df('0x2f')];_0x14c667['order']=qs[_0x06df('0x39')](_0x59e5cd[_0x06df('0x30')]['sort']);_0x14c667[_0x06df('0x3a')]=qs[_0x06df('0x32')](_['pick'](_0x59e5cd[_0x06df('0x30')],_0x5df659[_0x06df('0x32')]));if(_0x59e5cd['query']['filter']){_0x14c667[_0x06df('0x3a')]=_['merge'](_0x14c667[_0x06df('0x3a')],{'$or':_[_0x06df('0x2a')](_0x14c667[_0x06df('0x34')],function(_0x704e6c){var _0x34479b={};_0x34479b[_0x704e6c]={'$like':'%'+_0x59e5cd[_0x06df('0x30')][_0x06df('0x3c')]+'%'};return _0x34479b;})});}_0x14c667=_[_0x06df('0x3d')]({},_0x14c667,_0x59e5cd[_0x06df('0x3f')]);return _0x34f438[_0x06df('0x4c')](_0x14c667);}})['then'](function(_0x5d8f2b){if(_0x5d8f2b){_0x2d980a=_0x5d8f2b[_0x06df('0x36')];if(!_0x59e5cd[_0x06df('0x30')]['hasOwnProperty'](_0x06df('0x37'))){_0x14c667[_0x06df('0x1b')]=qs[_0x06df('0x1b')](_0x59e5cd['query'][_0x06df('0x1b')]);_0x14c667['offset']=qs[_0x06df('0x1a')](_0x59e5cd['query'][_0x06df('0x1a')]);}return _0x34f438['getSubjects'](_0x14c667);}})[_0x06df('0x25')](function(_0x1ef785){if(_0x1ef785){return _0x1ef785?{'count':_0x2d980a,'rows':_0x1ef785}:null;}})['then'](respondWithResult(_0x2cfa00,null))[_0x06df('0x43')](handleError(_0x2cfa00,null));};exports['getDescriptions']=function(_0x2e21fc,_0x124a3c,_0x293957){var _0xf2cb9f={};var _0x4d6c3b={};var _0x5b2e3a;var _0x24c4d3;return db[_0x06df('0x2b')]['findOne']({'where':{'id':_0x2e21fc['params']['id']}})[_0x06df('0x25')](handleEntityNotFound(_0x124a3c,null))[_0x06df('0x25')](function(_0x2b7adb){if(_0x2b7adb){_0x5b2e3a=_0x2b7adb;_0x4d6c3b['model']=_[_0x06df('0x31')](db[_0x06df('0x4a')][_0x06df('0x2c')]);_0x4d6c3b[_0x06df('0x30')]=_['keys'](_0x2e21fc[_0x06df('0x30')]);_0x4d6c3b[_0x06df('0x32')]=_[_0x06df('0x33')](_0x4d6c3b[_0x06df('0x2f')],_0x4d6c3b['query']);_0xf2cb9f['attributes']=_[_0x06df('0x33')](_0x4d6c3b['model'],qs['fields'](_0x2e21fc['query'][_0x06df('0x35')]));_0xf2cb9f['attributes']=_0xf2cb9f[_0x06df('0x34')][_0x06df('0x36')]?_0xf2cb9f[_0x06df('0x34')]:_0x4d6c3b[_0x06df('0x2f')];_0xf2cb9f[_0x06df('0x38')]=qs[_0x06df('0x39')](_0x2e21fc['query'][_0x06df('0x39')]);_0xf2cb9f[_0x06df('0x3a')]=qs[_0x06df('0x32')](_[_0x06df('0x3b')](_0x2e21fc[_0x06df('0x30')],_0x4d6c3b['filters']));if(_0x2e21fc['query'][_0x06df('0x3c')]){_0xf2cb9f[_0x06df('0x3a')]=_[_0x06df('0x3d')](_0xf2cb9f[_0x06df('0x3a')],{'$or':_[_0x06df('0x2a')](_0xf2cb9f['attributes'],function(_0x5d3b21){var _0xd8055={};_0xd8055[_0x5d3b21]={'$like':'%'+_0x2e21fc[_0x06df('0x30')][_0x06df('0x3c')]+'%'};return _0xd8055;})});}_0xf2cb9f=_['merge']({},_0xf2cb9f,_0x2e21fc[_0x06df('0x3f')]);return _0x5b2e3a[_0x06df('0x4e')](_0xf2cb9f);}})['then'](function(_0x39b97f){if(_0x39b97f){_0x24c4d3=_0x39b97f['length'];if(!_0x2e21fc[_0x06df('0x30')]['hasOwnProperty'](_0x06df('0x37'))){_0xf2cb9f[_0x06df('0x1b')]=qs[_0x06df('0x1b')](_0x2e21fc[_0x06df('0x30')]['limit']);_0xf2cb9f[_0x06df('0x1a')]=qs[_0x06df('0x1a')](_0x2e21fc[_0x06df('0x30')][_0x06df('0x1a')]);}return _0x5b2e3a[_0x06df('0x4e')](_0xf2cb9f);}})[_0x06df('0x25')](function(_0x1e5c7a){if(_0x1e5c7a){return _0x1e5c7a?{'count':_0x24c4d3,'rows':_0x1e5c7a}:null;}})[_0x06df('0x25')](respondWithResult(_0x124a3c,null))[_0x06df('0x43')](handleError(_0x124a3c,null));};exports[_0x06df('0x4f')]=function(_0xd5e486,_0x31044d,_0x304769){var _0x513ebd={};var _0x238f80={};var _0x4e24b5;var _0x4e604d;return db[_0x06df('0x2b')][_0x06df('0x4d')]({'where':{'id':_0xd5e486[_0x06df('0x45')]['id']}})[_0x06df('0x25')](handleEntityNotFound(_0x31044d,null))[_0x06df('0x25')](function(_0x35b711){if(_0x35b711){_0x4e24b5=_0x35b711;_0x238f80[_0x06df('0x2f')]=_['keys'](db[_0x06df('0x50')][_0x06df('0x2c')]);_0x238f80['query']=_[_0x06df('0x31')](_0xd5e486[_0x06df('0x30')]);_0x238f80[_0x06df('0x32')]=_[_0x06df('0x33')](_0x238f80[_0x06df('0x2f')],_0x238f80[_0x06df('0x30')]);_0x513ebd[_0x06df('0x34')]=_['intersection'](_0x238f80['model'],qs[_0x06df('0x35')](_0xd5e486[_0x06df('0x30')][_0x06df('0x35')]));_0x513ebd[_0x06df('0x34')]=_0x513ebd['attributes'][_0x06df('0x36')]?_0x513ebd[_0x06df('0x34')]:_0x238f80[_0x06df('0x2f')];_0x513ebd['order']=qs[_0x06df('0x39')](_0xd5e486[_0x06df('0x30')][_0x06df('0x39')]);_0x513ebd[_0x06df('0x3a')]=qs['filters'](_[_0x06df('0x3b')](_0xd5e486[_0x06df('0x30')],_0x238f80[_0x06df('0x32')]));if(_0xd5e486['query'][_0x06df('0x3c')]){_0x513ebd[_0x06df('0x3a')]=_[_0x06df('0x3d')](_0x513ebd[_0x06df('0x3a')],{'$or':_[_0x06df('0x2a')](_0x513ebd[_0x06df('0x34')],function(_0x4506ce){var _0x575d73={};_0x575d73[_0x4506ce]={'$like':'%'+_0xd5e486[_0x06df('0x30')][_0x06df('0x3c')]+'%'};return _0x575d73;})});}_0x513ebd=_['merge']({},_0x513ebd,_0xd5e486[_0x06df('0x3f')]);return _0x4e24b5['getTags'](_0x513ebd);}})[_0x06df('0x25')](function(_0x324516){if(_0x324516){_0x4e604d=_0x324516[_0x06df('0x36')];if(!_0xd5e486[_0x06df('0x30')][_0x06df('0x4b')](_0x06df('0x37'))){_0x513ebd[_0x06df('0x1b')]=qs[_0x06df('0x1b')](_0xd5e486[_0x06df('0x30')]['limit']);_0x513ebd[_0x06df('0x1a')]=qs[_0x06df('0x1a')](_0xd5e486['query']['offset']);}return _0x4e24b5['getTags'](_0x513ebd);}})[_0x06df('0x25')](function(_0x23424d){if(_0x23424d){return _0x23424d?{'count':_0x4e604d,'rows':_0x23424d}:null;}})[_0x06df('0x25')](respondWithResult(_0x31044d,null))[_0x06df('0x43')](handleError(_0x31044d,null));};exports[_0x06df('0x51')]=function(_0x598894,_0x1fbed7,_0x44dea8){if(_0x598894[_0x06df('0x47')]['id']){delete _0x598894[_0x06df('0x47')]['id'];}return db[_0x06df('0x2b')][_0x06df('0x4d')]({'where':{'id':_0x598894['params']['id']}})[_0x06df('0x25')](handleEntityNotFound(_0x1fbed7,null))[_0x06df('0x25')](function(_0x574e07){if(_0x574e07){return _0x574e07[_0x06df('0x51')](_0x598894['body']['ids']||[]);}return null;})[_0x06df('0x25')](respondWithResult(_0x1fbed7,null))[_0x06df('0x43')](handleError(_0x1fbed7,null));}; \ No newline at end of file +var _0xa1f6=['pick','filter','VIRTUAL','merge','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','apply','update','then','destroy','error','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x34665a,_0x3c5c40){var _0x56727f=function(_0x148955){while(--_0x148955){_0x34665a['push'](_0x34665a['shift']());}};_0x56727f(++_0x3c5c40);}(_0xa1f6,0x69));var _0x6a1f=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xa1f6[_0x53b133];return _0x5647e0;};'use strict';var emlformat=require(_0x6a1f('0x0'));var rimraf=require(_0x6a1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a1f('0x2'));var moment=require(_0x6a1f('0x3'));var BPromise=require(_0x6a1f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a1f('0x5'));var sox=require(_0x6a1f('0x6'));var csv=require(_0x6a1f('0x7'));var ejs=require(_0x6a1f('0x8'));var fs=require('fs');var fs_extra=require(_0x6a1f('0x9'));var _=require(_0x6a1f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a1f('0xb'));var deskjs=require(_0x6a1f('0xc'));var toCsv=require(_0x6a1f('0x7'));var querystring=require(_0x6a1f('0xd'));var Papa=require(_0x6a1f('0xe'));var Redis=require(_0x6a1f('0xf'));var authService=require(_0x6a1f('0x10'));var qs=require(_0x6a1f('0x11'));var as=require(_0x6a1f('0x12'));var hardwareService=require(_0x6a1f('0x13'));var logger=require('../../config/logger')(_0x6a1f('0x14'));var utils=require(_0x6a1f('0x15'));var config=require(_0x6a1f('0x16'));var licenseUtil=require(_0x6a1f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3582bb,_0x3307c1){_0x3307c1=_0x3307c1||0xcc;return function(_0x12f6ec){if(_0x12f6ec){return _0x3582bb[_0x6a1f('0x18')](_0x3307c1);}return _0x3582bb['status'](_0x3307c1)[_0x6a1f('0x19')]();};}function respondWithResult(_0x8cc136,_0x5b63cd){_0x5b63cd=_0x5b63cd||0xc8;return function(_0x4f06ad){if(_0x4f06ad){return _0x8cc136[_0x6a1f('0x1a')](_0x5b63cd)['json'](_0x4f06ad);}};}function respondWithFilteredResult(_0x4faadb,_0x1ef1e8){return function(_0x42a648){if(_0x42a648){var _0x1340d8=typeof _0x1ef1e8[_0x6a1f('0x1b')]===_0x6a1f('0x1c')&&typeof _0x1ef1e8[_0x6a1f('0x1d')]==='undefined';var _0x5c66a1=_0x42a648[_0x6a1f('0x1e')];var _0x536fc7=_0x1340d8?0x0:_0x1ef1e8[_0x6a1f('0x1b')];var _0x1aae9e=_0x1340d8?_0x42a648[_0x6a1f('0x1e')]:_0x1ef1e8[_0x6a1f('0x1b')]+_0x1ef1e8[_0x6a1f('0x1d')];var _0x17c4ec;if(_0x1aae9e>=_0x5c66a1){_0x1aae9e=_0x5c66a1;_0x17c4ec=0xc8;}else{_0x17c4ec=0xce;}_0x4faadb[_0x6a1f('0x1a')](_0x17c4ec);return _0x4faadb[_0x6a1f('0x1f')]('Content-Range',_0x536fc7+'-'+_0x1aae9e+'/'+_0x5c66a1)['json'](_0x42a648);}return null;};}function patchUpdates(_0x2b8244){return function(_0x5c7186){try{jsonpatch[_0x6a1f('0x20')](_0x5c7186,_0x2b8244,!![]);}catch(_0x5db167){return BPromise['reject'](_0x5db167);}return _0x5c7186['save']();};}function saveUpdates(_0x37da9a,_0x41816d){return function(_0x6a246d){if(_0x6a246d){return _0x6a246d[_0x6a1f('0x21')](_0x37da9a)[_0x6a1f('0x22')](function(_0x3a5eef){return _0x3a5eef;});}return null;};}function removeEntity(_0x37df98,_0x497087){return function(_0x1112a7){if(_0x1112a7){return _0x1112a7[_0x6a1f('0x23')]()[_0x6a1f('0x22')](function(){_0x37df98[_0x6a1f('0x1a')](0xcc)[_0x6a1f('0x19')]();});}};}function handleEntityNotFound(_0x59146b,_0x19fb3e){return function(_0x5525dd){if(!_0x5525dd){_0x59146b['sendStatus'](0x194);}return _0x5525dd;};}function handleError(_0x157205,_0x4cb22f){_0x4cb22f=_0x4cb22f||0x1f4;return function(_0x183d74){logger[_0x6a1f('0x24')](_0x183d74['stack']);if(_0x183d74[_0x6a1f('0x25')]){delete _0x183d74[_0x6a1f('0x25')];}_0x157205[_0x6a1f('0x1a')](_0x4cb22f)[_0x6a1f('0x26')](_0x183d74);};}exports['index']=function(_0x2062b4,_0x1fb44d){var _0x2699a0={},_0x21c5b6={},_0x24d104={'count':0x0,'rows':[]};var _0x4779ba=_[_0x6a1f('0x27')](db['DeskConfiguration'][_0x6a1f('0x28')],function(_0x31fe16){return{'name':_0x31fe16['fieldName'],'type':_0x31fe16[_0x6a1f('0x29')][_0x6a1f('0x2a')]};});_0x21c5b6[_0x6a1f('0x2b')]=_[_0x6a1f('0x27')](_0x4779ba,_0x6a1f('0x25'));_0x21c5b6['query']=_['keys'](_0x2062b4[_0x6a1f('0x2c')]);_0x21c5b6[_0x6a1f('0x2d')]=_[_0x6a1f('0x2e')](_0x21c5b6[_0x6a1f('0x2b')],_0x21c5b6[_0x6a1f('0x2c')]);_0x2699a0[_0x6a1f('0x2f')]=_[_0x6a1f('0x2e')](_0x21c5b6[_0x6a1f('0x2b')],qs[_0x6a1f('0x30')](_0x2062b4[_0x6a1f('0x2c')][_0x6a1f('0x30')]));_0x2699a0['attributes']=_0x2699a0[_0x6a1f('0x2f')][_0x6a1f('0x31')]?_0x2699a0[_0x6a1f('0x2f')]:_0x21c5b6['model'];if(!_0x2062b4[_0x6a1f('0x2c')][_0x6a1f('0x32')](_0x6a1f('0x33'))){_0x2699a0[_0x6a1f('0x1d')]=qs['limit'](_0x2062b4[_0x6a1f('0x2c')][_0x6a1f('0x1d')]);_0x2699a0[_0x6a1f('0x1b')]=qs[_0x6a1f('0x1b')](_0x2062b4['query']['offset']);}_0x2699a0[_0x6a1f('0x34')]=qs['sort'](_0x2062b4[_0x6a1f('0x2c')][_0x6a1f('0x35')]);_0x2699a0[_0x6a1f('0x36')]=qs[_0x6a1f('0x2d')](_[_0x6a1f('0x37')](_0x2062b4[_0x6a1f('0x2c')],_0x21c5b6[_0x6a1f('0x2d')]),_0x4779ba);if(_0x2062b4['query'][_0x6a1f('0x38')]){_0x2699a0[_0x6a1f('0x36')]=_['merge'](_0x2699a0['where'],{'$or':_[_0x6a1f('0x27')](_0x4779ba,function(_0x3dd056){if(_0x3dd056[_0x6a1f('0x29')]!==_0x6a1f('0x39')){var _0x47e4e8={};_0x47e4e8[_0x3dd056[_0x6a1f('0x25')]]={'$like':'%'+_0x2062b4['query'][_0x6a1f('0x38')]+'%'};return _0x47e4e8;}})});}_0x2699a0=_[_0x6a1f('0x3a')]({},_0x2699a0,_0x2062b4[_0x6a1f('0x3b')]);var _0x4c20d0={'where':_0x2699a0[_0x6a1f('0x36')]};return db[_0x6a1f('0x3c')][_0x6a1f('0x1e')](_0x4c20d0)[_0x6a1f('0x22')](function(_0x5a4fbb){_0x24d104[_0x6a1f('0x1e')]=_0x5a4fbb;if(_0x2062b4[_0x6a1f('0x2c')][_0x6a1f('0x3d')]){_0x2699a0[_0x6a1f('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x6a1f('0x3f')](_0x2699a0);})[_0x6a1f('0x22')](function(_0x2a7260){_0x24d104[_0x6a1f('0x40')]=_0x2a7260;return _0x24d104;})[_0x6a1f('0x22')](respondWithFilteredResult(_0x1fb44d,_0x2699a0))[_0x6a1f('0x41')](handleError(_0x1fb44d,null));};exports[_0x6a1f('0x42')]=function(_0x2d0454,_0x3b76d6){var _0x28f714={'raw':![],'where':{'id':_0x2d0454[_0x6a1f('0x43')]['id']}},_0x422b37={};_0x422b37[_0x6a1f('0x2b')]=_['keys'](db['DeskConfiguration'][_0x6a1f('0x28')]);_0x422b37['query']=_[_0x6a1f('0x44')](_0x2d0454['query']);_0x422b37[_0x6a1f('0x2d')]=_[_0x6a1f('0x2e')](_0x422b37[_0x6a1f('0x2b')],_0x422b37['query']);_0x28f714[_0x6a1f('0x2f')]=_[_0x6a1f('0x2e')](_0x422b37['model'],qs[_0x6a1f('0x30')](_0x2d0454[_0x6a1f('0x2c')][_0x6a1f('0x30')]));_0x28f714['attributes']=_0x28f714[_0x6a1f('0x2f')][_0x6a1f('0x31')]?_0x28f714[_0x6a1f('0x2f')]:_0x422b37[_0x6a1f('0x2b')];if(_0x2d0454[_0x6a1f('0x2c')][_0x6a1f('0x3d')]){_0x28f714['include']=[{'all':!![]}];}_0x28f714=_[_0x6a1f('0x3a')]({},_0x28f714,_0x2d0454['options']);return db[_0x6a1f('0x3c')][_0x6a1f('0x45')](_0x28f714)['then'](handleEntityNotFound(_0x3b76d6,null))['then'](respondWithResult(_0x3b76d6,null))[_0x6a1f('0x41')](handleError(_0x3b76d6,null));};exports[_0x6a1f('0x46')]=function(_0x2e31bc,_0x117192){return db['DeskConfiguration']['create'](_0x2e31bc[_0x6a1f('0x47')],{})[_0x6a1f('0x22')](respondWithResult(_0x117192,0xc9))[_0x6a1f('0x41')](handleError(_0x117192,null));};exports[_0x6a1f('0x21')]=function(_0x492655,_0x378143){if(_0x492655[_0x6a1f('0x47')]['id']){delete _0x492655[_0x6a1f('0x47')]['id'];}return db['DeskConfiguration'][_0x6a1f('0x45')]({'where':{'id':_0x492655[_0x6a1f('0x43')]['id']}})[_0x6a1f('0x22')](handleEntityNotFound(_0x378143,null))[_0x6a1f('0x22')](saveUpdates(_0x492655['body'],null))[_0x6a1f('0x22')](respondWithResult(_0x378143,null))[_0x6a1f('0x41')](handleError(_0x378143,null));};exports[_0x6a1f('0x23')]=function(_0x343b11,_0x27a8f1){return db['DeskConfiguration'][_0x6a1f('0x45')]({'where':{'id':_0x343b11['params']['id']}})[_0x6a1f('0x22')](handleEntityNotFound(_0x27a8f1,null))[_0x6a1f('0x22')](removeEntity(_0x27a8f1,null))[_0x6a1f('0x41')](handleError(_0x27a8f1,null));};exports[_0x6a1f('0x48')]=function(_0x5095ea,_0x3f3926,_0x2ba447){var _0x3727c1={};var _0x1ce258={};var _0x277221;var _0x28e57f;return db[_0x6a1f('0x3c')][_0x6a1f('0x49')]({'where':{'id':_0x5095ea['params']['id']}})[_0x6a1f('0x22')](handleEntityNotFound(_0x3f3926,null))['then'](function(_0x3e0dc8){if(_0x3e0dc8){_0x277221=_0x3e0dc8;_0x1ce258[_0x6a1f('0x2b')]=_['keys'](db[_0x6a1f('0x4a')][_0x6a1f('0x28')]);_0x1ce258['query']=_[_0x6a1f('0x44')](_0x5095ea['query']);_0x1ce258[_0x6a1f('0x2d')]=_[_0x6a1f('0x2e')](_0x1ce258[_0x6a1f('0x2b')],_0x1ce258[_0x6a1f('0x2c')]);_0x3727c1[_0x6a1f('0x2f')]=_[_0x6a1f('0x2e')](_0x1ce258[_0x6a1f('0x2b')],qs[_0x6a1f('0x30')](_0x5095ea[_0x6a1f('0x2c')]['fields']));_0x3727c1['attributes']=_0x3727c1[_0x6a1f('0x2f')]['length']?_0x3727c1[_0x6a1f('0x2f')]:_0x1ce258['model'];_0x3727c1['order']=qs[_0x6a1f('0x35')](_0x5095ea[_0x6a1f('0x2c')][_0x6a1f('0x35')]);_0x3727c1['where']=qs['filters'](_['pick'](_0x5095ea['query'],_0x1ce258[_0x6a1f('0x2d')]));if(_0x5095ea['query']['filter']){_0x3727c1['where']=_['merge'](_0x3727c1[_0x6a1f('0x36')],{'$or':_['map'](_0x3727c1[_0x6a1f('0x2f')],function(_0x150c5b){var _0x19c4a0={};_0x19c4a0[_0x150c5b]={'$like':'%'+_0x5095ea[_0x6a1f('0x2c')]['filter']+'%'};return _0x19c4a0;})});}_0x3727c1=_[_0x6a1f('0x3a')]({},_0x3727c1,_0x5095ea[_0x6a1f('0x3b')]);return _0x277221[_0x6a1f('0x48')](_0x3727c1);}})[_0x6a1f('0x22')](function(_0x53dd04){if(_0x53dd04){_0x28e57f=_0x53dd04[_0x6a1f('0x31')];if(!_0x5095ea[_0x6a1f('0x2c')]['hasOwnProperty'](_0x6a1f('0x33'))){_0x3727c1[_0x6a1f('0x1d')]=qs[_0x6a1f('0x1d')](_0x5095ea[_0x6a1f('0x2c')][_0x6a1f('0x1d')]);_0x3727c1[_0x6a1f('0x1b')]=qs[_0x6a1f('0x1b')](_0x5095ea[_0x6a1f('0x2c')][_0x6a1f('0x1b')]);}return _0x277221[_0x6a1f('0x48')](_0x3727c1);}})[_0x6a1f('0x22')](function(_0x32474d){if(_0x32474d){return _0x32474d?{'count':_0x28e57f,'rows':_0x32474d}:null;}})[_0x6a1f('0x22')](respondWithResult(_0x3f3926,null))[_0x6a1f('0x41')](handleError(_0x3f3926,null));};exports[_0x6a1f('0x4b')]=function(_0x5afd76,_0x3327e3,_0x141f09){var _0x3abfdc={};var _0x3601a8={};var _0x552cd1;var _0x1cb4b2;return db[_0x6a1f('0x3c')][_0x6a1f('0x49')]({'where':{'id':_0x5afd76['params']['id']}})[_0x6a1f('0x22')](handleEntityNotFound(_0x3327e3,null))[_0x6a1f('0x22')](function(_0x3e9dc5){if(_0x3e9dc5){_0x552cd1=_0x3e9dc5;_0x3601a8[_0x6a1f('0x2b')]=_[_0x6a1f('0x44')](db[_0x6a1f('0x4a')][_0x6a1f('0x28')]);_0x3601a8[_0x6a1f('0x2c')]=_['keys'](_0x5afd76['query']);_0x3601a8[_0x6a1f('0x2d')]=_[_0x6a1f('0x2e')](_0x3601a8['model'],_0x3601a8[_0x6a1f('0x2c')]);_0x3abfdc['attributes']=_[_0x6a1f('0x2e')](_0x3601a8['model'],qs[_0x6a1f('0x30')](_0x5afd76[_0x6a1f('0x2c')][_0x6a1f('0x30')]));_0x3abfdc['attributes']=_0x3abfdc[_0x6a1f('0x2f')][_0x6a1f('0x31')]?_0x3abfdc[_0x6a1f('0x2f')]:_0x3601a8[_0x6a1f('0x2b')];_0x3abfdc['order']=qs[_0x6a1f('0x35')](_0x5afd76['query']['sort']);_0x3abfdc[_0x6a1f('0x36')]=qs['filters'](_[_0x6a1f('0x37')](_0x5afd76['query'],_0x3601a8[_0x6a1f('0x2d')]));if(_0x5afd76['query']['filter']){_0x3abfdc['where']=_['merge'](_0x3abfdc[_0x6a1f('0x36')],{'$or':_[_0x6a1f('0x27')](_0x3abfdc[_0x6a1f('0x2f')],function(_0x3192cb){var _0x1c97e2={};_0x1c97e2[_0x3192cb]={'$like':'%'+_0x5afd76[_0x6a1f('0x2c')][_0x6a1f('0x38')]+'%'};return _0x1c97e2;})});}_0x3abfdc=_[_0x6a1f('0x3a')]({},_0x3abfdc,_0x5afd76[_0x6a1f('0x3b')]);return _0x552cd1[_0x6a1f('0x4b')](_0x3abfdc);}})[_0x6a1f('0x22')](function(_0x3a0182){if(_0x3a0182){_0x1cb4b2=_0x3a0182[_0x6a1f('0x31')];if(!_0x5afd76[_0x6a1f('0x2c')][_0x6a1f('0x32')]('nolimit')){_0x3abfdc['limit']=qs[_0x6a1f('0x1d')](_0x5afd76['query'][_0x6a1f('0x1d')]);_0x3abfdc[_0x6a1f('0x1b')]=qs[_0x6a1f('0x1b')](_0x5afd76[_0x6a1f('0x2c')][_0x6a1f('0x1b')]);}return _0x552cd1[_0x6a1f('0x4b')](_0x3abfdc);}})[_0x6a1f('0x22')](function(_0x89adfb){if(_0x89adfb){return _0x89adfb?{'count':_0x1cb4b2,'rows':_0x89adfb}:null;}})[_0x6a1f('0x22')](respondWithResult(_0x3327e3,null))[_0x6a1f('0x41')](handleError(_0x3327e3,null));};exports['getDescriptions']=function(_0x2df04e,_0x5f3da0,_0x2e7457){var _0x2b89d3={};var _0x50efe4={};var _0x53f603;var _0x4b10fa;return db[_0x6a1f('0x3c')][_0x6a1f('0x49')]({'where':{'id':_0x2df04e[_0x6a1f('0x43')]['id']}})[_0x6a1f('0x22')](handleEntityNotFound(_0x5f3da0,null))['then'](function(_0x4ba9d4){if(_0x4ba9d4){_0x53f603=_0x4ba9d4;_0x50efe4[_0x6a1f('0x2b')]=_[_0x6a1f('0x44')](db[_0x6a1f('0x4a')][_0x6a1f('0x28')]);_0x50efe4[_0x6a1f('0x2c')]=_[_0x6a1f('0x44')](_0x2df04e[_0x6a1f('0x2c')]);_0x50efe4['filters']=_['intersection'](_0x50efe4[_0x6a1f('0x2b')],_0x50efe4[_0x6a1f('0x2c')]);_0x2b89d3['attributes']=_['intersection'](_0x50efe4[_0x6a1f('0x2b')],qs['fields'](_0x2df04e['query'][_0x6a1f('0x30')]));_0x2b89d3[_0x6a1f('0x2f')]=_0x2b89d3['attributes'][_0x6a1f('0x31')]?_0x2b89d3[_0x6a1f('0x2f')]:_0x50efe4[_0x6a1f('0x2b')];_0x2b89d3[_0x6a1f('0x34')]=qs[_0x6a1f('0x35')](_0x2df04e['query'][_0x6a1f('0x35')]);_0x2b89d3[_0x6a1f('0x36')]=qs[_0x6a1f('0x2d')](_[_0x6a1f('0x37')](_0x2df04e[_0x6a1f('0x2c')],_0x50efe4[_0x6a1f('0x2d')]));if(_0x2df04e[_0x6a1f('0x2c')][_0x6a1f('0x38')]){_0x2b89d3[_0x6a1f('0x36')]=_[_0x6a1f('0x3a')](_0x2b89d3[_0x6a1f('0x36')],{'$or':_[_0x6a1f('0x27')](_0x2b89d3[_0x6a1f('0x2f')],function(_0x37cabd){var _0x4e8c38={};_0x4e8c38[_0x37cabd]={'$like':'%'+_0x2df04e[_0x6a1f('0x2c')][_0x6a1f('0x38')]+'%'};return _0x4e8c38;})});}_0x2b89d3=_[_0x6a1f('0x3a')]({},_0x2b89d3,_0x2df04e[_0x6a1f('0x3b')]);return _0x53f603[_0x6a1f('0x4c')](_0x2b89d3);}})[_0x6a1f('0x22')](function(_0x45c8ce){if(_0x45c8ce){_0x4b10fa=_0x45c8ce['length'];if(!_0x2df04e['query'][_0x6a1f('0x32')](_0x6a1f('0x33'))){_0x2b89d3['limit']=qs[_0x6a1f('0x1d')](_0x2df04e[_0x6a1f('0x2c')][_0x6a1f('0x1d')]);_0x2b89d3[_0x6a1f('0x1b')]=qs[_0x6a1f('0x1b')](_0x2df04e[_0x6a1f('0x2c')][_0x6a1f('0x1b')]);}return _0x53f603[_0x6a1f('0x4c')](_0x2b89d3);}})['then'](function(_0x2fb92a){if(_0x2fb92a){return _0x2fb92a?{'count':_0x4b10fa,'rows':_0x2fb92a}:null;}})[_0x6a1f('0x22')](respondWithResult(_0x5f3da0,null))[_0x6a1f('0x41')](handleError(_0x5f3da0,null));};exports[_0x6a1f('0x4d')]=function(_0x1f93f8,_0x1839b4,_0x42df32){var _0x230a2e={};var _0x3e73b7={};var _0x165285;var _0x934e5f;return db[_0x6a1f('0x3c')][_0x6a1f('0x49')]({'where':{'id':_0x1f93f8[_0x6a1f('0x43')]['id']}})[_0x6a1f('0x22')](handleEntityNotFound(_0x1839b4,null))['then'](function(_0x5343dc){if(_0x5343dc){_0x165285=_0x5343dc;_0x3e73b7[_0x6a1f('0x2b')]=_[_0x6a1f('0x44')](db[_0x6a1f('0x4e')]['rawAttributes']);_0x3e73b7[_0x6a1f('0x2c')]=_[_0x6a1f('0x44')](_0x1f93f8[_0x6a1f('0x2c')]);_0x3e73b7[_0x6a1f('0x2d')]=_[_0x6a1f('0x2e')](_0x3e73b7[_0x6a1f('0x2b')],_0x3e73b7[_0x6a1f('0x2c')]);_0x230a2e['attributes']=_['intersection'](_0x3e73b7[_0x6a1f('0x2b')],qs['fields'](_0x1f93f8[_0x6a1f('0x2c')][_0x6a1f('0x30')]));_0x230a2e[_0x6a1f('0x2f')]=_0x230a2e['attributes'][_0x6a1f('0x31')]?_0x230a2e[_0x6a1f('0x2f')]:_0x3e73b7['model'];_0x230a2e[_0x6a1f('0x34')]=qs['sort'](_0x1f93f8[_0x6a1f('0x2c')]['sort']);_0x230a2e[_0x6a1f('0x36')]=qs[_0x6a1f('0x2d')](_[_0x6a1f('0x37')](_0x1f93f8['query'],_0x3e73b7['filters']));if(_0x1f93f8['query'][_0x6a1f('0x38')]){_0x230a2e['where']=_['merge'](_0x230a2e['where'],{'$or':_['map'](_0x230a2e[_0x6a1f('0x2f')],function(_0x5445d3){var _0x5c79f2={};_0x5c79f2[_0x5445d3]={'$like':'%'+_0x1f93f8[_0x6a1f('0x2c')][_0x6a1f('0x38')]+'%'};return _0x5c79f2;})});}_0x230a2e=_['merge']({},_0x230a2e,_0x1f93f8[_0x6a1f('0x3b')]);return _0x165285[_0x6a1f('0x4d')](_0x230a2e);}})[_0x6a1f('0x22')](function(_0x21bc07){if(_0x21bc07){_0x934e5f=_0x21bc07['length'];if(!_0x1f93f8[_0x6a1f('0x2c')][_0x6a1f('0x32')](_0x6a1f('0x33'))){_0x230a2e['limit']=qs[_0x6a1f('0x1d')](_0x1f93f8[_0x6a1f('0x2c')][_0x6a1f('0x1d')]);_0x230a2e[_0x6a1f('0x1b')]=qs['offset'](_0x1f93f8[_0x6a1f('0x2c')][_0x6a1f('0x1b')]);}return _0x165285[_0x6a1f('0x4d')](_0x230a2e);}})[_0x6a1f('0x22')](function(_0x661057){if(_0x661057){return _0x661057?{'count':_0x934e5f,'rows':_0x661057}:null;}})[_0x6a1f('0x22')](respondWithResult(_0x1839b4,null))['catch'](handleError(_0x1839b4,null));};exports[_0x6a1f('0x4f')]=function(_0x3f1f3d,_0x4d50ec,_0xc6ad97){if(_0x3f1f3d[_0x6a1f('0x47')]['id']){delete _0x3f1f3d[_0x6a1f('0x47')]['id'];}return db[_0x6a1f('0x3c')]['findOne']({'where':{'id':_0x3f1f3d[_0x6a1f('0x43')]['id']}})[_0x6a1f('0x22')](handleEntityNotFound(_0x4d50ec,null))[_0x6a1f('0x22')](function(_0x36a75e){if(_0x36a75e){return _0x36a75e[_0x6a1f('0x4f')](_0x3f1f3d[_0x6a1f('0x47')]['ids']||[]);}return null;})[_0x6a1f('0x22')](respondWithResult(_0x4d50ec,null))[_0x6a1f('0x41')](handleError(_0x4d50ec,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index fde1bd7..db41877 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 _0x526b=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb301ed,_0x280e7f){var _0x3558be=function(_0x5f18d1){while(--_0x5f18d1){_0xb301ed['push'](_0xb301ed['shift']());}};_0x3558be(++_0x280e7f);}(_0x526b,0xa0));var _0xb526=function(_0x495b19,_0xe0206e){_0x495b19=_0x495b19-0x0;var _0x3a5641=_0x526b[_0x495b19];return _0x3a5641;};'use strict';var _=require(_0xb526('0x0'));var util=require('util');var logger=require(_0xb526('0x1'))(_0xb526('0x2'));var moment=require(_0xb526('0x3'));var BPromise=require(_0xb526('0x4'));var rp=require(_0xb526('0x5'));var fs=require('fs');var path=require(_0xb526('0x6'));var rimraf=require(_0xb526('0x7'));var config=require(_0xb526('0x8'));var attributes=require(_0xb526('0x9'));module[_0xb526('0xa')]=function(_0x5ce5ea,_0x453d38){return _0x5ce5ea[_0xb526('0xb')](_0xb526('0xc'),attributes,{'tableName':_0xb526('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9434=['DeskConfiguration','int_desk_configurations','lodash','util','api','bluebird','path','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x1a579d,_0x45b74b){var _0x2e2795=function(_0xde0870){while(--_0xde0870){_0x1a579d['push'](_0x1a579d['shift']());}};_0x2e2795(++_0x45b74b);}(_0x9434,0x178));var _0x4943=function(_0x5f4107,_0x332ff5){_0x5f4107=_0x5f4107-0x0;var _0x4c7f37=_0x9434[_0x5f4107];return _0x4c7f37;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var logger=require('../../config/logger')(_0x4943('0x2'));var moment=require('moment');var BPromise=require(_0x4943('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4943('0x4'));var rimraf=require('rimraf');var config=require(_0x4943('0x5'));var attributes=require(_0x4943('0x6'));module[_0x4943('0x7')]=function(_0x4d9740,_0x5bce8c){return _0x4d9740[_0x4943('0x8')](_0x4943('0x9'),attributes,{'tableName':_0x4943('0xa'),'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 7ad236e..2d9c924 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 _0x9ab8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x9ab8,0x81));var _0x89ab=function(_0x3b7e99,_0x36bc54){_0x3b7e99=_0x3b7e99-0x0;var _0x1bc5f0=_0x9ab8[_0x3b7e99];return _0x1bc5f0;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a984,_0x3ecaa0,_0x366c32){return new BPromise(function(_0x5fd99f,_0x42da87){return client[_0x89ab('0xa')](_0x29a984,_0x366c32)[_0x89ab('0xb')](function(_0x36dc63){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3ecaa0,_0x89ab('0xc'),JSON[_0x89ab('0xd')](_0x36dc63));if(_0x36dc63[_0x89ab('0xe')]){if(_0x36dc63[_0x89ab('0xe')][_0x89ab('0xf')]===0x1f4){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x42da87(_0x36dc63[_0x89ab('0xe')][_0x89ab('0x11')]);}logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x5fd99f(_0x36dc63[_0x89ab('0xe')]['message']);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');_0x5fd99f(_0x36dc63['result']['message']);}})[_0x89ab('0x12')](function(_0x1ce918){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x1ce918);_0x42da87(_0x1ce918);});});} \ No newline at end of file +var _0xd8d7=['client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise'];(function(_0x17cb30,_0x51f68c){var _0x26a0d4=function(_0x3fd371){while(--_0x3fd371){_0x17cb30['push'](_0x17cb30['shift']());}};_0x26a0d4(++_0x51f68c);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xd8d7[_0x599c94];return _0x34e215;};'use strict';var _=require(_0x7d8d('0x0'));var util=require(_0x7d8d('0x1'));var moment=require(_0x7d8d('0x2'));var BPromise=require(_0x7d8d('0x3'));var rs=require(_0x7d8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d8d('0x5'));var config=require('../../config/environment');var jayson=require(_0x7d8d('0x6'));var client=jayson[_0x7d8d('0x7')][_0x7d8d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc39292,_0x2294c2,_0x3036a9){return new BPromise(function(_0x1bac2e,_0x506fcd){return client[_0x7d8d('0x9')](_0xc39292,_0x3036a9)[_0x7d8d('0xa')](function(_0x3e2f6e){logger[_0x7d8d('0xb')](_0x7d8d('0xc'),_0x2294c2,_0x7d8d('0xd'));logger[_0x7d8d('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2294c2,_0x7d8d('0xd'),JSON[_0x7d8d('0xf')](_0x3e2f6e));if(_0x3e2f6e[_0x7d8d('0x10')]){if(_0x3e2f6e[_0x7d8d('0x10')][_0x7d8d('0x11')]===0x1f4){logger['error'](_0x7d8d('0xc'),_0x2294c2,_0x3e2f6e[_0x7d8d('0x10')][_0x7d8d('0x12')]);return _0x506fcd(_0x3e2f6e[_0x7d8d('0x10')][_0x7d8d('0x12')]);}logger[_0x7d8d('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2294c2,_0x3e2f6e[_0x7d8d('0x10')][_0x7d8d('0x12')]);return _0x1bac2e(_0x3e2f6e[_0x7d8d('0x10')][_0x7d8d('0x12')]);}else{logger[_0x7d8d('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x2294c2,_0x7d8d('0xd'));_0x1bac2e(_0x3e2f6e['result'][_0x7d8d('0x12')]);}})['catch'](function(_0x12588c){logger[_0x7d8d('0x10')](_0x7d8d('0xc'),_0x2294c2,_0x12588c);_0x506fcd(_0x12588c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 15542fd..a584ab4 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 _0x21b3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','connect-timeout','express'];(function(_0x14e3d1,_0x5e37a5){var _0x5baa3b=function(_0x161ae6){while(--_0x161ae6){_0x14e3d1['push'](_0x14e3d1['shift']());}};_0x5baa3b(++_0x5e37a5);}(_0x21b3,0x130));var _0x321b=function(_0x2be499,_0xaa27e){_0x2be499=_0x2be499-0x0;var _0x5dec94=_0x21b3[_0x2be499];return _0x5dec94;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x321b('0x0'));var express=require(_0x321b('0x1'));var router=express[_0x321b('0x2')]();var fs_extra=require(_0x321b('0x3'));var auth=require(_0x321b('0x4'));var interaction=require(_0x321b('0x5'));var config=require('../../config/environment');var controller=require(_0x321b('0x6'));router[_0x321b('0x7')]('/',auth[_0x321b('0x8')](),controller[_0x321b('0x9')]);router[_0x321b('0x7')](_0x321b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x321b('0xb')]('/',auth[_0x321b('0x8')](),controller[_0x321b('0xc')]);router[_0x321b('0xd')](_0x321b('0xa'),auth[_0x321b('0x8')](),controller[_0x321b('0xe')]);router[_0x321b('0xf')]('/:id',auth[_0x321b('0x8')](),controller[_0x321b('0x10')]);module[_0x321b('0x11')]=router; \ No newline at end of file +var _0x69c3=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id'];(function(_0x9cb789,_0x166e23){var _0x4278a5=function(_0x478f5d){while(--_0x478f5d){_0x9cb789['push'](_0x9cb789['shift']());}};_0x4278a5(++_0x166e23);}(_0x69c3,0xd3));var _0x369c=function(_0x2577fa,_0x231b4e){_0x2577fa=_0x2577fa-0x0;var _0x56549d=_0x69c3[_0x2577fa];return _0x56549d;};'use strict';var multer=require('multer');var util=require(_0x369c('0x0'));var path=require(_0x369c('0x1'));var timeout=require(_0x369c('0x2'));var express=require(_0x369c('0x3'));var router=express[_0x369c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x369c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x369c('0x6'));var controller=require(_0x369c('0x7'));router[_0x369c('0x8')]('/',auth[_0x369c('0x9')](),controller['index']);router[_0x369c('0x8')]('/:id',auth[_0x369c('0x9')](),controller[_0x369c('0xa')]);router[_0x369c('0xb')]('/',auth[_0x369c('0x9')](),controller[_0x369c('0xc')]);router[_0x369c('0xd')]('/:id',auth[_0x369c('0x9')](),controller[_0x369c('0xe')]);router[_0x369c('0xf')](_0x369c('0x10'),auth['isAuthenticated'](),controller[_0x369c('0x11')]);module[_0x369c('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 19dd051..0db403d 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 _0xc57c=['customVariable','keyValue','picklist','string','ENUM','STRING','BOOLEAN','exports','variable'];(function(_0x2c0a5e,_0x568fb0){var _0x219441=function(_0x17a3ad){while(--_0x17a3ad){_0x2c0a5e['push'](_0x2c0a5e['shift']());}};_0x219441(++_0x568fb0);}(_0xc57c,0x10c));var _0xcc57=function(_0x517b18,_0x2e653b){_0x517b18=_0x517b18-0x0;var _0x4a5b6f=_0xc57c[_0x517b18];return _0x4a5b6f;};'use strict';var Sequelize=require('sequelize');module[_0xcc57('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xcc57('0x1'),_0xcc57('0x2'),_0xcc57('0x3'),_0xcc57('0x4')),'defaultValue':_0xcc57('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcc57('0x6')](_0xcc57('0x5'),_0xcc57('0x1'),_0xcc57('0x2'))},'keyContent':{'type':Sequelize[_0xcc57('0x7')]},'idField':{'type':Sequelize[_0xcc57('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcc57('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc57('0x7')]}}; \ No newline at end of file +var _0x09a0=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x54f803,_0x5aa9d9){var _0x2927ff=function(_0x3befaf){while(--_0x3befaf){_0x54f803['push'](_0x54f803['shift']());}};_0x2927ff(++_0x5aa9d9);}(_0x09a0,0x16f));var _0x009a=function(_0x2e34a1,_0x2db12e){_0x2e34a1=_0x2e34a1-0x0;var _0x54c941=_0x09a0[_0x2e34a1];return _0x54c941;};'use strict';var Sequelize=require('sequelize');module[_0x009a('0x0')]={'type':{'type':Sequelize[_0x009a('0x1')](_0x009a('0x2'),_0x009a('0x3'),_0x009a('0x4'),_0x009a('0x5'),_0x009a('0x6')),'defaultValue':_0x009a('0x2')},'content':{'type':Sequelize[_0x009a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x009a('0x2'),_0x009a('0x3'),_0x009a('0x4'))},'keyContent':{'type':Sequelize[_0x009a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x009a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x009a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c466e76..694130d 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 _0xf17a=['body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create'];(function(_0x121681,_0x1c92e7){var _0x44c26a=function(_0xe1641c){while(--_0xe1641c){_0x121681['push'](_0x121681['shift']());}};_0x44c26a(++_0x1c92e7);}(_0xf17a,0x136));var _0xaf17=function(_0x118ca9,_0x4da43f){_0x118ca9=_0x118ca9-0x0;var _0x4ef798=_0xf17a[_0x118ca9];return _0x4ef798;};'use strict';var emlformat=require(_0xaf17('0x0'));var rimraf=require(_0xaf17('0x1'));var zipdir=require(_0xaf17('0x2'));var jsonpatch=require(_0xaf17('0x3'));var rp=require(_0xaf17('0x4'));var moment=require(_0xaf17('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaf17('0x6'));var sox=require(_0xaf17('0x7'));var csv=require(_0xaf17('0x8'));var ejs=require(_0xaf17('0x9'));var fs=require('fs');var fs_extra=require(_0xaf17('0xa'));var _=require(_0xaf17('0xb'));var squel=require('squel');var crypto=require(_0xaf17('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaf17('0xd'));var toCsv=require(_0xaf17('0x8'));var querystring=require(_0xaf17('0xe'));var Papa=require('papaparse');var Redis=require(_0xaf17('0xf'));var authService=require(_0xaf17('0x10'));var qs=require(_0xaf17('0x11'));var as=require(_0xaf17('0x12'));var hardwareService=require(_0xaf17('0x13'));var logger=require(_0xaf17('0x14'))(_0xaf17('0x15'));var utils=require('../../config/utils');var config=require(_0xaf17('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x209bce,_0x136968){_0x136968=_0x136968||0xcc;return function(_0x3a53bb){if(_0x3a53bb){return _0x209bce[_0xaf17('0x17')](_0x136968);}return _0x209bce[_0xaf17('0x18')](_0x136968)['end']();};}function respondWithResult(_0x1afa5f,_0x39b181){_0x39b181=_0x39b181||0xc8;return function(_0x468a6a){if(_0x468a6a){return _0x1afa5f[_0xaf17('0x18')](_0x39b181)[_0xaf17('0x19')](_0x468a6a);}};}function respondWithFilteredResult(_0x586501,_0x145d83){return function(_0x33a32f){if(_0x33a32f){var _0x5eb253=typeof _0x145d83[_0xaf17('0x1a')]==='undefined'&&typeof _0x145d83[_0xaf17('0x1b')]===_0xaf17('0x1c');var _0x75d606=_0x33a32f[_0xaf17('0x1d')];var _0x8fecdf=_0x5eb253?0x0:_0x145d83[_0xaf17('0x1a')];var _0x264ed7=_0x5eb253?_0x33a32f[_0xaf17('0x1d')]:_0x145d83['offset']+_0x145d83[_0xaf17('0x1b')];var _0x294876;if(_0x264ed7>=_0x75d606){_0x264ed7=_0x75d606;_0x294876=0xc8;}else{_0x294876=0xce;}_0x586501['status'](_0x294876);return _0x586501[_0xaf17('0x1e')](_0xaf17('0x1f'),_0x8fecdf+'-'+_0x264ed7+'/'+_0x75d606)['json'](_0x33a32f);}return null;};}function patchUpdates(_0x259506){return function(_0x5c6450){try{jsonpatch[_0xaf17('0x20')](_0x5c6450,_0x259506,!![]);}catch(_0x2ef609){return BPromise[_0xaf17('0x21')](_0x2ef609);}return _0x5c6450[_0xaf17('0x22')]();};}function saveUpdates(_0x3d9a7a,_0x336e28){return function(_0x40e685){if(_0x40e685){return _0x40e685[_0xaf17('0x23')](_0x3d9a7a)['then'](function(_0x3af26f){return _0x3af26f;});}return null;};}function removeEntity(_0x3b777f,_0x1670a1){return function(_0x39eb7a){if(_0x39eb7a){return _0x39eb7a['destroy']()[_0xaf17('0x24')](function(){_0x3b777f['status'](0xcc)[_0xaf17('0x25')]();});}};}function handleEntityNotFound(_0x538e9d,_0x17fb86){return function(_0x1ef9cf){if(!_0x1ef9cf){_0x538e9d['sendStatus'](0x194);}return _0x1ef9cf;};}function handleError(_0x4d477e,_0x3cede8){_0x3cede8=_0x3cede8||0x1f4;return function(_0x2da69e){logger[_0xaf17('0x26')](_0x2da69e[_0xaf17('0x27')]);if(_0x2da69e['name']){delete _0x2da69e[_0xaf17('0x28')];}_0x4d477e['status'](_0x3cede8)[_0xaf17('0x29')](_0x2da69e);};}exports[_0xaf17('0x2a')]=function(_0x45d099,_0x34eeb7){var _0x5678bf={},_0x1ca1ce={},_0x5ba4e9={'count':0x0,'rows':[]};var _0x20f71f=_['map'](db[_0xaf17('0x2b')][_0xaf17('0x2c')],function(_0x139dbc){return{'name':_0x139dbc[_0xaf17('0x2d')],'type':_0x139dbc[_0xaf17('0x2e')][_0xaf17('0x2f')]};});_0x1ca1ce[_0xaf17('0x30')]=_[_0xaf17('0x31')](_0x20f71f,_0xaf17('0x28'));_0x1ca1ce[_0xaf17('0x32')]=_[_0xaf17('0x33')](_0x45d099[_0xaf17('0x32')]);_0x1ca1ce['filters']=_['intersection'](_0x1ca1ce[_0xaf17('0x30')],_0x1ca1ce[_0xaf17('0x32')]);_0x5678bf[_0xaf17('0x34')]=_[_0xaf17('0x35')](_0x1ca1ce['model'],qs[_0xaf17('0x36')](_0x45d099[_0xaf17('0x32')][_0xaf17('0x36')]));_0x5678bf[_0xaf17('0x34')]=_0x5678bf[_0xaf17('0x34')][_0xaf17('0x37')]?_0x5678bf[_0xaf17('0x34')]:_0x1ca1ce[_0xaf17('0x30')];if(!_0x45d099['query'][_0xaf17('0x38')](_0xaf17('0x39'))){_0x5678bf[_0xaf17('0x1b')]=qs[_0xaf17('0x1b')](_0x45d099[_0xaf17('0x32')][_0xaf17('0x1b')]);_0x5678bf[_0xaf17('0x1a')]=qs[_0xaf17('0x1a')](_0x45d099[_0xaf17('0x32')][_0xaf17('0x1a')]);}_0x5678bf[_0xaf17('0x3a')]=qs[_0xaf17('0x3b')](_0x45d099[_0xaf17('0x32')][_0xaf17('0x3b')]);_0x5678bf[_0xaf17('0x3c')]=qs[_0xaf17('0x3d')](_[_0xaf17('0x3e')](_0x45d099[_0xaf17('0x32')],_0x1ca1ce[_0xaf17('0x3d')]),_0x20f71f);if(_0x45d099[_0xaf17('0x32')][_0xaf17('0x3f')]){_0x5678bf[_0xaf17('0x3c')]=_[_0xaf17('0x40')](_0x5678bf[_0xaf17('0x3c')],{'$or':_['map'](_0x20f71f,function(_0x496ab0){if(_0x496ab0[_0xaf17('0x2e')]!=='VIRTUAL'){var _0x22f9f4={};_0x22f9f4[_0x496ab0['name']]={'$like':'%'+_0x45d099[_0xaf17('0x32')][_0xaf17('0x3f')]+'%'};return _0x22f9f4;}})});}_0x5678bf=_['merge']({},_0x5678bf,_0x45d099['options']);var _0x3863ce={'where':_0x5678bf[_0xaf17('0x3c')]};return db['DeskField']['count'](_0x3863ce)[_0xaf17('0x24')](function(_0x40562a){_0x5ba4e9[_0xaf17('0x1d')]=_0x40562a;if(_0x45d099[_0xaf17('0x32')][_0xaf17('0x41')]){_0x5678bf[_0xaf17('0x42')]=[{'all':!![]}];}return db[_0xaf17('0x2b')][_0xaf17('0x43')](_0x5678bf);})[_0xaf17('0x24')](function(_0x3d5114){_0x5ba4e9[_0xaf17('0x44')]=_0x3d5114;return _0x5ba4e9;})[_0xaf17('0x24')](respondWithFilteredResult(_0x34eeb7,_0x5678bf))[_0xaf17('0x45')](handleError(_0x34eeb7,null));};exports[_0xaf17('0x46')]=function(_0x14626c,_0xcf5bd8){var _0x495f3b={'raw':!![],'where':{'id':_0x14626c[_0xaf17('0x47')]['id']}},_0x10fd73={};_0x10fd73[_0xaf17('0x30')]=_[_0xaf17('0x33')](db['DeskField'][_0xaf17('0x2c')]);_0x10fd73['query']=_[_0xaf17('0x33')](_0x14626c[_0xaf17('0x32')]);_0x10fd73[_0xaf17('0x3d')]=_[_0xaf17('0x35')](_0x10fd73[_0xaf17('0x30')],_0x10fd73[_0xaf17('0x32')]);_0x495f3b[_0xaf17('0x34')]=_[_0xaf17('0x35')](_0x10fd73[_0xaf17('0x30')],qs[_0xaf17('0x36')](_0x14626c[_0xaf17('0x32')]['fields']));_0x495f3b[_0xaf17('0x34')]=_0x495f3b['attributes'][_0xaf17('0x37')]?_0x495f3b[_0xaf17('0x34')]:_0x10fd73[_0xaf17('0x30')];if(_0x14626c['query'][_0xaf17('0x41')]){_0x495f3b[_0xaf17('0x42')]=[{'all':!![]}];}_0x495f3b=_[_0xaf17('0x40')]({},_0x495f3b,_0x14626c[_0xaf17('0x48')]);return db[_0xaf17('0x2b')][_0xaf17('0x49')](_0x495f3b)['then'](handleEntityNotFound(_0xcf5bd8,null))[_0xaf17('0x24')](respondWithResult(_0xcf5bd8,null))['catch'](handleError(_0xcf5bd8,null));};exports[_0xaf17('0x4a')]=function(_0x5cc5f7,_0x1a70b1){return db['DeskField']['create'](_0x5cc5f7['body'],{})[_0xaf17('0x24')](respondWithResult(_0x1a70b1,0xc9))[_0xaf17('0x45')](handleError(_0x1a70b1,null));};exports[_0xaf17('0x23')]=function(_0x564c01,_0x3a0d9c){if(_0x564c01[_0xaf17('0x4b')]['id']){delete _0x564c01[_0xaf17('0x4b')]['id'];}return db['DeskField'][_0xaf17('0x49')]({'where':{'id':_0x564c01[_0xaf17('0x47')]['id']}})[_0xaf17('0x24')](handleEntityNotFound(_0x3a0d9c,null))[_0xaf17('0x24')](saveUpdates(_0x564c01['body'],null))[_0xaf17('0x24')](respondWithResult(_0x3a0d9c,null))[_0xaf17('0x45')](handleError(_0x3a0d9c,null));};exports[_0xaf17('0x4c')]=function(_0x489f18,_0x3a7ad4){return db[_0xaf17('0x2b')]['find']({'where':{'id':_0x489f18[_0xaf17('0x47')]['id']}})[_0xaf17('0x24')](handleEntityNotFound(_0x3a7ad4,null))[_0xaf17('0x24')](removeEntity(_0x3a7ad4,null))['catch'](handleError(_0x3a7ad4,null));}; \ No newline at end of file +var _0x25ed=['map','DeskField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index'];(function(_0x2cde71,_0x1f55b4){var _0x4e1db9=function(_0x4cd129){while(--_0x4cd129){_0x2cde71['push'](_0x2cde71['shift']());}};_0x4e1db9(++_0x1f55b4);}(_0x25ed,0x1e8));var _0xd25e=function(_0x5c3c90,_0x5ba31e){_0x5c3c90=_0x5c3c90-0x0;var _0x1dff8b=_0x25ed[_0x5c3c90];return _0x1dff8b;};'use strict';var emlformat=require(_0xd25e('0x0'));var rimraf=require(_0xd25e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd25e('0x2'));var rp=require(_0xd25e('0x3'));var moment=require(_0xd25e('0x4'));var BPromise=require(_0xd25e('0x5'));var Mustache=require(_0xd25e('0x6'));var util=require(_0xd25e('0x7'));var path=require(_0xd25e('0x8'));var sox=require(_0xd25e('0x9'));var csv=require(_0xd25e('0xa'));var ejs=require(_0xd25e('0xb'));var fs=require('fs');var fs_extra=require(_0xd25e('0xc'));var _=require(_0xd25e('0xd'));var squel=require(_0xd25e('0xe'));var crypto=require(_0xd25e('0xf'));var jsforce=require(_0xd25e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd25e('0xa'));var querystring=require(_0xd25e('0x11'));var Papa=require(_0xd25e('0x12'));var Redis=require(_0xd25e('0x13'));var authService=require(_0xd25e('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd25e('0x15'));var utils=require(_0xd25e('0x16'));var config=require(_0xd25e('0x17'));var licenseUtil=require(_0xd25e('0x18'));var db=require(_0xd25e('0x19'))['db'];function respondWithStatusCode(_0x12402b,_0x1a2bb1){_0x1a2bb1=_0x1a2bb1||0xcc;return function(_0x2afb97){if(_0x2afb97){return _0x12402b['sendStatus'](_0x1a2bb1);}return _0x12402b['status'](_0x1a2bb1)[_0xd25e('0x1a')]();};}function respondWithResult(_0xecae2e,_0x5e6369){_0x5e6369=_0x5e6369||0xc8;return function(_0x293388){if(_0x293388){return _0xecae2e[_0xd25e('0x1b')](_0x5e6369)[_0xd25e('0x1c')](_0x293388);}};}function respondWithFilteredResult(_0x2ebd2d,_0x5e9481){return function(_0x1bed2e){if(_0x1bed2e){var _0x48c98e=typeof _0x5e9481[_0xd25e('0x1d')]==='undefined'&&typeof _0x5e9481[_0xd25e('0x1e')]==='undefined';var _0x24f3a3=_0x1bed2e[_0xd25e('0x1f')];var _0x3d3cfb=_0x48c98e?0x0:_0x5e9481[_0xd25e('0x1d')];var _0x296f1a=_0x48c98e?_0x1bed2e[_0xd25e('0x1f')]:_0x5e9481[_0xd25e('0x1d')]+_0x5e9481[_0xd25e('0x1e')];var _0x3a93f2;if(_0x296f1a>=_0x24f3a3){_0x296f1a=_0x24f3a3;_0x3a93f2=0xc8;}else{_0x3a93f2=0xce;}_0x2ebd2d[_0xd25e('0x1b')](_0x3a93f2);return _0x2ebd2d['set'](_0xd25e('0x20'),_0x3d3cfb+'-'+_0x296f1a+'/'+_0x24f3a3)[_0xd25e('0x1c')](_0x1bed2e);}return null;};}function patchUpdates(_0xb1287a){return function(_0x4d6dde){try{jsonpatch[_0xd25e('0x21')](_0x4d6dde,_0xb1287a,!![]);}catch(_0x595a1c){return BPromise[_0xd25e('0x22')](_0x595a1c);}return _0x4d6dde[_0xd25e('0x23')]();};}function saveUpdates(_0x42930e,_0x217539){return function(_0x357307){if(_0x357307){return _0x357307[_0xd25e('0x24')](_0x42930e)[_0xd25e('0x25')](function(_0x2f516e){return _0x2f516e;});}return null;};}function removeEntity(_0x54764d,_0x1ced69){return function(_0x3f6c9d){if(_0x3f6c9d){return _0x3f6c9d[_0xd25e('0x26')]()[_0xd25e('0x25')](function(){_0x54764d[_0xd25e('0x1b')](0xcc)[_0xd25e('0x1a')]();});}};}function handleEntityNotFound(_0x1250d6,_0x4ff0f6){return function(_0x41e66c){if(!_0x41e66c){_0x1250d6[_0xd25e('0x27')](0x194);}return _0x41e66c;};}function handleError(_0x15e802,_0x33970e){_0x33970e=_0x33970e||0x1f4;return function(_0x43e038){logger[_0xd25e('0x28')](_0x43e038['stack']);if(_0x43e038[_0xd25e('0x29')]){delete _0x43e038[_0xd25e('0x29')];}_0x15e802['status'](_0x33970e)[_0xd25e('0x2a')](_0x43e038);};}exports[_0xd25e('0x2b')]=function(_0x21f7ee,_0xafb7d){var _0x51742e={},_0x171630={},_0x23d7e2={'count':0x0,'rows':[]};var _0x381e21=_[_0xd25e('0x2c')](db[_0xd25e('0x2d')]['rawAttributes'],function(_0x5989ea){return{'name':_0x5989ea[_0xd25e('0x2e')],'type':_0x5989ea['type'][_0xd25e('0x2f')]};});_0x171630[_0xd25e('0x30')]=_[_0xd25e('0x2c')](_0x381e21,_0xd25e('0x29'));_0x171630[_0xd25e('0x31')]=_[_0xd25e('0x32')](_0x21f7ee[_0xd25e('0x31')]);_0x171630[_0xd25e('0x33')]=_[_0xd25e('0x34')](_0x171630[_0xd25e('0x30')],_0x171630['query']);_0x51742e[_0xd25e('0x35')]=_[_0xd25e('0x34')](_0x171630[_0xd25e('0x30')],qs[_0xd25e('0x36')](_0x21f7ee[_0xd25e('0x31')][_0xd25e('0x36')]));_0x51742e[_0xd25e('0x35')]=_0x51742e['attributes'][_0xd25e('0x37')]?_0x51742e[_0xd25e('0x35')]:_0x171630['model'];if(!_0x21f7ee[_0xd25e('0x31')]['hasOwnProperty'](_0xd25e('0x38'))){_0x51742e['limit']=qs['limit'](_0x21f7ee[_0xd25e('0x31')][_0xd25e('0x1e')]);_0x51742e['offset']=qs['offset'](_0x21f7ee[_0xd25e('0x31')][_0xd25e('0x1d')]);}_0x51742e[_0xd25e('0x39')]=qs['sort'](_0x21f7ee['query'][_0xd25e('0x3a')]);_0x51742e[_0xd25e('0x3b')]=qs[_0xd25e('0x33')](_[_0xd25e('0x3c')](_0x21f7ee[_0xd25e('0x31')],_0x171630[_0xd25e('0x33')]),_0x381e21);if(_0x21f7ee[_0xd25e('0x31')][_0xd25e('0x3d')]){_0x51742e[_0xd25e('0x3b')]=_[_0xd25e('0x3e')](_0x51742e[_0xd25e('0x3b')],{'$or':_['map'](_0x381e21,function(_0x3322bd){if(_0x3322bd[_0xd25e('0x3f')]!==_0xd25e('0x40')){var _0xe7c49b={};_0xe7c49b[_0x3322bd[_0xd25e('0x29')]]={'$like':'%'+_0x21f7ee[_0xd25e('0x31')][_0xd25e('0x3d')]+'%'};return _0xe7c49b;}})});}_0x51742e=_['merge']({},_0x51742e,_0x21f7ee[_0xd25e('0x41')]);var _0x5d57ed={'where':_0x51742e[_0xd25e('0x3b')]};return db[_0xd25e('0x2d')][_0xd25e('0x1f')](_0x5d57ed)['then'](function(_0x3d0ece){_0x23d7e2[_0xd25e('0x1f')]=_0x3d0ece;if(_0x21f7ee[_0xd25e('0x31')][_0xd25e('0x42')]){_0x51742e[_0xd25e('0x43')]=[{'all':!![]}];}return db[_0xd25e('0x2d')][_0xd25e('0x44')](_0x51742e);})[_0xd25e('0x25')](function(_0x18eb36){_0x23d7e2['rows']=_0x18eb36;return _0x23d7e2;})[_0xd25e('0x25')](respondWithFilteredResult(_0xafb7d,_0x51742e))['catch'](handleError(_0xafb7d,null));};exports[_0xd25e('0x45')]=function(_0xbd75f4,_0x4b3893){var _0xd0dbc={'raw':!![],'where':{'id':_0xbd75f4[_0xd25e('0x46')]['id']}},_0x2911e6={};_0x2911e6[_0xd25e('0x30')]=_[_0xd25e('0x32')](db[_0xd25e('0x2d')][_0xd25e('0x47')]);_0x2911e6['query']=_[_0xd25e('0x32')](_0xbd75f4[_0xd25e('0x31')]);_0x2911e6['filters']=_['intersection'](_0x2911e6['model'],_0x2911e6[_0xd25e('0x31')]);_0xd0dbc['attributes']=_[_0xd25e('0x34')](_0x2911e6['model'],qs[_0xd25e('0x36')](_0xbd75f4['query']['fields']));_0xd0dbc[_0xd25e('0x35')]=_0xd0dbc['attributes'][_0xd25e('0x37')]?_0xd0dbc['attributes']:_0x2911e6[_0xd25e('0x30')];if(_0xbd75f4['query'][_0xd25e('0x42')]){_0xd0dbc[_0xd25e('0x43')]=[{'all':!![]}];}_0xd0dbc=_[_0xd25e('0x3e')]({},_0xd0dbc,_0xbd75f4[_0xd25e('0x41')]);return db['DeskField'][_0xd25e('0x48')](_0xd0dbc)[_0xd25e('0x25')](handleEntityNotFound(_0x4b3893,null))[_0xd25e('0x25')](respondWithResult(_0x4b3893,null))[_0xd25e('0x49')](handleError(_0x4b3893,null));};exports['create']=function(_0x3f698d,_0x3f6bd5){return db['DeskField'][_0xd25e('0x4a')](_0x3f698d[_0xd25e('0x4b')],{})['then'](respondWithResult(_0x3f6bd5,0xc9))[_0xd25e('0x49')](handleError(_0x3f6bd5,null));};exports['update']=function(_0x50c7aa,_0x4c670c){if(_0x50c7aa['body']['id']){delete _0x50c7aa[_0xd25e('0x4b')]['id'];}return db['DeskField'][_0xd25e('0x48')]({'where':{'id':_0x50c7aa[_0xd25e('0x46')]['id']}})[_0xd25e('0x25')](handleEntityNotFound(_0x4c670c,null))[_0xd25e('0x25')](saveUpdates(_0x50c7aa[_0xd25e('0x4b')],null))[_0xd25e('0x25')](respondWithResult(_0x4c670c,null))['catch'](handleError(_0x4c670c,null));};exports['destroy']=function(_0x4ca74f,_0x3d2a46){return db[_0xd25e('0x2d')][_0xd25e('0x48')]({'where':{'id':_0x4ca74f['params']['id']}})[_0xd25e('0x25')](handleEntityNotFound(_0x3d2a46,null))[_0xd25e('0x25')](removeEntity(_0x3d2a46,null))[_0xd25e('0x49')](handleError(_0x3d2a46,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 70dd23e..37ed4f2 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 _0xad13=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','util','../../config/logger','api','moment','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xad13,0x1b7));var _0x3ad1=function(_0x4e0068,_0x5d2270){_0x4e0068=_0x4e0068-0x0;var _0x4b0b5f=_0xad13[_0x4e0068];return _0x4b0b5f;};'use strict';var _=require('lodash');var util=require(_0x3ad1('0x0'));var logger=require(_0x3ad1('0x1'))(_0x3ad1('0x2'));var moment=require(_0x3ad1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ad1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3ad1('0x5'));module[_0x3ad1('0x6')]=function(_0x265c07,_0x3bac80){return _0x265c07[_0x3ad1('0x7')](_0x3ad1('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3ad1('0x9'),'fields':[_0x3ad1('0xa'),_0x3ad1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e4c=['desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intDeskField.attributes','exports','define','DeskField'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x2e4c,0x1a2));var _0xc2e4=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x2e4c[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0xc2e4('0x0'));var util=require(_0xc2e4('0x1'));var logger=require(_0xc2e4('0x2'))(_0xc2e4('0x3'));var moment=require(_0xc2e4('0x4'));var BPromise=require(_0xc2e4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc2e4('0x6'));var attributes=require(_0xc2e4('0x7'));module[_0xc2e4('0x8')]=function(_0x439978,_0x43b3c9){return _0x439978[_0xc2e4('0x9')](_0xc2e4('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xc2e4('0xb'),'fields':[_0xc2e4('0xc'),'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 f3f3279..2e23523 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 _0xd4f7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1c8f34,_0x284a2f){var _0xff1829=function(_0x41f1b5){while(--_0x41f1b5){_0x1c8f34['push'](_0x1c8f34['shift']());}};_0xff1829(++_0x284a2f);}(_0xd4f7,0x141));var _0x7d4f=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xd4f7[_0x3bfdde];return _0x3f752a;};'use strict';var _=require(_0x7d4f('0x0'));var util=require(_0x7d4f('0x1'));var moment=require(_0x7d4f('0x2'));var BPromise=require(_0x7d4f('0x3'));var rs=require(_0x7d4f('0x4'));var fs=require('fs');var Redis=require(_0x7d4f('0x5'));var db=require(_0x7d4f('0x6'))['db'];var utils=require(_0x7d4f('0x7'));var logger=require(_0x7d4f('0x8'))(_0x7d4f('0x9'));var config=require(_0x7d4f('0xa'));var jayson=require(_0x7d4f('0xb'));var client=jayson[_0x7d4f('0xc')][_0x7d4f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2195f5,_0x3a5427,_0x48159e){return new BPromise(function(_0x13583e,_0x294708){return client[_0x7d4f('0xe')](_0x2195f5,_0x48159e)[_0x7d4f('0xf')](function(_0x3bd660){logger[_0x7d4f('0x10')](_0x7d4f('0x11'),_0x3a5427,_0x7d4f('0x12'));logger[_0x7d4f('0x13')](_0x7d4f('0x14'),_0x3a5427,_0x7d4f('0x12'),JSON[_0x7d4f('0x15')](_0x3bd660));if(_0x3bd660[_0x7d4f('0x16')]){if(_0x3bd660['error'][_0x7d4f('0x17')]===0x1f4){logger[_0x7d4f('0x16')](_0x7d4f('0x11'),_0x3a5427,_0x3bd660[_0x7d4f('0x16')]['message']);return _0x294708(_0x3bd660[_0x7d4f('0x16')][_0x7d4f('0x18')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x3a5427,_0x3bd660[_0x7d4f('0x16')][_0x7d4f('0x18')]);return _0x13583e(_0x3bd660[_0x7d4f('0x16')]['message']);}else{logger[_0x7d4f('0x10')](_0x7d4f('0x11'),_0x3a5427,'request\x20sent');_0x13583e(_0x3bd660[_0x7d4f('0x19')][_0x7d4f('0x18')]);}})[_0x7d4f('0x1a')](function(_0x1e0102){logger['error'](_0x7d4f('0x11'),_0x3a5427,_0x1e0102);_0x294708(_0x1e0102);});});} \ No newline at end of file +var _0xd272=['moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x3e0ad9,_0x1af410){var _0x228f16=function(_0x4cd5e0){while(--_0x4cd5e0){_0x3e0ad9['push'](_0x3e0ad9['shift']());}};_0x228f16(++_0x1af410);}(_0xd272,0x1f2));var _0x2d27=function(_0x3f6a49,_0x11a6d7){_0x3f6a49=_0x3f6a49-0x0;var _0x1d887d=_0xd272[_0x3f6a49];return _0x1d887d;};'use strict';var _=require(_0x2d27('0x0'));var util=require(_0x2d27('0x1'));var moment=require(_0x2d27('0x2'));var BPromise=require(_0x2d27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d27('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d27('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d27('0x6'));var jayson=require(_0x2d27('0x7'));var client=jayson[_0x2d27('0x8')][_0x2d27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40b247,_0x8a7c02,_0x3bead9){return new BPromise(function(_0xe74bc6,_0x44c62f){return client[_0x2d27('0xa')](_0x40b247,_0x3bead9)['then'](function(_0xa032b7){logger[_0x2d27('0xb')](_0x2d27('0xc'),_0x8a7c02,_0x2d27('0xd'));logger['debug'](_0x2d27('0xe'),_0x8a7c02,_0x2d27('0xd'),JSON[_0x2d27('0xf')](_0xa032b7));if(_0xa032b7[_0x2d27('0x10')]){if(_0xa032b7[_0x2d27('0x10')][_0x2d27('0x11')]===0x1f4){logger[_0x2d27('0x10')](_0x2d27('0xc'),_0x8a7c02,_0xa032b7[_0x2d27('0x10')][_0x2d27('0x12')]);return _0x44c62f(_0xa032b7[_0x2d27('0x10')]['message']);}logger[_0x2d27('0x10')](_0x2d27('0xc'),_0x8a7c02,_0xa032b7[_0x2d27('0x10')]['message']);return _0xe74bc6(_0xa032b7['error'][_0x2d27('0x12')]);}else{logger[_0x2d27('0xb')](_0x2d27('0xc'),_0x8a7c02,_0x2d27('0xd'));_0xe74bc6(_0xa032b7[_0x2d27('0x13')][_0x2d27('0x12')]);}})['catch'](function(_0x32d68a){logger['error']('DeskField,\x20%s,\x20%s',_0x8a7c02,_0x32d68a);_0x44c62f(_0x32d68a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index aa930db..b3faa4b 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 _0xe07a=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x34823e,_0xfd07fa){var _0xaf46fe=function(_0x42977a){while(--_0x42977a){_0x34823e['push'](_0x34823e['shift']());}};_0xaf46fe(++_0xfd07fa);}(_0xe07a,0x94));var _0xae07=function(_0xa9c2c3,_0x403fb9){_0xa9c2c3=_0xa9c2c3-0x0;var _0x528ec1=_0xe07a[_0xa9c2c3];return _0x528ec1;};'use strict';var multer=require(_0xae07('0x0'));var util=require(_0xae07('0x1'));var path=require(_0xae07('0x2'));var timeout=require(_0xae07('0x3'));var express=require(_0xae07('0x4'));var router=express[_0xae07('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xae07('0x6'));var interaction=require(_0xae07('0x7'));var config=require(_0xae07('0x8'));var controller=require('./intDynamics365Account.controller');router[_0xae07('0x9')]('/',auth[_0xae07('0xa')](),controller[_0xae07('0xb')]);router[_0xae07('0x9')](_0xae07('0xc'),auth[_0xae07('0xa')](),controller[_0xae07('0xd')]);router[_0xae07('0x9')]('/:id/configurations',auth[_0xae07('0xa')](),controller[_0xae07('0xe')]);router[_0xae07('0x9')](_0xae07('0xf'),auth['isAuthenticated'](),controller[_0xae07('0x10')]);router[_0xae07('0x11')]('/',auth[_0xae07('0xa')](),controller[_0xae07('0x12')]);router[_0xae07('0x11')]('/:id/configurations',auth[_0xae07('0xa')](),controller[_0xae07('0x13')]);router[_0xae07('0x14')](_0xae07('0xc'),auth['isAuthenticated'](),controller[_0xae07('0x15')]);router['delete'](_0xae07('0xc'),auth[_0xae07('0xa')](),controller[_0xae07('0x16')]);module[_0xae07('0x17')]=router; \ No newline at end of file +var _0x4a51=['delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x1d0cba,_0x2731b1){var _0xdc3278=function(_0x3b20f5){while(--_0x3b20f5){_0x1d0cba['push'](_0x1d0cba['shift']());}};_0xdc3278(++_0x2731b1);}(_0x4a51,0x80));var _0x14a5=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x4a51[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0x14a5('0x0'));var util=require(_0x14a5('0x1'));var path=require(_0x14a5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14a5('0x3'));var auth=require(_0x14a5('0x4'));var interaction=require(_0x14a5('0x5'));var config=require(_0x14a5('0x6'));var controller=require(_0x14a5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x14a5('0x8')]);router[_0x14a5('0x9')](_0x14a5('0xa'),auth[_0x14a5('0xb')](),controller['show']);router[_0x14a5('0x9')](_0x14a5('0xc'),auth[_0x14a5('0xb')](),controller[_0x14a5('0xd')]);router[_0x14a5('0x9')]('/:id/fields',auth[_0x14a5('0xb')](),controller[_0x14a5('0xe')]);router[_0x14a5('0xf')]('/',auth[_0x14a5('0xb')](),controller[_0x14a5('0x10')]);router[_0x14a5('0xf')]('/:id/configurations',auth[_0x14a5('0xb')](),controller['addConfiguration']);router[_0x14a5('0x11')](_0x14a5('0xa'),auth[_0x14a5('0xb')](),controller[_0x14a5('0x12')]);router[_0x14a5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x14a5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a107664..77035d3 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 _0xf1e2=['STRING','exports'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0xf1e2,0xaf));var _0x2f1e=function(_0x487cbd,_0x342d12){_0x487cbd=_0x487cbd-0x0;var _0x5021f6=_0xf1e2[_0x487cbd];return _0x5021f6;};'use strict';var Sequelize=require('sequelize');module[_0x2f1e('0x0')]={'name':{'type':Sequelize[_0x2f1e('0x1')]},'username':{'type':Sequelize[_0x2f1e('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2f1e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2f1e('0x1')]}}; \ No newline at end of file +var _0x53d6=['STRING','exports'];(function(_0x167d20,_0x1c6e44){var _0x5428bb=function(_0x53a48a){while(--_0x53a48a){_0x167d20['push'](_0x167d20['shift']());}};_0x5428bb(++_0x1c6e44);}(_0x53d6,0x113));var _0x653d=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x53d6[_0x264b9b];return _0x4c7a0e;};'use strict';var Sequelize=require('sequelize');module[_0x653d('0x0')]={'name':{'type':Sequelize[_0x653d('0x1')]},'username':{'type':Sequelize[_0x653d('0x1')]},'password':{'type':Sequelize[_0x653d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x653d('0x1')]},'clientSecret':{'type':Sequelize[_0x653d('0x1')]},'serverUrl':{'type':Sequelize[_0x653d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x653d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index cbf1ec4..af6ae56 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 _0x3e74=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','create','body','find','getConfigurations','findOne','fields','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','Dynamics365Field','getFields','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','Value','UserLocalizedLabel',')/Attributes(','OptionSet','TrueOption','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2a70ae,_0x8c97c5){var _0x9043f2=function(_0x59a687){while(--_0x59a687){_0x2a70ae['push'](_0x2a70ae['shift']());}};_0x9043f2(++_0x8c97c5);}(_0x3e74,0x175));var _0x43e7=function(_0x3c2b29,_0xbec9f9){_0x3c2b29=_0x3c2b29-0x0;var _0x707c99=_0x3e74[_0x3c2b29];return _0x707c99;};'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'];var integrations=require(_0x43e7('0x15'));function respondWithStatusCode(_0x2718d3,_0x3bb83f){_0x3bb83f=_0x3bb83f||0xcc;return function(_0x4e008c){if(_0x4e008c){return _0x2718d3['sendStatus'](_0x3bb83f);}return _0x2718d3[_0x43e7('0x16')](_0x3bb83f)[_0x43e7('0x17')]();};}function respondWithResult(_0x44b0bd,_0x51b974){_0x51b974=_0x51b974||0xc8;return function(_0x5e641c){if(_0x5e641c){return _0x44b0bd[_0x43e7('0x16')](_0x51b974)[_0x43e7('0x18')](_0x5e641c);}};}function respondWithFilteredResult(_0x203378,_0x328445){return function(_0x4de324){if(_0x4de324){var _0x5c4eaa=typeof _0x328445[_0x43e7('0x19')]===_0x43e7('0x1a')&&typeof _0x328445[_0x43e7('0x1b')]==='undefined';var _0x4b5a6b=_0x4de324[_0x43e7('0x1c')];var _0x1ca758=_0x5c4eaa?0x0:_0x328445[_0x43e7('0x19')];var _0x140657=_0x5c4eaa?_0x4de324[_0x43e7('0x1c')]:_0x328445[_0x43e7('0x19')]+_0x328445[_0x43e7('0x1b')];var _0x1441ef;if(_0x140657>=_0x4b5a6b){_0x140657=_0x4b5a6b;_0x1441ef=0xc8;}else{_0x1441ef=0xce;}_0x203378[_0x43e7('0x16')](_0x1441ef);return _0x203378[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x1ca758+'-'+_0x140657+'/'+_0x4b5a6b)[_0x43e7('0x18')](_0x4de324);}return null;};}function patchUpdates(_0x4b5d64){return function(_0xef1a5a){try{jsonpatch[_0x43e7('0x1f')](_0xef1a5a,_0x4b5d64,!![]);}catch(_0x4b386b){return BPromise[_0x43e7('0x20')](_0x4b386b);}return _0xef1a5a[_0x43e7('0x21')]();};}function saveUpdates(_0x3945bb,_0x28aacc){return function(_0x4077fb){if(_0x4077fb){return _0x4077fb[_0x43e7('0x22')](_0x3945bb)['then'](function(_0x454359){return _0x454359;});}return null;};}function removeEntity(_0x4eea52,_0x4c9df3){return function(_0x47204e){if(_0x47204e){return _0x47204e[_0x43e7('0x23')]()['then'](function(){_0x4eea52[_0x43e7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x326dab,_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x326dab[_0x43e7('0x24')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x25')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x26')];}_0x20888b[_0x43e7('0x16')](_0x405f85)[_0x43e7('0x27')](_0x51f4d7);};}exports[_0x43e7('0x28')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={},_0x45b675={},_0x50f9f5={'count':0x0,'rows':[]};var _0x442c3b=_[_0x43e7('0x29')](db[_0x43e7('0x2a')][_0x43e7('0x2b')],function(_0x3bf475){return{'name':_0x3bf475[_0x43e7('0x2c')],'type':_0x3bf475[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x45b675[_0x43e7('0x2f')]=_[_0x43e7('0x29')](_0x442c3b,'name');_0x45b675[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x5087d7[_0x43e7('0x30')]);_0x45b675[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x45b675['model'],_0x45b675[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x34')]=_[_0x43e7('0x33')](_0x45b675[_0x43e7('0x2f')],qs['fields'](_0x5087d7['query']['fields']));_0x4690a6[_0x43e7('0x34')]=_0x4690a6[_0x43e7('0x34')][_0x43e7('0x35')]?_0x4690a6[_0x43e7('0x34')]:_0x45b675[_0x43e7('0x2f')];if(!_0x5087d7[_0x43e7('0x30')]['hasOwnProperty']('nolimit')){_0x4690a6['limit']=qs['limit'](_0x5087d7['query']['limit']);_0x4690a6['offset']=qs[_0x43e7('0x19')](_0x5087d7['query'][_0x43e7('0x19')]);}_0x4690a6[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0x5087d7[_0x43e7('0x30')][_0x43e7('0x37')]);_0x4690a6[_0x43e7('0x38')]=qs[_0x43e7('0x32')](_['pick'](_0x5087d7['query'],_0x45b675['filters']),_0x442c3b);if(_0x5087d7[_0x43e7('0x30')][_0x43e7('0x39')]){_0x4690a6[_0x43e7('0x38')]=_[_0x43e7('0x3a')](_0x4690a6[_0x43e7('0x38')],{'$or':_[_0x43e7('0x29')](_0x442c3b,function(_0x1d4589){if(_0x1d4589[_0x43e7('0x2d')]!=='VIRTUAL'){var _0x61ed8e={};_0x61ed8e[_0x1d4589[_0x43e7('0x26')]]={'$like':'%'+_0x5087d7['query'][_0x43e7('0x39')]+'%'};return _0x61ed8e;}})});}_0x4690a6=_['merge']({},_0x4690a6,_0x5087d7[_0x43e7('0x3b')]);var _0x2ad008={'where':_0x4690a6[_0x43e7('0x38')]};return db[_0x43e7('0x2a')][_0x43e7('0x1c')](_0x2ad008)[_0x43e7('0x3c')](function(_0x5e731b){_0x50f9f5['count']=_0x5e731b;if(_0x5087d7[_0x43e7('0x30')][_0x43e7('0x3d')]){_0x4690a6[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x2a')][_0x43e7('0x3f')](_0x4690a6);})['then'](function(_0x32a451){_0x50f9f5[_0x43e7('0x40')]=_0x32a451;return _0x50f9f5;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x41')](handleError(_0x33a1a5,null));};exports['show']=function(_0x2ad8ef,_0x504101){var _0x3d81ae={'raw':![],'where':{'id':_0x2ad8ef[_0x43e7('0x42')]['id']}},_0x3b4235={};_0x3b4235[_0x43e7('0x2f')]=_['keys'](db['Dynamics365Account'][_0x43e7('0x2b')]);_0x3b4235[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2ad8ef[_0x43e7('0x30')]);_0x3b4235['filters']=_['intersection'](_0x3b4235['model'],_0x3b4235[_0x43e7('0x30')]);_0x3d81ae['attributes']=_[_0x43e7('0x33')](_0x3b4235['model'],qs['fields'](_0x2ad8ef[_0x43e7('0x30')]['fields']));_0x3d81ae[_0x43e7('0x34')]=_0x3d81ae[_0x43e7('0x34')][_0x43e7('0x35')]?_0x3d81ae[_0x43e7('0x34')]:_0x3b4235['model'];if(_0x2ad8ef[_0x43e7('0x30')][_0x43e7('0x3d')]){_0x3d81ae[_0x43e7('0x3e')]=[{'all':!![]}];}_0x3d81ae=_[_0x43e7('0x3a')]({},_0x3d81ae,_0x2ad8ef[_0x43e7('0x3b')]);return db[_0x43e7('0x2a')]['find'](_0x3d81ae)['then'](handleEntityNotFound(_0x504101,null))[_0x43e7('0x3c')](respondWithResult(_0x504101,null))[_0x43e7('0x41')](handleError(_0x504101,null));};exports[_0x43e7('0x43')]=function(_0x4c00a8,_0x5c1c18){return db['Dynamics365Account'][_0x43e7('0x43')](_0x4c00a8[_0x43e7('0x44')],{})['then'](respondWithResult(_0x5c1c18,0xc9))[_0x43e7('0x41')](handleError(_0x5c1c18,null));};exports[_0x43e7('0x22')]=function(_0x3c96fe,_0x560329){if(_0x3c96fe['body']['id']){delete _0x3c96fe['body']['id'];}return db['Dynamics365Account'][_0x43e7('0x45')]({'where':{'id':_0x3c96fe[_0x43e7('0x42')]['id']}})['then'](handleEntityNotFound(_0x560329,null))[_0x43e7('0x3c')](saveUpdates(_0x3c96fe[_0x43e7('0x44')],null))[_0x43e7('0x3c')](respondWithResult(_0x560329,null))[_0x43e7('0x41')](handleError(_0x560329,null));};exports['destroy']=function(_0x2718d5,_0x483f20){return db['Dynamics365Account'][_0x43e7('0x45')]({'where':{'id':_0x2718d5[_0x43e7('0x42')]['id']}})[_0x43e7('0x3c')](handleEntityNotFound(_0x483f20,null))[_0x43e7('0x3c')](removeEntity(_0x483f20,null))[_0x43e7('0x41')](handleError(_0x483f20,null));};exports[_0x43e7('0x46')]=function(_0x1cd87c,_0x256ddd,_0x473fca){var _0x2b5515={};var _0x58dfd0={};var _0x119d34;var _0x46c910;return db['Dynamics365Account'][_0x43e7('0x47')]({'where':{'id':_0x1cd87c['params']['id']}})[_0x43e7('0x3c')](handleEntityNotFound(_0x256ddd,null))[_0x43e7('0x3c')](function(_0x34e2ec){if(_0x34e2ec){_0x119d34=_0x34e2ec;_0x58dfd0[_0x43e7('0x2f')]=_[_0x43e7('0x31')](db['Dynamics365Configuration']['rawAttributes']);_0x58dfd0[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x1cd87c[_0x43e7('0x30')]);_0x58dfd0[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x58dfd0[_0x43e7('0x2f')],_0x58dfd0[_0x43e7('0x30')]);_0x2b5515[_0x43e7('0x34')]=_[_0x43e7('0x33')](_0x58dfd0[_0x43e7('0x2f')],qs[_0x43e7('0x48')](_0x1cd87c['query'][_0x43e7('0x48')]));_0x2b5515[_0x43e7('0x34')]=_0x2b5515['attributes'][_0x43e7('0x35')]?_0x2b5515[_0x43e7('0x34')]:_0x58dfd0[_0x43e7('0x2f')];_0x2b5515['order']=qs['sort'](_0x1cd87c[_0x43e7('0x30')][_0x43e7('0x37')]);_0x2b5515['where']=qs[_0x43e7('0x32')](_['pick'](_0x1cd87c['query'],_0x58dfd0[_0x43e7('0x32')]));if(_0x1cd87c[_0x43e7('0x30')][_0x43e7('0x39')]){_0x2b5515[_0x43e7('0x38')]=_[_0x43e7('0x3a')](_0x2b5515['where'],{'$or':_[_0x43e7('0x29')](_0x2b5515[_0x43e7('0x34')],function(_0x4d89bd){var _0x20283b={};_0x20283b[_0x4d89bd]={'$like':'%'+_0x1cd87c[_0x43e7('0x30')][_0x43e7('0x39')]+'%'};return _0x20283b;})});}_0x2b5515=_['merge']({},_0x2b5515,_0x1cd87c['options']);return _0x119d34['getConfigurations'](_0x2b5515);}})[_0x43e7('0x3c')](function(_0x4058ce){if(_0x4058ce){_0x46c910=_0x4058ce[_0x43e7('0x35')];if(!_0x1cd87c[_0x43e7('0x30')]['hasOwnProperty']('nolimit')){_0x2b5515[_0x43e7('0x1b')]=qs[_0x43e7('0x1b')](_0x1cd87c[_0x43e7('0x30')][_0x43e7('0x1b')]);_0x2b5515['offset']=qs[_0x43e7('0x19')](_0x1cd87c[_0x43e7('0x30')][_0x43e7('0x19')]);}return _0x119d34[_0x43e7('0x46')](_0x2b5515);}})[_0x43e7('0x3c')](function(_0xd41e79){if(_0xd41e79){return _0xd41e79?{'count':_0x46c910,'rows':_0xd41e79}:null;}})[_0x43e7('0x3c')](respondWithResult(_0x256ddd,null))[_0x43e7('0x41')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x381208,_0x252f00,_0x57fdfe){if(_0x381208['body']['id']){delete _0x381208[_0x43e7('0x44')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x381208['params']['id']}})[_0x43e7('0x3c')](handleEntityNotFound(_0x252f00,null))[_0x43e7('0x3c')](function(_0x5d7b37){if(_0x5d7b37){_0x381208[_0x43e7('0x44')][_0x43e7('0x4a')]=_0x5d7b37['id'];_0x381208[_0x43e7('0x44')]['Subjects']=integrations[_0x43e7('0x4b')](_0x381208[_0x43e7('0x44')][_0x43e7('0x4c')],_0x381208[_0x43e7('0x44')][_0x43e7('0x2d')]);_0x381208[_0x43e7('0x44')][_0x43e7('0x4d')]=integrations['getDescriptions'](_0x381208[_0x43e7('0x44')][_0x43e7('0x4c')],_0x381208[_0x43e7('0x44')]['type']);return db['Dynamics365Configuration'][_0x43e7('0x43')](_0x381208['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x43e7('0x4e')},{'model':db[_0x43e7('0x4f')],'as':'Descriptions'}]});}return null;})[_0x43e7('0x3c')](respondWithResult(_0x252f00,null))[_0x43e7('0x41')](handleError(_0x252f00,null));};exports[_0x43e7('0x50')]=function(_0x3401ec,_0x16499c,_0x13ef5c){var _0x398a78=_0x3401ec['query'][_0x43e7('0x51')];var _0x1bb7ad=_0x398a78==='incident'?_0x43e7('0x52'):'PhoneCall';var _0x26ee52='';var _0x248936='';var _0x37301b='';var _0x1ca24b='';var _0x506361='';var _0x2d25b5='';var _0x2646c2='';var _0xf929a5='';var _0x556001=[_0x43e7('0x53'),_0x43e7('0x54'),_0x43e7('0x55'),_0x43e7('0x56'),_0x43e7('0x57'),'subject',_0x43e7('0x58'),_0x43e7('0x59'),_0x43e7('0x5a'),_0x43e7('0x5b')];var _0x433d3c=[_0x43e7('0x5c'),_0x43e7('0x5d'),'actualserviceunits','billedserviceunits',_0x43e7('0x5e'),'contactidyominame','contractdetailidname','contractidname',_0x43e7('0x5f'),_0x43e7('0x60'),_0x43e7('0x61'),_0x43e7('0x62'),_0x43e7('0x63'),_0x43e7('0x64'),'createdonbehalfbyyominame',_0x43e7('0x65'),_0x43e7('0x66'),_0x43e7('0x67'),'emailaddress',_0x43e7('0x68'),_0x43e7('0x69'),_0x43e7('0x6a'),_0x43e7('0x6b'),_0x43e7('0x6c'),_0x43e7('0x6d'),_0x43e7('0x6e'),_0x43e7('0x6f'),'influencescore','kbarticleidname','lastonholdtime',_0x43e7('0x70'),_0x43e7('0x71'),'modifiedbyexternalpartyyominame',_0x43e7('0x72'),_0x43e7('0x73'),_0x43e7('0x74'),_0x43e7('0x75'),'modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname',_0x43e7('0x76'),_0x43e7('0x77'),'overriddencreatedon','owneridname',_0x43e7('0x78'),_0x43e7('0x79'),_0x43e7('0x7a'),'primarycontactidname',_0x43e7('0x7b'),_0x43e7('0x7c'),_0x43e7('0x7d'),_0x43e7('0x7e'),'resolveby',_0x43e7('0x7f'),'responseby',_0x43e7('0x80'),_0x43e7('0x81'),_0x43e7('0x82'),_0x43e7('0x83'),_0x43e7('0x84'),_0x43e7('0x85'),_0x43e7('0x86'),'statuscode',_0x43e7('0x87'),_0x43e7('0x88'),_0x43e7('0x89'),_0x43e7('0x8a'),'traversedpath','utcconversiontimezonecode','versionnumber'];var _0x1262f=_0x556001['concat'](_0x433d3c);return db[_0x43e7('0x2a')][_0x43e7('0x47')]({'where':{'id':_0x3401ec[_0x43e7('0x42')]['id']},'attributes':['id',_0x43e7('0x8b'),_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8e'),_0x43e7('0x8f'),_0x43e7('0x90')]})[_0x43e7('0x3c')](handleEntityNotFound(_0x16499c,null))[_0x43e7('0x3c')](function(_0x5b3565){if(_0x5b3565){_0xf929a5=_0x5b3565[_0x43e7('0x8d')];var _0x1a09ac=_0xf929a5[_0x43e7('0x91')](-0x1);if(_0x1a09ac==='/'){_0xf929a5=_0xf929a5[_0x43e7('0x92')](0x0,_0xf929a5[_0x43e7('0x93')](_0x1a09ac));}_0x2646c2=util['format']('%s/api/data/v9.0/',_0xf929a5);var _0x162a27={'method':_0x43e7('0x94'),'uri':'https://login.microsoftonline.com/'+_0x5b3565[_0x43e7('0x8e')]+_0x43e7('0x95'),'form':{'client_id':_0x5b3565['clientId'],'resource':_0xf929a5,'username':_0x5b3565['username'],'password':_0x5b3565[_0x43e7('0x8c')],'grant_type':_0x43e7('0x8c'),'client_secret':_0x5b3565[_0x43e7('0x90')]},'json':!![]};return rp(_0x162a27);}})[_0x43e7('0x3c')](function(_0x2a4a31){_0x2d25b5=_0x2a4a31['access_token'];var _0x4b50bf={'method':_0x43e7('0x96'),'uri':encodeURI(_0x2646c2+_0x43e7('0x97')+_0x1bb7ad+'\x27'),'headers':{'Authorization':_0x43e7('0x98')+_0x2d25b5,'If-None-Match':null,'OData-Version':_0x43e7('0x99')},'json':!![]};return rp(_0x4b50bf);})['then'](function(_0x45dc61){var _0x96ffb4=_0x45dc61[_0x43e7('0x9a')][0x0];var _0x15ee83=_0x96ffb4['MetadataId'];var _0x3a4962={'method':_0x43e7('0x96'),'uri':_0x2646c2+_0x43e7('0x9b')+_0x15ee83+_0x43e7('0x9c'),'headers':{'Authorization':_0x43e7('0x98')+_0x2d25b5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a4962);})[_0x43e7('0x3c')](function(_0x1edd29){_0x26ee52=_0x1edd29;_0x248936=_0x26ee52['Attributes'];_0x248936=_[_0x43e7('0x9d')](_0x248936,function(_0x2ca6fb){return!_0x1262f[_0x43e7('0x9e')](_0x2ca6fb[_0x43e7('0x9f')]);});var _0x533504=[];var _0x3da183=[];_0x248936['forEach'](function(_0x130b41){if(_0x130b41[_0x43e7('0xa0')]){var _0x1cf302=_0x130b41[_0x43e7('0xa0')][_0x43e7('0x92')](_0x130b41[_0x43e7('0xa0')][_0x43e7('0x93')]('.')+0x1);if(_0x1cf302===_0x43e7('0xa1')){_0x533504[_0x43e7('0xa2')](getSelectList(_0x2646c2,_0x398a78,_0x3da183,_0x26ee52['MetadataId'],_0x130b41[_0x43e7('0xa3')],_0x2d25b5));}}});return Promise[_0x43e7('0xa4')](_0x533504);})[_0x43e7('0x3c')](function(_0x438f41){_0x37301b=_0x438f41[0x0];var _0x56593f=[];var _0x519523=[];_0x248936[_0x43e7('0xa5')](function(_0x3f0367){if(!_[_0x43e7('0xa6')](_0x3f0367['@odata.type'])){var _0x12e7a8=_0x3f0367['@odata.type']['substring'](_0x3f0367['@odata.type'][_0x43e7('0x93')]('.')+0x1);if(_0x12e7a8==='BooleanAttributeMetadata'){_0x56593f[_0x43e7('0xa2')](getBooleanList(_0x2646c2,_0x398a78,_0x519523,_0x26ee52[_0x43e7('0xa3')],_0x3f0367[_0x43e7('0xa3')],_0x2d25b5));}}});return Promise[_0x43e7('0xa4')](_0x56593f);})[_0x43e7('0x3c')](function(_0x482adc){_0x1ca24b=_0x482adc[0x0];var _0x4d64c9=[];var _0x46f1c6=[];_0x248936[_0x43e7('0xa5')](function(_0x589751){if(_0x589751[_0x43e7('0xa0')]){var _0x10fd28=_0x589751[_0x43e7('0xa0')][_0x43e7('0x92')](_0x589751[_0x43e7('0xa0')][_0x43e7('0x93')]('.')+0x1);if(_0x10fd28===_0x43e7('0xa7')||_0x10fd28===_0x43e7('0xa8')||_0x10fd28===_0x43e7('0xa9')||_0x10fd28===_0x43e7('0xaa')||_0x10fd28===_0x43e7('0xab')||_0x10fd28===_0x43e7('0xac')||_0x10fd28===_0x43e7('0xad')||_0x10fd28===_0x43e7('0xae')||_0x10fd28===_0x43e7('0xaf')||_0x10fd28===_0x43e7('0xb0')){_0x4d64c9[_0x43e7('0xa2')](getInputList(_0x2646c2,_0x398a78,_0x10fd28,_0x46f1c6,_0x26ee52[_0x43e7('0xa3')],_0x589751[_0x43e7('0xa3')],_0x2d25b5));}}});return Promise[_0x43e7('0xa4')](_0x4d64c9);})[_0x43e7('0x3c')](function(_0x11f7d8){_0x506361=_0x11f7d8[0x0];var _0x492c2f=_0x37301b[_0x43e7('0xb1')](_0x1ca24b)[_0x43e7('0xb1')](_0x506361);var _0x3a81fc={'count':_0x492c2f[_0x43e7('0x35')],'rows':_0x492c2f};return _0x3a81fc;})['then'](respondWithResult(_0x16499c,null))[_0x43e7('0x41')](function(_0x484978){var _0x3f99a7=_0x3401ec[_0x43e7('0x30')][_0x43e7('0xb2')]?0x1f4:_0x484978[_0x43e7('0xb3')]||0x1f4;logger[_0x43e7('0xb4')](_0x484978[_0x43e7('0x25')]);delete _0x484978['name'];if(_0x3f99a7===0x191){_0x3f99a7=0x190;}_0x16499c[_0x43e7('0x16')](_0x3f99a7)[_0x43e7('0x27')](_0x3401ec[_0x43e7('0x30')][_0x43e7('0xb2')]?{'message':_0x43e7('0xb5'),'statusCode':_0x484978['statusCode']}:_0x484978);});};function getSelectList(_0x59a3f8,_0xcccf84,_0x564639,_0x195e6f,_0x45aef7,_0x35e743){var _0x29ef54={'method':'GET','uri':_0x59a3f8+'EntityDefinitions('+_0x195e6f+')/Attributes('+_0x45aef7+_0x43e7('0xb6')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x35e743,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x29ef54)[_0x43e7('0x3c')](function(_0x1e6ddb){var _0x5308fd=[];var _0x1206db=_0x1e6ddb['OptionSet'][_0x43e7('0xb7')];_0x1206db[_0x43e7('0xa5')](function(_0x271f55){_0x5308fd[_0x43e7('0xa2')]({'name':_0x271f55[_0x43e7('0xb8')]['UserLocalizedLabel'][_0x43e7('0xb8')],'value':String(_0x271f55[_0x43e7('0xb9')])});});var _0xed4879={'id':_0xcccf84+'_'+_0x1e6ddb['LogicalName'],'name':_0x1e6ddb['DisplayName'][_0x43e7('0xba')][_0x43e7('0xb8')],'custom':![],'options':_0x5308fd};_0x564639[_0x43e7('0xa2')](_0xed4879);return _0x564639;});}function getBooleanList(_0x38e116,_0x55e7f2,_0x385cc1,_0x2e18d6,_0x46f08c,_0x56150e){var _0x41a222={'method':_0x43e7('0x96'),'uri':_0x38e116+_0x43e7('0x9b')+_0x2e18d6+_0x43e7('0xbb')+_0x46f08c+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x43e7('0x98')+_0x56150e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x41a222)[_0x43e7('0x3c')](function(_0x244d9d){var _0x47f29f=[];_0x47f29f['push']({'name':_0x244d9d[_0x43e7('0xbc')][_0x43e7('0xbd')][_0x43e7('0xb8')][_0x43e7('0xba')][_0x43e7('0xb8')],'value':_0x43e7('0xbe')},{'name':_0x244d9d[_0x43e7('0xbc')][_0x43e7('0xbf')][_0x43e7('0xb8')][_0x43e7('0xba')][_0x43e7('0xb8')],'value':'false'});var _0x7a46b3={'id':_0x55e7f2+'_'+_0x244d9d['LogicalName'],'name':_0x244d9d[_0x43e7('0xc0')][_0x43e7('0xba')][_0x43e7('0xb8')],'custom':![],'options':_0x47f29f};_0x385cc1['push'](_0x7a46b3);return _0x385cc1;});}function getInputList(_0x153084,_0x111adf,_0x119cd2,_0x352405,_0x5c34b7,_0x266fb1,_0x125dc5){var _0x524dc2={'method':'GET','uri':_0x153084+'EntityDefinitions('+_0x5c34b7+_0x43e7('0xbb')+_0x266fb1+_0x43e7('0xc1')+_0x119cd2+_0x43e7('0xc2'),'headers':{'Authorization':_0x43e7('0x98')+_0x125dc5,'If-None-Match':null,'OData-Version':_0x43e7('0x99')},'json':!![]};return rp(_0x524dc2)[_0x43e7('0x3c')](function(_0x1f5028){var _0xad319d={'id':_0x111adf+'_'+_0x1f5028['LogicalName'],'name':_0x1f5028[_0x43e7('0xc0')][_0x43e7('0xba')]?_0x1f5028[_0x43e7('0xc0')][_0x43e7('0xba')]['Label']:_0x1f5028['LogicalName'],'custom':![],'options':[]};_0x352405[_0x43e7('0xa2')](_0xad319d);return _0x352405;});} \ No newline at end of file +var _0xe93b=['LogicalName','@odata.type','substring','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Label','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','findOne','pick','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','Subjects','getFields','incident','PhoneCall','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridtype','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','slice','lastIndexOf','format','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','Bearer\x20','4.0','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes'];(function(_0x53526b,_0x43a1f8){var _0x2722f6=function(_0x5b5c3b){while(--_0x5b5c3b){_0x53526b['push'](_0x53526b['shift']());}};_0x2722f6(++_0x43a1f8);}(_0xe93b,0x1c2));var _0xbe93=function(_0x41ecb4,_0x5a55e9){_0x41ecb4=_0x41ecb4-0x0;var _0x9f444d=_0xe93b[_0x41ecb4];return _0x9f444d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe93('0x0'));var zipdir=require(_0xbe93('0x1'));var jsonpatch=require(_0xbe93('0x2'));var rp=require('request-promise');var moment=require(_0xbe93('0x3'));var BPromise=require(_0xbe93('0x4'));var Mustache=require(_0xbe93('0x5'));var util=require(_0xbe93('0x6'));var path=require(_0xbe93('0x7'));var sox=require(_0xbe93('0x8'));var csv=require(_0xbe93('0x9'));var ejs=require(_0xbe93('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe93('0xb'));var squel=require(_0xbe93('0xc'));var crypto=require(_0xbe93('0xd'));var jsforce=require(_0xbe93('0xe'));var deskjs=require(_0xbe93('0xf'));var toCsv=require(_0xbe93('0x9'));var querystring=require(_0xbe93('0x10'));var Papa=require(_0xbe93('0x11'));var Redis=require(_0xbe93('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbe93('0x13'));var as=require(_0xbe93('0x14'));var hardwareService=require(_0xbe93('0x15'));var logger=require(_0xbe93('0x16'))(_0xbe93('0x17'));var utils=require(_0xbe93('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbe93('0x19'));var db=require(_0xbe93('0x1a'))['db'];var integrations=require(_0xbe93('0x1b'));function respondWithStatusCode(_0x55df35,_0x52f369){_0x52f369=_0x52f369||0xcc;return function(_0xf87f23){if(_0xf87f23){return _0x55df35[_0xbe93('0x1c')](_0x52f369);}return _0x55df35[_0xbe93('0x1d')](_0x52f369)['end']();};}function respondWithResult(_0x527a2f,_0x24ae1c){_0x24ae1c=_0x24ae1c||0xc8;return function(_0x223a49){if(_0x223a49){return _0x527a2f[_0xbe93('0x1d')](_0x24ae1c)[_0xbe93('0x1e')](_0x223a49);}};}function respondWithFilteredResult(_0x2a4f52,_0x8749fa){return function(_0x4cd008){if(_0x4cd008){var _0x3435e5=typeof _0x8749fa[_0xbe93('0x1f')]==='undefined'&&typeof _0x8749fa[_0xbe93('0x20')]===_0xbe93('0x21');var _0x4c2841=_0x4cd008['count'];var _0x4447d6=_0x3435e5?0x0:_0x8749fa[_0xbe93('0x1f')];var _0x5480c3=_0x3435e5?_0x4cd008[_0xbe93('0x22')]:_0x8749fa[_0xbe93('0x1f')]+_0x8749fa[_0xbe93('0x20')];var _0x40a403;if(_0x5480c3>=_0x4c2841){_0x5480c3=_0x4c2841;_0x40a403=0xc8;}else{_0x40a403=0xce;}_0x2a4f52[_0xbe93('0x1d')](_0x40a403);return _0x2a4f52[_0xbe93('0x23')](_0xbe93('0x24'),_0x4447d6+'-'+_0x5480c3+'/'+_0x4c2841)['json'](_0x4cd008);}return null;};}function patchUpdates(_0x3758c8){return function(_0x46dfc2){try{jsonpatch[_0xbe93('0x25')](_0x46dfc2,_0x3758c8,!![]);}catch(_0xd8ba78){return BPromise[_0xbe93('0x26')](_0xd8ba78);}return _0x46dfc2['save']();};}function saveUpdates(_0x9ff333,_0x1321b8){return function(_0x104f97){if(_0x104f97){return _0x104f97[_0xbe93('0x27')](_0x9ff333)[_0xbe93('0x28')](function(_0x52ae45){return _0x52ae45;});}return null;};}function removeEntity(_0x4d80ac,_0x14629a){return function(_0x1dcc26){if(_0x1dcc26){return _0x1dcc26[_0xbe93('0x29')]()[_0xbe93('0x28')](function(){_0x4d80ac['status'](0xcc)[_0xbe93('0x2a')]();});}};}function handleEntityNotFound(_0x171279,_0x2517eb){return function(_0x43dd32){if(!_0x43dd32){_0x171279[_0xbe93('0x1c')](0x194);}return _0x43dd32;};}function handleError(_0x153d40,_0x34d124){_0x34d124=_0x34d124||0x1f4;return function(_0x2d1de2){logger[_0xbe93('0x2b')](_0x2d1de2[_0xbe93('0x2c')]);if(_0x2d1de2[_0xbe93('0x2d')]){delete _0x2d1de2[_0xbe93('0x2d')];}_0x153d40['status'](_0x34d124)[_0xbe93('0x2e')](_0x2d1de2);};}exports[_0xbe93('0x2f')]=function(_0x3eeeb5,_0x37ef07){var _0x5bf77c={},_0x3fd740={},_0x559e23={'count':0x0,'rows':[]};var _0x5ec553=_[_0xbe93('0x30')](db[_0xbe93('0x31')][_0xbe93('0x32')],function(_0x16bc0f){return{'name':_0x16bc0f['fieldName'],'type':_0x16bc0f['type'][_0xbe93('0x33')]};});_0x3fd740[_0xbe93('0x34')]=_[_0xbe93('0x30')](_0x5ec553,_0xbe93('0x2d'));_0x3fd740[_0xbe93('0x35')]=_[_0xbe93('0x36')](_0x3eeeb5[_0xbe93('0x35')]);_0x3fd740[_0xbe93('0x37')]=_[_0xbe93('0x38')](_0x3fd740[_0xbe93('0x34')],_0x3fd740[_0xbe93('0x35')]);_0x5bf77c[_0xbe93('0x39')]=_['intersection'](_0x3fd740['model'],qs[_0xbe93('0x3a')](_0x3eeeb5[_0xbe93('0x35')][_0xbe93('0x3a')]));_0x5bf77c[_0xbe93('0x39')]=_0x5bf77c[_0xbe93('0x39')]['length']?_0x5bf77c[_0xbe93('0x39')]:_0x3fd740[_0xbe93('0x34')];if(!_0x3eeeb5['query'][_0xbe93('0x3b')](_0xbe93('0x3c'))){_0x5bf77c[_0xbe93('0x20')]=qs[_0xbe93('0x20')](_0x3eeeb5[_0xbe93('0x35')][_0xbe93('0x20')]);_0x5bf77c[_0xbe93('0x1f')]=qs[_0xbe93('0x1f')](_0x3eeeb5['query'][_0xbe93('0x1f')]);}_0x5bf77c[_0xbe93('0x3d')]=qs[_0xbe93('0x3e')](_0x3eeeb5[_0xbe93('0x35')][_0xbe93('0x3e')]);_0x5bf77c[_0xbe93('0x3f')]=qs[_0xbe93('0x37')](_['pick'](_0x3eeeb5[_0xbe93('0x35')],_0x3fd740[_0xbe93('0x37')]),_0x5ec553);if(_0x3eeeb5[_0xbe93('0x35')][_0xbe93('0x40')]){_0x5bf77c[_0xbe93('0x3f')]=_[_0xbe93('0x41')](_0x5bf77c[_0xbe93('0x3f')],{'$or':_[_0xbe93('0x30')](_0x5ec553,function(_0x4d8a37){if(_0x4d8a37[_0xbe93('0x42')]!==_0xbe93('0x43')){var _0x1d3b00={};_0x1d3b00[_0x4d8a37[_0xbe93('0x2d')]]={'$like':'%'+_0x3eeeb5[_0xbe93('0x35')]['filter']+'%'};return _0x1d3b00;}})});}_0x5bf77c=_['merge']({},_0x5bf77c,_0x3eeeb5[_0xbe93('0x44')]);var _0x353998={'where':_0x5bf77c[_0xbe93('0x3f')]};return db[_0xbe93('0x31')][_0xbe93('0x22')](_0x353998)[_0xbe93('0x28')](function(_0x9c0257){_0x559e23[_0xbe93('0x22')]=_0x9c0257;if(_0x3eeeb5['query'][_0xbe93('0x45')]){_0x5bf77c[_0xbe93('0x46')]=[{'all':!![]}];}return db[_0xbe93('0x31')][_0xbe93('0x47')](_0x5bf77c);})['then'](function(_0x475b20){_0x559e23[_0xbe93('0x48')]=_0x475b20;return _0x559e23;})[_0xbe93('0x28')](respondWithFilteredResult(_0x37ef07,_0x5bf77c))[_0xbe93('0x49')](handleError(_0x37ef07,null));};exports['show']=function(_0x116244,_0xc5bdac){var _0x232825={'raw':![],'where':{'id':_0x116244[_0xbe93('0x4a')]['id']}},_0x277daa={};_0x277daa[_0xbe93('0x34')]=_[_0xbe93('0x36')](db['Dynamics365Account'][_0xbe93('0x32')]);_0x277daa[_0xbe93('0x35')]=_[_0xbe93('0x36')](_0x116244[_0xbe93('0x35')]);_0x277daa[_0xbe93('0x37')]=_[_0xbe93('0x38')](_0x277daa[_0xbe93('0x34')],_0x277daa[_0xbe93('0x35')]);_0x232825[_0xbe93('0x39')]=_[_0xbe93('0x38')](_0x277daa[_0xbe93('0x34')],qs['fields'](_0x116244[_0xbe93('0x35')][_0xbe93('0x3a')]));_0x232825[_0xbe93('0x39')]=_0x232825[_0xbe93('0x39')][_0xbe93('0x4b')]?_0x232825['attributes']:_0x277daa[_0xbe93('0x34')];if(_0x116244[_0xbe93('0x35')][_0xbe93('0x45')]){_0x232825[_0xbe93('0x46')]=[{'all':!![]}];}_0x232825=_['merge']({},_0x232825,_0x116244['options']);return db['Dynamics365Account'][_0xbe93('0x4c')](_0x232825)['then'](handleEntityNotFound(_0xc5bdac,null))[_0xbe93('0x28')](respondWithResult(_0xc5bdac,null))[_0xbe93('0x49')](handleError(_0xc5bdac,null));};exports[_0xbe93('0x4d')]=function(_0x532f95,_0x2b208d){return db['Dynamics365Account'][_0xbe93('0x4d')](_0x532f95[_0xbe93('0x4e')],{})[_0xbe93('0x28')](respondWithResult(_0x2b208d,0xc9))[_0xbe93('0x49')](handleError(_0x2b208d,null));};exports['update']=function(_0x3c3bc6,_0x45a021){if(_0x3c3bc6['body']['id']){delete _0x3c3bc6[_0xbe93('0x4e')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x3c3bc6['params']['id']}})[_0xbe93('0x28')](handleEntityNotFound(_0x45a021,null))['then'](saveUpdates(_0x3c3bc6[_0xbe93('0x4e')],null))['then'](respondWithResult(_0x45a021,null))[_0xbe93('0x49')](handleError(_0x45a021,null));};exports['destroy']=function(_0x5893da,_0x4c2d10){return db['Dynamics365Account'][_0xbe93('0x4c')]({'where':{'id':_0x5893da['params']['id']}})[_0xbe93('0x28')](handleEntityNotFound(_0x4c2d10,null))[_0xbe93('0x28')](removeEntity(_0x4c2d10,null))[_0xbe93('0x49')](handleError(_0x4c2d10,null));};exports['getConfigurations']=function(_0x195064,_0xc17d7a,_0x5bd715){var _0xdae31c={};var _0x39fcf8={};var _0x5b2c1f;var _0x1f3cef;return db[_0xbe93('0x31')][_0xbe93('0x4f')]({'where':{'id':_0x195064[_0xbe93('0x4a')]['id']}})[_0xbe93('0x28')](handleEntityNotFound(_0xc17d7a,null))[_0xbe93('0x28')](function(_0x24029){if(_0x24029){_0x5b2c1f=_0x24029;_0x39fcf8[_0xbe93('0x34')]=_[_0xbe93('0x36')](db['Dynamics365Configuration'][_0xbe93('0x32')]);_0x39fcf8['query']=_['keys'](_0x195064[_0xbe93('0x35')]);_0x39fcf8['filters']=_[_0xbe93('0x38')](_0x39fcf8['model'],_0x39fcf8[_0xbe93('0x35')]);_0xdae31c[_0xbe93('0x39')]=_[_0xbe93('0x38')](_0x39fcf8['model'],qs[_0xbe93('0x3a')](_0x195064[_0xbe93('0x35')][_0xbe93('0x3a')]));_0xdae31c['attributes']=_0xdae31c[_0xbe93('0x39')][_0xbe93('0x4b')]?_0xdae31c[_0xbe93('0x39')]:_0x39fcf8[_0xbe93('0x34')];_0xdae31c['order']=qs[_0xbe93('0x3e')](_0x195064[_0xbe93('0x35')][_0xbe93('0x3e')]);_0xdae31c[_0xbe93('0x3f')]=qs[_0xbe93('0x37')](_[_0xbe93('0x50')](_0x195064[_0xbe93('0x35')],_0x39fcf8[_0xbe93('0x37')]));if(_0x195064[_0xbe93('0x35')][_0xbe93('0x40')]){_0xdae31c[_0xbe93('0x3f')]=_[_0xbe93('0x41')](_0xdae31c['where'],{'$or':_[_0xbe93('0x30')](_0xdae31c[_0xbe93('0x39')],function(_0x4b193b){var _0x3a6662={};_0x3a6662[_0x4b193b]={'$like':'%'+_0x195064[_0xbe93('0x35')][_0xbe93('0x40')]+'%'};return _0x3a6662;})});}_0xdae31c=_[_0xbe93('0x41')]({},_0xdae31c,_0x195064['options']);return _0x5b2c1f[_0xbe93('0x51')](_0xdae31c);}})[_0xbe93('0x28')](function(_0x481e22){if(_0x481e22){_0x1f3cef=_0x481e22['length'];if(!_0x195064[_0xbe93('0x35')][_0xbe93('0x3b')](_0xbe93('0x3c'))){_0xdae31c[_0xbe93('0x20')]=qs[_0xbe93('0x20')](_0x195064[_0xbe93('0x35')][_0xbe93('0x20')]);_0xdae31c[_0xbe93('0x1f')]=qs[_0xbe93('0x1f')](_0x195064['query'][_0xbe93('0x1f')]);}return _0x5b2c1f['getConfigurations'](_0xdae31c);}})[_0xbe93('0x28')](function(_0x536ad6){if(_0x536ad6){return _0x536ad6?{'count':_0x1f3cef,'rows':_0x536ad6}:null;}})[_0xbe93('0x28')](respondWithResult(_0xc17d7a,null))['catch'](handleError(_0xc17d7a,null));};exports[_0xbe93('0x52')]=function(_0x6efd83,_0x3da241,_0x16666a){if(_0x6efd83[_0xbe93('0x4e')]['id']){delete _0x6efd83[_0xbe93('0x4e')]['id'];}return db['Dynamics365Account'][_0xbe93('0x4f')]({'where':{'id':_0x6efd83[_0xbe93('0x4a')]['id']}})[_0xbe93('0x28')](handleEntityNotFound(_0x3da241,null))[_0xbe93('0x28')](function(_0x269229){if(_0x269229){_0x6efd83[_0xbe93('0x4e')][_0xbe93('0x53')]=_0x269229['id'];_0x6efd83[_0xbe93('0x4e')]['Subjects']=integrations[_0xbe93('0x54')](_0x6efd83[_0xbe93('0x4e')]['channel'],_0x6efd83['body'][_0xbe93('0x42')]);_0x6efd83[_0xbe93('0x4e')][_0xbe93('0x55')]=integrations[_0xbe93('0x56')](_0x6efd83[_0xbe93('0x4e')][_0xbe93('0x57')],_0x6efd83[_0xbe93('0x4e')]['type']);return db[_0xbe93('0x58')][_0xbe93('0x4d')](_0x6efd83[_0xbe93('0x4e')],{'include':[{'model':db[_0xbe93('0x59')],'as':_0xbe93('0x5a')},{'model':db['Dynamics365Field'],'as':_0xbe93('0x55')}]});}return null;})['then'](respondWithResult(_0x3da241,null))[_0xbe93('0x49')](handleError(_0x3da241,null));};exports[_0xbe93('0x5b')]=function(_0x3b7972,_0x1142a6,_0x4684c1){var _0x5a7a3f=_0x3b7972['query']['ticketType'];var _0x574529=_0x5a7a3f===_0xbe93('0x5c')?'Incident':_0xbe93('0x5d');var _0xf241ad='';var _0x327ca6='';var _0x1f20dc='';var _0x222c3c='';var _0x3c6e49='';var _0x1ba07d='';var _0x4e0e5d='';var _0x377b86='';var _0x61c606=['title',_0xbe93('0x5e'),_0xbe93('0x5f'),_0xbe93('0x60'),'caseorigincode',_0xbe93('0x61'),_0xbe93('0x62'),_0xbe93('0x63'),_0xbe93('0x64'),_0xbe93('0x65')];var _0x4b934d=['accountidname',_0xbe93('0x66'),_0xbe93('0x67'),_0xbe93('0x68'),_0xbe93('0x69'),_0xbe93('0x6a'),'contractdetailidname',_0xbe93('0x6b'),_0xbe93('0x6c'),_0xbe93('0x6d'),_0xbe93('0x6e'),'createdbyyominame',_0xbe93('0x6f'),'createdonbehalfbyname',_0xbe93('0x70'),'customeridname',_0xbe93('0x71'),'customeridyominame',_0xbe93('0x72'),'entitlementidname','entityimage_timestamp',_0xbe93('0x73'),_0xbe93('0x74'),_0xbe93('0x75'),_0xbe93('0x76'),_0xbe93('0x77'),_0xbe93('0x78'),_0xbe93('0x79'),_0xbe93('0x7a'),_0xbe93('0x7b'),_0xbe93('0x7c'),_0xbe93('0x7d'),'modifiedbyexternalpartyyominame',_0xbe93('0x7e'),_0xbe93('0x7f'),_0xbe93('0x80'),_0xbe93('0x81'),'modifiedonbehalfbyyominame',_0xbe93('0x82'),_0xbe93('0x83'),_0xbe93('0x84'),_0xbe93('0x85'),_0xbe93('0x86'),_0xbe93('0x87'),_0xbe93('0x88'),'owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame',_0xbe93('0x89'),_0xbe93('0x8a'),_0xbe93('0x8b'),_0xbe93('0x8c'),_0xbe93('0x8d'),'responseby',_0xbe93('0x8e'),'responsiblecontactidyominame','sentimentvalue',_0xbe93('0x8f'),_0xbe93('0x90'),_0xbe93('0x91'),'statecode',_0xbe93('0x92'),'subjectidname',_0xbe93('0x93'),_0xbe93('0x94'),_0xbe93('0x95'),_0xbe93('0x96'),_0xbe93('0x97'),_0xbe93('0x98')];var _0x2fb4f=_0x61c606[_0xbe93('0x99')](_0x4b934d);return db[_0xbe93('0x31')][_0xbe93('0x4f')]({'where':{'id':_0x3b7972[_0xbe93('0x4a')]['id']},'attributes':['id',_0xbe93('0x9a'),_0xbe93('0x9b'),_0xbe93('0x9c'),'tenantId','clientId',_0xbe93('0x9d')]})['then'](handleEntityNotFound(_0x1142a6,null))[_0xbe93('0x28')](function(_0x5a54f1){if(_0x5a54f1){_0x377b86=_0x5a54f1[_0xbe93('0x9c')];var _0x3e5a22=_0x377b86[_0xbe93('0x9e')](-0x1);if(_0x3e5a22==='/'){_0x377b86=_0x377b86['substring'](0x0,_0x377b86[_0xbe93('0x9f')](_0x3e5a22));}_0x4e0e5d=util[_0xbe93('0xa0')]('%s/api/data/v9.0/',_0x377b86);var _0x490b01={'method':'POST','uri':_0xbe93('0xa1')+_0x5a54f1[_0xbe93('0xa2')]+_0xbe93('0xa3'),'form':{'client_id':_0x5a54f1['clientId'],'resource':_0x377b86,'username':_0x5a54f1[_0xbe93('0x9a')],'password':_0x5a54f1[_0xbe93('0x9b')],'grant_type':_0xbe93('0x9b'),'client_secret':_0x5a54f1[_0xbe93('0x9d')]},'json':!![]};return rp(_0x490b01);}})[_0xbe93('0x28')](function(_0x320432){_0x1ba07d=_0x320432[_0xbe93('0xa4')];var _0x27a03b={'method':'GET','uri':encodeURI(_0x4e0e5d+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x574529+'\x27'),'headers':{'Authorization':_0xbe93('0xa5')+_0x1ba07d,'If-None-Match':null,'OData-Version':_0xbe93('0xa6')},'json':!![]};return rp(_0x27a03b);})[_0xbe93('0x28')](function(_0x384770){var _0x3f8811=_0x384770[_0xbe93('0xa7')][0x0];var _0x44ccc8=_0x3f8811[_0xbe93('0xa8')];var _0x39d1f6={'method':_0xbe93('0xa9'),'uri':_0x4e0e5d+'EntityDefinitions('+_0x44ccc8+_0xbe93('0xaa'),'headers':{'Authorization':_0xbe93('0xa5')+_0x1ba07d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x39d1f6);})[_0xbe93('0x28')](function(_0x4fd942){_0xf241ad=_0x4fd942;_0x327ca6=_0xf241ad[_0xbe93('0xab')];_0x327ca6=_[_0xbe93('0xac')](_0x327ca6,function(_0x4d3bde){return!_0x2fb4f[_0xbe93('0xad')](_0x4d3bde[_0xbe93('0xae')]);});var _0x577f9b=[];var _0x20ae71=[];_0x327ca6['forEach'](function(_0x575ed7){if(_0x575ed7[_0xbe93('0xaf')]){var _0x224245=_0x575ed7['@odata.type'][_0xbe93('0xb0')](_0x575ed7['@odata.type'][_0xbe93('0x9f')]('.')+0x1);if(_0x224245===_0xbe93('0xb1')){_0x577f9b['push'](getSelectList(_0x4e0e5d,_0x5a7a3f,_0x20ae71,_0xf241ad[_0xbe93('0xa8')],_0x575ed7[_0xbe93('0xa8')],_0x1ba07d));}}});return Promise[_0xbe93('0xb2')](_0x577f9b);})['then'](function(_0x58546b){_0x1f20dc=_0x58546b[0x0];var _0x4edc74=[];var _0xc50ea8=[];_0x327ca6[_0xbe93('0xb3')](function(_0x50438){if(!_[_0xbe93('0xb4')](_0x50438[_0xbe93('0xaf')])){var _0x535f87=_0x50438[_0xbe93('0xaf')][_0xbe93('0xb0')](_0x50438[_0xbe93('0xaf')][_0xbe93('0x9f')]('.')+0x1);if(_0x535f87===_0xbe93('0xb5')){_0x4edc74[_0xbe93('0xb6')](getBooleanList(_0x4e0e5d,_0x5a7a3f,_0xc50ea8,_0xf241ad['MetadataId'],_0x50438[_0xbe93('0xa8')],_0x1ba07d));}}});return Promise[_0xbe93('0xb2')](_0x4edc74);})[_0xbe93('0x28')](function(_0x347b77){_0x222c3c=_0x347b77[0x0];var _0x549bee=[];var _0x2e38fc=[];_0x327ca6[_0xbe93('0xb3')](function(_0x4e63f4){if(_0x4e63f4[_0xbe93('0xaf')]){var _0x414f96=_0x4e63f4['@odata.type'][_0xbe93('0xb0')](_0x4e63f4[_0xbe93('0xaf')][_0xbe93('0x9f')]('.')+0x1);if(_0x414f96===_0xbe93('0xb7')||_0x414f96===_0xbe93('0xb8')||_0x414f96===_0xbe93('0xb9')||_0x414f96===_0xbe93('0xba')||_0x414f96===_0xbe93('0xbb')||_0x414f96===_0xbe93('0xbc')||_0x414f96===_0xbe93('0xbd')||_0x414f96===_0xbe93('0xbe')||_0x414f96===_0xbe93('0xbf')||_0x414f96===_0xbe93('0xc0')){_0x549bee[_0xbe93('0xb6')](getInputList(_0x4e0e5d,_0x5a7a3f,_0x414f96,_0x2e38fc,_0xf241ad[_0xbe93('0xa8')],_0x4e63f4['MetadataId'],_0x1ba07d));}}});return Promise[_0xbe93('0xb2')](_0x549bee);})[_0xbe93('0x28')](function(_0x373b34){_0x3c6e49=_0x373b34[0x0];var _0x161984=_0x1f20dc['concat'](_0x222c3c)[_0xbe93('0x99')](_0x3c6e49);var _0x3f2b72={'count':_0x161984['length'],'rows':_0x161984};return _0x3f2b72;})[_0xbe93('0x28')](respondWithResult(_0x1142a6,null))[_0xbe93('0x49')](function(_0xd6960){var _0x5b7cb0=_0x3b7972[_0xbe93('0x35')][_0xbe93('0xc1')]?0x1f4:_0xd6960[_0xbe93('0xc2')]||0x1f4;logger['error'](_0xd6960[_0xbe93('0x2c')]);delete _0xd6960['name'];if(_0x5b7cb0===0x191){_0x5b7cb0=0x190;}_0x1142a6[_0xbe93('0x1d')](_0x5b7cb0)[_0xbe93('0x2e')](_0x3b7972[_0xbe93('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xd6960[_0xbe93('0xc2')]}:_0xd6960);});};function getSelectList(_0x12f528,_0xf90c31,_0x4336da,_0x5b888a,_0x2b5cfe,_0x53c415){var _0x2b300e={'method':_0xbe93('0xa9'),'uri':_0x12f528+_0xbe93('0xc3')+_0x5b888a+')/Attributes('+_0x2b5cfe+_0xbe93('0xc4')+_0xbe93('0xc5'),'headers':{'Authorization':_0xbe93('0xa5')+_0x53c415,'If-None-Match':null,'OData-Version':_0xbe93('0xa6')},'json':!![]};return rp(_0x2b300e)['then'](function(_0x5b4d1a){var _0x57b7d3=[];var _0x33ba23=_0x5b4d1a[_0xbe93('0xc6')]['Options'];_0x33ba23['forEach'](function(_0x377eca){_0x57b7d3[_0xbe93('0xb6')]({'name':_0x377eca['Label'][_0xbe93('0xc7')][_0xbe93('0xc8')],'value':String(_0x377eca['Value'])});});var _0x5bd61c={'id':_0xf90c31+'_'+_0x5b4d1a[_0xbe93('0xae')],'name':_0x5b4d1a[_0xbe93('0xc9')][_0xbe93('0xc7')][_0xbe93('0xc8')],'custom':![],'options':_0x57b7d3};_0x4336da[_0xbe93('0xb6')](_0x5bd61c);return _0x4336da;});}function getBooleanList(_0x200e5b,_0x5851ff,_0x39e883,_0x419fa8,_0x470cd1,_0x22077f){var _0x17ae89={'method':_0xbe93('0xa9'),'uri':_0x200e5b+'EntityDefinitions('+_0x419fa8+_0xbe93('0xca')+_0x470cd1+_0xbe93('0xcb'),'headers':{'Authorization':'Bearer\x20'+_0x22077f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x17ae89)[_0xbe93('0x28')](function(_0x58eb30){var _0x4f3f05=[];_0x4f3f05[_0xbe93('0xb6')]({'name':_0x58eb30[_0xbe93('0xc6')][_0xbe93('0xcc')][_0xbe93('0xc8')]['UserLocalizedLabel'][_0xbe93('0xc8')],'value':_0xbe93('0xcd')},{'name':_0x58eb30[_0xbe93('0xc6')]['FalseOption'][_0xbe93('0xc8')][_0xbe93('0xc7')]['Label'],'value':_0xbe93('0xce')});var _0x2cd9fc={'id':_0x5851ff+'_'+_0x58eb30[_0xbe93('0xae')],'name':_0x58eb30[_0xbe93('0xc9')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4f3f05};_0x39e883['push'](_0x2cd9fc);return _0x39e883;});}function getInputList(_0x4c0007,_0x15ae87,_0x5b827b,_0x429c74,_0x223eb1,_0x25b6f4,_0x1b80af){var _0x2e155a={'method':_0xbe93('0xa9'),'uri':_0x4c0007+_0xbe93('0xc3')+_0x223eb1+')/Attributes('+_0x25b6f4+_0xbe93('0xcf')+_0x5b827b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xbe93('0xa5')+_0x1b80af,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e155a)[_0xbe93('0x28')](function(_0x59841f){var _0x408502={'id':_0x15ae87+'_'+_0x59841f['LogicalName'],'name':_0x59841f[_0xbe93('0xc9')][_0xbe93('0xc7')]?_0x59841f[_0xbe93('0xc9')]['UserLocalizedLabel'][_0xbe93('0xc8')]:_0x59841f[_0xbe93('0xae')],'custom':![],'options':[]};_0x429c74[_0xbe93('0xb6')](_0x408502);return _0x429c74;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 226fd5c..ec14890 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x5c0707,_0x21089e){var _0x3beae2=function(_0x47e9fc){while(--_0x47e9fc){_0x5c0707['push'](_0x5c0707['shift']());}};_0x3beae2(++_0x21089e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x184adc,_0x9680f7){var _0x3d2752=function(_0x41f808){while(--_0x41f808){_0x184adc['push'](_0x184adc['shift']());}};_0x3d2752(++_0x9680f7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb7e7[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ee81d6c..36d0bc1 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 _0x3944=['Dynamics365Account','options','raw','attributes','limit','include','map','model','catch','ShowDynamics365Account','where','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','info','result','GetDynamics365Account'];(function(_0x38fe5c,_0x215e7a){var _0x21a5b4=function(_0x1a6339){while(--_0x1a6339){_0x38fe5c['push'](_0x38fe5c['shift']());}};_0x21a5b4(++_0x215e7a);}(_0x3944,0x138));var _0x4394=function(_0x51dd6e,_0x2a8a3c){_0x51dd6e=_0x51dd6e-0x0;var _0x4235a2=_0x3944[_0x51dd6e];return _0x4235a2;};'use strict';var _=require(_0x4394('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4394('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4394('0x2'));var db=require(_0x4394('0x3'))['db'];var utils=require(_0x4394('0x4'));var logger=require('../../config/logger')(_0x4394('0x5'));var config=require(_0x4394('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4394('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x170c37,_0xe4ecc6,_0xf9224f){return new BPromise(function(_0xa930b6,_0x544d4a){return client[_0x4394('0x8')](_0x170c37,_0xf9224f)[_0x4394('0x9')](function(_0x388385){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xe4ecc6,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xe4ecc6,_0x4394('0xa'),JSON[_0x4394('0xb')](_0x388385));if(_0x388385[_0x4394('0xc')]){if(_0x388385['error']['code']===0x1f4){logger[_0x4394('0xc')](_0x4394('0xd'),_0xe4ecc6,_0x388385[_0x4394('0xc')][_0x4394('0xe')]);return _0x544d4a(_0x388385['error']['message']);}logger[_0x4394('0xc')](_0x4394('0xd'),_0xe4ecc6,_0x388385[_0x4394('0xc')][_0x4394('0xe')]);return _0xa930b6(_0x388385[_0x4394('0xc')][_0x4394('0xe')]);}else{logger[_0x4394('0xf')](_0x4394('0xd'),_0xe4ecc6,_0x4394('0xa'));_0xa930b6(_0x388385[_0x4394('0x10')]['message']);}})['catch'](function(_0x2882bf){logger[_0x4394('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0xe4ecc6,_0x2882bf);_0x544d4a(_0x2882bf);});});}exports[_0x4394('0x11')]=function(_0x77fb23){var _0x479e79=this;return new Promise(function(_0x48f65c,_0x1a3c24){return db[_0x4394('0x12')]['findAll']({'raw':_0x77fb23[_0x4394('0x13')]?_0x77fb23['options'][_0x4394('0x14')]===undefined?!![]:![]:!![],'where':_0x77fb23[_0x4394('0x13')]?_0x77fb23[_0x4394('0x13')]['where']||null:null,'attributes':_0x77fb23['options']?_0x77fb23[_0x4394('0x13')][_0x4394('0x15')]||null:null,'limit':_0x77fb23[_0x4394('0x13')]?_0x77fb23['options'][_0x4394('0x16')]||null:null,'include':_0x77fb23['options']?_0x77fb23[_0x4394('0x13')][_0x4394('0x17')]?_[_0x4394('0x18')](_0x77fb23[_0x4394('0x13')][_0x4394('0x17')],function(_0x165be3){return{'model':db[_0x165be3[_0x4394('0x19')]],'as':_0x165be3['as'],'attributes':_0x165be3['attributes'],'include':_0x165be3[_0x4394('0x17')]?_[_0x4394('0x18')](_0x165be3[_0x4394('0x17')],function(_0x5600df){return{'model':db[_0x5600df[_0x4394('0x19')]],'as':_0x5600df['as'],'attributes':_0x5600df[_0x4394('0x15')],'include':_0x5600df['include']?_['map'](_0x5600df['include'],function(_0x443a26){return{'model':db[_0x443a26['model']],'as':_0x443a26['as'],'attributes':_0x443a26[_0x4394('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x124bfd){logger[_0x4394('0xf')]('GetDynamics365Account',_0x77fb23);logger['debug'](_0x4394('0x11'),_0x77fb23,JSON[_0x4394('0xb')](_0x124bfd));_0x48f65c(_0x124bfd);})[_0x4394('0x1a')](function(_0x5ed028){logger[_0x4394('0xc')]('GetDynamics365Account',_0x5ed028[_0x4394('0xe')],_0x77fb23);_0x1a3c24(_0x479e79['error'](0x1f4,_0x5ed028[_0x4394('0xe')]));});});};exports[_0x4394('0x1b')]=function(_0x129f12){var _0x1cd6d2=this;return new Promise(function(_0x415897,_0x5224e9){return db['Dynamics365Account']['find']({'raw':_0x129f12[_0x4394('0x13')]?_0x129f12[_0x4394('0x13')][_0x4394('0x14')]===undefined?!![]:![]:!![],'where':_0x129f12[_0x4394('0x13')]?_0x129f12['options'][_0x4394('0x1c')]||null:null,'attributes':_0x129f12[_0x4394('0x13')]?_0x129f12[_0x4394('0x13')][_0x4394('0x15')]||null:null,'include':_0x129f12[_0x4394('0x13')]?_0x129f12[_0x4394('0x13')][_0x4394('0x17')]?_[_0x4394('0x18')](_0x129f12['options'][_0x4394('0x17')],function(_0x566aa4){return{'model':db[_0x566aa4[_0x4394('0x19')]],'as':_0x566aa4['as'],'attributes':_0x566aa4['attributes'],'include':_0x566aa4[_0x4394('0x17')]?_[_0x4394('0x18')](_0x566aa4[_0x4394('0x17')],function(_0x5d0120){return{'model':db[_0x5d0120[_0x4394('0x19')]],'as':_0x5d0120['as'],'attributes':_0x5d0120['attributes'],'include':_0x5d0120[_0x4394('0x17')]?_[_0x4394('0x18')](_0x5d0120[_0x4394('0x17')],function(_0x1b2194){return{'model':db[_0x1b2194[_0x4394('0x19')]],'as':_0x1b2194['as'],'attributes':_0x1b2194['attributes']};}):[]};}):[]};}):[]:[]})[_0x4394('0x9')](function(_0x364fd3){logger['info'](_0x4394('0x1b'),_0x129f12);logger[_0x4394('0x1d')](_0x4394('0x1b'),_0x129f12,JSON[_0x4394('0xb')](_0x364fd3));_0x415897(_0x364fd3);})['catch'](function(_0x4659ba){logger[_0x4394('0xc')](_0x4394('0x1b'),_0x4659ba[_0x4394('0xe')],_0x129f12);_0x5224e9(_0x1cd6d2['error'](0x1f4,_0x4659ba[_0x4394('0xe')]));});});}; \ No newline at end of file +var _0x0312=['catch','Dynamics365Account','findAll','options','raw','where','attributes','include','model','map','GetDynamics365Account','debug','find','ShowDynamics365Account','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1610a4,_0x416bf5){var _0x476d45=function(_0x4d409b){while(--_0x4d409b){_0x1610a4['push'](_0x1610a4['shift']());}};_0x476d45(++_0x416bf5);}(_0x0312,0xb8));var _0x2031=function(_0x478c54,_0x52948f){_0x478c54=_0x478c54-0x0;var _0x4048e7=_0x0312[_0x478c54];return _0x4048e7;};'use strict';var _=require(_0x2031('0x0'));var util=require(_0x2031('0x1'));var moment=require('moment');var BPromise=require(_0x2031('0x2'));var rs=require(_0x2031('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2031('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2031('0x5'))(_0x2031('0x6'));var config=require(_0x2031('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2031('0x8')][_0x2031('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd44f87,_0x284c85,_0x549b4b){return new BPromise(function(_0x32a559,_0x44b2ce){return client[_0x2031('0xa')](_0xd44f87,_0x549b4b)[_0x2031('0xb')](function(_0x4ef30d){logger['info'](_0x2031('0xc'),_0x284c85,_0x2031('0xd'));logger['debug'](_0x2031('0xe'),_0x284c85,_0x2031('0xd'),JSON[_0x2031('0xf')](_0x4ef30d));if(_0x4ef30d['error']){if(_0x4ef30d['error']['code']===0x1f4){logger[_0x2031('0x10')](_0x2031('0xc'),_0x284c85,_0x4ef30d[_0x2031('0x10')][_0x2031('0x11')]);return _0x44b2ce(_0x4ef30d[_0x2031('0x10')][_0x2031('0x11')]);}logger[_0x2031('0x10')](_0x2031('0xc'),_0x284c85,_0x4ef30d[_0x2031('0x10')][_0x2031('0x11')]);return _0x32a559(_0x4ef30d['error'][_0x2031('0x11')]);}else{logger[_0x2031('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x284c85,_0x2031('0xd'));_0x32a559(_0x4ef30d[_0x2031('0x13')]['message']);}})[_0x2031('0x14')](function(_0x4ddee5){logger[_0x2031('0x10')](_0x2031('0xc'),_0x284c85,_0x4ddee5);_0x44b2ce(_0x4ddee5);});});}exports['GetDynamics365Account']=function(_0x409d79){var _0x38e969=this;return new Promise(function(_0x3cef11,_0x56b067){return db[_0x2031('0x15')][_0x2031('0x16')]({'raw':_0x409d79[_0x2031('0x17')]?_0x409d79[_0x2031('0x17')][_0x2031('0x18')]===undefined?!![]:![]:!![],'where':_0x409d79[_0x2031('0x17')]?_0x409d79['options'][_0x2031('0x19')]||null:null,'attributes':_0x409d79[_0x2031('0x17')]?_0x409d79['options'][_0x2031('0x1a')]||null:null,'limit':_0x409d79['options']?_0x409d79['options']['limit']||null:null,'include':_0x409d79[_0x2031('0x17')]?_0x409d79[_0x2031('0x17')][_0x2031('0x1b')]?_['map'](_0x409d79[_0x2031('0x17')][_0x2031('0x1b')],function(_0x2e37f3){return{'model':db[_0x2e37f3[_0x2031('0x1c')]],'as':_0x2e37f3['as'],'attributes':_0x2e37f3[_0x2031('0x1a')],'include':_0x2e37f3[_0x2031('0x1b')]?_['map'](_0x2e37f3['include'],function(_0x277ba9){return{'model':db[_0x277ba9['model']],'as':_0x277ba9['as'],'attributes':_0x277ba9[_0x2031('0x1a')],'include':_0x277ba9[_0x2031('0x1b')]?_[_0x2031('0x1d')](_0x277ba9['include'],function(_0x2038bb){return{'model':db[_0x2038bb[_0x2031('0x1c')]],'as':_0x2038bb['as'],'attributes':_0x2038bb[_0x2031('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f37f9){logger['info'](_0x2031('0x1e'),_0x409d79);logger[_0x2031('0x1f')]('GetDynamics365Account',_0x409d79,JSON[_0x2031('0xf')](_0x2f37f9));_0x3cef11(_0x2f37f9);})['catch'](function(_0x40e219){logger[_0x2031('0x10')](_0x2031('0x1e'),_0x40e219[_0x2031('0x11')],_0x409d79);_0x56b067(_0x38e969['error'](0x1f4,_0x40e219[_0x2031('0x11')]));});});};exports['ShowDynamics365Account']=function(_0x2b8909){var _0x4d5c81=this;return new Promise(function(_0x1c5c50,_0x317a2c){return db['Dynamics365Account'][_0x2031('0x20')]({'raw':_0x2b8909[_0x2031('0x17')]?_0x2b8909[_0x2031('0x17')][_0x2031('0x18')]===undefined?!![]:![]:!![],'where':_0x2b8909[_0x2031('0x17')]?_0x2b8909[_0x2031('0x17')][_0x2031('0x19')]||null:null,'attributes':_0x2b8909[_0x2031('0x17')]?_0x2b8909['options'][_0x2031('0x1a')]||null:null,'include':_0x2b8909[_0x2031('0x17')]?_0x2b8909['options']['include']?_['map'](_0x2b8909['options']['include'],function(_0x2ebe6a){return{'model':db[_0x2ebe6a['model']],'as':_0x2ebe6a['as'],'attributes':_0x2ebe6a[_0x2031('0x1a')],'include':_0x2ebe6a[_0x2031('0x1b')]?_['map'](_0x2ebe6a[_0x2031('0x1b')],function(_0x49aa1a){return{'model':db[_0x49aa1a[_0x2031('0x1c')]],'as':_0x49aa1a['as'],'attributes':_0x49aa1a[_0x2031('0x1a')],'include':_0x49aa1a[_0x2031('0x1b')]?_[_0x2031('0x1d')](_0x49aa1a['include'],function(_0x55f4a9){return{'model':db[_0x55f4a9[_0x2031('0x1c')]],'as':_0x55f4a9['as'],'attributes':_0x55f4a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x2031('0xb')](function(_0x2466ad){logger[_0x2031('0x12')](_0x2031('0x21'),_0x2b8909);logger[_0x2031('0x1f')]('ShowDynamics365Account',_0x2b8909,JSON['stringify'](_0x2466ad));_0x1c5c50(_0x2466ad);})[_0x2031('0x14')](function(_0x3f8faf){logger[_0x2031('0x10')](_0x2031('0x21'),_0x3f8faf[_0x2031('0x11')],_0x2b8909);_0x317a2c(_0x4d5c81[_0x2031('0x10')](0x1f4,_0x3f8faf['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6270bf0..5637cc6 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 _0x6380=['/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x46901e,_0x5131d4){var _0x36c296=function(_0x260ee4){while(--_0x260ee4){_0x46901e['push'](_0x46901e['shift']());}};_0x36c296(++_0x5131d4);}(_0x6380,0x159));var _0x0638=function(_0x9299c3,_0x27d4ff){_0x9299c3=_0x9299c3-0x0;var _0x7ca31c=_0x6380[_0x9299c3];return _0x7ca31c;};'use strict';var multer=require('multer');var util=require(_0x0638('0x0'));var path=require(_0x0638('0x1'));var timeout=require(_0x0638('0x2'));var express=require(_0x0638('0x3'));var router=express[_0x0638('0x4')]();var fs_extra=require(_0x0638('0x5'));var auth=require(_0x0638('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0638('0x7'));var controller=require(_0x0638('0x8'));router[_0x0638('0x9')]('/',auth[_0x0638('0xa')](),controller[_0x0638('0xb')]);router[_0x0638('0x9')](_0x0638('0xc'),auth[_0x0638('0xa')](),controller[_0x0638('0xd')]);router[_0x0638('0x9')]('/:id/fields',auth[_0x0638('0xa')](),controller['getFields']);router[_0x0638('0x9')](_0x0638('0xe'),auth[_0x0638('0xa')](),controller['getSubjects']);router['get'](_0x0638('0xf'),auth[_0x0638('0xa')](),controller[_0x0638('0x10')]);router[_0x0638('0x11')]('/',auth[_0x0638('0xa')](),controller[_0x0638('0x12')]);router['put'](_0x0638('0xc'),auth[_0x0638('0xa')](),controller[_0x0638('0x13')]);router['delete'](_0x0638('0xc'),auth[_0x0638('0xa')](),controller['destroy']);module[_0x0638('0x14')]=router; \ No newline at end of file +var _0xb44f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2d7d51,_0x375c2f){var _0x23e7a9=function(_0x41ba3f){while(--_0x41ba3f){_0x2d7d51['push'](_0x2d7d51['shift']());}};_0x23e7a9(++_0x375c2f);}(_0xb44f,0x165));var _0xfb44=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb44f[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xfb44('0x0'));var util=require(_0xfb44('0x1'));var path=require(_0xfb44('0x2'));var timeout=require(_0xfb44('0x3'));var express=require(_0xfb44('0x4'));var router=express[_0xfb44('0x5')]();var fs_extra=require(_0xfb44('0x6'));var auth=require(_0xfb44('0x7'));var interaction=require(_0xfb44('0x8'));var config=require(_0xfb44('0x9'));var controller=require(_0xfb44('0xa'));router['get']('/',auth[_0xfb44('0xb')](),controller['index']);router[_0xfb44('0xc')](_0xfb44('0xd'),auth[_0xfb44('0xb')](),controller[_0xfb44('0xe')]);router[_0xfb44('0xc')](_0xfb44('0xf'),auth[_0xfb44('0xb')](),controller[_0xfb44('0x10')]);router[_0xfb44('0xc')](_0xfb44('0x11'),auth[_0xfb44('0xb')](),controller[_0xfb44('0x12')]);router['get'](_0xfb44('0x13'),auth[_0xfb44('0xb')](),controller[_0xfb44('0x14')]);router[_0xfb44('0x15')]('/',auth[_0xfb44('0xb')](),controller[_0xfb44('0x16')]);router[_0xfb44('0x17')](_0xfb44('0xd'),auth[_0xfb44('0xb')](),controller[_0xfb44('0x18')]);router['delete']('/:id',auth[_0xfb44('0xb')](),controller['destroy']);module[_0xfb44('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d709fe9..6d7043c 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 _0x7177=['incident','sequelize','exports','STRING'];(function(_0x10bc7c,_0x58fb7c){var _0x31bb2c=function(_0x23dbe8){while(--_0x23dbe8){_0x10bc7c['push'](_0x10bc7c['shift']());}};_0x31bb2c(++_0x58fb7c);}(_0x7177,0x1b9));var _0x7717=function(_0x2a5203,_0x42834d){_0x2a5203=_0x2a5203-0x0;var _0x580809=_0x7177[_0x2a5203];return _0x580809;};'use strict';var Sequelize=require(_0x7717('0x0'));module[_0x7717('0x1')]={'name':{'type':Sequelize[_0x7717('0x2')]},'description':{'type':Sequelize[_0x7717('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x7717('0x3'),'phonecall'),'defaultValue':_0x7717('0x3')}}; \ No newline at end of file +var _0xc50d=['phonecall','incident','sequelize','exports','STRING','ENUM'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc50d,0x1b2));var _0xdc50=function(_0x282fab,_0x1739cf){_0x282fab=_0x282fab-0x0;var _0x497b7b=_0xc50d[_0x282fab];return _0x497b7b;};'use strict';var Sequelize=require(_0xdc50('0x0'));module[_0xdc50('0x1')]={'name':{'type':Sequelize[_0xdc50('0x2')]},'description':{'type':Sequelize[_0xdc50('0x2')]},'ticketType':{'type':Sequelize[_0xdc50('0x3')]('incident',_0xdc50('0x4')),'defaultValue':_0xdc50('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1cb7350..da203d5 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 _0xe495=['offset','undefined','limit','count','set','reject','save','then','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','fields','create','body','params','find','getFields','findOne','pick','options','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','sendStatus','status','end','json'];(function(_0x2726ad,_0x5073b1){var _0xd87993=function(_0x1cb35b){while(--_0x1cb35b){_0x2726ad['push'](_0x2726ad['shift']());}};_0xd87993(++_0x5073b1);}(_0xe495,0x119));var _0x5e49=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xe495[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x5e49('0x0'));var rimraf=require(_0x5e49('0x1'));var zipdir=require(_0x5e49('0x2'));var jsonpatch=require(_0x5e49('0x3'));var rp=require(_0x5e49('0x4'));var moment=require(_0x5e49('0x5'));var BPromise=require(_0x5e49('0x6'));var Mustache=require(_0x5e49('0x7'));var util=require(_0x5e49('0x8'));var path=require(_0x5e49('0x9'));var sox=require(_0x5e49('0xa'));var csv=require(_0x5e49('0xb'));var ejs=require(_0x5e49('0xc'));var fs=require('fs');var fs_extra=require(_0x5e49('0xd'));var _=require('lodash');var squel=require(_0x5e49('0xe'));var crypto=require(_0x5e49('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5e49('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5e49('0x11'));var Papa=require(_0x5e49('0x12'));var Redis=require(_0x5e49('0x13'));var authService=require(_0x5e49('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5e49('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e49('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c4d94,_0x189367){_0x189367=_0x189367||0xcc;return function(_0x4e22c8){if(_0x4e22c8){return _0x5c4d94[_0x5e49('0x17')](_0x189367);}return _0x5c4d94[_0x5e49('0x18')](_0x189367)[_0x5e49('0x19')]();};}function respondWithResult(_0xebdd40,_0x59eac9){_0x59eac9=_0x59eac9||0xc8;return function(_0x3ab015){if(_0x3ab015){return _0xebdd40[_0x5e49('0x18')](_0x59eac9)[_0x5e49('0x1a')](_0x3ab015);}};}function respondWithFilteredResult(_0x4671ba,_0x341f20){return function(_0x369d9e){if(_0x369d9e){var _0x384db8=typeof _0x341f20[_0x5e49('0x1b')]===_0x5e49('0x1c')&&typeof _0x341f20[_0x5e49('0x1d')]===_0x5e49('0x1c');var _0x33bb35=_0x369d9e['count'];var _0x494bd6=_0x384db8?0x0:_0x341f20[_0x5e49('0x1b')];var _0x55028c=_0x384db8?_0x369d9e[_0x5e49('0x1e')]:_0x341f20[_0x5e49('0x1b')]+_0x341f20[_0x5e49('0x1d')];var _0x3e8327;if(_0x55028c>=_0x33bb35){_0x55028c=_0x33bb35;_0x3e8327=0xc8;}else{_0x3e8327=0xce;}_0x4671ba[_0x5e49('0x18')](_0x3e8327);return _0x4671ba[_0x5e49('0x1f')]('Content-Range',_0x494bd6+'-'+_0x55028c+'/'+_0x33bb35)[_0x5e49('0x1a')](_0x369d9e);}return null;};}function patchUpdates(_0x738614){return function(_0x541613){try{jsonpatch['apply'](_0x541613,_0x738614,!![]);}catch(_0x417f8f){return BPromise[_0x5e49('0x20')](_0x417f8f);}return _0x541613[_0x5e49('0x21')]();};}function saveUpdates(_0x39973b,_0x4dd5fe){return function(_0x31d410){if(_0x31d410){return _0x31d410['update'](_0x39973b)[_0x5e49('0x22')](function(_0x3aee21){return _0x3aee21;});}return null;};}function removeEntity(_0x274242,_0x2a7ae0){return function(_0x1050a4){if(_0x1050a4){return _0x1050a4[_0x5e49('0x23')]()['then'](function(){_0x274242[_0x5e49('0x18')](0xcc)[_0x5e49('0x19')]();});}};}function handleEntityNotFound(_0x1f5d98,_0x2d5b6e){return function(_0x17755c){if(!_0x17755c){_0x1f5d98[_0x5e49('0x17')](0x194);}return _0x17755c;};}function handleError(_0x24e0b9,_0x51d680){_0x51d680=_0x51d680||0x1f4;return function(_0x27c33b){logger['error'](_0x27c33b[_0x5e49('0x24')]);if(_0x27c33b[_0x5e49('0x25')]){delete _0x27c33b[_0x5e49('0x25')];}_0x24e0b9[_0x5e49('0x18')](_0x51d680)[_0x5e49('0x26')](_0x27c33b);};}exports[_0x5e49('0x27')]=function(_0x57de9e,_0x5bd91f){var _0x4f4e57={},_0x4a844f={},_0x4d06c7={'count':0x0,'rows':[]};var _0x2cadd5=_[_0x5e49('0x28')](db[_0x5e49('0x29')][_0x5e49('0x2a')],function(_0x537867){return{'name':_0x537867[_0x5e49('0x2b')],'type':_0x537867[_0x5e49('0x2c')][_0x5e49('0x2d')]};});_0x4a844f[_0x5e49('0x2e')]=_[_0x5e49('0x28')](_0x2cadd5,_0x5e49('0x25'));_0x4a844f['query']=_[_0x5e49('0x2f')](_0x57de9e[_0x5e49('0x30')]);_0x4a844f[_0x5e49('0x31')]=_[_0x5e49('0x32')](_0x4a844f[_0x5e49('0x2e')],_0x4a844f[_0x5e49('0x30')]);_0x4f4e57['attributes']=_['intersection'](_0x4a844f['model'],qs['fields'](_0x57de9e[_0x5e49('0x30')]['fields']));_0x4f4e57[_0x5e49('0x33')]=_0x4f4e57[_0x5e49('0x33')][_0x5e49('0x34')]?_0x4f4e57[_0x5e49('0x33')]:_0x4a844f['model'];if(!_0x57de9e[_0x5e49('0x30')][_0x5e49('0x35')](_0x5e49('0x36'))){_0x4f4e57[_0x5e49('0x1d')]=qs[_0x5e49('0x1d')](_0x57de9e[_0x5e49('0x30')][_0x5e49('0x1d')]);_0x4f4e57['offset']=qs[_0x5e49('0x1b')](_0x57de9e[_0x5e49('0x30')]['offset']);}_0x4f4e57[_0x5e49('0x37')]=qs[_0x5e49('0x38')](_0x57de9e[_0x5e49('0x30')]['sort']);_0x4f4e57[_0x5e49('0x39')]=qs[_0x5e49('0x31')](_['pick'](_0x57de9e[_0x5e49('0x30')],_0x4a844f[_0x5e49('0x31')]),_0x2cadd5);if(_0x57de9e['query'][_0x5e49('0x3a')]){_0x4f4e57[_0x5e49('0x39')]=_[_0x5e49('0x3b')](_0x4f4e57[_0x5e49('0x39')],{'$or':_['map'](_0x2cadd5,function(_0x1013e6){if(_0x1013e6[_0x5e49('0x2c')]!==_0x5e49('0x3c')){var _0x5c60d5={};_0x5c60d5[_0x1013e6[_0x5e49('0x25')]]={'$like':'%'+_0x57de9e[_0x5e49('0x30')]['filter']+'%'};return _0x5c60d5;}})});}_0x4f4e57=_[_0x5e49('0x3b')]({},_0x4f4e57,_0x57de9e['options']);var _0x3fd91a={'where':_0x4f4e57[_0x5e49('0x39')]};return db[_0x5e49('0x29')]['count'](_0x3fd91a)['then'](function(_0x1909dd){_0x4d06c7[_0x5e49('0x1e')]=_0x1909dd;if(_0x57de9e[_0x5e49('0x30')][_0x5e49('0x3d')]){_0x4f4e57[_0x5e49('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x4f4e57);})[_0x5e49('0x22')](function(_0x2df452){_0x4d06c7[_0x5e49('0x3f')]=_0x2df452;return _0x4d06c7;})[_0x5e49('0x22')](respondWithFilteredResult(_0x5bd91f,_0x4f4e57))[_0x5e49('0x40')](handleError(_0x5bd91f,null));};exports['show']=function(_0x42235e,_0x1dafc8){var _0x30f5fc={'raw':![],'where':{'id':_0x42235e['params']['id']}},_0x1246d6={};_0x1246d6[_0x5e49('0x2e')]=_[_0x5e49('0x2f')](db[_0x5e49('0x29')][_0x5e49('0x2a')]);_0x1246d6[_0x5e49('0x30')]=_[_0x5e49('0x2f')](_0x42235e[_0x5e49('0x30')]);_0x1246d6[_0x5e49('0x31')]=_[_0x5e49('0x32')](_0x1246d6['model'],_0x1246d6['query']);_0x30f5fc['attributes']=_[_0x5e49('0x32')](_0x1246d6['model'],qs[_0x5e49('0x41')](_0x42235e['query']['fields']));_0x30f5fc[_0x5e49('0x33')]=_0x30f5fc[_0x5e49('0x33')][_0x5e49('0x34')]?_0x30f5fc[_0x5e49('0x33')]:_0x1246d6[_0x5e49('0x2e')];if(_0x42235e['query'][_0x5e49('0x3d')]){_0x30f5fc[_0x5e49('0x3e')]=[{'all':!![]}];}_0x30f5fc=_[_0x5e49('0x3b')]({},_0x30f5fc,_0x42235e['options']);return db[_0x5e49('0x29')]['find'](_0x30f5fc)[_0x5e49('0x22')](handleEntityNotFound(_0x1dafc8,null))[_0x5e49('0x22')](respondWithResult(_0x1dafc8,null))['catch'](handleError(_0x1dafc8,null));};exports[_0x5e49('0x42')]=function(_0xf8650b,_0x16dd27){return db[_0x5e49('0x29')][_0x5e49('0x42')](_0xf8650b[_0x5e49('0x43')],{})['then'](respondWithResult(_0x16dd27,0xc9))[_0x5e49('0x40')](handleError(_0x16dd27,null));};exports['update']=function(_0x1fbf3a,_0x47f074){if(_0x1fbf3a['body']['id']){delete _0x1fbf3a[_0x5e49('0x43')]['id'];}return db[_0x5e49('0x29')]['find']({'where':{'id':_0x1fbf3a[_0x5e49('0x44')]['id']}})[_0x5e49('0x22')](handleEntityNotFound(_0x47f074,null))[_0x5e49('0x22')](saveUpdates(_0x1fbf3a[_0x5e49('0x43')],null))['then'](respondWithResult(_0x47f074,null))['catch'](handleError(_0x47f074,null));};exports[_0x5e49('0x23')]=function(_0x31707b,_0x3e0c57){return db['Dynamics365Configuration'][_0x5e49('0x45')]({'where':{'id':_0x31707b[_0x5e49('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e0c57,null))[_0x5e49('0x22')](removeEntity(_0x3e0c57,null))[_0x5e49('0x40')](handleError(_0x3e0c57,null));};exports[_0x5e49('0x46')]=function(_0x975f72,_0x147aaa,_0x1c4e51){var _0x1211da={};var _0x2bc83d={};var _0xeb5bea;var _0x5b0d4f;return db[_0x5e49('0x29')][_0x5e49('0x47')]({'where':{'id':_0x975f72[_0x5e49('0x44')]['id']}})[_0x5e49('0x22')](handleEntityNotFound(_0x147aaa,null))[_0x5e49('0x22')](function(_0x279549){if(_0x279549){_0xeb5bea=_0x279549;_0x2bc83d['model']=_['keys'](db['Dynamics365Field'][_0x5e49('0x2a')]);_0x2bc83d[_0x5e49('0x30')]=_[_0x5e49('0x2f')](_0x975f72[_0x5e49('0x30')]);_0x2bc83d['filters']=_['intersection'](_0x2bc83d[_0x5e49('0x2e')],_0x2bc83d[_0x5e49('0x30')]);_0x1211da[_0x5e49('0x33')]=_[_0x5e49('0x32')](_0x2bc83d['model'],qs['fields'](_0x975f72['query'][_0x5e49('0x41')]));_0x1211da['attributes']=_0x1211da[_0x5e49('0x33')]['length']?_0x1211da[_0x5e49('0x33')]:_0x2bc83d[_0x5e49('0x2e')];_0x1211da['order']=qs[_0x5e49('0x38')](_0x975f72[_0x5e49('0x30')]['sort']);_0x1211da['where']=qs[_0x5e49('0x31')](_[_0x5e49('0x48')](_0x975f72[_0x5e49('0x30')],_0x2bc83d[_0x5e49('0x31')]));if(_0x975f72['query'][_0x5e49('0x3a')]){_0x1211da[_0x5e49('0x39')]=_['merge'](_0x1211da[_0x5e49('0x39')],{'$or':_['map'](_0x1211da[_0x5e49('0x33')],function(_0xb4968a){var _0x90dae={};_0x90dae[_0xb4968a]={'$like':'%'+_0x975f72['query']['filter']+'%'};return _0x90dae;})});}_0x1211da=_[_0x5e49('0x3b')]({},_0x1211da,_0x975f72['options']);return _0xeb5bea[_0x5e49('0x46')](_0x1211da);}})[_0x5e49('0x22')](function(_0x5b863a){if(_0x5b863a){_0x5b0d4f=_0x5b863a[_0x5e49('0x34')];if(!_0x975f72[_0x5e49('0x30')]['hasOwnProperty'](_0x5e49('0x36'))){_0x1211da[_0x5e49('0x1d')]=qs['limit'](_0x975f72[_0x5e49('0x30')][_0x5e49('0x1d')]);_0x1211da[_0x5e49('0x1b')]=qs[_0x5e49('0x1b')](_0x975f72['query'][_0x5e49('0x1b')]);}return _0xeb5bea[_0x5e49('0x46')](_0x1211da);}})[_0x5e49('0x22')](function(_0x3e63bc){if(_0x3e63bc){return _0x3e63bc?{'count':_0x5b0d4f,'rows':_0x3e63bc}:null;}})['then'](respondWithResult(_0x147aaa,null))[_0x5e49('0x40')](handleError(_0x147aaa,null));};exports['getSubjects']=function(_0x2ad645,_0x1a5058,_0xf8c27a){var _0x4a0934={};var _0xc8eb40={};var _0xd5063f;var _0x22d3b2;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2ad645[_0x5e49('0x44')]['id']}})[_0x5e49('0x22')](handleEntityNotFound(_0x1a5058,null))[_0x5e49('0x22')](function(_0x155d85){if(_0x155d85){_0xd5063f=_0x155d85;_0xc8eb40[_0x5e49('0x2e')]=_[_0x5e49('0x2f')](db['Dynamics365Field'][_0x5e49('0x2a')]);_0xc8eb40['query']=_[_0x5e49('0x2f')](_0x2ad645[_0x5e49('0x30')]);_0xc8eb40['filters']=_[_0x5e49('0x32')](_0xc8eb40[_0x5e49('0x2e')],_0xc8eb40[_0x5e49('0x30')]);_0x4a0934[_0x5e49('0x33')]=_['intersection'](_0xc8eb40[_0x5e49('0x2e')],qs[_0x5e49('0x41')](_0x2ad645[_0x5e49('0x30')][_0x5e49('0x41')]));_0x4a0934['attributes']=_0x4a0934[_0x5e49('0x33')][_0x5e49('0x34')]?_0x4a0934[_0x5e49('0x33')]:_0xc8eb40['model'];_0x4a0934[_0x5e49('0x37')]=qs[_0x5e49('0x38')](_0x2ad645['query'][_0x5e49('0x38')]);_0x4a0934[_0x5e49('0x39')]=qs[_0x5e49('0x31')](_[_0x5e49('0x48')](_0x2ad645['query'],_0xc8eb40['filters']));if(_0x2ad645[_0x5e49('0x30')][_0x5e49('0x3a')]){_0x4a0934[_0x5e49('0x39')]=_[_0x5e49('0x3b')](_0x4a0934[_0x5e49('0x39')],{'$or':_[_0x5e49('0x28')](_0x4a0934[_0x5e49('0x33')],function(_0x50b8f4){var _0x148251={};_0x148251[_0x50b8f4]={'$like':'%'+_0x2ad645[_0x5e49('0x30')]['filter']+'%'};return _0x148251;})});}_0x4a0934=_[_0x5e49('0x3b')]({},_0x4a0934,_0x2ad645[_0x5e49('0x49')]);return _0xd5063f[_0x5e49('0x4a')](_0x4a0934);}})[_0x5e49('0x22')](function(_0x239de9){if(_0x239de9){_0x22d3b2=_0x239de9[_0x5e49('0x34')];if(!_0x2ad645['query']['hasOwnProperty']('nolimit')){_0x4a0934['limit']=qs[_0x5e49('0x1d')](_0x2ad645[_0x5e49('0x30')][_0x5e49('0x1d')]);_0x4a0934['offset']=qs[_0x5e49('0x1b')](_0x2ad645[_0x5e49('0x30')][_0x5e49('0x1b')]);}return _0xd5063f[_0x5e49('0x4a')](_0x4a0934);}})[_0x5e49('0x22')](function(_0x145104){if(_0x145104){return _0x145104?{'count':_0x22d3b2,'rows':_0x145104}:null;}})[_0x5e49('0x22')](respondWithResult(_0x1a5058,null))['catch'](handleError(_0x1a5058,null));};exports['getDescriptions']=function(_0x28a86d,_0x5266d5,_0x38867a){var _0x23180d={};var _0x4c2172={};var _0x38cdf6;var _0x7786a;return db[_0x5e49('0x29')][_0x5e49('0x47')]({'where':{'id':_0x28a86d['params']['id']}})[_0x5e49('0x22')](handleEntityNotFound(_0x5266d5,null))[_0x5e49('0x22')](function(_0x20fc58){if(_0x20fc58){_0x38cdf6=_0x20fc58;_0x4c2172[_0x5e49('0x2e')]=_[_0x5e49('0x2f')](db[_0x5e49('0x4b')][_0x5e49('0x2a')]);_0x4c2172[_0x5e49('0x30')]=_[_0x5e49('0x2f')](_0x28a86d[_0x5e49('0x30')]);_0x4c2172[_0x5e49('0x31')]=_['intersection'](_0x4c2172['model'],_0x4c2172['query']);_0x23180d[_0x5e49('0x33')]=_[_0x5e49('0x32')](_0x4c2172[_0x5e49('0x2e')],qs['fields'](_0x28a86d[_0x5e49('0x30')]['fields']));_0x23180d[_0x5e49('0x33')]=_0x23180d[_0x5e49('0x33')]['length']?_0x23180d[_0x5e49('0x33')]:_0x4c2172['model'];_0x23180d[_0x5e49('0x37')]=qs[_0x5e49('0x38')](_0x28a86d[_0x5e49('0x30')][_0x5e49('0x38')]);_0x23180d['where']=qs['filters'](_['pick'](_0x28a86d[_0x5e49('0x30')],_0x4c2172[_0x5e49('0x31')]));if(_0x28a86d[_0x5e49('0x30')][_0x5e49('0x3a')]){_0x23180d[_0x5e49('0x39')]=_[_0x5e49('0x3b')](_0x23180d[_0x5e49('0x39')],{'$or':_[_0x5e49('0x28')](_0x23180d[_0x5e49('0x33')],function(_0x4b12fc){var _0x2bf2de={};_0x2bf2de[_0x4b12fc]={'$like':'%'+_0x28a86d['query'][_0x5e49('0x3a')]+'%'};return _0x2bf2de;})});}_0x23180d=_[_0x5e49('0x3b')]({},_0x23180d,_0x28a86d[_0x5e49('0x49')]);return _0x38cdf6[_0x5e49('0x4c')](_0x23180d);}})[_0x5e49('0x22')](function(_0xe5924e){if(_0xe5924e){_0x7786a=_0xe5924e[_0x5e49('0x34')];if(!_0x28a86d[_0x5e49('0x30')][_0x5e49('0x35')](_0x5e49('0x36'))){_0x23180d[_0x5e49('0x1d')]=qs[_0x5e49('0x1d')](_0x28a86d[_0x5e49('0x30')]['limit']);_0x23180d[_0x5e49('0x1b')]=qs[_0x5e49('0x1b')](_0x28a86d[_0x5e49('0x30')]['offset']);}return _0x38cdf6[_0x5e49('0x4c')](_0x23180d);}})[_0x5e49('0x22')](function(_0x139091){if(_0x139091){return _0x139091?{'count':_0x7786a,'rows':_0x139091}:null;}})[_0x5e49('0x22')](respondWithResult(_0x5266d5,null))[_0x5e49('0x40')](handleError(_0x5266d5,null));}; \ No newline at end of file +var _0xc88e=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','Dynamics365Configuration','rawAttributes','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','limit','order','where','pick','filter','type','merge','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','getFields','findOne','Dynamics365Field','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc88e,0x1d4));var _0xec88=function(_0x2b4fe9,_0x381c5f){_0x2b4fe9=_0x2b4fe9-0x0;var _0x1e2ba8=_0xc88e[_0x2b4fe9];return _0x1e2ba8;};'use strict';var emlformat=require(_0xec88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec88('0x1'));var jsonpatch=require(_0xec88('0x2'));var rp=require(_0xec88('0x3'));var moment=require(_0xec88('0x4'));var BPromise=require(_0xec88('0x5'));var Mustache=require(_0xec88('0x6'));var util=require(_0xec88('0x7'));var path=require(_0xec88('0x8'));var sox=require(_0xec88('0x9'));var csv=require('to-csv');var ejs=require(_0xec88('0xa'));var fs=require('fs');var fs_extra=require(_0xec88('0xb'));var _=require(_0xec88('0xc'));var squel=require(_0xec88('0xd'));var crypto=require('crypto');var jsforce=require(_0xec88('0xe'));var deskjs=require(_0xec88('0xf'));var toCsv=require(_0xec88('0x10'));var querystring=require(_0xec88('0x11'));var Papa=require(_0xec88('0x12'));var Redis=require(_0xec88('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec88('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xec88('0x15'));var config=require(_0xec88('0x16'));var licenseUtil=require(_0xec88('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12e83a,_0x243a9b){_0x243a9b=_0x243a9b||0xcc;return function(_0x50706a){if(_0x50706a){return _0x12e83a[_0xec88('0x18')](_0x243a9b);}return _0x12e83a['status'](_0x243a9b)[_0xec88('0x19')]();};}function respondWithResult(_0x4eaeda,_0x227c37){_0x227c37=_0x227c37||0xc8;return function(_0x49c174){if(_0x49c174){return _0x4eaeda[_0xec88('0x1a')](_0x227c37)[_0xec88('0x1b')](_0x49c174);}};}function respondWithFilteredResult(_0x22bd3a,_0x484de3){return function(_0x42983f){if(_0x42983f){var _0x59c3f3=typeof _0x484de3['offset']==='undefined'&&typeof _0x484de3['limit']==='undefined';var _0x537041=_0x42983f[_0xec88('0x1c')];var _0x2c5d12=_0x59c3f3?0x0:_0x484de3[_0xec88('0x1d')];var _0x3bf552=_0x59c3f3?_0x42983f['count']:_0x484de3['offset']+_0x484de3['limit'];var _0x185c4f;if(_0x3bf552>=_0x537041){_0x3bf552=_0x537041;_0x185c4f=0xc8;}else{_0x185c4f=0xce;}_0x22bd3a[_0xec88('0x1a')](_0x185c4f);return _0x22bd3a[_0xec88('0x1e')](_0xec88('0x1f'),_0x2c5d12+'-'+_0x3bf552+'/'+_0x537041)[_0xec88('0x1b')](_0x42983f);}return null;};}function patchUpdates(_0x539049){return function(_0x21f601){try{jsonpatch[_0xec88('0x20')](_0x21f601,_0x539049,!![]);}catch(_0x20f6f0){return BPromise[_0xec88('0x21')](_0x20f6f0);}return _0x21f601[_0xec88('0x22')]();};}function saveUpdates(_0x3447ad,_0x107783){return function(_0x4e7c38){if(_0x4e7c38){return _0x4e7c38[_0xec88('0x23')](_0x3447ad)[_0xec88('0x24')](function(_0x9fa202){return _0x9fa202;});}return null;};}function removeEntity(_0x4b7a36,_0x4be7f8){return function(_0x4897fc){if(_0x4897fc){return _0x4897fc[_0xec88('0x25')]()[_0xec88('0x24')](function(){_0x4b7a36['status'](0xcc)[_0xec88('0x19')]();});}};}function handleEntityNotFound(_0x1e1dcc,_0x14b34e){return function(_0x9809f7){if(!_0x9809f7){_0x1e1dcc[_0xec88('0x18')](0x194);}return _0x9809f7;};}function handleError(_0x3e3ca0,_0x5ac3d2){_0x5ac3d2=_0x5ac3d2||0x1f4;return function(_0x2df090){logger[_0xec88('0x26')](_0x2df090['stack']);if(_0x2df090['name']){delete _0x2df090[_0xec88('0x27')];}_0x3e3ca0[_0xec88('0x1a')](_0x5ac3d2)[_0xec88('0x28')](_0x2df090);};}exports['index']=function(_0xac6ddc,_0x22377c){var _0x2fa09d={},_0x1ff5be={},_0x3bc784={'count':0x0,'rows':[]};var _0x216a8e=_['map'](db[_0xec88('0x29')][_0xec88('0x2a')],function(_0x25fbf6){return{'name':_0x25fbf6[_0xec88('0x2b')],'type':_0x25fbf6['type'][_0xec88('0x2c')]};});_0x1ff5be['model']=_[_0xec88('0x2d')](_0x216a8e,_0xec88('0x27'));_0x1ff5be['query']=_['keys'](_0xac6ddc[_0xec88('0x2e')]);_0x1ff5be[_0xec88('0x2f')]=_[_0xec88('0x30')](_0x1ff5be['model'],_0x1ff5be['query']);_0x2fa09d[_0xec88('0x31')]=_[_0xec88('0x30')](_0x1ff5be[_0xec88('0x32')],qs[_0xec88('0x33')](_0xac6ddc[_0xec88('0x2e')]['fields']));_0x2fa09d[_0xec88('0x31')]=_0x2fa09d[_0xec88('0x31')][_0xec88('0x34')]?_0x2fa09d[_0xec88('0x31')]:_0x1ff5be[_0xec88('0x32')];if(!_0xac6ddc[_0xec88('0x2e')]['hasOwnProperty'](_0xec88('0x35'))){_0x2fa09d[_0xec88('0x36')]=qs[_0xec88('0x36')](_0xac6ddc[_0xec88('0x2e')]['limit']);_0x2fa09d['offset']=qs['offset'](_0xac6ddc[_0xec88('0x2e')][_0xec88('0x1d')]);}_0x2fa09d[_0xec88('0x37')]=qs['sort'](_0xac6ddc[_0xec88('0x2e')]['sort']);_0x2fa09d[_0xec88('0x38')]=qs[_0xec88('0x2f')](_[_0xec88('0x39')](_0xac6ddc[_0xec88('0x2e')],_0x1ff5be[_0xec88('0x2f')]),_0x216a8e);if(_0xac6ddc['query'][_0xec88('0x3a')]){_0x2fa09d[_0xec88('0x38')]=_['merge'](_0x2fa09d[_0xec88('0x38')],{'$or':_[_0xec88('0x2d')](_0x216a8e,function(_0x10f210){if(_0x10f210[_0xec88('0x3b')]!=='VIRTUAL'){var _0x48d0ec={};_0x48d0ec[_0x10f210[_0xec88('0x27')]]={'$like':'%'+_0xac6ddc[_0xec88('0x2e')][_0xec88('0x3a')]+'%'};return _0x48d0ec;}})});}_0x2fa09d=_[_0xec88('0x3c')]({},_0x2fa09d,_0xac6ddc[_0xec88('0x3d')]);var _0x33fdad={'where':_0x2fa09d['where']};return db[_0xec88('0x29')][_0xec88('0x1c')](_0x33fdad)['then'](function(_0x186da9){_0x3bc784[_0xec88('0x1c')]=_0x186da9;if(_0xac6ddc[_0xec88('0x2e')]['includeAll']){_0x2fa09d[_0xec88('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xec88('0x3f')](_0x2fa09d);})[_0xec88('0x24')](function(_0x497c89){_0x3bc784[_0xec88('0x40')]=_0x497c89;return _0x3bc784;})[_0xec88('0x24')](respondWithFilteredResult(_0x22377c,_0x2fa09d))['catch'](handleError(_0x22377c,null));};exports[_0xec88('0x41')]=function(_0x37f651,_0x17a9d2){var _0x17aa98={'raw':![],'where':{'id':_0x37f651[_0xec88('0x42')]['id']}},_0x3742e4={};_0x3742e4[_0xec88('0x32')]=_[_0xec88('0x43')](db['Dynamics365Configuration'][_0xec88('0x2a')]);_0x3742e4['query']=_[_0xec88('0x43')](_0x37f651[_0xec88('0x2e')]);_0x3742e4[_0xec88('0x2f')]=_[_0xec88('0x30')](_0x3742e4['model'],_0x3742e4[_0xec88('0x2e')]);_0x17aa98[_0xec88('0x31')]=_[_0xec88('0x30')](_0x3742e4[_0xec88('0x32')],qs[_0xec88('0x33')](_0x37f651[_0xec88('0x2e')][_0xec88('0x33')]));_0x17aa98[_0xec88('0x31')]=_0x17aa98[_0xec88('0x31')]['length']?_0x17aa98[_0xec88('0x31')]:_0x3742e4[_0xec88('0x32')];if(_0x37f651[_0xec88('0x2e')][_0xec88('0x44')]){_0x17aa98[_0xec88('0x3e')]=[{'all':!![]}];}_0x17aa98=_['merge']({},_0x17aa98,_0x37f651[_0xec88('0x3d')]);return db[_0xec88('0x29')][_0xec88('0x45')](_0x17aa98)['then'](handleEntityNotFound(_0x17a9d2,null))['then'](respondWithResult(_0x17a9d2,null))[_0xec88('0x46')](handleError(_0x17a9d2,null));};exports['create']=function(_0x45e993,_0x47a451){return db[_0xec88('0x29')][_0xec88('0x47')](_0x45e993[_0xec88('0x48')],{})[_0xec88('0x24')](respondWithResult(_0x47a451,0xc9))[_0xec88('0x46')](handleError(_0x47a451,null));};exports[_0xec88('0x23')]=function(_0x15440b,_0xe69fe1){if(_0x15440b[_0xec88('0x48')]['id']){delete _0x15440b['body']['id'];}return db[_0xec88('0x29')]['find']({'where':{'id':_0x15440b[_0xec88('0x42')]['id']}})['then'](handleEntityNotFound(_0xe69fe1,null))['then'](saveUpdates(_0x15440b[_0xec88('0x48')],null))[_0xec88('0x24')](respondWithResult(_0xe69fe1,null))[_0xec88('0x46')](handleError(_0xe69fe1,null));};exports[_0xec88('0x25')]=function(_0x5651f4,_0x3e0fc9){return db[_0xec88('0x29')][_0xec88('0x45')]({'where':{'id':_0x5651f4['params']['id']}})['then'](handleEntityNotFound(_0x3e0fc9,null))[_0xec88('0x24')](removeEntity(_0x3e0fc9,null))['catch'](handleError(_0x3e0fc9,null));};exports[_0xec88('0x49')]=function(_0x124b8a,_0x5e9e46,_0x2441c){var _0x5b1481={};var _0x182c3e={};var _0x171f6b;var _0x3247df;return db['Dynamics365Configuration'][_0xec88('0x4a')]({'where':{'id':_0x124b8a[_0xec88('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e9e46,null))[_0xec88('0x24')](function(_0x2f689d){if(_0x2f689d){_0x171f6b=_0x2f689d;_0x182c3e[_0xec88('0x32')]=_['keys'](db[_0xec88('0x4b')][_0xec88('0x2a')]);_0x182c3e[_0xec88('0x2e')]=_[_0xec88('0x43')](_0x124b8a[_0xec88('0x2e')]);_0x182c3e[_0xec88('0x2f')]=_[_0xec88('0x30')](_0x182c3e[_0xec88('0x32')],_0x182c3e['query']);_0x5b1481['attributes']=_[_0xec88('0x30')](_0x182c3e[_0xec88('0x32')],qs[_0xec88('0x33')](_0x124b8a[_0xec88('0x2e')][_0xec88('0x33')]));_0x5b1481[_0xec88('0x31')]=_0x5b1481['attributes'][_0xec88('0x34')]?_0x5b1481[_0xec88('0x31')]:_0x182c3e['model'];_0x5b1481[_0xec88('0x37')]=qs['sort'](_0x124b8a[_0xec88('0x2e')][_0xec88('0x4c')]);_0x5b1481[_0xec88('0x38')]=qs['filters'](_[_0xec88('0x39')](_0x124b8a[_0xec88('0x2e')],_0x182c3e[_0xec88('0x2f')]));if(_0x124b8a[_0xec88('0x2e')][_0xec88('0x3a')]){_0x5b1481['where']=_[_0xec88('0x3c')](_0x5b1481[_0xec88('0x38')],{'$or':_[_0xec88('0x2d')](_0x5b1481[_0xec88('0x31')],function(_0x4817f8){var _0x57b808={};_0x57b808[_0x4817f8]={'$like':'%'+_0x124b8a[_0xec88('0x2e')][_0xec88('0x3a')]+'%'};return _0x57b808;})});}_0x5b1481=_['merge']({},_0x5b1481,_0x124b8a[_0xec88('0x3d')]);return _0x171f6b['getFields'](_0x5b1481);}})[_0xec88('0x24')](function(_0x259b85){if(_0x259b85){_0x3247df=_0x259b85[_0xec88('0x34')];if(!_0x124b8a['query'][_0xec88('0x4d')](_0xec88('0x35'))){_0x5b1481['limit']=qs[_0xec88('0x36')](_0x124b8a[_0xec88('0x2e')][_0xec88('0x36')]);_0x5b1481[_0xec88('0x1d')]=qs[_0xec88('0x1d')](_0x124b8a[_0xec88('0x2e')][_0xec88('0x1d')]);}return _0x171f6b[_0xec88('0x49')](_0x5b1481);}})[_0xec88('0x24')](function(_0x50cf5f){if(_0x50cf5f){return _0x50cf5f?{'count':_0x3247df,'rows':_0x50cf5f}:null;}})[_0xec88('0x24')](respondWithResult(_0x5e9e46,null))[_0xec88('0x46')](handleError(_0x5e9e46,null));};exports['getSubjects']=function(_0x3328b9,_0x4e6fc3,_0x24d46a){var _0x2ee0e6={};var _0x5af2d9={};var _0x245dca;var _0x2571d7;return db[_0xec88('0x29')][_0xec88('0x4a')]({'where':{'id':_0x3328b9['params']['id']}})[_0xec88('0x24')](handleEntityNotFound(_0x4e6fc3,null))[_0xec88('0x24')](function(_0x310661){if(_0x310661){_0x245dca=_0x310661;_0x5af2d9[_0xec88('0x32')]=_[_0xec88('0x43')](db[_0xec88('0x4b')][_0xec88('0x2a')]);_0x5af2d9[_0xec88('0x2e')]=_['keys'](_0x3328b9[_0xec88('0x2e')]);_0x5af2d9[_0xec88('0x2f')]=_[_0xec88('0x30')](_0x5af2d9['model'],_0x5af2d9[_0xec88('0x2e')]);_0x2ee0e6[_0xec88('0x31')]=_['intersection'](_0x5af2d9[_0xec88('0x32')],qs[_0xec88('0x33')](_0x3328b9[_0xec88('0x2e')]['fields']));_0x2ee0e6[_0xec88('0x31')]=_0x2ee0e6[_0xec88('0x31')][_0xec88('0x34')]?_0x2ee0e6[_0xec88('0x31')]:_0x5af2d9[_0xec88('0x32')];_0x2ee0e6['order']=qs[_0xec88('0x4c')](_0x3328b9['query'][_0xec88('0x4c')]);_0x2ee0e6['where']=qs[_0xec88('0x2f')](_[_0xec88('0x39')](_0x3328b9[_0xec88('0x2e')],_0x5af2d9[_0xec88('0x2f')]));if(_0x3328b9[_0xec88('0x2e')][_0xec88('0x3a')]){_0x2ee0e6[_0xec88('0x38')]=_[_0xec88('0x3c')](_0x2ee0e6[_0xec88('0x38')],{'$or':_['map'](_0x2ee0e6[_0xec88('0x31')],function(_0x55ecc3){var _0x35137d={};_0x35137d[_0x55ecc3]={'$like':'%'+_0x3328b9[_0xec88('0x2e')][_0xec88('0x3a')]+'%'};return _0x35137d;})});}_0x2ee0e6=_['merge']({},_0x2ee0e6,_0x3328b9['options']);return _0x245dca[_0xec88('0x4e')](_0x2ee0e6);}})[_0xec88('0x24')](function(_0xf4850d){if(_0xf4850d){_0x2571d7=_0xf4850d['length'];if(!_0x3328b9[_0xec88('0x2e')]['hasOwnProperty'](_0xec88('0x35'))){_0x2ee0e6[_0xec88('0x36')]=qs[_0xec88('0x36')](_0x3328b9[_0xec88('0x2e')][_0xec88('0x36')]);_0x2ee0e6[_0xec88('0x1d')]=qs[_0xec88('0x1d')](_0x3328b9[_0xec88('0x2e')][_0xec88('0x1d')]);}return _0x245dca[_0xec88('0x4e')](_0x2ee0e6);}})[_0xec88('0x24')](function(_0x1b28c3){if(_0x1b28c3){return _0x1b28c3?{'count':_0x2571d7,'rows':_0x1b28c3}:null;}})[_0xec88('0x24')](respondWithResult(_0x4e6fc3,null))[_0xec88('0x46')](handleError(_0x4e6fc3,null));};exports[_0xec88('0x4f')]=function(_0x3f2ef1,_0x14ffcf,_0x220ca2){var _0x1505cc={};var _0x4f362f={};var _0x306d4b;var _0x4956da;return db[_0xec88('0x29')][_0xec88('0x4a')]({'where':{'id':_0x3f2ef1[_0xec88('0x42')]['id']}})[_0xec88('0x24')](handleEntityNotFound(_0x14ffcf,null))[_0xec88('0x24')](function(_0x2e974e){if(_0x2e974e){_0x306d4b=_0x2e974e;_0x4f362f[_0xec88('0x32')]=_[_0xec88('0x43')](db[_0xec88('0x4b')][_0xec88('0x2a')]);_0x4f362f[_0xec88('0x2e')]=_['keys'](_0x3f2ef1['query']);_0x4f362f['filters']=_['intersection'](_0x4f362f[_0xec88('0x32')],_0x4f362f[_0xec88('0x2e')]);_0x1505cc['attributes']=_[_0xec88('0x30')](_0x4f362f[_0xec88('0x32')],qs['fields'](_0x3f2ef1[_0xec88('0x2e')]['fields']));_0x1505cc['attributes']=_0x1505cc[_0xec88('0x31')][_0xec88('0x34')]?_0x1505cc[_0xec88('0x31')]:_0x4f362f[_0xec88('0x32')];_0x1505cc[_0xec88('0x37')]=qs[_0xec88('0x4c')](_0x3f2ef1[_0xec88('0x2e')][_0xec88('0x4c')]);_0x1505cc[_0xec88('0x38')]=qs[_0xec88('0x2f')](_['pick'](_0x3f2ef1[_0xec88('0x2e')],_0x4f362f['filters']));if(_0x3f2ef1[_0xec88('0x2e')][_0xec88('0x3a')]){_0x1505cc[_0xec88('0x38')]=_[_0xec88('0x3c')](_0x1505cc['where'],{'$or':_[_0xec88('0x2d')](_0x1505cc[_0xec88('0x31')],function(_0x4ddaea){var _0x49bc78={};_0x49bc78[_0x4ddaea]={'$like':'%'+_0x3f2ef1[_0xec88('0x2e')]['filter']+'%'};return _0x49bc78;})});}_0x1505cc=_[_0xec88('0x3c')]({},_0x1505cc,_0x3f2ef1[_0xec88('0x3d')]);return _0x306d4b[_0xec88('0x4f')](_0x1505cc);}})[_0xec88('0x24')](function(_0x36bb46){if(_0x36bb46){_0x4956da=_0x36bb46[_0xec88('0x34')];if(!_0x3f2ef1[_0xec88('0x2e')][_0xec88('0x4d')](_0xec88('0x35'))){_0x1505cc[_0xec88('0x36')]=qs[_0xec88('0x36')](_0x3f2ef1[_0xec88('0x2e')][_0xec88('0x36')]);_0x1505cc[_0xec88('0x1d')]=qs['offset'](_0x3f2ef1[_0xec88('0x2e')][_0xec88('0x1d')]);}return _0x306d4b[_0xec88('0x4f')](_0x1505cc);}})[_0xec88('0x24')](function(_0x207194){if(_0x207194){return _0x207194?{'count':_0x4956da,'rows':_0x207194}:null;}})[_0xec88('0x24')](respondWithResult(_0x14ffcf,null))[_0xec88('0x46')](handleError(_0x14ffcf,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e6156a1..45eb440 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x5b54cc,_0x4f5e69){var _0x35e432=function(_0x3fa441){while(--_0x3fa441){_0x5b54cc['push'](_0x5b54cc['shift']());}};_0x35e432(++_0x4f5e69);}(_0x9f62,0x154));var _0x29f6=function(_0x56f635,_0x11bc11){_0x56f635=_0x56f635-0x0;var _0x3b7c61=_0x9f62[_0x56f635];return _0x3b7c61;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x24c8ee,_0x394f4b){var _0x5c6fc2=function(_0x3d766b){while(--_0x3d766b){_0x24c8ee['push'](_0x24c8ee['shift']());}};_0x5c6fc2(++_0x394f4b);}(_0x34e8,0x12c));var _0x834e=function(_0x11d272,_0x5c47f5){_0x11d272=_0x11d272-0x0;var _0x4d003f=_0x34e8[_0x11d272];return _0x4d003f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 93f43b8..1d9a116 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 _0xe94d=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x29c93a,_0x423dbf){var _0x3025c8=function(_0x378ced){while(--_0x378ced){_0x29c93a['push'](_0x29c93a['shift']());}};_0x3025c8(++_0x423dbf);}(_0xe94d,0x1ca));var _0xde94=function(_0x138fdd,_0x4b7379){_0x138fdd=_0x138fdd-0x0;var _0x25d7af=_0xe94d[_0x138fdd];return _0x25d7af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde94('0x0'));var BPromise=require(_0xde94('0x1'));var rs=require(_0xde94('0x2'));var fs=require('fs');var Redis=require(_0xde94('0x3'));var db=require(_0xde94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde94('0x5'))(_0xde94('0x6'));var config=require(_0xde94('0x7'));var jayson=require(_0xde94('0x8'));var client=jayson['client'][_0xde94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x529956,_0x3bdce4,_0x48c91b){return new BPromise(function(_0x2b414a,_0x1538d6){return client[_0xde94('0xa')](_0x529956,_0x48c91b)[_0xde94('0xb')](function(_0x2c2ea7){logger['info'](_0xde94('0xc'),_0x3bdce4,_0xde94('0xd'));logger[_0xde94('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3bdce4,_0xde94('0xd'),JSON[_0xde94('0xf')](_0x2c2ea7));if(_0x2c2ea7[_0xde94('0x10')]){if(_0x2c2ea7[_0xde94('0x10')][_0xde94('0x11')]===0x1f4){logger['error'](_0xde94('0xc'),_0x3bdce4,_0x2c2ea7[_0xde94('0x10')][_0xde94('0x12')]);return _0x1538d6(_0x2c2ea7['error'][_0xde94('0x12')]);}logger[_0xde94('0x10')](_0xde94('0xc'),_0x3bdce4,_0x2c2ea7[_0xde94('0x10')][_0xde94('0x12')]);return _0x2b414a(_0x2c2ea7['error']['message']);}else{logger['info'](_0xde94('0xc'),_0x3bdce4,_0xde94('0xd'));_0x2b414a(_0x2c2ea7[_0xde94('0x13')][_0xde94('0x12')]);}})[_0xde94('0x14')](function(_0x5ceb01){logger[_0xde94('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3bdce4,_0x5ceb01);_0x1538d6(_0x5ceb01);});});} \ No newline at end of file +var _0x9f61=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dffb9,_0x337545){var _0x12fce4=function(_0x103dac){while(--_0x103dac){_0x3dffb9['push'](_0x3dffb9['shift']());}};_0x12fce4(++_0x337545);}(_0x9f61,0x76));var _0x19f6=function(_0x244ace,_0x3efe6d){_0x244ace=_0x244ace-0x0;var _0x3d01b7=_0x9f61[_0x244ace];return _0x3d01b7;};'use strict';var _=require(_0x19f6('0x0'));var util=require(_0x19f6('0x1'));var moment=require(_0x19f6('0x2'));var BPromise=require(_0x19f6('0x3'));var rs=require(_0x19f6('0x4'));var fs=require('fs');var Redis=require(_0x19f6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x19f6('0x6'));var logger=require(_0x19f6('0x7'))('rpc');var config=require(_0x19f6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x19f6('0x9')][_0x19f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x517575,_0x18fcbf,_0x42bc86){return new BPromise(function(_0x384cc1,_0x140cb4){return client[_0x19f6('0xb')](_0x517575,_0x42bc86)[_0x19f6('0xc')](function(_0x21f40f){logger[_0x19f6('0xd')](_0x19f6('0xe'),_0x18fcbf,_0x19f6('0xf'));logger[_0x19f6('0x10')](_0x19f6('0x11'),_0x18fcbf,_0x19f6('0xf'),JSON[_0x19f6('0x12')](_0x21f40f));if(_0x21f40f[_0x19f6('0x13')]){if(_0x21f40f[_0x19f6('0x13')]['code']===0x1f4){logger[_0x19f6('0x13')](_0x19f6('0xe'),_0x18fcbf,_0x21f40f['error'][_0x19f6('0x14')]);return _0x140cb4(_0x21f40f[_0x19f6('0x13')][_0x19f6('0x14')]);}logger[_0x19f6('0x13')](_0x19f6('0xe'),_0x18fcbf,_0x21f40f['error']['message']);return _0x384cc1(_0x21f40f[_0x19f6('0x13')][_0x19f6('0x14')]);}else{logger['info'](_0x19f6('0xe'),_0x18fcbf,_0x19f6('0xf'));_0x384cc1(_0x21f40f[_0x19f6('0x15')][_0x19f6('0x14')]);}})[_0x19f6('0x16')](function(_0x46b1b9){logger[_0x19f6('0x13')](_0x19f6('0xe'),_0x18fcbf,_0x46b1b9);_0x140cb4(_0x46b1b9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a0ad8f0..c025d94 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 _0x462c=['delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put'];(function(_0x4b9fd6,_0x443252){var _0x4f745a=function(_0x12b716){while(--_0x12b716){_0x4b9fd6['push'](_0x4b9fd6['shift']());}};_0x4f745a(++_0x443252);}(_0x462c,0x167));var _0xc462=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x462c[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0xc462('0x0'));var path=require(_0xc462('0x1'));var timeout=require(_0xc462('0x2'));var express=require(_0xc462('0x3'));var router=express[_0xc462('0x4')]();var fs_extra=require(_0xc462('0x5'));var auth=require(_0xc462('0x6'));var interaction=require(_0xc462('0x7'));var config=require(_0xc462('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc462('0x9')](_0xc462('0xa'),auth['isAuthenticated'](),controller[_0xc462('0xb')]);router['post']('/',auth[_0xc462('0xc')](),controller[_0xc462('0xd')]);router[_0xc462('0xe')](_0xc462('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc462('0xf')](_0xc462('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc462('0x10')]=router; \ No newline at end of file +var _0xb695=['exports','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x32ee77,_0x2dd07a){var _0x3dc519=function(_0x54e69d){while(--_0x54e69d){_0x32ee77['push'](_0x32ee77['shift']());}};_0x3dc519(++_0x2dd07a);}(_0xb695,0x1cc));var _0x5b69=function(_0x2738d6,_0x3d76d5){_0x2738d6=_0x2738d6-0x0;var _0x3fb00a=_0xb695[_0x2738d6];return _0x3fb00a;};'use strict';var multer=require('multer');var util=require(_0x5b69('0x0'));var path=require(_0x5b69('0x1'));var timeout=require(_0x5b69('0x2'));var express=require(_0x5b69('0x3'));var router=express[_0x5b69('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b69('0x5'));var controller=require('./intDynamics365Field.controller');router[_0x5b69('0x6')]('/',auth[_0x5b69('0x7')](),controller[_0x5b69('0x8')]);router[_0x5b69('0x6')](_0x5b69('0x9'),auth[_0x5b69('0x7')](),controller[_0x5b69('0xa')]);router[_0x5b69('0xb')]('/',auth[_0x5b69('0x7')](),controller[_0x5b69('0xc')]);router[_0x5b69('0xd')](_0x5b69('0x9'),auth[_0x5b69('0x7')](),controller['update']);router[_0x5b69('0xe')](_0x5b69('0x9'),auth[_0x5b69('0x7')](),controller[_0x5b69('0xf')]);module[_0x5b69('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2c36dcf..6781940 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 _0xed67=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x8dd53a,_0x172f13){var _0x4625f8=function(_0x259d46){while(--_0x259d46){_0x8dd53a['push'](_0x8dd53a['shift']());}};_0x4625f8(++_0x172f13);}(_0xed67,0x14a));var _0x7ed6=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0xed67[_0x23e6bb];return _0x1e3b4c;};'use strict';var Sequelize=require(_0x7ed6('0x0'));module[_0x7ed6('0x1')]={'type':{'type':Sequelize[_0x7ed6('0x2')](_0x7ed6('0x3'),_0x7ed6('0x4'),_0x7ed6('0x5'),_0x7ed6('0x6'),_0x7ed6('0x7')),'defaultValue':_0x7ed6('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7ed6('0x8')]},'keyType':{'type':Sequelize[_0x7ed6('0x2')](_0x7ed6('0x3'),'variable',_0x7ed6('0x5'))},'keyContent':{'type':Sequelize[_0x7ed6('0x8')]},'idField':{'type':Sequelize[_0x7ed6('0x8')]},'nameField':{'type':Sequelize[_0x7ed6('0x8')]},'customField':{'type':Sequelize[_0x7ed6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ed6('0x8')]}}; \ No newline at end of file +var _0x8861=['string','keyValue','STRING','variable','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x452d3d,_0x383478){var _0x48a47c=function(_0x42b36a){while(--_0x42b36a){_0x452d3d['push'](_0x452d3d['shift']());}};_0x48a47c(++_0x383478);}(_0x8861,0x1a6));var _0x1886=function(_0x4aabc6,_0x348818){_0x4aabc6=_0x4aabc6-0x0;var _0xf26471=_0x8861[_0x4aabc6];return _0xf26471;};'use strict';var Sequelize=require(_0x1886('0x0'));module['exports']={'type':{'type':Sequelize[_0x1886('0x1')](_0x1886('0x2'),'variable','customVariable',_0x1886('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1886('0x4')]},'key':{'type':Sequelize[_0x1886('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x1886('0x5'),_0x1886('0x6'))},'keyContent':{'type':Sequelize[_0x1886('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1886('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 24f518d..9f9fed5 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 _0x52ed=['offset','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','Dynamics365Field','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','find','create','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x52ed,0x79));var _0xd52e=function(_0x573fdf,_0x16cc8f){_0x573fdf=_0x573fdf-0x0;var _0x269299=_0x52ed[_0x573fdf];return _0x269299;};'use strict';var emlformat=require(_0xd52e('0x0'));var rimraf=require(_0xd52e('0x1'));var zipdir=require(_0xd52e('0x2'));var jsonpatch=require(_0xd52e('0x3'));var rp=require(_0xd52e('0x4'));var moment=require(_0xd52e('0x5'));var BPromise=require(_0xd52e('0x6'));var Mustache=require(_0xd52e('0x7'));var util=require(_0xd52e('0x8'));var path=require(_0xd52e('0x9'));var sox=require(_0xd52e('0xa'));var csv=require(_0xd52e('0xb'));var ejs=require(_0xd52e('0xc'));var fs=require('fs');var fs_extra=require(_0xd52e('0xd'));var _=require(_0xd52e('0xe'));var squel=require(_0xd52e('0xf'));var crypto=require(_0xd52e('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd52e('0x11'));var toCsv=require(_0xd52e('0xb'));var querystring=require(_0xd52e('0x12'));var Papa=require(_0xd52e('0x13'));var Redis=require(_0xd52e('0x14'));var authService=require(_0xd52e('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd52e('0x16'));var logger=require(_0xd52e('0x17'))('api');var utils=require(_0xd52e('0x18'));var config=require(_0xd52e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd52e('0x1a'))['db'];function respondWithStatusCode(_0x1e676b,_0xdc245f){_0xdc245f=_0xdc245f||0xcc;return function(_0xef67e0){if(_0xef67e0){return _0x1e676b[_0xd52e('0x1b')](_0xdc245f);}return _0x1e676b[_0xd52e('0x1c')](_0xdc245f)['end']();};}function respondWithResult(_0x5a8047,_0x3c1168){_0x3c1168=_0x3c1168||0xc8;return function(_0x22b95b){if(_0x22b95b){return _0x5a8047[_0xd52e('0x1c')](_0x3c1168)[_0xd52e('0x1d')](_0x22b95b);}};}function respondWithFilteredResult(_0x53fd6a,_0x5237c8){return function(_0x2d6d0e){if(_0x2d6d0e){var _0x23409=typeof _0x5237c8['offset']===_0xd52e('0x1e')&&typeof _0x5237c8[_0xd52e('0x1f')]==='undefined';var _0x4b5111=_0x2d6d0e[_0xd52e('0x20')];var _0x3e1341=_0x23409?0x0:_0x5237c8['offset'];var _0x18aad4=_0x23409?_0x2d6d0e[_0xd52e('0x20')]:_0x5237c8[_0xd52e('0x21')]+_0x5237c8[_0xd52e('0x1f')];var _0x486f4c;if(_0x18aad4>=_0x4b5111){_0x18aad4=_0x4b5111;_0x486f4c=0xc8;}else{_0x486f4c=0xce;}_0x53fd6a[_0xd52e('0x1c')](_0x486f4c);return _0x53fd6a[_0xd52e('0x22')](_0xd52e('0x23'),_0x3e1341+'-'+_0x18aad4+'/'+_0x4b5111)[_0xd52e('0x1d')](_0x2d6d0e);}return null;};}function patchUpdates(_0x444346){return function(_0x42aae4){try{jsonpatch['apply'](_0x42aae4,_0x444346,!![]);}catch(_0x2af31e){return BPromise[_0xd52e('0x24')](_0x2af31e);}return _0x42aae4[_0xd52e('0x25')]();};}function saveUpdates(_0x30859d,_0x49bcba){return function(_0x35a810){if(_0x35a810){return _0x35a810[_0xd52e('0x26')](_0x30859d)['then'](function(_0x4ac0c2){return _0x4ac0c2;});}return null;};}function removeEntity(_0x35ecce,_0x5ab6ac){return function(_0x260421){if(_0x260421){return _0x260421[_0xd52e('0x27')]()[_0xd52e('0x28')](function(){_0x35ecce[_0xd52e('0x1c')](0xcc)[_0xd52e('0x29')]();});}};}function handleEntityNotFound(_0x3b87ad,_0x522176){return function(_0x3d925d){if(!_0x3d925d){_0x3b87ad['sendStatus'](0x194);}return _0x3d925d;};}function handleError(_0x1f645e,_0x14b33c){_0x14b33c=_0x14b33c||0x1f4;return function(_0xb56777){logger[_0xd52e('0x2a')](_0xb56777[_0xd52e('0x2b')]);if(_0xb56777[_0xd52e('0x2c')]){delete _0xb56777[_0xd52e('0x2c')];}_0x1f645e[_0xd52e('0x1c')](_0x14b33c)[_0xd52e('0x2d')](_0xb56777);};}exports[_0xd52e('0x2e')]=function(_0x494c27,_0x48e92d){var _0x3802d7={},_0x181138={},_0x24a72={'count':0x0,'rows':[]};var _0x4e64cb=_['map'](db[_0xd52e('0x2f')][_0xd52e('0x30')],function(_0x2a4900){return{'name':_0x2a4900['fieldName'],'type':_0x2a4900[_0xd52e('0x31')]['key']};});_0x181138[_0xd52e('0x32')]=_[_0xd52e('0x33')](_0x4e64cb,_0xd52e('0x2c'));_0x181138[_0xd52e('0x34')]=_[_0xd52e('0x35')](_0x494c27[_0xd52e('0x34')]);_0x181138[_0xd52e('0x36')]=_[_0xd52e('0x37')](_0x181138[_0xd52e('0x32')],_0x181138['query']);_0x3802d7['attributes']=_['intersection'](_0x181138[_0xd52e('0x32')],qs[_0xd52e('0x38')](_0x494c27[_0xd52e('0x34')][_0xd52e('0x38')]));_0x3802d7['attributes']=_0x3802d7[_0xd52e('0x39')][_0xd52e('0x3a')]?_0x3802d7[_0xd52e('0x39')]:_0x181138[_0xd52e('0x32')];if(!_0x494c27[_0xd52e('0x34')][_0xd52e('0x3b')](_0xd52e('0x3c'))){_0x3802d7['limit']=qs[_0xd52e('0x1f')](_0x494c27['query'][_0xd52e('0x1f')]);_0x3802d7['offset']=qs[_0xd52e('0x21')](_0x494c27[_0xd52e('0x34')][_0xd52e('0x21')]);}_0x3802d7[_0xd52e('0x3d')]=qs[_0xd52e('0x3e')](_0x494c27[_0xd52e('0x34')][_0xd52e('0x3e')]);_0x3802d7[_0xd52e('0x3f')]=qs['filters'](_['pick'](_0x494c27[_0xd52e('0x34')],_0x181138[_0xd52e('0x36')]),_0x4e64cb);if(_0x494c27[_0xd52e('0x34')][_0xd52e('0x40')]){_0x3802d7[_0xd52e('0x3f')]=_[_0xd52e('0x41')](_0x3802d7[_0xd52e('0x3f')],{'$or':_[_0xd52e('0x33')](_0x4e64cb,function(_0x3b3274){if(_0x3b3274['type']!=='VIRTUAL'){var _0x330daa={};_0x330daa[_0x3b3274[_0xd52e('0x2c')]]={'$like':'%'+_0x494c27[_0xd52e('0x34')][_0xd52e('0x40')]+'%'};return _0x330daa;}})});}_0x3802d7=_[_0xd52e('0x41')]({},_0x3802d7,_0x494c27[_0xd52e('0x42')]);var _0x4a9aac={'where':_0x3802d7[_0xd52e('0x3f')]};return db[_0xd52e('0x2f')]['count'](_0x4a9aac)[_0xd52e('0x28')](function(_0x37289d){_0x24a72[_0xd52e('0x20')]=_0x37289d;if(_0x494c27[_0xd52e('0x34')][_0xd52e('0x43')]){_0x3802d7[_0xd52e('0x44')]=[{'all':!![]}];}return db[_0xd52e('0x2f')][_0xd52e('0x45')](_0x3802d7);})[_0xd52e('0x28')](function(_0x3cc140){_0x24a72[_0xd52e('0x46')]=_0x3cc140;return _0x24a72;})[_0xd52e('0x28')](respondWithFilteredResult(_0x48e92d,_0x3802d7))['catch'](handleError(_0x48e92d,null));};exports[_0xd52e('0x47')]=function(_0x59c6ca,_0x18774e){var _0x241fff={'raw':!![],'where':{'id':_0x59c6ca['params']['id']}},_0x39708a={};_0x39708a['model']=_['keys'](db['Dynamics365Field'][_0xd52e('0x30')]);_0x39708a[_0xd52e('0x34')]=_['keys'](_0x59c6ca[_0xd52e('0x34')]);_0x39708a['filters']=_[_0xd52e('0x37')](_0x39708a[_0xd52e('0x32')],_0x39708a['query']);_0x241fff[_0xd52e('0x39')]=_[_0xd52e('0x37')](_0x39708a[_0xd52e('0x32')],qs[_0xd52e('0x38')](_0x59c6ca['query']['fields']));_0x241fff[_0xd52e('0x39')]=_0x241fff['attributes']['length']?_0x241fff[_0xd52e('0x39')]:_0x39708a['model'];if(_0x59c6ca[_0xd52e('0x34')][_0xd52e('0x43')]){_0x241fff[_0xd52e('0x44')]=[{'all':!![]}];}_0x241fff=_['merge']({},_0x241fff,_0x59c6ca[_0xd52e('0x42')]);return db[_0xd52e('0x2f')][_0xd52e('0x48')](_0x241fff)[_0xd52e('0x28')](handleEntityNotFound(_0x18774e,null))[_0xd52e('0x28')](respondWithResult(_0x18774e,null))['catch'](handleError(_0x18774e,null));};exports[_0xd52e('0x49')]=function(_0x3d8a90,_0x3dd1f9){return db[_0xd52e('0x2f')][_0xd52e('0x49')](_0x3d8a90['body'],{})[_0xd52e('0x28')](respondWithResult(_0x3dd1f9,0xc9))[_0xd52e('0x4a')](handleError(_0x3dd1f9,null));};exports['update']=function(_0x59f5a9,_0x4da7e9){if(_0x59f5a9[_0xd52e('0x4b')]['id']){delete _0x59f5a9[_0xd52e('0x4b')]['id'];}return db[_0xd52e('0x2f')][_0xd52e('0x48')]({'where':{'id':_0x59f5a9[_0xd52e('0x4c')]['id']}})[_0xd52e('0x28')](handleEntityNotFound(_0x4da7e9,null))[_0xd52e('0x28')](saveUpdates(_0x59f5a9[_0xd52e('0x4b')],null))['then'](respondWithResult(_0x4da7e9,null))[_0xd52e('0x4a')](handleError(_0x4da7e9,null));};exports['destroy']=function(_0x1bb986,_0x1ec128){return db[_0xd52e('0x2f')][_0xd52e('0x48')]({'where':{'id':_0x1bb986[_0xd52e('0x4c')]['id']}})[_0xd52e('0x28')](handleEntityNotFound(_0x1ec128,null))[_0xd52e('0x28')](removeEntity(_0x1ec128,null))[_0xd52e('0x4a')](handleError(_0x1ec128,null));}; \ No newline at end of file +var _0xdd10=['keys','query','attributes','intersection','model','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','Dynamics365Field','merge','find','catch','create','body','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x27b24e,_0x13fbd7){var _0x5ae60e=function(_0x21e181){while(--_0x21e181){_0x27b24e['push'](_0x27b24e['shift']());}};_0x5ae60e(++_0x13fbd7);}(_0xdd10,0x183));var _0x0dd1=function(_0x317eab,_0x201a6d){_0x317eab=_0x317eab-0x0;var _0x5cf165=_0xdd10[_0x317eab];return _0x5cf165;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0dd1('0x0'));var rp=require(_0x0dd1('0x1'));var moment=require(_0x0dd1('0x2'));var BPromise=require(_0x0dd1('0x3'));var Mustache=require(_0x0dd1('0x4'));var util=require(_0x0dd1('0x5'));var path=require(_0x0dd1('0x6'));var sox=require(_0x0dd1('0x7'));var csv=require(_0x0dd1('0x8'));var ejs=require(_0x0dd1('0x9'));var fs=require('fs');var fs_extra=require(_0x0dd1('0xa'));var _=require(_0x0dd1('0xb'));var squel=require(_0x0dd1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0dd1('0xd'));var toCsv=require(_0x0dd1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0dd1('0xe'));var authService=require(_0x0dd1('0xf'));var qs=require(_0x0dd1('0x10'));var as=require(_0x0dd1('0x11'));var hardwareService=require(_0x0dd1('0x12'));var logger=require(_0x0dd1('0x13'))(_0x0dd1('0x14'));var utils=require('../../config/utils');var config=require(_0x0dd1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dd1('0x16'))['db'];function respondWithStatusCode(_0x2f7130,_0x428fc2){_0x428fc2=_0x428fc2||0xcc;return function(_0x5734d2){if(_0x5734d2){return _0x2f7130[_0x0dd1('0x17')](_0x428fc2);}return _0x2f7130[_0x0dd1('0x18')](_0x428fc2)[_0x0dd1('0x19')]();};}function respondWithResult(_0x218a1a,_0x827650){_0x827650=_0x827650||0xc8;return function(_0x6290d4){if(_0x6290d4){return _0x218a1a[_0x0dd1('0x18')](_0x827650)[_0x0dd1('0x1a')](_0x6290d4);}};}function respondWithFilteredResult(_0x2547dc,_0xbaed13){return function(_0x57d7ca){if(_0x57d7ca){var _0x5daf58=typeof _0xbaed13[_0x0dd1('0x1b')]===_0x0dd1('0x1c')&&typeof _0xbaed13[_0x0dd1('0x1d')]==='undefined';var _0x165bc5=_0x57d7ca['count'];var _0x34fa42=_0x5daf58?0x0:_0xbaed13[_0x0dd1('0x1b')];var _0x522cea=_0x5daf58?_0x57d7ca[_0x0dd1('0x1e')]:_0xbaed13[_0x0dd1('0x1b')]+_0xbaed13[_0x0dd1('0x1d')];var _0x1cf0cb;if(_0x522cea>=_0x165bc5){_0x522cea=_0x165bc5;_0x1cf0cb=0xc8;}else{_0x1cf0cb=0xce;}_0x2547dc[_0x0dd1('0x18')](_0x1cf0cb);return _0x2547dc[_0x0dd1('0x1f')](_0x0dd1('0x20'),_0x34fa42+'-'+_0x522cea+'/'+_0x165bc5)[_0x0dd1('0x1a')](_0x57d7ca);}return null;};}function patchUpdates(_0x258a2d){return function(_0x3c9023){try{jsonpatch[_0x0dd1('0x21')](_0x3c9023,_0x258a2d,!![]);}catch(_0x4688de){return BPromise['reject'](_0x4688de);}return _0x3c9023[_0x0dd1('0x22')]();};}function saveUpdates(_0xb22cd8,_0x169a3c){return function(_0x551e4c){if(_0x551e4c){return _0x551e4c[_0x0dd1('0x23')](_0xb22cd8)['then'](function(_0x32fead){return _0x32fead;});}return null;};}function removeEntity(_0x451c94,_0x3707a9){return function(_0x3dfb5d){if(_0x3dfb5d){return _0x3dfb5d['destroy']()[_0x0dd1('0x24')](function(){_0x451c94['status'](0xcc)[_0x0dd1('0x19')]();});}};}function handleEntityNotFound(_0x32cd9e,_0x4092b2){return function(_0x9caafd){if(!_0x9caafd){_0x32cd9e[_0x0dd1('0x17')](0x194);}return _0x9caafd;};}function handleError(_0x318b1f,_0x400a58){_0x400a58=_0x400a58||0x1f4;return function(_0x1c0266){logger[_0x0dd1('0x25')](_0x1c0266[_0x0dd1('0x26')]);if(_0x1c0266['name']){delete _0x1c0266[_0x0dd1('0x27')];}_0x318b1f[_0x0dd1('0x18')](_0x400a58)['send'](_0x1c0266);};}exports[_0x0dd1('0x28')]=function(_0xeea16d,_0x3eccac){var _0x2efa1f={},_0xfe4693={},_0x26bebf={'count':0x0,'rows':[]};var _0x3c9a3d=_[_0x0dd1('0x29')](db['Dynamics365Field'][_0x0dd1('0x2a')],function(_0x2a00a5){return{'name':_0x2a00a5[_0x0dd1('0x2b')],'type':_0x2a00a5[_0x0dd1('0x2c')]['key']};});_0xfe4693['model']=_[_0x0dd1('0x29')](_0x3c9a3d,'name');_0xfe4693['query']=_[_0x0dd1('0x2d')](_0xeea16d[_0x0dd1('0x2e')]);_0xfe4693['filters']=_['intersection'](_0xfe4693['model'],_0xfe4693['query']);_0x2efa1f[_0x0dd1('0x2f')]=_[_0x0dd1('0x30')](_0xfe4693[_0x0dd1('0x31')],qs[_0x0dd1('0x32')](_0xeea16d[_0x0dd1('0x2e')][_0x0dd1('0x32')]));_0x2efa1f[_0x0dd1('0x2f')]=_0x2efa1f[_0x0dd1('0x2f')][_0x0dd1('0x33')]?_0x2efa1f[_0x0dd1('0x2f')]:_0xfe4693[_0x0dd1('0x31')];if(!_0xeea16d[_0x0dd1('0x2e')]['hasOwnProperty']('nolimit')){_0x2efa1f[_0x0dd1('0x1d')]=qs[_0x0dd1('0x1d')](_0xeea16d[_0x0dd1('0x2e')][_0x0dd1('0x1d')]);_0x2efa1f[_0x0dd1('0x1b')]=qs[_0x0dd1('0x1b')](_0xeea16d['query'][_0x0dd1('0x1b')]);}_0x2efa1f[_0x0dd1('0x34')]=qs[_0x0dd1('0x35')](_0xeea16d['query'][_0x0dd1('0x35')]);_0x2efa1f[_0x0dd1('0x36')]=qs[_0x0dd1('0x37')](_[_0x0dd1('0x38')](_0xeea16d[_0x0dd1('0x2e')],_0xfe4693[_0x0dd1('0x37')]),_0x3c9a3d);if(_0xeea16d[_0x0dd1('0x2e')][_0x0dd1('0x39')]){_0x2efa1f[_0x0dd1('0x36')]=_['merge'](_0x2efa1f[_0x0dd1('0x36')],{'$or':_[_0x0dd1('0x29')](_0x3c9a3d,function(_0xf272c0){if(_0xf272c0[_0x0dd1('0x2c')]!==_0x0dd1('0x3a')){var _0xb4d4f4={};_0xb4d4f4[_0xf272c0[_0x0dd1('0x27')]]={'$like':'%'+_0xeea16d[_0x0dd1('0x2e')]['filter']+'%'};return _0xb4d4f4;}})});}_0x2efa1f=_['merge']({},_0x2efa1f,_0xeea16d['options']);var _0x506290={'where':_0x2efa1f[_0x0dd1('0x36')]};return db['Dynamics365Field'][_0x0dd1('0x1e')](_0x506290)[_0x0dd1('0x24')](function(_0x2eb094){_0x26bebf[_0x0dd1('0x1e')]=_0x2eb094;if(_0xeea16d[_0x0dd1('0x2e')][_0x0dd1('0x3b')]){_0x2efa1f[_0x0dd1('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x0dd1('0x3d')](_0x2efa1f);})['then'](function(_0x542dec){_0x26bebf[_0x0dd1('0x3e')]=_0x542dec;return _0x26bebf;})[_0x0dd1('0x24')](respondWithFilteredResult(_0x3eccac,_0x2efa1f))['catch'](handleError(_0x3eccac,null));};exports[_0x0dd1('0x3f')]=function(_0x190c50,_0x269b11){var _0xd6382d={'raw':!![],'where':{'id':_0x190c50[_0x0dd1('0x40')]['id']}},_0x442165={};_0x442165[_0x0dd1('0x31')]=_['keys'](db[_0x0dd1('0x41')]['rawAttributes']);_0x442165['query']=_[_0x0dd1('0x2d')](_0x190c50[_0x0dd1('0x2e')]);_0x442165['filters']=_[_0x0dd1('0x30')](_0x442165[_0x0dd1('0x31')],_0x442165[_0x0dd1('0x2e')]);_0xd6382d[_0x0dd1('0x2f')]=_[_0x0dd1('0x30')](_0x442165[_0x0dd1('0x31')],qs[_0x0dd1('0x32')](_0x190c50[_0x0dd1('0x2e')][_0x0dd1('0x32')]));_0xd6382d[_0x0dd1('0x2f')]=_0xd6382d[_0x0dd1('0x2f')][_0x0dd1('0x33')]?_0xd6382d[_0x0dd1('0x2f')]:_0x442165[_0x0dd1('0x31')];if(_0x190c50['query']['includeAll']){_0xd6382d[_0x0dd1('0x3c')]=[{'all':!![]}];}_0xd6382d=_[_0x0dd1('0x42')]({},_0xd6382d,_0x190c50['options']);return db[_0x0dd1('0x41')][_0x0dd1('0x43')](_0xd6382d)['then'](handleEntityNotFound(_0x269b11,null))['then'](respondWithResult(_0x269b11,null))[_0x0dd1('0x44')](handleError(_0x269b11,null));};exports[_0x0dd1('0x45')]=function(_0x5c699d,_0x254904){return db[_0x0dd1('0x41')][_0x0dd1('0x45')](_0x5c699d['body'],{})[_0x0dd1('0x24')](respondWithResult(_0x254904,0xc9))[_0x0dd1('0x44')](handleError(_0x254904,null));};exports[_0x0dd1('0x23')]=function(_0x89b4ec,_0x4b77db){if(_0x89b4ec[_0x0dd1('0x46')]['id']){delete _0x89b4ec['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x89b4ec[_0x0dd1('0x40')]['id']}})[_0x0dd1('0x24')](handleEntityNotFound(_0x4b77db,null))[_0x0dd1('0x24')](saveUpdates(_0x89b4ec[_0x0dd1('0x46')],null))[_0x0dd1('0x24')](respondWithResult(_0x4b77db,null))['catch'](handleError(_0x4b77db,null));};exports[_0x0dd1('0x47')]=function(_0x219421,_0x2bac10){return db[_0x0dd1('0x41')][_0x0dd1('0x43')]({'where':{'id':_0x219421[_0x0dd1('0x40')]['id']}})[_0x0dd1('0x24')](handleEntityNotFound(_0x2bac10,null))[_0x0dd1('0x24')](removeEntity(_0x2bac10,null))['catch'](handleError(_0x2bac10,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1dff651..919946b 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 _0xdedb=['moment','path','rimraf','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xdedb,0xd0));var _0xbded=function(_0x4e28ae,_0x4a6ea0){_0x4e28ae=_0x4e28ae-0x0;var _0x4641e5=_0xdedb[_0x4e28ae];return _0x4641e5;};'use strict';var _=require(_0xbded('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbded('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbded('0x2'));var rimraf=require(_0xbded('0x3'));var config=require('../../config/environment');var attributes=require(_0xbded('0x4'));module[_0xbded('0x5')]=function(_0x24a6d9,_0x276c02){return _0x24a6d9[_0xbded('0x6')]('Dynamics365Field',attributes,{'tableName':_0xbded('0x7'),'paranoid':![],'indexes':[{'name':_0xbded('0x8'),'fields':[_0xbded('0x9'),_0xbded('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85b3=['../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x85b3,0xca));var _0x385b=function(_0x37f211,_0x237ae1){_0x37f211=_0x37f211-0x0;var _0xcad0fe=_0x85b3[_0x37f211];return _0xcad0fe;};'use strict';var _=require(_0x385b('0x0'));var util=require(_0x385b('0x1'));var logger=require(_0x385b('0x2'))(_0x385b('0x3'));var moment=require('moment');var BPromise=require(_0x385b('0x4'));var rp=require(_0x385b('0x5'));var fs=require('fs');var path=require(_0x385b('0x6'));var rimraf=require(_0x385b('0x7'));var config=require(_0x385b('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0x385b('0x9')]=function(_0x2456ab,_0xc9f4fe){return _0x2456ab[_0x385b('0xa')]('Dynamics365Field',attributes,{'tableName':_0x385b('0xb'),'paranoid':![],'indexes':[{'name':_0x385b('0xc'),'fields':[_0x385b('0xd'),_0x385b('0xe')],'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 5cade0d..12fe42b 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 _0x03e4=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x411b69,_0x400c91){var _0x4b0e62=function(_0x40e22c){while(--_0x40e22c){_0x411b69['push'](_0x411b69['shift']());}};_0x4b0e62(++_0x400c91);}(_0x03e4,0x17c));var _0x403e=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x03e4[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0x403e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x403e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x403e('0x2'));var db=require(_0x403e('0x3'))['db'];var utils=require(_0x403e('0x4'));var logger=require('../../config/logger')(_0x403e('0x5'));var config=require('../../config/environment');var jayson=require(_0x403e('0x6'));var client=jayson[_0x403e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x165115,_0x5c6724,_0x56edf4){return new BPromise(function(_0x425c3a,_0x5b8d2e){return client[_0x403e('0x8')](_0x165115,_0x56edf4)['then'](function(_0x2c96db){logger[_0x403e('0x9')](_0x403e('0xa'),_0x5c6724,_0x403e('0xb'));logger[_0x403e('0xc')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5c6724,'request\x20sent',JSON[_0x403e('0xd')](_0x2c96db));if(_0x2c96db['error']){if(_0x2c96db[_0x403e('0xe')]['code']===0x1f4){logger[_0x403e('0xe')](_0x403e('0xa'),_0x5c6724,_0x2c96db[_0x403e('0xe')][_0x403e('0xf')]);return _0x5b8d2e(_0x2c96db[_0x403e('0xe')][_0x403e('0xf')]);}logger[_0x403e('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x5c6724,_0x2c96db[_0x403e('0xe')][_0x403e('0xf')]);return _0x425c3a(_0x2c96db[_0x403e('0xe')]['message']);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x5c6724,'request\x20sent');_0x425c3a(_0x2c96db[_0x403e('0x10')][_0x403e('0xf')]);}})[_0x403e('0x11')](function(_0x389481){logger[_0x403e('0xe')](_0x403e('0xa'),_0x5c6724,_0x389481);_0x5b8d2e(_0x389481);});});} \ No newline at end of file +var _0x16a1=['error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x7000fe,_0x224d41){var _0x182e13=function(_0x109609){while(--_0x109609){_0x7000fe['push'](_0x7000fe['shift']());}};_0x182e13(++_0x224d41);}(_0x16a1,0x159));var _0x116a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x16a1[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x116a('0x0'));var util=require(_0x116a('0x1'));var moment=require(_0x116a('0x2'));var BPromise=require(_0x116a('0x3'));var rs=require(_0x116a('0x4'));var fs=require('fs');var Redis=require(_0x116a('0x5'));var db=require(_0x116a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x116a('0x7'))(_0x116a('0x8'));var config=require(_0x116a('0x9'));var jayson=require(_0x116a('0xa'));var client=jayson[_0x116a('0xb')][_0x116a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21247e,_0x18172a,_0x51b17e){return new BPromise(function(_0x3411f2,_0x423e97){return client[_0x116a('0xd')](_0x21247e,_0x51b17e)[_0x116a('0xe')](function(_0x4160e4){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x18172a,_0x116a('0xf'));logger[_0x116a('0x10')](_0x116a('0x11'),_0x18172a,_0x116a('0xf'),JSON[_0x116a('0x12')](_0x4160e4));if(_0x4160e4[_0x116a('0x13')]){if(_0x4160e4[_0x116a('0x13')][_0x116a('0x14')]===0x1f4){logger[_0x116a('0x13')](_0x116a('0x15'),_0x18172a,_0x4160e4[_0x116a('0x13')][_0x116a('0x16')]);return _0x423e97(_0x4160e4['error'][_0x116a('0x16')]);}logger['error'](_0x116a('0x15'),_0x18172a,_0x4160e4[_0x116a('0x13')][_0x116a('0x16')]);return _0x3411f2(_0x4160e4[_0x116a('0x13')][_0x116a('0x16')]);}else{logger[_0x116a('0x17')](_0x116a('0x15'),_0x18172a,'request\x20sent');_0x3411f2(_0x4160e4[_0x116a('0x18')]['message']);}})[_0x116a('0x19')](function(_0x1b6ee8){logger[_0x116a('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x18172a,_0x1b6ee8);_0x423e97(_0x1b6ee8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fca32ea..da742d6 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 _0x82f6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete'];(function(_0x273b1e,_0x1231d7){var _0x322fa0=function(_0x4d914c){while(--_0x4d914c){_0x273b1e['push'](_0x273b1e['shift']());}};_0x322fa0(++_0x1231d7);}(_0x82f6,0x7f));var _0x682f=function(_0x1ad107,_0x4d4de8){_0x1ad107=_0x1ad107-0x0;var _0x44398a=_0x82f6[_0x1ad107];return _0x44398a;};'use strict';var multer=require(_0x682f('0x0'));var util=require(_0x682f('0x1'));var path=require(_0x682f('0x2'));var timeout=require(_0x682f('0x3'));var express=require(_0x682f('0x4'));var router=express[_0x682f('0x5')]();var fs_extra=require(_0x682f('0x6'));var auth=require(_0x682f('0x7'));var interaction=require(_0x682f('0x8'));var config=require(_0x682f('0x9'));var controller=require(_0x682f('0xa'));router[_0x682f('0xb')]('/',auth['isAuthenticated'](),controller[_0x682f('0xc')]);router['get'](_0x682f('0xd'),auth[_0x682f('0xe')](),controller[_0x682f('0xf')]);router[_0x682f('0xb')]('/:id/configurations',auth[_0x682f('0xe')](),controller['getConfigurations']);router[_0x682f('0xb')](_0x682f('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x682f('0x11')]('/',auth[_0x682f('0xe')](),controller[_0x682f('0x12')]);router[_0x682f('0x11')](_0x682f('0x13'),auth['isAuthenticated'](),controller[_0x682f('0x14')]);router[_0x682f('0x15')](_0x682f('0xd'),auth[_0x682f('0xe')](),controller['update']);router[_0x682f('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x682f('0x17')]);module[_0x682f('0x18')]=router; \ No newline at end of file +var _0xb020=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xb020,0x14e));var _0x0b02=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xb020[_0xd09668];return _0x68726;};'use strict';var multer=require(_0x0b02('0x0'));var util=require('util');var path=require(_0x0b02('0x1'));var timeout=require(_0x0b02('0x2'));var express=require(_0x0b02('0x3'));var router=express[_0x0b02('0x4')]();var fs_extra=require(_0x0b02('0x5'));var auth=require(_0x0b02('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b02('0x7'));var controller=require(_0x0b02('0x8'));router['get']('/',auth[_0x0b02('0x9')](),controller[_0x0b02('0xa')]);router[_0x0b02('0xb')]('/:id',auth[_0x0b02('0x9')](),controller['show']);router[_0x0b02('0xb')](_0x0b02('0xc'),auth['isAuthenticated'](),controller[_0x0b02('0xd')]);router[_0x0b02('0xb')](_0x0b02('0xe'),auth['isAuthenticated'](),controller[_0x0b02('0xf')]);router[_0x0b02('0x10')]('/',auth[_0x0b02('0x9')](),controller[_0x0b02('0x11')]);router[_0x0b02('0x10')](_0x0b02('0xc'),auth[_0x0b02('0x9')](),controller['addConfiguration']);router[_0x0b02('0x12')](_0x0b02('0x13'),auth[_0x0b02('0x9')](),controller[_0x0b02('0x14')]);router[_0x0b02('0x15')]('/:id',auth[_0x0b02('0x9')](),controller[_0x0b02('0x16')]);module[_0x0b02('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index eb3e119..5a38687 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 _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x7e6cd9,_0x33514f){var _0x2418e5=function(_0x1a9031){while(--_0x1a9031){_0x7e6cd9['push'](_0x7e6cd9['shift']());}};_0x2418e5(++_0x33514f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1c1820,_0x18bb79){_0x1c1820=_0x1c1820-0x0;var _0x6690e6=_0x0b0e[_0x1c1820];return _0x6690e6;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x583c=['exports','STRING','username','sequelize'];(function(_0x407fc0,_0x33c89c){var _0x5850e3=function(_0x5192f6){while(--_0x5192f6){_0x407fc0['push'](_0x407fc0['shift']());}};_0x5850e3(++_0x33c89c);}(_0x583c,0x12b));var _0xc583=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x583c[_0x31172e];return _0x414ada;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 315a814..f290705 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 _0xe43c=['find','findOne','FreshdeskConfiguration','rawAttributes','pick','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','create','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','apiKey','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','rows','show','params','options','body','catch'];(function(_0x5cceb8,_0xa8e57a){var _0xeaf4be=function(_0x154250){while(--_0x154250){_0x5cceb8['push'](_0x5cceb8['shift']());}};_0xeaf4be(++_0xa8e57a);}(_0xe43c,0x180));var _0xce43=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe43c[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xce43('0x0'));var rimraf=require(_0xce43('0x1'));var zipdir=require(_0xce43('0x2'));var jsonpatch=require(_0xce43('0x3'));var rp=require(_0xce43('0x4'));var moment=require(_0xce43('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce43('0x6'));var util=require('util');var path=require(_0xce43('0x7'));var sox=require(_0xce43('0x8'));var csv=require(_0xce43('0x9'));var ejs=require(_0xce43('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce43('0xb'));var squel=require('squel');var crypto=require(_0xce43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce43('0xe'));var Redis=require(_0xce43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce43('0x10'));var logger=require('../../config/logger')(_0xce43('0x11'));var utils=require('../../config/utils');var config=require(_0xce43('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce43('0x13'))['db'];var integrations=require(_0xce43('0x14'));function respondWithStatusCode(_0x4c092b,_0x226f21){_0x226f21=_0x226f21||0xcc;return function(_0x1a74bf){if(_0x1a74bf){return _0x4c092b[_0xce43('0x15')](_0x226f21);}return _0x4c092b[_0xce43('0x16')](_0x226f21)['end']();};}function respondWithResult(_0x3034c7,_0x607d92){_0x607d92=_0x607d92||0xc8;return function(_0x3cd0f7){if(_0x3cd0f7){return _0x3034c7[_0xce43('0x16')](_0x607d92)['json'](_0x3cd0f7);}};}function respondWithFilteredResult(_0x588ddb,_0x3c0948){return function(_0x3e4218){if(_0x3e4218){var _0x2eb70b=typeof _0x3c0948[_0xce43('0x17')]===_0xce43('0x18')&&typeof _0x3c0948[_0xce43('0x19')]==='undefined';var _0x12014e=_0x3e4218[_0xce43('0x1a')];var _0xbc38f0=_0x2eb70b?0x0:_0x3c0948[_0xce43('0x17')];var _0x4c6a1b=_0x2eb70b?_0x3e4218[_0xce43('0x1a')]:_0x3c0948[_0xce43('0x17')]+_0x3c0948[_0xce43('0x19')];var _0x2506de;if(_0x4c6a1b>=_0x12014e){_0x4c6a1b=_0x12014e;_0x2506de=0xc8;}else{_0x2506de=0xce;}_0x588ddb[_0xce43('0x16')](_0x2506de);return _0x588ddb[_0xce43('0x1b')]('Content-Range',_0xbc38f0+'-'+_0x4c6a1b+'/'+_0x12014e)[_0xce43('0x1c')](_0x3e4218);}return null;};}function patchUpdates(_0x383f69){return function(_0x5973b9){try{jsonpatch[_0xce43('0x1d')](_0x5973b9,_0x383f69,!![]);}catch(_0x7d1421){return BPromise[_0xce43('0x1e')](_0x7d1421);}return _0x5973b9['save']();};}function saveUpdates(_0x57dcd4,_0x37b34e){return function(_0x30f5a1){if(_0x30f5a1){return _0x30f5a1[_0xce43('0x1f')](_0x57dcd4)[_0xce43('0x20')](function(_0x2d8f7d){return _0x2d8f7d;});}return null;};}function removeEntity(_0x2b9874,_0x118a89){return function(_0x4e7611){if(_0x4e7611){return _0x4e7611[_0xce43('0x21')]()[_0xce43('0x20')](function(){_0x2b9874[_0xce43('0x16')](0xcc)[_0xce43('0x22')]();});}};}function handleEntityNotFound(_0x48a448,_0x11d60b){return function(_0x45fec7){if(!_0x45fec7){_0x48a448[_0xce43('0x15')](0x194);}return _0x45fec7;};}function handleError(_0x1bb63f,_0x802b0d){_0x802b0d=_0x802b0d||0x1f4;return function(_0x272b45){logger['error'](_0x272b45[_0xce43('0x23')]);if(_0x272b45['name']){delete _0x272b45[_0xce43('0x24')];}_0x1bb63f[_0xce43('0x16')](_0x802b0d)[_0xce43('0x25')](_0x272b45);};}exports[_0xce43('0x26')]=function(_0x536452,_0xb6527c){var _0x4402f8={},_0x2a2d1d={},_0x44ac56={'count':0x0,'rows':[]};var _0x4b966a=_[_0xce43('0x27')](db[_0xce43('0x28')]['rawAttributes'],function(_0x388279){return{'name':_0x388279[_0xce43('0x29')],'type':_0x388279[_0xce43('0x2a')][_0xce43('0x2b')]};});_0x2a2d1d[_0xce43('0x2c')]=_[_0xce43('0x27')](_0x4b966a,'name');_0x2a2d1d['query']=_[_0xce43('0x2d')](_0x536452[_0xce43('0x2e')]);_0x2a2d1d['filters']=_[_0xce43('0x2f')](_0x2a2d1d[_0xce43('0x2c')],_0x2a2d1d[_0xce43('0x2e')]);_0x4402f8[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x2a2d1d['model'],qs[_0xce43('0x31')](_0x536452[_0xce43('0x2e')][_0xce43('0x31')]));_0x4402f8[_0xce43('0x30')]=_0x4402f8[_0xce43('0x30')][_0xce43('0x32')]?_0x4402f8[_0xce43('0x30')]:_0x2a2d1d[_0xce43('0x2c')];if(!_0x536452[_0xce43('0x2e')][_0xce43('0x33')](_0xce43('0x34'))){_0x4402f8[_0xce43('0x19')]=qs[_0xce43('0x19')](_0x536452[_0xce43('0x2e')][_0xce43('0x19')]);_0x4402f8[_0xce43('0x17')]=qs[_0xce43('0x17')](_0x536452[_0xce43('0x2e')]['offset']);}_0x4402f8[_0xce43('0x35')]=qs[_0xce43('0x36')](_0x536452[_0xce43('0x2e')][_0xce43('0x36')]);_0x4402f8[_0xce43('0x37')]=qs[_0xce43('0x38')](_['pick'](_0x536452[_0xce43('0x2e')],_0x2a2d1d[_0xce43('0x38')]),_0x4b966a);if(_0x536452[_0xce43('0x2e')][_0xce43('0x39')]){_0x4402f8[_0xce43('0x37')]=_['merge'](_0x4402f8['where'],{'$or':_[_0xce43('0x27')](_0x4b966a,function(_0x143eef){if(_0x143eef['type']!==_0xce43('0x3a')){var _0x269d81={};_0x269d81[_0x143eef[_0xce43('0x24')]]={'$like':'%'+_0x536452[_0xce43('0x2e')]['filter']+'%'};return _0x269d81;}})});}_0x4402f8=_[_0xce43('0x3b')]({},_0x4402f8,_0x536452['options']);var _0x83cf22={'where':_0x4402f8[_0xce43('0x37')]};return db['FreshdeskAccount'][_0xce43('0x1a')](_0x83cf22)[_0xce43('0x20')](function(_0x294299){_0x44ac56['count']=_0x294299;if(_0x536452['query'][_0xce43('0x3c')]){_0x4402f8[_0xce43('0x3d')]=[{'all':!![]}];}return db[_0xce43('0x28')]['findAll'](_0x4402f8);})[_0xce43('0x20')](function(_0x149f6a){_0x44ac56[_0xce43('0x3e')]=_0x149f6a;return _0x44ac56;})[_0xce43('0x20')](respondWithFilteredResult(_0xb6527c,_0x4402f8))['catch'](handleError(_0xb6527c,null));};exports[_0xce43('0x3f')]=function(_0x29a516,_0x3b7717){var _0xc55921={'raw':![],'where':{'id':_0x29a516[_0xce43('0x40')]['id']}},_0x3d8734={};_0x3d8734[_0xce43('0x2c')]=_[_0xce43('0x2d')](db[_0xce43('0x28')]['rawAttributes']);_0x3d8734['query']=_[_0xce43('0x2d')](_0x29a516[_0xce43('0x2e')]);_0x3d8734[_0xce43('0x38')]=_[_0xce43('0x2f')](_0x3d8734[_0xce43('0x2c')],_0x3d8734[_0xce43('0x2e')]);_0xc55921[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x3d8734[_0xce43('0x2c')],qs[_0xce43('0x31')](_0x29a516[_0xce43('0x2e')][_0xce43('0x31')]));_0xc55921[_0xce43('0x30')]=_0xc55921[_0xce43('0x30')][_0xce43('0x32')]?_0xc55921[_0xce43('0x30')]:_0x3d8734[_0xce43('0x2c')];if(_0x29a516[_0xce43('0x2e')]['includeAll']){_0xc55921[_0xce43('0x3d')]=[{'all':!![]}];}_0xc55921=_[_0xce43('0x3b')]({},_0xc55921,_0x29a516[_0xce43('0x41')]);return db['FreshdeskAccount']['find'](_0xc55921)[_0xce43('0x20')](handleEntityNotFound(_0x3b7717,null))['then'](respondWithResult(_0x3b7717,null))['catch'](handleError(_0x3b7717,null));};exports['create']=function(_0x4cdd4f,_0x3de6ec){return db[_0xce43('0x28')]['create'](_0x4cdd4f[_0xce43('0x42')],{})['then'](respondWithResult(_0x3de6ec,0xc9))['catch'](handleError(_0x3de6ec,null));};exports[_0xce43('0x1f')]=function(_0x562963,_0x55181e){if(_0x562963[_0xce43('0x42')]['id']){delete _0x562963[_0xce43('0x42')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x562963[_0xce43('0x40')]['id']}})['then'](handleEntityNotFound(_0x55181e,null))[_0xce43('0x20')](saveUpdates(_0x562963[_0xce43('0x42')],null))['then'](respondWithResult(_0x55181e,null))[_0xce43('0x43')](handleError(_0x55181e,null));};exports[_0xce43('0x21')]=function(_0x29ec7d,_0x180fa2){return db[_0xce43('0x28')][_0xce43('0x44')]({'where':{'id':_0x29ec7d[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x180fa2,null))[_0xce43('0x20')](removeEntity(_0x180fa2,null))['catch'](handleError(_0x180fa2,null));};exports['getConfigurations']=function(_0x359330,_0x25fb99,_0x29d911){var _0xc9e65e={};var _0x17b110={};var _0x43ba4f;var _0x59a74d;return db[_0xce43('0x28')][_0xce43('0x45')]({'where':{'id':_0x359330[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x25fb99,null))[_0xce43('0x20')](function(_0x46905b){if(_0x46905b){_0x43ba4f=_0x46905b;_0x17b110[_0xce43('0x2c')]=_[_0xce43('0x2d')](db[_0xce43('0x46')][_0xce43('0x47')]);_0x17b110[_0xce43('0x2e')]=_['keys'](_0x359330[_0xce43('0x2e')]);_0x17b110[_0xce43('0x38')]=_[_0xce43('0x2f')](_0x17b110['model'],_0x17b110[_0xce43('0x2e')]);_0xc9e65e[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x17b110['model'],qs['fields'](_0x359330[_0xce43('0x2e')]['fields']));_0xc9e65e[_0xce43('0x30')]=_0xc9e65e[_0xce43('0x30')][_0xce43('0x32')]?_0xc9e65e['attributes']:_0x17b110['model'];_0xc9e65e['order']=qs['sort'](_0x359330['query']['sort']);_0xc9e65e[_0xce43('0x37')]=qs[_0xce43('0x38')](_[_0xce43('0x48')](_0x359330[_0xce43('0x2e')],_0x17b110['filters']));if(_0x359330['query'][_0xce43('0x39')]){_0xc9e65e[_0xce43('0x37')]=_[_0xce43('0x3b')](_0xc9e65e[_0xce43('0x37')],{'$or':_['map'](_0xc9e65e[_0xce43('0x30')],function(_0xdb94a7){var _0x4b3017={};_0x4b3017[_0xdb94a7]={'$like':'%'+_0x359330[_0xce43('0x2e')][_0xce43('0x39')]+'%'};return _0x4b3017;})});}_0xc9e65e=_[_0xce43('0x3b')]({},_0xc9e65e,_0x359330['options']);return _0x43ba4f[_0xce43('0x49')](_0xc9e65e);}})[_0xce43('0x20')](function(_0x5eba18){if(_0x5eba18){_0x59a74d=_0x5eba18['length'];if(!_0x359330['query'][_0xce43('0x33')]('nolimit')){_0xc9e65e[_0xce43('0x19')]=qs['limit'](_0x359330[_0xce43('0x2e')]['limit']);_0xc9e65e['offset']=qs[_0xce43('0x17')](_0x359330['query'][_0xce43('0x17')]);}return _0x43ba4f[_0xce43('0x49')](_0xc9e65e);}})[_0xce43('0x20')](function(_0x37cadd){if(_0x37cadd){return _0x37cadd?{'count':_0x59a74d,'rows':_0x37cadd}:null;}})[_0xce43('0x20')](respondWithResult(_0x25fb99,null))[_0xce43('0x43')](handleError(_0x25fb99,null));};exports[_0xce43('0x4a')]=function(_0x2e2680,_0x1aa98f,_0x3514fd){if(_0x2e2680[_0xce43('0x42')]['id']){delete _0x2e2680['body']['id'];}return db[_0xce43('0x28')][_0xce43('0x45')]({'where':{'id':_0x2e2680[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x1aa98f,null))[_0xce43('0x20')](function(_0x41c26e){if(_0x41c26e){_0x2e2680[_0xce43('0x42')][_0xce43('0x4b')]=_0x41c26e['id'];_0x2e2680['body']['Subjects']=integrations[_0xce43('0x4c')](_0x2e2680[_0xce43('0x42')]['channel'],_0x2e2680[_0xce43('0x42')]['type']);_0x2e2680['body'][_0xce43('0x4d')]=integrations[_0xce43('0x4e')](_0x2e2680[_0xce43('0x42')][_0xce43('0x4f')],_0x2e2680[_0xce43('0x42')]['type']);return db[_0xce43('0x46')][_0xce43('0x50')](_0x2e2680['body'],{'include':[{'model':db[_0xce43('0x51')],'as':'Subjects'},{'model':db[_0xce43('0x51')],'as':_0xce43('0x4d')}]});}return null;})[_0xce43('0x20')](respondWithResult(_0x1aa98f,null))['catch'](handleError(_0x1aa98f,null));};exports[_0xce43('0x52')]=function(_0x48d113,_0xbaf075,_0x596da4){var _0x29c768='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x48d113['params']['id']},'attributes':['id',_0xce43('0x53'),'apiKey']})['then'](handleEntityNotFound(_0xbaf075,null))[_0xce43('0x20')](function(_0x320f71){if(_0x320f71){_0x29c768=_0x320f71[_0xce43('0x53')];var _0x529064=_0x29c768[_0xce43('0x54')](-0x1);if(_0x529064==='/'){_0x29c768=_0x29c768[_0xce43('0x55')](0x0,_0x29c768[_0xce43('0x56')](_0x529064));}return rp({'method':_0xce43('0x57'),'uri':util['format']('%s/%s',_0x29c768,_0xce43('0x58')),'headers':{'Authorization':util[_0xce43('0x59')](_0xce43('0x5a'),new Buffer(util[_0xce43('0x59')]('%s:X',_0x320f71[_0xce43('0x5b')]))[_0xce43('0x5c')]('base64'))},'json':!![]});}})[_0xce43('0x20')](function(_0x578b38){if(_0x578b38){var _0x2d1bfb=[_0xce43('0x5d'),_0xce43('0x5e'),_0xce43('0x5f'),_0xce43('0x60'),_0xce43('0x16'),_0xce43('0x61'),_0xce43('0x62'),_0xce43('0x63'),_0xce43('0x64'),_0xce43('0x62'),_0xce43('0x65')];_[_0xce43('0x66')](_0x578b38,function(_0x161a06){return _0x2d1bfb['includes'](_0x161a06['name'])||!_0x161a06[_0xce43('0x67')]&&_0x161a06[_0xce43('0x2a')]!==_0xce43('0x68')&&_0x161a06['type']!==_0xce43('0x69');});return{'count':_0x578b38['length'],'rows':_[_0xce43('0x27')](_0x578b38,function(_0x8fd118){return{'id':_0x8fd118['name'],'name':_0x8fd118[_0xce43('0x6a')],'custom':!_0x8fd118[_0xce43('0x67')],'options':_0x8fd118['choices']?_[_0xce43('0x27')](_0x8fd118['choices'],function(_0x41f4a7){return{'name':_[_0xce43('0x6b')](_0x41f4a7),'value':_0x41f4a7};}):[]};})};}})[_0xce43('0x20')](respondWithResult(_0xbaf075,null))[_0xce43('0x43')](function(_0x7f4104){var _0x632fa6=_0x48d113[_0xce43('0x2e')][_0xce43('0x6c')]?0x1f4:_0x7f4104[_0xce43('0x6d')]||0x1f4;logger[_0xce43('0x6e')](_0xce43('0x6f'),'getFields',_0x632fa6,JSON['stringify'](_0x7f4104));delete _0x7f4104['name'];if(_0x632fa6===0x191){_0x632fa6=0x190;}_0xbaf075[_0xce43('0x16')](_0x632fa6)[_0xce43('0x25')](_0x48d113[_0xce43('0x2e')][_0xce43('0x6c')]?{'message':_0xce43('0x70'),'statusCode':_0x7f4104[_0xce43('0x6d')]}:_0x7f4104);});}; \ No newline at end of file +var _0x66d3=['body','destroy','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshdeskField','getFields','remoteUri','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','group','source','ticket_type','company','remove','includes','custom_text','label','default','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','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','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','undefined','offset','count','set','reject','save','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','FreshdeskAccount','includeAll','include','findAll','rows','catch','show','params','length','find','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x66d3,0x10f));var _0x366d=function(_0x5931e2,_0x59e522){_0x5931e2=_0x5931e2-0x0;var _0x77a877=_0x66d3[_0x5931e2];return _0x77a877;};'use strict';var emlformat=require(_0x366d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x366d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x366d('0x2'));var moment=require(_0x366d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x366d('0x4'));var util=require('util');var path=require(_0x366d('0x5'));var sox=require('sox');var csv=require(_0x366d('0x6'));var ejs=require(_0x366d('0x7'));var fs=require('fs');var fs_extra=require(_0x366d('0x8'));var _=require(_0x366d('0x9'));var squel=require(_0x366d('0xa'));var crypto=require(_0x366d('0xb'));var jsforce=require(_0x366d('0xc'));var deskjs=require(_0x366d('0xd'));var toCsv=require(_0x366d('0x6'));var querystring=require(_0x366d('0xe'));var Papa=require(_0x366d('0xf'));var Redis=require('ioredis');var authService=require(_0x366d('0x10'));var qs=require(_0x366d('0x11'));var as=require(_0x366d('0x12'));var hardwareService=require(_0x366d('0x13'));var logger=require(_0x366d('0x14'))(_0x366d('0x15'));var utils=require(_0x366d('0x16'));var config=require(_0x366d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x366d('0x18'));function respondWithStatusCode(_0x797ee,_0x3dd776){_0x3dd776=_0x3dd776||0xcc;return function(_0x2eef82){if(_0x2eef82){return _0x797ee[_0x366d('0x19')](_0x3dd776);}return _0x797ee[_0x366d('0x1a')](_0x3dd776)['end']();};}function respondWithResult(_0x265292,_0x2a3fdb){_0x2a3fdb=_0x2a3fdb||0xc8;return function(_0x4e1d8e){if(_0x4e1d8e){return _0x265292[_0x366d('0x1a')](_0x2a3fdb)[_0x366d('0x1b')](_0x4e1d8e);}};}function respondWithFilteredResult(_0x54a1bb,_0x3da66f){return function(_0x309dc6){if(_0x309dc6){var _0x413008=typeof _0x3da66f['offset']===_0x366d('0x1c')&&typeof _0x3da66f['limit']===_0x366d('0x1c');var _0x6b9092=_0x309dc6['count'];var _0x401eca=_0x413008?0x0:_0x3da66f[_0x366d('0x1d')];var _0x12fecc=_0x413008?_0x309dc6[_0x366d('0x1e')]:_0x3da66f[_0x366d('0x1d')]+_0x3da66f['limit'];var _0xb8b16d;if(_0x12fecc>=_0x6b9092){_0x12fecc=_0x6b9092;_0xb8b16d=0xc8;}else{_0xb8b16d=0xce;}_0x54a1bb['status'](_0xb8b16d);return _0x54a1bb[_0x366d('0x1f')]('Content-Range',_0x401eca+'-'+_0x12fecc+'/'+_0x6b9092)['json'](_0x309dc6);}return null;};}function patchUpdates(_0x219106){return function(_0x3eb8d9){try{jsonpatch['apply'](_0x3eb8d9,_0x219106,!![]);}catch(_0x189dc0){return BPromise[_0x366d('0x20')](_0x189dc0);}return _0x3eb8d9[_0x366d('0x21')]();};}function saveUpdates(_0x58d16f,_0x3b5c89){return function(_0x3c540d){if(_0x3c540d){return _0x3c540d['update'](_0x58d16f)[_0x366d('0x22')](function(_0x47ebf4){return _0x47ebf4;});}return null;};}function removeEntity(_0x1c9ee9,_0x1326c9){return function(_0x46bf52){if(_0x46bf52){return _0x46bf52['destroy']()[_0x366d('0x22')](function(){_0x1c9ee9[_0x366d('0x1a')](0xcc)[_0x366d('0x23')]();});}};}function handleEntityNotFound(_0x5254e6,_0x53002e){return function(_0x5aec17){if(!_0x5aec17){_0x5254e6[_0x366d('0x19')](0x194);}return _0x5aec17;};}function handleError(_0x40f3df,_0x5d2b67){_0x5d2b67=_0x5d2b67||0x1f4;return function(_0x5592a1){logger[_0x366d('0x24')](_0x5592a1[_0x366d('0x25')]);if(_0x5592a1[_0x366d('0x26')]){delete _0x5592a1[_0x366d('0x26')];}_0x40f3df['status'](_0x5d2b67)[_0x366d('0x27')](_0x5592a1);};}exports['index']=function(_0x47cc0c,_0x13a6b2){var _0x594d42={},_0x535b26={},_0xa856fa={'count':0x0,'rows':[]};var _0x13aaca=_[_0x366d('0x28')](db['FreshdeskAccount'][_0x366d('0x29')],function(_0x2cb209){return{'name':_0x2cb209[_0x366d('0x2a')],'type':_0x2cb209[_0x366d('0x2b')][_0x366d('0x2c')]};});_0x535b26[_0x366d('0x2d')]=_['map'](_0x13aaca,_0x366d('0x26'));_0x535b26['query']=_[_0x366d('0x2e')](_0x47cc0c['query']);_0x535b26[_0x366d('0x2f')]=_[_0x366d('0x30')](_0x535b26[_0x366d('0x2d')],_0x535b26[_0x366d('0x31')]);_0x594d42['attributes']=_[_0x366d('0x30')](_0x535b26[_0x366d('0x2d')],qs[_0x366d('0x32')](_0x47cc0c[_0x366d('0x31')][_0x366d('0x32')]));_0x594d42[_0x366d('0x33')]=_0x594d42['attributes']['length']?_0x594d42[_0x366d('0x33')]:_0x535b26[_0x366d('0x2d')];if(!_0x47cc0c[_0x366d('0x31')][_0x366d('0x34')]('nolimit')){_0x594d42[_0x366d('0x35')]=qs[_0x366d('0x35')](_0x47cc0c[_0x366d('0x31')][_0x366d('0x35')]);_0x594d42[_0x366d('0x1d')]=qs[_0x366d('0x1d')](_0x47cc0c[_0x366d('0x31')][_0x366d('0x1d')]);}_0x594d42[_0x366d('0x36')]=qs['sort'](_0x47cc0c[_0x366d('0x31')][_0x366d('0x37')]);_0x594d42[_0x366d('0x38')]=qs['filters'](_[_0x366d('0x39')](_0x47cc0c[_0x366d('0x31')],_0x535b26[_0x366d('0x2f')]),_0x13aaca);if(_0x47cc0c[_0x366d('0x31')][_0x366d('0x3a')]){_0x594d42[_0x366d('0x38')]=_['merge'](_0x594d42[_0x366d('0x38')],{'$or':_[_0x366d('0x28')](_0x13aaca,function(_0x28dabd){if(_0x28dabd[_0x366d('0x2b')]!=='VIRTUAL'){var _0xffb576={};_0xffb576[_0x28dabd[_0x366d('0x26')]]={'$like':'%'+_0x47cc0c[_0x366d('0x31')][_0x366d('0x3a')]+'%'};return _0xffb576;}})});}_0x594d42=_[_0x366d('0x3b')]({},_0x594d42,_0x47cc0c['options']);var _0xf280fe={'where':_0x594d42[_0x366d('0x38')]};return db[_0x366d('0x3c')][_0x366d('0x1e')](_0xf280fe)[_0x366d('0x22')](function(_0x2957e2){_0xa856fa[_0x366d('0x1e')]=_0x2957e2;if(_0x47cc0c['query'][_0x366d('0x3d')]){_0x594d42[_0x366d('0x3e')]=[{'all':!![]}];}return db[_0x366d('0x3c')][_0x366d('0x3f')](_0x594d42);})[_0x366d('0x22')](function(_0x2dbcb5){_0xa856fa[_0x366d('0x40')]=_0x2dbcb5;return _0xa856fa;})[_0x366d('0x22')](respondWithFilteredResult(_0x13a6b2,_0x594d42))[_0x366d('0x41')](handleError(_0x13a6b2,null));};exports[_0x366d('0x42')]=function(_0x1b5d5c,_0x185abc){var _0x53c654={'raw':![],'where':{'id':_0x1b5d5c[_0x366d('0x43')]['id']}},_0xfe8801={};_0xfe8801['model']=_[_0x366d('0x2e')](db['FreshdeskAccount'][_0x366d('0x29')]);_0xfe8801['query']=_[_0x366d('0x2e')](_0x1b5d5c['query']);_0xfe8801[_0x366d('0x2f')]=_[_0x366d('0x30')](_0xfe8801[_0x366d('0x2d')],_0xfe8801[_0x366d('0x31')]);_0x53c654[_0x366d('0x33')]=_[_0x366d('0x30')](_0xfe8801[_0x366d('0x2d')],qs['fields'](_0x1b5d5c[_0x366d('0x31')][_0x366d('0x32')]));_0x53c654[_0x366d('0x33')]=_0x53c654[_0x366d('0x33')][_0x366d('0x44')]?_0x53c654[_0x366d('0x33')]:_0xfe8801[_0x366d('0x2d')];if(_0x1b5d5c[_0x366d('0x31')][_0x366d('0x3d')]){_0x53c654[_0x366d('0x3e')]=[{'all':!![]}];}_0x53c654=_[_0x366d('0x3b')]({},_0x53c654,_0x1b5d5c['options']);return db[_0x366d('0x3c')][_0x366d('0x45')](_0x53c654)[_0x366d('0x22')](handleEntityNotFound(_0x185abc,null))['then'](respondWithResult(_0x185abc,null))[_0x366d('0x41')](handleError(_0x185abc,null));};exports['create']=function(_0x15efc4,_0x423fb6){return db[_0x366d('0x3c')]['create'](_0x15efc4['body'],{})[_0x366d('0x22')](respondWithResult(_0x423fb6,0xc9))[_0x366d('0x41')](handleError(_0x423fb6,null));};exports[_0x366d('0x46')]=function(_0x68ba99,_0xe88468){if(_0x68ba99[_0x366d('0x47')]['id']){delete _0x68ba99[_0x366d('0x47')]['id'];}return db['FreshdeskAccount'][_0x366d('0x45')]({'where':{'id':_0x68ba99[_0x366d('0x43')]['id']}})[_0x366d('0x22')](handleEntityNotFound(_0xe88468,null))['then'](saveUpdates(_0x68ba99['body'],null))[_0x366d('0x22')](respondWithResult(_0xe88468,null))[_0x366d('0x41')](handleError(_0xe88468,null));};exports[_0x366d('0x48')]=function(_0x3948c8,_0xfffa10){return db[_0x366d('0x3c')][_0x366d('0x45')]({'where':{'id':_0x3948c8['params']['id']}})[_0x366d('0x22')](handleEntityNotFound(_0xfffa10,null))[_0x366d('0x22')](removeEntity(_0xfffa10,null))[_0x366d('0x41')](handleError(_0xfffa10,null));};exports[_0x366d('0x49')]=function(_0x1537d9,_0x9d8be,_0x7c3397){var _0x315f08={};var _0x8520af={};var _0x1359ea;var _0x39d546;return db['FreshdeskAccount'][_0x366d('0x4a')]({'where':{'id':_0x1537d9[_0x366d('0x43')]['id']}})['then'](handleEntityNotFound(_0x9d8be,null))[_0x366d('0x22')](function(_0x207afe){if(_0x207afe){_0x1359ea=_0x207afe;_0x8520af['model']=_[_0x366d('0x2e')](db[_0x366d('0x4b')]['rawAttributes']);_0x8520af[_0x366d('0x31')]=_[_0x366d('0x2e')](_0x1537d9[_0x366d('0x31')]);_0x8520af[_0x366d('0x2f')]=_['intersection'](_0x8520af[_0x366d('0x2d')],_0x8520af['query']);_0x315f08[_0x366d('0x33')]=_[_0x366d('0x30')](_0x8520af['model'],qs[_0x366d('0x32')](_0x1537d9['query'][_0x366d('0x32')]));_0x315f08[_0x366d('0x33')]=_0x315f08[_0x366d('0x33')]['length']?_0x315f08[_0x366d('0x33')]:_0x8520af[_0x366d('0x2d')];_0x315f08[_0x366d('0x36')]=qs[_0x366d('0x37')](_0x1537d9['query'][_0x366d('0x37')]);_0x315f08[_0x366d('0x38')]=qs[_0x366d('0x2f')](_[_0x366d('0x39')](_0x1537d9[_0x366d('0x31')],_0x8520af[_0x366d('0x2f')]));if(_0x1537d9[_0x366d('0x31')][_0x366d('0x3a')]){_0x315f08[_0x366d('0x38')]=_[_0x366d('0x3b')](_0x315f08['where'],{'$or':_[_0x366d('0x28')](_0x315f08[_0x366d('0x33')],function(_0x1da500){var _0x152da4={};_0x152da4[_0x1da500]={'$like':'%'+_0x1537d9[_0x366d('0x31')][_0x366d('0x3a')]+'%'};return _0x152da4;})});}_0x315f08=_[_0x366d('0x3b')]({},_0x315f08,_0x1537d9['options']);return _0x1359ea[_0x366d('0x49')](_0x315f08);}})[_0x366d('0x22')](function(_0x1da9a1){if(_0x1da9a1){_0x39d546=_0x1da9a1[_0x366d('0x44')];if(!_0x1537d9[_0x366d('0x31')][_0x366d('0x34')](_0x366d('0x4c'))){_0x315f08[_0x366d('0x35')]=qs[_0x366d('0x35')](_0x1537d9['query'][_0x366d('0x35')]);_0x315f08[_0x366d('0x1d')]=qs['offset'](_0x1537d9[_0x366d('0x31')][_0x366d('0x1d')]);}return _0x1359ea[_0x366d('0x49')](_0x315f08);}})[_0x366d('0x22')](function(_0x2ac178){if(_0x2ac178){return _0x2ac178?{'count':_0x39d546,'rows':_0x2ac178}:null;}})[_0x366d('0x22')](respondWithResult(_0x9d8be,null))[_0x366d('0x41')](handleError(_0x9d8be,null));};exports[_0x366d('0x4d')]=function(_0x25db3f,_0x299b86,_0x54430c){if(_0x25db3f[_0x366d('0x47')]['id']){delete _0x25db3f['body']['id'];}return db[_0x366d('0x3c')][_0x366d('0x4a')]({'where':{'id':_0x25db3f['params']['id']}})[_0x366d('0x22')](handleEntityNotFound(_0x299b86,null))[_0x366d('0x22')](function(_0x278ca2){if(_0x278ca2){_0x25db3f[_0x366d('0x47')]['AccountId']=_0x278ca2['id'];_0x25db3f[_0x366d('0x47')][_0x366d('0x4e')]=integrations[_0x366d('0x4f')](_0x25db3f[_0x366d('0x47')][_0x366d('0x50')],_0x25db3f['body'][_0x366d('0x2b')]);_0x25db3f[_0x366d('0x47')][_0x366d('0x51')]=integrations[_0x366d('0x52')](_0x25db3f[_0x366d('0x47')][_0x366d('0x50')],_0x25db3f[_0x366d('0x47')][_0x366d('0x2b')]);return db[_0x366d('0x4b')][_0x366d('0x53')](_0x25db3f[_0x366d('0x47')],{'include':[{'model':db['FreshdeskField'],'as':_0x366d('0x4e')},{'model':db[_0x366d('0x54')],'as':_0x366d('0x51')}]});}return null;})['then'](respondWithResult(_0x299b86,null))['catch'](handleError(_0x299b86,null));};exports[_0x366d('0x55')]=function(_0x15d796,_0x33f391,_0x241fd6){var _0x25a823='';return db[_0x366d('0x3c')][_0x366d('0x4a')]({'where':{'id':_0x15d796[_0x366d('0x43')]['id']},'attributes':['id',_0x366d('0x56'),'apiKey']})[_0x366d('0x22')](handleEntityNotFound(_0x33f391,null))[_0x366d('0x22')](function(_0x79ca8a){if(_0x79ca8a){_0x25a823=_0x79ca8a[_0x366d('0x56')];var _0x54e6d0=_0x25a823['slice'](-0x1);if(_0x54e6d0==='/'){_0x25a823=_0x25a823[_0x366d('0x57')](0x0,_0x25a823[_0x366d('0x58')](_0x54e6d0));}return rp({'method':_0x366d('0x59'),'uri':util[_0x366d('0x5a')]('%s/%s',_0x25a823,_0x366d('0x5b')),'headers':{'Authorization':util[_0x366d('0x5a')](_0x366d('0x5c'),new Buffer(util[_0x366d('0x5a')](_0x366d('0x5d'),_0x79ca8a['apiKey']))[_0x366d('0x5e')](_0x366d('0x5f')))},'json':!![]});}})[_0x366d('0x22')](function(_0x49df32){if(_0x49df32){var _0x466bfe=[_0x366d('0x60'),_0x366d('0x61'),'agent',_0x366d('0x62'),_0x366d('0x1a'),'priority',_0x366d('0x63'),_0x366d('0x64'),_0x366d('0x65'),_0x366d('0x63'),_0x366d('0x66')];_[_0x366d('0x67')](_0x49df32,function(_0x3192ba){return _0x466bfe[_0x366d('0x68')](_0x3192ba[_0x366d('0x26')])||!_0x3192ba['default']&&_0x3192ba[_0x366d('0x2b')]!==_0x366d('0x69')&&_0x3192ba[_0x366d('0x2b')]!=='custom_dropdown';});return{'count':_0x49df32[_0x366d('0x44')],'rows':_[_0x366d('0x28')](_0x49df32,function(_0x4046f3){return{'id':_0x4046f3[_0x366d('0x26')],'name':_0x4046f3[_0x366d('0x6a')],'custom':!_0x4046f3[_0x366d('0x6b')],'options':_0x4046f3[_0x366d('0x6c')]?_[_0x366d('0x28')](_0x4046f3[_0x366d('0x6c')],function(_0x1d380d){return{'name':_['capitalize'](_0x1d380d),'value':_0x1d380d};}):[]};})};}})['then'](respondWithResult(_0x33f391,null))['catch'](function(_0x1b2c75){var _0x3b01fb=_0x15d796[_0x366d('0x31')][_0x366d('0x6d')]?0x1f4:_0x1b2c75[_0x366d('0x6e')]||0x1f4;logger[_0x366d('0x24')](_0x366d('0x6f'),_0x366d('0x55'),_0x3b01fb,JSON[_0x366d('0x70')](_0x1b2c75));delete _0x1b2c75[_0x366d('0x26')];if(_0x3b01fb===0x191){_0x3b01fb=0x190;}_0x33f391[_0x366d('0x1a')](_0x3b01fb)[_0x366d('0x27')](_0x15d796[_0x366d('0x31')][_0x366d('0x6d')]?{'message':_0x366d('0x71'),'statusCode':_0x1b2c75[_0x366d('0x6e')]}:_0x1b2c75);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b95b1f9..798467d 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 _0x94a1=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4e8505,_0x4afb85){var _0x16af15=function(_0x17f487){while(--_0x17f487){_0x4e8505['push'](_0x4e8505['shift']());}};_0x16af15(++_0x4afb85);}(_0x94a1,0x1d1));var _0x194a=function(_0x28a5a2,_0x38e66f){_0x28a5a2=_0x28a5a2-0x0;var _0x5e9811=_0x94a1[_0x28a5a2];return _0x5e9811;};'use strict';var _=require(_0x194a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x194a('0x1'));var rp=require(_0x194a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x194a('0x3'));var config=require(_0x194a('0x4'));var attributes=require(_0x194a('0x5'));var integrations=require(_0x194a('0x6'));module[_0x194a('0x7')]=function(_0x132575,_0x10a4f9){return _0x132575[_0x194a('0x8')](_0x194a('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf03=['request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','bluebird'];(function(_0x5a38a1,_0x5ae232){var _0x4c5c44=function(_0x221326){while(--_0x221326){_0x5a38a1['push'](_0x5a38a1['shift']());}};_0x4c5c44(++_0x5ae232);}(_0xbf03,0xa7));var _0x3bf0=function(_0xf8b332,_0x2de168){_0xf8b332=_0xf8b332-0x0;var _0xc591f8=_0xbf03[_0xf8b332];return _0xc591f8;};'use strict';var _=require(_0x3bf0('0x0'));var util=require(_0x3bf0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3bf0('0x2'));var rp=require(_0x3bf0('0x3'));var fs=require('fs');var path=require(_0x3bf0('0x4'));var rimraf=require('rimraf');var config=require(_0x3bf0('0x5'));var attributes=require(_0x3bf0('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x418888,_0x446db7){return _0x418888[_0x3bf0('0x7')](_0x3bf0('0x8'),attributes,{'tableName':_0x3bf0('0x9'),'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 ce9a314..8eb28de 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 _0x6141=['result','catch','GetFreshdeskAccount','findAll','options','attributes','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','raw','where','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x5f1559,_0x32da6b){var _0x8400c0=function(_0x1a9eb3){while(--_0x1a9eb3){_0x5f1559['push'](_0x5f1559['shift']());}};_0x8400c0(++_0x32da6b);}(_0x6141,0x1dd));var _0x1614=function(_0x50b2dc,_0x24f87f){_0x50b2dc=_0x50b2dc-0x0;var _0x8ce955=_0x6141[_0x50b2dc];return _0x8ce955;};'use strict';var _=require(_0x1614('0x0'));var util=require(_0x1614('0x1'));var moment=require('moment');var BPromise=require(_0x1614('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1614('0x3'));var db=require(_0x1614('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1614('0x5'))(_0x1614('0x6'));var config=require('../../config/environment');var jayson=require(_0x1614('0x7'));var client=jayson['client'][_0x1614('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x199204,_0x89820,_0x520457){return new BPromise(function(_0x405dee,_0x58b823){return client[_0x1614('0x9')](_0x199204,_0x520457)[_0x1614('0xa')](function(_0x5cafd4){logger['info'](_0x1614('0xb'),_0x89820,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x89820,_0x1614('0xc'),JSON[_0x1614('0xd')](_0x5cafd4));if(_0x5cafd4[_0x1614('0xe')]){if(_0x5cafd4['error'][_0x1614('0xf')]===0x1f4){logger[_0x1614('0xe')](_0x1614('0xb'),_0x89820,_0x5cafd4[_0x1614('0xe')][_0x1614('0x10')]);return _0x58b823(_0x5cafd4['error']['message']);}logger[_0x1614('0xe')](_0x1614('0xb'),_0x89820,_0x5cafd4['error'][_0x1614('0x10')]);return _0x405dee(_0x5cafd4[_0x1614('0xe')]['message']);}else{logger[_0x1614('0x11')](_0x1614('0xb'),_0x89820,_0x1614('0xc'));_0x405dee(_0x5cafd4[_0x1614('0x12')][_0x1614('0x10')]);}})[_0x1614('0x13')](function(_0x55aa08){logger[_0x1614('0xe')](_0x1614('0xb'),_0x89820,_0x55aa08);_0x58b823(_0x55aa08);});});}exports[_0x1614('0x14')]=function(_0x585d01){var _0x189c03=this;return new Promise(function(_0xe5c6eb,_0xda6cd3){return db['FreshdeskAccount'][_0x1614('0x15')]({'raw':_0x585d01[_0x1614('0x16')]?_0x585d01['options']['raw']===undefined?!![]:![]:!![],'where':_0x585d01['options']?_0x585d01[_0x1614('0x16')]['where']||null:null,'attributes':_0x585d01[_0x1614('0x16')]?_0x585d01[_0x1614('0x16')][_0x1614('0x17')]||null:null,'limit':_0x585d01[_0x1614('0x16')]?_0x585d01['options']['limit']||null:null,'include':_0x585d01[_0x1614('0x16')]?_0x585d01[_0x1614('0x16')][_0x1614('0x18')]?_[_0x1614('0x19')](_0x585d01[_0x1614('0x16')][_0x1614('0x18')],function(_0x21bbbc){return{'model':db[_0x21bbbc['model']],'as':_0x21bbbc['as'],'attributes':_0x21bbbc['attributes'],'include':_0x21bbbc[_0x1614('0x18')]?_['map'](_0x21bbbc[_0x1614('0x18')],function(_0x256661){return{'model':db[_0x256661['model']],'as':_0x256661['as'],'attributes':_0x256661[_0x1614('0x17')],'include':_0x256661[_0x1614('0x18')]?_[_0x1614('0x19')](_0x256661['include'],function(_0x107f98){return{'model':db[_0x107f98[_0x1614('0x1a')]],'as':_0x107f98['as'],'attributes':_0x107f98[_0x1614('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41be8e){logger[_0x1614('0x11')]('GetFreshdeskAccount',_0x585d01);logger['debug']('GetFreshdeskAccount',_0x585d01,JSON[_0x1614('0xd')](_0x41be8e));_0xe5c6eb(_0x41be8e);})[_0x1614('0x13')](function(_0x4f4c92){logger['error'](_0x1614('0x14'),_0x4f4c92[_0x1614('0x10')],_0x585d01);_0xda6cd3(_0x189c03['error'](0x1f4,_0x4f4c92['message']));});});};exports[_0x1614('0x1b')]=function(_0x1aaf82){var _0x3cf21e=this;return new Promise(function(_0x5e93e9,_0x53801d){return db[_0x1614('0x1c')][_0x1614('0x1d')]({'raw':_0x1aaf82[_0x1614('0x16')]?_0x1aaf82['options'][_0x1614('0x1e')]===undefined?!![]:![]:!![],'where':_0x1aaf82['options']?_0x1aaf82[_0x1614('0x16')][_0x1614('0x1f')]||null:null,'attributes':_0x1aaf82['options']?_0x1aaf82[_0x1614('0x16')][_0x1614('0x17')]||null:null,'include':_0x1aaf82[_0x1614('0x16')]?_0x1aaf82['options'][_0x1614('0x18')]?_['map'](_0x1aaf82[_0x1614('0x16')]['include'],function(_0x29920c){return{'model':db[_0x29920c[_0x1614('0x1a')]],'as':_0x29920c['as'],'attributes':_0x29920c['attributes'],'include':_0x29920c[_0x1614('0x18')]?_[_0x1614('0x19')](_0x29920c[_0x1614('0x18')],function(_0x44bdd6){return{'model':db[_0x44bdd6[_0x1614('0x1a')]],'as':_0x44bdd6['as'],'attributes':_0x44bdd6[_0x1614('0x17')],'include':_0x44bdd6[_0x1614('0x18')]?_[_0x1614('0x19')](_0x44bdd6['include'],function(_0x171ba9){return{'model':db[_0x171ba9[_0x1614('0x1a')]],'as':_0x171ba9['as'],'attributes':_0x171ba9[_0x1614('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1614('0xa')](function(_0x4f8075){logger['info'](_0x1614('0x1b'),_0x1aaf82);logger[_0x1614('0x20')]('ShowFreshdeskAccount',_0x1aaf82,JSON[_0x1614('0xd')](_0x4f8075));_0x5e93e9(_0x4f8075);})['catch'](function(_0x4654df){logger[_0x1614('0xe')](_0x1614('0x1b'),_0x4654df[_0x1614('0x10')],_0x1aaf82);_0x53801d(_0x3cf21e[_0x1614('0xe')](0x1f4,_0x4654df[_0x1614('0x10')]));});});}; \ No newline at end of file +var _0xe02c=['GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','info'];(function(_0x6decae,_0x5fb7de){var _0x10e46d=function(_0x46b6fd){while(--_0x46b6fd){_0x6decae['push'](_0x6decae['shift']());}};_0x10e46d(++_0x5fb7de);}(_0xe02c,0xae));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce02('0x0'));var util=require('util');var moment=require(_0xce02('0x1'));var BPromise=require(_0xce02('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce02('0x3'));var db=require(_0xce02('0x4'))['db'];var utils=require(_0xce02('0x5'));var logger=require('../../config/logger')(_0xce02('0x6'));var config=require(_0xce02('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce02('0x8')][_0xce02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x452e11,_0x1cc92f,_0x3f98a0){return new BPromise(function(_0x5086a1,_0x1e9dbe){return client[_0xce02('0xa')](_0x452e11,_0x3f98a0)[_0xce02('0xb')](function(_0x479c8c){logger['info'](_0xce02('0xc'),_0x1cc92f,_0xce02('0xd'));logger[_0xce02('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1cc92f,'request\x20sent',JSON[_0xce02('0xf')](_0x479c8c));if(_0x479c8c[_0xce02('0x10')]){if(_0x479c8c[_0xce02('0x10')]['code']===0x1f4){logger[_0xce02('0x10')](_0xce02('0xc'),_0x1cc92f,_0x479c8c[_0xce02('0x10')][_0xce02('0x11')]);return _0x1e9dbe(_0x479c8c['error'][_0xce02('0x11')]);}logger[_0xce02('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x1cc92f,_0x479c8c['error'][_0xce02('0x11')]);return _0x5086a1(_0x479c8c[_0xce02('0x10')]['message']);}else{logger['info'](_0xce02('0xc'),_0x1cc92f,_0xce02('0xd'));_0x5086a1(_0x479c8c[_0xce02('0x12')]['message']);}})[_0xce02('0x13')](function(_0x4d847d){logger[_0xce02('0x10')](_0xce02('0xc'),_0x1cc92f,_0x4d847d);_0x1e9dbe(_0x4d847d);});});}exports['GetFreshdeskAccount']=function(_0x93ce59){var _0x44d311=this;return new Promise(function(_0x3d546a,_0xd7c86e){return db[_0xce02('0x14')][_0xce02('0x15')]({'raw':_0x93ce59['options']?_0x93ce59[_0xce02('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x93ce59[_0xce02('0x16')]?_0x93ce59[_0xce02('0x16')][_0xce02('0x17')]||null:null,'attributes':_0x93ce59[_0xce02('0x16')]?_0x93ce59['options'][_0xce02('0x18')]||null:null,'limit':_0x93ce59[_0xce02('0x16')]?_0x93ce59[_0xce02('0x16')][_0xce02('0x19')]||null:null,'include':_0x93ce59[_0xce02('0x16')]?_0x93ce59[_0xce02('0x16')][_0xce02('0x1a')]?_[_0xce02('0x1b')](_0x93ce59[_0xce02('0x16')][_0xce02('0x1a')],function(_0x1a32cc){return{'model':db[_0x1a32cc[_0xce02('0x1c')]],'as':_0x1a32cc['as'],'attributes':_0x1a32cc[_0xce02('0x18')],'include':_0x1a32cc[_0xce02('0x1a')]?_[_0xce02('0x1b')](_0x1a32cc[_0xce02('0x1a')],function(_0x330edf){return{'model':db[_0x330edf[_0xce02('0x1c')]],'as':_0x330edf['as'],'attributes':_0x330edf[_0xce02('0x18')],'include':_0x330edf['include']?_[_0xce02('0x1b')](_0x330edf[_0xce02('0x1a')],function(_0xfe3349){return{'model':db[_0xfe3349[_0xce02('0x1c')]],'as':_0xfe3349['as'],'attributes':_0xfe3349[_0xce02('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4011c0){logger[_0xce02('0x1d')](_0xce02('0x1e'),_0x93ce59);logger['debug'](_0xce02('0x1e'),_0x93ce59,JSON['stringify'](_0x4011c0));_0x3d546a(_0x4011c0);})['catch'](function(_0x2a0b4c){logger[_0xce02('0x10')]('GetFreshdeskAccount',_0x2a0b4c['message'],_0x93ce59);_0xd7c86e(_0x44d311[_0xce02('0x10')](0x1f4,_0x2a0b4c[_0xce02('0x11')]));});});};exports[_0xce02('0x1f')]=function(_0x570a0e){var _0x331584=this;return new Promise(function(_0x2f7e97,_0x5d05c9){return db['FreshdeskAccount'][_0xce02('0x20')]({'raw':_0x570a0e[_0xce02('0x16')]?_0x570a0e[_0xce02('0x16')][_0xce02('0x21')]===undefined?!![]:![]:!![],'where':_0x570a0e['options']?_0x570a0e['options'][_0xce02('0x17')]||null:null,'attributes':_0x570a0e[_0xce02('0x16')]?_0x570a0e[_0xce02('0x16')][_0xce02('0x18')]||null:null,'include':_0x570a0e[_0xce02('0x16')]?_0x570a0e[_0xce02('0x16')][_0xce02('0x1a')]?_['map'](_0x570a0e[_0xce02('0x16')][_0xce02('0x1a')],function(_0x3f6d7f){return{'model':db[_0x3f6d7f[_0xce02('0x1c')]],'as':_0x3f6d7f['as'],'attributes':_0x3f6d7f[_0xce02('0x18')],'include':_0x3f6d7f['include']?_[_0xce02('0x1b')](_0x3f6d7f[_0xce02('0x1a')],function(_0x3ad316){return{'model':db[_0x3ad316[_0xce02('0x1c')]],'as':_0x3ad316['as'],'attributes':_0x3ad316[_0xce02('0x18')],'include':_0x3ad316['include']?_[_0xce02('0x1b')](_0x3ad316[_0xce02('0x1a')],function(_0x5dc1fc){return{'model':db[_0x5dc1fc['model']],'as':_0x5dc1fc['as'],'attributes':_0x5dc1fc['attributes']};}):[]};}):[]};}):[]:[]})[_0xce02('0xb')](function(_0x4f8412){logger[_0xce02('0x1d')](_0xce02('0x1f'),_0x570a0e);logger[_0xce02('0xe')](_0xce02('0x1f'),_0x570a0e,JSON['stringify'](_0x4f8412));_0x2f7e97(_0x4f8412);})[_0xce02('0x13')](function(_0xe81009){logger[_0xce02('0x10')](_0xce02('0x1f'),_0xe81009[_0xce02('0x11')],_0x570a0e);_0x5d05c9(_0x331584[_0xce02('0x10')](0x1f4,_0xe81009[_0xce02('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7beec4d..269a332 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 _0x18c9=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','/:id/fields','/:id/subjects','isAuthenticated','getDescriptions','/:id/tags','create','post','setTags','put'];(function(_0x77fcb4,_0x20d261){var _0x216256=function(_0x45d3bc){while(--_0x45d3bc){_0x77fcb4['push'](_0x77fcb4['shift']());}};_0x216256(++_0x20d261);}(_0x18c9,0xcb));var _0x918c=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x18c9[_0x489b87];return _0x1823b6;};'use strict';var multer=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var path=require('path');var timeout=require(_0x918c('0x2'));var express=require(_0x918c('0x3'));var router=express[_0x918c('0x4')]();var fs_extra=require(_0x918c('0x5'));var auth=require(_0x918c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x918c('0x7'));var controller=require(_0x918c('0x8'));router[_0x918c('0x9')]('/',auth['isAuthenticated'](),controller[_0x918c('0xa')]);router[_0x918c('0x9')](_0x918c('0xb'),auth['isAuthenticated'](),controller[_0x918c('0xc')]);router[_0x918c('0x9')](_0x918c('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x918c('0x9')](_0x918c('0xe'),auth[_0x918c('0xf')](),controller['getSubjects']);router[_0x918c('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x918c('0x10')]);router[_0x918c('0x9')](_0x918c('0x11'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x918c('0xf')](),controller[_0x918c('0x12')]);router[_0x918c('0x13')]('/:id/tags',auth[_0x918c('0xf')](),controller[_0x918c('0x14')]);router[_0x918c('0x15')](_0x918c('0xb'),auth[_0x918c('0xf')](),controller[_0x918c('0x16')]);router[_0x918c('0x17')](_0x918c('0xb'),auth[_0x918c('0xf')](),controller[_0x918c('0x18')]);module['exports']=router; \ No newline at end of file +var _0x5055=['show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x5055,0x106));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5505('0x0'));var util=require('util');var path=require(_0x5505('0x1'));var timeout=require('connect-timeout');var express=require(_0x5505('0x2'));var router=express[_0x5505('0x3')]();var fs_extra=require(_0x5505('0x4'));var auth=require(_0x5505('0x5'));var interaction=require(_0x5505('0x6'));var config=require(_0x5505('0x7'));var controller=require(_0x5505('0x8'));router[_0x5505('0x9')]('/',auth[_0x5505('0xa')](),controller[_0x5505('0xb')]);router[_0x5505('0x9')](_0x5505('0xc'),auth[_0x5505('0xa')](),controller[_0x5505('0xd')]);router[_0x5505('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x5505('0x9')](_0x5505('0xe'),auth[_0x5505('0xa')](),controller[_0x5505('0xf')]);router[_0x5505('0x9')](_0x5505('0x10'),auth[_0x5505('0xa')](),controller[_0x5505('0x11')]);router['get']('/:id/tags',auth[_0x5505('0xa')](),controller[_0x5505('0x12')]);router[_0x5505('0x13')]('/',auth[_0x5505('0xa')](),controller[_0x5505('0x14')]);router[_0x5505('0x13')](_0x5505('0x15'),auth[_0x5505('0xa')](),controller[_0x5505('0x16')]);router['put']('/:id',auth[_0x5505('0xa')](),controller['update']);router[_0x5505('0x17')](_0x5505('0xc'),auth[_0x5505('0xa')](),controller[_0x5505('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index df9a01f..5ea6eb3 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 _0x4658=['exports','STRING','sequelize'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x4658,0x158));var _0x8465=function(_0x27e0f4,_0x2daf3b){_0x27e0f4=_0x27e0f4-0x0;var _0x49c600=_0x4658[_0x27e0f4];return _0x49c600;};'use strict';var Sequelize=require(_0x8465('0x0'));module[_0x8465('0x1')]={'name':{'type':Sequelize[_0x8465('0x2')]},'description':{'type':Sequelize[_0x8465('0x2')]}}; \ No newline at end of file +var _0x94f8=['STRING','sequelize'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x94f8,0x14d));var _0x894f=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0x94f8[_0x454bd3];return _0x4eb066;};'use strict';var Sequelize=require(_0x894f('0x0'));module['exports']={'name':{'type':Sequelize[_0x894f('0x1')]},'description':{'type':Sequelize[_0x894f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 9a1ff91..70a9f10 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 _0xf6c9=['rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','catch','show','merge','options','find','create','body','getFields','findOne','FreshdeskField','hasOwnProperty','nolimit','getSubjects','params','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FreshdeskConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6c9,0x11f));var _0x9f6c=function(_0x160105,_0x4a600b){_0x160105=_0x160105-0x0;var _0x2ccd1f=_0xf6c9[_0x160105];return _0x2ccd1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f6c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f6c('0x1'));var rp=require(_0x9f6c('0x2'));var moment=require(_0x9f6c('0x3'));var BPromise=require(_0x9f6c('0x4'));var Mustache=require(_0x9f6c('0x5'));var util=require(_0x9f6c('0x6'));var path=require(_0x9f6c('0x7'));var sox=require('sox');var csv=require(_0x9f6c('0x8'));var ejs=require(_0x9f6c('0x9'));var fs=require('fs');var fs_extra=require(_0x9f6c('0xa'));var _=require(_0x9f6c('0xb'));var squel=require('squel');var crypto=require(_0x9f6c('0xc'));var jsforce=require(_0x9f6c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9f6c('0x8'));var querystring=require('querystring');var Papa=require(_0x9f6c('0xe'));var Redis=require(_0x9f6c('0xf'));var authService=require(_0x9f6c('0x10'));var qs=require(_0x9f6c('0x11'));var as=require(_0x9f6c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f6c('0x13'))('api');var utils=require(_0x9f6c('0x14'));var config=require(_0x9f6c('0x15'));var licenseUtil=require(_0x9f6c('0x16'));var db=require(_0x9f6c('0x17'))['db'];function respondWithStatusCode(_0x1a259e,_0x471b99){_0x471b99=_0x471b99||0xcc;return function(_0x3e32aa){if(_0x3e32aa){return _0x1a259e[_0x9f6c('0x18')](_0x471b99);}return _0x1a259e[_0x9f6c('0x19')](_0x471b99)[_0x9f6c('0x1a')]();};}function respondWithResult(_0x52a7e9,_0x39409b){_0x39409b=_0x39409b||0xc8;return function(_0x355ddc){if(_0x355ddc){return _0x52a7e9[_0x9f6c('0x19')](_0x39409b)[_0x9f6c('0x1b')](_0x355ddc);}};}function respondWithFilteredResult(_0x2452c8,_0x4bac9a){return function(_0x46b923){if(_0x46b923){var _0x40286d=typeof _0x4bac9a[_0x9f6c('0x1c')]===_0x9f6c('0x1d')&&typeof _0x4bac9a[_0x9f6c('0x1e')]===_0x9f6c('0x1d');var _0x3e4d6f=_0x46b923['count'];var _0x42118d=_0x40286d?0x0:_0x4bac9a[_0x9f6c('0x1c')];var _0x51f77a=_0x40286d?_0x46b923[_0x9f6c('0x1f')]:_0x4bac9a['offset']+_0x4bac9a[_0x9f6c('0x1e')];var _0x2b3022;if(_0x51f77a>=_0x3e4d6f){_0x51f77a=_0x3e4d6f;_0x2b3022=0xc8;}else{_0x2b3022=0xce;}_0x2452c8['status'](_0x2b3022);return _0x2452c8[_0x9f6c('0x20')](_0x9f6c('0x21'),_0x42118d+'-'+_0x51f77a+'/'+_0x3e4d6f)['json'](_0x46b923);}return null;};}function patchUpdates(_0x515c8c){return function(_0x2f3294){try{jsonpatch[_0x9f6c('0x22')](_0x2f3294,_0x515c8c,!![]);}catch(_0x364a76){return BPromise[_0x9f6c('0x23')](_0x364a76);}return _0x2f3294[_0x9f6c('0x24')]();};}function saveUpdates(_0x267dd0,_0xa3b59d){return function(_0x55fb48){if(_0x55fb48){return _0x55fb48[_0x9f6c('0x25')](_0x267dd0)[_0x9f6c('0x26')](function(_0x474300){return _0x474300;});}return null;};}function removeEntity(_0x224054,_0x33dabb){return function(_0x55a6d9){if(_0x55a6d9){return _0x55a6d9[_0x9f6c('0x27')]()[_0x9f6c('0x26')](function(){_0x224054[_0x9f6c('0x19')](0xcc)[_0x9f6c('0x1a')]();});}};}function handleEntityNotFound(_0x10a90b,_0x670cba){return function(_0x25b7e9){if(!_0x25b7e9){_0x10a90b[_0x9f6c('0x18')](0x194);}return _0x25b7e9;};}function handleError(_0x397696,_0x219346){_0x219346=_0x219346||0x1f4;return function(_0x251f89){logger['error'](_0x251f89['stack']);if(_0x251f89[_0x9f6c('0x28')]){delete _0x251f89[_0x9f6c('0x28')];}_0x397696['status'](_0x219346)[_0x9f6c('0x29')](_0x251f89);};}exports[_0x9f6c('0x2a')]=function(_0x497c5e,_0x5c0183){var _0x45ecae={},_0x24c62e={},_0x6ec35d={'count':0x0,'rows':[]};var _0x246512=_[_0x9f6c('0x2b')](db[_0x9f6c('0x2c')][_0x9f6c('0x2d')],function(_0x362861){return{'name':_0x362861['fieldName'],'type':_0x362861[_0x9f6c('0x2e')]['key']};});_0x24c62e[_0x9f6c('0x2f')]=_[_0x9f6c('0x2b')](_0x246512,_0x9f6c('0x28'));_0x24c62e[_0x9f6c('0x30')]=_[_0x9f6c('0x31')](_0x497c5e[_0x9f6c('0x30')]);_0x24c62e[_0x9f6c('0x32')]=_[_0x9f6c('0x33')](_0x24c62e['model'],_0x24c62e[_0x9f6c('0x30')]);_0x45ecae[_0x9f6c('0x34')]=_['intersection'](_0x24c62e['model'],qs[_0x9f6c('0x35')](_0x497c5e[_0x9f6c('0x30')]['fields']));_0x45ecae[_0x9f6c('0x34')]=_0x45ecae[_0x9f6c('0x34')][_0x9f6c('0x36')]?_0x45ecae[_0x9f6c('0x34')]:_0x24c62e[_0x9f6c('0x2f')];if(!_0x497c5e[_0x9f6c('0x30')]['hasOwnProperty']('nolimit')){_0x45ecae[_0x9f6c('0x1e')]=qs[_0x9f6c('0x1e')](_0x497c5e[_0x9f6c('0x30')][_0x9f6c('0x1e')]);_0x45ecae[_0x9f6c('0x1c')]=qs[_0x9f6c('0x1c')](_0x497c5e['query'][_0x9f6c('0x1c')]);}_0x45ecae[_0x9f6c('0x37')]=qs[_0x9f6c('0x38')](_0x497c5e['query'][_0x9f6c('0x38')]);_0x45ecae[_0x9f6c('0x39')]=qs[_0x9f6c('0x32')](_[_0x9f6c('0x3a')](_0x497c5e[_0x9f6c('0x30')],_0x24c62e['filters']),_0x246512);if(_0x497c5e[_0x9f6c('0x30')][_0x9f6c('0x3b')]){_0x45ecae[_0x9f6c('0x39')]=_['merge'](_0x45ecae['where'],{'$or':_[_0x9f6c('0x2b')](_0x246512,function(_0x2fdb7b){if(_0x2fdb7b[_0x9f6c('0x2e')]!==_0x9f6c('0x3c')){var _0x57e14e={};_0x57e14e[_0x2fdb7b['name']]={'$like':'%'+_0x497c5e[_0x9f6c('0x30')]['filter']+'%'};return _0x57e14e;}})});}_0x45ecae=_['merge']({},_0x45ecae,_0x497c5e['options']);var _0x47abd0={'where':_0x45ecae[_0x9f6c('0x39')]};return db[_0x9f6c('0x2c')][_0x9f6c('0x1f')](_0x47abd0)[_0x9f6c('0x26')](function(_0x3f6c28){_0x6ec35d['count']=_0x3f6c28;if(_0x497c5e[_0x9f6c('0x30')][_0x9f6c('0x3d')]){_0x45ecae[_0x9f6c('0x3e')]=[{'all':!![]}];}return db[_0x9f6c('0x2c')][_0x9f6c('0x3f')](_0x45ecae);})[_0x9f6c('0x26')](function(_0x56349d){_0x6ec35d['rows']=_0x56349d;return _0x6ec35d;})[_0x9f6c('0x26')](respondWithFilteredResult(_0x5c0183,_0x45ecae))[_0x9f6c('0x40')](handleError(_0x5c0183,null));};exports[_0x9f6c('0x41')]=function(_0x2bb47a,_0x5da173){var _0x24aa62={'raw':![],'where':{'id':_0x2bb47a['params']['id']}},_0x96cf73={};_0x96cf73[_0x9f6c('0x2f')]=_[_0x9f6c('0x31')](db[_0x9f6c('0x2c')][_0x9f6c('0x2d')]);_0x96cf73['query']=_[_0x9f6c('0x31')](_0x2bb47a['query']);_0x96cf73[_0x9f6c('0x32')]=_['intersection'](_0x96cf73['model'],_0x96cf73[_0x9f6c('0x30')]);_0x24aa62[_0x9f6c('0x34')]=_[_0x9f6c('0x33')](_0x96cf73[_0x9f6c('0x2f')],qs[_0x9f6c('0x35')](_0x2bb47a[_0x9f6c('0x30')]['fields']));_0x24aa62[_0x9f6c('0x34')]=_0x24aa62['attributes'][_0x9f6c('0x36')]?_0x24aa62['attributes']:_0x96cf73[_0x9f6c('0x2f')];if(_0x2bb47a[_0x9f6c('0x30')][_0x9f6c('0x3d')]){_0x24aa62[_0x9f6c('0x3e')]=[{'all':!![]}];}_0x24aa62=_[_0x9f6c('0x42')]({},_0x24aa62,_0x2bb47a[_0x9f6c('0x43')]);return db[_0x9f6c('0x2c')][_0x9f6c('0x44')](_0x24aa62)[_0x9f6c('0x26')](handleEntityNotFound(_0x5da173,null))[_0x9f6c('0x26')](respondWithResult(_0x5da173,null))[_0x9f6c('0x40')](handleError(_0x5da173,null));};exports[_0x9f6c('0x45')]=function(_0x2dc8f9,_0x490cbb){return db['FreshdeskConfiguration']['create'](_0x2dc8f9[_0x9f6c('0x46')],{})[_0x9f6c('0x26')](respondWithResult(_0x490cbb,0xc9))[_0x9f6c('0x40')](handleError(_0x490cbb,null));};exports[_0x9f6c('0x25')]=function(_0x513655,_0x36a969){if(_0x513655[_0x9f6c('0x46')]['id']){delete _0x513655[_0x9f6c('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x9f6c('0x44')]({'where':{'id':_0x513655['params']['id']}})['then'](handleEntityNotFound(_0x36a969,null))[_0x9f6c('0x26')](saveUpdates(_0x513655['body'],null))[_0x9f6c('0x26')](respondWithResult(_0x36a969,null))[_0x9f6c('0x40')](handleError(_0x36a969,null));};exports[_0x9f6c('0x27')]=function(_0xcbf3ee,_0x415cce){return db[_0x9f6c('0x2c')]['find']({'where':{'id':_0xcbf3ee['params']['id']}})[_0x9f6c('0x26')](handleEntityNotFound(_0x415cce,null))[_0x9f6c('0x26')](removeEntity(_0x415cce,null))[_0x9f6c('0x40')](handleError(_0x415cce,null));};exports[_0x9f6c('0x47')]=function(_0x17cc4d,_0xf216ef,_0x4fc860){var _0x43b672={};var _0x5d9572={};var _0x4c9b19;var _0x2be1ce;return db[_0x9f6c('0x2c')][_0x9f6c('0x48')]({'where':{'id':_0x17cc4d['params']['id']}})[_0x9f6c('0x26')](handleEntityNotFound(_0xf216ef,null))[_0x9f6c('0x26')](function(_0x3512a5){if(_0x3512a5){_0x4c9b19=_0x3512a5;_0x5d9572['model']=_['keys'](db[_0x9f6c('0x49')][_0x9f6c('0x2d')]);_0x5d9572[_0x9f6c('0x30')]=_['keys'](_0x17cc4d[_0x9f6c('0x30')]);_0x5d9572[_0x9f6c('0x32')]=_[_0x9f6c('0x33')](_0x5d9572[_0x9f6c('0x2f')],_0x5d9572['query']);_0x43b672[_0x9f6c('0x34')]=_[_0x9f6c('0x33')](_0x5d9572[_0x9f6c('0x2f')],qs[_0x9f6c('0x35')](_0x17cc4d[_0x9f6c('0x30')][_0x9f6c('0x35')]));_0x43b672[_0x9f6c('0x34')]=_0x43b672['attributes'][_0x9f6c('0x36')]?_0x43b672[_0x9f6c('0x34')]:_0x5d9572[_0x9f6c('0x2f')];_0x43b672[_0x9f6c('0x37')]=qs[_0x9f6c('0x38')](_0x17cc4d[_0x9f6c('0x30')][_0x9f6c('0x38')]);_0x43b672[_0x9f6c('0x39')]=qs[_0x9f6c('0x32')](_['pick'](_0x17cc4d[_0x9f6c('0x30')],_0x5d9572[_0x9f6c('0x32')]));if(_0x17cc4d[_0x9f6c('0x30')][_0x9f6c('0x3b')]){_0x43b672[_0x9f6c('0x39')]=_[_0x9f6c('0x42')](_0x43b672[_0x9f6c('0x39')],{'$or':_[_0x9f6c('0x2b')](_0x43b672['attributes'],function(_0x4ba81d){var _0x245f7a={};_0x245f7a[_0x4ba81d]={'$like':'%'+_0x17cc4d[_0x9f6c('0x30')][_0x9f6c('0x3b')]+'%'};return _0x245f7a;})});}_0x43b672=_[_0x9f6c('0x42')]({},_0x43b672,_0x17cc4d['options']);return _0x4c9b19[_0x9f6c('0x47')](_0x43b672);}})[_0x9f6c('0x26')](function(_0xf47425){if(_0xf47425){_0x2be1ce=_0xf47425['length'];if(!_0x17cc4d[_0x9f6c('0x30')][_0x9f6c('0x4a')](_0x9f6c('0x4b'))){_0x43b672['limit']=qs[_0x9f6c('0x1e')](_0x17cc4d[_0x9f6c('0x30')][_0x9f6c('0x1e')]);_0x43b672[_0x9f6c('0x1c')]=qs[_0x9f6c('0x1c')](_0x17cc4d[_0x9f6c('0x30')][_0x9f6c('0x1c')]);}return _0x4c9b19['getFields'](_0x43b672);}})[_0x9f6c('0x26')](function(_0x5de0f5){if(_0x5de0f5){return _0x5de0f5?{'count':_0x2be1ce,'rows':_0x5de0f5}:null;}})[_0x9f6c('0x26')](respondWithResult(_0xf216ef,null))['catch'](handleError(_0xf216ef,null));};exports[_0x9f6c('0x4c')]=function(_0x259f89,_0x30d1cf,_0x123af5){var _0xe7be74={};var _0x56167e={};var _0x295450;var _0x4744a9;return db[_0x9f6c('0x2c')][_0x9f6c('0x48')]({'where':{'id':_0x259f89[_0x9f6c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x30d1cf,null))[_0x9f6c('0x26')](function(_0x1facff){if(_0x1facff){_0x295450=_0x1facff;_0x56167e['model']=_[_0x9f6c('0x31')](db['FreshdeskField']['rawAttributes']);_0x56167e[_0x9f6c('0x30')]=_[_0x9f6c('0x31')](_0x259f89[_0x9f6c('0x30')]);_0x56167e[_0x9f6c('0x32')]=_[_0x9f6c('0x33')](_0x56167e[_0x9f6c('0x2f')],_0x56167e[_0x9f6c('0x30')]);_0xe7be74[_0x9f6c('0x34')]=_[_0x9f6c('0x33')](_0x56167e[_0x9f6c('0x2f')],qs[_0x9f6c('0x35')](_0x259f89[_0x9f6c('0x30')][_0x9f6c('0x35')]));_0xe7be74[_0x9f6c('0x34')]=_0xe7be74['attributes']['length']?_0xe7be74['attributes']:_0x56167e[_0x9f6c('0x2f')];_0xe7be74[_0x9f6c('0x37')]=qs[_0x9f6c('0x38')](_0x259f89[_0x9f6c('0x30')]['sort']);_0xe7be74['where']=qs[_0x9f6c('0x32')](_['pick'](_0x259f89[_0x9f6c('0x30')],_0x56167e['filters']));if(_0x259f89[_0x9f6c('0x30')][_0x9f6c('0x3b')]){_0xe7be74['where']=_['merge'](_0xe7be74[_0x9f6c('0x39')],{'$or':_[_0x9f6c('0x2b')](_0xe7be74[_0x9f6c('0x34')],function(_0x2f02d9){var _0x917373={};_0x917373[_0x2f02d9]={'$like':'%'+_0x259f89[_0x9f6c('0x30')][_0x9f6c('0x3b')]+'%'};return _0x917373;})});}_0xe7be74=_['merge']({},_0xe7be74,_0x259f89['options']);return _0x295450[_0x9f6c('0x4c')](_0xe7be74);}})[_0x9f6c('0x26')](function(_0x7ba17b){if(_0x7ba17b){_0x4744a9=_0x7ba17b[_0x9f6c('0x36')];if(!_0x259f89['query']['hasOwnProperty'](_0x9f6c('0x4b'))){_0xe7be74['limit']=qs[_0x9f6c('0x1e')](_0x259f89['query']['limit']);_0xe7be74[_0x9f6c('0x1c')]=qs[_0x9f6c('0x1c')](_0x259f89[_0x9f6c('0x30')][_0x9f6c('0x1c')]);}return _0x295450[_0x9f6c('0x4c')](_0xe7be74);}})[_0x9f6c('0x26')](function(_0x5bd9f4){if(_0x5bd9f4){return _0x5bd9f4?{'count':_0x4744a9,'rows':_0x5bd9f4}:null;}})[_0x9f6c('0x26')](respondWithResult(_0x30d1cf,null))[_0x9f6c('0x40')](handleError(_0x30d1cf,null));};exports[_0x9f6c('0x4e')]=function(_0x4ac021,_0x96d0fd,_0x5f250e){var _0x2ba580={};var _0x59bee5={};var _0x24e585;var _0x2b9672;return db[_0x9f6c('0x2c')][_0x9f6c('0x48')]({'where':{'id':_0x4ac021[_0x9f6c('0x4d')]['id']}})[_0x9f6c('0x26')](handleEntityNotFound(_0x96d0fd,null))[_0x9f6c('0x26')](function(_0x3adb99){if(_0x3adb99){_0x24e585=_0x3adb99;_0x59bee5[_0x9f6c('0x2f')]=_[_0x9f6c('0x31')](db['FreshdeskField'][_0x9f6c('0x2d')]);_0x59bee5[_0x9f6c('0x30')]=_[_0x9f6c('0x31')](_0x4ac021[_0x9f6c('0x30')]);_0x59bee5[_0x9f6c('0x32')]=_[_0x9f6c('0x33')](_0x59bee5[_0x9f6c('0x2f')],_0x59bee5['query']);_0x2ba580['attributes']=_[_0x9f6c('0x33')](_0x59bee5['model'],qs[_0x9f6c('0x35')](_0x4ac021['query'][_0x9f6c('0x35')]));_0x2ba580['attributes']=_0x2ba580['attributes']['length']?_0x2ba580[_0x9f6c('0x34')]:_0x59bee5['model'];_0x2ba580[_0x9f6c('0x37')]=qs[_0x9f6c('0x38')](_0x4ac021[_0x9f6c('0x30')]['sort']);_0x2ba580[_0x9f6c('0x39')]=qs['filters'](_[_0x9f6c('0x3a')](_0x4ac021['query'],_0x59bee5['filters']));if(_0x4ac021[_0x9f6c('0x30')][_0x9f6c('0x3b')]){_0x2ba580[_0x9f6c('0x39')]=_[_0x9f6c('0x42')](_0x2ba580['where'],{'$or':_[_0x9f6c('0x2b')](_0x2ba580['attributes'],function(_0x2488ff){var _0x4e42b2={};_0x4e42b2[_0x2488ff]={'$like':'%'+_0x4ac021[_0x9f6c('0x30')][_0x9f6c('0x3b')]+'%'};return _0x4e42b2;})});}_0x2ba580=_[_0x9f6c('0x42')]({},_0x2ba580,_0x4ac021[_0x9f6c('0x43')]);return _0x24e585[_0x9f6c('0x4e')](_0x2ba580);}})[_0x9f6c('0x26')](function(_0x3a7616){if(_0x3a7616){_0x2b9672=_0x3a7616[_0x9f6c('0x36')];if(!_0x4ac021[_0x9f6c('0x30')][_0x9f6c('0x4a')](_0x9f6c('0x4b'))){_0x2ba580[_0x9f6c('0x1e')]=qs[_0x9f6c('0x1e')](_0x4ac021['query'][_0x9f6c('0x1e')]);_0x2ba580[_0x9f6c('0x1c')]=qs[_0x9f6c('0x1c')](_0x4ac021['query'][_0x9f6c('0x1c')]);}return _0x24e585['getDescriptions'](_0x2ba580);}})[_0x9f6c('0x26')](function(_0x1d9f5b){if(_0x1d9f5b){return _0x1d9f5b?{'count':_0x2b9672,'rows':_0x1d9f5b}:null;}})[_0x9f6c('0x26')](respondWithResult(_0x96d0fd,null))[_0x9f6c('0x40')](handleError(_0x96d0fd,null));};exports[_0x9f6c('0x4f')]=function(_0x1ac361,_0x848a2d,_0x510088){var _0x48f26d={};var _0x1b96bf={};var _0x2dbc79;var _0x3c7829;return db['FreshdeskConfiguration'][_0x9f6c('0x48')]({'where':{'id':_0x1ac361[_0x9f6c('0x4d')]['id']}})[_0x9f6c('0x26')](handleEntityNotFound(_0x848a2d,null))[_0x9f6c('0x26')](function(_0x5a8483){if(_0x5a8483){_0x2dbc79=_0x5a8483;_0x1b96bf[_0x9f6c('0x2f')]=_['keys'](db[_0x9f6c('0x50')][_0x9f6c('0x2d')]);_0x1b96bf[_0x9f6c('0x30')]=_[_0x9f6c('0x31')](_0x1ac361[_0x9f6c('0x30')]);_0x1b96bf['filters']=_[_0x9f6c('0x33')](_0x1b96bf['model'],_0x1b96bf[_0x9f6c('0x30')]);_0x48f26d[_0x9f6c('0x34')]=_['intersection'](_0x1b96bf[_0x9f6c('0x2f')],qs['fields'](_0x1ac361[_0x9f6c('0x30')][_0x9f6c('0x35')]));_0x48f26d[_0x9f6c('0x34')]=_0x48f26d[_0x9f6c('0x34')][_0x9f6c('0x36')]?_0x48f26d['attributes']:_0x1b96bf[_0x9f6c('0x2f')];_0x48f26d[_0x9f6c('0x37')]=qs[_0x9f6c('0x38')](_0x1ac361[_0x9f6c('0x30')][_0x9f6c('0x38')]);_0x48f26d['where']=qs[_0x9f6c('0x32')](_[_0x9f6c('0x3a')](_0x1ac361[_0x9f6c('0x30')],_0x1b96bf[_0x9f6c('0x32')]));if(_0x1ac361[_0x9f6c('0x30')][_0x9f6c('0x3b')]){_0x48f26d['where']=_[_0x9f6c('0x42')](_0x48f26d[_0x9f6c('0x39')],{'$or':_['map'](_0x48f26d['attributes'],function(_0x337521){var _0x1d3d91={};_0x1d3d91[_0x337521]={'$like':'%'+_0x1ac361[_0x9f6c('0x30')][_0x9f6c('0x3b')]+'%'};return _0x1d3d91;})});}_0x48f26d=_[_0x9f6c('0x42')]({},_0x48f26d,_0x1ac361[_0x9f6c('0x43')]);return _0x2dbc79[_0x9f6c('0x4f')](_0x48f26d);}})[_0x9f6c('0x26')](function(_0x2b74f6){if(_0x2b74f6){_0x3c7829=_0x2b74f6[_0x9f6c('0x36')];if(!_0x1ac361[_0x9f6c('0x30')][_0x9f6c('0x4a')](_0x9f6c('0x4b'))){_0x48f26d[_0x9f6c('0x1e')]=qs['limit'](_0x1ac361[_0x9f6c('0x30')][_0x9f6c('0x1e')]);_0x48f26d[_0x9f6c('0x1c')]=qs['offset'](_0x1ac361[_0x9f6c('0x30')][_0x9f6c('0x1c')]);}return _0x2dbc79[_0x9f6c('0x4f')](_0x48f26d);}})[_0x9f6c('0x26')](function(_0x3e9e1c){if(_0x3e9e1c){return _0x3e9e1c?{'count':_0x3c7829,'rows':_0x3e9e1c}:null;}})[_0x9f6c('0x26')](respondWithResult(_0x848a2d,null))[_0x9f6c('0x40')](handleError(_0x848a2d,null));};exports[_0x9f6c('0x51')]=function(_0x1b8d6e,_0x4f662f,_0x5c73af){if(_0x1b8d6e[_0x9f6c('0x46')]['id']){delete _0x1b8d6e[_0x9f6c('0x46')]['id'];}return db[_0x9f6c('0x2c')][_0x9f6c('0x48')]({'where':{'id':_0x1b8d6e['params']['id']}})[_0x9f6c('0x26')](handleEntityNotFound(_0x4f662f,null))['then'](function(_0x3c0c9b){if(_0x3c0c9b){return _0x3c0c9b[_0x9f6c('0x51')](_0x1b8d6e[_0x9f6c('0x46')][_0x9f6c('0x52')]||[]);}return null;})['then'](respondWithResult(_0x4f662f,null))[_0x9f6c('0x40')](handleError(_0x4f662f,null));}; \ No newline at end of file +var _0x2397=['getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','eml-format','fast-json-patch','moment','bluebird','mustache','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body'];(function(_0x41ca9a,_0x54f89f){var _0x5ab19c=function(_0x445a43){while(--_0x445a43){_0x41ca9a['push'](_0x41ca9a['shift']());}};_0x5ab19c(++_0x54f89f);}(_0x2397,0x1f4));var _0x7239=function(_0x5ec868,_0x577632){_0x5ec868=_0x5ec868-0x0;var _0x3074a8=_0x2397[_0x5ec868];return _0x3074a8;};'use strict';var emlformat=require(_0x7239('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7239('0x1'));var rp=require('request-promise');var moment=require(_0x7239('0x2'));var BPromise=require(_0x7239('0x3'));var Mustache=require(_0x7239('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7239('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7239('0x6'));var squel=require(_0x7239('0x7'));var crypto=require('crypto');var jsforce=require(_0x7239('0x8'));var deskjs=require(_0x7239('0x9'));var toCsv=require(_0x7239('0xa'));var querystring=require('querystring');var Papa=require(_0x7239('0xb'));var Redis=require(_0x7239('0xc'));var authService=require(_0x7239('0xd'));var qs=require(_0x7239('0xe'));var as=require(_0x7239('0xf'));var hardwareService=require(_0x7239('0x10'));var logger=require(_0x7239('0x11'))('api');var utils=require(_0x7239('0x12'));var config=require(_0x7239('0x13'));var licenseUtil=require(_0x7239('0x14'));var db=require(_0x7239('0x15'))['db'];function respondWithStatusCode(_0x711c1c,_0x1f9cfb){_0x1f9cfb=_0x1f9cfb||0xcc;return function(_0x2ce4be){if(_0x2ce4be){return _0x711c1c[_0x7239('0x16')](_0x1f9cfb);}return _0x711c1c[_0x7239('0x17')](_0x1f9cfb)['end']();};}function respondWithResult(_0x26f81e,_0x16e173){_0x16e173=_0x16e173||0xc8;return function(_0x49d3c0){if(_0x49d3c0){return _0x26f81e['status'](_0x16e173)[_0x7239('0x18')](_0x49d3c0);}};}function respondWithFilteredResult(_0x2e4288,_0x15fa41){return function(_0x2fe032){if(_0x2fe032){var _0x1be332=typeof _0x15fa41['offset']===_0x7239('0x19')&&typeof _0x15fa41[_0x7239('0x1a')]===_0x7239('0x19');var _0x4daa11=_0x2fe032[_0x7239('0x1b')];var _0x17fc93=_0x1be332?0x0:_0x15fa41['offset'];var _0x1644d3=_0x1be332?_0x2fe032[_0x7239('0x1b')]:_0x15fa41[_0x7239('0x1c')]+_0x15fa41[_0x7239('0x1a')];var _0x5ea71c;if(_0x1644d3>=_0x4daa11){_0x1644d3=_0x4daa11;_0x5ea71c=0xc8;}else{_0x5ea71c=0xce;}_0x2e4288[_0x7239('0x17')](_0x5ea71c);return _0x2e4288[_0x7239('0x1d')](_0x7239('0x1e'),_0x17fc93+'-'+_0x1644d3+'/'+_0x4daa11)[_0x7239('0x18')](_0x2fe032);}return null;};}function patchUpdates(_0x5dd935){return function(_0x3679b5){try{jsonpatch[_0x7239('0x1f')](_0x3679b5,_0x5dd935,!![]);}catch(_0x3571d6){return BPromise[_0x7239('0x20')](_0x3571d6);}return _0x3679b5[_0x7239('0x21')]();};}function saveUpdates(_0x514b11,_0x569050){return function(_0x4bc55d){if(_0x4bc55d){return _0x4bc55d[_0x7239('0x22')](_0x514b11)[_0x7239('0x23')](function(_0x185b4f){return _0x185b4f;});}return null;};}function removeEntity(_0x175199,_0x3cb3b7){return function(_0x22258d){if(_0x22258d){return _0x22258d[_0x7239('0x24')]()[_0x7239('0x23')](function(){_0x175199['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a3cf,_0x417dbc){return function(_0x4e9e1b){if(!_0x4e9e1b){_0x22a3cf[_0x7239('0x16')](0x194);}return _0x4e9e1b;};}function handleError(_0x462780,_0x325c9e){_0x325c9e=_0x325c9e||0x1f4;return function(_0x103b95){logger[_0x7239('0x25')](_0x103b95[_0x7239('0x26')]);if(_0x103b95['name']){delete _0x103b95['name'];}_0x462780[_0x7239('0x17')](_0x325c9e)[_0x7239('0x27')](_0x103b95);};}exports['index']=function(_0x2d6477,_0x155306){var _0x112b2f={},_0x4f42dd={},_0x39c9ac={'count':0x0,'rows':[]};var _0x3ae957=_[_0x7239('0x28')](db[_0x7239('0x29')][_0x7239('0x2a')],function(_0x2cb751){return{'name':_0x2cb751[_0x7239('0x2b')],'type':_0x2cb751['type'][_0x7239('0x2c')]};});_0x4f42dd[_0x7239('0x2d')]=_['map'](_0x3ae957,_0x7239('0x2e'));_0x4f42dd[_0x7239('0x2f')]=_[_0x7239('0x30')](_0x2d6477['query']);_0x4f42dd[_0x7239('0x31')]=_[_0x7239('0x32')](_0x4f42dd[_0x7239('0x2d')],_0x4f42dd[_0x7239('0x2f')]);_0x112b2f[_0x7239('0x33')]=_[_0x7239('0x32')](_0x4f42dd[_0x7239('0x2d')],qs[_0x7239('0x34')](_0x2d6477['query'][_0x7239('0x34')]));_0x112b2f[_0x7239('0x33')]=_0x112b2f[_0x7239('0x33')][_0x7239('0x35')]?_0x112b2f['attributes']:_0x4f42dd[_0x7239('0x2d')];if(!_0x2d6477[_0x7239('0x2f')][_0x7239('0x36')](_0x7239('0x37'))){_0x112b2f[_0x7239('0x1a')]=qs[_0x7239('0x1a')](_0x2d6477[_0x7239('0x2f')][_0x7239('0x1a')]);_0x112b2f['offset']=qs[_0x7239('0x1c')](_0x2d6477['query'][_0x7239('0x1c')]);}_0x112b2f[_0x7239('0x38')]=qs['sort'](_0x2d6477[_0x7239('0x2f')][_0x7239('0x39')]);_0x112b2f[_0x7239('0x3a')]=qs[_0x7239('0x31')](_[_0x7239('0x3b')](_0x2d6477[_0x7239('0x2f')],_0x4f42dd['filters']),_0x3ae957);if(_0x2d6477[_0x7239('0x2f')]['filter']){_0x112b2f[_0x7239('0x3a')]=_[_0x7239('0x3c')](_0x112b2f['where'],{'$or':_[_0x7239('0x28')](_0x3ae957,function(_0x40b11b){if(_0x40b11b[_0x7239('0x3d')]!==_0x7239('0x3e')){var _0x48effa={};_0x48effa[_0x40b11b['name']]={'$like':'%'+_0x2d6477['query'][_0x7239('0x3f')]+'%'};return _0x48effa;}})});}_0x112b2f=_[_0x7239('0x3c')]({},_0x112b2f,_0x2d6477[_0x7239('0x40')]);var _0xdebffa={'where':_0x112b2f[_0x7239('0x3a')]};return db['FreshdeskConfiguration'][_0x7239('0x1b')](_0xdebffa)['then'](function(_0x1f3eb1){_0x39c9ac[_0x7239('0x1b')]=_0x1f3eb1;if(_0x2d6477[_0x7239('0x2f')][_0x7239('0x41')]){_0x112b2f['include']=[{'all':!![]}];}return db[_0x7239('0x29')][_0x7239('0x42')](_0x112b2f);})[_0x7239('0x23')](function(_0x3ddf0a){_0x39c9ac[_0x7239('0x43')]=_0x3ddf0a;return _0x39c9ac;})[_0x7239('0x23')](respondWithFilteredResult(_0x155306,_0x112b2f))[_0x7239('0x44')](handleError(_0x155306,null));};exports[_0x7239('0x45')]=function(_0x5c6783,_0x2cf874){var _0x399450={'raw':![],'where':{'id':_0x5c6783[_0x7239('0x46')]['id']}},_0x3b8619={};_0x3b8619['model']=_['keys'](db[_0x7239('0x29')][_0x7239('0x2a')]);_0x3b8619['query']=_[_0x7239('0x30')](_0x5c6783[_0x7239('0x2f')]);_0x3b8619['filters']=_[_0x7239('0x32')](_0x3b8619[_0x7239('0x2d')],_0x3b8619[_0x7239('0x2f')]);_0x399450[_0x7239('0x33')]=_[_0x7239('0x32')](_0x3b8619['model'],qs[_0x7239('0x34')](_0x5c6783['query'][_0x7239('0x34')]));_0x399450[_0x7239('0x33')]=_0x399450[_0x7239('0x33')][_0x7239('0x35')]?_0x399450[_0x7239('0x33')]:_0x3b8619['model'];if(_0x5c6783['query'][_0x7239('0x41')]){_0x399450['include']=[{'all':!![]}];}_0x399450=_[_0x7239('0x3c')]({},_0x399450,_0x5c6783['options']);return db[_0x7239('0x29')][_0x7239('0x47')](_0x399450)['then'](handleEntityNotFound(_0x2cf874,null))['then'](respondWithResult(_0x2cf874,null))[_0x7239('0x44')](handleError(_0x2cf874,null));};exports[_0x7239('0x48')]=function(_0x5bf581,_0x13e7be){return db['FreshdeskConfiguration'][_0x7239('0x48')](_0x5bf581[_0x7239('0x49')],{})[_0x7239('0x23')](respondWithResult(_0x13e7be,0xc9))[_0x7239('0x44')](handleError(_0x13e7be,null));};exports[_0x7239('0x22')]=function(_0x3e2503,_0x1f80d1){if(_0x3e2503[_0x7239('0x49')]['id']){delete _0x3e2503['body']['id'];}return db[_0x7239('0x29')][_0x7239('0x47')]({'where':{'id':_0x3e2503[_0x7239('0x46')]['id']}})[_0x7239('0x23')](handleEntityNotFound(_0x1f80d1,null))['then'](saveUpdates(_0x3e2503[_0x7239('0x49')],null))[_0x7239('0x23')](respondWithResult(_0x1f80d1,null))[_0x7239('0x44')](handleError(_0x1f80d1,null));};exports[_0x7239('0x24')]=function(_0x586e5c,_0x768794){return db[_0x7239('0x29')][_0x7239('0x47')]({'where':{'id':_0x586e5c[_0x7239('0x46')]['id']}})[_0x7239('0x23')](handleEntityNotFound(_0x768794,null))['then'](removeEntity(_0x768794,null))[_0x7239('0x44')](handleError(_0x768794,null));};exports[_0x7239('0x4a')]=function(_0x336abf,_0x5ea686,_0x1196bc){var _0x658f24={};var _0x508c7c={};var _0x3f1201;var _0x52b90a;return db['FreshdeskConfiguration'][_0x7239('0x4b')]({'where':{'id':_0x336abf[_0x7239('0x46')]['id']}})[_0x7239('0x23')](handleEntityNotFound(_0x5ea686,null))[_0x7239('0x23')](function(_0x224100){if(_0x224100){_0x3f1201=_0x224100;_0x508c7c[_0x7239('0x2d')]=_[_0x7239('0x30')](db['FreshdeskField'][_0x7239('0x2a')]);_0x508c7c['query']=_[_0x7239('0x30')](_0x336abf[_0x7239('0x2f')]);_0x508c7c[_0x7239('0x31')]=_[_0x7239('0x32')](_0x508c7c[_0x7239('0x2d')],_0x508c7c[_0x7239('0x2f')]);_0x658f24[_0x7239('0x33')]=_['intersection'](_0x508c7c[_0x7239('0x2d')],qs['fields'](_0x336abf[_0x7239('0x2f')][_0x7239('0x34')]));_0x658f24[_0x7239('0x33')]=_0x658f24['attributes']['length']?_0x658f24[_0x7239('0x33')]:_0x508c7c['model'];_0x658f24['order']=qs['sort'](_0x336abf[_0x7239('0x2f')][_0x7239('0x39')]);_0x658f24[_0x7239('0x3a')]=qs['filters'](_[_0x7239('0x3b')](_0x336abf['query'],_0x508c7c[_0x7239('0x31')]));if(_0x336abf[_0x7239('0x2f')][_0x7239('0x3f')]){_0x658f24[_0x7239('0x3a')]=_[_0x7239('0x3c')](_0x658f24['where'],{'$or':_['map'](_0x658f24[_0x7239('0x33')],function(_0x4e3dfa){var _0xa4d5a7={};_0xa4d5a7[_0x4e3dfa]={'$like':'%'+_0x336abf[_0x7239('0x2f')]['filter']+'%'};return _0xa4d5a7;})});}_0x658f24=_['merge']({},_0x658f24,_0x336abf[_0x7239('0x40')]);return _0x3f1201[_0x7239('0x4a')](_0x658f24);}})[_0x7239('0x23')](function(_0x3dc17e){if(_0x3dc17e){_0x52b90a=_0x3dc17e[_0x7239('0x35')];if(!_0x336abf['query']['hasOwnProperty'](_0x7239('0x37'))){_0x658f24[_0x7239('0x1a')]=qs[_0x7239('0x1a')](_0x336abf[_0x7239('0x2f')][_0x7239('0x1a')]);_0x658f24[_0x7239('0x1c')]=qs['offset'](_0x336abf[_0x7239('0x2f')][_0x7239('0x1c')]);}return _0x3f1201[_0x7239('0x4a')](_0x658f24);}})[_0x7239('0x23')](function(_0x4847ff){if(_0x4847ff){return _0x4847ff?{'count':_0x52b90a,'rows':_0x4847ff}:null;}})[_0x7239('0x23')](respondWithResult(_0x5ea686,null))['catch'](handleError(_0x5ea686,null));};exports[_0x7239('0x4c')]=function(_0x172492,_0x377d82,_0x297e1d){var _0x5a13b2={};var _0xd5f613={};var _0x11e07a;var _0x256d7a;return db[_0x7239('0x29')]['findOne']({'where':{'id':_0x172492[_0x7239('0x46')]['id']}})[_0x7239('0x23')](handleEntityNotFound(_0x377d82,null))[_0x7239('0x23')](function(_0x51166e){if(_0x51166e){_0x11e07a=_0x51166e;_0xd5f613[_0x7239('0x2d')]=_[_0x7239('0x30')](db[_0x7239('0x4d')][_0x7239('0x2a')]);_0xd5f613['query']=_[_0x7239('0x30')](_0x172492[_0x7239('0x2f')]);_0xd5f613[_0x7239('0x31')]=_['intersection'](_0xd5f613['model'],_0xd5f613['query']);_0x5a13b2[_0x7239('0x33')]=_[_0x7239('0x32')](_0xd5f613[_0x7239('0x2d')],qs[_0x7239('0x34')](_0x172492[_0x7239('0x2f')][_0x7239('0x34')]));_0x5a13b2[_0x7239('0x33')]=_0x5a13b2[_0x7239('0x33')][_0x7239('0x35')]?_0x5a13b2['attributes']:_0xd5f613[_0x7239('0x2d')];_0x5a13b2[_0x7239('0x38')]=qs[_0x7239('0x39')](_0x172492[_0x7239('0x2f')][_0x7239('0x39')]);_0x5a13b2['where']=qs[_0x7239('0x31')](_[_0x7239('0x3b')](_0x172492[_0x7239('0x2f')],_0xd5f613[_0x7239('0x31')]));if(_0x172492['query'][_0x7239('0x3f')]){_0x5a13b2[_0x7239('0x3a')]=_['merge'](_0x5a13b2[_0x7239('0x3a')],{'$or':_[_0x7239('0x28')](_0x5a13b2[_0x7239('0x33')],function(_0x5a7d15){var _0x3ca8cd={};_0x3ca8cd[_0x5a7d15]={'$like':'%'+_0x172492['query'][_0x7239('0x3f')]+'%'};return _0x3ca8cd;})});}_0x5a13b2=_[_0x7239('0x3c')]({},_0x5a13b2,_0x172492[_0x7239('0x40')]);return _0x11e07a[_0x7239('0x4c')](_0x5a13b2);}})[_0x7239('0x23')](function(_0x412480){if(_0x412480){_0x256d7a=_0x412480['length'];if(!_0x172492[_0x7239('0x2f')][_0x7239('0x36')]('nolimit')){_0x5a13b2['limit']=qs[_0x7239('0x1a')](_0x172492[_0x7239('0x2f')][_0x7239('0x1a')]);_0x5a13b2[_0x7239('0x1c')]=qs['offset'](_0x172492[_0x7239('0x2f')][_0x7239('0x1c')]);}return _0x11e07a[_0x7239('0x4c')](_0x5a13b2);}})['then'](function(_0x2e0e6b){if(_0x2e0e6b){return _0x2e0e6b?{'count':_0x256d7a,'rows':_0x2e0e6b}:null;}})[_0x7239('0x23')](respondWithResult(_0x377d82,null))[_0x7239('0x44')](handleError(_0x377d82,null));};exports['getDescriptions']=function(_0x393dc5,_0x1546ef,_0x864212){var _0x19a422={};var _0x872221={};var _0x5581b0;var _0x2d5b48;return db[_0x7239('0x29')][_0x7239('0x4b')]({'where':{'id':_0x393dc5['params']['id']}})[_0x7239('0x23')](handleEntityNotFound(_0x1546ef,null))[_0x7239('0x23')](function(_0x461f39){if(_0x461f39){_0x5581b0=_0x461f39;_0x872221[_0x7239('0x2d')]=_[_0x7239('0x30')](db[_0x7239('0x4d')]['rawAttributes']);_0x872221[_0x7239('0x2f')]=_[_0x7239('0x30')](_0x393dc5['query']);_0x872221[_0x7239('0x31')]=_['intersection'](_0x872221[_0x7239('0x2d')],_0x872221[_0x7239('0x2f')]);_0x19a422['attributes']=_['intersection'](_0x872221[_0x7239('0x2d')],qs[_0x7239('0x34')](_0x393dc5[_0x7239('0x2f')]['fields']));_0x19a422[_0x7239('0x33')]=_0x19a422[_0x7239('0x33')][_0x7239('0x35')]?_0x19a422[_0x7239('0x33')]:_0x872221[_0x7239('0x2d')];_0x19a422['order']=qs[_0x7239('0x39')](_0x393dc5[_0x7239('0x2f')]['sort']);_0x19a422['where']=qs['filters'](_[_0x7239('0x3b')](_0x393dc5[_0x7239('0x2f')],_0x872221[_0x7239('0x31')]));if(_0x393dc5[_0x7239('0x2f')][_0x7239('0x3f')]){_0x19a422['where']=_[_0x7239('0x3c')](_0x19a422['where'],{'$or':_['map'](_0x19a422['attributes'],function(_0x5cf8ec){var _0x3ba68f={};_0x3ba68f[_0x5cf8ec]={'$like':'%'+_0x393dc5[_0x7239('0x2f')]['filter']+'%'};return _0x3ba68f;})});}_0x19a422=_['merge']({},_0x19a422,_0x393dc5['options']);return _0x5581b0[_0x7239('0x4e')](_0x19a422);}})[_0x7239('0x23')](function(_0x3443e5){if(_0x3443e5){_0x2d5b48=_0x3443e5[_0x7239('0x35')];if(!_0x393dc5[_0x7239('0x2f')][_0x7239('0x36')](_0x7239('0x37'))){_0x19a422['limit']=qs[_0x7239('0x1a')](_0x393dc5[_0x7239('0x2f')][_0x7239('0x1a')]);_0x19a422[_0x7239('0x1c')]=qs['offset'](_0x393dc5[_0x7239('0x2f')][_0x7239('0x1c')]);}return _0x5581b0['getDescriptions'](_0x19a422);}})[_0x7239('0x23')](function(_0x48ec36){if(_0x48ec36){return _0x48ec36?{'count':_0x2d5b48,'rows':_0x48ec36}:null;}})[_0x7239('0x23')](respondWithResult(_0x1546ef,null))[_0x7239('0x44')](handleError(_0x1546ef,null));};exports[_0x7239('0x4f')]=function(_0x554489,_0x3fad5e,_0x7b6e78){var _0x56f861={};var _0x2e1268={};var _0x3bd0c4;var _0x2ceb10;return db[_0x7239('0x29')][_0x7239('0x4b')]({'where':{'id':_0x554489[_0x7239('0x46')]['id']}})[_0x7239('0x23')](handleEntityNotFound(_0x3fad5e,null))['then'](function(_0x36662b){if(_0x36662b){_0x3bd0c4=_0x36662b;_0x2e1268[_0x7239('0x2d')]=_[_0x7239('0x30')](db['Tag'][_0x7239('0x2a')]);_0x2e1268['query']=_[_0x7239('0x30')](_0x554489['query']);_0x2e1268[_0x7239('0x31')]=_[_0x7239('0x32')](_0x2e1268[_0x7239('0x2d')],_0x2e1268[_0x7239('0x2f')]);_0x56f861['attributes']=_[_0x7239('0x32')](_0x2e1268[_0x7239('0x2d')],qs[_0x7239('0x34')](_0x554489[_0x7239('0x2f')][_0x7239('0x34')]));_0x56f861[_0x7239('0x33')]=_0x56f861['attributes'][_0x7239('0x35')]?_0x56f861[_0x7239('0x33')]:_0x2e1268[_0x7239('0x2d')];_0x56f861['order']=qs[_0x7239('0x39')](_0x554489[_0x7239('0x2f')][_0x7239('0x39')]);_0x56f861[_0x7239('0x3a')]=qs[_0x7239('0x31')](_[_0x7239('0x3b')](_0x554489[_0x7239('0x2f')],_0x2e1268[_0x7239('0x31')]));if(_0x554489[_0x7239('0x2f')][_0x7239('0x3f')]){_0x56f861[_0x7239('0x3a')]=_[_0x7239('0x3c')](_0x56f861[_0x7239('0x3a')],{'$or':_[_0x7239('0x28')](_0x56f861[_0x7239('0x33')],function(_0x5ac8d7){var _0x4d70fa={};_0x4d70fa[_0x5ac8d7]={'$like':'%'+_0x554489[_0x7239('0x2f')][_0x7239('0x3f')]+'%'};return _0x4d70fa;})});}_0x56f861=_[_0x7239('0x3c')]({},_0x56f861,_0x554489[_0x7239('0x40')]);return _0x3bd0c4[_0x7239('0x4f')](_0x56f861);}})[_0x7239('0x23')](function(_0x546e0d){if(_0x546e0d){_0x2ceb10=_0x546e0d[_0x7239('0x35')];if(!_0x554489[_0x7239('0x2f')]['hasOwnProperty'](_0x7239('0x37'))){_0x56f861[_0x7239('0x1a')]=qs['limit'](_0x554489[_0x7239('0x2f')][_0x7239('0x1a')]);_0x56f861['offset']=qs['offset'](_0x554489[_0x7239('0x2f')][_0x7239('0x1c')]);}return _0x3bd0c4[_0x7239('0x4f')](_0x56f861);}})[_0x7239('0x23')](function(_0x427209){if(_0x427209){return _0x427209?{'count':_0x2ceb10,'rows':_0x427209}:null;}})[_0x7239('0x23')](respondWithResult(_0x3fad5e,null))[_0x7239('0x44')](handleError(_0x3fad5e,null));};exports[_0x7239('0x50')]=function(_0x3cec3d,_0x53f200,_0x2e8c74){if(_0x3cec3d[_0x7239('0x49')]['id']){delete _0x3cec3d['body']['id'];}return db[_0x7239('0x29')][_0x7239('0x4b')]({'where':{'id':_0x3cec3d[_0x7239('0x46')]['id']}})[_0x7239('0x23')](handleEntityNotFound(_0x53f200,null))[_0x7239('0x23')](function(_0x7d10e9){if(_0x7d10e9){return _0x7d10e9[_0x7239('0x50')](_0x3cec3d['body'][_0x7239('0x51')]||[]);}return null;})[_0x7239('0x23')](respondWithResult(_0x53f200,null))[_0x7239('0x44')](handleError(_0x53f200,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bab4ab6..bc52d62 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 _0x1062=['../../config/logger','moment','bluebird','request-promise','./intFreshdeskConfiguration.attributes','exports','util'];(function(_0x2c60ed,_0xed9937){var _0x22bffe=function(_0x4a5a6b){while(--_0x4a5a6b){_0x2c60ed['push'](_0x2c60ed['shift']());}};_0x22bffe(++_0xed9937);}(_0x1062,0x1d4));var _0x2106=function(_0x24b28e,_0x1446e6){_0x24b28e=_0x24b28e-0x0;var _0x21ce24=_0x1062[_0x24b28e];return _0x21ce24;};'use strict';var _=require('lodash');var util=require(_0x2106('0x0'));var logger=require(_0x2106('0x1'))('api');var moment=require(_0x2106('0x2'));var BPromise=require(_0x2106('0x3'));var rp=require(_0x2106('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2106('0x5'));module[_0x2106('0x6')]=function(_0x1248d1,_0xa261bd){return _0x1248d1['define']('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0722=['bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','moment'];(function(_0x6ea1a0,_0x341a4f){var _0x491723=function(_0x323350){while(--_0x323350){_0x6ea1a0['push'](_0x6ea1a0['shift']());}};_0x491723(++_0x341a4f);}(_0x0722,0x164));var _0x2072=function(_0x25f751,_0x4f3f7d){_0x25f751=_0x25f751-0x0;var _0x43fbf2=_0x0722[_0x25f751];return _0x43fbf2;};'use strict';var _=require(_0x2072('0x0'));var util=require('util');var logger=require(_0x2072('0x1'))(_0x2072('0x2'));var moment=require(_0x2072('0x3'));var BPromise=require(_0x2072('0x4'));var rp=require(_0x2072('0x5'));var fs=require('fs');var path=require(_0x2072('0x6'));var rimraf=require('rimraf');var config=require(_0x2072('0x7'));var attributes=require(_0x2072('0x8'));module[_0x2072('0x9')]=function(_0xa8bd06,_0x53688d){return _0xa8bd06[_0x2072('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x2072('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 5ca8d73..2f2ad09 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 _0x1eab=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1eab,0x155));var _0xb1ea=function(_0x271ca6,_0x53ff77){_0x271ca6=_0x271ca6-0x0;var _0x594abf=_0x1eab[_0x271ca6];return _0x594abf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb1ea('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1ea('0x1'))['db'];var utils=require(_0xb1ea('0x2'));var logger=require(_0xb1ea('0x3'))(_0xb1ea('0x4'));var config=require(_0xb1ea('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb1ea('0x6')][_0xb1ea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46ef68,_0x16896d,_0x432979){return new BPromise(function(_0x5b8652,_0x478c97){return client['request'](_0x46ef68,_0x432979)[_0xb1ea('0x8')](function(_0x3b53eb){logger['info'](_0xb1ea('0x9'),_0x16896d,_0xb1ea('0xa'));logger[_0xb1ea('0xb')](_0xb1ea('0xc'),_0x16896d,_0xb1ea('0xa'),JSON['stringify'](_0x3b53eb));if(_0x3b53eb[_0xb1ea('0xd')]){if(_0x3b53eb[_0xb1ea('0xd')][_0xb1ea('0xe')]===0x1f4){logger['error'](_0xb1ea('0x9'),_0x16896d,_0x3b53eb[_0xb1ea('0xd')][_0xb1ea('0xf')]);return _0x478c97(_0x3b53eb[_0xb1ea('0xd')][_0xb1ea('0xf')]);}logger[_0xb1ea('0xd')](_0xb1ea('0x9'),_0x16896d,_0x3b53eb[_0xb1ea('0xd')][_0xb1ea('0xf')]);return _0x5b8652(_0x3b53eb[_0xb1ea('0xd')]['message']);}else{logger[_0xb1ea('0x10')](_0xb1ea('0x9'),_0x16896d,_0xb1ea('0xa'));_0x5b8652(_0x3b53eb['result'][_0xb1ea('0xf')]);}})[_0xb1ea('0x11')](function(_0x1989fe){logger[_0xb1ea('0xd')](_0xb1ea('0x9'),_0x16896d,_0x1989fe);_0x478c97(_0x1989fe);});});} \ No newline at end of file +var _0x3e00=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x3f92c6,_0x38724d){var _0x3942dd=function(_0x2899ed){while(--_0x2899ed){_0x3f92c6['push'](_0x3f92c6['shift']());}};_0x3942dd(++_0x38724d);}(_0x3e00,0x9e));var _0x03e0=function(_0x4403d4,_0x18520f){_0x4403d4=_0x4403d4-0x0;var _0x35e690=_0x3e00[_0x4403d4];return _0x35e690;};'use strict';var _=require(_0x03e0('0x0'));var util=require(_0x03e0('0x1'));var moment=require(_0x03e0('0x2'));var BPromise=require(_0x03e0('0x3'));var rs=require(_0x03e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03e0('0x5'))['db'];var utils=require(_0x03e0('0x6'));var logger=require(_0x03e0('0x7'))(_0x03e0('0x8'));var config=require(_0x03e0('0x9'));var jayson=require(_0x03e0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x526279,_0x5c0878,_0x1e9f2c){return new BPromise(function(_0x37852e,_0x1f589f){return client[_0x03e0('0xb')](_0x526279,_0x1e9f2c)[_0x03e0('0xc')](function(_0xccdb8b){logger[_0x03e0('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c0878,_0x03e0('0xe'));logger[_0x03e0('0xf')](_0x03e0('0x10'),_0x5c0878,'request\x20sent',JSON[_0x03e0('0x11')](_0xccdb8b));if(_0xccdb8b[_0x03e0('0x12')]){if(_0xccdb8b[_0x03e0('0x12')][_0x03e0('0x13')]===0x1f4){logger[_0x03e0('0x12')](_0x03e0('0x14'),_0x5c0878,_0xccdb8b[_0x03e0('0x12')]['message']);return _0x1f589f(_0xccdb8b[_0x03e0('0x12')][_0x03e0('0x15')]);}logger[_0x03e0('0x12')](_0x03e0('0x14'),_0x5c0878,_0xccdb8b[_0x03e0('0x12')][_0x03e0('0x15')]);return _0x37852e(_0xccdb8b[_0x03e0('0x12')][_0x03e0('0x15')]);}else{logger[_0x03e0('0xd')](_0x03e0('0x14'),_0x5c0878,_0x03e0('0xe'));_0x37852e(_0xccdb8b[_0x03e0('0x16')]['message']);}})['catch'](function(_0x36fa67){logger[_0x03e0('0x12')](_0x03e0('0x14'),_0x5c0878,_0x36fa67);_0x1f589f(_0x36fa67);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index cbe3488..81c1648 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 _0x7bdd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','get','/:id','post','put','update','destroy','exports','multer','path'];(function(_0x483d91,_0x4546e8){var _0x103ae8=function(_0x19cd8b){while(--_0x19cd8b){_0x483d91['push'](_0x483d91['shift']());}};_0x103ae8(++_0x4546e8);}(_0x7bdd,0x64));var _0xd7bd=function(_0x282bda,_0x2f6d07){_0x282bda=_0x282bda-0x0;var _0x4183e0=_0x7bdd[_0x282bda];return _0x4183e0;};'use strict';var multer=require(_0xd7bd('0x0'));var util=require('util');var path=require(_0xd7bd('0x1'));var timeout=require(_0xd7bd('0x2'));var express=require(_0xd7bd('0x3'));var router=express[_0xd7bd('0x4')]();var fs_extra=require(_0xd7bd('0x5'));var auth=require(_0xd7bd('0x6'));var interaction=require(_0xd7bd('0x7'));var config=require('../../config/environment');var controller=require(_0xd7bd('0x8'));router['get']('/',auth[_0xd7bd('0x9')](),controller['index']);router[_0xd7bd('0xa')](_0xd7bd('0xb'),auth[_0xd7bd('0x9')](),controller['show']);router[_0xd7bd('0xc')]('/',auth[_0xd7bd('0x9')](),controller['create']);router[_0xd7bd('0xd')](_0xd7bd('0xb'),auth['isAuthenticated'](),controller[_0xd7bd('0xe')]);router['delete'](_0xd7bd('0xb'),auth[_0xd7bd('0x9')](),controller[_0xd7bd('0xf')]);module[_0xd7bd('0x10')]=router; \ No newline at end of file +var _0xda5b=['create','put','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0xa8535a,_0x401b12){var _0x227e2a=function(_0x98d071){while(--_0x98d071){_0xa8535a['push'](_0xa8535a['shift']());}};_0x227e2a(++_0x401b12);}(_0xda5b,0x125));var _0xbda5=function(_0x20237d,_0x506c3d){_0x20237d=_0x20237d-0x0;var _0x5a5b92=_0xda5b[_0x20237d];return _0x5a5b92;};'use strict';var multer=require('multer');var util=require(_0xbda5('0x0'));var path=require(_0xbda5('0x1'));var timeout=require('connect-timeout');var express=require(_0xbda5('0x2'));var router=express[_0xbda5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbda5('0x4'));var config=require('../../config/environment');var controller=require(_0xbda5('0x5'));router[_0xbda5('0x6')]('/',auth[_0xbda5('0x7')](),controller[_0xbda5('0x8')]);router[_0xbda5('0x6')](_0xbda5('0x9'),auth[_0xbda5('0x7')](),controller[_0xbda5('0xa')]);router['post']('/',auth[_0xbda5('0x7')](),controller[_0xbda5('0xb')]);router[_0xbda5('0xc')](_0xbda5('0x9'),auth[_0xbda5('0x7')](),controller['update']);router[_0xbda5('0xd')](_0xbda5('0x9'),auth[_0xbda5('0x7')](),controller[_0xbda5('0xe')]);module[_0xbda5('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6444e38..396976e 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 _0x8d20=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x218400,_0x449026){var _0x2dfdff=function(_0x1026fe){while(--_0x1026fe){_0x218400['push'](_0x218400['shift']());}};_0x2dfdff(++_0x449026);}(_0x8d20,0xac));var _0x08d2=function(_0x13d60b,_0x481bcd){_0x13d60b=_0x13d60b-0x0;var _0x1c8861=_0x8d20[_0x13d60b];return _0x1c8861;};'use strict';var Sequelize=require(_0x08d2('0x0'));module[_0x08d2('0x1')]={'type':{'type':Sequelize[_0x08d2('0x2')](_0x08d2('0x3'),'variable',_0x08d2('0x4'),_0x08d2('0x5'),_0x08d2('0x6')),'defaultValue':_0x08d2('0x3')},'content':{'type':Sequelize[_0x08d2('0x7')]},'key':{'type':Sequelize[_0x08d2('0x7')]},'keyType':{'type':Sequelize[_0x08d2('0x2')](_0x08d2('0x3'),_0x08d2('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x08d2('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x08d2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x08d2('0x7')]}}; \ No newline at end of file +var _0xdac1=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0xdac1,0x64));var _0x1dac=function(_0xe449e3,_0x572d33){_0xe449e3=_0xe449e3-0x0;var _0x22fedb=_0xdac1[_0xe449e3];return _0x22fedb;};'use strict';var Sequelize=require(_0x1dac('0x0'));module[_0x1dac('0x1')]={'type':{'type':Sequelize[_0x1dac('0x2')](_0x1dac('0x3'),_0x1dac('0x4'),_0x1dac('0x5'),_0x1dac('0x6'),'picklist'),'defaultValue':_0x1dac('0x3')},'content':{'type':Sequelize[_0x1dac('0x7')]},'key':{'type':Sequelize[_0x1dac('0x7')]},'keyType':{'type':Sequelize[_0x1dac('0x2')](_0x1dac('0x3'),_0x1dac('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1dac('0x7')]},'idField':{'type':Sequelize[_0x1dac('0x7')]},'nameField':{'type':Sequelize[_0x1dac('0x7')]},'customField':{'type':Sequelize[_0x1dac('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1dac('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 2a9ca30..dfe96bb 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 _0xd139=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x26eb2a,_0x26c896){var _0xed5187=function(_0x157f5b){while(--_0x157f5b){_0x26eb2a['push'](_0x26eb2a['shift']());}};_0xed5187(++_0x26c896);}(_0xd139,0x14e));var _0x9d13=function(_0x2cb240,_0x1374ba){_0x2cb240=_0x2cb240-0x0;var _0x59984d=_0xd139[_0x2cb240];return _0x59984d;};'use strict';var emlformat=require(_0x9d13('0x0'));var rimraf=require(_0x9d13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d13('0x2'));var moment=require(_0x9d13('0x3'));var BPromise=require(_0x9d13('0x4'));var Mustache=require(_0x9d13('0x5'));var util=require(_0x9d13('0x6'));var path=require(_0x9d13('0x7'));var sox=require(_0x9d13('0x8'));var csv=require('to-csv');var ejs=require(_0x9d13('0x9'));var fs=require('fs');var fs_extra=require(_0x9d13('0xa'));var _=require('lodash');var squel=require(_0x9d13('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d13('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d13('0xd'));var Redis=require(_0x9d13('0xe'));var authService=require(_0x9d13('0xf'));var qs=require(_0x9d13('0x10'));var as=require(_0x9d13('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d13('0x12'))(_0x9d13('0x13'));var utils=require(_0x9d13('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d13('0x15'))['db'];function respondWithStatusCode(_0x3933d1,_0x39020){_0x39020=_0x39020||0xcc;return function(_0x331fea){if(_0x331fea){return _0x3933d1[_0x9d13('0x16')](_0x39020);}return _0x3933d1['status'](_0x39020)['end']();};}function respondWithResult(_0x37607a,_0x43bf27){_0x43bf27=_0x43bf27||0xc8;return function(_0x2f5442){if(_0x2f5442){return _0x37607a[_0x9d13('0x17')](_0x43bf27)[_0x9d13('0x18')](_0x2f5442);}};}function respondWithFilteredResult(_0x1a2b65,_0x38f368){return function(_0x47bcd3){if(_0x47bcd3){var _0x3acfc1=typeof _0x38f368[_0x9d13('0x19')]===_0x9d13('0x1a')&&typeof _0x38f368[_0x9d13('0x1b')]===_0x9d13('0x1a');var _0x42d5a5=_0x47bcd3[_0x9d13('0x1c')];var _0x10aa89=_0x3acfc1?0x0:_0x38f368[_0x9d13('0x19')];var _0x2acb0b=_0x3acfc1?_0x47bcd3[_0x9d13('0x1c')]:_0x38f368[_0x9d13('0x19')]+_0x38f368[_0x9d13('0x1b')];var _0x4d6b9d;if(_0x2acb0b>=_0x42d5a5){_0x2acb0b=_0x42d5a5;_0x4d6b9d=0xc8;}else{_0x4d6b9d=0xce;}_0x1a2b65[_0x9d13('0x17')](_0x4d6b9d);return _0x1a2b65[_0x9d13('0x1d')](_0x9d13('0x1e'),_0x10aa89+'-'+_0x2acb0b+'/'+_0x42d5a5)[_0x9d13('0x18')](_0x47bcd3);}return null;};}function patchUpdates(_0x4e1425){return function(_0x48ce3d){try{jsonpatch['apply'](_0x48ce3d,_0x4e1425,!![]);}catch(_0x223ea5){return BPromise[_0x9d13('0x1f')](_0x223ea5);}return _0x48ce3d[_0x9d13('0x20')]();};}function saveUpdates(_0x1fefe4,_0x3971e0){return function(_0x3040e7){if(_0x3040e7){return _0x3040e7[_0x9d13('0x21')](_0x1fefe4)[_0x9d13('0x22')](function(_0x5d14c8){return _0x5d14c8;});}return null;};}function removeEntity(_0xb34817,_0xd5a981){return function(_0x22963f){if(_0x22963f){return _0x22963f[_0x9d13('0x23')]()['then'](function(){_0xb34817[_0x9d13('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40c673,_0xfaf587){return function(_0xe0c57){if(!_0xe0c57){_0x40c673[_0x9d13('0x16')](0x194);}return _0xe0c57;};}function handleError(_0x453536,_0x45a299){_0x45a299=_0x45a299||0x1f4;return function(_0x1c36e5){logger[_0x9d13('0x24')](_0x1c36e5['stack']);if(_0x1c36e5[_0x9d13('0x25')]){delete _0x1c36e5['name'];}_0x453536[_0x9d13('0x17')](_0x45a299)[_0x9d13('0x26')](_0x1c36e5);};}exports[_0x9d13('0x27')]=function(_0x1d9f56,_0x5ebfaf){var _0x23c91f={},_0x441118={},_0x3dcc6c={'count':0x0,'rows':[]};var _0x34e5df=_[_0x9d13('0x28')](db[_0x9d13('0x29')][_0x9d13('0x2a')],function(_0x523e5e){return{'name':_0x523e5e[_0x9d13('0x2b')],'type':_0x523e5e['type'][_0x9d13('0x2c')]};});_0x441118[_0x9d13('0x2d')]=_['map'](_0x34e5df,_0x9d13('0x25'));_0x441118[_0x9d13('0x2e')]=_['keys'](_0x1d9f56['query']);_0x441118['filters']=_[_0x9d13('0x2f')](_0x441118['model'],_0x441118[_0x9d13('0x2e')]);_0x23c91f[_0x9d13('0x30')]=_[_0x9d13('0x2f')](_0x441118['model'],qs[_0x9d13('0x31')](_0x1d9f56[_0x9d13('0x2e')][_0x9d13('0x31')]));_0x23c91f[_0x9d13('0x30')]=_0x23c91f['attributes']['length']?_0x23c91f[_0x9d13('0x30')]:_0x441118[_0x9d13('0x2d')];if(!_0x1d9f56['query'][_0x9d13('0x32')](_0x9d13('0x33'))){_0x23c91f[_0x9d13('0x1b')]=qs[_0x9d13('0x1b')](_0x1d9f56[_0x9d13('0x2e')][_0x9d13('0x1b')]);_0x23c91f[_0x9d13('0x19')]=qs['offset'](_0x1d9f56[_0x9d13('0x2e')]['offset']);}_0x23c91f['order']=qs['sort'](_0x1d9f56[_0x9d13('0x2e')][_0x9d13('0x34')]);_0x23c91f[_0x9d13('0x35')]=qs[_0x9d13('0x36')](_[_0x9d13('0x37')](_0x1d9f56['query'],_0x441118[_0x9d13('0x36')]),_0x34e5df);if(_0x1d9f56[_0x9d13('0x2e')][_0x9d13('0x38')]){_0x23c91f[_0x9d13('0x35')]=_[_0x9d13('0x39')](_0x23c91f[_0x9d13('0x35')],{'$or':_['map'](_0x34e5df,function(_0x3f2bb9){if(_0x3f2bb9[_0x9d13('0x3a')]!==_0x9d13('0x3b')){var _0x547a6b={};_0x547a6b[_0x3f2bb9['name']]={'$like':'%'+_0x1d9f56[_0x9d13('0x2e')][_0x9d13('0x38')]+'%'};return _0x547a6b;}})});}_0x23c91f=_[_0x9d13('0x39')]({},_0x23c91f,_0x1d9f56['options']);var _0x206f29={'where':_0x23c91f[_0x9d13('0x35')]};return db['FreshdeskField'][_0x9d13('0x1c')](_0x206f29)[_0x9d13('0x22')](function(_0x4635b5){_0x3dcc6c[_0x9d13('0x1c')]=_0x4635b5;if(_0x1d9f56[_0x9d13('0x2e')][_0x9d13('0x3c')]){_0x23c91f[_0x9d13('0x3d')]=[{'all':!![]}];}return db[_0x9d13('0x29')][_0x9d13('0x3e')](_0x23c91f);})['then'](function(_0x56943){_0x3dcc6c[_0x9d13('0x3f')]=_0x56943;return _0x3dcc6c;})[_0x9d13('0x22')](respondWithFilteredResult(_0x5ebfaf,_0x23c91f))[_0x9d13('0x40')](handleError(_0x5ebfaf,null));};exports[_0x9d13('0x41')]=function(_0x20e89e,_0x395972){var _0x5635f4={'raw':!![],'where':{'id':_0x20e89e[_0x9d13('0x42')]['id']}},_0x30114a={};_0x30114a[_0x9d13('0x2d')]=_[_0x9d13('0x43')](db[_0x9d13('0x29')][_0x9d13('0x2a')]);_0x30114a['query']=_['keys'](_0x20e89e[_0x9d13('0x2e')]);_0x30114a['filters']=_[_0x9d13('0x2f')](_0x30114a['model'],_0x30114a[_0x9d13('0x2e')]);_0x5635f4[_0x9d13('0x30')]=_[_0x9d13('0x2f')](_0x30114a[_0x9d13('0x2d')],qs[_0x9d13('0x31')](_0x20e89e['query'][_0x9d13('0x31')]));_0x5635f4[_0x9d13('0x30')]=_0x5635f4[_0x9d13('0x30')][_0x9d13('0x44')]?_0x5635f4[_0x9d13('0x30')]:_0x30114a[_0x9d13('0x2d')];if(_0x20e89e[_0x9d13('0x2e')][_0x9d13('0x3c')]){_0x5635f4[_0x9d13('0x3d')]=[{'all':!![]}];}_0x5635f4=_[_0x9d13('0x39')]({},_0x5635f4,_0x20e89e['options']);return db['FreshdeskField'][_0x9d13('0x45')](_0x5635f4)[_0x9d13('0x22')](handleEntityNotFound(_0x395972,null))['then'](respondWithResult(_0x395972,null))[_0x9d13('0x40')](handleError(_0x395972,null));};exports['create']=function(_0xd81e84,_0x20b834){return db['FreshdeskField']['create'](_0xd81e84[_0x9d13('0x46')],{})[_0x9d13('0x22')](respondWithResult(_0x20b834,0xc9))[_0x9d13('0x40')](handleError(_0x20b834,null));};exports[_0x9d13('0x21')]=function(_0x35865e,_0x70514d){if(_0x35865e[_0x9d13('0x46')]['id']){delete _0x35865e[_0x9d13('0x46')]['id'];}return db[_0x9d13('0x29')]['find']({'where':{'id':_0x35865e[_0x9d13('0x42')]['id']}})['then'](handleEntityNotFound(_0x70514d,null))['then'](saveUpdates(_0x35865e[_0x9d13('0x46')],null))['then'](respondWithResult(_0x70514d,null))[_0x9d13('0x40')](handleError(_0x70514d,null));};exports[_0x9d13('0x23')]=function(_0x3457e5,_0x5dde68){return db[_0x9d13('0x29')][_0x9d13('0x45')]({'where':{'id':_0x3457e5['params']['id']}})[_0x9d13('0x22')](handleEntityNotFound(_0x5dde68,null))[_0x9d13('0x22')](removeEntity(_0x5dde68,null))[_0x9d13('0x40')](handleError(_0x5dde68,null));}; \ No newline at end of file +var _0xbc9d=['stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','map','type','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then'];(function(_0x1863ae,_0x384202){var _0x13cf63=function(_0x331d3d){while(--_0x331d3d){_0x1863ae['push'](_0x1863ae['shift']());}};_0x13cf63(++_0x384202);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x4c04b1,_0xee7e14){_0x4c04b1=_0x4c04b1-0x0;var _0x432f22=_0xbc9d[_0x4c04b1];return _0x432f22;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)[_0xdbc9('0x1b')]();});}};}function handleEntityNotFound(_0x3c8c1d,_0x4a868b){return function(_0x550bef){if(!_0x550bef){_0x3c8c1d[_0xdbc9('0x19')](0x194);}return _0x550bef;};}function handleError(_0x446ab9,_0x1053ca){_0x1053ca=_0x1053ca||0x1f4;return function(_0x24fdec){logger['error'](_0x24fdec[_0xdbc9('0x27')]);if(_0x24fdec[_0xdbc9('0x28')]){delete _0x24fdec['name'];}_0x446ab9['status'](_0x1053ca)[_0xdbc9('0x29')](_0x24fdec);};}exports[_0xdbc9('0x2a')]=function(_0x473430,_0x59bfd2){var _0x13a432={},_0x539e57={},_0x561f8e={'count':0x0,'rows':[]};var _0x210a40=_['map'](db['FreshdeskField'][_0xdbc9('0x2b')],function(_0x20eb4f){return{'name':_0x20eb4f[_0xdbc9('0x2c')],'type':_0x20eb4f['type'][_0xdbc9('0x2d')]};});_0x539e57[_0xdbc9('0x2e')]=_['map'](_0x210a40,'name');_0x539e57[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x473430[_0xdbc9('0x2f')]);_0x539e57[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],_0x539e57[_0xdbc9('0x2f')]);_0x13a432['attributes']=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],qs[_0xdbc9('0x33')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x33')]));_0x13a432[_0xdbc9('0x34')]=_0x13a432['attributes'][_0xdbc9('0x35')]?_0x13a432['attributes']:_0x539e57['model'];if(!_0x473430['query']['hasOwnProperty']('nolimit')){_0x13a432[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x473430[_0xdbc9('0x2f')]['limit']);_0x13a432[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x20')]);}_0x13a432[_0xdbc9('0x36')]=qs[_0xdbc9('0x37')](_0x473430['query'][_0xdbc9('0x37')]);_0x13a432[_0xdbc9('0x38')]=qs[_0xdbc9('0x31')](_['pick'](_0x473430[_0xdbc9('0x2f')],_0x539e57[_0xdbc9('0x31')]),_0x210a40);if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x39')]){_0x13a432['where']=_['merge'](_0x13a432[_0xdbc9('0x38')],{'$or':_[_0xdbc9('0x3a')](_0x210a40,function(_0x136392){if(_0x136392[_0xdbc9('0x3b')]!=='VIRTUAL'){var _0x1b651f={};_0x1b651f[_0x136392[_0xdbc9('0x28')]]={'$like':'%'+_0x473430[_0xdbc9('0x2f')]['filter']+'%'};return _0x1b651f;}})});}_0x13a432=_[_0xdbc9('0x3c')]({},_0x13a432,_0x473430[_0xdbc9('0x3d')]);var _0x444219={'where':_0x13a432['where']};return db[_0xdbc9('0x3e')][_0xdbc9('0x1f')](_0x444219)['then'](function(_0x5173c2){_0x561f8e[_0xdbc9('0x1f')]=_0x5173c2;if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x13a432[_0xdbc9('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0xdbc9('0x41')](_0x13a432);})[_0xdbc9('0x26')](function(_0x577725){_0x561f8e[_0xdbc9('0x42')]=_0x577725;return _0x561f8e;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x59bfd2,_0x13a432))['catch'](handleError(_0x59bfd2,null));};exports[_0xdbc9('0x43')]=function(_0x72dee3,_0x2adb23){var _0x3415c3={'raw':!![],'where':{'id':_0x72dee3[_0xdbc9('0x44')]['id']}},_0x3ed4de={};_0x3ed4de[_0xdbc9('0x2e')]=_['keys'](db['FreshdeskField'][_0xdbc9('0x2b')]);_0x3ed4de[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x72dee3[_0xdbc9('0x2f')]);_0x3ed4de[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],_0x3ed4de[_0xdbc9('0x2f')]);_0x3415c3[_0xdbc9('0x34')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],qs['fields'](_0x72dee3['query'][_0xdbc9('0x33')]));_0x3415c3[_0xdbc9('0x34')]=_0x3415c3[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x3415c3[_0xdbc9('0x34')]:_0x3ed4de[_0xdbc9('0x2e')];if(_0x72dee3[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x3415c3['include']=[{'all':!![]}];}_0x3415c3=_['merge']({},_0x3415c3,_0x72dee3[_0xdbc9('0x3d')]);return db[_0xdbc9('0x3e')][_0xdbc9('0x45')](_0x3415c3)[_0xdbc9('0x26')](handleEntityNotFound(_0x2adb23,null))[_0xdbc9('0x26')](respondWithResult(_0x2adb23,null))[_0xdbc9('0x46')](handleError(_0x2adb23,null));};exports[_0xdbc9('0x47')]=function(_0x2ea096,_0x43e3ec){return db['FreshdeskField'][_0xdbc9('0x47')](_0x2ea096[_0xdbc9('0x48')],{})['then'](respondWithResult(_0x43e3ec,0xc9))['catch'](handleError(_0x43e3ec,null));};exports[_0xdbc9('0x24')]=function(_0xc3db3c,_0x133a13){if(_0xc3db3c['body']['id']){delete _0xc3db3c[_0xdbc9('0x48')]['id'];}return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0xc3db3c[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x133a13,null))[_0xdbc9('0x26')](saveUpdates(_0xc3db3c[_0xdbc9('0x48')],null))[_0xdbc9('0x26')](respondWithResult(_0x133a13,null))[_0xdbc9('0x46')](handleError(_0x133a13,null));};exports['destroy']=function(_0x3e89f5,_0x36c70e){return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0x3e89f5[_0xdbc9('0x44')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x36c70e,null))[_0xdbc9('0x26')](removeEntity(_0x36c70e,null))[_0xdbc9('0x46')](handleError(_0x36c70e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5fe2e44..2834bf9 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 _0xc3a6=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x45c849,_0x25b00c){var _0x5e8981=function(_0xce3674){while(--_0xce3674){_0x45c849['push'](_0x45c849['shift']());}};_0x5e8981(++_0x25b00c);}(_0xc3a6,0x116));var _0x6c3a=function(_0x24a60f,_0x5ec8de){_0x24a60f=_0x24a60f-0x0;var _0x2ca7ea=_0xc3a6[_0x24a60f];return _0x2ca7ea;};'use strict';var _=require(_0x6c3a('0x0'));var util=require('util');var logger=require(_0x6c3a('0x1'))(_0x6c3a('0x2'));var moment=require(_0x6c3a('0x3'));var BPromise=require(_0x6c3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c3a('0x5'));var rimraf=require(_0x6c3a('0x6'));var config=require(_0x6c3a('0x7'));var attributes=require(_0x6c3a('0x8'));module[_0x6c3a('0x9')]=function(_0x65b400,_0x543cc9){return _0x65b400[_0x6c3a('0xa')](_0x6c3a('0xb'),attributes,{'tableName':_0x6c3a('0xc'),'paranoid':![],'indexes':[{'name':_0x6c3a('0xd'),'fields':[_0x6c3a('0xe'),_0x6c3a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3aa2=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','util','../../config/logger','api','bluebird','path'];(function(_0x2018d1,_0x19904e){var _0x374451=function(_0x5d5071){while(--_0x5d5071){_0x2018d1['push'](_0x2018d1['shift']());}};_0x374451(++_0x19904e);}(_0x3aa2,0xd3));var _0x23aa=function(_0x2cb984,_0x365f50){_0x2cb984=_0x2cb984-0x0;var _0x2f73e6=_0x3aa2[_0x2cb984];return _0x2f73e6;};'use strict';var _=require('lodash');var util=require(_0x23aa('0x0'));var logger=require(_0x23aa('0x1'))(_0x23aa('0x2'));var moment=require('moment');var BPromise=require(_0x23aa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23aa('0x4'));var rimraf=require('rimraf');var config=require(_0x23aa('0x5'));var attributes=require(_0x23aa('0x6'));module[_0x23aa('0x7')]=function(_0x1b60a0,_0x828c0){return _0x1b60a0[_0x23aa('0x8')](_0x23aa('0x9'),attributes,{'tableName':_0x23aa('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x23aa('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 912db1f..6e97a6f 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 _0xd193=['request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x23286c,_0x4caaff){var _0x303038=function(_0x37e750){while(--_0x37e750){_0x23286c['push'](_0x23286c['shift']());}};_0x303038(++_0x4caaff);}(_0xd193,0x1d6));var _0x3d19=function(_0x1e4582,_0x66871b){_0x1e4582=_0x1e4582-0x0;var _0xf2ac27=_0xd193[_0x1e4582];return _0xf2ac27;};'use strict';var _=require(_0x3d19('0x0'));var util=require(_0x3d19('0x1'));var moment=require(_0x3d19('0x2'));var BPromise=require(_0x3d19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d19('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d19('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30bbe5,_0x563fb4,_0x3230fa){return new BPromise(function(_0x153018,_0x3e7925){return client[_0x3d19('0x6')](_0x30bbe5,_0x3230fa)[_0x3d19('0x7')](function(_0x273075){logger[_0x3d19('0x8')](_0x3d19('0x9'),_0x563fb4,_0x3d19('0xa'));logger[_0x3d19('0xb')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x563fb4,_0x3d19('0xa'),JSON['stringify'](_0x273075));if(_0x273075[_0x3d19('0xc')]){if(_0x273075[_0x3d19('0xc')][_0x3d19('0xd')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x563fb4,_0x273075[_0x3d19('0xc')][_0x3d19('0xe')]);return _0x3e7925(_0x273075['error']['message']);}logger[_0x3d19('0xc')](_0x3d19('0x9'),_0x563fb4,_0x273075[_0x3d19('0xc')][_0x3d19('0xe')]);return _0x153018(_0x273075['error']['message']);}else{logger[_0x3d19('0x8')](_0x3d19('0x9'),_0x563fb4,_0x3d19('0xa'));_0x153018(_0x273075[_0x3d19('0xf')][_0x3d19('0xe')]);}})[_0x3d19('0x10')](function(_0x480d2b){logger['error'](_0x3d19('0x9'),_0x563fb4,_0x480d2b);_0x3e7925(_0x480d2b);});});} \ No newline at end of file +var _0xdb5a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xdb5a,0x1c1));var _0xadb5=function(_0x4f19de,_0x1c89e5){_0x4f19de=_0x4f19de-0x0;var _0x3d66a0=_0xdb5a[_0x4f19de];return _0x3d66a0;};'use strict';var _=require(_0xadb5('0x0'));var util=require(_0xadb5('0x1'));var moment=require(_0xadb5('0x2'));var BPromise=require(_0xadb5('0x3'));var rs=require(_0xadb5('0x4'));var fs=require('fs');var Redis=require(_0xadb5('0x5'));var db=require(_0xadb5('0x6'))['db'];var utils=require(_0xadb5('0x7'));var logger=require('../../config/logger')(_0xadb5('0x8'));var config=require(_0xadb5('0x9'));var jayson=require(_0xadb5('0xa'));var client=jayson[_0xadb5('0xb')][_0xadb5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb69788,_0x4c0320,_0x1361d2){return new BPromise(function(_0x4265b9,_0x293aa0){return client[_0xadb5('0xd')](_0xb69788,_0x1361d2)['then'](function(_0x3bf68a){logger['info'](_0xadb5('0xe'),_0x4c0320,_0xadb5('0xf'));logger[_0xadb5('0x10')](_0xadb5('0x11'),_0x4c0320,_0xadb5('0xf'),JSON[_0xadb5('0x12')](_0x3bf68a));if(_0x3bf68a[_0xadb5('0x13')]){if(_0x3bf68a[_0xadb5('0x13')][_0xadb5('0x14')]===0x1f4){logger[_0xadb5('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4c0320,_0x3bf68a[_0xadb5('0x13')]['message']);return _0x293aa0(_0x3bf68a[_0xadb5('0x13')][_0xadb5('0x15')]);}logger[_0xadb5('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4c0320,_0x3bf68a[_0xadb5('0x13')]['message']);return _0x4265b9(_0x3bf68a[_0xadb5('0x13')]['message']);}else{logger[_0xadb5('0x16')](_0xadb5('0xe'),_0x4c0320,_0xadb5('0xf'));_0x4265b9(_0x3bf68a[_0xadb5('0x17')][_0xadb5('0x15')]);}})['catch'](function(_0x207786){logger[_0xadb5('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4c0320,_0x207786);_0x293aa0(_0x207786);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f830798..d4aa4fd 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 _0xa74f=['post','create','/:id/configurations','put','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields'];(function(_0x35dadd,_0x3ed50f){var _0x2728ed=function(_0x80656f){while(--_0x80656f){_0x35dadd['push'](_0x35dadd['shift']());}};_0x2728ed(++_0x3ed50f);}(_0xa74f,0x9a));var _0xfa74=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xa74f[_0x38c652];return _0x218a37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id/configurations',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0x7')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0xe')](_0xfa74('0x10'),auth[_0xfa74('0x9')](),controller['addConfiguration']);router[_0xfa74('0x11')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x12')]);router['delete'](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x13')]);module[_0xfa74('0x14')]=router; \ No newline at end of file +var _0xb9a7=['addConfiguration','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create'];(function(_0x317bfe,_0x1c2fbf){var _0x38000c=function(_0x11fe89){while(--_0x11fe89){_0x317bfe['push'](_0x317bfe['shift']());}};_0x38000c(++_0x1c2fbf);}(_0xb9a7,0x112));var _0x7b9a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xb9a7[_0xa148b7];return _0x51efd3;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['show']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['getFields']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b9a('0xd')]);router['post'](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0xe')]);router['put'](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['update']);router[_0x7b9a('0xf')](_0x7b9a('0x9'),auth['isAuthenticated'](),controller[_0x7b9a('0x10')]);module[_0x7b9a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index bb8a196..1f1be25 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 _0x1a37=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4e3b9c,_0x4d76a3){var _0x358b13=function(_0x2409d6){while(--_0x2409d6){_0x4e3b9c['push'](_0x4e3b9c['shift']());}};_0x358b13(++_0x4d76a3);}(_0x1a37,0xb4));var _0x71a3=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x1a37[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')]},'description':{'type':Sequelize[_0x71a3('0x2')]},'username':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3')},'apiKey':{'type':Sequelize[_0x71a3('0x2')]},'remoteUri':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x4')},'serverUrl':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3d04=['STRING','username','sequelize','exports'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x43d0('0x0'));module[_0x43d0('0x1')]={'name':{'type':Sequelize[_0x43d0('0x2')]},'description':{'type':Sequelize[_0x43d0('0x2')]},'username':{'type':Sequelize[_0x43d0('0x2')],'unique':_0x43d0('0x3')},'apiKey':{'type':Sequelize[_0x43d0('0x2')]},'remoteUri':{'type':Sequelize[_0x43d0('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x43d0('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 98047c3..c5dd217 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 _0x66ff=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','findOne','FreshsalesConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Token\x20token=','users','email','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x521705,_0x4a835b){var _0x4f30e5=function(_0x53958b){while(--_0x53958b){_0x521705['push'](_0x521705['shift']());}};_0x4f30e5(++_0x4a835b);}(_0x66ff,0x184));var _0xf66f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x66ff[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xf66f('0x0'));var rimraf=require(_0xf66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf66f('0x2'));var Mustache=require(_0xf66f('0x3'));var util=require('util');var path=require(_0xf66f('0x4'));var sox=require(_0xf66f('0x5'));var csv=require(_0xf66f('0x6'));var ejs=require(_0xf66f('0x7'));var fs=require('fs');var fs_extra=require(_0xf66f('0x8'));var _=require(_0xf66f('0x9'));var squel=require(_0xf66f('0xa'));var crypto=require(_0xf66f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf66f('0x6'));var querystring=require(_0xf66f('0xc'));var Papa=require('papaparse');var Redis=require(_0xf66f('0xd'));var authService=require(_0xf66f('0xe'));var qs=require(_0xf66f('0xf'));var as=require(_0xf66f('0x10'));var hardwareService=require(_0xf66f('0x11'));var logger=require(_0xf66f('0x12'))(_0xf66f('0x13'));var utils=require(_0xf66f('0x14'));var config=require(_0xf66f('0x15'));var licenseUtil=require(_0xf66f('0x16'));var db=require(_0xf66f('0x17'))['db'];var integrations=require(_0xf66f('0x18'));function respondWithStatusCode(_0x49d7f3,_0x81eac8){_0x81eac8=_0x81eac8||0xcc;return function(_0x349e55){if(_0x349e55){return _0x49d7f3['sendStatus'](_0x81eac8);}return _0x49d7f3[_0xf66f('0x19')](_0x81eac8)[_0xf66f('0x1a')]();};}function respondWithResult(_0x341131,_0x186abd){_0x186abd=_0x186abd||0xc8;return function(_0x3f6d0e){if(_0x3f6d0e){return _0x341131['status'](_0x186abd)[_0xf66f('0x1b')](_0x3f6d0e);}};}function respondWithFilteredResult(_0x55e3da,_0x1bd8cf){return function(_0xd1b603){if(_0xd1b603){var _0xb7b73f=typeof _0x1bd8cf['offset']===_0xf66f('0x1c')&&typeof _0x1bd8cf[_0xf66f('0x1d')]===_0xf66f('0x1c');var _0xb8c3a6=_0xd1b603[_0xf66f('0x1e')];var _0x2b60e8=_0xb7b73f?0x0:_0x1bd8cf[_0xf66f('0x1f')];var _0x5680e3=_0xb7b73f?_0xd1b603['count']:_0x1bd8cf[_0xf66f('0x1f')]+_0x1bd8cf[_0xf66f('0x1d')];var _0x18ad42;if(_0x5680e3>=_0xb8c3a6){_0x5680e3=_0xb8c3a6;_0x18ad42=0xc8;}else{_0x18ad42=0xce;}_0x55e3da['status'](_0x18ad42);return _0x55e3da['set'](_0xf66f('0x20'),_0x2b60e8+'-'+_0x5680e3+'/'+_0xb8c3a6)['json'](_0xd1b603);}return null;};}function patchUpdates(_0x393054){return function(_0xd14c1a){try{jsonpatch[_0xf66f('0x21')](_0xd14c1a,_0x393054,!![]);}catch(_0x186211){return BPromise[_0xf66f('0x22')](_0x186211);}return _0xd14c1a[_0xf66f('0x23')]();};}function saveUpdates(_0x228767,_0x351ee4){return function(_0x5b1a33){if(_0x5b1a33){return _0x5b1a33[_0xf66f('0x24')](_0x228767)[_0xf66f('0x25')](function(_0x10d21a){return _0x10d21a;});}return null;};}function removeEntity(_0x1f3af2,_0x29c9de){return function(_0x4de000){if(_0x4de000){return _0x4de000[_0xf66f('0x26')]()[_0xf66f('0x25')](function(){_0x1f3af2[_0xf66f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6565b3,_0x50302){return function(_0x511857){if(!_0x511857){_0x6565b3[_0xf66f('0x27')](0x194);}return _0x511857;};}function handleError(_0x45c6e7,_0x2ceeaa){_0x2ceeaa=_0x2ceeaa||0x1f4;return function(_0x5bdff3){logger[_0xf66f('0x28')](_0x5bdff3['stack']);if(_0x5bdff3[_0xf66f('0x29')]){delete _0x5bdff3[_0xf66f('0x29')];}_0x45c6e7['status'](_0x2ceeaa)[_0xf66f('0x2a')](_0x5bdff3);};}exports[_0xf66f('0x2b')]=function(_0x2693a5,_0xae6d0a){var _0x557324={},_0x3d927e={},_0x4b2b43={'count':0x0,'rows':[]};var _0x2e60fe=_[_0xf66f('0x2c')](db[_0xf66f('0x2d')][_0xf66f('0x2e')],function(_0x46be6c){return{'name':_0x46be6c['fieldName'],'type':_0x46be6c[_0xf66f('0x2f')][_0xf66f('0x30')]};});_0x3d927e[_0xf66f('0x31')]=_['map'](_0x2e60fe,_0xf66f('0x29'));_0x3d927e[_0xf66f('0x32')]=_[_0xf66f('0x33')](_0x2693a5[_0xf66f('0x32')]);_0x3d927e[_0xf66f('0x34')]=_[_0xf66f('0x35')](_0x3d927e[_0xf66f('0x31')],_0x3d927e[_0xf66f('0x32')]);_0x557324[_0xf66f('0x36')]=_['intersection'](_0x3d927e[_0xf66f('0x31')],qs['fields'](_0x2693a5[_0xf66f('0x32')][_0xf66f('0x37')]));_0x557324[_0xf66f('0x36')]=_0x557324[_0xf66f('0x36')][_0xf66f('0x38')]?_0x557324[_0xf66f('0x36')]:_0x3d927e[_0xf66f('0x31')];if(!_0x2693a5[_0xf66f('0x32')][_0xf66f('0x39')]('nolimit')){_0x557324[_0xf66f('0x1d')]=qs['limit'](_0x2693a5[_0xf66f('0x32')][_0xf66f('0x1d')]);_0x557324[_0xf66f('0x1f')]=qs['offset'](_0x2693a5[_0xf66f('0x32')]['offset']);}_0x557324[_0xf66f('0x3a')]=qs[_0xf66f('0x3b')](_0x2693a5[_0xf66f('0x32')]['sort']);_0x557324['where']=qs[_0xf66f('0x34')](_[_0xf66f('0x3c')](_0x2693a5['query'],_0x3d927e['filters']),_0x2e60fe);if(_0x2693a5[_0xf66f('0x32')][_0xf66f('0x3d')]){_0x557324[_0xf66f('0x3e')]=_[_0xf66f('0x3f')](_0x557324['where'],{'$or':_['map'](_0x2e60fe,function(_0x247707){if(_0x247707[_0xf66f('0x2f')]!==_0xf66f('0x40')){var _0x23b8dc={};_0x23b8dc[_0x247707[_0xf66f('0x29')]]={'$like':'%'+_0x2693a5['query']['filter']+'%'};return _0x23b8dc;}})});}_0x557324=_[_0xf66f('0x3f')]({},_0x557324,_0x2693a5[_0xf66f('0x41')]);var _0x561b3c={'where':_0x557324[_0xf66f('0x3e')]};return db[_0xf66f('0x2d')]['count'](_0x561b3c)[_0xf66f('0x25')](function(_0x28cce1){_0x4b2b43[_0xf66f('0x1e')]=_0x28cce1;if(_0x2693a5[_0xf66f('0x32')][_0xf66f('0x42')]){_0x557324[_0xf66f('0x43')]=[{'all':!![]}];}return db[_0xf66f('0x2d')]['findAll'](_0x557324);})[_0xf66f('0x25')](function(_0x599aa6){_0x4b2b43[_0xf66f('0x44')]=_0x599aa6;return _0x4b2b43;})[_0xf66f('0x25')](respondWithFilteredResult(_0xae6d0a,_0x557324))['catch'](handleError(_0xae6d0a,null));};exports[_0xf66f('0x45')]=function(_0x2946cc,_0x5f3247){var _0x10498e={'raw':![],'where':{'id':_0x2946cc['params']['id']}},_0x3df06c={};_0x3df06c[_0xf66f('0x31')]=_['keys'](db['FreshsalesAccount'][_0xf66f('0x2e')]);_0x3df06c['query']=_[_0xf66f('0x33')](_0x2946cc[_0xf66f('0x32')]);_0x3df06c[_0xf66f('0x34')]=_[_0xf66f('0x35')](_0x3df06c[_0xf66f('0x31')],_0x3df06c[_0xf66f('0x32')]);_0x10498e[_0xf66f('0x36')]=_[_0xf66f('0x35')](_0x3df06c['model'],qs[_0xf66f('0x37')](_0x2946cc[_0xf66f('0x32')][_0xf66f('0x37')]));_0x10498e['attributes']=_0x10498e['attributes'][_0xf66f('0x38')]?_0x10498e[_0xf66f('0x36')]:_0x3df06c[_0xf66f('0x31')];if(_0x2946cc[_0xf66f('0x32')][_0xf66f('0x42')]){_0x10498e['include']=[{'all':!![]}];}_0x10498e=_[_0xf66f('0x3f')]({},_0x10498e,_0x2946cc[_0xf66f('0x41')]);return db['FreshsalesAccount'][_0xf66f('0x46')](_0x10498e)['then'](handleEntityNotFound(_0x5f3247,null))['then'](respondWithResult(_0x5f3247,null))[_0xf66f('0x47')](handleError(_0x5f3247,null));};exports[_0xf66f('0x48')]=function(_0x1e5b5d,_0x2ba1ea){return db['FreshsalesAccount'][_0xf66f('0x48')](_0x1e5b5d[_0xf66f('0x49')],{})[_0xf66f('0x25')](respondWithResult(_0x2ba1ea,0xc9))[_0xf66f('0x47')](handleError(_0x2ba1ea,null));};exports[_0xf66f('0x24')]=function(_0x3e1dbb,_0x451020){if(_0x3e1dbb['body']['id']){delete _0x3e1dbb[_0xf66f('0x49')]['id'];}return db[_0xf66f('0x2d')][_0xf66f('0x46')]({'where':{'id':_0x3e1dbb['params']['id']}})[_0xf66f('0x25')](handleEntityNotFound(_0x451020,null))['then'](saveUpdates(_0x3e1dbb[_0xf66f('0x49')],null))[_0xf66f('0x25')](respondWithResult(_0x451020,null))['catch'](handleError(_0x451020,null));};exports['destroy']=function(_0x41fa0d,_0x4ed7e3){return db['FreshsalesAccount']['find']({'where':{'id':_0x41fa0d[_0xf66f('0x4a')]['id']}})[_0xf66f('0x25')](handleEntityNotFound(_0x4ed7e3,null))[_0xf66f('0x25')](removeEntity(_0x4ed7e3,null))[_0xf66f('0x47')](handleError(_0x4ed7e3,null));};exports['getConfigurations']=function(_0x45b6c4,_0x533ff6,_0x4b31d6){var _0x41f75b={};var _0x4bf011={};var _0x929a06;var _0x4b923b;return db[_0xf66f('0x2d')][_0xf66f('0x4b')]({'where':{'id':_0x45b6c4['params']['id']}})[_0xf66f('0x25')](handleEntityNotFound(_0x533ff6,null))[_0xf66f('0x25')](function(_0x888b2b){if(_0x888b2b){_0x929a06=_0x888b2b;_0x4bf011[_0xf66f('0x31')]=_[_0xf66f('0x33')](db[_0xf66f('0x4c')][_0xf66f('0x2e')]);_0x4bf011[_0xf66f('0x32')]=_[_0xf66f('0x33')](_0x45b6c4[_0xf66f('0x32')]);_0x4bf011['filters']=_[_0xf66f('0x35')](_0x4bf011['model'],_0x4bf011['query']);_0x41f75b[_0xf66f('0x36')]=_['intersection'](_0x4bf011[_0xf66f('0x31')],qs[_0xf66f('0x37')](_0x45b6c4['query']['fields']));_0x41f75b['attributes']=_0x41f75b[_0xf66f('0x36')]['length']?_0x41f75b[_0xf66f('0x36')]:_0x4bf011['model'];_0x41f75b['order']=qs[_0xf66f('0x3b')](_0x45b6c4[_0xf66f('0x32')][_0xf66f('0x3b')]);_0x41f75b[_0xf66f('0x3e')]=qs[_0xf66f('0x34')](_[_0xf66f('0x3c')](_0x45b6c4[_0xf66f('0x32')],_0x4bf011[_0xf66f('0x34')]));if(_0x45b6c4[_0xf66f('0x32')][_0xf66f('0x3d')]){_0x41f75b[_0xf66f('0x3e')]=_['merge'](_0x41f75b[_0xf66f('0x3e')],{'$or':_[_0xf66f('0x2c')](_0x41f75b[_0xf66f('0x36')],function(_0x323041){var _0x56185d={};_0x56185d[_0x323041]={'$like':'%'+_0x45b6c4[_0xf66f('0x32')][_0xf66f('0x3d')]+'%'};return _0x56185d;})});}_0x41f75b=_[_0xf66f('0x3f')]({},_0x41f75b,_0x45b6c4[_0xf66f('0x41')]);return _0x929a06[_0xf66f('0x4d')](_0x41f75b);}})[_0xf66f('0x25')](function(_0x447649){if(_0x447649){_0x4b923b=_0x447649['length'];if(!_0x45b6c4['query'][_0xf66f('0x39')](_0xf66f('0x4e'))){_0x41f75b[_0xf66f('0x1d')]=qs[_0xf66f('0x1d')](_0x45b6c4[_0xf66f('0x32')]['limit']);_0x41f75b['offset']=qs['offset'](_0x45b6c4[_0xf66f('0x32')][_0xf66f('0x1f')]);}return _0x929a06[_0xf66f('0x4d')](_0x41f75b);}})[_0xf66f('0x25')](function(_0x2cee86){if(_0x2cee86){return _0x2cee86?{'count':_0x4b923b,'rows':_0x2cee86}:null;}})[_0xf66f('0x25')](respondWithResult(_0x533ff6,null))[_0xf66f('0x47')](handleError(_0x533ff6,null));};exports[_0xf66f('0x4f')]=function(_0x2944c9,_0x5a0972,_0x815f6a){if(_0x2944c9['body']['id']){delete _0x2944c9['body']['id'];}return db[_0xf66f('0x2d')]['findOne']({'where':{'id':_0x2944c9[_0xf66f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a0972,null))[_0xf66f('0x25')](function(_0x4f6bda){if(_0x4f6bda){_0x2944c9[_0xf66f('0x49')][_0xf66f('0x50')]=_0x4f6bda['id'];_0x2944c9[_0xf66f('0x49')][_0xf66f('0x51')]=integrations[_0xf66f('0x52')](_0x2944c9[_0xf66f('0x49')][_0xf66f('0x53')],_0x2944c9[_0xf66f('0x49')]['type']);_0x2944c9[_0xf66f('0x49')][_0xf66f('0x54')]=integrations[_0xf66f('0x55')](_0x2944c9['body'][_0xf66f('0x53')],_0x2944c9[_0xf66f('0x49')][_0xf66f('0x2f')]);return db[_0xf66f('0x4c')][_0xf66f('0x48')](_0x2944c9['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0xf66f('0x56')],'as':_0xf66f('0x54')}]});}return null;})[_0xf66f('0x25')](respondWithResult(_0x5a0972,null))[_0xf66f('0x47')](handleError(_0x5a0972,null));};exports[_0xf66f('0x57')]=function(_0x497b88,_0x4f7577,_0x4faf40){var _0xd6f1c8='';var _0x26473e='';return db[_0xf66f('0x2d')][_0xf66f('0x4b')]({'where':{'id':_0x497b88[_0xf66f('0x4a')]['id']},'attributes':['id','username',_0xf66f('0x58'),_0xf66f('0x59')]})[_0xf66f('0x25')](handleEntityNotFound(_0x4f7577,null))[_0xf66f('0x25')](function(_0x13e451){if(_0x13e451){_0x26473e=_0x13e451['username'];_0xd6f1c8=_0x13e451[_0xf66f('0x58')];var _0x328476=_0x13e451[_0xf66f('0x58')][_0xf66f('0x5a')](-0x1);if(_0x328476==='/'){_0xd6f1c8=_0xd6f1c8[_0xf66f('0x5b')](0x0,_0xd6f1c8[_0xf66f('0x5c')](_0x328476));}return rp({'method':_0xf66f('0x5d'),'uri':util[_0xf66f('0x5e')]('%s%s',_0xd6f1c8,'/api/selector/owners'),'headers':{'Authorization':_0xf66f('0x5f')+_0x13e451['apiKey']},'json':!![]});}})[_0xf66f('0x25')](function(_0xd900cc){if(_0xd900cc){var _0xb6c3cc=_0xd900cc[_0xf66f('0x60')];var _0x3a1d3d=![];var _0x2d00b4=null;for(_0x2d00b4=0x0;_0x2d00b4<_0xb6c3cc[_0xf66f('0x38')];_0x2d00b4++){if(_0xb6c3cc[_0x2d00b4][_0xf66f('0x61')]===_0x26473e){_0x3a1d3d=!![];}}if(_0x3a1d3d){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xf66f('0x25')](respondWithResult(_0x4f7577,null))[_0xf66f('0x47')](function(_0x43183b){var _0x4f94aa=_0x497b88[_0xf66f('0x32')][_0xf66f('0x62')]?0x1f4:_0x43183b[_0xf66f('0x63')]||0x1f4;logger[_0xf66f('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xf66f('0x57'),_0x4f94aa,JSON[_0xf66f('0x64')](_0x43183b));delete _0x43183b[_0xf66f('0x29')];if(_0x4f94aa===0x191){_0x4f94aa=0x190;}_0x4f7577['status'](_0x4f94aa)[_0xf66f('0x2a')](_0x497b88[_0xf66f('0x32')][_0xf66f('0x62')]?{'message':_0xf66f('0x65'),'statusCode':_0x43183b['statusCode']}:_0x43183b);});}; \ No newline at end of file +var _0x4634=['params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','Subjects','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','format','%s%s','Token\x20token=','email','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','keys','length','include','find','create','body'];(function(_0x209340,_0x176d93){var _0x536d22=function(_0x6a2419){while(--_0x6a2419){_0x209340['push'](_0x209340['shift']());}};_0x536d22(++_0x176d93);}(_0x4634,0x81));var _0x4463=function(_0x209bfe,_0x219447){_0x209bfe=_0x209bfe-0x0;var _0x4b34fb=_0x4634[_0x209bfe];return _0x4b34fb;};'use strict';var emlformat=require(_0x4463('0x0'));var rimraf=require(_0x4463('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4463('0x2'));var rp=require(_0x4463('0x3'));var moment=require('moment');var BPromise=require(_0x4463('0x4'));var Mustache=require(_0x4463('0x5'));var util=require(_0x4463('0x6'));var path=require('path');var sox=require(_0x4463('0x7'));var csv=require(_0x4463('0x8'));var ejs=require(_0x4463('0x9'));var fs=require('fs');var fs_extra=require(_0x4463('0xa'));var _=require(_0x4463('0xb'));var squel=require(_0x4463('0xc'));var crypto=require(_0x4463('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4463('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4463('0xf'));var Papa=require(_0x4463('0x10'));var Redis=require(_0x4463('0x11'));var authService=require(_0x4463('0x12'));var qs=require(_0x4463('0x13'));var as=require(_0x4463('0x14'));var hardwareService=require(_0x4463('0x15'));var logger=require('../../config/logger')(_0x4463('0x16'));var utils=require(_0x4463('0x17'));var config=require(_0x4463('0x18'));var licenseUtil=require(_0x4463('0x19'));var db=require(_0x4463('0x1a'))['db'];var integrations=require(_0x4463('0x1b'));function respondWithStatusCode(_0x569370,_0x526bfc){_0x526bfc=_0x526bfc||0xcc;return function(_0x5957d){if(_0x5957d){return _0x569370['sendStatus'](_0x526bfc);}return _0x569370['status'](_0x526bfc)['end']();};}function respondWithResult(_0x26b97f,_0x1cac76){_0x1cac76=_0x1cac76||0xc8;return function(_0x454563){if(_0x454563){return _0x26b97f['status'](_0x1cac76)[_0x4463('0x1c')](_0x454563);}};}function respondWithFilteredResult(_0x3e2360,_0x148066){return function(_0xd7cf22){if(_0xd7cf22){var _0x3fde0a=typeof _0x148066[_0x4463('0x1d')]===_0x4463('0x1e')&&typeof _0x148066[_0x4463('0x1f')]===_0x4463('0x1e');var _0x42e104=_0xd7cf22[_0x4463('0x20')];var _0x3dc4f5=_0x3fde0a?0x0:_0x148066[_0x4463('0x1d')];var _0x4e030d=_0x3fde0a?_0xd7cf22['count']:_0x148066[_0x4463('0x1d')]+_0x148066['limit'];var _0xa8b17b;if(_0x4e030d>=_0x42e104){_0x4e030d=_0x42e104;_0xa8b17b=0xc8;}else{_0xa8b17b=0xce;}_0x3e2360[_0x4463('0x21')](_0xa8b17b);return _0x3e2360[_0x4463('0x22')]('Content-Range',_0x3dc4f5+'-'+_0x4e030d+'/'+_0x42e104)[_0x4463('0x1c')](_0xd7cf22);}return null;};}function patchUpdates(_0x3127cb){return function(_0x5ee024){try{jsonpatch[_0x4463('0x23')](_0x5ee024,_0x3127cb,!![]);}catch(_0x44c2a5){return BPromise['reject'](_0x44c2a5);}return _0x5ee024[_0x4463('0x24')]();};}function saveUpdates(_0x233878,_0x555130){return function(_0x1ac7a0){if(_0x1ac7a0){return _0x1ac7a0[_0x4463('0x25')](_0x233878)[_0x4463('0x26')](function(_0x3edc9c){return _0x3edc9c;});}return null;};}function removeEntity(_0x35041d,_0x4b521b){return function(_0xbc6db6){if(_0xbc6db6){return _0xbc6db6[_0x4463('0x27')]()[_0x4463('0x26')](function(){_0x35041d[_0x4463('0x21')](0xcc)[_0x4463('0x28')]();});}};}function handleEntityNotFound(_0x37a5bf,_0x117d9a){return function(_0x11dcf2){if(!_0x11dcf2){_0x37a5bf[_0x4463('0x29')](0x194);}return _0x11dcf2;};}function handleError(_0x52625b,_0x5c2b31){_0x5c2b31=_0x5c2b31||0x1f4;return function(_0x46170d){logger[_0x4463('0x2a')](_0x46170d[_0x4463('0x2b')]);if(_0x46170d[_0x4463('0x2c')]){delete _0x46170d[_0x4463('0x2c')];}_0x52625b[_0x4463('0x21')](_0x5c2b31)['send'](_0x46170d);};}exports[_0x4463('0x2d')]=function(_0x3e8ea8,_0x354c40){var _0x1cffb4={},_0x1a00e5={},_0x19133e={'count':0x0,'rows':[]};var _0x403f0b=_[_0x4463('0x2e')](db[_0x4463('0x2f')][_0x4463('0x30')],function(_0x542589){return{'name':_0x542589[_0x4463('0x31')],'type':_0x542589[_0x4463('0x32')][_0x4463('0x33')]};});_0x1a00e5[_0x4463('0x34')]=_[_0x4463('0x2e')](_0x403f0b,'name');_0x1a00e5['query']=_['keys'](_0x3e8ea8[_0x4463('0x35')]);_0x1a00e5[_0x4463('0x36')]=_[_0x4463('0x37')](_0x1a00e5[_0x4463('0x34')],_0x1a00e5[_0x4463('0x35')]);_0x1cffb4[_0x4463('0x38')]=_[_0x4463('0x37')](_0x1a00e5[_0x4463('0x34')],qs[_0x4463('0x39')](_0x3e8ea8[_0x4463('0x35')][_0x4463('0x39')]));_0x1cffb4[_0x4463('0x38')]=_0x1cffb4['attributes']['length']?_0x1cffb4[_0x4463('0x38')]:_0x1a00e5[_0x4463('0x34')];if(!_0x3e8ea8['query'][_0x4463('0x3a')]('nolimit')){_0x1cffb4['limit']=qs[_0x4463('0x1f')](_0x3e8ea8[_0x4463('0x35')]['limit']);_0x1cffb4[_0x4463('0x1d')]=qs['offset'](_0x3e8ea8['query'][_0x4463('0x1d')]);}_0x1cffb4[_0x4463('0x3b')]=qs[_0x4463('0x3c')](_0x3e8ea8[_0x4463('0x35')]['sort']);_0x1cffb4[_0x4463('0x3d')]=qs[_0x4463('0x36')](_[_0x4463('0x3e')](_0x3e8ea8['query'],_0x1a00e5['filters']),_0x403f0b);if(_0x3e8ea8[_0x4463('0x35')][_0x4463('0x3f')]){_0x1cffb4[_0x4463('0x3d')]=_[_0x4463('0x40')](_0x1cffb4['where'],{'$or':_[_0x4463('0x2e')](_0x403f0b,function(_0x19c807){if(_0x19c807[_0x4463('0x32')]!==_0x4463('0x41')){var _0x4a7329={};_0x4a7329[_0x19c807[_0x4463('0x2c')]]={'$like':'%'+_0x3e8ea8[_0x4463('0x35')][_0x4463('0x3f')]+'%'};return _0x4a7329;}})});}_0x1cffb4=_[_0x4463('0x40')]({},_0x1cffb4,_0x3e8ea8[_0x4463('0x42')]);var _0x4a7e21={'where':_0x1cffb4[_0x4463('0x3d')]};return db[_0x4463('0x2f')][_0x4463('0x20')](_0x4a7e21)[_0x4463('0x26')](function(_0x175792){_0x19133e['count']=_0x175792;if(_0x3e8ea8[_0x4463('0x35')]['includeAll']){_0x1cffb4['include']=[{'all':!![]}];}return db[_0x4463('0x2f')]['findAll'](_0x1cffb4);})[_0x4463('0x26')](function(_0x2026dc){_0x19133e['rows']=_0x2026dc;return _0x19133e;})[_0x4463('0x26')](respondWithFilteredResult(_0x354c40,_0x1cffb4))[_0x4463('0x43')](handleError(_0x354c40,null));};exports[_0x4463('0x44')]=function(_0x20f184,_0x4c0aa0){var _0x132e18={'raw':![],'where':{'id':_0x20f184['params']['id']}},_0x5d178f={};_0x5d178f['model']=_[_0x4463('0x45')](db[_0x4463('0x2f')][_0x4463('0x30')]);_0x5d178f['query']=_[_0x4463('0x45')](_0x20f184[_0x4463('0x35')]);_0x5d178f[_0x4463('0x36')]=_['intersection'](_0x5d178f[_0x4463('0x34')],_0x5d178f[_0x4463('0x35')]);_0x132e18['attributes']=_[_0x4463('0x37')](_0x5d178f[_0x4463('0x34')],qs[_0x4463('0x39')](_0x20f184[_0x4463('0x35')][_0x4463('0x39')]));_0x132e18['attributes']=_0x132e18['attributes'][_0x4463('0x46')]?_0x132e18[_0x4463('0x38')]:_0x5d178f[_0x4463('0x34')];if(_0x20f184['query']['includeAll']){_0x132e18[_0x4463('0x47')]=[{'all':!![]}];}_0x132e18=_[_0x4463('0x40')]({},_0x132e18,_0x20f184[_0x4463('0x42')]);return db[_0x4463('0x2f')][_0x4463('0x48')](_0x132e18)[_0x4463('0x26')](handleEntityNotFound(_0x4c0aa0,null))['then'](respondWithResult(_0x4c0aa0,null))[_0x4463('0x43')](handleError(_0x4c0aa0,null));};exports[_0x4463('0x49')]=function(_0x605343,_0x58ab59){return db['FreshsalesAccount'][_0x4463('0x49')](_0x605343['body'],{})['then'](respondWithResult(_0x58ab59,0xc9))['catch'](handleError(_0x58ab59,null));};exports[_0x4463('0x25')]=function(_0x18c78b,_0x99333c){if(_0x18c78b[_0x4463('0x4a')]['id']){delete _0x18c78b['body']['id'];}return db[_0x4463('0x2f')]['find']({'where':{'id':_0x18c78b[_0x4463('0x4b')]['id']}})[_0x4463('0x26')](handleEntityNotFound(_0x99333c,null))[_0x4463('0x26')](saveUpdates(_0x18c78b[_0x4463('0x4a')],null))['then'](respondWithResult(_0x99333c,null))[_0x4463('0x43')](handleError(_0x99333c,null));};exports['destroy']=function(_0x39a705,_0x6cdee6){return db[_0x4463('0x2f')][_0x4463('0x48')]({'where':{'id':_0x39a705[_0x4463('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6cdee6,null))[_0x4463('0x26')](removeEntity(_0x6cdee6,null))[_0x4463('0x43')](handleError(_0x6cdee6,null));};exports[_0x4463('0x4c')]=function(_0x3f8ebd,_0x45c719,_0x22bbc2){var _0x328d9b={};var _0x3a2f46={};var _0x3bf5ef;var _0x55c158;return db['FreshsalesAccount'][_0x4463('0x4d')]({'where':{'id':_0x3f8ebd[_0x4463('0x4b')]['id']}})[_0x4463('0x26')](handleEntityNotFound(_0x45c719,null))[_0x4463('0x26')](function(_0x2db01a){if(_0x2db01a){_0x3bf5ef=_0x2db01a;_0x3a2f46[_0x4463('0x34')]=_[_0x4463('0x45')](db[_0x4463('0x4e')][_0x4463('0x30')]);_0x3a2f46[_0x4463('0x35')]=_['keys'](_0x3f8ebd[_0x4463('0x35')]);_0x3a2f46['filters']=_[_0x4463('0x37')](_0x3a2f46[_0x4463('0x34')],_0x3a2f46[_0x4463('0x35')]);_0x328d9b[_0x4463('0x38')]=_[_0x4463('0x37')](_0x3a2f46[_0x4463('0x34')],qs[_0x4463('0x39')](_0x3f8ebd[_0x4463('0x35')][_0x4463('0x39')]));_0x328d9b['attributes']=_0x328d9b[_0x4463('0x38')][_0x4463('0x46')]?_0x328d9b[_0x4463('0x38')]:_0x3a2f46[_0x4463('0x34')];_0x328d9b['order']=qs[_0x4463('0x3c')](_0x3f8ebd[_0x4463('0x35')][_0x4463('0x3c')]);_0x328d9b[_0x4463('0x3d')]=qs['filters'](_[_0x4463('0x3e')](_0x3f8ebd['query'],_0x3a2f46[_0x4463('0x36')]));if(_0x3f8ebd[_0x4463('0x35')][_0x4463('0x3f')]){_0x328d9b[_0x4463('0x3d')]=_['merge'](_0x328d9b[_0x4463('0x3d')],{'$or':_['map'](_0x328d9b[_0x4463('0x38')],function(_0x5d0d8d){var _0x274b24={};_0x274b24[_0x5d0d8d]={'$like':'%'+_0x3f8ebd['query'][_0x4463('0x3f')]+'%'};return _0x274b24;})});}_0x328d9b=_['merge']({},_0x328d9b,_0x3f8ebd[_0x4463('0x42')]);return _0x3bf5ef[_0x4463('0x4c')](_0x328d9b);}})[_0x4463('0x26')](function(_0x45e07e){if(_0x45e07e){_0x55c158=_0x45e07e[_0x4463('0x46')];if(!_0x3f8ebd[_0x4463('0x35')][_0x4463('0x3a')]('nolimit')){_0x328d9b[_0x4463('0x1f')]=qs['limit'](_0x3f8ebd[_0x4463('0x35')][_0x4463('0x1f')]);_0x328d9b[_0x4463('0x1d')]=qs[_0x4463('0x1d')](_0x3f8ebd[_0x4463('0x35')][_0x4463('0x1d')]);}return _0x3bf5ef[_0x4463('0x4c')](_0x328d9b);}})[_0x4463('0x26')](function(_0x3971b5){if(_0x3971b5){return _0x3971b5?{'count':_0x55c158,'rows':_0x3971b5}:null;}})[_0x4463('0x26')](respondWithResult(_0x45c719,null))[_0x4463('0x43')](handleError(_0x45c719,null));};exports[_0x4463('0x4f')]=function(_0x27e16a,_0x48bfa6,_0x504009){if(_0x27e16a[_0x4463('0x4a')]['id']){delete _0x27e16a['body']['id'];}return db['FreshsalesAccount'][_0x4463('0x4d')]({'where':{'id':_0x27e16a[_0x4463('0x4b')]['id']}})[_0x4463('0x26')](handleEntityNotFound(_0x48bfa6,null))[_0x4463('0x26')](function(_0x153aaf){if(_0x153aaf){_0x27e16a[_0x4463('0x4a')][_0x4463('0x50')]=_0x153aaf['id'];_0x27e16a[_0x4463('0x4a')]['Subjects']=integrations[_0x4463('0x51')](_0x27e16a['body']['channel'],_0x27e16a[_0x4463('0x4a')][_0x4463('0x32')]);_0x27e16a['body'][_0x4463('0x52')]=integrations['getDescriptions'](_0x27e16a['body']['channel'],_0x27e16a[_0x4463('0x4a')][_0x4463('0x32')]);return db['FreshsalesConfiguration'][_0x4463('0x49')](_0x27e16a[_0x4463('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':_0x4463('0x53')},{'model':db[_0x4463('0x54')],'as':_0x4463('0x52')}]});}return null;})[_0x4463('0x26')](respondWithResult(_0x48bfa6,null))[_0x4463('0x43')](handleError(_0x48bfa6,null));};exports[_0x4463('0x55')]=function(_0x3814ed,_0x1f8189,_0x25af4){var _0x11c3cf='';var _0x1bb49c='';return db[_0x4463('0x2f')]['findOne']({'where':{'id':_0x3814ed[_0x4463('0x4b')]['id']},'attributes':['id','username',_0x4463('0x56'),_0x4463('0x57')]})[_0x4463('0x26')](handleEntityNotFound(_0x1f8189,null))[_0x4463('0x26')](function(_0x28eb4f){if(_0x28eb4f){_0x1bb49c=_0x28eb4f[_0x4463('0x58')];_0x11c3cf=_0x28eb4f[_0x4463('0x56')];var _0x2d4bdd=_0x28eb4f[_0x4463('0x56')][_0x4463('0x59')](-0x1);if(_0x2d4bdd==='/'){_0x11c3cf=_0x11c3cf[_0x4463('0x5a')](0x0,_0x11c3cf[_0x4463('0x5b')](_0x2d4bdd));}return rp({'method':'GET','uri':util[_0x4463('0x5c')](_0x4463('0x5d'),_0x11c3cf,'/api/selector/owners'),'headers':{'Authorization':_0x4463('0x5e')+_0x28eb4f[_0x4463('0x57')]},'json':!![]});}})[_0x4463('0x26')](function(_0x4e3c5f){if(_0x4e3c5f){var _0x2c0327=_0x4e3c5f['users'];var _0x4eeb24=![];var _0x341c03=null;for(_0x341c03=0x0;_0x341c03<_0x2c0327['length'];_0x341c03++){if(_0x2c0327[_0x341c03][_0x4463('0x5f')]===_0x1bb49c){_0x4eeb24=!![];}}if(_0x4eeb24){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x1f8189,null))[_0x4463('0x43')](function(_0x523e3e){var _0x573355=_0x3814ed['query'][_0x4463('0x60')]?0x1f4:_0x523e3e['statusCode']||0x1f4;logger['error'](_0x4463('0x61'),_0x4463('0x55'),_0x573355,JSON[_0x4463('0x62')](_0x523e3e));delete _0x523e3e[_0x4463('0x2c')];if(_0x573355===0x191){_0x573355=0x190;}_0x1f8189[_0x4463('0x21')](_0x573355)[_0x4463('0x63')](_0x3814ed[_0x4463('0x35')][_0x4463('0x60')]?{'message':_0x4463('0x64'),'statusCode':_0x523e3e[_0x4463('0x65')]}:_0x523e3e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 766539e..a38e867 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 _0x11e5=['path','../../config/environment','exports','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x11e5,0x8b));var _0x511e=function(_0x2cec83,_0x1a9274){_0x2cec83=_0x2cec83-0x0;var _0x710a3b=_0x11e5[_0x2cec83];return _0x710a3b;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x511e('0x7')]=function(_0x323f8c,_0x466dec){return _0x323f8c['define']('FreshsalesAccount',attributes,{'tableName':_0x511e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd117=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x2b85d9,_0xf7e087){var _0x5af443=function(_0x55274a){while(--_0x55274a){_0x2b85d9['push'](_0x2b85d9['shift']());}};_0x5af443(++_0xf7e087);}(_0xd117,0x182));var _0x7d11=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xd117[_0x5951e8];return _0x20a1f5;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));var integrations=require(_0x7d11('0xb'));module[_0x7d11('0xc')]=function(_0x40c3c4,_0x345602){return _0x40c3c4[_0x7d11('0xd')]('FreshsalesAccount',attributes,{'tableName':_0x7d11('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 676df20..eeba149 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 _0xed1c=['model','ShowFreshsalesAccount','find','debug','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','include','map'];(function(_0x57874a,_0x14a2aa){var _0x1d0444=function(_0xa49347){while(--_0xa49347){_0x57874a['push'](_0x57874a['shift']());}};_0x1d0444(++_0x14a2aa);}(_0xed1c,0xe4));var _0xced1=function(_0x43d614,_0x2f896f){_0x43d614=_0x43d614-0x0;var _0x1c5ac4=_0xed1c[_0x43d614];return _0x1c5ac4;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});}exports[_0xced1('0x14')]=function(_0x5a563a){var _0x56fc50=this;return new Promise(function(_0x2a92c8,_0x111fb0){return db[_0xced1('0x15')]['findAll']({'raw':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')][_0xced1('0x17')]===undefined?!![]:![]:!![],'where':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x5a563a[_0xced1('0x16')]?_0x5a563a['options'][_0xced1('0x19')]||null:null,'limit':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')]['limit']||null:null,'include':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')],function(_0x49c8b9){return{'model':db[_0x49c8b9[_0xced1('0x1c')]],'as':_0x49c8b9['as'],'attributes':_0x49c8b9[_0xced1('0x19')],'include':_0x49c8b9['include']?_['map'](_0x49c8b9[_0xced1('0x1a')],function(_0x258c9a){return{'model':db[_0x258c9a[_0xced1('0x1c')]],'as':_0x258c9a['as'],'attributes':_0x258c9a[_0xced1('0x19')],'include':_0x258c9a[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x258c9a['include'],function(_0x181f6e){return{'model':db[_0x181f6e[_0xced1('0x1c')]],'as':_0x181f6e['as'],'attributes':_0x181f6e[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x34dd2e){logger[_0xced1('0xb')](_0xced1('0x14'),_0x5a563a);logger['debug'](_0xced1('0x14'),_0x5a563a,JSON['stringify'](_0x34dd2e));_0x2a92c8(_0x34dd2e);})[_0xced1('0x13')](function(_0x2c2269){logger[_0xced1('0xf')](_0xced1('0x14'),_0x2c2269['message'],_0x5a563a);_0x111fb0(_0x56fc50['error'](0x1f4,_0x2c2269[_0xced1('0x11')]));});});};exports[_0xced1('0x1d')]=function(_0x2bc785){var _0x4ea07e=this;return new Promise(function(_0x573146,_0x543c47){return db[_0xced1('0x15')][_0xced1('0x1e')]({'raw':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x19')]||null:null,'include':_0x2bc785[_0xced1('0x16')]?_0x2bc785['options']['include']?_[_0xced1('0x1b')](_0x2bc785[_0xced1('0x16')][_0xced1('0x1a')],function(_0x7ebeb3){return{'model':db[_0x7ebeb3[_0xced1('0x1c')]],'as':_0x7ebeb3['as'],'attributes':_0x7ebeb3[_0xced1('0x19')],'include':_0x7ebeb3['include']?_['map'](_0x7ebeb3['include'],function(_0x4d305c){return{'model':db[_0x4d305c[_0xced1('0x1c')]],'as':_0x4d305c['as'],'attributes':_0x4d305c[_0xced1('0x19')],'include':_0x4d305c[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x4d305c[_0xced1('0x1a')],function(_0x1c36fa){return{'model':db[_0x1c36fa[_0xced1('0x1c')]],'as':_0x1c36fa['as'],'attributes':_0x1c36fa[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x3dfd2f){logger[_0xced1('0xb')](_0xced1('0x1d'),_0x2bc785);logger[_0xced1('0x1f')]('ShowFreshsalesAccount',_0x2bc785,JSON[_0xced1('0xe')](_0x3dfd2f));_0x573146(_0x3dfd2f);})[_0xced1('0x13')](function(_0x1116de){logger[_0xced1('0xf')](_0xced1('0x1d'),_0x1116de[_0xced1('0x11')],_0x2bc785);_0x543c47(_0x4ea07e['error'](0x1f4,_0x1116de[_0xced1('0x11')]));});});}; \ No newline at end of file +var _0xd046=['ioredis','../../config/logger','../../config/environment','http','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','find','ShowFreshsalesAccount','util','moment','bluebird'];(function(_0x309502,_0x2d3c2e){var _0x164796=function(_0x426e73){while(--_0x426e73){_0x309502['push'](_0x309502['shift']());}};_0x164796(++_0x2d3c2e);}(_0xd046,0x129));var _0x6d04=function(_0x282f05,_0x1705da){_0x282f05=_0x282f05-0x0;var _0x5cad71=_0xd046[_0x282f05];return _0x5cad71;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});}exports[_0x6d04('0xf')]=function(_0x2bc798){var _0x3ad325=this;return new Promise(function(_0x4e93b5,_0x3657a1){return db[_0x6d04('0x10')][_0x6d04('0x11')]({'raw':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'where':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x15')]||null:null,'limit':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options'][_0x6d04('0x16')]||null:null,'include':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options']['include']?_[_0x6d04('0x17')](_0x2bc798[_0x6d04('0x12')][_0x6d04('0x18')],function(_0xe8f198){return{'model':db[_0xe8f198[_0x6d04('0x19')]],'as':_0xe8f198['as'],'attributes':_0xe8f198[_0x6d04('0x15')],'include':_0xe8f198[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0xe8f198[_0x6d04('0x18')],function(_0x38e90f){return{'model':db[_0x38e90f[_0x6d04('0x19')]],'as':_0x38e90f['as'],'attributes':_0x38e90f[_0x6d04('0x15')],'include':_0x38e90f[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0x38e90f['include'],function(_0x1dc29b){return{'model':db[_0x1dc29b[_0x6d04('0x19')]],'as':_0x1dc29b['as'],'attributes':_0x1dc29b[_0x6d04('0x15')]};}):[]};}):[]};}):[]:[]})[_0x6d04('0x1a')](function(_0x4256a3){logger[_0x6d04('0xc')]('GetFreshsalesAccount',_0x2bc798);logger[_0x6d04('0x1b')](_0x6d04('0xf'),_0x2bc798,JSON[_0x6d04('0x9')](_0x4256a3));_0x4e93b5(_0x4256a3);})[_0x6d04('0xe')](function(_0x2ed2bb){logger['error']('GetFreshsalesAccount',_0x2ed2bb['message'],_0x2bc798);_0x3657a1(_0x3ad325['error'](0x1f4,_0x2ed2bb[_0x6d04('0xb')]));});});};exports['ShowFreshsalesAccount']=function(_0x43eb48){var _0x4ed123=this;return new Promise(function(_0x26be38,_0xee1291){return db[_0x6d04('0x10')][_0x6d04('0x1c')]({'raw':_0x43eb48[_0x6d04('0x12')]?_0x43eb48[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'where':_0x43eb48[_0x6d04('0x12')]?_0x43eb48[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x43eb48['options']?_0x43eb48['options'][_0x6d04('0x15')]||null:null,'include':_0x43eb48[_0x6d04('0x12')]?_0x43eb48[_0x6d04('0x12')][_0x6d04('0x18')]?_['map'](_0x43eb48[_0x6d04('0x12')][_0x6d04('0x18')],function(_0x40758d){return{'model':db[_0x40758d[_0x6d04('0x19')]],'as':_0x40758d['as'],'attributes':_0x40758d['attributes'],'include':_0x40758d[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0x40758d[_0x6d04('0x18')],function(_0x184da2){return{'model':db[_0x184da2[_0x6d04('0x19')]],'as':_0x184da2['as'],'attributes':_0x184da2[_0x6d04('0x15')],'include':_0x184da2[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0x184da2[_0x6d04('0x18')],function(_0x67e455){return{'model':db[_0x67e455[_0x6d04('0x19')]],'as':_0x67e455['as'],'attributes':_0x67e455[_0x6d04('0x15')]};}):[]};}):[]};}):[]:[]})[_0x6d04('0x1a')](function(_0x2c2203){logger[_0x6d04('0xc')]('ShowFreshsalesAccount',_0x43eb48);logger[_0x6d04('0x1b')]('ShowFreshsalesAccount',_0x43eb48,JSON[_0x6d04('0x9')](_0x2c2203));_0x26be38(_0x2c2203);})[_0x6d04('0xe')](function(_0x4c1908){logger[_0x6d04('0xa')](_0x6d04('0x1d'),_0x4c1908[_0x6d04('0xb')],_0x43eb48);_0xee1291(_0x4ed123[_0x6d04('0xa')](0x1f4,_0x4c1908[_0x6d04('0xb')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5029cad..32fd743 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 _0x9566=['../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x9566,0x10b));var _0x6956=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9566[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x6956('0x0'));var util=require(_0x6956('0x1'));var path=require(_0x6956('0x2'));var timeout=require(_0x6956('0x3'));var express=require(_0x6956('0x4'));var router=express[_0x6956('0x5')]();var fs_extra=require(_0x6956('0x6'));var auth=require(_0x6956('0x7'));var interaction=require(_0x6956('0x8'));var config=require(_0x6956('0x9'));var controller=require(_0x6956('0xa'));router[_0x6956('0xb')]('/',auth[_0x6956('0xc')](),controller['index']);router[_0x6956('0xb')](_0x6956('0xd'),auth[_0x6956('0xc')](),controller[_0x6956('0xe')]);router[_0x6956('0xb')](_0x6956('0xf'),auth[_0x6956('0xc')](),controller['getSubjects']);router['get'](_0x6956('0x10'),auth[_0x6956('0xc')](),controller['getDescriptions']);router[_0x6956('0xb')]('/:id/fields',auth[_0x6956('0xc')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x6956('0x11')]);router[_0x6956('0x12')](_0x6956('0xd'),auth[_0x6956('0xc')](),controller[_0x6956('0x13')]);router[_0x6956('0x14')](_0x6956('0xd'),auth[_0x6956('0xc')](),controller[_0x6956('0x15')]);module[_0x6956('0x16')]=router; \ No newline at end of file +var _0x9699=['isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','index','get'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x9699,0x1da));var _0x9969=function(_0x13abf2,_0x4838dd){_0x13abf2=_0x13abf2-0x0;var _0x4776ce=_0x9699[_0x13abf2];return _0x4776ce;};'use strict';var multer=require(_0x9969('0x0'));var util=require(_0x9969('0x1'));var path=require('path');var timeout=require(_0x9969('0x2'));var express=require(_0x9969('0x3'));var router=express['Router']();var fs_extra=require(_0x9969('0x4'));var auth=require(_0x9969('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9969('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9969('0x7')]);router[_0x9969('0x8')]('/:id',auth[_0x9969('0x9')](),controller[_0x9969('0xa')]);router['get'](_0x9969('0xb'),auth[_0x9969('0x9')](),controller[_0x9969('0xc')]);router[_0x9969('0x8')]('/:id/descriptions',auth[_0x9969('0x9')](),controller[_0x9969('0xd')]);router['get']('/:id/fields',auth[_0x9969('0x9')](),controller[_0x9969('0xe')]);router[_0x9969('0xf')]('/',auth[_0x9969('0x9')](),controller[_0x9969('0x10')]);router[_0x9969('0x11')](_0x9969('0x12'),auth['isAuthenticated'](),controller[_0x9969('0x13')]);router[_0x9969('0x14')]('/:id',auth[_0x9969('0x9')](),controller[_0x9969('0x15')]);module[_0x9969('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 11b3d0e..2491ccb 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 _0x54d4=['STRING','sequelize','exports'];(function(_0x30cd8a,_0x337aa2){var _0x757617=function(_0xd3a004){while(--_0xd3a004){_0x30cd8a['push'](_0x30cd8a['shift']());}};_0x757617(++_0x337aa2);}(_0x54d4,0xcd));var _0x454d=function(_0xb10a00,_0x5686ec){_0xb10a00=_0xb10a00-0x0;var _0x1112d7=_0x54d4[_0xb10a00];return _0x1112d7;};'use strict';var Sequelize=require(_0x454d('0x0'));module[_0x454d('0x1')]={'name':{'type':Sequelize[_0x454d('0x2')]},'description':{'type':Sequelize[_0x454d('0x2')]}}; \ No newline at end of file +var _0x18e1=['STRING','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x18e1,0x8e));var _0x118e=function(_0x4b8d4f,_0x36e5f6){_0x4b8d4f=_0x4b8d4f-0x0;var _0x59979e=_0x18e1[_0x4b8d4f];return _0x59979e;};'use strict';var Sequelize=require(_0x118e('0x0'));module[_0x118e('0x1')]={'name':{'type':Sequelize[_0x118e('0x2')]},'description':{'type':Sequelize[_0x118e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index df9d381..88fb718 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 _0xc4c7=['rimraf','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getSubjects','pick','getDescriptions','findOne','getFields','FreshsalesField','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4c7,0x1df));var _0x7c4c=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0xc4c7[_0x264d4d];return _0xc917e2;};'use strict';var emlformat=require(_0x7c4c('0x0'));var rimraf=require(_0x7c4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c4c('0x2'));var rp=require(_0x7c4c('0x3'));var moment=require(_0x7c4c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7c4c('0x5'));var sox=require('sox');var csv=require(_0x7c4c('0x6'));var ejs=require(_0x7c4c('0x7'));var fs=require('fs');var fs_extra=require(_0x7c4c('0x8'));var _=require(_0x7c4c('0x9'));var squel=require('squel');var crypto=require(_0x7c4c('0xa'));var jsforce=require(_0x7c4c('0xb'));var deskjs=require(_0x7c4c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7c4c('0xd'));var Redis=require(_0x7c4c('0xe'));var authService=require(_0x7c4c('0xf'));var qs=require(_0x7c4c('0x10'));var as=require(_0x7c4c('0x11'));var hardwareService=require(_0x7c4c('0x12'));var logger=require('../../config/logger')(_0x7c4c('0x13'));var utils=require(_0x7c4c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7c4c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1829d4,_0x41b3a2){_0x41b3a2=_0x41b3a2||0xcc;return function(_0x5b43e5){if(_0x5b43e5){return _0x1829d4[_0x7c4c('0x16')](_0x41b3a2);}return _0x1829d4['status'](_0x41b3a2)[_0x7c4c('0x17')]();};}function respondWithResult(_0x2dea50,_0x466f9d){_0x466f9d=_0x466f9d||0xc8;return function(_0x5116bd){if(_0x5116bd){return _0x2dea50[_0x7c4c('0x18')](_0x466f9d)[_0x7c4c('0x19')](_0x5116bd);}};}function respondWithFilteredResult(_0x122ba8,_0x206287){return function(_0x4a90ec){if(_0x4a90ec){var _0x1f1c3f=typeof _0x206287[_0x7c4c('0x1a')]==='undefined'&&typeof _0x206287[_0x7c4c('0x1b')]==='undefined';var _0x20ecee=_0x4a90ec['count'];var _0x5310ae=_0x1f1c3f?0x0:_0x206287[_0x7c4c('0x1a')];var _0x172451=_0x1f1c3f?_0x4a90ec[_0x7c4c('0x1c')]:_0x206287[_0x7c4c('0x1a')]+_0x206287[_0x7c4c('0x1b')];var _0x474a87;if(_0x172451>=_0x20ecee){_0x172451=_0x20ecee;_0x474a87=0xc8;}else{_0x474a87=0xce;}_0x122ba8[_0x7c4c('0x18')](_0x474a87);return _0x122ba8[_0x7c4c('0x1d')](_0x7c4c('0x1e'),_0x5310ae+'-'+_0x172451+'/'+_0x20ecee)[_0x7c4c('0x19')](_0x4a90ec);}return null;};}function patchUpdates(_0x260bf7){return function(_0x3ca22c){try{jsonpatch[_0x7c4c('0x1f')](_0x3ca22c,_0x260bf7,!![]);}catch(_0x20fa81){return BPromise[_0x7c4c('0x20')](_0x20fa81);}return _0x3ca22c[_0x7c4c('0x21')]();};}function saveUpdates(_0x377050,_0x539dc9){return function(_0x2d37ad){if(_0x2d37ad){return _0x2d37ad[_0x7c4c('0x22')](_0x377050)[_0x7c4c('0x23')](function(_0x4383df){return _0x4383df;});}return null;};}function removeEntity(_0x236ebe,_0x3708ce){return function(_0x1f87d4){if(_0x1f87d4){return _0x1f87d4['destroy']()[_0x7c4c('0x23')](function(){_0x236ebe[_0x7c4c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x269c1a,_0x256f05){return function(_0x265b57){if(!_0x265b57){_0x269c1a[_0x7c4c('0x16')](0x194);}return _0x265b57;};}function handleError(_0xc41514,_0x45ec4c){_0x45ec4c=_0x45ec4c||0x1f4;return function(_0x1c7854){logger[_0x7c4c('0x24')](_0x1c7854[_0x7c4c('0x25')]);if(_0x1c7854[_0x7c4c('0x26')]){delete _0x1c7854[_0x7c4c('0x26')];}_0xc41514[_0x7c4c('0x18')](_0x45ec4c)[_0x7c4c('0x27')](_0x1c7854);};}exports[_0x7c4c('0x28')]=function(_0x5aab2e,_0x31e04b){var _0x54cda5={},_0x431246={},_0x59b7a1={'count':0x0,'rows':[]};var _0x4f9873=_[_0x7c4c('0x29')](db[_0x7c4c('0x2a')][_0x7c4c('0x2b')],function(_0x65cd27){return{'name':_0x65cd27[_0x7c4c('0x2c')],'type':_0x65cd27[_0x7c4c('0x2d')][_0x7c4c('0x2e')]};});_0x431246[_0x7c4c('0x2f')]=_[_0x7c4c('0x29')](_0x4f9873,'name');_0x431246[_0x7c4c('0x30')]=_[_0x7c4c('0x31')](_0x5aab2e[_0x7c4c('0x30')]);_0x431246[_0x7c4c('0x32')]=_[_0x7c4c('0x33')](_0x431246[_0x7c4c('0x2f')],_0x431246['query']);_0x54cda5[_0x7c4c('0x34')]=_[_0x7c4c('0x33')](_0x431246[_0x7c4c('0x2f')],qs[_0x7c4c('0x35')](_0x5aab2e[_0x7c4c('0x30')][_0x7c4c('0x35')]));_0x54cda5[_0x7c4c('0x34')]=_0x54cda5[_0x7c4c('0x34')]['length']?_0x54cda5[_0x7c4c('0x34')]:_0x431246[_0x7c4c('0x2f')];if(!_0x5aab2e[_0x7c4c('0x30')][_0x7c4c('0x36')](_0x7c4c('0x37'))){_0x54cda5[_0x7c4c('0x1b')]=qs[_0x7c4c('0x1b')](_0x5aab2e[_0x7c4c('0x30')][_0x7c4c('0x1b')]);_0x54cda5[_0x7c4c('0x1a')]=qs['offset'](_0x5aab2e[_0x7c4c('0x30')][_0x7c4c('0x1a')]);}_0x54cda5[_0x7c4c('0x38')]=qs[_0x7c4c('0x39')](_0x5aab2e[_0x7c4c('0x30')]['sort']);_0x54cda5[_0x7c4c('0x3a')]=qs['filters'](_['pick'](_0x5aab2e[_0x7c4c('0x30')],_0x431246['filters']),_0x4f9873);if(_0x5aab2e[_0x7c4c('0x30')][_0x7c4c('0x3b')]){_0x54cda5[_0x7c4c('0x3a')]=_[_0x7c4c('0x3c')](_0x54cda5['where'],{'$or':_[_0x7c4c('0x29')](_0x4f9873,function(_0x18a8ae){if(_0x18a8ae[_0x7c4c('0x2d')]!==_0x7c4c('0x3d')){var _0x14343f={};_0x14343f[_0x18a8ae[_0x7c4c('0x26')]]={'$like':'%'+_0x5aab2e[_0x7c4c('0x30')][_0x7c4c('0x3b')]+'%'};return _0x14343f;}})});}_0x54cda5=_['merge']({},_0x54cda5,_0x5aab2e[_0x7c4c('0x3e')]);var _0x4b13dc={'where':_0x54cda5[_0x7c4c('0x3a')]};return db[_0x7c4c('0x2a')][_0x7c4c('0x1c')](_0x4b13dc)[_0x7c4c('0x23')](function(_0x2c0360){_0x59b7a1[_0x7c4c('0x1c')]=_0x2c0360;if(_0x5aab2e[_0x7c4c('0x30')][_0x7c4c('0x3f')]){_0x54cda5[_0x7c4c('0x40')]=[{'all':!![]}];}return db[_0x7c4c('0x2a')]['findAll'](_0x54cda5);})['then'](function(_0x37ff1d){_0x59b7a1[_0x7c4c('0x41')]=_0x37ff1d;return _0x59b7a1;})[_0x7c4c('0x23')](respondWithFilteredResult(_0x31e04b,_0x54cda5))[_0x7c4c('0x42')](handleError(_0x31e04b,null));};exports[_0x7c4c('0x43')]=function(_0xe1582c,_0x552d2f){var _0x96d0e2={'raw':![],'where':{'id':_0xe1582c[_0x7c4c('0x44')]['id']}},_0x1ea85e={};_0x1ea85e['model']=_['keys'](db[_0x7c4c('0x2a')][_0x7c4c('0x2b')]);_0x1ea85e['query']=_['keys'](_0xe1582c['query']);_0x1ea85e['filters']=_[_0x7c4c('0x33')](_0x1ea85e[_0x7c4c('0x2f')],_0x1ea85e[_0x7c4c('0x30')]);_0x96d0e2[_0x7c4c('0x34')]=_[_0x7c4c('0x33')](_0x1ea85e[_0x7c4c('0x2f')],qs['fields'](_0xe1582c['query'][_0x7c4c('0x35')]));_0x96d0e2['attributes']=_0x96d0e2[_0x7c4c('0x34')][_0x7c4c('0x45')]?_0x96d0e2['attributes']:_0x1ea85e[_0x7c4c('0x2f')];if(_0xe1582c['query'][_0x7c4c('0x3f')]){_0x96d0e2[_0x7c4c('0x40')]=[{'all':!![]}];}_0x96d0e2=_['merge']({},_0x96d0e2,_0xe1582c[_0x7c4c('0x3e')]);return db[_0x7c4c('0x2a')][_0x7c4c('0x46')](_0x96d0e2)[_0x7c4c('0x23')](handleEntityNotFound(_0x552d2f,null))[_0x7c4c('0x23')](respondWithResult(_0x552d2f,null))[_0x7c4c('0x42')](handleError(_0x552d2f,null));};exports[_0x7c4c('0x47')]=function(_0x541093,_0x163c1e){return db[_0x7c4c('0x2a')][_0x7c4c('0x47')](_0x541093[_0x7c4c('0x48')],{})['then'](respondWithResult(_0x163c1e,0xc9))[_0x7c4c('0x42')](handleError(_0x163c1e,null));};exports[_0x7c4c('0x22')]=function(_0x2f2686,_0x4d6105){if(_0x2f2686[_0x7c4c('0x48')]['id']){delete _0x2f2686[_0x7c4c('0x48')]['id'];}return db[_0x7c4c('0x2a')][_0x7c4c('0x46')]({'where':{'id':_0x2f2686[_0x7c4c('0x44')]['id']}})[_0x7c4c('0x23')](handleEntityNotFound(_0x4d6105,null))[_0x7c4c('0x23')](saveUpdates(_0x2f2686[_0x7c4c('0x48')],null))[_0x7c4c('0x23')](respondWithResult(_0x4d6105,null))[_0x7c4c('0x42')](handleError(_0x4d6105,null));};exports[_0x7c4c('0x49')]=function(_0xe2518b,_0x51ef26){return db[_0x7c4c('0x2a')][_0x7c4c('0x46')]({'where':{'id':_0xe2518b[_0x7c4c('0x44')]['id']}})[_0x7c4c('0x23')](handleEntityNotFound(_0x51ef26,null))['then'](removeEntity(_0x51ef26,null))['catch'](handleError(_0x51ef26,null));};exports[_0x7c4c('0x4a')]=function(_0x253756,_0x5a35f5,_0x2a426f){var _0x2621d6={};var _0x2cc56e={};var _0x52ec0b;var _0x403418;return db[_0x7c4c('0x2a')]['findOne']({'where':{'id':_0x253756['params']['id']}})[_0x7c4c('0x23')](handleEntityNotFound(_0x5a35f5,null))[_0x7c4c('0x23')](function(_0x32f18e){if(_0x32f18e){_0x52ec0b=_0x32f18e;_0x2cc56e[_0x7c4c('0x2f')]=_[_0x7c4c('0x31')](db['FreshsalesField'][_0x7c4c('0x2b')]);_0x2cc56e[_0x7c4c('0x30')]=_[_0x7c4c('0x31')](_0x253756[_0x7c4c('0x30')]);_0x2cc56e[_0x7c4c('0x32')]=_[_0x7c4c('0x33')](_0x2cc56e[_0x7c4c('0x2f')],_0x2cc56e[_0x7c4c('0x30')]);_0x2621d6[_0x7c4c('0x34')]=_['intersection'](_0x2cc56e[_0x7c4c('0x2f')],qs[_0x7c4c('0x35')](_0x253756[_0x7c4c('0x30')][_0x7c4c('0x35')]));_0x2621d6[_0x7c4c('0x34')]=_0x2621d6[_0x7c4c('0x34')]['length']?_0x2621d6[_0x7c4c('0x34')]:_0x2cc56e[_0x7c4c('0x2f')];_0x2621d6[_0x7c4c('0x38')]=qs[_0x7c4c('0x39')](_0x253756[_0x7c4c('0x30')][_0x7c4c('0x39')]);_0x2621d6['where']=qs['filters'](_[_0x7c4c('0x4b')](_0x253756[_0x7c4c('0x30')],_0x2cc56e[_0x7c4c('0x32')]));if(_0x253756['query']['filter']){_0x2621d6[_0x7c4c('0x3a')]=_[_0x7c4c('0x3c')](_0x2621d6['where'],{'$or':_[_0x7c4c('0x29')](_0x2621d6[_0x7c4c('0x34')],function(_0x39328d){var _0x585a58={};_0x585a58[_0x39328d]={'$like':'%'+_0x253756[_0x7c4c('0x30')][_0x7c4c('0x3b')]+'%'};return _0x585a58;})});}_0x2621d6=_[_0x7c4c('0x3c')]({},_0x2621d6,_0x253756[_0x7c4c('0x3e')]);return _0x52ec0b[_0x7c4c('0x4a')](_0x2621d6);}})['then'](function(_0x23b36d){if(_0x23b36d){_0x403418=_0x23b36d[_0x7c4c('0x45')];if(!_0x253756[_0x7c4c('0x30')]['hasOwnProperty'](_0x7c4c('0x37'))){_0x2621d6[_0x7c4c('0x1b')]=qs['limit'](_0x253756[_0x7c4c('0x30')][_0x7c4c('0x1b')]);_0x2621d6[_0x7c4c('0x1a')]=qs[_0x7c4c('0x1a')](_0x253756['query']['offset']);}return _0x52ec0b['getSubjects'](_0x2621d6);}})[_0x7c4c('0x23')](function(_0x2e92d8){if(_0x2e92d8){return _0x2e92d8?{'count':_0x403418,'rows':_0x2e92d8}:null;}})[_0x7c4c('0x23')](respondWithResult(_0x5a35f5,null))[_0x7c4c('0x42')](handleError(_0x5a35f5,null));};exports[_0x7c4c('0x4c')]=function(_0x248666,_0xe7f0d9,_0x56a010){var _0x3a35={};var _0x5917e9={};var _0x4dff00;var _0x488816;return db[_0x7c4c('0x2a')][_0x7c4c('0x4d')]({'where':{'id':_0x248666[_0x7c4c('0x44')]['id']}})[_0x7c4c('0x23')](handleEntityNotFound(_0xe7f0d9,null))['then'](function(_0x389235){if(_0x389235){_0x4dff00=_0x389235;_0x5917e9[_0x7c4c('0x2f')]=_[_0x7c4c('0x31')](db['FreshsalesField'][_0x7c4c('0x2b')]);_0x5917e9[_0x7c4c('0x30')]=_[_0x7c4c('0x31')](_0x248666[_0x7c4c('0x30')]);_0x5917e9['filters']=_[_0x7c4c('0x33')](_0x5917e9[_0x7c4c('0x2f')],_0x5917e9['query']);_0x3a35[_0x7c4c('0x34')]=_[_0x7c4c('0x33')](_0x5917e9[_0x7c4c('0x2f')],qs[_0x7c4c('0x35')](_0x248666[_0x7c4c('0x30')][_0x7c4c('0x35')]));_0x3a35[_0x7c4c('0x34')]=_0x3a35[_0x7c4c('0x34')][_0x7c4c('0x45')]?_0x3a35[_0x7c4c('0x34')]:_0x5917e9[_0x7c4c('0x2f')];_0x3a35['order']=qs[_0x7c4c('0x39')](_0x248666[_0x7c4c('0x30')][_0x7c4c('0x39')]);_0x3a35[_0x7c4c('0x3a')]=qs[_0x7c4c('0x32')](_[_0x7c4c('0x4b')](_0x248666[_0x7c4c('0x30')],_0x5917e9['filters']));if(_0x248666[_0x7c4c('0x30')][_0x7c4c('0x3b')]){_0x3a35[_0x7c4c('0x3a')]=_[_0x7c4c('0x3c')](_0x3a35[_0x7c4c('0x3a')],{'$or':_[_0x7c4c('0x29')](_0x3a35[_0x7c4c('0x34')],function(_0x1dd89d){var _0x10331c={};_0x10331c[_0x1dd89d]={'$like':'%'+_0x248666[_0x7c4c('0x30')][_0x7c4c('0x3b')]+'%'};return _0x10331c;})});}_0x3a35=_[_0x7c4c('0x3c')]({},_0x3a35,_0x248666[_0x7c4c('0x3e')]);return _0x4dff00[_0x7c4c('0x4c')](_0x3a35);}})[_0x7c4c('0x23')](function(_0x2f7e92){if(_0x2f7e92){_0x488816=_0x2f7e92[_0x7c4c('0x45')];if(!_0x248666[_0x7c4c('0x30')][_0x7c4c('0x36')](_0x7c4c('0x37'))){_0x3a35[_0x7c4c('0x1b')]=qs['limit'](_0x248666[_0x7c4c('0x30')]['limit']);_0x3a35[_0x7c4c('0x1a')]=qs['offset'](_0x248666[_0x7c4c('0x30')][_0x7c4c('0x1a')]);}return _0x4dff00[_0x7c4c('0x4c')](_0x3a35);}})[_0x7c4c('0x23')](function(_0x1b695f){if(_0x1b695f){return _0x1b695f?{'count':_0x488816,'rows':_0x1b695f}:null;}})[_0x7c4c('0x23')](respondWithResult(_0xe7f0d9,null))[_0x7c4c('0x42')](handleError(_0xe7f0d9,null));};exports[_0x7c4c('0x4e')]=function(_0x385129,_0x402dd0,_0xd07903){var _0x43c2dd={};var _0x7d2008={};var _0x4fc3dc;var _0x531420;return db[_0x7c4c('0x2a')][_0x7c4c('0x4d')]({'where':{'id':_0x385129[_0x7c4c('0x44')]['id']}})['then'](handleEntityNotFound(_0x402dd0,null))[_0x7c4c('0x23')](function(_0x39299b){if(_0x39299b){_0x4fc3dc=_0x39299b;_0x7d2008[_0x7c4c('0x2f')]=_['keys'](db[_0x7c4c('0x4f')][_0x7c4c('0x2b')]);_0x7d2008[_0x7c4c('0x30')]=_[_0x7c4c('0x31')](_0x385129['query']);_0x7d2008[_0x7c4c('0x32')]=_[_0x7c4c('0x33')](_0x7d2008[_0x7c4c('0x2f')],_0x7d2008[_0x7c4c('0x30')]);_0x43c2dd[_0x7c4c('0x34')]=_['intersection'](_0x7d2008[_0x7c4c('0x2f')],qs[_0x7c4c('0x35')](_0x385129[_0x7c4c('0x30')][_0x7c4c('0x35')]));_0x43c2dd['attributes']=_0x43c2dd[_0x7c4c('0x34')][_0x7c4c('0x45')]?_0x43c2dd[_0x7c4c('0x34')]:_0x7d2008[_0x7c4c('0x2f')];_0x43c2dd['order']=qs[_0x7c4c('0x39')](_0x385129[_0x7c4c('0x30')]['sort']);_0x43c2dd[_0x7c4c('0x3a')]=qs[_0x7c4c('0x32')](_['pick'](_0x385129[_0x7c4c('0x30')],_0x7d2008[_0x7c4c('0x32')]));if(_0x385129['query']['filter']){_0x43c2dd[_0x7c4c('0x3a')]=_[_0x7c4c('0x3c')](_0x43c2dd['where'],{'$or':_[_0x7c4c('0x29')](_0x43c2dd['attributes'],function(_0x514209){var _0x3d8b0f={};_0x3d8b0f[_0x514209]={'$like':'%'+_0x385129[_0x7c4c('0x30')][_0x7c4c('0x3b')]+'%'};return _0x3d8b0f;})});}_0x43c2dd=_[_0x7c4c('0x3c')]({},_0x43c2dd,_0x385129['options']);return _0x4fc3dc['getFields'](_0x43c2dd);}})['then'](function(_0x505893){if(_0x505893){_0x531420=_0x505893['length'];if(!_0x385129[_0x7c4c('0x30')]['hasOwnProperty']('nolimit')){_0x43c2dd[_0x7c4c('0x1b')]=qs[_0x7c4c('0x1b')](_0x385129['query'][_0x7c4c('0x1b')]);_0x43c2dd[_0x7c4c('0x1a')]=qs[_0x7c4c('0x1a')](_0x385129['query'][_0x7c4c('0x1a')]);}return _0x4fc3dc[_0x7c4c('0x4e')](_0x43c2dd);}})['then'](function(_0x4169e8){if(_0x4169e8){return _0x4169e8?{'count':_0x531420,'rows':_0x4169e8}:null;}})[_0x7c4c('0x23')](respondWithResult(_0x402dd0,null))[_0x7c4c('0x42')](handleError(_0x402dd0,null));}; \ No newline at end of file +var _0xa827=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x13609f,_0x379c40){var _0x5d7b97=function(_0x3b4555){while(--_0x3b4555){_0x13609f['push'](_0x13609f['shift']());}};_0x5d7b97(++_0x379c40);}(_0xa827,0x112));var _0x7a82=function(_0x41e33c,_0xd0cc42){_0x41e33c=_0x41e33c-0x0;var _0x57403a=_0xa827[_0x41e33c];return _0x57403a;};'use strict';var emlformat=require(_0x7a82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a82('0x1'));var jsonpatch=require(_0x7a82('0x2'));var rp=require('request-promise');var moment=require(_0x7a82('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7a82('0x4'));var util=require(_0x7a82('0x5'));var path=require(_0x7a82('0x6'));var sox=require(_0x7a82('0x7'));var csv=require(_0x7a82('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a82('0x9'));var _=require(_0x7a82('0xa'));var squel=require(_0x7a82('0xb'));var crypto=require(_0x7a82('0xc'));var jsforce=require(_0x7a82('0xd'));var deskjs=require(_0x7a82('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7a82('0xf'));var Papa=require(_0x7a82('0x10'));var Redis=require(_0x7a82('0x11'));var authService=require(_0x7a82('0x12'));var qs=require(_0x7a82('0x13'));var as=require(_0x7a82('0x14'));var hardwareService=require(_0x7a82('0x15'));var logger=require(_0x7a82('0x16'))(_0x7a82('0x17'));var utils=require('../../config/utils');var config=require(_0x7a82('0x18'));var licenseUtil=require(_0x7a82('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1956,_0x20c378){_0x20c378=_0x20c378||0xcc;return function(_0x180b8a){if(_0x180b8a){return _0x3e1956[_0x7a82('0x1a')](_0x20c378);}return _0x3e1956[_0x7a82('0x1b')](_0x20c378)[_0x7a82('0x1c')]();};}function respondWithResult(_0x590fe8,_0x4ec001){_0x4ec001=_0x4ec001||0xc8;return function(_0x5a9326){if(_0x5a9326){return _0x590fe8['status'](_0x4ec001)[_0x7a82('0x1d')](_0x5a9326);}};}function respondWithFilteredResult(_0x19fa2b,_0xef411d){return function(_0xda4293){if(_0xda4293){var _0x36dfff=typeof _0xef411d[_0x7a82('0x1e')]===_0x7a82('0x1f')&&typeof _0xef411d[_0x7a82('0x20')]===_0x7a82('0x1f');var _0x37024e=_0xda4293[_0x7a82('0x21')];var _0xa971cb=_0x36dfff?0x0:_0xef411d[_0x7a82('0x1e')];var _0x2496cf=_0x36dfff?_0xda4293[_0x7a82('0x21')]:_0xef411d[_0x7a82('0x1e')]+_0xef411d[_0x7a82('0x20')];var _0x5ab810;if(_0x2496cf>=_0x37024e){_0x2496cf=_0x37024e;_0x5ab810=0xc8;}else{_0x5ab810=0xce;}_0x19fa2b[_0x7a82('0x1b')](_0x5ab810);return _0x19fa2b[_0x7a82('0x22')](_0x7a82('0x23'),_0xa971cb+'-'+_0x2496cf+'/'+_0x37024e)[_0x7a82('0x1d')](_0xda4293);}return null;};}function patchUpdates(_0x25833c){return function(_0x36d0bd){try{jsonpatch['apply'](_0x36d0bd,_0x25833c,!![]);}catch(_0x8adbb7){return BPromise[_0x7a82('0x24')](_0x8adbb7);}return _0x36d0bd[_0x7a82('0x25')]();};}function saveUpdates(_0x3cb50f,_0x5c2070){return function(_0x2b81b7){if(_0x2b81b7){return _0x2b81b7[_0x7a82('0x26')](_0x3cb50f)['then'](function(_0x3043e5){return _0x3043e5;});}return null;};}function removeEntity(_0x1c622c,_0x287be3){return function(_0x4ca760){if(_0x4ca760){return _0x4ca760[_0x7a82('0x27')]()[_0x7a82('0x28')](function(){_0x1c622c[_0x7a82('0x1b')](0xcc)[_0x7a82('0x1c')]();});}};}function handleEntityNotFound(_0x7cdb4d,_0x1abdb1){return function(_0xbb5e8a){if(!_0xbb5e8a){_0x7cdb4d[_0x7a82('0x1a')](0x194);}return _0xbb5e8a;};}function handleError(_0x399a19,_0x236642){_0x236642=_0x236642||0x1f4;return function(_0x48fb13){logger[_0x7a82('0x29')](_0x48fb13[_0x7a82('0x2a')]);if(_0x48fb13[_0x7a82('0x2b')]){delete _0x48fb13[_0x7a82('0x2b')];}_0x399a19[_0x7a82('0x1b')](_0x236642)[_0x7a82('0x2c')](_0x48fb13);};}exports[_0x7a82('0x2d')]=function(_0x20761a,_0x3b2632){var _0x1a9604={},_0x59dbfc={},_0x26e56a={'count':0x0,'rows':[]};var _0xaa2f92=_[_0x7a82('0x2e')](db[_0x7a82('0x2f')][_0x7a82('0x30')],function(_0x4979ec){return{'name':_0x4979ec['fieldName'],'type':_0x4979ec[_0x7a82('0x31')][_0x7a82('0x32')]};});_0x59dbfc[_0x7a82('0x33')]=_[_0x7a82('0x2e')](_0xaa2f92,_0x7a82('0x2b'));_0x59dbfc['query']=_[_0x7a82('0x34')](_0x20761a[_0x7a82('0x35')]);_0x59dbfc[_0x7a82('0x36')]=_[_0x7a82('0x37')](_0x59dbfc[_0x7a82('0x33')],_0x59dbfc[_0x7a82('0x35')]);_0x1a9604[_0x7a82('0x38')]=_['intersection'](_0x59dbfc[_0x7a82('0x33')],qs[_0x7a82('0x39')](_0x20761a[_0x7a82('0x35')][_0x7a82('0x39')]));_0x1a9604[_0x7a82('0x38')]=_0x1a9604[_0x7a82('0x38')]['length']?_0x1a9604['attributes']:_0x59dbfc[_0x7a82('0x33')];if(!_0x20761a[_0x7a82('0x35')][_0x7a82('0x3a')](_0x7a82('0x3b'))){_0x1a9604[_0x7a82('0x20')]=qs[_0x7a82('0x20')](_0x20761a[_0x7a82('0x35')]['limit']);_0x1a9604[_0x7a82('0x1e')]=qs[_0x7a82('0x1e')](_0x20761a['query'][_0x7a82('0x1e')]);}_0x1a9604[_0x7a82('0x3c')]=qs[_0x7a82('0x3d')](_0x20761a[_0x7a82('0x35')][_0x7a82('0x3d')]);_0x1a9604[_0x7a82('0x3e')]=qs[_0x7a82('0x36')](_[_0x7a82('0x3f')](_0x20761a[_0x7a82('0x35')],_0x59dbfc[_0x7a82('0x36')]),_0xaa2f92);if(_0x20761a[_0x7a82('0x35')]['filter']){_0x1a9604[_0x7a82('0x3e')]=_['merge'](_0x1a9604[_0x7a82('0x3e')],{'$or':_[_0x7a82('0x2e')](_0xaa2f92,function(_0x59e6b1){if(_0x59e6b1['type']!=='VIRTUAL'){var _0x5294ef={};_0x5294ef[_0x59e6b1[_0x7a82('0x2b')]]={'$like':'%'+_0x20761a[_0x7a82('0x35')][_0x7a82('0x40')]+'%'};return _0x5294ef;}})});}_0x1a9604=_[_0x7a82('0x41')]({},_0x1a9604,_0x20761a[_0x7a82('0x42')]);var _0x163a23={'where':_0x1a9604[_0x7a82('0x3e')]};return db[_0x7a82('0x2f')][_0x7a82('0x21')](_0x163a23)['then'](function(_0x3462d6){_0x26e56a['count']=_0x3462d6;if(_0x20761a['query'][_0x7a82('0x43')]){_0x1a9604[_0x7a82('0x44')]=[{'all':!![]}];}return db[_0x7a82('0x2f')][_0x7a82('0x45')](_0x1a9604);})[_0x7a82('0x28')](function(_0xe00c8c){_0x26e56a[_0x7a82('0x46')]=_0xe00c8c;return _0x26e56a;})[_0x7a82('0x28')](respondWithFilteredResult(_0x3b2632,_0x1a9604))['catch'](handleError(_0x3b2632,null));};exports[_0x7a82('0x47')]=function(_0x3c4c94,_0x2908db){var _0xd47c8c={'raw':![],'where':{'id':_0x3c4c94[_0x7a82('0x48')]['id']}},_0x452e81={};_0x452e81['model']=_[_0x7a82('0x34')](db['FreshsalesConfiguration'][_0x7a82('0x30')]);_0x452e81[_0x7a82('0x35')]=_[_0x7a82('0x34')](_0x3c4c94['query']);_0x452e81[_0x7a82('0x36')]=_[_0x7a82('0x37')](_0x452e81[_0x7a82('0x33')],_0x452e81[_0x7a82('0x35')]);_0xd47c8c[_0x7a82('0x38')]=_[_0x7a82('0x37')](_0x452e81[_0x7a82('0x33')],qs['fields'](_0x3c4c94[_0x7a82('0x35')]['fields']));_0xd47c8c[_0x7a82('0x38')]=_0xd47c8c[_0x7a82('0x38')][_0x7a82('0x49')]?_0xd47c8c['attributes']:_0x452e81[_0x7a82('0x33')];if(_0x3c4c94[_0x7a82('0x35')][_0x7a82('0x43')]){_0xd47c8c[_0x7a82('0x44')]=[{'all':!![]}];}_0xd47c8c=_[_0x7a82('0x41')]({},_0xd47c8c,_0x3c4c94['options']);return db[_0x7a82('0x2f')][_0x7a82('0x4a')](_0xd47c8c)[_0x7a82('0x28')](handleEntityNotFound(_0x2908db,null))[_0x7a82('0x28')](respondWithResult(_0x2908db,null))[_0x7a82('0x4b')](handleError(_0x2908db,null));};exports[_0x7a82('0x4c')]=function(_0x340407,_0xe2c6b5){return db['FreshsalesConfiguration'][_0x7a82('0x4c')](_0x340407[_0x7a82('0x4d')],{})[_0x7a82('0x28')](respondWithResult(_0xe2c6b5,0xc9))[_0x7a82('0x4b')](handleError(_0xe2c6b5,null));};exports['update']=function(_0x1fdae2,_0xb7eec8){if(_0x1fdae2[_0x7a82('0x4d')]['id']){delete _0x1fdae2['body']['id'];}return db[_0x7a82('0x2f')][_0x7a82('0x4a')]({'where':{'id':_0x1fdae2[_0x7a82('0x48')]['id']}})['then'](handleEntityNotFound(_0xb7eec8,null))[_0x7a82('0x28')](saveUpdates(_0x1fdae2[_0x7a82('0x4d')],null))[_0x7a82('0x28')](respondWithResult(_0xb7eec8,null))['catch'](handleError(_0xb7eec8,null));};exports[_0x7a82('0x27')]=function(_0x331e25,_0x38fc05){return db[_0x7a82('0x2f')][_0x7a82('0x4a')]({'where':{'id':_0x331e25[_0x7a82('0x48')]['id']}})[_0x7a82('0x28')](handleEntityNotFound(_0x38fc05,null))[_0x7a82('0x28')](removeEntity(_0x38fc05,null))['catch'](handleError(_0x38fc05,null));};exports[_0x7a82('0x4e')]=function(_0x45162f,_0x232d5d,_0x5286ef){var _0x3f5fcc={};var _0x3a706f={};var _0x1dbee1;var _0x1e52c0;return db['FreshsalesConfiguration'][_0x7a82('0x4f')]({'where':{'id':_0x45162f[_0x7a82('0x48')]['id']}})[_0x7a82('0x28')](handleEntityNotFound(_0x232d5d,null))['then'](function(_0x44c635){if(_0x44c635){_0x1dbee1=_0x44c635;_0x3a706f[_0x7a82('0x33')]=_[_0x7a82('0x34')](db[_0x7a82('0x50')]['rawAttributes']);_0x3a706f[_0x7a82('0x35')]=_[_0x7a82('0x34')](_0x45162f[_0x7a82('0x35')]);_0x3a706f[_0x7a82('0x36')]=_[_0x7a82('0x37')](_0x3a706f[_0x7a82('0x33')],_0x3a706f[_0x7a82('0x35')]);_0x3f5fcc[_0x7a82('0x38')]=_[_0x7a82('0x37')](_0x3a706f[_0x7a82('0x33')],qs['fields'](_0x45162f[_0x7a82('0x35')][_0x7a82('0x39')]));_0x3f5fcc[_0x7a82('0x38')]=_0x3f5fcc['attributes']['length']?_0x3f5fcc[_0x7a82('0x38')]:_0x3a706f[_0x7a82('0x33')];_0x3f5fcc[_0x7a82('0x3c')]=qs[_0x7a82('0x3d')](_0x45162f[_0x7a82('0x35')][_0x7a82('0x3d')]);_0x3f5fcc[_0x7a82('0x3e')]=qs[_0x7a82('0x36')](_[_0x7a82('0x3f')](_0x45162f[_0x7a82('0x35')],_0x3a706f[_0x7a82('0x36')]));if(_0x45162f[_0x7a82('0x35')][_0x7a82('0x40')]){_0x3f5fcc[_0x7a82('0x3e')]=_[_0x7a82('0x41')](_0x3f5fcc['where'],{'$or':_[_0x7a82('0x2e')](_0x3f5fcc['attributes'],function(_0x16830c){var _0x59355a={};_0x59355a[_0x16830c]={'$like':'%'+_0x45162f[_0x7a82('0x35')]['filter']+'%'};return _0x59355a;})});}_0x3f5fcc=_[_0x7a82('0x41')]({},_0x3f5fcc,_0x45162f[_0x7a82('0x42')]);return _0x1dbee1[_0x7a82('0x4e')](_0x3f5fcc);}})['then'](function(_0xf8d3a1){if(_0xf8d3a1){_0x1e52c0=_0xf8d3a1[_0x7a82('0x49')];if(!_0x45162f[_0x7a82('0x35')][_0x7a82('0x3a')](_0x7a82('0x3b'))){_0x3f5fcc[_0x7a82('0x20')]=qs['limit'](_0x45162f['query'][_0x7a82('0x20')]);_0x3f5fcc[_0x7a82('0x1e')]=qs[_0x7a82('0x1e')](_0x45162f[_0x7a82('0x35')][_0x7a82('0x1e')]);}return _0x1dbee1[_0x7a82('0x4e')](_0x3f5fcc);}})[_0x7a82('0x28')](function(_0x2abac8){if(_0x2abac8){return _0x2abac8?{'count':_0x1e52c0,'rows':_0x2abac8}:null;}})['then'](respondWithResult(_0x232d5d,null))['catch'](handleError(_0x232d5d,null));};exports[_0x7a82('0x51')]=function(_0x22de82,_0x725184,_0x736e65){var _0x381c5f={};var _0x5f2a8c={};var _0x144aff;var _0xfe58eb;return db[_0x7a82('0x2f')][_0x7a82('0x4f')]({'where':{'id':_0x22de82[_0x7a82('0x48')]['id']}})[_0x7a82('0x28')](handleEntityNotFound(_0x725184,null))[_0x7a82('0x28')](function(_0x24bc86){if(_0x24bc86){_0x144aff=_0x24bc86;_0x5f2a8c[_0x7a82('0x33')]=_['keys'](db['FreshsalesField'][_0x7a82('0x30')]);_0x5f2a8c[_0x7a82('0x35')]=_['keys'](_0x22de82[_0x7a82('0x35')]);_0x5f2a8c[_0x7a82('0x36')]=_[_0x7a82('0x37')](_0x5f2a8c[_0x7a82('0x33')],_0x5f2a8c['query']);_0x381c5f[_0x7a82('0x38')]=_[_0x7a82('0x37')](_0x5f2a8c[_0x7a82('0x33')],qs[_0x7a82('0x39')](_0x22de82[_0x7a82('0x35')]['fields']));_0x381c5f['attributes']=_0x381c5f[_0x7a82('0x38')]['length']?_0x381c5f[_0x7a82('0x38')]:_0x5f2a8c['model'];_0x381c5f['order']=qs[_0x7a82('0x3d')](_0x22de82[_0x7a82('0x35')][_0x7a82('0x3d')]);_0x381c5f[_0x7a82('0x3e')]=qs[_0x7a82('0x36')](_['pick'](_0x22de82[_0x7a82('0x35')],_0x5f2a8c[_0x7a82('0x36')]));if(_0x22de82[_0x7a82('0x35')][_0x7a82('0x40')]){_0x381c5f[_0x7a82('0x3e')]=_['merge'](_0x381c5f['where'],{'$or':_[_0x7a82('0x2e')](_0x381c5f['attributes'],function(_0x5ba26e){var _0x2bcb9f={};_0x2bcb9f[_0x5ba26e]={'$like':'%'+_0x22de82[_0x7a82('0x35')][_0x7a82('0x40')]+'%'};return _0x2bcb9f;})});}_0x381c5f=_[_0x7a82('0x41')]({},_0x381c5f,_0x22de82[_0x7a82('0x42')]);return _0x144aff[_0x7a82('0x51')](_0x381c5f);}})[_0x7a82('0x28')](function(_0x7f651b){if(_0x7f651b){_0xfe58eb=_0x7f651b[_0x7a82('0x49')];if(!_0x22de82[_0x7a82('0x35')][_0x7a82('0x3a')](_0x7a82('0x3b'))){_0x381c5f[_0x7a82('0x20')]=qs['limit'](_0x22de82[_0x7a82('0x35')][_0x7a82('0x20')]);_0x381c5f[_0x7a82('0x1e')]=qs[_0x7a82('0x1e')](_0x22de82[_0x7a82('0x35')]['offset']);}return _0x144aff[_0x7a82('0x51')](_0x381c5f);}})[_0x7a82('0x28')](function(_0x54b5b0){if(_0x54b5b0){return _0x54b5b0?{'count':_0xfe58eb,'rows':_0x54b5b0}:null;}})['then'](respondWithResult(_0x725184,null))[_0x7a82('0x4b')](handleError(_0x725184,null));};exports['getFields']=function(_0x32e367,_0x10fbbf,_0x47c1d2){var _0x22074d={};var _0x4dc2dc={};var _0x40d23a;var _0xf28264;return db['FreshsalesConfiguration'][_0x7a82('0x4f')]({'where':{'id':_0x32e367[_0x7a82('0x48')]['id']}})[_0x7a82('0x28')](handleEntityNotFound(_0x10fbbf,null))['then'](function(_0x3817e4){if(_0x3817e4){_0x40d23a=_0x3817e4;_0x4dc2dc[_0x7a82('0x33')]=_[_0x7a82('0x34')](db[_0x7a82('0x50')][_0x7a82('0x30')]);_0x4dc2dc[_0x7a82('0x35')]=_[_0x7a82('0x34')](_0x32e367['query']);_0x4dc2dc[_0x7a82('0x36')]=_['intersection'](_0x4dc2dc['model'],_0x4dc2dc[_0x7a82('0x35')]);_0x22074d['attributes']=_[_0x7a82('0x37')](_0x4dc2dc[_0x7a82('0x33')],qs[_0x7a82('0x39')](_0x32e367['query'][_0x7a82('0x39')]));_0x22074d[_0x7a82('0x38')]=_0x22074d[_0x7a82('0x38')][_0x7a82('0x49')]?_0x22074d[_0x7a82('0x38')]:_0x4dc2dc[_0x7a82('0x33')];_0x22074d['order']=qs[_0x7a82('0x3d')](_0x32e367[_0x7a82('0x35')][_0x7a82('0x3d')]);_0x22074d[_0x7a82('0x3e')]=qs['filters'](_['pick'](_0x32e367[_0x7a82('0x35')],_0x4dc2dc['filters']));if(_0x32e367['query'][_0x7a82('0x40')]){_0x22074d[_0x7a82('0x3e')]=_['merge'](_0x22074d[_0x7a82('0x3e')],{'$or':_[_0x7a82('0x2e')](_0x22074d[_0x7a82('0x38')],function(_0x5760eb){var _0x35a785={};_0x35a785[_0x5760eb]={'$like':'%'+_0x32e367[_0x7a82('0x35')][_0x7a82('0x40')]+'%'};return _0x35a785;})});}_0x22074d=_['merge']({},_0x22074d,_0x32e367[_0x7a82('0x42')]);return _0x40d23a[_0x7a82('0x52')](_0x22074d);}})['then'](function(_0xe4efb4){if(_0xe4efb4){_0xf28264=_0xe4efb4['length'];if(!_0x32e367[_0x7a82('0x35')][_0x7a82('0x3a')](_0x7a82('0x3b'))){_0x22074d[_0x7a82('0x20')]=qs['limit'](_0x32e367['query'][_0x7a82('0x20')]);_0x22074d[_0x7a82('0x1e')]=qs[_0x7a82('0x1e')](_0x32e367[_0x7a82('0x35')]['offset']);}return _0x40d23a[_0x7a82('0x52')](_0x22074d);}})[_0x7a82('0x28')](function(_0x3cac97){if(_0x3cac97){return _0x3cac97?{'count':_0xf28264,'rows':_0x3cac97}:null;}})['then'](respondWithResult(_0x10fbbf,null))[_0x7a82('0x4b')](handleError(_0x10fbbf,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 07bfb7a..51953ac 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 _0xaa9e=['bluebird','request-promise','rimraf','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa9e,0x145));var _0xeaa9=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0xaa9e[_0x8b8564];return _0x360c61;};'use strict';var _=require(_0xeaa9('0x0'));var util=require(_0xeaa9('0x1'));var logger=require(_0xeaa9('0x2'))(_0xeaa9('0x3'));var moment=require(_0xeaa9('0x4'));var BPromise=require(_0xeaa9('0x5'));var rp=require(_0xeaa9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeaa9('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xeaa9('0x8')]=function(_0x29ffd1,_0x4cbe27){return _0x29ffd1[_0xeaa9('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0xeaa9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb960=['path','rimraf','../../config/environment','exports','define','int_freshsales_configurations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x8d44ee,_0x3fd8f6){var _0x2a6cca=function(_0x5de659){while(--_0x5de659){_0x8d44ee['push'](_0x8d44ee['shift']());}};_0x2a6cca(++_0x3fd8f6);}(_0xb960,0x15b));var _0x0b96=function(_0x316efa,_0x20a1e1){_0x316efa=_0x316efa-0x0;var _0x4d96cc=_0xb960[_0x316efa];return _0x4d96cc;};'use strict';var _=require('lodash');var util=require(_0x0b96('0x0'));var logger=require(_0x0b96('0x1'))('api');var moment=require(_0x0b96('0x2'));var BPromise=require(_0x0b96('0x3'));var rp=require(_0x0b96('0x4'));var fs=require('fs');var path=require(_0x0b96('0x5'));var rimraf=require(_0x0b96('0x6'));var config=require(_0x0b96('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x0b96('0x8')]=function(_0x5c02c9,_0x21d717){return _0x5c02c9[_0x0b96('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x0b96('0xa'),'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 0b7c2fe..051644b 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 _0xdae3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0xcb8fde,_0x24399c){var _0x16dd77=function(_0x27cab4){while(--_0x27cab4){_0xcb8fde['push'](_0xcb8fde['shift']());}};_0x16dd77(++_0x24399c);}(_0xdae3,0x11d));var _0x3dae=function(_0x13e455,_0x285edc){_0x13e455=_0x13e455-0x0;var _0x43015b=_0xdae3[_0x13e455];return _0x43015b;};'use strict';var _=require(_0x3dae('0x0'));var util=require(_0x3dae('0x1'));var moment=require(_0x3dae('0x2'));var BPromise=require(_0x3dae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dae('0x4'));var db=require(_0x3dae('0x5'))['db'];var utils=require(_0x3dae('0x6'));var logger=require(_0x3dae('0x7'))('rpc');var config=require(_0x3dae('0x8'));var jayson=require(_0x3dae('0x9'));var client=jayson[_0x3dae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30fcef,_0xbf252c,_0x3befcc){return new BPromise(function(_0xc7a160,_0x321338){return client['request'](_0x30fcef,_0x3befcc)['then'](function(_0x253364){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0xbf252c,_0x3dae('0xb'));logger[_0x3dae('0xc')](_0x3dae('0xd'),_0xbf252c,_0x3dae('0xb'),JSON[_0x3dae('0xe')](_0x253364));if(_0x253364[_0x3dae('0xf')]){if(_0x253364['error'][_0x3dae('0x10')]===0x1f4){logger[_0x3dae('0xf')](_0x3dae('0x11'),_0xbf252c,_0x253364[_0x3dae('0xf')][_0x3dae('0x12')]);return _0x321338(_0x253364['error']['message']);}logger['error'](_0x3dae('0x11'),_0xbf252c,_0x253364['error'][_0x3dae('0x12')]);return _0xc7a160(_0x253364['error'][_0x3dae('0x12')]);}else{logger[_0x3dae('0x13')](_0x3dae('0x11'),_0xbf252c,'request\x20sent');_0xc7a160(_0x253364[_0x3dae('0x14')][_0x3dae('0x12')]);}})[_0x3dae('0x15')](function(_0x9f8fe6){logger[_0x3dae('0xf')](_0x3dae('0x11'),_0xbf252c,_0x9f8fe6);_0x321338(_0x9f8fe6);});});} \ No newline at end of file +var _0x1ad8=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x423d18,_0x3b302b){var _0x57ee5b=function(_0x465997){while(--_0x465997){_0x423d18['push'](_0x423d18['shift']());}};_0x57ee5b(++_0x3b302b);}(_0x1ad8,0x1a3));var _0x81ad=function(_0x2834f7,_0x5ff7b8){_0x2834f7=_0x2834f7-0x0;var _0x17188c=_0x1ad8[_0x2834f7];return _0x17188c;};'use strict';var _=require('lodash');var util=require(_0x81ad('0x0'));var moment=require('moment');var BPromise=require(_0x81ad('0x1'));var rs=require(_0x81ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81ad('0x3'))['db'];var utils=require(_0x81ad('0x4'));var logger=require(_0x81ad('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x81ad('0x6'));var client=jayson[_0x81ad('0x7')][_0x81ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc8bde0,_0x317a86,_0x1b88ba){return new BPromise(function(_0x586edd,_0xf51c09){return client['request'](_0xc8bde0,_0x1b88ba)[_0x81ad('0x9')](function(_0x3826e1){logger[_0x81ad('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x317a86,_0x81ad('0xb'));logger[_0x81ad('0xc')](_0x81ad('0xd'),_0x317a86,_0x81ad('0xb'),JSON['stringify'](_0x3826e1));if(_0x3826e1[_0x81ad('0xe')]){if(_0x3826e1['error'][_0x81ad('0xf')]===0x1f4){logger[_0x81ad('0xe')](_0x81ad('0x10'),_0x317a86,_0x3826e1[_0x81ad('0xe')]['message']);return _0xf51c09(_0x3826e1[_0x81ad('0xe')][_0x81ad('0x11')]);}logger[_0x81ad('0xe')](_0x81ad('0x10'),_0x317a86,_0x3826e1[_0x81ad('0xe')]['message']);return _0x586edd(_0x3826e1[_0x81ad('0xe')][_0x81ad('0x11')]);}else{logger[_0x81ad('0xa')](_0x81ad('0x10'),_0x317a86,_0x81ad('0xb'));_0x586edd(_0x3826e1[_0x81ad('0x12')][_0x81ad('0x11')]);}})[_0x81ad('0x13')](function(_0x3c1246){logger[_0x81ad('0xe')](_0x81ad('0x10'),_0x317a86,_0x3c1246);_0xf51c09(_0x3c1246);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index effd33d..dcb4feb 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 _0xbec5=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0x115d1f,_0xc8262){var _0x357a9e=function(_0x510cb1){while(--_0x510cb1){_0x115d1f['push'](_0x115d1f['shift']());}};_0x357a9e(++_0xc8262);}(_0xbec5,0xe5));var _0x5bec=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0xbec5[_0x409fb8];return _0x278270;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router['put'](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);module[_0x5bec('0x13')]=router; \ No newline at end of file +var _0xc3b0=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4498e5,_0x3fe4cd){var _0xe6628a=function(_0x597c57){while(--_0x597c57){_0x4498e5['push'](_0x4498e5['shift']());}};_0xe6628a(++_0x3fe4cd);}(_0xc3b0,0x166));var _0x0c3b=function(_0x5d77cd,_0x46ea40){_0x5d77cd=_0x5d77cd-0x0;var _0x385788=_0xc3b0[_0x5d77cd];return _0x385788;};'use strict';var multer=require(_0x0c3b('0x0'));var util=require(_0x0c3b('0x1'));var path=require(_0x0c3b('0x2'));var timeout=require(_0x0c3b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c3b('0x4'));var auth=require(_0x0c3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0c3b('0x6'));var controller=require(_0x0c3b('0x7'));router[_0x0c3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c3b('0x9')]);router[_0x0c3b('0x8')](_0x0c3b('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0c3b('0xb')](),controller[_0x0c3b('0xc')]);router[_0x0c3b('0xd')](_0x0c3b('0xa'),auth[_0x0c3b('0xb')](),controller[_0x0c3b('0xe')]);router[_0x0c3b('0xf')](_0x0c3b('0xa'),auth[_0x0c3b('0xb')](),controller[_0x0c3b('0x10')]);module[_0x0c3b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 236fe6e..5dc93b8 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 _0x715f=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x715f,0x91));var _0xf715=function(_0x25b4cc,_0x1186ff){_0x25b4cc=_0x25b4cc-0x0;var _0x1b1bc9=_0x715f[_0x25b4cc];return _0x1b1bc9;};'use strict';var Sequelize=require(_0xf715('0x0'));module[_0xf715('0x1')]={'type':{'type':Sequelize[_0xf715('0x2')]('string',_0xf715('0x3'),_0xf715('0x4'),_0xf715('0x5'),'picklist'),'defaultValue':_0xf715('0x6')},'content':{'type':Sequelize[_0xf715('0x7')]},'key':{'type':Sequelize[_0xf715('0x7')]},'keyType':{'type':Sequelize[_0xf715('0x2')](_0xf715('0x6'),_0xf715('0x3'),_0xf715('0x4'))},'keyContent':{'type':Sequelize[_0xf715('0x7')]},'idField':{'type':Sequelize[_0xf715('0x7')]},'nameField':{'type':Sequelize[_0xf715('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf715('0x7')]}}; \ No newline at end of file +var _0x1c6b=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x815b87,_0x270652){var _0x398960=function(_0x32aad2){while(--_0x32aad2){_0x815b87['push'](_0x815b87['shift']());}};_0x398960(++_0x270652);}(_0x1c6b,0x153));var _0xb1c6=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x1c6b[_0x54d49e];return _0x4af0f1;};'use strict';var Sequelize=require('sequelize');module[_0xb1c6('0x0')]={'type':{'type':Sequelize[_0xb1c6('0x1')](_0xb1c6('0x2'),_0xb1c6('0x3'),_0xb1c6('0x4'),'keyValue',_0xb1c6('0x5')),'defaultValue':_0xb1c6('0x2')},'content':{'type':Sequelize[_0xb1c6('0x6')]},'key':{'type':Sequelize[_0xb1c6('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb1c6('0x2'),_0xb1c6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xb1c6('0x6')]},'idField':{'type':Sequelize[_0xb1c6('0x6')]},'nameField':{'type':Sequelize[_0xb1c6('0x6')]},'customField':{'type':Sequelize[_0xb1c6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb1c6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7e9d16f..5d985d6 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 _0x8c75=['offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','catch','params','include','options','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8c75,0x166));var _0x58c7=function(_0x56f28a,_0xe14616){_0x56f28a=_0x56f28a-0x0;var _0x2e8484=_0x8c75[_0x56f28a];return _0x2e8484;};'use strict';var emlformat=require(_0x58c7('0x0'));var rimraf=require(_0x58c7('0x1'));var zipdir=require(_0x58c7('0x2'));var jsonpatch=require(_0x58c7('0x3'));var rp=require(_0x58c7('0x4'));var moment=require(_0x58c7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x58c7('0x6'));var util=require(_0x58c7('0x7'));var path=require(_0x58c7('0x8'));var sox=require(_0x58c7('0x9'));var csv=require(_0x58c7('0xa'));var ejs=require(_0x58c7('0xb'));var fs=require('fs');var fs_extra=require(_0x58c7('0xc'));var _=require(_0x58c7('0xd'));var squel=require('squel');var crypto=require(_0x58c7('0xe'));var jsforce=require(_0x58c7('0xf'));var deskjs=require(_0x58c7('0x10'));var toCsv=require(_0x58c7('0xa'));var querystring=require(_0x58c7('0x11'));var Papa=require(_0x58c7('0x12'));var Redis=require(_0x58c7('0x13'));var authService=require(_0x58c7('0x14'));var qs=require(_0x58c7('0x15'));var as=require(_0x58c7('0x16'));var hardwareService=require(_0x58c7('0x17'));var logger=require(_0x58c7('0x18'))(_0x58c7('0x19'));var utils=require('../../config/utils');var config=require(_0x58c7('0x1a'));var licenseUtil=require(_0x58c7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a0a74,_0x367508){_0x367508=_0x367508||0xcc;return function(_0x611243){if(_0x611243){return _0x3a0a74[_0x58c7('0x1c')](_0x367508);}return _0x3a0a74[_0x58c7('0x1d')](_0x367508)[_0x58c7('0x1e')]();};}function respondWithResult(_0x52ec0a,_0x5dc9b8){_0x5dc9b8=_0x5dc9b8||0xc8;return function(_0x1bfb61){if(_0x1bfb61){return _0x52ec0a[_0x58c7('0x1d')](_0x5dc9b8)[_0x58c7('0x1f')](_0x1bfb61);}};}function respondWithFilteredResult(_0x2b15d2,_0x468757){return function(_0x518f42){if(_0x518f42){var _0x5880d5=typeof _0x468757[_0x58c7('0x20')]===_0x58c7('0x21')&&typeof _0x468757[_0x58c7('0x22')]===_0x58c7('0x21');var _0x5ebdd0=_0x518f42['count'];var _0x1eebdc=_0x5880d5?0x0:_0x468757[_0x58c7('0x20')];var _0x94f073=_0x5880d5?_0x518f42[_0x58c7('0x23')]:_0x468757['offset']+_0x468757[_0x58c7('0x22')];var _0x16d125;if(_0x94f073>=_0x5ebdd0){_0x94f073=_0x5ebdd0;_0x16d125=0xc8;}else{_0x16d125=0xce;}_0x2b15d2[_0x58c7('0x1d')](_0x16d125);return _0x2b15d2['set'](_0x58c7('0x24'),_0x1eebdc+'-'+_0x94f073+'/'+_0x5ebdd0)['json'](_0x518f42);}return null;};}function patchUpdates(_0x652c9f){return function(_0x4503cc){try{jsonpatch[_0x58c7('0x25')](_0x4503cc,_0x652c9f,!![]);}catch(_0x1bcdda){return BPromise[_0x58c7('0x26')](_0x1bcdda);}return _0x4503cc[_0x58c7('0x27')]();};}function saveUpdates(_0x5621a7,_0x24bdf0){return function(_0x43f426){if(_0x43f426){return _0x43f426['update'](_0x5621a7)[_0x58c7('0x28')](function(_0xabcef1){return _0xabcef1;});}return null;};}function removeEntity(_0x157e59,_0x386d83){return function(_0x5485d9){if(_0x5485d9){return _0x5485d9[_0x58c7('0x29')]()['then'](function(){_0x157e59[_0x58c7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ea8ac,_0x3f18cf){return function(_0x108add){if(!_0x108add){_0x2ea8ac[_0x58c7('0x1c')](0x194);}return _0x108add;};}function handleError(_0x2c78e6,_0x37dcdd){_0x37dcdd=_0x37dcdd||0x1f4;return function(_0xda7e22){logger[_0x58c7('0x2a')](_0xda7e22[_0x58c7('0x2b')]);if(_0xda7e22[_0x58c7('0x2c')]){delete _0xda7e22[_0x58c7('0x2c')];}_0x2c78e6[_0x58c7('0x1d')](_0x37dcdd)[_0x58c7('0x2d')](_0xda7e22);};}exports[_0x58c7('0x2e')]=function(_0x107f08,_0x55014a){var _0x33aa3d={},_0x306749={},_0x5bd2e7={'count':0x0,'rows':[]};var _0x5a8684=_[_0x58c7('0x2f')](db[_0x58c7('0x30')][_0x58c7('0x31')],function(_0xb473aa){return{'name':_0xb473aa[_0x58c7('0x32')],'type':_0xb473aa[_0x58c7('0x33')][_0x58c7('0x34')]};});_0x306749['model']=_[_0x58c7('0x2f')](_0x5a8684,_0x58c7('0x2c'));_0x306749[_0x58c7('0x35')]=_[_0x58c7('0x36')](_0x107f08[_0x58c7('0x35')]);_0x306749[_0x58c7('0x37')]=_['intersection'](_0x306749['model'],_0x306749[_0x58c7('0x35')]);_0x33aa3d[_0x58c7('0x38')]=_[_0x58c7('0x39')](_0x306749[_0x58c7('0x3a')],qs[_0x58c7('0x3b')](_0x107f08[_0x58c7('0x35')][_0x58c7('0x3b')]));_0x33aa3d[_0x58c7('0x38')]=_0x33aa3d[_0x58c7('0x38')][_0x58c7('0x3c')]?_0x33aa3d[_0x58c7('0x38')]:_0x306749[_0x58c7('0x3a')];if(!_0x107f08[_0x58c7('0x35')][_0x58c7('0x3d')](_0x58c7('0x3e'))){_0x33aa3d['limit']=qs['limit'](_0x107f08['query']['limit']);_0x33aa3d[_0x58c7('0x20')]=qs['offset'](_0x107f08['query'][_0x58c7('0x20')]);}_0x33aa3d[_0x58c7('0x3f')]=qs[_0x58c7('0x40')](_0x107f08['query']['sort']);_0x33aa3d[_0x58c7('0x41')]=qs['filters'](_['pick'](_0x107f08['query'],_0x306749['filters']),_0x5a8684);if(_0x107f08[_0x58c7('0x35')][_0x58c7('0x42')]){_0x33aa3d[_0x58c7('0x41')]=_['merge'](_0x33aa3d[_0x58c7('0x41')],{'$or':_[_0x58c7('0x2f')](_0x5a8684,function(_0x17923f){if(_0x17923f[_0x58c7('0x33')]!==_0x58c7('0x43')){var _0x2f5aef={};_0x2f5aef[_0x17923f[_0x58c7('0x2c')]]={'$like':'%'+_0x107f08[_0x58c7('0x35')][_0x58c7('0x42')]+'%'};return _0x2f5aef;}})});}_0x33aa3d=_[_0x58c7('0x44')]({},_0x33aa3d,_0x107f08['options']);var _0x314c59={'where':_0x33aa3d['where']};return db[_0x58c7('0x30')][_0x58c7('0x23')](_0x314c59)[_0x58c7('0x28')](function(_0x4fcab4){_0x5bd2e7['count']=_0x4fcab4;if(_0x107f08['query'][_0x58c7('0x45')]){_0x33aa3d['include']=[{'all':!![]}];}return db[_0x58c7('0x30')]['findAll'](_0x33aa3d);})['then'](function(_0x311d64){_0x5bd2e7['rows']=_0x311d64;return _0x5bd2e7;})['then'](respondWithFilteredResult(_0x55014a,_0x33aa3d))[_0x58c7('0x46')](handleError(_0x55014a,null));};exports['show']=function(_0x25348c,_0x5d7468){var _0xd45739={'raw':!![],'where':{'id':_0x25348c[_0x58c7('0x47')]['id']}},_0x11f404={};_0x11f404[_0x58c7('0x3a')]=_[_0x58c7('0x36')](db[_0x58c7('0x30')][_0x58c7('0x31')]);_0x11f404['query']=_[_0x58c7('0x36')](_0x25348c[_0x58c7('0x35')]);_0x11f404[_0x58c7('0x37')]=_[_0x58c7('0x39')](_0x11f404[_0x58c7('0x3a')],_0x11f404[_0x58c7('0x35')]);_0xd45739[_0x58c7('0x38')]=_[_0x58c7('0x39')](_0x11f404[_0x58c7('0x3a')],qs['fields'](_0x25348c[_0x58c7('0x35')]['fields']));_0xd45739[_0x58c7('0x38')]=_0xd45739[_0x58c7('0x38')][_0x58c7('0x3c')]?_0xd45739[_0x58c7('0x38')]:_0x11f404[_0x58c7('0x3a')];if(_0x25348c['query'][_0x58c7('0x45')]){_0xd45739[_0x58c7('0x48')]=[{'all':!![]}];}_0xd45739=_[_0x58c7('0x44')]({},_0xd45739,_0x25348c[_0x58c7('0x49')]);return db[_0x58c7('0x30')][_0x58c7('0x4a')](_0xd45739)[_0x58c7('0x28')](handleEntityNotFound(_0x5d7468,null))[_0x58c7('0x28')](respondWithResult(_0x5d7468,null))['catch'](handleError(_0x5d7468,null));};exports['create']=function(_0x1041da,_0x1d4356){return db[_0x58c7('0x30')][_0x58c7('0x4b')](_0x1041da['body'],{})['then'](respondWithResult(_0x1d4356,0xc9))[_0x58c7('0x46')](handleError(_0x1d4356,null));};exports[_0x58c7('0x4c')]=function(_0x543450,_0x4b16c0){if(_0x543450[_0x58c7('0x4d')]['id']){delete _0x543450[_0x58c7('0x4d')]['id'];}return db[_0x58c7('0x30')][_0x58c7('0x4a')]({'where':{'id':_0x543450[_0x58c7('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b16c0,null))[_0x58c7('0x28')](saveUpdates(_0x543450['body'],null))[_0x58c7('0x28')](respondWithResult(_0x4b16c0,null))[_0x58c7('0x46')](handleError(_0x4b16c0,null));};exports[_0x58c7('0x29')]=function(_0x48fe06,_0x57d7e3){return db[_0x58c7('0x30')][_0x58c7('0x4a')]({'where':{'id':_0x48fe06[_0x58c7('0x47')]['id']}})[_0x58c7('0x28')](handleEntityNotFound(_0x57d7e3,null))[_0x58c7('0x28')](removeEntity(_0x57d7e3,null))['catch'](handleError(_0x57d7e3,null));}; \ No newline at end of file +var _0xd5fe=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','name','send','index','FreshsalesField','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','map','type','VIRTUAL','options','count','includeAll','include','show','keys','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd5fe,0x1e2));var _0xed5f=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0xd5fe[_0x11e03f];return _0x5666fe;};'use strict';var emlformat=require(_0xed5f('0x0'));var rimraf=require(_0xed5f('0x1'));var zipdir=require(_0xed5f('0x2'));var jsonpatch=require(_0xed5f('0x3'));var rp=require('request-promise');var moment=require(_0xed5f('0x4'));var BPromise=require(_0xed5f('0x5'));var Mustache=require(_0xed5f('0x6'));var util=require(_0xed5f('0x7'));var path=require(_0xed5f('0x8'));var sox=require(_0xed5f('0x9'));var csv=require(_0xed5f('0xa'));var ejs=require(_0xed5f('0xb'));var fs=require('fs');var fs_extra=require(_0xed5f('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed5f('0xd'));var deskjs=require(_0xed5f('0xe'));var toCsv=require(_0xed5f('0xa'));var querystring=require('querystring');var Papa=require(_0xed5f('0xf'));var Redis=require(_0xed5f('0x10'));var authService=require(_0xed5f('0x11'));var qs=require(_0xed5f('0x12'));var as=require(_0xed5f('0x13'));var hardwareService=require(_0xed5f('0x14'));var logger=require(_0xed5f('0x15'))(_0xed5f('0x16'));var utils=require(_0xed5f('0x17'));var config=require(_0xed5f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xed5f('0x19'))['db'];function respondWithStatusCode(_0x3917ac,_0x19a892){_0x19a892=_0x19a892||0xcc;return function(_0x575260){if(_0x575260){return _0x3917ac[_0xed5f('0x1a')](_0x19a892);}return _0x3917ac[_0xed5f('0x1b')](_0x19a892)[_0xed5f('0x1c')]();};}function respondWithResult(_0x37ed18,_0xeea88){_0xeea88=_0xeea88||0xc8;return function(_0x57ab0c){if(_0x57ab0c){return _0x37ed18['status'](_0xeea88)[_0xed5f('0x1d')](_0x57ab0c);}};}function respondWithFilteredResult(_0x4825a4,_0x33e011){return function(_0x21c1e4){if(_0x21c1e4){var _0x281434=typeof _0x33e011[_0xed5f('0x1e')]===_0xed5f('0x1f')&&typeof _0x33e011[_0xed5f('0x20')]==='undefined';var _0x21e7c0=_0x21c1e4['count'];var _0x237468=_0x281434?0x0:_0x33e011[_0xed5f('0x1e')];var _0x1bc7cb=_0x281434?_0x21c1e4['count']:_0x33e011[_0xed5f('0x1e')]+_0x33e011['limit'];var _0x383ed2;if(_0x1bc7cb>=_0x21e7c0){_0x1bc7cb=_0x21e7c0;_0x383ed2=0xc8;}else{_0x383ed2=0xce;}_0x4825a4[_0xed5f('0x1b')](_0x383ed2);return _0x4825a4[_0xed5f('0x21')](_0xed5f('0x22'),_0x237468+'-'+_0x1bc7cb+'/'+_0x21e7c0)[_0xed5f('0x1d')](_0x21c1e4);}return null;};}function patchUpdates(_0x4e9677){return function(_0x307a2f){try{jsonpatch[_0xed5f('0x23')](_0x307a2f,_0x4e9677,!![]);}catch(_0x2a2ca9){return BPromise[_0xed5f('0x24')](_0x2a2ca9);}return _0x307a2f['save']();};}function saveUpdates(_0x467eb0,_0x292d1c){return function(_0x18a60c){if(_0x18a60c){return _0x18a60c['update'](_0x467eb0)[_0xed5f('0x25')](function(_0x20fd82){return _0x20fd82;});}return null;};}function removeEntity(_0x4b3aac,_0x394646){return function(_0x4e87be){if(_0x4e87be){return _0x4e87be['destroy']()[_0xed5f('0x25')](function(){_0x4b3aac[_0xed5f('0x1b')](0xcc)[_0xed5f('0x1c')]();});}};}function handleEntityNotFound(_0x1e2410,_0x3b831b){return function(_0x2f8c9f){if(!_0x2f8c9f){_0x1e2410[_0xed5f('0x1a')](0x194);}return _0x2f8c9f;};}function handleError(_0x2ca4d4,_0x4da7b0){_0x4da7b0=_0x4da7b0||0x1f4;return function(_0x5123ce){logger['error'](_0x5123ce['stack']);if(_0x5123ce[_0xed5f('0x26')]){delete _0x5123ce[_0xed5f('0x26')];}_0x2ca4d4['status'](_0x4da7b0)[_0xed5f('0x27')](_0x5123ce);};}exports[_0xed5f('0x28')]=function(_0x1ce6ea,_0x276fdb){var _0x5ea665={},_0x58282b={},_0x2f8003={'count':0x0,'rows':[]};var _0x113871=_['map'](db[_0xed5f('0x29')][_0xed5f('0x2a')],function(_0x3a0d81){return{'name':_0x3a0d81[_0xed5f('0x2b')],'type':_0x3a0d81['type']['key']};});_0x58282b[_0xed5f('0x2c')]=_['map'](_0x113871,_0xed5f('0x26'));_0x58282b[_0xed5f('0x2d')]=_['keys'](_0x1ce6ea['query']);_0x58282b[_0xed5f('0x2e')]=_['intersection'](_0x58282b[_0xed5f('0x2c')],_0x58282b['query']);_0x5ea665[_0xed5f('0x2f')]=_[_0xed5f('0x30')](_0x58282b[_0xed5f('0x2c')],qs[_0xed5f('0x31')](_0x1ce6ea[_0xed5f('0x2d')][_0xed5f('0x31')]));_0x5ea665[_0xed5f('0x2f')]=_0x5ea665[_0xed5f('0x2f')][_0xed5f('0x32')]?_0x5ea665[_0xed5f('0x2f')]:_0x58282b[_0xed5f('0x2c')];if(!_0x1ce6ea[_0xed5f('0x2d')][_0xed5f('0x33')](_0xed5f('0x34'))){_0x5ea665['limit']=qs['limit'](_0x1ce6ea['query'][_0xed5f('0x20')]);_0x5ea665[_0xed5f('0x1e')]=qs[_0xed5f('0x1e')](_0x1ce6ea[_0xed5f('0x2d')][_0xed5f('0x1e')]);}_0x5ea665['order']=qs[_0xed5f('0x35')](_0x1ce6ea['query'][_0xed5f('0x35')]);_0x5ea665['where']=qs[_0xed5f('0x2e')](_['pick'](_0x1ce6ea['query'],_0x58282b[_0xed5f('0x2e')]),_0x113871);if(_0x1ce6ea['query'][_0xed5f('0x36')]){_0x5ea665[_0xed5f('0x37')]=_[_0xed5f('0x38')](_0x5ea665[_0xed5f('0x37')],{'$or':_[_0xed5f('0x39')](_0x113871,function(_0x2e62ee){if(_0x2e62ee[_0xed5f('0x3a')]!==_0xed5f('0x3b')){var _0x43d34f={};_0x43d34f[_0x2e62ee[_0xed5f('0x26')]]={'$like':'%'+_0x1ce6ea[_0xed5f('0x2d')][_0xed5f('0x36')]+'%'};return _0x43d34f;}})});}_0x5ea665=_[_0xed5f('0x38')]({},_0x5ea665,_0x1ce6ea[_0xed5f('0x3c')]);var _0x3f89b5={'where':_0x5ea665[_0xed5f('0x37')]};return db[_0xed5f('0x29')][_0xed5f('0x3d')](_0x3f89b5)[_0xed5f('0x25')](function(_0x5ace5f){_0x2f8003[_0xed5f('0x3d')]=_0x5ace5f;if(_0x1ce6ea[_0xed5f('0x2d')][_0xed5f('0x3e')]){_0x5ea665[_0xed5f('0x3f')]=[{'all':!![]}];}return db[_0xed5f('0x29')]['findAll'](_0x5ea665);})[_0xed5f('0x25')](function(_0x1110cc){_0x2f8003['rows']=_0x1110cc;return _0x2f8003;})['then'](respondWithFilteredResult(_0x276fdb,_0x5ea665))['catch'](handleError(_0x276fdb,null));};exports[_0xed5f('0x40')]=function(_0x43c3b3,_0x3ed60c){var _0x4f8aba={'raw':!![],'where':{'id':_0x43c3b3['params']['id']}},_0x4ed897={};_0x4ed897['model']=_['keys'](db[_0xed5f('0x29')][_0xed5f('0x2a')]);_0x4ed897[_0xed5f('0x2d')]=_[_0xed5f('0x41')](_0x43c3b3[_0xed5f('0x2d')]);_0x4ed897[_0xed5f('0x2e')]=_['intersection'](_0x4ed897['model'],_0x4ed897[_0xed5f('0x2d')]);_0x4f8aba[_0xed5f('0x2f')]=_['intersection'](_0x4ed897['model'],qs[_0xed5f('0x31')](_0x43c3b3['query'][_0xed5f('0x31')]));_0x4f8aba[_0xed5f('0x2f')]=_0x4f8aba['attributes'][_0xed5f('0x32')]?_0x4f8aba[_0xed5f('0x2f')]:_0x4ed897[_0xed5f('0x2c')];if(_0x43c3b3[_0xed5f('0x2d')][_0xed5f('0x3e')]){_0x4f8aba[_0xed5f('0x3f')]=[{'all':!![]}];}_0x4f8aba=_[_0xed5f('0x38')]({},_0x4f8aba,_0x43c3b3[_0xed5f('0x3c')]);return db[_0xed5f('0x29')][_0xed5f('0x42')](_0x4f8aba)[_0xed5f('0x25')](handleEntityNotFound(_0x3ed60c,null))[_0xed5f('0x25')](respondWithResult(_0x3ed60c,null))[_0xed5f('0x43')](handleError(_0x3ed60c,null));};exports['create']=function(_0x54b0b8,_0x55b6b6){return db[_0xed5f('0x29')][_0xed5f('0x44')](_0x54b0b8[_0xed5f('0x45')],{})[_0xed5f('0x25')](respondWithResult(_0x55b6b6,0xc9))[_0xed5f('0x43')](handleError(_0x55b6b6,null));};exports[_0xed5f('0x46')]=function(_0x4e34b4,_0x4ec2ae){if(_0x4e34b4['body']['id']){delete _0x4e34b4['body']['id'];}return db['FreshsalesField'][_0xed5f('0x42')]({'where':{'id':_0x4e34b4[_0xed5f('0x47')]['id']}})[_0xed5f('0x25')](handleEntityNotFound(_0x4ec2ae,null))[_0xed5f('0x25')](saveUpdates(_0x4e34b4[_0xed5f('0x45')],null))[_0xed5f('0x25')](respondWithResult(_0x4ec2ae,null))[_0xed5f('0x43')](handleError(_0x4ec2ae,null));};exports['destroy']=function(_0x56069e,_0x153282){return db['FreshsalesField'][_0xed5f('0x42')]({'where':{'id':_0x56069e[_0xed5f('0x47')]['id']}})[_0xed5f('0x25')](handleEntityNotFound(_0x153282,null))[_0xed5f('0x25')](removeEntity(_0x153282,null))[_0xed5f('0x43')](handleError(_0x153282,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index be9eae0..9dd74fb 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 _0xb982=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0xb982,0x15e));var _0x2b98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb982[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b98('0x0'))(_0x2b98('0x1'));var moment=require(_0x2b98('0x2'));var BPromise=require(_0x2b98('0x3'));var rp=require(_0x2b98('0x4'));var fs=require('fs');var path=require(_0x2b98('0x5'));var rimraf=require(_0x2b98('0x6'));var config=require(_0x2b98('0x7'));var attributes=require(_0x2b98('0x8'));module[_0x2b98('0x9')]=function(_0x55f7b8,_0xe2657d){return _0x55f7b8[_0x2b98('0xa')](_0x2b98('0xb'),attributes,{'tableName':_0x2b98('0xc'),'paranoid':![],'indexes':[{'name':_0x2b98('0xd'),'fields':[_0x2b98('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['define','FreshsalesField','int_freshsales_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intFreshsalesField.attributes','exports'];(function(_0x148c24,_0x57d4c3){var _0x2a7dae=function(_0x3cb019){while(--_0x3cb019){_0x148c24['push'](_0x148c24['shift']());}};_0x2a7dae(++_0x57d4c3);}(_0x0424,0x159));var _0x4042=function(_0x287eaf,_0x41d318){_0x287eaf=_0x287eaf-0x0;var _0x321683=_0x0424[_0x287eaf];return _0x321683;};'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':[{'name':'freshsales_unique_index','fields':['idField',_0x4042('0xa')],'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 43cf7ac..84b964f 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 _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3fd84a,_0x33ac7d){var _0x1947c7=function(_0x41b56b){while(--_0x41b56b){_0x3fd84a['push'](_0x3fd84a['shift']());}};_0x1947c7(++_0x33ac7d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x33f04a,_0x8a2824){var _0x554091=function(_0x4ce092){while(--_0x4ce092){_0x33f04a['push'](_0x33f04a['shift']());}};_0x554091(++_0x8a2824);}(_0x2a07,0x74));var _0x72a0=function(_0x25dd3b,_0x27e043){_0x25dd3b=_0x25dd3b-0x0;var _0x3084aa=_0x2a07[_0x25dd3b];return _0x3084aa;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3b1b392..4e9188d 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(_0x40e25b,_0x1fa1b5){var _0x1831a2=function(_0x125059){while(--_0x125059){_0x40e25b['push'](_0x40e25b['shift']());}};_0x1831a2(++_0x1fa1b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x305f64,_0x1cb4dc){var _0x51020b=function(_0x55af0b){while(--_0x55af0b){_0x305f64['push'](_0x305f64['shift']());}};_0x51020b(++_0x1cb4dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 8d30821..ca3975f 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 _0x0699=['newTab','sequelize','STRING','username','ENUM','integrationTab'];(function(_0x8f2550,_0x2d3f5d){var _0x38c830=function(_0x2c2682){while(--_0x2c2682){_0x8f2550['push'](_0x8f2550['shift']());}};_0x38c830(++_0x2d3f5d);}(_0x0699,0x1db));var _0x9069=function(_0x2a50fd,_0x441e81){_0x2a50fd=_0x2a50fd-0x0;var _0x4b9777=_0x0699[_0x2a50fd];return _0x4b9777;};'use strict';var Sequelize=require(_0x9069('0x0'));module['exports']={'name':{'type':Sequelize[_0x9069('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9069('0x1')],'unique':_0x9069('0x2')},'remoteUri':{'type':Sequelize[_0x9069('0x1')]},'password':{'type':Sequelize[_0x9069('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x9069('0x1')]},'securityToken':{'type':Sequelize[_0x9069('0x1')]},'serverUrl':{'type':Sequelize[_0x9069('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9069('0x3')](_0x9069('0x4'),_0x9069('0x5')),'defaultValue':_0x9069('0x4')}}; \ No newline at end of file +var _0x7711=['integrationTab','sequelize','exports','STRING','username','newTab'];(function(_0x451f4f,_0x35e617){var _0x17d725=function(_0x26bbd6){while(--_0x26bbd6){_0x451f4f['push'](_0x451f4f['shift']());}};_0x17d725(++_0x35e617);}(_0x7711,0xf7));var _0x1771=function(_0x3b308d,_0x217672){_0x3b308d=_0x3b308d-0x0;var _0x4bff85=_0x7711[_0x3b308d];return _0x4bff85;};'use strict';var Sequelize=require(_0x1771('0x0'));module[_0x1771('0x1')]={'name':{'type':Sequelize[_0x1771('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x1771('0x3')},'remoteUri':{'type':Sequelize[_0x1771('0x2')]},'password':{'type':Sequelize[_0x1771('0x2')]},'clientId':{'type':Sequelize[_0x1771('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x1771('0x2')]},'serverUrl':{'type':Sequelize[_0x1771('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x1771('0x4')),'defaultValue':_0x1771('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0d33162..c0d68a8 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 _0x04dc=['apply','reject','save','destroy','sendStatus','error','stack','name','index','map','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','SalesforceAccount','then','includeAll','include','catch','show','params','rawAttributes','create','update','body','find','findOne','SalesforceConfiguration','order','pick','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','slice','substring','lastIndexOf','Connection','concat','securityToken','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','Subject','string','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set'];(function(_0xb4a044,_0x72c7ae){var _0x2a75f0=function(_0x3e77c3){while(--_0x3e77c3){_0xb4a044['push'](_0xb4a044['shift']());}};_0x2a75f0(++_0x72c7ae);}(_0x04dc,0xd2));var _0xc04d=function(_0x5a65c1,_0xea1e75){_0x5a65c1=_0x5a65c1-0x0;var _0x346660=_0x04dc[_0x5a65c1];return _0x346660;};'use strict';var emlformat=require(_0xc04d('0x0'));var rimraf=require(_0xc04d('0x1'));var zipdir=require(_0xc04d('0x2'));var jsonpatch=require(_0xc04d('0x3'));var rp=require(_0xc04d('0x4'));var moment=require(_0xc04d('0x5'));var BPromise=require(_0xc04d('0x6'));var Mustache=require(_0xc04d('0x7'));var util=require(_0xc04d('0x8'));var path=require('path');var sox=require(_0xc04d('0x9'));var csv=require(_0xc04d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc04d('0xb'));var squel=require(_0xc04d('0xc'));var crypto=require(_0xc04d('0xd'));var jsforce=require(_0xc04d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc04d('0xa'));var querystring=require(_0xc04d('0xf'));var Papa=require(_0xc04d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc04d('0x11'));var as=require(_0xc04d('0x12'));var hardwareService=require(_0xc04d('0x13'));var logger=require(_0xc04d('0x14'))('api');var utils=require(_0xc04d('0x15'));var config=require(_0xc04d('0x16'));var licenseUtil=require(_0xc04d('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43bf42,_0xd07e5b){_0xd07e5b=_0xd07e5b||0xcc;return function(_0x488560){if(_0x488560){return _0x43bf42['sendStatus'](_0xd07e5b);}return _0x43bf42['status'](_0xd07e5b)[_0xc04d('0x18')]();};}function respondWithResult(_0x292970,_0x178fcc){_0x178fcc=_0x178fcc||0xc8;return function(_0x7b8ed8){if(_0x7b8ed8){return _0x292970[_0xc04d('0x19')](_0x178fcc)[_0xc04d('0x1a')](_0x7b8ed8);}};}function respondWithFilteredResult(_0x414f31,_0xd8855){return function(_0x34a106){if(_0x34a106){var _0x48f962=typeof _0xd8855[_0xc04d('0x1b')]===_0xc04d('0x1c')&&typeof _0xd8855[_0xc04d('0x1d')]===_0xc04d('0x1c');var _0x4ee239=_0x34a106['count'];var _0x46aadb=_0x48f962?0x0:_0xd8855[_0xc04d('0x1b')];var _0x5b0531=_0x48f962?_0x34a106[_0xc04d('0x1e')]:_0xd8855[_0xc04d('0x1b')]+_0xd8855['limit'];var _0x2f5de4;if(_0x5b0531>=_0x4ee239){_0x5b0531=_0x4ee239;_0x2f5de4=0xc8;}else{_0x2f5de4=0xce;}_0x414f31[_0xc04d('0x19')](_0x2f5de4);return _0x414f31[_0xc04d('0x1f')]('Content-Range',_0x46aadb+'-'+_0x5b0531+'/'+_0x4ee239)[_0xc04d('0x1a')](_0x34a106);}return null;};}function patchUpdates(_0x52b119){return function(_0x2d9113){try{jsonpatch[_0xc04d('0x20')](_0x2d9113,_0x52b119,!![]);}catch(_0x476262){return BPromise[_0xc04d('0x21')](_0x476262);}return _0x2d9113[_0xc04d('0x22')]();};}function saveUpdates(_0x4a036d,_0x334f7c){return function(_0x430b61){if(_0x430b61){return _0x430b61['update'](_0x4a036d)['then'](function(_0x2c684f){return _0x2c684f;});}return null;};}function removeEntity(_0xf3e94,_0x21dca3){return function(_0x4a4898){if(_0x4a4898){return _0x4a4898[_0xc04d('0x23')]()['then'](function(){_0xf3e94['status'](0xcc)[_0xc04d('0x18')]();});}};}function handleEntityNotFound(_0x2f190f,_0xf5d3d2){return function(_0x344764){if(!_0x344764){_0x2f190f[_0xc04d('0x24')](0x194);}return _0x344764;};}function handleError(_0x13adfc,_0x5958ac){_0x5958ac=_0x5958ac||0x1f4;return function(_0x131476){logger[_0xc04d('0x25')](_0x131476[_0xc04d('0x26')]);if(_0x131476[_0xc04d('0x27')]){delete _0x131476[_0xc04d('0x27')];}_0x13adfc[_0xc04d('0x19')](_0x5958ac)['send'](_0x131476);};}exports[_0xc04d('0x28')]=function(_0x1d0762,_0x227aba){var _0x56c197={},_0x244e99={},_0x46124b={'count':0x0,'rows':[]};var _0x5dd66b=_[_0xc04d('0x29')](db['SalesforceAccount']['rawAttributes'],function(_0xbe7064){return{'name':_0xbe7064[_0xc04d('0x2a')],'type':_0xbe7064[_0xc04d('0x2b')][_0xc04d('0x2c')]};});_0x244e99['model']=_[_0xc04d('0x29')](_0x5dd66b,_0xc04d('0x27'));_0x244e99['query']=_[_0xc04d('0x2d')](_0x1d0762[_0xc04d('0x2e')]);_0x244e99[_0xc04d('0x2f')]=_[_0xc04d('0x30')](_0x244e99['model'],_0x244e99['query']);_0x56c197['attributes']=_[_0xc04d('0x30')](_0x244e99[_0xc04d('0x31')],qs[_0xc04d('0x32')](_0x1d0762['query'][_0xc04d('0x32')]));_0x56c197[_0xc04d('0x33')]=_0x56c197[_0xc04d('0x33')][_0xc04d('0x34')]?_0x56c197[_0xc04d('0x33')]:_0x244e99['model'];if(!_0x1d0762[_0xc04d('0x2e')][_0xc04d('0x35')](_0xc04d('0x36'))){_0x56c197[_0xc04d('0x1d')]=qs[_0xc04d('0x1d')](_0x1d0762[_0xc04d('0x2e')]['limit']);_0x56c197['offset']=qs['offset'](_0x1d0762[_0xc04d('0x2e')][_0xc04d('0x1b')]);}_0x56c197['order']=qs[_0xc04d('0x37')](_0x1d0762[_0xc04d('0x2e')][_0xc04d('0x37')]);_0x56c197[_0xc04d('0x38')]=qs[_0xc04d('0x2f')](_['pick'](_0x1d0762[_0xc04d('0x2e')],_0x244e99[_0xc04d('0x2f')]),_0x5dd66b);if(_0x1d0762[_0xc04d('0x2e')]['filter']){_0x56c197[_0xc04d('0x38')]=_['merge'](_0x56c197[_0xc04d('0x38')],{'$or':_[_0xc04d('0x29')](_0x5dd66b,function(_0x25377c){if(_0x25377c['type']!==_0xc04d('0x39')){var _0x1028f8={};_0x1028f8[_0x25377c['name']]={'$like':'%'+_0x1d0762['query'][_0xc04d('0x3a')]+'%'};return _0x1028f8;}})});}_0x56c197=_[_0xc04d('0x3b')]({},_0x56c197,_0x1d0762[_0xc04d('0x3c')]);var _0x1f1766={'where':_0x56c197['where']};return db[_0xc04d('0x3d')][_0xc04d('0x1e')](_0x1f1766)[_0xc04d('0x3e')](function(_0x1254c5){_0x46124b[_0xc04d('0x1e')]=_0x1254c5;if(_0x1d0762['query'][_0xc04d('0x3f')]){_0x56c197[_0xc04d('0x40')]=[{'all':!![]}];}return db[_0xc04d('0x3d')]['findAll'](_0x56c197);})['then'](function(_0x11d2b1){_0x46124b['rows']=_0x11d2b1;return _0x46124b;})[_0xc04d('0x3e')](respondWithFilteredResult(_0x227aba,_0x56c197))[_0xc04d('0x41')](handleError(_0x227aba,null));};exports[_0xc04d('0x42')]=function(_0x161826,_0x4ebbe8){var _0x2a8324={'raw':![],'where':{'id':_0x161826[_0xc04d('0x43')]['id']}},_0x324bd9={};_0x324bd9['model']=_[_0xc04d('0x2d')](db[_0xc04d('0x3d')][_0xc04d('0x44')]);_0x324bd9[_0xc04d('0x2e')]=_[_0xc04d('0x2d')](_0x161826[_0xc04d('0x2e')]);_0x324bd9[_0xc04d('0x2f')]=_[_0xc04d('0x30')](_0x324bd9[_0xc04d('0x31')],_0x324bd9[_0xc04d('0x2e')]);_0x2a8324[_0xc04d('0x33')]=_[_0xc04d('0x30')](_0x324bd9[_0xc04d('0x31')],qs['fields'](_0x161826[_0xc04d('0x2e')][_0xc04d('0x32')]));_0x2a8324[_0xc04d('0x33')]=_0x2a8324[_0xc04d('0x33')][_0xc04d('0x34')]?_0x2a8324[_0xc04d('0x33')]:_0x324bd9[_0xc04d('0x31')];if(_0x161826[_0xc04d('0x2e')][_0xc04d('0x3f')]){_0x2a8324[_0xc04d('0x40')]=[{'all':!![]}];}_0x2a8324=_[_0xc04d('0x3b')]({},_0x2a8324,_0x161826['options']);return db['SalesforceAccount']['find'](_0x2a8324)[_0xc04d('0x3e')](handleEntityNotFound(_0x4ebbe8,null))[_0xc04d('0x3e')](respondWithResult(_0x4ebbe8,null))[_0xc04d('0x41')](handleError(_0x4ebbe8,null));};exports[_0xc04d('0x45')]=function(_0x3b7e0a,_0x53ee11){return db['SalesforceAccount'][_0xc04d('0x45')](_0x3b7e0a['body'],{})[_0xc04d('0x3e')](respondWithResult(_0x53ee11,0xc9))['catch'](handleError(_0x53ee11,null));};exports[_0xc04d('0x46')]=function(_0x25f096,_0x34f13a){if(_0x25f096[_0xc04d('0x47')]['id']){delete _0x25f096[_0xc04d('0x47')]['id'];}return db['SalesforceAccount'][_0xc04d('0x48')]({'where':{'id':_0x25f096[_0xc04d('0x43')]['id']}})[_0xc04d('0x3e')](handleEntityNotFound(_0x34f13a,null))[_0xc04d('0x3e')](saveUpdates(_0x25f096['body'],null))[_0xc04d('0x3e')](respondWithResult(_0x34f13a,null))[_0xc04d('0x41')](handleError(_0x34f13a,null));};exports[_0xc04d('0x23')]=function(_0xc5369,_0x55e213){return db['SalesforceAccount']['find']({'where':{'id':_0xc5369[_0xc04d('0x43')]['id']}})[_0xc04d('0x3e')](handleEntityNotFound(_0x55e213,null))[_0xc04d('0x3e')](removeEntity(_0x55e213,null))[_0xc04d('0x41')](handleError(_0x55e213,null));};exports['getConfigurations']=function(_0x436cfd,_0x4f9990,_0x3efc60){var _0x109d16={};var _0x1bc71e={};var _0x42d8cc;var _0x5f5996;return db[_0xc04d('0x3d')][_0xc04d('0x49')]({'where':{'id':_0x436cfd[_0xc04d('0x43')]['id']}})[_0xc04d('0x3e')](handleEntityNotFound(_0x4f9990,null))[_0xc04d('0x3e')](function(_0xb81508){if(_0xb81508){_0x42d8cc=_0xb81508;_0x1bc71e[_0xc04d('0x31')]=_['keys'](db[_0xc04d('0x4a')][_0xc04d('0x44')]);_0x1bc71e[_0xc04d('0x2e')]=_[_0xc04d('0x2d')](_0x436cfd[_0xc04d('0x2e')]);_0x1bc71e[_0xc04d('0x2f')]=_[_0xc04d('0x30')](_0x1bc71e[_0xc04d('0x31')],_0x1bc71e['query']);_0x109d16[_0xc04d('0x33')]=_[_0xc04d('0x30')](_0x1bc71e[_0xc04d('0x31')],qs['fields'](_0x436cfd[_0xc04d('0x2e')][_0xc04d('0x32')]));_0x109d16['attributes']=_0x109d16[_0xc04d('0x33')][_0xc04d('0x34')]?_0x109d16[_0xc04d('0x33')]:_0x1bc71e[_0xc04d('0x31')];_0x109d16[_0xc04d('0x4b')]=qs[_0xc04d('0x37')](_0x436cfd[_0xc04d('0x2e')][_0xc04d('0x37')]);_0x109d16['where']=qs[_0xc04d('0x2f')](_[_0xc04d('0x4c')](_0x436cfd[_0xc04d('0x2e')],_0x1bc71e[_0xc04d('0x2f')]));if(_0x436cfd[_0xc04d('0x2e')][_0xc04d('0x3a')]){_0x109d16[_0xc04d('0x38')]=_[_0xc04d('0x3b')](_0x109d16['where'],{'$or':_[_0xc04d('0x29')](_0x109d16['attributes'],function(_0x2be0dd){var _0x10eae6={};_0x10eae6[_0x2be0dd]={'$like':'%'+_0x436cfd[_0xc04d('0x2e')][_0xc04d('0x3a')]+'%'};return _0x10eae6;})});}_0x109d16=_[_0xc04d('0x3b')]({},_0x109d16,_0x436cfd[_0xc04d('0x3c')]);return _0x42d8cc[_0xc04d('0x4d')](_0x109d16);}})[_0xc04d('0x3e')](function(_0x252fa8){if(_0x252fa8){_0x5f5996=_0x252fa8[_0xc04d('0x34')];if(!_0x436cfd[_0xc04d('0x2e')][_0xc04d('0x35')](_0xc04d('0x36'))){_0x109d16[_0xc04d('0x1d')]=qs['limit'](_0x436cfd['query'][_0xc04d('0x1d')]);_0x109d16['offset']=qs[_0xc04d('0x1b')](_0x436cfd[_0xc04d('0x2e')][_0xc04d('0x1b')]);}return _0x42d8cc[_0xc04d('0x4d')](_0x109d16);}})[_0xc04d('0x3e')](function(_0x50d981){if(_0x50d981){return _0x50d981?{'count':_0x5f5996,'rows':_0x50d981}:null;}})[_0xc04d('0x3e')](respondWithResult(_0x4f9990,null))[_0xc04d('0x41')](handleError(_0x4f9990,null));};exports[_0xc04d('0x4e')]=function(_0x424c39,_0x4d164e,_0x5b5e2a){if(_0x424c39[_0xc04d('0x47')]['id']){delete _0x424c39['body']['id'];}return db[_0xc04d('0x3d')][_0xc04d('0x49')]({'where':{'id':_0x424c39[_0xc04d('0x43')]['id']}})[_0xc04d('0x3e')](handleEntityNotFound(_0x4d164e,null))[_0xc04d('0x3e')](function(_0x13e7c8){if(_0x13e7c8){_0x424c39[_0xc04d('0x47')][_0xc04d('0x4f')]=_0x13e7c8['id'];_0x424c39[_0xc04d('0x47')][_0xc04d('0x50')]=integrations['getSubjects'](_0x424c39[_0xc04d('0x47')][_0xc04d('0x51')],_0x424c39['body'][_0xc04d('0x2b')]);_0x424c39[_0xc04d('0x47')][_0xc04d('0x52')]=integrations['getDescriptions'](_0x424c39['body'][_0xc04d('0x51')],_0x424c39[_0xc04d('0x47')]['type']);return db[_0xc04d('0x4a')][_0xc04d('0x45')](_0x424c39[_0xc04d('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0xc04d('0x50')},{'model':db[_0xc04d('0x53')],'as':_0xc04d('0x52')}]});}return null;})[_0xc04d('0x3e')](respondWithResult(_0x4d164e,null))[_0xc04d('0x41')](handleError(_0x4d164e,null));};exports[_0xc04d('0x54')]=function(_0x5beb2d,_0x47fcdd,_0x144d21){var _0x37302f;var _0x4abde6='';var _0x156b5a=_0xc04d('0x55');return db[_0xc04d('0x3d')][_0xc04d('0x49')]({'where':{'id':_0x5beb2d['params']['id']},'attributes':['id',_0xc04d('0x56'),_0xc04d('0x57'),_0xc04d('0x58'),_0xc04d('0x59'),'password','securityToken']})[_0xc04d('0x3e')](handleEntityNotFound(_0x47fcdd,null))[_0xc04d('0x3e')](function(_0x539f12){if(_0x539f12){_0x4abde6=_0x539f12[_0xc04d('0x56')];var _0x4f2f2f=_0x4abde6[_0xc04d('0x5a')](-0x1);if(_0x4f2f2f==='/'){_0x4abde6=_0x4abde6[_0xc04d('0x5b')](0x0,_0x4abde6[_0xc04d('0x5c')](_0x4f2f2f));}_0x37302f=new jsforce[(_0xc04d('0x5d'))]({'oauth2':{'loginUrl':_0x4abde6,'clientId':_0x539f12[_0xc04d('0x57')],'clientSecret':_0x539f12[_0xc04d('0x58')]}});return _0x37302f['login'](_0x539f12['username'],_0x539f12['password'][_0xc04d('0x5e')](_0x539f12[_0xc04d('0x5f')]));}})[_0xc04d('0x3e')](function(_0xe5dc4c){if(_0xe5dc4c){if(!_[_0xc04d('0x60')](_0x5beb2d[_0xc04d('0x2e')][_0xc04d('0x61')])){_0x156b5a=_0x5beb2d[_0xc04d('0x2e')][_0xc04d('0x61')];}return _0x37302f[_0xc04d('0x62')](_0x156b5a)['describe']();}})[_0xc04d('0x3e')](function(_0x9405f6){var _0x3a33b8=[_0xc04d('0x63'),_0xc04d('0x64'),_0xc04d('0x65'),'IsRecurrence',_0xc04d('0x66'),'Description'];var _0x41fd8d=[_0xc04d('0x67'),'int',_0xc04d('0x68'),_0xc04d('0x69'),_0xc04d('0x6a'),'textarea',_0xc04d('0x6b')];if(_0x9405f6){_[_0xc04d('0x6c')](_0x9405f6['fields'],function(_0x4d3443){return _0x3a33b8[_0xc04d('0x6d')](_0x4d3443['name'])||!_0x41fd8d[_0xc04d('0x6d')](_0x4d3443[_0xc04d('0x2b')]);});return{'count':_0x9405f6[_0xc04d('0x32')][_0xc04d('0x34')],'rows':_[_0xc04d('0x29')](_0x9405f6['fields'],function(_0x733d63){return{'id':_0x733d63['name'],'name':_0x733d63[_0xc04d('0x6e')],'custom':_0x733d63[_0xc04d('0x6f')],'options':_0x733d63['picklistValues'][_0xc04d('0x34')]>0x0?_[_0xc04d('0x29')](_0x733d63[_0xc04d('0x70')],function(_0x9c139a){return{'name':_0x9c139a['label'],'value':_0x9c139a[_0xc04d('0x71')]};}):_0x733d63[_0xc04d('0x2b')]=='boolean'?[{'name':_0xc04d('0x72'),'value':'true'},{'name':_0xc04d('0x73'),'value':_0xc04d('0x74')}]:[]};})};}})[_0xc04d('0x3e')](respondWithResult(_0x47fcdd,null))[_0xc04d('0x41')](function(_0x4384dc){var _0x34237a=_0x5beb2d['query'][_0xc04d('0x75')]?0x1f4:_0x4384dc[_0xc04d('0x76')]||0x1f4;logger[_0xc04d('0x25')](_0xc04d('0x77'),'getFields',_0x34237a,JSON[_0xc04d('0x78')](_0x4384dc));delete _0x4384dc[_0xc04d('0x27')];if(_0x34237a===0x191){_0x34237a=0x190;}_0x47fcdd[_0xc04d('0x19')](_0x34237a)['send'](_0x5beb2d[_0xc04d('0x2e')][_0xc04d('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x4384dc['statusCode']}:_0x4384dc);});}; \ No newline at end of file +var _0xdbe9=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','index','SalesforceAccount','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','catch','body','getConfigurations','findOne','SalesforceConfiguration','rawAttributes','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','Task','clientId','clientSecret','username','password','remoteUri','slice','substring','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','string','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf'];(function(_0x57c642,_0x1f8e14){var _0x28e542=function(_0x34448e){while(--_0x34448e){_0x57c642['push'](_0x57c642['shift']());}};_0x28e542(++_0x1f8e14);}(_0xdbe9,0x7a));var _0x9dbe=function(_0x57f24f,_0x400991){_0x57f24f=_0x57f24f-0x0;var _0x21c986=_0xdbe9[_0x57f24f];return _0x21c986;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbe('0x0'));var zipdir=require(_0x9dbe('0x1'));var jsonpatch=require(_0x9dbe('0x2'));var rp=require(_0x9dbe('0x3'));var moment=require(_0x9dbe('0x4'));var BPromise=require(_0x9dbe('0x5'));var Mustache=require('mustache');var util=require(_0x9dbe('0x6'));var path=require(_0x9dbe('0x7'));var sox=require('sox');var csv=require(_0x9dbe('0x8'));var ejs=require(_0x9dbe('0x9'));var fs=require('fs');var fs_extra=require(_0x9dbe('0xa'));var _=require(_0x9dbe('0xb'));var squel=require('squel');var crypto=require(_0x9dbe('0xc'));var jsforce=require(_0x9dbe('0xd'));var deskjs=require(_0x9dbe('0xe'));var toCsv=require(_0x9dbe('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9dbe('0xf'));var authService=require(_0x9dbe('0x10'));var qs=require(_0x9dbe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dbe('0x12'));var logger=require(_0x9dbe('0x13'))(_0x9dbe('0x14'));var utils=require(_0x9dbe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9dbe('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9dbe('0x17'));function respondWithStatusCode(_0x442c95,_0x4fdcfe){_0x4fdcfe=_0x4fdcfe||0xcc;return function(_0x22a29e){if(_0x22a29e){return _0x442c95[_0x9dbe('0x18')](_0x4fdcfe);}return _0x442c95['status'](_0x4fdcfe)[_0x9dbe('0x19')]();};}function respondWithResult(_0x5e4ca6,_0x284faf){_0x284faf=_0x284faf||0xc8;return function(_0x84a350){if(_0x84a350){return _0x5e4ca6['status'](_0x284faf)['json'](_0x84a350);}};}function respondWithFilteredResult(_0x535884,_0xe80808){return function(_0x16df1a){if(_0x16df1a){var _0x741b41=typeof _0xe80808[_0x9dbe('0x1a')]===_0x9dbe('0x1b')&&typeof _0xe80808[_0x9dbe('0x1c')]==='undefined';var _0xe265a7=_0x16df1a[_0x9dbe('0x1d')];var _0x38ab1d=_0x741b41?0x0:_0xe80808[_0x9dbe('0x1a')];var _0x4b5898=_0x741b41?_0x16df1a['count']:_0xe80808['offset']+_0xe80808[_0x9dbe('0x1c')];var _0x1916c6;if(_0x4b5898>=_0xe265a7){_0x4b5898=_0xe265a7;_0x1916c6=0xc8;}else{_0x1916c6=0xce;}_0x535884[_0x9dbe('0x1e')](_0x1916c6);return _0x535884[_0x9dbe('0x1f')](_0x9dbe('0x20'),_0x38ab1d+'-'+_0x4b5898+'/'+_0xe265a7)[_0x9dbe('0x21')](_0x16df1a);}return null;};}function patchUpdates(_0x111cd0){return function(_0x26b940){try{jsonpatch[_0x9dbe('0x22')](_0x26b940,_0x111cd0,!![]);}catch(_0x3e65a9){return BPromise[_0x9dbe('0x23')](_0x3e65a9);}return _0x26b940['save']();};}function saveUpdates(_0x208c73,_0x3edaa3){return function(_0x1d80eb){if(_0x1d80eb){return _0x1d80eb[_0x9dbe('0x24')](_0x208c73)['then'](function(_0x5d53f7){return _0x5d53f7;});}return null;};}function removeEntity(_0x57ecc0,_0x33d936){return function(_0x826af5){if(_0x826af5){return _0x826af5[_0x9dbe('0x25')]()[_0x9dbe('0x26')](function(){_0x57ecc0['status'](0xcc)[_0x9dbe('0x19')]();});}};}function handleEntityNotFound(_0x2022b2,_0x29337b){return function(_0x1bee61){if(!_0x1bee61){_0x2022b2['sendStatus'](0x194);}return _0x1bee61;};}function handleError(_0x51357a,_0x4bdd6b){_0x4bdd6b=_0x4bdd6b||0x1f4;return function(_0x36be60){logger['error'](_0x36be60[_0x9dbe('0x27')]);if(_0x36be60[_0x9dbe('0x28')]){delete _0x36be60['name'];}_0x51357a[_0x9dbe('0x1e')](_0x4bdd6b)[_0x9dbe('0x29')](_0x36be60);};}exports[_0x9dbe('0x2a')]=function(_0x301fa1,_0x1037f5){var _0x15ab03={},_0x1cbe98={},_0x1d60ac={'count':0x0,'rows':[]};var _0x51f822=_['map'](db[_0x9dbe('0x2b')]['rawAttributes'],function(_0x1a2e39){return{'name':_0x1a2e39['fieldName'],'type':_0x1a2e39[_0x9dbe('0x2c')][_0x9dbe('0x2d')]};});_0x1cbe98[_0x9dbe('0x2e')]=_['map'](_0x51f822,_0x9dbe('0x28'));_0x1cbe98[_0x9dbe('0x2f')]=_[_0x9dbe('0x30')](_0x301fa1[_0x9dbe('0x2f')]);_0x1cbe98[_0x9dbe('0x31')]=_[_0x9dbe('0x32')](_0x1cbe98[_0x9dbe('0x2e')],_0x1cbe98[_0x9dbe('0x2f')]);_0x15ab03['attributes']=_[_0x9dbe('0x32')](_0x1cbe98[_0x9dbe('0x2e')],qs[_0x9dbe('0x33')](_0x301fa1[_0x9dbe('0x2f')][_0x9dbe('0x33')]));_0x15ab03[_0x9dbe('0x34')]=_0x15ab03[_0x9dbe('0x34')]['length']?_0x15ab03[_0x9dbe('0x34')]:_0x1cbe98[_0x9dbe('0x2e')];if(!_0x301fa1[_0x9dbe('0x2f')]['hasOwnProperty']('nolimit')){_0x15ab03[_0x9dbe('0x1c')]=qs['limit'](_0x301fa1['query']['limit']);_0x15ab03['offset']=qs[_0x9dbe('0x1a')](_0x301fa1[_0x9dbe('0x2f')][_0x9dbe('0x1a')]);}_0x15ab03[_0x9dbe('0x35')]=qs[_0x9dbe('0x36')](_0x301fa1[_0x9dbe('0x2f')]['sort']);_0x15ab03[_0x9dbe('0x37')]=qs[_0x9dbe('0x31')](_[_0x9dbe('0x38')](_0x301fa1[_0x9dbe('0x2f')],_0x1cbe98['filters']),_0x51f822);if(_0x301fa1['query']['filter']){_0x15ab03[_0x9dbe('0x37')]=_[_0x9dbe('0x39')](_0x15ab03[_0x9dbe('0x37')],{'$or':_[_0x9dbe('0x3a')](_0x51f822,function(_0x983b83){if(_0x983b83['type']!==_0x9dbe('0x3b')){var _0x10d891={};_0x10d891[_0x983b83['name']]={'$like':'%'+_0x301fa1[_0x9dbe('0x2f')][_0x9dbe('0x3c')]+'%'};return _0x10d891;}})});}_0x15ab03=_['merge']({},_0x15ab03,_0x301fa1[_0x9dbe('0x3d')]);var _0x266237={'where':_0x15ab03[_0x9dbe('0x37')]};return db['SalesforceAccount'][_0x9dbe('0x1d')](_0x266237)[_0x9dbe('0x26')](function(_0x4fa652){_0x1d60ac[_0x9dbe('0x1d')]=_0x4fa652;if(_0x301fa1[_0x9dbe('0x2f')][_0x9dbe('0x3e')]){_0x15ab03[_0x9dbe('0x3f')]=[{'all':!![]}];}return db[_0x9dbe('0x2b')][_0x9dbe('0x40')](_0x15ab03);})[_0x9dbe('0x26')](function(_0x1942f3){_0x1d60ac[_0x9dbe('0x41')]=_0x1942f3;return _0x1d60ac;})[_0x9dbe('0x26')](respondWithFilteredResult(_0x1037f5,_0x15ab03))['catch'](handleError(_0x1037f5,null));};exports[_0x9dbe('0x42')]=function(_0x2c0470,_0x4d1710){var _0x40a7fb={'raw':![],'where':{'id':_0x2c0470[_0x9dbe('0x43')]['id']}},_0x4a9b52={};_0x4a9b52[_0x9dbe('0x2e')]=_[_0x9dbe('0x30')](db['SalesforceAccount']['rawAttributes']);_0x4a9b52[_0x9dbe('0x2f')]=_[_0x9dbe('0x30')](_0x2c0470[_0x9dbe('0x2f')]);_0x4a9b52[_0x9dbe('0x31')]=_['intersection'](_0x4a9b52['model'],_0x4a9b52[_0x9dbe('0x2f')]);_0x40a7fb['attributes']=_[_0x9dbe('0x32')](_0x4a9b52['model'],qs[_0x9dbe('0x33')](_0x2c0470[_0x9dbe('0x2f')][_0x9dbe('0x33')]));_0x40a7fb[_0x9dbe('0x34')]=_0x40a7fb[_0x9dbe('0x34')][_0x9dbe('0x44')]?_0x40a7fb[_0x9dbe('0x34')]:_0x4a9b52['model'];if(_0x2c0470['query'][_0x9dbe('0x3e')]){_0x40a7fb[_0x9dbe('0x3f')]=[{'all':!![]}];}_0x40a7fb=_['merge']({},_0x40a7fb,_0x2c0470[_0x9dbe('0x3d')]);return db['SalesforceAccount'][_0x9dbe('0x45')](_0x40a7fb)[_0x9dbe('0x26')](handleEntityNotFound(_0x4d1710,null))[_0x9dbe('0x26')](respondWithResult(_0x4d1710,null))['catch'](handleError(_0x4d1710,null));};exports['create']=function(_0x357c7c,_0x422941){return db['SalesforceAccount'][_0x9dbe('0x46')](_0x357c7c['body'],{})[_0x9dbe('0x26')](respondWithResult(_0x422941,0xc9))[_0x9dbe('0x47')](handleError(_0x422941,null));};exports[_0x9dbe('0x24')]=function(_0x53b9ea,_0x34c5e1){if(_0x53b9ea[_0x9dbe('0x48')]['id']){delete _0x53b9ea[_0x9dbe('0x48')]['id'];}return db[_0x9dbe('0x2b')][_0x9dbe('0x45')]({'where':{'id':_0x53b9ea[_0x9dbe('0x43')]['id']}})[_0x9dbe('0x26')](handleEntityNotFound(_0x34c5e1,null))[_0x9dbe('0x26')](saveUpdates(_0x53b9ea['body'],null))[_0x9dbe('0x26')](respondWithResult(_0x34c5e1,null))['catch'](handleError(_0x34c5e1,null));};exports['destroy']=function(_0x37494f,_0x16e13c){return db[_0x9dbe('0x2b')][_0x9dbe('0x45')]({'where':{'id':_0x37494f[_0x9dbe('0x43')]['id']}})[_0x9dbe('0x26')](handleEntityNotFound(_0x16e13c,null))[_0x9dbe('0x26')](removeEntity(_0x16e13c,null))[_0x9dbe('0x47')](handleError(_0x16e13c,null));};exports[_0x9dbe('0x49')]=function(_0x58f594,_0x4e8dcd,_0x2045b5){var _0x448dce={};var _0x226780={};var _0x4826cd;var _0x38cd07;return db[_0x9dbe('0x2b')][_0x9dbe('0x4a')]({'where':{'id':_0x58f594['params']['id']}})['then'](handleEntityNotFound(_0x4e8dcd,null))[_0x9dbe('0x26')](function(_0x20fae1){if(_0x20fae1){_0x4826cd=_0x20fae1;_0x226780['model']=_[_0x9dbe('0x30')](db[_0x9dbe('0x4b')][_0x9dbe('0x4c')]);_0x226780['query']=_[_0x9dbe('0x30')](_0x58f594['query']);_0x226780[_0x9dbe('0x31')]=_[_0x9dbe('0x32')](_0x226780[_0x9dbe('0x2e')],_0x226780['query']);_0x448dce[_0x9dbe('0x34')]=_[_0x9dbe('0x32')](_0x226780[_0x9dbe('0x2e')],qs[_0x9dbe('0x33')](_0x58f594['query'][_0x9dbe('0x33')]));_0x448dce[_0x9dbe('0x34')]=_0x448dce[_0x9dbe('0x34')][_0x9dbe('0x44')]?_0x448dce['attributes']:_0x226780[_0x9dbe('0x2e')];_0x448dce[_0x9dbe('0x35')]=qs[_0x9dbe('0x36')](_0x58f594[_0x9dbe('0x2f')][_0x9dbe('0x36')]);_0x448dce[_0x9dbe('0x37')]=qs[_0x9dbe('0x31')](_[_0x9dbe('0x38')](_0x58f594[_0x9dbe('0x2f')],_0x226780['filters']));if(_0x58f594[_0x9dbe('0x2f')]['filter']){_0x448dce[_0x9dbe('0x37')]=_[_0x9dbe('0x39')](_0x448dce[_0x9dbe('0x37')],{'$or':_[_0x9dbe('0x3a')](_0x448dce['attributes'],function(_0x1dc38f){var _0x2614af={};_0x2614af[_0x1dc38f]={'$like':'%'+_0x58f594[_0x9dbe('0x2f')]['filter']+'%'};return _0x2614af;})});}_0x448dce=_[_0x9dbe('0x39')]({},_0x448dce,_0x58f594[_0x9dbe('0x3d')]);return _0x4826cd[_0x9dbe('0x49')](_0x448dce);}})['then'](function(_0x553701){if(_0x553701){_0x38cd07=_0x553701[_0x9dbe('0x44')];if(!_0x58f594[_0x9dbe('0x2f')][_0x9dbe('0x4d')](_0x9dbe('0x4e'))){_0x448dce[_0x9dbe('0x1c')]=qs[_0x9dbe('0x1c')](_0x58f594[_0x9dbe('0x2f')]['limit']);_0x448dce[_0x9dbe('0x1a')]=qs[_0x9dbe('0x1a')](_0x58f594['query'][_0x9dbe('0x1a')]);}return _0x4826cd['getConfigurations'](_0x448dce);}})[_0x9dbe('0x26')](function(_0x1e9bd7){if(_0x1e9bd7){return _0x1e9bd7?{'count':_0x38cd07,'rows':_0x1e9bd7}:null;}})[_0x9dbe('0x26')](respondWithResult(_0x4e8dcd,null))[_0x9dbe('0x47')](handleError(_0x4e8dcd,null));};exports[_0x9dbe('0x4f')]=function(_0x3a7a2b,_0x2a046c,_0x37090c){if(_0x3a7a2b[_0x9dbe('0x48')]['id']){delete _0x3a7a2b[_0x9dbe('0x48')]['id'];}return db[_0x9dbe('0x2b')][_0x9dbe('0x4a')]({'where':{'id':_0x3a7a2b['params']['id']}})[_0x9dbe('0x26')](handleEntityNotFound(_0x2a046c,null))['then'](function(_0xb0c7eb){if(_0xb0c7eb){_0x3a7a2b[_0x9dbe('0x48')][_0x9dbe('0x50')]=_0xb0c7eb['id'];_0x3a7a2b[_0x9dbe('0x48')][_0x9dbe('0x51')]=integrations[_0x9dbe('0x52')](_0x3a7a2b['body'][_0x9dbe('0x53')],_0x3a7a2b[_0x9dbe('0x48')][_0x9dbe('0x2c')]);_0x3a7a2b[_0x9dbe('0x48')]['Descriptions']=integrations[_0x9dbe('0x54')](_0x3a7a2b[_0x9dbe('0x48')][_0x9dbe('0x53')],_0x3a7a2b[_0x9dbe('0x48')]['type']);return db[_0x9dbe('0x4b')][_0x9dbe('0x46')](_0x3a7a2b[_0x9dbe('0x48')],{'include':[{'model':db[_0x9dbe('0x55')],'as':_0x9dbe('0x51')},{'model':db[_0x9dbe('0x55')],'as':_0x9dbe('0x56')}]});}return null;})[_0x9dbe('0x26')](respondWithResult(_0x2a046c,null))[_0x9dbe('0x47')](handleError(_0x2a046c,null));};exports['getFields']=function(_0x460087,_0x33bf58,_0x112355){var _0x144e0c;var _0x238c0c='';var _0x5bdb32=_0x9dbe('0x57');return db[_0x9dbe('0x2b')][_0x9dbe('0x4a')]({'where':{'id':_0x460087[_0x9dbe('0x43')]['id']},'attributes':['id','remoteUri',_0x9dbe('0x58'),_0x9dbe('0x59'),_0x9dbe('0x5a'),_0x9dbe('0x5b'),'securityToken']})['then'](handleEntityNotFound(_0x33bf58,null))[_0x9dbe('0x26')](function(_0x373ecc){if(_0x373ecc){_0x238c0c=_0x373ecc[_0x9dbe('0x5c')];var _0x15ea7c=_0x238c0c[_0x9dbe('0x5d')](-0x1);if(_0x15ea7c==='/'){_0x238c0c=_0x238c0c[_0x9dbe('0x5e')](0x0,_0x238c0c['lastIndexOf'](_0x15ea7c));}_0x144e0c=new jsforce[(_0x9dbe('0x5f'))]({'oauth2':{'loginUrl':_0x238c0c,'clientId':_0x373ecc[_0x9dbe('0x58')],'clientSecret':_0x373ecc[_0x9dbe('0x59')]}});return _0x144e0c[_0x9dbe('0x60')](_0x373ecc[_0x9dbe('0x5a')],_0x373ecc['password'][_0x9dbe('0x61')](_0x373ecc['securityToken']));}})[_0x9dbe('0x26')](function(_0x5b8a09){if(_0x5b8a09){if(!_[_0x9dbe('0x62')](_0x460087[_0x9dbe('0x2f')]['ticketType'])){_0x5bdb32=_0x460087[_0x9dbe('0x2f')][_0x9dbe('0x63')];}return _0x144e0c[_0x9dbe('0x64')](_0x5bdb32)[_0x9dbe('0x65')]();}})[_0x9dbe('0x26')](function(_0x5395da){var _0x14c030=[_0x9dbe('0x66'),'ActivityDate','IsReminderSet','IsRecurrence','Subject','Description'];var _0x30e2d1=[_0x9dbe('0x67'),_0x9dbe('0x68'),_0x9dbe('0x69'),_0x9dbe('0x6a'),_0x9dbe('0x6b'),'textarea',_0x9dbe('0x6c')];if(_0x5395da){_[_0x9dbe('0x6d')](_0x5395da[_0x9dbe('0x33')],function(_0x3f04cb){return _0x14c030[_0x9dbe('0x6e')](_0x3f04cb[_0x9dbe('0x28')])||!_0x30e2d1['includes'](_0x3f04cb[_0x9dbe('0x2c')]);});return{'count':_0x5395da[_0x9dbe('0x33')][_0x9dbe('0x44')],'rows':_['map'](_0x5395da['fields'],function(_0x1fd908){return{'id':_0x1fd908['name'],'name':_0x1fd908[_0x9dbe('0x6f')],'custom':_0x1fd908[_0x9dbe('0x70')],'options':_0x1fd908[_0x9dbe('0x71')][_0x9dbe('0x44')]>0x0?_[_0x9dbe('0x3a')](_0x1fd908[_0x9dbe('0x71')],function(_0x385e2e){return{'name':_0x385e2e['label'],'value':_0x385e2e[_0x9dbe('0x72')]};}):_0x1fd908['type']=='boolean'?[{'name':_0x9dbe('0x73'),'value':_0x9dbe('0x74')},{'name':'False','value':_0x9dbe('0x75')}]:[]};})};}})[_0x9dbe('0x26')](respondWithResult(_0x33bf58,null))[_0x9dbe('0x47')](function(_0x1d621a){var _0x81e42e=_0x460087[_0x9dbe('0x2f')][_0x9dbe('0x76')]?0x1f4:_0x1d621a[_0x9dbe('0x77')]||0x1f4;logger['error'](_0x9dbe('0x78'),_0x9dbe('0x79'),_0x81e42e,JSON['stringify'](_0x1d621a));delete _0x1d621a[_0x9dbe('0x28')];if(_0x81e42e===0x191){_0x81e42e=0x190;}_0x33bf58[_0x9dbe('0x1e')](_0x81e42e)[_0x9dbe('0x29')](_0x460087[_0x9dbe('0x2f')][_0x9dbe('0x76')]?{'message':_0x9dbe('0x7a'),'statusCode':_0x1d621a[_0x9dbe('0x77')]}:_0x1d621a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1cfc924..0e9acbb 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 _0xca27=['exports','SalesforceAccount','int_salesforce_accounts','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0xcbe5d7,_0x348a02){var _0x1f41bd=function(_0xa8ba38){while(--_0xa8ba38){_0xcbe5d7['push'](_0xcbe5d7['shift']());}};_0x1f41bd(++_0x348a02);}(_0xca27,0xbe));var _0x7ca2=function(_0x27c818,_0x41dcc3){_0x27c818=_0x27c818-0x0;var _0x338973=_0xca27[_0x27c818];return _0x338973;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7ca2('0x0'))(_0x7ca2('0x1'));var moment=require(_0x7ca2('0x2'));var BPromise=require(_0x7ca2('0x3'));var rp=require(_0x7ca2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca2('0x5'));var config=require(_0x7ca2('0x6'));var attributes=require(_0x7ca2('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7ca2('0x8')]=function(_0x22bc5c,_0x30b984){return _0x22bc5c['define'](_0x7ca2('0x9'),attributes,{'tableName':_0x7ca2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3881=['SalesforceAccount','int_salesforce_accounts','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x44a73a,_0x30146d){var _0x3a923c=function(_0x95ebd8){while(--_0x95ebd8){_0x44a73a['push'](_0x44a73a['shift']());}};_0x3a923c(++_0x30146d);}(_0x3881,0xe6));var _0x1388=function(_0x23c19c,_0x4870e1){_0x23c19c=_0x23c19c-0x0;var _0x1d4972=_0x3881[_0x23c19c];return _0x1d4972;};'use strict';var _=require(_0x1388('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1388('0x1'));var BPromise=require(_0x1388('0x2'));var rp=require(_0x1388('0x3'));var fs=require('fs');var path=require(_0x1388('0x4'));var rimraf=require(_0x1388('0x5'));var config=require(_0x1388('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x1388('0x7'));module[_0x1388('0x8')]=function(_0x231bf0,_0x573ec0){return _0x231bf0[_0x1388('0x9')](_0x1388('0xa'),attributes,{'tableName':_0x1388('0xb'),'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 35ff384..753e016 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 _0x031d=['request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','info','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s'];(function(_0x2d7a26,_0x218c55){var _0x43eaa9=function(_0x110f64){while(--_0x110f64){_0x2d7a26['push'](_0x2d7a26['shift']());}};_0x43eaa9(++_0x218c55);}(_0x031d,0x1b7));var _0xd031=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x031d[_0x2a5b3b];return _0xae665a;};'use strict';var _=require(_0xd031('0x0'));var util=require(_0xd031('0x1'));var moment=require(_0xd031('0x2'));var BPromise=require(_0xd031('0x3'));var rs=require(_0xd031('0x4'));var fs=require('fs');var Redis=require(_0xd031('0x5'));var db=require(_0xd031('0x6'))['db'];var utils=require(_0xd031('0x7'));var logger=require(_0xd031('0x8'))(_0xd031('0x9'));var config=require(_0xd031('0xa'));var jayson=require(_0xd031('0xb'));var client=jayson[_0xd031('0xc')][_0xd031('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x22e75f,_0x3301b7,_0xa1b2b1){return new BPromise(function(_0x1b9cf8,_0x3ff46a){return client[_0xd031('0xe')](_0x22e75f,_0xa1b2b1)[_0xd031('0xf')](function(_0x504c38){logger['info'](_0xd031('0x10'),_0x3301b7,_0xd031('0x11'));logger[_0xd031('0x12')](_0xd031('0x13'),_0x3301b7,_0xd031('0x11'),JSON[_0xd031('0x14')](_0x504c38));if(_0x504c38['error']){if(_0x504c38[_0xd031('0x15')]['code']===0x1f4){logger[_0xd031('0x15')]('SalesforceAccount,\x20%s,\x20%s',_0x3301b7,_0x504c38[_0xd031('0x15')][_0xd031('0x16')]);return _0x3ff46a(_0x504c38[_0xd031('0x15')][_0xd031('0x16')]);}logger[_0xd031('0x15')](_0xd031('0x10'),_0x3301b7,_0x504c38[_0xd031('0x15')][_0xd031('0x16')]);return _0x1b9cf8(_0x504c38[_0xd031('0x15')][_0xd031('0x16')]);}else{logger['info'](_0xd031('0x10'),_0x3301b7,_0xd031('0x11'));_0x1b9cf8(_0x504c38['result']['message']);}})[_0xd031('0x17')](function(_0x1d67b9){logger[_0xd031('0x15')](_0xd031('0x10'),_0x3301b7,_0x1d67b9);_0x3ff46a(_0x1d67b9);});});}exports[_0xd031('0x18')]=function(_0x2b5f1d){var _0xb46bab=this;return new Promise(function(_0x131fd6,_0x3b9ccb){return db[_0xd031('0x19')][_0xd031('0x1a')]({'raw':_0x2b5f1d[_0xd031('0x1b')]?_0x2b5f1d[_0xd031('0x1b')][_0xd031('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b5f1d[_0xd031('0x1b')]?_0x2b5f1d[_0xd031('0x1b')][_0xd031('0x1d')]||null:null,'attributes':_0x2b5f1d[_0xd031('0x1b')]?_0x2b5f1d['options'][_0xd031('0x1e')]||null:null,'limit':_0x2b5f1d['options']?_0x2b5f1d[_0xd031('0x1b')][_0xd031('0x1f')]||null:null,'include':_0x2b5f1d[_0xd031('0x1b')]?_0x2b5f1d[_0xd031('0x1b')]['include']?_[_0xd031('0x20')](_0x2b5f1d['options'][_0xd031('0x21')],function(_0x52fc5f){return{'model':db[_0x52fc5f[_0xd031('0x22')]],'as':_0x52fc5f['as'],'attributes':_0x52fc5f['attributes'],'include':_0x52fc5f[_0xd031('0x21')]?_[_0xd031('0x20')](_0x52fc5f[_0xd031('0x21')],function(_0x539c84){return{'model':db[_0x539c84[_0xd031('0x22')]],'as':_0x539c84['as'],'attributes':_0x539c84['attributes'],'include':_0x539c84['include']?_[_0xd031('0x20')](_0x539c84[_0xd031('0x21')],function(_0x4be610){return{'model':db[_0x4be610[_0xd031('0x22')]],'as':_0x4be610['as'],'attributes':_0x4be610[_0xd031('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfb4651){logger[_0xd031('0x23')](_0xd031('0x18'),_0x2b5f1d);logger[_0xd031('0x12')](_0xd031('0x18'),_0x2b5f1d,JSON[_0xd031('0x14')](_0xfb4651));_0x131fd6(_0xfb4651);})['catch'](function(_0x326745){logger['error']('GetSalesforceAccount',_0x326745[_0xd031('0x16')],_0x2b5f1d);_0x3b9ccb(_0xb46bab[_0xd031('0x15')](0x1f4,_0x326745[_0xd031('0x16')]));});});};exports[_0xd031('0x24')]=function(_0x1850f1){var _0x6fe878=this;return new Promise(function(_0x324718,_0x4bd5d6){return db[_0xd031('0x19')][_0xd031('0x25')]({'raw':_0x1850f1[_0xd031('0x1b')]?_0x1850f1[_0xd031('0x1b')][_0xd031('0x1c')]===undefined?!![]:![]:!![],'where':_0x1850f1['options']?_0x1850f1[_0xd031('0x1b')]['where']||null:null,'attributes':_0x1850f1[_0xd031('0x1b')]?_0x1850f1[_0xd031('0x1b')][_0xd031('0x1e')]||null:null,'include':_0x1850f1[_0xd031('0x1b')]?_0x1850f1[_0xd031('0x1b')][_0xd031('0x21')]?_[_0xd031('0x20')](_0x1850f1[_0xd031('0x1b')][_0xd031('0x21')],function(_0x401b50){return{'model':db[_0x401b50[_0xd031('0x22')]],'as':_0x401b50['as'],'attributes':_0x401b50[_0xd031('0x1e')],'include':_0x401b50[_0xd031('0x21')]?_[_0xd031('0x20')](_0x401b50['include'],function(_0x3834f8){return{'model':db[_0x3834f8[_0xd031('0x22')]],'as':_0x3834f8['as'],'attributes':_0x3834f8[_0xd031('0x1e')],'include':_0x3834f8['include']?_['map'](_0x3834f8[_0xd031('0x21')],function(_0x34ce16){return{'model':db[_0x34ce16[_0xd031('0x22')]],'as':_0x34ce16['as'],'attributes':_0x34ce16[_0xd031('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd031('0xf')](function(_0x11704e){logger[_0xd031('0x23')]('ShowSalesforceAccount',_0x1850f1);logger[_0xd031('0x12')](_0xd031('0x24'),_0x1850f1,JSON[_0xd031('0x14')](_0x11704e));_0x324718(_0x11704e);})['catch'](function(_0x18c205){logger['error'](_0xd031('0x24'),_0x18c205[_0xd031('0x16')],_0x1850f1);_0x4bd5d6(_0x6fe878['error'](0x1f4,_0x18c205['message']));});});}; \ No newline at end of file +var _0x29b1=['../../config/environment','jayson/promise','client','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','SalesforceAccount,\x20%s,\x20%s','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include','model','map','attributes','debug','ShowSalesforceAccount','find','where','util','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x29b1,0xbb));var _0x129b=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x29b1[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require(_0x129b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x129b('0x1'));var db=require(_0x129b('0x2'))['db'];var utils=require(_0x129b('0x3'));var logger=require('../../config/logger')(_0x129b('0x4'));var config=require(_0x129b('0x5'));var jayson=require(_0x129b('0x6'));var client=jayson[_0x129b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x367149,_0x1e2e84,_0xe9a999){return new BPromise(function(_0x572bb0,_0x5e066f){return client['request'](_0x367149,_0xe9a999)['then'](function(_0x3c65c7){logger[_0x129b('0x8')]('SalesforceAccount,\x20%s,\x20%s',_0x1e2e84,_0x129b('0x9'));logger['debug'](_0x129b('0xa'),_0x1e2e84,'request\x20sent',JSON[_0x129b('0xb')](_0x3c65c7));if(_0x3c65c7['error']){if(_0x3c65c7['error'][_0x129b('0xc')]===0x1f4){logger['error'](_0x129b('0xd'),_0x1e2e84,_0x3c65c7[_0x129b('0xe')][_0x129b('0xf')]);return _0x5e066f(_0x3c65c7[_0x129b('0xe')]['message']);}logger[_0x129b('0xe')](_0x129b('0xd'),_0x1e2e84,_0x3c65c7[_0x129b('0xe')][_0x129b('0xf')]);return _0x572bb0(_0x3c65c7[_0x129b('0xe')][_0x129b('0xf')]);}else{logger[_0x129b('0x8')](_0x129b('0xd'),_0x1e2e84,_0x129b('0x9'));_0x572bb0(_0x3c65c7[_0x129b('0x10')][_0x129b('0xf')]);}})[_0x129b('0x11')](function(_0xb34c52){logger[_0x129b('0xe')](_0x129b('0xd'),_0x1e2e84,_0xb34c52);_0x5e066f(_0xb34c52);});});}exports[_0x129b('0x12')]=function(_0xdaa9d7){var _0x42dab8=this;return new Promise(function(_0x40047e,_0x374080){return db[_0x129b('0x13')][_0x129b('0x14')]({'raw':_0xdaa9d7[_0x129b('0x15')]?_0xdaa9d7['options'][_0x129b('0x16')]===undefined?!![]:![]:!![],'where':_0xdaa9d7[_0x129b('0x15')]?_0xdaa9d7[_0x129b('0x15')]['where']||null:null,'attributes':_0xdaa9d7[_0x129b('0x15')]?_0xdaa9d7['options']['attributes']||null:null,'limit':_0xdaa9d7[_0x129b('0x15')]?_0xdaa9d7[_0x129b('0x15')][_0x129b('0x17')]||null:null,'include':_0xdaa9d7[_0x129b('0x15')]?_0xdaa9d7[_0x129b('0x15')]['include']?_['map'](_0xdaa9d7['options'][_0x129b('0x18')],function(_0x49c772){return{'model':db[_0x49c772[_0x129b('0x19')]],'as':_0x49c772['as'],'attributes':_0x49c772['attributes'],'include':_0x49c772[_0x129b('0x18')]?_['map'](_0x49c772[_0x129b('0x18')],function(_0x1cb446){return{'model':db[_0x1cb446[_0x129b('0x19')]],'as':_0x1cb446['as'],'attributes':_0x1cb446['attributes'],'include':_0x1cb446[_0x129b('0x18')]?_[_0x129b('0x1a')](_0x1cb446['include'],function(_0xab26ee){return{'model':db[_0xab26ee['model']],'as':_0xab26ee['as'],'attributes':_0xab26ee[_0x129b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21414b){logger[_0x129b('0x8')](_0x129b('0x12'),_0xdaa9d7);logger[_0x129b('0x1c')](_0x129b('0x12'),_0xdaa9d7,JSON[_0x129b('0xb')](_0x21414b));_0x40047e(_0x21414b);})[_0x129b('0x11')](function(_0x401c41){logger['error'](_0x129b('0x12'),_0x401c41[_0x129b('0xf')],_0xdaa9d7);_0x374080(_0x42dab8[_0x129b('0xe')](0x1f4,_0x401c41[_0x129b('0xf')]));});});};exports[_0x129b('0x1d')]=function(_0x9e09a){var _0x774dfc=this;return new Promise(function(_0x48364b,_0x3c89da){return db[_0x129b('0x13')][_0x129b('0x1e')]({'raw':_0x9e09a[_0x129b('0x15')]?_0x9e09a['options'][_0x129b('0x16')]===undefined?!![]:![]:!![],'where':_0x9e09a['options']?_0x9e09a[_0x129b('0x15')][_0x129b('0x1f')]||null:null,'attributes':_0x9e09a['options']?_0x9e09a[_0x129b('0x15')][_0x129b('0x1b')]||null:null,'include':_0x9e09a[_0x129b('0x15')]?_0x9e09a['options'][_0x129b('0x18')]?_['map'](_0x9e09a[_0x129b('0x15')][_0x129b('0x18')],function(_0x2b6605){return{'model':db[_0x2b6605[_0x129b('0x19')]],'as':_0x2b6605['as'],'attributes':_0x2b6605[_0x129b('0x1b')],'include':_0x2b6605['include']?_[_0x129b('0x1a')](_0x2b6605['include'],function(_0x105887){return{'model':db[_0x105887[_0x129b('0x19')]],'as':_0x105887['as'],'attributes':_0x105887[_0x129b('0x1b')],'include':_0x105887['include']?_['map'](_0x105887[_0x129b('0x18')],function(_0x3f26e3){return{'model':db[_0x3f26e3['model']],'as':_0x3f26e3['as'],'attributes':_0x3f26e3[_0x129b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47bec7){logger[_0x129b('0x8')](_0x129b('0x1d'),_0x9e09a);logger[_0x129b('0x1c')]('ShowSalesforceAccount',_0x9e09a,JSON[_0x129b('0xb')](_0x47bec7));_0x48364b(_0x47bec7);})['catch'](function(_0x4bacb3){logger[_0x129b('0xe')](_0x129b('0x1d'),_0x4bacb3[_0x129b('0xf')],_0x9e09a);_0x3c89da(_0x774dfc[_0x129b('0xe')](0x1f4,_0x4bacb3[_0x129b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index caf93da..cda1cfc 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x35e9cd,_0x192ac8){var _0x1fcb32=function(_0x395874){while(--_0x395874){_0x35e9cd['push'](_0x35e9cd['shift']());}};_0x1fcb32(++_0x192ac8);}(_0x7a54,0x106));var _0x47a5=function(_0x31dd3f,_0x6642a1){_0x31dd3f=_0x31dd3f-0x0;var _0x2718a2=_0x7a54[_0x31dd3f];return _0x2718a2;};'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/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdb28,0x106));var _0x8db2=function(_0x3362c7,_0x1ffa3f){_0x3362c7=_0x3362c7-0x0;var _0x1282cb=_0xdb28[_0x3362c7];return _0x1282cb;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 77a540d..2ca3503 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 _0xfea4=['account_contact_lead','account','nothing','lead','exports','STRING','Task','ENUM','contact_lead','contact'];(function(_0x51558c,_0x5550a2){var _0x5b9361=function(_0x37f7d7){while(--_0x37f7d7){_0x51558c['push'](_0x51558c['shift']());}};_0x5b9361(++_0x5550a2);}(_0xfea4,0x1a8));var _0x4fea=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xfea4[_0x4cfa2e];return _0x279b50;};'use strict';var Sequelize=require('sequelize');module[_0x4fea('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fea('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task','Case'),'defaultValue':_0x4fea('0x2')},'moduleSearch':{'type':Sequelize[_0x4fea('0x3')](_0x4fea('0x4'),_0x4fea('0x5'),'lead',_0x4fea('0x6'),_0x4fea('0x7')),'defaultValue':_0x4fea('0x4')},'moduleCreate':{'type':Sequelize[_0x4fea('0x3')](_0x4fea('0x8'),_0x4fea('0x5'),_0x4fea('0x9'),_0x4fea('0x7')),'defaultValue':_0x4fea('0x9')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x4fea('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x4fea('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x4fea('0x1')]}}; \ No newline at end of file +var _0x7f3c=['lead','nothing','account','sequelize','STRING','Task','ENUM','contact_lead','contact'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x7f3c,0x1d7));var _0xc7f3=function(_0x33efcc,_0x2ebf86){_0x33efcc=_0x33efcc-0x0;var _0x2e9f19=_0x7f3c[_0x33efcc];return _0x2e9f19;};'use strict';var Sequelize=require(_0xc7f3('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc7f3('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xc7f3('0x2'),'Case'),'defaultValue':_0xc7f3('0x2')},'moduleSearch':{'type':Sequelize[_0xc7f3('0x3')](_0xc7f3('0x4'),_0xc7f3('0x5'),_0xc7f3('0x6'),'account_contact_lead','account'),'defaultValue':_0xc7f3('0x4')},'moduleCreate':{'type':Sequelize[_0xc7f3('0x3')](_0xc7f3('0x7'),_0xc7f3('0x5'),_0xc7f3('0x6'),_0xc7f3('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xc7f3('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xc7f3('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xc7f3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b9a2b62..f8d918b 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 _0x640a=['lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','status','end','error','name','send','map','SalesforceConfiguration','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','getFields','SalesforceField','nolimit','getSubjects','getDescriptions','findOne','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x3ae5ea,_0x419c40){var _0x463d53=function(_0x2f98a9){while(--_0x2f98a9){_0x3ae5ea['push'](_0x3ae5ea['shift']());}};_0x463d53(++_0x419c40);}(_0x640a,0x133));var _0xa640=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x640a[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0xa640('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa640('0x1'));var rp=require(_0xa640('0x2'));var moment=require('moment');var BPromise=require(_0xa640('0x3'));var Mustache=require(_0xa640('0x4'));var util=require(_0xa640('0x5'));var path=require(_0xa640('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa640('0x7'));var fs=require('fs');var fs_extra=require(_0xa640('0x8'));var _=require(_0xa640('0x9'));var squel=require(_0xa640('0xa'));var crypto=require('crypto');var jsforce=require(_0xa640('0xb'));var deskjs=require(_0xa640('0xc'));var toCsv=require(_0xa640('0xd'));var querystring=require('querystring');var Papa=require(_0xa640('0xe'));var Redis=require(_0xa640('0xf'));var authService=require(_0xa640('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa640('0x11'));var hardwareService=require(_0xa640('0x12'));var logger=require(_0xa640('0x13'))('api');var utils=require(_0xa640('0x14'));var config=require(_0xa640('0x15'));var licenseUtil=require(_0xa640('0x16'));var db=require(_0xa640('0x17'))['db'];function respondWithStatusCode(_0x5c8e46,_0x422b79){_0x422b79=_0x422b79||0xcc;return function(_0x55b769){if(_0x55b769){return _0x5c8e46[_0xa640('0x18')](_0x422b79);}return _0x5c8e46['status'](_0x422b79)['end']();};}function respondWithResult(_0x4207d5,_0x5843a4){_0x5843a4=_0x5843a4||0xc8;return function(_0x2ef193){if(_0x2ef193){return _0x4207d5['status'](_0x5843a4)['json'](_0x2ef193);}};}function respondWithFilteredResult(_0x2bb8c5,_0x196af5){return function(_0x332e5c){if(_0x332e5c){var _0x181a9a=typeof _0x196af5[_0xa640('0x19')]==='undefined'&&typeof _0x196af5['limit']===_0xa640('0x1a');var _0xb0d836=_0x332e5c[_0xa640('0x1b')];var _0x72680e=_0x181a9a?0x0:_0x196af5[_0xa640('0x19')];var _0x23a765=_0x181a9a?_0x332e5c[_0xa640('0x1b')]:_0x196af5[_0xa640('0x19')]+_0x196af5[_0xa640('0x1c')];var _0x4d79a5;if(_0x23a765>=_0xb0d836){_0x23a765=_0xb0d836;_0x4d79a5=0xc8;}else{_0x4d79a5=0xce;}_0x2bb8c5['status'](_0x4d79a5);return _0x2bb8c5[_0xa640('0x1d')](_0xa640('0x1e'),_0x72680e+'-'+_0x23a765+'/'+_0xb0d836)[_0xa640('0x1f')](_0x332e5c);}return null;};}function patchUpdates(_0x2bdc54){return function(_0x10d84e){try{jsonpatch[_0xa640('0x20')](_0x10d84e,_0x2bdc54,!![]);}catch(_0x4c35fa){return BPromise['reject'](_0x4c35fa);}return _0x10d84e[_0xa640('0x21')]();};}function saveUpdates(_0x363df6,_0x3e5a8e){return function(_0x1ed06c){if(_0x1ed06c){return _0x1ed06c[_0xa640('0x22')](_0x363df6)[_0xa640('0x23')](function(_0x5a5ad7){return _0x5a5ad7;});}return null;};}function removeEntity(_0x4a66c6,_0x16940d){return function(_0x395c1f){if(_0x395c1f){return _0x395c1f[_0xa640('0x24')]()[_0xa640('0x23')](function(){_0x4a66c6[_0xa640('0x25')](0xcc)[_0xa640('0x26')]();});}};}function handleEntityNotFound(_0x5949ec,_0x3b340b){return function(_0x158aa2){if(!_0x158aa2){_0x5949ec[_0xa640('0x18')](0x194);}return _0x158aa2;};}function handleError(_0x27e980,_0x267fc4){_0x267fc4=_0x267fc4||0x1f4;return function(_0x4aa1d4){logger[_0xa640('0x27')](_0x4aa1d4['stack']);if(_0x4aa1d4[_0xa640('0x28')]){delete _0x4aa1d4[_0xa640('0x28')];}_0x27e980['status'](_0x267fc4)[_0xa640('0x29')](_0x4aa1d4);};}exports['index']=function(_0x36fb5d,_0x2bfbfd){var _0x3f63ef={},_0x2d88a7={},_0xcd8ded={'count':0x0,'rows':[]};var _0x29d527=_[_0xa640('0x2a')](db[_0xa640('0x2b')][_0xa640('0x2c')],function(_0x4030f9){return{'name':_0x4030f9['fieldName'],'type':_0x4030f9['type']['key']};});_0x2d88a7[_0xa640('0x2d')]=_[_0xa640('0x2a')](_0x29d527,_0xa640('0x28'));_0x2d88a7['query']=_[_0xa640('0x2e')](_0x36fb5d[_0xa640('0x2f')]);_0x2d88a7['filters']=_[_0xa640('0x30')](_0x2d88a7[_0xa640('0x2d')],_0x2d88a7[_0xa640('0x2f')]);_0x3f63ef[_0xa640('0x31')]=_[_0xa640('0x30')](_0x2d88a7[_0xa640('0x2d')],qs[_0xa640('0x32')](_0x36fb5d[_0xa640('0x2f')]['fields']));_0x3f63ef[_0xa640('0x31')]=_0x3f63ef['attributes'][_0xa640('0x33')]?_0x3f63ef[_0xa640('0x31')]:_0x2d88a7[_0xa640('0x2d')];if(!_0x36fb5d[_0xa640('0x2f')][_0xa640('0x34')]('nolimit')){_0x3f63ef[_0xa640('0x1c')]=qs['limit'](_0x36fb5d[_0xa640('0x2f')][_0xa640('0x1c')]);_0x3f63ef[_0xa640('0x19')]=qs[_0xa640('0x19')](_0x36fb5d['query']['offset']);}_0x3f63ef[_0xa640('0x35')]=qs[_0xa640('0x36')](_0x36fb5d[_0xa640('0x2f')][_0xa640('0x36')]);_0x3f63ef['where']=qs['filters'](_[_0xa640('0x37')](_0x36fb5d[_0xa640('0x2f')],_0x2d88a7[_0xa640('0x38')]),_0x29d527);if(_0x36fb5d[_0xa640('0x2f')][_0xa640('0x39')]){_0x3f63ef[_0xa640('0x3a')]=_['merge'](_0x3f63ef['where'],{'$or':_['map'](_0x29d527,function(_0x45e53c){if(_0x45e53c[_0xa640('0x3b')]!==_0xa640('0x3c')){var _0x55a7ab={};_0x55a7ab[_0x45e53c['name']]={'$like':'%'+_0x36fb5d['query'][_0xa640('0x39')]+'%'};return _0x55a7ab;}})});}_0x3f63ef=_['merge']({},_0x3f63ef,_0x36fb5d[_0xa640('0x3d')]);var _0x48ba4e={'where':_0x3f63ef['where']};return db['SalesforceConfiguration'][_0xa640('0x1b')](_0x48ba4e)['then'](function(_0x3bde8b){_0xcd8ded[_0xa640('0x1b')]=_0x3bde8b;if(_0x36fb5d[_0xa640('0x2f')][_0xa640('0x3e')]){_0x3f63ef[_0xa640('0x3f')]=[{'all':!![]}];}return db[_0xa640('0x2b')][_0xa640('0x40')](_0x3f63ef);})[_0xa640('0x23')](function(_0x50f95f){_0xcd8ded[_0xa640('0x41')]=_0x50f95f;return _0xcd8ded;})[_0xa640('0x23')](respondWithFilteredResult(_0x2bfbfd,_0x3f63ef))['catch'](handleError(_0x2bfbfd,null));};exports[_0xa640('0x42')]=function(_0x10fbcb,_0x7b59f4){var _0x43a776={'raw':![],'where':{'id':_0x10fbcb[_0xa640('0x43')]['id']}},_0x4f05ef={};_0x4f05ef[_0xa640('0x2d')]=_[_0xa640('0x2e')](db[_0xa640('0x2b')][_0xa640('0x2c')]);_0x4f05ef[_0xa640('0x2f')]=_[_0xa640('0x2e')](_0x10fbcb[_0xa640('0x2f')]);_0x4f05ef['filters']=_[_0xa640('0x30')](_0x4f05ef[_0xa640('0x2d')],_0x4f05ef[_0xa640('0x2f')]);_0x43a776['attributes']=_['intersection'](_0x4f05ef[_0xa640('0x2d')],qs['fields'](_0x10fbcb['query'][_0xa640('0x32')]));_0x43a776[_0xa640('0x31')]=_0x43a776['attributes']['length']?_0x43a776[_0xa640('0x31')]:_0x4f05ef[_0xa640('0x2d')];if(_0x10fbcb[_0xa640('0x2f')]['includeAll']){_0x43a776[_0xa640('0x3f')]=[{'all':!![]}];}_0x43a776=_[_0xa640('0x44')]({},_0x43a776,_0x10fbcb[_0xa640('0x3d')]);return db[_0xa640('0x2b')][_0xa640('0x45')](_0x43a776)[_0xa640('0x23')](handleEntityNotFound(_0x7b59f4,null))[_0xa640('0x23')](respondWithResult(_0x7b59f4,null))[_0xa640('0x46')](handleError(_0x7b59f4,null));};exports['create']=function(_0x480772,_0x486134){return db[_0xa640('0x2b')][_0xa640('0x47')](_0x480772[_0xa640('0x48')],{})[_0xa640('0x23')](respondWithResult(_0x486134,0xc9))[_0xa640('0x46')](handleError(_0x486134,null));};exports[_0xa640('0x22')]=function(_0x226a71,_0x327fe4){if(_0x226a71[_0xa640('0x48')]['id']){delete _0x226a71[_0xa640('0x48')]['id'];}return db[_0xa640('0x2b')][_0xa640('0x45')]({'where':{'id':_0x226a71[_0xa640('0x43')]['id']}})[_0xa640('0x23')](handleEntityNotFound(_0x327fe4,null))[_0xa640('0x23')](saveUpdates(_0x226a71[_0xa640('0x48')],null))['then'](respondWithResult(_0x327fe4,null))[_0xa640('0x46')](handleError(_0x327fe4,null));};exports[_0xa640('0x24')]=function(_0x378ecd,_0x622538){return db[_0xa640('0x2b')][_0xa640('0x45')]({'where':{'id':_0x378ecd[_0xa640('0x43')]['id']}})[_0xa640('0x23')](handleEntityNotFound(_0x622538,null))['then'](removeEntity(_0x622538,null))[_0xa640('0x46')](handleError(_0x622538,null));};exports[_0xa640('0x49')]=function(_0x2208e5,_0x583c20,_0x5a3b9d){var _0xaba033={};var _0x5b7752={};var _0x4efa95;var _0x19df9a;return db[_0xa640('0x2b')]['findOne']({'where':{'id':_0x2208e5[_0xa640('0x43')]['id']}})[_0xa640('0x23')](handleEntityNotFound(_0x583c20,null))[_0xa640('0x23')](function(_0x392f4d){if(_0x392f4d){_0x4efa95=_0x392f4d;_0x5b7752[_0xa640('0x2d')]=_[_0xa640('0x2e')](db[_0xa640('0x4a')][_0xa640('0x2c')]);_0x5b7752['query']=_[_0xa640('0x2e')](_0x2208e5['query']);_0x5b7752[_0xa640('0x38')]=_['intersection'](_0x5b7752[_0xa640('0x2d')],_0x5b7752[_0xa640('0x2f')]);_0xaba033[_0xa640('0x31')]=_[_0xa640('0x30')](_0x5b7752['model'],qs[_0xa640('0x32')](_0x2208e5[_0xa640('0x2f')][_0xa640('0x32')]));_0xaba033[_0xa640('0x31')]=_0xaba033['attributes'][_0xa640('0x33')]?_0xaba033[_0xa640('0x31')]:_0x5b7752[_0xa640('0x2d')];_0xaba033[_0xa640('0x35')]=qs[_0xa640('0x36')](_0x2208e5['query'][_0xa640('0x36')]);_0xaba033[_0xa640('0x3a')]=qs[_0xa640('0x38')](_[_0xa640('0x37')](_0x2208e5[_0xa640('0x2f')],_0x5b7752[_0xa640('0x38')]));if(_0x2208e5[_0xa640('0x2f')][_0xa640('0x39')]){_0xaba033[_0xa640('0x3a')]=_[_0xa640('0x44')](_0xaba033['where'],{'$or':_[_0xa640('0x2a')](_0xaba033[_0xa640('0x31')],function(_0x4b26df){var _0x15b664={};_0x15b664[_0x4b26df]={'$like':'%'+_0x2208e5[_0xa640('0x2f')][_0xa640('0x39')]+'%'};return _0x15b664;})});}_0xaba033=_[_0xa640('0x44')]({},_0xaba033,_0x2208e5[_0xa640('0x3d')]);return _0x4efa95[_0xa640('0x49')](_0xaba033);}})['then'](function(_0x34e94f){if(_0x34e94f){_0x19df9a=_0x34e94f['length'];if(!_0x2208e5[_0xa640('0x2f')][_0xa640('0x34')](_0xa640('0x4b'))){_0xaba033[_0xa640('0x1c')]=qs['limit'](_0x2208e5[_0xa640('0x2f')][_0xa640('0x1c')]);_0xaba033[_0xa640('0x19')]=qs['offset'](_0x2208e5['query'][_0xa640('0x19')]);}return _0x4efa95['getFields'](_0xaba033);}})[_0xa640('0x23')](function(_0x362af1){if(_0x362af1){return _0x362af1?{'count':_0x19df9a,'rows':_0x362af1}:null;}})[_0xa640('0x23')](respondWithResult(_0x583c20,null))[_0xa640('0x46')](handleError(_0x583c20,null));};exports[_0xa640('0x4c')]=function(_0x149748,_0x2ee5cc,_0x42b460){var _0x23c58f={};var _0x5aa9d9={};var _0x3881f7;var _0x4d6146;return db[_0xa640('0x2b')]['findOne']({'where':{'id':_0x149748[_0xa640('0x43')]['id']}})[_0xa640('0x23')](handleEntityNotFound(_0x2ee5cc,null))[_0xa640('0x23')](function(_0x15c2ea){if(_0x15c2ea){_0x3881f7=_0x15c2ea;_0x5aa9d9[_0xa640('0x2d')]=_[_0xa640('0x2e')](db[_0xa640('0x4a')][_0xa640('0x2c')]);_0x5aa9d9[_0xa640('0x2f')]=_[_0xa640('0x2e')](_0x149748[_0xa640('0x2f')]);_0x5aa9d9[_0xa640('0x38')]=_[_0xa640('0x30')](_0x5aa9d9[_0xa640('0x2d')],_0x5aa9d9['query']);_0x23c58f[_0xa640('0x31')]=_['intersection'](_0x5aa9d9['model'],qs['fields'](_0x149748['query']['fields']));_0x23c58f[_0xa640('0x31')]=_0x23c58f[_0xa640('0x31')][_0xa640('0x33')]?_0x23c58f[_0xa640('0x31')]:_0x5aa9d9['model'];_0x23c58f[_0xa640('0x35')]=qs['sort'](_0x149748[_0xa640('0x2f')][_0xa640('0x36')]);_0x23c58f[_0xa640('0x3a')]=qs[_0xa640('0x38')](_[_0xa640('0x37')](_0x149748['query'],_0x5aa9d9[_0xa640('0x38')]));if(_0x149748['query']['filter']){_0x23c58f[_0xa640('0x3a')]=_[_0xa640('0x44')](_0x23c58f[_0xa640('0x3a')],{'$or':_[_0xa640('0x2a')](_0x23c58f[_0xa640('0x31')],function(_0x4dfaf7){var _0x12c27c={};_0x12c27c[_0x4dfaf7]={'$like':'%'+_0x149748[_0xa640('0x2f')][_0xa640('0x39')]+'%'};return _0x12c27c;})});}_0x23c58f=_['merge']({},_0x23c58f,_0x149748['options']);return _0x3881f7[_0xa640('0x4c')](_0x23c58f);}})[_0xa640('0x23')](function(_0x1e62f4){if(_0x1e62f4){_0x4d6146=_0x1e62f4['length'];if(!_0x149748[_0xa640('0x2f')][_0xa640('0x34')](_0xa640('0x4b'))){_0x23c58f[_0xa640('0x1c')]=qs[_0xa640('0x1c')](_0x149748[_0xa640('0x2f')][_0xa640('0x1c')]);_0x23c58f[_0xa640('0x19')]=qs['offset'](_0x149748[_0xa640('0x2f')]['offset']);}return _0x3881f7['getSubjects'](_0x23c58f);}})[_0xa640('0x23')](function(_0x14bd67){if(_0x14bd67){return _0x14bd67?{'count':_0x4d6146,'rows':_0x14bd67}:null;}})['then'](respondWithResult(_0x2ee5cc,null))[_0xa640('0x46')](handleError(_0x2ee5cc,null));};exports[_0xa640('0x4d')]=function(_0x2faeea,_0x1777b5,_0x3d142d){var _0x4a626e={};var _0x2f2268={};var _0xc8bd53;var _0x286afb;return db['SalesforceConfiguration'][_0xa640('0x4e')]({'where':{'id':_0x2faeea['params']['id']}})[_0xa640('0x23')](handleEntityNotFound(_0x1777b5,null))[_0xa640('0x23')](function(_0x11e678){if(_0x11e678){_0xc8bd53=_0x11e678;_0x2f2268['model']=_[_0xa640('0x2e')](db[_0xa640('0x4a')][_0xa640('0x2c')]);_0x2f2268[_0xa640('0x2f')]=_[_0xa640('0x2e')](_0x2faeea[_0xa640('0x2f')]);_0x2f2268['filters']=_['intersection'](_0x2f2268[_0xa640('0x2d')],_0x2f2268[_0xa640('0x2f')]);_0x4a626e[_0xa640('0x31')]=_[_0xa640('0x30')](_0x2f2268[_0xa640('0x2d')],qs[_0xa640('0x32')](_0x2faeea[_0xa640('0x2f')][_0xa640('0x32')]));_0x4a626e[_0xa640('0x31')]=_0x4a626e[_0xa640('0x31')][_0xa640('0x33')]?_0x4a626e[_0xa640('0x31')]:_0x2f2268[_0xa640('0x2d')];_0x4a626e['order']=qs[_0xa640('0x36')](_0x2faeea[_0xa640('0x2f')]['sort']);_0x4a626e['where']=qs[_0xa640('0x38')](_[_0xa640('0x37')](_0x2faeea[_0xa640('0x2f')],_0x2f2268['filters']));if(_0x2faeea['query'][_0xa640('0x39')]){_0x4a626e[_0xa640('0x3a')]=_[_0xa640('0x44')](_0x4a626e[_0xa640('0x3a')],{'$or':_[_0xa640('0x2a')](_0x4a626e[_0xa640('0x31')],function(_0x35d3a1){var _0x211c4f={};_0x211c4f[_0x35d3a1]={'$like':'%'+_0x2faeea['query'][_0xa640('0x39')]+'%'};return _0x211c4f;})});}_0x4a626e=_[_0xa640('0x44')]({},_0x4a626e,_0x2faeea[_0xa640('0x3d')]);return _0xc8bd53['getDescriptions'](_0x4a626e);}})[_0xa640('0x23')](function(_0x534c83){if(_0x534c83){_0x286afb=_0x534c83[_0xa640('0x33')];if(!_0x2faeea['query']['hasOwnProperty'](_0xa640('0x4b'))){_0x4a626e[_0xa640('0x1c')]=qs['limit'](_0x2faeea[_0xa640('0x2f')][_0xa640('0x1c')]);_0x4a626e[_0xa640('0x19')]=qs['offset'](_0x2faeea[_0xa640('0x2f')][_0xa640('0x19')]);}return _0xc8bd53['getDescriptions'](_0x4a626e);}})[_0xa640('0x23')](function(_0x35985c){if(_0x35985c){return _0x35985c?{'count':_0x286afb,'rows':_0x35985c}:null;}})['then'](respondWithResult(_0x1777b5,null))[_0xa640('0x46')](handleError(_0x1777b5,null));}; \ No newline at end of file +var _0x4680=['include','findAll','rows','catch','show','params','keys','find','create','body','getFields','SalesforceField','pick','nolimit','getSubjects','order','hasOwnProperty','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','model','query','intersection','fields','attributes','length','sort','where','filters','filter','merge','VIRTUAL','options','includeAll'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4680,0x106));var _0x0468=function(_0xf42772,_0x13a6d2){_0xf42772=_0xf42772-0x0;var _0x441c11=_0x4680[_0xf42772];return _0x441c11;};'use strict';var emlformat=require(_0x0468('0x0'));var rimraf=require(_0x0468('0x1'));var zipdir=require(_0x0468('0x2'));var jsonpatch=require(_0x0468('0x3'));var rp=require('request-promise');var moment=require(_0x0468('0x4'));var BPromise=require(_0x0468('0x5'));var Mustache=require(_0x0468('0x6'));var util=require(_0x0468('0x7'));var path=require(_0x0468('0x8'));var sox=require(_0x0468('0x9'));var csv=require(_0x0468('0xa'));var ejs=require(_0x0468('0xb'));var fs=require('fs');var fs_extra=require(_0x0468('0xc'));var _=require('lodash');var squel=require(_0x0468('0xd'));var crypto=require(_0x0468('0xe'));var jsforce=require(_0x0468('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0468('0xa'));var querystring=require(_0x0468('0x10'));var Papa=require(_0x0468('0x11'));var Redis=require(_0x0468('0x12'));var authService=require(_0x0468('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0468('0x14'));var hardwareService=require(_0x0468('0x15'));var logger=require('../../config/logger')(_0x0468('0x16'));var utils=require('../../config/utils');var config=require(_0x0468('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0468('0x18'))['db'];function respondWithStatusCode(_0x34c20e,_0x468a71){_0x468a71=_0x468a71||0xcc;return function(_0x290c4d){if(_0x290c4d){return _0x34c20e[_0x0468('0x19')](_0x468a71);}return _0x34c20e[_0x0468('0x1a')](_0x468a71)[_0x0468('0x1b')]();};}function respondWithResult(_0x2fa8b4,_0x1cf0a0){_0x1cf0a0=_0x1cf0a0||0xc8;return function(_0x2f583f){if(_0x2f583f){return _0x2fa8b4[_0x0468('0x1a')](_0x1cf0a0)[_0x0468('0x1c')](_0x2f583f);}};}function respondWithFilteredResult(_0x536a56,_0x12537a){return function(_0x1d6c06){if(_0x1d6c06){var _0x53015a=typeof _0x12537a[_0x0468('0x1d')]===_0x0468('0x1e')&&typeof _0x12537a[_0x0468('0x1f')]===_0x0468('0x1e');var _0x55740c=_0x1d6c06[_0x0468('0x20')];var _0x1d7aeb=_0x53015a?0x0:_0x12537a[_0x0468('0x1d')];var _0xf34b81=_0x53015a?_0x1d6c06[_0x0468('0x20')]:_0x12537a[_0x0468('0x1d')]+_0x12537a[_0x0468('0x1f')];var _0x5efe2a;if(_0xf34b81>=_0x55740c){_0xf34b81=_0x55740c;_0x5efe2a=0xc8;}else{_0x5efe2a=0xce;}_0x536a56[_0x0468('0x1a')](_0x5efe2a);return _0x536a56[_0x0468('0x21')](_0x0468('0x22'),_0x1d7aeb+'-'+_0xf34b81+'/'+_0x55740c)[_0x0468('0x1c')](_0x1d6c06);}return null;};}function patchUpdates(_0x199290){return function(_0x16b8e6){try{jsonpatch[_0x0468('0x23')](_0x16b8e6,_0x199290,!![]);}catch(_0x47550a){return BPromise['reject'](_0x47550a);}return _0x16b8e6['save']();};}function saveUpdates(_0x1f8d9a,_0x39eae6){return function(_0x4231a6){if(_0x4231a6){return _0x4231a6[_0x0468('0x24')](_0x1f8d9a)[_0x0468('0x25')](function(_0x24fbe7){return _0x24fbe7;});}return null;};}function removeEntity(_0x5d9330,_0x57a232){return function(_0x4cbbdf){if(_0x4cbbdf){return _0x4cbbdf[_0x0468('0x26')]()[_0x0468('0x25')](function(){_0x5d9330[_0x0468('0x1a')](0xcc)[_0x0468('0x1b')]();});}};}function handleEntityNotFound(_0x639946,_0x23e772){return function(_0x4beab9){if(!_0x4beab9){_0x639946['sendStatus'](0x194);}return _0x4beab9;};}function handleError(_0x3b9d1f,_0x3d36a1){_0x3d36a1=_0x3d36a1||0x1f4;return function(_0x57c1cd){logger[_0x0468('0x27')](_0x57c1cd[_0x0468('0x28')]);if(_0x57c1cd[_0x0468('0x29')]){delete _0x57c1cd[_0x0468('0x29')];}_0x3b9d1f[_0x0468('0x1a')](_0x3d36a1)[_0x0468('0x2a')](_0x57c1cd);};}exports[_0x0468('0x2b')]=function(_0x4097fd,_0x4494d8){var _0x240782={},_0x4ef16e={},_0x46d8a6={'count':0x0,'rows':[]};var _0x41f02c=_[_0x0468('0x2c')](db[_0x0468('0x2d')][_0x0468('0x2e')],function(_0x384e1c){return{'name':_0x384e1c['fieldName'],'type':_0x384e1c[_0x0468('0x2f')]['key']};});_0x4ef16e[_0x0468('0x30')]=_[_0x0468('0x2c')](_0x41f02c,'name');_0x4ef16e[_0x0468('0x31')]=_['keys'](_0x4097fd['query']);_0x4ef16e['filters']=_[_0x0468('0x32')](_0x4ef16e[_0x0468('0x30')],_0x4ef16e[_0x0468('0x31')]);_0x240782['attributes']=_[_0x0468('0x32')](_0x4ef16e[_0x0468('0x30')],qs[_0x0468('0x33')](_0x4097fd[_0x0468('0x31')][_0x0468('0x33')]));_0x240782[_0x0468('0x34')]=_0x240782[_0x0468('0x34')][_0x0468('0x35')]?_0x240782[_0x0468('0x34')]:_0x4ef16e[_0x0468('0x30')];if(!_0x4097fd[_0x0468('0x31')]['hasOwnProperty']('nolimit')){_0x240782[_0x0468('0x1f')]=qs[_0x0468('0x1f')](_0x4097fd[_0x0468('0x31')]['limit']);_0x240782[_0x0468('0x1d')]=qs['offset'](_0x4097fd[_0x0468('0x31')][_0x0468('0x1d')]);}_0x240782['order']=qs[_0x0468('0x36')](_0x4097fd[_0x0468('0x31')][_0x0468('0x36')]);_0x240782[_0x0468('0x37')]=qs['filters'](_['pick'](_0x4097fd[_0x0468('0x31')],_0x4ef16e[_0x0468('0x38')]),_0x41f02c);if(_0x4097fd[_0x0468('0x31')][_0x0468('0x39')]){_0x240782[_0x0468('0x37')]=_[_0x0468('0x3a')](_0x240782['where'],{'$or':_[_0x0468('0x2c')](_0x41f02c,function(_0x4be3db){if(_0x4be3db['type']!==_0x0468('0x3b')){var _0x32943a={};_0x32943a[_0x4be3db['name']]={'$like':'%'+_0x4097fd[_0x0468('0x31')][_0x0468('0x39')]+'%'};return _0x32943a;}})});}_0x240782=_['merge']({},_0x240782,_0x4097fd[_0x0468('0x3c')]);var _0x5cf07e={'where':_0x240782[_0x0468('0x37')]};return db[_0x0468('0x2d')][_0x0468('0x20')](_0x5cf07e)[_0x0468('0x25')](function(_0x488fcc){_0x46d8a6[_0x0468('0x20')]=_0x488fcc;if(_0x4097fd['query'][_0x0468('0x3d')]){_0x240782[_0x0468('0x3e')]=[{'all':!![]}];}return db[_0x0468('0x2d')][_0x0468('0x3f')](_0x240782);})[_0x0468('0x25')](function(_0x3ae44a){_0x46d8a6[_0x0468('0x40')]=_0x3ae44a;return _0x46d8a6;})['then'](respondWithFilteredResult(_0x4494d8,_0x240782))[_0x0468('0x41')](handleError(_0x4494d8,null));};exports[_0x0468('0x42')]=function(_0x1c529d,_0x5512f2){var _0x3d5cf7={'raw':![],'where':{'id':_0x1c529d[_0x0468('0x43')]['id']}},_0xaebb5d={};_0xaebb5d['model']=_['keys'](db['SalesforceConfiguration'][_0x0468('0x2e')]);_0xaebb5d['query']=_[_0x0468('0x44')](_0x1c529d[_0x0468('0x31')]);_0xaebb5d[_0x0468('0x38')]=_[_0x0468('0x32')](_0xaebb5d[_0x0468('0x30')],_0xaebb5d['query']);_0x3d5cf7['attributes']=_['intersection'](_0xaebb5d[_0x0468('0x30')],qs['fields'](_0x1c529d[_0x0468('0x31')][_0x0468('0x33')]));_0x3d5cf7['attributes']=_0x3d5cf7[_0x0468('0x34')][_0x0468('0x35')]?_0x3d5cf7[_0x0468('0x34')]:_0xaebb5d[_0x0468('0x30')];if(_0x1c529d[_0x0468('0x31')][_0x0468('0x3d')]){_0x3d5cf7[_0x0468('0x3e')]=[{'all':!![]}];}_0x3d5cf7=_[_0x0468('0x3a')]({},_0x3d5cf7,_0x1c529d[_0x0468('0x3c')]);return db[_0x0468('0x2d')][_0x0468('0x45')](_0x3d5cf7)['then'](handleEntityNotFound(_0x5512f2,null))[_0x0468('0x25')](respondWithResult(_0x5512f2,null))[_0x0468('0x41')](handleError(_0x5512f2,null));};exports[_0x0468('0x46')]=function(_0x549df0,_0x1b3fdc){return db['SalesforceConfiguration']['create'](_0x549df0[_0x0468('0x47')],{})[_0x0468('0x25')](respondWithResult(_0x1b3fdc,0xc9))['catch'](handleError(_0x1b3fdc,null));};exports[_0x0468('0x24')]=function(_0x228f29,_0x408ccb){if(_0x228f29['body']['id']){delete _0x228f29['body']['id'];}return db[_0x0468('0x2d')][_0x0468('0x45')]({'where':{'id':_0x228f29[_0x0468('0x43')]['id']}})[_0x0468('0x25')](handleEntityNotFound(_0x408ccb,null))[_0x0468('0x25')](saveUpdates(_0x228f29[_0x0468('0x47')],null))['then'](respondWithResult(_0x408ccb,null))[_0x0468('0x41')](handleError(_0x408ccb,null));};exports[_0x0468('0x26')]=function(_0x401b01,_0x1c58b8){return db[_0x0468('0x2d')][_0x0468('0x45')]({'where':{'id':_0x401b01['params']['id']}})[_0x0468('0x25')](handleEntityNotFound(_0x1c58b8,null))[_0x0468('0x25')](removeEntity(_0x1c58b8,null))['catch'](handleError(_0x1c58b8,null));};exports[_0x0468('0x48')]=function(_0x353f87,_0x1aa0b7,_0x5baea3){var _0x339b23={};var _0x330458={};var _0xd5b153;var _0x3aacac;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x353f87[_0x0468('0x43')]['id']}})[_0x0468('0x25')](handleEntityNotFound(_0x1aa0b7,null))[_0x0468('0x25')](function(_0x4daaf5){if(_0x4daaf5){_0xd5b153=_0x4daaf5;_0x330458[_0x0468('0x30')]=_[_0x0468('0x44')](db[_0x0468('0x49')]['rawAttributes']);_0x330458[_0x0468('0x31')]=_[_0x0468('0x44')](_0x353f87[_0x0468('0x31')]);_0x330458[_0x0468('0x38')]=_['intersection'](_0x330458[_0x0468('0x30')],_0x330458[_0x0468('0x31')]);_0x339b23[_0x0468('0x34')]=_[_0x0468('0x32')](_0x330458[_0x0468('0x30')],qs['fields'](_0x353f87[_0x0468('0x31')][_0x0468('0x33')]));_0x339b23[_0x0468('0x34')]=_0x339b23['attributes'][_0x0468('0x35')]?_0x339b23['attributes']:_0x330458[_0x0468('0x30')];_0x339b23['order']=qs['sort'](_0x353f87[_0x0468('0x31')]['sort']);_0x339b23[_0x0468('0x37')]=qs['filters'](_[_0x0468('0x4a')](_0x353f87[_0x0468('0x31')],_0x330458[_0x0468('0x38')]));if(_0x353f87[_0x0468('0x31')][_0x0468('0x39')]){_0x339b23[_0x0468('0x37')]=_[_0x0468('0x3a')](_0x339b23[_0x0468('0x37')],{'$or':_[_0x0468('0x2c')](_0x339b23[_0x0468('0x34')],function(_0x2546dd){var _0x5e8339={};_0x5e8339[_0x2546dd]={'$like':'%'+_0x353f87[_0x0468('0x31')][_0x0468('0x39')]+'%'};return _0x5e8339;})});}_0x339b23=_[_0x0468('0x3a')]({},_0x339b23,_0x353f87['options']);return _0xd5b153['getFields'](_0x339b23);}})[_0x0468('0x25')](function(_0xbff3ea){if(_0xbff3ea){_0x3aacac=_0xbff3ea[_0x0468('0x35')];if(!_0x353f87[_0x0468('0x31')]['hasOwnProperty'](_0x0468('0x4b'))){_0x339b23['limit']=qs[_0x0468('0x1f')](_0x353f87[_0x0468('0x31')][_0x0468('0x1f')]);_0x339b23[_0x0468('0x1d')]=qs[_0x0468('0x1d')](_0x353f87[_0x0468('0x31')][_0x0468('0x1d')]);}return _0xd5b153[_0x0468('0x48')](_0x339b23);}})['then'](function(_0x2cb9aa){if(_0x2cb9aa){return _0x2cb9aa?{'count':_0x3aacac,'rows':_0x2cb9aa}:null;}})[_0x0468('0x25')](respondWithResult(_0x1aa0b7,null))[_0x0468('0x41')](handleError(_0x1aa0b7,null));};exports[_0x0468('0x4c')]=function(_0xcf57f0,_0x2d6f22,_0x49a341){var _0x42eb37={};var _0x1be55e={};var _0x49bfa7;var _0x407ac4;return db[_0x0468('0x2d')]['findOne']({'where':{'id':_0xcf57f0['params']['id']}})[_0x0468('0x25')](handleEntityNotFound(_0x2d6f22,null))[_0x0468('0x25')](function(_0x4c8dd5){if(_0x4c8dd5){_0x49bfa7=_0x4c8dd5;_0x1be55e[_0x0468('0x30')]=_[_0x0468('0x44')](db[_0x0468('0x49')][_0x0468('0x2e')]);_0x1be55e['query']=_[_0x0468('0x44')](_0xcf57f0[_0x0468('0x31')]);_0x1be55e[_0x0468('0x38')]=_[_0x0468('0x32')](_0x1be55e[_0x0468('0x30')],_0x1be55e[_0x0468('0x31')]);_0x42eb37[_0x0468('0x34')]=_[_0x0468('0x32')](_0x1be55e['model'],qs[_0x0468('0x33')](_0xcf57f0[_0x0468('0x31')][_0x0468('0x33')]));_0x42eb37['attributes']=_0x42eb37[_0x0468('0x34')]['length']?_0x42eb37[_0x0468('0x34')]:_0x1be55e['model'];_0x42eb37[_0x0468('0x4d')]=qs[_0x0468('0x36')](_0xcf57f0[_0x0468('0x31')][_0x0468('0x36')]);_0x42eb37[_0x0468('0x37')]=qs[_0x0468('0x38')](_[_0x0468('0x4a')](_0xcf57f0['query'],_0x1be55e['filters']));if(_0xcf57f0['query'][_0x0468('0x39')]){_0x42eb37[_0x0468('0x37')]=_[_0x0468('0x3a')](_0x42eb37['where'],{'$or':_['map'](_0x42eb37[_0x0468('0x34')],function(_0x44b484){var _0x268ca1={};_0x268ca1[_0x44b484]={'$like':'%'+_0xcf57f0[_0x0468('0x31')][_0x0468('0x39')]+'%'};return _0x268ca1;})});}_0x42eb37=_[_0x0468('0x3a')]({},_0x42eb37,_0xcf57f0[_0x0468('0x3c')]);return _0x49bfa7[_0x0468('0x4c')](_0x42eb37);}})[_0x0468('0x25')](function(_0x66292c){if(_0x66292c){_0x407ac4=_0x66292c[_0x0468('0x35')];if(!_0xcf57f0[_0x0468('0x31')][_0x0468('0x4e')](_0x0468('0x4b'))){_0x42eb37[_0x0468('0x1f')]=qs[_0x0468('0x1f')](_0xcf57f0[_0x0468('0x31')][_0x0468('0x1f')]);_0x42eb37['offset']=qs[_0x0468('0x1d')](_0xcf57f0[_0x0468('0x31')][_0x0468('0x1d')]);}return _0x49bfa7['getSubjects'](_0x42eb37);}})[_0x0468('0x25')](function(_0x248bc7){if(_0x248bc7){return _0x248bc7?{'count':_0x407ac4,'rows':_0x248bc7}:null;}})[_0x0468('0x25')](respondWithResult(_0x2d6f22,null))[_0x0468('0x41')](handleError(_0x2d6f22,null));};exports[_0x0468('0x4f')]=function(_0x2aba4c,_0x19a660,_0x223942){var _0x4f32a2={};var _0x58a32f={};var _0x1913d7;var _0x38b263;return db[_0x0468('0x2d')][_0x0468('0x50')]({'where':{'id':_0x2aba4c[_0x0468('0x43')]['id']}})['then'](handleEntityNotFound(_0x19a660,null))[_0x0468('0x25')](function(_0x2a2c15){if(_0x2a2c15){_0x1913d7=_0x2a2c15;_0x58a32f[_0x0468('0x30')]=_[_0x0468('0x44')](db[_0x0468('0x49')][_0x0468('0x2e')]);_0x58a32f['query']=_[_0x0468('0x44')](_0x2aba4c[_0x0468('0x31')]);_0x58a32f[_0x0468('0x38')]=_[_0x0468('0x32')](_0x58a32f[_0x0468('0x30')],_0x58a32f[_0x0468('0x31')]);_0x4f32a2[_0x0468('0x34')]=_[_0x0468('0x32')](_0x58a32f['model'],qs[_0x0468('0x33')](_0x2aba4c[_0x0468('0x31')][_0x0468('0x33')]));_0x4f32a2[_0x0468('0x34')]=_0x4f32a2['attributes'][_0x0468('0x35')]?_0x4f32a2[_0x0468('0x34')]:_0x58a32f[_0x0468('0x30')];_0x4f32a2[_0x0468('0x4d')]=qs[_0x0468('0x36')](_0x2aba4c[_0x0468('0x31')][_0x0468('0x36')]);_0x4f32a2[_0x0468('0x37')]=qs[_0x0468('0x38')](_[_0x0468('0x4a')](_0x2aba4c['query'],_0x58a32f[_0x0468('0x38')]));if(_0x2aba4c[_0x0468('0x31')][_0x0468('0x39')]){_0x4f32a2[_0x0468('0x37')]=_[_0x0468('0x3a')](_0x4f32a2[_0x0468('0x37')],{'$or':_[_0x0468('0x2c')](_0x4f32a2[_0x0468('0x34')],function(_0x199863){var _0x4bb7be={};_0x4bb7be[_0x199863]={'$like':'%'+_0x2aba4c[_0x0468('0x31')][_0x0468('0x39')]+'%'};return _0x4bb7be;})});}_0x4f32a2=_[_0x0468('0x3a')]({},_0x4f32a2,_0x2aba4c['options']);return _0x1913d7[_0x0468('0x4f')](_0x4f32a2);}})['then'](function(_0x245988){if(_0x245988){_0x38b263=_0x245988['length'];if(!_0x2aba4c[_0x0468('0x31')][_0x0468('0x4e')]('nolimit')){_0x4f32a2[_0x0468('0x1f')]=qs[_0x0468('0x1f')](_0x2aba4c[_0x0468('0x31')][_0x0468('0x1f')]);_0x4f32a2['offset']=qs['offset'](_0x2aba4c[_0x0468('0x31')][_0x0468('0x1d')]);}return _0x1913d7[_0x0468('0x4f')](_0x4f32a2);}})[_0x0468('0x25')](function(_0x5525a8){if(_0x5525a8){return _0x5525a8?{'count':_0x38b263,'rows':_0x5525a8}:null;}})['then'](respondWithResult(_0x19a660,null))[_0x0468('0x41')](handleError(_0x19a660,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3d0090f..8d3c7aa 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 _0xed8e=['moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','api'];(function(_0x153162,_0xd7921d){var _0x2f4492=function(_0x23c4ad){while(--_0x23c4ad){_0x153162['push'](_0x153162['shift']());}};_0x2f4492(++_0xd7921d);}(_0xed8e,0x106));var _0xeed8=function(_0x2ecb20,_0xc80eb1){_0x2ecb20=_0x2ecb20-0x0;var _0x1d9f39=_0xed8e[_0x2ecb20];return _0x1d9f39;};'use strict';var _=require('lodash');var util=require(_0xeed8('0x0'));var logger=require('../../config/logger')(_0xeed8('0x1'));var moment=require(_0xeed8('0x2'));var BPromise=require(_0xeed8('0x3'));var rp=require(_0xeed8('0x4'));var fs=require('fs');var path=require(_0xeed8('0x5'));var rimraf=require('rimraf');var config=require(_0xeed8('0x6'));var attributes=require(_0xeed8('0x7'));module[_0xeed8('0x8')]=function(_0x4e785a,_0x390f5c){return _0x4e785a[_0xeed8('0x9')](_0xeed8('0xa'),attributes,{'tableName':_0xeed8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aea=['define','int_salesforce_configurations','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x0aea,0xfe));var _0xa0ae=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0aea[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa0ae('0x0'));var rp=require(_0xa0ae('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa0ae('0x2'));var attributes=require(_0xa0ae('0x3'));module[_0xa0ae('0x4')]=function(_0x3f3a87,_0x1d972f){return _0x3f3a87[_0xa0ae('0x5')]('SalesforceConfiguration',attributes,{'tableName':_0xa0ae('0x6'),'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 a25c2d5..eb1fea3 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 _0xe2cd=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','ioredis'];(function(_0x24dc9a,_0x460710){var _0x13b699=function(_0x37311a){while(--_0x37311a){_0x24dc9a['push'](_0x24dc9a['shift']());}};_0x13b699(++_0x460710);}(_0xe2cd,0xf8));var _0xde2c=function(_0xb5848,_0x1ed810){_0xb5848=_0xb5848-0x0;var _0x25eecb=_0xe2cd[_0xb5848];return _0x25eecb;};'use strict';var _=require(_0xde2c('0x0'));var util=require(_0xde2c('0x1'));var moment=require(_0xde2c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde2c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xde2c('0x4'));var logger=require('../../config/logger')(_0xde2c('0x5'));var config=require(_0xde2c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xde2c('0x7')][_0xde2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cb28f,_0x3aa47b,_0x30def8){return new BPromise(function(_0x2f27d9,_0x19bd68){return client[_0xde2c('0x9')](_0x4cb28f,_0x30def8)[_0xde2c('0xa')](function(_0x97a030){logger[_0xde2c('0xb')](_0xde2c('0xc'),_0x3aa47b,_0xde2c('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3aa47b,_0xde2c('0xd'),JSON[_0xde2c('0xe')](_0x97a030));if(_0x97a030[_0xde2c('0xf')]){if(_0x97a030[_0xde2c('0xf')][_0xde2c('0x10')]===0x1f4){logger[_0xde2c('0xf')](_0xde2c('0xc'),_0x3aa47b,_0x97a030['error']['message']);return _0x19bd68(_0x97a030[_0xde2c('0xf')][_0xde2c('0x11')]);}logger[_0xde2c('0xf')](_0xde2c('0xc'),_0x3aa47b,_0x97a030[_0xde2c('0xf')][_0xde2c('0x11')]);return _0x2f27d9(_0x97a030[_0xde2c('0xf')][_0xde2c('0x11')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3aa47b,_0xde2c('0xd'));_0x2f27d9(_0x97a030['result']['message']);}})['catch'](function(_0x513b58){logger[_0xde2c('0xf')](_0xde2c('0xc'),_0x3aa47b,_0x513b58);_0x19bd68(_0x513b58);});});} \ No newline at end of file +var _0x8eb0=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3dc235,_0x231911){var _0x16cbc4=function(_0x1895c1){while(--_0x1895c1){_0x3dc235['push'](_0x3dc235['shift']());}};_0x16cbc4(++_0x231911);}(_0x8eb0,0xe9));var _0x08eb=function(_0x3c9f06,_0x1641b2){_0x3c9f06=_0x3c9f06-0x0;var _0x25e22a=_0x8eb0[_0x3c9f06];return _0x25e22a;};'use strict';var _=require(_0x08eb('0x0'));var util=require(_0x08eb('0x1'));var moment=require(_0x08eb('0x2'));var BPromise=require(_0x08eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08eb('0x4'));var db=require(_0x08eb('0x5'))['db'];var utils=require(_0x08eb('0x6'));var logger=require(_0x08eb('0x7'))(_0x08eb('0x8'));var config=require(_0x08eb('0x9'));var jayson=require(_0x08eb('0xa'));var client=jayson[_0x08eb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174a92,_0x359931,_0x137960){return new BPromise(function(_0x539e18,_0xa13cbf){return client[_0x08eb('0xc')](_0x174a92,_0x137960)[_0x08eb('0xd')](function(_0x34b90f){logger[_0x08eb('0xe')](_0x08eb('0xf'),_0x359931,_0x08eb('0x10'));logger[_0x08eb('0x11')](_0x08eb('0x12'),_0x359931,_0x08eb('0x10'),JSON[_0x08eb('0x13')](_0x34b90f));if(_0x34b90f[_0x08eb('0x14')]){if(_0x34b90f['error'][_0x08eb('0x15')]===0x1f4){logger[_0x08eb('0x14')](_0x08eb('0xf'),_0x359931,_0x34b90f[_0x08eb('0x14')][_0x08eb('0x16')]);return _0xa13cbf(_0x34b90f[_0x08eb('0x14')][_0x08eb('0x16')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x359931,_0x34b90f[_0x08eb('0x14')][_0x08eb('0x16')]);return _0x539e18(_0x34b90f[_0x08eb('0x14')]['message']);}else{logger[_0x08eb('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x359931,_0x08eb('0x10'));_0x539e18(_0x34b90f[_0x08eb('0x17')][_0x08eb('0x16')]);}})[_0x08eb('0x18')](function(_0x31844d){logger[_0x08eb('0x14')](_0x08eb('0xf'),_0x359931,_0x31844d);_0xa13cbf(_0x31844d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 84fc327..33f0bcf 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 _0xdfa7=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2faae7,_0x310385){var _0x4c9c5d=function(_0x2a773d){while(--_0x2a773d){_0x2faae7['push'](_0x2faae7['shift']());}};_0x4c9c5d(++_0x310385);}(_0xdfa7,0xac));var _0x7dfa=function(_0x3bce7b,_0x2a5eb3){_0x3bce7b=_0x3bce7b-0x0;var _0x4c692f=_0xdfa7[_0x3bce7b];return _0x4c692f;};'use strict';var multer=require('multer');var util=require(_0x7dfa('0x0'));var path=require(_0x7dfa('0x1'));var timeout=require(_0x7dfa('0x2'));var express=require(_0x7dfa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7dfa('0x4'));var interaction=require(_0x7dfa('0x5'));var config=require(_0x7dfa('0x6'));var controller=require('./intSalesforceField.controller');router[_0x7dfa('0x7')]('/',auth[_0x7dfa('0x8')](),controller[_0x7dfa('0x9')]);router[_0x7dfa('0x7')](_0x7dfa('0xa'),auth[_0x7dfa('0x8')](),controller[_0x7dfa('0xb')]);router[_0x7dfa('0xc')]('/',auth[_0x7dfa('0x8')](),controller[_0x7dfa('0xd')]);router[_0x7dfa('0xe')](_0x7dfa('0xa'),auth['isAuthenticated'](),controller[_0x7dfa('0xf')]);router[_0x7dfa('0x10')](_0x7dfa('0xa'),auth[_0x7dfa('0x8')](),controller[_0x7dfa('0x11')]);module[_0x7dfa('0x12')]=router; \ No newline at end of file +var _0xff2e=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x1d3466,_0x4a8ffe){var _0x47ecfb=function(_0x497252){while(--_0x497252){_0x1d3466['push'](_0x1d3466['shift']());}};_0x47ecfb(++_0x4a8ffe);}(_0xff2e,0x8f));var _0xeff2=function(_0x1c4ce7,_0x31ee86){_0x1c4ce7=_0x1c4ce7-0x0;var _0x3ce6d2=_0xff2e[_0x1c4ce7];return _0x3ce6d2;};'use strict';var multer=require(_0xeff2('0x0'));var util=require(_0xeff2('0x1'));var path=require(_0xeff2('0x2'));var timeout=require(_0xeff2('0x3'));var express=require(_0xeff2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeff2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeff2('0x6'));var controller=require(_0xeff2('0x7'));router[_0xeff2('0x8')]('/',auth[_0xeff2('0x9')](),controller[_0xeff2('0xa')]);router[_0xeff2('0x8')](_0xeff2('0xb'),auth[_0xeff2('0x9')](),controller[_0xeff2('0xc')]);router[_0xeff2('0xd')]('/',auth[_0xeff2('0x9')](),controller[_0xeff2('0xe')]);router[_0xeff2('0xf')](_0xeff2('0xb'),auth['isAuthenticated'](),controller[_0xeff2('0x10')]);router[_0xeff2('0x11')](_0xeff2('0xb'),auth['isAuthenticated'](),controller[_0xeff2('0x12')]);module[_0xeff2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 53e2bf9..c463d11 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 _0x21df=['STRING','ENUM','variable','sequelize','string','customVariable','picklist'];(function(_0x86ce09,_0x2c3244){var _0x5c00ef=function(_0x40794f){while(--_0x40794f){_0x86ce09['push'](_0x86ce09['shift']());}};_0x5c00ef(++_0x2c3244);}(_0x21df,0x129));var _0xf21d=function(_0x5be1f1,_0x3ed24e){_0x5be1f1=_0x5be1f1-0x0;var _0x59d6d5=_0x21df[_0x5be1f1];return _0x59d6d5;};'use strict';var Sequelize=require(_0xf21d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf21d('0x1'),'variable',_0xf21d('0x2'),'keyValue',_0xf21d('0x3')),'defaultValue':_0xf21d('0x1')},'content':{'type':Sequelize[_0xf21d('0x4')]},'key':{'type':Sequelize[_0xf21d('0x4')]},'keyType':{'type':Sequelize[_0xf21d('0x5')]('string',_0xf21d('0x6'),_0xf21d('0x2'))},'keyContent':{'type':Sequelize[_0xf21d('0x4')]},'idField':{'type':Sequelize[_0xf21d('0x4')]},'variableName':{'type':Sequelize[_0xf21d('0x4')]}}; \ No newline at end of file +var _0x1841=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x1e91b8,_0x54104d){var _0x4e936f=function(_0x34d3fb){while(--_0x34d3fb){_0x1e91b8['push'](_0x1e91b8['shift']());}};_0x4e936f(++_0x54104d);}(_0x1841,0xad));var _0x1184=function(_0x5b54cb,_0x582277){_0x5b54cb=_0x5b54cb-0x0;var _0xc71d65=_0x1841[_0x5b54cb];return _0xc71d65;};'use strict';var Sequelize=require(_0x1184('0x0'));module[_0x1184('0x1')]={'type':{'type':Sequelize[_0x1184('0x2')](_0x1184('0x3'),_0x1184('0x4'),_0x1184('0x5'),_0x1184('0x6'),_0x1184('0x7')),'defaultValue':_0x1184('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1184('0x8')]},'keyType':{'type':Sequelize[_0x1184('0x2')](_0x1184('0x3'),_0x1184('0x4'),_0x1184('0x5'))},'keyContent':{'type':Sequelize[_0x1184('0x8')]},'idField':{'type':Sequelize[_0x1184('0x8')]},'variableName':{'type':Sequelize[_0x1184('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b2e5043..0fd17bb 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 _0xdad5=['params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','SalesforceField','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xdad5,0x172));var _0x5dad=function(_0xd58916,_0x490176){_0xd58916=_0xd58916-0x0;var _0x2209aa=_0xdad5[_0xd58916];return _0x2209aa;};'use strict';var emlformat=require(_0x5dad('0x0'));var rimraf=require(_0x5dad('0x1'));var zipdir=require(_0x5dad('0x2'));var jsonpatch=require(_0x5dad('0x3'));var rp=require(_0x5dad('0x4'));var moment=require(_0x5dad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5dad('0x6'));var path=require(_0x5dad('0x7'));var sox=require(_0x5dad('0x8'));var csv=require(_0x5dad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dad('0xa'));var _=require(_0x5dad('0xb'));var squel=require(_0x5dad('0xc'));var crypto=require(_0x5dad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dad('0xe'));var toCsv=require(_0x5dad('0x9'));var querystring=require(_0x5dad('0xf'));var Papa=require(_0x5dad('0x10'));var Redis=require(_0x5dad('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5dad('0x12'));var as=require(_0x5dad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dad('0x14'));var utils=require(_0x5dad('0x15'));var config=require(_0x5dad('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1525bd,_0x2af022){_0x2af022=_0x2af022||0xcc;return function(_0x28c280){if(_0x28c280){return _0x1525bd[_0x5dad('0x17')](_0x2af022);}return _0x1525bd[_0x5dad('0x18')](_0x2af022)[_0x5dad('0x19')]();};}function respondWithResult(_0xa388c1,_0x458902){_0x458902=_0x458902||0xc8;return function(_0x42b62a){if(_0x42b62a){return _0xa388c1[_0x5dad('0x18')](_0x458902)['json'](_0x42b62a);}};}function respondWithFilteredResult(_0x4cc90a,_0x52ceea){return function(_0x135e9d){if(_0x135e9d){var _0xde4759=typeof _0x52ceea['offset']===_0x5dad('0x1a')&&typeof _0x52ceea['limit']===_0x5dad('0x1a');var _0x46a09d=_0x135e9d[_0x5dad('0x1b')];var _0x521189=_0xde4759?0x0:_0x52ceea[_0x5dad('0x1c')];var _0x3951fd=_0xde4759?_0x135e9d['count']:_0x52ceea[_0x5dad('0x1c')]+_0x52ceea['limit'];var _0x2a9778;if(_0x3951fd>=_0x46a09d){_0x3951fd=_0x46a09d;_0x2a9778=0xc8;}else{_0x2a9778=0xce;}_0x4cc90a[_0x5dad('0x18')](_0x2a9778);return _0x4cc90a[_0x5dad('0x1d')](_0x5dad('0x1e'),_0x521189+'-'+_0x3951fd+'/'+_0x46a09d)[_0x5dad('0x1f')](_0x135e9d);}return null;};}function patchUpdates(_0x4f0997){return function(_0x2fc07b){try{jsonpatch['apply'](_0x2fc07b,_0x4f0997,!![]);}catch(_0xb48be6){return BPromise[_0x5dad('0x20')](_0xb48be6);}return _0x2fc07b['save']();};}function saveUpdates(_0x212eb6,_0x8d6f53){return function(_0x5e792f){if(_0x5e792f){return _0x5e792f[_0x5dad('0x21')](_0x212eb6)[_0x5dad('0x22')](function(_0x3b5488){return _0x3b5488;});}return null;};}function removeEntity(_0x166299,_0x19e04e){return function(_0x44816a){if(_0x44816a){return _0x44816a[_0x5dad('0x23')]()[_0x5dad('0x22')](function(){_0x166299[_0x5dad('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5549f9,_0x393f20){return function(_0x54e276){if(!_0x54e276){_0x5549f9[_0x5dad('0x17')](0x194);}return _0x54e276;};}function handleError(_0x3b5d3b,_0x150d1a){_0x150d1a=_0x150d1a||0x1f4;return function(_0x151a9a){logger[_0x5dad('0x24')](_0x151a9a[_0x5dad('0x25')]);if(_0x151a9a[_0x5dad('0x26')]){delete _0x151a9a[_0x5dad('0x26')];}_0x3b5d3b['status'](_0x150d1a)[_0x5dad('0x27')](_0x151a9a);};}exports['index']=function(_0x1396af,_0x39ff51){var _0x465859={},_0x46a081={},_0xae2864={'count':0x0,'rows':[]};var _0x1a89e4=_['map'](db[_0x5dad('0x28')][_0x5dad('0x29')],function(_0x26a3b5){return{'name':_0x26a3b5[_0x5dad('0x2a')],'type':_0x26a3b5[_0x5dad('0x2b')]['key']};});_0x46a081['model']=_[_0x5dad('0x2c')](_0x1a89e4,_0x5dad('0x26'));_0x46a081[_0x5dad('0x2d')]=_['keys'](_0x1396af[_0x5dad('0x2d')]);_0x46a081[_0x5dad('0x2e')]=_[_0x5dad('0x2f')](_0x46a081[_0x5dad('0x30')],_0x46a081[_0x5dad('0x2d')]);_0x465859[_0x5dad('0x31')]=_['intersection'](_0x46a081[_0x5dad('0x30')],qs[_0x5dad('0x32')](_0x1396af['query']['fields']));_0x465859[_0x5dad('0x31')]=_0x465859[_0x5dad('0x31')][_0x5dad('0x33')]?_0x465859[_0x5dad('0x31')]:_0x46a081[_0x5dad('0x30')];if(!_0x1396af[_0x5dad('0x2d')][_0x5dad('0x34')](_0x5dad('0x35'))){_0x465859[_0x5dad('0x36')]=qs[_0x5dad('0x36')](_0x1396af['query'][_0x5dad('0x36')]);_0x465859['offset']=qs[_0x5dad('0x1c')](_0x1396af[_0x5dad('0x2d')][_0x5dad('0x1c')]);}_0x465859[_0x5dad('0x37')]=qs[_0x5dad('0x38')](_0x1396af['query']['sort']);_0x465859[_0x5dad('0x39')]=qs[_0x5dad('0x2e')](_[_0x5dad('0x3a')](_0x1396af[_0x5dad('0x2d')],_0x46a081[_0x5dad('0x2e')]),_0x1a89e4);if(_0x1396af[_0x5dad('0x2d')][_0x5dad('0x3b')]){_0x465859[_0x5dad('0x39')]=_[_0x5dad('0x3c')](_0x465859[_0x5dad('0x39')],{'$or':_[_0x5dad('0x2c')](_0x1a89e4,function(_0x54faef){if(_0x54faef['type']!==_0x5dad('0x3d')){var _0x5c64a7={};_0x5c64a7[_0x54faef[_0x5dad('0x26')]]={'$like':'%'+_0x1396af[_0x5dad('0x2d')][_0x5dad('0x3b')]+'%'};return _0x5c64a7;}})});}_0x465859=_[_0x5dad('0x3c')]({},_0x465859,_0x1396af[_0x5dad('0x3e')]);var _0x10a7dd={'where':_0x465859[_0x5dad('0x39')]};return db[_0x5dad('0x28')][_0x5dad('0x1b')](_0x10a7dd)['then'](function(_0x24272f){_0xae2864[_0x5dad('0x1b')]=_0x24272f;if(_0x1396af[_0x5dad('0x2d')][_0x5dad('0x3f')]){_0x465859[_0x5dad('0x40')]=[{'all':!![]}];}return db[_0x5dad('0x28')]['findAll'](_0x465859);})[_0x5dad('0x22')](function(_0x593d7c){_0xae2864[_0x5dad('0x41')]=_0x593d7c;return _0xae2864;})[_0x5dad('0x22')](respondWithFilteredResult(_0x39ff51,_0x465859))[_0x5dad('0x42')](handleError(_0x39ff51,null));};exports[_0x5dad('0x43')]=function(_0x4e708e,_0x11159e){var _0x50c9e1={'raw':!![],'where':{'id':_0x4e708e[_0x5dad('0x44')]['id']}},_0x20f8d8={};_0x20f8d8[_0x5dad('0x30')]=_[_0x5dad('0x45')](db[_0x5dad('0x28')][_0x5dad('0x29')]);_0x20f8d8[_0x5dad('0x2d')]=_['keys'](_0x4e708e[_0x5dad('0x2d')]);_0x20f8d8[_0x5dad('0x2e')]=_[_0x5dad('0x2f')](_0x20f8d8[_0x5dad('0x30')],_0x20f8d8['query']);_0x50c9e1['attributes']=_[_0x5dad('0x2f')](_0x20f8d8[_0x5dad('0x30')],qs['fields'](_0x4e708e['query'][_0x5dad('0x32')]));_0x50c9e1[_0x5dad('0x31')]=_0x50c9e1[_0x5dad('0x31')][_0x5dad('0x33')]?_0x50c9e1['attributes']:_0x20f8d8['model'];if(_0x4e708e[_0x5dad('0x2d')]['includeAll']){_0x50c9e1[_0x5dad('0x40')]=[{'all':!![]}];}_0x50c9e1=_['merge']({},_0x50c9e1,_0x4e708e['options']);return db['SalesforceField'][_0x5dad('0x46')](_0x50c9e1)['then'](handleEntityNotFound(_0x11159e,null))[_0x5dad('0x22')](respondWithResult(_0x11159e,null))[_0x5dad('0x42')](handleError(_0x11159e,null));};exports[_0x5dad('0x47')]=function(_0x1f2453,_0x3ec5c6){return db[_0x5dad('0x28')][_0x5dad('0x47')](_0x1f2453[_0x5dad('0x48')],{})[_0x5dad('0x22')](respondWithResult(_0x3ec5c6,0xc9))[_0x5dad('0x42')](handleError(_0x3ec5c6,null));};exports[_0x5dad('0x21')]=function(_0xc91e2f,_0x905768){if(_0xc91e2f['body']['id']){delete _0xc91e2f[_0x5dad('0x48')]['id'];}return db[_0x5dad('0x28')][_0x5dad('0x46')]({'where':{'id':_0xc91e2f['params']['id']}})['then'](handleEntityNotFound(_0x905768,null))[_0x5dad('0x22')](saveUpdates(_0xc91e2f[_0x5dad('0x48')],null))[_0x5dad('0x22')](respondWithResult(_0x905768,null))['catch'](handleError(_0x905768,null));};exports[_0x5dad('0x23')]=function(_0x150c0e,_0x49188e){return db[_0x5dad('0x28')]['find']({'where':{'id':_0x150c0e['params']['id']}})['then'](handleEntityNotFound(_0x49188e,null))[_0x5dad('0x22')](removeEntity(_0x49188e,null))[_0x5dad('0x42')](handleError(_0x49188e,null));}; \ No newline at end of file +var _0xeddc=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SalesforceField','findAll','keys','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit'];(function(_0x5776ce,_0x2e210a){var _0x1ba506=function(_0x73193b){while(--_0x73193b){_0x5776ce['push'](_0x5776ce['shift']());}};_0x1ba506(++_0x2e210a);}(_0xeddc,0xfc));var _0xcedd=function(_0x5b751c,_0x433170){_0x5b751c=_0x5b751c-0x0;var _0x26cb0d=_0xeddc[_0x5b751c];return _0x26cb0d;};'use strict';var emlformat=require(_0xcedd('0x0'));var rimraf=require(_0xcedd('0x1'));var zipdir=require(_0xcedd('0x2'));var jsonpatch=require(_0xcedd('0x3'));var rp=require('request-promise');var moment=require(_0xcedd('0x4'));var BPromise=require(_0xcedd('0x5'));var Mustache=require('mustache');var util=require(_0xcedd('0x6'));var path=require(_0xcedd('0x7'));var sox=require(_0xcedd('0x8'));var csv=require(_0xcedd('0x9'));var ejs=require(_0xcedd('0xa'));var fs=require('fs');var fs_extra=require(_0xcedd('0xb'));var _=require(_0xcedd('0xc'));var squel=require(_0xcedd('0xd'));var crypto=require(_0xcedd('0xe'));var jsforce=require(_0xcedd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcedd('0x10'));var Papa=require(_0xcedd('0x11'));var Redis=require(_0xcedd('0x12'));var authService=require(_0xcedd('0x13'));var qs=require(_0xcedd('0x14'));var as=require(_0xcedd('0x15'));var hardwareService=require(_0xcedd('0x16'));var logger=require(_0xcedd('0x17'))(_0xcedd('0x18'));var utils=require(_0xcedd('0x19'));var config=require(_0xcedd('0x1a'));var licenseUtil=require(_0xcedd('0x1b'));var db=require(_0xcedd('0x1c'))['db'];function respondWithStatusCode(_0x137fe4,_0x44c4c9){_0x44c4c9=_0x44c4c9||0xcc;return function(_0xecbeb8){if(_0xecbeb8){return _0x137fe4['sendStatus'](_0x44c4c9);}return _0x137fe4[_0xcedd('0x1d')](_0x44c4c9)['end']();};}function respondWithResult(_0xee2067,_0x3b2f57){_0x3b2f57=_0x3b2f57||0xc8;return function(_0x56e58a){if(_0x56e58a){return _0xee2067[_0xcedd('0x1d')](_0x3b2f57)[_0xcedd('0x1e')](_0x56e58a);}};}function respondWithFilteredResult(_0x29f77f,_0x3fa939){return function(_0x4b6011){if(_0x4b6011){var _0x4e7c4e=typeof _0x3fa939[_0xcedd('0x1f')]==='undefined'&&typeof _0x3fa939[_0xcedd('0x20')]===_0xcedd('0x21');var _0x3a7bf4=_0x4b6011['count'];var _0x46f996=_0x4e7c4e?0x0:_0x3fa939[_0xcedd('0x1f')];var _0x3348a5=_0x4e7c4e?_0x4b6011[_0xcedd('0x22')]:_0x3fa939[_0xcedd('0x1f')]+_0x3fa939['limit'];var _0x15ecdf;if(_0x3348a5>=_0x3a7bf4){_0x3348a5=_0x3a7bf4;_0x15ecdf=0xc8;}else{_0x15ecdf=0xce;}_0x29f77f[_0xcedd('0x1d')](_0x15ecdf);return _0x29f77f[_0xcedd('0x23')]('Content-Range',_0x46f996+'-'+_0x3348a5+'/'+_0x3a7bf4)[_0xcedd('0x1e')](_0x4b6011);}return null;};}function patchUpdates(_0x186a86){return function(_0x4c986d){try{jsonpatch[_0xcedd('0x24')](_0x4c986d,_0x186a86,!![]);}catch(_0x11ef32){return BPromise[_0xcedd('0x25')](_0x11ef32);}return _0x4c986d[_0xcedd('0x26')]();};}function saveUpdates(_0x2b9163,_0x4e4c9b){return function(_0x2ec5df){if(_0x2ec5df){return _0x2ec5df[_0xcedd('0x27')](_0x2b9163)[_0xcedd('0x28')](function(_0x3a9a8b){return _0x3a9a8b;});}return null;};}function removeEntity(_0x4463a3,_0x5a78a7){return function(_0x1e94c4){if(_0x1e94c4){return _0x1e94c4['destroy']()['then'](function(){_0x4463a3['status'](0xcc)[_0xcedd('0x29')]();});}};}function handleEntityNotFound(_0x43c347,_0x1ae7cd){return function(_0x145015){if(!_0x145015){_0x43c347[_0xcedd('0x2a')](0x194);}return _0x145015;};}function handleError(_0x11b346,_0x151074){_0x151074=_0x151074||0x1f4;return function(_0x5bb3b0){logger[_0xcedd('0x2b')](_0x5bb3b0[_0xcedd('0x2c')]);if(_0x5bb3b0[_0xcedd('0x2d')]){delete _0x5bb3b0[_0xcedd('0x2d')];}_0x11b346[_0xcedd('0x1d')](_0x151074)[_0xcedd('0x2e')](_0x5bb3b0);};}exports['index']=function(_0x455f7f,_0x46cfb1){var _0x2fa017={},_0x516ed4={},_0x3000bf={'count':0x0,'rows':[]};var _0x4e42b1=_[_0xcedd('0x2f')](db['SalesforceField'][_0xcedd('0x30')],function(_0x4ef58d){return{'name':_0x4ef58d[_0xcedd('0x31')],'type':_0x4ef58d[_0xcedd('0x32')][_0xcedd('0x33')]};});_0x516ed4[_0xcedd('0x34')]=_[_0xcedd('0x2f')](_0x4e42b1,'name');_0x516ed4['query']=_['keys'](_0x455f7f[_0xcedd('0x35')]);_0x516ed4[_0xcedd('0x36')]=_['intersection'](_0x516ed4[_0xcedd('0x34')],_0x516ed4['query']);_0x2fa017[_0xcedd('0x37')]=_[_0xcedd('0x38')](_0x516ed4['model'],qs[_0xcedd('0x39')](_0x455f7f[_0xcedd('0x35')][_0xcedd('0x39')]));_0x2fa017[_0xcedd('0x37')]=_0x2fa017[_0xcedd('0x37')][_0xcedd('0x3a')]?_0x2fa017['attributes']:_0x516ed4['model'];if(!_0x455f7f['query']['hasOwnProperty'](_0xcedd('0x3b'))){_0x2fa017[_0xcedd('0x20')]=qs[_0xcedd('0x20')](_0x455f7f[_0xcedd('0x35')][_0xcedd('0x20')]);_0x2fa017[_0xcedd('0x1f')]=qs[_0xcedd('0x1f')](_0x455f7f[_0xcedd('0x35')][_0xcedd('0x1f')]);}_0x2fa017[_0xcedd('0x3c')]=qs[_0xcedd('0x3d')](_0x455f7f[_0xcedd('0x35')][_0xcedd('0x3d')]);_0x2fa017[_0xcedd('0x3e')]=qs[_0xcedd('0x36')](_[_0xcedd('0x3f')](_0x455f7f[_0xcedd('0x35')],_0x516ed4[_0xcedd('0x36')]),_0x4e42b1);if(_0x455f7f['query'][_0xcedd('0x40')]){_0x2fa017[_0xcedd('0x3e')]=_[_0xcedd('0x41')](_0x2fa017[_0xcedd('0x3e')],{'$or':_[_0xcedd('0x2f')](_0x4e42b1,function(_0x16a17b){if(_0x16a17b[_0xcedd('0x32')]!==_0xcedd('0x42')){var _0x34d00a={};_0x34d00a[_0x16a17b[_0xcedd('0x2d')]]={'$like':'%'+_0x455f7f[_0xcedd('0x35')][_0xcedd('0x40')]+'%'};return _0x34d00a;}})});}_0x2fa017=_[_0xcedd('0x41')]({},_0x2fa017,_0x455f7f[_0xcedd('0x43')]);var _0x4c78ed={'where':_0x2fa017['where']};return db['SalesforceField'][_0xcedd('0x22')](_0x4c78ed)['then'](function(_0x195c09){_0x3000bf['count']=_0x195c09;if(_0x455f7f[_0xcedd('0x35')][_0xcedd('0x44')]){_0x2fa017[_0xcedd('0x45')]=[{'all':!![]}];}return db[_0xcedd('0x46')][_0xcedd('0x47')](_0x2fa017);})[_0xcedd('0x28')](function(_0x549f20){_0x3000bf['rows']=_0x549f20;return _0x3000bf;})[_0xcedd('0x28')](respondWithFilteredResult(_0x46cfb1,_0x2fa017))['catch'](handleError(_0x46cfb1,null));};exports['show']=function(_0x4d992c,_0x5d9918){var _0x438726={'raw':!![],'where':{'id':_0x4d992c['params']['id']}},_0x58db53={};_0x58db53[_0xcedd('0x34')]=_[_0xcedd('0x48')](db[_0xcedd('0x46')][_0xcedd('0x30')]);_0x58db53[_0xcedd('0x35')]=_[_0xcedd('0x48')](_0x4d992c['query']);_0x58db53[_0xcedd('0x36')]=_[_0xcedd('0x38')](_0x58db53[_0xcedd('0x34')],_0x58db53['query']);_0x438726[_0xcedd('0x37')]=_[_0xcedd('0x38')](_0x58db53[_0xcedd('0x34')],qs['fields'](_0x4d992c['query'][_0xcedd('0x39')]));_0x438726['attributes']=_0x438726[_0xcedd('0x37')][_0xcedd('0x3a')]?_0x438726['attributes']:_0x58db53[_0xcedd('0x34')];if(_0x4d992c['query'][_0xcedd('0x44')]){_0x438726[_0xcedd('0x45')]=[{'all':!![]}];}_0x438726=_['merge']({},_0x438726,_0x4d992c[_0xcedd('0x43')]);return db['SalesforceField'][_0xcedd('0x49')](_0x438726)['then'](handleEntityNotFound(_0x5d9918,null))[_0xcedd('0x28')](respondWithResult(_0x5d9918,null))[_0xcedd('0x4a')](handleError(_0x5d9918,null));};exports['create']=function(_0x1250f4,_0x38a32b){return db[_0xcedd('0x46')][_0xcedd('0x4b')](_0x1250f4[_0xcedd('0x4c')],{})[_0xcedd('0x28')](respondWithResult(_0x38a32b,0xc9))[_0xcedd('0x4a')](handleError(_0x38a32b,null));};exports[_0xcedd('0x27')]=function(_0x30a72a,_0x532a2d){if(_0x30a72a[_0xcedd('0x4c')]['id']){delete _0x30a72a[_0xcedd('0x4c')]['id'];}return db[_0xcedd('0x46')][_0xcedd('0x49')]({'where':{'id':_0x30a72a['params']['id']}})[_0xcedd('0x28')](handleEntityNotFound(_0x532a2d,null))[_0xcedd('0x28')](saveUpdates(_0x30a72a[_0xcedd('0x4c')],null))['then'](respondWithResult(_0x532a2d,null))[_0xcedd('0x4a')](handleError(_0x532a2d,null));};exports['destroy']=function(_0x1e5159,_0x5b45a2){return db[_0xcedd('0x46')][_0xcedd('0x49')]({'where':{'id':_0x1e5159[_0xcedd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b45a2,null))[_0xcedd('0x28')](removeEntity(_0x5b45a2,null))['catch'](handleError(_0x5b45a2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 08c7089..32217de 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 _0xf27d=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x3af736,_0x30aa2e){var _0x4653cf=function(_0x1110e6){while(--_0x1110e6){_0x3af736['push'](_0x3af736['shift']());}};_0x4653cf(++_0x30aa2e);}(_0xf27d,0xc8));var _0xdf27=function(_0x59e3b5,_0x5aeb0c){_0x59e3b5=_0x59e3b5-0x0;var _0x55407d=_0xf27d[_0x59e3b5];return _0x55407d;};'use strict';var _=require('lodash');var util=require(_0xdf27('0x0'));var logger=require(_0xdf27('0x1'))(_0xdf27('0x2'));var moment=require(_0xdf27('0x3'));var BPromise=require(_0xdf27('0x4'));var rp=require(_0xdf27('0x5'));var fs=require('fs');var path=require(_0xdf27('0x6'));var rimraf=require(_0xdf27('0x7'));var config=require(_0xdf27('0x8'));var attributes=require(_0xdf27('0x9'));module['exports']=function(_0x236c66,_0x2c90a7){return _0x236c66[_0xdf27('0xa')](_0xdf27('0xb'),attributes,{'tableName':_0xdf27('0xc'),'paranoid':![],'indexes':[{'name':_0xdf27('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x75b6=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','moment','bluebird'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x75b6,0x66));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x675b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x675b('0x1'));var BPromise=require(_0x675b('0x2'));var rp=require(_0x675b('0x3'));var fs=require('fs');var path=require(_0x675b('0x4'));var rimraf=require(_0x675b('0x5'));var config=require(_0x675b('0x6'));var attributes=require(_0x675b('0x7'));module[_0x675b('0x8')]=function(_0x201549,_0x47525b){return _0x201549[_0x675b('0x9')](_0x675b('0xa'),attributes,{'tableName':_0x675b('0xb'),'paranoid':![],'indexes':[{'name':_0x675b('0xc'),'fields':[_0x675b('0xd'),_0x675b('0xe')],'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 1d2f9c4..0a05020 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 _0x2478=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x2478,0xd7));var _0x8247=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2478[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x8247('0x0'));var util=require(_0x8247('0x1'));var moment=require('moment');var BPromise=require(_0x8247('0x2'));var rs=require(_0x8247('0x3'));var fs=require('fs');var Redis=require(_0x8247('0x4'));var db=require(_0x8247('0x5'))['db'];var utils=require(_0x8247('0x6'));var logger=require(_0x8247('0x7'))(_0x8247('0x8'));var config=require(_0x8247('0x9'));var jayson=require(_0x8247('0xa'));var client=jayson[_0x8247('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f978f,_0x27b942,_0x4e6036){return new BPromise(function(_0x16298b,_0x15b001){return client[_0x8247('0xc')](_0x3f978f,_0x4e6036)[_0x8247('0xd')](function(_0x58da37){logger['info'](_0x8247('0xe'),_0x27b942,_0x8247('0xf'));logger[_0x8247('0x10')](_0x8247('0x11'),_0x27b942,_0x8247('0xf'),JSON['stringify'](_0x58da37));if(_0x58da37['error']){if(_0x58da37[_0x8247('0x12')][_0x8247('0x13')]===0x1f4){logger['error'](_0x8247('0xe'),_0x27b942,_0x58da37['error'][_0x8247('0x14')]);return _0x15b001(_0x58da37[_0x8247('0x12')][_0x8247('0x14')]);}logger[_0x8247('0x12')]('SalesforceField,\x20%s,\x20%s',_0x27b942,_0x58da37['error'][_0x8247('0x14')]);return _0x16298b(_0x58da37['error'][_0x8247('0x14')]);}else{logger[_0x8247('0x15')](_0x8247('0xe'),_0x27b942,_0x8247('0xf'));_0x16298b(_0x58da37[_0x8247('0x16')][_0x8247('0x14')]);}})[_0x8247('0x17')](function(_0x5684c4){logger[_0x8247('0x12')](_0x8247('0xe'),_0x27b942,_0x5684c4);_0x15b001(_0x5684c4);});});} \ No newline at end of file +var _0x4496=['SalesforceField,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x22c1bc,_0x324724){var _0x7c9abe=function(_0x5b5389){while(--_0x5b5389){_0x22c1bc['push'](_0x22c1bc['shift']());}};_0x7c9abe(++_0x324724);}(_0x4496,0x137));var _0x6449=function(_0x940ed2,_0x3072ec){_0x940ed2=_0x940ed2-0x0;var _0xd06e4a=_0x4496[_0x940ed2];return _0xd06e4a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6449('0x0'));var rs=require(_0x6449('0x1'));var fs=require('fs');var Redis=require(_0x6449('0x2'));var db=require(_0x6449('0x3'))['db'];var utils=require(_0x6449('0x4'));var logger=require(_0x6449('0x5'))(_0x6449('0x6'));var config=require(_0x6449('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6449('0x8')][_0x6449('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc4e85,_0x77dbca,_0xbf8150){return new BPromise(function(_0x3fb3d3,_0x3a083d){return client[_0x6449('0xa')](_0xc4e85,_0xbf8150)[_0x6449('0xb')](function(_0x4e25fb){logger[_0x6449('0xc')]('SalesforceField,\x20%s,\x20%s',_0x77dbca,'request\x20sent');logger[_0x6449('0xd')](_0x6449('0xe'),_0x77dbca,_0x6449('0xf'),JSON[_0x6449('0x10')](_0x4e25fb));if(_0x4e25fb[_0x6449('0x11')]){if(_0x4e25fb[_0x6449('0x11')][_0x6449('0x12')]===0x1f4){logger[_0x6449('0x11')](_0x6449('0x13'),_0x77dbca,_0x4e25fb[_0x6449('0x11')][_0x6449('0x14')]);return _0x3a083d(_0x4e25fb[_0x6449('0x11')][_0x6449('0x14')]);}logger[_0x6449('0x11')]('SalesforceField,\x20%s,\x20%s',_0x77dbca,_0x4e25fb['error'][_0x6449('0x14')]);return _0x3fb3d3(_0x4e25fb['error'][_0x6449('0x14')]);}else{logger[_0x6449('0xc')]('SalesforceField,\x20%s,\x20%s',_0x77dbca,_0x6449('0xf'));_0x3fb3d3(_0x4e25fb[_0x6449('0x15')][_0x6449('0x14')]);}})['catch'](function(_0x554a71){logger[_0x6449('0x11')](_0x6449('0x13'),_0x77dbca,_0x554a71);_0x3a083d(_0x554a71);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 92385bf..87306b7 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 _0x0962=['/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','put','update','delete'];(function(_0x6fcce9,_0xd4f609){var _0x3b114b=function(_0xe8398d){while(--_0xe8398d){_0x6fcce9['push'](_0x6fcce9['shift']());}};_0x3b114b(++_0xd4f609);}(_0x0962,0x116));var _0x2096=function(_0x150034,_0x4a8175){_0x150034=_0x150034-0x0;var _0x2fb73d=_0x0962[_0x150034];return _0x2fb73d;};'use strict';var multer=require(_0x2096('0x0'));var util=require(_0x2096('0x1'));var path=require(_0x2096('0x2'));var timeout=require(_0x2096('0x3'));var express=require(_0x2096('0x4'));var router=express[_0x2096('0x5')]();var fs_extra=require(_0x2096('0x6'));var auth=require(_0x2096('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2096('0x8'));var controller=require(_0x2096('0x9'));router['get']('/',auth[_0x2096('0xa')](),controller[_0x2096('0xb')]);router[_0x2096('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x2096('0xd')]);router[_0x2096('0xc')](_0x2096('0xe'),auth[_0x2096('0xa')](),controller['getConfigurations']);router[_0x2096('0xc')](_0x2096('0xf'),auth[_0x2096('0xa')](),controller[_0x2096('0x10')]);router['post']('/',auth[_0x2096('0xa')](),controller['create']);router[_0x2096('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x2096('0x12')]('/:id',auth[_0x2096('0xa')](),controller[_0x2096('0x13')]);router[_0x2096('0x14')](_0x2096('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0x2096('0x16')]=router; \ No newline at end of file +var _0x1dc1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','update','delete','destroy','multer','util','connect-timeout'];(function(_0x440630,_0x21a620){var _0x239af6=function(_0x461628){while(--_0x461628){_0x440630['push'](_0x440630['shift']());}};_0x239af6(++_0x21a620);}(_0x1dc1,0x66));var _0x11dc=function(_0xd39e8a,_0x1a2663){_0xd39e8a=_0xd39e8a-0x0;var _0x42bdff=_0x1dc1[_0xd39e8a];return _0x42bdff;};'use strict';var multer=require(_0x11dc('0x0'));var util=require(_0x11dc('0x1'));var path=require('path');var timeout=require(_0x11dc('0x2'));var express=require(_0x11dc('0x3'));var router=express[_0x11dc('0x4')]();var fs_extra=require(_0x11dc('0x5'));var auth=require(_0x11dc('0x6'));var interaction=require(_0x11dc('0x7'));var config=require(_0x11dc('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x11dc('0x9')]('/',auth['isAuthenticated'](),controller[_0x11dc('0xa')]);router[_0x11dc('0x9')](_0x11dc('0xb'),auth[_0x11dc('0xc')](),controller[_0x11dc('0xd')]);router[_0x11dc('0x9')](_0x11dc('0xe'),auth[_0x11dc('0xc')](),controller['getConfigurations']);router[_0x11dc('0x9')](_0x11dc('0xf'),auth[_0x11dc('0xc')](),controller['getFields']);router[_0x11dc('0x10')]('/',auth['isAuthenticated'](),controller[_0x11dc('0x11')]);router[_0x11dc('0x10')]('/:id/configurations',auth[_0x11dc('0xc')](),controller['addConfiguration']);router['put'](_0x11dc('0xb'),auth[_0x11dc('0xc')](),controller[_0x11dc('0x12')]);router[_0x11dc('0x13')](_0x11dc('0xb'),auth[_0x11dc('0xc')](),controller[_0x11dc('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4f97b6e..1afee94 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 _0xee0f=['exports','STRING','username','remoteUri'];(function(_0x5e4aaa,_0x53d58a){var _0x59b3d7=function(_0x384e01){while(--_0x384e01){_0x5e4aaa['push'](_0x5e4aaa['shift']());}};_0x59b3d7(++_0x53d58a);}(_0xee0f,0x1e0));var _0xfee0=function(_0x56989c,_0x6781f0){_0x56989c=_0x56989c-0x0;var _0x22ab27=_0xee0f[_0x56989c];return _0x22ab27;};'use strict';var Sequelize=require('sequelize');module[_0xfee0('0x0')]={'name':{'type':Sequelize[_0xfee0('0x1')]},'description':{'type':Sequelize[_0xfee0('0x1')]},'username':{'type':Sequelize[_0xfee0('0x1')],'unique':_0xfee0('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xfee0('0x1')]},'remoteUri':{'type':Sequelize[_0xfee0('0x1')],'unique':_0xfee0('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5cce=['exports','STRING','username','remoteUri','sequelize'];(function(_0x867e1a,_0x53b160){var _0x54f961=function(_0x5ce3b9){while(--_0x5ce3b9){_0x867e1a['push'](_0x867e1a['shift']());}};_0x54f961(++_0x53b160);}(_0x5cce,0x1ee));var _0xe5cc=function(_0x12a626,_0x29d236){_0x12a626=_0x12a626-0x0;var _0x2a4b38=_0x5cce[_0x12a626];return _0x2a4b38;};'use strict';var Sequelize=require(_0xe5cc('0x0'));module[_0xe5cc('0x1')]={'name':{'type':Sequelize[_0xe5cc('0x2')]},'description':{'type':Sequelize[_0xe5cc('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe5cc('0x3')},'password':{'type':Sequelize[_0xe5cc('0x2')]},'email':{'type':Sequelize[_0xe5cc('0x2')]},'remoteUri':{'type':Sequelize[_0xe5cc('0x2')],'unique':_0xe5cc('0x4')},'serverUrl':{'type':Sequelize[_0xe5cc('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 ff784b4..d56ac0c 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 _0xe379=['key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','findOne','ServicenowConfiguration','pick','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','subcategory','close_code','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','urgency','company','activity_due','comments','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','serverUrl','remoteUri','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','rimraf','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','ServicenowAccount','rawAttributes','type'];(function(_0x96659f,_0x31c020){var _0x3ab61a=function(_0x2acdcb){while(--_0x2acdcb){_0x96659f['push'](_0x96659f['shift']());}};_0x3ab61a(++_0x31c020);}(_0xe379,0x1eb));var _0x9e37=function(_0x29af21,_0x12abfa){_0x29af21=_0x29af21-0x0;var _0x265135=_0xe379[_0x29af21];return _0x265135;};'use strict';var emlformat=require(_0x9e37('0x0'));var rimraf=require(_0x9e37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e37('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9e37('0x3'));var path=require(_0x9e37('0x4'));var sox=require(_0x9e37('0x5'));var csv=require(_0x9e37('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e37('0x7'));var _=require(_0x9e37('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e37('0x9'));var toCsv=require('to-csv');var querystring=require(_0x9e37('0xa'));var Papa=require(_0x9e37('0xb'));var Redis=require('ioredis');var authService=require(_0x9e37('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x9e37('0xd'));var hardwareService=require(_0x9e37('0xe'));var logger=require(_0x9e37('0xf'))(_0x9e37('0x10'));var utils=require(_0x9e37('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x9e37('0x12'));var db=require(_0x9e37('0x13'))['db'];var integrations=require(_0x9e37('0x14'));function respondWithStatusCode(_0x5ce61e,_0x10c79e){_0x10c79e=_0x10c79e||0xcc;return function(_0x45f49f){if(_0x45f49f){return _0x5ce61e[_0x9e37('0x15')](_0x10c79e);}return _0x5ce61e[_0x9e37('0x16')](_0x10c79e)['end']();};}function respondWithResult(_0x589ef2,_0x180d88){_0x180d88=_0x180d88||0xc8;return function(_0x5780fc){if(_0x5780fc){return _0x589ef2[_0x9e37('0x16')](_0x180d88)[_0x9e37('0x17')](_0x5780fc);}};}function respondWithFilteredResult(_0x6fefd8,_0x10f373){return function(_0x4dc623){if(_0x4dc623){var _0x31aa73=typeof _0x10f373[_0x9e37('0x18')]==='undefined'&&typeof _0x10f373[_0x9e37('0x19')]===_0x9e37('0x1a');var _0x3078d9=_0x4dc623[_0x9e37('0x1b')];var _0x3da605=_0x31aa73?0x0:_0x10f373[_0x9e37('0x18')];var _0x12f44e=_0x31aa73?_0x4dc623['count']:_0x10f373['offset']+_0x10f373['limit'];var _0x4ba54a;if(_0x12f44e>=_0x3078d9){_0x12f44e=_0x3078d9;_0x4ba54a=0xc8;}else{_0x4ba54a=0xce;}_0x6fefd8[_0x9e37('0x16')](_0x4ba54a);return _0x6fefd8[_0x9e37('0x1c')](_0x9e37('0x1d'),_0x3da605+'-'+_0x12f44e+'/'+_0x3078d9)[_0x9e37('0x17')](_0x4dc623);}return null;};}function patchUpdates(_0xd9daa8){return function(_0x516e7a){try{jsonpatch['apply'](_0x516e7a,_0xd9daa8,!![]);}catch(_0x3890eb){return BPromise[_0x9e37('0x1e')](_0x3890eb);}return _0x516e7a[_0x9e37('0x1f')]();};}function saveUpdates(_0x5e5c57,_0x8fee58){return function(_0x384115){if(_0x384115){return _0x384115[_0x9e37('0x20')](_0x5e5c57)[_0x9e37('0x21')](function(_0x406468){return _0x406468;});}return null;};}function removeEntity(_0x156e40,_0x2ad291){return function(_0x9ecd14){if(_0x9ecd14){return _0x9ecd14[_0x9e37('0x22')]()[_0x9e37('0x21')](function(){_0x156e40[_0x9e37('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a182,_0x407ffc){return function(_0xb0c8d7){if(!_0xb0c8d7){_0x59a182[_0x9e37('0x15')](0x194);}return _0xb0c8d7;};}function handleError(_0x2ff7b5,_0x2a205d){_0x2a205d=_0x2a205d||0x1f4;return function(_0x414083){logger[_0x9e37('0x23')](_0x414083['stack']);if(_0x414083[_0x9e37('0x24')]){delete _0x414083[_0x9e37('0x24')];}_0x2ff7b5[_0x9e37('0x16')](_0x2a205d)[_0x9e37('0x25')](_0x414083);};}exports[_0x9e37('0x26')]=function(_0x1fb892,_0x220909){var _0x3e903e={},_0x15b609={},_0x3fc176={'count':0x0,'rows':[]};var _0x3a36ce=_[_0x9e37('0x27')](db[_0x9e37('0x28')][_0x9e37('0x29')],function(_0x18e515){return{'name':_0x18e515['fieldName'],'type':_0x18e515[_0x9e37('0x2a')][_0x9e37('0x2b')]};});_0x15b609[_0x9e37('0x2c')]=_[_0x9e37('0x27')](_0x3a36ce,_0x9e37('0x24'));_0x15b609['query']=_[_0x9e37('0x2d')](_0x1fb892[_0x9e37('0x2e')]);_0x15b609[_0x9e37('0x2f')]=_[_0x9e37('0x30')](_0x15b609[_0x9e37('0x2c')],_0x15b609[_0x9e37('0x2e')]);_0x3e903e['attributes']=_[_0x9e37('0x30')](_0x15b609['model'],qs[_0x9e37('0x31')](_0x1fb892[_0x9e37('0x2e')][_0x9e37('0x31')]));_0x3e903e['attributes']=_0x3e903e[_0x9e37('0x32')]['length']?_0x3e903e[_0x9e37('0x32')]:_0x15b609[_0x9e37('0x2c')];if(!_0x1fb892[_0x9e37('0x2e')][_0x9e37('0x33')]('nolimit')){_0x3e903e[_0x9e37('0x19')]=qs[_0x9e37('0x19')](_0x1fb892['query']['limit']);_0x3e903e[_0x9e37('0x18')]=qs['offset'](_0x1fb892[_0x9e37('0x2e')][_0x9e37('0x18')]);}_0x3e903e[_0x9e37('0x34')]=qs[_0x9e37('0x35')](_0x1fb892['query']['sort']);_0x3e903e[_0x9e37('0x36')]=qs[_0x9e37('0x2f')](_['pick'](_0x1fb892[_0x9e37('0x2e')],_0x15b609[_0x9e37('0x2f')]),_0x3a36ce);if(_0x1fb892[_0x9e37('0x2e')][_0x9e37('0x37')]){_0x3e903e[_0x9e37('0x36')]=_[_0x9e37('0x38')](_0x3e903e[_0x9e37('0x36')],{'$or':_[_0x9e37('0x27')](_0x3a36ce,function(_0x2c04f2){if(_0x2c04f2[_0x9e37('0x2a')]!==_0x9e37('0x39')){var _0x28210c={};_0x28210c[_0x2c04f2['name']]={'$like':'%'+_0x1fb892[_0x9e37('0x2e')]['filter']+'%'};return _0x28210c;}})});}_0x3e903e=_[_0x9e37('0x38')]({},_0x3e903e,_0x1fb892[_0x9e37('0x3a')]);var _0x38bf19={'where':_0x3e903e[_0x9e37('0x36')]};return db[_0x9e37('0x28')][_0x9e37('0x1b')](_0x38bf19)[_0x9e37('0x21')](function(_0xc803d0){_0x3fc176[_0x9e37('0x1b')]=_0xc803d0;if(_0x1fb892[_0x9e37('0x2e')]['includeAll']){_0x3e903e[_0x9e37('0x3b')]=[{'all':!![]}];}return db[_0x9e37('0x28')][_0x9e37('0x3c')](_0x3e903e);})['then'](function(_0x1a174e){_0x3fc176[_0x9e37('0x3d')]=_0x1a174e;return _0x3fc176;})[_0x9e37('0x21')](respondWithFilteredResult(_0x220909,_0x3e903e))[_0x9e37('0x3e')](handleError(_0x220909,null));};exports[_0x9e37('0x3f')]=function(_0x3b6026,_0x538022){var _0x2548a5={'raw':![],'where':{'id':_0x3b6026['params']['id']}},_0xaa6385={};_0xaa6385[_0x9e37('0x2c')]=_[_0x9e37('0x2d')](db[_0x9e37('0x28')][_0x9e37('0x29')]);_0xaa6385['query']=_[_0x9e37('0x2d')](_0x3b6026[_0x9e37('0x2e')]);_0xaa6385[_0x9e37('0x2f')]=_[_0x9e37('0x30')](_0xaa6385[_0x9e37('0x2c')],_0xaa6385[_0x9e37('0x2e')]);_0x2548a5['attributes']=_[_0x9e37('0x30')](_0xaa6385[_0x9e37('0x2c')],qs['fields'](_0x3b6026['query'][_0x9e37('0x31')]));_0x2548a5[_0x9e37('0x32')]=_0x2548a5[_0x9e37('0x32')][_0x9e37('0x40')]?_0x2548a5[_0x9e37('0x32')]:_0xaa6385[_0x9e37('0x2c')];if(_0x3b6026[_0x9e37('0x2e')][_0x9e37('0x41')]){_0x2548a5[_0x9e37('0x3b')]=[{'all':!![]}];}_0x2548a5=_[_0x9e37('0x38')]({},_0x2548a5,_0x3b6026[_0x9e37('0x3a')]);return db[_0x9e37('0x28')][_0x9e37('0x42')](_0x2548a5)['then'](handleEntityNotFound(_0x538022,null))[_0x9e37('0x21')](respondWithResult(_0x538022,null))[_0x9e37('0x3e')](handleError(_0x538022,null));};exports['create']=function(_0x1b1cdc,_0x286814){return db[_0x9e37('0x28')][_0x9e37('0x43')](_0x1b1cdc[_0x9e37('0x44')],{})[_0x9e37('0x21')](respondWithResult(_0x286814,0xc9))[_0x9e37('0x3e')](handleError(_0x286814,null));};exports[_0x9e37('0x20')]=function(_0x15110e,_0xed2cfc){if(_0x15110e[_0x9e37('0x44')]['id']){delete _0x15110e['body']['id'];}return db[_0x9e37('0x28')][_0x9e37('0x42')]({'where':{'id':_0x15110e[_0x9e37('0x45')]['id']}})['then'](handleEntityNotFound(_0xed2cfc,null))[_0x9e37('0x21')](saveUpdates(_0x15110e[_0x9e37('0x44')],null))[_0x9e37('0x21')](respondWithResult(_0xed2cfc,null))[_0x9e37('0x3e')](handleError(_0xed2cfc,null));};exports[_0x9e37('0x22')]=function(_0x1b0ebd,_0x1fe561){return db['ServicenowAccount'][_0x9e37('0x42')]({'where':{'id':_0x1b0ebd[_0x9e37('0x45')]['id']}})[_0x9e37('0x21')](handleEntityNotFound(_0x1fe561,null))['then'](removeEntity(_0x1fe561,null))[_0x9e37('0x3e')](handleError(_0x1fe561,null));};exports['getConfigurations']=function(_0x394e28,_0x25a13e,_0x189b92){var _0x59664e={};var _0x358775={};var _0x17ff7e;var _0x437e74;return db[_0x9e37('0x28')][_0x9e37('0x46')]({'where':{'id':_0x394e28[_0x9e37('0x45')]['id']}})[_0x9e37('0x21')](handleEntityNotFound(_0x25a13e,null))[_0x9e37('0x21')](function(_0x452694){if(_0x452694){_0x17ff7e=_0x452694;_0x358775[_0x9e37('0x2c')]=_[_0x9e37('0x2d')](db[_0x9e37('0x47')]['rawAttributes']);_0x358775[_0x9e37('0x2e')]=_[_0x9e37('0x2d')](_0x394e28[_0x9e37('0x2e')]);_0x358775[_0x9e37('0x2f')]=_['intersection'](_0x358775['model'],_0x358775[_0x9e37('0x2e')]);_0x59664e[_0x9e37('0x32')]=_[_0x9e37('0x30')](_0x358775[_0x9e37('0x2c')],qs[_0x9e37('0x31')](_0x394e28[_0x9e37('0x2e')][_0x9e37('0x31')]));_0x59664e[_0x9e37('0x32')]=_0x59664e[_0x9e37('0x32')]['length']?_0x59664e[_0x9e37('0x32')]:_0x358775[_0x9e37('0x2c')];_0x59664e[_0x9e37('0x34')]=qs[_0x9e37('0x35')](_0x394e28['query'][_0x9e37('0x35')]);_0x59664e['where']=qs[_0x9e37('0x2f')](_[_0x9e37('0x48')](_0x394e28[_0x9e37('0x2e')],_0x358775[_0x9e37('0x2f')]));if(_0x394e28['query'][_0x9e37('0x37')]){_0x59664e['where']=_[_0x9e37('0x38')](_0x59664e['where'],{'$or':_[_0x9e37('0x27')](_0x59664e[_0x9e37('0x32')],function(_0x3b1866){var _0x35481f={};_0x35481f[_0x3b1866]={'$like':'%'+_0x394e28['query'][_0x9e37('0x37')]+'%'};return _0x35481f;})});}_0x59664e=_[_0x9e37('0x38')]({},_0x59664e,_0x394e28[_0x9e37('0x3a')]);return _0x17ff7e[_0x9e37('0x49')](_0x59664e);}})[_0x9e37('0x21')](function(_0x29aa01){if(_0x29aa01){_0x437e74=_0x29aa01['length'];if(!_0x394e28[_0x9e37('0x2e')]['hasOwnProperty'](_0x9e37('0x4a'))){_0x59664e[_0x9e37('0x19')]=qs['limit'](_0x394e28[_0x9e37('0x2e')][_0x9e37('0x19')]);_0x59664e[_0x9e37('0x18')]=qs[_0x9e37('0x18')](_0x394e28[_0x9e37('0x2e')][_0x9e37('0x18')]);}return _0x17ff7e[_0x9e37('0x49')](_0x59664e);}})[_0x9e37('0x21')](function(_0x18231d){if(_0x18231d){return _0x18231d?{'count':_0x437e74,'rows':_0x18231d}:null;}})[_0x9e37('0x21')](respondWithResult(_0x25a13e,null))[_0x9e37('0x3e')](handleError(_0x25a13e,null));};exports[_0x9e37('0x4b')]=function(_0xdad21b,_0x509c56,_0x1b774b){if(_0xdad21b[_0x9e37('0x44')]['id']){delete _0xdad21b['body']['id'];}return db[_0x9e37('0x28')][_0x9e37('0x46')]({'where':{'id':_0xdad21b[_0x9e37('0x45')]['id']}})[_0x9e37('0x21')](handleEntityNotFound(_0x509c56,null))['then'](function(_0xd90094){if(_0xd90094){_0xdad21b[_0x9e37('0x44')][_0x9e37('0x4c')]=_0xd90094['id'];_0xdad21b[_0x9e37('0x44')]['Subjects']=integrations[_0x9e37('0x4d')](_0xdad21b[_0x9e37('0x44')][_0x9e37('0x4e')],_0xdad21b['body'][_0x9e37('0x2a')]);_0xdad21b['body'][_0x9e37('0x4f')]=integrations[_0x9e37('0x50')](_0xdad21b[_0x9e37('0x44')][_0x9e37('0x4e')],_0xdad21b['body']['type']);return db[_0x9e37('0x47')][_0x9e37('0x43')](_0xdad21b[_0x9e37('0x44')],{'include':[{'model':db[_0x9e37('0x51')],'as':_0x9e37('0x52')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x9e37('0x21')](respondWithResult(_0x509c56,null))[_0x9e37('0x3e')](handleError(_0x509c56,null));};exports[_0x9e37('0x53')]=function(_0x57f27d,_0x313056,_0x4d14cb){var _0x3fdd8d=[_0x9e37('0x54'),_0x9e37('0x55'),'knowledge',_0x9e37('0x56'),_0x9e37('0x57'),'notify','incident_state',_0x9e37('0x58'),_0x9e37('0x59')];var _0x9c9d09=[_0x9e37('0x5a'),_0x9e37('0x54'),_0x9e37('0x5b'),_0x9e37('0x5c'),_0x9e37('0x5d'),_0x9e37('0x5e'),'child_incidents',_0x9e37('0x55'),_0x9e37('0x5f'),_0x9e37('0x60'),_0x9e37('0x61'),'sys_updated_by',_0x9e37('0x62'),_0x9e37('0x63'),_0x9e37('0x64'),_0x9e37('0x65'),_0x9e37('0x66'),_0x9e37('0x67'),_0x9e37('0x68'),_0x9e37('0x34'),_0x9e37('0x69'),_0x9e37('0x6a'),'cmdb_ci','delivery_plan','impact',_0x9e37('0x6b'),_0x9e37('0x6c'),_0x9e37('0x6d'),_0x9e37('0x6e'),_0x9e37('0x6f'),_0x9e37('0x70'),_0x9e37('0x71'),'expected_start',_0x9e37('0x72'),_0x9e37('0x73'),_0x9e37('0x74'),_0x9e37('0x75'),_0x9e37('0x76'),_0x9e37('0x77'),_0x9e37('0x78'),_0x9e37('0x79'),_0x9e37('0x56'),_0x9e37('0x7a'),_0x9e37('0x7b'),'close_code',_0x9e37('0x7c'),'delivery_task',_0x9e37('0x7d'),'assignment_group',_0x9e37('0x7e'),'additional_assignee_list','description',_0x9e37('0x7f'),_0x9e37('0x80'),_0x9e37('0x81'),_0x9e37('0x82'),_0x9e37('0x83'),_0x9e37('0x84'),_0x9e37('0x85'),'sys_id','contact_type','reopened_by','incident_state',_0x9e37('0x86'),'problem_id',_0x9e37('0x87'),'reassignment_count',_0x9e37('0x88'),'assigned_to','severity',_0x9e37('0x89'),'sla_due','approval',_0x9e37('0x8a'),'due_date','sys_mod_count',_0x9e37('0x8b'),_0x9e37('0x8c'),_0x9e37('0x8d'),_0x9e37('0x8e'),_0x9e37('0x8f'),_0x9e37('0x90'),_0x9e37('0x59')];var _0x292fb4='';var _0x1cad16='';var _0xe3fc91=[];var _0x565483='';var _0x44a0a2='';var _0x5aafad=[];var _0xf60c4='';var _0x51c833='';var _0x12318c={};var _0x2a3fd3='';return db[_0x9e37('0x28')]['findOne']({'where':{'id':_0x57f27d[_0x9e37('0x45')]['id']},'attributes':['id','username',_0x9e37('0x91'),_0x9e37('0x92'),'remoteUri',_0x9e37('0x93')]})[_0x9e37('0x21')](handleEntityNotFound(_0x313056,null))[_0x9e37('0x21')](function(_0x2ef0a2){if(_0x2ef0a2){_0x2a3fd3=_0x2ef0a2[_0x9e37('0x94')];var _0x149b06=_0x2a3fd3['slice'](-0x1);if(_0x149b06==='/'){_0x2a3fd3=_0x2a3fd3['substring'](0x0,_0x2a3fd3[_0x9e37('0x95')](_0x149b06));}_0x51c833=util['format'](_0x9e37('0x96'),_0x2a3fd3);_0xf60c4=util['format'](_0x9e37('0x97'),_0x2a3fd3);_0x12318c={'user':_0x2ef0a2[_0x9e37('0x98')],'pass':_0x2ef0a2[_0x9e37('0x91')]};var _0x433acb={'method':_0x9e37('0x99'),'uri':_0x51c833+_0x9e37('0x9a'),'auth':_0x12318c,'json':!![]};return rp(_0x433acb);}})[_0x9e37('0x21')](function(_0x4ba21c){if(_0x4ba21c[_0x9e37('0x9b')]['length']>0x0){_0x292fb4=_0x4ba21c[_0x9e37('0x9b')];}console[_0x9e37('0x9c')](_0x9e37('0x9d'),_0x292fb4);_0x5aafad=[];_0x1cad16=Object[_0x9e37('0x9e')]([],_0x292fb4);_['remove'](_0x1cad16,function(_0x3d0f6b){return!_0x3fdd8d[_0x9e37('0x9f')](_0x3d0f6b[_0x9e37('0x24')]);});_0x1cad16['forEach'](function(_0x2cdf2c){var _0x24f5a8=createFieldObject(_0xf60c4,_0x12318c,_0x2cdf2c['internalType'],_0x2cdf2c[_0x9e37('0x24')],_0x2cdf2c[_0x9e37('0xa0')],![]);_0x5aafad['push'](_0x24f5a8);});return Promise[_0x9e37('0xa1')](_0x5aafad);})[_0x9e37('0x21')](function(_0x94d78){_0xe3fc91=_0x94d78;_0x565483=Object['assign']([],_0x292fb4);console['log'](_0x9e37('0xa2'),_0x292fb4);_[_0x9e37('0xa3')](_0x565483,function(_0x180078){return _0x9c9d09[_0x9e37('0x9f')](_0x180078[_0x9e37('0x24')]);});console['log'](_0x9e37('0xa4'),_0x565483);_0x5aafad=[];_0x565483[_0x9e37('0xa5')](function(_0x582aeb){var _0x3fb66a=createFieldObject(_0xf60c4,_0x12318c,_0x582aeb['internalType'],_0x582aeb[_0x9e37('0x24')],_0x582aeb[_0x9e37('0xa0')],!![]);_0x5aafad[_0x9e37('0xa6')](_0x3fb66a);});return Promise[_0x9e37('0xa1')](_0x5aafad);})[_0x9e37('0x21')](function(_0x56c9d6){_0x44a0a2=_0x56c9d6;var _0x4eaed9=_0xe3fc91['concat'](_0x44a0a2);return{'count':_0x4eaed9[_0x9e37('0x40')],'rows':_0x4eaed9};})[_0x9e37('0x21')](respondWithResult(_0x313056,null))[_0x9e37('0x3e')](function(_0x134a5a){console[_0x9e37('0x9c')](_0x9e37('0xa7')+_0x134a5a);var _0x4960f5=_0x57f27d[_0x9e37('0x2e')][_0x9e37('0xa8')]?0x1f4:_0x134a5a[_0x9e37('0xa9')]||0x1f4;logger['error'](_0x134a5a[_0x9e37('0xaa')]);delete _0x134a5a['name'];if(_0x4960f5===0x191){_0x4960f5=0x190;}_0x313056[_0x9e37('0x16')](_0x4960f5)[_0x9e37('0x25')](_0x57f27d[_0x9e37('0x2e')][_0x9e37('0xa8')]?{'message':_0x9e37('0xab'),'statusCode':_0x134a5a['statusCode']}:_0x134a5a);});};function createFieldObject(_0x3d5fd8,_0x34db98,_0x3586c7,_0x68b58a,_0x3e71c4,_0x5a1a90){return new Promise(function(_0x47acc2,_0x4a7211){var _0x371b25={'id':_0x68b58a,'name':_0x3e71c4,'custom':_0x5a1a90};if(_0x3586c7===_0x9e37('0xac')){_0x371b25[_0x9e37('0x3a')]=[{'name':_0x9e37('0xad'),'value':_0x9e37('0xae')},{'name':'False','value':'false'}];_0x47acc2(_0x371b25);}else{var _0x326d92={'method':'GET','uri':_0x3d5fd8+_0x9e37('0xaf')+_0x68b58a,'auth':_0x34db98,'json':!![]};return rp(_0x326d92)['then'](function(_0x166d68){var _0x501e7b=[];if(_0x166d68[_0x9e37('0x9b')][_0x9e37('0x40')]>0x0){_0x166d68[_0x9e37('0x9b')][_0x9e37('0xa5')](function(_0x148adc){if(_0x148adc[_0x9e37('0xb0')]===_0x9e37('0xb1')){var _0x138bb5={'name':_0x148adc['label'],'value':_0x148adc['value']};_0x501e7b[_0x9e37('0xa6')](_0x138bb5);}});}_0x371b25[_0x9e37('0x3a')]=_0x501e7b;if(_0x371b25[_0x9e37('0x3a')][_0x9e37('0x40')]>0x0){_0x47acc2(_0x371b25);}else{if(_0x5a1a90==![]){_0x47acc2();}else{_0x47acc2(_0x371b25);}}});}});} \ No newline at end of file +var _0x88c4=['sys_choice?sysparm_query=name=incident^element=','result','forEach','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','show','params','filters','length','include','catch','create','update','body','find','findOne','ServicenowConfiguration','addConfiguration','getSubjects','channel','Subjects','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','sys_class_name','closed_by','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','serverUrl','remoteUri','slice','substring','format','%s/api/now/table/','incident\x20table\x20objects','assign','includes','internalType','label','all','log','remove','push','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','GET'];(function(_0x3cc7aa,_0xcff53e){var _0xea7766=function(_0x260a89){while(--_0x260a89){_0x3cc7aa['push'](_0x3cc7aa['shift']());}};_0xea7766(++_0xcff53e);}(_0x88c4,0x16d));var _0x488c=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x88c4[_0x100682];return _0xcb6e87;};'use strict';var emlformat=require(_0x488c('0x0'));var rimraf=require(_0x488c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x488c('0x2'));var rp=require(_0x488c('0x3'));var moment=require('moment');var BPromise=require(_0x488c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x488c('0x5'));var sox=require(_0x488c('0x6'));var csv=require('to-csv');var ejs=require(_0x488c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x488c('0x8'));var squel=require(_0x488c('0x9'));var crypto=require(_0x488c('0xa'));var jsforce=require(_0x488c('0xb'));var deskjs=require(_0x488c('0xc'));var toCsv=require(_0x488c('0xd'));var querystring=require(_0x488c('0xe'));var Papa=require(_0x488c('0xf'));var Redis=require(_0x488c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x488c('0x11'));var as=require(_0x488c('0x12'));var hardwareService=require(_0x488c('0x13'));var logger=require(_0x488c('0x14'))(_0x488c('0x15'));var utils=require('../../config/utils');var config=require(_0x488c('0x16'));var licenseUtil=require(_0x488c('0x17'));var db=require(_0x488c('0x18'))['db'];var integrations=require(_0x488c('0x19'));function respondWithStatusCode(_0x55f4ba,_0x45f723){_0x45f723=_0x45f723||0xcc;return function(_0x51cbf0){if(_0x51cbf0){return _0x55f4ba[_0x488c('0x1a')](_0x45f723);}return _0x55f4ba[_0x488c('0x1b')](_0x45f723)[_0x488c('0x1c')]();};}function respondWithResult(_0x3e388e,_0x4b9060){_0x4b9060=_0x4b9060||0xc8;return function(_0x46c958){if(_0x46c958){return _0x3e388e['status'](_0x4b9060)[_0x488c('0x1d')](_0x46c958);}};}function respondWithFilteredResult(_0x505701,_0x4d4695){return function(_0x4d65a2){if(_0x4d65a2){var _0x249959=typeof _0x4d4695[_0x488c('0x1e')]===_0x488c('0x1f')&&typeof _0x4d4695[_0x488c('0x20')]===_0x488c('0x1f');var _0x3c9022=_0x4d65a2[_0x488c('0x21')];var _0x1d17fa=_0x249959?0x0:_0x4d4695[_0x488c('0x1e')];var _0x461446=_0x249959?_0x4d65a2[_0x488c('0x21')]:_0x4d4695['offset']+_0x4d4695['limit'];var _0x1174cd;if(_0x461446>=_0x3c9022){_0x461446=_0x3c9022;_0x1174cd=0xc8;}else{_0x1174cd=0xce;}_0x505701[_0x488c('0x1b')](_0x1174cd);return _0x505701['set'](_0x488c('0x22'),_0x1d17fa+'-'+_0x461446+'/'+_0x3c9022)[_0x488c('0x1d')](_0x4d65a2);}return null;};}function patchUpdates(_0x597d3c){return function(_0x297ece){try{jsonpatch['apply'](_0x297ece,_0x597d3c,!![]);}catch(_0x48e4f2){return BPromise[_0x488c('0x23')](_0x48e4f2);}return _0x297ece[_0x488c('0x24')]();};}function saveUpdates(_0x9d8bbc,_0x5e6f64){return function(_0x179016){if(_0x179016){return _0x179016['update'](_0x9d8bbc)[_0x488c('0x25')](function(_0x2c75d7){return _0x2c75d7;});}return null;};}function removeEntity(_0x2fe40d,_0x33d5f7){return function(_0x37cf4b){if(_0x37cf4b){return _0x37cf4b['destroy']()['then'](function(){_0x2fe40d['status'](0xcc)[_0x488c('0x1c')]();});}};}function handleEntityNotFound(_0x4bc066,_0x40331b){return function(_0x50564a){if(!_0x50564a){_0x4bc066['sendStatus'](0x194);}return _0x50564a;};}function handleError(_0x2b73e3,_0x519431){_0x519431=_0x519431||0x1f4;return function(_0x5ac231){logger[_0x488c('0x26')](_0x5ac231[_0x488c('0x27')]);if(_0x5ac231[_0x488c('0x28')]){delete _0x5ac231[_0x488c('0x28')];}_0x2b73e3[_0x488c('0x1b')](_0x519431)[_0x488c('0x29')](_0x5ac231);};}exports[_0x488c('0x2a')]=function(_0x10c212,_0x23a341){var _0x28eef5={},_0x1b34bf={},_0x5e7673={'count':0x0,'rows':[]};var _0x599bcb=_[_0x488c('0x2b')](db[_0x488c('0x2c')][_0x488c('0x2d')],function(_0x829da6){return{'name':_0x829da6['fieldName'],'type':_0x829da6['type'][_0x488c('0x2e')]};});_0x1b34bf[_0x488c('0x2f')]=_[_0x488c('0x2b')](_0x599bcb,_0x488c('0x28'));_0x1b34bf['query']=_[_0x488c('0x30')](_0x10c212[_0x488c('0x31')]);_0x1b34bf['filters']=_[_0x488c('0x32')](_0x1b34bf['model'],_0x1b34bf[_0x488c('0x31')]);_0x28eef5['attributes']=_[_0x488c('0x32')](_0x1b34bf['model'],qs[_0x488c('0x33')](_0x10c212[_0x488c('0x31')][_0x488c('0x33')]));_0x28eef5[_0x488c('0x34')]=_0x28eef5[_0x488c('0x34')]['length']?_0x28eef5['attributes']:_0x1b34bf['model'];if(!_0x10c212[_0x488c('0x31')][_0x488c('0x35')]('nolimit')){_0x28eef5[_0x488c('0x20')]=qs[_0x488c('0x20')](_0x10c212['query']['limit']);_0x28eef5['offset']=qs['offset'](_0x10c212[_0x488c('0x31')][_0x488c('0x1e')]);}_0x28eef5[_0x488c('0x36')]=qs[_0x488c('0x37')](_0x10c212[_0x488c('0x31')][_0x488c('0x37')]);_0x28eef5[_0x488c('0x38')]=qs['filters'](_[_0x488c('0x39')](_0x10c212[_0x488c('0x31')],_0x1b34bf['filters']),_0x599bcb);if(_0x10c212[_0x488c('0x31')]['filter']){_0x28eef5['where']=_[_0x488c('0x3a')](_0x28eef5[_0x488c('0x38')],{'$or':_['map'](_0x599bcb,function(_0x5c4958){if(_0x5c4958[_0x488c('0x3b')]!==_0x488c('0x3c')){var _0x2b9b75={};_0x2b9b75[_0x5c4958[_0x488c('0x28')]]={'$like':'%'+_0x10c212[_0x488c('0x31')][_0x488c('0x3d')]+'%'};return _0x2b9b75;}})});}_0x28eef5=_['merge']({},_0x28eef5,_0x10c212[_0x488c('0x3e')]);var _0x4d9948={'where':_0x28eef5['where']};return db['ServicenowAccount'][_0x488c('0x21')](_0x4d9948)[_0x488c('0x25')](function(_0x2c6a63){_0x5e7673[_0x488c('0x21')]=_0x2c6a63;if(_0x10c212[_0x488c('0x31')][_0x488c('0x3f')]){_0x28eef5['include']=[{'all':!![]}];}return db[_0x488c('0x2c')]['findAll'](_0x28eef5);})[_0x488c('0x25')](function(_0x4d2680){_0x5e7673[_0x488c('0x40')]=_0x4d2680;return _0x5e7673;})[_0x488c('0x25')](respondWithFilteredResult(_0x23a341,_0x28eef5))['catch'](handleError(_0x23a341,null));};exports[_0x488c('0x41')]=function(_0x564d64,_0x107f9c){var _0x2207e5={'raw':![],'where':{'id':_0x564d64[_0x488c('0x42')]['id']}},_0x5f9876={};_0x5f9876[_0x488c('0x2f')]=_[_0x488c('0x30')](db[_0x488c('0x2c')][_0x488c('0x2d')]);_0x5f9876[_0x488c('0x31')]=_[_0x488c('0x30')](_0x564d64[_0x488c('0x31')]);_0x5f9876[_0x488c('0x43')]=_[_0x488c('0x32')](_0x5f9876[_0x488c('0x2f')],_0x5f9876['query']);_0x2207e5[_0x488c('0x34')]=_['intersection'](_0x5f9876[_0x488c('0x2f')],qs[_0x488c('0x33')](_0x564d64[_0x488c('0x31')]['fields']));_0x2207e5[_0x488c('0x34')]=_0x2207e5[_0x488c('0x34')][_0x488c('0x44')]?_0x2207e5[_0x488c('0x34')]:_0x5f9876[_0x488c('0x2f')];if(_0x564d64['query']['includeAll']){_0x2207e5[_0x488c('0x45')]=[{'all':!![]}];}_0x2207e5=_[_0x488c('0x3a')]({},_0x2207e5,_0x564d64[_0x488c('0x3e')]);return db['ServicenowAccount']['find'](_0x2207e5)[_0x488c('0x25')](handleEntityNotFound(_0x107f9c,null))[_0x488c('0x25')](respondWithResult(_0x107f9c,null))[_0x488c('0x46')](handleError(_0x107f9c,null));};exports['create']=function(_0x490ed5,_0x3d4d59){return db[_0x488c('0x2c')][_0x488c('0x47')](_0x490ed5['body'],{})['then'](respondWithResult(_0x3d4d59,0xc9))[_0x488c('0x46')](handleError(_0x3d4d59,null));};exports[_0x488c('0x48')]=function(_0x4a3d39,_0x4c31d7){if(_0x4a3d39[_0x488c('0x49')]['id']){delete _0x4a3d39[_0x488c('0x49')]['id'];}return db[_0x488c('0x2c')][_0x488c('0x4a')]({'where':{'id':_0x4a3d39[_0x488c('0x42')]['id']}})[_0x488c('0x25')](handleEntityNotFound(_0x4c31d7,null))[_0x488c('0x25')](saveUpdates(_0x4a3d39['body'],null))[_0x488c('0x25')](respondWithResult(_0x4c31d7,null))[_0x488c('0x46')](handleError(_0x4c31d7,null));};exports['destroy']=function(_0x3b7f65,_0x3089ec){return db['ServicenowAccount'][_0x488c('0x4a')]({'where':{'id':_0x3b7f65[_0x488c('0x42')]['id']}})[_0x488c('0x25')](handleEntityNotFound(_0x3089ec,null))[_0x488c('0x25')](removeEntity(_0x3089ec,null))['catch'](handleError(_0x3089ec,null));};exports['getConfigurations']=function(_0x355673,_0x1fbd86,_0x398a0e){var _0x5abe9b={};var _0x3ccfe2={};var _0x4f4bf0;var _0x391e73;return db[_0x488c('0x2c')][_0x488c('0x4b')]({'where':{'id':_0x355673[_0x488c('0x42')]['id']}})[_0x488c('0x25')](handleEntityNotFound(_0x1fbd86,null))['then'](function(_0x5441aa){if(_0x5441aa){_0x4f4bf0=_0x5441aa;_0x3ccfe2[_0x488c('0x2f')]=_[_0x488c('0x30')](db[_0x488c('0x4c')][_0x488c('0x2d')]);_0x3ccfe2[_0x488c('0x31')]=_[_0x488c('0x30')](_0x355673['query']);_0x3ccfe2[_0x488c('0x43')]=_[_0x488c('0x32')](_0x3ccfe2['model'],_0x3ccfe2['query']);_0x5abe9b[_0x488c('0x34')]=_[_0x488c('0x32')](_0x3ccfe2[_0x488c('0x2f')],qs[_0x488c('0x33')](_0x355673['query'][_0x488c('0x33')]));_0x5abe9b[_0x488c('0x34')]=_0x5abe9b['attributes'][_0x488c('0x44')]?_0x5abe9b[_0x488c('0x34')]:_0x3ccfe2[_0x488c('0x2f')];_0x5abe9b[_0x488c('0x36')]=qs[_0x488c('0x37')](_0x355673['query'][_0x488c('0x37')]);_0x5abe9b['where']=qs[_0x488c('0x43')](_['pick'](_0x355673[_0x488c('0x31')],_0x3ccfe2[_0x488c('0x43')]));if(_0x355673[_0x488c('0x31')]['filter']){_0x5abe9b['where']=_['merge'](_0x5abe9b[_0x488c('0x38')],{'$or':_[_0x488c('0x2b')](_0x5abe9b[_0x488c('0x34')],function(_0x2588a8){var _0x5160fe={};_0x5160fe[_0x2588a8]={'$like':'%'+_0x355673[_0x488c('0x31')][_0x488c('0x3d')]+'%'};return _0x5160fe;})});}_0x5abe9b=_[_0x488c('0x3a')]({},_0x5abe9b,_0x355673['options']);return _0x4f4bf0['getConfigurations'](_0x5abe9b);}})[_0x488c('0x25')](function(_0x1d53fe){if(_0x1d53fe){_0x391e73=_0x1d53fe[_0x488c('0x44')];if(!_0x355673[_0x488c('0x31')][_0x488c('0x35')]('nolimit')){_0x5abe9b[_0x488c('0x20')]=qs['limit'](_0x355673[_0x488c('0x31')][_0x488c('0x20')]);_0x5abe9b[_0x488c('0x1e')]=qs[_0x488c('0x1e')](_0x355673[_0x488c('0x31')][_0x488c('0x1e')]);}return _0x4f4bf0['getConfigurations'](_0x5abe9b);}})[_0x488c('0x25')](function(_0x47f3e2){if(_0x47f3e2){return _0x47f3e2?{'count':_0x391e73,'rows':_0x47f3e2}:null;}})[_0x488c('0x25')](respondWithResult(_0x1fbd86,null))['catch'](handleError(_0x1fbd86,null));};exports[_0x488c('0x4d')]=function(_0x41cb37,_0x5497fc,_0x31cca5){if(_0x41cb37[_0x488c('0x49')]['id']){delete _0x41cb37['body']['id'];}return db[_0x488c('0x2c')][_0x488c('0x4b')]({'where':{'id':_0x41cb37[_0x488c('0x42')]['id']}})[_0x488c('0x25')](handleEntityNotFound(_0x5497fc,null))[_0x488c('0x25')](function(_0x696436){if(_0x696436){_0x41cb37[_0x488c('0x49')]['AccountId']=_0x696436['id'];_0x41cb37[_0x488c('0x49')]['Subjects']=integrations[_0x488c('0x4e')](_0x41cb37['body']['channel'],_0x41cb37[_0x488c('0x49')][_0x488c('0x3b')]);_0x41cb37['body']['Descriptions']=integrations['getDescriptions'](_0x41cb37[_0x488c('0x49')][_0x488c('0x4f')],_0x41cb37[_0x488c('0x49')]['type']);return db[_0x488c('0x4c')][_0x488c('0x47')](_0x41cb37['body'],{'include':[{'model':db['ServicenowField'],'as':_0x488c('0x50')},{'model':db['ServicenowField'],'as':_0x488c('0x51')}]});}return null;})[_0x488c('0x25')](respondWithResult(_0x5497fc,null))[_0x488c('0x46')](handleError(_0x5497fc,null));};exports[_0x488c('0x52')]=function(_0x180ce4,_0x507e5f,_0x4838a4){var _0x17f530=[_0x488c('0x53'),_0x488c('0x54'),_0x488c('0x55'),'subcategory',_0x488c('0x56'),_0x488c('0x57'),_0x488c('0x58'),_0x488c('0x59'),'category'];var _0x125a51=[_0x488c('0x5a'),_0x488c('0x53'),_0x488c('0x5b'),_0x488c('0x5c'),_0x488c('0x5d'),_0x488c('0x5e'),_0x488c('0x5f'),_0x488c('0x54'),'approval_history',_0x488c('0x60'),_0x488c('0x61'),_0x488c('0x62'),_0x488c('0x63'),_0x488c('0x64'),_0x488c('0x65'),_0x488c('0x66'),_0x488c('0x67'),_0x488c('0x68'),_0x488c('0x55'),'order',_0x488c('0x69'),'closed_at',_0x488c('0x6a'),'delivery_plan',_0x488c('0x6b'),_0x488c('0x6c'),_0x488c('0x6d'),'business_service',_0x488c('0x6e'),_0x488c('0x6f'),_0x488c('0x70'),_0x488c('0x71'),_0x488c('0x72'),_0x488c('0x73'),_0x488c('0x74'),'group_list',_0x488c('0x75'),'reopened_time','resolved_at',_0x488c('0x76'),_0x488c('0x77'),'subcategory',_0x488c('0x78'),_0x488c('0x79'),_0x488c('0x56'),_0x488c('0x7a'),'delivery_task',_0x488c('0x7b'),_0x488c('0x7c'),_0x488c('0x7d'),'additional_assignee_list','description','calendar_duration',_0x488c('0x57'),_0x488c('0x7e'),'close_notes',_0x488c('0x7f'),_0x488c('0x80'),'parent_incident',_0x488c('0x81'),_0x488c('0x82'),_0x488c('0x83'),_0x488c('0x58'),'urgency',_0x488c('0x84'),_0x488c('0x85'),_0x488c('0x86'),_0x488c('0x87'),_0x488c('0x88'),_0x488c('0x59'),'comments',_0x488c('0x89'),_0x488c('0x8a'),'comments_and_work_notes',_0x488c('0x8b'),_0x488c('0x8c'),'reopen_count',_0x488c('0x8d'),_0x488c('0x8e'),_0x488c('0x8f'),_0x488c('0x90'),_0x488c('0x91'),_0x488c('0x92')];var _0x1c53ae='';var _0x5872cb='';var _0x254731=[];var _0x413882='';var _0xf52c20='';var _0x131ad8=[];var _0x41f415='';var _0x26c77e='';var _0xd4409e={};var _0x421496='';return db['ServicenowAccount'][_0x488c('0x4b')]({'where':{'id':_0x180ce4['params']['id']},'attributes':['id',_0x488c('0x93'),_0x488c('0x94'),_0x488c('0x95'),'remoteUri',_0x488c('0x96')]})[_0x488c('0x25')](handleEntityNotFound(_0x507e5f,null))[_0x488c('0x25')](function(_0x89813a){if(_0x89813a){_0x421496=_0x89813a[_0x488c('0x97')];var _0x39060d=_0x421496[_0x488c('0x98')](-0x1);if(_0x39060d==='/'){_0x421496=_0x421496[_0x488c('0x99')](0x0,_0x421496['lastIndexOf'](_0x39060d));}_0x26c77e=util[_0x488c('0x9a')]('%s/api/now/doc/table/schema/',_0x421496);_0x41f415=util[_0x488c('0x9a')](_0x488c('0x9b'),_0x421496);_0xd4409e={'user':_0x89813a['username'],'pass':_0x89813a[_0x488c('0x94')]};var _0x1da013={'method':'GET','uri':_0x26c77e+'incident?sysparm_display_value=all','auth':_0xd4409e,'json':!![]};return rp(_0x1da013);}})[_0x488c('0x25')](function(_0x57a8b7){if(_0x57a8b7['result'][_0x488c('0x44')]>0x0){_0x1c53ae=_0x57a8b7['result'];}console['log'](_0x488c('0x9c'),_0x1c53ae);_0x131ad8=[];_0x5872cb=Object[_0x488c('0x9d')]([],_0x1c53ae);_['remove'](_0x5872cb,function(_0x3e0385){return!_0x17f530[_0x488c('0x9e')](_0x3e0385['name']);});_0x5872cb['forEach'](function(_0x250906){var _0x41a961=createFieldObject(_0x41f415,_0xd4409e,_0x250906[_0x488c('0x9f')],_0x250906[_0x488c('0x28')],_0x250906[_0x488c('0xa0')],![]);_0x131ad8['push'](_0x41a961);});return Promise[_0x488c('0xa1')](_0x131ad8);})[_0x488c('0x25')](function(_0x48ba89){_0x254731=_0x48ba89;_0x413882=Object['assign']([],_0x1c53ae);console[_0x488c('0xa2')]('TCL:\x20_object',_0x1c53ae);_[_0x488c('0xa3')](_0x413882,function(_0x3a8876){return _0x125a51[_0x488c('0x9e')](_0x3a8876[_0x488c('0x28')]);});console[_0x488c('0xa2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x413882);_0x131ad8=[];_0x413882['forEach'](function(_0x23dc32){var _0x5dc100=createFieldObject(_0x41f415,_0xd4409e,_0x23dc32[_0x488c('0x9f')],_0x23dc32[_0x488c('0x28')],_0x23dc32[_0x488c('0xa0')],!![]);_0x131ad8[_0x488c('0xa4')](_0x5dc100);});return Promise[_0x488c('0xa1')](_0x131ad8);})[_0x488c('0x25')](function(_0x5c1846){_0xf52c20=_0x5c1846;var _0x509565=_0x254731['concat'](_0xf52c20);return{'count':_0x509565['length'],'rows':_0x509565};})[_0x488c('0x25')](respondWithResult(_0x507e5f,null))[_0x488c('0x46')](function(_0x371152){console[_0x488c('0xa2')](_0x488c('0xa5')+_0x371152);var _0x523b27=_0x180ce4['query'][_0x488c('0xa6')]?0x1f4:_0x371152[_0x488c('0xa7')]||0x1f4;logger[_0x488c('0x26')](_0x371152[_0x488c('0x27')]);delete _0x371152['name'];if(_0x523b27===0x191){_0x523b27=0x190;}_0x507e5f[_0x488c('0x1b')](_0x523b27)[_0x488c('0x29')](_0x180ce4[_0x488c('0x31')]['test']?{'message':_0x488c('0xa8'),'statusCode':_0x371152[_0x488c('0xa7')]}:_0x371152);});};function createFieldObject(_0x24897f,_0x498852,_0x3da0df,_0x416cd9,_0x1f6f50,_0xb80f42){return new Promise(function(_0x20bbf1,_0x1ced2c){var _0x4b440d={'id':_0x416cd9,'name':_0x1f6f50,'custom':_0xb80f42};if(_0x3da0df===_0x488c('0xa9')){_0x4b440d[_0x488c('0x3e')]=[{'name':_0x488c('0xaa'),'value':_0x488c('0xab')},{'name':_0x488c('0xac'),'value':_0x488c('0xad')}];_0x20bbf1(_0x4b440d);}else{var _0x4835a0={'method':_0x488c('0xae'),'uri':_0x24897f+_0x488c('0xaf')+_0x416cd9,'auth':_0x498852,'json':!![]};return rp(_0x4835a0)[_0x488c('0x25')](function(_0xb608c1){var _0xf51c61=[];if(_0xb608c1[_0x488c('0xb0')][_0x488c('0x44')]>0x0){_0xb608c1['result'][_0x488c('0xb1')](function(_0x6611c9){if(_0x6611c9[_0x488c('0xb2')]==='false'){var _0x3b0bf6={'name':_0x6611c9[_0x488c('0xa0')],'value':_0x6611c9[_0x488c('0xb3')]};_0xf51c61['push'](_0x3b0bf6);}});}_0x4b440d['options']=_0xf51c61;if(_0x4b440d[_0x488c('0x3e')][_0x488c('0x44')]>0x0){_0x20bbf1(_0x4b440d);}else{if(_0xb80f42==![]){_0x20bbf1();}else{_0x20bbf1(_0x4b440d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index bed5908..2639b8a 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 _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2bb779,_0x1d70a7){var _0x17557a=function(_0x5d10e2){while(--_0x5d10e2){_0x2bb779['push'](_0x2bb779['shift']());}};_0x17557a(++_0x1d70a7);}(_0x31f0,0xb7));var _0x031f=function(_0x4f4dd4,_0x49b0a6){_0x4f4dd4=_0x4f4dd4-0x0;var _0x5deb2d=_0x31f0[_0x4f4dd4];return _0x5deb2d;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x36c285,_0x2f754a){var _0x39680c=function(_0x160a71){while(--_0x160a71){_0x36c285['push'](_0x36c285['shift']());}};_0x39680c(++_0x2f754a);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 2c380e7..6217f14 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 _0x6b3a=['ShowServicenowAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','debug','find','raw','then'];(function(_0x417e6d,_0x1df680){var _0x921a79=function(_0x416118){while(--_0x416118){_0x417e6d['push'](_0x417e6d['shift']());}};_0x921a79(++_0x1df680);}(_0x6b3a,0x14e));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa6b3('0x0'));var moment=require(_0xa6b3('0x1'));var BPromise=require(_0xa6b3('0x2'));var rs=require(_0xa6b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6b3('0x4'))['db'];var utils=require(_0xa6b3('0x5'));var logger=require(_0xa6b3('0x6'))(_0xa6b3('0x7'));var config=require(_0xa6b3('0x8'));var jayson=require(_0xa6b3('0x9'));var client=jayson[_0xa6b3('0xa')][_0xa6b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x235cfd,_0x246a87,_0x3eb02c){return new BPromise(function(_0x35c18b,_0x18be47){return client[_0xa6b3('0xc')](_0x235cfd,_0x3eb02c)['then'](function(_0x4c9b5f){logger[_0xa6b3('0xd')](_0xa6b3('0xe'),_0x246a87,_0xa6b3('0xf'));logger['debug'](_0xa6b3('0x10'),_0x246a87,_0xa6b3('0xf'),JSON[_0xa6b3('0x11')](_0x4c9b5f));if(_0x4c9b5f[_0xa6b3('0x12')]){if(_0x4c9b5f[_0xa6b3('0x12')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x246a87,_0x4c9b5f[_0xa6b3('0x12')]['message']);return _0x18be47(_0x4c9b5f[_0xa6b3('0x12')]['message']);}logger[_0xa6b3('0x12')](_0xa6b3('0xe'),_0x246a87,_0x4c9b5f[_0xa6b3('0x12')][_0xa6b3('0x13')]);return _0x35c18b(_0x4c9b5f[_0xa6b3('0x12')][_0xa6b3('0x13')]);}else{logger[_0xa6b3('0xd')](_0xa6b3('0xe'),_0x246a87,_0xa6b3('0xf'));_0x35c18b(_0x4c9b5f[_0xa6b3('0x14')]['message']);}})[_0xa6b3('0x15')](function(_0x329dbc){logger['error'](_0xa6b3('0xe'),_0x246a87,_0x329dbc);_0x18be47(_0x329dbc);});});}exports[_0xa6b3('0x16')]=function(_0x5ab86f){var _0x180069=this;return new Promise(function(_0x488bc7,_0x249141){return db[_0xa6b3('0x17')][_0xa6b3('0x18')]({'raw':_0x5ab86f[_0xa6b3('0x19')]?_0x5ab86f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ab86f[_0xa6b3('0x19')]?_0x5ab86f[_0xa6b3('0x19')][_0xa6b3('0x1a')]||null:null,'attributes':_0x5ab86f['options']?_0x5ab86f[_0xa6b3('0x19')][_0xa6b3('0x1b')]||null:null,'limit':_0x5ab86f['options']?_0x5ab86f[_0xa6b3('0x19')][_0xa6b3('0x1c')]||null:null,'include':_0x5ab86f[_0xa6b3('0x19')]?_0x5ab86f[_0xa6b3('0x19')][_0xa6b3('0x1d')]?_[_0xa6b3('0x1e')](_0x5ab86f[_0xa6b3('0x19')]['include'],function(_0x555105){return{'model':db[_0x555105['model']],'as':_0x555105['as'],'attributes':_0x555105[_0xa6b3('0x1b')],'include':_0x555105[_0xa6b3('0x1d')]?_[_0xa6b3('0x1e')](_0x555105[_0xa6b3('0x1d')],function(_0x2d25c6){return{'model':db[_0x2d25c6['model']],'as':_0x2d25c6['as'],'attributes':_0x2d25c6[_0xa6b3('0x1b')],'include':_0x2d25c6[_0xa6b3('0x1d')]?_['map'](_0x2d25c6[_0xa6b3('0x1d')],function(_0x708fe7){return{'model':db[_0x708fe7[_0xa6b3('0x1f')]],'as':_0x708fe7['as'],'attributes':_0x708fe7[_0xa6b3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ee590){logger[_0xa6b3('0xd')]('GetServicenowAccount',_0x5ab86f);logger[_0xa6b3('0x20')](_0xa6b3('0x16'),_0x5ab86f,JSON[_0xa6b3('0x11')](_0x1ee590));_0x488bc7(_0x1ee590);})[_0xa6b3('0x15')](function(_0x3ee7b7){logger[_0xa6b3('0x12')](_0xa6b3('0x16'),_0x3ee7b7[_0xa6b3('0x13')],_0x5ab86f);_0x249141(_0x180069['error'](0x1f4,_0x3ee7b7[_0xa6b3('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x5bcd84){var _0x4c06e6=this;return new Promise(function(_0x1bc91b,_0xbd4765){return db[_0xa6b3('0x17')][_0xa6b3('0x21')]({'raw':_0x5bcd84['options']?_0x5bcd84[_0xa6b3('0x19')][_0xa6b3('0x22')]===undefined?!![]:![]:!![],'where':_0x5bcd84['options']?_0x5bcd84[_0xa6b3('0x19')][_0xa6b3('0x1a')]||null:null,'attributes':_0x5bcd84[_0xa6b3('0x19')]?_0x5bcd84['options'][_0xa6b3('0x1b')]||null:null,'include':_0x5bcd84[_0xa6b3('0x19')]?_0x5bcd84[_0xa6b3('0x19')]['include']?_['map'](_0x5bcd84[_0xa6b3('0x19')][_0xa6b3('0x1d')],function(_0x4545f8){return{'model':db[_0x4545f8[_0xa6b3('0x1f')]],'as':_0x4545f8['as'],'attributes':_0x4545f8['attributes'],'include':_0x4545f8[_0xa6b3('0x1d')]?_[_0xa6b3('0x1e')](_0x4545f8[_0xa6b3('0x1d')],function(_0x3ace10){return{'model':db[_0x3ace10[_0xa6b3('0x1f')]],'as':_0x3ace10['as'],'attributes':_0x3ace10[_0xa6b3('0x1b')],'include':_0x3ace10[_0xa6b3('0x1d')]?_[_0xa6b3('0x1e')](_0x3ace10[_0xa6b3('0x1d')],function(_0x322c65){return{'model':db[_0x322c65['model']],'as':_0x322c65['as'],'attributes':_0x322c65[_0xa6b3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa6b3('0x23')](function(_0x5dd43f){logger[_0xa6b3('0xd')]('ShowServicenowAccount',_0x5bcd84);logger[_0xa6b3('0x20')](_0xa6b3('0x24'),_0x5bcd84,JSON[_0xa6b3('0x11')](_0x5dd43f));_0x1bc91b(_0x5dd43f);})['catch'](function(_0x65c000){logger['error'](_0xa6b3('0x24'),_0x65c000['message'],_0x5bcd84);_0xbd4765(_0x4c06e6[_0xa6b3('0x12')](0x1f4,_0x65c000[_0xa6b3('0x13')]));});});}; \ No newline at end of file +var _0xe36a=['raw','where','include','map','model','attributes','ShowServicenowAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options'];(function(_0x329132,_0x2759c8){var _0x35c88f=function(_0x41b94a){while(--_0x41b94a){_0x329132['push'](_0x329132['shift']());}};_0x35c88f(++_0x2759c8);}(_0xe36a,0x98));var _0xae36=function(_0x237398,_0xc0ef22){_0x237398=_0x237398-0x0;var _0x5598de=_0xe36a[_0x237398];return _0x5598de;};'use strict';var _=require('lodash');var util=require(_0xae36('0x0'));var moment=require(_0xae36('0x1'));var BPromise=require(_0xae36('0x2'));var rs=require(_0xae36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae36('0x4'))['db'];var utils=require(_0xae36('0x5'));var logger=require(_0xae36('0x6'))(_0xae36('0x7'));var config=require(_0xae36('0x8'));var jayson=require(_0xae36('0x9'));var client=jayson[_0xae36('0xa')][_0xae36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a05ab,_0x5d0d22,_0x2b4870){return new BPromise(function(_0x400f32,_0x1d768d){return client[_0xae36('0xc')](_0x4a05ab,_0x2b4870)[_0xae36('0xd')](function(_0xf57078){logger[_0xae36('0xe')](_0xae36('0xf'),_0x5d0d22,_0xae36('0x10'));logger[_0xae36('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5d0d22,_0xae36('0x10'),JSON[_0xae36('0x12')](_0xf57078));if(_0xf57078[_0xae36('0x13')]){if(_0xf57078[_0xae36('0x13')][_0xae36('0x14')]===0x1f4){logger[_0xae36('0x13')](_0xae36('0xf'),_0x5d0d22,_0xf57078[_0xae36('0x13')][_0xae36('0x15')]);return _0x1d768d(_0xf57078['error']['message']);}logger[_0xae36('0x13')](_0xae36('0xf'),_0x5d0d22,_0xf57078[_0xae36('0x13')][_0xae36('0x15')]);return _0x400f32(_0xf57078[_0xae36('0x13')][_0xae36('0x15')]);}else{logger[_0xae36('0xe')](_0xae36('0xf'),_0x5d0d22,_0xae36('0x10'));_0x400f32(_0xf57078[_0xae36('0x16')]['message']);}})[_0xae36('0x17')](function(_0x334bef){logger[_0xae36('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5d0d22,_0x334bef);_0x1d768d(_0x334bef);});});}exports[_0xae36('0x18')]=function(_0x15f88e){var _0x5a9230=this;return new Promise(function(_0x3ef035,_0x33c5c9){return db[_0xae36('0x19')][_0xae36('0x1a')]({'raw':_0x15f88e['options']?_0x15f88e[_0xae36('0x1b')][_0xae36('0x1c')]===undefined?!![]:![]:!![],'where':_0x15f88e['options']?_0x15f88e[_0xae36('0x1b')][_0xae36('0x1d')]||null:null,'attributes':_0x15f88e[_0xae36('0x1b')]?_0x15f88e[_0xae36('0x1b')]['attributes']||null:null,'limit':_0x15f88e[_0xae36('0x1b')]?_0x15f88e['options']['limit']||null:null,'include':_0x15f88e[_0xae36('0x1b')]?_0x15f88e[_0xae36('0x1b')][_0xae36('0x1e')]?_[_0xae36('0x1f')](_0x15f88e[_0xae36('0x1b')]['include'],function(_0x449869){return{'model':db[_0x449869[_0xae36('0x20')]],'as':_0x449869['as'],'attributes':_0x449869[_0xae36('0x21')],'include':_0x449869[_0xae36('0x1e')]?_[_0xae36('0x1f')](_0x449869['include'],function(_0x57ae5a){return{'model':db[_0x57ae5a[_0xae36('0x20')]],'as':_0x57ae5a['as'],'attributes':_0x57ae5a[_0xae36('0x21')],'include':_0x57ae5a['include']?_[_0xae36('0x1f')](_0x57ae5a[_0xae36('0x1e')],function(_0x195124){return{'model':db[_0x195124['model']],'as':_0x195124['as'],'attributes':_0x195124[_0xae36('0x21')]};}):[]};}):[]};}):[]:[]})[_0xae36('0xd')](function(_0xa22f72){logger['info']('GetServicenowAccount',_0x15f88e);logger['debug'](_0xae36('0x18'),_0x15f88e,JSON[_0xae36('0x12')](_0xa22f72));_0x3ef035(_0xa22f72);})[_0xae36('0x17')](function(_0x2dfb8e){logger[_0xae36('0x13')](_0xae36('0x18'),_0x2dfb8e[_0xae36('0x15')],_0x15f88e);_0x33c5c9(_0x5a9230[_0xae36('0x13')](0x1f4,_0x2dfb8e[_0xae36('0x15')]));});});};exports[_0xae36('0x22')]=function(_0x4fd2d7){var _0x218ddb=this;return new Promise(function(_0x2473a9,_0x2dac99){return db[_0xae36('0x19')][_0xae36('0x23')]({'raw':_0x4fd2d7['options']?_0x4fd2d7[_0xae36('0x1b')][_0xae36('0x1c')]===undefined?!![]:![]:!![],'where':_0x4fd2d7[_0xae36('0x1b')]?_0x4fd2d7[_0xae36('0x1b')][_0xae36('0x1d')]||null:null,'attributes':_0x4fd2d7[_0xae36('0x1b')]?_0x4fd2d7[_0xae36('0x1b')]['attributes']||null:null,'include':_0x4fd2d7['options']?_0x4fd2d7[_0xae36('0x1b')][_0xae36('0x1e')]?_['map'](_0x4fd2d7[_0xae36('0x1b')]['include'],function(_0x2f0032){return{'model':db[_0x2f0032[_0xae36('0x20')]],'as':_0x2f0032['as'],'attributes':_0x2f0032[_0xae36('0x21')],'include':_0x2f0032['include']?_[_0xae36('0x1f')](_0x2f0032[_0xae36('0x1e')],function(_0x407785){return{'model':db[_0x407785[_0xae36('0x20')]],'as':_0x407785['as'],'attributes':_0x407785[_0xae36('0x21')],'include':_0x407785['include']?_[_0xae36('0x1f')](_0x407785['include'],function(_0x986db6){return{'model':db[_0x986db6[_0xae36('0x20')]],'as':_0x986db6['as'],'attributes':_0x986db6[_0xae36('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x220a4b){logger[_0xae36('0xe')]('ShowServicenowAccount',_0x4fd2d7);logger['debug']('ShowServicenowAccount',_0x4fd2d7,JSON[_0xae36('0x12')](_0x220a4b));_0x2473a9(_0x220a4b);})['catch'](function(_0x28656f){logger[_0xae36('0x13')]('ShowServicenowAccount',_0x28656f['message'],_0x4fd2d7);_0x2dac99(_0x218ddb['error'](0x1f4,_0x28656f[_0xae36('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index dee0a5e..412e080 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 _0xebdb=['/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','getSubjects'];(function(_0x12e839,_0x4df859){var _0x340f9a=function(_0x30d2e7){while(--_0x30d2e7){_0x12e839['push'](_0x12e839['shift']());}};_0x340f9a(++_0x4df859);}(_0xebdb,0xef));var _0xbebd=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xebdb[_0x421cf8];return _0x145c48;};'use strict';var multer=require('multer');var util=require(_0xbebd('0x0'));var path=require(_0xbebd('0x1'));var timeout=require(_0xbebd('0x2'));var express=require(_0xbebd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbebd('0x4'));var interaction=require(_0xbebd('0x5'));var config=require(_0xbebd('0x6'));var controller=require(_0xbebd('0x7'));router[_0xbebd('0x8')]('/',auth[_0xbebd('0x9')](),controller[_0xbebd('0xa')]);router[_0xbebd('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbebd('0x8')](_0xbebd('0xb'),auth[_0xbebd('0x9')](),controller[_0xbebd('0xc')]);router[_0xbebd('0x8')]('/:id/subjects',auth[_0xbebd('0x9')](),controller[_0xbebd('0xd')]);router[_0xbebd('0x8')](_0xbebd('0xe'),auth['isAuthenticated'](),controller[_0xbebd('0xf')]);router[_0xbebd('0x10')]('/',auth['isAuthenticated'](),controller[_0xbebd('0x11')]);router[_0xbebd('0x12')](_0xbebd('0x13'),auth[_0xbebd('0x9')](),controller[_0xbebd('0x14')]);router['delete']('/:id',auth[_0xbebd('0x9')](),controller[_0xbebd('0x15')]);module[_0xbebd('0x16')]=router; \ No newline at end of file +var _0x1d76=['express','Router','../../components/auth/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1bcca1,_0x4a9ac1){var _0x38812f=function(_0x3cf5f6){while(--_0x3cf5f6){_0x1bcca1['push'](_0x1bcca1['shift']());}};_0x38812f(++_0x4a9ac1);}(_0x1d76,0x9f));var _0x61d7=function(_0x4e6b63,_0x2a4427){_0x4e6b63=_0x4e6b63-0x0;var _0x5ee149=_0x1d76[_0x4e6b63];return _0x5ee149;};'use strict';var multer=require(_0x61d7('0x0'));var util=require('util');var path=require(_0x61d7('0x1'));var timeout=require('connect-timeout');var express=require(_0x61d7('0x2'));var router=express[_0x61d7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x61d7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x61d7('0x5'));router['get']('/',auth[_0x61d7('0x6')](),controller[_0x61d7('0x7')]);router[_0x61d7('0x8')](_0x61d7('0x9'),auth[_0x61d7('0x6')](),controller[_0x61d7('0xa')]);router[_0x61d7('0x8')](_0x61d7('0xb'),auth[_0x61d7('0x6')](),controller[_0x61d7('0xc')]);router[_0x61d7('0x8')](_0x61d7('0xd'),auth[_0x61d7('0x6')](),controller['getSubjects']);router['get'](_0x61d7('0xe'),auth[_0x61d7('0x6')](),controller[_0x61d7('0xf')]);router[_0x61d7('0x10')]('/',auth[_0x61d7('0x6')](),controller[_0x61d7('0x11')]);router[_0x61d7('0x12')](_0x61d7('0x9'),auth['isAuthenticated'](),controller[_0x61d7('0x13')]);router[_0x61d7('0x14')](_0x61d7('0x9'),auth[_0x61d7('0x6')](),controller[_0x61d7('0x15')]);module[_0x61d7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5e7e7fc..5b88780 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 _0xc841=['exports','STRING','sequelize'];(function(_0x52bfa1,_0x24f271){var _0x2f32d5=function(_0x5ccced){while(--_0x5ccced){_0x52bfa1['push'](_0x52bfa1['shift']());}};_0x2f32d5(++_0x24f271);}(_0xc841,0x1dc));var _0x1c84=function(_0x1751c4,_0x180a67){_0x1751c4=_0x1751c4-0x0;var _0x1bc7b3=_0xc841[_0x1751c4];return _0x1bc7b3;};'use strict';var Sequelize=require(_0x1c84('0x0'));module[_0x1c84('0x1')]={'name':{'type':Sequelize[_0x1c84('0x2')]},'description':{'type':Sequelize[_0x1c84('0x2')]}}; \ No newline at end of file +var _0x1417=['exports','STRING'];(function(_0x1422f5,_0x422f11){var _0x1fa596=function(_0x202495){while(--_0x202495){_0x1422f5['push'](_0x1422f5['shift']());}};_0x1fa596(++_0x422f11);}(_0x1417,0xb4));var _0x7141=function(_0xdb7bc5,_0x11506f){_0xdb7bc5=_0xdb7bc5-0x0;var _0x7cf93e=_0x1417[_0xdb7bc5];return _0x7cf93e;};'use strict';var Sequelize=require('sequelize');module[_0x7141('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7141('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 0f8c745..740ced2 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 _0xf03f=['name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack'];(function(_0x30c1dd,_0x23a13c){var _0x57dfaf=function(_0x43afa5){while(--_0x43afa5){_0x30c1dd['push'](_0x30c1dd['shift']());}};_0x57dfaf(++_0x23a13c);}(_0xf03f,0x1d7));var _0xff03=function(_0x40b66c,_0x578758){_0x40b66c=_0x40b66c-0x0;var _0x2fd22b=_0xf03f[_0x40b66c];return _0x2fd22b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff03('0x0'));var zipdir=require(_0xff03('0x1'));var jsonpatch=require(_0xff03('0x2'));var rp=require(_0xff03('0x3'));var moment=require(_0xff03('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff03('0x5'));var util=require(_0xff03('0x6'));var path=require(_0xff03('0x7'));var sox=require(_0xff03('0x8'));var csv=require(_0xff03('0x9'));var ejs=require(_0xff03('0xa'));var fs=require('fs');var fs_extra=require(_0xff03('0xb'));var _=require(_0xff03('0xc'));var squel=require(_0xff03('0xd'));var crypto=require('crypto');var jsforce=require(_0xff03('0xe'));var deskjs=require(_0xff03('0xf'));var toCsv=require(_0xff03('0x9'));var querystring=require(_0xff03('0x10'));var Papa=require(_0xff03('0x11'));var Redis=require(_0xff03('0x12'));var authService=require(_0xff03('0x13'));var qs=require(_0xff03('0x14'));var as=require(_0xff03('0x15'));var hardwareService=require(_0xff03('0x16'));var logger=require(_0xff03('0x17'))(_0xff03('0x18'));var utils=require(_0xff03('0x19'));var config=require(_0xff03('0x1a'));var licenseUtil=require(_0xff03('0x1b'));var db=require(_0xff03('0x1c'))['db'];function respondWithStatusCode(_0x9ae090,_0x38e341){_0x38e341=_0x38e341||0xcc;return function(_0x5880a9){if(_0x5880a9){return _0x9ae090[_0xff03('0x1d')](_0x38e341);}return _0x9ae090[_0xff03('0x1e')](_0x38e341)[_0xff03('0x1f')]();};}function respondWithResult(_0x19de1f,_0x3af595){_0x3af595=_0x3af595||0xc8;return function(_0x24ed7c){if(_0x24ed7c){return _0x19de1f[_0xff03('0x1e')](_0x3af595)[_0xff03('0x20')](_0x24ed7c);}};}function respondWithFilteredResult(_0xd2fa8a,_0x41ee60){return function(_0x21245a){if(_0x21245a){var _0x45c146=typeof _0x41ee60[_0xff03('0x21')]===_0xff03('0x22')&&typeof _0x41ee60[_0xff03('0x23')]===_0xff03('0x22');var _0x4e9696=_0x21245a[_0xff03('0x24')];var _0x174cea=_0x45c146?0x0:_0x41ee60[_0xff03('0x21')];var _0x4a1e08=_0x45c146?_0x21245a[_0xff03('0x24')]:_0x41ee60[_0xff03('0x21')]+_0x41ee60[_0xff03('0x23')];var _0x324090;if(_0x4a1e08>=_0x4e9696){_0x4a1e08=_0x4e9696;_0x324090=0xc8;}else{_0x324090=0xce;}_0xd2fa8a['status'](_0x324090);return _0xd2fa8a[_0xff03('0x25')](_0xff03('0x26'),_0x174cea+'-'+_0x4a1e08+'/'+_0x4e9696)[_0xff03('0x20')](_0x21245a);}return null;};}function patchUpdates(_0x347072){return function(_0x45610c){try{jsonpatch[_0xff03('0x27')](_0x45610c,_0x347072,!![]);}catch(_0x146639){return BPromise[_0xff03('0x28')](_0x146639);}return _0x45610c[_0xff03('0x29')]();};}function saveUpdates(_0x4e79ec,_0xadd639){return function(_0x3bf864){if(_0x3bf864){return _0x3bf864[_0xff03('0x2a')](_0x4e79ec)[_0xff03('0x2b')](function(_0x59d33a){return _0x59d33a;});}return null;};}function removeEntity(_0x38ad86,_0x43d1ad){return function(_0x1ad43b){if(_0x1ad43b){return _0x1ad43b['destroy']()['then'](function(){_0x38ad86[_0xff03('0x1e')](0xcc)[_0xff03('0x1f')]();});}};}function handleEntityNotFound(_0x420761,_0x5b4f7b){return function(_0x5c7bed){if(!_0x5c7bed){_0x420761[_0xff03('0x1d')](0x194);}return _0x5c7bed;};}function handleError(_0x5c1390,_0x1f094b){_0x1f094b=_0x1f094b||0x1f4;return function(_0x11658a){logger['error'](_0x11658a[_0xff03('0x2c')]);if(_0x11658a[_0xff03('0x2d')]){delete _0x11658a[_0xff03('0x2d')];}_0x5c1390[_0xff03('0x1e')](_0x1f094b)[_0xff03('0x2e')](_0x11658a);};}exports[_0xff03('0x2f')]=function(_0x32a69e,_0x1e250a){var _0x22b58a={},_0x3ed0dc={},_0x94339f={'count':0x0,'rows':[]};var _0x40f455=_['map'](db[_0xff03('0x30')][_0xff03('0x31')],function(_0x4f1654){return{'name':_0x4f1654[_0xff03('0x32')],'type':_0x4f1654['type'][_0xff03('0x33')]};});_0x3ed0dc[_0xff03('0x34')]=_[_0xff03('0x35')](_0x40f455,_0xff03('0x2d'));_0x3ed0dc[_0xff03('0x36')]=_['keys'](_0x32a69e[_0xff03('0x36')]);_0x3ed0dc['filters']=_[_0xff03('0x37')](_0x3ed0dc[_0xff03('0x34')],_0x3ed0dc[_0xff03('0x36')]);_0x22b58a[_0xff03('0x38')]=_[_0xff03('0x37')](_0x3ed0dc[_0xff03('0x34')],qs['fields'](_0x32a69e[_0xff03('0x36')][_0xff03('0x39')]));_0x22b58a[_0xff03('0x38')]=_0x22b58a['attributes'][_0xff03('0x3a')]?_0x22b58a[_0xff03('0x38')]:_0x3ed0dc[_0xff03('0x34')];if(!_0x32a69e[_0xff03('0x36')][_0xff03('0x3b')](_0xff03('0x3c'))){_0x22b58a[_0xff03('0x23')]=qs[_0xff03('0x23')](_0x32a69e[_0xff03('0x36')][_0xff03('0x23')]);_0x22b58a[_0xff03('0x21')]=qs[_0xff03('0x21')](_0x32a69e['query']['offset']);}_0x22b58a['order']=qs[_0xff03('0x3d')](_0x32a69e['query'][_0xff03('0x3d')]);_0x22b58a[_0xff03('0x3e')]=qs['filters'](_[_0xff03('0x3f')](_0x32a69e[_0xff03('0x36')],_0x3ed0dc[_0xff03('0x40')]),_0x40f455);if(_0x32a69e['query']['filter']){_0x22b58a[_0xff03('0x3e')]=_['merge'](_0x22b58a['where'],{'$or':_[_0xff03('0x35')](_0x40f455,function(_0x3412fe){if(_0x3412fe['type']!==_0xff03('0x41')){var _0x303935={};_0x303935[_0x3412fe['name']]={'$like':'%'+_0x32a69e[_0xff03('0x36')][_0xff03('0x42')]+'%'};return _0x303935;}})});}_0x22b58a=_[_0xff03('0x43')]({},_0x22b58a,_0x32a69e[_0xff03('0x44')]);var _0xb08989={'where':_0x22b58a['where']};return db[_0xff03('0x30')][_0xff03('0x24')](_0xb08989)[_0xff03('0x2b')](function(_0x49ef30){_0x94339f['count']=_0x49ef30;if(_0x32a69e[_0xff03('0x36')][_0xff03('0x45')]){_0x22b58a[_0xff03('0x46')]=[{'all':!![]}];}return db[_0xff03('0x30')]['findAll'](_0x22b58a);})['then'](function(_0x482bbe){_0x94339f[_0xff03('0x47')]=_0x482bbe;return _0x94339f;})['then'](respondWithFilteredResult(_0x1e250a,_0x22b58a))[_0xff03('0x48')](handleError(_0x1e250a,null));};exports[_0xff03('0x49')]=function(_0x2c5937,_0x454928){var _0x58ce49={'raw':![],'where':{'id':_0x2c5937[_0xff03('0x4a')]['id']}},_0xdf5ad4={};_0xdf5ad4[_0xff03('0x34')]=_[_0xff03('0x4b')](db['ServicenowConfiguration'][_0xff03('0x31')]);_0xdf5ad4[_0xff03('0x36')]=_['keys'](_0x2c5937[_0xff03('0x36')]);_0xdf5ad4[_0xff03('0x40')]=_['intersection'](_0xdf5ad4[_0xff03('0x34')],_0xdf5ad4['query']);_0x58ce49[_0xff03('0x38')]=_[_0xff03('0x37')](_0xdf5ad4[_0xff03('0x34')],qs[_0xff03('0x39')](_0x2c5937[_0xff03('0x36')][_0xff03('0x39')]));_0x58ce49[_0xff03('0x38')]=_0x58ce49[_0xff03('0x38')][_0xff03('0x3a')]?_0x58ce49[_0xff03('0x38')]:_0xdf5ad4['model'];if(_0x2c5937[_0xff03('0x36')][_0xff03('0x45')]){_0x58ce49[_0xff03('0x46')]=[{'all':!![]}];}_0x58ce49=_[_0xff03('0x43')]({},_0x58ce49,_0x2c5937[_0xff03('0x44')]);return db[_0xff03('0x30')][_0xff03('0x4c')](_0x58ce49)['then'](handleEntityNotFound(_0x454928,null))[_0xff03('0x2b')](respondWithResult(_0x454928,null))['catch'](handleError(_0x454928,null));};exports[_0xff03('0x4d')]=function(_0x497499,_0x3f3652){return db[_0xff03('0x30')][_0xff03('0x4d')](_0x497499['body'],{})[_0xff03('0x2b')](respondWithResult(_0x3f3652,0xc9))['catch'](handleError(_0x3f3652,null));};exports[_0xff03('0x2a')]=function(_0x1b5c53,_0x487b53){if(_0x1b5c53['body']['id']){delete _0x1b5c53[_0xff03('0x4e')]['id'];}return db[_0xff03('0x30')][_0xff03('0x4c')]({'where':{'id':_0x1b5c53['params']['id']}})[_0xff03('0x2b')](handleEntityNotFound(_0x487b53,null))['then'](saveUpdates(_0x1b5c53['body'],null))[_0xff03('0x2b')](respondWithResult(_0x487b53,null))[_0xff03('0x48')](handleError(_0x487b53,null));};exports[_0xff03('0x4f')]=function(_0x5b01f6,_0x1b4ecd){return db[_0xff03('0x30')][_0xff03('0x4c')]({'where':{'id':_0x5b01f6[_0xff03('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b4ecd,null))[_0xff03('0x2b')](removeEntity(_0x1b4ecd,null))['catch'](handleError(_0x1b4ecd,null));};exports[_0xff03('0x50')]=function(_0x3cc33b,_0x192ea0,_0x2a3f52){var _0x2aec9c={};var _0x5f10b0={};var _0x44b03e;var _0x316512;return db['ServicenowConfiguration'][_0xff03('0x51')]({'where':{'id':_0x3cc33b[_0xff03('0x4a')]['id']}})['then'](handleEntityNotFound(_0x192ea0,null))[_0xff03('0x2b')](function(_0x75fcbe){if(_0x75fcbe){_0x44b03e=_0x75fcbe;_0x5f10b0[_0xff03('0x34')]=_[_0xff03('0x4b')](db[_0xff03('0x52')]['rawAttributes']);_0x5f10b0['query']=_[_0xff03('0x4b')](_0x3cc33b['query']);_0x5f10b0[_0xff03('0x40')]=_['intersection'](_0x5f10b0[_0xff03('0x34')],_0x5f10b0[_0xff03('0x36')]);_0x2aec9c['attributes']=_['intersection'](_0x5f10b0[_0xff03('0x34')],qs[_0xff03('0x39')](_0x3cc33b[_0xff03('0x36')][_0xff03('0x39')]));_0x2aec9c[_0xff03('0x38')]=_0x2aec9c[_0xff03('0x38')][_0xff03('0x3a')]?_0x2aec9c[_0xff03('0x38')]:_0x5f10b0['model'];_0x2aec9c[_0xff03('0x53')]=qs[_0xff03('0x3d')](_0x3cc33b['query'][_0xff03('0x3d')]);_0x2aec9c[_0xff03('0x3e')]=qs[_0xff03('0x40')](_['pick'](_0x3cc33b[_0xff03('0x36')],_0x5f10b0['filters']));if(_0x3cc33b['query']['filter']){_0x2aec9c[_0xff03('0x3e')]=_['merge'](_0x2aec9c[_0xff03('0x3e')],{'$or':_[_0xff03('0x35')](_0x2aec9c[_0xff03('0x38')],function(_0x41fd9c){var _0x320e29={};_0x320e29[_0x41fd9c]={'$like':'%'+_0x3cc33b['query'][_0xff03('0x42')]+'%'};return _0x320e29;})});}_0x2aec9c=_['merge']({},_0x2aec9c,_0x3cc33b[_0xff03('0x44')]);return _0x44b03e[_0xff03('0x50')](_0x2aec9c);}})[_0xff03('0x2b')](function(_0x2e7e8d){if(_0x2e7e8d){_0x316512=_0x2e7e8d[_0xff03('0x3a')];if(!_0x3cc33b[_0xff03('0x36')][_0xff03('0x3b')](_0xff03('0x3c'))){_0x2aec9c[_0xff03('0x23')]=qs[_0xff03('0x23')](_0x3cc33b['query'][_0xff03('0x23')]);_0x2aec9c[_0xff03('0x21')]=qs[_0xff03('0x21')](_0x3cc33b['query']['offset']);}return _0x44b03e[_0xff03('0x50')](_0x2aec9c);}})[_0xff03('0x2b')](function(_0x350ed6){if(_0x350ed6){return _0x350ed6?{'count':_0x316512,'rows':_0x350ed6}:null;}})[_0xff03('0x2b')](respondWithResult(_0x192ea0,null))['catch'](handleError(_0x192ea0,null));};exports[_0xff03('0x54')]=function(_0x1ec31f,_0x46fd62,_0x1ec622){var _0x4093f5={};var _0x39ce9f={};var _0x89c623;var _0x4f3a4d;return db[_0xff03('0x30')]['findOne']({'where':{'id':_0x1ec31f['params']['id']}})[_0xff03('0x2b')](handleEntityNotFound(_0x46fd62,null))[_0xff03('0x2b')](function(_0x35a24b){if(_0x35a24b){_0x89c623=_0x35a24b;_0x39ce9f['model']=_[_0xff03('0x4b')](db[_0xff03('0x52')][_0xff03('0x31')]);_0x39ce9f['query']=_[_0xff03('0x4b')](_0x1ec31f[_0xff03('0x36')]);_0x39ce9f[_0xff03('0x40')]=_[_0xff03('0x37')](_0x39ce9f['model'],_0x39ce9f[_0xff03('0x36')]);_0x4093f5[_0xff03('0x38')]=_['intersection'](_0x39ce9f['model'],qs[_0xff03('0x39')](_0x1ec31f[_0xff03('0x36')][_0xff03('0x39')]));_0x4093f5['attributes']=_0x4093f5[_0xff03('0x38')]['length']?_0x4093f5['attributes']:_0x39ce9f[_0xff03('0x34')];_0x4093f5['order']=qs['sort'](_0x1ec31f[_0xff03('0x36')][_0xff03('0x3d')]);_0x4093f5[_0xff03('0x3e')]=qs[_0xff03('0x40')](_[_0xff03('0x3f')](_0x1ec31f['query'],_0x39ce9f[_0xff03('0x40')]));if(_0x1ec31f[_0xff03('0x36')]['filter']){_0x4093f5[_0xff03('0x3e')]=_[_0xff03('0x43')](_0x4093f5[_0xff03('0x3e')],{'$or':_[_0xff03('0x35')](_0x4093f5['attributes'],function(_0x11b7bf){var _0x182635={};_0x182635[_0x11b7bf]={'$like':'%'+_0x1ec31f['query'][_0xff03('0x42')]+'%'};return _0x182635;})});}_0x4093f5=_[_0xff03('0x43')]({},_0x4093f5,_0x1ec31f[_0xff03('0x44')]);return _0x89c623[_0xff03('0x54')](_0x4093f5);}})[_0xff03('0x2b')](function(_0x5231de){if(_0x5231de){_0x4f3a4d=_0x5231de[_0xff03('0x3a')];if(!_0x1ec31f[_0xff03('0x36')][_0xff03('0x3b')]('nolimit')){_0x4093f5[_0xff03('0x23')]=qs[_0xff03('0x23')](_0x1ec31f[_0xff03('0x36')][_0xff03('0x23')]);_0x4093f5[_0xff03('0x21')]=qs[_0xff03('0x21')](_0x1ec31f['query'][_0xff03('0x21')]);}return _0x89c623[_0xff03('0x54')](_0x4093f5);}})[_0xff03('0x2b')](function(_0x164d43){if(_0x164d43){return _0x164d43?{'count':_0x4f3a4d,'rows':_0x164d43}:null;}})['then'](respondWithResult(_0x46fd62,null))[_0xff03('0x48')](handleError(_0x46fd62,null));};exports[_0xff03('0x55')]=function(_0x24ae0c,_0x263f79,_0x2b9643){var _0x350c8f={};var _0xe81aca={};var _0x4623a3;var _0x47c589;return db['ServicenowConfiguration'][_0xff03('0x51')]({'where':{'id':_0x24ae0c[_0xff03('0x4a')]['id']}})['then'](handleEntityNotFound(_0x263f79,null))[_0xff03('0x2b')](function(_0x5e6c48){if(_0x5e6c48){_0x4623a3=_0x5e6c48;_0xe81aca[_0xff03('0x34')]=_[_0xff03('0x4b')](db[_0xff03('0x52')][_0xff03('0x31')]);_0xe81aca[_0xff03('0x36')]=_['keys'](_0x24ae0c[_0xff03('0x36')]);_0xe81aca[_0xff03('0x40')]=_[_0xff03('0x37')](_0xe81aca[_0xff03('0x34')],_0xe81aca[_0xff03('0x36')]);_0x350c8f[_0xff03('0x38')]=_['intersection'](_0xe81aca[_0xff03('0x34')],qs[_0xff03('0x39')](_0x24ae0c[_0xff03('0x36')][_0xff03('0x39')]));_0x350c8f['attributes']=_0x350c8f[_0xff03('0x38')]['length']?_0x350c8f[_0xff03('0x38')]:_0xe81aca[_0xff03('0x34')];_0x350c8f['order']=qs[_0xff03('0x3d')](_0x24ae0c[_0xff03('0x36')][_0xff03('0x3d')]);_0x350c8f[_0xff03('0x3e')]=qs[_0xff03('0x40')](_[_0xff03('0x3f')](_0x24ae0c[_0xff03('0x36')],_0xe81aca[_0xff03('0x40')]));if(_0x24ae0c[_0xff03('0x36')]['filter']){_0x350c8f[_0xff03('0x3e')]=_[_0xff03('0x43')](_0x350c8f[_0xff03('0x3e')],{'$or':_[_0xff03('0x35')](_0x350c8f[_0xff03('0x38')],function(_0x16166a){var _0x56cf77={};_0x56cf77[_0x16166a]={'$like':'%'+_0x24ae0c[_0xff03('0x36')]['filter']+'%'};return _0x56cf77;})});}_0x350c8f=_[_0xff03('0x43')]({},_0x350c8f,_0x24ae0c[_0xff03('0x44')]);return _0x4623a3[_0xff03('0x55')](_0x350c8f);}})[_0xff03('0x2b')](function(_0x16d4a0){if(_0x16d4a0){_0x47c589=_0x16d4a0[_0xff03('0x3a')];if(!_0x24ae0c[_0xff03('0x36')][_0xff03('0x3b')](_0xff03('0x3c'))){_0x350c8f[_0xff03('0x23')]=qs[_0xff03('0x23')](_0x24ae0c[_0xff03('0x36')][_0xff03('0x23')]);_0x350c8f[_0xff03('0x21')]=qs[_0xff03('0x21')](_0x24ae0c[_0xff03('0x36')][_0xff03('0x21')]);}return _0x4623a3[_0xff03('0x55')](_0x350c8f);}})[_0xff03('0x2b')](function(_0x5afc44){if(_0x5afc44){return _0x5afc44?{'count':_0x47c589,'rows':_0x5afc44}:null;}})[_0xff03('0x2b')](respondWithResult(_0x263f79,null))[_0xff03('0x48')](handleError(_0x263f79,null));}; \ No newline at end of file +var _0x6b81=['../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','stack','name','map','ServicenowConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x47768f,_0x305409){var _0x1a6d0e=function(_0x14f074){while(--_0x14f074){_0x47768f['push'](_0x47768f['shift']());}};_0x1a6d0e(++_0x305409);}(_0x6b81,0xce));var _0x16b8=function(_0x538bd3,_0x1e3c75){_0x538bd3=_0x538bd3-0x0;var _0x5e2fd7=_0x6b81[_0x538bd3];return _0x5e2fd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16b8('0x0'));var zipdir=require(_0x16b8('0x1'));var jsonpatch=require(_0x16b8('0x2'));var rp=require(_0x16b8('0x3'));var moment=require(_0x16b8('0x4'));var BPromise=require(_0x16b8('0x5'));var Mustache=require(_0x16b8('0x6'));var util=require(_0x16b8('0x7'));var path=require(_0x16b8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x16b8('0x9'));var fs=require('fs');var fs_extra=require(_0x16b8('0xa'));var _=require(_0x16b8('0xb'));var squel=require(_0x16b8('0xc'));var crypto=require(_0x16b8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16b8('0xe'));var querystring=require(_0x16b8('0xf'));var Papa=require(_0x16b8('0x10'));var Redis=require(_0x16b8('0x11'));var authService=require(_0x16b8('0x12'));var qs=require(_0x16b8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x16b8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x16b8('0x15'))['db'];function respondWithStatusCode(_0x28b52f,_0x3ae3f7){_0x3ae3f7=_0x3ae3f7||0xcc;return function(_0x4eba32){if(_0x4eba32){return _0x28b52f[_0x16b8('0x16')](_0x3ae3f7);}return _0x28b52f[_0x16b8('0x17')](_0x3ae3f7)[_0x16b8('0x18')]();};}function respondWithResult(_0x175b87,_0x27b364){_0x27b364=_0x27b364||0xc8;return function(_0x404203){if(_0x404203){return _0x175b87[_0x16b8('0x17')](_0x27b364)[_0x16b8('0x19')](_0x404203);}};}function respondWithFilteredResult(_0x5834f9,_0x22219f){return function(_0x44740b){if(_0x44740b){var _0x50d168=typeof _0x22219f[_0x16b8('0x1a')]==='undefined'&&typeof _0x22219f[_0x16b8('0x1b')]===_0x16b8('0x1c');var _0x37e26d=_0x44740b[_0x16b8('0x1d')];var _0x59bdc5=_0x50d168?0x0:_0x22219f['offset'];var _0x570ece=_0x50d168?_0x44740b['count']:_0x22219f[_0x16b8('0x1a')]+_0x22219f['limit'];var _0x592354;if(_0x570ece>=_0x37e26d){_0x570ece=_0x37e26d;_0x592354=0xc8;}else{_0x592354=0xce;}_0x5834f9[_0x16b8('0x17')](_0x592354);return _0x5834f9['set'](_0x16b8('0x1e'),_0x59bdc5+'-'+_0x570ece+'/'+_0x37e26d)[_0x16b8('0x19')](_0x44740b);}return null;};}function patchUpdates(_0x2f1552){return function(_0xfc1ba4){try{jsonpatch[_0x16b8('0x1f')](_0xfc1ba4,_0x2f1552,!![]);}catch(_0x3aac95){return BPromise['reject'](_0x3aac95);}return _0xfc1ba4[_0x16b8('0x20')]();};}function saveUpdates(_0x27bbe1,_0x15e758){return function(_0x810ce7){if(_0x810ce7){return _0x810ce7['update'](_0x27bbe1)[_0x16b8('0x21')](function(_0xd9927d){return _0xd9927d;});}return null;};}function removeEntity(_0x2da8fb,_0x54b3ee){return function(_0x9851f){if(_0x9851f){return _0x9851f[_0x16b8('0x22')]()[_0x16b8('0x21')](function(){_0x2da8fb[_0x16b8('0x17')](0xcc)[_0x16b8('0x18')]();});}};}function handleEntityNotFound(_0x48a78e,_0x37a59f){return function(_0x5b364c){if(!_0x5b364c){_0x48a78e[_0x16b8('0x16')](0x194);}return _0x5b364c;};}function handleError(_0x103e45,_0x11cea8){_0x11cea8=_0x11cea8||0x1f4;return function(_0x2e8787){logger['error'](_0x2e8787[_0x16b8('0x23')]);if(_0x2e8787[_0x16b8('0x24')]){delete _0x2e8787[_0x16b8('0x24')];}_0x103e45['status'](_0x11cea8)['send'](_0x2e8787);};}exports['index']=function(_0x722680,_0x47d040){var _0x3e190f={},_0x2646b6={},_0x255a77={'count':0x0,'rows':[]};var _0x24d0af=_[_0x16b8('0x25')](db[_0x16b8('0x26')][_0x16b8('0x27')],function(_0x2a6fa1){return{'name':_0x2a6fa1['fieldName'],'type':_0x2a6fa1[_0x16b8('0x28')][_0x16b8('0x29')]};});_0x2646b6['model']=_[_0x16b8('0x25')](_0x24d0af,'name');_0x2646b6[_0x16b8('0x2a')]=_[_0x16b8('0x2b')](_0x722680[_0x16b8('0x2a')]);_0x2646b6[_0x16b8('0x2c')]=_[_0x16b8('0x2d')](_0x2646b6[_0x16b8('0x2e')],_0x2646b6[_0x16b8('0x2a')]);_0x3e190f[_0x16b8('0x2f')]=_[_0x16b8('0x2d')](_0x2646b6['model'],qs[_0x16b8('0x30')](_0x722680['query']['fields']));_0x3e190f[_0x16b8('0x2f')]=_0x3e190f[_0x16b8('0x2f')]['length']?_0x3e190f[_0x16b8('0x2f')]:_0x2646b6[_0x16b8('0x2e')];if(!_0x722680['query'][_0x16b8('0x31')](_0x16b8('0x32'))){_0x3e190f[_0x16b8('0x1b')]=qs[_0x16b8('0x1b')](_0x722680[_0x16b8('0x2a')][_0x16b8('0x1b')]);_0x3e190f['offset']=qs[_0x16b8('0x1a')](_0x722680['query'][_0x16b8('0x1a')]);}_0x3e190f[_0x16b8('0x33')]=qs['sort'](_0x722680['query'][_0x16b8('0x34')]);_0x3e190f['where']=qs[_0x16b8('0x2c')](_[_0x16b8('0x35')](_0x722680[_0x16b8('0x2a')],_0x2646b6[_0x16b8('0x2c')]),_0x24d0af);if(_0x722680[_0x16b8('0x2a')][_0x16b8('0x36')]){_0x3e190f[_0x16b8('0x37')]=_[_0x16b8('0x38')](_0x3e190f[_0x16b8('0x37')],{'$or':_[_0x16b8('0x25')](_0x24d0af,function(_0xd87a25){if(_0xd87a25['type']!==_0x16b8('0x39')){var _0x6815a2={};_0x6815a2[_0xd87a25[_0x16b8('0x24')]]={'$like':'%'+_0x722680[_0x16b8('0x2a')][_0x16b8('0x36')]+'%'};return _0x6815a2;}})});}_0x3e190f=_[_0x16b8('0x38')]({},_0x3e190f,_0x722680[_0x16b8('0x3a')]);var _0x12db82={'where':_0x3e190f[_0x16b8('0x37')]};return db[_0x16b8('0x26')]['count'](_0x12db82)[_0x16b8('0x21')](function(_0x2ab471){_0x255a77[_0x16b8('0x1d')]=_0x2ab471;if(_0x722680['query'][_0x16b8('0x3b')]){_0x3e190f['include']=[{'all':!![]}];}return db[_0x16b8('0x26')][_0x16b8('0x3c')](_0x3e190f);})['then'](function(_0x4e99a6){_0x255a77[_0x16b8('0x3d')]=_0x4e99a6;return _0x255a77;})[_0x16b8('0x21')](respondWithFilteredResult(_0x47d040,_0x3e190f))[_0x16b8('0x3e')](handleError(_0x47d040,null));};exports[_0x16b8('0x3f')]=function(_0x52f5e5,_0x4507f6){var _0x2dbd9d={'raw':![],'where':{'id':_0x52f5e5['params']['id']}},_0x43f250={};_0x43f250[_0x16b8('0x2e')]=_[_0x16b8('0x2b')](db[_0x16b8('0x26')]['rawAttributes']);_0x43f250['query']=_[_0x16b8('0x2b')](_0x52f5e5[_0x16b8('0x2a')]);_0x43f250[_0x16b8('0x2c')]=_[_0x16b8('0x2d')](_0x43f250[_0x16b8('0x2e')],_0x43f250[_0x16b8('0x2a')]);_0x2dbd9d[_0x16b8('0x2f')]=_[_0x16b8('0x2d')](_0x43f250[_0x16b8('0x2e')],qs[_0x16b8('0x30')](_0x52f5e5[_0x16b8('0x2a')][_0x16b8('0x30')]));_0x2dbd9d['attributes']=_0x2dbd9d[_0x16b8('0x2f')][_0x16b8('0x40')]?_0x2dbd9d[_0x16b8('0x2f')]:_0x43f250[_0x16b8('0x2e')];if(_0x52f5e5[_0x16b8('0x2a')][_0x16b8('0x3b')]){_0x2dbd9d[_0x16b8('0x41')]=[{'all':!![]}];}_0x2dbd9d=_[_0x16b8('0x38')]({},_0x2dbd9d,_0x52f5e5[_0x16b8('0x3a')]);return db[_0x16b8('0x26')][_0x16b8('0x42')](_0x2dbd9d)['then'](handleEntityNotFound(_0x4507f6,null))[_0x16b8('0x21')](respondWithResult(_0x4507f6,null))[_0x16b8('0x3e')](handleError(_0x4507f6,null));};exports['create']=function(_0x3e4138,_0x376ede){return db[_0x16b8('0x26')][_0x16b8('0x43')](_0x3e4138[_0x16b8('0x44')],{})[_0x16b8('0x21')](respondWithResult(_0x376ede,0xc9))[_0x16b8('0x3e')](handleError(_0x376ede,null));};exports['update']=function(_0x2f527e,_0x1bb91b){if(_0x2f527e['body']['id']){delete _0x2f527e[_0x16b8('0x44')]['id'];}return db[_0x16b8('0x26')][_0x16b8('0x42')]({'where':{'id':_0x2f527e[_0x16b8('0x45')]['id']}})[_0x16b8('0x21')](handleEntityNotFound(_0x1bb91b,null))[_0x16b8('0x21')](saveUpdates(_0x2f527e[_0x16b8('0x44')],null))['then'](respondWithResult(_0x1bb91b,null))['catch'](handleError(_0x1bb91b,null));};exports[_0x16b8('0x22')]=function(_0x37cdb3,_0x2b6d02){return db[_0x16b8('0x26')][_0x16b8('0x42')]({'where':{'id':_0x37cdb3[_0x16b8('0x45')]['id']}})[_0x16b8('0x21')](handleEntityNotFound(_0x2b6d02,null))[_0x16b8('0x21')](removeEntity(_0x2b6d02,null))['catch'](handleError(_0x2b6d02,null));};exports[_0x16b8('0x46')]=function(_0x2b079e,_0x56656d,_0x53f777){var _0x216768={};var _0x40442e={};var _0x55a3b2;var _0x43be0d;return db[_0x16b8('0x26')][_0x16b8('0x47')]({'where':{'id':_0x2b079e[_0x16b8('0x45')]['id']}})[_0x16b8('0x21')](handleEntityNotFound(_0x56656d,null))[_0x16b8('0x21')](function(_0x1132be){if(_0x1132be){_0x55a3b2=_0x1132be;_0x40442e['model']=_[_0x16b8('0x2b')](db[_0x16b8('0x48')][_0x16b8('0x27')]);_0x40442e[_0x16b8('0x2a')]=_[_0x16b8('0x2b')](_0x2b079e[_0x16b8('0x2a')]);_0x40442e[_0x16b8('0x2c')]=_[_0x16b8('0x2d')](_0x40442e['model'],_0x40442e[_0x16b8('0x2a')]);_0x216768[_0x16b8('0x2f')]=_['intersection'](_0x40442e['model'],qs['fields'](_0x2b079e['query']['fields']));_0x216768[_0x16b8('0x2f')]=_0x216768['attributes'][_0x16b8('0x40')]?_0x216768['attributes']:_0x40442e[_0x16b8('0x2e')];_0x216768[_0x16b8('0x33')]=qs['sort'](_0x2b079e[_0x16b8('0x2a')][_0x16b8('0x34')]);_0x216768[_0x16b8('0x37')]=qs[_0x16b8('0x2c')](_[_0x16b8('0x35')](_0x2b079e[_0x16b8('0x2a')],_0x40442e[_0x16b8('0x2c')]));if(_0x2b079e[_0x16b8('0x2a')][_0x16b8('0x36')]){_0x216768[_0x16b8('0x37')]=_[_0x16b8('0x38')](_0x216768['where'],{'$or':_[_0x16b8('0x25')](_0x216768[_0x16b8('0x2f')],function(_0x5ac4c5){var _0x1f0589={};_0x1f0589[_0x5ac4c5]={'$like':'%'+_0x2b079e[_0x16b8('0x2a')][_0x16b8('0x36')]+'%'};return _0x1f0589;})});}_0x216768=_[_0x16b8('0x38')]({},_0x216768,_0x2b079e[_0x16b8('0x3a')]);return _0x55a3b2[_0x16b8('0x46')](_0x216768);}})['then'](function(_0x1eb85b){if(_0x1eb85b){_0x43be0d=_0x1eb85b[_0x16b8('0x40')];if(!_0x2b079e[_0x16b8('0x2a')][_0x16b8('0x31')]('nolimit')){_0x216768[_0x16b8('0x1b')]=qs[_0x16b8('0x1b')](_0x2b079e[_0x16b8('0x2a')][_0x16b8('0x1b')]);_0x216768['offset']=qs[_0x16b8('0x1a')](_0x2b079e[_0x16b8('0x2a')][_0x16b8('0x1a')]);}return _0x55a3b2['getFields'](_0x216768);}})[_0x16b8('0x21')](function(_0xed4459){if(_0xed4459){return _0xed4459?{'count':_0x43be0d,'rows':_0xed4459}:null;}})[_0x16b8('0x21')](respondWithResult(_0x56656d,null))[_0x16b8('0x3e')](handleError(_0x56656d,null));};exports['getSubjects']=function(_0x28717b,_0x1b924c,_0x83e896){var _0x48abeb={};var _0x30ff63={};var _0x5bbb1c;var _0x3302ea;return db[_0x16b8('0x26')][_0x16b8('0x47')]({'where':{'id':_0x28717b[_0x16b8('0x45')]['id']}})[_0x16b8('0x21')](handleEntityNotFound(_0x1b924c,null))[_0x16b8('0x21')](function(_0x4019f6){if(_0x4019f6){_0x5bbb1c=_0x4019f6;_0x30ff63['model']=_[_0x16b8('0x2b')](db[_0x16b8('0x48')][_0x16b8('0x27')]);_0x30ff63[_0x16b8('0x2a')]=_[_0x16b8('0x2b')](_0x28717b['query']);_0x30ff63[_0x16b8('0x2c')]=_['intersection'](_0x30ff63[_0x16b8('0x2e')],_0x30ff63['query']);_0x48abeb[_0x16b8('0x2f')]=_[_0x16b8('0x2d')](_0x30ff63['model'],qs['fields'](_0x28717b['query'][_0x16b8('0x30')]));_0x48abeb[_0x16b8('0x2f')]=_0x48abeb[_0x16b8('0x2f')][_0x16b8('0x40')]?_0x48abeb[_0x16b8('0x2f')]:_0x30ff63['model'];_0x48abeb[_0x16b8('0x33')]=qs[_0x16b8('0x34')](_0x28717b[_0x16b8('0x2a')]['sort']);_0x48abeb['where']=qs['filters'](_[_0x16b8('0x35')](_0x28717b[_0x16b8('0x2a')],_0x30ff63['filters']));if(_0x28717b[_0x16b8('0x2a')][_0x16b8('0x36')]){_0x48abeb[_0x16b8('0x37')]=_[_0x16b8('0x38')](_0x48abeb[_0x16b8('0x37')],{'$or':_[_0x16b8('0x25')](_0x48abeb[_0x16b8('0x2f')],function(_0x3fee7b){var _0x4cddf7={};_0x4cddf7[_0x3fee7b]={'$like':'%'+_0x28717b[_0x16b8('0x2a')][_0x16b8('0x36')]+'%'};return _0x4cddf7;})});}_0x48abeb=_['merge']({},_0x48abeb,_0x28717b[_0x16b8('0x3a')]);return _0x5bbb1c[_0x16b8('0x49')](_0x48abeb);}})[_0x16b8('0x21')](function(_0x5c6a44){if(_0x5c6a44){_0x3302ea=_0x5c6a44['length'];if(!_0x28717b[_0x16b8('0x2a')]['hasOwnProperty'](_0x16b8('0x32'))){_0x48abeb[_0x16b8('0x1b')]=qs[_0x16b8('0x1b')](_0x28717b[_0x16b8('0x2a')][_0x16b8('0x1b')]);_0x48abeb['offset']=qs['offset'](_0x28717b[_0x16b8('0x2a')][_0x16b8('0x1a')]);}return _0x5bbb1c['getSubjects'](_0x48abeb);}})['then'](function(_0x591444){if(_0x591444){return _0x591444?{'count':_0x3302ea,'rows':_0x591444}:null;}})[_0x16b8('0x21')](respondWithResult(_0x1b924c,null))[_0x16b8('0x3e')](handleError(_0x1b924c,null));};exports['getDescriptions']=function(_0x1cdf4b,_0x48b65d,_0x125e0d){var _0x109886={};var _0x62a3de={};var _0x24ce5f;var _0x48a27f;return db[_0x16b8('0x26')][_0x16b8('0x47')]({'where':{'id':_0x1cdf4b[_0x16b8('0x45')]['id']}})['then'](handleEntityNotFound(_0x48b65d,null))[_0x16b8('0x21')](function(_0x2c05c9){if(_0x2c05c9){_0x24ce5f=_0x2c05c9;_0x62a3de[_0x16b8('0x2e')]=_['keys'](db[_0x16b8('0x48')][_0x16b8('0x27')]);_0x62a3de[_0x16b8('0x2a')]=_['keys'](_0x1cdf4b[_0x16b8('0x2a')]);_0x62a3de[_0x16b8('0x2c')]=_[_0x16b8('0x2d')](_0x62a3de['model'],_0x62a3de[_0x16b8('0x2a')]);_0x109886['attributes']=_[_0x16b8('0x2d')](_0x62a3de['model'],qs[_0x16b8('0x30')](_0x1cdf4b[_0x16b8('0x2a')][_0x16b8('0x30')]));_0x109886[_0x16b8('0x2f')]=_0x109886[_0x16b8('0x2f')][_0x16b8('0x40')]?_0x109886['attributes']:_0x62a3de[_0x16b8('0x2e')];_0x109886[_0x16b8('0x33')]=qs[_0x16b8('0x34')](_0x1cdf4b['query'][_0x16b8('0x34')]);_0x109886[_0x16b8('0x37')]=qs['filters'](_[_0x16b8('0x35')](_0x1cdf4b[_0x16b8('0x2a')],_0x62a3de[_0x16b8('0x2c')]));if(_0x1cdf4b[_0x16b8('0x2a')][_0x16b8('0x36')]){_0x109886[_0x16b8('0x37')]=_[_0x16b8('0x38')](_0x109886['where'],{'$or':_[_0x16b8('0x25')](_0x109886[_0x16b8('0x2f')],function(_0x22d7d2){var _0x309375={};_0x309375[_0x22d7d2]={'$like':'%'+_0x1cdf4b[_0x16b8('0x2a')]['filter']+'%'};return _0x309375;})});}_0x109886=_[_0x16b8('0x38')]({},_0x109886,_0x1cdf4b[_0x16b8('0x3a')]);return _0x24ce5f[_0x16b8('0x4a')](_0x109886);}})['then'](function(_0x10b2a3){if(_0x10b2a3){_0x48a27f=_0x10b2a3[_0x16b8('0x40')];if(!_0x1cdf4b[_0x16b8('0x2a')]['hasOwnProperty'](_0x16b8('0x32'))){_0x109886[_0x16b8('0x1b')]=qs[_0x16b8('0x1b')](_0x1cdf4b[_0x16b8('0x2a')][_0x16b8('0x1b')]);_0x109886['offset']=qs['offset'](_0x1cdf4b['query']['offset']);}return _0x24ce5f[_0x16b8('0x4a')](_0x109886);}})[_0x16b8('0x21')](function(_0x58aad8){if(_0x58aad8){return _0x58aad8?{'count':_0x48a27f,'rows':_0x58aad8}:null;}})[_0x16b8('0x21')](respondWithResult(_0x48b65d,null))[_0x16b8('0x3e')](handleError(_0x48b65d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index fb658b1..8505f7d 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 _0x66d3=['int_servicenow_configurations','lodash','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','ServicenowConfiguration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x66d3,0x10f));var _0x366d=function(_0x17f6af,_0x1ec524){_0x17f6af=_0x17f6af-0x0;var _0x1fe205=_0x66d3[_0x17f6af];return _0x1fe205;};'use strict';var _=require(_0x366d('0x0'));var util=require('util');var logger=require(_0x366d('0x1'))('api');var moment=require(_0x366d('0x2'));var BPromise=require(_0x366d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x366d('0x4'));var rimraf=require('rimraf');var config=require(_0x366d('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x366d('0x6')]=function(_0x7c355e,_0x316f53){return _0x7c355e[_0x366d('0x7')](_0x366d('0x8'),attributes,{'tableName':_0x366d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2547=['rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x104acc,_0x37fdb8){var _0x5ce747=function(_0xe3eb99){while(--_0xe3eb99){_0x104acc['push'](_0x104acc['shift']());}};_0x5ce747(++_0x37fdb8);}(_0x2547,0x1cd));var _0x7254=function(_0x2743a8,_0x3f5bba){_0x2743a8=_0x2743a8-0x0;var _0x48ec91=_0x2547[_0x2743a8];return _0x48ec91;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 6083834..5bff9fa 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 _0xb955=['../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x38733d,_0x430e97){var _0x20ad2b=function(_0x3c6522){while(--_0x3c6522){_0x38733d['push'](_0x38733d['shift']());}};_0x20ad2b(++_0x430e97);}(_0xb955,0x123));var _0x5b95=function(_0x4d9094,_0x1df51b){_0x4d9094=_0x4d9094-0x0;var _0x282e9c=_0xb955[_0x4d9094];return _0x282e9c;};'use strict';var _=require(_0x5b95('0x0'));var util=require(_0x5b95('0x1'));var moment=require(_0x5b95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b95('0x3'));var db=require(_0x5b95('0x4'))['db'];var utils=require(_0x5b95('0x5'));var logger=require(_0x5b95('0x6'))(_0x5b95('0x7'));var config=require(_0x5b95('0x8'));var jayson=require(_0x5b95('0x9'));var client=jayson[_0x5b95('0xa')][_0x5b95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392ee2,_0x4eb97a,_0xf02d99){return new BPromise(function(_0x23ee42,_0x4b0744){return client['request'](_0x392ee2,_0xf02d99)[_0x5b95('0xc')](function(_0x2bca40){logger[_0x5b95('0xd')](_0x5b95('0xe'),_0x4eb97a,_0x5b95('0xf'));logger[_0x5b95('0x10')](_0x5b95('0x11'),_0x4eb97a,'request\x20sent',JSON[_0x5b95('0x12')](_0x2bca40));if(_0x2bca40['error']){if(_0x2bca40[_0x5b95('0x13')][_0x5b95('0x14')]===0x1f4){logger[_0x5b95('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4eb97a,_0x2bca40[_0x5b95('0x13')][_0x5b95('0x15')]);return _0x4b0744(_0x2bca40[_0x5b95('0x13')]['message']);}logger[_0x5b95('0x13')](_0x5b95('0xe'),_0x4eb97a,_0x2bca40[_0x5b95('0x13')]['message']);return _0x23ee42(_0x2bca40[_0x5b95('0x13')][_0x5b95('0x15')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4eb97a,_0x5b95('0xf'));_0x23ee42(_0x2bca40['result'][_0x5b95('0x15')]);}})[_0x5b95('0x16')](function(_0x79abc5){logger[_0x5b95('0x13')](_0x5b95('0xe'),_0x4eb97a,_0x79abc5);_0x4b0744(_0x79abc5);});});} \ No newline at end of file +var _0xd409=['../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x49efc8,_0x2497a5){var _0x2b3b84=function(_0x382372){while(--_0x382372){_0x49efc8['push'](_0x49efc8['shift']());}};_0x2b3b84(++_0x2497a5);}(_0xd409,0x15f));var _0x9d40=function(_0x1c3429,_0x11d159){_0x1c3429=_0x1c3429-0x0;var _0x1609bd=_0xd409[_0x1c3429];return _0x1609bd;};'use strict';var _=require('lodash');var util=require(_0x9d40('0x0'));var moment=require(_0x9d40('0x1'));var BPromise=require(_0x9d40('0x2'));var rs=require(_0x9d40('0x3'));var fs=require('fs');var Redis=require(_0x9d40('0x4'));var db=require(_0x9d40('0x5'))['db'];var utils=require(_0x9d40('0x6'));var logger=require('../../config/logger')(_0x9d40('0x7'));var config=require('../../config/environment');var jayson=require(_0x9d40('0x8'));var client=jayson[_0x9d40('0x9')][_0x9d40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2298a1,_0x46e88,_0x23a53a){return new BPromise(function(_0x59b2a6,_0x10f982){return client[_0x9d40('0xb')](_0x2298a1,_0x23a53a)['then'](function(_0x4ff949){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x46e88,_0x9d40('0xc'));logger['debug'](_0x9d40('0xd'),_0x46e88,_0x9d40('0xc'),JSON[_0x9d40('0xe')](_0x4ff949));if(_0x4ff949[_0x9d40('0xf')]){if(_0x4ff949[_0x9d40('0xf')][_0x9d40('0x10')]===0x1f4){logger[_0x9d40('0xf')](_0x9d40('0x11'),_0x46e88,_0x4ff949[_0x9d40('0xf')][_0x9d40('0x12')]);return _0x10f982(_0x4ff949[_0x9d40('0xf')][_0x9d40('0x12')]);}logger[_0x9d40('0xf')](_0x9d40('0x11'),_0x46e88,_0x4ff949[_0x9d40('0xf')][_0x9d40('0x12')]);return _0x59b2a6(_0x4ff949['error'][_0x9d40('0x12')]);}else{logger[_0x9d40('0x13')](_0x9d40('0x11'),_0x46e88,_0x9d40('0xc'));_0x59b2a6(_0x4ff949['result']['message']);}})[_0x9d40('0x14')](function(_0x34822f){logger[_0x9d40('0xf')](_0x9d40('0x11'),_0x46e88,_0x34822f);_0x10f982(_0x34822f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 494669c..964bc5d 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 _0x1fe7=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x4f5b51,_0x49ce72){var _0x4b6817=function(_0x139199){while(--_0x139199){_0x4f5b51['push'](_0x4f5b51['shift']());}};_0x4b6817(++_0x49ce72);}(_0x1fe7,0xeb));var _0x71fe=function(_0x3bb186,_0x120dbb){_0x3bb186=_0x3bb186-0x0;var _0x40af4d=_0x1fe7[_0x3bb186];return _0x40af4d;};'use strict';var multer=require(_0x71fe('0x0'));var util=require(_0x71fe('0x1'));var path=require(_0x71fe('0x2'));var timeout=require(_0x71fe('0x3'));var express=require(_0x71fe('0x4'));var router=express['Router']();var fs_extra=require(_0x71fe('0x5'));var auth=require(_0x71fe('0x6'));var interaction=require(_0x71fe('0x7'));var config=require(_0x71fe('0x8'));var controller=require('./intServicenowField.controller');router[_0x71fe('0x9')]('/',auth[_0x71fe('0xa')](),controller[_0x71fe('0xb')]);router[_0x71fe('0x9')](_0x71fe('0xc'),auth[_0x71fe('0xa')](),controller['show']);router[_0x71fe('0xd')]('/',auth[_0x71fe('0xa')](),controller[_0x71fe('0xe')]);router[_0x71fe('0xf')](_0x71fe('0xc'),auth['isAuthenticated'](),controller[_0x71fe('0x10')]);router['delete'](_0x71fe('0xc'),auth[_0x71fe('0xa')](),controller[_0x71fe('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6728=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6728,0x90));var _0x8672=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x6728[_0x149083];return _0x4dc74e;};'use strict';var multer=require(_0x8672('0x0'));var util=require(_0x8672('0x1'));var path=require(_0x8672('0x2'));var timeout=require('connect-timeout');var express=require(_0x8672('0x3'));var router=express[_0x8672('0x4')]();var fs_extra=require(_0x8672('0x5'));var auth=require(_0x8672('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8672('0x7'));var controller=require(_0x8672('0x8'));router[_0x8672('0x9')]('/',auth[_0x8672('0xa')](),controller[_0x8672('0xb')]);router[_0x8672('0x9')](_0x8672('0xc'),auth['isAuthenticated'](),controller[_0x8672('0xd')]);router['post']('/',auth[_0x8672('0xa')](),controller[_0x8672('0xe')]);router[_0x8672('0xf')](_0x8672('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8672('0x10')](_0x8672('0xc'),auth[_0x8672('0xa')](),controller[_0x8672('0x11')]);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 7855d98..923c425 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 _0xdecc=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2a038e,_0x52b6f0){var _0x24cb88=function(_0x2bb034){while(--_0x2bb034){_0x2a038e['push'](_0x2a038e['shift']());}};_0x24cb88(++_0x52b6f0);}(_0xdecc,0x1b2));var _0xcdec=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0xdecc[_0x52bfa5];return _0x26f80b;};'use strict';var Sequelize=require(_0xcdec('0x0'));module['exports']={'type':{'type':Sequelize[_0xcdec('0x1')](_0xcdec('0x2'),_0xcdec('0x3'),_0xcdec('0x4'),_0xcdec('0x5'),_0xcdec('0x6')),'defaultValue':_0xcdec('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcdec('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xcdec('0x2'),_0xcdec('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xcdec('0x7')]},'idField':{'type':Sequelize[_0xcdec('0x7')]},'nameField':{'type':Sequelize[_0xcdec('0x7')]},'customField':{'type':Sequelize[_0xcdec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcdec('0x7')]}}; \ No newline at end of file +var _0x29e8=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x21e0f5,_0xaf95dd){var _0x2b49ae=function(_0x17590c){while(--_0x17590c){_0x21e0f5['push'](_0x21e0f5['shift']());}};_0x2b49ae(++_0xaf95dd);}(_0x29e8,0x160));var _0x829e=function(_0x459e94,_0x44c7b3){_0x459e94=_0x459e94-0x0;var _0x723904=_0x29e8[_0x459e94];return _0x723904;};'use strict';var Sequelize=require('sequelize');module[_0x829e('0x0')]={'type':{'type':Sequelize[_0x829e('0x1')](_0x829e('0x2'),_0x829e('0x3'),_0x829e('0x4'),_0x829e('0x5'),_0x829e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x829e('0x7')]},'key':{'type':Sequelize[_0x829e('0x7')]},'keyType':{'type':Sequelize[_0x829e('0x1')]('string',_0x829e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x829e('0x7')]},'idField':{'type':Sequelize[_0x829e('0x7')]},'nameField':{'type':Sequelize[_0x829e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'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 a30d54d..4d3ab74 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 _0xf6bd=['json','undefined','limit','count','offset','set','reject','save','then','stack','name','send','index','map','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','ServicenowField','includeAll','include','params','rawAttributes','options','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status'];(function(_0x422db0,_0x33be5b){var _0x355e09=function(_0x2b00a4){while(--_0x2b00a4){_0x422db0['push'](_0x422db0['shift']());}};_0x355e09(++_0x33be5b);}(_0xf6bd,0x71));var _0xdf6b=function(_0x51bc84,_0x519320){_0x51bc84=_0x51bc84-0x0;var _0x3a953e=_0xf6bd[_0x51bc84];return _0x3a953e;};'use strict';var emlformat=require(_0xdf6b('0x0'));var rimraf=require(_0xdf6b('0x1'));var zipdir=require(_0xdf6b('0x2'));var jsonpatch=require(_0xdf6b('0x3'));var rp=require(_0xdf6b('0x4'));var moment=require('moment');var BPromise=require(_0xdf6b('0x5'));var Mustache=require(_0xdf6b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xdf6b('0x7'));var csv=require('to-csv');var ejs=require(_0xdf6b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf6b('0x9'));var squel=require(_0xdf6b('0xa'));var crypto=require('crypto');var jsforce=require(_0xdf6b('0xb'));var deskjs=require(_0xdf6b('0xc'));var toCsv=require(_0xdf6b('0xd'));var querystring=require(_0xdf6b('0xe'));var Papa=require(_0xdf6b('0xf'));var Redis=require('ioredis');var authService=require(_0xdf6b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdf6b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf6b('0x12'))('api');var utils=require(_0xdf6b('0x13'));var config=require(_0xdf6b('0x14'));var licenseUtil=require(_0xdf6b('0x15'));var db=require(_0xdf6b('0x16'))['db'];function respondWithStatusCode(_0x3f3764,_0x8dc552){_0x8dc552=_0x8dc552||0xcc;return function(_0x552f9d){if(_0x552f9d){return _0x3f3764['sendStatus'](_0x8dc552);}return _0x3f3764['status'](_0x8dc552)[_0xdf6b('0x17')]();};}function respondWithResult(_0x20fb71,_0x571485){_0x571485=_0x571485||0xc8;return function(_0x687cee){if(_0x687cee){return _0x20fb71[_0xdf6b('0x18')](_0x571485)[_0xdf6b('0x19')](_0x687cee);}};}function respondWithFilteredResult(_0x358fe9,_0x1486ab){return function(_0xb14235){if(_0xb14235){var _0x5eb084=typeof _0x1486ab['offset']===_0xdf6b('0x1a')&&typeof _0x1486ab[_0xdf6b('0x1b')]===_0xdf6b('0x1a');var _0x48e638=_0xb14235[_0xdf6b('0x1c')];var _0x1a19f2=_0x5eb084?0x0:_0x1486ab[_0xdf6b('0x1d')];var _0x48e387=_0x5eb084?_0xb14235[_0xdf6b('0x1c')]:_0x1486ab['offset']+_0x1486ab[_0xdf6b('0x1b')];var _0x517a5b;if(_0x48e387>=_0x48e638){_0x48e387=_0x48e638;_0x517a5b=0xc8;}else{_0x517a5b=0xce;}_0x358fe9['status'](_0x517a5b);return _0x358fe9[_0xdf6b('0x1e')]('Content-Range',_0x1a19f2+'-'+_0x48e387+'/'+_0x48e638)['json'](_0xb14235);}return null;};}function patchUpdates(_0x1c0b09){return function(_0x5a97cf){try{jsonpatch['apply'](_0x5a97cf,_0x1c0b09,!![]);}catch(_0x433a4c){return BPromise[_0xdf6b('0x1f')](_0x433a4c);}return _0x5a97cf[_0xdf6b('0x20')]();};}function saveUpdates(_0x2b82b2,_0x1bb3fc){return function(_0x8da316){if(_0x8da316){return _0x8da316['update'](_0x2b82b2)['then'](function(_0x5ca7e4){return _0x5ca7e4;});}return null;};}function removeEntity(_0x156862,_0x2721da){return function(_0x208cc1){if(_0x208cc1){return _0x208cc1['destroy']()[_0xdf6b('0x21')](function(){_0x156862['status'](0xcc)[_0xdf6b('0x17')]();});}};}function handleEntityNotFound(_0x3e5d17,_0x4aed39){return function(_0x84612b){if(!_0x84612b){_0x3e5d17['sendStatus'](0x194);}return _0x84612b;};}function handleError(_0x3ccdba,_0xfb05fc){_0xfb05fc=_0xfb05fc||0x1f4;return function(_0x77e60b){logger['error'](_0x77e60b[_0xdf6b('0x22')]);if(_0x77e60b[_0xdf6b('0x23')]){delete _0x77e60b[_0xdf6b('0x23')];}_0x3ccdba[_0xdf6b('0x18')](_0xfb05fc)[_0xdf6b('0x24')](_0x77e60b);};}exports[_0xdf6b('0x25')]=function(_0x35228d,_0x4e9e7c){var _0x281383={},_0x49f202={},_0x57f5cc={'count':0x0,'rows':[]};var _0x335124=_[_0xdf6b('0x26')](db['ServicenowField']['rawAttributes'],function(_0x2ea9a4){return{'name':_0x2ea9a4['fieldName'],'type':_0x2ea9a4['type'][_0xdf6b('0x27')]};});_0x49f202[_0xdf6b('0x28')]=_[_0xdf6b('0x26')](_0x335124,_0xdf6b('0x23'));_0x49f202[_0xdf6b('0x29')]=_[_0xdf6b('0x2a')](_0x35228d[_0xdf6b('0x29')]);_0x49f202[_0xdf6b('0x2b')]=_['intersection'](_0x49f202[_0xdf6b('0x28')],_0x49f202[_0xdf6b('0x29')]);_0x281383[_0xdf6b('0x2c')]=_[_0xdf6b('0x2d')](_0x49f202[_0xdf6b('0x28')],qs[_0xdf6b('0x2e')](_0x35228d['query'][_0xdf6b('0x2e')]));_0x281383['attributes']=_0x281383[_0xdf6b('0x2c')][_0xdf6b('0x2f')]?_0x281383[_0xdf6b('0x2c')]:_0x49f202['model'];if(!_0x35228d[_0xdf6b('0x29')][_0xdf6b('0x30')](_0xdf6b('0x31'))){_0x281383['limit']=qs['limit'](_0x35228d[_0xdf6b('0x29')][_0xdf6b('0x1b')]);_0x281383[_0xdf6b('0x1d')]=qs[_0xdf6b('0x1d')](_0x35228d[_0xdf6b('0x29')]['offset']);}_0x281383[_0xdf6b('0x32')]=qs[_0xdf6b('0x33')](_0x35228d['query'][_0xdf6b('0x33')]);_0x281383[_0xdf6b('0x34')]=qs[_0xdf6b('0x2b')](_['pick'](_0x35228d['query'],_0x49f202[_0xdf6b('0x2b')]),_0x335124);if(_0x35228d['query'][_0xdf6b('0x35')]){_0x281383['where']=_['merge'](_0x281383[_0xdf6b('0x34')],{'$or':_[_0xdf6b('0x26')](_0x335124,function(_0x514d8d){if(_0x514d8d[_0xdf6b('0x36')]!==_0xdf6b('0x37')){var _0x4cb4fc={};_0x4cb4fc[_0x514d8d['name']]={'$like':'%'+_0x35228d[_0xdf6b('0x29')][_0xdf6b('0x35')]+'%'};return _0x4cb4fc;}})});}_0x281383=_[_0xdf6b('0x38')]({},_0x281383,_0x35228d['options']);var _0xb2772e={'where':_0x281383[_0xdf6b('0x34')]};return db[_0xdf6b('0x39')][_0xdf6b('0x1c')](_0xb2772e)['then'](function(_0x4381ec){_0x57f5cc[_0xdf6b('0x1c')]=_0x4381ec;if(_0x35228d[_0xdf6b('0x29')][_0xdf6b('0x3a')]){_0x281383[_0xdf6b('0x3b')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x281383);})[_0xdf6b('0x21')](function(_0x49e451){_0x57f5cc['rows']=_0x49e451;return _0x57f5cc;})[_0xdf6b('0x21')](respondWithFilteredResult(_0x4e9e7c,_0x281383))['catch'](handleError(_0x4e9e7c,null));};exports['show']=function(_0x268937,_0x25a011){var _0x5b9b5f={'raw':!![],'where':{'id':_0x268937[_0xdf6b('0x3c')]['id']}},_0x77050d={};_0x77050d[_0xdf6b('0x28')]=_[_0xdf6b('0x2a')](db[_0xdf6b('0x39')][_0xdf6b('0x3d')]);_0x77050d[_0xdf6b('0x29')]=_[_0xdf6b('0x2a')](_0x268937[_0xdf6b('0x29')]);_0x77050d['filters']=_[_0xdf6b('0x2d')](_0x77050d[_0xdf6b('0x28')],_0x77050d[_0xdf6b('0x29')]);_0x5b9b5f['attributes']=_[_0xdf6b('0x2d')](_0x77050d[_0xdf6b('0x28')],qs['fields'](_0x268937['query'][_0xdf6b('0x2e')]));_0x5b9b5f[_0xdf6b('0x2c')]=_0x5b9b5f[_0xdf6b('0x2c')]['length']?_0x5b9b5f[_0xdf6b('0x2c')]:_0x77050d[_0xdf6b('0x28')];if(_0x268937[_0xdf6b('0x29')][_0xdf6b('0x3a')]){_0x5b9b5f[_0xdf6b('0x3b')]=[{'all':!![]}];}_0x5b9b5f=_[_0xdf6b('0x38')]({},_0x5b9b5f,_0x268937[_0xdf6b('0x3e')]);return db[_0xdf6b('0x39')][_0xdf6b('0x3f')](_0x5b9b5f)[_0xdf6b('0x21')](handleEntityNotFound(_0x25a011,null))[_0xdf6b('0x21')](respondWithResult(_0x25a011,null))[_0xdf6b('0x40')](handleError(_0x25a011,null));};exports['create']=function(_0xdd5bfe,_0x61eac9){return db[_0xdf6b('0x39')][_0xdf6b('0x41')](_0xdd5bfe[_0xdf6b('0x42')],{})['then'](respondWithResult(_0x61eac9,0xc9))[_0xdf6b('0x40')](handleError(_0x61eac9,null));};exports[_0xdf6b('0x43')]=function(_0x255676,_0x396047){if(_0x255676[_0xdf6b('0x42')]['id']){delete _0x255676[_0xdf6b('0x42')]['id'];}return db[_0xdf6b('0x39')][_0xdf6b('0x3f')]({'where':{'id':_0x255676['params']['id']}})[_0xdf6b('0x21')](handleEntityNotFound(_0x396047,null))['then'](saveUpdates(_0x255676['body'],null))[_0xdf6b('0x21')](respondWithResult(_0x396047,null))[_0xdf6b('0x40')](handleError(_0x396047,null));};exports[_0xdf6b('0x44')]=function(_0x560aae,_0x1710f0){return db['ServicenowField'][_0xdf6b('0x3f')]({'where':{'id':_0x560aae[_0xdf6b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1710f0,null))[_0xdf6b('0x21')](removeEntity(_0x1710f0,null))[_0xdf6b('0x40')](handleError(_0x1710f0,null));}; \ No newline at end of file +var _0xa799=['status','json','offset','undefined','limit','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ServicenowField','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0x427e03,_0x9122c){var _0x5a0fa9=function(_0x5a5507){while(--_0x5a5507){_0x427e03['push'](_0x427e03['shift']());}};_0x5a0fa9(++_0x9122c);}(_0xa799,0x7c));var _0x9a79=function(_0x19c2b6,_0x23f8b9){_0x19c2b6=_0x19c2b6-0x0;var _0x49b853=_0xa799[_0x19c2b6];return _0x49b853;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a79('0x0'));var zipdir=require(_0x9a79('0x1'));var jsonpatch=require(_0x9a79('0x2'));var rp=require(_0x9a79('0x3'));var moment=require(_0x9a79('0x4'));var BPromise=require(_0x9a79('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9a79('0x6'));var csv=require(_0x9a79('0x7'));var ejs=require(_0x9a79('0x8'));var fs=require('fs');var fs_extra=require(_0x9a79('0x9'));var _=require(_0x9a79('0xa'));var squel=require(_0x9a79('0xb'));var crypto=require(_0x9a79('0xc'));var jsforce=require(_0x9a79('0xd'));var deskjs=require(_0x9a79('0xe'));var toCsv=require(_0x9a79('0x7'));var querystring=require(_0x9a79('0xf'));var Papa=require(_0x9a79('0x10'));var Redis=require(_0x9a79('0x11'));var authService=require(_0x9a79('0x12'));var qs=require(_0x9a79('0x13'));var as=require(_0x9a79('0x14'));var hardwareService=require(_0x9a79('0x15'));var logger=require(_0x9a79('0x16'))(_0x9a79('0x17'));var utils=require('../../config/utils');var config=require(_0x9a79('0x18'));var licenseUtil=require(_0x9a79('0x19'));var db=require(_0x9a79('0x1a'))['db'];function respondWithStatusCode(_0x192fb1,_0x5a2d15){_0x5a2d15=_0x5a2d15||0xcc;return function(_0x23938f){if(_0x23938f){return _0x192fb1['sendStatus'](_0x5a2d15);}return _0x192fb1['status'](_0x5a2d15)[_0x9a79('0x1b')]();};}function respondWithResult(_0x50f2e5,_0x564a2e){_0x564a2e=_0x564a2e||0xc8;return function(_0x5f223f){if(_0x5f223f){return _0x50f2e5[_0x9a79('0x1c')](_0x564a2e)[_0x9a79('0x1d')](_0x5f223f);}};}function respondWithFilteredResult(_0x5e4a27,_0x2c11bd){return function(_0x29e4de){if(_0x29e4de){var _0x10d5f3=typeof _0x2c11bd[_0x9a79('0x1e')]===_0x9a79('0x1f')&&typeof _0x2c11bd[_0x9a79('0x20')]==='undefined';var _0x4117ca=_0x29e4de['count'];var _0x36a447=_0x10d5f3?0x0:_0x2c11bd[_0x9a79('0x1e')];var _0x4fa577=_0x10d5f3?_0x29e4de['count']:_0x2c11bd[_0x9a79('0x1e')]+_0x2c11bd[_0x9a79('0x20')];var _0x10f44f;if(_0x4fa577>=_0x4117ca){_0x4fa577=_0x4117ca;_0x10f44f=0xc8;}else{_0x10f44f=0xce;}_0x5e4a27[_0x9a79('0x1c')](_0x10f44f);return _0x5e4a27[_0x9a79('0x21')](_0x9a79('0x22'),_0x36a447+'-'+_0x4fa577+'/'+_0x4117ca)[_0x9a79('0x1d')](_0x29e4de);}return null;};}function patchUpdates(_0x453aba){return function(_0x5528c1){try{jsonpatch['apply'](_0x5528c1,_0x453aba,!![]);}catch(_0xb0e631){return BPromise['reject'](_0xb0e631);}return _0x5528c1[_0x9a79('0x23')]();};}function saveUpdates(_0x2f7ed3,_0x25214b){return function(_0x3e8303){if(_0x3e8303){return _0x3e8303[_0x9a79('0x24')](_0x2f7ed3)['then'](function(_0x5e63c5){return _0x5e63c5;});}return null;};}function removeEntity(_0x331341,_0x16f290){return function(_0xeee7af){if(_0xeee7af){return _0xeee7af[_0x9a79('0x25')]()[_0x9a79('0x26')](function(){_0x331341[_0x9a79('0x1c')](0xcc)[_0x9a79('0x1b')]();});}};}function handleEntityNotFound(_0x1d3f26,_0x47c46b){return function(_0x39a691){if(!_0x39a691){_0x1d3f26[_0x9a79('0x27')](0x194);}return _0x39a691;};}function handleError(_0x19d727,_0x64d978){_0x64d978=_0x64d978||0x1f4;return function(_0x424c5b){logger[_0x9a79('0x28')](_0x424c5b[_0x9a79('0x29')]);if(_0x424c5b[_0x9a79('0x2a')]){delete _0x424c5b['name'];}_0x19d727['status'](_0x64d978)[_0x9a79('0x2b')](_0x424c5b);};}exports[_0x9a79('0x2c')]=function(_0xcfa76e,_0x9568){var _0x184522={},_0x116823={},_0x2191b9={'count':0x0,'rows':[]};var _0x539262=_[_0x9a79('0x2d')](db[_0x9a79('0x2e')]['rawAttributes'],function(_0x1a94dd){return{'name':_0x1a94dd[_0x9a79('0x2f')],'type':_0x1a94dd['type']['key']};});_0x116823[_0x9a79('0x30')]=_['map'](_0x539262,_0x9a79('0x2a'));_0x116823[_0x9a79('0x31')]=_[_0x9a79('0x32')](_0xcfa76e['query']);_0x116823[_0x9a79('0x33')]=_['intersection'](_0x116823[_0x9a79('0x30')],_0x116823[_0x9a79('0x31')]);_0x184522['attributes']=_['intersection'](_0x116823[_0x9a79('0x30')],qs[_0x9a79('0x34')](_0xcfa76e[_0x9a79('0x31')][_0x9a79('0x34')]));_0x184522['attributes']=_0x184522[_0x9a79('0x35')][_0x9a79('0x36')]?_0x184522['attributes']:_0x116823[_0x9a79('0x30')];if(!_0xcfa76e[_0x9a79('0x31')][_0x9a79('0x37')]('nolimit')){_0x184522[_0x9a79('0x20')]=qs[_0x9a79('0x20')](_0xcfa76e[_0x9a79('0x31')][_0x9a79('0x20')]);_0x184522[_0x9a79('0x1e')]=qs['offset'](_0xcfa76e[_0x9a79('0x31')][_0x9a79('0x1e')]);}_0x184522[_0x9a79('0x38')]=qs[_0x9a79('0x39')](_0xcfa76e[_0x9a79('0x31')][_0x9a79('0x39')]);_0x184522[_0x9a79('0x3a')]=qs['filters'](_[_0x9a79('0x3b')](_0xcfa76e[_0x9a79('0x31')],_0x116823[_0x9a79('0x33')]),_0x539262);if(_0xcfa76e[_0x9a79('0x31')]['filter']){_0x184522[_0x9a79('0x3a')]=_[_0x9a79('0x3c')](_0x184522[_0x9a79('0x3a')],{'$or':_[_0x9a79('0x2d')](_0x539262,function(_0x29637c){if(_0x29637c[_0x9a79('0x3d')]!==_0x9a79('0x3e')){var _0x24ad4d={};_0x24ad4d[_0x29637c['name']]={'$like':'%'+_0xcfa76e[_0x9a79('0x31')]['filter']+'%'};return _0x24ad4d;}})});}_0x184522=_[_0x9a79('0x3c')]({},_0x184522,_0xcfa76e[_0x9a79('0x3f')]);var _0x58fb11={'where':_0x184522['where']};return db[_0x9a79('0x2e')][_0x9a79('0x40')](_0x58fb11)[_0x9a79('0x26')](function(_0xb9c75f){_0x2191b9['count']=_0xb9c75f;if(_0xcfa76e[_0x9a79('0x31')][_0x9a79('0x41')]){_0x184522[_0x9a79('0x42')]=[{'all':!![]}];}return db[_0x9a79('0x2e')][_0x9a79('0x43')](_0x184522);})[_0x9a79('0x26')](function(_0x416b76){_0x2191b9[_0x9a79('0x44')]=_0x416b76;return _0x2191b9;})[_0x9a79('0x26')](respondWithFilteredResult(_0x9568,_0x184522))[_0x9a79('0x45')](handleError(_0x9568,null));};exports[_0x9a79('0x46')]=function(_0x3202a4,_0x5d15ff){var _0x18730a={'raw':!![],'where':{'id':_0x3202a4[_0x9a79('0x47')]['id']}},_0x5599e2={};_0x5599e2['model']=_[_0x9a79('0x32')](db[_0x9a79('0x2e')][_0x9a79('0x48')]);_0x5599e2[_0x9a79('0x31')]=_[_0x9a79('0x32')](_0x3202a4['query']);_0x5599e2[_0x9a79('0x33')]=_['intersection'](_0x5599e2[_0x9a79('0x30')],_0x5599e2[_0x9a79('0x31')]);_0x18730a[_0x9a79('0x35')]=_[_0x9a79('0x49')](_0x5599e2[_0x9a79('0x30')],qs[_0x9a79('0x34')](_0x3202a4[_0x9a79('0x31')][_0x9a79('0x34')]));_0x18730a[_0x9a79('0x35')]=_0x18730a[_0x9a79('0x35')]['length']?_0x18730a[_0x9a79('0x35')]:_0x5599e2['model'];if(_0x3202a4[_0x9a79('0x31')][_0x9a79('0x41')]){_0x18730a[_0x9a79('0x42')]=[{'all':!![]}];}_0x18730a=_[_0x9a79('0x3c')]({},_0x18730a,_0x3202a4[_0x9a79('0x3f')]);return db[_0x9a79('0x2e')]['find'](_0x18730a)[_0x9a79('0x26')](handleEntityNotFound(_0x5d15ff,null))[_0x9a79('0x26')](respondWithResult(_0x5d15ff,null))[_0x9a79('0x45')](handleError(_0x5d15ff,null));};exports['create']=function(_0x2439e3,_0x4b429b){return db[_0x9a79('0x2e')]['create'](_0x2439e3[_0x9a79('0x4a')],{})[_0x9a79('0x26')](respondWithResult(_0x4b429b,0xc9))[_0x9a79('0x45')](handleError(_0x4b429b,null));};exports[_0x9a79('0x24')]=function(_0x4df731,_0x323157){if(_0x4df731[_0x9a79('0x4a')]['id']){delete _0x4df731[_0x9a79('0x4a')]['id'];}return db['ServicenowField'][_0x9a79('0x4b')]({'where':{'id':_0x4df731[_0x9a79('0x47')]['id']}})[_0x9a79('0x26')](handleEntityNotFound(_0x323157,null))[_0x9a79('0x26')](saveUpdates(_0x4df731[_0x9a79('0x4a')],null))[_0x9a79('0x26')](respondWithResult(_0x323157,null))[_0x9a79('0x45')](handleError(_0x323157,null));};exports[_0x9a79('0x25')]=function(_0x696666,_0x3b78e2){return db[_0x9a79('0x2e')]['find']({'where':{'id':_0x696666[_0x9a79('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b78e2,null))[_0x9a79('0x26')](removeEntity(_0x3b78e2,null))[_0x9a79('0x45')](handleError(_0x3b78e2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index ef96ea7..7da5e5a 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 _0x2ff6=['exports','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x3b8994,_0xda7f9e){var _0x43d2db=function(_0x56ce6f){while(--_0x56ce6f){_0x3b8994['push'](_0x3b8994['shift']());}};_0x43d2db(++_0xda7f9e);}(_0x2ff6,0xa1));var _0x62ff=function(_0x8f87a9,_0x2983a7){_0x8f87a9=_0x8f87a9-0x0;var _0x28baae=_0x2ff6[_0x8f87a9];return _0x28baae;};'use strict';var _=require(_0x62ff('0x0'));var util=require('util');var logger=require(_0x62ff('0x1'))(_0x62ff('0x2'));var moment=require('moment');var BPromise=require(_0x62ff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62ff('0x4'));var rimraf=require(_0x62ff('0x5'));var config=require(_0x62ff('0x6'));var attributes=require(_0x62ff('0x7'));module[_0x62ff('0x8')]=function(_0x3e1952,_0x48ab50){return _0x3e1952['define'](_0x62ff('0x9'),attributes,{'tableName':_0x62ff('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x62ff('0xb'),_0x62ff('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e9e=['api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x8e9e,0x19f));var _0xe8e9=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x8e9e[_0x483e3a];return _0x43fca9;};'use strict';var _=require('lodash');var util=require(_0xe8e9('0x0'));var logger=require('../../config/logger')(_0xe8e9('0x1'));var moment=require('moment');var BPromise=require(_0xe8e9('0x2'));var rp=require(_0xe8e9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8e9('0x4'));var config=require(_0xe8e9('0x5'));var attributes=require(_0xe8e9('0x6'));module[_0xe8e9('0x7')]=function(_0x1bf621,_0x347b6d){return _0x1bf621['define'](_0xe8e9('0x8'),attributes,{'tableName':_0xe8e9('0x9'),'paranoid':![],'indexes':[{'name':_0xe8e9('0xa'),'fields':[_0xe8e9('0xb'),_0xe8e9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 1c0d60b..ec569ce 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac4a,0x13f));var _0xaac4=function(_0x4cd45c,_0x1d1f7c){_0x4cd45c=_0x4cd45c-0x0;var _0x538b17=_0xac4a[_0x4cd45c];return _0x538b17;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2f26f9,_0x391ab9){var _0x29d6cf=function(_0x451a2a){while(--_0x451a2a){_0x2f26f9['push'](_0x2f26f9['shift']());}};_0x29d6cf(++_0x391ab9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e42506e..2d8c605 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xf98e7b,_0x3b05dd){var _0x3c2cd1=function(_0x1550c3){while(--_0x1550c3){_0xf98e7b['push'](_0xf98e7b['shift']());}};_0x3c2cd1(++_0x3b05dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3aadce,_0xfb74ef){var _0x611441=function(_0x3bc75){while(--_0x3bc75){_0x3aadce['push'](_0x3aadce['shift']());}};_0x611441(++_0xfb74ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 469da99..8d38a30 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(_0x2c5693,_0x33a745){var _0x5850f6=function(_0x3ab2fa){while(--_0x3ab2fa){_0x2c5693['push'](_0x2c5693['shift']());}};_0x5850f6(++_0x33a745);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x236e0c,_0x231378){var _0x533202=function(_0x34997a){while(--_0x34997a){_0x236e0c['push'](_0x236e0c['shift']());}};_0x533202(++_0x231378);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 9aeeb37..dcf1121 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 _0xd10b=['endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','getConfigurations','params','SugarcrmConfiguration','order','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','get_module_fields','Calls','values','remove','includes'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd10b,0xf8));var _0xbd10=function(_0x459f26,_0x94acca){_0x459f26=_0x459f26-0x0;var _0x1fe9a8=_0xd10b[_0x459f26];return _0x1fe9a8;};'use strict';var emlformat=require(_0xbd10('0x0'));var rimraf=require(_0xbd10('0x1'));var zipdir=require(_0xbd10('0x2'));var jsonpatch=require(_0xbd10('0x3'));var rp=require(_0xbd10('0x4'));var moment=require(_0xbd10('0x5'));var BPromise=require(_0xbd10('0x6'));var Mustache=require(_0xbd10('0x7'));var util=require(_0xbd10('0x8'));var path=require('path');var sox=require(_0xbd10('0x9'));var csv=require(_0xbd10('0xa'));var ejs=require(_0xbd10('0xb'));var fs=require('fs');var fs_extra=require(_0xbd10('0xc'));var _=require(_0xbd10('0xd'));var squel=require(_0xbd10('0xe'));var crypto=require(_0xbd10('0xf'));var jsforce=require(_0xbd10('0x10'));var deskjs=require(_0xbd10('0x11'));var toCsv=require(_0xbd10('0xa'));var querystring=require(_0xbd10('0x12'));var Papa=require(_0xbd10('0x13'));var Redis=require('ioredis');var authService=require(_0xbd10('0x14'));var qs=require(_0xbd10('0x15'));var as=require(_0xbd10('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbd10('0x17'));var utils=require(_0xbd10('0x18'));var config=require(_0xbd10('0x19'));var licenseUtil=require(_0xbd10('0x1a'));var db=require(_0xbd10('0x1b'))['db'];var integrations=require(_0xbd10('0x1c'));function respondWithStatusCode(_0x381456,_0x2d38e8){_0x2d38e8=_0x2d38e8||0xcc;return function(_0x556782){if(_0x556782){return _0x381456[_0xbd10('0x1d')](_0x2d38e8);}return _0x381456[_0xbd10('0x1e')](_0x2d38e8)[_0xbd10('0x1f')]();};}function respondWithResult(_0x5557ac,_0x1768b9){_0x1768b9=_0x1768b9||0xc8;return function(_0x16d954){if(_0x16d954){return _0x5557ac[_0xbd10('0x1e')](_0x1768b9)[_0xbd10('0x20')](_0x16d954);}};}function respondWithFilteredResult(_0x48e01d,_0x23b21a){return function(_0x29922a){if(_0x29922a){var _0x5e9957=typeof _0x23b21a[_0xbd10('0x21')]===_0xbd10('0x22')&&typeof _0x23b21a[_0xbd10('0x23')]===_0xbd10('0x22');var _0x33c3ab=_0x29922a[_0xbd10('0x24')];var _0x433349=_0x5e9957?0x0:_0x23b21a[_0xbd10('0x21')];var _0x4a9a44=_0x5e9957?_0x29922a[_0xbd10('0x24')]:_0x23b21a[_0xbd10('0x21')]+_0x23b21a[_0xbd10('0x23')];var _0x49b018;if(_0x4a9a44>=_0x33c3ab){_0x4a9a44=_0x33c3ab;_0x49b018=0xc8;}else{_0x49b018=0xce;}_0x48e01d[_0xbd10('0x1e')](_0x49b018);return _0x48e01d['set']('Content-Range',_0x433349+'-'+_0x4a9a44+'/'+_0x33c3ab)['json'](_0x29922a);}return null;};}function patchUpdates(_0x35468f){return function(_0x4d9194){try{jsonpatch[_0xbd10('0x25')](_0x4d9194,_0x35468f,!![]);}catch(_0x2a0df2){return BPromise['reject'](_0x2a0df2);}return _0x4d9194[_0xbd10('0x26')]();};}function saveUpdates(_0x54c8bd,_0x30e456){return function(_0x4c988a){if(_0x4c988a){return _0x4c988a[_0xbd10('0x27')](_0x54c8bd)[_0xbd10('0x28')](function(_0x21f3e2){return _0x21f3e2;});}return null;};}function removeEntity(_0xf9c40a,_0x3c8d4b){return function(_0x294295){if(_0x294295){return _0x294295[_0xbd10('0x29')]()[_0xbd10('0x28')](function(){_0xf9c40a[_0xbd10('0x1e')](0xcc)[_0xbd10('0x1f')]();});}};}function handleEntityNotFound(_0x196da5,_0x3ff192){return function(_0x20eef9){if(!_0x20eef9){_0x196da5[_0xbd10('0x1d')](0x194);}return _0x20eef9;};}function handleError(_0x453ade,_0x376636){_0x376636=_0x376636||0x1f4;return function(_0x455454){logger[_0xbd10('0x2a')](_0x455454[_0xbd10('0x2b')]);if(_0x455454['name']){delete _0x455454[_0xbd10('0x2c')];}_0x453ade[_0xbd10('0x1e')](_0x376636)['send'](_0x455454);};}exports['index']=function(_0x3532c1,_0x333388){var _0x1b2393={},_0x49beee={},_0x3b956e={'count':0x0,'rows':[]};var _0x32c8cc=_[_0xbd10('0x2d')](db[_0xbd10('0x2e')][_0xbd10('0x2f')],function(_0x35c395){return{'name':_0x35c395['fieldName'],'type':_0x35c395[_0xbd10('0x30')][_0xbd10('0x31')]};});_0x49beee[_0xbd10('0x32')]=_[_0xbd10('0x2d')](_0x32c8cc,_0xbd10('0x2c'));_0x49beee[_0xbd10('0x33')]=_[_0xbd10('0x34')](_0x3532c1['query']);_0x49beee[_0xbd10('0x35')]=_[_0xbd10('0x36')](_0x49beee['model'],_0x49beee[_0xbd10('0x33')]);_0x1b2393[_0xbd10('0x37')]=_[_0xbd10('0x36')](_0x49beee[_0xbd10('0x32')],qs[_0xbd10('0x38')](_0x3532c1[_0xbd10('0x33')]['fields']));_0x1b2393[_0xbd10('0x37')]=_0x1b2393[_0xbd10('0x37')][_0xbd10('0x39')]?_0x1b2393[_0xbd10('0x37')]:_0x49beee[_0xbd10('0x32')];if(!_0x3532c1[_0xbd10('0x33')][_0xbd10('0x3a')](_0xbd10('0x3b'))){_0x1b2393[_0xbd10('0x23')]=qs[_0xbd10('0x23')](_0x3532c1[_0xbd10('0x33')][_0xbd10('0x23')]);_0x1b2393[_0xbd10('0x21')]=qs['offset'](_0x3532c1[_0xbd10('0x33')]['offset']);}_0x1b2393['order']=qs[_0xbd10('0x3c')](_0x3532c1[_0xbd10('0x33')][_0xbd10('0x3c')]);_0x1b2393['where']=qs[_0xbd10('0x35')](_[_0xbd10('0x3d')](_0x3532c1['query'],_0x49beee[_0xbd10('0x35')]),_0x32c8cc);if(_0x3532c1[_0xbd10('0x33')][_0xbd10('0x3e')]){_0x1b2393[_0xbd10('0x3f')]=_[_0xbd10('0x40')](_0x1b2393['where'],{'$or':_[_0xbd10('0x2d')](_0x32c8cc,function(_0x57ad05){if(_0x57ad05[_0xbd10('0x30')]!==_0xbd10('0x41')){var _0x865820={};_0x865820[_0x57ad05[_0xbd10('0x2c')]]={'$like':'%'+_0x3532c1['query'][_0xbd10('0x3e')]+'%'};return _0x865820;}})});}_0x1b2393=_[_0xbd10('0x40')]({},_0x1b2393,_0x3532c1[_0xbd10('0x42')]);var _0x383be7={'where':_0x1b2393[_0xbd10('0x3f')]};return db['SugarcrmAccount']['count'](_0x383be7)[_0xbd10('0x28')](function(_0x221242){_0x3b956e[_0xbd10('0x24')]=_0x221242;if(_0x3532c1[_0xbd10('0x33')][_0xbd10('0x43')]){_0x1b2393[_0xbd10('0x44')]=[{'all':!![]}];}return db[_0xbd10('0x2e')]['findAll'](_0x1b2393);})[_0xbd10('0x28')](function(_0x4f3872){_0x3b956e[_0xbd10('0x45')]=_0x4f3872;return _0x3b956e;})['then'](respondWithFilteredResult(_0x333388,_0x1b2393))[_0xbd10('0x46')](handleError(_0x333388,null));};exports[_0xbd10('0x47')]=function(_0xf4dbf0,_0x2bb15f){var _0x485698={'raw':![],'where':{'id':_0xf4dbf0['params']['id']}},_0x1ec31f={};_0x1ec31f[_0xbd10('0x32')]=_[_0xbd10('0x34')](db[_0xbd10('0x2e')]['rawAttributes']);_0x1ec31f['query']=_[_0xbd10('0x34')](_0xf4dbf0[_0xbd10('0x33')]);_0x1ec31f[_0xbd10('0x35')]=_[_0xbd10('0x36')](_0x1ec31f['model'],_0x1ec31f[_0xbd10('0x33')]);_0x485698[_0xbd10('0x37')]=_[_0xbd10('0x36')](_0x1ec31f[_0xbd10('0x32')],qs['fields'](_0xf4dbf0[_0xbd10('0x33')]['fields']));_0x485698['attributes']=_0x485698[_0xbd10('0x37')][_0xbd10('0x39')]?_0x485698[_0xbd10('0x37')]:_0x1ec31f['model'];if(_0xf4dbf0[_0xbd10('0x33')][_0xbd10('0x43')]){_0x485698[_0xbd10('0x44')]=[{'all':!![]}];}_0x485698=_[_0xbd10('0x40')]({},_0x485698,_0xf4dbf0[_0xbd10('0x42')]);return db['SugarcrmAccount'][_0xbd10('0x48')](_0x485698)[_0xbd10('0x28')](handleEntityNotFound(_0x2bb15f,null))[_0xbd10('0x28')](respondWithResult(_0x2bb15f,null))['catch'](handleError(_0x2bb15f,null));};exports['create']=function(_0x1e2e84,_0x5e91ab){return db[_0xbd10('0x2e')][_0xbd10('0x49')](_0x1e2e84['body'],{})[_0xbd10('0x28')](respondWithResult(_0x5e91ab,0xc9))[_0xbd10('0x46')](handleError(_0x5e91ab,null));};exports[_0xbd10('0x27')]=function(_0x34fb8a,_0x422879){if(_0x34fb8a[_0xbd10('0x4a')]['id']){delete _0x34fb8a['body']['id'];}return db[_0xbd10('0x2e')][_0xbd10('0x48')]({'where':{'id':_0x34fb8a['params']['id']}})['then'](handleEntityNotFound(_0x422879,null))[_0xbd10('0x28')](saveUpdates(_0x34fb8a[_0xbd10('0x4a')],null))[_0xbd10('0x28')](respondWithResult(_0x422879,null))[_0xbd10('0x46')](handleError(_0x422879,null));};exports[_0xbd10('0x29')]=function(_0x1a0aa6,_0x4b7c73){return db[_0xbd10('0x2e')][_0xbd10('0x48')]({'where':{'id':_0x1a0aa6['params']['id']}})[_0xbd10('0x28')](handleEntityNotFound(_0x4b7c73,null))[_0xbd10('0x28')](removeEntity(_0x4b7c73,null))[_0xbd10('0x46')](handleError(_0x4b7c73,null));};exports[_0xbd10('0x4b')]=function(_0x16bfde,_0x1e4e71,_0x1e62c2){var _0x5304e1={};var _0x15291b={};var _0x480ed8;var _0x255a1d;return db[_0xbd10('0x2e')]['findOne']({'where':{'id':_0x16bfde[_0xbd10('0x4c')]['id']}})[_0xbd10('0x28')](handleEntityNotFound(_0x1e4e71,null))['then'](function(_0x4096ba){if(_0x4096ba){_0x480ed8=_0x4096ba;_0x15291b['model']=_[_0xbd10('0x34')](db[_0xbd10('0x4d')][_0xbd10('0x2f')]);_0x15291b['query']=_[_0xbd10('0x34')](_0x16bfde[_0xbd10('0x33')]);_0x15291b[_0xbd10('0x35')]=_[_0xbd10('0x36')](_0x15291b[_0xbd10('0x32')],_0x15291b[_0xbd10('0x33')]);_0x5304e1[_0xbd10('0x37')]=_[_0xbd10('0x36')](_0x15291b['model'],qs['fields'](_0x16bfde['query']['fields']));_0x5304e1['attributes']=_0x5304e1[_0xbd10('0x37')][_0xbd10('0x39')]?_0x5304e1['attributes']:_0x15291b[_0xbd10('0x32')];_0x5304e1[_0xbd10('0x4e')]=qs[_0xbd10('0x3c')](_0x16bfde[_0xbd10('0x33')][_0xbd10('0x3c')]);_0x5304e1[_0xbd10('0x3f')]=qs[_0xbd10('0x35')](_[_0xbd10('0x3d')](_0x16bfde['query'],_0x15291b[_0xbd10('0x35')]));if(_0x16bfde['query'][_0xbd10('0x3e')]){_0x5304e1[_0xbd10('0x3f')]=_[_0xbd10('0x40')](_0x5304e1[_0xbd10('0x3f')],{'$or':_[_0xbd10('0x2d')](_0x5304e1['attributes'],function(_0x4e57a7){var _0x391af6={};_0x391af6[_0x4e57a7]={'$like':'%'+_0x16bfde[_0xbd10('0x33')]['filter']+'%'};return _0x391af6;})});}_0x5304e1=_[_0xbd10('0x40')]({},_0x5304e1,_0x16bfde[_0xbd10('0x42')]);return _0x480ed8[_0xbd10('0x4b')](_0x5304e1);}})[_0xbd10('0x28')](function(_0x56280){if(_0x56280){_0x255a1d=_0x56280[_0xbd10('0x39')];if(!_0x16bfde[_0xbd10('0x33')][_0xbd10('0x3a')](_0xbd10('0x3b'))){_0x5304e1['limit']=qs[_0xbd10('0x23')](_0x16bfde[_0xbd10('0x33')][_0xbd10('0x23')]);_0x5304e1[_0xbd10('0x21')]=qs[_0xbd10('0x21')](_0x16bfde[_0xbd10('0x33')][_0xbd10('0x21')]);}return _0x480ed8[_0xbd10('0x4b')](_0x5304e1);}})[_0xbd10('0x28')](function(_0x41c972){if(_0x41c972){return _0x41c972?{'count':_0x255a1d,'rows':_0x41c972}:null;}})[_0xbd10('0x28')](respondWithResult(_0x1e4e71,null))[_0xbd10('0x46')](handleError(_0x1e4e71,null));};exports[_0xbd10('0x4f')]=function(_0x323c3e,_0x4a570c,_0x52b1fd){if(_0x323c3e['body']['id']){delete _0x323c3e[_0xbd10('0x4a')]['id'];}return db['SugarcrmAccount'][_0xbd10('0x50')]({'where':{'id':_0x323c3e[_0xbd10('0x4c')]['id']}})[_0xbd10('0x28')](handleEntityNotFound(_0x4a570c,null))[_0xbd10('0x28')](function(_0x2ae74e){if(_0x2ae74e){_0x323c3e['body']['AccountId']=_0x2ae74e['id'];_0x323c3e[_0xbd10('0x4a')][_0xbd10('0x51')]=integrations['getSubjects'](_0x323c3e[_0xbd10('0x4a')][_0xbd10('0x52')],_0x323c3e[_0xbd10('0x4a')][_0xbd10('0x30')]);_0x323c3e['body'][_0xbd10('0x53')]=integrations[_0xbd10('0x54')](_0x323c3e[_0xbd10('0x4a')][_0xbd10('0x52')],_0x323c3e['body'][_0xbd10('0x30')]);return db[_0xbd10('0x4d')][_0xbd10('0x49')](_0x323c3e[_0xbd10('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xbd10('0x53')}]});}return null;})['then'](respondWithResult(_0x4a570c,null))[_0xbd10('0x46')](handleError(_0x4a570c,null));};exports[_0xbd10('0x55')]=function(_0x4ea602,_0x118756,_0x42f47a){var _0x4d2e65='';var _0x46c1fd=['id','name',_0xbd10('0x56'),_0xbd10('0x57'),'description',_0xbd10('0x58'),_0xbd10('0x59'),'duration_minutes',_0xbd10('0x5a'),_0xbd10('0x5b'),_0xbd10('0x5c'),_0xbd10('0x5d')];return db[_0xbd10('0x2e')][_0xbd10('0x50')]({'where':{'id':_0x4ea602['params']['id']},'attributes':['id',_0xbd10('0x5e'),_0xbd10('0x5f'),_0xbd10('0x60')]})[_0xbd10('0x28')](handleEntityNotFound(_0x118756,null))[_0xbd10('0x28')](function(_0x1e2bc6){if(_0x1e2bc6){_0x4d2e65=_0x1e2bc6[_0xbd10('0x60')];var _0x42365a=_0x4d2e65[_0xbd10('0x61')](-0x1);if(_0x42365a==='/'){_0x4d2e65=_0x4d2e65[_0xbd10('0x62')](0x0,_0x4d2e65[_0xbd10('0x63')](_0x42365a));}return rp({'method':_0xbd10('0x64'),'uri':util[_0xbd10('0x65')]('%s%s',_0x4d2e65,_0xbd10('0x66')),'json':!![],'form':{'method':_0xbd10('0x67'),'input_type':_0xbd10('0x68'),'response_type':_0xbd10('0x68'),'rest_data':JSON[_0xbd10('0x69')]({'user_auth':{'user_name':_0x1e2bc6[_0xbd10('0x5e')],'password':_0x1e2bc6[_0xbd10('0x5f')],'encryption':_0xbd10('0x6a')},'application':_0xbd10('0x6b')})}});}})[_0xbd10('0x28')](function(_0x1ee101){if(_0x1ee101&&_0x1ee101[_0xbd10('0x2c')]!=='Invalid\x20Login'&&_0x1ee101[_0xbd10('0x2c')]!==_0xbd10('0x6c')){return rp({'method':'POST','uri':util[_0xbd10('0x65')](_0xbd10('0x6d'),_0x4d2e65,_0xbd10('0x66')),'json':!![],'form':{'method':_0xbd10('0x6e'),'input_type':_0xbd10('0x68'),'response_type':'JSON','rest_data':JSON[_0xbd10('0x69')]({'session':_0x1ee101['id'],'module_name':_0xbd10('0x6f')})}})['then'](function(_0x352ac6){if(_0x352ac6){var _0x54a2be=_[_0xbd10('0x70')](_0x352ac6['module_fields']);_[_0xbd10('0x71')](_0x54a2be,function(_0x4f187e){return _0x46c1fd[_0xbd10('0x72')](_0x4f187e['name']);});return{'count':_0x54a2be[_0xbd10('0x39')],'rows':_['map'](_0x54a2be,function(_0x2c9972){return{'id':_0x2c9972['name'],'name':_0x2c9972['label'],'custom':_[_0xbd10('0x73')](_0x2c9972[_0xbd10('0x2c')],'_c')?!![]:![],'options':_0x2c9972['options']?_[_0xbd10('0x2d')](_[_0xbd10('0x70')](_0x2c9972['options']),function(_0x5a965a){return{'name':_0x5a965a['value'],'value':_0x5a965a[_0xbd10('0x2c')]};}):[]};})};}})[_0xbd10('0x28')](respondWithResult(_0x118756,null))[_0xbd10('0x46')](function(_0x46133c){var _0x4fd7d0=_0x4ea602[_0xbd10('0x33')][_0xbd10('0x74')]?0x1f4:_0x46133c[_0xbd10('0x75')]||0x1f4;logger['error'](_0xbd10('0x76'),_0xbd10('0x55'),_0x4fd7d0,JSON[_0xbd10('0x69')](_0x46133c));delete _0x46133c['name'];if(_0x4fd7d0===0x191){_0x4fd7d0=0x190;}_0x118756[_0xbd10('0x1e')](_0x4fd7d0)[_0xbd10('0x77')](_0x4ea602['query']['test']?{'message':_0xbd10('0x78'),'statusCode':_0x46133c[_0xbd10('0x75')]}:_0x46133c);});}else{var _0x4cd590=0x1f4;_0x118756[_0xbd10('0x1e')](_0x4cd590)['send']({'message':_0xbd10('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x4717=['substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','label','endsWith','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','map','SugarcrmAccount','rawAttributes','type','model','keys','query','filters','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','intersection','length','find','catch','create','body','findOne','pick','getConfigurations','hasOwnProperty','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice'];(function(_0x12129a,_0x13b125){var _0x22af91=function(_0x2da53b){while(--_0x2da53b){_0x12129a['push'](_0x12129a['shift']());}};_0x22af91(++_0x13b125);}(_0x4717,0x1e1));var _0x7471=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x4717[_0x363ef8];return _0x148822;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7471('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7471('0x1'));var moment=require(_0x7471('0x2'));var BPromise=require(_0x7471('0x3'));var Mustache=require(_0x7471('0x4'));var util=require(_0x7471('0x5'));var path=require(_0x7471('0x6'));var sox=require(_0x7471('0x7'));var csv=require(_0x7471('0x8'));var ejs=require(_0x7471('0x9'));var fs=require('fs');var fs_extra=require(_0x7471('0xa'));var _=require(_0x7471('0xb'));var squel=require(_0x7471('0xc'));var crypto=require('crypto');var jsforce=require(_0x7471('0xd'));var deskjs=require(_0x7471('0xe'));var toCsv=require(_0x7471('0x8'));var querystring=require(_0x7471('0xf'));var Papa=require(_0x7471('0x10'));var Redis=require(_0x7471('0x11'));var authService=require(_0x7471('0x12'));var qs=require(_0x7471('0x13'));var as=require(_0x7471('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7471('0x15'));var utils=require(_0x7471('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7471('0x17'));var db=require(_0x7471('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4c7a7b,_0x52bb65){_0x52bb65=_0x52bb65||0xcc;return function(_0x163350){if(_0x163350){return _0x4c7a7b[_0x7471('0x19')](_0x52bb65);}return _0x4c7a7b[_0x7471('0x1a')](_0x52bb65)[_0x7471('0x1b')]();};}function respondWithResult(_0x1aeb7e,_0xdf38bf){_0xdf38bf=_0xdf38bf||0xc8;return function(_0x327573){if(_0x327573){return _0x1aeb7e[_0x7471('0x1a')](_0xdf38bf)[_0x7471('0x1c')](_0x327573);}};}function respondWithFilteredResult(_0x4c006b,_0x49f518){return function(_0x2417bc){if(_0x2417bc){var _0x5d754e=typeof _0x49f518[_0x7471('0x1d')]===_0x7471('0x1e')&&typeof _0x49f518[_0x7471('0x1f')]===_0x7471('0x1e');var _0x50aac1=_0x2417bc[_0x7471('0x20')];var _0x16a659=_0x5d754e?0x0:_0x49f518[_0x7471('0x1d')];var _0x10dd73=_0x5d754e?_0x2417bc[_0x7471('0x20')]:_0x49f518[_0x7471('0x1d')]+_0x49f518[_0x7471('0x1f')];var _0x27ea7d;if(_0x10dd73>=_0x50aac1){_0x10dd73=_0x50aac1;_0x27ea7d=0xc8;}else{_0x27ea7d=0xce;}_0x4c006b[_0x7471('0x1a')](_0x27ea7d);return _0x4c006b[_0x7471('0x21')]('Content-Range',_0x16a659+'-'+_0x10dd73+'/'+_0x50aac1)[_0x7471('0x1c')](_0x2417bc);}return null;};}function patchUpdates(_0x212ad5){return function(_0x16f839){try{jsonpatch[_0x7471('0x22')](_0x16f839,_0x212ad5,!![]);}catch(_0x50082c){return BPromise[_0x7471('0x23')](_0x50082c);}return _0x16f839[_0x7471('0x24')]();};}function saveUpdates(_0x4343c1,_0xae1ae4){return function(_0x46eb94){if(_0x46eb94){return _0x46eb94[_0x7471('0x25')](_0x4343c1)[_0x7471('0x26')](function(_0x55ffd9){return _0x55ffd9;});}return null;};}function removeEntity(_0x72fc62,_0x354cb1){return function(_0x550fb9){if(_0x550fb9){return _0x550fb9[_0x7471('0x27')]()['then'](function(){_0x72fc62['status'](0xcc)[_0x7471('0x1b')]();});}};}function handleEntityNotFound(_0x55bde8,_0x19f019){return function(_0x3eebef){if(!_0x3eebef){_0x55bde8[_0x7471('0x19')](0x194);}return _0x3eebef;};}function handleError(_0x191837,_0x343539){_0x343539=_0x343539||0x1f4;return function(_0x90bbf2){logger['error'](_0x90bbf2[_0x7471('0x28')]);if(_0x90bbf2['name']){delete _0x90bbf2[_0x7471('0x29')];}_0x191837[_0x7471('0x1a')](_0x343539)['send'](_0x90bbf2);};}exports[_0x7471('0x2a')]=function(_0x51c425,_0x2b6af0){var _0x54d3f9={},_0x4f854a={},_0x199d06={'count':0x0,'rows':[]};var _0x1a7775=_[_0x7471('0x2b')](db[_0x7471('0x2c')][_0x7471('0x2d')],function(_0x392406){return{'name':_0x392406['fieldName'],'type':_0x392406[_0x7471('0x2e')]['key']};});_0x4f854a[_0x7471('0x2f')]=_[_0x7471('0x2b')](_0x1a7775,_0x7471('0x29'));_0x4f854a['query']=_[_0x7471('0x30')](_0x51c425[_0x7471('0x31')]);_0x4f854a[_0x7471('0x32')]=_['intersection'](_0x4f854a[_0x7471('0x2f')],_0x4f854a[_0x7471('0x31')]);_0x54d3f9[_0x7471('0x33')]=_['intersection'](_0x4f854a[_0x7471('0x2f')],qs['fields'](_0x51c425[_0x7471('0x31')][_0x7471('0x34')]));_0x54d3f9[_0x7471('0x33')]=_0x54d3f9['attributes']['length']?_0x54d3f9[_0x7471('0x33')]:_0x4f854a[_0x7471('0x2f')];if(!_0x51c425[_0x7471('0x31')]['hasOwnProperty'](_0x7471('0x35'))){_0x54d3f9[_0x7471('0x1f')]=qs[_0x7471('0x1f')](_0x51c425['query'][_0x7471('0x1f')]);_0x54d3f9[_0x7471('0x1d')]=qs[_0x7471('0x1d')](_0x51c425[_0x7471('0x31')][_0x7471('0x1d')]);}_0x54d3f9[_0x7471('0x36')]=qs['sort'](_0x51c425['query'][_0x7471('0x37')]);_0x54d3f9[_0x7471('0x38')]=qs[_0x7471('0x32')](_['pick'](_0x51c425['query'],_0x4f854a[_0x7471('0x32')]),_0x1a7775);if(_0x51c425[_0x7471('0x31')][_0x7471('0x39')]){_0x54d3f9[_0x7471('0x38')]=_[_0x7471('0x3a')](_0x54d3f9[_0x7471('0x38')],{'$or':_['map'](_0x1a7775,function(_0x342219){if(_0x342219[_0x7471('0x2e')]!=='VIRTUAL'){var _0x521857={};_0x521857[_0x342219[_0x7471('0x29')]]={'$like':'%'+_0x51c425[_0x7471('0x31')]['filter']+'%'};return _0x521857;}})});}_0x54d3f9=_['merge']({},_0x54d3f9,_0x51c425[_0x7471('0x3b')]);var _0x47ceb8={'where':_0x54d3f9[_0x7471('0x38')]};return db[_0x7471('0x2c')][_0x7471('0x20')](_0x47ceb8)[_0x7471('0x26')](function(_0x56b568){_0x199d06['count']=_0x56b568;if(_0x51c425[_0x7471('0x31')][_0x7471('0x3c')]){_0x54d3f9[_0x7471('0x3d')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x7471('0x3e')](_0x54d3f9);})[_0x7471('0x26')](function(_0x134397){_0x199d06[_0x7471('0x3f')]=_0x134397;return _0x199d06;})['then'](respondWithFilteredResult(_0x2b6af0,_0x54d3f9))['catch'](handleError(_0x2b6af0,null));};exports['show']=function(_0x117969,_0x58a96e){var _0x4ce1a5={'raw':![],'where':{'id':_0x117969[_0x7471('0x40')]['id']}},_0x45ca9e={};_0x45ca9e[_0x7471('0x2f')]=_[_0x7471('0x30')](db[_0x7471('0x2c')][_0x7471('0x2d')]);_0x45ca9e['query']=_[_0x7471('0x30')](_0x117969[_0x7471('0x31')]);_0x45ca9e[_0x7471('0x32')]=_[_0x7471('0x41')](_0x45ca9e[_0x7471('0x2f')],_0x45ca9e[_0x7471('0x31')]);_0x4ce1a5[_0x7471('0x33')]=_[_0x7471('0x41')](_0x45ca9e['model'],qs[_0x7471('0x34')](_0x117969[_0x7471('0x31')]['fields']));_0x4ce1a5[_0x7471('0x33')]=_0x4ce1a5['attributes'][_0x7471('0x42')]?_0x4ce1a5[_0x7471('0x33')]:_0x45ca9e['model'];if(_0x117969[_0x7471('0x31')]['includeAll']){_0x4ce1a5[_0x7471('0x3d')]=[{'all':!![]}];}_0x4ce1a5=_[_0x7471('0x3a')]({},_0x4ce1a5,_0x117969[_0x7471('0x3b')]);return db[_0x7471('0x2c')][_0x7471('0x43')](_0x4ce1a5)[_0x7471('0x26')](handleEntityNotFound(_0x58a96e,null))['then'](respondWithResult(_0x58a96e,null))[_0x7471('0x44')](handleError(_0x58a96e,null));};exports[_0x7471('0x45')]=function(_0xeb4e87,_0x56da4b){return db[_0x7471('0x2c')][_0x7471('0x45')](_0xeb4e87['body'],{})[_0x7471('0x26')](respondWithResult(_0x56da4b,0xc9))[_0x7471('0x44')](handleError(_0x56da4b,null));};exports[_0x7471('0x25')]=function(_0xfddaee,_0x1d3bba){if(_0xfddaee[_0x7471('0x46')]['id']){delete _0xfddaee['body']['id'];}return db[_0x7471('0x2c')][_0x7471('0x43')]({'where':{'id':_0xfddaee[_0x7471('0x40')]['id']}})[_0x7471('0x26')](handleEntityNotFound(_0x1d3bba,null))[_0x7471('0x26')](saveUpdates(_0xfddaee[_0x7471('0x46')],null))['then'](respondWithResult(_0x1d3bba,null))[_0x7471('0x44')](handleError(_0x1d3bba,null));};exports[_0x7471('0x27')]=function(_0x587c94,_0x2007d9){return db[_0x7471('0x2c')][_0x7471('0x43')]({'where':{'id':_0x587c94['params']['id']}})[_0x7471('0x26')](handleEntityNotFound(_0x2007d9,null))[_0x7471('0x26')](removeEntity(_0x2007d9,null))[_0x7471('0x44')](handleError(_0x2007d9,null));};exports['getConfigurations']=function(_0x54e2b2,_0x180017,_0xe1a65c){var _0x448581={};var _0x3865aa={};var _0x2fdf85;var _0x36927e;return db[_0x7471('0x2c')][_0x7471('0x47')]({'where':{'id':_0x54e2b2[_0x7471('0x40')]['id']}})[_0x7471('0x26')](handleEntityNotFound(_0x180017,null))['then'](function(_0x4ef46f){if(_0x4ef46f){_0x2fdf85=_0x4ef46f;_0x3865aa['model']=_[_0x7471('0x30')](db['SugarcrmConfiguration'][_0x7471('0x2d')]);_0x3865aa[_0x7471('0x31')]=_[_0x7471('0x30')](_0x54e2b2[_0x7471('0x31')]);_0x3865aa[_0x7471('0x32')]=_[_0x7471('0x41')](_0x3865aa[_0x7471('0x2f')],_0x3865aa[_0x7471('0x31')]);_0x448581[_0x7471('0x33')]=_[_0x7471('0x41')](_0x3865aa[_0x7471('0x2f')],qs[_0x7471('0x34')](_0x54e2b2[_0x7471('0x31')][_0x7471('0x34')]));_0x448581[_0x7471('0x33')]=_0x448581['attributes']['length']?_0x448581[_0x7471('0x33')]:_0x3865aa[_0x7471('0x2f')];_0x448581[_0x7471('0x36')]=qs[_0x7471('0x37')](_0x54e2b2[_0x7471('0x31')][_0x7471('0x37')]);_0x448581[_0x7471('0x38')]=qs[_0x7471('0x32')](_[_0x7471('0x48')](_0x54e2b2['query'],_0x3865aa['filters']));if(_0x54e2b2[_0x7471('0x31')]['filter']){_0x448581[_0x7471('0x38')]=_['merge'](_0x448581[_0x7471('0x38')],{'$or':_[_0x7471('0x2b')](_0x448581[_0x7471('0x33')],function(_0x559141){var _0x37b596={};_0x37b596[_0x559141]={'$like':'%'+_0x54e2b2[_0x7471('0x31')][_0x7471('0x39')]+'%'};return _0x37b596;})});}_0x448581=_[_0x7471('0x3a')]({},_0x448581,_0x54e2b2['options']);return _0x2fdf85[_0x7471('0x49')](_0x448581);}})[_0x7471('0x26')](function(_0x4eda6b){if(_0x4eda6b){_0x36927e=_0x4eda6b[_0x7471('0x42')];if(!_0x54e2b2[_0x7471('0x31')][_0x7471('0x4a')]('nolimit')){_0x448581[_0x7471('0x1f')]=qs[_0x7471('0x1f')](_0x54e2b2['query'][_0x7471('0x1f')]);_0x448581[_0x7471('0x1d')]=qs['offset'](_0x54e2b2[_0x7471('0x31')][_0x7471('0x1d')]);}return _0x2fdf85[_0x7471('0x49')](_0x448581);}})[_0x7471('0x26')](function(_0x43ee44){if(_0x43ee44){return _0x43ee44?{'count':_0x36927e,'rows':_0x43ee44}:null;}})[_0x7471('0x26')](respondWithResult(_0x180017,null))['catch'](handleError(_0x180017,null));};exports[_0x7471('0x4b')]=function(_0x183d14,_0x2b308f,_0x1f1957){if(_0x183d14[_0x7471('0x46')]['id']){delete _0x183d14[_0x7471('0x46')]['id'];}return db[_0x7471('0x2c')]['findOne']({'where':{'id':_0x183d14['params']['id']}})[_0x7471('0x26')](handleEntityNotFound(_0x2b308f,null))[_0x7471('0x26')](function(_0xb216c3){if(_0xb216c3){_0x183d14[_0x7471('0x46')]['AccountId']=_0xb216c3['id'];_0x183d14[_0x7471('0x46')][_0x7471('0x4c')]=integrations['getSubjects'](_0x183d14[_0x7471('0x46')][_0x7471('0x4d')],_0x183d14['body']['type']);_0x183d14['body'][_0x7471('0x4e')]=integrations[_0x7471('0x4f')](_0x183d14[_0x7471('0x46')]['channel'],_0x183d14[_0x7471('0x46')][_0x7471('0x2e')]);return db[_0x7471('0x50')][_0x7471('0x45')](_0x183d14[_0x7471('0x46')],{'include':[{'model':db[_0x7471('0x51')],'as':'Subjects'},{'model':db[_0x7471('0x51')],'as':'Descriptions'}]});}return null;})[_0x7471('0x26')](respondWithResult(_0x2b308f,null))['catch'](handleError(_0x2b308f,null));};exports['getFields']=function(_0x2f51d7,_0x30a80b,_0x5386b9){var _0x1b559a='';var _0x917239=['id','name',_0x7471('0x52'),_0x7471('0x53'),'description',_0x7471('0x54'),_0x7471('0x55'),_0x7471('0x56'),'parent_id',_0x7471('0x57'),_0x7471('0x58'),_0x7471('0x59')];return db[_0x7471('0x2c')][_0x7471('0x47')]({'where':{'id':_0x2f51d7[_0x7471('0x40')]['id']},'attributes':['id',_0x7471('0x5a'),_0x7471('0x5b'),_0x7471('0x5c')]})[_0x7471('0x26')](handleEntityNotFound(_0x30a80b,null))[_0x7471('0x26')](function(_0x3e0817){if(_0x3e0817){_0x1b559a=_0x3e0817['remoteUri'];var _0x14fc58=_0x1b559a[_0x7471('0x5d')](-0x1);if(_0x14fc58==='/'){_0x1b559a=_0x1b559a[_0x7471('0x5e')](0x0,_0x1b559a['lastIndexOf'](_0x14fc58));}return rp({'method':_0x7471('0x5f'),'uri':util['format'](_0x7471('0x60'),_0x1b559a,_0x7471('0x61')),'json':!![],'form':{'method':_0x7471('0x62'),'input_type':_0x7471('0x63'),'response_type':'JSON','rest_data':JSON[_0x7471('0x64')]({'user_auth':{'user_name':_0x3e0817[_0x7471('0x5a')],'password':_0x3e0817[_0x7471('0x5b')],'encryption':_0x7471('0x65')},'application':_0x7471('0x66')})}});}})[_0x7471('0x26')](function(_0x532596){if(_0x532596&&_0x532596['name']!==_0x7471('0x67')&&_0x532596[_0x7471('0x29')]!==_0x7471('0x68')){return rp({'method':'POST','uri':util[_0x7471('0x69')]('%s%s',_0x1b559a,_0x7471('0x61')),'json':!![],'form':{'method':_0x7471('0x6a'),'input_type':_0x7471('0x63'),'response_type':_0x7471('0x63'),'rest_data':JSON[_0x7471('0x64')]({'session':_0x532596['id'],'module_name':_0x7471('0x6b')})}})['then'](function(_0x5d2af6){if(_0x5d2af6){var _0x417605=_[_0x7471('0x6c')](_0x5d2af6[_0x7471('0x6d')]);_['remove'](_0x417605,function(_0xf0c41c){return _0x917239['includes'](_0xf0c41c[_0x7471('0x29')]);});return{'count':_0x417605[_0x7471('0x42')],'rows':_['map'](_0x417605,function(_0x1be62d){return{'id':_0x1be62d[_0x7471('0x29')],'name':_0x1be62d[_0x7471('0x6e')],'custom':_[_0x7471('0x6f')](_0x1be62d[_0x7471('0x29')],'_c')?!![]:![],'options':_0x1be62d[_0x7471('0x3b')]?_[_0x7471('0x2b')](_[_0x7471('0x6c')](_0x1be62d['options']),function(_0x36600b){return{'name':_0x36600b['value'],'value':_0x36600b[_0x7471('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x30a80b,null))['catch'](function(_0x42f1bb){var _0x35fea8=_0x2f51d7[_0x7471('0x31')]['test']?0x1f4:_0x42f1bb['statusCode']||0x1f4;logger['error'](_0x7471('0x70'),'getFields',_0x35fea8,JSON[_0x7471('0x64')](_0x42f1bb));delete _0x42f1bb[_0x7471('0x29')];if(_0x35fea8===0x191){_0x35fea8=0x190;}_0x30a80b[_0x7471('0x1a')](_0x35fea8)[_0x7471('0x71')](_0x2f51d7[_0x7471('0x31')]['test']?{'message':_0x7471('0x72'),'statusCode':_0x42f1bb['statusCode']}:_0x42f1bb);});}else{var _0x5d5425=0x1f4;_0x30a80b[_0x7471('0x1a')](_0x5d5425)['send']({'message':_0x7471('0x72'),'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 20d88bd..cc45dad 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 _0x2711=['int_sugarcrm_accounts','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount'];(function(_0x2b488f,_0x235261){var _0x1fd4de=function(_0xaa10c){while(--_0xaa10c){_0x2b488f['push'](_0x2b488f['shift']());}};_0x1fd4de(++_0x235261);}(_0x2711,0x1e1));var _0x1271=function(_0x11d084,_0x1236dc){_0x11d084=_0x11d084-0x0;var _0x4dc4cc=_0x2711[_0x11d084];return _0x4dc4cc;};'use strict';var _=require('lodash');var util=require(_0x1271('0x0'));var logger=require(_0x1271('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1271('0x2'));var rp=require(_0x1271('0x3'));var fs=require('fs');var path=require(_0x1271('0x4'));var rimraf=require(_0x1271('0x5'));var config=require(_0x1271('0x6'));var attributes=require(_0x1271('0x7'));var integrations=require(_0x1271('0x8'));module[_0x1271('0x9')]=function(_0x55021d,_0x109cdf){return _0x55021d['define'](_0x1271('0xa'),attributes,{'tableName':_0x1271('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f1a=['api','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x3c45bc,_0x25bdaf){var _0x43b00f=function(_0xd3c78f){while(--_0xd3c78f){_0x3c45bc['push'](_0x3c45bc['shift']());}};_0x43b00f(++_0x25bdaf);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x190177,_0xfa9cbd){_0x190177=_0x190177-0x0;var _0x23603d=_0x8f1a[_0x190177];return _0x23603d;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var logger=require(_0xa8f1('0x2'))(_0xa8f1('0x3'));var moment=require(_0xa8f1('0x4'));var BPromise=require(_0xa8f1('0x5'));var rp=require(_0xa8f1('0x6'));var fs=require('fs');var path=require(_0xa8f1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8f1('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xa8f1('0x9')]=function(_0x3d62e4,_0x4c2920){return _0x3d62e4[_0xa8f1('0xa')](_0xa8f1('0xb'),attributes,{'tableName':_0xa8f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 524c8d4..04ec082 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 _0xc67c=['GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','debug','find','ShowSugarcrmAccount','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xc67c,0x1e9));var _0xcc67=function(_0x546201,_0x49ee3e){_0x546201=_0x546201-0x0;var _0x57e598=_0xc67c[_0x546201];return _0x57e598;};'use strict';var _=require('lodash');var util=require(_0xcc67('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc67('0x1'));var fs=require('fs');var Redis=require(_0xcc67('0x2'));var db=require(_0xcc67('0x3'))['db'];var utils=require(_0xcc67('0x4'));var logger=require(_0xcc67('0x5'))(_0xcc67('0x6'));var config=require(_0xcc67('0x7'));var jayson=require(_0xcc67('0x8'));var client=jayson[_0xcc67('0x9')][_0xcc67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b54fd,_0xb46289,_0x394750){return new BPromise(function(_0x2db2e4,_0x48d097){return client['request'](_0x4b54fd,_0x394750)[_0xcc67('0xb')](function(_0x4b8be6){logger[_0xcc67('0xc')](_0xcc67('0xd'),_0xb46289,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xb46289,_0xcc67('0xe'),JSON[_0xcc67('0xf')](_0x4b8be6));if(_0x4b8be6[_0xcc67('0x10')]){if(_0x4b8be6['error'][_0xcc67('0x11')]===0x1f4){logger['error'](_0xcc67('0xd'),_0xb46289,_0x4b8be6['error'][_0xcc67('0x12')]);return _0x48d097(_0x4b8be6[_0xcc67('0x10')][_0xcc67('0x12')]);}logger[_0xcc67('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0xb46289,_0x4b8be6['error'][_0xcc67('0x12')]);return _0x2db2e4(_0x4b8be6[_0xcc67('0x10')][_0xcc67('0x12')]);}else{logger[_0xcc67('0xc')](_0xcc67('0xd'),_0xb46289,_0xcc67('0xe'));_0x2db2e4(_0x4b8be6[_0xcc67('0x13')][_0xcc67('0x12')]);}})[_0xcc67('0x14')](function(_0x2303d4){logger[_0xcc67('0x10')](_0xcc67('0xd'),_0xb46289,_0x2303d4);_0x48d097(_0x2303d4);});});}exports[_0xcc67('0x15')]=function(_0xb27b5f){var _0x7ca1f3=this;return new Promise(function(_0x956097,_0x82f648){return db[_0xcc67('0x16')]['findAll']({'raw':_0xb27b5f['options']?_0xb27b5f[_0xcc67('0x17')][_0xcc67('0x18')]===undefined?!![]:![]:!![],'where':_0xb27b5f[_0xcc67('0x17')]?_0xb27b5f[_0xcc67('0x17')][_0xcc67('0x19')]||null:null,'attributes':_0xb27b5f[_0xcc67('0x17')]?_0xb27b5f[_0xcc67('0x17')][_0xcc67('0x1a')]||null:null,'limit':_0xb27b5f[_0xcc67('0x17')]?_0xb27b5f[_0xcc67('0x17')][_0xcc67('0x1b')]||null:null,'include':_0xb27b5f[_0xcc67('0x17')]?_0xb27b5f['options'][_0xcc67('0x1c')]?_[_0xcc67('0x1d')](_0xb27b5f[_0xcc67('0x17')][_0xcc67('0x1c')],function(_0xb3da64){return{'model':db[_0xb3da64['model']],'as':_0xb3da64['as'],'attributes':_0xb3da64[_0xcc67('0x1a')],'include':_0xb3da64[_0xcc67('0x1c')]?_[_0xcc67('0x1d')](_0xb3da64[_0xcc67('0x1c')],function(_0x1b32cd){return{'model':db[_0x1b32cd['model']],'as':_0x1b32cd['as'],'attributes':_0x1b32cd[_0xcc67('0x1a')],'include':_0x1b32cd[_0xcc67('0x1c')]?_[_0xcc67('0x1d')](_0x1b32cd['include'],function(_0x149818){return{'model':db[_0x149818[_0xcc67('0x1e')]],'as':_0x149818['as'],'attributes':_0x149818['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc67('0xb')](function(_0x5877ea){logger[_0xcc67('0xc')](_0xcc67('0x15'),_0xb27b5f);logger[_0xcc67('0x1f')](_0xcc67('0x15'),_0xb27b5f,JSON['stringify'](_0x5877ea));_0x956097(_0x5877ea);})[_0xcc67('0x14')](function(_0x30390e){logger['error'](_0xcc67('0x15'),_0x30390e[_0xcc67('0x12')],_0xb27b5f);_0x82f648(_0x7ca1f3[_0xcc67('0x10')](0x1f4,_0x30390e[_0xcc67('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x2df25f){var _0x4a7dd1=this;return new Promise(function(_0x541f98,_0xd74b7c){return db[_0xcc67('0x16')][_0xcc67('0x20')]({'raw':_0x2df25f[_0xcc67('0x17')]?_0x2df25f['options'][_0xcc67('0x18')]===undefined?!![]:![]:!![],'where':_0x2df25f[_0xcc67('0x17')]?_0x2df25f[_0xcc67('0x17')]['where']||null:null,'attributes':_0x2df25f[_0xcc67('0x17')]?_0x2df25f[_0xcc67('0x17')][_0xcc67('0x1a')]||null:null,'include':_0x2df25f[_0xcc67('0x17')]?_0x2df25f[_0xcc67('0x17')][_0xcc67('0x1c')]?_[_0xcc67('0x1d')](_0x2df25f[_0xcc67('0x17')][_0xcc67('0x1c')],function(_0x1de7e3){return{'model':db[_0x1de7e3[_0xcc67('0x1e')]],'as':_0x1de7e3['as'],'attributes':_0x1de7e3[_0xcc67('0x1a')],'include':_0x1de7e3[_0xcc67('0x1c')]?_[_0xcc67('0x1d')](_0x1de7e3[_0xcc67('0x1c')],function(_0x32553c){return{'model':db[_0x32553c[_0xcc67('0x1e')]],'as':_0x32553c['as'],'attributes':_0x32553c[_0xcc67('0x1a')],'include':_0x32553c[_0xcc67('0x1c')]?_['map'](_0x32553c[_0xcc67('0x1c')],function(_0x9317b2){return{'model':db[_0x9317b2[_0xcc67('0x1e')]],'as':_0x9317b2['as'],'attributes':_0x9317b2[_0xcc67('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x416ce0){logger[_0xcc67('0xc')]('ShowSugarcrmAccount',_0x2df25f);logger[_0xcc67('0x1f')](_0xcc67('0x21'),_0x2df25f,JSON['stringify'](_0x416ce0));_0x541f98(_0x416ce0);})[_0xcc67('0x14')](function(_0x4d5c15){logger[_0xcc67('0x10')](_0xcc67('0x21'),_0x4d5c15[_0xcc67('0x12')],_0x2df25f);_0xd74b7c(_0x4a7dd1[_0xcc67('0x10')](0x1f4,_0x4d5c15[_0xcc67('0x12')]));});});}; \ No newline at end of file +var _0xf446=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','attributes','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','raw','lodash','util','moment'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0xf446,0x11d));var _0x6f44=function(_0x14462a,_0x468d3b){_0x14462a=_0x14462a-0x0;var _0x380faa=_0xf446[_0x14462a];return _0x380faa;};'use strict';var _=require(_0x6f44('0x0'));var util=require(_0x6f44('0x1'));var moment=require(_0x6f44('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f44('0x3'));var db=require(_0x6f44('0x4'))['db'];var utils=require(_0x6f44('0x5'));var logger=require('../../config/logger')(_0x6f44('0x6'));var config=require('../../config/environment');var jayson=require(_0x6f44('0x7'));var client=jayson[_0x6f44('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x371fce,_0x33d0a6,_0x50fdd1){return new BPromise(function(_0x4ec27d,_0x554827){return client['request'](_0x371fce,_0x50fdd1)[_0x6f44('0x9')](function(_0x535552){logger[_0x6f44('0xa')](_0x6f44('0xb'),_0x33d0a6,_0x6f44('0xc'));logger[_0x6f44('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x33d0a6,_0x6f44('0xc'),JSON[_0x6f44('0xe')](_0x535552));if(_0x535552[_0x6f44('0xf')]){if(_0x535552[_0x6f44('0xf')][_0x6f44('0x10')]===0x1f4){logger[_0x6f44('0xf')](_0x6f44('0xb'),_0x33d0a6,_0x535552[_0x6f44('0xf')][_0x6f44('0x11')]);return _0x554827(_0x535552[_0x6f44('0xf')][_0x6f44('0x11')]);}logger[_0x6f44('0xf')](_0x6f44('0xb'),_0x33d0a6,_0x535552[_0x6f44('0xf')][_0x6f44('0x11')]);return _0x4ec27d(_0x535552[_0x6f44('0xf')][_0x6f44('0x11')]);}else{logger[_0x6f44('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x33d0a6,_0x6f44('0xc'));_0x4ec27d(_0x535552[_0x6f44('0x12')][_0x6f44('0x11')]);}})[_0x6f44('0x13')](function(_0x566cb7){logger['error'](_0x6f44('0xb'),_0x33d0a6,_0x566cb7);_0x554827(_0x566cb7);});});}exports['GetSugarcrmAccount']=function(_0x460870){var _0x2260ce=this;return new Promise(function(_0x568ae9,_0x4534bd){return db['SugarcrmAccount'][_0x6f44('0x14')]({'raw':_0x460870[_0x6f44('0x15')]?_0x460870['options']['raw']===undefined?!![]:![]:!![],'where':_0x460870[_0x6f44('0x15')]?_0x460870[_0x6f44('0x15')][_0x6f44('0x16')]||null:null,'attributes':_0x460870[_0x6f44('0x15')]?_0x460870[_0x6f44('0x15')]['attributes']||null:null,'limit':_0x460870[_0x6f44('0x15')]?_0x460870[_0x6f44('0x15')][_0x6f44('0x17')]||null:null,'include':_0x460870[_0x6f44('0x15')]?_0x460870[_0x6f44('0x15')][_0x6f44('0x18')]?_[_0x6f44('0x19')](_0x460870[_0x6f44('0x15')][_0x6f44('0x18')],function(_0x1fdca0){return{'model':db[_0x1fdca0['model']],'as':_0x1fdca0['as'],'attributes':_0x1fdca0[_0x6f44('0x1a')],'include':_0x1fdca0[_0x6f44('0x18')]?_['map'](_0x1fdca0[_0x6f44('0x18')],function(_0x14bf3a){return{'model':db[_0x14bf3a[_0x6f44('0x1b')]],'as':_0x14bf3a['as'],'attributes':_0x14bf3a[_0x6f44('0x1a')],'include':_0x14bf3a[_0x6f44('0x18')]?_[_0x6f44('0x19')](_0x14bf3a[_0x6f44('0x18')],function(_0x44785e){return{'model':db[_0x44785e[_0x6f44('0x1b')]],'as':_0x44785e['as'],'attributes':_0x44785e[_0x6f44('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6f44('0x9')](function(_0x5b83f3){logger[_0x6f44('0xa')](_0x6f44('0x1c'),_0x460870);logger[_0x6f44('0xd')](_0x6f44('0x1c'),_0x460870,JSON[_0x6f44('0xe')](_0x5b83f3));_0x568ae9(_0x5b83f3);})[_0x6f44('0x13')](function(_0x57a0d7){logger['error'](_0x6f44('0x1c'),_0x57a0d7[_0x6f44('0x11')],_0x460870);_0x4534bd(_0x2260ce['error'](0x1f4,_0x57a0d7[_0x6f44('0x11')]));});});};exports[_0x6f44('0x1d')]=function(_0x19c735){var _0x97a656=this;return new Promise(function(_0x46d501,_0x2a4819){return db[_0x6f44('0x1e')]['find']({'raw':_0x19c735[_0x6f44('0x15')]?_0x19c735['options'][_0x6f44('0x1f')]===undefined?!![]:![]:!![],'where':_0x19c735['options']?_0x19c735[_0x6f44('0x15')][_0x6f44('0x16')]||null:null,'attributes':_0x19c735[_0x6f44('0x15')]?_0x19c735['options'][_0x6f44('0x1a')]||null:null,'include':_0x19c735[_0x6f44('0x15')]?_0x19c735[_0x6f44('0x15')]['include']?_[_0x6f44('0x19')](_0x19c735['options']['include'],function(_0x47f70b){return{'model':db[_0x47f70b[_0x6f44('0x1b')]],'as':_0x47f70b['as'],'attributes':_0x47f70b[_0x6f44('0x1a')],'include':_0x47f70b['include']?_[_0x6f44('0x19')](_0x47f70b[_0x6f44('0x18')],function(_0x50f6f3){return{'model':db[_0x50f6f3[_0x6f44('0x1b')]],'as':_0x50f6f3['as'],'attributes':_0x50f6f3[_0x6f44('0x1a')],'include':_0x50f6f3[_0x6f44('0x18')]?_[_0x6f44('0x19')](_0x50f6f3['include'],function(_0x1bf192){return{'model':db[_0x1bf192[_0x6f44('0x1b')]],'as':_0x1bf192['as'],'attributes':_0x1bf192['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x216bca){logger[_0x6f44('0xa')]('ShowSugarcrmAccount',_0x19c735);logger[_0x6f44('0xd')](_0x6f44('0x1d'),_0x19c735,JSON['stringify'](_0x216bca));_0x46d501(_0x216bca);})[_0x6f44('0x13')](function(_0x3fb27f){logger[_0x6f44('0xf')](_0x6f44('0x1d'),_0x3fb27f[_0x6f44('0x11')],_0x19c735);_0x2a4819(_0x97a656[_0x6f44('0xf')](0x1f4,_0x3fb27f[_0x6f44('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d4249bc..8a7d81b 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 _0x9ce3=['/:id/descriptions','create','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects'];(function(_0x250ac7,_0x1c3ac2){var _0x4f566e=function(_0x347a99){while(--_0x347a99){_0x250ac7['push'](_0x250ac7['shift']());}};_0x4f566e(++_0x1c3ac2);}(_0x9ce3,0x100));var _0x39ce=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x9ce3[_0x5575cd];return _0x4979a0;};'use strict';var multer=require(_0x39ce('0x0'));var util=require(_0x39ce('0x1'));var path=require(_0x39ce('0x2'));var timeout=require(_0x39ce('0x3'));var express=require(_0x39ce('0x4'));var router=express['Router']();var fs_extra=require(_0x39ce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x39ce('0x6'));var config=require(_0x39ce('0x7'));var controller=require(_0x39ce('0x8'));router[_0x39ce('0x9')]('/',auth[_0x39ce('0xa')](),controller[_0x39ce('0xb')]);router[_0x39ce('0x9')](_0x39ce('0xc'),auth['isAuthenticated'](),controller[_0x39ce('0xd')]);router['get']('/:id/fields',auth[_0x39ce('0xa')](),controller[_0x39ce('0xe')]);router['get'](_0x39ce('0xf'),auth['isAuthenticated'](),controller[_0x39ce('0x10')]);router['get'](_0x39ce('0x11'),auth[_0x39ce('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x39ce('0xa')](),controller[_0x39ce('0x12')]);router[_0x39ce('0x13')](_0x39ce('0xc'),auth[_0x39ce('0xa')](),controller['update']);router[_0x39ce('0x14')]('/:id',auth[_0x39ce('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8bdb=['getSubjects','/:id/descriptions','getDescriptions','post','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects'];(function(_0x3954db,_0x5bc187){var _0x1e0ee4=function(_0x4b5ed8){while(--_0x4b5ed8){_0x3954db['push'](_0x3954db['shift']());}};_0x1e0ee4(++_0x5bc187);}(_0x8bdb,0x132));var _0xb8bd=function(_0x5a8c17,_0x22256e){_0x5a8c17=_0x5a8c17-0x0;var _0x5a0df4=_0x8bdb[_0x5a8c17];return _0x5a0df4;};'use strict';var multer=require(_0xb8bd('0x0'));var util=require(_0xb8bd('0x1'));var path=require(_0xb8bd('0x2'));var timeout=require(_0xb8bd('0x3'));var express=require(_0xb8bd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb8bd('0x6'));var controller=require(_0xb8bd('0x7'));router[_0xb8bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8bd('0x9')]);router['get'](_0xb8bd('0xa'),auth['isAuthenticated'](),controller[_0xb8bd('0xb')]);router[_0xb8bd('0x8')](_0xb8bd('0xc'),auth[_0xb8bd('0xd')](),controller[_0xb8bd('0xe')]);router['get'](_0xb8bd('0xf'),auth[_0xb8bd('0xd')](),controller[_0xb8bd('0x10')]);router[_0xb8bd('0x8')](_0xb8bd('0x11'),auth[_0xb8bd('0xd')](),controller[_0xb8bd('0x12')]);router[_0xb8bd('0x13')]('/',auth[_0xb8bd('0xd')](),controller[_0xb8bd('0x14')]);router['put'](_0xb8bd('0xa'),auth[_0xb8bd('0xd')](),controller['update']);router[_0xb8bd('0x15')](_0xb8bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb8bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 3df4ea4..eeba500 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 _0xe3d9=['sequelize','STRING'];(function(_0x335e5e,_0x485b61){var _0x3d6b83=function(_0x3543b0){while(--_0x3543b0){_0x335e5e['push'](_0x335e5e['shift']());}};_0x3d6b83(++_0x485b61);}(_0xe3d9,0xe4));var _0x9e3d=function(_0x52da86,_0x6ed99b){_0x52da86=_0x52da86-0x0;var _0x4183fe=_0xe3d9[_0x52da86];return _0x4183fe;};'use strict';var Sequelize=require(_0x9e3d('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e3d('0x1')]},'description':{'type':Sequelize[_0x9e3d('0x1')]}}; \ No newline at end of file +var _0x5020=['exports','STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5020,0x167));var _0x0502=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x5020[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0502('0x0'));module[_0x0502('0x1')]={'name':{'type':Sequelize[_0x0502('0x2')]},'description':{'type':Sequelize[_0x0502('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5be7f78..c414e49 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 _0x9ab7=['include','rows','catch','show','find','create','body','destroy','params','getFields','findOne','SugarcrmField','getSubjects','order','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll'];(function(_0x190826,_0x24271c){var _0x3da89c=function(_0xe8826a){while(--_0xe8826a){_0x190826['push'](_0x190826['shift']());}};_0x3da89c(++_0x24271c);}(_0x9ab7,0x13f));var _0x79ab=function(_0x3ec51c,_0xc4c0c1){_0x3ec51c=_0x3ec51c-0x0;var _0x1ad708=_0x9ab7[_0x3ec51c];return _0x1ad708;};'use strict';var emlformat=require(_0x79ab('0x0'));var rimraf=require(_0x79ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79ab('0x2'));var rp=require(_0x79ab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x79ab('0x4'));var util=require(_0x79ab('0x5'));var path=require(_0x79ab('0x6'));var sox=require('sox');var csv=require(_0x79ab('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79ab('0x8'));var _=require('lodash');var squel=require(_0x79ab('0x9'));var crypto=require('crypto');var jsforce=require(_0x79ab('0xa'));var deskjs=require(_0x79ab('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x79ab('0xc'));var Redis=require(_0x79ab('0xd'));var authService=require(_0x79ab('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x79ab('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x79ab('0x10'));var utils=require('../../config/utils');var config=require(_0x79ab('0x11'));var licenseUtil=require(_0x79ab('0x12'));var db=require(_0x79ab('0x13'))['db'];function respondWithStatusCode(_0x99a89d,_0x53578c){_0x53578c=_0x53578c||0xcc;return function(_0x2cedb2){if(_0x2cedb2){return _0x99a89d['sendStatus'](_0x53578c);}return _0x99a89d['status'](_0x53578c)['end']();};}function respondWithResult(_0x47c5af,_0x348fa7){_0x348fa7=_0x348fa7||0xc8;return function(_0x13afdd){if(_0x13afdd){return _0x47c5af['status'](_0x348fa7)[_0x79ab('0x14')](_0x13afdd);}};}function respondWithFilteredResult(_0x2096c5,_0xf7be0){return function(_0x53f5d8){if(_0x53f5d8){var _0x3e11d3=typeof _0xf7be0[_0x79ab('0x15')]===_0x79ab('0x16')&&typeof _0xf7be0['limit']===_0x79ab('0x16');var _0x25e3c8=_0x53f5d8[_0x79ab('0x17')];var _0x3eaef7=_0x3e11d3?0x0:_0xf7be0['offset'];var _0x453789=_0x3e11d3?_0x53f5d8[_0x79ab('0x17')]:_0xf7be0[_0x79ab('0x15')]+_0xf7be0[_0x79ab('0x18')];var _0x1ae4aa;if(_0x453789>=_0x25e3c8){_0x453789=_0x25e3c8;_0x1ae4aa=0xc8;}else{_0x1ae4aa=0xce;}_0x2096c5[_0x79ab('0x19')](_0x1ae4aa);return _0x2096c5[_0x79ab('0x1a')](_0x79ab('0x1b'),_0x3eaef7+'-'+_0x453789+'/'+_0x25e3c8)[_0x79ab('0x14')](_0x53f5d8);}return null;};}function patchUpdates(_0x3a232e){return function(_0x1e9b01){try{jsonpatch[_0x79ab('0x1c')](_0x1e9b01,_0x3a232e,!![]);}catch(_0x39ca25){return BPromise[_0x79ab('0x1d')](_0x39ca25);}return _0x1e9b01[_0x79ab('0x1e')]();};}function saveUpdates(_0x378064,_0xe20000){return function(_0x47df17){if(_0x47df17){return _0x47df17[_0x79ab('0x1f')](_0x378064)[_0x79ab('0x20')](function(_0x3466d0){return _0x3466d0;});}return null;};}function removeEntity(_0x6b85b8,_0x4522d1){return function(_0x3b062c){if(_0x3b062c){return _0x3b062c['destroy']()['then'](function(){_0x6b85b8[_0x79ab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x404f05,_0x349256){return function(_0x266b26){if(!_0x266b26){_0x404f05['sendStatus'](0x194);}return _0x266b26;};}function handleError(_0x28434a,_0x4d82cb){_0x4d82cb=_0x4d82cb||0x1f4;return function(_0x14ab8c){logger[_0x79ab('0x21')](_0x14ab8c[_0x79ab('0x22')]);if(_0x14ab8c[_0x79ab('0x23')]){delete _0x14ab8c[_0x79ab('0x23')];}_0x28434a[_0x79ab('0x19')](_0x4d82cb)[_0x79ab('0x24')](_0x14ab8c);};}exports[_0x79ab('0x25')]=function(_0x15a7b7,_0x4ca2d4){var _0x2f5dd7={},_0x4b7ad5={},_0x2074ab={'count':0x0,'rows':[]};var _0x15ccdc=_[_0x79ab('0x26')](db[_0x79ab('0x27')][_0x79ab('0x28')],function(_0x2d768a){return{'name':_0x2d768a[_0x79ab('0x29')],'type':_0x2d768a[_0x79ab('0x2a')][_0x79ab('0x2b')]};});_0x4b7ad5[_0x79ab('0x2c')]=_[_0x79ab('0x26')](_0x15ccdc,'name');_0x4b7ad5['query']=_[_0x79ab('0x2d')](_0x15a7b7[_0x79ab('0x2e')]);_0x4b7ad5[_0x79ab('0x2f')]=_[_0x79ab('0x30')](_0x4b7ad5[_0x79ab('0x2c')],_0x4b7ad5[_0x79ab('0x2e')]);_0x2f5dd7['attributes']=_[_0x79ab('0x30')](_0x4b7ad5[_0x79ab('0x2c')],qs[_0x79ab('0x31')](_0x15a7b7['query']['fields']));_0x2f5dd7[_0x79ab('0x32')]=_0x2f5dd7[_0x79ab('0x32')][_0x79ab('0x33')]?_0x2f5dd7[_0x79ab('0x32')]:_0x4b7ad5['model'];if(!_0x15a7b7['query'][_0x79ab('0x34')](_0x79ab('0x35'))){_0x2f5dd7[_0x79ab('0x18')]=qs['limit'](_0x15a7b7[_0x79ab('0x2e')][_0x79ab('0x18')]);_0x2f5dd7['offset']=qs['offset'](_0x15a7b7[_0x79ab('0x2e')][_0x79ab('0x15')]);}_0x2f5dd7['order']=qs[_0x79ab('0x36')](_0x15a7b7[_0x79ab('0x2e')]['sort']);_0x2f5dd7[_0x79ab('0x37')]=qs[_0x79ab('0x2f')](_[_0x79ab('0x38')](_0x15a7b7['query'],_0x4b7ad5[_0x79ab('0x2f')]),_0x15ccdc);if(_0x15a7b7[_0x79ab('0x2e')][_0x79ab('0x39')]){_0x2f5dd7['where']=_[_0x79ab('0x3a')](_0x2f5dd7[_0x79ab('0x37')],{'$or':_['map'](_0x15ccdc,function(_0x3560ec){if(_0x3560ec[_0x79ab('0x2a')]!=='VIRTUAL'){var _0x197b93={};_0x197b93[_0x3560ec['name']]={'$like':'%'+_0x15a7b7[_0x79ab('0x2e')][_0x79ab('0x39')]+'%'};return _0x197b93;}})});}_0x2f5dd7=_[_0x79ab('0x3a')]({},_0x2f5dd7,_0x15a7b7[_0x79ab('0x3b')]);var _0x42ad52={'where':_0x2f5dd7[_0x79ab('0x37')]};return db[_0x79ab('0x27')]['count'](_0x42ad52)[_0x79ab('0x20')](function(_0x50caec){_0x2074ab[_0x79ab('0x17')]=_0x50caec;if(_0x15a7b7[_0x79ab('0x2e')][_0x79ab('0x3c')]){_0x2f5dd7[_0x79ab('0x3d')]=[{'all':!![]}];}return db[_0x79ab('0x27')]['findAll'](_0x2f5dd7);})[_0x79ab('0x20')](function(_0x74354f){_0x2074ab[_0x79ab('0x3e')]=_0x74354f;return _0x2074ab;})[_0x79ab('0x20')](respondWithFilteredResult(_0x4ca2d4,_0x2f5dd7))[_0x79ab('0x3f')](handleError(_0x4ca2d4,null));};exports[_0x79ab('0x40')]=function(_0x13b915,_0x3bc090){var _0x3f8fbc={'raw':![],'where':{'id':_0x13b915['params']['id']}},_0x2e724f={};_0x2e724f['model']=_[_0x79ab('0x2d')](db[_0x79ab('0x27')][_0x79ab('0x28')]);_0x2e724f[_0x79ab('0x2e')]=_[_0x79ab('0x2d')](_0x13b915[_0x79ab('0x2e')]);_0x2e724f['filters']=_['intersection'](_0x2e724f[_0x79ab('0x2c')],_0x2e724f[_0x79ab('0x2e')]);_0x3f8fbc[_0x79ab('0x32')]=_[_0x79ab('0x30')](_0x2e724f['model'],qs['fields'](_0x13b915['query'][_0x79ab('0x31')]));_0x3f8fbc[_0x79ab('0x32')]=_0x3f8fbc[_0x79ab('0x32')][_0x79ab('0x33')]?_0x3f8fbc['attributes']:_0x2e724f[_0x79ab('0x2c')];if(_0x13b915[_0x79ab('0x2e')][_0x79ab('0x3c')]){_0x3f8fbc['include']=[{'all':!![]}];}_0x3f8fbc=_[_0x79ab('0x3a')]({},_0x3f8fbc,_0x13b915[_0x79ab('0x3b')]);return db[_0x79ab('0x27')][_0x79ab('0x41')](_0x3f8fbc)[_0x79ab('0x20')](handleEntityNotFound(_0x3bc090,null))[_0x79ab('0x20')](respondWithResult(_0x3bc090,null))[_0x79ab('0x3f')](handleError(_0x3bc090,null));};exports[_0x79ab('0x42')]=function(_0xc6c9df,_0x428cd8){return db[_0x79ab('0x27')][_0x79ab('0x42')](_0xc6c9df['body'],{})[_0x79ab('0x20')](respondWithResult(_0x428cd8,0xc9))[_0x79ab('0x3f')](handleError(_0x428cd8,null));};exports['update']=function(_0x27cc24,_0x3ce83d){if(_0x27cc24['body']['id']){delete _0x27cc24[_0x79ab('0x43')]['id'];}return db[_0x79ab('0x27')][_0x79ab('0x41')]({'where':{'id':_0x27cc24['params']['id']}})[_0x79ab('0x20')](handleEntityNotFound(_0x3ce83d,null))[_0x79ab('0x20')](saveUpdates(_0x27cc24[_0x79ab('0x43')],null))['then'](respondWithResult(_0x3ce83d,null))[_0x79ab('0x3f')](handleError(_0x3ce83d,null));};exports[_0x79ab('0x44')]=function(_0xb976f1,_0x2241d1){return db[_0x79ab('0x27')][_0x79ab('0x41')]({'where':{'id':_0xb976f1[_0x79ab('0x45')]['id']}})[_0x79ab('0x20')](handleEntityNotFound(_0x2241d1,null))[_0x79ab('0x20')](removeEntity(_0x2241d1,null))[_0x79ab('0x3f')](handleError(_0x2241d1,null));};exports[_0x79ab('0x46')]=function(_0x2613b5,_0xcb3a7b,_0x5db597){var _0x5cf376={};var _0x2fc943={};var _0x225295;var _0x4b6237;return db[_0x79ab('0x27')][_0x79ab('0x47')]({'where':{'id':_0x2613b5[_0x79ab('0x45')]['id']}})['then'](handleEntityNotFound(_0xcb3a7b,null))[_0x79ab('0x20')](function(_0x7d180e){if(_0x7d180e){_0x225295=_0x7d180e;_0x2fc943[_0x79ab('0x2c')]=_['keys'](db[_0x79ab('0x48')]['rawAttributes']);_0x2fc943[_0x79ab('0x2e')]=_['keys'](_0x2613b5[_0x79ab('0x2e')]);_0x2fc943[_0x79ab('0x2f')]=_['intersection'](_0x2fc943['model'],_0x2fc943[_0x79ab('0x2e')]);_0x5cf376[_0x79ab('0x32')]=_[_0x79ab('0x30')](_0x2fc943[_0x79ab('0x2c')],qs[_0x79ab('0x31')](_0x2613b5[_0x79ab('0x2e')]['fields']));_0x5cf376[_0x79ab('0x32')]=_0x5cf376[_0x79ab('0x32')]['length']?_0x5cf376[_0x79ab('0x32')]:_0x2fc943[_0x79ab('0x2c')];_0x5cf376['order']=qs[_0x79ab('0x36')](_0x2613b5[_0x79ab('0x2e')][_0x79ab('0x36')]);_0x5cf376[_0x79ab('0x37')]=qs[_0x79ab('0x2f')](_[_0x79ab('0x38')](_0x2613b5[_0x79ab('0x2e')],_0x2fc943[_0x79ab('0x2f')]));if(_0x2613b5[_0x79ab('0x2e')][_0x79ab('0x39')]){_0x5cf376[_0x79ab('0x37')]=_[_0x79ab('0x3a')](_0x5cf376[_0x79ab('0x37')],{'$or':_[_0x79ab('0x26')](_0x5cf376[_0x79ab('0x32')],function(_0x43b42b){var _0xabf85={};_0xabf85[_0x43b42b]={'$like':'%'+_0x2613b5['query']['filter']+'%'};return _0xabf85;})});}_0x5cf376=_['merge']({},_0x5cf376,_0x2613b5[_0x79ab('0x3b')]);return _0x225295[_0x79ab('0x46')](_0x5cf376);}})[_0x79ab('0x20')](function(_0x4a4eda){if(_0x4a4eda){_0x4b6237=_0x4a4eda[_0x79ab('0x33')];if(!_0x2613b5['query']['hasOwnProperty'](_0x79ab('0x35'))){_0x5cf376[_0x79ab('0x18')]=qs[_0x79ab('0x18')](_0x2613b5[_0x79ab('0x2e')][_0x79ab('0x18')]);_0x5cf376[_0x79ab('0x15')]=qs[_0x79ab('0x15')](_0x2613b5['query'][_0x79ab('0x15')]);}return _0x225295[_0x79ab('0x46')](_0x5cf376);}})[_0x79ab('0x20')](function(_0x3d2a74){if(_0x3d2a74){return _0x3d2a74?{'count':_0x4b6237,'rows':_0x3d2a74}:null;}})[_0x79ab('0x20')](respondWithResult(_0xcb3a7b,null))[_0x79ab('0x3f')](handleError(_0xcb3a7b,null));};exports[_0x79ab('0x49')]=function(_0x785dab,_0x296423,_0x136203){var _0x358e34={};var _0x1bedd9={};var _0x1d4675;var _0x4cfe26;return db[_0x79ab('0x27')][_0x79ab('0x47')]({'where':{'id':_0x785dab[_0x79ab('0x45')]['id']}})[_0x79ab('0x20')](handleEntityNotFound(_0x296423,null))[_0x79ab('0x20')](function(_0x1dc620){if(_0x1dc620){_0x1d4675=_0x1dc620;_0x1bedd9[_0x79ab('0x2c')]=_[_0x79ab('0x2d')](db['SugarcrmField']['rawAttributes']);_0x1bedd9['query']=_[_0x79ab('0x2d')](_0x785dab[_0x79ab('0x2e')]);_0x1bedd9[_0x79ab('0x2f')]=_[_0x79ab('0x30')](_0x1bedd9[_0x79ab('0x2c')],_0x1bedd9[_0x79ab('0x2e')]);_0x358e34[_0x79ab('0x32')]=_[_0x79ab('0x30')](_0x1bedd9['model'],qs[_0x79ab('0x31')](_0x785dab[_0x79ab('0x2e')]['fields']));_0x358e34[_0x79ab('0x32')]=_0x358e34[_0x79ab('0x32')][_0x79ab('0x33')]?_0x358e34['attributes']:_0x1bedd9[_0x79ab('0x2c')];_0x358e34[_0x79ab('0x4a')]=qs[_0x79ab('0x36')](_0x785dab[_0x79ab('0x2e')][_0x79ab('0x36')]);_0x358e34[_0x79ab('0x37')]=qs[_0x79ab('0x2f')](_[_0x79ab('0x38')](_0x785dab[_0x79ab('0x2e')],_0x1bedd9['filters']));if(_0x785dab['query'][_0x79ab('0x39')]){_0x358e34['where']=_[_0x79ab('0x3a')](_0x358e34[_0x79ab('0x37')],{'$or':_[_0x79ab('0x26')](_0x358e34['attributes'],function(_0x4d97a3){var _0x67a611={};_0x67a611[_0x4d97a3]={'$like':'%'+_0x785dab[_0x79ab('0x2e')][_0x79ab('0x39')]+'%'};return _0x67a611;})});}_0x358e34=_[_0x79ab('0x3a')]({},_0x358e34,_0x785dab[_0x79ab('0x3b')]);return _0x1d4675['getSubjects'](_0x358e34);}})[_0x79ab('0x20')](function(_0x355882){if(_0x355882){_0x4cfe26=_0x355882[_0x79ab('0x33')];if(!_0x785dab[_0x79ab('0x2e')][_0x79ab('0x34')](_0x79ab('0x35'))){_0x358e34['limit']=qs['limit'](_0x785dab[_0x79ab('0x2e')]['limit']);_0x358e34[_0x79ab('0x15')]=qs[_0x79ab('0x15')](_0x785dab[_0x79ab('0x2e')][_0x79ab('0x15')]);}return _0x1d4675[_0x79ab('0x49')](_0x358e34);}})[_0x79ab('0x20')](function(_0x4aa5b3){if(_0x4aa5b3){return _0x4aa5b3?{'count':_0x4cfe26,'rows':_0x4aa5b3}:null;}})[_0x79ab('0x20')](respondWithResult(_0x296423,null))[_0x79ab('0x3f')](handleError(_0x296423,null));};exports['getDescriptions']=function(_0x47cfab,_0x152433,_0x41b0db){var _0xb22b79={};var _0x3da0dd={};var _0x3f45bc;var _0x4d6eb4;return db['SugarcrmConfiguration'][_0x79ab('0x47')]({'where':{'id':_0x47cfab[_0x79ab('0x45')]['id']}})[_0x79ab('0x20')](handleEntityNotFound(_0x152433,null))[_0x79ab('0x20')](function(_0xfec0ac){if(_0xfec0ac){_0x3f45bc=_0xfec0ac;_0x3da0dd[_0x79ab('0x2c')]=_[_0x79ab('0x2d')](db[_0x79ab('0x48')][_0x79ab('0x28')]);_0x3da0dd[_0x79ab('0x2e')]=_['keys'](_0x47cfab[_0x79ab('0x2e')]);_0x3da0dd[_0x79ab('0x2f')]=_[_0x79ab('0x30')](_0x3da0dd[_0x79ab('0x2c')],_0x3da0dd['query']);_0xb22b79['attributes']=_[_0x79ab('0x30')](_0x3da0dd[_0x79ab('0x2c')],qs[_0x79ab('0x31')](_0x47cfab[_0x79ab('0x2e')][_0x79ab('0x31')]));_0xb22b79['attributes']=_0xb22b79[_0x79ab('0x32')]['length']?_0xb22b79['attributes']:_0x3da0dd['model'];_0xb22b79[_0x79ab('0x4a')]=qs[_0x79ab('0x36')](_0x47cfab[_0x79ab('0x2e')]['sort']);_0xb22b79[_0x79ab('0x37')]=qs[_0x79ab('0x2f')](_[_0x79ab('0x38')](_0x47cfab[_0x79ab('0x2e')],_0x3da0dd[_0x79ab('0x2f')]));if(_0x47cfab[_0x79ab('0x2e')][_0x79ab('0x39')]){_0xb22b79['where']=_[_0x79ab('0x3a')](_0xb22b79[_0x79ab('0x37')],{'$or':_[_0x79ab('0x26')](_0xb22b79[_0x79ab('0x32')],function(_0x52f2dd){var _0x5f0d61={};_0x5f0d61[_0x52f2dd]={'$like':'%'+_0x47cfab['query'][_0x79ab('0x39')]+'%'};return _0x5f0d61;})});}_0xb22b79=_['merge']({},_0xb22b79,_0x47cfab[_0x79ab('0x3b')]);return _0x3f45bc['getDescriptions'](_0xb22b79);}})[_0x79ab('0x20')](function(_0x55a4c0){if(_0x55a4c0){_0x4d6eb4=_0x55a4c0[_0x79ab('0x33')];if(!_0x47cfab[_0x79ab('0x2e')][_0x79ab('0x34')](_0x79ab('0x35'))){_0xb22b79['limit']=qs[_0x79ab('0x18')](_0x47cfab[_0x79ab('0x2e')][_0x79ab('0x18')]);_0xb22b79[_0x79ab('0x15')]=qs['offset'](_0x47cfab[_0x79ab('0x2e')][_0x79ab('0x15')]);}return _0x3f45bc[_0x79ab('0x4b')](_0xb22b79);}})[_0x79ab('0x20')](function(_0x411509){if(_0x411509){return _0x411509?{'count':_0x4d6eb4,'rows':_0x411509}:null;}})[_0x79ab('0x20')](respondWithResult(_0x152433,null))['catch'](handleError(_0x152433,null));}; \ No newline at end of file +var _0xcd2f=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','keys','rawAttributes','options','find','create','body','params','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','crypto','jsforce'];(function(_0x2fc130,_0x1e4dc0){var _0xd5a6d1=function(_0x1375f8){while(--_0x1375f8){_0x2fc130['push'](_0x2fc130['shift']());}};_0xd5a6d1(++_0x1e4dc0);}(_0xcd2f,0x172));var _0xfcd2=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xcd2f[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0xfcd2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfcd2('0x1'));var rp=require(_0xfcd2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfcd2('0x3'));var util=require(_0xfcd2('0x4'));var path=require('path');var sox=require(_0xfcd2('0x5'));var csv=require(_0xfcd2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcd2('0x7'));var squel=require('squel');var crypto=require(_0xfcd2('0x8'));var jsforce=require(_0xfcd2('0x9'));var deskjs=require(_0xfcd2('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfcd2('0xb'));var Papa=require(_0xfcd2('0xc'));var Redis=require(_0xfcd2('0xd'));var authService=require(_0xfcd2('0xe'));var qs=require(_0xfcd2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcd2('0x10'))(_0xfcd2('0x11'));var utils=require('../../config/utils');var config=require(_0xfcd2('0x12'));var licenseUtil=require(_0xfcd2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29f363,_0x3cfcb5){_0x3cfcb5=_0x3cfcb5||0xcc;return function(_0x3d9251){if(_0x3d9251){return _0x29f363[_0xfcd2('0x14')](_0x3cfcb5);}return _0x29f363[_0xfcd2('0x15')](_0x3cfcb5)[_0xfcd2('0x16')]();};}function respondWithResult(_0x498631,_0x59187d){_0x59187d=_0x59187d||0xc8;return function(_0x53715a){if(_0x53715a){return _0x498631[_0xfcd2('0x15')](_0x59187d)[_0xfcd2('0x17')](_0x53715a);}};}function respondWithFilteredResult(_0x58c4f1,_0x488282){return function(_0x2c04a5){if(_0x2c04a5){var _0x3fef79=typeof _0x488282[_0xfcd2('0x18')]===_0xfcd2('0x19')&&typeof _0x488282[_0xfcd2('0x1a')]===_0xfcd2('0x19');var _0x53df15=_0x2c04a5[_0xfcd2('0x1b')];var _0x13ffd7=_0x3fef79?0x0:_0x488282['offset'];var _0x351257=_0x3fef79?_0x2c04a5[_0xfcd2('0x1b')]:_0x488282['offset']+_0x488282['limit'];var _0x49d637;if(_0x351257>=_0x53df15){_0x351257=_0x53df15;_0x49d637=0xc8;}else{_0x49d637=0xce;}_0x58c4f1['status'](_0x49d637);return _0x58c4f1[_0xfcd2('0x1c')](_0xfcd2('0x1d'),_0x13ffd7+'-'+_0x351257+'/'+_0x53df15)[_0xfcd2('0x17')](_0x2c04a5);}return null;};}function patchUpdates(_0x173cca){return function(_0xc660a8){try{jsonpatch[_0xfcd2('0x1e')](_0xc660a8,_0x173cca,!![]);}catch(_0x63b4db){return BPromise[_0xfcd2('0x1f')](_0x63b4db);}return _0xc660a8[_0xfcd2('0x20')]();};}function saveUpdates(_0x3601cd,_0x2e8d58){return function(_0x27205d){if(_0x27205d){return _0x27205d[_0xfcd2('0x21')](_0x3601cd)['then'](function(_0x3f7970){return _0x3f7970;});}return null;};}function removeEntity(_0x46501f,_0x5d5606){return function(_0x260b48){if(_0x260b48){return _0x260b48[_0xfcd2('0x22')]()[_0xfcd2('0x23')](function(){_0x46501f[_0xfcd2('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcea45b,_0x3b6641){return function(_0x1fa57c){if(!_0x1fa57c){_0xcea45b[_0xfcd2('0x14')](0x194);}return _0x1fa57c;};}function handleError(_0x463330,_0xb7000b){_0xb7000b=_0xb7000b||0x1f4;return function(_0x2946c7){logger['error'](_0x2946c7[_0xfcd2('0x24')]);if(_0x2946c7[_0xfcd2('0x25')]){delete _0x2946c7[_0xfcd2('0x25')];}_0x463330['status'](_0xb7000b)[_0xfcd2('0x26')](_0x2946c7);};}exports[_0xfcd2('0x27')]=function(_0xa31637,_0x84dee6){var _0x45c3cd={},_0x372855={},_0xca6c4d={'count':0x0,'rows':[]};var _0x53fe54=_[_0xfcd2('0x28')](db[_0xfcd2('0x29')]['rawAttributes'],function(_0x4d2aa9){return{'name':_0x4d2aa9[_0xfcd2('0x2a')],'type':_0x4d2aa9[_0xfcd2('0x2b')]['key']};});_0x372855[_0xfcd2('0x2c')]=_[_0xfcd2('0x28')](_0x53fe54,'name');_0x372855[_0xfcd2('0x2d')]=_['keys'](_0xa31637[_0xfcd2('0x2d')]);_0x372855[_0xfcd2('0x2e')]=_[_0xfcd2('0x2f')](_0x372855['model'],_0x372855[_0xfcd2('0x2d')]);_0x45c3cd['attributes']=_[_0xfcd2('0x2f')](_0x372855[_0xfcd2('0x2c')],qs[_0xfcd2('0x30')](_0xa31637[_0xfcd2('0x2d')][_0xfcd2('0x30')]));_0x45c3cd[_0xfcd2('0x31')]=_0x45c3cd[_0xfcd2('0x31')][_0xfcd2('0x32')]?_0x45c3cd[_0xfcd2('0x31')]:_0x372855[_0xfcd2('0x2c')];if(!_0xa31637[_0xfcd2('0x2d')][_0xfcd2('0x33')](_0xfcd2('0x34'))){_0x45c3cd[_0xfcd2('0x1a')]=qs[_0xfcd2('0x1a')](_0xa31637[_0xfcd2('0x2d')][_0xfcd2('0x1a')]);_0x45c3cd[_0xfcd2('0x18')]=qs['offset'](_0xa31637[_0xfcd2('0x2d')][_0xfcd2('0x18')]);}_0x45c3cd[_0xfcd2('0x35')]=qs[_0xfcd2('0x36')](_0xa31637[_0xfcd2('0x2d')][_0xfcd2('0x36')]);_0x45c3cd[_0xfcd2('0x37')]=qs['filters'](_[_0xfcd2('0x38')](_0xa31637[_0xfcd2('0x2d')],_0x372855['filters']),_0x53fe54);if(_0xa31637[_0xfcd2('0x2d')]['filter']){_0x45c3cd[_0xfcd2('0x37')]=_[_0xfcd2('0x39')](_0x45c3cd[_0xfcd2('0x37')],{'$or':_['map'](_0x53fe54,function(_0x38a6cd){if(_0x38a6cd['type']!=='VIRTUAL'){var _0x7e347d={};_0x7e347d[_0x38a6cd[_0xfcd2('0x25')]]={'$like':'%'+_0xa31637[_0xfcd2('0x2d')][_0xfcd2('0x3a')]+'%'};return _0x7e347d;}})});}_0x45c3cd=_['merge']({},_0x45c3cd,_0xa31637['options']);var _0x288d9c={'where':_0x45c3cd[_0xfcd2('0x37')]};return db['SugarcrmConfiguration'][_0xfcd2('0x1b')](_0x288d9c)[_0xfcd2('0x23')](function(_0x212bbc){_0xca6c4d[_0xfcd2('0x1b')]=_0x212bbc;if(_0xa31637[_0xfcd2('0x2d')][_0xfcd2('0x3b')]){_0x45c3cd[_0xfcd2('0x3c')]=[{'all':!![]}];}return db[_0xfcd2('0x29')]['findAll'](_0x45c3cd);})['then'](function(_0x15dfac){_0xca6c4d[_0xfcd2('0x3d')]=_0x15dfac;return _0xca6c4d;})[_0xfcd2('0x23')](respondWithFilteredResult(_0x84dee6,_0x45c3cd))[_0xfcd2('0x3e')](handleError(_0x84dee6,null));};exports[_0xfcd2('0x3f')]=function(_0x52a84d,_0x245333){var _0x4f5e08={'raw':![],'where':{'id':_0x52a84d['params']['id']}},_0x26f8d3={};_0x26f8d3[_0xfcd2('0x2c')]=_[_0xfcd2('0x40')](db[_0xfcd2('0x29')][_0xfcd2('0x41')]);_0x26f8d3[_0xfcd2('0x2d')]=_[_0xfcd2('0x40')](_0x52a84d[_0xfcd2('0x2d')]);_0x26f8d3[_0xfcd2('0x2e')]=_[_0xfcd2('0x2f')](_0x26f8d3['model'],_0x26f8d3[_0xfcd2('0x2d')]);_0x4f5e08[_0xfcd2('0x31')]=_['intersection'](_0x26f8d3[_0xfcd2('0x2c')],qs[_0xfcd2('0x30')](_0x52a84d[_0xfcd2('0x2d')][_0xfcd2('0x30')]));_0x4f5e08['attributes']=_0x4f5e08[_0xfcd2('0x31')]['length']?_0x4f5e08[_0xfcd2('0x31')]:_0x26f8d3['model'];if(_0x52a84d[_0xfcd2('0x2d')][_0xfcd2('0x3b')]){_0x4f5e08[_0xfcd2('0x3c')]=[{'all':!![]}];}_0x4f5e08=_[_0xfcd2('0x39')]({},_0x4f5e08,_0x52a84d[_0xfcd2('0x42')]);return db[_0xfcd2('0x29')][_0xfcd2('0x43')](_0x4f5e08)[_0xfcd2('0x23')](handleEntityNotFound(_0x245333,null))[_0xfcd2('0x23')](respondWithResult(_0x245333,null))[_0xfcd2('0x3e')](handleError(_0x245333,null));};exports[_0xfcd2('0x44')]=function(_0x3f3300,_0xb34c69){return db[_0xfcd2('0x29')][_0xfcd2('0x44')](_0x3f3300[_0xfcd2('0x45')],{})[_0xfcd2('0x23')](respondWithResult(_0xb34c69,0xc9))[_0xfcd2('0x3e')](handleError(_0xb34c69,null));};exports[_0xfcd2('0x21')]=function(_0x558def,_0x3e39a6){if(_0x558def['body']['id']){delete _0x558def['body']['id'];}return db[_0xfcd2('0x29')][_0xfcd2('0x43')]({'where':{'id':_0x558def[_0xfcd2('0x46')]['id']}})[_0xfcd2('0x23')](handleEntityNotFound(_0x3e39a6,null))['then'](saveUpdates(_0x558def['body'],null))['then'](respondWithResult(_0x3e39a6,null))['catch'](handleError(_0x3e39a6,null));};exports[_0xfcd2('0x22')]=function(_0x421157,_0x578887){return db['SugarcrmConfiguration'][_0xfcd2('0x43')]({'where':{'id':_0x421157[_0xfcd2('0x46')]['id']}})[_0xfcd2('0x23')](handleEntityNotFound(_0x578887,null))['then'](removeEntity(_0x578887,null))[_0xfcd2('0x3e')](handleError(_0x578887,null));};exports[_0xfcd2('0x47')]=function(_0x60834f,_0x177168,_0x459dd5){var _0x1033b5={};var _0xa5cb22={};var _0x271731;var _0xeb36d5;return db[_0xfcd2('0x29')][_0xfcd2('0x48')]({'where':{'id':_0x60834f[_0xfcd2('0x46')]['id']}})[_0xfcd2('0x23')](handleEntityNotFound(_0x177168,null))[_0xfcd2('0x23')](function(_0x44a430){if(_0x44a430){_0x271731=_0x44a430;_0xa5cb22['model']=_['keys'](db[_0xfcd2('0x49')]['rawAttributes']);_0xa5cb22[_0xfcd2('0x2d')]=_[_0xfcd2('0x40')](_0x60834f[_0xfcd2('0x2d')]);_0xa5cb22['filters']=_[_0xfcd2('0x2f')](_0xa5cb22[_0xfcd2('0x2c')],_0xa5cb22[_0xfcd2('0x2d')]);_0x1033b5[_0xfcd2('0x31')]=_[_0xfcd2('0x2f')](_0xa5cb22[_0xfcd2('0x2c')],qs[_0xfcd2('0x30')](_0x60834f[_0xfcd2('0x2d')][_0xfcd2('0x30')]));_0x1033b5['attributes']=_0x1033b5[_0xfcd2('0x31')][_0xfcd2('0x32')]?_0x1033b5['attributes']:_0xa5cb22[_0xfcd2('0x2c')];_0x1033b5[_0xfcd2('0x35')]=qs[_0xfcd2('0x36')](_0x60834f[_0xfcd2('0x2d')][_0xfcd2('0x36')]);_0x1033b5[_0xfcd2('0x37')]=qs[_0xfcd2('0x2e')](_[_0xfcd2('0x38')](_0x60834f[_0xfcd2('0x2d')],_0xa5cb22[_0xfcd2('0x2e')]));if(_0x60834f[_0xfcd2('0x2d')][_0xfcd2('0x3a')]){_0x1033b5[_0xfcd2('0x37')]=_['merge'](_0x1033b5[_0xfcd2('0x37')],{'$or':_['map'](_0x1033b5['attributes'],function(_0x57deaf){var _0x344666={};_0x344666[_0x57deaf]={'$like':'%'+_0x60834f['query'][_0xfcd2('0x3a')]+'%'};return _0x344666;})});}_0x1033b5=_[_0xfcd2('0x39')]({},_0x1033b5,_0x60834f[_0xfcd2('0x42')]);return _0x271731['getFields'](_0x1033b5);}})[_0xfcd2('0x23')](function(_0x1f2c3a){if(_0x1f2c3a){_0xeb36d5=_0x1f2c3a[_0xfcd2('0x32')];if(!_0x60834f[_0xfcd2('0x2d')][_0xfcd2('0x33')]('nolimit')){_0x1033b5['limit']=qs[_0xfcd2('0x1a')](_0x60834f[_0xfcd2('0x2d')][_0xfcd2('0x1a')]);_0x1033b5[_0xfcd2('0x18')]=qs[_0xfcd2('0x18')](_0x60834f[_0xfcd2('0x2d')][_0xfcd2('0x18')]);}return _0x271731[_0xfcd2('0x47')](_0x1033b5);}})[_0xfcd2('0x23')](function(_0x5d75f7){if(_0x5d75f7){return _0x5d75f7?{'count':_0xeb36d5,'rows':_0x5d75f7}:null;}})[_0xfcd2('0x23')](respondWithResult(_0x177168,null))[_0xfcd2('0x3e')](handleError(_0x177168,null));};exports[_0xfcd2('0x4a')]=function(_0x49ac6d,_0x11b954,_0x3289b9){var _0x11d92f={};var _0x22e869={};var _0x4743f6;var _0x502536;return db['SugarcrmConfiguration'][_0xfcd2('0x48')]({'where':{'id':_0x49ac6d[_0xfcd2('0x46')]['id']}})[_0xfcd2('0x23')](handleEntityNotFound(_0x11b954,null))['then'](function(_0x125754){if(_0x125754){_0x4743f6=_0x125754;_0x22e869[_0xfcd2('0x2c')]=_[_0xfcd2('0x40')](db[_0xfcd2('0x49')]['rawAttributes']);_0x22e869[_0xfcd2('0x2d')]=_['keys'](_0x49ac6d[_0xfcd2('0x2d')]);_0x22e869[_0xfcd2('0x2e')]=_['intersection'](_0x22e869[_0xfcd2('0x2c')],_0x22e869[_0xfcd2('0x2d')]);_0x11d92f[_0xfcd2('0x31')]=_[_0xfcd2('0x2f')](_0x22e869[_0xfcd2('0x2c')],qs[_0xfcd2('0x30')](_0x49ac6d[_0xfcd2('0x2d')][_0xfcd2('0x30')]));_0x11d92f[_0xfcd2('0x31')]=_0x11d92f[_0xfcd2('0x31')][_0xfcd2('0x32')]?_0x11d92f[_0xfcd2('0x31')]:_0x22e869['model'];_0x11d92f[_0xfcd2('0x35')]=qs[_0xfcd2('0x36')](_0x49ac6d[_0xfcd2('0x2d')][_0xfcd2('0x36')]);_0x11d92f[_0xfcd2('0x37')]=qs[_0xfcd2('0x2e')](_['pick'](_0x49ac6d['query'],_0x22e869[_0xfcd2('0x2e')]));if(_0x49ac6d[_0xfcd2('0x2d')][_0xfcd2('0x3a')]){_0x11d92f[_0xfcd2('0x37')]=_['merge'](_0x11d92f['where'],{'$or':_[_0xfcd2('0x28')](_0x11d92f[_0xfcd2('0x31')],function(_0x4ed9d8){var _0x4ca6c6={};_0x4ca6c6[_0x4ed9d8]={'$like':'%'+_0x49ac6d[_0xfcd2('0x2d')][_0xfcd2('0x3a')]+'%'};return _0x4ca6c6;})});}_0x11d92f=_['merge']({},_0x11d92f,_0x49ac6d[_0xfcd2('0x42')]);return _0x4743f6['getSubjects'](_0x11d92f);}})[_0xfcd2('0x23')](function(_0x487107){if(_0x487107){_0x502536=_0x487107['length'];if(!_0x49ac6d[_0xfcd2('0x2d')]['hasOwnProperty'](_0xfcd2('0x34'))){_0x11d92f[_0xfcd2('0x1a')]=qs[_0xfcd2('0x1a')](_0x49ac6d['query'][_0xfcd2('0x1a')]);_0x11d92f['offset']=qs['offset'](_0x49ac6d[_0xfcd2('0x2d')][_0xfcd2('0x18')]);}return _0x4743f6[_0xfcd2('0x4a')](_0x11d92f);}})['then'](function(_0xbb0d7f){if(_0xbb0d7f){return _0xbb0d7f?{'count':_0x502536,'rows':_0xbb0d7f}:null;}})['then'](respondWithResult(_0x11b954,null))[_0xfcd2('0x3e')](handleError(_0x11b954,null));};exports[_0xfcd2('0x4b')]=function(_0x385978,_0x4805a3,_0x20b7fd){var _0x401f48={};var _0x1c7354={};var _0x3329d1;var _0x175122;return db[_0xfcd2('0x29')][_0xfcd2('0x48')]({'where':{'id':_0x385978[_0xfcd2('0x46')]['id']}})['then'](handleEntityNotFound(_0x4805a3,null))['then'](function(_0xa39629){if(_0xa39629){_0x3329d1=_0xa39629;_0x1c7354[_0xfcd2('0x2c')]=_[_0xfcd2('0x40')](db[_0xfcd2('0x49')][_0xfcd2('0x41')]);_0x1c7354[_0xfcd2('0x2d')]=_['keys'](_0x385978['query']);_0x1c7354[_0xfcd2('0x2e')]=_['intersection'](_0x1c7354[_0xfcd2('0x2c')],_0x1c7354[_0xfcd2('0x2d')]);_0x401f48[_0xfcd2('0x31')]=_[_0xfcd2('0x2f')](_0x1c7354[_0xfcd2('0x2c')],qs[_0xfcd2('0x30')](_0x385978[_0xfcd2('0x2d')]['fields']));_0x401f48['attributes']=_0x401f48['attributes'][_0xfcd2('0x32')]?_0x401f48[_0xfcd2('0x31')]:_0x1c7354['model'];_0x401f48[_0xfcd2('0x35')]=qs[_0xfcd2('0x36')](_0x385978['query']['sort']);_0x401f48['where']=qs[_0xfcd2('0x2e')](_[_0xfcd2('0x38')](_0x385978[_0xfcd2('0x2d')],_0x1c7354[_0xfcd2('0x2e')]));if(_0x385978['query'][_0xfcd2('0x3a')]){_0x401f48['where']=_[_0xfcd2('0x39')](_0x401f48[_0xfcd2('0x37')],{'$or':_['map'](_0x401f48['attributes'],function(_0x5a2167){var _0x40a6df={};_0x40a6df[_0x5a2167]={'$like':'%'+_0x385978[_0xfcd2('0x2d')][_0xfcd2('0x3a')]+'%'};return _0x40a6df;})});}_0x401f48=_['merge']({},_0x401f48,_0x385978[_0xfcd2('0x42')]);return _0x3329d1[_0xfcd2('0x4b')](_0x401f48);}})[_0xfcd2('0x23')](function(_0x28aa2a){if(_0x28aa2a){_0x175122=_0x28aa2a[_0xfcd2('0x32')];if(!_0x385978['query'][_0xfcd2('0x33')](_0xfcd2('0x34'))){_0x401f48[_0xfcd2('0x1a')]=qs[_0xfcd2('0x1a')](_0x385978[_0xfcd2('0x2d')]['limit']);_0x401f48['offset']=qs[_0xfcd2('0x18')](_0x385978['query'][_0xfcd2('0x18')]);}return _0x3329d1[_0xfcd2('0x4b')](_0x401f48);}})[_0xfcd2('0x23')](function(_0x3eea1a){if(_0x3eea1a){return _0x3eea1a?{'count':_0x175122,'rows':_0x3eea1a}:null;}})[_0xfcd2('0x23')](respondWithResult(_0x4805a3,null))[_0xfcd2('0x3e')](handleError(_0x4805a3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7e6df09..f0f5e41 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 _0xd763=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash'];(function(_0x284b34,_0x12833b){var _0x3d7ab1=function(_0x4f7ab8){while(--_0x4f7ab8){_0x284b34['push'](_0x284b34['shift']());}};_0x3d7ab1(++_0x12833b);}(_0xd763,0x12b));var _0x3d76=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd763[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x3d76('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3d76('0x1'));var moment=require(_0x3d76('0x2'));var BPromise=require(_0x3d76('0x3'));var rp=require(_0x3d76('0x4'));var fs=require('fs');var path=require(_0x3d76('0x5'));var rimraf=require(_0x3d76('0x6'));var config=require(_0x3d76('0x7'));var attributes=require(_0x3d76('0x8'));module[_0x3d76('0x9')]=function(_0x34206f,_0x2a353c){return _0x34206f[_0x3d76('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x3d76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecb0=['lodash','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration'];(function(_0x54b637,_0x53af68){var _0x522f8f=function(_0x22c35f){while(--_0x22c35f){_0x54b637['push'](_0x54b637['shift']());}};_0x522f8f(++_0x53af68);}(_0xecb0,0xf0));var _0x0ecb=function(_0x387730,_0x530a33){_0x387730=_0x387730-0x0;var _0xa6d36=_0xecb0[_0x387730];return _0xa6d36;};'use strict';var _=require(_0x0ecb('0x0'));var util=require('util');var logger=require(_0x0ecb('0x1'))(_0x0ecb('0x2'));var moment=require(_0x0ecb('0x3'));var BPromise=require(_0x0ecb('0x4'));var rp=require(_0x0ecb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ecb('0x6'));module['exports']=function(_0x3e9367,_0x427f58){return _0x3e9367['define'](_0x0ecb('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 66c919f..6905c87 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 _0xf2f2=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','result','catch'];(function(_0x16a101,_0x12caba){var _0x47b258=function(_0x1d4a8b){while(--_0x1d4a8b){_0x16a101['push'](_0x16a101['shift']());}};_0x47b258(++_0x12caba);}(_0xf2f2,0x1b8));var _0x2f2f=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xf2f2[_0x3c2a69];return _0x596bc8;};'use strict';var _=require('lodash');var util=require(_0x2f2f('0x0'));var moment=require(_0x2f2f('0x1'));var BPromise=require(_0x2f2f('0x2'));var rs=require(_0x2f2f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f2f('0x4'))['db'];var utils=require(_0x2f2f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f2f('0x6'));var jayson=require(_0x2f2f('0x7'));var client=jayson[_0x2f2f('0x8')][_0x2f2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x453f04,_0x4b46be,_0x5ab956){return new BPromise(function(_0x5dedd0,_0x1edbb8){return client[_0x2f2f('0xa')](_0x453f04,_0x5ab956)[_0x2f2f('0xb')](function(_0x12d7cb){logger[_0x2f2f('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b46be,'request\x20sent');logger[_0x2f2f('0xd')](_0x2f2f('0xe'),_0x4b46be,'request\x20sent',JSON['stringify'](_0x12d7cb));if(_0x12d7cb[_0x2f2f('0xf')]){if(_0x12d7cb[_0x2f2f('0xf')][_0x2f2f('0x10')]===0x1f4){logger[_0x2f2f('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b46be,_0x12d7cb[_0x2f2f('0xf')]['message']);return _0x1edbb8(_0x12d7cb[_0x2f2f('0xf')][_0x2f2f('0x11')]);}logger[_0x2f2f('0xf')](_0x2f2f('0x12'),_0x4b46be,_0x12d7cb['error'][_0x2f2f('0x11')]);return _0x5dedd0(_0x12d7cb[_0x2f2f('0xf')][_0x2f2f('0x11')]);}else{logger[_0x2f2f('0xc')](_0x2f2f('0x12'),_0x4b46be,_0x2f2f('0x13'));_0x5dedd0(_0x12d7cb[_0x2f2f('0x14')][_0x2f2f('0x11')]);}})[_0x2f2f('0x15')](function(_0x184d37){logger[_0x2f2f('0xf')](_0x2f2f('0x12'),_0x4b46be,_0x184d37);_0x1edbb8(_0x184d37);});});} \ No newline at end of file +var _0x47bb=['request','then','info','request\x20sent','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0xc9b026,_0x1a9335){var _0x202bac=function(_0x7fa680){while(--_0x7fa680){_0xc9b026['push'](_0xc9b026['shift']());}};_0x202bac(++_0x1a9335);}(_0x47bb,0x8e));var _0xb47b=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x47bb[_0x2cdd4d];return _0x55cbc8;};'use strict';var _=require(_0xb47b('0x0'));var util=require(_0xb47b('0x1'));var moment=require(_0xb47b('0x2'));var BPromise=require(_0xb47b('0x3'));var rs=require(_0xb47b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb47b('0x5'))['db'];var utils=require(_0xb47b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb47b('0x7'));var client=jayson[_0xb47b('0x8')][_0xb47b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xac0dc0,_0x572556,_0xf3d01c){return new BPromise(function(_0xf3f804,_0x4d400d){return client[_0xb47b('0xa')](_0xac0dc0,_0xf3d01c)[_0xb47b('0xb')](function(_0x57b537){logger[_0xb47b('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x572556,_0xb47b('0xd'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x572556,'request\x20sent',JSON['stringify'](_0x57b537));if(_0x57b537[_0xb47b('0xe')]){if(_0x57b537[_0xb47b('0xe')][_0xb47b('0xf')]===0x1f4){logger[_0xb47b('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x572556,_0x57b537[_0xb47b('0xe')][_0xb47b('0x10')]);return _0x4d400d(_0x57b537[_0xb47b('0xe')][_0xb47b('0x10')]);}logger[_0xb47b('0xe')](_0xb47b('0x11'),_0x572556,_0x57b537[_0xb47b('0xe')][_0xb47b('0x10')]);return _0xf3f804(_0x57b537[_0xb47b('0xe')][_0xb47b('0x10')]);}else{logger[_0xb47b('0xc')](_0xb47b('0x11'),_0x572556,'request\x20sent');_0xf3f804(_0x57b537['result'][_0xb47b('0x10')]);}})[_0xb47b('0x12')](function(_0x1d53aa){logger[_0xb47b('0xe')](_0xb47b('0x11'),_0x572556,_0x1d53aa);_0x4d400d(_0x1d53aa);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e68eba5..56cd2a9 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 _0xbc49=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x36888d,_0x22988e){var _0x14f524=function(_0x5cdbfe){while(--_0x5cdbfe){_0x36888d['push'](_0x36888d['shift']());}};_0x14f524(++_0x22988e);}(_0xbc49,0x11b));var _0x9bc4=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0xbc49[_0x547ff4];return _0xe41057;};'use strict';var multer=require(_0x9bc4('0x0'));var util=require(_0x9bc4('0x1'));var path=require(_0x9bc4('0x2'));var timeout=require(_0x9bc4('0x3'));var express=require(_0x9bc4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9bc4('0x5'));var interaction=require(_0x9bc4('0x6'));var config=require(_0x9bc4('0x7'));var controller=require(_0x9bc4('0x8'));router[_0x9bc4('0x9')]('/',auth[_0x9bc4('0xa')](),controller[_0x9bc4('0xb')]);router[_0x9bc4('0x9')]('/:id',auth[_0x9bc4('0xa')](),controller[_0x9bc4('0xc')]);router[_0x9bc4('0xd')]('/',auth[_0x9bc4('0xa')](),controller[_0x9bc4('0xe')]);router[_0x9bc4('0xf')](_0x9bc4('0x10'),auth[_0x9bc4('0xa')](),controller[_0x9bc4('0x11')]);router[_0x9bc4('0x12')]('/:id',auth[_0x9bc4('0xa')](),controller[_0x9bc4('0x13')]);module[_0x9bc4('0x14')]=router; \ No newline at end of file +var _0xbfd1=['isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id'];(function(_0x42a33b,_0x308e12){var _0x3c7012=function(_0x1ba25f){while(--_0x1ba25f){_0x42a33b['push'](_0x42a33b['shift']());}};_0x3c7012(++_0x308e12);}(_0xbfd1,0x125));var _0x1bfd=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xbfd1[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x1bfd('0x0'));var util=require('util');var path=require(_0x1bfd('0x1'));var timeout=require(_0x1bfd('0x2'));var express=require(_0x1bfd('0x3'));var router=express['Router']();var fs_extra=require(_0x1bfd('0x4'));var auth=require(_0x1bfd('0x5'));var interaction=require(_0x1bfd('0x6'));var config=require(_0x1bfd('0x7'));var controller=require(_0x1bfd('0x8'));router[_0x1bfd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1bfd('0x9')](_0x1bfd('0xa'),auth[_0x1bfd('0xb')](),controller[_0x1bfd('0xc')]);router[_0x1bfd('0xd')]('/',auth[_0x1bfd('0xb')](),controller[_0x1bfd('0xe')]);router[_0x1bfd('0xf')](_0x1bfd('0xa'),auth[_0x1bfd('0xb')](),controller[_0x1bfd('0x10')]);router['delete'](_0x1bfd('0xa'),auth[_0x1bfd('0xb')](),controller[_0x1bfd('0x11')]);module[_0x1bfd('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 3fec39a..6b596f9 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 _0x1f17=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x5ac0b3,_0x3e20fb){var _0x4cb82e=function(_0x3d6df2){while(--_0x3d6df2){_0x5ac0b3['push'](_0x5ac0b3['shift']());}};_0x4cb82e(++_0x3e20fb);}(_0x1f17,0x1ef));var _0x71f1=function(_0x52b828,_0x359d0f){_0x52b828=_0x52b828-0x0;var _0x2721d8=_0x1f17[_0x52b828];return _0x2721d8;};'use strict';var Sequelize=require(_0x71f1('0x0'));module['exports']={'type':{'type':Sequelize[_0x71f1('0x1')](_0x71f1('0x2'),_0x71f1('0x3'),_0x71f1('0x4'),_0x71f1('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x71f1('0x6')]},'keyType':{'type':Sequelize[_0x71f1('0x1')]('string',_0x71f1('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x71f1('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x71f1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7e63=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports'];(function(_0x954e0,_0x5e02e8){var _0x4ca7ae=function(_0x1c3050){while(--_0x1c3050){_0x954e0['push'](_0x954e0['shift']());}};_0x4ca7ae(++_0x5e02e8);}(_0x7e63,0x1a5));var _0x37e6=function(_0x244682,_0x5c5432){_0x244682=_0x244682-0x0;var _0x1fd9ac=_0x7e63[_0x244682];return _0x1fd9ac;};'use strict';var Sequelize=require(_0x37e6('0x0'));module[_0x37e6('0x1')]={'type':{'type':Sequelize[_0x37e6('0x2')](_0x37e6('0x3'),_0x37e6('0x4'),'customVariable',_0x37e6('0x5'),_0x37e6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x37e6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x37e6('0x3'),'variable',_0x37e6('0x8'))},'keyContent':{'type':Sequelize[_0x37e6('0x7')]},'idField':{'type':Sequelize[_0x37e6('0x7')]},'nameField':{'type':Sequelize[_0x37e6('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x37e6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e806b8a..275e78f 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 _0x815c=['fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SugarcrmField','include','findAll','show','params','includeAll','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x31ebd0,_0x522270){var _0x544981=function(_0x571a71){while(--_0x571a71){_0x31ebd0['push'](_0x31ebd0['shift']());}};_0x544981(++_0x522270);}(_0x815c,0xf9));var _0xc815=function(_0x301486,_0x27b799){_0x301486=_0x301486-0x0;var _0x418d16=_0x815c[_0x301486];return _0x418d16;};'use strict';var emlformat=require(_0xc815('0x0'));var rimraf=require(_0xc815('0x1'));var zipdir=require(_0xc815('0x2'));var jsonpatch=require(_0xc815('0x3'));var rp=require(_0xc815('0x4'));var moment=require(_0xc815('0x5'));var BPromise=require(_0xc815('0x6'));var Mustache=require(_0xc815('0x7'));var util=require('util');var path=require(_0xc815('0x8'));var sox=require(_0xc815('0x9'));var csv=require(_0xc815('0xa'));var ejs=require(_0xc815('0xb'));var fs=require('fs');var fs_extra=require(_0xc815('0xc'));var _=require(_0xc815('0xd'));var squel=require(_0xc815('0xe'));var crypto=require('crypto');var jsforce=require(_0xc815('0xf'));var deskjs=require(_0xc815('0x10'));var toCsv=require(_0xc815('0xa'));var querystring=require(_0xc815('0x11'));var Papa=require(_0xc815('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc815('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc815('0x14'))(_0xc815('0x15'));var utils=require(_0xc815('0x16'));var config=require(_0xc815('0x17'));var licenseUtil=require(_0xc815('0x18'));var db=require(_0xc815('0x19'))['db'];function respondWithStatusCode(_0x25678f,_0x2b8f38){_0x2b8f38=_0x2b8f38||0xcc;return function(_0x6be9b2){if(_0x6be9b2){return _0x25678f['sendStatus'](_0x2b8f38);}return _0x25678f[_0xc815('0x1a')](_0x2b8f38)['end']();};}function respondWithResult(_0x390ad7,_0x2d1b14){_0x2d1b14=_0x2d1b14||0xc8;return function(_0x5c3ea5){if(_0x5c3ea5){return _0x390ad7[_0xc815('0x1a')](_0x2d1b14)['json'](_0x5c3ea5);}};}function respondWithFilteredResult(_0x245947,_0x206628){return function(_0x2c28af){if(_0x2c28af){var _0x2c9238=typeof _0x206628[_0xc815('0x1b')]===_0xc815('0x1c')&&typeof _0x206628['limit']==='undefined';var _0x1c6213=_0x2c28af['count'];var _0x30f112=_0x2c9238?0x0:_0x206628[_0xc815('0x1b')];var _0x307880=_0x2c9238?_0x2c28af[_0xc815('0x1d')]:_0x206628['offset']+_0x206628[_0xc815('0x1e')];var _0x4d0c38;if(_0x307880>=_0x1c6213){_0x307880=_0x1c6213;_0x4d0c38=0xc8;}else{_0x4d0c38=0xce;}_0x245947[_0xc815('0x1a')](_0x4d0c38);return _0x245947[_0xc815('0x1f')](_0xc815('0x20'),_0x30f112+'-'+_0x307880+'/'+_0x1c6213)[_0xc815('0x21')](_0x2c28af);}return null;};}function patchUpdates(_0x4e6050){return function(_0x2a4d77){try{jsonpatch['apply'](_0x2a4d77,_0x4e6050,!![]);}catch(_0x4263da){return BPromise[_0xc815('0x22')](_0x4263da);}return _0x2a4d77[_0xc815('0x23')]();};}function saveUpdates(_0x316b29,_0x5ca325){return function(_0x2a2a9f){if(_0x2a2a9f){return _0x2a2a9f['update'](_0x316b29)[_0xc815('0x24')](function(_0x30135a){return _0x30135a;});}return null;};}function removeEntity(_0x56eda9,_0x1aaf2b){return function(_0x61b11a){if(_0x61b11a){return _0x61b11a[_0xc815('0x25')]()['then'](function(){_0x56eda9[_0xc815('0x1a')](0xcc)[_0xc815('0x26')]();});}};}function handleEntityNotFound(_0x448f9e,_0x568bb5){return function(_0x1082b3){if(!_0x1082b3){_0x448f9e[_0xc815('0x27')](0x194);}return _0x1082b3;};}function handleError(_0x345d8c,_0xfbcf4){_0xfbcf4=_0xfbcf4||0x1f4;return function(_0x199248){logger[_0xc815('0x28')](_0x199248[_0xc815('0x29')]);if(_0x199248[_0xc815('0x2a')]){delete _0x199248[_0xc815('0x2a')];}_0x345d8c[_0xc815('0x1a')](_0xfbcf4)[_0xc815('0x2b')](_0x199248);};}exports[_0xc815('0x2c')]=function(_0x5390e6,_0x21e45e){var _0x5c0d72={},_0x4b204f={},_0x3e7e58={'count':0x0,'rows':[]};var _0x26eae6=_[_0xc815('0x2d')](db['SugarcrmField'][_0xc815('0x2e')],function(_0x3dcce9){return{'name':_0x3dcce9['fieldName'],'type':_0x3dcce9[_0xc815('0x2f')][_0xc815('0x30')]};});_0x4b204f[_0xc815('0x31')]=_['map'](_0x26eae6,'name');_0x4b204f[_0xc815('0x32')]=_[_0xc815('0x33')](_0x5390e6[_0xc815('0x32')]);_0x4b204f[_0xc815('0x34')]=_[_0xc815('0x35')](_0x4b204f[_0xc815('0x31')],_0x4b204f[_0xc815('0x32')]);_0x5c0d72[_0xc815('0x36')]=_[_0xc815('0x35')](_0x4b204f[_0xc815('0x31')],qs['fields'](_0x5390e6['query'][_0xc815('0x37')]));_0x5c0d72[_0xc815('0x36')]=_0x5c0d72['attributes'][_0xc815('0x38')]?_0x5c0d72['attributes']:_0x4b204f[_0xc815('0x31')];if(!_0x5390e6['query'][_0xc815('0x39')](_0xc815('0x3a'))){_0x5c0d72[_0xc815('0x1e')]=qs['limit'](_0x5390e6[_0xc815('0x32')][_0xc815('0x1e')]);_0x5c0d72[_0xc815('0x1b')]=qs[_0xc815('0x1b')](_0x5390e6[_0xc815('0x32')][_0xc815('0x1b')]);}_0x5c0d72['order']=qs[_0xc815('0x3b')](_0x5390e6['query'][_0xc815('0x3b')]);_0x5c0d72[_0xc815('0x3c')]=qs[_0xc815('0x34')](_['pick'](_0x5390e6[_0xc815('0x32')],_0x4b204f['filters']),_0x26eae6);if(_0x5390e6[_0xc815('0x32')][_0xc815('0x3d')]){_0x5c0d72[_0xc815('0x3c')]=_[_0xc815('0x3e')](_0x5c0d72[_0xc815('0x3c')],{'$or':_[_0xc815('0x2d')](_0x26eae6,function(_0x10c32f){if(_0x10c32f[_0xc815('0x2f')]!==_0xc815('0x3f')){var _0x822ad2={};_0x822ad2[_0x10c32f['name']]={'$like':'%'+_0x5390e6[_0xc815('0x32')]['filter']+'%'};return _0x822ad2;}})});}_0x5c0d72=_['merge']({},_0x5c0d72,_0x5390e6[_0xc815('0x40')]);var _0x5e370c={'where':_0x5c0d72[_0xc815('0x3c')]};return db[_0xc815('0x41')][_0xc815('0x1d')](_0x5e370c)[_0xc815('0x24')](function(_0x4e5800){_0x3e7e58[_0xc815('0x1d')]=_0x4e5800;if(_0x5390e6[_0xc815('0x32')]['includeAll']){_0x5c0d72[_0xc815('0x42')]=[{'all':!![]}];}return db[_0xc815('0x41')][_0xc815('0x43')](_0x5c0d72);})[_0xc815('0x24')](function(_0x5daef){_0x3e7e58['rows']=_0x5daef;return _0x3e7e58;})['then'](respondWithFilteredResult(_0x21e45e,_0x5c0d72))['catch'](handleError(_0x21e45e,null));};exports[_0xc815('0x44')]=function(_0x474e12,_0x4bf225){var _0x46189d={'raw':!![],'where':{'id':_0x474e12[_0xc815('0x45')]['id']}},_0x3ae6ab={};_0x3ae6ab[_0xc815('0x31')]=_['keys'](db[_0xc815('0x41')]['rawAttributes']);_0x3ae6ab[_0xc815('0x32')]=_['keys'](_0x474e12['query']);_0x3ae6ab[_0xc815('0x34')]=_[_0xc815('0x35')](_0x3ae6ab['model'],_0x3ae6ab[_0xc815('0x32')]);_0x46189d[_0xc815('0x36')]=_[_0xc815('0x35')](_0x3ae6ab[_0xc815('0x31')],qs['fields'](_0x474e12[_0xc815('0x32')][_0xc815('0x37')]));_0x46189d[_0xc815('0x36')]=_0x46189d[_0xc815('0x36')]['length']?_0x46189d[_0xc815('0x36')]:_0x3ae6ab[_0xc815('0x31')];if(_0x474e12[_0xc815('0x32')][_0xc815('0x46')]){_0x46189d[_0xc815('0x42')]=[{'all':!![]}];}_0x46189d=_[_0xc815('0x3e')]({},_0x46189d,_0x474e12['options']);return db['SugarcrmField'][_0xc815('0x47')](_0x46189d)['then'](handleEntityNotFound(_0x4bf225,null))[_0xc815('0x24')](respondWithResult(_0x4bf225,null))[_0xc815('0x48')](handleError(_0x4bf225,null));};exports[_0xc815('0x49')]=function(_0x46d472,_0x29de8f){return db[_0xc815('0x41')][_0xc815('0x49')](_0x46d472[_0xc815('0x4a')],{})['then'](respondWithResult(_0x29de8f,0xc9))[_0xc815('0x48')](handleError(_0x29de8f,null));};exports[_0xc815('0x4b')]=function(_0x5dc1de,_0x178bcf){if(_0x5dc1de[_0xc815('0x4a')]['id']){delete _0x5dc1de[_0xc815('0x4a')]['id'];}return db['SugarcrmField'][_0xc815('0x47')]({'where':{'id':_0x5dc1de[_0xc815('0x45')]['id']}})[_0xc815('0x24')](handleEntityNotFound(_0x178bcf,null))[_0xc815('0x24')](saveUpdates(_0x5dc1de[_0xc815('0x4a')],null))[_0xc815('0x24')](respondWithResult(_0x178bcf,null))[_0xc815('0x48')](handleError(_0x178bcf,null));};exports[_0xc815('0x25')]=function(_0x589266,_0x4dca41){return db[_0xc815('0x41')][_0xc815('0x47')]({'where':{'id':_0x589266[_0xc815('0x45')]['id']}})[_0xc815('0x24')](handleEntityNotFound(_0x4dca41,null))[_0xc815('0x24')](removeEntity(_0x4dca41,null))[_0xc815('0x48')](handleError(_0x4dca41,null));}; \ No newline at end of file +var _0x9335=['SugarcrmField','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','index'];(function(_0x433ea1,_0x30559c){var _0x4e0fae=function(_0x567112){while(--_0x567112){_0x433ea1['push'](_0x433ea1['shift']());}};_0x4e0fae(++_0x30559c);}(_0x9335,0x65));var _0x5933=function(_0x3a0984,_0x19135f){_0x3a0984=_0x3a0984-0x0;var _0x4351fd=_0x9335[_0x3a0984];return _0x4351fd;};'use strict';var emlformat=require(_0x5933('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5933('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5933('0x2'));var moment=require('moment');var BPromise=require(_0x5933('0x3'));var Mustache=require(_0x5933('0x4'));var util=require(_0x5933('0x5'));var path=require(_0x5933('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5933('0x7'));var fs=require('fs');var fs_extra=require(_0x5933('0x8'));var _=require('lodash');var squel=require(_0x5933('0x9'));var crypto=require(_0x5933('0xa'));var jsforce=require(_0x5933('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5933('0xc'));var querystring=require(_0x5933('0xd'));var Papa=require('papaparse');var Redis=require(_0x5933('0xe'));var authService=require(_0x5933('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5933('0x10'));var hardwareService=require(_0x5933('0x11'));var logger=require('../../config/logger')(_0x5933('0x12'));var utils=require(_0x5933('0x13'));var config=require(_0x5933('0x14'));var licenseUtil=require(_0x5933('0x15'));var db=require(_0x5933('0x16'))['db'];function respondWithStatusCode(_0x2f03a5,_0x30381d){_0x30381d=_0x30381d||0xcc;return function(_0x430432){if(_0x430432){return _0x2f03a5[_0x5933('0x17')](_0x30381d);}return _0x2f03a5['status'](_0x30381d)[_0x5933('0x18')]();};}function respondWithResult(_0x2e0266,_0x498af3){_0x498af3=_0x498af3||0xc8;return function(_0x23fa62){if(_0x23fa62){return _0x2e0266[_0x5933('0x19')](_0x498af3)[_0x5933('0x1a')](_0x23fa62);}};}function respondWithFilteredResult(_0xadacfa,_0x13404b){return function(_0x18aa74){if(_0x18aa74){var _0x421b8a=typeof _0x13404b[_0x5933('0x1b')]===_0x5933('0x1c')&&typeof _0x13404b[_0x5933('0x1d')]===_0x5933('0x1c');var _0x4035f2=_0x18aa74['count'];var _0x55bd55=_0x421b8a?0x0:_0x13404b[_0x5933('0x1b')];var _0x206643=_0x421b8a?_0x18aa74[_0x5933('0x1e')]:_0x13404b['offset']+_0x13404b['limit'];var _0xd56691;if(_0x206643>=_0x4035f2){_0x206643=_0x4035f2;_0xd56691=0xc8;}else{_0xd56691=0xce;}_0xadacfa['status'](_0xd56691);return _0xadacfa[_0x5933('0x1f')]('Content-Range',_0x55bd55+'-'+_0x206643+'/'+_0x4035f2)['json'](_0x18aa74);}return null;};}function patchUpdates(_0x214893){return function(_0x19725b){try{jsonpatch[_0x5933('0x20')](_0x19725b,_0x214893,!![]);}catch(_0x25a511){return BPromise[_0x5933('0x21')](_0x25a511);}return _0x19725b[_0x5933('0x22')]();};}function saveUpdates(_0x116666,_0x1a23f6){return function(_0x566849){if(_0x566849){return _0x566849[_0x5933('0x23')](_0x116666)['then'](function(_0x2b7149){return _0x2b7149;});}return null;};}function removeEntity(_0x2c3ab9,_0x53ac06){return function(_0x4a4373){if(_0x4a4373){return _0x4a4373[_0x5933('0x24')]()[_0x5933('0x25')](function(){_0x2c3ab9[_0x5933('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e5f8e,_0x49fc2f){return function(_0x84cee0){if(!_0x84cee0){_0x5e5f8e[_0x5933('0x17')](0x194);}return _0x84cee0;};}function handleError(_0x4f3791,_0x5291c9){_0x5291c9=_0x5291c9||0x1f4;return function(_0xfd6ca6){logger[_0x5933('0x26')](_0xfd6ca6['stack']);if(_0xfd6ca6[_0x5933('0x27')]){delete _0xfd6ca6[_0x5933('0x27')];}_0x4f3791[_0x5933('0x19')](_0x5291c9)['send'](_0xfd6ca6);};}exports[_0x5933('0x28')]=function(_0x27f8ee,_0x5c34ae){var _0x214c04={},_0x50bb79={},_0x3016d7={'count':0x0,'rows':[]};var _0x5a31d0=_['map'](db[_0x5933('0x29')]['rawAttributes'],function(_0x4858ee){return{'name':_0x4858ee[_0x5933('0x2a')],'type':_0x4858ee['type'][_0x5933('0x2b')]};});_0x50bb79[_0x5933('0x2c')]=_[_0x5933('0x2d')](_0x5a31d0,_0x5933('0x27'));_0x50bb79[_0x5933('0x2e')]=_[_0x5933('0x2f')](_0x27f8ee['query']);_0x50bb79['filters']=_[_0x5933('0x30')](_0x50bb79[_0x5933('0x2c')],_0x50bb79[_0x5933('0x2e')]);_0x214c04[_0x5933('0x31')]=_[_0x5933('0x30')](_0x50bb79[_0x5933('0x2c')],qs[_0x5933('0x32')](_0x27f8ee[_0x5933('0x2e')][_0x5933('0x32')]));_0x214c04[_0x5933('0x31')]=_0x214c04[_0x5933('0x31')][_0x5933('0x33')]?_0x214c04['attributes']:_0x50bb79[_0x5933('0x2c')];if(!_0x27f8ee[_0x5933('0x2e')][_0x5933('0x34')](_0x5933('0x35'))){_0x214c04[_0x5933('0x1d')]=qs[_0x5933('0x1d')](_0x27f8ee[_0x5933('0x2e')][_0x5933('0x1d')]);_0x214c04['offset']=qs[_0x5933('0x1b')](_0x27f8ee['query'][_0x5933('0x1b')]);}_0x214c04['order']=qs['sort'](_0x27f8ee[_0x5933('0x2e')]['sort']);_0x214c04['where']=qs[_0x5933('0x36')](_[_0x5933('0x37')](_0x27f8ee[_0x5933('0x2e')],_0x50bb79[_0x5933('0x36')]),_0x5a31d0);if(_0x27f8ee[_0x5933('0x2e')]['filter']){_0x214c04[_0x5933('0x38')]=_[_0x5933('0x39')](_0x214c04[_0x5933('0x38')],{'$or':_[_0x5933('0x2d')](_0x5a31d0,function(_0x15a67a){if(_0x15a67a[_0x5933('0x3a')]!==_0x5933('0x3b')){var _0x1f4295={};_0x1f4295[_0x15a67a['name']]={'$like':'%'+_0x27f8ee[_0x5933('0x2e')][_0x5933('0x3c')]+'%'};return _0x1f4295;}})});}_0x214c04=_[_0x5933('0x39')]({},_0x214c04,_0x27f8ee[_0x5933('0x3d')]);var _0x154bf5={'where':_0x214c04['where']};return db[_0x5933('0x29')][_0x5933('0x1e')](_0x154bf5)[_0x5933('0x25')](function(_0x2cf629){_0x3016d7[_0x5933('0x1e')]=_0x2cf629;if(_0x27f8ee[_0x5933('0x2e')][_0x5933('0x3e')]){_0x214c04['include']=[{'all':!![]}];}return db[_0x5933('0x29')]['findAll'](_0x214c04);})[_0x5933('0x25')](function(_0x25fc55){_0x3016d7[_0x5933('0x3f')]=_0x25fc55;return _0x3016d7;})['then'](respondWithFilteredResult(_0x5c34ae,_0x214c04))[_0x5933('0x40')](handleError(_0x5c34ae,null));};exports[_0x5933('0x41')]=function(_0x4089f4,_0x1f3560){var _0x5bbf77={'raw':!![],'where':{'id':_0x4089f4[_0x5933('0x42')]['id']}},_0x475978={};_0x475978[_0x5933('0x2c')]=_[_0x5933('0x2f')](db[_0x5933('0x29')][_0x5933('0x43')]);_0x475978[_0x5933('0x2e')]=_['keys'](_0x4089f4[_0x5933('0x2e')]);_0x475978[_0x5933('0x36')]=_[_0x5933('0x30')](_0x475978[_0x5933('0x2c')],_0x475978['query']);_0x5bbf77[_0x5933('0x31')]=_[_0x5933('0x30')](_0x475978[_0x5933('0x2c')],qs['fields'](_0x4089f4[_0x5933('0x2e')][_0x5933('0x32')]));_0x5bbf77[_0x5933('0x31')]=_0x5bbf77[_0x5933('0x31')][_0x5933('0x33')]?_0x5bbf77[_0x5933('0x31')]:_0x475978[_0x5933('0x2c')];if(_0x4089f4[_0x5933('0x2e')][_0x5933('0x3e')]){_0x5bbf77['include']=[{'all':!![]}];}_0x5bbf77=_[_0x5933('0x39')]({},_0x5bbf77,_0x4089f4[_0x5933('0x3d')]);return db[_0x5933('0x29')][_0x5933('0x44')](_0x5bbf77)[_0x5933('0x25')](handleEntityNotFound(_0x1f3560,null))[_0x5933('0x25')](respondWithResult(_0x1f3560,null))[_0x5933('0x40')](handleError(_0x1f3560,null));};exports[_0x5933('0x45')]=function(_0x25e9ae,_0xce5108){return db[_0x5933('0x29')]['create'](_0x25e9ae[_0x5933('0x46')],{})['then'](respondWithResult(_0xce5108,0xc9))[_0x5933('0x40')](handleError(_0xce5108,null));};exports[_0x5933('0x23')]=function(_0x88d8a6,_0x5ba8ee){if(_0x88d8a6[_0x5933('0x46')]['id']){delete _0x88d8a6[_0x5933('0x46')]['id'];}return db[_0x5933('0x29')][_0x5933('0x44')]({'where':{'id':_0x88d8a6['params']['id']}})['then'](handleEntityNotFound(_0x5ba8ee,null))[_0x5933('0x25')](saveUpdates(_0x88d8a6[_0x5933('0x46')],null))[_0x5933('0x25')](respondWithResult(_0x5ba8ee,null))['catch'](handleError(_0x5ba8ee,null));};exports[_0x5933('0x24')]=function(_0x58bf9f,_0x5861e7){return db['SugarcrmField'][_0x5933('0x44')]({'where':{'id':_0x58bf9f[_0x5933('0x42')]['id']}})[_0x5933('0x25')](handleEntityNotFound(_0x5861e7,null))[_0x5933('0x25')](removeEntity(_0x5861e7,null))['catch'](handleError(_0x5861e7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 10011e2..f7cd4f3 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 _0x83fa=['util','../../config/logger','api','path','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x83fa,0x18b));var _0xa83f=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x83fa[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xa83f('0x0'));var util=require(_0xa83f('0x1'));var logger=require(_0xa83f('0x2'))(_0xa83f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa83f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa83f('0x5'));module[_0xa83f('0x6')]=function(_0x403d48,_0x12dde2){return _0x403d48['define'](_0xa83f('0x7'),attributes,{'tableName':_0xa83f('0x8'),'paranoid':![],'indexes':[{'name':_0xa83f('0x9'),'fields':[_0xa83f('0xa'),_0xa83f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56e5=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField'];(function(_0xf05c4d,_0x140378){var _0x14030b=function(_0x4e0fe9){while(--_0x4e0fe9){_0xf05c4d['push'](_0xf05c4d['shift']());}};_0x14030b(++_0x140378);}(_0x56e5,0x1ad));var _0x556e=function(_0x184e92,_0x25c2c5){_0x184e92=_0x184e92-0x0;var _0x26151a=_0x56e5[_0x184e92];return _0x26151a;};'use strict';var _=require(_0x556e('0x0'));var util=require(_0x556e('0x1'));var logger=require(_0x556e('0x2'))(_0x556e('0x3'));var moment=require('moment');var BPromise=require(_0x556e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x556e('0x5'));var config=require(_0x556e('0x6'));var attributes=require(_0x556e('0x7'));module[_0x556e('0x8')]=function(_0x127f37,_0x47e1ff){return _0x127f37[_0x556e('0x9')](_0x556e('0xa'),attributes,{'tableName':_0x556e('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x556e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 3f5b276..a8326e5 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 _0x711c=['stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x44e78e,_0x5f2ba5){var _0xff1bb2=function(_0x1dc6a8){while(--_0x1dc6a8){_0x44e78e['push'](_0x44e78e['shift']());}};_0xff1bb2(++_0x5f2ba5);}(_0x711c,0x12b));var _0xc711=function(_0x5e73b8,_0x42cc33){_0x5e73b8=_0x5e73b8-0x0;var _0x5387de=_0x711c[_0x5e73b8];return _0x5387de;};'use strict';var _=require('lodash');var util=require(_0xc711('0x0'));var moment=require(_0xc711('0x1'));var BPromise=require(_0xc711('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc711('0x3'));var db=require(_0xc711('0x4'))['db'];var utils=require(_0xc711('0x5'));var logger=require(_0xc711('0x6'))(_0xc711('0x7'));var config=require('../../config/environment');var jayson=require(_0xc711('0x8'));var client=jayson[_0xc711('0x9')][_0xc711('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439e3b,_0x181cab,_0x438725){return new BPromise(function(_0x264827,_0x433f0c){return client['request'](_0x439e3b,_0x438725)[_0xc711('0xb')](function(_0x51810d){logger[_0xc711('0xc')](_0xc711('0xd'),_0x181cab,_0xc711('0xe'));logger['debug'](_0xc711('0xf'),_0x181cab,_0xc711('0xe'),JSON[_0xc711('0x10')](_0x51810d));if(_0x51810d[_0xc711('0x11')]){if(_0x51810d['error'][_0xc711('0x12')]===0x1f4){logger[_0xc711('0x11')](_0xc711('0xd'),_0x181cab,_0x51810d[_0xc711('0x11')][_0xc711('0x13')]);return _0x433f0c(_0x51810d[_0xc711('0x11')][_0xc711('0x13')]);}logger[_0xc711('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x181cab,_0x51810d[_0xc711('0x11')][_0xc711('0x13')]);return _0x264827(_0x51810d[_0xc711('0x11')]['message']);}else{logger[_0xc711('0xc')](_0xc711('0xd'),_0x181cab,'request\x20sent');_0x264827(_0x51810d[_0xc711('0x14')][_0xc711('0x13')]);}})['catch'](function(_0xf22120){logger['error'](_0xc711('0xd'),_0x181cab,_0xf22120);_0x433f0c(_0xf22120);});});} \ No newline at end of file +var _0xc89a=['jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment'];(function(_0x4e35c1,_0x24e3d6){var _0xb93941=function(_0x3a0a60){while(--_0x3a0a60){_0x4e35c1['push'](_0x4e35c1['shift']());}};_0xb93941(++_0x24e3d6);}(_0xc89a,0x1ce));var _0xac89=function(_0x20d0df,_0x2cc673){_0x20d0df=_0x20d0df-0x0;var _0x49bf6b=_0xc89a[_0x20d0df];return _0x49bf6b;};'use strict';var _=require('lodash');var util=require(_0xac89('0x0'));var moment=require(_0xac89('0x1'));var BPromise=require(_0xac89('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac89('0x3'));var db=require(_0xac89('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xac89('0x5'));var jayson=require(_0xac89('0x6'));var client=jayson[_0xac89('0x7')][_0xac89('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37092e,_0x5d4c10,_0x45516e){return new BPromise(function(_0x22cb61,_0x1aff1f){return client[_0xac89('0x9')](_0x37092e,_0x45516e)['then'](function(_0x461e32){logger[_0xac89('0xa')](_0xac89('0xb'),_0x5d4c10,_0xac89('0xc'));logger[_0xac89('0xd')](_0xac89('0xe'),_0x5d4c10,'request\x20sent',JSON['stringify'](_0x461e32));if(_0x461e32[_0xac89('0xf')]){if(_0x461e32[_0xac89('0xf')]['code']===0x1f4){logger[_0xac89('0xf')](_0xac89('0xb'),_0x5d4c10,_0x461e32[_0xac89('0xf')]['message']);return _0x1aff1f(_0x461e32[_0xac89('0xf')][_0xac89('0x10')]);}logger[_0xac89('0xf')](_0xac89('0xb'),_0x5d4c10,_0x461e32[_0xac89('0xf')][_0xac89('0x10')]);return _0x22cb61(_0x461e32[_0xac89('0xf')][_0xac89('0x10')]);}else{logger[_0xac89('0xa')](_0xac89('0xb'),_0x5d4c10,_0xac89('0xc'));_0x22cb61(_0x461e32['result'][_0xac89('0x10')]);}})[_0xac89('0x11')](function(_0x4006db){logger[_0xac89('0xf')](_0xac89('0xb'),_0x5d4c10,_0x4006db);_0x1aff1f(_0x4006db);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 72fbd91..16d2d0b 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 _0x1229=['index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x171f6b,_0x5bd32e){var _0x3cc0f1=function(_0x158f99){while(--_0x158f99){_0x171f6b['push'](_0x171f6b['shift']());}};_0x3cc0f1(++_0x5bd32e);}(_0x1229,0xac));var _0x9122=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x1229[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require(_0x9122('0x0'));var path=require(_0x9122('0x1'));var timeout=require(_0x9122('0x2'));var express=require(_0x9122('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9122('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9122('0x5'));var controller=require(_0x9122('0x6'));router[_0x9122('0x7')]('/',auth['isAuthenticated'](),controller[_0x9122('0x8')]);router[_0x9122('0x7')](_0x9122('0x9'),auth[_0x9122('0xa')](),controller[_0x9122('0xb')]);router['get'](_0x9122('0xc'),auth['isAuthenticated'](),controller[_0x9122('0xd')]);router[_0x9122('0x7')](_0x9122('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x9122('0xf')]('/',auth[_0x9122('0xa')](),controller['create']);router[_0x9122('0xf')](_0x9122('0xc'),auth[_0x9122('0xa')](),controller[_0x9122('0x10')]);router[_0x9122('0x11')](_0x9122('0x9'),auth[_0x9122('0xa')](),controller['update']);router[_0x9122('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9122('0x13')]=router; \ No newline at end of file +var _0x61df=['/:id','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x22bad1,_0x290ccb){var _0x550395=function(_0x22d922){while(--_0x22d922){_0x22bad1['push'](_0x22bad1['shift']());}};_0x550395(++_0x290ccb);}(_0x61df,0xbd));var _0xf61d=function(_0x13dc6b,_0x1e7d74){_0x13dc6b=_0x13dc6b-0x0;var _0xa39826=_0x61df[_0x13dc6b];return _0xa39826;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf61d('0x0'));var express=require(_0xf61d('0x1'));var router=express['Router']();var fs_extra=require(_0xf61d('0x2'));var auth=require(_0xf61d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf61d('0x4'));var controller=require(_0xf61d('0x5'));router[_0xf61d('0x6')]('/',auth[_0xf61d('0x7')](),controller[_0xf61d('0x8')]);router[_0xf61d('0x6')]('/:id',auth[_0xf61d('0x7')](),controller['show']);router[_0xf61d('0x6')](_0xf61d('0x9'),auth[_0xf61d('0x7')](),controller[_0xf61d('0xa')]);router[_0xf61d('0x6')](_0xf61d('0xb'),auth[_0xf61d('0x7')](),controller[_0xf61d('0xc')]);router[_0xf61d('0xd')]('/',auth[_0xf61d('0x7')](),controller[_0xf61d('0xe')]);router[_0xf61d('0xd')]('/:id/configurations',auth[_0xf61d('0x7')](),controller['addConfiguration']);router['put'](_0xf61d('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf61d('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf61d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c7341e4..746e6e2 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 _0xa286=['sequelize','STRING','HelpDesk'];(function(_0x325c47,_0x45db87){var _0x3aabbd=function(_0x19c406){while(--_0x19c406){_0x325c47['push'](_0x325c47['shift']());}};_0x3aabbd(++_0x45db87);}(_0xa286,0x19b));var _0x6a28=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xa286[_0x41c381];return _0x427981;};'use strict';var Sequelize=require(_0x6a28('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a28('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6a28('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6a28('0x1')],'allowNull':![],'defaultValue':_0x6a28('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6a28('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6a28('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd4b3=['exports','STRING','HelpDesk','sequelize'];(function(_0xef2a14,_0x4c359a){var _0x242a4d=function(_0x3227c9){while(--_0x3227c9){_0xef2a14['push'](_0xef2a14['shift']());}};_0x242a4d(++_0x4c359a);}(_0xd4b3,0xc7));var _0x3d4b=function(_0x4ec79a,_0x105980){_0x4ec79a=_0x4ec79a-0x0;var _0x37b2b5=_0xd4b3[_0x4ec79a];return _0x37b2b5;};'use strict';var Sequelize=require(_0x3d4b('0x0'));module[_0x3d4b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3d4b('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3d4b('0x2')],'allowNull':![],'defaultValue':_0x3d4b('0x3')},'remoteUri':{'type':Sequelize[_0x3d4b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3d4b('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 e02bf87..bd59075 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 _0x5524=['editable','false','cf_','picklist','picklistValues','label','value','log','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','VtigerAccount','findAll','rows','catch','show','length','includeAll','include','find','create','params','getConfigurations','findOne','options','nolimit','addConfiguration','body','AccountId','Subjects','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','moduleName','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','result','describe','autogenerated','reference','owner','remove','includes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5524,0xf5));var _0x4552=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5524[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4552('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4552('0x1'));var jsonpatch=require(_0x4552('0x2'));var rp=require(_0x4552('0x3'));var moment=require(_0x4552('0x4'));var BPromise=require(_0x4552('0x5'));var Mustache=require(_0x4552('0x6'));var util=require('util');var path=require(_0x4552('0x7'));var sox=require(_0x4552('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4552('0x9'));var squel=require('squel');var crypto=require(_0x4552('0xa'));var jsforce=require(_0x4552('0xb'));var deskjs=require(_0x4552('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4552('0xd'));var Papa=require('papaparse');var Redis=require(_0x4552('0xe'));var authService=require(_0x4552('0xf'));var qs=require(_0x4552('0x10'));var as=require(_0x4552('0x11'));var hardwareService=require(_0x4552('0x12'));var logger=require('../../config/logger')(_0x4552('0x13'));var utils=require(_0x4552('0x14'));var config=require(_0x4552('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4552('0x16'))['db'];var integrations=require(_0x4552('0x17'));function respondWithStatusCode(_0x2c147b,_0x35beb5){_0x35beb5=_0x35beb5||0xcc;return function(_0xb909ea){if(_0xb909ea){return _0x2c147b[_0x4552('0x18')](_0x35beb5);}return _0x2c147b[_0x4552('0x19')](_0x35beb5)[_0x4552('0x1a')]();};}function respondWithResult(_0x5ce87b,_0x802b98){_0x802b98=_0x802b98||0xc8;return function(_0x311e37){if(_0x311e37){return _0x5ce87b[_0x4552('0x19')](_0x802b98)[_0x4552('0x1b')](_0x311e37);}};}function respondWithFilteredResult(_0x520b77,_0x567ffb){return function(_0x5aebf3){if(_0x5aebf3){var _0x4074e=typeof _0x567ffb[_0x4552('0x1c')]===_0x4552('0x1d')&&typeof _0x567ffb[_0x4552('0x1e')]==='undefined';var _0x410b63=_0x5aebf3[_0x4552('0x1f')];var _0x48595a=_0x4074e?0x0:_0x567ffb[_0x4552('0x1c')];var _0x2e8e7a=_0x4074e?_0x5aebf3[_0x4552('0x1f')]:_0x567ffb[_0x4552('0x1c')]+_0x567ffb['limit'];var _0x505fd9;if(_0x2e8e7a>=_0x410b63){_0x2e8e7a=_0x410b63;_0x505fd9=0xc8;}else{_0x505fd9=0xce;}_0x520b77[_0x4552('0x19')](_0x505fd9);return _0x520b77[_0x4552('0x20')]('Content-Range',_0x48595a+'-'+_0x2e8e7a+'/'+_0x410b63)['json'](_0x5aebf3);}return null;};}function patchUpdates(_0x1dceb4){return function(_0x55fd7d){try{jsonpatch['apply'](_0x55fd7d,_0x1dceb4,!![]);}catch(_0x28bbe0){return BPromise[_0x4552('0x21')](_0x28bbe0);}return _0x55fd7d[_0x4552('0x22')]();};}function saveUpdates(_0xd08a63,_0x59ee4b){return function(_0x143e2b){if(_0x143e2b){return _0x143e2b[_0x4552('0x23')](_0xd08a63)[_0x4552('0x24')](function(_0x1332c9){return _0x1332c9;});}return null;};}function removeEntity(_0x80b31a,_0x19b586){return function(_0x408c26){if(_0x408c26){return _0x408c26[_0x4552('0x25')]()['then'](function(){_0x80b31a[_0x4552('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33478b,_0x33d5da){return function(_0x167af9){if(!_0x167af9){_0x33478b['sendStatus'](0x194);}return _0x167af9;};}function handleError(_0x411d99,_0x4ad515){_0x4ad515=_0x4ad515||0x1f4;return function(_0x5c48ce){logger[_0x4552('0x26')](_0x5c48ce['stack']);if(_0x5c48ce[_0x4552('0x27')]){delete _0x5c48ce['name'];}_0x411d99[_0x4552('0x19')](_0x4ad515)[_0x4552('0x28')](_0x5c48ce);};}exports[_0x4552('0x29')]=function(_0x25f709,_0x4dfb9e){var _0x544814={},_0x3a0afe={},_0x2f79f5={'count':0x0,'rows':[]};var _0x77f334=_[_0x4552('0x2a')](db['VtigerAccount'][_0x4552('0x2b')],function(_0x1c370a){return{'name':_0x1c370a[_0x4552('0x2c')],'type':_0x1c370a['type']['key']};});_0x3a0afe[_0x4552('0x2d')]=_['map'](_0x77f334,_0x4552('0x27'));_0x3a0afe[_0x4552('0x2e')]=_[_0x4552('0x2f')](_0x25f709['query']);_0x3a0afe[_0x4552('0x30')]=_[_0x4552('0x31')](_0x3a0afe['model'],_0x3a0afe[_0x4552('0x2e')]);_0x544814[_0x4552('0x32')]=_['intersection'](_0x3a0afe[_0x4552('0x2d')],qs[_0x4552('0x33')](_0x25f709[_0x4552('0x2e')]['fields']));_0x544814['attributes']=_0x544814['attributes']['length']?_0x544814[_0x4552('0x32')]:_0x3a0afe['model'];if(!_0x25f709[_0x4552('0x2e')][_0x4552('0x34')]('nolimit')){_0x544814[_0x4552('0x1e')]=qs[_0x4552('0x1e')](_0x25f709[_0x4552('0x2e')][_0x4552('0x1e')]);_0x544814[_0x4552('0x1c')]=qs[_0x4552('0x1c')](_0x25f709[_0x4552('0x2e')][_0x4552('0x1c')]);}_0x544814[_0x4552('0x35')]=qs[_0x4552('0x36')](_0x25f709[_0x4552('0x2e')][_0x4552('0x36')]);_0x544814[_0x4552('0x37')]=qs[_0x4552('0x30')](_['pick'](_0x25f709[_0x4552('0x2e')],_0x3a0afe[_0x4552('0x30')]),_0x77f334);if(_0x25f709[_0x4552('0x2e')][_0x4552('0x38')]){_0x544814[_0x4552('0x37')]=_[_0x4552('0x39')](_0x544814['where'],{'$or':_[_0x4552('0x2a')](_0x77f334,function(_0x322a43){if(_0x322a43[_0x4552('0x3a')]!==_0x4552('0x3b')){var _0x63b22a={};_0x63b22a[_0x322a43['name']]={'$like':'%'+_0x25f709[_0x4552('0x2e')][_0x4552('0x38')]+'%'};return _0x63b22a;}})});}_0x544814=_['merge']({},_0x544814,_0x25f709['options']);var _0x146cd8={'where':_0x544814[_0x4552('0x37')]};return db[_0x4552('0x3c')][_0x4552('0x1f')](_0x146cd8)[_0x4552('0x24')](function(_0xc52df1){_0x2f79f5[_0x4552('0x1f')]=_0xc52df1;if(_0x25f709['query']['includeAll']){_0x544814['include']=[{'all':!![]}];}return db[_0x4552('0x3c')][_0x4552('0x3d')](_0x544814);})[_0x4552('0x24')](function(_0x4d307d){_0x2f79f5[_0x4552('0x3e')]=_0x4d307d;return _0x2f79f5;})[_0x4552('0x24')](respondWithFilteredResult(_0x4dfb9e,_0x544814))[_0x4552('0x3f')](handleError(_0x4dfb9e,null));};exports[_0x4552('0x40')]=function(_0xffca85,_0x59ea6d){var _0x577819={'raw':![],'where':{'id':_0xffca85['params']['id']}},_0x4d22cd={};_0x4d22cd[_0x4552('0x2d')]=_['keys'](db[_0x4552('0x3c')][_0x4552('0x2b')]);_0x4d22cd[_0x4552('0x2e')]=_[_0x4552('0x2f')](_0xffca85[_0x4552('0x2e')]);_0x4d22cd[_0x4552('0x30')]=_[_0x4552('0x31')](_0x4d22cd[_0x4552('0x2d')],_0x4d22cd[_0x4552('0x2e')]);_0x577819[_0x4552('0x32')]=_[_0x4552('0x31')](_0x4d22cd[_0x4552('0x2d')],qs['fields'](_0xffca85[_0x4552('0x2e')][_0x4552('0x33')]));_0x577819[_0x4552('0x32')]=_0x577819[_0x4552('0x32')][_0x4552('0x41')]?_0x577819['attributes']:_0x4d22cd[_0x4552('0x2d')];if(_0xffca85['query'][_0x4552('0x42')]){_0x577819[_0x4552('0x43')]=[{'all':!![]}];}_0x577819=_[_0x4552('0x39')]({},_0x577819,_0xffca85['options']);return db[_0x4552('0x3c')][_0x4552('0x44')](_0x577819)[_0x4552('0x24')](handleEntityNotFound(_0x59ea6d,null))[_0x4552('0x24')](respondWithResult(_0x59ea6d,null))[_0x4552('0x3f')](handleError(_0x59ea6d,null));};exports['create']=function(_0x3016e9,_0x2959c1){return db[_0x4552('0x3c')][_0x4552('0x45')](_0x3016e9['body'],{})[_0x4552('0x24')](respondWithResult(_0x2959c1,0xc9))[_0x4552('0x3f')](handleError(_0x2959c1,null));};exports[_0x4552('0x23')]=function(_0x2de74b,_0x19a193){if(_0x2de74b['body']['id']){delete _0x2de74b['body']['id'];}return db[_0x4552('0x3c')][_0x4552('0x44')]({'where':{'id':_0x2de74b[_0x4552('0x46')]['id']}})[_0x4552('0x24')](handleEntityNotFound(_0x19a193,null))['then'](saveUpdates(_0x2de74b['body'],null))[_0x4552('0x24')](respondWithResult(_0x19a193,null))['catch'](handleError(_0x19a193,null));};exports[_0x4552('0x25')]=function(_0x1a9bac,_0x3e9cf3){return db['VtigerAccount'][_0x4552('0x44')]({'where':{'id':_0x1a9bac['params']['id']}})[_0x4552('0x24')](handleEntityNotFound(_0x3e9cf3,null))['then'](removeEntity(_0x3e9cf3,null))[_0x4552('0x3f')](handleError(_0x3e9cf3,null));};exports[_0x4552('0x47')]=function(_0x445569,_0xef0f93,_0x809693){var _0x55c5e4={};var _0x26f390={};var _0x318665;var _0xbee99c;return db['VtigerAccount'][_0x4552('0x48')]({'where':{'id':_0x445569[_0x4552('0x46')]['id']}})[_0x4552('0x24')](handleEntityNotFound(_0xef0f93,null))[_0x4552('0x24')](function(_0x5d7806){if(_0x5d7806){_0x318665=_0x5d7806;_0x26f390['model']=_[_0x4552('0x2f')](db['VtigerConfiguration']['rawAttributes']);_0x26f390[_0x4552('0x2e')]=_['keys'](_0x445569[_0x4552('0x2e')]);_0x26f390['filters']=_[_0x4552('0x31')](_0x26f390[_0x4552('0x2d')],_0x26f390[_0x4552('0x2e')]);_0x55c5e4[_0x4552('0x32')]=_[_0x4552('0x31')](_0x26f390[_0x4552('0x2d')],qs[_0x4552('0x33')](_0x445569[_0x4552('0x2e')]['fields']));_0x55c5e4[_0x4552('0x32')]=_0x55c5e4[_0x4552('0x32')]['length']?_0x55c5e4[_0x4552('0x32')]:_0x26f390[_0x4552('0x2d')];_0x55c5e4[_0x4552('0x35')]=qs[_0x4552('0x36')](_0x445569[_0x4552('0x2e')]['sort']);_0x55c5e4[_0x4552('0x37')]=qs['filters'](_['pick'](_0x445569[_0x4552('0x2e')],_0x26f390[_0x4552('0x30')]));if(_0x445569[_0x4552('0x2e')][_0x4552('0x38')]){_0x55c5e4[_0x4552('0x37')]=_['merge'](_0x55c5e4[_0x4552('0x37')],{'$or':_['map'](_0x55c5e4[_0x4552('0x32')],function(_0x5d26bc){var _0x236eb1={};_0x236eb1[_0x5d26bc]={'$like':'%'+_0x445569[_0x4552('0x2e')][_0x4552('0x38')]+'%'};return _0x236eb1;})});}_0x55c5e4=_[_0x4552('0x39')]({},_0x55c5e4,_0x445569[_0x4552('0x49')]);return _0x318665[_0x4552('0x47')](_0x55c5e4);}})[_0x4552('0x24')](function(_0x3943bf){if(_0x3943bf){_0xbee99c=_0x3943bf[_0x4552('0x41')];if(!_0x445569[_0x4552('0x2e')][_0x4552('0x34')](_0x4552('0x4a'))){_0x55c5e4[_0x4552('0x1e')]=qs['limit'](_0x445569['query'][_0x4552('0x1e')]);_0x55c5e4[_0x4552('0x1c')]=qs['offset'](_0x445569[_0x4552('0x2e')][_0x4552('0x1c')]);}return _0x318665[_0x4552('0x47')](_0x55c5e4);}})[_0x4552('0x24')](function(_0x39d19c){if(_0x39d19c){return _0x39d19c?{'count':_0xbee99c,'rows':_0x39d19c}:null;}})[_0x4552('0x24')](respondWithResult(_0xef0f93,null))['catch'](handleError(_0xef0f93,null));};exports[_0x4552('0x4b')]=function(_0x4640aa,_0x1e544d,_0x1a8003){if(_0x4640aa[_0x4552('0x4c')]['id']){delete _0x4640aa[_0x4552('0x4c')]['id'];}return db['VtigerAccount'][_0x4552('0x48')]({'where':{'id':_0x4640aa[_0x4552('0x46')]['id']}})[_0x4552('0x24')](handleEntityNotFound(_0x1e544d,null))[_0x4552('0x24')](function(_0x9f6a70){if(_0x9f6a70){_0x4640aa[_0x4552('0x4c')][_0x4552('0x4d')]=_0x9f6a70['id'];_0x4640aa[_0x4552('0x4c')][_0x4552('0x4e')]=integrations['getSubjects'](_0x4640aa[_0x4552('0x4c')]['channel'],_0x4640aa[_0x4552('0x4c')][_0x4552('0x3a')]);_0x4640aa[_0x4552('0x4c')][_0x4552('0x4f')]=integrations[_0x4552('0x50')](_0x4640aa[_0x4552('0x4c')]['channel'],_0x4640aa['body']['type']);return db[_0x4552('0x51')]['create'](_0x4640aa[_0x4552('0x4c')],{'include':[{'model':db['VtigerField'],'as':_0x4552('0x4e')},{'model':db[_0x4552('0x52')],'as':_0x4552('0x4f')}]});}return null;})['then'](respondWithResult(_0x1e544d,null))[_0x4552('0x3f')](handleError(_0x1e544d,null));};var md5=require(_0x4552('0x53'));exports[_0x4552('0x54')]=function(_0x25402d,_0x584c85,_0x3dbbe0){var _0x488d7f=null;var _0x2b1422=null;var _0x3b5907=null;var _0x3e52a6=null;var _0x27aaa3='';return db[_0x4552('0x3c')]['findOne']({'where':{'id':_0x25402d['params']['id']},'attributes':['id','name',_0x4552('0x55'),'description',_0x4552('0x56'),'remoteUri',_0x4552('0x57'),_0x4552('0x58')]})[_0x4552('0x24')](handleEntityNotFound(_0x584c85,null))[_0x4552('0x24')](function(_0x19ca4b){if(_0x19ca4b){_0x488d7f=_0x19ca4b[_0x4552('0x55')];_0x2b1422=_0x19ca4b['accessKey'];_0x3b5907=_0x19ca4b[_0x4552('0x56')];_0x27aaa3=_0x19ca4b['remoteUri'];var _0x4ec791=_0x27aaa3['slice'](-0x1);if(_0x4ec791==='/'){_0x27aaa3=_0x27aaa3[_0x4552('0x59')](0x0,_0x27aaa3[_0x4552('0x5a')](_0x4ec791));}_0x3e52a6=util[_0x4552('0x5b')](_0x4552('0x5c'),_0x27aaa3);var _0x528123={'method':_0x4552('0x5d'),'uri':_0x3e52a6,'qs':{'operation':_0x4552('0x5e'),'username':_0x19ca4b[_0x4552('0x55')]},'json':!![]};return rp(_0x528123);}})[_0x4552('0x24')](function(_0x5f1d66){if(_0x5f1d66[_0x4552('0x5f')]){var _0xa094dd={'method':'POST','uri':_0x3e52a6,'form':{'operation':'login','username':_0x488d7f,'accessKey':md5(_0x5f1d66[_0x4552('0x60')]['token']+_0x2b1422)},'json':!![]};return rp(_0xa094dd);}})['then'](function(_0x1176e1){if(_0x1176e1[_0x4552('0x5f')]){var _0x4eb4e3={'method':'GET','uri':_0x3e52a6,'qs':{'operation':_0x4552('0x61'),'username':_0x488d7f,'sessionName':_0x1176e1[_0x4552('0x60')]['sessionName'],'elementType':_0x3b5907},'json':!![]};return rp(_0x4eb4e3);}})[_0x4552('0x24')](function(_0x288482){if(_0x288482[_0x4552('0x5f')]){var _0x20c912=[_0x4552('0x62'),_0x4552('0x63'),_0x4552('0x64')];_[_0x4552('0x65')](_0x288482[_0x4552('0x60')][_0x4552('0x33')],function(_0x179321){return _0x20c912[_0x4552('0x66')](_0x179321[_0x4552('0x3a')]['name']);});_[_0x4552('0x65')](_0x288482[_0x4552('0x60')][_0x4552('0x33')],function(_0x2fc410){return _0x2fc410[_0x4552('0x67')]===_0x4552('0x68');});return{'count':_0x288482[_0x4552('0x60')]['fields'][_0x4552('0x41')],'rows':_['map'](_0x288482['result'][_0x4552('0x33')],function(_0x4fa81d){return{'id':_0x4fa81d[_0x4552('0x27')],'name':_0x4fa81d['label'],'custom':_['startsWith'](_0x4fa81d[_0x4552('0x27')],_0x4552('0x69'))?!![]:![],'options':_0x4fa81d['type'][_0x4552('0x27')]===_0x4552('0x6a')&&_0x4fa81d[_0x4552('0x3a')][_0x4552('0x6b')]['length']>0x0?_[_0x4552('0x2a')](_0x4fa81d[_0x4552('0x3a')][_0x4552('0x6b')],function(_0x6de229){return{'name':_0x6de229[_0x4552('0x6c')],'value':_0x6de229[_0x4552('0x6d')]};}):[]};})};}})[_0x4552('0x24')](respondWithResult(_0x584c85,null))[_0x4552('0x3f')](function(_0x2ea9a8){console[_0x4552('0x6e')]('vTiger\x20error:\x20'+_0x2ea9a8);var _0x3143e1=_0x25402d[_0x4552('0x2e')][_0x4552('0x6f')]?0x1f4:_0x2ea9a8['statusCode']||0x1f4;logger['error'](_0x4552('0x70'),_0x4552('0x54'),_0x3143e1,JSON[_0x4552('0x71')](_0x2ea9a8));delete _0x2ea9a8[_0x4552('0x27')];if(_0x3143e1===0x191){_0x3143e1=0x190;}_0x584c85['status'](_0x3143e1)[_0x4552('0x28')](_0x25402d[_0x4552('0x2e')][_0x4552('0x6f')]?{'message':_0x4552('0x72'),'statusCode':_0x2ea9a8[_0x4552('0x73')]}:_0x2ea9a8);});}; \ No newline at end of file +var _0x5454=['params','include','options','find','create','body','getConfigurations','pick','filter','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','GET','POST','token','success','describe','sessionName','autogenerated','reference','owner','remove','result','false','label','startsWith','cf_','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','VtigerAccount','includeAll','findAll','rows','catch','show'];(function(_0x123c5e,_0x430bcf){var _0x2ffbfa=function(_0x478209){while(--_0x478209){_0x123c5e['push'](_0x123c5e['shift']());}};_0x2ffbfa(++_0x430bcf);}(_0x5454,0x12a));var _0x4545=function(_0x23d84b,_0x152082){_0x23d84b=_0x23d84b-0x0;var _0x26d30e=_0x5454[_0x23d84b];return _0x26d30e;};'use strict';var emlformat=require(_0x4545('0x0'));var rimraf=require(_0x4545('0x1'));var zipdir=require(_0x4545('0x2'));var jsonpatch=require(_0x4545('0x3'));var rp=require(_0x4545('0x4'));var moment=require(_0x4545('0x5'));var BPromise=require(_0x4545('0x6'));var Mustache=require(_0x4545('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4545('0x8'));var csv=require(_0x4545('0x9'));var ejs=require(_0x4545('0xa'));var fs=require('fs');var fs_extra=require(_0x4545('0xb'));var _=require(_0x4545('0xc'));var squel=require(_0x4545('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4545('0xe'));var toCsv=require(_0x4545('0x9'));var querystring=require('querystring');var Papa=require(_0x4545('0xf'));var Redis=require(_0x4545('0x10'));var authService=require(_0x4545('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4545('0x12'));var hardwareService=require(_0x4545('0x13'));var logger=require(_0x4545('0x14'))(_0x4545('0x15'));var utils=require(_0x4545('0x16'));var config=require(_0x4545('0x17'));var licenseUtil=require(_0x4545('0x18'));var db=require(_0x4545('0x19'))['db'];var integrations=require(_0x4545('0x1a'));function respondWithStatusCode(_0x57a8dc,_0x4f27a3){_0x4f27a3=_0x4f27a3||0xcc;return function(_0x481c17){if(_0x481c17){return _0x57a8dc[_0x4545('0x1b')](_0x4f27a3);}return _0x57a8dc[_0x4545('0x1c')](_0x4f27a3)[_0x4545('0x1d')]();};}function respondWithResult(_0x419724,_0x51a618){_0x51a618=_0x51a618||0xc8;return function(_0x39868c){if(_0x39868c){return _0x419724[_0x4545('0x1c')](_0x51a618)[_0x4545('0x1e')](_0x39868c);}};}function respondWithFilteredResult(_0x384515,_0x3f457a){return function(_0x30de16){if(_0x30de16){var _0x535b7c=typeof _0x3f457a[_0x4545('0x1f')]===_0x4545('0x20')&&typeof _0x3f457a[_0x4545('0x21')]===_0x4545('0x20');var _0x35ea26=_0x30de16[_0x4545('0x22')];var _0x10d91e=_0x535b7c?0x0:_0x3f457a[_0x4545('0x1f')];var _0x4db15f=_0x535b7c?_0x30de16[_0x4545('0x22')]:_0x3f457a['offset']+_0x3f457a[_0x4545('0x21')];var _0x5ab094;if(_0x4db15f>=_0x35ea26){_0x4db15f=_0x35ea26;_0x5ab094=0xc8;}else{_0x5ab094=0xce;}_0x384515['status'](_0x5ab094);return _0x384515[_0x4545('0x23')](_0x4545('0x24'),_0x10d91e+'-'+_0x4db15f+'/'+_0x35ea26)['json'](_0x30de16);}return null;};}function patchUpdates(_0x3b1b7a){return function(_0x3a2c1c){try{jsonpatch[_0x4545('0x25')](_0x3a2c1c,_0x3b1b7a,!![]);}catch(_0x26d7e4){return BPromise[_0x4545('0x26')](_0x26d7e4);}return _0x3a2c1c[_0x4545('0x27')]();};}function saveUpdates(_0x1533da,_0x3d05dd){return function(_0x7dacbe){if(_0x7dacbe){return _0x7dacbe[_0x4545('0x28')](_0x1533da)[_0x4545('0x29')](function(_0x396c57){return _0x396c57;});}return null;};}function removeEntity(_0x31dc9e,_0x490691){return function(_0x30ac2e){if(_0x30ac2e){return _0x30ac2e[_0x4545('0x2a')]()[_0x4545('0x29')](function(){_0x31dc9e[_0x4545('0x1c')](0xcc)[_0x4545('0x1d')]();});}};}function handleEntityNotFound(_0x251b4c,_0x4812d2){return function(_0x33b584){if(!_0x33b584){_0x251b4c[_0x4545('0x1b')](0x194);}return _0x33b584;};}function handleError(_0x491133,_0x563980){_0x563980=_0x563980||0x1f4;return function(_0x26976e){logger['error'](_0x26976e['stack']);if(_0x26976e[_0x4545('0x2b')]){delete _0x26976e[_0x4545('0x2b')];}_0x491133['status'](_0x563980)['send'](_0x26976e);};}exports[_0x4545('0x2c')]=function(_0x2eba96,_0x1c40fa){var _0x56e256={},_0xa256fb={},_0x35bdde={'count':0x0,'rows':[]};var _0x109b1b=_[_0x4545('0x2d')](db['VtigerAccount'][_0x4545('0x2e')],function(_0x32200a){return{'name':_0x32200a[_0x4545('0x2f')],'type':_0x32200a[_0x4545('0x30')][_0x4545('0x31')]};});_0xa256fb[_0x4545('0x32')]=_[_0x4545('0x2d')](_0x109b1b,_0x4545('0x2b'));_0xa256fb[_0x4545('0x33')]=_[_0x4545('0x34')](_0x2eba96[_0x4545('0x33')]);_0xa256fb[_0x4545('0x35')]=_[_0x4545('0x36')](_0xa256fb['model'],_0xa256fb['query']);_0x56e256[_0x4545('0x37')]=_[_0x4545('0x36')](_0xa256fb[_0x4545('0x32')],qs[_0x4545('0x38')](_0x2eba96[_0x4545('0x33')][_0x4545('0x38')]));_0x56e256[_0x4545('0x37')]=_0x56e256[_0x4545('0x37')][_0x4545('0x39')]?_0x56e256['attributes']:_0xa256fb[_0x4545('0x32')];if(!_0x2eba96[_0x4545('0x33')][_0x4545('0x3a')](_0x4545('0x3b'))){_0x56e256['limit']=qs['limit'](_0x2eba96[_0x4545('0x33')][_0x4545('0x21')]);_0x56e256[_0x4545('0x1f')]=qs['offset'](_0x2eba96[_0x4545('0x33')][_0x4545('0x1f')]);}_0x56e256[_0x4545('0x3c')]=qs[_0x4545('0x3d')](_0x2eba96['query'][_0x4545('0x3d')]);_0x56e256[_0x4545('0x3e')]=qs[_0x4545('0x35')](_['pick'](_0x2eba96[_0x4545('0x33')],_0xa256fb[_0x4545('0x35')]),_0x109b1b);if(_0x2eba96[_0x4545('0x33')]['filter']){_0x56e256[_0x4545('0x3e')]=_['merge'](_0x56e256[_0x4545('0x3e')],{'$or':_['map'](_0x109b1b,function(_0x4e1ec6){if(_0x4e1ec6[_0x4545('0x30')]!==_0x4545('0x3f')){var _0x386820={};_0x386820[_0x4e1ec6[_0x4545('0x2b')]]={'$like':'%'+_0x2eba96[_0x4545('0x33')]['filter']+'%'};return _0x386820;}})});}_0x56e256=_[_0x4545('0x40')]({},_0x56e256,_0x2eba96['options']);var _0x7d4c59={'where':_0x56e256[_0x4545('0x3e')]};return db[_0x4545('0x41')][_0x4545('0x22')](_0x7d4c59)['then'](function(_0xbdc767){_0x35bdde['count']=_0xbdc767;if(_0x2eba96[_0x4545('0x33')][_0x4545('0x42')]){_0x56e256['include']=[{'all':!![]}];}return db[_0x4545('0x41')][_0x4545('0x43')](_0x56e256);})[_0x4545('0x29')](function(_0x3fcc38){_0x35bdde[_0x4545('0x44')]=_0x3fcc38;return _0x35bdde;})[_0x4545('0x29')](respondWithFilteredResult(_0x1c40fa,_0x56e256))[_0x4545('0x45')](handleError(_0x1c40fa,null));};exports[_0x4545('0x46')]=function(_0xa587f,_0x462ef4){var _0x3cbd04={'raw':![],'where':{'id':_0xa587f[_0x4545('0x47')]['id']}},_0x3ad457={};_0x3ad457[_0x4545('0x32')]=_[_0x4545('0x34')](db['VtigerAccount'][_0x4545('0x2e')]);_0x3ad457['query']=_[_0x4545('0x34')](_0xa587f[_0x4545('0x33')]);_0x3ad457[_0x4545('0x35')]=_[_0x4545('0x36')](_0x3ad457['model'],_0x3ad457[_0x4545('0x33')]);_0x3cbd04[_0x4545('0x37')]=_[_0x4545('0x36')](_0x3ad457[_0x4545('0x32')],qs[_0x4545('0x38')](_0xa587f[_0x4545('0x33')][_0x4545('0x38')]));_0x3cbd04['attributes']=_0x3cbd04[_0x4545('0x37')][_0x4545('0x39')]?_0x3cbd04['attributes']:_0x3ad457['model'];if(_0xa587f['query']['includeAll']){_0x3cbd04[_0x4545('0x48')]=[{'all':!![]}];}_0x3cbd04=_[_0x4545('0x40')]({},_0x3cbd04,_0xa587f[_0x4545('0x49')]);return db['VtigerAccount'][_0x4545('0x4a')](_0x3cbd04)[_0x4545('0x29')](handleEntityNotFound(_0x462ef4,null))['then'](respondWithResult(_0x462ef4,null))[_0x4545('0x45')](handleError(_0x462ef4,null));};exports[_0x4545('0x4b')]=function(_0x1ac985,_0x1766ae){return db[_0x4545('0x41')]['create'](_0x1ac985[_0x4545('0x4c')],{})[_0x4545('0x29')](respondWithResult(_0x1766ae,0xc9))[_0x4545('0x45')](handleError(_0x1766ae,null));};exports[_0x4545('0x28')]=function(_0x1f08d2,_0x5529e7){if(_0x1f08d2[_0x4545('0x4c')]['id']){delete _0x1f08d2[_0x4545('0x4c')]['id'];}return db[_0x4545('0x41')][_0x4545('0x4a')]({'where':{'id':_0x1f08d2[_0x4545('0x47')]['id']}})[_0x4545('0x29')](handleEntityNotFound(_0x5529e7,null))['then'](saveUpdates(_0x1f08d2[_0x4545('0x4c')],null))['then'](respondWithResult(_0x5529e7,null))[_0x4545('0x45')](handleError(_0x5529e7,null));};exports[_0x4545('0x2a')]=function(_0x36f92c,_0x3c0015){return db[_0x4545('0x41')][_0x4545('0x4a')]({'where':{'id':_0x36f92c[_0x4545('0x47')]['id']}})[_0x4545('0x29')](handleEntityNotFound(_0x3c0015,null))[_0x4545('0x29')](removeEntity(_0x3c0015,null))['catch'](handleError(_0x3c0015,null));};exports[_0x4545('0x4d')]=function(_0x549d71,_0x563a3d,_0x8aea83){var _0x172943={};var _0x378c9e={};var _0x3f6c43;var _0x29edfd;return db[_0x4545('0x41')]['findOne']({'where':{'id':_0x549d71[_0x4545('0x47')]['id']}})[_0x4545('0x29')](handleEntityNotFound(_0x563a3d,null))['then'](function(_0x4ef8fb){if(_0x4ef8fb){_0x3f6c43=_0x4ef8fb;_0x378c9e[_0x4545('0x32')]=_[_0x4545('0x34')](db['VtigerConfiguration']['rawAttributes']);_0x378c9e[_0x4545('0x33')]=_[_0x4545('0x34')](_0x549d71[_0x4545('0x33')]);_0x378c9e[_0x4545('0x35')]=_[_0x4545('0x36')](_0x378c9e[_0x4545('0x32')],_0x378c9e[_0x4545('0x33')]);_0x172943[_0x4545('0x37')]=_[_0x4545('0x36')](_0x378c9e['model'],qs[_0x4545('0x38')](_0x549d71[_0x4545('0x33')]['fields']));_0x172943['attributes']=_0x172943[_0x4545('0x37')]['length']?_0x172943[_0x4545('0x37')]:_0x378c9e[_0x4545('0x32')];_0x172943[_0x4545('0x3c')]=qs[_0x4545('0x3d')](_0x549d71[_0x4545('0x33')][_0x4545('0x3d')]);_0x172943[_0x4545('0x3e')]=qs['filters'](_[_0x4545('0x4e')](_0x549d71[_0x4545('0x33')],_0x378c9e['filters']));if(_0x549d71[_0x4545('0x33')]['filter']){_0x172943['where']=_[_0x4545('0x40')](_0x172943['where'],{'$or':_[_0x4545('0x2d')](_0x172943['attributes'],function(_0x2d4787){var _0x1750c0={};_0x1750c0[_0x2d4787]={'$like':'%'+_0x549d71[_0x4545('0x33')][_0x4545('0x4f')]+'%'};return _0x1750c0;})});}_0x172943=_[_0x4545('0x40')]({},_0x172943,_0x549d71['options']);return _0x3f6c43[_0x4545('0x4d')](_0x172943);}})[_0x4545('0x29')](function(_0x20bd07){if(_0x20bd07){_0x29edfd=_0x20bd07[_0x4545('0x39')];if(!_0x549d71[_0x4545('0x33')][_0x4545('0x3a')]('nolimit')){_0x172943[_0x4545('0x21')]=qs[_0x4545('0x21')](_0x549d71[_0x4545('0x33')][_0x4545('0x21')]);_0x172943['offset']=qs[_0x4545('0x1f')](_0x549d71[_0x4545('0x33')][_0x4545('0x1f')]);}return _0x3f6c43[_0x4545('0x4d')](_0x172943);}})[_0x4545('0x29')](function(_0x3227d2){if(_0x3227d2){return _0x3227d2?{'count':_0x29edfd,'rows':_0x3227d2}:null;}})[_0x4545('0x29')](respondWithResult(_0x563a3d,null))['catch'](handleError(_0x563a3d,null));};exports[_0x4545('0x50')]=function(_0x5cfbf1,_0x3e9f29,_0x375880){if(_0x5cfbf1[_0x4545('0x4c')]['id']){delete _0x5cfbf1[_0x4545('0x4c')]['id'];}return db['VtigerAccount'][_0x4545('0x51')]({'where':{'id':_0x5cfbf1[_0x4545('0x47')]['id']}})[_0x4545('0x29')](handleEntityNotFound(_0x3e9f29,null))[_0x4545('0x29')](function(_0x2d959b){if(_0x2d959b){_0x5cfbf1[_0x4545('0x4c')][_0x4545('0x52')]=_0x2d959b['id'];_0x5cfbf1[_0x4545('0x4c')]['Subjects']=integrations[_0x4545('0x53')](_0x5cfbf1['body'][_0x4545('0x54')],_0x5cfbf1[_0x4545('0x4c')][_0x4545('0x30')]);_0x5cfbf1[_0x4545('0x4c')][_0x4545('0x55')]=integrations[_0x4545('0x56')](_0x5cfbf1[_0x4545('0x4c')][_0x4545('0x54')],_0x5cfbf1['body']['type']);return db['VtigerConfiguration']['create'](_0x5cfbf1[_0x4545('0x4c')],{'include':[{'model':db[_0x4545('0x57')],'as':_0x4545('0x58')},{'model':db[_0x4545('0x57')],'as':_0x4545('0x55')}]});}return null;})[_0x4545('0x29')](respondWithResult(_0x3e9f29,null))[_0x4545('0x45')](handleError(_0x3e9f29,null));};var md5=require('md5');exports[_0x4545('0x59')]=function(_0x4f1157,_0x6465bd,_0x5645af){var _0x19735f=null;var _0x3359bd=null;var _0x85eb8d=null;var _0x2ce33e=null;var _0x5669c2='';return db['VtigerAccount'][_0x4545('0x51')]({'where':{'id':_0x4f1157[_0x4545('0x47')]['id']},'attributes':['id',_0x4545('0x2b'),_0x4545('0x5a'),_0x4545('0x5b'),_0x4545('0x5c'),_0x4545('0x5d'),_0x4545('0x5e'),_0x4545('0x5f')]})['then'](handleEntityNotFound(_0x6465bd,null))[_0x4545('0x29')](function(_0x296b64){if(_0x296b64){_0x19735f=_0x296b64[_0x4545('0x5a')];_0x3359bd=_0x296b64[_0x4545('0x5f')];_0x85eb8d=_0x296b64['moduleName'];_0x5669c2=_0x296b64['remoteUri'];var _0x4b2233=_0x5669c2[_0x4545('0x60')](-0x1);if(_0x4b2233==='/'){_0x5669c2=_0x5669c2[_0x4545('0x61')](0x0,_0x5669c2['lastIndexOf'](_0x4b2233));}_0x2ce33e=util['format'](_0x4545('0x62'),_0x5669c2);var _0x5174bf={'method':_0x4545('0x63'),'uri':_0x2ce33e,'qs':{'operation':'getchallenge','username':_0x296b64['username']},'json':!![]};return rp(_0x5174bf);}})[_0x4545('0x29')](function(_0x11caed){if(_0x11caed['success']){var _0x688d3c={'method':_0x4545('0x64'),'uri':_0x2ce33e,'form':{'operation':'login','username':_0x19735f,'accessKey':md5(_0x11caed['result'][_0x4545('0x65')]+_0x3359bd)},'json':!![]};return rp(_0x688d3c);}})[_0x4545('0x29')](function(_0x48f91c){if(_0x48f91c[_0x4545('0x66')]){var _0x11f0fd={'method':'GET','uri':_0x2ce33e,'qs':{'operation':_0x4545('0x67'),'username':_0x19735f,'sessionName':_0x48f91c['result'][_0x4545('0x68')],'elementType':_0x85eb8d},'json':!![]};return rp(_0x11f0fd);}})['then'](function(_0x439afb){if(_0x439afb[_0x4545('0x66')]){var _0x422dd2=[_0x4545('0x69'),_0x4545('0x6a'),_0x4545('0x6b')];_[_0x4545('0x6c')](_0x439afb[_0x4545('0x6d')][_0x4545('0x38')],function(_0x2b75f8){return _0x422dd2['includes'](_0x2b75f8['type']['name']);});_[_0x4545('0x6c')](_0x439afb['result'][_0x4545('0x38')],function(_0x48abfc){return _0x48abfc['editable']===_0x4545('0x6e');});return{'count':_0x439afb[_0x4545('0x6d')][_0x4545('0x38')]['length'],'rows':_[_0x4545('0x2d')](_0x439afb[_0x4545('0x6d')][_0x4545('0x38')],function(_0x1f980c){return{'id':_0x1f980c[_0x4545('0x2b')],'name':_0x1f980c[_0x4545('0x6f')],'custom':_[_0x4545('0x70')](_0x1f980c[_0x4545('0x2b')],_0x4545('0x71'))?!![]:![],'options':_0x1f980c[_0x4545('0x30')][_0x4545('0x2b')]==='picklist'&&_0x1f980c['type']['picklistValues'][_0x4545('0x39')]>0x0?_[_0x4545('0x2d')](_0x1f980c[_0x4545('0x30')][_0x4545('0x72')],function(_0x19cf35){return{'name':_0x19cf35[_0x4545('0x6f')],'value':_0x19cf35[_0x4545('0x73')]};}):[]};})};}})[_0x4545('0x29')](respondWithResult(_0x6465bd,null))['catch'](function(_0x2da84f){console['log'](_0x4545('0x74')+_0x2da84f);var _0x157fcb=_0x4f1157['query'][_0x4545('0x75')]?0x1f4:_0x2da84f[_0x4545('0x76')]||0x1f4;logger['error'](_0x4545('0x77'),_0x4545('0x59'),_0x157fcb,JSON[_0x4545('0x78')](_0x2da84f));delete _0x2da84f['name'];if(_0x157fcb===0x191){_0x157fcb=0x190;}_0x6465bd[_0x4545('0x1c')](_0x157fcb)[_0x4545('0x79')](_0x4f1157['query'][_0x4545('0x75')]?{'message':_0x4545('0x7a'),'statusCode':_0x2da84f[_0x4545('0x76')]}:_0x2da84f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b07319c..c9a8f0e 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 _0x96dc=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x330ad3,_0x1b4910){var _0x4bacfc=function(_0x1246a0){while(--_0x1246a0){_0x330ad3['push'](_0x330ad3['shift']());}};_0x4bacfc(++_0x1b4910);}(_0x96dc,0x6d));var _0xc96d=function(_0x2072a1,_0x19470e){_0x2072a1=_0x2072a1-0x0;var _0x1e6ecc=_0x96dc[_0x2072a1];return _0x1e6ecc;};'use strict';var _=require(_0xc96d('0x0'));var util=require(_0xc96d('0x1'));var logger=require(_0xc96d('0x2'))(_0xc96d('0x3'));var moment=require(_0xc96d('0x4'));var BPromise=require(_0xc96d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc96d('0x6'));var rimraf=require(_0xc96d('0x7'));var config=require(_0xc96d('0x8'));var attributes=require(_0xc96d('0x9'));var integrations=require(_0xc96d('0xa'));module[_0xc96d('0xb')]=function(_0x1eb1df,_0x5f3e6c){return _0x1eb1df[_0xc96d('0xc')](_0xc96d('0xd'),attributes,{'tableName':_0xc96d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb806=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','VtigerAccount'];(function(_0x2f7dd0,_0x2935d2){var _0x37959b=function(_0xed3570){while(--_0xed3570){_0x2f7dd0['push'](_0x2f7dd0['shift']());}};_0x37959b(++_0x2935d2);}(_0xb806,0x105));var _0x6b80=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xb806[_0x20a558];return _0x53d3f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6b80('0x0'))(_0x6b80('0x1'));var moment=require(_0x6b80('0x2'));var BPromise=require(_0x6b80('0x3'));var rp=require(_0x6b80('0x4'));var fs=require('fs');var path=require(_0x6b80('0x5'));var rimraf=require('rimraf');var config=require(_0x6b80('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x6b80('0x7'));module['exports']=function(_0xa837d2,_0x3aed3d){return _0xa837d2['define'](_0x6b80('0x8'),attributes,{'tableName':'int_vtiger_accounts','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 4b9c93f..4dff0e5 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 _0x282b=['map','model','ShowVtigerAccount','VtigerAccount','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','include'];(function(_0x48e1fc,_0x241eb2){var _0x5084f0=function(_0x3c3226){while(--_0x3c3226){_0x48e1fc['push'](_0x48e1fc['shift']());}};_0x5084f0(++_0x241eb2);}(_0x282b,0xec));var _0xb282=function(_0x318228,_0x192204){_0x318228=_0x318228-0x0;var _0x217cc9=_0x282b[_0x318228];return _0x217cc9;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['VtigerAccount'][_0xb282('0x16')]({'raw':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x19')]||null:null,'attributes':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x1a')]||null:null,'limit':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')]['limit']||null:null,'include':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x1b')]?_[_0xb282('0x1c')](_0xca5f12[_0xb282('0x17')]['include'],function(_0x4d624f){return{'model':db[_0x4d624f[_0xb282('0x1d')]],'as':_0x4d624f['as'],'attributes':_0x4d624f[_0xb282('0x1a')],'include':_0x4d624f['include']?_['map'](_0x4d624f[_0xb282('0x1b')],function(_0x114f77){return{'model':db[_0x114f77[_0xb282('0x1d')]],'as':_0x114f77['as'],'attributes':_0x114f77[_0xb282('0x1a')],'include':_0x114f77[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x114f77['include'],function(_0xa0d7fb){return{'model':db[_0xa0d7fb[_0xb282('0x1d')]],'as':_0xa0d7fb['as'],'attributes':_0xa0d7fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb282('0xb')](function(_0x38a1f8){logger[_0xb282('0xc')](_0xb282('0x15'),_0xca5f12);logger['debug'](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x38a1f8));_0x3f8a3f(_0x38a1f8);})[_0xb282('0x14')](function(_0x433ad5){logger[_0xb282('0x11')](_0xb282('0x15'),_0x433ad5[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070['error'](0x1f4,_0x433ad5[_0xb282('0x12')]));});});};exports[_0xb282('0x1e')]=function(_0x3eb294){var _0xd8780b=this;return new Promise(function(_0x42ef75,_0x5f3ddf){return db[_0xb282('0x1f')]['find']({'raw':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb294['options']?_0x3eb294[_0xb282('0x17')]['where']||null:null,'attributes':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1a')]||null:null,'include':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')]?_['map'](_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')],function(_0x4ede9d){return{'model':db[_0x4ede9d['model']],'as':_0x4ede9d['as'],'attributes':_0x4ede9d[_0xb282('0x1a')],'include':_0x4ede9d[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4ede9d['include'],function(_0x4a76ce){return{'model':db[_0x4a76ce['model']],'as':_0x4a76ce['as'],'attributes':_0x4a76ce[_0xb282('0x1a')],'include':_0x4a76ce[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4a76ce[_0xb282('0x1b')],function(_0x17c1e4){return{'model':db[_0x17c1e4[_0xb282('0x1d')]],'as':_0x17c1e4['as'],'attributes':_0x17c1e4[_0xb282('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc171){logger['info'](_0xb282('0x1e'),_0x3eb294);logger[_0xb282('0x20')](_0xb282('0x1e'),_0x3eb294,JSON['stringify'](_0x3dc171));_0x42ef75(_0x3dc171);})[_0xb282('0x14')](function(_0x4beef2){logger[_0xb282('0x11')](_0xb282('0x1e'),_0x4beef2[_0xb282('0x12')],_0x3eb294);_0x5f3ddf(_0xd8780b[_0xb282('0x11')](0x1f4,_0x4beef2['message']));});});}; \ No newline at end of file +var _0xae60=['result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','include','map','model','raw','ShowVtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x33de0f,_0x1d461d){var _0x2acc16=function(_0x1145a1){while(--_0x1145a1){_0x33de0f['push'](_0x33de0f['shift']());}};_0x2acc16(++_0x1d461d);}(_0xae60,0x1c7));var _0x0ae6=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xae60[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('VtigerAccount,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});}exports[_0x0ae6('0x17')]=function(_0xda4f01){var _0x3f5c41=this;return new Promise(function(_0x2fdf25,_0x1735ba){return db[_0x0ae6('0x18')][_0x0ae6('0x19')]({'raw':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1b')]||null:null,'attributes':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1c')]||null:null,'limit':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')]['limit']||null:null,'include':_0xda4f01[_0x0ae6('0x1a')]?_0xda4f01[_0x0ae6('0x1a')][_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0xda4f01[_0x0ae6('0x1a')]['include'],function(_0x296a9d){return{'model':db[_0x296a9d[_0x0ae6('0x1f')]],'as':_0x296a9d['as'],'attributes':_0x296a9d[_0x0ae6('0x1c')],'include':_0x296a9d[_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x296a9d[_0x0ae6('0x1d')],function(_0x5b86fe){return{'model':db[_0x5b86fe[_0x0ae6('0x1f')]],'as':_0x5b86fe['as'],'attributes':_0x5b86fe[_0x0ae6('0x1c')],'include':_0x5b86fe['include']?_['map'](_0x5b86fe[_0x0ae6('0x1d')],function(_0x3255a7){return{'model':db[_0x3255a7[_0x0ae6('0x1f')]],'as':_0x3255a7['as'],'attributes':_0x3255a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ae6('0xb')](function(_0xb68cbe){logger[_0x0ae6('0xc')]('GetVtigerAccount',_0xda4f01);logger[_0x0ae6('0xe')](_0x0ae6('0x17'),_0xda4f01,JSON[_0x0ae6('0x11')](_0xb68cbe));_0x2fdf25(_0xb68cbe);})[_0x0ae6('0x16')](function(_0x14eed5){logger[_0x0ae6('0x12')]('GetVtigerAccount',_0x14eed5['message'],_0xda4f01);_0x1735ba(_0x3f5c41[_0x0ae6('0x12')](0x1f4,_0x14eed5[_0x0ae6('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4a06f1){var _0x1ca059=this;return new Promise(function(_0x278577,_0x714c6d){return db[_0x0ae6('0x18')]['find']({'raw':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x20')]===undefined?!![]:![]:!![],'where':_0x4a06f1['options']?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1b')]||null:null,'attributes':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1c')]||null:null,'include':_0x4a06f1[_0x0ae6('0x1a')]?_0x4a06f1[_0x0ae6('0x1a')][_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x4a06f1[_0x0ae6('0x1a')]['include'],function(_0x2410bd){return{'model':db[_0x2410bd[_0x0ae6('0x1f')]],'as':_0x2410bd['as'],'attributes':_0x2410bd['attributes'],'include':_0x2410bd[_0x0ae6('0x1d')]?_[_0x0ae6('0x1e')](_0x2410bd[_0x0ae6('0x1d')],function(_0x5b9662){return{'model':db[_0x5b9662[_0x0ae6('0x1f')]],'as':_0x5b9662['as'],'attributes':_0x5b9662['attributes'],'include':_0x5b9662['include']?_[_0x0ae6('0x1e')](_0x5b9662[_0x0ae6('0x1d')],function(_0x18fc19){return{'model':db[_0x18fc19[_0x0ae6('0x1f')]],'as':_0x18fc19['as'],'attributes':_0x18fc19[_0x0ae6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x584dc8){logger[_0x0ae6('0xc')]('ShowVtigerAccount',_0x4a06f1);logger[_0x0ae6('0xe')]('ShowVtigerAccount',_0x4a06f1,JSON[_0x0ae6('0x11')](_0x584dc8));_0x278577(_0x584dc8);})['catch'](function(_0x7998e3){logger[_0x0ae6('0x12')](_0x0ae6('0x21'),_0x7998e3[_0x0ae6('0x14')],_0x4a06f1);_0x714c6d(_0x1ca059['error'](0x1f4,_0x7998e3['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index eac694c..1c90999 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 _0x8736=['show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0x33fd0e,_0x462db4){var _0x1613dd=function(_0x14a45f){while(--_0x14a45f){_0x33fd0e['push'](_0x33fd0e['shift']());}};_0x1613dd(++_0x462db4);}(_0x8736,0x12b));var _0x6873=function(_0x1501e1,_0x5343a7){_0x1501e1=_0x1501e1-0x0;var _0x1c2ce2=_0x8736[_0x1501e1];return _0x1c2ce2;};'use strict';var multer=require(_0x6873('0x0'));var util=require(_0x6873('0x1'));var path=require(_0x6873('0x2'));var timeout=require('connect-timeout');var express=require(_0x6873('0x3'));var router=express[_0x6873('0x4')]();var fs_extra=require(_0x6873('0x5'));var auth=require(_0x6873('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6873('0x7'));var controller=require(_0x6873('0x8'));router[_0x6873('0x9')]('/',auth['isAuthenticated'](),controller[_0x6873('0xa')]);router[_0x6873('0x9')](_0x6873('0xb'),auth[_0x6873('0xc')](),controller[_0x6873('0xd')]);router[_0x6873('0x9')](_0x6873('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x6873('0x9')](_0x6873('0xf'),auth[_0x6873('0xc')](),controller['getSubjects']);router[_0x6873('0x9')](_0x6873('0x10'),auth[_0x6873('0xc')](),controller['getDescriptions']);router[_0x6873('0x11')]('/',auth[_0x6873('0xc')](),controller[_0x6873('0x12')]);router[_0x6873('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6873('0x14')]);router[_0x6873('0x15')](_0x6873('0xb'),auth['isAuthenticated'](),controller[_0x6873('0x16')]);module[_0x6873('0x17')]=router; \ No newline at end of file +var _0xc48b=['index','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x2d093b,_0x460963){var _0x1abe4e=function(_0x3608b4){while(--_0x3608b4){_0x2d093b['push'](_0x2d093b['shift']());}};_0x1abe4e(++_0x460963);}(_0xc48b,0x103));var _0xbc48=function(_0x55de81,_0x1ebe60){_0x55de81=_0x55de81-0x0;var _0x21d6e6=_0xc48b[_0x55de81];return _0x21d6e6;};'use strict';var multer=require(_0xbc48('0x0'));var util=require(_0xbc48('0x1'));var path=require(_0xbc48('0x2'));var timeout=require(_0xbc48('0x3'));var express=require(_0xbc48('0x4'));var router=express[_0xbc48('0x5')]();var fs_extra=require(_0xbc48('0x6'));var auth=require(_0xbc48('0x7'));var interaction=require(_0xbc48('0x8'));var config=require(_0xbc48('0x9'));var controller=require(_0xbc48('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xbc48('0xb')]);router[_0xbc48('0xc')](_0xbc48('0xd'),auth[_0xbc48('0xe')](),controller[_0xbc48('0xf')]);router['get'](_0xbc48('0x10'),auth[_0xbc48('0xe')](),controller[_0xbc48('0x11')]);router['get']('/:id/subjects',auth[_0xbc48('0xe')](),controller[_0xbc48('0x12')]);router['get'](_0xbc48('0x13'),auth[_0xbc48('0xe')](),controller['getDescriptions']);router[_0xbc48('0x14')]('/',auth[_0xbc48('0xe')](),controller[_0xbc48('0x15')]);router[_0xbc48('0x16')](_0xbc48('0xd'),auth[_0xbc48('0xe')](),controller[_0xbc48('0x17')]);router[_0xbc48('0x18')](_0xbc48('0xd'),auth[_0xbc48('0xe')](),controller[_0xbc48('0x19')]);module[_0xbc48('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 04d2fe8..6c9a9b4 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 _0xeae6=['STRING'];(function(_0xf13fc,_0x259a90){var _0x265bc0=function(_0x2ca24e){while(--_0x2ca24e){_0xf13fc['push'](_0xf13fc['shift']());}};_0x265bc0(++_0x259a90);}(_0xeae6,0x110));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6eae('0x0')]}}; \ No newline at end of file +var _0x8e4f=['sequelize','exports','STRING'];(function(_0x19cc9a,_0x3c2ab5){var _0x1ae8ef=function(_0x3ae4f4){while(--_0x3ae4f4){_0x19cc9a['push'](_0x19cc9a['shift']());}};_0x1ae8ef(++_0x3c2ab5);}(_0x8e4f,0x84));var _0xf8e4=function(_0x489cc9,_0x68371e){_0x489cc9=_0x489cc9-0x0;var _0x1d5204=_0x8e4f[_0x489cc9];return _0x1d5204;};'use strict';var Sequelize=require(_0xf8e4('0x0'));module[_0xf8e4('0x1')]={'name':{'type':Sequelize[_0xf8e4('0x2')]},'description':{'type':Sequelize[_0xf8e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ea06e79..12dd1bf 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 _0xccef=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','catch','show','params','includeAll','include','find','create','body','findOne','getFields','getSubjects','VtigerField','order','options','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type'];(function(_0x23b230,_0x29f16a){var _0x1a8b69=function(_0x12b795){while(--_0x12b795){_0x23b230['push'](_0x23b230['shift']());}};_0x1a8b69(++_0x29f16a);}(_0xccef,0x1ee));var _0xfcce=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xccef[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcce('0x1'));var rp=require(_0xfcce('0x2'));var moment=require('moment');var BPromise=require(_0xfcce('0x3'));var Mustache=require(_0xfcce('0x4'));var util=require(_0xfcce('0x5'));var path=require('path');var sox=require(_0xfcce('0x6'));var csv=require(_0xfcce('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcce('0x8'));var _=require(_0xfcce('0x9'));var squel=require('squel');var crypto=require(_0xfcce('0xa'));var jsforce=require(_0xfcce('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfcce('0xc'));var Papa=require(_0xfcce('0xd'));var Redis=require(_0xfcce('0xe'));var authService=require(_0xfcce('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfcce('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcce('0x11'))(_0xfcce('0x12'));var utils=require('../../config/utils');var config=require(_0xfcce('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcce('0x14'))['db'];function respondWithStatusCode(_0x31dfa9,_0x2032b2){_0x2032b2=_0x2032b2||0xcc;return function(_0x108006){if(_0x108006){return _0x31dfa9['sendStatus'](_0x2032b2);}return _0x31dfa9[_0xfcce('0x15')](_0x2032b2)[_0xfcce('0x16')]();};}function respondWithResult(_0x16aa15,_0x408b95){_0x408b95=_0x408b95||0xc8;return function(_0x5dfb69){if(_0x5dfb69){return _0x16aa15['status'](_0x408b95)[_0xfcce('0x17')](_0x5dfb69);}};}function respondWithFilteredResult(_0x12ed33,_0x4c5f3d){return function(_0x2de5e4){if(_0x2de5e4){var _0x368621=typeof _0x4c5f3d['offset']===_0xfcce('0x18')&&typeof _0x4c5f3d['limit']===_0xfcce('0x18');var _0xa220b1=_0x2de5e4['count'];var _0x223ca0=_0x368621?0x0:_0x4c5f3d[_0xfcce('0x19')];var _0x4015ae=_0x368621?_0x2de5e4[_0xfcce('0x1a')]:_0x4c5f3d[_0xfcce('0x19')]+_0x4c5f3d['limit'];var _0x269594;if(_0x4015ae>=_0xa220b1){_0x4015ae=_0xa220b1;_0x269594=0xc8;}else{_0x269594=0xce;}_0x12ed33[_0xfcce('0x15')](_0x269594);return _0x12ed33[_0xfcce('0x1b')](_0xfcce('0x1c'),_0x223ca0+'-'+_0x4015ae+'/'+_0xa220b1)[_0xfcce('0x17')](_0x2de5e4);}return null;};}function patchUpdates(_0x22de11){return function(_0xbea208){try{jsonpatch[_0xfcce('0x1d')](_0xbea208,_0x22de11,!![]);}catch(_0x5159b1){return BPromise[_0xfcce('0x1e')](_0x5159b1);}return _0xbea208[_0xfcce('0x1f')]();};}function saveUpdates(_0xdf091,_0xe49c67){return function(_0x2adf97){if(_0x2adf97){return _0x2adf97[_0xfcce('0x20')](_0xdf091)[_0xfcce('0x21')](function(_0x2def2c){return _0x2def2c;});}return null;};}function removeEntity(_0x3ebc8f,_0x487fcc){return function(_0x517fa0){if(_0x517fa0){return _0x517fa0[_0xfcce('0x22')]()[_0xfcce('0x21')](function(){_0x3ebc8f[_0xfcce('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c8c9,_0x5ad980){return function(_0x1ba786){if(!_0x1ba786){_0x34c8c9[_0xfcce('0x23')](0x194);}return _0x1ba786;};}function handleError(_0x36797e,_0x23c93c){_0x23c93c=_0x23c93c||0x1f4;return function(_0x5af1c8){logger[_0xfcce('0x24')](_0x5af1c8[_0xfcce('0x25')]);if(_0x5af1c8[_0xfcce('0x26')]){delete _0x5af1c8[_0xfcce('0x26')];}_0x36797e['status'](_0x23c93c)[_0xfcce('0x27')](_0x5af1c8);};}exports['index']=function(_0x44f82a,_0x104ea4){var _0x40716c={},_0x1ce273={},_0xa720a3={'count':0x0,'rows':[]};var _0x4a714e=_[_0xfcce('0x28')](db[_0xfcce('0x29')][_0xfcce('0x2a')],function(_0x5b8f0a){return{'name':_0x5b8f0a[_0xfcce('0x2b')],'type':_0x5b8f0a[_0xfcce('0x2c')][_0xfcce('0x2d')]};});_0x1ce273['model']=_['map'](_0x4a714e,_0xfcce('0x26'));_0x1ce273[_0xfcce('0x2e')]=_[_0xfcce('0x2f')](_0x44f82a[_0xfcce('0x2e')]);_0x1ce273[_0xfcce('0x30')]=_[_0xfcce('0x31')](_0x1ce273[_0xfcce('0x32')],_0x1ce273['query']);_0x40716c[_0xfcce('0x33')]=_[_0xfcce('0x31')](_0x1ce273['model'],qs[_0xfcce('0x34')](_0x44f82a[_0xfcce('0x2e')][_0xfcce('0x34')]));_0x40716c['attributes']=_0x40716c[_0xfcce('0x33')][_0xfcce('0x35')]?_0x40716c['attributes']:_0x1ce273[_0xfcce('0x32')];if(!_0x44f82a[_0xfcce('0x2e')][_0xfcce('0x36')](_0xfcce('0x37'))){_0x40716c[_0xfcce('0x38')]=qs[_0xfcce('0x38')](_0x44f82a[_0xfcce('0x2e')][_0xfcce('0x38')]);_0x40716c[_0xfcce('0x19')]=qs['offset'](_0x44f82a[_0xfcce('0x2e')][_0xfcce('0x19')]);}_0x40716c['order']=qs[_0xfcce('0x39')](_0x44f82a[_0xfcce('0x2e')][_0xfcce('0x39')]);_0x40716c[_0xfcce('0x3a')]=qs['filters'](_[_0xfcce('0x3b')](_0x44f82a['query'],_0x1ce273[_0xfcce('0x30')]),_0x4a714e);if(_0x44f82a[_0xfcce('0x2e')][_0xfcce('0x3c')]){_0x40716c[_0xfcce('0x3a')]=_[_0xfcce('0x3d')](_0x40716c[_0xfcce('0x3a')],{'$or':_['map'](_0x4a714e,function(_0x5d043f){if(_0x5d043f[_0xfcce('0x2c')]!=='VIRTUAL'){var _0x25ecc1={};_0x25ecc1[_0x5d043f[_0xfcce('0x26')]]={'$like':'%'+_0x44f82a['query']['filter']+'%'};return _0x25ecc1;}})});}_0x40716c=_[_0xfcce('0x3d')]({},_0x40716c,_0x44f82a['options']);var _0x511789={'where':_0x40716c[_0xfcce('0x3a')]};return db[_0xfcce('0x29')][_0xfcce('0x1a')](_0x511789)[_0xfcce('0x21')](function(_0x495c79){_0xa720a3[_0xfcce('0x1a')]=_0x495c79;if(_0x44f82a[_0xfcce('0x2e')]['includeAll']){_0x40716c['include']=[{'all':!![]}];}return db[_0xfcce('0x29')]['findAll'](_0x40716c);})[_0xfcce('0x21')](function(_0x5d2380){_0xa720a3['rows']=_0x5d2380;return _0xa720a3;})['then'](respondWithFilteredResult(_0x104ea4,_0x40716c))[_0xfcce('0x3e')](handleError(_0x104ea4,null));};exports[_0xfcce('0x3f')]=function(_0x43da1b,_0x42ac0d){var _0x15f7c7={'raw':![],'where':{'id':_0x43da1b[_0xfcce('0x40')]['id']}},_0x5768d0={};_0x5768d0['model']=_[_0xfcce('0x2f')](db['VtigerConfiguration']['rawAttributes']);_0x5768d0[_0xfcce('0x2e')]=_[_0xfcce('0x2f')](_0x43da1b[_0xfcce('0x2e')]);_0x5768d0[_0xfcce('0x30')]=_['intersection'](_0x5768d0[_0xfcce('0x32')],_0x5768d0[_0xfcce('0x2e')]);_0x15f7c7[_0xfcce('0x33')]=_[_0xfcce('0x31')](_0x5768d0[_0xfcce('0x32')],qs[_0xfcce('0x34')](_0x43da1b[_0xfcce('0x2e')][_0xfcce('0x34')]));_0x15f7c7[_0xfcce('0x33')]=_0x15f7c7[_0xfcce('0x33')][_0xfcce('0x35')]?_0x15f7c7['attributes']:_0x5768d0[_0xfcce('0x32')];if(_0x43da1b[_0xfcce('0x2e')][_0xfcce('0x41')]){_0x15f7c7[_0xfcce('0x42')]=[{'all':!![]}];}_0x15f7c7=_['merge']({},_0x15f7c7,_0x43da1b['options']);return db[_0xfcce('0x29')][_0xfcce('0x43')](_0x15f7c7)['then'](handleEntityNotFound(_0x42ac0d,null))[_0xfcce('0x21')](respondWithResult(_0x42ac0d,null))[_0xfcce('0x3e')](handleError(_0x42ac0d,null));};exports[_0xfcce('0x44')]=function(_0x3fa6cf,_0x7361d9){return db[_0xfcce('0x29')]['create'](_0x3fa6cf[_0xfcce('0x45')],{})[_0xfcce('0x21')](respondWithResult(_0x7361d9,0xc9))[_0xfcce('0x3e')](handleError(_0x7361d9,null));};exports[_0xfcce('0x20')]=function(_0x5e18f9,_0x5bbe8f){if(_0x5e18f9[_0xfcce('0x45')]['id']){delete _0x5e18f9[_0xfcce('0x45')]['id'];}return db[_0xfcce('0x29')]['find']({'where':{'id':_0x5e18f9[_0xfcce('0x40')]['id']}})[_0xfcce('0x21')](handleEntityNotFound(_0x5bbe8f,null))[_0xfcce('0x21')](saveUpdates(_0x5e18f9['body'],null))[_0xfcce('0x21')](respondWithResult(_0x5bbe8f,null))[_0xfcce('0x3e')](handleError(_0x5bbe8f,null));};exports[_0xfcce('0x22')]=function(_0x2d609b,_0x4a0245){return db['VtigerConfiguration'][_0xfcce('0x43')]({'where':{'id':_0x2d609b[_0xfcce('0x40')]['id']}})[_0xfcce('0x21')](handleEntityNotFound(_0x4a0245,null))[_0xfcce('0x21')](removeEntity(_0x4a0245,null))[_0xfcce('0x3e')](handleError(_0x4a0245,null));};exports['getFields']=function(_0x452d01,_0x2420a1,_0x4c2c6a){var _0x173ab7={};var _0x31a868={};var _0x5e124b;var _0x2ae9fb;return db['VtigerConfiguration'][_0xfcce('0x46')]({'where':{'id':_0x452d01[_0xfcce('0x40')]['id']}})['then'](handleEntityNotFound(_0x2420a1,null))[_0xfcce('0x21')](function(_0x2f1f65){if(_0x2f1f65){_0x5e124b=_0x2f1f65;_0x31a868[_0xfcce('0x32')]=_[_0xfcce('0x2f')](db['VtigerField'][_0xfcce('0x2a')]);_0x31a868[_0xfcce('0x2e')]=_[_0xfcce('0x2f')](_0x452d01[_0xfcce('0x2e')]);_0x31a868['filters']=_[_0xfcce('0x31')](_0x31a868[_0xfcce('0x32')],_0x31a868[_0xfcce('0x2e')]);_0x173ab7[_0xfcce('0x33')]=_['intersection'](_0x31a868[_0xfcce('0x32')],qs['fields'](_0x452d01[_0xfcce('0x2e')][_0xfcce('0x34')]));_0x173ab7[_0xfcce('0x33')]=_0x173ab7[_0xfcce('0x33')][_0xfcce('0x35')]?_0x173ab7[_0xfcce('0x33')]:_0x31a868[_0xfcce('0x32')];_0x173ab7['order']=qs['sort'](_0x452d01[_0xfcce('0x2e')][_0xfcce('0x39')]);_0x173ab7[_0xfcce('0x3a')]=qs[_0xfcce('0x30')](_['pick'](_0x452d01[_0xfcce('0x2e')],_0x31a868[_0xfcce('0x30')]));if(_0x452d01['query'][_0xfcce('0x3c')]){_0x173ab7[_0xfcce('0x3a')]=_['merge'](_0x173ab7['where'],{'$or':_['map'](_0x173ab7['attributes'],function(_0x38aca0){var _0x2d1829={};_0x2d1829[_0x38aca0]={'$like':'%'+_0x452d01[_0xfcce('0x2e')][_0xfcce('0x3c')]+'%'};return _0x2d1829;})});}_0x173ab7=_['merge']({},_0x173ab7,_0x452d01['options']);return _0x5e124b[_0xfcce('0x47')](_0x173ab7);}})[_0xfcce('0x21')](function(_0x21cdb1){if(_0x21cdb1){_0x2ae9fb=_0x21cdb1[_0xfcce('0x35')];if(!_0x452d01[_0xfcce('0x2e')][_0xfcce('0x36')](_0xfcce('0x37'))){_0x173ab7['limit']=qs[_0xfcce('0x38')](_0x452d01['query'][_0xfcce('0x38')]);_0x173ab7[_0xfcce('0x19')]=qs[_0xfcce('0x19')](_0x452d01[_0xfcce('0x2e')]['offset']);}return _0x5e124b[_0xfcce('0x47')](_0x173ab7);}})[_0xfcce('0x21')](function(_0x4a5ce0){if(_0x4a5ce0){return _0x4a5ce0?{'count':_0x2ae9fb,'rows':_0x4a5ce0}:null;}})[_0xfcce('0x21')](respondWithResult(_0x2420a1,null))['catch'](handleError(_0x2420a1,null));};exports[_0xfcce('0x48')]=function(_0x25499f,_0x269d66,_0x42e626){var _0x47a8a6={};var _0x4d02cf={};var _0x3e5703;var _0x40f2f0;return db['VtigerConfiguration'][_0xfcce('0x46')]({'where':{'id':_0x25499f[_0xfcce('0x40')]['id']}})[_0xfcce('0x21')](handleEntityNotFound(_0x269d66,null))[_0xfcce('0x21')](function(_0x1e00e3){if(_0x1e00e3){_0x3e5703=_0x1e00e3;_0x4d02cf['model']=_[_0xfcce('0x2f')](db[_0xfcce('0x49')]['rawAttributes']);_0x4d02cf[_0xfcce('0x2e')]=_['keys'](_0x25499f[_0xfcce('0x2e')]);_0x4d02cf[_0xfcce('0x30')]=_[_0xfcce('0x31')](_0x4d02cf[_0xfcce('0x32')],_0x4d02cf[_0xfcce('0x2e')]);_0x47a8a6[_0xfcce('0x33')]=_['intersection'](_0x4d02cf[_0xfcce('0x32')],qs[_0xfcce('0x34')](_0x25499f[_0xfcce('0x2e')][_0xfcce('0x34')]));_0x47a8a6[_0xfcce('0x33')]=_0x47a8a6['attributes'][_0xfcce('0x35')]?_0x47a8a6['attributes']:_0x4d02cf[_0xfcce('0x32')];_0x47a8a6[_0xfcce('0x4a')]=qs[_0xfcce('0x39')](_0x25499f[_0xfcce('0x2e')][_0xfcce('0x39')]);_0x47a8a6[_0xfcce('0x3a')]=qs[_0xfcce('0x30')](_['pick'](_0x25499f['query'],_0x4d02cf[_0xfcce('0x30')]));if(_0x25499f[_0xfcce('0x2e')][_0xfcce('0x3c')]){_0x47a8a6['where']=_[_0xfcce('0x3d')](_0x47a8a6[_0xfcce('0x3a')],{'$or':_[_0xfcce('0x28')](_0x47a8a6['attributes'],function(_0x3990d8){var _0x52b0dc={};_0x52b0dc[_0x3990d8]={'$like':'%'+_0x25499f[_0xfcce('0x2e')]['filter']+'%'};return _0x52b0dc;})});}_0x47a8a6=_['merge']({},_0x47a8a6,_0x25499f[_0xfcce('0x4b')]);return _0x3e5703[_0xfcce('0x48')](_0x47a8a6);}})[_0xfcce('0x21')](function(_0x3ef631){if(_0x3ef631){_0x40f2f0=_0x3ef631['length'];if(!_0x25499f[_0xfcce('0x2e')][_0xfcce('0x36')](_0xfcce('0x37'))){_0x47a8a6[_0xfcce('0x38')]=qs[_0xfcce('0x38')](_0x25499f[_0xfcce('0x2e')][_0xfcce('0x38')]);_0x47a8a6[_0xfcce('0x19')]=qs['offset'](_0x25499f[_0xfcce('0x2e')][_0xfcce('0x19')]);}return _0x3e5703[_0xfcce('0x48')](_0x47a8a6);}})[_0xfcce('0x21')](function(_0x29b7fd){if(_0x29b7fd){return _0x29b7fd?{'count':_0x40f2f0,'rows':_0x29b7fd}:null;}})[_0xfcce('0x21')](respondWithResult(_0x269d66,null))['catch'](handleError(_0x269d66,null));};exports[_0xfcce('0x4c')]=function(_0x174296,_0x1cf064,_0x5e4c76){var _0x366889={};var _0x49208a={};var _0x217bb9;var _0xc667b2;return db[_0xfcce('0x29')][_0xfcce('0x46')]({'where':{'id':_0x174296[_0xfcce('0x40')]['id']}})['then'](handleEntityNotFound(_0x1cf064,null))[_0xfcce('0x21')](function(_0x30b277){if(_0x30b277){_0x217bb9=_0x30b277;_0x49208a[_0xfcce('0x32')]=_[_0xfcce('0x2f')](db[_0xfcce('0x49')][_0xfcce('0x2a')]);_0x49208a[_0xfcce('0x2e')]=_['keys'](_0x174296[_0xfcce('0x2e')]);_0x49208a[_0xfcce('0x30')]=_[_0xfcce('0x31')](_0x49208a[_0xfcce('0x32')],_0x49208a['query']);_0x366889[_0xfcce('0x33')]=_[_0xfcce('0x31')](_0x49208a['model'],qs[_0xfcce('0x34')](_0x174296[_0xfcce('0x2e')][_0xfcce('0x34')]));_0x366889[_0xfcce('0x33')]=_0x366889['attributes']['length']?_0x366889['attributes']:_0x49208a[_0xfcce('0x32')];_0x366889[_0xfcce('0x4a')]=qs[_0xfcce('0x39')](_0x174296[_0xfcce('0x2e')]['sort']);_0x366889[_0xfcce('0x3a')]=qs[_0xfcce('0x30')](_[_0xfcce('0x3b')](_0x174296[_0xfcce('0x2e')],_0x49208a[_0xfcce('0x30')]));if(_0x174296[_0xfcce('0x2e')][_0xfcce('0x3c')]){_0x366889[_0xfcce('0x3a')]=_['merge'](_0x366889['where'],{'$or':_[_0xfcce('0x28')](_0x366889[_0xfcce('0x33')],function(_0x10f046){var _0x50470c={};_0x50470c[_0x10f046]={'$like':'%'+_0x174296[_0xfcce('0x2e')][_0xfcce('0x3c')]+'%'};return _0x50470c;})});}_0x366889=_[_0xfcce('0x3d')]({},_0x366889,_0x174296[_0xfcce('0x4b')]);return _0x217bb9[_0xfcce('0x4c')](_0x366889);}})[_0xfcce('0x21')](function(_0x2a1f34){if(_0x2a1f34){_0xc667b2=_0x2a1f34[_0xfcce('0x35')];if(!_0x174296[_0xfcce('0x2e')]['hasOwnProperty']('nolimit')){_0x366889['limit']=qs[_0xfcce('0x38')](_0x174296[_0xfcce('0x2e')]['limit']);_0x366889['offset']=qs[_0xfcce('0x19')](_0x174296[_0xfcce('0x2e')][_0xfcce('0x19')]);}return _0x217bb9[_0xfcce('0x4c')](_0x366889);}})[_0xfcce('0x21')](function(_0x2d6d73){if(_0x2d6d73){return _0x2d6d73?{'count':_0xc667b2,'rows':_0x2d6d73}:null;}})[_0xfcce('0x21')](respondWithResult(_0x1cf064,null))[_0xfcce('0x3e')](handleError(_0x1cf064,null));}; \ No newline at end of file +var _0xc75f=['util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x2a4c2b,_0x1ce4a3){var _0x5c5cd1=function(_0x2f65e4){while(--_0x2f65e4){_0x2a4c2b['push'](_0x2a4c2b['shift']());}};_0x5c5cd1(++_0x1ce4a3);}(_0xc75f,0xf6));var _0xfc75=function(_0x5b1208,_0x1cb2b9){_0x5b1208=_0x5b1208-0x0;var _0x1c2346=_0xc75f[_0x5b1208];return _0x1c2346;};'use strict';var emlformat=require(_0xfc75('0x0'));var rimraf=require(_0xfc75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc75('0x2'));var moment=require(_0xfc75('0x3'));var BPromise=require(_0xfc75('0x4'));var Mustache=require(_0xfc75('0x5'));var util=require(_0xfc75('0x6'));var path=require(_0xfc75('0x7'));var sox=require(_0xfc75('0x8'));var csv=require('to-csv');var ejs=require(_0xfc75('0x9'));var fs=require('fs');var fs_extra=require(_0xfc75('0xa'));var _=require(_0xfc75('0xb'));var squel=require(_0xfc75('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc75('0xd'));var toCsv=require(_0xfc75('0xe'));var querystring=require(_0xfc75('0xf'));var Papa=require(_0xfc75('0x10'));var Redis=require(_0xfc75('0x11'));var authService=require(_0xfc75('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc75('0x13'));var hardwareService=require(_0xfc75('0x14'));var logger=require('../../config/logger')(_0xfc75('0x15'));var utils=require(_0xfc75('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfc75('0x17'));var db=require(_0xfc75('0x18'))['db'];function respondWithStatusCode(_0x4b5d36,_0x31fe55){_0x31fe55=_0x31fe55||0xcc;return function(_0x508d5a){if(_0x508d5a){return _0x4b5d36['sendStatus'](_0x31fe55);}return _0x4b5d36[_0xfc75('0x19')](_0x31fe55)[_0xfc75('0x1a')]();};}function respondWithResult(_0x14042e,_0x1c9966){_0x1c9966=_0x1c9966||0xc8;return function(_0x2a8477){if(_0x2a8477){return _0x14042e[_0xfc75('0x19')](_0x1c9966)[_0xfc75('0x1b')](_0x2a8477);}};}function respondWithFilteredResult(_0x572584,_0x1feaaa){return function(_0x2c66c7){if(_0x2c66c7){var _0x15b260=typeof _0x1feaaa[_0xfc75('0x1c')]==='undefined'&&typeof _0x1feaaa[_0xfc75('0x1d')]===_0xfc75('0x1e');var _0x31f149=_0x2c66c7[_0xfc75('0x1f')];var _0x1b5367=_0x15b260?0x0:_0x1feaaa[_0xfc75('0x1c')];var _0x238d84=_0x15b260?_0x2c66c7[_0xfc75('0x1f')]:_0x1feaaa[_0xfc75('0x1c')]+_0x1feaaa[_0xfc75('0x1d')];var _0x51693d;if(_0x238d84>=_0x31f149){_0x238d84=_0x31f149;_0x51693d=0xc8;}else{_0x51693d=0xce;}_0x572584['status'](_0x51693d);return _0x572584['set'](_0xfc75('0x20'),_0x1b5367+'-'+_0x238d84+'/'+_0x31f149)[_0xfc75('0x1b')](_0x2c66c7);}return null;};}function patchUpdates(_0x582bc5){return function(_0x3d5266){try{jsonpatch[_0xfc75('0x21')](_0x3d5266,_0x582bc5,!![]);}catch(_0x422a2d){return BPromise[_0xfc75('0x22')](_0x422a2d);}return _0x3d5266[_0xfc75('0x23')]();};}function saveUpdates(_0x5223d7,_0x3936b3){return function(_0x196589){if(_0x196589){return _0x196589[_0xfc75('0x24')](_0x5223d7)[_0xfc75('0x25')](function(_0x5b71a4){return _0x5b71a4;});}return null;};}function removeEntity(_0x1b5318,_0xb262d5){return function(_0x38a5b8){if(_0x38a5b8){return _0x38a5b8['destroy']()[_0xfc75('0x25')](function(){_0x1b5318[_0xfc75('0x19')](0xcc)[_0xfc75('0x1a')]();});}};}function handleEntityNotFound(_0x3ea6a2,_0x2cfd3d){return function(_0x441947){if(!_0x441947){_0x3ea6a2[_0xfc75('0x26')](0x194);}return _0x441947;};}function handleError(_0x8c4305,_0x2898c2){_0x2898c2=_0x2898c2||0x1f4;return function(_0x220d32){logger[_0xfc75('0x27')](_0x220d32[_0xfc75('0x28')]);if(_0x220d32['name']){delete _0x220d32[_0xfc75('0x29')];}_0x8c4305[_0xfc75('0x19')](_0x2898c2)[_0xfc75('0x2a')](_0x220d32);};}exports[_0xfc75('0x2b')]=function(_0x3f0da3,_0x1f91ca){var _0x1f05bf={},_0x5cae1d={},_0x327a1b={'count':0x0,'rows':[]};var _0x537e10=_[_0xfc75('0x2c')](db['VtigerConfiguration'][_0xfc75('0x2d')],function(_0x52e361){return{'name':_0x52e361[_0xfc75('0x2e')],'type':_0x52e361[_0xfc75('0x2f')][_0xfc75('0x30')]};});_0x5cae1d[_0xfc75('0x31')]=_[_0xfc75('0x2c')](_0x537e10,_0xfc75('0x29'));_0x5cae1d[_0xfc75('0x32')]=_[_0xfc75('0x33')](_0x3f0da3[_0xfc75('0x32')]);_0x5cae1d[_0xfc75('0x34')]=_[_0xfc75('0x35')](_0x5cae1d[_0xfc75('0x31')],_0x5cae1d[_0xfc75('0x32')]);_0x1f05bf[_0xfc75('0x36')]=_[_0xfc75('0x35')](_0x5cae1d['model'],qs[_0xfc75('0x37')](_0x3f0da3[_0xfc75('0x32')]['fields']));_0x1f05bf['attributes']=_0x1f05bf[_0xfc75('0x36')]['length']?_0x1f05bf[_0xfc75('0x36')]:_0x5cae1d[_0xfc75('0x31')];if(!_0x3f0da3[_0xfc75('0x32')][_0xfc75('0x38')](_0xfc75('0x39'))){_0x1f05bf['limit']=qs['limit'](_0x3f0da3[_0xfc75('0x32')]['limit']);_0x1f05bf['offset']=qs['offset'](_0x3f0da3[_0xfc75('0x32')][_0xfc75('0x1c')]);}_0x1f05bf[_0xfc75('0x3a')]=qs['sort'](_0x3f0da3[_0xfc75('0x32')][_0xfc75('0x3b')]);_0x1f05bf[_0xfc75('0x3c')]=qs['filters'](_[_0xfc75('0x3d')](_0x3f0da3[_0xfc75('0x32')],_0x5cae1d['filters']),_0x537e10);if(_0x3f0da3[_0xfc75('0x32')]['filter']){_0x1f05bf[_0xfc75('0x3c')]=_['merge'](_0x1f05bf[_0xfc75('0x3c')],{'$or':_[_0xfc75('0x2c')](_0x537e10,function(_0x22f452){if(_0x22f452[_0xfc75('0x2f')]!==_0xfc75('0x3e')){var _0x4ea199={};_0x4ea199[_0x22f452[_0xfc75('0x29')]]={'$like':'%'+_0x3f0da3['query'][_0xfc75('0x3f')]+'%'};return _0x4ea199;}})});}_0x1f05bf=_[_0xfc75('0x40')]({},_0x1f05bf,_0x3f0da3['options']);var _0xc2f5ca={'where':_0x1f05bf['where']};return db[_0xfc75('0x41')][_0xfc75('0x1f')](_0xc2f5ca)['then'](function(_0x12226f){_0x327a1b[_0xfc75('0x1f')]=_0x12226f;if(_0x3f0da3[_0xfc75('0x32')][_0xfc75('0x42')]){_0x1f05bf[_0xfc75('0x43')]=[{'all':!![]}];}return db[_0xfc75('0x41')][_0xfc75('0x44')](_0x1f05bf);})[_0xfc75('0x25')](function(_0x273180){_0x327a1b[_0xfc75('0x45')]=_0x273180;return _0x327a1b;})[_0xfc75('0x25')](respondWithFilteredResult(_0x1f91ca,_0x1f05bf))[_0xfc75('0x46')](handleError(_0x1f91ca,null));};exports[_0xfc75('0x47')]=function(_0x1ada59,_0x49725a){var _0x228dab={'raw':![],'where':{'id':_0x1ada59[_0xfc75('0x48')]['id']}},_0x42a211={};_0x42a211[_0xfc75('0x31')]=_[_0xfc75('0x33')](db[_0xfc75('0x41')]['rawAttributes']);_0x42a211[_0xfc75('0x32')]=_[_0xfc75('0x33')](_0x1ada59[_0xfc75('0x32')]);_0x42a211[_0xfc75('0x34')]=_[_0xfc75('0x35')](_0x42a211[_0xfc75('0x31')],_0x42a211['query']);_0x228dab['attributes']=_['intersection'](_0x42a211[_0xfc75('0x31')],qs[_0xfc75('0x37')](_0x1ada59[_0xfc75('0x32')][_0xfc75('0x37')]));_0x228dab[_0xfc75('0x36')]=_0x228dab[_0xfc75('0x36')][_0xfc75('0x49')]?_0x228dab[_0xfc75('0x36')]:_0x42a211[_0xfc75('0x31')];if(_0x1ada59[_0xfc75('0x32')]['includeAll']){_0x228dab[_0xfc75('0x43')]=[{'all':!![]}];}_0x228dab=_[_0xfc75('0x40')]({},_0x228dab,_0x1ada59[_0xfc75('0x4a')]);return db[_0xfc75('0x41')]['find'](_0x228dab)[_0xfc75('0x25')](handleEntityNotFound(_0x49725a,null))[_0xfc75('0x25')](respondWithResult(_0x49725a,null))[_0xfc75('0x46')](handleError(_0x49725a,null));};exports[_0xfc75('0x4b')]=function(_0x1e3ca6,_0x10ca74){return db['VtigerConfiguration'][_0xfc75('0x4b')](_0x1e3ca6['body'],{})[_0xfc75('0x25')](respondWithResult(_0x10ca74,0xc9))['catch'](handleError(_0x10ca74,null));};exports['update']=function(_0x35b706,_0x1b5036){if(_0x35b706['body']['id']){delete _0x35b706[_0xfc75('0x4c')]['id'];}return db['VtigerConfiguration'][_0xfc75('0x4d')]({'where':{'id':_0x35b706[_0xfc75('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b5036,null))[_0xfc75('0x25')](saveUpdates(_0x35b706['body'],null))['then'](respondWithResult(_0x1b5036,null))[_0xfc75('0x46')](handleError(_0x1b5036,null));};exports[_0xfc75('0x4e')]=function(_0x5d88be,_0x4a5ff7){return db[_0xfc75('0x41')]['find']({'where':{'id':_0x5d88be[_0xfc75('0x48')]['id']}})[_0xfc75('0x25')](handleEntityNotFound(_0x4a5ff7,null))[_0xfc75('0x25')](removeEntity(_0x4a5ff7,null))[_0xfc75('0x46')](handleError(_0x4a5ff7,null));};exports[_0xfc75('0x4f')]=function(_0x4d7918,_0x3f8927,_0x1f31c3){var _0x2dab37={};var _0x3fbb9b={};var _0x3b7d84;var _0x212e73;return db[_0xfc75('0x41')][_0xfc75('0x50')]({'where':{'id':_0x4d7918[_0xfc75('0x48')]['id']}})[_0xfc75('0x25')](handleEntityNotFound(_0x3f8927,null))['then'](function(_0x30374d){if(_0x30374d){_0x3b7d84=_0x30374d;_0x3fbb9b['model']=_[_0xfc75('0x33')](db[_0xfc75('0x51')]['rawAttributes']);_0x3fbb9b['query']=_[_0xfc75('0x33')](_0x4d7918[_0xfc75('0x32')]);_0x3fbb9b[_0xfc75('0x34')]=_['intersection'](_0x3fbb9b[_0xfc75('0x31')],_0x3fbb9b[_0xfc75('0x32')]);_0x2dab37[_0xfc75('0x36')]=_['intersection'](_0x3fbb9b[_0xfc75('0x31')],qs[_0xfc75('0x37')](_0x4d7918['query'][_0xfc75('0x37')]));_0x2dab37[_0xfc75('0x36')]=_0x2dab37[_0xfc75('0x36')][_0xfc75('0x49')]?_0x2dab37[_0xfc75('0x36')]:_0x3fbb9b['model'];_0x2dab37[_0xfc75('0x3a')]=qs['sort'](_0x4d7918[_0xfc75('0x32')][_0xfc75('0x3b')]);_0x2dab37[_0xfc75('0x3c')]=qs[_0xfc75('0x34')](_[_0xfc75('0x3d')](_0x4d7918[_0xfc75('0x32')],_0x3fbb9b[_0xfc75('0x34')]));if(_0x4d7918['query'][_0xfc75('0x3f')]){_0x2dab37[_0xfc75('0x3c')]=_[_0xfc75('0x40')](_0x2dab37[_0xfc75('0x3c')],{'$or':_[_0xfc75('0x2c')](_0x2dab37[_0xfc75('0x36')],function(_0x214681){var _0x1c3aae={};_0x1c3aae[_0x214681]={'$like':'%'+_0x4d7918[_0xfc75('0x32')][_0xfc75('0x3f')]+'%'};return _0x1c3aae;})});}_0x2dab37=_[_0xfc75('0x40')]({},_0x2dab37,_0x4d7918[_0xfc75('0x4a')]);return _0x3b7d84[_0xfc75('0x4f')](_0x2dab37);}})[_0xfc75('0x25')](function(_0x3d9508){if(_0x3d9508){_0x212e73=_0x3d9508[_0xfc75('0x49')];if(!_0x4d7918[_0xfc75('0x32')][_0xfc75('0x38')](_0xfc75('0x39'))){_0x2dab37[_0xfc75('0x1d')]=qs[_0xfc75('0x1d')](_0x4d7918[_0xfc75('0x32')][_0xfc75('0x1d')]);_0x2dab37[_0xfc75('0x1c')]=qs[_0xfc75('0x1c')](_0x4d7918[_0xfc75('0x32')][_0xfc75('0x1c')]);}return _0x3b7d84[_0xfc75('0x4f')](_0x2dab37);}})[_0xfc75('0x25')](function(_0x41d21f){if(_0x41d21f){return _0x41d21f?{'count':_0x212e73,'rows':_0x41d21f}:null;}})[_0xfc75('0x25')](respondWithResult(_0x3f8927,null))[_0xfc75('0x46')](handleError(_0x3f8927,null));};exports['getSubjects']=function(_0x28424e,_0x26c406,_0x598e5a){var _0x33b446={};var _0x3b14f3={};var _0x32f977;var _0x1a8657;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x28424e[_0xfc75('0x48')]['id']}})[_0xfc75('0x25')](handleEntityNotFound(_0x26c406,null))[_0xfc75('0x25')](function(_0x32ddeb){if(_0x32ddeb){_0x32f977=_0x32ddeb;_0x3b14f3[_0xfc75('0x31')]=_[_0xfc75('0x33')](db[_0xfc75('0x51')][_0xfc75('0x2d')]);_0x3b14f3[_0xfc75('0x32')]=_[_0xfc75('0x33')](_0x28424e[_0xfc75('0x32')]);_0x3b14f3[_0xfc75('0x34')]=_[_0xfc75('0x35')](_0x3b14f3[_0xfc75('0x31')],_0x3b14f3[_0xfc75('0x32')]);_0x33b446[_0xfc75('0x36')]=_[_0xfc75('0x35')](_0x3b14f3[_0xfc75('0x31')],qs[_0xfc75('0x37')](_0x28424e[_0xfc75('0x32')][_0xfc75('0x37')]));_0x33b446['attributes']=_0x33b446[_0xfc75('0x36')][_0xfc75('0x49')]?_0x33b446[_0xfc75('0x36')]:_0x3b14f3[_0xfc75('0x31')];_0x33b446['order']=qs['sort'](_0x28424e[_0xfc75('0x32')][_0xfc75('0x3b')]);_0x33b446[_0xfc75('0x3c')]=qs[_0xfc75('0x34')](_[_0xfc75('0x3d')](_0x28424e[_0xfc75('0x32')],_0x3b14f3[_0xfc75('0x34')]));if(_0x28424e[_0xfc75('0x32')][_0xfc75('0x3f')]){_0x33b446[_0xfc75('0x3c')]=_[_0xfc75('0x40')](_0x33b446[_0xfc75('0x3c')],{'$or':_[_0xfc75('0x2c')](_0x33b446['attributes'],function(_0x328d58){var _0x2da29e={};_0x2da29e[_0x328d58]={'$like':'%'+_0x28424e['query']['filter']+'%'};return _0x2da29e;})});}_0x33b446=_[_0xfc75('0x40')]({},_0x33b446,_0x28424e[_0xfc75('0x4a')]);return _0x32f977[_0xfc75('0x52')](_0x33b446);}})['then'](function(_0x19977d){if(_0x19977d){_0x1a8657=_0x19977d[_0xfc75('0x49')];if(!_0x28424e['query'][_0xfc75('0x38')](_0xfc75('0x39'))){_0x33b446[_0xfc75('0x1d')]=qs[_0xfc75('0x1d')](_0x28424e['query'][_0xfc75('0x1d')]);_0x33b446[_0xfc75('0x1c')]=qs['offset'](_0x28424e[_0xfc75('0x32')]['offset']);}return _0x32f977[_0xfc75('0x52')](_0x33b446);}})[_0xfc75('0x25')](function(_0x3828d1){if(_0x3828d1){return _0x3828d1?{'count':_0x1a8657,'rows':_0x3828d1}:null;}})['then'](respondWithResult(_0x26c406,null))[_0xfc75('0x46')](handleError(_0x26c406,null));};exports[_0xfc75('0x53')]=function(_0x34e3be,_0x2cc7cc,_0x553350){var _0x46e17a={};var _0x778712={};var _0x36e47a;var _0x25533a;return db[_0xfc75('0x41')][_0xfc75('0x50')]({'where':{'id':_0x34e3be[_0xfc75('0x48')]['id']}})[_0xfc75('0x25')](handleEntityNotFound(_0x2cc7cc,null))[_0xfc75('0x25')](function(_0x5e3ec9){if(_0x5e3ec9){_0x36e47a=_0x5e3ec9;_0x778712[_0xfc75('0x31')]=_['keys'](db[_0xfc75('0x51')][_0xfc75('0x2d')]);_0x778712['query']=_[_0xfc75('0x33')](_0x34e3be['query']);_0x778712['filters']=_['intersection'](_0x778712['model'],_0x778712['query']);_0x46e17a['attributes']=_[_0xfc75('0x35')](_0x778712[_0xfc75('0x31')],qs['fields'](_0x34e3be[_0xfc75('0x32')][_0xfc75('0x37')]));_0x46e17a[_0xfc75('0x36')]=_0x46e17a[_0xfc75('0x36')][_0xfc75('0x49')]?_0x46e17a[_0xfc75('0x36')]:_0x778712['model'];_0x46e17a[_0xfc75('0x3a')]=qs[_0xfc75('0x3b')](_0x34e3be[_0xfc75('0x32')]['sort']);_0x46e17a['where']=qs[_0xfc75('0x34')](_[_0xfc75('0x3d')](_0x34e3be[_0xfc75('0x32')],_0x778712[_0xfc75('0x34')]));if(_0x34e3be[_0xfc75('0x32')][_0xfc75('0x3f')]){_0x46e17a['where']=_[_0xfc75('0x40')](_0x46e17a[_0xfc75('0x3c')],{'$or':_[_0xfc75('0x2c')](_0x46e17a[_0xfc75('0x36')],function(_0x3b769b){var _0x922636={};_0x922636[_0x3b769b]={'$like':'%'+_0x34e3be[_0xfc75('0x32')][_0xfc75('0x3f')]+'%'};return _0x922636;})});}_0x46e17a=_['merge']({},_0x46e17a,_0x34e3be[_0xfc75('0x4a')]);return _0x36e47a['getDescriptions'](_0x46e17a);}})[_0xfc75('0x25')](function(_0xceab3){if(_0xceab3){_0x25533a=_0xceab3[_0xfc75('0x49')];if(!_0x34e3be['query'][_0xfc75('0x38')](_0xfc75('0x39'))){_0x46e17a[_0xfc75('0x1d')]=qs['limit'](_0x34e3be[_0xfc75('0x32')]['limit']);_0x46e17a['offset']=qs['offset'](_0x34e3be['query'][_0xfc75('0x1c')]);}return _0x36e47a[_0xfc75('0x53')](_0x46e17a);}})[_0xfc75('0x25')](function(_0x120da5){if(_0x120da5){return _0x120da5?{'count':_0x25533a,'rows':_0x120da5}:null;}})[_0xfc75('0x25')](respondWithResult(_0x2cc7cc,null))[_0xfc75('0x46')](handleError(_0x2cc7cc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9e27c59..c84515c 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 _0xc0b3=['moment','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x29bef7,_0x5127f0){var _0x1ba0c1=function(_0x90b156){while(--_0x90b156){_0x29bef7['push'](_0x29bef7['shift']());}};_0x1ba0c1(++_0x5127f0);}(_0xc0b3,0xd9));var _0x3c0b=function(_0x17847f,_0x3c3a7e){_0x17847f=_0x17847f-0x0;var _0x1e7064=_0xc0b3[_0x17847f];return _0x1e7064;};'use strict';var _=require(_0x3c0b('0x0'));var util=require(_0x3c0b('0x1'));var logger=require(_0x3c0b('0x2'))(_0x3c0b('0x3'));var moment=require(_0x3c0b('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c0b('0x5'));var fs=require('fs');var path=require(_0x3c0b('0x6'));var rimraf=require(_0x3c0b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c0b('0x8'));module[_0x3c0b('0x9')]=function(_0x2cc1be,_0x102a46){return _0x2cc1be[_0x3c0b('0xa')](_0x3c0b('0xb'),attributes,{'tableName':_0x3c0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x224f=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x10ecf1,_0x15085c){var _0xaa4ce5=function(_0x2a24f9){while(--_0x2a24f9){_0x10ecf1['push'](_0x10ecf1['shift']());}};_0xaa4ce5(++_0x15085c);}(_0x224f,0x174));var _0xf224=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x224f[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0xf224('0x0'));var util=require(_0xf224('0x1'));var logger=require(_0xf224('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf224('0x3'));var rp=require(_0xf224('0x4'));var fs=require('fs');var path=require(_0xf224('0x5'));var rimraf=require(_0xf224('0x6'));var config=require(_0xf224('0x7'));var attributes=require(_0xf224('0x8'));module[_0xf224('0x9')]=function(_0x4d3ffd,_0x43f590){return _0x4d3ffd[_0xf224('0xa')](_0xf224('0xb'),attributes,{'tableName':_0xf224('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 73d5f72..49ffa35 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 _0x7762=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2525d8,_0x4cd814){var _0x392a38=function(_0x559314){while(--_0x559314){_0x2525d8['push'](_0x2525d8['shift']());}};_0x392a38(++_0x4cd814);}(_0x7762,0xf7));var _0x2776=function(_0x1ac84d,_0x11b1e9){_0x1ac84d=_0x1ac84d-0x0;var _0xc7a451=_0x7762[_0x1ac84d];return _0xc7a451;};'use strict';var _=require(_0x2776('0x0'));var util=require(_0x2776('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2776('0x2'));var fs=require('fs');var Redis=require(_0x2776('0x3'));var db=require(_0x2776('0x4'))['db'];var utils=require(_0x2776('0x5'));var logger=require('../../config/logger')(_0x2776('0x6'));var config=require('../../config/environment');var jayson=require(_0x2776('0x7'));var client=jayson[_0x2776('0x8')][_0x2776('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ef529,_0x50aa11,_0x8d7da9){return new BPromise(function(_0x1ac5ec,_0x12fd83){return client[_0x2776('0xa')](_0x3ef529,_0x8d7da9)[_0x2776('0xb')](function(_0x44b5ee){logger[_0x2776('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x50aa11,_0x2776('0xd'));logger[_0x2776('0xe')](_0x2776('0xf'),_0x50aa11,'request\x20sent',JSON[_0x2776('0x10')](_0x44b5ee));if(_0x44b5ee[_0x2776('0x11')]){if(_0x44b5ee['error'][_0x2776('0x12')]===0x1f4){logger['error'](_0x2776('0x13'),_0x50aa11,_0x44b5ee[_0x2776('0x11')][_0x2776('0x14')]);return _0x12fd83(_0x44b5ee[_0x2776('0x11')][_0x2776('0x14')]);}logger[_0x2776('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x50aa11,_0x44b5ee['error']['message']);return _0x1ac5ec(_0x44b5ee[_0x2776('0x11')]['message']);}else{logger['info'](_0x2776('0x13'),_0x50aa11,_0x2776('0xd'));_0x1ac5ec(_0x44b5ee[_0x2776('0x15')][_0x2776('0x14')]);}})[_0x2776('0x16')](function(_0x568643){logger[_0x2776('0x11')](_0x2776('0x13'),_0x50aa11,_0x568643);_0x12fd83(_0x568643);});});} \ No newline at end of file +var _0x6363=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x183fc7,_0x4051f8){var _0xe5545e=function(_0x4b2f5e){while(--_0x4b2f5e){_0x183fc7['push'](_0x183fc7['shift']());}};_0xe5545e(++_0x4051f8);}(_0x6363,0xb1));var _0x3636=function(_0xb44685,_0x633e56){_0xb44685=_0xb44685-0x0;var _0x33f850=_0x6363[_0xb44685];return _0x33f850;};'use strict';var _=require('lodash');var util=require(_0x3636('0x0'));var moment=require(_0x3636('0x1'));var BPromise=require(_0x3636('0x2'));var rs=require(_0x3636('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3636('0x4'));var logger=require(_0x3636('0x5'))('rpc');var config=require(_0x3636('0x6'));var jayson=require(_0x3636('0x7'));var client=jayson[_0x3636('0x8')][_0x3636('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x332e63,_0xf7fb6c,_0x15082e){return new BPromise(function(_0x351e24,_0x1aaaff){return client[_0x3636('0xa')](_0x332e63,_0x15082e)[_0x3636('0xb')](function(_0x20dcbf){logger[_0x3636('0xc')](_0x3636('0xd'),_0xf7fb6c,_0x3636('0xe'));logger['debug'](_0x3636('0xf'),_0xf7fb6c,_0x3636('0xe'),JSON[_0x3636('0x10')](_0x20dcbf));if(_0x20dcbf[_0x3636('0x11')]){if(_0x20dcbf[_0x3636('0x11')][_0x3636('0x12')]===0x1f4){logger[_0x3636('0x11')](_0x3636('0xd'),_0xf7fb6c,_0x20dcbf[_0x3636('0x11')][_0x3636('0x13')]);return _0x1aaaff(_0x20dcbf[_0x3636('0x11')][_0x3636('0x13')]);}logger[_0x3636('0x11')](_0x3636('0xd'),_0xf7fb6c,_0x20dcbf['error'][_0x3636('0x13')]);return _0x351e24(_0x20dcbf['error'][_0x3636('0x13')]);}else{logger[_0x3636('0xc')](_0x3636('0xd'),_0xf7fb6c,_0x3636('0xe'));_0x351e24(_0x20dcbf[_0x3636('0x14')][_0x3636('0x13')]);}})['catch'](function(_0xef3032){logger[_0x3636('0x11')](_0x3636('0xd'),_0xf7fb6c,_0xef3032);_0x1aaaff(_0xef3032);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 09c6385..70d9fc0 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 _0x7d00=['../../config/environment','get','isAuthenticated','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3925ce,_0x1755ea){var _0x20602a=function(_0x54bcaf){while(--_0x54bcaf){_0x3925ce['push'](_0x3925ce['shift']());}};_0x20602a(++_0x1755ea);}(_0x7d00,0x19d));var _0x07d0=function(_0x410193,_0x47b895){_0x410193=_0x410193-0x0;var _0x231e14=_0x7d00[_0x410193];return _0x231e14;};'use strict';var multer=require(_0x07d0('0x0'));var util=require(_0x07d0('0x1'));var path=require(_0x07d0('0x2'));var timeout=require(_0x07d0('0x3'));var express=require('express');var router=express[_0x07d0('0x4')]();var fs_extra=require(_0x07d0('0x5'));var auth=require(_0x07d0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x07d0('0x7'));var controller=require('./intVtigerField.controller');router[_0x07d0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x07d0('0x8')]('/:id',auth[_0x07d0('0x9')](),controller['show']);router['post']('/',auth[_0x07d0('0x9')](),controller[_0x07d0('0xa')]);router[_0x07d0('0xb')](_0x07d0('0xc'),auth['isAuthenticated'](),controller[_0x07d0('0xd')]);router['delete'](_0x07d0('0xc'),auth['isAuthenticated'](),controller[_0x07d0('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0a54=['/:id','show','post','update','delete','exports','util','path','connect-timeout','express','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index'];(function(_0x15b4e1,_0x32cb92){var _0xe65c3f=function(_0x174f5d){while(--_0x174f5d){_0x15b4e1['push'](_0x15b4e1['shift']());}};_0xe65c3f(++_0x32cb92);}(_0x0a54,0x7e));var _0x40a5=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x0a54[_0x246148];return _0x453d94;};'use strict';var multer=require('multer');var util=require(_0x40a5('0x0'));var path=require(_0x40a5('0x1'));var timeout=require(_0x40a5('0x2'));var express=require(_0x40a5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x40a5('0x4'));var config=require('../../config/environment');var controller=require(_0x40a5('0x5'));router[_0x40a5('0x6')]('/',auth[_0x40a5('0x7')](),controller[_0x40a5('0x8')]);router[_0x40a5('0x6')](_0x40a5('0x9'),auth['isAuthenticated'](),controller[_0x40a5('0xa')]);router[_0x40a5('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x40a5('0x9'),auth[_0x40a5('0x7')](),controller[_0x40a5('0xc')]);router[_0x40a5('0xd')](_0x40a5('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x40a5('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 7b36e4b..ff95fbb 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 _0x2f8d=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x39df26,_0x30c4fa){var _0x2fcdfc=function(_0x101c45){while(--_0x101c45){_0x39df26['push'](_0x39df26['shift']());}};_0x2fcdfc(++_0x30c4fa);}(_0x2f8d,0x162));var _0xd2f8=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2f8d[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0xd2f8('0x0'));module[_0xd2f8('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd2f8('0x2'),_0xd2f8('0x3'),_0xd2f8('0x4'),_0xd2f8('0x5'),_0xd2f8('0x6')),'defaultValue':_0xd2f8('0x2')},'content':{'type':Sequelize[_0xd2f8('0x7')]},'key':{'type':Sequelize[_0xd2f8('0x7')]},'keyType':{'type':Sequelize[_0xd2f8('0x8')]('string',_0xd2f8('0x3'),_0xd2f8('0x4'))},'keyContent':{'type':Sequelize[_0xd2f8('0x7')]},'idField':{'type':Sequelize[_0xd2f8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd2f8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf314=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x5297d1,_0x521b28){var _0x559213=function(_0x33620d){while(--_0x33620d){_0x5297d1['push'](_0x5297d1['shift']());}};_0x559213(++_0x521b28);}(_0xf314,0x119));var _0x4f31=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xf314[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require('sequelize');module[_0x4f31('0x0')]={'type':{'type':Sequelize[_0x4f31('0x1')](_0x4f31('0x2'),_0x4f31('0x3'),_0x4f31('0x4'),_0x4f31('0x5'),_0x4f31('0x6')),'defaultValue':_0x4f31('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4f31('0x7')]},'keyType':{'type':Sequelize[_0x4f31('0x1')](_0x4f31('0x2'),'variable',_0x4f31('0x4'))},'keyContent':{'type':Sequelize[_0x4f31('0x7')]},'idField':{'type':Sequelize[_0x4f31('0x7')]},'nameField':{'type':Sequelize[_0x4f31('0x7')]},'customField':{'type':Sequelize[_0x4f31('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f31('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 518de51..a7a6b87 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 _0x8a75=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x8a75,0x183));var _0x58a7=function(_0x418194,_0x4c571d){_0x418194=_0x418194-0x0;var _0x34cd65=_0x8a75[_0x418194];return _0x34cd65;};'use strict';var emlformat=require(_0x58a7('0x0'));var rimraf=require(_0x58a7('0x1'));var zipdir=require(_0x58a7('0x2'));var jsonpatch=require(_0x58a7('0x3'));var rp=require(_0x58a7('0x4'));var moment=require(_0x58a7('0x5'));var BPromise=require(_0x58a7('0x6'));var Mustache=require(_0x58a7('0x7'));var util=require(_0x58a7('0x8'));var path=require(_0x58a7('0x9'));var sox=require('sox');var csv=require(_0x58a7('0xa'));var ejs=require(_0x58a7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58a7('0xc'));var squel=require(_0x58a7('0xd'));var crypto=require(_0x58a7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x58a7('0xf'));var toCsv=require(_0x58a7('0xa'));var querystring=require(_0x58a7('0x10'));var Papa=require(_0x58a7('0x11'));var Redis=require('ioredis');var authService=require(_0x58a7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x58a7('0x13'));var hardwareService=require(_0x58a7('0x14'));var logger=require(_0x58a7('0x15'))(_0x58a7('0x16'));var utils=require('../../config/utils');var config=require(_0x58a7('0x17'));var licenseUtil=require(_0x58a7('0x18'));var db=require(_0x58a7('0x19'))['db'];function respondWithStatusCode(_0x195c3b,_0x1f288d){_0x1f288d=_0x1f288d||0xcc;return function(_0x32bc3a){if(_0x32bc3a){return _0x195c3b[_0x58a7('0x1a')](_0x1f288d);}return _0x195c3b[_0x58a7('0x1b')](_0x1f288d)[_0x58a7('0x1c')]();};}function respondWithResult(_0x6bf302,_0x4b55c1){_0x4b55c1=_0x4b55c1||0xc8;return function(_0x2b7d85){if(_0x2b7d85){return _0x6bf302[_0x58a7('0x1b')](_0x4b55c1)[_0x58a7('0x1d')](_0x2b7d85);}};}function respondWithFilteredResult(_0x2e0882,_0x353a6f){return function(_0x51abb3){if(_0x51abb3){var _0x56beee=typeof _0x353a6f[_0x58a7('0x1e')]==='undefined'&&typeof _0x353a6f[_0x58a7('0x1f')]===_0x58a7('0x20');var _0x8a8626=_0x51abb3['count'];var _0x28622c=_0x56beee?0x0:_0x353a6f[_0x58a7('0x1e')];var _0x560384=_0x56beee?_0x51abb3[_0x58a7('0x21')]:_0x353a6f[_0x58a7('0x1e')]+_0x353a6f['limit'];var _0x203e2c;if(_0x560384>=_0x8a8626){_0x560384=_0x8a8626;_0x203e2c=0xc8;}else{_0x203e2c=0xce;}_0x2e0882['status'](_0x203e2c);return _0x2e0882[_0x58a7('0x22')]('Content-Range',_0x28622c+'-'+_0x560384+'/'+_0x8a8626)['json'](_0x51abb3);}return null;};}function patchUpdates(_0x32268f){return function(_0x5a0107){try{jsonpatch[_0x58a7('0x23')](_0x5a0107,_0x32268f,!![]);}catch(_0xda0c83){return BPromise[_0x58a7('0x24')](_0xda0c83);}return _0x5a0107[_0x58a7('0x25')]();};}function saveUpdates(_0x4bf79e,_0x5ad02c){return function(_0x3d700c){if(_0x3d700c){return _0x3d700c[_0x58a7('0x26')](_0x4bf79e)[_0x58a7('0x27')](function(_0x4abbdf){return _0x4abbdf;});}return null;};}function removeEntity(_0xaf4aba,_0x5abb7a){return function(_0x3fa309){if(_0x3fa309){return _0x3fa309[_0x58a7('0x28')]()['then'](function(){_0xaf4aba[_0x58a7('0x1b')](0xcc)[_0x58a7('0x1c')]();});}};}function handleEntityNotFound(_0x3d3a6d,_0xeed5f5){return function(_0x5c192f){if(!_0x5c192f){_0x3d3a6d[_0x58a7('0x1a')](0x194);}return _0x5c192f;};}function handleError(_0x4827eb,_0x4c0c51){_0x4c0c51=_0x4c0c51||0x1f4;return function(_0x3aff98){logger[_0x58a7('0x29')](_0x3aff98[_0x58a7('0x2a')]);if(_0x3aff98[_0x58a7('0x2b')]){delete _0x3aff98[_0x58a7('0x2b')];}_0x4827eb[_0x58a7('0x1b')](_0x4c0c51)[_0x58a7('0x2c')](_0x3aff98);};}exports[_0x58a7('0x2d')]=function(_0x375029,_0x12bda6){var _0x469ce7={},_0x367ad4={},_0x755c7e={'count':0x0,'rows':[]};var _0x5447c2=_[_0x58a7('0x2e')](db[_0x58a7('0x2f')][_0x58a7('0x30')],function(_0x254059){return{'name':_0x254059['fieldName'],'type':_0x254059[_0x58a7('0x31')][_0x58a7('0x32')]};});_0x367ad4[_0x58a7('0x33')]=_['map'](_0x5447c2,_0x58a7('0x2b'));_0x367ad4[_0x58a7('0x34')]=_[_0x58a7('0x35')](_0x375029[_0x58a7('0x34')]);_0x367ad4[_0x58a7('0x36')]=_[_0x58a7('0x37')](_0x367ad4[_0x58a7('0x33')],_0x367ad4[_0x58a7('0x34')]);_0x469ce7[_0x58a7('0x38')]=_[_0x58a7('0x37')](_0x367ad4[_0x58a7('0x33')],qs[_0x58a7('0x39')](_0x375029[_0x58a7('0x34')][_0x58a7('0x39')]));_0x469ce7[_0x58a7('0x38')]=_0x469ce7[_0x58a7('0x38')]['length']?_0x469ce7['attributes']:_0x367ad4[_0x58a7('0x33')];if(!_0x375029[_0x58a7('0x34')][_0x58a7('0x3a')](_0x58a7('0x3b'))){_0x469ce7['limit']=qs[_0x58a7('0x1f')](_0x375029[_0x58a7('0x34')]['limit']);_0x469ce7[_0x58a7('0x1e')]=qs[_0x58a7('0x1e')](_0x375029[_0x58a7('0x34')][_0x58a7('0x1e')]);}_0x469ce7[_0x58a7('0x3c')]=qs[_0x58a7('0x3d')](_0x375029[_0x58a7('0x34')][_0x58a7('0x3d')]);_0x469ce7[_0x58a7('0x3e')]=qs[_0x58a7('0x36')](_[_0x58a7('0x3f')](_0x375029[_0x58a7('0x34')],_0x367ad4[_0x58a7('0x36')]),_0x5447c2);if(_0x375029[_0x58a7('0x34')][_0x58a7('0x40')]){_0x469ce7[_0x58a7('0x3e')]=_[_0x58a7('0x41')](_0x469ce7[_0x58a7('0x3e')],{'$or':_[_0x58a7('0x2e')](_0x5447c2,function(_0x4bae1d){if(_0x4bae1d[_0x58a7('0x31')]!==_0x58a7('0x42')){var _0x408bb9={};_0x408bb9[_0x4bae1d[_0x58a7('0x2b')]]={'$like':'%'+_0x375029[_0x58a7('0x34')]['filter']+'%'};return _0x408bb9;}})});}_0x469ce7=_[_0x58a7('0x41')]({},_0x469ce7,_0x375029[_0x58a7('0x43')]);var _0x4903bd={'where':_0x469ce7['where']};return db[_0x58a7('0x2f')][_0x58a7('0x21')](_0x4903bd)[_0x58a7('0x27')](function(_0x1a254c){_0x755c7e[_0x58a7('0x21')]=_0x1a254c;if(_0x375029[_0x58a7('0x34')][_0x58a7('0x44')]){_0x469ce7[_0x58a7('0x45')]=[{'all':!![]}];}return db[_0x58a7('0x2f')][_0x58a7('0x46')](_0x469ce7);})[_0x58a7('0x27')](function(_0x57fbbe){_0x755c7e[_0x58a7('0x47')]=_0x57fbbe;return _0x755c7e;})[_0x58a7('0x27')](respondWithFilteredResult(_0x12bda6,_0x469ce7))[_0x58a7('0x48')](handleError(_0x12bda6,null));};exports['show']=function(_0x551a3a,_0x3ab934){var _0x148bc8={'raw':!![],'where':{'id':_0x551a3a[_0x58a7('0x49')]['id']}},_0x153f58={};_0x153f58[_0x58a7('0x33')]=_[_0x58a7('0x35')](db['VtigerField'][_0x58a7('0x30')]);_0x153f58[_0x58a7('0x34')]=_[_0x58a7('0x35')](_0x551a3a[_0x58a7('0x34')]);_0x153f58[_0x58a7('0x36')]=_['intersection'](_0x153f58['model'],_0x153f58[_0x58a7('0x34')]);_0x148bc8[_0x58a7('0x38')]=_[_0x58a7('0x37')](_0x153f58['model'],qs[_0x58a7('0x39')](_0x551a3a[_0x58a7('0x34')]['fields']));_0x148bc8[_0x58a7('0x38')]=_0x148bc8[_0x58a7('0x38')][_0x58a7('0x4a')]?_0x148bc8[_0x58a7('0x38')]:_0x153f58[_0x58a7('0x33')];if(_0x551a3a[_0x58a7('0x34')][_0x58a7('0x44')]){_0x148bc8['include']=[{'all':!![]}];}_0x148bc8=_[_0x58a7('0x41')]({},_0x148bc8,_0x551a3a[_0x58a7('0x43')]);return db[_0x58a7('0x2f')][_0x58a7('0x4b')](_0x148bc8)[_0x58a7('0x27')](handleEntityNotFound(_0x3ab934,null))[_0x58a7('0x27')](respondWithResult(_0x3ab934,null))[_0x58a7('0x48')](handleError(_0x3ab934,null));};exports['create']=function(_0x371528,_0x20cbee){return db[_0x58a7('0x2f')][_0x58a7('0x4c')](_0x371528[_0x58a7('0x4d')],{})[_0x58a7('0x27')](respondWithResult(_0x20cbee,0xc9))[_0x58a7('0x48')](handleError(_0x20cbee,null));};exports[_0x58a7('0x26')]=function(_0x3b068d,_0x1c6604){if(_0x3b068d[_0x58a7('0x4d')]['id']){delete _0x3b068d[_0x58a7('0x4d')]['id'];}return db[_0x58a7('0x2f')]['find']({'where':{'id':_0x3b068d['params']['id']}})[_0x58a7('0x27')](handleEntityNotFound(_0x1c6604,null))[_0x58a7('0x27')](saveUpdates(_0x3b068d[_0x58a7('0x4d')],null))['then'](respondWithResult(_0x1c6604,null))[_0x58a7('0x48')](handleError(_0x1c6604,null));};exports[_0x58a7('0x28')]=function(_0x193cc2,_0x27ed07){return db[_0x58a7('0x2f')]['find']({'where':{'id':_0x193cc2[_0x58a7('0x49')]['id']}})[_0x58a7('0x27')](handleEntityNotFound(_0x27ed07,null))[_0x58a7('0x27')](removeEntity(_0x27ed07,null))[_0x58a7('0x48')](handleError(_0x27ed07,null));}; \ No newline at end of file +var _0xf996=['update','destroy','then','error','stack','name','send','index','map','VtigerField','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','findAll','rows','catch','keys','rawAttributes','include','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject'];(function(_0x8dbafd,_0x4a7464){var _0x186231=function(_0x1c06aa){while(--_0x1c06aa){_0x8dbafd['push'](_0x8dbafd['shift']());}};_0x186231(++_0x4a7464);}(_0xf996,0x14f));var _0x6f99=function(_0x33e572,_0x4024f5){_0x33e572=_0x33e572-0x0;var _0x1513eb=_0xf996[_0x33e572];return _0x1513eb;};'use strict';var emlformat=require(_0x6f99('0x0'));var rimraf=require(_0x6f99('0x1'));var zipdir=require(_0x6f99('0x2'));var jsonpatch=require(_0x6f99('0x3'));var rp=require(_0x6f99('0x4'));var moment=require(_0x6f99('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6f99('0x6'));var util=require('util');var path=require(_0x6f99('0x7'));var sox=require('sox');var csv=require(_0x6f99('0x8'));var ejs=require(_0x6f99('0x9'));var fs=require('fs');var fs_extra=require(_0x6f99('0xa'));var _=require(_0x6f99('0xb'));var squel=require(_0x6f99('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f99('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6f99('0x8'));var querystring=require(_0x6f99('0xe'));var Papa=require(_0x6f99('0xf'));var Redis=require(_0x6f99('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6f99('0x11'));var as=require(_0x6f99('0x12'));var hardwareService=require(_0x6f99('0x13'));var logger=require(_0x6f99('0x14'))(_0x6f99('0x15'));var utils=require('../../config/utils');var config=require(_0x6f99('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f99('0x17'))['db'];function respondWithStatusCode(_0x561538,_0x35637f){_0x35637f=_0x35637f||0xcc;return function(_0x1212a5){if(_0x1212a5){return _0x561538[_0x6f99('0x18')](_0x35637f);}return _0x561538[_0x6f99('0x19')](_0x35637f)[_0x6f99('0x1a')]();};}function respondWithResult(_0x4260e1,_0xcfbac7){_0xcfbac7=_0xcfbac7||0xc8;return function(_0xa9d8b){if(_0xa9d8b){return _0x4260e1[_0x6f99('0x19')](_0xcfbac7)[_0x6f99('0x1b')](_0xa9d8b);}};}function respondWithFilteredResult(_0xf2c6a8,_0x33e5eb){return function(_0x1b706c){if(_0x1b706c){var _0x30a3f5=typeof _0x33e5eb['offset']===_0x6f99('0x1c')&&typeof _0x33e5eb['limit']===_0x6f99('0x1c');var _0x457103=_0x1b706c[_0x6f99('0x1d')];var _0x24d7c1=_0x30a3f5?0x0:_0x33e5eb[_0x6f99('0x1e')];var _0x1f091a=_0x30a3f5?_0x1b706c['count']:_0x33e5eb['offset']+_0x33e5eb[_0x6f99('0x1f')];var _0x12e7d3;if(_0x1f091a>=_0x457103){_0x1f091a=_0x457103;_0x12e7d3=0xc8;}else{_0x12e7d3=0xce;}_0xf2c6a8[_0x6f99('0x19')](_0x12e7d3);return _0xf2c6a8['set'](_0x6f99('0x20'),_0x24d7c1+'-'+_0x1f091a+'/'+_0x457103)[_0x6f99('0x1b')](_0x1b706c);}return null;};}function patchUpdates(_0x84fb9c){return function(_0x5100ea){try{jsonpatch[_0x6f99('0x21')](_0x5100ea,_0x84fb9c,!![]);}catch(_0x38d574){return BPromise[_0x6f99('0x22')](_0x38d574);}return _0x5100ea['save']();};}function saveUpdates(_0x1e513d,_0x547ef0){return function(_0x171518){if(_0x171518){return _0x171518[_0x6f99('0x23')](_0x1e513d)['then'](function(_0x226026){return _0x226026;});}return null;};}function removeEntity(_0x12d3ce,_0xb1ee5d){return function(_0x4cb945){if(_0x4cb945){return _0x4cb945[_0x6f99('0x24')]()[_0x6f99('0x25')](function(){_0x12d3ce['status'](0xcc)[_0x6f99('0x1a')]();});}};}function handleEntityNotFound(_0x494646,_0x171b7b){return function(_0x508d3f){if(!_0x508d3f){_0x494646[_0x6f99('0x18')](0x194);}return _0x508d3f;};}function handleError(_0x380b19,_0x60f397){_0x60f397=_0x60f397||0x1f4;return function(_0x566901){logger[_0x6f99('0x26')](_0x566901[_0x6f99('0x27')]);if(_0x566901['name']){delete _0x566901[_0x6f99('0x28')];}_0x380b19[_0x6f99('0x19')](_0x60f397)[_0x6f99('0x29')](_0x566901);};}exports[_0x6f99('0x2a')]=function(_0x11ab69,_0x340558){var _0x8c77af={},_0x493178={},_0x163018={'count':0x0,'rows':[]};var _0xd67335=_[_0x6f99('0x2b')](db[_0x6f99('0x2c')]['rawAttributes'],function(_0x1998bf){return{'name':_0x1998bf[_0x6f99('0x2d')],'type':_0x1998bf['type'][_0x6f99('0x2e')]};});_0x493178[_0x6f99('0x2f')]=_[_0x6f99('0x2b')](_0xd67335,_0x6f99('0x28'));_0x493178[_0x6f99('0x30')]=_['keys'](_0x11ab69[_0x6f99('0x30')]);_0x493178[_0x6f99('0x31')]=_[_0x6f99('0x32')](_0x493178[_0x6f99('0x2f')],_0x493178[_0x6f99('0x30')]);_0x8c77af[_0x6f99('0x33')]=_[_0x6f99('0x32')](_0x493178[_0x6f99('0x2f')],qs['fields'](_0x11ab69[_0x6f99('0x30')][_0x6f99('0x34')]));_0x8c77af[_0x6f99('0x33')]=_0x8c77af[_0x6f99('0x33')][_0x6f99('0x35')]?_0x8c77af[_0x6f99('0x33')]:_0x493178[_0x6f99('0x2f')];if(!_0x11ab69[_0x6f99('0x30')][_0x6f99('0x36')](_0x6f99('0x37'))){_0x8c77af[_0x6f99('0x1f')]=qs['limit'](_0x11ab69[_0x6f99('0x30')][_0x6f99('0x1f')]);_0x8c77af[_0x6f99('0x1e')]=qs[_0x6f99('0x1e')](_0x11ab69[_0x6f99('0x30')][_0x6f99('0x1e')]);}_0x8c77af[_0x6f99('0x38')]=qs[_0x6f99('0x39')](_0x11ab69[_0x6f99('0x30')]['sort']);_0x8c77af['where']=qs[_0x6f99('0x31')](_['pick'](_0x11ab69[_0x6f99('0x30')],_0x493178['filters']),_0xd67335);if(_0x11ab69[_0x6f99('0x30')][_0x6f99('0x3a')]){_0x8c77af['where']=_[_0x6f99('0x3b')](_0x8c77af[_0x6f99('0x3c')],{'$or':_[_0x6f99('0x2b')](_0xd67335,function(_0x1a2b49){if(_0x1a2b49[_0x6f99('0x3d')]!==_0x6f99('0x3e')){var _0x4e6466={};_0x4e6466[_0x1a2b49[_0x6f99('0x28')]]={'$like':'%'+_0x11ab69[_0x6f99('0x30')]['filter']+'%'};return _0x4e6466;}})});}_0x8c77af=_[_0x6f99('0x3b')]({},_0x8c77af,_0x11ab69['options']);var _0x5367de={'where':_0x8c77af[_0x6f99('0x3c')]};return db['VtigerField'][_0x6f99('0x1d')](_0x5367de)[_0x6f99('0x25')](function(_0x160620){_0x163018[_0x6f99('0x1d')]=_0x160620;if(_0x11ab69[_0x6f99('0x30')]['includeAll']){_0x8c77af['include']=[{'all':!![]}];}return db[_0x6f99('0x2c')][_0x6f99('0x3f')](_0x8c77af);})[_0x6f99('0x25')](function(_0xb2663c){_0x163018[_0x6f99('0x40')]=_0xb2663c;return _0x163018;})[_0x6f99('0x25')](respondWithFilteredResult(_0x340558,_0x8c77af))[_0x6f99('0x41')](handleError(_0x340558,null));};exports['show']=function(_0x2ad7fa,_0x252c3a){var _0x44e10a={'raw':!![],'where':{'id':_0x2ad7fa['params']['id']}},_0x25dc8f={};_0x25dc8f['model']=_[_0x6f99('0x42')](db[_0x6f99('0x2c')][_0x6f99('0x43')]);_0x25dc8f[_0x6f99('0x30')]=_[_0x6f99('0x42')](_0x2ad7fa[_0x6f99('0x30')]);_0x25dc8f[_0x6f99('0x31')]=_['intersection'](_0x25dc8f[_0x6f99('0x2f')],_0x25dc8f['query']);_0x44e10a['attributes']=_[_0x6f99('0x32')](_0x25dc8f[_0x6f99('0x2f')],qs[_0x6f99('0x34')](_0x2ad7fa[_0x6f99('0x30')]['fields']));_0x44e10a['attributes']=_0x44e10a[_0x6f99('0x33')]['length']?_0x44e10a[_0x6f99('0x33')]:_0x25dc8f[_0x6f99('0x2f')];if(_0x2ad7fa[_0x6f99('0x30')]['includeAll']){_0x44e10a[_0x6f99('0x44')]=[{'all':!![]}];}_0x44e10a=_[_0x6f99('0x3b')]({},_0x44e10a,_0x2ad7fa[_0x6f99('0x45')]);return db['VtigerField'][_0x6f99('0x46')](_0x44e10a)['then'](handleEntityNotFound(_0x252c3a,null))[_0x6f99('0x25')](respondWithResult(_0x252c3a,null))[_0x6f99('0x41')](handleError(_0x252c3a,null));};exports[_0x6f99('0x47')]=function(_0xa42aa2,_0x4fd631){return db['VtigerField']['create'](_0xa42aa2[_0x6f99('0x48')],{})[_0x6f99('0x25')](respondWithResult(_0x4fd631,0xc9))[_0x6f99('0x41')](handleError(_0x4fd631,null));};exports[_0x6f99('0x23')]=function(_0x3ccc3e,_0x3185fb){if(_0x3ccc3e['body']['id']){delete _0x3ccc3e[_0x6f99('0x48')]['id'];}return db[_0x6f99('0x2c')][_0x6f99('0x46')]({'where':{'id':_0x3ccc3e['params']['id']}})[_0x6f99('0x25')](handleEntityNotFound(_0x3185fb,null))[_0x6f99('0x25')](saveUpdates(_0x3ccc3e['body'],null))[_0x6f99('0x25')](respondWithResult(_0x3185fb,null))[_0x6f99('0x41')](handleError(_0x3185fb,null));};exports['destroy']=function(_0x2967b2,_0x1ec19f){return db[_0x6f99('0x2c')][_0x6f99('0x46')]({'where':{'id':_0x2967b2[_0x6f99('0x49')]['id']}})[_0x6f99('0x25')](handleEntityNotFound(_0x1ec19f,null))[_0x6f99('0x25')](removeEntity(_0x1ec19f,null))[_0x6f99('0x41')](handleError(_0x1ec19f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a64f9ed..dfd40b4 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 _0xe294=['int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x37dde0,_0x1b0333){var _0x827eb7=function(_0x3b5518){while(--_0x3b5518){_0x37dde0['push'](_0x37dde0['shift']());}};_0x827eb7(++_0x1b0333);}(_0xe294,0x11b));var _0x4e29=function(_0x372246,_0x11c9fc){_0x372246=_0x372246-0x0;var _0x851da8=_0xe294[_0x372246];return _0x851da8;};'use strict';var _=require(_0x4e29('0x0'));var util=require(_0x4e29('0x1'));var logger=require(_0x4e29('0x2'))(_0x4e29('0x3'));var moment=require('moment');var BPromise=require(_0x4e29('0x4'));var rp=require(_0x4e29('0x5'));var fs=require('fs');var path=require(_0x4e29('0x6'));var rimraf=require('rimraf');var config=require(_0x4e29('0x7'));var attributes=require(_0x4e29('0x8'));module[_0x4e29('0x9')]=function(_0x4e8766,_0x1de765){return _0x4e8766['define'](_0x4e29('0xa'),attributes,{'tableName':_0x4e29('0xb'),'paranoid':![],'indexes':[{'name':_0x4e29('0xc'),'fields':['idField',_0x4e29('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62df=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','exports','define','VtigerField'];(function(_0x52cfcf,_0x35be1a){var _0x13a714=function(_0x5b02fa){while(--_0x5b02fa){_0x52cfcf['push'](_0x52cfcf['shift']());}};_0x13a714(++_0x35be1a);}(_0x62df,0x86));var _0xf62d=function(_0x2d0814,_0x14f151){_0x2d0814=_0x2d0814-0x0;var _0x42c4d0=_0x62df[_0x2d0814];return _0x42c4d0;};'use strict';var _=require(_0xf62d('0x0'));var util=require('util');var logger=require(_0xf62d('0x1'))(_0xf62d('0x2'));var moment=require('moment');var BPromise=require(_0xf62d('0x3'));var rp=require(_0xf62d('0x4'));var fs=require('fs');var path=require(_0xf62d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0xf62d('0x6')]=function(_0x30d779,_0x42792a){return _0x30d779[_0xf62d('0x7')](_0xf62d('0x8'),attributes,{'tableName':_0xf62d('0x9'),'paranoid':![],'indexes':[{'name':_0xf62d('0xa'),'fields':[_0xf62d('0xb'),_0xf62d('0xc')],'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 e8bff30..79f0282 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 _0x4d9e=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x21c8a7,_0x3f85f5){_0x21c8a7=_0x21c8a7-0x0;var _0x80b162=_0x4d9e[_0x21c8a7];return _0x80b162;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('VtigerField,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('VtigerField,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});} \ No newline at end of file +var _0x7149=['info','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x7149,0x1f0));var _0x9714=function(_0x482713,_0x24665f){_0x482713=_0x482713-0x0;var _0xd88799=_0x7149[_0x482713];return _0xd88799;};'use strict';var _=require('lodash');var util=require(_0x9714('0x0'));var moment=require(_0x9714('0x1'));var BPromise=require(_0x9714('0x2'));var rs=require(_0x9714('0x3'));var fs=require('fs');var Redis=require(_0x9714('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9714('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9714('0x6'));var jayson=require(_0x9714('0x7'));var client=jayson[_0x9714('0x8')][_0x9714('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12f029,_0x1b2db4,_0x47fc13){return new BPromise(function(_0x88c333,_0x5060d6){return client[_0x9714('0xa')](_0x12f029,_0x47fc13)['then'](function(_0x5766fe){logger['info'](_0x9714('0xb'),_0x1b2db4,'request\x20sent');logger['debug'](_0x9714('0xc'),_0x1b2db4,'request\x20sent',JSON[_0x9714('0xd')](_0x5766fe));if(_0x5766fe['error']){if(_0x5766fe[_0x9714('0xe')][_0x9714('0xf')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x1b2db4,_0x5766fe['error'][_0x9714('0x10')]);return _0x5060d6(_0x5766fe[_0x9714('0xe')]['message']);}logger[_0x9714('0xe')](_0x9714('0xb'),_0x1b2db4,_0x5766fe[_0x9714('0xe')]['message']);return _0x88c333(_0x5766fe[_0x9714('0xe')][_0x9714('0x10')]);}else{logger[_0x9714('0x11')](_0x9714('0xb'),_0x1b2db4,_0x9714('0x12'));_0x88c333(_0x5766fe['result'][_0x9714('0x10')]);}})['catch'](function(_0xb9ecc9){logger[_0x9714('0xe')](_0x9714('0xb'),_0x1b2db4,_0xb9ecc9);_0x5060d6(_0xb9ecc9);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 82acaba..47510b5 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 _0x263e=['multer','util','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','addConfiguration','put','delete','destroy'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x263e,0xb0));var _0xe263=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0x263e[_0x443f79];return _0x3847e4;};'use strict';var multer=require(_0xe263('0x0'));var util=require(_0xe263('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe263('0x2'));var interaction=require(_0xe263('0x3'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xe263('0x4')]('/',auth[_0xe263('0x5')](),controller[_0xe263('0x6')]);router[_0xe263('0x4')](_0xe263('0x7'),auth[_0xe263('0x5')](),controller[_0xe263('0x8')]);router['get'](_0xe263('0x9'),auth[_0xe263('0x5')](),controller['getConfigurations']);router[_0xe263('0x4')]('/:id/fields',auth[_0xe263('0x5')](),controller['getFields']);router[_0xe263('0xa')]('/',auth[_0xe263('0x5')](),controller[_0xe263('0xb')]);router['post'](_0xe263('0x9'),auth[_0xe263('0x5')](),controller[_0xe263('0xc')]);router[_0xe263('0xd')]('/:id',auth[_0xe263('0x5')](),controller['update']);router[_0xe263('0xe')]('/:id',auth[_0xe263('0x5')](),controller[_0xe263('0xf')]);module['exports']=router; \ No newline at end of file +var _0x44ac=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','util'];(function(_0x107b3a,_0xfdf51e){var _0x57d43c=function(_0x1107a7){while(--_0x1107a7){_0x107b3a['push'](_0x107b3a['shift']());}};_0x57d43c(++_0xfdf51e);}(_0x44ac,0xc5));var _0xc44a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x44ac[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require('multer');var util=require(_0xc44a('0x0'));var path=require(_0xc44a('0x1'));var timeout=require(_0xc44a('0x2'));var express=require(_0xc44a('0x3'));var router=express[_0xc44a('0x4')]();var fs_extra=require(_0xc44a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc44a('0x6'));var config=require(_0xc44a('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xc44a('0x8')]('/',auth[_0xc44a('0x9')](),controller[_0xc44a('0xa')]);router['get'](_0xc44a('0xb'),auth[_0xc44a('0x9')](),controller[_0xc44a('0xc')]);router[_0xc44a('0x8')](_0xc44a('0xd'),auth[_0xc44a('0x9')](),controller[_0xc44a('0xe')]);router[_0xc44a('0x8')]('/:id/fields',auth[_0xc44a('0x9')](),controller[_0xc44a('0xf')]);router[_0xc44a('0x10')]('/',auth[_0xc44a('0x9')](),controller[_0xc44a('0x11')]);router[_0xc44a('0x10')](_0xc44a('0xd'),auth['isAuthenticated'](),controller[_0xc44a('0x12')]);router['put'](_0xc44a('0xb'),auth['isAuthenticated'](),controller[_0xc44a('0x13')]);router[_0xc44a('0x14')](_0xc44a('0xb'),auth[_0xc44a('0x9')](),controller[_0xc44a('0x15')]);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 e252071..3791daf 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 _0x2d2c=['newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab'];(function(_0x301a4e,_0x1d0ee9){var _0x5ebc83=function(_0x43d02e){while(--_0x43d02e){_0x301a4e['push'](_0x301a4e['shift']());}};_0x5ebc83(++_0x1d0ee9);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x5e6cb8,_0x1d1eb5){_0x5e6cb8=_0x5e6cb8-0x0;var _0x41754f=_0x2d2c[_0x5e6cb8];return _0x41754f;};'use strict';var Sequelize=require(_0xc2d2('0x0'));module[_0xc2d2('0x1')]={'name':{'type':Sequelize[_0xc2d2('0x2')]},'description':{'type':Sequelize[_0xc2d2('0x2')]},'username':{'type':Sequelize[_0xc2d2('0x2')],'unique':_0xc2d2('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xc2d2('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc2d2('0x4')},'authType':{'type':Sequelize[_0xc2d2('0x5')](_0xc2d2('0x6'),_0xc2d2('0x7')),'defaultValue':_0xc2d2('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc2d2('0x8'),_0xc2d2('0x9')),'defaultValue':_0xc2d2('0x8')}}; \ No newline at end of file +var _0x47c5=['username','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47c5,0x165));var _0x547c=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0x47c5[_0xaf25ae];return _0x49732d;};'use strict';var Sequelize=require(_0x547c('0x0'));module[_0x547c('0x1')]={'name':{'type':Sequelize[_0x547c('0x2')]},'description':{'type':Sequelize[_0x547c('0x2')]},'username':{'type':Sequelize[_0x547c('0x2')],'unique':_0x547c('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x547c('0x2')]},'remoteUri':{'type':Sequelize[_0x547c('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x547c('0x4')](_0x547c('0x5'),'token'),'defaultValue':_0x547c('0x5')},'serverUrl':{'type':Sequelize[_0x547c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x547c('0x4')](_0x547c('0x6'),_0x547c('0x7')),'defaultValue':_0x547c('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9f83ad5..59c0b90 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 _0xe5b5=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','map','addConfiguration','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','Unknown\x20authentication\x20type','group','assignee','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0x2c9056,_0x552f14){var _0x3e6959=function(_0x556247){while(--_0x556247){_0x2c9056['push'](_0x2c9056['shift']());}};_0x3e6959(++_0x552f14);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0xe5b5[_0x28e74e];return _0xb45ac1;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e5b('0x1b'));function respondWithStatusCode(_0x18434e,_0x4559a0){_0x4559a0=_0x4559a0||0xcc;return function(_0x1694ff){if(_0x1694ff){return _0x18434e[_0x5e5b('0x1c')](_0x4559a0);}return _0x18434e[_0x5e5b('0x1d')](_0x4559a0)[_0x5e5b('0x1e')]();};}function respondWithResult(_0x49edd0,_0x2b37fa){_0x2b37fa=_0x2b37fa||0xc8;return function(_0x2e92c3){if(_0x2e92c3){return _0x49edd0['status'](_0x2b37fa)[_0x5e5b('0x1f')](_0x2e92c3);}};}function respondWithFilteredResult(_0x578c14,_0x4e9509){return function(_0x13a1cb){if(_0x13a1cb){var _0x444435=typeof _0x4e9509[_0x5e5b('0x20')]==='undefined'&&typeof _0x4e9509[_0x5e5b('0x21')]==='undefined';var _0x1796af=_0x13a1cb[_0x5e5b('0x22')];var _0x4c5f9a=_0x444435?0x0:_0x4e9509[_0x5e5b('0x20')];var _0x1560e1=_0x444435?_0x13a1cb[_0x5e5b('0x22')]:_0x4e9509['offset']+_0x4e9509[_0x5e5b('0x21')];var _0x3f1103;if(_0x1560e1>=_0x1796af){_0x1560e1=_0x1796af;_0x3f1103=0xc8;}else{_0x3f1103=0xce;}_0x578c14['status'](_0x3f1103);return _0x578c14[_0x5e5b('0x23')](_0x5e5b('0x24'),_0x4c5f9a+'-'+_0x1560e1+'/'+_0x1796af)[_0x5e5b('0x1f')](_0x13a1cb);}return null;};}function patchUpdates(_0x2d8252){return function(_0x2cb0bb){try{jsonpatch[_0x5e5b('0x25')](_0x2cb0bb,_0x2d8252,!![]);}catch(_0x93df5c){return BPromise[_0x5e5b('0x26')](_0x93df5c);}return _0x2cb0bb['save']();};}function saveUpdates(_0x512e46,_0x256a00){return function(_0x3326fb){if(_0x3326fb){return _0x3326fb[_0x5e5b('0x27')](_0x512e46)[_0x5e5b('0x28')](function(_0x2e38ed){return _0x2e38ed;});}return null;};}function removeEntity(_0x28cd95,_0x135c6c){return function(_0x18903e){if(_0x18903e){return _0x18903e[_0x5e5b('0x29')]()[_0x5e5b('0x28')](function(){_0x28cd95[_0x5e5b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebb11,_0x75800d){return function(_0x3527a8){if(!_0x3527a8){_0x1ebb11['sendStatus'](0x194);}return _0x3527a8;};}function handleError(_0x988e5d,_0xdb2863){_0xdb2863=_0xdb2863||0x1f4;return function(_0x5ee866){logger[_0x5e5b('0x2a')](_0x5ee866[_0x5e5b('0x2b')]);if(_0x5ee866[_0x5e5b('0x2c')]){delete _0x5ee866[_0x5e5b('0x2c')];}_0x988e5d[_0x5e5b('0x1d')](_0xdb2863)[_0x5e5b('0x2d')](_0x5ee866);};}exports[_0x5e5b('0x2e')]=function(_0x2b4351,_0x3f6b25){var _0x42da3b={},_0xcb272c={},_0x28157a={'count':0x0,'rows':[]};var _0x4ed688=_['map'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')],function(_0xb68419){return{'name':_0xb68419[_0x5e5b('0x31')],'type':_0xb68419[_0x5e5b('0x32')]['key']};});_0xcb272c[_0x5e5b('0x33')]=_['map'](_0x4ed688,_0x5e5b('0x2c'));_0xcb272c[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x2b4351[_0x5e5b('0x34')]);_0xcb272c['filters']=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],_0xcb272c['query']);_0x42da3b[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x42da3b[_0x5e5b('0x37')]=_0x42da3b[_0x5e5b('0x37')]['length']?_0x42da3b[_0x5e5b('0x37')]:_0xcb272c[_0x5e5b('0x33')];if(!_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x42da3b[_0x5e5b('0x21')]=qs['limit'](_0x2b4351['query'][_0x5e5b('0x21')]);_0x42da3b[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x2b4351['query'][_0x5e5b('0x20')]);}_0x42da3b[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x2b4351[_0x5e5b('0x34')]['sort']);_0x42da3b[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_['pick'](_0x2b4351['query'],_0xcb272c[_0x5e5b('0x3e')]),_0x4ed688);if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]){_0x42da3b['where']=_[_0x5e5b('0x40')](_0x42da3b['where'],{'$or':_['map'](_0x4ed688,function(_0x261057){if(_0x261057[_0x5e5b('0x32')]!==_0x5e5b('0x41')){var _0xc666f7={};_0xc666f7[_0x261057[_0x5e5b('0x2c')]]={'$like':'%'+_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]+'%'};return _0xc666f7;}})});}_0x42da3b=_[_0x5e5b('0x40')]({},_0x42da3b,_0x2b4351[_0x5e5b('0x42')]);var _0x53b88f={'where':_0x42da3b[_0x5e5b('0x3d')]};return db[_0x5e5b('0x2f')]['count'](_0x53b88f)[_0x5e5b('0x28')](function(_0x4b54b0){_0x28157a[_0x5e5b('0x22')]=_0x4b54b0;if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x43')]){_0x42da3b[_0x5e5b('0x44')]=[{'all':!![]}];}return db[_0x5e5b('0x2f')][_0x5e5b('0x45')](_0x42da3b);})[_0x5e5b('0x28')](function(_0x24d81f){_0x28157a[_0x5e5b('0x46')]=_0x24d81f;return _0x28157a;})[_0x5e5b('0x28')](respondWithFilteredResult(_0x3f6b25,_0x42da3b))[_0x5e5b('0x47')](handleError(_0x3f6b25,null));};exports['show']=function(_0x2b81dd,_0x40e8ce){var _0x46fec9={'raw':![],'where':{'id':_0x2b81dd[_0x5e5b('0x48')]['id']}},_0x570413={};_0x570413[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')]);_0x570413['query']=_[_0x5e5b('0x35')](_0x2b81dd['query']);_0x570413['filters']=_['intersection'](_0x570413[_0x5e5b('0x33')],_0x570413['query']);_0x46fec9[_0x5e5b('0x37')]=_['intersection'](_0x570413[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b81dd[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x46fec9[_0x5e5b('0x37')]=_0x46fec9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x46fec9['attributes']:_0x570413['model'];if(_0x2b81dd[_0x5e5b('0x34')]['includeAll']){_0x46fec9['include']=[{'all':!![]}];}_0x46fec9=_['merge']({},_0x46fec9,_0x2b81dd[_0x5e5b('0x42')]);return db['ZendeskAccount'][_0x5e5b('0x4a')](_0x46fec9)[_0x5e5b('0x28')](handleEntityNotFound(_0x40e8ce,null))[_0x5e5b('0x28')](respondWithResult(_0x40e8ce,null))[_0x5e5b('0x47')](handleError(_0x40e8ce,null));};exports[_0x5e5b('0x4b')]=function(_0x192445,_0x4fd265){return db[_0x5e5b('0x2f')][_0x5e5b('0x4b')](_0x192445['body'],{})[_0x5e5b('0x28')](respondWithResult(_0x4fd265,0xc9))['catch'](handleError(_0x4fd265,null));};exports[_0x5e5b('0x27')]=function(_0x36d8fa,_0x42ebaf){if(_0x36d8fa[_0x5e5b('0x4c')]['id']){delete _0x36d8fa['body']['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4a')]({'where':{'id':_0x36d8fa['params']['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x42ebaf,null))[_0x5e5b('0x28')](saveUpdates(_0x36d8fa[_0x5e5b('0x4c')],null))[_0x5e5b('0x28')](respondWithResult(_0x42ebaf,null))[_0x5e5b('0x47')](handleError(_0x42ebaf,null));};exports[_0x5e5b('0x29')]=function(_0x50fc9c,_0x690f8c){return db[_0x5e5b('0x2f')]['find']({'where':{'id':_0x50fc9c[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x690f8c,null))[_0x5e5b('0x28')](removeEntity(_0x690f8c,null))['catch'](handleError(_0x690f8c,null));};exports[_0x5e5b('0x4d')]=function(_0x3e0ce5,_0x1f32f2,_0x4844ec){var _0x3877e9={};var _0x2e04d6={};var _0x239804;var _0x4a4e0f;return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x3e0ce5['params']['id']}})['then'](handleEntityNotFound(_0x1f32f2,null))[_0x5e5b('0x28')](function(_0x13eee9){if(_0x13eee9){_0x239804=_0x13eee9;_0x2e04d6[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x4f')][_0x5e5b('0x30')]);_0x2e04d6[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x3e0ce5[_0x5e5b('0x34')]);_0x2e04d6[_0x5e5b('0x3e')]=_['intersection'](_0x2e04d6['model'],_0x2e04d6[_0x5e5b('0x34')]);_0x3877e9[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0x2e04d6[_0x5e5b('0x33')],qs['fields'](_0x3e0ce5[_0x5e5b('0x34')]['fields']));_0x3877e9[_0x5e5b('0x37')]=_0x3877e9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x3877e9[_0x5e5b('0x37')]:_0x2e04d6[_0x5e5b('0x33')];_0x3877e9[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x3e0ce5[_0x5e5b('0x34')]['sort']);_0x3877e9[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_[_0x5e5b('0x50')](_0x3e0ce5[_0x5e5b('0x34')],_0x2e04d6[_0x5e5b('0x3e')]));if(_0x3e0ce5['query'][_0x5e5b('0x3f')]){_0x3877e9[_0x5e5b('0x3d')]=_[_0x5e5b('0x40')](_0x3877e9[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x51')](_0x3877e9['attributes'],function(_0x13fb51){var _0x5d9ff9={};_0x5d9ff9[_0x13fb51]={'$like':'%'+_0x3e0ce5[_0x5e5b('0x34')]['filter']+'%'};return _0x5d9ff9;})});}_0x3877e9=_[_0x5e5b('0x40')]({},_0x3877e9,_0x3e0ce5[_0x5e5b('0x42')]);return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x229a2d){if(_0x229a2d){_0x4a4e0f=_0x229a2d[_0x5e5b('0x49')];if(!_0x3e0ce5['query'][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x3877e9[_0x5e5b('0x21')]=qs[_0x5e5b('0x21')](_0x3e0ce5['query']['limit']);_0x3877e9[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x3e0ce5['query'][_0x5e5b('0x20')]);}return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x470042){if(_0x470042){return _0x470042?{'count':_0x4a4e0f,'rows':_0x470042}:null;}})[_0x5e5b('0x28')](respondWithResult(_0x1f32f2,null))['catch'](handleError(_0x1f32f2,null));};exports[_0x5e5b('0x52')]=function(_0x61faf2,_0x494b1d,_0x4795a7){if(_0x61faf2['body']['id']){delete _0x61faf2[_0x5e5b('0x4c')]['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4e')]({'where':{'id':_0x61faf2[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x494b1d,null))['then'](function(_0x28d834){if(_0x28d834){_0x61faf2[_0x5e5b('0x4c')]['AccountId']=_0x28d834['id'];_0x61faf2[_0x5e5b('0x4c')]['Subjects']=integrations['getSubjects'](_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x54')]=integrations[_0x5e5b('0x55')](_0x61faf2['body'][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);return db[_0x5e5b('0x4f')][_0x5e5b('0x4b')](_0x61faf2[_0x5e5b('0x4c')],{'include':[{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x57')},{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x54')}]});}return null;})[_0x5e5b('0x28')](respondWithResult(_0x494b1d,null))['catch'](handleError(_0x494b1d,null));};exports[_0x5e5b('0x58')]=function(_0x1a3d7b,_0x3c57ad,_0x271af6){var _0xc7171a='';return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x1a3d7b[_0x5e5b('0x48')]['id']},'attributes':['id',_0x5e5b('0x59'),_0x5e5b('0x5a'),_0x5e5b('0x5b'),_0x5e5b('0x5c'),'remoteUri']})[_0x5e5b('0x28')](handleEntityNotFound(_0x3c57ad,null))[_0x5e5b('0x28')](function(_0x359c04){if(_0x359c04){_0xc7171a=_0x359c04['remoteUri'];var _0xc8316a=_0xc7171a[_0x5e5b('0x5d')](-0x1);if(_0xc8316a==='/'){_0xc7171a=_0xc7171a[_0x5e5b('0x5e')](0x0,_0xc7171a[_0x5e5b('0x5f')](_0xc8316a));}var _0x344c25={'method':_0x5e5b('0x60'),'uri':util[_0x5e5b('0x61')](_0x5e5b('0x62'),_0xc7171a,_0x5e5b('0x63')),'json':!![]};switch(_0x359c04['authType']){case _0x5e5b('0x5a'):_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')](_0x5e5b('0x64'),new Buffer(util['format']('%s:%s',_0x359c04[_0x5e5b('0x59')],_0x359c04[_0x5e5b('0x5a')]))['toString'](_0x5e5b('0x65')))};break;case'token':_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')]('Basic\x20%s',new Buffer(util[_0x5e5b('0x61')](_0x5e5b('0x66'),_0x359c04[_0x5e5b('0x59')],_0x359c04['token']))[_0x5e5b('0x67')](_0x5e5b('0x65')))};break;default:throw new db[(_0x5e5b('0x68'))]['ValidationError'](_0x5e5b('0x69'));}return rp(_0x344c25);}})[_0x5e5b('0x28')](function(_0x58aef4){if(_0x58aef4){var _0x388dbe=['subject','description',_0x5e5b('0x6a'),_0x5e5b('0x6b')];_[_0x5e5b('0x6c')](_0x58aef4[_0x5e5b('0x63')],function(_0x1a7c5c){return _0x388dbe['includes'](_0x1a7c5c[_0x5e5b('0x32')]);});return{'count':_0x58aef4[_0x5e5b('0x63')]['length'],'rows':_['map'](_0x58aef4[_0x5e5b('0x63')],function(_0x467c6b){return{'id':_0x467c6b['id'],'name':_0x467c6b[_0x5e5b('0x6d')]>0x7?_0x467c6b[_0x5e5b('0x6e')]:_0x467c6b[_0x5e5b('0x32')],'custom':_0x467c6b[_0x5e5b('0x6d')]>0x7?!![]:![],'options':_0x467c6b['system_field_options']?_0x467c6b[_0x5e5b('0x6f')]:_0x467c6b[_0x5e5b('0x70')]?_0x467c6b[_0x5e5b('0x70')]:[]};})};}})['then'](respondWithResult(_0x3c57ad,null))['catch'](function(_0x24bcc9){var _0x1eb8cd=_0x1a3d7b[_0x5e5b('0x34')]['test']?0x1f4:_0x24bcc9[_0x5e5b('0x71')]||0x1f4;logger[_0x5e5b('0x2a')](_0x5e5b('0x72'),'getFields',_0x1eb8cd,JSON[_0x5e5b('0x73')](_0x24bcc9));delete _0x24bcc9[_0x5e5b('0x2c')];if(_0x1eb8cd===0x191){_0x1eb8cd=0x190;}_0x3c57ad[_0x5e5b('0x1d')](_0x1eb8cd)['send'](_0x1a3d7b[_0x5e5b('0x34')][_0x5e5b('0x74')]?{'message':_0x5e5b('0x75'),'statusCode':_0x24bcc9[_0x5e5b('0x71')]}:_0x24bcc9);});}; \ No newline at end of file +var _0x7d25=['%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','show','params','find','catch','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x7d25,0x8a));var _0x57d2=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7d25[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];var integrations=require(_0x57d2('0x17'));function respondWithStatusCode(_0x32c33a,_0x28428b){_0x28428b=_0x28428b||0xcc;return function(_0x3181ad){if(_0x3181ad){return _0x32c33a[_0x57d2('0x18')](_0x28428b);}return _0x32c33a[_0x57d2('0x19')](_0x28428b)[_0x57d2('0x1a')]();};}function respondWithResult(_0x4086f3,_0x5382d9){_0x5382d9=_0x5382d9||0xc8;return function(_0x5b940e){if(_0x5b940e){return _0x4086f3[_0x57d2('0x19')](_0x5382d9)[_0x57d2('0x1b')](_0x5b940e);}};}function respondWithFilteredResult(_0x4ec4b1,_0x8cf637){return function(_0x319489){if(_0x319489){var _0x4bb8f7=typeof _0x8cf637[_0x57d2('0x1c')]==='undefined'&&typeof _0x8cf637[_0x57d2('0x1d')]==='undefined';var _0x2ab5f0=_0x319489[_0x57d2('0x1e')];var _0x2ecfdf=_0x4bb8f7?0x0:_0x8cf637['offset'];var _0x525cfc=_0x4bb8f7?_0x319489[_0x57d2('0x1e')]:_0x8cf637[_0x57d2('0x1c')]+_0x8cf637[_0x57d2('0x1d')];var _0x2ca71d;if(_0x525cfc>=_0x2ab5f0){_0x525cfc=_0x2ab5f0;_0x2ca71d=0xc8;}else{_0x2ca71d=0xce;}_0x4ec4b1['status'](_0x2ca71d);return _0x4ec4b1[_0x57d2('0x1f')](_0x57d2('0x20'),_0x2ecfdf+'-'+_0x525cfc+'/'+_0x2ab5f0)['json'](_0x319489);}return null;};}function patchUpdates(_0x5f3fd5){return function(_0x21e509){try{jsonpatch[_0x57d2('0x21')](_0x21e509,_0x5f3fd5,!![]);}catch(_0x317f7a){return BPromise[_0x57d2('0x22')](_0x317f7a);}return _0x21e509[_0x57d2('0x23')]();};}function saveUpdates(_0x803c25,_0x32c7c8){return function(_0x31d2cf){if(_0x31d2cf){return _0x31d2cf[_0x57d2('0x24')](_0x803c25)[_0x57d2('0x25')](function(_0x46a4d1){return _0x46a4d1;});}return null;};}function removeEntity(_0x456fe1,_0x12ff19){return function(_0x473df2){if(_0x473df2){return _0x473df2['destroy']()[_0x57d2('0x25')](function(){_0x456fe1[_0x57d2('0x19')](0xcc)[_0x57d2('0x1a')]();});}};}function handleEntityNotFound(_0x452d5e,_0x4363b3){return function(_0x5058be){if(!_0x5058be){_0x452d5e[_0x57d2('0x18')](0x194);}return _0x5058be;};}function handleError(_0x608b10,_0x995928){_0x995928=_0x995928||0x1f4;return function(_0x16ee2f){logger[_0x57d2('0x26')](_0x16ee2f[_0x57d2('0x27')]);if(_0x16ee2f[_0x57d2('0x28')]){delete _0x16ee2f['name'];}_0x608b10[_0x57d2('0x19')](_0x995928)[_0x57d2('0x29')](_0x16ee2f);};}exports[_0x57d2('0x2a')]=function(_0x1fe383,_0x1957a6){var _0x7c33f3={},_0x1dd6cb={},_0x1d3a3a={'count':0x0,'rows':[]};var _0x1d2bdb=_[_0x57d2('0x2b')](db['ZendeskAccount'][_0x57d2('0x2c')],function(_0x3da926){return{'name':_0x3da926[_0x57d2('0x2d')],'type':_0x3da926[_0x57d2('0x2e')]['key']};});_0x1dd6cb[_0x57d2('0x2f')]=_[_0x57d2('0x2b')](_0x1d2bdb,_0x57d2('0x28'));_0x1dd6cb[_0x57d2('0x30')]=_[_0x57d2('0x31')](_0x1fe383[_0x57d2('0x30')]);_0x1dd6cb[_0x57d2('0x32')]=_[_0x57d2('0x33')](_0x1dd6cb[_0x57d2('0x2f')],_0x1dd6cb['query']);_0x7c33f3[_0x57d2('0x34')]=_[_0x57d2('0x33')](_0x1dd6cb['model'],qs[_0x57d2('0x35')](_0x1fe383[_0x57d2('0x30')]['fields']));_0x7c33f3[_0x57d2('0x34')]=_0x7c33f3[_0x57d2('0x34')][_0x57d2('0x36')]?_0x7c33f3[_0x57d2('0x34')]:_0x1dd6cb[_0x57d2('0x2f')];if(!_0x1fe383['query']['hasOwnProperty']('nolimit')){_0x7c33f3['limit']=qs[_0x57d2('0x1d')](_0x1fe383[_0x57d2('0x30')][_0x57d2('0x1d')]);_0x7c33f3[_0x57d2('0x1c')]=qs[_0x57d2('0x1c')](_0x1fe383['query'][_0x57d2('0x1c')]);}_0x7c33f3['order']=qs[_0x57d2('0x37')](_0x1fe383[_0x57d2('0x30')][_0x57d2('0x37')]);_0x7c33f3['where']=qs[_0x57d2('0x32')](_[_0x57d2('0x38')](_0x1fe383['query'],_0x1dd6cb[_0x57d2('0x32')]),_0x1d2bdb);if(_0x1fe383[_0x57d2('0x30')][_0x57d2('0x39')]){_0x7c33f3[_0x57d2('0x3a')]=_[_0x57d2('0x3b')](_0x7c33f3[_0x57d2('0x3a')],{'$or':_['map'](_0x1d2bdb,function(_0x27e4a6){if(_0x27e4a6['type']!==_0x57d2('0x3c')){var _0x2df063={};_0x2df063[_0x27e4a6[_0x57d2('0x28')]]={'$like':'%'+_0x1fe383[_0x57d2('0x30')][_0x57d2('0x39')]+'%'};return _0x2df063;}})});}_0x7c33f3=_['merge']({},_0x7c33f3,_0x1fe383[_0x57d2('0x3d')]);var _0x1dbbb7={'where':_0x7c33f3['where']};return db[_0x57d2('0x3e')][_0x57d2('0x1e')](_0x1dbbb7)[_0x57d2('0x25')](function(_0x514074){_0x1d3a3a[_0x57d2('0x1e')]=_0x514074;if(_0x1fe383[_0x57d2('0x30')][_0x57d2('0x3f')]){_0x7c33f3[_0x57d2('0x40')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x7c33f3);})[_0x57d2('0x25')](function(_0x42bc14){_0x1d3a3a[_0x57d2('0x41')]=_0x42bc14;return _0x1d3a3a;})['then'](respondWithFilteredResult(_0x1957a6,_0x7c33f3))['catch'](handleError(_0x1957a6,null));};exports[_0x57d2('0x42')]=function(_0x5116b5,_0xe42c98){var _0x1bb8ad={'raw':![],'where':{'id':_0x5116b5[_0x57d2('0x43')]['id']}},_0x4079b8={};_0x4079b8[_0x57d2('0x2f')]=_['keys'](db[_0x57d2('0x3e')][_0x57d2('0x2c')]);_0x4079b8['query']=_[_0x57d2('0x31')](_0x5116b5['query']);_0x4079b8[_0x57d2('0x32')]=_[_0x57d2('0x33')](_0x4079b8[_0x57d2('0x2f')],_0x4079b8[_0x57d2('0x30')]);_0x1bb8ad['attributes']=_['intersection'](_0x4079b8[_0x57d2('0x2f')],qs['fields'](_0x5116b5['query'][_0x57d2('0x35')]));_0x1bb8ad['attributes']=_0x1bb8ad['attributes'][_0x57d2('0x36')]?_0x1bb8ad['attributes']:_0x4079b8[_0x57d2('0x2f')];if(_0x5116b5['query'][_0x57d2('0x3f')]){_0x1bb8ad['include']=[{'all':!![]}];}_0x1bb8ad=_['merge']({},_0x1bb8ad,_0x5116b5[_0x57d2('0x3d')]);return db[_0x57d2('0x3e')][_0x57d2('0x44')](_0x1bb8ad)[_0x57d2('0x25')](handleEntityNotFound(_0xe42c98,null))[_0x57d2('0x25')](respondWithResult(_0xe42c98,null))[_0x57d2('0x45')](handleError(_0xe42c98,null));};exports['create']=function(_0x4541b2,_0xf91b05){return db[_0x57d2('0x3e')][_0x57d2('0x46')](_0x4541b2[_0x57d2('0x47')],{})[_0x57d2('0x25')](respondWithResult(_0xf91b05,0xc9))[_0x57d2('0x45')](handleError(_0xf91b05,null));};exports[_0x57d2('0x24')]=function(_0x51f172,_0x9f6f34){if(_0x51f172[_0x57d2('0x47')]['id']){delete _0x51f172['body']['id'];}return db[_0x57d2('0x3e')]['find']({'where':{'id':_0x51f172['params']['id']}})[_0x57d2('0x25')](handleEntityNotFound(_0x9f6f34,null))[_0x57d2('0x25')](saveUpdates(_0x51f172[_0x57d2('0x47')],null))[_0x57d2('0x25')](respondWithResult(_0x9f6f34,null))['catch'](handleError(_0x9f6f34,null));};exports[_0x57d2('0x48')]=function(_0x176e24,_0x51b535){return db['ZendeskAccount'][_0x57d2('0x44')]({'where':{'id':_0x176e24[_0x57d2('0x43')]['id']}})[_0x57d2('0x25')](handleEntityNotFound(_0x51b535,null))[_0x57d2('0x25')](removeEntity(_0x51b535,null))[_0x57d2('0x45')](handleError(_0x51b535,null));};exports[_0x57d2('0x49')]=function(_0x5a3e86,_0x4b377f,_0x5a5edb){var _0x30482c={};var _0x505849={};var _0x11165d;var _0x2ef710;return db['ZendeskAccount'][_0x57d2('0x4a')]({'where':{'id':_0x5a3e86[_0x57d2('0x43')]['id']}})[_0x57d2('0x25')](handleEntityNotFound(_0x4b377f,null))['then'](function(_0x10d4e5){if(_0x10d4e5){_0x11165d=_0x10d4e5;_0x505849[_0x57d2('0x2f')]=_[_0x57d2('0x31')](db[_0x57d2('0x4b')][_0x57d2('0x2c')]);_0x505849[_0x57d2('0x30')]=_[_0x57d2('0x31')](_0x5a3e86[_0x57d2('0x30')]);_0x505849[_0x57d2('0x32')]=_['intersection'](_0x505849[_0x57d2('0x2f')],_0x505849[_0x57d2('0x30')]);_0x30482c[_0x57d2('0x34')]=_['intersection'](_0x505849[_0x57d2('0x2f')],qs[_0x57d2('0x35')](_0x5a3e86[_0x57d2('0x30')]['fields']));_0x30482c['attributes']=_0x30482c['attributes'][_0x57d2('0x36')]?_0x30482c['attributes']:_0x505849[_0x57d2('0x2f')];_0x30482c['order']=qs[_0x57d2('0x37')](_0x5a3e86['query'][_0x57d2('0x37')]);_0x30482c[_0x57d2('0x3a')]=qs[_0x57d2('0x32')](_['pick'](_0x5a3e86['query'],_0x505849[_0x57d2('0x32')]));if(_0x5a3e86[_0x57d2('0x30')][_0x57d2('0x39')]){_0x30482c[_0x57d2('0x3a')]=_[_0x57d2('0x3b')](_0x30482c[_0x57d2('0x3a')],{'$or':_['map'](_0x30482c['attributes'],function(_0x2040c0){var _0x6951d8={};_0x6951d8[_0x2040c0]={'$like':'%'+_0x5a3e86[_0x57d2('0x30')][_0x57d2('0x39')]+'%'};return _0x6951d8;})});}_0x30482c=_['merge']({},_0x30482c,_0x5a3e86['options']);return _0x11165d[_0x57d2('0x49')](_0x30482c);}})[_0x57d2('0x25')](function(_0x4f6b8a){if(_0x4f6b8a){_0x2ef710=_0x4f6b8a[_0x57d2('0x36')];if(!_0x5a3e86[_0x57d2('0x30')][_0x57d2('0x4c')](_0x57d2('0x4d'))){_0x30482c['limit']=qs['limit'](_0x5a3e86['query']['limit']);_0x30482c[_0x57d2('0x1c')]=qs[_0x57d2('0x1c')](_0x5a3e86[_0x57d2('0x30')][_0x57d2('0x1c')]);}return _0x11165d[_0x57d2('0x49')](_0x30482c);}})[_0x57d2('0x25')](function(_0x2737ab){if(_0x2737ab){return _0x2737ab?{'count':_0x2ef710,'rows':_0x2737ab}:null;}})['then'](respondWithResult(_0x4b377f,null))[_0x57d2('0x45')](handleError(_0x4b377f,null));};exports['addConfiguration']=function(_0xca2707,_0x4fa789,_0x3fa67e){if(_0xca2707[_0x57d2('0x47')]['id']){delete _0xca2707[_0x57d2('0x47')]['id'];}return db[_0x57d2('0x3e')][_0x57d2('0x4a')]({'where':{'id':_0xca2707[_0x57d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fa789,null))[_0x57d2('0x25')](function(_0x24d3bf){if(_0x24d3bf){_0xca2707[_0x57d2('0x47')][_0x57d2('0x4e')]=_0x24d3bf['id'];_0xca2707[_0x57d2('0x47')][_0x57d2('0x4f')]=integrations[_0x57d2('0x50')](_0xca2707[_0x57d2('0x47')][_0x57d2('0x51')],_0xca2707['body'][_0x57d2('0x2e')]);_0xca2707['body']['Descriptions']=integrations['getDescriptions'](_0xca2707[_0x57d2('0x47')]['channel'],_0xca2707[_0x57d2('0x47')][_0x57d2('0x2e')]);return db['ZendeskConfiguration'][_0x57d2('0x46')](_0xca2707[_0x57d2('0x47')],{'include':[{'model':db[_0x57d2('0x52')],'as':_0x57d2('0x4f')},{'model':db['ZendeskField'],'as':_0x57d2('0x53')}]});}return null;})[_0x57d2('0x25')](respondWithResult(_0x4fa789,null))['catch'](handleError(_0x4fa789,null));};exports['getFields']=function(_0x28c7ff,_0x45f222,_0x481c6b){var _0x46c7de='';return db[_0x57d2('0x3e')][_0x57d2('0x4a')]({'where':{'id':_0x28c7ff[_0x57d2('0x43')]['id']},'attributes':['id',_0x57d2('0x54'),_0x57d2('0x55'),_0x57d2('0x56'),_0x57d2('0x57'),_0x57d2('0x58')]})[_0x57d2('0x25')](handleEntityNotFound(_0x45f222,null))[_0x57d2('0x25')](function(_0x1d7850){if(_0x1d7850){_0x46c7de=_0x1d7850[_0x57d2('0x58')];var _0x48aefe=_0x46c7de[_0x57d2('0x59')](-0x1);if(_0x48aefe==='/'){_0x46c7de=_0x46c7de[_0x57d2('0x5a')](0x0,_0x46c7de[_0x57d2('0x5b')](_0x48aefe));}var _0x1fee02={'method':_0x57d2('0x5c'),'uri':util[_0x57d2('0x5d')](_0x57d2('0x5e'),_0x46c7de,_0x57d2('0x5f')),'json':!![]};switch(_0x1d7850[_0x57d2('0x57')]){case _0x57d2('0x55'):_0x1fee02[_0x57d2('0x60')]={'Authorization':util[_0x57d2('0x5d')](_0x57d2('0x61'),new Buffer(util[_0x57d2('0x5d')](_0x57d2('0x62'),_0x1d7850[_0x57d2('0x54')],_0x1d7850['password']))[_0x57d2('0x63')](_0x57d2('0x64')))};break;case'token':_0x1fee02[_0x57d2('0x60')]={'Authorization':util[_0x57d2('0x5d')](_0x57d2('0x61'),new Buffer(util[_0x57d2('0x5d')]('%s/token:%s',_0x1d7850[_0x57d2('0x54')],_0x1d7850['token']))['toString'](_0x57d2('0x64')))};break;default:throw new db['Sequelize'][(_0x57d2('0x65'))](_0x57d2('0x66'));}return rp(_0x1fee02);}})[_0x57d2('0x25')](function(_0x31fa1b){if(_0x31fa1b){var _0x4ea1b4=[_0x57d2('0x67'),_0x57d2('0x68'),_0x57d2('0x69'),_0x57d2('0x6a')];_[_0x57d2('0x6b')](_0x31fa1b[_0x57d2('0x5f')],function(_0xc26657){return _0x4ea1b4[_0x57d2('0x6c')](_0xc26657[_0x57d2('0x2e')]);});return{'count':_0x31fa1b[_0x57d2('0x5f')]['length'],'rows':_[_0x57d2('0x2b')](_0x31fa1b[_0x57d2('0x5f')],function(_0x1bf81c){return{'id':_0x1bf81c['id'],'name':_0x1bf81c[_0x57d2('0x6d')]>0x7?_0x1bf81c[_0x57d2('0x6e')]:_0x1bf81c[_0x57d2('0x2e')],'custom':_0x1bf81c[_0x57d2('0x6d')]>0x7?!![]:![],'options':_0x1bf81c[_0x57d2('0x6f')]?_0x1bf81c[_0x57d2('0x6f')]:_0x1bf81c[_0x57d2('0x70')]?_0x1bf81c[_0x57d2('0x70')]:[]};})};}})[_0x57d2('0x25')](respondWithResult(_0x45f222,null))['catch'](function(_0x5aa569){var _0x3e101b=_0x28c7ff[_0x57d2('0x30')][_0x57d2('0x71')]?0x1f4:_0x5aa569[_0x57d2('0x72')]||0x1f4;logger[_0x57d2('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3e101b,JSON[_0x57d2('0x73')](_0x5aa569));delete _0x5aa569[_0x57d2('0x28')];if(_0x3e101b===0x191){_0x3e101b=0x190;}_0x45f222[_0x57d2('0x19')](_0x3e101b)[_0x57d2('0x29')](_0x28c7ff[_0x57d2('0x30')][_0x57d2('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x5aa569[_0x57d2('0x72')]}:_0x5aa569);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c4209e6..8af6970 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 _0x4b2f=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','../../config/logger','api','moment','request-promise','path'];(function(_0x51d279,_0x31a487){var _0x585e6a=function(_0x5aa23b){while(--_0x5aa23b){_0x51d279['push'](_0x51d279['shift']());}};_0x585e6a(++_0x31a487);}(_0x4b2f,0x171));var _0xf4b2=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x4b2f[_0x42bc91];return _0x3f5507;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4b2('0x0'))(_0xf4b2('0x1'));var moment=require(_0xf4b2('0x2'));var BPromise=require('bluebird');var rp=require(_0xf4b2('0x3'));var fs=require('fs');var path=require(_0xf4b2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4b2('0x5'));var integrations=require(_0xf4b2('0x6'));module[_0xf4b2('0x7')]=function(_0x1ffd20,_0x27d927){return _0x1ffd20[_0xf4b2('0x8')](_0xf4b2('0x9'),attributes,{'tableName':_0xf4b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96f2=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x96f2,0x1d1));var _0x296f=function(_0x562115,_0x26dbd3){_0x562115=_0x562115-0x0;var _0x420ce5=_0x96f2[_0x562115];return _0x420ce5;};'use strict';var _=require(_0x296f('0x0'));var util=require(_0x296f('0x1'));var logger=require(_0x296f('0x2'))(_0x296f('0x3'));var moment=require(_0x296f('0x4'));var BPromise=require(_0x296f('0x5'));var rp=require(_0x296f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x296f('0x7'));var config=require(_0x296f('0x8'));var attributes=require(_0x296f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x296f('0xa')]=function(_0x8d3e5f,_0xba8adb){return _0x8d3e5f[_0x296f('0xb')](_0x296f('0xc'),attributes,{'tableName':_0x296f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index e9590a3..ef41998 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 _0xda91=['include','model','attributes','map','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit'];(function(_0x1d5a4e,_0xc0582){var _0x58acba=function(_0x26a5fa){while(--_0x26a5fa){_0x1d5a4e['push'](_0x1d5a4e['shift']());}};_0x58acba(++_0xc0582);}(_0xda91,0x72));var _0x1da9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xda91[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1da9('0x0'));var util=require('util');var moment=require(_0x1da9('0x1'));var BPromise=require(_0x1da9('0x2'));var rs=require(_0x1da9('0x3'));var fs=require('fs');var Redis=require(_0x1da9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1da9('0x5'))(_0x1da9('0x6'));var config=require(_0x1da9('0x7'));var jayson=require(_0x1da9('0x8'));var client=jayson[_0x1da9('0x9')][_0x1da9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b135f,_0x54a413,_0x5053a9){return new BPromise(function(_0x213939,_0x55342e){return client[_0x1da9('0xb')](_0x1b135f,_0x5053a9)[_0x1da9('0xc')](function(_0x59b66f){logger[_0x1da9('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x54a413,'request\x20sent');logger[_0x1da9('0xe')](_0x1da9('0xf'),_0x54a413,_0x1da9('0x10'),JSON[_0x1da9('0x11')](_0x59b66f));if(_0x59b66f[_0x1da9('0x12')]){if(_0x59b66f[_0x1da9('0x12')]['code']===0x1f4){logger[_0x1da9('0x12')](_0x1da9('0x13'),_0x54a413,_0x59b66f[_0x1da9('0x12')][_0x1da9('0x14')]);return _0x55342e(_0x59b66f[_0x1da9('0x12')][_0x1da9('0x14')]);}logger[_0x1da9('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x54a413,_0x59b66f[_0x1da9('0x12')]['message']);return _0x213939(_0x59b66f['error']['message']);}else{logger['info'](_0x1da9('0x13'),_0x54a413,_0x1da9('0x10'));_0x213939(_0x59b66f[_0x1da9('0x15')][_0x1da9('0x14')]);}})[_0x1da9('0x16')](function(_0x153467){logger['error'](_0x1da9('0x13'),_0x54a413,_0x153467);_0x55342e(_0x153467);});});}exports[_0x1da9('0x17')]=function(_0x1bceea){var _0x3d7985=this;return new Promise(function(_0x16482a,_0x2fd801){return db[_0x1da9('0x18')][_0x1da9('0x19')]({'raw':_0x1bceea[_0x1da9('0x1a')]?_0x1bceea['options'][_0x1da9('0x1b')]===undefined?!![]:![]:!![],'where':_0x1bceea['options']?_0x1bceea['options'][_0x1da9('0x1c')]||null:null,'attributes':_0x1bceea['options']?_0x1bceea[_0x1da9('0x1a')]['attributes']||null:null,'limit':_0x1bceea[_0x1da9('0x1a')]?_0x1bceea[_0x1da9('0x1a')][_0x1da9('0x1d')]||null:null,'include':_0x1bceea['options']?_0x1bceea[_0x1da9('0x1a')][_0x1da9('0x1e')]?_['map'](_0x1bceea['options']['include'],function(_0x412eac){return{'model':db[_0x412eac[_0x1da9('0x1f')]],'as':_0x412eac['as'],'attributes':_0x412eac[_0x1da9('0x20')],'include':_0x412eac['include']?_['map'](_0x412eac[_0x1da9('0x1e')],function(_0x5be2af){return{'model':db[_0x5be2af[_0x1da9('0x1f')]],'as':_0x5be2af['as'],'attributes':_0x5be2af['attributes'],'include':_0x5be2af['include']?_[_0x1da9('0x21')](_0x5be2af[_0x1da9('0x1e')],function(_0x11fc41){return{'model':db[_0x11fc41['model']],'as':_0x11fc41['as'],'attributes':_0x11fc41[_0x1da9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1da9('0xc')](function(_0x1148cc){logger[_0x1da9('0xd')](_0x1da9('0x17'),_0x1bceea);logger['debug'](_0x1da9('0x17'),_0x1bceea,JSON['stringify'](_0x1148cc));_0x16482a(_0x1148cc);})[_0x1da9('0x16')](function(_0xf5b222){logger[_0x1da9('0x12')](_0x1da9('0x17'),_0xf5b222[_0x1da9('0x14')],_0x1bceea);_0x2fd801(_0x3d7985[_0x1da9('0x12')](0x1f4,_0xf5b222[_0x1da9('0x14')]));});});};exports[_0x1da9('0x22')]=function(_0x52cedb){var _0x2a214a=this;return new Promise(function(_0x546c35,_0x25150a){return db['ZendeskAccount'][_0x1da9('0x23')]({'raw':_0x52cedb[_0x1da9('0x1a')]?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x1b')]===undefined?!![]:![]:!![],'where':_0x52cedb['options']?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x1c')]||null:null,'attributes':_0x52cedb['options']?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x20')]||null:null,'include':_0x52cedb[_0x1da9('0x1a')]?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x1e')]?_[_0x1da9('0x21')](_0x52cedb['options'][_0x1da9('0x1e')],function(_0x2494f3){return{'model':db[_0x2494f3[_0x1da9('0x1f')]],'as':_0x2494f3['as'],'attributes':_0x2494f3['attributes'],'include':_0x2494f3[_0x1da9('0x1e')]?_[_0x1da9('0x21')](_0x2494f3['include'],function(_0xf1847f){return{'model':db[_0xf1847f[_0x1da9('0x1f')]],'as':_0xf1847f['as'],'attributes':_0xf1847f['attributes'],'include':_0xf1847f['include']?_[_0x1da9('0x21')](_0xf1847f[_0x1da9('0x1e')],function(_0x45f38a){return{'model':db[_0x45f38a['model']],'as':_0x45f38a['as'],'attributes':_0x45f38a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1da9('0xc')](function(_0x4fe108){logger[_0x1da9('0xd')](_0x1da9('0x22'),_0x52cedb);logger[_0x1da9('0xe')](_0x1da9('0x22'),_0x52cedb,JSON[_0x1da9('0x11')](_0x4fe108));_0x546c35(_0x4fe108);})[_0x1da9('0x16')](function(_0x368d33){logger[_0x1da9('0x12')]('ShowZendeskAccount',_0x368d33[_0x1da9('0x14')],_0x52cedb);_0x25150a(_0x2a214a['error'](0x1f4,_0x368d33[_0x1da9('0x14')]));});});}; \ No newline at end of file +var _0x5a43=['then','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','options','raw','where','attributes','limit','include','map','model'];(function(_0x307fcf,_0x394370){var _0x35522f=function(_0x3b78ea){while(--_0x3b78ea){_0x307fcf['push'](_0x307fcf['shift']());}};_0x35522f(++_0x394370);}(_0x5a43,0xd0));var _0x35a4=function(_0x3922bb,_0x48137d){_0x3922bb=_0x3922bb-0x0;var _0x47c1a2=_0x5a43[_0x3922bb];return _0x47c1a2;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35a4('0x6'))('rpc');var config=require(_0x35a4('0x7'));var jayson=require(_0x35a4('0x8'));var client=jayson[_0x35a4('0x9')][_0x35a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33f4a0,_0x816bf7,_0x3320ba){return new BPromise(function(_0x3d8b5e,_0x3e1a02){return client[_0x35a4('0xb')](_0x33f4a0,_0x3320ba)['then'](function(_0x571392){logger[_0x35a4('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x816bf7,_0x35a4('0xd'));logger[_0x35a4('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x816bf7,_0x35a4('0xd'),JSON['stringify'](_0x571392));if(_0x571392[_0x35a4('0xf')]){if(_0x571392[_0x35a4('0xf')][_0x35a4('0x10')]===0x1f4){logger[_0x35a4('0xf')](_0x35a4('0x11'),_0x816bf7,_0x571392[_0x35a4('0xf')]['message']);return _0x3e1a02(_0x571392[_0x35a4('0xf')][_0x35a4('0x12')]);}logger['error'](_0x35a4('0x11'),_0x816bf7,_0x571392[_0x35a4('0xf')][_0x35a4('0x12')]);return _0x3d8b5e(_0x571392[_0x35a4('0xf')]['message']);}else{logger['info'](_0x35a4('0x11'),_0x816bf7,_0x35a4('0xd'));_0x3d8b5e(_0x571392[_0x35a4('0x13')][_0x35a4('0x12')]);}})[_0x35a4('0x14')](function(_0x123c7a){logger[_0x35a4('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x816bf7,_0x123c7a);_0x3e1a02(_0x123c7a);});});}exports[_0x35a4('0x15')]=function(_0x2f2b5c){var _0x4cea70=this;return new Promise(function(_0x1d180e,_0x3dd48c){return db['ZendeskAccount']['findAll']({'raw':_0x2f2b5c[_0x35a4('0x16')]?_0x2f2b5c[_0x35a4('0x16')][_0x35a4('0x17')]===undefined?!![]:![]:!![],'where':_0x2f2b5c[_0x35a4('0x16')]?_0x2f2b5c[_0x35a4('0x16')][_0x35a4('0x18')]||null:null,'attributes':_0x2f2b5c[_0x35a4('0x16')]?_0x2f2b5c[_0x35a4('0x16')][_0x35a4('0x19')]||null:null,'limit':_0x2f2b5c[_0x35a4('0x16')]?_0x2f2b5c[_0x35a4('0x16')][_0x35a4('0x1a')]||null:null,'include':_0x2f2b5c['options']?_0x2f2b5c[_0x35a4('0x16')][_0x35a4('0x1b')]?_['map'](_0x2f2b5c['options']['include'],function(_0x5167df){return{'model':db[_0x5167df['model']],'as':_0x5167df['as'],'attributes':_0x5167df[_0x35a4('0x19')],'include':_0x5167df['include']?_[_0x35a4('0x1c')](_0x5167df[_0x35a4('0x1b')],function(_0xf876d0){return{'model':db[_0xf876d0[_0x35a4('0x1d')]],'as':_0xf876d0['as'],'attributes':_0xf876d0['attributes'],'include':_0xf876d0['include']?_[_0x35a4('0x1c')](_0xf876d0[_0x35a4('0x1b')],function(_0x33692e){return{'model':db[_0x33692e[_0x35a4('0x1d')]],'as':_0x33692e['as'],'attributes':_0x33692e['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a4('0x1e')](function(_0x431f37){logger[_0x35a4('0xc')]('GetZendeskAccount',_0x2f2b5c);logger['debug']('GetZendeskAccount',_0x2f2b5c,JSON['stringify'](_0x431f37));_0x1d180e(_0x431f37);})['catch'](function(_0x566221){logger[_0x35a4('0xf')]('GetZendeskAccount',_0x566221[_0x35a4('0x12')],_0x2f2b5c);_0x3dd48c(_0x4cea70[_0x35a4('0xf')](0x1f4,_0x566221[_0x35a4('0x12')]));});});};exports[_0x35a4('0x1f')]=function(_0x2e3b7d){var _0x925a03=this;return new Promise(function(_0x270251,_0x4c8752){return db[_0x35a4('0x20')][_0x35a4('0x21')]({'raw':_0x2e3b7d[_0x35a4('0x16')]?_0x2e3b7d['options'][_0x35a4('0x17')]===undefined?!![]:![]:!![],'where':_0x2e3b7d[_0x35a4('0x16')]?_0x2e3b7d[_0x35a4('0x16')][_0x35a4('0x18')]||null:null,'attributes':_0x2e3b7d[_0x35a4('0x16')]?_0x2e3b7d[_0x35a4('0x16')][_0x35a4('0x19')]||null:null,'include':_0x2e3b7d[_0x35a4('0x16')]?_0x2e3b7d[_0x35a4('0x16')][_0x35a4('0x1b')]?_[_0x35a4('0x1c')](_0x2e3b7d[_0x35a4('0x16')]['include'],function(_0x5134d3){return{'model':db[_0x5134d3[_0x35a4('0x1d')]],'as':_0x5134d3['as'],'attributes':_0x5134d3['attributes'],'include':_0x5134d3[_0x35a4('0x1b')]?_[_0x35a4('0x1c')](_0x5134d3[_0x35a4('0x1b')],function(_0x290e7d){return{'model':db[_0x290e7d[_0x35a4('0x1d')]],'as':_0x290e7d['as'],'attributes':_0x290e7d[_0x35a4('0x19')],'include':_0x290e7d['include']?_[_0x35a4('0x1c')](_0x290e7d[_0x35a4('0x1b')],function(_0x53b3f6){return{'model':db[_0x53b3f6[_0x35a4('0x1d')]],'as':_0x53b3f6['as'],'attributes':_0x53b3f6[_0x35a4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35a4('0x1e')](function(_0x389643){logger[_0x35a4('0xc')]('ShowZendeskAccount',_0x2e3b7d);logger[_0x35a4('0xe')](_0x35a4('0x1f'),_0x2e3b7d,JSON['stringify'](_0x389643));_0x270251(_0x389643);})['catch'](function(_0x4105ae){logger[_0x35a4('0xf')](_0x35a4('0x1f'),_0x4105ae[_0x35a4('0x12')],_0x2e3b7d);_0x4c8752(_0x925a03[_0x35a4('0xf')](0x1f4,_0x4105ae[_0x35a4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8dac93e..a60e75d 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 _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x47a539,_0x40ab84){var _0x2dbc23=function(_0x57b2eb){while(--_0x57b2eb){_0x47a539['push'](_0x47a539['shift']());}};_0x2dbc23(++_0x40ab84);}(_0x757a,0xde));var _0xa757=function(_0x374c68,_0x5160ce){_0x374c68=_0x374c68-0x0;var _0x4dd384=_0x757a[_0x374c68];return _0x4dd384;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file +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(_0xc3794,_0x2453ff){var _0x4f9aef=function(_0x3dafc7){while(--_0x3dafc7){_0xc3794['push'](_0xc3794['shift']());}};_0x4f9aef(++_0x2453ff);}(_0x91a7,0xe7));var _0x791a=function(_0x35cf58,_0x280717){_0x35cf58=_0x35cf58-0x0;var _0x3e8e65=_0x91a7[_0x35cf58];return _0x3e8e65;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5b08771..1fbe03b 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 _0x982a=['STRING'];(function(_0x18663b,_0x3846b6){var _0x54572c=function(_0x2cd601){while(--_0x2cd601){_0x18663b['push'](_0x18663b['shift']());}};_0x54572c(++_0x3846b6);}(_0x982a,0x171));var _0xa982=function(_0x3ed1c1,_0x45fe0a){_0x3ed1c1=_0x3ed1c1-0x0;var _0x11797d=_0x982a[_0x3ed1c1];return _0x11797d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa982('0x0')]},'description':{'type':Sequelize[_0xa982('0x0')]}}; \ No newline at end of file +var _0x96a8=['sequelize','exports','STRING'];(function(_0x1cb0e1,_0x5b69a7){var _0x1ccf18=function(_0x221476){while(--_0x221476){_0x1cb0e1['push'](_0x1cb0e1['shift']());}};_0x1ccf18(++_0x5b69a7);}(_0x96a8,0x132));var _0x896a=function(_0x2074de,_0x4721dd){_0x2074de=_0x2074de-0x0;var _0x379282=_0x96a8[_0x2074de];return _0x379282;};'use strict';var Sequelize=require(_0x896a('0x0'));module[_0x896a('0x1')]={'name':{'type':Sequelize[_0x896a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e0f114b..9e72a4e 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 _0x1d93=['merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','update','params','ZendeskField','getFields','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','end','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x55b23c,_0x52e162){var _0x2a739a=function(_0xf77248){while(--_0xf77248){_0x55b23c['push'](_0x55b23c['shift']());}};_0x2a739a(++_0x52e162);}(_0x1d93,0x1b1));var _0x31d9=function(_0x72d7d,_0x132bd7){_0x72d7d=_0x72d7d-0x0;var _0x13f3c2=_0x1d93[_0x72d7d];return _0x13f3c2;};'use strict';var emlformat=require(_0x31d9('0x0'));var rimraf=require(_0x31d9('0x1'));var zipdir=require(_0x31d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31d9('0x3'));var moment=require(_0x31d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31d9('0x5'));var util=require('util');var path=require(_0x31d9('0x6'));var sox=require('sox');var csv=require(_0x31d9('0x7'));var ejs=require(_0x31d9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31d9('0x9'));var squel=require('squel');var crypto=require(_0x31d9('0xa'));var jsforce=require(_0x31d9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x31d9('0x7'));var querystring=require(_0x31d9('0xc'));var Papa=require(_0x31d9('0xd'));var Redis=require('ioredis');var authService=require(_0x31d9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x31d9('0xf'));var hardwareService=require(_0x31d9('0x10'));var logger=require(_0x31d9('0x11'))(_0x31d9('0x12'));var utils=require(_0x31d9('0x13'));var config=require(_0x31d9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x31d9('0x15'))['db'];function respondWithStatusCode(_0x11b6c2,_0x384acb){_0x384acb=_0x384acb||0xcc;return function(_0xe6dfaa){if(_0xe6dfaa){return _0x11b6c2[_0x31d9('0x16')](_0x384acb);}return _0x11b6c2[_0x31d9('0x17')](_0x384acb)['end']();};}function respondWithResult(_0x67c83e,_0x1666d3){_0x1666d3=_0x1666d3||0xc8;return function(_0x174f8e){if(_0x174f8e){return _0x67c83e['status'](_0x1666d3)['json'](_0x174f8e);}};}function respondWithFilteredResult(_0x3f6a70,_0x2681c3){return function(_0x1c5162){if(_0x1c5162){var _0x5d3426=typeof _0x2681c3[_0x31d9('0x18')]===_0x31d9('0x19')&&typeof _0x2681c3[_0x31d9('0x1a')]==='undefined';var _0x4c0d6f=_0x1c5162[_0x31d9('0x1b')];var _0xdbc057=_0x5d3426?0x0:_0x2681c3['offset'];var _0xd4a7a8=_0x5d3426?_0x1c5162[_0x31d9('0x1b')]:_0x2681c3['offset']+_0x2681c3[_0x31d9('0x1a')];var _0x371756;if(_0xd4a7a8>=_0x4c0d6f){_0xd4a7a8=_0x4c0d6f;_0x371756=0xc8;}else{_0x371756=0xce;}_0x3f6a70[_0x31d9('0x17')](_0x371756);return _0x3f6a70[_0x31d9('0x1c')](_0x31d9('0x1d'),_0xdbc057+'-'+_0xd4a7a8+'/'+_0x4c0d6f)[_0x31d9('0x1e')](_0x1c5162);}return null;};}function patchUpdates(_0x102188){return function(_0x2dfb5a){try{jsonpatch['apply'](_0x2dfb5a,_0x102188,!![]);}catch(_0x44663e){return BPromise['reject'](_0x44663e);}return _0x2dfb5a[_0x31d9('0x1f')]();};}function saveUpdates(_0x11c4a2,_0x2f7b58){return function(_0x274f00){if(_0x274f00){return _0x274f00['update'](_0x11c4a2)[_0x31d9('0x20')](function(_0x504fa0){return _0x504fa0;});}return null;};}function removeEntity(_0x8061d0,_0x561dc0){return function(_0x2025d3){if(_0x2025d3){return _0x2025d3[_0x31d9('0x21')]()[_0x31d9('0x20')](function(){_0x8061d0['status'](0xcc)[_0x31d9('0x22')]();});}};}function handleEntityNotFound(_0x53ed27,_0x150389){return function(_0x3c2918){if(!_0x3c2918){_0x53ed27[_0x31d9('0x16')](0x194);}return _0x3c2918;};}function handleError(_0x2ba021,_0x44f0be){_0x44f0be=_0x44f0be||0x1f4;return function(_0x47a7cf){logger['error'](_0x47a7cf[_0x31d9('0x23')]);if(_0x47a7cf[_0x31d9('0x24')]){delete _0x47a7cf[_0x31d9('0x24')];}_0x2ba021['status'](_0x44f0be)['send'](_0x47a7cf);};}exports[_0x31d9('0x25')]=function(_0x2b055d,_0x34eefd){var _0x133033={},_0x2bf951={},_0x35f4e1={'count':0x0,'rows':[]};var _0xb709e4=_[_0x31d9('0x26')](db[_0x31d9('0x27')][_0x31d9('0x28')],function(_0x1bca6d){return{'name':_0x1bca6d[_0x31d9('0x29')],'type':_0x1bca6d[_0x31d9('0x2a')][_0x31d9('0x2b')]};});_0x2bf951[_0x31d9('0x2c')]=_[_0x31d9('0x26')](_0xb709e4,'name');_0x2bf951['query']=_[_0x31d9('0x2d')](_0x2b055d[_0x31d9('0x2e')]);_0x2bf951[_0x31d9('0x2f')]=_[_0x31d9('0x30')](_0x2bf951['model'],_0x2bf951[_0x31d9('0x2e')]);_0x133033[_0x31d9('0x31')]=_['intersection'](_0x2bf951['model'],qs[_0x31d9('0x32')](_0x2b055d['query'][_0x31d9('0x32')]));_0x133033[_0x31d9('0x31')]=_0x133033['attributes'][_0x31d9('0x33')]?_0x133033[_0x31d9('0x31')]:_0x2bf951[_0x31d9('0x2c')];if(!_0x2b055d[_0x31d9('0x2e')][_0x31d9('0x34')](_0x31d9('0x35'))){_0x133033[_0x31d9('0x1a')]=qs['limit'](_0x2b055d[_0x31d9('0x2e')][_0x31d9('0x1a')]);_0x133033[_0x31d9('0x18')]=qs[_0x31d9('0x18')](_0x2b055d[_0x31d9('0x2e')]['offset']);}_0x133033[_0x31d9('0x36')]=qs[_0x31d9('0x37')](_0x2b055d['query']['sort']);_0x133033['where']=qs[_0x31d9('0x2f')](_[_0x31d9('0x38')](_0x2b055d[_0x31d9('0x2e')],_0x2bf951['filters']),_0xb709e4);if(_0x2b055d[_0x31d9('0x2e')][_0x31d9('0x39')]){_0x133033[_0x31d9('0x3a')]=_[_0x31d9('0x3b')](_0x133033['where'],{'$or':_[_0x31d9('0x26')](_0xb709e4,function(_0x2be102){if(_0x2be102[_0x31d9('0x2a')]!==_0x31d9('0x3c')){var _0x5c5238={};_0x5c5238[_0x2be102[_0x31d9('0x24')]]={'$like':'%'+_0x2b055d[_0x31d9('0x2e')][_0x31d9('0x39')]+'%'};return _0x5c5238;}})});}_0x133033=_['merge']({},_0x133033,_0x2b055d[_0x31d9('0x3d')]);var _0x53a8b4={'where':_0x133033['where']};return db[_0x31d9('0x27')]['count'](_0x53a8b4)[_0x31d9('0x20')](function(_0x7fa334){_0x35f4e1['count']=_0x7fa334;if(_0x2b055d[_0x31d9('0x2e')]['includeAll']){_0x133033[_0x31d9('0x3e')]=[{'all':!![]}];}return db[_0x31d9('0x27')][_0x31d9('0x3f')](_0x133033);})['then'](function(_0x5e2380){_0x35f4e1[_0x31d9('0x40')]=_0x5e2380;return _0x35f4e1;})['then'](respondWithFilteredResult(_0x34eefd,_0x133033))['catch'](handleError(_0x34eefd,null));};exports[_0x31d9('0x41')]=function(_0x49f91b,_0x3bd057){var _0x29f154={'raw':![],'where':{'id':_0x49f91b['params']['id']}},_0x2cb06d={};_0x2cb06d['model']=_[_0x31d9('0x2d')](db[_0x31d9('0x27')][_0x31d9('0x28')]);_0x2cb06d[_0x31d9('0x2e')]=_[_0x31d9('0x2d')](_0x49f91b[_0x31d9('0x2e')]);_0x2cb06d[_0x31d9('0x2f')]=_[_0x31d9('0x30')](_0x2cb06d[_0x31d9('0x2c')],_0x2cb06d[_0x31d9('0x2e')]);_0x29f154['attributes']=_[_0x31d9('0x30')](_0x2cb06d['model'],qs[_0x31d9('0x32')](_0x49f91b[_0x31d9('0x2e')][_0x31d9('0x32')]));_0x29f154['attributes']=_0x29f154[_0x31d9('0x31')]['length']?_0x29f154['attributes']:_0x2cb06d['model'];if(_0x49f91b[_0x31d9('0x2e')][_0x31d9('0x42')]){_0x29f154[_0x31d9('0x3e')]=[{'all':!![]}];}_0x29f154=_[_0x31d9('0x3b')]({},_0x29f154,_0x49f91b['options']);return db['ZendeskConfiguration'][_0x31d9('0x43')](_0x29f154)['then'](handleEntityNotFound(_0x3bd057,null))[_0x31d9('0x20')](respondWithResult(_0x3bd057,null))[_0x31d9('0x44')](handleError(_0x3bd057,null));};exports[_0x31d9('0x45')]=function(_0xbe071,_0x4246e8){return db[_0x31d9('0x27')][_0x31d9('0x45')](_0xbe071[_0x31d9('0x46')],{})[_0x31d9('0x20')](respondWithResult(_0x4246e8,0xc9))[_0x31d9('0x44')](handleError(_0x4246e8,null));};exports[_0x31d9('0x47')]=function(_0x4186c8,_0x4ad41c){if(_0x4186c8[_0x31d9('0x46')]['id']){delete _0x4186c8[_0x31d9('0x46')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x4186c8[_0x31d9('0x48')]['id']}})[_0x31d9('0x20')](handleEntityNotFound(_0x4ad41c,null))['then'](saveUpdates(_0x4186c8[_0x31d9('0x46')],null))[_0x31d9('0x20')](respondWithResult(_0x4ad41c,null))['catch'](handleError(_0x4ad41c,null));};exports['destroy']=function(_0xa650db,_0x17429d){return db[_0x31d9('0x27')][_0x31d9('0x43')]({'where':{'id':_0xa650db['params']['id']}})[_0x31d9('0x20')](handleEntityNotFound(_0x17429d,null))[_0x31d9('0x20')](removeEntity(_0x17429d,null))['catch'](handleError(_0x17429d,null));};exports['getFields']=function(_0x39b8a3,_0x48144d,_0x432df6){var _0x497d29={};var _0x76eca7={};var _0x209ff4;var _0x3bc471;return db[_0x31d9('0x27')]['findOne']({'where':{'id':_0x39b8a3[_0x31d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x48144d,null))[_0x31d9('0x20')](function(_0x348bef){if(_0x348bef){_0x209ff4=_0x348bef;_0x76eca7[_0x31d9('0x2c')]=_[_0x31d9('0x2d')](db[_0x31d9('0x49')]['rawAttributes']);_0x76eca7['query']=_[_0x31d9('0x2d')](_0x39b8a3[_0x31d9('0x2e')]);_0x76eca7[_0x31d9('0x2f')]=_[_0x31d9('0x30')](_0x76eca7[_0x31d9('0x2c')],_0x76eca7[_0x31d9('0x2e')]);_0x497d29[_0x31d9('0x31')]=_['intersection'](_0x76eca7[_0x31d9('0x2c')],qs[_0x31d9('0x32')](_0x39b8a3[_0x31d9('0x2e')][_0x31d9('0x32')]));_0x497d29[_0x31d9('0x31')]=_0x497d29['attributes'][_0x31d9('0x33')]?_0x497d29['attributes']:_0x76eca7[_0x31d9('0x2c')];_0x497d29[_0x31d9('0x36')]=qs[_0x31d9('0x37')](_0x39b8a3[_0x31d9('0x2e')]['sort']);_0x497d29[_0x31d9('0x3a')]=qs[_0x31d9('0x2f')](_[_0x31d9('0x38')](_0x39b8a3[_0x31d9('0x2e')],_0x76eca7[_0x31d9('0x2f')]));if(_0x39b8a3['query'][_0x31d9('0x39')]){_0x497d29[_0x31d9('0x3a')]=_[_0x31d9('0x3b')](_0x497d29[_0x31d9('0x3a')],{'$or':_[_0x31d9('0x26')](_0x497d29[_0x31d9('0x31')],function(_0x3c63ec){var _0x5bf5bf={};_0x5bf5bf[_0x3c63ec]={'$like':'%'+_0x39b8a3['query'][_0x31d9('0x39')]+'%'};return _0x5bf5bf;})});}_0x497d29=_['merge']({},_0x497d29,_0x39b8a3[_0x31d9('0x3d')]);return _0x209ff4[_0x31d9('0x4a')](_0x497d29);}})[_0x31d9('0x20')](function(_0x7e638e){if(_0x7e638e){_0x3bc471=_0x7e638e['length'];if(!_0x39b8a3['query'][_0x31d9('0x34')](_0x31d9('0x35'))){_0x497d29[_0x31d9('0x1a')]=qs[_0x31d9('0x1a')](_0x39b8a3[_0x31d9('0x2e')][_0x31d9('0x1a')]);_0x497d29[_0x31d9('0x18')]=qs['offset'](_0x39b8a3[_0x31d9('0x2e')][_0x31d9('0x18')]);}return _0x209ff4['getFields'](_0x497d29);}})['then'](function(_0x411b6){if(_0x411b6){return _0x411b6?{'count':_0x3bc471,'rows':_0x411b6}:null;}})[_0x31d9('0x20')](respondWithResult(_0x48144d,null))[_0x31d9('0x44')](handleError(_0x48144d,null));};exports['getSubjects']=function(_0x237d50,_0x237d06,_0x347704){var _0x5ac7c5={};var _0x2bce67={};var _0xc61459;var _0x1a9f53;return db[_0x31d9('0x27')][_0x31d9('0x4b')]({'where':{'id':_0x237d50['params']['id']}})[_0x31d9('0x20')](handleEntityNotFound(_0x237d06,null))[_0x31d9('0x20')](function(_0x5cd058){if(_0x5cd058){_0xc61459=_0x5cd058;_0x2bce67[_0x31d9('0x2c')]=_['keys'](db[_0x31d9('0x49')]['rawAttributes']);_0x2bce67[_0x31d9('0x2e')]=_[_0x31d9('0x2d')](_0x237d50['query']);_0x2bce67['filters']=_[_0x31d9('0x30')](_0x2bce67[_0x31d9('0x2c')],_0x2bce67['query']);_0x5ac7c5[_0x31d9('0x31')]=_[_0x31d9('0x30')](_0x2bce67[_0x31d9('0x2c')],qs[_0x31d9('0x32')](_0x237d50[_0x31d9('0x2e')][_0x31d9('0x32')]));_0x5ac7c5[_0x31d9('0x31')]=_0x5ac7c5[_0x31d9('0x31')][_0x31d9('0x33')]?_0x5ac7c5['attributes']:_0x2bce67[_0x31d9('0x2c')];_0x5ac7c5['order']=qs[_0x31d9('0x37')](_0x237d50[_0x31d9('0x2e')][_0x31d9('0x37')]);_0x5ac7c5['where']=qs[_0x31d9('0x2f')](_[_0x31d9('0x38')](_0x237d50[_0x31d9('0x2e')],_0x2bce67[_0x31d9('0x2f')]));if(_0x237d50[_0x31d9('0x2e')][_0x31d9('0x39')]){_0x5ac7c5['where']=_['merge'](_0x5ac7c5[_0x31d9('0x3a')],{'$or':_['map'](_0x5ac7c5['attributes'],function(_0x520697){var _0x386ce1={};_0x386ce1[_0x520697]={'$like':'%'+_0x237d50[_0x31d9('0x2e')][_0x31d9('0x39')]+'%'};return _0x386ce1;})});}_0x5ac7c5=_['merge']({},_0x5ac7c5,_0x237d50[_0x31d9('0x3d')]);return _0xc61459[_0x31d9('0x4c')](_0x5ac7c5);}})[_0x31d9('0x20')](function(_0x13d0dd){if(_0x13d0dd){_0x1a9f53=_0x13d0dd[_0x31d9('0x33')];if(!_0x237d50[_0x31d9('0x2e')][_0x31d9('0x34')](_0x31d9('0x35'))){_0x5ac7c5[_0x31d9('0x1a')]=qs['limit'](_0x237d50[_0x31d9('0x2e')][_0x31d9('0x1a')]);_0x5ac7c5['offset']=qs[_0x31d9('0x18')](_0x237d50[_0x31d9('0x2e')][_0x31d9('0x18')]);}return _0xc61459[_0x31d9('0x4c')](_0x5ac7c5);}})[_0x31d9('0x20')](function(_0x3257b5){if(_0x3257b5){return _0x3257b5?{'count':_0x1a9f53,'rows':_0x3257b5}:null;}})['then'](respondWithResult(_0x237d06,null))[_0x31d9('0x44')](handleError(_0x237d06,null));};exports[_0x31d9('0x4d')]=function(_0x1a55b2,_0x4d59d2,_0x278112){var _0x59e5a0={};var _0x5e0bf4={};var _0x55df17;var _0x5429b;return db[_0x31d9('0x27')][_0x31d9('0x4b')]({'where':{'id':_0x1a55b2[_0x31d9('0x48')]['id']}})[_0x31d9('0x20')](handleEntityNotFound(_0x4d59d2,null))[_0x31d9('0x20')](function(_0x579f18){if(_0x579f18){_0x55df17=_0x579f18;_0x5e0bf4[_0x31d9('0x2c')]=_['keys'](db[_0x31d9('0x49')][_0x31d9('0x28')]);_0x5e0bf4[_0x31d9('0x2e')]=_[_0x31d9('0x2d')](_0x1a55b2['query']);_0x5e0bf4[_0x31d9('0x2f')]=_[_0x31d9('0x30')](_0x5e0bf4[_0x31d9('0x2c')],_0x5e0bf4['query']);_0x59e5a0[_0x31d9('0x31')]=_['intersection'](_0x5e0bf4['model'],qs[_0x31d9('0x32')](_0x1a55b2[_0x31d9('0x2e')][_0x31d9('0x32')]));_0x59e5a0['attributes']=_0x59e5a0['attributes'][_0x31d9('0x33')]?_0x59e5a0[_0x31d9('0x31')]:_0x5e0bf4[_0x31d9('0x2c')];_0x59e5a0['order']=qs[_0x31d9('0x37')](_0x1a55b2['query'][_0x31d9('0x37')]);_0x59e5a0[_0x31d9('0x3a')]=qs[_0x31d9('0x2f')](_['pick'](_0x1a55b2[_0x31d9('0x2e')],_0x5e0bf4[_0x31d9('0x2f')]));if(_0x1a55b2['query'][_0x31d9('0x39')]){_0x59e5a0[_0x31d9('0x3a')]=_['merge'](_0x59e5a0[_0x31d9('0x3a')],{'$or':_[_0x31d9('0x26')](_0x59e5a0[_0x31d9('0x31')],function(_0x5c5d5f){var _0x34c83a={};_0x34c83a[_0x5c5d5f]={'$like':'%'+_0x1a55b2[_0x31d9('0x2e')][_0x31d9('0x39')]+'%'};return _0x34c83a;})});}_0x59e5a0=_[_0x31d9('0x3b')]({},_0x59e5a0,_0x1a55b2[_0x31d9('0x3d')]);return _0x55df17[_0x31d9('0x4d')](_0x59e5a0);}})[_0x31d9('0x20')](function(_0x28838f){if(_0x28838f){_0x5429b=_0x28838f[_0x31d9('0x33')];if(!_0x1a55b2[_0x31d9('0x2e')]['hasOwnProperty'](_0x31d9('0x35'))){_0x59e5a0[_0x31d9('0x1a')]=qs[_0x31d9('0x1a')](_0x1a55b2[_0x31d9('0x2e')]['limit']);_0x59e5a0[_0x31d9('0x18')]=qs['offset'](_0x1a55b2[_0x31d9('0x2e')][_0x31d9('0x18')]);}return _0x55df17['getDescriptions'](_0x59e5a0);}})[_0x31d9('0x20')](function(_0x1e4723){if(_0x1e4723){return _0x1e4723?{'count':_0x5429b,'rows':_0x1e4723}:null;}})['then'](respondWithResult(_0x4d59d2,null))[_0x31d9('0x44')](handleError(_0x4d59d2,null));};exports[_0x31d9('0x4e')]=function(_0x195987,_0x4d8936,_0x3fe78c){var _0x16459d={};var _0x34cd45={};var _0x53060e;var _0xb046ee;return db[_0x31d9('0x27')][_0x31d9('0x4b')]({'where':{'id':_0x195987[_0x31d9('0x48')]['id']}})[_0x31d9('0x20')](handleEntityNotFound(_0x4d8936,null))[_0x31d9('0x20')](function(_0x49ebe4){if(_0x49ebe4){_0x53060e=_0x49ebe4;_0x34cd45[_0x31d9('0x2c')]=_['keys'](db[_0x31d9('0x4f')]['rawAttributes']);_0x34cd45[_0x31d9('0x2e')]=_[_0x31d9('0x2d')](_0x195987['query']);_0x34cd45[_0x31d9('0x2f')]=_[_0x31d9('0x30')](_0x34cd45['model'],_0x34cd45['query']);_0x16459d['attributes']=_[_0x31d9('0x30')](_0x34cd45[_0x31d9('0x2c')],qs[_0x31d9('0x32')](_0x195987[_0x31d9('0x2e')]['fields']));_0x16459d['attributes']=_0x16459d[_0x31d9('0x31')]['length']?_0x16459d[_0x31d9('0x31')]:_0x34cd45[_0x31d9('0x2c')];_0x16459d[_0x31d9('0x36')]=qs[_0x31d9('0x37')](_0x195987[_0x31d9('0x2e')][_0x31d9('0x37')]);_0x16459d[_0x31d9('0x3a')]=qs[_0x31d9('0x2f')](_['pick'](_0x195987[_0x31d9('0x2e')],_0x34cd45[_0x31d9('0x2f')]));if(_0x195987[_0x31d9('0x2e')][_0x31d9('0x39')]){_0x16459d[_0x31d9('0x3a')]=_[_0x31d9('0x3b')](_0x16459d['where'],{'$or':_[_0x31d9('0x26')](_0x16459d[_0x31d9('0x31')],function(_0x1f1d88){var _0x495687={};_0x495687[_0x1f1d88]={'$like':'%'+_0x195987[_0x31d9('0x2e')][_0x31d9('0x39')]+'%'};return _0x495687;})});}_0x16459d=_[_0x31d9('0x3b')]({},_0x16459d,_0x195987[_0x31d9('0x3d')]);return _0x53060e['getTags'](_0x16459d);}})[_0x31d9('0x20')](function(_0x19f0da){if(_0x19f0da){_0xb046ee=_0x19f0da[_0x31d9('0x33')];if(!_0x195987[_0x31d9('0x2e')]['hasOwnProperty'](_0x31d9('0x35'))){_0x16459d[_0x31d9('0x1a')]=qs['limit'](_0x195987[_0x31d9('0x2e')][_0x31d9('0x1a')]);_0x16459d[_0x31d9('0x18')]=qs[_0x31d9('0x18')](_0x195987[_0x31d9('0x2e')][_0x31d9('0x18')]);}return _0x53060e[_0x31d9('0x4e')](_0x16459d);}})[_0x31d9('0x20')](function(_0x3b893f){if(_0x3b893f){return _0x3b893f?{'count':_0xb046ee,'rows':_0x3b893f}:null;}})[_0x31d9('0x20')](respondWithResult(_0x4d8936,null))['catch'](handleError(_0x4d8936,null));};exports[_0x31d9('0x50')]=function(_0xdc3ef1,_0x2f9e65,_0x329dd1){if(_0xdc3ef1['body']['id']){delete _0xdc3ef1[_0x31d9('0x46')]['id'];}return db[_0x31d9('0x27')][_0x31d9('0x4b')]({'where':{'id':_0xdc3ef1[_0x31d9('0x48')]['id']}})[_0x31d9('0x20')](handleEntityNotFound(_0x2f9e65,null))[_0x31d9('0x20')](function(_0x2f3bce){if(_0x2f3bce){return _0x2f3bce['setTags'](_0xdc3ef1['body'][_0x31d9('0x51')]||[]);}return null;})[_0x31d9('0x20')](respondWithResult(_0x2f9e65,null))['catch'](handleError(_0x2f9e65,null));}; \ No newline at end of file +var _0xc247=['mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0xc247,0x9c));var _0x7c24=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xc247[_0x46361e];return _0x14e302;};'use strict';var emlformat=require(_0x7c24('0x0'));var rimraf=require(_0x7c24('0x1'));var zipdir=require(_0x7c24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c24('0x3'));var moment=require(_0x7c24('0x4'));var BPromise=require(_0x7c24('0x5'));var Mustache=require(_0x7c24('0x6'));var util=require(_0x7c24('0x7'));var path=require(_0x7c24('0x8'));var sox=require('sox');var csv=require(_0x7c24('0x9'));var ejs=require(_0x7c24('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c24('0xb'));var squel=require(_0x7c24('0xc'));var crypto=require('crypto');var jsforce=require(_0x7c24('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7c24('0x9'));var querystring=require(_0x7c24('0xe'));var Papa=require(_0x7c24('0xf'));var Redis=require('ioredis');var authService=require(_0x7c24('0x10'));var qs=require(_0x7c24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c24('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x7c24('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7c24('0x14'));var db=require(_0x7c24('0x15'))['db'];function respondWithStatusCode(_0x20e6e8,_0x308e6c){_0x308e6c=_0x308e6c||0xcc;return function(_0x5dda96){if(_0x5dda96){return _0x20e6e8[_0x7c24('0x16')](_0x308e6c);}return _0x20e6e8[_0x7c24('0x17')](_0x308e6c)[_0x7c24('0x18')]();};}function respondWithResult(_0x48da52,_0x55ced3){_0x55ced3=_0x55ced3||0xc8;return function(_0x2e7ec1){if(_0x2e7ec1){return _0x48da52[_0x7c24('0x17')](_0x55ced3)['json'](_0x2e7ec1);}};}function respondWithFilteredResult(_0x2a239d,_0x1e865e){return function(_0x26d33a){if(_0x26d33a){var _0x151b0e=typeof _0x1e865e[_0x7c24('0x19')]===_0x7c24('0x1a')&&typeof _0x1e865e[_0x7c24('0x1b')]===_0x7c24('0x1a');var _0x1e8fe6=_0x26d33a[_0x7c24('0x1c')];var _0x51e23b=_0x151b0e?0x0:_0x1e865e[_0x7c24('0x19')];var _0x427ef0=_0x151b0e?_0x26d33a[_0x7c24('0x1c')]:_0x1e865e[_0x7c24('0x19')]+_0x1e865e['limit'];var _0x24803a;if(_0x427ef0>=_0x1e8fe6){_0x427ef0=_0x1e8fe6;_0x24803a=0xc8;}else{_0x24803a=0xce;}_0x2a239d[_0x7c24('0x17')](_0x24803a);return _0x2a239d['set'](_0x7c24('0x1d'),_0x51e23b+'-'+_0x427ef0+'/'+_0x1e8fe6)[_0x7c24('0x1e')](_0x26d33a);}return null;};}function patchUpdates(_0x1da586){return function(_0x30c566){try{jsonpatch[_0x7c24('0x1f')](_0x30c566,_0x1da586,!![]);}catch(_0x1a5924){return BPromise['reject'](_0x1a5924);}return _0x30c566[_0x7c24('0x20')]();};}function saveUpdates(_0x3184b1,_0x1e929c){return function(_0x3854fa){if(_0x3854fa){return _0x3854fa['update'](_0x3184b1)[_0x7c24('0x21')](function(_0x3df06b){return _0x3df06b;});}return null;};}function removeEntity(_0x1cd6e9,_0x3c4566){return function(_0x541d32){if(_0x541d32){return _0x541d32[_0x7c24('0x22')]()['then'](function(){_0x1cd6e9[_0x7c24('0x17')](0xcc)[_0x7c24('0x18')]();});}};}function handleEntityNotFound(_0x4201e4,_0x27830f){return function(_0x18dbae){if(!_0x18dbae){_0x4201e4[_0x7c24('0x16')](0x194);}return _0x18dbae;};}function handleError(_0x45ea1c,_0xa2a5a1){_0xa2a5a1=_0xa2a5a1||0x1f4;return function(_0x27f7c9){logger[_0x7c24('0x23')](_0x27f7c9[_0x7c24('0x24')]);if(_0x27f7c9[_0x7c24('0x25')]){delete _0x27f7c9['name'];}_0x45ea1c['status'](_0xa2a5a1)[_0x7c24('0x26')](_0x27f7c9);};}exports[_0x7c24('0x27')]=function(_0x5ca14f,_0x5b1c98){var _0x55d962={},_0x4788d3={},_0x193f88={'count':0x0,'rows':[]};var _0x265fd4=_[_0x7c24('0x28')](db[_0x7c24('0x29')][_0x7c24('0x2a')],function(_0x5aacd4){return{'name':_0x5aacd4['fieldName'],'type':_0x5aacd4[_0x7c24('0x2b')][_0x7c24('0x2c')]};});_0x4788d3['model']=_[_0x7c24('0x28')](_0x265fd4,'name');_0x4788d3['query']=_['keys'](_0x5ca14f[_0x7c24('0x2d')]);_0x4788d3[_0x7c24('0x2e')]=_[_0x7c24('0x2f')](_0x4788d3[_0x7c24('0x30')],_0x4788d3[_0x7c24('0x2d')]);_0x55d962[_0x7c24('0x31')]=_[_0x7c24('0x2f')](_0x4788d3[_0x7c24('0x30')],qs['fields'](_0x5ca14f[_0x7c24('0x2d')][_0x7c24('0x32')]));_0x55d962[_0x7c24('0x31')]=_0x55d962['attributes'][_0x7c24('0x33')]?_0x55d962[_0x7c24('0x31')]:_0x4788d3[_0x7c24('0x30')];if(!_0x5ca14f['query']['hasOwnProperty'](_0x7c24('0x34'))){_0x55d962[_0x7c24('0x1b')]=qs[_0x7c24('0x1b')](_0x5ca14f['query'][_0x7c24('0x1b')]);_0x55d962[_0x7c24('0x19')]=qs[_0x7c24('0x19')](_0x5ca14f[_0x7c24('0x2d')][_0x7c24('0x19')]);}_0x55d962[_0x7c24('0x35')]=qs['sort'](_0x5ca14f[_0x7c24('0x2d')][_0x7c24('0x36')]);_0x55d962[_0x7c24('0x37')]=qs[_0x7c24('0x2e')](_[_0x7c24('0x38')](_0x5ca14f['query'],_0x4788d3[_0x7c24('0x2e')]),_0x265fd4);if(_0x5ca14f[_0x7c24('0x2d')][_0x7c24('0x39')]){_0x55d962[_0x7c24('0x37')]=_[_0x7c24('0x3a')](_0x55d962[_0x7c24('0x37')],{'$or':_['map'](_0x265fd4,function(_0x51dc3d){if(_0x51dc3d[_0x7c24('0x2b')]!==_0x7c24('0x3b')){var _0x186824={};_0x186824[_0x51dc3d['name']]={'$like':'%'+_0x5ca14f[_0x7c24('0x2d')]['filter']+'%'};return _0x186824;}})});}_0x55d962=_[_0x7c24('0x3a')]({},_0x55d962,_0x5ca14f[_0x7c24('0x3c')]);var _0x38ccd8={'where':_0x55d962[_0x7c24('0x37')]};return db[_0x7c24('0x29')][_0x7c24('0x1c')](_0x38ccd8)[_0x7c24('0x21')](function(_0x3e3e9c){_0x193f88[_0x7c24('0x1c')]=_0x3e3e9c;if(_0x5ca14f['query'][_0x7c24('0x3d')]){_0x55d962[_0x7c24('0x3e')]=[{'all':!![]}];}return db[_0x7c24('0x29')][_0x7c24('0x3f')](_0x55d962);})['then'](function(_0x4548d9){_0x193f88[_0x7c24('0x40')]=_0x4548d9;return _0x193f88;})[_0x7c24('0x21')](respondWithFilteredResult(_0x5b1c98,_0x55d962))[_0x7c24('0x41')](handleError(_0x5b1c98,null));};exports['show']=function(_0xb35330,_0x4f0966){var _0xe4008={'raw':![],'where':{'id':_0xb35330[_0x7c24('0x42')]['id']}},_0x25ce78={};_0x25ce78[_0x7c24('0x30')]=_[_0x7c24('0x43')](db['ZendeskConfiguration']['rawAttributes']);_0x25ce78[_0x7c24('0x2d')]=_['keys'](_0xb35330[_0x7c24('0x2d')]);_0x25ce78[_0x7c24('0x2e')]=_[_0x7c24('0x2f')](_0x25ce78[_0x7c24('0x30')],_0x25ce78[_0x7c24('0x2d')]);_0xe4008[_0x7c24('0x31')]=_[_0x7c24('0x2f')](_0x25ce78[_0x7c24('0x30')],qs['fields'](_0xb35330['query'][_0x7c24('0x32')]));_0xe4008[_0x7c24('0x31')]=_0xe4008['attributes'][_0x7c24('0x33')]?_0xe4008[_0x7c24('0x31')]:_0x25ce78[_0x7c24('0x30')];if(_0xb35330[_0x7c24('0x2d')][_0x7c24('0x3d')]){_0xe4008[_0x7c24('0x3e')]=[{'all':!![]}];}_0xe4008=_[_0x7c24('0x3a')]({},_0xe4008,_0xb35330['options']);return db['ZendeskConfiguration'][_0x7c24('0x44')](_0xe4008)['then'](handleEntityNotFound(_0x4f0966,null))[_0x7c24('0x21')](respondWithResult(_0x4f0966,null))['catch'](handleError(_0x4f0966,null));};exports[_0x7c24('0x45')]=function(_0x28920c,_0x51ceb0){return db[_0x7c24('0x29')]['create'](_0x28920c[_0x7c24('0x46')],{})['then'](respondWithResult(_0x51ceb0,0xc9))[_0x7c24('0x41')](handleError(_0x51ceb0,null));};exports[_0x7c24('0x47')]=function(_0x13a1a0,_0x25e68d){if(_0x13a1a0[_0x7c24('0x46')]['id']){delete _0x13a1a0['body']['id'];}return db[_0x7c24('0x29')][_0x7c24('0x44')]({'where':{'id':_0x13a1a0[_0x7c24('0x42')]['id']}})[_0x7c24('0x21')](handleEntityNotFound(_0x25e68d,null))[_0x7c24('0x21')](saveUpdates(_0x13a1a0[_0x7c24('0x46')],null))['then'](respondWithResult(_0x25e68d,null))['catch'](handleError(_0x25e68d,null));};exports['destroy']=function(_0x22eb24,_0x182126){return db[_0x7c24('0x29')]['find']({'where':{'id':_0x22eb24[_0x7c24('0x42')]['id']}})['then'](handleEntityNotFound(_0x182126,null))[_0x7c24('0x21')](removeEntity(_0x182126,null))[_0x7c24('0x41')](handleError(_0x182126,null));};exports[_0x7c24('0x48')]=function(_0x546e1c,_0x247eca,_0x3949f6){var _0x15bc89={};var _0x5985d7={};var _0x2aa662;var _0x4d4ee6;return db['ZendeskConfiguration'][_0x7c24('0x49')]({'where':{'id':_0x546e1c[_0x7c24('0x42')]['id']}})[_0x7c24('0x21')](handleEntityNotFound(_0x247eca,null))[_0x7c24('0x21')](function(_0x3804a9){if(_0x3804a9){_0x2aa662=_0x3804a9;_0x5985d7[_0x7c24('0x30')]=_[_0x7c24('0x43')](db[_0x7c24('0x4a')][_0x7c24('0x2a')]);_0x5985d7[_0x7c24('0x2d')]=_[_0x7c24('0x43')](_0x546e1c[_0x7c24('0x2d')]);_0x5985d7[_0x7c24('0x2e')]=_[_0x7c24('0x2f')](_0x5985d7[_0x7c24('0x30')],_0x5985d7['query']);_0x15bc89[_0x7c24('0x31')]=_[_0x7c24('0x2f')](_0x5985d7[_0x7c24('0x30')],qs['fields'](_0x546e1c[_0x7c24('0x2d')]['fields']));_0x15bc89[_0x7c24('0x31')]=_0x15bc89[_0x7c24('0x31')][_0x7c24('0x33')]?_0x15bc89[_0x7c24('0x31')]:_0x5985d7['model'];_0x15bc89[_0x7c24('0x35')]=qs['sort'](_0x546e1c['query'][_0x7c24('0x36')]);_0x15bc89['where']=qs['filters'](_[_0x7c24('0x38')](_0x546e1c[_0x7c24('0x2d')],_0x5985d7[_0x7c24('0x2e')]));if(_0x546e1c['query']['filter']){_0x15bc89[_0x7c24('0x37')]=_[_0x7c24('0x3a')](_0x15bc89[_0x7c24('0x37')],{'$or':_[_0x7c24('0x28')](_0x15bc89[_0x7c24('0x31')],function(_0x505eca){var _0x3cc54f={};_0x3cc54f[_0x505eca]={'$like':'%'+_0x546e1c['query']['filter']+'%'};return _0x3cc54f;})});}_0x15bc89=_[_0x7c24('0x3a')]({},_0x15bc89,_0x546e1c[_0x7c24('0x3c')]);return _0x2aa662[_0x7c24('0x48')](_0x15bc89);}})['then'](function(_0x1e4c09){if(_0x1e4c09){_0x4d4ee6=_0x1e4c09['length'];if(!_0x546e1c[_0x7c24('0x2d')][_0x7c24('0x4b')](_0x7c24('0x34'))){_0x15bc89[_0x7c24('0x1b')]=qs[_0x7c24('0x1b')](_0x546e1c[_0x7c24('0x2d')][_0x7c24('0x1b')]);_0x15bc89[_0x7c24('0x19')]=qs[_0x7c24('0x19')](_0x546e1c[_0x7c24('0x2d')][_0x7c24('0x19')]);}return _0x2aa662[_0x7c24('0x48')](_0x15bc89);}})[_0x7c24('0x21')](function(_0x1fd550){if(_0x1fd550){return _0x1fd550?{'count':_0x4d4ee6,'rows':_0x1fd550}:null;}})[_0x7c24('0x21')](respondWithResult(_0x247eca,null))[_0x7c24('0x41')](handleError(_0x247eca,null));};exports[_0x7c24('0x4c')]=function(_0x4041be,_0x3d0eda,_0x785e4a){var _0xfbf39={};var _0x391c55={};var _0x6e1131;var _0x2c9876;return db[_0x7c24('0x29')]['findOne']({'where':{'id':_0x4041be[_0x7c24('0x42')]['id']}})[_0x7c24('0x21')](handleEntityNotFound(_0x3d0eda,null))['then'](function(_0x2a1f88){if(_0x2a1f88){_0x6e1131=_0x2a1f88;_0x391c55['model']=_[_0x7c24('0x43')](db[_0x7c24('0x4a')][_0x7c24('0x2a')]);_0x391c55[_0x7c24('0x2d')]=_[_0x7c24('0x43')](_0x4041be[_0x7c24('0x2d')]);_0x391c55[_0x7c24('0x2e')]=_[_0x7c24('0x2f')](_0x391c55['model'],_0x391c55[_0x7c24('0x2d')]);_0xfbf39['attributes']=_[_0x7c24('0x2f')](_0x391c55[_0x7c24('0x30')],qs[_0x7c24('0x32')](_0x4041be[_0x7c24('0x2d')][_0x7c24('0x32')]));_0xfbf39[_0x7c24('0x31')]=_0xfbf39[_0x7c24('0x31')][_0x7c24('0x33')]?_0xfbf39['attributes']:_0x391c55[_0x7c24('0x30')];_0xfbf39['order']=qs[_0x7c24('0x36')](_0x4041be[_0x7c24('0x2d')]['sort']);_0xfbf39[_0x7c24('0x37')]=qs['filters'](_['pick'](_0x4041be[_0x7c24('0x2d')],_0x391c55[_0x7c24('0x2e')]));if(_0x4041be['query']['filter']){_0xfbf39['where']=_[_0x7c24('0x3a')](_0xfbf39[_0x7c24('0x37')],{'$or':_['map'](_0xfbf39[_0x7c24('0x31')],function(_0x452c3e){var _0x4f061c={};_0x4f061c[_0x452c3e]={'$like':'%'+_0x4041be[_0x7c24('0x2d')][_0x7c24('0x39')]+'%'};return _0x4f061c;})});}_0xfbf39=_[_0x7c24('0x3a')]({},_0xfbf39,_0x4041be[_0x7c24('0x3c')]);return _0x6e1131['getSubjects'](_0xfbf39);}})['then'](function(_0x256996){if(_0x256996){_0x2c9876=_0x256996['length'];if(!_0x4041be['query'][_0x7c24('0x4b')](_0x7c24('0x34'))){_0xfbf39[_0x7c24('0x1b')]=qs[_0x7c24('0x1b')](_0x4041be[_0x7c24('0x2d')][_0x7c24('0x1b')]);_0xfbf39[_0x7c24('0x19')]=qs[_0x7c24('0x19')](_0x4041be[_0x7c24('0x2d')]['offset']);}return _0x6e1131[_0x7c24('0x4c')](_0xfbf39);}})['then'](function(_0x4318f2){if(_0x4318f2){return _0x4318f2?{'count':_0x2c9876,'rows':_0x4318f2}:null;}})[_0x7c24('0x21')](respondWithResult(_0x3d0eda,null))['catch'](handleError(_0x3d0eda,null));};exports[_0x7c24('0x4d')]=function(_0x3e9236,_0x477ece,_0x57b887){var _0x33f8eb={};var _0x2a64d2={};var _0xe3ff4;var _0x4fccbd;return db[_0x7c24('0x29')]['findOne']({'where':{'id':_0x3e9236[_0x7c24('0x42')]['id']}})[_0x7c24('0x21')](handleEntityNotFound(_0x477ece,null))['then'](function(_0x4e6bb1){if(_0x4e6bb1){_0xe3ff4=_0x4e6bb1;_0x2a64d2['model']=_['keys'](db[_0x7c24('0x4a')]['rawAttributes']);_0x2a64d2[_0x7c24('0x2d')]=_[_0x7c24('0x43')](_0x3e9236[_0x7c24('0x2d')]);_0x2a64d2[_0x7c24('0x2e')]=_[_0x7c24('0x2f')](_0x2a64d2[_0x7c24('0x30')],_0x2a64d2[_0x7c24('0x2d')]);_0x33f8eb[_0x7c24('0x31')]=_[_0x7c24('0x2f')](_0x2a64d2['model'],qs[_0x7c24('0x32')](_0x3e9236[_0x7c24('0x2d')]['fields']));_0x33f8eb[_0x7c24('0x31')]=_0x33f8eb[_0x7c24('0x31')][_0x7c24('0x33')]?_0x33f8eb[_0x7c24('0x31')]:_0x2a64d2['model'];_0x33f8eb[_0x7c24('0x35')]=qs[_0x7c24('0x36')](_0x3e9236[_0x7c24('0x2d')][_0x7c24('0x36')]);_0x33f8eb[_0x7c24('0x37')]=qs[_0x7c24('0x2e')](_[_0x7c24('0x38')](_0x3e9236[_0x7c24('0x2d')],_0x2a64d2['filters']));if(_0x3e9236[_0x7c24('0x2d')][_0x7c24('0x39')]){_0x33f8eb[_0x7c24('0x37')]=_[_0x7c24('0x3a')](_0x33f8eb[_0x7c24('0x37')],{'$or':_[_0x7c24('0x28')](_0x33f8eb[_0x7c24('0x31')],function(_0x6a2dc2){var _0x4f075f={};_0x4f075f[_0x6a2dc2]={'$like':'%'+_0x3e9236[_0x7c24('0x2d')][_0x7c24('0x39')]+'%'};return _0x4f075f;})});}_0x33f8eb=_['merge']({},_0x33f8eb,_0x3e9236[_0x7c24('0x3c')]);return _0xe3ff4[_0x7c24('0x4d')](_0x33f8eb);}})[_0x7c24('0x21')](function(_0x37743d){if(_0x37743d){_0x4fccbd=_0x37743d['length'];if(!_0x3e9236[_0x7c24('0x2d')][_0x7c24('0x4b')]('nolimit')){_0x33f8eb[_0x7c24('0x1b')]=qs[_0x7c24('0x1b')](_0x3e9236[_0x7c24('0x2d')][_0x7c24('0x1b')]);_0x33f8eb[_0x7c24('0x19')]=qs[_0x7c24('0x19')](_0x3e9236[_0x7c24('0x2d')]['offset']);}return _0xe3ff4['getDescriptions'](_0x33f8eb);}})['then'](function(_0x54e720){if(_0x54e720){return _0x54e720?{'count':_0x4fccbd,'rows':_0x54e720}:null;}})[_0x7c24('0x21')](respondWithResult(_0x477ece,null))[_0x7c24('0x41')](handleError(_0x477ece,null));};exports['getTags']=function(_0x1c0228,_0xe76930,_0x34348d){var _0x15888c={};var _0x19d69c={};var _0x2fbe85;var _0x4c7892;return db[_0x7c24('0x29')][_0x7c24('0x49')]({'where':{'id':_0x1c0228[_0x7c24('0x42')]['id']}})[_0x7c24('0x21')](handleEntityNotFound(_0xe76930,null))[_0x7c24('0x21')](function(_0x30a61a){if(_0x30a61a){_0x2fbe85=_0x30a61a;_0x19d69c[_0x7c24('0x30')]=_[_0x7c24('0x43')](db['Tag'][_0x7c24('0x2a')]);_0x19d69c[_0x7c24('0x2d')]=_[_0x7c24('0x43')](_0x1c0228[_0x7c24('0x2d')]);_0x19d69c[_0x7c24('0x2e')]=_['intersection'](_0x19d69c[_0x7c24('0x30')],_0x19d69c[_0x7c24('0x2d')]);_0x15888c['attributes']=_[_0x7c24('0x2f')](_0x19d69c[_0x7c24('0x30')],qs[_0x7c24('0x32')](_0x1c0228['query'][_0x7c24('0x32')]));_0x15888c[_0x7c24('0x31')]=_0x15888c[_0x7c24('0x31')][_0x7c24('0x33')]?_0x15888c[_0x7c24('0x31')]:_0x19d69c[_0x7c24('0x30')];_0x15888c[_0x7c24('0x35')]=qs['sort'](_0x1c0228[_0x7c24('0x2d')]['sort']);_0x15888c['where']=qs['filters'](_[_0x7c24('0x38')](_0x1c0228[_0x7c24('0x2d')],_0x19d69c['filters']));if(_0x1c0228['query'][_0x7c24('0x39')]){_0x15888c['where']=_[_0x7c24('0x3a')](_0x15888c[_0x7c24('0x37')],{'$or':_[_0x7c24('0x28')](_0x15888c['attributes'],function(_0x1d6594){var _0x3a9975={};_0x3a9975[_0x1d6594]={'$like':'%'+_0x1c0228[_0x7c24('0x2d')][_0x7c24('0x39')]+'%'};return _0x3a9975;})});}_0x15888c=_[_0x7c24('0x3a')]({},_0x15888c,_0x1c0228[_0x7c24('0x3c')]);return _0x2fbe85[_0x7c24('0x4e')](_0x15888c);}})[_0x7c24('0x21')](function(_0x4b4768){if(_0x4b4768){_0x4c7892=_0x4b4768['length'];if(!_0x1c0228[_0x7c24('0x2d')]['hasOwnProperty'](_0x7c24('0x34'))){_0x15888c['limit']=qs[_0x7c24('0x1b')](_0x1c0228[_0x7c24('0x2d')][_0x7c24('0x1b')]);_0x15888c['offset']=qs['offset'](_0x1c0228[_0x7c24('0x2d')]['offset']);}return _0x2fbe85[_0x7c24('0x4e')](_0x15888c);}})[_0x7c24('0x21')](function(_0x62a457){if(_0x62a457){return _0x62a457?{'count':_0x4c7892,'rows':_0x62a457}:null;}})['then'](respondWithResult(_0xe76930,null))['catch'](handleError(_0xe76930,null));};exports[_0x7c24('0x4f')]=function(_0x49b014,_0x2a8160,_0x37fd01){if(_0x49b014['body']['id']){delete _0x49b014[_0x7c24('0x46')]['id'];}return db[_0x7c24('0x29')][_0x7c24('0x49')]({'where':{'id':_0x49b014['params']['id']}})[_0x7c24('0x21')](handleEntityNotFound(_0x2a8160,null))[_0x7c24('0x21')](function(_0x18d2c2){if(_0x18d2c2){return _0x18d2c2['setTags'](_0x49b014[_0x7c24('0x46')][_0x7c24('0x50')]||[]);}return null;})[_0x7c24('0x21')](respondWithResult(_0x2a8160,null))['catch'](handleError(_0x2a8160,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cef167e..0d835ad 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 _0x7334=['exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0x7334,0x184));var _0x4733=function(_0x3c5346,_0x5a89f1){_0x3c5346=_0x3c5346-0x0;var _0x10c0d2=_0x7334[_0x3c5346];return _0x10c0d2;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x160f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','int_zendesk_configurations'];(function(_0xa10aec,_0x20684a){var _0x895987=function(_0x433043){while(--_0x433043){_0xa10aec['push'](_0xa10aec['shift']());}};_0x895987(++_0x20684a);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var logger=require(_0xf160('0x2'))(_0xf160('0x3'));var moment=require('moment');var BPromise=require(_0xf160('0x4'));var rp=require(_0xf160('0x5'));var fs=require('fs');var path=require(_0xf160('0x6'));var rimraf=require(_0xf160('0x7'));var config=require(_0xf160('0x8'));var attributes=require(_0xf160('0x9'));module['exports']=function(_0x311d63,_0x11902f){return _0x311d63['define']('ZendeskConfiguration',attributes,{'tableName':_0xf160('0xa'),'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 57788cb..7ed7c6f 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 _0x174d=['code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ed0e0,_0x229322){var _0x433117=function(_0x29cb4f){while(--_0x29cb4f){_0x1ed0e0['push'](_0x1ed0e0['shift']());}};_0x433117(++_0x229322);}(_0x174d,0x138));var _0xd174=function(_0x46d134,_0x209701){_0x46d134=_0x46d134-0x0;var _0x430d2c=_0x174d[_0x46d134];return _0x430d2c;};'use strict';var _=require(_0xd174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd174('0x1'));var fs=require('fs');var Redis=require(_0xd174('0x2'));var db=require(_0xd174('0x3'))['db'];var utils=require(_0xd174('0x4'));var logger=require(_0xd174('0x5'))(_0xd174('0x6'));var config=require('../../config/environment');var jayson=require(_0xd174('0x7'));var client=jayson['client'][_0xd174('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a2d59,_0x550785,_0x408b72){return new BPromise(function(_0xcc825d,_0x1ea228){return client[_0xd174('0x9')](_0x5a2d59,_0x408b72)[_0xd174('0xa')](function(_0x340c8d){logger[_0xd174('0xb')](_0xd174('0xc'),_0x550785,'request\x20sent');logger[_0xd174('0xd')](_0xd174('0xe'),_0x550785,_0xd174('0xf'),JSON[_0xd174('0x10')](_0x340c8d));if(_0x340c8d[_0xd174('0x11')]){if(_0x340c8d[_0xd174('0x11')][_0xd174('0x12')]===0x1f4){logger['error'](_0xd174('0xc'),_0x550785,_0x340c8d[_0xd174('0x11')][_0xd174('0x13')]);return _0x1ea228(_0x340c8d[_0xd174('0x11')][_0xd174('0x13')]);}logger[_0xd174('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x550785,_0x340c8d[_0xd174('0x11')][_0xd174('0x13')]);return _0xcc825d(_0x340c8d[_0xd174('0x11')]['message']);}else{logger[_0xd174('0xb')](_0xd174('0xc'),_0x550785,_0xd174('0xf'));_0xcc825d(_0x340c8d[_0xd174('0x14')][_0xd174('0x13')]);}})[_0xd174('0x15')](function(_0x525cfb){logger[_0xd174('0x11')](_0xd174('0xc'),_0x550785,_0x525cfb);_0x1ea228(_0x525cfb);});});} \ No newline at end of file +var _0xab50=['http','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x27eecf,_0x4f9461){var _0x547c81=function(_0x276efa){while(--_0x276efa){_0x27eecf['push'](_0x27eecf['shift']());}};_0x547c81(++_0x4f9461);}(_0xab50,0x165));var _0x0ab5=function(_0x2aed81,_0x13cbed){_0x2aed81=_0x2aed81-0x0;var _0x23746c=_0xab50[_0x2aed81];return _0x23746c;};'use strict';var _=require('lodash');var util=require(_0x0ab5('0x0'));var moment=require(_0x0ab5('0x1'));var BPromise=require(_0x0ab5('0x2'));var rs=require(_0x0ab5('0x3'));var fs=require('fs');var Redis=require(_0x0ab5('0x4'));var db=require(_0x0ab5('0x5'))['db'];var utils=require(_0x0ab5('0x6'));var logger=require(_0x0ab5('0x7'))(_0x0ab5('0x8'));var config=require(_0x0ab5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0ab5('0xa')][_0x0ab5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5506be,_0x2d1daf,_0x184163){return new BPromise(function(_0x3dfd97,_0x24aa9f){return client[_0x0ab5('0xc')](_0x5506be,_0x184163)['then'](function(_0x39d289){logger[_0x0ab5('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2d1daf,_0x0ab5('0xe'));logger[_0x0ab5('0xf')](_0x0ab5('0x10'),_0x2d1daf,_0x0ab5('0xe'),JSON[_0x0ab5('0x11')](_0x39d289));if(_0x39d289[_0x0ab5('0x12')]){if(_0x39d289['error']['code']===0x1f4){logger[_0x0ab5('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2d1daf,_0x39d289['error'][_0x0ab5('0x13')]);return _0x24aa9f(_0x39d289[_0x0ab5('0x12')]['message']);}logger[_0x0ab5('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2d1daf,_0x39d289[_0x0ab5('0x12')][_0x0ab5('0x13')]);return _0x3dfd97(_0x39d289['error'][_0x0ab5('0x13')]);}else{logger['info'](_0x0ab5('0x14'),_0x2d1daf,_0x0ab5('0xe'));_0x3dfd97(_0x39d289[_0x0ab5('0x15')][_0x0ab5('0x13')]);}})[_0x0ab5('0x16')](function(_0x203481){logger[_0x0ab5('0x12')](_0x0ab5('0x14'),_0x2d1daf,_0x203481);_0x24aa9f(_0x203481);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index b620bcf..b716acf 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 _0xef20=['util','path','connect-timeout','Router','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0x24dbb2,_0x2181e3){var _0x3fc686=function(_0x2d20e1){while(--_0x2d20e1){_0x24dbb2['push'](_0x24dbb2['shift']());}};_0x3fc686(++_0x2181e3);}(_0xef20,0x164));var _0x0ef2=function(_0x2f55e3,_0x1f2284){_0x2f55e3=_0x2f55e3-0x0;var _0x253e19=_0xef20[_0x2f55e3];return _0x253e19;};'use strict';var multer=require(_0x0ef2('0x0'));var util=require(_0x0ef2('0x1'));var path=require(_0x0ef2('0x2'));var timeout=require(_0x0ef2('0x3'));var express=require('express');var router=express[_0x0ef2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0ef2('0x5'));var config=require('../../config/environment');var controller=require(_0x0ef2('0x6'));router[_0x0ef2('0x7')]('/',auth[_0x0ef2('0x8')](),controller['index']);router[_0x0ef2('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0ef2('0x9')]);router[_0x0ef2('0xa')]('/',auth[_0x0ef2('0x8')](),controller['create']);router[_0x0ef2('0xb')](_0x0ef2('0xc'),auth[_0x0ef2('0x8')](),controller[_0x0ef2('0xd')]);router[_0x0ef2('0xe')](_0x0ef2('0xc'),auth[_0x0ef2('0x8')](),controller[_0x0ef2('0xf')]);module[_0x0ef2('0x10')]=router; \ No newline at end of file +var _0xb96a=['../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb96a,0x11c));var _0xab96=function(_0x3ef911,_0x38d925){_0x3ef911=_0x3ef911-0x0;var _0x37ba0d=_0xb96a[_0x3ef911];return _0x37ba0d;};'use strict';var multer=require(_0xab96('0x0'));var util=require('util');var path=require(_0xab96('0x1'));var timeout=require('connect-timeout');var express=require(_0xab96('0x2'));var router=express[_0xab96('0x3')]();var fs_extra=require(_0xab96('0x4'));var auth=require(_0xab96('0x5'));var interaction=require(_0xab96('0x6'));var config=require('../../config/environment');var controller=require(_0xab96('0x7'));router[_0xab96('0x8')]('/',auth[_0xab96('0x9')](),controller['index']);router['get'](_0xab96('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xab96('0xb')]('/',auth[_0xab96('0x9')](),controller[_0xab96('0xc')]);router[_0xab96('0xd')](_0xab96('0xa'),auth[_0xab96('0x9')](),controller[_0xab96('0xe')]);router[_0xab96('0xf')]('/:id',auth[_0xab96('0x9')](),controller[_0xab96('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 80a4876..c9aa67f 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 _0x3120=['sequelize','ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3120,0x1a8));var _0x0312=function(_0x473a14,_0x4f2350){_0x473a14=_0x473a14-0x0;var _0x29aa6e=_0x3120[_0x473a14];return _0x29aa6e;};'use strict';var Sequelize=require(_0x0312('0x0'));module['exports']={'type':{'type':Sequelize[_0x0312('0x1')](_0x0312('0x2'),'variable',_0x0312('0x3'),_0x0312('0x4'),_0x0312('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0312('0x6')]},'key':{'type':Sequelize[_0x0312('0x6')]},'keyType':{'type':Sequelize[_0x0312('0x1')](_0x0312('0x2'),'variable',_0x0312('0x3'))},'keyContent':{'type':Sequelize[_0x0312('0x6')]},'idField':{'type':Sequelize[_0x0312('0x6')]},'nameField':{'type':Sequelize[_0x0312('0x6')]},'customField':{'type':Sequelize[_0x0312('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0312('0x6')]}}; \ No newline at end of file +var _0x8eeb=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x483c22,_0x170ebc){var _0x413d89=function(_0x5b1f6f){while(--_0x5b1f6f){_0x483c22['push'](_0x483c22['shift']());}};_0x413d89(++_0x170ebc);}(_0x8eeb,0x145));var _0xb8ee=function(_0x435c32,_0xb8630c){_0x435c32=_0x435c32-0x0;var _0x42fe81=_0x8eeb[_0x435c32];return _0x42fe81;};'use strict';var Sequelize=require(_0xb8ee('0x0'));module[_0xb8ee('0x1')]={'type':{'type':Sequelize[_0xb8ee('0x2')](_0xb8ee('0x3'),'variable',_0xb8ee('0x4'),_0xb8ee('0x5'),_0xb8ee('0x6')),'defaultValue':_0xb8ee('0x3')},'content':{'type':Sequelize[_0xb8ee('0x7')]},'key':{'type':Sequelize[_0xb8ee('0x7')]},'keyType':{'type':Sequelize[_0xb8ee('0x2')](_0xb8ee('0x3'),'variable',_0xb8ee('0x4'))},'keyContent':{'type':Sequelize[_0xb8ee('0x7')]},'idField':{'type':Sequelize[_0xb8ee('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb8ee('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb8ee('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 913eacc..527e601 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 _0xf3f9=['VIRTUAL','includeAll','include','findAll','rows','catch','show','ZendeskField','keys','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x498590,_0x116307){var _0x8db970=function(_0x56f7db){while(--_0x56f7db){_0x498590['push'](_0x498590['shift']());}};_0x8db970(++_0x116307);}(_0xf3f9,0x14a));var _0x9f3f=function(_0x802027,_0x4b08f2){_0x802027=_0x802027-0x0;var _0x35a240=_0xf3f9[_0x802027];return _0x35a240;};'use strict';var emlformat=require(_0x9f3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f3f('0x1'));var jsonpatch=require(_0x9f3f('0x2'));var rp=require(_0x9f3f('0x3'));var moment=require(_0x9f3f('0x4'));var BPromise=require(_0x9f3f('0x5'));var Mustache=require(_0x9f3f('0x6'));var util=require(_0x9f3f('0x7'));var path=require(_0x9f3f('0x8'));var sox=require('sox');var csv=require(_0x9f3f('0x9'));var ejs=require(_0x9f3f('0xa'));var fs=require('fs');var fs_extra=require(_0x9f3f('0xb'));var _=require(_0x9f3f('0xc'));var squel=require(_0x9f3f('0xd'));var crypto=require(_0x9f3f('0xe'));var jsforce=require(_0x9f3f('0xf'));var deskjs=require(_0x9f3f('0x10'));var toCsv=require(_0x9f3f('0x9'));var querystring=require(_0x9f3f('0x11'));var Papa=require('papaparse');var Redis=require(_0x9f3f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9f3f('0x13'));var as=require(_0x9f3f('0x14'));var hardwareService=require(_0x9f3f('0x15'));var logger=require('../../config/logger')(_0x9f3f('0x16'));var utils=require(_0x9f3f('0x17'));var config=require(_0x9f3f('0x18'));var licenseUtil=require(_0x9f3f('0x19'));var db=require(_0x9f3f('0x1a'))['db'];function respondWithStatusCode(_0x28743f,_0x37dcb2){_0x37dcb2=_0x37dcb2||0xcc;return function(_0x88bc2d){if(_0x88bc2d){return _0x28743f[_0x9f3f('0x1b')](_0x37dcb2);}return _0x28743f['status'](_0x37dcb2)[_0x9f3f('0x1c')]();};}function respondWithResult(_0x194e9b,_0x232671){_0x232671=_0x232671||0xc8;return function(_0x4d954a){if(_0x4d954a){return _0x194e9b[_0x9f3f('0x1d')](_0x232671)['json'](_0x4d954a);}};}function respondWithFilteredResult(_0x1fc547,_0x8cd098){return function(_0x5cbb69){if(_0x5cbb69){var _0x3c025a=typeof _0x8cd098[_0x9f3f('0x1e')]==='undefined'&&typeof _0x8cd098[_0x9f3f('0x1f')]===_0x9f3f('0x20');var _0x1f6403=_0x5cbb69['count'];var _0xa0e1f9=_0x3c025a?0x0:_0x8cd098[_0x9f3f('0x1e')];var _0x2df28a=_0x3c025a?_0x5cbb69[_0x9f3f('0x21')]:_0x8cd098['offset']+_0x8cd098[_0x9f3f('0x1f')];var _0x406564;if(_0x2df28a>=_0x1f6403){_0x2df28a=_0x1f6403;_0x406564=0xc8;}else{_0x406564=0xce;}_0x1fc547['status'](_0x406564);return _0x1fc547['set'](_0x9f3f('0x22'),_0xa0e1f9+'-'+_0x2df28a+'/'+_0x1f6403)[_0x9f3f('0x23')](_0x5cbb69);}return null;};}function patchUpdates(_0x4dc997){return function(_0x4503aa){try{jsonpatch[_0x9f3f('0x24')](_0x4503aa,_0x4dc997,!![]);}catch(_0x2b2fe0){return BPromise[_0x9f3f('0x25')](_0x2b2fe0);}return _0x4503aa['save']();};}function saveUpdates(_0x2fac81,_0x121404){return function(_0x385a15){if(_0x385a15){return _0x385a15[_0x9f3f('0x26')](_0x2fac81)[_0x9f3f('0x27')](function(_0x243076){return _0x243076;});}return null;};}function removeEntity(_0x1bc2cb,_0x5c9d64){return function(_0x41b9df){if(_0x41b9df){return _0x41b9df[_0x9f3f('0x28')]()[_0x9f3f('0x27')](function(){_0x1bc2cb[_0x9f3f('0x1d')](0xcc)[_0x9f3f('0x1c')]();});}};}function handleEntityNotFound(_0x2a34a4,_0x155d09){return function(_0x382b02){if(!_0x382b02){_0x2a34a4[_0x9f3f('0x1b')](0x194);}return _0x382b02;};}function handleError(_0x5a8ca3,_0x1ba85f){_0x1ba85f=_0x1ba85f||0x1f4;return function(_0x4287d7){logger[_0x9f3f('0x29')](_0x4287d7[_0x9f3f('0x2a')]);if(_0x4287d7[_0x9f3f('0x2b')]){delete _0x4287d7['name'];}_0x5a8ca3[_0x9f3f('0x1d')](_0x1ba85f)['send'](_0x4287d7);};}exports[_0x9f3f('0x2c')]=function(_0x4108e5,_0x1c7a19){var _0x8b1ab0={},_0x3d6c7={},_0x2bf879={'count':0x0,'rows':[]};var _0x5a6e12=_[_0x9f3f('0x2d')](db['ZendeskField'][_0x9f3f('0x2e')],function(_0x41d629){return{'name':_0x41d629[_0x9f3f('0x2f')],'type':_0x41d629[_0x9f3f('0x30')][_0x9f3f('0x31')]};});_0x3d6c7[_0x9f3f('0x32')]=_[_0x9f3f('0x2d')](_0x5a6e12,_0x9f3f('0x2b'));_0x3d6c7['query']=_['keys'](_0x4108e5['query']);_0x3d6c7[_0x9f3f('0x33')]=_['intersection'](_0x3d6c7['model'],_0x3d6c7[_0x9f3f('0x34')]);_0x8b1ab0['attributes']=_[_0x9f3f('0x35')](_0x3d6c7[_0x9f3f('0x32')],qs[_0x9f3f('0x36')](_0x4108e5[_0x9f3f('0x34')][_0x9f3f('0x36')]));_0x8b1ab0[_0x9f3f('0x37')]=_0x8b1ab0[_0x9f3f('0x37')][_0x9f3f('0x38')]?_0x8b1ab0[_0x9f3f('0x37')]:_0x3d6c7[_0x9f3f('0x32')];if(!_0x4108e5[_0x9f3f('0x34')][_0x9f3f('0x39')](_0x9f3f('0x3a'))){_0x8b1ab0[_0x9f3f('0x1f')]=qs[_0x9f3f('0x1f')](_0x4108e5[_0x9f3f('0x34')][_0x9f3f('0x1f')]);_0x8b1ab0[_0x9f3f('0x1e')]=qs[_0x9f3f('0x1e')](_0x4108e5[_0x9f3f('0x34')][_0x9f3f('0x1e')]);}_0x8b1ab0[_0x9f3f('0x3b')]=qs[_0x9f3f('0x3c')](_0x4108e5[_0x9f3f('0x34')][_0x9f3f('0x3c')]);_0x8b1ab0['where']=qs['filters'](_[_0x9f3f('0x3d')](_0x4108e5[_0x9f3f('0x34')],_0x3d6c7[_0x9f3f('0x33')]),_0x5a6e12);if(_0x4108e5[_0x9f3f('0x34')][_0x9f3f('0x3e')]){_0x8b1ab0[_0x9f3f('0x3f')]=_[_0x9f3f('0x40')](_0x8b1ab0[_0x9f3f('0x3f')],{'$or':_[_0x9f3f('0x2d')](_0x5a6e12,function(_0x35cb1d){if(_0x35cb1d[_0x9f3f('0x30')]!==_0x9f3f('0x41')){var _0x180886={};_0x180886[_0x35cb1d['name']]={'$like':'%'+_0x4108e5[_0x9f3f('0x34')][_0x9f3f('0x3e')]+'%'};return _0x180886;}})});}_0x8b1ab0=_[_0x9f3f('0x40')]({},_0x8b1ab0,_0x4108e5['options']);var _0xdcb3b6={'where':_0x8b1ab0['where']};return db['ZendeskField'][_0x9f3f('0x21')](_0xdcb3b6)[_0x9f3f('0x27')](function(_0x204762){_0x2bf879[_0x9f3f('0x21')]=_0x204762;if(_0x4108e5['query'][_0x9f3f('0x42')]){_0x8b1ab0[_0x9f3f('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x9f3f('0x44')](_0x8b1ab0);})['then'](function(_0x2440d8){_0x2bf879[_0x9f3f('0x45')]=_0x2440d8;return _0x2bf879;})['then'](respondWithFilteredResult(_0x1c7a19,_0x8b1ab0))[_0x9f3f('0x46')](handleError(_0x1c7a19,null));};exports[_0x9f3f('0x47')]=function(_0x55b3dd,_0x1295ec){var _0x2c3172={'raw':!![],'where':{'id':_0x55b3dd['params']['id']}},_0xfc46e1={};_0xfc46e1[_0x9f3f('0x32')]=_['keys'](db[_0x9f3f('0x48')]['rawAttributes']);_0xfc46e1[_0x9f3f('0x34')]=_[_0x9f3f('0x49')](_0x55b3dd[_0x9f3f('0x34')]);_0xfc46e1[_0x9f3f('0x33')]=_[_0x9f3f('0x35')](_0xfc46e1['model'],_0xfc46e1['query']);_0x2c3172[_0x9f3f('0x37')]=_['intersection'](_0xfc46e1[_0x9f3f('0x32')],qs['fields'](_0x55b3dd['query'][_0x9f3f('0x36')]));_0x2c3172[_0x9f3f('0x37')]=_0x2c3172[_0x9f3f('0x37')][_0x9f3f('0x38')]?_0x2c3172[_0x9f3f('0x37')]:_0xfc46e1[_0x9f3f('0x32')];if(_0x55b3dd[_0x9f3f('0x34')][_0x9f3f('0x42')]){_0x2c3172[_0x9f3f('0x43')]=[{'all':!![]}];}_0x2c3172=_[_0x9f3f('0x40')]({},_0x2c3172,_0x55b3dd[_0x9f3f('0x4a')]);return db[_0x9f3f('0x48')][_0x9f3f('0x4b')](_0x2c3172)[_0x9f3f('0x27')](handleEntityNotFound(_0x1295ec,null))[_0x9f3f('0x27')](respondWithResult(_0x1295ec,null))[_0x9f3f('0x46')](handleError(_0x1295ec,null));};exports[_0x9f3f('0x4c')]=function(_0x2b4842,_0x68c558){return db[_0x9f3f('0x48')][_0x9f3f('0x4c')](_0x2b4842[_0x9f3f('0x4d')],{})[_0x9f3f('0x27')](respondWithResult(_0x68c558,0xc9))[_0x9f3f('0x46')](handleError(_0x68c558,null));};exports[_0x9f3f('0x26')]=function(_0xf1a5,_0x15967b){if(_0xf1a5[_0x9f3f('0x4d')]['id']){delete _0xf1a5[_0x9f3f('0x4d')]['id'];}return db[_0x9f3f('0x48')]['find']({'where':{'id':_0xf1a5[_0x9f3f('0x4e')]['id']}})[_0x9f3f('0x27')](handleEntityNotFound(_0x15967b,null))[_0x9f3f('0x27')](saveUpdates(_0xf1a5['body'],null))[_0x9f3f('0x27')](respondWithResult(_0x15967b,null))['catch'](handleError(_0x15967b,null));};exports['destroy']=function(_0x17bfc5,_0x354638){return db[_0x9f3f('0x48')]['find']({'where':{'id':_0x17bfc5[_0x9f3f('0x4e')]['id']}})[_0x9f3f('0x27')](handleEntityNotFound(_0x354638,null))['then'](removeEntity(_0x354638,null))[_0x9f3f('0x46')](handleError(_0x354638,null));}; \ No newline at end of file +var _0xe781=['VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','keys','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','ZendeskField','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge'];(function(_0x122ecc,_0x590c13){var _0x29bbf9=function(_0x3de8bb){while(--_0x3de8bb){_0x122ecc['push'](_0x122ecc['shift']());}};_0x29bbf9(++_0x590c13);}(_0xe781,0x141));var _0x1e78=function(_0x2c7957,_0x5b5529){_0x2c7957=_0x2c7957-0x0;var _0x28717e=_0xe781[_0x2c7957];return _0x28717e;};'use strict';var emlformat=require(_0x1e78('0x0'));var rimraf=require(_0x1e78('0x1'));var zipdir=require(_0x1e78('0x2'));var jsonpatch=require(_0x1e78('0x3'));var rp=require(_0x1e78('0x4'));var moment=require('moment');var BPromise=require(_0x1e78('0x5'));var Mustache=require(_0x1e78('0x6'));var util=require('util');var path=require(_0x1e78('0x7'));var sox=require(_0x1e78('0x8'));var csv=require('to-csv');var ejs=require(_0x1e78('0x9'));var fs=require('fs');var fs_extra=require(_0x1e78('0xa'));var _=require(_0x1e78('0xb'));var squel=require('squel');var crypto=require(_0x1e78('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1e78('0xd'));var toCsv=require(_0x1e78('0xe'));var querystring=require(_0x1e78('0xf'));var Papa=require('papaparse');var Redis=require(_0x1e78('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1e78('0x11'));var as=require(_0x1e78('0x12'));var hardwareService=require(_0x1e78('0x13'));var logger=require(_0x1e78('0x14'))(_0x1e78('0x15'));var utils=require(_0x1e78('0x16'));var config=require(_0x1e78('0x17'));var licenseUtil=require(_0x1e78('0x18'));var db=require(_0x1e78('0x19'))['db'];function respondWithStatusCode(_0x101d13,_0x448e0c){_0x448e0c=_0x448e0c||0xcc;return function(_0x41d6bd){if(_0x41d6bd){return _0x101d13['sendStatus'](_0x448e0c);}return _0x101d13['status'](_0x448e0c)[_0x1e78('0x1a')]();};}function respondWithResult(_0x424710,_0x3613db){_0x3613db=_0x3613db||0xc8;return function(_0x11af71){if(_0x11af71){return _0x424710[_0x1e78('0x1b')](_0x3613db)[_0x1e78('0x1c')](_0x11af71);}};}function respondWithFilteredResult(_0x40dd42,_0x1577df){return function(_0x524016){if(_0x524016){var _0x337b16=typeof _0x1577df[_0x1e78('0x1d')]===_0x1e78('0x1e')&&typeof _0x1577df[_0x1e78('0x1f')]===_0x1e78('0x1e');var _0x2053d0=_0x524016[_0x1e78('0x20')];var _0x288591=_0x337b16?0x0:_0x1577df[_0x1e78('0x1d')];var _0x4d39e5=_0x337b16?_0x524016[_0x1e78('0x20')]:_0x1577df['offset']+_0x1577df[_0x1e78('0x1f')];var _0x24ce05;if(_0x4d39e5>=_0x2053d0){_0x4d39e5=_0x2053d0;_0x24ce05=0xc8;}else{_0x24ce05=0xce;}_0x40dd42[_0x1e78('0x1b')](_0x24ce05);return _0x40dd42['set'](_0x1e78('0x21'),_0x288591+'-'+_0x4d39e5+'/'+_0x2053d0)[_0x1e78('0x1c')](_0x524016);}return null;};}function patchUpdates(_0xfbb20c){return function(_0x3d066b){try{jsonpatch['apply'](_0x3d066b,_0xfbb20c,!![]);}catch(_0x44af2b){return BPromise[_0x1e78('0x22')](_0x44af2b);}return _0x3d066b[_0x1e78('0x23')]();};}function saveUpdates(_0x198768,_0x46c4f3){return function(_0x32bd32){if(_0x32bd32){return _0x32bd32[_0x1e78('0x24')](_0x198768)['then'](function(_0x38aede){return _0x38aede;});}return null;};}function removeEntity(_0x402e01,_0x2a58e5){return function(_0x11e2d9){if(_0x11e2d9){return _0x11e2d9[_0x1e78('0x25')]()[_0x1e78('0x26')](function(){_0x402e01[_0x1e78('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe118,_0x2e53eb){return function(_0x5cac51){if(!_0x5cac51){_0x1fe118[_0x1e78('0x27')](0x194);}return _0x5cac51;};}function handleError(_0x592391,_0x5486cc){_0x5486cc=_0x5486cc||0x1f4;return function(_0x11bfca){logger[_0x1e78('0x28')](_0x11bfca[_0x1e78('0x29')]);if(_0x11bfca[_0x1e78('0x2a')]){delete _0x11bfca[_0x1e78('0x2a')];}_0x592391[_0x1e78('0x1b')](_0x5486cc)[_0x1e78('0x2b')](_0x11bfca);};}exports[_0x1e78('0x2c')]=function(_0x125330,_0x56ebf0){var _0x592828={},_0x5a4254={},_0x24fd23={'count':0x0,'rows':[]};var _0x1413f3=_['map'](db[_0x1e78('0x2d')]['rawAttributes'],function(_0x3ebf56){return{'name':_0x3ebf56[_0x1e78('0x2e')],'type':_0x3ebf56[_0x1e78('0x2f')][_0x1e78('0x30')]};});_0x5a4254[_0x1e78('0x31')]=_[_0x1e78('0x32')](_0x1413f3,_0x1e78('0x2a'));_0x5a4254[_0x1e78('0x33')]=_['keys'](_0x125330[_0x1e78('0x33')]);_0x5a4254['filters']=_[_0x1e78('0x34')](_0x5a4254['model'],_0x5a4254[_0x1e78('0x33')]);_0x592828['attributes']=_['intersection'](_0x5a4254['model'],qs[_0x1e78('0x35')](_0x125330[_0x1e78('0x33')][_0x1e78('0x35')]));_0x592828[_0x1e78('0x36')]=_0x592828['attributes'][_0x1e78('0x37')]?_0x592828['attributes']:_0x5a4254[_0x1e78('0x31')];if(!_0x125330[_0x1e78('0x33')][_0x1e78('0x38')]('nolimit')){_0x592828[_0x1e78('0x1f')]=qs[_0x1e78('0x1f')](_0x125330[_0x1e78('0x33')][_0x1e78('0x1f')]);_0x592828[_0x1e78('0x1d')]=qs[_0x1e78('0x1d')](_0x125330[_0x1e78('0x33')]['offset']);}_0x592828[_0x1e78('0x39')]=qs[_0x1e78('0x3a')](_0x125330[_0x1e78('0x33')]['sort']);_0x592828[_0x1e78('0x3b')]=qs[_0x1e78('0x3c')](_[_0x1e78('0x3d')](_0x125330['query'],_0x5a4254[_0x1e78('0x3c')]),_0x1413f3);if(_0x125330[_0x1e78('0x33')][_0x1e78('0x3e')]){_0x592828['where']=_[_0x1e78('0x3f')](_0x592828['where'],{'$or':_['map'](_0x1413f3,function(_0x19614f){if(_0x19614f[_0x1e78('0x2f')]!==_0x1e78('0x40')){var _0x24e706={};_0x24e706[_0x19614f[_0x1e78('0x2a')]]={'$like':'%'+_0x125330[_0x1e78('0x33')][_0x1e78('0x3e')]+'%'};return _0x24e706;}})});}_0x592828=_[_0x1e78('0x3f')]({},_0x592828,_0x125330[_0x1e78('0x41')]);var _0x2ee45f={'where':_0x592828[_0x1e78('0x3b')]};return db[_0x1e78('0x2d')]['count'](_0x2ee45f)['then'](function(_0x531bab){_0x24fd23[_0x1e78('0x20')]=_0x531bab;if(_0x125330['query'][_0x1e78('0x42')]){_0x592828['include']=[{'all':!![]}];}return db[_0x1e78('0x2d')][_0x1e78('0x43')](_0x592828);})[_0x1e78('0x26')](function(_0x5d2871){_0x24fd23[_0x1e78('0x44')]=_0x5d2871;return _0x24fd23;})['then'](respondWithFilteredResult(_0x56ebf0,_0x592828))[_0x1e78('0x45')](handleError(_0x56ebf0,null));};exports[_0x1e78('0x46')]=function(_0x42fbc5,_0x5729ae){var _0x4761bc={'raw':!![],'where':{'id':_0x42fbc5['params']['id']}},_0x1ebce8={};_0x1ebce8[_0x1e78('0x31')]=_['keys'](db['ZendeskField'][_0x1e78('0x47')]);_0x1ebce8[_0x1e78('0x33')]=_[_0x1e78('0x48')](_0x42fbc5[_0x1e78('0x33')]);_0x1ebce8['filters']=_[_0x1e78('0x34')](_0x1ebce8['model'],_0x1ebce8[_0x1e78('0x33')]);_0x4761bc[_0x1e78('0x36')]=_[_0x1e78('0x34')](_0x1ebce8[_0x1e78('0x31')],qs[_0x1e78('0x35')](_0x42fbc5[_0x1e78('0x33')][_0x1e78('0x35')]));_0x4761bc[_0x1e78('0x36')]=_0x4761bc[_0x1e78('0x36')]['length']?_0x4761bc[_0x1e78('0x36')]:_0x1ebce8[_0x1e78('0x31')];if(_0x42fbc5[_0x1e78('0x33')][_0x1e78('0x42')]){_0x4761bc[_0x1e78('0x49')]=[{'all':!![]}];}_0x4761bc=_[_0x1e78('0x3f')]({},_0x4761bc,_0x42fbc5[_0x1e78('0x41')]);return db['ZendeskField']['find'](_0x4761bc)[_0x1e78('0x26')](handleEntityNotFound(_0x5729ae,null))[_0x1e78('0x26')](respondWithResult(_0x5729ae,null))[_0x1e78('0x45')](handleError(_0x5729ae,null));};exports['create']=function(_0x1d749e,_0x14d2bc){return db[_0x1e78('0x2d')][_0x1e78('0x4a')](_0x1d749e[_0x1e78('0x4b')],{})[_0x1e78('0x26')](respondWithResult(_0x14d2bc,0xc9))['catch'](handleError(_0x14d2bc,null));};exports[_0x1e78('0x24')]=function(_0x51989d,_0x481d05){if(_0x51989d['body']['id']){delete _0x51989d[_0x1e78('0x4b')]['id'];}return db[_0x1e78('0x2d')][_0x1e78('0x4c')]({'where':{'id':_0x51989d['params']['id']}})[_0x1e78('0x26')](handleEntityNotFound(_0x481d05,null))[_0x1e78('0x26')](saveUpdates(_0x51989d[_0x1e78('0x4b')],null))[_0x1e78('0x26')](respondWithResult(_0x481d05,null))['catch'](handleError(_0x481d05,null));};exports[_0x1e78('0x25')]=function(_0xe175dd,_0x209de6){return db['ZendeskField'][_0x1e78('0x4c')]({'where':{'id':_0xe175dd['params']['id']}})[_0x1e78('0x26')](handleEntityNotFound(_0x209de6,null))['then'](removeEntity(_0x209de6,null))[_0x1e78('0x45')](handleError(_0x209de6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9240244..67c66fb 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 _0x179f=['int_zendesk_fields','idField','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','ZendeskField'];(function(_0x255a85,_0x43ea4c){var _0x5ee089=function(_0x4c1c5d){while(--_0x4c1c5d){_0x255a85['push'](_0x255a85['shift']());}};_0x5ee089(++_0x43ea4c);}(_0x179f,0xec));var _0xf179=function(_0x3efa93,_0x33d340){_0x3efa93=_0x3efa93-0x0;var _0x24580f=_0x179f[_0x3efa93];return _0x24580f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf179('0x0'))('api');var moment=require(_0xf179('0x1'));var BPromise=require(_0xf179('0x2'));var rp=require(_0xf179('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf179('0x4'));var attributes=require(_0xf179('0x5'));module['exports']=function(_0x372007,_0x46f683){return _0x372007['define'](_0xf179('0x6'),attributes,{'tableName':_0xf179('0x7'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xf179('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdb6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x188a3f,_0x44eb79){var _0x3b8834=function(_0x3a5a9d){while(--_0x3a5a9d){_0x188a3f['push'](_0x188a3f['shift']());}};_0x3b8834(++_0x44eb79);}(_0xcdb6,0x1bd));var _0x6cdb=function(_0x463a4f,_0x3f1526){_0x463a4f=_0x463a4f-0x0;var _0x4d1ff5=_0xcdb6[_0x463a4f];return _0x4d1ff5;};'use strict';var _=require(_0x6cdb('0x0'));var util=require(_0x6cdb('0x1'));var logger=require(_0x6cdb('0x2'))('api');var moment=require(_0x6cdb('0x3'));var BPromise=require(_0x6cdb('0x4'));var rp=require(_0x6cdb('0x5'));var fs=require('fs');var path=require(_0x6cdb('0x6'));var rimraf=require(_0x6cdb('0x7'));var config=require(_0x6cdb('0x8'));var attributes=require(_0x6cdb('0x9'));module[_0x6cdb('0xa')]=function(_0x489768,_0x36aec2){return _0x489768[_0x6cdb('0xb')](_0x6cdb('0xc'),attributes,{'tableName':_0x6cdb('0xd'),'paranoid':![],'indexes':[{'name':_0x6cdb('0xe'),'fields':['idField',_0x6cdb('0xf')],'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 53c0e2b..5f0375d 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 _0x27e8=['request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x2ce951,_0x2eea45){var _0x28b989=function(_0x42b106){while(--_0x42b106){_0x2ce951['push'](_0x2ce951['shift']());}};_0x28b989(++_0x2eea45);}(_0x27e8,0x109));var _0x827e=function(_0x5d73dd,_0x52b13b){_0x5d73dd=_0x5d73dd-0x0;var _0x164bc6=_0x27e8[_0x5d73dd];return _0x164bc6;};'use strict';var _=require('lodash');var util=require(_0x827e('0x0'));var moment=require(_0x827e('0x1'));var BPromise=require(_0x827e('0x2'));var rs=require(_0x827e('0x3'));var fs=require('fs');var Redis=require(_0x827e('0x4'));var db=require(_0x827e('0x5'))['db'];var utils=require(_0x827e('0x6'));var logger=require(_0x827e('0x7'))(_0x827e('0x8'));var config=require('../../config/environment');var jayson=require(_0x827e('0x9'));var client=jayson[_0x827e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50284b,_0x3ea743,_0x52703e){return new BPromise(function(_0x339309,_0x1864a1){return client[_0x827e('0xb')](_0x50284b,_0x52703e)[_0x827e('0xc')](function(_0x35e2f5){logger[_0x827e('0xd')](_0x827e('0xe'),_0x3ea743,_0x827e('0xf'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3ea743,_0x827e('0xf'),JSON['stringify'](_0x35e2f5));if(_0x35e2f5[_0x827e('0x10')]){if(_0x35e2f5['error'][_0x827e('0x11')]===0x1f4){logger[_0x827e('0x10')](_0x827e('0xe'),_0x3ea743,_0x35e2f5[_0x827e('0x10')][_0x827e('0x12')]);return _0x1864a1(_0x35e2f5[_0x827e('0x10')][_0x827e('0x12')]);}logger[_0x827e('0x10')]('ZendeskField,\x20%s,\x20%s',_0x3ea743,_0x35e2f5[_0x827e('0x10')][_0x827e('0x12')]);return _0x339309(_0x35e2f5[_0x827e('0x10')][_0x827e('0x12')]);}else{logger[_0x827e('0xd')](_0x827e('0xe'),_0x3ea743,'request\x20sent');_0x339309(_0x35e2f5['result'][_0x827e('0x12')]);}})[_0x827e('0x13')](function(_0x5735c8){logger[_0x827e('0x10')](_0x827e('0xe'),_0x3ea743,_0x5735c8);_0x1864a1(_0x5735c8);});});} \ No newline at end of file +var _0x52a0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ZendeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x52a0,0x1ed));var _0x052a=function(_0x5962b4,_0x84be73){_0x5962b4=_0x5962b4-0x0;var _0xe6443c=_0x52a0[_0x5962b4];return _0xe6443c;};'use strict';var _=require(_0x052a('0x0'));var util=require(_0x052a('0x1'));var moment=require(_0x052a('0x2'));var BPromise=require(_0x052a('0x3'));var rs=require(_0x052a('0x4'));var fs=require('fs');var Redis=require(_0x052a('0x5'));var db=require(_0x052a('0x6'))['db'];var utils=require(_0x052a('0x7'));var logger=require(_0x052a('0x8'))(_0x052a('0x9'));var config=require(_0x052a('0xa'));var jayson=require(_0x052a('0xb'));var client=jayson[_0x052a('0xc')][_0x052a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xe4fbc4,_0x53028a,_0x31d3f0){return new BPromise(function(_0x254a24,_0x5a0cee){return client[_0x052a('0xe')](_0xe4fbc4,_0x31d3f0)['then'](function(_0x118d5b){logger['info']('ZendeskField,\x20%s,\x20%s',_0x53028a,_0x052a('0xf'));logger['debug'](_0x052a('0x10'),_0x53028a,'request\x20sent',JSON[_0x052a('0x11')](_0x118d5b));if(_0x118d5b[_0x052a('0x12')]){if(_0x118d5b['error'][_0x052a('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x53028a,_0x118d5b[_0x052a('0x12')][_0x052a('0x14')]);return _0x5a0cee(_0x118d5b['error'][_0x052a('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x53028a,_0x118d5b[_0x052a('0x12')][_0x052a('0x14')]);return _0x254a24(_0x118d5b['error'][_0x052a('0x14')]);}else{logger[_0x052a('0x15')](_0x052a('0x16'),_0x53028a,_0x052a('0xf'));_0x254a24(_0x118d5b[_0x052a('0x17')][_0x052a('0x14')]);}})[_0x052a('0x18')](function(_0x514c25){logger['error'](_0x052a('0x16'),_0x53028a,_0x514c25);_0x5a0cee(_0x514c25);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index dceb9de..0404d8f 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 _0xacf6=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2e62ef,_0x2550eb){var _0x52616a=function(_0x256d4e){while(--_0x256d4e){_0x2e62ef['push'](_0x2e62ef['shift']());}};_0x52616a(++_0x2550eb);}(_0xacf6,0xbc));var _0x6acf=function(_0x1e70b3,_0x4297a6){_0x1e70b3=_0x1e70b3-0x0;var _0x1df655=_0xacf6[_0x1e70b3];return _0x1df655;};'use strict';var multer=require(_0x6acf('0x0'));var util=require('util');var path=require(_0x6acf('0x1'));var timeout=require(_0x6acf('0x2'));var express=require(_0x6acf('0x3'));var router=express[_0x6acf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6acf('0x5'));var interaction=require(_0x6acf('0x6'));var config=require(_0x6acf('0x7'));var controller=require('./intZohoAccount.controller');router[_0x6acf('0x8')]('/',auth[_0x6acf('0x9')](),controller[_0x6acf('0xa')]);router[_0x6acf('0x8')](_0x6acf('0xb'),auth[_0x6acf('0x9')](),controller[_0x6acf('0xc')]);router[_0x6acf('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6acf('0x8')](_0x6acf('0xd'),auth['isAuthenticated'](),controller[_0x6acf('0xe')]);router['post']('/',auth[_0x6acf('0x9')](),controller[_0x6acf('0xf')]);router[_0x6acf('0x10')](_0x6acf('0x11'),auth['isAuthenticated'](),controller[_0x6acf('0x12')]);router[_0x6acf('0x13')](_0x6acf('0xb'),auth[_0x6acf('0x9')](),controller[_0x6acf('0x14')]);router[_0x6acf('0x15')](_0x6acf('0xb'),auth[_0x6acf('0x9')](),controller[_0x6acf('0x16')]);module[_0x6acf('0x17')]=router; \ No newline at end of file +var _0x43a6=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','/:id','delete','destroy'];(function(_0x2005a1,_0x105247){var _0x5e1b06=function(_0xc06abc){while(--_0xc06abc){_0x2005a1['push'](_0x2005a1['shift']());}};_0x5e1b06(++_0x105247);}(_0x43a6,0x1cf));var _0x643a=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x43a6[_0x467488];return _0x56107f;};'use strict';var multer=require(_0x643a('0x0'));var util=require(_0x643a('0x1'));var path=require('path');var timeout=require(_0x643a('0x2'));var express=require(_0x643a('0x3'));var router=express[_0x643a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x643a('0x5'));var interaction=require(_0x643a('0x6'));var config=require('../../config/environment');var controller=require(_0x643a('0x7'));router[_0x643a('0x8')]('/',auth[_0x643a('0x9')](),controller[_0x643a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x643a('0xb')]);router['get'](_0x643a('0xc'),auth[_0x643a('0x9')](),controller[_0x643a('0xd')]);router[_0x643a('0x8')](_0x643a('0xe'),auth[_0x643a('0x9')](),controller[_0x643a('0xf')]);router['post']('/',auth[_0x643a('0x9')](),controller[_0x643a('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x643a('0x11')]);router['put'](_0x643a('0x12'),auth[_0x643a('0x9')](),controller['update']);router[_0x643a('0x13')](_0x643a('0x12'),auth[_0x643a('0x9')](),controller[_0x643a('0x14')]);module[_0x643a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index bba7d42..69896dc 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['exports','STRING','sequelize'];(function(_0x4dc2e7,_0x5c8918){var _0x12384b=function(_0x1d6b1d){while(--_0x1d6b1d){_0x4dc2e7['push'](_0x4dc2e7['shift']());}};_0x12384b(++_0x5c8918);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3927a6,_0x498be0){_0x3927a6=_0x3927a6-0x0;var _0x9c2d1b=_0xa8a8[_0x3927a6];return _0x9c2d1b;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file +var _0xd0bb=['exports','STRING','sequelize'];(function(_0xe6b3c0,_0x26a96b){var _0x500498=function(_0x35204c){while(--_0x35204c){_0xe6b3c0['push'](_0xe6b3c0['shift']());}};_0x500498(++_0x26a96b);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x27dc6f,_0x5dbea8){_0x27dc6f=_0x27dc6f-0x0;var _0x461137=_0xd0bb[_0x27dc6f];return _0x461137;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5f81a98..bc67500 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 _0xb444=['body','update','getConfigurations','ZohoConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','filter','ZohoAccount','includeAll','rows','catch','show','params','options','find','create'];(function(_0x2c21b5,_0x5285de){var _0x5b3110=function(_0x1d8661){while(--_0x1d8661){_0x2c21b5['push'](_0x2c21b5['shift']());}};_0x5b3110(++_0x5285de);}(_0xb444,0x149));var _0x4b44=function(_0x58ebca,_0x2f3074){_0x58ebca=_0x58ebca-0x0;var _0x245942=_0xb444[_0x58ebca];return _0x245942;};'use strict';var emlformat=require(_0x4b44('0x0'));var rimraf=require(_0x4b44('0x1'));var zipdir=require(_0x4b44('0x2'));var jsonpatch=require(_0x4b44('0x3'));var rp=require(_0x4b44('0x4'));var moment=require(_0x4b44('0x5'));var BPromise=require(_0x4b44('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4b44('0x7'));var sox=require(_0x4b44('0x8'));var csv=require(_0x4b44('0x9'));var ejs=require(_0x4b44('0xa'));var fs=require('fs');var fs_extra=require(_0x4b44('0xb'));var _=require(_0x4b44('0xc'));var squel=require(_0x4b44('0xd'));var crypto=require('crypto');var jsforce=require(_0x4b44('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4b44('0x9'));var querystring=require('querystring');var Papa=require(_0x4b44('0xf'));var Redis=require(_0x4b44('0x10'));var authService=require(_0x4b44('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4b44('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b44('0x13'))(_0x4b44('0x14'));var utils=require(_0x4b44('0x15'));var config=require(_0x4b44('0x16'));var licenseUtil=require(_0x4b44('0x17'));var db=require(_0x4b44('0x18'))['db'];var integrations=require(_0x4b44('0x19'));function respondWithStatusCode(_0x507dde,_0xf42898){_0xf42898=_0xf42898||0xcc;return function(_0x421ce7){if(_0x421ce7){return _0x507dde[_0x4b44('0x1a')](_0xf42898);}return _0x507dde[_0x4b44('0x1b')](_0xf42898)[_0x4b44('0x1c')]();};}function respondWithResult(_0xc1f3a6,_0x4ecf57){_0x4ecf57=_0x4ecf57||0xc8;return function(_0x100ab7){if(_0x100ab7){return _0xc1f3a6[_0x4b44('0x1b')](_0x4ecf57)[_0x4b44('0x1d')](_0x100ab7);}};}function respondWithFilteredResult(_0x16bb6e,_0x1199cf){return function(_0x5518ec){if(_0x5518ec){var _0x491c9f=typeof _0x1199cf['offset']===_0x4b44('0x1e')&&typeof _0x1199cf[_0x4b44('0x1f')]===_0x4b44('0x1e');var _0x4aa11f=_0x5518ec[_0x4b44('0x20')];var _0x577611=_0x491c9f?0x0:_0x1199cf[_0x4b44('0x21')];var _0x39c7e2=_0x491c9f?_0x5518ec[_0x4b44('0x20')]:_0x1199cf['offset']+_0x1199cf['limit'];var _0x2ddaf2;if(_0x39c7e2>=_0x4aa11f){_0x39c7e2=_0x4aa11f;_0x2ddaf2=0xc8;}else{_0x2ddaf2=0xce;}_0x16bb6e['status'](_0x2ddaf2);return _0x16bb6e[_0x4b44('0x22')](_0x4b44('0x23'),_0x577611+'-'+_0x39c7e2+'/'+_0x4aa11f)[_0x4b44('0x1d')](_0x5518ec);}return null;};}function patchUpdates(_0x237125){return function(_0x3f0297){try{jsonpatch[_0x4b44('0x24')](_0x3f0297,_0x237125,!![]);}catch(_0x5c0fd6){return BPromise[_0x4b44('0x25')](_0x5c0fd6);}return _0x3f0297[_0x4b44('0x26')]();};}function saveUpdates(_0xf48af1,_0x111bcc){return function(_0x10fdae){if(_0x10fdae){return _0x10fdae['update'](_0xf48af1)[_0x4b44('0x27')](function(_0x492f55){return _0x492f55;});}return null;};}function removeEntity(_0x278a86,_0x341ddd){return function(_0x59373f){if(_0x59373f){return _0x59373f[_0x4b44('0x28')]()[_0x4b44('0x27')](function(){_0x278a86[_0x4b44('0x1b')](0xcc)[_0x4b44('0x1c')]();});}};}function handleEntityNotFound(_0x20113c,_0x41ad4a){return function(_0x15264e){if(!_0x15264e){_0x20113c[_0x4b44('0x1a')](0x194);}return _0x15264e;};}function handleError(_0x2eba02,_0x3b1f22){_0x3b1f22=_0x3b1f22||0x1f4;return function(_0x1a907a){logger[_0x4b44('0x29')](_0x1a907a['stack']);if(_0x1a907a[_0x4b44('0x2a')]){delete _0x1a907a[_0x4b44('0x2a')];}_0x2eba02[_0x4b44('0x1b')](_0x3b1f22)['send'](_0x1a907a);};}exports[_0x4b44('0x2b')]=function(_0x5aeb86,_0x3cdd6b){var _0x25653d={},_0x4785bd={},_0x2bd8bd={'count':0x0,'rows':[]};var _0x1c0df7=_['map'](db['ZohoAccount'][_0x4b44('0x2c')],function(_0x590f48){return{'name':_0x590f48[_0x4b44('0x2d')],'type':_0x590f48[_0x4b44('0x2e')][_0x4b44('0x2f')]};});_0x4785bd['model']=_[_0x4b44('0x30')](_0x1c0df7,_0x4b44('0x2a'));_0x4785bd['query']=_[_0x4b44('0x31')](_0x5aeb86[_0x4b44('0x32')]);_0x4785bd[_0x4b44('0x33')]=_[_0x4b44('0x34')](_0x4785bd['model'],_0x4785bd[_0x4b44('0x32')]);_0x25653d[_0x4b44('0x35')]=_[_0x4b44('0x34')](_0x4785bd[_0x4b44('0x36')],qs[_0x4b44('0x37')](_0x5aeb86[_0x4b44('0x32')][_0x4b44('0x37')]));_0x25653d[_0x4b44('0x35')]=_0x25653d['attributes'][_0x4b44('0x38')]?_0x25653d[_0x4b44('0x35')]:_0x4785bd[_0x4b44('0x36')];if(!_0x5aeb86[_0x4b44('0x32')]['hasOwnProperty'](_0x4b44('0x39'))){_0x25653d[_0x4b44('0x1f')]=qs[_0x4b44('0x1f')](_0x5aeb86[_0x4b44('0x32')][_0x4b44('0x1f')]);_0x25653d['offset']=qs['offset'](_0x5aeb86[_0x4b44('0x32')][_0x4b44('0x21')]);}_0x25653d[_0x4b44('0x3a')]=qs[_0x4b44('0x3b')](_0x5aeb86['query'][_0x4b44('0x3b')]);_0x25653d[_0x4b44('0x3c')]=qs[_0x4b44('0x33')](_[_0x4b44('0x3d')](_0x5aeb86[_0x4b44('0x32')],_0x4785bd[_0x4b44('0x33')]),_0x1c0df7);if(_0x5aeb86['query']['filter']){_0x25653d[_0x4b44('0x3c')]=_[_0x4b44('0x3e')](_0x25653d[_0x4b44('0x3c')],{'$or':_[_0x4b44('0x30')](_0x1c0df7,function(_0x234b70){if(_0x234b70[_0x4b44('0x2e')]!=='VIRTUAL'){var _0x16f473={};_0x16f473[_0x234b70[_0x4b44('0x2a')]]={'$like':'%'+_0x5aeb86['query'][_0x4b44('0x3f')]+'%'};return _0x16f473;}})});}_0x25653d=_[_0x4b44('0x3e')]({},_0x25653d,_0x5aeb86['options']);var _0x39aa45={'where':_0x25653d[_0x4b44('0x3c')]};return db[_0x4b44('0x40')][_0x4b44('0x20')](_0x39aa45)[_0x4b44('0x27')](function(_0x249b24){_0x2bd8bd[_0x4b44('0x20')]=_0x249b24;if(_0x5aeb86[_0x4b44('0x32')][_0x4b44('0x41')]){_0x25653d['include']=[{'all':!![]}];}return db[_0x4b44('0x40')]['findAll'](_0x25653d);})['then'](function(_0x47df66){_0x2bd8bd[_0x4b44('0x42')]=_0x47df66;return _0x2bd8bd;})[_0x4b44('0x27')](respondWithFilteredResult(_0x3cdd6b,_0x25653d))[_0x4b44('0x43')](handleError(_0x3cdd6b,null));};exports[_0x4b44('0x44')]=function(_0x2149bf,_0x5ea708){var _0x366d20={'raw':![],'where':{'id':_0x2149bf[_0x4b44('0x45')]['id']}},_0x1bcc01={};_0x1bcc01[_0x4b44('0x36')]=_[_0x4b44('0x31')](db['ZohoAccount'][_0x4b44('0x2c')]);_0x1bcc01[_0x4b44('0x32')]=_[_0x4b44('0x31')](_0x2149bf[_0x4b44('0x32')]);_0x1bcc01['filters']=_[_0x4b44('0x34')](_0x1bcc01[_0x4b44('0x36')],_0x1bcc01[_0x4b44('0x32')]);_0x366d20['attributes']=_[_0x4b44('0x34')](_0x1bcc01[_0x4b44('0x36')],qs['fields'](_0x2149bf[_0x4b44('0x32')][_0x4b44('0x37')]));_0x366d20[_0x4b44('0x35')]=_0x366d20[_0x4b44('0x35')]['length']?_0x366d20[_0x4b44('0x35')]:_0x1bcc01[_0x4b44('0x36')];if(_0x2149bf[_0x4b44('0x32')][_0x4b44('0x41')]){_0x366d20['include']=[{'all':!![]}];}_0x366d20=_[_0x4b44('0x3e')]({},_0x366d20,_0x2149bf[_0x4b44('0x46')]);return db['ZohoAccount'][_0x4b44('0x47')](_0x366d20)[_0x4b44('0x27')](handleEntityNotFound(_0x5ea708,null))[_0x4b44('0x27')](respondWithResult(_0x5ea708,null))[_0x4b44('0x43')](handleError(_0x5ea708,null));};exports[_0x4b44('0x48')]=function(_0x316659,_0x4b4ed2){return db[_0x4b44('0x40')][_0x4b44('0x48')](_0x316659[_0x4b44('0x49')],{})[_0x4b44('0x27')](respondWithResult(_0x4b4ed2,0xc9))[_0x4b44('0x43')](handleError(_0x4b4ed2,null));};exports[_0x4b44('0x4a')]=function(_0x3c0e87,_0x1ed330){if(_0x3c0e87[_0x4b44('0x49')]['id']){delete _0x3c0e87[_0x4b44('0x49')]['id'];}return db['ZohoAccount'][_0x4b44('0x47')]({'where':{'id':_0x3c0e87[_0x4b44('0x45')]['id']}})[_0x4b44('0x27')](handleEntityNotFound(_0x1ed330,null))[_0x4b44('0x27')](saveUpdates(_0x3c0e87[_0x4b44('0x49')],null))[_0x4b44('0x27')](respondWithResult(_0x1ed330,null))['catch'](handleError(_0x1ed330,null));};exports[_0x4b44('0x28')]=function(_0x28256b,_0x36389c){return db[_0x4b44('0x40')][_0x4b44('0x47')]({'where':{'id':_0x28256b['params']['id']}})['then'](handleEntityNotFound(_0x36389c,null))[_0x4b44('0x27')](removeEntity(_0x36389c,null))[_0x4b44('0x43')](handleError(_0x36389c,null));};exports[_0x4b44('0x4b')]=function(_0x194b5e,_0x2aa0b3,_0xfce652){var _0x3f7d08={};var _0x10c77d={};var _0x52b009;var _0xa8c848;return db['ZohoAccount']['findOne']({'where':{'id':_0x194b5e[_0x4b44('0x45')]['id']}})[_0x4b44('0x27')](handleEntityNotFound(_0x2aa0b3,null))['then'](function(_0x5e259d){if(_0x5e259d){_0x52b009=_0x5e259d;_0x10c77d[_0x4b44('0x36')]=_[_0x4b44('0x31')](db[_0x4b44('0x4c')][_0x4b44('0x2c')]);_0x10c77d[_0x4b44('0x32')]=_[_0x4b44('0x31')](_0x194b5e[_0x4b44('0x32')]);_0x10c77d[_0x4b44('0x33')]=_[_0x4b44('0x34')](_0x10c77d[_0x4b44('0x36')],_0x10c77d[_0x4b44('0x32')]);_0x3f7d08['attributes']=_[_0x4b44('0x34')](_0x10c77d[_0x4b44('0x36')],qs['fields'](_0x194b5e[_0x4b44('0x32')][_0x4b44('0x37')]));_0x3f7d08['attributes']=_0x3f7d08[_0x4b44('0x35')]['length']?_0x3f7d08['attributes']:_0x10c77d[_0x4b44('0x36')];_0x3f7d08[_0x4b44('0x3a')]=qs[_0x4b44('0x3b')](_0x194b5e[_0x4b44('0x32')][_0x4b44('0x3b')]);_0x3f7d08[_0x4b44('0x3c')]=qs[_0x4b44('0x33')](_['pick'](_0x194b5e[_0x4b44('0x32')],_0x10c77d[_0x4b44('0x33')]));if(_0x194b5e[_0x4b44('0x32')][_0x4b44('0x3f')]){_0x3f7d08['where']=_[_0x4b44('0x3e')](_0x3f7d08[_0x4b44('0x3c')],{'$or':_[_0x4b44('0x30')](_0x3f7d08[_0x4b44('0x35')],function(_0x58844d){var _0x44263b={};_0x44263b[_0x58844d]={'$like':'%'+_0x194b5e['query'][_0x4b44('0x3f')]+'%'};return _0x44263b;})});}_0x3f7d08=_[_0x4b44('0x3e')]({},_0x3f7d08,_0x194b5e[_0x4b44('0x46')]);return _0x52b009[_0x4b44('0x4b')](_0x3f7d08);}})['then'](function(_0xc4885c){if(_0xc4885c){_0xa8c848=_0xc4885c[_0x4b44('0x38')];if(!_0x194b5e[_0x4b44('0x32')][_0x4b44('0x4d')](_0x4b44('0x39'))){_0x3f7d08['limit']=qs[_0x4b44('0x1f')](_0x194b5e['query'][_0x4b44('0x1f')]);_0x3f7d08['offset']=qs[_0x4b44('0x21')](_0x194b5e['query'][_0x4b44('0x21')]);}return _0x52b009[_0x4b44('0x4b')](_0x3f7d08);}})[_0x4b44('0x27')](function(_0x80b9a0){if(_0x80b9a0){return _0x80b9a0?{'count':_0xa8c848,'rows':_0x80b9a0}:null;}})[_0x4b44('0x27')](respondWithResult(_0x2aa0b3,null))[_0x4b44('0x43')](handleError(_0x2aa0b3,null));};exports[_0x4b44('0x4e')]=function(_0x1e0bc8,_0x1aabc1,_0x4ecfad){if(_0x1e0bc8[_0x4b44('0x49')]['id']){delete _0x1e0bc8['body']['id'];}return db[_0x4b44('0x40')][_0x4b44('0x4f')]({'where':{'id':_0x1e0bc8[_0x4b44('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aabc1,null))[_0x4b44('0x27')](function(_0x2193a9){if(_0x2193a9){_0x1e0bc8[_0x4b44('0x49')][_0x4b44('0x50')]=_0x2193a9['id'];_0x1e0bc8[_0x4b44('0x49')]['Subjects']=integrations[_0x4b44('0x51')](_0x1e0bc8[_0x4b44('0x49')]['channel'],_0x1e0bc8['body']['type']);_0x1e0bc8[_0x4b44('0x49')][_0x4b44('0x52')]=integrations[_0x4b44('0x53')](_0x1e0bc8[_0x4b44('0x49')]['channel'],_0x1e0bc8[_0x4b44('0x49')][_0x4b44('0x2e')]);return db[_0x4b44('0x4c')][_0x4b44('0x48')](_0x1e0bc8[_0x4b44('0x49')],{'include':[{'model':db[_0x4b44('0x54')],'as':_0x4b44('0x55')},{'model':db[_0x4b44('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1aabc1,null))[_0x4b44('0x43')](handleError(_0x1aabc1,null));};function getAccessToken(_0x21dfbd){return new Promise(function(_0x278f67,_0x1d5842){var _0x37566f;switch(_0x21dfbd[_0x4b44('0x56')]){case'US':_0x37566f=_0x4b44('0x57');break;case'AU':_0x37566f=_0x4b44('0x58');break;case'EU':_0x37566f='https://accounts.zoho.eu';break;case'IN':_0x37566f=_0x4b44('0x59');break;case'CN':_0x37566f=_0x4b44('0x5a');break;default:_0x37566f='https://accounts.zoho.eu';break;}var _0x27fea8={'method':_0x4b44('0x5b'),'uri':_0x37566f+_0x4b44('0x5c'),'qs':{'refresh_token':_0x21dfbd['refreshToken'],'client_id':_0x21dfbd[_0x4b44('0x5d')],'client_secret':_0x21dfbd[_0x4b44('0x5e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x27fea8)['then'](function(_0x12c14b){if(_0x12c14b['access_token']){_0x278f67(_0x12c14b[_0x4b44('0x5f')]);}else{_0x1d5842(_0x4b44('0x60'));}})['catch'](function(_0x1ed41d){_0x1d5842(_0x1ed41d);});});}exports[_0x4b44('0x61')]=function(_0x112215,_0x2bc4f7,_0x394b5d){var _0x585a5b,_0x3b87eb,_0x1ea474,_0x25c283,_0x3709c3;return db[_0x4b44('0x40')][_0x4b44('0x4f')]({'where':{'id':_0x112215[_0x4b44('0x45')]['id']},'attributes':['id',_0x4b44('0x62'),_0x4b44('0x56'),_0x4b44('0x5d'),'clientSecret',_0x4b44('0x63'),_0x4b44('0x64'),_0x4b44('0x65')]})[_0x4b44('0x27')](handleEntityNotFound(_0x2bc4f7,null))['then'](function(_0x530e01){_0x3709c3=_0x530e01;_0x585a5b=_0x3709c3[_0x4b44('0x62')];_0x3b87eb=_0x585a5b===_0x4b44('0x66')?'eu':_0x4b44('0x67');_0x1ea474=_0x3709c3[_0x4b44('0x63')];var _0x5e8c1b=_0x1ea474[_0x4b44('0x68')](-0x1);if(_0x5e8c1b==='/'||_0x5e8c1b==='\x5c'||_0x5e8c1b===':'){_0x1ea474=_0x1ea474[_0x4b44('0x69')](0x0,_0x1ea474[_0x4b44('0x6a')](_0x5e8c1b));}if(!_0x3709c3[_0x4b44('0x65')]){throw new Error(_0x4b44('0x6b'));}return getAccessToken(_0x3709c3);})[_0x4b44('0x27')](function(_0x39eb1e){if(_0x39eb1e){return rp({'method':_0x4b44('0x6c'),'uri':util['format'](_0x4b44('0x6d'),_0x3b87eb),'qs':{'module':_0x4b44('0x6e')},'headers':{'Authorization':_0x4b44('0x6f')+_0x39eb1e},'json':!![]});}})[_0x4b44('0x27')](function(_0x2dd07f){if(_0x2dd07f){if(_0x2dd07f[_0x4b44('0x70')]&&_0x2dd07f[_0x4b44('0x70')][_0x4b44('0x29')]){throw new Error(_0x2dd07f[_0x4b44('0x70')]['error'][_0x4b44('0x71')]);}var _0x237cc5=[];var _0x50e35f=[];var _0x96da5c=[_0x4b44('0x72'),_0x4b44('0x73'),_0x4b44('0x74'),'WhoId',_0x4b44('0x75'),'Call_Result','Call_Start_Time',_0x4b44('0x76')];_0x50e35f=_['remove'](_0x2dd07f[_0x4b44('0x37')],function(_0x325cc2){return _0x96da5c[_0x4b44('0x77')](_0x325cc2[_0x4b44('0x78')]);});for(var _0x560484=0x0;_0x560484<_0x50e35f[_0x4b44('0x38')];_0x560484++){if(_0x50e35f[_0x560484][_0x4b44('0x79')]===![]){_0x237cc5[_0x4b44('0x7a')]({'id':_0x50e35f[_0x560484]['id'],'name':_0x50e35f[_0x560484][_0x4b44('0x7b')],'custom':_0x50e35f[_0x560484][_0x4b44('0x7c')],'options':_0x50e35f[_0x560484][_0x4b44('0x7d')]===_0x4b44('0x7e')&&_0x50e35f[_0x560484][_0x4b44('0x7f')][_0x4b44('0x38')]>-0x1?_[_0x4b44('0x30')](_0x50e35f[_0x560484]['pick_list_values'],function(_0x4f324b){return{'name':_0x4f324b,'value':_0x4f324b};}):[]});}}return{'count':_0x237cc5['length'],'rows':_0x237cc5};}else{return{'count':0x0,'rows':[]};}})[_0x4b44('0x27')](respondWithResult(_0x2bc4f7,null))[_0x4b44('0x43')](function(_0xcbad92){var _0x72e6eb=_0x112215[_0x4b44('0x32')]['test']?0x1f4:_0xcbad92[_0x4b44('0x80')]||0x1f4;logger['error'](_0x4b44('0x81'),_0x4b44('0x61'),_0x72e6eb,JSON[_0x4b44('0x82')](_0xcbad92));delete _0xcbad92['name'];if(_0x72e6eb===0x191){_0x72e6eb=0x190;}_0x2bc4f7[_0x4b44('0x1b')](_0x72e6eb)[_0x4b44('0x83')](_0x112215['query'][_0x4b44('0x84')]?{'message':_0x4b44('0x85'),'statusCode':_0xcbad92[_0x4b44('0x80')]}:_0xcbad92);});}; \ No newline at end of file +var _0x353b=['AccountId','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','refreshToken','zoho.eu','com','slice','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','Call_Duration','Call_Start_Time','remove','api_name','push','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','findAll','rows','show','params','keys','includeAll','merge','options','catch','create','body','find','getConfigurations','ZohoConfiguration','order','findOne'];(function(_0x27ba36,_0xd1e40f){var _0x4686f1=function(_0x3d7ef3){while(--_0x3d7ef3){_0x27ba36['push'](_0x27ba36['shift']());}};_0x4686f1(++_0xd1e40f);}(_0x353b,0x122));var _0xb353=function(_0x564615,_0x51000c){_0x564615=_0x564615-0x0;var _0x3e5c3c=_0x353b[_0x564615];return _0x3e5c3c;};'use strict';var emlformat=require(_0xb353('0x0'));var rimraf=require(_0xb353('0x1'));var zipdir=require(_0xb353('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb353('0x3'));var moment=require(_0xb353('0x4'));var BPromise=require(_0xb353('0x5'));var Mustache=require('mustache');var util=require(_0xb353('0x6'));var path=require(_0xb353('0x7'));var sox=require(_0xb353('0x8'));var csv=require(_0xb353('0x9'));var ejs=require(_0xb353('0xa'));var fs=require('fs');var fs_extra=require(_0xb353('0xb'));var _=require(_0xb353('0xc'));var squel=require(_0xb353('0xd'));var crypto=require(_0xb353('0xe'));var jsforce=require(_0xb353('0xf'));var deskjs=require(_0xb353('0x10'));var toCsv=require(_0xb353('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb353('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb353('0x12'));var hardwareService=require(_0xb353('0x13'));var logger=require(_0xb353('0x14'))('api');var utils=require(_0xb353('0x15'));var config=require(_0xb353('0x16'));var licenseUtil=require(_0xb353('0x17'));var db=require(_0xb353('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e2a72,_0x1eb25b){_0x1eb25b=_0x1eb25b||0xcc;return function(_0x2e11e5){if(_0x2e11e5){return _0x2e2a72[_0xb353('0x19')](_0x1eb25b);}return _0x2e2a72[_0xb353('0x1a')](_0x1eb25b)[_0xb353('0x1b')]();};}function respondWithResult(_0x151bff,_0x3e6ab0){_0x3e6ab0=_0x3e6ab0||0xc8;return function(_0x79c759){if(_0x79c759){return _0x151bff['status'](_0x3e6ab0)[_0xb353('0x1c')](_0x79c759);}};}function respondWithFilteredResult(_0xb6c298,_0x31e67f){return function(_0xb4ad53){if(_0xb4ad53){var _0x5124e1=typeof _0x31e67f[_0xb353('0x1d')]===_0xb353('0x1e')&&typeof _0x31e67f['limit']===_0xb353('0x1e');var _0x22888c=_0xb4ad53[_0xb353('0x1f')];var _0x477cfa=_0x5124e1?0x0:_0x31e67f['offset'];var _0x5a18da=_0x5124e1?_0xb4ad53[_0xb353('0x1f')]:_0x31e67f[_0xb353('0x1d')]+_0x31e67f[_0xb353('0x20')];var _0x1e21f5;if(_0x5a18da>=_0x22888c){_0x5a18da=_0x22888c;_0x1e21f5=0xc8;}else{_0x1e21f5=0xce;}_0xb6c298[_0xb353('0x1a')](_0x1e21f5);return _0xb6c298['set']('Content-Range',_0x477cfa+'-'+_0x5a18da+'/'+_0x22888c)[_0xb353('0x1c')](_0xb4ad53);}return null;};}function patchUpdates(_0x22290f){return function(_0x3b24e8){try{jsonpatch[_0xb353('0x21')](_0x3b24e8,_0x22290f,!![]);}catch(_0x1ce445){return BPromise[_0xb353('0x22')](_0x1ce445);}return _0x3b24e8[_0xb353('0x23')]();};}function saveUpdates(_0x2e0a86,_0x5dfdd2){return function(_0x3437e7){if(_0x3437e7){return _0x3437e7[_0xb353('0x24')](_0x2e0a86)[_0xb353('0x25')](function(_0x2b09df){return _0x2b09df;});}return null;};}function removeEntity(_0x353269,_0x9f1d5c){return function(_0x5268b5){if(_0x5268b5){return _0x5268b5[_0xb353('0x26')]()[_0xb353('0x25')](function(){_0x353269[_0xb353('0x1a')](0xcc)[_0xb353('0x1b')]();});}};}function handleEntityNotFound(_0x4cc561,_0x243aa3){return function(_0xe6250b){if(!_0xe6250b){_0x4cc561[_0xb353('0x19')](0x194);}return _0xe6250b;};}function handleError(_0x58d1d9,_0x285d4e){_0x285d4e=_0x285d4e||0x1f4;return function(_0x124991){logger[_0xb353('0x27')](_0x124991[_0xb353('0x28')]);if(_0x124991['name']){delete _0x124991[_0xb353('0x29')];}_0x58d1d9[_0xb353('0x1a')](_0x285d4e)[_0xb353('0x2a')](_0x124991);};}exports['index']=function(_0x2a2d95,_0x19a1e1){var _0x2c5501={},_0x58b787={},_0xf4fc38={'count':0x0,'rows':[]};var _0xde299a=_[_0xb353('0x2b')](db[_0xb353('0x2c')][_0xb353('0x2d')],function(_0x23c083){return{'name':_0x23c083[_0xb353('0x2e')],'type':_0x23c083[_0xb353('0x2f')][_0xb353('0x30')]};});_0x58b787[_0xb353('0x31')]=_[_0xb353('0x2b')](_0xde299a,_0xb353('0x29'));_0x58b787[_0xb353('0x32')]=_['keys'](_0x2a2d95['query']);_0x58b787[_0xb353('0x33')]=_[_0xb353('0x34')](_0x58b787['model'],_0x58b787[_0xb353('0x32')]);_0x2c5501['attributes']=_[_0xb353('0x34')](_0x58b787[_0xb353('0x31')],qs[_0xb353('0x35')](_0x2a2d95[_0xb353('0x32')][_0xb353('0x35')]));_0x2c5501[_0xb353('0x36')]=_0x2c5501[_0xb353('0x36')][_0xb353('0x37')]?_0x2c5501[_0xb353('0x36')]:_0x58b787[_0xb353('0x31')];if(!_0x2a2d95[_0xb353('0x32')][_0xb353('0x38')](_0xb353('0x39'))){_0x2c5501[_0xb353('0x20')]=qs[_0xb353('0x20')](_0x2a2d95[_0xb353('0x32')][_0xb353('0x20')]);_0x2c5501[_0xb353('0x1d')]=qs[_0xb353('0x1d')](_0x2a2d95[_0xb353('0x32')][_0xb353('0x1d')]);}_0x2c5501['order']=qs[_0xb353('0x3a')](_0x2a2d95[_0xb353('0x32')]['sort']);_0x2c5501[_0xb353('0x3b')]=qs[_0xb353('0x33')](_[_0xb353('0x3c')](_0x2a2d95[_0xb353('0x32')],_0x58b787[_0xb353('0x33')]),_0xde299a);if(_0x2a2d95[_0xb353('0x32')][_0xb353('0x3d')]){_0x2c5501[_0xb353('0x3b')]=_['merge'](_0x2c5501[_0xb353('0x3b')],{'$or':_[_0xb353('0x2b')](_0xde299a,function(_0x10a5b9){if(_0x10a5b9[_0xb353('0x2f')]!==_0xb353('0x3e')){var _0x388f5f={};_0x388f5f[_0x10a5b9[_0xb353('0x29')]]={'$like':'%'+_0x2a2d95[_0xb353('0x32')][_0xb353('0x3d')]+'%'};return _0x388f5f;}})});}_0x2c5501=_['merge']({},_0x2c5501,_0x2a2d95['options']);var _0x1f5678={'where':_0x2c5501[_0xb353('0x3b')]};return db['ZohoAccount'][_0xb353('0x1f')](_0x1f5678)[_0xb353('0x25')](function(_0x5bd7a3){_0xf4fc38[_0xb353('0x1f')]=_0x5bd7a3;if(_0x2a2d95[_0xb353('0x32')]['includeAll']){_0x2c5501['include']=[{'all':!![]}];}return db[_0xb353('0x2c')][_0xb353('0x3f')](_0x2c5501);})['then'](function(_0x48f429){_0xf4fc38[_0xb353('0x40')]=_0x48f429;return _0xf4fc38;})[_0xb353('0x25')](respondWithFilteredResult(_0x19a1e1,_0x2c5501))['catch'](handleError(_0x19a1e1,null));};exports[_0xb353('0x41')]=function(_0x6b2423,_0xc70fc3){var _0x2f17e3={'raw':![],'where':{'id':_0x6b2423[_0xb353('0x42')]['id']}},_0x2b6fbc={};_0x2b6fbc['model']=_[_0xb353('0x43')](db[_0xb353('0x2c')][_0xb353('0x2d')]);_0x2b6fbc['query']=_['keys'](_0x6b2423['query']);_0x2b6fbc['filters']=_[_0xb353('0x34')](_0x2b6fbc['model'],_0x2b6fbc[_0xb353('0x32')]);_0x2f17e3[_0xb353('0x36')]=_[_0xb353('0x34')](_0x2b6fbc[_0xb353('0x31')],qs[_0xb353('0x35')](_0x6b2423[_0xb353('0x32')][_0xb353('0x35')]));_0x2f17e3[_0xb353('0x36')]=_0x2f17e3[_0xb353('0x36')][_0xb353('0x37')]?_0x2f17e3[_0xb353('0x36')]:_0x2b6fbc['model'];if(_0x6b2423['query'][_0xb353('0x44')]){_0x2f17e3['include']=[{'all':!![]}];}_0x2f17e3=_[_0xb353('0x45')]({},_0x2f17e3,_0x6b2423[_0xb353('0x46')]);return db[_0xb353('0x2c')]['find'](_0x2f17e3)[_0xb353('0x25')](handleEntityNotFound(_0xc70fc3,null))[_0xb353('0x25')](respondWithResult(_0xc70fc3,null))[_0xb353('0x47')](handleError(_0xc70fc3,null));};exports['create']=function(_0x313320,_0x354e27){return db[_0xb353('0x2c')][_0xb353('0x48')](_0x313320[_0xb353('0x49')],{})[_0xb353('0x25')](respondWithResult(_0x354e27,0xc9))[_0xb353('0x47')](handleError(_0x354e27,null));};exports['update']=function(_0x2ef3b5,_0xf58390){if(_0x2ef3b5[_0xb353('0x49')]['id']){delete _0x2ef3b5['body']['id'];}return db['ZohoAccount'][_0xb353('0x4a')]({'where':{'id':_0x2ef3b5[_0xb353('0x42')]['id']}})['then'](handleEntityNotFound(_0xf58390,null))['then'](saveUpdates(_0x2ef3b5[_0xb353('0x49')],null))['then'](respondWithResult(_0xf58390,null))[_0xb353('0x47')](handleError(_0xf58390,null));};exports[_0xb353('0x26')]=function(_0x2f614b,_0x111257){return db[_0xb353('0x2c')][_0xb353('0x4a')]({'where':{'id':_0x2f614b['params']['id']}})['then'](handleEntityNotFound(_0x111257,null))[_0xb353('0x25')](removeEntity(_0x111257,null))[_0xb353('0x47')](handleError(_0x111257,null));};exports[_0xb353('0x4b')]=function(_0x5148c3,_0x335331,_0x4cc1c5){var _0x4c7dc7={};var _0xadef67={};var _0x414bd3;var _0x49ab33;return db[_0xb353('0x2c')]['findOne']({'where':{'id':_0x5148c3['params']['id']}})[_0xb353('0x25')](handleEntityNotFound(_0x335331,null))[_0xb353('0x25')](function(_0x54c38e){if(_0x54c38e){_0x414bd3=_0x54c38e;_0xadef67[_0xb353('0x31')]=_[_0xb353('0x43')](db[_0xb353('0x4c')]['rawAttributes']);_0xadef67[_0xb353('0x32')]=_[_0xb353('0x43')](_0x5148c3['query']);_0xadef67[_0xb353('0x33')]=_['intersection'](_0xadef67['model'],_0xadef67[_0xb353('0x32')]);_0x4c7dc7[_0xb353('0x36')]=_[_0xb353('0x34')](_0xadef67[_0xb353('0x31')],qs['fields'](_0x5148c3[_0xb353('0x32')][_0xb353('0x35')]));_0x4c7dc7[_0xb353('0x36')]=_0x4c7dc7['attributes']['length']?_0x4c7dc7[_0xb353('0x36')]:_0xadef67[_0xb353('0x31')];_0x4c7dc7[_0xb353('0x4d')]=qs['sort'](_0x5148c3['query']['sort']);_0x4c7dc7[_0xb353('0x3b')]=qs[_0xb353('0x33')](_[_0xb353('0x3c')](_0x5148c3[_0xb353('0x32')],_0xadef67[_0xb353('0x33')]));if(_0x5148c3[_0xb353('0x32')]['filter']){_0x4c7dc7[_0xb353('0x3b')]=_['merge'](_0x4c7dc7[_0xb353('0x3b')],{'$or':_[_0xb353('0x2b')](_0x4c7dc7[_0xb353('0x36')],function(_0x476085){var _0x3067c7={};_0x3067c7[_0x476085]={'$like':'%'+_0x5148c3[_0xb353('0x32')][_0xb353('0x3d')]+'%'};return _0x3067c7;})});}_0x4c7dc7=_[_0xb353('0x45')]({},_0x4c7dc7,_0x5148c3[_0xb353('0x46')]);return _0x414bd3[_0xb353('0x4b')](_0x4c7dc7);}})[_0xb353('0x25')](function(_0x274120){if(_0x274120){_0x49ab33=_0x274120[_0xb353('0x37')];if(!_0x5148c3['query'][_0xb353('0x38')](_0xb353('0x39'))){_0x4c7dc7[_0xb353('0x20')]=qs[_0xb353('0x20')](_0x5148c3['query'][_0xb353('0x20')]);_0x4c7dc7[_0xb353('0x1d')]=qs[_0xb353('0x1d')](_0x5148c3[_0xb353('0x32')]['offset']);}return _0x414bd3[_0xb353('0x4b')](_0x4c7dc7);}})[_0xb353('0x25')](function(_0x226884){if(_0x226884){return _0x226884?{'count':_0x49ab33,'rows':_0x226884}:null;}})[_0xb353('0x25')](respondWithResult(_0x335331,null))[_0xb353('0x47')](handleError(_0x335331,null));};exports['addConfiguration']=function(_0x25596a,_0x2c268b,_0x379db1){if(_0x25596a['body']['id']){delete _0x25596a[_0xb353('0x49')]['id'];}return db[_0xb353('0x2c')][_0xb353('0x4e')]({'where':{'id':_0x25596a[_0xb353('0x42')]['id']}})[_0xb353('0x25')](handleEntityNotFound(_0x2c268b,null))['then'](function(_0xedc8da){if(_0xedc8da){_0x25596a['body'][_0xb353('0x4f')]=_0xedc8da['id'];_0x25596a[_0xb353('0x49')][_0xb353('0x50')]=integrations['getSubjects'](_0x25596a[_0xb353('0x49')][_0xb353('0x51')],_0x25596a['body']['type']);_0x25596a[_0xb353('0x49')][_0xb353('0x52')]=integrations['getDescriptions'](_0x25596a[_0xb353('0x49')]['channel'],_0x25596a['body'][_0xb353('0x2f')]);return db[_0xb353('0x4c')][_0xb353('0x48')](_0x25596a['body'],{'include':[{'model':db[_0xb353('0x53')],'as':_0xb353('0x50')},{'model':db['ZohoField'],'as':_0xb353('0x52')}]});}return null;})[_0xb353('0x25')](respondWithResult(_0x2c268b,null))[_0xb353('0x47')](handleError(_0x2c268b,null));};function getAccessToken(_0x59c26e){return new Promise(function(_0xa49e86,_0x1bceac){var _0x4b56f1;switch(_0x59c26e[_0xb353('0x54')]){case'US':_0x4b56f1=_0xb353('0x55');break;case'AU':_0x4b56f1='https://accounts.zoho.com.au';break;case'EU':_0x4b56f1='https://accounts.zoho.eu';break;case'IN':_0x4b56f1='https://accounts.zoho.in';break;case'CN':_0x4b56f1=_0xb353('0x56');break;default:_0x4b56f1=_0xb353('0x57');break;}var _0x366459={'method':'POST','uri':_0x4b56f1+_0xb353('0x58'),'qs':{'refresh_token':_0x59c26e['refreshToken'],'client_id':_0x59c26e[_0xb353('0x59')],'client_secret':_0x59c26e[_0xb353('0x5a')],'grant_type':_0xb353('0x5b')},'json':!![]};return rp(_0x366459)['then'](function(_0x168a9f){if(_0x168a9f[_0xb353('0x5c')]){_0xa49e86(_0x168a9f[_0xb353('0x5c')]);}else{_0x1bceac(_0xb353('0x5d'));}})[_0xb353('0x47')](function(_0x536cf3){_0x1bceac(_0x536cf3);});});}exports[_0xb353('0x5e')]=function(_0x59ede0,_0x3d0464,_0x751679){var _0x14fe49,_0x2e176e,_0x16317e,_0x3dfe49,_0x37435f;return db['ZohoAccount'][_0xb353('0x4e')]({'where':{'id':_0x59ede0[_0xb353('0x42')]['id']},'attributes':['id',_0xb353('0x5f'),_0xb353('0x54'),_0xb353('0x59'),'clientSecret',_0xb353('0x60'),'code',_0xb353('0x61')]})['then'](handleEntityNotFound(_0x3d0464,null))[_0xb353('0x25')](function(_0x19ac0c){_0x37435f=_0x19ac0c;_0x14fe49=_0x37435f[_0xb353('0x5f')];_0x2e176e=_0x14fe49===_0xb353('0x62')?'eu':_0xb353('0x63');_0x16317e=_0x37435f[_0xb353('0x60')];var _0x52b5f3=_0x16317e[_0xb353('0x64')](-0x1);if(_0x52b5f3==='/'||_0x52b5f3==='\x5c'||_0x52b5f3===':'){_0x16317e=_0x16317e['substring'](0x0,_0x16317e['lastIndexOf'](_0x52b5f3));}if(!_0x37435f[_0xb353('0x61')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x37435f);})[_0xb353('0x25')](function(_0x500295){if(_0x500295){return rp({'method':_0xb353('0x65'),'uri':util[_0xb353('0x66')](_0xb353('0x67'),_0x2e176e),'qs':{'module':_0xb353('0x68')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x500295},'json':!![]});}})[_0xb353('0x25')](function(_0x5151d6){if(_0x5151d6){if(_0x5151d6[_0xb353('0x69')]&&_0x5151d6['response'][_0xb353('0x27')]){throw new Error(_0x5151d6[_0xb353('0x69')]['error'][_0xb353('0x6a')]);}var _0x12f1d2=[];var _0x119e72=[];var _0x3239ea=[_0xb353('0x6b'),_0xb353('0x6c'),_0xb353('0x6d'),'WhoId',_0xb353('0x6e'),'Call_Result',_0xb353('0x6f'),'Call_Type'];_0x119e72=_[_0xb353('0x70')](_0x5151d6[_0xb353('0x35')],function(_0x506d0f){return _0x3239ea['includes'](_0x506d0f[_0xb353('0x71')]);});for(var _0x4a5f2b=0x0;_0x4a5f2b<_0x119e72['length'];_0x4a5f2b++){if(_0x119e72[_0x4a5f2b]['system_mandatory']===![]){_0x12f1d2[_0xb353('0x72')]({'id':_0x119e72[_0x4a5f2b]['id'],'name':_0x119e72[_0x4a5f2b][_0xb353('0x73')],'custom':_0x119e72[_0x4a5f2b]['custom_field'],'options':_0x119e72[_0x4a5f2b][_0xb353('0x74')]==='picklist'&&_0x119e72[_0x4a5f2b][_0xb353('0x75')][_0xb353('0x37')]>-0x1?_['map'](_0x119e72[_0x4a5f2b][_0xb353('0x75')],function(_0x4a7ace){return{'name':_0x4a7ace,'value':_0x4a7ace};}):[]});}}return{'count':_0x12f1d2[_0xb353('0x37')],'rows':_0x12f1d2};}else{return{'count':0x0,'rows':[]};}})[_0xb353('0x25')](respondWithResult(_0x3d0464,null))[_0xb353('0x47')](function(_0x541394){var _0x5ba969=_0x59ede0['query'][_0xb353('0x76')]?0x1f4:_0x541394[_0xb353('0x77')]||0x1f4;logger['error'](_0xb353('0x78'),_0xb353('0x5e'),_0x5ba969,JSON[_0xb353('0x79')](_0x541394));delete _0x541394[_0xb353('0x29')];if(_0x5ba969===0x191){_0x5ba969=0x190;}_0x3d0464['status'](_0x5ba969)['send'](_0x59ede0['query'][_0xb353('0x76')]?{'message':_0xb353('0x7a'),'statusCode':_0x541394['statusCode']}:_0x541394);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f9e2fee..3648cbf 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 _0xa2fd=['int_zoho_accounts','changed','clientId','clientSecret','host','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','serverUrl','code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','error','inspect','slice','https://accounts.zoho.eu','util','../../config/logger','moment','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount'];(function(_0x2f7d05,_0xc1f5cf){var _0x33f33c=function(_0x41586e){while(--_0x41586e){_0x2f7d05['push'](_0x2f7d05['shift']());}};_0x33f33c(++_0xc1f5cf);}(_0xa2fd,0xf7));var _0xda2f=function(_0x3e57ef,_0x388fab){_0x3e57ef=_0x3e57ef-0x0;var _0x5ade66=_0xa2fd[_0x3e57ef];return _0x5ade66;};'use strict';var _=require('lodash');var util=require(_0xda2f('0x0'));var logger=require(_0xda2f('0x1'))('api');var moment=require(_0xda2f('0x2'));var BPromise=require('bluebird');var rp=require(_0xda2f('0x3'));var fs=require('fs');var path=require(_0xda2f('0x4'));var rimraf=require(_0xda2f('0x5'));var config=require('../../config/environment');var attributes=require(_0xda2f('0x6'));var integrations=require(_0xda2f('0x7'));module[_0xda2f('0x8')]=function(_0x10c6b4,_0x8c1cdd){return _0x10c6b4[_0xda2f('0x9')](_0xda2f('0xa'),attributes,{'tableName':_0xda2f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5fba6c,_0x5621ca,_0x36c9f0){if(_0x5fba6c['changed']('zone')||_0x5fba6c[_0xda2f('0xc')]('serverUrl')||_0x5fba6c[_0xda2f('0xc')](_0xda2f('0xd'))||_0x5fba6c['changed'](_0xda2f('0xe'))||_0x5fba6c[_0xda2f('0xc')]('code')||_0x5fba6c[_0xda2f('0xc')](_0xda2f('0xf'))){var _0x5d196f,_0x4617d5;_0x5d196f=_0x5fba6c['serverUrl'];var _0x523b9b=_0x5d196f['slice'](-0x1);if(_0x523b9b==='/'||_0x523b9b==='\x5c'||_0x523b9b===':'){_0x5d196f=_0x5d196f[_0xda2f('0x10')](0x0,_0x5d196f[_0xda2f('0x11')](_0x523b9b));}switch(_0x5fba6c[_0xda2f('0x12')]){case'US':_0x4617d5=_0xda2f('0x13');break;case'AU':_0x4617d5=_0xda2f('0x14');break;case'IN':_0x4617d5=_0xda2f('0x15');break;case'CN':_0x4617d5=_0xda2f('0x16');break;default:_0x4617d5='https://accounts.zoho.eu';break;}var _0x3a29d7={'method':_0xda2f('0x17'),'uri':_0x4617d5+_0xda2f('0x18'),'form':{'grant_type':_0xda2f('0x19'),'client_id':_0x5fba6c[_0xda2f('0xd')],'client_secret':_0x5fba6c[_0xda2f('0xe')],'redirect_uri':_0x5fba6c[_0xda2f('0x1a')],'code':_0x5fba6c[_0xda2f('0x1b')]},'headers':{'Content-Type':_0xda2f('0x1c')}};return rp(_0x3a29d7)[_0xda2f('0x1d')](function(_0x503bbb){var _0x5b943b=JSON[_0xda2f('0x1e')](_0x503bbb);if(_0x5b943b['refresh_token']){_0x5fba6c[_0xda2f('0x1f')]=_0x5b943b[_0xda2f('0x20')];logger[_0xda2f('0x21')](util[_0xda2f('0x22')](_0xda2f('0x23'),_0x5fba6c['name'],_0x5fba6c['id']));}else{logger['error'](util[_0xda2f('0x22')](_0xda2f('0x24'),_0x5fba6c[_0xda2f('0x25')],_0x5fba6c['id']),util['inspect'](_0x5b943b,{'showHidden':![],'depth':null}));}return _0x36c9f0(null,_0x5621ca);})[_0xda2f('0x26')](function(_0x4807f3){logger[_0xda2f('0x27')](util[_0xda2f('0x22')](_0xda2f('0x24'),_0x5fba6c[_0xda2f('0x25')],_0x5fba6c['id']),util[_0xda2f('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x36c9f0(_0x4807f3);});}else{return _0x36c9f0(null,_0x5621ca);}},'beforeUpdate':function(_0x37358f,_0x2bac2d,_0x47d801){if(_0x37358f[_0xda2f('0xc')](_0xda2f('0x12'))||_0x37358f[_0xda2f('0xc')](_0xda2f('0x1a'))||_0x37358f['changed']('clientId')||_0x37358f['changed'](_0xda2f('0xe'))||_0x37358f[_0xda2f('0xc')]('code')||_0x37358f['changed']('host')){var _0x3d12aa,_0x1ec4e4;_0x3d12aa=_0x37358f[_0xda2f('0x1a')];var _0x280c57=_0x3d12aa[_0xda2f('0x29')](-0x1);if(_0x280c57==='/'||_0x280c57==='\x5c'||_0x280c57===':'){_0x3d12aa=_0x3d12aa['substring'](0x0,_0x3d12aa[_0xda2f('0x11')](_0x280c57));}switch(_0x37358f[_0xda2f('0x12')]){case'US':_0x1ec4e4=_0xda2f('0x13');break;case'AU':_0x1ec4e4='https://accounts.zoho.com.au';break;case'IN':_0x1ec4e4=_0xda2f('0x15');break;case'CN':_0x1ec4e4=_0xda2f('0x16');break;default:_0x1ec4e4=_0xda2f('0x2a');break;}var _0x207faa={'method':'POST','uri':_0x1ec4e4+_0xda2f('0x18'),'form':{'grant_type':_0xda2f('0x19'),'client_id':_0x37358f[_0xda2f('0xd')],'client_secret':_0x37358f[_0xda2f('0xe')],'redirect_uri':_0x37358f[_0xda2f('0x1a')],'code':_0x37358f['code']},'headers':{'Content-Type':_0xda2f('0x1c')}};return rp(_0x207faa)[_0xda2f('0x1d')](function(_0x585d3f){var _0x483012=JSON[_0xda2f('0x1e')](_0x585d3f);if(_0x483012[_0xda2f('0x20')]){_0x37358f[_0xda2f('0x1f')]=_0x483012[_0xda2f('0x20')];logger[_0xda2f('0x21')](util['format'](_0xda2f('0x23'),_0x37358f[_0xda2f('0x25')],_0x37358f['id']));}else{logger['error'](util[_0xda2f('0x22')](_0xda2f('0x24'),_0x37358f['name'],_0x37358f['id']),util[_0xda2f('0x28')](_0x483012,{'showHidden':![],'depth':null}));}return _0x47d801(null,_0x2bac2d);})['catch'](function(_0x2dfa5f){logger[_0xda2f('0x27')](util[_0xda2f('0x22')](_0xda2f('0x24'),_0x37358f[_0xda2f('0x25')],_0x37358f['id']),util[_0xda2f('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x47d801(_0x2dfa5f);});}else{return _0x47d801(null,_0x2bac2d);}}}});}; \ No newline at end of file +var _0xc31b=['code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','clientSecret','slice','/oauth/v2/token','authorization_code','refresh_token','name','util','api','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId'];(function(_0xc00cde,_0x2623bd){var _0x191593=function(_0x1cdf2d){while(--_0x1cdf2d){_0xc00cde['push'](_0xc00cde['shift']());}};_0x191593(++_0x2623bd);}(_0xc31b,0x178));var _0xbc31=function(_0x38a199,_0x3cc8e8){_0x38a199=_0x38a199-0x0;var _0x537f8a=_0xc31b[_0x38a199];return _0x537f8a;};'use strict';var _=require('lodash');var util=require(_0xbc31('0x0'));var logger=require('../../config/logger')(_0xbc31('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc31('0x2'));var fs=require('fs');var path=require(_0xbc31('0x3'));var rimraf=require(_0xbc31('0x4'));var config=require('../../config/environment');var attributes=require(_0xbc31('0x5'));var integrations=require(_0xbc31('0x6'));module['exports']=function(_0x436fe5,_0x363e09){return _0x436fe5[_0xbc31('0x7')](_0xbc31('0x8'),attributes,{'tableName':_0xbc31('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x218482,_0x3c85fb,_0x2227dd){if(_0x218482[_0xbc31('0xa')](_0xbc31('0xb'))||_0x218482['changed'](_0xbc31('0xc'))||_0x218482[_0xbc31('0xa')](_0xbc31('0xd'))||_0x218482[_0xbc31('0xa')]('clientSecret')||_0x218482[_0xbc31('0xa')](_0xbc31('0xe'))||_0x218482[_0xbc31('0xa')](_0xbc31('0xf'))){var _0x301265,_0x3acfc1;_0x301265=_0x218482[_0xbc31('0xc')];var _0x31898b=_0x301265['slice'](-0x1);if(_0x31898b==='/'||_0x31898b==='\x5c'||_0x31898b===':'){_0x301265=_0x301265[_0xbc31('0x10')](0x0,_0x301265[_0xbc31('0x11')](_0x31898b));}switch(_0x218482['zone']){case'US':_0x3acfc1=_0xbc31('0x12');break;case'AU':_0x3acfc1=_0xbc31('0x13');break;case'IN':_0x3acfc1=_0xbc31('0x14');break;case'CN':_0x3acfc1=_0xbc31('0x15');break;default:_0x3acfc1=_0xbc31('0x16');break;}var _0x2d250a={'method':_0xbc31('0x17'),'uri':_0x3acfc1+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x218482[_0xbc31('0xd')],'client_secret':_0x218482['clientSecret'],'redirect_uri':_0x218482['serverUrl'],'code':_0x218482[_0xbc31('0xe')]},'headers':{'Content-Type':_0xbc31('0x18')}};return rp(_0x2d250a)[_0xbc31('0x19')](function(_0xd66346){var _0x73cd79=JSON['parse'](_0xd66346);if(_0x73cd79['refresh_token']){_0x218482['refreshToken']=_0x73cd79['refresh_token'];logger[_0xbc31('0x1a')](util[_0xbc31('0x1b')](_0xbc31('0x1c'),_0x218482['name'],_0x218482['id']));}else{logger[_0xbc31('0x1d')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x218482['name'],_0x218482['id']),util[_0xbc31('0x1e')](_0x73cd79,{'showHidden':![],'depth':null}));}return _0x2227dd(null,_0x3c85fb);})[_0xbc31('0x1f')](function(_0x2f990f){logger[_0xbc31('0x1d')](util[_0xbc31('0x1b')](_0xbc31('0x20'),_0x218482['name'],_0x218482['id']),util[_0xbc31('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x2227dd(_0x2f990f);});}else{return _0x2227dd(null,_0x3c85fb);}},'beforeUpdate':function(_0x2efe97,_0x3fe711,_0xa17e0b){if(_0x2efe97['changed']('zone')||_0x2efe97[_0xbc31('0xa')]('serverUrl')||_0x2efe97[_0xbc31('0xa')]('clientId')||_0x2efe97['changed'](_0xbc31('0x21'))||_0x2efe97['changed']('code')||_0x2efe97[_0xbc31('0xa')](_0xbc31('0xf'))){var _0x4a0ddb,_0x1f9b40;_0x4a0ddb=_0x2efe97['serverUrl'];var _0x1d402d=_0x4a0ddb[_0xbc31('0x22')](-0x1);if(_0x1d402d==='/'||_0x1d402d==='\x5c'||_0x1d402d===':'){_0x4a0ddb=_0x4a0ddb['substring'](0x0,_0x4a0ddb[_0xbc31('0x11')](_0x1d402d));}switch(_0x2efe97['zone']){case'US':_0x1f9b40=_0xbc31('0x12');break;case'AU':_0x1f9b40=_0xbc31('0x13');break;case'IN':_0x1f9b40='https://accounts.zoho.in';break;case'CN':_0x1f9b40=_0xbc31('0x15');break;default:_0x1f9b40=_0xbc31('0x16');break;}var _0x5e3c72={'method':_0xbc31('0x17'),'uri':_0x1f9b40+_0xbc31('0x23'),'form':{'grant_type':_0xbc31('0x24'),'client_id':_0x2efe97[_0xbc31('0xd')],'client_secret':_0x2efe97['clientSecret'],'redirect_uri':_0x2efe97[_0xbc31('0xc')],'code':_0x2efe97[_0xbc31('0xe')]},'headers':{'Content-Type':_0xbc31('0x18')}};return rp(_0x5e3c72)['then'](function(_0x46e1c8){var _0x9342bb=JSON['parse'](_0x46e1c8);if(_0x9342bb[_0xbc31('0x25')]){_0x2efe97['refreshToken']=_0x9342bb['refresh_token'];logger['info'](util[_0xbc31('0x1b')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2efe97[_0xbc31('0x26')],_0x2efe97['id']));}else{logger['error'](util['format'](_0xbc31('0x20'),_0x2efe97[_0xbc31('0x26')],_0x2efe97['id']),util[_0xbc31('0x1e')](_0x9342bb,{'showHidden':![],'depth':null}));}return _0xa17e0b(null,_0x3fe711);})['catch'](function(_0xabc9ec){logger['error'](util['format'](_0xbc31('0x20'),_0x2efe97[_0xbc31('0x26')],_0x2efe97['id']),util[_0xbc31('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0xa17e0b(_0xabc9ec);});}else{return _0xa17e0b(null,_0x3fe711);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 98de6a2..b5d8377 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 _0x58cc=['result','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','map','include','model','ShowZohoAccount','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x58cc,0x7a));var _0xc58c=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x58cc[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xc58c('0x0'));var util=require(_0xc58c('0x1'));var moment=require(_0xc58c('0x2'));var BPromise=require(_0xc58c('0x3'));var rs=require(_0xc58c('0x4'));var fs=require('fs');var Redis=require(_0xc58c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc58c('0x6'));var logger=require(_0xc58c('0x7'))(_0xc58c('0x8'));var config=require(_0xc58c('0x9'));var jayson=require(_0xc58c('0xa'));var client=jayson[_0xc58c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f1b4e,_0x448646,_0x282354){return new BPromise(function(_0x48a9f4,_0x184b6d){return client[_0xc58c('0xc')](_0x4f1b4e,_0x282354)['then'](function(_0x248c8c){logger['info'](_0xc58c('0xd'),_0x448646,_0xc58c('0xe'));logger[_0xc58c('0xf')](_0xc58c('0x10'),_0x448646,_0xc58c('0xe'),JSON[_0xc58c('0x11')](_0x248c8c));if(_0x248c8c['error']){if(_0x248c8c[_0xc58c('0x12')][_0xc58c('0x13')]===0x1f4){logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0x248c8c[_0xc58c('0x12')][_0xc58c('0x14')]);return _0x184b6d(_0x248c8c[_0xc58c('0x12')][_0xc58c('0x14')]);}logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0x248c8c['error'][_0xc58c('0x14')]);return _0x48a9f4(_0x248c8c['error'][_0xc58c('0x14')]);}else{logger[_0xc58c('0x15')](_0xc58c('0xd'),_0x448646,_0xc58c('0xe'));_0x48a9f4(_0x248c8c[_0xc58c('0x16')][_0xc58c('0x14')]);}})[_0xc58c('0x17')](function(_0xf1601f){logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0xf1601f);_0x184b6d(_0xf1601f);});});}exports[_0xc58c('0x18')]=function(_0x4a9536){var _0x3e544b=this;return new Promise(function(_0x475711,_0x3a2c01){return db[_0xc58c('0x19')]['findAll']({'raw':_0x4a9536[_0xc58c('0x1a')]?_0x4a9536[_0xc58c('0x1a')][_0xc58c('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a9536['options']?_0x4a9536['options']['where']||null:null,'attributes':_0x4a9536[_0xc58c('0x1a')]?_0x4a9536[_0xc58c('0x1a')][_0xc58c('0x1c')]||null:null,'limit':_0x4a9536[_0xc58c('0x1a')]?_0x4a9536['options']['limit']||null:null,'include':_0x4a9536[_0xc58c('0x1a')]?_0x4a9536[_0xc58c('0x1a')]['include']?_[_0xc58c('0x1d')](_0x4a9536[_0xc58c('0x1a')][_0xc58c('0x1e')],function(_0x586743){return{'model':db[_0x586743['model']],'as':_0x586743['as'],'attributes':_0x586743[_0xc58c('0x1c')],'include':_0x586743[_0xc58c('0x1e')]?_[_0xc58c('0x1d')](_0x586743[_0xc58c('0x1e')],function(_0x5a66d8){return{'model':db[_0x5a66d8[_0xc58c('0x1f')]],'as':_0x5a66d8['as'],'attributes':_0x5a66d8[_0xc58c('0x1c')],'include':_0x5a66d8[_0xc58c('0x1e')]?_[_0xc58c('0x1d')](_0x5a66d8[_0xc58c('0x1e')],function(_0xb1673d){return{'model':db[_0xb1673d[_0xc58c('0x1f')]],'as':_0xb1673d['as'],'attributes':_0xb1673d[_0xc58c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x161c6f){logger[_0xc58c('0x15')](_0xc58c('0x18'),_0x4a9536);logger['debug'](_0xc58c('0x18'),_0x4a9536,JSON[_0xc58c('0x11')](_0x161c6f));_0x475711(_0x161c6f);})[_0xc58c('0x17')](function(_0xf6ba27){logger['error'](_0xc58c('0x18'),_0xf6ba27[_0xc58c('0x14')],_0x4a9536);_0x3a2c01(_0x3e544b['error'](0x1f4,_0xf6ba27[_0xc58c('0x14')]));});});};exports[_0xc58c('0x20')]=function(_0x521a1a){var _0x16461c=this;return new Promise(function(_0x424cc8,_0x4257ef){return db[_0xc58c('0x19')][_0xc58c('0x21')]({'raw':_0x521a1a[_0xc58c('0x1a')]?_0x521a1a[_0xc58c('0x1a')][_0xc58c('0x1b')]===undefined?!![]:![]:!![],'where':_0x521a1a[_0xc58c('0x1a')]?_0x521a1a['options'][_0xc58c('0x22')]||null:null,'attributes':_0x521a1a[_0xc58c('0x1a')]?_0x521a1a[_0xc58c('0x1a')][_0xc58c('0x1c')]||null:null,'include':_0x521a1a[_0xc58c('0x1a')]?_0x521a1a[_0xc58c('0x1a')][_0xc58c('0x1e')]?_[_0xc58c('0x1d')](_0x521a1a['options'][_0xc58c('0x1e')],function(_0x388f55){return{'model':db[_0x388f55[_0xc58c('0x1f')]],'as':_0x388f55['as'],'attributes':_0x388f55[_0xc58c('0x1c')],'include':_0x388f55[_0xc58c('0x1e')]?_[_0xc58c('0x1d')](_0x388f55['include'],function(_0x2d7f00){return{'model':db[_0x2d7f00[_0xc58c('0x1f')]],'as':_0x2d7f00['as'],'attributes':_0x2d7f00[_0xc58c('0x1c')],'include':_0x2d7f00[_0xc58c('0x1e')]?_[_0xc58c('0x1d')](_0x2d7f00['include'],function(_0x13103b){return{'model':db[_0x13103b[_0xc58c('0x1f')]],'as':_0x13103b['as'],'attributes':_0x13103b[_0xc58c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc58c('0x23')](function(_0x8eaa4d){logger[_0xc58c('0x15')](_0xc58c('0x20'),_0x521a1a);logger[_0xc58c('0xf')](_0xc58c('0x20'),_0x521a1a,JSON[_0xc58c('0x11')](_0x8eaa4d));_0x424cc8(_0x8eaa4d);})[_0xc58c('0x17')](function(_0x114b78){logger[_0xc58c('0x12')](_0xc58c('0x20'),_0x114b78[_0xc58c('0x14')],_0x521a1a);_0x4257ef(_0x16461c[_0xc58c('0x12')](0x1f4,_0x114b78[_0xc58c('0x14')]));});});}; \ No newline at end of file +var _0xc274=['../../config/utils','../../config/logger','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','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','debug','util','randomstring','ioredis','../../mysqldb'];(function(_0x5860df,_0x4bf35f){var _0x2a2ffe=function(_0x57a661){while(--_0x57a661){_0x5860df['push'](_0x5860df['shift']());}};_0x2a2ffe(++_0x4bf35f);}(_0xc274,0x151));var _0x4c27=function(_0x22c583,_0x54a0e3){_0x22c583=_0x22c583-0x0;var _0x321d9a=_0xc274[_0x22c583];return _0x321d9a;};'use strict';var _=require('lodash');var util=require(_0x4c27('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c27('0x1'));var fs=require('fs');var Redis=require(_0x4c27('0x2'));var db=require(_0x4c27('0x3'))['db'];var utils=require(_0x4c27('0x4'));var logger=require(_0x4c27('0x5'))(_0x4c27('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c27('0x7'));var client=jayson['client'][_0x4c27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18fd2c,_0x38de2d,_0x5f5058){return new BPromise(function(_0x478a91,_0x36daa2){return client['request'](_0x18fd2c,_0x5f5058)[_0x4c27('0x9')](function(_0x2a0c76){logger[_0x4c27('0xa')](_0x4c27('0xb'),_0x38de2d,_0x4c27('0xc'));logger['debug'](_0x4c27('0xd'),_0x38de2d,_0x4c27('0xc'),JSON[_0x4c27('0xe')](_0x2a0c76));if(_0x2a0c76[_0x4c27('0xf')]){if(_0x2a0c76['error']['code']===0x1f4){logger[_0x4c27('0xf')](_0x4c27('0xb'),_0x38de2d,_0x2a0c76['error']['message']);return _0x36daa2(_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);}logger[_0x4c27('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x38de2d,_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);return _0x478a91(_0x2a0c76[_0x4c27('0xf')]['message']);}else{logger[_0x4c27('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x38de2d,'request\x20sent');_0x478a91(_0x2a0c76[_0x4c27('0x11')][_0x4c27('0x10')]);}})[_0x4c27('0x12')](function(_0x4762ad){logger['error'](_0x4c27('0xb'),_0x38de2d,_0x4762ad);_0x36daa2(_0x4762ad);});});}exports[_0x4c27('0x13')]=function(_0x4bf2fb){var _0x355fde=this;return new Promise(function(_0x37eb5d,_0x413dcd){return db[_0x4c27('0x14')]['findAll']({'raw':_0x4bf2fb[_0x4c27('0x15')]?_0x4bf2fb[_0x4c27('0x15')][_0x4c27('0x16')]===undefined?!![]:![]:!![],'where':_0x4bf2fb['options']?_0x4bf2fb[_0x4c27('0x15')][_0x4c27('0x17')]||null:null,'attributes':_0x4bf2fb[_0x4c27('0x15')]?_0x4bf2fb[_0x4c27('0x15')][_0x4c27('0x18')]||null:null,'limit':_0x4bf2fb[_0x4c27('0x15')]?_0x4bf2fb[_0x4c27('0x15')][_0x4c27('0x19')]||null:null,'include':_0x4bf2fb[_0x4c27('0x15')]?_0x4bf2fb[_0x4c27('0x15')][_0x4c27('0x1a')]?_[_0x4c27('0x1b')](_0x4bf2fb[_0x4c27('0x15')][_0x4c27('0x1a')],function(_0x35dbd1){return{'model':db[_0x35dbd1[_0x4c27('0x1c')]],'as':_0x35dbd1['as'],'attributes':_0x35dbd1[_0x4c27('0x18')],'include':_0x35dbd1[_0x4c27('0x1a')]?_[_0x4c27('0x1b')](_0x35dbd1[_0x4c27('0x1a')],function(_0x5a769b){return{'model':db[_0x5a769b[_0x4c27('0x1c')]],'as':_0x5a769b['as'],'attributes':_0x5a769b[_0x4c27('0x18')],'include':_0x5a769b[_0x4c27('0x1a')]?_[_0x4c27('0x1b')](_0x5a769b[_0x4c27('0x1a')],function(_0x57bc09){return{'model':db[_0x57bc09[_0x4c27('0x1c')]],'as':_0x57bc09['as'],'attributes':_0x57bc09[_0x4c27('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4c27('0x9')](function(_0x2ed090){logger[_0x4c27('0xa')]('GetZohoAccount',_0x4bf2fb);logger['debug'](_0x4c27('0x13'),_0x4bf2fb,JSON[_0x4c27('0xe')](_0x2ed090));_0x37eb5d(_0x2ed090);})[_0x4c27('0x12')](function(_0x10b935){logger['error']('GetZohoAccount',_0x10b935[_0x4c27('0x10')],_0x4bf2fb);_0x413dcd(_0x355fde[_0x4c27('0xf')](0x1f4,_0x10b935['message']));});});};exports[_0x4c27('0x1d')]=function(_0x1753ab){var _0x21f8e9=this;return new Promise(function(_0xc219a4,_0x5c0b24){return db[_0x4c27('0x14')]['find']({'raw':_0x1753ab[_0x4c27('0x15')]?_0x1753ab[_0x4c27('0x15')][_0x4c27('0x16')]===undefined?!![]:![]:!![],'where':_0x1753ab[_0x4c27('0x15')]?_0x1753ab['options'][_0x4c27('0x17')]||null:null,'attributes':_0x1753ab[_0x4c27('0x15')]?_0x1753ab[_0x4c27('0x15')]['attributes']||null:null,'include':_0x1753ab[_0x4c27('0x15')]?_0x1753ab[_0x4c27('0x15')][_0x4c27('0x1a')]?_[_0x4c27('0x1b')](_0x1753ab[_0x4c27('0x15')][_0x4c27('0x1a')],function(_0x1866bc){return{'model':db[_0x1866bc[_0x4c27('0x1c')]],'as':_0x1866bc['as'],'attributes':_0x1866bc[_0x4c27('0x18')],'include':_0x1866bc[_0x4c27('0x1a')]?_[_0x4c27('0x1b')](_0x1866bc[_0x4c27('0x1a')],function(_0x503fe7){return{'model':db[_0x503fe7[_0x4c27('0x1c')]],'as':_0x503fe7['as'],'attributes':_0x503fe7['attributes'],'include':_0x503fe7[_0x4c27('0x1a')]?_[_0x4c27('0x1b')](_0x503fe7[_0x4c27('0x1a')],function(_0x29c327){return{'model':db[_0x29c327[_0x4c27('0x1c')]],'as':_0x29c327['as'],'attributes':_0x29c327[_0x4c27('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9fcd1b){logger['info'](_0x4c27('0x1d'),_0x1753ab);logger[_0x4c27('0x1e')](_0x4c27('0x1d'),_0x1753ab,JSON[_0x4c27('0xe')](_0x9fcd1b));_0xc219a4(_0x9fcd1b);})[_0x4c27('0x12')](function(_0x492d09){logger[_0x4c27('0xf')](_0x4c27('0x1d'),_0x492d09[_0x4c27('0x10')],_0x1753ab);_0x5c0b24(_0x21f8e9[_0x4c27('0xf')](0x1f4,_0x492d09[_0x4c27('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index faffd0e..ce3306c 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 _0x6cb6=['/:id/subjects','getSubjects','getDescriptions','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x6cb6,0x9e));var _0x66cb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6cb6[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x66cb('0x0'));var util=require(_0x66cb('0x1'));var path=require(_0x66cb('0x2'));var timeout=require(_0x66cb('0x3'));var express=require(_0x66cb('0x4'));var router=express[_0x66cb('0x5')]();var fs_extra=require(_0x66cb('0x6'));var auth=require(_0x66cb('0x7'));var interaction=require(_0x66cb('0x8'));var config=require(_0x66cb('0x9'));var controller=require(_0x66cb('0xa'));router[_0x66cb('0xb')]('/',auth[_0x66cb('0xc')](),controller[_0x66cb('0xd')]);router[_0x66cb('0xb')](_0x66cb('0xe'),auth[_0x66cb('0xc')](),controller[_0x66cb('0xf')]);router[_0x66cb('0xb')]('/:id/fields',auth[_0x66cb('0xc')](),controller[_0x66cb('0x10')]);router[_0x66cb('0xb')](_0x66cb('0x11'),auth[_0x66cb('0xc')](),controller[_0x66cb('0x12')]);router[_0x66cb('0xb')]('/:id/descriptions',auth[_0x66cb('0xc')](),controller[_0x66cb('0x13')]);router['post']('/',auth[_0x66cb('0xc')](),controller[_0x66cb('0x14')]);router[_0x66cb('0x15')](_0x66cb('0xe'),auth[_0x66cb('0xc')](),controller[_0x66cb('0x16')]);router[_0x66cb('0x17')]('/:id',auth[_0x66cb('0xc')](),controller['destroy']);module[_0x66cb('0x18')]=router; \ No newline at end of file +var _0xc928=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','getSubjects','/:id/descriptions','create','put','/:id','update','destroy','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc928,0x1d0));var _0x8c92=function(_0x4e6a93,_0xb925e1){_0x4e6a93=_0x4e6a93-0x0;var _0x4d1db4=_0xc928[_0x4e6a93];return _0x4d1db4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c92('0x0'));var router=express['Router']();var fs_extra=require(_0x8c92('0x1'));var auth=require(_0x8c92('0x2'));var interaction=require(_0x8c92('0x3'));var config=require(_0x8c92('0x4'));var controller=require(_0x8c92('0x5'));router[_0x8c92('0x6')]('/',auth[_0x8c92('0x7')](),controller[_0x8c92('0x8')]);router[_0x8c92('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8c92('0x6')](_0x8c92('0x9'),auth['isAuthenticated'](),controller[_0x8c92('0xa')]);router[_0x8c92('0x6')]('/:id/subjects',auth[_0x8c92('0x7')](),controller[_0x8c92('0xb')]);router[_0x8c92('0x6')](_0x8c92('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x8c92('0x7')](),controller[_0x8c92('0xd')]);router[_0x8c92('0xe')](_0x8c92('0xf'),auth['isAuthenticated'](),controller[_0x8c92('0x10')]);router['delete'](_0x8c92('0xf'),auth[_0x8c92('0x7')](),controller[_0x8c92('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index c0b71d6..ab34459 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 _0xadff=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x4ef2b1,_0x31fffa){var _0xec4cf8=function(_0x4b34c8){while(--_0x4b34c8){_0x4ef2b1['push'](_0x4ef2b1['shift']());}};_0xec4cf8(++_0x31fffa);}(_0xadff,0xf8));var _0xfadf=function(_0x4147e6,_0x57174e){_0x4147e6=_0x4147e6-0x0;var _0x3305ba=_0xadff[_0x4147e6];return _0x3305ba;};'use strict';var Sequelize=require('sequelize');module[_0xfadf('0x0')]={'name':{'type':Sequelize[_0xfadf('0x1')]},'moduleCreate':{'type':Sequelize[_0xfadf('0x2')](_0xfadf('0x3'),_0xfadf('0x4'),_0xfadf('0x5')),'defaultValue':_0xfadf('0x3')},'moduleSearch':{'type':Sequelize[_0xfadf('0x2')]('contact_lead',_0xfadf('0x4'),_0xfadf('0x3')),'defaultValue':_0xfadf('0x6')},'description':{'type':Sequelize[_0xfadf('0x1')]}}; \ No newline at end of file +var _0x9821=['contact','nothing','lead','ENUM','contact_lead','sequelize','STRING'];(function(_0x132c66,_0x1f836e){var _0x323b70=function(_0x25fd95){while(--_0x25fd95){_0x132c66['push'](_0x132c66['shift']());}};_0x323b70(++_0x1f836e);}(_0x9821,0x1b7));var _0x1982=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x9821[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0x1982('0x0'));module['exports']={'name':{'type':Sequelize[_0x1982('0x1')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x1982('0x2'),_0x1982('0x3')),'defaultValue':_0x1982('0x4')},'moduleSearch':{'type':Sequelize[_0x1982('0x5')](_0x1982('0x6'),_0x1982('0x2'),_0x1982('0x4')),'defaultValue':_0x1982('0x6')},'description':{'type':Sequelize[_0x1982('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index aaff647..42548a1 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 _0x9a0d=['error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','ZohoField','order','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy'];(function(_0x49e7ef,_0x50dadb){var _0x12d184=function(_0x3168bc){while(--_0x3168bc){_0x49e7ef['push'](_0x49e7ef['shift']());}};_0x12d184(++_0x50dadb);}(_0x9a0d,0x114));var _0xd9a0=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0x9a0d[_0x2726ad];return _0xd87993;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9a0('0x0'));var zipdir=require(_0xd9a0('0x1'));var jsonpatch=require(_0xd9a0('0x2'));var rp=require(_0xd9a0('0x3'));var moment=require(_0xd9a0('0x4'));var BPromise=require(_0xd9a0('0x5'));var Mustache=require('mustache');var util=require(_0xd9a0('0x6'));var path=require(_0xd9a0('0x7'));var sox=require('sox');var csv=require(_0xd9a0('0x8'));var ejs=require(_0xd9a0('0x9'));var fs=require('fs');var fs_extra=require(_0xd9a0('0xa'));var _=require(_0xd9a0('0xb'));var squel=require(_0xd9a0('0xc'));var crypto=require(_0xd9a0('0xd'));var jsforce=require(_0xd9a0('0xe'));var deskjs=require(_0xd9a0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd9a0('0x10'));var Redis=require(_0xd9a0('0x11'));var authService=require(_0xd9a0('0x12'));var qs=require(_0xd9a0('0x13'));var as=require(_0xd9a0('0x14'));var hardwareService=require(_0xd9a0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd9a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd9a0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x405837,_0xafa733){_0xafa733=_0xafa733||0xcc;return function(_0x352362){if(_0x352362){return _0x405837['sendStatus'](_0xafa733);}return _0x405837[_0xd9a0('0x18')](_0xafa733)[_0xd9a0('0x19')]();};}function respondWithResult(_0x2c124c,_0x952a27){_0x952a27=_0x952a27||0xc8;return function(_0x2d58af){if(_0x2d58af){return _0x2c124c[_0xd9a0('0x18')](_0x952a27)[_0xd9a0('0x1a')](_0x2d58af);}};}function respondWithFilteredResult(_0x2d27c7,_0x411f74){return function(_0x84a997){if(_0x84a997){var _0x46fd65=typeof _0x411f74[_0xd9a0('0x1b')]===_0xd9a0('0x1c')&&typeof _0x411f74[_0xd9a0('0x1d')]==='undefined';var _0x6589b6=_0x84a997['count'];var _0x2c0658=_0x46fd65?0x0:_0x411f74['offset'];var _0x4a51d8=_0x46fd65?_0x84a997[_0xd9a0('0x1e')]:_0x411f74[_0xd9a0('0x1b')]+_0x411f74[_0xd9a0('0x1d')];var _0x3495a3;if(_0x4a51d8>=_0x6589b6){_0x4a51d8=_0x6589b6;_0x3495a3=0xc8;}else{_0x3495a3=0xce;}_0x2d27c7[_0xd9a0('0x18')](_0x3495a3);return _0x2d27c7[_0xd9a0('0x1f')]('Content-Range',_0x2c0658+'-'+_0x4a51d8+'/'+_0x6589b6)[_0xd9a0('0x1a')](_0x84a997);}return null;};}function patchUpdates(_0x41f2e9){return function(_0x286c3e){try{jsonpatch['apply'](_0x286c3e,_0x41f2e9,!![]);}catch(_0x36ed0){return BPromise[_0xd9a0('0x20')](_0x36ed0);}return _0x286c3e['save']();};}function saveUpdates(_0x2bc927,_0x52b8eb){return function(_0x562ee1){if(_0x562ee1){return _0x562ee1[_0xd9a0('0x21')](_0x2bc927)[_0xd9a0('0x22')](function(_0x4c7d89){return _0x4c7d89;});}return null;};}function removeEntity(_0x1ea265,_0xb9c856){return function(_0x458e1e){if(_0x458e1e){return _0x458e1e[_0xd9a0('0x23')]()[_0xd9a0('0x22')](function(){_0x1ea265[_0xd9a0('0x18')](0xcc)[_0xd9a0('0x19')]();});}};}function handleEntityNotFound(_0x36bb0a,_0x1bbc19){return function(_0x4622a5){if(!_0x4622a5){_0x36bb0a['sendStatus'](0x194);}return _0x4622a5;};}function handleError(_0x486d28,_0x1c8e14){_0x1c8e14=_0x1c8e14||0x1f4;return function(_0x214542){logger[_0xd9a0('0x24')](_0x214542[_0xd9a0('0x25')]);if(_0x214542[_0xd9a0('0x26')]){delete _0x214542[_0xd9a0('0x26')];}_0x486d28['status'](_0x1c8e14)[_0xd9a0('0x27')](_0x214542);};}exports['index']=function(_0x25e61b,_0x1168ed){var _0x32b983={},_0x7872e={},_0x580620={'count':0x0,'rows':[]};var _0x8bc0ad=_[_0xd9a0('0x28')](db[_0xd9a0('0x29')][_0xd9a0('0x2a')],function(_0x41858b){return{'name':_0x41858b[_0xd9a0('0x2b')],'type':_0x41858b['type'][_0xd9a0('0x2c')]};});_0x7872e[_0xd9a0('0x2d')]=_[_0xd9a0('0x28')](_0x8bc0ad,_0xd9a0('0x26'));_0x7872e['query']=_[_0xd9a0('0x2e')](_0x25e61b[_0xd9a0('0x2f')]);_0x7872e[_0xd9a0('0x30')]=_[_0xd9a0('0x31')](_0x7872e[_0xd9a0('0x2d')],_0x7872e[_0xd9a0('0x2f')]);_0x32b983[_0xd9a0('0x32')]=_[_0xd9a0('0x31')](_0x7872e[_0xd9a0('0x2d')],qs[_0xd9a0('0x33')](_0x25e61b[_0xd9a0('0x2f')][_0xd9a0('0x33')]));_0x32b983[_0xd9a0('0x32')]=_0x32b983[_0xd9a0('0x32')][_0xd9a0('0x34')]?_0x32b983['attributes']:_0x7872e[_0xd9a0('0x2d')];if(!_0x25e61b['query'][_0xd9a0('0x35')](_0xd9a0('0x36'))){_0x32b983[_0xd9a0('0x1d')]=qs[_0xd9a0('0x1d')](_0x25e61b[_0xd9a0('0x2f')][_0xd9a0('0x1d')]);_0x32b983['offset']=qs['offset'](_0x25e61b[_0xd9a0('0x2f')][_0xd9a0('0x1b')]);}_0x32b983['order']=qs[_0xd9a0('0x37')](_0x25e61b['query'][_0xd9a0('0x37')]);_0x32b983['where']=qs[_0xd9a0('0x30')](_[_0xd9a0('0x38')](_0x25e61b[_0xd9a0('0x2f')],_0x7872e[_0xd9a0('0x30')]),_0x8bc0ad);if(_0x25e61b[_0xd9a0('0x2f')][_0xd9a0('0x39')]){_0x32b983[_0xd9a0('0x3a')]=_[_0xd9a0('0x3b')](_0x32b983[_0xd9a0('0x3a')],{'$or':_[_0xd9a0('0x28')](_0x8bc0ad,function(_0xbc4e46){if(_0xbc4e46[_0xd9a0('0x3c')]!=='VIRTUAL'){var _0x4fdef2={};_0x4fdef2[_0xbc4e46[_0xd9a0('0x26')]]={'$like':'%'+_0x25e61b[_0xd9a0('0x2f')][_0xd9a0('0x39')]+'%'};return _0x4fdef2;}})});}_0x32b983=_[_0xd9a0('0x3b')]({},_0x32b983,_0x25e61b[_0xd9a0('0x3d')]);var _0x5efa60={'where':_0x32b983[_0xd9a0('0x3a')]};return db[_0xd9a0('0x29')][_0xd9a0('0x1e')](_0x5efa60)[_0xd9a0('0x22')](function(_0x2dfa25){_0x580620[_0xd9a0('0x1e')]=_0x2dfa25;if(_0x25e61b[_0xd9a0('0x2f')]['includeAll']){_0x32b983[_0xd9a0('0x3e')]=[{'all':!![]}];}return db[_0xd9a0('0x29')][_0xd9a0('0x3f')](_0x32b983);})['then'](function(_0x3c1e9b){_0x580620[_0xd9a0('0x40')]=_0x3c1e9b;return _0x580620;})[_0xd9a0('0x22')](respondWithFilteredResult(_0x1168ed,_0x32b983))[_0xd9a0('0x41')](handleError(_0x1168ed,null));};exports[_0xd9a0('0x42')]=function(_0x3e1d9f,_0x1b369d){var _0x139a33={'raw':![],'where':{'id':_0x3e1d9f[_0xd9a0('0x43')]['id']}},_0x2ab30f={};_0x2ab30f['model']=_[_0xd9a0('0x2e')](db[_0xd9a0('0x29')]['rawAttributes']);_0x2ab30f[_0xd9a0('0x2f')]=_[_0xd9a0('0x2e')](_0x3e1d9f['query']);_0x2ab30f['filters']=_[_0xd9a0('0x31')](_0x2ab30f[_0xd9a0('0x2d')],_0x2ab30f[_0xd9a0('0x2f')]);_0x139a33[_0xd9a0('0x32')]=_[_0xd9a0('0x31')](_0x2ab30f[_0xd9a0('0x2d')],qs[_0xd9a0('0x33')](_0x3e1d9f[_0xd9a0('0x2f')][_0xd9a0('0x33')]));_0x139a33[_0xd9a0('0x32')]=_0x139a33[_0xd9a0('0x32')][_0xd9a0('0x34')]?_0x139a33[_0xd9a0('0x32')]:_0x2ab30f[_0xd9a0('0x2d')];if(_0x3e1d9f['query'][_0xd9a0('0x44')]){_0x139a33['include']=[{'all':!![]}];}_0x139a33=_['merge']({},_0x139a33,_0x3e1d9f[_0xd9a0('0x3d')]);return db[_0xd9a0('0x29')][_0xd9a0('0x45')](_0x139a33)[_0xd9a0('0x22')](handleEntityNotFound(_0x1b369d,null))[_0xd9a0('0x22')](respondWithResult(_0x1b369d,null))[_0xd9a0('0x41')](handleError(_0x1b369d,null));};exports[_0xd9a0('0x46')]=function(_0x91bce,_0x525bbd){return db['ZohoConfiguration'][_0xd9a0('0x46')](_0x91bce[_0xd9a0('0x47')],{})[_0xd9a0('0x22')](respondWithResult(_0x525bbd,0xc9))[_0xd9a0('0x41')](handleError(_0x525bbd,null));};exports[_0xd9a0('0x21')]=function(_0x4b4e1f,_0x68cc3e){if(_0x4b4e1f[_0xd9a0('0x47')]['id']){delete _0x4b4e1f[_0xd9a0('0x47')]['id'];}return db['ZohoConfiguration'][_0xd9a0('0x45')]({'where':{'id':_0x4b4e1f[_0xd9a0('0x43')]['id']}})[_0xd9a0('0x22')](handleEntityNotFound(_0x68cc3e,null))['then'](saveUpdates(_0x4b4e1f[_0xd9a0('0x47')],null))['then'](respondWithResult(_0x68cc3e,null))[_0xd9a0('0x41')](handleError(_0x68cc3e,null));};exports[_0xd9a0('0x23')]=function(_0x4e7609,_0x2a5795){return db[_0xd9a0('0x29')]['find']({'where':{'id':_0x4e7609['params']['id']}})[_0xd9a0('0x22')](handleEntityNotFound(_0x2a5795,null))[_0xd9a0('0x22')](removeEntity(_0x2a5795,null))[_0xd9a0('0x41')](handleError(_0x2a5795,null));};exports[_0xd9a0('0x48')]=function(_0x400f82,_0x2b3133,_0x4240b6){var _0xc26023={};var _0x4a91b5={};var _0x48d849;var _0x84b2c1;return db[_0xd9a0('0x29')]['findOne']({'where':{'id':_0x400f82['params']['id']}})[_0xd9a0('0x22')](handleEntityNotFound(_0x2b3133,null))[_0xd9a0('0x22')](function(_0x3e11b1){if(_0x3e11b1){_0x48d849=_0x3e11b1;_0x4a91b5['model']=_[_0xd9a0('0x2e')](db[_0xd9a0('0x49')]['rawAttributes']);_0x4a91b5[_0xd9a0('0x2f')]=_[_0xd9a0('0x2e')](_0x400f82[_0xd9a0('0x2f')]);_0x4a91b5[_0xd9a0('0x30')]=_[_0xd9a0('0x31')](_0x4a91b5[_0xd9a0('0x2d')],_0x4a91b5[_0xd9a0('0x2f')]);_0xc26023['attributes']=_[_0xd9a0('0x31')](_0x4a91b5[_0xd9a0('0x2d')],qs['fields'](_0x400f82[_0xd9a0('0x2f')][_0xd9a0('0x33')]));_0xc26023[_0xd9a0('0x32')]=_0xc26023['attributes'][_0xd9a0('0x34')]?_0xc26023['attributes']:_0x4a91b5[_0xd9a0('0x2d')];_0xc26023[_0xd9a0('0x4a')]=qs[_0xd9a0('0x37')](_0x400f82['query'][_0xd9a0('0x37')]);_0xc26023['where']=qs['filters'](_['pick'](_0x400f82['query'],_0x4a91b5[_0xd9a0('0x30')]));if(_0x400f82['query'][_0xd9a0('0x39')]){_0xc26023['where']=_['merge'](_0xc26023[_0xd9a0('0x3a')],{'$or':_[_0xd9a0('0x28')](_0xc26023[_0xd9a0('0x32')],function(_0x593582){var _0x23bd35={};_0x23bd35[_0x593582]={'$like':'%'+_0x400f82['query'][_0xd9a0('0x39')]+'%'};return _0x23bd35;})});}_0xc26023=_[_0xd9a0('0x3b')]({},_0xc26023,_0x400f82['options']);return _0x48d849[_0xd9a0('0x48')](_0xc26023);}})[_0xd9a0('0x22')](function(_0x344be9){if(_0x344be9){_0x84b2c1=_0x344be9['length'];if(!_0x400f82[_0xd9a0('0x2f')][_0xd9a0('0x35')](_0xd9a0('0x36'))){_0xc26023[_0xd9a0('0x1d')]=qs[_0xd9a0('0x1d')](_0x400f82[_0xd9a0('0x2f')][_0xd9a0('0x1d')]);_0xc26023[_0xd9a0('0x1b')]=qs[_0xd9a0('0x1b')](_0x400f82[_0xd9a0('0x2f')]['offset']);}return _0x48d849[_0xd9a0('0x48')](_0xc26023);}})[_0xd9a0('0x22')](function(_0x188c9c){if(_0x188c9c){return _0x188c9c?{'count':_0x84b2c1,'rows':_0x188c9c}:null;}})[_0xd9a0('0x22')](respondWithResult(_0x2b3133,null))['catch'](handleError(_0x2b3133,null));};exports[_0xd9a0('0x4b')]=function(_0x56a2d2,_0xdfa5e7,_0x50089d){var _0x49298d={};var _0x3eadeb={};var _0x5bb240;var _0xc3e287;return db[_0xd9a0('0x29')][_0xd9a0('0x4c')]({'where':{'id':_0x56a2d2[_0xd9a0('0x43')]['id']}})[_0xd9a0('0x22')](handleEntityNotFound(_0xdfa5e7,null))[_0xd9a0('0x22')](function(_0x5394a3){if(_0x5394a3){_0x5bb240=_0x5394a3;_0x3eadeb[_0xd9a0('0x2d')]=_['keys'](db['ZohoField']['rawAttributes']);_0x3eadeb['query']=_[_0xd9a0('0x2e')](_0x56a2d2[_0xd9a0('0x2f')]);_0x3eadeb[_0xd9a0('0x30')]=_[_0xd9a0('0x31')](_0x3eadeb[_0xd9a0('0x2d')],_0x3eadeb['query']);_0x49298d[_0xd9a0('0x32')]=_[_0xd9a0('0x31')](_0x3eadeb[_0xd9a0('0x2d')],qs['fields'](_0x56a2d2[_0xd9a0('0x2f')][_0xd9a0('0x33')]));_0x49298d[_0xd9a0('0x32')]=_0x49298d[_0xd9a0('0x32')][_0xd9a0('0x34')]?_0x49298d[_0xd9a0('0x32')]:_0x3eadeb[_0xd9a0('0x2d')];_0x49298d[_0xd9a0('0x4a')]=qs[_0xd9a0('0x37')](_0x56a2d2[_0xd9a0('0x2f')][_0xd9a0('0x37')]);_0x49298d[_0xd9a0('0x3a')]=qs['filters'](_['pick'](_0x56a2d2[_0xd9a0('0x2f')],_0x3eadeb[_0xd9a0('0x30')]));if(_0x56a2d2[_0xd9a0('0x2f')][_0xd9a0('0x39')]){_0x49298d['where']=_[_0xd9a0('0x3b')](_0x49298d[_0xd9a0('0x3a')],{'$or':_[_0xd9a0('0x28')](_0x49298d['attributes'],function(_0x5c588a){var _0x329a7e={};_0x329a7e[_0x5c588a]={'$like':'%'+_0x56a2d2[_0xd9a0('0x2f')][_0xd9a0('0x39')]+'%'};return _0x329a7e;})});}_0x49298d=_[_0xd9a0('0x3b')]({},_0x49298d,_0x56a2d2[_0xd9a0('0x3d')]);return _0x5bb240[_0xd9a0('0x4b')](_0x49298d);}})[_0xd9a0('0x22')](function(_0x279aae){if(_0x279aae){_0xc3e287=_0x279aae[_0xd9a0('0x34')];if(!_0x56a2d2[_0xd9a0('0x2f')][_0xd9a0('0x35')](_0xd9a0('0x36'))){_0x49298d[_0xd9a0('0x1d')]=qs[_0xd9a0('0x1d')](_0x56a2d2[_0xd9a0('0x2f')][_0xd9a0('0x1d')]);_0x49298d[_0xd9a0('0x1b')]=qs[_0xd9a0('0x1b')](_0x56a2d2[_0xd9a0('0x2f')]['offset']);}return _0x5bb240[_0xd9a0('0x4b')](_0x49298d);}})[_0xd9a0('0x22')](function(_0x198c5c){if(_0x198c5c){return _0x198c5c?{'count':_0xc3e287,'rows':_0x198c5c}:null;}})[_0xd9a0('0x22')](respondWithResult(_0xdfa5e7,null))[_0xd9a0('0x41')](handleError(_0xdfa5e7,null));};exports[_0xd9a0('0x4d')]=function(_0x22d548,_0x5700a7,_0x34007b){var _0x23e1c9={};var _0x858418={};var _0x31600c;var _0x12c5ac;return db[_0xd9a0('0x29')][_0xd9a0('0x4c')]({'where':{'id':_0x22d548[_0xd9a0('0x43')]['id']}})[_0xd9a0('0x22')](handleEntityNotFound(_0x5700a7,null))[_0xd9a0('0x22')](function(_0x25b1e8){if(_0x25b1e8){_0x31600c=_0x25b1e8;_0x858418[_0xd9a0('0x2d')]=_[_0xd9a0('0x2e')](db['ZohoField']['rawAttributes']);_0x858418['query']=_[_0xd9a0('0x2e')](_0x22d548[_0xd9a0('0x2f')]);_0x858418[_0xd9a0('0x30')]=_[_0xd9a0('0x31')](_0x858418[_0xd9a0('0x2d')],_0x858418[_0xd9a0('0x2f')]);_0x23e1c9[_0xd9a0('0x32')]=_['intersection'](_0x858418[_0xd9a0('0x2d')],qs[_0xd9a0('0x33')](_0x22d548[_0xd9a0('0x2f')][_0xd9a0('0x33')]));_0x23e1c9['attributes']=_0x23e1c9[_0xd9a0('0x32')]['length']?_0x23e1c9[_0xd9a0('0x32')]:_0x858418[_0xd9a0('0x2d')];_0x23e1c9[_0xd9a0('0x4a')]=qs[_0xd9a0('0x37')](_0x22d548['query']['sort']);_0x23e1c9[_0xd9a0('0x3a')]=qs[_0xd9a0('0x30')](_['pick'](_0x22d548['query'],_0x858418[_0xd9a0('0x30')]));if(_0x22d548[_0xd9a0('0x2f')][_0xd9a0('0x39')]){_0x23e1c9[_0xd9a0('0x3a')]=_[_0xd9a0('0x3b')](_0x23e1c9[_0xd9a0('0x3a')],{'$or':_['map'](_0x23e1c9[_0xd9a0('0x32')],function(_0x64e3c3){var _0x3bae43={};_0x3bae43[_0x64e3c3]={'$like':'%'+_0x22d548[_0xd9a0('0x2f')][_0xd9a0('0x39')]+'%'};return _0x3bae43;})});}_0x23e1c9=_[_0xd9a0('0x3b')]({},_0x23e1c9,_0x22d548[_0xd9a0('0x3d')]);return _0x31600c[_0xd9a0('0x4d')](_0x23e1c9);}})[_0xd9a0('0x22')](function(_0x2ed338){if(_0x2ed338){_0x12c5ac=_0x2ed338[_0xd9a0('0x34')];if(!_0x22d548[_0xd9a0('0x2f')]['hasOwnProperty'](_0xd9a0('0x36'))){_0x23e1c9['limit']=qs[_0xd9a0('0x1d')](_0x22d548['query']['limit']);_0x23e1c9['offset']=qs[_0xd9a0('0x1b')](_0x22d548[_0xd9a0('0x2f')][_0xd9a0('0x1b')]);}return _0x31600c['getDescriptions'](_0x23e1c9);}})[_0xd9a0('0x22')](function(_0x172b77){if(_0x172b77){return _0x172b77?{'count':_0x12c5ac,'rows':_0x172b77}:null;}})[_0xd9a0('0x22')](respondWithResult(_0x5700a7,null))[_0xd9a0('0x41')](handleError(_0x5700a7,null));}; \ No newline at end of file +var _0x3df8=['body','catch','params','getFields','findOne','order','getSubjects','ZohoField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','options','find','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3df8,0xb1));var _0x83df=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0x3df8[_0x131585];return _0x1fcca2;};'use strict';var emlformat=require(_0x83df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83df('0x1'));var jsonpatch=require(_0x83df('0x2'));var rp=require(_0x83df('0x3'));var moment=require(_0x83df('0x4'));var BPromise=require(_0x83df('0x5'));var Mustache=require(_0x83df('0x6'));var util=require(_0x83df('0x7'));var path=require(_0x83df('0x8'));var sox=require('sox');var csv=require(_0x83df('0x9'));var ejs=require(_0x83df('0xa'));var fs=require('fs');var fs_extra=require(_0x83df('0xb'));var _=require(_0x83df('0xc'));var squel=require('squel');var crypto=require(_0x83df('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x83df('0xe'));var toCsv=require(_0x83df('0x9'));var querystring=require(_0x83df('0xf'));var Papa=require(_0x83df('0x10'));var Redis=require(_0x83df('0x11'));var authService=require(_0x83df('0x12'));var qs=require(_0x83df('0x13'));var as=require(_0x83df('0x14'));var hardwareService=require(_0x83df('0x15'));var logger=require(_0x83df('0x16'))('api');var utils=require(_0x83df('0x17'));var config=require(_0x83df('0x18'));var licenseUtil=require(_0x83df('0x19'));var db=require(_0x83df('0x1a'))['db'];function respondWithStatusCode(_0x47dc59,_0x3d112b){_0x3d112b=_0x3d112b||0xcc;return function(_0x31c0df){if(_0x31c0df){return _0x47dc59[_0x83df('0x1b')](_0x3d112b);}return _0x47dc59[_0x83df('0x1c')](_0x3d112b)[_0x83df('0x1d')]();};}function respondWithResult(_0x4d2bba,_0x4843d4){_0x4843d4=_0x4843d4||0xc8;return function(_0x39d305){if(_0x39d305){return _0x4d2bba[_0x83df('0x1c')](_0x4843d4)[_0x83df('0x1e')](_0x39d305);}};}function respondWithFilteredResult(_0x37595e,_0x5ec43b){return function(_0x354d87){if(_0x354d87){var _0x2ed4ce=typeof _0x5ec43b[_0x83df('0x1f')]===_0x83df('0x20')&&typeof _0x5ec43b[_0x83df('0x21')]===_0x83df('0x20');var _0x12e486=_0x354d87[_0x83df('0x22')];var _0x59e2a3=_0x2ed4ce?0x0:_0x5ec43b['offset'];var _0x58d672=_0x2ed4ce?_0x354d87[_0x83df('0x22')]:_0x5ec43b[_0x83df('0x1f')]+_0x5ec43b[_0x83df('0x21')];var _0x555282;if(_0x58d672>=_0x12e486){_0x58d672=_0x12e486;_0x555282=0xc8;}else{_0x555282=0xce;}_0x37595e[_0x83df('0x1c')](_0x555282);return _0x37595e[_0x83df('0x23')]('Content-Range',_0x59e2a3+'-'+_0x58d672+'/'+_0x12e486)[_0x83df('0x1e')](_0x354d87);}return null;};}function patchUpdates(_0x22e11a){return function(_0xa73eb9){try{jsonpatch['apply'](_0xa73eb9,_0x22e11a,!![]);}catch(_0x2f448f){return BPromise[_0x83df('0x24')](_0x2f448f);}return _0xa73eb9[_0x83df('0x25')]();};}function saveUpdates(_0x87bca6,_0x51f824){return function(_0x210040){if(_0x210040){return _0x210040[_0x83df('0x26')](_0x87bca6)[_0x83df('0x27')](function(_0x2e4b09){return _0x2e4b09;});}return null;};}function removeEntity(_0x58184b,_0x21eff2){return function(_0x1ce025){if(_0x1ce025){return _0x1ce025[_0x83df('0x28')]()[_0x83df('0x27')](function(){_0x58184b[_0x83df('0x1c')](0xcc)[_0x83df('0x1d')]();});}};}function handleEntityNotFound(_0x288393,_0x5475c5){return function(_0x56bc99){if(!_0x56bc99){_0x288393[_0x83df('0x1b')](0x194);}return _0x56bc99;};}function handleError(_0x19be34,_0x2929a9){_0x2929a9=_0x2929a9||0x1f4;return function(_0x473df1){logger['error'](_0x473df1[_0x83df('0x29')]);if(_0x473df1[_0x83df('0x2a')]){delete _0x473df1[_0x83df('0x2a')];}_0x19be34[_0x83df('0x1c')](_0x2929a9)[_0x83df('0x2b')](_0x473df1);};}exports[_0x83df('0x2c')]=function(_0x4b5285,_0x492afc){var _0x2ccdd7={},_0x5870f0={},_0x3ea483={'count':0x0,'rows':[]};var _0x2c80fc=_[_0x83df('0x2d')](db[_0x83df('0x2e')][_0x83df('0x2f')],function(_0x8990e1){return{'name':_0x8990e1[_0x83df('0x30')],'type':_0x8990e1[_0x83df('0x31')][_0x83df('0x32')]};});_0x5870f0[_0x83df('0x33')]=_['map'](_0x2c80fc,_0x83df('0x2a'));_0x5870f0[_0x83df('0x34')]=_[_0x83df('0x35')](_0x4b5285[_0x83df('0x34')]);_0x5870f0[_0x83df('0x36')]=_[_0x83df('0x37')](_0x5870f0[_0x83df('0x33')],_0x5870f0['query']);_0x2ccdd7[_0x83df('0x38')]=_[_0x83df('0x37')](_0x5870f0[_0x83df('0x33')],qs['fields'](_0x4b5285[_0x83df('0x34')][_0x83df('0x39')]));_0x2ccdd7[_0x83df('0x38')]=_0x2ccdd7[_0x83df('0x38')][_0x83df('0x3a')]?_0x2ccdd7[_0x83df('0x38')]:_0x5870f0[_0x83df('0x33')];if(!_0x4b5285['query'][_0x83df('0x3b')](_0x83df('0x3c'))){_0x2ccdd7['limit']=qs[_0x83df('0x21')](_0x4b5285[_0x83df('0x34')][_0x83df('0x21')]);_0x2ccdd7[_0x83df('0x1f')]=qs[_0x83df('0x1f')](_0x4b5285[_0x83df('0x34')][_0x83df('0x1f')]);}_0x2ccdd7['order']=qs[_0x83df('0x3d')](_0x4b5285[_0x83df('0x34')][_0x83df('0x3d')]);_0x2ccdd7['where']=qs[_0x83df('0x36')](_[_0x83df('0x3e')](_0x4b5285['query'],_0x5870f0[_0x83df('0x36')]),_0x2c80fc);if(_0x4b5285[_0x83df('0x34')]['filter']){_0x2ccdd7[_0x83df('0x3f')]=_[_0x83df('0x40')](_0x2ccdd7[_0x83df('0x3f')],{'$or':_['map'](_0x2c80fc,function(_0x3d3347){if(_0x3d3347['type']!==_0x83df('0x41')){var _0x568508={};_0x568508[_0x3d3347[_0x83df('0x2a')]]={'$like':'%'+_0x4b5285[_0x83df('0x34')][_0x83df('0x42')]+'%'};return _0x568508;}})});}_0x2ccdd7=_[_0x83df('0x40')]({},_0x2ccdd7,_0x4b5285['options']);var _0x1f4a90={'where':_0x2ccdd7['where']};return db[_0x83df('0x2e')]['count'](_0x1f4a90)['then'](function(_0x57e7e8){_0x3ea483[_0x83df('0x22')]=_0x57e7e8;if(_0x4b5285[_0x83df('0x34')][_0x83df('0x43')]){_0x2ccdd7[_0x83df('0x44')]=[{'all':!![]}];}return db[_0x83df('0x2e')][_0x83df('0x45')](_0x2ccdd7);})[_0x83df('0x27')](function(_0x43c6b3){_0x3ea483[_0x83df('0x46')]=_0x43c6b3;return _0x3ea483;})[_0x83df('0x27')](respondWithFilteredResult(_0x492afc,_0x2ccdd7))['catch'](handleError(_0x492afc,null));};exports[_0x83df('0x47')]=function(_0x18b93e,_0x3edb08){var _0x36ab94={'raw':![],'where':{'id':_0x18b93e['params']['id']}},_0x2dc2e6={};_0x2dc2e6[_0x83df('0x33')]=_[_0x83df('0x35')](db[_0x83df('0x2e')]['rawAttributes']);_0x2dc2e6['query']=_[_0x83df('0x35')](_0x18b93e[_0x83df('0x34')]);_0x2dc2e6[_0x83df('0x36')]=_[_0x83df('0x37')](_0x2dc2e6[_0x83df('0x33')],_0x2dc2e6['query']);_0x36ab94['attributes']=_[_0x83df('0x37')](_0x2dc2e6[_0x83df('0x33')],qs[_0x83df('0x39')](_0x18b93e['query'][_0x83df('0x39')]));_0x36ab94['attributes']=_0x36ab94[_0x83df('0x38')]['length']?_0x36ab94[_0x83df('0x38')]:_0x2dc2e6[_0x83df('0x33')];if(_0x18b93e[_0x83df('0x34')]['includeAll']){_0x36ab94['include']=[{'all':!![]}];}_0x36ab94=_[_0x83df('0x40')]({},_0x36ab94,_0x18b93e[_0x83df('0x48')]);return db[_0x83df('0x2e')][_0x83df('0x49')](_0x36ab94)['then'](handleEntityNotFound(_0x3edb08,null))[_0x83df('0x27')](respondWithResult(_0x3edb08,null))['catch'](handleError(_0x3edb08,null));};exports[_0x83df('0x4a')]=function(_0x440a3f,_0x152190){return db['ZohoConfiguration'][_0x83df('0x4a')](_0x440a3f[_0x83df('0x4b')],{})['then'](respondWithResult(_0x152190,0xc9))[_0x83df('0x4c')](handleError(_0x152190,null));};exports[_0x83df('0x26')]=function(_0x2ee06f,_0x5a0a5f){if(_0x2ee06f[_0x83df('0x4b')]['id']){delete _0x2ee06f[_0x83df('0x4b')]['id'];}return db[_0x83df('0x2e')][_0x83df('0x49')]({'where':{'id':_0x2ee06f[_0x83df('0x4d')]['id']}})[_0x83df('0x27')](handleEntityNotFound(_0x5a0a5f,null))[_0x83df('0x27')](saveUpdates(_0x2ee06f[_0x83df('0x4b')],null))[_0x83df('0x27')](respondWithResult(_0x5a0a5f,null))[_0x83df('0x4c')](handleError(_0x5a0a5f,null));};exports[_0x83df('0x28')]=function(_0x107478,_0x4ca530){return db[_0x83df('0x2e')][_0x83df('0x49')]({'where':{'id':_0x107478[_0x83df('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4ca530,null))[_0x83df('0x27')](removeEntity(_0x4ca530,null))[_0x83df('0x4c')](handleError(_0x4ca530,null));};exports[_0x83df('0x4e')]=function(_0xf3ea21,_0x2313bd,_0x2b8b10){var _0x13a9df={};var _0x211123={};var _0x4c3f49;var _0x39df09;return db[_0x83df('0x2e')][_0x83df('0x4f')]({'where':{'id':_0xf3ea21[_0x83df('0x4d')]['id']}})[_0x83df('0x27')](handleEntityNotFound(_0x2313bd,null))[_0x83df('0x27')](function(_0x1ee464){if(_0x1ee464){_0x4c3f49=_0x1ee464;_0x211123[_0x83df('0x33')]=_[_0x83df('0x35')](db['ZohoField'][_0x83df('0x2f')]);_0x211123[_0x83df('0x34')]=_[_0x83df('0x35')](_0xf3ea21['query']);_0x211123['filters']=_[_0x83df('0x37')](_0x211123['model'],_0x211123[_0x83df('0x34')]);_0x13a9df['attributes']=_[_0x83df('0x37')](_0x211123[_0x83df('0x33')],qs[_0x83df('0x39')](_0xf3ea21[_0x83df('0x34')][_0x83df('0x39')]));_0x13a9df[_0x83df('0x38')]=_0x13a9df[_0x83df('0x38')]['length']?_0x13a9df['attributes']:_0x211123[_0x83df('0x33')];_0x13a9df[_0x83df('0x50')]=qs['sort'](_0xf3ea21['query'][_0x83df('0x3d')]);_0x13a9df['where']=qs[_0x83df('0x36')](_['pick'](_0xf3ea21[_0x83df('0x34')],_0x211123[_0x83df('0x36')]));if(_0xf3ea21[_0x83df('0x34')][_0x83df('0x42')]){_0x13a9df[_0x83df('0x3f')]=_[_0x83df('0x40')](_0x13a9df['where'],{'$or':_[_0x83df('0x2d')](_0x13a9df[_0x83df('0x38')],function(_0x241cc9){var _0x347187={};_0x347187[_0x241cc9]={'$like':'%'+_0xf3ea21['query']['filter']+'%'};return _0x347187;})});}_0x13a9df=_[_0x83df('0x40')]({},_0x13a9df,_0xf3ea21['options']);return _0x4c3f49['getFields'](_0x13a9df);}})[_0x83df('0x27')](function(_0x101079){if(_0x101079){_0x39df09=_0x101079[_0x83df('0x3a')];if(!_0xf3ea21[_0x83df('0x34')][_0x83df('0x3b')](_0x83df('0x3c'))){_0x13a9df[_0x83df('0x21')]=qs[_0x83df('0x21')](_0xf3ea21['query']['limit']);_0x13a9df[_0x83df('0x1f')]=qs[_0x83df('0x1f')](_0xf3ea21[_0x83df('0x34')][_0x83df('0x1f')]);}return _0x4c3f49[_0x83df('0x4e')](_0x13a9df);}})[_0x83df('0x27')](function(_0x38afa0){if(_0x38afa0){return _0x38afa0?{'count':_0x39df09,'rows':_0x38afa0}:null;}})[_0x83df('0x27')](respondWithResult(_0x2313bd,null))['catch'](handleError(_0x2313bd,null));};exports[_0x83df('0x51')]=function(_0x47eace,_0x3d5daf,_0x5aaaba){var _0x46a9bc={};var _0x1dbae6={};var _0x3990d2;var _0x561f5c;return db['ZohoConfiguration'][_0x83df('0x4f')]({'where':{'id':_0x47eace[_0x83df('0x4d')]['id']}})[_0x83df('0x27')](handleEntityNotFound(_0x3d5daf,null))[_0x83df('0x27')](function(_0x133930){if(_0x133930){_0x3990d2=_0x133930;_0x1dbae6[_0x83df('0x33')]=_['keys'](db[_0x83df('0x52')]['rawAttributes']);_0x1dbae6[_0x83df('0x34')]=_[_0x83df('0x35')](_0x47eace[_0x83df('0x34')]);_0x1dbae6[_0x83df('0x36')]=_['intersection'](_0x1dbae6[_0x83df('0x33')],_0x1dbae6[_0x83df('0x34')]);_0x46a9bc[_0x83df('0x38')]=_[_0x83df('0x37')](_0x1dbae6[_0x83df('0x33')],qs['fields'](_0x47eace[_0x83df('0x34')]['fields']));_0x46a9bc[_0x83df('0x38')]=_0x46a9bc['attributes'][_0x83df('0x3a')]?_0x46a9bc['attributes']:_0x1dbae6['model'];_0x46a9bc[_0x83df('0x50')]=qs[_0x83df('0x3d')](_0x47eace['query'][_0x83df('0x3d')]);_0x46a9bc[_0x83df('0x3f')]=qs['filters'](_['pick'](_0x47eace[_0x83df('0x34')],_0x1dbae6[_0x83df('0x36')]));if(_0x47eace[_0x83df('0x34')][_0x83df('0x42')]){_0x46a9bc[_0x83df('0x3f')]=_[_0x83df('0x40')](_0x46a9bc[_0x83df('0x3f')],{'$or':_['map'](_0x46a9bc['attributes'],function(_0x39ff63){var _0x194b0c={};_0x194b0c[_0x39ff63]={'$like':'%'+_0x47eace['query'][_0x83df('0x42')]+'%'};return _0x194b0c;})});}_0x46a9bc=_[_0x83df('0x40')]({},_0x46a9bc,_0x47eace['options']);return _0x3990d2[_0x83df('0x51')](_0x46a9bc);}})['then'](function(_0x49792f){if(_0x49792f){_0x561f5c=_0x49792f[_0x83df('0x3a')];if(!_0x47eace[_0x83df('0x34')]['hasOwnProperty'](_0x83df('0x3c'))){_0x46a9bc[_0x83df('0x21')]=qs[_0x83df('0x21')](_0x47eace[_0x83df('0x34')][_0x83df('0x21')]);_0x46a9bc[_0x83df('0x1f')]=qs[_0x83df('0x1f')](_0x47eace[_0x83df('0x34')][_0x83df('0x1f')]);}return _0x3990d2[_0x83df('0x51')](_0x46a9bc);}})[_0x83df('0x27')](function(_0x17620c){if(_0x17620c){return _0x17620c?{'count':_0x561f5c,'rows':_0x17620c}:null;}})[_0x83df('0x27')](respondWithResult(_0x3d5daf,null))[_0x83df('0x4c')](handleError(_0x3d5daf,null));};exports['getDescriptions']=function(_0x50433e,_0x1fb407,_0x5b473c){var _0x6f1a2a={};var _0x445ef4={};var _0x3fd948;var _0x3e0e20;return db[_0x83df('0x2e')][_0x83df('0x4f')]({'where':{'id':_0x50433e[_0x83df('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1fb407,null))[_0x83df('0x27')](function(_0x35b099){if(_0x35b099){_0x3fd948=_0x35b099;_0x445ef4['model']=_[_0x83df('0x35')](db[_0x83df('0x52')]['rawAttributes']);_0x445ef4['query']=_[_0x83df('0x35')](_0x50433e[_0x83df('0x34')]);_0x445ef4[_0x83df('0x36')]=_[_0x83df('0x37')](_0x445ef4[_0x83df('0x33')],_0x445ef4[_0x83df('0x34')]);_0x6f1a2a[_0x83df('0x38')]=_['intersection'](_0x445ef4[_0x83df('0x33')],qs['fields'](_0x50433e[_0x83df('0x34')][_0x83df('0x39')]));_0x6f1a2a[_0x83df('0x38')]=_0x6f1a2a[_0x83df('0x38')]['length']?_0x6f1a2a[_0x83df('0x38')]:_0x445ef4[_0x83df('0x33')];_0x6f1a2a[_0x83df('0x50')]=qs[_0x83df('0x3d')](_0x50433e[_0x83df('0x34')][_0x83df('0x3d')]);_0x6f1a2a[_0x83df('0x3f')]=qs[_0x83df('0x36')](_[_0x83df('0x3e')](_0x50433e[_0x83df('0x34')],_0x445ef4[_0x83df('0x36')]));if(_0x50433e[_0x83df('0x34')]['filter']){_0x6f1a2a[_0x83df('0x3f')]=_['merge'](_0x6f1a2a[_0x83df('0x3f')],{'$or':_[_0x83df('0x2d')](_0x6f1a2a[_0x83df('0x38')],function(_0x11145d){var _0x1aafb0={};_0x1aafb0[_0x11145d]={'$like':'%'+_0x50433e[_0x83df('0x34')]['filter']+'%'};return _0x1aafb0;})});}_0x6f1a2a=_[_0x83df('0x40')]({},_0x6f1a2a,_0x50433e['options']);return _0x3fd948[_0x83df('0x53')](_0x6f1a2a);}})[_0x83df('0x27')](function(_0x5f0690){if(_0x5f0690){_0x3e0e20=_0x5f0690[_0x83df('0x3a')];if(!_0x50433e['query'][_0x83df('0x3b')](_0x83df('0x3c'))){_0x6f1a2a[_0x83df('0x21')]=qs[_0x83df('0x21')](_0x50433e[_0x83df('0x34')][_0x83df('0x21')]);_0x6f1a2a['offset']=qs[_0x83df('0x1f')](_0x50433e[_0x83df('0x34')]['offset']);}return _0x3fd948['getDescriptions'](_0x6f1a2a);}})[_0x83df('0x27')](function(_0x2b7581){if(_0x2b7581){return _0x2b7581?{'count':_0x3e0e20,'rows':_0x2b7581}:null;}})['then'](respondWithResult(_0x1fb407,null))[_0x83df('0x4c')](handleError(_0x1fb407,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 378b11c..878ce91 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 _0xba90=['exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x448812,_0x4febaa){var _0x516849=function(_0x384816){while(--_0x384816){_0x448812['push'](_0x448812['shift']());}};_0x516849(++_0x4febaa);}(_0xba90,0xff));var _0x0ba9=function(_0x2ec97c,_0x40b337){_0x2ec97c=_0x2ec97c-0x0;var _0x1a0086=_0xba90[_0x2ec97c];return _0x1a0086;};'use strict';var _=require(_0x0ba9('0x0'));var util=require(_0x0ba9('0x1'));var logger=require(_0x0ba9('0x2'))(_0x0ba9('0x3'));var moment=require(_0x0ba9('0x4'));var BPromise=require('bluebird');var rp=require(_0x0ba9('0x5'));var fs=require('fs');var path=require(_0x0ba9('0x6'));var rimraf=require('rimraf');var config=require(_0x0ba9('0x7'));var attributes=require(_0x0ba9('0x8'));module[_0x0ba9('0x9')]=function(_0x59617d,_0x4036cd){return _0x59617d['define'](_0x0ba9('0xa'),attributes,{'tableName':_0x0ba9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0457=['ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x44ee1b,_0x107b8b){var _0x4bcc7f=function(_0x145250){while(--_0x145250){_0x44ee1b['push'](_0x44ee1b['shift']());}};_0x4bcc7f(++_0x107b8b);}(_0x0457,0x15e));var _0x7045=function(_0x3dfb56,_0xfe844d){_0x3dfb56=_0x3dfb56-0x0;var _0x5e6e1b=_0x0457[_0x3dfb56];return _0x5e6e1b;};'use strict';var _=require('lodash');var util=require(_0x7045('0x0'));var logger=require(_0x7045('0x1'))(_0x7045('0x2'));var moment=require('moment');var BPromise=require(_0x7045('0x3'));var rp=require(_0x7045('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7045('0x5'));var config=require(_0x7045('0x6'));var attributes=require(_0x7045('0x7'));module[_0x7045('0x8')]=function(_0x62a324,_0x5650e3){return _0x62a324[_0x7045('0x9')](_0x7045('0xa'),attributes,{'tableName':_0x7045('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 591d05b..9fa2653 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 _0x33e1=['request\x20sent','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2b476b,_0x56d116){var _0x3b448e=function(_0x250a4e){while(--_0x250a4e){_0x2b476b['push'](_0x2b476b['shift']());}};_0x3b448e(++_0x56d116);}(_0x33e1,0x15a));var _0x133e=function(_0x48e5b1,_0x3c22ba){_0x48e5b1=_0x48e5b1-0x0;var _0x2c5bb0=_0x33e1[_0x48e5b1];return _0x2c5bb0;};'use strict';var _=require(_0x133e('0x0'));var util=require('util');var moment=require(_0x133e('0x1'));var BPromise=require('bluebird');var rs=require(_0x133e('0x2'));var fs=require('fs');var Redis=require(_0x133e('0x3'));var db=require(_0x133e('0x4'))['db'];var utils=require(_0x133e('0x5'));var logger=require(_0x133e('0x6'))(_0x133e('0x7'));var config=require('../../config/environment');var jayson=require(_0x133e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4daf25,_0x170ab0,_0x57177b){return new BPromise(function(_0x1911b2,_0x792788){return client[_0x133e('0x9')](_0x4daf25,_0x57177b)['then'](function(_0x106f03){logger[_0x133e('0xa')](_0x133e('0xb'),_0x170ab0,'request\x20sent');logger[_0x133e('0xc')](_0x133e('0xd'),_0x170ab0,_0x133e('0xe'),JSON[_0x133e('0xf')](_0x106f03));if(_0x106f03[_0x133e('0x10')]){if(_0x106f03[_0x133e('0x10')][_0x133e('0x11')]===0x1f4){logger[_0x133e('0x10')](_0x133e('0xb'),_0x170ab0,_0x106f03[_0x133e('0x10')][_0x133e('0x12')]);return _0x792788(_0x106f03['error'][_0x133e('0x12')]);}logger[_0x133e('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x170ab0,_0x106f03['error']['message']);return _0x1911b2(_0x106f03[_0x133e('0x10')][_0x133e('0x12')]);}else{logger['info'](_0x133e('0xb'),_0x170ab0,_0x133e('0xe'));_0x1911b2(_0x106f03[_0x133e('0x13')]['message']);}})['catch'](function(_0x2de385){logger[_0x133e('0x10')](_0x133e('0xb'),_0x170ab0,_0x2de385);_0x792788(_0x2de385);});});} \ No newline at end of file +var _0x4b3f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e487f,_0x3cbc99){var _0x50de83=function(_0x104e75){while(--_0x104e75){_0x4e487f['push'](_0x4e487f['shift']());}};_0x50de83(++_0x3cbc99);}(_0x4b3f,0x9a));var _0xf4b3=function(_0x84594,_0x266140){_0x84594=_0x84594-0x0;var _0x5d755f=_0x4b3f[_0x84594];return _0x5d755f;};'use strict';var _=require(_0xf4b3('0x0'));var util=require(_0xf4b3('0x1'));var moment=require(_0xf4b3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4b3('0x4'))['db'];var utils=require(_0xf4b3('0x5'));var logger=require(_0xf4b3('0x6'))(_0xf4b3('0x7'));var config=require(_0xf4b3('0x8'));var jayson=require(_0xf4b3('0x9'));var client=jayson[_0xf4b3('0xa')][_0xf4b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c713a,_0x49419b,_0x4d5feb){return new BPromise(function(_0x1b26b5,_0x3464f9){return client[_0xf4b3('0xc')](_0x5c713a,_0x4d5feb)[_0xf4b3('0xd')](function(_0x9115ba){logger[_0xf4b3('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x49419b,_0xf4b3('0xf'));logger[_0xf4b3('0x10')](_0xf4b3('0x11'),_0x49419b,_0xf4b3('0xf'),JSON[_0xf4b3('0x12')](_0x9115ba));if(_0x9115ba[_0xf4b3('0x13')]){if(_0x9115ba[_0xf4b3('0x13')]['code']===0x1f4){logger[_0xf4b3('0x13')](_0xf4b3('0x14'),_0x49419b,_0x9115ba['error'][_0xf4b3('0x15')]);return _0x3464f9(_0x9115ba[_0xf4b3('0x13')]['message']);}logger['error'](_0xf4b3('0x14'),_0x49419b,_0x9115ba[_0xf4b3('0x13')][_0xf4b3('0x15')]);return _0x1b26b5(_0x9115ba[_0xf4b3('0x13')][_0xf4b3('0x15')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x49419b,_0xf4b3('0xf'));_0x1b26b5(_0x9115ba['result'][_0xf4b3('0x15')]);}})[_0xf4b3('0x16')](function(_0x218d7d){logger[_0xf4b3('0x13')](_0xf4b3('0x14'),_0x49419b,_0x218d7d);_0x3464f9(_0x218d7d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 3269b01..c2f6c3c 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 _0x5f5b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util'];(function(_0x7530f,_0x2f8c1e){var _0x399090=function(_0x45e91f){while(--_0x45e91f){_0x7530f['push'](_0x7530f['shift']());}};_0x399090(++_0x2f8c1e);}(_0x5f5b,0x12a));var _0xb5f5=function(_0x53bf67,_0x4a3559){_0x53bf67=_0x53bf67-0x0;var _0x1a2701=_0x5f5b[_0x53bf67];return _0x1a2701;};'use strict';var multer=require(_0xb5f5('0x0'));var util=require(_0xb5f5('0x1'));var path=require(_0xb5f5('0x2'));var timeout=require(_0xb5f5('0x3'));var express=require(_0xb5f5('0x4'));var router=express[_0xb5f5('0x5')]();var fs_extra=require(_0xb5f5('0x6'));var auth=require(_0xb5f5('0x7'));var interaction=require(_0xb5f5('0x8'));var config=require(_0xb5f5('0x9'));var controller=require('./intZohoField.controller');router[_0xb5f5('0xa')]('/',auth[_0xb5f5('0xb')](),controller[_0xb5f5('0xc')]);router[_0xb5f5('0xa')](_0xb5f5('0xd'),auth[_0xb5f5('0xb')](),controller[_0xb5f5('0xe')]);router['post']('/',auth[_0xb5f5('0xb')](),controller[_0xb5f5('0xf')]);router['put'](_0xb5f5('0xd'),auth[_0xb5f5('0xb')](),controller[_0xb5f5('0x10')]);router[_0xb5f5('0x11')]('/:id',auth[_0xb5f5('0xb')](),controller[_0xb5f5('0x12')]);module[_0xb5f5('0x13')]=router; \ No newline at end of file +var _0x5964=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x5964,0x121));var _0x4596=function(_0xc08f00,_0x28067f){_0xc08f00=_0xc08f00-0x0;var _0x8649f7=_0x5964[_0xc08f00];return _0x8649f7;};'use strict';var multer=require('multer');var util=require(_0x4596('0x0'));var path=require(_0x4596('0x1'));var timeout=require(_0x4596('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4596('0x3'));var interaction=require(_0x4596('0x4'));var config=require(_0x4596('0x5'));var controller=require(_0x4596('0x6'));router['get']('/',auth[_0x4596('0x7')](),controller[_0x4596('0x8')]);router[_0x4596('0x9')](_0x4596('0xa'),auth[_0x4596('0x7')](),controller[_0x4596('0xb')]);router[_0x4596('0xc')]('/',auth['isAuthenticated'](),controller[_0x4596('0xd')]);router['put'](_0x4596('0xa'),auth[_0x4596('0x7')](),controller[_0x4596('0xe')]);router[_0x4596('0xf')](_0x4596('0xa'),auth[_0x4596('0x7')](),controller[_0x4596('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 21ab28a..a34d965 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 _0x7fa4=['exports','ENUM','string','variable','picklist','STRING','customVariable','sequelize'];(function(_0x462e64,_0x4f8df1){var _0xaa7ab8=function(_0x3889d9){while(--_0x3889d9){_0x462e64['push'](_0x462e64['shift']());}};_0xaa7ab8(++_0x4f8df1);}(_0x7fa4,0x1d7));var _0x47fa=function(_0x1b79e9,_0x411e99){_0x1b79e9=_0x1b79e9-0x0;var _0x42d199=_0x7fa4[_0x1b79e9];return _0x42d199;};'use strict';var Sequelize=require(_0x47fa('0x0'));module[_0x47fa('0x1')]={'type':{'type':Sequelize[_0x47fa('0x2')](_0x47fa('0x3'),_0x47fa('0x4'),'customVariable','keyValue',_0x47fa('0x5')),'defaultValue':_0x47fa('0x3')},'content':{'type':Sequelize[_0x47fa('0x6')]},'key':{'type':Sequelize[_0x47fa('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x47fa('0x3'),'variable',_0x47fa('0x7'))},'keyContent':{'type':Sequelize[_0x47fa('0x6')]},'idField':{'type':Sequelize[_0x47fa('0x6')]},'nameField':{'type':Sequelize[_0x47fa('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0df3=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x1d5357,_0x3c412b){var _0x2da485=function(_0x24dc25){while(--_0x24dc25){_0x1d5357['push'](_0x1d5357['shift']());}};_0x2da485(++_0x3c412b);}(_0x0df3,0x83));var _0x30df=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x0df3[_0x15a8fa];return _0x1355c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x30df('0x0')](_0x30df('0x1'),_0x30df('0x2'),_0x30df('0x3'),_0x30df('0x4'),_0x30df('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x30df('0x6')]},'key':{'type':Sequelize[_0x30df('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x30df('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x30df('0x6')]},'customField':{'type':Sequelize[_0x30df('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x30df('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6e5ad5c..356110a 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 _0x0498=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','destroy','then','end','error','name','send','index','map','ZohoField','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','options','include','rows','show','params','rawAttributes','length','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x57a50d,_0x2871f8){var _0x1b25b3=function(_0x45691e){while(--_0x45691e){_0x57a50d['push'](_0x57a50d['shift']());}};_0x1b25b3(++_0x2871f8);}(_0x0498,0xc6));var _0x8049=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0498[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x8049('0x0'));var rimraf=require(_0x8049('0x1'));var zipdir=require(_0x8049('0x2'));var jsonpatch=require(_0x8049('0x3'));var rp=require(_0x8049('0x4'));var moment=require(_0x8049('0x5'));var BPromise=require(_0x8049('0x6'));var Mustache=require(_0x8049('0x7'));var util=require(_0x8049('0x8'));var path=require(_0x8049('0x9'));var sox=require('sox');var csv=require(_0x8049('0xa'));var ejs=require(_0x8049('0xb'));var fs=require('fs');var fs_extra=require(_0x8049('0xc'));var _=require(_0x8049('0xd'));var squel=require(_0x8049('0xe'));var crypto=require('crypto');var jsforce=require(_0x8049('0xf'));var deskjs=require(_0x8049('0x10'));var toCsv=require(_0x8049('0xa'));var querystring=require(_0x8049('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8049('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8049('0x13'));var hardwareService=require(_0x8049('0x14'));var logger=require(_0x8049('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8049('0x16'));var licenseUtil=require(_0x8049('0x17'));var db=require(_0x8049('0x18'))['db'];function respondWithStatusCode(_0xe708f5,_0x257437){_0x257437=_0x257437||0xcc;return function(_0x20000e){if(_0x20000e){return _0xe708f5[_0x8049('0x19')](_0x257437);}return _0xe708f5[_0x8049('0x1a')](_0x257437)['end']();};}function respondWithResult(_0xfe0ecd,_0x3f0149){_0x3f0149=_0x3f0149||0xc8;return function(_0x53b3d6){if(_0x53b3d6){return _0xfe0ecd['status'](_0x3f0149)[_0x8049('0x1b')](_0x53b3d6);}};}function respondWithFilteredResult(_0x3b4a0b,_0x2eca1b){return function(_0x4471f0){if(_0x4471f0){var _0x5b52f6=typeof _0x2eca1b[_0x8049('0x1c')]===_0x8049('0x1d')&&typeof _0x2eca1b[_0x8049('0x1e')]===_0x8049('0x1d');var _0x1b9669=_0x4471f0[_0x8049('0x1f')];var _0x5923c0=_0x5b52f6?0x0:_0x2eca1b[_0x8049('0x1c')];var _0x5f4610=_0x5b52f6?_0x4471f0[_0x8049('0x1f')]:_0x2eca1b['offset']+_0x2eca1b[_0x8049('0x1e')];var _0x2ec28d;if(_0x5f4610>=_0x1b9669){_0x5f4610=_0x1b9669;_0x2ec28d=0xc8;}else{_0x2ec28d=0xce;}_0x3b4a0b[_0x8049('0x1a')](_0x2ec28d);return _0x3b4a0b['set']('Content-Range',_0x5923c0+'-'+_0x5f4610+'/'+_0x1b9669)[_0x8049('0x1b')](_0x4471f0);}return null;};}function patchUpdates(_0x3f2570){return function(_0x4a4b29){try{jsonpatch[_0x8049('0x20')](_0x4a4b29,_0x3f2570,!![]);}catch(_0x118587){return BPromise[_0x8049('0x21')](_0x118587);}return _0x4a4b29[_0x8049('0x22')]();};}function saveUpdates(_0x4b3b4e,_0x555fd9){return function(_0x41f1a4){if(_0x41f1a4){return _0x41f1a4['update'](_0x4b3b4e)['then'](function(_0x1c87c0){return _0x1c87c0;});}return null;};}function removeEntity(_0x4e39c3,_0x54a30a){return function(_0x2d19c6){if(_0x2d19c6){return _0x2d19c6[_0x8049('0x23')]()[_0x8049('0x24')](function(){_0x4e39c3[_0x8049('0x1a')](0xcc)[_0x8049('0x25')]();});}};}function handleEntityNotFound(_0x126f9c,_0x4a5577){return function(_0x528b3c){if(!_0x528b3c){_0x126f9c[_0x8049('0x19')](0x194);}return _0x528b3c;};}function handleError(_0x13c3fd,_0x2c6627){_0x2c6627=_0x2c6627||0x1f4;return function(_0x4c7a75){logger[_0x8049('0x26')](_0x4c7a75['stack']);if(_0x4c7a75[_0x8049('0x27')]){delete _0x4c7a75[_0x8049('0x27')];}_0x13c3fd[_0x8049('0x1a')](_0x2c6627)[_0x8049('0x28')](_0x4c7a75);};}exports[_0x8049('0x29')]=function(_0x3e68fa,_0x477ce6){var _0x22c761={},_0x2e2edf={},_0xbf78b3={'count':0x0,'rows':[]};var _0x2ae2f4=_[_0x8049('0x2a')](db[_0x8049('0x2b')]['rawAttributes'],function(_0x20cda3){return{'name':_0x20cda3[_0x8049('0x2c')],'type':_0x20cda3['type'][_0x8049('0x2d')]};});_0x2e2edf[_0x8049('0x2e')]=_[_0x8049('0x2a')](_0x2ae2f4,_0x8049('0x27'));_0x2e2edf[_0x8049('0x2f')]=_[_0x8049('0x30')](_0x3e68fa[_0x8049('0x2f')]);_0x2e2edf[_0x8049('0x31')]=_[_0x8049('0x32')](_0x2e2edf[_0x8049('0x2e')],_0x2e2edf[_0x8049('0x2f')]);_0x22c761['attributes']=_[_0x8049('0x32')](_0x2e2edf[_0x8049('0x2e')],qs[_0x8049('0x33')](_0x3e68fa[_0x8049('0x2f')][_0x8049('0x33')]));_0x22c761[_0x8049('0x34')]=_0x22c761[_0x8049('0x34')]['length']?_0x22c761['attributes']:_0x2e2edf[_0x8049('0x2e')];if(!_0x3e68fa[_0x8049('0x2f')][_0x8049('0x35')](_0x8049('0x36'))){_0x22c761[_0x8049('0x1e')]=qs['limit'](_0x3e68fa[_0x8049('0x2f')][_0x8049('0x1e')]);_0x22c761[_0x8049('0x1c')]=qs[_0x8049('0x1c')](_0x3e68fa['query'][_0x8049('0x1c')]);}_0x22c761[_0x8049('0x37')]=qs[_0x8049('0x38')](_0x3e68fa[_0x8049('0x2f')][_0x8049('0x38')]);_0x22c761['where']=qs[_0x8049('0x31')](_[_0x8049('0x39')](_0x3e68fa[_0x8049('0x2f')],_0x2e2edf[_0x8049('0x31')]),_0x2ae2f4);if(_0x3e68fa[_0x8049('0x2f')]['filter']){_0x22c761[_0x8049('0x3a')]=_[_0x8049('0x3b')](_0x22c761[_0x8049('0x3a')],{'$or':_[_0x8049('0x2a')](_0x2ae2f4,function(_0x5eacdd){if(_0x5eacdd[_0x8049('0x3c')]!=='VIRTUAL'){var _0xb3f6e5={};_0xb3f6e5[_0x5eacdd[_0x8049('0x27')]]={'$like':'%'+_0x3e68fa['query']['filter']+'%'};return _0xb3f6e5;}})});}_0x22c761=_[_0x8049('0x3b')]({},_0x22c761,_0x3e68fa[_0x8049('0x3d')]);var _0x36b5da={'where':_0x22c761[_0x8049('0x3a')]};return db['ZohoField'][_0x8049('0x1f')](_0x36b5da)[_0x8049('0x24')](function(_0x6eb949){_0xbf78b3['count']=_0x6eb949;if(_0x3e68fa[_0x8049('0x2f')]['includeAll']){_0x22c761[_0x8049('0x3e')]=[{'all':!![]}];}return db[_0x8049('0x2b')]['findAll'](_0x22c761);})[_0x8049('0x24')](function(_0x32f154){_0xbf78b3[_0x8049('0x3f')]=_0x32f154;return _0xbf78b3;})[_0x8049('0x24')](respondWithFilteredResult(_0x477ce6,_0x22c761))['catch'](handleError(_0x477ce6,null));};exports[_0x8049('0x40')]=function(_0x561553,_0x28742b){var _0x3ffeeb={'raw':!![],'where':{'id':_0x561553[_0x8049('0x41')]['id']}},_0x3a7b43={};_0x3a7b43['model']=_[_0x8049('0x30')](db[_0x8049('0x2b')][_0x8049('0x42')]);_0x3a7b43[_0x8049('0x2f')]=_[_0x8049('0x30')](_0x561553['query']);_0x3a7b43[_0x8049('0x31')]=_[_0x8049('0x32')](_0x3a7b43[_0x8049('0x2e')],_0x3a7b43['query']);_0x3ffeeb[_0x8049('0x34')]=_[_0x8049('0x32')](_0x3a7b43[_0x8049('0x2e')],qs[_0x8049('0x33')](_0x561553[_0x8049('0x2f')][_0x8049('0x33')]));_0x3ffeeb[_0x8049('0x34')]=_0x3ffeeb['attributes'][_0x8049('0x43')]?_0x3ffeeb[_0x8049('0x34')]:_0x3a7b43['model'];if(_0x561553[_0x8049('0x2f')][_0x8049('0x44')]){_0x3ffeeb[_0x8049('0x3e')]=[{'all':!![]}];}_0x3ffeeb=_[_0x8049('0x3b')]({},_0x3ffeeb,_0x561553[_0x8049('0x3d')]);return db[_0x8049('0x2b')][_0x8049('0x45')](_0x3ffeeb)[_0x8049('0x24')](handleEntityNotFound(_0x28742b,null))[_0x8049('0x24')](respondWithResult(_0x28742b,null))[_0x8049('0x46')](handleError(_0x28742b,null));};exports[_0x8049('0x47')]=function(_0x5b82be,_0x4c0724){return db[_0x8049('0x2b')][_0x8049('0x47')](_0x5b82be[_0x8049('0x48')],{})['then'](respondWithResult(_0x4c0724,0xc9))[_0x8049('0x46')](handleError(_0x4c0724,null));};exports['update']=function(_0x22820e,_0x1748f6){if(_0x22820e[_0x8049('0x48')]['id']){delete _0x22820e[_0x8049('0x48')]['id'];}return db[_0x8049('0x2b')][_0x8049('0x45')]({'where':{'id':_0x22820e[_0x8049('0x41')]['id']}})[_0x8049('0x24')](handleEntityNotFound(_0x1748f6,null))[_0x8049('0x24')](saveUpdates(_0x22820e[_0x8049('0x48')],null))[_0x8049('0x24')](respondWithResult(_0x1748f6,null))[_0x8049('0x46')](handleError(_0x1748f6,null));};exports[_0x8049('0x23')]=function(_0x24c31d,_0x57b1d1){return db[_0x8049('0x2b')]['find']({'where':{'id':_0x24c31d[_0x8049('0x41')]['id']}})[_0x8049('0x24')](handleEntityNotFound(_0x57b1d1,null))[_0x8049('0x24')](removeEntity(_0x57b1d1,null))['catch'](handleError(_0x57b1d1,null));}; \ No newline at end of file +var _0x1236=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','catch','show','rawAttributes','length','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','end','stack','name','send','map','ZohoField'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1236,0xaa));var _0x6123=function(_0xc54490,_0x2666f6){_0xc54490=_0xc54490-0x0;var _0xbe3a75=_0x1236[_0xc54490];return _0xbe3a75;};'use strict';var emlformat=require(_0x6123('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6123('0x1'));var jsonpatch=require(_0x6123('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6123('0x3'));var Mustache=require(_0x6123('0x4'));var util=require('util');var path=require(_0x6123('0x5'));var sox=require(_0x6123('0x6'));var csv=require(_0x6123('0x7'));var ejs=require(_0x6123('0x8'));var fs=require('fs');var fs_extra=require(_0x6123('0x9'));var _=require('lodash');var squel=require(_0x6123('0xa'));var crypto=require('crypto');var jsforce=require(_0x6123('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6123('0x7'));var querystring=require(_0x6123('0xc'));var Papa=require(_0x6123('0xd'));var Redis=require(_0x6123('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6123('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6123('0x10'))(_0x6123('0x11'));var utils=require(_0x6123('0x12'));var config=require(_0x6123('0x13'));var licenseUtil=require(_0x6123('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2024ef,_0x25ccc6){_0x25ccc6=_0x25ccc6||0xcc;return function(_0xcd14e7){if(_0xcd14e7){return _0x2024ef[_0x6123('0x15')](_0x25ccc6);}return _0x2024ef[_0x6123('0x16')](_0x25ccc6)['end']();};}function respondWithResult(_0x573cac,_0x44aa04){_0x44aa04=_0x44aa04||0xc8;return function(_0x46ab15){if(_0x46ab15){return _0x573cac[_0x6123('0x16')](_0x44aa04)['json'](_0x46ab15);}};}function respondWithFilteredResult(_0x1114b4,_0x3ea606){return function(_0x5ca89c){if(_0x5ca89c){var _0x20fd82=typeof _0x3ea606[_0x6123('0x17')]===_0x6123('0x18')&&typeof _0x3ea606['limit']===_0x6123('0x18');var _0x4dcd65=_0x5ca89c[_0x6123('0x19')];var _0x3b843d=_0x20fd82?0x0:_0x3ea606[_0x6123('0x17')];var _0x4506ff=_0x20fd82?_0x5ca89c[_0x6123('0x19')]:_0x3ea606[_0x6123('0x17')]+_0x3ea606[_0x6123('0x1a')];var _0x5e0c6c;if(_0x4506ff>=_0x4dcd65){_0x4506ff=_0x4dcd65;_0x5e0c6c=0xc8;}else{_0x5e0c6c=0xce;}_0x1114b4[_0x6123('0x16')](_0x5e0c6c);return _0x1114b4[_0x6123('0x1b')](_0x6123('0x1c'),_0x3b843d+'-'+_0x4506ff+'/'+_0x4dcd65)[_0x6123('0x1d')](_0x5ca89c);}return null;};}function patchUpdates(_0x4fae6b){return function(_0xf818c2){try{jsonpatch[_0x6123('0x1e')](_0xf818c2,_0x4fae6b,!![]);}catch(_0x375679){return BPromise[_0x6123('0x1f')](_0x375679);}return _0xf818c2['save']();};}function saveUpdates(_0x49f111,_0x18b3a9){return function(_0x40ec53){if(_0x40ec53){return _0x40ec53[_0x6123('0x20')](_0x49f111)['then'](function(_0xcfad68){return _0xcfad68;});}return null;};}function removeEntity(_0x4d9524,_0x41ee93){return function(_0x10fc02){if(_0x10fc02){return _0x10fc02[_0x6123('0x21')]()['then'](function(){_0x4d9524[_0x6123('0x16')](0xcc)[_0x6123('0x22')]();});}};}function handleEntityNotFound(_0x42b465,_0x22f923){return function(_0x29e64d){if(!_0x29e64d){_0x42b465[_0x6123('0x15')](0x194);}return _0x29e64d;};}function handleError(_0x2448ed,_0x1737ef){_0x1737ef=_0x1737ef||0x1f4;return function(_0x2a784b){logger['error'](_0x2a784b[_0x6123('0x23')]);if(_0x2a784b[_0x6123('0x24')]){delete _0x2a784b[_0x6123('0x24')];}_0x2448ed[_0x6123('0x16')](_0x1737ef)[_0x6123('0x25')](_0x2a784b);};}exports['index']=function(_0x1dcd3a,_0x13acee){var _0xa4aa6e={},_0x366afe={},_0x1e5bbc={'count':0x0,'rows':[]};var _0x1a7aac=_[_0x6123('0x26')](db[_0x6123('0x27')]['rawAttributes'],function(_0x49720e){return{'name':_0x49720e[_0x6123('0x28')],'type':_0x49720e[_0x6123('0x29')][_0x6123('0x2a')]};});_0x366afe[_0x6123('0x2b')]=_['map'](_0x1a7aac,_0x6123('0x24'));_0x366afe[_0x6123('0x2c')]=_[_0x6123('0x2d')](_0x1dcd3a['query']);_0x366afe[_0x6123('0x2e')]=_[_0x6123('0x2f')](_0x366afe[_0x6123('0x2b')],_0x366afe['query']);_0xa4aa6e[_0x6123('0x30')]=_[_0x6123('0x2f')](_0x366afe['model'],qs[_0x6123('0x31')](_0x1dcd3a[_0x6123('0x2c')][_0x6123('0x31')]));_0xa4aa6e[_0x6123('0x30')]=_0xa4aa6e[_0x6123('0x30')]['length']?_0xa4aa6e[_0x6123('0x30')]:_0x366afe[_0x6123('0x2b')];if(!_0x1dcd3a['query'][_0x6123('0x32')](_0x6123('0x33'))){_0xa4aa6e[_0x6123('0x1a')]=qs[_0x6123('0x1a')](_0x1dcd3a[_0x6123('0x2c')]['limit']);_0xa4aa6e['offset']=qs['offset'](_0x1dcd3a[_0x6123('0x2c')][_0x6123('0x17')]);}_0xa4aa6e['order']=qs['sort'](_0x1dcd3a[_0x6123('0x2c')][_0x6123('0x34')]);_0xa4aa6e['where']=qs[_0x6123('0x2e')](_['pick'](_0x1dcd3a[_0x6123('0x2c')],_0x366afe[_0x6123('0x2e')]),_0x1a7aac);if(_0x1dcd3a[_0x6123('0x2c')][_0x6123('0x35')]){_0xa4aa6e[_0x6123('0x36')]=_[_0x6123('0x37')](_0xa4aa6e[_0x6123('0x36')],{'$or':_[_0x6123('0x26')](_0x1a7aac,function(_0x16f144){if(_0x16f144[_0x6123('0x29')]!==_0x6123('0x38')){var _0x2060e7={};_0x2060e7[_0x16f144['name']]={'$like':'%'+_0x1dcd3a[_0x6123('0x2c')]['filter']+'%'};return _0x2060e7;}})});}_0xa4aa6e=_[_0x6123('0x37')]({},_0xa4aa6e,_0x1dcd3a['options']);var _0x23eca2={'where':_0xa4aa6e['where']};return db['ZohoField'][_0x6123('0x19')](_0x23eca2)[_0x6123('0x39')](function(_0x5e0eff){_0x1e5bbc['count']=_0x5e0eff;if(_0x1dcd3a[_0x6123('0x2c')][_0x6123('0x3a')]){_0xa4aa6e[_0x6123('0x3b')]=[{'all':!![]}];}return db['ZohoField'][_0x6123('0x3c')](_0xa4aa6e);})[_0x6123('0x39')](function(_0x28b80c){_0x1e5bbc['rows']=_0x28b80c;return _0x1e5bbc;})[_0x6123('0x39')](respondWithFilteredResult(_0x13acee,_0xa4aa6e))[_0x6123('0x3d')](handleError(_0x13acee,null));};exports[_0x6123('0x3e')]=function(_0x4a1639,_0x1ea5b5){var _0x1e40e0={'raw':!![],'where':{'id':_0x4a1639['params']['id']}},_0x4d313f={};_0x4d313f['model']=_[_0x6123('0x2d')](db['ZohoField'][_0x6123('0x3f')]);_0x4d313f[_0x6123('0x2c')]=_[_0x6123('0x2d')](_0x4a1639[_0x6123('0x2c')]);_0x4d313f[_0x6123('0x2e')]=_['intersection'](_0x4d313f[_0x6123('0x2b')],_0x4d313f[_0x6123('0x2c')]);_0x1e40e0[_0x6123('0x30')]=_['intersection'](_0x4d313f['model'],qs[_0x6123('0x31')](_0x4a1639[_0x6123('0x2c')][_0x6123('0x31')]));_0x1e40e0[_0x6123('0x30')]=_0x1e40e0[_0x6123('0x30')][_0x6123('0x40')]?_0x1e40e0[_0x6123('0x30')]:_0x4d313f[_0x6123('0x2b')];if(_0x4a1639['query'][_0x6123('0x3a')]){_0x1e40e0['include']=[{'all':!![]}];}_0x1e40e0=_[_0x6123('0x37')]({},_0x1e40e0,_0x4a1639[_0x6123('0x41')]);return db[_0x6123('0x27')][_0x6123('0x42')](_0x1e40e0)['then'](handleEntityNotFound(_0x1ea5b5,null))[_0x6123('0x39')](respondWithResult(_0x1ea5b5,null))[_0x6123('0x3d')](handleError(_0x1ea5b5,null));};exports[_0x6123('0x43')]=function(_0x47c0b7,_0x2efce1){return db['ZohoField'][_0x6123('0x43')](_0x47c0b7[_0x6123('0x44')],{})['then'](respondWithResult(_0x2efce1,0xc9))[_0x6123('0x3d')](handleError(_0x2efce1,null));};exports[_0x6123('0x20')]=function(_0x3a57d5,_0x46e541){if(_0x3a57d5[_0x6123('0x44')]['id']){delete _0x3a57d5[_0x6123('0x44')]['id'];}return db[_0x6123('0x27')][_0x6123('0x42')]({'where':{'id':_0x3a57d5['params']['id']}})[_0x6123('0x39')](handleEntityNotFound(_0x46e541,null))[_0x6123('0x39')](saveUpdates(_0x3a57d5[_0x6123('0x44')],null))[_0x6123('0x39')](respondWithResult(_0x46e541,null))[_0x6123('0x3d')](handleError(_0x46e541,null));};exports[_0x6123('0x21')]=function(_0x570d71,_0x3e0278){return db['ZohoField']['find']({'where':{'id':_0x570d71[_0x6123('0x45')]['id']}})[_0x6123('0x39')](handleEntityNotFound(_0x3e0278,null))['then'](removeEntity(_0x3e0278,null))[_0x6123('0x3d')](handleError(_0x3e0278,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 22e4c4b..f635be9 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 _0x0a6b=['int_zoho_fields','zoho_unique_index','lodash','moment','request-promise','path','rimraf','./intZohoField.attributes','ZohoField'];(function(_0x540cc6,_0x7cdae0){var _0x6faed0=function(_0x504a14){while(--_0x504a14){_0x540cc6['push'](_0x540cc6['shift']());}};_0x6faed0(++_0x7cdae0);}(_0x0a6b,0x18e));var _0xb0a6=function(_0xc9587f,_0x396523){_0xc9587f=_0xc9587f-0x0;var _0x76accb=_0x0a6b[_0xc9587f];return _0x76accb;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'paranoid':![],'indexes':[{'name':_0xb0a6('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','idField','FieldId','util','bluebird','request-promise','path'];(function(_0x1adadf,_0x4f4762){var _0x3d897f=function(_0x26d906){while(--_0x26d906){_0x1adadf['push'](_0x1adadf['shift']());}};_0x3d897f(++_0x4f4762);}(_0x81c6,0x1d5));var _0x681c=function(_0x402b7e,_0x35fdf7){_0x402b7e=_0x402b7e-0x0;var _0x55f359=_0x81c6[_0x402b7e];return _0x55f359;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x681c('0x9'),_0x681c('0xa')],'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 8bcbb08..167fdad 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 _0x6dfd=['info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xce307d,_0x1de850){var _0x4ecc51=function(_0x3da976){while(--_0x3da976){_0xce307d['push'](_0xce307d['shift']());}};_0x4ecc51(++_0x1de850);}(_0x6dfd,0xaa));var _0xd6df=function(_0x5c9f9c,_0x2193ed){_0x5c9f9c=_0x5c9f9c-0x0;var _0x20350a=_0x6dfd[_0x5c9f9c];return _0x20350a;};'use strict';var _=require(_0xd6df('0x0'));var util=require(_0xd6df('0x1'));var moment=require(_0xd6df('0x2'));var BPromise=require(_0xd6df('0x3'));var rs=require(_0xd6df('0x4'));var fs=require('fs');var Redis=require(_0xd6df('0x5'));var db=require(_0xd6df('0x6'))['db'];var utils=require(_0xd6df('0x7'));var logger=require(_0xd6df('0x8'))('rpc');var config=require(_0xd6df('0x9'));var jayson=require(_0xd6df('0xa'));var client=jayson[_0xd6df('0xb')][_0xd6df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x570baf,_0x1c445b,_0x1b27e4){return new BPromise(function(_0x175b12,_0x352ee3){return client[_0xd6df('0xd')](_0x570baf,_0x1b27e4)['then'](function(_0x5839fe){logger[_0xd6df('0xe')](_0xd6df('0xf'),_0x1c445b,_0xd6df('0x10'));logger['debug'](_0xd6df('0x11'),_0x1c445b,_0xd6df('0x10'),JSON[_0xd6df('0x12')](_0x5839fe));if(_0x5839fe['error']){if(_0x5839fe[_0xd6df('0x13')][_0xd6df('0x14')]===0x1f4){logger[_0xd6df('0x13')](_0xd6df('0xf'),_0x1c445b,_0x5839fe[_0xd6df('0x13')][_0xd6df('0x15')]);return _0x352ee3(_0x5839fe[_0xd6df('0x13')][_0xd6df('0x15')]);}logger[_0xd6df('0x13')](_0xd6df('0xf'),_0x1c445b,_0x5839fe[_0xd6df('0x13')]['message']);return _0x175b12(_0x5839fe[_0xd6df('0x13')]['message']);}else{logger[_0xd6df('0xe')](_0xd6df('0xf'),_0x1c445b,_0xd6df('0x10'));_0x175b12(_0x5839fe['result'][_0xd6df('0x15')]);}})[_0xd6df('0x16')](function(_0x5d3cc1){logger['error'](_0xd6df('0xf'),_0x1c445b,_0x5d3cc1);_0x352ee3(_0x5d3cc1);});});} \ No newline at end of file +var _0x3729=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3729,0x96));var _0x9372=function(_0x32760c,_0x1e0090){_0x32760c=_0x32760c-0x0;var _0x110e20=_0x3729[_0x32760c];return _0x110e20;};'use strict';var _=require(_0x9372('0x0'));var util=require(_0x9372('0x1'));var moment=require('moment');var BPromise=require(_0x9372('0x2'));var rs=require(_0x9372('0x3'));var fs=require('fs');var Redis=require(_0x9372('0x4'));var db=require(_0x9372('0x5'))['db'];var utils=require(_0x9372('0x6'));var logger=require('../../config/logger')(_0x9372('0x7'));var config=require(_0x9372('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x587621,_0x335d4d,_0x29e561){return new BPromise(function(_0x17c71c,_0xb3bbd1){return client['request'](_0x587621,_0x29e561)[_0x9372('0x9')](function(_0x3ec86c){logger[_0x9372('0xa')](_0x9372('0xb'),_0x335d4d,_0x9372('0xc'));logger[_0x9372('0xd')](_0x9372('0xe'),_0x335d4d,_0x9372('0xc'),JSON['stringify'](_0x3ec86c));if(_0x3ec86c['error']){if(_0x3ec86c[_0x9372('0xf')][_0x9372('0x10')]===0x1f4){logger[_0x9372('0xf')]('ZohoField,\x20%s,\x20%s',_0x335d4d,_0x3ec86c[_0x9372('0xf')][_0x9372('0x11')]);return _0xb3bbd1(_0x3ec86c[_0x9372('0xf')][_0x9372('0x11')]);}logger[_0x9372('0xf')](_0x9372('0xb'),_0x335d4d,_0x3ec86c[_0x9372('0xf')][_0x9372('0x11')]);return _0x17c71c(_0x3ec86c[_0x9372('0xf')][_0x9372('0x11')]);}else{logger[_0x9372('0xa')](_0x9372('0xb'),_0x335d4d,_0x9372('0xc'));_0x17c71c(_0x3ec86c[_0x9372('0x12')][_0x9372('0x11')]);}})[_0x9372('0x13')](function(_0x24e876){logger[_0x9372('0xf')](_0x9372('0xb'),_0x335d4d,_0x24e876);_0xb3bbd1(_0x24e876);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9f3e321..dd91868 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5910ed,_0x19f1d3){var _0x59b1ad=function(_0x57fa03){while(--_0x57fa03){_0x5910ed['push'](_0x5910ed['shift']());}};_0x59b1ad(++_0x19f1d3);}(_0xe706,0xa3));var _0x6e70=function(_0xacd405,_0x2217bb){_0xacd405=_0xacd405-0x0;var _0x57611c=_0xe706[_0xacd405];return _0x57611c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3ea210,_0x9488d7){var _0x27818c=function(_0x2b9686){while(--_0x2b9686){_0x3ea210['push'](_0x3ea210['shift']());}};_0x27818c(++_0x9488d7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0xcb91[_0x3474ac];return _0x5345ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 2090261..df842e3 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 _0xad74=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x1ec324,_0x468728){var _0x7c8695=function(_0x3bf570){while(--_0x3bf570){_0x1ec324['push'](_0x1ec324['shift']());}};_0x7c8695(++_0x468728);}(_0xad74,0x17e));var _0x4ad7=function(_0x1266f9,_0xbba76f){_0x1266f9=_0x1266f9-0x0;var _0x282acb=_0xad74[_0x1266f9];return _0x282acb;};'use strict';var Sequelize=require(_0x4ad7('0x0'));module[_0x4ad7('0x1')]={'name':{'type':Sequelize[_0x4ad7('0x2')],'allowNull':![],'unique':_0x4ad7('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ad7('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x4ad7('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x4ad7('0x2')]},'type':{'type':Sequelize[_0x4ad7('0x2')]},'size':{'type':Sequelize[_0x4ad7('0x5')]},'active':{'type':Sequelize[_0x4ad7('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x4ad7('0x2')]},'logo':{'type':Sequelize[_0x4ad7('0x2')]},'state':{'type':Sequelize[_0x4ad7('0x2')],'unique':_0x4ad7('0x7')},'description':{'type':Sequelize[_0x4ad7('0x2')]},'title':{'type':Sequelize[_0x4ad7('0x2')]},'remoteUri':{'type':Sequelize[_0x4ad7('0x2')]},'link':{'type':Sequelize[_0x4ad7('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x55f7=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x1d174c,_0xd71a94){var _0x193cbf=function(_0x140302){while(--_0x140302){_0x1d174c['push'](_0x1d174c['shift']());}};_0x193cbf(++_0xd71a94);}(_0x55f7,0xe1));var _0x755f=function(_0x43c00b,_0x39414c){_0x43c00b=_0x43c00b-0x0;var _0x181308=_0x55f7[_0x43c00b];return _0x181308;};'use strict';var Sequelize=require(_0x755f('0x0'));module[_0x755f('0x1')]={'name':{'type':Sequelize[_0x755f('0x2')],'allowNull':![],'unique':_0x755f('0x3')},'version':{'type':Sequelize[_0x755f('0x2')],'allowNull':![],'unique':_0x755f('0x3')},'main':{'type':Sequelize[_0x755f('0x2')],'defaultValue':_0x755f('0x4')},'filename':{'type':Sequelize[_0x755f('0x2')]},'path':{'type':Sequelize[_0x755f('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x755f('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x755f('0x2')]},'logo':{'type':Sequelize[_0x755f('0x2')]},'state':{'type':Sequelize[_0x755f('0x2')],'unique':_0x755f('0x6')},'description':{'type':Sequelize[_0x755f('0x2')]},'title':{'type':Sequelize[_0x755f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'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 36cecc7..66d849e 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 _0x4975=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','Integration','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x25a11c,_0x594dcb){var _0x1ff697=function(_0xe88154){while(--_0xe88154){_0x25a11c['push'](_0x25a11c['shift']());}};_0x1ff697(++_0x594dcb);}(_0x4975,0x86));var _0x5497=function(_0x21a19a,_0x3242d1){_0x21a19a=_0x21a19a-0x0;var _0xa09cd9=_0x4975[_0x21a19a];return _0xa09cd9;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['Integration']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['Integration'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));}; \ No newline at end of file +var _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Integration','fieldName','type','key'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xadb5,0xad));var _0x5adb=function(_0x4880c0,_0x359ca8){_0x4880c0=_0x4880c0-0x0;var _0x3fddc9=_0xadb5[_0x4880c0];return _0x3fddc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['Integration']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 508c803..a13108b 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 _0x51c9=['moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','lodash','util','api'];(function(_0x10f38f,_0x5da18a){var _0xfd25e3=function(_0x25f9ef){while(--_0x25f9ef){_0x10f38f['push'](_0x10f38f['shift']());}};_0xfd25e3(++_0x5da18a);}(_0x51c9,0x1cb));var _0x951c=function(_0x3610a1,_0x38be72){_0x3610a1=_0x3610a1-0x0;var _0xd0a6f3=_0x51c9[_0x3610a1];return _0xd0a6f3;};'use strict';var _=require(_0x951c('0x0'));var util=require(_0x951c('0x1'));var logger=require('../../config/logger')(_0x951c('0x2'));var moment=require(_0x951c('0x3'));var BPromise=require('bluebird');var rp=require(_0x951c('0x4'));var fs=require('fs');var path=require(_0x951c('0x5'));var rimraf=require(_0x951c('0x6'));var config=require(_0x951c('0x7'));var attributes=require(_0x951c('0x8'));module[_0x951c('0x9')]=function(_0x1a889,_0x36b0a4){return _0x1a889[_0x951c('0xa')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89b3=['../../config/environment','./integration.attributes','Integration','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x89b3,0x13e));var _0x389b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89b3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x389b('0x0'));var util=require(_0x389b('0x1'));var logger=require(_0x389b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x389b('0x3'));var fs=require('fs');var path=require(_0x389b('0x4'));var rimraf=require(_0x389b('0x5'));var config=require(_0x389b('0x6'));var attributes=require(_0x389b('0x7'));module['exports']=function(_0x118be2,_0x1b3983){return _0x118be2['define'](_0x389b('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index aeeee18..844f7a1 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 _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x594dfa,_0x1251eb){var _0x3b135d=function(_0x243809){while(--_0x243809){_0x594dfa['push'](_0x594dfa['shift']());}};_0x3b135d(++_0x1251eb);}(_0x6d38,0x1ef));var _0x86d3=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6d38[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x37ac46,_0x4d3711){var _0x5ee31b=function(_0x3fb6a2){while(--_0x3fb6a2){_0x37ac46['push'](_0x37ac46['shift']());}};_0x5ee31b(++_0x4d3711);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6d38[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a2c3b8c..51d182c 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(_0x11dd75,_0x340f1c){var _0x21bd9b=function(_0x22f10f){while(--_0x22f10f){_0x11dd75['push'](_0x11dd75['shift']());}};_0x21bd9b(++_0x340f1c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x566292,_0xba2a23){_0x566292=_0x566292-0x0;var _0xbff815=_0x9f0e[_0x566292];return _0xbff815;};'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 _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xda2d,0x102));var _0xdda2=function(_0x1b00b5,_0x5a338d){_0x1b00b5=_0x1b00b5-0x0;var _0x528577=_0xda2d[_0x1b00b5];return _0x528577;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index bf62f47..5179cc2 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 _0xac1b=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x51a2bf,_0x3c40e2){var _0x139a20=function(_0x522021){while(--_0x522021){_0x51a2bf['push'](_0x51a2bf['shift']());}};_0x139a20(++_0x3c40e2);}(_0xac1b,0x176));var _0xbac1=function(_0x51cde7,_0x1d1ea9){_0x51cde7=_0x51cde7-0x0;var _0x575ea1=_0xac1b[_0x51cde7];return _0x575ea1;};'use strict';var Sequelize=require(_0xbac1('0x0'));module[_0xbac1('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xbac1('0x2')]},'exitStatus':{'type':Sequelize[_0xbac1('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xbac1('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbac1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xbac1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbac1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xbac1('0x4')]},'agentconnectAt':{'type':Sequelize[_0xbac1('0x4')]},'holdtime':{'type':Sequelize[_0xbac1('0x3')]},'agentcomplete':{'type':Sequelize[_0xbac1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbac1('0x4')]},'talktime':{'type':Sequelize[_0xbac1('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbac1('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xbac1('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbac1('0x4')]},'agentdump':{'type':Sequelize[_0xbac1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbac1('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbac1('0x2')]},'channelstate':{'type':Sequelize[_0xbac1('0x3')]},'channelstatedesc':{'type':Sequelize[_0xbac1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xbac1('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbac1('0x2')]},'context':{'type':Sequelize[_0xbac1('0x2')]},'exten':{'type':Sequelize[_0xbac1('0x2')]},'priority':{'type':Sequelize[_0xbac1('0x2')]},'destchannel':{'type':Sequelize[_0xbac1('0x2')]},'destchannelstate':{'type':Sequelize[_0xbac1('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xbac1('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xbac1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbac1('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xbac1('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbac1('0x2')]},'destpriority':{'type':Sequelize[_0xbac1('0x2')]},'destuniqueid':{'type':Sequelize[_0xbac1('0x2')]},'messageId':{'type':Sequelize[_0xbac1('0x2')]},'inReplyTo':{'type':Sequelize[_0xbac1('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xbac1('0x2')]},'cc':{'type':Sequelize[_0xbac1('0x2')]},'attachment':{'type':Sequelize[_0xbac1('0x6')]},'html':{'type':Sequelize[_0xbac1('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xbac1('0x7')](_0xbac1('0x8'),_0xbac1('0x9'),_0xbac1('0xa'),_0xbac1('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xbac1('0x2')]},'appdata':{'type':Sequelize[_0xbac1('0x2')]},'projectId':{'type':Sequelize[_0xbac1('0x3')]}}; \ No newline at end of file +var _0x54a7=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','exports'];(function(_0x46c17f,_0x361c58){var _0x2e5b54=function(_0x4a1fbb){while(--_0x4a1fbb){_0x46c17f['push'](_0x46c17f['shift']());}};_0x2e5b54(++_0x361c58);}(_0x54a7,0x170));var _0x754a=function(_0x42615c,_0x405485){_0x42615c=_0x42615c-0x0;var _0x4f13a1=_0x54a7[_0x42615c];return _0x4f13a1;};'use strict';var Sequelize=require('sequelize');module[_0x754a('0x0')]={'integration':{'type':Sequelize[_0x754a('0x1')]},'eventChannel':{'type':Sequelize[_0x754a('0x1')]},'exitStatus':{'type':Sequelize[_0x754a('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x754a('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x754a('0x1')]},'calleridnum':{'type':Sequelize[_0x754a('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x754a('0x1')]},'membername':{'type':Sequelize[_0x754a('0x1')]},'agentcalledAt':{'type':Sequelize[_0x754a('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x754a('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x754a('0x3')]},'talktime':{'type':Sequelize[_0x754a('0x2')]},'agentacw':{'type':Sequelize[_0x754a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x754a('0x2')]},'reason':{'type':Sequelize[_0x754a('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x754a('0x3')]},'agentdump':{'type':Sequelize[_0x754a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x754a('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x754a('0x2')]},'channelstatedesc':{'type':Sequelize[_0x754a('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x754a('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x754a('0x1')]},'exten':{'type':Sequelize[_0x754a('0x1')]},'priority':{'type':Sequelize[_0x754a('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x754a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x754a('0x1')]},'destcalleridname':{'type':Sequelize[_0x754a('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x754a('0x1')]},'destlanguage':{'type':Sequelize[_0x754a('0x1')]},'destaccountcode':{'type':Sequelize[_0x754a('0x1')]},'destcontext':{'type':Sequelize[_0x754a('0x1')]},'destexten':{'type':Sequelize[_0x754a('0x1')]},'destpriority':{'type':Sequelize[_0x754a('0x1')]},'destuniqueid':{'type':Sequelize[_0x754a('0x1')]},'messageId':{'type':Sequelize[_0x754a('0x1')]},'inReplyTo':{'type':Sequelize[_0x754a('0x1')]},'subject':{'type':Sequelize[_0x754a('0x1')]},'from':{'type':Sequelize[_0x754a('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x754a('0x1')]},'attachment':{'type':Sequelize[_0x754a('0x5')]},'html':{'type':Sequelize[_0x754a('0x5')]},'text':{'type':Sequelize[_0x754a('0x5')]},'status':{'type':Sequelize[_0x754a('0x6')]('SENT',_0x754a('0x7'),_0x754a('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x754a('0x1')]},'appdata':{'type':Sequelize[_0x754a('0x1')]},'projectId':{'type':Sequelize[_0x754a('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d0fee4e..e7cff5b 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 _0xc30b=['intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','catch','show','length','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','save','update','then','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc30b,0x101));var _0xbc30=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xc30b[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc30('0x0'));var zipdir=require(_0xbc30('0x1'));var jsonpatch=require(_0xbc30('0x2'));var rp=require(_0xbc30('0x3'));var moment=require(_0xbc30('0x4'));var BPromise=require(_0xbc30('0x5'));var Mustache=require(_0xbc30('0x6'));var util=require(_0xbc30('0x7'));var path=require(_0xbc30('0x8'));var sox=require(_0xbc30('0x9'));var csv=require('to-csv');var ejs=require(_0xbc30('0xa'));var fs=require('fs');var fs_extra=require(_0xbc30('0xb'));var _=require(_0xbc30('0xc'));var squel=require(_0xbc30('0xd'));var crypto=require('crypto');var jsforce=require(_0xbc30('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbc30('0xf'));var querystring=require('querystring');var Papa=require(_0xbc30('0x10'));var Redis=require(_0xbc30('0x11'));var authService=require(_0xbc30('0x12'));var qs=require(_0xbc30('0x13'));var as=require(_0xbc30('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc30('0x15'))(_0xbc30('0x16'));var utils=require(_0xbc30('0x17'));var config=require(_0xbc30('0x18'));var licenseUtil=require(_0xbc30('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe9f7,_0x237c0d){_0x237c0d=_0x237c0d||0xcc;return function(_0x21dc0d){if(_0x21dc0d){return _0x3fe9f7[_0xbc30('0x1a')](_0x237c0d);}return _0x3fe9f7['status'](_0x237c0d)[_0xbc30('0x1b')]();};}function respondWithResult(_0x5302d7,_0x2744ef){_0x2744ef=_0x2744ef||0xc8;return function(_0x24edcc){if(_0x24edcc){return _0x5302d7['status'](_0x2744ef)[_0xbc30('0x1c')](_0x24edcc);}};}function respondWithFilteredResult(_0x4c6617,_0x143d4e){return function(_0x244cfc){if(_0x244cfc){var _0x285886=typeof _0x143d4e[_0xbc30('0x1d')]==='undefined'&&typeof _0x143d4e[_0xbc30('0x1e')]===_0xbc30('0x1f');var _0x31eda7=_0x244cfc[_0xbc30('0x20')];var _0x338425=_0x285886?0x0:_0x143d4e[_0xbc30('0x1d')];var _0x2386dd=_0x285886?_0x244cfc[_0xbc30('0x20')]:_0x143d4e['offset']+_0x143d4e[_0xbc30('0x1e')];var _0x15766b;if(_0x2386dd>=_0x31eda7){_0x2386dd=_0x31eda7;_0x15766b=0xc8;}else{_0x15766b=0xce;}_0x4c6617[_0xbc30('0x21')](_0x15766b);return _0x4c6617[_0xbc30('0x22')](_0xbc30('0x23'),_0x338425+'-'+_0x2386dd+'/'+_0x31eda7)[_0xbc30('0x1c')](_0x244cfc);}return null;};}function patchUpdates(_0x35dc76){return function(_0x237d1c){try{jsonpatch['apply'](_0x237d1c,_0x35dc76,!![]);}catch(_0x49e9b5){return BPromise['reject'](_0x49e9b5);}return _0x237d1c[_0xbc30('0x24')]();};}function saveUpdates(_0x521bf1,_0x20f768){return function(_0x8d924a){if(_0x8d924a){return _0x8d924a[_0xbc30('0x25')](_0x521bf1)[_0xbc30('0x26')](function(_0x5f3ea7){return _0x5f3ea7;});}return null;};}function removeEntity(_0x313e84,_0x4ac95a){return function(_0x2538da){if(_0x2538da){return _0x2538da['destroy']()[_0xbc30('0x26')](function(){_0x313e84[_0xbc30('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc1ed,_0x2c9d0c){return function(_0x491e9b){if(!_0x491e9b){_0x5bc1ed['sendStatus'](0x194);}return _0x491e9b;};}function handleError(_0x10510b,_0x385855){_0x385855=_0x385855||0x1f4;return function(_0xb9228e){logger['error'](_0xb9228e[_0xbc30('0x27')]);if(_0xb9228e['name']){delete _0xb9228e['name'];}_0x10510b[_0xbc30('0x21')](_0x385855)[_0xbc30('0x28')](_0xb9228e);};}exports[_0xbc30('0x29')]=function(_0x375da2,_0x2c5bf6){var _0x46ec2b={},_0x31e300={},_0x4ea8e7={'count':0x0,'rows':[]};var _0x2db7f3=_[_0xbc30('0x2a')](db[_0xbc30('0x2b')][_0xbc30('0x2c')],function(_0x11e7dd){return{'name':_0x11e7dd[_0xbc30('0x2d')],'type':_0x11e7dd[_0xbc30('0x2e')][_0xbc30('0x2f')]};});_0x31e300[_0xbc30('0x30')]=_[_0xbc30('0x2a')](_0x2db7f3,'name');_0x31e300[_0xbc30('0x31')]=_[_0xbc30('0x32')](_0x375da2[_0xbc30('0x31')]);_0x31e300['filters']=_[_0xbc30('0x33')](_0x31e300['model'],_0x31e300[_0xbc30('0x31')]);_0x46ec2b['attributes']=_[_0xbc30('0x33')](_0x31e300[_0xbc30('0x30')],qs[_0xbc30('0x34')](_0x375da2[_0xbc30('0x31')][_0xbc30('0x34')]));_0x46ec2b[_0xbc30('0x35')]=_0x46ec2b['attributes']['length']?_0x46ec2b['attributes']:_0x31e300[_0xbc30('0x30')];if(!_0x375da2['query'][_0xbc30('0x36')]('nolimit')){_0x46ec2b['limit']=qs['limit'](_0x375da2[_0xbc30('0x31')][_0xbc30('0x1e')]);_0x46ec2b[_0xbc30('0x1d')]=qs[_0xbc30('0x1d')](_0x375da2[_0xbc30('0x31')][_0xbc30('0x1d')]);}_0x46ec2b[_0xbc30('0x37')]=qs[_0xbc30('0x38')](_0x375da2[_0xbc30('0x31')][_0xbc30('0x38')]);_0x46ec2b[_0xbc30('0x39')]=qs['filters'](_[_0xbc30('0x3a')](_0x375da2[_0xbc30('0x31')],_0x31e300[_0xbc30('0x3b')]),_0x2db7f3);if(_0x375da2['query'][_0xbc30('0x3c')]){_0x46ec2b[_0xbc30('0x39')]=_[_0xbc30('0x3d')](_0x46ec2b[_0xbc30('0x39')],{'$or':_[_0xbc30('0x2a')](_0x2db7f3,function(_0x3da03f){if(_0x3da03f['type']!==_0xbc30('0x3e')){var _0x509fb9={};_0x509fb9[_0x3da03f[_0xbc30('0x3f')]]={'$like':'%'+_0x375da2['query'][_0xbc30('0x3c')]+'%'};return _0x509fb9;}})});}_0x46ec2b=_[_0xbc30('0x3d')]({},_0x46ec2b,_0x375da2[_0xbc30('0x40')]);var _0x15f782={'where':_0x46ec2b[_0xbc30('0x39')]};return db[_0xbc30('0x2b')]['count'](_0x15f782)['then'](function(_0x8701cd){_0x4ea8e7[_0xbc30('0x20')]=_0x8701cd;if(_0x375da2[_0xbc30('0x31')][_0xbc30('0x41')]){_0x46ec2b[_0xbc30('0x42')]=[{'all':!![]}];}return db['IntegrationReport'][_0xbc30('0x43')](_0x46ec2b);})[_0xbc30('0x26')](function(_0x1f8e59){_0x4ea8e7['rows']=_0x1f8e59;return _0x4ea8e7;})['then'](respondWithFilteredResult(_0x2c5bf6,_0x46ec2b))[_0xbc30('0x44')](handleError(_0x2c5bf6,null));};exports[_0xbc30('0x45')]=function(_0x4f1788,_0xaf9d8a){var _0x9cef71={'raw':![],'where':{'id':_0x4f1788['params']['id']}},_0x4e53b5={};_0x4e53b5[_0xbc30('0x30')]=_[_0xbc30('0x32')](db[_0xbc30('0x2b')]['rawAttributes']);_0x4e53b5[_0xbc30('0x31')]=_['keys'](_0x4f1788['query']);_0x4e53b5['filters']=_[_0xbc30('0x33')](_0x4e53b5[_0xbc30('0x30')],_0x4e53b5[_0xbc30('0x31')]);_0x9cef71[_0xbc30('0x35')]=_[_0xbc30('0x33')](_0x4e53b5[_0xbc30('0x30')],qs[_0xbc30('0x34')](_0x4f1788[_0xbc30('0x31')][_0xbc30('0x34')]));_0x9cef71[_0xbc30('0x35')]=_0x9cef71[_0xbc30('0x35')][_0xbc30('0x46')]?_0x9cef71[_0xbc30('0x35')]:_0x4e53b5[_0xbc30('0x30')];if(_0x4f1788[_0xbc30('0x31')]['includeAll']){_0x9cef71['include']=[{'all':!![]}];}_0x9cef71=_['merge']({},_0x9cef71,_0x4f1788[_0xbc30('0x40')]);return db[_0xbc30('0x2b')][_0xbc30('0x47')](_0x9cef71)[_0xbc30('0x26')](handleEntityNotFound(_0xaf9d8a,null))['then'](respondWithResult(_0xaf9d8a,null))[_0xbc30('0x44')](handleError(_0xaf9d8a,null));};exports[_0xbc30('0x48')]=function(_0x4f814d,_0x57bcfd){return db[_0xbc30('0x2b')]['create'](_0x4f814d[_0xbc30('0x49')],{})['then'](respondWithResult(_0x57bcfd,0xc9))[_0xbc30('0x44')](handleError(_0x57bcfd,null));};exports[_0xbc30('0x25')]=function(_0x435f45,_0x27fb58){if(_0x435f45[_0xbc30('0x49')]['id']){delete _0x435f45[_0xbc30('0x49')]['id'];}return db[_0xbc30('0x2b')][_0xbc30('0x47')]({'where':{'id':_0x435f45[_0xbc30('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27fb58,null))[_0xbc30('0x26')](saveUpdates(_0x435f45[_0xbc30('0x49')],null))[_0xbc30('0x26')](respondWithResult(_0x27fb58,null))[_0xbc30('0x44')](handleError(_0x27fb58,null));};exports[_0xbc30('0x4b')]=function(_0x33f2c6,_0x10fb97){return db['IntegrationReport'][_0xbc30('0x47')]({'where':{'id':_0x33f2c6['params']['id']}})[_0xbc30('0x26')](handleEntityNotFound(_0x10fb97,null))[_0xbc30('0x26')](removeEntity(_0x10fb97,null))[_0xbc30('0x44')](handleError(_0x10fb97,null));};exports[_0xbc30('0x4c')]=function(_0x35b07f,_0x5ec677){return db['IntegrationReport'][_0xbc30('0x4c')]()[_0xbc30('0x26')](respondWithResult(_0x5ec677,null))[_0xbc30('0x44')](handleError(_0x5ec677,null));}; \ No newline at end of file +var _0x60e1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x60e1,0x1bf));var _0x160e=function(_0x49b7b1,_0x54c5cb){_0x49b7b1=_0x49b7b1-0x0;var _0x7cb3be=_0x60e1[_0x49b7b1];return _0x7cb3be;};'use strict';var emlformat=require(_0x160e('0x0'));var rimraf=require(_0x160e('0x1'));var zipdir=require(_0x160e('0x2'));var jsonpatch=require(_0x160e('0x3'));var rp=require(_0x160e('0x4'));var moment=require(_0x160e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x160e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x160e('0x7'));var csv=require(_0x160e('0x8'));var ejs=require(_0x160e('0x9'));var fs=require('fs');var fs_extra=require(_0x160e('0xa'));var _=require(_0x160e('0xb'));var squel=require(_0x160e('0xc'));var crypto=require('crypto');var jsforce=require(_0x160e('0xd'));var deskjs=require(_0x160e('0xe'));var toCsv=require(_0x160e('0x8'));var querystring=require(_0x160e('0xf'));var Papa=require(_0x160e('0x10'));var Redis=require(_0x160e('0x11'));var authService=require(_0x160e('0x12'));var qs=require(_0x160e('0x13'));var as=require(_0x160e('0x14'));var hardwareService=require(_0x160e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x160e('0x16'));var config=require(_0x160e('0x17'));var licenseUtil=require(_0x160e('0x18'));var db=require(_0x160e('0x19'))['db'];function respondWithStatusCode(_0x16a498,_0x341b77){_0x341b77=_0x341b77||0xcc;return function(_0x1f05b8){if(_0x1f05b8){return _0x16a498[_0x160e('0x1a')](_0x341b77);}return _0x16a498['status'](_0x341b77)[_0x160e('0x1b')]();};}function respondWithResult(_0x5394c3,_0x100c42){_0x100c42=_0x100c42||0xc8;return function(_0x1dc172){if(_0x1dc172){return _0x5394c3[_0x160e('0x1c')](_0x100c42)[_0x160e('0x1d')](_0x1dc172);}};}function respondWithFilteredResult(_0x197873,_0xddce81){return function(_0x12f4c6){if(_0x12f4c6){var _0xf9516d=typeof _0xddce81[_0x160e('0x1e')]===_0x160e('0x1f')&&typeof _0xddce81[_0x160e('0x20')]===_0x160e('0x1f');var _0x5f40c9=_0x12f4c6[_0x160e('0x21')];var _0x204978=_0xf9516d?0x0:_0xddce81[_0x160e('0x1e')];var _0x409a02=_0xf9516d?_0x12f4c6['count']:_0xddce81[_0x160e('0x1e')]+_0xddce81['limit'];var _0x1b0369;if(_0x409a02>=_0x5f40c9){_0x409a02=_0x5f40c9;_0x1b0369=0xc8;}else{_0x1b0369=0xce;}_0x197873[_0x160e('0x1c')](_0x1b0369);return _0x197873[_0x160e('0x22')](_0x160e('0x23'),_0x204978+'-'+_0x409a02+'/'+_0x5f40c9)[_0x160e('0x1d')](_0x12f4c6);}return null;};}function patchUpdates(_0x3b60be){return function(_0x3b058a){try{jsonpatch[_0x160e('0x24')](_0x3b058a,_0x3b60be,!![]);}catch(_0x290f9a){return BPromise[_0x160e('0x25')](_0x290f9a);}return _0x3b058a[_0x160e('0x26')]();};}function saveUpdates(_0xcc5ed9,_0x2207cc){return function(_0x5733f9){if(_0x5733f9){return _0x5733f9[_0x160e('0x27')](_0xcc5ed9)[_0x160e('0x28')](function(_0x3998ff){return _0x3998ff;});}return null;};}function removeEntity(_0x1308a0,_0x48898e){return function(_0x36b8c5){if(_0x36b8c5){return _0x36b8c5['destroy']()[_0x160e('0x28')](function(){_0x1308a0['status'](0xcc)[_0x160e('0x1b')]();});}};}function handleEntityNotFound(_0x38ce19,_0x29566a){return function(_0x19759b){if(!_0x19759b){_0x38ce19['sendStatus'](0x194);}return _0x19759b;};}function handleError(_0x35a759,_0x1f1801){_0x1f1801=_0x1f1801||0x1f4;return function(_0x22af63){logger[_0x160e('0x29')](_0x22af63[_0x160e('0x2a')]);if(_0x22af63['name']){delete _0x22af63[_0x160e('0x2b')];}_0x35a759[_0x160e('0x1c')](_0x1f1801)[_0x160e('0x2c')](_0x22af63);};}exports[_0x160e('0x2d')]=function(_0x5767d5,_0x28a95a){var _0x47f297={},_0x5ceaca={},_0x222a7b={'count':0x0,'rows':[]};var _0x121998=_[_0x160e('0x2e')](db[_0x160e('0x2f')][_0x160e('0x30')],function(_0x2204cb){return{'name':_0x2204cb[_0x160e('0x31')],'type':_0x2204cb['type'][_0x160e('0x32')]};});_0x5ceaca[_0x160e('0x33')]=_[_0x160e('0x2e')](_0x121998,_0x160e('0x2b'));_0x5ceaca[_0x160e('0x34')]=_[_0x160e('0x35')](_0x5767d5['query']);_0x5ceaca[_0x160e('0x36')]=_[_0x160e('0x37')](_0x5ceaca[_0x160e('0x33')],_0x5ceaca['query']);_0x47f297[_0x160e('0x38')]=_[_0x160e('0x37')](_0x5ceaca[_0x160e('0x33')],qs['fields'](_0x5767d5[_0x160e('0x34')][_0x160e('0x39')]));_0x47f297[_0x160e('0x38')]=_0x47f297[_0x160e('0x38')][_0x160e('0x3a')]?_0x47f297[_0x160e('0x38')]:_0x5ceaca[_0x160e('0x33')];if(!_0x5767d5[_0x160e('0x34')]['hasOwnProperty'](_0x160e('0x3b'))){_0x47f297[_0x160e('0x20')]=qs[_0x160e('0x20')](_0x5767d5[_0x160e('0x34')][_0x160e('0x20')]);_0x47f297[_0x160e('0x1e')]=qs['offset'](_0x5767d5[_0x160e('0x34')][_0x160e('0x1e')]);}_0x47f297['order']=qs[_0x160e('0x3c')](_0x5767d5[_0x160e('0x34')][_0x160e('0x3c')]);_0x47f297[_0x160e('0x3d')]=qs[_0x160e('0x36')](_[_0x160e('0x3e')](_0x5767d5[_0x160e('0x34')],_0x5ceaca[_0x160e('0x36')]),_0x121998);if(_0x5767d5[_0x160e('0x34')][_0x160e('0x3f')]){_0x47f297[_0x160e('0x3d')]=_[_0x160e('0x40')](_0x47f297['where'],{'$or':_[_0x160e('0x2e')](_0x121998,function(_0x83c59d){if(_0x83c59d[_0x160e('0x41')]!==_0x160e('0x42')){var _0x4b64b6={};_0x4b64b6[_0x83c59d[_0x160e('0x2b')]]={'$like':'%'+_0x5767d5[_0x160e('0x34')][_0x160e('0x3f')]+'%'};return _0x4b64b6;}})});}_0x47f297=_[_0x160e('0x40')]({},_0x47f297,_0x5767d5['options']);var _0x2ea5b3={'where':_0x47f297[_0x160e('0x3d')]};return db['IntegrationReport'][_0x160e('0x21')](_0x2ea5b3)['then'](function(_0x8df442){_0x222a7b['count']=_0x8df442;if(_0x5767d5[_0x160e('0x34')][_0x160e('0x43')]){_0x47f297['include']=[{'all':!![]}];}return db[_0x160e('0x2f')][_0x160e('0x44')](_0x47f297);})[_0x160e('0x28')](function(_0x48c657){_0x222a7b['rows']=_0x48c657;return _0x222a7b;})[_0x160e('0x28')](respondWithFilteredResult(_0x28a95a,_0x47f297))[_0x160e('0x45')](handleError(_0x28a95a,null));};exports['show']=function(_0x6bf9e2,_0x91e2b1){var _0x323276={'raw':![],'where':{'id':_0x6bf9e2[_0x160e('0x46')]['id']}},_0x450e14={};_0x450e14['model']=_['keys'](db[_0x160e('0x2f')]['rawAttributes']);_0x450e14['query']=_[_0x160e('0x35')](_0x6bf9e2['query']);_0x450e14[_0x160e('0x36')]=_[_0x160e('0x37')](_0x450e14[_0x160e('0x33')],_0x450e14[_0x160e('0x34')]);_0x323276[_0x160e('0x38')]=_[_0x160e('0x37')](_0x450e14[_0x160e('0x33')],qs['fields'](_0x6bf9e2[_0x160e('0x34')][_0x160e('0x39')]));_0x323276[_0x160e('0x38')]=_0x323276[_0x160e('0x38')][_0x160e('0x3a')]?_0x323276[_0x160e('0x38')]:_0x450e14[_0x160e('0x33')];if(_0x6bf9e2['query'][_0x160e('0x43')]){_0x323276[_0x160e('0x47')]=[{'all':!![]}];}_0x323276=_['merge']({},_0x323276,_0x6bf9e2['options']);return db[_0x160e('0x2f')][_0x160e('0x48')](_0x323276)[_0x160e('0x28')](handleEntityNotFound(_0x91e2b1,null))[_0x160e('0x28')](respondWithResult(_0x91e2b1,null))[_0x160e('0x45')](handleError(_0x91e2b1,null));};exports['create']=function(_0x4f2c12,_0x113e6c){return db['IntegrationReport'][_0x160e('0x49')](_0x4f2c12[_0x160e('0x4a')],{})[_0x160e('0x28')](respondWithResult(_0x113e6c,0xc9))['catch'](handleError(_0x113e6c,null));};exports[_0x160e('0x27')]=function(_0xc802f0,_0xde76d1){if(_0xc802f0[_0x160e('0x4a')]['id']){delete _0xc802f0['body']['id'];}return db['IntegrationReport'][_0x160e('0x48')]({'where':{'id':_0xc802f0[_0x160e('0x46')]['id']}})['then'](handleEntityNotFound(_0xde76d1,null))[_0x160e('0x28')](saveUpdates(_0xc802f0['body'],null))[_0x160e('0x28')](respondWithResult(_0xde76d1,null))['catch'](handleError(_0xde76d1,null));};exports[_0x160e('0x4b')]=function(_0x26340b,_0x566252){return db[_0x160e('0x2f')]['find']({'where':{'id':_0x26340b[_0x160e('0x46')]['id']}})['then'](handleEntityNotFound(_0x566252,null))[_0x160e('0x28')](removeEntity(_0x566252,null))[_0x160e('0x45')](handleError(_0x566252,null));};exports[_0x160e('0x4c')]=function(_0x19928a,_0x153b17){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x153b17,null))[_0x160e('0x45')](handleError(_0x153b17,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 8f5fc1c..5974951 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 _0x7a4d=['path','rimraf','../../config/environment','exports','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ea808,_0x26fc4b){var _0x13541b=function(_0x4712a8){while(--_0x4712a8){_0x2ea808['push'](_0x2ea808['shift']());}};_0x13541b(++_0x26fc4b);}(_0x7a4d,0x10e));var _0xd7a4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x7a4d[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xd7a4('0x0'));var util=require('util');var logger=require(_0xd7a4('0x1'))(_0xd7a4('0x2'));var moment=require(_0xd7a4('0x3'));var BPromise=require(_0xd7a4('0x4'));var rp=require(_0xd7a4('0x5'));var fs=require('fs');var path=require(_0xd7a4('0x6'));var rimraf=require(_0xd7a4('0x7'));var config=require(_0xd7a4('0x8'));var attributes=require('./integrationReport.attributes');module[_0xd7a4('0x9')]=function(_0x46d444,_0x36469e){return _0x46d444['define'](_0xd7a4('0xa'),attributes,{'tableName':_0xd7a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6747=['./integrationReport.attributes','define','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x30e690,_0x104c15){var _0x18cd05=function(_0xb5a2b3){while(--_0xb5a2b3){_0x30e690['push'](_0x30e690['shift']());}};_0x18cd05(++_0x104c15);}(_0x6747,0x19b));var _0x7674=function(_0x594867,_0x2ee5d3){_0x594867=_0x594867-0x0;var _0x9ac5b1=_0x6747[_0x594867];return _0x9ac5b1;};'use strict';var _=require(_0x7674('0x0'));var util=require(_0x7674('0x1'));var logger=require(_0x7674('0x2'))(_0x7674('0x3'));var moment=require(_0x7674('0x4'));var BPromise=require(_0x7674('0x5'));var rp=require(_0x7674('0x6'));var fs=require('fs');var path=require(_0x7674('0x7'));var rimraf=require('rimraf');var config=require(_0x7674('0x8'));var attributes=require(_0x7674('0x9'));module['exports']=function(_0x36d638,_0x451508){return _0x36d638[_0x7674('0xa')]('IntegrationReport',attributes,{'tableName':_0x7674('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index a0d0490..d5b183e 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x55a323,_0x2f4227){var _0x486ae9=function(_0x286885){while(--_0x286885){_0x55a323['push'](_0x55a323['shift']());}};_0x486ae9(++_0x2f4227);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x50760f,_0x1e3fcc){_0x50760f=_0x50760f-0x0;var _0x4a5389=_0x7a54[_0x50760f];return _0x4a5389;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 41de964..ddf8eaa 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 _0x6ec2=['/:id/sub_intervals/create_many','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','show','post','create','/:id/sub_intervals','addInterval'];(function(_0x44b314,_0x21ff2f){var _0x2b409=function(_0x3cc6ce){while(--_0x3cc6ce){_0x44b314['push'](_0x44b314['shift']());}};_0x2b409(++_0x21ff2f);}(_0x6ec2,0x78));var _0x26ec=function(_0x54a208,_0x431478){_0x54a208=_0x54a208-0x0;var _0x378c68=_0x6ec2[_0x54a208];return _0x378c68;};'use strict';var multer=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var path=require(_0x26ec('0x2'));var timeout=require(_0x26ec('0x3'));var express=require(_0x26ec('0x4'));var router=express[_0x26ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26ec('0x6'));var interaction=require(_0x26ec('0x7'));var config=require(_0x26ec('0x8'));var controller=require(_0x26ec('0x9'));router[_0x26ec('0xa')]('/',auth['isAuthenticated'](),controller[_0x26ec('0xb')]);router['get']('/:id',auth[_0x26ec('0xc')](),controller[_0x26ec('0xd')]);router[_0x26ec('0xa')]('/:id/sub_intervals',auth[_0x26ec('0xc')](),controller['getIntervals']);router[_0x26ec('0xe')]('/',auth[_0x26ec('0xc')](),controller[_0x26ec('0xf')]);router[_0x26ec('0xe')](_0x26ec('0x10'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x11')]);router[_0x26ec('0xe')](_0x26ec('0x12'),auth[_0x26ec('0xc')](),controller['addIntervals']);router['put'](_0x26ec('0x13'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x14')]);router[_0x26ec('0x15')](_0x26ec('0x13'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x16')]);module['exports']=router; \ No newline at end of file +var _0x26d1=['/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0x208c29,_0x33fec9){var _0x392588=function(_0x1dcea6){while(--_0x1dcea6){_0x208c29['push'](_0x208c29['shift']());}};_0x392588(++_0x33fec9);}(_0x26d1,0x8e));var _0x126d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x26d1[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x126d('0x0'));var util=require('util');var path=require(_0x126d('0x1'));var timeout=require(_0x126d('0x2'));var express=require(_0x126d('0x3'));var router=express[_0x126d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x126d('0x5'));var config=require('../../config/environment');var controller=require(_0x126d('0x6'));router[_0x126d('0x7')]('/',auth[_0x126d('0x8')](),controller[_0x126d('0x9')]);router[_0x126d('0x7')]('/:id',auth[_0x126d('0x8')](),controller[_0x126d('0xa')]);router[_0x126d('0x7')](_0x126d('0xb'),auth[_0x126d('0x8')](),controller[_0x126d('0xc')]);router[_0x126d('0xd')]('/',auth['isAuthenticated'](),controller[_0x126d('0xe')]);router[_0x126d('0xd')](_0x126d('0xb'),auth[_0x126d('0x8')](),controller[_0x126d('0xf')]);router['post'](_0x126d('0x10'),auth['isAuthenticated'](),controller[_0x126d('0x11')]);router[_0x126d('0x12')](_0x126d('0x13'),auth['isAuthenticated'](),controller[_0x126d('0x14')]);router[_0x126d('0x15')](_0x126d('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x126d('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d6c80e0..c93bfcd 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 _0xb325=['exports','STRING'];(function(_0x1d8b85,_0x1af0db){var _0x50ad88=function(_0xc9576a){while(--_0xc9576a){_0x1d8b85['push'](_0x1d8b85['shift']());}};_0x50ad88(++_0x1af0db);}(_0xb325,0x6a));var _0x5b32=function(_0xdb42a,_0x58b29a){_0xdb42a=_0xdb42a-0x0;var _0x41a0be=_0xb325[_0xdb42a];return _0x41a0be;};'use strict';var Sequelize=require('sequelize');module[_0x5b32('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5b32('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc897=['sequelize','exports','STRING'];(function(_0x4795e8,_0x1c43db){var _0xcba64d=function(_0x39b192){while(--_0x39b192){_0x4795e8['push'](_0x4795e8['shift']());}};_0xcba64d(++_0x1c43db);}(_0xc897,0x66));var _0x7c89=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xc897[_0x3c51d4];return _0x53c45f;};'use strict';var Sequelize=require(_0x7c89('0x0'));module[_0x7c89('0x1')]={'name':{'type':Sequelize[_0x7c89('0x2')]},'description':{'type':Sequelize[_0x7c89('0x2')]},'interval':{'type':Sequelize[_0x7c89('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 44f2c08..ac35406 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 _0x2ff6=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','save','update','then','get','Intervals','UserProfileResource','destroy','error','stack','send','map','rawAttributes','fieldName','type','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Interval','includeAll','include','rows','show','keys','find','catch','create','body','role','user'];(function(_0x372bd7,_0x421e2c){var _0x5cf7f2=function(_0x1dfac4){while(--_0x1dfac4){_0x372bd7['push'](_0x372bd7['shift']());}};_0x5cf7f2(++_0x421e2c);}(_0x2ff6,0x17f));var _0x62ff=function(_0x210795,_0x7ddf02){_0x210795=_0x210795-0x0;var _0x3c0d6a=_0x2ff6[_0x210795];return _0x3c0d6a;};'use strict';var emlformat=require(_0x62ff('0x0'));var rimraf=require(_0x62ff('0x1'));var zipdir=require(_0x62ff('0x2'));var jsonpatch=require(_0x62ff('0x3'));var rp=require(_0x62ff('0x4'));var moment=require(_0x62ff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62ff('0x6'));var util=require('util');var path=require(_0x62ff('0x7'));var sox=require('sox');var csv=require(_0x62ff('0x8'));var ejs=require(_0x62ff('0x9'));var fs=require('fs');var fs_extra=require(_0x62ff('0xa'));var _=require(_0x62ff('0xb'));var squel=require(_0x62ff('0xc'));var crypto=require(_0x62ff('0xd'));var jsforce=require(_0x62ff('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x62ff('0xf'));var Papa=require(_0x62ff('0x10'));var Redis=require(_0x62ff('0x11'));var authService=require(_0x62ff('0x12'));var qs=require(_0x62ff('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62ff('0x14'));var logger=require(_0x62ff('0x15'))(_0x62ff('0x16'));var utils=require(_0x62ff('0x17'));var config=require(_0x62ff('0x18'));var licenseUtil=require(_0x62ff('0x19'));var db=require(_0x62ff('0x1a'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x356583,_0x428e52){_0x428e52=_0x428e52||0xcc;return function(_0x5c1d9e){if(_0x5c1d9e){return _0x356583[_0x62ff('0x1b')](_0x428e52);}return _0x356583[_0x62ff('0x1c')](_0x428e52)[_0x62ff('0x1d')]();};}function respondWithResult(_0x72d8c9,_0x2dc7f1){_0x2dc7f1=_0x2dc7f1||0xc8;return function(_0x3461d9){if(_0x3461d9){return _0x72d8c9[_0x62ff('0x1c')](_0x2dc7f1)['json'](_0x3461d9);}};}function respondWithFilteredResult(_0xe52e08,_0x4801ff){return function(_0x521910){if(_0x521910){var _0x450bdc=typeof _0x4801ff['offset']===_0x62ff('0x1e')&&typeof _0x4801ff[_0x62ff('0x1f')]===_0x62ff('0x1e');var _0x17b092=_0x521910[_0x62ff('0x20')];var _0x3837f9=_0x450bdc?0x0:_0x4801ff[_0x62ff('0x21')];var _0x47125d=_0x450bdc?_0x521910[_0x62ff('0x20')]:_0x4801ff[_0x62ff('0x21')]+_0x4801ff[_0x62ff('0x1f')];var _0x3a27c1;if(_0x47125d>=_0x17b092){_0x47125d=_0x17b092;_0x3a27c1=0xc8;}else{_0x3a27c1=0xce;}_0xe52e08[_0x62ff('0x1c')](_0x3a27c1);return _0xe52e08[_0x62ff('0x22')](_0x62ff('0x23'),_0x3837f9+'-'+_0x47125d+'/'+_0x17b092)[_0x62ff('0x24')](_0x521910);}return null;};}function patchUpdates(_0x5db7c6){return function(_0x267bd3){try{jsonpatch[_0x62ff('0x25')](_0x267bd3,_0x5db7c6,!![]);}catch(_0x5e34d7){return BPromise[_0x62ff('0x26')](_0x5e34d7);}return _0x267bd3[_0x62ff('0x27')]();};}function saveUpdates(_0xdb5d6c,_0x1cb712){return function(_0x38055f){if(_0x38055f){return _0x38055f[_0x62ff('0x28')](_0xdb5d6c)[_0x62ff('0x29')](function(_0x4ae89d){return _0x4ae89d;});}return null;};}function removeEntity(_0x403dae,_0x29c043){return function(_0x15fc72){if(_0x15fc72){return _0x15fc72['destroy']()[_0x62ff('0x29')](function(){var _0x770f7a=_0x15fc72[_0x62ff('0x2a')]({'plain':!![]});var _0x5ddc67=_0x62ff('0x2b');return db[_0x62ff('0x2c')][_0x62ff('0x2d')]({'where':{'type':_0x5ddc67,'resourceId':_0x770f7a['id']}})[_0x62ff('0x29')](function(){return _0x15fc72;});})[_0x62ff('0x29')](function(){_0x403dae['status'](0xcc)[_0x62ff('0x1d')]();});}};}function handleEntityNotFound(_0x578f9f,_0x2e2a22){return function(_0x13e9aa){if(!_0x13e9aa){_0x578f9f[_0x62ff('0x1b')](0x194);}return _0x13e9aa;};}function handleError(_0x51e7fd,_0x2579ed){_0x2579ed=_0x2579ed||0x1f4;return function(_0x3d1a35){logger[_0x62ff('0x2e')](_0x3d1a35[_0x62ff('0x2f')]);if(_0x3d1a35['name']){delete _0x3d1a35['name'];}_0x51e7fd[_0x62ff('0x1c')](_0x2579ed)[_0x62ff('0x30')](_0x3d1a35);};}exports['index']=function(_0x3463db,_0x32f724){var _0x3376a7={},_0x4da580={},_0x49c3e7={'count':0x0,'rows':[]};var _0x5d3254=_[_0x62ff('0x31')](db['Interval'][_0x62ff('0x32')],function(_0x379f9b){return{'name':_0x379f9b[_0x62ff('0x33')],'type':_0x379f9b[_0x62ff('0x34')]['key']};});_0x4da580['model']=_[_0x62ff('0x31')](_0x5d3254,_0x62ff('0x35'));_0x4da580[_0x62ff('0x36')]=_['keys'](_0x3463db['query']);_0x4da580[_0x62ff('0x37')]=_[_0x62ff('0x38')](_0x4da580['model'],_0x4da580[_0x62ff('0x36')]);_0x3376a7['attributes']=_[_0x62ff('0x38')](_0x4da580[_0x62ff('0x39')],qs[_0x62ff('0x3a')](_0x3463db[_0x62ff('0x36')][_0x62ff('0x3a')]));_0x3376a7[_0x62ff('0x3b')]=_0x3376a7[_0x62ff('0x3b')][_0x62ff('0x3c')]?_0x3376a7[_0x62ff('0x3b')]:_0x4da580[_0x62ff('0x39')];if(!_0x3463db[_0x62ff('0x36')][_0x62ff('0x3d')](_0x62ff('0x3e'))){_0x3376a7['limit']=qs[_0x62ff('0x1f')](_0x3463db[_0x62ff('0x36')][_0x62ff('0x1f')]);_0x3376a7[_0x62ff('0x21')]=qs[_0x62ff('0x21')](_0x3463db['query']['offset']);}_0x3376a7[_0x62ff('0x3f')]=qs['sort'](_0x3463db[_0x62ff('0x36')][_0x62ff('0x40')]);_0x3376a7[_0x62ff('0x41')]=qs[_0x62ff('0x37')](_['pick'](_0x3463db['query'],_0x4da580[_0x62ff('0x37')]),_0x5d3254);if(_0x3463db[_0x62ff('0x36')][_0x62ff('0x42')]){_0x3376a7[_0x62ff('0x41')]=_[_0x62ff('0x43')](_0x3376a7[_0x62ff('0x41')],{'$or':_['map'](_0x5d3254,function(_0x2cd6ee){if(_0x2cd6ee[_0x62ff('0x34')]!==_0x62ff('0x44')){var _0x3c9ebd={};_0x3c9ebd[_0x2cd6ee[_0x62ff('0x35')]]={'$like':'%'+_0x3463db[_0x62ff('0x36')][_0x62ff('0x42')]+'%'};return _0x3c9ebd;}})});}_0x3376a7=_['merge']({},_0x3376a7,_0x3463db[_0x62ff('0x45')]);var _0x162fe1={'where':_0x3376a7[_0x62ff('0x41')]};return db[_0x62ff('0x46')]['count'](_0x162fe1)[_0x62ff('0x29')](function(_0x26b5b3){_0x49c3e7[_0x62ff('0x20')]=_0x26b5b3;if(_0x3463db[_0x62ff('0x36')][_0x62ff('0x47')]){_0x3376a7[_0x62ff('0x48')]=[{'all':!![]}];}return db[_0x62ff('0x46')]['findAll'](_0x3376a7);})['then'](function(_0x57a214){_0x49c3e7[_0x62ff('0x49')]=_0x57a214;return _0x49c3e7;})[_0x62ff('0x29')](respondWithFilteredResult(_0x32f724,_0x3376a7))['catch'](handleError(_0x32f724,null));};exports[_0x62ff('0x4a')]=function(_0x299134,_0x20a492){var _0x99e007={'raw':!![],'where':{'id':_0x299134['params']['id']}},_0xe0e57e={};_0xe0e57e[_0x62ff('0x39')]=_[_0x62ff('0x4b')](db[_0x62ff('0x46')][_0x62ff('0x32')]);_0xe0e57e[_0x62ff('0x36')]=_[_0x62ff('0x4b')](_0x299134[_0x62ff('0x36')]);_0xe0e57e['filters']=_[_0x62ff('0x38')](_0xe0e57e[_0x62ff('0x39')],_0xe0e57e['query']);_0x99e007[_0x62ff('0x3b')]=_[_0x62ff('0x38')](_0xe0e57e[_0x62ff('0x39')],qs[_0x62ff('0x3a')](_0x299134[_0x62ff('0x36')][_0x62ff('0x3a')]));_0x99e007[_0x62ff('0x3b')]=_0x99e007[_0x62ff('0x3b')][_0x62ff('0x3c')]?_0x99e007[_0x62ff('0x3b')]:_0xe0e57e['model'];if(_0x299134['query'][_0x62ff('0x47')]){_0x99e007[_0x62ff('0x48')]=[{'all':!![]}];}_0x99e007=_[_0x62ff('0x43')]({},_0x99e007,_0x299134['options']);return db[_0x62ff('0x46')][_0x62ff('0x4c')](_0x99e007)[_0x62ff('0x29')](handleEntityNotFound(_0x20a492,null))['then'](respondWithResult(_0x20a492,null))[_0x62ff('0x4d')](handleError(_0x20a492,null));};exports[_0x62ff('0x4e')]=function(_0x59d5f4,_0x3967d5){return db[_0x62ff('0x46')][_0x62ff('0x4e')](_0x59d5f4[_0x62ff('0x4f')],{})[_0x62ff('0x29')](function(_0x50fae6){var _0x3a9f9e=_0x59d5f4['user'][_0x62ff('0x2a')]({'plain':!![]});if(!_0x3a9f9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a9f9e[_0x62ff('0x50')]===_0x62ff('0x51')){var _0x1e4116=_0x50fae6['get']({'plain':!![]});var _0xf24984=_0x62ff('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0xf24984,'userProfileId':_0x3a9f9e[_0x62ff('0x52')]},'raw':!![]})[_0x62ff('0x29')](function(_0x268e0f){if(_0x268e0f&&_0x268e0f['autoAssociation']===0x0){return db[_0x62ff('0x2c')][_0x62ff('0x4e')]({'name':_0x1e4116[_0x62ff('0x35')],'resourceId':_0x1e4116['id'],'type':_0x268e0f['name'],'sectionId':_0x268e0f['id']},{})[_0x62ff('0x29')](function(){return _0x50fae6;});}else{return _0x50fae6;}})['catch'](function(_0x260fc0){logger[_0x62ff('0x2e')](_0x62ff('0x53'),_0x260fc0);throw _0x260fc0;});}return _0x50fae6;})[_0x62ff('0x29')](respondWithResult(_0x3967d5,0xc9))['catch'](handleError(_0x3967d5,null));};exports[_0x62ff('0x28')]=function(_0x353ce5,_0x3bbcfd){if(_0x353ce5[_0x62ff('0x4f')]['id']){delete _0x353ce5[_0x62ff('0x4f')]['id'];}return db['Interval']['find']({'where':{'id':_0x353ce5[_0x62ff('0x54')]['id']}})[_0x62ff('0x29')](handleEntityNotFound(_0x3bbcfd,null))[_0x62ff('0x29')](saveUpdates(_0x353ce5[_0x62ff('0x4f')],null))[_0x62ff('0x29')](respondWithResult(_0x3bbcfd,null))[_0x62ff('0x4d')](handleError(_0x3bbcfd,null));};exports[_0x62ff('0x2d')]=function(_0x5c6c42,_0x33a78c){return db[_0x62ff('0x46')][_0x62ff('0x4c')]({'where':{'id':_0x5c6c42['params']['id']}})[_0x62ff('0x29')](handleEntityNotFound(_0x33a78c,null))['then'](removeEntity(_0x33a78c,null))[_0x62ff('0x4d')](handleError(_0x33a78c,null));};exports[_0x62ff('0x55')]=function(_0x1d2be3,_0x5bb2c6,_0x27f3d5){if(_0x1d2be3[_0x62ff('0x4f')]['id']){delete _0x1d2be3[_0x62ff('0x4f')]['id'];}return db[_0x62ff('0x46')][_0x62ff('0x4c')]({'where':{'id':_0x1d2be3['params']['id']}})['then'](handleEntityNotFound(_0x5bb2c6,null))[_0x62ff('0x29')](function(_0x1ad876){if(_0x1ad876){_0x1d2be3[_0x62ff('0x4f')][_0x62ff('0x56')]=_0x1ad876['id'];return db['Interval'][_0x62ff('0x4e')](_0x1d2be3[_0x62ff('0x4f')]);}})[_0x62ff('0x29')](respondWithResult(_0x5bb2c6,null))[_0x62ff('0x4d')](handleError(_0x5bb2c6,null));};exports['getIntervals']=function(_0x30d5b2,_0x203d89,_0x2bad0a){var _0x4eb75e={};var _0xa979ba={};var _0x5af79e;var _0x33c969;return db[_0x62ff('0x46')][_0x62ff('0x57')]({'where':{'id':_0x30d5b2[_0x62ff('0x54')]['id']}})[_0x62ff('0x29')](handleEntityNotFound(_0x203d89,null))[_0x62ff('0x29')](function(_0x2c597a){if(_0x2c597a){_0x5af79e=_0x2c597a;_0xa979ba[_0x62ff('0x39')]=_[_0x62ff('0x4b')](db['Interval']['rawAttributes']);_0xa979ba[_0x62ff('0x36')]=_[_0x62ff('0x4b')](_0x30d5b2[_0x62ff('0x36')]);_0xa979ba[_0x62ff('0x37')]=_[_0x62ff('0x38')](_0xa979ba[_0x62ff('0x39')],_0xa979ba[_0x62ff('0x36')]);_0x4eb75e[_0x62ff('0x3b')]=_[_0x62ff('0x38')](_0xa979ba[_0x62ff('0x39')],qs[_0x62ff('0x3a')](_0x30d5b2[_0x62ff('0x36')][_0x62ff('0x3a')]));_0x4eb75e[_0x62ff('0x3b')]=_0x4eb75e['attributes'][_0x62ff('0x3c')]?_0x4eb75e[_0x62ff('0x3b')]:_0xa979ba[_0x62ff('0x39')];_0x4eb75e['order']=qs[_0x62ff('0x40')](_0x30d5b2[_0x62ff('0x36')][_0x62ff('0x40')]);_0x4eb75e[_0x62ff('0x41')]=qs[_0x62ff('0x37')](_['pick'](_0x30d5b2[_0x62ff('0x36')],_0xa979ba[_0x62ff('0x37')]));if(_0x30d5b2[_0x62ff('0x36')][_0x62ff('0x42')]){_0x4eb75e[_0x62ff('0x41')]=_[_0x62ff('0x43')](_0x4eb75e['where'],{'$or':_[_0x62ff('0x31')](_0x4eb75e['attributes'],function(_0x4191ed){var _0x23fb50={};_0x23fb50[_0x4191ed]={'$like':'%'+_0x30d5b2[_0x62ff('0x36')][_0x62ff('0x42')]+'%'};return _0x23fb50;})});}_0x4eb75e=_[_0x62ff('0x43')]({},_0x4eb75e,_0x30d5b2[_0x62ff('0x45')]);return _0x5af79e['getIntervals'](_0x4eb75e);}})[_0x62ff('0x29')](function(_0x43f3b4){if(_0x43f3b4){_0x33c969=_0x43f3b4[_0x62ff('0x3c')];if(!_0x30d5b2[_0x62ff('0x36')][_0x62ff('0x3d')]('nolimit')){_0x4eb75e[_0x62ff('0x1f')]=qs[_0x62ff('0x1f')](_0x30d5b2['query']['limit']);_0x4eb75e[_0x62ff('0x21')]=qs['offset'](_0x30d5b2['query']['offset']);}return _0x5af79e[_0x62ff('0x58')](_0x4eb75e);}})[_0x62ff('0x29')](function(_0xe455ce){if(_0xe455ce){return _0xe455ce?{'count':_0x33c969,'rows':_0xe455ce}:null;}})[_0x62ff('0x29')](respondWithResult(_0x203d89,null))[_0x62ff('0x4d')](handleError(_0x203d89,null));};exports[_0x62ff('0x59')]=function(_0x36eee1,_0x5a336e,_0x3ac415){return db[_0x62ff('0x46')]['findOne']({'where':{'id':_0x36eee1['params']['id']}})[_0x62ff('0x29')](handleEntityNotFound(_0x5a336e,null))[_0x62ff('0x29')](function(_0x4f9e77){if(_0x4f9e77){return db[_0x62ff('0x5a')][_0x62ff('0x5b')](function(_0x4686a8){return db[_0x62ff('0x46')][_0x62ff('0x2d')]({'where':{'IntervalId':_0x36eee1[_0x62ff('0x54')]['id']},'transaction':_0x4686a8})[_0x62ff('0x29')](function(_0x907a38){var _0x5d8cd9=_[_0x62ff('0x31')](_0x36eee1[_0x62ff('0x4f')],function(_0x3cec02){delete _0x3cec02['id'];_0x3cec02[_0x62ff('0x56')]=_0x36eee1['params']['id'];return _0x3cec02;});return db[_0x62ff('0x46')][_0x62ff('0x5c')](_0x5d8cd9,{'transaction':_0x4686a8});});})['then'](function(){return db[_0x62ff('0x46')]['findAll']({'where':{'IntervalId':_0x36eee1['params']['id']}});});}})[_0x62ff('0x29')](respondWithResult(_0x5a336e,null))[_0x62ff('0x4d')](handleError(_0x5a336e,null));}; \ No newline at end of file +var _0xf135=['api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','count','set','apply','reject','then','destroy','get','Intervals','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','filters','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x31d6c0,_0x124577){var _0x5d6e72=function(_0x4e8b2c){while(--_0x4e8b2c){_0x31d6c0['push'](_0x31d6c0['shift']());}};_0x5d6e72(++_0x124577);}(_0xf135,0x1b2));var _0x5f13=function(_0x151b9a,_0x2721dd){_0x151b9a=_0x151b9a-0x0;var _0x3633d9=_0xf135[_0x151b9a];return _0x3633d9;};'use strict';var emlformat=require(_0x5f13('0x0'));var rimraf=require(_0x5f13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f13('0x2'));var rp=require('request-promise');var moment=require(_0x5f13('0x3'));var BPromise=require(_0x5f13('0x4'));var Mustache=require(_0x5f13('0x5'));var util=require(_0x5f13('0x6'));var path=require(_0x5f13('0x7'));var sox=require(_0x5f13('0x8'));var csv=require(_0x5f13('0x9'));var ejs=require(_0x5f13('0xa'));var fs=require('fs');var fs_extra=require(_0x5f13('0xb'));var _=require(_0x5f13('0xc'));var squel=require(_0x5f13('0xd'));var crypto=require(_0x5f13('0xe'));var jsforce=require(_0x5f13('0xf'));var deskjs=require(_0x5f13('0x10'));var toCsv=require(_0x5f13('0x9'));var querystring=require(_0x5f13('0x11'));var Papa=require(_0x5f13('0x12'));var Redis=require(_0x5f13('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f13('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f13('0x15'));var utils=require(_0x5f13('0x16'));var config=require(_0x5f13('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f13('0x18'))['db'];var extensions=require(_0x5f13('0x19'));function respondWithStatusCode(_0x2d4ab0,_0x84703c){_0x84703c=_0x84703c||0xcc;return function(_0x1e42a9){if(_0x1e42a9){return _0x2d4ab0['sendStatus'](_0x84703c);}return _0x2d4ab0[_0x5f13('0x1a')](_0x84703c)['end']();};}function respondWithResult(_0x3acc37,_0x1cf85a){_0x1cf85a=_0x1cf85a||0xc8;return function(_0x275f8d){if(_0x275f8d){return _0x3acc37[_0x5f13('0x1a')](_0x1cf85a)[_0x5f13('0x1b')](_0x275f8d);}};}function respondWithFilteredResult(_0x522478,_0x264e77){return function(_0x3c2fae){if(_0x3c2fae){var _0x3000db=typeof _0x264e77[_0x5f13('0x1c')]===_0x5f13('0x1d')&&typeof _0x264e77['limit']===_0x5f13('0x1d');var _0x392511=_0x3c2fae[_0x5f13('0x1e')];var _0x50f412=_0x3000db?0x0:_0x264e77[_0x5f13('0x1c')];var _0x5000e9=_0x3000db?_0x3c2fae[_0x5f13('0x1e')]:_0x264e77[_0x5f13('0x1c')]+_0x264e77['limit'];var _0x59955b;if(_0x5000e9>=_0x392511){_0x5000e9=_0x392511;_0x59955b=0xc8;}else{_0x59955b=0xce;}_0x522478[_0x5f13('0x1a')](_0x59955b);return _0x522478[_0x5f13('0x1f')]('Content-Range',_0x50f412+'-'+_0x5000e9+'/'+_0x392511)[_0x5f13('0x1b')](_0x3c2fae);}return null;};}function patchUpdates(_0x2e09a4){return function(_0x118386){try{jsonpatch[_0x5f13('0x20')](_0x118386,_0x2e09a4,!![]);}catch(_0x5318d7){return BPromise[_0x5f13('0x21')](_0x5318d7);}return _0x118386['save']();};}function saveUpdates(_0x483d00,_0x5372b6){return function(_0x3d5db0){if(_0x3d5db0){return _0x3d5db0['update'](_0x483d00)[_0x5f13('0x22')](function(_0x5352e0){return _0x5352e0;});}return null;};}function removeEntity(_0x49d50e,_0x503b89){return function(_0x306131){if(_0x306131){return _0x306131[_0x5f13('0x23')]()[_0x5f13('0x22')](function(){var _0x354a21=_0x306131[_0x5f13('0x24')]({'plain':!![]});var _0x51437f=_0x5f13('0x25');return db[_0x5f13('0x26')][_0x5f13('0x23')]({'where':{'type':_0x51437f,'resourceId':_0x354a21['id']}})[_0x5f13('0x22')](function(){return _0x306131;});})['then'](function(){_0x49d50e[_0x5f13('0x1a')](0xcc)[_0x5f13('0x27')]();});}};}function handleEntityNotFound(_0x5e7ecd,_0x222318){return function(_0x151ba3){if(!_0x151ba3){_0x5e7ecd[_0x5f13('0x28')](0x194);}return _0x151ba3;};}function handleError(_0x2f9090,_0x43131e){_0x43131e=_0x43131e||0x1f4;return function(_0x209707){logger[_0x5f13('0x29')](_0x209707[_0x5f13('0x2a')]);if(_0x209707[_0x5f13('0x2b')]){delete _0x209707[_0x5f13('0x2b')];}_0x2f9090['status'](_0x43131e)[_0x5f13('0x2c')](_0x209707);};}exports[_0x5f13('0x2d')]=function(_0x5d0156,_0x7e49){var _0x2de85f={},_0x1418f5={},_0x2a58a3={'count':0x0,'rows':[]};var _0x17d894=_[_0x5f13('0x2e')](db[_0x5f13('0x2f')][_0x5f13('0x30')],function(_0x81e6dc){return{'name':_0x81e6dc['fieldName'],'type':_0x81e6dc[_0x5f13('0x31')][_0x5f13('0x32')]};});_0x1418f5['model']=_['map'](_0x17d894,_0x5f13('0x2b'));_0x1418f5[_0x5f13('0x33')]=_[_0x5f13('0x34')](_0x5d0156['query']);_0x1418f5['filters']=_[_0x5f13('0x35')](_0x1418f5['model'],_0x1418f5[_0x5f13('0x33')]);_0x2de85f['attributes']=_[_0x5f13('0x35')](_0x1418f5[_0x5f13('0x36')],qs[_0x5f13('0x37')](_0x5d0156[_0x5f13('0x33')][_0x5f13('0x37')]));_0x2de85f[_0x5f13('0x38')]=_0x2de85f[_0x5f13('0x38')][_0x5f13('0x39')]?_0x2de85f[_0x5f13('0x38')]:_0x1418f5[_0x5f13('0x36')];if(!_0x5d0156[_0x5f13('0x33')][_0x5f13('0x3a')](_0x5f13('0x3b'))){_0x2de85f[_0x5f13('0x3c')]=qs[_0x5f13('0x3c')](_0x5d0156['query'][_0x5f13('0x3c')]);_0x2de85f['offset']=qs[_0x5f13('0x1c')](_0x5d0156[_0x5f13('0x33')][_0x5f13('0x1c')]);}_0x2de85f[_0x5f13('0x3d')]=qs[_0x5f13('0x3e')](_0x5d0156[_0x5f13('0x33')]['sort']);_0x2de85f[_0x5f13('0x3f')]=qs['filters'](_[_0x5f13('0x40')](_0x5d0156['query'],_0x1418f5['filters']),_0x17d894);if(_0x5d0156[_0x5f13('0x33')]['filter']){_0x2de85f[_0x5f13('0x3f')]=_[_0x5f13('0x41')](_0x2de85f[_0x5f13('0x3f')],{'$or':_['map'](_0x17d894,function(_0x18b146){if(_0x18b146[_0x5f13('0x31')]!==_0x5f13('0x42')){var _0x29e9c1={};_0x29e9c1[_0x18b146[_0x5f13('0x2b')]]={'$like':'%'+_0x5d0156[_0x5f13('0x33')][_0x5f13('0x43')]+'%'};return _0x29e9c1;}})});}_0x2de85f=_[_0x5f13('0x41')]({},_0x2de85f,_0x5d0156['options']);var _0x3a1fd8={'where':_0x2de85f[_0x5f13('0x3f')]};return db[_0x5f13('0x2f')][_0x5f13('0x1e')](_0x3a1fd8)[_0x5f13('0x22')](function(_0x412975){_0x2a58a3['count']=_0x412975;if(_0x5d0156['query'][_0x5f13('0x44')]){_0x2de85f[_0x5f13('0x45')]=[{'all':!![]}];}return db[_0x5f13('0x2f')]['findAll'](_0x2de85f);})[_0x5f13('0x22')](function(_0x1e0844){_0x2a58a3[_0x5f13('0x46')]=_0x1e0844;return _0x2a58a3;})[_0x5f13('0x22')](respondWithFilteredResult(_0x7e49,_0x2de85f))[_0x5f13('0x47')](handleError(_0x7e49,null));};exports[_0x5f13('0x48')]=function(_0x519338,_0x23e243){var _0x295f0c={'raw':!![],'where':{'id':_0x519338[_0x5f13('0x49')]['id']}},_0x4bd8a0={};_0x4bd8a0[_0x5f13('0x36')]=_['keys'](db[_0x5f13('0x2f')][_0x5f13('0x30')]);_0x4bd8a0[_0x5f13('0x33')]=_['keys'](_0x519338[_0x5f13('0x33')]);_0x4bd8a0[_0x5f13('0x4a')]=_[_0x5f13('0x35')](_0x4bd8a0[_0x5f13('0x36')],_0x4bd8a0[_0x5f13('0x33')]);_0x295f0c['attributes']=_[_0x5f13('0x35')](_0x4bd8a0[_0x5f13('0x36')],qs[_0x5f13('0x37')](_0x519338[_0x5f13('0x33')]['fields']));_0x295f0c[_0x5f13('0x38')]=_0x295f0c[_0x5f13('0x38')][_0x5f13('0x39')]?_0x295f0c['attributes']:_0x4bd8a0[_0x5f13('0x36')];if(_0x519338[_0x5f13('0x33')][_0x5f13('0x44')]){_0x295f0c[_0x5f13('0x45')]=[{'all':!![]}];}_0x295f0c=_['merge']({},_0x295f0c,_0x519338[_0x5f13('0x4b')]);return db[_0x5f13('0x2f')][_0x5f13('0x4c')](_0x295f0c)[_0x5f13('0x22')](handleEntityNotFound(_0x23e243,null))['then'](respondWithResult(_0x23e243,null))['catch'](handleError(_0x23e243,null));};exports[_0x5f13('0x4d')]=function(_0x253625,_0x1c7531){return db[_0x5f13('0x2f')][_0x5f13('0x4d')](_0x253625[_0x5f13('0x4e')],{})[_0x5f13('0x22')](function(_0x544a3a){var _0x577e4b=_0x253625['user']['get']({'plain':!![]});if(!_0x577e4b)throw new Error(_0x5f13('0x4f'));if(_0x577e4b[_0x5f13('0x50')]===_0x5f13('0x51')){var _0x11ea10=_0x544a3a[_0x5f13('0x24')]({'plain':!![]});var _0x556895=_0x5f13('0x25');return db['UserProfileSection'][_0x5f13('0x4c')]({'where':{'name':_0x556895,'userProfileId':_0x577e4b[_0x5f13('0x52')]},'raw':!![]})[_0x5f13('0x22')](function(_0x5aea3a){if(_0x5aea3a&&_0x5aea3a['autoAssociation']===0x0){return db['UserProfileResource'][_0x5f13('0x4d')]({'name':_0x11ea10[_0x5f13('0x2b')],'resourceId':_0x11ea10['id'],'type':_0x5aea3a['name'],'sectionId':_0x5aea3a['id']},{})[_0x5f13('0x22')](function(){return _0x544a3a;});}else{return _0x544a3a;}})[_0x5f13('0x47')](function(_0x14f6f7){logger[_0x5f13('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14f6f7);throw _0x14f6f7;});}return _0x544a3a;})[_0x5f13('0x22')](respondWithResult(_0x1c7531,0xc9))[_0x5f13('0x47')](handleError(_0x1c7531,null));};exports['update']=function(_0x41179,_0x187569){if(_0x41179[_0x5f13('0x4e')]['id']){delete _0x41179[_0x5f13('0x4e')]['id'];}return db['Interval'][_0x5f13('0x4c')]({'where':{'id':_0x41179[_0x5f13('0x49')]['id']}})[_0x5f13('0x22')](handleEntityNotFound(_0x187569,null))['then'](saveUpdates(_0x41179[_0x5f13('0x4e')],null))[_0x5f13('0x22')](respondWithResult(_0x187569,null))['catch'](handleError(_0x187569,null));};exports['destroy']=function(_0x5d0231,_0x4b6d56){return db[_0x5f13('0x2f')][_0x5f13('0x4c')]({'where':{'id':_0x5d0231[_0x5f13('0x49')]['id']}})[_0x5f13('0x22')](handleEntityNotFound(_0x4b6d56,null))[_0x5f13('0x22')](removeEntity(_0x4b6d56,null))[_0x5f13('0x47')](handleError(_0x4b6d56,null));};exports[_0x5f13('0x53')]=function(_0x28c5b5,_0x496da9,_0x56b97e){if(_0x28c5b5['body']['id']){delete _0x28c5b5[_0x5f13('0x4e')]['id'];}return db[_0x5f13('0x2f')]['find']({'where':{'id':_0x28c5b5['params']['id']}})[_0x5f13('0x22')](handleEntityNotFound(_0x496da9,null))['then'](function(_0x42243c){if(_0x42243c){_0x28c5b5[_0x5f13('0x4e')][_0x5f13('0x54')]=_0x42243c['id'];return db[_0x5f13('0x2f')][_0x5f13('0x4d')](_0x28c5b5['body']);}})[_0x5f13('0x22')](respondWithResult(_0x496da9,null))[_0x5f13('0x47')](handleError(_0x496da9,null));};exports[_0x5f13('0x55')]=function(_0x2c9213,_0x43bf0d,_0x3a7884){var _0x35f47a={};var _0xcea259={};var _0x44b30d;var _0x471500;return db['Interval'][_0x5f13('0x56')]({'where':{'id':_0x2c9213[_0x5f13('0x49')]['id']}})[_0x5f13('0x22')](handleEntityNotFound(_0x43bf0d,null))[_0x5f13('0x22')](function(_0x1a59a7){if(_0x1a59a7){_0x44b30d=_0x1a59a7;_0xcea259[_0x5f13('0x36')]=_[_0x5f13('0x34')](db[_0x5f13('0x2f')]['rawAttributes']);_0xcea259[_0x5f13('0x33')]=_['keys'](_0x2c9213[_0x5f13('0x33')]);_0xcea259[_0x5f13('0x4a')]=_[_0x5f13('0x35')](_0xcea259[_0x5f13('0x36')],_0xcea259[_0x5f13('0x33')]);_0x35f47a['attributes']=_['intersection'](_0xcea259[_0x5f13('0x36')],qs['fields'](_0x2c9213['query'][_0x5f13('0x37')]));_0x35f47a[_0x5f13('0x38')]=_0x35f47a[_0x5f13('0x38')][_0x5f13('0x39')]?_0x35f47a[_0x5f13('0x38')]:_0xcea259[_0x5f13('0x36')];_0x35f47a[_0x5f13('0x3d')]=qs[_0x5f13('0x3e')](_0x2c9213[_0x5f13('0x33')][_0x5f13('0x3e')]);_0x35f47a[_0x5f13('0x3f')]=qs[_0x5f13('0x4a')](_[_0x5f13('0x40')](_0x2c9213[_0x5f13('0x33')],_0xcea259[_0x5f13('0x4a')]));if(_0x2c9213[_0x5f13('0x33')][_0x5f13('0x43')]){_0x35f47a[_0x5f13('0x3f')]=_[_0x5f13('0x41')](_0x35f47a[_0x5f13('0x3f')],{'$or':_[_0x5f13('0x2e')](_0x35f47a['attributes'],function(_0x433378){var _0x37c153={};_0x37c153[_0x433378]={'$like':'%'+_0x2c9213['query']['filter']+'%'};return _0x37c153;})});}_0x35f47a=_[_0x5f13('0x41')]({},_0x35f47a,_0x2c9213['options']);return _0x44b30d[_0x5f13('0x55')](_0x35f47a);}})['then'](function(_0x11b962){if(_0x11b962){_0x471500=_0x11b962['length'];if(!_0x2c9213[_0x5f13('0x33')][_0x5f13('0x3a')](_0x5f13('0x3b'))){_0x35f47a[_0x5f13('0x3c')]=qs['limit'](_0x2c9213['query'][_0x5f13('0x3c')]);_0x35f47a['offset']=qs['offset'](_0x2c9213[_0x5f13('0x33')]['offset']);}return _0x44b30d[_0x5f13('0x55')](_0x35f47a);}})[_0x5f13('0x22')](function(_0x9198fd){if(_0x9198fd){return _0x9198fd?{'count':_0x471500,'rows':_0x9198fd}:null;}})[_0x5f13('0x22')](respondWithResult(_0x43bf0d,null))[_0x5f13('0x47')](handleError(_0x43bf0d,null));};exports['addIntervals']=function(_0x1c6538,_0x12e0b0,_0xb42105){return db[_0x5f13('0x2f')][_0x5f13('0x56')]({'where':{'id':_0x1c6538['params']['id']}})[_0x5f13('0x22')](handleEntityNotFound(_0x12e0b0,null))[_0x5f13('0x22')](function(_0x12aeb7){if(_0x12aeb7){return db[_0x5f13('0x57')][_0x5f13('0x58')](function(_0x4806a9){return db[_0x5f13('0x2f')]['destroy']({'where':{'IntervalId':_0x1c6538[_0x5f13('0x49')]['id']},'transaction':_0x4806a9})[_0x5f13('0x22')](function(_0x2ff62b){var _0x44aebb=_[_0x5f13('0x2e')](_0x1c6538[_0x5f13('0x4e')],function(_0x396bbb){delete _0x396bbb['id'];_0x396bbb['IntervalId']=_0x1c6538[_0x5f13('0x49')]['id'];return _0x396bbb;});return db[_0x5f13('0x2f')][_0x5f13('0x59')](_0x44aebb,{'transaction':_0x4806a9});});})['then'](function(){return db[_0x5f13('0x2f')][_0x5f13('0x5a')]({'where':{'IntervalId':_0x1c6538[_0x5f13('0x49')]['id']}});});}})['then'](respondWithResult(_0x12e0b0,null))[_0x5f13('0x47')](handleError(_0x12e0b0,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6683454..98546d8 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 _0x1892=['path','rimraf','../../config/environment','define','rewrite','lodash','util','api','bluebird'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x1892,0x1a3));var _0x2189=function(_0x4a8228,_0x2b0fec){_0x4a8228=_0x4a8228-0x0;var _0x2b1436=_0x1892[_0x4a8228];return _0x2b1436;};'use strict';var _=require(_0x2189('0x0'));var util=require(_0x2189('0x1'));var logger=require('../../config/logger')(_0x2189('0x2'));var moment=require('moment');var BPromise=require(_0x2189('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2189('0x4'));var rimraf=require(_0x2189('0x5'));var config=require(_0x2189('0x6'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x4acb80,_0x2dfac7){return _0x4acb80[_0x2189('0x7')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x24e45c,_0x2dd19b){extensions[_0x2189('0x8')](_0x4acb80,_0x24e45c);},'afterBulkCreate':function(_0x509ece,_0x69c7d4,_0x1eda54){_0x1eda54();extensions[_0x2189('0x8')](_0x4acb80,_0x509ece[0x0]);},'afterUpdate':function(_0x421d58,_0x5e7e59){extensions[_0x2189('0x8')](_0x4acb80,_0x421d58);},'afterDestroy':function(_0x4aeada,_0x32d4d4){extensions[_0x2189('0x8')](_0x4acb80,_0x4aeada);}}});}; \ No newline at end of file +var _0xbf9b=['define','rewrite','api','request-promise','path','rimraf','./interval.attributes','exports'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0xbf9b,0x172));var _0xbbf9=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xbf9b[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbbf9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbbf9('0x1'));var fs=require('fs');var path=require(_0xbbf9('0x2'));var rimraf=require(_0xbbf9('0x3'));var config=require('../../config/environment');var attributes=require(_0xbbf9('0x4'));var extensions=require('../../components/extensions/rewrite');module[_0xbbf9('0x5')]=function(_0x1ca349,_0x4caa4a){return _0x1ca349[_0xbbf9('0x6')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x6e7994,_0x2ecf82){extensions[_0xbbf9('0x7')](_0x1ca349,_0x6e7994);},'afterBulkCreate':function(_0x5cbe17,_0x4f1363,_0x4843cd){_0x4843cd();extensions[_0xbbf9('0x7')](_0x1ca349,_0x5cbe17[0x0]);},'afterUpdate':function(_0x118eef,_0x4bcd7b){extensions[_0xbbf9('0x7')](_0x1ca349,_0x118eef);},'afterDestroy':function(_0x4b41d6,_0x1f2cf3){extensions[_0xbbf9('0x7')](_0x1ca349,_0x4b41d6);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index bfcd37c..cf7c4e3 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 407100c..759687e 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x9b0e90,_0x466ddb){var _0x4e6376=function(_0x45e894){while(--_0x45e894){_0x9b0e90['push'](_0x9b0e90['shift']());}};_0x4e6376(++_0x466ddb);}(_0x2032,0xd9));var _0x2203=function(_0x26372e,_0x3f4f2c){_0x26372e=_0x26372e-0x0;var _0x25303d=_0x2032[_0x26372e];return _0x25303d;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x434ee6,_0x349e9a){var _0x46e5a7=function(_0x5f0226){while(--_0x5f0226){_0x434ee6['push'](_0x434ee6['shift']());}};_0x46e5a7(++_0x349e9a);}(_0x2ef3,0xba));var _0x32ef=function(_0x406c1c,_0x535641){_0x406c1c=_0x406c1c-0x0;var _0x3526cd=_0x2ef3[_0x406c1c];return _0x3526cd;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 2eff18a..8076faa 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 _0x8a69=['name','customfield_11504','reason','track.xcallymotion.com','application/json','Basic\x20','toString','base64','request','utf8','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','stringify','issuetype','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a69,0x13f));var _0x98a6=function(_0x56a9fc,_0x372087){_0x56a9fc=_0x56a9fc-0x0;var _0x2ef9e3=_0x8a69[_0x56a9fc];return _0x2ef9e3;};'use strict';var BPromise=require(_0x98a6('0x0'));var https=require(_0x98a6('0x1'));var logger=require(_0x98a6('0x2'))(_0x98a6('0x3'));var USERNAME='support';var PASSWORD=_0x98a6('0x4');function openIssue(_0x50ed06,_0x451b8f){var _0x5878d3={'fields':{'project':{'key':_0x50ed06[_0x98a6('0x5')]||_0x98a6('0x6')},'summary':(_0x50ed06['summary']||_0x98a6('0x7'))+_0x98a6('0x8')+_0x50ed06['ip'],'description':_0x50ed06['description']||JSON[_0x98a6('0x9')](_0x50ed06),'issuetype':{'name':_0x50ed06[_0x98a6('0xa')]||'Bug'}}};_0x5878d3['fields']['customfield_11500']=_0x50ed06[_0x98a6('0xb')];_0x5878d3[_0x98a6('0xc')][_0x98a6('0xd')]=_0x50ed06['oldToken'];_0x5878d3[_0x98a6('0xc')][_0x98a6('0xe')]=_0x50ed06[_0x98a6('0xf')];_0x5878d3[_0x98a6('0xc')][_0x98a6('0x10')]=_0x50ed06[_0x98a6('0x11')];_0x5878d3[_0x98a6('0xc')][_0x98a6('0x12')]=_0x50ed06[_0x98a6('0x13')];_0x5878d3[_0x98a6('0xc')]['customfield_10102']=_0x50ed06['ip'];var _0x49f40c={'host':_0x98a6('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x98a6('0x15'),'Authorization':_0x98a6('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x98a6('0x17')](_0x98a6('0x18'))}};var _0x3228dd=JSON[_0x98a6('0x9')](_0x5878d3);var _0x2b1174=https[_0x98a6('0x19')](_0x49f40c,function(_0x169db8){_0x169db8['setEncoding'](_0x98a6('0x1a'));var _0x2f5cf4='';_0x169db8['on']('data',function(_0x47de5f){_0x2f5cf4+=_0x47de5f;});_0x169db8['on'](_0x98a6('0x1b'),function(){if(_0x451b8f){return _0x451b8f[_0x98a6('0x1c')](_0x169db8['statusCode'])[_0x98a6('0x1d')](JSON[_0x98a6('0x1e')](_0x2f5cf4));}});});_0x2b1174['on']('error',function(_0x238bd7){if(_0x451b8f){return _0x451b8f['status'](0x1f4)[_0x98a6('0x1d')]({'errors':[{'message':_0x98a6('0x1f'),'type':_0x98a6('0x20')}]});}});_0x2b1174[_0x98a6('0x21')](_0x3228dd);_0x2b1174[_0x98a6('0x1b')]();}exports[_0x98a6('0x22')]=openIssue;exports[_0x98a6('0x23')]=function(_0x16dfff,_0x3c45fd){_0x16dfff[_0x98a6('0x24')]['ip']=_0x16dfff[_0x98a6('0x25')][_0x98a6('0x26')]||_0x16dfff[_0x98a6('0x27')][_0x98a6('0x28')]||_0x16dfff[_0x98a6('0x29')][_0x98a6('0x28')]||_0x16dfff[_0x98a6('0x27')]['socket'][_0x98a6('0x28')];return openIssue(_0x16dfff[_0x98a6('0x24')],_0x3c45fd);}; \ No newline at end of file +var _0x7da0=['reason','track.xcallymotion.com','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','description','issuetype','Bug','email','fields','oldToken','newToken','name','customfield_11504'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x7da0,0xc1));var _0x07da=function(_0x5c9ecb,_0x4fadd6){_0x5c9ecb=_0x5c9ecb-0x0;var _0x2b250b=_0x7da0[_0x5c9ecb];return _0x2b250b;};'use strict';var BPromise=require(_0x07da('0x0'));var https=require(_0x07da('0x1'));var logger=require(_0x07da('0x2'))(_0x07da('0x3'));var USERNAME=_0x07da('0x4');var PASSWORD=_0x07da('0x5');function openIssue(_0x208f6d,_0x15f932){var _0x4e3fe3={'fields':{'project':{'key':_0x208f6d[_0x07da('0x6')]||_0x07da('0x7')},'summary':(_0x208f6d['summary']||'Report')+'\x20from\x20'+_0x208f6d['ip'],'description':_0x208f6d[_0x07da('0x8')]||JSON['stringify'](_0x208f6d),'issuetype':{'name':_0x208f6d[_0x07da('0x9')]||_0x07da('0xa')}}};_0x4e3fe3['fields']['customfield_11500']=_0x208f6d[_0x07da('0xb')];_0x4e3fe3[_0x07da('0xc')]['customfield_11501']=_0x208f6d[_0x07da('0xd')];_0x4e3fe3[_0x07da('0xc')]['customfield_11502']=_0x208f6d[_0x07da('0xe')];_0x4e3fe3[_0x07da('0xc')]['customfield_11503']=_0x208f6d[_0x07da('0xf')];_0x4e3fe3[_0x07da('0xc')][_0x07da('0x10')]=_0x208f6d[_0x07da('0x11')];_0x4e3fe3['fields']['customfield_10102']=_0x208f6d['ip'];var _0x432cbf={'host':_0x07da('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x07da('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x07da('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x07da('0x15')](_0x07da('0x16'))}};var _0x534245=JSON['stringify'](_0x4e3fe3);var _0x2973d0=https[_0x07da('0x17')](_0x432cbf,function(_0x377002){_0x377002[_0x07da('0x18')](_0x07da('0x19'));var _0x2bd01e='';_0x377002['on'](_0x07da('0x1a'),function(_0x5bb538){_0x2bd01e+=_0x5bb538;});_0x377002['on']('end',function(){if(_0x15f932){return _0x15f932[_0x07da('0x1b')](_0x377002[_0x07da('0x1c')])[_0x07da('0x1d')](JSON['parse'](_0x2bd01e));}});});_0x2973d0['on'](_0x07da('0x1e'),function(_0x240b38){if(_0x15f932){return _0x15f932['status'](0x1f4)[_0x07da('0x1d')]({'errors':[{'message':_0x07da('0x1f'),'type':_0x07da('0x20')}]});}});_0x2973d0[_0x07da('0x21')](_0x534245);_0x2973d0[_0x07da('0x22')]();}exports['openIssue']=openIssue;exports[_0x07da('0x23')]=function(_0x449e21,_0x40996a){_0x449e21[_0x07da('0x24')]['ip']=_0x449e21[_0x07da('0x25')][_0x07da('0x26')]||_0x449e21[_0x07da('0x27')][_0x07da('0x28')]||_0x449e21[_0x07da('0x29')][_0x07da('0x28')]||_0x449e21['connection'][_0x07da('0x29')]['remoteAddress'];return openIssue(_0x449e21['body'],_0x40996a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4f7b246..84ce3bf 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 _0x5ff3=['/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3ace04,_0x112d27){var _0x34c77b=function(_0x1d3d9d){while(--_0x1d3d9d){_0x3ace04['push'](_0x3ace04['shift']());}};_0x34c77b(++_0x112d27);}(_0x5ff3,0x17d));var _0x35ff=function(_0x36707b,_0x4cfd26){_0x36707b=_0x36707b-0x0;var _0x3e0767=_0x5ff3[_0x36707b];return _0x3e0767;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/describe',auth[_0x35ff('0x8')](),controller['describe']);router[_0x35ff('0x7')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xb')]('/',auth['isAuthenticated'](),controller[_0x35ff('0xc')]);router[_0x35ff('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module[_0x35ff('0x10')]=router; \ No newline at end of file +var _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x3e8742,_0x3ab1c){var _0x43dafd=function(_0x496919){while(--_0x496919){_0x3e8742['push'](_0x3e8742['shift']());}};_0x43dafd(++_0x3ab1c);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index dd87b65..2bce407 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x5de213,_0x505ef4){_0x5de213=_0x5de213-0x0;var _0x35ce1e=_0x7a54[_0x5de213];return _0x35ce1e;};'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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x77a4a3,_0x49a556){_0x77a4a3=_0x77a4a3-0x0;var _0x2dd4dd=_0x7a54[_0x77a4a3];return _0x2dd4dd;};'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 ec4d339..564bec1 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 _0x2d2c=['name','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0x2d2c[_0x1b0597];return _0x2b6a2a;};'use strict';var emlformat=require(_0xc2d2('0x0'));var rimraf=require(_0xc2d2('0x1'));var zipdir=require(_0xc2d2('0x2'));var jsonpatch=require(_0xc2d2('0x3'));var rp=require(_0xc2d2('0x4'));var moment=require(_0xc2d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d2('0x6'));var util=require('util');var path=require(_0xc2d2('0x7'));var sox=require(_0xc2d2('0x8'));var csv=require(_0xc2d2('0x9'));var ejs=require(_0xc2d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc2d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2d2('0xc'));var jsforce=require(_0xc2d2('0xd'));var deskjs=require(_0xc2d2('0xe'));var toCsv=require(_0xc2d2('0x9'));var querystring=require(_0xc2d2('0xf'));var Papa=require(_0xc2d2('0x10'));var Redis=require(_0xc2d2('0x11'));var authService=require(_0xc2d2('0x12'));var qs=require(_0xc2d2('0x13'));var as=require(_0xc2d2('0x14'));var hardwareService=require(_0xc2d2('0x15'));var logger=require(_0xc2d2('0x16'))('api');var utils=require(_0xc2d2('0x17'));var config=require(_0xc2d2('0x18'));var licenseUtil=require(_0xc2d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273269,_0x738877){_0x738877=_0x738877||0xcc;return function(_0x4c2b12){if(_0x4c2b12){return _0x273269[_0xc2d2('0x1a')](_0x738877);}return _0x273269[_0xc2d2('0x1b')](_0x738877)['end']();};}function respondWithResult(_0xa6f836,_0x4de52a){_0x4de52a=_0x4de52a||0xc8;return function(_0x5a1d24){if(_0x5a1d24){return _0xa6f836[_0xc2d2('0x1b')](_0x4de52a)[_0xc2d2('0x1c')](_0x5a1d24);}};}function respondWithFilteredResult(_0xf6bc66,_0x4006f3){return function(_0x2c42a6){if(_0x2c42a6){var _0x37552b=typeof _0x4006f3[_0xc2d2('0x1d')]===_0xc2d2('0x1e')&&typeof _0x4006f3[_0xc2d2('0x1f')]===_0xc2d2('0x1e');var _0x403d51=_0x2c42a6['count'];var _0x2d4ec4=_0x37552b?0x0:_0x4006f3[_0xc2d2('0x1d')];var _0x34f750=_0x37552b?_0x2c42a6[_0xc2d2('0x20')]:_0x4006f3['offset']+_0x4006f3[_0xc2d2('0x1f')];var _0x18cef7;if(_0x34f750>=_0x403d51){_0x34f750=_0x403d51;_0x18cef7=0xc8;}else{_0x18cef7=0xce;}_0xf6bc66['status'](_0x18cef7);return _0xf6bc66[_0xc2d2('0x21')](_0xc2d2('0x22'),_0x2d4ec4+'-'+_0x34f750+'/'+_0x403d51)[_0xc2d2('0x1c')](_0x2c42a6);}return null;};}function patchUpdates(_0xb14bc3){return function(_0x603323){try{jsonpatch['apply'](_0x603323,_0xb14bc3,!![]);}catch(_0x100d5b){return BPromise[_0xc2d2('0x23')](_0x100d5b);}return _0x603323['save']();};}function saveUpdates(_0x2cac91,_0x4e3cb5){return function(_0x5ecf78){if(_0x5ecf78){return _0x5ecf78['update'](_0x2cac91)[_0xc2d2('0x24')](function(_0x1bdcb5){return _0x1bdcb5;});}return null;};}function removeEntity(_0x7ffb28,_0x4b3449){return function(_0x2dbc46){if(_0x2dbc46){return _0x2dbc46[_0xc2d2('0x25')]()[_0xc2d2('0x24')](function(){_0x7ffb28[_0xc2d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b201,_0x25e6af){return function(_0xf2ba15){if(!_0xf2ba15){_0x25b201[_0xc2d2('0x1a')](0x194);}return _0xf2ba15;};}function handleError(_0x1a11d2,_0x1c14e5){_0x1c14e5=_0x1c14e5||0x1f4;return function(_0x49e955){logger[_0xc2d2('0x26')](_0x49e955[_0xc2d2('0x27')]);if(_0x49e955[_0xc2d2('0x28')]){delete _0x49e955[_0xc2d2('0x28')];}_0x1a11d2['status'](_0x1c14e5)['send'](_0x49e955);};}exports[_0xc2d2('0x29')]=function(_0x7b75f4,_0x1f3b66){var _0x21ca37={},_0x402337={},_0x460379={'count':0x0,'rows':[]};var _0x4d4af2=_[_0xc2d2('0x2a')](db[_0xc2d2('0x2b')]['rawAttributes'],function(_0x29cae5){return{'name':_0x29cae5[_0xc2d2('0x2c')],'type':_0x29cae5[_0xc2d2('0x2d')][_0xc2d2('0x2e')]};});_0x402337[_0xc2d2('0x2f')]=_['map'](_0x4d4af2,'name');_0x402337[_0xc2d2('0x30')]=_['keys'](_0x7b75f4[_0xc2d2('0x30')]);_0x402337[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],_0x402337[_0xc2d2('0x30')]);_0x21ca37['attributes']=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],qs[_0xc2d2('0x33')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x21ca37[_0xc2d2('0x34')]=_0x21ca37['attributes'][_0xc2d2('0x35')]?_0x21ca37[_0xc2d2('0x34')]:_0x402337['model'];if(!_0x7b75f4[_0xc2d2('0x30')]['hasOwnProperty'](_0xc2d2('0x36'))){_0x21ca37[_0xc2d2('0x1f')]=qs[_0xc2d2('0x1f')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x1f')]);_0x21ca37[_0xc2d2('0x1d')]=qs[_0xc2d2('0x1d')](_0x7b75f4[_0xc2d2('0x30')]['offset']);}_0x21ca37[_0xc2d2('0x37')]=qs[_0xc2d2('0x38')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x38')]);_0x21ca37['where']=qs[_0xc2d2('0x31')](_[_0xc2d2('0x39')](_0x7b75f4[_0xc2d2('0x30')],_0x402337[_0xc2d2('0x31')]),_0x4d4af2);if(_0x7b75f4['query'][_0xc2d2('0x3a')]){_0x21ca37['where']=_[_0xc2d2('0x3b')](_0x21ca37[_0xc2d2('0x3c')],{'$or':_['map'](_0x4d4af2,function(_0xdbdce0){if(_0xdbdce0[_0xc2d2('0x2d')]!==_0xc2d2('0x3d')){var _0x29d04b={};_0x29d04b[_0xdbdce0[_0xc2d2('0x28')]]={'$like':'%'+_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x3a')]+'%'};return _0x29d04b;}})});}_0x21ca37=_[_0xc2d2('0x3b')]({},_0x21ca37,_0x7b75f4[_0xc2d2('0x3e')]);var _0x49d900={'where':_0x21ca37['where']};return db[_0xc2d2('0x2b')][_0xc2d2('0x20')](_0x49d900)['then'](function(_0xfd3ad4){_0x460379[_0xc2d2('0x20')]=_0xfd3ad4;if(_0x7b75f4[_0xc2d2('0x30')]['includeAll']){_0x21ca37['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc2d2('0x3f')](_0x21ca37);})[_0xc2d2('0x24')](function(_0x4031d0){_0x460379[_0xc2d2('0x40')]=_0x4031d0;return _0x460379;})['then'](respondWithFilteredResult(_0x1f3b66,_0x21ca37))[_0xc2d2('0x41')](handleError(_0x1f3b66,null));};exports['show']=function(_0x582edb,_0x24544e){var _0x2a987a={'raw':!![],'where':{'id':_0x582edb['params']['id']}},_0x386a39={};_0x386a39[_0xc2d2('0x2f')]=_[_0xc2d2('0x42')](db[_0xc2d2('0x2b')]['rawAttributes']);_0x386a39[_0xc2d2('0x30')]=_['keys'](_0x582edb[_0xc2d2('0x30')]);_0x386a39[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x386a39[_0xc2d2('0x2f')],_0x386a39[_0xc2d2('0x30')]);_0x2a987a[_0xc2d2('0x34')]=_['intersection'](_0x386a39[_0xc2d2('0x2f')],qs['fields'](_0x582edb[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x2a987a[_0xc2d2('0x34')]=_0x2a987a[_0xc2d2('0x34')][_0xc2d2('0x35')]?_0x2a987a['attributes']:_0x386a39[_0xc2d2('0x2f')];if(_0x582edb[_0xc2d2('0x30')]['includeAll']){_0x2a987a['include']=[{'all':!![]}];}_0x2a987a=_['merge']({},_0x2a987a,_0x582edb['options']);return db[_0xc2d2('0x2b')][_0xc2d2('0x43')](_0x2a987a)[_0xc2d2('0x24')](handleEntityNotFound(_0x24544e,null))[_0xc2d2('0x24')](respondWithResult(_0x24544e,null))[_0xc2d2('0x41')](handleError(_0x24544e,null));};exports[_0xc2d2('0x44')]=function(_0x1146cb,_0x3b795a){return db[_0xc2d2('0x2b')][_0xc2d2('0x44')](_0x1146cb[_0xc2d2('0x45')],{})[_0xc2d2('0x24')](respondWithResult(_0x3b795a,0xc9))['catch'](handleError(_0x3b795a,null));};exports[_0xc2d2('0x46')]=function(_0x4181dc,_0x572764){if(_0x4181dc[_0xc2d2('0x45')]['id']){delete _0x4181dc['body']['id'];}return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x4181dc[_0xc2d2('0x47')]['id']}})[_0xc2d2('0x24')](handleEntityNotFound(_0x572764,null))['then'](saveUpdates(_0x4181dc[_0xc2d2('0x45')],null))[_0xc2d2('0x24')](respondWithResult(_0x572764,null))[_0xc2d2('0x41')](handleError(_0x572764,null));};exports[_0xc2d2('0x25')]=function(_0x3b61ef,_0x4765f9){return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x3b61ef[_0xc2d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4765f9,null))['then'](removeEntity(_0x4765f9,null))[_0xc2d2('0x41')](handleError(_0x4765f9,null));};exports[_0xc2d2('0x48')]=function(_0x472299,_0x1827c3){return db[_0xc2d2('0x2b')]['describe']()[_0xc2d2('0x24')](respondWithResult(_0x1827c3,null))[_0xc2d2('0x41')](handleError(_0x1827c3,null));}; \ No newline at end of file +var _0x0a52=['show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x28dcbc,_0x39cf07){var _0x533f58=function(_0x3bff58){while(--_0x3bff58){_0x28dcbc['push'](_0x28dcbc['shift']());}};_0x533f58(++_0x39cf07);}(_0x0a52,0xe4));var _0x20a5=function(_0x43f88d,_0x54d8ce){_0x43f88d=_0x43f88d-0x0;var _0x1aae21=_0x0a52[_0x43f88d];return _0x1aae21;};'use strict';var emlformat=require(_0x20a5('0x0'));var rimraf=require(_0x20a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20a5('0x2'));var rp=require(_0x20a5('0x3'));var moment=require(_0x20a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20a5('0x5'));var util=require(_0x20a5('0x6'));var path=require(_0x20a5('0x7'));var sox=require(_0x20a5('0x8'));var csv=require(_0x20a5('0x9'));var ejs=require(_0x20a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x20a5('0xb'));var crypto=require(_0x20a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x20a5('0xd'));var toCsv=require(_0x20a5('0x9'));var querystring=require(_0x20a5('0xe'));var Papa=require(_0x20a5('0xf'));var Redis=require('ioredis');var authService=require(_0x20a5('0x10'));var qs=require(_0x20a5('0x11'));var as=require(_0x20a5('0x12'));var hardwareService=require(_0x20a5('0x13'));var logger=require(_0x20a5('0x14'))(_0x20a5('0x15'));var utils=require(_0x20a5('0x16'));var config=require(_0x20a5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x20a5('0x18'))['db'];function respondWithStatusCode(_0x5e6c3b,_0xd07281){_0xd07281=_0xd07281||0xcc;return function(_0x429c69){if(_0x429c69){return _0x5e6c3b['sendStatus'](_0xd07281);}return _0x5e6c3b[_0x20a5('0x19')](_0xd07281)[_0x20a5('0x1a')]();};}function respondWithResult(_0x46acee,_0x43528b){_0x43528b=_0x43528b||0xc8;return function(_0x42bc38){if(_0x42bc38){return _0x46acee[_0x20a5('0x19')](_0x43528b)[_0x20a5('0x1b')](_0x42bc38);}};}function respondWithFilteredResult(_0x254546,_0x39b063){return function(_0x446a4f){if(_0x446a4f){var _0x24e1b0=typeof _0x39b063[_0x20a5('0x1c')]==='undefined'&&typeof _0x39b063[_0x20a5('0x1d')]==='undefined';var _0x312978=_0x446a4f[_0x20a5('0x1e')];var _0x11a4e3=_0x24e1b0?0x0:_0x39b063[_0x20a5('0x1c')];var _0x2cb0e8=_0x24e1b0?_0x446a4f[_0x20a5('0x1e')]:_0x39b063[_0x20a5('0x1c')]+_0x39b063['limit'];var _0x43cd40;if(_0x2cb0e8>=_0x312978){_0x2cb0e8=_0x312978;_0x43cd40=0xc8;}else{_0x43cd40=0xce;}_0x254546['status'](_0x43cd40);return _0x254546[_0x20a5('0x1f')](_0x20a5('0x20'),_0x11a4e3+'-'+_0x2cb0e8+'/'+_0x312978)[_0x20a5('0x1b')](_0x446a4f);}return null;};}function patchUpdates(_0x3bf093){return function(_0x40e28e){try{jsonpatch[_0x20a5('0x21')](_0x40e28e,_0x3bf093,!![]);}catch(_0xf577cd){return BPromise[_0x20a5('0x22')](_0xf577cd);}return _0x40e28e[_0x20a5('0x23')]();};}function saveUpdates(_0x1e43e4,_0x42c159){return function(_0x580d39){if(_0x580d39){return _0x580d39[_0x20a5('0x24')](_0x1e43e4)[_0x20a5('0x25')](function(_0x39ac06){return _0x39ac06;});}return null;};}function removeEntity(_0x4d4052,_0x370efa){return function(_0x1b2850){if(_0x1b2850){return _0x1b2850[_0x20a5('0x26')]()[_0x20a5('0x25')](function(){_0x4d4052['status'](0xcc)[_0x20a5('0x1a')]();});}};}function handleEntityNotFound(_0x3103bd,_0x16022f){return function(_0x21978f){if(!_0x21978f){_0x3103bd[_0x20a5('0x27')](0x194);}return _0x21978f;};}function handleError(_0x23239d,_0x171cd5){_0x171cd5=_0x171cd5||0x1f4;return function(_0x3987c5){logger['error'](_0x3987c5['stack']);if(_0x3987c5[_0x20a5('0x28')]){delete _0x3987c5[_0x20a5('0x28')];}_0x23239d['status'](_0x171cd5)[_0x20a5('0x29')](_0x3987c5);};}exports[_0x20a5('0x2a')]=function(_0x2b891c,_0x38bae9){var _0x5a84be={},_0x33f000={},_0x571e92={'count':0x0,'rows':[]};var _0x96280e=_[_0x20a5('0x2b')](db[_0x20a5('0x2c')][_0x20a5('0x2d')],function(_0xf23890){return{'name':_0xf23890[_0x20a5('0x2e')],'type':_0xf23890['type'][_0x20a5('0x2f')]};});_0x33f000[_0x20a5('0x30')]=_[_0x20a5('0x2b')](_0x96280e,_0x20a5('0x28'));_0x33f000['query']=_[_0x20a5('0x31')](_0x2b891c[_0x20a5('0x32')]);_0x33f000['filters']=_[_0x20a5('0x33')](_0x33f000[_0x20a5('0x30')],_0x33f000[_0x20a5('0x32')]);_0x5a84be[_0x20a5('0x34')]=_[_0x20a5('0x33')](_0x33f000[_0x20a5('0x30')],qs[_0x20a5('0x35')](_0x2b891c['query'][_0x20a5('0x35')]));_0x5a84be[_0x20a5('0x34')]=_0x5a84be[_0x20a5('0x34')][_0x20a5('0x36')]?_0x5a84be[_0x20a5('0x34')]:_0x33f000[_0x20a5('0x30')];if(!_0x2b891c[_0x20a5('0x32')]['hasOwnProperty'](_0x20a5('0x37'))){_0x5a84be[_0x20a5('0x1d')]=qs[_0x20a5('0x1d')](_0x2b891c[_0x20a5('0x32')]['limit']);_0x5a84be[_0x20a5('0x1c')]=qs[_0x20a5('0x1c')](_0x2b891c[_0x20a5('0x32')][_0x20a5('0x1c')]);}_0x5a84be['order']=qs[_0x20a5('0x38')](_0x2b891c['query'][_0x20a5('0x38')]);_0x5a84be['where']=qs[_0x20a5('0x39')](_[_0x20a5('0x3a')](_0x2b891c[_0x20a5('0x32')],_0x33f000[_0x20a5('0x39')]),_0x96280e);if(_0x2b891c[_0x20a5('0x32')]['filter']){_0x5a84be[_0x20a5('0x3b')]=_[_0x20a5('0x3c')](_0x5a84be[_0x20a5('0x3b')],{'$or':_[_0x20a5('0x2b')](_0x96280e,function(_0x2bdc15){if(_0x2bdc15[_0x20a5('0x3d')]!==_0x20a5('0x3e')){var _0x110550={};_0x110550[_0x2bdc15['name']]={'$like':'%'+_0x2b891c[_0x20a5('0x32')]['filter']+'%'};return _0x110550;}})});}_0x5a84be=_[_0x20a5('0x3c')]({},_0x5a84be,_0x2b891c[_0x20a5('0x3f')]);var _0x16c726={'where':_0x5a84be[_0x20a5('0x3b')]};return db['JscriptyAnswerReport'][_0x20a5('0x1e')](_0x16c726)[_0x20a5('0x25')](function(_0x26fdee){_0x571e92['count']=_0x26fdee;if(_0x2b891c['query'][_0x20a5('0x40')]){_0x5a84be[_0x20a5('0x41')]=[{'all':!![]}];}return db[_0x20a5('0x2c')][_0x20a5('0x42')](_0x5a84be);})[_0x20a5('0x25')](function(_0x96baad){_0x571e92[_0x20a5('0x43')]=_0x96baad;return _0x571e92;})[_0x20a5('0x25')](respondWithFilteredResult(_0x38bae9,_0x5a84be))['catch'](handleError(_0x38bae9,null));};exports[_0x20a5('0x44')]=function(_0xc8c498,_0x3c3b4a){var _0x9b618e={'raw':!![],'where':{'id':_0xc8c498[_0x20a5('0x45')]['id']}},_0x4d6a1e={};_0x4d6a1e[_0x20a5('0x30')]=_['keys'](db['JscriptyAnswerReport'][_0x20a5('0x2d')]);_0x4d6a1e['query']=_[_0x20a5('0x31')](_0xc8c498['query']);_0x4d6a1e[_0x20a5('0x39')]=_[_0x20a5('0x33')](_0x4d6a1e['model'],_0x4d6a1e[_0x20a5('0x32')]);_0x9b618e['attributes']=_[_0x20a5('0x33')](_0x4d6a1e[_0x20a5('0x30')],qs[_0x20a5('0x35')](_0xc8c498[_0x20a5('0x32')][_0x20a5('0x35')]));_0x9b618e['attributes']=_0x9b618e[_0x20a5('0x34')][_0x20a5('0x36')]?_0x9b618e['attributes']:_0x4d6a1e['model'];if(_0xc8c498[_0x20a5('0x32')][_0x20a5('0x40')]){_0x9b618e[_0x20a5('0x41')]=[{'all':!![]}];}_0x9b618e=_[_0x20a5('0x3c')]({},_0x9b618e,_0xc8c498[_0x20a5('0x3f')]);return db['JscriptyAnswerReport'][_0x20a5('0x46')](_0x9b618e)[_0x20a5('0x25')](handleEntityNotFound(_0x3c3b4a,null))[_0x20a5('0x25')](respondWithResult(_0x3c3b4a,null))[_0x20a5('0x47')](handleError(_0x3c3b4a,null));};exports[_0x20a5('0x48')]=function(_0x23c27f,_0x42aa14){return db[_0x20a5('0x2c')][_0x20a5('0x48')](_0x23c27f['body'],{})[_0x20a5('0x25')](respondWithResult(_0x42aa14,0xc9))[_0x20a5('0x47')](handleError(_0x42aa14,null));};exports[_0x20a5('0x24')]=function(_0x1e6981,_0x78729f){if(_0x1e6981['body']['id']){delete _0x1e6981[_0x20a5('0x49')]['id'];}return db[_0x20a5('0x2c')]['find']({'where':{'id':_0x1e6981[_0x20a5('0x45')]['id']}})[_0x20a5('0x25')](handleEntityNotFound(_0x78729f,null))[_0x20a5('0x25')](saveUpdates(_0x1e6981['body'],null))[_0x20a5('0x25')](respondWithResult(_0x78729f,null))[_0x20a5('0x47')](handleError(_0x78729f,null));};exports[_0x20a5('0x26')]=function(_0x45ef54,_0x58fa88){return db[_0x20a5('0x2c')][_0x20a5('0x46')]({'where':{'id':_0x45ef54[_0x20a5('0x45')]['id']}})[_0x20a5('0x25')](handleEntityNotFound(_0x58fa88,null))[_0x20a5('0x25')](removeEntity(_0x58fa88,null))[_0x20a5('0x47')](handleError(_0x58fa88,null));};exports['describe']=function(_0x4ad70d,_0x40ad8b){return db[_0x20a5('0x2c')]['describe']()[_0x20a5('0x25')](respondWithResult(_0x40ad8b,null))['catch'](handleError(_0x40ad8b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0a6217d..f493cf4 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 _0x49b9=['util','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash'];(function(_0x35ee37,_0x2fb2b1){var _0x2aff14=function(_0x4d46b5){while(--_0x4d46b5){_0x35ee37['push'](_0x35ee37['shift']());}};_0x2aff14(++_0x2fb2b1);}(_0x49b9,0xe3));var _0x949b=function(_0x46721a,_0x50cf18){_0x46721a=_0x46721a-0x0;var _0x480319=_0x49b9[_0x46721a];return _0x480319;};'use strict';var _=require(_0x949b('0x0'));var util=require(_0x949b('0x1'));var logger=require('../../config/logger')(_0x949b('0x2'));var moment=require(_0x949b('0x3'));var BPromise=require(_0x949b('0x4'));var rp=require(_0x949b('0x5'));var fs=require('fs');var path=require(_0x949b('0x6'));var rimraf=require(_0x949b('0x7'));var config=require('../../config/environment');var attributes=require(_0x949b('0x8'));module[_0x949b('0x9')]=function(_0x1268f4,_0x46a13d){return _0x1268f4[_0x949b('0xa')](_0x949b('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3311=['request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','util','../../config/logger','api'];(function(_0x48fcee,_0x431a8b){var _0x28d65a=function(_0x28b4ad){while(--_0x28b4ad){_0x48fcee['push'](_0x48fcee['shift']());}};_0x28d65a(++_0x431a8b);}(_0x3311,0x17d));var _0x1331=function(_0x4714b7,_0x545a82){_0x4714b7=_0x4714b7-0x0;var _0x20b1d2=_0x3311[_0x4714b7];return _0x20b1d2;};'use strict';var _=require('lodash');var util=require(_0x1331('0x0'));var logger=require(_0x1331('0x1'))(_0x1331('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1331('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1331('0x4'));var config=require(_0x1331('0x5'));var attributes=require(_0x1331('0x6'));module[_0x1331('0x7')]=function(_0x1beed7,_0x599349){return _0x1beed7['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','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 f77d8e9..85e21b2 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 _0x0ad3=['stringify','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x389c88,_0x46d30a){var _0x32b899=function(_0x2b70f2){while(--_0x2b70f2){_0x389c88['push'](_0x389c88['shift']());}};_0x32b899(++_0x46d30a);}(_0x0ad3,0x1be));var _0x30ad=function(_0x46529d,_0x21525f){_0x46529d=_0x46529d-0x0;var _0x5cba65=_0x0ad3[_0x46529d];return _0x5cba65;};'use strict';var _=require(_0x30ad('0x0'));var util=require(_0x30ad('0x1'));var moment=require(_0x30ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x30ad('0x3'));var fs=require('fs');var Redis=require(_0x30ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x30ad('0x5'));var logger=require(_0x30ad('0x6'))('rpc');var config=require(_0x30ad('0x7'));var jayson=require(_0x30ad('0x8'));var client=jayson[_0x30ad('0x9')][_0x30ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58d810,_0x3856f1,_0x46a5a6){return new BPromise(function(_0x21d856,_0x598f0c){return client[_0x30ad('0xb')](_0x58d810,_0x46a5a6)[_0x30ad('0xc')](function(_0x44bd65){logger['info'](_0x30ad('0xd'),_0x3856f1,_0x30ad('0xe'));logger[_0x30ad('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x3856f1,_0x30ad('0xe'),JSON[_0x30ad('0x10')](_0x44bd65));if(_0x44bd65['error']){if(_0x44bd65[_0x30ad('0x11')]['code']===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3856f1,_0x44bd65[_0x30ad('0x11')]['message']);return _0x598f0c(_0x44bd65['error'][_0x30ad('0x12')]);}logger['error'](_0x30ad('0xd'),_0x3856f1,_0x44bd65[_0x30ad('0x11')][_0x30ad('0x12')]);return _0x21d856(_0x44bd65['error']['message']);}else{logger[_0x30ad('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3856f1,'request\x20sent');_0x21d856(_0x44bd65['result']['message']);}})[_0x30ad('0x14')](function(_0x1b9254){logger[_0x30ad('0x11')](_0x30ad('0xd'),_0x3856f1,_0x1b9254);_0x598f0c(_0x1b9254);});});} \ No newline at end of file +var _0x2587=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','lodash','moment','randomstring'];(function(_0x3e9942,_0x12e0e6){var _0x2f7e3f=function(_0x512089){while(--_0x512089){_0x3e9942['push'](_0x3e9942['shift']());}};_0x2f7e3f(++_0x12e0e6);}(_0x2587,0x66));var _0x7258=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0x2587[_0x3fbb91];return _0x3eb213;};'use strict';var _=require(_0x7258('0x0'));var util=require('util');var moment=require(_0x7258('0x1'));var BPromise=require('bluebird');var rs=require(_0x7258('0x2'));var fs=require('fs');var Redis=require(_0x7258('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7258('0x4'));var logger=require(_0x7258('0x5'))(_0x7258('0x6'));var config=require(_0x7258('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7258('0x8')][_0x7258('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb490,_0x24a428,_0x4f9b16){return new BPromise(function(_0x3ace68,_0x4625ad){return client[_0x7258('0xa')](_0x2eb490,_0x4f9b16)[_0x7258('0xb')](function(_0x35bf49){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x24a428,'request\x20sent');logger[_0x7258('0xc')](_0x7258('0xd'),_0x24a428,_0x7258('0xe'),JSON[_0x7258('0xf')](_0x35bf49));if(_0x35bf49[_0x7258('0x10')]){if(_0x35bf49[_0x7258('0x10')][_0x7258('0x11')]===0x1f4){logger[_0x7258('0x10')](_0x7258('0x12'),_0x24a428,_0x35bf49[_0x7258('0x10')][_0x7258('0x13')]);return _0x4625ad(_0x35bf49['error'][_0x7258('0x13')]);}logger[_0x7258('0x10')](_0x7258('0x12'),_0x24a428,_0x35bf49['error'][_0x7258('0x13')]);return _0x3ace68(_0x35bf49[_0x7258('0x10')][_0x7258('0x13')]);}else{logger[_0x7258('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x24a428,_0x7258('0xe'));_0x3ace68(_0x35bf49['result'][_0x7258('0x13')]);}})['catch'](function(_0x1ce3ce){logger[_0x7258('0x10')](_0x7258('0x12'),_0x24a428,_0x1ce3ce);_0x4625ad(_0x1ce3ce);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 245e14c..34f1264 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 _0x41c0=['../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0x41c0,0xa8));var _0x041c=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x41c0[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0x041c('0x0'));var util=require(_0x041c('0x1'));var path=require(_0x041c('0x2'));var timeout=require(_0x041c('0x3'));var express=require(_0x041c('0x4'));var router=express['Router']();var fs_extra=require(_0x041c('0x5'));var auth=require(_0x041c('0x6'));var interaction=require(_0x041c('0x7'));var config=require('../../config/environment');var controller=require(_0x041c('0x8'));router[_0x041c('0x9')]('/',auth[_0x041c('0xa')](),controller[_0x041c('0xb')]);router[_0x041c('0x9')](_0x041c('0xc'),auth[_0x041c('0xa')](),controller[_0x041c('0xd')]);router['get'](_0x041c('0xe'),auth[_0x041c('0xa')](),controller[_0x041c('0xf')]);router[_0x041c('0x9')](_0x041c('0x10'),auth[_0x041c('0xa')](),controller[_0x041c('0x11')]);router[_0x041c('0x9')](_0x041c('0x12'),auth[_0x041c('0xa')](),timeout(_0x041c('0x13')),controller[_0x041c('0x14')]);router[_0x041c('0x15')]('/',auth[_0x041c('0xa')](),controller[_0x041c('0x16')]);router[_0x041c('0x15')](_0x041c('0x17'),auth['isAuthenticated'](),controller[_0x041c('0x18')]);router['put'](_0x041c('0xc'),auth[_0x041c('0xa')](),controller[_0x041c('0x19')]);router[_0x041c('0x1a')](_0x041c('0xc'),auth[_0x041c('0xa')](),controller[_0x041c('0x1b')]);module[_0x041c('0x1c')]=router; \ No newline at end of file +var _0xf8ba=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','show','/:id/sessions','getSessions','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','/:id','delete','destroy'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf8ba,0x9c));var _0xaf8b=function(_0x2cf02d,_0x26129b){_0x2cf02d=_0x2cf02d-0x0;var _0x3651f3=_0xf8ba[_0x2cf02d];return _0x3651f3;};'use strict';var multer=require(_0xaf8b('0x0'));var util=require(_0xaf8b('0x1'));var path=require(_0xaf8b('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf8b('0x3'));var router=express[_0xaf8b('0x4')]();var fs_extra=require(_0xaf8b('0x5'));var auth=require(_0xaf8b('0x6'));var interaction=require(_0xaf8b('0x7'));var config=require('../../config/environment');var controller=require(_0xaf8b('0x8'));router['get']('/',auth[_0xaf8b('0x9')](),controller[_0xaf8b('0xa')]);router[_0xaf8b('0xb')]('/:id',auth[_0xaf8b('0x9')](),controller[_0xaf8b('0xc')]);router[_0xaf8b('0xb')](_0xaf8b('0xd'),auth[_0xaf8b('0x9')](),controller[_0xaf8b('0xe')]);router['get']('/:id/answers',auth[_0xaf8b('0x9')](),controller[_0xaf8b('0xf')]);router[_0xaf8b('0xb')]('/:id/summary',auth[_0xaf8b('0x9')](),timeout(_0xaf8b('0x10')),controller[_0xaf8b('0x11')]);router[_0xaf8b('0x12')]('/',auth['isAuthenticated'](),controller[_0xaf8b('0x13')]);router[_0xaf8b('0x12')](_0xaf8b('0x14'),auth['isAuthenticated'](),controller[_0xaf8b('0x15')]);router[_0xaf8b('0x16')](_0xaf8b('0x17'),auth[_0xaf8b('0x9')](),controller['update']);router[_0xaf8b('0x18')]('/:id',auth[_0xaf8b('0x9')](),controller[_0xaf8b('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6a4455f..2e5c1ab 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 _0xc3ef=['BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x1e19cc,_0x3b8a34){var _0x49b40b=function(_0x409300){while(--_0x409300){_0x1e19cc['push'](_0x1e19cc['shift']());}};_0x49b40b(++_0x3b8a34);}(_0xc3ef,0x1a1));var _0xfc3e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc3ef[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xfc3e('0x0'));var _=require(_0xfc3e('0x1'));var util=require(_0xfc3e('0x2'));module[_0xfc3e('0x3')]={'name':{'type':Sequelize[_0xfc3e('0x4')],'unique':_0xfc3e('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xfc3e('0x6')),'set':function(_0x498831){if(_[_0xfc3e('0x7')](_0x498831)){this[_0xfc3e('0x8')](_0xfc3e('0x9'),JSON['stringify'](_0x498831));}else if(_[_0xfc3e('0xa')](_0x498831)){this[_0xfc3e('0x8')](_0xfc3e('0x9'),_0x498831);}else{this[_0xfc3e('0x8')](_0xfc3e('0x9'),util[_0xfc3e('0xb')](_0xfc3e('0xc'),this[_0xfc3e('0xd')](_0xfc3e('0x5'))||'',this[_0xfc3e('0xd')](_0xfc3e('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfc3e('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x6538=['setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike'];(function(_0x18063f,_0x3efbaf){var _0x116771=function(_0x366444){while(--_0x366444){_0x18063f['push'](_0x18063f['shift']());}};_0x116771(++_0x3efbaf);}(_0x6538,0x1c8));var _0x8653=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x6538[_0x1e4f2f];return _0xccea89;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8653('0x0'));var util=require(_0x8653('0x1'));module[_0x8653('0x2')]={'name':{'type':Sequelize[_0x8653('0x3')],'unique':_0x8653('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x8653('0x5')](_0x8653('0x6')),'set':function(_0x194e88){if(_[_0x8653('0x7')](_0x194e88)){this[_0x8653('0x8')](_0x8653('0x9'),JSON[_0x8653('0xa')](_0x194e88));}else if(_[_0x8653('0xb')](_0x194e88)){this['setDataValue'](_0x8653('0x9'),_0x194e88);}else{this['setDataValue'](_0x8653('0x9'),util['format'](_0x8653('0xc'),this[_0x8653('0xd')]('name')||'',this[_0x8653('0xd')](_0x8653('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8653('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8653('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index b8e39d0..8183617 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 _0x6200=['map','JscriptyProject','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','role','user','Projects','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','questionId','question','format','SessionId','answer','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index'];(function(_0xcd38d3,_0x3731b4){var _0x42d5b1=function(_0x480260){while(--_0x480260){_0xcd38d3['push'](_0xcd38d3['shift']());}};_0x42d5b1(++_0x3731b4);}(_0x6200,0x192));var _0x0620=function(_0x1c727d,_0x196fa9){_0x1c727d=_0x1c727d-0x0;var _0x39bf0e=_0x6200[_0x1c727d];return _0x39bf0e;};'use strict';var emlformat=require(_0x0620('0x0'));var rimraf=require(_0x0620('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0620('0x2'));var rp=require('request-promise');var moment=require(_0x0620('0x3'));var BPromise=require(_0x0620('0x4'));var Mustache=require(_0x0620('0x5'));var util=require(_0x0620('0x6'));var path=require(_0x0620('0x7'));var sox=require('sox');var csv=require(_0x0620('0x8'));var ejs=require(_0x0620('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0620('0xa'));var squel=require(_0x0620('0xb'));var crypto=require(_0x0620('0xc'));var jsforce=require(_0x0620('0xd'));var deskjs=require(_0x0620('0xe'));var toCsv=require(_0x0620('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0620('0xf'));var authService=require(_0x0620('0x10'));var qs=require(_0x0620('0x11'));var as=require(_0x0620('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0620('0x13'))('api');var utils=require(_0x0620('0x14'));var config=require(_0x0620('0x15'));var licenseUtil=require(_0x0620('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x558eab,_0x42659a){_0x42659a=_0x42659a||0xcc;return function(_0x1b6eac){if(_0x1b6eac){return _0x558eab[_0x0620('0x17')](_0x42659a);}return _0x558eab[_0x0620('0x18')](_0x42659a)[_0x0620('0x19')]();};}function respondWithResult(_0xd2af42,_0x3e5155){_0x3e5155=_0x3e5155||0xc8;return function(_0x18e5c0){if(_0x18e5c0){return _0xd2af42[_0x0620('0x18')](_0x3e5155)[_0x0620('0x1a')](_0x18e5c0);}};}function respondWithFilteredResult(_0x19a09a,_0xb0c4c7){return function(_0x4c0e68){if(_0x4c0e68){var _0x1a57a2=typeof _0xb0c4c7[_0x0620('0x1b')]===_0x0620('0x1c')&&typeof _0xb0c4c7['limit']===_0x0620('0x1c');var _0x500bb5=_0x4c0e68['count'];var _0x5b2d81=_0x1a57a2?0x0:_0xb0c4c7[_0x0620('0x1b')];var _0x39a419=_0x1a57a2?_0x4c0e68[_0x0620('0x1d')]:_0xb0c4c7[_0x0620('0x1b')]+_0xb0c4c7[_0x0620('0x1e')];var _0x1add9d;if(_0x39a419>=_0x500bb5){_0x39a419=_0x500bb5;_0x1add9d=0xc8;}else{_0x1add9d=0xce;}_0x19a09a[_0x0620('0x18')](_0x1add9d);return _0x19a09a['set']('Content-Range',_0x5b2d81+'-'+_0x39a419+'/'+_0x500bb5)[_0x0620('0x1a')](_0x4c0e68);}return null;};}function patchUpdates(_0x312b82){return function(_0x3f0a80){try{jsonpatch[_0x0620('0x1f')](_0x3f0a80,_0x312b82,!![]);}catch(_0x597887){return BPromise[_0x0620('0x20')](_0x597887);}return _0x3f0a80['save']();};}function saveUpdates(_0x5c2b1e,_0x5d4ef1){return function(_0x546172){if(_0x546172){return _0x546172[_0x0620('0x21')](_0x5c2b1e)[_0x0620('0x22')](function(_0xce050c){return _0xce050c;});}return null;};}function removeEntity(_0x54c8e4,_0x4965ae){return function(_0x4e59c6){if(_0x4e59c6){return _0x4e59c6[_0x0620('0x23')]()['then'](function(){var _0x4bbdc0=_0x4e59c6[_0x0620('0x24')]({'plain':!![]});var _0x397295='Projects';return db[_0x0620('0x25')][_0x0620('0x23')]({'where':{'type':_0x397295,'resourceId':_0x4bbdc0['id']}})[_0x0620('0x22')](function(){return _0x4e59c6;});})[_0x0620('0x22')](function(){_0x54c8e4[_0x0620('0x18')](0xcc)[_0x0620('0x19')]();});}};}function handleEntityNotFound(_0x4502e7,_0x554cee){return function(_0x2e7ea7){if(!_0x2e7ea7){_0x4502e7[_0x0620('0x17')](0x194);}return _0x2e7ea7;};}function handleError(_0x2ba47e,_0x59629e){_0x59629e=_0x59629e||0x1f4;return function(_0x9500ab){logger[_0x0620('0x26')](_0x9500ab[_0x0620('0x27')]);if(_0x9500ab[_0x0620('0x28')]){delete _0x9500ab[_0x0620('0x28')];}_0x2ba47e['status'](_0x59629e)['send'](_0x9500ab);};}exports[_0x0620('0x29')]=function(_0x8fa158,_0x40c5e5){var _0x57901b={},_0x1e4d0b={},_0x597df5={'count':0x0,'rows':[]};var _0x14c951=_[_0x0620('0x2a')](db[_0x0620('0x2b')][_0x0620('0x2c')],function(_0x471a45){return{'name':_0x471a45[_0x0620('0x2d')],'type':_0x471a45['type'][_0x0620('0x2e')]};});_0x1e4d0b['model']=_[_0x0620('0x2a')](_0x14c951,_0x0620('0x28'));_0x1e4d0b['query']=_[_0x0620('0x2f')](_0x8fa158[_0x0620('0x30')]);_0x1e4d0b[_0x0620('0x31')]=_[_0x0620('0x32')](_0x1e4d0b['model'],_0x1e4d0b[_0x0620('0x30')]);_0x57901b[_0x0620('0x33')]=_['intersection'](_0x1e4d0b[_0x0620('0x34')],qs[_0x0620('0x35')](_0x8fa158[_0x0620('0x30')][_0x0620('0x35')]));_0x57901b[_0x0620('0x33')]=_0x57901b[_0x0620('0x33')][_0x0620('0x36')]?_0x57901b[_0x0620('0x33')]:_0x1e4d0b[_0x0620('0x34')];if(!_0x8fa158['query'][_0x0620('0x37')](_0x0620('0x38'))){_0x57901b[_0x0620('0x1e')]=qs[_0x0620('0x1e')](_0x8fa158[_0x0620('0x30')][_0x0620('0x1e')]);_0x57901b[_0x0620('0x1b')]=qs[_0x0620('0x1b')](_0x8fa158[_0x0620('0x30')][_0x0620('0x1b')]);}_0x57901b[_0x0620('0x39')]=qs[_0x0620('0x3a')](_0x8fa158[_0x0620('0x30')][_0x0620('0x3a')]);_0x57901b[_0x0620('0x3b')]=qs[_0x0620('0x31')](_[_0x0620('0x3c')](_0x8fa158[_0x0620('0x30')],_0x1e4d0b[_0x0620('0x31')]),_0x14c951);if(_0x8fa158['query'][_0x0620('0x3d')]){_0x57901b[_0x0620('0x3b')]=_[_0x0620('0x3e')](_0x57901b[_0x0620('0x3b')],{'$or':_[_0x0620('0x2a')](_0x14c951,function(_0x12b36c){if(_0x12b36c[_0x0620('0x3f')]!==_0x0620('0x40')){var _0xdb46e1={};_0xdb46e1[_0x12b36c[_0x0620('0x28')]]={'$like':'%'+_0x8fa158[_0x0620('0x30')]['filter']+'%'};return _0xdb46e1;}})});}_0x57901b=_['merge']({},_0x57901b,_0x8fa158[_0x0620('0x41')]);var _0x60eb58={'where':_0x57901b[_0x0620('0x3b')]};return db[_0x0620('0x2b')][_0x0620('0x1d')](_0x60eb58)['then'](function(_0x2c8f37){_0x597df5[_0x0620('0x1d')]=_0x2c8f37;if(_0x8fa158[_0x0620('0x30')][_0x0620('0x42')]){_0x57901b[_0x0620('0x43')]=[{'all':!![]}];}return db[_0x0620('0x2b')][_0x0620('0x44')](_0x57901b);})[_0x0620('0x22')](function(_0xf9e30d){_0x597df5['rows']=_0xf9e30d;return _0x597df5;})[_0x0620('0x22')](respondWithFilteredResult(_0x40c5e5,_0x57901b))['catch'](handleError(_0x40c5e5,null));};exports[_0x0620('0x45')]=function(_0x2285b6,_0x27861f){var _0x3bd1a3={'raw':![],'where':{'id':_0x2285b6['params']['id']}},_0x573281={};_0x573281[_0x0620('0x34')]=_[_0x0620('0x2f')](db[_0x0620('0x2b')][_0x0620('0x2c')]);_0x573281[_0x0620('0x30')]=_[_0x0620('0x2f')](_0x2285b6[_0x0620('0x30')]);_0x573281[_0x0620('0x31')]=_['intersection'](_0x573281[_0x0620('0x34')],_0x573281[_0x0620('0x30')]);_0x3bd1a3['attributes']=_[_0x0620('0x32')](_0x573281[_0x0620('0x34')],qs[_0x0620('0x35')](_0x2285b6[_0x0620('0x30')][_0x0620('0x35')]));_0x3bd1a3['attributes']=_0x3bd1a3[_0x0620('0x33')][_0x0620('0x36')]?_0x3bd1a3[_0x0620('0x33')]:_0x573281[_0x0620('0x34')];if(_0x2285b6[_0x0620('0x30')][_0x0620('0x42')]){_0x3bd1a3[_0x0620('0x43')]=[{'all':!![]}];}_0x3bd1a3=_[_0x0620('0x3e')]({},_0x3bd1a3,_0x2285b6[_0x0620('0x41')]);return db[_0x0620('0x2b')][_0x0620('0x46')](_0x3bd1a3)[_0x0620('0x22')](handleEntityNotFound(_0x27861f,null))[_0x0620('0x22')](respondWithResult(_0x27861f,null))['catch'](handleError(_0x27861f,null));};exports['create']=function(_0x1e3407,_0x563aa5){return db['JscriptyProject'][_0x0620('0x47')](_0x1e3407[_0x0620('0x48')],{})[_0x0620('0x22')](function(_0x1f9e01){var _0x8d4535=_0x1e3407['user'][_0x0620('0x24')]({'plain':!![]});if(!_0x8d4535)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8d4535[_0x0620('0x49')]===_0x0620('0x4a')){var _0x4128a5=_0x1f9e01[_0x0620('0x24')]({'plain':!![]});var _0x4b278e=_0x0620('0x4b');return db[_0x0620('0x4c')][_0x0620('0x46')]({'where':{'name':_0x4b278e,'userProfileId':_0x8d4535[_0x0620('0x4d')]},'raw':!![]})[_0x0620('0x22')](function(_0x3e7562){if(_0x3e7562&&_0x3e7562['autoAssociation']===0x0){return db['UserProfileResource'][_0x0620('0x47')]({'name':_0x4128a5[_0x0620('0x28')],'resourceId':_0x4128a5['id'],'type':_0x3e7562['name'],'sectionId':_0x3e7562['id']},{})['then'](function(){return _0x1f9e01;});}else{return _0x1f9e01;}})['catch'](function(_0x21d59c){logger[_0x0620('0x26')](_0x0620('0x4e'),_0x21d59c);throw _0x21d59c;});}return _0x1f9e01;})[_0x0620('0x22')](respondWithResult(_0x563aa5,0xc9))[_0x0620('0x4f')](handleError(_0x563aa5,null));};exports[_0x0620('0x50')]=function(_0x2bfdec,_0x516b47){var _0x4ac25a={'where':{'id':_0x2bfdec[_0x0620('0x51')]['id']}},_0x36965f={};_0x36965f[_0x0620('0x34')]=_[_0x0620('0x2f')](db['JscriptyProject'][_0x0620('0x2c')]);_0x4ac25a[_0x0620('0x33')]=_['intersection'](_0x36965f[_0x0620('0x34')],qs[_0x0620('0x35')](_0x2bfdec['query'][_0x0620('0x35')]));_0x4ac25a[_0x0620('0x33')]=_0x4ac25a[_0x0620('0x33')]['length']?_0x4ac25a['attributes']:_0x36965f[_0x0620('0x34')];if(_0x2bfdec[_0x0620('0x30')][_0x0620('0x42')]){_0x4ac25a[_0x0620('0x43')]=[{'all':!![]}];}_0x4ac25a=_[_0x0620('0x3e')]({},_0x4ac25a,_0x2bfdec['options']);return db[_0x0620('0x2b')][_0x0620('0x46')](_0x4ac25a)[_0x0620('0x22')](handleEntityNotFound(_0x516b47,null))[_0x0620('0x22')](function(_0x333920){if(_0x333920){var _0x71f88=_0x333920['get']({'plain':!![]});_0x71f88=qs[_0x0620('0x52')](_0x71f88,['id','createdAt',_0x0620('0x53')]);_0x2bfdec[_0x0620('0x48')]=_[_0x0620('0x52')](_0x2bfdec[_0x0620('0x48')],['id',_0x0620('0x54'),_0x0620('0x53')]);return db[_0x0620('0x2b')]['create'](_[_0x0620('0x3e')](_0x71f88,_0x2bfdec[_0x0620('0x48')]),{'include':_0x2bfdec[_0x0620('0x30')][_0x0620('0x42')]?[{'all':!![]}]:undefined})[_0x0620('0x22')](function(_0x41fa17){var _0x673f3a=_0x2bfdec[_0x0620('0x4a')][_0x0620('0x24')]({'plain':!![]});if(!_0x673f3a)throw new Error(_0x0620('0x55'));if(_0x673f3a[_0x0620('0x49')]===_0x0620('0x4a')){var _0x360c55=_0x41fa17[_0x0620('0x24')]({'plain':!![]});var _0x12f06e=_0x0620('0x4b');return db[_0x0620('0x4c')]['find']({'where':{'name':_0x12f06e,'userProfileId':_0x673f3a['userProfileId']},'raw':!![]})[_0x0620('0x22')](function(_0x3fd1fa){if(_0x3fd1fa&&_0x3fd1fa['autoAssociation']===0x0){return db[_0x0620('0x25')][_0x0620('0x47')]({'name':_0x360c55['name'],'resourceId':_0x360c55['id'],'type':_0x3fd1fa[_0x0620('0x28')],'sectionId':_0x3fd1fa['id']},{})[_0x0620('0x22')](function(){return _0x41fa17;});}else{return _0x41fa17;}})[_0x0620('0x4f')](function(_0x236823){logger['error'](_0x0620('0x4e'),_0x236823);throw _0x236823;});}return _0x41fa17;});}})['then'](respondWithResult(_0x516b47,0xc9))[_0x0620('0x4f')](handleError(_0x516b47,null));};exports[_0x0620('0x21')]=function(_0x5e9c59,_0x14e7f0){if(_0x5e9c59[_0x0620('0x48')]['id']){delete _0x5e9c59['body']['id'];}return db[_0x0620('0x2b')][_0x0620('0x46')]({'where':{'id':_0x5e9c59[_0x0620('0x51')]['id']}})[_0x0620('0x22')](handleEntityNotFound(_0x14e7f0,null))[_0x0620('0x22')](saveUpdates(_0x5e9c59[_0x0620('0x48')],null))[_0x0620('0x22')](respondWithResult(_0x14e7f0,null))[_0x0620('0x4f')](handleError(_0x14e7f0,null));};exports[_0x0620('0x23')]=function(_0xf9b621,_0x424f11){return db[_0x0620('0x2b')][_0x0620('0x46')]({'where':{'id':_0xf9b621[_0x0620('0x51')]['id']}})[_0x0620('0x22')](handleEntityNotFound(_0x424f11,null))[_0x0620('0x22')](removeEntity(_0x424f11,null))['catch'](handleError(_0x424f11,null));};exports['getSessions']=function(_0x4a45a3,_0x1b3c37,_0x4d090c){var _0x4a0434={'raw':!![],'where':{}};var _0x55d8fc={};var _0x498d9b={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0620('0x56')]({'where':{'id':_0x4a45a3[_0x0620('0x51')]['id']}})[_0x0620('0x22')](handleEntityNotFound(_0x1b3c37,null))[_0x0620('0x22')](function(_0x5170f8){if(_0x5170f8){_0x55d8fc[_0x0620('0x34')]=_[_0x0620('0x2f')](db[_0x0620('0x57')][_0x0620('0x2c')]);_0x55d8fc[_0x0620('0x30')]=_[_0x0620('0x2f')](_0x4a45a3[_0x0620('0x30')]);_0x55d8fc[_0x0620('0x31')]=_['intersection'](_0x55d8fc[_0x0620('0x34')],_0x55d8fc[_0x0620('0x30')]);_0x4a0434[_0x0620('0x33')]=_[_0x0620('0x32')](_0x55d8fc[_0x0620('0x34')],qs[_0x0620('0x35')](_0x4a45a3[_0x0620('0x30')][_0x0620('0x35')]));_0x4a0434[_0x0620('0x33')]=_0x4a0434[_0x0620('0x33')][_0x0620('0x36')]?_0x4a0434[_0x0620('0x33')]:_0x55d8fc[_0x0620('0x34')];if(!_0x4a45a3['query'][_0x0620('0x37')](_0x0620('0x38'))){_0x4a0434['limit']=qs['limit'](_0x4a45a3[_0x0620('0x30')]['limit']);_0x4a0434[_0x0620('0x1b')]=qs[_0x0620('0x1b')](_0x4a45a3[_0x0620('0x30')][_0x0620('0x1b')]);}_0x4a0434[_0x0620('0x39')]=qs[_0x0620('0x3a')](_0x4a45a3['query'][_0x0620('0x3a')]);_0x4a0434['where']=qs[_0x0620('0x31')](_[_0x0620('0x3c')](_0x4a45a3[_0x0620('0x30')],_0x55d8fc[_0x0620('0x31')]));_0x4a0434['where'][_0x0620('0x58')]=_0x5170f8['id'];if(_0x4a45a3[_0x0620('0x30')]['filter']){_0x4a0434[_0x0620('0x3b')]=_['merge'](_0x4a0434[_0x0620('0x3b')],{'$or':_[_0x0620('0x2a')](_0x4a0434[_0x0620('0x33')],function(_0x5426d9){var _0x324df1={};_0x324df1[_0x5426d9]={'$like':'%'+_0x4a45a3[_0x0620('0x30')][_0x0620('0x3d')]+'%'};return _0x324df1;})});}_0x4a0434=_[_0x0620('0x3e')]({},_0x4a0434,_0x4a45a3[_0x0620('0x41')]);return db[_0x0620('0x57')][_0x0620('0x1d')]({'where':_0x4a0434[_0x0620('0x3b')]})[_0x0620('0x22')](function(_0x3ce90c){_0x498d9b[_0x0620('0x1d')]=_0x3ce90c;if(_0x4a45a3[_0x0620('0x30')][_0x0620('0x42')]){_0x4a0434[_0x0620('0x43')]=[{'all':!![]}];}return db[_0x0620('0x57')][_0x0620('0x44')](_0x4a0434);})['then'](function(_0x5f4c18){_0x498d9b[_0x0620('0x59')]=_0x5f4c18;return _0x498d9b;});}})[_0x0620('0x22')](respondWithFilteredResult(_0x1b3c37,_0x4a0434))[_0x0620('0x4f')](handleError(_0x1b3c37,null));};exports[_0x0620('0x5a')]=function(_0x32446f,_0x3e58d5,_0x1f3b57){var _0x19bae1={'raw':!![],'where':{}};var _0x2f3846={};var _0x5ae547={'count':0x0,'rows':[]};return db[_0x0620('0x2b')][_0x0620('0x56')]({'where':{'id':_0x32446f[_0x0620('0x51')]['id']}})['then'](handleEntityNotFound(_0x3e58d5,null))['then'](function(_0xbb62ab){if(_0xbb62ab){_0x2f3846['model']=_['keys'](db[_0x0620('0x5b')][_0x0620('0x2c')]);_0x2f3846[_0x0620('0x30')]=_[_0x0620('0x2f')](_0x32446f[_0x0620('0x30')]);_0x2f3846[_0x0620('0x31')]=_[_0x0620('0x32')](_0x2f3846[_0x0620('0x34')],_0x2f3846[_0x0620('0x30')]);_0x19bae1['attributes']=_[_0x0620('0x32')](_0x2f3846[_0x0620('0x34')],qs['fields'](_0x32446f['query'][_0x0620('0x35')]));_0x19bae1[_0x0620('0x33')]=_0x19bae1['attributes'][_0x0620('0x36')]?_0x19bae1['attributes']:_0x2f3846[_0x0620('0x34')];if(!_0x32446f[_0x0620('0x30')][_0x0620('0x37')](_0x0620('0x38'))){_0x19bae1['limit']=qs['limit'](_0x32446f[_0x0620('0x30')][_0x0620('0x1e')]);_0x19bae1['offset']=qs[_0x0620('0x1b')](_0x32446f['query'][_0x0620('0x1b')]);}_0x19bae1[_0x0620('0x39')]=qs[_0x0620('0x3a')](_0x32446f[_0x0620('0x30')]['sort']);_0x19bae1['where']=qs['filters'](_['pick'](_0x32446f[_0x0620('0x30')],_0x2f3846['filters']));_0x19bae1[_0x0620('0x3b')]['ProjectId']=_0xbb62ab['id'];if(_0x32446f[_0x0620('0x30')][_0x0620('0x3d')]){_0x19bae1['where']=_['merge'](_0x19bae1[_0x0620('0x3b')],{'$or':_[_0x0620('0x2a')](_0x19bae1[_0x0620('0x33')],function(_0x3d654e){var _0x456c77={};_0x456c77[_0x3d654e]={'$like':'%'+_0x32446f[_0x0620('0x30')][_0x0620('0x3d')]+'%'};return _0x456c77;})});}_0x19bae1=_[_0x0620('0x3e')]({},_0x19bae1,_0x32446f['options']);return db['JscriptyAnswerReport'][_0x0620('0x1d')]({'where':_0x19bae1[_0x0620('0x3b')]})[_0x0620('0x22')](function(_0x3c0fcf){_0x5ae547[_0x0620('0x1d')]=_0x3c0fcf;if(_0x32446f[_0x0620('0x30')][_0x0620('0x42')]){_0x19bae1[_0x0620('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x0620('0x44')](_0x19bae1);})[_0x0620('0x22')](function(_0x1dfe93){_0x5ae547['rows']=_0x1dfe93;return _0x5ae547;});}})[_0x0620('0x22')](respondWithFilteredResult(_0x3e58d5,_0x19bae1))[_0x0620('0x4f')](handleError(_0x3e58d5,null));};function char(_0x20bbd2){return'number'===typeof _0x20bbd2?String[_0x0620('0x5c')]['apply'](null,arguments):_0x20bbd2;}function needsEncapsulation(_0x11810c){return!!_0x11810c&&(_0x11810c[_0x0620('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x11810c[_0x0620('0x5d')]()['indexOf'](char(0xa))>=0x0||_0x11810c[_0x0620('0x5d')]()[_0x0620('0x5e')](char(0x2c))>=0x0||_0x11810c[_0x0620('0x5d')]()[_0x0620('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x37f556){var _0x572afd=char(0x22),_0x5d25bc='\x5c'+char(0x22),_0x3621a5=_0x37f556[_0x0620('0x5d')]()[_0x0620('0x5f')](new RegExp(_0x572afd,'g'),_0x5d25bc);return _0x572afd+_0x3621a5+_0x572afd;}exports[_0x0620('0x60')]=function(_0x3eeffe,_0x25ad3e,_0x1bd519){var _0x482cb9,_0x4192a0;var _0x2c22f9={'where':{'ProjectId':_0x3eeffe['params']['id']}};if(_0x3eeffe[_0x0620('0x30')][_0x0620('0x61')]){_0x2c22f9[_0x0620('0x3b')][_0x0620('0x62')]=JSON['parse'](_0x3eeffe[_0x0620('0x30')][_0x0620('0x61')]);}return db[_0x0620('0x57')][_0x0620('0x44')](_0x2c22f9)[_0x0620('0x22')](handleEntityNotFound(_0x25ad3e,null))[_0x0620('0x22')](function(_0x308073){if(_0x308073){_0x482cb9=_0x308073;return db['JscriptyQuestionReport'][_0x0620('0x44')]({'where':{'SessionId':{'$in':_[_0x0620('0x2a')](_0x482cb9,'id')},'ProjectId':_0x3eeffe[_0x0620('0x51')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x25ad3e,null))[_0x0620('0x22')](function(_0x5af593){if(_0x5af593){_0x4192a0=_0x5af593;var _0x4a35d7={};for(var _0x457391=0x0,_0x4eb2f5=_0x4192a0['length'];_0x457391<_0x4eb2f5;_0x457391++){if(!_0x4a35d7[_0x0620('0x37')](_0x4192a0[_0x457391][_0x0620('0x63')])){_0x4a35d7[_0x4192a0[_0x457391][_0x0620('0x63')]]=needsEncapsulation(_0x4192a0[_0x457391][_0x0620('0x64')])?encapsulate(_0x4192a0[_0x457391][_0x0620('0x64')]):_0x4192a0[_0x457391][_0x0620('0x64')];}}var _0x451083=[],_0x40346a={};for(var _0x29541c=0x0,_0xbfcb07=_0x482cb9[_0x0620('0x36')];_0x29541c<_0xbfcb07;_0x29541c++){_0x40346a={'ProjectId':_0x3eeffe[_0x0620('0x51')]['id'],'SessionId':_0x482cb9[_0x29541c]['id'],'StartTime':moment(_0x482cb9[_0x29541c][_0x0620('0x62')])[_0x0620('0x65')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x31aa65=0x0,_0x2cb16f=_0x4192a0[_0x0620('0x36')];_0x31aa65<_0x2cb16f;_0x31aa65++){if(_0x4192a0[_0x31aa65][_0x0620('0x66')]==_0x482cb9[_0x29541c]['id']&&_0x4a35d7['hasOwnProperty'](_0x4192a0[_0x31aa65][_0x0620('0x63')])){_0x40346a[_0x4a35d7[_0x4192a0[_0x31aa65][_0x0620('0x63')]]]=_0x4192a0[_0x31aa65][_0x0620('0x67')];}}for(var _0x14a23b in _0x4a35d7){if(!_0x40346a[_0x0620('0x37')](_0x4a35d7[_0x14a23b])){_0x40346a[_0x4a35d7[_0x14a23b]]=null;}}_0x451083['push'](_0x40346a);}return _0x451083;}})[_0x0620('0x22')](function(_0x26ec82){if(!_['isEmpty'](_0x26ec82)){var _0x52e741=toCsv(_0x26ec82);var _0x39e293=Date['now']();fs[_0x0620('0x68')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3eeffe[_0x0620('0x51')]['id'],_0x39e293),_0x52e741);_0x25ad3e[_0x0620('0x69')](_0x0620('0x6a'),_0x0620('0x6b')+util[_0x0620('0x65')](_0x0620('0x6c'),_0x3eeffe[_0x0620('0x51')]['id'],_0x39e293));_0x25ad3e['setHeader']('Content-type',_0x0620('0x6d'));return _0x25ad3e[_0x0620('0x6e')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3eeffe['params']['id'],_0x39e293));}else{return _0x25ad3e['sendStatus'](0xcc);}})['catch'](handleError(_0x25ad3e,null));}; \ No newline at end of file +var _0x8383=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','body','findOne','JscriptySessionReport','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','JscriptyProject','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find'];(function(_0x4ec863,_0x85080a){var _0x2071fc=function(_0x5a49a2){while(--_0x5a49a2){_0x4ec863['push'](_0x4ec863['shift']());}};_0x2071fc(++_0x85080a);}(_0x8383,0x98));var _0x3838=function(_0x5cad1d,_0x1ee946){_0x5cad1d=_0x5cad1d-0x0;var _0x239dbb=_0x8383[_0x5cad1d];return _0x239dbb;};'use strict';var emlformat=require(_0x3838('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3838('0x1'));var rp=require(_0x3838('0x2'));var moment=require(_0x3838('0x3'));var BPromise=require(_0x3838('0x4'));var Mustache=require(_0x3838('0x5'));var util=require(_0x3838('0x6'));var path=require(_0x3838('0x7'));var sox=require(_0x3838('0x8'));var csv=require(_0x3838('0x9'));var ejs=require(_0x3838('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3838('0xb'));var squel=require(_0x3838('0xc'));var crypto=require('crypto');var jsforce=require(_0x3838('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3838('0x9'));var querystring=require(_0x3838('0xe'));var Papa=require(_0x3838('0xf'));var Redis=require('ioredis');var authService=require(_0x3838('0x10'));var qs=require(_0x3838('0x11'));var as=require(_0x3838('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3838('0x13'))(_0x3838('0x14'));var utils=require(_0x3838('0x15'));var config=require(_0x3838('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3838('0x17'))['db'];function respondWithStatusCode(_0x276d98,_0x21f2c0){_0x21f2c0=_0x21f2c0||0xcc;return function(_0x56e009){if(_0x56e009){return _0x276d98[_0x3838('0x18')](_0x21f2c0);}return _0x276d98['status'](_0x21f2c0)[_0x3838('0x19')]();};}function respondWithResult(_0x2cfc06,_0x104adf){_0x104adf=_0x104adf||0xc8;return function(_0x17e0c4){if(_0x17e0c4){return _0x2cfc06[_0x3838('0x1a')](_0x104adf)['json'](_0x17e0c4);}};}function respondWithFilteredResult(_0x284ec1,_0xb4bf82){return function(_0x396b2d){if(_0x396b2d){var _0x2d81b2=typeof _0xb4bf82[_0x3838('0x1b')]==='undefined'&&typeof _0xb4bf82[_0x3838('0x1c')]===_0x3838('0x1d');var _0x29e617=_0x396b2d['count'];var _0x45aa66=_0x2d81b2?0x0:_0xb4bf82[_0x3838('0x1b')];var _0x4a9a7a=_0x2d81b2?_0x396b2d[_0x3838('0x1e')]:_0xb4bf82[_0x3838('0x1b')]+_0xb4bf82['limit'];var _0x313a90;if(_0x4a9a7a>=_0x29e617){_0x4a9a7a=_0x29e617;_0x313a90=0xc8;}else{_0x313a90=0xce;}_0x284ec1['status'](_0x313a90);return _0x284ec1[_0x3838('0x1f')](_0x3838('0x20'),_0x45aa66+'-'+_0x4a9a7a+'/'+_0x29e617)[_0x3838('0x21')](_0x396b2d);}return null;};}function patchUpdates(_0x2f9965){return function(_0x31a4b8){try{jsonpatch['apply'](_0x31a4b8,_0x2f9965,!![]);}catch(_0x5d7dd0){return BPromise[_0x3838('0x22')](_0x5d7dd0);}return _0x31a4b8['save']();};}function saveUpdates(_0x211fa7,_0x220fdd){return function(_0x200e51){if(_0x200e51){return _0x200e51[_0x3838('0x23')](_0x211fa7)[_0x3838('0x24')](function(_0x30e98f){return _0x30e98f;});}return null;};}function removeEntity(_0xbd0fd1,_0x1e8d61){return function(_0x525b21){if(_0x525b21){return _0x525b21[_0x3838('0x25')]()['then'](function(){var _0x3e554a=_0x525b21[_0x3838('0x26')]({'plain':!![]});var _0x55eaa5=_0x3838('0x27');return db[_0x3838('0x28')]['destroy']({'where':{'type':_0x55eaa5,'resourceId':_0x3e554a['id']}})[_0x3838('0x24')](function(){return _0x525b21;});})[_0x3838('0x24')](function(){_0xbd0fd1['status'](0xcc)[_0x3838('0x19')]();});}};}function handleEntityNotFound(_0x4c1efb,_0x2b2bd6){return function(_0x5c26b9){if(!_0x5c26b9){_0x4c1efb['sendStatus'](0x194);}return _0x5c26b9;};}function handleError(_0xef609c,_0x328e57){_0x328e57=_0x328e57||0x1f4;return function(_0x41bb45){logger[_0x3838('0x29')](_0x41bb45[_0x3838('0x2a')]);if(_0x41bb45['name']){delete _0x41bb45[_0x3838('0x2b')];}_0xef609c[_0x3838('0x1a')](_0x328e57)[_0x3838('0x2c')](_0x41bb45);};}exports['index']=function(_0x14950a,_0x5ee2d8){var _0x2549bd={},_0x4b1a0c={},_0x441a7f={'count':0x0,'rows':[]};var _0x2a725c=_['map'](db[_0x3838('0x2d')]['rawAttributes'],function(_0x580d0a){return{'name':_0x580d0a[_0x3838('0x2e')],'type':_0x580d0a[_0x3838('0x2f')]['key']};});_0x4b1a0c['model']=_[_0x3838('0x30')](_0x2a725c,'name');_0x4b1a0c[_0x3838('0x31')]=_[_0x3838('0x32')](_0x14950a[_0x3838('0x31')]);_0x4b1a0c[_0x3838('0x33')]=_[_0x3838('0x34')](_0x4b1a0c[_0x3838('0x35')],_0x4b1a0c['query']);_0x2549bd[_0x3838('0x36')]=_[_0x3838('0x34')](_0x4b1a0c[_0x3838('0x35')],qs[_0x3838('0x37')](_0x14950a[_0x3838('0x31')][_0x3838('0x37')]));_0x2549bd[_0x3838('0x36')]=_0x2549bd[_0x3838('0x36')][_0x3838('0x38')]?_0x2549bd[_0x3838('0x36')]:_0x4b1a0c[_0x3838('0x35')];if(!_0x14950a['query'][_0x3838('0x39')](_0x3838('0x3a'))){_0x2549bd[_0x3838('0x1c')]=qs[_0x3838('0x1c')](_0x14950a['query'][_0x3838('0x1c')]);_0x2549bd[_0x3838('0x1b')]=qs[_0x3838('0x1b')](_0x14950a[_0x3838('0x31')]['offset']);}_0x2549bd[_0x3838('0x3b')]=qs[_0x3838('0x3c')](_0x14950a[_0x3838('0x31')][_0x3838('0x3c')]);_0x2549bd['where']=qs[_0x3838('0x33')](_[_0x3838('0x3d')](_0x14950a[_0x3838('0x31')],_0x4b1a0c['filters']),_0x2a725c);if(_0x14950a['query'][_0x3838('0x3e')]){_0x2549bd[_0x3838('0x3f')]=_[_0x3838('0x40')](_0x2549bd[_0x3838('0x3f')],{'$or':_[_0x3838('0x30')](_0x2a725c,function(_0x45e0e8){if(_0x45e0e8[_0x3838('0x2f')]!==_0x3838('0x41')){var _0x2c7521={};_0x2c7521[_0x45e0e8['name']]={'$like':'%'+_0x14950a[_0x3838('0x31')][_0x3838('0x3e')]+'%'};return _0x2c7521;}})});}_0x2549bd=_[_0x3838('0x40')]({},_0x2549bd,_0x14950a[_0x3838('0x42')]);var _0x43a8d6={'where':_0x2549bd[_0x3838('0x3f')]};return db[_0x3838('0x2d')][_0x3838('0x1e')](_0x43a8d6)['then'](function(_0x2bbd18){_0x441a7f[_0x3838('0x1e')]=_0x2bbd18;if(_0x14950a['query'][_0x3838('0x43')]){_0x2549bd['include']=[{'all':!![]}];}return db[_0x3838('0x2d')][_0x3838('0x44')](_0x2549bd);})['then'](function(_0x55af4f){_0x441a7f['rows']=_0x55af4f;return _0x441a7f;})[_0x3838('0x24')](respondWithFilteredResult(_0x5ee2d8,_0x2549bd))[_0x3838('0x45')](handleError(_0x5ee2d8,null));};exports[_0x3838('0x46')]=function(_0xbc0a4b,_0x5824c9){var _0x3826da={'raw':![],'where':{'id':_0xbc0a4b[_0x3838('0x47')]['id']}},_0x308d62={};_0x308d62[_0x3838('0x35')]=_[_0x3838('0x32')](db[_0x3838('0x2d')][_0x3838('0x48')]);_0x308d62[_0x3838('0x31')]=_[_0x3838('0x32')](_0xbc0a4b[_0x3838('0x31')]);_0x308d62['filters']=_[_0x3838('0x34')](_0x308d62[_0x3838('0x35')],_0x308d62[_0x3838('0x31')]);_0x3826da[_0x3838('0x36')]=_[_0x3838('0x34')](_0x308d62[_0x3838('0x35')],qs[_0x3838('0x37')](_0xbc0a4b['query'][_0x3838('0x37')]));_0x3826da['attributes']=_0x3826da['attributes'][_0x3838('0x38')]?_0x3826da[_0x3838('0x36')]:_0x308d62[_0x3838('0x35')];if(_0xbc0a4b['query'][_0x3838('0x43')]){_0x3826da['include']=[{'all':!![]}];}_0x3826da=_[_0x3838('0x40')]({},_0x3826da,_0xbc0a4b[_0x3838('0x42')]);return db[_0x3838('0x2d')][_0x3838('0x49')](_0x3826da)[_0x3838('0x24')](handleEntityNotFound(_0x5824c9,null))[_0x3838('0x24')](respondWithResult(_0x5824c9,null))[_0x3838('0x45')](handleError(_0x5824c9,null));};exports[_0x3838('0x4a')]=function(_0x415af0,_0x18b817){return db['JscriptyProject']['create'](_0x415af0['body'],{})[_0x3838('0x24')](function(_0x256e32){var _0x83b1a2=_0x415af0[_0x3838('0x4b')][_0x3838('0x26')]({'plain':!![]});if(!_0x83b1a2)throw new Error(_0x3838('0x4c'));if(_0x83b1a2[_0x3838('0x4d')]===_0x3838('0x4b')){var _0x1992a6=_0x256e32[_0x3838('0x26')]({'plain':!![]});var _0x12f4cd=_0x3838('0x27');return db[_0x3838('0x4e')][_0x3838('0x49')]({'where':{'name':_0x12f4cd,'userProfileId':_0x83b1a2[_0x3838('0x4f')]},'raw':!![]})[_0x3838('0x24')](function(_0x39abe2){if(_0x39abe2&&_0x39abe2[_0x3838('0x50')]===0x0){return db['UserProfileResource'][_0x3838('0x4a')]({'name':_0x1992a6[_0x3838('0x2b')],'resourceId':_0x1992a6['id'],'type':_0x39abe2['name'],'sectionId':_0x39abe2['id']},{})[_0x3838('0x24')](function(){return _0x256e32;});}else{return _0x256e32;}})['catch'](function(_0x41c671){logger[_0x3838('0x29')](_0x3838('0x51'),_0x41c671);throw _0x41c671;});}return _0x256e32;})[_0x3838('0x24')](respondWithResult(_0x18b817,0xc9))[_0x3838('0x45')](handleError(_0x18b817,null));};exports[_0x3838('0x52')]=function(_0x442aa6,_0x223441){var _0x47a370={'where':{'id':_0x442aa6[_0x3838('0x47')]['id']}},_0x4b4cd4={};_0x4b4cd4[_0x3838('0x35')]=_['keys'](db[_0x3838('0x2d')][_0x3838('0x48')]);_0x47a370['attributes']=_[_0x3838('0x34')](_0x4b4cd4[_0x3838('0x35')],qs[_0x3838('0x37')](_0x442aa6[_0x3838('0x31')][_0x3838('0x37')]));_0x47a370[_0x3838('0x36')]=_0x47a370[_0x3838('0x36')]['length']?_0x47a370['attributes']:_0x4b4cd4['model'];if(_0x442aa6[_0x3838('0x31')][_0x3838('0x43')]){_0x47a370[_0x3838('0x53')]=[{'all':!![]}];}_0x47a370=_['merge']({},_0x47a370,_0x442aa6[_0x3838('0x42')]);return db[_0x3838('0x2d')][_0x3838('0x49')](_0x47a370)[_0x3838('0x24')](handleEntityNotFound(_0x223441,null))[_0x3838('0x24')](function(_0x350e94){if(_0x350e94){var _0x2e352e=_0x350e94[_0x3838('0x26')]({'plain':!![]});_0x2e352e=qs[_0x3838('0x54')](_0x2e352e,['id',_0x3838('0x55'),'updatedAt']);_0x442aa6[_0x3838('0x56')]=_[_0x3838('0x54')](_0x442aa6[_0x3838('0x56')],['id','createdAt','updatedAt']);return db[_0x3838('0x2d')][_0x3838('0x4a')](_[_0x3838('0x40')](_0x2e352e,_0x442aa6[_0x3838('0x56')]),{'include':_0x442aa6['query'][_0x3838('0x43')]?[{'all':!![]}]:undefined})[_0x3838('0x24')](function(_0x1631b4){var _0x124ef9=_0x442aa6[_0x3838('0x4b')]['get']({'plain':!![]});if(!_0x124ef9)throw new Error(_0x3838('0x4c'));if(_0x124ef9[_0x3838('0x4d')]===_0x3838('0x4b')){var _0x40d406=_0x1631b4['get']({'plain':!![]});var _0x2f8ff6=_0x3838('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x2f8ff6,'userProfileId':_0x124ef9[_0x3838('0x4f')]},'raw':!![]})[_0x3838('0x24')](function(_0xae078){if(_0xae078&&_0xae078['autoAssociation']===0x0){return db[_0x3838('0x28')][_0x3838('0x4a')]({'name':_0x40d406[_0x3838('0x2b')],'resourceId':_0x40d406['id'],'type':_0xae078[_0x3838('0x2b')],'sectionId':_0xae078['id']},{})[_0x3838('0x24')](function(){return _0x1631b4;});}else{return _0x1631b4;}})[_0x3838('0x45')](function(_0x4431ec){logger[_0x3838('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4431ec);throw _0x4431ec;});}return _0x1631b4;});}})['then'](respondWithResult(_0x223441,0xc9))[_0x3838('0x45')](handleError(_0x223441,null));};exports['update']=function(_0x17f09d,_0x1228c7){if(_0x17f09d[_0x3838('0x56')]['id']){delete _0x17f09d[_0x3838('0x56')]['id'];}return db[_0x3838('0x2d')][_0x3838('0x49')]({'where':{'id':_0x17f09d[_0x3838('0x47')]['id']}})['then'](handleEntityNotFound(_0x1228c7,null))[_0x3838('0x24')](saveUpdates(_0x17f09d[_0x3838('0x56')],null))[_0x3838('0x24')](respondWithResult(_0x1228c7,null))[_0x3838('0x45')](handleError(_0x1228c7,null));};exports[_0x3838('0x25')]=function(_0x565af1,_0x2edbc8){return db[_0x3838('0x2d')][_0x3838('0x49')]({'where':{'id':_0x565af1[_0x3838('0x47')]['id']}})['then'](handleEntityNotFound(_0x2edbc8,null))[_0x3838('0x24')](removeEntity(_0x2edbc8,null))[_0x3838('0x45')](handleError(_0x2edbc8,null));};exports['getSessions']=function(_0xe43827,_0x19f103,_0x5e30b9){var _0x1a8844={'raw':!![],'where':{}};var _0x58eccf={};var _0x43e6d0={'count':0x0,'rows':[]};return db[_0x3838('0x2d')][_0x3838('0x57')]({'where':{'id':_0xe43827[_0x3838('0x47')]['id']}})[_0x3838('0x24')](handleEntityNotFound(_0x19f103,null))[_0x3838('0x24')](function(_0x1f1ad5){if(_0x1f1ad5){_0x58eccf[_0x3838('0x35')]=_[_0x3838('0x32')](db[_0x3838('0x58')][_0x3838('0x48')]);_0x58eccf['query']=_[_0x3838('0x32')](_0xe43827[_0x3838('0x31')]);_0x58eccf[_0x3838('0x33')]=_[_0x3838('0x34')](_0x58eccf['model'],_0x58eccf['query']);_0x1a8844[_0x3838('0x36')]=_['intersection'](_0x58eccf[_0x3838('0x35')],qs[_0x3838('0x37')](_0xe43827[_0x3838('0x31')][_0x3838('0x37')]));_0x1a8844['attributes']=_0x1a8844[_0x3838('0x36')]['length']?_0x1a8844[_0x3838('0x36')]:_0x58eccf[_0x3838('0x35')];if(!_0xe43827[_0x3838('0x31')][_0x3838('0x39')](_0x3838('0x3a'))){_0x1a8844[_0x3838('0x1c')]=qs[_0x3838('0x1c')](_0xe43827['query']['limit']);_0x1a8844[_0x3838('0x1b')]=qs[_0x3838('0x1b')](_0xe43827['query'][_0x3838('0x1b')]);}_0x1a8844[_0x3838('0x3b')]=qs['sort'](_0xe43827[_0x3838('0x31')][_0x3838('0x3c')]);_0x1a8844[_0x3838('0x3f')]=qs[_0x3838('0x33')](_['pick'](_0xe43827[_0x3838('0x31')],_0x58eccf[_0x3838('0x33')]));_0x1a8844['where']['ProjectId']=_0x1f1ad5['id'];if(_0xe43827['query'][_0x3838('0x3e')]){_0x1a8844[_0x3838('0x3f')]=_['merge'](_0x1a8844[_0x3838('0x3f')],{'$or':_[_0x3838('0x30')](_0x1a8844[_0x3838('0x36')],function(_0x59e738){var _0x49491a={};_0x49491a[_0x59e738]={'$like':'%'+_0xe43827[_0x3838('0x31')][_0x3838('0x3e')]+'%'};return _0x49491a;})});}_0x1a8844=_[_0x3838('0x40')]({},_0x1a8844,_0xe43827[_0x3838('0x42')]);return db[_0x3838('0x58')]['count']({'where':_0x1a8844['where']})[_0x3838('0x24')](function(_0x5af995){_0x43e6d0[_0x3838('0x1e')]=_0x5af995;if(_0xe43827[_0x3838('0x31')][_0x3838('0x43')]){_0x1a8844[_0x3838('0x53')]=[{'all':!![]}];}return db[_0x3838('0x58')][_0x3838('0x44')](_0x1a8844);})[_0x3838('0x24')](function(_0x1363c1){_0x43e6d0['rows']=_0x1363c1;return _0x43e6d0;});}})['then'](respondWithFilteredResult(_0x19f103,_0x1a8844))[_0x3838('0x45')](handleError(_0x19f103,null));};exports['getAnswers']=function(_0x17d8e0,_0x1bf104,_0x2d814f){var _0x461f7d={'raw':!![],'where':{}};var _0x5ea8df={};var _0x29f7c5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x3838('0x57')]({'where':{'id':_0x17d8e0['params']['id']}})[_0x3838('0x24')](handleEntityNotFound(_0x1bf104,null))[_0x3838('0x24')](function(_0x26a6fa){if(_0x26a6fa){_0x5ea8df[_0x3838('0x35')]=_[_0x3838('0x32')](db[_0x3838('0x59')][_0x3838('0x48')]);_0x5ea8df[_0x3838('0x31')]=_[_0x3838('0x32')](_0x17d8e0[_0x3838('0x31')]);_0x5ea8df[_0x3838('0x33')]=_['intersection'](_0x5ea8df[_0x3838('0x35')],_0x5ea8df[_0x3838('0x31')]);_0x461f7d[_0x3838('0x36')]=_[_0x3838('0x34')](_0x5ea8df[_0x3838('0x35')],qs[_0x3838('0x37')](_0x17d8e0[_0x3838('0x31')][_0x3838('0x37')]));_0x461f7d['attributes']=_0x461f7d['attributes'][_0x3838('0x38')]?_0x461f7d[_0x3838('0x36')]:_0x5ea8df[_0x3838('0x35')];if(!_0x17d8e0[_0x3838('0x31')][_0x3838('0x39')]('nolimit')){_0x461f7d[_0x3838('0x1c')]=qs[_0x3838('0x1c')](_0x17d8e0['query'][_0x3838('0x1c')]);_0x461f7d[_0x3838('0x1b')]=qs['offset'](_0x17d8e0[_0x3838('0x31')]['offset']);}_0x461f7d[_0x3838('0x3b')]=qs[_0x3838('0x3c')](_0x17d8e0[_0x3838('0x31')][_0x3838('0x3c')]);_0x461f7d[_0x3838('0x3f')]=qs[_0x3838('0x33')](_[_0x3838('0x3d')](_0x17d8e0[_0x3838('0x31')],_0x5ea8df[_0x3838('0x33')]));_0x461f7d[_0x3838('0x3f')]['ProjectId']=_0x26a6fa['id'];if(_0x17d8e0[_0x3838('0x31')][_0x3838('0x3e')]){_0x461f7d[_0x3838('0x3f')]=_[_0x3838('0x40')](_0x461f7d[_0x3838('0x3f')],{'$or':_[_0x3838('0x30')](_0x461f7d[_0x3838('0x36')],function(_0x54f3d8){var _0x217d21={};_0x217d21[_0x54f3d8]={'$like':'%'+_0x17d8e0['query'][_0x3838('0x3e')]+'%'};return _0x217d21;})});}_0x461f7d=_[_0x3838('0x40')]({},_0x461f7d,_0x17d8e0['options']);return db[_0x3838('0x59')][_0x3838('0x1e')]({'where':_0x461f7d[_0x3838('0x3f')]})[_0x3838('0x24')](function(_0x512b8f){_0x29f7c5[_0x3838('0x1e')]=_0x512b8f;if(_0x17d8e0['query'][_0x3838('0x43')]){_0x461f7d[_0x3838('0x53')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3838('0x44')](_0x461f7d);})[_0x3838('0x24')](function(_0x54d573){_0x29f7c5['rows']=_0x54d573;return _0x29f7c5;});}})['then'](respondWithFilteredResult(_0x1bf104,_0x461f7d))['catch'](handleError(_0x1bf104,null));};function char(_0x19a275){return _0x3838('0x5a')===typeof _0x19a275?String[_0x3838('0x5b')]['apply'](null,arguments):_0x19a275;}function needsEncapsulation(_0x4716f5){return!!_0x4716f5&&(_0x4716f5[_0x3838('0x5c')]()[_0x3838('0x5d')](char(0xd))>=0x0||_0x4716f5[_0x3838('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x4716f5[_0x3838('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x4716f5[_0x3838('0x5c')]()[_0x3838('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x510e9b){var _0x2f7989=char(0x22),_0x3a9f9e='\x5c'+char(0x22),_0x287a10=_0x510e9b[_0x3838('0x5c')]()['replace'](new RegExp(_0x2f7989,'g'),_0x3a9f9e);return _0x2f7989+_0x287a10+_0x2f7989;}exports[_0x3838('0x5e')]=function(_0x625040,_0x474d90,_0x4a42be){var _0x2ae48f,_0x56bd07;var _0x406011={'where':{'ProjectId':_0x625040['params']['id']}};if(_0x625040[_0x3838('0x31')]['startTime']){_0x406011[_0x3838('0x3f')][_0x3838('0x5f')]=JSON[_0x3838('0x60')](_0x625040[_0x3838('0x31')]['startTime']);}return db[_0x3838('0x58')][_0x3838('0x44')](_0x406011)[_0x3838('0x24')](handleEntityNotFound(_0x474d90,null))[_0x3838('0x24')](function(_0x2bd982){if(_0x2bd982){_0x2ae48f=_0x2bd982;return db['JscriptyQuestionReport'][_0x3838('0x44')]({'where':{'SessionId':{'$in':_['map'](_0x2ae48f,'id')},'ProjectId':_0x625040['params']['id']},'order':_0x3838('0x61')});}})[_0x3838('0x24')](handleEntityNotFound(_0x474d90,null))['then'](function(_0x4fe4f4){if(_0x4fe4f4){_0x56bd07=_0x4fe4f4;var _0x4793e0={};for(var _0x493300=0x0,_0x3121cc=_0x56bd07[_0x3838('0x38')];_0x493300<_0x3121cc;_0x493300++){if(!_0x4793e0[_0x3838('0x39')](_0x56bd07[_0x493300]['questionId'])){_0x4793e0[_0x56bd07[_0x493300][_0x3838('0x62')]]=needsEncapsulation(_0x56bd07[_0x493300]['question'])?encapsulate(_0x56bd07[_0x493300][_0x3838('0x63')]):_0x56bd07[_0x493300][_0x3838('0x63')];}}var _0x7ab4fc=[],_0x5a3c54={};for(var _0x39a230=0x0,_0x1dc281=_0x2ae48f['length'];_0x39a230<_0x1dc281;_0x39a230++){_0x5a3c54={'ProjectId':_0x625040['params']['id'],'SessionId':_0x2ae48f[_0x39a230]['id'],'StartTime':moment(_0x2ae48f[_0x39a230][_0x3838('0x5f')])[_0x3838('0x64')](_0x3838('0x65'))};for(var _0xb55309=0x0,_0xafd77e=_0x56bd07[_0x3838('0x38')];_0xb55309<_0xafd77e;_0xb55309++){if(_0x56bd07[_0xb55309]['SessionId']==_0x2ae48f[_0x39a230]['id']&&_0x4793e0[_0x3838('0x39')](_0x56bd07[_0xb55309][_0x3838('0x62')])){_0x5a3c54[_0x4793e0[_0x56bd07[_0xb55309][_0x3838('0x62')]]]=_0x56bd07[_0xb55309]['answer'];}}for(var _0x554293 in _0x4793e0){if(!_0x5a3c54[_0x3838('0x39')](_0x4793e0[_0x554293])){_0x5a3c54[_0x4793e0[_0x554293]]=null;}}_0x7ab4fc[_0x3838('0x66')](_0x5a3c54);}return _0x7ab4fc;}})['then'](function(_0x137172){if(!_[_0x3838('0x67')](_0x137172)){var _0x3cff72=toCsv(_0x137172);var _0x5372ad=Date['now']();fs[_0x3838('0x68')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x625040[_0x3838('0x47')]['id'],_0x5372ad),_0x3cff72);_0x474d90[_0x3838('0x69')](_0x3838('0x6a'),_0x3838('0x6b')+util[_0x3838('0x64')](_0x3838('0x6c'),_0x625040[_0x3838('0x47')]['id'],_0x5372ad));_0x474d90['setHeader'](_0x3838('0x6d'),_0x3838('0x6e'));return _0x474d90[_0x3838('0x6f')](util[_0x3838('0x64')](_0x3838('0x70'),_0x625040[_0x3838('0x47')]['id'],_0x5372ad));}else{return _0x474d90[_0x3838('0x18')](0xcc);}})[_0x3838('0x45')](handleError(_0x474d90,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 6b9e78a..096f61b 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 _0xe009=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x446f11,_0x95cf21){var _0x385cb5=function(_0x426715){while(--_0x426715){_0x446f11['push'](_0x446f11['shift']());}};_0x385cb5(++_0x95cf21);}(_0xe009,0x122));var _0x9e00=function(_0x467aa9,_0x1120cb){_0x467aa9=_0x467aa9-0x0;var _0x42aa6f=_0xe009[_0x467aa9];return _0x42aa6f;};'use strict';var _=require(_0x9e00('0x0'));var util=require(_0x9e00('0x1'));var logger=require(_0x9e00('0x2'))(_0x9e00('0x3'));var moment=require('moment');var BPromise=require(_0x9e00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e00('0x5'));var rimraf=require(_0x9e00('0x6'));var config=require(_0x9e00('0x7'));var attributes=require(_0x9e00('0x8'));module[_0x9e00('0x9')]=function(_0x467e35,_0x32b4ee){return _0x467e35[_0x9e00('0xa')](_0x9e00('0xb'),attributes,{'tableName':_0x9e00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17c4=['rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x38de33,_0x4361bb){var _0x40f16d=function(_0x25975c){while(--_0x25975c){_0x38de33['push'](_0x38de33['shift']());}};_0x40f16d(++_0x4361bb);}(_0x17c4,0x102));var _0x417c=function(_0x106895,_0xf6b6be){_0x106895=_0x106895-0x0;var _0x3ee675=_0x17c4[_0x106895];return _0x3ee675;};'use strict';var _=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var logger=require(_0x417c('0x2'))(_0x417c('0x3'));var moment=require(_0x417c('0x4'));var BPromise=require(_0x417c('0x5'));var rp=require(_0x417c('0x6'));var fs=require('fs');var path=require(_0x417c('0x7'));var rimraf=require(_0x417c('0x8'));var config=require(_0x417c('0x9'));var attributes=require(_0x417c('0xa'));module['exports']=function(_0x24e681,_0x117c5d){return _0x24e681[_0x417c('0xb')](_0x417c('0xc'),attributes,{'tableName':_0x417c('0xd'),'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 05d27ec..9a6868e 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 _0xbdb7=['request\x20sent','debug','JscriptyProject,\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','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x12fe86,_0x57ec8d){_0x12fe86=_0x12fe86-0x0;var _0x3c528b=_0xbdb7[_0x12fe86];return _0x3c528b;};'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 _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(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 8ba5ed0..cf74a64 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 _0x903a=['describe','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated'];(function(_0x5d0b9f,_0x4856d1){var _0x55ba86=function(_0x2dae1a){while(--_0x2dae1a){_0x5d0b9f['push'](_0x5d0b9f['shift']());}};_0x55ba86(++_0x4856d1);}(_0x903a,0x1aa));var _0xa903=function(_0x9fe264,_0x341cae){_0x9fe264=_0x9fe264-0x0;var _0x2cc159=_0x903a[_0x9fe264];return _0x2cc159;};'use strict';var multer=require('multer');var util=require(_0xa903('0x0'));var path=require(_0xa903('0x1'));var timeout=require(_0xa903('0x2'));var express=require('express');var router=express[_0xa903('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa903('0x4'));var interaction=require(_0xa903('0x5'));var config=require('../../config/environment');var controller=require(_0xa903('0x6'));router[_0xa903('0x7')]('/',auth['isAuthenticated'](),controller[_0xa903('0x8')]);router['get'](_0xa903('0x9'),auth[_0xa903('0xa')](),controller[_0xa903('0xb')]);router[_0xa903('0x7')]('/:id',auth[_0xa903('0xa')](),controller['show']);router[_0xa903('0xc')]('/',auth['isAuthenticated'](),controller[_0xa903('0xd')]);router[_0xa903('0xe')](_0xa903('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xa903('0x10')]('/:id',auth[_0xa903('0xa')](),controller[_0xa903('0x11')]);module[_0xa903('0x12')]=router; \ No newline at end of file +var _0x3f49=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x60369b,_0x525315){var _0x3c9e8e=function(_0x3e7f91){while(--_0x3e7f91){_0x60369b['push'](_0x60369b['shift']());}};_0x3c9e8e(++_0x525315);}(_0x3f49,0x13d));var _0x93f4=function(_0x268e53,_0x1c0958){_0x268e53=_0x268e53-0x0;var _0xea5a5b=_0x3f49[_0x268e53];return _0xea5a5b;};'use strict';var multer=require(_0x93f4('0x0'));var util=require('util');var path=require(_0x93f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x93f4('0x2'));var router=express[_0x93f4('0x3')]();var fs_extra=require(_0x93f4('0x4'));var auth=require(_0x93f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x93f4('0x6'));var controller=require(_0x93f4('0x7'));router[_0x93f4('0x8')]('/',auth[_0x93f4('0x9')](),controller['index']);router['get']('/describe',auth[_0x93f4('0x9')](),controller[_0x93f4('0xa')]);router[_0x93f4('0x8')](_0x93f4('0xb'),auth['isAuthenticated'](),controller[_0x93f4('0xc')]);router['post']('/',auth[_0x93f4('0x9')](),controller[_0x93f4('0xd')]);router[_0x93f4('0xe')](_0x93f4('0xb'),auth[_0x93f4('0x9')](),controller[_0x93f4('0xf')]);router[_0x93f4('0x10')](_0x93f4('0xb'),auth[_0x93f4('0x9')](),controller[_0x93f4('0x11')]);module[_0x93f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9bedead..3635a26 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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x125cb3,_0x36bcca){_0x125cb3=_0x125cb3-0x0;var _0x16b97a=_0x7a54[_0x125cb3];return _0x16b97a;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x2501f9,_0x51c6a6){_0x2501f9=_0x2501f9-0x0;var _0x5dec58=_0x7a54[_0x2501f9];return _0x5dec58;};'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 a2ae3d6..1927eb4 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 _0xa5c5=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','rows','catch','show','params','rawAttributes','includeAll','include','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','offset','limit','count','set','apply','save','update','then','destroy','end','name','send','JscriptyQuestionReport','fieldName','key','model','query','keys','filters'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa5c5,0xe9));var _0x5a5c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa5c5[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x5a5c('0x0'));var rimraf=require(_0x5a5c('0x1'));var zipdir=require(_0x5a5c('0x2'));var jsonpatch=require(_0x5a5c('0x3'));var rp=require(_0x5a5c('0x4'));var moment=require(_0x5a5c('0x5'));var BPromise=require(_0x5a5c('0x6'));var Mustache=require('mustache');var util=require(_0x5a5c('0x7'));var path=require('path');var sox=require(_0x5a5c('0x8'));var csv=require(_0x5a5c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a5c('0xa'));var _=require(_0x5a5c('0xb'));var squel=require('squel');var crypto=require(_0x5a5c('0xc'));var jsforce=require(_0x5a5c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5a5c('0xe'));var Papa=require(_0x5a5c('0xf'));var Redis=require(_0x5a5c('0x10'));var authService=require(_0x5a5c('0x11'));var qs=require(_0x5a5c('0x12'));var as=require(_0x5a5c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a5c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5a5c('0x15'));var db=require(_0x5a5c('0x16'))['db'];function respondWithStatusCode(_0x20fb46,_0x110d36){_0x110d36=_0x110d36||0xcc;return function(_0x4e90dc){if(_0x4e90dc){return _0x20fb46['sendStatus'](_0x110d36);}return _0x20fb46['status'](_0x110d36)['end']();};}function respondWithResult(_0x2409c7,_0x4580f1){_0x4580f1=_0x4580f1||0xc8;return function(_0x351072){if(_0x351072){return _0x2409c7[_0x5a5c('0x17')](_0x4580f1)['json'](_0x351072);}};}function respondWithFilteredResult(_0x498d3c,_0x6792a4){return function(_0x255bb1){if(_0x255bb1){var _0x21fd49=typeof _0x6792a4[_0x5a5c('0x18')]==='undefined'&&typeof _0x6792a4[_0x5a5c('0x19')]==='undefined';var _0x576ff6=_0x255bb1[_0x5a5c('0x1a')];var _0x141c76=_0x21fd49?0x0:_0x6792a4[_0x5a5c('0x18')];var _0x2a0e81=_0x21fd49?_0x255bb1[_0x5a5c('0x1a')]:_0x6792a4['offset']+_0x6792a4[_0x5a5c('0x19')];var _0xdbfd01;if(_0x2a0e81>=_0x576ff6){_0x2a0e81=_0x576ff6;_0xdbfd01=0xc8;}else{_0xdbfd01=0xce;}_0x498d3c[_0x5a5c('0x17')](_0xdbfd01);return _0x498d3c[_0x5a5c('0x1b')]('Content-Range',_0x141c76+'-'+_0x2a0e81+'/'+_0x576ff6)['json'](_0x255bb1);}return null;};}function patchUpdates(_0x186dc2){return function(_0x408d03){try{jsonpatch[_0x5a5c('0x1c')](_0x408d03,_0x186dc2,!![]);}catch(_0x1b1da0){return BPromise['reject'](_0x1b1da0);}return _0x408d03[_0x5a5c('0x1d')]();};}function saveUpdates(_0x221849,_0x1e7493){return function(_0xc298a6){if(_0xc298a6){return _0xc298a6[_0x5a5c('0x1e')](_0x221849)[_0x5a5c('0x1f')](function(_0x56c2c4){return _0x56c2c4;});}return null;};}function removeEntity(_0x550b1b,_0x1e6a30){return function(_0x26aff7){if(_0x26aff7){return _0x26aff7[_0x5a5c('0x20')]()[_0x5a5c('0x1f')](function(){_0x550b1b[_0x5a5c('0x17')](0xcc)[_0x5a5c('0x21')]();});}};}function handleEntityNotFound(_0x59069f,_0x267a96){return function(_0x4ae1df){if(!_0x4ae1df){_0x59069f['sendStatus'](0x194);}return _0x4ae1df;};}function handleError(_0xa7cd95,_0x143f73){_0x143f73=_0x143f73||0x1f4;return function(_0x2b38bf){logger['error'](_0x2b38bf['stack']);if(_0x2b38bf[_0x5a5c('0x22')]){delete _0x2b38bf[_0x5a5c('0x22')];}_0xa7cd95['status'](_0x143f73)[_0x5a5c('0x23')](_0x2b38bf);};}exports['index']=function(_0x3e6fc8,_0x4ea80c){var _0x3f2b71={},_0x1b482c={},_0x3c283a={'count':0x0,'rows':[]};var _0x29a43d=_['map'](db[_0x5a5c('0x24')]['rawAttributes'],function(_0x3d76b6){return{'name':_0x3d76b6[_0x5a5c('0x25')],'type':_0x3d76b6['type'][_0x5a5c('0x26')]};});_0x1b482c[_0x5a5c('0x27')]=_['map'](_0x29a43d,_0x5a5c('0x22'));_0x1b482c[_0x5a5c('0x28')]=_[_0x5a5c('0x29')](_0x3e6fc8[_0x5a5c('0x28')]);_0x1b482c[_0x5a5c('0x2a')]=_[_0x5a5c('0x2b')](_0x1b482c[_0x5a5c('0x27')],_0x1b482c[_0x5a5c('0x28')]);_0x3f2b71[_0x5a5c('0x2c')]=_[_0x5a5c('0x2b')](_0x1b482c[_0x5a5c('0x27')],qs[_0x5a5c('0x2d')](_0x3e6fc8[_0x5a5c('0x28')][_0x5a5c('0x2d')]));_0x3f2b71[_0x5a5c('0x2c')]=_0x3f2b71['attributes'][_0x5a5c('0x2e')]?_0x3f2b71[_0x5a5c('0x2c')]:_0x1b482c['model'];if(!_0x3e6fc8[_0x5a5c('0x28')][_0x5a5c('0x2f')](_0x5a5c('0x30'))){_0x3f2b71[_0x5a5c('0x19')]=qs[_0x5a5c('0x19')](_0x3e6fc8['query'][_0x5a5c('0x19')]);_0x3f2b71[_0x5a5c('0x18')]=qs[_0x5a5c('0x18')](_0x3e6fc8[_0x5a5c('0x28')][_0x5a5c('0x18')]);}_0x3f2b71[_0x5a5c('0x31')]=qs['sort'](_0x3e6fc8[_0x5a5c('0x28')][_0x5a5c('0x32')]);_0x3f2b71[_0x5a5c('0x33')]=qs['filters'](_[_0x5a5c('0x34')](_0x3e6fc8[_0x5a5c('0x28')],_0x1b482c['filters']),_0x29a43d);if(_0x3e6fc8['query'][_0x5a5c('0x35')]){_0x3f2b71[_0x5a5c('0x33')]=_[_0x5a5c('0x36')](_0x3f2b71[_0x5a5c('0x33')],{'$or':_[_0x5a5c('0x37')](_0x29a43d,function(_0x56821b){if(_0x56821b[_0x5a5c('0x38')]!==_0x5a5c('0x39')){var _0x1c0b0a={};_0x1c0b0a[_0x56821b[_0x5a5c('0x22')]]={'$like':'%'+_0x3e6fc8['query'][_0x5a5c('0x35')]+'%'};return _0x1c0b0a;}})});}_0x3f2b71=_[_0x5a5c('0x36')]({},_0x3f2b71,_0x3e6fc8[_0x5a5c('0x3a')]);var _0x9ee24e={'where':_0x3f2b71[_0x5a5c('0x33')]};return db['JscriptyQuestionReport']['count'](_0x9ee24e)[_0x5a5c('0x1f')](function(_0x26efd5){_0x3c283a['count']=_0x26efd5;if(_0x3e6fc8['query']['includeAll']){_0x3f2b71['include']=[{'all':!![]}];}return db[_0x5a5c('0x24')]['findAll'](_0x3f2b71);})[_0x5a5c('0x1f')](function(_0x13fb9e){_0x3c283a[_0x5a5c('0x3b')]=_0x13fb9e;return _0x3c283a;})[_0x5a5c('0x1f')](respondWithFilteredResult(_0x4ea80c,_0x3f2b71))[_0x5a5c('0x3c')](handleError(_0x4ea80c,null));};exports[_0x5a5c('0x3d')]=function(_0x41c3bf,_0x2fde8f){var _0x445b89={'raw':!![],'where':{'id':_0x41c3bf[_0x5a5c('0x3e')]['id']}},_0x598045={};_0x598045[_0x5a5c('0x27')]=_[_0x5a5c('0x29')](db['JscriptyQuestionReport'][_0x5a5c('0x3f')]);_0x598045[_0x5a5c('0x28')]=_['keys'](_0x41c3bf['query']);_0x598045[_0x5a5c('0x2a')]=_[_0x5a5c('0x2b')](_0x598045[_0x5a5c('0x27')],_0x598045['query']);_0x445b89[_0x5a5c('0x2c')]=_[_0x5a5c('0x2b')](_0x598045['model'],qs[_0x5a5c('0x2d')](_0x41c3bf['query']['fields']));_0x445b89['attributes']=_0x445b89[_0x5a5c('0x2c')][_0x5a5c('0x2e')]?_0x445b89[_0x5a5c('0x2c')]:_0x598045[_0x5a5c('0x27')];if(_0x41c3bf[_0x5a5c('0x28')][_0x5a5c('0x40')]){_0x445b89[_0x5a5c('0x41')]=[{'all':!![]}];}_0x445b89=_[_0x5a5c('0x36')]({},_0x445b89,_0x41c3bf[_0x5a5c('0x3a')]);return db[_0x5a5c('0x24')]['find'](_0x445b89)[_0x5a5c('0x1f')](handleEntityNotFound(_0x2fde8f,null))['then'](respondWithResult(_0x2fde8f,null))[_0x5a5c('0x3c')](handleError(_0x2fde8f,null));};exports[_0x5a5c('0x42')]=function(_0x5e3be0,_0x365d83){return db['JscriptyQuestionReport'][_0x5a5c('0x42')](_0x5e3be0[_0x5a5c('0x43')],{})[_0x5a5c('0x1f')](respondWithResult(_0x365d83,0xc9))[_0x5a5c('0x3c')](handleError(_0x365d83,null));};exports[_0x5a5c('0x1e')]=function(_0x45a947,_0x54d8af){if(_0x45a947[_0x5a5c('0x43')]['id']){delete _0x45a947['body']['id'];}return db[_0x5a5c('0x24')]['find']({'where':{'id':_0x45a947[_0x5a5c('0x3e')]['id']}})[_0x5a5c('0x1f')](handleEntityNotFound(_0x54d8af,null))['then'](saveUpdates(_0x45a947['body'],null))[_0x5a5c('0x1f')](respondWithResult(_0x54d8af,null))[_0x5a5c('0x3c')](handleError(_0x54d8af,null));};exports[_0x5a5c('0x20')]=function(_0x5a1013,_0x59a76){return db[_0x5a5c('0x24')]['find']({'where':{'id':_0x5a1013['params']['id']}})[_0x5a5c('0x1f')](handleEntityNotFound(_0x59a76,null))[_0x5a5c('0x1f')](removeEntity(_0x59a76,null))[_0x5a5c('0x3c')](handleError(_0x59a76,null));};exports[_0x5a5c('0x44')]=function(_0x15cb35,_0xbae5c2){return db['JscriptyQuestionReport'][_0x5a5c('0x44')]()[_0x5a5c('0x1f')](respondWithResult(_0xbae5c2,null))[_0x5a5c('0x3c')](handleError(_0xbae5c2,null));}; \ No newline at end of file +var _0x8624=['VIRTUAL','options','includeAll','include','show','rawAttributes','length','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','send','map','JscriptyQuestionReport','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','order','sort','where','filters','filter','merge'];(function(_0x256f60,_0x892aa0){var _0x34f044=function(_0x4e0728){while(--_0x4e0728){_0x256f60['push'](_0x256f60['shift']());}};_0x34f044(++_0x892aa0);}(_0x8624,0x1ab));var _0x4862=function(_0x5d31ee,_0x183e43){_0x5d31ee=_0x5d31ee-0x0;var _0x21c2e6=_0x8624[_0x5d31ee];return _0x21c2e6;};'use strict';var emlformat=require(_0x4862('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4862('0x1'));var jsonpatch=require(_0x4862('0x2'));var rp=require(_0x4862('0x3'));var moment=require('moment');var BPromise=require(_0x4862('0x4'));var Mustache=require('mustache');var util=require(_0x4862('0x5'));var path=require('path');var sox=require(_0x4862('0x6'));var csv=require(_0x4862('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4862('0x8'));var _=require(_0x4862('0x9'));var squel=require(_0x4862('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4862('0xb'));var toCsv=require(_0x4862('0x7'));var querystring=require(_0x4862('0xc'));var Papa=require(_0x4862('0xd'));var Redis=require(_0x4862('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4862('0xf'));var as=require(_0x4862('0x10'));var hardwareService=require(_0x4862('0x11'));var logger=require('../../config/logger')(_0x4862('0x12'));var utils=require(_0x4862('0x13'));var config=require(_0x4862('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4862('0x15'))['db'];function respondWithStatusCode(_0x5c9d91,_0x49a237){_0x49a237=_0x49a237||0xcc;return function(_0x2b4133){if(_0x2b4133){return _0x5c9d91[_0x4862('0x16')](_0x49a237);}return _0x5c9d91['status'](_0x49a237)[_0x4862('0x17')]();};}function respondWithResult(_0x421bc0,_0x5f125a){_0x5f125a=_0x5f125a||0xc8;return function(_0xcf3732){if(_0xcf3732){return _0x421bc0[_0x4862('0x18')](_0x5f125a)['json'](_0xcf3732);}};}function respondWithFilteredResult(_0x485639,_0x16146b){return function(_0x1107ca){if(_0x1107ca){var _0x1b92fc=typeof _0x16146b[_0x4862('0x19')]===_0x4862('0x1a')&&typeof _0x16146b[_0x4862('0x1b')]===_0x4862('0x1a');var _0x51fa34=_0x1107ca[_0x4862('0x1c')];var _0x312623=_0x1b92fc?0x0:_0x16146b[_0x4862('0x19')];var _0x4f71b2=_0x1b92fc?_0x1107ca[_0x4862('0x1c')]:_0x16146b[_0x4862('0x19')]+_0x16146b['limit'];var _0x54048f;if(_0x4f71b2>=_0x51fa34){_0x4f71b2=_0x51fa34;_0x54048f=0xc8;}else{_0x54048f=0xce;}_0x485639[_0x4862('0x18')](_0x54048f);return _0x485639[_0x4862('0x1d')]('Content-Range',_0x312623+'-'+_0x4f71b2+'/'+_0x51fa34)[_0x4862('0x1e')](_0x1107ca);}return null;};}function patchUpdates(_0x63d3ef){return function(_0x3f257d){try{jsonpatch[_0x4862('0x1f')](_0x3f257d,_0x63d3ef,!![]);}catch(_0x5f13bf){return BPromise[_0x4862('0x20')](_0x5f13bf);}return _0x3f257d['save']();};}function saveUpdates(_0x2e0899,_0x2d2472){return function(_0x281369){if(_0x281369){return _0x281369[_0x4862('0x21')](_0x2e0899)[_0x4862('0x22')](function(_0x7f91a3){return _0x7f91a3;});}return null;};}function removeEntity(_0x3728d6,_0x495420){return function(_0xfcd134){if(_0xfcd134){return _0xfcd134[_0x4862('0x23')]()[_0x4862('0x22')](function(){_0x3728d6[_0x4862('0x18')](0xcc)[_0x4862('0x17')]();});}};}function handleEntityNotFound(_0x2975b2,_0x14bb76){return function(_0x49dd73){if(!_0x49dd73){_0x2975b2[_0x4862('0x16')](0x194);}return _0x49dd73;};}function handleError(_0x69a2ff,_0x49b926){_0x49b926=_0x49b926||0x1f4;return function(_0x5f23b0){logger[_0x4862('0x24')](_0x5f23b0['stack']);if(_0x5f23b0['name']){delete _0x5f23b0['name'];}_0x69a2ff[_0x4862('0x18')](_0x49b926)[_0x4862('0x25')](_0x5f23b0);};}exports['index']=function(_0x571c2c,_0xc7d1df){var _0x58673f={},_0x4b96b0={},_0x44f195={'count':0x0,'rows':[]};var _0x762707=_[_0x4862('0x26')](db[_0x4862('0x27')]['rawAttributes'],function(_0x400d67){return{'name':_0x400d67[_0x4862('0x28')],'type':_0x400d67[_0x4862('0x29')][_0x4862('0x2a')]};});_0x4b96b0['model']=_[_0x4862('0x26')](_0x762707,_0x4862('0x2b'));_0x4b96b0[_0x4862('0x2c')]=_[_0x4862('0x2d')](_0x571c2c['query']);_0x4b96b0['filters']=_[_0x4862('0x2e')](_0x4b96b0['model'],_0x4b96b0[_0x4862('0x2c')]);_0x58673f['attributes']=_[_0x4862('0x2e')](_0x4b96b0[_0x4862('0x2f')],qs[_0x4862('0x30')](_0x571c2c[_0x4862('0x2c')][_0x4862('0x30')]));_0x58673f[_0x4862('0x31')]=_0x58673f[_0x4862('0x31')]['length']?_0x58673f[_0x4862('0x31')]:_0x4b96b0['model'];if(!_0x571c2c['query']['hasOwnProperty']('nolimit')){_0x58673f['limit']=qs[_0x4862('0x1b')](_0x571c2c[_0x4862('0x2c')]['limit']);_0x58673f[_0x4862('0x19')]=qs['offset'](_0x571c2c['query'][_0x4862('0x19')]);}_0x58673f[_0x4862('0x32')]=qs[_0x4862('0x33')](_0x571c2c['query'][_0x4862('0x33')]);_0x58673f[_0x4862('0x34')]=qs[_0x4862('0x35')](_['pick'](_0x571c2c[_0x4862('0x2c')],_0x4b96b0[_0x4862('0x35')]),_0x762707);if(_0x571c2c['query'][_0x4862('0x36')]){_0x58673f[_0x4862('0x34')]=_[_0x4862('0x37')](_0x58673f[_0x4862('0x34')],{'$or':_['map'](_0x762707,function(_0x5bfe09){if(_0x5bfe09[_0x4862('0x29')]!==_0x4862('0x38')){var _0x491de1={};_0x491de1[_0x5bfe09['name']]={'$like':'%'+_0x571c2c[_0x4862('0x2c')][_0x4862('0x36')]+'%'};return _0x491de1;}})});}_0x58673f=_[_0x4862('0x37')]({},_0x58673f,_0x571c2c[_0x4862('0x39')]);var _0x5d1cf9={'where':_0x58673f[_0x4862('0x34')]};return db[_0x4862('0x27')][_0x4862('0x1c')](_0x5d1cf9)['then'](function(_0x23361b){_0x44f195['count']=_0x23361b;if(_0x571c2c[_0x4862('0x2c')][_0x4862('0x3a')]){_0x58673f[_0x4862('0x3b')]=[{'all':!![]}];}return db[_0x4862('0x27')]['findAll'](_0x58673f);})[_0x4862('0x22')](function(_0x2e30f2){_0x44f195['rows']=_0x2e30f2;return _0x44f195;})[_0x4862('0x22')](respondWithFilteredResult(_0xc7d1df,_0x58673f))['catch'](handleError(_0xc7d1df,null));};exports[_0x4862('0x3c')]=function(_0x45abdc,_0x102d7a){var _0x5c5bdc={'raw':!![],'where':{'id':_0x45abdc['params']['id']}},_0xcdd636={};_0xcdd636[_0x4862('0x2f')]=_[_0x4862('0x2d')](db[_0x4862('0x27')][_0x4862('0x3d')]);_0xcdd636['query']=_[_0x4862('0x2d')](_0x45abdc[_0x4862('0x2c')]);_0xcdd636[_0x4862('0x35')]=_[_0x4862('0x2e')](_0xcdd636[_0x4862('0x2f')],_0xcdd636[_0x4862('0x2c')]);_0x5c5bdc[_0x4862('0x31')]=_[_0x4862('0x2e')](_0xcdd636[_0x4862('0x2f')],qs[_0x4862('0x30')](_0x45abdc[_0x4862('0x2c')]['fields']));_0x5c5bdc['attributes']=_0x5c5bdc['attributes'][_0x4862('0x3e')]?_0x5c5bdc['attributes']:_0xcdd636[_0x4862('0x2f')];if(_0x45abdc[_0x4862('0x2c')][_0x4862('0x3a')]){_0x5c5bdc['include']=[{'all':!![]}];}_0x5c5bdc=_[_0x4862('0x37')]({},_0x5c5bdc,_0x45abdc[_0x4862('0x39')]);return db[_0x4862('0x27')][_0x4862('0x3f')](_0x5c5bdc)[_0x4862('0x22')](handleEntityNotFound(_0x102d7a,null))['then'](respondWithResult(_0x102d7a,null))[_0x4862('0x40')](handleError(_0x102d7a,null));};exports['create']=function(_0x566071,_0x42bc59){return db[_0x4862('0x27')][_0x4862('0x41')](_0x566071['body'],{})[_0x4862('0x22')](respondWithResult(_0x42bc59,0xc9))[_0x4862('0x40')](handleError(_0x42bc59,null));};exports[_0x4862('0x21')]=function(_0x577195,_0x3adbd6){if(_0x577195[_0x4862('0x42')]['id']){delete _0x577195[_0x4862('0x42')]['id'];}return db[_0x4862('0x27')][_0x4862('0x3f')]({'where':{'id':_0x577195[_0x4862('0x43')]['id']}})[_0x4862('0x22')](handleEntityNotFound(_0x3adbd6,null))[_0x4862('0x22')](saveUpdates(_0x577195[_0x4862('0x42')],null))[_0x4862('0x22')](respondWithResult(_0x3adbd6,null))[_0x4862('0x40')](handleError(_0x3adbd6,null));};exports[_0x4862('0x23')]=function(_0x39d912,_0x1ccf88){return db[_0x4862('0x27')][_0x4862('0x3f')]({'where':{'id':_0x39d912['params']['id']}})[_0x4862('0x22')](handleEntityNotFound(_0x1ccf88,null))['then'](removeEntity(_0x1ccf88,null))['catch'](handleError(_0x1ccf88,null));};exports[_0x4862('0x44')]=function(_0x1f4030,_0x494f82){return db['JscriptyQuestionReport']['describe']()[_0x4862('0x22')](respondWithResult(_0x494f82,null))[_0x4862('0x40')](handleError(_0x494f82,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7c4abac..2cc4b63 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 _0x2b5d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x2d2b81,_0x5189e0){var _0x46f7cf=function(_0x51cec1){while(--_0x51cec1){_0x2d2b81['push'](_0x2d2b81['shift']());}};_0x46f7cf(++_0x5189e0);}(_0x2b5d,0x180));var _0xd2b5=function(_0x563391,_0x347305){_0x563391=_0x563391-0x0;var _0x4e7fca=_0x2b5d[_0x563391];return _0x4e7fca;};'use strict';var _=require(_0xd2b5('0x0'));var util=require(_0xd2b5('0x1'));var logger=require(_0xd2b5('0x2'))(_0xd2b5('0x3'));var moment=require('moment');var BPromise=require(_0xd2b5('0x4'));var rp=require(_0xd2b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2b5('0x6'));var config=require(_0xd2b5('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2d9792,_0x29b22b){return _0x2d9792[_0xd2b5('0x8')](_0xd2b5('0x9'),attributes,{'tableName':_0xd2b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb50e=['JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x508d80,_0x58d6a5){var _0x54c8f6=function(_0x1aad54){while(--_0x1aad54){_0x508d80['push'](_0x508d80['shift']());}};_0x54c8f6(++_0x58d6a5);}(_0xb50e,0x12b));var _0xeb50=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0xb50e[_0x560448];return _0x550276;};'use strict';var _=require('lodash');var util=require(_0xeb50('0x0'));var logger=require(_0xeb50('0x1'))(_0xeb50('0x2'));var moment=require(_0xeb50('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb50('0x4'));var rimraf=require(_0xeb50('0x5'));var config=require(_0xeb50('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xeb50('0x7')]=function(_0x572bec,_0x41dbff){return _0x572bec[_0xeb50('0x8')](_0xeb50('0x9'),attributes,{'tableName':_0xeb50('0xa'),'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 5dc1e77..0b83508 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 _0xb7cc=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x37916f,_0x42c63c){var _0x478951=function(_0x1285d5){while(--_0x1285d5){_0x37916f['push'](_0x37916f['shift']());}};_0x478951(++_0x42c63c);}(_0xb7cc,0xfb));var _0xcb7c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xb7cc[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xcb7c('0x0'));var util=require(_0xcb7c('0x1'));var moment=require(_0xcb7c('0x2'));var BPromise=require(_0xcb7c('0x3'));var rs=require(_0xcb7c('0x4'));var fs=require('fs');var Redis=require(_0xcb7c('0x5'));var db=require(_0xcb7c('0x6'))['db'];var utils=require(_0xcb7c('0x7'));var logger=require('../../config/logger')(_0xcb7c('0x8'));var config=require(_0xcb7c('0x9'));var jayson=require(_0xcb7c('0xa'));var client=jayson[_0xcb7c('0xb')][_0xcb7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x332857,_0x48c999,_0x54f593){return new BPromise(function(_0x52f28c,_0x578970){return client[_0xcb7c('0xd')](_0x332857,_0x54f593)[_0xcb7c('0xe')](function(_0x2fa9c4){logger[_0xcb7c('0xf')](_0xcb7c('0x10'),_0x48c999,'request\x20sent');logger[_0xcb7c('0x11')](_0xcb7c('0x12'),_0x48c999,_0xcb7c('0x13'),JSON[_0xcb7c('0x14')](_0x2fa9c4));if(_0x2fa9c4[_0xcb7c('0x15')]){if(_0x2fa9c4[_0xcb7c('0x15')][_0xcb7c('0x16')]===0x1f4){logger['error'](_0xcb7c('0x10'),_0x48c999,_0x2fa9c4[_0xcb7c('0x15')][_0xcb7c('0x17')]);return _0x578970(_0x2fa9c4[_0xcb7c('0x15')][_0xcb7c('0x17')]);}logger[_0xcb7c('0x15')](_0xcb7c('0x10'),_0x48c999,_0x2fa9c4['error'][_0xcb7c('0x17')]);return _0x52f28c(_0x2fa9c4[_0xcb7c('0x15')][_0xcb7c('0x17')]);}else{logger['info'](_0xcb7c('0x10'),_0x48c999,_0xcb7c('0x13'));_0x52f28c(_0x2fa9c4[_0xcb7c('0x18')][_0xcb7c('0x17')]);}})[_0xcb7c('0x19')](function(_0x58b810){logger[_0xcb7c('0x15')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x48c999,_0x58b810);_0x578970(_0x58b810);});});} \ No newline at end of file +var _0xb6a4=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xb6a4,0x93));var _0x4b6a=function(_0x36c08,_0x4a4021){_0x36c08=_0x36c08-0x0;var _0x5499e7=_0xb6a4[_0x36c08];return _0x5499e7;};'use strict';var _=require(_0x4b6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4b6a('0x1'));var rs=require(_0x4b6a('0x2'));var fs=require('fs');var Redis=require(_0x4b6a('0x3'));var db=require(_0x4b6a('0x4'))['db'];var utils=require(_0x4b6a('0x5'));var logger=require(_0x4b6a('0x6'))(_0x4b6a('0x7'));var config=require(_0x4b6a('0x8'));var jayson=require(_0x4b6a('0x9'));var client=jayson[_0x4b6a('0xa')][_0x4b6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e2529,_0x582aa7,_0x6b012b){return new BPromise(function(_0x4aa169,_0xcaec04){return client[_0x4b6a('0xc')](_0x3e2529,_0x6b012b)['then'](function(_0x12acb6){logger['info'](_0x4b6a('0xd'),_0x582aa7,_0x4b6a('0xe'));logger[_0x4b6a('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x582aa7,'request\x20sent',JSON[_0x4b6a('0x10')](_0x12acb6));if(_0x12acb6[_0x4b6a('0x11')]){if(_0x12acb6['error'][_0x4b6a('0x12')]===0x1f4){logger[_0x4b6a('0x11')](_0x4b6a('0xd'),_0x582aa7,_0x12acb6[_0x4b6a('0x11')][_0x4b6a('0x13')]);return _0xcaec04(_0x12acb6[_0x4b6a('0x11')][_0x4b6a('0x13')]);}logger[_0x4b6a('0x11')](_0x4b6a('0xd'),_0x582aa7,_0x12acb6['error']['message']);return _0x4aa169(_0x12acb6[_0x4b6a('0x11')][_0x4b6a('0x13')]);}else{logger[_0x4b6a('0x14')](_0x4b6a('0xd'),_0x582aa7,_0x4b6a('0xe'));_0x4aa169(_0x12acb6[_0x4b6a('0x15')][_0x4b6a('0x13')]);}})[_0x4b6a('0x16')](function(_0x2e0c9a){logger['error'](_0x4b6a('0xd'),_0x582aa7,_0x2e0c9a);_0xcaec04(_0x2e0c9a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0181fb4..8dc425e 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 _0xfc6a=['multer','util','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xfc6a,0x1e0));var _0xafc6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc6a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xafc6('0x0'));var util=require(_0xafc6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xafc6('0x2'));var router=express[_0xafc6('0x3')]();var fs_extra=require(_0xafc6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xafc6('0x5'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xafc6('0x6')]('/',auth[_0xafc6('0x7')](),controller[_0xafc6('0x8')]);router[_0xafc6('0x6')](_0xafc6('0x9'),auth[_0xafc6('0x7')](),controller[_0xafc6('0xa')]);router['get'](_0xafc6('0xb'),auth[_0xafc6('0x7')](),controller[_0xafc6('0xc')]);router[_0xafc6('0x6')](_0xafc6('0xd'),auth[_0xafc6('0x7')](),controller[_0xafc6('0xe')]);router['post']('/',auth[_0xafc6('0x7')](),controller[_0xafc6('0xf')]);router[_0xafc6('0x10')](_0xafc6('0xb'),auth[_0xafc6('0x7')](),controller[_0xafc6('0x11')]);router[_0xafc6('0x12')](_0xafc6('0xb'),auth[_0xafc6('0x7')](),controller[_0xafc6('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3770=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','post'];(function(_0x392b64,_0x6a754a){var _0x4245bd=function(_0x341194){while(--_0x341194){_0x392b64['push'](_0x392b64['shift']());}};_0x4245bd(++_0x6a754a);}(_0x3770,0x1a9));var _0x0377=function(_0x14a4b1,_0x4224f7){_0x14a4b1=_0x14a4b1-0x0;var _0x106864=_0x3770[_0x14a4b1];return _0x106864;};'use strict';var multer=require(_0x0377('0x0'));var util=require(_0x0377('0x1'));var path=require('path');var timeout=require(_0x0377('0x2'));var express=require(_0x0377('0x3'));var router=express['Router']();var fs_extra=require(_0x0377('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0377('0x5'));var config=require('../../config/environment');var controller=require(_0x0377('0x6'));router[_0x0377('0x7')]('/',auth[_0x0377('0x8')](),controller['index']);router[_0x0377('0x7')](_0x0377('0x9'),auth[_0x0377('0x8')](),controller[_0x0377('0xa')]);router[_0x0377('0x7')](_0x0377('0xb'),auth['isAuthenticated'](),controller[_0x0377('0xc')]);router[_0x0377('0x7')](_0x0377('0xd'),auth[_0x0377('0x8')](),controller['getQuestions']);router[_0x0377('0xe')]('/',auth[_0x0377('0x8')](),controller['create']);router[_0x0377('0xf')](_0x0377('0xb'),auth[_0x0377('0x8')](),controller[_0x0377('0x10')]);router[_0x0377('0x11')]('/:id',auth[_0x0377('0x8')](),controller[_0x0377('0x12')]);module[_0x0377('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 602fa12..901dfa6 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 _0x18e2=['DATE','setDataValue','starttime','endtime','format','STRING','BOOLEAN','moment','exports'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x18e2,0x1c0));var _0x218e=function(_0x4aea8e,_0xb1d5c1){_0x4aea8e=_0x4aea8e-0x0;var _0x108075=_0x18e2[_0x4aea8e];return _0x108075;};'use strict';var moment=require(_0x218e('0x0'));var Sequelize=require('sequelize');module[_0x218e('0x1')]={'starttime':{'type':Sequelize[_0x218e('0x2')],'set':function(_0x4cbc6b){this[_0x218e('0x3')](_0x218e('0x4'),_0x4cbc6b);this[_0x218e('0x3')](_0x218e('0x5'),moment()[_0x218e('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x218e('0x2')]},'membername':{'type':Sequelize[_0x218e('0x7')]},'projectname':{'type':Sequelize[_0x218e('0x7')]},'queue':{'type':Sequelize[_0x218e('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x218e('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x218e('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x7432=['STRING','BOOLEAN','moment','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7432,0x7a));var _0x2743=function(_0x194e05,_0x5fbd8a){_0x194e05=_0x194e05-0x0;var _0x1ee6d2=_0x7432[_0x194e05];return _0x1ee6d2;};'use strict';var moment=require(_0x2743('0x0'));var Sequelize=require('sequelize');module[_0x2743('0x1')]={'starttime':{'type':Sequelize[_0x2743('0x2')],'set':function(_0x2e153b){this[_0x2743('0x3')](_0x2743('0x4'),_0x2e153b);this[_0x2743('0x3')](_0x2743('0x5'),moment()[_0x2743('0x6')](_0x2743('0x7')));}},'endtime':{'type':Sequelize[_0x2743('0x2')]},'membername':{'type':Sequelize[_0x2743('0x8')]},'projectname':{'type':Sequelize[_0x2743('0x8')]},'queue':{'type':Sequelize[_0x2743('0x8')]},'uniqueid':{'type':Sequelize[_0x2743('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x2743('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 f6e3b4d..df752ff 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 _0xe32c=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','find','create','body','destroy','describe','getQuestions','findOne','params','JscriptyQuestionReport','SessionId','map','findAll','rimraf','zip-dir'];(function(_0x424167,_0x39f30e){var _0x5db42b=function(_0x319715){while(--_0x319715){_0x424167['push'](_0x424167['shift']());}};_0x5db42b(++_0x39f30e);}(_0xe32c,0x193));var _0xce32=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe32c[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce32('0x0'));var zipdir=require(_0xce32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce32('0x2'));var moment=require('moment');var BPromise=require(_0xce32('0x3'));var Mustache=require(_0xce32('0x4'));var util=require(_0xce32('0x5'));var path=require(_0xce32('0x6'));var sox=require(_0xce32('0x7'));var csv=require(_0xce32('0x8'));var ejs=require(_0xce32('0x9'));var fs=require('fs');var fs_extra=require(_0xce32('0xa'));var _=require(_0xce32('0xb'));var squel=require('squel');var crypto=require(_0xce32('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce32('0xd'));var toCsv=require(_0xce32('0x8'));var querystring=require(_0xce32('0xe'));var Papa=require('papaparse');var Redis=require(_0xce32('0xf'));var authService=require(_0xce32('0x10'));var qs=require(_0xce32('0x11'));var as=require(_0xce32('0x12'));var hardwareService=require(_0xce32('0x13'));var logger=require(_0xce32('0x14'))(_0xce32('0x15'));var utils=require(_0xce32('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xce32('0x17'));var db=require(_0xce32('0x18'))['db'];function respondWithStatusCode(_0x1c7594,_0x26f4ef){_0x26f4ef=_0x26f4ef||0xcc;return function(_0x2611b7){if(_0x2611b7){return _0x1c7594['sendStatus'](_0x26f4ef);}return _0x1c7594[_0xce32('0x19')](_0x26f4ef)['end']();};}function respondWithResult(_0x29aa62,_0x55236b){_0x55236b=_0x55236b||0xc8;return function(_0x46e37b){if(_0x46e37b){return _0x29aa62['status'](_0x55236b)['json'](_0x46e37b);}};}function respondWithFilteredResult(_0x1ef16e,_0x37ffe6){return function(_0x2291db){if(_0x2291db){var _0x521610=typeof _0x37ffe6[_0xce32('0x1a')]===_0xce32('0x1b')&&typeof _0x37ffe6[_0xce32('0x1c')]===_0xce32('0x1b');var _0xbda41f=_0x2291db[_0xce32('0x1d')];var _0x36a0ca=_0x521610?0x0:_0x37ffe6[_0xce32('0x1a')];var _0x45eecd=_0x521610?_0x2291db[_0xce32('0x1d')]:_0x37ffe6[_0xce32('0x1a')]+_0x37ffe6[_0xce32('0x1c')];var _0x2aa4f1;if(_0x45eecd>=_0xbda41f){_0x45eecd=_0xbda41f;_0x2aa4f1=0xc8;}else{_0x2aa4f1=0xce;}_0x1ef16e[_0xce32('0x19')](_0x2aa4f1);return _0x1ef16e[_0xce32('0x1e')](_0xce32('0x1f'),_0x36a0ca+'-'+_0x45eecd+'/'+_0xbda41f)[_0xce32('0x20')](_0x2291db);}return null;};}function patchUpdates(_0x144fca){return function(_0x1357d9){try{jsonpatch[_0xce32('0x21')](_0x1357d9,_0x144fca,!![]);}catch(_0x25c4ec){return BPromise[_0xce32('0x22')](_0x25c4ec);}return _0x1357d9[_0xce32('0x23')]();};}function saveUpdates(_0x5c6881,_0x7a4ea){return function(_0x46fcaf){if(_0x46fcaf){return _0x46fcaf[_0xce32('0x24')](_0x5c6881)[_0xce32('0x25')](function(_0x191b92){return _0x191b92;});}return null;};}function removeEntity(_0x3525ac,_0x168ef8){return function(_0x483a9a){if(_0x483a9a){return _0x483a9a['destroy']()['then'](function(){_0x3525ac[_0xce32('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c894,_0xac6a77){return function(_0x27bfa3){if(!_0x27bfa3){_0x54c894['sendStatus'](0x194);}return _0x27bfa3;};}function handleError(_0x4a7d2d,_0x4abcab){_0x4abcab=_0x4abcab||0x1f4;return function(_0xc3c986){logger[_0xce32('0x26')](_0xc3c986[_0xce32('0x27')]);if(_0xc3c986['name']){delete _0xc3c986[_0xce32('0x28')];}_0x4a7d2d['status'](_0x4abcab)[_0xce32('0x29')](_0xc3c986);};}exports[_0xce32('0x2a')]=function(_0xbe297,_0x174268){var _0x4b6b30={},_0x4c1a7e={},_0x1347a8={'count':0x0,'rows':[]};var _0x58e5b6=_['map'](db[_0xce32('0x2b')][_0xce32('0x2c')],function(_0x3ed3e2){return{'name':_0x3ed3e2[_0xce32('0x2d')],'type':_0x3ed3e2[_0xce32('0x2e')][_0xce32('0x2f')]};});_0x4c1a7e[_0xce32('0x30')]=_['map'](_0x58e5b6,'name');_0x4c1a7e[_0xce32('0x31')]=_[_0xce32('0x32')](_0xbe297[_0xce32('0x31')]);_0x4c1a7e[_0xce32('0x33')]=_['intersection'](_0x4c1a7e[_0xce32('0x30')],_0x4c1a7e['query']);_0x4b6b30[_0xce32('0x34')]=_[_0xce32('0x35')](_0x4c1a7e[_0xce32('0x30')],qs[_0xce32('0x36')](_0xbe297[_0xce32('0x31')][_0xce32('0x36')]));_0x4b6b30[_0xce32('0x34')]=_0x4b6b30[_0xce32('0x34')][_0xce32('0x37')]?_0x4b6b30[_0xce32('0x34')]:_0x4c1a7e[_0xce32('0x30')];if(!_0xbe297[_0xce32('0x31')]['hasOwnProperty'](_0xce32('0x38'))){_0x4b6b30['limit']=qs[_0xce32('0x1c')](_0xbe297[_0xce32('0x31')]['limit']);_0x4b6b30[_0xce32('0x1a')]=qs[_0xce32('0x1a')](_0xbe297[_0xce32('0x31')]['offset']);}_0x4b6b30[_0xce32('0x39')]=qs[_0xce32('0x3a')](_0xbe297[_0xce32('0x31')][_0xce32('0x3a')]);_0x4b6b30['where']=qs[_0xce32('0x33')](_[_0xce32('0x3b')](_0xbe297[_0xce32('0x31')],_0x4c1a7e[_0xce32('0x33')]),_0x58e5b6);if(_0xbe297[_0xce32('0x31')][_0xce32('0x3c')]){_0x4b6b30['where']=_['merge'](_0x4b6b30[_0xce32('0x3d')],{'$or':_['map'](_0x58e5b6,function(_0x361374){if(_0x361374['type']!=='VIRTUAL'){var _0xa084bf={};_0xa084bf[_0x361374[_0xce32('0x28')]]={'$like':'%'+_0xbe297['query'][_0xce32('0x3c')]+'%'};return _0xa084bf;}})});}_0x4b6b30=_[_0xce32('0x3e')]({},_0x4b6b30,_0xbe297[_0xce32('0x3f')]);var _0x3d0ca3={'where':_0x4b6b30[_0xce32('0x3d')]};return db['JscriptySessionReport']['count'](_0x3d0ca3)[_0xce32('0x25')](function(_0xe3e40){_0x1347a8[_0xce32('0x1d')]=_0xe3e40;if(_0xbe297[_0xce32('0x31')][_0xce32('0x40')]){_0x4b6b30[_0xce32('0x41')]=[{'all':!![]}];}return db[_0xce32('0x2b')]['findAll'](_0x4b6b30);})[_0xce32('0x25')](function(_0x992cae){_0x1347a8[_0xce32('0x42')]=_0x992cae;return _0x1347a8;})[_0xce32('0x25')](respondWithFilteredResult(_0x174268,_0x4b6b30))[_0xce32('0x43')](handleError(_0x174268,null));};exports[_0xce32('0x44')]=function(_0x3c3027,_0x71481e){var _0x23acb2={'raw':!![],'where':{'id':_0x3c3027['params']['id']}},_0x36bcd1={};_0x36bcd1[_0xce32('0x30')]=_[_0xce32('0x32')](db[_0xce32('0x2b')][_0xce32('0x2c')]);_0x36bcd1['query']=_[_0xce32('0x32')](_0x3c3027[_0xce32('0x31')]);_0x36bcd1['filters']=_[_0xce32('0x35')](_0x36bcd1['model'],_0x36bcd1['query']);_0x23acb2['attributes']=_[_0xce32('0x35')](_0x36bcd1['model'],qs['fields'](_0x3c3027[_0xce32('0x31')][_0xce32('0x36')]));_0x23acb2[_0xce32('0x34')]=_0x23acb2[_0xce32('0x34')][_0xce32('0x37')]?_0x23acb2[_0xce32('0x34')]:_0x36bcd1[_0xce32('0x30')];if(_0x3c3027['query'][_0xce32('0x40')]){_0x23acb2[_0xce32('0x41')]=[{'all':!![]}];}_0x23acb2=_[_0xce32('0x3e')]({},_0x23acb2,_0x3c3027['options']);return db['JscriptySessionReport'][_0xce32('0x45')](_0x23acb2)[_0xce32('0x25')](handleEntityNotFound(_0x71481e,null))[_0xce32('0x25')](respondWithResult(_0x71481e,null))['catch'](handleError(_0x71481e,null));};exports[_0xce32('0x46')]=function(_0x5740df,_0x33e0c4){return db[_0xce32('0x2b')][_0xce32('0x46')](_0x5740df[_0xce32('0x47')],{})['then'](respondWithResult(_0x33e0c4,0xc9))['catch'](handleError(_0x33e0c4,null));};exports['update']=function(_0x265c4c,_0x47af77){if(_0x265c4c[_0xce32('0x47')]['id']){delete _0x265c4c[_0xce32('0x47')]['id'];}return db[_0xce32('0x2b')][_0xce32('0x45')]({'where':{'id':_0x265c4c['params']['id']}})[_0xce32('0x25')](handleEntityNotFound(_0x47af77,null))['then'](saveUpdates(_0x265c4c[_0xce32('0x47')],null))[_0xce32('0x25')](respondWithResult(_0x47af77,null))[_0xce32('0x43')](handleError(_0x47af77,null));};exports[_0xce32('0x48')]=function(_0x5a703a,_0x587979){return db[_0xce32('0x2b')][_0xce32('0x45')]({'where':{'id':_0x5a703a['params']['id']}})[_0xce32('0x25')](handleEntityNotFound(_0x587979,null))['then'](removeEntity(_0x587979,null))[_0xce32('0x43')](handleError(_0x587979,null));};exports[_0xce32('0x49')]=function(_0x1971b9,_0x486f19){return db[_0xce32('0x2b')][_0xce32('0x49')]()[_0xce32('0x25')](respondWithResult(_0x486f19,null))['catch'](handleError(_0x486f19,null));};exports[_0xce32('0x4a')]=function(_0x63a162,_0x48a8ec,_0x29c8c7){var _0x791fc6={'raw':!![],'where':{}};var _0x5b8dbe={};var _0x339135={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xce32('0x4b')]({'where':{'id':_0x63a162[_0xce32('0x4c')]['id']}})[_0xce32('0x25')](handleEntityNotFound(_0x48a8ec,null))[_0xce32('0x25')](function(_0x4ed3e9){if(_0x4ed3e9){_0x5b8dbe['model']=_['keys'](db[_0xce32('0x4d')][_0xce32('0x2c')]);_0x5b8dbe['query']=_[_0xce32('0x32')](_0x63a162[_0xce32('0x31')]);_0x5b8dbe[_0xce32('0x33')]=_[_0xce32('0x35')](_0x5b8dbe[_0xce32('0x30')],_0x5b8dbe['query']);_0x791fc6[_0xce32('0x34')]=_[_0xce32('0x35')](_0x5b8dbe[_0xce32('0x30')],qs[_0xce32('0x36')](_0x63a162[_0xce32('0x31')][_0xce32('0x36')]));_0x791fc6[_0xce32('0x34')]=_0x791fc6[_0xce32('0x34')]['length']?_0x791fc6[_0xce32('0x34')]:_0x5b8dbe[_0xce32('0x30')];if(!_0x63a162['query']['hasOwnProperty'](_0xce32('0x38'))){_0x791fc6[_0xce32('0x1c')]=qs['limit'](_0x63a162['query'][_0xce32('0x1c')]);_0x791fc6[_0xce32('0x1a')]=qs[_0xce32('0x1a')](_0x63a162[_0xce32('0x31')][_0xce32('0x1a')]);}_0x791fc6[_0xce32('0x39')]=qs['sort'](_0x63a162[_0xce32('0x31')]['sort']);_0x791fc6[_0xce32('0x3d')]=qs['filters'](_[_0xce32('0x3b')](_0x63a162['query'],_0x5b8dbe[_0xce32('0x33')]));_0x791fc6['where'][_0xce32('0x4e')]=_0x4ed3e9['id'];if(_0x63a162['query'][_0xce32('0x3c')]){_0x791fc6[_0xce32('0x3d')]=_[_0xce32('0x3e')](_0x791fc6[_0xce32('0x3d')],{'$or':_[_0xce32('0x4f')](_0x791fc6[_0xce32('0x34')],function(_0x230f1b){var _0x1aae3b={};_0x1aae3b[_0x230f1b]={'$like':'%'+_0x63a162[_0xce32('0x31')][_0xce32('0x3c')]+'%'};return _0x1aae3b;})});}_0x791fc6=_['merge']({},_0x791fc6,_0x63a162[_0xce32('0x3f')]);return db[_0xce32('0x4d')][_0xce32('0x1d')]({'where':_0x791fc6[_0xce32('0x3d')]})[_0xce32('0x25')](function(_0x5bcd21){_0x339135[_0xce32('0x1d')]=_0x5bcd21;if(_0x63a162[_0xce32('0x31')]['includeAll']){_0x791fc6[_0xce32('0x41')]=[{'all':!![]}];}return db[_0xce32('0x4d')][_0xce32('0x50')](_0x791fc6);})[_0xce32('0x25')](function(_0x54d43a){_0x339135[_0xce32('0x42')]=_0x54d43a;return _0x339135;});}})[_0xce32('0x25')](respondWithFilteredResult(_0x48a8ec,_0x791fc6))[_0xce32('0x43')](handleError(_0x48a8ec,null));}; \ No newline at end of file +var _0xcfaa=['mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','body','describe','findOne','JscriptyQuestionReport','order','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x839850,_0x19c676){var _0x13782d=function(_0x48e6c5){while(--_0x48e6c5){_0x839850['push'](_0x839850['shift']());}};_0x13782d(++_0x19c676);}(_0xcfaa,0x9c));var _0xacfa=function(_0x296c7b,_0x37a883){_0x296c7b=_0x296c7b-0x0;var _0xd2cf0d=_0xcfaa[_0x296c7b];return _0xd2cf0d;};'use strict';var emlformat=require(_0xacfa('0x0'));var rimraf=require(_0xacfa('0x1'));var zipdir=require(_0xacfa('0x2'));var jsonpatch=require(_0xacfa('0x3'));var rp=require('request-promise');var moment=require(_0xacfa('0x4'));var BPromise=require(_0xacfa('0x5'));var Mustache=require(_0xacfa('0x6'));var util=require(_0xacfa('0x7'));var path=require('path');var sox=require(_0xacfa('0x8'));var csv=require(_0xacfa('0x9'));var ejs=require(_0xacfa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacfa('0xb'));var squel=require('squel');var crypto=require(_0xacfa('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xacfa('0x9'));var querystring=require(_0xacfa('0xd'));var Papa=require(_0xacfa('0xe'));var Redis=require(_0xacfa('0xf'));var authService=require(_0xacfa('0x10'));var qs=require(_0xacfa('0x11'));var as=require(_0xacfa('0x12'));var hardwareService=require(_0xacfa('0x13'));var logger=require(_0xacfa('0x14'))(_0xacfa('0x15'));var utils=require(_0xacfa('0x16'));var config=require(_0xacfa('0x17'));var licenseUtil=require(_0xacfa('0x18'));var db=require(_0xacfa('0x19'))['db'];function respondWithStatusCode(_0x59de97,_0x5290b0){_0x5290b0=_0x5290b0||0xcc;return function(_0x18430b){if(_0x18430b){return _0x59de97[_0xacfa('0x1a')](_0x5290b0);}return _0x59de97[_0xacfa('0x1b')](_0x5290b0)[_0xacfa('0x1c')]();};}function respondWithResult(_0x22e5d0,_0x8e22b){_0x8e22b=_0x8e22b||0xc8;return function(_0x42d0a9){if(_0x42d0a9){return _0x22e5d0[_0xacfa('0x1b')](_0x8e22b)[_0xacfa('0x1d')](_0x42d0a9);}};}function respondWithFilteredResult(_0x10082c,_0x3cc6b3){return function(_0x955dfe){if(_0x955dfe){var _0x5bdea5=typeof _0x3cc6b3[_0xacfa('0x1e')]===_0xacfa('0x1f')&&typeof _0x3cc6b3[_0xacfa('0x20')]===_0xacfa('0x1f');var _0x30e9fb=_0x955dfe[_0xacfa('0x21')];var _0x3a8f1f=_0x5bdea5?0x0:_0x3cc6b3['offset'];var _0x154f40=_0x5bdea5?_0x955dfe[_0xacfa('0x21')]:_0x3cc6b3['offset']+_0x3cc6b3[_0xacfa('0x20')];var _0x307940;if(_0x154f40>=_0x30e9fb){_0x154f40=_0x30e9fb;_0x307940=0xc8;}else{_0x307940=0xce;}_0x10082c[_0xacfa('0x1b')](_0x307940);return _0x10082c[_0xacfa('0x22')](_0xacfa('0x23'),_0x3a8f1f+'-'+_0x154f40+'/'+_0x30e9fb)[_0xacfa('0x1d')](_0x955dfe);}return null;};}function patchUpdates(_0x48de70){return function(_0x39c8bf){try{jsonpatch['apply'](_0x39c8bf,_0x48de70,!![]);}catch(_0x51e052){return BPromise[_0xacfa('0x24')](_0x51e052);}return _0x39c8bf['save']();};}function saveUpdates(_0x182dd9,_0x3c1859){return function(_0x4d3ce6){if(_0x4d3ce6){return _0x4d3ce6[_0xacfa('0x25')](_0x182dd9)[_0xacfa('0x26')](function(_0x5b2f97){return _0x5b2f97;});}return null;};}function removeEntity(_0x5d2f59,_0x5584a1){return function(_0x3f179b){if(_0x3f179b){return _0x3f179b[_0xacfa('0x27')]()[_0xacfa('0x26')](function(){_0x5d2f59[_0xacfa('0x1b')](0xcc)[_0xacfa('0x1c')]();});}};}function handleEntityNotFound(_0x1a5f37,_0x377439){return function(_0x3e8dda){if(!_0x3e8dda){_0x1a5f37['sendStatus'](0x194);}return _0x3e8dda;};}function handleError(_0x1e395c,_0x504694){_0x504694=_0x504694||0x1f4;return function(_0x47d30b){logger[_0xacfa('0x28')](_0x47d30b[_0xacfa('0x29')]);if(_0x47d30b[_0xacfa('0x2a')]){delete _0x47d30b[_0xacfa('0x2a')];}_0x1e395c[_0xacfa('0x1b')](_0x504694)[_0xacfa('0x2b')](_0x47d30b);};}exports[_0xacfa('0x2c')]=function(_0x36e1fe,_0xf328d3){var _0x4c2e9e={},_0x51b60e={},_0x529ae6={'count':0x0,'rows':[]};var _0x50be15=_[_0xacfa('0x2d')](db[_0xacfa('0x2e')][_0xacfa('0x2f')],function(_0x336855){return{'name':_0x336855[_0xacfa('0x30')],'type':_0x336855[_0xacfa('0x31')][_0xacfa('0x32')]};});_0x51b60e[_0xacfa('0x33')]=_[_0xacfa('0x2d')](_0x50be15,_0xacfa('0x2a'));_0x51b60e['query']=_[_0xacfa('0x34')](_0x36e1fe[_0xacfa('0x35')]);_0x51b60e[_0xacfa('0x36')]=_[_0xacfa('0x37')](_0x51b60e[_0xacfa('0x33')],_0x51b60e[_0xacfa('0x35')]);_0x4c2e9e[_0xacfa('0x38')]=_[_0xacfa('0x37')](_0x51b60e[_0xacfa('0x33')],qs[_0xacfa('0x39')](_0x36e1fe[_0xacfa('0x35')][_0xacfa('0x39')]));_0x4c2e9e[_0xacfa('0x38')]=_0x4c2e9e[_0xacfa('0x38')][_0xacfa('0x3a')]?_0x4c2e9e[_0xacfa('0x38')]:_0x51b60e[_0xacfa('0x33')];if(!_0x36e1fe[_0xacfa('0x35')][_0xacfa('0x3b')](_0xacfa('0x3c'))){_0x4c2e9e[_0xacfa('0x20')]=qs[_0xacfa('0x20')](_0x36e1fe[_0xacfa('0x35')][_0xacfa('0x20')]);_0x4c2e9e[_0xacfa('0x1e')]=qs['offset'](_0x36e1fe[_0xacfa('0x35')]['offset']);}_0x4c2e9e['order']=qs['sort'](_0x36e1fe[_0xacfa('0x35')][_0xacfa('0x3d')]);_0x4c2e9e[_0xacfa('0x3e')]=qs[_0xacfa('0x36')](_[_0xacfa('0x3f')](_0x36e1fe[_0xacfa('0x35')],_0x51b60e['filters']),_0x50be15);if(_0x36e1fe[_0xacfa('0x35')][_0xacfa('0x40')]){_0x4c2e9e['where']=_[_0xacfa('0x41')](_0x4c2e9e[_0xacfa('0x3e')],{'$or':_[_0xacfa('0x2d')](_0x50be15,function(_0x3b8cc3){if(_0x3b8cc3['type']!=='VIRTUAL'){var _0x57ff0d={};_0x57ff0d[_0x3b8cc3[_0xacfa('0x2a')]]={'$like':'%'+_0x36e1fe[_0xacfa('0x35')]['filter']+'%'};return _0x57ff0d;}})});}_0x4c2e9e=_[_0xacfa('0x41')]({},_0x4c2e9e,_0x36e1fe[_0xacfa('0x42')]);var _0xfba2e8={'where':_0x4c2e9e[_0xacfa('0x3e')]};return db[_0xacfa('0x2e')]['count'](_0xfba2e8)['then'](function(_0x459383){_0x529ae6[_0xacfa('0x21')]=_0x459383;if(_0x36e1fe[_0xacfa('0x35')][_0xacfa('0x43')]){_0x4c2e9e[_0xacfa('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4c2e9e);})['then'](function(_0x34deec){_0x529ae6[_0xacfa('0x45')]=_0x34deec;return _0x529ae6;})[_0xacfa('0x26')](respondWithFilteredResult(_0xf328d3,_0x4c2e9e))['catch'](handleError(_0xf328d3,null));};exports[_0xacfa('0x46')]=function(_0x298b7e,_0x5d9f4a){var _0x34e699={'raw':!![],'where':{'id':_0x298b7e[_0xacfa('0x47')]['id']}},_0x550a31={};_0x550a31[_0xacfa('0x33')]=_[_0xacfa('0x34')](db[_0xacfa('0x2e')][_0xacfa('0x2f')]);_0x550a31[_0xacfa('0x35')]=_['keys'](_0x298b7e[_0xacfa('0x35')]);_0x550a31[_0xacfa('0x36')]=_[_0xacfa('0x37')](_0x550a31[_0xacfa('0x33')],_0x550a31[_0xacfa('0x35')]);_0x34e699['attributes']=_[_0xacfa('0x37')](_0x550a31['model'],qs[_0xacfa('0x39')](_0x298b7e['query'][_0xacfa('0x39')]));_0x34e699[_0xacfa('0x38')]=_0x34e699[_0xacfa('0x38')][_0xacfa('0x3a')]?_0x34e699[_0xacfa('0x38')]:_0x550a31[_0xacfa('0x33')];if(_0x298b7e[_0xacfa('0x35')][_0xacfa('0x43')]){_0x34e699[_0xacfa('0x44')]=[{'all':!![]}];}_0x34e699=_[_0xacfa('0x41')]({},_0x34e699,_0x298b7e['options']);return db[_0xacfa('0x2e')][_0xacfa('0x48')](_0x34e699)[_0xacfa('0x26')](handleEntityNotFound(_0x5d9f4a,null))['then'](respondWithResult(_0x5d9f4a,null))[_0xacfa('0x49')](handleError(_0x5d9f4a,null));};exports['create']=function(_0x9eb858,_0x1cda44){return db[_0xacfa('0x2e')]['create'](_0x9eb858[_0xacfa('0x4a')],{})[_0xacfa('0x26')](respondWithResult(_0x1cda44,0xc9))[_0xacfa('0x49')](handleError(_0x1cda44,null));};exports['update']=function(_0x305b9c,_0x46eec3){if(_0x305b9c[_0xacfa('0x4a')]['id']){delete _0x305b9c[_0xacfa('0x4a')]['id'];}return db[_0xacfa('0x2e')][_0xacfa('0x48')]({'where':{'id':_0x305b9c['params']['id']}})[_0xacfa('0x26')](handleEntityNotFound(_0x46eec3,null))['then'](saveUpdates(_0x305b9c[_0xacfa('0x4a')],null))['then'](respondWithResult(_0x46eec3,null))[_0xacfa('0x49')](handleError(_0x46eec3,null));};exports[_0xacfa('0x27')]=function(_0x488fbc,_0x2ea58f){return db[_0xacfa('0x2e')]['find']({'where':{'id':_0x488fbc[_0xacfa('0x47')]['id']}})[_0xacfa('0x26')](handleEntityNotFound(_0x2ea58f,null))[_0xacfa('0x26')](removeEntity(_0x2ea58f,null))[_0xacfa('0x49')](handleError(_0x2ea58f,null));};exports[_0xacfa('0x4b')]=function(_0x5be7d4,_0x268978){return db[_0xacfa('0x2e')]['describe']()[_0xacfa('0x26')](respondWithResult(_0x268978,null))[_0xacfa('0x49')](handleError(_0x268978,null));};exports['getQuestions']=function(_0x2dceb8,_0x50d864,_0x1c5068){var _0x182b89={'raw':!![],'where':{}};var _0x1a7d25={};var _0x7a123b={'count':0x0,'rows':[]};return db[_0xacfa('0x2e')][_0xacfa('0x4c')]({'where':{'id':_0x2dceb8[_0xacfa('0x47')]['id']}})[_0xacfa('0x26')](handleEntityNotFound(_0x50d864,null))['then'](function(_0x1d5db2){if(_0x1d5db2){_0x1a7d25['model']=_[_0xacfa('0x34')](db[_0xacfa('0x4d')][_0xacfa('0x2f')]);_0x1a7d25[_0xacfa('0x35')]=_[_0xacfa('0x34')](_0x2dceb8[_0xacfa('0x35')]);_0x1a7d25[_0xacfa('0x36')]=_['intersection'](_0x1a7d25[_0xacfa('0x33')],_0x1a7d25[_0xacfa('0x35')]);_0x182b89[_0xacfa('0x38')]=_['intersection'](_0x1a7d25[_0xacfa('0x33')],qs[_0xacfa('0x39')](_0x2dceb8[_0xacfa('0x35')][_0xacfa('0x39')]));_0x182b89[_0xacfa('0x38')]=_0x182b89['attributes'][_0xacfa('0x3a')]?_0x182b89[_0xacfa('0x38')]:_0x1a7d25[_0xacfa('0x33')];if(!_0x2dceb8[_0xacfa('0x35')][_0xacfa('0x3b')](_0xacfa('0x3c'))){_0x182b89[_0xacfa('0x20')]=qs['limit'](_0x2dceb8['query'][_0xacfa('0x20')]);_0x182b89['offset']=qs[_0xacfa('0x1e')](_0x2dceb8[_0xacfa('0x35')][_0xacfa('0x1e')]);}_0x182b89[_0xacfa('0x4e')]=qs[_0xacfa('0x3d')](_0x2dceb8[_0xacfa('0x35')][_0xacfa('0x3d')]);_0x182b89['where']=qs[_0xacfa('0x36')](_[_0xacfa('0x3f')](_0x2dceb8[_0xacfa('0x35')],_0x1a7d25[_0xacfa('0x36')]));_0x182b89['where'][_0xacfa('0x4f')]=_0x1d5db2['id'];if(_0x2dceb8['query']['filter']){_0x182b89[_0xacfa('0x3e')]=_[_0xacfa('0x41')](_0x182b89[_0xacfa('0x3e')],{'$or':_[_0xacfa('0x2d')](_0x182b89[_0xacfa('0x38')],function(_0x17cef7){var _0x44941c={};_0x44941c[_0x17cef7]={'$like':'%'+_0x2dceb8[_0xacfa('0x35')][_0xacfa('0x40')]+'%'};return _0x44941c;})});}_0x182b89=_[_0xacfa('0x41')]({},_0x182b89,_0x2dceb8[_0xacfa('0x42')]);return db['JscriptyQuestionReport'][_0xacfa('0x21')]({'where':_0x182b89['where']})[_0xacfa('0x26')](function(_0x458ef1){_0x7a123b['count']=_0x458ef1;if(_0x2dceb8[_0xacfa('0x35')][_0xacfa('0x43')]){_0x182b89[_0xacfa('0x44')]=[{'all':!![]}];}return db[_0xacfa('0x4d')][_0xacfa('0x50')](_0x182b89);})['then'](function(_0x5bca5e){_0x7a123b[_0xacfa('0x45')]=_0x5bca5e;return _0x7a123b;});}})[_0xacfa('0x26')](respondWithFilteredResult(_0x50d864,_0x182b89))[_0xacfa('0x49')](handleError(_0x50d864,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2b7cd01..829a18a 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 _0x81c6=['JscriptySessionReport','util','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x1a1dd5,_0x5038e2){var _0x810dd4=function(_0x2357aa){while(--_0x2357aa){_0x1a1dd5['push'](_0x1a1dd5['shift']());}};_0x810dd4(++_0x5038e2);}(_0x81c6,0x1d5));var _0x681c=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0x81c6[_0x3da707];return _0x342ee7;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2a9404,_0x4e556b){_0x2a9404=_0x2a9404-0x0;var _0x39bec4=_0xb4c7[_0x2a9404];return _0x39bec4;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d1f2efa..285f6c5 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 _0x0a6b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','randomstring'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x493ac1,_0x10e2d8){_0x493ac1=_0x493ac1-0x0;var _0x4ee674=_0x0a6b[_0x493ac1];return _0x4ee674;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('JscriptySessionReport,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});} \ No newline at end of file +var _0x430c=['then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0x430c,0x1a1));var _0xc430=function(_0x802997,_0x5534a2){_0x802997=_0x802997-0x0;var _0x35c641=_0x430c[_0x802997];return _0x35c641;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c806d83..d0b73b2 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 _0xea89=['get','index','put','/:id','isAuthenticated','update','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./license.controller'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xea89,0x1e2));var _0x9ea8=function(_0x36d4ec,_0x49afed){_0x36d4ec=_0x36d4ec-0x0;var _0x22addd=_0xea89[_0x36d4ec];return _0x22addd;};'use strict';var multer=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var path=require(_0x9ea8('0x2'));var timeout=require(_0x9ea8('0x3'));var express=require(_0x9ea8('0x4'));var router=express['Router']();var fs_extra=require(_0x9ea8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ea8('0x6'));var config=require('../../config/environment');var controller=require(_0x9ea8('0x7'));router[_0x9ea8('0x8')]('/',controller[_0x9ea8('0x9')]);router[_0x9ea8('0xa')](_0x9ea8('0xb'),auth[_0x9ea8('0xc')](),controller[_0x9ea8('0xd')]);module['exports']=router; \ No newline at end of file +var _0xed08=['./license.controller','get','index','/:id','isAuthenticated','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xed08,0x67));var _0x8ed0=function(_0x26e602,_0x379571){_0x26e602=_0x26e602-0x0;var _0x5244e1=_0xed08[_0x26e602];return _0x5244e1;};'use strict';var multer=require('multer');var util=require(_0x8ed0('0x0'));var path=require(_0x8ed0('0x1'));var timeout=require(_0x8ed0('0x2'));var express=require(_0x8ed0('0x3'));var router=express[_0x8ed0('0x4')]();var fs_extra=require(_0x8ed0('0x5'));var auth=require(_0x8ed0('0x6'));var interaction=require(_0x8ed0('0x7'));var config=require(_0x8ed0('0x8'));var controller=require(_0x8ed0('0x9'));router[_0x8ed0('0xa')]('/',controller[_0x8ed0('0xb')]);router['put'](_0x8ed0('0xc'),auth[_0x8ed0('0xd')](),controller[_0x8ed0('0xe')]);module[_0x8ed0('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6935726..fe43f27 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 _0xe780=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x32f9b8,_0x5ad72){var _0x156002=function(_0x3dedc9){while(--_0x3dedc9){_0x32f9b8['push'](_0x32f9b8['shift']());}};_0x156002(++_0x5ad72);}(_0xe780,0x1d2));var _0x0e78=function(_0x562af0,_0x59f1c8){_0x562af0=_0x562af0-0x0;var _0x43c756=_0xe780[_0x562af0];return _0x43c756;};'use strict';var Sequelize=require(_0x0e78('0x0'));module[_0x0e78('0x1')]={'license':{'type':Sequelize[_0x0e78('0x2')]},'data1':{'type':Sequelize[_0x0e78('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x0e78('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa495=['INTEGER','sequelize','TEXT','STRING'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa495,0x99));var _0x5a49=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0xa495[_0x41582d];return _0x59c504;};'use strict';var Sequelize=require(_0x5a49('0x0'));module['exports']={'license':{'type':Sequelize[_0x5a49('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5a49('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x5a49('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 6d017c4..f4aa237 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 _0x1967=['params','checkLicense','key','demo','catch','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','index','model','keys','rawAttributes','query','intersection','attributes','fields','merge','getLicense','body','find'];(function(_0x1bd1d4,_0x23f408){var _0x1a828c=function(_0x43cd9c){while(--_0x43cd9c){_0x1bd1d4['push'](_0x1bd1d4['shift']());}};_0x1a828c(++_0x23f408);}(_0x1967,0x173));var _0x7196=function(_0x2b15d8,_0x2d3431){_0x2b15d8=_0x2b15d8-0x0;var _0x5e141c=_0x1967[_0x2b15d8];return _0x5e141c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}var utilLicense=require('../../config/license/util');exports[_0x7196('0x2c')]=function(_0x4ecea1,_0x4fd339){var _0x59d79d={'raw':!![],'where':{'id':0x1}},_0x30151f={};_0x30151f[_0x7196('0x2d')]=_[_0x7196('0x2e')](db['License'][_0x7196('0x2f')]);_0x30151f[_0x7196('0x30')]=_[_0x7196('0x2e')](_0x4ecea1[_0x7196('0x30')]);_0x30151f['filters']=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],_0x30151f[_0x7196('0x30')]);_0x59d79d[_0x7196('0x32')]=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],qs[_0x7196('0x33')](_0x4ecea1[_0x7196('0x30')][_0x7196('0x33')]));_0x59d79d[_0x7196('0x32')]=_0x59d79d[_0x7196('0x32')]['length']?_0x59d79d[_0x7196('0x32')]:_0x30151f['model'];_0x59d79d=_[_0x7196('0x34')]({},_0x59d79d,_0x4ecea1['options']);return utilLicense[_0x7196('0x35')](_0x59d79d)[_0x7196('0x27')](respondWithResult(_0x4fd339,null))['catch'](handleError(_0x4fd339,null));};exports[_0x7196('0x26')]=function(_0x2bcadd,_0x4531d7){if(_0x2bcadd[_0x7196('0x36')]['id']){delete _0x2bcadd[_0x7196('0x36')]['id'];}return db['License'][_0x7196('0x37')]({'where':{'id':_0x2bcadd[_0x7196('0x38')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x4531d7,null))[_0x7196('0x27')](function(_0x3e8f98){var _0x123cad=_0x3e8f98['get']({'plain':!![]});return utilLicense[_0x7196('0x39')](_0x123cad,_0x2bcadd[_0x7196('0x36')][_0x7196('0x3a')]);})['then'](function(_0x33831a){if(!_0x33831a[_0x7196('0x3b')]){return saveUpdates(_0x2bcadd[_0x7196('0x36')],null);}return _0x33831a;})[_0x7196('0x27')](respondWithResult(_0x4531d7,null))[_0x7196('0x3c')](handleError(_0x4531d7,null));}; \ No newline at end of file +var _0xc4aa=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 908604c..180851e 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 _0x1e31=['../../config/environment','./license.attributes','exports','define','License','license','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x1df823,_0x2e5839){var _0x5528f2=function(_0x4aec36){while(--_0x4aec36){_0x1df823['push'](_0x1df823['shift']());}};_0x5528f2(++_0x2e5839);}(_0x1e31,0x10a));var _0x11e3=function(_0x2f1fce,_0x41bf9e){_0x2f1fce=_0x2f1fce-0x0;var _0x2ea4f4=_0x1e31[_0x2f1fce];return _0x2ea4f4;};'use strict';var _=require(_0x11e3('0x0'));var util=require(_0x11e3('0x1'));var logger=require('../../config/logger')(_0x11e3('0x2'));var moment=require('moment');var BPromise=require(_0x11e3('0x3'));var rp=require(_0x11e3('0x4'));var fs=require('fs');var path=require(_0x11e3('0x5'));var rimraf=require(_0x11e3('0x6'));var config=require(_0x11e3('0x7'));var attributes=require(_0x11e3('0x8'));module[_0x11e3('0x9')]=function(_0xb69f46,_0x180c5a){return _0xb69f46[_0x11e3('0xa')](_0x11e3('0xb'),attributes,{'tableName':_0x11e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x843b=['License','api','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x11e77e,_0x1c39d6){var _0x1bc83e=function(_0x47114f){while(--_0x47114f){_0x11e77e['push'](_0x11e77e['shift']());}};_0x1bc83e(++_0x1c39d6);}(_0x843b,0x199));var _0xb843=function(_0x1f4b56,_0x474f87){_0x1f4b56=_0x1f4b56-0x0;var _0x2bee98=_0x843b[_0x1f4b56];return _0x2bee98;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb843('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb843('0x1'));var fs=require('fs');var path=require(_0xb843('0x2'));var rimraf=require(_0xb843('0x3'));var config=require(_0xb843('0x4'));var attributes=require(_0xb843('0x5'));module[_0xb843('0x6')]=function(_0x12988b,_0x1c9135){return _0x12988b['define'](_0xb843('0x7'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 75e1ff2..0fdb8b5 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 _0xea92=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea92,0x154));var _0x2ea9=function(_0xad6aba,_0x3562bf){_0xad6aba=_0xad6aba-0x0;var _0x2b9c7e=_0xea92[_0xad6aba];return _0x2b9c7e;};'use strict';var _=require(_0x2ea9('0x0'));var util=require('util');var moment=require(_0x2ea9('0x1'));var BPromise=require(_0x2ea9('0x2'));var rs=require(_0x2ea9('0x3'));var fs=require('fs');var Redis=require(_0x2ea9('0x4'));var db=require(_0x2ea9('0x5'))['db'];var utils=require(_0x2ea9('0x6'));var logger=require('../../config/logger')(_0x2ea9('0x7'));var config=require(_0x2ea9('0x8'));var jayson=require(_0x2ea9('0x9'));var client=jayson['client'][_0x2ea9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c259b,_0x1b0aad,_0x4cc11d){return new BPromise(function(_0x5f3244,_0x4f7da5){return client[_0x2ea9('0xb')](_0x1c259b,_0x4cc11d)[_0x2ea9('0xc')](function(_0x5e42ed){logger[_0x2ea9('0xd')](_0x2ea9('0xe'),_0x1b0aad,_0x2ea9('0xf'));logger[_0x2ea9('0x10')](_0x2ea9('0x11'),_0x1b0aad,_0x2ea9('0xf'),JSON['stringify'](_0x5e42ed));if(_0x5e42ed[_0x2ea9('0x12')]){if(_0x5e42ed[_0x2ea9('0x12')][_0x2ea9('0x13')]===0x1f4){logger['error'](_0x2ea9('0xe'),_0x1b0aad,_0x5e42ed[_0x2ea9('0x12')][_0x2ea9('0x14')]);return _0x4f7da5(_0x5e42ed[_0x2ea9('0x12')][_0x2ea9('0x14')]);}logger['error'](_0x2ea9('0xe'),_0x1b0aad,_0x5e42ed[_0x2ea9('0x12')][_0x2ea9('0x14')]);return _0x5f3244(_0x5e42ed[_0x2ea9('0x12')]['message']);}else{logger[_0x2ea9('0xd')](_0x2ea9('0xe'),_0x1b0aad,_0x2ea9('0xf'));_0x5f3244(_0x5e42ed[_0x2ea9('0x15')][_0x2ea9('0x14')]);}})[_0x2ea9('0x16')](function(_0x146355){logger[_0x2ea9('0x12')](_0x2ea9('0xe'),_0x1b0aad,_0x146355);_0x4f7da5(_0x146355);});});} \ No newline at end of file +var _0xf3cd=['License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x4609b8,_0x222b6a){var _0x56b675=function(_0x4a9a60){while(--_0x4a9a60){_0x4609b8['push'](_0x4609b8['shift']());}};_0x56b675(++_0x222b6a);}(_0xf3cd,0x79));var _0xdf3c=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0xf3cd[_0x4cb095];return _0x2b565d;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require(_0xdf3c('0x6'))['db'];var utils=require(_0xdf3c('0x7'));var logger=require(_0xdf3c('0x8'))(_0xdf3c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39f880,_0x10b381,_0x51c730){return new BPromise(function(_0x3a4c1f,_0x40b8d8){return client[_0xdf3c('0xc')](_0x39f880,_0x51c730)[_0xdf3c('0xd')](function(_0x26a478){logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x10b381,_0xdf3c('0x10'));logger['debug'](_0xdf3c('0x11'),_0x10b381,_0xdf3c('0x10'),JSON[_0xdf3c('0x12')](_0x26a478));if(_0x26a478['error']){if(_0x26a478[_0xdf3c('0x13')][_0xdf3c('0x14')]===0x1f4){logger[_0xdf3c('0x13')]('License,\x20%s,\x20%s',_0x10b381,_0x26a478[_0xdf3c('0x13')]['message']);return _0x40b8d8(_0x26a478[_0xdf3c('0x13')][_0xdf3c('0x15')]);}logger['error']('License,\x20%s,\x20%s',_0x10b381,_0x26a478[_0xdf3c('0x13')][_0xdf3c('0x15')]);return _0x3a4c1f(_0x26a478[_0xdf3c('0x13')][_0xdf3c('0x15')]);}else{logger['info'](_0xdf3c('0xf'),_0x10b381,_0xdf3c('0x10'));_0x3a4c1f(_0x26a478['result'][_0xdf3c('0x15')]);}})[_0xdf3c('0x16')](function(_0x2790c4){logger['error'](_0xdf3c('0xf'),_0x10b381,_0x2790c4);_0x40b8d8(_0x2790c4);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 01a5e15..b3c677d 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 _0xc906=['update','removeDispositions','delete','removeSmtp','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','/:id/applications','getMessages','/:id/verify','verifySmtp','getAgents','post','/:id/canned_answers','addAnswer','create','addImap','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents'];(function(_0x46326d,_0x377200){var _0x80f0db=function(_0x590bff){while(--_0x590bff){_0x46326d['push'](_0x46326d['shift']());}};_0x80f0db(++_0x377200);}(_0xc906,0x1de));var _0x6c90=function(_0x4333d5,_0xb97fc6){_0x4333d5=_0x4333d5-0x0;var _0x57ddd3=_0xc906[_0x4333d5];return _0x57ddd3;};'use strict';var multer=require(_0x6c90('0x0'));var util=require(_0x6c90('0x1'));var path=require('path');var timeout=require(_0x6c90('0x2'));var express=require(_0x6c90('0x3'));var router=express[_0x6c90('0x4')]();var fs_extra=require(_0x6c90('0x5'));var auth=require(_0x6c90('0x6'));var interaction=require(_0x6c90('0x7'));var config=require(_0x6c90('0x8'));var controller=require(_0x6c90('0x9'));router[_0x6c90('0xa')]('/',auth[_0x6c90('0xb')](),controller['index']);router[_0x6c90('0xa')](_0x6c90('0xc'),auth['isAuthenticated'](),controller[_0x6c90('0xd')]);router[_0x6c90('0xa')](_0x6c90('0xe'),auth[_0x6c90('0xb')](),controller[_0x6c90('0xf')]);router[_0x6c90('0xa')](_0x6c90('0x10'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x11')]);router[_0x6c90('0xa')]('/:id/canned_answers',auth[_0x6c90('0xb')](),controller['getAnswers']);router[_0x6c90('0xa')](_0x6c90('0x12'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x13')]);router[_0x6c90('0xa')](_0x6c90('0x14'),auth['isAuthenticated'](),controller['getSmtp']);router[_0x6c90('0xa')]('/:id/interactions',auth[_0x6c90('0xb')](),controller['getInteractions']);router[_0x6c90('0xa')](_0x6c90('0x15'),auth[_0x6c90('0xb')](),controller['getApplications']);router[_0x6c90('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6c90('0x16')]);router[_0x6c90('0xa')](_0x6c90('0x17'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x18')]);router[_0x6c90('0xa')]('/:id/users',auth[_0x6c90('0xb')](),controller[_0x6c90('0x19')]);router[_0x6c90('0x1a')]('/:id/dispositions',auth[_0x6c90('0xb')](),controller['addDisposition']);router[_0x6c90('0x1a')](_0x6c90('0x1b'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x1c')]);router[_0x6c90('0x1a')]('/',auth[_0x6c90('0xb')](),controller[_0x6c90('0x1d')]);router[_0x6c90('0x1a')](_0x6c90('0x12'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x1e')]);router[_0x6c90('0x1a')](_0x6c90('0x14'),auth[_0x6c90('0xb')](),controller['addSmtp']);router[_0x6c90('0x1a')](_0x6c90('0x1f'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x20')]);router[_0x6c90('0x1a')](_0x6c90('0x15'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x21')]);router[_0x6c90('0x1a')](_0x6c90('0x22'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x23')]);router[_0x6c90('0x1a')](_0x6c90('0x24'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x25')]);router['put'](_0x6c90('0xe'),auth['isAuthenticated'](),controller[_0x6c90('0x26')]);router['delete'](_0x6c90('0x10'),auth[_0x6c90('0xb')](),controller[_0x6c90('0x27')]);router[_0x6c90('0x28')]('/:id/canned_answers',auth[_0x6c90('0xb')](),controller['removeAnswers']);router[_0x6c90('0x28')](_0x6c90('0x12'),auth[_0x6c90('0xb')](),controller['removeImap']);router[_0x6c90('0x28')](_0x6c90('0x14'),auth['isAuthenticated'](),controller[_0x6c90('0x29')]);router[_0x6c90('0x28')](_0x6c90('0xe'),auth['isAuthenticated'](),controller[_0x6c90('0x2a')]);router[_0x6c90('0x28')](_0x6c90('0x24'),auth[_0x6c90('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x920d=['destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/send','addAgents','update','delete','removeAnswers','removeImap'];(function(_0x3243de,_0x198e57){var _0x29d80c=function(_0x144998){while(--_0x144998){_0x3243de['push'](_0x3243de['shift']());}};_0x29d80c(++_0x198e57);}(_0x920d,0x19b));var _0xd920=function(_0x597a77,_0x36501d){_0x597a77=_0x597a77-0x0;var _0x28259a=_0x920d[_0x597a77];return _0x28259a;};'use strict';var multer=require('multer');var util=require(_0xd920('0x0'));var path=require(_0xd920('0x1'));var timeout=require('connect-timeout');var express=require(_0xd920('0x2'));var router=express[_0xd920('0x3')]();var fs_extra=require(_0xd920('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd920('0x5'));var config=require(_0xd920('0x6'));var controller=require('./mailAccount.controller');router[_0xd920('0x7')]('/',auth[_0xd920('0x8')](),controller[_0xd920('0x9')]);router['get'](_0xd920('0xa'),auth['isAuthenticated'](),controller[_0xd920('0xb')]);router[_0xd920('0x7')](_0xd920('0xc'),auth[_0xd920('0x8')](),controller[_0xd920('0xd')]);router[_0xd920('0x7')](_0xd920('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xd920('0x7')](_0xd920('0xf'),auth[_0xd920('0x8')](),controller[_0xd920('0x10')]);router['get'](_0xd920('0x11'),auth['isAuthenticated'](),controller['getImap']);router[_0xd920('0x7')](_0xd920('0x12'),auth[_0xd920('0x8')](),controller[_0xd920('0x13')]);router[_0xd920('0x7')](_0xd920('0x14'),auth[_0xd920('0x8')](),controller[_0xd920('0x15')]);router[_0xd920('0x7')](_0xd920('0x16'),auth[_0xd920('0x8')](),controller[_0xd920('0x17')]);router[_0xd920('0x7')](_0xd920('0x18'),auth[_0xd920('0x8')](),controller[_0xd920('0x19')]);router[_0xd920('0x7')]('/:id/verify',auth[_0xd920('0x8')](),controller['verifySmtp']);router[_0xd920('0x7')](_0xd920('0x1a'),auth[_0xd920('0x8')](),controller[_0xd920('0x1b')]);router[_0xd920('0x1c')](_0xd920('0xe'),auth[_0xd920('0x8')](),controller[_0xd920('0x1d')]);router['post'](_0xd920('0xf'),auth[_0xd920('0x8')](),controller[_0xd920('0x1e')]);router[_0xd920('0x1c')]('/',auth[_0xd920('0x8')](),controller[_0xd920('0x1f')]);router[_0xd920('0x1c')](_0xd920('0x11'),auth['isAuthenticated'](),controller[_0xd920('0x20')]);router[_0xd920('0x1c')]('/:id/out_servers',auth[_0xd920('0x8')](),controller[_0xd920('0x21')]);router[_0xd920('0x1c')]('/:id/interactions',auth[_0xd920('0x8')](),controller['addInteraction']);router[_0xd920('0x1c')](_0xd920('0x16'),auth[_0xd920('0x8')](),controller['addApplications']);router['post'](_0xd920('0x22'),auth[_0xd920('0x8')](),controller['send']);router[_0xd920('0x1c')](_0xd920('0x1a'),auth[_0xd920('0x8')](),controller[_0xd920('0x23')]);router['put'](_0xd920('0xc'),auth[_0xd920('0x8')](),controller[_0xd920('0x24')]);router[_0xd920('0x25')]('/:id/dispositions',auth[_0xd920('0x8')](),controller['removeDispositions']);router['delete'](_0xd920('0xf'),auth[_0xd920('0x8')](),controller[_0xd920('0x26')]);router[_0xd920('0x25')](_0xd920('0x11'),auth['isAuthenticated'](),controller[_0xd920('0x27')]);router[_0xd920('0x25')](_0xd920('0x12'),auth[_0xd920('0x8')](),controller['removeSmtp']);router['delete'](_0xd920('0xc'),auth['isAuthenticated'](),controller[_0xd920('0x28')]);router[_0xd920('0x25')](_0xd920('0x1a'),auth[_0xd920('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 89d2afd..8fee897 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 _0x0a12=['BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','TEXT'];(function(_0x482fc8,_0x4d40ce){var _0x1ba080=function(_0x54a809){while(--_0x54a809){_0x482fc8['push'](_0x482fc8['shift']());}};_0x1ba080(++_0x4d40ce);}(_0x0a12,0xb8));var _0x20a1=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x0a12[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require('sequelize');module[_0x20a1('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x20a1('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x20a1('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x20a1('0x2')]},'markAsUnread':{'type':Sequelize[_0x20a1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x20a1('0x1')],'allowNull':![],'defaultValue':_0x20a1('0x4')},'fontSize':{'type':Sequelize[_0x20a1('0x5')](0x2)[_0x20a1('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x20a1('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x20a1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x20a1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x20a1('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20a1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20a1('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x20a1('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x20a1('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3552e4){if(!_0x3552e4)this[_0x20a1('0x8')](_0x20a1('0x9'),null);this[_0x20a1('0x8')](_0x20a1('0xa'),_0x3552e4);}}}; \ No newline at end of file +var _0x7b27=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0x7b27,0x186));var _0x77b2=function(_0x2639f0,_0xe7536){_0x2639f0=_0x2639f0-0x0;var _0x30aa7a=_0x7b27[_0x2639f0];return _0x30aa7a;};'use strict';var Sequelize=require(_0x77b2('0x0'));module['exports']={'description':{'type':Sequelize[_0x77b2('0x1')]},'name':{'type':Sequelize[_0x77b2('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x77b2('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x77b2('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x77b2('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x77b2('0x1')],'allowNull':![],'defaultValue':_0x77b2('0x4')},'fontSize':{'type':Sequelize[_0x77b2('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x77b2('0x3')],'defaultValue':function(){return _0x77b2('0x6');}},'notificationSound':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x77b2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x77b2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x77b2('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x77b2('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x77b2('0x2')],'defaultValue':![],'comment':_0x77b2('0x8'),'set':function(_0x5ddcf6){if(!_0x5ddcf6)this[_0x77b2('0x9')](_0x77b2('0xa'),null);this['setDataValue'](_0x77b2('0xb'),_0x5ddcf6);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ae409e0..180ce2a 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 _0x6c88=['user','cuser','password','pass','cpassword','host','port','MailServerOut','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','Contacts','DESC','email','attachments','root','server/files/attachments','service','secure','auth','SendMail','List\x20not\x20found','CmContact','messageId','from','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','name','send','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','MailAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','cservice'];(function(_0x5f3be6,_0x311a8a){var _0x3ff93a=function(_0x1cc5f0){while(--_0x1cc5f0){_0x5f3be6['push'](_0x5f3be6['shift']());}};_0x3ff93a(++_0x311a8a);}(_0x6c88,0x11b));var _0x86c8=function(_0x117b82,_0x13554b){_0x117b82=_0x117b82-0x0;var _0x3a8975=_0x6c88[_0x117b82];return _0x3a8975;};'use strict';var emlformat=require(_0x86c8('0x0'));var rimraf=require(_0x86c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86c8('0x2'));var rp=require(_0x86c8('0x3'));var moment=require('moment');var BPromise=require(_0x86c8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86c8('0x5'));var sox=require(_0x86c8('0x6'));var csv=require(_0x86c8('0x7'));var ejs=require(_0x86c8('0x8'));var fs=require('fs');var fs_extra=require(_0x86c8('0x9'));var _=require(_0x86c8('0xa'));var squel=require(_0x86c8('0xb'));var crypto=require(_0x86c8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x86c8('0xd'));var toCsv=require(_0x86c8('0x7'));var querystring=require(_0x86c8('0xe'));var Papa=require(_0x86c8('0xf'));var htmlToText=require(_0x86c8('0x10'));var juice=require(_0x86c8('0x11'));var Redis=require(_0x86c8('0x12'));var authService=require(_0x86c8('0x13'));var qs=require(_0x86c8('0x14'));var as=require(_0x86c8('0x15'));var hardwareService=require(_0x86c8('0x16'));var logger=require('../../config/logger')(_0x86c8('0x17'));var utils=require(_0x86c8('0x18'));var config=require(_0x86c8('0x19'));var licenseUtil=require(_0x86c8('0x1a'));var db=require(_0x86c8('0x1b'))['db'];config['redis']=_[_0x86c8('0x1c')](config[_0x86c8('0x1d')],{'host':_0x86c8('0x1e'),'port':0x18eb});var socket=require(_0x86c8('0x1f'))(new Redis(config[_0x86c8('0x1d')]));require(_0x86c8('0x20'))[_0x86c8('0x21')](socket);var jayson=require(_0x86c8('0x22'));var client=jayson['client'][_0x86c8('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x1497d4,_0x1cebe9,_0x3c1e32,_0x32b6af){return new BPromise(function(_0xfd2ca5,_0x537285){var _0x36b59b=_0x32b6af||client;return _0x36b59b[_0x86c8('0x24')](_0x1497d4,_0x3c1e32)[_0x86c8('0x25')](function(_0x15ab13){logger['info'](_0x86c8('0x26'),_0x1cebe9,_0x86c8('0x27'));logger[_0x86c8('0x28')](_0x86c8('0x29'),_0x1cebe9,_0x86c8('0x27'),JSON[_0x86c8('0x2a')](_0x15ab13));if(_0x15ab13[_0x86c8('0x2b')]){if(_0x15ab13[_0x86c8('0x2b')]['code']===0x1f4){logger[_0x86c8('0x2b')]('MailAccount,\x20%s,\x20%s',_0x1cebe9,_0x15ab13['error']['message']);return _0x537285(_0x15ab13[_0x86c8('0x2b')][_0x86c8('0x2c')]);}logger[_0x86c8('0x2b')]('MailAccount,\x20%s,\x20%s',_0x1cebe9,_0x15ab13[_0x86c8('0x2b')][_0x86c8('0x2c')]);return _0xfd2ca5(_0x15ab13[_0x86c8('0x2b')][_0x86c8('0x2c')]);}else{logger[_0x86c8('0x2d')](_0x86c8('0x26'),_0x1cebe9,_0x86c8('0x27'));_0xfd2ca5(_0x15ab13[_0x86c8('0x2e')][_0x86c8('0x2c')]);}})[_0x86c8('0x2f')](function(_0x2220c6){logger[_0x86c8('0x2b')]('MailAccount,\x20%s,\x20%s',_0x1cebe9,_0x2220c6);_0x537285(_0x2220c6);});});}function respondWithStatusCode(_0x3bca04,_0x3f857d){_0x3f857d=_0x3f857d||0xcc;return function(_0x53c2c7){if(_0x53c2c7){return _0x3bca04[_0x86c8('0x30')](_0x3f857d);}return _0x3bca04[_0x86c8('0x31')](_0x3f857d)[_0x86c8('0x32')]();};}function respondWithResult(_0x9117ea,_0x12633b){_0x12633b=_0x12633b||0xc8;return function(_0x249c23){if(_0x249c23){return _0x9117ea[_0x86c8('0x31')](_0x12633b)['json'](_0x249c23);}};}function respondWithFilteredResult(_0x1b797f,_0x4c433f){return function(_0x1625dc){if(_0x1625dc){var _0x232007=typeof _0x4c433f[_0x86c8('0x33')]===_0x86c8('0x34')&&typeof _0x4c433f[_0x86c8('0x35')]===_0x86c8('0x34');var _0x2b4e78=_0x1625dc['count'];var _0x379446=_0x232007?0x0:_0x4c433f['offset'];var _0x20c502=_0x232007?_0x1625dc[_0x86c8('0x36')]:_0x4c433f[_0x86c8('0x33')]+_0x4c433f['limit'];var _0x9b77ac;if(_0x20c502>=_0x2b4e78){_0x20c502=_0x2b4e78;_0x9b77ac=0xc8;}else{_0x9b77ac=0xce;}_0x1b797f['status'](_0x9b77ac);return _0x1b797f[_0x86c8('0x37')](_0x86c8('0x38'),_0x379446+'-'+_0x20c502+'/'+_0x2b4e78)['json'](_0x1625dc);}return null;};}function patchUpdates(_0x2759b3){return function(_0x57ffda){try{jsonpatch[_0x86c8('0x39')](_0x57ffda,_0x2759b3,!![]);}catch(_0x7ba995){return BPromise[_0x86c8('0x3a')](_0x7ba995);}return _0x57ffda[_0x86c8('0x3b')]();};}function saveUpdates(_0x22f895,_0x4c1297){return function(_0x8092a1){if(_0x8092a1){return _0x8092a1[_0x86c8('0x3c')](_0x22f895)['then'](function(_0x4b74a1){return _0x4b74a1;});}return null;};}function removeEntity(_0x4be2c1,_0x1032b1){return function(_0x5853f4){if(_0x5853f4){return _0x5853f4['destroy']()[_0x86c8('0x25')](function(){var _0x2b80e5=_0x5853f4[_0x86c8('0x3d')]({'plain':!![]});var _0x1f80cd='MailAccounts';return db[_0x86c8('0x3e')][_0x86c8('0x3f')]({'where':{'type':_0x1f80cd,'resourceId':_0x2b80e5['id']}})['then'](function(){return _0x5853f4;});})['then'](function(){_0x4be2c1[_0x86c8('0x31')](0xcc)[_0x86c8('0x32')]();});}};}function handleEntityNotFound(_0x3bb010,_0x494d87){return function(_0x540763){if(!_0x540763){_0x3bb010[_0x86c8('0x30')](0x194);}return _0x540763;};}function handleError(_0x388480,_0x4259b6){_0x4259b6=_0x4259b6||0x1f4;return function(_0xa8f5c){logger[_0x86c8('0x2b')](_0xa8f5c['stack']);if(_0xa8f5c[_0x86c8('0x40')]){delete _0xa8f5c[_0x86c8('0x40')];}_0x388480[_0x86c8('0x31')](_0x4259b6)[_0x86c8('0x41')](_0xa8f5c);};}exports[_0x86c8('0x42')]=function(_0x141df3,_0x4da59a){var _0x387815={'include':[{'model':db[_0x86c8('0x43')],'as':_0x86c8('0x44')},{'model':db['MailServerOut'],'as':_0x86c8('0x45')},{'model':db['Pause'],'as':_0x86c8('0x46')}]},_0x4d833c={},_0x20c475={'count':0x0,'rows':[]};var _0x34baf6=_['map'](db[_0x86c8('0x47')]['rawAttributes'],function(_0x5a9000){return{'name':_0x5a9000[_0x86c8('0x48')],'type':_0x5a9000['type'][_0x86c8('0x49')]};});_0x4d833c[_0x86c8('0x4a')]=_[_0x86c8('0x4b')](_0x34baf6,'name');_0x4d833c[_0x86c8('0x4c')]=_[_0x86c8('0x4d')](_0x141df3[_0x86c8('0x4c')]);_0x4d833c[_0x86c8('0x4e')]=_[_0x86c8('0x4f')](_0x4d833c[_0x86c8('0x4a')],_0x4d833c[_0x86c8('0x4c')]);_0x387815[_0x86c8('0x50')]=_[_0x86c8('0x4f')](_0x4d833c[_0x86c8('0x4a')],qs['fields'](_0x141df3[_0x86c8('0x4c')][_0x86c8('0x51')]));_0x387815['attributes']=_0x387815[_0x86c8('0x50')][_0x86c8('0x52')]?_0x387815[_0x86c8('0x50')]:_0x4d833c['model'];if(!_0x141df3[_0x86c8('0x4c')][_0x86c8('0x53')](_0x86c8('0x54'))){_0x387815['limit']=qs[_0x86c8('0x35')](_0x141df3[_0x86c8('0x4c')]['limit']);_0x387815[_0x86c8('0x33')]=qs['offset'](_0x141df3[_0x86c8('0x4c')]['offset']);}_0x387815['order']=qs[_0x86c8('0x55')](_0x141df3['query'][_0x86c8('0x55')]);_0x387815['where']=qs[_0x86c8('0x4e')](_[_0x86c8('0x56')](_0x141df3[_0x86c8('0x4c')],_0x4d833c[_0x86c8('0x4e')]),_0x34baf6);if(_0x141df3[_0x86c8('0x4c')][_0x86c8('0x57')]){_0x387815['where']=_[_0x86c8('0x58')](_0x387815[_0x86c8('0x59')],{'$or':_['map'](_0x34baf6,function(_0x2f82e7){if(_0x2f82e7[_0x86c8('0x5a')]!==_0x86c8('0x5b')){var _0x2288c6={};_0x2288c6[_0x2f82e7[_0x86c8('0x40')]]={'$like':'%'+_0x141df3['query'][_0x86c8('0x57')]+'%'};return _0x2288c6;}})});}_0x387815=_['merge']({},_0x387815,_0x141df3[_0x86c8('0x5c')]);var _0x2cf410={'where':_0x387815[_0x86c8('0x59')]};return db[_0x86c8('0x47')][_0x86c8('0x36')](_0x2cf410)[_0x86c8('0x25')](function(_0x121c91){_0x20c475['count']=_0x121c91;if(_0x141df3[_0x86c8('0x4c')][_0x86c8('0x5d')]){_0x387815[_0x86c8('0x5e')]=[{'all':!![]}];}return db['MailAccount'][_0x86c8('0x5f')](_0x387815);})[_0x86c8('0x25')](function(_0x20a860){_0x20c475[_0x86c8('0x60')]=_0x20a860;return _0x20c475;})[_0x86c8('0x25')](respondWithFilteredResult(_0x4da59a,_0x387815))[_0x86c8('0x2f')](handleError(_0x4da59a,null));};exports['show']=function(_0xa4a7a3,_0x5a8505){var _0x323524={'raw':![],'where':{'id':_0xa4a7a3[_0x86c8('0x61')]['id']},'include':[{'model':db[_0x86c8('0x43')],'as':_0x86c8('0x44')},{'model':db['MailServerOut'],'as':_0x86c8('0x45')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x52ba8c={};_0x52ba8c[_0x86c8('0x4a')]=_['keys'](db['MailAccount'][_0x86c8('0x62')]);_0x52ba8c[_0x86c8('0x4c')]=_[_0x86c8('0x4d')](_0xa4a7a3[_0x86c8('0x4c')]);_0x52ba8c[_0x86c8('0x4e')]=_[_0x86c8('0x4f')](_0x52ba8c[_0x86c8('0x4a')],_0x52ba8c[_0x86c8('0x4c')]);_0x323524[_0x86c8('0x50')]=_['intersection'](_0x52ba8c[_0x86c8('0x4a')],qs[_0x86c8('0x51')](_0xa4a7a3['query'][_0x86c8('0x51')]));_0x323524[_0x86c8('0x50')]=_0x323524[_0x86c8('0x50')][_0x86c8('0x52')]?_0x323524[_0x86c8('0x50')]:_0x52ba8c['model'];if(_0xa4a7a3[_0x86c8('0x4c')][_0x86c8('0x5d')]){_0x323524['include']=[{'all':!![]}];}_0x323524=_[_0x86c8('0x58')]({},_0x323524,_0xa4a7a3['options']);return db[_0x86c8('0x47')][_0x86c8('0x63')](_0x323524)[_0x86c8('0x25')](handleEntityNotFound(_0x5a8505,null))[_0x86c8('0x25')](respondWithResult(_0x5a8505,null))[_0x86c8('0x2f')](handleError(_0x5a8505,null));};exports[_0x86c8('0x3c')]=function(_0x3f3159,_0x5e8f24){if(_0x3f3159['body']['id']){delete _0x3f3159['body']['id'];}return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x3f3159[_0x86c8('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x86c8('0x44')},{'model':db['MailServerOut'],'as':_0x86c8('0x45')},{'model':db['Pause'],'as':_0x86c8('0x46')}]})[_0x86c8('0x25')](handleEntityNotFound(_0x5e8f24,null))[_0x86c8('0x25')](saveUpdates(_0x3f3159[_0x86c8('0x64')],null))['then'](function(_0x1fdeff){if(_0x1fdeff&&_0x3f3159[_0x86c8('0x64')][_0x86c8('0x44')]){return db[_0x86c8('0x43')][_0x86c8('0x3c')](_0x3f3159[_0x86c8('0x64')]['Imap'],{'where':{'MailAccountId':_0x1fdeff['id']}})['then'](function(){return _0x1fdeff;});}return _0x1fdeff;})['then'](function(_0x6d811a){if(_0x6d811a&&_0x3f3159['body'][_0x86c8('0x45')]){return db['MailServerOut']['update'](_0x3f3159[_0x86c8('0x64')][_0x86c8('0x45')],{'where':{'MailAccountId':_0x6d811a['id']}})[_0x86c8('0x25')](function(){return _0x6d811a;});}return _0x6d811a;})[_0x86c8('0x25')](respondWithResult(_0x5e8f24,null))[_0x86c8('0x2f')](handleError(_0x5e8f24,null));};exports[_0x86c8('0x65')]=function(_0x27585e,_0x34303f){return db[_0x86c8('0x47')][_0x86c8('0x65')]()[_0x86c8('0x25')](respondWithResult(_0x34303f,null))[_0x86c8('0x2f')](handleError(_0x34303f,null));};exports[_0x86c8('0x66')]=function(_0x2d8278,_0x434c3b,_0x5cd8ec){if(_0x2d8278[_0x86c8('0x64')]['id']){delete _0x2d8278[_0x86c8('0x64')]['id'];}return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x2d8278[_0x86c8('0x61')]['id']}})['then'](handleEntityNotFound(_0x434c3b,null))[_0x86c8('0x25')](function(_0x537de8){if(_0x537de8){_0x2d8278[_0x86c8('0x64')][_0x86c8('0x67')]=_0x537de8['id'];return db[_0x86c8('0x68')][_0x86c8('0x69')](_0x2d8278[_0x86c8('0x64')]);}})['then'](respondWithResult(_0x434c3b,null))['catch'](handleError(_0x434c3b,null));};exports[_0x86c8('0x6a')]=function(_0xbe9fbf,_0x2bd5d4,_0x1c22c5){var _0x446f5a={'raw':![],'where':{}};var _0x479460={};var _0x393813={'count':0x0,'rows':[]};return db['MailAccount'][_0x86c8('0x6b')]({'where':{'id':_0xbe9fbf[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x2bd5d4,null))[_0x86c8('0x25')](function(_0x3acd3a){if(_0x3acd3a){_0x479460['model']=_[_0x86c8('0x4d')](db[_0x86c8('0x68')][_0x86c8('0x62')]);_0x479460[_0x86c8('0x4c')]=_[_0x86c8('0x4d')](_0xbe9fbf[_0x86c8('0x4c')]);_0x479460['filters']=_[_0x86c8('0x4f')](_0x479460['model'],_0x479460[_0x86c8('0x4c')]);_0x446f5a[_0x86c8('0x50')]=_[_0x86c8('0x4f')](_0x479460[_0x86c8('0x4a')],qs['fields'](_0xbe9fbf[_0x86c8('0x4c')][_0x86c8('0x51')]));_0x446f5a[_0x86c8('0x50')]=_0x446f5a['attributes'][_0x86c8('0x52')]?_0x446f5a[_0x86c8('0x50')]:_0x479460['model'];if(!_0xbe9fbf[_0x86c8('0x4c')][_0x86c8('0x53')]('nolimit')){_0x446f5a['limit']=qs['limit'](_0xbe9fbf['query'][_0x86c8('0x35')]);_0x446f5a[_0x86c8('0x33')]=qs[_0x86c8('0x33')](_0xbe9fbf['query'][_0x86c8('0x33')]);}_0x446f5a[_0x86c8('0x6c')]=qs[_0x86c8('0x55')](_0xbe9fbf[_0x86c8('0x4c')]['sort']);_0x446f5a['where']=qs[_0x86c8('0x4e')](_[_0x86c8('0x56')](_0xbe9fbf[_0x86c8('0x4c')],_0x479460[_0x86c8('0x4e')]));_0x446f5a['where']['MailAccountId']=_0x3acd3a['id'];if(_0xbe9fbf[_0x86c8('0x4c')][_0x86c8('0x57')]){_0x446f5a[_0x86c8('0x59')]=_[_0x86c8('0x58')](_0x446f5a[_0x86c8('0x59')],{'$or':_[_0x86c8('0x4b')](_0x446f5a[_0x86c8('0x50')],function(_0x2ee80c){var _0x470b8b={};_0x470b8b[_0x2ee80c]={'$like':'%'+_0xbe9fbf['query']['filter']+'%'};return _0x470b8b;})});}_0x446f5a=_[_0x86c8('0x58')]({},_0x446f5a,_0xbe9fbf[_0x86c8('0x5c')]);return db['Disposition'][_0x86c8('0x36')]({'where':_0x446f5a[_0x86c8('0x59')]})[_0x86c8('0x25')](function(_0x4218f1){_0x393813[_0x86c8('0x36')]=_0x4218f1;if(_0xbe9fbf['query'][_0x86c8('0x5d')]){_0x446f5a[_0x86c8('0x5e')]=[{'all':!![]}];}return db[_0x86c8('0x68')]['findAll'](_0x446f5a);})[_0x86c8('0x25')](function(_0x4f233b){_0x393813[_0x86c8('0x60')]=_0x4f233b;return _0x393813;});}})[_0x86c8('0x25')](respondWithFilteredResult(_0x2bd5d4,_0x446f5a))[_0x86c8('0x2f')](handleError(_0x2bd5d4,null));};exports[_0x86c8('0x6d')]=function(_0x1c2195,_0x1ce248,_0x1e4cb9){return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x1c2195[_0x86c8('0x61')]['id']}})['then'](handleEntityNotFound(_0x1ce248,null))[_0x86c8('0x25')](function(_0x3863b2){if(_0x3863b2){return _0x3863b2[_0x86c8('0x6d')](_0x1c2195[_0x86c8('0x4c')][_0x86c8('0x6e')]);}})['then'](respondWithStatusCode(_0x1ce248,null))[_0x86c8('0x2f')](handleError(_0x1ce248,null));};exports[_0x86c8('0x6f')]=function(_0x2fe914,_0x32815d,_0x143c82){if(_0x2fe914['body']['id']){delete _0x2fe914[_0x86c8('0x64')]['id'];}return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x2fe914[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x32815d,null))['then'](function(_0x37ed4b){if(_0x37ed4b){_0x2fe914[_0x86c8('0x64')][_0x86c8('0x67')]=_0x37ed4b['id'];return db[_0x86c8('0x70')][_0x86c8('0x69')](_0x2fe914[_0x86c8('0x64')]);}})[_0x86c8('0x25')](respondWithResult(_0x32815d,null))[_0x86c8('0x2f')](handleError(_0x32815d,null));};exports[_0x86c8('0x71')]=function(_0x24daa1,_0x526bf8,_0x224df0){var _0x2dab12={'raw':![],'where':{}};var _0x2b86d1={};var _0x4d2fe1={'count':0x0,'rows':[]};return db[_0x86c8('0x47')][_0x86c8('0x6b')]({'where':{'id':_0x24daa1[_0x86c8('0x61')]['id']}})['then'](handleEntityNotFound(_0x526bf8,null))[_0x86c8('0x25')](function(_0x3aca73){if(_0x3aca73){_0x2b86d1['model']=_[_0x86c8('0x4d')](db['CannedAnswer'][_0x86c8('0x62')]);_0x2b86d1['query']=_['keys'](_0x24daa1[_0x86c8('0x4c')]);_0x2b86d1[_0x86c8('0x4e')]=_[_0x86c8('0x4f')](_0x2b86d1['model'],_0x2b86d1['query']);_0x2dab12[_0x86c8('0x50')]=_[_0x86c8('0x4f')](_0x2b86d1['model'],qs[_0x86c8('0x51')](_0x24daa1['query']['fields']));_0x2dab12['attributes']=_0x2dab12['attributes'][_0x86c8('0x52')]?_0x2dab12['attributes']:_0x2b86d1[_0x86c8('0x4a')];if(!_0x24daa1['query']['hasOwnProperty']('nolimit')){_0x2dab12[_0x86c8('0x35')]=qs[_0x86c8('0x35')](_0x24daa1[_0x86c8('0x4c')]['limit']);_0x2dab12[_0x86c8('0x33')]=qs[_0x86c8('0x33')](_0x24daa1[_0x86c8('0x4c')][_0x86c8('0x33')]);}_0x2dab12[_0x86c8('0x6c')]=qs[_0x86c8('0x55')](_0x24daa1[_0x86c8('0x4c')][_0x86c8('0x55')]);_0x2dab12['where']=qs['filters'](_[_0x86c8('0x56')](_0x24daa1[_0x86c8('0x4c')],_0x2b86d1[_0x86c8('0x4e')]));_0x2dab12[_0x86c8('0x59')][_0x86c8('0x67')]=_0x3aca73['id'];if(_0x24daa1[_0x86c8('0x4c')][_0x86c8('0x57')]){_0x2dab12[_0x86c8('0x59')]=_['merge'](_0x2dab12[_0x86c8('0x59')],{'$or':_[_0x86c8('0x4b')](_0x2dab12[_0x86c8('0x50')],function(_0x39e2a4){var _0x235641={};_0x235641[_0x39e2a4]={'$like':'%'+_0x24daa1[_0x86c8('0x4c')][_0x86c8('0x57')]+'%'};return _0x235641;})});}_0x2dab12=_[_0x86c8('0x58')]({},_0x2dab12,_0x24daa1[_0x86c8('0x5c')]);return db[_0x86c8('0x70')]['count']({'where':_0x2dab12['where']})[_0x86c8('0x25')](function(_0x286f3d){_0x4d2fe1[_0x86c8('0x36')]=_0x286f3d;if(_0x24daa1[_0x86c8('0x4c')]['includeAll']){_0x2dab12['include']=[{'all':!![]}];}return db[_0x86c8('0x70')][_0x86c8('0x5f')](_0x2dab12);})[_0x86c8('0x25')](function(_0x546d39){_0x4d2fe1['rows']=_0x546d39;return _0x4d2fe1;});}})[_0x86c8('0x25')](respondWithFilteredResult(_0x526bf8,_0x2dab12))[_0x86c8('0x2f')](handleError(_0x526bf8,null));};exports[_0x86c8('0x72')]=function(_0x3f5928,_0x4b0c46,_0x18512b){return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x3f5928[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x4b0c46,null))[_0x86c8('0x25')](function(_0x1776cd){if(_0x1776cd){return _0x1776cd['removeAnswers'](_0x3f5928[_0x86c8('0x4c')][_0x86c8('0x6e')]);}})['then'](respondWithStatusCode(_0x4b0c46,null))[_0x86c8('0x2f')](handleError(_0x4b0c46,null));};exports[_0x86c8('0x69')]=function(_0x428f8a,_0x33692e){var _0x123768={'name':_0x428f8a[_0x86c8('0x64')][_0x86c8('0x40')],'key':_0x428f8a[_0x86c8('0x64')][_0x86c8('0x49')],'email':_0x428f8a['body']['email'],'ListId':_0x428f8a[_0x86c8('0x64')][_0x86c8('0x73')],'active':!_[_0x86c8('0x74')](_0x428f8a[_0x86c8('0x64')][_0x86c8('0x75')])?_0x428f8a[_0x86c8('0x64')][_0x86c8('0x75')]:!![],'description':_0x428f8a[_0x86c8('0x64')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x86c8('0x74')](_0x428f8a[_0x86c8('0x64')][_0x86c8('0x76')])){if(_0x428f8a['body']['cauthentication']){_0x123768[_0x86c8('0x44')][_0x86c8('0x77')]=_0x123768[_0x86c8('0x45')][_0x86c8('0x77')]=_0x428f8a[_0x86c8('0x64')][_0x86c8('0x78')];_0x123768[_0x86c8('0x44')][_0x86c8('0x79')]=_0x123768[_0x86c8('0x45')][_0x86c8('0x7a')]=_0x428f8a[_0x86c8('0x64')][_0x86c8('0x7b')];}else{_0x123768['Imap']['authentication']=_0x123768[_0x86c8('0x45')]['authentication']=![];}_0x123768[_0x86c8('0x44')][_0x86c8('0x7c')]=_0x428f8a['body'][_0x86c8('0x44')][_0x86c8('0x7c')];_0x123768['Imap'][_0x86c8('0x7d')]=_0x428f8a[_0x86c8('0x64')]['Imap']['port'];_0x123768[_0x86c8('0x45')]['host']=_0x428f8a['body'][_0x86c8('0x45')][_0x86c8('0x7c')];_0x123768[_0x86c8('0x45')][_0x86c8('0x7d')]=_0x428f8a[_0x86c8('0x64')][_0x86c8('0x45')][_0x86c8('0x7d')];}else{_0x123768[_0x86c8('0x44')]['service']=_0x123768['Smtp']['service']=_0x428f8a['body'][_0x86c8('0x76')];_0x123768[_0x86c8('0x44')][_0x86c8('0x77')]=_0x123768[_0x86c8('0x45')][_0x86c8('0x77')]=_0x428f8a[_0x86c8('0x64')]['cuser'];_0x123768[_0x86c8('0x44')][_0x86c8('0x79')]=_0x123768[_0x86c8('0x45')]['pass']=_0x428f8a[_0x86c8('0x64')]['cpassword'];}return db['MailAccount'][_0x86c8('0x69')](_0x123768,{'include':[{'model':db[_0x86c8('0x7e')],'as':_0x86c8('0x45')},{'model':db[_0x86c8('0x43')],'as':_0x86c8('0x44')}]})[_0x86c8('0x25')](function(_0x2d8dfd){var _0x5e0d42=_0x428f8a[_0x86c8('0x77')][_0x86c8('0x3d')]({'plain':!![]});if(!_0x5e0d42)throw new Error(_0x86c8('0x7f'));if(_0x5e0d42[_0x86c8('0x80')]===_0x86c8('0x77')){var _0x238e05=_0x2d8dfd[_0x86c8('0x3d')]({'plain':!![]});return db['UserProfileSection'][_0x86c8('0x63')]({'where':{'name':_0x86c8('0x81'),'userProfileId':_0x5e0d42['userProfileId']},'raw':!![]})['then'](function(_0x264ab8){if(_0x264ab8&&_0x264ab8[_0x86c8('0x82')]===0x0){return db[_0x86c8('0x3e')][_0x86c8('0x69')]({'name':_0x238e05[_0x86c8('0x40')],'resourceId':_0x238e05['id'],'type':_0x264ab8[_0x86c8('0x40')],'sectionId':_0x264ab8['id']},{})[_0x86c8('0x25')](function(){return _0x2d8dfd;});}else{return _0x2d8dfd;}})[_0x86c8('0x2f')](function(_0x4bf394){logger[_0x86c8('0x2b')](_0x86c8('0x83'),_0x4bf394);throw _0x4bf394;});}return _0x2d8dfd;})[_0x86c8('0x25')](respondWithResult(_0x33692e,0xc9))[_0x86c8('0x2f')](handleError(_0x33692e,null));};exports['getImap']=function(_0x1e369b,_0x193bc5,_0x3514c9){return db[_0x86c8('0x47')][_0x86c8('0x6b')]({'where':{'id':_0x1e369b['params']['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x193bc5,null))[_0x86c8('0x25')](function(_0x399427){if(_0x399427){return _0x399427[_0x86c8('0x84')]();}return null;})[_0x86c8('0x25')](respondWithResult(_0x193bc5,null))[_0x86c8('0x2f')](handleError(_0x193bc5,null));};exports[_0x86c8('0x85')]=function(_0x15fd61,_0x4e8eca,_0x35b87c){if(_0x15fd61[_0x86c8('0x64')]['id']){delete _0x15fd61[_0x86c8('0x64')]['id'];}return db[_0x86c8('0x47')]['find']({'where':{'id':_0x15fd61[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x4e8eca,null))[_0x86c8('0x25')](function(_0x3201e7){if(_0x3201e7){_0x15fd61['body'][_0x86c8('0x67')]=_0x3201e7['id'];return db[_0x86c8('0x43')][_0x86c8('0x69')](_0x15fd61[_0x86c8('0x64')]);}})[_0x86c8('0x25')](respondWithResult(_0x4e8eca,null))[_0x86c8('0x2f')](handleError(_0x4e8eca,null));};exports[_0x86c8('0x86')]=function(_0x14db9e,_0x23681d,_0x1bbc77){return db[_0x86c8('0x47')][_0x86c8('0x6b')]({'where':{'id':_0x14db9e[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x23681d,null))['then'](function(_0x45b342){if(_0x45b342){return _0x45b342[_0x86c8('0x87')](null);}return null;})[_0x86c8('0x25')](respondWithStatusCode(_0x23681d,null))[_0x86c8('0x2f')](handleError(_0x23681d,null));};exports['getSmtp']=function(_0x3b293b,_0x4bd4be,_0x8adb4a){return db['MailAccount']['findOne']({'where':{'id':_0x3b293b['params']['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x4bd4be,null))['then'](function(_0x26a907){if(_0x26a907){return _0x26a907[_0x86c8('0x88')]();}return null;})['then'](respondWithResult(_0x4bd4be,null))[_0x86c8('0x2f')](handleError(_0x4bd4be,null));};exports[_0x86c8('0x89')]=function(_0x587104,_0x153e80,_0x419e76){if(_0x587104[_0x86c8('0x64')]['id']){delete _0x587104[_0x86c8('0x64')]['id'];}return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x587104[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x153e80,null))['then'](function(_0x2a1eeb){if(_0x2a1eeb){_0x587104[_0x86c8('0x64')][_0x86c8('0x67')]=_0x2a1eeb['id'];return db['MailServerOut']['create'](_0x587104['body']);}})[_0x86c8('0x25')](respondWithResult(_0x153e80,null))[_0x86c8('0x2f')](handleError(_0x153e80,null));};exports[_0x86c8('0x8a')]=function(_0x4094b5,_0x41fefc,_0x4e901a){return db['MailAccount'][_0x86c8('0x6b')]({'where':{'id':_0x4094b5[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x41fefc,null))[_0x86c8('0x25')](function(_0xa85fe7){if(_0xa85fe7){return _0xa85fe7[_0x86c8('0x8b')](null);}return null;})[_0x86c8('0x25')](respondWithStatusCode(_0x41fefc,null))[_0x86c8('0x2f')](handleError(_0x41fefc,null));};exports['addInteraction']=function(_0x736906,_0x1cbbff,_0x3afe90){return db[_0x86c8('0x8c')]['find']({'where':{'id':_0x736906['params']['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x1cbbff,null))[_0x86c8('0x25')](function(_0x4f11cc){if(_0x4f11cc){return _0x4f11cc[_0x86c8('0x8d')](_0x736906[_0x86c8('0x64')][_0x86c8('0x6e')],_[_0x86c8('0x8e')](_0x736906['body'],[_0x86c8('0x6e'),'id'])||{});}})[_0x86c8('0x25')](respondWithResult(_0x1cbbff,null))[_0x86c8('0x2f')](handleError(_0x1cbbff,null));};exports[_0x86c8('0x8f')]=function(_0x5dfd7c,_0x3fcaba,_0x4b98ee){var _0x1fe22c={'raw':![],'where':{}};var _0x70d0ab={};var _0x4d961c={'count':0x0,'rows':[]};return db[_0x86c8('0x47')][_0x86c8('0x6b')]({'where':{'id':_0x5dfd7c['params']['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x3fcaba,null))['then'](function(_0x379144){if(_0x379144){_0x70d0ab[_0x86c8('0x4a')]=_[_0x86c8('0x4d')](db['MailInteraction'][_0x86c8('0x62')]);_0x70d0ab[_0x86c8('0x4c')]=_[_0x86c8('0x4d')](_0x5dfd7c[_0x86c8('0x4c')]);_0x70d0ab['filters']=_[_0x86c8('0x4f')](_0x70d0ab[_0x86c8('0x4a')],_0x70d0ab[_0x86c8('0x4c')]);_0x1fe22c[_0x86c8('0x50')]=_[_0x86c8('0x4f')](_0x70d0ab[_0x86c8('0x4a')],qs[_0x86c8('0x51')](_0x5dfd7c[_0x86c8('0x4c')]['fields']));_0x1fe22c[_0x86c8('0x50')]=_0x1fe22c['attributes'][_0x86c8('0x52')]?_0x1fe22c[_0x86c8('0x50')]:_0x70d0ab[_0x86c8('0x4a')];if(!_0x5dfd7c['query'][_0x86c8('0x53')](_0x86c8('0x54'))){_0x1fe22c[_0x86c8('0x35')]=qs[_0x86c8('0x35')](_0x5dfd7c['query'][_0x86c8('0x35')]);_0x1fe22c['offset']=qs['offset'](_0x5dfd7c[_0x86c8('0x4c')]['offset']);}_0x1fe22c[_0x86c8('0x6c')]=qs[_0x86c8('0x55')](_0x5dfd7c['query'][_0x86c8('0x55')]);_0x1fe22c[_0x86c8('0x59')]=qs[_0x86c8('0x4e')](_[_0x86c8('0x56')](_0x5dfd7c[_0x86c8('0x4c')],_0x70d0ab[_0x86c8('0x4e')]));_0x1fe22c['where'][_0x86c8('0x67')]=_0x379144['id'];if(_0x5dfd7c[_0x86c8('0x4c')][_0x86c8('0x57')]){_0x1fe22c[_0x86c8('0x59')]=_[_0x86c8('0x58')](_0x1fe22c[_0x86c8('0x59')],{'$or':_[_0x86c8('0x4b')](_0x1fe22c[_0x86c8('0x50')],function(_0x561f01){var _0x17f198={};_0x17f198[_0x561f01]={'$like':'%'+_0x5dfd7c[_0x86c8('0x4c')]['filter']+'%'};return _0x17f198;})});}_0x1fe22c=_[_0x86c8('0x58')]({},_0x1fe22c,_0x5dfd7c[_0x86c8('0x5c')]);return db[_0x86c8('0x8c')][_0x86c8('0x36')]({'where':_0x1fe22c[_0x86c8('0x59')]})[_0x86c8('0x25')](function(_0x4d30b1){_0x4d961c[_0x86c8('0x36')]=_0x4d30b1;if(_0x5dfd7c['query'][_0x86c8('0x5d')]){_0x1fe22c[_0x86c8('0x5e')]=[{'model':db['CmContact'],'as':_0x86c8('0x90'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x86c8('0x40'),_0x86c8('0x91'),_0x86c8('0x92')],'required':![]},{'model':db[_0x86c8('0x93')],'as':_0x86c8('0x94'),'attributes':['id','name',_0x86c8('0x95')],'where':_0x5dfd7c['query']['tag']?{'id':_0x5dfd7c[_0x86c8('0x4c')][_0x86c8('0x96')]}:undefined,'required':_0x5dfd7c[_0x86c8('0x4c')][_0x86c8('0x96')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x1fe22c);})[_0x86c8('0x25')](function(_0x3beca5){_0x4d961c['rows']=_0x3beca5;return _0x4d961c;});}})[_0x86c8('0x25')](respondWithFilteredResult(_0x3fcaba,_0x1fe22c))['catch'](handleError(_0x3fcaba,null));};exports[_0x86c8('0x97')]=function(_0xc40af,_0x338128,_0x10312b){return db[_0x86c8('0x47')][_0x86c8('0x6b')]({'where':{'id':_0xc40af['params']['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x338128,null))[_0x86c8('0x25')](function(_0x4cce43){if(_0x4cce43){return db[_0x86c8('0x98')][_0x86c8('0x99')](function(_0x5766e0){return db[_0x86c8('0x9a')][_0x86c8('0x3f')]({'where':{'MailAccountId':_0xc40af['params']['id']},'transaction':_0x5766e0})[_0x86c8('0x25')](function(_0x557533){var _0x2dcf39=_[_0x86c8('0x4b')](_0xc40af[_0x86c8('0x64')],function(_0x5c9d15){_0x5c9d15['MailAccountId']=_0xc40af['params']['id'];return _0x5c9d15;});return db[_0x86c8('0x9a')][_0x86c8('0x9b')](_0x2dcf39,{'transaction':_0x5766e0});});})[_0x86c8('0x25')](function(){return db[_0x86c8('0x9a')][_0x86c8('0x9c')]({'where':{'MailAccountId':_0xc40af[_0x86c8('0x61')]['id']},'order':_0x86c8('0x9d')});});}})[_0x86c8('0x25')](respondWithResult(_0x338128,null))[_0x86c8('0x2f')](handleError(_0x338128,null));};exports[_0x86c8('0x9e')]=function(_0x10c127,_0xb9b35d,_0x22d12f){var _0x5642ca={};var _0x222d31={};var _0x590383;var _0x3a9ae7;return db['MailAccount'][_0x86c8('0x6b')]({'where':{'id':_0x10c127['params']['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0xb9b35d,null))[_0x86c8('0x25')](function(_0x3bbad0){if(_0x3bbad0){_0x590383=_0x3bbad0;_0x222d31['model']=_[_0x86c8('0x4d')](db[_0x86c8('0x9a')][_0x86c8('0x62')]);_0x222d31[_0x86c8('0x4c')]=_['keys'](_0x10c127[_0x86c8('0x4c')]);_0x222d31['filters']=_[_0x86c8('0x4f')](_0x222d31[_0x86c8('0x4a')],_0x222d31[_0x86c8('0x4c')]);_0x5642ca[_0x86c8('0x50')]=_[_0x86c8('0x4f')](_0x222d31['model'],qs['fields'](_0x10c127[_0x86c8('0x4c')][_0x86c8('0x51')]));_0x5642ca[_0x86c8('0x50')]=_0x5642ca[_0x86c8('0x50')][_0x86c8('0x52')]?_0x5642ca[_0x86c8('0x50')]:_0x222d31[_0x86c8('0x4a')];_0x5642ca[_0x86c8('0x6c')]=qs[_0x86c8('0x55')](_0x10c127['query'][_0x86c8('0x55')]);_0x5642ca[_0x86c8('0x59')]=qs[_0x86c8('0x4e')](_[_0x86c8('0x56')](_0x10c127['query'],_0x222d31[_0x86c8('0x4e')]));if(_0x10c127['query']['filter']){_0x5642ca['where']=_[_0x86c8('0x58')](_0x5642ca[_0x86c8('0x59')],{'$or':_[_0x86c8('0x4b')](_0x5642ca[_0x86c8('0x50')],function(_0x3f7a6c){var _0x114d5f={};_0x114d5f[_0x3f7a6c]={'$like':'%'+_0x10c127[_0x86c8('0x4c')]['filter']+'%'};return _0x114d5f;})});}_0x5642ca=_[_0x86c8('0x58')]({},_0x5642ca,_0x10c127[_0x86c8('0x5c')]);return _0x590383[_0x86c8('0x9e')](_0x5642ca);}})[_0x86c8('0x25')](function(_0x3ca790){if(_0x3ca790){_0x3a9ae7=_0x3ca790['length'];if(!_0x10c127[_0x86c8('0x4c')][_0x86c8('0x53')](_0x86c8('0x54'))){_0x5642ca[_0x86c8('0x35')]=qs[_0x86c8('0x35')](_0x10c127[_0x86c8('0x4c')][_0x86c8('0x35')]);_0x5642ca[_0x86c8('0x33')]=qs[_0x86c8('0x33')](_0x10c127[_0x86c8('0x4c')]['offset']);}return _0x590383['getApplications'](_0x5642ca);}})['then'](function(_0x22fbc7){if(_0x22fbc7){return _0x22fbc7?{'count':_0x3a9ae7,'rows':_0x22fbc7}:null;}})[_0x86c8('0x25')](respondWithResult(_0xb9b35d,null))[_0x86c8('0x2f')](handleError(_0xb9b35d,null));};exports[_0x86c8('0x9f')]=function(_0x351123,_0x13d8f9,_0x41162b){var _0x94d455={'raw':!![],'where':{}};var _0x5d0027={};var _0x13933b={'count':0x0,'rows':[]};return db['MailAccount'][_0x86c8('0x6b')]({'where':{'id':_0x351123[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x13d8f9,null))[_0x86c8('0x25')](function(_0x2e144b){if(_0x2e144b){_0x5d0027[_0x86c8('0x4a')]=_[_0x86c8('0x4d')](db['MailMessage'][_0x86c8('0x62')]);_0x5d0027[_0x86c8('0x4c')]=_['keys'](_0x351123['query']);_0x5d0027[_0x86c8('0x4e')]=_[_0x86c8('0x4f')](_0x5d0027[_0x86c8('0x4a')],_0x5d0027[_0x86c8('0x4c')]);_0x94d455[_0x86c8('0x50')]=_[_0x86c8('0x4f')](_0x5d0027[_0x86c8('0x4a')],qs['fields'](_0x351123['query']['fields']));_0x94d455['attributes']=_0x94d455['attributes']['length']?_0x94d455['attributes']:_0x5d0027['model'];if(!_0x351123[_0x86c8('0x4c')]['hasOwnProperty'](_0x86c8('0x54'))){_0x94d455['limit']=qs[_0x86c8('0x35')](_0x351123['query'][_0x86c8('0x35')]);_0x94d455[_0x86c8('0x33')]=qs[_0x86c8('0x33')](_0x351123[_0x86c8('0x4c')][_0x86c8('0x33')]);}_0x94d455[_0x86c8('0x6c')]=qs[_0x86c8('0x55')](_0x351123[_0x86c8('0x4c')][_0x86c8('0x55')]);_0x94d455['where']=qs[_0x86c8('0x4e')](_[_0x86c8('0x56')](_0x351123[_0x86c8('0x4c')],_0x5d0027['filters']));_0x94d455['where']['MailAccountId']=_0x2e144b['id'];if(_0x351123[_0x86c8('0x4c')][_0x86c8('0x57')]){_0x94d455[_0x86c8('0x59')]=_[_0x86c8('0x58')](_0x94d455[_0x86c8('0x59')],{'$or':_['map'](_0x94d455[_0x86c8('0x50')],function(_0x3a940c){var _0x53803b={};_0x53803b[_0x3a940c]={'$like':'%'+_0x351123[_0x86c8('0x4c')][_0x86c8('0x57')]+'%'};return _0x53803b;})});}if(_0x351123['query'][_0x86c8('0xa0')]){var _0x495dc4=_0x351123[_0x86c8('0x4c')]['$gte'][_0x86c8('0xa1')](',');var _0x548c64={};_0x548c64[_0x495dc4[0x0]]={'$gte':moment(_0x495dc4[0x1])[_0x86c8('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x94d455[_0x86c8('0x59')]=_[_0x86c8('0x58')](_0x94d455[_0x86c8('0x59')],_0x548c64);}_0x94d455=_[_0x86c8('0x58')]({},_0x94d455,_0x351123['options']);return db[_0x86c8('0xa3')][_0x86c8('0x36')]({'where':_0x94d455[_0x86c8('0x59')]})[_0x86c8('0x25')](function(_0xecfa25){_0x13933b[_0x86c8('0x36')]=_0xecfa25;if(_0x351123[_0x86c8('0x4c')][_0x86c8('0x5d')]){_0x94d455['include']=[{'all':!![]}];}return db[_0x86c8('0xa3')][_0x86c8('0x5f')](_0x94d455);})['then'](function(_0x547d39){if(_0x351123[_0x86c8('0x4c')][_0x86c8('0xa4')]===_0x86c8('0xa5')){for(var _0x5588a2=0x0;_0x5588a2<_0x547d39[_0x86c8('0x52')];_0x5588a2++){_0x547d39[_0x5588a2][_0x86c8('0x64')]=juice(_0x547d39[_0x5588a2][_0x86c8('0x64')]);}}_0x13933b[_0x86c8('0x60')]=_0x547d39;return _0x13933b;});}})['then'](respondWithFilteredResult(_0x13d8f9,_0x94d455))[_0x86c8('0x2f')](handleError(_0x13d8f9,null));};exports[_0x86c8('0x41')]=function(_0x36a02b,_0x3e334a,_0x5e5fcd){var _0x2d1310,_0xae277c={},_0x1e7097;if(_0x36a02b[_0x86c8('0x64')]['to']){_0x1e7097=_0x36a02b[_0x86c8('0x64')]['to'][_0x86c8('0xa1')](',')[0x0];}return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x36a02b[_0x86c8('0x61')]['id']},'include':[{'model':db[_0x86c8('0xa6')],'as':_0x86c8('0xa7'),'include':[{'model':db['CmContact'],'as':_0x86c8('0xa8'),'where':{'email':_0x1e7097},'limit':0x1,'order':[['updatedAt',_0x86c8('0xa9')]]}]},{'model':db[_0x86c8('0x7e')],'as':_0x86c8('0x45'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3e334a,null))[_0x86c8('0x25')](function(_0x3aa351){if(_0x3aa351){_0x2d1310=_0x3aa351;if(_0x3aa351[_0x86c8('0x45')]){if(_[_0x86c8('0x74')](_0x36a02b[_0x86c8('0x64')]['from'])){_0x36a02b[_0x86c8('0x64')]['from']=util[_0x86c8('0xa2')]('%s\x20<%s>',_0x3aa351['name'],_0x3aa351[_0x86c8('0xaa')]||_0x3aa351['Smtp'][_0x86c8('0x77')]);}if(_0x36a02b[_0x86c8('0x64')][_0x86c8('0xab')]&&_0x36a02b[_0x86c8('0x64')][_0x86c8('0xab')][_0x86c8('0x52')]){for(var _0x532bdf=0x0;_0x532bdf<_0x36a02b[_0x86c8('0x64')][_0x86c8('0xab')][_0x86c8('0x52')];_0x532bdf+=0x1){_0x36a02b[_0x86c8('0x64')][_0x86c8('0xab')][_0x532bdf]={'filename':_0x36a02b['body']['attachments'][_0x532bdf]['name'],'path':path['join'](config[_0x86c8('0xac')],_0x86c8('0xad'),_0x36a02b[_0x86c8('0x64')][_0x86c8('0xab')][_0x532bdf]['basename'])};}}var _0x589667={'tls':{'rejectUnauthorized':![]}};if(_[_0x86c8('0x74')](_0x3aa351['Smtp'][_0x86c8('0xae')])){if(_0x3aa351[_0x86c8('0x45')]['authentication']){_0x589667['auth']={'user':_0x3aa351[_0x86c8('0x45')][_0x86c8('0x77')],'pass':_0x3aa351[_0x86c8('0x45')][_0x86c8('0x7a')]};}_0x589667[_0x86c8('0x7c')]=_0x3aa351[_0x86c8('0x45')][_0x86c8('0x7c')];_0x589667[_0x86c8('0x7d')]=_0x3aa351['Smtp'][_0x86c8('0x7d')];_0x589667[_0x86c8('0xaf')]=_0x3aa351[_0x86c8('0x45')][_0x86c8('0xaf')];}else{_0x589667['service']=_0x3aa351[_0x86c8('0x45')][_0x86c8('0xae')];_0x589667[_0x86c8('0xb0')]={'user':_0x3aa351[_0x86c8('0x45')][_0x86c8('0x77')],'pass':_0x3aa351['Smtp'][_0x86c8('0x7a')]};}return respondWithRpcPromise(_0x86c8('0xb1'),'sendMail',{'account':_0x589667,'message':_0x36a02b['body']});}else{throw new Error(_0x86c8('0xb2'));}}})[_0x86c8('0x25')](function(_0xbaeaf){if(_0xbaeaf){_0xae277c=_0xbaeaf;if(_0x2d1310[_0x86c8('0xa7')]){if(_0x2d1310[_0x86c8('0xa7')][_0x86c8('0xa8')][_0x86c8('0x52')]){return _0x2d1310['List'][_0x86c8('0xa8')][0x0];}else{return db[_0x86c8('0xb3')]['create'](_[_0x86c8('0x1c')](_0x36a02b[_0x86c8('0x64')],{'firstName':_0x36a02b[_0x86c8('0x64')]['to'],'email':_0x36a02b[_0x86c8('0x64')]['to'],'phone':_0x36a02b[_0x86c8('0x64')]['to'],'ListId':_0x2d1310[_0x86c8('0x73')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x273376){if(_0x273376){var _0xe9b641={'UserId':_0x36a02b[_0x86c8('0x77')]['id'],'ContactId':_0x273376['id'],'MailAccountId':_0x2d1310['id'],'inReplyTo':_0xae277c[_0x86c8('0xb4')],'to':_0x36a02b[_0x86c8('0x64')][_0x86c8('0xb5')],'cc':_0x36a02b[_0x86c8('0x64')]['cc'],'subject':_0x36a02b[_0x86c8('0x64')][_0x86c8('0xb6')],'attach':_0x36a02b['body'][_0x86c8('0xb7')],'firstMsgDirection':_0x86c8('0xb8'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x86c8('0xb8'),'Messages':[_[_0x86c8('0x58')](_0x36a02b[_0x86c8('0x64')],{'messageId':_0xae277c[_0x86c8('0xb4')],'sentAt':moment()[_0x86c8('0xa2')](_0x86c8('0xb9')),'read':!![],'MailAccountId':_0x2d1310['id'],'UserId':_0x36a02b[_0x86c8('0x77')]['id'],'ContactId':_0x273376['id']})]};if(_0x36a02b[_0x86c8('0x64')][_0x86c8('0xba')]){_0xe9b641=_[_0x86c8('0x58')](_0xe9b641,_0x36a02b[_0x86c8('0x64')]['Interaction']);}return db[_0x86c8('0x8c')][_0x86c8('0x69')](_0xe9b641,{'include':[{'model':db[_0x86c8('0xa3')],'as':_0x86c8('0xbb')}]});}})['then'](respondWithResult(_0x3e334a,null))[_0x86c8('0x2f')](handleError(_0x3e334a,null));};exports[_0x86c8('0xbc')]=function(_0x18be06,_0x27f397,_0x3773a0){return db[_0x86c8('0x47')]['find']({'where':{'id':_0x18be06['params']['id']},'include':[{'model':db[_0x86c8('0x7e')],'as':_0x86c8('0x45'),'raw':!![]}]})[_0x86c8('0x25')](handleEntityNotFound(_0x27f397,null))[_0x86c8('0x25')](function(_0x191133){if(_0x191133&&_0x191133[_0x86c8('0x45')]){var _0x3ed764={'id':_0x191133['id'],'tls':{'rejectUnauthorized':![]}};if(_0x191133['Smtp'][_0x86c8('0xae')]){_0x3ed764[_0x86c8('0xae')]=_0x191133[_0x86c8('0x45')][_0x86c8('0xae')];}else{_0x3ed764['host']=_0x191133[_0x86c8('0x45')]['host'];_0x3ed764[_0x86c8('0x7d')]=_0x191133[_0x86c8('0x45')][_0x86c8('0x7d')];_0x3ed764[_0x86c8('0xaf')]=_0x191133[_0x86c8('0x45')][_0x86c8('0xaf')];}if(_0x191133[_0x86c8('0x45')]['authentication']){_0x3ed764[_0x86c8('0xb0')]={'user':_0x191133[_0x86c8('0x45')][_0x86c8('0x77')],'pass':_0x191133[_0x86c8('0x45')][_0x86c8('0x7a')]};}return respondWithRpcPromise(_0x86c8('0xbd'),_0x86c8('0xbc'),{'account':_0x3ed764});}})['then'](respondWithResult(_0x27f397,null))[_0x86c8('0x2f')](handleError(_0x27f397,null));};exports[_0x86c8('0x3f')]=function(_0x47c9de,_0x35151c){return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x47c9de[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x35151c,null))['then'](function(_0x2f9813){if(_0x2f9813&&_0x2f9813[_0x86c8('0xae')]){throw new db[(_0x86c8('0xbe'))][(_0x86c8('0xbf'))](_0x86c8('0xc0'));}return _0x2f9813;})[_0x86c8('0x25')](removeEntity(_0x35151c,null))[_0x86c8('0x2f')](handleError(_0x35151c,null));};exports[_0x86c8('0xc1')]=function(_0x243f50,_0x1301a9,_0x405191){return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x243f50[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0x1301a9,null))[_0x86c8('0x25')](function(_0xf3b014){if(_0xf3b014){return _0xf3b014[_0x86c8('0xc1')](_0x243f50[_0x86c8('0x64')][_0x86c8('0x6e')],_['omit'](_0x243f50[_0x86c8('0x64')],[_0x86c8('0x6e'),'id'])||{})[_0x86c8('0xc2')](function(_0x214d29){for(var _0x4f0f54=0x0;_0x4f0f54<_0x243f50[_0x86c8('0x64')][_0x86c8('0x6e')][_0x86c8('0x52')];_0x4f0f54+=0x1){socket[_0x86c8('0xc3')](_0x86c8('0xc4'),{'UserId':Number(_0x243f50['body'][_0x86c8('0x6e')][_0x4f0f54]),'MailAccountId':Number(_0x243f50['params']['id'])});}return _0x214d29;});}})[_0x86c8('0x25')](respondWithResult(_0x1301a9,null))[_0x86c8('0x2f')](handleError(_0x1301a9,null));};exports[_0x86c8('0xc5')]=function(_0x3cb5ef,_0x53d221,_0x18b397){return db[_0x86c8('0x47')][_0x86c8('0x63')]({'where':{'id':_0x3cb5ef[_0x86c8('0x61')]['id']}})['then'](handleEntityNotFound(_0x53d221,null))[_0x86c8('0x25')](function(_0x541bc5){if(_0x541bc5){return _0x541bc5[_0x86c8('0xc5')](_0x3cb5ef['query'][_0x86c8('0x6e')])[_0x86c8('0x25')](function(){if(_[_0x86c8('0xc6')](_0x3cb5ef['query']['ids'])){for(var _0x3cdc8b=0x0;_0x3cdc8b<_0x3cb5ef[_0x86c8('0x4c')][_0x86c8('0x6e')][_0x86c8('0x52')];_0x3cdc8b+=0x1){socket[_0x86c8('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x3cb5ef[_0x86c8('0x4c')]['ids'][_0x3cdc8b]),'MailAccountId':Number(_0x3cb5ef[_0x86c8('0x61')]['id'])});}}else{socket[_0x86c8('0xc3')](_0x86c8('0xc7'),{'UserId':Number(_0x3cb5ef[_0x86c8('0x4c')][_0x86c8('0x6e')]),'MailAccountId':Number(_0x3cb5ef[_0x86c8('0x61')]['id'])});}});}})[_0x86c8('0x25')](respondWithStatusCode(_0x53d221,null))[_0x86c8('0x2f')](handleError(_0x53d221,null));};exports[_0x86c8('0xc8')]=function(_0x57ab11,_0xf8a6ce,_0x262698){var _0x2cae85={};var _0x1b2dba={};var _0x4d2e27;var _0x429e03;return db[_0x86c8('0x47')][_0x86c8('0x6b')]({'where':{'id':_0x57ab11[_0x86c8('0x61')]['id']}})[_0x86c8('0x25')](handleEntityNotFound(_0xf8a6ce,null))[_0x86c8('0x25')](function(_0xad7e89){if(_0xad7e89){_0x4d2e27=_0xad7e89;_0x1b2dba[_0x86c8('0x4a')]=_['keys'](db['User'][_0x86c8('0x62')]);_0x1b2dba['query']=_['keys'](_0x57ab11[_0x86c8('0x4c')]);_0x1b2dba['filters']=_[_0x86c8('0x4f')](_0x1b2dba[_0x86c8('0x4a')],_0x1b2dba[_0x86c8('0x4c')]);_0x2cae85[_0x86c8('0x50')]=_[_0x86c8('0x4f')](_0x1b2dba[_0x86c8('0x4a')],qs[_0x86c8('0x51')](_0x57ab11[_0x86c8('0x4c')][_0x86c8('0x51')]));_0x2cae85['attributes']=_0x2cae85['attributes'][_0x86c8('0x52')]?_0x2cae85[_0x86c8('0x50')]:_0x1b2dba['model'];_0x2cae85[_0x86c8('0x6c')]=qs[_0x86c8('0x55')](_0x57ab11['query'][_0x86c8('0x55')]);_0x2cae85[_0x86c8('0x59')]=qs[_0x86c8('0x4e')](_[_0x86c8('0x56')](_0x57ab11['query'],_0x1b2dba[_0x86c8('0x4e')]));if(_0x57ab11[_0x86c8('0x4c')][_0x86c8('0x57')]){_0x2cae85['where']=_[_0x86c8('0x58')](_0x2cae85[_0x86c8('0x59')],{'$or':_['map'](_0x2cae85['attributes'],function(_0x1deb5f){var _0x564b5f={};_0x564b5f[_0x1deb5f]={'$like':'%'+_0x57ab11[_0x86c8('0x4c')][_0x86c8('0x57')]+'%'};return _0x564b5f;})});}_0x2cae85=_[_0x86c8('0x58')]({},_0x2cae85,_0x57ab11[_0x86c8('0x5c')]);return _0x4d2e27[_0x86c8('0xc8')](_0x2cae85);}})[_0x86c8('0x25')](function(_0x2b8212){if(_0x2b8212){_0x429e03=_0x2b8212[_0x86c8('0x52')];if(!_0x57ab11[_0x86c8('0x4c')]['hasOwnProperty'](_0x86c8('0x54'))){_0x2cae85['limit']=qs[_0x86c8('0x35')](_0x57ab11[_0x86c8('0x4c')][_0x86c8('0x35')]);_0x2cae85[_0x86c8('0x33')]=qs[_0x86c8('0x33')](_0x57ab11[_0x86c8('0x4c')][_0x86c8('0x33')]);}return _0x4d2e27[_0x86c8('0xc8')](_0x2cae85);}})[_0x86c8('0x25')](function(_0x33b024){if(_0x33b024){return _0x33b024?{'count':_0x429e03,'rows':_0x33b024}:null;}})[_0x86c8('0x25')](respondWithResult(_0xf8a6ce,null))[_0x86c8('0x2f')](handleError(_0xf8a6ce,null));}; \ No newline at end of file +var _0xc973=['format','YYYY-MM-DD\x20HH:mm:ss','true','List','updatedAt','from','%s\x20<%s>','attachments','server/files/attachments','basename','service','auth','secure','SendMail','List\x20not\x20found','Contacts','messageId','subject','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','User','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','html-to-text','../../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','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','MailAccount','fieldName','type','key','map','keys','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','show','params','Pause','rawAttributes','length','include','body','find','describe','Disposition','create','getDispositions','findOne','pick','MailAccountId','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','email','ListId','active','description','isNil','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','split'];(function(_0x59c233,_0xe0627e){var _0x26e0ef=function(_0x553d84){while(--_0x553d84){_0x59c233['push'](_0x59c233['shift']());}};_0x26e0ef(++_0xe0627e);}(_0xc973,0xdb));var _0x3c97=function(_0xb97ff1,_0x560abc){_0xb97ff1=_0xb97ff1-0x0;var _0xaa4339=_0xc973[_0xb97ff1];return _0xaa4339;};'use strict';var emlformat=require(_0x3c97('0x0'));var rimraf=require(_0x3c97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c97('0x2'));var rp=require('request-promise');var moment=require(_0x3c97('0x3'));var BPromise=require(_0x3c97('0x4'));var Mustache=require('mustache');var util=require(_0x3c97('0x5'));var path=require(_0x3c97('0x6'));var sox=require(_0x3c97('0x7'));var csv=require(_0x3c97('0x8'));var ejs=require(_0x3c97('0x9'));var fs=require('fs');var fs_extra=require(_0x3c97('0xa'));var _=require(_0x3c97('0xb'));var squel=require(_0x3c97('0xc'));var crypto=require(_0x3c97('0xd'));var jsforce=require(_0x3c97('0xe'));var deskjs=require(_0x3c97('0xf'));var toCsv=require(_0x3c97('0x8'));var querystring=require('querystring');var Papa=require(_0x3c97('0x10'));var htmlToText=require(_0x3c97('0x11'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x3c97('0x12'));var qs=require(_0x3c97('0x13'));var as=require(_0x3c97('0x14'));var hardwareService=require(_0x3c97('0x15'));var logger=require(_0x3c97('0x16'))(_0x3c97('0x17'));var utils=require(_0x3c97('0x18'));var config=require(_0x3c97('0x19'));var licenseUtil=require(_0x3c97('0x1a'));var db=require(_0x3c97('0x1b'))['db'];config[_0x3c97('0x1c')]=_[_0x3c97('0x1d')](config[_0x3c97('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c97('0x1c')]));require(_0x3c97('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x18f636,_0x39ed3e,_0x5acc9d,_0x5e15a1){return new BPromise(function(_0x44fe3b,_0x10ebb1){var _0x57d502=_0x5e15a1||client;return _0x57d502[_0x3c97('0x1f')](_0x18f636,_0x5acc9d)['then'](function(_0x275de2){logger[_0x3c97('0x20')](_0x3c97('0x21'),_0x39ed3e,_0x3c97('0x22'));logger['debug'](_0x3c97('0x23'),_0x39ed3e,_0x3c97('0x22'),JSON[_0x3c97('0x24')](_0x275de2));if(_0x275de2[_0x3c97('0x25')]){if(_0x275de2[_0x3c97('0x25')]['code']===0x1f4){logger[_0x3c97('0x25')](_0x3c97('0x21'),_0x39ed3e,_0x275de2[_0x3c97('0x25')][_0x3c97('0x26')]);return _0x10ebb1(_0x275de2['error']['message']);}logger[_0x3c97('0x25')](_0x3c97('0x21'),_0x39ed3e,_0x275de2[_0x3c97('0x25')][_0x3c97('0x26')]);return _0x44fe3b(_0x275de2[_0x3c97('0x25')][_0x3c97('0x26')]);}else{logger[_0x3c97('0x20')]('MailAccount,\x20%s,\x20%s',_0x39ed3e,'request\x20sent');_0x44fe3b(_0x275de2[_0x3c97('0x27')][_0x3c97('0x26')]);}})[_0x3c97('0x28')](function(_0x2d145f){logger[_0x3c97('0x25')](_0x3c97('0x21'),_0x39ed3e,_0x2d145f);_0x10ebb1(_0x2d145f);});});}function respondWithStatusCode(_0x44d180,_0x34a7aa){_0x34a7aa=_0x34a7aa||0xcc;return function(_0x102766){if(_0x102766){return _0x44d180[_0x3c97('0x29')](_0x34a7aa);}return _0x44d180[_0x3c97('0x2a')](_0x34a7aa)[_0x3c97('0x2b')]();};}function respondWithResult(_0x372c23,_0x448681){_0x448681=_0x448681||0xc8;return function(_0x4e9ecb){if(_0x4e9ecb){return _0x372c23[_0x3c97('0x2a')](_0x448681)[_0x3c97('0x2c')](_0x4e9ecb);}};}function respondWithFilteredResult(_0x519e0d,_0x2f1c00){return function(_0x271eb9){if(_0x271eb9){var _0x152ed1=typeof _0x2f1c00[_0x3c97('0x2d')]===_0x3c97('0x2e')&&typeof _0x2f1c00['limit']==='undefined';var _0x5a559a=_0x271eb9[_0x3c97('0x2f')];var _0x4d90f2=_0x152ed1?0x0:_0x2f1c00['offset'];var _0x158836=_0x152ed1?_0x271eb9[_0x3c97('0x2f')]:_0x2f1c00[_0x3c97('0x2d')]+_0x2f1c00[_0x3c97('0x30')];var _0x17a53c;if(_0x158836>=_0x5a559a){_0x158836=_0x5a559a;_0x17a53c=0xc8;}else{_0x17a53c=0xce;}_0x519e0d[_0x3c97('0x2a')](_0x17a53c);return _0x519e0d[_0x3c97('0x31')](_0x3c97('0x32'),_0x4d90f2+'-'+_0x158836+'/'+_0x5a559a)[_0x3c97('0x2c')](_0x271eb9);}return null;};}function patchUpdates(_0x4ae958){return function(_0x5edd26){try{jsonpatch['apply'](_0x5edd26,_0x4ae958,!![]);}catch(_0x192575){return BPromise[_0x3c97('0x33')](_0x192575);}return _0x5edd26['save']();};}function saveUpdates(_0x59280a,_0x3c163c){return function(_0x1f2ae7){if(_0x1f2ae7){return _0x1f2ae7[_0x3c97('0x34')](_0x59280a)[_0x3c97('0x35')](function(_0x36a80d){return _0x36a80d;});}return null;};}function removeEntity(_0x3d0c50,_0x4a23e7){return function(_0x4c5139){if(_0x4c5139){return _0x4c5139[_0x3c97('0x36')]()['then'](function(){var _0x37a1e6=_0x4c5139[_0x3c97('0x37')]({'plain':!![]});var _0x1a8163=_0x3c97('0x38');return db[_0x3c97('0x39')][_0x3c97('0x36')]({'where':{'type':_0x1a8163,'resourceId':_0x37a1e6['id']}})[_0x3c97('0x35')](function(){return _0x4c5139;});})[_0x3c97('0x35')](function(){_0x3d0c50[_0x3c97('0x2a')](0xcc)[_0x3c97('0x2b')]();});}};}function handleEntityNotFound(_0x426805,_0x17a51d){return function(_0x158bf2){if(!_0x158bf2){_0x426805[_0x3c97('0x29')](0x194);}return _0x158bf2;};}function handleError(_0x47868b,_0x32558d){_0x32558d=_0x32558d||0x1f4;return function(_0x197a27){logger[_0x3c97('0x25')](_0x197a27[_0x3c97('0x3a')]);if(_0x197a27[_0x3c97('0x3b')]){delete _0x197a27['name'];}_0x47868b['status'](_0x32558d)[_0x3c97('0x3c')](_0x197a27);};}exports[_0x3c97('0x3d')]=function(_0x3783a9,_0xcd11fd){var _0x420c42={'include':[{'model':db[_0x3c97('0x3e')],'as':_0x3c97('0x3f')},{'model':db[_0x3c97('0x40')],'as':_0x3c97('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3ec210={},_0x17a7a1={'count':0x0,'rows':[]};var _0xba4bf2=_['map'](db[_0x3c97('0x42')]['rawAttributes'],function(_0x35904c){return{'name':_0x35904c[_0x3c97('0x43')],'type':_0x35904c[_0x3c97('0x44')][_0x3c97('0x45')]};});_0x3ec210['model']=_[_0x3c97('0x46')](_0xba4bf2,_0x3c97('0x3b'));_0x3ec210['query']=_[_0x3c97('0x47')](_0x3783a9['query']);_0x3ec210['filters']=_[_0x3c97('0x48')](_0x3ec210[_0x3c97('0x49')],_0x3ec210[_0x3c97('0x4a')]);_0x420c42[_0x3c97('0x4b')]=_[_0x3c97('0x48')](_0x3ec210[_0x3c97('0x49')],qs[_0x3c97('0x4c')](_0x3783a9[_0x3c97('0x4a')]['fields']));_0x420c42[_0x3c97('0x4b')]=_0x420c42['attributes']['length']?_0x420c42[_0x3c97('0x4b')]:_0x3ec210[_0x3c97('0x49')];if(!_0x3783a9[_0x3c97('0x4a')][_0x3c97('0x4d')]('nolimit')){_0x420c42['limit']=qs[_0x3c97('0x30')](_0x3783a9[_0x3c97('0x4a')][_0x3c97('0x30')]);_0x420c42[_0x3c97('0x2d')]=qs[_0x3c97('0x2d')](_0x3783a9[_0x3c97('0x4a')]['offset']);}_0x420c42[_0x3c97('0x4e')]=qs[_0x3c97('0x4f')](_0x3783a9[_0x3c97('0x4a')][_0x3c97('0x4f')]);_0x420c42['where']=qs[_0x3c97('0x50')](_['pick'](_0x3783a9['query'],_0x3ec210['filters']),_0xba4bf2);if(_0x3783a9[_0x3c97('0x4a')][_0x3c97('0x51')]){_0x420c42[_0x3c97('0x52')]=_[_0x3c97('0x53')](_0x420c42[_0x3c97('0x52')],{'$or':_[_0x3c97('0x46')](_0xba4bf2,function(_0x2bd6cb){if(_0x2bd6cb[_0x3c97('0x44')]!==_0x3c97('0x54')){var _0x1675c0={};_0x1675c0[_0x2bd6cb[_0x3c97('0x3b')]]={'$like':'%'+_0x3783a9['query']['filter']+'%'};return _0x1675c0;}})});}_0x420c42=_[_0x3c97('0x53')]({},_0x420c42,_0x3783a9[_0x3c97('0x55')]);var _0x3811f5={'where':_0x420c42['where']};return db['MailAccount'][_0x3c97('0x2f')](_0x3811f5)['then'](function(_0x1ed832){_0x17a7a1[_0x3c97('0x2f')]=_0x1ed832;if(_0x3783a9[_0x3c97('0x4a')][_0x3c97('0x56')]){_0x420c42['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x420c42);})['then'](function(_0x3184ed){_0x17a7a1['rows']=_0x3184ed;return _0x17a7a1;})[_0x3c97('0x35')](respondWithFilteredResult(_0xcd11fd,_0x420c42))['catch'](handleError(_0xcd11fd,null));};exports[_0x3c97('0x57')]=function(_0x47fde2,_0xb5d0f2){var _0x313dc5={'raw':![],'where':{'id':_0x47fde2[_0x3c97('0x58')]['id']},'include':[{'model':db[_0x3c97('0x3e')],'as':_0x3c97('0x3f')},{'model':db[_0x3c97('0x40')],'as':'Smtp'},{'model':db[_0x3c97('0x59')],'as':'mandatoryDispositionPause'}]},_0x441585={};_0x441585[_0x3c97('0x49')]=_[_0x3c97('0x47')](db[_0x3c97('0x42')][_0x3c97('0x5a')]);_0x441585[_0x3c97('0x4a')]=_[_0x3c97('0x47')](_0x47fde2[_0x3c97('0x4a')]);_0x441585['filters']=_[_0x3c97('0x48')](_0x441585[_0x3c97('0x49')],_0x441585[_0x3c97('0x4a')]);_0x313dc5['attributes']=_[_0x3c97('0x48')](_0x441585[_0x3c97('0x49')],qs[_0x3c97('0x4c')](_0x47fde2[_0x3c97('0x4a')][_0x3c97('0x4c')]));_0x313dc5['attributes']=_0x313dc5[_0x3c97('0x4b')][_0x3c97('0x5b')]?_0x313dc5[_0x3c97('0x4b')]:_0x441585[_0x3c97('0x49')];if(_0x47fde2[_0x3c97('0x4a')][_0x3c97('0x56')]){_0x313dc5[_0x3c97('0x5c')]=[{'all':!![]}];}_0x313dc5=_[_0x3c97('0x53')]({},_0x313dc5,_0x47fde2[_0x3c97('0x55')]);return db[_0x3c97('0x42')]['find'](_0x313dc5)['then'](handleEntityNotFound(_0xb5d0f2,null))[_0x3c97('0x35')](respondWithResult(_0xb5d0f2,null))[_0x3c97('0x28')](handleError(_0xb5d0f2,null));};exports[_0x3c97('0x34')]=function(_0x4433fe,_0x196271){if(_0x4433fe[_0x3c97('0x5d')]['id']){delete _0x4433fe[_0x3c97('0x5d')]['id'];}return db['MailAccount'][_0x3c97('0x5e')]({'where':{'id':_0x4433fe['params']['id']},'include':[{'model':db[_0x3c97('0x3e')],'as':_0x3c97('0x3f')},{'model':db[_0x3c97('0x40')],'as':_0x3c97('0x41')},{'model':db[_0x3c97('0x59')],'as':'mandatoryDispositionPause'}]})[_0x3c97('0x35')](handleEntityNotFound(_0x196271,null))['then'](saveUpdates(_0x4433fe['body'],null))[_0x3c97('0x35')](function(_0xd26ca2){if(_0xd26ca2&&_0x4433fe[_0x3c97('0x5d')]['Imap']){return db[_0x3c97('0x3e')][_0x3c97('0x34')](_0x4433fe[_0x3c97('0x5d')]['Imap'],{'where':{'MailAccountId':_0xd26ca2['id']}})[_0x3c97('0x35')](function(){return _0xd26ca2;});}return _0xd26ca2;})['then'](function(_0x176fad){if(_0x176fad&&_0x4433fe[_0x3c97('0x5d')]['Smtp']){return db[_0x3c97('0x40')][_0x3c97('0x34')](_0x4433fe[_0x3c97('0x5d')][_0x3c97('0x41')],{'where':{'MailAccountId':_0x176fad['id']}})['then'](function(){return _0x176fad;});}return _0x176fad;})[_0x3c97('0x35')](respondWithResult(_0x196271,null))[_0x3c97('0x28')](handleError(_0x196271,null));};exports[_0x3c97('0x5f')]=function(_0x1f0a8d,_0x2a8df8){return db[_0x3c97('0x42')][_0x3c97('0x5f')]()[_0x3c97('0x35')](respondWithResult(_0x2a8df8,null))[_0x3c97('0x28')](handleError(_0x2a8df8,null));};exports['addDisposition']=function(_0xe39bcd,_0x3e53df,_0x128def){if(_0xe39bcd[_0x3c97('0x5d')]['id']){delete _0xe39bcd[_0x3c97('0x5d')]['id'];}return db[_0x3c97('0x42')][_0x3c97('0x5e')]({'where':{'id':_0xe39bcd['params']['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x3e53df,null))[_0x3c97('0x35')](function(_0xa249d2){if(_0xa249d2){_0xe39bcd[_0x3c97('0x5d')]['MailAccountId']=_0xa249d2['id'];return db[_0x3c97('0x60')][_0x3c97('0x61')](_0xe39bcd['body']);}})[_0x3c97('0x35')](respondWithResult(_0x3e53df,null))[_0x3c97('0x28')](handleError(_0x3e53df,null));};exports[_0x3c97('0x62')]=function(_0x243ed0,_0x3ab731,_0x4c640c){var _0x3c05d4={'raw':![],'where':{}};var _0x2fbf8a={};var _0x534861={'count':0x0,'rows':[]};return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x243ed0[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x3ab731,null))[_0x3c97('0x35')](function(_0x4d2959){if(_0x4d2959){_0x2fbf8a[_0x3c97('0x49')]=_[_0x3c97('0x47')](db[_0x3c97('0x60')][_0x3c97('0x5a')]);_0x2fbf8a['query']=_['keys'](_0x243ed0[_0x3c97('0x4a')]);_0x2fbf8a[_0x3c97('0x50')]=_['intersection'](_0x2fbf8a[_0x3c97('0x49')],_0x2fbf8a[_0x3c97('0x4a')]);_0x3c05d4[_0x3c97('0x4b')]=_['intersection'](_0x2fbf8a['model'],qs['fields'](_0x243ed0[_0x3c97('0x4a')][_0x3c97('0x4c')]));_0x3c05d4[_0x3c97('0x4b')]=_0x3c05d4[_0x3c97('0x4b')][_0x3c97('0x5b')]?_0x3c05d4['attributes']:_0x2fbf8a['model'];if(!_0x243ed0[_0x3c97('0x4a')][_0x3c97('0x4d')]('nolimit')){_0x3c05d4['limit']=qs[_0x3c97('0x30')](_0x243ed0['query']['limit']);_0x3c05d4[_0x3c97('0x2d')]=qs[_0x3c97('0x2d')](_0x243ed0[_0x3c97('0x4a')][_0x3c97('0x2d')]);}_0x3c05d4[_0x3c97('0x4e')]=qs[_0x3c97('0x4f')](_0x243ed0['query']['sort']);_0x3c05d4[_0x3c97('0x52')]=qs[_0x3c97('0x50')](_[_0x3c97('0x64')](_0x243ed0['query'],_0x2fbf8a['filters']));_0x3c05d4[_0x3c97('0x52')][_0x3c97('0x65')]=_0x4d2959['id'];if(_0x243ed0[_0x3c97('0x4a')][_0x3c97('0x51')]){_0x3c05d4['where']=_[_0x3c97('0x53')](_0x3c05d4[_0x3c97('0x52')],{'$or':_[_0x3c97('0x46')](_0x3c05d4[_0x3c97('0x4b')],function(_0x507a87){var _0x8fd98b={};_0x8fd98b[_0x507a87]={'$like':'%'+_0x243ed0['query']['filter']+'%'};return _0x8fd98b;})});}_0x3c05d4=_[_0x3c97('0x53')]({},_0x3c05d4,_0x243ed0[_0x3c97('0x55')]);return db[_0x3c97('0x60')]['count']({'where':_0x3c05d4['where']})[_0x3c97('0x35')](function(_0x71e383){_0x534861[_0x3c97('0x2f')]=_0x71e383;if(_0x243ed0[_0x3c97('0x4a')][_0x3c97('0x56')]){_0x3c05d4[_0x3c97('0x5c')]=[{'all':!![]}];}return db[_0x3c97('0x60')][_0x3c97('0x66')](_0x3c05d4);})[_0x3c97('0x35')](function(_0x5e2529){_0x534861[_0x3c97('0x67')]=_0x5e2529;return _0x534861;});}})[_0x3c97('0x35')](respondWithFilteredResult(_0x3ab731,_0x3c05d4))[_0x3c97('0x28')](handleError(_0x3ab731,null));};exports[_0x3c97('0x68')]=function(_0x2023b8,_0x13a3cb,_0xcc0b49){return db['MailAccount']['find']({'where':{'id':_0x2023b8[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x13a3cb,null))['then'](function(_0x549122){if(_0x549122){return _0x549122[_0x3c97('0x68')](_0x2023b8[_0x3c97('0x4a')][_0x3c97('0x69')]);}})['then'](respondWithStatusCode(_0x13a3cb,null))[_0x3c97('0x28')](handleError(_0x13a3cb,null));};exports[_0x3c97('0x6a')]=function(_0x1ee5a9,_0x26d4ac,_0x207da8){if(_0x1ee5a9['body']['id']){delete _0x1ee5a9[_0x3c97('0x5d')]['id'];}return db[_0x3c97('0x42')][_0x3c97('0x5e')]({'where':{'id':_0x1ee5a9[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x26d4ac,null))[_0x3c97('0x35')](function(_0x3afb71){if(_0x3afb71){_0x1ee5a9[_0x3c97('0x5d')][_0x3c97('0x65')]=_0x3afb71['id'];return db[_0x3c97('0x6b')][_0x3c97('0x61')](_0x1ee5a9['body']);}})[_0x3c97('0x35')](respondWithResult(_0x26d4ac,null))[_0x3c97('0x28')](handleError(_0x26d4ac,null));};exports[_0x3c97('0x6c')]=function(_0x53bfe9,_0x2f8be3,_0x4567a0){var _0x3995df={'raw':![],'where':{}};var _0x21f370={};var _0x1c267f={'count':0x0,'rows':[]};return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x53bfe9[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x2f8be3,null))['then'](function(_0x36e151){if(_0x36e151){_0x21f370[_0x3c97('0x49')]=_['keys'](db[_0x3c97('0x6b')][_0x3c97('0x5a')]);_0x21f370[_0x3c97('0x4a')]=_['keys'](_0x53bfe9[_0x3c97('0x4a')]);_0x21f370['filters']=_['intersection'](_0x21f370['model'],_0x21f370['query']);_0x3995df['attributes']=_[_0x3c97('0x48')](_0x21f370[_0x3c97('0x49')],qs['fields'](_0x53bfe9['query'][_0x3c97('0x4c')]));_0x3995df['attributes']=_0x3995df[_0x3c97('0x4b')][_0x3c97('0x5b')]?_0x3995df[_0x3c97('0x4b')]:_0x21f370['model'];if(!_0x53bfe9[_0x3c97('0x4a')][_0x3c97('0x4d')](_0x3c97('0x6d'))){_0x3995df[_0x3c97('0x30')]=qs[_0x3c97('0x30')](_0x53bfe9['query'][_0x3c97('0x30')]);_0x3995df['offset']=qs[_0x3c97('0x2d')](_0x53bfe9[_0x3c97('0x4a')][_0x3c97('0x2d')]);}_0x3995df['order']=qs[_0x3c97('0x4f')](_0x53bfe9['query'][_0x3c97('0x4f')]);_0x3995df[_0x3c97('0x52')]=qs[_0x3c97('0x50')](_[_0x3c97('0x64')](_0x53bfe9['query'],_0x21f370[_0x3c97('0x50')]));_0x3995df[_0x3c97('0x52')][_0x3c97('0x65')]=_0x36e151['id'];if(_0x53bfe9[_0x3c97('0x4a')][_0x3c97('0x51')]){_0x3995df['where']=_[_0x3c97('0x53')](_0x3995df[_0x3c97('0x52')],{'$or':_[_0x3c97('0x46')](_0x3995df['attributes'],function(_0x370f9f){var _0x595fb3={};_0x595fb3[_0x370f9f]={'$like':'%'+_0x53bfe9[_0x3c97('0x4a')][_0x3c97('0x51')]+'%'};return _0x595fb3;})});}_0x3995df=_[_0x3c97('0x53')]({},_0x3995df,_0x53bfe9[_0x3c97('0x55')]);return db[_0x3c97('0x6b')][_0x3c97('0x2f')]({'where':_0x3995df['where']})[_0x3c97('0x35')](function(_0x143a37){_0x1c267f[_0x3c97('0x2f')]=_0x143a37;if(_0x53bfe9[_0x3c97('0x4a')][_0x3c97('0x56')]){_0x3995df[_0x3c97('0x5c')]=[{'all':!![]}];}return db[_0x3c97('0x6b')][_0x3c97('0x66')](_0x3995df);})[_0x3c97('0x35')](function(_0x134f40){_0x1c267f[_0x3c97('0x67')]=_0x134f40;return _0x1c267f;});}})['then'](respondWithFilteredResult(_0x2f8be3,_0x3995df))[_0x3c97('0x28')](handleError(_0x2f8be3,null));};exports[_0x3c97('0x6e')]=function(_0x290f1d,_0x34c8c5,_0x4db7e3){return db[_0x3c97('0x42')][_0x3c97('0x5e')]({'where':{'id':_0x290f1d[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x34c8c5,null))[_0x3c97('0x35')](function(_0x36e7b6){if(_0x36e7b6){return _0x36e7b6[_0x3c97('0x6e')](_0x290f1d['query'][_0x3c97('0x69')]);}})[_0x3c97('0x35')](respondWithStatusCode(_0x34c8c5,null))[_0x3c97('0x28')](handleError(_0x34c8c5,null));};exports['create']=function(_0x15340d,_0xc779a){var _0x31370e={'name':_0x15340d[_0x3c97('0x5d')]['name'],'key':_0x15340d[_0x3c97('0x5d')][_0x3c97('0x45')],'email':_0x15340d[_0x3c97('0x5d')][_0x3c97('0x6f')],'ListId':_0x15340d[_0x3c97('0x5d')][_0x3c97('0x70')],'active':!_['isNil'](_0x15340d[_0x3c97('0x5d')][_0x3c97('0x71')])?_0x15340d[_0x3c97('0x5d')][_0x3c97('0x71')]:!![],'description':_0x15340d['body'][_0x3c97('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x3c97('0x73')](_0x15340d[_0x3c97('0x5d')][_0x3c97('0x74')])){if(_0x15340d[_0x3c97('0x5d')][_0x3c97('0x75')]){_0x31370e['Imap'][_0x3c97('0x76')]=_0x31370e['Smtp'][_0x3c97('0x76')]=_0x15340d[_0x3c97('0x5d')][_0x3c97('0x77')];_0x31370e[_0x3c97('0x3f')]['password']=_0x31370e[_0x3c97('0x41')]['pass']=_0x15340d['body'][_0x3c97('0x78')];}else{_0x31370e[_0x3c97('0x3f')][_0x3c97('0x79')]=_0x31370e[_0x3c97('0x41')][_0x3c97('0x79')]=![];}_0x31370e[_0x3c97('0x3f')][_0x3c97('0x7a')]=_0x15340d[_0x3c97('0x5d')]['Imap']['host'];_0x31370e[_0x3c97('0x3f')][_0x3c97('0x7b')]=_0x15340d[_0x3c97('0x5d')][_0x3c97('0x3f')]['port'];_0x31370e['Smtp']['host']=_0x15340d[_0x3c97('0x5d')][_0x3c97('0x41')][_0x3c97('0x7a')];_0x31370e[_0x3c97('0x41')][_0x3c97('0x7b')]=_0x15340d[_0x3c97('0x5d')][_0x3c97('0x41')][_0x3c97('0x7b')];}else{_0x31370e[_0x3c97('0x3f')]['service']=_0x31370e['Smtp']['service']=_0x15340d[_0x3c97('0x5d')]['cservice'];_0x31370e[_0x3c97('0x3f')]['user']=_0x31370e['Smtp']['user']=_0x15340d[_0x3c97('0x5d')][_0x3c97('0x77')];_0x31370e['Imap']['password']=_0x31370e[_0x3c97('0x41')][_0x3c97('0x7c')]=_0x15340d[_0x3c97('0x5d')][_0x3c97('0x78')];}return db[_0x3c97('0x42')][_0x3c97('0x61')](_0x31370e,{'include':[{'model':db[_0x3c97('0x40')],'as':_0x3c97('0x41')},{'model':db[_0x3c97('0x3e')],'as':'Imap'}]})[_0x3c97('0x35')](function(_0x4b6694){var _0x19f767=_0x15340d[_0x3c97('0x76')][_0x3c97('0x37')]({'plain':!![]});if(!_0x19f767)throw new Error(_0x3c97('0x7d'));if(_0x19f767[_0x3c97('0x7e')]===_0x3c97('0x76')){var _0x27cca4=_0x4b6694['get']({'plain':!![]});return db[_0x3c97('0x7f')]['find']({'where':{'name':_0x3c97('0x38'),'userProfileId':_0x19f767[_0x3c97('0x80')]},'raw':!![]})[_0x3c97('0x35')](function(_0x7bbd02){if(_0x7bbd02&&_0x7bbd02['autoAssociation']===0x0){return db['UserProfileResource'][_0x3c97('0x61')]({'name':_0x27cca4[_0x3c97('0x3b')],'resourceId':_0x27cca4['id'],'type':_0x7bbd02[_0x3c97('0x3b')],'sectionId':_0x7bbd02['id']},{})['then'](function(){return _0x4b6694;});}else{return _0x4b6694;}})[_0x3c97('0x28')](function(_0x5e31cf){logger[_0x3c97('0x25')](_0x3c97('0x81'),_0x5e31cf);throw _0x5e31cf;});}return _0x4b6694;})[_0x3c97('0x35')](respondWithResult(_0xc779a,0xc9))[_0x3c97('0x28')](handleError(_0xc779a,null));};exports[_0x3c97('0x82')]=function(_0x2b8415,_0x2e95ac,_0x3d697e){return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x2b8415[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x2e95ac,null))[_0x3c97('0x35')](function(_0x184b1b){if(_0x184b1b){return _0x184b1b[_0x3c97('0x82')]();}return null;})['then'](respondWithResult(_0x2e95ac,null))[_0x3c97('0x28')](handleError(_0x2e95ac,null));};exports[_0x3c97('0x83')]=function(_0x115ea2,_0x5c2535,_0x2322c9){if(_0x115ea2[_0x3c97('0x5d')]['id']){delete _0x115ea2['body']['id'];}return db['MailAccount'][_0x3c97('0x5e')]({'where':{'id':_0x115ea2[_0x3c97('0x58')]['id']}})['then'](handleEntityNotFound(_0x5c2535,null))[_0x3c97('0x35')](function(_0x34682d){if(_0x34682d){_0x115ea2[_0x3c97('0x5d')]['MailAccountId']=_0x34682d['id'];return db['MailServerIn'][_0x3c97('0x61')](_0x115ea2[_0x3c97('0x5d')]);}})['then'](respondWithResult(_0x5c2535,null))[_0x3c97('0x28')](handleError(_0x5c2535,null));};exports[_0x3c97('0x84')]=function(_0x37368c,_0x496b65,_0x5559d6){return db[_0x3c97('0x42')]['findOne']({'where':{'id':_0x37368c[_0x3c97('0x58')]['id']}})['then'](handleEntityNotFound(_0x496b65,null))['then'](function(_0x5bfa71){if(_0x5bfa71){return _0x5bfa71[_0x3c97('0x85')](null);}return null;})[_0x3c97('0x35')](respondWithStatusCode(_0x496b65,null))[_0x3c97('0x28')](handleError(_0x496b65,null));};exports[_0x3c97('0x86')]=function(_0x31c95d,_0x1dc6e4,_0x1c6423){return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x31c95d[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x1dc6e4,null))['then'](function(_0x7a182d){if(_0x7a182d){return _0x7a182d[_0x3c97('0x86')]();}return null;})[_0x3c97('0x35')](respondWithResult(_0x1dc6e4,null))[_0x3c97('0x28')](handleError(_0x1dc6e4,null));};exports[_0x3c97('0x87')]=function(_0x1243e1,_0x4355d0,_0x16634a){if(_0x1243e1[_0x3c97('0x5d')]['id']){delete _0x1243e1[_0x3c97('0x5d')]['id'];}return db[_0x3c97('0x42')]['find']({'where':{'id':_0x1243e1[_0x3c97('0x58')]['id']}})['then'](handleEntityNotFound(_0x4355d0,null))['then'](function(_0x3f03e5){if(_0x3f03e5){_0x1243e1[_0x3c97('0x5d')][_0x3c97('0x65')]=_0x3f03e5['id'];return db[_0x3c97('0x40')][_0x3c97('0x61')](_0x1243e1[_0x3c97('0x5d')]);}})[_0x3c97('0x35')](respondWithResult(_0x4355d0,null))['catch'](handleError(_0x4355d0,null));};exports[_0x3c97('0x88')]=function(_0x413f6e,_0x77d873,_0x33b208){return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x413f6e[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x77d873,null))[_0x3c97('0x35')](function(_0x453abd){if(_0x453abd){return _0x453abd[_0x3c97('0x89')](null);}return null;})['then'](respondWithStatusCode(_0x77d873,null))['catch'](handleError(_0x77d873,null));};exports['addInteraction']=function(_0x529810,_0x466a82,_0x3a7cb5){return db['MailInteraction'][_0x3c97('0x5e')]({'where':{'id':_0x529810[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x466a82,null))[_0x3c97('0x35')](function(_0x36c77f){if(_0x36c77f){return _0x36c77f[_0x3c97('0x8a')](_0x529810[_0x3c97('0x5d')][_0x3c97('0x69')],_[_0x3c97('0x8b')](_0x529810[_0x3c97('0x5d')],[_0x3c97('0x69'),'id'])||{});}})[_0x3c97('0x35')](respondWithResult(_0x466a82,null))[_0x3c97('0x28')](handleError(_0x466a82,null));};exports['getInteractions']=function(_0x2eaa49,_0x170c54,_0x4667d1){var _0x392229={'raw':![],'where':{}};var _0x1445a6={};var _0x401a4f={'count':0x0,'rows':[]};return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x2eaa49[_0x3c97('0x58')]['id']}})['then'](handleEntityNotFound(_0x170c54,null))[_0x3c97('0x35')](function(_0x1f9529){if(_0x1f9529){_0x1445a6['model']=_[_0x3c97('0x47')](db[_0x3c97('0x8c')][_0x3c97('0x5a')]);_0x1445a6[_0x3c97('0x4a')]=_[_0x3c97('0x47')](_0x2eaa49[_0x3c97('0x4a')]);_0x1445a6[_0x3c97('0x50')]=_[_0x3c97('0x48')](_0x1445a6[_0x3c97('0x49')],_0x1445a6['query']);_0x392229[_0x3c97('0x4b')]=_[_0x3c97('0x48')](_0x1445a6[_0x3c97('0x49')],qs[_0x3c97('0x4c')](_0x2eaa49['query'][_0x3c97('0x4c')]));_0x392229[_0x3c97('0x4b')]=_0x392229[_0x3c97('0x4b')][_0x3c97('0x5b')]?_0x392229[_0x3c97('0x4b')]:_0x1445a6[_0x3c97('0x49')];if(!_0x2eaa49[_0x3c97('0x4a')]['hasOwnProperty']('nolimit')){_0x392229[_0x3c97('0x30')]=qs[_0x3c97('0x30')](_0x2eaa49['query']['limit']);_0x392229[_0x3c97('0x2d')]=qs[_0x3c97('0x2d')](_0x2eaa49[_0x3c97('0x4a')][_0x3c97('0x2d')]);}_0x392229['order']=qs[_0x3c97('0x4f')](_0x2eaa49[_0x3c97('0x4a')][_0x3c97('0x4f')]);_0x392229[_0x3c97('0x52')]=qs['filters'](_[_0x3c97('0x64')](_0x2eaa49['query'],_0x1445a6[_0x3c97('0x50')]));_0x392229[_0x3c97('0x52')]['MailAccountId']=_0x1f9529['id'];if(_0x2eaa49[_0x3c97('0x4a')][_0x3c97('0x51')]){_0x392229[_0x3c97('0x52')]=_[_0x3c97('0x53')](_0x392229['where'],{'$or':_[_0x3c97('0x46')](_0x392229[_0x3c97('0x4b')],function(_0x1e5c5c){var _0x26fa91={};_0x26fa91[_0x1e5c5c]={'$like':'%'+_0x2eaa49[_0x3c97('0x4a')][_0x3c97('0x51')]+'%'};return _0x26fa91;})});}_0x392229=_['merge']({},_0x392229,_0x2eaa49[_0x3c97('0x55')]);return db[_0x3c97('0x8c')][_0x3c97('0x2f')]({'where':_0x392229['where']})[_0x3c97('0x35')](function(_0x3a8491){_0x401a4f[_0x3c97('0x2f')]=_0x3a8491;if(_0x2eaa49['query'][_0x3c97('0x56')]){_0x392229[_0x3c97('0x5c')]=[{'model':db[_0x3c97('0x8d')],'as':_0x3c97('0x8e'),'required':![]},{'model':db['User'],'as':_0x3c97('0x8f'),'attributes':[_0x3c97('0x3b'),_0x3c97('0x90'),_0x3c97('0x91')],'required':![]},{'model':db[_0x3c97('0x92')],'as':'Tags','attributes':['id',_0x3c97('0x3b'),_0x3c97('0x93')],'where':_0x2eaa49[_0x3c97('0x4a')][_0x3c97('0x94')]?{'id':_0x2eaa49[_0x3c97('0x4a')][_0x3c97('0x94')]}:undefined,'required':_0x2eaa49[_0x3c97('0x4a')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x3c97('0x66')](_0x392229);})[_0x3c97('0x35')](function(_0x14bb30){_0x401a4f[_0x3c97('0x67')]=_0x14bb30;return _0x401a4f;});}})['then'](respondWithFilteredResult(_0x170c54,_0x392229))[_0x3c97('0x28')](handleError(_0x170c54,null));};exports['addApplications']=function(_0x33c19b,_0x33b36e,_0x92ec0d){return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x33c19b[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x33b36e,null))['then'](function(_0x37a97d){if(_0x37a97d){return db['sequelize'][_0x3c97('0x95')](function(_0x4c4a84){return db[_0x3c97('0x96')]['destroy']({'where':{'MailAccountId':_0x33c19b[_0x3c97('0x58')]['id']},'transaction':_0x4c4a84})[_0x3c97('0x35')](function(_0x2ad354){var _0x77c13d=_[_0x3c97('0x46')](_0x33c19b[_0x3c97('0x5d')],function(_0xba98c2){_0xba98c2[_0x3c97('0x65')]=_0x33c19b[_0x3c97('0x58')]['id'];return _0xba98c2;});return db[_0x3c97('0x96')]['bulkCreate'](_0x77c13d,{'transaction':_0x4c4a84});});})[_0x3c97('0x35')](function(){return db['MailApplication'][_0x3c97('0x97')]({'where':{'MailAccountId':_0x33c19b[_0x3c97('0x58')]['id']},'order':_0x3c97('0x98')});});}})[_0x3c97('0x35')](respondWithResult(_0x33b36e,null))[_0x3c97('0x28')](handleError(_0x33b36e,null));};exports[_0x3c97('0x99')]=function(_0x360c80,_0x3bbd5a,_0x535ac7){var _0x247a53={};var _0x90e980={};var _0x7c1b94;var _0x215f0c;return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x360c80[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x3bbd5a,null))[_0x3c97('0x35')](function(_0x4b20f3){if(_0x4b20f3){_0x7c1b94=_0x4b20f3;_0x90e980[_0x3c97('0x49')]=_[_0x3c97('0x47')](db[_0x3c97('0x96')]['rawAttributes']);_0x90e980[_0x3c97('0x4a')]=_[_0x3c97('0x47')](_0x360c80[_0x3c97('0x4a')]);_0x90e980[_0x3c97('0x50')]=_[_0x3c97('0x48')](_0x90e980[_0x3c97('0x49')],_0x90e980[_0x3c97('0x4a')]);_0x247a53[_0x3c97('0x4b')]=_[_0x3c97('0x48')](_0x90e980[_0x3c97('0x49')],qs['fields'](_0x360c80[_0x3c97('0x4a')][_0x3c97('0x4c')]));_0x247a53[_0x3c97('0x4b')]=_0x247a53['attributes'][_0x3c97('0x5b')]?_0x247a53[_0x3c97('0x4b')]:_0x90e980[_0x3c97('0x49')];_0x247a53[_0x3c97('0x4e')]=qs[_0x3c97('0x4f')](_0x360c80['query'][_0x3c97('0x4f')]);_0x247a53[_0x3c97('0x52')]=qs[_0x3c97('0x50')](_[_0x3c97('0x64')](_0x360c80[_0x3c97('0x4a')],_0x90e980[_0x3c97('0x50')]));if(_0x360c80['query'][_0x3c97('0x51')]){_0x247a53[_0x3c97('0x52')]=_['merge'](_0x247a53[_0x3c97('0x52')],{'$or':_[_0x3c97('0x46')](_0x247a53[_0x3c97('0x4b')],function(_0xd26486){var _0x1bd774={};_0x1bd774[_0xd26486]={'$like':'%'+_0x360c80[_0x3c97('0x4a')][_0x3c97('0x51')]+'%'};return _0x1bd774;})});}_0x247a53=_[_0x3c97('0x53')]({},_0x247a53,_0x360c80[_0x3c97('0x55')]);return _0x7c1b94[_0x3c97('0x99')](_0x247a53);}})[_0x3c97('0x35')](function(_0x5b001f){if(_0x5b001f){_0x215f0c=_0x5b001f[_0x3c97('0x5b')];if(!_0x360c80[_0x3c97('0x4a')][_0x3c97('0x4d')]('nolimit')){_0x247a53[_0x3c97('0x30')]=qs[_0x3c97('0x30')](_0x360c80[_0x3c97('0x4a')][_0x3c97('0x30')]);_0x247a53['offset']=qs['offset'](_0x360c80['query'][_0x3c97('0x2d')]);}return _0x7c1b94['getApplications'](_0x247a53);}})[_0x3c97('0x35')](function(_0x2ed6e8){if(_0x2ed6e8){return _0x2ed6e8?{'count':_0x215f0c,'rows':_0x2ed6e8}:null;}})[_0x3c97('0x35')](respondWithResult(_0x3bbd5a,null))[_0x3c97('0x28')](handleError(_0x3bbd5a,null));};exports[_0x3c97('0x9a')]=function(_0x508d3c,_0x2e18a0,_0x251f5a){var _0x27e3c5={'raw':!![],'where':{}};var _0x303718={};var _0x444814={'count':0x0,'rows':[]};return db[_0x3c97('0x42')][_0x3c97('0x63')]({'where':{'id':_0x508d3c['params']['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x2e18a0,null))[_0x3c97('0x35')](function(_0x34ab6b){if(_0x34ab6b){_0x303718['model']=_['keys'](db[_0x3c97('0x9b')][_0x3c97('0x5a')]);_0x303718[_0x3c97('0x4a')]=_[_0x3c97('0x47')](_0x508d3c[_0x3c97('0x4a')]);_0x303718[_0x3c97('0x50')]=_['intersection'](_0x303718[_0x3c97('0x49')],_0x303718[_0x3c97('0x4a')]);_0x27e3c5[_0x3c97('0x4b')]=_[_0x3c97('0x48')](_0x303718[_0x3c97('0x49')],qs[_0x3c97('0x4c')](_0x508d3c[_0x3c97('0x4a')]['fields']));_0x27e3c5[_0x3c97('0x4b')]=_0x27e3c5[_0x3c97('0x4b')][_0x3c97('0x5b')]?_0x27e3c5[_0x3c97('0x4b')]:_0x303718['model'];if(!_0x508d3c['query']['hasOwnProperty'](_0x3c97('0x6d'))){_0x27e3c5['limit']=qs[_0x3c97('0x30')](_0x508d3c[_0x3c97('0x4a')][_0x3c97('0x30')]);_0x27e3c5[_0x3c97('0x2d')]=qs[_0x3c97('0x2d')](_0x508d3c[_0x3c97('0x4a')][_0x3c97('0x2d')]);}_0x27e3c5[_0x3c97('0x4e')]=qs['sort'](_0x508d3c['query'][_0x3c97('0x4f')]);_0x27e3c5[_0x3c97('0x52')]=qs['filters'](_['pick'](_0x508d3c[_0x3c97('0x4a')],_0x303718['filters']));_0x27e3c5[_0x3c97('0x52')]['MailAccountId']=_0x34ab6b['id'];if(_0x508d3c[_0x3c97('0x4a')]['filter']){_0x27e3c5[_0x3c97('0x52')]=_[_0x3c97('0x53')](_0x27e3c5[_0x3c97('0x52')],{'$or':_[_0x3c97('0x46')](_0x27e3c5[_0x3c97('0x4b')],function(_0x50706e){var _0x49ff63={};_0x49ff63[_0x50706e]={'$like':'%'+_0x508d3c['query'][_0x3c97('0x51')]+'%'};return _0x49ff63;})});}if(_0x508d3c['query']['$gte']){var _0x59da32=_0x508d3c[_0x3c97('0x4a')]['$gte'][_0x3c97('0x9c')](',');var _0x55e7c1={};_0x55e7c1[_0x59da32[0x0]]={'$gte':moment(_0x59da32[0x1])[_0x3c97('0x9d')](_0x3c97('0x9e'))};_0x27e3c5[_0x3c97('0x52')]=_[_0x3c97('0x53')](_0x27e3c5[_0x3c97('0x52')],_0x55e7c1);}_0x27e3c5=_[_0x3c97('0x53')]({},_0x27e3c5,_0x508d3c[_0x3c97('0x55')]);return db[_0x3c97('0x9b')]['count']({'where':_0x27e3c5[_0x3c97('0x52')]})[_0x3c97('0x35')](function(_0x3c5da9){_0x444814[_0x3c97('0x2f')]=_0x3c5da9;if(_0x508d3c['query'][_0x3c97('0x56')]){_0x27e3c5[_0x3c97('0x5c')]=[{'all':!![]}];}return db['MailMessage'][_0x3c97('0x66')](_0x27e3c5);})[_0x3c97('0x35')](function(_0x2d00f1){if(_0x508d3c[_0x3c97('0x4a')]['inlineCss']===_0x3c97('0x9f')){for(var _0x3c1e8b=0x0;_0x3c1e8b<_0x2d00f1['length'];_0x3c1e8b++){_0x2d00f1[_0x3c1e8b][_0x3c97('0x5d')]=juice(_0x2d00f1[_0x3c1e8b][_0x3c97('0x5d')]);}}_0x444814[_0x3c97('0x67')]=_0x2d00f1;return _0x444814;});}})[_0x3c97('0x35')](respondWithFilteredResult(_0x2e18a0,_0x27e3c5))[_0x3c97('0x28')](handleError(_0x2e18a0,null));};exports[_0x3c97('0x3c')]=function(_0x3220f6,_0x339c78,_0x35e670){var _0x17da5e,_0x39120f={},_0x4fe2f0;if(_0x3220f6['body']['to']){_0x4fe2f0=_0x3220f6[_0x3c97('0x5d')]['to'][_0x3c97('0x9c')](',')[0x0];}return db['MailAccount'][_0x3c97('0x5e')]({'where':{'id':_0x3220f6[_0x3c97('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x3c97('0xa0'),'include':[{'model':db[_0x3c97('0x8d')],'as':'Contacts','where':{'email':_0x4fe2f0},'limit':0x1,'order':[[_0x3c97('0xa1'),'DESC']]}]},{'model':db[_0x3c97('0x40')],'as':_0x3c97('0x41'),'raw':!![]}]})[_0x3c97('0x35')](handleEntityNotFound(_0x339c78,null))[_0x3c97('0x35')](function(_0x27ae03){if(_0x27ae03){_0x17da5e=_0x27ae03;if(_0x27ae03['Smtp']){if(_[_0x3c97('0x73')](_0x3220f6[_0x3c97('0x5d')][_0x3c97('0xa2')])){_0x3220f6[_0x3c97('0x5d')][_0x3c97('0xa2')]=util[_0x3c97('0x9d')](_0x3c97('0xa3'),_0x27ae03[_0x3c97('0x3b')],_0x27ae03[_0x3c97('0x6f')]||_0x27ae03[_0x3c97('0x41')][_0x3c97('0x76')]);}if(_0x3220f6['body']['attachments']&&_0x3220f6[_0x3c97('0x5d')]['attachments'][_0x3c97('0x5b')]){for(var _0x5afe65=0x0;_0x5afe65<_0x3220f6[_0x3c97('0x5d')]['attachments']['length'];_0x5afe65+=0x1){_0x3220f6[_0x3c97('0x5d')][_0x3c97('0xa4')][_0x5afe65]={'filename':_0x3220f6[_0x3c97('0x5d')][_0x3c97('0xa4')][_0x5afe65][_0x3c97('0x3b')],'path':path['join'](config['root'],_0x3c97('0xa5'),_0x3220f6[_0x3c97('0x5d')]['attachments'][_0x5afe65][_0x3c97('0xa6')])};}}var _0x8e6325={'tls':{'rejectUnauthorized':![]}};if(_[_0x3c97('0x73')](_0x27ae03[_0x3c97('0x41')][_0x3c97('0xa7')])){if(_0x27ae03[_0x3c97('0x41')][_0x3c97('0x79')]){_0x8e6325[_0x3c97('0xa8')]={'user':_0x27ae03[_0x3c97('0x41')]['user'],'pass':_0x27ae03[_0x3c97('0x41')][_0x3c97('0x7c')]};}_0x8e6325[_0x3c97('0x7a')]=_0x27ae03['Smtp'][_0x3c97('0x7a')];_0x8e6325[_0x3c97('0x7b')]=_0x27ae03['Smtp'][_0x3c97('0x7b')];_0x8e6325[_0x3c97('0xa9')]=_0x27ae03[_0x3c97('0x41')][_0x3c97('0xa9')];}else{_0x8e6325[_0x3c97('0xa7')]=_0x27ae03[_0x3c97('0x41')]['service'];_0x8e6325[_0x3c97('0xa8')]={'user':_0x27ae03['Smtp'][_0x3c97('0x76')],'pass':_0x27ae03['Smtp'][_0x3c97('0x7c')]};}return respondWithRpcPromise(_0x3c97('0xaa'),'sendMail',{'account':_0x8e6325,'message':_0x3220f6[_0x3c97('0x5d')]});}else{throw new Error(_0x3c97('0xab'));}}})[_0x3c97('0x35')](function(_0x2adf9f){if(_0x2adf9f){_0x39120f=_0x2adf9f;if(_0x17da5e[_0x3c97('0xa0')]){if(_0x17da5e[_0x3c97('0xa0')][_0x3c97('0xac')][_0x3c97('0x5b')]){return _0x17da5e[_0x3c97('0xa0')][_0x3c97('0xac')][0x0];}else{return db['CmContact'][_0x3c97('0x61')](_[_0x3c97('0x1d')](_0x3220f6[_0x3c97('0x5d')],{'firstName':_0x3220f6[_0x3c97('0x5d')]['to'],'email':_0x3220f6[_0x3c97('0x5d')]['to'],'phone':_0x3220f6[_0x3c97('0x5d')]['to'],'ListId':_0x17da5e[_0x3c97('0x70')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x3c97('0x35')](function(_0x28f104){if(_0x28f104){var _0x56adcc={'UserId':_0x3220f6[_0x3c97('0x76')]['id'],'ContactId':_0x28f104['id'],'MailAccountId':_0x17da5e['id'],'inReplyTo':_0x39120f[_0x3c97('0xad')],'to':_0x3220f6[_0x3c97('0x5d')][_0x3c97('0xa2')],'cc':_0x3220f6[_0x3c97('0x5d')]['cc'],'subject':_0x3220f6['body'][_0x3c97('0xae')],'attach':_0x3220f6['body']['attach'],'firstMsgDirection':_0x3c97('0xaf'),'lastMsgAt':moment()[_0x3c97('0x9d')](_0x3c97('0x9e')),'lastMsgDirection':_0x3c97('0xaf'),'Messages':[_[_0x3c97('0x53')](_0x3220f6['body'],{'messageId':_0x39120f[_0x3c97('0xad')],'sentAt':moment()[_0x3c97('0x9d')](_0x3c97('0x9e')),'read':!![],'MailAccountId':_0x17da5e['id'],'UserId':_0x3220f6[_0x3c97('0x76')]['id'],'ContactId':_0x28f104['id']})]};if(_0x3220f6['body'][_0x3c97('0xb0')]){_0x56adcc=_[_0x3c97('0x53')](_0x56adcc,_0x3220f6[_0x3c97('0x5d')][_0x3c97('0xb0')]);}return db[_0x3c97('0x8c')][_0x3c97('0x61')](_0x56adcc,{'include':[{'model':db[_0x3c97('0x9b')],'as':_0x3c97('0xb1')}]});}})[_0x3c97('0x35')](respondWithResult(_0x339c78,null))['catch'](handleError(_0x339c78,null));};exports[_0x3c97('0xb2')]=function(_0x2dfa61,_0x231df4,_0x1ea2d7){return db[_0x3c97('0x42')]['find']({'where':{'id':_0x2dfa61['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x3c97('0x41'),'raw':!![]}]})[_0x3c97('0x35')](handleEntityNotFound(_0x231df4,null))[_0x3c97('0x35')](function(_0x4b6587){if(_0x4b6587&&_0x4b6587[_0x3c97('0x41')]){var _0x22dbb9={'id':_0x4b6587['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4b6587[_0x3c97('0x41')][_0x3c97('0xa7')]){_0x22dbb9[_0x3c97('0xa7')]=_0x4b6587[_0x3c97('0x41')][_0x3c97('0xa7')];}else{_0x22dbb9['host']=_0x4b6587['Smtp'][_0x3c97('0x7a')];_0x22dbb9['port']=_0x4b6587['Smtp'][_0x3c97('0x7b')];_0x22dbb9[_0x3c97('0xa9')]=_0x4b6587[_0x3c97('0x41')][_0x3c97('0xa9')];}if(_0x4b6587[_0x3c97('0x41')][_0x3c97('0x79')]){_0x22dbb9['auth']={'user':_0x4b6587[_0x3c97('0x41')][_0x3c97('0x76')],'pass':_0x4b6587['Smtp'][_0x3c97('0x7c')]};}return respondWithRpcPromise('VerifySmtp',_0x3c97('0xb2'),{'account':_0x22dbb9});}})['then'](respondWithResult(_0x231df4,null))[_0x3c97('0x28')](handleError(_0x231df4,null));};exports['destroy']=function(_0x3cd38d,_0x8e732){return db[_0x3c97('0x42')][_0x3c97('0x5e')]({'where':{'id':_0x3cd38d[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x8e732,null))[_0x3c97('0x35')](function(_0x1aad31){if(_0x1aad31&&_0x1aad31[_0x3c97('0xa7')]){throw new db['Sequelize'][(_0x3c97('0xb3'))](_0x3c97('0xb4'));}return _0x1aad31;})[_0x3c97('0x35')](removeEntity(_0x8e732,null))[_0x3c97('0x28')](handleError(_0x8e732,null));};exports[_0x3c97('0xb5')]=function(_0x58e138,_0x5d47d0,_0x4ad698){return db[_0x3c97('0x42')][_0x3c97('0x5e')]({'where':{'id':_0x58e138['params']['id']}})['then'](handleEntityNotFound(_0x5d47d0,null))['then'](function(_0x1a7dce){if(_0x1a7dce){return _0x1a7dce[_0x3c97('0xb5')](_0x58e138['body'][_0x3c97('0x69')],_[_0x3c97('0x8b')](_0x58e138['body'],['ids','id'])||{})['spread'](function(_0x22cde0){for(var _0x509d2a=0x0;_0x509d2a<_0x58e138[_0x3c97('0x5d')][_0x3c97('0x69')]['length'];_0x509d2a+=0x1){socket[_0x3c97('0xb6')](_0x3c97('0xb7'),{'UserId':Number(_0x58e138[_0x3c97('0x5d')][_0x3c97('0x69')][_0x509d2a]),'MailAccountId':Number(_0x58e138[_0x3c97('0x58')]['id'])});}return _0x22cde0;});}})[_0x3c97('0x35')](respondWithResult(_0x5d47d0,null))[_0x3c97('0x28')](handleError(_0x5d47d0,null));};exports[_0x3c97('0xb8')]=function(_0x5933ea,_0x44dc67,_0x26c118){return db[_0x3c97('0x42')][_0x3c97('0x5e')]({'where':{'id':_0x5933ea['params']['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x44dc67,null))[_0x3c97('0x35')](function(_0x269177){if(_0x269177){return _0x269177[_0x3c97('0xb8')](_0x5933ea['query'][_0x3c97('0x69')])[_0x3c97('0x35')](function(){if(_['isArray'](_0x5933ea[_0x3c97('0x4a')][_0x3c97('0x69')])){for(var _0x2e1aca=0x0;_0x2e1aca<_0x5933ea[_0x3c97('0x4a')]['ids'][_0x3c97('0x5b')];_0x2e1aca+=0x1){socket['emit'](_0x3c97('0xb9'),{'UserId':Number(_0x5933ea[_0x3c97('0x4a')]['ids'][_0x2e1aca]),'MailAccountId':Number(_0x5933ea[_0x3c97('0x58')]['id'])});}}else{socket[_0x3c97('0xb6')](_0x3c97('0xb9'),{'UserId':Number(_0x5933ea[_0x3c97('0x4a')][_0x3c97('0x69')]),'MailAccountId':Number(_0x5933ea[_0x3c97('0x58')]['id'])});}});}})[_0x3c97('0x35')](respondWithStatusCode(_0x44dc67,null))[_0x3c97('0x28')](handleError(_0x44dc67,null));};exports[_0x3c97('0xba')]=function(_0x508c75,_0x420610,_0x511de3){var _0x7a3d5a={};var _0x253f5a={};var _0x312203;var _0x1a2ac6;return db['MailAccount'][_0x3c97('0x63')]({'where':{'id':_0x508c75[_0x3c97('0x58')]['id']}})[_0x3c97('0x35')](handleEntityNotFound(_0x420610,null))[_0x3c97('0x35')](function(_0x44fbf6){if(_0x44fbf6){_0x312203=_0x44fbf6;_0x253f5a[_0x3c97('0x49')]=_[_0x3c97('0x47')](db[_0x3c97('0xbb')][_0x3c97('0x5a')]);_0x253f5a[_0x3c97('0x4a')]=_[_0x3c97('0x47')](_0x508c75[_0x3c97('0x4a')]);_0x253f5a['filters']=_['intersection'](_0x253f5a[_0x3c97('0x49')],_0x253f5a[_0x3c97('0x4a')]);_0x7a3d5a[_0x3c97('0x4b')]=_[_0x3c97('0x48')](_0x253f5a[_0x3c97('0x49')],qs[_0x3c97('0x4c')](_0x508c75[_0x3c97('0x4a')][_0x3c97('0x4c')]));_0x7a3d5a[_0x3c97('0x4b')]=_0x7a3d5a[_0x3c97('0x4b')][_0x3c97('0x5b')]?_0x7a3d5a[_0x3c97('0x4b')]:_0x253f5a[_0x3c97('0x49')];_0x7a3d5a[_0x3c97('0x4e')]=qs[_0x3c97('0x4f')](_0x508c75[_0x3c97('0x4a')][_0x3c97('0x4f')]);_0x7a3d5a[_0x3c97('0x52')]=qs[_0x3c97('0x50')](_[_0x3c97('0x64')](_0x508c75[_0x3c97('0x4a')],_0x253f5a[_0x3c97('0x50')]));if(_0x508c75['query'][_0x3c97('0x51')]){_0x7a3d5a['where']=_[_0x3c97('0x53')](_0x7a3d5a[_0x3c97('0x52')],{'$or':_['map'](_0x7a3d5a['attributes'],function(_0x1830c1){var _0x5a1b23={};_0x5a1b23[_0x1830c1]={'$like':'%'+_0x508c75[_0x3c97('0x4a')]['filter']+'%'};return _0x5a1b23;})});}_0x7a3d5a=_[_0x3c97('0x53')]({},_0x7a3d5a,_0x508c75[_0x3c97('0x55')]);return _0x312203[_0x3c97('0xba')](_0x7a3d5a);}})[_0x3c97('0x35')](function(_0x4fe15e){if(_0x4fe15e){_0x1a2ac6=_0x4fe15e['length'];if(!_0x508c75[_0x3c97('0x4a')][_0x3c97('0x4d')](_0x3c97('0x6d'))){_0x7a3d5a[_0x3c97('0x30')]=qs[_0x3c97('0x30')](_0x508c75[_0x3c97('0x4a')]['limit']);_0x7a3d5a[_0x3c97('0x2d')]=qs[_0x3c97('0x2d')](_0x508c75[_0x3c97('0x4a')][_0x3c97('0x2d')]);}return _0x312203[_0x3c97('0xba')](_0x7a3d5a);}})[_0x3c97('0x35')](function(_0x184510){if(_0x184510){return _0x184510?{'count':_0x1a2ac6,'rows':_0x184510}:null;}})[_0x3c97('0x35')](respondWithResult(_0x420610,null))['catch'](handleError(_0x420610,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4b383cc..bc65240 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 _0x0170=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x443747,_0x514528){var _0x28ef39=function(_0x2717bc){while(--_0x2717bc){_0x443747['push'](_0x443747['shift']());}};_0x28ef39(++_0x514528);}(_0x0170,0x1d6));var _0x0017=function(_0x150251,_0x4fa846){_0x150251=_0x150251-0x0;var _0x4f08d7=_0x0170[_0x150251];return _0x4f08d7;};'use strict';var EventEmitter=require(_0x0017('0x0'));var MailAccount=require(_0x0017('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0017('0x2')](0x0);var events={'afterCreate':_0x0017('0x3'),'afterUpdate':_0x0017('0x4'),'afterDestroy':_0x0017('0x5')};function emitEvent(_0x5ee6e8){return function(_0x20a045,_0x255938,_0x3ba292){MailAccountEvents[_0x0017('0x6')](_0x5ee6e8+':'+_0x20a045['id'],_0x20a045);MailAccountEvents[_0x0017('0x6')](_0x5ee6e8,_0x20a045);_0x3ba292(null);};}for(var e in events){if(events[_0x0017('0x7')](e)){var event=events[e];MailAccount[_0x0017('0x8')](e,emitEvent(event));}}module[_0x0017('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xc2e3=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x66435c,_0x53dae7){var _0x3c4230=function(_0x3ce5ef){while(--_0x3ce5ef){_0x66435c['push'](_0x66435c['shift']());}};_0x3c4230(++_0x53dae7);}(_0xc2e3,0x1f3));var _0x3c2e=function(_0x5f43f0,_0x42fe2c){_0x5f43f0=_0x5f43f0-0x0;var _0x16f96e=_0xc2e3[_0x5f43f0];return _0x16f96e;};'use strict';var EventEmitter=require(_0x3c2e('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3c2e('0x1')](0x0);var events={'afterCreate':_0x3c2e('0x2'),'afterUpdate':_0x3c2e('0x3'),'afterDestroy':_0x3c2e('0x4')};function emitEvent(_0xad0f94){return function(_0x54eb30,_0x35a665,_0x3eef97){MailAccountEvents[_0x3c2e('0x5')](_0xad0f94+':'+_0x54eb30['id'],_0x54eb30);MailAccountEvents[_0x3c2e('0x5')](_0xad0f94,_0x54eb30);_0x3eef97(null);};}for(var e in events){if(events[_0x3c2e('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x3c2e('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 99d4a9c..8d6baf4 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 _0x9932=['./mailAccount.attributes','exports','MailAccount','mail_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2177f2,_0x1c59ab){var _0x3cde07=function(_0x133c95){while(--_0x133c95){_0x2177f2['push'](_0x2177f2['shift']());}};_0x3cde07(++_0x1c59ab);}(_0x9932,0xe8));var _0x2993=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x9932[_0x671369];return _0x33f2b4;};'use strict';var _=require('lodash');var util=require(_0x2993('0x0'));var logger=require(_0x2993('0x1'))(_0x2993('0x2'));var moment=require('moment');var BPromise=require(_0x2993('0x3'));var rp=require(_0x2993('0x4'));var fs=require('fs');var path=require(_0x2993('0x5'));var rimraf=require(_0x2993('0x6'));var config=require(_0x2993('0x7'));var attributes=require(_0x2993('0x8'));module[_0x2993('0x9')]=function(_0x42d630,_0x215f61){return _0x42d630['define'](_0x2993('0xa'),attributes,{'tableName':_0x2993('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd33=['util','api','moment','bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','exports','mail_accounts','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcd33,0xe6));var _0x3cd3=function(_0x31f182,_0x1c03f6){_0x31f182=_0x31f182-0x0;var _0xc5bd97=_0xcd33[_0x31f182];return _0xc5bd97;};'use strict';var _=require(_0x3cd3('0x0'));var util=require(_0x3cd3('0x1'));var logger=require('../../config/logger')(_0x3cd3('0x2'));var moment=require(_0x3cd3('0x3'));var BPromise=require(_0x3cd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cd3('0x5'));var rimraf=require(_0x3cd3('0x6'));var config=require(_0x3cd3('0x7'));var attributes=require(_0x3cd3('0x8'));module[_0x3cd3('0x9')]=function(_0x3262e2,_0x56e8ca){return _0x3262e2['define']('MailAccount',attributes,{'tableName':_0x3cd3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 85196e0..f227526 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 _0xee91=['findAll','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','raw','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','List\x20not\x20found','contact','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','create','Contact\x20not\x20found','update','messageId','interaction','created','MailMessage','attachments','originTo','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount'];(function(_0x5f4ccc,_0x2a581d){var _0x55361d=function(_0x1aa406){while(--_0x1aa406){_0x5f4ccc['push'](_0x5f4ccc['shift']());}};_0x55361d(++_0x2a581d);}(_0xee91,0xc1));var _0x1ee9=function(_0x491fe2,_0x39718c){_0x491fe2=_0x491fe2-0x0;var _0x45aed3=_0xee91[_0x491fe2];return _0x45aed3;};'use strict';var _=require(_0x1ee9('0x0'));var util=require(_0x1ee9('0x1'));var moment=require('moment');var BPromise=require(_0x1ee9('0x2'));var rs=require(_0x1ee9('0x3'));var fs=require('fs');var Redis=require(_0x1ee9('0x4'));var db=require(_0x1ee9('0x5'))['db'];var utils=require(_0x1ee9('0x6'));var logger=require(_0x1ee9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1ee9('0x8'));var client=jayson[_0x1ee9('0x9')][_0x1ee9('0xa')]({'port':0x232c});config[_0x1ee9('0xb')]=_[_0x1ee9('0xc')](config[_0x1ee9('0xb')],{'host':_0x1ee9('0xd'),'port':0x18eb});var socket=require(_0x1ee9('0xe'))(new Redis(config[_0x1ee9('0xb')]));require(_0x1ee9('0xf'))[_0x1ee9('0x10')](socket);function respondWithRpcPromise(_0x2c0c13,_0x25706e,_0x97fe2a){return new BPromise(function(_0x3344ee,_0x2adadf){return client[_0x1ee9('0x11')](_0x2c0c13,_0x97fe2a)[_0x1ee9('0x12')](function(_0x365ff3){logger[_0x1ee9('0x13')](_0x1ee9('0x14'),_0x25706e,'request\x20sent');logger['debug'](_0x1ee9('0x15'),_0x25706e,_0x1ee9('0x16'),JSON[_0x1ee9('0x17')](_0x365ff3));if(_0x365ff3[_0x1ee9('0x18')]){if(_0x365ff3[_0x1ee9('0x18')][_0x1ee9('0x19')]===0x1f4){logger[_0x1ee9('0x18')]('MailAccount,\x20%s,\x20%s',_0x25706e,_0x365ff3['error'][_0x1ee9('0x1a')]);return _0x2adadf(_0x365ff3[_0x1ee9('0x18')]['message']);}logger[_0x1ee9('0x18')]('MailAccount,\x20%s,\x20%s',_0x25706e,_0x365ff3[_0x1ee9('0x18')][_0x1ee9('0x1a')]);return _0x3344ee(_0x365ff3['error']['message']);}else{logger[_0x1ee9('0x13')](_0x1ee9('0x14'),_0x25706e,'request\x20sent');_0x3344ee(_0x365ff3[_0x1ee9('0x1b')]['message']);}})[_0x1ee9('0x1c')](function(_0x352eef){logger[_0x1ee9('0x18')](_0x1ee9('0x14'),_0x25706e,_0x352eef);_0x2adadf(_0x352eef);});});}exports[_0x1ee9('0x1d')]=function(_0x339145){var _0x14297d=this;return new Promise(function(_0x555720,_0x4a5fbd){return db[_0x1ee9('0x1e')][_0x1ee9('0x1f')]({'raw':_0x339145[_0x1ee9('0x20')]?_0x339145['options']['raw']===undefined?!![]:![]:!![],'where':_0x339145[_0x1ee9('0x20')]?_0x339145[_0x1ee9('0x20')][_0x1ee9('0x21')]||null:null,'attributes':_0x339145['options']?_0x339145[_0x1ee9('0x20')][_0x1ee9('0x22')]||null:null,'limit':_0x339145[_0x1ee9('0x20')]?_0x339145[_0x1ee9('0x20')][_0x1ee9('0x23')]||null:null,'include':_0x339145['options']?_0x339145[_0x1ee9('0x20')][_0x1ee9('0x24')]?_[_0x1ee9('0x25')](_0x339145[_0x1ee9('0x20')][_0x1ee9('0x24')],function(_0x5778bb){return{'model':db[_0x5778bb[_0x1ee9('0x26')]],'as':_0x5778bb['as'],'attributes':_0x5778bb[_0x1ee9('0x22')],'include':_0x5778bb[_0x1ee9('0x24')]?_[_0x1ee9('0x25')](_0x5778bb[_0x1ee9('0x24')],function(_0x21c3af){return{'model':db[_0x21c3af['model']],'as':_0x21c3af['as'],'attributes':_0x21c3af['attributes'],'include':_0x21c3af['include']?_[_0x1ee9('0x25')](_0x21c3af[_0x1ee9('0x24')],function(_0x961649){return{'model':db[_0x961649[_0x1ee9('0x26')]],'as':_0x961649['as'],'attributes':_0x961649[_0x1ee9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1ee9('0x12')](function(_0x6670a8){logger[_0x1ee9('0x13')](_0x1ee9('0x1d'),_0x339145);logger[_0x1ee9('0x27')](_0x1ee9('0x1d'),_0x339145,JSON[_0x1ee9('0x17')](_0x6670a8));_0x555720(_0x6670a8);})[_0x1ee9('0x1c')](function(_0x366e34){logger['error'](_0x1ee9('0x1d'),_0x366e34[_0x1ee9('0x1a')],_0x339145);_0x4a5fbd(_0x14297d[_0x1ee9('0x18')](0x1f4,_0x366e34[_0x1ee9('0x1a')]));});});};exports[_0x1ee9('0x28')]=function(_0x183e76){var _0x45b6dc=this;return new Promise(function(_0x1d9104,_0x145263){return db[_0x1ee9('0x1e')][_0x1ee9('0x29')]({'raw':_0x183e76['options']?_0x183e76[_0x1ee9('0x20')][_0x1ee9('0x2a')]===undefined?!![]:![]:!![],'where':_0x183e76['options']?_0x183e76[_0x1ee9('0x20')][_0x1ee9('0x21')]||null:null,'attributes':_0x183e76[_0x1ee9('0x20')]?_0x183e76[_0x1ee9('0x20')]['attributes']||null:null,'include':_0x183e76[_0x1ee9('0x20')]?_0x183e76[_0x1ee9('0x20')][_0x1ee9('0x24')]?_[_0x1ee9('0x25')](_0x183e76[_0x1ee9('0x20')][_0x1ee9('0x24')],function(_0x463743){return{'model':db[_0x463743[_0x1ee9('0x26')]],'as':_0x463743['as'],'attributes':_0x463743[_0x1ee9('0x22')],'include':_0x463743[_0x1ee9('0x24')]?_[_0x1ee9('0x25')](_0x463743[_0x1ee9('0x24')],function(_0x12188a){return{'model':db[_0x12188a[_0x1ee9('0x26')]],'as':_0x12188a['as'],'attributes':_0x12188a[_0x1ee9('0x22')],'include':_0x12188a[_0x1ee9('0x24')]?_[_0x1ee9('0x25')](_0x12188a[_0x1ee9('0x24')],function(_0x3a6d41){return{'model':db[_0x3a6d41[_0x1ee9('0x26')]],'as':_0x3a6d41['as'],'attributes':_0x3a6d41[_0x1ee9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd8e8f){logger[_0x1ee9('0x13')]('ShowMailAccount',_0x183e76);logger['debug'](_0x1ee9('0x28'),_0x183e76,JSON['stringify'](_0xd8e8f));_0x1d9104(_0xd8e8f);})[_0x1ee9('0x1c')](function(_0x2a009b){logger[_0x1ee9('0x18')]('ShowMailAccount',_0x2a009b['message'],_0x183e76);_0x145263(_0x45b6dc[_0x1ee9('0x18')](0x1f4,_0x2a009b[_0x1ee9('0x1a')]));});});};exports[_0x1ee9('0x2b')]=function(_0x1f1bab){var _0x14f946=this;return new Promise(function(_0x41fd7a,_0x24a947){var _0x259f52={'body':_0x1f1bab[_0x1ee9('0x2c')],'channel':_0x1ee9('0x2d')};var _0x57cbbd=_['difference'](_['keys'](db[_0x1ee9('0x2e')][_0x1ee9('0x2f')]),[_0x1ee9('0x30'),_0x1ee9('0x31'),_0x1ee9('0x32'),_0x1ee9('0x33')]);var _0x53dfed=![];if(_0x1f1bab[_0x1ee9('0x2c')]['id']){delete _0x1f1bab['body']['id'];}if(_[_0x1ee9('0x34')](_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x35')])){return _0x24a947(_0x14f946[_0x1ee9('0x18')](0x1f4,_0x1ee9('0x36')));}if(_[_0x1ee9('0x34')](_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x2c')])||_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x2c')]===''){return _0x24a947(_0x14f946['error'](0x1f4,_0x1ee9('0x37')));}if(_[_0x1ee9('0x34')](_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x38')])){return _0x24a947(_0x14f946['error'](0x1f4,_0x1ee9('0x39')+_0x57cbbd));}if(!_[_0x1ee9('0x3a')](_0x57cbbd,_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x38')])){return _0x24a947(_0x14f946['error'](0x1f4,_0x1ee9('0x3b')+_0x57cbbd));}var _0x5b8930={};_0x5b8930[_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x38')]]=_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x35')];return db[_0x1ee9('0x1e')][_0x1ee9('0x29')]({'where':{'id':_0x1f1bab[_0x1ee9('0x3c')]['id']},'include':[{'model':db['CmList'],'as':_0x1ee9('0x3d'),'include':[{'model':db[_0x1ee9('0x2e')],'as':_0x1ee9('0x3e'),'where':_0x5b8930,'limit':0x1,'order':[['updatedAt',_0x1ee9('0x3f')]]}]},{'model':db[_0x1ee9('0x40')],'as':_0x1ee9('0x41')},{'model':db[_0x1ee9('0x42')],'as':_0x1ee9('0x43')}]})['then'](function(_0x456e83){if(_0x456e83&&_0x456e83[_0x1ee9('0x3d')]){var _0x4e767f=_0x456e83[_0x1ee9('0x44')]({'plain':!![]});_0x259f52[_0x1ee9('0x3c')]=_[_0x1ee9('0x45')](_0x4e767f,[_0x1ee9('0x41'),_0x1ee9('0x3d')]);_0x259f52['applications']=_0x4e767f[_0x1ee9('0x41')];_0x259f52[_0x1ee9('0x46')]=_0x4e767f[_0x1ee9('0x3d')];_0x259f52[_0x1ee9('0x47')]=_[_0x1ee9('0x48')](_0x259f52[_0x1ee9('0x47')],[_0x1ee9('0x49')],[_0x1ee9('0x4a')]);if(_0x259f52[_0x1ee9('0x3c')]&&_0x259f52['account'][_0x1ee9('0x4b')]){_0x259f52[_0x1ee9('0x47')][_0x1ee9('0x4c')]({'id':0x0,'priority':_0x259f52[_0x1ee9('0x47')]['length']+0x1,'app':_0x1ee9('0x4d'),'appdata':'autoclose','interval':_0x1ee9('0x4e')});}if(_0x259f52['account']['Applications']){delete _0x259f52[_0x1ee9('0x3c')][_0x1ee9('0x41')];}if(_0x259f52['account'][_0x1ee9('0x3d')]){delete _0x259f52[_0x1ee9('0x3c')][_0x1ee9('0x3d')];}if(_0x4e767f[_0x1ee9('0x3d')][_0x1ee9('0x3e')][_0x1ee9('0x4f')]){return _0x4e767f[_0x1ee9('0x3d')][_0x1ee9('0x3e')][0x0];}var _0x3d8538=_[_0x1ee9('0xc')](_0x1f1bab[_0x1ee9('0x2c')],{'firstName':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x35')],'ListId':_0x4e767f[_0x1ee9('0x33')]});_0x3d8538[_0x1f1bab[_0x1ee9('0x2c')]['mapKey']]=_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x35')];return db['CmContact']['create'](_0x3d8538);}else{throw new Error(_0x1ee9('0x50'));}})[_0x1ee9('0x12')](function(_0x348bbe){_0x259f52[_0x1ee9('0x51')]=_0x348bbe;if(_0x348bbe){if(!_0x1f1bab['body'][_0x1ee9('0x1a')]['messageId']){_0x1f1bab[_0x1ee9('0x2c')]['message']['messageId']=rs[_0x1ee9('0x52')]()+'\x20'+_0x1f1bab['body'][_0x1ee9('0x1a')][_0x1ee9('0x35')];}var _0xd6d8b0={'ContactId':_0x348bbe['id'],'MailAccountId':_0x1f1bab[_0x1ee9('0x3c')]['id'],'inReplyTo':_0x1f1bab['body'][_0x1ee9('0x1a')]['messageId'],'to':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x35')],'cc':_0x1f1bab['body'][_0x1ee9('0x1a')]['cc'],'subject':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x53')],'attach':_0x1f1bab['body']['message'][_0x1ee9('0x54')],'lastMsgAt':moment()[_0x1ee9('0x55')](_0x1ee9('0x56')),'lastMsgDirection':'in'};return db[_0x1ee9('0x57')][_0x1ee9('0x29')]({'where':{'closed':![],'MailAccountId':_0x1f1bab[_0x1ee9('0x3c')]['id']},'include':[{'model':db['MailMessage'],'as':_0x1ee9('0x58'),'attributes':['messageId'],'where':{'messageId':_0x1f1bab[_0x1ee9('0x2c')]['message'][_0x1ee9('0x59')]}}]})[_0x1ee9('0x12')](function(_0x3c56bf){if(_0x3c56bf){return[_0x3c56bf,![]];}return db['MailInteraction'][_0x1ee9('0x5a')](_0xd6d8b0)['then'](function(_0xd95969){return[_0xd95969,!![]];});});}else{throw new Error(_0x1ee9('0x5b'));}})['spread'](function(_0x24f2ab,_0x11b9ad){if(_0x24f2ab){_0x53dfed=_0x11b9ad;if(!_0x11b9ad){return _0x24f2ab[_0x1ee9('0x5c')]({'inReplyTo':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x5d')],'to':_0x1f1bab['body'][_0x1ee9('0x1a')][_0x1ee9('0x35')],'cc':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')]['cc'],'subject':_0x1f1bab['body']['message'][_0x1ee9('0x53')],'attach':_0x24f2ab[_0x1ee9('0x54')]?_0x24f2ab[_0x1ee9('0x54')]:_0x1f1bab['body'][_0x1ee9('0x1a')][_0x1ee9('0x54')],'substatus':null,'substatusAt':moment()['format'](_0x1ee9('0x56')),'lastMsgAt':moment()[_0x1ee9('0x55')](_0x1ee9('0x56')),'lastMsgDirection':'in'});}else{return _0x24f2ab;}}})[_0x1ee9('0x12')](function(_0x42e388){_0x259f52[_0x1ee9('0x5e')]=_0x42e388[_0x1ee9('0x44')]({'plain':!![]});_0x259f52[_0x1ee9('0x5e')][_0x1ee9('0x5f')]=_0x53dfed;return db[_0x1ee9('0x60')][_0x1ee9('0x5a')]({'body':_0x1f1bab['body']['body'],'MailAccountId':_0x1f1bab[_0x1ee9('0x3c')]['id'],'MailInteractionId':_0x42e388['id'],'direction':'in','ContactId':_0x259f52[_0x1ee9('0x51')]['id'],'messageId':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x5d')],'from':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')]['from'],'to':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')]['to'],'cc':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')]['cc'],'subject':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x53')],'attach':_0x1f1bab[_0x1ee9('0x2c')]['message'][_0x1ee9('0x54')],'Attachments':_0x1f1bab[_0x1ee9('0x2c')]['message'][_0x1ee9('0x61')],'originTo':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x62')],'originCc':_0x1f1bab[_0x1ee9('0x2c')]['message']['originCc'],'bcc':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x63')],'ChatWebsiteId':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x64')]||null,'originChannel':_0x1f1bab['body']['message'][_0x1ee9('0x65')]||'Email','ChatOfflineMessageId':_0x1f1bab[_0x1ee9('0x2c')][_0x1ee9('0x1a')][_0x1ee9('0x66')]||null},{'include':[{'model':db[_0x1ee9('0x67')],'as':_0x1ee9('0x68')}]});})[_0x1ee9('0x12')](function(_0x383885){_0x259f52[_0x1ee9('0x1a')]=_0x383885;if(_0x259f52[_0x1ee9('0x5e')][_0x1ee9('0x69')]){return db['User'][_0x1ee9('0x29')]({'attributes':['id','name'],'where':{'id':_0x259f52[_0x1ee9('0x5e')][_0x1ee9('0x69')]}})[_0x1ee9('0x12')](function(_0x12b921){if(_0x12b921){_0x259f52[_0x1ee9('0x47')][_0x1ee9('0x6a')]({'id':0x0,'priority':0x0,'app':_0x1ee9('0x6b'),'appdata':_0x12b921[_0x1ee9('0x6c')]+','+(_0x259f52[_0x1ee9('0x3c')][_0x1ee9('0x6d')]||0xa),'interval':_0x1ee9('0x4e')});}return respondWithRpcPromise(_0x1ee9('0x6e'),_0x1ee9('0x6f'),_0x259f52);});}return respondWithRpcPromise(_0x1ee9('0x6e'),_0x1ee9('0x6f'),_0x259f52);})[_0x1ee9('0x12')](function(_0x350e73){_0x41fd7a(_0x350e73);})[_0x1ee9('0x1c')](function(_0x50b613){_0x24a947(_0x14f946[_0x1ee9('0x18')](0x1f4,_0x50b613['message']));});});}; \ No newline at end of file +var _0xafa6=['map','then','stringify','find','ShowMailAccount','body','mail','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','account','omit','applications','list','orderBy','priority','asc','push','length','close','autoclose','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','Contact\x20not\x20found','spread','update','get','interaction','created','MailMessage','contact','attachments','originTo','originCc','bcc','originChannel','Email','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model'];(function(_0xc8a337,_0x52062b){var _0x4d3d9b=function(_0x1a5f42){while(--_0x1a5f42){_0xc8a337['push'](_0xc8a337['shift']());}};_0x4d3d9b(++_0x52062b);}(_0xafa6,0x175));var _0x6afa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xafa6[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x6afa('0x0'));var util=require('util');var moment=require(_0x6afa('0x1'));var BPromise=require('bluebird');var rs=require(_0x6afa('0x2'));var fs=require('fs');var Redis=require(_0x6afa('0x3'));var db=require(_0x6afa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6afa('0x5'))(_0x6afa('0x6'));var config=require(_0x6afa('0x7'));var jayson=require(_0x6afa('0x8'));var client=jayson['client'][_0x6afa('0x9')]({'port':0x232c});config[_0x6afa('0xa')]=_[_0x6afa('0xb')](config[_0x6afa('0xa')],{'host':_0x6afa('0xc'),'port':0x18eb});var socket=require(_0x6afa('0xd'))(new Redis(config[_0x6afa('0xa')]));require(_0x6afa('0xe'))[_0x6afa('0xf')](socket);function respondWithRpcPromise(_0x5ba613,_0x45324b,_0x3206d5){return new BPromise(function(_0x2bf253,_0x204eeb){return client[_0x6afa('0x10')](_0x5ba613,_0x3206d5)['then'](function(_0x5c7ceb){logger['info'](_0x6afa('0x11'),_0x45324b,_0x6afa('0x12'));logger[_0x6afa('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x45324b,_0x6afa('0x12'),JSON['stringify'](_0x5c7ceb));if(_0x5c7ceb[_0x6afa('0x14')]){if(_0x5c7ceb['error'][_0x6afa('0x15')]===0x1f4){logger[_0x6afa('0x14')](_0x6afa('0x11'),_0x45324b,_0x5c7ceb[_0x6afa('0x14')][_0x6afa('0x16')]);return _0x204eeb(_0x5c7ceb[_0x6afa('0x14')][_0x6afa('0x16')]);}logger[_0x6afa('0x14')](_0x6afa('0x11'),_0x45324b,_0x5c7ceb[_0x6afa('0x14')]['message']);return _0x2bf253(_0x5c7ceb[_0x6afa('0x14')][_0x6afa('0x16')]);}else{logger[_0x6afa('0x17')](_0x6afa('0x11'),_0x45324b,_0x6afa('0x12'));_0x2bf253(_0x5c7ceb['result'][_0x6afa('0x16')]);}})[_0x6afa('0x18')](function(_0x13c79a){logger['error']('MailAccount,\x20%s,\x20%s',_0x45324b,_0x13c79a);_0x204eeb(_0x13c79a);});});}exports[_0x6afa('0x19')]=function(_0x2f80eb){var _0x59519b=this;return new Promise(function(_0x1cd545,_0x1bcbfc){return db[_0x6afa('0x1a')][_0x6afa('0x1b')]({'raw':_0x2f80eb[_0x6afa('0x1c')]?_0x2f80eb[_0x6afa('0x1c')][_0x6afa('0x1d')]===undefined?!![]:![]:!![],'where':_0x2f80eb[_0x6afa('0x1c')]?_0x2f80eb[_0x6afa('0x1c')][_0x6afa('0x1e')]||null:null,'attributes':_0x2f80eb[_0x6afa('0x1c')]?_0x2f80eb[_0x6afa('0x1c')][_0x6afa('0x1f')]||null:null,'limit':_0x2f80eb[_0x6afa('0x1c')]?_0x2f80eb[_0x6afa('0x1c')][_0x6afa('0x20')]||null:null,'include':_0x2f80eb[_0x6afa('0x1c')]?_0x2f80eb['options'][_0x6afa('0x21')]?_['map'](_0x2f80eb[_0x6afa('0x1c')][_0x6afa('0x21')],function(_0x4ffac9){return{'model':db[_0x4ffac9[_0x6afa('0x22')]],'as':_0x4ffac9['as'],'attributes':_0x4ffac9[_0x6afa('0x1f')],'include':_0x4ffac9['include']?_[_0x6afa('0x23')](_0x4ffac9[_0x6afa('0x21')],function(_0x3b2e3d){return{'model':db[_0x3b2e3d[_0x6afa('0x22')]],'as':_0x3b2e3d['as'],'attributes':_0x3b2e3d['attributes'],'include':_0x3b2e3d[_0x6afa('0x21')]?_[_0x6afa('0x23')](_0x3b2e3d['include'],function(_0x480873){return{'model':db[_0x480873['model']],'as':_0x480873['as'],'attributes':_0x480873['attributes']};}):[]};}):[]};}):[]:[]})[_0x6afa('0x24')](function(_0x4a247a){logger[_0x6afa('0x17')](_0x6afa('0x19'),_0x2f80eb);logger[_0x6afa('0x13')](_0x6afa('0x19'),_0x2f80eb,JSON[_0x6afa('0x25')](_0x4a247a));_0x1cd545(_0x4a247a);})['catch'](function(_0x33fad8){logger[_0x6afa('0x14')]('GetMailAccount',_0x33fad8['message'],_0x2f80eb);_0x1bcbfc(_0x59519b[_0x6afa('0x14')](0x1f4,_0x33fad8[_0x6afa('0x16')]));});});};exports['ShowMailAccount']=function(_0x359f3c){var _0x40f1d7=this;return new Promise(function(_0x37b15c,_0x344a8d){return db[_0x6afa('0x1a')][_0x6afa('0x26')]({'raw':_0x359f3c[_0x6afa('0x1c')]?_0x359f3c[_0x6afa('0x1c')][_0x6afa('0x1d')]===undefined?!![]:![]:!![],'where':_0x359f3c[_0x6afa('0x1c')]?_0x359f3c['options']['where']||null:null,'attributes':_0x359f3c[_0x6afa('0x1c')]?_0x359f3c[_0x6afa('0x1c')]['attributes']||null:null,'include':_0x359f3c[_0x6afa('0x1c')]?_0x359f3c[_0x6afa('0x1c')]['include']?_[_0x6afa('0x23')](_0x359f3c[_0x6afa('0x1c')][_0x6afa('0x21')],function(_0x1d3680){return{'model':db[_0x1d3680[_0x6afa('0x22')]],'as':_0x1d3680['as'],'attributes':_0x1d3680['attributes'],'include':_0x1d3680[_0x6afa('0x21')]?_[_0x6afa('0x23')](_0x1d3680['include'],function(_0x36c0c6){return{'model':db[_0x36c0c6[_0x6afa('0x22')]],'as':_0x36c0c6['as'],'attributes':_0x36c0c6[_0x6afa('0x1f')],'include':_0x36c0c6[_0x6afa('0x21')]?_[_0x6afa('0x23')](_0x36c0c6['include'],function(_0x3b8ea9){return{'model':db[_0x3b8ea9[_0x6afa('0x22')]],'as':_0x3b8ea9['as'],'attributes':_0x3b8ea9['attributes']};}):[]};}):[]};}):[]:[]})[_0x6afa('0x24')](function(_0x4c8bfd){logger[_0x6afa('0x17')](_0x6afa('0x27'),_0x359f3c);logger[_0x6afa('0x13')](_0x6afa('0x27'),_0x359f3c,JSON[_0x6afa('0x25')](_0x4c8bfd));_0x37b15c(_0x4c8bfd);})[_0x6afa('0x18')](function(_0x58377e){logger[_0x6afa('0x14')](_0x6afa('0x27'),_0x58377e['message'],_0x359f3c);_0x344a8d(_0x40f1d7[_0x6afa('0x14')](0x1f4,_0x58377e['message']));});});};exports['NotifyMailAccount']=function(_0x1c6e56){var _0x123509=this;return new Promise(function(_0x52c3ec,_0x327bce){var _0x120085={'body':_0x1c6e56[_0x6afa('0x28')],'channel':_0x6afa('0x29')};var _0x430205=_['difference'](_['keys'](db['CmContact']['rawAttributes']),[_0x6afa('0x2a'),_0x6afa('0x2b'),_0x6afa('0x2c'),_0x6afa('0x2d')]);var _0x5873f4=![];if(_0x1c6e56[_0x6afa('0x28')]['id']){delete _0x1c6e56[_0x6afa('0x28')]['id'];}if(_[_0x6afa('0x2e')](_0x1c6e56['body'][_0x6afa('0x2f')])){return _0x327bce(_0x123509[_0x6afa('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x6afa('0x2e')](_0x1c6e56[_0x6afa('0x28')]['body'])||_0x1c6e56[_0x6afa('0x28')]['body']===''){return _0x327bce(_0x123509[_0x6afa('0x14')](0x1f4,_0x6afa('0x30')));}if(_[_0x6afa('0x2e')](_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x31')])){return _0x327bce(_0x123509[_0x6afa('0x14')](0x1f4,_0x6afa('0x32')+_0x430205));}if(!_[_0x6afa('0x33')](_0x430205,_0x1c6e56[_0x6afa('0x28')]['mapKey'])){return _0x327bce(_0x123509[_0x6afa('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x430205));}var _0x1e0e37={};_0x1e0e37[_0x1c6e56[_0x6afa('0x28')]['mapKey']]=_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x2f')];return db[_0x6afa('0x1a')]['find']({'where':{'id':_0x1c6e56['account']['id']},'include':[{'model':db['CmList'],'as':_0x6afa('0x34'),'include':[{'model':db['CmContact'],'as':_0x6afa('0x35'),'where':_0x1e0e37,'limit':0x1,'order':[[_0x6afa('0x2b'),_0x6afa('0x36')]]}]},{'model':db[_0x6afa('0x37')],'as':_0x6afa('0x38')},{'model':db[_0x6afa('0x39')],'as':_0x6afa('0x3a')}]})[_0x6afa('0x24')](function(_0x49ad3f){if(_0x49ad3f&&_0x49ad3f['List']){var _0x22419c=_0x49ad3f['get']({'plain':!![]});_0x120085[_0x6afa('0x3b')]=_[_0x6afa('0x3c')](_0x22419c,[_0x6afa('0x38'),'List']);_0x120085[_0x6afa('0x3d')]=_0x22419c[_0x6afa('0x38')];_0x120085[_0x6afa('0x3e')]=_0x22419c['List'];_0x120085[_0x6afa('0x3d')]=_[_0x6afa('0x3f')](_0x120085[_0x6afa('0x3d')],[_0x6afa('0x40')],[_0x6afa('0x41')]);if(_0x120085['account']&&_0x120085[_0x6afa('0x3b')]['autoclose']){_0x120085['applications'][_0x6afa('0x42')]({'id':0x0,'priority':_0x120085[_0x6afa('0x3d')][_0x6afa('0x43')]+0x1,'app':_0x6afa('0x44'),'appdata':_0x6afa('0x45'),'interval':'*,*,*,*'});}if(_0x120085[_0x6afa('0x3b')][_0x6afa('0x38')]){delete _0x120085[_0x6afa('0x3b')][_0x6afa('0x38')];}if(_0x120085[_0x6afa('0x3b')][_0x6afa('0x34')]){delete _0x120085[_0x6afa('0x3b')][_0x6afa('0x34')];}if(_0x22419c[_0x6afa('0x34')][_0x6afa('0x35')][_0x6afa('0x43')]){return _0x22419c['List'][_0x6afa('0x35')][0x0];}var _0x1f6750=_['defaults'](_0x1c6e56[_0x6afa('0x28')],{'firstName':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x2f')],'ListId':_0x22419c[_0x6afa('0x2d')]});_0x1f6750[_0x1c6e56['body'][_0x6afa('0x31')]]=_0x1c6e56[_0x6afa('0x28')]['from'];return db['CmContact'][_0x6afa('0x46')](_0x1f6750);}else{throw new Error(_0x6afa('0x47'));}})[_0x6afa('0x24')](function(_0x2d7651){_0x120085['contact']=_0x2d7651;if(_0x2d7651){if(!_0x1c6e56['body']['message'][_0x6afa('0x48')]){_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x48')]=rs[_0x6afa('0x49')]()+'\x20'+_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x2f')];}var _0x5353b4={'ContactId':_0x2d7651['id'],'MailAccountId':_0x1c6e56[_0x6afa('0x3b')]['id'],'inReplyTo':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x48')],'to':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x2f')],'cc':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')]['cc'],'subject':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x4a')],'attach':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x4b')],'lastMsgAt':moment()[_0x6afa('0x4c')](_0x6afa('0x4d')),'lastMsgDirection':'in'};return db[_0x6afa('0x4e')][_0x6afa('0x26')]({'where':{'closed':![],'MailAccountId':_0x1c6e56['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x6afa('0x4f'),'attributes':[_0x6afa('0x48')],'where':{'messageId':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')]['inReplyTo']}}]})[_0x6afa('0x24')](function(_0x1c8edc){if(_0x1c8edc){return[_0x1c8edc,![]];}return db[_0x6afa('0x4e')][_0x6afa('0x46')](_0x5353b4)[_0x6afa('0x24')](function(_0xa8bf4b){return[_0xa8bf4b,!![]];});});}else{throw new Error(_0x6afa('0x50'));}})[_0x6afa('0x51')](function(_0x521ed3,_0x587af0){if(_0x521ed3){_0x5873f4=_0x587af0;if(!_0x587af0){return _0x521ed3[_0x6afa('0x52')]({'inReplyTo':_0x1c6e56[_0x6afa('0x28')]['message']['messageId'],'to':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x2f')],'cc':_0x1c6e56[_0x6afa('0x28')]['message']['cc'],'subject':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x4a')],'attach':_0x521ed3['attach']?_0x521ed3['attach']:_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x4b')],'substatus':null,'substatusAt':moment()[_0x6afa('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x6afa('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x521ed3;}}})[_0x6afa('0x24')](function(_0x5b359b){_0x120085['interaction']=_0x5b359b[_0x6afa('0x53')]({'plain':!![]});_0x120085[_0x6afa('0x54')][_0x6afa('0x55')]=_0x5873f4;return db[_0x6afa('0x56')][_0x6afa('0x46')]({'body':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x28')],'MailAccountId':_0x1c6e56[_0x6afa('0x3b')]['id'],'MailInteractionId':_0x5b359b['id'],'direction':'in','ContactId':_0x120085[_0x6afa('0x57')]['id'],'messageId':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x48')],'from':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')]['from'],'to':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')]['to'],'cc':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')]['cc'],'subject':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x4a')],'attach':_0x1c6e56[_0x6afa('0x28')]['message']['attach'],'Attachments':_0x1c6e56['body'][_0x6afa('0x16')][_0x6afa('0x58')],'originTo':_0x1c6e56[_0x6afa('0x28')]['message'][_0x6afa('0x59')],'originCc':_0x1c6e56[_0x6afa('0x28')]['message'][_0x6afa('0x5a')],'bcc':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x5b')],'ChatWebsiteId':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')]['ChatWebsiteId']||null,'originChannel':_0x1c6e56[_0x6afa('0x28')][_0x6afa('0x16')][_0x6afa('0x5c')]||_0x6afa('0x5d'),'ChatOfflineMessageId':_0x1c6e56[_0x6afa('0x28')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x6afa('0x24')](function(_0x5d3367){_0x120085['message']=_0x5d3367;if(_0x120085[_0x6afa('0x54')][_0x6afa('0x5e')]){return db[_0x6afa('0x5f')][_0x6afa('0x26')]({'attributes':['id',_0x6afa('0x60')],'where':{'id':_0x120085[_0x6afa('0x54')][_0x6afa('0x5e')]}})[_0x6afa('0x24')](function(_0x43a928){if(_0x43a928){_0x120085[_0x6afa('0x3d')][_0x6afa('0x61')]({'id':0x0,'priority':0x0,'app':_0x6afa('0x62'),'appdata':_0x43a928[_0x6afa('0x60')]+','+(_0x120085['account']['waitForTheAssignedAgent']||0xa),'interval':_0x6afa('0x63')});}return respondWithRpcPromise(_0x6afa('0x64'),'startRouting',_0x120085);});}return respondWithRpcPromise(_0x6afa('0x64'),_0x6afa('0x65'),_0x120085);})[_0x6afa('0x24')](function(_0x18c5c5){_0x52c3ec(_0x18c5c5);})[_0x6afa('0x18')](function(_0x3997f3){_0x327bce(_0x123509['error'](0x1f4,_0x3997f3[_0x6afa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 403deb0..2d9d752 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 _0x5e74=['length','mailAccount:','save','remove','update','emit','removeListener','register'];(function(_0x21a0cb,_0x5a4cc5){var _0x2e9bb4=function(_0x3b47cf){while(--_0x3b47cf){_0x21a0cb['push'](_0x21a0cb['shift']());}};_0x2e9bb4(++_0x5a4cc5);}(_0x5e74,0xd2));var _0x45e7=function(_0x49e22d,_0x54379a){_0x49e22d=_0x49e22d-0x0;var _0x3cfb71=_0x5e74[_0x49e22d];return _0x3cfb71;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x45e7('0x0'),_0x45e7('0x1'),_0x45e7('0x2')];function createListener(_0x13dc1e,_0x1e9665){return function(_0x4ac48d){_0x1e9665[_0x45e7('0x3')](_0x13dc1e,_0x4ac48d);};}function removeListener(_0x3c2822,_0x3ad25f){return function(){MailAccountEvents[_0x45e7('0x4')](_0x3c2822,_0x3ad25f);};}exports[_0x45e7('0x5')]=function(_0x5f0f41){for(var _0x3bb98e=0x0,_0x402795=events[_0x45e7('0x6')];_0x3bb98e<_0x402795;_0x3bb98e++){var _0x4f84f7=events[_0x3bb98e];var _0x315ff1=createListener(_0x45e7('0x7')+_0x4f84f7,_0x5f0f41);MailAccountEvents['on'](_0x4f84f7,_0x315ff1);}}; \ No newline at end of file +var _0x8156=['emit','removeListener','register','length','mailAccount:','save','remove','update'];(function(_0x2c77f4,_0x23774e){var _0x3c85c5=function(_0x31f707){while(--_0x31f707){_0x2c77f4['push'](_0x2c77f4['shift']());}};_0x3c85c5(++_0x23774e);}(_0x8156,0xad));var _0x6815=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8156[_0x3947c9];return _0x2e7871;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x6815('0x0'),_0x6815('0x1'),_0x6815('0x2')];function createListener(_0x8abb42,_0xfb5f42){return function(_0x2e7cbc){_0xfb5f42[_0x6815('0x3')](_0x8abb42,_0x2e7cbc);};}function removeListener(_0x27945e,_0x13415d){return function(){MailAccountEvents[_0x6815('0x4')](_0x27945e,_0x13415d);};}exports[_0x6815('0x5')]=function(_0xcf7396){for(var _0x41f17f=0x0,_0x22e6f2=events[_0x6815('0x6')];_0x41f17f<_0x22e6f2;_0x41f17f++){var _0x356203=events[_0x41f17f];var _0x306724=createListener(_0x6815('0x7')+_0x356203,_0xcf7396);MailAccountEvents['on'](_0x356203,_0x306724);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e2e6ac3..4ddbf61 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 _0x0f55=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','exports','multer','util','path','express','Router'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0f55,0x18b));var _0x50f5=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0x0f55[_0x2e2104];return _0x1280c5;};'use strict';var multer=require(_0x50f5('0x0'));var util=require(_0x50f5('0x1'));var path=require(_0x50f5('0x2'));var timeout=require('connect-timeout');var express=require(_0x50f5('0x3'));var router=express[_0x50f5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x50f5('0x5'));var interaction=require(_0x50f5('0x6'));var config=require(_0x50f5('0x7'));var controller=require(_0x50f5('0x8'));router[_0x50f5('0x9')](_0x50f5('0xa'),auth['isAuthenticated'](),controller[_0x50f5('0xb')]);router[_0x50f5('0xc')]('/:id',auth[_0x50f5('0xd')](),controller[_0x50f5('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x50f5('0xf')]=router; \ No newline at end of file +var _0xb7ac=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','put','/:id','update','delete','isAuthenticated'];(function(_0x17bfae,_0x52023d){var _0x6af798=function(_0x21a0f4){while(--_0x21a0f4){_0x17bfae['push'](_0x17bfae['shift']());}};_0x6af798(++_0x52023d);}(_0xb7ac,0x121));var _0xcb7a=function(_0x3f23c3,_0x2b066d){_0x3f23c3=_0x3f23c3-0x0;var _0x1e670c=_0xb7ac[_0x3f23c3];return _0x1e670c;};'use strict';var multer=require(_0xcb7a('0x0'));var util=require(_0xcb7a('0x1'));var path=require(_0xcb7a('0x2'));var timeout=require(_0xcb7a('0x3'));var express=require(_0xcb7a('0x4'));var router=express[_0xcb7a('0x5')]();var fs_extra=require(_0xcb7a('0x6'));var auth=require(_0xcb7a('0x7'));var interaction=require(_0xcb7a('0x8'));var config=require(_0xcb7a('0x9'));var controller=require(_0xcb7a('0xa'));router[_0xcb7a('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcb7a('0xc')](_0xcb7a('0xd'),auth['isAuthenticated'](),controller[_0xcb7a('0xe')]);router[_0xcb7a('0xf')](_0xcb7a('0xd'),auth[_0xcb7a('0x10')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 54eb7c8..26c330d 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 _0xb36b=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x4b2e1d,_0x1ec8b6){var _0x3e0fe0=function(_0x574513){while(--_0x574513){_0x4b2e1d['push'](_0x4b2e1d['shift']());}};_0x3e0fe0(++_0x1ec8b6);}(_0xb36b,0xac));var _0xbb36=function(_0x3fc161,_0x1e7597){_0x3fc161=_0x3fc161-0x0;var _0xc4c27d=_0xb36b[_0x3fc161];return _0xc4c27d;};'use strict';var Sequelize=require(_0xbb36('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbb36('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbb36('0x2')],'allowNull':![],'defaultValue':_0xbb36('0x3')},'appdata':{'type':Sequelize[_0xbb36('0x4')]()},'description':{'type':Sequelize[_0xbb36('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbb36('0x5')}}; \ No newline at end of file +var _0xa777=['STRING','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x272b37,_0x5a1fa5){var _0x2e2c71=function(_0x5f076b){while(--_0x5f076b){_0x272b37['push'](_0x272b37['shift']());}};_0x2e2c71(++_0x5a1fa5);}(_0xa777,0x175));var _0x7a77=function(_0x4eca77,_0x363332){_0x4eca77=_0x4eca77-0x0;var _0x1338fb=_0xa777[_0x4eca77];return _0x1338fb;};'use strict';var Sequelize=require(_0x7a77('0x0'));module[_0x7a77('0x1')]={'priority':{'type':Sequelize[_0x7a77('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7a77('0x3')},'appdata':{'type':Sequelize[_0x7a77('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7a77('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c63e213..449683f 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0xbdb7[_0x77773a];return _0x1091a2;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x42e988,_0xd8abe0){_0x42e988=_0x42e988-0x0;var _0x5ce1fb=_0xbdb7[_0x42e988];return _0x5ce1fb;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a107dca..937f587 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 _0x0d7c=['../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x504fe2,_0x31b6f0){var _0x4143b3=function(_0x1891f7){while(--_0x1891f7){_0x504fe2['push'](_0x504fe2['shift']());}};_0x4143b3(++_0x31b6f0);}(_0x0d7c,0xea));var _0xc0d7=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x0d7c[_0x2652ef];return _0x2db578;};'use strict';var _=require(_0xc0d7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0d7('0x1'));var moment=require('moment');var BPromise=require(_0xc0d7('0x2'));var rp=require(_0xc0d7('0x3'));var fs=require('fs');var path=require(_0xc0d7('0x4'));var rimraf=require(_0xc0d7('0x5'));var config=require(_0xc0d7('0x6'));var attributes=require(_0xc0d7('0x7'));module['exports']=function(_0xb6c504,_0x295735){return _0xb6c504[_0xc0d7('0x8')]('MailApplication',attributes,{'tableName':_0xc0d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0d7('0xa'),'collate':_0xc0d7('0xb')});}; \ No newline at end of file +var _0x1c8f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3a97bb,_0x34cc2f){var _0x531a69=function(_0x5a4fff){while(--_0x5a4fff){_0x3a97bb['push'](_0x3a97bb['shift']());}};_0x531a69(++_0x34cc2f);}(_0x1c8f,0xa2));var _0xf1c8=function(_0x578543,_0x573f2b){_0x578543=_0x578543-0x0;var _0x6fb81d=_0x1c8f[_0x578543];return _0x6fb81d;};'use strict';var _=require(_0xf1c8('0x0'));var util=require(_0xf1c8('0x1'));var logger=require(_0xf1c8('0x2'))(_0xf1c8('0x3'));var moment=require(_0xf1c8('0x4'));var BPromise=require(_0xf1c8('0x5'));var rp=require(_0xf1c8('0x6'));var fs=require('fs');var path=require(_0xf1c8('0x7'));var rimraf=require(_0xf1c8('0x8'));var config=require(_0xf1c8('0x9'));var attributes=require('./mailApplication.attributes');module[_0xf1c8('0xa')]=function(_0x4d6116,_0x402983){return _0x4d6116[_0xf1c8('0xb')](_0xf1c8('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf1c8('0xd'),'collate':_0xf1c8('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index f0a1963..6f716be 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 _0x2b67=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','MailApplication','body','options','raw','attributes','limit','UpdateMailApplication','debug','catch','lodash','moment'];(function(_0x592932,_0x158030){var _0x25f5d4=function(_0x35e10d){while(--_0x35e10d){_0x592932['push'](_0x592932['shift']());}};_0x25f5d4(++_0x158030);}(_0x2b67,0x13e));var _0x72b6=function(_0xc8168a,_0x45c505){_0xc8168a=_0xc8168a-0x0;var _0x476dab=_0x2b67[_0xc8168a];return _0x476dab;};'use strict';var _=require(_0x72b6('0x0'));var util=require('util');var moment=require(_0x72b6('0x1'));var BPromise=require(_0x72b6('0x2'));var rs=require(_0x72b6('0x3'));var fs=require('fs');var Redis=require(_0x72b6('0x4'));var db=require(_0x72b6('0x5'))['db'];var utils=require(_0x72b6('0x6'));var logger=require(_0x72b6('0x7'))(_0x72b6('0x8'));var config=require(_0x72b6('0x9'));var jayson=require(_0x72b6('0xa'));var client=jayson[_0x72b6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d825b,_0x2d1b33,_0x47e452){return new BPromise(function(_0x322f65,_0x2ffb67){return client[_0x72b6('0xc')](_0x5d825b,_0x47e452)[_0x72b6('0xd')](function(_0x1647a0){logger[_0x72b6('0xe')]('MailApplication,\x20%s,\x20%s',_0x2d1b33,_0x72b6('0xf'));logger['debug'](_0x72b6('0x10'),_0x2d1b33,_0x72b6('0xf'),JSON[_0x72b6('0x11')](_0x1647a0));if(_0x1647a0['error']){if(_0x1647a0[_0x72b6('0x12')][_0x72b6('0x13')]===0x1f4){logger[_0x72b6('0x12')](_0x72b6('0x14'),_0x2d1b33,_0x1647a0['error'][_0x72b6('0x15')]);return _0x2ffb67(_0x1647a0[_0x72b6('0x12')][_0x72b6('0x15')]);}logger[_0x72b6('0x12')](_0x72b6('0x14'),_0x2d1b33,_0x1647a0[_0x72b6('0x12')]['message']);return _0x322f65(_0x1647a0[_0x72b6('0x12')]['message']);}else{logger[_0x72b6('0xe')](_0x72b6('0x14'),_0x2d1b33,_0x72b6('0xf'));_0x322f65(_0x1647a0[_0x72b6('0x16')][_0x72b6('0x15')]);}})['catch'](function(_0x44dd9a){logger[_0x72b6('0x12')](_0x72b6('0x14'),_0x2d1b33,_0x44dd9a);_0x2ffb67(_0x44dd9a);});});}exports['UpdateMailApplication']=function(_0x18e025){var _0x5ebdb6=this;return new Promise(function(_0x55e937,_0x5d0231){return db[_0x72b6('0x17')]['update'](_0x18e025[_0x72b6('0x18')],{'raw':_0x18e025[_0x72b6('0x19')]?_0x18e025[_0x72b6('0x19')][_0x72b6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18e025[_0x72b6('0x19')]?_0x18e025[_0x72b6('0x19')]['where']||null:null,'attributes':_0x18e025[_0x72b6('0x19')]?_0x18e025['options'][_0x72b6('0x1b')]||null:null,'limit':_0x18e025[_0x72b6('0x19')]?_0x18e025[_0x72b6('0x19')][_0x72b6('0x1c')]||null:null})['then'](function(_0xccd9c2){logger['info'](_0x72b6('0x1d'),_0x18e025);logger[_0x72b6('0x1e')](_0x72b6('0x1d'),_0x18e025,JSON[_0x72b6('0x11')](_0xccd9c2));_0x55e937(_0xccd9c2);})[_0x72b6('0x1f')](function(_0xcb490c){logger[_0x72b6('0x12')](_0x72b6('0x1d'),_0xcb490c[_0x72b6('0x15')],_0x18e025);_0x5d0231(_0x5ebdb6[_0x72b6('0x12')](0x1f4,_0xcb490c['message']));});});}; \ No newline at end of file +var _0x78cc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','limit','then','stringify','lodash','moment','bluebird','randomstring'];(function(_0x4c970f,_0xa8827b){var _0x3c0cc6=function(_0x4e67f3){while(--_0x4e67f3){_0x4c970f['push'](_0x4c970f['shift']());}};_0x3c0cc6(++_0xa8827b);}(_0x78cc,0xec));var _0xc78c=function(_0x37850a,_0x5b335c){_0x37850a=_0x37850a-0x0;var _0x2b59a1=_0x78cc[_0x37850a];return _0x2b59a1;};'use strict';var _=require(_0xc78c('0x0'));var util=require('util');var moment=require(_0xc78c('0x1'));var BPromise=require(_0xc78c('0x2'));var rs=require(_0xc78c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc78c('0x4'));var logger=require(_0xc78c('0x5'))(_0xc78c('0x6'));var config=require(_0xc78c('0x7'));var jayson=require(_0xc78c('0x8'));var client=jayson[_0xc78c('0x9')][_0xc78c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11e552,_0x2ac45f,_0x371314){return new BPromise(function(_0x36d484,_0x137df0){return client['request'](_0x11e552,_0x371314)['then'](function(_0x24e45c){logger[_0xc78c('0xb')](_0xc78c('0xc'),_0x2ac45f,_0xc78c('0xd'));logger[_0xc78c('0xe')](_0xc78c('0xf'),_0x2ac45f,_0xc78c('0xd'),JSON['stringify'](_0x24e45c));if(_0x24e45c[_0xc78c('0x10')]){if(_0x24e45c[_0xc78c('0x10')][_0xc78c('0x11')]===0x1f4){logger[_0xc78c('0x10')]('MailApplication,\x20%s,\x20%s',_0x2ac45f,_0x24e45c[_0xc78c('0x10')][_0xc78c('0x12')]);return _0x137df0(_0x24e45c[_0xc78c('0x10')][_0xc78c('0x12')]);}logger['error'](_0xc78c('0xc'),_0x2ac45f,_0x24e45c[_0xc78c('0x10')][_0xc78c('0x12')]);return _0x36d484(_0x24e45c[_0xc78c('0x10')][_0xc78c('0x12')]);}else{logger[_0xc78c('0xb')](_0xc78c('0xc'),_0x2ac45f,_0xc78c('0xd'));_0x36d484(_0x24e45c[_0xc78c('0x13')][_0xc78c('0x12')]);}})[_0xc78c('0x14')](function(_0xf087fa){logger[_0xc78c('0x10')](_0xc78c('0xc'),_0x2ac45f,_0xf087fa);_0x137df0(_0xf087fa);});});}exports[_0xc78c('0x15')]=function(_0x2080ec){var _0x20612f=this;return new Promise(function(_0x12105d,_0x3cdafc){return db[_0xc78c('0x16')][_0xc78c('0x17')](_0x2080ec[_0xc78c('0x18')],{'raw':_0x2080ec[_0xc78c('0x19')]?_0x2080ec[_0xc78c('0x19')][_0xc78c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2080ec['options']?_0x2080ec[_0xc78c('0x19')]['where']||null:null,'attributes':_0x2080ec['options']?_0x2080ec[_0xc78c('0x19')]['attributes']||null:null,'limit':_0x2080ec[_0xc78c('0x19')]?_0x2080ec['options'][_0xc78c('0x1b')]||null:null})[_0xc78c('0x1c')](function(_0x259590){logger[_0xc78c('0xb')]('UpdateMailApplication',_0x2080ec);logger['debug'](_0xc78c('0x15'),_0x2080ec,JSON[_0xc78c('0x1d')](_0x259590));_0x12105d(_0x259590);})[_0xc78c('0x14')](function(_0x565d40){logger[_0xc78c('0x10')](_0xc78c('0x15'),_0x565d40[_0xc78c('0x12')],_0x2080ec);_0x3cdafc(_0x20612f[_0xc78c('0x10')](0x1f4,_0x565d40[_0xc78c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 447f032..be8ddf3 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 _0x7631=['mailinteraction:update','update','delete','mailinteraction:destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put'];(function(_0x219cc1,_0x3d03b5){var _0x177034=function(_0x45e0fe){while(--_0x45e0fe){_0x219cc1['push'](_0x219cc1['shift']());}};_0x177034(++_0x3d03b5);}(_0x7631,0x1c5));var _0x1763=function(_0x57bc6b,_0x3938a9){_0x57bc6b=_0x57bc6b-0x0;var _0x5c7c4e=_0x7631[_0x57bc6b];return _0x5c7c4e;};'use strict';var express=require(_0x1763('0x0'));var router=express[_0x1763('0x1')]();var auth=require(_0x1763('0x2'));var interaction=require(_0x1763('0x3'));var controller=require(_0x1763('0x4'));router[_0x1763('0x5')]('/',auth[_0x1763('0x6')](),controller[_0x1763('0x7')]);router[_0x1763('0x5')]('/describe',auth[_0x1763('0x6')](),controller[_0x1763('0x8')]);router[_0x1763('0x5')](_0x1763('0x9'),auth[_0x1763('0x6')](),controller[_0x1763('0xa')]);router[_0x1763('0x5')](_0x1763('0xb'),auth[_0x1763('0x6')](),controller['getMessages']);router['get'](_0x1763('0xc'),auth[_0x1763('0x6')](),controller[_0x1763('0xd')]);router['post']('/',auth[_0x1763('0x6')](),controller[_0x1763('0xe')]);router[_0x1763('0xf')]('/:id/messages',auth[_0x1763('0x6')](),controller[_0x1763('0x10')]);router['post'](_0x1763('0x11'),auth['isAuthenticated'](),interaction[_0x1763('0x12')](_0x1763('0x13'),_0x1763('0x14')),controller[_0x1763('0x15')]);router[_0x1763('0x16')]('/:id',auth[_0x1763('0x6')](),interaction[_0x1763('0x12')](_0x1763('0x13'),_0x1763('0x17')),controller[_0x1763('0x18')]);router[_0x1763('0x19')](_0x1763('0x9'),auth['isAuthenticated'](),interaction[_0x1763('0x12')](_0x1763('0x13'),_0x1763('0x1a')),controller['destroy']);router[_0x1763('0x19')](_0x1763('0x11'),auth[_0x1763('0x6')](),controller['removeTags']);module[_0x1763('0x1b')]=router; \ No newline at end of file +var _0x3019=['express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','mailinteraction:addtags','/:id','tracked','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x3019,0x1a9));var _0x9301=function(_0x20eaa1,_0x2b0373){_0x20eaa1=_0x20eaa1-0x0;var _0xfbef1a=_0x3019[_0x20eaa1];return _0xfbef1a;};'use strict';var express=require(_0x9301('0x0'));var router=express[_0x9301('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x9301('0x2'));var controller=require(_0x9301('0x3'));router[_0x9301('0x4')]('/',auth[_0x9301('0x5')](),controller[_0x9301('0x6')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9301('0x7')]);router[_0x9301('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x9301('0x8')]);router[_0x9301('0x4')](_0x9301('0x9'),auth[_0x9301('0x5')](),controller[_0x9301('0xa')]);router[_0x9301('0x4')](_0x9301('0xb'),auth[_0x9301('0x5')](),controller['download']);router[_0x9301('0xc')]('/',auth['isAuthenticated'](),controller[_0x9301('0xd')]);router['post']('/:id/messages',auth[_0x9301('0x5')](),controller['addMessage']);router[_0x9301('0xc')](_0x9301('0xe'),auth[_0x9301('0x5')](),interaction['tracked']('mail',_0x9301('0xf')),controller['addTags']);router['put'](_0x9301('0x10'),auth[_0x9301('0x5')](),interaction[_0x9301('0x11')](_0x9301('0x12'),_0x9301('0x13')),controller['update']);router[_0x9301('0x14')](_0x9301('0x10'),auth[_0x9301('0x5')](),interaction[_0x9301('0x11')](_0x9301('0x12'),_0x9301('0x15')),controller[_0x9301('0x16')]);router['delete'](_0x9301('0xe'),auth[_0x9301('0x5')](),controller[_0x9301('0x17')]);module[_0x9301('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index c448d98..cc38669 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 _0xf688=['BOOLEAN','ENUM','out','exports','DATE','STRING','TEXT'];(function(_0x223325,_0x52791a){var _0x14a86a=function(_0x5092f0){while(--_0x5092f0){_0x223325['push'](_0x223325['shift']());}};_0x14a86a(++_0x52791a);}(_0xf688,0x10d));var _0x8f68=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf688[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x8f68('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8f68('0x1')]},'disposition':{'type':Sequelize[_0x8f68('0x2')]},'secondDisposition':{'type':Sequelize[_0x8f68('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8f68('0x2')]},'note':{'type':Sequelize[_0x8f68('0x2')]},'inReplyTo':{'type':Sequelize[_0x8f68('0x2')](0x1fe)},'to':{'type':Sequelize[_0x8f68('0x2')]},'cc':{'type':Sequelize[_0x8f68('0x3')]('long')},'subject':{'type':Sequelize[_0x8f68('0x3')]()},'attach':{'type':Sequelize[_0x8f68('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8f68('0x1')]},'substatus':{'type':Sequelize[_0x8f68('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x8f68('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x8f68('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8f68('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x8f68('0x5')]('in',_0x8f68('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe4b6=['exports','DATE','STRING','TEXT','BOOLEAN','ENUM','out','sequelize','iconv'];(function(_0x29d87c,_0x33290e){var _0x3ff27c=function(_0x193912){while(--_0x193912){_0x29d87c['push'](_0x29d87c['shift']());}};_0x3ff27c(++_0x33290e);}(_0xe4b6,0xfa));var _0x6e4b=function(_0x1a6269,_0x5deea5){_0x1a6269=_0x1a6269-0x0;var _0x536f68=_0xe4b6[_0x1a6269];return _0x536f68;};'use strict';var Sequelize=require(_0x6e4b('0x0'));var iconv=require(_0x6e4b('0x1'));module[_0x6e4b('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e4b('0x3')]},'disposition':{'type':Sequelize[_0x6e4b('0x4')]},'secondDisposition':{'type':Sequelize[_0x6e4b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6e4b('0x4')]},'note':{'type':Sequelize[_0x6e4b('0x4')]},'inReplyTo':{'type':Sequelize[_0x6e4b('0x4')](0x1fe)},'to':{'type':Sequelize[_0x6e4b('0x4')]},'cc':{'type':Sequelize[_0x6e4b('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x6e4b('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6e4b('0x3')]},'substatus':{'type':Sequelize[_0x6e4b('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x6e4b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6e4b('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e4b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6e4b('0x7')]('in',_0x6e4b('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6e4b('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4d75fc9..787c575 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 _0x451b=['map','MailInteraction','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','tools_tags','u.id','u.fullname','ui.MailInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','MailAccountId','i.MailAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','show','params','intersection','includeAll','include','options','body','describe','addMessage','omit','ids','true','addTags','setTags','Tag','findAll','mailInteractionTags:save','removeTags','download','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','bluebird','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','undefined','limit','count','set','update','then','destroy','sendStatus','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','plainBody','-id','lastMsgText','trimStart','catch'];(function(_0x4daa5c,_0x117e8c){var _0x2afe54=function(_0x40d8df){while(--_0x40d8df){_0x4daa5c['push'](_0x4daa5c['shift']());}};_0x2afe54(++_0x117e8c);}(_0x451b,0xb8));var _0xb451=function(_0x3e2554,_0x26afa1){_0x3e2554=_0x3e2554-0x0;var _0x2bee3b=_0x451b[_0x3e2554];return _0x2bee3b;};'use strict';var emlformat=require(_0xb451('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xb451('0x1'));var util=require(_0xb451('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xb451('0x3'));var squel=require(_0xb451('0x4'));var juice=require(_0xb451('0x5'));var Redis=require(_0xb451('0x6'));var qs=require(_0xb451('0x7'));var as=require(_0xb451('0x8'));var logger=require(_0xb451('0x9'))(_0xb451('0xa'));var config=require(_0xb451('0xb'));var db=require(_0xb451('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xb451('0xd')]=_[_0xb451('0xe')](config[_0xb451('0xd')],{'host':_0xb451('0xf'),'port':0x18eb});var socket=require(_0xb451('0x10'))(new Redis(config[_0xb451('0xd')]));require(_0xb451('0x11'))[_0xb451('0x12')](socket);function respondWithStatusCode(_0x14f143,_0x31ccf1){_0x31ccf1=_0x31ccf1||0xcc;return function(_0x3222ad){if(_0x3222ad){return _0x14f143['sendStatus'](_0x31ccf1);}return _0x14f143[_0xb451('0x13')](_0x31ccf1)[_0xb451('0x14')]();};}function respondWithResult(_0x542385,_0x13434c){_0x13434c=_0x13434c||0xc8;return function(_0x4f2d73){if(_0x4f2d73){return _0x542385[_0xb451('0x13')](_0x13434c)['json'](_0x4f2d73);}};}function respondWithFilteredResult(_0xafada1,_0x2c365d){return function(_0x1192bf){if(_0x1192bf){var _0x51eac1=typeof _0x2c365d[_0xb451('0x15')]===_0xb451('0x16')&&typeof _0x2c365d[_0xb451('0x17')]===_0xb451('0x16');var _0x220235=_0x1192bf[_0xb451('0x18')];var _0x3f1e19=_0x51eac1?0x0:_0x2c365d['offset'];var _0xcb2a26=_0x51eac1?_0x1192bf[_0xb451('0x18')]:_0x2c365d[_0xb451('0x15')]+_0x2c365d[_0xb451('0x17')];var _0x51a0b1;if(_0xcb2a26>=_0x220235){_0xcb2a26=_0x220235;_0x51a0b1=0xc8;}else{_0x51a0b1=0xce;}_0xafada1[_0xb451('0x13')](_0x51a0b1);return _0xafada1[_0xb451('0x19')]('Content-Range',_0x3f1e19+'-'+_0xcb2a26+'/'+_0x220235)['json'](_0x1192bf);}return null;};}function saveUpdates(_0x1c7242){return function(_0x218d3d){if(_0x218d3d){return _0x218d3d[_0xb451('0x1a')](_0x1c7242)[_0xb451('0x1b')](function(_0x1684a2){return _0x1684a2;});}return null;};}function removeEntity(_0x502d13){return function(_0x2aa1cc){if(_0x2aa1cc){return _0x2aa1cc[_0xb451('0x1c')]()['then'](function(){_0x502d13['status'](0xcc)[_0xb451('0x14')]();});}};}function handleEntityNotFound(_0x58b7d7){return function(_0x2550ef){if(!_0x2550ef){_0x58b7d7[_0xb451('0x1d')](0x194);}return _0x2550ef;};}function handleError(_0x2318b9,_0x1160e3){_0x1160e3=_0x1160e3||0x1f4;return function(_0x2af8f5){logger[_0xb451('0x1e')](_0x2af8f5[_0xb451('0x1f')]);if(_0x2af8f5[_0xb451('0x20')]){delete _0x2af8f5['name'];}_0x2318b9[_0xb451('0x13')](_0x1160e3)[_0xb451('0x21')](_0x2af8f5);};}function getInteractionUsers(_0x53fee2,_0x43bb66){return new BPromise(function(_0x1c0653,_0x2c6cba){try{if(_0x43bb66[_0x53fee2['id']]){_0x53fee2['Users']=_['map'](_0x43bb66[_0x53fee2['id']],function(_0x5418e7){return{'id':_0x5418e7['id'],'fullname':_0x5418e7[_0xb451('0x22')]};});}}catch(_0x172a9b){_0x2c6cba(_0x172a9b);}_0x1c0653(_0x53fee2);});}function getInteractionTags(_0x487292,_0x152ca1){return new BPromise(function(_0x231989,_0x2fc8b4){try{if(_0x487292[_0xb451('0x23')]){_0x487292[_0xb451('0x24')]=[];_0x487292[_0xb451('0x23')][_0xb451('0x25')](',')[_0xb451('0x26')](function(_0x5e326f){_0x487292[_0xb451('0x24')][_0xb451('0x27')](_0x152ca1[_0x5e326f]);});}delete _0x487292[_0xb451('0x23')];}catch(_0x12d4db){_0x2fc8b4(_0x12d4db);}_0x231989(_0x487292);});}function getLastMessageText(_0x308910){return new BPromise(function(_0x4f7ab1,_0x5c2a86){return db[_0xb451('0x28')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x308910['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb451('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb451('0x2a')],'order':_0xb451('0x2b'),'raw':!![]})[_0xb451('0x1b')](function(_0xce6702){if(_0xce6702&&_0xce6702[_0xb451('0x2a')]){_0x308910[_0xb451('0x2c')]=_[_0xb451('0x2d')](_0xce6702[_0xb451('0x2a')]);}_0x4f7ab1(_0x308910);})[_0xb451('0x2e')](function(_0x3b6a33){_0x5c2a86(_0x3b6a33);});});}function updateMailInteraction(_0x2f7e2,_0x4d10a0,_0x313891,_0x1a409d){return new BPromise(function(_0x539310,_0x552ae2){return getInteractionUsers(_0x2f7e2,_0x313891)[_0xb451('0x1b')](function(_0x1dcb03){return getInteractionTags(_0x1dcb03,_0x4d10a0);})[_0xb451('0x1b')](function(_0x4fdd04){if(_0x1a409d){_0x539310(getLastMessageText(_0x4fdd04));}else{_0x539310(_0x4fdd04);}})[_0xb451('0x2e')](function(_0x2f8488){_0x552ae2(_0x2f8488);});});}exports['index']=function(_0x35b7e2,_0x15bf99){var _0x119efc={},_0x122c35={},_0x5d6909={'count':0x0,'rows':[]};var _0x30dc9a=_[_0xb451('0x2f')](db[_0xb451('0x30')][_0xb451('0x31')],function(_0x3db159){return{'name':_0x3db159[_0xb451('0x32')],'type':_0x3db159['type'][_0xb451('0x33')]};});_0x122c35[_0xb451('0x34')]=_[_0xb451('0x2f')](_0x30dc9a,_0xb451('0x20'));_0x122c35[_0xb451('0x35')]=_[_0xb451('0x36')](_0x35b7e2[_0xb451('0x35')]);_0x122c35[_0xb451('0x37')]=_['intersection'](_0x122c35[_0xb451('0x34')],_0x122c35['query']);_0x119efc[_0xb451('0x38')]=_['intersection'](_0x122c35[_0xb451('0x34')],qs[_0xb451('0x39')](_0x35b7e2[_0xb451('0x35')]['fields']));_0x119efc[_0xb451('0x38')]=_0x119efc[_0xb451('0x38')]['length']?_0x119efc[_0xb451('0x38')]:_0x122c35[_0xb451('0x34')];if(!_0x35b7e2['query'][_0xb451('0x3a')](_0xb451('0x3b'))){_0x119efc['limit']=qs[_0xb451('0x17')](_0x35b7e2['query'][_0xb451('0x17')]);_0x119efc[_0xb451('0x15')]=qs[_0xb451('0x15')](_0x35b7e2[_0xb451('0x35')][_0xb451('0x15')]);}_0x119efc[_0xb451('0x3c')]=qs[_0xb451('0x3d')](_0x35b7e2[_0xb451('0x35')][_0xb451('0x3d')]);_0x119efc[_0xb451('0x3e')]=qs[_0xb451('0x37')](_[_0xb451('0x3f')](_0x35b7e2['query'],_0x122c35[_0xb451('0x37')]),_0x30dc9a);var _0x936f16=[];var _0x54d42e=squel['select']()['field']('id')[_0xb451('0x40')](_0xb451('0x20'))['field'](_0xb451('0x41'))['from'](_0xb451('0x42'));var _0x335b00=squel['select']()[_0xb451('0x40')](_0xb451('0x43'))[_0xb451('0x40')](_0xb451('0x44'))[_0xb451('0x40')](_0xb451('0x45'))[_0xb451('0x46')]('user_has_mail_interactions','ui')[_0xb451('0x47')](_0xb451('0x48'),'u',_0xb451('0x49'));var _0x4cdc0a=squel['select']()[_0xb451('0x46')](_0xb451('0x4a'),'i')[_0xb451('0x47')](_0xb451('0x4b'),'c',_0xb451('0x4c'))['left_join'](_0xb451('0x48'),'o',_0xb451('0x4d'))[_0xb451('0x47')](_0xb451('0x4e'),'a',_0xb451('0x4f'))[_0xb451('0x47')]('mail_messages','me',_0xb451('0x50'))[_0xb451('0x47')](_0xb451('0x51'),'it',_0xb451('0x52'))[_0xb451('0x47')](_0xb451('0x42'),'t',_0xb451('0x53'));var _0x588cec=squel[_0xb451('0x54')]();var _0x3452c6=[];var _0x188e15=squel['expr']();var _0x3bb95c;if(_0x35b7e2[_0xb451('0x35')][_0xb451('0x55')]){_0x3bb95c=as[_0xb451('0x56')](_0x35b7e2[_0xb451('0x35')][_0xb451('0x55')]);var _0x555ed5=_0x3bb95c[_0xb451('0x57')];for(var _0x43cfe9=0x0;_0x43cfe9<_0x3bb95c[_0xb451('0x58')][_0xb451('0x59')];_0x43cfe9++){var _0x41d872=_0x3bb95c[_0xb451('0x58')][_0x43cfe9];var _0x3a3e40='i';var _0x505683=_[_0xb451('0x5a')](_0x30dc9a,['name',_0x41d872[_0xb451('0x40')]]);if(!_0x505683){switch(_0x41d872[_0xb451('0x40')]){case _0xb451('0x5b'):if(_0x41d872[_0xb451('0x5c')]==0x1){_0x4cdc0a['having']('`'+_0x41d872['field']+_0xb451('0x5d'));}else{_0x4cdc0a[_0xb451('0x5e')]('`'+_0x41d872[_0xb451('0x40')]+_0xb451('0x5f'));}break;case'Contact':if(_0x41d872[_0xb451('0x60')]===_0xb451('0x61')){if(_0x41d872['value'][_0xb451('0x25')]('\x20')[_0xb451('0x59')]>0x1){_0x588cec[_0x555ed5](_0xb451('0x62'),qs['getFullTextValue'](_0x41d872[_0xb451('0x5c')]),null);}else{var _0x3e45f2='%'+_0x41d872[_0xb451('0x5c')]+'%';_0x588cec[_0x555ed5](_0xb451('0x63'),_0x3e45f2,_0x3e45f2,_0x3e45f2);}}else{_0x505683=_['find'](_0x30dc9a,[_0xb451('0x20'),'ContactId']);_0x41d872['field']=_0xb451('0x64');_0x48d36b=as[_0xb451('0x65')](_0x3a3e40,_0x505683[_0xb451('0x66')],_0x41d872);_0x588cec[_0x555ed5](_0x48d36b['text'],_0x48d36b[_0xb451('0x5c')]['start'],_0x48d36b['value'][_0xb451('0x14')]);}break;case'Tag':var _0x353b3f=_0x41d872[_0xb451('0x5c')][_0xb451('0x25')](',')[_0xb451('0x2f')](function(_0x28c1c0){return Number(_0x28c1c0);});_0x353b3f['forEach'](function(_0x7f8373){_0x188e15['or'](_0xb451('0x67'),'%,'+_0x7f8373+',%');});_0x3452c6=_['union'](_0x3452c6,_0x353b3f);break;case _0xb451('0x68'):if(_0x41d872[_0xb451('0x60')]===_0xb451('0x61')){_0x588cec[_0x555ed5](_0xb451('0x69'),'%'+_0x41d872[_0xb451('0x5c')]+'%',null);}else{_0x505683=_[_0xb451('0x5a')](_0x30dc9a,['name',_0xb451('0x6a')]);_0x41d872['field']=_0xb451('0x6a');_0x48d36b=as[_0xb451('0x65')](_0x3a3e40,_0x505683[_0xb451('0x66')],_0x41d872);_0x588cec[_0x555ed5](_0x48d36b[_0xb451('0x6b')],_0x48d36b['value'][_0xb451('0x6c')],_0x48d36b[_0xb451('0x5c')][_0xb451('0x14')]);}break;case'plainBody':_0x48d36b=as['buildExpression']('me',null,_0x41d872);_0x588cec[_0x555ed5](_0x48d36b['text'],_0x48d36b[_0xb451('0x5c')][_0xb451('0x6c')],_0x48d36b[_0xb451('0x5c')][_0xb451('0x14')]);break;}}else{var _0x48d36b=as['buildExpression'](_0x3a3e40,_0x505683[_0xb451('0x66')],_0x41d872);_0x588cec[_0x555ed5](_0x48d36b['text'],_0x48d36b['value'][_0xb451('0x6c')],_0x48d36b[_0xb451('0x5c')]['end']);}}}else{var _0x57343f=_(_0x35b7e2[_0xb451('0x35')])[_0xb451('0x36')]()['map'](function(_0x255a16){return _['some'](_0x30dc9a,[_0xb451('0x20'),_0x255a16])?_0x255a16:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x57343f)){_0x57343f[_0xb451('0x26')](function(_0x39b4ea){if(_0x39b4ea===_0xb451('0x6d')){_0x4cdc0a['where'](_0xb451('0x6e'),[][_0xb451('0x6f')](_0x35b7e2[_0xb451('0x35')][_0x39b4ea]));}else if(_0x39b4ea==='createdAt'){var _0x12d098=JSON['parse'](_0x35b7e2[_0xb451('0x35')][_0x39b4ea])[_0xb451('0x70')];var _0x2d7524=JSON[_0xb451('0x71')](_0x35b7e2[_0xb451('0x35')][_0x39b4ea])[_0xb451('0x72')];_0x4cdc0a[_0xb451('0x3e')](_0xb451('0x73'),_0x12d098,_0x2d7524);}else{if(_0x35b7e2['query'][_0x39b4ea]===_0xb451('0x74')){_0x4cdc0a['where']('i.'+_0x39b4ea+'\x20IS\x20NULL');}else{_0x4cdc0a[_0xb451('0x3e')]('i.'+_0x39b4ea+_0xb451('0x75'),_0x35b7e2[_0xb451('0x35')][_0x39b4ea]);}}});}if(_0x35b7e2[_0xb451('0x35')][_0xb451('0x76')]){if(_0x35b7e2[_0xb451('0x35')][_0xb451('0x76')]==0x1){_0x4cdc0a[_0xb451('0x5e')](_0xb451('0x77'));}else{_0x4cdc0a[_0xb451('0x5e')](_0xb451('0x78'));}}if(_0x35b7e2[_0xb451('0x35')][_0xb451('0x79')]){_0x3452c6=_[_0xb451('0x7a')](_0x35b7e2['query'][_0xb451('0x79')])?_0x35b7e2[_0xb451('0x35')][_0xb451('0x79')]:new Array(_0x35b7e2['query'][_0xb451('0x79')]);_0x3452c6['forEach'](function(_0x7bf3d1){_0x188e15['or'](_0xb451('0x67'),'%,'+_0x7bf3d1+',%');});}if(_0x35b7e2[_0xb451('0x35')]['filter']){var _0x268457=_0x35b7e2[_0xb451('0x35')][_0xb451('0x7b')][_0xb451('0x7c')]('\x5c','\x5c\x5c')[_0xb451('0x7c')](/'/g,'\x27\x27');if(qs[_0xb451('0x7d')](_0x268457)){_0x588cec['or']('i.id\x20LIKE\x20?',_0x268457+'%');}else if(qs[_0xb451('0x7e')](_0x268457)){_0x588cec['or'](_0xb451('0x7f'),_0x268457+'%');}else{_0x588cec['or'](_0xb451('0x80'),qs[_0xb451('0x81')](_0x268457))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb451('0x81')](_0x268457));}}}_0x4cdc0a[_0xb451('0x3e')](_0x588cec);_0x4cdc0a[_0xb451('0x82')](_0xb451('0x83'));var _0x586164={'type':db[_0xb451('0x84')][_0xb451('0x85')][_0xb451('0x86')],'raw':!![]};var _0x509d9e=_0x4cdc0a[_0xb451('0x87')]();_0x509d9e[_0xb451('0x40')]('i.id');_0x509d9e[_0xb451('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb451('0x5b'));if(_0x119efc['order']){_0x119efc[_0xb451('0x3c')][_0xb451('0x26')](function(_0x4125f1){var _0x7bfbb9=_0x4125f1[0x0]===_0xb451('0x88')?_0x4125f1[0x0]:'i.'+_0x4125f1[0x0];_0x4cdc0a['order'](_0x7bfbb9,_0x4125f1[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb451('0x89')](_0x3452c6)){_0x4cdc0a[_0xb451('0x5e')](_0x188e15);_0x509d9e['where'](_0xb451('0x8a'),_0x3452c6);}BPromise[_0xb451('0x8b')]()[_0xb451('0x1b')](function(){if(!_0x3bb95c){if(_0x35b7e2[_0xb451('0x35')][_0xb451('0x6d')])return;_0x509d9e['where'](_0xb451('0x8c'));_0x4cdc0a[_0xb451('0x3e')](_0xb451('0x8c'));return;}if(_0x35b7e2[_0xb451('0x8d')]['role']!==_0xb451('0x8e'))return;return _0x35b7e2['user'][_0xb451('0x8f')]({'attributes':['id'],'raw':!![]})[_0xb451('0x1b')](function(_0x5735f1){if(_['isEmpty'](_0x5735f1)){_0x509d9e['where']('i.MailAccountId\x20IS\x20NULL');_0x4cdc0a[_0xb451('0x3e')](_0xb451('0x90'));}else{_0x509d9e[_0xb451('0x3e')](_0xb451('0x6e'),_['map'](_0x5735f1,'id'));_0x4cdc0a[_0xb451('0x3e')](_0xb451('0x6e'),_['map'](_0x5735f1,'id'));}});})[_0xb451('0x1b')](function(){if(_0x35b7e2[_0xb451('0x8d')][_0xb451('0x91')]===_0xb451('0x8e')&&!_0x3bb95c&&!_0x35b7e2[_0xb451('0x35')][_0xb451('0x6d')])return[];return db['sequelize'][_0xb451('0x35')](_0x509d9e[_0xb451('0x92')](),_0x586164);})[_0xb451('0x1b')](function(_0xbd4530){_0x5d6909[_0xb451('0x18')]=_0xbd4530[_0xb451('0x59')];if(_0x5d6909['count']===0x0)return[];return db['sequelize'][_0xb451('0x35')](_0x54d42e['toString'](),_0x586164)[_0xb451('0x1b')](function(_0x559a2b){_0x936f16=_['keyBy'](_0x559a2b,'id');_0x586164=_[_0xb451('0x93')](_0x586164,{'model':db[_0xb451('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35b7e2[_0xb451('0x35')][_0xb451('0x39')]){_0x119efc[_0xb451('0x38')]['forEach'](function(_0x10a962){_0x4cdc0a[_0xb451('0x40')]('i.'+_0x10a962);});}else{_0x4cdc0a[_0xb451('0x40')](_0xb451('0x94'),_0xb451('0x5b'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0x95'),'Account.key');_0x4cdc0a[_0xb451('0x40')]('a.mandatoryDisposition',_0xb451('0x96'));_0x4cdc0a[_0xb451('0x40')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb451('0x88'));_0x4cdc0a[_0xb451('0x40')]('i.id');_0x4cdc0a['field'](_0xb451('0x97'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0x98'));_0x4cdc0a['field']('i.closed');_0x4cdc0a['field']('i.closedAt');_0x4cdc0a['field'](_0xb451('0x99'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0x9a'));_0x4cdc0a['field'](_0xb451('0x9b'));_0x4cdc0a['field'](_0xb451('0x9c'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0x9d'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0x9e'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0x9f'));_0x4cdc0a['field']('i.substatus');_0x4cdc0a[_0xb451('0x40')](_0xb451('0xa0'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xa1'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xa2'));_0x4cdc0a[_0xb451('0x40')]('i.UserId');_0x4cdc0a[_0xb451('0x40')](_0xb451('0xa3'),_0xb451('0xa4'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xa5'),_0xb451('0xa6'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xa7'),_0xb451('0xa8'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xa9'),_0xb451('0xaa'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xab'),_0xb451('0xac'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xad'),_0xb451('0xae'));_0x4cdc0a[_0xb451('0x40')](_0xb451('0xaf'),'Owner.fullname');_0x4cdc0a['field']('o.internal',_0xb451('0xb0'));_0x4cdc0a['field'](_0xb451('0xb1'),_0xb451('0x23'));}if(_0x119efc['limit'])_0x4cdc0a[_0xb451('0x17')](_0x119efc[_0xb451('0x17')]);if(_0x119efc[_0xb451('0x15')])_0x4cdc0a[_0xb451('0x15')](_0x119efc['offset']);return db[_0xb451('0xb2')]['query'](_0x4cdc0a[_0xb451('0x92')](),_0x586164);})['then'](function(_0xc795d){if(_0xc795d[_0xb451('0x59')]>0x0)_0x335b00[_0xb451('0x3e')]('ui.MailInteractionId\x20IN\x20?',_[_0xb451('0x2f')](_0xc795d,'id'));return db[_0xb451('0xb2')][_0xb451('0x35')](_0x335b00[_0xb451('0x92')](),_0x586164)[_0xb451('0x1b')](function(_0x4e514a){var _0x99b334=_[_0xb451('0xb3')](_0x4e514a,_0xb451('0xb4'));var _0x429c82=[];return db[_0xb451('0xb5')][_0xb451('0xb6')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x2c4abd){var _0x1493e2=_0x2c4abd[_0xb451('0xb7')];_0xc795d[_0xb451('0x26')](function(_0x3abf66){_0x429c82[_0xb451('0x27')](updateMailInteraction(_0x3abf66,_0x936f16,_0x99b334,_0x1493e2));});return BPromise[_0xb451('0xb8')](_0x429c82);});});});})[_0xb451('0x1b')](function(_0x266a68){_0x5d6909[_0xb451('0xb9')]=_0x266a68;return _0x5d6909;})[_0xb451('0x1b')](respondWithFilteredResult(_0x15bf99,_0x119efc))[_0xb451('0x2e')](handleError(_0x15bf99,null));};exports[_0xb451('0xba')]=function(_0x37d921,_0xf418cc){var _0x4b0e66={'raw':![],'where':{'id':_0x37d921[_0xb451('0xbb')]['id']}},_0x17c46d={};_0x17c46d['model']=_[_0xb451('0x36')](db[_0xb451('0x30')][_0xb451('0x31')]);_0x17c46d['query']=_['keys'](_0x37d921[_0xb451('0x35')]);_0x17c46d[_0xb451('0x37')]=_[_0xb451('0xbc')](_0x17c46d['model'],_0x17c46d['query']);_0x4b0e66[_0xb451('0x38')]=_[_0xb451('0xbc')](_0x17c46d[_0xb451('0x34')],qs['fields'](_0x37d921['query'][_0xb451('0x39')]));_0x4b0e66['attributes']=_0x4b0e66[_0xb451('0x38')][_0xb451('0x59')]?_0x4b0e66['attributes']:_0x17c46d['model'];if(_0x37d921[_0xb451('0x35')][_0xb451('0xbd')]){_0x4b0e66[_0xb451('0xbe')]=[{'all':!![]}];}_0x4b0e66=_['merge']({},_0x4b0e66,_0x37d921[_0xb451('0xbf')]);return db[_0xb451('0x30')][_0xb451('0x5a')](_0x4b0e66)[_0xb451('0x1b')](handleEntityNotFound(_0xf418cc,null))['then'](respondWithResult(_0xf418cc,null))[_0xb451('0x2e')](handleError(_0xf418cc,null));};exports['create']=function(_0x3d3f2c,_0x4e861c){return db[_0xb451('0x30')]['create'](_0x3d3f2c['body'],{})[_0xb451('0x1b')](respondWithResult(_0x4e861c,0xc9))[_0xb451('0x2e')](handleError(_0x4e861c,null));};exports[_0xb451('0x1a')]=function(_0x479d06,_0x5dcb52){if(_0x479d06[_0xb451('0xc0')]['id']){delete _0x479d06[_0xb451('0xc0')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x479d06[_0xb451('0xbb')]['id']}})[_0xb451('0x1b')](handleEntityNotFound(_0x5dcb52,null))[_0xb451('0x1b')](saveUpdates(_0x479d06[_0xb451('0xc0')],null))[_0xb451('0x1b')](respondWithResult(_0x5dcb52,null))['catch'](handleError(_0x5dcb52,null));};exports[_0xb451('0x1c')]=function(_0x2c1f60,_0x244247){return db[_0xb451('0x30')][_0xb451('0x5a')]({'where':{'id':_0x2c1f60[_0xb451('0xbb')]['id']}})[_0xb451('0x1b')](handleEntityNotFound(_0x244247,null))['then'](removeEntity(_0x244247,null))[_0xb451('0x2e')](handleError(_0x244247,null));};exports[_0xb451('0xc1')]=function(_0x51ed34,_0x25ea24){return db[_0xb451('0x30')]['describe']()[_0xb451('0x1b')](respondWithResult(_0x25ea24,null))[_0xb451('0x2e')](handleError(_0x25ea24,null));};exports[_0xb451('0xc2')]=function(_0x2827b0,_0x3da423){return db[_0xb451('0x28')]['find']({'where':{'id':_0x2827b0[_0xb451('0xbb')]['id']}})[_0xb451('0x1b')](handleEntityNotFound(_0x3da423,null))[_0xb451('0x1b')](function(_0x2bc58d){if(_0x2bc58d){return _0x2bc58d[_0xb451('0xc2')](_0x2827b0['body']['ids'],_[_0xb451('0xc3')](_0x2827b0['body'],[_0xb451('0xc4'),'id'])||{});}})[_0xb451('0x1b')](respondWithResult(_0x3da423,null))[_0xb451('0x2e')](handleError(_0x3da423,null));};exports['getMessages']=function(_0x3eaded,_0x3f6600){var _0x5d9861={'raw':![],'where':{}};var _0x102db5={};var _0x2fa4c5={'count':0x0,'rows':[]};return db[_0xb451('0x30')][_0xb451('0xb6')]({'where':{'id':_0x3eaded['params']['id']}})[_0xb451('0x1b')](handleEntityNotFound(_0x3f6600,null))['then'](function(_0x1e7af7){if(_0x1e7af7){_0x102db5['model']=_['keys'](db['MailMessage'][_0xb451('0x31')]);_0x102db5[_0xb451('0x35')]=_['keys'](_0x3eaded[_0xb451('0x35')]);_0x102db5[_0xb451('0x37')]=_[_0xb451('0xbc')](_0x102db5[_0xb451('0x34')],_0x102db5['query']);_0x5d9861[_0xb451('0x38')]=_[_0xb451('0xbc')](_0x102db5[_0xb451('0x34')],qs[_0xb451('0x39')](_0x3eaded['query'][_0xb451('0x39')]));_0x5d9861[_0xb451('0x38')]=_0x5d9861['attributes'][_0xb451('0x59')]?_0x5d9861[_0xb451('0x38')]:_0x102db5[_0xb451('0x34')];if(!_0x3eaded[_0xb451('0x35')][_0xb451('0x3a')](_0xb451('0x3b'))){_0x5d9861[_0xb451('0x17')]=qs[_0xb451('0x17')](_0x3eaded[_0xb451('0x35')][_0xb451('0x17')]);_0x5d9861[_0xb451('0x15')]=qs['offset'](_0x3eaded['query'][_0xb451('0x15')]);}_0x5d9861['order']=qs[_0xb451('0x3d')](_0x3eaded[_0xb451('0x35')][_0xb451('0x3d')]);_0x5d9861['where']=qs[_0xb451('0x37')](_['pick'](_0x3eaded[_0xb451('0x35')],_0x102db5[_0xb451('0x37')]));_0x5d9861[_0xb451('0x3e')]['MailInteractionId']=_0x1e7af7['id'];if(_0x3eaded[_0xb451('0x35')][_0xb451('0x7b')]){_0x5d9861['where']=_[_0xb451('0x93')](_0x5d9861[_0xb451('0x3e')],{'$or':_[_0xb451('0x2f')](_0x5d9861[_0xb451('0x38')],function(_0x3a0b3c){var _0x235262={};_0x235262[_0x3a0b3c]={'$like':'%'+_0x3eaded[_0xb451('0x35')][_0xb451('0x7b')]+'%'};return _0x235262;})});}if(_0x3eaded[_0xb451('0x35')]['$gte']){var _0x361a2f=_0x3eaded['query'][_0xb451('0x70')][_0xb451('0x25')](',');var _0x222118={};_0x222118[_0x361a2f[0x0]]={'$gte':moment(_0x361a2f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5d9861[_0xb451('0x3e')]=_[_0xb451('0x93')](_0x5d9861[_0xb451('0x3e')],_0x222118);}_0x5d9861=_[_0xb451('0x93')]({},_0x5d9861,_0x3eaded[_0xb451('0xbf')]);return db[_0xb451('0x28')]['count']({'where':_0x5d9861[_0xb451('0x3e')]})[_0xb451('0x1b')](function(_0x1be1a0){_0x2fa4c5[_0xb451('0x18')]=_0x1be1a0;if(_0x3eaded['query'][_0xb451('0xbd')]){_0x5d9861['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5d9861);})[_0xb451('0x1b')](function(_0x15b471){if(_0x3eaded[_0xb451('0x35')]['inlineCss']===_0xb451('0xc5')){for(var _0x5c34ce=0x0;_0x5c34ce<_0x15b471[_0xb451('0x59')];_0x5c34ce++){_0x15b471[_0x5c34ce]['body']=juice(_0x15b471[_0x5c34ce]['body']);}}_0x2fa4c5[_0xb451('0xb9')]=_0x15b471;return _0x2fa4c5;});}})['then'](respondWithFilteredResult(_0x3f6600,_0x5d9861))[_0xb451('0x2e')](handleError(_0x3f6600,null));};exports[_0xb451('0xc6')]=function(_0x89026b,_0x4d5f83){return db[_0xb451('0x30')][_0xb451('0x5a')]({'where':{'id':_0x89026b['params']['id']}})[_0xb451('0x1b')](handleEntityNotFound(_0x4d5f83,null))[_0xb451('0x1b')](function(_0x368570){if(_0x368570){return _0x368570[_0xb451('0xc7')](_0x89026b[_0xb451('0xc0')]['ids'],_[_0xb451('0xc3')](_0x89026b[_0xb451('0xc0')],[_0xb451('0xc4'),'id'])||{})['spread'](function(){return db[_0xb451('0xc8')][_0xb451('0xc9')]({'attributes':['id',_0xb451('0x20'),_0xb451('0x41')],'where':{'id':_0x89026b[_0xb451('0xc0')]['ids']}});})[_0xb451('0x1b')](function(_0x1b9cc1){socket['emit'](_0xb451('0xca'),{'id':Number(_0x89026b[_0xb451('0xbb')]['id']),'tags':_0x1b9cc1||[]});return{'id':Number(_0x89026b['params']['id']),'tags':_0x1b9cc1||[]};});}})[_0xb451('0x1b')](respondWithResult(_0x4d5f83,null))[_0xb451('0x2e')](handleError(_0x4d5f83,null));};exports[_0xb451('0xcb')]=function(_0x23d5f5,_0x47b6a9){return db[_0xb451('0x30')]['find']({'where':{'id':_0x23d5f5[_0xb451('0xbb')]['id']}})[_0xb451('0x1b')](handleEntityNotFound(_0x47b6a9,null))[_0xb451('0x1b')](function(_0x1af8de){if(_0x1af8de){return _0x1af8de[_0xb451('0xcb')](_0x23d5f5[_0xb451('0x35')][_0xb451('0xc4')]);}})[_0xb451('0x1b')](respondWithStatusCode(_0x47b6a9,null))[_0xb451('0x2e')](handleError(_0x47b6a9,null));};exports[_0xb451('0xcc')]=function(_0x35cde8,_0xab0c16){var _0x4cc68c=moment()['unix']()[_0xb451('0x92')]();var _0x328690=path['join'](config['root'],_0xb451('0xcd'),_0xb451('0xce'),_0xb451('0xcf'));var _0x21194c=path[_0xb451('0xd0')](config[_0xb451('0xd1')],_0xb451('0xcd'),_0xb451('0xce'),_0xb451('0xd2'));var _0x4b1d0c=path[_0xb451('0xd0')](_0x328690,_0x4cc68c);var _0x4052f4=util['format'](_0xb451('0xd3'),_0x35cde8[_0xb451('0xbb')]['id'],_0x4cc68c);var _0x5b1f58=path[_0xb451('0xd0')](_0x328690,_0x4052f4);var _0x1f2bf6=[];if(_0x35cde8[_0xb451('0x35')][_0xb451('0xd2')]){_0x1f2bf6[_0xb451('0x27')]({'model':db[_0xb451('0xd4')],'as':_0xb451('0xd5'),'raw':!![]});}var _0x3bf6dc=[{'model':db['MailMessage'],'as':_0xb451('0xd6'),'attributes':['id',_0xb451('0xc0'),_0xb451('0x46'),'to','cc',_0xb451('0xd7'),_0xb451('0xd8'),_0xb451('0xd9')],'where':{'secret':![]},'order':qs[_0xb451('0x3d')]('id'),'include':_0x1f2bf6}];return db[_0xb451('0x30')]['find']({'where':{'id':_0x35cde8['params']['id']},'include':_0x3bf6dc})[_0xb451('0x1b')](handleEntityNotFound(_0xab0c16,null))[_0xb451('0x1b')](function(_0x219563){if(_0x219563&&_0x219563[_0xb451('0xd6')]){var _0x4934ef=_0x219563[_0xb451('0xda')]({'plain':!![]});fs[_0xb451('0xdb')](_0x4b1d0c);return BPromise[_0xb451('0xdc')](_0x4934ef['Messages'],function(_0x2e700d,_0x3d32c){var _0x174812={'from':_0x2e700d[_0xb451('0x46')],'to':_0x2e700d['to'],'subject':_0x2e700d[_0xb451('0xd8')],'html':htmlEntities[_0xb451('0xdd')](_0x2e700d['body']),'headers':{'Date':moment(_0x2e700d[_0xb451('0xd9')])[_0xb451('0xde')](_0xb451('0xdf'))},'attachments':[]};if(_0x2e700d['cc']){_0x174812['headers']['Cc']=_0x2e700d['cc'];}if(_0x2e700d['bcc']){_0x174812[_0xb451('0xe0')][_0xb451('0xe1')]=_0x2e700d[_0xb451('0xd7')];}return new BPromise(function(_0x115d55,_0x2185d0){if(_0x2e700d[_0xb451('0xd5')]){for(var _0x1db4e3=0x0;_0x1db4e3<_0x2e700d['Attachments']['length'];_0x1db4e3++){var _0x209ac6=_0x2e700d['Attachments'][_0x1db4e3];var _0x4ee928=path['join'](_0x21194c,_0x209ac6['basename']);if(fs[_0xb451('0xe2')](_0x4ee928)){_0x174812['attachments']['push']({'name':_0x209ac6[_0xb451('0x20')],'contentType':_0x209ac6['type'],'data':fs['readFileSync'](_0x4ee928)});}}}emlformat[_0xb451('0xe3')](_0x174812,function(_0x4f0577,_0x5fb442){if(_0x4f0577)return _0x2185d0(_0x4f0577);fs[_0xb451('0xe4')](path['join'](_0x4b1d0c,util[_0xb451('0xde')](_0xb451('0xe5'),_0x3d32c)),_0x5fb442);return _0x115d55(_0x5fb442);});});})['then'](function(){return new BPromise(function(_0x268ecc,_0x38c2c8){zipdir(_0x4b1d0c,{'saveTo':_0x5b1f58},function(_0x32fd90,_0x386bd1){if(_0x32fd90)return _0x38c2c8(_0x32fd90);return _0x268ecc(_0x386bd1);});})[_0xb451('0x1b')](function(){return new BPromise(function(_0xc38fd0,_0x3fd955){rimraf(_0x4b1d0c,function(_0x4202d4){if(_0x4202d4)_0x3fd955(_0x4202d4);return _0xc38fd0();});});})[_0xb451('0x1b')](function(){return _0xab0c16[_0xb451('0xcc')](_0x5b1f58,_0x4052f4,function(_0x12ea36){if(!_0x12ea36)fs[_0xb451('0xe6')](_0x5b1f58);});});});}else{return _0xab0c16[_0xb451('0x1d')](0xc8);}})[_0xb451('0x2e')](handleError(_0xab0c16,null));}; \ No newline at end of file +var _0xa477=['Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','sequelize','length','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','catch','includeAll','include','options','create','body','update','params','describe','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','setTags','spread','Tag','findAll','color','mailInteractionTags:save','removeTags','download','unix','root','server','join','files','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','bcc','get','mkdirSync','each','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','stack','name','send','Users','map','TagIds','Tags','split','MailMessage','findOne','out','plainBody','-id','index','MailInteraction','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','pick','filters','select','field','tools_tags','u.id','u.fullname','ui.MailInteractionId','users','u.id\x20=\x20ui.UserId','from','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','forEach','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','where','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id'];(function(_0x3d3473,_0x42281c){var _0x25d3df=function(_0x3003a4){while(--_0x3003a4){_0x3d3473['push'](_0x3d3473['shift']());}};_0x25d3df(++_0x42281c);}(_0xa477,0x14a));var _0x7a47=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa477[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x7a47('0x0'));var rimraf=require(_0x7a47('0x1'));var zipdir=require(_0x7a47('0x2'));var moment=require(_0x7a47('0x3'));var BPromise=require(_0x7a47('0x4'));var util=require(_0x7a47('0x5'));var path=require(_0x7a47('0x6'));var fs=require('fs');var _=require(_0x7a47('0x7'));var squel=require(_0x7a47('0x8'));var juice=require('juice');var Redis=require(_0x7a47('0x9'));var qs=require(_0x7a47('0xa'));var as=require(_0x7a47('0xb'));var logger=require(_0x7a47('0xc'))(_0x7a47('0xd'));var config=require('../../config/environment');var db=require(_0x7a47('0xe'))['db'];var htmlEntities=require('html-entities');config[_0x7a47('0xf')]=_[_0x7a47('0x10')](config[_0x7a47('0xf')],{'host':_0x7a47('0x11'),'port':0x18eb});var socket=require(_0x7a47('0x12'))(new Redis(config['redis']));require(_0x7a47('0x13'))[_0x7a47('0x14')](socket);function respondWithStatusCode(_0x287614,_0x5ac655){_0x5ac655=_0x5ac655||0xcc;return function(_0x27a83b){if(_0x27a83b){return _0x287614[_0x7a47('0x15')](_0x5ac655);}return _0x287614['status'](_0x5ac655)[_0x7a47('0x16')]();};}function respondWithResult(_0x437fe0,_0x64f81a){_0x64f81a=_0x64f81a||0xc8;return function(_0x463f5e){if(_0x463f5e){return _0x437fe0[_0x7a47('0x17')](_0x64f81a)[_0x7a47('0x18')](_0x463f5e);}};}function respondWithFilteredResult(_0x57acb1,_0x41ad30){return function(_0x57f95d){if(_0x57f95d){var _0x3dda7e=typeof _0x41ad30[_0x7a47('0x19')]==='undefined'&&typeof _0x41ad30[_0x7a47('0x1a')]===_0x7a47('0x1b');var _0x283518=_0x57f95d[_0x7a47('0x1c')];var _0x434dcd=_0x3dda7e?0x0:_0x41ad30['offset'];var _0x97f9f7=_0x3dda7e?_0x57f95d[_0x7a47('0x1c')]:_0x41ad30['offset']+_0x41ad30[_0x7a47('0x1a')];var _0x275775;if(_0x97f9f7>=_0x283518){_0x97f9f7=_0x283518;_0x275775=0xc8;}else{_0x275775=0xce;}_0x57acb1[_0x7a47('0x17')](_0x275775);return _0x57acb1[_0x7a47('0x1d')](_0x7a47('0x1e'),_0x434dcd+'-'+_0x97f9f7+'/'+_0x283518)[_0x7a47('0x18')](_0x57f95d);}return null;};}function saveUpdates(_0x1322a5){return function(_0x10dbe9){if(_0x10dbe9){return _0x10dbe9['update'](_0x1322a5)[_0x7a47('0x1f')](function(_0x19d4ff){return _0x19d4ff;});}return null;};}function removeEntity(_0x163b0e){return function(_0x56790e){if(_0x56790e){return _0x56790e[_0x7a47('0x20')]()['then'](function(){_0x163b0e[_0x7a47('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9baf){return function(_0x1e4292){if(!_0x1e4292){_0x1b9baf[_0x7a47('0x15')](0x194);}return _0x1e4292;};}function handleError(_0x377865,_0x412882){_0x412882=_0x412882||0x1f4;return function(_0x5534f7){logger['error'](_0x5534f7[_0x7a47('0x21')]);if(_0x5534f7[_0x7a47('0x22')]){delete _0x5534f7[_0x7a47('0x22')];}_0x377865[_0x7a47('0x17')](_0x412882)[_0x7a47('0x23')](_0x5534f7);};}function getInteractionUsers(_0x35c454,_0xaaad85){return new BPromise(function(_0x48fa2e,_0x4aa0d0){try{if(_0xaaad85[_0x35c454['id']]){_0x35c454[_0x7a47('0x24')]=_[_0x7a47('0x25')](_0xaaad85[_0x35c454['id']],function(_0xeeca2e){return{'id':_0xeeca2e['id'],'fullname':_0xeeca2e['fullname']};});}}catch(_0x1c6393){_0x4aa0d0(_0x1c6393);}_0x48fa2e(_0x35c454);});}function getInteractionTags(_0xc01b5,_0x261fd0){return new BPromise(function(_0x218c91,_0x2195dc){try{if(_0xc01b5[_0x7a47('0x26')]){_0xc01b5[_0x7a47('0x27')]=[];_0xc01b5[_0x7a47('0x26')][_0x7a47('0x28')](',')['forEach'](function(_0x3a183c){_0xc01b5['Tags']['push'](_0x261fd0[_0x3a183c]);});}delete _0xc01b5[_0x7a47('0x26')];}catch(_0x1fd66b){_0x2195dc(_0x1fd66b);}_0x218c91(_0xc01b5);});}function getLastMessageText(_0x4f98f0){return new BPromise(function(_0x38d508,_0x15c82b){return db[_0x7a47('0x29')][_0x7a47('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x4f98f0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7a47('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7a47('0x2c')],'order':_0x7a47('0x2d'),'raw':!![]})['then'](function(_0x29353e){if(_0x29353e&&_0x29353e[_0x7a47('0x2c')]){_0x4f98f0['lastMsgText']=_['trimStart'](_0x29353e[_0x7a47('0x2c')]);}_0x38d508(_0x4f98f0);})['catch'](function(_0xffa139){_0x15c82b(_0xffa139);});});}function updateMailInteraction(_0xc964d2,_0x88bcc4,_0x4d9359,_0x1239dd){return new BPromise(function(_0x1f8e42,_0x453465){return getInteractionUsers(_0xc964d2,_0x4d9359)[_0x7a47('0x1f')](function(_0x298af7){return getInteractionTags(_0x298af7,_0x88bcc4);})[_0x7a47('0x1f')](function(_0x3113c1){if(_0x1239dd){_0x1f8e42(getLastMessageText(_0x3113c1));}else{_0x1f8e42(_0x3113c1);}})['catch'](function(_0xa28118){_0x453465(_0xa28118);});});}exports[_0x7a47('0x2e')]=function(_0x21adad,_0x1a76b3){var _0x3e29bf={},_0x53bafd={},_0x4faa95={'count':0x0,'rows':[]};var _0x39c74b=_[_0x7a47('0x25')](db[_0x7a47('0x2f')][_0x7a47('0x30')],function(_0xc50bc7){return{'name':_0xc50bc7[_0x7a47('0x31')],'type':_0xc50bc7[_0x7a47('0x32')][_0x7a47('0x33')]};});_0x53bafd['model']=_[_0x7a47('0x25')](_0x39c74b,_0x7a47('0x22'));_0x53bafd[_0x7a47('0x34')]=_[_0x7a47('0x35')](_0x21adad[_0x7a47('0x34')]);_0x53bafd['filters']=_[_0x7a47('0x36')](_0x53bafd['model'],_0x53bafd[_0x7a47('0x34')]);_0x3e29bf[_0x7a47('0x37')]=_[_0x7a47('0x36')](_0x53bafd[_0x7a47('0x38')],qs[_0x7a47('0x39')](_0x21adad['query'][_0x7a47('0x39')]));_0x3e29bf[_0x7a47('0x37')]=_0x3e29bf[_0x7a47('0x37')]['length']?_0x3e29bf['attributes']:_0x53bafd[_0x7a47('0x38')];if(!_0x21adad[_0x7a47('0x34')][_0x7a47('0x3a')](_0x7a47('0x3b'))){_0x3e29bf[_0x7a47('0x1a')]=qs[_0x7a47('0x1a')](_0x21adad[_0x7a47('0x34')]['limit']);_0x3e29bf[_0x7a47('0x19')]=qs['offset'](_0x21adad[_0x7a47('0x34')][_0x7a47('0x19')]);}_0x3e29bf['order']=qs[_0x7a47('0x3c')](_0x21adad['query'][_0x7a47('0x3c')]);_0x3e29bf['where']=qs['filters'](_[_0x7a47('0x3d')](_0x21adad[_0x7a47('0x34')],_0x53bafd[_0x7a47('0x3e')]),_0x39c74b);var _0x2d60db=[];var _0x575b00=squel[_0x7a47('0x3f')]()[_0x7a47('0x40')]('id')['field'](_0x7a47('0x22'))['field']('color')['from'](_0x7a47('0x41'));var _0x72c0b4=squel[_0x7a47('0x3f')]()['field'](_0x7a47('0x42'))[_0x7a47('0x40')](_0x7a47('0x43'))[_0x7a47('0x40')](_0x7a47('0x44'))['from']('user_has_mail_interactions','ui')['left_join'](_0x7a47('0x45'),'u',_0x7a47('0x46'));var _0x48ce76=squel['select']()[_0x7a47('0x47')](_0x7a47('0x48'),'i')['left_join'](_0x7a47('0x49'),'c',_0x7a47('0x4a'))[_0x7a47('0x4b')](_0x7a47('0x45'),'o',_0x7a47('0x4c'))[_0x7a47('0x4b')](_0x7a47('0x4d'),'a',_0x7a47('0x4e'))[_0x7a47('0x4b')](_0x7a47('0x4f'),'me',_0x7a47('0x50'))['left_join']('mail_interaction_has_tags','it',_0x7a47('0x51'))[_0x7a47('0x4b')]('tools_tags','t',_0x7a47('0x52'));var _0x382120=squel[_0x7a47('0x53')]();var _0xaf9d83=[];var _0x11fa36=squel[_0x7a47('0x53')]();var _0x3cd0fd;if(_0x21adad['query'][_0x7a47('0x54')]){_0x3cd0fd=as['parseSearch'](_0x21adad[_0x7a47('0x34')][_0x7a47('0x54')]);var _0x2d7f72=_0x3cd0fd['sqlOperator'];for(var _0xe7d4e3=0x0;_0xe7d4e3<_0x3cd0fd['conditions']['length'];_0xe7d4e3++){var _0x1efb06=_0x3cd0fd[_0x7a47('0x55')][_0xe7d4e3];var _0x281238='i';var _0x368760=_[_0x7a47('0x56')](_0x39c74b,[_0x7a47('0x22'),_0x1efb06['field']]);if(!_0x368760){switch(_0x1efb06[_0x7a47('0x40')]){case _0x7a47('0x57'):if(_0x1efb06[_0x7a47('0x58')]==0x1){_0x48ce76[_0x7a47('0x59')]('`'+_0x1efb06['field']+_0x7a47('0x5a'));}else{_0x48ce76[_0x7a47('0x59')]('`'+_0x1efb06['field']+_0x7a47('0x5b'));}break;case _0x7a47('0x5c'):if(_0x1efb06[_0x7a47('0x5d')]===_0x7a47('0x5e')){if(_0x1efb06[_0x7a47('0x58')][_0x7a47('0x28')]('\x20')['length']>0x1){_0x382120[_0x2d7f72](_0x7a47('0x5f'),qs[_0x7a47('0x60')](_0x1efb06[_0x7a47('0x58')]),null);}else{var _0x3e8ae5='%'+_0x1efb06[_0x7a47('0x58')]+'%';_0x382120[_0x2d7f72]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3e8ae5,_0x3e8ae5,_0x3e8ae5);}}else{_0x368760=_[_0x7a47('0x56')](_0x39c74b,[_0x7a47('0x22'),'ContactId']);_0x1efb06['field']=_0x7a47('0x61');_0x506365=as['buildExpression'](_0x281238,_0x368760[_0x7a47('0x32')],_0x1efb06);_0x382120[_0x2d7f72](_0x506365[_0x7a47('0x62')],_0x506365[_0x7a47('0x58')][_0x7a47('0x63')],_0x506365[_0x7a47('0x58')][_0x7a47('0x16')]);}break;case'Tag':var _0x2658ca=_0x1efb06['value'][_0x7a47('0x28')](',')[_0x7a47('0x25')](function(_0x1cc658){return Number(_0x1cc658);});_0x2658ca['forEach'](function(_0x253e8d){_0x11fa36['or'](_0x7a47('0x64'),'%,'+_0x253e8d+',%');});_0xaf9d83=_[_0x7a47('0x65')](_0xaf9d83,_0x2658ca);break;case _0x7a47('0x66'):if(_0x1efb06[_0x7a47('0x5d')]==='$substring'){_0x382120[_0x2d7f72](_0x7a47('0x67'),'%'+_0x1efb06[_0x7a47('0x58')]+'%',null);}else{_0x368760=_[_0x7a47('0x56')](_0x39c74b,[_0x7a47('0x22'),'UserId']);_0x1efb06[_0x7a47('0x40')]=_0x7a47('0x68');_0x506365=as[_0x7a47('0x69')](_0x281238,_0x368760['type'],_0x1efb06);_0x382120[_0x2d7f72](_0x506365['text'],_0x506365[_0x7a47('0x58')][_0x7a47('0x63')],_0x506365[_0x7a47('0x58')][_0x7a47('0x16')]);}break;case _0x7a47('0x2c'):_0x506365=as[_0x7a47('0x69')]('me',null,_0x1efb06);_0x382120[_0x2d7f72](_0x506365[_0x7a47('0x62')],_0x506365[_0x7a47('0x58')]['start'],_0x506365['value'][_0x7a47('0x16')]);break;}}else{var _0x506365=as[_0x7a47('0x69')](_0x281238,_0x368760[_0x7a47('0x32')],_0x1efb06);_0x382120[_0x2d7f72](_0x506365[_0x7a47('0x62')],_0x506365['value']['start'],_0x506365[_0x7a47('0x58')][_0x7a47('0x16')]);}}}else{var _0x4dc684=_(_0x21adad[_0x7a47('0x34')])[_0x7a47('0x35')]()[_0x7a47('0x25')](function(_0x410135){return _[_0x7a47('0x6a')](_0x39c74b,['name',_0x410135])?_0x410135:undefined;})[_0x7a47('0x6b')]()[_0x7a47('0x58')]();if(!_[_0x7a47('0x6c')](_0x4dc684)){_0x4dc684[_0x7a47('0x6d')](function(_0x20afbd){if(_0x20afbd===_0x7a47('0x6e')){_0x48ce76['where'](_0x7a47('0x6f'),[][_0x7a47('0x70')](_0x21adad[_0x7a47('0x34')][_0x20afbd]));}else if(_0x20afbd===_0x7a47('0x71')){var _0x16cadd=JSON[_0x7a47('0x72')](_0x21adad[_0x7a47('0x34')][_0x20afbd])['$gte'];var _0x43db59=JSON[_0x7a47('0x72')](_0x21adad[_0x7a47('0x34')][_0x20afbd])[_0x7a47('0x73')];_0x48ce76['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cadd,_0x43db59);}else{if(_0x21adad[_0x7a47('0x34')][_0x20afbd]==='null'){_0x48ce76[_0x7a47('0x74')]('i.'+_0x20afbd+'\x20IS\x20NULL');}else{_0x48ce76[_0x7a47('0x74')]('i.'+_0x20afbd+_0x7a47('0x75'),_0x21adad[_0x7a47('0x34')][_0x20afbd]);}}});}if(_0x21adad[_0x7a47('0x34')][_0x7a47('0x76')]){if(_0x21adad[_0x7a47('0x34')][_0x7a47('0x76')]==0x1){_0x48ce76['having'](_0x7a47('0x77'));}else{_0x48ce76['having'](_0x7a47('0x78'));}}if(_0x21adad[_0x7a47('0x34')][_0x7a47('0x79')]){_0xaf9d83=_[_0x7a47('0x7a')](_0x21adad[_0x7a47('0x34')]['tag'])?_0x21adad[_0x7a47('0x34')][_0x7a47('0x79')]:new Array(_0x21adad[_0x7a47('0x34')][_0x7a47('0x79')]);_0xaf9d83[_0x7a47('0x6d')](function(_0x5cc520){_0x11fa36['or'](_0x7a47('0x64'),'%,'+_0x5cc520+',%');});}if(_0x21adad['query'][_0x7a47('0x7b')]){var _0x21ae93=_0x21adad['query'][_0x7a47('0x7b')]['replace']('\x5c','\x5c\x5c')[_0x7a47('0x7c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x21ae93)){_0x382120['or']('i.id\x20LIKE\x20?',_0x21ae93+'%');}else if(qs[_0x7a47('0x7d')](_0x21ae93)){_0x382120['or'](_0x7a47('0x7e'),_0x21ae93+'%');}else{_0x382120['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7a47('0x60')](_0x21ae93))['or'](_0x7a47('0x7f'),qs[_0x7a47('0x60')](_0x21ae93));}}}_0x48ce76[_0x7a47('0x74')](_0x382120);_0x48ce76[_0x7a47('0x80')](_0x7a47('0x81'));var _0x317e3c={'type':db[_0x7a47('0x82')]['QueryTypes'][_0x7a47('0x83')],'raw':!![]};var _0x3f796c=_0x48ce76[_0x7a47('0x84')]();_0x3f796c[_0x7a47('0x40')](_0x7a47('0x81'));_0x3f796c[_0x7a47('0x40')](_0x7a47('0x85'),_0x7a47('0x57'));if(_0x3e29bf[_0x7a47('0x86')]){_0x3e29bf[_0x7a47('0x86')]['forEach'](function(_0x81b710){var _0x4a63fb=_0x81b710[0x0]===_0x7a47('0x87')?_0x81b710[0x0]:'i.'+_0x81b710[0x0];_0x48ce76[_0x7a47('0x86')](_0x4a63fb,_0x81b710[0x1]===_0x7a47('0x88')?![]:!![]);});}if(!_[_0x7a47('0x6c')](_0xaf9d83)){_0x48ce76[_0x7a47('0x59')](_0x11fa36);_0x3f796c[_0x7a47('0x74')]('t.id\x20IN\x20?',_0xaf9d83);}BPromise[_0x7a47('0x89')]()['then'](function(){if(!_0x3cd0fd){if(_0x21adad[_0x7a47('0x34')][_0x7a47('0x6e')])return;_0x3f796c['where'](_0x7a47('0x8a'));_0x48ce76[_0x7a47('0x74')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x21adad[_0x7a47('0x8b')][_0x7a47('0x8c')]!==_0x7a47('0x8d'))return;return _0x21adad[_0x7a47('0x8b')][_0x7a47('0x8e')]({'attributes':['id'],'raw':!![]})[_0x7a47('0x1f')](function(_0x567c04){if(_[_0x7a47('0x6c')](_0x567c04)){_0x3f796c[_0x7a47('0x74')](_0x7a47('0x8f'));_0x48ce76['where'](_0x7a47('0x8f'));}else{_0x3f796c[_0x7a47('0x74')](_0x7a47('0x6f'),_[_0x7a47('0x25')](_0x567c04,'id'));_0x48ce76[_0x7a47('0x74')](_0x7a47('0x6f'),_[_0x7a47('0x25')](_0x567c04,'id'));}});})[_0x7a47('0x1f')](function(){if(_0x21adad['user'][_0x7a47('0x8c')]===_0x7a47('0x8d')&&!_0x3cd0fd&&!_0x21adad[_0x7a47('0x34')][_0x7a47('0x6e')])return[];return db['sequelize'][_0x7a47('0x34')](_0x3f796c[_0x7a47('0x90')](),_0x317e3c);})[_0x7a47('0x1f')](function(_0x460693){_0x4faa95[_0x7a47('0x1c')]=_0x460693['length'];if(_0x4faa95['count']===0x0)return[];return db['sequelize'][_0x7a47('0x34')](_0x575b00[_0x7a47('0x90')](),_0x317e3c)['then'](function(_0x42b25a){_0x2d60db=_[_0x7a47('0x91')](_0x42b25a,'id');_0x317e3c=_[_0x7a47('0x92')](_0x317e3c,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21adad[_0x7a47('0x34')]['fields']){_0x3e29bf[_0x7a47('0x37')]['forEach'](function(_0x4cb281){_0x48ce76[_0x7a47('0x40')]('i.'+_0x4cb281);});}else{_0x48ce76[_0x7a47('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7a47('0x57'));_0x48ce76[_0x7a47('0x40')]('a.key','Account.key');_0x48ce76[_0x7a47('0x40')](_0x7a47('0x93'),_0x7a47('0x94'));_0x48ce76[_0x7a47('0x40')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x7a47('0x87'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0x81'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0x95'));_0x48ce76[_0x7a47('0x40')]('i.updatedAt');_0x48ce76['field'](_0x7a47('0x96'));_0x48ce76[_0x7a47('0x40')]('i.closedAt');_0x48ce76[_0x7a47('0x40')](_0x7a47('0x97'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0x98'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0x99'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0x9a'));_0x48ce76[_0x7a47('0x40')]('i.disposition');_0x48ce76[_0x7a47('0x40')](_0x7a47('0x9b'));_0x48ce76[_0x7a47('0x40')]('i.thirdDisposition');_0x48ce76[_0x7a47('0x40')](_0x7a47('0x9c'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0x9d'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0x9e'));_0x48ce76['field'](_0x7a47('0x9f'));_0x48ce76['field']('i.UserId');_0x48ce76[_0x7a47('0x40')]('c.firstName',_0x7a47('0xa0'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0xa1'),_0x7a47('0xa2'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0xa3'),_0x7a47('0xa4'));_0x48ce76['field'](_0x7a47('0xa5'),'Contact.phone');_0x48ce76[_0x7a47('0x40')]('c.mobile',_0x7a47('0xa6'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0xa7'),'Contact.fax');_0x48ce76[_0x7a47('0x40')](_0x7a47('0xa8'),_0x7a47('0xa9'));_0x48ce76[_0x7a47('0x40')](_0x7a47('0xaa'),_0x7a47('0xab'));_0x48ce76[_0x7a47('0x40')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7a47('0x26'));}if(_0x3e29bf[_0x7a47('0x1a')])_0x48ce76['limit'](_0x3e29bf[_0x7a47('0x1a')]);if(_0x3e29bf['offset'])_0x48ce76[_0x7a47('0x19')](_0x3e29bf[_0x7a47('0x19')]);return db[_0x7a47('0xac')][_0x7a47('0x34')](_0x48ce76[_0x7a47('0x90')](),_0x317e3c);})[_0x7a47('0x1f')](function(_0x5ecdec){if(_0x5ecdec[_0x7a47('0xad')]>0x0)_0x72c0b4[_0x7a47('0x74')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x5ecdec,'id'));return db[_0x7a47('0xac')][_0x7a47('0x34')](_0x72c0b4[_0x7a47('0x90')](),_0x317e3c)[_0x7a47('0x1f')](function(_0x26bdac){var _0x2e01d6=_[_0x7a47('0xae')](_0x26bdac,_0x7a47('0xaf'));var _0x2d3173=[];return db[_0x7a47('0xb0')]['findOne']({'attributes':[_0x7a47('0xb1')],'raw':!![]})[_0x7a47('0x1f')](function(_0x1bf7d5){var _0x1d504c=_0x1bf7d5[_0x7a47('0xb1')];_0x5ecdec[_0x7a47('0x6d')](function(_0x3906c2){_0x2d3173['push'](updateMailInteraction(_0x3906c2,_0x2d60db,_0x2e01d6,_0x1d504c));});return BPromise[_0x7a47('0xb2')](_0x2d3173);});});});})[_0x7a47('0x1f')](function(_0xcda979){_0x4faa95[_0x7a47('0xb3')]=_0xcda979;return _0x4faa95;})[_0x7a47('0x1f')](respondWithFilteredResult(_0x1a76b3,_0x3e29bf))[_0x7a47('0xb4')](handleError(_0x1a76b3,null));};exports['show']=function(_0x2ed64a,_0x2ae7b3){var _0x5873ad={'raw':![],'where':{'id':_0x2ed64a['params']['id']}},_0x4de190={};_0x4de190[_0x7a47('0x38')]=_['keys'](db[_0x7a47('0x2f')][_0x7a47('0x30')]);_0x4de190[_0x7a47('0x34')]=_[_0x7a47('0x35')](_0x2ed64a[_0x7a47('0x34')]);_0x4de190['filters']=_[_0x7a47('0x36')](_0x4de190['model'],_0x4de190['query']);_0x5873ad[_0x7a47('0x37')]=_[_0x7a47('0x36')](_0x4de190['model'],qs[_0x7a47('0x39')](_0x2ed64a[_0x7a47('0x34')][_0x7a47('0x39')]));_0x5873ad[_0x7a47('0x37')]=_0x5873ad[_0x7a47('0x37')][_0x7a47('0xad')]?_0x5873ad[_0x7a47('0x37')]:_0x4de190[_0x7a47('0x38')];if(_0x2ed64a[_0x7a47('0x34')][_0x7a47('0xb5')]){_0x5873ad[_0x7a47('0xb6')]=[{'all':!![]}];}_0x5873ad=_[_0x7a47('0x92')]({},_0x5873ad,_0x2ed64a[_0x7a47('0xb7')]);return db[_0x7a47('0x2f')][_0x7a47('0x56')](_0x5873ad)[_0x7a47('0x1f')](handleEntityNotFound(_0x2ae7b3,null))[_0x7a47('0x1f')](respondWithResult(_0x2ae7b3,null))[_0x7a47('0xb4')](handleError(_0x2ae7b3,null));};exports[_0x7a47('0xb8')]=function(_0x237b45,_0x4b6e6d){return db['MailInteraction'][_0x7a47('0xb8')](_0x237b45[_0x7a47('0xb9')],{})[_0x7a47('0x1f')](respondWithResult(_0x4b6e6d,0xc9))[_0x7a47('0xb4')](handleError(_0x4b6e6d,null));};exports[_0x7a47('0xba')]=function(_0x400e52,_0x1fec84){if(_0x400e52[_0x7a47('0xb9')]['id']){delete _0x400e52[_0x7a47('0xb9')]['id'];}return db[_0x7a47('0x2f')][_0x7a47('0x56')]({'where':{'id':_0x400e52[_0x7a47('0xbb')]['id']}})[_0x7a47('0x1f')](handleEntityNotFound(_0x1fec84,null))['then'](saveUpdates(_0x400e52[_0x7a47('0xb9')],null))[_0x7a47('0x1f')](respondWithResult(_0x1fec84,null))['catch'](handleError(_0x1fec84,null));};exports['destroy']=function(_0xc0ddd8,_0x36e033){return db['MailInteraction'][_0x7a47('0x56')]({'where':{'id':_0xc0ddd8[_0x7a47('0xbb')]['id']}})[_0x7a47('0x1f')](handleEntityNotFound(_0x36e033,null))[_0x7a47('0x1f')](removeEntity(_0x36e033,null))[_0x7a47('0xb4')](handleError(_0x36e033,null));};exports['describe']=function(_0x5a79ed,_0x3ec294){return db[_0x7a47('0x2f')][_0x7a47('0xbc')]()[_0x7a47('0x1f')](respondWithResult(_0x3ec294,null))[_0x7a47('0xb4')](handleError(_0x3ec294,null));};exports[_0x7a47('0xbd')]=function(_0x31d7b3,_0x305077){return db[_0x7a47('0x29')][_0x7a47('0x56')]({'where':{'id':_0x31d7b3[_0x7a47('0xbb')]['id']}})[_0x7a47('0x1f')](handleEntityNotFound(_0x305077,null))[_0x7a47('0x1f')](function(_0x35c4f1){if(_0x35c4f1){return _0x35c4f1[_0x7a47('0xbd')](_0x31d7b3[_0x7a47('0xb9')][_0x7a47('0xbe')],_[_0x7a47('0xbf')](_0x31d7b3[_0x7a47('0xb9')],['ids','id'])||{});}})[_0x7a47('0x1f')](respondWithResult(_0x305077,null))['catch'](handleError(_0x305077,null));};exports[_0x7a47('0xc0')]=function(_0x22b2e8,_0x2fdca5){var _0x1d67d3={'raw':![],'where':{}};var _0x3e45d4={};var _0x2f5bd={'count':0x0,'rows':[]};return db['MailInteraction'][_0x7a47('0x2a')]({'where':{'id':_0x22b2e8[_0x7a47('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2fdca5,null))[_0x7a47('0x1f')](function(_0x5877b7){if(_0x5877b7){_0x3e45d4['model']=_['keys'](db[_0x7a47('0x29')][_0x7a47('0x30')]);_0x3e45d4[_0x7a47('0x34')]=_['keys'](_0x22b2e8[_0x7a47('0x34')]);_0x3e45d4[_0x7a47('0x3e')]=_[_0x7a47('0x36')](_0x3e45d4[_0x7a47('0x38')],_0x3e45d4[_0x7a47('0x34')]);_0x1d67d3['attributes']=_[_0x7a47('0x36')](_0x3e45d4[_0x7a47('0x38')],qs[_0x7a47('0x39')](_0x22b2e8[_0x7a47('0x34')][_0x7a47('0x39')]));_0x1d67d3[_0x7a47('0x37')]=_0x1d67d3[_0x7a47('0x37')][_0x7a47('0xad')]?_0x1d67d3['attributes']:_0x3e45d4[_0x7a47('0x38')];if(!_0x22b2e8['query'][_0x7a47('0x3a')]('nolimit')){_0x1d67d3[_0x7a47('0x1a')]=qs['limit'](_0x22b2e8['query'][_0x7a47('0x1a')]);_0x1d67d3[_0x7a47('0x19')]=qs[_0x7a47('0x19')](_0x22b2e8[_0x7a47('0x34')]['offset']);}_0x1d67d3[_0x7a47('0x86')]=qs['sort'](_0x22b2e8[_0x7a47('0x34')]['sort']);_0x1d67d3[_0x7a47('0x74')]=qs[_0x7a47('0x3e')](_['pick'](_0x22b2e8[_0x7a47('0x34')],_0x3e45d4[_0x7a47('0x3e')]));_0x1d67d3[_0x7a47('0x74')]['MailInteractionId']=_0x5877b7['id'];if(_0x22b2e8[_0x7a47('0x34')]['filter']){_0x1d67d3[_0x7a47('0x74')]=_['merge'](_0x1d67d3[_0x7a47('0x74')],{'$or':_['map'](_0x1d67d3[_0x7a47('0x37')],function(_0x533eb9){var _0x1f6967={};_0x1f6967[_0x533eb9]={'$like':'%'+_0x22b2e8[_0x7a47('0x34')][_0x7a47('0x7b')]+'%'};return _0x1f6967;})});}if(_0x22b2e8[_0x7a47('0x34')][_0x7a47('0xc1')]){var _0x78d824=_0x22b2e8[_0x7a47('0x34')][_0x7a47('0xc1')][_0x7a47('0x28')](',');var _0x4b26e3={};_0x4b26e3[_0x78d824[0x0]]={'$gte':moment(_0x78d824[0x1])['format'](_0x7a47('0xc2'))};_0x1d67d3[_0x7a47('0x74')]=_[_0x7a47('0x92')](_0x1d67d3[_0x7a47('0x74')],_0x4b26e3);}_0x1d67d3=_['merge']({},_0x1d67d3,_0x22b2e8['options']);return db[_0x7a47('0x29')][_0x7a47('0x1c')]({'where':_0x1d67d3[_0x7a47('0x74')]})[_0x7a47('0x1f')](function(_0xa5f6ff){_0x2f5bd[_0x7a47('0x1c')]=_0xa5f6ff;if(_0x22b2e8[_0x7a47('0x34')][_0x7a47('0xb5')]){_0x1d67d3[_0x7a47('0xb6')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1d67d3);})['then'](function(_0x4b102b){if(_0x22b2e8['query'][_0x7a47('0xc3')]===_0x7a47('0xc4')){for(var _0x3d97d3=0x0;_0x3d97d3<_0x4b102b['length'];_0x3d97d3++){_0x4b102b[_0x3d97d3][_0x7a47('0xb9')]=juice(_0x4b102b[_0x3d97d3][_0x7a47('0xb9')]);}}_0x2f5bd[_0x7a47('0xb3')]=_0x4b102b;return _0x2f5bd;});}})[_0x7a47('0x1f')](respondWithFilteredResult(_0x2fdca5,_0x1d67d3))[_0x7a47('0xb4')](handleError(_0x2fdca5,null));};exports['addTags']=function(_0x2f77a3,_0xa76394){return db[_0x7a47('0x2f')][_0x7a47('0x56')]({'where':{'id':_0x2f77a3[_0x7a47('0xbb')]['id']}})['then'](handleEntityNotFound(_0xa76394,null))[_0x7a47('0x1f')](function(_0x3fc37b){if(_0x3fc37b){return _0x3fc37b[_0x7a47('0xc5')](_0x2f77a3[_0x7a47('0xb9')][_0x7a47('0xbe')],_[_0x7a47('0xbf')](_0x2f77a3[_0x7a47('0xb9')],['ids','id'])||{})[_0x7a47('0xc6')](function(){return db[_0x7a47('0xc7')][_0x7a47('0xc8')]({'attributes':['id',_0x7a47('0x22'),_0x7a47('0xc9')],'where':{'id':_0x2f77a3[_0x7a47('0xb9')]['ids']}});})[_0x7a47('0x1f')](function(_0x327e76){socket['emit'](_0x7a47('0xca'),{'id':Number(_0x2f77a3['params']['id']),'tags':_0x327e76||[]});return{'id':Number(_0x2f77a3[_0x7a47('0xbb')]['id']),'tags':_0x327e76||[]};});}})[_0x7a47('0x1f')](respondWithResult(_0xa76394,null))['catch'](handleError(_0xa76394,null));};exports['removeTags']=function(_0x213083,_0x133d08){return db[_0x7a47('0x2f')][_0x7a47('0x56')]({'where':{'id':_0x213083[_0x7a47('0xbb')]['id']}})[_0x7a47('0x1f')](handleEntityNotFound(_0x133d08,null))[_0x7a47('0x1f')](function(_0x65aa9f){if(_0x65aa9f){return _0x65aa9f[_0x7a47('0xcb')](_0x213083['query'][_0x7a47('0xbe')]);}})[_0x7a47('0x1f')](respondWithStatusCode(_0x133d08,null))[_0x7a47('0xb4')](handleError(_0x133d08,null));};exports[_0x7a47('0xcc')]=function(_0x3485da,_0x694cff){var _0x1170fe=moment()[_0x7a47('0xcd')]()['toString']();var _0xac5d2d=path['join'](config[_0x7a47('0xce')],_0x7a47('0xcf'),'files','tmp');var _0x4f27ec=path[_0x7a47('0xd0')](config[_0x7a47('0xce')],'server',_0x7a47('0xd1'),'attachments');var _0x3a7951=path['join'](_0xac5d2d,_0x1170fe);var _0x3b8bc3=util['format'](_0x7a47('0xd2'),_0x3485da[_0x7a47('0xbb')]['id'],_0x1170fe);var _0x57e7b4=path[_0x7a47('0xd0')](_0xac5d2d,_0x3b8bc3);var _0x5ce742=[];if(_0x3485da[_0x7a47('0x34')][_0x7a47('0xd3')]){_0x5ce742[_0x7a47('0xd4')]({'model':db[_0x7a47('0xd5')],'as':_0x7a47('0xd6'),'raw':!![]});}var _0x20d26e=[{'model':db[_0x7a47('0x29')],'as':_0x7a47('0xd7'),'attributes':['id','body',_0x7a47('0x47'),'to','cc',_0x7a47('0xd8'),'subject',_0x7a47('0x71')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x5ce742}];return db[_0x7a47('0x2f')][_0x7a47('0x56')]({'where':{'id':_0x3485da['params']['id']},'include':_0x20d26e})[_0x7a47('0x1f')](handleEntityNotFound(_0x694cff,null))[_0x7a47('0x1f')](function(_0x3d6426){if(_0x3d6426&&_0x3d6426[_0x7a47('0xd7')]){var _0x3e27fd=_0x3d6426[_0x7a47('0xd9')]({'plain':!![]});fs[_0x7a47('0xda')](_0x3a7951);return BPromise[_0x7a47('0xdb')](_0x3e27fd[_0x7a47('0xd7')],function(_0x3a1ab9,_0x4e7550){var _0x1b027c={'from':_0x3a1ab9[_0x7a47('0x47')],'to':_0x3a1ab9['to'],'subject':_0x3a1ab9['subject'],'html':htmlEntities[_0x7a47('0xdc')](_0x3a1ab9[_0x7a47('0xb9')]),'headers':{'Date':moment(_0x3a1ab9['createdAt'])[_0x7a47('0xdd')](_0x7a47('0xde'))},'attachments':[]};if(_0x3a1ab9['cc']){_0x1b027c[_0x7a47('0xdf')]['Cc']=_0x3a1ab9['cc'];}if(_0x3a1ab9['bcc']){_0x1b027c[_0x7a47('0xdf')][_0x7a47('0xe0')]=_0x3a1ab9[_0x7a47('0xd8')];}return new BPromise(function(_0x17c5ed,_0x49b1c7){if(_0x3a1ab9['Attachments']){for(var _0x3be423=0x0;_0x3be423<_0x3a1ab9[_0x7a47('0xd6')][_0x7a47('0xad')];_0x3be423++){var _0x82ece4=_0x3a1ab9[_0x7a47('0xd6')][_0x3be423];var _0x5e03e8=path[_0x7a47('0xd0')](_0x4f27ec,_0x82ece4[_0x7a47('0xe1')]);if(fs[_0x7a47('0xe2')](_0x5e03e8)){_0x1b027c[_0x7a47('0xd3')][_0x7a47('0xd4')]({'name':_0x82ece4[_0x7a47('0x22')],'contentType':_0x82ece4['type'],'data':fs[_0x7a47('0xe3')](_0x5e03e8)});}}}emlformat['build'](_0x1b027c,function(_0x2be95f,_0x533cf6){if(_0x2be95f)return _0x49b1c7(_0x2be95f);fs[_0x7a47('0xe4')](path[_0x7a47('0xd0')](_0x3a7951,util[_0x7a47('0xdd')]('message%d.eml',_0x4e7550)),_0x533cf6);return _0x17c5ed(_0x533cf6);});});})[_0x7a47('0x1f')](function(){return new BPromise(function(_0x34cb76,_0x27059b){zipdir(_0x3a7951,{'saveTo':_0x57e7b4},function(_0x1a45be,_0x572764){if(_0x1a45be)return _0x27059b(_0x1a45be);return _0x34cb76(_0x572764);});})['then'](function(){return new BPromise(function(_0x3d159b,_0x3ae572){rimraf(_0x3a7951,function(_0xde2a7e){if(_0xde2a7e)_0x3ae572(_0xde2a7e);return _0x3d159b();});});})[_0x7a47('0x1f')](function(){return _0x694cff[_0x7a47('0xcc')](_0x57e7b4,_0x3b8bc3,function(_0x39dca8){if(!_0x39dca8)fs[_0x7a47('0xe5')](_0x57e7b4);});});});}else{return _0x694cff[_0x7a47('0x15')](0xc8);}})[_0x7a47('0xb4')](handleError(_0x694cff,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6b29c7e..a8c7a89 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 _0xc0ca=['unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','then','setDataValue','Users','findAll'];(function(_0x844763,_0x234945){var _0x4270ef=function(_0x5182c8){while(--_0x5182c8){_0x844763['push'](_0x844763['shift']());}};_0x4270ef(++_0x234945);}(_0xc0ca,0x1e5));var _0xac0c=function(_0x11cd75,_0x3dac98){_0x11cd75=_0x11cd75-0x0;var _0x37fdf1=_0xc0ca[_0x11cd75];return _0x37fdf1;};'use strict';var EventEmitter=require(_0xac0c('0x0'));var MailInteraction=require(_0xac0c('0x1'))['db'][_0xac0c('0x2')];var MailMessage=require(_0xac0c('0x1'))['db'][_0xac0c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xac0c('0x4')](0x0);var events={'afterCreate':_0xac0c('0x5'),'afterUpdate':'update','afterDestroy':_0xac0c('0x6')};function emitEvent(_0x413042){return function(_0x283abe,_0x31136f,_0x46320b){_0x283abe['getUsers']({'attributes':['id'],'raw':!![]})[_0xac0c('0x7')](function(_0x5b8dd0){_0x283abe[_0xac0c('0x8')](_0xac0c('0x9'),_0x5b8dd0['map'](function(_0x54a6a9){return{'id':_0x54a6a9['id']};}));return MailMessage[_0xac0c('0xa')]({'where':{'MailInteractionId':_0x283abe['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac0c('0x7')](function(_0xfee001){_0x283abe['setDataValue'](_0xac0c('0xb'),_0xfee001[_0xac0c('0xc')]);MailInteractionEvents[_0xac0c('0xd')](_0x413042+':'+_0x283abe['id'],_0x283abe);MailInteractionEvents[_0xac0c('0xd')](_0x413042,_0x283abe);_0x46320b(null);})['catch'](_0x46320b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xac0c('0xe')](e,emitEvent(event));}}module[_0xac0c('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x859b=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers','then','Users','findAll','unreadMessages','length','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x859b,0x179));var _0xb859=function(_0x47919d,_0x124029){_0x47919d=_0x47919d-0x0;var _0x7fe5ec=_0x859b[_0x47919d];return _0x7fe5ec;};'use strict';var EventEmitter=require(_0xb859('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xb859('0x1'))['db'][_0xb859('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xb859('0x3')](0x0);var events={'afterCreate':_0xb859('0x4'),'afterUpdate':_0xb859('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5bcc7e){return function(_0x397af3,_0x461c3b,_0x506d7c){_0x397af3[_0xb859('0x6')]({'attributes':['id'],'raw':!![]})[_0xb859('0x7')](function(_0x709db3){_0x397af3['setDataValue'](_0xb859('0x8'),_0x709db3['map'](function(_0x4e9640){return{'id':_0x4e9640['id']};}));return MailMessage[_0xb859('0x9')]({'where':{'MailInteractionId':_0x397af3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb859('0x7')](function(_0xc32bad){_0x397af3['setDataValue'](_0xb859('0xa'),_0xc32bad[_0xb859('0xb')]);MailInteractionEvents[_0xb859('0xc')](_0x5bcc7e+':'+_0x397af3['id'],_0x397af3);MailInteractionEvents[_0xb859('0xc')](_0x5bcc7e,_0x397af3);_0x506d7c(null);})['catch'](_0x506d7c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb859('0xd')](e,emitEvent(event));}}module[_0xb859('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5ae8117..d3cf1a9 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 _0x7828=['define','MailInteraction','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','substatus','changed','closed','models','get','MailMessage','update','then','catch','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports'];(function(_0x59fee9,_0x3b4274){var _0x3a60a6=function(_0x30af23){while(--_0x30af23){_0x59fee9['push'](_0x59fee9['shift']());}};_0x3a60a6(++_0x3b4274);}(_0x7828,0xc6));var _0x8782=function(_0x2f8dbb,_0x578e01){_0x2f8dbb=_0x2f8dbb-0x0;var _0x369549=_0x7828[_0x2f8dbb];return _0x369549;};'use strict';var _=require(_0x8782('0x0'));var util=require(_0x8782('0x1'));var logger=require('../../config/logger')(_0x8782('0x2'));var moment=require(_0x8782('0x3'));var BPromise=require(_0x8782('0x4'));var rp=require(_0x8782('0x5'));var fs=require('fs');var path=require(_0x8782('0x6'));var rimraf=require('rimraf');var config=require(_0x8782('0x7'));var attributes=require(_0x8782('0x8'));module[_0x8782('0x9')]=function(_0x20c7ee,_0x5dad82){return _0x20c7ee[_0x8782('0xa')](_0x8782('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1f52a6,_0x355547,_0x19b9f2){if(_0x1f52a6['substatus']){_0x1f52a6[_0x8782('0xc')]=moment()[_0x8782('0xd')](_0x8782('0xe'));}if(_0x1f52a6['closed']){_0x1f52a6[_0x8782('0xf')]=moment()[_0x8782('0xd')](_0x8782('0xe'));}_0x19b9f2(null,_0x355547);},'beforeUpdate':function(_0x2dade4,_0x39ba8b,_0x3838ed){if(_0x2dade4['changed'](_0x8782('0x10'))){_0x2dade4['substatusAt']=_0x2dade4[_0x8782('0x10')]?moment()['format'](_0x8782('0xe')):null;}if(_0x2dade4[_0x8782('0x11')](_0x8782('0x12'))){_0x2dade4[_0x8782('0xf')]=moment()[_0x8782('0xd')](_0x8782('0xe'));_0x2dade4[_0x8782('0x10')]=null;_0x2dade4[_0x8782('0xc')]=null;}_0x3838ed(null,_0x2dade4);},'afterUpdate':function(_0x4573e2,_0x29c292,_0x5a0685){var _0x298234=_0x20c7ee[_0x8782('0x13')];var _0x28ba6b=_0x4573e2[_0x8782('0x14')]({'plain':!![]});if(_0x28ba6b[_0x8782('0x12')]){return _0x298234[_0x8782('0x15')][_0x8782('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x28ba6b['id']}})[_0x8782('0x17')](function(){_0x5a0685();})[_0x8782('0x18')](function(_0x261d14){_0x5a0685(_0x261d14);});}else{_0x5a0685();}}},'charset':_0x8782('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x29d6=['FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','MailMessage','update','then','catch','lodash','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x29d6,0x1c4));var _0x629d=function(_0x31d319,_0x124520){_0x31d319=_0x31d319-0x0;var _0x409f38=_0x29d6[_0x31d319];return _0x409f38;};'use strict';var _=require(_0x629d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x629d('0x1'));var moment=require('moment');var BPromise=require(_0x629d('0x2'));var rp=require(_0x629d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x629d('0x4'));var config=require(_0x629d('0x5'));var attributes=require(_0x629d('0x6'));module[_0x629d('0x7')]=function(_0x110ca4,_0x4f205e){return _0x110ca4['define'](_0x629d('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x629d('0x9'),'fields':['subject','to'],'type':_0x629d('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32a3bd,_0x4cb25f,_0x22b7f4){if(_0x32a3bd['substatus']){_0x32a3bd[_0x629d('0xb')]=moment()[_0x629d('0xc')](_0x629d('0xd'));}if(_0x32a3bd[_0x629d('0xe')]){_0x32a3bd[_0x629d('0xf')]=moment()[_0x629d('0xc')](_0x629d('0xd'));}_0x22b7f4(null,_0x4cb25f);},'beforeUpdate':function(_0x3572e6,_0x2b3544,_0x41bec0){if(_0x3572e6[_0x629d('0x10')](_0x629d('0x11'))){_0x3572e6[_0x629d('0xb')]=_0x3572e6[_0x629d('0x11')]?moment()[_0x629d('0xc')](_0x629d('0xd')):null;}if(_0x3572e6[_0x629d('0x10')](_0x629d('0xe'))){_0x3572e6[_0x629d('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3572e6['substatus']=null;_0x3572e6[_0x629d('0xb')]=null;}_0x41bec0(null,_0x3572e6);},'afterUpdate':function(_0x7e7ab4,_0x1c4b8c,_0x23d1ad){var _0x2f2dc6=_0x110ca4['models'];var _0x20bd82=_0x7e7ab4['get']({'plain':!![]});if(_0x20bd82['closed']){return _0x2f2dc6[_0x629d('0x12')][_0x629d('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x20bd82['id']}})[_0x629d('0x14')](function(){_0x23d1ad();})[_0x629d('0x15')](function(_0x1bd919){_0x23d1ad(_0x1bd919);});}else{_0x23d1ad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 65e0d36..6eef2b7 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 _0xfaee=['addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','MailInteraction','update','options','where','attributes','stringify','AddTagsToMailInteraction','find'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xfaee,0x15d));var _0xefae=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0xfaee[_0x528575];return _0x3063b7;};'use strict';var _=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var moment=require('moment');var BPromise=require(_0xefae('0x2'));var rs=require(_0xefae('0x3'));var fs=require('fs');var Redis=require(_0xefae('0x4'));var db=require(_0xefae('0x5'))['db'];var utils=require(_0xefae('0x6'));var logger=require(_0xefae('0x7'))(_0xefae('0x8'));var config=require(_0xefae('0x9'));var jayson=require(_0xefae('0xa'));var client=jayson[_0xefae('0xb')]['http']({'port':0x232a});config[_0xefae('0xc')]=_[_0xefae('0xd')](config[_0xefae('0xc')],{'host':_0xefae('0xe'),'port':0x18eb});var socket=require(_0xefae('0xf'))(new Redis(config['redis']));require(_0xefae('0x10'))[_0xefae('0x11')](socket);function respondWithRpcPromise(_0xe82a56,_0x32a9b3,_0x491520){return new BPromise(function(_0x5e5b38,_0x261768){return client[_0xefae('0x12')](_0xe82a56,_0x491520)[_0xefae('0x13')](function(_0x39a276){logger[_0xefae('0x14')]('MailInteraction,\x20%s,\x20%s',_0x32a9b3,_0xefae('0x15'));logger[_0xefae('0x16')](_0xefae('0x17'),_0x32a9b3,_0xefae('0x15'),JSON['stringify'](_0x39a276));if(_0x39a276[_0xefae('0x18')]){if(_0x39a276[_0xefae('0x18')][_0xefae('0x19')]===0x1f4){logger['error'](_0xefae('0x1a'),_0x32a9b3,_0x39a276[_0xefae('0x18')][_0xefae('0x1b')]);return _0x261768(_0x39a276[_0xefae('0x18')][_0xefae('0x1b')]);}logger[_0xefae('0x18')](_0xefae('0x1a'),_0x32a9b3,_0x39a276['error'][_0xefae('0x1b')]);return _0x5e5b38(_0x39a276[_0xefae('0x18')]['message']);}else{logger[_0xefae('0x14')](_0xefae('0x1a'),_0x32a9b3,_0xefae('0x15'));_0x5e5b38(_0x39a276['result'][_0xefae('0x1b')]);}})[_0xefae('0x1c')](function(_0x43776f){logger[_0xefae('0x18')](_0xefae('0x1a'),_0x32a9b3,_0x43776f);_0x261768(_0x43776f);});});}exports[_0xefae('0x1d')]=function(_0x5f410c){var _0x594546=this;return new Promise(function(_0x4b57d6,_0x30fa45){return db[_0xefae('0x1e')][_0xefae('0x1f')](_0x5f410c['body'],{'raw':_0x5f410c[_0xefae('0x20')]?_0x5f410c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f410c[_0xefae('0x20')]?_0x5f410c[_0xefae('0x20')][_0xefae('0x21')]||null:null,'attributes':_0x5f410c[_0xefae('0x20')]?_0x5f410c['options'][_0xefae('0x22')]||null:null,'limit':_0x5f410c[_0xefae('0x20')]?_0x5f410c[_0xefae('0x20')]['limit']||null:null})[_0xefae('0x13')](function(_0x1b83fc){logger['info'](_0xefae('0x1d'),_0x5f410c);logger[_0xefae('0x16')](_0xefae('0x1d'),_0x5f410c,JSON[_0xefae('0x23')](_0x1b83fc));_0x4b57d6(_0x1b83fc);})['catch'](function(_0x388244){logger['error'](_0xefae('0x1d'),_0x388244[_0xefae('0x1b')],_0x5f410c);_0x30fa45(_0x594546[_0xefae('0x18')](0x1f4,_0x388244['message']));});});};exports[_0xefae('0x24')]=function(_0x47a736){return new Promise(function(_0x4f0a78,_0x1e6b36){return db[_0xefae('0x1e')][_0xefae('0x25')]({'where':_0x47a736['options']?_0x47a736[_0xefae('0x20')][_0xefae('0x21')]||null:null})['then'](function(_0x140f60){if(_0x140f60){return _0x140f60[_0xefae('0x26')](_0x47a736['body'][_0xefae('0x27')],_[_0xefae('0x28')](_0x47a736['body'],[_0xefae('0x27'),'id'])||{});}})[_0xefae('0x29')](function(_0x166aa1){logger['info'](_0xefae('0x2a'),_0x47a736);logger[_0xefae('0x16')](_0xefae('0x2a'),_0x47a736,JSON['stringify'](_0x166aa1));_0x4f0a78(_0x166aa1);})[_0xefae('0x1c')](function(_0x39f10c){logger[_0xefae('0x18')]('AddTags',_0x39f10c[_0xefae('0x1b')],_0x47a736);_0x1e6b36(_this[_0xefae('0x18')](0x1f4,_0x39f10c[_0xefae('0x1b')]));});});}; \ No newline at end of file +var _0xfcbe=['ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x591a23,_0x26fd6b){_0x591a23=_0x591a23-0x0;var _0x8bf6c6=_0xfcbe[_0x591a23];return _0x8bf6c6;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var moment=require(_0xefcb('0x1'));var BPromise=require(_0xefcb('0x2'));var rs=require(_0xefcb('0x3'));var fs=require('fs');var Redis=require(_0xefcb('0x4'));var db=require(_0xefcb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xefcb('0x6'))(_0xefcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xefcb('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xefcb('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xefcb('0xa'))(new Redis(config[_0xefcb('0x9')]));require(_0xefcb('0xb'))['register'](socket);function respondWithRpcPromise(_0x35630e,_0x35f070,_0x527170){return new BPromise(function(_0x533ee5,_0x326270){return client[_0xefcb('0xc')](_0x35630e,_0x527170)[_0xefcb('0xd')](function(_0x3f9204){logger[_0xefcb('0xe')](_0xefcb('0xf'),_0x35f070,'request\x20sent');logger[_0xefcb('0x10')](_0xefcb('0x11'),_0x35f070,_0xefcb('0x12'),JSON[_0xefcb('0x13')](_0x3f9204));if(_0x3f9204[_0xefcb('0x14')]){if(_0x3f9204['error']['code']===0x1f4){logger[_0xefcb('0x14')](_0xefcb('0xf'),_0x35f070,_0x3f9204['error'][_0xefcb('0x15')]);return _0x326270(_0x3f9204['error'][_0xefcb('0x15')]);}logger['error'](_0xefcb('0xf'),_0x35f070,_0x3f9204[_0xefcb('0x14')][_0xefcb('0x15')]);return _0x533ee5(_0x3f9204[_0xefcb('0x14')][_0xefcb('0x15')]);}else{logger[_0xefcb('0xe')]('MailInteraction,\x20%s,\x20%s',_0x35f070,_0xefcb('0x12'));_0x533ee5(_0x3f9204[_0xefcb('0x16')][_0xefcb('0x15')]);}})[_0xefcb('0x17')](function(_0x1bd57c){logger[_0xefcb('0x14')](_0xefcb('0xf'),_0x35f070,_0x1bd57c);_0x326270(_0x1bd57c);});});}exports['UpdateMailInteraction']=function(_0x39ab04){var _0x3b7509=this;return new Promise(function(_0x5695b4,_0x12a93f){return db[_0xefcb('0x18')][_0xefcb('0x19')](_0x39ab04[_0xefcb('0x1a')],{'raw':_0x39ab04[_0xefcb('0x1b')]?_0x39ab04['options'][_0xefcb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ab04[_0xefcb('0x1b')]?_0x39ab04[_0xefcb('0x1b')][_0xefcb('0x1d')]||null:null,'attributes':_0x39ab04[_0xefcb('0x1b')]?_0x39ab04[_0xefcb('0x1b')][_0xefcb('0x1e')]||null:null,'limit':_0x39ab04[_0xefcb('0x1b')]?_0x39ab04['options']['limit']||null:null})['then'](function(_0x104212){logger[_0xefcb('0xe')](_0xefcb('0x1f'),_0x39ab04);logger[_0xefcb('0x10')](_0xefcb('0x1f'),_0x39ab04,JSON[_0xefcb('0x13')](_0x104212));_0x5695b4(_0x104212);})[_0xefcb('0x17')](function(_0x52ce86){logger[_0xefcb('0x14')](_0xefcb('0x1f'),_0x52ce86[_0xefcb('0x15')],_0x39ab04);_0x12a93f(_0x3b7509[_0xefcb('0x14')](0x1f4,_0x52ce86[_0xefcb('0x15')]));});});};exports[_0xefcb('0x20')]=function(_0x16757b){return new Promise(function(_0x36521c,_0x1c7ee1){return db[_0xefcb('0x18')][_0xefcb('0x21')]({'where':_0x16757b[_0xefcb('0x1b')]?_0x16757b[_0xefcb('0x1b')][_0xefcb('0x1d')]||null:null})[_0xefcb('0xd')](function(_0x518447){if(_0x518447){return _0x518447[_0xefcb('0x22')](_0x16757b[_0xefcb('0x1a')][_0xefcb('0x23')],_[_0xefcb('0x24')](_0x16757b[_0xefcb('0x1a')],[_0xefcb('0x23'),'id'])||{});}})[_0xefcb('0x25')](function(_0x5a436c){logger['info'](_0xefcb('0x26'),_0x16757b);logger[_0xefcb('0x10')]('AddTags',_0x16757b,JSON[_0xefcb('0x13')](_0x5a436c));_0x36521c(_0x5a436c);})[_0xefcb('0x17')](function(_0x3e7da7){logger['error'](_0xefcb('0x26'),_0x3e7da7[_0xefcb('0x15')],_0x16757b);_0x1c7ee1(_this[_0xefcb('0x14')](0x1f4,_0x3e7da7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a9359ea..9bff28e 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 _0xd122=['emit','removeListener','length','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x1de930,_0x39ed09){var _0x18ed21=function(_0x11560f){while(--_0x11560f){_0x1de930['push'](_0x1de930['shift']());}};_0x18ed21(++_0x39ed09);}(_0xd122,0x9e));var _0x2d12=function(_0x22e18f,_0x32e999){_0x22e18f=_0x22e18f-0x0;var _0x5d2227=_0xd122[_0x22e18f];return _0x5d2227;};'use strict';var MailInteractionEvents=require(_0x2d12('0x0'));var events=[_0x2d12('0x1'),'remove',_0x2d12('0x2')];function createListener(_0x5751f7,_0x546431){return function(_0x26f49b){_0x546431[_0x2d12('0x3')](_0x5751f7,_0x26f49b);};}function removeListener(_0x546eb9,_0x55fd1b){return function(){MailInteractionEvents[_0x2d12('0x4')](_0x546eb9,_0x55fd1b);};}exports['register']=function(_0x316684){for(var _0x439b97=0x0,_0x11dd35=events[_0x2d12('0x5')];_0x439b97<_0x11dd35;_0x439b97++){var _0x35a520=events[_0x439b97];var _0x16174c=createListener(_0x2d12('0x6')+_0x35a520,_0x316684);MailInteractionEvents['on'](_0x35a520,_0x16174c);}}; \ No newline at end of file +var _0x00ff=['update','emit','removeListener','register','mailInteraction:','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x00ff,0xe9));var _0xf00f=function(_0x153a85,_0x1e5c26){_0x153a85=_0x153a85-0x0;var _0x3607b9=_0x00ff[_0x153a85];return _0x3607b9;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xf00f('0x0'),_0xf00f('0x1')];function createListener(_0x2c4781,_0x129f22){return function(_0x6e03aa){_0x129f22[_0xf00f('0x2')](_0x2c4781,_0x6e03aa);};}function removeListener(_0x3ccafd,_0xa6afd9){return function(){MailInteractionEvents[_0xf00f('0x3')](_0x3ccafd,_0xa6afd9);};}exports[_0xf00f('0x4')]=function(_0x2ebc7c){for(var _0x5d5ef6=0x0,_0x4f9f35=events['length'];_0x5d5ef6<_0x4f9f35;_0x5d5ef6++){var _0x522e7a=events[_0x5d5ef6];var _0x3e7811=createListener(_0xf00f('0x5')+_0x522e7a,_0x2ebc7c);MailInteractionEvents['on'](_0x522e7a,_0x3e7811);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index becfdee..ed0f6b2 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 _0x93e7=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','isAuthenticated','get','describe','/:id','show','/:id/download','tracked','create','put'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x93e7,0x9e));var _0x793e=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x93e7[_0x3cea78];return _0x33b66b;};'use strict';var multer=require(_0x793e('0x0'));var util=require('util');var path=require(_0x793e('0x1'));var timeout=require(_0x793e('0x2'));var express=require('express');var router=express[_0x793e('0x3')]();var fs_extra=require(_0x793e('0x4'));var auth=require(_0x793e('0x5'));var interaction=require(_0x793e('0x6'));var config=require('../../config/environment');var controller=require(_0x793e('0x7'));router['get']('/',auth[_0x793e('0x8')](),controller['index']);router[_0x793e('0x9')]('/describe',auth[_0x793e('0x8')](),controller[_0x793e('0xa')]);router[_0x793e('0x9')](_0x793e('0xb'),auth[_0x793e('0x8')](),controller[_0x793e('0xc')]);router[_0x793e('0x9')](_0x793e('0xd'),auth[_0x793e('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),interaction[_0x793e('0xe')]('mail','mailmessage:create'),controller[_0x793e('0xf')]);router[_0x793e('0x10')]('/:id',auth[_0x793e('0x8')](),controller[_0x793e('0x11')]);router[_0x793e('0x10')](_0x793e('0x12'),auth[_0x793e('0x8')](),controller[_0x793e('0x13')]);router[_0x793e('0x10')](_0x793e('0x14'),auth[_0x793e('0x8')](),controller[_0x793e('0x15')]);router[_0x793e('0x16')](_0x793e('0xb'),auth[_0x793e('0x8')](),controller[_0x793e('0x17')]);module[_0x793e('0x18')]=router; \ No newline at end of file +var _0x7980=['./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x248cb3,_0x459c47){var _0xe0e822=function(_0x11a854){while(--_0x11a854){_0x248cb3['push'](_0x248cb3['shift']());}};_0xe0e822(++_0x459c47);}(_0x7980,0x123));var _0x0798=function(_0x34c349,_0x500dbf){_0x34c349=_0x34c349-0x0;var _0x523fff=_0x7980[_0x34c349];return _0x523fff;};'use strict';var multer=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var path=require('path');var timeout=require(_0x0798('0x2'));var express=require(_0x0798('0x3'));var router=express[_0x0798('0x4')]();var fs_extra=require(_0x0798('0x5'));var auth=require(_0x0798('0x6'));var interaction=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var controller=require(_0x0798('0x9'));router['get']('/',auth[_0x0798('0xa')](),controller[_0x0798('0xb')]);router[_0x0798('0xc')](_0x0798('0xd'),auth[_0x0798('0xa')](),controller[_0x0798('0xe')]);router['get'](_0x0798('0xf'),auth[_0x0798('0xa')](),controller[_0x0798('0x10')]);router[_0x0798('0xc')](_0x0798('0x11'),auth[_0x0798('0xa')](),controller[_0x0798('0x12')]);router[_0x0798('0x13')]('/',auth[_0x0798('0xa')](),interaction[_0x0798('0x14')](_0x0798('0x15'),_0x0798('0x16')),controller['create']);router[_0x0798('0x17')]('/:id',auth[_0x0798('0xa')](),controller['update']);router[_0x0798('0x17')]('/:id/accept',auth[_0x0798('0xa')](),controller[_0x0798('0x18')]);router[_0x0798('0x17')](_0x0798('0x19'),auth[_0x0798('0xa')](),controller[_0x0798('0x1a')]);router[_0x0798('0x1b')](_0x0798('0xf'),auth[_0x0798('0xa')](),controller[_0x0798('0x1c')]);module[_0x0798('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index ca940c5..9911e49 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 _0x7c11=['STRING','DATE','INTEGER','BOOLEAN','ENUM','Email','Chat','sequelize','exports','TEXT','long','medium','out'];(function(_0x533c35,_0x23d4f0){var _0x5f3d1b=function(_0x36c42b){while(--_0x36c42b){_0x533c35['push'](_0x533c35['shift']());}};_0x5f3d1b(++_0x23d4f0);}(_0x7c11,0x1ce));var _0x17c1=function(_0x3503ef,_0x2a72fe){_0x3503ef=_0x3503ef-0x0;var _0x2bff85=_0x7c11[_0x3503ef];return _0x2bff85;};'use strict';var Sequelize=require(_0x17c1('0x0'));var _=require('lodash');module[_0x17c1('0x1')]={'body':{'type':Sequelize[_0x17c1('0x2')](_0x17c1('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x17c1('0x2')](_0x17c1('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x17c1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x17c1('0x6')]},'to':{'type':Sequelize['TEXT'](_0x17c1('0x3'))},'cc':{'type':Sequelize[_0x17c1('0x2')](_0x17c1('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x17c1('0x3'))},'subject':{'type':Sequelize[_0x17c1('0x2')]},'sentAt':{'type':Sequelize[_0x17c1('0x7')]},'attach':{'type':Sequelize[_0x17c1('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x17c1('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x17c1('0x7')]},'originTo':{'type':Sequelize[_0x17c1('0x2')](_0x17c1('0x3'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x17c1('0xa')](_0x17c1('0xb'),_0x17c1('0xc')),'defaultValue':_0x17c1('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xdeb4=['DATE','INTEGER','Email','Chat','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','long'];(function(_0x41fdd1,_0x65b699){var _0x5a7e7e=function(_0x419f31){while(--_0x419f31){_0x41fdd1['push'](_0x41fdd1['shift']());}};_0x5a7e7e(++_0x65b699);}(_0xdeb4,0x178));var _0x4deb=function(_0x348b34,_0x528472){_0x348b34=_0x348b34-0x0;var _0x19b090=_0xdeb4[_0x348b34];return _0x19b090;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4deb('0x0'));module[_0x4deb('0x1')]={'body':{'type':Sequelize[_0x4deb('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4deb('0x2')](_0x4deb('0x3'))},'read':{'type':Sequelize[_0x4deb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4deb('0x5')]('in',_0x4deb('0x6')),'defaultValue':_0x4deb('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4deb('0x2')]('long')},'cc':{'type':Sequelize[_0x4deb('0x2')](_0x4deb('0x7'))},'bcc':{'type':Sequelize[_0x4deb('0x2')](_0x4deb('0x7'))},'subject':{'type':Sequelize[_0x4deb('0x2')]},'sentAt':{'type':Sequelize[_0x4deb('0x8')]},'attach':{'type':Sequelize[_0x4deb('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4deb('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4deb('0x2')]('long')},'originCc':{'type':Sequelize[_0x4deb('0x2')](_0x4deb('0x7'))},'originChannel':{'type':Sequelize[_0x4deb('0x5')](_0x4deb('0xa'),_0x4deb('0xb')),'defaultValue':_0x4deb('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index c05e55a..e6119f2 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 _0xb816=['List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','contact','download','unix','toString','join','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','offset','undefined','limit','count','set','json','destroy','end','stack','name','status','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','show','params','keys','find','update','body','describe','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','create','ListId'];(function(_0x30f0ae,_0x1e2cf8){var _0x161be4=function(_0xd76a83){while(--_0xd76a83){_0x30f0ae['push'](_0x30f0ae['shift']());}};_0x161be4(++_0x1e2cf8);}(_0xb816,0xe7));var _0x6b81=function(_0x3b767f,_0x17a099){_0x3b767f=_0x3b767f-0x0;var _0x439327=_0xb816[_0x3b767f];return _0x439327;};'use strict';var emlformat=require(_0x6b81('0x0'));var moment=require(_0x6b81('0x1'));var BPromise=require('bluebird');var util=require(_0x6b81('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x6b81('0x3'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0x6b81('0x4'));var logger=require(_0x6b81('0x5'))(_0x6b81('0x6'));var interaction_log=require(_0x6b81('0x5'))(_0x6b81('0x7'));var config=require(_0x6b81('0x8'));var db=require('../../mysqldb')['db'];config[_0x6b81('0x9')]=_[_0x6b81('0xa')](config[_0x6b81('0x9')],{'host':_0x6b81('0xb'),'port':0x18eb});var socket=require(_0x6b81('0xc'))(new Redis(config[_0x6b81('0x9')]));var htmlEntities=require(_0x6b81('0xd'));require(_0x6b81('0xe'))[_0x6b81('0xf')](socket);var jayson=require(_0x6b81('0x10'));var client=jayson[_0x6b81('0x11')][_0x6b81('0x12')]({'port':0x232c});var client9003=jayson[_0x6b81('0x11')]['http']({'port':0x232b});var client9002=jayson[_0x6b81('0x11')][_0x6b81('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x106772,_0x3a2f9d,_0x13d319,_0x214ca3){return new BPromise(function(_0x328779,_0x3b1b90){var _0x41fcbf=_0x214ca3||client;return _0x41fcbf['request'](_0x106772,_0x13d319)[_0x6b81('0x13')](function(_0x2afd90){logger[_0x6b81('0x14')](_0x6b81('0x15'),_0x3a2f9d,'request\x20sent');logger[_0x6b81('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3a2f9d,_0x6b81('0x17'),JSON[_0x6b81('0x18')](_0x2afd90));if(_0x2afd90[_0x6b81('0x19')]){if(_0x2afd90['error'][_0x6b81('0x1a')]===0x1f4){logger[_0x6b81('0x19')](_0x6b81('0x15'),_0x3a2f9d,_0x2afd90[_0x6b81('0x19')][_0x6b81('0x1b')]);return _0x3b1b90(_0x2afd90['error']['message']);}logger['error'](_0x6b81('0x15'),_0x3a2f9d,_0x2afd90['error'][_0x6b81('0x1b')]);return _0x328779(_0x2afd90[_0x6b81('0x19')][_0x6b81('0x1b')]);}else{logger[_0x6b81('0x14')](_0x6b81('0x15'),_0x3a2f9d,_0x6b81('0x17'));_0x328779(_0x2afd90['result']['message']);}})[_0x6b81('0x1c')](function(_0x14bc6d){logger[_0x6b81('0x19')](_0x6b81('0x15'),_0x3a2f9d,_0x14bc6d);_0x3b1b90(_0x14bc6d);});});}function respondWithResult(_0x5fb5b5,_0x49183c){_0x49183c=_0x49183c||0xc8;return function(_0x4023c0){if(_0x4023c0){return _0x5fb5b5['status'](_0x49183c)['json'](_0x4023c0);}};}function respondWithFilteredResult(_0x4230b7,_0x1af1d1){return function(_0x43561a){if(_0x43561a){var _0x537d78=typeof _0x1af1d1[_0x6b81('0x1d')]===_0x6b81('0x1e')&&typeof _0x1af1d1[_0x6b81('0x1f')]===_0x6b81('0x1e');var _0x33c530=_0x43561a[_0x6b81('0x20')];var _0x2a20de=_0x537d78?0x0:_0x1af1d1[_0x6b81('0x1d')];var _0x1baa72=_0x537d78?_0x43561a[_0x6b81('0x20')]:_0x1af1d1[_0x6b81('0x1d')]+_0x1af1d1[_0x6b81('0x1f')];var _0x274955;if(_0x1baa72>=_0x33c530){_0x1baa72=_0x33c530;_0x274955=0xc8;}else{_0x274955=0xce;}_0x4230b7['status'](_0x274955);return _0x4230b7[_0x6b81('0x21')]('Content-Range',_0x2a20de+'-'+_0x1baa72+'/'+_0x33c530)[_0x6b81('0x22')](_0x43561a);}return null;};}function saveUpdates(_0x1beaa2){return function(_0x329773){if(_0x329773){return _0x329773['update'](_0x1beaa2)[_0x6b81('0x13')](function(_0x7b05f2){return _0x7b05f2;});}return null;};}function removeEntity(_0x23315f){return function(_0x12de33){if(_0x12de33){return _0x12de33[_0x6b81('0x23')]()['then'](function(){_0x23315f['status'](0xcc)[_0x6b81('0x24')]();});}};}function handleEntityNotFound(_0x3a9cbd){return function(_0x525ee3){if(!_0x525ee3){_0x3a9cbd['sendStatus'](0x194);}return _0x525ee3;};}function handleError(_0x4befe6,_0x1028ec){_0x1028ec=_0x1028ec||0x1f4;return function(_0x153325){logger[_0x6b81('0x19')](_0x153325[_0x6b81('0x25')]);if(_0x153325[_0x6b81('0x26')]){delete _0x153325[_0x6b81('0x26')];}_0x4befe6[_0x6b81('0x27')](_0x1028ec)[_0x6b81('0x28')](_0x153325);};}exports['index']=function(_0x2c6610,_0x10f45e){var _0x1ede5e={},_0x2c0fbe={},_0x5b22c2={'count':0x0,'rows':[]};var _0x4e121e=_['map'](db['MailMessage'][_0x6b81('0x29')],function(_0x574a39){return{'name':_0x574a39[_0x6b81('0x2a')],'type':_0x574a39[_0x6b81('0x2b')][_0x6b81('0x2c')]};});_0x2c0fbe[_0x6b81('0x2d')]=_['map'](_0x4e121e,_0x6b81('0x26'));_0x2c0fbe[_0x6b81('0x2e')]=_['keys'](_0x2c6610['query']);_0x2c0fbe[_0x6b81('0x2f')]=_[_0x6b81('0x30')](_0x2c0fbe[_0x6b81('0x2d')],_0x2c0fbe[_0x6b81('0x2e')]);_0x1ede5e[_0x6b81('0x31')]=_[_0x6b81('0x30')](_0x2c0fbe['model'],qs[_0x6b81('0x32')](_0x2c6610[_0x6b81('0x2e')][_0x6b81('0x32')]));_0x1ede5e[_0x6b81('0x31')]=_0x1ede5e['attributes'][_0x6b81('0x33')]?_0x1ede5e[_0x6b81('0x31')]:_0x2c0fbe['model'];if(!_0x2c6610[_0x6b81('0x2e')]['hasOwnProperty'](_0x6b81('0x34'))){_0x1ede5e[_0x6b81('0x1f')]=qs[_0x6b81('0x1f')](_0x2c6610['query']['limit']);_0x1ede5e[_0x6b81('0x1d')]=qs[_0x6b81('0x1d')](_0x2c6610[_0x6b81('0x2e')][_0x6b81('0x1d')]);}_0x1ede5e[_0x6b81('0x35')]=qs[_0x6b81('0x36')](_0x2c6610['query'][_0x6b81('0x36')]);_0x1ede5e[_0x6b81('0x37')]=qs[_0x6b81('0x2f')](_[_0x6b81('0x38')](_0x2c6610[_0x6b81('0x2e')],_0x2c0fbe[_0x6b81('0x2f')]),_0x4e121e);if(_0x2c6610['query'][_0x6b81('0x39')]){_0x1ede5e[_0x6b81('0x37')]=_[_0x6b81('0x3a')](_0x1ede5e[_0x6b81('0x37')],{'$or':_[_0x6b81('0x3b')](_0x4e121e,function(_0x49bf91){if(_0x49bf91['type']!==_0x6b81('0x3c')){var _0x3976c1={};_0x3976c1[_0x49bf91[_0x6b81('0x26')]]={'$like':'%'+_0x2c6610[_0x6b81('0x2e')][_0x6b81('0x39')]+'%'};return _0x3976c1;}})});}_0x1ede5e=_['merge']({},_0x1ede5e,_0x2c6610[_0x6b81('0x3d')]);var _0x228e5a={'where':_0x1ede5e[_0x6b81('0x37')]};return db[_0x6b81('0x3e')][_0x6b81('0x20')](_0x228e5a)[_0x6b81('0x13')](function(_0x24db76){_0x5b22c2[_0x6b81('0x20')]=_0x24db76;if(_0x2c6610['query'][_0x6b81('0x3f')]){_0x1ede5e[_0x6b81('0x40')]=[{'all':!![]}];}return db[_0x6b81('0x3e')][_0x6b81('0x41')](_0x1ede5e);})[_0x6b81('0x13')](function(_0x307bff){_0x5b22c2[_0x6b81('0x42')]=_0x307bff;return _0x5b22c2;})[_0x6b81('0x13')](respondWithFilteredResult(_0x10f45e,_0x1ede5e))['catch'](handleError(_0x10f45e,null));};exports[_0x6b81('0x43')]=function(_0xf8712b,_0x5360b8){var _0x68c8bc={'raw':!![],'where':{'id':_0xf8712b[_0x6b81('0x44')]['id']}},_0x3cd5c6={};_0x3cd5c6['model']=_[_0x6b81('0x45')](db['MailMessage'][_0x6b81('0x29')]);_0x3cd5c6[_0x6b81('0x2e')]=_['keys'](_0xf8712b[_0x6b81('0x2e')]);_0x3cd5c6['filters']=_[_0x6b81('0x30')](_0x3cd5c6[_0x6b81('0x2d')],_0x3cd5c6[_0x6b81('0x2e')]);_0x68c8bc[_0x6b81('0x31')]=_[_0x6b81('0x30')](_0x3cd5c6[_0x6b81('0x2d')],qs[_0x6b81('0x32')](_0xf8712b['query'][_0x6b81('0x32')]));_0x68c8bc[_0x6b81('0x31')]=_0x68c8bc[_0x6b81('0x31')][_0x6b81('0x33')]?_0x68c8bc[_0x6b81('0x31')]:_0x3cd5c6[_0x6b81('0x2d')];if(_0xf8712b['query'][_0x6b81('0x3f')]){_0x68c8bc[_0x6b81('0x40')]=[{'all':!![]}];}_0x68c8bc=_[_0x6b81('0x3a')]({},_0x68c8bc,_0xf8712b['options']);return db[_0x6b81('0x3e')][_0x6b81('0x46')](_0x68c8bc)['then'](handleEntityNotFound(_0x5360b8,null))['then'](respondWithResult(_0x5360b8,null))['catch'](handleError(_0x5360b8,null));};exports[_0x6b81('0x47')]=function(_0x4a95ad,_0x3f78ce){if(_0x4a95ad['body']['id']){delete _0x4a95ad[_0x6b81('0x48')]['id'];}return db[_0x6b81('0x3e')][_0x6b81('0x46')]({'where':{'id':_0x4a95ad[_0x6b81('0x44')]['id']}})[_0x6b81('0x13')](handleEntityNotFound(_0x3f78ce,null))[_0x6b81('0x13')](saveUpdates(_0x4a95ad['body'],null))[_0x6b81('0x13')](respondWithResult(_0x3f78ce,null))[_0x6b81('0x1c')](handleError(_0x3f78ce,null));};exports[_0x6b81('0x23')]=function(_0x30429d,_0x2f4496){return db[_0x6b81('0x3e')][_0x6b81('0x46')]({'where':{'id':_0x30429d[_0x6b81('0x44')]['id']}})[_0x6b81('0x13')](handleEntityNotFound(_0x2f4496,null))[_0x6b81('0x13')](removeEntity(_0x2f4496,null))[_0x6b81('0x1c')](handleError(_0x2f4496,null));};exports[_0x6b81('0x49')]=function(_0x1d3952,_0x5bd7c7){return db['MailMessage'][_0x6b81('0x49')]()['then'](respondWithResult(_0x5bd7c7,null))[_0x6b81('0x1c')](handleError(_0x5bd7c7,null));};exports['create']=function(_0x19adfc,_0x1590df){return db[_0x6b81('0x3e')]['create'](_0x19adfc[_0x6b81('0x48')])['then'](function(_0x479e0a){if(_0x479e0a){if(_0x479e0a['direction']===_0x6b81('0x4a')&&!_0x479e0a[_0x6b81('0x4b')]){var _0x4efd19,_0x118e80,_0x3ab98c;if(_0x19adfc[_0x6b81('0x48')]['to']){_0x118e80=_0x19adfc[_0x6b81('0x48')]['to'][_0x6b81('0x4c')](',')[0x0];}return db[_0x6b81('0x4d')][_0x6b81('0x4e')]({'where':{'id':_0x479e0a[_0x6b81('0x4f')]},'include':[{'model':db[_0x6b81('0x50')],'as':_0x6b81('0x51'),'include':[{'model':db[_0x6b81('0x52')],'as':_0x6b81('0x53'),'where':{'email':_0x118e80},'limit':0x1,'order':[[_0x6b81('0x54'),_0x6b81('0x55')]]}]},{'model':db[_0x6b81('0x56')],'as':_0x6b81('0x57'),'raw':!![]}]})[_0x6b81('0x13')](function(_0xfee51d){_0x4efd19=_0xfee51d;if(_0x4efd19&&_0x4efd19[_0x6b81('0x57')]){var _0x3183fe={'tls':{'rejectUnauthorized':![]}};if(_[_0x6b81('0x58')](_0x4efd19['Smtp'][_0x6b81('0x59')])){_0x3183fe[_0x6b81('0x5a')]=_0x4efd19[_0x6b81('0x57')]['host'];_0x3183fe[_0x6b81('0x5b')]=_0x4efd19[_0x6b81('0x57')]['port'];_0x3183fe[_0x6b81('0x5c')]=_0x4efd19[_0x6b81('0x57')]['secure'];if(_0x4efd19['Smtp'][_0x6b81('0x5d')]){_0x3183fe[_0x6b81('0x5e')]={'user':_0x4efd19[_0x6b81('0x57')][_0x6b81('0x5f')],'pass':_0x4efd19['Smtp'][_0x6b81('0x60')]};}}else{_0x3183fe['service']=_0x4efd19[_0x6b81('0x57')]['service'];_0x3183fe[_0x6b81('0x5e')]={'user':_0x4efd19[_0x6b81('0x57')]['user'],'pass':_0x4efd19[_0x6b81('0x57')][_0x6b81('0x60')]};_0x3183fe[_0x6b81('0x5c')]=_0x4efd19[_0x6b81('0x57')][_0x6b81('0x5c')];}if(_0x19adfc[_0x6b81('0x48')][_0x6b81('0x61')]&&_0x19adfc[_0x6b81('0x48')][_0x6b81('0x61')]['length']){for(var _0x363f64=0x0;_0x363f64<_0x19adfc[_0x6b81('0x48')][_0x6b81('0x61')][_0x6b81('0x33')];_0x363f64+=0x1){_0x19adfc[_0x6b81('0x48')][_0x6b81('0x61')][_0x363f64]={'filename':_0x19adfc[_0x6b81('0x48')][_0x6b81('0x61')][_0x363f64][_0x6b81('0x26')],'path':path['join'](config[_0x6b81('0x62')],_0x6b81('0x63'),_0x19adfc[_0x6b81('0x48')][_0x6b81('0x61')][_0x363f64][_0x6b81('0x64')])};}}_0x3ab98c={'account':_0x3183fe,'message':_0x19adfc[_0x6b81('0x48')]};return;}})[_0x6b81('0x13')](function(){if(_0x4efd19[_0x6b81('0x51')]){if(_0x4efd19[_0x6b81('0x51')][_0x6b81('0x53')][_0x6b81('0x33')]){return _0x4efd19[_0x6b81('0x51')][_0x6b81('0x53')][0x0];}else{return db[_0x6b81('0x52')][_0x6b81('0x65')](_['defaults'](_0x19adfc[_0x6b81('0x48')],{'firstName':_0x19adfc[_0x6b81('0x48')]['to'],'email':_0x19adfc[_0x6b81('0x48')]['to'],'phone':_0x19adfc[_0x6b81('0x48')]['to'],'ListId':_0x4efd19[_0x6b81('0x66')]}));}}else{throw new Error(_0x6b81('0x67'));}})[_0x6b81('0x13')](function(){if(_0x3ab98c){return respondWithRpcPromise(_0x6b81('0x68'),_0x6b81('0x69'),_0x3ab98c,client9003)[_0x6b81('0x13')](function(_0x5e8063){return _0x479e0a[_0x6b81('0x47')]({'read':!![],'messageId':_0x5e8063['messageId'],'sentAt':moment()[_0x6b81('0x6a')](_0x6b81('0x6b'))});})['catch'](function(_0x533347){logger[_0x6b81('0x19')]('%s',JSON[_0x6b81('0x18')](_0x533347));return _0x479e0a;});}return _0x479e0a;});}return _0x479e0a;}})[_0x6b81('0x13')](respondWithResult(_0x1590df,0xc9))[_0x6b81('0x1c')](handleError(_0x1590df,null));};exports[_0x6b81('0x6c')]=function(_0x1c1769,_0xc4a059){var _0x3dd48d={'agent':{},'channel':_0x6b81('0x6d')};if(_0x1c1769[_0x6b81('0x48')]['id']){delete _0x1c1769['body']['id'];}_0x1c1769[_0x6b81('0x48')][_0x6b81('0x6e')]=!![];_0x1c1769[_0x6b81('0x48')][_0x6b81('0x6f')]=moment()['format'](_0x6b81('0x6b'));_0x1c1769[_0x6b81('0x48')]['UserId']=_0x1c1769['body'][_0x6b81('0x70')]||_0x1c1769[_0x6b81('0x5f')]['id'];_0x3dd48d[_0x6b81('0x71')]['id']=_0x1c1769[_0x6b81('0x48')]['UserId'];return db[_0x6b81('0x3e')]['find']({'where':{'id':_0x1c1769['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc4a059,null))[_0x6b81('0x13')](saveUpdates(_0x1c1769['body'],null))['then'](function(_0x2c08f7){if(_0x2c08f7){_0x3dd48d[_0x6b81('0x1b')]=_0x2c08f7[_0x6b81('0x72')]({'plain':!![]});return db[_0x6b81('0x73')][_0x6b81('0x46')]({'where':{'id':_0x2c08f7[_0x6b81('0x74')]}});}return null;})[_0x6b81('0x13')](handleEntityNotFound(_0xc4a059,null))[_0x6b81('0x13')](function(_0x2f4b64){if(_0x2f4b64){return _0x2f4b64[_0x6b81('0x47')]({'UserId':_0x1c1769[_0x6b81('0x48')][_0x6b81('0x70')],'read1stAt':_['isNil'](_0x2f4b64[_0x6b81('0x75')])?moment()[_0x6b81('0x6a')](_0x6b81('0x6b')):undefined});}return null;})['then'](function(_0x3cbeed){if(_0x3cbeed){_0x3dd48d['interaction']=_0x3cbeed[_0x6b81('0x72')]({'plain':!![]});interaction_log[_0x6b81('0x14')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c1769[_0x6b81('0x5f')]['id'],_0x1c1769[_0x6b81('0x5f')]['name'],_0x1c1769['user'][_0x6b81('0x76')],_0x3dd48d['interaction']['id'],_0x1c1769[_0x6b81('0x48')]?JSON[_0x6b81('0x18')](_0x1c1769[_0x6b81('0x48')]):'null');return respondWithRpcPromise(_0x6b81('0x77'),_0x6b81('0x78'),_0x3dd48d);}return null;})['then'](function(_0x226e1c){var _0x45fbb4=_0x6b81('0x79')+_0x226e1c[_0x6b81('0x1b')][_0x6b81('0x7a')];return db[_0x6b81('0x7b')][_0x6b81('0x2e')](_0x45fbb4,{'type':db[_0x6b81('0x7c')][_0x6b81('0x7d')][_0x6b81('0x7e')],'raw':!![]})[_0x6b81('0x13')](function(_0x942867){return _0x942867;});})[_0x6b81('0x13')](function(_0xb62fc8){if(_0xb62fc8){_0x3dd48d[_0x6b81('0x1b')]['contact']=_0xb62fc8[0x0];if(!_0x1c1769['body']['UserId'])return;return db[_0x6b81('0x7f')][_0x6b81('0x46')]({'where':{'id':_0x1c1769[_0x6b81('0x48')][_0x6b81('0x70')],'role':_0x6b81('0x71')},'attributes':['id','name',_0x6b81('0x80'),_0x6b81('0x81'),_0x6b81('0x82')],'raw':!![]});}return null;})[_0x6b81('0x13')](function(_0x2e603a){if(!_0x2e603a)return null;_0x3dd48d['message'][_0x6b81('0x71')]=_0x2e603a;return _0x3dd48d;})['then'](function(_0x4dc7ed){if(_0x4dc7ed){if(_0x1c1769[_0x6b81('0x48')][_0x6b81('0x83')]){_0x3dd48d[_0x6b81('0x1b')][_0x6b81('0x84')]=util[_0x6b81('0x6a')](_0x6b81('0x85'),_0x1c1769[_0x6b81('0x5f')][_0x6b81('0x26')]);_0x3dd48d['message'][_0x6b81('0x86')]=_0x3dd48d['channel'];_0x3dd48d[_0x6b81('0x1b')]['motionChannel']=_0x3dd48d[_0x6b81('0x86')];_0x3dd48d[_0x6b81('0x1b')][_0x6b81('0x87')]='accept';_0x3dd48d[_0x6b81('0x1b')]['body']=htmlToText[_0x6b81('0x88')](_0x3dd48d['message'][_0x6b81('0x48')]);return respondWithRpcPromise('EventManager',_0x6b81('0x89'),{'event':_0x6b81('0x8a'),'message':_0x3dd48d[_0x6b81('0x1b')]},client9002)[_0x6b81('0x13')](function(){return _0x3dd48d;});}return _0x3dd48d;}return null;})['then'](respondWithResult(_0xc4a059,null))[_0x6b81('0x1c')](handleError(_0xc4a059,null));};exports[_0x6b81('0x8b')]=function(_0x63ec32,_0x4bfb77){var _0x10c9a7={'agent':{},'channel':_0x6b81('0x6d')};if(_0x63ec32[_0x6b81('0x48')]['id']){delete _0x63ec32['body']['id'];}_0x63ec32[_0x6b81('0x48')][_0x6b81('0x70')]=_0x63ec32[_0x6b81('0x48')][_0x6b81('0x70')]||_0x63ec32[_0x6b81('0x5f')]['id'];_0x10c9a7[_0x6b81('0x71')]['id']=_0x63ec32[_0x6b81('0x48')][_0x6b81('0x70')];return db[_0x6b81('0x3e')]['find']({'where':{'id':_0x63ec32[_0x6b81('0x44')]['id'],'UserId':null}})[_0x6b81('0x13')](handleEntityNotFound(_0x4bfb77,null))[_0x6b81('0x13')](function(_0x44c71b){if(_0x44c71b){_0x10c9a7[_0x6b81('0x1b')]=_0x44c71b[_0x6b81('0x72')]({'plain':!![]});return db[_0x6b81('0x73')][_0x6b81('0x46')]({'where':{'id':_0x44c71b['MailInteractionId']}});}return null;})[_0x6b81('0x13')](handleEntityNotFound(_0x4bfb77,null))['then'](function(_0x333283){if(_0x333283){_0x10c9a7[_0x6b81('0x8c')]=_0x333283[_0x6b81('0x72')]({'plain':!![]});interaction_log[_0x6b81('0x14')](_0x6b81('0x8d'),_0x63ec32[_0x6b81('0x5f')]['id'],_0x63ec32[_0x6b81('0x5f')][_0x6b81('0x26')],_0x63ec32['user']['role'],_0x10c9a7[_0x6b81('0x8c')]['id'],_0x63ec32[_0x6b81('0x48')]?JSON[_0x6b81('0x18')](_0x63ec32[_0x6b81('0x48')]):_0x6b81('0x8e'));return respondWithRpcPromise('RejectMessage',_0x6b81('0x8f'),_0x10c9a7);}return null;})[_0x6b81('0x13')](function(_0x244b18){var _0x185fa2=_0x6b81('0x79')+_0x244b18[_0x6b81('0x1b')][_0x6b81('0x7a')];return db[_0x6b81('0x7b')][_0x6b81('0x2e')](_0x185fa2,{'type':db[_0x6b81('0x7c')][_0x6b81('0x7d')][_0x6b81('0x7e')],'raw':!![]})['then'](function(_0x4cd0fa){return _0x4cd0fa;});})[_0x6b81('0x13')](function(_0x5bd179){if(_0x5bd179){_0x10c9a7['message'][_0x6b81('0x90')]=_0x5bd179[0x0];if(!_0x63ec32['body'][_0x6b81('0x70')])return;return db[_0x6b81('0x7f')][_0x6b81('0x46')]({'where':{'id':_0x63ec32[_0x6b81('0x48')][_0x6b81('0x70')],'role':_0x6b81('0x71')},'attributes':['id','name',_0x6b81('0x80'),_0x6b81('0x81'),_0x6b81('0x82')],'raw':!![]});}return null;})[_0x6b81('0x13')](function(_0x45a920){if(!_0x45a920)return null;_0x10c9a7[_0x6b81('0x1b')]['agent']=_0x45a920;return _0x10c9a7;})[_0x6b81('0x13')](function(_0x384209){if(_0x384209){_0x384209[_0x6b81('0x1b')][_0x6b81('0x84')]=util['format']('SIP/%s',_0x63ec32[_0x6b81('0x5f')][_0x6b81('0x26')]);_0x384209['message']['channel']=_0x10c9a7['channel'];_0x384209[_0x6b81('0x1b')]['motionChannel']=_0x10c9a7[_0x6b81('0x86')];_0x384209[_0x6b81('0x1b')][_0x6b81('0x87')]=_0x6b81('0x8b');_0x384209[_0x6b81('0x1b')][_0x6b81('0x48')]=htmlToText[_0x6b81('0x88')](_0x10c9a7[_0x6b81('0x1b')][_0x6b81('0x48')]);respondWithRpcPromise(_0x6b81('0x89'),_0x6b81('0x89'),{'event':'rejectmessage','message':_0x384209['message']},client9002);return _0x10c9a7;}return null;})['then'](respondWithResult(_0x4bfb77,null))[_0x6b81('0x1c')](handleError(_0x4bfb77,null));};exports[_0x6b81('0x91')]=function(_0x21c5f0,_0x4c9b74){var _0x595b96=moment()[_0x6b81('0x92')]()[_0x6b81('0x93')]();var _0x8792c3=path[_0x6b81('0x94')](config[_0x6b81('0x62')],_0x6b81('0x95'),'files',_0x6b81('0x96'));var _0x5a018b=path[_0x6b81('0x94')](config[_0x6b81('0x62')],_0x6b81('0x95'),_0x6b81('0x97'),_0x6b81('0x61'));var _0x161777=util[_0x6b81('0x6a')](_0x6b81('0x98'),_0x595b96);return db[_0x6b81('0x3e')][_0x6b81('0x46')]({'where':{'id':_0x21c5f0[_0x6b81('0x44')]['id']},'attributes':['id',_0x6b81('0x48'),_0x6b81('0x99'),'to','cc',_0x6b81('0x9a'),'subject',_0x6b81('0x9b')],'include':_0x21c5f0[_0x6b81('0x2e')][_0x6b81('0x61')]?[{'model':db['Attachment'],'as':_0x6b81('0x9c')}]:undefined})['then'](handleEntityNotFound(_0x4c9b74,null))['then'](function(_0x584425){if(_0x584425){var _0x2f17b6=_0x584425;var _0x2d1272={'from':_0x2f17b6[_0x6b81('0x99')],'to':_0x2f17b6['to'],'subject':_0x2f17b6[_0x6b81('0x9d')],'html':htmlEntities[_0x6b81('0x9e')](_0x2f17b6[_0x6b81('0x48')]),'headers':{'Date':moment(_0x2f17b6['createdAt'])['format'](_0x6b81('0x9f'))},'attachments':[]};if(_0x584425['cc']){_0x2d1272[_0x6b81('0xa0')]['Cc']=_0x584425['cc'];}if(_0x584425[_0x6b81('0x9a')]){_0x2d1272[_0x6b81('0xa0')]['Bcc']=_0x584425[_0x6b81('0x9a')];}return new BPromise(function(_0x1873c1,_0x5e3141){if(_0x584425[_0x6b81('0x9c')]){for(var _0x563d60=0x0;_0x563d60<_0x584425[_0x6b81('0x9c')][_0x6b81('0x33')];_0x563d60++){var _0x305669=_0x584425[_0x6b81('0x9c')][_0x563d60];var _0x3b60ea=path[_0x6b81('0x94')](_0x5a018b,_0x305669[_0x6b81('0x64')]);if(fs[_0x6b81('0xa1')](_0x3b60ea)){_0x2d1272[_0x6b81('0x61')][_0x6b81('0xa2')]({'name':_0x305669['name'],'contentType':_0x305669['type'],'data':fs[_0x6b81('0xa3')](_0x3b60ea)});}}}emlformat[_0x6b81('0xa4')](_0x2d1272,function(_0x4f5a26,_0xa831f1){if(_0x4f5a26)return _0x5e3141(_0x4f5a26);fs[_0x6b81('0xa5')](path[_0x6b81('0x94')](_0x8792c3,_0x161777),_0xa831f1);return _0x1873c1(_0xa831f1);});});}})[_0x6b81('0x13')](function(_0x33d5f7){if(_0x33d5f7){return _0x4c9b74['download'](path['join'](_0x8792c3,_0x161777),_0x161777,function(_0x553b29){if(!_0x553b29)fs[_0x6b81('0xa6')](path[_0x6b81('0x94')](_0x8792c3,_0x161777));});}})[_0x6b81('0x1c')](handleError(_0x4c9b74,null));}; \ No newline at end of file +var _0xb8f6=['includeAll','include','findAll','rows','catch','show','params','find','body','describe','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','Smtp','isNil','service','host','port','secure','auth','pass','attachments','join','root','server/files/attachments','List','sendMail','format','stringify','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','MailInteractionId','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','mail','RejectMessage','rejectMessage','SIP/%s','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','json','offset','undefined','limit','count','status','Content-Range','update','destroy','stack','name','send','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x1f1158,_0x3ff189){var _0x539a9d=function(_0x54db89){while(--_0x54db89){_0x1f1158['push'](_0x1f1158['shift']());}};_0x539a9d(++_0x3ff189);}(_0xb8f6,0x1a4));var _0x6b8f=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xb8f6[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0x6b8f('0x0'));var moment=require(_0x6b8f('0x1'));var BPromise=require(_0x6b8f('0x2'));var util=require(_0x6b8f('0x3'));var path=require(_0x6b8f('0x4'));var fs=require('fs');var _=require(_0x6b8f('0x5'));var Redis=require(_0x6b8f('0x6'));var htmlToText=require(_0x6b8f('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x6b8f('0x8'))(_0x6b8f('0x9'));var interaction_log=require(_0x6b8f('0x8'))(_0x6b8f('0xa'));var config=require(_0x6b8f('0xb'));var db=require(_0x6b8f('0xc'))['db'];config[_0x6b8f('0xd')]=_[_0x6b8f('0xe')](config[_0x6b8f('0xd')],{'host':_0x6b8f('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0x6b8f('0x10'));require(_0x6b8f('0x11'))[_0x6b8f('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6b8f('0x13')][_0x6b8f('0x14')]({'port':0x232c});var client9003=jayson[_0x6b8f('0x13')][_0x6b8f('0x14')]({'port':0x232b});var client9002=jayson[_0x6b8f('0x13')][_0x6b8f('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x306bc0,_0x328d59,_0x108e08,_0x4c8155){return new BPromise(function(_0x3e770a,_0x563acd){var _0x3fedad=_0x4c8155||client;return _0x3fedad['request'](_0x306bc0,_0x108e08)[_0x6b8f('0x15')](function(_0x3e6778){logger[_0x6b8f('0x16')](_0x6b8f('0x17'),_0x328d59,_0x6b8f('0x18'));logger['debug'](_0x6b8f('0x19'),_0x328d59,_0x6b8f('0x18'),JSON['stringify'](_0x3e6778));if(_0x3e6778[_0x6b8f('0x1a')]){if(_0x3e6778[_0x6b8f('0x1a')]['code']===0x1f4){logger[_0x6b8f('0x1a')](_0x6b8f('0x17'),_0x328d59,_0x3e6778['error'][_0x6b8f('0x1b')]);return _0x563acd(_0x3e6778['error'][_0x6b8f('0x1b')]);}logger[_0x6b8f('0x1a')]('MailMessage,\x20%s,\x20%s',_0x328d59,_0x3e6778[_0x6b8f('0x1a')][_0x6b8f('0x1b')]);return _0x3e770a(_0x3e6778[_0x6b8f('0x1a')][_0x6b8f('0x1b')]);}else{logger['info'](_0x6b8f('0x17'),_0x328d59,'request\x20sent');_0x3e770a(_0x3e6778[_0x6b8f('0x1c')][_0x6b8f('0x1b')]);}})['catch'](function(_0x26590d){logger[_0x6b8f('0x1a')](_0x6b8f('0x17'),_0x328d59,_0x26590d);_0x563acd(_0x26590d);});});}function respondWithResult(_0x48f808,_0x5d3035){_0x5d3035=_0x5d3035||0xc8;return function(_0x143b49){if(_0x143b49){return _0x48f808['status'](_0x5d3035)[_0x6b8f('0x1d')](_0x143b49);}};}function respondWithFilteredResult(_0xe1b788,_0x25eac2){return function(_0x20c6c6){if(_0x20c6c6){var _0x337844=typeof _0x25eac2[_0x6b8f('0x1e')]===_0x6b8f('0x1f')&&typeof _0x25eac2[_0x6b8f('0x20')]==='undefined';var _0x183f64=_0x20c6c6[_0x6b8f('0x21')];var _0x159c97=_0x337844?0x0:_0x25eac2['offset'];var _0x4c43f3=_0x337844?_0x20c6c6[_0x6b8f('0x21')]:_0x25eac2[_0x6b8f('0x1e')]+_0x25eac2[_0x6b8f('0x20')];var _0x5ad867;if(_0x4c43f3>=_0x183f64){_0x4c43f3=_0x183f64;_0x5ad867=0xc8;}else{_0x5ad867=0xce;}_0xe1b788[_0x6b8f('0x22')](_0x5ad867);return _0xe1b788['set'](_0x6b8f('0x23'),_0x159c97+'-'+_0x4c43f3+'/'+_0x183f64)[_0x6b8f('0x1d')](_0x20c6c6);}return null;};}function saveUpdates(_0x347ddd){return function(_0x12e343){if(_0x12e343){return _0x12e343[_0x6b8f('0x24')](_0x347ddd)['then'](function(_0x5a9534){return _0x5a9534;});}return null;};}function removeEntity(_0x507807){return function(_0x1ecb53){if(_0x1ecb53){return _0x1ecb53[_0x6b8f('0x25')]()[_0x6b8f('0x15')](function(){_0x507807[_0x6b8f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a9069){return function(_0x1471ef){if(!_0x1471ef){_0x5a9069['sendStatus'](0x194);}return _0x1471ef;};}function handleError(_0x6d9dbd,_0x5b3361){_0x5b3361=_0x5b3361||0x1f4;return function(_0x15f7e8){logger['error'](_0x15f7e8[_0x6b8f('0x26')]);if(_0x15f7e8[_0x6b8f('0x27')]){delete _0x15f7e8[_0x6b8f('0x27')];}_0x6d9dbd['status'](_0x5b3361)[_0x6b8f('0x28')](_0x15f7e8);};}exports['index']=function(_0x82dfad,_0x23fdf3){var _0x323195={},_0x45f7f8={},_0x331e65={'count':0x0,'rows':[]};var _0x2971c8=_[_0x6b8f('0x29')](db[_0x6b8f('0x2a')][_0x6b8f('0x2b')],function(_0x9deed7){return{'name':_0x9deed7['fieldName'],'type':_0x9deed7[_0x6b8f('0x2c')][_0x6b8f('0x2d')]};});_0x45f7f8[_0x6b8f('0x2e')]=_[_0x6b8f('0x29')](_0x2971c8,_0x6b8f('0x27'));_0x45f7f8[_0x6b8f('0x2f')]=_[_0x6b8f('0x30')](_0x82dfad[_0x6b8f('0x2f')]);_0x45f7f8[_0x6b8f('0x31')]=_[_0x6b8f('0x32')](_0x45f7f8[_0x6b8f('0x2e')],_0x45f7f8[_0x6b8f('0x2f')]);_0x323195[_0x6b8f('0x33')]=_[_0x6b8f('0x32')](_0x45f7f8[_0x6b8f('0x2e')],qs[_0x6b8f('0x34')](_0x82dfad[_0x6b8f('0x2f')][_0x6b8f('0x34')]));_0x323195[_0x6b8f('0x33')]=_0x323195['attributes'][_0x6b8f('0x35')]?_0x323195['attributes']:_0x45f7f8[_0x6b8f('0x2e')];if(!_0x82dfad['query'][_0x6b8f('0x36')]('nolimit')){_0x323195[_0x6b8f('0x20')]=qs[_0x6b8f('0x20')](_0x82dfad[_0x6b8f('0x2f')][_0x6b8f('0x20')]);_0x323195[_0x6b8f('0x1e')]=qs[_0x6b8f('0x1e')](_0x82dfad[_0x6b8f('0x2f')]['offset']);}_0x323195[_0x6b8f('0x37')]=qs[_0x6b8f('0x38')](_0x82dfad[_0x6b8f('0x2f')][_0x6b8f('0x38')]);_0x323195[_0x6b8f('0x39')]=qs[_0x6b8f('0x31')](_[_0x6b8f('0x3a')](_0x82dfad[_0x6b8f('0x2f')],_0x45f7f8['filters']),_0x2971c8);if(_0x82dfad[_0x6b8f('0x2f')][_0x6b8f('0x3b')]){_0x323195['where']=_[_0x6b8f('0x3c')](_0x323195[_0x6b8f('0x39')],{'$or':_[_0x6b8f('0x29')](_0x2971c8,function(_0x5b51d5){if(_0x5b51d5['type']!==_0x6b8f('0x3d')){var _0x1f6d59={};_0x1f6d59[_0x5b51d5[_0x6b8f('0x27')]]={'$like':'%'+_0x82dfad[_0x6b8f('0x2f')][_0x6b8f('0x3b')]+'%'};return _0x1f6d59;}})});}_0x323195=_[_0x6b8f('0x3c')]({},_0x323195,_0x82dfad[_0x6b8f('0x3e')]);var _0x558295={'where':_0x323195[_0x6b8f('0x39')]};return db[_0x6b8f('0x2a')][_0x6b8f('0x21')](_0x558295)['then'](function(_0x12d307){_0x331e65[_0x6b8f('0x21')]=_0x12d307;if(_0x82dfad['query'][_0x6b8f('0x3f')]){_0x323195[_0x6b8f('0x40')]=[{'all':!![]}];}return db[_0x6b8f('0x2a')][_0x6b8f('0x41')](_0x323195);})[_0x6b8f('0x15')](function(_0x23468c){_0x331e65[_0x6b8f('0x42')]=_0x23468c;return _0x331e65;})[_0x6b8f('0x15')](respondWithFilteredResult(_0x23fdf3,_0x323195))[_0x6b8f('0x43')](handleError(_0x23fdf3,null));};exports[_0x6b8f('0x44')]=function(_0x48c5b3,_0x134e7f){var _0xe6004={'raw':!![],'where':{'id':_0x48c5b3[_0x6b8f('0x45')]['id']}},_0x3f3f08={};_0x3f3f08[_0x6b8f('0x2e')]=_[_0x6b8f('0x30')](db['MailMessage'][_0x6b8f('0x2b')]);_0x3f3f08[_0x6b8f('0x2f')]=_[_0x6b8f('0x30')](_0x48c5b3['query']);_0x3f3f08[_0x6b8f('0x31')]=_[_0x6b8f('0x32')](_0x3f3f08['model'],_0x3f3f08[_0x6b8f('0x2f')]);_0xe6004[_0x6b8f('0x33')]=_['intersection'](_0x3f3f08['model'],qs[_0x6b8f('0x34')](_0x48c5b3[_0x6b8f('0x2f')]['fields']));_0xe6004[_0x6b8f('0x33')]=_0xe6004['attributes']['length']?_0xe6004[_0x6b8f('0x33')]:_0x3f3f08[_0x6b8f('0x2e')];if(_0x48c5b3[_0x6b8f('0x2f')]['includeAll']){_0xe6004[_0x6b8f('0x40')]=[{'all':!![]}];}_0xe6004=_[_0x6b8f('0x3c')]({},_0xe6004,_0x48c5b3[_0x6b8f('0x3e')]);return db['MailMessage'][_0x6b8f('0x46')](_0xe6004)['then'](handleEntityNotFound(_0x134e7f,null))[_0x6b8f('0x15')](respondWithResult(_0x134e7f,null))['catch'](handleError(_0x134e7f,null));};exports[_0x6b8f('0x24')]=function(_0x1b9b2d,_0x5b097c){if(_0x1b9b2d['body']['id']){delete _0x1b9b2d[_0x6b8f('0x47')]['id'];}return db['MailMessage'][_0x6b8f('0x46')]({'where':{'id':_0x1b9b2d['params']['id']}})[_0x6b8f('0x15')](handleEntityNotFound(_0x5b097c,null))[_0x6b8f('0x15')](saveUpdates(_0x1b9b2d['body'],null))[_0x6b8f('0x15')](respondWithResult(_0x5b097c,null))['catch'](handleError(_0x5b097c,null));};exports[_0x6b8f('0x25')]=function(_0x54f39e,_0x435810){return db[_0x6b8f('0x2a')]['find']({'where':{'id':_0x54f39e[_0x6b8f('0x45')]['id']}})[_0x6b8f('0x15')](handleEntityNotFound(_0x435810,null))[_0x6b8f('0x15')](removeEntity(_0x435810,null))[_0x6b8f('0x43')](handleError(_0x435810,null));};exports[_0x6b8f('0x48')]=function(_0x552c79,_0x207947){return db[_0x6b8f('0x2a')][_0x6b8f('0x48')]()['then'](respondWithResult(_0x207947,null))[_0x6b8f('0x43')](handleError(_0x207947,null));};exports['create']=function(_0x8cebac,_0x256693){return db[_0x6b8f('0x2a')]['create'](_0x8cebac[_0x6b8f('0x47')])['then'](function(_0x1095cd){if(_0x1095cd){if(_0x1095cd[_0x6b8f('0x49')]===_0x6b8f('0x4a')&&!_0x1095cd[_0x6b8f('0x4b')]){var _0x1ac3bd,_0x371931,_0xd37331;if(_0x8cebac['body']['to']){_0x371931=_0x8cebac[_0x6b8f('0x47')]['to']['split'](',')[0x0];}return db[_0x6b8f('0x4c')][_0x6b8f('0x4d')]({'where':{'id':_0x1095cd[_0x6b8f('0x4e')]},'include':[{'model':db[_0x6b8f('0x4f')],'as':'List','include':[{'model':db[_0x6b8f('0x50')],'as':_0x6b8f('0x51'),'where':{'email':_0x371931},'limit':0x1,'order':[[_0x6b8f('0x52'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x6b8f('0x53'),'raw':!![]}]})[_0x6b8f('0x15')](function(_0x3d9d7f){_0x1ac3bd=_0x3d9d7f;if(_0x1ac3bd&&_0x1ac3bd[_0x6b8f('0x53')]){var _0x2e9e79={'tls':{'rejectUnauthorized':![]}};if(_[_0x6b8f('0x54')](_0x1ac3bd[_0x6b8f('0x53')][_0x6b8f('0x55')])){_0x2e9e79[_0x6b8f('0x56')]=_0x1ac3bd[_0x6b8f('0x53')][_0x6b8f('0x56')];_0x2e9e79[_0x6b8f('0x57')]=_0x1ac3bd[_0x6b8f('0x53')][_0x6b8f('0x57')];_0x2e9e79['secure']=_0x1ac3bd[_0x6b8f('0x53')][_0x6b8f('0x58')];if(_0x1ac3bd[_0x6b8f('0x53')]['authentication']){_0x2e9e79[_0x6b8f('0x59')]={'user':_0x1ac3bd['Smtp']['user'],'pass':_0x1ac3bd['Smtp']['pass']};}}else{_0x2e9e79['service']=_0x1ac3bd[_0x6b8f('0x53')][_0x6b8f('0x55')];_0x2e9e79['auth']={'user':_0x1ac3bd[_0x6b8f('0x53')]['user'],'pass':_0x1ac3bd[_0x6b8f('0x53')][_0x6b8f('0x5a')]};_0x2e9e79[_0x6b8f('0x58')]=_0x1ac3bd[_0x6b8f('0x53')][_0x6b8f('0x58')];}if(_0x8cebac['body'][_0x6b8f('0x5b')]&&_0x8cebac['body'][_0x6b8f('0x5b')][_0x6b8f('0x35')]){for(var _0x493904=0x0;_0x493904<_0x8cebac[_0x6b8f('0x47')][_0x6b8f('0x5b')][_0x6b8f('0x35')];_0x493904+=0x1){_0x8cebac[_0x6b8f('0x47')][_0x6b8f('0x5b')][_0x493904]={'filename':_0x8cebac['body']['attachments'][_0x493904]['name'],'path':path[_0x6b8f('0x5c')](config[_0x6b8f('0x5d')],_0x6b8f('0x5e'),_0x8cebac[_0x6b8f('0x47')][_0x6b8f('0x5b')][_0x493904]['basename'])};}}_0xd37331={'account':_0x2e9e79,'message':_0x8cebac[_0x6b8f('0x47')]};return;}})[_0x6b8f('0x15')](function(){if(_0x1ac3bd['List']){if(_0x1ac3bd['List'][_0x6b8f('0x51')][_0x6b8f('0x35')]){return _0x1ac3bd[_0x6b8f('0x5f')][_0x6b8f('0x51')][0x0];}else{return db[_0x6b8f('0x50')]['create'](_['defaults'](_0x8cebac[_0x6b8f('0x47')],{'firstName':_0x8cebac['body']['to'],'email':_0x8cebac[_0x6b8f('0x47')]['to'],'phone':_0x8cebac[_0x6b8f('0x47')]['to'],'ListId':_0x1ac3bd['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x6b8f('0x15')](function(){if(_0xd37331){return respondWithRpcPromise('SendMail',_0x6b8f('0x60'),_0xd37331,client9003)[_0x6b8f('0x15')](function(_0x240cc8){return _0x1095cd['update']({'read':!![],'messageId':_0x240cc8['messageId'],'sentAt':moment()[_0x6b8f('0x61')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x6b8f('0x43')](function(_0x314022){logger[_0x6b8f('0x1a')]('%s',JSON[_0x6b8f('0x62')](_0x314022));return _0x1095cd;});}return _0x1095cd;});}return _0x1095cd;}})[_0x6b8f('0x15')](respondWithResult(_0x256693,0xc9))[_0x6b8f('0x43')](handleError(_0x256693,null));};exports[_0x6b8f('0x63')]=function(_0x2965a7,_0x1f9fcb){var _0x4e3f31={'agent':{},'channel':'mail'};if(_0x2965a7[_0x6b8f('0x47')]['id']){delete _0x2965a7[_0x6b8f('0x47')]['id'];}_0x2965a7[_0x6b8f('0x47')][_0x6b8f('0x64')]=!![];_0x2965a7[_0x6b8f('0x47')][_0x6b8f('0x65')]=moment()[_0x6b8f('0x61')](_0x6b8f('0x66'));_0x2965a7[_0x6b8f('0x47')][_0x6b8f('0x67')]=_0x2965a7[_0x6b8f('0x47')][_0x6b8f('0x67')]||_0x2965a7['user']['id'];_0x4e3f31[_0x6b8f('0x68')]['id']=_0x2965a7[_0x6b8f('0x47')]['UserId'];return db[_0x6b8f('0x2a')][_0x6b8f('0x46')]({'where':{'id':_0x2965a7[_0x6b8f('0x45')]['id'],'UserId':null}})[_0x6b8f('0x15')](handleEntityNotFound(_0x1f9fcb,null))[_0x6b8f('0x15')](saveUpdates(_0x2965a7[_0x6b8f('0x47')],null))['then'](function(_0x5e49d8){if(_0x5e49d8){_0x4e3f31[_0x6b8f('0x1b')]=_0x5e49d8[_0x6b8f('0x69')]({'plain':!![]});return db[_0x6b8f('0x6a')][_0x6b8f('0x46')]({'where':{'id':_0x5e49d8[_0x6b8f('0x6b')]}});}return null;})[_0x6b8f('0x15')](handleEntityNotFound(_0x1f9fcb,null))['then'](function(_0x5db1c9){if(_0x5db1c9){return _0x5db1c9[_0x6b8f('0x24')]({'UserId':_0x2965a7['body']['UserId'],'read1stAt':_[_0x6b8f('0x54')](_0x5db1c9['read1stAt'])?moment()[_0x6b8f('0x61')](_0x6b8f('0x66')):undefined});}return null;})['then'](function(_0xcf5262){if(_0xcf5262){_0x4e3f31['interaction']=_0xcf5262[_0x6b8f('0x69')]({'plain':!![]});interaction_log[_0x6b8f('0x16')](_0x6b8f('0x6c'),_0x2965a7[_0x6b8f('0x6d')]['id'],_0x2965a7[_0x6b8f('0x6d')][_0x6b8f('0x27')],_0x2965a7[_0x6b8f('0x6d')][_0x6b8f('0x6e')],_0x4e3f31[_0x6b8f('0x6f')]['id'],_0x2965a7[_0x6b8f('0x47')]?JSON['stringify'](_0x2965a7[_0x6b8f('0x47')]):_0x6b8f('0x70'));return respondWithRpcPromise(_0x6b8f('0x71'),_0x6b8f('0x72'),_0x4e3f31);}return null;})[_0x6b8f('0x15')](function(_0x349595){var _0x26d13e=_0x6b8f('0x73')+_0x349595[_0x6b8f('0x1b')][_0x6b8f('0x74')];return db[_0x6b8f('0x75')]['query'](_0x26d13e,{'type':db[_0x6b8f('0x76')][_0x6b8f('0x77')][_0x6b8f('0x78')],'raw':!![]})[_0x6b8f('0x15')](function(_0x39037d){return _0x39037d;});})[_0x6b8f('0x15')](function(_0x5da958){if(_0x5da958){_0x4e3f31[_0x6b8f('0x1b')][_0x6b8f('0x79')]=_0x5da958[0x0];if(!_0x2965a7[_0x6b8f('0x47')]['UserId'])return;return db[_0x6b8f('0x7a')]['find']({'where':{'id':_0x2965a7[_0x6b8f('0x47')][_0x6b8f('0x67')],'role':'agent'},'attributes':['id',_0x6b8f('0x27'),_0x6b8f('0x7b'),_0x6b8f('0x7c'),_0x6b8f('0x7d')],'raw':!![]});}return null;})[_0x6b8f('0x15')](function(_0x204b3e){if(!_0x204b3e)return null;_0x4e3f31[_0x6b8f('0x1b')]['agent']=_0x204b3e;return _0x4e3f31;})[_0x6b8f('0x15')](function(_0x148331){if(_0x148331){if(_0x2965a7[_0x6b8f('0x47')][_0x6b8f('0x7e')]){_0x4e3f31[_0x6b8f('0x1b')][_0x6b8f('0x7f')]=util[_0x6b8f('0x61')]('SIP/%s',_0x2965a7[_0x6b8f('0x6d')]['name']);_0x4e3f31[_0x6b8f('0x1b')][_0x6b8f('0x80')]=_0x4e3f31['channel'];_0x4e3f31[_0x6b8f('0x1b')][_0x6b8f('0x81')]=_0x4e3f31['channel'];_0x4e3f31[_0x6b8f('0x1b')][_0x6b8f('0x82')]=_0x6b8f('0x63');_0x4e3f31[_0x6b8f('0x1b')][_0x6b8f('0x47')]=htmlToText['fromString'](_0x4e3f31['message']['body']);return respondWithRpcPromise(_0x6b8f('0x83'),_0x6b8f('0x83'),{'event':_0x6b8f('0x84'),'message':_0x4e3f31['message']},client9002)[_0x6b8f('0x15')](function(){return _0x4e3f31;});}return _0x4e3f31;}return null;})[_0x6b8f('0x15')](respondWithResult(_0x1f9fcb,null))[_0x6b8f('0x43')](handleError(_0x1f9fcb,null));};exports[_0x6b8f('0x85')]=function(_0x270281,_0x1a6680){var _0xcde309={'agent':{},'channel':_0x6b8f('0x86')};if(_0x270281['body']['id']){delete _0x270281[_0x6b8f('0x47')]['id'];}_0x270281['body']['UserId']=_0x270281[_0x6b8f('0x47')][_0x6b8f('0x67')]||_0x270281[_0x6b8f('0x6d')]['id'];_0xcde309['agent']['id']=_0x270281[_0x6b8f('0x47')][_0x6b8f('0x67')];return db[_0x6b8f('0x2a')][_0x6b8f('0x46')]({'where':{'id':_0x270281[_0x6b8f('0x45')]['id'],'UserId':null}})[_0x6b8f('0x15')](handleEntityNotFound(_0x1a6680,null))['then'](function(_0x3ad213){if(_0x3ad213){_0xcde309['message']=_0x3ad213[_0x6b8f('0x69')]({'plain':!![]});return db[_0x6b8f('0x6a')][_0x6b8f('0x46')]({'where':{'id':_0x3ad213[_0x6b8f('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x1a6680,null))[_0x6b8f('0x15')](function(_0x19c1c8){if(_0x19c1c8){_0xcde309[_0x6b8f('0x6f')]=_0x19c1c8[_0x6b8f('0x69')]({'plain':!![]});interaction_log[_0x6b8f('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x270281[_0x6b8f('0x6d')]['id'],_0x270281[_0x6b8f('0x6d')][_0x6b8f('0x27')],_0x270281['user']['role'],_0xcde309['interaction']['id'],_0x270281[_0x6b8f('0x47')]?JSON[_0x6b8f('0x62')](_0x270281['body']):'null');return respondWithRpcPromise(_0x6b8f('0x87'),_0x6b8f('0x88'),_0xcde309);}return null;})[_0x6b8f('0x15')](function(_0x1ac49e){var _0x1bb817='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ac49e[_0x6b8f('0x1b')][_0x6b8f('0x74')];return db['sequelize'][_0x6b8f('0x2f')](_0x1bb817,{'type':db['Sequelize'][_0x6b8f('0x77')][_0x6b8f('0x78')],'raw':!![]})['then'](function(_0x366760){return _0x366760;});})[_0x6b8f('0x15')](function(_0x38eb83){if(_0x38eb83){_0xcde309[_0x6b8f('0x1b')][_0x6b8f('0x79')]=_0x38eb83[0x0];if(!_0x270281[_0x6b8f('0x47')]['UserId'])return;return db[_0x6b8f('0x7a')][_0x6b8f('0x46')]({'where':{'id':_0x270281[_0x6b8f('0x47')]['UserId'],'role':_0x6b8f('0x68')},'attributes':['id','name',_0x6b8f('0x7b'),_0x6b8f('0x7c'),_0x6b8f('0x7d')],'raw':!![]});}return null;})[_0x6b8f('0x15')](function(_0x2e924b){if(!_0x2e924b)return null;_0xcde309[_0x6b8f('0x1b')][_0x6b8f('0x68')]=_0x2e924b;return _0xcde309;})[_0x6b8f('0x15')](function(_0x53500e){if(_0x53500e){_0x53500e[_0x6b8f('0x1b')][_0x6b8f('0x7f')]=util[_0x6b8f('0x61')](_0x6b8f('0x89'),_0x270281['user'][_0x6b8f('0x27')]);_0x53500e['message'][_0x6b8f('0x80')]=_0xcde309[_0x6b8f('0x80')];_0x53500e[_0x6b8f('0x1b')][_0x6b8f('0x81')]=_0xcde309[_0x6b8f('0x80')];_0x53500e['message']['event']=_0x6b8f('0x85');_0x53500e['message']['body']=htmlToText['fromString'](_0xcde309[_0x6b8f('0x1b')][_0x6b8f('0x47')]);respondWithRpcPromise(_0x6b8f('0x83'),_0x6b8f('0x83'),{'event':_0x6b8f('0x8a'),'message':_0x53500e['message']},client9002);return _0xcde309;}return null;})['then'](respondWithResult(_0x1a6680,null))[_0x6b8f('0x43')](handleError(_0x1a6680,null));};exports[_0x6b8f('0x8b')]=function(_0x2c7914,_0x4973ed){var _0x1eb4aa=moment()[_0x6b8f('0x8c')]()[_0x6b8f('0x8d')]();var _0x43101e=path[_0x6b8f('0x5c')](config['root'],'server',_0x6b8f('0x8e'),_0x6b8f('0x8f'));var _0x210bef=path['join'](config[_0x6b8f('0x5d')],_0x6b8f('0x90'),_0x6b8f('0x8e'),_0x6b8f('0x5b'));var _0x5be776=util[_0x6b8f('0x61')](_0x6b8f('0x91'),_0x1eb4aa);return db[_0x6b8f('0x2a')][_0x6b8f('0x46')]({'where':{'id':_0x2c7914[_0x6b8f('0x45')]['id']},'attributes':['id','body','from','to','cc','bcc',_0x6b8f('0x92'),_0x6b8f('0x93')],'include':_0x2c7914['query'][_0x6b8f('0x5b')]?[{'model':db[_0x6b8f('0x94')],'as':'Attachments'}]:undefined})[_0x6b8f('0x15')](handleEntityNotFound(_0x4973ed,null))[_0x6b8f('0x15')](function(_0xc934be){if(_0xc934be){var _0x29ebf2=_0xc934be;var _0x7050a7={'from':_0x29ebf2[_0x6b8f('0x95')],'to':_0x29ebf2['to'],'subject':_0x29ebf2[_0x6b8f('0x92')],'html':htmlEntities['decode'](_0x29ebf2[_0x6b8f('0x47')]),'headers':{'Date':moment(_0x29ebf2[_0x6b8f('0x93')])[_0x6b8f('0x61')](_0x6b8f('0x96'))},'attachments':[]};if(_0xc934be['cc']){_0x7050a7[_0x6b8f('0x97')]['Cc']=_0xc934be['cc'];}if(_0xc934be[_0x6b8f('0x98')]){_0x7050a7['headers']['Bcc']=_0xc934be[_0x6b8f('0x98')];}return new BPromise(function(_0x1a4eaa,_0x51a237){if(_0xc934be[_0x6b8f('0x99')]){for(var _0x58de80=0x0;_0x58de80<_0xc934be['Attachments'][_0x6b8f('0x35')];_0x58de80++){var _0x5f376c=_0xc934be[_0x6b8f('0x99')][_0x58de80];var _0x5f3c8f=path[_0x6b8f('0x5c')](_0x210bef,_0x5f376c[_0x6b8f('0x9a')]);if(fs[_0x6b8f('0x9b')](_0x5f3c8f)){_0x7050a7[_0x6b8f('0x5b')][_0x6b8f('0x9c')]({'name':_0x5f376c[_0x6b8f('0x27')],'contentType':_0x5f376c[_0x6b8f('0x2c')],'data':fs[_0x6b8f('0x9d')](_0x5f3c8f)});}}}emlformat[_0x6b8f('0x9e')](_0x7050a7,function(_0x261806,_0x957cd0){if(_0x261806)return _0x51a237(_0x261806);fs[_0x6b8f('0x9f')](path['join'](_0x43101e,_0x5be776),_0x957cd0);return _0x1a4eaa(_0x957cd0);});});}})[_0x6b8f('0x15')](function(_0x46d912){if(_0x46d912){return _0x4973ed[_0x6b8f('0x8b')](path[_0x6b8f('0x5c')](_0x43101e,_0x5be776),_0x5be776,function(_0xf721be){if(!_0xf721be)fs[_0x6b8f('0xa0')](path[_0x6b8f('0x5c')](_0x43101e,_0x5be776));});}})[_0x6b8f('0x43')](handleError(_0x4973ed,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index bfb19fd..26c0525 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 _0x56f5=['update','remove','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x4e5d04,_0x20593b){var _0x48d604=function(_0x37a046){while(--_0x37a046){_0x4e5d04['push'](_0x4e5d04['shift']());}};_0x48d604(++_0x20593b);}(_0x56f5,0x6c));var _0x556f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56f5[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x556f('0x0'));var MailMessage=require(_0x556f('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x556f('0x2')](0x0);var events={'afterCreate':_0x556f('0x3'),'afterUpdate':_0x556f('0x4'),'afterDestroy':_0x556f('0x5')};function emitEvent(_0x5a6d0c){return function(_0x379d52,_0x246126,_0x1d69a7){MailMessageEvents[_0x556f('0x6')](_0x5a6d0c+':'+_0x379d52['id'],_0x379d52);MailMessageEvents[_0x556f('0x6')](_0x5a6d0c,_0x379d52);_0x1d69a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x556f('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xb084=['hook','exports','events','MailMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x3c6064,_0x4af185){var _0x3d520b=function(_0x3ed263){while(--_0x3ed263){_0x3c6064['push'](_0x3c6064['shift']());}};_0x3d520b(++_0x4af185);}(_0xb084,0x77));var _0x4b08=function(_0x4dbf42,_0x5f3ae8){_0x4dbf42=_0x4dbf42-0x0;var _0x504827=_0xb084[_0x4dbf42];return _0x504827;};'use strict';var EventEmitter=require(_0x4b08('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x4b08('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b08('0x2'),'afterUpdate':_0x4b08('0x3'),'afterDestroy':_0x4b08('0x4')};function emitEvent(_0x360695){return function(_0x571782,_0x5d287e,_0x5e56c5){MailMessageEvents[_0x4b08('0x5')](_0x360695+':'+_0x571782['id'],_0x571782);MailMessageEvents[_0x4b08('0x5')](_0x360695,_0x571782);_0x5e56c5(null);};}for(var e in events){if(events[_0x4b08('0x6')](e)){var event=events[e];MailMessage[_0x4b08('0x7')](e,emitEvent(event));}}module[_0x4b08('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9766363..2905ef6 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 _0x0b63=['mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','direction','toLowerCase','out','secret','isNil','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x53a72c,_0xc9f802){var _0x56b41b=function(_0x354562){while(--_0x354562){_0x53a72c['push'](_0x53a72c['shift']());}};_0x56b41b(++_0xc9f802);}(_0x0b63,0x142));var _0x30b6=function(_0x5225b8,_0x4d0c86){_0x5225b8=_0x5225b8-0x0;var _0x1f3db1=_0x0b63[_0x5225b8];return _0x1f3db1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x30b6('0x0'));var moment=require(_0x30b6('0x1'));var BPromise=require(_0x30b6('0x2'));var rp=require(_0x30b6('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x30b6('0x4'));var rimraf=require('rimraf');var config=require(_0x30b6('0x5'));var attributes=require('./mailMessage.attributes');module[_0x30b6('0x6')]=function(_0x50fc23,_0xa60975){return _0x50fc23[_0x30b6('0x7')]('MailMessage',attributes,{'tableName':_0x30b6('0x8'),'paranoid':![],'indexes':[{'name':_0x30b6('0x9'),'fields':['messageId']},{'name':_0x30b6('0xa'),'fields':['plainBody',_0x30b6('0xb')],'type':_0x30b6('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x341170,_0x59b174,_0x43cb4c){if(_0x341170[_0x30b6('0xd')]){_0x341170[_0x30b6('0xe')]=htmlToText[_0x30b6('0xf')](_0x341170['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x43cb4c(null,_0x59b174);},'afterCreate':function(_0x70b0b7,_0x48769a,_0x2932c8){var _0x5c19c9=_0x50fc23[_0x30b6('0x10')];var _0x159178=_0x70b0b7['get']({'plain':!![]});if(_0x159178[_0x30b6('0x11')][_0x30b6('0x12')]()==='in'||_0x159178[_0x30b6('0x11')][_0x30b6('0x12')]()===_0x30b6('0x13')&&!_0x159178[_0x30b6('0x14')]&&!_[_0x30b6('0x15')](_0x159178['UserId'])){_0x5c19c9['MailInteraction'][_0x30b6('0x16')]({'where':{'id':_0x159178[_0x30b6('0x17')]}})[_0x30b6('0x18')](function(_0x4db68b){if(_0x4db68b){_0x4db68b['update']({'lastMsgAt':_0x159178[_0x30b6('0x19')],'lastMsgDirection':_0x159178[_0x30b6('0x11')][_0x30b6('0x12')]()});}})[_0x30b6('0x1a')](function(_0x584d92){console[_0x30b6('0x1b')](_0x584d92);});}_0x2932c8();}},'charset':_0x30b6('0x1c'),'collate':_0x30b6('0x1d')});}; \ No newline at end of file +var _0x0458=['models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','path','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x0458,0xb9));var _0x8045=function(_0xd4835c,_0x1438e2){_0xd4835c=_0xd4835c-0x0;var _0x4fe4e9=_0x0458[_0xd4835c];return _0x4fe4e9;};'use strict';var _=require(_0x8045('0x0'));var util=require(_0x8045('0x1'));var logger=require(_0x8045('0x2'))(_0x8045('0x3'));var moment=require(_0x8045('0x4'));var BPromise=require(_0x8045('0x5'));var rp=require('request-promise');var htmlToText=require(_0x8045('0x6'));var fs=require('fs');var path=require(_0x8045('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8045('0x8'));module[_0x8045('0x9')]=function(_0x23412e,_0x1c22c2){return _0x23412e[_0x8045('0xa')]('MailMessage',attributes,{'tableName':_0x8045('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8045('0xc')]},{'name':_0x8045('0xd'),'fields':[_0x8045('0xe'),_0x8045('0xf')],'type':_0x8045('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f1b4a,_0x4e244d,_0x5afb4f){if(_0x2f1b4a[_0x8045('0x11')]){_0x2f1b4a[_0x8045('0xe')]=htmlToText[_0x8045('0x12')](_0x2f1b4a[_0x8045('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5afb4f(null,_0x4e244d);},'afterCreate':function(_0x2020b,_0x4393c6,_0x7c2ac6){var _0x427cf6=_0x23412e[_0x8045('0x13')];var _0x3ba265=_0x2020b[_0x8045('0x14')]({'plain':!![]});if(_0x3ba265[_0x8045('0x15')][_0x8045('0x16')]()==='in'||_0x3ba265[_0x8045('0x15')][_0x8045('0x16')]()==='out'&&!_0x3ba265[_0x8045('0x17')]&&!_[_0x8045('0x18')](_0x3ba265[_0x8045('0x19')])){_0x427cf6[_0x8045('0x1a')]['findOne']({'where':{'id':_0x3ba265[_0x8045('0x1b')]}})[_0x8045('0x1c')](function(_0x1a27fd){if(_0x1a27fd){_0x1a27fd['update']({'lastMsgAt':_0x3ba265[_0x8045('0x1d')],'lastMsgDirection':_0x3ba265['direction'][_0x8045('0x16')]()});}})[_0x8045('0x1e')](function(_0x42dbc0){console[_0x8045('0x1f')](_0x42dbc0);});}_0x7c2ac6();}},'charset':_0x8045('0x20'),'collate':_0x8045('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 475fe7a..f0de385 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 _0xe820=['client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateMailMessage','body','options','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x51d3e6,_0x4378a6){var _0x2ee127=function(_0x2b065c){while(--_0x2b065c){_0x51d3e6['push'](_0x51d3e6['shift']());}};_0x2ee127(++_0x4378a6);}(_0xe820,0xd2));var _0x0e82=function(_0x8f6c3c,_0xe72c90){_0x8f6c3c=_0x8f6c3c-0x0;var _0x2d8237=_0xe820[_0x8f6c3c];return _0x2d8237;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});config[_0x0e82('0x9')]=_[_0x0e82('0xa')](config['redis'],{'host':_0x0e82('0xb'),'port':0x18eb});var socket=require(_0x0e82('0xc'))(new Redis(config[_0x0e82('0x9')]));require(_0x0e82('0xd'))[_0x0e82('0xe')](socket);function respondWithRpcPromise(_0x4b3302,_0x43b550,_0x38b362){return new BPromise(function(_0x2dfacf,_0x10b2e2){return client[_0x0e82('0xf')](_0x4b3302,_0x38b362)[_0x0e82('0x10')](function(_0x270173){logger['info'](_0x0e82('0x11'),_0x43b550,_0x0e82('0x12'));logger[_0x0e82('0x13')](_0x0e82('0x14'),_0x43b550,_0x0e82('0x12'),JSON[_0x0e82('0x15')](_0x270173));if(_0x270173['error']){if(_0x270173[_0x0e82('0x16')]['code']===0x1f4){logger['error'](_0x0e82('0x11'),_0x43b550,_0x270173['error']['message']);return _0x10b2e2(_0x270173['error'][_0x0e82('0x17')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x43b550,_0x270173[_0x0e82('0x16')]['message']);return _0x2dfacf(_0x270173[_0x0e82('0x16')][_0x0e82('0x17')]);}else{logger[_0x0e82('0x18')](_0x0e82('0x11'),_0x43b550,'request\x20sent');_0x2dfacf(_0x270173[_0x0e82('0x19')][_0x0e82('0x17')]);}})[_0x0e82('0x1a')](function(_0xc3d043){logger[_0x0e82('0x16')](_0x0e82('0x11'),_0x43b550,_0xc3d043);_0x10b2e2(_0xc3d043);});});}exports[_0x0e82('0x1b')]=function(_0x3735c0){var _0xc9f7ac=this;return new Promise(function(_0x224455,_0x5903c){return db['MailMessage']['create'](_0x3735c0[_0x0e82('0x1c')],{'raw':_0x3735c0[_0x0e82('0x1d')]?_0x3735c0[_0x0e82('0x1d')][_0x0e82('0x1e')]===undefined?!![]:![]:!![]})[_0x0e82('0x10')](function(_0x1bdad4){logger[_0x0e82('0x18')](_0x0e82('0x1b'),_0x3735c0);logger['debug'](_0x0e82('0x1b'),_0x3735c0,JSON[_0x0e82('0x15')](_0x1bdad4));_0x224455(_0x1bdad4);})[_0x0e82('0x1a')](function(_0x24f883){logger['error'](_0x0e82('0x1b'),_0x24f883[_0x0e82('0x17')],_0x3735c0);_0x5903c(_0xc9f7ac[_0x0e82('0x16')](0x1f4,_0x24f883[_0x0e82('0x17')]));});});}; \ No newline at end of file +var _0x2272=['MailMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateMailMessage'];(function(_0x3b0972,_0x474fbf){var _0x5633de=function(_0x395662){while(--_0x395662){_0x3b0972['push'](_0x3b0972['shift']());}};_0x5633de(++_0x474fbf);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});config[_0x2227('0xb')]=_[_0x2227('0xc')](config[_0x2227('0xb')],{'host':_0x2227('0xd'),'port':0x18eb});var socket=require(_0x2227('0xe'))(new Redis(config[_0x2227('0xb')]));require(_0x2227('0xf'))['register'](socket);function respondWithRpcPromise(_0x799370,_0x5c1cba,_0x2f66ca){return new BPromise(function(_0x2d1c39,_0x164735){return client[_0x2227('0x10')](_0x799370,_0x2f66ca)[_0x2227('0x11')](function(_0x51ed54){logger[_0x2227('0x12')](_0x2227('0x13'),_0x5c1cba,_0x2227('0x14'));logger[_0x2227('0x15')](_0x2227('0x16'),_0x5c1cba,_0x2227('0x14'),JSON['stringify'](_0x51ed54));if(_0x51ed54['error']){if(_0x51ed54['error'][_0x2227('0x17')]===0x1f4){logger['error'](_0x2227('0x13'),_0x5c1cba,_0x51ed54[_0x2227('0x18')]['message']);return _0x164735(_0x51ed54[_0x2227('0x18')][_0x2227('0x19')]);}logger[_0x2227('0x18')](_0x2227('0x13'),_0x5c1cba,_0x51ed54[_0x2227('0x18')][_0x2227('0x19')]);return _0x2d1c39(_0x51ed54['error'][_0x2227('0x19')]);}else{logger[_0x2227('0x12')](_0x2227('0x13'),_0x5c1cba,'request\x20sent');_0x2d1c39(_0x51ed54[_0x2227('0x1a')][_0x2227('0x19')]);}})[_0x2227('0x1b')](function(_0x2482ba){logger[_0x2227('0x18')](_0x2227('0x13'),_0x5c1cba,_0x2482ba);_0x164735(_0x2482ba);});});}exports[_0x2227('0x1c')]=function(_0x4e0bba){var _0x386e6a=this;return new Promise(function(_0x59f988,_0x2b26b7){return db[_0x2227('0x1d')][_0x2227('0x1e')](_0x4e0bba[_0x2227('0x1f')],{'raw':_0x4e0bba[_0x2227('0x20')]?_0x4e0bba[_0x2227('0x20')][_0x2227('0x21')]===undefined?!![]:![]:!![]})[_0x2227('0x11')](function(_0x3299fd){logger[_0x2227('0x12')](_0x2227('0x1c'),_0x4e0bba);logger['debug'](_0x2227('0x1c'),_0x4e0bba,JSON[_0x2227('0x22')](_0x3299fd));_0x59f988(_0x3299fd);})['catch'](function(_0x2cef4b){logger[_0x2227('0x18')]('CreateMailMessage',_0x2cef4b['message'],_0x4e0bba);_0x2b26b7(_0x386e6a[_0x2227('0x18')](0x1f4,_0x2cef4b[_0x2227('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index aca639e..9bb2c3e 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 _0xd33b=['save','update','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x49687d,_0x2b5635){var _0x24167d=function(_0x4d44fa){while(--_0x4d44fa){_0x49687d['push'](_0x49687d['shift']());}};_0x24167d(++_0x2b5635);}(_0xd33b,0x1af));var _0xbd33=function(_0xd2546f,_0x3fb64f){_0xd2546f=_0xd2546f-0x0;var _0xfcf436=_0xd33b[_0xd2546f];return _0xfcf436;};'use strict';var MailMessageEvents=require(_0xbd33('0x0'));var events=[_0xbd33('0x1'),'remove',_0xbd33('0x2')];function createListener(_0x595f3a,_0x51c467){return function(_0x5183f1){_0x51c467[_0xbd33('0x3')](_0x595f3a,_0x5183f1);};}function removeListener(_0x1d5ee6,_0x545c88){return function(){MailMessageEvents[_0xbd33('0x4')](_0x1d5ee6,_0x545c88);};}exports[_0xbd33('0x5')]=function(_0x2c8b0c){for(var _0x2b9c0d=0x0,_0x59d195=events[_0xbd33('0x6')];_0x2b9c0d<_0x59d195;_0x2b9c0d++){var _0x53d1d7=events[_0x2b9c0d];var _0x579ad2=createListener(_0xbd33('0x7')+_0x53d1d7,_0x2c8b0c);MailMessageEvents['on'](_0x53d1d7,_0x579ad2);}}; \ No newline at end of file +var _0x5f90=['remove','emit','removeListener','length','./mailMessage.events'];(function(_0x38e0de,_0x132d49){var _0x1a906a=function(_0x45d5a0){while(--_0x45d5a0){_0x38e0de['push'](_0x38e0de['shift']());}};_0x1a906a(++_0x132d49);}(_0x5f90,0xae));var _0x05f9=function(_0x5561cc,_0x525f10){_0x5561cc=_0x5561cc-0x0;var _0x596c1c=_0x5f90[_0x5561cc];return _0x596c1c;};'use strict';var MailMessageEvents=require(_0x05f9('0x0'));var events=['save',_0x05f9('0x1'),'update'];function createListener(_0x9f82fb,_0x53c7be){return function(_0xabc517){_0x53c7be[_0x05f9('0x2')](_0x9f82fb,_0xabc517);};}function removeListener(_0x1b98b3,_0x424e70){return function(){MailMessageEvents[_0x05f9('0x3')](_0x1b98b3,_0x424e70);};}exports['register']=function(_0x179f3e){for(var _0x707ae3=0x0,_0x3034bd=events[_0x05f9('0x4')];_0x707ae3<_0x3034bd;_0x707ae3++){var _0xdfa627=events[_0x707ae3];var _0x26349d=createListener('mailMessage:'+_0xdfa627,_0x179f3e);MailMessageEvents['on'](_0xdfa627,_0x26349d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 55b0147..d369271 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 _0x9b55=['post','/:id/teams','addTeams','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','/:id/users'];(function(_0x222d16,_0xe451d){var _0x3a4039=function(_0x3da9e1){while(--_0x3da9e1){_0x222d16['push'](_0x222d16['shift']());}};_0x3a4039(++_0xe451d);}(_0x9b55,0x133));var _0x59b5=function(_0x4449db,_0x4d97d1){_0x4449db=_0x4449db-0x0;var _0x19e1f7=_0x9b55[_0x4449db];return _0x19e1f7;};'use strict';var multer=require(_0x59b5('0x0'));var util=require(_0x59b5('0x1'));var path=require(_0x59b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x59b5('0x3'));var router=express['Router']();var fs_extra=require(_0x59b5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x59b5('0x5'));var config=require('../../config/environment');var controller=require(_0x59b5('0x6'));router[_0x59b5('0x7')]('/',auth['isAuthenticated'](),controller[_0x59b5('0x8')]);router[_0x59b5('0x7')](_0x59b5('0x9'),auth[_0x59b5('0xa')](),controller[_0x59b5('0xb')]);router[_0x59b5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x59b5('0xc')]);router[_0x59b5('0x7')](_0x59b5('0xd'),auth[_0x59b5('0xa')](),controller[_0x59b5('0xe')]);router[_0x59b5('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x59b5('0xf')]);router['get'](_0x59b5('0x10'),auth[_0x59b5('0xa')](),controller['getAgents']);router[_0x59b5('0x11')]('/',auth[_0x59b5('0xa')](),controller['create']);router['post'](_0x59b5('0x12'),auth[_0x59b5('0xa')](),controller[_0x59b5('0x13')]);router[_0x59b5('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x59b5('0x14')](_0x59b5('0x15'),auth[_0x59b5('0xa')](),controller[_0x59b5('0x16')]);router[_0x59b5('0x17')](_0x59b5('0x15'),auth[_0x59b5('0xa')](),controller['destroy']);router[_0x59b5('0x17')](_0x59b5('0x12'),auth[_0x59b5('0xa')](),controller[_0x59b5('0x18')]);router['delete'](_0x59b5('0x10'),auth[_0x59b5('0xa')](),controller[_0x59b5('0x19')]);module[_0x59b5('0x1a')]=router; \ No newline at end of file +var _0x3415=['Router','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x13ee83,_0x456ca6){var _0x43c870=function(_0x50d6aa){while(--_0x50d6aa){_0x13ee83['push'](_0x13ee83['shift']());}};_0x43c870(++_0x456ca6);}(_0x3415,0x130));var _0x5341=function(_0x1e7154,_0x3e6c57){_0x1e7154=_0x1e7154-0x0;var _0xe7509=_0x3415[_0x1e7154];return _0xe7509;};'use strict';var multer=require(_0x5341('0x0'));var util=require(_0x5341('0x1'));var path=require('path');var timeout=require(_0x5341('0x2'));var express=require(_0x5341('0x3'));var router=express[_0x5341('0x4')]();var fs_extra=require(_0x5341('0x5'));var auth=require(_0x5341('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5341('0x7'));router[_0x5341('0x8')]('/',auth[_0x5341('0x9')](),controller[_0x5341('0xa')]);router[_0x5341('0x8')](_0x5341('0xb'),auth[_0x5341('0x9')](),controller['describe']);router['get'](_0x5341('0xc'),auth[_0x5341('0x9')](),controller[_0x5341('0xd')]);router[_0x5341('0x8')](_0x5341('0xe'),auth[_0x5341('0x9')](),controller[_0x5341('0xf')]);router['get'](_0x5341('0x10'),auth[_0x5341('0x9')](),controller[_0x5341('0x11')]);router[_0x5341('0x8')](_0x5341('0x12'),auth[_0x5341('0x9')](),controller[_0x5341('0x13')]);router['post']('/',auth[_0x5341('0x9')](),controller['create']);router[_0x5341('0x14')]('/:id/teams',auth[_0x5341('0x9')](),controller[_0x5341('0x15')]);router[_0x5341('0x14')]('/:id/users',auth[_0x5341('0x9')](),controller[_0x5341('0x16')]);router['put'](_0x5341('0xc'),auth[_0x5341('0x9')](),controller[_0x5341('0x17')]);router[_0x5341('0x18')](_0x5341('0xc'),auth[_0x5341('0x9')](),controller[_0x5341('0x19')]);router[_0x5341('0x18')]('/:id/teams',auth[_0x5341('0x9')](),controller['removeTeams']);router[_0x5341('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x5341('0x1a')]);module[_0x5341('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 6c0681c..4cfbeb9 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 _0xeb98=['STRING','name','INTEGER','ENUM','beepall','roundrobin','exports'];(function(_0xad5799,_0x5b123f){var _0x27967c=function(_0x290b6f){while(--_0x290b6f){_0xad5799['push'](_0xad5799['shift']());}};_0x27967c(++_0x5b123f);}(_0xeb98,0x92));var _0x8eb9=function(_0x2705f2,_0xaacd45){_0x2705f2=_0x2705f2-0x0;var _0x189588=_0xeb98[_0x2705f2];return _0x189588;};'use strict';var Sequelize=require('sequelize');module[_0x8eb9('0x0')]={'name':{'type':Sequelize[_0x8eb9('0x1')],'unique':_0x8eb9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8eb9('0x1')]},'timeout':{'type':Sequelize[_0x8eb9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8eb9('0x4')]('rrmemory',_0x8eb9('0x5'),_0x8eb9('0x6'))}}; \ No newline at end of file +var _0x8c23=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0x8c23,0x151));var _0x38c2=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8c23[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x38c2('0x0'));module[_0x38c2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x38c2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x38c2('0x3')]},'timeout':{'type':Sequelize[_0x38c2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x38c2('0x5')]('rrmemory','beepall',_0x38c2('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 8b165ec..66dc920 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 _0x3fa7=['ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','compact','value','isEmpty','forEach','emit','addAgents','omit','spread','removeAgents','userMailQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailQueue.socket','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','body','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','filter','User','UserId','agent','mailPause','updatedAt','format','%s/%s','createdAt','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','userMailQueue:save','removeTeams','select','from','user_has_teams'];(function(_0x11ef17,_0x28e011){var _0x157af9=function(_0x2f9d99){while(--_0x2f9d99){_0x11ef17['push'](_0x11ef17['shift']());}};_0x157af9(++_0x28e011);}(_0x3fa7,0x1b8));var _0x73fa=function(_0x4b8ce2,_0x109dff){_0x4b8ce2=_0x4b8ce2-0x0;var _0xc4e2a6=_0x3fa7[_0x4b8ce2];return _0xc4e2a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x73fa('0x0'));var zipdir=require(_0x73fa('0x1'));var jsonpatch=require(_0x73fa('0x2'));var rp=require('request-promise');var moment=require(_0x73fa('0x3'));var BPromise=require(_0x73fa('0x4'));var Mustache=require(_0x73fa('0x5'));var util=require(_0x73fa('0x6'));var path=require(_0x73fa('0x7'));var sox=require(_0x73fa('0x8'));var csv=require(_0x73fa('0x9'));var ejs=require(_0x73fa('0xa'));var fs=require('fs');var fs_extra=require(_0x73fa('0xb'));var _=require(_0x73fa('0xc'));var squel=require(_0x73fa('0xd'));var crypto=require(_0x73fa('0xe'));var jsforce=require(_0x73fa('0xf'));var deskjs=require(_0x73fa('0x10'));var toCsv=require(_0x73fa('0x9'));var querystring=require(_0x73fa('0x11'));var Papa=require(_0x73fa('0x12'));var Redis=require('ioredis');var authService=require(_0x73fa('0x13'));var qs=require(_0x73fa('0x14'));var as=require(_0x73fa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73fa('0x16'))(_0x73fa('0x17'));var utils=require(_0x73fa('0x18'));var config=require(_0x73fa('0x19'));var licenseUtil=require(_0x73fa('0x1a'));var db=require('../../mysqldb')['db'];config[_0x73fa('0x1b')]=_[_0x73fa('0x1c')](config[_0x73fa('0x1b')],{'host':_0x73fa('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73fa('0x1b')]));require(_0x73fa('0x1e'))['register'](socket);function respondWithStatusCode(_0x5b2c64,_0x850466){_0x850466=_0x850466||0xcc;return function(_0x511356){if(_0x511356){return _0x5b2c64['sendStatus'](_0x850466);}return _0x5b2c64[_0x73fa('0x1f')](_0x850466)[_0x73fa('0x20')]();};}function respondWithResult(_0x4fde8a,_0x3e1e25){_0x3e1e25=_0x3e1e25||0xc8;return function(_0x108af1){if(_0x108af1){return _0x4fde8a[_0x73fa('0x1f')](_0x3e1e25)[_0x73fa('0x21')](_0x108af1);}};}function respondWithFilteredResult(_0x1b58c7,_0x32faad){return function(_0x2f0040){if(_0x2f0040){var _0x250104=typeof _0x32faad['offset']===_0x73fa('0x22')&&typeof _0x32faad[_0x73fa('0x23')]===_0x73fa('0x22');var _0x394ae2=_0x2f0040[_0x73fa('0x24')];var _0x35e9f1=_0x250104?0x0:_0x32faad[_0x73fa('0x25')];var _0xa839f4=_0x250104?_0x2f0040[_0x73fa('0x24')]:_0x32faad[_0x73fa('0x25')]+_0x32faad[_0x73fa('0x23')];var _0x873f86;if(_0xa839f4>=_0x394ae2){_0xa839f4=_0x394ae2;_0x873f86=0xc8;}else{_0x873f86=0xce;}_0x1b58c7['status'](_0x873f86);return _0x1b58c7['set'](_0x73fa('0x26'),_0x35e9f1+'-'+_0xa839f4+'/'+_0x394ae2)[_0x73fa('0x21')](_0x2f0040);}return null;};}function patchUpdates(_0x52f3b3){return function(_0x4ef1a7){try{jsonpatch['apply'](_0x4ef1a7,_0x52f3b3,!![]);}catch(_0x5b718b){return BPromise[_0x73fa('0x27')](_0x5b718b);}return _0x4ef1a7[_0x73fa('0x28')]();};}function saveUpdates(_0x1de946,_0x4004ec){return function(_0x5ecc45){if(_0x5ecc45){return _0x5ecc45[_0x73fa('0x29')](_0x1de946)[_0x73fa('0x2a')](function(_0x5c5598){return _0x5c5598;});}return null;};}function removeEntity(_0x1a2d90,_0x1900d1){return function(_0x499d6f){if(_0x499d6f){return _0x499d6f[_0x73fa('0x2b')]()[_0x73fa('0x2a')](function(){var _0x1ae3e5=_0x499d6f[_0x73fa('0x2c')]({'plain':!![]});var _0x38a495=_0x73fa('0x2d');return db[_0x73fa('0x2e')]['destroy']({'where':{'type':_0x38a495,'resourceId':_0x1ae3e5['id']}})[_0x73fa('0x2a')](function(){return _0x499d6f;});})[_0x73fa('0x2a')](function(){_0x1a2d90[_0x73fa('0x1f')](0xcc)[_0x73fa('0x20')]();});}};}function handleEntityNotFound(_0x1969fc,_0x548212){return function(_0xc8b89f){if(!_0xc8b89f){_0x1969fc[_0x73fa('0x2f')](0x194);}return _0xc8b89f;};}function handleError(_0x4f593d,_0x27370e){_0x27370e=_0x27370e||0x1f4;return function(_0x111cb1){logger['error'](_0x111cb1['stack']);if(_0x111cb1[_0x73fa('0x30')]){delete _0x111cb1[_0x73fa('0x30')];}_0x4f593d[_0x73fa('0x1f')](_0x27370e)[_0x73fa('0x31')](_0x111cb1);};}exports[_0x73fa('0x32')]=function(_0x432f6a,_0x1db245){var _0xc7dc59={},_0x2c83e6={},_0x216831={'count':0x0,'rows':[]};var _0x3591a2=_[_0x73fa('0x33')](db[_0x73fa('0x34')][_0x73fa('0x35')],function(_0x4cd18d){return{'name':_0x4cd18d[_0x73fa('0x36')],'type':_0x4cd18d[_0x73fa('0x37')][_0x73fa('0x38')]};});_0x2c83e6['model']=_[_0x73fa('0x33')](_0x3591a2,_0x73fa('0x30'));_0x2c83e6[_0x73fa('0x39')]=_[_0x73fa('0x3a')](_0x432f6a[_0x73fa('0x39')]);_0x2c83e6[_0x73fa('0x3b')]=_[_0x73fa('0x3c')](_0x2c83e6[_0x73fa('0x3d')],_0x2c83e6[_0x73fa('0x39')]);_0xc7dc59['attributes']=_[_0x73fa('0x3c')](_0x2c83e6[_0x73fa('0x3d')],qs[_0x73fa('0x3e')](_0x432f6a[_0x73fa('0x39')]['fields']));_0xc7dc59['attributes']=_0xc7dc59[_0x73fa('0x3f')][_0x73fa('0x40')]?_0xc7dc59[_0x73fa('0x3f')]:_0x2c83e6[_0x73fa('0x3d')];if(!_0x432f6a[_0x73fa('0x39')][_0x73fa('0x41')]('nolimit')){_0xc7dc59[_0x73fa('0x23')]=qs[_0x73fa('0x23')](_0x432f6a[_0x73fa('0x39')][_0x73fa('0x23')]);_0xc7dc59[_0x73fa('0x25')]=qs[_0x73fa('0x25')](_0x432f6a[_0x73fa('0x39')][_0x73fa('0x25')]);}_0xc7dc59[_0x73fa('0x42')]=qs[_0x73fa('0x43')](_0x432f6a[_0x73fa('0x39')][_0x73fa('0x43')]);_0xc7dc59[_0x73fa('0x44')]=qs[_0x73fa('0x3b')](_[_0x73fa('0x45')](_0x432f6a[_0x73fa('0x39')],_0x2c83e6[_0x73fa('0x3b')]),_0x3591a2);if(_0x432f6a['query']['filter']){_0xc7dc59[_0x73fa('0x44')]=_[_0x73fa('0x46')](_0xc7dc59[_0x73fa('0x44')],{'$or':_['map'](_0x3591a2,function(_0x393d0e){if(_0x393d0e[_0x73fa('0x37')]!==_0x73fa('0x47')){var _0x3ffcb4={};_0x3ffcb4[_0x393d0e['name']]={'$like':'%'+_0x432f6a[_0x73fa('0x39')]['filter']+'%'};return _0x3ffcb4;}})});}_0xc7dc59=_[_0x73fa('0x46')]({},_0xc7dc59,_0x432f6a['options']);var _0x4e0970={'where':_0xc7dc59[_0x73fa('0x44')]};return db[_0x73fa('0x34')]['count'](_0x4e0970)[_0x73fa('0x2a')](function(_0x5f2519){_0x216831[_0x73fa('0x24')]=_0x5f2519;if(_0x432f6a['query'][_0x73fa('0x48')]){_0xc7dc59[_0x73fa('0x49')]=[{'all':!![]}];}return db[_0x73fa('0x34')][_0x73fa('0x4a')](_0xc7dc59);})[_0x73fa('0x2a')](function(_0x3f875c){_0x216831[_0x73fa('0x4b')]=_0x3f875c;return _0x216831;})[_0x73fa('0x2a')](respondWithFilteredResult(_0x1db245,_0xc7dc59))[_0x73fa('0x4c')](handleError(_0x1db245,null));};exports[_0x73fa('0x4d')]=function(_0x365717,_0x21ea9e){var _0x2d6d65={'raw':!![],'where':{'id':_0x365717[_0x73fa('0x4e')]['id']}},_0x847553={};_0x847553[_0x73fa('0x3d')]=_['keys'](db[_0x73fa('0x34')]['rawAttributes']);_0x847553[_0x73fa('0x39')]=_['keys'](_0x365717[_0x73fa('0x39')]);_0x847553[_0x73fa('0x3b')]=_[_0x73fa('0x3c')](_0x847553[_0x73fa('0x3d')],_0x847553[_0x73fa('0x39')]);_0x2d6d65[_0x73fa('0x3f')]=_[_0x73fa('0x3c')](_0x847553[_0x73fa('0x3d')],qs[_0x73fa('0x3e')](_0x365717[_0x73fa('0x39')][_0x73fa('0x3e')]));_0x2d6d65[_0x73fa('0x3f')]=_0x2d6d65[_0x73fa('0x3f')][_0x73fa('0x40')]?_0x2d6d65['attributes']:_0x847553[_0x73fa('0x3d')];if(_0x365717['query'][_0x73fa('0x48')]){_0x2d6d65['include']=[{'all':!![]}];}_0x2d6d65=_[_0x73fa('0x46')]({},_0x2d6d65,_0x365717[_0x73fa('0x4f')]);return db[_0x73fa('0x34')]['find'](_0x2d6d65)[_0x73fa('0x2a')](handleEntityNotFound(_0x21ea9e,null))[_0x73fa('0x2a')](respondWithResult(_0x21ea9e,null))[_0x73fa('0x4c')](handleError(_0x21ea9e,null));};exports[_0x73fa('0x50')]=function(_0x1c1fe0,_0x14c53c){return db[_0x73fa('0x34')]['create'](_0x1c1fe0['body'],{})[_0x73fa('0x2a')](function(_0x4390f5){var _0x4a58d5=_0x1c1fe0[_0x73fa('0x51')][_0x73fa('0x2c')]({'plain':!![]});if(!_0x4a58d5)throw new Error(_0x73fa('0x52'));if(_0x4a58d5[_0x73fa('0x53')]===_0x73fa('0x51')){var _0xdc1e9f=_0x4390f5['get']({'plain':!![]});var _0x5ac48a=_0x73fa('0x2d');return db[_0x73fa('0x54')][_0x73fa('0x55')]({'where':{'name':_0x5ac48a,'userProfileId':_0x4a58d5['userProfileId']},'raw':!![]})[_0x73fa('0x2a')](function(_0x135fd9){if(_0x135fd9&&_0x135fd9[_0x73fa('0x56')]===0x0){return db[_0x73fa('0x2e')]['create']({'name':_0xdc1e9f[_0x73fa('0x30')],'resourceId':_0xdc1e9f['id'],'type':_0x135fd9['name'],'sectionId':_0x135fd9['id']},{})[_0x73fa('0x2a')](function(){return _0x4390f5;});}else{return _0x4390f5;}})[_0x73fa('0x4c')](function(_0x23633b){logger[_0x73fa('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23633b);throw _0x23633b;});}return _0x4390f5;})[_0x73fa('0x2a')](respondWithResult(_0x14c53c,0xc9))[_0x73fa('0x4c')](handleError(_0x14c53c,null));};exports[_0x73fa('0x29')]=function(_0x2ac305,_0x1e48ce){if(_0x2ac305[_0x73fa('0x58')]['id']){delete _0x2ac305[_0x73fa('0x58')]['id'];}return db[_0x73fa('0x34')][_0x73fa('0x55')]({'where':{'id':_0x2ac305[_0x73fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e48ce,null))[_0x73fa('0x2a')](saveUpdates(_0x2ac305[_0x73fa('0x58')],null))[_0x73fa('0x2a')](respondWithResult(_0x1e48ce,null))[_0x73fa('0x4c')](handleError(_0x1e48ce,null));};exports[_0x73fa('0x2b')]=function(_0x3d67fb,_0x4eae39){return db['MailQueue'][_0x73fa('0x55')]({'where':{'id':_0x3d67fb[_0x73fa('0x4e')]['id']}})[_0x73fa('0x2a')](handleEntityNotFound(_0x4eae39,null))[_0x73fa('0x2a')](removeEntity(_0x4eae39,null))[_0x73fa('0x4c')](handleError(_0x4eae39,null));};exports[_0x73fa('0x59')]=function(_0x3ac9f8,_0x203470){return db[_0x73fa('0x34')][_0x73fa('0x59')]()[_0x73fa('0x2a')](respondWithResult(_0x203470,null))[_0x73fa('0x4c')](handleError(_0x203470,null));};exports[_0x73fa('0x5a')]=function(_0x9acef6,_0x324f24,_0x322710){var _0x65d304={'raw':!![],'where':{}},_0x3bed81={},_0x4e66ff;return db[_0x73fa('0x34')][_0x73fa('0x5b')]({'where':{'id':_0x9acef6[_0x73fa('0x4e')]['id']}})[_0x73fa('0x2a')](handleEntityNotFound(_0x324f24,null))[_0x73fa('0x2a')](function(_0x296767){if(_0x296767){_0x4e66ff=_0x296767[_0x73fa('0x2c')]({'plain':!![]});_0x3bed81['model']=_[_0x73fa('0x3a')](db[_0x73fa('0x5c')][_0x73fa('0x35')]);_0x3bed81[_0x73fa('0x39')]=_[_0x73fa('0x3a')](_0x9acef6['query']);_0x3bed81['filters']=_[_0x73fa('0x3c')](_0x3bed81['model'],_0x3bed81[_0x73fa('0x39')]);_0x65d304[_0x73fa('0x3f')]=_['intersection'](_0x3bed81[_0x73fa('0x3d')],qs[_0x73fa('0x3e')](_0x9acef6[_0x73fa('0x39')]['fields']));_0x65d304[_0x73fa('0x3f')]=_0x65d304[_0x73fa('0x3f')][_0x73fa('0x40')]?_0x65d304[_0x73fa('0x3f')]:_0x3bed81[_0x73fa('0x3d')];if(!_0x9acef6[_0x73fa('0x39')]['hasOwnProperty'](_0x73fa('0x5d'))){_0x65d304[_0x73fa('0x23')]=qs[_0x73fa('0x23')](_0x9acef6[_0x73fa('0x39')]['limit']);_0x65d304[_0x73fa('0x25')]=qs[_0x73fa('0x25')](_0x9acef6['query'][_0x73fa('0x25')]);}_0x65d304[_0x73fa('0x42')]=qs['sort'](_0x9acef6['query']['sort']);_0x65d304[_0x73fa('0x44')]=qs[_0x73fa('0x3b')](_[_0x73fa('0x45')](_0x9acef6[_0x73fa('0x39')],_0x3bed81[_0x73fa('0x3b')]));_0x65d304[_0x73fa('0x44')][_0x73fa('0x5e')]=_0x296767['id'];if(_0x9acef6['query'][_0x73fa('0x5f')]){_0x65d304[_0x73fa('0x44')]=_[_0x73fa('0x46')](_0x65d304[_0x73fa('0x44')],{'$or':_[_0x73fa('0x33')](_0x65d304[_0x73fa('0x3f')],function(_0x3e6184){var _0x3fabdf={};_0x3fabdf[_0x3e6184]={'$like':'%'+_0x9acef6[_0x73fa('0x39')][_0x73fa('0x5f')]+'%'};return _0x3fabdf;})});}_0x65d304=_[_0x73fa('0x46')]({},_0x65d304,_0x9acef6[_0x73fa('0x4f')]);return db[_0x73fa('0x5c')][_0x73fa('0x4a')](_0x65d304);}})['then'](function(_0x3a8f21){if(_0x3a8f21){return db[_0x73fa('0x60')]['findAndCountAll']({'where':{'id':_[_0x73fa('0x33')](_0x3a8f21,_0x73fa('0x61')),'role':_0x73fa('0x62')},'attributes':['id','name',_0x73fa('0x63'),_0x73fa('0x64'),'createdAt']});}})[_0x73fa('0x2a')](function(_0x474e23){if(_0x474e23){return{'count':_0x474e23[_0x73fa('0x24')],'rows':_['map'](_0x474e23[_0x73fa('0x4b')],function(_0x179ca7){return{'membername':_0x179ca7[_0x73fa('0x30')],'UserId':_0x179ca7['id'],'queue_name':_0x4e66ff[_0x73fa('0x30')],'MailQueueId':_0x4e66ff['id'],'interface':util[_0x73fa('0x65')](_0x73fa('0x66'),'SIP',_0x179ca7[_0x73fa('0x30')]),'penalty':0x0,'paused':_0x179ca7[_0x73fa('0x63')],'createdAt':_0x179ca7[_0x73fa('0x67')],'updatedAt':_0x179ca7[_0x73fa('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x73fa('0x2a')](respondWithFilteredResult(_0x324f24,_0x65d304))[_0x73fa('0x4c')](handleError(_0x324f24,null));};exports[_0x73fa('0x68')]=function(_0x28d5e5,_0x575ad8,_0x1b6e28){var _0x1563d8={};var _0x376b5c={};var _0x4cb596;var _0x116dca;return db['MailQueue'][_0x73fa('0x5b')]({'where':{'id':_0x28d5e5['params']['id']}})[_0x73fa('0x2a')](handleEntityNotFound(_0x575ad8,null))[_0x73fa('0x2a')](function(_0x480696){if(_0x480696){_0x4cb596=_0x480696;_0x376b5c['model']=_['keys'](db['Team'][_0x73fa('0x35')]);_0x376b5c['query']=_[_0x73fa('0x3a')](_0x28d5e5[_0x73fa('0x39')]);_0x376b5c[_0x73fa('0x3b')]=_[_0x73fa('0x3c')](_0x376b5c['model'],_0x376b5c[_0x73fa('0x39')]);_0x1563d8[_0x73fa('0x3f')]=_[_0x73fa('0x3c')](_0x376b5c[_0x73fa('0x3d')],qs['fields'](_0x28d5e5['query'][_0x73fa('0x3e')]));_0x1563d8[_0x73fa('0x3f')]=_0x1563d8[_0x73fa('0x3f')]['length']?_0x1563d8['attributes']:_0x376b5c['model'];_0x1563d8[_0x73fa('0x42')]=qs['sort'](_0x28d5e5[_0x73fa('0x39')][_0x73fa('0x43')]);_0x1563d8[_0x73fa('0x44')]=qs[_0x73fa('0x3b')](_['pick'](_0x28d5e5[_0x73fa('0x39')],_0x376b5c[_0x73fa('0x3b')]));if(_0x28d5e5[_0x73fa('0x39')][_0x73fa('0x5f')]){_0x1563d8[_0x73fa('0x44')]=_['merge'](_0x1563d8[_0x73fa('0x44')],{'$or':_['map'](_0x1563d8[_0x73fa('0x3f')],function(_0x7cbacb){var _0x3df2f6={};_0x3df2f6[_0x7cbacb]={'$like':'%'+_0x28d5e5[_0x73fa('0x39')]['filter']+'%'};return _0x3df2f6;})});}_0x1563d8=_[_0x73fa('0x46')]({},_0x1563d8,_0x28d5e5[_0x73fa('0x4f')]);return _0x4cb596[_0x73fa('0x68')](_0x1563d8);}})[_0x73fa('0x2a')](function(_0x36644e){if(_0x36644e){_0x116dca=_0x36644e['length'];if(!_0x28d5e5['query'][_0x73fa('0x41')](_0x73fa('0x5d'))){_0x1563d8['limit']=qs[_0x73fa('0x23')](_0x28d5e5[_0x73fa('0x39')][_0x73fa('0x23')]);_0x1563d8[_0x73fa('0x25')]=qs[_0x73fa('0x25')](_0x28d5e5[_0x73fa('0x39')][_0x73fa('0x25')]);}return _0x4cb596[_0x73fa('0x68')](_0x1563d8);}})[_0x73fa('0x2a')](function(_0x5218d0){if(_0x5218d0){return _0x5218d0?{'count':_0x116dca,'rows':_0x5218d0}:null;}})[_0x73fa('0x2a')](respondWithResult(_0x575ad8,null))[_0x73fa('0x4c')](handleError(_0x575ad8,null));};exports[_0x73fa('0x69')]=function(_0x483cb8,_0x3431a7,_0x2df7e4){var _0x28c8cf=_0x483cb8[_0x73fa('0x58')][_0x73fa('0x6a')];return db[_0x73fa('0x6b')][_0x73fa('0x4a')]({'where':{'id':_0x28c8cf},'attributes':['id'],'include':[{'model':db[_0x73fa('0x60')],'as':_0x73fa('0x6c'),'attributes':['id',_0x73fa('0x30'),_0x73fa('0x6d'),'voicePause',_0x73fa('0x6e')],'raw':!![]}]})[_0x73fa('0x2a')](function(_0x129a10){if(_0x129a10){var _0xcc853b=_[_0x73fa('0x6f')](_0x129a10,function(_0x266875){var _0x3c37b9=_0x266875[_0x73fa('0x2c')]({'plain':!![]});return _0x3c37b9[_0x73fa('0x6c')];});return db[_0x73fa('0x34')][_0x73fa('0x55')]({'where':{'id':_0x483cb8[_0x73fa('0x4e')]['id']}})[_0x73fa('0x2a')](function(_0x13130d){return db[_0x73fa('0x70')][_0x73fa('0x71')](function(_0x2fb14e){return _0x13130d[_0x73fa('0x69')](_0x28c8cf,{'transaction':_0x2fb14e})[_0x73fa('0x2a')](function(){return BPromise['each'](_0xcc853b,function(_0x41d70c){return db['UserMailQueue'][_0x73fa('0x72')]({'where':{'UserId':_0x41d70c['id'],'MailQueueId':_0x483cb8[_0x73fa('0x4e')]['id']},'transaction':_0x2fb14e});});})[_0x73fa('0x2a')](function(){_0xcc853b['forEach'](function(_0x20ae3f){socket['emit'](_0x73fa('0x73'),{'UserId':_0x20ae3f['id'],'MailQueueId':_0x13130d['id']});});});});});}})['then'](respondWithStatusCode(_0x3431a7,null))[_0x73fa('0x4c')](handleError(_0x3431a7,null));};exports[_0x73fa('0x74')]=function(_0x477966,_0x3df29a,_0x5ef4be){return db[_0x73fa('0x6b')][_0x73fa('0x4a')]({'where':{'id':_0x477966[_0x73fa('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x73fa('0x60')],'as':_0x73fa('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x73fa('0x2a')](handleEntityNotFound(_0x3df29a,null))[_0x73fa('0x2a')](function(_0x341fe1){var _0x342d0a=_[_0x73fa('0x33')](_0x341fe1,'id');var _0x31481f=[];var _0x4f67c1=[];var _0x31c158=squel[_0x73fa('0x75')]();_0x31c158['field']('tq.TeamId')[_0x73fa('0x76')]('team_has_mail_queues','tq')['join'](_0x73fa('0x77'),'ut',_0x73fa('0x78'))[_0x73fa('0x44')](_0x73fa('0x79'),_0x477966[_0x73fa('0x4e')]['id']);for(var _0x1a343f=0x0;_0x1a343f<_0x341fe1['length'];_0x1a343f+=0x1){let _0x49a3f0=_0x341fe1[_0x1a343f];for(var _0xba71ec=0x0;_0xba71ec<_0x49a3f0[_0x73fa('0x6c')][_0x73fa('0x40')];_0xba71ec+=0x1){let _0x47fc8f=_0x49a3f0['Agents'][_0xba71ec];var _0x4cce77=_0x31c158[_0x73fa('0x7a')]();_0x4cce77[_0x73fa('0x44')](_0x73fa('0x7b'),_0x47fc8f['id']);_0x4f67c1[_0x73fa('0x7c')](db[_0x73fa('0x70')][_0x73fa('0x39')](_0x4cce77['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x118262){if(_0x118262['length']===0x1){return _0x47fc8f['id'];}else{var _0x364c15=_[_0x73fa('0x7d')](_[_0x73fa('0x33')](_0x118262,_0x73fa('0x7e')),function(_0x191a93){return _[_0x73fa('0x7f')](_0x342d0a,_0x191a93);});if(_0x364c15){return _0x47fc8f['id'];}}}));}}return BPromise[_0x73fa('0x80')](_0x4f67c1)[_0x73fa('0x2a')](function(_0x2f612a){_0x31481f=_(_0x31481f)['union'](_0x2f612a)[_0x73fa('0x81')]()[_0x73fa('0x82')]();return db[_0x73fa('0x34')]['find']({'where':{'id':_0x477966[_0x73fa('0x4e')]['id']}})[_0x73fa('0x2a')](function(_0x48303d){return db['sequelize']['transaction'](function(_0x15b6e8){return _0x48303d[_0x73fa('0x74')](_0x477966[_0x73fa('0x39')][_0x73fa('0x6a')],{'transaction':_0x15b6e8})[_0x73fa('0x2a')](function(){if(!_[_0x73fa('0x83')](_0x31481f)){return _0x48303d['removeAgents'](_0x31481f,{'transaction':_0x15b6e8});}})[_0x73fa('0x2a')](function(){_0x31481f[_0x73fa('0x84')](function(_0x41b929){socket[_0x73fa('0x85')]('userMailQueue:remove',{'UserId':_0x41b929,'MailQueueId':_0x48303d['id']});});});});});});})['then'](respondWithStatusCode(_0x3df29a,null))[_0x73fa('0x4c')](handleError(_0x3df29a,null));};exports['addAgents']=function(_0x5af109,_0x403359,_0x3c1fb8){return db[_0x73fa('0x34')][_0x73fa('0x55')]({'where':{'id':_0x5af109[_0x73fa('0x4e')]['id']}})[_0x73fa('0x2a')](handleEntityNotFound(_0x403359,null))[_0x73fa('0x2a')](function(_0x3eca37){if(_0x3eca37){return _0x3eca37[_0x73fa('0x86')](_0x5af109[_0x73fa('0x58')][_0x73fa('0x6a')],_[_0x73fa('0x87')](_0x5af109[_0x73fa('0x58')],['ids','id'])||{})[_0x73fa('0x88')](function(_0x262726){for(var _0x4802b3=0x0;_0x4802b3<_0x5af109[_0x73fa('0x58')]['ids'][_0x73fa('0x40')];_0x4802b3+=0x1){socket[_0x73fa('0x85')](_0x73fa('0x73'),{'UserId':Number(_0x5af109['body'][_0x73fa('0x6a')][_0x4802b3]),'MailQueueId':Number(_0x5af109[_0x73fa('0x4e')]['id'])});}return _0x262726;});}})[_0x73fa('0x2a')](respondWithResult(_0x403359,null))[_0x73fa('0x4c')](handleError(_0x403359,null));};exports[_0x73fa('0x89')]=function(_0x59f7bf,_0x3c9de1,_0x4972f0){return db[_0x73fa('0x34')][_0x73fa('0x55')]({'where':{'id':_0x59f7bf[_0x73fa('0x4e')]['id']}})[_0x73fa('0x2a')](handleEntityNotFound(_0x3c9de1,null))[_0x73fa('0x2a')](function(_0x440c70){if(_0x440c70){return _0x440c70[_0x73fa('0x89')](_0x59f7bf[_0x73fa('0x39')][_0x73fa('0x6a')])[_0x73fa('0x2a')](function(){if(_['isArray'](_0x59f7bf[_0x73fa('0x39')][_0x73fa('0x6a')])){for(var _0x234367=0x0;_0x234367<_0x59f7bf[_0x73fa('0x39')]['ids']['length'];_0x234367+=0x1){socket['emit'](_0x73fa('0x8a'),{'UserId':Number(_0x59f7bf[_0x73fa('0x39')][_0x73fa('0x6a')][_0x234367]),'MailQueueId':Number(_0x59f7bf[_0x73fa('0x4e')]['id'])});}}else{socket[_0x73fa('0x85')]('userMailQueue:remove',{'UserId':Number(_0x59f7bf['query'][_0x73fa('0x6a')]),'MailQueueId':Number(_0x59f7bf['params']['id'])});}});}})[_0x73fa('0x2a')](respondWithStatusCode(_0x3c9de1,null))['catch'](handleError(_0x3c9de1,null));};exports['getAgents']=function(_0x194ebf,_0x4f5d01,_0x56ef11){var _0x517187={};var _0x4f6edc={};var _0x142c6d;var _0x3d2052;return db['MailQueue']['findOne']({'where':{'id':_0x194ebf[_0x73fa('0x4e')]['id']}})[_0x73fa('0x2a')](handleEntityNotFound(_0x4f5d01,null))['then'](function(_0x167c55){if(_0x167c55){_0x142c6d=_0x167c55;_0x4f6edc[_0x73fa('0x3d')]=_[_0x73fa('0x3a')](db['User'][_0x73fa('0x35')]);_0x4f6edc['query']=_[_0x73fa('0x3a')](_0x194ebf[_0x73fa('0x39')]);_0x4f6edc[_0x73fa('0x3b')]=_[_0x73fa('0x3c')](_0x4f6edc[_0x73fa('0x3d')],_0x4f6edc[_0x73fa('0x39')]);_0x517187[_0x73fa('0x3f')]=_[_0x73fa('0x3c')](_0x4f6edc['model'],qs['fields'](_0x194ebf[_0x73fa('0x39')]['fields']));_0x517187[_0x73fa('0x3f')]=_0x517187[_0x73fa('0x3f')]['length']?_0x517187[_0x73fa('0x3f')]:_0x4f6edc[_0x73fa('0x3d')];_0x517187[_0x73fa('0x42')]=qs[_0x73fa('0x43')](_0x194ebf[_0x73fa('0x39')][_0x73fa('0x43')]);_0x517187[_0x73fa('0x44')]=qs[_0x73fa('0x3b')](_[_0x73fa('0x45')](_0x194ebf[_0x73fa('0x39')],_0x4f6edc['filters']));if(_0x194ebf[_0x73fa('0x39')][_0x73fa('0x5f')]){_0x517187['where']=_[_0x73fa('0x46')](_0x517187[_0x73fa('0x44')],{'$or':_[_0x73fa('0x33')](_0x517187[_0x73fa('0x3f')],function(_0x3529cc){var _0x14236={};_0x14236[_0x3529cc]={'$like':'%'+_0x194ebf[_0x73fa('0x39')][_0x73fa('0x5f')]+'%'};return _0x14236;})});}_0x517187=_[_0x73fa('0x46')]({},_0x517187,_0x194ebf[_0x73fa('0x4f')]);return _0x142c6d[_0x73fa('0x8b')](_0x517187);}})[_0x73fa('0x2a')](function(_0xce3f00){if(_0xce3f00){_0x3d2052=_0xce3f00['length'];if(!_0x194ebf[_0x73fa('0x39')][_0x73fa('0x41')](_0x73fa('0x5d'))){_0x517187['limit']=qs[_0x73fa('0x23')](_0x194ebf[_0x73fa('0x39')][_0x73fa('0x23')]);_0x517187['offset']=qs[_0x73fa('0x25')](_0x194ebf[_0x73fa('0x39')][_0x73fa('0x25')]);}return _0x142c6d['getAgents'](_0x517187);}})['then'](function(_0x2cbab7){if(_0x2cbab7){return _0x2cbab7?{'count':_0x3d2052,'rows':_0x2cbab7}:null;}})[_0x73fa('0x2a')](respondWithResult(_0x4f5d01,null))[_0x73fa('0x4c')](handleError(_0x4f5d01,null));}; \ No newline at end of file +var _0xf12f=['TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','MailQueue','includeAll','findAll','rows','catch','show','params','attributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every'];(function(_0x2d20ac,_0x44e103){var _0x125e12=function(_0x43a2a1){while(--_0x43a2a1){_0x2d20ac['push'](_0x2d20ac['shift']());}};_0x125e12(++_0x44e103);}(_0xf12f,0x9c));var _0xff12=function(_0x15b0c9,_0x161ebf){_0x15b0c9=_0x15b0c9-0x0;var _0x1f287e=_0xf12f[_0x15b0c9];return _0x1f287e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff12('0x0'));var zipdir=require(_0xff12('0x1'));var jsonpatch=require(_0xff12('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff12('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff12('0x4'));var sox=require(_0xff12('0x5'));var csv=require(_0xff12('0x6'));var ejs=require(_0xff12('0x7'));var fs=require('fs');var fs_extra=require(_0xff12('0x8'));var _=require(_0xff12('0x9'));var squel=require(_0xff12('0xa'));var crypto=require(_0xff12('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff12('0x6'));var querystring=require('querystring');var Papa=require(_0xff12('0xc'));var Redis=require(_0xff12('0xd'));var authService=require(_0xff12('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xff12('0xf'));var hardwareService=require(_0xff12('0x10'));var logger=require(_0xff12('0x11'))(_0xff12('0x12'));var utils=require('../../config/utils');var config=require(_0xff12('0x13'));var licenseUtil=require(_0xff12('0x14'));var db=require(_0xff12('0x15'))['db'];config['redis']=_[_0xff12('0x16')](config['redis'],{'host':_0xff12('0x17'),'port':0x18eb});var socket=require(_0xff12('0x18'))(new Redis(config[_0xff12('0x19')]));require(_0xff12('0x1a'))['register'](socket);function respondWithStatusCode(_0x4ba70f,_0x26afae){_0x26afae=_0x26afae||0xcc;return function(_0x3bab41){if(_0x3bab41){return _0x4ba70f[_0xff12('0x1b')](_0x26afae);}return _0x4ba70f[_0xff12('0x1c')](_0x26afae)[_0xff12('0x1d')]();};}function respondWithResult(_0x267a5e,_0x42610f){_0x42610f=_0x42610f||0xc8;return function(_0x59e703){if(_0x59e703){return _0x267a5e['status'](_0x42610f)[_0xff12('0x1e')](_0x59e703);}};}function respondWithFilteredResult(_0x11504f,_0x21edfa){return function(_0x37bb28){if(_0x37bb28){var _0x5a5d4a=typeof _0x21edfa[_0xff12('0x1f')]===_0xff12('0x20')&&typeof _0x21edfa[_0xff12('0x21')]===_0xff12('0x20');var _0x3ddb24=_0x37bb28[_0xff12('0x22')];var _0x28781f=_0x5a5d4a?0x0:_0x21edfa['offset'];var _0x20b973=_0x5a5d4a?_0x37bb28[_0xff12('0x22')]:_0x21edfa[_0xff12('0x1f')]+_0x21edfa[_0xff12('0x21')];var _0xb02818;if(_0x20b973>=_0x3ddb24){_0x20b973=_0x3ddb24;_0xb02818=0xc8;}else{_0xb02818=0xce;}_0x11504f[_0xff12('0x1c')](_0xb02818);return _0x11504f[_0xff12('0x23')](_0xff12('0x24'),_0x28781f+'-'+_0x20b973+'/'+_0x3ddb24)[_0xff12('0x1e')](_0x37bb28);}return null;};}function patchUpdates(_0x214c9c){return function(_0x2dc113){try{jsonpatch[_0xff12('0x25')](_0x2dc113,_0x214c9c,!![]);}catch(_0x3b3cdd){return BPromise[_0xff12('0x26')](_0x3b3cdd);}return _0x2dc113['save']();};}function saveUpdates(_0x25cddf,_0xe8a838){return function(_0x119b64){if(_0x119b64){return _0x119b64[_0xff12('0x27')](_0x25cddf)[_0xff12('0x28')](function(_0x2e603d){return _0x2e603d;});}return null;};}function removeEntity(_0x286c1f,_0x34dbc6){return function(_0x29b1b5){if(_0x29b1b5){return _0x29b1b5[_0xff12('0x29')]()[_0xff12('0x28')](function(){var _0x2bac21=_0x29b1b5[_0xff12('0x2a')]({'plain':!![]});var _0x11776d='MailQueues';return db[_0xff12('0x2b')]['destroy']({'where':{'type':_0x11776d,'resourceId':_0x2bac21['id']}})[_0xff12('0x28')](function(){return _0x29b1b5;});})[_0xff12('0x28')](function(){_0x286c1f[_0xff12('0x1c')](0xcc)[_0xff12('0x1d')]();});}};}function handleEntityNotFound(_0xbcac60,_0x18f960){return function(_0x41aab0){if(!_0x41aab0){_0xbcac60['sendStatus'](0x194);}return _0x41aab0;};}function handleError(_0x26864d,_0x56067f){_0x56067f=_0x56067f||0x1f4;return function(_0x240284){logger['error'](_0x240284[_0xff12('0x2c')]);if(_0x240284[_0xff12('0x2d')]){delete _0x240284[_0xff12('0x2d')];}_0x26864d[_0xff12('0x1c')](_0x56067f)['send'](_0x240284);};}exports[_0xff12('0x2e')]=function(_0x4de54d,_0x5b124e){var _0x40f7f1={},_0x369907={},_0x182b6e={'count':0x0,'rows':[]};var _0x2ac838=_[_0xff12('0x2f')](db['MailQueue'][_0xff12('0x30')],function(_0x358723){return{'name':_0x358723[_0xff12('0x31')],'type':_0x358723['type'][_0xff12('0x32')]};});_0x369907[_0xff12('0x33')]=_[_0xff12('0x2f')](_0x2ac838,_0xff12('0x2d'));_0x369907[_0xff12('0x34')]=_[_0xff12('0x35')](_0x4de54d[_0xff12('0x34')]);_0x369907[_0xff12('0x36')]=_[_0xff12('0x37')](_0x369907[_0xff12('0x33')],_0x369907['query']);_0x40f7f1['attributes']=_[_0xff12('0x37')](_0x369907['model'],qs[_0xff12('0x38')](_0x4de54d[_0xff12('0x34')]['fields']));_0x40f7f1['attributes']=_0x40f7f1['attributes']['length']?_0x40f7f1['attributes']:_0x369907[_0xff12('0x33')];if(!_0x4de54d[_0xff12('0x34')][_0xff12('0x39')](_0xff12('0x3a'))){_0x40f7f1[_0xff12('0x21')]=qs[_0xff12('0x21')](_0x4de54d[_0xff12('0x34')]['limit']);_0x40f7f1[_0xff12('0x1f')]=qs[_0xff12('0x1f')](_0x4de54d[_0xff12('0x34')][_0xff12('0x1f')]);}_0x40f7f1[_0xff12('0x3b')]=qs['sort'](_0x4de54d[_0xff12('0x34')][_0xff12('0x3c')]);_0x40f7f1[_0xff12('0x3d')]=qs[_0xff12('0x36')](_[_0xff12('0x3e')](_0x4de54d['query'],_0x369907[_0xff12('0x36')]),_0x2ac838);if(_0x4de54d[_0xff12('0x34')]['filter']){_0x40f7f1[_0xff12('0x3d')]=_[_0xff12('0x3f')](_0x40f7f1[_0xff12('0x3d')],{'$or':_[_0xff12('0x2f')](_0x2ac838,function(_0x2a0909){if(_0x2a0909['type']!=='VIRTUAL'){var _0x56bfa8={};_0x56bfa8[_0x2a0909[_0xff12('0x2d')]]={'$like':'%'+_0x4de54d[_0xff12('0x34')][_0xff12('0x40')]+'%'};return _0x56bfa8;}})});}_0x40f7f1=_[_0xff12('0x3f')]({},_0x40f7f1,_0x4de54d[_0xff12('0x41')]);var _0x49cee5={'where':_0x40f7f1[_0xff12('0x3d')]};return db[_0xff12('0x42')][_0xff12('0x22')](_0x49cee5)['then'](function(_0x39a7a7){_0x182b6e['count']=_0x39a7a7;if(_0x4de54d[_0xff12('0x34')][_0xff12('0x43')]){_0x40f7f1['include']=[{'all':!![]}];}return db['MailQueue'][_0xff12('0x44')](_0x40f7f1);})[_0xff12('0x28')](function(_0x541e0e){_0x182b6e[_0xff12('0x45')]=_0x541e0e;return _0x182b6e;})[_0xff12('0x28')](respondWithFilteredResult(_0x5b124e,_0x40f7f1))[_0xff12('0x46')](handleError(_0x5b124e,null));};exports[_0xff12('0x47')]=function(_0x411f5b,_0x365163){var _0x1a8101={'raw':!![],'where':{'id':_0x411f5b[_0xff12('0x48')]['id']}},_0x4df15e={};_0x4df15e[_0xff12('0x33')]=_[_0xff12('0x35')](db[_0xff12('0x42')][_0xff12('0x30')]);_0x4df15e[_0xff12('0x34')]=_['keys'](_0x411f5b[_0xff12('0x34')]);_0x4df15e['filters']=_[_0xff12('0x37')](_0x4df15e['model'],_0x4df15e['query']);_0x1a8101[_0xff12('0x49')]=_['intersection'](_0x4df15e['model'],qs[_0xff12('0x38')](_0x411f5b['query'][_0xff12('0x38')]));_0x1a8101['attributes']=_0x1a8101[_0xff12('0x49')][_0xff12('0x4a')]?_0x1a8101[_0xff12('0x49')]:_0x4df15e[_0xff12('0x33')];if(_0x411f5b[_0xff12('0x34')][_0xff12('0x43')]){_0x1a8101[_0xff12('0x4b')]=[{'all':!![]}];}_0x1a8101=_[_0xff12('0x3f')]({},_0x1a8101,_0x411f5b[_0xff12('0x41')]);return db[_0xff12('0x42')][_0xff12('0x4c')](_0x1a8101)['then'](handleEntityNotFound(_0x365163,null))[_0xff12('0x28')](respondWithResult(_0x365163,null))[_0xff12('0x46')](handleError(_0x365163,null));};exports[_0xff12('0x4d')]=function(_0x2fb604,_0x234756){return db[_0xff12('0x42')][_0xff12('0x4d')](_0x2fb604[_0xff12('0x4e')],{})[_0xff12('0x28')](function(_0xa472b6){var _0xfbc4a5=_0x2fb604[_0xff12('0x4f')][_0xff12('0x2a')]({'plain':!![]});if(!_0xfbc4a5)throw new Error(_0xff12('0x50'));if(_0xfbc4a5[_0xff12('0x51')]==='user'){var _0x3af631=_0xa472b6[_0xff12('0x2a')]({'plain':!![]});var _0x5c6080=_0xff12('0x52');return db[_0xff12('0x53')]['find']({'where':{'name':_0x5c6080,'userProfileId':_0xfbc4a5[_0xff12('0x54')]},'raw':!![]})[_0xff12('0x28')](function(_0xfe9d11){if(_0xfe9d11&&_0xfe9d11[_0xff12('0x55')]===0x0){return db[_0xff12('0x2b')][_0xff12('0x4d')]({'name':_0x3af631[_0xff12('0x2d')],'resourceId':_0x3af631['id'],'type':_0xfe9d11['name'],'sectionId':_0xfe9d11['id']},{})[_0xff12('0x28')](function(){return _0xa472b6;});}else{return _0xa472b6;}})['catch'](function(_0x578446){logger['error'](_0xff12('0x56'),_0x578446);throw _0x578446;});}return _0xa472b6;})['then'](respondWithResult(_0x234756,0xc9))[_0xff12('0x46')](handleError(_0x234756,null));};exports['update']=function(_0x527238,_0x623609){if(_0x527238[_0xff12('0x4e')]['id']){delete _0x527238[_0xff12('0x4e')]['id'];}return db[_0xff12('0x42')][_0xff12('0x4c')]({'where':{'id':_0x527238[_0xff12('0x48')]['id']}})['then'](handleEntityNotFound(_0x623609,null))[_0xff12('0x28')](saveUpdates(_0x527238[_0xff12('0x4e')],null))[_0xff12('0x28')](respondWithResult(_0x623609,null))[_0xff12('0x46')](handleError(_0x623609,null));};exports[_0xff12('0x29')]=function(_0x3bf8d7,_0x463504){return db[_0xff12('0x42')]['find']({'where':{'id':_0x3bf8d7['params']['id']}})['then'](handleEntityNotFound(_0x463504,null))[_0xff12('0x28')](removeEntity(_0x463504,null))[_0xff12('0x46')](handleError(_0x463504,null));};exports[_0xff12('0x57')]=function(_0x537e8e,_0x17229f){return db['MailQueue']['describe']()[_0xff12('0x28')](respondWithResult(_0x17229f,null))[_0xff12('0x46')](handleError(_0x17229f,null));};exports[_0xff12('0x58')]=function(_0x36cd3f,_0x5c6c77,_0x89def5){var _0x265a6c={'raw':!![],'where':{}},_0x4e712f={},_0x5cf480;return db['MailQueue'][_0xff12('0x59')]({'where':{'id':_0x36cd3f['params']['id']}})[_0xff12('0x28')](handleEntityNotFound(_0x5c6c77,null))[_0xff12('0x28')](function(_0x37679f){if(_0x37679f){_0x5cf480=_0x37679f[_0xff12('0x2a')]({'plain':!![]});_0x4e712f[_0xff12('0x33')]=_[_0xff12('0x35')](db[_0xff12('0x5a')][_0xff12('0x30')]);_0x4e712f['query']=_['keys'](_0x36cd3f['query']);_0x4e712f[_0xff12('0x36')]=_[_0xff12('0x37')](_0x4e712f['model'],_0x4e712f[_0xff12('0x34')]);_0x265a6c[_0xff12('0x49')]=_[_0xff12('0x37')](_0x4e712f[_0xff12('0x33')],qs[_0xff12('0x38')](_0x36cd3f[_0xff12('0x34')][_0xff12('0x38')]));_0x265a6c[_0xff12('0x49')]=_0x265a6c[_0xff12('0x49')][_0xff12('0x4a')]?_0x265a6c[_0xff12('0x49')]:_0x4e712f[_0xff12('0x33')];if(!_0x36cd3f['query']['hasOwnProperty'](_0xff12('0x3a'))){_0x265a6c[_0xff12('0x21')]=qs[_0xff12('0x21')](_0x36cd3f[_0xff12('0x34')][_0xff12('0x21')]);_0x265a6c[_0xff12('0x1f')]=qs[_0xff12('0x1f')](_0x36cd3f[_0xff12('0x34')][_0xff12('0x1f')]);}_0x265a6c[_0xff12('0x3b')]=qs['sort'](_0x36cd3f[_0xff12('0x34')][_0xff12('0x3c')]);_0x265a6c[_0xff12('0x3d')]=qs['filters'](_[_0xff12('0x3e')](_0x36cd3f[_0xff12('0x34')],_0x4e712f[_0xff12('0x36')]));_0x265a6c[_0xff12('0x3d')][_0xff12('0x5b')]=_0x37679f['id'];if(_0x36cd3f[_0xff12('0x34')][_0xff12('0x40')]){_0x265a6c[_0xff12('0x3d')]=_[_0xff12('0x3f')](_0x265a6c[_0xff12('0x3d')],{'$or':_['map'](_0x265a6c[_0xff12('0x49')],function(_0x3047e4){var _0x5b1392={};_0x5b1392[_0x3047e4]={'$like':'%'+_0x36cd3f[_0xff12('0x34')][_0xff12('0x40')]+'%'};return _0x5b1392;})});}_0x265a6c=_[_0xff12('0x3f')]({},_0x265a6c,_0x36cd3f[_0xff12('0x41')]);return db['UserMailQueue'][_0xff12('0x44')](_0x265a6c);}})['then'](function(_0x1c422b){if(_0x1c422b){return db[_0xff12('0x5c')][_0xff12('0x5d')]({'where':{'id':_[_0xff12('0x2f')](_0x1c422b,'UserId'),'role':_0xff12('0x5e')},'attributes':['id',_0xff12('0x2d'),_0xff12('0x5f'),_0xff12('0x60'),_0xff12('0x61')]});}})[_0xff12('0x28')](function(_0x4682e6){if(_0x4682e6){return{'count':_0x4682e6['count'],'rows':_['map'](_0x4682e6['rows'],function(_0x232fb6){return{'membername':_0x232fb6['name'],'UserId':_0x232fb6['id'],'queue_name':_0x5cf480[_0xff12('0x2d')],'MailQueueId':_0x5cf480['id'],'interface':util[_0xff12('0x62')](_0xff12('0x63'),_0xff12('0x64'),_0x232fb6[_0xff12('0x2d')]),'penalty':0x0,'paused':_0x232fb6['mailPause'],'createdAt':_0x232fb6[_0xff12('0x61')],'updatedAt':_0x232fb6[_0xff12('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5c6c77,_0x265a6c))[_0xff12('0x46')](handleError(_0x5c6c77,null));};exports[_0xff12('0x65')]=function(_0x102878,_0x59afc4,_0x5f10c0){var _0x27c403={};var _0x44b114={};var _0x33011d;var _0x2e6194;return db[_0xff12('0x42')][_0xff12('0x59')]({'where':{'id':_0x102878['params']['id']}})['then'](handleEntityNotFound(_0x59afc4,null))['then'](function(_0x1c7a41){if(_0x1c7a41){_0x33011d=_0x1c7a41;_0x44b114['model']=_[_0xff12('0x35')](db[_0xff12('0x66')]['rawAttributes']);_0x44b114[_0xff12('0x34')]=_[_0xff12('0x35')](_0x102878['query']);_0x44b114['filters']=_['intersection'](_0x44b114[_0xff12('0x33')],_0x44b114[_0xff12('0x34')]);_0x27c403['attributes']=_[_0xff12('0x37')](_0x44b114[_0xff12('0x33')],qs[_0xff12('0x38')](_0x102878['query'][_0xff12('0x38')]));_0x27c403['attributes']=_0x27c403[_0xff12('0x49')][_0xff12('0x4a')]?_0x27c403[_0xff12('0x49')]:_0x44b114[_0xff12('0x33')];_0x27c403[_0xff12('0x3b')]=qs[_0xff12('0x3c')](_0x102878[_0xff12('0x34')][_0xff12('0x3c')]);_0x27c403['where']=qs[_0xff12('0x36')](_[_0xff12('0x3e')](_0x102878['query'],_0x44b114[_0xff12('0x36')]));if(_0x102878[_0xff12('0x34')][_0xff12('0x40')]){_0x27c403[_0xff12('0x3d')]=_[_0xff12('0x3f')](_0x27c403[_0xff12('0x3d')],{'$or':_[_0xff12('0x2f')](_0x27c403[_0xff12('0x49')],function(_0x13f2ec){var _0x11daef={};_0x11daef[_0x13f2ec]={'$like':'%'+_0x102878['query'][_0xff12('0x40')]+'%'};return _0x11daef;})});}_0x27c403=_[_0xff12('0x3f')]({},_0x27c403,_0x102878[_0xff12('0x41')]);return _0x33011d[_0xff12('0x65')](_0x27c403);}})[_0xff12('0x28')](function(_0x258dd2){if(_0x258dd2){_0x2e6194=_0x258dd2['length'];if(!_0x102878[_0xff12('0x34')][_0xff12('0x39')](_0xff12('0x3a'))){_0x27c403[_0xff12('0x21')]=qs[_0xff12('0x21')](_0x102878[_0xff12('0x34')][_0xff12('0x21')]);_0x27c403[_0xff12('0x1f')]=qs[_0xff12('0x1f')](_0x102878[_0xff12('0x34')]['offset']);}return _0x33011d[_0xff12('0x65')](_0x27c403);}})[_0xff12('0x28')](function(_0x4cde6a){if(_0x4cde6a){return _0x4cde6a?{'count':_0x2e6194,'rows':_0x4cde6a}:null;}})['then'](respondWithResult(_0x59afc4,null))[_0xff12('0x46')](handleError(_0x59afc4,null));};exports[_0xff12('0x67')]=function(_0x50ff16,_0x252076,_0x14349d){var _0x8d2001=_0x50ff16[_0xff12('0x4e')][_0xff12('0x68')];return db[_0xff12('0x66')][_0xff12('0x44')]({'where':{'id':_0x8d2001},'attributes':['id'],'include':[{'model':db['User'],'as':_0xff12('0x69'),'attributes':['id',_0xff12('0x2d'),_0xff12('0x6a'),_0xff12('0x6b'),_0xff12('0x6c')],'raw':!![]}]})[_0xff12('0x28')](function(_0x4bde8e){if(_0x4bde8e){var _0x165c58=_[_0xff12('0x6d')](_0x4bde8e,function(_0x5b4e93){var _0xa4b317=_0x5b4e93['get']({'plain':!![]});return _0xa4b317[_0xff12('0x69')];});return db['MailQueue'][_0xff12('0x4c')]({'where':{'id':_0x50ff16[_0xff12('0x48')]['id']}})[_0xff12('0x28')](function(_0x371e8f){return db[_0xff12('0x6e')]['transaction'](function(_0xc9bfbd){return _0x371e8f[_0xff12('0x67')](_0x8d2001,{'transaction':_0xc9bfbd})[_0xff12('0x28')](function(){return BPromise['each'](_0x165c58,function(_0x158bea){return db[_0xff12('0x5a')][_0xff12('0x6f')]({'where':{'UserId':_0x158bea['id'],'MailQueueId':_0x50ff16['params']['id']},'transaction':_0xc9bfbd});});})['then'](function(){_0x165c58[_0xff12('0x70')](function(_0x3b1aac){socket[_0xff12('0x71')](_0xff12('0x72'),{'UserId':_0x3b1aac['id'],'MailQueueId':_0x371e8f['id']});});});});});}})['then'](respondWithStatusCode(_0x252076,null))[_0xff12('0x46')](handleError(_0x252076,null));};exports[_0xff12('0x73')]=function(_0x103f09,_0x531afd,_0x162257){return db['Team'][_0xff12('0x44')]({'where':{'id':_0x103f09[_0xff12('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xff12('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x531afd,null))['then'](function(_0x47bd09){var _0x161eb0=_['map'](_0x47bd09,'id');var _0x44a1d6=[];var _0x343297=[];var _0x1eb9e2=squel[_0xff12('0x74')]();_0x1eb9e2[_0xff12('0x75')]('tq.TeamId')[_0xff12('0x76')](_0xff12('0x77'),'tq')[_0xff12('0x78')](_0xff12('0x79'),'ut',_0xff12('0x7a'))['where'](_0xff12('0x7b'),_0x103f09[_0xff12('0x48')]['id']);for(var _0x454414=0x0;_0x454414<_0x47bd09[_0xff12('0x4a')];_0x454414+=0x1){let _0x8ae0cc=_0x47bd09[_0x454414];for(var _0x327b09=0x0;_0x327b09<_0x8ae0cc[_0xff12('0x69')][_0xff12('0x4a')];_0x327b09+=0x1){let _0x317885=_0x8ae0cc[_0xff12('0x69')][_0x327b09];var _0x595d31=_0x1eb9e2['clone']();_0x595d31['where'](_0xff12('0x7c'),_0x317885['id']);_0x343297['push'](db[_0xff12('0x6e')]['query'](_0x595d31[_0xff12('0x7d')](),{'type':db[_0xff12('0x6e')][_0xff12('0x7e')]['SELECT']})['then'](function(_0x98364d){if(_0x98364d[_0xff12('0x4a')]===0x1){return _0x317885['id'];}else{var _0x129892=_[_0xff12('0x7f')](_[_0xff12('0x2f')](_0x98364d,_0xff12('0x80')),function(_0x2a00dc){return _['includes'](_0x161eb0,_0x2a00dc);});if(_0x129892){return _0x317885['id'];}}}));}}return BPromise[_0xff12('0x81')](_0x343297)[_0xff12('0x28')](function(_0x4fc51a){_0x44a1d6=_(_0x44a1d6)[_0xff12('0x82')](_0x4fc51a)[_0xff12('0x83')]()[_0xff12('0x84')]();return db[_0xff12('0x42')][_0xff12('0x4c')]({'where':{'id':_0x103f09[_0xff12('0x48')]['id']}})[_0xff12('0x28')](function(_0x23e131){return db['sequelize'][_0xff12('0x85')](function(_0x954304){return _0x23e131[_0xff12('0x73')](_0x103f09['query']['ids'],{'transaction':_0x954304})[_0xff12('0x28')](function(){if(!_[_0xff12('0x86')](_0x44a1d6)){return _0x23e131[_0xff12('0x87')](_0x44a1d6,{'transaction':_0x954304});}})[_0xff12('0x28')](function(){_0x44a1d6[_0xff12('0x70')](function(_0xaffad7){socket[_0xff12('0x71')](_0xff12('0x88'),{'UserId':_0xaffad7,'MailQueueId':_0x23e131['id']});});});});});});})['then'](respondWithStatusCode(_0x531afd,null))[_0xff12('0x46')](handleError(_0x531afd,null));};exports[_0xff12('0x89')]=function(_0xdbb679,_0x487f90,_0x119c38){return db[_0xff12('0x42')][_0xff12('0x4c')]({'where':{'id':_0xdbb679[_0xff12('0x48')]['id']}})[_0xff12('0x28')](handleEntityNotFound(_0x487f90,null))[_0xff12('0x28')](function(_0x4d0cb0){if(_0x4d0cb0){return _0x4d0cb0['addAgents'](_0xdbb679['body'][_0xff12('0x68')],_[_0xff12('0x8a')](_0xdbb679[_0xff12('0x4e')],[_0xff12('0x68'),'id'])||{})[_0xff12('0x8b')](function(_0x89044d){for(var _0x272160=0x0;_0x272160<_0xdbb679[_0xff12('0x4e')][_0xff12('0x68')][_0xff12('0x4a')];_0x272160+=0x1){socket[_0xff12('0x71')](_0xff12('0x72'),{'UserId':Number(_0xdbb679[_0xff12('0x4e')]['ids'][_0x272160]),'MailQueueId':Number(_0xdbb679[_0xff12('0x48')]['id'])});}return _0x89044d;});}})['then'](respondWithResult(_0x487f90,null))[_0xff12('0x46')](handleError(_0x487f90,null));};exports[_0xff12('0x87')]=function(_0x4d6527,_0x5e2bf2,_0xdbb571){return db[_0xff12('0x42')][_0xff12('0x4c')]({'where':{'id':_0x4d6527[_0xff12('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e2bf2,null))['then'](function(_0x560ac8){if(_0x560ac8){return _0x560ac8[_0xff12('0x87')](_0x4d6527['query']['ids'])[_0xff12('0x28')](function(){if(_[_0xff12('0x8c')](_0x4d6527['query']['ids'])){for(var _0x4cd73d=0x0;_0x4cd73d<_0x4d6527[_0xff12('0x34')][_0xff12('0x68')][_0xff12('0x4a')];_0x4cd73d+=0x1){socket[_0xff12('0x71')](_0xff12('0x88'),{'UserId':Number(_0x4d6527['query'][_0xff12('0x68')][_0x4cd73d]),'MailQueueId':Number(_0x4d6527['params']['id'])});}}else{socket[_0xff12('0x71')](_0xff12('0x88'),{'UserId':Number(_0x4d6527['query'][_0xff12('0x68')]),'MailQueueId':Number(_0x4d6527['params']['id'])});}});}})[_0xff12('0x28')](respondWithStatusCode(_0x5e2bf2,null))['catch'](handleError(_0x5e2bf2,null));};exports[_0xff12('0x8d')]=function(_0x1e15db,_0x155e5f,_0x194503){var _0x5add7a={};var _0x1e1349={};var _0x15dfb9;var _0x4833c1;return db[_0xff12('0x42')][_0xff12('0x59')]({'where':{'id':_0x1e15db['params']['id']}})['then'](handleEntityNotFound(_0x155e5f,null))['then'](function(_0x16189a){if(_0x16189a){_0x15dfb9=_0x16189a;_0x1e1349[_0xff12('0x33')]=_[_0xff12('0x35')](db[_0xff12('0x5c')]['rawAttributes']);_0x1e1349[_0xff12('0x34')]=_[_0xff12('0x35')](_0x1e15db[_0xff12('0x34')]);_0x1e1349[_0xff12('0x36')]=_[_0xff12('0x37')](_0x1e1349[_0xff12('0x33')],_0x1e1349[_0xff12('0x34')]);_0x5add7a['attributes']=_[_0xff12('0x37')](_0x1e1349[_0xff12('0x33')],qs['fields'](_0x1e15db[_0xff12('0x34')][_0xff12('0x38')]));_0x5add7a[_0xff12('0x49')]=_0x5add7a[_0xff12('0x49')][_0xff12('0x4a')]?_0x5add7a[_0xff12('0x49')]:_0x1e1349[_0xff12('0x33')];_0x5add7a[_0xff12('0x3b')]=qs[_0xff12('0x3c')](_0x1e15db['query'][_0xff12('0x3c')]);_0x5add7a[_0xff12('0x3d')]=qs[_0xff12('0x36')](_[_0xff12('0x3e')](_0x1e15db[_0xff12('0x34')],_0x1e1349[_0xff12('0x36')]));if(_0x1e15db[_0xff12('0x34')][_0xff12('0x40')]){_0x5add7a[_0xff12('0x3d')]=_['merge'](_0x5add7a[_0xff12('0x3d')],{'$or':_[_0xff12('0x2f')](_0x5add7a[_0xff12('0x49')],function(_0x4863ca){var _0x456ef8={};_0x456ef8[_0x4863ca]={'$like':'%'+_0x1e15db[_0xff12('0x34')][_0xff12('0x40')]+'%'};return _0x456ef8;})});}_0x5add7a=_['merge']({},_0x5add7a,_0x1e15db['options']);return _0x15dfb9[_0xff12('0x8d')](_0x5add7a);}})[_0xff12('0x28')](function(_0x16b475){if(_0x16b475){_0x4833c1=_0x16b475[_0xff12('0x4a')];if(!_0x1e15db[_0xff12('0x34')]['hasOwnProperty']('nolimit')){_0x5add7a[_0xff12('0x21')]=qs[_0xff12('0x21')](_0x1e15db[_0xff12('0x34')]['limit']);_0x5add7a[_0xff12('0x1f')]=qs[_0xff12('0x1f')](_0x1e15db[_0xff12('0x34')][_0xff12('0x1f')]);}return _0x15dfb9[_0xff12('0x8d')](_0x5add7a);}})['then'](function(_0x2f0a48){if(_0x2f0a48){return _0x2f0a48?{'count':_0x4833c1,'rows':_0x2f0a48}:null;}})[_0xff12('0x28')](respondWithResult(_0x155e5f,null))[_0xff12('0x46')](handleError(_0x155e5f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a483299..84f283e 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 _0x50de=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x2e4d98,_0x579db7){var _0x4a6b4c=function(_0x5b44cf){while(--_0x5b44cf){_0x2e4d98['push'](_0x2e4d98['shift']());}};_0x4a6b4c(++_0x579db7);}(_0x50de,0xdb));var _0xe50d=function(_0x36284b,_0x2b7436){_0x36284b=_0x36284b-0x0;var _0x23c34a=_0x50de[_0x36284b];return _0x23c34a;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xe50d('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe50d('0x1')](0x0);var events={'afterCreate':_0xe50d('0x2'),'afterUpdate':_0xe50d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x39986e){return function(_0x14d939,_0x12fd41,_0x31987c){MailQueueEvents[_0xe50d('0x4')](_0x39986e+':'+_0x14d939['id'],_0x14d939);MailQueueEvents[_0xe50d('0x4')](_0x39986e,_0x14d939);_0x31987c(null);};}for(var e in events){if(events[_0xe50d('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xe50d('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xcea3=['save','remove','emit','hook','events','../../mysqldb'];(function(_0x5399a5,_0x55e960){var _0x2eab4f=function(_0x5e52b2){while(--_0x5e52b2){_0x5399a5['push'](_0x5399a5['shift']());}};_0x2eab4f(++_0x55e960);}(_0xcea3,0x1f0));var _0x3cea=function(_0x170bec,_0x3c0208){_0x170bec=_0x170bec-0x0;var _0x283a04=_0xcea3[_0x170bec];return _0x283a04;};'use strict';var EventEmitter=require(_0x3cea('0x0'));var MailQueue=require(_0x3cea('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3cea('0x2'),'afterUpdate':'update','afterDestroy':_0x3cea('0x3')};function emitEvent(_0x281179){return function(_0x36c824,_0x32bc83,_0x56c5d7){MailQueueEvents['emit'](_0x281179+':'+_0x36c824['id'],_0x36c824);MailQueueEvents[_0x3cea('0x4')](_0x281179,_0x36c824);_0x56c5d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x3cea('0x5')](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 aad2be2..cf20c19 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 _0x2f5c=['MailQueue','mail_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x20da5c,_0x4d5709){var _0x3a343d=function(_0x81ed86){while(--_0x81ed86){_0x20da5c['push'](_0x20da5c['shift']());}};_0x3a343d(++_0x4d5709);}(_0x2f5c,0xdf));var _0xc2f5=function(_0x11ecec,_0x1423de){_0x11ecec=_0x11ecec-0x0;var _0x2f4f72=_0x2f5c[_0x11ecec];return _0x2f4f72;};'use strict';var _=require(_0xc2f5('0x0'));var util=require(_0xc2f5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc2f5('0x2'));var BPromise=require(_0xc2f5('0x3'));var rp=require(_0xc2f5('0x4'));var fs=require('fs');var path=require(_0xc2f5('0x5'));var rimraf=require(_0xc2f5('0x6'));var config=require(_0xc2f5('0x7'));var attributes=require(_0xc2f5('0x8'));module[_0xc2f5('0x9')]=function(_0x5b122e,_0xdab3a5){return _0x5b122e[_0xc2f5('0xa')](_0xc2f5('0xb'),attributes,{'tableName':_0xc2f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc28c=['MailQueue','mail_queues','lodash','../../config/logger','api','moment','request-promise','path','./mailQueue.attributes','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc28c,0x7a));var _0xcc28=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xc28c[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xcc28('0x0'));var util=require('util');var logger=require(_0xcc28('0x1'))(_0xcc28('0x2'));var moment=require(_0xcc28('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc28('0x4'));var fs=require('fs');var path=require(_0xcc28('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcc28('0x6'));module[_0xcc28('0x7')]=function(_0x310947,_0x1d2ac7){return _0x310947['define'](_0xcc28('0x8'),attributes,{'tableName':_0xcc28('0x9'),'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 1977ec2..561e0dc 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 _0x3d38=['defaults','redis','localhost','./mailQueue.socket','register','request','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','find','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x246194,_0x27cdd9){var _0x4fed0e=function(_0x5a92bc){while(--_0x5a92bc){_0x246194['push'](_0x246194['shift']());}};_0x4fed0e(++_0x27cdd9);}(_0x3d38,0x1d7));var _0x83d3=function(_0x56ed51,_0x5acddc){_0x56ed51=_0x56ed51-0x0;var _0x521784=_0x3d38[_0x56ed51];return _0x521784;};'use strict';var _=require('lodash');var util=require(_0x83d3('0x0'));var moment=require('moment');var BPromise=require(_0x83d3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83d3('0x2'))['db'];var utils=require(_0x83d3('0x3'));var logger=require(_0x83d3('0x4'))(_0x83d3('0x5'));var config=require(_0x83d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x83d3('0x7')][_0x83d3('0x8')]({'port':0x232a});config['redis']=_[_0x83d3('0x9')](config[_0x83d3('0xa')],{'host':_0x83d3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x83d3('0xc'))[_0x83d3('0xd')](socket);function respondWithRpcPromise(_0x2afd2f,_0x3d9cc8,_0x5f01f4){return new BPromise(function(_0x4a7bca,_0x1dd3da){return client[_0x83d3('0xe')](_0x2afd2f,_0x5f01f4)[_0x83d3('0xf')](function(_0x59e877){logger['info']('MailQueue,\x20%s,\x20%s',_0x3d9cc8,_0x83d3('0x10'));logger[_0x83d3('0x11')](_0x83d3('0x12'),_0x3d9cc8,'request\x20sent',JSON[_0x83d3('0x13')](_0x59e877));if(_0x59e877[_0x83d3('0x14')]){if(_0x59e877[_0x83d3('0x14')][_0x83d3('0x15')]===0x1f4){logger[_0x83d3('0x14')](_0x83d3('0x16'),_0x3d9cc8,_0x59e877['error'][_0x83d3('0x17')]);return _0x1dd3da(_0x59e877[_0x83d3('0x14')][_0x83d3('0x17')]);}logger[_0x83d3('0x14')]('MailQueue,\x20%s,\x20%s',_0x3d9cc8,_0x59e877[_0x83d3('0x14')][_0x83d3('0x17')]);return _0x4a7bca(_0x59e877[_0x83d3('0x14')][_0x83d3('0x17')]);}else{logger[_0x83d3('0x18')](_0x83d3('0x16'),_0x3d9cc8,_0x83d3('0x10'));_0x4a7bca(_0x59e877[_0x83d3('0x19')][_0x83d3('0x17')]);}})[_0x83d3('0x1a')](function(_0x59c135){logger[_0x83d3('0x14')](_0x83d3('0x16'),_0x3d9cc8,_0x59c135);_0x1dd3da(_0x59c135);});});}exports[_0x83d3('0x1b')]=function(_0x257bd4){var _0x198e6c=this;return new Promise(function(_0x1a7fb9,_0x1375b2){return db['MailQueue'][_0x83d3('0x1c')]({'raw':_0x257bd4[_0x83d3('0x1d')]?_0x257bd4[_0x83d3('0x1d')][_0x83d3('0x1e')]===undefined?!![]:![]:!![],'where':_0x257bd4[_0x83d3('0x1d')]?_0x257bd4[_0x83d3('0x1d')][_0x83d3('0x1f')]||null:null,'attributes':_0x257bd4[_0x83d3('0x1d')]?_0x257bd4[_0x83d3('0x1d')][_0x83d3('0x20')]||null:null,'limit':_0x257bd4[_0x83d3('0x1d')]?_0x257bd4[_0x83d3('0x1d')][_0x83d3('0x21')]||null:null,'include':_0x257bd4[_0x83d3('0x1d')]?_0x257bd4[_0x83d3('0x1d')][_0x83d3('0x22')]?_[_0x83d3('0x23')](_0x257bd4['options'][_0x83d3('0x22')],function(_0x1ec74b){return{'model':db[_0x1ec74b[_0x83d3('0x24')]],'as':_0x1ec74b['as'],'attributes':_0x1ec74b[_0x83d3('0x20')],'include':_0x1ec74b['include']?_['map'](_0x1ec74b[_0x83d3('0x22')],function(_0x2d8950){return{'model':db[_0x2d8950[_0x83d3('0x24')]],'as':_0x2d8950['as'],'attributes':_0x2d8950['attributes'],'include':_0x2d8950[_0x83d3('0x22')]?_[_0x83d3('0x23')](_0x2d8950['include'],function(_0x310bad){return{'model':db[_0x310bad[_0x83d3('0x24')]],'as':_0x310bad['as'],'attributes':_0x310bad['attributes']};}):[]};}):[]};}):[]:[]})[_0x83d3('0xf')](function(_0x3337dc){logger['info'](_0x83d3('0x1b'),_0x257bd4);logger[_0x83d3('0x11')](_0x83d3('0x1b'),_0x257bd4,JSON[_0x83d3('0x13')](_0x3337dc));_0x1a7fb9(_0x3337dc);})[_0x83d3('0x1a')](function(_0xc82c5e){logger[_0x83d3('0x14')](_0x83d3('0x1b'),_0xc82c5e[_0x83d3('0x17')],_0x257bd4);_0x1375b2(_0x198e6c[_0x83d3('0x14')](0x1f4,_0xc82c5e[_0x83d3('0x17')]));});});};exports[_0x83d3('0x25')]=function(_0x6df28c){var _0x15ced6=this;return new Promise(function(_0x1f3727,_0xd67c0){return db[_0x83d3('0x26')][_0x83d3('0x27')]({'raw':_0x6df28c[_0x83d3('0x1d')]?_0x6df28c[_0x83d3('0x1d')][_0x83d3('0x1e')]===undefined?!![]:![]:!![],'where':_0x6df28c['options']?_0x6df28c[_0x83d3('0x1d')][_0x83d3('0x1f')]||null:null,'attributes':_0x6df28c['options']?_0x6df28c[_0x83d3('0x1d')]['attributes']||null:null,'include':_0x6df28c['options']?_0x6df28c[_0x83d3('0x1d')][_0x83d3('0x22')]?_[_0x83d3('0x23')](_0x6df28c[_0x83d3('0x1d')]['include'],function(_0x45444f){return{'model':db[_0x45444f[_0x83d3('0x24')]],'as':_0x45444f['as'],'attributes':_0x45444f['attributes'],'include':_0x45444f[_0x83d3('0x22')]?_[_0x83d3('0x23')](_0x45444f['include'],function(_0x17f417){return{'model':db[_0x17f417[_0x83d3('0x24')]],'as':_0x17f417['as'],'attributes':_0x17f417[_0x83d3('0x20')],'include':_0x17f417[_0x83d3('0x22')]?_[_0x83d3('0x23')](_0x17f417['include'],function(_0x3321a8){return{'model':db[_0x3321a8['model']],'as':_0x3321a8['as'],'attributes':_0x3321a8[_0x83d3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11a333){logger['info'](_0x83d3('0x25'),_0x6df28c);logger[_0x83d3('0x11')](_0x83d3('0x25'),_0x6df28c,JSON[_0x83d3('0x13')](_0x11a333));_0x1f3727(_0x11a333);})[_0x83d3('0x1a')](function(_0x33e9cf){logger[_0x83d3('0x14')](_0x83d3('0x25'),_0x33e9cf[_0x83d3('0x17')],_0x6df28c);_0xd67c0(_0x15ced6[_0x83d3('0x14')](0x1f4,_0x33e9cf[_0x83d3('0x17')]));});});}; \ No newline at end of file +var _0xf00e=['request','then','debug','request\x20sent','error','code','MailQueue,\x20%s,\x20%s','message','info','result','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowMailQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x11cf82,_0xc3ddd){var _0x1266e9=function(_0x3c0f2b){while(--_0x3c0f2b){_0x11cf82['push'](_0x11cf82['shift']());}};_0x1266e9(++_0xc3ddd);}(_0xf00e,0x12f));var _0xef00=function(_0x462089,_0x34ae31){_0x462089=_0x462089-0x0;var _0x4f4863=_0xf00e[_0x462089];return _0x4f4863;};'use strict';var _=require(_0xef00('0x0'));var util=require(_0xef00('0x1'));var moment=require(_0xef00('0x2'));var BPromise=require(_0xef00('0x3'));var rs=require(_0xef00('0x4'));var fs=require('fs');var Redis=require(_0xef00('0x5'));var db=require(_0xef00('0x6'))['db'];var utils=require(_0xef00('0x7'));var logger=require(_0xef00('0x8'))(_0xef00('0x9'));var config=require(_0xef00('0xa'));var jayson=require(_0xef00('0xb'));var client=jayson[_0xef00('0xc')][_0xef00('0xd')]({'port':0x232a});config[_0xef00('0xe')]=_[_0xef00('0xf')](config[_0xef00('0xe')],{'host':_0xef00('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef00('0xe')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x173074,_0x4f8db3,_0x4f01bc){return new BPromise(function(_0xc380a6,_0x506a38){return client[_0xef00('0x11')](_0x173074,_0x4f01bc)[_0xef00('0x12')](function(_0x5dba5b){logger['info']('MailQueue,\x20%s,\x20%s',_0x4f8db3,'request\x20sent');logger[_0xef00('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4f8db3,_0xef00('0x14'),JSON['stringify'](_0x5dba5b));if(_0x5dba5b[_0xef00('0x15')]){if(_0x5dba5b[_0xef00('0x15')][_0xef00('0x16')]===0x1f4){logger[_0xef00('0x15')](_0xef00('0x17'),_0x4f8db3,_0x5dba5b['error'][_0xef00('0x18')]);return _0x506a38(_0x5dba5b[_0xef00('0x15')]['message']);}logger[_0xef00('0x15')](_0xef00('0x17'),_0x4f8db3,_0x5dba5b[_0xef00('0x15')][_0xef00('0x18')]);return _0xc380a6(_0x5dba5b['error'][_0xef00('0x18')]);}else{logger[_0xef00('0x19')]('MailQueue,\x20%s,\x20%s',_0x4f8db3,_0xef00('0x14'));_0xc380a6(_0x5dba5b[_0xef00('0x1a')][_0xef00('0x18')]);}})['catch'](function(_0x5d66dd){logger['error'](_0xef00('0x17'),_0x4f8db3,_0x5d66dd);_0x506a38(_0x5d66dd);});});}exports[_0xef00('0x1b')]=function(_0x4f39d7){var _0x3185dd=this;return new Promise(function(_0x3641c2,_0x4e4157){return db['MailQueue'][_0xef00('0x1c')]({'raw':_0x4f39d7[_0xef00('0x1d')]?_0x4f39d7['options'][_0xef00('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f39d7[_0xef00('0x1d')]?_0x4f39d7['options'][_0xef00('0x1f')]||null:null,'attributes':_0x4f39d7['options']?_0x4f39d7['options'][_0xef00('0x20')]||null:null,'limit':_0x4f39d7['options']?_0x4f39d7[_0xef00('0x1d')][_0xef00('0x21')]||null:null,'include':_0x4f39d7[_0xef00('0x1d')]?_0x4f39d7[_0xef00('0x1d')]['include']?_[_0xef00('0x22')](_0x4f39d7[_0xef00('0x1d')][_0xef00('0x23')],function(_0x595c05){return{'model':db[_0x595c05[_0xef00('0x24')]],'as':_0x595c05['as'],'attributes':_0x595c05[_0xef00('0x20')],'include':_0x595c05[_0xef00('0x23')]?_[_0xef00('0x22')](_0x595c05[_0xef00('0x23')],function(_0x441584){return{'model':db[_0x441584[_0xef00('0x24')]],'as':_0x441584['as'],'attributes':_0x441584['attributes'],'include':_0x441584['include']?_[_0xef00('0x22')](_0x441584[_0xef00('0x23')],function(_0x17b633){return{'model':db[_0x17b633['model']],'as':_0x17b633['as'],'attributes':_0x17b633[_0xef00('0x20')]};}):[]};}):[]};}):[]:[]})[_0xef00('0x12')](function(_0xfc7621){logger[_0xef00('0x19')](_0xef00('0x1b'),_0x4f39d7);logger['debug'](_0xef00('0x1b'),_0x4f39d7,JSON[_0xef00('0x25')](_0xfc7621));_0x3641c2(_0xfc7621);})['catch'](function(_0x128dd9){logger[_0xef00('0x15')](_0xef00('0x1b'),_0x128dd9[_0xef00('0x18')],_0x4f39d7);_0x4e4157(_0x3185dd[_0xef00('0x15')](0x1f4,_0x128dd9[_0xef00('0x18')]));});});};exports[_0xef00('0x26')]=function(_0x5d802a){var _0x1557bd=this;return new Promise(function(_0x3c2504,_0x13d68b){return db['MailQueue']['find']({'raw':_0x5d802a[_0xef00('0x1d')]?_0x5d802a['options'][_0xef00('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d802a[_0xef00('0x1d')]?_0x5d802a[_0xef00('0x1d')][_0xef00('0x1f')]||null:null,'attributes':_0x5d802a[_0xef00('0x1d')]?_0x5d802a['options'][_0xef00('0x20')]||null:null,'include':_0x5d802a['options']?_0x5d802a[_0xef00('0x1d')][_0xef00('0x23')]?_[_0xef00('0x22')](_0x5d802a[_0xef00('0x1d')][_0xef00('0x23')],function(_0x232dcf){return{'model':db[_0x232dcf['model']],'as':_0x232dcf['as'],'attributes':_0x232dcf[_0xef00('0x20')],'include':_0x232dcf[_0xef00('0x23')]?_[_0xef00('0x22')](_0x232dcf['include'],function(_0x2089ed){return{'model':db[_0x2089ed[_0xef00('0x24')]],'as':_0x2089ed['as'],'attributes':_0x2089ed[_0xef00('0x20')],'include':_0x2089ed['include']?_['map'](_0x2089ed['include'],function(_0x5b00d2){return{'model':db[_0x5b00d2[_0xef00('0x24')]],'as':_0x5b00d2['as'],'attributes':_0x5b00d2[_0xef00('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54259f){logger[_0xef00('0x19')](_0xef00('0x26'),_0x5d802a);logger[_0xef00('0x13')](_0xef00('0x26'),_0x5d802a,JSON[_0xef00('0x25')](_0x54259f));_0x3c2504(_0x54259f);})[_0xef00('0x27')](function(_0x2a3c10){logger[_0xef00('0x15')](_0xef00('0x26'),_0x2a3c10['message'],_0x5d802a);_0x13d68b(_0x1557bd[_0xef00('0x15')](0x1f4,_0x2a3c10[_0xef00('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3113832..6a2e11e 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 _0x95c3=['mailQueue:','remove','update','emit','removeListener','length'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x95c3,0x6d));var _0x395c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x95c3[_0x3b380d];return _0x54502b;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x395c('0x0'),_0x395c('0x1')];function createListener(_0x4dbd4c,_0x556ed5){return function(_0xef2274){_0x556ed5[_0x395c('0x2')](_0x4dbd4c,_0xef2274);};}function removeListener(_0x21e41a,_0xb8452d){return function(){MailQueueEvents[_0x395c('0x3')](_0x21e41a,_0xb8452d);};}exports['register']=function(_0x1df05d){for(var _0x3b952c=0x0,_0x3d2d61=events[_0x395c('0x4')];_0x3b952c<_0x3d2d61;_0x3b952c++){var _0x8422f=events[_0x3b952c];var _0x1fdb0e=createListener(_0x395c('0x5')+_0x8422f,_0x1df05d);MailQueueEvents['on'](_0x8422f,_0x1fdb0e);}}; \ No newline at end of file +var _0x0608=['emit','length','./mailQueue.events','save','remove','update'];(function(_0x5d5972,_0x3c631f){var _0x3076c1=function(_0x32fddd){while(--_0x32fddd){_0x5d5972['push'](_0x5d5972['shift']());}};_0x3076c1(++_0x3c631f);}(_0x0608,0x1d6));var _0x8060=function(_0xa31d6a,_0xea335b){_0xa31d6a=_0xa31d6a-0x0;var _0x435e64=_0x0608[_0xa31d6a];return _0x435e64;};'use strict';var MailQueueEvents=require(_0x8060('0x0'));var events=[_0x8060('0x1'),_0x8060('0x2'),_0x8060('0x3')];function createListener(_0x2359cb,_0x4cbc1e){return function(_0x52ce31){_0x4cbc1e[_0x8060('0x4')](_0x2359cb,_0x52ce31);};}function removeListener(_0x1a7e2a,_0x39fedb){return function(){MailQueueEvents['removeListener'](_0x1a7e2a,_0x39fedb);};}exports['register']=function(_0x449870){for(var _0x2fe793=0x0,_0x3a6ae2=events[_0x8060('0x5')];_0x2fe793<_0x3a6ae2;_0x2fe793++){var _0x50a850=events[_0x2fe793];var _0x1a8184=createListener('mailQueue:'+_0x50a850,_0x449870);MailQueueEvents['on'](_0x50a850,_0x1a8184);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index e26c7f4..6d68e59 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 _0x5fcd=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put','destroy','exports','multer','util'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x5fcd,0x141));var _0xd5fc=function(_0x19309c,_0x143658){_0x19309c=_0x19309c-0x0;var _0x936eb=_0x5fcd[_0x19309c];return _0x936eb;};'use strict';var multer=require(_0xd5fc('0x0'));var util=require(_0xd5fc('0x1'));var path=require(_0xd5fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5fc('0x3'));var router=express['Router']();var fs_extra=require(_0xd5fc('0x4'));var auth=require(_0xd5fc('0x5'));var interaction=require(_0xd5fc('0x6'));var config=require('../../config/environment');var controller=require(_0xd5fc('0x7'));router[_0xd5fc('0x8')]('/',auth[_0xd5fc('0x9')](),controller['index']);router[_0xd5fc('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd5fc('0xa')]);router[_0xd5fc('0x8')](_0xd5fc('0xb'),auth[_0xd5fc('0x9')](),controller['show']);router[_0xd5fc('0xc')]('/',auth[_0xd5fc('0x9')](),controller[_0xd5fc('0xd')]);router[_0xd5fc('0xe')](_0xd5fc('0xb'),auth[_0xd5fc('0x9')](),controller['update']);router['delete'](_0xd5fc('0xb'),auth['isAuthenticated'](),controller[_0xd5fc('0xf')]);module[_0xd5fc('0x10')]=router; \ No newline at end of file +var _0x38e4=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x9e5fc6,_0x406f25){var _0x3e9c4a=function(_0x5e3a7e){while(--_0x5e3a7e){_0x9e5fc6['push'](_0x9e5fc6['shift']());}};_0x3e9c4a(++_0x406f25);}(_0x38e4,0x160));var _0x438e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x38e4[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x438e('0x0'));var path=require('path');var timeout=require(_0x438e('0x1'));var express=require(_0x438e('0x2'));var router=express[_0x438e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x438e('0x4'));var config=require(_0x438e('0x5'));var controller=require(_0x438e('0x6'));router[_0x438e('0x7')]('/',auth[_0x438e('0x8')](),controller[_0x438e('0x9')]);router[_0x438e('0x7')]('/describe',auth[_0x438e('0x8')](),controller['describe']);router['get'](_0x438e('0xa'),auth['isAuthenticated'](),controller[_0x438e('0xb')]);router[_0x438e('0xc')]('/',auth[_0x438e('0x8')](),controller[_0x438e('0xd')]);router[_0x438e('0xe')]('/:id',auth[_0x438e('0x8')](),controller[_0x438e('0xf')]);router[_0x438e('0x10')](_0x438e('0xa'),auth[_0x438e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b060cab..a11ece6 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 _0x5058=['STRING','DATE','moment','sequelize','exports'];(function(_0x1a0b99,_0x257b53){var _0x5bc094=function(_0x1dd0d5){while(--_0x1dd0d5){_0x1a0b99['push'](_0x1a0b99['shift']());}};_0x5bc094(++_0x257b53);}(_0x5058,0xde));var _0x8505=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x5058[_0x210603];return _0x1bcb7d;};'use strict';var moment=require(_0x8505('0x0'));var Sequelize=require(_0x8505('0x1'));module[_0x8505('0x2')]={'uniqueid':{'type':Sequelize[_0x8505('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8505('0x3')]},'joinAt':{'type':Sequelize[_0x8505('0x4')]},'leaveAt':{'type':Sequelize[_0x8505('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8505('0x3')]}}; \ No newline at end of file +var _0xf318=['sequelize','exports','DATE','STRING','moment'];(function(_0xf9bc18,_0x5a4721){var _0x2b5d92=function(_0x2e932e){while(--_0x2e932e){_0xf9bc18['push'](_0xf9bc18['shift']());}};_0x2b5d92(++_0x5a4721);}(_0xf318,0x13a));var _0x8f31=function(_0xe7edce,_0x1c1f04){_0xe7edce=_0xe7edce-0x0;var _0x28fd99=_0xf318[_0xe7edce];return _0x28fd99;};'use strict';var moment=require(_0x8f31('0x0'));var Sequelize=require(_0x8f31('0x1'));module[_0x8f31('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8f31('0x3')]},'leaveAt':{'type':Sequelize[_0x8f31('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8f31('0x3')]},'reason':{'type':Sequelize[_0x8f31('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f20b0ff..f8de174 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 _0x3e24=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','eml-format'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x3e24,0x167));var _0x43e2=function(_0x51bac9,_0x1675a7){_0x51bac9=_0x51bac9-0x0;var _0x2c6371=_0x3e24[_0x51bac9];return _0x2c6371;};'use strict';var emlformat=require(_0x43e2('0x0'));var rimraf=require(_0x43e2('0x1'));var zipdir=require(_0x43e2('0x2'));var jsonpatch=require(_0x43e2('0x3'));var rp=require(_0x43e2('0x4'));var moment=require('moment');var BPromise=require(_0x43e2('0x5'));var Mustache=require(_0x43e2('0x6'));var util=require('util');var path=require(_0x43e2('0x7'));var sox=require(_0x43e2('0x8'));var csv=require(_0x43e2('0x9'));var ejs=require(_0x43e2('0xa'));var fs=require('fs');var fs_extra=require(_0x43e2('0xb'));var _=require(_0x43e2('0xc'));var squel=require(_0x43e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43e2('0xe'));var deskjs=require(_0x43e2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43e2('0x10'));var Papa=require(_0x43e2('0x11'));var Redis=require('ioredis');var authService=require(_0x43e2('0x12'));var qs=require(_0x43e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43e2('0x15'));var licenseUtil=require(_0x43e2('0x16'));var db=require(_0x43e2('0x17'))['db'];function respondWithStatusCode(_0x44781a,_0x43ba14){_0x43ba14=_0x43ba14||0xcc;return function(_0x68e82d){if(_0x68e82d){return _0x44781a[_0x43e2('0x18')](_0x43ba14);}return _0x44781a[_0x43e2('0x19')](_0x43ba14)[_0x43e2('0x1a')]();};}function respondWithResult(_0x218ae7,_0x377097){_0x377097=_0x377097||0xc8;return function(_0x3ccccd){if(_0x3ccccd){return _0x218ae7['status'](_0x377097)[_0x43e2('0x1b')](_0x3ccccd);}};}function respondWithFilteredResult(_0x40fb7b,_0xb929b5){return function(_0x2a0fb0){if(_0x2a0fb0){var _0x5cea01=typeof _0xb929b5['offset']===_0x43e2('0x1c')&&typeof _0xb929b5[_0x43e2('0x1d')]===_0x43e2('0x1c');var _0x3a27eb=_0x2a0fb0[_0x43e2('0x1e')];var _0x1b7cde=_0x5cea01?0x0:_0xb929b5[_0x43e2('0x1f')];var _0x15ecb5=_0x5cea01?_0x2a0fb0[_0x43e2('0x1e')]:_0xb929b5[_0x43e2('0x1f')]+_0xb929b5['limit'];var _0x3ee34c;if(_0x15ecb5>=_0x3a27eb){_0x15ecb5=_0x3a27eb;_0x3ee34c=0xc8;}else{_0x3ee34c=0xce;}_0x40fb7b[_0x43e2('0x19')](_0x3ee34c);return _0x40fb7b['set'](_0x43e2('0x20'),_0x1b7cde+'-'+_0x15ecb5+'/'+_0x3a27eb)['json'](_0x2a0fb0);}return null;};}function patchUpdates(_0x3bc2ce){return function(_0x13610f){try{jsonpatch[_0x43e2('0x21')](_0x13610f,_0x3bc2ce,!![]);}catch(_0x23825c){return BPromise[_0x43e2('0x22')](_0x23825c);}return _0x13610f['save']();};}function saveUpdates(_0x3b0357,_0x12d842){return function(_0x272934){if(_0x272934){return _0x272934['update'](_0x3b0357)[_0x43e2('0x23')](function(_0x32f048){return _0x32f048;});}return null;};}function removeEntity(_0x43078f,_0x11b285){return function(_0x4f20e6){if(_0x4f20e6){return _0x4f20e6[_0x43e2('0x24')]()[_0x43e2('0x23')](function(){_0x43078f[_0x43e2('0x19')](0xcc)[_0x43e2('0x1a')]();});}};}function handleEntityNotFound(_0x178223,_0x2a593e){return function(_0x3ca16b){if(!_0x3ca16b){_0x178223[_0x43e2('0x18')](0x194);}return _0x3ca16b;};}function handleError(_0xd29b7b,_0x1ec68e){_0x1ec68e=_0x1ec68e||0x1f4;return function(_0x1ea844){logger[_0x43e2('0x25')](_0x1ea844['stack']);if(_0x1ea844[_0x43e2('0x26')]){delete _0x1ea844[_0x43e2('0x26')];}_0xd29b7b['status'](_0x1ec68e)[_0x43e2('0x27')](_0x1ea844);};}exports[_0x43e2('0x28')]=function(_0x2dffa2,_0x404483){var _0x3fd232={},_0x5a896b={},_0x42f495={'count':0x0,'rows':[]};var _0xd1b43a=_[_0x43e2('0x29')](db[_0x43e2('0x2a')][_0x43e2('0x2b')],function(_0x30bdcb){return{'name':_0x30bdcb['fieldName'],'type':_0x30bdcb['type'][_0x43e2('0x2c')]};});_0x5a896b[_0x43e2('0x2d')]=_[_0x43e2('0x29')](_0xd1b43a,_0x43e2('0x26'));_0x5a896b[_0x43e2('0x2e')]=_['keys'](_0x2dffa2[_0x43e2('0x2e')]);_0x5a896b[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x2d')],_0x5a896b[_0x43e2('0x2e')]);_0x3fd232[_0x43e2('0x31')]=_[_0x43e2('0x30')](_0x5a896b['model'],qs['fields'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x3fd232['attributes']=_0x3fd232[_0x43e2('0x31')][_0x43e2('0x33')]?_0x3fd232['attributes']:_0x5a896b[_0x43e2('0x2d')];if(!_0x2dffa2['query']['hasOwnProperty']('nolimit')){_0x3fd232[_0x43e2('0x1d')]=qs['limit'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1d')]);_0x3fd232[_0x43e2('0x1f')]=qs[_0x43e2('0x1f')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1f')]);}_0x3fd232[_0x43e2('0x34')]=qs[_0x43e2('0x35')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x35')]);_0x3fd232[_0x43e2('0x36')]=qs[_0x43e2('0x2f')](_[_0x43e2('0x37')](_0x2dffa2[_0x43e2('0x2e')],_0x5a896b[_0x43e2('0x2f')]),_0xd1b43a);if(_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]){_0x3fd232['where']=_['merge'](_0x3fd232['where'],{'$or':_[_0x43e2('0x29')](_0xd1b43a,function(_0x13af7f){if(_0x13af7f['type']!=='VIRTUAL'){var _0x2b5fce={};_0x2b5fce[_0x13af7f[_0x43e2('0x26')]]={'$like':'%'+_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]+'%'};return _0x2b5fce;}})});}_0x3fd232=_[_0x43e2('0x39')]({},_0x3fd232,_0x2dffa2[_0x43e2('0x3a')]);var _0x2afcdd={'where':_0x3fd232[_0x43e2('0x36')]};return db[_0x43e2('0x2a')][_0x43e2('0x1e')](_0x2afcdd)[_0x43e2('0x23')](function(_0x257de9){_0x42f495[_0x43e2('0x1e')]=_0x257de9;if(_0x2dffa2[_0x43e2('0x2e')]['includeAll']){_0x3fd232[_0x43e2('0x3b')]=[{'all':!![]}];}return db['MailQueueReport'][_0x43e2('0x3c')](_0x3fd232);})['then'](function(_0x19ce1b){_0x42f495[_0x43e2('0x3d')]=_0x19ce1b;return _0x42f495;})[_0x43e2('0x23')](respondWithFilteredResult(_0x404483,_0x3fd232))['catch'](handleError(_0x404483,null));};exports[_0x43e2('0x3e')]=function(_0x5ca5d0,_0x1ba4cf){var _0x36f94a={'raw':!![],'where':{'id':_0x5ca5d0[_0x43e2('0x3f')]['id']}},_0x34f2b5={};_0x34f2b5['model']=_['keys'](db[_0x43e2('0x2a')][_0x43e2('0x2b')]);_0x34f2b5[_0x43e2('0x2e')]=_[_0x43e2('0x40')](_0x5ca5d0['query']);_0x34f2b5[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x34f2b5[_0x43e2('0x2d')],_0x34f2b5[_0x43e2('0x2e')]);_0x36f94a[_0x43e2('0x31')]=_['intersection'](_0x34f2b5[_0x43e2('0x2d')],qs['fields'](_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x36f94a['attributes']=_0x36f94a[_0x43e2('0x31')]['length']?_0x36f94a['attributes']:_0x34f2b5[_0x43e2('0x2d')];if(_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x41')]){_0x36f94a[_0x43e2('0x3b')]=[{'all':!![]}];}_0x36f94a=_[_0x43e2('0x39')]({},_0x36f94a,_0x5ca5d0['options']);return db[_0x43e2('0x2a')][_0x43e2('0x42')](_0x36f94a)[_0x43e2('0x23')](handleEntityNotFound(_0x1ba4cf,null))[_0x43e2('0x23')](respondWithResult(_0x1ba4cf,null))[_0x43e2('0x43')](handleError(_0x1ba4cf,null));};exports[_0x43e2('0x44')]=function(_0x29a9ef,_0x2462db){return db['MailQueueReport'][_0x43e2('0x44')](_0x29a9ef[_0x43e2('0x45')],{})['then'](respondWithResult(_0x2462db,0xc9))[_0x43e2('0x43')](handleError(_0x2462db,null));};exports[_0x43e2('0x46')]=function(_0x466f65,_0x8bc721){if(_0x466f65['body']['id']){delete _0x466f65[_0x43e2('0x45')]['id'];}return db[_0x43e2('0x2a')][_0x43e2('0x42')]({'where':{'id':_0x466f65[_0x43e2('0x3f')]['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x8bc721,null))['then'](saveUpdates(_0x466f65['body'],null))[_0x43e2('0x23')](respondWithResult(_0x8bc721,null))[_0x43e2('0x43')](handleError(_0x8bc721,null));};exports['destroy']=function(_0x2a40a5,_0x28a101){return db[_0x43e2('0x2a')]['find']({'where':{'id':_0x2a40a5['params']['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x28a101,null))[_0x43e2('0x23')](removeEntity(_0x28a101,null))[_0x43e2('0x43')](handleError(_0x28a101,null));};exports[_0x43e2('0x47')]=function(_0x1a9283,_0x278730){return db[_0x43e2('0x2a')][_0x43e2('0x47')]()[_0x43e2('0x23')](respondWithResult(_0x278730,null))['catch'](handleError(_0x278730,null));}; \ No newline at end of file +var _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','MailQueueReport','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1623,0xab));var _0x3162=function(_0x2a8b71,_0x2ec0b0){_0x2a8b71=_0x2a8b71-0x0;var _0x49f14a=_0x1623[_0x2a8b71];return _0x49f14a;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['MailQueueReport'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['MailQueueReport'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3223c35..506ba35 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 _0x5351=['MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define'];(function(_0x45306f,_0x3f975c){var _0x1faeb5=function(_0x3d4429){while(--_0x3d4429){_0x45306f['push'](_0x45306f['shift']());}};_0x1faeb5(++_0x3f975c);}(_0x5351,0x1d1));var _0x1535=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5351[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x1535('0x0'));var logger=require(_0x1535('0x1'))(_0x1535('0x2'));var moment=require(_0x1535('0x3'));var BPromise=require(_0x1535('0x4'));var rp=require(_0x1535('0x5'));var fs=require('fs');var path=require(_0x1535('0x6'));var rimraf=require(_0x1535('0x7'));var config=require(_0x1535('0x8'));var attributes=require(_0x1535('0x9'));module['exports']=function(_0x5a4c45,_0x40c426){return _0x5a4c45[_0x1535('0xa')](_0x1535('0xb'),attributes,{'tableName':_0x1535('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1535('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd463=['api','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x5f415d,_0x39b258){var _0x3ac7a6=function(_0x314dc5){while(--_0x314dc5){_0x5f415d['push'](_0x5f415d['shift']());}};_0x3ac7a6(++_0x39b258);}(_0xd463,0x11b));var _0x3d46=function(_0x4259a3,_0x2f9e82){_0x4259a3=_0x4259a3-0x0;var _0x5dfed4=_0xd463[_0x4259a3];return _0x5dfed4;};'use strict';var _=require(_0x3d46('0x0'));var util=require(_0x3d46('0x1'));var logger=require(_0x3d46('0x2'))(_0x3d46('0x3'));var moment=require('moment');var BPromise=require(_0x3d46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d46('0x5'));var rimraf=require(_0x3d46('0x6'));var config=require(_0x3d46('0x7'));var attributes=require(_0x3d46('0x8'));module[_0x3d46('0x9')]=function(_0x269101,_0x2e8f8b){return _0x269101[_0x3d46('0xa')](_0x3d46('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3d46('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 37f6f24..cdff831 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c1883,_0x12111a){var _0x1624ae=function(_0x26b237){while(--_0x26b237){_0x3c1883['push'](_0x3c1883['shift']());}};_0x1624ae(++_0x12111a);}(_0x326f,0xd1));var _0xf326=function(_0x3b85a6,_0x3e021d){_0x3b85a6=_0x3b85a6-0x0;var _0x37a2b8=_0x326f[_0x3b85a6];return _0x37a2b8;};'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')]('MailQueueReport,\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')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x30aaf8,_0x45433d){var _0x5d735f=function(_0x5a6d6a){while(--_0x5a6d6a){_0x30aaf8['push'](_0x30aaf8['shift']());}};_0x5d735f(++_0x45433d);}(_0xdb28,0x106));var _0x8db2=function(_0x3468a6,_0x530df9){_0x3468a6=_0x3468a6-0x0;var _0x418c8f=_0xdb28[_0x3468a6];return _0x418c8f;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b2fc538..dee2ea0 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5e857d,_0x35fde6){var _0xf634b7=function(_0xf902c9){while(--_0xf902c9){_0x5e857d['push'](_0x5e857d['shift']());}};_0xf634b7(++_0x35fde6);}(_0x70e0,0x17b));var _0x070e=function(_0x294a7c,_0x555902){_0x294a7c=_0x294a7c-0x0;var _0x324da2=_0x70e0[_0x294a7c];return _0x324da2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x577f85,_0x130564){var _0x232a60=function(_0x23e441){while(--_0x23e441){_0x577f85['push'](_0x577f85['shift']());}};_0x232a60(++_0x130564);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ead8482..7349d0a 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 _0x2504=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2504,0xee));var _0x4250=function(_0x57597a,_0x56d8a1){_0x57597a=_0x57597a-0x0;var _0x3c0724=_0x2504[_0x57597a];return _0x3c0724;};'use strict';var Sequelize=require(_0x4250('0x0'));module[_0x4250('0x1')]={'description':{'type':Sequelize[_0x4250('0x2')]},'host':{'type':Sequelize[_0x4250('0x2')]},'authentication':{'type':Sequelize[_0x4250('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4250('0x2')]},'password':{'type':Sequelize[_0x4250('0x2')]},'port':{'type':Sequelize[_0x4250('0x4')]},'tls':{'type':Sequelize[_0x4250('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4250('0x2')],'defaultValue':_0x4250('0x5')},'connTimeout':{'type':Sequelize[_0x4250('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x4250('0x2')]}}; \ No newline at end of file +var _0xad95=['STRING','sequelize','exports'];(function(_0x2f31b1,_0x17daa8){var _0x448988=function(_0x540f6b){while(--_0x540f6b){_0x2f31b1['push'](_0x2f31b1['shift']());}};_0x448988(++_0x17daa8);}(_0xad95,0x70));var _0x5ad9=function(_0x304809,_0x30c653){_0x304809=_0x304809-0x0;var _0x236e69=_0xad95[_0x304809];return _0x236e69;};'use strict';var Sequelize=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]={'description':{'type':Sequelize[_0x5ad9('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x5ad9('0x2')]},'password':{'type':Sequelize[_0x5ad9('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5ad9('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e57efae..1a060d0 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 _0x5d5b=['define','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x5d5b,0x152));var _0xb5d5=function(_0x2e5fa7,_0x458da0){_0x2e5fa7=_0x2e5fa7-0x0;var _0x1eeb01=_0x5d5b[_0x2e5fa7];return _0x1eeb01;};'use strict';var _=require(_0xb5d5('0x0'));var util=require(_0xb5d5('0x1'));var logger=require(_0xb5d5('0x2'))('api');var moment=require(_0xb5d5('0x3'));var BPromise=require(_0xb5d5('0x4'));var rp=require(_0xb5d5('0x5'));var fs=require('fs');var path=require(_0xb5d5('0x6'));var rimraf=require(_0xb5d5('0x7'));var config=require('../../config/environment');var attributes=require(_0xb5d5('0x8'));module[_0xb5d5('0x9')]=function(_0x16d4b7,_0x38d5c2){return _0x16d4b7[_0xb5d5('0xa')]('MailServerIn',attributes,{'tableName':_0xb5d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f2=['define','MailServerIn','../../config/logger','api','path','./mailServerIn.attributes','exports'];(function(_0x1dd2cc,_0x36ddfe){var _0x305d8e=function(_0x27df09){while(--_0x27df09){_0x1dd2cc['push'](_0x1dd2cc['shift']());}};_0x305d8e(++_0x36ddfe);}(_0x35f2,0x1c9));var _0x235f=function(_0x3c3df6,_0x6c7759){_0x3c3df6=_0x3c3df6-0x0;var _0x413267=_0x35f2[_0x3c3df6];return _0x413267;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x235f('0x0'))(_0x235f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x235f('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x235f('0x3'));module[_0x235f('0x4')]=function(_0x1f709c,_0x42d69f){return _0x1f709c[_0x235f('0x5')](_0x235f('0x6'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 411687f..ad40848 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 _0x3512=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','map','include','model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x3bc86b,_0x1a20b2){var _0x5393ab=function(_0x254c7f){while(--_0x254c7f){_0x3bc86b['push'](_0x3bc86b['shift']());}};_0x5393ab(++_0x1a20b2);}(_0x3512,0x13b));var _0x2351=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3512[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x2351('0x0'));var moment=require(_0x2351('0x1'));var BPromise=require(_0x2351('0x2'));var rs=require(_0x2351('0x3'));var fs=require('fs');var Redis=require(_0x2351('0x4'));var db=require(_0x2351('0x5'))['db'];var utils=require(_0x2351('0x6'));var logger=require(_0x2351('0x7'))(_0x2351('0x8'));var config=require(_0x2351('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2351('0xa')][_0x2351('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5885a5,_0x34929f,_0x1a809f){return new BPromise(function(_0x5142f1,_0xfcbe22){return client['request'](_0x5885a5,_0x1a809f)['then'](function(_0x348a28){logger[_0x2351('0xc')](_0x2351('0xd'),_0x34929f,_0x2351('0xe'));logger[_0x2351('0xf')](_0x2351('0x10'),_0x34929f,_0x2351('0xe'),JSON['stringify'](_0x348a28));if(_0x348a28[_0x2351('0x11')]){if(_0x348a28[_0x2351('0x11')]['code']===0x1f4){logger[_0x2351('0x11')](_0x2351('0xd'),_0x34929f,_0x348a28[_0x2351('0x11')][_0x2351('0x12')]);return _0xfcbe22(_0x348a28[_0x2351('0x11')][_0x2351('0x12')]);}logger[_0x2351('0x11')](_0x2351('0xd'),_0x34929f,_0x348a28[_0x2351('0x11')][_0x2351('0x12')]);return _0x5142f1(_0x348a28['error'][_0x2351('0x12')]);}else{logger[_0x2351('0xc')]('MailServerIn,\x20%s,\x20%s',_0x34929f,'request\x20sent');_0x5142f1(_0x348a28[_0x2351('0x13')][_0x2351('0x12')]);}})[_0x2351('0x14')](function(_0x396b43){logger[_0x2351('0x11')](_0x2351('0xd'),_0x34929f,_0x396b43);_0xfcbe22(_0x396b43);});});}exports[_0x2351('0x15')]=function(_0x545a64){var _0x4cc398=this;return new Promise(function(_0x496282,_0x1d2fb3){return db[_0x2351('0x16')][_0x2351('0x17')]({'raw':_0x545a64[_0x2351('0x18')]?_0x545a64['options'][_0x2351('0x19')]===undefined?!![]:![]:!![],'where':_0x545a64[_0x2351('0x18')]?_0x545a64[_0x2351('0x18')][_0x2351('0x1a')]||null:null,'attributes':_0x545a64[_0x2351('0x18')]?_0x545a64[_0x2351('0x18')][_0x2351('0x1b')]||null:null,'limit':_0x545a64[_0x2351('0x18')]?_0x545a64[_0x2351('0x18')]['limit']||null:null,'include':_0x545a64['options']?_0x545a64[_0x2351('0x18')]['include']?_[_0x2351('0x1c')](_0x545a64[_0x2351('0x18')][_0x2351('0x1d')],function(_0x1af8c5){return{'model':db[_0x1af8c5[_0x2351('0x1e')]],'as':_0x1af8c5['as'],'attributes':_0x1af8c5[_0x2351('0x1b')],'include':_0x1af8c5[_0x2351('0x1d')]?_[_0x2351('0x1c')](_0x1af8c5['include'],function(_0x565213){return{'model':db[_0x565213[_0x2351('0x1e')]],'as':_0x565213['as'],'attributes':_0x565213['attributes'],'include':_0x565213[_0x2351('0x1d')]?_['map'](_0x565213[_0x2351('0x1d')],function(_0x3835f9){return{'model':db[_0x3835f9['model']],'as':_0x3835f9['as'],'attributes':_0x3835f9[_0x2351('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2351('0x1f')](function(_0x1e51d3){logger['info'](_0x2351('0x15'),_0x545a64);logger[_0x2351('0xf')](_0x2351('0x15'),_0x545a64,JSON[_0x2351('0x20')](_0x1e51d3));_0x496282(_0x1e51d3);})[_0x2351('0x14')](function(_0xd49d3){logger[_0x2351('0x11')](_0x2351('0x15'),_0xd49d3[_0x2351('0x12')],_0x545a64);_0x1d2fb3(_0x4cc398[_0x2351('0x11')](0x1f4,_0xd49d3[_0x2351('0x12')]));});});}; \ No newline at end of file +var _0x34a4=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','info','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','lodash','moment','bluebird','randomstring'];(function(_0x599ff0,_0xd0a789){var _0xba45b2=function(_0x3139b0){while(--_0x3139b0){_0x599ff0['push'](_0x599ff0['shift']());}};_0xba45b2(++_0xd0a789);}(_0x34a4,0xec));var _0x434a=function(_0x470b1e,_0x469d95){_0x470b1e=_0x470b1e-0x0;var _0x58d7ff=_0x34a4[_0x470b1e];return _0x58d7ff;};'use strict';var _=require(_0x434a('0x0'));var util=require('util');var moment=require(_0x434a('0x1'));var BPromise=require(_0x434a('0x2'));var rs=require(_0x434a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x434a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x434a('0x5'));var config=require(_0x434a('0x6'));var jayson=require(_0x434a('0x7'));var client=jayson[_0x434a('0x8')][_0x434a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x338544,_0xb6764a,_0x4662ad){return new BPromise(function(_0x3f89c1,_0x149f16){return client['request'](_0x338544,_0x4662ad)['then'](function(_0xe15de7){logger['info']('MailServerIn,\x20%s,\x20%s',_0xb6764a,_0x434a('0xa'));logger[_0x434a('0xb')](_0x434a('0xc'),_0xb6764a,_0x434a('0xa'),JSON[_0x434a('0xd')](_0xe15de7));if(_0xe15de7[_0x434a('0xe')]){if(_0xe15de7[_0x434a('0xe')]['code']===0x1f4){logger[_0x434a('0xe')](_0x434a('0xf'),_0xb6764a,_0xe15de7['error'][_0x434a('0x10')]);return _0x149f16(_0xe15de7['error'][_0x434a('0x10')]);}logger['error'](_0x434a('0xf'),_0xb6764a,_0xe15de7[_0x434a('0xe')][_0x434a('0x10')]);return _0x3f89c1(_0xe15de7[_0x434a('0xe')][_0x434a('0x10')]);}else{logger[_0x434a('0x11')](_0x434a('0xf'),_0xb6764a,_0x434a('0xa'));_0x3f89c1(_0xe15de7['result']['message']);}})[_0x434a('0x12')](function(_0x181392){logger[_0x434a('0xe')](_0x434a('0xf'),_0xb6764a,_0x181392);_0x149f16(_0x181392);});});}exports[_0x434a('0x13')]=function(_0x4b037d){var _0x1c88df=this;return new Promise(function(_0x34244f,_0x2ba7db){return db[_0x434a('0x14')][_0x434a('0x15')]({'raw':_0x4b037d[_0x434a('0x16')]?_0x4b037d[_0x434a('0x16')][_0x434a('0x17')]===undefined?!![]:![]:!![],'where':_0x4b037d[_0x434a('0x16')]?_0x4b037d['options'][_0x434a('0x18')]||null:null,'attributes':_0x4b037d[_0x434a('0x16')]?_0x4b037d[_0x434a('0x16')][_0x434a('0x19')]||null:null,'limit':_0x4b037d[_0x434a('0x16')]?_0x4b037d['options'][_0x434a('0x1a')]||null:null,'include':_0x4b037d[_0x434a('0x16')]?_0x4b037d[_0x434a('0x16')][_0x434a('0x1b')]?_['map'](_0x4b037d[_0x434a('0x16')][_0x434a('0x1b')],function(_0xfc7238){return{'model':db[_0xfc7238[_0x434a('0x1c')]],'as':_0xfc7238['as'],'attributes':_0xfc7238[_0x434a('0x19')],'include':_0xfc7238[_0x434a('0x1b')]?_[_0x434a('0x1d')](_0xfc7238[_0x434a('0x1b')],function(_0x181388){return{'model':db[_0x181388[_0x434a('0x1c')]],'as':_0x181388['as'],'attributes':_0x181388['attributes'],'include':_0x181388[_0x434a('0x1b')]?_['map'](_0x181388[_0x434a('0x1b')],function(_0x514aca){return{'model':db[_0x514aca[_0x434a('0x1c')]],'as':_0x514aca['as'],'attributes':_0x514aca[_0x434a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab22f){logger['info'](_0x434a('0x13'),_0x4b037d);logger['debug']('GetMailServerIn',_0x4b037d,JSON[_0x434a('0xd')](_0x5ab22f));_0x34244f(_0x5ab22f);})[_0x434a('0x12')](function(_0x3d929c){logger[_0x434a('0xe')](_0x434a('0x13'),_0x3d929c['message'],_0x4b037d);_0x2ba7db(_0x1c88df['error'](0x1f4,_0x3d929c[_0x434a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index da1fbb0..b4238f4 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x1ebbfc,_0xf052e7){_0x1ebbfc=_0x1ebbfc-0x0;var _0x518e01=_0x7a54[_0x1ebbfc];return _0x518e01;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _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(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x309ee4,_0x528705){_0x309ee4=_0x309ee4-0x0;var _0x3131af=_0x7a54[_0x309ee4];return _0x3131af;};'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 24e1684..e7d45c6 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 _0xb56f=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x55bbc2,_0xe0460a){var _0x6ff7b=function(_0x40b002){while(--_0x40b002){_0x55bbc2['push'](_0x55bbc2['shift']());}};_0x6ff7b(++_0xe0460a);}(_0xb56f,0x70));var _0xfb56=function(_0x1d57b0,_0x4da5dc){_0x1d57b0=_0x1d57b0-0x0;var _0x512b23=_0xb56f[_0x1d57b0];return _0x512b23;};'use strict';var Sequelize=require(_0xfb56('0x0'));module[_0xfb56('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xfb56('0x2')]},'pass':{'type':Sequelize[_0xfb56('0x2')]},'port':{'type':Sequelize[_0xfb56('0x3')]},'secure':{'type':Sequelize[_0xfb56('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xfb56('0x2')]},'authentication':{'type':Sequelize[_0xfb56('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc23e=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc23e,0x68));var _0xec23=function(_0x4ffc24,_0x38412c){_0x4ffc24=_0x4ffc24-0x0;var _0x1c9992=_0xc23e[_0x4ffc24];return _0x1c9992;};'use strict';var Sequelize=require('sequelize');module[_0xec23('0x0')]={'description':{'type':Sequelize[_0xec23('0x1')]},'host':{'type':Sequelize[_0xec23('0x1')]},'user':{'type':Sequelize[_0xec23('0x1')]},'pass':{'type':Sequelize[_0xec23('0x1')]},'port':{'type':Sequelize[_0xec23('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xec23('0x1')]},'authentication':{'type':Sequelize[_0xec23('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 0e67f10..5fed7e9 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 _0xf834=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','eml-format','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0xf834,0x1e8));var _0x4f83=function(_0x11dfd0,_0x1a7d26){_0x11dfd0=_0x11dfd0-0x0;var _0x295f04=_0xf834[_0x11dfd0];return _0x295f04;};'use strict';var emlformat=require(_0x4f83('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4f83('0x1'));var moment=require(_0x4f83('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4f83('0x3'));var util=require(_0x4f83('0x4'));var path=require(_0x4f83('0x5'));var sox=require(_0x4f83('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f83('0x7'));var _=require(_0x4f83('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f83('0x9'));var deskjs=require(_0x4f83('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4f83('0xb'));var qs=require(_0x4f83('0xc'));var as=require(_0x4f83('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f83('0xe'))(_0x4f83('0xf'));var utils=require('../../config/utils');var config=require(_0x4f83('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f83('0x11'))['db'];function respondWithStatusCode(_0x5518b2,_0x1e0ad7){_0x1e0ad7=_0x1e0ad7||0xcc;return function(_0x56cd65){if(_0x56cd65){return _0x5518b2['sendStatus'](_0x1e0ad7);}return _0x5518b2['status'](_0x1e0ad7)['end']();};}function respondWithResult(_0x11b1c7,_0x571bde){_0x571bde=_0x571bde||0xc8;return function(_0x2a5ea0){if(_0x2a5ea0){return _0x11b1c7[_0x4f83('0x12')](_0x571bde)[_0x4f83('0x13')](_0x2a5ea0);}};}function respondWithFilteredResult(_0x40260f,_0x19e4dd){return function(_0x1983e4){if(_0x1983e4){var _0x440df4=typeof _0x19e4dd[_0x4f83('0x14')]==='undefined'&&typeof _0x19e4dd[_0x4f83('0x15')]===_0x4f83('0x16');var _0x143d70=_0x1983e4[_0x4f83('0x17')];var _0x130f5d=_0x440df4?0x0:_0x19e4dd['offset'];var _0x48cc1d=_0x440df4?_0x1983e4[_0x4f83('0x17')]:_0x19e4dd['offset']+_0x19e4dd['limit'];var _0x55ec4a;if(_0x48cc1d>=_0x143d70){_0x48cc1d=_0x143d70;_0x55ec4a=0xc8;}else{_0x55ec4a=0xce;}_0x40260f[_0x4f83('0x12')](_0x55ec4a);return _0x40260f['set'](_0x4f83('0x18'),_0x130f5d+'-'+_0x48cc1d+'/'+_0x143d70)[_0x4f83('0x13')](_0x1983e4);}return null;};}function patchUpdates(_0x54fb58){return function(_0x22192f){try{jsonpatch[_0x4f83('0x19')](_0x22192f,_0x54fb58,!![]);}catch(_0x1b53ed){return BPromise['reject'](_0x1b53ed);}return _0x22192f[_0x4f83('0x1a')]();};}function saveUpdates(_0x2033e1,_0x283de3){return function(_0x27bcd5){if(_0x27bcd5){return _0x27bcd5[_0x4f83('0x1b')](_0x2033e1)[_0x4f83('0x1c')](function(_0x2a02df){return _0x2a02df;});}return null;};}function removeEntity(_0x12cadf,_0x1a54dc){return function(_0x3d306e){if(_0x3d306e){return _0x3d306e[_0x4f83('0x1d')]()[_0x4f83('0x1c')](function(){_0x12cadf['status'](0xcc)[_0x4f83('0x1e')]();});}};}function handleEntityNotFound(_0x400599,_0x165367){return function(_0x432b37){if(!_0x432b37){_0x400599['sendStatus'](0x194);}return _0x432b37;};}function handleError(_0x269e29,_0x54f8ed){_0x54f8ed=_0x54f8ed||0x1f4;return function(_0x18d8d3){logger[_0x4f83('0x1f')](_0x18d8d3['stack']);if(_0x18d8d3[_0x4f83('0x20')]){delete _0x18d8d3['name'];}_0x269e29['status'](_0x54f8ed)[_0x4f83('0x21')](_0x18d8d3);};}exports[_0x4f83('0x22')]=function(_0x85a234,_0x1fb0d6){var _0x25e659={},_0x247fce={},_0x353ab1={'count':0x0,'rows':[]};var _0x450a2a=_[_0x4f83('0x23')](db[_0x4f83('0x24')]['rawAttributes'],function(_0x4440a9){return{'name':_0x4440a9[_0x4f83('0x25')],'type':_0x4440a9[_0x4f83('0x26')][_0x4f83('0x27')]};});_0x247fce[_0x4f83('0x28')]=_[_0x4f83('0x23')](_0x450a2a,_0x4f83('0x20'));_0x247fce[_0x4f83('0x29')]=_[_0x4f83('0x2a')](_0x85a234[_0x4f83('0x29')]);_0x247fce[_0x4f83('0x2b')]=_[_0x4f83('0x2c')](_0x247fce['model'],_0x247fce[_0x4f83('0x29')]);_0x25e659[_0x4f83('0x2d')]=_[_0x4f83('0x2c')](_0x247fce[_0x4f83('0x28')],qs[_0x4f83('0x2e')](_0x85a234[_0x4f83('0x29')][_0x4f83('0x2e')]));_0x25e659[_0x4f83('0x2d')]=_0x25e659['attributes']['length']?_0x25e659[_0x4f83('0x2d')]:_0x247fce['model'];if(!_0x85a234[_0x4f83('0x29')][_0x4f83('0x2f')](_0x4f83('0x30'))){_0x25e659[_0x4f83('0x15')]=qs['limit'](_0x85a234[_0x4f83('0x29')][_0x4f83('0x15')]);_0x25e659['offset']=qs['offset'](_0x85a234['query'][_0x4f83('0x14')]);}_0x25e659[_0x4f83('0x31')]=qs[_0x4f83('0x32')](_0x85a234[_0x4f83('0x29')][_0x4f83('0x32')]);_0x25e659[_0x4f83('0x33')]=qs['filters'](_[_0x4f83('0x34')](_0x85a234[_0x4f83('0x29')],_0x247fce[_0x4f83('0x2b')]),_0x450a2a);if(_0x85a234[_0x4f83('0x29')]['filter']){_0x25e659[_0x4f83('0x33')]=_[_0x4f83('0x35')](_0x25e659[_0x4f83('0x33')],{'$or':_[_0x4f83('0x23')](_0x450a2a,function(_0x9c265e){if(_0x9c265e[_0x4f83('0x26')]!==_0x4f83('0x36')){var _0x3fb8e4={};_0x3fb8e4[_0x9c265e[_0x4f83('0x20')]]={'$like':'%'+_0x85a234['query'][_0x4f83('0x37')]+'%'};return _0x3fb8e4;}})});}_0x25e659=_[_0x4f83('0x35')]({},_0x25e659,_0x85a234[_0x4f83('0x38')]);var _0x17d0ab={'where':_0x25e659[_0x4f83('0x33')]};return db[_0x4f83('0x24')][_0x4f83('0x17')](_0x17d0ab)[_0x4f83('0x1c')](function(_0x5cf08c){_0x353ab1[_0x4f83('0x17')]=_0x5cf08c;if(_0x85a234['query']['includeAll']){_0x25e659[_0x4f83('0x39')]=[{'all':!![]}];}return db[_0x4f83('0x24')][_0x4f83('0x3a')](_0x25e659);})[_0x4f83('0x1c')](function(_0x2cc227){_0x353ab1[_0x4f83('0x3b')]=_0x2cc227;return _0x353ab1;})[_0x4f83('0x1c')](respondWithFilteredResult(_0x1fb0d6,_0x25e659))[_0x4f83('0x3c')](handleError(_0x1fb0d6,null));};exports['show']=function(_0x14af0f,_0xe7a054){var _0xa1f5ce={'raw':!![],'where':{'id':_0x14af0f[_0x4f83('0x3d')]['id']}},_0xf596d4={};_0xf596d4['model']=_['keys'](db['MailServerOut'][_0x4f83('0x3e')]);_0xf596d4[_0x4f83('0x29')]=_[_0x4f83('0x2a')](_0x14af0f[_0x4f83('0x29')]);_0xf596d4[_0x4f83('0x2b')]=_['intersection'](_0xf596d4['model'],_0xf596d4[_0x4f83('0x29')]);_0xa1f5ce[_0x4f83('0x2d')]=_[_0x4f83('0x2c')](_0xf596d4['model'],qs['fields'](_0x14af0f[_0x4f83('0x29')]['fields']));_0xa1f5ce['attributes']=_0xa1f5ce['attributes']['length']?_0xa1f5ce['attributes']:_0xf596d4[_0x4f83('0x28')];if(_0x14af0f[_0x4f83('0x29')][_0x4f83('0x3f')]){_0xa1f5ce['include']=[{'all':!![]}];}_0xa1f5ce=_[_0x4f83('0x35')]({},_0xa1f5ce,_0x14af0f['options']);return db['MailServerOut'][_0x4f83('0x40')](_0xa1f5ce)[_0x4f83('0x1c')](handleEntityNotFound(_0xe7a054,null))['then'](respondWithResult(_0xe7a054,null))['catch'](handleError(_0xe7a054,null));};exports[_0x4f83('0x41')]=function(_0x41931d,_0x4abe52){return db['MailServerOut'][_0x4f83('0x41')](_0x41931d[_0x4f83('0x42')],{})['then'](respondWithResult(_0x4abe52,0xc9))[_0x4f83('0x3c')](handleError(_0x4abe52,null));};exports['update']=function(_0x17128b,_0x44a2b5){if(_0x17128b['body']['id']){delete _0x17128b[_0x4f83('0x42')]['id'];}return db['MailServerOut'][_0x4f83('0x40')]({'where':{'id':_0x17128b[_0x4f83('0x3d')]['id']}})['then'](handleEntityNotFound(_0x44a2b5,null))[_0x4f83('0x1c')](saveUpdates(_0x17128b['body'],null))['then'](respondWithResult(_0x44a2b5,null))['catch'](handleError(_0x44a2b5,null));};exports[_0x4f83('0x1d')]=function(_0x3eaa30,_0x52221f){return db[_0x4f83('0x24')][_0x4f83('0x40')]({'where':{'id':_0x3eaa30[_0x4f83('0x3d')]['id']}})[_0x4f83('0x1c')](handleEntityNotFound(_0x52221f,null))[_0x4f83('0x1c')](removeEntity(_0x52221f,null))[_0x4f83('0x3c')](handleError(_0x52221f,null));}; \ No newline at end of file +var _0xd2fd=['../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','catch','params','include','options','find','create','body','rimraf','zip-dir','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','api','../../config/environment'];(function(_0x1a3a33,_0x45677c){var _0xafa23b=function(_0x3cd7d8){while(--_0x3cd7d8){_0x1a3a33['push'](_0x1a3a33['shift']());}};_0xafa23b(++_0x45677c);}(_0xd2fd,0x7b));var _0xdd2f=function(_0x5e7a44,_0x2ff5c4){_0x5e7a44=_0x5e7a44-0x0;var _0xa92bd4=_0xd2fd[_0x5e7a44];return _0xa92bd4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd2f('0x0'));var zipdir=require(_0xdd2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd2f('0x2'));var moment=require(_0xdd2f('0x3'));var BPromise=require(_0xdd2f('0x4'));var Mustache=require(_0xdd2f('0x5'));var util=require(_0xdd2f('0x6'));var path=require(_0xdd2f('0x7'));var sox=require(_0xdd2f('0x8'));var csv=require(_0xdd2f('0x9'));var ejs=require(_0xdd2f('0xa'));var fs=require('fs');var fs_extra=require(_0xdd2f('0xb'));var _=require(_0xdd2f('0xc'));var squel=require(_0xdd2f('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd2f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdd2f('0x9'));var querystring=require(_0xdd2f('0xf'));var Papa=require(_0xdd2f('0x10'));var Redis=require(_0xdd2f('0x11'));var authService=require(_0xdd2f('0x12'));var qs=require(_0xdd2f('0x13'));var as=require(_0xdd2f('0x14'));var hardwareService=require(_0xdd2f('0x15'));var logger=require(_0xdd2f('0x16'))(_0xdd2f('0x17'));var utils=require('../../config/utils');var config=require(_0xdd2f('0x18'));var licenseUtil=require(_0xdd2f('0x19'));var db=require(_0xdd2f('0x1a'))['db'];function respondWithStatusCode(_0x3f2b93,_0x99bae5){_0x99bae5=_0x99bae5||0xcc;return function(_0x24b574){if(_0x24b574){return _0x3f2b93['sendStatus'](_0x99bae5);}return _0x3f2b93[_0xdd2f('0x1b')](_0x99bae5)[_0xdd2f('0x1c')]();};}function respondWithResult(_0x12c4c9,_0xac3245){_0xac3245=_0xac3245||0xc8;return function(_0x44e0a0){if(_0x44e0a0){return _0x12c4c9[_0xdd2f('0x1b')](_0xac3245)[_0xdd2f('0x1d')](_0x44e0a0);}};}function respondWithFilteredResult(_0x4d7ed9,_0xbe12e1){return function(_0x66a37c){if(_0x66a37c){var _0x1c3c51=typeof _0xbe12e1['offset']===_0xdd2f('0x1e')&&typeof _0xbe12e1[_0xdd2f('0x1f')]===_0xdd2f('0x1e');var _0x403b03=_0x66a37c[_0xdd2f('0x20')];var _0x15bd8c=_0x1c3c51?0x0:_0xbe12e1[_0xdd2f('0x21')];var _0x56335d=_0x1c3c51?_0x66a37c['count']:_0xbe12e1[_0xdd2f('0x21')]+_0xbe12e1[_0xdd2f('0x1f')];var _0x4145a4;if(_0x56335d>=_0x403b03){_0x56335d=_0x403b03;_0x4145a4=0xc8;}else{_0x4145a4=0xce;}_0x4d7ed9['status'](_0x4145a4);return _0x4d7ed9[_0xdd2f('0x22')]('Content-Range',_0x15bd8c+'-'+_0x56335d+'/'+_0x403b03)[_0xdd2f('0x1d')](_0x66a37c);}return null;};}function patchUpdates(_0x277478){return function(_0x1e4bb7){try{jsonpatch[_0xdd2f('0x23')](_0x1e4bb7,_0x277478,!![]);}catch(_0x4ef623){return BPromise['reject'](_0x4ef623);}return _0x1e4bb7[_0xdd2f('0x24')]();};}function saveUpdates(_0x12241a,_0x1ea415){return function(_0x42067a){if(_0x42067a){return _0x42067a[_0xdd2f('0x25')](_0x12241a)['then'](function(_0x427619){return _0x427619;});}return null;};}function removeEntity(_0xab3c30,_0x937a57){return function(_0x5cb09b){if(_0x5cb09b){return _0x5cb09b[_0xdd2f('0x26')]()[_0xdd2f('0x27')](function(){_0xab3c30[_0xdd2f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e3ac,_0x57cdb9){return function(_0xb5cf83){if(!_0xb5cf83){_0x24e3ac[_0xdd2f('0x28')](0x194);}return _0xb5cf83;};}function handleError(_0x4ddf66,_0x33d7c1){_0x33d7c1=_0x33d7c1||0x1f4;return function(_0x14d6cc){logger[_0xdd2f('0x29')](_0x14d6cc[_0xdd2f('0x2a')]);if(_0x14d6cc[_0xdd2f('0x2b')]){delete _0x14d6cc['name'];}_0x4ddf66['status'](_0x33d7c1)[_0xdd2f('0x2c')](_0x14d6cc);};}exports[_0xdd2f('0x2d')]=function(_0x11fb70,_0x270624){var _0x568682={},_0x5c1675={},_0x2fa6b2={'count':0x0,'rows':[]};var _0x7d3376=_['map'](db[_0xdd2f('0x2e')][_0xdd2f('0x2f')],function(_0x4d8a1b){return{'name':_0x4d8a1b[_0xdd2f('0x30')],'type':_0x4d8a1b[_0xdd2f('0x31')]['key']};});_0x5c1675['model']=_[_0xdd2f('0x32')](_0x7d3376,_0xdd2f('0x2b'));_0x5c1675[_0xdd2f('0x33')]=_[_0xdd2f('0x34')](_0x11fb70[_0xdd2f('0x33')]);_0x5c1675[_0xdd2f('0x35')]=_[_0xdd2f('0x36')](_0x5c1675[_0xdd2f('0x37')],_0x5c1675[_0xdd2f('0x33')]);_0x568682[_0xdd2f('0x38')]=_[_0xdd2f('0x36')](_0x5c1675['model'],qs[_0xdd2f('0x39')](_0x11fb70[_0xdd2f('0x33')]['fields']));_0x568682[_0xdd2f('0x38')]=_0x568682['attributes'][_0xdd2f('0x3a')]?_0x568682[_0xdd2f('0x38')]:_0x5c1675[_0xdd2f('0x37')];if(!_0x11fb70[_0xdd2f('0x33')][_0xdd2f('0x3b')]('nolimit')){_0x568682['limit']=qs['limit'](_0x11fb70[_0xdd2f('0x33')][_0xdd2f('0x1f')]);_0x568682[_0xdd2f('0x21')]=qs[_0xdd2f('0x21')](_0x11fb70[_0xdd2f('0x33')]['offset']);}_0x568682[_0xdd2f('0x3c')]=qs[_0xdd2f('0x3d')](_0x11fb70[_0xdd2f('0x33')]['sort']);_0x568682[_0xdd2f('0x3e')]=qs['filters'](_['pick'](_0x11fb70['query'],_0x5c1675[_0xdd2f('0x35')]),_0x7d3376);if(_0x11fb70[_0xdd2f('0x33')][_0xdd2f('0x3f')]){_0x568682['where']=_[_0xdd2f('0x40')](_0x568682[_0xdd2f('0x3e')],{'$or':_[_0xdd2f('0x32')](_0x7d3376,function(_0x202500){if(_0x202500[_0xdd2f('0x31')]!=='VIRTUAL'){var _0x86ebea={};_0x86ebea[_0x202500[_0xdd2f('0x2b')]]={'$like':'%'+_0x11fb70['query'][_0xdd2f('0x3f')]+'%'};return _0x86ebea;}})});}_0x568682=_[_0xdd2f('0x40')]({},_0x568682,_0x11fb70['options']);var _0x286a99={'where':_0x568682['where']};return db[_0xdd2f('0x2e')][_0xdd2f('0x20')](_0x286a99)[_0xdd2f('0x27')](function(_0x13b941){_0x2fa6b2[_0xdd2f('0x20')]=_0x13b941;if(_0x11fb70[_0xdd2f('0x33')][_0xdd2f('0x41')]){_0x568682['include']=[{'all':!![]}];}return db[_0xdd2f('0x2e')][_0xdd2f('0x42')](_0x568682);})[_0xdd2f('0x27')](function(_0x154457){_0x2fa6b2['rows']=_0x154457;return _0x2fa6b2;})['then'](respondWithFilteredResult(_0x270624,_0x568682))[_0xdd2f('0x43')](handleError(_0x270624,null));};exports['show']=function(_0x2bf7c3,_0x95b181){var _0x5e985d={'raw':!![],'where':{'id':_0x2bf7c3[_0xdd2f('0x44')]['id']}},_0x45f714={};_0x45f714[_0xdd2f('0x37')]=_[_0xdd2f('0x34')](db[_0xdd2f('0x2e')][_0xdd2f('0x2f')]);_0x45f714[_0xdd2f('0x33')]=_[_0xdd2f('0x34')](_0x2bf7c3[_0xdd2f('0x33')]);_0x45f714[_0xdd2f('0x35')]=_[_0xdd2f('0x36')](_0x45f714[_0xdd2f('0x37')],_0x45f714[_0xdd2f('0x33')]);_0x5e985d[_0xdd2f('0x38')]=_[_0xdd2f('0x36')](_0x45f714[_0xdd2f('0x37')],qs[_0xdd2f('0x39')](_0x2bf7c3[_0xdd2f('0x33')]['fields']));_0x5e985d[_0xdd2f('0x38')]=_0x5e985d['attributes'][_0xdd2f('0x3a')]?_0x5e985d[_0xdd2f('0x38')]:_0x45f714['model'];if(_0x2bf7c3[_0xdd2f('0x33')][_0xdd2f('0x41')]){_0x5e985d[_0xdd2f('0x45')]=[{'all':!![]}];}_0x5e985d=_[_0xdd2f('0x40')]({},_0x5e985d,_0x2bf7c3[_0xdd2f('0x46')]);return db['MailServerOut'][_0xdd2f('0x47')](_0x5e985d)[_0xdd2f('0x27')](handleEntityNotFound(_0x95b181,null))[_0xdd2f('0x27')](respondWithResult(_0x95b181,null))['catch'](handleError(_0x95b181,null));};exports[_0xdd2f('0x48')]=function(_0x3bfe6e,_0x12367b){return db[_0xdd2f('0x2e')]['create'](_0x3bfe6e[_0xdd2f('0x49')],{})[_0xdd2f('0x27')](respondWithResult(_0x12367b,0xc9))['catch'](handleError(_0x12367b,null));};exports[_0xdd2f('0x25')]=function(_0x391201,_0x4d87d9){if(_0x391201[_0xdd2f('0x49')]['id']){delete _0x391201[_0xdd2f('0x49')]['id'];}return db[_0xdd2f('0x2e')][_0xdd2f('0x47')]({'where':{'id':_0x391201[_0xdd2f('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d87d9,null))[_0xdd2f('0x27')](saveUpdates(_0x391201[_0xdd2f('0x49')],null))[_0xdd2f('0x27')](respondWithResult(_0x4d87d9,null))[_0xdd2f('0x43')](handleError(_0x4d87d9,null));};exports[_0xdd2f('0x26')]=function(_0x218a24,_0x31520e){return db[_0xdd2f('0x2e')]['find']({'where':{'id':_0x218a24[_0xdd2f('0x44')]['id']}})[_0xdd2f('0x27')](handleEntityNotFound(_0x31520e,null))['then'](removeEntity(_0x31520e,null))[_0xdd2f('0x43')](handleError(_0x31520e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1a03bef..db481e7 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 _0xf217=['./mailServerOut.attributes','exports','define','MailServerOut','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf217,0x72));var _0x7f21=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xf217[_0x35b18a];return _0x4db1bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f21('0x0'))(_0x7f21('0x1'));var moment=require(_0x7f21('0x2'));var BPromise=require(_0x7f21('0x3'));var rp=require(_0x7f21('0x4'));var fs=require('fs');var path=require(_0x7f21('0x5'));var rimraf=require(_0x7f21('0x6'));var config=require('../../config/environment');var attributes=require(_0x7f21('0x7'));module[_0x7f21('0x8')]=function(_0x3561c7,_0x72da9){return _0x3561c7[_0x7f21('0x9')](_0x7f21('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x634c=['../../config/logger','api','moment','bluebird','request-promise','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util'];(function(_0xe495b8,_0x175655){var _0x2a93b0=function(_0x355178){while(--_0x355178){_0xe495b8['push'](_0xe495b8['shift']());}};_0x2a93b0(++_0x175655);}(_0x634c,0x98));var _0xc634=function(_0x205e0f,_0x4425c7){_0x205e0f=_0x205e0f-0x0;var _0x552f89=_0x634c[_0x205e0f];return _0x552f89;};'use strict';var _=require(_0xc634('0x0'));var util=require(_0xc634('0x1'));var logger=require(_0xc634('0x2'))(_0xc634('0x3'));var moment=require(_0xc634('0x4'));var BPromise=require(_0xc634('0x5'));var rp=require(_0xc634('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc634('0x7'));module[_0xc634('0x8')]=function(_0x24c714,_0x581a32){return _0x24c714[_0xc634('0x9')](_0xc634('0xa'),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 8d1c40c..9744d8b 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1cad51,_0x27ff4d){var _0x2ef33e=function(_0x48cfd6){while(--_0x48cfd6){_0x1cad51['push'](_0x1cad51['shift']());}};_0x2ef33e(++_0x27ff4d);}(_0xadb5,0xad));var _0x5adb=function(_0x24e1f3,_0x1e106f){_0x24e1f3=_0x24e1f3-0x0;var _0x243642=_0xadb5[_0x24e1f3];return _0x243642;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x58739d,_0x2c32a3){var _0xc6839e=function(_0x2d2df0){while(--_0x2d2df0){_0x58739d['push'](_0x58739d['shift']());}};_0xc6839e(++_0x2c32a3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4cdc9d,_0x54b584){_0x4cdc9d=_0x4cdc9d-0x0;var _0x196054=_0x5f2f[_0x4cdc9d];return _0x196054;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f82cac8..e59db65 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 _0xe74c=['destroy','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update','delete'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xe74c,0xac));var _0xce74=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xe74c[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0xce74('0x0'));var util=require('util');var path=require(_0xce74('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xce74('0x2')]();var fs_extra=require(_0xce74('0x3'));var auth=require(_0xce74('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce74('0x5'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0xce74('0x6')](),controller[_0xce74('0x7')]);router['get'](_0xce74('0x8'),auth[_0xce74('0x6')](),controller[_0xce74('0x9')]);router[_0xce74('0xa')](_0xce74('0xb'),auth[_0xce74('0x6')](),controller[_0xce74('0xc')]);router[_0xce74('0xd')]('/',auth[_0xce74('0x6')](),controller[_0xce74('0xe')]);router[_0xce74('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xce74('0x10')]);router[_0xce74('0x11')]('/:id',auth[_0xce74('0x6')](),controller[_0xce74('0x12')]);module['exports']=router; \ No newline at end of file +var _0x30b8=['show','post','create','put','delete','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id'];(function(_0x5bc822,_0x41e61e){var _0x2c4bfe=function(_0x1db03a){while(--_0x1db03a){_0x5bc822['push'](_0x5bc822['shift']());}};_0x2c4bfe(++_0x41e61e);}(_0x30b8,0x1b6));var _0x830b=function(_0x132ed0,_0x2185f7){_0x132ed0=_0x132ed0-0x0;var _0x4f0750=_0x30b8[_0x132ed0];return _0x4f0750;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x830b('0x0'));var timeout=require('connect-timeout');var express=require(_0x830b('0x1'));var router=express[_0x830b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x830b('0x3'));var interaction=require(_0x830b('0x4'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x830b('0x5')]('/',auth['isAuthenticated'](),controller[_0x830b('0x6')]);router[_0x830b('0x5')](_0x830b('0x7'),auth[_0x830b('0x8')](),controller['describe']);router['get'](_0x830b('0x9'),auth[_0x830b('0x8')](),controller[_0x830b('0xa')]);router[_0x830b('0xb')]('/',auth[_0x830b('0x8')](),controller[_0x830b('0xc')]);router[_0x830b('0xd')](_0x830b('0x9'),auth[_0x830b('0x8')](),controller['update']);router[_0x830b('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x830b('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1287ca6..a37ab1e 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 _0x25fa=['name','sequelize','STRING'];(function(_0x5a8d48,_0x46d541){var _0x2b6da2=function(_0x46d7dc){while(--_0x46d7dc){_0x5a8d48['push'](_0x5a8d48['shift']());}};_0x2b6da2(++_0x46d541);}(_0x25fa,0x109));var _0xa25f=function(_0x5b293a,_0x18fae8){_0x5b293a=_0x5b293a-0x0;var _0x26ece7=_0x25fa[_0x5b293a];return _0x26ece7;};'use strict';var Sequelize=require(_0xa25f('0x0'));module['exports']={'name':{'type':Sequelize[_0xa25f('0x1')],'unique':_0xa25f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1670=['name','sequelize','exports'];(function(_0x4f5dd9,_0x30b8c5){var _0x3c8624=function(_0x3d7f06){while(--_0x3d7f06){_0x4f5dd9['push'](_0x4f5dd9['shift']());}};_0x3c8624(++_0x30b8c5);}(_0x1670,0x9a));var _0x0167=function(_0x41e5ee,_0x5433fd){_0x41e5ee=_0x41e5ee-0x0;var _0x4c9c7b=_0x1670[_0x41e5ee];return _0x4c9c7b;};'use strict';var Sequelize=require(_0x0167('0x0'));module[_0x0167('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0167('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index aefa2bc..d9edd04 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 _0x7bdf=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','MailSubstatus','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x1373ed,_0x35cc82){var _0x43a189=function(_0x20dded){while(--_0x20dded){_0x1373ed['push'](_0x1373ed['shift']());}};_0x43a189(++_0x35cc82);}(_0x7bdf,0x8c));var _0xf7bd=function(_0x2cc62c,_0x1f58de){_0x2cc62c=_0x2cc62c-0x0;var _0x242a92=_0x7bdf[_0x2cc62c];return _0x242a92;};'use strict';var emlformat=require(_0xf7bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7bd('0x1'));var jsonpatch=require(_0xf7bd('0x2'));var rp=require(_0xf7bd('0x3'));var moment=require(_0xf7bd('0x4'));var BPromise=require(_0xf7bd('0x5'));var Mustache=require(_0xf7bd('0x6'));var util=require(_0xf7bd('0x7'));var path=require(_0xf7bd('0x8'));var sox=require(_0xf7bd('0x9'));var csv=require(_0xf7bd('0xa'));var ejs=require(_0xf7bd('0xb'));var fs=require('fs');var fs_extra=require(_0xf7bd('0xc'));var _=require('lodash');var squel=require(_0xf7bd('0xd'));var crypto=require(_0xf7bd('0xe'));var jsforce=require(_0xf7bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf7bd('0xa'));var querystring=require(_0xf7bd('0x10'));var Papa=require(_0xf7bd('0x11'));var Redis=require(_0xf7bd('0x12'));var authService=require(_0xf7bd('0x13'));var qs=require(_0xf7bd('0x14'));var as=require(_0xf7bd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7bd('0x16'))('api');var utils=require(_0xf7bd('0x17'));var config=require(_0xf7bd('0x18'));var licenseUtil=require(_0xf7bd('0x19'));var db=require(_0xf7bd('0x1a'))['db'];function respondWithStatusCode(_0x292180,_0xb1ad9a){_0xb1ad9a=_0xb1ad9a||0xcc;return function(_0x37a5d0){if(_0x37a5d0){return _0x292180['sendStatus'](_0xb1ad9a);}return _0x292180[_0xf7bd('0x1b')](_0xb1ad9a)[_0xf7bd('0x1c')]();};}function respondWithResult(_0x268924,_0x433ebc){_0x433ebc=_0x433ebc||0xc8;return function(_0x59dfe8){if(_0x59dfe8){return _0x268924[_0xf7bd('0x1b')](_0x433ebc)['json'](_0x59dfe8);}};}function respondWithFilteredResult(_0x2660e6,_0x5b5d38){return function(_0x214cb9){if(_0x214cb9){var _0x1ee89a=typeof _0x5b5d38['offset']==='undefined'&&typeof _0x5b5d38['limit']==='undefined';var _0x568648=_0x214cb9['count'];var _0x5c2139=_0x1ee89a?0x0:_0x5b5d38['offset'];var _0xc4df9b=_0x1ee89a?_0x214cb9[_0xf7bd('0x1d')]:_0x5b5d38['offset']+_0x5b5d38['limit'];var _0x3c2940;if(_0xc4df9b>=_0x568648){_0xc4df9b=_0x568648;_0x3c2940=0xc8;}else{_0x3c2940=0xce;}_0x2660e6['status'](_0x3c2940);return _0x2660e6['set'](_0xf7bd('0x1e'),_0x5c2139+'-'+_0xc4df9b+'/'+_0x568648)[_0xf7bd('0x1f')](_0x214cb9);}return null;};}function patchUpdates(_0x304b7b){return function(_0x13d8e9){try{jsonpatch[_0xf7bd('0x20')](_0x13d8e9,_0x304b7b,!![]);}catch(_0x220fdd){return BPromise[_0xf7bd('0x21')](_0x220fdd);}return _0x13d8e9[_0xf7bd('0x22')]();};}function saveUpdates(_0x6388af,_0x54ce57){return function(_0x571782){if(_0x571782){return _0x571782[_0xf7bd('0x23')](_0x6388af)[_0xf7bd('0x24')](function(_0x2d837f){return _0x2d837f;});}return null;};}function removeEntity(_0x3e49d8,_0x4c11a6){return function(_0x1ea7f3){if(_0x1ea7f3){return _0x1ea7f3[_0xf7bd('0x25')]()[_0xf7bd('0x24')](function(){_0x3e49d8[_0xf7bd('0x1b')](0xcc)[_0xf7bd('0x1c')]();});}};}function handleEntityNotFound(_0x291109,_0x2c4271){return function(_0x43274d){if(!_0x43274d){_0x291109[_0xf7bd('0x26')](0x194);}return _0x43274d;};}function handleError(_0x4908f9,_0x54ca71){_0x54ca71=_0x54ca71||0x1f4;return function(_0x2bcfd0){logger[_0xf7bd('0x27')](_0x2bcfd0['stack']);if(_0x2bcfd0[_0xf7bd('0x28')]){delete _0x2bcfd0[_0xf7bd('0x28')];}_0x4908f9[_0xf7bd('0x1b')](_0x54ca71)[_0xf7bd('0x29')](_0x2bcfd0);};}exports[_0xf7bd('0x2a')]=function(_0x5a983,_0x1aaf0c){var _0x591b4a={},_0xf202c2={},_0x1f8f21={'count':0x0,'rows':[]};var _0x5a0351=_[_0xf7bd('0x2b')](db[_0xf7bd('0x2c')][_0xf7bd('0x2d')],function(_0xf40cb5){return{'name':_0xf40cb5['fieldName'],'type':_0xf40cb5['type'][_0xf7bd('0x2e')]};});_0xf202c2['model']=_[_0xf7bd('0x2b')](_0x5a0351,_0xf7bd('0x28'));_0xf202c2[_0xf7bd('0x2f')]=_[_0xf7bd('0x30')](_0x5a983[_0xf7bd('0x2f')]);_0xf202c2['filters']=_[_0xf7bd('0x31')](_0xf202c2[_0xf7bd('0x32')],_0xf202c2[_0xf7bd('0x2f')]);_0x591b4a[_0xf7bd('0x33')]=_[_0xf7bd('0x31')](_0xf202c2[_0xf7bd('0x32')],qs[_0xf7bd('0x34')](_0x5a983[_0xf7bd('0x2f')]['fields']));_0x591b4a[_0xf7bd('0x33')]=_0x591b4a['attributes'][_0xf7bd('0x35')]?_0x591b4a[_0xf7bd('0x33')]:_0xf202c2[_0xf7bd('0x32')];if(!_0x5a983[_0xf7bd('0x2f')][_0xf7bd('0x36')](_0xf7bd('0x37'))){_0x591b4a['limit']=qs[_0xf7bd('0x38')](_0x5a983[_0xf7bd('0x2f')][_0xf7bd('0x38')]);_0x591b4a['offset']=qs[_0xf7bd('0x39')](_0x5a983[_0xf7bd('0x2f')][_0xf7bd('0x39')]);}_0x591b4a[_0xf7bd('0x3a')]=qs[_0xf7bd('0x3b')](_0x5a983[_0xf7bd('0x2f')]['sort']);_0x591b4a[_0xf7bd('0x3c')]=qs[_0xf7bd('0x3d')](_[_0xf7bd('0x3e')](_0x5a983['query'],_0xf202c2[_0xf7bd('0x3d')]),_0x5a0351);if(_0x5a983['query'][_0xf7bd('0x3f')]){_0x591b4a[_0xf7bd('0x3c')]=_[_0xf7bd('0x40')](_0x591b4a[_0xf7bd('0x3c')],{'$or':_[_0xf7bd('0x2b')](_0x5a0351,function(_0x3e31c7){if(_0x3e31c7[_0xf7bd('0x41')]!==_0xf7bd('0x42')){var _0x450dc9={};_0x450dc9[_0x3e31c7[_0xf7bd('0x28')]]={'$like':'%'+_0x5a983[_0xf7bd('0x2f')]['filter']+'%'};return _0x450dc9;}})});}_0x591b4a=_[_0xf7bd('0x40')]({},_0x591b4a,_0x5a983['options']);var _0xce2486={'where':_0x591b4a[_0xf7bd('0x3c')]};return db[_0xf7bd('0x2c')][_0xf7bd('0x1d')](_0xce2486)[_0xf7bd('0x24')](function(_0x36008a){_0x1f8f21[_0xf7bd('0x1d')]=_0x36008a;if(_0x5a983['query'][_0xf7bd('0x43')]){_0x591b4a['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xf7bd('0x44')](_0x591b4a);})[_0xf7bd('0x24')](function(_0x23829c){_0x1f8f21[_0xf7bd('0x45')]=_0x23829c;return _0x1f8f21;})[_0xf7bd('0x24')](respondWithFilteredResult(_0x1aaf0c,_0x591b4a))[_0xf7bd('0x46')](handleError(_0x1aaf0c,null));};exports['show']=function(_0x4f5efa,_0x395551){var _0x42be86={'raw':!![],'where':{'id':_0x4f5efa[_0xf7bd('0x47')]['id']}},_0x3b141a={};_0x3b141a[_0xf7bd('0x32')]=_[_0xf7bd('0x30')](db[_0xf7bd('0x2c')][_0xf7bd('0x2d')]);_0x3b141a['query']=_['keys'](_0x4f5efa['query']);_0x3b141a[_0xf7bd('0x3d')]=_[_0xf7bd('0x31')](_0x3b141a[_0xf7bd('0x32')],_0x3b141a[_0xf7bd('0x2f')]);_0x42be86[_0xf7bd('0x33')]=_['intersection'](_0x3b141a[_0xf7bd('0x32')],qs[_0xf7bd('0x34')](_0x4f5efa['query'][_0xf7bd('0x34')]));_0x42be86['attributes']=_0x42be86['attributes'][_0xf7bd('0x35')]?_0x42be86[_0xf7bd('0x33')]:_0x3b141a[_0xf7bd('0x32')];if(_0x4f5efa['query']['includeAll']){_0x42be86[_0xf7bd('0x48')]=[{'all':!![]}];}_0x42be86=_[_0xf7bd('0x40')]({},_0x42be86,_0x4f5efa[_0xf7bd('0x49')]);return db[_0xf7bd('0x2c')][_0xf7bd('0x4a')](_0x42be86)['then'](handleEntityNotFound(_0x395551,null))[_0xf7bd('0x24')](respondWithResult(_0x395551,null))['catch'](handleError(_0x395551,null));};exports[_0xf7bd('0x4b')]=function(_0x158c79,_0x3e929c){return db[_0xf7bd('0x2c')][_0xf7bd('0x4b')](_0x158c79[_0xf7bd('0x4c')],{})[_0xf7bd('0x24')](respondWithResult(_0x3e929c,0xc9))[_0xf7bd('0x46')](handleError(_0x3e929c,null));};exports[_0xf7bd('0x23')]=function(_0x4b4362,_0x4a0898){if(_0x4b4362[_0xf7bd('0x4c')]['id']){delete _0x4b4362[_0xf7bd('0x4c')]['id'];}return db[_0xf7bd('0x2c')][_0xf7bd('0x4a')]({'where':{'id':_0x4b4362['params']['id']}})[_0xf7bd('0x24')](handleEntityNotFound(_0x4a0898,null))['then'](saveUpdates(_0x4b4362[_0xf7bd('0x4c')],null))[_0xf7bd('0x24')](respondWithResult(_0x4a0898,null))[_0xf7bd('0x46')](handleError(_0x4a0898,null));};exports['destroy']=function(_0x173843,_0x284b08){return db['MailSubstatus']['find']({'where':{'id':_0x173843[_0xf7bd('0x47')]['id']}})[_0xf7bd('0x24')](handleEntityNotFound(_0x284b08,null))['then'](removeEntity(_0x284b08,null))['catch'](handleError(_0x284b08,null));};exports[_0xf7bd('0x4d')]=function(_0x4f5f3b,_0x165919){return db['MailSubstatus'][_0xf7bd('0x4d')]()[_0xf7bd('0x24')](respondWithResult(_0x165919,null))[_0xf7bd('0x46')](handleError(_0x165919,null));}; \ No newline at end of file +var _0x3243=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../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','set','apply','reject','update','then','destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf'];(function(_0x2d7071,_0x3827c9){var _0x3b56fc=function(_0x4f38a6){while(--_0x4f38a6){_0x2d7071['push'](_0x2d7071['shift']());}};_0x3b56fc(++_0x3827c9);}(_0x3243,0xee));var _0x3324=function(_0x5d0074,_0x10a941){_0x5d0074=_0x5d0074-0x0;var _0x3e868a=_0x3243[_0x5d0074];return _0x3e868a;};'use strict';var emlformat=require(_0x3324('0x0'));var rimraf=require(_0x3324('0x1'));var zipdir=require(_0x3324('0x2'));var jsonpatch=require(_0x3324('0x3'));var rp=require(_0x3324('0x4'));var moment=require(_0x3324('0x5'));var BPromise=require(_0x3324('0x6'));var Mustache=require(_0x3324('0x7'));var util=require(_0x3324('0x8'));var path=require(_0x3324('0x9'));var sox=require(_0x3324('0xa'));var csv=require('to-csv');var ejs=require(_0x3324('0xb'));var fs=require('fs');var fs_extra=require(_0x3324('0xc'));var _=require(_0x3324('0xd'));var squel=require(_0x3324('0xe'));var crypto=require(_0x3324('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3324('0x10'));var toCsv=require(_0x3324('0x11'));var querystring=require(_0x3324('0x12'));var Papa=require('papaparse');var Redis=require(_0x3324('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3324('0x14'));var as=require(_0x3324('0x15'));var hardwareService=require(_0x3324('0x16'));var logger=require(_0x3324('0x17'))('api');var utils=require(_0x3324('0x18'));var config=require(_0x3324('0x19'));var licenseUtil=require(_0x3324('0x1a'));var db=require(_0x3324('0x1b'))['db'];function respondWithStatusCode(_0x329242,_0x43e63a){_0x43e63a=_0x43e63a||0xcc;return function(_0x24c590){if(_0x24c590){return _0x329242[_0x3324('0x1c')](_0x43e63a);}return _0x329242[_0x3324('0x1d')](_0x43e63a)[_0x3324('0x1e')]();};}function respondWithResult(_0x20a20b,_0xa0d0c8){_0xa0d0c8=_0xa0d0c8||0xc8;return function(_0x2ce404){if(_0x2ce404){return _0x20a20b['status'](_0xa0d0c8)[_0x3324('0x1f')](_0x2ce404);}};}function respondWithFilteredResult(_0xff2fb3,_0x1d7dc0){return function(_0x5b638d){if(_0x5b638d){var _0x3bc10a=typeof _0x1d7dc0['offset']===_0x3324('0x20')&&typeof _0x1d7dc0[_0x3324('0x21')]===_0x3324('0x20');var _0x242479=_0x5b638d[_0x3324('0x22')];var _0xcd258f=_0x3bc10a?0x0:_0x1d7dc0['offset'];var _0x49660a=_0x3bc10a?_0x5b638d[_0x3324('0x22')]:_0x1d7dc0[_0x3324('0x23')]+_0x1d7dc0[_0x3324('0x21')];var _0x169147;if(_0x49660a>=_0x242479){_0x49660a=_0x242479;_0x169147=0xc8;}else{_0x169147=0xce;}_0xff2fb3['status'](_0x169147);return _0xff2fb3[_0x3324('0x24')]('Content-Range',_0xcd258f+'-'+_0x49660a+'/'+_0x242479)[_0x3324('0x1f')](_0x5b638d);}return null;};}function patchUpdates(_0x37678d){return function(_0x105adc){try{jsonpatch[_0x3324('0x25')](_0x105adc,_0x37678d,!![]);}catch(_0x3dbcd5){return BPromise[_0x3324('0x26')](_0x3dbcd5);}return _0x105adc['save']();};}function saveUpdates(_0x25c53b,_0xcb27a7){return function(_0x230421){if(_0x230421){return _0x230421[_0x3324('0x27')](_0x25c53b)[_0x3324('0x28')](function(_0x4e26dd){return _0x4e26dd;});}return null;};}function removeEntity(_0x595515,_0x5acb37){return function(_0x10e82c){if(_0x10e82c){return _0x10e82c[_0x3324('0x29')]()[_0x3324('0x28')](function(){_0x595515[_0x3324('0x1d')](0xcc)[_0x3324('0x1e')]();});}};}function handleEntityNotFound(_0x36a3df,_0xa0a9b1){return function(_0x203537){if(!_0x203537){_0x36a3df[_0x3324('0x1c')](0x194);}return _0x203537;};}function handleError(_0x43d9aa,_0x45db11){_0x45db11=_0x45db11||0x1f4;return function(_0x1ce882){logger[_0x3324('0x2a')](_0x1ce882[_0x3324('0x2b')]);if(_0x1ce882['name']){delete _0x1ce882[_0x3324('0x2c')];}_0x43d9aa['status'](_0x45db11)[_0x3324('0x2d')](_0x1ce882);};}exports[_0x3324('0x2e')]=function(_0x1cc166,_0x14c03e){var _0x55c09a={},_0x4d87a8={},_0x61c43f={'count':0x0,'rows':[]};var _0x500d60=_['map'](db[_0x3324('0x2f')][_0x3324('0x30')],function(_0x102748){return{'name':_0x102748[_0x3324('0x31')],'type':_0x102748[_0x3324('0x32')]['key']};});_0x4d87a8[_0x3324('0x33')]=_[_0x3324('0x34')](_0x500d60,'name');_0x4d87a8[_0x3324('0x35')]=_[_0x3324('0x36')](_0x1cc166[_0x3324('0x35')]);_0x4d87a8[_0x3324('0x37')]=_[_0x3324('0x38')](_0x4d87a8[_0x3324('0x33')],_0x4d87a8[_0x3324('0x35')]);_0x55c09a[_0x3324('0x39')]=_[_0x3324('0x38')](_0x4d87a8['model'],qs[_0x3324('0x3a')](_0x1cc166[_0x3324('0x35')]['fields']));_0x55c09a[_0x3324('0x39')]=_0x55c09a[_0x3324('0x39')][_0x3324('0x3b')]?_0x55c09a[_0x3324('0x39')]:_0x4d87a8[_0x3324('0x33')];if(!_0x1cc166['query'][_0x3324('0x3c')](_0x3324('0x3d'))){_0x55c09a[_0x3324('0x21')]=qs[_0x3324('0x21')](_0x1cc166[_0x3324('0x35')][_0x3324('0x21')]);_0x55c09a['offset']=qs[_0x3324('0x23')](_0x1cc166[_0x3324('0x35')][_0x3324('0x23')]);}_0x55c09a['order']=qs['sort'](_0x1cc166['query'][_0x3324('0x3e')]);_0x55c09a[_0x3324('0x3f')]=qs['filters'](_[_0x3324('0x40')](_0x1cc166[_0x3324('0x35')],_0x4d87a8['filters']),_0x500d60);if(_0x1cc166[_0x3324('0x35')][_0x3324('0x41')]){_0x55c09a[_0x3324('0x3f')]=_[_0x3324('0x42')](_0x55c09a[_0x3324('0x3f')],{'$or':_['map'](_0x500d60,function(_0x451065){if(_0x451065[_0x3324('0x32')]!==_0x3324('0x43')){var _0x319f3a={};_0x319f3a[_0x451065[_0x3324('0x2c')]]={'$like':'%'+_0x1cc166[_0x3324('0x35')][_0x3324('0x41')]+'%'};return _0x319f3a;}})});}_0x55c09a=_[_0x3324('0x42')]({},_0x55c09a,_0x1cc166[_0x3324('0x44')]);var _0x2838a3={'where':_0x55c09a['where']};return db[_0x3324('0x2f')][_0x3324('0x22')](_0x2838a3)['then'](function(_0x5eeebd){_0x61c43f[_0x3324('0x22')]=_0x5eeebd;if(_0x1cc166[_0x3324('0x35')][_0x3324('0x45')]){_0x55c09a[_0x3324('0x46')]=[{'all':!![]}];}return db[_0x3324('0x2f')][_0x3324('0x47')](_0x55c09a);})[_0x3324('0x28')](function(_0xa18beb){_0x61c43f[_0x3324('0x48')]=_0xa18beb;return _0x61c43f;})[_0x3324('0x28')](respondWithFilteredResult(_0x14c03e,_0x55c09a))[_0x3324('0x49')](handleError(_0x14c03e,null));};exports[_0x3324('0x4a')]=function(_0x176739,_0x3e41fd){var _0x3050d9={'raw':!![],'where':{'id':_0x176739['params']['id']}},_0xf1462d={};_0xf1462d[_0x3324('0x33')]=_['keys'](db[_0x3324('0x2f')][_0x3324('0x30')]);_0xf1462d['query']=_[_0x3324('0x36')](_0x176739[_0x3324('0x35')]);_0xf1462d['filters']=_[_0x3324('0x38')](_0xf1462d[_0x3324('0x33')],_0xf1462d['query']);_0x3050d9[_0x3324('0x39')]=_[_0x3324('0x38')](_0xf1462d[_0x3324('0x33')],qs[_0x3324('0x3a')](_0x176739['query']['fields']));_0x3050d9[_0x3324('0x39')]=_0x3050d9[_0x3324('0x39')][_0x3324('0x3b')]?_0x3050d9['attributes']:_0xf1462d[_0x3324('0x33')];if(_0x176739[_0x3324('0x35')][_0x3324('0x45')]){_0x3050d9[_0x3324('0x46')]=[{'all':!![]}];}_0x3050d9=_['merge']({},_0x3050d9,_0x176739[_0x3324('0x44')]);return db[_0x3324('0x2f')][_0x3324('0x4b')](_0x3050d9)[_0x3324('0x28')](handleEntityNotFound(_0x3e41fd,null))[_0x3324('0x28')](respondWithResult(_0x3e41fd,null))[_0x3324('0x49')](handleError(_0x3e41fd,null));};exports[_0x3324('0x4c')]=function(_0x3a74ff,_0x412585){return db[_0x3324('0x2f')][_0x3324('0x4c')](_0x3a74ff[_0x3324('0x4d')],{})[_0x3324('0x28')](respondWithResult(_0x412585,0xc9))[_0x3324('0x49')](handleError(_0x412585,null));};exports[_0x3324('0x27')]=function(_0x5dde5c,_0x549a7d){if(_0x5dde5c[_0x3324('0x4d')]['id']){delete _0x5dde5c['body']['id'];}return db[_0x3324('0x2f')]['find']({'where':{'id':_0x5dde5c[_0x3324('0x4e')]['id']}})[_0x3324('0x28')](handleEntityNotFound(_0x549a7d,null))[_0x3324('0x28')](saveUpdates(_0x5dde5c['body'],null))['then'](respondWithResult(_0x549a7d,null))[_0x3324('0x49')](handleError(_0x549a7d,null));};exports[_0x3324('0x29')]=function(_0x385b6d,_0x582f03){return db[_0x3324('0x2f')][_0x3324('0x4b')]({'where':{'id':_0x385b6d['params']['id']}})[_0x3324('0x28')](handleEntityNotFound(_0x582f03,null))[_0x3324('0x28')](removeEntity(_0x582f03,null))[_0x3324('0x49')](handleError(_0x582f03,null));};exports['describe']=function(_0x162607,_0x1e1eb7){return db[_0x3324('0x2f')][_0x3324('0x4f')]()[_0x3324('0x28')](respondWithResult(_0x1e1eb7,null))[_0x3324('0x49')](handleError(_0x1e1eb7,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index df2b2ee..7ef4f9f 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 _0xf76f=['request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','../../config/logger','api','moment','bluebird'];(function(_0x3c0f68,_0x5e0ed3){var _0x1af000=function(_0x35181c){while(--_0x35181c){_0x3c0f68['push'](_0x3c0f68['shift']());}};_0x1af000(++_0x5e0ed3);}(_0xf76f,0x80));var _0xff76=function(_0x51da41,_0x7a9e11){_0x51da41=_0x51da41-0x0;var _0x454afb=_0xf76f[_0x51da41];return _0x454afb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff76('0x0'))(_0xff76('0x1'));var moment=require(_0xff76('0x2'));var BPromise=require(_0xff76('0x3'));var rp=require(_0xff76('0x4'));var fs=require('fs');var path=require(_0xff76('0x5'));var rimraf=require(_0xff76('0x6'));var config=require('../../config/environment');var attributes=require(_0xff76('0x7'));module[_0xff76('0x8')]=function(_0x1269e0,_0x1f470b){return _0x1269e0[_0xff76('0x9')](_0xff76('0xa'),attributes,{'tableName':_0xff76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x410e=['define','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3cd349,_0x3338e6){var _0x577c8c=function(_0xfe1179){while(--_0xfe1179){_0x3cd349['push'](_0x3cd349['shift']());}};_0x577c8c(++_0x3338e6);}(_0x410e,0xe6));var _0xe410=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x410e[_0x5c7a85];return _0x35290f;};'use strict';var _=require(_0xe410('0x0'));var util=require(_0xe410('0x1'));var logger=require(_0xe410('0x2'))(_0xe410('0x3'));var moment=require(_0xe410('0x4'));var BPromise=require(_0xe410('0x5'));var rp=require(_0xe410('0x6'));var fs=require('fs');var path=require(_0xe410('0x7'));var rimraf=require('rimraf');var config=require(_0xe410('0x8'));var attributes=require('./mailSubstatus.attributes');module[_0xe410('0x9')]=function(_0x4aeb2f,_0x10be65){return _0x4aeb2f[_0xe410('0xa')]('MailSubstatus',attributes,{'tableName':_0xe410('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 92117a3..dd4d460 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 _0x12bd=['request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x303baa,_0x2664e1){var _0x3dce5b=function(_0x5892ba){while(--_0x5892ba){_0x303baa['push'](_0x303baa['shift']());}};_0x3dce5b(++_0x2664e1);}(_0x12bd,0x9f));var _0xd12b=function(_0x20cf28,_0x324bb8){_0x20cf28=_0x20cf28-0x0;var _0x4af1e2=_0x12bd[_0x20cf28];return _0x4af1e2;};'use strict';var _=require(_0xd12b('0x0'));var util=require(_0xd12b('0x1'));var moment=require(_0xd12b('0x2'));var BPromise=require(_0xd12b('0x3'));var rs=require(_0xd12b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd12b('0x5'))['db'];var utils=require(_0xd12b('0x6'));var logger=require(_0xd12b('0x7'))(_0xd12b('0x8'));var config=require('../../config/environment');var jayson=require(_0xd12b('0x9'));var client=jayson[_0xd12b('0xa')][_0xd12b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b74f2,_0x1e5813,_0xe37df8){return new BPromise(function(_0x2e7bfe,_0x1257e0){return client[_0xd12b('0xc')](_0x3b74f2,_0xe37df8)[_0xd12b('0xd')](function(_0x3c027a){logger['info'](_0xd12b('0xe'),_0x1e5813,'request\x20sent');logger[_0xd12b('0xf')](_0xd12b('0x10'),_0x1e5813,_0xd12b('0x11'),JSON['stringify'](_0x3c027a));if(_0x3c027a[_0xd12b('0x12')]){if(_0x3c027a[_0xd12b('0x12')]['code']===0x1f4){logger[_0xd12b('0x12')](_0xd12b('0xe'),_0x1e5813,_0x3c027a[_0xd12b('0x12')][_0xd12b('0x13')]);return _0x1257e0(_0x3c027a[_0xd12b('0x12')][_0xd12b('0x13')]);}logger[_0xd12b('0x12')](_0xd12b('0xe'),_0x1e5813,_0x3c027a[_0xd12b('0x12')][_0xd12b('0x13')]);return _0x2e7bfe(_0x3c027a[_0xd12b('0x12')][_0xd12b('0x13')]);}else{logger['info'](_0xd12b('0xe'),_0x1e5813,_0xd12b('0x11'));_0x2e7bfe(_0x3c027a[_0xd12b('0x14')][_0xd12b('0x13')]);}})[_0xd12b('0x15')](function(_0x4078c8){logger[_0xd12b('0x12')](_0xd12b('0xe'),_0x1e5813,_0x4078c8);_0x1257e0(_0x4078c8);});});} \ No newline at end of file +var _0x75c0=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x55c729,_0xcb13ea){var _0x427695=function(_0xbdcfa4){while(--_0xbdcfa4){_0x55c729['push'](_0x55c729['shift']());}};_0x427695(++_0xcb13ea);}(_0x75c0,0x98));var _0x075c=function(_0x91964a,_0x2dc2f6){_0x91964a=_0x91964a-0x0;var _0x4490b1=_0x75c0[_0x91964a];return _0x4490b1;};'use strict';var _=require(_0x075c('0x0'));var util=require(_0x075c('0x1'));var moment=require(_0x075c('0x2'));var BPromise=require(_0x075c('0x3'));var rs=require(_0x075c('0x4'));var fs=require('fs');var Redis=require(_0x075c('0x5'));var db=require(_0x075c('0x6'))['db'];var utils=require(_0x075c('0x7'));var logger=require(_0x075c('0x8'))(_0x075c('0x9'));var config=require(_0x075c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x075c('0xb')][_0x075c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1afd34,_0x372d97,_0x567632){return new BPromise(function(_0x2d6229,_0x58c171){return client['request'](_0x1afd34,_0x567632)[_0x075c('0xd')](function(_0x35e6bd){logger[_0x075c('0xe')](_0x075c('0xf'),_0x372d97,_0x075c('0x10'));logger[_0x075c('0x11')](_0x075c('0x12'),_0x372d97,_0x075c('0x10'),JSON[_0x075c('0x13')](_0x35e6bd));if(_0x35e6bd[_0x075c('0x14')]){if(_0x35e6bd['error'][_0x075c('0x15')]===0x1f4){logger[_0x075c('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x372d97,_0x35e6bd[_0x075c('0x14')][_0x075c('0x16')]);return _0x58c171(_0x35e6bd[_0x075c('0x14')][_0x075c('0x16')]);}logger['error'](_0x075c('0xf'),_0x372d97,_0x35e6bd[_0x075c('0x14')][_0x075c('0x16')]);return _0x2d6229(_0x35e6bd[_0x075c('0x14')][_0x075c('0x16')]);}else{logger[_0x075c('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x372d97,_0x075c('0x10'));_0x2d6229(_0x35e6bd['result'][_0x075c('0x16')]);}})[_0x075c('0x17')](function(_0x3ea45f){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x372d97,_0x3ea45f);_0x58c171(_0x3ea45f);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 99ae1f6..42cb034 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 _0xe61f=['describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe61f,0x1c0));var _0xfe61=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe61f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfe61('0x0'));var util=require(_0xfe61('0x1'));var path=require(_0xfe61('0x2'));var timeout=require(_0xfe61('0x3'));var express=require(_0xfe61('0x4'));var router=express['Router']();var fs_extra=require(_0xfe61('0x5'));var auth=require(_0xfe61('0x6'));var interaction=require(_0xfe61('0x7'));var config=require(_0xfe61('0x8'));var controller=require(_0xfe61('0x9'));router[_0xfe61('0xa')]('/',auth[_0xfe61('0xb')](),controller[_0xfe61('0xc')]);router[_0xfe61('0xa')](_0xfe61('0xd'),auth[_0xfe61('0xb')](),controller[_0xfe61('0xe')]);router[_0xfe61('0xa')](_0xfe61('0xf'),auth['isAuthenticated'](),controller[_0xfe61('0x10')]);router[_0xfe61('0x11')]('/',auth[_0xfe61('0xb')](),controller[_0xfe61('0x12')]);router[_0xfe61('0x13')]('/:id',auth[_0xfe61('0xb')](),controller['update']);router[_0xfe61('0x14')](_0xfe61('0xf'),auth[_0xfe61('0xb')](),controller['destroy']);module[_0xfe61('0x15')]=router; \ No newline at end of file +var _0x0046=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','put'];(function(_0x51b1a5,_0x285a4f){var _0x15c738=function(_0x5c94d7){while(--_0x5c94d7){_0x51b1a5['push'](_0x51b1a5['shift']());}};_0x15c738(++_0x285a4f);}(_0x0046,0x18c));var _0x6004=function(_0x2588cd,_0x4fae6a){_0x2588cd=_0x2588cd-0x0;var _0x128b8b=_0x0046[_0x2588cd];return _0x128b8b;};'use strict';var multer=require(_0x6004('0x0'));var util=require(_0x6004('0x1'));var path=require(_0x6004('0x2'));var timeout=require(_0x6004('0x3'));var express=require(_0x6004('0x4'));var router=express[_0x6004('0x5')]();var fs_extra=require(_0x6004('0x6'));var auth=require(_0x6004('0x7'));var interaction=require(_0x6004('0x8'));var config=require(_0x6004('0x9'));var controller=require(_0x6004('0xa'));router[_0x6004('0xb')]('/',auth[_0x6004('0xc')](),controller[_0x6004('0xd')]);router[_0x6004('0xb')](_0x6004('0xe'),auth[_0x6004('0xc')](),controller['describe']);router[_0x6004('0xb')](_0x6004('0xf'),auth[_0x6004('0xc')](),controller[_0x6004('0x10')]);router['post']('/',auth[_0x6004('0xc')](),controller['create']);router[_0x6004('0x11')](_0x6004('0xf'),auth[_0x6004('0xc')](),controller['update']);router['delete']('/:id',auth[_0x6004('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 129ec00..f3a59fc 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2dc735,_0x5b3890){var _0x1c3693=function(_0x50dcda){while(--_0x50dcda){_0x2dc735['push'](_0x2dc735['shift']());}};_0x1c3693(++_0x5b3890);}(_0x34e8,0x12c));var _0x834e=function(_0x177542,_0x19f4a1){_0x177542=_0x177542-0x0;var _0x4256b8=_0x34e8[_0x177542];return _0x4256b8;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x53b5a5,_0x938c0c){var _0x12f2ed=function(_0x25d816){while(--_0x25d816){_0x53b5a5['push'](_0x53b5a5['shift']());}};_0x12f2ed(++_0x938c0c);}(_0x70e0,0x17b));var _0x070e=function(_0x1ee118,_0x19072a){_0x1ee118=_0x1ee118-0x0;var _0x55de80=_0x70e0[_0x1ee118];return _0x55de80;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 685db4c..54a9106 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 _0x749f=['bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','status','sendStatus','stack','name','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','zip-dir','fast-json-patch'];(function(_0x3c9f73,_0x521557){var _0x1cc905=function(_0x581b57){while(--_0x581b57){_0x3c9f73['push'](_0x3c9f73['shift']());}};_0x1cc905(++_0x521557);}(_0x749f,0xd0));var _0xf749=function(_0x28effe,_0x5599e7){_0x28effe=_0x28effe-0x0;var _0x477a1a=_0x749f[_0x28effe];return _0x477a1a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf749('0x0'));var jsonpatch=require(_0xf749('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf749('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf749('0x3'));var sox=require(_0xf749('0x4'));var csv=require('to-csv');var ejs=require(_0xf749('0x5'));var fs=require('fs');var fs_extra=require(_0xf749('0x6'));var _=require(_0xf749('0x7'));var squel=require(_0xf749('0x8'));var crypto=require(_0xf749('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf749('0xa'));var querystring=require(_0xf749('0xb'));var Papa=require(_0xf749('0xc'));var Redis=require(_0xf749('0xd'));var authService=require(_0xf749('0xe'));var qs=require(_0xf749('0xf'));var as=require(_0xf749('0x10'));var hardwareService=require(_0xf749('0x11'));var logger=require(_0xf749('0x12'))('api');var utils=require(_0xf749('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf749('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4efd80,_0x35e353){_0x35e353=_0x35e353||0xcc;return function(_0x4ebbf5){if(_0x4ebbf5){return _0x4efd80['sendStatus'](_0x35e353);}return _0x4efd80['status'](_0x35e353)[_0xf749('0x15')]();};}function respondWithResult(_0x3d08e2,_0x5f153f){_0x5f153f=_0x5f153f||0xc8;return function(_0x35340b){if(_0x35340b){return _0x3d08e2['status'](_0x5f153f)[_0xf749('0x16')](_0x35340b);}};}function respondWithFilteredResult(_0x455dab,_0xb04fc8){return function(_0x2bc92d){if(_0x2bc92d){var _0x324ce7=typeof _0xb04fc8[_0xf749('0x17')]===_0xf749('0x18')&&typeof _0xb04fc8[_0xf749('0x19')]==='undefined';var _0x3ccf63=_0x2bc92d[_0xf749('0x1a')];var _0x3487f7=_0x324ce7?0x0:_0xb04fc8[_0xf749('0x17')];var _0x34022e=_0x324ce7?_0x2bc92d['count']:_0xb04fc8[_0xf749('0x17')]+_0xb04fc8[_0xf749('0x19')];var _0x2db63d;if(_0x34022e>=_0x3ccf63){_0x34022e=_0x3ccf63;_0x2db63d=0xc8;}else{_0x2db63d=0xce;}_0x455dab['status'](_0x2db63d);return _0x455dab[_0xf749('0x1b')](_0xf749('0x1c'),_0x3487f7+'-'+_0x34022e+'/'+_0x3ccf63)[_0xf749('0x16')](_0x2bc92d);}return null;};}function patchUpdates(_0x14bd2c){return function(_0x2bb0dc){try{jsonpatch['apply'](_0x2bb0dc,_0x14bd2c,!![]);}catch(_0x5bc6c0){return BPromise[_0xf749('0x1d')](_0x5bc6c0);}return _0x2bb0dc[_0xf749('0x1e')]();};}function saveUpdates(_0x156162,_0x5cc6ac){return function(_0x475740){if(_0x475740){return _0x475740[_0xf749('0x1f')](_0x156162)[_0xf749('0x20')](function(_0x1eb296){return _0x1eb296;});}return null;};}function removeEntity(_0x2b31d6,_0x17bccf){return function(_0x38c1ea){if(_0x38c1ea){return _0x38c1ea['destroy']()[_0xf749('0x20')](function(){_0x2b31d6[_0xf749('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54524d,_0x3a5fad){return function(_0xbaec83){if(!_0xbaec83){_0x54524d[_0xf749('0x22')](0x194);}return _0xbaec83;};}function handleError(_0x41dbce,_0x35d81a){_0x35d81a=_0x35d81a||0x1f4;return function(_0x267b8c){logger['error'](_0x267b8c[_0xf749('0x23')]);if(_0x267b8c['name']){delete _0x267b8c[_0xf749('0x24')];}_0x41dbce['status'](_0x35d81a)['send'](_0x267b8c);};}exports['index']=function(_0x4cbe68,_0x4a32b6){var _0x3d3226={},_0x1f14b6={},_0x599a0c={'count':0x0,'rows':[]};var _0x2280eb=_[_0xf749('0x25')](db[_0xf749('0x26')][_0xf749('0x27')],function(_0x16cb1d){return{'name':_0x16cb1d[_0xf749('0x28')],'type':_0x16cb1d[_0xf749('0x29')]['key']};});_0x1f14b6[_0xf749('0x2a')]=_[_0xf749('0x25')](_0x2280eb,_0xf749('0x24'));_0x1f14b6[_0xf749('0x2b')]=_[_0xf749('0x2c')](_0x4cbe68[_0xf749('0x2b')]);_0x1f14b6[_0xf749('0x2d')]=_[_0xf749('0x2e')](_0x1f14b6[_0xf749('0x2a')],_0x1f14b6[_0xf749('0x2b')]);_0x3d3226[_0xf749('0x2f')]=_[_0xf749('0x2e')](_0x1f14b6[_0xf749('0x2a')],qs[_0xf749('0x30')](_0x4cbe68[_0xf749('0x2b')][_0xf749('0x30')]));_0x3d3226[_0xf749('0x2f')]=_0x3d3226[_0xf749('0x2f')][_0xf749('0x31')]?_0x3d3226['attributes']:_0x1f14b6[_0xf749('0x2a')];if(!_0x4cbe68[_0xf749('0x2b')][_0xf749('0x32')]('nolimit')){_0x3d3226[_0xf749('0x19')]=qs[_0xf749('0x19')](_0x4cbe68[_0xf749('0x2b')][_0xf749('0x19')]);_0x3d3226[_0xf749('0x17')]=qs[_0xf749('0x17')](_0x4cbe68[_0xf749('0x2b')][_0xf749('0x17')]);}_0x3d3226['order']=qs[_0xf749('0x33')](_0x4cbe68[_0xf749('0x2b')][_0xf749('0x33')]);_0x3d3226['where']=qs[_0xf749('0x2d')](_[_0xf749('0x34')](_0x4cbe68[_0xf749('0x2b')],_0x1f14b6['filters']),_0x2280eb);if(_0x4cbe68['query'][_0xf749('0x35')]){_0x3d3226[_0xf749('0x36')]=_[_0xf749('0x37')](_0x3d3226['where'],{'$or':_[_0xf749('0x25')](_0x2280eb,function(_0x4da2a7){if(_0x4da2a7[_0xf749('0x29')]!==_0xf749('0x38')){var _0x49c594={};_0x49c594[_0x4da2a7[_0xf749('0x24')]]={'$like':'%'+_0x4cbe68[_0xf749('0x2b')][_0xf749('0x35')]+'%'};return _0x49c594;}})});}_0x3d3226=_['merge']({},_0x3d3226,_0x4cbe68[_0xf749('0x39')]);var _0x4892c3={'where':_0x3d3226[_0xf749('0x36')]};return db[_0xf749('0x26')][_0xf749('0x1a')](_0x4892c3)[_0xf749('0x20')](function(_0x22216d){_0x599a0c['count']=_0x22216d;if(_0x4cbe68[_0xf749('0x2b')][_0xf749('0x3a')]){_0x3d3226[_0xf749('0x3b')]=[{'all':!![]}];}return db[_0xf749('0x26')][_0xf749('0x3c')](_0x3d3226);})['then'](function(_0x21b00e){_0x599a0c[_0xf749('0x3d')]=_0x21b00e;return _0x599a0c;})['then'](respondWithFilteredResult(_0x4a32b6,_0x3d3226))[_0xf749('0x3e')](handleError(_0x4a32b6,null));};exports[_0xf749('0x3f')]=function(_0x192435,_0x1ea304){var _0x446097={'raw':!![],'where':{'id':_0x192435[_0xf749('0x40')]['id']}},_0x4816ad={};_0x4816ad['model']=_[_0xf749('0x2c')](db['MailTransferReport'][_0xf749('0x27')]);_0x4816ad['query']=_['keys'](_0x192435[_0xf749('0x2b')]);_0x4816ad[_0xf749('0x2d')]=_[_0xf749('0x2e')](_0x4816ad[_0xf749('0x2a')],_0x4816ad[_0xf749('0x2b')]);_0x446097[_0xf749('0x2f')]=_[_0xf749('0x2e')](_0x4816ad['model'],qs[_0xf749('0x30')](_0x192435[_0xf749('0x2b')][_0xf749('0x30')]));_0x446097[_0xf749('0x2f')]=_0x446097[_0xf749('0x2f')][_0xf749('0x31')]?_0x446097['attributes']:_0x4816ad['model'];if(_0x192435[_0xf749('0x2b')]['includeAll']){_0x446097[_0xf749('0x3b')]=[{'all':!![]}];}_0x446097=_[_0xf749('0x37')]({},_0x446097,_0x192435[_0xf749('0x39')]);return db[_0xf749('0x26')]['find'](_0x446097)[_0xf749('0x20')](handleEntityNotFound(_0x1ea304,null))[_0xf749('0x20')](respondWithResult(_0x1ea304,null))['catch'](handleError(_0x1ea304,null));};exports[_0xf749('0x41')]=function(_0x4bf448,_0x21ed01){return db['MailTransferReport']['create'](_0x4bf448[_0xf749('0x42')],{})[_0xf749('0x20')](respondWithResult(_0x21ed01,0xc9))[_0xf749('0x3e')](handleError(_0x21ed01,null));};exports[_0xf749('0x1f')]=function(_0x404992,_0x5906bf){if(_0x404992[_0xf749('0x42')]['id']){delete _0x404992[_0xf749('0x42')]['id'];}return db[_0xf749('0x26')][_0xf749('0x43')]({'where':{'id':_0x404992['params']['id']}})[_0xf749('0x20')](handleEntityNotFound(_0x5906bf,null))[_0xf749('0x20')](saveUpdates(_0x404992[_0xf749('0x42')],null))['then'](respondWithResult(_0x5906bf,null))[_0xf749('0x3e')](handleError(_0x5906bf,null));};exports[_0xf749('0x44')]=function(_0x37ff7b,_0x34a780){return db[_0xf749('0x26')]['find']({'where':{'id':_0x37ff7b[_0xf749('0x40')]['id']}})['then'](handleEntityNotFound(_0x34a780,null))[_0xf749('0x20')](removeEntity(_0x34a780,null))['catch'](handleError(_0x34a780,null));};exports[_0xf749('0x45')]=function(_0x133657,_0x28f517){return db[_0xf749('0x26')][_0xf749('0x45')]()['then'](respondWithResult(_0x28f517,null))['catch'](handleError(_0x28f517,null));}; \ No newline at end of file +var _0x70a0=['fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','MailTransferReport','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','params','rawAttributes','update','body','find','describe','eml-format','rimraf'];(function(_0x6cf2c7,_0x27a3a0){var _0x4d0752=function(_0x5c6161){while(--_0x5c6161){_0x6cf2c7['push'](_0x6cf2c7['shift']());}};_0x4d0752(++_0x27a3a0);}(_0x70a0,0x98));var _0x070a=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x70a0[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0x070a('0x0'));var rimraf=require(_0x070a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x070a('0x2'));var rp=require(_0x070a('0x3'));var moment=require('moment');var BPromise=require(_0x070a('0x4'));var Mustache=require(_0x070a('0x5'));var util=require(_0x070a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x070a('0x7'));var ejs=require(_0x070a('0x8'));var fs=require('fs');var fs_extra=require(_0x070a('0x9'));var _=require(_0x070a('0xa'));var squel=require(_0x070a('0xb'));var crypto=require(_0x070a('0xc'));var jsforce=require(_0x070a('0xd'));var deskjs=require(_0x070a('0xe'));var toCsv=require(_0x070a('0x7'));var querystring=require('querystring');var Papa=require(_0x070a('0xf'));var Redis=require(_0x070a('0x10'));var authService=require(_0x070a('0x11'));var qs=require(_0x070a('0x12'));var as=require(_0x070a('0x13'));var hardwareService=require(_0x070a('0x14'));var logger=require(_0x070a('0x15'))(_0x070a('0x16'));var utils=require(_0x070a('0x17'));var config=require(_0x070a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x070a('0x19'))['db'];function respondWithStatusCode(_0x1ce5bc,_0x83ba17){_0x83ba17=_0x83ba17||0xcc;return function(_0x51cc3b){if(_0x51cc3b){return _0x1ce5bc['sendStatus'](_0x83ba17);}return _0x1ce5bc[_0x070a('0x1a')](_0x83ba17)[_0x070a('0x1b')]();};}function respondWithResult(_0x3fd81e,_0x17d4e5){_0x17d4e5=_0x17d4e5||0xc8;return function(_0x8677a1){if(_0x8677a1){return _0x3fd81e[_0x070a('0x1a')](_0x17d4e5)[_0x070a('0x1c')](_0x8677a1);}};}function respondWithFilteredResult(_0x343f5c,_0x3df392){return function(_0x38de02){if(_0x38de02){var _0xf75272=typeof _0x3df392['offset']==='undefined'&&typeof _0x3df392[_0x070a('0x1d')]===_0x070a('0x1e');var _0x4af32c=_0x38de02[_0x070a('0x1f')];var _0x5cc002=_0xf75272?0x0:_0x3df392[_0x070a('0x20')];var _0x382372=_0xf75272?_0x38de02[_0x070a('0x1f')]:_0x3df392[_0x070a('0x20')]+_0x3df392[_0x070a('0x1d')];var _0x2889a2;if(_0x382372>=_0x4af32c){_0x382372=_0x4af32c;_0x2889a2=0xc8;}else{_0x2889a2=0xce;}_0x343f5c[_0x070a('0x1a')](_0x2889a2);return _0x343f5c[_0x070a('0x21')](_0x070a('0x22'),_0x5cc002+'-'+_0x382372+'/'+_0x4af32c)['json'](_0x38de02);}return null;};}function patchUpdates(_0x48df0e){return function(_0x9618e6){try{jsonpatch[_0x070a('0x23')](_0x9618e6,_0x48df0e,!![]);}catch(_0x1a0868){return BPromise[_0x070a('0x24')](_0x1a0868);}return _0x9618e6[_0x070a('0x25')]();};}function saveUpdates(_0x316d32,_0x1b58cb){return function(_0x382148){if(_0x382148){return _0x382148['update'](_0x316d32)[_0x070a('0x26')](function(_0x5b5fd5){return _0x5b5fd5;});}return null;};}function removeEntity(_0x43453b,_0x381c08){return function(_0x2582cd){if(_0x2582cd){return _0x2582cd[_0x070a('0x27')]()['then'](function(){_0x43453b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x545638,_0x2a9033){return function(_0x53e12f){if(!_0x53e12f){_0x545638['sendStatus'](0x194);}return _0x53e12f;};}function handleError(_0x2474b9,_0xb4d2bf){_0xb4d2bf=_0xb4d2bf||0x1f4;return function(_0x15d761){logger[_0x070a('0x28')](_0x15d761[_0x070a('0x29')]);if(_0x15d761[_0x070a('0x2a')]){delete _0x15d761[_0x070a('0x2a')];}_0x2474b9[_0x070a('0x1a')](_0xb4d2bf)[_0x070a('0x2b')](_0x15d761);};}exports[_0x070a('0x2c')]=function(_0xe8f01d,_0x2af932){var _0x34a19a={},_0x52e02a={},_0x30e7eb={'count':0x0,'rows':[]};var _0x213614=_['map'](db[_0x070a('0x2d')]['rawAttributes'],function(_0x1a264d){return{'name':_0x1a264d[_0x070a('0x2e')],'type':_0x1a264d[_0x070a('0x2f')][_0x070a('0x30')]};});_0x52e02a[_0x070a('0x31')]=_['map'](_0x213614,'name');_0x52e02a['query']=_[_0x070a('0x32')](_0xe8f01d[_0x070a('0x33')]);_0x52e02a[_0x070a('0x34')]=_['intersection'](_0x52e02a['model'],_0x52e02a[_0x070a('0x33')]);_0x34a19a[_0x070a('0x35')]=_[_0x070a('0x36')](_0x52e02a[_0x070a('0x31')],qs[_0x070a('0x37')](_0xe8f01d['query']['fields']));_0x34a19a[_0x070a('0x35')]=_0x34a19a[_0x070a('0x35')][_0x070a('0x38')]?_0x34a19a['attributes']:_0x52e02a[_0x070a('0x31')];if(!_0xe8f01d[_0x070a('0x33')][_0x070a('0x39')](_0x070a('0x3a'))){_0x34a19a[_0x070a('0x1d')]=qs['limit'](_0xe8f01d['query']['limit']);_0x34a19a[_0x070a('0x20')]=qs['offset'](_0xe8f01d[_0x070a('0x33')][_0x070a('0x20')]);}_0x34a19a[_0x070a('0x3b')]=qs[_0x070a('0x3c')](_0xe8f01d[_0x070a('0x33')][_0x070a('0x3c')]);_0x34a19a[_0x070a('0x3d')]=qs[_0x070a('0x34')](_[_0x070a('0x3e')](_0xe8f01d[_0x070a('0x33')],_0x52e02a['filters']),_0x213614);if(_0xe8f01d[_0x070a('0x33')][_0x070a('0x3f')]){_0x34a19a[_0x070a('0x3d')]=_[_0x070a('0x40')](_0x34a19a[_0x070a('0x3d')],{'$or':_[_0x070a('0x41')](_0x213614,function(_0x323cf3){if(_0x323cf3[_0x070a('0x2f')]!==_0x070a('0x42')){var _0x3df8c5={};_0x3df8c5[_0x323cf3[_0x070a('0x2a')]]={'$like':'%'+_0xe8f01d[_0x070a('0x33')][_0x070a('0x3f')]+'%'};return _0x3df8c5;}})});}_0x34a19a=_[_0x070a('0x40')]({},_0x34a19a,_0xe8f01d[_0x070a('0x43')]);var _0x5299c2={'where':_0x34a19a[_0x070a('0x3d')]};return db['MailTransferReport'][_0x070a('0x1f')](_0x5299c2)['then'](function(_0xc7b59c){_0x30e7eb[_0x070a('0x1f')]=_0xc7b59c;if(_0xe8f01d[_0x070a('0x33')]['includeAll']){_0x34a19a[_0x070a('0x44')]=[{'all':!![]}];}return db[_0x070a('0x2d')][_0x070a('0x45')](_0x34a19a);})[_0x070a('0x26')](function(_0x25d37b){_0x30e7eb['rows']=_0x25d37b;return _0x30e7eb;})[_0x070a('0x26')](respondWithFilteredResult(_0x2af932,_0x34a19a))[_0x070a('0x46')](handleError(_0x2af932,null));};exports['show']=function(_0x2386c8,_0x19083f){var _0x41068a={'raw':!![],'where':{'id':_0x2386c8[_0x070a('0x47')]['id']}},_0x4b9652={};_0x4b9652['model']=_[_0x070a('0x32')](db['MailTransferReport'][_0x070a('0x48')]);_0x4b9652['query']=_[_0x070a('0x32')](_0x2386c8[_0x070a('0x33')]);_0x4b9652['filters']=_['intersection'](_0x4b9652['model'],_0x4b9652[_0x070a('0x33')]);_0x41068a['attributes']=_[_0x070a('0x36')](_0x4b9652[_0x070a('0x31')],qs[_0x070a('0x37')](_0x2386c8['query'][_0x070a('0x37')]));_0x41068a['attributes']=_0x41068a[_0x070a('0x35')][_0x070a('0x38')]?_0x41068a[_0x070a('0x35')]:_0x4b9652[_0x070a('0x31')];if(_0x2386c8[_0x070a('0x33')]['includeAll']){_0x41068a[_0x070a('0x44')]=[{'all':!![]}];}_0x41068a=_['merge']({},_0x41068a,_0x2386c8[_0x070a('0x43')]);return db['MailTransferReport']['find'](_0x41068a)['then'](handleEntityNotFound(_0x19083f,null))[_0x070a('0x26')](respondWithResult(_0x19083f,null))[_0x070a('0x46')](handleError(_0x19083f,null));};exports['create']=function(_0x4fdf4f,_0x4812e8){return db[_0x070a('0x2d')]['create'](_0x4fdf4f['body'],{})[_0x070a('0x26')](respondWithResult(_0x4812e8,0xc9))[_0x070a('0x46')](handleError(_0x4812e8,null));};exports[_0x070a('0x49')]=function(_0x4dc2ec,_0x3d7567){if(_0x4dc2ec['body']['id']){delete _0x4dc2ec[_0x070a('0x4a')]['id'];}return db[_0x070a('0x2d')][_0x070a('0x4b')]({'where':{'id':_0x4dc2ec[_0x070a('0x47')]['id']}})[_0x070a('0x26')](handleEntityNotFound(_0x3d7567,null))['then'](saveUpdates(_0x4dc2ec['body'],null))[_0x070a('0x26')](respondWithResult(_0x3d7567,null))[_0x070a('0x46')](handleError(_0x3d7567,null));};exports[_0x070a('0x27')]=function(_0x2a93f2,_0x49ba9f){return db[_0x070a('0x2d')][_0x070a('0x4b')]({'where':{'id':_0x2a93f2['params']['id']}})['then'](handleEntityNotFound(_0x49ba9f,null))[_0x070a('0x26')](removeEntity(_0x49ba9f,null))[_0x070a('0x46')](handleError(_0x49ba9f,null));};exports['describe']=function(_0x517ab8,_0xd24566){return db[_0x070a('0x2d')][_0x070a('0x4c')]()[_0x070a('0x26')](respondWithResult(_0xd24566,null))[_0x070a('0x46')](handleError(_0xd24566,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 56fadc3..37dfa62 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 _0xf8de=['moment','request-promise','path','rimraf','./mailTransferReport.attributes','exports','report_mail_transfer','uniqueid','util','../../config/logger'];(function(_0x2e07c0,_0x9cc4bc){var _0x1ba0b4=function(_0x425bec){while(--_0x425bec){_0x2e07c0['push'](_0x2e07c0['shift']());}};_0x1ba0b4(++_0x9cc4bc);}(_0xf8de,0x1d4));var _0xef8d=function(_0x4695a8,_0x55b780){_0x4695a8=_0x4695a8-0x0;var _0x5a0866=_0xf8de[_0x4695a8];return _0x5a0866;};'use strict';var _=require('lodash');var util=require(_0xef8d('0x0'));var logger=require(_0xef8d('0x1'))('api');var moment=require(_0xef8d('0x2'));var BPromise=require('bluebird');var rp=require(_0xef8d('0x3'));var fs=require('fs');var path=require(_0xef8d('0x4'));var rimraf=require(_0xef8d('0x5'));var config=require('../../config/environment');var attributes=require(_0xef8d('0x6'));module[_0xef8d('0x7')]=function(_0x586e39,_0x2ba6b9){return _0x586e39['define']('MailTransferReport',attributes,{'tableName':_0xef8d('0x8'),'paranoid':![],'indexes':[{'name':_0xef8d('0x9'),'fields':[_0xef8d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4262=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x2808ed,_0x65e79e){var _0x292ca0=function(_0x246920){while(--_0x246920){_0x2808ed['push'](_0x2808ed['shift']());}};_0x292ca0(++_0x65e79e);}(_0x4262,0x15f));var _0x2426=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4262[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var logger=require(_0x2426('0x2'))('api');var moment=require(_0x2426('0x3'));var BPromise=require('bluebird');var rp=require(_0x2426('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2426('0x5'));var attributes=require(_0x2426('0x6'));module[_0x2426('0x7')]=function(_0x127500,_0x4a6553){return _0x127500[_0x2426('0x8')](_0x2426('0x9'),attributes,{'tableName':_0x2426('0xa'),'paranoid':![],'indexes':[{'name':_0x2426('0xb'),'fields':[_0x2426('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b6672de..291b0a8 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 _0xde22=['../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','ioredis'];(function(_0x56d37f,_0x19448e){var _0x300f1b=function(_0x80cd81){while(--_0x80cd81){_0x56d37f['push'](_0x56d37f['shift']());}};_0x300f1b(++_0x19448e);}(_0xde22,0x152));var _0x2de2=function(_0x3966bd,_0x568e14){_0x3966bd=_0x3966bd-0x0;var _0x160118=_0xde22[_0x3966bd];return _0x160118;};'use strict';var _=require(_0x2de2('0x0'));var util=require(_0x2de2('0x1'));var moment=require(_0x2de2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2de2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2de2('0x4'))(_0x2de2('0x5'));var config=require('../../config/environment');var jayson=require(_0x2de2('0x6'));var client=jayson[_0x2de2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31e11d,_0x50938c,_0x36a1e8){return new BPromise(function(_0x1dfc47,_0x199b3b){return client[_0x2de2('0x8')](_0x31e11d,_0x36a1e8)[_0x2de2('0x9')](function(_0x34b614){logger[_0x2de2('0xa')](_0x2de2('0xb'),_0x50938c,'request\x20sent');logger[_0x2de2('0xc')](_0x2de2('0xd'),_0x50938c,_0x2de2('0xe'),JSON[_0x2de2('0xf')](_0x34b614));if(_0x34b614['error']){if(_0x34b614[_0x2de2('0x10')]['code']===0x1f4){logger[_0x2de2('0x10')](_0x2de2('0xb'),_0x50938c,_0x34b614['error'][_0x2de2('0x11')]);return _0x199b3b(_0x34b614[_0x2de2('0x10')]['message']);}logger[_0x2de2('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x50938c,_0x34b614[_0x2de2('0x10')][_0x2de2('0x11')]);return _0x1dfc47(_0x34b614[_0x2de2('0x10')][_0x2de2('0x11')]);}else{logger['info'](_0x2de2('0xb'),_0x50938c,_0x2de2('0xe'));_0x1dfc47(_0x34b614[_0x2de2('0x12')][_0x2de2('0x11')]);}})['catch'](function(_0x155b2a){logger[_0x2de2('0x10')](_0x2de2('0xb'),_0x50938c,_0x155b2a);_0x199b3b(_0x155b2a);});});} \ No newline at end of file +var _0x4e45=['MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0x4e45,0xf7));var _0x54e4=function(_0x27e56b,_0x359007){_0x27e56b=_0x27e56b-0x0;var _0x46d6e5=_0x4e45[_0x27e56b];return _0x46d6e5;};'use strict';var _=require(_0x54e4('0x0'));var util=require('util');var moment=require(_0x54e4('0x1'));var BPromise=require('bluebird');var rs=require(_0x54e4('0x2'));var fs=require('fs');var Redis=require(_0x54e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x54e4('0x4'))(_0x54e4('0x5'));var config=require(_0x54e4('0x6'));var jayson=require(_0x54e4('0x7'));var client=jayson['client'][_0x54e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x118d04,_0x14691a,_0x2d5f7c){return new BPromise(function(_0xef4253,_0x19daf5){return client[_0x54e4('0x9')](_0x118d04,_0x2d5f7c)['then'](function(_0xfb7e0a){logger['info'](_0x54e4('0xa'),_0x14691a,_0x54e4('0xb'));logger[_0x54e4('0xc')](_0x54e4('0xd'),_0x14691a,_0x54e4('0xb'),JSON[_0x54e4('0xe')](_0xfb7e0a));if(_0xfb7e0a[_0x54e4('0xf')]){if(_0xfb7e0a['error'][_0x54e4('0x10')]===0x1f4){logger[_0x54e4('0xf')](_0x54e4('0xa'),_0x14691a,_0xfb7e0a[_0x54e4('0xf')][_0x54e4('0x11')]);return _0x19daf5(_0xfb7e0a[_0x54e4('0xf')][_0x54e4('0x11')]);}logger[_0x54e4('0xf')](_0x54e4('0xa'),_0x14691a,_0xfb7e0a['error'][_0x54e4('0x11')]);return _0xef4253(_0xfb7e0a[_0x54e4('0xf')][_0x54e4('0x11')]);}else{logger['info'](_0x54e4('0xa'),_0x14691a,'request\x20sent');_0xef4253(_0xfb7e0a[_0x54e4('0x12')][_0x54e4('0x11')]);}})[_0x54e4('0x13')](function(_0x5499f7){logger['error'](_0x54e4('0xa'),_0x14691a,_0x5499f7);_0x19daf5(_0x5499f7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 5aceb12..dfadaa0 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 _0xead0=['create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x56fcfc,_0x424980){var _0x295470=function(_0x457488){while(--_0x457488){_0x56fcfc['push'](_0x56fcfc['shift']());}};_0x295470(++_0x424980);}(_0xead0,0x94));var _0x0ead=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0xead0[_0x5fe69a];return _0x3f1aee;};'use strict';var multer=require(_0x0ead('0x0'));var util=require('util');var path=require(_0x0ead('0x1'));var timeout=require(_0x0ead('0x2'));var express=require(_0x0ead('0x3'));var router=express[_0x0ead('0x4')]();var fs_extra=require(_0x0ead('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ead('0x6'));var config=require(_0x0ead('0x7'));var controller=require(_0x0ead('0x8'));router[_0x0ead('0x9')]('/',auth[_0x0ead('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0ead('0xb')]);router[_0x0ead('0x9')](_0x0ead('0xc'),auth[_0x0ead('0xa')](),controller[_0x0ead('0xd')]);router['post']('/',auth[_0x0ead('0xa')](),controller[_0x0ead('0xe')]);router[_0x0ead('0xf')](_0x0ead('0xc'),auth[_0x0ead('0xa')](),controller[_0x0ead('0x10')]);router['delete'](_0x0ead('0xc'),auth[_0x0ead('0xa')](),controller[_0x0ead('0x11')]);module['exports']=router; \ No newline at end of file +var _0x141a=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bbdc6,_0x262329){var _0x50a293=function(_0x29a49a){while(--_0x29a49a){_0x3bbdc6['push'](_0x3bbdc6['shift']());}};_0x50a293(++_0x262329);}(_0x141a,0x1b0));var _0xa141=function(_0x4e9c89,_0x54ab8a){_0x4e9c89=_0x4e9c89-0x0;var _0x4198cc=_0x141a[_0x4e9c89];return _0x4198cc;};'use strict';var multer=require(_0xa141('0x0'));var util=require(_0xa141('0x1'));var path=require('path');var timeout=require(_0xa141('0x2'));var express=require(_0xa141('0x3'));var router=express[_0xa141('0x4')]();var fs_extra=require(_0xa141('0x5'));var auth=require(_0xa141('0x6'));var interaction=require(_0xa141('0x7'));var config=require(_0xa141('0x8'));var controller=require(_0xa141('0x9'));router[_0xa141('0xa')]('/',auth[_0xa141('0xb')](),controller[_0xa141('0xc')]);router[_0xa141('0xa')](_0xa141('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa141('0xe'),auth[_0xa141('0xb')](),controller['show']);router[_0xa141('0xf')]('/',auth['isAuthenticated'](),controller[_0xa141('0x10')]);router[_0xa141('0x11')](_0xa141('0xe'),auth[_0xa141('0xb')](),controller[_0xa141('0x12')]);router[_0xa141('0x13')](_0xa141('0xe'),auth[_0xa141('0xb')](),controller[_0xa141('0x14')]);module[_0xa141('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7f61e60..2b63f27 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 _0xb26e=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE'];(function(_0x3c23a4,_0x42c507){var _0x3f34b=function(_0x1e9a71){while(--_0x1e9a71){_0x3c23a4['push'](_0x3c23a4['shift']());}};_0x3f34b(++_0x42c507);}(_0xb26e,0x11d));var _0xeb26=function(_0x3869fa,_0x16ef3f){_0x3869fa=_0x3869fa-0x0;var _0x209652=_0xb26e[_0x3869fa];return _0x209652;};'use strict';var Sequelize=require(_0xeb26('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xeb26('0x1')]},'interface':{'type':Sequelize[_0xeb26('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xeb26('0x2'),'comment':_0xeb26('0x3')},'duration':{'type':Sequelize[_0xeb26('0x4')]},'enterAt':{'type':Sequelize[_0xeb26('0x5')]},'exitAt':{'type':Sequelize[_0xeb26('0x5')],'set':function(_0x17f489){var _0x2351f9=moment(_0x17f489);var _0xc0d644=moment(this[_0xeb26('0x6')](_0xeb26('0x7')));var _0x170f9b=_0x2351f9[_0xeb26('0x8')](_0xc0d644,_0xeb26('0x9'));this['setDataValue'](_0xeb26('0xa'),_0x17f489);this['setDataValue']('duration',_0x170f9b||null);}},'data1':{'type':Sequelize[_0xeb26('0x1')],'comment':_0xeb26('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xeb26('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xeb26('0xd')},'data4':{'type':Sequelize[_0xeb26('0x1')],'comment':_0xeb26('0xe')},'data5':{'type':Sequelize[_0xeb26('0x1')],'comment':_0xeb26('0xf')},'role':{'type':Sequelize[_0xeb26('0x1')]},'internal':{'type':Sequelize[_0xeb26('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3fb7=['talk:[dial\x20string]','talk:[queue]','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x59dae4,_0x112ff9){var _0x39d036=function(_0x31cad3){while(--_0x31cad3){_0x59dae4['push'](_0x59dae4['shift']());}};_0x39d036(++_0x112ff9);}(_0x3fb7,0x189));var _0x73fb=function(_0x17fca3,_0x14623e){_0x17fca3=_0x17fca3-0x0;var _0x318a22=_0x3fb7[_0x17fca3];return _0x318a22;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x73fb('0x0'));module['exports']={'channel':{'type':Sequelize[_0x73fb('0x1')]},'membername':{'type':Sequelize[_0x73fb('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x73fb('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x73fb('0x2')},'duration':{'type':Sequelize[_0x73fb('0x3')]},'enterAt':{'type':Sequelize[_0x73fb('0x4')]},'exitAt':{'type':Sequelize[_0x73fb('0x4')],'set':function(_0x3330e3){var _0x423496=moment(_0x3330e3);var _0x33d35b=moment(this[_0x73fb('0x5')](_0x73fb('0x6')));var _0x2413ee=_0x423496[_0x73fb('0x7')](_0x33d35b,_0x73fb('0x8'));this[_0x73fb('0x9')](_0x73fb('0xa'),_0x3330e3);this[_0x73fb('0x9')](_0x73fb('0xb'),_0x2413ee||null);}},'data1':{'type':Sequelize[_0x73fb('0x1')],'comment':_0x73fb('0xc')},'data2':{'type':Sequelize[_0x73fb('0x1')],'comment':_0x73fb('0xd')},'data3':{'type':Sequelize[_0x73fb('0x1')],'comment':_0x73fb('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x73fb('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x73fb('0x10')},'role':{'type':Sequelize[_0x73fb('0x1')]},'internal':{'type':Sequelize[_0x73fb('0x3')]},'uniqueid':{'type':Sequelize[_0x73fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1ec6e63..9832d5e 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x21ab22,_0x42cb78){var _0x4540e5=function(_0x45f911){while(--_0x45f911){_0x21ab22['push'](_0x21ab22['shift']());}};_0x4540e5(++_0x42cb78);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +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(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xedd9,0xfc));var _0x9edd=function(_0x28bb70,_0x88f63){_0x28bb70=_0x28bb70-0x0;var _0x58236a=_0xedd9[_0x28bb70];return _0x58236a;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4c2b794..ff67f29 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 _0x43ef=['path','../../config/environment','exports','define','report_member','membername_interface','membername','lodash','util','api','moment','bluebird','request-promise'];(function(_0x199e03,_0x107a32){var _0x262658=function(_0x23a7fc){while(--_0x23a7fc){_0x199e03['push'](_0x199e03['shift']());}};_0x262658(++_0x107a32);}(_0x43ef,0x19a));var _0xf43e=function(_0x35bf94,_0x2241c9){_0x35bf94=_0x35bf94-0x0;var _0xee8322=_0x43ef[_0x35bf94];return _0xee8322;};'use strict';var _=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var logger=require('../../config/logger')(_0xf43e('0x2'));var moment=require(_0xf43e('0x3'));var BPromise=require(_0xf43e('0x4'));var rp=require(_0xf43e('0x5'));var fs=require('fs');var path=require(_0xf43e('0x6'));var rimraf=require('rimraf');var config=require(_0xf43e('0x7'));var attributes=require('./memberReport.attributes');module[_0xf43e('0x8')]=function(_0x249559,_0x2297fa){return _0x249559[_0xf43e('0x9')]('MemberReport',attributes,{'tableName':_0xf43e('0xa'),'paranoid':![],'indexes':[{'name':_0xf43e('0xb'),'fields':[_0xf43e('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcafa=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./memberReport.attributes','define','MemberReport','report_member','membername_interface','interface'];(function(_0x2d623d,_0x24487a){var _0x5d7ddb=function(_0xfea6a0){while(--_0xfea6a0){_0x2d623d['push'](_0x2d623d['shift']());}};_0x5d7ddb(++_0x24487a);}(_0xcafa,0x8f));var _0xacaf=function(_0x50ffdd,_0xcefeae){_0x50ffdd=_0x50ffdd-0x0;var _0x1ee2fb=_0xcafa[_0x50ffdd];return _0x1ee2fb;};'use strict';var _=require(_0xacaf('0x0'));var util=require(_0xacaf('0x1'));var logger=require(_0xacaf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xacaf('0x3'));var rp=require(_0xacaf('0x4'));var fs=require('fs');var path=require(_0xacaf('0x5'));var rimraf=require(_0xacaf('0x6'));var config=require('../../config/environment');var attributes=require(_0xacaf('0x7'));module['exports']=function(_0x185dde,_0xf7f82a){return _0x185dde[_0xacaf('0x8')](_0xacaf('0x9'),attributes,{'tableName':_0xacaf('0xa'),'paranoid':![],'indexes':[{'name':_0xacaf('0xb'),'fields':['membername',_0xacaf('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 e069a85..e14cf91 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 _0xc812=['rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','MemberReport','body','update','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x229066,_0x443063){var _0xd7c89=function(_0x8c80e6){while(--_0x8c80e6){_0x229066['push'](_0x229066['shift']());}};_0xd7c89(++_0x443063);}(_0xc812,0xbc));var _0x2c81=function(_0x3bb462,_0x4176e5){_0x3bb462=_0x3bb462-0x0;var _0x4fdd11=_0xc812[_0x3bb462];return _0x4fdd11;};'use strict';var _=require(_0x2c81('0x0'));var util=require(_0x2c81('0x1'));var moment=require(_0x2c81('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c81('0x3'));var fs=require('fs');var Redis=require(_0x2c81('0x4'));var db=require(_0x2c81('0x5'))['db'];var utils=require(_0x2c81('0x6'));var logger=require('../../config/logger')(_0x2c81('0x7'));var config=require(_0x2c81('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c81('0x9')][_0x2c81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c6fe7,_0x318a4d,_0x42ef3d){return new BPromise(function(_0x2e4013,_0x5b80ae){return client[_0x2c81('0xb')](_0x1c6fe7,_0x42ef3d)[_0x2c81('0xc')](function(_0x2aaff2){logger[_0x2c81('0xd')](_0x2c81('0xe'),_0x318a4d,'request\x20sent');logger[_0x2c81('0xf')](_0x2c81('0x10'),_0x318a4d,_0x2c81('0x11'),JSON[_0x2c81('0x12')](_0x2aaff2));if(_0x2aaff2[_0x2c81('0x13')]){if(_0x2aaff2[_0x2c81('0x13')][_0x2c81('0x14')]===0x1f4){logger['error'](_0x2c81('0xe'),_0x318a4d,_0x2aaff2[_0x2c81('0x13')]['message']);return _0x5b80ae(_0x2aaff2['error'][_0x2c81('0x15')]);}logger[_0x2c81('0x13')]('MemberReport,\x20%s,\x20%s',_0x318a4d,_0x2aaff2[_0x2c81('0x13')][_0x2c81('0x15')]);return _0x2e4013(_0x2aaff2[_0x2c81('0x13')][_0x2c81('0x15')]);}else{logger[_0x2c81('0xd')](_0x2c81('0xe'),_0x318a4d,_0x2c81('0x11'));_0x2e4013(_0x2aaff2[_0x2c81('0x16')]['message']);}})[_0x2c81('0x17')](function(_0x24c35c){logger['error'](_0x2c81('0xe'),_0x318a4d,_0x24c35c);_0x5b80ae(_0x24c35c);});});}exports[_0x2c81('0x18')]=function(_0x3d5a02){var _0x381eda=this;return new Promise(function(_0x101325,_0x1f6a68){return db['MemberReport'][_0x2c81('0x19')]({'raw':_0x3d5a02[_0x2c81('0x1a')]?_0x3d5a02[_0x2c81('0x1a')][_0x2c81('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d5a02[_0x2c81('0x1a')]?_0x3d5a02[_0x2c81('0x1a')][_0x2c81('0x1c')]||null:null,'attributes':_0x3d5a02[_0x2c81('0x1a')]?_0x3d5a02['options'][_0x2c81('0x1d')]||null:null,'limit':_0x3d5a02[_0x2c81('0x1a')]?_0x3d5a02['options'][_0x2c81('0x1e')]||null:null,'include':_0x3d5a02['options']?_0x3d5a02['options']['include']?_[_0x2c81('0x1f')](_0x3d5a02[_0x2c81('0x1a')][_0x2c81('0x20')],function(_0x3e529f){return{'model':db[_0x3e529f['model']],'as':_0x3e529f['as'],'attributes':_0x3e529f[_0x2c81('0x1d')],'include':_0x3e529f[_0x2c81('0x20')]?_[_0x2c81('0x1f')](_0x3e529f[_0x2c81('0x20')],function(_0x309b2f){return{'model':db[_0x309b2f[_0x2c81('0x21')]],'as':_0x309b2f['as'],'attributes':_0x309b2f[_0x2c81('0x1d')],'include':_0x309b2f['include']?_[_0x2c81('0x1f')](_0x309b2f[_0x2c81('0x20')],function(_0x1def4c){return{'model':db[_0x1def4c[_0x2c81('0x21')]],'as':_0x1def4c['as'],'attributes':_0x1def4c[_0x2c81('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2486fb){logger[_0x2c81('0xd')](_0x2c81('0x18'),_0x3d5a02);logger[_0x2c81('0xf')](_0x2c81('0x18'),_0x3d5a02,JSON[_0x2c81('0x12')](_0x2486fb));_0x101325(_0x2486fb);})[_0x2c81('0x17')](function(_0x3adf97){logger[_0x2c81('0x13')](_0x2c81('0x18'),_0x3adf97[_0x2c81('0x15')],_0x3d5a02);_0x1f6a68(_0x381eda[_0x2c81('0x13')](0x1f4,_0x3adf97[_0x2c81('0x15')]));});});};exports[_0x2c81('0x22')]=function(_0x596091){var _0x2b7111=this;return new Promise(function(_0x12b457,_0x37da90){return db[_0x2c81('0x23')]['create'](_0x596091[_0x2c81('0x24')],{'raw':_0x596091[_0x2c81('0x1a')]?_0x596091[_0x2c81('0x1a')][_0x2c81('0x1b')]===undefined?!![]:![]:!![]})[_0x2c81('0xc')](function(_0x27d643){logger[_0x2c81('0xd')](_0x2c81('0x22'),_0x596091);logger[_0x2c81('0xf')](_0x2c81('0x22'),_0x596091,JSON['stringify'](_0x27d643));_0x12b457(_0x27d643);})['catch'](function(_0x3477b2){logger[_0x2c81('0x13')](_0x2c81('0x22'),_0x3477b2[_0x2c81('0x15')],_0x596091);_0x37da90(_0x2b7111[_0x2c81('0x13')](0x1f4,_0x3477b2[_0x2c81('0x15')]));});});};exports['UpdateMemberReport']=function(_0x23334f){var _0x28bc9=this;return new Promise(function(_0x5c099f,_0x5a53d6){return db['MemberReport'][_0x2c81('0x25')](_0x23334f[_0x2c81('0x24')],{'raw':_0x23334f[_0x2c81('0x1a')]?_0x23334f[_0x2c81('0x1a')][_0x2c81('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23334f[_0x2c81('0x1a')]?_0x23334f[_0x2c81('0x1a')][_0x2c81('0x1c')]||null:null,'attributes':_0x23334f['options']?_0x23334f[_0x2c81('0x1a')][_0x2c81('0x1d')]||null:null,'limit':_0x23334f[_0x2c81('0x1a')]?_0x23334f[_0x2c81('0x1a')][_0x2c81('0x1e')]||null:null})[_0x2c81('0xc')](function(_0xa9a730){logger[_0x2c81('0xd')](_0x2c81('0x26'),_0x23334f);logger[_0x2c81('0xf')](_0x2c81('0x26'),_0x23334f,JSON[_0x2c81('0x12')](_0xa9a730));_0x5c099f(_0xa9a730);})[_0x2c81('0x17')](function(_0x3e06ef){logger[_0x2c81('0x13')](_0x2c81('0x26'),_0x3e06ef[_0x2c81('0x15')],_0x23334f);_0x5a53d6(_0x28bc9['error'](0x1f4,_0x3e06ef[_0x2c81('0x15')]));});});}; \ No newline at end of file +var _0x0650=['result','GetMemberReport','MemberReport','findAll','raw','options','where','limit','map','include','model','attributes','debug','create','body','catch','CreateMemberReport','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x1850e2,_0x7dab61){var _0x1f5de4=function(_0x2cfb85){while(--_0x2cfb85){_0x1850e2['push'](_0x1850e2['shift']());}};_0x1f5de4(++_0x7dab61);}(_0x0650,0x1aa));var _0x0065=function(_0x2d259a,_0x31068e){_0x2d259a=_0x2d259a-0x0;var _0x16f9d5=_0x0650[_0x2d259a];return _0x16f9d5;};'use strict';var _=require(_0x0065('0x0'));var util=require(_0x0065('0x1'));var moment=require(_0x0065('0x2'));var BPromise=require(_0x0065('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0065('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0065('0x5'))(_0x0065('0x6'));var config=require(_0x0065('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0065('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5792dc,_0x517b9f,_0x49d04d){return new BPromise(function(_0x576ca0,_0x25892a){return client['request'](_0x5792dc,_0x49d04d)[_0x0065('0x9')](function(_0x141e01){logger['info'](_0x0065('0xa'),_0x517b9f,_0x0065('0xb'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x517b9f,_0x0065('0xb'),JSON[_0x0065('0xc')](_0x141e01));if(_0x141e01[_0x0065('0xd')]){if(_0x141e01[_0x0065('0xd')]['code']===0x1f4){logger['error'](_0x0065('0xa'),_0x517b9f,_0x141e01['error']['message']);return _0x25892a(_0x141e01[_0x0065('0xd')]['message']);}logger[_0x0065('0xd')]('MemberReport,\x20%s,\x20%s',_0x517b9f,_0x141e01['error'][_0x0065('0xe')]);return _0x576ca0(_0x141e01[_0x0065('0xd')][_0x0065('0xe')]);}else{logger[_0x0065('0xf')](_0x0065('0xa'),_0x517b9f,_0x0065('0xb'));_0x576ca0(_0x141e01[_0x0065('0x10')][_0x0065('0xe')]);}})['catch'](function(_0x26f491){logger[_0x0065('0xd')](_0x0065('0xa'),_0x517b9f,_0x26f491);_0x25892a(_0x26f491);});});}exports[_0x0065('0x11')]=function(_0x20adaa){var _0x9c1723=this;return new Promise(function(_0x244937,_0xcf4ea1){return db[_0x0065('0x12')][_0x0065('0x13')]({'raw':_0x20adaa['options']?_0x20adaa['options'][_0x0065('0x14')]===undefined?!![]:![]:!![],'where':_0x20adaa[_0x0065('0x15')]?_0x20adaa[_0x0065('0x15')][_0x0065('0x16')]||null:null,'attributes':_0x20adaa[_0x0065('0x15')]?_0x20adaa[_0x0065('0x15')]['attributes']||null:null,'limit':_0x20adaa[_0x0065('0x15')]?_0x20adaa[_0x0065('0x15')][_0x0065('0x17')]||null:null,'include':_0x20adaa['options']?_0x20adaa[_0x0065('0x15')]['include']?_[_0x0065('0x18')](_0x20adaa[_0x0065('0x15')][_0x0065('0x19')],function(_0x5578da){return{'model':db[_0x5578da[_0x0065('0x1a')]],'as':_0x5578da['as'],'attributes':_0x5578da[_0x0065('0x1b')],'include':_0x5578da[_0x0065('0x19')]?_[_0x0065('0x18')](_0x5578da[_0x0065('0x19')],function(_0x4cbd31){return{'model':db[_0x4cbd31[_0x0065('0x1a')]],'as':_0x4cbd31['as'],'attributes':_0x4cbd31['attributes'],'include':_0x4cbd31[_0x0065('0x19')]?_[_0x0065('0x18')](_0x4cbd31[_0x0065('0x19')],function(_0x234fb2){return{'model':db[_0x234fb2[_0x0065('0x1a')]],'as':_0x234fb2['as'],'attributes':_0x234fb2[_0x0065('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47fb44){logger[_0x0065('0xf')](_0x0065('0x11'),_0x20adaa);logger[_0x0065('0x1c')](_0x0065('0x11'),_0x20adaa,JSON['stringify'](_0x47fb44));_0x244937(_0x47fb44);})['catch'](function(_0x432dbf){logger['error']('GetMemberReport',_0x432dbf[_0x0065('0xe')],_0x20adaa);_0xcf4ea1(_0x9c1723[_0x0065('0xd')](0x1f4,_0x432dbf[_0x0065('0xe')]));});});};exports['CreateMemberReport']=function(_0x1086a6){var _0xa89ff6=this;return new Promise(function(_0x33599d,_0x21c5da){return db[_0x0065('0x12')][_0x0065('0x1d')](_0x1086a6[_0x0065('0x1e')],{'raw':_0x1086a6[_0x0065('0x15')]?_0x1086a6[_0x0065('0x15')][_0x0065('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x5215c3){logger[_0x0065('0xf')]('CreateMemberReport',_0x1086a6);logger[_0x0065('0x1c')]('CreateMemberReport',_0x1086a6,JSON[_0x0065('0xc')](_0x5215c3));_0x33599d(_0x5215c3);})[_0x0065('0x1f')](function(_0x53aa4c){logger['error'](_0x0065('0x20'),_0x53aa4c[_0x0065('0xe')],_0x1086a6);_0x21c5da(_0xa89ff6['error'](0x1f4,_0x53aa4c['message']));});});};exports[_0x0065('0x21')]=function(_0x573f38){var _0x39dfdb=this;return new Promise(function(_0x275a0a,_0x3e72ce){return db[_0x0065('0x12')]['update'](_0x573f38[_0x0065('0x1e')],{'raw':_0x573f38[_0x0065('0x15')]?_0x573f38[_0x0065('0x15')][_0x0065('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573f38[_0x0065('0x15')]?_0x573f38[_0x0065('0x15')]['where']||null:null,'attributes':_0x573f38[_0x0065('0x15')]?_0x573f38[_0x0065('0x15')][_0x0065('0x1b')]||null:null,'limit':_0x573f38[_0x0065('0x15')]?_0x573f38[_0x0065('0x15')]['limit']||null:null})[_0x0065('0x9')](function(_0x5264f1){logger[_0x0065('0xf')](_0x0065('0x21'),_0x573f38);logger[_0x0065('0x1c')](_0x0065('0x21'),_0x573f38,JSON[_0x0065('0xc')](_0x5264f1));_0x275a0a(_0x5264f1);})[_0x0065('0x1f')](function(_0x15753e){logger[_0x0065('0xd')](_0x0065('0x21'),_0x15753e[_0x0065('0xe')],_0x573f38);_0x3e72ce(_0x39dfdb[_0x0065('0xd')](0x1f4,_0x15753e['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a822f99..768c59b 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 _0x029e=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index'];(function(_0x2e2d4d,_0x5af1ce){var _0x4b08ec=function(_0x55d7b2){while(--_0x55d7b2){_0x2e2d4d['push'](_0x2e2d4d['shift']());}};_0x4b08ec(++_0x5af1ce);}(_0x029e,0xbb));var _0xe029=function(_0x282395,_0x303b09){_0x282395=_0x282395-0x0;var _0x1aa954=_0x029e[_0x282395];return _0x1aa954;};'use strict';var multer=require(_0xe029('0x0'));var util=require(_0xe029('0x1'));var path=require(_0xe029('0x2'));var timeout=require(_0xe029('0x3'));var express=require('express');var router=express[_0xe029('0x4')]();var fs_extra=require(_0xe029('0x5'));var auth=require(_0xe029('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe029('0x7'));var controller=require(_0xe029('0x8'));router[_0xe029('0x9')]('/',controller[_0xe029('0xa')]);module['exports']=router; \ No newline at end of file +var _0x3e06=['./migration.controller','get','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23f4a7,_0x583696){var _0x356b5d=function(_0x1a3ff0){while(--_0x1a3ff0){_0x23f4a7['push'](_0x23f4a7['shift']());}};_0x356b5d(++_0x583696);}(_0x3e06,0x153));var _0x63e0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3e06[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x63e0('0x0'));var util=require(_0x63e0('0x1'));var path=require(_0x63e0('0x2'));var timeout=require(_0x63e0('0x3'));var express=require(_0x63e0('0x4'));var router=express[_0x63e0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x63e0('0x6'));var interaction=require(_0x63e0('0x7'));var config=require(_0x63e0('0x8'));var controller=require(_0x63e0('0x9'));router[_0x63e0('0xa')]('/',controller['index']);module[_0x63e0('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3840639..efc7ebf 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 _0x97e1=['STRING','version','sequelize','exports'];(function(_0x107308,_0x2252df){var _0x3d3f0c=function(_0x2fdd76){while(--_0x2fdd76){_0x107308['push'](_0x107308['shift']());}};_0x3d3f0c(++_0x2252df);}(_0x97e1,0x1da));var _0x197e=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x97e1[_0x34d346];return _0x122d76;};'use strict';var Sequelize=require(_0x197e('0x0'));module[_0x197e('0x1')]={'version':{'type':Sequelize[_0x197e('0x2')],'unique':_0x197e('0x3')}}; \ No newline at end of file +var _0x4e26=['exports','STRING','version','sequelize'];(function(_0x13eb00,_0x384af9){var _0x2fcec1=function(_0x8ff48f){while(--_0x8ff48f){_0x13eb00['push'](_0x13eb00['shift']());}};_0x2fcec1(++_0x384af9);}(_0x4e26,0x17b));var _0x64e2=function(_0x1403d3,_0xbbfd02){_0x1403d3=_0x1403d3-0x0;var _0x3f1b38=_0x4e26[_0x1403d3];return _0x3f1b38;};'use strict';var Sequelize=require(_0x64e2('0x0'));module[_0x64e2('0x1')]={'version':{'type':Sequelize[_0x64e2('0x2')],'unique':_0x64e2('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d290dd4..11cd68a 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 _0xd974=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','eml-format'];(function(_0x5427c6,_0x1240a1){var _0x5144ff=function(_0x426797){while(--_0x426797){_0x5427c6['push'](_0x5427c6['shift']());}};_0x5144ff(++_0x1240a1);}(_0xd974,0x8b));var _0x4d97=function(_0x45beb6,_0x1a3ada){_0x45beb6=_0x45beb6-0x0;var _0x1dd61f=_0xd974[_0x45beb6];return _0x1dd61f;};'use strict';var emlformat=require(_0x4d97('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4d97('0x1'));var rp=require('request-promise');var moment=require(_0x4d97('0x2'));var BPromise=require(_0x4d97('0x3'));var Mustache=require(_0x4d97('0x4'));var util=require(_0x4d97('0x5'));var path=require(_0x4d97('0x6'));var sox=require(_0x4d97('0x7'));var csv=require(_0x4d97('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d97('0x9'));var _=require(_0x4d97('0xa'));var squel=require(_0x4d97('0xb'));var crypto=require(_0x4d97('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4d97('0xd'));var toCsv=require(_0x4d97('0x8'));var querystring=require(_0x4d97('0xe'));var Papa=require(_0x4d97('0xf'));var Redis=require(_0x4d97('0x10'));var authService=require(_0x4d97('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4d97('0x12'));var hardwareService=require(_0x4d97('0x13'));var logger=require(_0x4d97('0x14'))(_0x4d97('0x15'));var utils=require('../../config/utils');var config=require(_0x4d97('0x16'));var licenseUtil=require(_0x4d97('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1827af,_0x3cbca0){_0x3cbca0=_0x3cbca0||0xcc;return function(_0x45abb4){if(_0x45abb4){return _0x1827af[_0x4d97('0x18')](_0x3cbca0);}return _0x1827af['status'](_0x3cbca0)[_0x4d97('0x19')]();};}function respondWithResult(_0x519571,_0x3f2397){_0x3f2397=_0x3f2397||0xc8;return function(_0x268952){if(_0x268952){return _0x519571[_0x4d97('0x1a')](_0x3f2397)[_0x4d97('0x1b')](_0x268952);}};}function respondWithFilteredResult(_0x473956,_0x4c3370){return function(_0x45f93d){if(_0x45f93d){var _0x3dfb5a=typeof _0x4c3370[_0x4d97('0x1c')]===_0x4d97('0x1d')&&typeof _0x4c3370[_0x4d97('0x1e')]==='undefined';var _0x344695=_0x45f93d[_0x4d97('0x1f')];var _0x199494=_0x3dfb5a?0x0:_0x4c3370[_0x4d97('0x1c')];var _0x6cc7e8=_0x3dfb5a?_0x45f93d[_0x4d97('0x1f')]:_0x4c3370[_0x4d97('0x1c')]+_0x4c3370[_0x4d97('0x1e')];var _0x719d37;if(_0x6cc7e8>=_0x344695){_0x6cc7e8=_0x344695;_0x719d37=0xc8;}else{_0x719d37=0xce;}_0x473956[_0x4d97('0x1a')](_0x719d37);return _0x473956['set'](_0x4d97('0x20'),_0x199494+'-'+_0x6cc7e8+'/'+_0x344695)[_0x4d97('0x1b')](_0x45f93d);}return null;};}function patchUpdates(_0x178c00){return function(_0xdb708a){try{jsonpatch[_0x4d97('0x21')](_0xdb708a,_0x178c00,!![]);}catch(_0x3a016d){return BPromise[_0x4d97('0x22')](_0x3a016d);}return _0xdb708a[_0x4d97('0x23')]();};}function saveUpdates(_0x205b93,_0x1a7c2d){return function(_0x4c06b6){if(_0x4c06b6){return _0x4c06b6[_0x4d97('0x24')](_0x205b93)[_0x4d97('0x25')](function(_0x14d12b){return _0x14d12b;});}return null;};}function removeEntity(_0x4ce79e,_0x1905b8){return function(_0x3412fc){if(_0x3412fc){return _0x3412fc[_0x4d97('0x26')]()['then'](function(){_0x4ce79e[_0x4d97('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5be82d,_0x5d3b0e){return function(_0x2b1289){if(!_0x2b1289){_0x5be82d[_0x4d97('0x18')](0x194);}return _0x2b1289;};}function handleError(_0x4421d4,_0x18d91a){_0x18d91a=_0x18d91a||0x1f4;return function(_0x3200b8){logger[_0x4d97('0x27')](_0x3200b8[_0x4d97('0x28')]);if(_0x3200b8[_0x4d97('0x29')]){delete _0x3200b8[_0x4d97('0x29')];}_0x4421d4[_0x4d97('0x1a')](_0x18d91a)['send'](_0x3200b8);};}exports[_0x4d97('0x2a')]=function(_0x5eacb1,_0x282f63){var _0x2e6d80={},_0x425380={},_0x1e16f6={'count':0x0,'rows':[]};var _0x334bb9=_['map'](db[_0x4d97('0x2b')][_0x4d97('0x2c')],function(_0x111553){return{'name':_0x111553[_0x4d97('0x2d')],'type':_0x111553[_0x4d97('0x2e')][_0x4d97('0x2f')]};});_0x425380[_0x4d97('0x30')]=_[_0x4d97('0x31')](_0x334bb9,_0x4d97('0x29'));_0x425380[_0x4d97('0x32')]=_[_0x4d97('0x33')](_0x5eacb1[_0x4d97('0x32')]);_0x425380[_0x4d97('0x34')]=_[_0x4d97('0x35')](_0x425380[_0x4d97('0x30')],_0x425380[_0x4d97('0x32')]);_0x2e6d80[_0x4d97('0x36')]=_[_0x4d97('0x35')](_0x425380['model'],qs[_0x4d97('0x37')](_0x5eacb1[_0x4d97('0x32')][_0x4d97('0x37')]));_0x2e6d80[_0x4d97('0x36')]=_0x2e6d80[_0x4d97('0x36')][_0x4d97('0x38')]?_0x2e6d80[_0x4d97('0x36')]:_0x425380[_0x4d97('0x30')];if(!_0x5eacb1['query']['hasOwnProperty'](_0x4d97('0x39'))){_0x2e6d80[_0x4d97('0x1e')]=qs[_0x4d97('0x1e')](_0x5eacb1[_0x4d97('0x32')][_0x4d97('0x1e')]);_0x2e6d80[_0x4d97('0x1c')]=qs[_0x4d97('0x1c')](_0x5eacb1['query']['offset']);}_0x2e6d80[_0x4d97('0x3a')]=qs['sort'](_0x5eacb1['query'][_0x4d97('0x3b')]);_0x2e6d80['where']=qs[_0x4d97('0x34')](_[_0x4d97('0x3c')](_0x5eacb1[_0x4d97('0x32')],_0x425380[_0x4d97('0x34')]),_0x334bb9);if(_0x5eacb1['query'][_0x4d97('0x3d')]){_0x2e6d80['where']=_[_0x4d97('0x3e')](_0x2e6d80[_0x4d97('0x3f')],{'$or':_[_0x4d97('0x31')](_0x334bb9,function(_0x129d9f){if(_0x129d9f[_0x4d97('0x2e')]!==_0x4d97('0x40')){var _0x116567={};_0x116567[_0x129d9f[_0x4d97('0x29')]]={'$like':'%'+_0x5eacb1['query'][_0x4d97('0x3d')]+'%'};return _0x116567;}})});}_0x2e6d80=_[_0x4d97('0x3e')]({},_0x2e6d80,_0x5eacb1[_0x4d97('0x41')]);var _0x12026d={'where':_0x2e6d80[_0x4d97('0x3f')]};return db['Migration']['count'](_0x12026d)[_0x4d97('0x25')](function(_0x3f82a2){_0x1e16f6[_0x4d97('0x1f')]=_0x3f82a2;if(_0x5eacb1[_0x4d97('0x32')][_0x4d97('0x42')]){_0x2e6d80['include']=[{'all':!![]}];}return db[_0x4d97('0x2b')][_0x4d97('0x43')](_0x2e6d80);})[_0x4d97('0x25')](function(_0x5eca25){_0x1e16f6[_0x4d97('0x44')]=_0x5eca25;return _0x1e16f6;})[_0x4d97('0x25')](respondWithFilteredResult(_0x282f63,_0x2e6d80))[_0x4d97('0x45')](handleError(_0x282f63,null));}; \ No newline at end of file +var _0x521b=['keys','filters','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','index','map','Migration','rawAttributes','fieldName','key','query'];(function(_0x1664a5,_0x3ae9d0){var _0x15f241=function(_0x3bf2c3){while(--_0x3bf2c3){_0x1664a5['push'](_0x1664a5['shift']());}};_0x15f241(++_0x3ae9d0);}(_0x521b,0x1b7));var _0xb521=function(_0x20961b,_0x121bba){_0x20961b=_0x20961b-0x0;var _0x48ad1c=_0x521b[_0x20961b];return _0x48ad1c;};'use strict';var emlformat=require(_0xb521('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb521('0x1'));var jsonpatch=require(_0xb521('0x2'));var rp=require(_0xb521('0x3'));var moment=require(_0xb521('0x4'));var BPromise=require(_0xb521('0x5'));var Mustache=require(_0xb521('0x6'));var util=require(_0xb521('0x7'));var path=require(_0xb521('0x8'));var sox=require(_0xb521('0x9'));var csv=require('to-csv');var ejs=require(_0xb521('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb521('0xb'));var squel=require(_0xb521('0xc'));var crypto=require(_0xb521('0xd'));var jsforce=require(_0xb521('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb521('0xf'));var querystring=require(_0xb521('0x10'));var Papa=require(_0xb521('0x11'));var Redis=require(_0xb521('0x12'));var authService=require(_0xb521('0x13'));var qs=require(_0xb521('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb521('0x15'));var logger=require(_0xb521('0x16'))(_0xb521('0x17'));var utils=require(_0xb521('0x18'));var config=require(_0xb521('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb521('0x1a'))['db'];function respondWithStatusCode(_0x105188,_0x23e77c){_0x23e77c=_0x23e77c||0xcc;return function(_0x2d0db3){if(_0x2d0db3){return _0x105188[_0xb521('0x1b')](_0x23e77c);}return _0x105188['status'](_0x23e77c)['end']();};}function respondWithResult(_0x3f3e58,_0x3b1c7f){_0x3b1c7f=_0x3b1c7f||0xc8;return function(_0x202e8b){if(_0x202e8b){return _0x3f3e58[_0xb521('0x1c')](_0x3b1c7f)[_0xb521('0x1d')](_0x202e8b);}};}function respondWithFilteredResult(_0x36fc5b,_0x580b5d){return function(_0x508128){if(_0x508128){var _0x476373=typeof _0x580b5d[_0xb521('0x1e')]===_0xb521('0x1f')&&typeof _0x580b5d[_0xb521('0x20')]===_0xb521('0x1f');var _0x171670=_0x508128[_0xb521('0x21')];var _0xffeb6d=_0x476373?0x0:_0x580b5d[_0xb521('0x1e')];var _0xeb7840=_0x476373?_0x508128[_0xb521('0x21')]:_0x580b5d[_0xb521('0x1e')]+_0x580b5d['limit'];var _0x44e7ce;if(_0xeb7840>=_0x171670){_0xeb7840=_0x171670;_0x44e7ce=0xc8;}else{_0x44e7ce=0xce;}_0x36fc5b['status'](_0x44e7ce);return _0x36fc5b[_0xb521('0x22')](_0xb521('0x23'),_0xffeb6d+'-'+_0xeb7840+'/'+_0x171670)[_0xb521('0x1d')](_0x508128);}return null;};}function patchUpdates(_0x482da9){return function(_0x158054){try{jsonpatch[_0xb521('0x24')](_0x158054,_0x482da9,!![]);}catch(_0x4e84b7){return BPromise[_0xb521('0x25')](_0x4e84b7);}return _0x158054[_0xb521('0x26')]();};}function saveUpdates(_0x5760c2,_0x4fe3e4){return function(_0x3276d5){if(_0x3276d5){return _0x3276d5[_0xb521('0x27')](_0x5760c2)[_0xb521('0x28')](function(_0xf0f85f){return _0xf0f85f;});}return null;};}function removeEntity(_0xbd26ea,_0x137503){return function(_0x162057){if(_0x162057){return _0x162057['destroy']()[_0xb521('0x28')](function(){_0xbd26ea[_0xb521('0x1c')](0xcc)[_0xb521('0x29')]();});}};}function handleEntityNotFound(_0x311443,_0x824bc8){return function(_0x5f1805){if(!_0x5f1805){_0x311443[_0xb521('0x1b')](0x194);}return _0x5f1805;};}function handleError(_0x9c17a4,_0x39d3ba){_0x39d3ba=_0x39d3ba||0x1f4;return function(_0x4f509d){logger['error'](_0x4f509d[_0xb521('0x2a')]);if(_0x4f509d[_0xb521('0x2b')]){delete _0x4f509d[_0xb521('0x2b')];}_0x9c17a4[_0xb521('0x1c')](_0x39d3ba)['send'](_0x4f509d);};}exports[_0xb521('0x2c')]=function(_0x33a4ac,_0x3aea69){var _0x44c911={},_0x531d96={},_0x551829={'count':0x0,'rows':[]};var _0x1d46b8=_[_0xb521('0x2d')](db[_0xb521('0x2e')][_0xb521('0x2f')],function(_0x17b2ee){return{'name':_0x17b2ee[_0xb521('0x30')],'type':_0x17b2ee['type'][_0xb521('0x31')]};});_0x531d96['model']=_['map'](_0x1d46b8,_0xb521('0x2b'));_0x531d96[_0xb521('0x32')]=_[_0xb521('0x33')](_0x33a4ac[_0xb521('0x32')]);_0x531d96[_0xb521('0x34')]=_['intersection'](_0x531d96[_0xb521('0x35')],_0x531d96[_0xb521('0x32')]);_0x44c911['attributes']=_['intersection'](_0x531d96[_0xb521('0x35')],qs[_0xb521('0x36')](_0x33a4ac[_0xb521('0x32')]['fields']));_0x44c911[_0xb521('0x37')]=_0x44c911[_0xb521('0x37')]['length']?_0x44c911['attributes']:_0x531d96['model'];if(!_0x33a4ac[_0xb521('0x32')][_0xb521('0x38')]('nolimit')){_0x44c911['limit']=qs[_0xb521('0x20')](_0x33a4ac[_0xb521('0x32')][_0xb521('0x20')]);_0x44c911[_0xb521('0x1e')]=qs['offset'](_0x33a4ac[_0xb521('0x32')][_0xb521('0x1e')]);}_0x44c911[_0xb521('0x39')]=qs[_0xb521('0x3a')](_0x33a4ac[_0xb521('0x32')][_0xb521('0x3a')]);_0x44c911[_0xb521('0x3b')]=qs['filters'](_[_0xb521('0x3c')](_0x33a4ac['query'],_0x531d96[_0xb521('0x34')]),_0x1d46b8);if(_0x33a4ac['query'][_0xb521('0x3d')]){_0x44c911[_0xb521('0x3b')]=_[_0xb521('0x3e')](_0x44c911['where'],{'$or':_[_0xb521('0x2d')](_0x1d46b8,function(_0x725e8a){if(_0x725e8a[_0xb521('0x3f')]!==_0xb521('0x40')){var _0x2fc154={};_0x2fc154[_0x725e8a[_0xb521('0x2b')]]={'$like':'%'+_0x33a4ac[_0xb521('0x32')][_0xb521('0x3d')]+'%'};return _0x2fc154;}})});}_0x44c911=_[_0xb521('0x3e')]({},_0x44c911,_0x33a4ac[_0xb521('0x41')]);var _0xe07340={'where':_0x44c911[_0xb521('0x3b')]};return db[_0xb521('0x2e')]['count'](_0xe07340)[_0xb521('0x28')](function(_0x2f4709){_0x551829['count']=_0x2f4709;if(_0x33a4ac[_0xb521('0x32')][_0xb521('0x42')]){_0x44c911['include']=[{'all':!![]}];}return db[_0xb521('0x2e')][_0xb521('0x43')](_0x44c911);})['then'](function(_0xc61d63){_0x551829[_0xb521('0x44')]=_0xc61d63;return _0x551829;})[_0xb521('0x28')](respondWithFilteredResult(_0x3aea69,_0x44c911))[_0xb521('0x45')](handleError(_0x3aea69,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 136d2cd..3d11f10 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 _0xb067=['exports','define','Migration','migrations','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x3f4f87,_0x189452){var _0x19f569=function(_0x587fec){while(--_0x587fec){_0x3f4f87['push'](_0x3f4f87['shift']());}};_0x19f569(++_0x189452);}(_0xb067,0x1b2));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7b06('0x0'));var util=require(_0x7b06('0x1'));var logger=require(_0x7b06('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7b06('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b06('0x4'));var config=require(_0x7b06('0x5'));var attributes=require('./migration.attributes');module[_0x7b06('0x6')]=function(_0x31f5b7,_0x52471d){return _0x31f5b7[_0x7b06('0x7')](_0x7b06('0x8'),attributes,{'tableName':_0x7b06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53d0=['api','moment','bluebird','request-promise','../../config/environment','./migration.attributes','define','Migration','lodash','../../config/logger'];(function(_0x31f6d2,_0x49129c){var _0xd9d2ba=function(_0x4b3e49){while(--_0x4b3e49){_0x31f6d2['push'](_0x31f6d2['shift']());}};_0xd9d2ba(++_0x49129c);}(_0x53d0,0x1b6));var _0x053d=function(_0x13717d,_0xc8ff55){_0x13717d=_0x13717d-0x0;var _0x3cb271=_0x53d0[_0x13717d];return _0x3cb271;};'use strict';var _=require(_0x053d('0x0'));var util=require('util');var logger=require(_0x053d('0x1'))(_0x053d('0x2'));var moment=require(_0x053d('0x3'));var BPromise=require(_0x053d('0x4'));var rp=require(_0x053d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x053d('0x6'));var attributes=require(_0x053d('0x7'));module['exports']=function(_0x6d34aa,_0x73fb65){return _0x6d34aa[_0x053d('0x8')](_0x053d('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ba6632e..b3fa4ef 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 _0x0834=['bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x0834,0x18e));var _0x4083=function(_0x1f9a25,_0x486bb0){_0x1f9a25=_0x1f9a25-0x0;var _0x3d7060=_0x0834[_0x1f9a25];return _0x3d7060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4083('0x0'));var BPromise=require(_0x4083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('rpc');var config=require(_0x4083('0x4'));var jayson=require(_0x4083('0x5'));var client=jayson['client'][_0x4083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a54,_0x31c7ef,_0x26ed53){return new BPromise(function(_0x2c42bb,_0x1d56dd){return client[_0x4083('0x7')](_0x5c5a54,_0x26ed53)[_0x4083('0x8')](function(_0x3cee37){logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));logger[_0x4083('0xc')](_0x4083('0xd'),_0x31c7ef,_0x4083('0xb'),JSON[_0x4083('0xe')](_0x3cee37));if(_0x3cee37[_0x4083('0xf')]){if(_0x3cee37['error']['code']===0x1f4){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x3cee37['error'][_0x4083('0x10')]);return _0x1d56dd(_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);}logger['error']('Migration,\x20%s,\x20%s',_0x31c7ef,_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);return _0x2c42bb(_0x3cee37['error'][_0x4083('0x10')]);}else{logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));_0x2c42bb(_0x3cee37[_0x4083('0x11')]['message']);}})[_0x4083('0x12')](function(_0x10cadd){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x10cadd);_0x1d56dd(_0x10cadd);});});} \ No newline at end of file +var _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3e5ae1,_0x589e27){_0x3e5ae1=_0x3e5ae1-0x0;var _0x8c4005=_0xee5b[_0x3e5ae1];return _0x8c4005;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('Migration,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('Migration,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0eb9a7c..11cb9ad 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 _0x3cdc=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','put','update','delete','destroy','exports','util'];(function(_0x4217da,_0x525263){var _0x3f583f=function(_0x378632){while(--_0x378632){_0x4217da['push'](_0x4217da['shift']());}};_0x3f583f(++_0x525263);}(_0x3cdc,0x18b));var _0xc3cd=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0x3cdc[_0x3d7a9f];return _0x13f5f1;};'use strict';var multer=require('multer');var util=require(_0xc3cd('0x0'));var path=require(_0xc3cd('0x1'));var timeout=require(_0xc3cd('0x2'));var express=require(_0xc3cd('0x3'));var router=express[_0xc3cd('0x4')]();var fs_extra=require(_0xc3cd('0x5'));var auth=require(_0xc3cd('0x6'));var interaction=require(_0xc3cd('0x7'));var config=require(_0xc3cd('0x8'));var controller=require(_0xc3cd('0x9'));router[_0xc3cd('0xa')]('/',auth[_0xc3cd('0xb')](),controller['index']);router[_0xc3cd('0xa')](_0xc3cd('0xc'),auth[_0xc3cd('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc3cd('0xd')]('/:id',auth[_0xc3cd('0xb')](),controller[_0xc3cd('0xe')]);router[_0xc3cd('0xf')](_0xc3cd('0xc'),auth['isAuthenticated'](),controller[_0xc3cd('0x10')]);module[_0xc3cd('0x11')]=router; \ No newline at end of file +var _0xb5bf=['update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xb5bf[_0x4ed520];return _0x4415a6;};'use strict';var multer=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var path=require(_0xfb5b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb5b('0x3'));var router=express['Router']();var fs_extra=require(_0xfb5b('0x4'));var auth=require(_0xfb5b('0x5'));var interaction=require(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var controller=require(_0xfb5b('0x8'));router[_0xfb5b('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb5b('0xa')]);router[_0xfb5b('0x9')](_0xfb5b('0xb'),auth[_0xfb5b('0xc')](),controller[_0xfb5b('0xd')]);router[_0xfb5b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfb5b('0xb'),auth['isAuthenticated'](),controller[_0xfb5b('0xf')]);router['delete']('/:id',auth[_0xfb5b('0xc')](),controller[_0xfb5b('0x10')]);module[_0xfb5b('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 55a2ef3..0df042e 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 _0xd266=['turn','STRING','sequelize','externip','stun'];(function(_0x39f6ca,_0x2d55f4){var _0x58f147=function(_0x3d9d68){while(--_0x3d9d68){_0x39f6ca['push'](_0x39f6ca['shift']());}};_0x58f147(++_0x2d55f4);}(_0xd266,0x165));var _0x6d26=function(_0x248be3,_0x203e1f){_0x248be3=_0x248be3-0x0;var _0x255f8f=_0xd266[_0x248be3];return _0x255f8f;};'use strict';var Sequelize=require(_0x6d26('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('localnet',_0x6d26('0x1'),_0x6d26('0x2'),_0x6d26('0x3'))},'value':{'type':Sequelize[_0x6d26('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6d26('0x4')]}}; \ No newline at end of file +var _0x5caf=['ENUM','localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0x58d8d7,_0x3aedbc){var _0x13fb94=function(_0x2468e9){while(--_0x2468e9){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x13fb94(++_0x3aedbc);}(_0x5caf,0x156));var _0xf5ca=function(_0x4d6de0,_0x2347ff){_0x4d6de0=_0x4d6de0-0x0;var _0x42cf75=_0x5caf[_0x4d6de0];return _0x42cf75;};'use strict';var Sequelize=require(_0xf5ca('0x0'));module[_0xf5ca('0x1')]={'type':{'type':Sequelize[_0xf5ca('0x2')](_0xf5ca('0x3'),_0xf5ca('0x4'),_0xf5ca('0x5'),_0xf5ca('0x6'))},'value':{'type':Sequelize[_0xf5ca('0x7')]},'username':{'type':Sequelize[_0xf5ca('0x7')]},'password':{'type':Sequelize[_0xf5ca('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 1696c23..c3483c4 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 _0x313c=['offset','undefined','count','limit','Content-Range','apply','save','update','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','rows','catch','show','params','keys','length','transaction','create','body','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','toUpperCase','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','findAll','/etc/asterisk/stun_xcally.conf','STUN','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x313c,0x1f3));var _0xc313=function(_0x40f84e,_0x444428){_0x40f84e=_0x40f84e-0x0;var _0x3cc65a=_0x313c[_0x40f84e];return _0x3cc65a;};'use strict';var emlformat=require(_0xc313('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc313('0x1'));var jsonpatch=require(_0xc313('0x2'));var rp=require(_0xc313('0x3'));var moment=require(_0xc313('0x4'));var BPromise=require(_0xc313('0x5'));var Mustache=require(_0xc313('0x6'));var util=require(_0xc313('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc313('0x8'));var fs=require('fs');var fs_extra=require(_0xc313('0x9'));var _=require(_0xc313('0xa'));var squel=require(_0xc313('0xb'));var crypto=require(_0xc313('0xc'));var jsforce=require(_0xc313('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc313('0xe'));var querystring=require(_0xc313('0xf'));var Papa=require(_0xc313('0x10'));var Redis=require(_0xc313('0x11'));var authService=require(_0xc313('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc313('0x13'));var logger=require('../../config/logger')(_0xc313('0x14'));var utils=require(_0xc313('0x15'));var config=require(_0xc313('0x16'));var licenseUtil=require(_0xc313('0x17'));var db=require(_0xc313('0x18'))['db'];var jayson=require(_0xc313('0x19'));var client=jayson[_0xc313('0x1a')][_0xc313('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2034ea,_0x53354d,_0x2b4eff,_0x2bcb76){return new BPromise(function(_0x38d8e4,_0xc4741a){var _0x1f0a70=_0x2bcb76||client;return _0x1f0a70[_0xc313('0x1c')](_0x2034ea,_0x2b4eff)[_0xc313('0x1d')](function(_0x219305){logger[_0xc313('0x1e')](_0xc313('0x1f'),_0x53354d,_0xc313('0x20'));logger[_0xc313('0x21')](_0xc313('0x22'),_0x53354d,_0xc313('0x20'),JSON[_0xc313('0x23')](_0x219305));if(_0x219305['error']){if(_0x219305[_0xc313('0x24')][_0xc313('0x25')]===0x1f4){logger[_0xc313('0x24')]('Network,\x20%s,\x20%s',_0x53354d,_0x219305[_0xc313('0x24')][_0xc313('0x26')]);return _0xc4741a(_0x219305[_0xc313('0x24')]['message']);}logger['error'](_0xc313('0x1f'),_0x53354d,_0x219305['error']['message']);return _0x38d8e4(_0x219305[_0xc313('0x24')][_0xc313('0x26')]);}else{logger[_0xc313('0x1e')](_0xc313('0x1f'),_0x53354d,_0xc313('0x20'));_0x38d8e4(_0x219305['result']['message']);}})['catch'](function(_0xe5f9d6){logger['error'](_0xc313('0x1f'),_0x53354d,_0xe5f9d6);_0xc4741a(_0xe5f9d6);});});}function respondWithStatusCode(_0x3e1a69,_0xa80100){_0xa80100=_0xa80100||0xcc;return function(_0x245d36){if(_0x245d36){return _0x3e1a69['sendStatus'](_0xa80100);}return _0x3e1a69[_0xc313('0x27')](_0xa80100)['end']();};}function respondWithResult(_0x1cb136,_0x1cd12f){_0x1cd12f=_0x1cd12f||0xc8;return function(_0xd6fd1c){if(_0xd6fd1c){return _0x1cb136[_0xc313('0x27')](_0x1cd12f)[_0xc313('0x28')](_0xd6fd1c);}};}function respondWithFilteredResult(_0xa449eb,_0x15a6be){return function(_0x6bfa8a){if(_0x6bfa8a){var _0x14a841=typeof _0x15a6be[_0xc313('0x29')]===_0xc313('0x2a')&&typeof _0x15a6be['limit']==='undefined';var _0x3fa414=_0x6bfa8a[_0xc313('0x2b')];var _0xe3e7de=_0x14a841?0x0:_0x15a6be['offset'];var _0x1c861f=_0x14a841?_0x6bfa8a['count']:_0x15a6be['offset']+_0x15a6be[_0xc313('0x2c')];var _0x342ec4;if(_0x1c861f>=_0x3fa414){_0x1c861f=_0x3fa414;_0x342ec4=0xc8;}else{_0x342ec4=0xce;}_0xa449eb[_0xc313('0x27')](_0x342ec4);return _0xa449eb['set'](_0xc313('0x2d'),_0xe3e7de+'-'+_0x1c861f+'/'+_0x3fa414)['json'](_0x6bfa8a);}return null;};}function patchUpdates(_0x4e266c){return function(_0x4f734a){try{jsonpatch[_0xc313('0x2e')](_0x4f734a,_0x4e266c,!![]);}catch(_0x262230){return BPromise['reject'](_0x262230);}return _0x4f734a[_0xc313('0x2f')]();};}function saveUpdates(_0x13e03d,_0x59e8bd){return function(_0x2eb068){if(_0x2eb068){return _0x2eb068[_0xc313('0x30')](_0x13e03d)[_0xc313('0x1d')](function(_0x4aa526){return _0x4aa526;});}return null;};}function removeEntity(_0x2b5385,_0x126ce3){return function(_0x1c9f91){if(_0x1c9f91){return _0x1c9f91[_0xc313('0x31')]()['then'](function(){_0x2b5385['status'](0xcc)[_0xc313('0x32')]();});}};}function handleEntityNotFound(_0x141b94,_0x5156c6){return function(_0x1023d5){if(!_0x1023d5){_0x141b94[_0xc313('0x33')](0x194);}return _0x1023d5;};}function handleError(_0x5cd85b,_0x1d40d6){_0x1d40d6=_0x1d40d6||0x1f4;return function(_0x4caf7d){logger[_0xc313('0x24')](_0x4caf7d['stack']);if(_0x4caf7d[_0xc313('0x34')]){delete _0x4caf7d[_0xc313('0x34')];}_0x5cd85b['status'](_0x1d40d6)[_0xc313('0x35')](_0x4caf7d);};}exports[_0xc313('0x36')]=function(_0x29fc14,_0x2053b3){var _0x56a3e1={},_0x11cbea={},_0x582786={'count':0x0,'rows':[]};var _0x3c7e87=_[_0xc313('0x37')](db['Network'][_0xc313('0x38')],function(_0x5b472c){return{'name':_0x5b472c[_0xc313('0x39')],'type':_0x5b472c[_0xc313('0x3a')]['key']};});_0x11cbea[_0xc313('0x3b')]=_[_0xc313('0x37')](_0x3c7e87,_0xc313('0x34'));_0x11cbea[_0xc313('0x3c')]=_['keys'](_0x29fc14['query']);_0x11cbea['filters']=_['intersection'](_0x11cbea['model'],_0x11cbea[_0xc313('0x3c')]);_0x56a3e1[_0xc313('0x3d')]=_[_0xc313('0x3e')](_0x11cbea[_0xc313('0x3b')],qs['fields'](_0x29fc14['query'][_0xc313('0x3f')]));_0x56a3e1[_0xc313('0x3d')]=_0x56a3e1[_0xc313('0x3d')]['length']?_0x56a3e1[_0xc313('0x3d')]:_0x11cbea[_0xc313('0x3b')];if(!_0x29fc14[_0xc313('0x3c')][_0xc313('0x40')](_0xc313('0x41'))){_0x56a3e1[_0xc313('0x2c')]=qs[_0xc313('0x2c')](_0x29fc14[_0xc313('0x3c')][_0xc313('0x2c')]);_0x56a3e1[_0xc313('0x29')]=qs['offset'](_0x29fc14[_0xc313('0x3c')][_0xc313('0x29')]);}_0x56a3e1[_0xc313('0x42')]=qs[_0xc313('0x43')](_0x29fc14[_0xc313('0x3c')]['sort']);_0x56a3e1[_0xc313('0x44')]=qs[_0xc313('0x45')](_[_0xc313('0x46')](_0x29fc14[_0xc313('0x3c')],_0x11cbea['filters']),_0x3c7e87);if(_0x29fc14[_0xc313('0x3c')][_0xc313('0x47')]){_0x56a3e1[_0xc313('0x44')]=_[_0xc313('0x48')](_0x56a3e1[_0xc313('0x44')],{'$or':_[_0xc313('0x37')](_0x3c7e87,function(_0x4d90b8){if(_0x4d90b8[_0xc313('0x3a')]!==_0xc313('0x49')){var _0x4eb376={};_0x4eb376[_0x4d90b8[_0xc313('0x34')]]={'$like':'%'+_0x29fc14['query'][_0xc313('0x47')]+'%'};return _0x4eb376;}})});}_0x56a3e1=_[_0xc313('0x48')]({},_0x56a3e1,_0x29fc14[_0xc313('0x4a')]);var _0x347a69={'where':_0x56a3e1[_0xc313('0x44')]};return db[_0xc313('0x4b')][_0xc313('0x2b')](_0x347a69)[_0xc313('0x1d')](function(_0x4160d9){_0x582786[_0xc313('0x2b')]=_0x4160d9;if(_0x29fc14[_0xc313('0x3c')][_0xc313('0x4c')]){_0x56a3e1[_0xc313('0x4d')]=[{'all':!![]}];}return db['Network']['findAll'](_0x56a3e1);})[_0xc313('0x1d')](function(_0x1637fd){_0x582786[_0xc313('0x4e')]=_0x1637fd;return _0x582786;})[_0xc313('0x1d')](respondWithFilteredResult(_0x2053b3,_0x56a3e1))[_0xc313('0x4f')](handleError(_0x2053b3,null));};exports[_0xc313('0x50')]=function(_0x2d068d,_0xfe2c9){var _0x37aca6={'raw':!![],'where':{'id':_0x2d068d[_0xc313('0x51')]['id']}},_0xe5f6e6={};_0xe5f6e6[_0xc313('0x3b')]=_[_0xc313('0x52')](db[_0xc313('0x4b')][_0xc313('0x38')]);_0xe5f6e6['query']=_[_0xc313('0x52')](_0x2d068d[_0xc313('0x3c')]);_0xe5f6e6[_0xc313('0x45')]=_[_0xc313('0x3e')](_0xe5f6e6[_0xc313('0x3b')],_0xe5f6e6[_0xc313('0x3c')]);_0x37aca6[_0xc313('0x3d')]=_['intersection'](_0xe5f6e6[_0xc313('0x3b')],qs[_0xc313('0x3f')](_0x2d068d[_0xc313('0x3c')][_0xc313('0x3f')]));_0x37aca6[_0xc313('0x3d')]=_0x37aca6[_0xc313('0x3d')][_0xc313('0x53')]?_0x37aca6[_0xc313('0x3d')]:_0xe5f6e6[_0xc313('0x3b')];if(_0x2d068d[_0xc313('0x3c')]['includeAll']){_0x37aca6[_0xc313('0x4d')]=[{'all':!![]}];}_0x37aca6=_[_0xc313('0x48')]({},_0x37aca6,_0x2d068d[_0xc313('0x4a')]);return db[_0xc313('0x4b')]['find'](_0x37aca6)['then'](handleEntityNotFound(_0xfe2c9,null))['then'](respondWithResult(_0xfe2c9,null))[_0xc313('0x4f')](handleError(_0xfe2c9,null));};exports['create']=function(_0x2496e8,_0x1ae41e,_0x546c81){var _0x99bec6;return db['sequelize'][_0xc313('0x54')](function(_0x44c31c){return db['Network'][_0xc313('0x55')](_0x2496e8['body'],{'raw':!![]})['then'](function(_0x329d85){_0x99bec6=_0x329d85;return db[_0xc313('0x4b')]['findAll']({'where':{'type':_0x2496e8[_0xc313('0x56')]['type']},'raw':!![]});})[_0xc313('0x1d')](function(_0x5e587f){if(_0x99bec6[_0xc313('0x3a')]['toUpperCase']()=='STUN'){var _0x173169=fs[_0xc313('0x57')](path[_0xc313('0x58')](config[_0xc313('0x59')],_0xc313('0x5a')),_0xc313('0x5b'));var _0x1b2d55=ejs[_0xc313('0x5c')](_0x173169,{'networks':_0x5e587f||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1b2d55);return respondWithRpcPromise(_0xc313('0x5d'),_0xc313('0x55'),{'module':_0xc313('0x5e')});}else if(_0x99bec6[_0xc313('0x3a')][_0xc313('0x5f')]()=='TURN'){var _0x143ab2=fs['readFileSync'](path['join'](config[_0xc313('0x59')],_0xc313('0x60')),_0xc313('0x5b'));var _0x2e9441=ejs['render'](_0x143ab2,{'networks':_0x5e587f||[]});fs[_0xc313('0x61')](_0xc313('0x62'),_0x2e9441);return respondWithRpcPromise('Reload',_0xc313('0x55'),{'module':_0xc313('0x5e')});}else{var _0x278462=fs[_0xc313('0x57')](path['join'](config['root'],_0xc313('0x63')),'utf8');var _0x5cfb4b=ejs[_0xc313('0x5c')](_0x278462,{'networks':_0x5e587f||[]});fs[_0xc313('0x61')](util[_0xc313('0x64')](_0xc313('0x65'),_0x2496e8[_0xc313('0x56')][_0xc313('0x3a')][_0xc313('0x66')]()),_0x5cfb4b);return respondWithRpcPromise(_0xc313('0x5d'),_0xc313('0x55'),{'module':_0xc313('0x67')});}return null;})[_0xc313('0x1d')](function(){return _0x99bec6;});})[_0xc313('0x1d')](respondWithResult(_0x1ae41e,0xc9))[_0xc313('0x4f')](handleError(_0x1ae41e,null));};exports[_0xc313('0x30')]=function(_0x222319,_0x24fa91,_0x1dc169){var _0xdabe6;return db['sequelize']['transaction'](function(_0x392b11){return db[_0xc313('0x4b')][_0xc313('0x68')]({'where':{'id':_0x222319[_0xc313('0x51')]['id']}})['then'](handleEntityNotFound(_0x24fa91,null))[_0xc313('0x1d')](saveUpdates(_0x222319['body'],null))[_0xc313('0x1d')](function(_0x49258f){if(_0x49258f){_0xdabe6=_0x49258f;return db['Network'][_0xc313('0x69')]({'where':{'type':_0xdabe6[_0xc313('0x3a')]},'raw':!![]});}return null;})[_0xc313('0x1d')](function(_0x1c05fa){if(_0xdabe6['type']['toUpperCase']()=='STUN'){var _0x3b182d=fs['readFileSync'](path[_0xc313('0x58')](config[_0xc313('0x59')],_0xc313('0x5a')),_0xc313('0x5b'));var _0x35ff06=ejs[_0xc313('0x5c')](_0x3b182d,{'networks':_0x1c05fa||[]});fs[_0xc313('0x61')](_0xc313('0x6a'),_0x35ff06);return respondWithRpcPromise(_0xc313('0x5d'),_0xc313('0x30'),{'module':_0xc313('0x5e')});}else if(_0xdabe6['type'][_0xc313('0x5f')]()=='TURN'){var _0x52c03d=fs[_0xc313('0x57')](path[_0xc313('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xc313('0x5b'));var _0x313e7a=ejs[_0xc313('0x5c')](_0x52c03d,{'networks':_0x1c05fa||[]});fs[_0xc313('0x61')](_0xc313('0x62'),_0x313e7a);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else{var _0x257969=fs[_0xc313('0x57')](path[_0xc313('0x58')](config[_0xc313('0x59')],'server/files/templates/network.ejs'),'utf8');var _0x13526b=ejs[_0xc313('0x5c')](_0x257969,{'networks':_0x1c05fa||[]});fs[_0xc313('0x61')](util[_0xc313('0x64')](_0xc313('0x65'),_0x222319[_0xc313('0x56')][_0xc313('0x3a')][_0xc313('0x66')]()),_0x13526b);return respondWithRpcPromise(_0xc313('0x5d'),'update',{'module':_0xc313('0x67')});}return null;})[_0xc313('0x1d')](function(_0x456751){if(_0x456751){return _0xdabe6;}return null;});})[_0xc313('0x1d')](respondWithResult(_0x24fa91,null))[_0xc313('0x4f')](handleError(_0x24fa91,null));};exports[_0xc313('0x31')]=function(_0x5962e7,_0x57151e,_0x1ab169){var _0x17b0ce;return db[_0xc313('0x4b')][_0xc313('0x68')]({'where':{'id':_0x5962e7[_0xc313('0x51')]['id']}})[_0xc313('0x1d')](function(_0x2e1ebe){_0x17b0ce=_0x2e1ebe;return _0x2e1ebe;})[_0xc313('0x1d')](handleEntityNotFound(_0x57151e,null))[_0xc313('0x1d')](removeEntity(_0x57151e,null))[_0xc313('0x1d')](function(){if(_0x17b0ce){return db['Network'][_0xc313('0x69')]({'where':{'type':_0x17b0ce[_0xc313('0x3a')]},'raw':!![]});}})[_0xc313('0x1d')](function(_0x561077){if(_0x17b0ce['type'][_0xc313('0x5f')]()==_0xc313('0x6b')){var _0x825407=fs[_0xc313('0x57')](path[_0xc313('0x58')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xc313('0x5b'));var _0x2176dd=ejs[_0xc313('0x5c')](_0x825407,{'networks':_0x561077||[]});fs[_0xc313('0x61')](_0xc313('0x6a'),_0x2176dd);return respondWithRpcPromise(_0xc313('0x5d'),_0xc313('0x31'),{'module':_0xc313('0x5e')});}else if(_0x17b0ce[_0xc313('0x3a')][_0xc313('0x5f')]()=='TURN'){var _0x556a23=fs[_0xc313('0x57')](path['join'](config[_0xc313('0x59')],_0xc313('0x60')),_0xc313('0x5b'));var _0x10f027=ejs['render'](_0x556a23,{'networks':_0x561077||[]});fs[_0xc313('0x61')](_0xc313('0x62'),_0x10f027);return respondWithRpcPromise(_0xc313('0x5d'),_0xc313('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x37fee3=fs[_0xc313('0x57')](path['join'](config[_0xc313('0x59')],'server/files/templates/network.ejs'),_0xc313('0x5b'));var _0x570951=ejs[_0xc313('0x5c')](_0x37fee3,{'networks':_0x561077||[]});fs[_0xc313('0x61')](util['format'](_0xc313('0x65'),_0x5962e7[_0xc313('0x56')]['type'][_0xc313('0x66')]()),_0x570951);return respondWithRpcPromise(_0xc313('0x5d'),_0xc313('0x31'),{'module':_0xc313('0x67')});}return null;})[_0xc313('0x4f')](handleError(_0x57151e,null));}; \ No newline at end of file +var _0xbf01=['body','toUpperCase','STUN','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','server/files/templates/stun_multiple.ejs','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','sendStatus','name','index','map','Network','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0xbf01,0x83));var _0x1bf0=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xbf01[_0x2de0a7];return _0x429437;};'use strict';var emlformat=require(_0x1bf0('0x0'));var rimraf=require(_0x1bf0('0x1'));var zipdir=require(_0x1bf0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1bf0('0x3'));var moment=require(_0x1bf0('0x4'));var BPromise=require(_0x1bf0('0x5'));var Mustache=require(_0x1bf0('0x6'));var util=require(_0x1bf0('0x7'));var path=require(_0x1bf0('0x8'));var sox=require(_0x1bf0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bf0('0xa'));var _=require(_0x1bf0('0xb'));var squel=require(_0x1bf0('0xc'));var crypto=require(_0x1bf0('0xd'));var jsforce=require(_0x1bf0('0xe'));var deskjs=require(_0x1bf0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1bf0('0x10'));var Redis=require(_0x1bf0('0x11'));var authService=require(_0x1bf0('0x12'));var qs=require(_0x1bf0('0x13'));var as=require(_0x1bf0('0x14'));var hardwareService=require(_0x1bf0('0x15'));var logger=require(_0x1bf0('0x16'))('api');var utils=require(_0x1bf0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1bf0('0x18'));var db=require(_0x1bf0('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1bf0('0x1a')][_0x1bf0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3e193e,_0x14fff8,_0x454798,_0x1ba33b){return new BPromise(function(_0x53a717,_0x31b6ac){var _0x25f98d=_0x1ba33b||client;return _0x25f98d['request'](_0x3e193e,_0x454798)[_0x1bf0('0x1c')](function(_0x1174d1){logger[_0x1bf0('0x1d')](_0x1bf0('0x1e'),_0x14fff8,_0x1bf0('0x1f'));logger[_0x1bf0('0x20')](_0x1bf0('0x21'),_0x14fff8,'request\x20sent',JSON['stringify'](_0x1174d1));if(_0x1174d1[_0x1bf0('0x22')]){if(_0x1174d1[_0x1bf0('0x22')]['code']===0x1f4){logger[_0x1bf0('0x22')](_0x1bf0('0x1e'),_0x14fff8,_0x1174d1[_0x1bf0('0x22')][_0x1bf0('0x23')]);return _0x31b6ac(_0x1174d1['error']['message']);}logger[_0x1bf0('0x22')]('Network,\x20%s,\x20%s',_0x14fff8,_0x1174d1['error'][_0x1bf0('0x23')]);return _0x53a717(_0x1174d1['error'][_0x1bf0('0x23')]);}else{logger[_0x1bf0('0x1d')](_0x1bf0('0x1e'),_0x14fff8,'request\x20sent');_0x53a717(_0x1174d1[_0x1bf0('0x24')]['message']);}})[_0x1bf0('0x25')](function(_0x4f9ebe){logger[_0x1bf0('0x22')](_0x1bf0('0x1e'),_0x14fff8,_0x4f9ebe);_0x31b6ac(_0x4f9ebe);});});}function respondWithStatusCode(_0x430a37,_0x2fbfc5){_0x2fbfc5=_0x2fbfc5||0xcc;return function(_0x5dcb83){if(_0x5dcb83){return _0x430a37['sendStatus'](_0x2fbfc5);}return _0x430a37[_0x1bf0('0x26')](_0x2fbfc5)[_0x1bf0('0x27')]();};}function respondWithResult(_0x4731e3,_0x47d60e){_0x47d60e=_0x47d60e||0xc8;return function(_0x3eab2a){if(_0x3eab2a){return _0x4731e3[_0x1bf0('0x26')](_0x47d60e)[_0x1bf0('0x28')](_0x3eab2a);}};}function respondWithFilteredResult(_0xa59805,_0x12be8c){return function(_0x5d6b4c){if(_0x5d6b4c){var _0x20a62f=typeof _0x12be8c[_0x1bf0('0x29')]===_0x1bf0('0x2a')&&typeof _0x12be8c[_0x1bf0('0x2b')]==='undefined';var _0x4fc1ef=_0x5d6b4c[_0x1bf0('0x2c')];var _0x5dee31=_0x20a62f?0x0:_0x12be8c[_0x1bf0('0x29')];var _0x12496f=_0x20a62f?_0x5d6b4c[_0x1bf0('0x2c')]:_0x12be8c[_0x1bf0('0x29')]+_0x12be8c[_0x1bf0('0x2b')];var _0x41537f;if(_0x12496f>=_0x4fc1ef){_0x12496f=_0x4fc1ef;_0x41537f=0xc8;}else{_0x41537f=0xce;}_0xa59805[_0x1bf0('0x26')](_0x41537f);return _0xa59805[_0x1bf0('0x2d')]('Content-Range',_0x5dee31+'-'+_0x12496f+'/'+_0x4fc1ef)[_0x1bf0('0x28')](_0x5d6b4c);}return null;};}function patchUpdates(_0x238199){return function(_0x5c19cd){try{jsonpatch[_0x1bf0('0x2e')](_0x5c19cd,_0x238199,!![]);}catch(_0x137b3b){return BPromise[_0x1bf0('0x2f')](_0x137b3b);}return _0x5c19cd[_0x1bf0('0x30')]();};}function saveUpdates(_0x27e854,_0x39f5d7){return function(_0x59554c){if(_0x59554c){return _0x59554c[_0x1bf0('0x31')](_0x27e854)[_0x1bf0('0x1c')](function(_0x1edb3f){return _0x1edb3f;});}return null;};}function removeEntity(_0x40d995,_0x3d44f4){return function(_0x133126){if(_0x133126){return _0x133126[_0x1bf0('0x32')]()[_0x1bf0('0x1c')](function(){_0x40d995['status'](0xcc)[_0x1bf0('0x27')]();});}};}function handleEntityNotFound(_0x49c6c1,_0xf05581){return function(_0x1caf0f){if(!_0x1caf0f){_0x49c6c1[_0x1bf0('0x33')](0x194);}return _0x1caf0f;};}function handleError(_0x51e77f,_0x1f1619){_0x1f1619=_0x1f1619||0x1f4;return function(_0x24a1c5){logger[_0x1bf0('0x22')](_0x24a1c5['stack']);if(_0x24a1c5[_0x1bf0('0x34')]){delete _0x24a1c5['name'];}_0x51e77f[_0x1bf0('0x26')](_0x1f1619)['send'](_0x24a1c5);};}exports[_0x1bf0('0x35')]=function(_0x51552a,_0xd13312){var _0x2e60b1={},_0x237098={},_0x32e8e9={'count':0x0,'rows':[]};var _0xadd4f7=_[_0x1bf0('0x36')](db[_0x1bf0('0x37')][_0x1bf0('0x38')],function(_0x18ffc8){return{'name':_0x18ffc8[_0x1bf0('0x39')],'type':_0x18ffc8[_0x1bf0('0x3a')][_0x1bf0('0x3b')]};});_0x237098[_0x1bf0('0x3c')]=_[_0x1bf0('0x36')](_0xadd4f7,'name');_0x237098['query']=_[_0x1bf0('0x3d')](_0x51552a['query']);_0x237098[_0x1bf0('0x3e')]=_[_0x1bf0('0x3f')](_0x237098[_0x1bf0('0x3c')],_0x237098['query']);_0x2e60b1[_0x1bf0('0x40')]=_[_0x1bf0('0x3f')](_0x237098[_0x1bf0('0x3c')],qs[_0x1bf0('0x41')](_0x51552a[_0x1bf0('0x42')]['fields']));_0x2e60b1[_0x1bf0('0x40')]=_0x2e60b1[_0x1bf0('0x40')][_0x1bf0('0x43')]?_0x2e60b1['attributes']:_0x237098['model'];if(!_0x51552a['query'][_0x1bf0('0x44')](_0x1bf0('0x45'))){_0x2e60b1[_0x1bf0('0x2b')]=qs[_0x1bf0('0x2b')](_0x51552a['query'][_0x1bf0('0x2b')]);_0x2e60b1[_0x1bf0('0x29')]=qs[_0x1bf0('0x29')](_0x51552a[_0x1bf0('0x42')][_0x1bf0('0x29')]);}_0x2e60b1[_0x1bf0('0x46')]=qs['sort'](_0x51552a[_0x1bf0('0x42')][_0x1bf0('0x47')]);_0x2e60b1[_0x1bf0('0x48')]=qs[_0x1bf0('0x3e')](_[_0x1bf0('0x49')](_0x51552a['query'],_0x237098[_0x1bf0('0x3e')]),_0xadd4f7);if(_0x51552a[_0x1bf0('0x42')]['filter']){_0x2e60b1[_0x1bf0('0x48')]=_[_0x1bf0('0x4a')](_0x2e60b1[_0x1bf0('0x48')],{'$or':_[_0x1bf0('0x36')](_0xadd4f7,function(_0x5bf016){if(_0x5bf016['type']!==_0x1bf0('0x4b')){var _0x4f7dba={};_0x4f7dba[_0x5bf016[_0x1bf0('0x34')]]={'$like':'%'+_0x51552a[_0x1bf0('0x42')][_0x1bf0('0x4c')]+'%'};return _0x4f7dba;}})});}_0x2e60b1=_['merge']({},_0x2e60b1,_0x51552a[_0x1bf0('0x4d')]);var _0x3c53ae={'where':_0x2e60b1['where']};return db[_0x1bf0('0x37')][_0x1bf0('0x2c')](_0x3c53ae)[_0x1bf0('0x1c')](function(_0x4f83cb){_0x32e8e9[_0x1bf0('0x2c')]=_0x4f83cb;if(_0x51552a[_0x1bf0('0x42')][_0x1bf0('0x4e')]){_0x2e60b1[_0x1bf0('0x4f')]=[{'all':!![]}];}return db['Network'][_0x1bf0('0x50')](_0x2e60b1);})[_0x1bf0('0x1c')](function(_0x58b307){_0x32e8e9[_0x1bf0('0x51')]=_0x58b307;return _0x32e8e9;})[_0x1bf0('0x1c')](respondWithFilteredResult(_0xd13312,_0x2e60b1))[_0x1bf0('0x25')](handleError(_0xd13312,null));};exports[_0x1bf0('0x52')]=function(_0x438508,_0x4b83e8){var _0x1f8f65={'raw':!![],'where':{'id':_0x438508[_0x1bf0('0x53')]['id']}},_0x1ea539={};_0x1ea539['model']=_[_0x1bf0('0x3d')](db[_0x1bf0('0x37')][_0x1bf0('0x38')]);_0x1ea539[_0x1bf0('0x42')]=_[_0x1bf0('0x3d')](_0x438508['query']);_0x1ea539['filters']=_['intersection'](_0x1ea539[_0x1bf0('0x3c')],_0x1ea539['query']);_0x1f8f65[_0x1bf0('0x40')]=_[_0x1bf0('0x3f')](_0x1ea539[_0x1bf0('0x3c')],qs[_0x1bf0('0x41')](_0x438508[_0x1bf0('0x42')][_0x1bf0('0x41')]));_0x1f8f65[_0x1bf0('0x40')]=_0x1f8f65[_0x1bf0('0x40')][_0x1bf0('0x43')]?_0x1f8f65['attributes']:_0x1ea539['model'];if(_0x438508[_0x1bf0('0x42')][_0x1bf0('0x4e')]){_0x1f8f65[_0x1bf0('0x4f')]=[{'all':!![]}];}_0x1f8f65=_[_0x1bf0('0x4a')]({},_0x1f8f65,_0x438508['options']);return db[_0x1bf0('0x37')]['find'](_0x1f8f65)[_0x1bf0('0x1c')](handleEntityNotFound(_0x4b83e8,null))['then'](respondWithResult(_0x4b83e8,null))[_0x1bf0('0x25')](handleError(_0x4b83e8,null));};exports[_0x1bf0('0x54')]=function(_0xd44137,_0x18dfcd,_0x2e74e0){var _0x3f85f7;return db['sequelize']['transaction'](function(_0x4f06e4){return db[_0x1bf0('0x37')][_0x1bf0('0x54')](_0xd44137[_0x1bf0('0x55')],{'raw':!![]})['then'](function(_0x5884e2){_0x3f85f7=_0x5884e2;return db['Network'][_0x1bf0('0x50')]({'where':{'type':_0xd44137[_0x1bf0('0x55')]['type']},'raw':!![]});})[_0x1bf0('0x1c')](function(_0x263d0d){if(_0x3f85f7['type'][_0x1bf0('0x56')]()==_0x1bf0('0x57')){var _0x52d2da=fs[_0x1bf0('0x58')](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x1bf0('0x5b'));var _0x5d754e=ejs[_0x1bf0('0x5c')](_0x52d2da,{'networks':_0x263d0d||[]});fs['writeFileSync'](_0x1bf0('0x5d'),_0x5d754e);return respondWithRpcPromise(_0x1bf0('0x5e'),_0x1bf0('0x54'),{'module':'res_stun_monitor.so'});}else if(_0x3f85f7['type'][_0x1bf0('0x56')]()==_0x1bf0('0x5f')){var _0x63d2fb=fs[_0x1bf0('0x58')](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],_0x1bf0('0x60')),_0x1bf0('0x5b'));var _0x4ab529=ejs[_0x1bf0('0x5c')](_0x63d2fb,{'networks':_0x263d0d||[]});fs[_0x1bf0('0x61')](_0x1bf0('0x62'),_0x4ab529);return respondWithRpcPromise('Reload',_0x1bf0('0x54'),{'module':_0x1bf0('0x63')});}else{var _0x51fa46=fs[_0x1bf0('0x58')](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],_0x1bf0('0x64')),'utf8');var _0x4609cf=ejs[_0x1bf0('0x5c')](_0x51fa46,{'networks':_0x263d0d||[]});fs[_0x1bf0('0x61')](util[_0x1bf0('0x65')](_0x1bf0('0x66'),_0xd44137[_0x1bf0('0x55')]['type'][_0x1bf0('0x67')]()),_0x4609cf);return respondWithRpcPromise('Reload','create',{'module':_0x1bf0('0x68')});}return null;})['then'](function(){return _0x3f85f7;});})[_0x1bf0('0x1c')](respondWithResult(_0x18dfcd,0xc9))[_0x1bf0('0x25')](handleError(_0x18dfcd,null));};exports[_0x1bf0('0x31')]=function(_0x561e9c,_0x5c8686,_0x1be670){var _0x958995;return db['sequelize'][_0x1bf0('0x69')](function(_0x303045){return db[_0x1bf0('0x37')]['find']({'where':{'id':_0x561e9c['params']['id']}})['then'](handleEntityNotFound(_0x5c8686,null))[_0x1bf0('0x1c')](saveUpdates(_0x561e9c['body'],null))[_0x1bf0('0x1c')](function(_0x13e00e){if(_0x13e00e){_0x958995=_0x13e00e;return db[_0x1bf0('0x37')]['findAll']({'where':{'type':_0x958995[_0x1bf0('0x3a')]},'raw':!![]});}return null;})['then'](function(_0x55d865){if(_0x958995[_0x1bf0('0x3a')][_0x1bf0('0x56')]()=='STUN'){var _0x2badbf=fs[_0x1bf0('0x58')](path[_0x1bf0('0x59')](config['root'],_0x1bf0('0x6a')),_0x1bf0('0x5b'));var _0x2a9ca7=ejs[_0x1bf0('0x5c')](_0x2badbf,{'networks':_0x55d865||[]});fs[_0x1bf0('0x61')]('/etc/asterisk/stun_xcally.conf',_0x2a9ca7);return respondWithRpcPromise(_0x1bf0('0x5e'),_0x1bf0('0x31'),{'module':_0x1bf0('0x63')});}else if(_0x958995[_0x1bf0('0x3a')][_0x1bf0('0x56')]()==_0x1bf0('0x5f')){var _0x48484d=fs['readFileSync'](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],'server/files/templates/turn_multiple.ejs'),_0x1bf0('0x5b'));var _0x91a884=ejs[_0x1bf0('0x5c')](_0x48484d,{'networks':_0x55d865||[]});fs[_0x1bf0('0x61')](_0x1bf0('0x62'),_0x91a884);return respondWithRpcPromise(_0x1bf0('0x5e'),_0x1bf0('0x31'),{'module':_0x1bf0('0x63')});}else{var _0x940305=fs[_0x1bf0('0x58')](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],_0x1bf0('0x64')),_0x1bf0('0x5b'));var _0x1e07fd=ejs[_0x1bf0('0x5c')](_0x940305,{'networks':_0x55d865||[]});fs[_0x1bf0('0x61')](util['format'](_0x1bf0('0x66'),_0x561e9c[_0x1bf0('0x55')][_0x1bf0('0x3a')][_0x1bf0('0x67')]()),_0x1e07fd);return respondWithRpcPromise(_0x1bf0('0x5e'),_0x1bf0('0x31'),{'module':_0x1bf0('0x68')});}return null;})[_0x1bf0('0x1c')](function(_0x1f88ea){if(_0x1f88ea){return _0x958995;}return null;});})[_0x1bf0('0x1c')](respondWithResult(_0x5c8686,null))[_0x1bf0('0x25')](handleError(_0x5c8686,null));};exports[_0x1bf0('0x32')]=function(_0x57751b,_0x3fc898,_0x4fa6ee){var _0x3f4ae4;return db[_0x1bf0('0x37')][_0x1bf0('0x6b')]({'where':{'id':_0x57751b['params']['id']}})['then'](function(_0x12af51){_0x3f4ae4=_0x12af51;return _0x12af51;})['then'](handleEntityNotFound(_0x3fc898,null))['then'](removeEntity(_0x3fc898,null))[_0x1bf0('0x1c')](function(){if(_0x3f4ae4){return db[_0x1bf0('0x37')][_0x1bf0('0x50')]({'where':{'type':_0x3f4ae4['type']},'raw':!![]});}})['then'](function(_0x8bf88){if(_0x3f4ae4[_0x1bf0('0x3a')][_0x1bf0('0x56')]()==_0x1bf0('0x57')){var _0x611979=fs['readFileSync'](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],_0x1bf0('0x6a')),_0x1bf0('0x5b'));var _0x3eb553=ejs[_0x1bf0('0x5c')](_0x611979,{'networks':_0x8bf88||[]});fs[_0x1bf0('0x61')](_0x1bf0('0x5d'),_0x3eb553);return respondWithRpcPromise(_0x1bf0('0x5e'),_0x1bf0('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x3f4ae4[_0x1bf0('0x3a')][_0x1bf0('0x56')]()==_0x1bf0('0x5f')){var _0x3a6497=fs[_0x1bf0('0x58')](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],_0x1bf0('0x60')),_0x1bf0('0x5b'));var _0x16f9fb=ejs[_0x1bf0('0x5c')](_0x3a6497,{'networks':_0x8bf88||[]});fs[_0x1bf0('0x61')](_0x1bf0('0x62'),_0x16f9fb);return respondWithRpcPromise(_0x1bf0('0x5e'),_0x1bf0('0x32'),{'module':_0x1bf0('0x63')});}else{var _0x4221b6=fs['readFileSync'](path[_0x1bf0('0x59')](config[_0x1bf0('0x5a')],_0x1bf0('0x64')),_0x1bf0('0x5b'));var _0x644e56=ejs[_0x1bf0('0x5c')](_0x4221b6,{'networks':_0x8bf88||[]});fs[_0x1bf0('0x61')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x57751b[_0x1bf0('0x55')][_0x1bf0('0x3a')]['toLowerCase']()),_0x644e56);return respondWithRpcPromise('Reload',_0x1bf0('0x32'),{'module':_0x1bf0('0x68')});}return null;})[_0x1bf0('0x25')](handleError(_0x3fc898,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e4e929f..2c5364a 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 _0x5db8=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x5db8,0xbb));var _0x85db=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x5db8[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x780f=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./network.attributes','define','Network','network'];(function(_0x101129,_0x5c6e96){var _0x324b0b=function(_0x384ee1){while(--_0x384ee1){_0x101129['push'](_0x101129['shift']());}};_0x324b0b(++_0x5c6e96);}(_0x780f,0x6c));var _0xf780=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x780f[_0x510b98];return _0x45e775;};'use strict';var _=require(_0xf780('0x0'));var util=require(_0xf780('0x1'));var logger=require(_0xf780('0x2'))(_0xf780('0x3'));var moment=require(_0xf780('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf780('0x5'));var rimraf=require(_0xf780('0x6'));var config=require(_0xf780('0x7'));var attributes=require(_0xf780('0x8'));module['exports']=function(_0x37b0a2,_0x4b55e7){return _0x37b0a2[_0xf780('0x9')](_0xf780('0xa'),attributes,{'tableName':_0xf780('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 a329ea2..d2e212e 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4c8dcc,_0x136c2d){_0x4c8dcc=_0x4c8dcc-0x0;var _0x33e345=_0x7a54[_0x4c8dcc];return _0x33e345;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x172d67,_0x596d68){var _0x1c892f=function(_0x62bcfb){while(--_0x62bcfb){_0x172d67['push'](_0x172d67['shift']());}};_0x1c892f(++_0x596d68);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 6409cfb..676a44f 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 _0x2342=['getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users'];(function(_0x27ed1f,_0x128269){var _0x1091fb=function(_0x152166){while(--_0x152166){_0x27ed1f['push'](_0x27ed1f['shift']());}};_0x1091fb(++_0x128269);}(_0x2342,0x197));var _0x2234=function(_0x22885d,_0x1d3193){_0x22885d=_0x22885d-0x0;var _0x7a79c0=_0x2342[_0x22885d];return _0x7a79c0;};'use strict';var multer=require(_0x2234('0x0'));var util=require(_0x2234('0x1'));var path=require('path');var timeout=require(_0x2234('0x2'));var express=require(_0x2234('0x3'));var router=express[_0x2234('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2234('0x5'));var interaction=require(_0x2234('0x6'));var config=require(_0x2234('0x7'));var controller=require(_0x2234('0x8'));router[_0x2234('0x9')]('/',auth[_0x2234('0xa')](),controller[_0x2234('0xb')]);router['get'](_0x2234('0xc'),auth[_0x2234('0xa')](),controller[_0x2234('0xd')]);router['get']('/:id',auth[_0x2234('0xa')](),controller['show']);router[_0x2234('0x9')](_0x2234('0xe'),auth['isAuthenticated'](),controller[_0x2234('0xf')]);router[_0x2234('0x9')](_0x2234('0x10'),auth[_0x2234('0xa')](),controller[_0x2234('0x11')]);router[_0x2234('0x9')](_0x2234('0x12'),auth[_0x2234('0xa')](),controller[_0x2234('0x13')]);router[_0x2234('0x9')](_0x2234('0x14'),auth['isAuthenticated'](),controller[_0x2234('0x15')]);router[_0x2234('0x9')](_0x2234('0x16'),auth['isAuthenticated'](),controller[_0x2234('0x17')]);router[_0x2234('0x18')]('/',auth[_0x2234('0xa')](),controller[_0x2234('0x19')]);router[_0x2234('0x18')]('/:id/dispositions',auth[_0x2234('0xa')](),controller[_0x2234('0x1a')]);router['post'](_0x2234('0x10'),auth[_0x2234('0xa')](),controller[_0x2234('0x1b')]);router['post'](_0x2234('0x1c'),controller[_0x2234('0x1d')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x2234('0x1e')]);router[_0x2234('0x18')](_0x2234('0x16'),auth[_0x2234('0xa')](),controller[_0x2234('0x1f')]);router[_0x2234('0x18')](_0x2234('0x20'),auth[_0x2234('0xa')](),controller[_0x2234('0x21')]);router[_0x2234('0x22')](_0x2234('0x23'),auth[_0x2234('0xa')](),controller[_0x2234('0x24')]);router[_0x2234('0x25')](_0x2234('0x23'),auth[_0x2234('0xa')](),controller[_0x2234('0x26')]);router[_0x2234('0x25')](_0x2234('0xe'),auth[_0x2234('0xa')](),controller[_0x2234('0x27')]);router[_0x2234('0x25')]('/:id/canned_answers',auth[_0x2234('0xa')](),controller[_0x2234('0x28')]);router[_0x2234('0x25')](_0x2234('0x16'),auth[_0x2234('0xa')](),controller[_0x2234('0x29')]);module[_0x2234('0x2a')]=router; \ No newline at end of file +var _0x4886=['getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0x4886,0x97));var _0x6488=function(_0x54bd4d,_0x748182){_0x54bd4d=_0x54bd4d-0x0;var _0x3b3cd4=_0x4886[_0x54bd4d];return _0x3b3cd4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6488('0x0'));var timeout=require(_0x6488('0x1'));var express=require(_0x6488('0x2'));var router=express[_0x6488('0x3')]();var fs_extra=require(_0x6488('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6488('0x5'));var config=require('../../config/environment');var controller=require(_0x6488('0x6'));router[_0x6488('0x7')]('/',auth['isAuthenticated'](),controller[_0x6488('0x8')]);router['get'](_0x6488('0x9'),auth[_0x6488('0xa')](),controller['describe']);router[_0x6488('0x7')](_0x6488('0xb'),auth[_0x6488('0xa')](),controller[_0x6488('0xc')]);router[_0x6488('0x7')](_0x6488('0xd'),auth[_0x6488('0xa')](),controller[_0x6488('0xe')]);router[_0x6488('0x7')](_0x6488('0xf'),auth[_0x6488('0xa')](),controller['getAnswers']);router['get'](_0x6488('0x10'),auth[_0x6488('0xa')](),controller[_0x6488('0x11')]);router[_0x6488('0x7')](_0x6488('0x12'),auth[_0x6488('0xa')](),controller[_0x6488('0x13')]);router[_0x6488('0x7')](_0x6488('0x14'),auth[_0x6488('0xa')](),controller[_0x6488('0x15')]);router[_0x6488('0x16')]('/',auth[_0x6488('0xa')](),controller['create']);router[_0x6488('0x16')](_0x6488('0xd'),auth[_0x6488('0xa')](),controller[_0x6488('0x17')]);router['post'](_0x6488('0xf'),auth['isAuthenticated'](),controller[_0x6488('0x18')]);router[_0x6488('0x16')](_0x6488('0x19'),controller['notify']);router[_0x6488('0x16')](_0x6488('0x10'),auth[_0x6488('0xa')](),controller[_0x6488('0x1a')]);router[_0x6488('0x16')](_0x6488('0x14'),auth[_0x6488('0xa')](),controller[_0x6488('0x1b')]);router['post'](_0x6488('0x1c'),auth[_0x6488('0xa')](),controller[_0x6488('0x1d')]);router[_0x6488('0x1e')](_0x6488('0xb'),auth[_0x6488('0xa')](),controller[_0x6488('0x1f')]);router[_0x6488('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x6488('0x21')]);router['delete'](_0x6488('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x6488('0xf'),auth[_0x6488('0xa')](),controller['removeAnswers']);router[_0x6488('0x20')](_0x6488('0x14'),auth[_0x6488('0xa')](),controller['removeAgents']);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 4a797c8..1bc9781 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 _0xdcac=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x102336,_0x1e486c){var _0x3273fb=function(_0x11bbbc){while(--_0x11bbbc){_0x102336['push'](_0x102336['shift']());}};_0x3273fb(++_0x1e486c);}(_0xdcac,0x10b));var _0xcdca=function(_0x11714e,_0x5791b9){_0x11714e=_0x11714e-0x0;var _0x4c9010=_0xdcac[_0x11714e];return _0x4c9010;};'use strict';var Sequelize=require(_0xcdca('0x0'));var rs=require(_0xcdca('0x1'));module[_0xcdca('0x2')]={'name':{'type':Sequelize[_0xcdca('0x3')],'unique':_0xcdca('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xcdca('0x3')]},'token':{'type':Sequelize[_0xcdca('0x3')],'defaultValue':function(){return rs[_0xcdca('0x5')]();}},'replyUri':{'type':Sequelize[_0xcdca('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcdca('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcdca('0x6')],'defaultValue':function(){return _0xcdca('0x7');}},'notificationSound':{'type':Sequelize[_0xcdca('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcdca('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcdca('0x3')]},'queueTransfer':{'type':Sequelize[_0xcdca('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcdca('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcdca('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcdca('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcdca('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xcdca('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcdca('0xb'),'set':function(_0x1486dc){if(!_0x1486dc)this[_0xcdca('0xc')]('mandatoryDispositionPauseId',null);this[_0xcdca('0xc')](_0xcdca('0xd'),_0x1486dc);}}}; \ No newline at end of file +var _0xd85a=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2a20e4,_0x52d92e){var _0x23037c=function(_0x433427){while(--_0x433427){_0x2a20e4['push'](_0x2a20e4['shift']());}};_0x23037c(++_0x52d92e);}(_0xd85a,0x149));var _0xad85=function(_0x336772,_0xa1cb7a){_0x336772=_0x336772-0x0;var _0x133943=_0xd85a[_0x336772];return _0x133943;};'use strict';var Sequelize=require(_0xad85('0x0'));var rs=require(_0xad85('0x1'));module[_0xad85('0x2')]={'name':{'type':Sequelize[_0xad85('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xad85('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xad85('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xad85('0x4')],'defaultValue':function(){return _0xad85('0x5');}},'notificationSound':{'type':Sequelize[_0xad85('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xad85('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xad85('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xad85('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xad85('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad85('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xad85('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xad85('0x6')],'defaultValue':![],'comment':_0xad85('0x9'),'set':function(_0x2a59f1){if(!_0x2a59f1)this[_0xad85('0xa')](_0xad85('0xb'),null);this[_0xad85('0xa')](_0xad85('0xc'),_0x2a59f1);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 938046c..8ab3d05 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 _0xe229=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','isNil','mapKey','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','contact','firstName','threadId','externalUrl','OpenchannelInteraction','lastName','messageId','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','UserId','unshift','*,*,*,*','forcedOwnership','Start','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','priority','getApplications','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','user','out','Messages','spread','dataValues','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','OpenchannelAccounts','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','type','options','include','findAll','rows','catch','show','params','keys','includeAll','create','role','get','UserProfileSection','find','userProfileId'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0xe229,0x111));var _0x9e22=function(_0x1b39d5,_0x13ce9c){_0x1b39d5=_0x1b39d5-0x0;var _0x2fe85b=_0xe229[_0x1b39d5];return _0x2fe85b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9e22('0x0'));var rp=require(_0x9e22('0x1'));var moment=require(_0x9e22('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9e22('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9e22('0x4'));var fs=require('fs');var fs_extra=require(_0x9e22('0x5'));var _=require(_0x9e22('0x6'));var squel=require(_0x9e22('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e22('0x8'));var toCsv=require(_0x9e22('0x9'));var querystring=require(_0x9e22('0xa'));var Papa=require(_0x9e22('0xb'));var Redis=require(_0x9e22('0xc'));var authService=require(_0x9e22('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9e22('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e22('0xf'))(_0x9e22('0x10'));var utils=require('../../config/utils');var config=require(_0x9e22('0x11'));var licenseUtil=require(_0x9e22('0x12'));var db=require(_0x9e22('0x13'))['db'];config['redis']=_[_0x9e22('0x14')](config[_0x9e22('0x15')],{'host':_0x9e22('0x16'),'port':0x18eb});var socket=require(_0x9e22('0x17'))(new Redis(config['redis']));require(_0x9e22('0x18'))[_0x9e22('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9e22('0x1a')][_0x9e22('0x1b')]({'port':0x232c});var client9002=jayson[_0x9e22('0x1a')][_0x9e22('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x14bd0e,_0x322597,_0x439050,_0x2d2d1){return new BPromise(function(_0x1a5e6f,_0x127edc){var _0x54202b=_0x2d2d1||client;return _0x54202b[_0x9e22('0x1c')](_0x14bd0e,_0x439050)[_0x9e22('0x1d')](function(_0x24154e){logger[_0x9e22('0x1e')](_0x9e22('0x1f'),_0x322597,_0x9e22('0x20'));logger['debug'](_0x9e22('0x21'),_0x322597,_0x9e22('0x20'),JSON[_0x9e22('0x22')](_0x24154e));if(_0x24154e[_0x9e22('0x23')]){if(_0x24154e[_0x9e22('0x23')][_0x9e22('0x24')]===0x1f4){logger[_0x9e22('0x23')](_0x9e22('0x1f'),_0x322597,_0x24154e[_0x9e22('0x23')][_0x9e22('0x25')]);return _0x127edc(_0x24154e['error'][_0x9e22('0x25')]);}logger['error'](_0x9e22('0x1f'),_0x322597,_0x24154e['error'][_0x9e22('0x25')]);return _0x1a5e6f(_0x24154e[_0x9e22('0x23')][_0x9e22('0x25')]);}else{logger[_0x9e22('0x1e')](_0x9e22('0x1f'),_0x322597,_0x9e22('0x20'));_0x1a5e6f(_0x24154e[_0x9e22('0x26')][_0x9e22('0x25')]);}})['catch'](function(_0x5b3bb7){logger[_0x9e22('0x23')](_0x9e22('0x1f'),_0x322597,_0x5b3bb7);_0x127edc(_0x5b3bb7);});});}function respondWithStatusCode(_0x204f61,_0x536575){_0x536575=_0x536575||0xcc;return function(_0x4efaab){if(_0x4efaab){return _0x204f61[_0x9e22('0x27')](_0x536575);}return _0x204f61[_0x9e22('0x28')](_0x536575)[_0x9e22('0x29')]();};}function respondWithResult(_0x4b97b8,_0x1e3727){_0x1e3727=_0x1e3727||0xc8;return function(_0x1d9399){if(_0x1d9399){return _0x4b97b8[_0x9e22('0x28')](_0x1e3727)[_0x9e22('0x2a')](_0x1d9399);}};}function respondWithFilteredResult(_0x54bbfb,_0x49f6e4){return function(_0x2cc3f8){if(_0x2cc3f8){var _0x4a5658=typeof _0x49f6e4[_0x9e22('0x2b')]==='undefined'&&typeof _0x49f6e4[_0x9e22('0x2c')]===_0x9e22('0x2d');var _0x357f01=_0x2cc3f8[_0x9e22('0x2e')];var _0x1b71ee=_0x4a5658?0x0:_0x49f6e4[_0x9e22('0x2b')];var _0x4b7015=_0x4a5658?_0x2cc3f8[_0x9e22('0x2e')]:_0x49f6e4[_0x9e22('0x2b')]+_0x49f6e4[_0x9e22('0x2c')];var _0x485246;if(_0x4b7015>=_0x357f01){_0x4b7015=_0x357f01;_0x485246=0xc8;}else{_0x485246=0xce;}_0x54bbfb[_0x9e22('0x28')](_0x485246);return _0x54bbfb['set'](_0x9e22('0x2f'),_0x1b71ee+'-'+_0x4b7015+'/'+_0x357f01)['json'](_0x2cc3f8);}return null;};}function patchUpdates(_0x1d6970){return function(_0x3d304e){try{jsonpatch[_0x9e22('0x30')](_0x3d304e,_0x1d6970,!![]);}catch(_0x2d54e4){return BPromise['reject'](_0x2d54e4);}return _0x3d304e[_0x9e22('0x31')]();};}function saveUpdates(_0x33ce1e,_0x8724dc){return function(_0x470a81){if(_0x470a81){return _0x470a81['update'](_0x33ce1e)[_0x9e22('0x1d')](function(_0x5b2af8){return _0x5b2af8;});}return null;};}function removeEntity(_0x3845ae,_0x2af02a){return function(_0x3fb1c6){if(_0x3fb1c6){return _0x3fb1c6['destroy']()[_0x9e22('0x1d')](function(){var _0x413ab8=_0x3fb1c6['get']({'plain':!![]});var _0x240d95=_0x9e22('0x32');return db[_0x9e22('0x33')]['destroy']({'where':{'type':_0x240d95,'resourceId':_0x413ab8['id']}})[_0x9e22('0x1d')](function(){return _0x3fb1c6;});})[_0x9e22('0x1d')](function(){_0x3845ae[_0x9e22('0x28')](0xcc)[_0x9e22('0x29')]();});}};}function handleEntityNotFound(_0xcf8041,_0x340bc3){return function(_0x1bf85d){if(!_0x1bf85d){_0xcf8041['sendStatus'](0x194);}return _0x1bf85d;};}function handleError(_0x1f6c81,_0x2ba39d){_0x2ba39d=_0x2ba39d||0x1f4;return function(_0x56ccfd){logger['error'](_0x56ccfd[_0x9e22('0x34')]);if(_0x56ccfd['name']){delete _0x56ccfd['name'];}_0x1f6c81[_0x9e22('0x28')](_0x2ba39d)[_0x9e22('0x35')](_0x56ccfd);};}exports['index']=function(_0x157990,_0x1b8f60){var _0x1b362a={'include':[{'model':db[_0x9e22('0x36')],'as':_0x9e22('0x37')}]},_0x4c2fd2={},_0x2d40dc={'count':0x0,'rows':[]};var _0x4f6b04=_[_0x9e22('0x38')](db[_0x9e22('0x39')][_0x9e22('0x3a')],function(_0x1a9e37){return{'name':_0x1a9e37[_0x9e22('0x3b')],'type':_0x1a9e37['type'][_0x9e22('0x3c')]};});_0x4c2fd2[_0x9e22('0x3d')]=_[_0x9e22('0x38')](_0x4f6b04,_0x9e22('0x3e'));_0x4c2fd2[_0x9e22('0x3f')]=_['keys'](_0x157990['query']);_0x4c2fd2[_0x9e22('0x40')]=_[_0x9e22('0x41')](_0x4c2fd2['model'],_0x4c2fd2[_0x9e22('0x3f')]);_0x1b362a['attributes']=_['intersection'](_0x4c2fd2[_0x9e22('0x3d')],qs[_0x9e22('0x42')](_0x157990[_0x9e22('0x3f')]['fields']));_0x1b362a[_0x9e22('0x43')]=_0x1b362a['attributes'][_0x9e22('0x44')]?_0x1b362a[_0x9e22('0x43')]:_0x4c2fd2['model'];if(!_0x157990[_0x9e22('0x3f')]['hasOwnProperty'](_0x9e22('0x45'))){_0x1b362a[_0x9e22('0x2c')]=qs[_0x9e22('0x2c')](_0x157990[_0x9e22('0x3f')][_0x9e22('0x2c')]);_0x1b362a[_0x9e22('0x2b')]=qs[_0x9e22('0x2b')](_0x157990['query'][_0x9e22('0x2b')]);}_0x1b362a[_0x9e22('0x46')]=qs['sort'](_0x157990[_0x9e22('0x3f')][_0x9e22('0x47')]);_0x1b362a['where']=qs[_0x9e22('0x40')](_['pick'](_0x157990['query'],_0x4c2fd2['filters']),_0x4f6b04);if(_0x157990[_0x9e22('0x3f')][_0x9e22('0x48')]){_0x1b362a[_0x9e22('0x49')]=_[_0x9e22('0x4a')](_0x1b362a[_0x9e22('0x49')],{'$or':_[_0x9e22('0x38')](_0x4f6b04,function(_0x484c66){if(_0x484c66[_0x9e22('0x4b')]!=='VIRTUAL'){var _0x1ba19a={};_0x1ba19a[_0x484c66[_0x9e22('0x3e')]]={'$like':'%'+_0x157990[_0x9e22('0x3f')][_0x9e22('0x48')]+'%'};return _0x1ba19a;}})});}_0x1b362a=_[_0x9e22('0x4a')]({},_0x1b362a,_0x157990[_0x9e22('0x4c')]);var _0x568af6={'where':_0x1b362a[_0x9e22('0x49')]};return db[_0x9e22('0x39')][_0x9e22('0x2e')](_0x568af6)[_0x9e22('0x1d')](function(_0x5b601f){_0x2d40dc[_0x9e22('0x2e')]=_0x5b601f;if(_0x157990[_0x9e22('0x3f')]['includeAll']){_0x1b362a[_0x9e22('0x4d')]=[{'all':!![]}];}return db[_0x9e22('0x39')][_0x9e22('0x4e')](_0x1b362a);})[_0x9e22('0x1d')](function(_0x3372d1){_0x2d40dc[_0x9e22('0x4f')]=_0x3372d1;return _0x2d40dc;})[_0x9e22('0x1d')](respondWithFilteredResult(_0x1b8f60,_0x1b362a))[_0x9e22('0x50')](handleError(_0x1b8f60,null));};exports[_0x9e22('0x51')]=function(_0x364f8a,_0x365e16){var _0x19e424={'raw':![],'where':{'id':_0x364f8a[_0x9e22('0x52')]['id']},'include':[{'model':db[_0x9e22('0x36')],'as':_0x9e22('0x37')}]},_0x20b694={};_0x20b694[_0x9e22('0x3d')]=_[_0x9e22('0x53')](db[_0x9e22('0x39')]['rawAttributes']);_0x20b694[_0x9e22('0x3f')]=_['keys'](_0x364f8a[_0x9e22('0x3f')]);_0x20b694[_0x9e22('0x40')]=_[_0x9e22('0x41')](_0x20b694[_0x9e22('0x3d')],_0x20b694[_0x9e22('0x3f')]);_0x19e424[_0x9e22('0x43')]=_[_0x9e22('0x41')](_0x20b694[_0x9e22('0x3d')],qs[_0x9e22('0x42')](_0x364f8a[_0x9e22('0x3f')][_0x9e22('0x42')]));_0x19e424[_0x9e22('0x43')]=_0x19e424['attributes'][_0x9e22('0x44')]?_0x19e424['attributes']:_0x20b694[_0x9e22('0x3d')];if(_0x364f8a[_0x9e22('0x3f')][_0x9e22('0x54')]){_0x19e424[_0x9e22('0x4d')]=[{'all':!![]}];}_0x19e424=_[_0x9e22('0x4a')]({},_0x19e424,_0x364f8a[_0x9e22('0x4c')]);return db[_0x9e22('0x39')]['find'](_0x19e424)['then'](handleEntityNotFound(_0x365e16,null))['then'](respondWithResult(_0x365e16,null))[_0x9e22('0x50')](handleError(_0x365e16,null));};exports[_0x9e22('0x55')]=function(_0x1a4d4a,_0x2a0ebf){return db[_0x9e22('0x39')]['create'](_0x1a4d4a['body'],{})[_0x9e22('0x1d')](function(_0x2e9e6c){var _0x3a979a=_0x1a4d4a['user']['get']({'plain':!![]});if(!_0x3a979a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a979a[_0x9e22('0x56')]==='user'){var _0x3f5725=_0x2e9e6c[_0x9e22('0x57')]({'plain':!![]});var _0x4c87a7=_0x9e22('0x32');return db[_0x9e22('0x58')][_0x9e22('0x59')]({'where':{'name':_0x4c87a7,'userProfileId':_0x3a979a[_0x9e22('0x5a')]},'raw':!![]})['then'](function(_0x4e2630){if(_0x4e2630&&_0x4e2630[_0x9e22('0x5b')]===0x0){return db['UserProfileResource'][_0x9e22('0x55')]({'name':_0x3f5725[_0x9e22('0x3e')],'resourceId':_0x3f5725['id'],'type':_0x4e2630[_0x9e22('0x3e')],'sectionId':_0x4e2630['id']},{})['then'](function(){return _0x2e9e6c;});}else{return _0x2e9e6c;}})[_0x9e22('0x50')](function(_0x591059){logger[_0x9e22('0x23')](_0x9e22('0x5c'),_0x591059);throw _0x591059;});}return _0x2e9e6c;})[_0x9e22('0x1d')](respondWithResult(_0x2a0ebf,0xc9))[_0x9e22('0x50')](handleError(_0x2a0ebf,null));};exports[_0x9e22('0x5d')]=function(_0x6fe2ed,_0x209163){if(_0x6fe2ed[_0x9e22('0x5e')]['id']){delete _0x6fe2ed['body']['id'];}return db[_0x9e22('0x39')][_0x9e22('0x59')]({'where':{'id':_0x6fe2ed[_0x9e22('0x52')]['id']},'include':[{'model':db[_0x9e22('0x36')],'as':_0x9e22('0x37')}]})['then'](handleEntityNotFound(_0x209163,null))[_0x9e22('0x1d')](saveUpdates(_0x6fe2ed[_0x9e22('0x5e')],null))[_0x9e22('0x1d')](respondWithResult(_0x209163,null))[_0x9e22('0x50')](handleError(_0x209163,null));};exports[_0x9e22('0x5f')]=function(_0x511e44,_0x106c2b){return db[_0x9e22('0x39')][_0x9e22('0x59')]({'where':{'id':_0x511e44[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x106c2b,null))[_0x9e22('0x1d')](removeEntity(_0x106c2b,null))[_0x9e22('0x50')](handleError(_0x106c2b,null));};exports[_0x9e22('0x60')]=function(_0x7fb2d8,_0x1e5c13){return db[_0x9e22('0x39')][_0x9e22('0x60')]()[_0x9e22('0x1d')](respondWithResult(_0x1e5c13,null))[_0x9e22('0x50')](handleError(_0x1e5c13,null));};exports[_0x9e22('0x61')]=function(_0x212150,_0x21d765,_0xa9391e){if(_0x212150[_0x9e22('0x5e')]['id']){delete _0x212150[_0x9e22('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x212150[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x21d765,null))[_0x9e22('0x1d')](function(_0x362a49){if(_0x362a49){_0x212150[_0x9e22('0x5e')][_0x9e22('0x62')]=_0x362a49['id'];return db[_0x9e22('0x63')]['create'](_0x212150[_0x9e22('0x5e')]);}})['then'](respondWithResult(_0x21d765,null))[_0x9e22('0x50')](handleError(_0x21d765,null));};exports[_0x9e22('0x64')]=function(_0x307c1f,_0x311de2,_0x3b5796){var _0x31ea8e={'raw':![],'where':{}};var _0x9e61fe={};var _0x29e037={'count':0x0,'rows':[]};return db[_0x9e22('0x39')][_0x9e22('0x65')]({'where':{'id':_0x307c1f['params']['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x311de2,null))[_0x9e22('0x1d')](function(_0x4aa7af){if(_0x4aa7af){_0x9e61fe[_0x9e22('0x3d')]=_[_0x9e22('0x53')](db[_0x9e22('0x63')][_0x9e22('0x3a')]);_0x9e61fe['query']=_[_0x9e22('0x53')](_0x307c1f[_0x9e22('0x3f')]);_0x9e61fe['filters']=_[_0x9e22('0x41')](_0x9e61fe[_0x9e22('0x3d')],_0x9e61fe[_0x9e22('0x3f')]);_0x31ea8e[_0x9e22('0x43')]=_[_0x9e22('0x41')](_0x9e61fe[_0x9e22('0x3d')],qs[_0x9e22('0x42')](_0x307c1f['query'][_0x9e22('0x42')]));_0x31ea8e[_0x9e22('0x43')]=_0x31ea8e[_0x9e22('0x43')][_0x9e22('0x44')]?_0x31ea8e[_0x9e22('0x43')]:_0x9e61fe[_0x9e22('0x3d')];if(!_0x307c1f[_0x9e22('0x3f')][_0x9e22('0x66')](_0x9e22('0x45'))){_0x31ea8e['limit']=qs[_0x9e22('0x2c')](_0x307c1f[_0x9e22('0x3f')][_0x9e22('0x2c')]);_0x31ea8e[_0x9e22('0x2b')]=qs[_0x9e22('0x2b')](_0x307c1f[_0x9e22('0x3f')][_0x9e22('0x2b')]);}_0x31ea8e[_0x9e22('0x46')]=qs[_0x9e22('0x47')](_0x307c1f[_0x9e22('0x3f')][_0x9e22('0x47')]);_0x31ea8e['where']=qs[_0x9e22('0x40')](_[_0x9e22('0x67')](_0x307c1f[_0x9e22('0x3f')],_0x9e61fe[_0x9e22('0x40')]));_0x31ea8e[_0x9e22('0x49')]['OpenchannelAccountId']=_0x4aa7af['id'];if(_0x307c1f[_0x9e22('0x3f')][_0x9e22('0x48')]){_0x31ea8e['where']=_[_0x9e22('0x4a')](_0x31ea8e[_0x9e22('0x49')],{'$or':_[_0x9e22('0x38')](_0x31ea8e['attributes'],function(_0x34dc0d){var _0x4ebeca={};_0x4ebeca[_0x34dc0d]={'$like':'%'+_0x307c1f[_0x9e22('0x3f')][_0x9e22('0x48')]+'%'};return _0x4ebeca;})});}_0x31ea8e=_[_0x9e22('0x4a')]({},_0x31ea8e,_0x307c1f[_0x9e22('0x4c')]);return db[_0x9e22('0x63')][_0x9e22('0x2e')]({'where':_0x31ea8e[_0x9e22('0x49')]})[_0x9e22('0x1d')](function(_0x46c341){_0x29e037[_0x9e22('0x2e')]=_0x46c341;if(_0x307c1f['query'][_0x9e22('0x54')]){_0x31ea8e[_0x9e22('0x4d')]=[{'all':!![]}];}return db[_0x9e22('0x63')][_0x9e22('0x4e')](_0x31ea8e);})[_0x9e22('0x1d')](function(_0x1c0506){_0x29e037['rows']=_0x1c0506;return _0x29e037;});}})['then'](respondWithFilteredResult(_0x311de2,_0x31ea8e))[_0x9e22('0x50')](handleError(_0x311de2,null));};exports[_0x9e22('0x68')]=function(_0x967143,_0x4ea852,_0x21877b){return db[_0x9e22('0x39')][_0x9e22('0x59')]({'where':{'id':_0x967143['params']['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x4ea852,null))['then'](function(_0x541279){if(_0x541279){return _0x541279['removeDispositions'](_0x967143['query'][_0x9e22('0x69')]);}})[_0x9e22('0x1d')](respondWithStatusCode(_0x4ea852,null))[_0x9e22('0x50')](handleError(_0x4ea852,null));};exports[_0x9e22('0x6a')]=function(_0xb5f877,_0x5afbd9,_0xc1b77f){if(_0xb5f877[_0x9e22('0x5e')]['id']){delete _0xb5f877[_0x9e22('0x5e')]['id'];}return db[_0x9e22('0x39')][_0x9e22('0x59')]({'where':{'id':_0xb5f877[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x5afbd9,null))[_0x9e22('0x1d')](function(_0xc40cc0){if(_0xc40cc0){_0xb5f877[_0x9e22('0x5e')][_0x9e22('0x62')]=_0xc40cc0['id'];return db[_0x9e22('0x6b')]['create'](_0xb5f877[_0x9e22('0x5e')]);}})[_0x9e22('0x1d')](respondWithResult(_0x5afbd9,null))[_0x9e22('0x50')](handleError(_0x5afbd9,null));};exports['getAnswers']=function(_0x5530f2,_0x10b7c1,_0xf5793e){var _0x4bc50f={'raw':![],'where':{}};var _0x35fc78={};var _0x55a9c9={'count':0x0,'rows':[]};return db[_0x9e22('0x39')][_0x9e22('0x65')]({'where':{'id':_0x5530f2[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x10b7c1,null))[_0x9e22('0x1d')](function(_0x1a0841){if(_0x1a0841){_0x35fc78[_0x9e22('0x3d')]=_['keys'](db[_0x9e22('0x6b')][_0x9e22('0x3a')]);_0x35fc78['query']=_[_0x9e22('0x53')](_0x5530f2['query']);_0x35fc78[_0x9e22('0x40')]=_[_0x9e22('0x41')](_0x35fc78[_0x9e22('0x3d')],_0x35fc78[_0x9e22('0x3f')]);_0x4bc50f[_0x9e22('0x43')]=_[_0x9e22('0x41')](_0x35fc78[_0x9e22('0x3d')],qs[_0x9e22('0x42')](_0x5530f2[_0x9e22('0x3f')][_0x9e22('0x42')]));_0x4bc50f['attributes']=_0x4bc50f[_0x9e22('0x43')][_0x9e22('0x44')]?_0x4bc50f[_0x9e22('0x43')]:_0x35fc78[_0x9e22('0x3d')];if(!_0x5530f2[_0x9e22('0x3f')][_0x9e22('0x66')](_0x9e22('0x45'))){_0x4bc50f[_0x9e22('0x2c')]=qs[_0x9e22('0x2c')](_0x5530f2[_0x9e22('0x3f')][_0x9e22('0x2c')]);_0x4bc50f['offset']=qs['offset'](_0x5530f2[_0x9e22('0x3f')][_0x9e22('0x2b')]);}_0x4bc50f[_0x9e22('0x46')]=qs[_0x9e22('0x47')](_0x5530f2[_0x9e22('0x3f')][_0x9e22('0x47')]);_0x4bc50f[_0x9e22('0x49')]=qs[_0x9e22('0x40')](_['pick'](_0x5530f2['query'],_0x35fc78[_0x9e22('0x40')]));_0x4bc50f['where'][_0x9e22('0x62')]=_0x1a0841['id'];if(_0x5530f2[_0x9e22('0x3f')][_0x9e22('0x48')]){_0x4bc50f[_0x9e22('0x49')]=_[_0x9e22('0x4a')](_0x4bc50f[_0x9e22('0x49')],{'$or':_[_0x9e22('0x38')](_0x4bc50f['attributes'],function(_0x1c51ea){var _0x3303a0={};_0x3303a0[_0x1c51ea]={'$like':'%'+_0x5530f2[_0x9e22('0x3f')]['filter']+'%'};return _0x3303a0;})});}_0x4bc50f=_['merge']({},_0x4bc50f,_0x5530f2[_0x9e22('0x4c')]);return db['CannedAnswer']['count']({'where':_0x4bc50f[_0x9e22('0x49')]})[_0x9e22('0x1d')](function(_0x301cbd){_0x55a9c9[_0x9e22('0x2e')]=_0x301cbd;if(_0x5530f2['query'][_0x9e22('0x54')]){_0x4bc50f[_0x9e22('0x4d')]=[{'all':!![]}];}return db[_0x9e22('0x6b')][_0x9e22('0x4e')](_0x4bc50f);})['then'](function(_0x23e248){_0x55a9c9[_0x9e22('0x4f')]=_0x23e248;return _0x55a9c9;});}})[_0x9e22('0x1d')](respondWithFilteredResult(_0x10b7c1,_0x4bc50f))[_0x9e22('0x50')](handleError(_0x10b7c1,null));};exports[_0x9e22('0x6c')]=function(_0x5dd09e,_0x378994,_0x2b1873){return db[_0x9e22('0x39')]['find']({'where':{'id':_0x5dd09e[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x378994,null))[_0x9e22('0x1d')](function(_0x2edc4){if(_0x2edc4){return _0x2edc4['removeAnswers'](_0x5dd09e[_0x9e22('0x3f')][_0x9e22('0x69')]);}})[_0x9e22('0x1d')](respondWithStatusCode(_0x378994,null))[_0x9e22('0x50')](handleError(_0x378994,null));};exports[_0x9e22('0x6d')]=function(_0x498133,_0x440553,_0x17eb95){var _0x2e592e={'body':_0x498133[_0x9e22('0x5e')],'channel':_0x9e22('0x6e')};var _0x29af32=[];var _0x3853b4=[];var _0x15dcbf={};var _0x101569=![];return db['CmContact']['describe']()[_0x9e22('0x1d')](function(_0x989a68){if(!_0x989a68){throw new db[(_0x9e22('0x6f'))][(_0x9e22('0x70'))](_0x9e22('0x71'));}_0x29af32=_[_0x9e22('0x72')](_['keys'](_0x989a68),[_0x9e22('0x73'),_0x9e22('0x74')]);_0x3853b4=_[_0x9e22('0x72')](_[_0x9e22('0x53')](_0x989a68),[_0x9e22('0x73'),'updatedAt',_0x9e22('0x75'),_0x9e22('0x76')]);if(_0x498133[_0x9e22('0x5e')]['id']){delete _0x498133[_0x9e22('0x5e')]['id'];}if(_['isNil'](_0x498133[_0x9e22('0x5e')][_0x9e22('0x77')])){throw new db[(_0x9e22('0x6f'))][(_0x9e22('0x70'))]('from\x20is\x20mandatory');}if(_[_0x9e22('0x78')](_0x498133[_0x9e22('0x5e')][_0x9e22('0x5e')])||_0x498133['body'][_0x9e22('0x5e')]===''){throw new db[(_0x9e22('0x6f'))][(_0x9e22('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9e22('0x78')](_0x498133['body'][_0x9e22('0x79')])){throw new db[(_0x9e22('0x6f'))][(_0x9e22('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3853b4);}if(!_[_0x9e22('0x7a')](_0x3853b4,_0x498133['body'][_0x9e22('0x79')])){throw new db['Sequelize'][(_0x9e22('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3853b4);}_0x15dcbf[_0x498133[_0x9e22('0x5e')][_0x9e22('0x79')]]=_0x498133['body'][_0x9e22('0x77')];})[_0x9e22('0x1d')](function(){return db[_0x9e22('0x39')][_0x9e22('0x59')]({'where':{'id':_0x498133['params']['id']},'include':[{'model':db[_0x9e22('0x7b')],'as':_0x9e22('0x7c'),'include':[{'model':db['CmContact'],'as':_0x9e22('0x7d'),'where':_0x15dcbf,'limit':0x1,'order':[['updatedAt',_0x9e22('0x7e')]]}]},{'model':db[_0x9e22('0x7f')],'as':_0x9e22('0x80')}]});})[_0x9e22('0x1d')](handleEntityNotFound(_0x440553,null))['then'](function(_0xebfb03){if(_0xebfb03&&_0xebfb03[_0x9e22('0x7c')]){_0x2e592e[_0x9e22('0x81')]=_0xebfb03;_0x2e592e[_0x9e22('0x82')]=_0xebfb03[_0x9e22('0x80')];_0x2e592e[_0x9e22('0x83')]=_0xebfb03[_0x9e22('0x7c')];_0x2e592e['applications']=_[_0x9e22('0x84')](_0x2e592e[_0x9e22('0x82')],['priority'],[_0x9e22('0x85')]);if(_0x2e592e[_0x9e22('0x81')][_0x9e22('0x80')]){delete _0x2e592e['account']['Applications'];}if(_0x2e592e[_0x9e22('0x81')][_0x9e22('0x7c')]&&_0x2e592e[_0x9e22('0x81')][_0x9e22('0x7c')][_0x9e22('0x7d')]['length']){return _0x2e592e[_0x9e22('0x81')][_0x9e22('0x7c')]['Contacts'][0x0];}var _0x13bfd8=_[_0x9e22('0x14')](_0x498133[_0x9e22('0x5e')],{'firstName':_0x498133['body']['from'],'ListId':_0xebfb03[_0x9e22('0x76')]});_0x13bfd8[_0x498133['body'][_0x9e22('0x79')]]=_0x498133[_0x9e22('0x5e')]['from'];return db['CmContact'][_0x9e22('0x55')](_0x13bfd8,{'fields':_0x29af32,'raw':!![]});}})[_0x9e22('0x1d')](handleEntityNotFound(_0x440553,null))[_0x9e22('0x1d')](function(_0x5a5917){_0x2e592e[_0x9e22('0x86')]=_0x5a5917;if(_0x5a5917){var _0x5d065a={'ContactId':_0x5a5917['id'],'OpenchannelAccountId':_0x498133[_0x9e22('0x52')]['id'],'from':(_0x5a5917[_0x9e22('0x87')]||'')+'\x20'+(_0x5a5917['lastName']||'')};var _0x10dc63={'OpenchannelAccountId':_0x498133[_0x9e22('0x52')]['id'],'closed':![]};if(_0x498133[_0x9e22('0x5e')]['threadId']){_0x10dc63['threadId']=_0x498133[_0x9e22('0x5e')][_0x9e22('0x88')];return db['OpenchannelInteraction'][_0x9e22('0x59')]({'where':_0x10dc63})[_0x9e22('0x1d')](function(_0xf43dd){if(_0xf43dd){return[_0xf43dd,![]];}_0x5d065a['threadId']=_0x498133[_0x9e22('0x5e')][_0x9e22('0x88')];_0x5d065a['externalUrl']=_0x498133[_0x9e22('0x5e')][_0x9e22('0x89')];return db[_0x9e22('0x8a')][_0x9e22('0x55')](_0x5d065a)[_0x9e22('0x1d')](function(_0x50b3d1){return[_0x50b3d1,!![]];});});}else{_0x10dc63[_0x9e22('0x88')]=null;}_0x10dc63['ContactId']=_0x5a5917['id'];return db['OpenchannelInteraction'][_0x9e22('0x59')]({'where':_0x10dc63})[_0x9e22('0x1d')](function(_0x2ce3c9){if(_0x2ce3c9){return[_0x2ce3c9,![]];}return db['OpenchannelInteraction'][_0x9e22('0x55')](_0x5d065a)['then'](function(_0x11cd75){return[_0x11cd75,!![]];});});}})['spread'](function(_0x283d35,_0x11c861){if(_0x283d35){_0x101569=_0x11c861;if(!_0x11c861){var _0x211d95={'from':(_0x2e592e[_0x9e22('0x86')]['firstName']||'')+'\x20'+(_0x2e592e[_0x9e22('0x86')][_0x9e22('0x8b')]||'')};if(_0x498133[_0x9e22('0x5e')][_0x9e22('0x88')]&&_0x498133[_0x9e22('0x5e')][_0x9e22('0x8c')]&&_0x498133['body'][_0x9e22('0x88')]!=_0x498133[_0x9e22('0x5e')]['messageId']){_0x211d95[_0x9e22('0x88')]=_0x498133[_0x9e22('0x5e')][_0x9e22('0x8c')];}return _0x283d35['update'](_0x211d95);}else{return _0x283d35;}}})[_0x9e22('0x1d')](function(_0x5b3bae){_0x2e592e[_0x9e22('0x8d')]=_0x5b3bae[_0x9e22('0x57')]({'plain':!![]});_0x2e592e[_0x9e22('0x8d')][_0x9e22('0x8e')]=_0x101569;if(_0x2e592e[_0x9e22('0x8d')][_0x9e22('0x8e')]){if(_0x2e592e[_0x9e22('0x81')][_0x9e22('0x8f')]){_0x2e592e[_0x9e22('0x82')][_0x9e22('0x90')]({'id':0x0,'priority':_0x2e592e['applications'][_0x9e22('0x44')]+0x1,'app':_0x9e22('0x91'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x9e22('0x92')][_0x9e22('0x55')]({'body':_0x498133[_0x9e22('0x5e')][_0x9e22('0x5e')],'OpenchannelAccountId':_0x498133[_0x9e22('0x52')]['id'],'OpenchannelInteractionId':_0x5b3bae['id'],'direction':'in','ContactId':_0x2e592e[_0x9e22('0x86')]['id'],'AttachmentId':_0x498133['body'][_0x9e22('0x93')]});})[_0x9e22('0x1d')](function(_0x5d5320){_0x2e592e['message']=_0x5d5320;if(_0x2e592e[_0x9e22('0x8d')]['UserId']){return db['User'][_0x9e22('0x59')]({'attributes':['id',_0x9e22('0x3e')],'where':{'id':_0x2e592e['interaction'][_0x9e22('0x94')]}})[_0x9e22('0x1d')](function(_0x359f58){if(_0x359f58){_0x2e592e[_0x9e22('0x82')][_0x9e22('0x95')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x359f58['name']+','+(_0x2e592e[_0x9e22('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x9e22('0x96')});_0x2e592e[_0x9e22('0x97')]=![];}return respondWithRpcPromise('Start','startRouting',_0x2e592e);});}return respondWithRpcPromise(_0x9e22('0x98'),'startRouting',_0x2e592e);})['then'](function(_0xf54ae8){respondWithRpcPromise(_0x9e22('0x99'),_0x9e22('0x99'),{'event':_0x9e22('0x6d'),'message':_0xf54ae8},client9002);return _0xf54ae8;})[_0x9e22('0x1d')](respondWithResult(_0x440553,null))[_0x9e22('0x50')](handleError(_0x440553,null));};exports[_0x9e22('0x9a')]=function(_0x3138df,_0x1769d3,_0x47ddae){return db[_0x9e22('0x39')]['findOne']({'where':{'id':_0x3138df[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x1769d3,null))[_0x9e22('0x1d')](function(_0x1676aa){if(_0x1676aa){return db[_0x9e22('0x9b')]['transaction'](function(_0x544d81){return db[_0x9e22('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x3138df['params']['id']},'transaction':_0x544d81})['then'](function(_0x585fdc){var _0x4563b2=_[_0x9e22('0x38')](_0x3138df[_0x9e22('0x5e')],function(_0x4a576b){_0x4a576b[_0x9e22('0x62')]=_0x3138df['params']['id'];return _0x4a576b;});return db[_0x9e22('0x7f')][_0x9e22('0x9c')](_0x4563b2,{'transaction':_0x544d81});});})[_0x9e22('0x1d')](function(){return db[_0x9e22('0x7f')][_0x9e22('0x9d')]({'where':{'OpenchannelAccountId':_0x3138df['params']['id']},'order':_0x9e22('0x9e')});});}})[_0x9e22('0x1d')](respondWithResult(_0x1769d3,null))['catch'](handleError(_0x1769d3,null));};exports[_0x9e22('0x9f')]=function(_0x128658,_0x222e39,_0x4d1356){var _0x10f508={};var _0x31d5f3={};var _0x1a7526;var _0x11bdb8;return db[_0x9e22('0x39')]['findOne']({'where':{'id':_0x128658[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x222e39,null))['then'](function(_0x2e54e6){if(_0x2e54e6){_0x1a7526=_0x2e54e6;_0x31d5f3[_0x9e22('0x3d')]=_[_0x9e22('0x53')](db[_0x9e22('0x7f')]['rawAttributes']);_0x31d5f3[_0x9e22('0x3f')]=_[_0x9e22('0x53')](_0x128658[_0x9e22('0x3f')]);_0x31d5f3[_0x9e22('0x40')]=_[_0x9e22('0x41')](_0x31d5f3[_0x9e22('0x3d')],_0x31d5f3[_0x9e22('0x3f')]);_0x10f508[_0x9e22('0x43')]=_['intersection'](_0x31d5f3[_0x9e22('0x3d')],qs['fields'](_0x128658['query']['fields']));_0x10f508[_0x9e22('0x43')]=_0x10f508[_0x9e22('0x43')][_0x9e22('0x44')]?_0x10f508[_0x9e22('0x43')]:_0x31d5f3['model'];_0x10f508[_0x9e22('0x46')]=qs['sort'](_0x128658[_0x9e22('0x3f')][_0x9e22('0x47')]);_0x10f508['where']=qs[_0x9e22('0x40')](_[_0x9e22('0x67')](_0x128658[_0x9e22('0x3f')],_0x31d5f3[_0x9e22('0x40')]));if(_0x128658[_0x9e22('0x3f')][_0x9e22('0x48')]){_0x10f508[_0x9e22('0x49')]=_[_0x9e22('0x4a')](_0x10f508[_0x9e22('0x49')],{'$or':_[_0x9e22('0x38')](_0x10f508[_0x9e22('0x43')],function(_0x4f8520){var _0x2d206f={};_0x2d206f[_0x4f8520]={'$like':'%'+_0x128658[_0x9e22('0x3f')][_0x9e22('0x48')]+'%'};return _0x2d206f;})});}_0x10f508=_[_0x9e22('0x4a')]({},_0x10f508,_0x128658[_0x9e22('0x4c')]);return _0x1a7526[_0x9e22('0x9f')](_0x10f508);}})[_0x9e22('0x1d')](function(_0x2a6bf2){if(_0x2a6bf2){_0x11bdb8=_0x2a6bf2['length'];if(!_0x128658[_0x9e22('0x3f')][_0x9e22('0x66')](_0x9e22('0x45'))){_0x10f508[_0x9e22('0x2c')]=qs[_0x9e22('0x2c')](_0x128658[_0x9e22('0x3f')][_0x9e22('0x2c')]);_0x10f508['offset']=qs[_0x9e22('0x2b')](_0x128658['query'][_0x9e22('0x2b')]);}return _0x1a7526[_0x9e22('0x9f')](_0x10f508);}})['then'](function(_0xde7848){if(_0xde7848){return _0xde7848?{'count':_0x11bdb8,'rows':_0xde7848}:null;}})[_0x9e22('0x1d')](respondWithResult(_0x222e39,null))[_0x9e22('0x50')](handleError(_0x222e39,null));};exports['getInteractions']=function(_0xf6a721,_0x50b901,_0x542ffc){var _0x42db97={'raw':![],'where':{}};var _0x3e45e7={};var _0xd6a4b7={'count':0x0,'rows':[]};return db[_0x9e22('0x39')]['findOne']({'where':{'id':_0xf6a721['params']['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x50b901,null))['then'](function(_0x43eb65){if(_0x43eb65){_0x3e45e7[_0x9e22('0x3d')]=_[_0x9e22('0x53')](db[_0x9e22('0x8a')]['rawAttributes']);_0x3e45e7[_0x9e22('0x3f')]=_[_0x9e22('0x53')](_0xf6a721['query']);_0x3e45e7['filters']=_['intersection'](_0x3e45e7[_0x9e22('0x3d')],_0x3e45e7['query']);_0x42db97['attributes']=_[_0x9e22('0x41')](_0x3e45e7[_0x9e22('0x3d')],qs[_0x9e22('0x42')](_0xf6a721['query']['fields']));_0x42db97[_0x9e22('0x43')]=_0x42db97[_0x9e22('0x43')][_0x9e22('0x44')]?_0x42db97[_0x9e22('0x43')]:_0x3e45e7[_0x9e22('0x3d')];if(!_0xf6a721[_0x9e22('0x3f')]['hasOwnProperty'](_0x9e22('0x45'))){_0x42db97[_0x9e22('0x2c')]=qs[_0x9e22('0x2c')](_0xf6a721['query'][_0x9e22('0x2c')]);_0x42db97[_0x9e22('0x2b')]=qs[_0x9e22('0x2b')](_0xf6a721[_0x9e22('0x3f')][_0x9e22('0x2b')]);}_0x42db97[_0x9e22('0x46')]=qs[_0x9e22('0x47')](_0xf6a721[_0x9e22('0x3f')][_0x9e22('0x47')]);_0x42db97[_0x9e22('0x49')]=qs['filters'](_['pick'](_0xf6a721[_0x9e22('0x3f')],_0x3e45e7[_0x9e22('0x40')]));_0x42db97[_0x9e22('0x49')]['OpenchannelAccountId']=_0x43eb65['id'];if(_0xf6a721[_0x9e22('0x3f')][_0x9e22('0x48')]){_0x42db97[_0x9e22('0x49')]=_[_0x9e22('0x4a')](_0x42db97['where'],{'$or':_['map'](_0x42db97[_0x9e22('0x43')],function(_0x51f6ee){var _0x254887={};_0x254887[_0x51f6ee]={'$like':'%'+_0xf6a721[_0x9e22('0x3f')][_0x9e22('0x48')]+'%'};return _0x254887;})});}_0x42db97=_['merge']({},_0x42db97,_0xf6a721[_0x9e22('0x4c')]);return db[_0x9e22('0x8a')]['count']({'where':_0x42db97[_0x9e22('0x49')]})['then'](function(_0x4ddbb2){_0xd6a4b7[_0x9e22('0x2e')]=_0x4ddbb2;if(_0xf6a721[_0x9e22('0x3f')][_0x9e22('0x54')]){_0x42db97[_0x9e22('0x4d')]=[{'model':db[_0x9e22('0xa0')],'as':_0x9e22('0xa1'),'required':![]},{'model':db[_0x9e22('0xa2')],'as':'Owner','attributes':['name',_0x9e22('0xa3'),_0x9e22('0xa4')],'required':![]},{'model':db[_0x9e22('0xa5')],'as':_0x9e22('0xa6'),'attributes':['id','name',_0x9e22('0xa7')],'where':_0xf6a721[_0x9e22('0x3f')]['tag']?{'id':_0xf6a721['query'][_0x9e22('0xa8')]}:undefined,'required':_0xf6a721[_0x9e22('0x3f')]['tag']?!![]:![]}];}return db[_0x9e22('0x8a')][_0x9e22('0x4e')](_0x42db97);})[_0x9e22('0x1d')](function(_0x596c3f){_0xd6a4b7[_0x9e22('0x4f')]=_0x596c3f;return _0xd6a4b7;});}})[_0x9e22('0x1d')](respondWithFilteredResult(_0x50b901,_0x42db97))[_0x9e22('0x50')](handleError(_0x50b901,null));};exports[_0x9e22('0xa9')]=function(_0x4df8a9,_0x5e0f5e,_0x5ce104){return db['OpenchannelAccount'][_0x9e22('0x59')]({'where':{'id':_0x4df8a9[_0x9e22('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e0f5e,null))[_0x9e22('0x1d')](function(_0x2c7dac){if(_0x2c7dac){return _0x2c7dac[_0x9e22('0xa9')](_0x4df8a9[_0x9e22('0x5e')][_0x9e22('0x69')],_['omit'](_0x4df8a9[_0x9e22('0x5e')],[_0x9e22('0x69'),'id'])||{})['spread'](function(_0x235883){for(var _0x1dd6f6=0x0;_0x1dd6f6<_0x4df8a9['body']['ids'][_0x9e22('0x44')];_0x1dd6f6+=0x1){socket[_0x9e22('0xaa')](_0x9e22('0xab'),{'UserId':Number(_0x4df8a9[_0x9e22('0x5e')][_0x9e22('0x69')][_0x1dd6f6]),'OpenchannelAccountId':Number(_0x4df8a9[_0x9e22('0x52')]['id'])});}return _0x235883;});}})[_0x9e22('0x1d')](respondWithResult(_0x5e0f5e,null))[_0x9e22('0x50')](handleError(_0x5e0f5e,null));};exports[_0x9e22('0xac')]=function(_0x11fd43,_0xb9ca41,_0x1c4614){return db['OpenchannelAccount']['find']({'where':{'id':_0x11fd43[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0xb9ca41,null))['then'](function(_0x203670){if(_0x203670){return _0x203670[_0x9e22('0xac')](_0x11fd43[_0x9e22('0x3f')][_0x9e22('0x69')])[_0x9e22('0x1d')](function(){if(_[_0x9e22('0xad')](_0x11fd43[_0x9e22('0x3f')][_0x9e22('0x69')])){for(var _0xf4494a=0x0;_0xf4494a<_0x11fd43[_0x9e22('0x3f')]['ids'][_0x9e22('0x44')];_0xf4494a+=0x1){socket[_0x9e22('0xaa')](_0x9e22('0xae'),{'UserId':Number(_0x11fd43[_0x9e22('0x3f')]['ids'][_0xf4494a]),'OpenchannelAccountId':Number(_0x11fd43[_0x9e22('0x52')]['id'])});}}else{socket['emit'](_0x9e22('0xae'),{'UserId':Number(_0x11fd43[_0x9e22('0x3f')][_0x9e22('0x69')]),'OpenchannelAccountId':Number(_0x11fd43[_0x9e22('0x52')]['id'])});}});}})[_0x9e22('0x1d')](respondWithStatusCode(_0xb9ca41,null))['catch'](handleError(_0xb9ca41,null));};exports[_0x9e22('0xaf')]=function(_0x227526,_0x19191b,_0x149b31){var _0x2c3de6={};var _0x374fc9={};var _0x19ff7d;var _0x5d552c;return db[_0x9e22('0x39')][_0x9e22('0x65')]({'where':{'id':_0x227526[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x19191b,null))[_0x9e22('0x1d')](function(_0x37bb2b){if(_0x37bb2b){_0x19ff7d=_0x37bb2b;_0x374fc9[_0x9e22('0x3d')]=_[_0x9e22('0x53')](db[_0x9e22('0xa2')][_0x9e22('0x3a')]);_0x374fc9[_0x9e22('0x3f')]=_[_0x9e22('0x53')](_0x227526[_0x9e22('0x3f')]);_0x374fc9['filters']=_[_0x9e22('0x41')](_0x374fc9[_0x9e22('0x3d')],_0x374fc9[_0x9e22('0x3f')]);_0x2c3de6[_0x9e22('0x43')]=_[_0x9e22('0x41')](_0x374fc9[_0x9e22('0x3d')],qs[_0x9e22('0x42')](_0x227526[_0x9e22('0x3f')][_0x9e22('0x42')]));_0x2c3de6[_0x9e22('0x43')]=_0x2c3de6[_0x9e22('0x43')][_0x9e22('0x44')]?_0x2c3de6[_0x9e22('0x43')]:_0x374fc9['model'];_0x2c3de6[_0x9e22('0x46')]=qs[_0x9e22('0x47')](_0x227526['query']['sort']);_0x2c3de6[_0x9e22('0x49')]=qs[_0x9e22('0x40')](_['pick'](_0x227526['query'],_0x374fc9['filters']));if(_0x227526[_0x9e22('0x3f')][_0x9e22('0x48')]){_0x2c3de6[_0x9e22('0x49')]=_[_0x9e22('0x4a')](_0x2c3de6[_0x9e22('0x49')],{'$or':_[_0x9e22('0x38')](_0x2c3de6[_0x9e22('0x43')],function(_0x56e862){var _0x2c9fdd={};_0x2c9fdd[_0x56e862]={'$like':'%'+_0x227526[_0x9e22('0x3f')][_0x9e22('0x48')]+'%'};return _0x2c9fdd;})});}_0x2c3de6=_[_0x9e22('0x4a')]({},_0x2c3de6,_0x227526[_0x9e22('0x4c')]);return _0x19ff7d[_0x9e22('0xaf')](_0x2c3de6);}})[_0x9e22('0x1d')](function(_0x35ab68){if(_0x35ab68){_0x5d552c=_0x35ab68[_0x9e22('0x44')];if(!_0x227526[_0x9e22('0x3f')][_0x9e22('0x66')]('nolimit')){_0x2c3de6[_0x9e22('0x2c')]=qs[_0x9e22('0x2c')](_0x227526[_0x9e22('0x3f')][_0x9e22('0x2c')]);_0x2c3de6['offset']=qs[_0x9e22('0x2b')](_0x227526[_0x9e22('0x3f')][_0x9e22('0x2b')]);}return _0x19ff7d[_0x9e22('0xaf')](_0x2c3de6);}})[_0x9e22('0x1d')](function(_0x560d38){if(_0x560d38){return _0x560d38?{'count':_0x5d552c,'rows':_0x560d38}:null;}})[_0x9e22('0x1d')](respondWithResult(_0x19191b,null))[_0x9e22('0x50')](handleError(_0x19191b,null));};exports['send']=function(_0x29b309,_0x278fe7,_0x6b6015){var _0x269d95,_0x4c2f64,_0xa368a9;if(_[_0x9e22('0x78')](_0x29b309[_0x9e22('0x5e')]['body'])||_0x29b309[_0x9e22('0x5e')][_0x9e22('0x5e')]===''){throw new db['Sequelize'][(_0x9e22('0x70'))](_0x9e22('0xb0'));}if(_['isNil'](_0x29b309['body']['to'])){}_0x269d95=_0x29b309[_0x9e22('0x5e')]['to'];return db[_0x9e22('0x39')][_0x9e22('0x65')]({'where':{'id':_0x29b309[_0x9e22('0x52')]['id']}})[_0x9e22('0x1d')](handleEntityNotFound(_0x278fe7,null))[_0x9e22('0x1d')](function(_0x12d17b){if(_0x12d17b){return db[_0x9e22('0x39')][_0x9e22('0x59')]({'where':{'id':_0x12d17b['id']},'include':[{'model':db[_0x9e22('0x7b')],'as':_0x9e22('0x7c'),'include':[{'model':db[_0x9e22('0xa0')],'as':_0x9e22('0x7d'),'where':{[_0x12d17b[_0x9e22('0x79')]]:_0x269d95},'limit':0x1,'order':[[_0x9e22('0x74'),'DESC']]}]}]})[_0x9e22('0x1d')](handleEntityNotFound(_0x278fe7,null))[_0x9e22('0x1d')](function(_0xcaf083){if(_0xcaf083&&_0xcaf083[_0x9e22('0x7c')]){_0x4c2f64=_0xcaf083[_0x9e22('0x57')]({'plain':!![]});if(_0x4c2f64[_0x9e22('0x7c')]&&_0x4c2f64['List'][_0x9e22('0x7d')][_0x9e22('0x44')]){return _0x4c2f64[_0x9e22('0x7c')][_0x9e22('0x7d')][0x0];}return db['CmContact']['create'](_[_0x9e22('0x14')](_0x29b309['body'],{'firstName':_0x269d95,[_0xcaf083['mapKey']]:_0x269d95,'phone':_0x269d95,'ListId':_0x4c2f64[_0x9e22('0x76')]}));}})[_0x9e22('0x1d')](handleEntityNotFound(_0x278fe7,null))['then'](function(_0x396b20){if(_0x396b20){_0xa368a9=_0x396b20;return db[_0x9e22('0x8a')][_0x9e22('0x59')]({'where':{'ContactId':_0xa368a9['id'],'closed':![],'OpenchannelAccountId':_0x4c2f64['id']}})['then'](function(_0x51e2ce){if(_0x51e2ce){return[_0x51e2ce,![]];}return db['OpenchannelInteraction'][_0x9e22('0x55')]({'UserId':_0x29b309[_0x9e22('0xb1')]['id'],'ContactId':_0xa368a9['id'],'OpenchannelAccountId':_0x4c2f64['id'],'lastMsgDirection':_0x9e22('0xb2'),'Messages':[_['merge'](_0x29b309[_0x9e22('0x5e')],{'read':![],'body':_0x29b309[_0x9e22('0x5e')][_0x9e22('0x5e')],'OpenchannelAccountId':_0x4c2f64['id'],'UserId':_0x29b309[_0x9e22('0xb1')]['id'],'ContactId':_0xa368a9['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x9e22('0xb3')}]})['then'](function(_0x49f319){return[_0x49f319,!![]];});});}})[_0x9e22('0xb4')](function(_0x28759d,_0x32ffd0){if(_0x32ffd0){return _0x28759d;}return db[_0x9e22('0x92')][_0x9e22('0x55')](_['merge'](_0x29b309['body'],{'read':![],'body':_0x29b309[_0x9e22('0x5e')][_0x9e22('0x5e')],'OpenchannelAccountId':_0x4c2f64['id'],'OpenchannelInteractionId':_0x28759d['id'],'UserId':_0x29b309['user']['id'],'ContactId':_0xa368a9['id']}))[_0x9e22('0x1d')](function(_0x420df1){_0x28759d['dataValues']['Messages']=[];_0x28759d[_0x9e22('0xb5')][_0x9e22('0xb3')][_0x9e22('0x90')](_0x420df1[_0x9e22('0xb5')]);return _0x28759d;});});}})['then'](respondWithResult(_0x278fe7,null))['catch'](handleError(_0x278fe7,null));}; \ No newline at end of file +var _0x7b73=['OpenchannelApplication','Applications','account','applications','list','priority','asc','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','defaults','user','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','catch','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','Pause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7b73,0xf5));var _0x37b7=function(_0x1de01d,_0xeb122c){_0x1de01d=_0x1de01d-0x0;var _0x2865ef=_0x7b73[_0x1de01d];return _0x2865ef;};'use strict';var emlformat=require(_0x37b7('0x0'));var rimraf=require(_0x37b7('0x1'));var zipdir=require(_0x37b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37b7('0x3'));var moment=require(_0x37b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37b7('0x5'));var util=require(_0x37b7('0x6'));var path=require(_0x37b7('0x7'));var sox=require('sox');var csv=require(_0x37b7('0x8'));var ejs=require(_0x37b7('0x9'));var fs=require('fs');var fs_extra=require(_0x37b7('0xa'));var _=require(_0x37b7('0xb'));var squel=require(_0x37b7('0xc'));var crypto=require(_0x37b7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x37b7('0xe'));var toCsv=require(_0x37b7('0x8'));var querystring=require(_0x37b7('0xf'));var Papa=require('papaparse');var Redis=require(_0x37b7('0x10'));var authService=require(_0x37b7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37b7('0x12'));var logger=require(_0x37b7('0x13'))('api');var utils=require(_0x37b7('0x14'));var config=require(_0x37b7('0x15'));var licenseUtil=require(_0x37b7('0x16'));var db=require('../../mysqldb')['db'];config[_0x37b7('0x17')]=_['defaults'](config[_0x37b7('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37b7('0x17')]));require(_0x37b7('0x18'))[_0x37b7('0x19')](socket);var jayson=require(_0x37b7('0x1a'));var client=jayson[_0x37b7('0x1b')][_0x37b7('0x1c')]({'port':0x232c});var client9002=jayson[_0x37b7('0x1b')][_0x37b7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2fa792,_0x11011c,_0x5a3474,_0x307eb2){return new BPromise(function(_0x187f2f,_0xd9e0a8){var _0x5d1745=_0x307eb2||client;return _0x5d1745[_0x37b7('0x1d')](_0x2fa792,_0x5a3474)[_0x37b7('0x1e')](function(_0x203778){logger[_0x37b7('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x11011c,_0x37b7('0x20'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11011c,_0x37b7('0x20'),JSON[_0x37b7('0x21')](_0x203778));if(_0x203778[_0x37b7('0x22')]){if(_0x203778[_0x37b7('0x22')][_0x37b7('0x23')]===0x1f4){logger[_0x37b7('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x11011c,_0x203778['error'][_0x37b7('0x24')]);return _0xd9e0a8(_0x203778[_0x37b7('0x22')][_0x37b7('0x24')]);}logger[_0x37b7('0x22')](_0x37b7('0x25'),_0x11011c,_0x203778[_0x37b7('0x22')][_0x37b7('0x24')]);return _0x187f2f(_0x203778[_0x37b7('0x22')][_0x37b7('0x24')]);}else{logger[_0x37b7('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x11011c,_0x37b7('0x20'));_0x187f2f(_0x203778['result'][_0x37b7('0x24')]);}})[_0x37b7('0x26')](function(_0x562b66){logger[_0x37b7('0x22')](_0x37b7('0x25'),_0x11011c,_0x562b66);_0xd9e0a8(_0x562b66);});});}function respondWithStatusCode(_0x3bfde9,_0x32c551){_0x32c551=_0x32c551||0xcc;return function(_0x41e906){if(_0x41e906){return _0x3bfde9['sendStatus'](_0x32c551);}return _0x3bfde9[_0x37b7('0x27')](_0x32c551)[_0x37b7('0x28')]();};}function respondWithResult(_0x56c716,_0x41fa0e){_0x41fa0e=_0x41fa0e||0xc8;return function(_0x1b0037){if(_0x1b0037){return _0x56c716[_0x37b7('0x27')](_0x41fa0e)[_0x37b7('0x29')](_0x1b0037);}};}function respondWithFilteredResult(_0x3894ac,_0x5e357f){return function(_0x2193a2){if(_0x2193a2){var _0x1430a6=typeof _0x5e357f[_0x37b7('0x2a')]===_0x37b7('0x2b')&&typeof _0x5e357f[_0x37b7('0x2c')]==='undefined';var _0x5ecbcb=_0x2193a2['count'];var _0xe43480=_0x1430a6?0x0:_0x5e357f[_0x37b7('0x2a')];var _0x4d370a=_0x1430a6?_0x2193a2[_0x37b7('0x2d')]:_0x5e357f[_0x37b7('0x2a')]+_0x5e357f[_0x37b7('0x2c')];var _0x27f0a6;if(_0x4d370a>=_0x5ecbcb){_0x4d370a=_0x5ecbcb;_0x27f0a6=0xc8;}else{_0x27f0a6=0xce;}_0x3894ac[_0x37b7('0x27')](_0x27f0a6);return _0x3894ac['set'](_0x37b7('0x2e'),_0xe43480+'-'+_0x4d370a+'/'+_0x5ecbcb)[_0x37b7('0x29')](_0x2193a2);}return null;};}function patchUpdates(_0x1e141b){return function(_0x3e3039){try{jsonpatch['apply'](_0x3e3039,_0x1e141b,!![]);}catch(_0xb2f323){return BPromise[_0x37b7('0x2f')](_0xb2f323);}return _0x3e3039['save']();};}function saveUpdates(_0x3cb799,_0x47dbc8){return function(_0xdd4979){if(_0xdd4979){return _0xdd4979[_0x37b7('0x30')](_0x3cb799)[_0x37b7('0x1e')](function(_0x3e7128){return _0x3e7128;});}return null;};}function removeEntity(_0x3a9738,_0x1b2cd6){return function(_0xf08793){if(_0xf08793){return _0xf08793[_0x37b7('0x31')]()[_0x37b7('0x1e')](function(){var _0x21c5a7=_0xf08793[_0x37b7('0x32')]({'plain':!![]});var _0x1bf9e9=_0x37b7('0x33');return db[_0x37b7('0x34')][_0x37b7('0x31')]({'where':{'type':_0x1bf9e9,'resourceId':_0x21c5a7['id']}})[_0x37b7('0x1e')](function(){return _0xf08793;});})['then'](function(){_0x3a9738['status'](0xcc)[_0x37b7('0x28')]();});}};}function handleEntityNotFound(_0x2bc28c,_0x2fd521){return function(_0x79d469){if(!_0x79d469){_0x2bc28c['sendStatus'](0x194);}return _0x79d469;};}function handleError(_0x1852ac,_0x45d149){_0x45d149=_0x45d149||0x1f4;return function(_0x5f499a){logger['error'](_0x5f499a[_0x37b7('0x35')]);if(_0x5f499a['name']){delete _0x5f499a[_0x37b7('0x36')];}_0x1852ac['status'](_0x45d149)['send'](_0x5f499a);};}exports['index']=function(_0x1baf13,_0x56f4c5){var _0x1057c8={'include':[{'model':db['Pause'],'as':_0x37b7('0x37')}]},_0xadce80={},_0x12d8ce={'count':0x0,'rows':[]};var _0x1e381f=_[_0x37b7('0x38')](db[_0x37b7('0x39')][_0x37b7('0x3a')],function(_0x259d53){return{'name':_0x259d53[_0x37b7('0x3b')],'type':_0x259d53[_0x37b7('0x3c')][_0x37b7('0x3d')]};});_0xadce80['model']=_['map'](_0x1e381f,_0x37b7('0x36'));_0xadce80[_0x37b7('0x3e')]=_[_0x37b7('0x3f')](_0x1baf13[_0x37b7('0x3e')]);_0xadce80['filters']=_[_0x37b7('0x40')](_0xadce80['model'],_0xadce80[_0x37b7('0x3e')]);_0x1057c8[_0x37b7('0x41')]=_['intersection'](_0xadce80[_0x37b7('0x42')],qs[_0x37b7('0x43')](_0x1baf13[_0x37b7('0x3e')]['fields']));_0x1057c8[_0x37b7('0x41')]=_0x1057c8[_0x37b7('0x41')][_0x37b7('0x44')]?_0x1057c8[_0x37b7('0x41')]:_0xadce80[_0x37b7('0x42')];if(!_0x1baf13[_0x37b7('0x3e')][_0x37b7('0x45')](_0x37b7('0x46'))){_0x1057c8['limit']=qs[_0x37b7('0x2c')](_0x1baf13['query']['limit']);_0x1057c8[_0x37b7('0x2a')]=qs[_0x37b7('0x2a')](_0x1baf13[_0x37b7('0x3e')][_0x37b7('0x2a')]);}_0x1057c8[_0x37b7('0x47')]=qs[_0x37b7('0x48')](_0x1baf13[_0x37b7('0x3e')]['sort']);_0x1057c8[_0x37b7('0x49')]=qs[_0x37b7('0x4a')](_[_0x37b7('0x4b')](_0x1baf13[_0x37b7('0x3e')],_0xadce80[_0x37b7('0x4a')]),_0x1e381f);if(_0x1baf13[_0x37b7('0x3e')][_0x37b7('0x4c')]){_0x1057c8[_0x37b7('0x49')]=_[_0x37b7('0x4d')](_0x1057c8[_0x37b7('0x49')],{'$or':_[_0x37b7('0x38')](_0x1e381f,function(_0x5097d3){if(_0x5097d3[_0x37b7('0x3c')]!=='VIRTUAL'){var _0x5b5bc6={};_0x5b5bc6[_0x5097d3['name']]={'$like':'%'+_0x1baf13[_0x37b7('0x3e')][_0x37b7('0x4c')]+'%'};return _0x5b5bc6;}})});}_0x1057c8=_[_0x37b7('0x4d')]({},_0x1057c8,_0x1baf13[_0x37b7('0x4e')]);var _0x29731b={'where':_0x1057c8['where']};return db[_0x37b7('0x39')][_0x37b7('0x2d')](_0x29731b)['then'](function(_0x29d698){_0x12d8ce['count']=_0x29d698;if(_0x1baf13[_0x37b7('0x3e')][_0x37b7('0x4f')]){_0x1057c8[_0x37b7('0x50')]=[{'all':!![]}];}return db[_0x37b7('0x39')][_0x37b7('0x51')](_0x1057c8);})[_0x37b7('0x1e')](function(_0x29b162){_0x12d8ce[_0x37b7('0x52')]=_0x29b162;return _0x12d8ce;})[_0x37b7('0x1e')](respondWithFilteredResult(_0x56f4c5,_0x1057c8))[_0x37b7('0x26')](handleError(_0x56f4c5,null));};exports[_0x37b7('0x53')]=function(_0x1d4999,_0x1efe39){var _0x4afb1b={'raw':![],'where':{'id':_0x1d4999['params']['id']},'include':[{'model':db[_0x37b7('0x54')],'as':_0x37b7('0x37')}]},_0x1e19a8={};_0x1e19a8['model']=_['keys'](db['OpenchannelAccount'][_0x37b7('0x3a')]);_0x1e19a8['query']=_['keys'](_0x1d4999['query']);_0x1e19a8[_0x37b7('0x4a')]=_[_0x37b7('0x40')](_0x1e19a8[_0x37b7('0x42')],_0x1e19a8[_0x37b7('0x3e')]);_0x4afb1b[_0x37b7('0x41')]=_[_0x37b7('0x40')](_0x1e19a8[_0x37b7('0x42')],qs[_0x37b7('0x43')](_0x1d4999[_0x37b7('0x3e')][_0x37b7('0x43')]));_0x4afb1b[_0x37b7('0x41')]=_0x4afb1b[_0x37b7('0x41')][_0x37b7('0x44')]?_0x4afb1b[_0x37b7('0x41')]:_0x1e19a8[_0x37b7('0x42')];if(_0x1d4999[_0x37b7('0x3e')][_0x37b7('0x4f')]){_0x4afb1b['include']=[{'all':!![]}];}_0x4afb1b=_[_0x37b7('0x4d')]({},_0x4afb1b,_0x1d4999[_0x37b7('0x4e')]);return db[_0x37b7('0x39')]['find'](_0x4afb1b)[_0x37b7('0x1e')](handleEntityNotFound(_0x1efe39,null))[_0x37b7('0x1e')](respondWithResult(_0x1efe39,null))[_0x37b7('0x26')](handleError(_0x1efe39,null));};exports[_0x37b7('0x55')]=function(_0x28d0a8,_0x45a9ff){return db[_0x37b7('0x39')][_0x37b7('0x55')](_0x28d0a8[_0x37b7('0x56')],{})[_0x37b7('0x1e')](function(_0x2f8dfd){var _0x4d3598=_0x28d0a8['user'][_0x37b7('0x32')]({'plain':!![]});if(!_0x4d3598)throw new Error(_0x37b7('0x57'));if(_0x4d3598[_0x37b7('0x58')]==='user'){var _0x20b848=_0x2f8dfd[_0x37b7('0x32')]({'plain':!![]});var _0x4c646b=_0x37b7('0x33');return db['UserProfileSection'][_0x37b7('0x59')]({'where':{'name':_0x4c646b,'userProfileId':_0x4d3598[_0x37b7('0x5a')]},'raw':!![]})[_0x37b7('0x1e')](function(_0x45c89a){if(_0x45c89a&&_0x45c89a[_0x37b7('0x5b')]===0x0){return db[_0x37b7('0x34')][_0x37b7('0x55')]({'name':_0x20b848[_0x37b7('0x36')],'resourceId':_0x20b848['id'],'type':_0x45c89a['name'],'sectionId':_0x45c89a['id']},{})[_0x37b7('0x1e')](function(){return _0x2f8dfd;});}else{return _0x2f8dfd;}})['catch'](function(_0x4c1975){logger['error'](_0x37b7('0x5c'),_0x4c1975);throw _0x4c1975;});}return _0x2f8dfd;})[_0x37b7('0x1e')](respondWithResult(_0x45a9ff,0xc9))[_0x37b7('0x26')](handleError(_0x45a9ff,null));};exports[_0x37b7('0x30')]=function(_0x18771d,_0x45068d){if(_0x18771d[_0x37b7('0x56')]['id']){delete _0x18771d[_0x37b7('0x56')]['id'];}return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x18771d[_0x37b7('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x37b7('0x1e')](handleEntityNotFound(_0x45068d,null))[_0x37b7('0x1e')](saveUpdates(_0x18771d[_0x37b7('0x56')],null))[_0x37b7('0x1e')](respondWithResult(_0x45068d,null))[_0x37b7('0x26')](handleError(_0x45068d,null));};exports[_0x37b7('0x31')]=function(_0x3a9e79,_0x54aa81){return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x3a9e79[_0x37b7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x54aa81,null))[_0x37b7('0x1e')](removeEntity(_0x54aa81,null))['catch'](handleError(_0x54aa81,null));};exports[_0x37b7('0x5e')]=function(_0x4df0d3,_0x56b3b8){return db['OpenchannelAccount'][_0x37b7('0x5e')]()[_0x37b7('0x1e')](respondWithResult(_0x56b3b8,null))[_0x37b7('0x26')](handleError(_0x56b3b8,null));};exports[_0x37b7('0x5f')]=function(_0x49fdd5,_0x1167a0,_0x418121){if(_0x49fdd5[_0x37b7('0x56')]['id']){delete _0x49fdd5[_0x37b7('0x56')]['id'];}return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x49fdd5[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x1167a0,null))['then'](function(_0x840324){if(_0x840324){_0x49fdd5['body'][_0x37b7('0x60')]=_0x840324['id'];return db[_0x37b7('0x61')][_0x37b7('0x55')](_0x49fdd5[_0x37b7('0x56')]);}})[_0x37b7('0x1e')](respondWithResult(_0x1167a0,null))[_0x37b7('0x26')](handleError(_0x1167a0,null));};exports['getDispositions']=function(_0x225843,_0x4694a4,_0x663fa1){var _0x1ce727={'raw':![],'where':{}};var _0x55373b={};var _0xb13baa={'count':0x0,'rows':[]};return db[_0x37b7('0x39')][_0x37b7('0x62')]({'where':{'id':_0x225843[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x4694a4,null))[_0x37b7('0x1e')](function(_0x5e7038){if(_0x5e7038){_0x55373b['model']=_['keys'](db[_0x37b7('0x61')][_0x37b7('0x3a')]);_0x55373b['query']=_['keys'](_0x225843[_0x37b7('0x3e')]);_0x55373b['filters']=_[_0x37b7('0x40')](_0x55373b['model'],_0x55373b[_0x37b7('0x3e')]);_0x1ce727['attributes']=_[_0x37b7('0x40')](_0x55373b[_0x37b7('0x42')],qs[_0x37b7('0x43')](_0x225843[_0x37b7('0x3e')][_0x37b7('0x43')]));_0x1ce727[_0x37b7('0x41')]=_0x1ce727[_0x37b7('0x41')][_0x37b7('0x44')]?_0x1ce727[_0x37b7('0x41')]:_0x55373b[_0x37b7('0x42')];if(!_0x225843[_0x37b7('0x3e')][_0x37b7('0x45')](_0x37b7('0x46'))){_0x1ce727['limit']=qs[_0x37b7('0x2c')](_0x225843[_0x37b7('0x3e')]['limit']);_0x1ce727[_0x37b7('0x2a')]=qs[_0x37b7('0x2a')](_0x225843['query']['offset']);}_0x1ce727[_0x37b7('0x47')]=qs[_0x37b7('0x48')](_0x225843[_0x37b7('0x3e')]['sort']);_0x1ce727[_0x37b7('0x49')]=qs[_0x37b7('0x4a')](_[_0x37b7('0x4b')](_0x225843[_0x37b7('0x3e')],_0x55373b[_0x37b7('0x4a')]));_0x1ce727[_0x37b7('0x49')]['OpenchannelAccountId']=_0x5e7038['id'];if(_0x225843[_0x37b7('0x3e')][_0x37b7('0x4c')]){_0x1ce727[_0x37b7('0x49')]=_[_0x37b7('0x4d')](_0x1ce727[_0x37b7('0x49')],{'$or':_[_0x37b7('0x38')](_0x1ce727[_0x37b7('0x41')],function(_0x500283){var _0x17ab43={};_0x17ab43[_0x500283]={'$like':'%'+_0x225843[_0x37b7('0x3e')][_0x37b7('0x4c')]+'%'};return _0x17ab43;})});}_0x1ce727=_['merge']({},_0x1ce727,_0x225843['options']);return db['Disposition'][_0x37b7('0x2d')]({'where':_0x1ce727[_0x37b7('0x49')]})['then'](function(_0x1c0cc6){_0xb13baa['count']=_0x1c0cc6;if(_0x225843[_0x37b7('0x3e')][_0x37b7('0x4f')]){_0x1ce727[_0x37b7('0x50')]=[{'all':!![]}];}return db[_0x37b7('0x61')][_0x37b7('0x51')](_0x1ce727);})[_0x37b7('0x1e')](function(_0x52a046){_0xb13baa[_0x37b7('0x52')]=_0x52a046;return _0xb13baa;});}})[_0x37b7('0x1e')](respondWithFilteredResult(_0x4694a4,_0x1ce727))[_0x37b7('0x26')](handleError(_0x4694a4,null));};exports[_0x37b7('0x63')]=function(_0x13287f,_0x2562de,_0x1625b4){return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x13287f['params']['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x2562de,null))['then'](function(_0x182d0a){if(_0x182d0a){return _0x182d0a[_0x37b7('0x63')](_0x13287f[_0x37b7('0x3e')][_0x37b7('0x64')]);}})[_0x37b7('0x1e')](respondWithStatusCode(_0x2562de,null))[_0x37b7('0x26')](handleError(_0x2562de,null));};exports['addAnswer']=function(_0x132301,_0x1ec918,_0x46065c){if(_0x132301[_0x37b7('0x56')]['id']){delete _0x132301[_0x37b7('0x56')]['id'];}return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x132301[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x1ec918,null))[_0x37b7('0x1e')](function(_0x3fa762){if(_0x3fa762){_0x132301[_0x37b7('0x56')][_0x37b7('0x60')]=_0x3fa762['id'];return db[_0x37b7('0x65')]['create'](_0x132301[_0x37b7('0x56')]);}})[_0x37b7('0x1e')](respondWithResult(_0x1ec918,null))[_0x37b7('0x26')](handleError(_0x1ec918,null));};exports['getAnswers']=function(_0xf44400,_0x4481ce,_0x297ec5){var _0x4cdf67={'raw':![],'where':{}};var _0x43b95b={};var _0x174850={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xf44400['params']['id']}})['then'](handleEntityNotFound(_0x4481ce,null))[_0x37b7('0x1e')](function(_0x4d764c){if(_0x4d764c){_0x43b95b[_0x37b7('0x42')]=_[_0x37b7('0x3f')](db[_0x37b7('0x65')][_0x37b7('0x3a')]);_0x43b95b['query']=_[_0x37b7('0x3f')](_0xf44400[_0x37b7('0x3e')]);_0x43b95b[_0x37b7('0x4a')]=_[_0x37b7('0x40')](_0x43b95b['model'],_0x43b95b[_0x37b7('0x3e')]);_0x4cdf67['attributes']=_[_0x37b7('0x40')](_0x43b95b['model'],qs[_0x37b7('0x43')](_0xf44400[_0x37b7('0x3e')][_0x37b7('0x43')]));_0x4cdf67[_0x37b7('0x41')]=_0x4cdf67['attributes'][_0x37b7('0x44')]?_0x4cdf67[_0x37b7('0x41')]:_0x43b95b[_0x37b7('0x42')];if(!_0xf44400[_0x37b7('0x3e')][_0x37b7('0x45')](_0x37b7('0x46'))){_0x4cdf67['limit']=qs['limit'](_0xf44400['query']['limit']);_0x4cdf67[_0x37b7('0x2a')]=qs[_0x37b7('0x2a')](_0xf44400[_0x37b7('0x3e')][_0x37b7('0x2a')]);}_0x4cdf67['order']=qs[_0x37b7('0x48')](_0xf44400[_0x37b7('0x3e')][_0x37b7('0x48')]);_0x4cdf67['where']=qs[_0x37b7('0x4a')](_[_0x37b7('0x4b')](_0xf44400[_0x37b7('0x3e')],_0x43b95b[_0x37b7('0x4a')]));_0x4cdf67['where'][_0x37b7('0x60')]=_0x4d764c['id'];if(_0xf44400[_0x37b7('0x3e')][_0x37b7('0x4c')]){_0x4cdf67[_0x37b7('0x49')]=_['merge'](_0x4cdf67[_0x37b7('0x49')],{'$or':_['map'](_0x4cdf67[_0x37b7('0x41')],function(_0x571b65){var _0x5c5993={};_0x5c5993[_0x571b65]={'$like':'%'+_0xf44400[_0x37b7('0x3e')]['filter']+'%'};return _0x5c5993;})});}_0x4cdf67=_[_0x37b7('0x4d')]({},_0x4cdf67,_0xf44400['options']);return db[_0x37b7('0x65')][_0x37b7('0x2d')]({'where':_0x4cdf67[_0x37b7('0x49')]})[_0x37b7('0x1e')](function(_0x3adcc4){_0x174850[_0x37b7('0x2d')]=_0x3adcc4;if(_0xf44400['query'][_0x37b7('0x4f')]){_0x4cdf67[_0x37b7('0x50')]=[{'all':!![]}];}return db[_0x37b7('0x65')][_0x37b7('0x51')](_0x4cdf67);})[_0x37b7('0x1e')](function(_0x387224){_0x174850[_0x37b7('0x52')]=_0x387224;return _0x174850;});}})['then'](respondWithFilteredResult(_0x4481ce,_0x4cdf67))[_0x37b7('0x26')](handleError(_0x4481ce,null));};exports[_0x37b7('0x66')]=function(_0x48e45b,_0xfd82a0,_0x3c1d49){return db['OpenchannelAccount']['find']({'where':{'id':_0x48e45b[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0xfd82a0,null))[_0x37b7('0x1e')](function(_0x302862){if(_0x302862){return _0x302862[_0x37b7('0x66')](_0x48e45b[_0x37b7('0x3e')][_0x37b7('0x64')]);}})[_0x37b7('0x1e')](respondWithStatusCode(_0xfd82a0,null))[_0x37b7('0x26')](handleError(_0xfd82a0,null));};exports[_0x37b7('0x67')]=function(_0x263af4,_0x144177,_0x5e3f6f){var _0x1d85cf={'body':_0x263af4['body'],'channel':_0x37b7('0x68')};var _0x2961fe=[];var _0x5e47c6=[];var _0x32d5ec={};var _0x40604c=![];return db[_0x37b7('0x69')]['describe']()[_0x37b7('0x1e')](function(_0x259012){if(!_0x259012){throw new db[(_0x37b7('0x6a'))][(_0x37b7('0x6b'))](_0x37b7('0x6c'));}_0x2961fe=_[_0x37b7('0x6d')](_['keys'](_0x259012),[_0x37b7('0x6e'),_0x37b7('0x6f')]);_0x5e47c6=_[_0x37b7('0x6d')](_[_0x37b7('0x3f')](_0x259012),['createdAt','updatedAt',_0x37b7('0x70'),'ListId']);if(_0x263af4[_0x37b7('0x56')]['id']){delete _0x263af4[_0x37b7('0x56')]['id'];}if(_[_0x37b7('0x71')](_0x263af4['body'][_0x37b7('0x72')])){throw new db[(_0x37b7('0x6a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x37b7('0x71')](_0x263af4[_0x37b7('0x56')][_0x37b7('0x56')])||_0x263af4[_0x37b7('0x56')][_0x37b7('0x56')]===''){throw new db[(_0x37b7('0x6a'))][(_0x37b7('0x6b'))](_0x37b7('0x73'));}if(_[_0x37b7('0x71')](_0x263af4['body'][_0x37b7('0x74')])){throw new db[(_0x37b7('0x6a'))][(_0x37b7('0x6b'))](_0x37b7('0x75')+_0x5e47c6);}if(!_[_0x37b7('0x76')](_0x5e47c6,_0x263af4[_0x37b7('0x56')][_0x37b7('0x74')])){throw new db[(_0x37b7('0x6a'))][(_0x37b7('0x6b'))](_0x37b7('0x77')+_0x5e47c6);}_0x32d5ec[_0x263af4[_0x37b7('0x56')][_0x37b7('0x74')]]=_0x263af4[_0x37b7('0x56')][_0x37b7('0x72')];})[_0x37b7('0x1e')](function(){return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x263af4[_0x37b7('0x5d')]['id']},'include':[{'model':db[_0x37b7('0x78')],'as':_0x37b7('0x79'),'include':[{'model':db[_0x37b7('0x69')],'as':'Contacts','where':_0x32d5ec,'limit':0x1,'order':[[_0x37b7('0x6f'),_0x37b7('0x7a')]]}]},{'model':db[_0x37b7('0x7b')],'as':_0x37b7('0x7c')}]});})[_0x37b7('0x1e')](handleEntityNotFound(_0x144177,null))[_0x37b7('0x1e')](function(_0x1ba80a){if(_0x1ba80a&&_0x1ba80a[_0x37b7('0x79')]){_0x1d85cf[_0x37b7('0x7d')]=_0x1ba80a;_0x1d85cf[_0x37b7('0x7e')]=_0x1ba80a[_0x37b7('0x7c')];_0x1d85cf[_0x37b7('0x7f')]=_0x1ba80a['List'];_0x1d85cf['applications']=_['orderBy'](_0x1d85cf[_0x37b7('0x7e')],[_0x37b7('0x80')],[_0x37b7('0x81')]);if(_0x1d85cf[_0x37b7('0x7d')][_0x37b7('0x7c')]){delete _0x1d85cf['account'][_0x37b7('0x7c')];}if(_0x1d85cf[_0x37b7('0x7d')][_0x37b7('0x79')]&&_0x1d85cf['account']['List']['Contacts'][_0x37b7('0x44')]){return _0x1d85cf[_0x37b7('0x7d')][_0x37b7('0x79')][_0x37b7('0x82')][0x0];}var _0x44e2ee=_['defaults'](_0x263af4[_0x37b7('0x56')],{'firstName':_0x263af4['body'][_0x37b7('0x72')],'ListId':_0x1ba80a[_0x37b7('0x83')]});_0x44e2ee[_0x263af4[_0x37b7('0x56')][_0x37b7('0x74')]]=_0x263af4[_0x37b7('0x56')][_0x37b7('0x72')];return db[_0x37b7('0x69')][_0x37b7('0x55')](_0x44e2ee,{'fields':_0x2961fe,'raw':!![]});}})[_0x37b7('0x1e')](handleEntityNotFound(_0x144177,null))[_0x37b7('0x1e')](function(_0x5301a7){_0x1d85cf[_0x37b7('0x84')]=_0x5301a7;if(_0x5301a7){var _0x181c10={'ContactId':_0x5301a7['id'],'OpenchannelAccountId':_0x263af4[_0x37b7('0x5d')]['id'],'from':(_0x5301a7[_0x37b7('0x85')]||'')+'\x20'+(_0x5301a7[_0x37b7('0x86')]||'')};var _0x491dba={'OpenchannelAccountId':_0x263af4[_0x37b7('0x5d')]['id'],'closed':![]};if(_0x263af4['body'][_0x37b7('0x87')]){_0x491dba['threadId']=_0x263af4[_0x37b7('0x56')][_0x37b7('0x87')];return db[_0x37b7('0x88')][_0x37b7('0x59')]({'where':_0x491dba})[_0x37b7('0x1e')](function(_0x5de77c){if(_0x5de77c){return[_0x5de77c,![]];}_0x181c10['threadId']=_0x263af4[_0x37b7('0x56')][_0x37b7('0x87')];_0x181c10['externalUrl']=_0x263af4[_0x37b7('0x56')][_0x37b7('0x89')];return db['OpenchannelInteraction'][_0x37b7('0x55')](_0x181c10)['then'](function(_0x5e6235){return[_0x5e6235,!![]];});});}else{_0x491dba[_0x37b7('0x87')]=null;}_0x491dba[_0x37b7('0x8a')]=_0x5301a7['id'];return db[_0x37b7('0x88')][_0x37b7('0x59')]({'where':_0x491dba})[_0x37b7('0x1e')](function(_0xd06267){if(_0xd06267){return[_0xd06267,![]];}return db[_0x37b7('0x88')]['create'](_0x181c10)[_0x37b7('0x1e')](function(_0x7905e9){return[_0x7905e9,!![]];});});}})['spread'](function(_0x14aa3f,_0x9520f9){if(_0x14aa3f){_0x40604c=_0x9520f9;if(!_0x9520f9){var _0x2fb496={'from':(_0x1d85cf['contact'][_0x37b7('0x85')]||'')+'\x20'+(_0x1d85cf[_0x37b7('0x84')][_0x37b7('0x86')]||'')};if(_0x263af4[_0x37b7('0x56')][_0x37b7('0x87')]&&_0x263af4[_0x37b7('0x56')][_0x37b7('0x8b')]&&_0x263af4[_0x37b7('0x56')][_0x37b7('0x87')]!=_0x263af4[_0x37b7('0x56')][_0x37b7('0x8b')]){_0x2fb496[_0x37b7('0x87')]=_0x263af4[_0x37b7('0x56')][_0x37b7('0x8b')];}return _0x14aa3f[_0x37b7('0x30')](_0x2fb496);}else{return _0x14aa3f;}}})['then'](function(_0x5c6161){_0x1d85cf[_0x37b7('0x8c')]=_0x5c6161['get']({'plain':!![]});_0x1d85cf['interaction'][_0x37b7('0x8d')]=_0x40604c;if(_0x1d85cf[_0x37b7('0x8c')]['created']){if(_0x1d85cf[_0x37b7('0x7d')]['autoclose']){_0x1d85cf[_0x37b7('0x7e')][_0x37b7('0x8e')]({'id':0x0,'priority':_0x1d85cf[_0x37b7('0x7e')][_0x37b7('0x44')]+0x1,'app':_0x37b7('0x8f'),'appdata':_0x37b7('0x90'),'interval':_0x37b7('0x91')});}}return db['OpenchannelMessage'][_0x37b7('0x55')]({'body':_0x263af4[_0x37b7('0x56')][_0x37b7('0x56')],'OpenchannelAccountId':_0x263af4[_0x37b7('0x5d')]['id'],'OpenchannelInteractionId':_0x5c6161['id'],'direction':'in','ContactId':_0x1d85cf[_0x37b7('0x84')]['id'],'AttachmentId':_0x263af4[_0x37b7('0x56')][_0x37b7('0x92')]});})[_0x37b7('0x1e')](function(_0x4d6966){_0x1d85cf['message']=_0x4d6966;if(_0x1d85cf[_0x37b7('0x8c')][_0x37b7('0x93')]){return db['User'][_0x37b7('0x59')]({'attributes':['id',_0x37b7('0x36')],'where':{'id':_0x1d85cf[_0x37b7('0x8c')]['UserId']}})[_0x37b7('0x1e')](function(_0x3ac01c){if(_0x3ac01c){_0x1d85cf[_0x37b7('0x7e')][_0x37b7('0x94')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3ac01c[_0x37b7('0x36')]+','+(_0x1d85cf['account'][_0x37b7('0x95')]||0xa),'interval':'*,*,*,*'});_0x1d85cf['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x37b7('0x96'),_0x1d85cf);});}return respondWithRpcPromise(_0x37b7('0x97'),_0x37b7('0x96'),_0x1d85cf);})[_0x37b7('0x1e')](function(_0xa0451c){respondWithRpcPromise(_0x37b7('0x98'),'EventManager',{'event':'notify','message':_0xa0451c},client9002);return _0xa0451c;})['then'](respondWithResult(_0x144177,null))['catch'](handleError(_0x144177,null));};exports[_0x37b7('0x99')]=function(_0x4fea64,_0x2372e8,_0x4c346b){return db['OpenchannelAccount'][_0x37b7('0x62')]({'where':{'id':_0x4fea64['params']['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x2372e8,null))[_0x37b7('0x1e')](function(_0x1e93c3){if(_0x1e93c3){return db[_0x37b7('0x9a')][_0x37b7('0x9b')](function(_0x38ba25){return db[_0x37b7('0x7b')][_0x37b7('0x31')]({'where':{'OpenchannelAccountId':_0x4fea64[_0x37b7('0x5d')]['id']},'transaction':_0x38ba25})['then'](function(_0x3c9886){var _0x3f41f7=_['map'](_0x4fea64[_0x37b7('0x56')],function(_0x1dd785){_0x1dd785['OpenchannelAccountId']=_0x4fea64['params']['id'];return _0x1dd785;});return db[_0x37b7('0x7b')][_0x37b7('0x9c')](_0x3f41f7,{'transaction':_0x38ba25});});})[_0x37b7('0x1e')](function(){return db[_0x37b7('0x7b')][_0x37b7('0x9d')]({'where':{'OpenchannelAccountId':_0x4fea64[_0x37b7('0x5d')]['id']},'order':_0x37b7('0x80')});});}})['then'](respondWithResult(_0x2372e8,null))[_0x37b7('0x26')](handleError(_0x2372e8,null));};exports[_0x37b7('0x9e')]=function(_0x270ea2,_0x463b16,_0x4b465e){var _0x1e819d={};var _0x3fceef={};var _0x4f333e;var _0x17b302;return db[_0x37b7('0x39')][_0x37b7('0x62')]({'where':{'id':_0x270ea2[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x463b16,null))[_0x37b7('0x1e')](function(_0x1e84e6){if(_0x1e84e6){_0x4f333e=_0x1e84e6;_0x3fceef['model']=_[_0x37b7('0x3f')](db[_0x37b7('0x7b')][_0x37b7('0x3a')]);_0x3fceef['query']=_[_0x37b7('0x3f')](_0x270ea2['query']);_0x3fceef[_0x37b7('0x4a')]=_['intersection'](_0x3fceef[_0x37b7('0x42')],_0x3fceef['query']);_0x1e819d[_0x37b7('0x41')]=_['intersection'](_0x3fceef[_0x37b7('0x42')],qs[_0x37b7('0x43')](_0x270ea2[_0x37b7('0x3e')]['fields']));_0x1e819d[_0x37b7('0x41')]=_0x1e819d[_0x37b7('0x41')][_0x37b7('0x44')]?_0x1e819d[_0x37b7('0x41')]:_0x3fceef['model'];_0x1e819d[_0x37b7('0x47')]=qs[_0x37b7('0x48')](_0x270ea2[_0x37b7('0x3e')][_0x37b7('0x48')]);_0x1e819d[_0x37b7('0x49')]=qs[_0x37b7('0x4a')](_[_0x37b7('0x4b')](_0x270ea2[_0x37b7('0x3e')],_0x3fceef['filters']));if(_0x270ea2[_0x37b7('0x3e')][_0x37b7('0x4c')]){_0x1e819d[_0x37b7('0x49')]=_['merge'](_0x1e819d[_0x37b7('0x49')],{'$or':_['map'](_0x1e819d['attributes'],function(_0x460440){var _0x31c839={};_0x31c839[_0x460440]={'$like':'%'+_0x270ea2[_0x37b7('0x3e')][_0x37b7('0x4c')]+'%'};return _0x31c839;})});}_0x1e819d=_[_0x37b7('0x4d')]({},_0x1e819d,_0x270ea2['options']);return _0x4f333e[_0x37b7('0x9e')](_0x1e819d);}})[_0x37b7('0x1e')](function(_0x1f816f){if(_0x1f816f){_0x17b302=_0x1f816f[_0x37b7('0x44')];if(!_0x270ea2['query'][_0x37b7('0x45')]('nolimit')){_0x1e819d[_0x37b7('0x2c')]=qs[_0x37b7('0x2c')](_0x270ea2[_0x37b7('0x3e')][_0x37b7('0x2c')]);_0x1e819d[_0x37b7('0x2a')]=qs['offset'](_0x270ea2['query'][_0x37b7('0x2a')]);}return _0x4f333e['getApplications'](_0x1e819d);}})[_0x37b7('0x1e')](function(_0x38f630){if(_0x38f630){return _0x38f630?{'count':_0x17b302,'rows':_0x38f630}:null;}})[_0x37b7('0x1e')](respondWithResult(_0x463b16,null))[_0x37b7('0x26')](handleError(_0x463b16,null));};exports[_0x37b7('0x9f')]=function(_0xcf4ae9,_0x56926a,_0xeba09c){var _0x2fcbcb={'raw':![],'where':{}};var _0x22253e={};var _0x1cc8c7={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xcf4ae9[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x56926a,null))[_0x37b7('0x1e')](function(_0x543083){if(_0x543083){_0x22253e[_0x37b7('0x42')]=_['keys'](db['OpenchannelInteraction'][_0x37b7('0x3a')]);_0x22253e[_0x37b7('0x3e')]=_[_0x37b7('0x3f')](_0xcf4ae9[_0x37b7('0x3e')]);_0x22253e[_0x37b7('0x4a')]=_[_0x37b7('0x40')](_0x22253e[_0x37b7('0x42')],_0x22253e[_0x37b7('0x3e')]);_0x2fcbcb['attributes']=_[_0x37b7('0x40')](_0x22253e[_0x37b7('0x42')],qs['fields'](_0xcf4ae9[_0x37b7('0x3e')]['fields']));_0x2fcbcb[_0x37b7('0x41')]=_0x2fcbcb['attributes'][_0x37b7('0x44')]?_0x2fcbcb['attributes']:_0x22253e[_0x37b7('0x42')];if(!_0xcf4ae9[_0x37b7('0x3e')][_0x37b7('0x45')](_0x37b7('0x46'))){_0x2fcbcb['limit']=qs[_0x37b7('0x2c')](_0xcf4ae9[_0x37b7('0x3e')][_0x37b7('0x2c')]);_0x2fcbcb[_0x37b7('0x2a')]=qs[_0x37b7('0x2a')](_0xcf4ae9[_0x37b7('0x3e')]['offset']);}_0x2fcbcb['order']=qs['sort'](_0xcf4ae9[_0x37b7('0x3e')][_0x37b7('0x48')]);_0x2fcbcb[_0x37b7('0x49')]=qs[_0x37b7('0x4a')](_[_0x37b7('0x4b')](_0xcf4ae9[_0x37b7('0x3e')],_0x22253e[_0x37b7('0x4a')]));_0x2fcbcb[_0x37b7('0x49')][_0x37b7('0x60')]=_0x543083['id'];if(_0xcf4ae9[_0x37b7('0x3e')][_0x37b7('0x4c')]){_0x2fcbcb[_0x37b7('0x49')]=_[_0x37b7('0x4d')](_0x2fcbcb['where'],{'$or':_[_0x37b7('0x38')](_0x2fcbcb[_0x37b7('0x41')],function(_0x12d898){var _0x4ee55c={};_0x4ee55c[_0x12d898]={'$like':'%'+_0xcf4ae9[_0x37b7('0x3e')][_0x37b7('0x4c')]+'%'};return _0x4ee55c;})});}_0x2fcbcb=_[_0x37b7('0x4d')]({},_0x2fcbcb,_0xcf4ae9[_0x37b7('0x4e')]);return db[_0x37b7('0x88')]['count']({'where':_0x2fcbcb[_0x37b7('0x49')]})[_0x37b7('0x1e')](function(_0x1aa56b){_0x1cc8c7[_0x37b7('0x2d')]=_0x1aa56b;if(_0xcf4ae9[_0x37b7('0x3e')]['includeAll']){_0x2fcbcb[_0x37b7('0x50')]=[{'model':db[_0x37b7('0x69')],'as':'Contact','required':![]},{'model':db[_0x37b7('0xa0')],'as':_0x37b7('0xa1'),'attributes':[_0x37b7('0x36'),_0x37b7('0xa2'),_0x37b7('0xa3')],'required':![]},{'model':db[_0x37b7('0xa4')],'as':_0x37b7('0xa5'),'attributes':['id',_0x37b7('0x36'),_0x37b7('0xa6')],'where':_0xcf4ae9[_0x37b7('0x3e')][_0x37b7('0xa7')]?{'id':_0xcf4ae9[_0x37b7('0x3e')][_0x37b7('0xa7')]}:undefined,'required':_0xcf4ae9['query'][_0x37b7('0xa7')]?!![]:![]}];}return db[_0x37b7('0x88')][_0x37b7('0x51')](_0x2fcbcb);})[_0x37b7('0x1e')](function(_0x1c91b0){_0x1cc8c7[_0x37b7('0x52')]=_0x1c91b0;return _0x1cc8c7;});}})[_0x37b7('0x1e')](respondWithFilteredResult(_0x56926a,_0x2fcbcb))[_0x37b7('0x26')](handleError(_0x56926a,null));};exports[_0x37b7('0xa8')]=function(_0x1e8180,_0x390b2a,_0x1bc414){return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x1e8180[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x390b2a,null))[_0x37b7('0x1e')](function(_0x1c4820){if(_0x1c4820){return _0x1c4820[_0x37b7('0xa8')](_0x1e8180[_0x37b7('0x56')]['ids'],_[_0x37b7('0xa9')](_0x1e8180['body'],['ids','id'])||{})[_0x37b7('0xaa')](function(_0x6f9c5){for(var _0x407974=0x0;_0x407974<_0x1e8180['body'][_0x37b7('0x64')][_0x37b7('0x44')];_0x407974+=0x1){socket[_0x37b7('0xab')](_0x37b7('0xac'),{'UserId':Number(_0x1e8180[_0x37b7('0x56')][_0x37b7('0x64')][_0x407974]),'OpenchannelAccountId':Number(_0x1e8180[_0x37b7('0x5d')]['id'])});}return _0x6f9c5;});}})[_0x37b7('0x1e')](respondWithResult(_0x390b2a,null))[_0x37b7('0x26')](handleError(_0x390b2a,null));};exports[_0x37b7('0xad')]=function(_0x308f92,_0x26ac7b,_0x44a6a7){return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x308f92[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x26ac7b,null))[_0x37b7('0x1e')](function(_0x3b2f47){if(_0x3b2f47){return _0x3b2f47[_0x37b7('0xad')](_0x308f92[_0x37b7('0x3e')]['ids'])['then'](function(){if(_[_0x37b7('0xae')](_0x308f92[_0x37b7('0x3e')][_0x37b7('0x64')])){for(var _0x295e80=0x0;_0x295e80<_0x308f92['query']['ids'][_0x37b7('0x44')];_0x295e80+=0x1){socket['emit'](_0x37b7('0xaf'),{'UserId':Number(_0x308f92[_0x37b7('0x3e')]['ids'][_0x295e80]),'OpenchannelAccountId':Number(_0x308f92[_0x37b7('0x5d')]['id'])});}}else{socket['emit'](_0x37b7('0xaf'),{'UserId':Number(_0x308f92[_0x37b7('0x3e')][_0x37b7('0x64')]),'OpenchannelAccountId':Number(_0x308f92[_0x37b7('0x5d')]['id'])});}});}})[_0x37b7('0x1e')](respondWithStatusCode(_0x26ac7b,null))['catch'](handleError(_0x26ac7b,null));};exports['getAgents']=function(_0x2fded0,_0x350660,_0x391a97){var _0xdfe331={};var _0x581562={};var _0x23a6a1;var _0x543b0c;return db[_0x37b7('0x39')]['findOne']({'where':{'id':_0x2fded0[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x350660,null))[_0x37b7('0x1e')](function(_0x126c55){if(_0x126c55){_0x23a6a1=_0x126c55;_0x581562[_0x37b7('0x42')]=_['keys'](db[_0x37b7('0xa0')][_0x37b7('0x3a')]);_0x581562[_0x37b7('0x3e')]=_['keys'](_0x2fded0[_0x37b7('0x3e')]);_0x581562[_0x37b7('0x4a')]=_['intersection'](_0x581562[_0x37b7('0x42')],_0x581562[_0x37b7('0x3e')]);_0xdfe331['attributes']=_[_0x37b7('0x40')](_0x581562[_0x37b7('0x42')],qs[_0x37b7('0x43')](_0x2fded0[_0x37b7('0x3e')][_0x37b7('0x43')]));_0xdfe331['attributes']=_0xdfe331[_0x37b7('0x41')][_0x37b7('0x44')]?_0xdfe331[_0x37b7('0x41')]:_0x581562[_0x37b7('0x42')];_0xdfe331['order']=qs['sort'](_0x2fded0[_0x37b7('0x3e')][_0x37b7('0x48')]);_0xdfe331[_0x37b7('0x49')]=qs[_0x37b7('0x4a')](_[_0x37b7('0x4b')](_0x2fded0[_0x37b7('0x3e')],_0x581562[_0x37b7('0x4a')]));if(_0x2fded0[_0x37b7('0x3e')][_0x37b7('0x4c')]){_0xdfe331[_0x37b7('0x49')]=_[_0x37b7('0x4d')](_0xdfe331['where'],{'$or':_[_0x37b7('0x38')](_0xdfe331[_0x37b7('0x41')],function(_0x1b5ea6){var _0x3a8018={};_0x3a8018[_0x1b5ea6]={'$like':'%'+_0x2fded0[_0x37b7('0x3e')][_0x37b7('0x4c')]+'%'};return _0x3a8018;})});}_0xdfe331=_[_0x37b7('0x4d')]({},_0xdfe331,_0x2fded0[_0x37b7('0x4e')]);return _0x23a6a1[_0x37b7('0xb0')](_0xdfe331);}})['then'](function(_0x155cf6){if(_0x155cf6){_0x543b0c=_0x155cf6[_0x37b7('0x44')];if(!_0x2fded0['query'][_0x37b7('0x45')](_0x37b7('0x46'))){_0xdfe331['limit']=qs[_0x37b7('0x2c')](_0x2fded0['query'][_0x37b7('0x2c')]);_0xdfe331[_0x37b7('0x2a')]=qs['offset'](_0x2fded0['query'][_0x37b7('0x2a')]);}return _0x23a6a1['getAgents'](_0xdfe331);}})[_0x37b7('0x1e')](function(_0x3e4515){if(_0x3e4515){return _0x3e4515?{'count':_0x543b0c,'rows':_0x3e4515}:null;}})[_0x37b7('0x1e')](respondWithResult(_0x350660,null))['catch'](handleError(_0x350660,null));};exports[_0x37b7('0xb1')]=function(_0x371486,_0x3a69d8,_0x5c4ee0){var _0x5f5d74,_0x3198da,_0x27a4d1;if(_[_0x37b7('0x71')](_0x371486['body'][_0x37b7('0x56')])||_0x371486[_0x37b7('0x56')][_0x37b7('0x56')]===''){throw new db[(_0x37b7('0x6a'))][(_0x37b7('0x6b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x371486['body']['to'])){}_0x5f5d74=_0x371486[_0x37b7('0x56')]['to'];return db[_0x37b7('0x39')]['findOne']({'where':{'id':_0x371486[_0x37b7('0x5d')]['id']}})[_0x37b7('0x1e')](handleEntityNotFound(_0x3a69d8,null))['then'](function(_0x22ba0d){if(_0x22ba0d){return db[_0x37b7('0x39')][_0x37b7('0x59')]({'where':{'id':_0x22ba0d['id']},'include':[{'model':db[_0x37b7('0x78')],'as':'List','include':[{'model':db[_0x37b7('0x69')],'as':_0x37b7('0x82'),'where':{[_0x22ba0d[_0x37b7('0x74')]]:_0x5f5d74},'limit':0x1,'order':[[_0x37b7('0x6f'),_0x37b7('0x7a')]]}]}]})[_0x37b7('0x1e')](handleEntityNotFound(_0x3a69d8,null))[_0x37b7('0x1e')](function(_0x16cef8){if(_0x16cef8&&_0x16cef8[_0x37b7('0x79')]){_0x3198da=_0x16cef8[_0x37b7('0x32')]({'plain':!![]});if(_0x3198da[_0x37b7('0x79')]&&_0x3198da[_0x37b7('0x79')]['Contacts'][_0x37b7('0x44')]){return _0x3198da['List'][_0x37b7('0x82')][0x0];}return db[_0x37b7('0x69')][_0x37b7('0x55')](_[_0x37b7('0xb2')](_0x371486[_0x37b7('0x56')],{'firstName':_0x5f5d74,[_0x16cef8[_0x37b7('0x74')]]:_0x5f5d74,'phone':_0x5f5d74,'ListId':_0x3198da['ListId']}));}})[_0x37b7('0x1e')](handleEntityNotFound(_0x3a69d8,null))[_0x37b7('0x1e')](function(_0x5ef546){if(_0x5ef546){_0x27a4d1=_0x5ef546;return db['OpenchannelInteraction'][_0x37b7('0x59')]({'where':{'ContactId':_0x27a4d1['id'],'closed':![],'OpenchannelAccountId':_0x3198da['id']}})[_0x37b7('0x1e')](function(_0x216ab1){if(_0x216ab1){return[_0x216ab1,![]];}return db[_0x37b7('0x88')]['create']({'UserId':_0x371486[_0x37b7('0xb3')]['id'],'ContactId':_0x27a4d1['id'],'OpenchannelAccountId':_0x3198da['id'],'lastMsgDirection':_0x37b7('0xb4'),'Messages':[_[_0x37b7('0x4d')](_0x371486[_0x37b7('0x56')],{'read':![],'body':_0x371486[_0x37b7('0x56')][_0x37b7('0x56')],'OpenchannelAccountId':_0x3198da['id'],'UserId':_0x371486[_0x37b7('0xb3')]['id'],'ContactId':_0x27a4d1['id']})]},{'include':[{'model':db[_0x37b7('0xb5')],'as':_0x37b7('0xb6')}]})['then'](function(_0x75af7c){return[_0x75af7c,!![]];});});}})[_0x37b7('0xaa')](function(_0x5621aa,_0x47813a){if(_0x47813a){return _0x5621aa;}return db[_0x37b7('0xb5')][_0x37b7('0x55')](_[_0x37b7('0x4d')](_0x371486[_0x37b7('0x56')],{'read':![],'body':_0x371486[_0x37b7('0x56')][_0x37b7('0x56')],'OpenchannelAccountId':_0x3198da['id'],'OpenchannelInteractionId':_0x5621aa['id'],'UserId':_0x371486[_0x37b7('0xb3')]['id'],'ContactId':_0x27a4d1['id']}))[_0x37b7('0x1e')](function(_0x5dbfed){_0x5621aa[_0x37b7('0xb7')]['Messages']=[];_0x5621aa[_0x37b7('0xb7')][_0x37b7('0xb6')][_0x37b7('0x8e')](_0x5dbfed['dataValues']);return _0x5621aa;});});}})[_0x37b7('0x1e')](respondWithResult(_0x3a69d8,null))[_0x37b7('0x26')](handleError(_0x3a69d8,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7647c40..1d533df 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 _0x22fb=['hook','exports','OpenchannelAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x22fb,0x192));var _0xb22f=function(_0x14bf7d,_0x17db98){_0x14bf7d=_0x14bf7d-0x0;var _0x198597=_0x22fb[_0x14bf7d];return _0x198597;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xb22f('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb22f('0x1'),'afterUpdate':_0xb22f('0x2'),'afterDestroy':_0xb22f('0x3')};function emitEvent(_0x10d2c4){return function(_0x201512,_0x50cdab,_0x44717d){OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4+':'+_0x201512['id'],_0x201512);OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4,_0x201512);_0x44717d(null);};}for(var e in events){if(events[_0xb22f('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb22f('0x6')](e,emitEvent(event));}}module[_0xb22f('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6e6c=['../../mysqldb','setMaxListeners','save','emit','hook','exports','events'];(function(_0x11ad37,_0x34581){var _0x297f25=function(_0x30874b){while(--_0x30874b){_0x11ad37['push'](_0x11ad37['shift']());}};_0x297f25(++_0x34581);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var OpenchannelAccount=require(_0xc6e6('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc6e6('0x2')](0x0);var events={'afterCreate':_0xc6e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e97f5){return function(_0x5a9e2b,_0x40b7e1,_0x4b13f0){OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5+':'+_0x5a9e2b['id'],_0x5a9e2b);OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5,_0x5a9e2b);_0x4b13f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc6e6('0x5')](e,emitEvent(event));}}module[_0xc6e6('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e208817..0ea0a79 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(_0xeb3c11,_0x5b85af){var _0xf4f5ca=function(_0x2fd689){while(--_0x2fd689){_0xeb3c11['push'](_0xeb3c11['shift']());}};_0xf4f5ca(++_0x5b85af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x16b8a2,_0x3927f4){var _0x27de18=function(_0x208dee){while(--_0x208dee){_0x16b8a2['push'](_0x16b8a2['shift']());}};_0x27de18(++_0x3927f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 01dd761..e9ec94d 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 _0x8f59=['redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8f59,0x11d));var _0x98f5=function(_0x31c402,_0x24f479){_0x31c402=_0x31c402-0x0;var _0x59e2a4=_0x8f59[_0x31c402];return _0x59e2a4;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});config[_0x98f5('0xc')]=_['defaults'](config['redis'],{'host':_0x98f5('0xd'),'port':0x18eb});var socket=require(_0x98f5('0xe'))(new Redis(config[_0x98f5('0xc')]));require('./openchannelAccount.socket')[_0x98f5('0xf')](socket);function respondWithRpcPromise(_0x31b669,_0x227cf3,_0x39e85d){return new BPromise(function(_0x4c4abc,_0x26a0fc){return client['request'](_0x31b669,_0x39e85d)['then'](function(_0x3cf4b2){logger[_0x98f5('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x227cf3,_0x98f5('0x11'));logger[_0x98f5('0x12')](_0x98f5('0x13'),_0x227cf3,_0x98f5('0x11'),JSON[_0x98f5('0x14')](_0x3cf4b2));if(_0x3cf4b2[_0x98f5('0x15')]){if(_0x3cf4b2['error'][_0x98f5('0x16')]===0x1f4){logger[_0x98f5('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x227cf3,_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);return _0x26a0fc(_0x3cf4b2[_0x98f5('0x15')]['message']);}logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x3cf4b2[_0x98f5('0x15')]['message']);return _0x4c4abc(_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);}else{logger['info'](_0x98f5('0x18'),_0x227cf3,'request\x20sent');_0x4c4abc(_0x3cf4b2[_0x98f5('0x19')][_0x98f5('0x17')]);}})[_0x98f5('0x1a')](function(_0x11b6d4){logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x11b6d4);_0x26a0fc(_0x11b6d4);});});} \ No newline at end of file +var _0x26f9=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa054f,_0x1f4a18){var _0x11b0b6=function(_0x1c4dc5){while(--_0x1c4dc5){_0xa054f['push'](_0xa054f['shift']());}};_0x11b0b6(++_0x1f4a18);}(_0x26f9,0x16f));var _0x926f=function(_0x256011,_0x28bb88){_0x256011=_0x256011-0x0;var _0xcb704f=_0x26f9[_0x256011];return _0xcb704f;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var moment=require('moment');var BPromise=require(_0x926f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x926f('0x3'))['db'];var utils=require(_0x926f('0x4'));var logger=require('../../config/logger')(_0x926f('0x5'));var config=require(_0x926f('0x6'));var jayson=require(_0x926f('0x7'));var client=jayson[_0x926f('0x8')][_0x926f('0x9')]({'port':0x232a});config[_0x926f('0xa')]=_[_0x926f('0xb')](config[_0x926f('0xa')],{'host':_0x926f('0xc'),'port':0x18eb});var socket=require(_0x926f('0xd'))(new Redis(config['redis']));require(_0x926f('0xe'))['register'](socket);function respondWithRpcPromise(_0x12fbd4,_0x43cd93,_0x4f7d2c){return new BPromise(function(_0x3d3802,_0x2ae81c){return client[_0x926f('0xf')](_0x12fbd4,_0x4f7d2c)[_0x926f('0x10')](function(_0x13ef84){logger['info'](_0x926f('0x11'),_0x43cd93,_0x926f('0x12'));logger[_0x926f('0x13')](_0x926f('0x14'),_0x43cd93,_0x926f('0x12'),JSON[_0x926f('0x15')](_0x13ef84));if(_0x13ef84[_0x926f('0x16')]){if(_0x13ef84['error']['code']===0x1f4){logger['error'](_0x926f('0x11'),_0x43cd93,_0x13ef84[_0x926f('0x16')][_0x926f('0x17')]);return _0x2ae81c(_0x13ef84[_0x926f('0x16')]['message']);}logger[_0x926f('0x16')](_0x926f('0x11'),_0x43cd93,_0x13ef84['error'][_0x926f('0x17')]);return _0x3d3802(_0x13ef84['error'][_0x926f('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x43cd93,_0x926f('0x12'));_0x3d3802(_0x13ef84[_0x926f('0x18')]['message']);}})[_0x926f('0x19')](function(_0x386498){logger[_0x926f('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x43cd93,_0x386498);_0x2ae81c(_0x386498);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ebef46c..dd44376 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 _0xcfac=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcfac,0x105));var _0xccfa=function(_0x16d19a,_0x1e3eb4){_0x16d19a=_0x16d19a-0x0;var _0x33df18=_0xcfac[_0x16d19a];return _0x33df18;};'use strict';var OpenchannelAccountEvents=require(_0xccfa('0x0'));var events=[_0xccfa('0x1'),_0xccfa('0x2'),_0xccfa('0x3')];function createListener(_0x450800,_0x176421){return function(_0x1c58a9){_0x176421[_0xccfa('0x4')](_0x450800,_0x1c58a9);};}function removeListener(_0x156017,_0x49da36){return function(){OpenchannelAccountEvents[_0xccfa('0x5')](_0x156017,_0x49da36);};}exports[_0xccfa('0x6')]=function(_0x2d2ddf){for(var _0x1ba378=0x0,_0x1529e7=events[_0xccfa('0x7')];_0x1ba378<_0x1529e7;_0x1ba378++){var _0x2cc52a=events[_0x1ba378];var _0x5c5f2f=createListener(_0xccfa('0x8')+_0x2cc52a,_0x2d2ddf);OpenchannelAccountEvents['on'](_0x2cc52a,_0x5c5f2f);}}; \ No newline at end of file +var _0x6931=['./openchannelAccount.events','save','removeListener','length','openchannelAccount:'];(function(_0x470ee7,_0x53a8ce){var _0x47ae4d=function(_0x5edb6a){while(--_0x5edb6a){_0x470ee7['push'](_0x470ee7['shift']());}};_0x47ae4d(++_0x53a8ce);}(_0x6931,0xa5));var _0x1693=function(_0x17759f,_0x53c79f){_0x17759f=_0x17759f-0x0;var _0x47de3a=_0x6931[_0x17759f];return _0x47de3a;};'use strict';var OpenchannelAccountEvents=require(_0x1693('0x0'));var events=[_0x1693('0x1'),'remove','update'];function createListener(_0x7828b9,_0x190052){return function(_0x37c53b){_0x190052['emit'](_0x7828b9,_0x37c53b);};}function removeListener(_0x1c8ac6,_0x3ea966){return function(){OpenchannelAccountEvents[_0x1693('0x2')](_0x1c8ac6,_0x3ea966);};}exports['register']=function(_0x361381){for(var _0x4bd166=0x0,_0x3594e0=events[_0x1693('0x3')];_0x4bd166<_0x3594e0;_0x4bd166++){var _0x328cfc=events[_0x4bd166];var _0x2ab0a0=createListener(_0x1693('0x4')+_0x328cfc,_0x361381);OpenchannelAccountEvents['on'](_0x328cfc,_0x2ab0a0);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9c71db6..d4a2646 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 _0x3fe9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','put','update','delete','exports','util','path'];(function(_0x39d2a7,_0x336009){var _0x2f577c=function(_0x3b6dab){while(--_0x3b6dab){_0x39d2a7['push'](_0x39d2a7['shift']());}};_0x2f577c(++_0x336009);}(_0x3fe9,0x6a));var _0x93fe=function(_0x2add0b,_0x3d338d){_0x2add0b=_0x2add0b-0x0;var _0x5f3158=_0x3fe9[_0x2add0b];return _0x5f3158;};'use strict';var multer=require('multer');var util=require(_0x93fe('0x0'));var path=require(_0x93fe('0x1'));var timeout=require(_0x93fe('0x2'));var express=require(_0x93fe('0x3'));var router=express[_0x93fe('0x4')]();var fs_extra=require(_0x93fe('0x5'));var auth=require(_0x93fe('0x6'));var interaction=require(_0x93fe('0x7'));var config=require(_0x93fe('0x8'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x93fe('0x9')](),controller[_0x93fe('0xa')]);router[_0x93fe('0xb')](_0x93fe('0xc'),auth[_0x93fe('0x9')](),controller['show']);router[_0x93fe('0xd')]('/',auth[_0x93fe('0x9')](),controller['create']);router[_0x93fe('0xe')]('/:id',auth[_0x93fe('0x9')](),controller[_0x93fe('0xf')]);router[_0x93fe('0x10')](_0x93fe('0xc'),auth[_0x93fe('0x9')](),controller['destroy']);module[_0x93fe('0x11')]=router; \ No newline at end of file +var _0x32d2=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32d2,0x169));var _0x232d=function(_0x18e030,_0x25bc51){_0x18e030=_0x18e030-0x0;var _0x412a47=_0x32d2[_0x18e030];return _0x412a47;};'use strict';var multer=require(_0x232d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x232d('0x1'));var express=require(_0x232d('0x2'));var router=express[_0x232d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x232d('0x4'));var interaction=require(_0x232d('0x5'));var config=require(_0x232d('0x6'));var controller=require(_0x232d('0x7'));router['get']('/',auth[_0x232d('0x8')](),controller[_0x232d('0x9')]);router[_0x232d('0xa')](_0x232d('0xb'),auth[_0x232d('0x8')](),controller[_0x232d('0xc')]);router[_0x232d('0xd')]('/',auth[_0x232d('0x8')](),controller[_0x232d('0xe')]);router[_0x232d('0xf')](_0x232d('0xb'),auth[_0x232d('0x8')](),controller[_0x232d('0x10')]);router[_0x232d('0x11')]('/:id',auth[_0x232d('0x8')](),controller[_0x232d('0x12')]);module[_0x232d('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 69a1fe9..d06aa81 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 _0x203a=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x15b9e4,_0x3adcb4){var _0x567840=function(_0x309c6a){while(--_0x309c6a){_0x15b9e4['push'](_0x15b9e4['shift']());}};_0x567840(++_0x3adcb4);}(_0x203a,0xdd));var _0xa203=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x203a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa203('0x0'));module[_0xa203('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa203('0x2')],'allowNull':![],'defaultValue':_0xa203('0x3')},'appdata':{'type':Sequelize[_0xa203('0x4')]()},'description':{'type':Sequelize[_0xa203('0x2')]},'interval':{'type':Sequelize[_0xa203('0x2')],'defaultValue':_0xa203('0x5')}}; \ No newline at end of file +var _0x3ee4=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3ee4,0x143));var _0x43ee=function(_0xd50818,_0x148968){_0xd50818=_0xd50818-0x0;var _0x376e53=_0x3ee4[_0xd50818];return _0x376e53;};'use strict';var Sequelize=require(_0x43ee('0x0'));module[_0x43ee('0x1')]={'priority':{'type':Sequelize[_0x43ee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x43ee('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x43ee('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x43ee('0x3')],'defaultValue':_0x43ee('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c899257..0daa4ea 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 _0xcda4=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','rows','show','params','model','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4f8a7b,_0x4f9ea9){var _0x525fd3=function(_0x101c79){while(--_0x101c79){_0x4f8a7b['push'](_0x4f8a7b['shift']());}};_0x525fd3(++_0x4f9ea9);}(_0xcda4,0x1ef));var _0x4cda=function(_0x4f3c18,_0x5c4939){_0x4f3c18=_0x4f3c18-0x0;var _0x3af9a8=_0xcda4[_0x4f3c18];return _0x3af9a8;};'use strict';var emlformat=require(_0x4cda('0x0'));var rimraf=require(_0x4cda('0x1'));var zipdir=require(_0x4cda('0x2'));var jsonpatch=require(_0x4cda('0x3'));var rp=require(_0x4cda('0x4'));var moment=require(_0x4cda('0x5'));var BPromise=require(_0x4cda('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4cda('0x7'));var sox=require(_0x4cda('0x8'));var csv=require(_0x4cda('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cda('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4cda('0xb'));var deskjs=require(_0x4cda('0xc'));var toCsv=require(_0x4cda('0x9'));var querystring=require(_0x4cda('0xd'));var Papa=require(_0x4cda('0xe'));var Redis=require(_0x4cda('0xf'));var authService=require(_0x4cda('0x10'));var qs=require(_0x4cda('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4cda('0x12'));var logger=require(_0x4cda('0x13'))('api');var utils=require(_0x4cda('0x14'));var config=require(_0x4cda('0x15'));var licenseUtil=require(_0x4cda('0x16'));var db=require(_0x4cda('0x17'))['db'];function respondWithStatusCode(_0x12d083,_0x4f4fd2){_0x4f4fd2=_0x4f4fd2||0xcc;return function(_0x29c03b){if(_0x29c03b){return _0x12d083[_0x4cda('0x18')](_0x4f4fd2);}return _0x12d083[_0x4cda('0x19')](_0x4f4fd2)[_0x4cda('0x1a')]();};}function respondWithResult(_0x5cf510,_0x533f1f){_0x533f1f=_0x533f1f||0xc8;return function(_0x3d249f){if(_0x3d249f){return _0x5cf510[_0x4cda('0x19')](_0x533f1f)[_0x4cda('0x1b')](_0x3d249f);}};}function respondWithFilteredResult(_0x452f38,_0x59450b){return function(_0x3d334a){if(_0x3d334a){var _0x3f4ba1=typeof _0x59450b['offset']===_0x4cda('0x1c')&&typeof _0x59450b[_0x4cda('0x1d')]===_0x4cda('0x1c');var _0x1ff296=_0x3d334a['count'];var _0x4c2964=_0x3f4ba1?0x0:_0x59450b[_0x4cda('0x1e')];var _0x272afc=_0x3f4ba1?_0x3d334a[_0x4cda('0x1f')]:_0x59450b['offset']+_0x59450b[_0x4cda('0x1d')];var _0x71c485;if(_0x272afc>=_0x1ff296){_0x272afc=_0x1ff296;_0x71c485=0xc8;}else{_0x71c485=0xce;}_0x452f38[_0x4cda('0x19')](_0x71c485);return _0x452f38[_0x4cda('0x20')](_0x4cda('0x21'),_0x4c2964+'-'+_0x272afc+'/'+_0x1ff296)[_0x4cda('0x1b')](_0x3d334a);}return null;};}function patchUpdates(_0x29070a){return function(_0xf1ab81){try{jsonpatch[_0x4cda('0x22')](_0xf1ab81,_0x29070a,!![]);}catch(_0x4c8a65){return BPromise[_0x4cda('0x23')](_0x4c8a65);}return _0xf1ab81[_0x4cda('0x24')]();};}function saveUpdates(_0x34e3ea,_0x408700){return function(_0x4ff84a){if(_0x4ff84a){return _0x4ff84a[_0x4cda('0x25')](_0x34e3ea)[_0x4cda('0x26')](function(_0x1bbfb9){return _0x1bbfb9;});}return null;};}function removeEntity(_0x4a0e4e,_0x270b57){return function(_0x1a3030){if(_0x1a3030){return _0x1a3030[_0x4cda('0x27')]()[_0x4cda('0x26')](function(){_0x4a0e4e[_0x4cda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37eabb,_0x1a8bda){return function(_0x2fbb62){if(!_0x2fbb62){_0x37eabb[_0x4cda('0x18')](0x194);}return _0x2fbb62;};}function handleError(_0x1684db,_0x53bf68){_0x53bf68=_0x53bf68||0x1f4;return function(_0x30ec6d){logger[_0x4cda('0x28')](_0x30ec6d[_0x4cda('0x29')]);if(_0x30ec6d['name']){delete _0x30ec6d['name'];}_0x1684db[_0x4cda('0x19')](_0x53bf68)[_0x4cda('0x2a')](_0x30ec6d);};}exports[_0x4cda('0x2b')]=function(_0x4b3fc0,_0x3611fe){var _0x44046e={},_0x3aa9ea={},_0x49551c={'count':0x0,'rows':[]};var _0x91c59d=_[_0x4cda('0x2c')](db['OpenchannelApplication'][_0x4cda('0x2d')],function(_0x1940a7){return{'name':_0x1940a7[_0x4cda('0x2e')],'type':_0x1940a7[_0x4cda('0x2f')][_0x4cda('0x30')]};});_0x3aa9ea['model']=_[_0x4cda('0x2c')](_0x91c59d,_0x4cda('0x31'));_0x3aa9ea[_0x4cda('0x32')]=_[_0x4cda('0x33')](_0x4b3fc0[_0x4cda('0x32')]);_0x3aa9ea[_0x4cda('0x34')]=_[_0x4cda('0x35')](_0x3aa9ea['model'],_0x3aa9ea['query']);_0x44046e[_0x4cda('0x36')]=_['intersection'](_0x3aa9ea['model'],qs[_0x4cda('0x37')](_0x4b3fc0[_0x4cda('0x32')][_0x4cda('0x37')]));_0x44046e[_0x4cda('0x36')]=_0x44046e[_0x4cda('0x36')][_0x4cda('0x38')]?_0x44046e[_0x4cda('0x36')]:_0x3aa9ea['model'];if(!_0x4b3fc0['query'][_0x4cda('0x39')](_0x4cda('0x3a'))){_0x44046e[_0x4cda('0x1d')]=qs['limit'](_0x4b3fc0['query'][_0x4cda('0x1d')]);_0x44046e[_0x4cda('0x1e')]=qs['offset'](_0x4b3fc0[_0x4cda('0x32')]['offset']);}_0x44046e[_0x4cda('0x3b')]=qs['sort'](_0x4b3fc0[_0x4cda('0x32')][_0x4cda('0x3c')]);_0x44046e[_0x4cda('0x3d')]=qs[_0x4cda('0x34')](_[_0x4cda('0x3e')](_0x4b3fc0[_0x4cda('0x32')],_0x3aa9ea[_0x4cda('0x34')]),_0x91c59d);if(_0x4b3fc0[_0x4cda('0x32')][_0x4cda('0x3f')]){_0x44046e[_0x4cda('0x3d')]=_[_0x4cda('0x40')](_0x44046e[_0x4cda('0x3d')],{'$or':_[_0x4cda('0x2c')](_0x91c59d,function(_0x374283){if(_0x374283['type']!==_0x4cda('0x41')){var _0x3ac4ac={};_0x3ac4ac[_0x374283[_0x4cda('0x31')]]={'$like':'%'+_0x4b3fc0[_0x4cda('0x32')][_0x4cda('0x3f')]+'%'};return _0x3ac4ac;}})});}_0x44046e=_['merge']({},_0x44046e,_0x4b3fc0[_0x4cda('0x42')]);var _0x28f7b5={'where':_0x44046e[_0x4cda('0x3d')]};return db[_0x4cda('0x43')]['count'](_0x28f7b5)[_0x4cda('0x26')](function(_0x3859f8){_0x49551c[_0x4cda('0x1f')]=_0x3859f8;if(_0x4b3fc0[_0x4cda('0x32')][_0x4cda('0x44')]){_0x44046e[_0x4cda('0x45')]=[{'all':!![]}];}return db[_0x4cda('0x43')][_0x4cda('0x46')](_0x44046e);})[_0x4cda('0x26')](function(_0xabe35c){_0x49551c[_0x4cda('0x47')]=_0xabe35c;return _0x49551c;})[_0x4cda('0x26')](respondWithFilteredResult(_0x3611fe,_0x44046e))['catch'](handleError(_0x3611fe,null));};exports[_0x4cda('0x48')]=function(_0x2b6b1d,_0x26872e){var _0x543fa9={'raw':!![],'where':{'id':_0x2b6b1d[_0x4cda('0x49')]['id']}},_0x29c1fd={};_0x29c1fd['model']=_[_0x4cda('0x33')](db[_0x4cda('0x43')][_0x4cda('0x2d')]);_0x29c1fd[_0x4cda('0x32')]=_['keys'](_0x2b6b1d[_0x4cda('0x32')]);_0x29c1fd[_0x4cda('0x34')]=_['intersection'](_0x29c1fd[_0x4cda('0x4a')],_0x29c1fd[_0x4cda('0x32')]);_0x543fa9['attributes']=_[_0x4cda('0x35')](_0x29c1fd[_0x4cda('0x4a')],qs[_0x4cda('0x37')](_0x2b6b1d[_0x4cda('0x32')][_0x4cda('0x37')]));_0x543fa9[_0x4cda('0x36')]=_0x543fa9[_0x4cda('0x36')]['length']?_0x543fa9['attributes']:_0x29c1fd[_0x4cda('0x4a')];if(_0x2b6b1d[_0x4cda('0x32')]['includeAll']){_0x543fa9[_0x4cda('0x45')]=[{'all':!![]}];}_0x543fa9=_[_0x4cda('0x40')]({},_0x543fa9,_0x2b6b1d[_0x4cda('0x42')]);return db[_0x4cda('0x43')][_0x4cda('0x4b')](_0x543fa9)[_0x4cda('0x26')](handleEntityNotFound(_0x26872e,null))[_0x4cda('0x26')](respondWithResult(_0x26872e,null))[_0x4cda('0x4c')](handleError(_0x26872e,null));};exports[_0x4cda('0x4d')]=function(_0x22035b,_0x34c5e5){return db['OpenchannelApplication'][_0x4cda('0x4d')](_0x22035b[_0x4cda('0x4e')],{})[_0x4cda('0x26')](respondWithResult(_0x34c5e5,0xc9))[_0x4cda('0x4c')](handleError(_0x34c5e5,null));};exports[_0x4cda('0x25')]=function(_0x270d71,_0x1dc618){if(_0x270d71[_0x4cda('0x4e')]['id']){delete _0x270d71['body']['id'];}return db[_0x4cda('0x43')]['find']({'where':{'id':_0x270d71[_0x4cda('0x49')]['id']}})[_0x4cda('0x26')](handleEntityNotFound(_0x1dc618,null))[_0x4cda('0x26')](saveUpdates(_0x270d71[_0x4cda('0x4e')],null))[_0x4cda('0x26')](respondWithResult(_0x1dc618,null))[_0x4cda('0x4c')](handleError(_0x1dc618,null));};exports[_0x4cda('0x27')]=function(_0xfb277c,_0x35a1ac){return db[_0x4cda('0x43')][_0x4cda('0x4b')]({'where':{'id':_0xfb277c['params']['id']}})['then'](handleEntityNotFound(_0x35a1ac,null))['then'](removeEntity(_0x35a1ac,null))[_0x4cda('0x4c')](handleError(_0x35a1ac,null));}; \ No newline at end of file +var _0x82dc=['map','OpenchannelApplication','fieldName','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index'];(function(_0x35e54a,_0x46953a){var _0x35c2b0=function(_0x3c0ab9){while(--_0x3c0ab9){_0x35e54a['push'](_0x35e54a['shift']());}};_0x35c2b0(++_0x46953a);}(_0x82dc,0x13c));var _0xc82d=function(_0xe1f8d9,_0x32b5c8){_0xe1f8d9=_0xe1f8d9-0x0;var _0x311bd8=_0x82dc[_0xe1f8d9];return _0x311bd8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc82d('0x0'));var zipdir=require(_0xc82d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc82d('0x2'));var util=require('util');var path=require(_0xc82d('0x3'));var sox=require(_0xc82d('0x4'));var csv=require(_0xc82d('0x5'));var ejs=require(_0xc82d('0x6'));var fs=require('fs');var fs_extra=require(_0xc82d('0x7'));var _=require('lodash');var squel=require(_0xc82d('0x8'));var crypto=require(_0xc82d('0x9'));var jsforce=require(_0xc82d('0xa'));var deskjs=require(_0xc82d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc82d('0xc'));var Papa=require(_0xc82d('0xd'));var Redis=require(_0xc82d('0xe'));var authService=require(_0xc82d('0xf'));var qs=require(_0xc82d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc82d('0x11'));var logger=require(_0xc82d('0x12'))(_0xc82d('0x13'));var utils=require(_0xc82d('0x14'));var config=require(_0xc82d('0x15'));var licenseUtil=require(_0xc82d('0x16'));var db=require(_0xc82d('0x17'))['db'];function respondWithStatusCode(_0x62dbf9,_0x43d12d){_0x43d12d=_0x43d12d||0xcc;return function(_0x1c3fd7){if(_0x1c3fd7){return _0x62dbf9[_0xc82d('0x18')](_0x43d12d);}return _0x62dbf9['status'](_0x43d12d)['end']();};}function respondWithResult(_0x95d739,_0x789c5c){_0x789c5c=_0x789c5c||0xc8;return function(_0x35a07d){if(_0x35a07d){return _0x95d739['status'](_0x789c5c)[_0xc82d('0x19')](_0x35a07d);}};}function respondWithFilteredResult(_0x51507e,_0x1584b5){return function(_0x411399){if(_0x411399){var _0x2e98dc=typeof _0x1584b5['offset']==='undefined'&&typeof _0x1584b5['limit']===_0xc82d('0x1a');var _0x521e58=_0x411399[_0xc82d('0x1b')];var _0x4e5b7c=_0x2e98dc?0x0:_0x1584b5['offset'];var _0x2840f3=_0x2e98dc?_0x411399[_0xc82d('0x1b')]:_0x1584b5[_0xc82d('0x1c')]+_0x1584b5[_0xc82d('0x1d')];var _0x422ff8;if(_0x2840f3>=_0x521e58){_0x2840f3=_0x521e58;_0x422ff8=0xc8;}else{_0x422ff8=0xce;}_0x51507e[_0xc82d('0x1e')](_0x422ff8);return _0x51507e[_0xc82d('0x1f')](_0xc82d('0x20'),_0x4e5b7c+'-'+_0x2840f3+'/'+_0x521e58)[_0xc82d('0x19')](_0x411399);}return null;};}function patchUpdates(_0x52ea56){return function(_0x5a4dfa){try{jsonpatch[_0xc82d('0x21')](_0x5a4dfa,_0x52ea56,!![]);}catch(_0x39bd64){return BPromise[_0xc82d('0x22')](_0x39bd64);}return _0x5a4dfa[_0xc82d('0x23')]();};}function saveUpdates(_0x5172c7,_0x476536){return function(_0x5ac18d){if(_0x5ac18d){return _0x5ac18d[_0xc82d('0x24')](_0x5172c7)['then'](function(_0x24e4af){return _0x24e4af;});}return null;};}function removeEntity(_0xc48e86,_0x152ba1){return function(_0x5edd14){if(_0x5edd14){return _0x5edd14[_0xc82d('0x25')]()[_0xc82d('0x26')](function(){_0xc48e86[_0xc82d('0x1e')](0xcc)[_0xc82d('0x27')]();});}};}function handleEntityNotFound(_0xaa61a8,_0xbcb422){return function(_0xaf49ef){if(!_0xaf49ef){_0xaa61a8['sendStatus'](0x194);}return _0xaf49ef;};}function handleError(_0x2833ab,_0x1043b3){_0x1043b3=_0x1043b3||0x1f4;return function(_0x161881){logger[_0xc82d('0x28')](_0x161881['stack']);if(_0x161881[_0xc82d('0x29')]){delete _0x161881['name'];}_0x2833ab['status'](_0x1043b3)[_0xc82d('0x2a')](_0x161881);};}exports[_0xc82d('0x2b')]=function(_0x5ad71e,_0xc1b0e9){var _0x2aed6={},_0x14dff9={},_0x51eed7={'count':0x0,'rows':[]};var _0x1d5b54=_[_0xc82d('0x2c')](db[_0xc82d('0x2d')]['rawAttributes'],function(_0x2e1a1d){return{'name':_0x2e1a1d[_0xc82d('0x2e')],'type':_0x2e1a1d['type']['key']};});_0x14dff9['model']=_['map'](_0x1d5b54,_0xc82d('0x29'));_0x14dff9[_0xc82d('0x2f')]=_[_0xc82d('0x30')](_0x5ad71e[_0xc82d('0x2f')]);_0x14dff9[_0xc82d('0x31')]=_[_0xc82d('0x32')](_0x14dff9['model'],_0x14dff9[_0xc82d('0x2f')]);_0x2aed6[_0xc82d('0x33')]=_[_0xc82d('0x32')](_0x14dff9[_0xc82d('0x34')],qs['fields'](_0x5ad71e[_0xc82d('0x2f')][_0xc82d('0x35')]));_0x2aed6['attributes']=_0x2aed6[_0xc82d('0x33')]['length']?_0x2aed6[_0xc82d('0x33')]:_0x14dff9[_0xc82d('0x34')];if(!_0x5ad71e[_0xc82d('0x2f')]['hasOwnProperty'](_0xc82d('0x36'))){_0x2aed6[_0xc82d('0x1d')]=qs[_0xc82d('0x1d')](_0x5ad71e[_0xc82d('0x2f')]['limit']);_0x2aed6[_0xc82d('0x1c')]=qs[_0xc82d('0x1c')](_0x5ad71e[_0xc82d('0x2f')]['offset']);}_0x2aed6['order']=qs[_0xc82d('0x37')](_0x5ad71e['query'][_0xc82d('0x37')]);_0x2aed6[_0xc82d('0x38')]=qs['filters'](_[_0xc82d('0x39')](_0x5ad71e['query'],_0x14dff9[_0xc82d('0x31')]),_0x1d5b54);if(_0x5ad71e[_0xc82d('0x2f')][_0xc82d('0x3a')]){_0x2aed6['where']=_['merge'](_0x2aed6[_0xc82d('0x38')],{'$or':_['map'](_0x1d5b54,function(_0x1e0c31){if(_0x1e0c31[_0xc82d('0x3b')]!==_0xc82d('0x3c')){var _0xaf9eff={};_0xaf9eff[_0x1e0c31[_0xc82d('0x29')]]={'$like':'%'+_0x5ad71e[_0xc82d('0x2f')][_0xc82d('0x3a')]+'%'};return _0xaf9eff;}})});}_0x2aed6=_[_0xc82d('0x3d')]({},_0x2aed6,_0x5ad71e['options']);var _0x3a67a4={'where':_0x2aed6['where']};return db[_0xc82d('0x2d')][_0xc82d('0x1b')](_0x3a67a4)[_0xc82d('0x26')](function(_0x65e7f3){_0x51eed7[_0xc82d('0x1b')]=_0x65e7f3;if(_0x5ad71e[_0xc82d('0x2f')][_0xc82d('0x3e')]){_0x2aed6[_0xc82d('0x3f')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xc82d('0x40')](_0x2aed6);})['then'](function(_0x39457f){_0x51eed7['rows']=_0x39457f;return _0x51eed7;})[_0xc82d('0x26')](respondWithFilteredResult(_0xc1b0e9,_0x2aed6))[_0xc82d('0x41')](handleError(_0xc1b0e9,null));};exports[_0xc82d('0x42')]=function(_0x2d6f0b,_0x366e78){var _0x1f4f35={'raw':!![],'where':{'id':_0x2d6f0b[_0xc82d('0x43')]['id']}},_0x4b83e1={};_0x4b83e1['model']=_[_0xc82d('0x30')](db[_0xc82d('0x2d')][_0xc82d('0x44')]);_0x4b83e1[_0xc82d('0x2f')]=_[_0xc82d('0x30')](_0x2d6f0b['query']);_0x4b83e1['filters']=_[_0xc82d('0x32')](_0x4b83e1[_0xc82d('0x34')],_0x4b83e1[_0xc82d('0x2f')]);_0x1f4f35[_0xc82d('0x33')]=_['intersection'](_0x4b83e1[_0xc82d('0x34')],qs['fields'](_0x2d6f0b[_0xc82d('0x2f')][_0xc82d('0x35')]));_0x1f4f35[_0xc82d('0x33')]=_0x1f4f35[_0xc82d('0x33')]['length']?_0x1f4f35['attributes']:_0x4b83e1[_0xc82d('0x34')];if(_0x2d6f0b[_0xc82d('0x2f')][_0xc82d('0x3e')]){_0x1f4f35[_0xc82d('0x3f')]=[{'all':!![]}];}_0x1f4f35=_[_0xc82d('0x3d')]({},_0x1f4f35,_0x2d6f0b['options']);return db[_0xc82d('0x2d')][_0xc82d('0x45')](_0x1f4f35)[_0xc82d('0x26')](handleEntityNotFound(_0x366e78,null))[_0xc82d('0x26')](respondWithResult(_0x366e78,null))['catch'](handleError(_0x366e78,null));};exports[_0xc82d('0x46')]=function(_0x2d75d2,_0x58d70f){return db[_0xc82d('0x2d')][_0xc82d('0x46')](_0x2d75d2[_0xc82d('0x47')],{})[_0xc82d('0x26')](respondWithResult(_0x58d70f,0xc9))[_0xc82d('0x41')](handleError(_0x58d70f,null));};exports[_0xc82d('0x24')]=function(_0x350d40,_0x479795){if(_0x350d40['body']['id']){delete _0x350d40[_0xc82d('0x47')]['id'];}return db[_0xc82d('0x2d')][_0xc82d('0x45')]({'where':{'id':_0x350d40[_0xc82d('0x43')]['id']}})[_0xc82d('0x26')](handleEntityNotFound(_0x479795,null))[_0xc82d('0x26')](saveUpdates(_0x350d40['body'],null))['then'](respondWithResult(_0x479795,null))['catch'](handleError(_0x479795,null));};exports['destroy']=function(_0x142d1b,_0x49082c){return db['OpenchannelApplication']['find']({'where':{'id':_0x142d1b[_0xc82d('0x43')]['id']}})[_0xc82d('0x26')](handleEntityNotFound(_0x49082c,null))[_0xc82d('0x26')](removeEntity(_0x49082c,null))[_0xc82d('0x41')](handleError(_0x49082c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a7dcfc5..c62762e 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 _0x8d82=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0x8d82,0x9b));var _0x28d8=function(_0x21c429,_0x2d9d58){_0x21c429=_0x21c429-0x0;var _0x4b1456=_0x8d82[_0x21c429];return _0x4b1456;};'use strict';var _=require(_0x28d8('0x0'));var util=require('util');var logger=require(_0x28d8('0x1'))('api');var moment=require(_0x28d8('0x2'));var BPromise=require(_0x28d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28d8('0x4'));var rimraf=require(_0x28d8('0x5'));var config=require(_0x28d8('0x6'));var attributes=require(_0x28d8('0x7'));module[_0x28d8('0x8')]=function(_0x25f064,_0xc7cacd){return _0x25f064[_0x28d8('0x9')](_0x28d8('0xa'),attributes,{'tableName':_0x28d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28d8('0xc'),'collate':_0x28d8('0xd')});}; \ No newline at end of file +var _0x6c36=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6c36,0x1bf));var _0x66c3=function(_0x56b80f,_0x16eb22){_0x56b80f=_0x56b80f-0x0;var _0x1c2364=_0x6c36[_0x56b80f];return _0x1c2364;};'use strict';var _=require(_0x66c3('0x0'));var util=require(_0x66c3('0x1'));var logger=require(_0x66c3('0x2'))('api');var moment=require(_0x66c3('0x3'));var BPromise=require(_0x66c3('0x4'));var rp=require(_0x66c3('0x5'));var fs=require('fs');var path=require(_0x66c3('0x6'));var rimraf=require('rimraf');var config=require(_0x66c3('0x7'));var attributes=require(_0x66c3('0x8'));module[_0x66c3('0x9')]=function(_0x225cde,_0x225d5f){return _0x225cde[_0x66c3('0xa')](_0x66c3('0xb'),attributes,{'tableName':_0x66c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 15ad163..c3d27ac 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 _0x613e=['OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','then','debug','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','info'];(function(_0x361ea3,_0x43ca7e){var _0x6c605f=function(_0x3409b9){while(--_0x3409b9){_0x361ea3['push'](_0x361ea3['shift']());}};_0x6c605f(++_0x43ca7e);}(_0x613e,0xbb));var _0xe613=function(_0x531a3f,_0x36f0f1){_0x531a3f=_0x531a3f-0x0;var _0x43fec5=_0x613e[_0x531a3f];return _0x43fec5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe613('0x0'));var BPromise=require(_0xe613('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe613('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe613('0x3'));var logger=require(_0xe613('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe613('0x5'));var client=jayson['client'][_0xe613('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24241e,_0x43526a,_0x2f2472){return new BPromise(function(_0x4ca738,_0x3f6b10){return client[_0xe613('0x7')](_0x24241e,_0x2f2472)['then'](function(_0x3f2994){logger[_0xe613('0x8')]('OpenchannelApplication,\x20%s,\x20%s',_0x43526a,'request\x20sent');logger['debug'](_0xe613('0x9'),_0x43526a,'request\x20sent',JSON[_0xe613('0xa')](_0x3f2994));if(_0x3f2994[_0xe613('0xb')]){if(_0x3f2994[_0xe613('0xb')][_0xe613('0xc')]===0x1f4){logger[_0xe613('0xb')](_0xe613('0xd'),_0x43526a,_0x3f2994[_0xe613('0xb')][_0xe613('0xe')]);return _0x3f6b10(_0x3f2994[_0xe613('0xb')][_0xe613('0xe')]);}logger[_0xe613('0xb')](_0xe613('0xd'),_0x43526a,_0x3f2994[_0xe613('0xb')][_0xe613('0xe')]);return _0x4ca738(_0x3f2994['error']['message']);}else{logger[_0xe613('0x8')](_0xe613('0xd'),_0x43526a,_0xe613('0xf'));_0x4ca738(_0x3f2994[_0xe613('0x10')][_0xe613('0xe')]);}})[_0xe613('0x11')](function(_0x20b342){logger[_0xe613('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x43526a,_0x20b342);_0x3f6b10(_0x20b342);});});}exports[_0xe613('0x12')]=function(_0x27bc21){var _0x5ece7=this;return new Promise(function(_0x23de3e,_0xd5aae8){return db[_0xe613('0x13')][_0xe613('0x14')](_0x27bc21[_0xe613('0x15')],{'raw':_0x27bc21[_0xe613('0x16')]?_0x27bc21[_0xe613('0x16')][_0xe613('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27bc21[_0xe613('0x16')]?_0x27bc21[_0xe613('0x16')]['where']||null:null,'attributes':_0x27bc21[_0xe613('0x16')]?_0x27bc21[_0xe613('0x16')][_0xe613('0x18')]||null:null,'limit':_0x27bc21[_0xe613('0x16')]?_0x27bc21[_0xe613('0x16')][_0xe613('0x19')]||null:null})[_0xe613('0x1a')](function(_0xa9d494){logger[_0xe613('0x8')](_0xe613('0x12'),_0x27bc21);logger[_0xe613('0x1b')](_0xe613('0x12'),_0x27bc21,JSON[_0xe613('0xa')](_0xa9d494));_0x23de3e(_0xa9d494);})['catch'](function(_0x4494c2){logger[_0xe613('0xb')](_0xe613('0x12'),_0x4494c2[_0xe613('0xe')],_0x27bc21);_0xd5aae8(_0x5ece7['error'](0x1f4,_0x4494c2['message']));});});}; \ No newline at end of file +var _0x35ef=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','stringify','lodash','util'];(function(_0x479f47,_0x3d619a){var _0xc3fac2=function(_0x351634){while(--_0x351634){_0x479f47['push'](_0x479f47['shift']());}};_0xc3fac2(++_0x3d619a);}(_0x35ef,0x9e));var _0xf35e=function(_0x46c415,_0x442b74){_0x46c415=_0x46c415-0x0;var _0x2d854d=_0x35ef[_0x46c415];return _0x2d854d;};'use strict';var _=require(_0xf35e('0x0'));var util=require(_0xf35e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf35e('0x2'));var fs=require('fs');var Redis=require(_0xf35e('0x3'));var db=require(_0xf35e('0x4'))['db'];var utils=require(_0xf35e('0x5'));var logger=require(_0xf35e('0x6'))(_0xf35e('0x7'));var config=require('../../config/environment');var jayson=require(_0xf35e('0x8'));var client=jayson[_0xf35e('0x9')][_0xf35e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x313a59,_0x4cbe59,_0x3aa7ae){return new BPromise(function(_0x281e00,_0x153de1){return client[_0xf35e('0xb')](_0x313a59,_0x3aa7ae)[_0xf35e('0xc')](function(_0x2c57de){logger[_0xf35e('0xd')](_0xf35e('0xe'),_0x4cbe59,_0xf35e('0xf'));logger[_0xf35e('0x10')](_0xf35e('0x11'),_0x4cbe59,_0xf35e('0xf'),JSON['stringify'](_0x2c57de));if(_0x2c57de['error']){if(_0x2c57de[_0xf35e('0x12')][_0xf35e('0x13')]===0x1f4){logger[_0xf35e('0x12')](_0xf35e('0xe'),_0x4cbe59,_0x2c57de['error'][_0xf35e('0x14')]);return _0x153de1(_0x2c57de[_0xf35e('0x12')][_0xf35e('0x14')]);}logger['error'](_0xf35e('0xe'),_0x4cbe59,_0x2c57de['error']['message']);return _0x281e00(_0x2c57de[_0xf35e('0x12')][_0xf35e('0x14')]);}else{logger[_0xf35e('0xd')](_0xf35e('0xe'),_0x4cbe59,_0xf35e('0xf'));_0x281e00(_0x2c57de[_0xf35e('0x15')][_0xf35e('0x14')]);}})[_0xf35e('0x16')](function(_0x361cc4){logger[_0xf35e('0x12')](_0xf35e('0xe'),_0x4cbe59,_0x361cc4);_0x153de1(_0x361cc4);});});}exports[_0xf35e('0x17')]=function(_0x466858){var _0x20ae27=this;return new Promise(function(_0x2fb29c,_0x1547e7){return db[_0xf35e('0x18')][_0xf35e('0x19')](_0x466858[_0xf35e('0x1a')],{'raw':_0x466858['options']?_0x466858[_0xf35e('0x1b')][_0xf35e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466858['options']?_0x466858['options'][_0xf35e('0x1d')]||null:null,'attributes':_0x466858['options']?_0x466858[_0xf35e('0x1b')]['attributes']||null:null,'limit':_0x466858[_0xf35e('0x1b')]?_0x466858['options'][_0xf35e('0x1e')]||null:null})[_0xf35e('0xc')](function(_0xee1d99){logger['info'](_0xf35e('0x17'),_0x466858);logger[_0xf35e('0x10')](_0xf35e('0x17'),_0x466858,JSON[_0xf35e('0x1f')](_0xee1d99));_0x2fb29c(_0xee1d99);})[_0xf35e('0x16')](function(_0x3c386a){logger['error'](_0xf35e('0x17'),_0x3c386a[_0xf35e('0x14')],_0x466858);_0x1547e7(_0x20ae27[_0xf35e('0x12')](0x1f4,_0x3c386a[_0xf35e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 314ade5..67bcec0 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 _0x1d27=['tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','addMessage','/:id/tags'];(function(_0x100a09,_0xbe667f){var _0x5422dd=function(_0x2bf803){while(--_0x2bf803){_0x100a09['push'](_0x100a09['shift']());}};_0x5422dd(++_0xbe667f);}(_0x1d27,0x1c9));var _0x71d2=function(_0x3dca9d,_0x367833){_0x3dca9d=_0x3dca9d-0x0;var _0x5bb8f9=_0x1d27[_0x3dca9d];return _0x5bb8f9;};'use strict';var multer=require(_0x71d2('0x0'));var util=require(_0x71d2('0x1'));var path=require(_0x71d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x71d2('0x3'));var router=express[_0x71d2('0x4')]();var fs_extra=require(_0x71d2('0x5'));var auth=require(_0x71d2('0x6'));var interaction=require(_0x71d2('0x7'));var config=require(_0x71d2('0x8'));var controller=require(_0x71d2('0x9'));router['get']('/',auth[_0x71d2('0xa')](),controller[_0x71d2('0xb')]);router[_0x71d2('0xc')](_0x71d2('0xd'),auth[_0x71d2('0xa')](),controller[_0x71d2('0xe')]);router[_0x71d2('0xc')](_0x71d2('0xf'),auth['isAuthenticated'](),controller[_0x71d2('0x10')]);router[_0x71d2('0xc')](_0x71d2('0x11'),auth[_0x71d2('0xa')](),controller['getMessages']);router[_0x71d2('0xc')](_0x71d2('0x12'),auth['isAuthenticated'](),controller[_0x71d2('0x13')]);router['post']('/',auth[_0x71d2('0xa')](),controller[_0x71d2('0x14')]);router['post']('/:id/messages',auth[_0x71d2('0xa')](),controller[_0x71d2('0x15')]);router['post'](_0x71d2('0x16'),auth['isAuthenticated'](),interaction[_0x71d2('0x17')](_0x71d2('0x18'),_0x71d2('0x19')),controller['addTags']);router[_0x71d2('0x1a')]('/:id',auth[_0x71d2('0xa')](),interaction[_0x71d2('0x17')](_0x71d2('0x18'),_0x71d2('0x1b')),controller[_0x71d2('0x1c')]);router[_0x71d2('0x1d')](_0x71d2('0xf'),auth[_0x71d2('0xa')](),interaction[_0x71d2('0x17')](_0x71d2('0x18'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x71d2('0x1d')](_0x71d2('0x16'),auth[_0x71d2('0xa')](),controller[_0x71d2('0x1e')]);module[_0x71d2('0x1f')]=router; \ No newline at end of file +var _0x0d5e=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x0d5e,0xd2));var _0xe0d5=function(_0x5f5c8c,_0x2e3b21){_0x5f5c8c=_0x5f5c8c-0x0;var _0x4c4772=_0x0d5e[_0x5f5c8c];return _0x4c4772;};'use strict';var multer=require(_0xe0d5('0x0'));var util=require(_0xe0d5('0x1'));var path=require(_0xe0d5('0x2'));var timeout=require(_0xe0d5('0x3'));var express=require(_0xe0d5('0x4'));var router=express['Router']();var fs_extra=require(_0xe0d5('0x5'));var auth=require(_0xe0d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe0d5('0x7'));var controller=require('./openchannelInteraction.controller');router[_0xe0d5('0x8')]('/',auth['isAuthenticated'](),controller[_0xe0d5('0x9')]);router[_0xe0d5('0x8')](_0xe0d5('0xa'),auth[_0xe0d5('0xb')](),controller[_0xe0d5('0xc')]);router['get'](_0xe0d5('0xd'),auth['isAuthenticated'](),controller[_0xe0d5('0xe')]);router[_0xe0d5('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0xe0d5('0xf')]);router[_0xe0d5('0x8')](_0xe0d5('0x10'),auth[_0xe0d5('0xb')](),controller[_0xe0d5('0x11')]);router['post']('/',auth[_0xe0d5('0xb')](),controller[_0xe0d5('0x12')]);router[_0xe0d5('0x13')](_0xe0d5('0x14'),auth[_0xe0d5('0xb')](),controller[_0xe0d5('0x15')]);router[_0xe0d5('0x13')](_0xe0d5('0x16'),auth['isAuthenticated'](),interaction[_0xe0d5('0x17')](_0xe0d5('0x18'),_0xe0d5('0x19')),controller[_0xe0d5('0x1a')]);router[_0xe0d5('0x1b')](_0xe0d5('0xd'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xe0d5('0x1c')),controller[_0xe0d5('0x1d')]);router[_0xe0d5('0x1e')](_0xe0d5('0xd'),auth[_0xe0d5('0xb')](),interaction[_0xe0d5('0x17')]('openchannel',_0xe0d5('0x1f')),controller[_0xe0d5('0x20')]);router['delete'](_0xe0d5('0x16'),auth[_0xe0d5('0xb')](),controller[_0xe0d5('0x21')]);module[_0xe0d5('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 31453d2..8a06c36 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 _0x894f=['BOOLEAN','DATE','STRING','sequelize','exports'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x894f,0x14d));var _0xf894=function(_0x22e40d,_0x490841){_0x22e40d=_0x22e40d-0x0;var _0x554502=_0x894f[_0x22e40d];return _0x554502;};'use strict';var Sequelize=require(_0xf894('0x0'));module[_0xf894('0x1')]={'closed':{'type':Sequelize[_0xf894('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf894('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf894('0x4')]},'note':{'type':Sequelize[_0xf894('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xf894('0x4')]},'lastMsgAt':{'type':Sequelize[_0xf894('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf894('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf894('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x63b6=['ENUM','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x5b12e9,_0x295e5f){var _0x247fb3=function(_0x40a11b){while(--_0x40a11b){_0x5b12e9['push'](_0x5b12e9['shift']());}};_0x247fb3(++_0x295e5f);}(_0x63b6,0x127));var _0x663b=function(_0x2d3b84,_0x160ed0){_0x2d3b84=_0x2d3b84-0x0;var _0x10ad44=_0x63b6[_0x2d3b84];return _0x10ad44;};'use strict';var Sequelize=require(_0x663b('0x0'));module[_0x663b('0x1')]={'closed':{'type':Sequelize[_0x663b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x663b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x663b('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x663b('0x4')]},'threadId':{'type':Sequelize[_0x663b('0x3')]},'externalUrl':{'type':Sequelize[_0x663b('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x663b('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x663b('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7bd3d0a..4243109 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 _0x1d57=['mustache','path','sox','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','then','stack','name','Users','map','TagIds','Tags','split','push','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','from','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','i.OpenchannelAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','params','includeAll','options','create','body','destroy','describe','OpenchannelMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','mkdirSync','Openchannel','Account','N.A.','closed','closedAt','disposition','threadId','Public','existsSync','createReadStream','pipe','createWriteStream','out','System','basename','direction','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x1d57,0xe4));var _0x71d5=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0x1d57[_0x246f0c];return _0x30fe50;};'use strict';var emlformat=require(_0x71d5('0x0'));var rimraf=require(_0x71d5('0x1'));var zipdir=require(_0x71d5('0x2'));var jsonpatch=require(_0x71d5('0x3'));var rp=require(_0x71d5('0x4'));var moment=require('moment');var BPromise=require(_0x71d5('0x5'));var Mustache=require(_0x71d5('0x6'));var util=require('util');var path=require(_0x71d5('0x7'));var sox=require(_0x71d5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71d5('0x9'));var squel=require(_0x71d5('0xa'));var crypto=require(_0x71d5('0xb'));var jsforce=require(_0x71d5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x71d5('0xd'));var querystring=require('querystring');var Papa=require(_0x71d5('0xe'));var Redis=require('ioredis');var authService=require(_0x71d5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x71d5('0x10'));var pdf=require(_0x71d5('0x11'));var hardwareService=require(_0x71d5('0x12'));var logger=require(_0x71d5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x71d5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x71d5('0x15'))['db'];config[_0x71d5('0x16')]=_[_0x71d5('0x17')](config[_0x71d5('0x16')],{'host':_0x71d5('0x18'),'port':0x18eb});var socket=require(_0x71d5('0x19'))(new Redis(config['redis']));require(_0x71d5('0x1a'))[_0x71d5('0x1b')](socket);function respondWithStatusCode(_0x5b167d,_0x48b98f){_0x48b98f=_0x48b98f||0xcc;return function(_0x3857b8){if(_0x3857b8){return _0x5b167d[_0x71d5('0x1c')](_0x48b98f);}return _0x5b167d[_0x71d5('0x1d')](_0x48b98f)[_0x71d5('0x1e')]();};}function respondWithResult(_0x247eb6,_0x5080a2){_0x5080a2=_0x5080a2||0xc8;return function(_0x123ed0){if(_0x123ed0){return _0x247eb6['status'](_0x5080a2)['json'](_0x123ed0);}};}function respondWithFilteredResult(_0x6bb148,_0x47da16){return function(_0x1c2fb3){if(_0x1c2fb3){var _0x5afd5f=typeof _0x47da16[_0x71d5('0x1f')]===_0x71d5('0x20')&&typeof _0x47da16['limit']==='undefined';var _0x59182a=_0x1c2fb3[_0x71d5('0x21')];var _0x1812d0=_0x5afd5f?0x0:_0x47da16[_0x71d5('0x1f')];var _0x50d8d4=_0x5afd5f?_0x1c2fb3[_0x71d5('0x21')]:_0x47da16['offset']+_0x47da16[_0x71d5('0x22')];var _0x184b0f;if(_0x50d8d4>=_0x59182a){_0x50d8d4=_0x59182a;_0x184b0f=0xc8;}else{_0x184b0f=0xce;}_0x6bb148[_0x71d5('0x1d')](_0x184b0f);return _0x6bb148[_0x71d5('0x23')](_0x71d5('0x24'),_0x1812d0+'-'+_0x50d8d4+'/'+_0x59182a)['json'](_0x1c2fb3);}return null;};}function patchUpdates(_0x44e6b7){return function(_0x177363){try{jsonpatch[_0x71d5('0x25')](_0x177363,_0x44e6b7,!![]);}catch(_0x1c770c){return BPromise['reject'](_0x1c770c);}return _0x177363['save']();};}function saveUpdates(_0x20a742,_0x461804){return function(_0x360248){if(_0x360248){return _0x360248[_0x71d5('0x26')](_0x20a742)['then'](function(_0x3fc627){return _0x3fc627;});}return null;};}function removeEntity(_0x3f815c,_0x5f3645){return function(_0x19baa2){if(_0x19baa2){return _0x19baa2['destroy']()[_0x71d5('0x27')](function(){_0x3f815c[_0x71d5('0x1d')](0xcc)[_0x71d5('0x1e')]();});}};}function handleEntityNotFound(_0x23a725,_0x285cd6){return function(_0x687d1c){if(!_0x687d1c){_0x23a725[_0x71d5('0x1c')](0x194);}return _0x687d1c;};}function handleError(_0x39d426,_0x2be38d){_0x2be38d=_0x2be38d||0x1f4;return function(_0x2a76b4){logger['error'](_0x2a76b4[_0x71d5('0x28')]);if(_0x2a76b4[_0x71d5('0x29')]){delete _0x2a76b4['name'];}_0x39d426[_0x71d5('0x1d')](_0x2be38d)['send'](_0x2a76b4);};}function getInteractionUsers(_0x45289e,_0x166888){return new BPromise(function(_0xcfa7df,_0x464a36){try{if(_0x166888[_0x45289e['id']]){_0x45289e[_0x71d5('0x2a')]=_[_0x71d5('0x2b')](_0x166888[_0x45289e['id']],function(_0x252f10){return{'id':_0x252f10['id'],'fullname':_0x252f10['fullname']};});}}catch(_0x4e6e83){_0x464a36(_0x4e6e83);}_0xcfa7df(_0x45289e);});}function getInteractionTags(_0x174b5e,_0x3ae784){return new BPromise(function(_0x4d5488,_0x4fb17c){try{if(_0x174b5e[_0x71d5('0x2c')]){_0x174b5e[_0x71d5('0x2d')]=[];_0x174b5e[_0x71d5('0x2c')][_0x71d5('0x2e')](',')['forEach'](function(_0x2f5436){_0x174b5e[_0x71d5('0x2d')][_0x71d5('0x2f')](_0x3ae784[_0x2f5436]);});}delete _0x174b5e[_0x71d5('0x2c')];}catch(_0x1d0348){_0x4fb17c(_0x1d0348);}_0x4d5488(_0x174b5e);});}function updateOpenchannelInteraction(_0x3d3b6d,_0x4e3bd8,_0x34b20c){return new BPromise(function(_0x264da8,_0x3afce5){return getInteractionUsers(_0x3d3b6d,_0x34b20c)[_0x71d5('0x27')](function(_0xd82d0a){return getInteractionTags(_0xd82d0a,_0x4e3bd8);})['then'](function(_0x559df7){_0x264da8(_0x559df7);})[_0x71d5('0x30')](function(_0x2b75a0){_0x3afce5(_0x2b75a0);});});}exports['index']=function(_0x1b2815,_0x59087c){var _0xdfb5b3={},_0x54a4d8={},_0x335ad5={'count':0x0,'rows':[]};var _0x181182=_[_0x71d5('0x2b')](db[_0x71d5('0x31')][_0x71d5('0x32')],function(_0x559012){return{'name':_0x559012[_0x71d5('0x33')],'type':_0x559012[_0x71d5('0x34')][_0x71d5('0x35')]};});_0x54a4d8[_0x71d5('0x36')]=_[_0x71d5('0x2b')](_0x181182,'name');_0x54a4d8['query']=_[_0x71d5('0x37')](_0x1b2815[_0x71d5('0x38')]);_0x54a4d8[_0x71d5('0x39')]=_[_0x71d5('0x3a')](_0x54a4d8[_0x71d5('0x36')],_0x54a4d8['query']);_0xdfb5b3[_0x71d5('0x3b')]=_[_0x71d5('0x3a')](_0x54a4d8[_0x71d5('0x36')],qs[_0x71d5('0x3c')](_0x1b2815['query'][_0x71d5('0x3c')]));_0xdfb5b3[_0x71d5('0x3b')]=_0xdfb5b3[_0x71d5('0x3b')][_0x71d5('0x3d')]?_0xdfb5b3['attributes']:_0x54a4d8[_0x71d5('0x36')];if(!_0x1b2815[_0x71d5('0x38')]['hasOwnProperty'](_0x71d5('0x3e'))){_0xdfb5b3[_0x71d5('0x22')]=qs[_0x71d5('0x22')](_0x1b2815[_0x71d5('0x38')][_0x71d5('0x22')]);_0xdfb5b3[_0x71d5('0x1f')]=qs['offset'](_0x1b2815[_0x71d5('0x38')]['offset']);}_0xdfb5b3[_0x71d5('0x3f')]=qs[_0x71d5('0x40')](_0x1b2815[_0x71d5('0x38')][_0x71d5('0x40')]);_0xdfb5b3[_0x71d5('0x41')]=qs['filters'](_[_0x71d5('0x42')](_0x1b2815['query'],_0x54a4d8[_0x71d5('0x39')]),_0x181182);var _0x13b761=[];var _0x342f69=squel[_0x71d5('0x43')]()['field']('id')['field'](_0x71d5('0x29'))[_0x71d5('0x44')]('color')[_0x71d5('0x45')]('tools_tags');var _0x25714b=squel[_0x71d5('0x43')]()['field'](_0x71d5('0x46'))[_0x71d5('0x44')](_0x71d5('0x47'))[_0x71d5('0x44')](_0x71d5('0x48'))[_0x71d5('0x45')]('user_has_openchannel_interactions','ui')[_0x71d5('0x49')](_0x71d5('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x4af94e=squel[_0x71d5('0x43')]()[_0x71d5('0x45')]('openchannel_interactions','i')[_0x71d5('0x49')](_0x71d5('0x4b'),'c',_0x71d5('0x4c'))[_0x71d5('0x49')](_0x71d5('0x4a'),'o',_0x71d5('0x4d'))['left_join'](_0x71d5('0x4e'),'a',_0x71d5('0x4f'))['left_join'](_0x71d5('0x50'),'me',_0x71d5('0x51'))[_0x71d5('0x49')](_0x71d5('0x52'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x71d5('0x49')](_0x71d5('0x53'),'t','t.id\x20=\x20it.TagId');var _0x367117=squel[_0x71d5('0x54')]();var _0x52d757=[];var _0x52ec53=squel[_0x71d5('0x54')]();var _0x40ec6c;if(_0x1b2815['query'][_0x71d5('0x55')]){_0x40ec6c=as[_0x71d5('0x56')](_0x1b2815[_0x71d5('0x38')][_0x71d5('0x55')]);var _0x3270c8=_0x40ec6c['sqlOperator'];for(var _0x1d0f96=0x0;_0x1d0f96<_0x40ec6c[_0x71d5('0x57')][_0x71d5('0x3d')];_0x1d0f96++){var _0x324bfb=_0x40ec6c[_0x71d5('0x57')][_0x1d0f96];var _0xcc5ef2='i';var _0x5caab6=_[_0x71d5('0x58')](_0x181182,[_0x71d5('0x29'),_0x324bfb[_0x71d5('0x44')]]);if(!_0x5caab6){switch(_0x324bfb[_0x71d5('0x44')]){case _0x71d5('0x59'):if(_0x324bfb[_0x71d5('0x5a')]==0x1){_0x4af94e[_0x71d5('0x5b')]('`'+_0x324bfb[_0x71d5('0x44')]+_0x71d5('0x5c'));}else{_0x4af94e[_0x71d5('0x5b')]('`'+_0x324bfb[_0x71d5('0x44')]+_0x71d5('0x5d'));}break;case'Contact':if(_0x324bfb[_0x71d5('0x5e')]==='$substring'){if(_0x324bfb[_0x71d5('0x5a')][_0x71d5('0x2e')]('\x20')[_0x71d5('0x3d')]>0x1){_0x367117[_0x3270c8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x71d5('0x5f')](_0x324bfb[_0x71d5('0x5a')]),null);}else{var _0x42518c='%'+_0x324bfb['value']+'%';_0x367117[_0x3270c8]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x42518c,_0x42518c,_0x42518c);}}else{_0x5caab6=_['find'](_0x181182,[_0x71d5('0x29'),_0x71d5('0x60')]);_0x324bfb[_0x71d5('0x44')]='ContactId';_0xbf7966=as[_0x71d5('0x61')](_0xcc5ef2,_0x5caab6[_0x71d5('0x34')],_0x324bfb);_0x367117[_0x3270c8](_0xbf7966[_0x71d5('0x62')],_0xbf7966[_0x71d5('0x5a')][_0x71d5('0x63')],_0xbf7966['value'][_0x71d5('0x1e')]);}break;case _0x71d5('0x64'):var _0x18ddd8=_0x324bfb[_0x71d5('0x5a')]['split'](',')['map'](function(_0x16ce7c){return Number(_0x16ce7c);});_0x18ddd8[_0x71d5('0x65')](function(_0x54f192){_0x52ec53['or'](_0x71d5('0x66'),'%,'+_0x54f192+',%');});_0x52d757=_[_0x71d5('0x67')](_0x52d757,_0x18ddd8);break;case _0x71d5('0x68'):if(_0x324bfb[_0x71d5('0x5e')]===_0x71d5('0x69')){_0x367117[_0x3270c8]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x324bfb[_0x71d5('0x5a')]+'%',null);}else{_0x5caab6=_[_0x71d5('0x58')](_0x181182,['name',_0x71d5('0x6a')]);_0x324bfb[_0x71d5('0x44')]=_0x71d5('0x6a');_0xbf7966=as['buildExpression'](_0xcc5ef2,_0x5caab6[_0x71d5('0x34')],_0x324bfb);_0x367117[_0x3270c8](_0xbf7966[_0x71d5('0x62')],_0xbf7966['value'][_0x71d5('0x63')],_0xbf7966[_0x71d5('0x5a')][_0x71d5('0x1e')]);}break;case'body':_0xbf7966=as['buildExpression']('me',null,_0x324bfb);_0x367117[_0x3270c8](_0xbf7966[_0x71d5('0x62')],_0xbf7966['value']['start'],_0xbf7966[_0x71d5('0x5a')]['end']);break;}}else{var _0xbf7966=as[_0x71d5('0x61')](_0xcc5ef2,_0x5caab6[_0x71d5('0x34')],_0x324bfb);_0x367117[_0x3270c8](_0xbf7966[_0x71d5('0x62')],_0xbf7966['value'][_0x71d5('0x63')],_0xbf7966[_0x71d5('0x5a')][_0x71d5('0x1e')]);}}}else{var _0x35486a=_(_0x1b2815[_0x71d5('0x38')])[_0x71d5('0x37')]()[_0x71d5('0x2b')](function(_0x26281e){return _[_0x71d5('0x6b')](_0x181182,[_0x71d5('0x29'),_0x26281e])?_0x26281e:undefined;})[_0x71d5('0x6c')]()[_0x71d5('0x5a')]();if(!_['isEmpty'](_0x35486a)){_0x35486a[_0x71d5('0x65')](function(_0xcbdea6){if(_0xcbdea6===_0x71d5('0x6d')){_0x4af94e['where'](_0x71d5('0x6e'),[][_0x71d5('0x6f')](_0x1b2815[_0x71d5('0x38')][_0xcbdea6]));}else if(_0xcbdea6===_0x71d5('0x70')){var _0x5e2743=JSON[_0x71d5('0x71')](_0x1b2815[_0x71d5('0x38')][_0xcbdea6])['$gte'];var _0x3a11ee=JSON[_0x71d5('0x71')](_0x1b2815[_0x71d5('0x38')][_0xcbdea6])[_0x71d5('0x72')];_0x4af94e[_0x71d5('0x41')](_0x71d5('0x73'),_0x5e2743,_0x3a11ee);}else{if(_0x1b2815[_0x71d5('0x38')][_0xcbdea6]===_0x71d5('0x74')){_0x4af94e[_0x71d5('0x41')]('i.'+_0xcbdea6+_0x71d5('0x75'));}else{_0x4af94e[_0x71d5('0x41')]('i.'+_0xcbdea6+_0x71d5('0x76'),_0x1b2815[_0x71d5('0x38')][_0xcbdea6]);}}});}if(_0x1b2815[_0x71d5('0x38')][_0x71d5('0x77')]){if(_0x1b2815[_0x71d5('0x38')][_0x71d5('0x77')]==0x1){_0x4af94e[_0x71d5('0x5b')](_0x71d5('0x78'));}else{_0x4af94e['having'](_0x71d5('0x79'));}}if(_0x1b2815['query'][_0x71d5('0x7a')]){_0x52d757=_[_0x71d5('0x7b')](_0x1b2815['query'][_0x71d5('0x7a')])?_0x1b2815[_0x71d5('0x38')][_0x71d5('0x7a')]:new Array(_0x1b2815['query']['tag']);_0x52d757['forEach'](function(_0x3dbdfa){_0x52ec53['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3dbdfa+',%');});}if(_0x1b2815[_0x71d5('0x38')]['filter']){var _0x48b89b=_0x1b2815[_0x71d5('0x38')][_0x71d5('0x7c')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x71d5('0x7d')](_0x48b89b)){_0x367117['or'](_0x71d5('0x7e'),_0x48b89b+'%');}else{_0x367117['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x71d5('0x5f')](_0x48b89b))['or'](_0x71d5('0x7f'),_0x48b89b+'%')['or'](_0x71d5('0x80'),_0x48b89b+'%');}}}_0x4af94e[_0x71d5('0x41')](_0x367117);_0x4af94e['group'](_0x71d5('0x81'));var _0x28f535={'type':db[_0x71d5('0x82')]['QueryTypes'][_0x71d5('0x83')],'raw':!![]};var _0x4cb01d=_0x4af94e[_0x71d5('0x84')]();_0x4cb01d[_0x71d5('0x44')](_0x71d5('0x81'));_0x4cb01d[_0x71d5('0x44')](_0x71d5('0x85'),_0x71d5('0x59'));if(_0xdfb5b3['order']){_0xdfb5b3['order'][_0x71d5('0x65')](function(_0x48574f){var _0x28fd03=_0x48574f[0x0]===_0x71d5('0x86')?_0x48574f[0x0]:'i.'+_0x48574f[0x0];_0x4af94e[_0x71d5('0x3f')](_0x28fd03,_0x48574f[0x1]===_0x71d5('0x87')?![]:!![]);});}if(!_[_0x71d5('0x88')](_0x52d757)){_0x4af94e[_0x71d5('0x5b')](_0x52ec53);_0x4cb01d[_0x71d5('0x41')]('t.id\x20IN\x20?',_0x52d757);}BPromise[_0x71d5('0x89')]()[_0x71d5('0x27')](function(){if(!_0x40ec6c){if(_0x1b2815[_0x71d5('0x38')][_0x71d5('0x6d')])return;_0x4cb01d[_0x71d5('0x41')](_0x71d5('0x8a'));_0x4af94e[_0x71d5('0x41')](_0x71d5('0x8a'));return;}if(_0x1b2815[_0x71d5('0x8b')][_0x71d5('0x8c')]!=='agent')return;return _0x1b2815[_0x71d5('0x8b')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x71d5('0x27')](function(_0x3c07ff){if(_[_0x71d5('0x88')](_0x3c07ff)){_0x4cb01d[_0x71d5('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4af94e[_0x71d5('0x41')](_0x71d5('0x8d'));}else{_0x4cb01d[_0x71d5('0x41')](_0x71d5('0x6e'),_[_0x71d5('0x2b')](_0x3c07ff,'id'));_0x4af94e['where'](_0x71d5('0x6e'),_[_0x71d5('0x2b')](_0x3c07ff,'id'));}});})[_0x71d5('0x27')](function(){if(_0x1b2815[_0x71d5('0x8b')][_0x71d5('0x8c')]===_0x71d5('0x8e')&&!_0x40ec6c&&!_0x1b2815[_0x71d5('0x38')]['OpenchannelAccountId'])return[];return db[_0x71d5('0x8f')]['query'](_0x4cb01d[_0x71d5('0x90')](),_0x28f535);})[_0x71d5('0x27')](function(_0x2bfa63){_0x335ad5[_0x71d5('0x21')]=_0x2bfa63[_0x71d5('0x3d')];if(_0x335ad5['count']===0x0)return[];return db['sequelize']['query'](_0x342f69[_0x71d5('0x90')](),_0x28f535)[_0x71d5('0x27')](function(_0x4dde20){_0x13b761=_[_0x71d5('0x91')](_0x4dde20,'id');_0x28f535=_[_0x71d5('0x92')](_0x28f535,{'model':db[_0x71d5('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b2815['query'][_0x71d5('0x3c')]){_0xdfb5b3[_0x71d5('0x3b')][_0x71d5('0x65')](function(_0xe0742c){_0x4af94e[_0x71d5('0x44')]('i.'+_0xe0742c);});}else{_0x4af94e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x71d5('0x59'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0x93'),_0x71d5('0x94'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0x95'),_0x71d5('0x96'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0x97'),_0x71d5('0x86'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0x98'));_0x4af94e[_0x71d5('0x44')]('c.firstName',_0x71d5('0x99'));_0x4af94e['field']('c.lastName','Contact.lastName');_0x4af94e[_0x71d5('0x44')](_0x71d5('0x9a'),_0x71d5('0x9b'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0x9c'),_0x71d5('0x9d'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0x9e'),_0x71d5('0x9f'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0xa0'),_0x71d5('0xa1'));_0x4af94e[_0x71d5('0x44')]('o.fullname','Owner.fullname');_0x4af94e[_0x71d5('0x44')](_0x71d5('0xa2'),_0x71d5('0xa3'));_0x4af94e[_0x71d5('0x44')](_0x71d5('0xa4'),'TagIds');}if(_0xdfb5b3[_0x71d5('0x22')])_0x4af94e[_0x71d5('0x22')](_0xdfb5b3['limit']);if(_0xdfb5b3[_0x71d5('0x1f')])_0x4af94e['offset'](_0xdfb5b3[_0x71d5('0x1f')]);return db[_0x71d5('0x8f')][_0x71d5('0x38')](_0x4af94e[_0x71d5('0x90')](),_0x28f535);})[_0x71d5('0x27')](function(_0x2620dc){if(_0x2620dc[_0x71d5('0x3d')]>0x0)_0x25714b[_0x71d5('0x41')](_0x71d5('0xa5'),_['map'](_0x2620dc,'id'));return db['sequelize'][_0x71d5('0x38')](_0x25714b[_0x71d5('0x90')](),_0x28f535)[_0x71d5('0x27')](function(_0x569f81){var _0x5a26a0=_['groupBy'](_0x569f81,_0x71d5('0xa6'));var _0x10514b=[];_0x2620dc[_0x71d5('0x65')](function(_0x6efdb4){_0x10514b[_0x71d5('0x2f')](updateOpenchannelInteraction(_0x6efdb4,_0x13b761,_0x5a26a0));});return BPromise[_0x71d5('0xa7')](_0x10514b);});});})[_0x71d5('0x27')](function(_0x3b1b82){_0x335ad5[_0x71d5('0xa8')]=_0x3b1b82;return _0x335ad5;})['then'](respondWithFilteredResult(_0x59087c,_0xdfb5b3))[_0x71d5('0x30')](handleError(_0x59087c,null));};exports[_0x71d5('0xa9')]=function(_0x4a4c4c,_0x1dbe29){var _0x50a0de={};if(_0x4a4c4c[_0x71d5('0x38')]['type']&&_0x4a4c4c[_0x71d5('0x38')]['type']===_0x71d5('0x45')){_0x50a0de[_0x71d5('0x45')]=_0x4a4c4c['params']['id'];}else{_0x50a0de['id']=_0x4a4c4c[_0x71d5('0xaa')]['id'];}var _0x1739ca={'raw':![],'where':_0x50a0de},_0x2a0713={};_0x2a0713[_0x71d5('0x36')]=_[_0x71d5('0x37')](db[_0x71d5('0x31')][_0x71d5('0x32')]);_0x2a0713['query']=_['keys'](_0x4a4c4c[_0x71d5('0x38')]);_0x2a0713[_0x71d5('0x39')]=_['intersection'](_0x2a0713[_0x71d5('0x36')],_0x2a0713[_0x71d5('0x38')]);_0x1739ca[_0x71d5('0x3b')]=_[_0x71d5('0x3a')](_0x2a0713[_0x71d5('0x36')],qs['fields'](_0x4a4c4c[_0x71d5('0x38')][_0x71d5('0x3c')]));_0x1739ca['attributes']=_0x1739ca[_0x71d5('0x3b')][_0x71d5('0x3d')]?_0x1739ca[_0x71d5('0x3b')]:_0x2a0713[_0x71d5('0x36')];if(_0x4a4c4c[_0x71d5('0x38')][_0x71d5('0xab')]){_0x1739ca['include']=[{'all':!![]}];}_0x1739ca=_[_0x71d5('0x92')]({},_0x1739ca,_0x4a4c4c[_0x71d5('0xac')]);return db[_0x71d5('0x31')]['find'](_0x1739ca)[_0x71d5('0x27')](handleEntityNotFound(_0x1dbe29,null))['then'](respondWithResult(_0x1dbe29,null))[_0x71d5('0x30')](handleError(_0x1dbe29,null));};exports[_0x71d5('0xad')]=function(_0x2fbafb,_0x44b708){return db[_0x71d5('0x31')]['create'](_0x2fbafb['body'],{})[_0x71d5('0x27')](respondWithResult(_0x44b708,0xc9))[_0x71d5('0x30')](handleError(_0x44b708,null));};exports[_0x71d5('0x26')]=function(_0x2e4fac,_0x1e57e2){if(_0x2e4fac[_0x71d5('0xae')]['id']){delete _0x2e4fac[_0x71d5('0xae')]['id'];}return db[_0x71d5('0x31')]['find']({'where':{'id':_0x2e4fac[_0x71d5('0xaa')]['id']}})[_0x71d5('0x27')](handleEntityNotFound(_0x1e57e2,null))[_0x71d5('0x27')](saveUpdates(_0x2e4fac[_0x71d5('0xae')],null))['then'](respondWithResult(_0x1e57e2,null))['catch'](handleError(_0x1e57e2,null));};exports[_0x71d5('0xaf')]=function(_0x469589,_0x94788a){return db[_0x71d5('0x31')][_0x71d5('0x58')]({'where':{'id':_0x469589['params']['id']}})[_0x71d5('0x27')](handleEntityNotFound(_0x94788a,null))['then'](removeEntity(_0x94788a,null))[_0x71d5('0x30')](handleError(_0x94788a,null));};exports[_0x71d5('0xb0')]=function(_0x13c648,_0x1cc00d){return db[_0x71d5('0x31')][_0x71d5('0xb0')]()[_0x71d5('0x27')](respondWithResult(_0x1cc00d,null))[_0x71d5('0x30')](handleError(_0x1cc00d,null));};exports['addMessage']=function(_0x4d0b5c,_0x30b145,_0x1a0b5c){return db[_0x71d5('0xb1')][_0x71d5('0x58')]({'where':{'id':_0x4d0b5c[_0x71d5('0xaa')]['id']}})[_0x71d5('0x27')](handleEntityNotFound(_0x30b145,null))[_0x71d5('0x27')](function(_0x474ac5){if(_0x474ac5){return _0x474ac5['addMessage'](_0x4d0b5c[_0x71d5('0xae')][_0x71d5('0xb2')],_[_0x71d5('0xb3')](_0x4d0b5c['body'],[_0x71d5('0xb2'),'id'])||{});}})[_0x71d5('0x27')](respondWithResult(_0x30b145,null))[_0x71d5('0x30')](handleError(_0x30b145,null));};exports[_0x71d5('0xb4')]=function(_0x54d7b5,_0x22066e,_0x50f2f9){var _0x2dc623={'raw':![],'where':{}};var _0x236164={};var _0x594d2d={'count':0x0,'rows':[]};return db[_0x71d5('0x31')][_0x71d5('0xb5')]({'where':{'id':_0x54d7b5[_0x71d5('0xaa')]['id']}})[_0x71d5('0x27')](handleEntityNotFound(_0x22066e,null))['then'](function(_0x25f99e){if(_0x25f99e){_0x236164[_0x71d5('0x36')]=_[_0x71d5('0x37')](db[_0x71d5('0xb1')]['rawAttributes']);_0x236164[_0x71d5('0x38')]=_[_0x71d5('0x37')](_0x54d7b5['query']);_0x236164[_0x71d5('0x39')]=_[_0x71d5('0x3a')](_0x236164[_0x71d5('0x36')],_0x236164[_0x71d5('0x38')]);_0x2dc623[_0x71d5('0x3b')]=_[_0x71d5('0x3a')](_0x236164['model'],qs['fields'](_0x54d7b5[_0x71d5('0x38')]['fields']));_0x2dc623[_0x71d5('0x3b')]=_0x2dc623[_0x71d5('0x3b')][_0x71d5('0x3d')]?_0x2dc623['attributes']:_0x236164[_0x71d5('0x36')];if(!_0x54d7b5[_0x71d5('0x38')]['hasOwnProperty'](_0x71d5('0x3e'))){_0x2dc623[_0x71d5('0x22')]=qs[_0x71d5('0x22')](_0x54d7b5[_0x71d5('0x38')][_0x71d5('0x22')]);_0x2dc623[_0x71d5('0x1f')]=qs[_0x71d5('0x1f')](_0x54d7b5['query']['offset']);}_0x2dc623[_0x71d5('0x3f')]=qs[_0x71d5('0x40')](_0x54d7b5['query']['sort']);_0x2dc623[_0x71d5('0x41')]=qs[_0x71d5('0x39')](_[_0x71d5('0x42')](_0x54d7b5[_0x71d5('0x38')],_0x236164[_0x71d5('0x39')]));_0x2dc623['where'][_0x71d5('0xa6')]=_0x25f99e['id'];if(_0x54d7b5['query'][_0x71d5('0x7c')]){_0x2dc623['where']=_['merge'](_0x2dc623[_0x71d5('0x41')],{'$or':_[_0x71d5('0x2b')](_0x2dc623['attributes'],function(_0x1afc11){var _0x368913={};_0x368913[_0x1afc11]={'$like':'%'+_0x54d7b5[_0x71d5('0x38')][_0x71d5('0x7c')]+'%'};return _0x368913;})});}if(_0x54d7b5[_0x71d5('0x38')][_0x71d5('0xb6')]){var _0x19dcce=_0x54d7b5[_0x71d5('0x38')]['$gte']['split'](',');var _0x45d7b6={};_0x45d7b6[_0x19dcce[0x0]]={'$gte':moment(_0x19dcce[0x1])[_0x71d5('0xb7')](_0x71d5('0xb8'))};_0x2dc623['where']=_[_0x71d5('0x92')](_0x2dc623['where'],_0x45d7b6);}_0x2dc623=_[_0x71d5('0x92')]({},_0x2dc623,_0x54d7b5[_0x71d5('0xac')]);return db['OpenchannelMessage']['count']({'where':_0x2dc623[_0x71d5('0x41')]})[_0x71d5('0x27')](function(_0x43a418){_0x594d2d[_0x71d5('0x21')]=_0x43a418;if(_0x54d7b5['query'][_0x71d5('0xab')]){_0x2dc623['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x2dc623);})[_0x71d5('0x27')](function(_0x89306f){_0x594d2d[_0x71d5('0xa8')]=_0x89306f;return _0x594d2d;});}})[_0x71d5('0x27')](respondWithFilteredResult(_0x22066e,_0x2dc623))[_0x71d5('0x30')](handleError(_0x22066e,null));};exports[_0x71d5('0xb9')]=function(_0x45f5de,_0x1d5123,_0x5183e0){return db[_0x71d5('0x31')][_0x71d5('0x58')]({'where':{'id':_0x45f5de[_0x71d5('0xaa')]['id']}})[_0x71d5('0x27')](handleEntityNotFound(_0x1d5123,null))[_0x71d5('0x27')](function(_0x314b32){if(_0x314b32){return _0x314b32[_0x71d5('0xba')](_0x45f5de[_0x71d5('0xae')][_0x71d5('0xb2')],_['omit'](_0x45f5de[_0x71d5('0xae')],[_0x71d5('0xb2'),'id'])||{})[_0x71d5('0xbb')](function(){return db[_0x71d5('0x64')][_0x71d5('0xbc')]({'attributes':['id',_0x71d5('0x29'),_0x71d5('0xbd')],'where':{'id':_0x45f5de[_0x71d5('0xae')][_0x71d5('0xb2')]}});})[_0x71d5('0x27')](function(_0x5d003d){socket[_0x71d5('0xbe')](_0x71d5('0xbf'),{'id':Number(_0x45f5de[_0x71d5('0xaa')]['id']),'tags':_0x5d003d||[]});return{'id':Number(_0x45f5de[_0x71d5('0xaa')]['id']),'tags':_0x5d003d||[]};});}})[_0x71d5('0x27')](respondWithResult(_0x1d5123,null))[_0x71d5('0x30')](handleError(_0x1d5123,null));};exports['removeTags']=function(_0x1aa4eb,_0x184afc,_0x152e10){return db[_0x71d5('0x31')][_0x71d5('0x58')]({'where':{'id':_0x1aa4eb[_0x71d5('0xaa')]['id']}})[_0x71d5('0x27')](handleEntityNotFound(_0x184afc,null))[_0x71d5('0x27')](function(_0x497441){if(_0x497441){return _0x497441[_0x71d5('0xc0')](_0x1aa4eb[_0x71d5('0x38')][_0x71d5('0xb2')]);}})[_0x71d5('0x27')](respondWithStatusCode(_0x184afc,null))['catch'](handleError(_0x184afc,null));};exports[_0x71d5('0xc1')]=function(_0xd6dcd0,_0x50beba){var _0x41fb78=moment()[_0x71d5('0xc2')]()['toString']();var _0x43cc94=path['join'](config[_0x71d5('0xc3')],_0x71d5('0xc4'),_0x71d5('0xc5'),_0x71d5('0xc6'));var _0x47179b=path[_0x71d5('0xc7')](config[_0x71d5('0xc3')],_0x71d5('0xc4'),_0x71d5('0xc5'),_0x71d5('0xc8'));var _0x5db8b3=path[_0x71d5('0xc7')](_0x43cc94,_0x41fb78);var _0x2650b8=util['format'](_0x71d5('0xc9'),_0xd6dcd0[_0x71d5('0xaa')]['id'],_0x41fb78);var _0xe78349=path[_0x71d5('0xc7')](_0x43cc94,_0x2650b8);var _0x3d8b4b=[];_0x3d8b4b[_0x71d5('0x2f')]({'model':db[_0x71d5('0x68')],'as':_0x71d5('0x68'),'attributes':['id',_0x71d5('0xca')],'raw':!![]});_0x3d8b4b[_0x71d5('0x2f')]({'model':db[_0x71d5('0xcb')],'as':_0x71d5('0xcc'),'attributes':['id',_0x71d5('0xcd'),_0x71d5('0xce')],'raw':!![]});if(_0xd6dcd0[_0x71d5('0x38')][_0x71d5('0xc8')]){_0x3d8b4b[_0x71d5('0x2f')]({'model':db['Attachment'],'as':_0x71d5('0xcf'),'raw':!![]});}var _0xa08510=[{'model':db[_0x71d5('0xb1')],'as':_0x71d5('0xd0'),'attributes':['id',_0x71d5('0xae'),'createdAt','direction',_0x71d5('0xd1'),_0x71d5('0x77')],'include':_0x3d8b4b}];_0xa08510[_0x71d5('0x2f')]({'model':db[_0x71d5('0xd2')],'as':'Account','attributes':['id',_0x71d5('0x29')]});_0xa08510[_0x71d5('0x2f')]({'model':db[_0x71d5('0x68')],'as':'Owner','attributes':['id',_0x71d5('0xca')]});return db[_0x71d5('0x31')][_0x71d5('0x58')]({'where':{'id':_0xd6dcd0['params']['id']},'include':_0xa08510})['then'](handleEntityNotFound(_0x50beba,null))['then'](function(_0x5b8407){if(_0x5b8407){var _0x1bfa82=_0x5b8407['get']({'plain':!![]});fs[_0x71d5('0xd3')](_0x5db8b3);var _0x90237b={'channel':_0x71d5('0xd4'),'account':_0x1bfa82[_0x71d5('0xd5')][_0x71d5('0x29')],'agent':_0x1bfa82['Owner']?_0x1bfa82['Owner'][_0x71d5('0xca')]:_0x71d5('0xd6'),'createdAt':moment(_0x1bfa82['createdAt'])[_0x71d5('0xb7')](_0x71d5('0xb8'))['toString'](),'closedAt':_0x1bfa82[_0x71d5('0xd7')]?moment(_0x1bfa82[_0x71d5('0xd8')])['format'](_0x71d5('0xb8'))[_0x71d5('0x90')]():'','disposition':_0x1bfa82[_0x71d5('0xd9')],'visibility':_0x1bfa82[_0x71d5('0xda')]?_0x71d5('0xdb'):'Private','messages':_(_0x1bfa82[_0x71d5('0xd0')])[_0x71d5('0x7c')]({'secret':![]})[_0x71d5('0x2b')](function(_0x1a43a4){if(_0x1a43a4[_0x71d5('0xcf')]){var _0x1f6933=path[_0x71d5('0xc7')](_0x47179b,_0x1a43a4['Attachment']['basename']);if(fs[_0x71d5('0xdc')](_0x1f6933)){fs[_0x71d5('0xdd')](_0x1f6933)[_0x71d5('0xde')](fs[_0x71d5('0xdf')](path[_0x71d5('0xc7')](_0x5db8b3,_0x1a43a4[_0x71d5('0xcf')]['basename'])));}}return{'date':moment(_0x1a43a4['createdAt'])[_0x71d5('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1a43a4['direction']===_0x71d5('0xe0')?_0x1a43a4[_0x71d5('0x68')]?_0x1a43a4['User']['fullname']:_0x71d5('0xe1'):_0x1a43a4[_0x71d5('0xcc')]['firstName']+(_0x1a43a4[_0x71d5('0xcc')][_0x71d5('0xce')]?'\x20'+_0x1a43a4[_0x71d5('0xcc')]['lastName']:''),'body':_0x1a43a4[_0x71d5('0xcf')]?_0x1a43a4[_0x71d5('0xcf')][_0x71d5('0xe2')]:_0x1a43a4[_0x71d5('0xae')],'direction':_0x1a43a4[_0x71d5('0xe3')]===_0x71d5('0xe0')?'A':'C','secret':_0x1a43a4['secret'],'read':_0x1a43a4[_0x71d5('0x77')],'attachment':_0x1a43a4['Attachment']};})[_0x71d5('0x5a')]()};return ejs[_0x71d5('0xe4')](path['join'](config[_0x71d5('0xc3')],_0x71d5('0xc4'),_0x71d5('0xe5'),_0x71d5('0xe6')),{'interaction':_0x90237b})['then'](function(_0x4fdd47){var _0xaeda07=path[_0x71d5('0xc7')](_0x5db8b3,_0x71d5('0xe7')+_0x1bfa82['id']+'-'+_0x41fb78+_0x71d5('0xe8'));var _0x16b70c={'path':_0xaeda07,'channel':_0x71d5('0xd4'),'interactionId':_0x1bfa82['id']};return pdf['createPdfFromHTML'](_0x4fdd47,_0x16b70c);})[_0x71d5('0x27')](function(){return new BPromise(function(_0x3f6d2e,_0x22769b){zipdir(_0x5db8b3,{'saveTo':_0xe78349},function(_0x47d5a7,_0x4754ab){if(_0x47d5a7)return _0x22769b(_0x47d5a7);return _0x3f6d2e(_0x4754ab);});})['then'](function(){return new BPromise(function(_0x38a6db,_0x582f61){rimraf(_0x5db8b3,function(_0x4cb0d0){if(_0x4cb0d0)_0x582f61(_0x4cb0d0);return _0x38a6db();});});})[_0x71d5('0x27')](function(){return _0x50beba[_0x71d5('0xc1')](_0xe78349,_0x2650b8,function(_0x39c85b){if(_0x39c85b){console['log'](_0x71d5('0xe9'),_0x39c85b);}else{fs['unlinkSync'](_0xe78349);}});});});}else{return _0x50beba[_0x71d5('0x1c')](0xc8);}})['catch'](handleError(_0x50beba,null));}; \ No newline at end of file +var _0x5b1b=['omit','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','attachments','User','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','closed','closedAt','threadId','Public','Private','existsSync','pipe','createWriteStream','out','firstName','basename','renderFile','root','views','transcript-','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','start','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','merge','a.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','include','options','describe','addMessage','OpenchannelMessage','ids'];(function(_0x2b56a2,_0x1f9f59){var _0x1f59cc=function(_0x40d118){while(--_0x40d118){_0x2b56a2['push'](_0x2b56a2['shift']());}};_0x1f59cc(++_0x1f9f59);}(_0x5b1b,0x116));var _0xb5b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b1b[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5b1('0x0'));var zipdir=require(_0xb5b1('0x1'));var jsonpatch=require(_0xb5b1('0x2'));var rp=require(_0xb5b1('0x3'));var moment=require(_0xb5b1('0x4'));var BPromise=require(_0xb5b1('0x5'));var Mustache=require(_0xb5b1('0x6'));var util=require(_0xb5b1('0x7'));var path=require(_0xb5b1('0x8'));var sox=require(_0xb5b1('0x9'));var csv=require('to-csv');var ejs=require(_0xb5b1('0xa'));var fs=require('fs');var fs_extra=require(_0xb5b1('0xb'));var _=require('lodash');var squel=require(_0xb5b1('0xc'));var crypto=require(_0xb5b1('0xd'));var jsforce=require(_0xb5b1('0xe'));var deskjs=require(_0xb5b1('0xf'));var toCsv=require(_0xb5b1('0x10'));var querystring=require('querystring');var Papa=require(_0xb5b1('0x11'));var Redis=require(_0xb5b1('0x12'));var authService=require(_0xb5b1('0x13'));var qs=require(_0xb5b1('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xb5b1('0x15'));var hardwareService=require(_0xb5b1('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xb5b1('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb5b1('0x18'))['db'];config[_0xb5b1('0x19')]=_[_0xb5b1('0x1a')](config['redis'],{'host':_0xb5b1('0x1b'),'port':0x18eb});var socket=require(_0xb5b1('0x1c'))(new Redis(config[_0xb5b1('0x19')]));require('./openchannelInteraction.socket')[_0xb5b1('0x1d')](socket);function respondWithStatusCode(_0x11d1b1,_0x162dd1){_0x162dd1=_0x162dd1||0xcc;return function(_0x529dfa){if(_0x529dfa){return _0x11d1b1[_0xb5b1('0x1e')](_0x162dd1);}return _0x11d1b1[_0xb5b1('0x1f')](_0x162dd1)[_0xb5b1('0x20')]();};}function respondWithResult(_0x213309,_0x314c36){_0x314c36=_0x314c36||0xc8;return function(_0x4c3f77){if(_0x4c3f77){return _0x213309[_0xb5b1('0x1f')](_0x314c36)['json'](_0x4c3f77);}};}function respondWithFilteredResult(_0x3a8b41,_0x2a4e52){return function(_0x5450ca){if(_0x5450ca){var _0x39e11c=typeof _0x2a4e52[_0xb5b1('0x21')]===_0xb5b1('0x22')&&typeof _0x2a4e52[_0xb5b1('0x23')]===_0xb5b1('0x22');var _0x246a83=_0x5450ca[_0xb5b1('0x24')];var _0x1e880c=_0x39e11c?0x0:_0x2a4e52[_0xb5b1('0x21')];var _0x5a7b9f=_0x39e11c?_0x5450ca[_0xb5b1('0x24')]:_0x2a4e52[_0xb5b1('0x21')]+_0x2a4e52[_0xb5b1('0x23')];var _0x340515;if(_0x5a7b9f>=_0x246a83){_0x5a7b9f=_0x246a83;_0x340515=0xc8;}else{_0x340515=0xce;}_0x3a8b41[_0xb5b1('0x1f')](_0x340515);return _0x3a8b41['set'](_0xb5b1('0x25'),_0x1e880c+'-'+_0x5a7b9f+'/'+_0x246a83)['json'](_0x5450ca);}return null;};}function patchUpdates(_0x501c0f){return function(_0x52548c){try{jsonpatch['apply'](_0x52548c,_0x501c0f,!![]);}catch(_0x40a7eb){return BPromise[_0xb5b1('0x26')](_0x40a7eb);}return _0x52548c[_0xb5b1('0x27')]();};}function saveUpdates(_0x5580fe,_0x537b39){return function(_0xd83b39){if(_0xd83b39){return _0xd83b39[_0xb5b1('0x28')](_0x5580fe)[_0xb5b1('0x29')](function(_0x353b43){return _0x353b43;});}return null;};}function removeEntity(_0x4c981c,_0xa6eed6){return function(_0x2b2496){if(_0x2b2496){return _0x2b2496[_0xb5b1('0x2a')]()['then'](function(){_0x4c981c[_0xb5b1('0x1f')](0xcc)[_0xb5b1('0x20')]();});}};}function handleEntityNotFound(_0x330bc,_0x43e056){return function(_0x293f7a){if(!_0x293f7a){_0x330bc['sendStatus'](0x194);}return _0x293f7a;};}function handleError(_0x32c49a,_0x3a2699){_0x3a2699=_0x3a2699||0x1f4;return function(_0x52a67f){logger[_0xb5b1('0x2b')](_0x52a67f[_0xb5b1('0x2c')]);if(_0x52a67f[_0xb5b1('0x2d')]){delete _0x52a67f['name'];}_0x32c49a[_0xb5b1('0x1f')](_0x3a2699)[_0xb5b1('0x2e')](_0x52a67f);};}function getInteractionUsers(_0x2d5ac2,_0x4ac4b5){return new BPromise(function(_0x30cd6e,_0x3104fe){try{if(_0x4ac4b5[_0x2d5ac2['id']]){_0x2d5ac2[_0xb5b1('0x2f')]=_[_0xb5b1('0x30')](_0x4ac4b5[_0x2d5ac2['id']],function(_0x51f1b7){return{'id':_0x51f1b7['id'],'fullname':_0x51f1b7[_0xb5b1('0x31')]};});}}catch(_0x55d7b0){_0x3104fe(_0x55d7b0);}_0x30cd6e(_0x2d5ac2);});}function getInteractionTags(_0x3ff4f7,_0x8b9d3d){return new BPromise(function(_0xb51eeb,_0x217825){try{if(_0x3ff4f7[_0xb5b1('0x32')]){_0x3ff4f7[_0xb5b1('0x33')]=[];_0x3ff4f7[_0xb5b1('0x32')][_0xb5b1('0x34')](',')[_0xb5b1('0x35')](function(_0x219c09){_0x3ff4f7[_0xb5b1('0x33')][_0xb5b1('0x36')](_0x8b9d3d[_0x219c09]);});}delete _0x3ff4f7[_0xb5b1('0x32')];}catch(_0x2661ec){_0x217825(_0x2661ec);}_0xb51eeb(_0x3ff4f7);});}function updateOpenchannelInteraction(_0x518d26,_0x205ef3,_0xf26b68){return new BPromise(function(_0x28303e,_0x2b8001){return getInteractionUsers(_0x518d26,_0xf26b68)['then'](function(_0x4d73b5){return getInteractionTags(_0x4d73b5,_0x205ef3);})[_0xb5b1('0x29')](function(_0x396e1e){_0x28303e(_0x396e1e);})[_0xb5b1('0x37')](function(_0x460615){_0x2b8001(_0x460615);});});}exports[_0xb5b1('0x38')]=function(_0x48d601,_0x11efa5){var _0x3c0f8a={},_0x774ae={},_0x50ca60={'count':0x0,'rows':[]};var _0x4bc818=_[_0xb5b1('0x30')](db[_0xb5b1('0x39')][_0xb5b1('0x3a')],function(_0x4a970d){return{'name':_0x4a970d['fieldName'],'type':_0x4a970d[_0xb5b1('0x3b')][_0xb5b1('0x3c')]};});_0x774ae[_0xb5b1('0x3d')]=_[_0xb5b1('0x30')](_0x4bc818,'name');_0x774ae[_0xb5b1('0x3e')]=_[_0xb5b1('0x3f')](_0x48d601[_0xb5b1('0x3e')]);_0x774ae[_0xb5b1('0x40')]=_[_0xb5b1('0x41')](_0x774ae[_0xb5b1('0x3d')],_0x774ae[_0xb5b1('0x3e')]);_0x3c0f8a[_0xb5b1('0x42')]=_['intersection'](_0x774ae[_0xb5b1('0x3d')],qs[_0xb5b1('0x43')](_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x43')]));_0x3c0f8a[_0xb5b1('0x42')]=_0x3c0f8a[_0xb5b1('0x42')][_0xb5b1('0x44')]?_0x3c0f8a['attributes']:_0x774ae['model'];if(!_0x48d601[_0xb5b1('0x3e')]['hasOwnProperty'](_0xb5b1('0x45'))){_0x3c0f8a[_0xb5b1('0x23')]=qs[_0xb5b1('0x23')](_0x48d601[_0xb5b1('0x3e')]['limit']);_0x3c0f8a[_0xb5b1('0x21')]=qs[_0xb5b1('0x21')](_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x21')]);}_0x3c0f8a['order']=qs['sort'](_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x46')]);_0x3c0f8a[_0xb5b1('0x47')]=qs[_0xb5b1('0x40')](_[_0xb5b1('0x48')](_0x48d601[_0xb5b1('0x3e')],_0x774ae[_0xb5b1('0x40')]),_0x4bc818);var _0x4b0ce3=[];var _0x12fc4e=squel[_0xb5b1('0x49')]()[_0xb5b1('0x4a')]('id')[_0xb5b1('0x4a')](_0xb5b1('0x2d'))[_0xb5b1('0x4a')](_0xb5b1('0x4b'))[_0xb5b1('0x4c')](_0xb5b1('0x4d'));var _0x32245c=squel[_0xb5b1('0x49')]()['field'](_0xb5b1('0x4e'))[_0xb5b1('0x4a')](_0xb5b1('0x4f'))[_0xb5b1('0x4a')]('ui.OpenchannelInteractionId')[_0xb5b1('0x4c')](_0xb5b1('0x50'),'ui')[_0xb5b1('0x51')](_0xb5b1('0x52'),'u',_0xb5b1('0x53'));var _0x2d1566=squel[_0xb5b1('0x49')]()['from'](_0xb5b1('0x54'),'i')['left_join'](_0xb5b1('0x55'),'c',_0xb5b1('0x56'))['left_join'](_0xb5b1('0x52'),'o',_0xb5b1('0x57'))[_0xb5b1('0x51')]('openchannel_accounts','a',_0xb5b1('0x58'))[_0xb5b1('0x51')](_0xb5b1('0x59'),'me',_0xb5b1('0x5a'))['left_join'](_0xb5b1('0x5b'),'it',_0xb5b1('0x5c'))[_0xb5b1('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3699f9=squel[_0xb5b1('0x5d')]();var _0x27db4f=[];var _0x4f1254=squel[_0xb5b1('0x5d')]();var _0xf0a5b1;if(_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x5e')]){_0xf0a5b1=as[_0xb5b1('0x5f')](_0x48d601['query'][_0xb5b1('0x5e')]);var _0x4b5173=_0xf0a5b1[_0xb5b1('0x60')];for(var _0x35ea8a=0x0;_0x35ea8a<_0xf0a5b1[_0xb5b1('0x61')]['length'];_0x35ea8a++){var _0x24a460=_0xf0a5b1[_0xb5b1('0x61')][_0x35ea8a];var _0x3df8c3='i';var _0x34c81f=_[_0xb5b1('0x62')](_0x4bc818,[_0xb5b1('0x2d'),_0x24a460[_0xb5b1('0x4a')]]);if(!_0x34c81f){switch(_0x24a460[_0xb5b1('0x4a')]){case'unreadMessages':if(_0x24a460[_0xb5b1('0x63')]==0x1){_0x2d1566[_0xb5b1('0x64')]('`'+_0x24a460[_0xb5b1('0x4a')]+_0xb5b1('0x65'));}else{_0x2d1566[_0xb5b1('0x64')]('`'+_0x24a460[_0xb5b1('0x4a')]+_0xb5b1('0x66'));}break;case _0xb5b1('0x67'):if(_0x24a460[_0xb5b1('0x68')]==='$substring'){if(_0x24a460['value']['split']('\x20')[_0xb5b1('0x44')]>0x1){_0x3699f9[_0x4b5173](_0xb5b1('0x69'),qs[_0xb5b1('0x6a')](_0x24a460[_0xb5b1('0x63')]),null);}else{var _0x39ec23='%'+_0x24a460['value']+'%';_0x3699f9[_0x4b5173]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x39ec23,_0x39ec23,_0x39ec23);}}else{_0x34c81f=_['find'](_0x4bc818,[_0xb5b1('0x2d'),_0xb5b1('0x6b')]);_0x24a460[_0xb5b1('0x4a')]=_0xb5b1('0x6b');_0x1809ee=as[_0xb5b1('0x6c')](_0x3df8c3,_0x34c81f[_0xb5b1('0x3b')],_0x24a460);_0x3699f9[_0x4b5173](_0x1809ee[_0xb5b1('0x6d')],_0x1809ee['value']['start'],_0x1809ee[_0xb5b1('0x63')][_0xb5b1('0x20')]);}break;case _0xb5b1('0x6e'):var _0xc40a33=_0x24a460[_0xb5b1('0x63')]['split'](',')['map'](function(_0x3a7620){return Number(_0x3a7620);});_0xc40a33[_0xb5b1('0x35')](function(_0xff385d){_0x4f1254['or'](_0xb5b1('0x6f'),'%,'+_0xff385d+',%');});_0x27db4f=_[_0xb5b1('0x70')](_0x27db4f,_0xc40a33);break;case'User':if(_0x24a460['operator']===_0xb5b1('0x71')){_0x3699f9[_0x4b5173]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x24a460[_0xb5b1('0x63')]+'%',null);}else{_0x34c81f=_[_0xb5b1('0x62')](_0x4bc818,[_0xb5b1('0x2d'),'UserId']);_0x24a460[_0xb5b1('0x4a')]='UserId';_0x1809ee=as['buildExpression'](_0x3df8c3,_0x34c81f['type'],_0x24a460);_0x3699f9[_0x4b5173](_0x1809ee[_0xb5b1('0x6d')],_0x1809ee[_0xb5b1('0x63')][_0xb5b1('0x72')],_0x1809ee[_0xb5b1('0x63')]['end']);}break;case _0xb5b1('0x73'):_0x1809ee=as['buildExpression']('me',null,_0x24a460);_0x3699f9[_0x4b5173](_0x1809ee[_0xb5b1('0x6d')],_0x1809ee[_0xb5b1('0x63')]['start'],_0x1809ee['value'][_0xb5b1('0x20')]);break;}}else{var _0x1809ee=as[_0xb5b1('0x6c')](_0x3df8c3,_0x34c81f['type'],_0x24a460);_0x3699f9[_0x4b5173](_0x1809ee[_0xb5b1('0x6d')],_0x1809ee[_0xb5b1('0x63')][_0xb5b1('0x72')],_0x1809ee['value'][_0xb5b1('0x20')]);}}}else{var _0x3479ae=_(_0x48d601[_0xb5b1('0x3e')])[_0xb5b1('0x3f')]()[_0xb5b1('0x30')](function(_0x2f47e4){return _[_0xb5b1('0x74')](_0x4bc818,[_0xb5b1('0x2d'),_0x2f47e4])?_0x2f47e4:undefined;})[_0xb5b1('0x75')]()[_0xb5b1('0x63')]();if(!_['isEmpty'](_0x3479ae)){_0x3479ae['forEach'](function(_0x1fe39c){if(_0x1fe39c===_0xb5b1('0x76')){_0x2d1566[_0xb5b1('0x47')](_0xb5b1('0x77'),[][_0xb5b1('0x78')](_0x48d601[_0xb5b1('0x3e')][_0x1fe39c]));}else if(_0x1fe39c===_0xb5b1('0x79')){var _0x1f00c6=JSON[_0xb5b1('0x7a')](_0x48d601[_0xb5b1('0x3e')][_0x1fe39c])[_0xb5b1('0x7b')];var _0x390923=JSON[_0xb5b1('0x7a')](_0x48d601[_0xb5b1('0x3e')][_0x1fe39c])['$lte'];_0x2d1566[_0xb5b1('0x47')](_0xb5b1('0x7c'),_0x1f00c6,_0x390923);}else{if(_0x48d601[_0xb5b1('0x3e')][_0x1fe39c]===_0xb5b1('0x7d')){_0x2d1566[_0xb5b1('0x47')]('i.'+_0x1fe39c+_0xb5b1('0x7e'));}else{_0x2d1566[_0xb5b1('0x47')]('i.'+_0x1fe39c+_0xb5b1('0x7f'),_0x48d601[_0xb5b1('0x3e')][_0x1fe39c]);}}});}if(_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x80')]){if(_0x48d601[_0xb5b1('0x3e')]['read']==0x1){_0x2d1566['having'](_0xb5b1('0x81'));}else{_0x2d1566['having'](_0xb5b1('0x82'));}}if(_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x83')]){_0x27db4f=_[_0xb5b1('0x84')](_0x48d601['query'][_0xb5b1('0x83')])?_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x83')]:new Array(_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x83')]);_0x27db4f[_0xb5b1('0x35')](function(_0x3cd19a){_0x4f1254['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3cd19a+',%');});}if(_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x85')]){var _0x4f2896=_0x48d601['query'][_0xb5b1('0x85')][_0xb5b1('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4f2896)){_0x3699f9['or']('i.id\x20LIKE\x20?',_0x4f2896+'%');}else{_0x3699f9['or'](_0xb5b1('0x87'),qs[_0xb5b1('0x6a')](_0x4f2896))['or'](_0xb5b1('0x88'),_0x4f2896+'%')['or'](_0xb5b1('0x89'),_0x4f2896+'%');}}}_0x2d1566[_0xb5b1('0x47')](_0x3699f9);_0x2d1566['group']('i.id');var _0x426a10={'type':db[_0xb5b1('0x8a')][_0xb5b1('0x8b')]['SELECT'],'raw':!![]};var _0x25d84b=_0x2d1566['clone']();_0x25d84b['field'](_0xb5b1('0x8c'));_0x25d84b[_0xb5b1('0x4a')](_0xb5b1('0x8d'),_0xb5b1('0x8e'));if(_0x3c0f8a['order']){_0x3c0f8a['order'][_0xb5b1('0x35')](function(_0x266f0f){var _0x5baeef=_0x266f0f[0x0]===_0xb5b1('0x8f')?_0x266f0f[0x0]:'i.'+_0x266f0f[0x0];_0x2d1566[_0xb5b1('0x90')](_0x5baeef,_0x266f0f[0x1]===_0xb5b1('0x91')?![]:!![]);});}if(!_[_0xb5b1('0x92')](_0x27db4f)){_0x2d1566[_0xb5b1('0x64')](_0x4f1254);_0x25d84b[_0xb5b1('0x47')](_0xb5b1('0x93'),_0x27db4f);}BPromise[_0xb5b1('0x94')]()['then'](function(){if(!_0xf0a5b1){if(_0x48d601['query']['OpenchannelAccountId'])return;_0x25d84b[_0xb5b1('0x47')](_0xb5b1('0x95'));_0x2d1566[_0xb5b1('0x47')](_0xb5b1('0x95'));return;}if(_0x48d601[_0xb5b1('0x96')]['role']!==_0xb5b1('0x97'))return;return _0x48d601[_0xb5b1('0x96')][_0xb5b1('0x98')]({'attributes':['id'],'raw':!![]})[_0xb5b1('0x29')](function(_0x44b998){if(_[_0xb5b1('0x92')](_0x44b998)){_0x25d84b[_0xb5b1('0x47')](_0xb5b1('0x99'));_0x2d1566[_0xb5b1('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x25d84b[_0xb5b1('0x47')](_0xb5b1('0x77'),_[_0xb5b1('0x30')](_0x44b998,'id'));_0x2d1566[_0xb5b1('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xb5b1('0x30')](_0x44b998,'id'));}});})['then'](function(){if(_0x48d601[_0xb5b1('0x96')][_0xb5b1('0x9a')]==='agent'&&!_0xf0a5b1&&!_0x48d601['query']['OpenchannelAccountId'])return[];return db[_0xb5b1('0x9b')][_0xb5b1('0x3e')](_0x25d84b[_0xb5b1('0x9c')](),_0x426a10);})['then'](function(_0x592b88){_0x50ca60['count']=_0x592b88[_0xb5b1('0x44')];if(_0x50ca60['count']===0x0)return[];return db[_0xb5b1('0x9b')]['query'](_0x12fc4e[_0xb5b1('0x9c')](),_0x426a10)[_0xb5b1('0x29')](function(_0x1fcb1e){_0x4b0ce3=_['keyBy'](_0x1fcb1e,'id');_0x426a10=_[_0xb5b1('0x9d')](_0x426a10,{'model':db[_0xb5b1('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48d601[_0xb5b1('0x3e')][_0xb5b1('0x43')]){_0x3c0f8a[_0xb5b1('0x42')][_0xb5b1('0x35')](function(_0x481e90){_0x2d1566['field']('i.'+_0x481e90);});}else{_0x2d1566['field'](_0xb5b1('0x8d'),_0xb5b1('0x8e'));_0x2d1566['field'](_0xb5b1('0x9e'),'Account.key');_0x2d1566[_0xb5b1('0x4a')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2d1566['field'](_0xb5b1('0x9f'),'contactName');_0x2d1566[_0xb5b1('0x4a')](_0xb5b1('0xa0'));_0x2d1566[_0xb5b1('0x4a')]('c.firstName',_0xb5b1('0xa1'));_0x2d1566[_0xb5b1('0x4a')](_0xb5b1('0xa2'),_0xb5b1('0xa3'));_0x2d1566[_0xb5b1('0x4a')](_0xb5b1('0xa4'),'Contact.email');_0x2d1566[_0xb5b1('0x4a')](_0xb5b1('0xa5'),_0xb5b1('0xa6'));_0x2d1566[_0xb5b1('0x4a')](_0xb5b1('0xa7'),_0xb5b1('0xa8'));_0x2d1566['field'](_0xb5b1('0xa9'),_0xb5b1('0xaa'));_0x2d1566['field'](_0xb5b1('0xab'),'Owner.fullname');_0x2d1566[_0xb5b1('0x4a')](_0xb5b1('0xac'),_0xb5b1('0xad'));_0x2d1566[_0xb5b1('0x4a')](_0xb5b1('0xae'),_0xb5b1('0x32'));}if(_0x3c0f8a['limit'])_0x2d1566['limit'](_0x3c0f8a[_0xb5b1('0x23')]);if(_0x3c0f8a['offset'])_0x2d1566[_0xb5b1('0x21')](_0x3c0f8a[_0xb5b1('0x21')]);return db[_0xb5b1('0x9b')][_0xb5b1('0x3e')](_0x2d1566[_0xb5b1('0x9c')](),_0x426a10);})[_0xb5b1('0x29')](function(_0x4cbfd1){if(_0x4cbfd1['length']>0x0)_0x32245c[_0xb5b1('0x47')](_0xb5b1('0xaf'),_['map'](_0x4cbfd1,'id'));return db['sequelize'][_0xb5b1('0x3e')](_0x32245c[_0xb5b1('0x9c')](),_0x426a10)['then'](function(_0x4a0436){var _0x438e27=_[_0xb5b1('0xb0')](_0x4a0436,_0xb5b1('0xb1'));var _0x28b91c=[];_0x4cbfd1[_0xb5b1('0x35')](function(_0x329c52){_0x28b91c['push'](updateOpenchannelInteraction(_0x329c52,_0x4b0ce3,_0x438e27));});return BPromise['all'](_0x28b91c);});});})[_0xb5b1('0x29')](function(_0x31d427){_0x50ca60[_0xb5b1('0xb2')]=_0x31d427;return _0x50ca60;})[_0xb5b1('0x29')](respondWithFilteredResult(_0x11efa5,_0x3c0f8a))[_0xb5b1('0x37')](handleError(_0x11efa5,null));};exports[_0xb5b1('0xb3')]=function(_0x234ea4,_0x3844e4){var _0x3bbcf8={};if(_0x234ea4[_0xb5b1('0x3e')][_0xb5b1('0x3b')]&&_0x234ea4[_0xb5b1('0x3e')][_0xb5b1('0x3b')]===_0xb5b1('0x4c')){_0x3bbcf8[_0xb5b1('0x4c')]=_0x234ea4[_0xb5b1('0xb4')]['id'];}else{_0x3bbcf8['id']=_0x234ea4[_0xb5b1('0xb4')]['id'];}var _0x1b3e03={'raw':![],'where':_0x3bbcf8},_0x476dc8={};_0x476dc8['model']=_['keys'](db['OpenchannelInteraction'][_0xb5b1('0x3a')]);_0x476dc8[_0xb5b1('0x3e')]=_[_0xb5b1('0x3f')](_0x234ea4['query']);_0x476dc8[_0xb5b1('0x40')]=_[_0xb5b1('0x41')](_0x476dc8[_0xb5b1('0x3d')],_0x476dc8[_0xb5b1('0x3e')]);_0x1b3e03[_0xb5b1('0x42')]=_[_0xb5b1('0x41')](_0x476dc8[_0xb5b1('0x3d')],qs['fields'](_0x234ea4[_0xb5b1('0x3e')]['fields']));_0x1b3e03[_0xb5b1('0x42')]=_0x1b3e03['attributes'][_0xb5b1('0x44')]?_0x1b3e03[_0xb5b1('0x42')]:_0x476dc8[_0xb5b1('0x3d')];if(_0x234ea4[_0xb5b1('0x3e')][_0xb5b1('0xb5')]){_0x1b3e03[_0xb5b1('0xb6')]=[{'all':!![]}];}_0x1b3e03=_['merge']({},_0x1b3e03,_0x234ea4[_0xb5b1('0xb7')]);return db[_0xb5b1('0x39')][_0xb5b1('0x62')](_0x1b3e03)[_0xb5b1('0x29')](handleEntityNotFound(_0x3844e4,null))['then'](respondWithResult(_0x3844e4,null))[_0xb5b1('0x37')](handleError(_0x3844e4,null));};exports['create']=function(_0x59fa60,_0xd426d1){return db[_0xb5b1('0x39')]['create'](_0x59fa60[_0xb5b1('0x73')],{})[_0xb5b1('0x29')](respondWithResult(_0xd426d1,0xc9))[_0xb5b1('0x37')](handleError(_0xd426d1,null));};exports[_0xb5b1('0x28')]=function(_0x1123bf,_0x38b1cb){if(_0x1123bf[_0xb5b1('0x73')]['id']){delete _0x1123bf['body']['id'];}return db[_0xb5b1('0x39')][_0xb5b1('0x62')]({'where':{'id':_0x1123bf[_0xb5b1('0xb4')]['id']}})[_0xb5b1('0x29')](handleEntityNotFound(_0x38b1cb,null))[_0xb5b1('0x29')](saveUpdates(_0x1123bf['body'],null))[_0xb5b1('0x29')](respondWithResult(_0x38b1cb,null))['catch'](handleError(_0x38b1cb,null));};exports[_0xb5b1('0x2a')]=function(_0x378277,_0x5f1463){return db[_0xb5b1('0x39')][_0xb5b1('0x62')]({'where':{'id':_0x378277[_0xb5b1('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5f1463,null))[_0xb5b1('0x29')](removeEntity(_0x5f1463,null))[_0xb5b1('0x37')](handleError(_0x5f1463,null));};exports['describe']=function(_0x2acd84,_0x5bb6ca){return db[_0xb5b1('0x39')][_0xb5b1('0xb8')]()[_0xb5b1('0x29')](respondWithResult(_0x5bb6ca,null))[_0xb5b1('0x37')](handleError(_0x5bb6ca,null));};exports[_0xb5b1('0xb9')]=function(_0x211c5f,_0x4b1f85,_0x2eec06){return db[_0xb5b1('0xba')]['find']({'where':{'id':_0x211c5f[_0xb5b1('0xb4')]['id']}})[_0xb5b1('0x29')](handleEntityNotFound(_0x4b1f85,null))['then'](function(_0x5e4f29){if(_0x5e4f29){return _0x5e4f29['addMessage'](_0x211c5f[_0xb5b1('0x73')][_0xb5b1('0xbb')],_[_0xb5b1('0xbc')](_0x211c5f[_0xb5b1('0x73')],[_0xb5b1('0xbb'),'id'])||{});}})[_0xb5b1('0x29')](respondWithResult(_0x4b1f85,null))[_0xb5b1('0x37')](handleError(_0x4b1f85,null));};exports[_0xb5b1('0xbd')]=function(_0x1c4fa8,_0x57d17a,_0x47a945){var _0x5129ef={'raw':![],'where':{}};var _0x161ca7={};var _0x17e0f5={'count':0x0,'rows':[]};return db[_0xb5b1('0x39')]['findOne']({'where':{'id':_0x1c4fa8[_0xb5b1('0xb4')]['id']}})[_0xb5b1('0x29')](handleEntityNotFound(_0x57d17a,null))[_0xb5b1('0x29')](function(_0x23a1ef){if(_0x23a1ef){_0x161ca7[_0xb5b1('0x3d')]=_[_0xb5b1('0x3f')](db[_0xb5b1('0xba')][_0xb5b1('0x3a')]);_0x161ca7['query']=_[_0xb5b1('0x3f')](_0x1c4fa8[_0xb5b1('0x3e')]);_0x161ca7[_0xb5b1('0x40')]=_[_0xb5b1('0x41')](_0x161ca7[_0xb5b1('0x3d')],_0x161ca7[_0xb5b1('0x3e')]);_0x5129ef[_0xb5b1('0x42')]=_[_0xb5b1('0x41')](_0x161ca7[_0xb5b1('0x3d')],qs[_0xb5b1('0x43')](_0x1c4fa8[_0xb5b1('0x3e')][_0xb5b1('0x43')]));_0x5129ef[_0xb5b1('0x42')]=_0x5129ef[_0xb5b1('0x42')][_0xb5b1('0x44')]?_0x5129ef['attributes']:_0x161ca7['model'];if(!_0x1c4fa8[_0xb5b1('0x3e')][_0xb5b1('0xbe')](_0xb5b1('0x45'))){_0x5129ef[_0xb5b1('0x23')]=qs['limit'](_0x1c4fa8['query']['limit']);_0x5129ef['offset']=qs['offset'](_0x1c4fa8[_0xb5b1('0x3e')][_0xb5b1('0x21')]);}_0x5129ef[_0xb5b1('0x90')]=qs[_0xb5b1('0x46')](_0x1c4fa8[_0xb5b1('0x3e')][_0xb5b1('0x46')]);_0x5129ef[_0xb5b1('0x47')]=qs[_0xb5b1('0x40')](_[_0xb5b1('0x48')](_0x1c4fa8[_0xb5b1('0x3e')],_0x161ca7['filters']));_0x5129ef[_0xb5b1('0x47')][_0xb5b1('0xb1')]=_0x23a1ef['id'];if(_0x1c4fa8['query'][_0xb5b1('0x85')]){_0x5129ef[_0xb5b1('0x47')]=_[_0xb5b1('0x9d')](_0x5129ef[_0xb5b1('0x47')],{'$or':_[_0xb5b1('0x30')](_0x5129ef[_0xb5b1('0x42')],function(_0x2614de){var _0x108ec8={};_0x108ec8[_0x2614de]={'$like':'%'+_0x1c4fa8[_0xb5b1('0x3e')]['filter']+'%'};return _0x108ec8;})});}if(_0x1c4fa8[_0xb5b1('0x3e')]['$gte']){var _0x43b3e2=_0x1c4fa8[_0xb5b1('0x3e')]['$gte'][_0xb5b1('0x34')](',');var _0xfdd160={};_0xfdd160[_0x43b3e2[0x0]]={'$gte':moment(_0x43b3e2[0x1])[_0xb5b1('0xbf')](_0xb5b1('0xc0'))};_0x5129ef['where']=_[_0xb5b1('0x9d')](_0x5129ef['where'],_0xfdd160);}_0x5129ef=_[_0xb5b1('0x9d')]({},_0x5129ef,_0x1c4fa8[_0xb5b1('0xb7')]);return db[_0xb5b1('0xba')]['count']({'where':_0x5129ef[_0xb5b1('0x47')]})[_0xb5b1('0x29')](function(_0x5a0549){_0x17e0f5[_0xb5b1('0x24')]=_0x5a0549;if(_0x1c4fa8[_0xb5b1('0x3e')][_0xb5b1('0xb5')]){_0x5129ef[_0xb5b1('0xb6')]=[{'all':!![]}];}return db[_0xb5b1('0xba')][_0xb5b1('0xc1')](_0x5129ef);})[_0xb5b1('0x29')](function(_0xef4e48){_0x17e0f5['rows']=_0xef4e48;return _0x17e0f5;});}})[_0xb5b1('0x29')](respondWithFilteredResult(_0x57d17a,_0x5129ef))['catch'](handleError(_0x57d17a,null));};exports['addTags']=function(_0x3bb795,_0x169532,_0x45d175){return db[_0xb5b1('0x39')][_0xb5b1('0x62')]({'where':{'id':_0x3bb795[_0xb5b1('0xb4')]['id']}})[_0xb5b1('0x29')](handleEntityNotFound(_0x169532,null))[_0xb5b1('0x29')](function(_0x877e6d){if(_0x877e6d){return _0x877e6d[_0xb5b1('0xc2')](_0x3bb795[_0xb5b1('0x73')][_0xb5b1('0xbb')],_[_0xb5b1('0xbc')](_0x3bb795[_0xb5b1('0x73')],[_0xb5b1('0xbb'),'id'])||{})[_0xb5b1('0xc3')](function(){return db['Tag'][_0xb5b1('0xc1')]({'attributes':['id',_0xb5b1('0x2d'),_0xb5b1('0x4b')],'where':{'id':_0x3bb795[_0xb5b1('0x73')][_0xb5b1('0xbb')]}});})[_0xb5b1('0x29')](function(_0x4e3b11){socket[_0xb5b1('0xc4')](_0xb5b1('0xc5'),{'id':Number(_0x3bb795[_0xb5b1('0xb4')]['id']),'tags':_0x4e3b11||[]});return{'id':Number(_0x3bb795[_0xb5b1('0xb4')]['id']),'tags':_0x4e3b11||[]};});}})[_0xb5b1('0x29')](respondWithResult(_0x169532,null))[_0xb5b1('0x37')](handleError(_0x169532,null));};exports[_0xb5b1('0xc6')]=function(_0x239bd9,_0x29c1c5,_0x53a894){return db[_0xb5b1('0x39')][_0xb5b1('0x62')]({'where':{'id':_0x239bd9[_0xb5b1('0xb4')]['id']}})['then'](handleEntityNotFound(_0x29c1c5,null))[_0xb5b1('0x29')](function(_0x8a6700){if(_0x8a6700){return _0x8a6700['removeTags'](_0x239bd9[_0xb5b1('0x3e')][_0xb5b1('0xbb')]);}})[_0xb5b1('0x29')](respondWithStatusCode(_0x29c1c5,null))[_0xb5b1('0x37')](handleError(_0x29c1c5,null));};exports[_0xb5b1('0xc7')]=function(_0x3c886a,_0x4d23e5){var _0x2f1654=moment()[_0xb5b1('0xc8')]()[_0xb5b1('0x9c')]();var _0x4f1e05=path[_0xb5b1('0xc9')](config['root'],_0xb5b1('0xca'),'files','tmp');var _0x388caf=path[_0xb5b1('0xc9')](config['root'],_0xb5b1('0xca'),'files',_0xb5b1('0xcb'));var _0x52d9d2=path[_0xb5b1('0xc9')](_0x4f1e05,_0x2f1654);var _0xb221b3=util[_0xb5b1('0xbf')]('transcript-%d-%s.zip',_0x3c886a[_0xb5b1('0xb4')]['id'],_0x2f1654);var _0x418826=path[_0xb5b1('0xc9')](_0x4f1e05,_0xb221b3);var _0x2af22f=[];_0x2af22f[_0xb5b1('0x36')]({'model':db[_0xb5b1('0xcc')],'as':'User','attributes':['id',_0xb5b1('0x31')],'raw':!![]});_0x2af22f[_0xb5b1('0x36')]({'model':db['CmContact'],'as':_0xb5b1('0x67'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x3c886a[_0xb5b1('0x3e')]['attachments']){_0x2af22f['push']({'model':db['Attachment'],'as':_0xb5b1('0xcd'),'raw':!![]});}var _0x5373ea=[{'model':db[_0xb5b1('0xba')],'as':_0xb5b1('0xce'),'attributes':['id',_0xb5b1('0x73'),_0xb5b1('0x79'),_0xb5b1('0xcf'),_0xb5b1('0xd0'),_0xb5b1('0x80')],'include':_0x2af22f}];_0x5373ea[_0xb5b1('0x36')]({'model':db[_0xb5b1('0xd1')],'as':_0xb5b1('0xd2'),'attributes':['id','name']});_0x5373ea[_0xb5b1('0x36')]({'model':db[_0xb5b1('0xcc')],'as':_0xb5b1('0xd3'),'attributes':['id',_0xb5b1('0x31')]});return db[_0xb5b1('0x39')]['find']({'where':{'id':_0x3c886a[_0xb5b1('0xb4')]['id']},'include':_0x5373ea})['then'](handleEntityNotFound(_0x4d23e5,null))[_0xb5b1('0x29')](function(_0x3bad17){if(_0x3bad17){var _0x42d57e=_0x3bad17[_0xb5b1('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x52d9d2);var _0x32b4ec={'channel':_0xb5b1('0xd5'),'account':_0x42d57e[_0xb5b1('0xd2')]['name'],'agent':_0x42d57e[_0xb5b1('0xd3')]?_0x42d57e[_0xb5b1('0xd3')][_0xb5b1('0x31')]:_0xb5b1('0xd6'),'createdAt':moment(_0x42d57e[_0xb5b1('0x79')])[_0xb5b1('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb5b1('0x9c')](),'closedAt':_0x42d57e[_0xb5b1('0xd7')]?moment(_0x42d57e[_0xb5b1('0xd8')])[_0xb5b1('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb5b1('0x9c')]():'','disposition':_0x42d57e['disposition'],'visibility':_0x42d57e[_0xb5b1('0xd9')]?_0xb5b1('0xda'):_0xb5b1('0xdb'),'messages':_(_0x42d57e[_0xb5b1('0xce')])[_0xb5b1('0x85')]({'secret':![]})[_0xb5b1('0x30')](function(_0x393cb2){if(_0x393cb2[_0xb5b1('0xcd')]){var _0x152fa9=path['join'](_0x388caf,_0x393cb2[_0xb5b1('0xcd')]['basename']);if(fs[_0xb5b1('0xdc')](_0x152fa9)){fs['createReadStream'](_0x152fa9)[_0xb5b1('0xdd')](fs[_0xb5b1('0xde')](path[_0xb5b1('0xc9')](_0x52d9d2,_0x393cb2[_0xb5b1('0xcd')]['basename'])));}}return{'date':moment(_0x393cb2[_0xb5b1('0x79')])[_0xb5b1('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb5b1('0x9c')](),'sender':_0x393cb2[_0xb5b1('0xcf')]===_0xb5b1('0xdf')?_0x393cb2[_0xb5b1('0xcc')]?_0x393cb2['User']['fullname']:'System':_0x393cb2[_0xb5b1('0x67')][_0xb5b1('0xe0')]+(_0x393cb2[_0xb5b1('0x67')]['lastName']?'\x20'+_0x393cb2[_0xb5b1('0x67')]['lastName']:''),'body':_0x393cb2['Attachment']?_0x393cb2[_0xb5b1('0xcd')][_0xb5b1('0xe1')]:_0x393cb2[_0xb5b1('0x73')],'direction':_0x393cb2[_0xb5b1('0xcf')]===_0xb5b1('0xdf')?'A':'C','secret':_0x393cb2['secret'],'read':_0x393cb2['read'],'attachment':_0x393cb2['Attachment']};})['value']()};return ejs[_0xb5b1('0xe2')](path['join'](config[_0xb5b1('0xe3')],'server',_0xb5b1('0xe4'),'downloadInteraction.ejs'),{'interaction':_0x32b4ec})[_0xb5b1('0x29')](function(_0x74b899){var _0x118c2a=path['join'](_0x52d9d2,_0xb5b1('0xe5')+_0x42d57e['id']+'-'+_0x2f1654+'.pdf');var _0x2eab06={'path':_0x118c2a,'channel':_0xb5b1('0xd5'),'interactionId':_0x42d57e['id']};return pdf['createPdfFromHTML'](_0x74b899,_0x2eab06);})[_0xb5b1('0x29')](function(){return new BPromise(function(_0x118e42,_0x4e26de){zipdir(_0x52d9d2,{'saveTo':_0x418826},function(_0x49a247,_0x134e5){if(_0x49a247)return _0x4e26de(_0x49a247);return _0x118e42(_0x134e5);});})[_0xb5b1('0x29')](function(){return new BPromise(function(_0x3f9d08,_0x2335a5){rimraf(_0x52d9d2,function(_0x22d2d0){if(_0x22d2d0)_0x2335a5(_0x22d2d0);return _0x3f9d08();});});})[_0xb5b1('0x29')](function(){return _0x4d23e5['download'](_0x418826,_0xb221b3,function(_0x1dd04f){if(_0x1dd04f){console[_0xb5b1('0xe6')](_0xb5b1('0xe7'),_0x1dd04f);}else{fs[_0xb5b1('0xe8')](_0x418826);}});});});}else{return _0x4d23e5[_0xb5b1('0x1e')](0xc8);}})['catch'](handleError(_0x4d23e5,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 3146705..184d1cd 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 _0x1941=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x871d9a,_0x3d3f72){var _0x31f4dc=function(_0x209dca){while(--_0x209dca){_0x871d9a['push'](_0x871d9a['shift']());}};_0x31f4dc(++_0x3d3f72);}(_0x1941,0x186));var _0x1194=function(_0x192201,_0x3f8f19){_0x192201=_0x192201-0x0;var _0x47936b=_0x1941[_0x192201];return _0x47936b;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x1194('0x0'))['db'][_0x1194('0x1')];var OpenchannelMessage=require(_0x1194('0x0'))['db'][_0x1194('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1194('0x3')](0x0);var events={'afterCreate':_0x1194('0x4'),'afterUpdate':_0x1194('0x5'),'afterDestroy':_0x1194('0x6')};function emitEvent(_0x2670cd){return function(_0x588534,_0x1ca1f2,_0x3e2f94){_0x588534[_0x1194('0x7')]({'attributes':['id'],'raw':!![]})[_0x1194('0x8')](function(_0x369d0c){_0x588534[_0x1194('0x9')](_0x1194('0xa'),_0x369d0c[_0x1194('0xb')](function(_0x2e749c){return{'id':_0x2e749c['id']};}));return OpenchannelMessage[_0x1194('0xc')]({'where':{'OpenchannelInteractionId':_0x588534['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1194('0x8')](function(_0x38d7a5){_0x588534[_0x1194('0x9')](_0x1194('0xd'),_0x38d7a5[_0x1194('0xe')]);OpenchannelInteractionEvents[_0x1194('0xf')](_0x2670cd+':'+_0x588534['id'],_0x588534);OpenchannelInteractionEvents[_0x1194('0xf')](_0x2670cd,_0x588534);_0x3e2f94(null);})[_0x1194('0x10')](_0x3e2f94(null));};}for(var e in events){if(events[_0x1194('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x1194('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xdce8=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users'];(function(_0x14a3cf,_0xae014f){var _0x5bcffb=function(_0x45fdad){while(--_0x45fdad){_0x14a3cf['push'](_0x14a3cf['shift']());}};_0x5bcffb(++_0xae014f);}(_0xdce8,0xc1));var _0x8dce=function(_0x1c1eab,_0x405694){_0x1c1eab=_0x1c1eab-0x0;var _0x1d4ccf=_0xdce8[_0x1c1eab];return _0x1d4ccf;};'use strict';var EventEmitter=require(_0x8dce('0x0'));var OpenchannelInteraction=require(_0x8dce('0x1'))['db'][_0x8dce('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x8dce('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8dce('0x4')](0x0);var events={'afterCreate':_0x8dce('0x5'),'afterUpdate':_0x8dce('0x6'),'afterDestroy':_0x8dce('0x7')};function emitEvent(_0x3bef56){return function(_0x3778e8,_0x5852fa,_0x397ca2){_0x3778e8['getUsers']({'attributes':['id'],'raw':!![]})[_0x8dce('0x8')](function(_0x4a67f2){_0x3778e8[_0x8dce('0x9')](_0x8dce('0xa'),_0x4a67f2['map'](function(_0x47c035){return{'id':_0x47c035['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3778e8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8dce('0x8')](function(_0x4fdecb){_0x3778e8[_0x8dce('0x9')](_0x8dce('0xb'),_0x4fdecb[_0x8dce('0xc')]);OpenchannelInteractionEvents[_0x8dce('0xd')](_0x3bef56+':'+_0x3778e8['id'],_0x3778e8);OpenchannelInteractionEvents[_0x8dce('0xd')](_0x3bef56,_0x3778e8);_0x397ca2(null);})[_0x8dce('0xe')](_0x397ca2(null));};}for(var e in events){if(events[_0x8dce('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x8dce('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a7e9f5f..f75a44b 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 _0x1dbb=['util','../../config/logger','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x22e4e7,_0x50bcf6){var _0x51b621=function(_0x10bb1d){while(--_0x10bb1d){_0x22e4e7['push'](_0x22e4e7['shift']());}};_0x51b621(++_0x50bcf6);}(_0x1dbb,0xed));var _0xb1db=function(_0x47031d,_0x35d7b1){_0x47031d=_0x47031d-0x0;var _0x47cf26=_0x1dbb[_0x47031d];return _0x47cf26;};'use strict';var _=require(_0xb1db('0x0'));var util=require(_0xb1db('0x1'));var logger=require(_0xb1db('0x2'))('api');var moment=require(_0xb1db('0x3'));var BPromise=require(_0xb1db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1db('0x5'));var rimraf=require('rimraf');var config=require(_0xb1db('0x6'));var attributes=require(_0xb1db('0x7'));module['exports']=function(_0x57d1ba,_0x441e7c){return _0x57d1ba[_0xb1db('0x8')](_0xb1db('0x9'),attributes,{'tableName':_0xb1db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb1db('0xb'),'hooks':{'beforeUpdate':function(_0x2ed207,_0x433da7,_0x4823b3){if(_0x2ed207[_0xb1db('0xc')](_0xb1db('0xd'))){_0x2ed207[_0xb1db('0xe')]=moment()[_0xb1db('0xf')](_0xb1db('0x10'));}_0x4823b3(null,_0x2ed207);}}});}; \ No newline at end of file +var _0x904b=['exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1634bf,_0xda08a7){var _0x32643d=function(_0x40e7c2){while(--_0x40e7c2){_0x1634bf['push'](_0x1634bf['shift']());}};_0x32643d(++_0xda08a7);}(_0x904b,0x1ac));var _0xb904=function(_0x76f60a,_0x4e1476){_0x76f60a=_0x76f60a-0x0;var _0x2aea31=_0x904b[_0x76f60a];return _0x2aea31;};'use strict';var _=require(_0xb904('0x0'));var util=require(_0xb904('0x1'));var logger=require(_0xb904('0x2'))(_0xb904('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb904('0x4'));var fs=require('fs');var path=require(_0xb904('0x5'));var rimraf=require(_0xb904('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xb904('0x7')]=function(_0x4ce9ac,_0x51006f){return _0x4ce9ac[_0xb904('0x8')](_0xb904('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb904('0xa'),'collate':_0xb904('0xb'),'hooks':{'beforeUpdate':function(_0x4bd49f,_0x4c0dfa,_0x2298b4){if(_0x4bd49f[_0xb904('0xc')]('closed')){_0x4bd49f['closedAt']=moment()[_0xb904('0xd')](_0xb904('0xe'));}_0x2298b4(null,_0x4bd49f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index cc68b37..99b99c4 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 _0x4b6f=['http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','raw','options','where','attributes','limit','info','catch','AddTagsToOpenchannelInteraction','find','then','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4b6f,0x128));var _0xf4b6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4b6f[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xf4b6('0x0'));var util=require(_0xf4b6('0x1'));var moment=require(_0xf4b6('0x2'));var BPromise=require(_0xf4b6('0x3'));var rs=require(_0xf4b6('0x4'));var fs=require('fs');var Redis=require(_0xf4b6('0x5'));var db=require(_0xf4b6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4b6('0x7'))(_0xf4b6('0x8'));var config=require(_0xf4b6('0x9'));var jayson=require(_0xf4b6('0xa'));var client=jayson[_0xf4b6('0xb')][_0xf4b6('0xc')]({'port':0x232a});config[_0xf4b6('0xd')]=_['defaults'](config['redis'],{'host':_0xf4b6('0xe'),'port':0x18eb});var socket=require(_0xf4b6('0xf'))(new Redis(config[_0xf4b6('0xd')]));require(_0xf4b6('0x10'))[_0xf4b6('0x11')](socket);function respondWithRpcPromise(_0x12a60f,_0x8688f7,_0x1cf8b7){return new BPromise(function(_0x58d329,_0x21432f){return client['request'](_0x12a60f,_0x1cf8b7)['then'](function(_0x414b0f){logger['info'](_0xf4b6('0x12'),_0x8688f7,_0xf4b6('0x13'));logger[_0xf4b6('0x14')](_0xf4b6('0x15'),_0x8688f7,_0xf4b6('0x13'),JSON[_0xf4b6('0x16')](_0x414b0f));if(_0x414b0f['error']){if(_0x414b0f[_0xf4b6('0x17')][_0xf4b6('0x18')]===0x1f4){logger['error'](_0xf4b6('0x12'),_0x8688f7,_0x414b0f[_0xf4b6('0x17')][_0xf4b6('0x19')]);return _0x21432f(_0x414b0f[_0xf4b6('0x17')][_0xf4b6('0x19')]);}logger[_0xf4b6('0x17')](_0xf4b6('0x12'),_0x8688f7,_0x414b0f[_0xf4b6('0x17')][_0xf4b6('0x19')]);return _0x58d329(_0x414b0f[_0xf4b6('0x17')]['message']);}else{logger['info'](_0xf4b6('0x12'),_0x8688f7,_0xf4b6('0x13'));_0x58d329(_0x414b0f[_0xf4b6('0x1a')][_0xf4b6('0x19')]);}})['catch'](function(_0x1882c5){logger[_0xf4b6('0x17')](_0xf4b6('0x12'),_0x8688f7,_0x1882c5);_0x21432f(_0x1882c5);});});}exports[_0xf4b6('0x1b')]=function(_0x10766b){var _0x52f668=this;return new Promise(function(_0x55eb1b,_0x2bf380){return db[_0xf4b6('0x1c')]['update'](_0x10766b['body'],{'raw':_0x10766b['options']?_0x10766b['options'][_0xf4b6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10766b['options']?_0x10766b[_0xf4b6('0x1e')][_0xf4b6('0x1f')]||null:null,'attributes':_0x10766b['options']?_0x10766b[_0xf4b6('0x1e')][_0xf4b6('0x20')]||null:null,'limit':_0x10766b[_0xf4b6('0x1e')]?_0x10766b['options'][_0xf4b6('0x21')]||null:null})['then'](function(_0x34a8ab){logger[_0xf4b6('0x22')](_0xf4b6('0x1b'),_0x10766b);logger[_0xf4b6('0x14')](_0xf4b6('0x1b'),_0x10766b,JSON[_0xf4b6('0x16')](_0x34a8ab));_0x55eb1b(_0x34a8ab);})[_0xf4b6('0x23')](function(_0x2f831a){logger[_0xf4b6('0x17')](_0xf4b6('0x1b'),_0x2f831a[_0xf4b6('0x19')],_0x10766b);_0x2bf380(_0x52f668['error'](0x1f4,_0x2f831a['message']));});});};exports[_0xf4b6('0x24')]=function(_0x2224ef){return new Promise(function(_0x179933,_0x39a4f8){return db[_0xf4b6('0x1c')][_0xf4b6('0x25')]({'where':_0x2224ef[_0xf4b6('0x1e')]?_0x2224ef[_0xf4b6('0x1e')][_0xf4b6('0x1f')]||null:null})[_0xf4b6('0x26')](function(_0x2be334){if(_0x2be334){return _0x2be334['addTags'](_0x2224ef['body'][_0xf4b6('0x27')],_[_0xf4b6('0x28')](_0x2224ef[_0xf4b6('0x29')],[_0xf4b6('0x27'),'id'])||{});}})[_0xf4b6('0x2a')](function(_0x2b2c60){logger['info'](_0xf4b6('0x2b'),_0x2224ef);logger['debug']('AddTags',_0x2224ef,JSON[_0xf4b6('0x16')](_0x2b2c60));_0x179933(_0x2b2c60);})[_0xf4b6('0x23')](function(_0x40356d){logger[_0xf4b6('0x17')](_0xf4b6('0x2b'),_0x40356d[_0xf4b6('0x19')],_0x2224ef);_0x39a4f8(_this[_0xf4b6('0x17')](0x1f4,_0x40356d['message']));});});}; \ No newline at end of file +var _0xfe4b=['options','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','omit','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','OpenchannelInteraction','update','body'];(function(_0x2fd88e,_0x51ff8f){var _0x29d093=function(_0x4c2987){while(--_0x4c2987){_0x2fd88e['push'](_0x2fd88e['shift']());}};_0x29d093(++_0x51ff8f);}(_0xfe4b,0xf9));var _0xbfe4=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xfe4b[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xbfe4('0x0'));var util=require('util');var moment=require(_0xbfe4('0x1'));var BPromise=require(_0xbfe4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfe4('0x3'));var db=require(_0xbfe4('0x4'))['db'];var utils=require(_0xbfe4('0x5'));var logger=require(_0xbfe4('0x6'))(_0xbfe4('0x7'));var config=require('../../config/environment');var jayson=require(_0xbfe4('0x8'));var client=jayson['client'][_0xbfe4('0x9')]({'port':0x232a});config[_0xbfe4('0xa')]=_['defaults'](config[_0xbfe4('0xa')],{'host':_0xbfe4('0xb'),'port':0x18eb});var socket=require(_0xbfe4('0xc'))(new Redis(config[_0xbfe4('0xa')]));require(_0xbfe4('0xd'))[_0xbfe4('0xe')](socket);function respondWithRpcPromise(_0x220556,_0x550fcd,_0xccf841){return new BPromise(function(_0x103d46,_0x3f14a6){return client[_0xbfe4('0xf')](_0x220556,_0xccf841)[_0xbfe4('0x10')](function(_0x1ddb8c){logger[_0xbfe4('0x11')](_0xbfe4('0x12'),_0x550fcd,'request\x20sent');logger[_0xbfe4('0x13')](_0xbfe4('0x14'),_0x550fcd,'request\x20sent',JSON[_0xbfe4('0x15')](_0x1ddb8c));if(_0x1ddb8c[_0xbfe4('0x16')]){if(_0x1ddb8c[_0xbfe4('0x16')][_0xbfe4('0x17')]===0x1f4){logger['error'](_0xbfe4('0x12'),_0x550fcd,_0x1ddb8c[_0xbfe4('0x16')]['message']);return _0x3f14a6(_0x1ddb8c[_0xbfe4('0x16')][_0xbfe4('0x18')]);}logger[_0xbfe4('0x16')](_0xbfe4('0x12'),_0x550fcd,_0x1ddb8c[_0xbfe4('0x16')][_0xbfe4('0x18')]);return _0x103d46(_0x1ddb8c[_0xbfe4('0x16')][_0xbfe4('0x18')]);}else{logger[_0xbfe4('0x11')](_0xbfe4('0x12'),_0x550fcd,_0xbfe4('0x19'));_0x103d46(_0x1ddb8c[_0xbfe4('0x1a')][_0xbfe4('0x18')]);}})[_0xbfe4('0x1b')](function(_0x35af5f){logger[_0xbfe4('0x16')](_0xbfe4('0x12'),_0x550fcd,_0x35af5f);_0x3f14a6(_0x35af5f);});});}exports['UpdateOpenchannelInteraction']=function(_0x321d3e){var _0x4eb49f=this;return new Promise(function(_0xae9e4f,_0x3d39d6){return db[_0xbfe4('0x1c')][_0xbfe4('0x1d')](_0x321d3e[_0xbfe4('0x1e')],{'raw':_0x321d3e[_0xbfe4('0x1f')]?_0x321d3e[_0xbfe4('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x321d3e['options']?_0x321d3e[_0xbfe4('0x1f')][_0xbfe4('0x20')]||null:null,'attributes':_0x321d3e[_0xbfe4('0x1f')]?_0x321d3e[_0xbfe4('0x1f')]['attributes']||null:null,'limit':_0x321d3e[_0xbfe4('0x1f')]?_0x321d3e[_0xbfe4('0x1f')][_0xbfe4('0x21')]||null:null})[_0xbfe4('0x10')](function(_0x143e25){logger[_0xbfe4('0x11')](_0xbfe4('0x22'),_0x321d3e);logger[_0xbfe4('0x13')](_0xbfe4('0x22'),_0x321d3e,JSON['stringify'](_0x143e25));_0xae9e4f(_0x143e25);})[_0xbfe4('0x1b')](function(_0x3533de){logger[_0xbfe4('0x16')]('UpdateOpenchannelInteraction',_0x3533de[_0xbfe4('0x18')],_0x321d3e);_0x3d39d6(_0x4eb49f[_0xbfe4('0x16')](0x1f4,_0x3533de[_0xbfe4('0x18')]));});});};exports[_0xbfe4('0x23')]=function(_0xccb448){return new Promise(function(_0xb43207,_0x21db26){return db['OpenchannelInteraction']['find']({'where':_0xccb448[_0xbfe4('0x1f')]?_0xccb448['options']['where']||null:null})[_0xbfe4('0x10')](function(_0x5e6d12){if(_0x5e6d12){return _0x5e6d12['addTags'](_0xccb448[_0xbfe4('0x1e')]['ids'],_[_0xbfe4('0x24')](_0xccb448['body'],[_0xbfe4('0x25'),'id'])||{});}})[_0xbfe4('0x26')](function(_0x59b191){logger[_0xbfe4('0x11')]('AddTags',_0xccb448);logger[_0xbfe4('0x13')](_0xbfe4('0x27'),_0xccb448,JSON[_0xbfe4('0x15')](_0x59b191));_0xb43207(_0x59b191);})['catch'](function(_0x3bcc8c){logger[_0xbfe4('0x16')](_0xbfe4('0x27'),_0x3bcc8c['message'],_0xccb448);_0x21db26(_this[_0xbfe4('0x16')](0x1f4,_0x3bcc8c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 63db831..7791cf0 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 _0xd821=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0xd821,0x8a));var _0x1d82=function(_0x1a80f4,_0x1de53b){_0x1a80f4=_0x1a80f4-0x0;var _0x55e867=_0xd821[_0x1a80f4];return _0x55e867;};'use strict';var OpenchannelInteractionEvents=require(_0x1d82('0x0'));var events=[_0x1d82('0x1'),_0x1d82('0x2'),_0x1d82('0x3')];function createListener(_0x345404,_0x14ebf4){return function(_0x33dac7){_0x14ebf4[_0x1d82('0x4')](_0x345404,_0x33dac7);};}function removeListener(_0x195be5,_0x5e2d93){return function(){OpenchannelInteractionEvents[_0x1d82('0x5')](_0x195be5,_0x5e2d93);};}exports[_0x1d82('0x6')]=function(_0x25534c){for(var _0x2b3dd3=0x0,_0x27033c=events[_0x1d82('0x7')];_0x2b3dd3<_0x27033c;_0x2b3dd3++){var _0x3b3100=events[_0x2b3dd3];var _0x43cfa3=createListener(_0x1d82('0x8')+_0x3b3100,_0x25534c);OpenchannelInteractionEvents['on'](_0x3b3100,_0x43cfa3);}}; \ No newline at end of file +var _0x6b1a=['emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x1cf4d7,_0x5c9cd8){var _0x4c9053=function(_0x23fde2){while(--_0x23fde2){_0x1cf4d7['push'](_0x1cf4d7['shift']());}};_0x4c9053(++_0x5c9cd8);}(_0x6b1a,0x162));var _0xa6b1=function(_0x2da4a9,_0x344782){_0x2da4a9=_0x2da4a9-0x0;var _0x1ec99e=_0x6b1a[_0x2da4a9];return _0x1ec99e;};'use strict';var OpenchannelInteractionEvents=require(_0xa6b1('0x0'));var events=['save','remove','update'];function createListener(_0x3ac8c8,_0x4502c3){return function(_0x38b570){_0x4502c3[_0xa6b1('0x1')](_0x3ac8c8,_0x38b570);};}function removeListener(_0x4919db,_0x504a38){return function(){OpenchannelInteractionEvents[_0xa6b1('0x2')](_0x4919db,_0x504a38);};}exports['register']=function(_0x518006){for(var _0x4e6605=0x0,_0x501a4d=events[_0xa6b1('0x3')];_0x4e6605<_0x501a4d;_0x4e6605++){var _0x205711=events[_0x4e6605];var _0x5579fb=createListener(_0xa6b1('0x4')+_0x205711,_0x518006);OpenchannelInteractionEvents['on'](_0x205711,_0x5579fb);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e1d6e79..333129b 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x374c4a,_0x5afa32){var _0x103f4a=function(_0x5a70e1){while(--_0x5a70e1){_0x374c4a['push'](_0x374c4a['shift']());}};_0x103f4a(++_0x5afa32);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x5ac48e,_0x18bf11){var _0x52ae34=function(_0x2d2145){while(--_0x2d2145){_0x5ac48e['push'](_0x5ac48e['shift']());}};_0x52ae34(++_0x18bf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 876566c..399f338 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 _0x9000=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x4033f6,_0x48f717){var _0x4d3466=function(_0x362721){while(--_0x362721){_0x4033f6['push'](_0x4033f6['shift']());}};_0x4d3466(++_0x48f717);}(_0x9000,0x19e));var _0x0900=function(_0x6470a2,_0x3b5f44){_0x6470a2=_0x6470a2-0x0;var _0x24ac61=_0x9000[_0x6470a2];return _0x24ac61;};'use strict';var Sequelize=require(_0x0900('0x0'));module[_0x0900('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0900('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0900('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0900('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0900('0x4')]('in',_0x0900('0x5')),'defaultValue':_0x0900('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0900('0x6')]},'providerName':{'type':Sequelize[_0x0900('0x7')]},'providerResponse':{'type':Sequelize[_0x0900('0x8')]}}; \ No newline at end of file +var _0xb98e=['out','DATE','STRING','sequelize','exports','BOOLEAN','ENUM'];(function(_0x1aad39,_0x5b9a34){var _0x50be3b=function(_0x1f1da7){while(--_0x1f1da7){_0x1aad39['push'](_0x1aad39['shift']());}};_0x50be3b(++_0x5b9a34);}(_0xb98e,0x184));var _0xeb98=function(_0x148447,_0x49a47c){_0x148447=_0x148447-0x0;var _0x193290=_0xb98e[_0x148447];return _0x193290;};'use strict';var Sequelize=require(_0xeb98('0x0'));module[_0xeb98('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeb98('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeb98('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb98('0x3')]('in','out'),'defaultValue':_0xeb98('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb98('0x5')]},'providerName':{'type':Sequelize[_0xeb98('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 12df98f..76d4d64 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 _0x7cef=['show','params','options','create','body','find','describe','openchannel-interactions','accept','read','readAt','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','Sequelize','QueryTypes','SELECT','User','agent','fullname','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','contact','email','internal','interface','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch'];(function(_0x5cd5b5,_0x3516cd){var _0x1ac1be=function(_0x550ed5){while(--_0x550ed5){_0x5cd5b5['push'](_0x5cd5b5['shift']());}};_0x1ac1be(++_0x3516cd);}(_0x7cef,0x12f));var _0xf7ce=function(_0x3021fe,_0xff1cca){_0x3021fe=_0x3021fe-0x0;var _0x50e3d2=_0x7cef[_0x3021fe];return _0x50e3d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7ce('0x0'));var zipdir=require(_0xf7ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7ce('0x2'));var moment=require(_0xf7ce('0x3'));var BPromise=require(_0xf7ce('0x4'));var Mustache=require(_0xf7ce('0x5'));var util=require(_0xf7ce('0x6'));var path=require(_0xf7ce('0x7'));var sox=require(_0xf7ce('0x8'));var csv=require('to-csv');var ejs=require(_0xf7ce('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7ce('0xa'));var crypto=require(_0xf7ce('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf7ce('0xc'));var toCsv=require(_0xf7ce('0xd'));var querystring=require(_0xf7ce('0xe'));var Papa=require('papaparse');var Redis=require(_0xf7ce('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf7ce('0x10'));var as=require(_0xf7ce('0x11'));var hardwareService=require(_0xf7ce('0x12'));var logger=require(_0xf7ce('0x13'))(_0xf7ce('0x14'));var utils=require('../../config/utils');var config=require(_0xf7ce('0x15'));var licenseUtil=require(_0xf7ce('0x16'));var db=require(_0xf7ce('0x17'))['db'];config[_0xf7ce('0x18')]=_[_0xf7ce('0x19')](config[_0xf7ce('0x18')],{'host':_0xf7ce('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7ce('0x18')]));require('./openchannelMessage.socket')[_0xf7ce('0x1b')](socket);var jayson=require(_0xf7ce('0x1c'));var client=jayson['client'][_0xf7ce('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xf7ce('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4484e2,_0x4c99c1,_0x4b0865,_0x51ee22){return new BPromise(function(_0x2e6448,_0x5eeaf0){var _0x4a3466=_0x51ee22||client;return _0x4a3466['request'](_0x4484e2,_0x4b0865)[_0xf7ce('0x1e')](function(_0x3a6456){logger[_0xf7ce('0x1f')](_0xf7ce('0x20'),_0x4c99c1,_0xf7ce('0x21'));logger[_0xf7ce('0x22')](_0xf7ce('0x23'),_0x4c99c1,'request\x20sent',JSON[_0xf7ce('0x24')](_0x3a6456));if(_0x3a6456[_0xf7ce('0x25')]){if(_0x3a6456[_0xf7ce('0x25')][_0xf7ce('0x26')]===0x1f4){logger[_0xf7ce('0x25')](_0xf7ce('0x20'),_0x4c99c1,_0x3a6456['error'][_0xf7ce('0x27')]);return _0x5eeaf0(_0x3a6456[_0xf7ce('0x25')]['message']);}logger['error'](_0xf7ce('0x20'),_0x4c99c1,_0x3a6456[_0xf7ce('0x25')][_0xf7ce('0x27')]);return _0x2e6448(_0x3a6456['error']['message']);}else{logger[_0xf7ce('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c99c1,_0xf7ce('0x21'));_0x2e6448(_0x3a6456[_0xf7ce('0x28')][_0xf7ce('0x27')]);}})['catch'](function(_0x3b0cc7){logger[_0xf7ce('0x25')](_0xf7ce('0x20'),_0x4c99c1,_0x3b0cc7);_0x5eeaf0(_0x3b0cc7);});});}function respondWithStatusCode(_0x2c4851,_0x54b9e1){_0x54b9e1=_0x54b9e1||0xcc;return function(_0x12094c){if(_0x12094c){return _0x2c4851[_0xf7ce('0x29')](_0x54b9e1);}return _0x2c4851[_0xf7ce('0x2a')](_0x54b9e1)[_0xf7ce('0x2b')]();};}function respondWithResult(_0x577cad,_0x46b39a){_0x46b39a=_0x46b39a||0xc8;return function(_0xfbce7b){if(_0xfbce7b){return _0x577cad[_0xf7ce('0x2a')](_0x46b39a)[_0xf7ce('0x2c')](_0xfbce7b);}};}function respondWithFilteredResult(_0x558bee,_0x56fd8e){return function(_0x5b752c){if(_0x5b752c){var _0x1a0bb3=typeof _0x56fd8e[_0xf7ce('0x2d')]==='undefined'&&typeof _0x56fd8e[_0xf7ce('0x2e')]===_0xf7ce('0x2f');var _0x13eab5=_0x5b752c['count'];var _0x178252=_0x1a0bb3?0x0:_0x56fd8e[_0xf7ce('0x2d')];var _0x2ad744=_0x1a0bb3?_0x5b752c['count']:_0x56fd8e['offset']+_0x56fd8e[_0xf7ce('0x2e')];var _0x56a402;if(_0x2ad744>=_0x13eab5){_0x2ad744=_0x13eab5;_0x56a402=0xc8;}else{_0x56a402=0xce;}_0x558bee[_0xf7ce('0x2a')](_0x56a402);return _0x558bee[_0xf7ce('0x30')](_0xf7ce('0x31'),_0x178252+'-'+_0x2ad744+'/'+_0x13eab5)['json'](_0x5b752c);}return null;};}function patchUpdates(_0x37d81a){return function(_0x1935b5){try{jsonpatch[_0xf7ce('0x32')](_0x1935b5,_0x37d81a,!![]);}catch(_0x1b1b03){return BPromise[_0xf7ce('0x33')](_0x1b1b03);}return _0x1935b5['save']();};}function saveUpdates(_0x5f1aaf,_0x53c5c7){return function(_0x4885be){if(_0x4885be){return _0x4885be[_0xf7ce('0x34')](_0x5f1aaf)[_0xf7ce('0x1e')](function(_0xfe9774){return _0xfe9774;});}return null;};}function removeEntity(_0x48b8fb,_0x39c81a){return function(_0x2274a7){if(_0x2274a7){return _0x2274a7[_0xf7ce('0x35')]()['then'](function(){_0x48b8fb[_0xf7ce('0x2a')](0xcc)[_0xf7ce('0x2b')]();});}};}function handleEntityNotFound(_0x352a60,_0x37f996){return function(_0x28419f){if(!_0x28419f){_0x352a60[_0xf7ce('0x29')](0x194);}return _0x28419f;};}function handleError(_0x5eab71,_0x5439c4){_0x5439c4=_0x5439c4||0x1f4;return function(_0x3057a2){logger['error'](_0x3057a2[_0xf7ce('0x36')]);if(_0x3057a2[_0xf7ce('0x37')]){delete _0x3057a2['name'];}_0x5eab71[_0xf7ce('0x2a')](_0x5439c4)[_0xf7ce('0x38')](_0x3057a2);};}exports[_0xf7ce('0x39')]=function(_0x1c5dd8,_0x5181ea){var _0x9e9cf7={},_0x2b74b1={},_0x9d1fe2={'count':0x0,'rows':[]};var _0x3b72c0=_[_0xf7ce('0x3a')](db[_0xf7ce('0x3b')][_0xf7ce('0x3c')],function(_0x5895a1){return{'name':_0x5895a1[_0xf7ce('0x3d')],'type':_0x5895a1[_0xf7ce('0x3e')][_0xf7ce('0x3f')]};});_0x2b74b1[_0xf7ce('0x40')]=_[_0xf7ce('0x3a')](_0x3b72c0,_0xf7ce('0x37'));_0x2b74b1[_0xf7ce('0x41')]=_[_0xf7ce('0x42')](_0x1c5dd8[_0xf7ce('0x41')]);_0x2b74b1[_0xf7ce('0x43')]=_[_0xf7ce('0x44')](_0x2b74b1[_0xf7ce('0x40')],_0x2b74b1['query']);_0x9e9cf7['attributes']=_[_0xf7ce('0x44')](_0x2b74b1['model'],qs[_0xf7ce('0x45')](_0x1c5dd8[_0xf7ce('0x41')][_0xf7ce('0x45')]));_0x9e9cf7[_0xf7ce('0x46')]=_0x9e9cf7['attributes']['length']?_0x9e9cf7[_0xf7ce('0x46')]:_0x2b74b1[_0xf7ce('0x40')];if(!_0x1c5dd8[_0xf7ce('0x41')][_0xf7ce('0x47')]('nolimit')){_0x9e9cf7[_0xf7ce('0x2e')]=qs[_0xf7ce('0x2e')](_0x1c5dd8[_0xf7ce('0x41')][_0xf7ce('0x2e')]);_0x9e9cf7[_0xf7ce('0x2d')]=qs[_0xf7ce('0x2d')](_0x1c5dd8[_0xf7ce('0x41')][_0xf7ce('0x2d')]);}_0x9e9cf7[_0xf7ce('0x48')]=qs[_0xf7ce('0x49')](_0x1c5dd8[_0xf7ce('0x41')]['sort']);_0x9e9cf7[_0xf7ce('0x4a')]=qs[_0xf7ce('0x43')](_[_0xf7ce('0x4b')](_0x1c5dd8[_0xf7ce('0x41')],_0x2b74b1[_0xf7ce('0x43')]),_0x3b72c0);if(_0x1c5dd8[_0xf7ce('0x41')][_0xf7ce('0x4c')]){_0x9e9cf7[_0xf7ce('0x4a')]=_[_0xf7ce('0x4d')](_0x9e9cf7[_0xf7ce('0x4a')],{'$or':_[_0xf7ce('0x3a')](_0x3b72c0,function(_0x3bec45){if(_0x3bec45[_0xf7ce('0x3e')]!==_0xf7ce('0x4e')){var _0x387f51={};_0x387f51[_0x3bec45['name']]={'$like':'%'+_0x1c5dd8[_0xf7ce('0x41')][_0xf7ce('0x4c')]+'%'};return _0x387f51;}})});}_0x9e9cf7=_[_0xf7ce('0x4d')]({},_0x9e9cf7,_0x1c5dd8['options']);var _0x1f23f2={'where':_0x9e9cf7[_0xf7ce('0x4a')]};return db['OpenchannelMessage'][_0xf7ce('0x4f')](_0x1f23f2)[_0xf7ce('0x1e')](function(_0x40ec8c){_0x9d1fe2['count']=_0x40ec8c;if(_0x1c5dd8[_0xf7ce('0x41')][_0xf7ce('0x50')]){_0x9e9cf7[_0xf7ce('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xf7ce('0x52')](_0x9e9cf7);})[_0xf7ce('0x1e')](function(_0x5aaf19){_0x9d1fe2['rows']=_0x5aaf19;return _0x9d1fe2;})['then'](respondWithFilteredResult(_0x5181ea,_0x9e9cf7))[_0xf7ce('0x53')](handleError(_0x5181ea,null));};exports[_0xf7ce('0x54')]=function(_0x2f43a2,_0x5f2e13){var _0x19a99f={'raw':!![],'where':{'id':_0x2f43a2[_0xf7ce('0x55')]['id']}},_0x2c5003={};_0x2c5003[_0xf7ce('0x40')]=_[_0xf7ce('0x42')](db[_0xf7ce('0x3b')]['rawAttributes']);_0x2c5003[_0xf7ce('0x41')]=_[_0xf7ce('0x42')](_0x2f43a2[_0xf7ce('0x41')]);_0x2c5003['filters']=_[_0xf7ce('0x44')](_0x2c5003[_0xf7ce('0x40')],_0x2c5003['query']);_0x19a99f[_0xf7ce('0x46')]=_[_0xf7ce('0x44')](_0x2c5003['model'],qs[_0xf7ce('0x45')](_0x2f43a2[_0xf7ce('0x41')][_0xf7ce('0x45')]));_0x19a99f[_0xf7ce('0x46')]=_0x19a99f[_0xf7ce('0x46')]['length']?_0x19a99f[_0xf7ce('0x46')]:_0x2c5003['model'];if(_0x2f43a2[_0xf7ce('0x41')][_0xf7ce('0x50')]){_0x19a99f[_0xf7ce('0x51')]=[{'all':!![]}];}_0x19a99f=_[_0xf7ce('0x4d')]({},_0x19a99f,_0x2f43a2[_0xf7ce('0x56')]);return db[_0xf7ce('0x3b')]['find'](_0x19a99f)[_0xf7ce('0x1e')](handleEntityNotFound(_0x5f2e13,null))[_0xf7ce('0x1e')](respondWithResult(_0x5f2e13,null))['catch'](handleError(_0x5f2e13,null));};exports[_0xf7ce('0x57')]=function(_0xe4714d,_0x66cbb){return db[_0xf7ce('0x3b')][_0xf7ce('0x57')](_0xe4714d[_0xf7ce('0x58')],{})[_0xf7ce('0x1e')](respondWithResult(_0x66cbb,0xc9))[_0xf7ce('0x53')](handleError(_0x66cbb,null));};exports[_0xf7ce('0x34')]=function(_0x1e663e,_0x5c164e){if(_0x1e663e[_0xf7ce('0x58')]['id']){delete _0x1e663e[_0xf7ce('0x58')]['id'];}return db[_0xf7ce('0x3b')][_0xf7ce('0x59')]({'where':{'id':_0x1e663e[_0xf7ce('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c164e,null))['then'](saveUpdates(_0x1e663e[_0xf7ce('0x58')],null))['then'](respondWithResult(_0x5c164e,null))['catch'](handleError(_0x5c164e,null));};exports['destroy']=function(_0x29764e,_0x381176){return db[_0xf7ce('0x3b')][_0xf7ce('0x59')]({'where':{'id':_0x29764e[_0xf7ce('0x55')]['id']}})[_0xf7ce('0x1e')](handleEntityNotFound(_0x381176,null))[_0xf7ce('0x1e')](removeEntity(_0x381176,null))[_0xf7ce('0x53')](handleError(_0x381176,null));};exports['describe']=function(_0x45a49a,_0x5228fc){return db[_0xf7ce('0x3b')][_0xf7ce('0x5a')]()[_0xf7ce('0x1e')](respondWithResult(_0x5228fc,null))['catch'](handleError(_0x5228fc,null));};var interaction_log=require(_0xf7ce('0x13'))(_0xf7ce('0x5b'));exports[_0xf7ce('0x5c')]=function(_0x505e9d,_0x3cfe57,_0x49cfb1){var _0x221121={'agent':{},'channel':'openchannel'};if(_0x505e9d[_0xf7ce('0x58')]['id']){delete _0x505e9d[_0xf7ce('0x58')]['id'];}_0x505e9d[_0xf7ce('0x58')][_0xf7ce('0x5d')]=!![];_0x505e9d['body'][_0xf7ce('0x5e')]=moment()[_0xf7ce('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x505e9d[_0xf7ce('0x58')][_0xf7ce('0x60')]=_0x505e9d[_0xf7ce('0x58')][_0xf7ce('0x60')]||_0x505e9d[_0xf7ce('0x61')]['id'];_0x221121['agent']['id']=_0x505e9d[_0xf7ce('0x58')][_0xf7ce('0x60')];return db[_0xf7ce('0x3b')][_0xf7ce('0x59')]({'where':{'id':_0x505e9d[_0xf7ce('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3cfe57,null))[_0xf7ce('0x1e')](saveUpdates(_0x505e9d['body'],null))[_0xf7ce('0x1e')](function(_0x17aa22){if(_0x17aa22){_0x221121['message']=_0x17aa22[_0xf7ce('0x62')]({'plain':!![]});return db[_0xf7ce('0x63')]['find']({'where':{'id':_0x17aa22[_0xf7ce('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3cfe57,null))[_0xf7ce('0x1e')](function(_0x9bb4e){if(_0x9bb4e){return _0x9bb4e[_0xf7ce('0x34')]({'UserId':_0x505e9d[_0xf7ce('0x58')][_0xf7ce('0x60')],'read1stAt':_[_0xf7ce('0x65')](_0x9bb4e[_0xf7ce('0x66')])?moment()[_0xf7ce('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf7ce('0x1e')](function(_0x15af48){if(_0x15af48){_0x221121['interaction']=_0x15af48['get']({'plain':!![]});interaction_log[_0xf7ce('0x1f')](_0xf7ce('0x67'),_0x505e9d[_0xf7ce('0x61')]['id'],_0x505e9d[_0xf7ce('0x61')][_0xf7ce('0x37')],_0x505e9d[_0xf7ce('0x61')]['role'],_0x221121[_0xf7ce('0x68')]['id'],_0x505e9d[_0xf7ce('0x58')]?JSON[_0xf7ce('0x24')](_0x505e9d[_0xf7ce('0x58')]):_0xf7ce('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x221121);}return null;})[_0xf7ce('0x1e')](function(_0x50fa36){var _0x5de2f8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x50fa36['message']['ContactId'];return db['sequelize'][_0xf7ce('0x41')](_0x5de2f8,{'type':db[_0xf7ce('0x6a')][_0xf7ce('0x6b')][_0xf7ce('0x6c')],'raw':!![]})[_0xf7ce('0x1e')](function(_0x74c3cf){return _0x74c3cf;});})[_0xf7ce('0x1e')](function(_0x43b879){if(_0x43b879){_0x221121[_0xf7ce('0x27')]['contact']=_0x43b879[0x0];if(!_0x505e9d[_0xf7ce('0x58')][_0xf7ce('0x60')])return;return db[_0xf7ce('0x6d')][_0xf7ce('0x59')]({'where':{'id':_0x505e9d[_0xf7ce('0x58')]['UserId'],'role':_0xf7ce('0x6e')},'attributes':['id',_0xf7ce('0x37'),_0xf7ce('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0xf7ce('0x1e')](function(_0x1c7d7d){if(!_0x1c7d7d)return null;_0x221121['message'][_0xf7ce('0x6e')]=_0x1c7d7d;return _0x221121;})[_0xf7ce('0x1e')](function(_0x102752){if(_0x102752){if(_0x505e9d[_0xf7ce('0x58')]['manual']){_0x221121[_0xf7ce('0x27')]['interface']=util[_0xf7ce('0x5f')](_0xf7ce('0x70'),_0x505e9d[_0xf7ce('0x61')]['name']);_0x221121[_0xf7ce('0x27')][_0xf7ce('0x71')]=_0x221121[_0xf7ce('0x71')];_0x221121['message'][_0xf7ce('0x72')]=_0x221121['channel'];_0x221121[_0xf7ce('0x27')][_0xf7ce('0x73')]='accept';return respondWithRpcPromise(_0xf7ce('0x74'),'EventManager',{'event':_0xf7ce('0x75'),'message':_0x221121[_0xf7ce('0x27')]},client9002)[_0xf7ce('0x1e')](function(){return _0x221121;});}return _0x221121;}return null;})[_0xf7ce('0x1e')](respondWithResult(_0x3cfe57,null))[_0xf7ce('0x53')](handleError(_0x3cfe57,null));};var interaction_log=require('../../config/logger')(_0xf7ce('0x5b'));exports[_0xf7ce('0x33')]=function(_0xec4fb1,_0x42ba2e,_0x24539e){var _0x526b2d={'agent':{},'channel':_0xf7ce('0x76')};if(_0xec4fb1[_0xf7ce('0x58')]['id']){delete _0xec4fb1['body']['id'];}_0xec4fb1[_0xf7ce('0x58')][_0xf7ce('0x60')]=_0xec4fb1[_0xf7ce('0x58')][_0xf7ce('0x60')]||_0xec4fb1[_0xf7ce('0x61')]['id'];_0x526b2d[_0xf7ce('0x6e')]['id']=_0xec4fb1[_0xf7ce('0x58')][_0xf7ce('0x60')];return db[_0xf7ce('0x3b')]['find']({'where':{'id':_0xec4fb1[_0xf7ce('0x55')]['id'],'UserId':null}})[_0xf7ce('0x1e')](handleEntityNotFound(_0x42ba2e,null))[_0xf7ce('0x1e')](function(_0x279758){if(_0x279758){_0x526b2d[_0xf7ce('0x27')]=_0x279758[_0xf7ce('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x279758['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x42ba2e,null))[_0xf7ce('0x1e')](function(_0x12ced7){if(_0x12ced7){_0x526b2d[_0xf7ce('0x68')]=_0x12ced7[_0xf7ce('0x62')]({'plain':!![]});interaction_log[_0xf7ce('0x1f')](_0xf7ce('0x77'),_0xec4fb1[_0xf7ce('0x61')]['id'],_0xec4fb1[_0xf7ce('0x61')][_0xf7ce('0x37')],_0xec4fb1['user'][_0xf7ce('0x78')],_0x526b2d[_0xf7ce('0x68')]['id'],_0xec4fb1[_0xf7ce('0x58')]?JSON[_0xf7ce('0x24')](_0xec4fb1['body']):_0xf7ce('0x69'));return respondWithRpcPromise(_0xf7ce('0x79'),_0xf7ce('0x7a'),_0x526b2d);}return null;})['then'](function(_0x4fffd1){var _0x39dd6d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4fffd1[_0xf7ce('0x27')][_0xf7ce('0x7b')];return db['sequelize'][_0xf7ce('0x41')](_0x39dd6d,{'type':db[_0xf7ce('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x3ba04f){return _0x3ba04f;});})[_0xf7ce('0x1e')](function(_0x5f222b){if(_0x5f222b){_0x526b2d[_0xf7ce('0x27')][_0xf7ce('0x7c')]=_0x5f222b[0x0];if(!_0xec4fb1[_0xf7ce('0x58')]['UserId'])return;return db[_0xf7ce('0x6d')]['find']({'where':{'id':_0xec4fb1['body'][_0xf7ce('0x60')],'role':_0xf7ce('0x6e')},'attributes':['id',_0xf7ce('0x37'),_0xf7ce('0x6f'),_0xf7ce('0x7d'),_0xf7ce('0x7e')],'raw':!![]});}return null;})[_0xf7ce('0x1e')](function(_0xbc808b){if(!_0xbc808b)return null;_0x526b2d[_0xf7ce('0x27')]['agent']=_0xbc808b;return _0x526b2d;})['then'](function(_0x389cc9){if(_0x389cc9){_0x389cc9[_0xf7ce('0x27')][_0xf7ce('0x7f')]=util[_0xf7ce('0x5f')](_0xf7ce('0x70'),_0xec4fb1['user']['name']);_0x389cc9[_0xf7ce('0x27')]['channel']=_0x526b2d['channel'];_0x389cc9['message']['motionChannel']=_0x526b2d[_0xf7ce('0x71')];_0x389cc9[_0xf7ce('0x27')][_0xf7ce('0x73')]='reject';respondWithRpcPromise(_0xf7ce('0x74'),'EventManager',{'event':_0xf7ce('0x80'),'message':_0x389cc9[_0xf7ce('0x27')]},client9002);return _0x526b2d;}return null;})[_0xf7ce('0x1e')](respondWithResult(_0x42ba2e,null))[_0xf7ce('0x53')](handleError(_0x42ba2e,null));}; \ No newline at end of file +var _0x8601=['ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','params','length','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox'];(function(_0x45e08e,_0x4e2af0){var _0x366232=function(_0x46a720){while(--_0x46a720){_0x45e08e['push'](_0x45e08e['shift']());}};_0x366232(++_0x4e2af0);}(_0x8601,0x183));var _0x1860=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8601[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x1860('0x0'));var rimraf=require(_0x1860('0x1'));var zipdir=require(_0x1860('0x2'));var jsonpatch=require(_0x1860('0x3'));var rp=require(_0x1860('0x4'));var moment=require('moment');var BPromise=require(_0x1860('0x5'));var Mustache=require(_0x1860('0x6'));var util=require(_0x1860('0x7'));var path=require('path');var sox=require(_0x1860('0x8'));var csv=require('to-csv');var ejs=require(_0x1860('0x9'));var fs=require('fs');var fs_extra=require(_0x1860('0xa'));var _=require('lodash');var squel=require(_0x1860('0xb'));var crypto=require('crypto');var jsforce=require(_0x1860('0xc'));var deskjs=require(_0x1860('0xd'));var toCsv=require(_0x1860('0xe'));var querystring=require(_0x1860('0xf'));var Papa=require(_0x1860('0x10'));var Redis=require(_0x1860('0x11'));var authService=require(_0x1860('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1860('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1860('0x14'))(_0x1860('0x15'));var utils=require(_0x1860('0x16'));var config=require(_0x1860('0x17'));var licenseUtil=require(_0x1860('0x18'));var db=require(_0x1860('0x19'))['db'];config[_0x1860('0x1a')]=_['defaults'](config[_0x1860('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1860('0x1b'))(new Redis(config[_0x1860('0x1a')]));require(_0x1860('0x1c'))[_0x1860('0x1d')](socket);var jayson=require(_0x1860('0x1e'));var client=jayson['client'][_0x1860('0x1f')]({'port':0x232c});var client9002=jayson[_0x1860('0x20')][_0x1860('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x19336e,_0x55cb43,_0x4260a5,_0x5856d7){return new BPromise(function(_0x550c41,_0x48fc55){var _0x11c033=_0x5856d7||client;return _0x11c033[_0x1860('0x21')](_0x19336e,_0x4260a5)[_0x1860('0x22')](function(_0xbbbfda){logger['info'](_0x1860('0x23'),_0x55cb43,_0x1860('0x24'));logger[_0x1860('0x25')](_0x1860('0x26'),_0x55cb43,'request\x20sent',JSON[_0x1860('0x27')](_0xbbbfda));if(_0xbbbfda['error']){if(_0xbbbfda['error']['code']===0x1f4){logger[_0x1860('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x55cb43,_0xbbbfda['error']['message']);return _0x48fc55(_0xbbbfda[_0x1860('0x28')][_0x1860('0x29')]);}logger[_0x1860('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x55cb43,_0xbbbfda['error'][_0x1860('0x29')]);return _0x550c41(_0xbbbfda[_0x1860('0x28')][_0x1860('0x29')]);}else{logger[_0x1860('0x2a')](_0x1860('0x23'),_0x55cb43,_0x1860('0x24'));_0x550c41(_0xbbbfda[_0x1860('0x2b')]['message']);}})[_0x1860('0x2c')](function(_0x217b95){logger[_0x1860('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x55cb43,_0x217b95);_0x48fc55(_0x217b95);});});}function respondWithStatusCode(_0x5c1c92,_0x4db769){_0x4db769=_0x4db769||0xcc;return function(_0x2ffbd4){if(_0x2ffbd4){return _0x5c1c92[_0x1860('0x2d')](_0x4db769);}return _0x5c1c92[_0x1860('0x2e')](_0x4db769)[_0x1860('0x2f')]();};}function respondWithResult(_0x238f8e,_0x28d321){_0x28d321=_0x28d321||0xc8;return function(_0x2a81ab){if(_0x2a81ab){return _0x238f8e['status'](_0x28d321)[_0x1860('0x30')](_0x2a81ab);}};}function respondWithFilteredResult(_0x33e529,_0x48c90c){return function(_0x4812ea){if(_0x4812ea){var _0x20434c=typeof _0x48c90c[_0x1860('0x31')]===_0x1860('0x32')&&typeof _0x48c90c[_0x1860('0x33')]===_0x1860('0x32');var _0x3c0692=_0x4812ea[_0x1860('0x34')];var _0x547ce8=_0x20434c?0x0:_0x48c90c[_0x1860('0x31')];var _0x299f06=_0x20434c?_0x4812ea[_0x1860('0x34')]:_0x48c90c[_0x1860('0x31')]+_0x48c90c[_0x1860('0x33')];var _0x5dfeba;if(_0x299f06>=_0x3c0692){_0x299f06=_0x3c0692;_0x5dfeba=0xc8;}else{_0x5dfeba=0xce;}_0x33e529[_0x1860('0x2e')](_0x5dfeba);return _0x33e529['set'](_0x1860('0x35'),_0x547ce8+'-'+_0x299f06+'/'+_0x3c0692)[_0x1860('0x30')](_0x4812ea);}return null;};}function patchUpdates(_0x3be419){return function(_0x287828){try{jsonpatch[_0x1860('0x36')](_0x287828,_0x3be419,!![]);}catch(_0x4ca315){return BPromise['reject'](_0x4ca315);}return _0x287828['save']();};}function saveUpdates(_0x5d6306,_0x598621){return function(_0xbd955b){if(_0xbd955b){return _0xbd955b[_0x1860('0x37')](_0x5d6306)['then'](function(_0x47f004){return _0x47f004;});}return null;};}function removeEntity(_0x22e742,_0x3146aa){return function(_0x3ef1fc){if(_0x3ef1fc){return _0x3ef1fc[_0x1860('0x38')]()[_0x1860('0x22')](function(){_0x22e742[_0x1860('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6241,_0x191ddf){return function(_0x30f4b6){if(!_0x30f4b6){_0x2a6241[_0x1860('0x2d')](0x194);}return _0x30f4b6;};}function handleError(_0x19b352,_0x1e2ee3){_0x1e2ee3=_0x1e2ee3||0x1f4;return function(_0x5dee8c){logger[_0x1860('0x28')](_0x5dee8c[_0x1860('0x39')]);if(_0x5dee8c['name']){delete _0x5dee8c[_0x1860('0x3a')];}_0x19b352[_0x1860('0x2e')](_0x1e2ee3)[_0x1860('0x3b')](_0x5dee8c);};}exports[_0x1860('0x3c')]=function(_0x5302e9,_0x2e3274){var _0x55d5a6={},_0x2540c8={},_0x1f8c3b={'count':0x0,'rows':[]};var _0x1a905c=_[_0x1860('0x3d')](db[_0x1860('0x3e')][_0x1860('0x3f')],function(_0x43ed43){return{'name':_0x43ed43[_0x1860('0x40')],'type':_0x43ed43[_0x1860('0x41')]['key']};});_0x2540c8[_0x1860('0x42')]=_[_0x1860('0x3d')](_0x1a905c,'name');_0x2540c8[_0x1860('0x43')]=_[_0x1860('0x44')](_0x5302e9[_0x1860('0x43')]);_0x2540c8[_0x1860('0x45')]=_[_0x1860('0x46')](_0x2540c8[_0x1860('0x42')],_0x2540c8[_0x1860('0x43')]);_0x55d5a6[_0x1860('0x47')]=_['intersection'](_0x2540c8[_0x1860('0x42')],qs[_0x1860('0x48')](_0x5302e9['query'][_0x1860('0x48')]));_0x55d5a6[_0x1860('0x47')]=_0x55d5a6[_0x1860('0x47')]['length']?_0x55d5a6['attributes']:_0x2540c8[_0x1860('0x42')];if(!_0x5302e9[_0x1860('0x43')]['hasOwnProperty'](_0x1860('0x49'))){_0x55d5a6[_0x1860('0x33')]=qs['limit'](_0x5302e9['query'][_0x1860('0x33')]);_0x55d5a6[_0x1860('0x31')]=qs[_0x1860('0x31')](_0x5302e9[_0x1860('0x43')][_0x1860('0x31')]);}_0x55d5a6[_0x1860('0x4a')]=qs[_0x1860('0x4b')](_0x5302e9[_0x1860('0x43')][_0x1860('0x4b')]);_0x55d5a6[_0x1860('0x4c')]=qs[_0x1860('0x45')](_['pick'](_0x5302e9[_0x1860('0x43')],_0x2540c8[_0x1860('0x45')]),_0x1a905c);if(_0x5302e9['query']['filter']){_0x55d5a6['where']=_[_0x1860('0x4d')](_0x55d5a6[_0x1860('0x4c')],{'$or':_[_0x1860('0x3d')](_0x1a905c,function(_0x3ad12d){if(_0x3ad12d['type']!==_0x1860('0x4e')){var _0x30c64a={};_0x30c64a[_0x3ad12d[_0x1860('0x3a')]]={'$like':'%'+_0x5302e9[_0x1860('0x43')][_0x1860('0x4f')]+'%'};return _0x30c64a;}})});}_0x55d5a6=_[_0x1860('0x4d')]({},_0x55d5a6,_0x5302e9[_0x1860('0x50')]);var _0x2e38b9={'where':_0x55d5a6[_0x1860('0x4c')]};return db[_0x1860('0x3e')][_0x1860('0x34')](_0x2e38b9)[_0x1860('0x22')](function(_0x408f40){_0x1f8c3b['count']=_0x408f40;if(_0x5302e9[_0x1860('0x43')]['includeAll']){_0x55d5a6[_0x1860('0x51')]=[{'all':!![]}];}return db[_0x1860('0x3e')][_0x1860('0x52')](_0x55d5a6);})[_0x1860('0x22')](function(_0x30ec87){_0x1f8c3b['rows']=_0x30ec87;return _0x1f8c3b;})[_0x1860('0x22')](respondWithFilteredResult(_0x2e3274,_0x55d5a6))[_0x1860('0x2c')](handleError(_0x2e3274,null));};exports['show']=function(_0x8d3fb6,_0x17343a){var _0x1b585a={'raw':!![],'where':{'id':_0x8d3fb6[_0x1860('0x53')]['id']}},_0x37790c={};_0x37790c[_0x1860('0x42')]=_[_0x1860('0x44')](db[_0x1860('0x3e')][_0x1860('0x3f')]);_0x37790c['query']=_[_0x1860('0x44')](_0x8d3fb6[_0x1860('0x43')]);_0x37790c[_0x1860('0x45')]=_[_0x1860('0x46')](_0x37790c['model'],_0x37790c[_0x1860('0x43')]);_0x1b585a[_0x1860('0x47')]=_['intersection'](_0x37790c[_0x1860('0x42')],qs[_0x1860('0x48')](_0x8d3fb6[_0x1860('0x43')][_0x1860('0x48')]));_0x1b585a[_0x1860('0x47')]=_0x1b585a[_0x1860('0x47')][_0x1860('0x54')]?_0x1b585a[_0x1860('0x47')]:_0x37790c[_0x1860('0x42')];if(_0x8d3fb6[_0x1860('0x43')][_0x1860('0x55')]){_0x1b585a[_0x1860('0x51')]=[{'all':!![]}];}_0x1b585a=_['merge']({},_0x1b585a,_0x8d3fb6[_0x1860('0x50')]);return db['OpenchannelMessage'][_0x1860('0x56')](_0x1b585a)[_0x1860('0x22')](handleEntityNotFound(_0x17343a,null))[_0x1860('0x22')](respondWithResult(_0x17343a,null))[_0x1860('0x2c')](handleError(_0x17343a,null));};exports['create']=function(_0x47759a,_0x4d292a){return db[_0x1860('0x3e')][_0x1860('0x57')](_0x47759a[_0x1860('0x58')],{})['then'](respondWithResult(_0x4d292a,0xc9))[_0x1860('0x2c')](handleError(_0x4d292a,null));};exports[_0x1860('0x37')]=function(_0x9c8780,_0x40c840){if(_0x9c8780[_0x1860('0x58')]['id']){delete _0x9c8780['body']['id'];}return db[_0x1860('0x3e')][_0x1860('0x56')]({'where':{'id':_0x9c8780[_0x1860('0x53')]['id']}})[_0x1860('0x22')](handleEntityNotFound(_0x40c840,null))[_0x1860('0x22')](saveUpdates(_0x9c8780[_0x1860('0x58')],null))[_0x1860('0x22')](respondWithResult(_0x40c840,null))[_0x1860('0x2c')](handleError(_0x40c840,null));};exports[_0x1860('0x38')]=function(_0x17df49,_0x42e3ae){return db[_0x1860('0x3e')]['find']({'where':{'id':_0x17df49[_0x1860('0x53')]['id']}})[_0x1860('0x22')](handleEntityNotFound(_0x42e3ae,null))['then'](removeEntity(_0x42e3ae,null))[_0x1860('0x2c')](handleError(_0x42e3ae,null));};exports[_0x1860('0x59')]=function(_0x4867d9,_0xe69838){return db[_0x1860('0x3e')][_0x1860('0x59')]()['then'](respondWithResult(_0xe69838,null))[_0x1860('0x2c')](handleError(_0xe69838,null));};var interaction_log=require(_0x1860('0x14'))(_0x1860('0x5a'));exports[_0x1860('0x5b')]=function(_0xe0bfb9,_0x1e3423,_0x26fed3){var _0x3b3b58={'agent':{},'channel':_0x1860('0x5c')};if(_0xe0bfb9[_0x1860('0x58')]['id']){delete _0xe0bfb9[_0x1860('0x58')]['id'];}_0xe0bfb9[_0x1860('0x58')][_0x1860('0x5d')]=!![];_0xe0bfb9[_0x1860('0x58')][_0x1860('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xe0bfb9['body'][_0x1860('0x5f')]=_0xe0bfb9[_0x1860('0x58')][_0x1860('0x5f')]||_0xe0bfb9[_0x1860('0x60')]['id'];_0x3b3b58[_0x1860('0x61')]['id']=_0xe0bfb9[_0x1860('0x58')][_0x1860('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0xe0bfb9['params']['id'],'UserId':null}})[_0x1860('0x22')](handleEntityNotFound(_0x1e3423,null))[_0x1860('0x22')](saveUpdates(_0xe0bfb9['body'],null))['then'](function(_0x53768c){if(_0x53768c){_0x3b3b58[_0x1860('0x29')]=_0x53768c[_0x1860('0x62')]({'plain':!![]});return db[_0x1860('0x63')]['find']({'where':{'id':_0x53768c[_0x1860('0x64')]}});}return null;})[_0x1860('0x22')](handleEntityNotFound(_0x1e3423,null))[_0x1860('0x22')](function(_0x3fe000){if(_0x3fe000){return _0x3fe000[_0x1860('0x37')]({'UserId':_0xe0bfb9[_0x1860('0x58')][_0x1860('0x5f')],'read1stAt':_[_0x1860('0x65')](_0x3fe000[_0x1860('0x66')])?moment()[_0x1860('0x67')](_0x1860('0x68')):undefined});}return null;})['then'](function(_0x56cccd){if(_0x56cccd){_0x3b3b58[_0x1860('0x69')]=_0x56cccd[_0x1860('0x62')]({'plain':!![]});interaction_log['info'](_0x1860('0x6a'),_0xe0bfb9[_0x1860('0x60')]['id'],_0xe0bfb9[_0x1860('0x60')][_0x1860('0x3a')],_0xe0bfb9[_0x1860('0x60')][_0x1860('0x6b')],_0x3b3b58['interaction']['id'],_0xe0bfb9[_0x1860('0x58')]?JSON[_0x1860('0x27')](_0xe0bfb9[_0x1860('0x58')]):_0x1860('0x6c'));return respondWithRpcPromise(_0x1860('0x6d'),'acceptMessage',_0x3b3b58);}return null;})['then'](function(_0x2f0d1f){var _0x518d29=_0x1860('0x6e')+_0x2f0d1f[_0x1860('0x29')][_0x1860('0x6f')];return db['sequelize'][_0x1860('0x43')](_0x518d29,{'type':db[_0x1860('0x70')][_0x1860('0x71')][_0x1860('0x72')],'raw':!![]})['then'](function(_0x14fe02){return _0x14fe02;});})[_0x1860('0x22')](function(_0x4a9f60){if(_0x4a9f60){_0x3b3b58[_0x1860('0x29')][_0x1860('0x73')]=_0x4a9f60[0x0];if(!_0xe0bfb9[_0x1860('0x58')][_0x1860('0x5f')])return;return db['User'][_0x1860('0x56')]({'where':{'id':_0xe0bfb9['body'][_0x1860('0x5f')],'role':_0x1860('0x61')},'attributes':['id',_0x1860('0x3a'),_0x1860('0x74'),_0x1860('0x75'),_0x1860('0x76')],'raw':!![]});}return null;})['then'](function(_0x2eaa9a){if(!_0x2eaa9a)return null;_0x3b3b58['message'][_0x1860('0x61')]=_0x2eaa9a;return _0x3b3b58;})[_0x1860('0x22')](function(_0xae5bcc){if(_0xae5bcc){if(_0xe0bfb9['body'][_0x1860('0x77')]){_0x3b3b58[_0x1860('0x29')][_0x1860('0x78')]=util['format'](_0x1860('0x79'),_0xe0bfb9[_0x1860('0x60')][_0x1860('0x3a')]);_0x3b3b58['message'][_0x1860('0x7a')]=_0x3b3b58[_0x1860('0x7a')];_0x3b3b58[_0x1860('0x29')][_0x1860('0x7b')]=_0x3b3b58[_0x1860('0x7a')];_0x3b3b58[_0x1860('0x29')][_0x1860('0x7c')]='accept';return respondWithRpcPromise(_0x1860('0x7d'),_0x1860('0x7d'),{'event':_0x1860('0x7e'),'message':_0x3b3b58[_0x1860('0x29')]},client9002)['then'](function(){return _0x3b3b58;});}return _0x3b3b58;}return null;})[_0x1860('0x22')](respondWithResult(_0x1e3423,null))['catch'](handleError(_0x1e3423,null));};var interaction_log=require(_0x1860('0x14'))(_0x1860('0x5a'));exports[_0x1860('0x7f')]=function(_0x1d4381,_0x5eb3fa,_0x176dcb){var _0xa462be={'agent':{},'channel':_0x1860('0x5c')};if(_0x1d4381[_0x1860('0x58')]['id']){delete _0x1d4381[_0x1860('0x58')]['id'];}_0x1d4381[_0x1860('0x58')][_0x1860('0x5f')]=_0x1d4381[_0x1860('0x58')][_0x1860('0x5f')]||_0x1d4381[_0x1860('0x60')]['id'];_0xa462be[_0x1860('0x61')]['id']=_0x1d4381['body'][_0x1860('0x5f')];return db[_0x1860('0x3e')][_0x1860('0x56')]({'where':{'id':_0x1d4381[_0x1860('0x53')]['id'],'UserId':null}})[_0x1860('0x22')](handleEntityNotFound(_0x5eb3fa,null))['then'](function(_0x1d4c85){if(_0x1d4c85){_0xa462be[_0x1860('0x29')]=_0x1d4c85[_0x1860('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1860('0x56')]({'where':{'id':_0x1d4c85['OpenchannelInteractionId']}});}return null;})[_0x1860('0x22')](handleEntityNotFound(_0x5eb3fa,null))['then'](function(_0x5add1c){if(_0x5add1c){_0xa462be[_0x1860('0x69')]=_0x5add1c[_0x1860('0x62')]({'plain':!![]});interaction_log['info'](_0x1860('0x80'),_0x1d4381['user']['id'],_0x1d4381[_0x1860('0x60')][_0x1860('0x3a')],_0x1d4381[_0x1860('0x60')][_0x1860('0x6b')],_0xa462be[_0x1860('0x69')]['id'],_0x1d4381[_0x1860('0x58')]?JSON[_0x1860('0x27')](_0x1d4381[_0x1860('0x58')]):_0x1860('0x6c'));return respondWithRpcPromise(_0x1860('0x81'),_0x1860('0x82'),_0xa462be);}return null;})[_0x1860('0x22')](function(_0x27bdc8){var _0x294f4d=_0x1860('0x6e')+_0x27bdc8[_0x1860('0x29')][_0x1860('0x6f')];return db['sequelize']['query'](_0x294f4d,{'type':db[_0x1860('0x70')][_0x1860('0x71')][_0x1860('0x72')],'raw':!![]})[_0x1860('0x22')](function(_0xcbbd91){return _0xcbbd91;});})[_0x1860('0x22')](function(_0x326a0b){if(_0x326a0b){_0xa462be[_0x1860('0x29')][_0x1860('0x73')]=_0x326a0b[0x0];if(!_0x1d4381['body']['UserId'])return;return db['User'][_0x1860('0x56')]({'where':{'id':_0x1d4381[_0x1860('0x58')][_0x1860('0x5f')],'role':_0x1860('0x61')},'attributes':['id',_0x1860('0x3a'),_0x1860('0x74'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x24ab1e){if(!_0x24ab1e)return null;_0xa462be[_0x1860('0x29')]['agent']=_0x24ab1e;return _0xa462be;})['then'](function(_0x576582){if(_0x576582){_0x576582[_0x1860('0x29')][_0x1860('0x78')]=util['format'](_0x1860('0x79'),_0x1d4381[_0x1860('0x60')][_0x1860('0x3a')]);_0x576582[_0x1860('0x29')][_0x1860('0x7a')]=_0xa462be['channel'];_0x576582['message']['motionChannel']=_0xa462be[_0x1860('0x7a')];_0x576582[_0x1860('0x29')][_0x1860('0x7c')]='reject';respondWithRpcPromise(_0x1860('0x7d'),'EventManager',{'event':_0x1860('0x83'),'message':_0x576582[_0x1860('0x29')]},client9002);return _0xa462be;}return null;})[_0x1860('0x22')](respondWithResult(_0x5eb3fa,null))[_0x1860('0x2c')](handleError(_0x5eb3fa,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index fbda244..2d0922a 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 _0x0931=['emit','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update'];(function(_0x428eab,_0x442ffd){var _0x423fe5=function(_0x3488b3){while(--_0x3488b3){_0x428eab['push'](_0x428eab['shift']());}};_0x423fe5(++_0x442ffd);}(_0x0931,0xe3));var _0x1093=function(_0x526ffb,_0x576d16){_0x526ffb=_0x526ffb-0x0;var _0x3029c6=_0x0931[_0x526ffb];return _0x3029c6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x1093('0x0'))['db'][_0x1093('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1093('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1093('0x3'),'afterDestroy':'remove'};function emitEvent(_0x220752){return function(_0x3cba8f,_0x10253d,_0x2ba129){OpenchannelMessageEvents[_0x1093('0x4')](_0x220752+':'+_0x3cba8f['id'],_0x3cba8f);OpenchannelMessageEvents[_0x1093('0x4')](_0x220752,_0x3cba8f);_0x2ba129(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x1093('0x5')](e,emitEvent(event));}}module[_0x1093('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xd278=['hasOwnProperty','hook','events','remove','emit'];(function(_0x4bfc48,_0x28aba5){var _0x3ef568=function(_0x434d73){while(--_0x434d73){_0x4bfc48['push'](_0x4bfc48['shift']());}};_0x3ef568(++_0x28aba5);}(_0xd278,0x1ce));var _0x8d27=function(_0x32983b,_0x1615f4){_0x32983b=_0x32983b-0x0;var _0x55e622=_0xd278[_0x32983b];return _0x55e622;};'use strict';var EventEmitter=require(_0x8d27('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8d27('0x1')};function emitEvent(_0x13540e){return function(_0x2b4501,_0xbdf93c,_0x4d106e){OpenchannelMessageEvents['emit'](_0x13540e+':'+_0x2b4501['id'],_0x2b4501);OpenchannelMessageEvents[_0x8d27('0x2')](_0x13540e,_0x2b4501);_0x4d106e(null);};}for(var e in events){if(events[_0x8d27('0x3')](e)){var event=events[e];OpenchannelMessage[_0x8d27('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index db903b7..1f72314 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 _0x4cf8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','format','body','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','get','replyUri','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x4cf8[_0x3c2166];return _0x30ccc3;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('OpenchannelMessage',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[{'name':_0x84cf('0xe'),'fields':['body'],'type':_0x84cf('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39c6bc,_0x489063,_0xfb5398){var _0x1b223d=_0x50ade2[_0x84cf('0x10')];var _0x369ce6=_0x39c6bc['get']({'plain':!![]});if(_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()==='in'||_0x369ce6['direction']['toLowerCase']()===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]&&!_[_0x84cf('0x15')](_0x369ce6[_0x84cf('0x16')])){_0x1b223d[_0x84cf('0x17')][_0x84cf('0x18')]({'where':{'id':_0x369ce6[_0x84cf('0x19')]}})[_0x84cf('0x1a')](function(_0xced48){if(_0xced48){_0xced48[_0x84cf('0x1b')]({'lastMsgAt':_0x369ce6[_0x84cf('0x1c')],'lastMsgDirection':_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()});}})[_0x84cf('0x1d')](function(_0x27261b){console[_0x84cf('0x1e')](_0x27261b);});}if(_0x369ce6[_0x84cf('0x11')]===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]){var _0x5b8ac8;_0x1b223d[_0x84cf('0x1f')][_0x84cf('0x20')]()[_0x84cf('0x1a')](function(_0x1abe2d){return _0x1b223d[_0x84cf('0x21')][_0x84cf('0x22')]({'where':{'id':_0x369ce6[_0x84cf('0x23')]},'include':[{'model':_0x1b223d['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x369ce6[_0x84cf('0x19')]},'limit':0x1,'include':[{'model':_0x1b223d[_0x84cf('0x1f')],'as':_0x84cf('0x24'),'attributes':_[_0x84cf('0x25')](_0x1abe2d)}]}]});})[_0x84cf('0x1a')](function(_0x5dda3f){_0x5b8ac8=_0x5dda3f[_0x84cf('0x26')]({'plain':!![]});if(_0x5b8ac8&&_0x5b8ac8[_0x84cf('0x27')]){logger[_0x84cf('0x28')](_0x84cf('0x29'),_0x84cf('0x2a'),util['format'](_0x84cf('0x2b'),_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x5b8ac8[_0x84cf('0x2c')]&&_0x5b8ac8[_0x84cf('0x2c')][_0x84cf('0x2d')]){_0x369ce6[_0x84cf('0x2e')]=_[_0x84cf('0x2f')](_0x5b8ac8['Interactions'][0x0],_0x84cf('0x24'));_0x369ce6[_0x84cf('0x24')]=_0x5b8ac8[_0x84cf('0x2c')][0x0][_0x84cf('0x24')];}var _0x489063={'method':_0x84cf('0x30'),'uri':encodeURI(_0x5b8ac8[_0x84cf('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x489063[_0x84cf('0x31')]){case _0x84cf('0x32'):_0x489063['qs']=_0x369ce6;break;case _0x84cf('0x30'):_0x489063['body']=_0x369ce6;break;}return rp(_0x489063)[_0x84cf('0x1a')](function(_0x17bc92){logger[_0x84cf('0x28')](_0x84cf('0x29'),'afterCreate',util[_0x84cf('0x33')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]&&_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]!=_0x369ce6[_0x84cf('0x2e')][_0x84cf('0x35')]){return _0x1b223d[_0x84cf('0x17')][_0x84cf('0x1b')]({'threadId':_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]},{'logging':!![],'where':{'id':_0x369ce6[_0x84cf('0x2e')]['id']}});}else{return;}})[_0x84cf('0x1a')](function(){return _0x39c6bc[_0x84cf('0x1b')]({'read':!![]});})['catch'](function(_0x4852ff){logger[_0x84cf('0x1e')](_0x84cf('0x29'),_0x84cf('0x2a'),util[_0x84cf('0x36')](_0x4852ff,{'showHidden':![],'depth':null}));_0xfb5398();});}else{_0xfb5398();}})[_0x84cf('0x37')](function(){_0xfb5398();});}else{_0xfb5398();}}},'charset':_0x84cf('0x38'),'collate':_0x84cf('0x39')});}; \ No newline at end of file +var _0x4cf8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','format','body','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','get','replyUri','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x42e25e,_0x46cfd1){_0x42e25e=_0x42e25e-0x0;var _0x1ed3a6=_0x4cf8[_0x42e25e];return _0x1ed3a6;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('OpenchannelMessage',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[{'name':_0x84cf('0xe'),'fields':['body'],'type':_0x84cf('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39c6bc,_0x489063,_0xfb5398){var _0x1b223d=_0x50ade2[_0x84cf('0x10')];var _0x369ce6=_0x39c6bc['get']({'plain':!![]});if(_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()==='in'||_0x369ce6['direction']['toLowerCase']()===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]&&!_[_0x84cf('0x15')](_0x369ce6[_0x84cf('0x16')])){_0x1b223d[_0x84cf('0x17')][_0x84cf('0x18')]({'where':{'id':_0x369ce6[_0x84cf('0x19')]}})[_0x84cf('0x1a')](function(_0xced48){if(_0xced48){_0xced48[_0x84cf('0x1b')]({'lastMsgAt':_0x369ce6[_0x84cf('0x1c')],'lastMsgDirection':_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()});}})[_0x84cf('0x1d')](function(_0x27261b){console[_0x84cf('0x1e')](_0x27261b);});}if(_0x369ce6[_0x84cf('0x11')]===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]){var _0x5b8ac8;_0x1b223d[_0x84cf('0x1f')][_0x84cf('0x20')]()[_0x84cf('0x1a')](function(_0x1abe2d){return _0x1b223d[_0x84cf('0x21')][_0x84cf('0x22')]({'where':{'id':_0x369ce6[_0x84cf('0x23')]},'include':[{'model':_0x1b223d['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x369ce6[_0x84cf('0x19')]},'limit':0x1,'include':[{'model':_0x1b223d[_0x84cf('0x1f')],'as':_0x84cf('0x24'),'attributes':_[_0x84cf('0x25')](_0x1abe2d)}]}]});})[_0x84cf('0x1a')](function(_0x5dda3f){_0x5b8ac8=_0x5dda3f[_0x84cf('0x26')]({'plain':!![]});if(_0x5b8ac8&&_0x5b8ac8[_0x84cf('0x27')]){logger[_0x84cf('0x28')](_0x84cf('0x29'),_0x84cf('0x2a'),util['format'](_0x84cf('0x2b'),_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x5b8ac8[_0x84cf('0x2c')]&&_0x5b8ac8[_0x84cf('0x2c')][_0x84cf('0x2d')]){_0x369ce6[_0x84cf('0x2e')]=_[_0x84cf('0x2f')](_0x5b8ac8['Interactions'][0x0],_0x84cf('0x24'));_0x369ce6[_0x84cf('0x24')]=_0x5b8ac8[_0x84cf('0x2c')][0x0][_0x84cf('0x24')];}var _0x489063={'method':_0x84cf('0x30'),'uri':encodeURI(_0x5b8ac8[_0x84cf('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x489063[_0x84cf('0x31')]){case _0x84cf('0x32'):_0x489063['qs']=_0x369ce6;break;case _0x84cf('0x30'):_0x489063['body']=_0x369ce6;break;}return rp(_0x489063)[_0x84cf('0x1a')](function(_0x17bc92){logger[_0x84cf('0x28')](_0x84cf('0x29'),'afterCreate',util[_0x84cf('0x33')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]&&_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]!=_0x369ce6[_0x84cf('0x2e')][_0x84cf('0x35')]){return _0x1b223d[_0x84cf('0x17')][_0x84cf('0x1b')]({'threadId':_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]},{'logging':!![],'where':{'id':_0x369ce6[_0x84cf('0x2e')]['id']}});}else{return;}})[_0x84cf('0x1a')](function(){return _0x39c6bc[_0x84cf('0x1b')]({'read':!![]});})['catch'](function(_0x4852ff){logger[_0x84cf('0x1e')](_0x84cf('0x29'),_0x84cf('0x2a'),util[_0x84cf('0x36')](_0x4852ff,{'showHidden':![],'depth':null}));_0xfb5398();});}else{_0xfb5398();}})[_0x84cf('0x37')](function(){_0xfb5398();});}else{_0xfb5398();}}},'charset':_0x84cf('0x38'),'collate':_0x84cf('0x39')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c681cbd..398b3b8 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2245db,_0x172a4c){var _0x3279d5=function(_0x5383e3){while(--_0x5383e3){_0x2245db['push'](_0x2245db['shift']());}};_0x3279d5(++_0x172a4c);}(_0x5f2f,0x73));var _0xf5f2=function(_0xb8d140,_0x1ba2c6){_0xb8d140=_0xb8d140-0x0;var _0x28a97a=_0x5f2f[_0xb8d140];return _0x28a97a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x371e93,_0x41dfcb){var _0x3ea3f9=function(_0x3c1894){while(--_0x3c1894){_0x371e93['push'](_0x371e93['shift']());}};_0x3ea3f9(++_0x41dfcb);}(_0x1261,0x144));var _0x1126=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x1261[_0x46e523];return _0x5da0ee;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 88fbbf3..f6a3189 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 _0x4b40=['openchannelMessage:','save','remove','update','emit','register'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4b40,0x1f3));var _0x04b4=function(_0x3a472e,_0x4bd59b){_0x3a472e=_0x3a472e-0x0;var _0x49b02b=_0x4b40[_0x3a472e];return _0x49b02b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x04b4('0x0'),_0x04b4('0x1'),_0x04b4('0x2')];function createListener(_0x442f77,_0xce8622){return function(_0x5ec667){_0xce8622[_0x04b4('0x3')](_0x442f77,_0x5ec667);};}function removeListener(_0x23e960,_0x23895b){return function(){OpenchannelMessageEvents['removeListener'](_0x23e960,_0x23895b);};}exports[_0x04b4('0x4')]=function(_0x17fa54){for(var _0x45d29f=0x0,_0x11c863=events['length'];_0x45d29f<_0x11c863;_0x45d29f++){var _0x5d4211=events[_0x45d29f];var _0x3e4e42=createListener(_0x04b4('0x5')+_0x5d4211,_0x17fa54);OpenchannelMessageEvents['on'](_0x5d4211,_0x3e4e42);}}; \ No newline at end of file +var _0xf59f=['update','emit','register','length','openchannelMessage:','save','remove'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xf59f,0xb4));var _0xff59=function(_0xd65a54,_0x7dd5de){_0xd65a54=_0xd65a54-0x0;var _0x22d65e=_0xf59f[_0xd65a54];return _0x22d65e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xff59('0x0'),_0xff59('0x1'),_0xff59('0x2')];function createListener(_0x40797c,_0x5bd473){return function(_0x99b157){_0x5bd473[_0xff59('0x3')](_0x40797c,_0x99b157);};}function removeListener(_0x17ef6d,_0x36ec4d){return function(){OpenchannelMessageEvents['removeListener'](_0x17ef6d,_0x36ec4d);};}exports[_0xff59('0x4')]=function(_0x25832b){for(var _0x1213d9=0x0,_0x5cc8c3=events[_0xff59('0x5')];_0x1213d9<_0x5cc8c3;_0x1213d9++){var _0x374682=events[_0x1213d9];var _0x239ec0=createListener(_0xff59('0x6')+_0x374682,_0x25832b);OpenchannelMessageEvents['on'](_0x374682,_0x239ec0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6205cf5..d151765 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 _0xa488=['getAgents','create','post','addTeams','addAgents','put','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','get','/:id/teams','getTeams','/:id/users'];(function(_0x5787f7,_0x250fe3){var _0x103fa6=function(_0x2b92d4){while(--_0x2b92d4){_0x5787f7['push'](_0x5787f7['shift']());}};_0x103fa6(++_0x250fe3);}(_0xa488,0x6a));var _0x8a48=function(_0x2d2d6a,_0x29a5b7){_0x2d2d6a=_0x2d2d6a-0x0;var _0x2bf511=_0xa488[_0x2d2d6a];return _0x2bf511;};'use strict';var multer=require(_0x8a48('0x0'));var util=require(_0x8a48('0x1'));var path=require(_0x8a48('0x2'));var timeout=require(_0x8a48('0x3'));var express=require(_0x8a48('0x4'));var router=express[_0x8a48('0x5')]();var fs_extra=require(_0x8a48('0x6'));var auth=require(_0x8a48('0x7'));var interaction=require(_0x8a48('0x8'));var config=require(_0x8a48('0x9'));var controller=require(_0x8a48('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8a48('0xb'),auth[_0x8a48('0xc')](),controller[_0x8a48('0xd')]);router['get'](_0x8a48('0xe'),auth[_0x8a48('0xc')](),controller[_0x8a48('0xf')]);router['get'](_0x8a48('0x10'),auth[_0x8a48('0xc')](),controller[_0x8a48('0x11')]);router[_0x8a48('0x12')](_0x8a48('0x13'),auth[_0x8a48('0xc')](),controller[_0x8a48('0x14')]);router[_0x8a48('0x12')](_0x8a48('0x15'),auth[_0x8a48('0xc')](),controller[_0x8a48('0x16')]);router['post']('/',auth[_0x8a48('0xc')](),controller[_0x8a48('0x17')]);router[_0x8a48('0x18')](_0x8a48('0x13'),auth[_0x8a48('0xc')](),controller[_0x8a48('0x19')]);router[_0x8a48('0x18')](_0x8a48('0x15'),auth[_0x8a48('0xc')](),controller[_0x8a48('0x1a')]);router[_0x8a48('0x1b')](_0x8a48('0xe'),auth[_0x8a48('0xc')](),controller['update']);router['delete'](_0x8a48('0xe'),auth[_0x8a48('0xc')](),controller[_0x8a48('0x1c')]);router[_0x8a48('0x1d')](_0x8a48('0x13'),auth[_0x8a48('0xc')](),controller[_0x8a48('0x1e')]);router[_0x8a48('0x1d')](_0x8a48('0x15'),auth[_0x8a48('0xc')](),controller['removeAgents']);module[_0x8a48('0x1f')]=router; \ No newline at end of file +var _0xd17e=['put','update','delete','destroy','/:id/teams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','addTeams','addAgents'];(function(_0x144c0c,_0x113cfe){var _0x436221=function(_0x231dd7){while(--_0x231dd7){_0x144c0c['push'](_0x144c0c['shift']());}};_0x436221(++_0x113cfe);}(_0xd17e,0x76));var _0xed17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd17e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xed17('0x0'));var path=require(_0xed17('0x1'));var timeout=require(_0xed17('0x2'));var express=require(_0xed17('0x3'));var router=express[_0xed17('0x4')]();var fs_extra=require(_0xed17('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed17('0x6'));var config=require('../../config/environment');var controller=require(_0xed17('0x7'));router[_0xed17('0x8')]('/',auth[_0xed17('0x9')](),controller[_0xed17('0xa')]);router[_0xed17('0x8')]('/describe',auth[_0xed17('0x9')](),controller[_0xed17('0xb')]);router[_0xed17('0x8')](_0xed17('0xc'),auth['isAuthenticated'](),controller[_0xed17('0xd')]);router[_0xed17('0x8')](_0xed17('0xe'),auth[_0xed17('0x9')](),controller[_0xed17('0xf')]);router[_0xed17('0x8')]('/:id/teams',auth[_0xed17('0x9')](),controller[_0xed17('0x10')]);router[_0xed17('0x8')](_0xed17('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xed17('0x12')]('/',auth[_0xed17('0x9')](),controller[_0xed17('0x13')]);router[_0xed17('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0xed17('0x14')]);router['post'](_0xed17('0x11'),auth['isAuthenticated'](),controller[_0xed17('0x15')]);router[_0xed17('0x16')](_0xed17('0xc'),auth['isAuthenticated'](),controller[_0xed17('0x17')]);router[_0xed17('0x18')](_0xed17('0xc'),auth['isAuthenticated'](),controller[_0xed17('0x19')]);router[_0xed17('0x18')](_0xed17('0x1a'),auth[_0xed17('0x9')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0xed17('0x9')](),controller[_0xed17('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a0e78ac..48ac993 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 _0xc295=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x1e7f6d,_0x580b98){var _0x20da89=function(_0x529162){while(--_0x529162){_0x1e7f6d['push'](_0x1e7f6d['shift']());}};_0x20da89(++_0x580b98);}(_0xc295,0x115));var _0x5c29=function(_0x14b37e,_0x31d0d8){_0x14b37e=_0x14b37e-0x0;var _0x34c8a9=_0xc295[_0x14b37e];return _0x34c8a9;};'use strict';var Sequelize=require(_0x5c29('0x0'));module[_0x5c29('0x1')]={'name':{'type':Sequelize[_0x5c29('0x2')],'unique':_0x5c29('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5c29('0x2')]},'timeout':{'type':Sequelize[_0x5c29('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c29('0x5')](_0x5c29('0x6'),_0x5c29('0x7'),'roundrobin')}}; \ No newline at end of file +var _0xf360=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5ad555,_0x568728){var _0x4dcfb0=function(_0x1268e2){while(--_0x1268e2){_0x5ad555['push'](_0x5ad555['shift']());}};_0x4dcfb0(++_0x568728);}(_0xf360,0x12f));var _0x0f36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf360[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x0f36('0x0'));module[_0x0f36('0x1')]={'name':{'type':Sequelize[_0x0f36('0x2')],'unique':_0x0f36('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0f36('0x2')]},'timeout':{'type':Sequelize[_0x0f36('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0f36('0x5')](_0x0f36('0x6'),_0x0f36('0x7'),_0x0f36('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1972daf..bb49c1d 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 _0x706f=['forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','OpenchannelQueues','UserProfileResource','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate'];(function(_0x3d9373,_0x2752cf){var _0x25257d=function(_0x130208){while(--_0x130208){_0x3d9373['push'](_0x3d9373['shift']());}};_0x25257d(++_0x2752cf);}(_0x706f,0x149));var _0xf706=function(_0x3a2cb7,_0x585eaf){_0x3a2cb7=_0x3a2cb7-0x0;var _0x2dcd51=_0x706f[_0x3a2cb7];return _0x2dcd51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf706('0x0'));var zipdir=require(_0xf706('0x1'));var jsonpatch=require(_0xf706('0x2'));var rp=require(_0xf706('0x3'));var moment=require(_0xf706('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf706('0x5'));var util=require(_0xf706('0x6'));var path=require('path');var sox=require(_0xf706('0x7'));var csv=require(_0xf706('0x8'));var ejs=require(_0xf706('0x9'));var fs=require('fs');var fs_extra=require(_0xf706('0xa'));var _=require('lodash');var squel=require(_0xf706('0xb'));var crypto=require(_0xf706('0xc'));var jsforce=require(_0xf706('0xd'));var deskjs=require(_0xf706('0xe'));var toCsv=require(_0xf706('0x8'));var querystring=require(_0xf706('0xf'));var Papa=require(_0xf706('0x10'));var Redis=require(_0xf706('0x11'));var authService=require(_0xf706('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf706('0x13'));var hardwareService=require(_0xf706('0x14'));var logger=require(_0xf706('0x15'))(_0xf706('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf706('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf706('0x18')](config['redis'],{'host':_0xf706('0x19'),'port':0x18eb});var socket=require(_0xf706('0x1a'))(new Redis(config[_0xf706('0x1b')]));require(_0xf706('0x1c'))[_0xf706('0x1d')](socket);function respondWithStatusCode(_0x3e2a95,_0x20fb38){_0x20fb38=_0x20fb38||0xcc;return function(_0x37867f){if(_0x37867f){return _0x3e2a95[_0xf706('0x1e')](_0x20fb38);}return _0x3e2a95['status'](_0x20fb38)[_0xf706('0x1f')]();};}function respondWithResult(_0x489c12,_0x557027){_0x557027=_0x557027||0xc8;return function(_0x4c92a0){if(_0x4c92a0){return _0x489c12[_0xf706('0x20')](_0x557027)['json'](_0x4c92a0);}};}function respondWithFilteredResult(_0x11305a,_0x486126){return function(_0x15ddd0){if(_0x15ddd0){var _0x493a01=typeof _0x486126[_0xf706('0x21')]===_0xf706('0x22')&&typeof _0x486126[_0xf706('0x23')]===_0xf706('0x22');var _0x4b4e7f=_0x15ddd0['count'];var _0x517be0=_0x493a01?0x0:_0x486126['offset'];var _0x256804=_0x493a01?_0x15ddd0[_0xf706('0x24')]:_0x486126[_0xf706('0x21')]+_0x486126[_0xf706('0x23')];var _0x204424;if(_0x256804>=_0x4b4e7f){_0x256804=_0x4b4e7f;_0x204424=0xc8;}else{_0x204424=0xce;}_0x11305a[_0xf706('0x20')](_0x204424);return _0x11305a[_0xf706('0x25')](_0xf706('0x26'),_0x517be0+'-'+_0x256804+'/'+_0x4b4e7f)['json'](_0x15ddd0);}return null;};}function patchUpdates(_0x3f409e){return function(_0x3cfce1){try{jsonpatch[_0xf706('0x27')](_0x3cfce1,_0x3f409e,!![]);}catch(_0x139102){return BPromise[_0xf706('0x28')](_0x139102);}return _0x3cfce1[_0xf706('0x29')]();};}function saveUpdates(_0x4609e4,_0x2712d5){return function(_0x1ba9ef){if(_0x1ba9ef){return _0x1ba9ef[_0xf706('0x2a')](_0x4609e4)['then'](function(_0x5def02){return _0x5def02;});}return null;};}function removeEntity(_0x1290cf,_0x1e7a0b){return function(_0x16c016){if(_0x16c016){return _0x16c016[_0xf706('0x2b')]()[_0xf706('0x2c')](function(){var _0x14adfe=_0x16c016['get']({'plain':!![]});var _0x42491c=_0xf706('0x2d');return db[_0xf706('0x2e')]['destroy']({'where':{'type':_0x42491c,'resourceId':_0x14adfe['id']}})[_0xf706('0x2c')](function(){return _0x16c016;});})[_0xf706('0x2c')](function(){_0x1290cf[_0xf706('0x20')](0xcc)[_0xf706('0x1f')]();});}};}function handleEntityNotFound(_0x7122ac,_0x2df952){return function(_0x378aa9){if(!_0x378aa9){_0x7122ac[_0xf706('0x1e')](0x194);}return _0x378aa9;};}function handleError(_0x2aa379,_0x865073){_0x865073=_0x865073||0x1f4;return function(_0x3dbacc){logger['error'](_0x3dbacc[_0xf706('0x2f')]);if(_0x3dbacc[_0xf706('0x30')]){delete _0x3dbacc[_0xf706('0x30')];}_0x2aa379['status'](_0x865073)['send'](_0x3dbacc);};}exports[_0xf706('0x31')]=function(_0xd07681,_0x45acbd){var _0x5addee={},_0x3cde77={},_0x328bf2={'count':0x0,'rows':[]};var _0x3b4df9=_[_0xf706('0x32')](db[_0xf706('0x33')][_0xf706('0x34')],function(_0x559dfc){return{'name':_0x559dfc[_0xf706('0x35')],'type':_0x559dfc['type']['key']};});_0x3cde77[_0xf706('0x36')]=_[_0xf706('0x32')](_0x3b4df9,_0xf706('0x30'));_0x3cde77['query']=_[_0xf706('0x37')](_0xd07681[_0xf706('0x38')]);_0x3cde77[_0xf706('0x39')]=_[_0xf706('0x3a')](_0x3cde77['model'],_0x3cde77[_0xf706('0x38')]);_0x5addee['attributes']=_[_0xf706('0x3a')](_0x3cde77[_0xf706('0x36')],qs[_0xf706('0x3b')](_0xd07681[_0xf706('0x38')][_0xf706('0x3b')]));_0x5addee[_0xf706('0x3c')]=_0x5addee[_0xf706('0x3c')][_0xf706('0x3d')]?_0x5addee[_0xf706('0x3c')]:_0x3cde77[_0xf706('0x36')];if(!_0xd07681[_0xf706('0x38')]['hasOwnProperty'](_0xf706('0x3e'))){_0x5addee['limit']=qs[_0xf706('0x23')](_0xd07681['query'][_0xf706('0x23')]);_0x5addee[_0xf706('0x21')]=qs[_0xf706('0x21')](_0xd07681[_0xf706('0x38')]['offset']);}_0x5addee[_0xf706('0x3f')]=qs[_0xf706('0x40')](_0xd07681[_0xf706('0x38')][_0xf706('0x40')]);_0x5addee[_0xf706('0x41')]=qs[_0xf706('0x39')](_[_0xf706('0x42')](_0xd07681[_0xf706('0x38')],_0x3cde77[_0xf706('0x39')]),_0x3b4df9);if(_0xd07681[_0xf706('0x38')][_0xf706('0x43')]){_0x5addee[_0xf706('0x41')]=_['merge'](_0x5addee[_0xf706('0x41')],{'$or':_[_0xf706('0x32')](_0x3b4df9,function(_0x52d4d1){if(_0x52d4d1[_0xf706('0x44')]!=='VIRTUAL'){var _0x286641={};_0x286641[_0x52d4d1[_0xf706('0x30')]]={'$like':'%'+_0xd07681['query'][_0xf706('0x43')]+'%'};return _0x286641;}})});}_0x5addee=_[_0xf706('0x45')]({},_0x5addee,_0xd07681[_0xf706('0x46')]);var _0x2635d6={'where':_0x5addee[_0xf706('0x41')]};return db[_0xf706('0x33')][_0xf706('0x24')](_0x2635d6)[_0xf706('0x2c')](function(_0x45aeda){_0x328bf2['count']=_0x45aeda;if(_0xd07681[_0xf706('0x38')][_0xf706('0x47')]){_0x5addee[_0xf706('0x48')]=[{'all':!![]}];}return db[_0xf706('0x33')]['findAll'](_0x5addee);})[_0xf706('0x2c')](function(_0x3e117a){_0x328bf2[_0xf706('0x49')]=_0x3e117a;return _0x328bf2;})['then'](respondWithFilteredResult(_0x45acbd,_0x5addee))[_0xf706('0x4a')](handleError(_0x45acbd,null));};exports[_0xf706('0x4b')]=function(_0x5311f7,_0x41b6db){var _0x50514c={'raw':!![],'where':{'id':_0x5311f7[_0xf706('0x4c')]['id']}},_0x1e5e26={};_0x1e5e26['model']=_[_0xf706('0x37')](db[_0xf706('0x33')][_0xf706('0x34')]);_0x1e5e26[_0xf706('0x38')]=_[_0xf706('0x37')](_0x5311f7[_0xf706('0x38')]);_0x1e5e26[_0xf706('0x39')]=_['intersection'](_0x1e5e26['model'],_0x1e5e26[_0xf706('0x38')]);_0x50514c[_0xf706('0x3c')]=_[_0xf706('0x3a')](_0x1e5e26['model'],qs[_0xf706('0x3b')](_0x5311f7[_0xf706('0x38')]['fields']));_0x50514c['attributes']=_0x50514c[_0xf706('0x3c')][_0xf706('0x3d')]?_0x50514c['attributes']:_0x1e5e26[_0xf706('0x36')];if(_0x5311f7[_0xf706('0x38')][_0xf706('0x47')]){_0x50514c['include']=[{'all':!![]}];}_0x50514c=_['merge']({},_0x50514c,_0x5311f7['options']);return db[_0xf706('0x33')][_0xf706('0x4d')](_0x50514c)[_0xf706('0x2c')](handleEntityNotFound(_0x41b6db,null))['then'](respondWithResult(_0x41b6db,null))[_0xf706('0x4a')](handleError(_0x41b6db,null));};exports['create']=function(_0x31df80,_0x35b268){return db[_0xf706('0x33')][_0xf706('0x4e')](_0x31df80[_0xf706('0x4f')],{})[_0xf706('0x2c')](function(_0x40790c){var _0x3e2f35=_0x31df80[_0xf706('0x50')][_0xf706('0x51')]({'plain':!![]});if(!_0x3e2f35)throw new Error(_0xf706('0x52'));if(_0x3e2f35[_0xf706('0x53')]==='user'){var _0x59c0ef=_0x40790c[_0xf706('0x51')]({'plain':!![]});var _0x307d8b=_0xf706('0x2d');return db[_0xf706('0x54')][_0xf706('0x4d')]({'where':{'name':_0x307d8b,'userProfileId':_0x3e2f35[_0xf706('0x55')]},'raw':!![]})['then'](function(_0x59d345){if(_0x59d345&&_0x59d345[_0xf706('0x56')]===0x0){return db[_0xf706('0x2e')][_0xf706('0x4e')]({'name':_0x59c0ef['name'],'resourceId':_0x59c0ef['id'],'type':_0x59d345[_0xf706('0x30')],'sectionId':_0x59d345['id']},{})['then'](function(){return _0x40790c;});}else{return _0x40790c;}})[_0xf706('0x4a')](function(_0x287cd1){logger[_0xf706('0x57')](_0xf706('0x58'),_0x287cd1);throw _0x287cd1;});}return _0x40790c;})[_0xf706('0x2c')](respondWithResult(_0x35b268,0xc9))[_0xf706('0x4a')](handleError(_0x35b268,null));};exports[_0xf706('0x2a')]=function(_0xf4fbd6,_0x358e9a){if(_0xf4fbd6['body']['id']){delete _0xf4fbd6[_0xf706('0x4f')]['id'];}return db[_0xf706('0x33')][_0xf706('0x4d')]({'where':{'id':_0xf4fbd6[_0xf706('0x4c')]['id']}})[_0xf706('0x2c')](handleEntityNotFound(_0x358e9a,null))[_0xf706('0x2c')](saveUpdates(_0xf4fbd6[_0xf706('0x4f')],null))['then'](respondWithResult(_0x358e9a,null))[_0xf706('0x4a')](handleError(_0x358e9a,null));};exports[_0xf706('0x2b')]=function(_0x1b7f69,_0x1d9a3d){return db['OpenchannelQueue']['find']({'where':{'id':_0x1b7f69[_0xf706('0x4c')]['id']}})[_0xf706('0x2c')](handleEntityNotFound(_0x1d9a3d,null))[_0xf706('0x2c')](removeEntity(_0x1d9a3d,null))['catch'](handleError(_0x1d9a3d,null));};exports['describe']=function(_0x3e325d,_0x522bfe){return db[_0xf706('0x33')][_0xf706('0x59')]()[_0xf706('0x2c')](respondWithResult(_0x522bfe,null))[_0xf706('0x4a')](handleError(_0x522bfe,null));};exports['getMembers']=function(_0x57743b,_0x50f0db,_0x430c97){var _0x4d30d9={'raw':!![],'where':{}},_0x5532fc={},_0x4c14fa;return db[_0xf706('0x33')][_0xf706('0x5a')]({'where':{'id':_0x57743b[_0xf706('0x4c')]['id']}})[_0xf706('0x2c')](handleEntityNotFound(_0x50f0db,null))['then'](function(_0x517f02){if(_0x517f02){_0x4c14fa=_0x517f02[_0xf706('0x51')]({'plain':!![]});_0x5532fc[_0xf706('0x36')]=_[_0xf706('0x37')](db[_0xf706('0x5b')][_0xf706('0x34')]);_0x5532fc['query']=_[_0xf706('0x37')](_0x57743b[_0xf706('0x38')]);_0x5532fc[_0xf706('0x39')]=_[_0xf706('0x3a')](_0x5532fc[_0xf706('0x36')],_0x5532fc['query']);_0x4d30d9['attributes']=_[_0xf706('0x3a')](_0x5532fc[_0xf706('0x36')],qs[_0xf706('0x3b')](_0x57743b['query']['fields']));_0x4d30d9[_0xf706('0x3c')]=_0x4d30d9[_0xf706('0x3c')]['length']?_0x4d30d9['attributes']:_0x5532fc['model'];if(!_0x57743b[_0xf706('0x38')]['hasOwnProperty'](_0xf706('0x3e'))){_0x4d30d9['limit']=qs[_0xf706('0x23')](_0x57743b[_0xf706('0x38')][_0xf706('0x23')]);_0x4d30d9[_0xf706('0x21')]=qs[_0xf706('0x21')](_0x57743b[_0xf706('0x38')][_0xf706('0x21')]);}_0x4d30d9[_0xf706('0x3f')]=qs[_0xf706('0x40')](_0x57743b[_0xf706('0x38')][_0xf706('0x40')]);_0x4d30d9[_0xf706('0x41')]=qs[_0xf706('0x39')](_[_0xf706('0x42')](_0x57743b[_0xf706('0x38')],_0x5532fc[_0xf706('0x39')]));_0x4d30d9[_0xf706('0x41')][_0xf706('0x5c')]=_0x517f02['id'];if(_0x57743b[_0xf706('0x38')][_0xf706('0x43')]){_0x4d30d9['where']=_[_0xf706('0x45')](_0x4d30d9[_0xf706('0x41')],{'$or':_[_0xf706('0x32')](_0x4d30d9[_0xf706('0x3c')],function(_0xc368ec){var _0x1308a5={};_0x1308a5[_0xc368ec]={'$like':'%'+_0x57743b['query']['filter']+'%'};return _0x1308a5;})});}_0x4d30d9=_[_0xf706('0x45')]({},_0x4d30d9,_0x57743b['options']);return db[_0xf706('0x5b')]['findAll'](_0x4d30d9);}})[_0xf706('0x2c')](function(_0x4d4155){if(_0x4d4155){return db[_0xf706('0x5d')][_0xf706('0x5e')]({'where':{'id':_[_0xf706('0x32')](_0x4d4155,_0xf706('0x5f')),'role':_0xf706('0x60')},'attributes':['id',_0xf706('0x30'),'openchannelPause','updatedAt',_0xf706('0x61')]});}})['then'](function(_0x10c7b4){if(_0x10c7b4){return{'count':_0x10c7b4[_0xf706('0x24')],'rows':_[_0xf706('0x32')](_0x10c7b4[_0xf706('0x49')],function(_0x45f1e7){return{'membername':_0x45f1e7[_0xf706('0x30')],'UserId':_0x45f1e7['id'],'queue_name':_0x4c14fa['name'],'OpenchannelQueueId':_0x4c14fa['id'],'interface':util[_0xf706('0x62')](_0xf706('0x63'),_0xf706('0x64'),_0x45f1e7[_0xf706('0x30')]),'penalty':0x0,'paused':_0x45f1e7['openchannelPause'],'createdAt':_0x45f1e7[_0xf706('0x61')],'updatedAt':_0x45f1e7[_0xf706('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf706('0x2c')](respondWithFilteredResult(_0x50f0db,_0x4d30d9))[_0xf706('0x4a')](handleError(_0x50f0db,null));};exports[_0xf706('0x66')]=function(_0x26224f,_0x29547e,_0x1f8ea0){var _0x4b6581={};var _0x357793={};var _0xfda2c4;var _0x49cc6a;return db['OpenchannelQueue'][_0xf706('0x5a')]({'where':{'id':_0x26224f[_0xf706('0x4c')]['id']}})[_0xf706('0x2c')](handleEntityNotFound(_0x29547e,null))[_0xf706('0x2c')](function(_0x32a372){if(_0x32a372){_0xfda2c4=_0x32a372;_0x357793[_0xf706('0x36')]=_[_0xf706('0x37')](db[_0xf706('0x67')]['rawAttributes']);_0x357793[_0xf706('0x38')]=_[_0xf706('0x37')](_0x26224f['query']);_0x357793[_0xf706('0x39')]=_[_0xf706('0x3a')](_0x357793[_0xf706('0x36')],_0x357793[_0xf706('0x38')]);_0x4b6581[_0xf706('0x3c')]=_['intersection'](_0x357793['model'],qs[_0xf706('0x3b')](_0x26224f[_0xf706('0x38')]['fields']));_0x4b6581['attributes']=_0x4b6581['attributes'][_0xf706('0x3d')]?_0x4b6581[_0xf706('0x3c')]:_0x357793[_0xf706('0x36')];_0x4b6581[_0xf706('0x3f')]=qs[_0xf706('0x40')](_0x26224f['query']['sort']);_0x4b6581[_0xf706('0x41')]=qs[_0xf706('0x39')](_[_0xf706('0x42')](_0x26224f['query'],_0x357793[_0xf706('0x39')]));if(_0x26224f['query'][_0xf706('0x43')]){_0x4b6581[_0xf706('0x41')]=_[_0xf706('0x45')](_0x4b6581[_0xf706('0x41')],{'$or':_['map'](_0x4b6581['attributes'],function(_0x384a9f){var _0x3c2d65={};_0x3c2d65[_0x384a9f]={'$like':'%'+_0x26224f[_0xf706('0x38')]['filter']+'%'};return _0x3c2d65;})});}_0x4b6581=_['merge']({},_0x4b6581,_0x26224f[_0xf706('0x46')]);return _0xfda2c4['getTeams'](_0x4b6581);}})[_0xf706('0x2c')](function(_0x12f503){if(_0x12f503){_0x49cc6a=_0x12f503[_0xf706('0x3d')];if(!_0x26224f[_0xf706('0x38')][_0xf706('0x68')]('nolimit')){_0x4b6581[_0xf706('0x23')]=qs[_0xf706('0x23')](_0x26224f[_0xf706('0x38')][_0xf706('0x23')]);_0x4b6581[_0xf706('0x21')]=qs['offset'](_0x26224f[_0xf706('0x38')]['offset']);}return _0xfda2c4[_0xf706('0x66')](_0x4b6581);}})[_0xf706('0x2c')](function(_0x36ff9f){if(_0x36ff9f){return _0x36ff9f?{'count':_0x49cc6a,'rows':_0x36ff9f}:null;}})[_0xf706('0x2c')](respondWithResult(_0x29547e,null))[_0xf706('0x4a')](handleError(_0x29547e,null));};exports[_0xf706('0x69')]=function(_0x5c6c30,_0x57ad27,_0x503853){var _0xb66ba5=_0x5c6c30['body'][_0xf706('0x6a')];return db[_0xf706('0x67')][_0xf706('0x6b')]({'where':{'id':_0xb66ba5},'attributes':['id'],'include':[{'model':db[_0xf706('0x5d')],'as':_0xf706('0x6c'),'attributes':['id',_0xf706('0x30'),_0xf706('0x6d'),_0xf706('0x6e'),_0xf706('0x6f')],'raw':!![]}]})['then'](function(_0x1704d1){if(_0x1704d1){var _0x22acec=_[_0xf706('0x70')](_0x1704d1,function(_0x1d2d62){var _0x1098dc=_0x1d2d62[_0xf706('0x51')]({'plain':!![]});return _0x1098dc[_0xf706('0x6c')];});return db[_0xf706('0x33')]['find']({'where':{'id':_0x5c6c30[_0xf706('0x4c')]['id']}})[_0xf706('0x2c')](function(_0x268ba3){return db[_0xf706('0x71')]['transaction'](function(_0x47e5de){return _0x268ba3[_0xf706('0x69')](_0xb66ba5,{'transaction':_0x47e5de})[_0xf706('0x2c')](function(){return BPromise['each'](_0x22acec,function(_0x454e7d){return db[_0xf706('0x5b')][_0xf706('0x72')]({'where':{'UserId':_0x454e7d['id'],'OpenchannelQueueId':_0x5c6c30[_0xf706('0x4c')]['id']},'transaction':_0x47e5de});});})[_0xf706('0x2c')](function(){_0x22acec[_0xf706('0x73')](function(_0x1c2830){socket[_0xf706('0x74')](_0xf706('0x75'),{'UserId':_0x1c2830['id'],'OpenchannelQueueId':_0x268ba3['id']});});});});});}})[_0xf706('0x2c')](respondWithStatusCode(_0x57ad27,null))[_0xf706('0x4a')](handleError(_0x57ad27,null));};exports[_0xf706('0x76')]=function(_0x2b358f,_0x12bbfa,_0x8be9f0){return db[_0xf706('0x67')][_0xf706('0x6b')]({'where':{'id':_0x2b358f[_0xf706('0x38')][_0xf706('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xf706('0x5d')],'as':_0xf706('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf706('0x2c')](handleEntityNotFound(_0x12bbfa,null))[_0xf706('0x2c')](function(_0x4a2194){var _0x41d52c=_[_0xf706('0x32')](_0x4a2194,'id');var _0x1dde17=[];var _0x300d25=[];var _0xa6a2ea=squel[_0xf706('0x77')]();_0xa6a2ea[_0xf706('0x78')](_0xf706('0x79'))[_0xf706('0x7a')](_0xf706('0x7b'),'tq')[_0xf706('0x7c')](_0xf706('0x7d'),'ut',_0xf706('0x7e'))[_0xf706('0x41')](_0xf706('0x7f'),_0x2b358f[_0xf706('0x4c')]['id']);for(var _0x34aa5c=0x0;_0x34aa5c<_0x4a2194['length'];_0x34aa5c+=0x1){let _0x5ad3f6=_0x4a2194[_0x34aa5c];for(var _0x5058ca=0x0;_0x5058ca<_0x5ad3f6[_0xf706('0x6c')][_0xf706('0x3d')];_0x5058ca+=0x1){let _0x5aa8f7=_0x5ad3f6[_0xf706('0x6c')][_0x5058ca];var _0x20fd10=_0xa6a2ea[_0xf706('0x80')]();_0x20fd10[_0xf706('0x41')](_0xf706('0x81'),_0x5aa8f7['id']);_0x300d25[_0xf706('0x82')](db[_0xf706('0x71')]['query'](_0x20fd10[_0xf706('0x83')](),{'type':db[_0xf706('0x71')][_0xf706('0x84')][_0xf706('0x85')]})[_0xf706('0x2c')](function(_0x42c29a){if(_0x42c29a[_0xf706('0x3d')]===0x1){return _0x5aa8f7['id'];}else{var _0x2a3bfc=_['every'](_['map'](_0x42c29a,_0xf706('0x86')),function(_0x38202e){return _[_0xf706('0x87')](_0x41d52c,_0x38202e);});if(_0x2a3bfc){return _0x5aa8f7['id'];}}}));}}return BPromise[_0xf706('0x88')](_0x300d25)[_0xf706('0x2c')](function(_0x5ac55c){_0x1dde17=_(_0x1dde17)[_0xf706('0x89')](_0x5ac55c)[_0xf706('0x8a')]()[_0xf706('0x8b')]();return db[_0xf706('0x33')][_0xf706('0x4d')]({'where':{'id':_0x2b358f['params']['id']}})[_0xf706('0x2c')](function(_0x4dad3a){return db[_0xf706('0x71')][_0xf706('0x8c')](function(_0x521642){return _0x4dad3a[_0xf706('0x76')](_0x2b358f[_0xf706('0x38')][_0xf706('0x6a')],{'transaction':_0x521642})['then'](function(){if(!_[_0xf706('0x8d')](_0x1dde17)){return _0x4dad3a[_0xf706('0x8e')](_0x1dde17,{'transaction':_0x521642});}})['then'](function(){_0x1dde17[_0xf706('0x73')](function(_0x555d71){socket[_0xf706('0x74')](_0xf706('0x8f'),{'UserId':_0x555d71,'OpenchannelQueueId':_0x4dad3a['id']});});});});});});})[_0xf706('0x2c')](respondWithStatusCode(_0x12bbfa,null))[_0xf706('0x4a')](handleError(_0x12bbfa,null));};exports['addAgents']=function(_0x34903c,_0x1c2d39,_0x449bb8){return db['OpenchannelQueue'][_0xf706('0x4d')]({'where':{'id':_0x34903c[_0xf706('0x4c')]['id']}})[_0xf706('0x2c')](handleEntityNotFound(_0x1c2d39,null))['then'](function(_0x50f68a){if(_0x50f68a){return _0x50f68a['addAgents'](_0x34903c['body'][_0xf706('0x6a')],_[_0xf706('0x90')](_0x34903c[_0xf706('0x4f')],[_0xf706('0x6a'),'id'])||{})[_0xf706('0x91')](function(_0x4fe788){for(var _0x20c8a4=0x0;_0x20c8a4<_0x34903c['body'][_0xf706('0x6a')]['length'];_0x20c8a4+=0x1){socket[_0xf706('0x74')](_0xf706('0x75'),{'UserId':Number(_0x34903c[_0xf706('0x4f')][_0xf706('0x6a')][_0x20c8a4]),'OpenchannelQueueId':Number(_0x34903c[_0xf706('0x4c')]['id'])});}return _0x4fe788;});}})[_0xf706('0x2c')](respondWithResult(_0x1c2d39,null))[_0xf706('0x4a')](handleError(_0x1c2d39,null));};exports[_0xf706('0x8e')]=function(_0x15137a,_0x43c989,_0x45d031){return db[_0xf706('0x33')][_0xf706('0x4d')]({'where':{'id':_0x15137a['params']['id']}})[_0xf706('0x2c')](handleEntityNotFound(_0x43c989,null))[_0xf706('0x2c')](function(_0xc9e385){if(_0xc9e385){return _0xc9e385[_0xf706('0x8e')](_0x15137a[_0xf706('0x38')][_0xf706('0x6a')])[_0xf706('0x2c')](function(){if(_[_0xf706('0x92')](_0x15137a[_0xf706('0x38')][_0xf706('0x6a')])){for(var _0x220ca7=0x0;_0x220ca7<_0x15137a[_0xf706('0x38')][_0xf706('0x6a')][_0xf706('0x3d')];_0x220ca7+=0x1){socket[_0xf706('0x74')](_0xf706('0x8f'),{'UserId':Number(_0x15137a[_0xf706('0x38')][_0xf706('0x6a')][_0x220ca7]),'OpenchannelQueueId':Number(_0x15137a[_0xf706('0x4c')]['id'])});}}else{socket[_0xf706('0x74')](_0xf706('0x8f'),{'UserId':Number(_0x15137a['query'][_0xf706('0x6a')]),'OpenchannelQueueId':Number(_0x15137a[_0xf706('0x4c')]['id'])});}});}})[_0xf706('0x2c')](respondWithStatusCode(_0x43c989,null))[_0xf706('0x4a')](handleError(_0x43c989,null));};exports[_0xf706('0x93')]=function(_0x496a06,_0x56aca3,_0x50708f){var _0x554286={};var _0x3360f1={};var _0x59ff40;var _0x58e1b3;return db[_0xf706('0x33')]['findOne']({'where':{'id':_0x496a06[_0xf706('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56aca3,null))[_0xf706('0x2c')](function(_0x3cf6d6){if(_0x3cf6d6){_0x59ff40=_0x3cf6d6;_0x3360f1['model']=_['keys'](db[_0xf706('0x5d')][_0xf706('0x34')]);_0x3360f1[_0xf706('0x38')]=_['keys'](_0x496a06['query']);_0x3360f1[_0xf706('0x39')]=_[_0xf706('0x3a')](_0x3360f1[_0xf706('0x36')],_0x3360f1['query']);_0x554286[_0xf706('0x3c')]=_[_0xf706('0x3a')](_0x3360f1[_0xf706('0x36')],qs[_0xf706('0x3b')](_0x496a06[_0xf706('0x38')]['fields']));_0x554286['attributes']=_0x554286[_0xf706('0x3c')][_0xf706('0x3d')]?_0x554286[_0xf706('0x3c')]:_0x3360f1[_0xf706('0x36')];_0x554286['order']=qs[_0xf706('0x40')](_0x496a06['query']['sort']);_0x554286['where']=qs[_0xf706('0x39')](_[_0xf706('0x42')](_0x496a06[_0xf706('0x38')],_0x3360f1[_0xf706('0x39')]));if(_0x496a06['query'][_0xf706('0x43')]){_0x554286[_0xf706('0x41')]=_[_0xf706('0x45')](_0x554286[_0xf706('0x41')],{'$or':_[_0xf706('0x32')](_0x554286['attributes'],function(_0xc24ca2){var _0x53b502={};_0x53b502[_0xc24ca2]={'$like':'%'+_0x496a06[_0xf706('0x38')][_0xf706('0x43')]+'%'};return _0x53b502;})});}_0x554286=_[_0xf706('0x45')]({},_0x554286,_0x496a06[_0xf706('0x46')]);return _0x59ff40[_0xf706('0x93')](_0x554286);}})['then'](function(_0x40ac5e){if(_0x40ac5e){_0x58e1b3=_0x40ac5e['length'];if(!_0x496a06[_0xf706('0x38')]['hasOwnProperty'](_0xf706('0x3e'))){_0x554286[_0xf706('0x23')]=qs[_0xf706('0x23')](_0x496a06['query'][_0xf706('0x23')]);_0x554286[_0xf706('0x21')]=qs['offset'](_0x496a06[_0xf706('0x38')]['offset']);}return _0x59ff40['getAgents'](_0x554286);}})[_0xf706('0x2c')](function(_0x54b3aa){if(_0x54b3aa){return _0x54b3aa?{'count':_0x58e1b3,'rows':_0x54b3aa}:null;}})['then'](respondWithResult(_0x56aca3,null))[_0xf706('0x4a')](handleError(_0x56aca3,null));}; \ No newline at end of file +var _0x0cf1=['lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','OpenchannelQueues','UserProfileResource','then','end','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x0cf1,0x80));var _0x10cf=function(_0x17a187,_0xb77d35){_0x17a187=_0x17a187-0x0;var _0x1de848=_0x0cf1[_0x17a187];return _0x1de848;};'use strict';var emlformat=require(_0x10cf('0x0'));var rimraf=require(_0x10cf('0x1'));var zipdir=require(_0x10cf('0x2'));var jsonpatch=require(_0x10cf('0x3'));var rp=require(_0x10cf('0x4'));var moment=require(_0x10cf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x10cf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x10cf('0x7'));var csv=require(_0x10cf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10cf('0x9'));var _=require(_0x10cf('0xa'));var squel=require('squel');var crypto=require(_0x10cf('0xb'));var jsforce=require(_0x10cf('0xc'));var deskjs=require(_0x10cf('0xd'));var toCsv=require(_0x10cf('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10cf('0xe'));var authService=require(_0x10cf('0xf'));var qs=require(_0x10cf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10cf('0x11'));var logger=require(_0x10cf('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x10cf('0x13'));var licenseUtil=require(_0x10cf('0x14'));var db=require(_0x10cf('0x15'))['db'];config[_0x10cf('0x16')]=_[_0x10cf('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x10cf('0x18'))(new Redis(config[_0x10cf('0x16')]));require(_0x10cf('0x19'))['register'](socket);function respondWithStatusCode(_0x12fb3c,_0x25f3c8){_0x25f3c8=_0x25f3c8||0xcc;return function(_0x22a30a){if(_0x22a30a){return _0x12fb3c[_0x10cf('0x1a')](_0x25f3c8);}return _0x12fb3c[_0x10cf('0x1b')](_0x25f3c8)['end']();};}function respondWithResult(_0x1f3b6e,_0x2f7afa){_0x2f7afa=_0x2f7afa||0xc8;return function(_0x10c214){if(_0x10c214){return _0x1f3b6e[_0x10cf('0x1b')](_0x2f7afa)[_0x10cf('0x1c')](_0x10c214);}};}function respondWithFilteredResult(_0x1b11fd,_0x4b0847){return function(_0x2dedd4){if(_0x2dedd4){var _0x2b845b=typeof _0x4b0847[_0x10cf('0x1d')]===_0x10cf('0x1e')&&typeof _0x4b0847[_0x10cf('0x1f')]===_0x10cf('0x1e');var _0x4346dc=_0x2dedd4[_0x10cf('0x20')];var _0x544d93=_0x2b845b?0x0:_0x4b0847[_0x10cf('0x1d')];var _0x534e0f=_0x2b845b?_0x2dedd4[_0x10cf('0x20')]:_0x4b0847[_0x10cf('0x1d')]+_0x4b0847[_0x10cf('0x1f')];var _0x4cc244;if(_0x534e0f>=_0x4346dc){_0x534e0f=_0x4346dc;_0x4cc244=0xc8;}else{_0x4cc244=0xce;}_0x1b11fd[_0x10cf('0x1b')](_0x4cc244);return _0x1b11fd[_0x10cf('0x21')]('Content-Range',_0x544d93+'-'+_0x534e0f+'/'+_0x4346dc)[_0x10cf('0x1c')](_0x2dedd4);}return null;};}function patchUpdates(_0x97fd39){return function(_0x3e355b){try{jsonpatch[_0x10cf('0x22')](_0x3e355b,_0x97fd39,!![]);}catch(_0x3cf1a2){return BPromise['reject'](_0x3cf1a2);}return _0x3e355b[_0x10cf('0x23')]();};}function saveUpdates(_0x266c05,_0x42e600){return function(_0x3538cf){if(_0x3538cf){return _0x3538cf[_0x10cf('0x24')](_0x266c05)['then'](function(_0x18380c){return _0x18380c;});}return null;};}function removeEntity(_0x1fed38,_0x4bd874){return function(_0x5b151a){if(_0x5b151a){return _0x5b151a[_0x10cf('0x25')]()['then'](function(){var _0x5e0e55=_0x5b151a[_0x10cf('0x26')]({'plain':!![]});var _0x3397a8=_0x10cf('0x27');return db[_0x10cf('0x28')][_0x10cf('0x25')]({'where':{'type':_0x3397a8,'resourceId':_0x5e0e55['id']}})[_0x10cf('0x29')](function(){return _0x5b151a;});})[_0x10cf('0x29')](function(){_0x1fed38[_0x10cf('0x1b')](0xcc)[_0x10cf('0x2a')]();});}};}function handleEntityNotFound(_0x516706,_0x49b1f6){return function(_0x408761){if(!_0x408761){_0x516706[_0x10cf('0x1a')](0x194);}return _0x408761;};}function handleError(_0x5a1888,_0x57e438){_0x57e438=_0x57e438||0x1f4;return function(_0x2a08de){logger['error'](_0x2a08de[_0x10cf('0x2b')]);if(_0x2a08de[_0x10cf('0x2c')]){delete _0x2a08de[_0x10cf('0x2c')];}_0x5a1888['status'](_0x57e438)[_0x10cf('0x2d')](_0x2a08de);};}exports[_0x10cf('0x2e')]=function(_0x4fdfd8,_0x4d1d22){var _0x4b6916={},_0x3a6b56={},_0x461573={'count':0x0,'rows':[]};var _0x59a184=_[_0x10cf('0x2f')](db[_0x10cf('0x30')][_0x10cf('0x31')],function(_0x1c83d1){return{'name':_0x1c83d1[_0x10cf('0x32')],'type':_0x1c83d1[_0x10cf('0x33')]['key']};});_0x3a6b56[_0x10cf('0x34')]=_[_0x10cf('0x2f')](_0x59a184,_0x10cf('0x2c'));_0x3a6b56['query']=_[_0x10cf('0x35')](_0x4fdfd8['query']);_0x3a6b56[_0x10cf('0x36')]=_[_0x10cf('0x37')](_0x3a6b56[_0x10cf('0x34')],_0x3a6b56['query']);_0x4b6916[_0x10cf('0x38')]=_[_0x10cf('0x37')](_0x3a6b56[_0x10cf('0x34')],qs['fields'](_0x4fdfd8[_0x10cf('0x39')][_0x10cf('0x3a')]));_0x4b6916[_0x10cf('0x38')]=_0x4b6916[_0x10cf('0x38')][_0x10cf('0x3b')]?_0x4b6916['attributes']:_0x3a6b56[_0x10cf('0x34')];if(!_0x4fdfd8[_0x10cf('0x39')][_0x10cf('0x3c')](_0x10cf('0x3d'))){_0x4b6916['limit']=qs['limit'](_0x4fdfd8[_0x10cf('0x39')]['limit']);_0x4b6916[_0x10cf('0x1d')]=qs[_0x10cf('0x1d')](_0x4fdfd8[_0x10cf('0x39')][_0x10cf('0x1d')]);}_0x4b6916['order']=qs['sort'](_0x4fdfd8[_0x10cf('0x39')][_0x10cf('0x3e')]);_0x4b6916[_0x10cf('0x3f')]=qs[_0x10cf('0x36')](_[_0x10cf('0x40')](_0x4fdfd8['query'],_0x3a6b56[_0x10cf('0x36')]),_0x59a184);if(_0x4fdfd8[_0x10cf('0x39')][_0x10cf('0x41')]){_0x4b6916[_0x10cf('0x3f')]=_[_0x10cf('0x42')](_0x4b6916[_0x10cf('0x3f')],{'$or':_[_0x10cf('0x2f')](_0x59a184,function(_0x5006a6){if(_0x5006a6[_0x10cf('0x33')]!==_0x10cf('0x43')){var _0x5a070d={};_0x5a070d[_0x5006a6['name']]={'$like':'%'+_0x4fdfd8[_0x10cf('0x39')][_0x10cf('0x41')]+'%'};return _0x5a070d;}})});}_0x4b6916=_[_0x10cf('0x42')]({},_0x4b6916,_0x4fdfd8[_0x10cf('0x44')]);var _0x2a02eb={'where':_0x4b6916[_0x10cf('0x3f')]};return db[_0x10cf('0x30')][_0x10cf('0x20')](_0x2a02eb)['then'](function(_0x4ade2e){_0x461573[_0x10cf('0x20')]=_0x4ade2e;if(_0x4fdfd8['query'][_0x10cf('0x45')]){_0x4b6916[_0x10cf('0x46')]=[{'all':!![]}];}return db[_0x10cf('0x30')][_0x10cf('0x47')](_0x4b6916);})[_0x10cf('0x29')](function(_0x18e1a6){_0x461573[_0x10cf('0x48')]=_0x18e1a6;return _0x461573;})[_0x10cf('0x29')](respondWithFilteredResult(_0x4d1d22,_0x4b6916))[_0x10cf('0x49')](handleError(_0x4d1d22,null));};exports['show']=function(_0x1259aa,_0x12ace1){var _0x1afdab={'raw':!![],'where':{'id':_0x1259aa[_0x10cf('0x4a')]['id']}},_0x25f001={};_0x25f001[_0x10cf('0x34')]=_[_0x10cf('0x35')](db[_0x10cf('0x30')][_0x10cf('0x31')]);_0x25f001['query']=_[_0x10cf('0x35')](_0x1259aa['query']);_0x25f001[_0x10cf('0x36')]=_[_0x10cf('0x37')](_0x25f001['model'],_0x25f001[_0x10cf('0x39')]);_0x1afdab['attributes']=_[_0x10cf('0x37')](_0x25f001[_0x10cf('0x34')],qs[_0x10cf('0x3a')](_0x1259aa[_0x10cf('0x39')][_0x10cf('0x3a')]));_0x1afdab[_0x10cf('0x38')]=_0x1afdab[_0x10cf('0x38')][_0x10cf('0x3b')]?_0x1afdab[_0x10cf('0x38')]:_0x25f001['model'];if(_0x1259aa['query'][_0x10cf('0x45')]){_0x1afdab['include']=[{'all':!![]}];}_0x1afdab=_[_0x10cf('0x42')]({},_0x1afdab,_0x1259aa[_0x10cf('0x44')]);return db[_0x10cf('0x30')][_0x10cf('0x4b')](_0x1afdab)['then'](handleEntityNotFound(_0x12ace1,null))[_0x10cf('0x29')](respondWithResult(_0x12ace1,null))['catch'](handleError(_0x12ace1,null));};exports[_0x10cf('0x4c')]=function(_0xbbe5bb,_0x3acd28){return db['OpenchannelQueue'][_0x10cf('0x4c')](_0xbbe5bb[_0x10cf('0x4d')],{})[_0x10cf('0x29')](function(_0x3e5a92){var _0x10eb44=_0xbbe5bb[_0x10cf('0x4e')]['get']({'plain':!![]});if(!_0x10eb44)throw new Error(_0x10cf('0x4f'));if(_0x10eb44[_0x10cf('0x50')]===_0x10cf('0x4e')){var _0x3b887c=_0x3e5a92[_0x10cf('0x26')]({'plain':!![]});var _0x322582=_0x10cf('0x27');return db[_0x10cf('0x51')][_0x10cf('0x4b')]({'where':{'name':_0x322582,'userProfileId':_0x10eb44['userProfileId']},'raw':!![]})['then'](function(_0x161d35){if(_0x161d35&&_0x161d35[_0x10cf('0x52')]===0x0){return db[_0x10cf('0x28')][_0x10cf('0x4c')]({'name':_0x3b887c['name'],'resourceId':_0x3b887c['id'],'type':_0x161d35[_0x10cf('0x2c')],'sectionId':_0x161d35['id']},{})[_0x10cf('0x29')](function(){return _0x3e5a92;});}else{return _0x3e5a92;}})['catch'](function(_0x54e6bd){logger[_0x10cf('0x53')](_0x10cf('0x54'),_0x54e6bd);throw _0x54e6bd;});}return _0x3e5a92;})[_0x10cf('0x29')](respondWithResult(_0x3acd28,0xc9))[_0x10cf('0x49')](handleError(_0x3acd28,null));};exports[_0x10cf('0x24')]=function(_0x548717,_0x26f4f9){if(_0x548717['body']['id']){delete _0x548717[_0x10cf('0x4d')]['id'];}return db[_0x10cf('0x30')][_0x10cf('0x4b')]({'where':{'id':_0x548717[_0x10cf('0x4a')]['id']}})[_0x10cf('0x29')](handleEntityNotFound(_0x26f4f9,null))['then'](saveUpdates(_0x548717[_0x10cf('0x4d')],null))[_0x10cf('0x29')](respondWithResult(_0x26f4f9,null))[_0x10cf('0x49')](handleError(_0x26f4f9,null));};exports[_0x10cf('0x25')]=function(_0x208299,_0x232b22){return db['OpenchannelQueue']['find']({'where':{'id':_0x208299[_0x10cf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x232b22,null))[_0x10cf('0x29')](removeEntity(_0x232b22,null))[_0x10cf('0x49')](handleError(_0x232b22,null));};exports[_0x10cf('0x55')]=function(_0x299203,_0x3c8ad2){return db[_0x10cf('0x30')][_0x10cf('0x55')]()['then'](respondWithResult(_0x3c8ad2,null))[_0x10cf('0x49')](handleError(_0x3c8ad2,null));};exports[_0x10cf('0x56')]=function(_0x3c2705,_0x338d82,_0x1873ac){var _0xaa4a5c={'raw':!![],'where':{}},_0x37dc8c={},_0x7e1b62;return db[_0x10cf('0x30')][_0x10cf('0x57')]({'where':{'id':_0x3c2705['params']['id']}})[_0x10cf('0x29')](handleEntityNotFound(_0x338d82,null))[_0x10cf('0x29')](function(_0x479c00){if(_0x479c00){_0x7e1b62=_0x479c00[_0x10cf('0x26')]({'plain':!![]});_0x37dc8c[_0x10cf('0x34')]=_[_0x10cf('0x35')](db[_0x10cf('0x58')]['rawAttributes']);_0x37dc8c[_0x10cf('0x39')]=_[_0x10cf('0x35')](_0x3c2705[_0x10cf('0x39')]);_0x37dc8c['filters']=_[_0x10cf('0x37')](_0x37dc8c['model'],_0x37dc8c[_0x10cf('0x39')]);_0xaa4a5c[_0x10cf('0x38')]=_[_0x10cf('0x37')](_0x37dc8c[_0x10cf('0x34')],qs[_0x10cf('0x3a')](_0x3c2705[_0x10cf('0x39')][_0x10cf('0x3a')]));_0xaa4a5c[_0x10cf('0x38')]=_0xaa4a5c[_0x10cf('0x38')][_0x10cf('0x3b')]?_0xaa4a5c[_0x10cf('0x38')]:_0x37dc8c[_0x10cf('0x34')];if(!_0x3c2705[_0x10cf('0x39')]['hasOwnProperty'](_0x10cf('0x3d'))){_0xaa4a5c[_0x10cf('0x1f')]=qs[_0x10cf('0x1f')](_0x3c2705[_0x10cf('0x39')][_0x10cf('0x1f')]);_0xaa4a5c[_0x10cf('0x1d')]=qs[_0x10cf('0x1d')](_0x3c2705[_0x10cf('0x39')]['offset']);}_0xaa4a5c[_0x10cf('0x59')]=qs[_0x10cf('0x3e')](_0x3c2705['query'][_0x10cf('0x3e')]);_0xaa4a5c[_0x10cf('0x3f')]=qs['filters'](_['pick'](_0x3c2705[_0x10cf('0x39')],_0x37dc8c[_0x10cf('0x36')]));_0xaa4a5c[_0x10cf('0x3f')][_0x10cf('0x5a')]=_0x479c00['id'];if(_0x3c2705[_0x10cf('0x39')][_0x10cf('0x41')]){_0xaa4a5c[_0x10cf('0x3f')]=_[_0x10cf('0x42')](_0xaa4a5c[_0x10cf('0x3f')],{'$or':_['map'](_0xaa4a5c['attributes'],function(_0x3e1b49){var _0x54a604={};_0x54a604[_0x3e1b49]={'$like':'%'+_0x3c2705[_0x10cf('0x39')][_0x10cf('0x41')]+'%'};return _0x54a604;})});}_0xaa4a5c=_[_0x10cf('0x42')]({},_0xaa4a5c,_0x3c2705['options']);return db['UserOpenchannelQueue']['findAll'](_0xaa4a5c);}})[_0x10cf('0x29')](function(_0x2fcb65){if(_0x2fcb65){return db['User'][_0x10cf('0x5b')]({'where':{'id':_[_0x10cf('0x2f')](_0x2fcb65,_0x10cf('0x5c')),'role':'agent'},'attributes':['id',_0x10cf('0x2c'),_0x10cf('0x5d'),_0x10cf('0x5e'),_0x10cf('0x5f')]});}})[_0x10cf('0x29')](function(_0x281cae){if(_0x281cae){return{'count':_0x281cae[_0x10cf('0x20')],'rows':_[_0x10cf('0x2f')](_0x281cae[_0x10cf('0x48')],function(_0x48d033){return{'membername':_0x48d033['name'],'UserId':_0x48d033['id'],'queue_name':_0x7e1b62['name'],'OpenchannelQueueId':_0x7e1b62['id'],'interface':util['format']('%s/%s',_0x10cf('0x60'),_0x48d033[_0x10cf('0x2c')]),'penalty':0x0,'paused':_0x48d033['openchannelPause'],'createdAt':_0x48d033['createdAt'],'updatedAt':_0x48d033[_0x10cf('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x10cf('0x29')](respondWithFilteredResult(_0x338d82,_0xaa4a5c))[_0x10cf('0x49')](handleError(_0x338d82,null));};exports[_0x10cf('0x61')]=function(_0x4dd640,_0x176b6c,_0x1181a2){var _0x23a0cd={};var _0x3893b5={};var _0xdb3089;var _0x4b965b;return db[_0x10cf('0x30')][_0x10cf('0x57')]({'where':{'id':_0x4dd640['params']['id']}})[_0x10cf('0x29')](handleEntityNotFound(_0x176b6c,null))[_0x10cf('0x29')](function(_0xe14822){if(_0xe14822){_0xdb3089=_0xe14822;_0x3893b5[_0x10cf('0x34')]=_[_0x10cf('0x35')](db[_0x10cf('0x62')]['rawAttributes']);_0x3893b5[_0x10cf('0x39')]=_[_0x10cf('0x35')](_0x4dd640[_0x10cf('0x39')]);_0x3893b5[_0x10cf('0x36')]=_['intersection'](_0x3893b5[_0x10cf('0x34')],_0x3893b5[_0x10cf('0x39')]);_0x23a0cd[_0x10cf('0x38')]=_[_0x10cf('0x37')](_0x3893b5[_0x10cf('0x34')],qs[_0x10cf('0x3a')](_0x4dd640['query']['fields']));_0x23a0cd[_0x10cf('0x38')]=_0x23a0cd['attributes'][_0x10cf('0x3b')]?_0x23a0cd[_0x10cf('0x38')]:_0x3893b5[_0x10cf('0x34')];_0x23a0cd[_0x10cf('0x59')]=qs[_0x10cf('0x3e')](_0x4dd640['query'][_0x10cf('0x3e')]);_0x23a0cd[_0x10cf('0x3f')]=qs[_0x10cf('0x36')](_[_0x10cf('0x40')](_0x4dd640['query'],_0x3893b5[_0x10cf('0x36')]));if(_0x4dd640['query'][_0x10cf('0x41')]){_0x23a0cd['where']=_[_0x10cf('0x42')](_0x23a0cd[_0x10cf('0x3f')],{'$or':_[_0x10cf('0x2f')](_0x23a0cd[_0x10cf('0x38')],function(_0x4ca427){var _0x424110={};_0x424110[_0x4ca427]={'$like':'%'+_0x4dd640[_0x10cf('0x39')][_0x10cf('0x41')]+'%'};return _0x424110;})});}_0x23a0cd=_['merge']({},_0x23a0cd,_0x4dd640[_0x10cf('0x44')]);return _0xdb3089[_0x10cf('0x61')](_0x23a0cd);}})[_0x10cf('0x29')](function(_0x2c1dcd){if(_0x2c1dcd){_0x4b965b=_0x2c1dcd[_0x10cf('0x3b')];if(!_0x4dd640[_0x10cf('0x39')][_0x10cf('0x3c')](_0x10cf('0x3d'))){_0x23a0cd[_0x10cf('0x1f')]=qs[_0x10cf('0x1f')](_0x4dd640['query'][_0x10cf('0x1f')]);_0x23a0cd['offset']=qs[_0x10cf('0x1d')](_0x4dd640['query'][_0x10cf('0x1d')]);}return _0xdb3089['getTeams'](_0x23a0cd);}})[_0x10cf('0x29')](function(_0x1e4701){if(_0x1e4701){return _0x1e4701?{'count':_0x4b965b,'rows':_0x1e4701}:null;}})[_0x10cf('0x29')](respondWithResult(_0x176b6c,null))[_0x10cf('0x49')](handleError(_0x176b6c,null));};exports[_0x10cf('0x63')]=function(_0x47c82c,_0x3bebe0,_0x4a063e){var _0xe1bd55=_0x47c82c['body'][_0x10cf('0x64')];return db[_0x10cf('0x62')][_0x10cf('0x47')]({'where':{'id':_0xe1bd55},'attributes':['id'],'include':[{'model':db[_0x10cf('0x65')],'as':_0x10cf('0x66'),'attributes':['id',_0x10cf('0x2c'),_0x10cf('0x67'),_0x10cf('0x68'),_0x10cf('0x69')],'raw':!![]}]})[_0x10cf('0x29')](function(_0x43f40d){if(_0x43f40d){var _0x272ed0=_[_0x10cf('0x6a')](_0x43f40d,function(_0x1c6060){var _0xb713ea=_0x1c6060[_0x10cf('0x26')]({'plain':!![]});return _0xb713ea['Agents'];});return db[_0x10cf('0x30')][_0x10cf('0x4b')]({'where':{'id':_0x47c82c[_0x10cf('0x4a')]['id']}})[_0x10cf('0x29')](function(_0x28cd10){return db[_0x10cf('0x6b')]['transaction'](function(_0x3c128f){return _0x28cd10[_0x10cf('0x63')](_0xe1bd55,{'transaction':_0x3c128f})[_0x10cf('0x29')](function(){return BPromise['each'](_0x272ed0,function(_0x54cf09){return db[_0x10cf('0x58')][_0x10cf('0x6c')]({'where':{'UserId':_0x54cf09['id'],'OpenchannelQueueId':_0x47c82c[_0x10cf('0x4a')]['id']},'transaction':_0x3c128f});});})[_0x10cf('0x29')](function(){_0x272ed0[_0x10cf('0x6d')](function(_0x1f860d){socket[_0x10cf('0x6e')](_0x10cf('0x6f'),{'UserId':_0x1f860d['id'],'OpenchannelQueueId':_0x28cd10['id']});});});});});}})[_0x10cf('0x29')](respondWithStatusCode(_0x3bebe0,null))[_0x10cf('0x49')](handleError(_0x3bebe0,null));};exports[_0x10cf('0x70')]=function(_0x1a591a,_0x5130ba,_0x8064ce){return db['Team'][_0x10cf('0x47')]({'where':{'id':_0x1a591a[_0x10cf('0x39')][_0x10cf('0x64')]},'attributes':['id'],'include':[{'model':db[_0x10cf('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x10cf('0x29')](handleEntityNotFound(_0x5130ba,null))[_0x10cf('0x29')](function(_0x2b7f81){var _0x253c54=_[_0x10cf('0x2f')](_0x2b7f81,'id');var _0x29b3f6=[];var _0x1f922b=[];var _0xb7b04f=squel[_0x10cf('0x71')]();_0xb7b04f[_0x10cf('0x72')](_0x10cf('0x73'))[_0x10cf('0x74')](_0x10cf('0x75'),'tq')[_0x10cf('0x76')](_0x10cf('0x77'),'ut',_0x10cf('0x78'))[_0x10cf('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x1a591a[_0x10cf('0x4a')]['id']);for(var _0x3ab38c=0x0;_0x3ab38c<_0x2b7f81[_0x10cf('0x3b')];_0x3ab38c+=0x1){let _0x18422a=_0x2b7f81[_0x3ab38c];for(var _0x27e40f=0x0;_0x27e40f<_0x18422a[_0x10cf('0x66')][_0x10cf('0x3b')];_0x27e40f+=0x1){let _0x2193ad=_0x18422a[_0x10cf('0x66')][_0x27e40f];var _0x315740=_0xb7b04f[_0x10cf('0x79')]();_0x315740[_0x10cf('0x3f')](_0x10cf('0x7a'),_0x2193ad['id']);_0x1f922b['push'](db['sequelize'][_0x10cf('0x39')](_0x315740[_0x10cf('0x7b')](),{'type':db[_0x10cf('0x6b')][_0x10cf('0x7c')][_0x10cf('0x7d')]})['then'](function(_0x262a3f){if(_0x262a3f[_0x10cf('0x3b')]===0x1){return _0x2193ad['id'];}else{var _0x39d8f8=_[_0x10cf('0x7e')](_['map'](_0x262a3f,'TeamId'),function(_0x2bff9a){return _[_0x10cf('0x7f')](_0x253c54,_0x2bff9a);});if(_0x39d8f8){return _0x2193ad['id'];}}}));}}return BPromise[_0x10cf('0x80')](_0x1f922b)[_0x10cf('0x29')](function(_0x49ea03){_0x29b3f6=_(_0x29b3f6)[_0x10cf('0x81')](_0x49ea03)['compact']()[_0x10cf('0x82')]();return db[_0x10cf('0x30')][_0x10cf('0x4b')]({'where':{'id':_0x1a591a[_0x10cf('0x4a')]['id']}})['then'](function(_0x4817fe){return db[_0x10cf('0x6b')]['transaction'](function(_0x3e9aa4){return _0x4817fe[_0x10cf('0x70')](_0x1a591a[_0x10cf('0x39')][_0x10cf('0x64')],{'transaction':_0x3e9aa4})[_0x10cf('0x29')](function(){if(!_['isEmpty'](_0x29b3f6)){return _0x4817fe[_0x10cf('0x83')](_0x29b3f6,{'transaction':_0x3e9aa4});}})[_0x10cf('0x29')](function(){_0x29b3f6[_0x10cf('0x6d')](function(_0x57e877){socket[_0x10cf('0x6e')](_0x10cf('0x84'),{'UserId':_0x57e877,'OpenchannelQueueId':_0x4817fe['id']});});});});});});})['then'](respondWithStatusCode(_0x5130ba,null))[_0x10cf('0x49')](handleError(_0x5130ba,null));};exports[_0x10cf('0x85')]=function(_0x332170,_0x3958b7,_0x5b1238){return db['OpenchannelQueue']['find']({'where':{'id':_0x332170[_0x10cf('0x4a')]['id']}})[_0x10cf('0x29')](handleEntityNotFound(_0x3958b7,null))[_0x10cf('0x29')](function(_0x126beb){if(_0x126beb){return _0x126beb[_0x10cf('0x85')](_0x332170[_0x10cf('0x4d')]['ids'],_[_0x10cf('0x86')](_0x332170['body'],[_0x10cf('0x64'),'id'])||{})[_0x10cf('0x87')](function(_0x15cef7){for(var _0x23a69c=0x0;_0x23a69c<_0x332170['body'][_0x10cf('0x64')]['length'];_0x23a69c+=0x1){socket[_0x10cf('0x6e')]('userOpenchannelQueue:save',{'UserId':Number(_0x332170[_0x10cf('0x4d')][_0x10cf('0x64')][_0x23a69c]),'OpenchannelQueueId':Number(_0x332170[_0x10cf('0x4a')]['id'])});}return _0x15cef7;});}})[_0x10cf('0x29')](respondWithResult(_0x3958b7,null))[_0x10cf('0x49')](handleError(_0x3958b7,null));};exports['removeAgents']=function(_0x3dc429,_0x1ad4f9,_0x18ade3){return db[_0x10cf('0x30')][_0x10cf('0x4b')]({'where':{'id':_0x3dc429[_0x10cf('0x4a')]['id']}})[_0x10cf('0x29')](handleEntityNotFound(_0x1ad4f9,null))[_0x10cf('0x29')](function(_0x1eccb2){if(_0x1eccb2){return _0x1eccb2['removeAgents'](_0x3dc429['query']['ids'])['then'](function(){if(_[_0x10cf('0x88')](_0x3dc429[_0x10cf('0x39')][_0x10cf('0x64')])){for(var _0x42dff9=0x0;_0x42dff9<_0x3dc429[_0x10cf('0x39')][_0x10cf('0x64')]['length'];_0x42dff9+=0x1){socket[_0x10cf('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3dc429[_0x10cf('0x39')][_0x10cf('0x64')][_0x42dff9]),'OpenchannelQueueId':Number(_0x3dc429[_0x10cf('0x4a')]['id'])});}}else{socket['emit'](_0x10cf('0x84'),{'UserId':Number(_0x3dc429['query'][_0x10cf('0x64')]),'OpenchannelQueueId':Number(_0x3dc429[_0x10cf('0x4a')]['id'])});}});}})[_0x10cf('0x29')](respondWithStatusCode(_0x1ad4f9,null))[_0x10cf('0x49')](handleError(_0x1ad4f9,null));};exports[_0x10cf('0x89')]=function(_0x4009a3,_0x50f962,_0x409fb9){var _0x565e0b={};var _0x5c814f={};var _0x45614c;var _0x15bc1f;return db[_0x10cf('0x30')][_0x10cf('0x57')]({'where':{'id':_0x4009a3[_0x10cf('0x4a')]['id']}})[_0x10cf('0x29')](handleEntityNotFound(_0x50f962,null))[_0x10cf('0x29')](function(_0x214e9c){if(_0x214e9c){_0x45614c=_0x214e9c;_0x5c814f['model']=_[_0x10cf('0x35')](db[_0x10cf('0x65')][_0x10cf('0x31')]);_0x5c814f[_0x10cf('0x39')]=_['keys'](_0x4009a3['query']);_0x5c814f[_0x10cf('0x36')]=_[_0x10cf('0x37')](_0x5c814f[_0x10cf('0x34')],_0x5c814f['query']);_0x565e0b[_0x10cf('0x38')]=_[_0x10cf('0x37')](_0x5c814f[_0x10cf('0x34')],qs['fields'](_0x4009a3['query']['fields']));_0x565e0b[_0x10cf('0x38')]=_0x565e0b['attributes'][_0x10cf('0x3b')]?_0x565e0b[_0x10cf('0x38')]:_0x5c814f[_0x10cf('0x34')];_0x565e0b[_0x10cf('0x59')]=qs[_0x10cf('0x3e')](_0x4009a3[_0x10cf('0x39')][_0x10cf('0x3e')]);_0x565e0b['where']=qs[_0x10cf('0x36')](_[_0x10cf('0x40')](_0x4009a3['query'],_0x5c814f['filters']));if(_0x4009a3[_0x10cf('0x39')][_0x10cf('0x41')]){_0x565e0b[_0x10cf('0x3f')]=_[_0x10cf('0x42')](_0x565e0b['where'],{'$or':_[_0x10cf('0x2f')](_0x565e0b['attributes'],function(_0x31f977){var _0x10da71={};_0x10da71[_0x31f977]={'$like':'%'+_0x4009a3[_0x10cf('0x39')]['filter']+'%'};return _0x10da71;})});}_0x565e0b=_[_0x10cf('0x42')]({},_0x565e0b,_0x4009a3[_0x10cf('0x44')]);return _0x45614c[_0x10cf('0x89')](_0x565e0b);}})[_0x10cf('0x29')](function(_0x5eea4a){if(_0x5eea4a){_0x15bc1f=_0x5eea4a['length'];if(!_0x4009a3['query'][_0x10cf('0x3c')](_0x10cf('0x3d'))){_0x565e0b[_0x10cf('0x1f')]=qs[_0x10cf('0x1f')](_0x4009a3[_0x10cf('0x39')]['limit']);_0x565e0b[_0x10cf('0x1d')]=qs[_0x10cf('0x1d')](_0x4009a3[_0x10cf('0x39')][_0x10cf('0x1d')]);}return _0x45614c[_0x10cf('0x89')](_0x565e0b);}})[_0x10cf('0x29')](function(_0x49e2e2){if(_0x49e2e2){return _0x49e2e2?{'count':_0x15bc1f,'rows':_0x49e2e2}:null;}})[_0x10cf('0x29')](respondWithResult(_0x50f962,null))[_0x10cf('0x49')](handleError(_0x50f962,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 144baa0..6ca2b9b 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 _0xe50e=['exports','events','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x114363,_0x165747){var _0x35d3e6=function(_0x3e3a68){while(--_0x3e3a68){_0x114363['push'](_0x114363['shift']());}};_0x35d3e6(++_0x165747);}(_0xe50e,0xf9));var _0xee50=function(_0x6f0bdb,_0xb91694){_0x6f0bdb=_0x6f0bdb-0x0;var _0x22cc09=_0xe50e[_0x6f0bdb];return _0x22cc09;};'use strict';var EventEmitter=require(_0xee50('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee50('0x1'),'afterUpdate':_0xee50('0x2'),'afterDestroy':_0xee50('0x3')};function emitEvent(_0x13a2c3){return function(_0xeec6c5,_0x40272b,_0x4895a){OpenchannelQueueEvents[_0xee50('0x4')](_0x13a2c3+':'+_0xeec6c5['id'],_0xeec6c5);OpenchannelQueueEvents[_0xee50('0x4')](_0x13a2c3,_0xeec6c5);_0x4895a(null);};}for(var e in events){if(events[_0xee50('0x5')](e)){var event=events[e];OpenchannelQueue[_0xee50('0x6')](e,emitEvent(event));}}module[_0xee50('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x80e6=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4c4224,_0x356c44){var _0x264cc2=function(_0x129eb5){while(--_0x129eb5){_0x4c4224['push'](_0x4c4224['shift']());}};_0x264cc2(++_0x356c44);}(_0x80e6,0x97));var _0x680e=function(_0x3223f0,_0x8dc2e0){_0x3223f0=_0x3223f0-0x0;var _0x5de37e=_0x80e6[_0x3223f0];return _0x5de37e;};'use strict';var EventEmitter=require(_0x680e('0x0'));var OpenchannelQueue=require(_0x680e('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x680e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x680e('0x3')};function emitEvent(_0x4dfa68){return function(_0x191f5f,_0x5b4daa,_0x1d7703){OpenchannelQueueEvents['emit'](_0x4dfa68+':'+_0x191f5f['id'],_0x191f5f);OpenchannelQueueEvents[_0x680e('0x4')](_0x4dfa68,_0x191f5f);_0x1d7703(null);};}for(var e in events){if(events[_0x680e('0x5')](e)){var event=events[e];OpenchannelQueue[_0x680e('0x6')](e,emitEvent(event));}}module[_0x680e('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 3d50fc6..ce39053 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 _0xe190=['bluebird','request-promise','path','../../config/environment','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x2bbcb4,_0x1f1e5d){var _0x4b4f91=function(_0x509168){while(--_0x509168){_0x2bbcb4['push'](_0x2bbcb4['shift']());}};_0x4b4f91(++_0x1f1e5d);}(_0xe190,0x96));var _0x0e19=function(_0x19e08e,_0x178f46){_0x19e08e=_0x19e08e-0x0;var _0x14c229=_0xe190[_0x19e08e];return _0x14c229;};'use strict';var _=require(_0x0e19('0x0'));var util=require(_0x0e19('0x1'));var logger=require(_0x0e19('0x2'))(_0x0e19('0x3'));var moment=require('moment');var BPromise=require(_0x0e19('0x4'));var rp=require(_0x0e19('0x5'));var fs=require('fs');var path=require(_0x0e19('0x6'));var rimraf=require('rimraf');var config=require(_0x0e19('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x373e47,_0x3ee15f){return _0x373e47[_0x0e19('0x8')](_0x0e19('0x9'),attributes,{'tableName':_0x0e19('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4615=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','request-promise','path'];(function(_0x113826,_0x47558c){var _0x1979ea=function(_0x2a8f96){while(--_0x2a8f96){_0x113826['push'](_0x113826['shift']());}};_0x1979ea(++_0x47558c);}(_0x4615,0x1b4));var _0x5461=function(_0x25d537,_0x5a0025){_0x25d537=_0x25d537-0x0;var _0x33d0af=_0x4615[_0x25d537];return _0x33d0af;};'use strict';var _=require(_0x5461('0x0'));var util=require(_0x5461('0x1'));var logger=require('../../config/logger')(_0x5461('0x2'));var moment=require(_0x5461('0x3'));var BPromise=require('bluebird');var rp=require(_0x5461('0x4'));var fs=require('fs');var path=require(_0x5461('0x5'));var rimraf=require(_0x5461('0x6'));var config=require(_0x5461('0x7'));var attributes=require(_0x5461('0x8'));module[_0x5461('0x9')]=function(_0x45185e,_0x2c7c02){return _0x45185e[_0x5461('0xa')](_0x5461('0xb'),attributes,{'tableName':_0x5461('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 91bbd6c..3b76890 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 _0xdd5c=['lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowOpenchannelQueue','find','stringify'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0xdd5c,0x111));var _0xcdd5=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0xdd5c[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0xcdd5('0x0'));var util=require(_0xcdd5('0x1'));var moment=require('moment');var BPromise=require(_0xcdd5('0x2'));var rs=require(_0xcdd5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcdd5('0x4'))(_0xcdd5('0x5'));var config=require('../../config/environment');var jayson=require(_0xcdd5('0x6'));var client=jayson[_0xcdd5('0x7')][_0xcdd5('0x8')]({'port':0x232a});config[_0xcdd5('0x9')]=_['defaults'](config['redis'],{'host':_0xcdd5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdd5('0x9')]));require(_0xcdd5('0xb'))[_0xcdd5('0xc')](socket);function respondWithRpcPromise(_0x1e4fae,_0x2c6d23,_0x38ddc0){return new BPromise(function(_0x2ba6e7,_0x170ef4){return client[_0xcdd5('0xd')](_0x1e4fae,_0x38ddc0)[_0xcdd5('0xe')](function(_0x380569){logger[_0xcdd5('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x2c6d23,_0xcdd5('0x10'));logger['debug'](_0xcdd5('0x11'),_0x2c6d23,_0xcdd5('0x10'),JSON['stringify'](_0x380569));if(_0x380569[_0xcdd5('0x12')]){if(_0x380569['error'][_0xcdd5('0x13')]===0x1f4){logger[_0xcdd5('0x12')](_0xcdd5('0x14'),_0x2c6d23,_0x380569[_0xcdd5('0x12')]['message']);return _0x170ef4(_0x380569[_0xcdd5('0x12')][_0xcdd5('0x15')]);}logger[_0xcdd5('0x12')](_0xcdd5('0x14'),_0x2c6d23,_0x380569[_0xcdd5('0x12')][_0xcdd5('0x15')]);return _0x2ba6e7(_0x380569[_0xcdd5('0x12')][_0xcdd5('0x15')]);}else{logger['info'](_0xcdd5('0x14'),_0x2c6d23,'request\x20sent');_0x2ba6e7(_0x380569[_0xcdd5('0x16')][_0xcdd5('0x15')]);}})[_0xcdd5('0x17')](function(_0x14d8c6){logger[_0xcdd5('0x12')](_0xcdd5('0x14'),_0x2c6d23,_0x14d8c6);_0x170ef4(_0x14d8c6);});});}exports[_0xcdd5('0x18')]=function(_0x2bb5b0){var _0xe34a44=this;return new Promise(function(_0x10fc9a,_0x50f9c4){return db[_0xcdd5('0x19')][_0xcdd5('0x1a')]({'raw':_0x2bb5b0[_0xcdd5('0x1b')]?_0x2bb5b0['options'][_0xcdd5('0x1c')]===undefined?!![]:![]:!![],'where':_0x2bb5b0[_0xcdd5('0x1b')]?_0x2bb5b0[_0xcdd5('0x1b')][_0xcdd5('0x1d')]||null:null,'attributes':_0x2bb5b0[_0xcdd5('0x1b')]?_0x2bb5b0[_0xcdd5('0x1b')]['attributes']||null:null,'limit':_0x2bb5b0[_0xcdd5('0x1b')]?_0x2bb5b0['options'][_0xcdd5('0x1e')]||null:null,'include':_0x2bb5b0[_0xcdd5('0x1b')]?_0x2bb5b0['options'][_0xcdd5('0x1f')]?_[_0xcdd5('0x20')](_0x2bb5b0['options']['include'],function(_0x5aec2a){return{'model':db[_0x5aec2a[_0xcdd5('0x21')]],'as':_0x5aec2a['as'],'attributes':_0x5aec2a[_0xcdd5('0x22')],'include':_0x5aec2a[_0xcdd5('0x1f')]?_['map'](_0x5aec2a['include'],function(_0x32e55e){return{'model':db[_0x32e55e[_0xcdd5('0x21')]],'as':_0x32e55e['as'],'attributes':_0x32e55e[_0xcdd5('0x22')],'include':_0x32e55e[_0xcdd5('0x1f')]?_[_0xcdd5('0x20')](_0x32e55e[_0xcdd5('0x1f')],function(_0x133d7d){return{'model':db[_0x133d7d[_0xcdd5('0x21')]],'as':_0x133d7d['as'],'attributes':_0x133d7d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e95f7){logger[_0xcdd5('0xf')](_0xcdd5('0x18'),_0x2bb5b0);logger[_0xcdd5('0x23')](_0xcdd5('0x18'),_0x2bb5b0,JSON['stringify'](_0x3e95f7));_0x10fc9a(_0x3e95f7);})['catch'](function(_0xb735f8){logger[_0xcdd5('0x12')](_0xcdd5('0x18'),_0xb735f8[_0xcdd5('0x15')],_0x2bb5b0);_0x50f9c4(_0xe34a44[_0xcdd5('0x12')](0x1f4,_0xb735f8[_0xcdd5('0x15')]));});});};exports[_0xcdd5('0x24')]=function(_0x137fc5){var _0x2ada11=this;return new Promise(function(_0x22c16b,_0x3fda0b){return db['OpenchannelQueue'][_0xcdd5('0x25')]({'raw':_0x137fc5[_0xcdd5('0x1b')]?_0x137fc5[_0xcdd5('0x1b')][_0xcdd5('0x1c')]===undefined?!![]:![]:!![],'where':_0x137fc5[_0xcdd5('0x1b')]?_0x137fc5[_0xcdd5('0x1b')][_0xcdd5('0x1d')]||null:null,'attributes':_0x137fc5[_0xcdd5('0x1b')]?_0x137fc5[_0xcdd5('0x1b')][_0xcdd5('0x22')]||null:null,'include':_0x137fc5[_0xcdd5('0x1b')]?_0x137fc5['options']['include']?_[_0xcdd5('0x20')](_0x137fc5['options']['include'],function(_0x2f2d73){return{'model':db[_0x2f2d73['model']],'as':_0x2f2d73['as'],'attributes':_0x2f2d73[_0xcdd5('0x22')],'include':_0x2f2d73['include']?_[_0xcdd5('0x20')](_0x2f2d73[_0xcdd5('0x1f')],function(_0x33b878){return{'model':db[_0x33b878[_0xcdd5('0x21')]],'as':_0x33b878['as'],'attributes':_0x33b878[_0xcdd5('0x22')],'include':_0x33b878[_0xcdd5('0x1f')]?_['map'](_0x33b878[_0xcdd5('0x1f')],function(_0x7e0f6){return{'model':db[_0x7e0f6[_0xcdd5('0x21')]],'as':_0x7e0f6['as'],'attributes':_0x7e0f6[_0xcdd5('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcdd5('0xe')](function(_0x130140){logger[_0xcdd5('0xf')]('ShowOpenchannelQueue',_0x137fc5);logger[_0xcdd5('0x23')](_0xcdd5('0x24'),_0x137fc5,JSON[_0xcdd5('0x26')](_0x130140));_0x22c16b(_0x130140);})[_0xcdd5('0x17')](function(_0x34e273){logger[_0xcdd5('0x12')](_0xcdd5('0x24'),_0x34e273[_0xcdd5('0x15')],_0x137fc5);_0x3fda0b(_0x2ada11['error'](0x1f4,_0x34e273[_0xcdd5('0x15')]));});});}; \ No newline at end of file +var _0x219d=['OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','debug','stringify','find','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetOpenchannelQueue'];(function(_0x4e280c,_0x2503c0){var _0x40ed1c=function(_0x37d295){while(--_0x37d295){_0x4e280c['push'](_0x4e280c['shift']());}};_0x40ed1c(++_0x2503c0);}(_0x219d,0x10f));var _0xd219=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x219d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xd219('0x0'));var moment=require(_0xd219('0x1'));var BPromise=require(_0xd219('0x2'));var rs=require(_0xd219('0x3'));var fs=require('fs');var Redis=require(_0xd219('0x4'));var db=require(_0xd219('0x5'))['db'];var utils=require(_0xd219('0x6'));var logger=require(_0xd219('0x7'))(_0xd219('0x8'));var config=require(_0xd219('0x9'));var jayson=require(_0xd219('0xa'));var client=jayson[_0xd219('0xb')][_0xd219('0xc')]({'port':0x232a});config[_0xd219('0xd')]=_[_0xd219('0xe')](config[_0xd219('0xd')],{'host':_0xd219('0xf'),'port':0x18eb});var socket=require(_0xd219('0x10'))(new Redis(config[_0xd219('0xd')]));require(_0xd219('0x11'))[_0xd219('0x12')](socket);function respondWithRpcPromise(_0x2afea2,_0x206762,_0x41014f){return new BPromise(function(_0x58fd87,_0x2348a1){return client['request'](_0x2afea2,_0x41014f)[_0xd219('0x13')](function(_0x115c76){logger[_0xd219('0x14')](_0xd219('0x15'),_0x206762,'request\x20sent');logger['debug'](_0xd219('0x16'),_0x206762,_0xd219('0x17'),JSON['stringify'](_0x115c76));if(_0x115c76[_0xd219('0x18')]){if(_0x115c76[_0xd219('0x18')][_0xd219('0x19')]===0x1f4){logger['error'](_0xd219('0x15'),_0x206762,_0x115c76[_0xd219('0x18')][_0xd219('0x1a')]);return _0x2348a1(_0x115c76['error']['message']);}logger[_0xd219('0x18')](_0xd219('0x15'),_0x206762,_0x115c76[_0xd219('0x18')][_0xd219('0x1a')]);return _0x58fd87(_0x115c76[_0xd219('0x18')][_0xd219('0x1a')]);}else{logger[_0xd219('0x14')](_0xd219('0x15'),_0x206762,_0xd219('0x17'));_0x58fd87(_0x115c76[_0xd219('0x1b')]['message']);}})[_0xd219('0x1c')](function(_0x33d7b9){logger[_0xd219('0x18')](_0xd219('0x15'),_0x206762,_0x33d7b9);_0x2348a1(_0x33d7b9);});});}exports[_0xd219('0x1d')]=function(_0x6b74cd){var _0x2f71a7=this;return new Promise(function(_0x5af8f0,_0x274d4d){return db[_0xd219('0x1e')][_0xd219('0x1f')]({'raw':_0x6b74cd[_0xd219('0x20')]?_0x6b74cd[_0xd219('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x6b74cd[_0xd219('0x20')]?_0x6b74cd[_0xd219('0x20')][_0xd219('0x21')]||null:null,'attributes':_0x6b74cd[_0xd219('0x20')]?_0x6b74cd[_0xd219('0x20')][_0xd219('0x22')]||null:null,'limit':_0x6b74cd[_0xd219('0x20')]?_0x6b74cd['options'][_0xd219('0x23')]||null:null,'include':_0x6b74cd[_0xd219('0x20')]?_0x6b74cd['options'][_0xd219('0x24')]?_[_0xd219('0x25')](_0x6b74cd[_0xd219('0x20')][_0xd219('0x24')],function(_0x13a4ba){return{'model':db[_0x13a4ba['model']],'as':_0x13a4ba['as'],'attributes':_0x13a4ba[_0xd219('0x22')],'include':_0x13a4ba['include']?_[_0xd219('0x25')](_0x13a4ba[_0xd219('0x24')],function(_0x253ff4){return{'model':db[_0x253ff4['model']],'as':_0x253ff4['as'],'attributes':_0x253ff4[_0xd219('0x22')],'include':_0x253ff4['include']?_[_0xd219('0x25')](_0x253ff4[_0xd219('0x24')],function(_0x12ff0a){return{'model':db[_0x12ff0a[_0xd219('0x26')]],'as':_0x12ff0a['as'],'attributes':_0x12ff0a[_0xd219('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd219('0x13')](function(_0x19843e){logger[_0xd219('0x14')](_0xd219('0x1d'),_0x6b74cd);logger[_0xd219('0x27')](_0xd219('0x1d'),_0x6b74cd,JSON[_0xd219('0x28')](_0x19843e));_0x5af8f0(_0x19843e);})[_0xd219('0x1c')](function(_0x281df3){logger[_0xd219('0x18')](_0xd219('0x1d'),_0x281df3[_0xd219('0x1a')],_0x6b74cd);_0x274d4d(_0x2f71a7[_0xd219('0x18')](0x1f4,_0x281df3[_0xd219('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x1942e0){var _0x3c1979=this;return new Promise(function(_0x23d361,_0x3e7de8){return db[_0xd219('0x1e')][_0xd219('0x29')]({'raw':_0x1942e0['options']?_0x1942e0[_0xd219('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x1942e0[_0xd219('0x20')]?_0x1942e0[_0xd219('0x20')][_0xd219('0x21')]||null:null,'attributes':_0x1942e0[_0xd219('0x20')]?_0x1942e0[_0xd219('0x20')]['attributes']||null:null,'include':_0x1942e0[_0xd219('0x20')]?_0x1942e0[_0xd219('0x20')][_0xd219('0x24')]?_[_0xd219('0x25')](_0x1942e0['options'][_0xd219('0x24')],function(_0x503a23){return{'model':db[_0x503a23['model']],'as':_0x503a23['as'],'attributes':_0x503a23[_0xd219('0x22')],'include':_0x503a23[_0xd219('0x24')]?_[_0xd219('0x25')](_0x503a23[_0xd219('0x24')],function(_0x46636d){return{'model':db[_0x46636d[_0xd219('0x26')]],'as':_0x46636d['as'],'attributes':_0x46636d['attributes'],'include':_0x46636d[_0xd219('0x24')]?_[_0xd219('0x25')](_0x46636d[_0xd219('0x24')],function(_0x1c67df){return{'model':db[_0x1c67df[_0xd219('0x26')]],'as':_0x1c67df['as'],'attributes':_0x1c67df['attributes']};}):[]};}):[]};}):[]:[]})[_0xd219('0x13')](function(_0x19146a){logger[_0xd219('0x14')](_0xd219('0x2a'),_0x1942e0);logger[_0xd219('0x27')](_0xd219('0x2a'),_0x1942e0,JSON['stringify'](_0x19146a));_0x23d361(_0x19146a);})['catch'](function(_0x594499){logger[_0xd219('0x18')](_0xd219('0x2a'),_0x594499[_0xd219('0x1a')],_0x1942e0);_0x3e7de8(_0x3c1979['error'](0x1f4,_0x594499[_0xd219('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index ff5b27a..fb46f55 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 _0x953a=['./openchannelQueue.events','save','remove','update','emit','length'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x953a,0x72));var _0xa953=function(_0x1c65af,_0x35c63e){_0x1c65af=_0x1c65af-0x0;var _0x528957=_0x953a[_0x1c65af];return _0x528957;};'use strict';var OpenchannelQueueEvents=require(_0xa953('0x0'));var events=[_0xa953('0x1'),_0xa953('0x2'),_0xa953('0x3')];function createListener(_0x2bad36,_0x1d9073){return function(_0x185dbe){_0x1d9073[_0xa953('0x4')](_0x2bad36,_0x185dbe);};}function removeListener(_0x1aa24b,_0x131e46){return function(){OpenchannelQueueEvents['removeListener'](_0x1aa24b,_0x131e46);};}exports['register']=function(_0x510ebb){for(var _0xd40742=0x0,_0x11609e=events[_0xa953('0x5')];_0xd40742<_0x11609e;_0xd40742++){var _0x268b89=events[_0xd40742];var _0x240ec6=createListener('openchannelQueue:'+_0x268b89,_0x510ebb);OpenchannelQueueEvents['on'](_0x268b89,_0x240ec6);}}; \ No newline at end of file +var _0x262e=['removeListener','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x262e,0x192));var _0xe262=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x262e[_0x36eaaa];return _0x461349;};'use strict';var OpenchannelQueueEvents=require(_0xe262('0x0'));var events=[_0xe262('0x1'),'remove','update'];function createListener(_0x3dae4d,_0x7edf51){return function(_0x44c62b){_0x7edf51['emit'](_0x3dae4d,_0x44c62b);};}function removeListener(_0x3047ff,_0x5c60c4){return function(){OpenchannelQueueEvents[_0xe262('0x2')](_0x3047ff,_0x5c60c4);};}exports['register']=function(_0xecc2f5){for(var _0x16d88e=0x0,_0x52658f=events['length'];_0x16d88e<_0x52658f;_0x16d88e++){var _0x245314=events[_0x16d88e];var _0x1ff446=createListener(_0xe262('0x3')+_0x245314,_0xecc2f5);OpenchannelQueueEvents['on'](_0x245314,_0x1ff446);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 93c0e41..18606fc 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 _0xf783=['/describe','/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0x31b9ba,_0x5cd053){var _0x340fde=function(_0x3cb193){while(--_0x3cb193){_0x31b9ba['push'](_0x31b9ba['shift']());}};_0x340fde(++_0x5cd053);}(_0xf783,0x196));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f78('0x0'));var util=require(_0x3f78('0x1'));var path=require(_0x3f78('0x2'));var timeout=require(_0x3f78('0x3'));var express=require(_0x3f78('0x4'));var router=express['Router']();var fs_extra=require(_0x3f78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f78('0x6'));var config=require(_0x3f78('0x7'));var controller=require(_0x3f78('0x8'));router[_0x3f78('0x9')]('/',auth[_0x3f78('0xa')](),controller[_0x3f78('0xb')]);router[_0x3f78('0x9')](_0x3f78('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3f78('0x9')](_0x3f78('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3f78('0xe')]('/',auth['isAuthenticated'](),controller[_0x3f78('0xf')]);router[_0x3f78('0x10')](_0x3f78('0xd'),auth[_0x3f78('0xa')](),controller[_0x3f78('0x11')]);router[_0x3f78('0x12')](_0x3f78('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xab48=['destroy','multer','util','path','express','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','update'];(function(_0x2db98d,_0x364e98){var _0x3c0ffe=function(_0x1c8bbe){while(--_0x1c8bbe){_0x2db98d['push'](_0x2db98d['shift']());}};_0x3c0ffe(++_0x364e98);}(_0xab48,0x7f));var _0x8ab4=function(_0x44671c,_0x571fad){_0x44671c=_0x44671c-0x0;var _0x17b588=_0xab48[_0x44671c];return _0x17b588;};'use strict';var multer=require(_0x8ab4('0x0'));var util=require(_0x8ab4('0x1'));var path=require(_0x8ab4('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ab4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8ab4('0x4'));var config=require('../../config/environment');var controller=require(_0x8ab4('0x5'));router[_0x8ab4('0x6')]('/',auth[_0x8ab4('0x7')](),controller['index']);router[_0x8ab4('0x6')](_0x8ab4('0x8'),auth[_0x8ab4('0x7')](),controller[_0x8ab4('0x9')]);router[_0x8ab4('0x6')](_0x8ab4('0xa'),auth[_0x8ab4('0x7')](),controller[_0x8ab4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8ab4('0xa'),auth[_0x8ab4('0x7')](),controller[_0x8ab4('0xc')]);router['delete'](_0x8ab4('0xa'),auth[_0x8ab4('0x7')](),controller[_0x8ab4('0xd')]);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 70274c0..9ec3896 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 _0x1a39=['exports','STRING','DATE','moment','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1a39,0xd0));var _0x91a3=function(_0x127869,_0x36fcc9){_0x127869=_0x127869-0x0;var _0x67b9f5=_0x1a39[_0x127869];return _0x67b9f5;};'use strict';var moment=require(_0x91a3('0x0'));var Sequelize=require(_0x91a3('0x1'));module[_0x91a3('0x2')]={'uniqueid':{'type':Sequelize[_0x91a3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x91a3('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x91a3('0x4')]},'exitAt':{'type':Sequelize[_0x91a3('0x4')]},'reason':{'type':Sequelize[_0x91a3('0x3')]}}; \ No newline at end of file +var _0x6a15=['moment','sequelize','exports','STRING','DATE'];(function(_0x5096db,_0x777867){var _0x45bb2e=function(_0x457fdc){while(--_0x457fdc){_0x5096db['push'](_0x5096db['shift']());}};_0x45bb2e(++_0x777867);}(_0x6a15,0x159));var _0x56a1=function(_0x10333b,_0x43dfb5){_0x10333b=_0x10333b-0x0;var _0x2e5209=_0x6a15[_0x10333b];return _0x2e5209;};'use strict';var moment=require(_0x56a1('0x0'));var Sequelize=require(_0x56a1('0x1'));module[_0x56a1('0x2')]={'uniqueid':{'type':Sequelize[_0x56a1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x56a1('0x3')]},'joinAt':{'type':Sequelize[_0x56a1('0x4')]},'leaveAt':{'type':Sequelize[_0x56a1('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b564f0b..f3c0e0d 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 _0x96cd=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','OpenchannelQueueReport','findAll','rows','show','params','keys','includeAll','include','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','type'];(function(_0x384900,_0xb6537e){var _0x30c2a2=function(_0x116c48){while(--_0x116c48){_0x384900['push'](_0x384900['shift']());}};_0x30c2a2(++_0xb6537e);}(_0x96cd,0x19a));var _0xd96c=function(_0x15c1e9,_0x4106ec){_0x15c1e9=_0x15c1e9-0x0;var _0x214e8a=_0x96cd[_0x15c1e9];return _0x214e8a;};'use strict';var emlformat=require(_0xd96c('0x0'));var rimraf=require(_0xd96c('0x1'));var zipdir=require(_0xd96c('0x2'));var jsonpatch=require(_0xd96c('0x3'));var rp=require(_0xd96c('0x4'));var moment=require(_0xd96c('0x5'));var BPromise=require(_0xd96c('0x6'));var Mustache=require('mustache');var util=require(_0xd96c('0x7'));var path=require(_0xd96c('0x8'));var sox=require(_0xd96c('0x9'));var csv=require(_0xd96c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd96c('0xb'));var _=require('lodash');var squel=require(_0xd96c('0xc'));var crypto=require(_0xd96c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd96c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd96c('0xf'));var Papa=require(_0xd96c('0x10'));var Redis=require(_0xd96c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd96c('0x12'));var as=require(_0xd96c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd96c('0x14'));var utils=require(_0xd96c('0x15'));var config=require(_0xd96c('0x16'));var licenseUtil=require(_0xd96c('0x17'));var db=require(_0xd96c('0x18'))['db'];function respondWithStatusCode(_0x511033,_0x3e6cfd){_0x3e6cfd=_0x3e6cfd||0xcc;return function(_0x11c1ac){if(_0x11c1ac){return _0x511033['sendStatus'](_0x3e6cfd);}return _0x511033[_0xd96c('0x19')](_0x3e6cfd)[_0xd96c('0x1a')]();};}function respondWithResult(_0x2bd09d,_0x577045){_0x577045=_0x577045||0xc8;return function(_0x2fd8ab){if(_0x2fd8ab){return _0x2bd09d[_0xd96c('0x19')](_0x577045)[_0xd96c('0x1b')](_0x2fd8ab);}};}function respondWithFilteredResult(_0x41c7ee,_0xd49099){return function(_0x1cc798){if(_0x1cc798){var _0x4085bb=typeof _0xd49099[_0xd96c('0x1c')]===_0xd96c('0x1d')&&typeof _0xd49099[_0xd96c('0x1e')]==='undefined';var _0x2091de=_0x1cc798[_0xd96c('0x1f')];var _0x48d47e=_0x4085bb?0x0:_0xd49099[_0xd96c('0x1c')];var _0x4590c1=_0x4085bb?_0x1cc798['count']:_0xd49099[_0xd96c('0x1c')]+_0xd49099[_0xd96c('0x1e')];var _0x10a143;if(_0x4590c1>=_0x2091de){_0x4590c1=_0x2091de;_0x10a143=0xc8;}else{_0x10a143=0xce;}_0x41c7ee[_0xd96c('0x19')](_0x10a143);return _0x41c7ee[_0xd96c('0x20')](_0xd96c('0x21'),_0x48d47e+'-'+_0x4590c1+'/'+_0x2091de)[_0xd96c('0x1b')](_0x1cc798);}return null;};}function patchUpdates(_0x333b3a){return function(_0x574f59){try{jsonpatch['apply'](_0x574f59,_0x333b3a,!![]);}catch(_0x5200d4){return BPromise[_0xd96c('0x22')](_0x5200d4);}return _0x574f59[_0xd96c('0x23')]();};}function saveUpdates(_0x5e5cf2,_0x400a77){return function(_0x4db08b){if(_0x4db08b){return _0x4db08b['update'](_0x5e5cf2)['then'](function(_0x20d0cb){return _0x20d0cb;});}return null;};}function removeEntity(_0x137598,_0x79d33c){return function(_0x211ff8){if(_0x211ff8){return _0x211ff8[_0xd96c('0x24')]()[_0xd96c('0x25')](function(){_0x137598[_0xd96c('0x19')](0xcc)[_0xd96c('0x1a')]();});}};}function handleEntityNotFound(_0x3a211e,_0x5c016d){return function(_0x4ab0eb){if(!_0x4ab0eb){_0x3a211e[_0xd96c('0x26')](0x194);}return _0x4ab0eb;};}function handleError(_0x27dcd5,_0x20fb7d){_0x20fb7d=_0x20fb7d||0x1f4;return function(_0x40bb30){logger[_0xd96c('0x27')](_0x40bb30['stack']);if(_0x40bb30['name']){delete _0x40bb30[_0xd96c('0x28')];}_0x27dcd5[_0xd96c('0x19')](_0x20fb7d)[_0xd96c('0x29')](_0x40bb30);};}exports[_0xd96c('0x2a')]=function(_0x498a3e,_0x25ebf6){var _0x24a489={},_0x295ff0={},_0x112481={'count':0x0,'rows':[]};var _0x9903d9=_[_0xd96c('0x2b')](db['OpenchannelQueueReport'][_0xd96c('0x2c')],function(_0x37f2cf){return{'name':_0x37f2cf['fieldName'],'type':_0x37f2cf[_0xd96c('0x2d')]['key']};});_0x295ff0[_0xd96c('0x2e')]=_['map'](_0x9903d9,_0xd96c('0x28'));_0x295ff0['query']=_['keys'](_0x498a3e[_0xd96c('0x2f')]);_0x295ff0['filters']=_[_0xd96c('0x30')](_0x295ff0[_0xd96c('0x2e')],_0x295ff0[_0xd96c('0x2f')]);_0x24a489[_0xd96c('0x31')]=_['intersection'](_0x295ff0[_0xd96c('0x2e')],qs[_0xd96c('0x32')](_0x498a3e[_0xd96c('0x2f')][_0xd96c('0x32')]));_0x24a489[_0xd96c('0x31')]=_0x24a489[_0xd96c('0x31')][_0xd96c('0x33')]?_0x24a489[_0xd96c('0x31')]:_0x295ff0['model'];if(!_0x498a3e['query'][_0xd96c('0x34')](_0xd96c('0x35'))){_0x24a489[_0xd96c('0x1e')]=qs['limit'](_0x498a3e[_0xd96c('0x2f')][_0xd96c('0x1e')]);_0x24a489[_0xd96c('0x1c')]=qs[_0xd96c('0x1c')](_0x498a3e[_0xd96c('0x2f')][_0xd96c('0x1c')]);}_0x24a489[_0xd96c('0x36')]=qs['sort'](_0x498a3e[_0xd96c('0x2f')][_0xd96c('0x37')]);_0x24a489[_0xd96c('0x38')]=qs[_0xd96c('0x39')](_[_0xd96c('0x3a')](_0x498a3e[_0xd96c('0x2f')],_0x295ff0['filters']),_0x9903d9);if(_0x498a3e[_0xd96c('0x2f')][_0xd96c('0x3b')]){_0x24a489[_0xd96c('0x38')]=_[_0xd96c('0x3c')](_0x24a489[_0xd96c('0x38')],{'$or':_['map'](_0x9903d9,function(_0x2e8718){if(_0x2e8718[_0xd96c('0x2d')]!=='VIRTUAL'){var _0x4182f1={};_0x4182f1[_0x2e8718[_0xd96c('0x28')]]={'$like':'%'+_0x498a3e['query'][_0xd96c('0x3b')]+'%'};return _0x4182f1;}})});}_0x24a489=_['merge']({},_0x24a489,_0x498a3e[_0xd96c('0x3d')]);var _0x2301e4={'where':_0x24a489['where']};return db[_0xd96c('0x3e')]['count'](_0x2301e4)[_0xd96c('0x25')](function(_0x3a5c1f){_0x112481['count']=_0x3a5c1f;if(_0x498a3e[_0xd96c('0x2f')]['includeAll']){_0x24a489['include']=[{'all':!![]}];}return db[_0xd96c('0x3e')][_0xd96c('0x3f')](_0x24a489);})[_0xd96c('0x25')](function(_0x2fd6d0){_0x112481[_0xd96c('0x40')]=_0x2fd6d0;return _0x112481;})['then'](respondWithFilteredResult(_0x25ebf6,_0x24a489))['catch'](handleError(_0x25ebf6,null));};exports[_0xd96c('0x41')]=function(_0x332535,_0x46ff2b){var _0x2e2b0a={'raw':!![],'where':{'id':_0x332535[_0xd96c('0x42')]['id']}},_0xc0f785={};_0xc0f785['model']=_[_0xd96c('0x43')](db['OpenchannelQueueReport'][_0xd96c('0x2c')]);_0xc0f785['query']=_[_0xd96c('0x43')](_0x332535[_0xd96c('0x2f')]);_0xc0f785['filters']=_['intersection'](_0xc0f785[_0xd96c('0x2e')],_0xc0f785[_0xd96c('0x2f')]);_0x2e2b0a[_0xd96c('0x31')]=_[_0xd96c('0x30')](_0xc0f785['model'],qs[_0xd96c('0x32')](_0x332535['query'][_0xd96c('0x32')]));_0x2e2b0a[_0xd96c('0x31')]=_0x2e2b0a['attributes']['length']?_0x2e2b0a['attributes']:_0xc0f785[_0xd96c('0x2e')];if(_0x332535[_0xd96c('0x2f')][_0xd96c('0x44')]){_0x2e2b0a[_0xd96c('0x45')]=[{'all':!![]}];}_0x2e2b0a=_['merge']({},_0x2e2b0a,_0x332535[_0xd96c('0x3d')]);return db['OpenchannelQueueReport']['find'](_0x2e2b0a)[_0xd96c('0x25')](handleEntityNotFound(_0x46ff2b,null))[_0xd96c('0x25')](respondWithResult(_0x46ff2b,null))[_0xd96c('0x46')](handleError(_0x46ff2b,null));};exports[_0xd96c('0x47')]=function(_0xbeb615,_0x268413){return db[_0xd96c('0x3e')][_0xd96c('0x47')](_0xbeb615[_0xd96c('0x48')],{})['then'](respondWithResult(_0x268413,0xc9))['catch'](handleError(_0x268413,null));};exports[_0xd96c('0x49')]=function(_0x3e8fe6,_0x36de4e){if(_0x3e8fe6['body']['id']){delete _0x3e8fe6[_0xd96c('0x48')]['id'];}return db[_0xd96c('0x3e')]['find']({'where':{'id':_0x3e8fe6['params']['id']}})[_0xd96c('0x25')](handleEntityNotFound(_0x36de4e,null))['then'](saveUpdates(_0x3e8fe6[_0xd96c('0x48')],null))['then'](respondWithResult(_0x36de4e,null))[_0xd96c('0x46')](handleError(_0x36de4e,null));};exports[_0xd96c('0x24')]=function(_0x1ae80e,_0x41a893){return db['OpenchannelQueueReport'][_0xd96c('0x4a')]({'where':{'id':_0x1ae80e[_0xd96c('0x42')]['id']}})[_0xd96c('0x25')](handleEntityNotFound(_0x41a893,null))[_0xd96c('0x25')](removeEntity(_0x41a893,null))[_0xd96c('0x46')](handleError(_0x41a893,null));};exports[_0xd96c('0x4b')]=function(_0x30aa96,_0x55ae56){return db[_0xd96c('0x3e')][_0xd96c('0x4b')]()[_0xd96c('0x25')](respondWithResult(_0x55ae56,null))['catch'](handleError(_0x55ae56,null));}; \ No newline at end of file +var _0x23ec=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','show','params','includeAll','find','catch','create','body','destroy','describe','eml-format'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x23ec,0x158));var _0xc23e=function(_0x1f3d9d,_0xa564c1){_0x1f3d9d=_0x1f3d9d-0x0;var _0x4fec71=_0x23ec[_0x1f3d9d];return _0x4fec71;};'use strict';var emlformat=require(_0xc23e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc23e('0x1'));var jsonpatch=require(_0xc23e('0x2'));var rp=require(_0xc23e('0x3'));var moment=require('moment');var BPromise=require(_0xc23e('0x4'));var Mustache=require(_0xc23e('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc23e('0x6'));var csv=require(_0xc23e('0x7'));var ejs=require(_0xc23e('0x8'));var fs=require('fs');var fs_extra=require(_0xc23e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc23e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc23e('0xb'));var toCsv=require(_0xc23e('0x7'));var querystring=require(_0xc23e('0xc'));var Papa=require(_0xc23e('0xd'));var Redis=require('ioredis');var authService=require(_0xc23e('0xe'));var qs=require(_0xc23e('0xf'));var as=require(_0xc23e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc23e('0x11'))(_0xc23e('0x12'));var utils=require(_0xc23e('0x13'));var config=require(_0xc23e('0x14'));var licenseUtil=require(_0xc23e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e2d8f,_0x1c5cc3){_0x1c5cc3=_0x1c5cc3||0xcc;return function(_0x5781d7){if(_0x5781d7){return _0x1e2d8f[_0xc23e('0x16')](_0x1c5cc3);}return _0x1e2d8f[_0xc23e('0x17')](_0x1c5cc3)[_0xc23e('0x18')]();};}function respondWithResult(_0x22cf35,_0x3bde26){_0x3bde26=_0x3bde26||0xc8;return function(_0x35aede){if(_0x35aede){return _0x22cf35[_0xc23e('0x17')](_0x3bde26)[_0xc23e('0x19')](_0x35aede);}};}function respondWithFilteredResult(_0x23226a,_0x345d6c){return function(_0x49157e){if(_0x49157e){var _0x165585=typeof _0x345d6c[_0xc23e('0x1a')]===_0xc23e('0x1b')&&typeof _0x345d6c[_0xc23e('0x1c')]==='undefined';var _0x2e0824=_0x49157e[_0xc23e('0x1d')];var _0x272ff4=_0x165585?0x0:_0x345d6c[_0xc23e('0x1a')];var _0x3822fc=_0x165585?_0x49157e[_0xc23e('0x1d')]:_0x345d6c[_0xc23e('0x1a')]+_0x345d6c[_0xc23e('0x1c')];var _0x4c0f28;if(_0x3822fc>=_0x2e0824){_0x3822fc=_0x2e0824;_0x4c0f28=0xc8;}else{_0x4c0f28=0xce;}_0x23226a[_0xc23e('0x17')](_0x4c0f28);return _0x23226a[_0xc23e('0x1e')]('Content-Range',_0x272ff4+'-'+_0x3822fc+'/'+_0x2e0824)[_0xc23e('0x19')](_0x49157e);}return null;};}function patchUpdates(_0x424a71){return function(_0x19aa27){try{jsonpatch[_0xc23e('0x1f')](_0x19aa27,_0x424a71,!![]);}catch(_0x30e4a3){return BPromise['reject'](_0x30e4a3);}return _0x19aa27['save']();};}function saveUpdates(_0x5dc722,_0x4c3d44){return function(_0x3a7ddb){if(_0x3a7ddb){return _0x3a7ddb[_0xc23e('0x20')](_0x5dc722)[_0xc23e('0x21')](function(_0x774d9a){return _0x774d9a;});}return null;};}function removeEntity(_0x1bd23c,_0x30feda){return function(_0x37fac6){if(_0x37fac6){return _0x37fac6['destroy']()[_0xc23e('0x21')](function(){_0x1bd23c[_0xc23e('0x17')](0xcc)[_0xc23e('0x18')]();});}};}function handleEntityNotFound(_0x308526,_0x42a9d8){return function(_0x59d9e5){if(!_0x59d9e5){_0x308526['sendStatus'](0x194);}return _0x59d9e5;};}function handleError(_0x4d317c,_0x37399f){_0x37399f=_0x37399f||0x1f4;return function(_0x138e15){logger[_0xc23e('0x22')](_0x138e15['stack']);if(_0x138e15[_0xc23e('0x23')]){delete _0x138e15[_0xc23e('0x23')];}_0x4d317c[_0xc23e('0x17')](_0x37399f)[_0xc23e('0x24')](_0x138e15);};}exports[_0xc23e('0x25')]=function(_0x535d1b,_0x37e4cf){var _0x3a53e5={},_0x55f899={},_0x277841={'count':0x0,'rows':[]};var _0x28465c=_[_0xc23e('0x26')](db[_0xc23e('0x27')]['rawAttributes'],function(_0x969724){return{'name':_0x969724[_0xc23e('0x28')],'type':_0x969724[_0xc23e('0x29')][_0xc23e('0x2a')]};});_0x55f899[_0xc23e('0x2b')]=_[_0xc23e('0x26')](_0x28465c,_0xc23e('0x23'));_0x55f899['query']=_[_0xc23e('0x2c')](_0x535d1b[_0xc23e('0x2d')]);_0x55f899['filters']=_[_0xc23e('0x2e')](_0x55f899[_0xc23e('0x2b')],_0x55f899[_0xc23e('0x2d')]);_0x3a53e5[_0xc23e('0x2f')]=_[_0xc23e('0x2e')](_0x55f899[_0xc23e('0x2b')],qs[_0xc23e('0x30')](_0x535d1b['query'][_0xc23e('0x30')]));_0x3a53e5[_0xc23e('0x2f')]=_0x3a53e5[_0xc23e('0x2f')][_0xc23e('0x31')]?_0x3a53e5[_0xc23e('0x2f')]:_0x55f899[_0xc23e('0x2b')];if(!_0x535d1b[_0xc23e('0x2d')]['hasOwnProperty'](_0xc23e('0x32'))){_0x3a53e5[_0xc23e('0x1c')]=qs[_0xc23e('0x1c')](_0x535d1b['query'][_0xc23e('0x1c')]);_0x3a53e5[_0xc23e('0x1a')]=qs['offset'](_0x535d1b[_0xc23e('0x2d')][_0xc23e('0x1a')]);}_0x3a53e5[_0xc23e('0x33')]=qs[_0xc23e('0x34')](_0x535d1b[_0xc23e('0x2d')][_0xc23e('0x34')]);_0x3a53e5[_0xc23e('0x35')]=qs[_0xc23e('0x36')](_[_0xc23e('0x37')](_0x535d1b[_0xc23e('0x2d')],_0x55f899[_0xc23e('0x36')]),_0x28465c);if(_0x535d1b['query'][_0xc23e('0x38')]){_0x3a53e5[_0xc23e('0x35')]=_['merge'](_0x3a53e5[_0xc23e('0x35')],{'$or':_['map'](_0x28465c,function(_0x12aec6){if(_0x12aec6[_0xc23e('0x29')]!==_0xc23e('0x39')){var _0x576dbe={};_0x576dbe[_0x12aec6['name']]={'$like':'%'+_0x535d1b[_0xc23e('0x2d')][_0xc23e('0x38')]+'%'};return _0x576dbe;}})});}_0x3a53e5=_['merge']({},_0x3a53e5,_0x535d1b[_0xc23e('0x3a')]);var _0x1bb685={'where':_0x3a53e5['where']};return db['OpenchannelQueueReport'][_0xc23e('0x1d')](_0x1bb685)[_0xc23e('0x21')](function(_0x489eaf){_0x277841[_0xc23e('0x1d')]=_0x489eaf;if(_0x535d1b[_0xc23e('0x2d')]['includeAll']){_0x3a53e5[_0xc23e('0x3b')]=[{'all':!![]}];}return db[_0xc23e('0x27')]['findAll'](_0x3a53e5);})[_0xc23e('0x21')](function(_0x420987){_0x277841['rows']=_0x420987;return _0x277841;})[_0xc23e('0x21')](respondWithFilteredResult(_0x37e4cf,_0x3a53e5))['catch'](handleError(_0x37e4cf,null));};exports[_0xc23e('0x3c')]=function(_0x564e05,_0x2669c6){var _0x2a31de={'raw':!![],'where':{'id':_0x564e05[_0xc23e('0x3d')]['id']}},_0xf08d9e={};_0xf08d9e['model']=_[_0xc23e('0x2c')](db[_0xc23e('0x27')]['rawAttributes']);_0xf08d9e[_0xc23e('0x2d')]=_[_0xc23e('0x2c')](_0x564e05[_0xc23e('0x2d')]);_0xf08d9e['filters']=_[_0xc23e('0x2e')](_0xf08d9e[_0xc23e('0x2b')],_0xf08d9e[_0xc23e('0x2d')]);_0x2a31de[_0xc23e('0x2f')]=_[_0xc23e('0x2e')](_0xf08d9e['model'],qs[_0xc23e('0x30')](_0x564e05[_0xc23e('0x2d')][_0xc23e('0x30')]));_0x2a31de[_0xc23e('0x2f')]=_0x2a31de['attributes'][_0xc23e('0x31')]?_0x2a31de[_0xc23e('0x2f')]:_0xf08d9e[_0xc23e('0x2b')];if(_0x564e05[_0xc23e('0x2d')][_0xc23e('0x3e')]){_0x2a31de[_0xc23e('0x3b')]=[{'all':!![]}];}_0x2a31de=_['merge']({},_0x2a31de,_0x564e05[_0xc23e('0x3a')]);return db[_0xc23e('0x27')][_0xc23e('0x3f')](_0x2a31de)['then'](handleEntityNotFound(_0x2669c6,null))['then'](respondWithResult(_0x2669c6,null))[_0xc23e('0x40')](handleError(_0x2669c6,null));};exports[_0xc23e('0x41')]=function(_0x3bcdfb,_0x138031){return db['OpenchannelQueueReport'][_0xc23e('0x41')](_0x3bcdfb[_0xc23e('0x42')],{})[_0xc23e('0x21')](respondWithResult(_0x138031,0xc9))[_0xc23e('0x40')](handleError(_0x138031,null));};exports[_0xc23e('0x20')]=function(_0xc6ee73,_0x1f5ce5){if(_0xc6ee73[_0xc23e('0x42')]['id']){delete _0xc6ee73[_0xc23e('0x42')]['id'];}return db[_0xc23e('0x27')][_0xc23e('0x3f')]({'where':{'id':_0xc6ee73[_0xc23e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1f5ce5,null))[_0xc23e('0x21')](saveUpdates(_0xc6ee73[_0xc23e('0x42')],null))[_0xc23e('0x21')](respondWithResult(_0x1f5ce5,null))['catch'](handleError(_0x1f5ce5,null));};exports[_0xc23e('0x43')]=function(_0x1c310b,_0x28580a){return db[_0xc23e('0x27')]['find']({'where':{'id':_0x1c310b[_0xc23e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x28580a,null))['then'](removeEntity(_0x28580a,null))[_0xc23e('0x40')](handleError(_0x28580a,null));};exports[_0xc23e('0x44')]=function(_0xfbf3e1,_0x2e3f4b){return db[_0xc23e('0x27')]['describe']()[_0xc23e('0x21')](respondWithResult(_0x2e3f4b,null))[_0xc23e('0x40')](handleError(_0x2e3f4b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index af80ab3..82800bc 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x66bfe,_0x5dcc5c){var _0x52bddc=function(_0x387698){while(--_0x387698){_0x66bfe['push'](_0x66bfe['shift']());}};_0x52bddc(++_0x5dcc5c);}(_0x7a54,0x106));var _0x47a5=function(_0x5505ca,_0x1e80a6){_0x5505ca=_0x5505ca-0x0;var _0x1b223b=_0x7a54[_0x5505ca];return _0x1b223b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2ed0f3,_0x57ab9a){var _0x5db3ad=function(_0x145cac){while(--_0x145cac){_0x2ed0f3['push'](_0x2ed0f3['shift']());}};_0x5db3ad(++_0x57ab9a);}(_0x7a54,0x106));var _0x47a5=function(_0x5b27c7,_0x280bdf){_0x5b27c7=_0x5b27c7-0x0;var _0x3c0095=_0x7a54[_0x5b27c7];return _0x3c0095;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 297b725..fc10b64 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 _0xccde=['limit','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','create','body','options','raw','debug','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes'];(function(_0xd22a26,_0x453354){var _0x15d547=function(_0x4e5ae9){while(--_0x4e5ae9){_0xd22a26['push'](_0xd22a26['shift']());}};_0x15d547(++_0x453354);}(_0xccde,0x1e1));var _0xeccd=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0xccde[_0x1bd3ab];return _0x37e394;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var moment=require(_0xeccd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeccd('0x4'))(_0xeccd('0x5'));var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338742,_0x130f1c,_0x1b622f){return new BPromise(function(_0x1eebfb,_0x4b068e){return client[_0xeccd('0x9')](_0x338742,_0x1b622f)[_0xeccd('0xa')](function(_0x9dccd){logger[_0xeccd('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x130f1c,'request\x20sent');logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'),JSON[_0xeccd('0xd')](_0x9dccd));if(_0x9dccd[_0xeccd('0xe')]){if(_0x9dccd[_0xeccd('0xe')][_0xeccd('0xf')]===0x1f4){logger['error'](_0xeccd('0x10'),_0x130f1c,_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);return _0x4b068e(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}logger[_0xeccd('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x130f1c,_0x9dccd['error'][_0xeccd('0x11')]);return _0x1eebfb(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}else{logger[_0xeccd('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'));_0x1eebfb(_0x9dccd[_0xeccd('0x12')]['message']);}})['catch'](function(_0x42e47e){logger[_0xeccd('0xe')](_0xeccd('0x10'),_0x130f1c,_0x42e47e);_0x4b068e(_0x42e47e);});});}exports[_0xeccd('0x13')]=function(_0xb0fad7){var _0x360d25=this;return new Promise(function(_0x466d98,_0x17596a){return db['OpenchannelQueueReport'][_0xeccd('0x14')](_0xb0fad7[_0xeccd('0x15')],{'raw':_0xb0fad7[_0xeccd('0x16')]?_0xb0fad7[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![]})[_0xeccd('0xa')](function(_0x508439){logger['info']('CreateOpenchannelQueueReport',_0xb0fad7);logger[_0xeccd('0x18')]('CreateOpenchannelQueueReport',_0xb0fad7,JSON[_0xeccd('0xd')](_0x508439));_0x466d98(_0x508439);})[_0xeccd('0x19')](function(_0x54083d){logger[_0xeccd('0xe')]('CreateOpenchannelQueueReport',_0x54083d[_0xeccd('0x11')],_0xb0fad7);_0x17596a(_0x360d25[_0xeccd('0xe')](0x1f4,_0x54083d[_0xeccd('0x11')]));});});};exports[_0xeccd('0x1a')]=function(_0x16e97a){var _0x5c4672=this;return new Promise(function(_0x4bc387,_0x560659){return db[_0xeccd('0x1b')][_0xeccd('0x1c')](_0x16e97a[_0xeccd('0x15')],{'raw':_0x16e97a[_0xeccd('0x16')]?_0x16e97a['options'][_0xeccd('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16e97a[_0xeccd('0x16')]?_0x16e97a[_0xeccd('0x16')][_0xeccd('0x1d')]||null:null,'attributes':_0x16e97a['options']?_0x16e97a[_0xeccd('0x16')][_0xeccd('0x1e')]||null:null,'limit':_0x16e97a[_0xeccd('0x16')]?_0x16e97a[_0xeccd('0x16')][_0xeccd('0x1f')]||null:null})[_0xeccd('0xa')](function(_0x2ea699){logger[_0xeccd('0xb')](_0xeccd('0x1a'),_0x16e97a);logger['debug'](_0xeccd('0x1a'),_0x16e97a,JSON['stringify'](_0x2ea699));_0x4bc387(_0x2ea699);})[_0xeccd('0x19')](function(_0x1817b7){logger[_0xeccd('0xe')](_0xeccd('0x1a'),_0x1817b7[_0xeccd('0x11')],_0x16e97a);_0x560659(_0x5c4672[_0xeccd('0xe')](0x1f4,_0x1817b7[_0xeccd('0x11')]));});});}; \ No newline at end of file +var _0x8d05=['body','options','raw','stringify','catch','UpdateOpenchannelQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create'];(function(_0x19f5f9,_0x43dc20){var _0x590fab=function(_0xa797e7){while(--_0xa797e7){_0x19f5f9['push'](_0x19f5f9['shift']());}};_0x590fab(++_0x43dc20);}(_0x8d05,0xe8));var _0x58d0=function(_0xf00c3b,_0x4aee2c){_0xf00c3b=_0xf00c3b-0x0;var _0x30c04e=_0x8d05[_0xf00c3b];return _0x30c04e;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var moment=require(_0x58d0('0x2'));var BPromise=require(_0x58d0('0x3'));var rs=require(_0x58d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58d0('0x5'));var logger=require(_0x58d0('0x6'))(_0x58d0('0x7'));var config=require(_0x58d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x58d0('0x9')][_0x58d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528303,_0x66aef1,_0x4e44e2){return new BPromise(function(_0xe744f4,_0x34ab60){return client[_0x58d0('0xb')](_0x528303,_0x4e44e2)[_0x58d0('0xc')](function(_0x1d070a){logger['info'](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));logger['debug'](_0x58d0('0xf'),_0x66aef1,_0x58d0('0xe'),JSON['stringify'](_0x1d070a));if(_0x1d070a['error']){if(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x11')]===0x1f4){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0x34ab60(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0xe744f4(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}else{logger[_0x58d0('0x13')](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));_0xe744f4(_0x1d070a[_0x58d0('0x14')][_0x58d0('0x12')]);}})['catch'](function(_0x10874e){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x10874e);_0x34ab60(_0x10874e);});});}exports[_0x58d0('0x15')]=function(_0xb8dd5f){var _0x2c7db6=this;return new Promise(function(_0x23dcfb,_0x41d221){return db[_0x58d0('0x16')][_0x58d0('0x17')](_0xb8dd5f[_0x58d0('0x18')],{'raw':_0xb8dd5f[_0x58d0('0x19')]?_0xb8dd5f[_0x58d0('0x19')][_0x58d0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3072f9){logger[_0x58d0('0x13')](_0x58d0('0x15'),_0xb8dd5f);logger['debug'](_0x58d0('0x15'),_0xb8dd5f,JSON[_0x58d0('0x1b')](_0x3072f9));_0x23dcfb(_0x3072f9);})[_0x58d0('0x1c')](function(_0x575b34){logger[_0x58d0('0x10')]('CreateOpenchannelQueueReport',_0x575b34['message'],_0xb8dd5f);_0x41d221(_0x2c7db6[_0x58d0('0x10')](0x1f4,_0x575b34[_0x58d0('0x12')]));});});};exports[_0x58d0('0x1d')]=function(_0x6c0cd0){var _0x5388ef=this;return new Promise(function(_0xca616e,_0x28b6e2){return db[_0x58d0('0x16')]['update'](_0x6c0cd0[_0x58d0('0x18')],{'raw':_0x6c0cd0[_0x58d0('0x19')]?_0x6c0cd0['options'][_0x58d0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6c0cd0[_0x58d0('0x19')]?_0x6c0cd0[_0x58d0('0x19')][_0x58d0('0x1e')]||null:null,'attributes':_0x6c0cd0[_0x58d0('0x19')]?_0x6c0cd0['options']['attributes']||null:null,'limit':_0x6c0cd0[_0x58d0('0x19')]?_0x6c0cd0[_0x58d0('0x19')][_0x58d0('0x1f')]||null:null})[_0x58d0('0xc')](function(_0x34a676){logger['info'](_0x58d0('0x1d'),_0x6c0cd0);logger['debug'](_0x58d0('0x1d'),_0x6c0cd0,JSON[_0x58d0('0x1b')](_0x34a676));_0xca616e(_0x34a676);})[_0x58d0('0x1c')](function(_0x396234){logger['error'](_0x58d0('0x1d'),_0x396234[_0x58d0('0x12')],_0x6c0cd0);_0x28b6e2(_0x5388ef[_0x58d0('0x10')](0x1f4,_0x396234['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index e49db7a..62b0cdf 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 _0xb450=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb450,0x114));var _0x0b45=function(_0x1d9cae,_0x5c21d4){_0x1d9cae=_0x1d9cae-0x0;var _0x3fcd34=_0xb450[_0x1d9cae];return _0x3fcd34;};'use strict';var multer=require(_0x0b45('0x0'));var util=require(_0x0b45('0x1'));var path=require(_0x0b45('0x2'));var timeout=require(_0x0b45('0x3'));var express=require(_0x0b45('0x4'));var router=express[_0x0b45('0x5')]();var fs_extra=require(_0x0b45('0x6'));var auth=require(_0x0b45('0x7'));var interaction=require(_0x0b45('0x8'));var config=require(_0x0b45('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0x0b45('0xa')]('/',auth['isAuthenticated'](),controller[_0x0b45('0xb')]);router[_0x0b45('0xa')](_0x0b45('0xc'),auth[_0x0b45('0xd')](),controller['describe']);router[_0x0b45('0xa')](_0x0b45('0xe'),auth['isAuthenticated'](),controller[_0x0b45('0xf')]);router[_0x0b45('0x10')]('/',auth[_0x0b45('0xd')](),controller['create']);router[_0x0b45('0x11')](_0x0b45('0xe'),auth[_0x0b45('0xd')](),controller[_0x0b45('0x12')]);router['delete'](_0x0b45('0xe'),auth[_0x0b45('0xd')](),controller[_0x0b45('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7932=['/describe','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x34a552,_0x10e6cd){var _0x9cde90=function(_0xed73a3){while(--_0xed73a3){_0x34a552['push'](_0x34a552['shift']());}};_0x9cde90(++_0x10e6cd);}(_0x7932,0x15d));var _0x2793=function(_0x535ab3,_0x3a25c0){_0x535ab3=_0x535ab3-0x0;var _0x4f91a3=_0x7932[_0x535ab3];return _0x4f91a3;};'use strict';var multer=require(_0x2793('0x0'));var util=require(_0x2793('0x1'));var path=require(_0x2793('0x2'));var timeout=require(_0x2793('0x3'));var express=require(_0x2793('0x4'));var router=express[_0x2793('0x5')]();var fs_extra=require(_0x2793('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2793('0x7'));var config=require(_0x2793('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x2793('0x9')]('/',auth[_0x2793('0xa')](),controller[_0x2793('0xb')]);router[_0x2793('0x9')](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['describe']);router[_0x2793('0x9')](_0x2793('0xd'),auth['isAuthenticated'](),controller[_0x2793('0xe')]);router[_0x2793('0xf')]('/',auth[_0x2793('0xa')](),controller['create']);router['put'](_0x2793('0xd'),auth[_0x2793('0xa')](),controller['update']);router[_0x2793('0x10')](_0x2793('0xd'),auth[_0x2793('0xa')](),controller[_0x2793('0x11')]);module[_0x2793('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4064100..d68418d 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1f191d,_0x3aedde){var _0xdcf727=function(_0x5d6f07){while(--_0x5d6f07){_0x1f191d['push'](_0x1f191d['shift']());}};_0xdcf727(++_0x3aedde);}(_0xedd9,0xfc));var _0x9edd=function(_0x1737e2,_0x2fe76f){_0x1737e2=_0x1737e2-0x0;var _0x813ace=_0xedd9[_0x1737e2];return _0x813ace;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x41d67e,_0x336a28){var _0x100cb2=function(_0x3fd927){while(--_0x3fd927){_0x41d67e['push'](_0x41d67e['shift']());}};_0x100cb2(++_0x336a28);}(_0x008c,0x188));var _0xc008=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x008c[_0x121886];return _0x20ca01;};'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 1954771..4612f7d 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 _0x745d=['send','index','map','OpenchannelTransferReport','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','includeAll','body','catch','find','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','name'];(function(_0x583328,_0x28b210){var _0x241700=function(_0x10ec3b){while(--_0x10ec3b){_0x583328['push'](_0x583328['shift']());}};_0x241700(++_0x28b210);}(_0x745d,0x1cb));var _0xd745=function(_0x52abda,_0x1f56e0){_0x52abda=_0x52abda-0x0;var _0x3a30d1=_0x745d[_0x52abda];return _0x3a30d1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd745('0x0'));var jsonpatch=require(_0xd745('0x1'));var rp=require(_0xd745('0x2'));var moment=require('moment');var BPromise=require(_0xd745('0x3'));var Mustache=require(_0xd745('0x4'));var util=require(_0xd745('0x5'));var path=require(_0xd745('0x6'));var sox=require('sox');var csv=require(_0xd745('0x7'));var ejs=require(_0xd745('0x8'));var fs=require('fs');var fs_extra=require(_0xd745('0x9'));var _=require(_0xd745('0xa'));var squel=require(_0xd745('0xb'));var crypto=require(_0xd745('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd745('0xd'));var Papa=require(_0xd745('0xe'));var Redis=require('ioredis');var authService=require(_0xd745('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd745('0x10'));var logger=require(_0xd745('0x11'))(_0xd745('0x12'));var utils=require(_0xd745('0x13'));var config=require(_0xd745('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd745('0x15'))['db'];function respondWithStatusCode(_0x13e5fc,_0x4dc470){_0x4dc470=_0x4dc470||0xcc;return function(_0x42ae69){if(_0x42ae69){return _0x13e5fc['sendStatus'](_0x4dc470);}return _0x13e5fc[_0xd745('0x16')](_0x4dc470)[_0xd745('0x17')]();};}function respondWithResult(_0x2b7342,_0x1b9ef6){_0x1b9ef6=_0x1b9ef6||0xc8;return function(_0xce71ba){if(_0xce71ba){return _0x2b7342[_0xd745('0x16')](_0x1b9ef6)[_0xd745('0x18')](_0xce71ba);}};}function respondWithFilteredResult(_0x54c04e,_0xb8e5bd){return function(_0xa0bd4f){if(_0xa0bd4f){var _0x5b4d60=typeof _0xb8e5bd[_0xd745('0x19')]===_0xd745('0x1a')&&typeof _0xb8e5bd[_0xd745('0x1b')]===_0xd745('0x1a');var _0x4a3a74=_0xa0bd4f[_0xd745('0x1c')];var _0x28f54e=_0x5b4d60?0x0:_0xb8e5bd['offset'];var _0x54bcc7=_0x5b4d60?_0xa0bd4f[_0xd745('0x1c')]:_0xb8e5bd[_0xd745('0x19')]+_0xb8e5bd[_0xd745('0x1b')];var _0x450ccd;if(_0x54bcc7>=_0x4a3a74){_0x54bcc7=_0x4a3a74;_0x450ccd=0xc8;}else{_0x450ccd=0xce;}_0x54c04e['status'](_0x450ccd);return _0x54c04e[_0xd745('0x1d')](_0xd745('0x1e'),_0x28f54e+'-'+_0x54bcc7+'/'+_0x4a3a74)[_0xd745('0x18')](_0xa0bd4f);}return null;};}function patchUpdates(_0x269824){return function(_0xba55a9){try{jsonpatch['apply'](_0xba55a9,_0x269824,!![]);}catch(_0x27ce69){return BPromise[_0xd745('0x1f')](_0x27ce69);}return _0xba55a9[_0xd745('0x20')]();};}function saveUpdates(_0x2e3a3e,_0x2efcb9){return function(_0x27260c){if(_0x27260c){return _0x27260c[_0xd745('0x21')](_0x2e3a3e)[_0xd745('0x22')](function(_0x31e4e2){return _0x31e4e2;});}return null;};}function removeEntity(_0x258d1d,_0x5e6452){return function(_0x59cf26){if(_0x59cf26){return _0x59cf26[_0xd745('0x23')]()[_0xd745('0x22')](function(){_0x258d1d[_0xd745('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d379,_0xf44cb9){return function(_0x587dbf){if(!_0x587dbf){_0x45d379[_0xd745('0x24')](0x194);}return _0x587dbf;};}function handleError(_0x3fe013,_0x28296f){_0x28296f=_0x28296f||0x1f4;return function(_0x186e27){logger['error'](_0x186e27['stack']);if(_0x186e27[_0xd745('0x25')]){delete _0x186e27[_0xd745('0x25')];}_0x3fe013[_0xd745('0x16')](_0x28296f)[_0xd745('0x26')](_0x186e27);};}exports[_0xd745('0x27')]=function(_0x2dc6ca,_0x3c22a7){var _0x1f5fc1={},_0x12b884={},_0x4df35e={'count':0x0,'rows':[]};var _0x3998e8=_[_0xd745('0x28')](db[_0xd745('0x29')]['rawAttributes'],function(_0x18afae){return{'name':_0x18afae[_0xd745('0x2a')],'type':_0x18afae[_0xd745('0x2b')][_0xd745('0x2c')]};});_0x12b884['model']=_['map'](_0x3998e8,'name');_0x12b884[_0xd745('0x2d')]=_[_0xd745('0x2e')](_0x2dc6ca[_0xd745('0x2d')]);_0x12b884[_0xd745('0x2f')]=_['intersection'](_0x12b884[_0xd745('0x30')],_0x12b884[_0xd745('0x2d')]);_0x1f5fc1[_0xd745('0x31')]=_[_0xd745('0x32')](_0x12b884[_0xd745('0x30')],qs[_0xd745('0x33')](_0x2dc6ca['query'][_0xd745('0x33')]));_0x1f5fc1[_0xd745('0x31')]=_0x1f5fc1[_0xd745('0x31')][_0xd745('0x34')]?_0x1f5fc1[_0xd745('0x31')]:_0x12b884['model'];if(!_0x2dc6ca['query'][_0xd745('0x35')](_0xd745('0x36'))){_0x1f5fc1['limit']=qs[_0xd745('0x1b')](_0x2dc6ca['query']['limit']);_0x1f5fc1['offset']=qs[_0xd745('0x19')](_0x2dc6ca[_0xd745('0x2d')][_0xd745('0x19')]);}_0x1f5fc1[_0xd745('0x37')]=qs[_0xd745('0x38')](_0x2dc6ca[_0xd745('0x2d')][_0xd745('0x38')]);_0x1f5fc1[_0xd745('0x39')]=qs['filters'](_['pick'](_0x2dc6ca[_0xd745('0x2d')],_0x12b884['filters']),_0x3998e8);if(_0x2dc6ca[_0xd745('0x2d')]['filter']){_0x1f5fc1['where']=_[_0xd745('0x3a')](_0x1f5fc1[_0xd745('0x39')],{'$or':_[_0xd745('0x28')](_0x3998e8,function(_0x4e97af){if(_0x4e97af[_0xd745('0x2b')]!==_0xd745('0x3b')){var _0x30a693={};_0x30a693[_0x4e97af['name']]={'$like':'%'+_0x2dc6ca[_0xd745('0x2d')]['filter']+'%'};return _0x30a693;}})});}_0x1f5fc1=_[_0xd745('0x3a')]({},_0x1f5fc1,_0x2dc6ca[_0xd745('0x3c')]);var _0x11408c={'where':_0x1f5fc1['where']};return db[_0xd745('0x29')]['count'](_0x11408c)[_0xd745('0x22')](function(_0x44e5f7){_0x4df35e[_0xd745('0x1c')]=_0x44e5f7;if(_0x2dc6ca[_0xd745('0x2d')]['includeAll']){_0x1f5fc1[_0xd745('0x3d')]=[{'all':!![]}];}return db[_0xd745('0x29')][_0xd745('0x3e')](_0x1f5fc1);})[_0xd745('0x22')](function(_0x4b140f){_0x4df35e['rows']=_0x4b140f;return _0x4df35e;})[_0xd745('0x22')](respondWithFilteredResult(_0x3c22a7,_0x1f5fc1))['catch'](handleError(_0x3c22a7,null));};exports[_0xd745('0x3f')]=function(_0x27cb0b,_0x338746){var _0x558b7a={'raw':!![],'where':{'id':_0x27cb0b[_0xd745('0x40')]['id']}},_0x48da2d={};_0x48da2d[_0xd745('0x30')]=_['keys'](db[_0xd745('0x29')][_0xd745('0x41')]);_0x48da2d[_0xd745('0x2d')]=_[_0xd745('0x2e')](_0x27cb0b[_0xd745('0x2d')]);_0x48da2d[_0xd745('0x2f')]=_[_0xd745('0x32')](_0x48da2d[_0xd745('0x30')],_0x48da2d['query']);_0x558b7a['attributes']=_[_0xd745('0x32')](_0x48da2d[_0xd745('0x30')],qs[_0xd745('0x33')](_0x27cb0b[_0xd745('0x2d')][_0xd745('0x33')]));_0x558b7a[_0xd745('0x31')]=_0x558b7a[_0xd745('0x31')][_0xd745('0x34')]?_0x558b7a[_0xd745('0x31')]:_0x48da2d[_0xd745('0x30')];if(_0x27cb0b['query'][_0xd745('0x42')]){_0x558b7a[_0xd745('0x3d')]=[{'all':!![]}];}_0x558b7a=_[_0xd745('0x3a')]({},_0x558b7a,_0x27cb0b[_0xd745('0x3c')]);return db[_0xd745('0x29')]['find'](_0x558b7a)[_0xd745('0x22')](handleEntityNotFound(_0x338746,null))['then'](respondWithResult(_0x338746,null))['catch'](handleError(_0x338746,null));};exports['create']=function(_0x2ec937,_0x4da77e){return db[_0xd745('0x29')]['create'](_0x2ec937[_0xd745('0x43')],{})[_0xd745('0x22')](respondWithResult(_0x4da77e,0xc9))[_0xd745('0x44')](handleError(_0x4da77e,null));};exports['update']=function(_0x367549,_0x2029ec){if(_0x367549['body']['id']){delete _0x367549[_0xd745('0x43')]['id'];}return db[_0xd745('0x29')]['find']({'where':{'id':_0x367549[_0xd745('0x40')]['id']}})[_0xd745('0x22')](handleEntityNotFound(_0x2029ec,null))[_0xd745('0x22')](saveUpdates(_0x367549[_0xd745('0x43')],null))[_0xd745('0x22')](respondWithResult(_0x2029ec,null))[_0xd745('0x44')](handleError(_0x2029ec,null));};exports[_0xd745('0x23')]=function(_0x19b6df,_0x167d3d){return db[_0xd745('0x29')][_0xd745('0x45')]({'where':{'id':_0x19b6df[_0xd745('0x40')]['id']}})['then'](handleEntityNotFound(_0x167d3d,null))[_0xd745('0x22')](removeEntity(_0x167d3d,null))[_0xd745('0x44')](handleError(_0x167d3d,null));};exports['describe']=function(_0x36f96b,_0x3de5d5){return db[_0xd745('0x29')][_0xd745('0x46')]()[_0xd745('0x22')](respondWithResult(_0x3de5d5,null))[_0xd745('0x44')](handleError(_0x3de5d5,null));}; \ No newline at end of file +var _0xf711=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','end','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','then','includeAll','rows','catch','show','keys','fields','find','create','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache'];(function(_0x5dd21a,_0x54d17f){var _0x576466=function(_0x318d74){while(--_0x318d74){_0x5dd21a['push'](_0x5dd21a['shift']());}};_0x576466(++_0x54d17f);}(_0xf711,0x93));var _0x1f71=function(_0x4d7c01,_0x17a6b3){_0x4d7c01=_0x4d7c01-0x0;var _0x1ec273=_0xf711[_0x4d7c01];return _0x1ec273;};'use strict';var emlformat=require(_0x1f71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1f71('0x2'));var BPromise=require(_0x1f71('0x3'));var Mustache=require(_0x1f71('0x4'));var util=require(_0x1f71('0x5'));var path=require(_0x1f71('0x6'));var sox=require(_0x1f71('0x7'));var csv=require(_0x1f71('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f71('0x9'));var _=require(_0x1f71('0xa'));var squel=require(_0x1f71('0xb'));var crypto=require(_0x1f71('0xc'));var jsforce=require(_0x1f71('0xd'));var deskjs=require(_0x1f71('0xe'));var toCsv=require(_0x1f71('0x8'));var querystring=require(_0x1f71('0xf'));var Papa=require(_0x1f71('0x10'));var Redis=require('ioredis');var authService=require(_0x1f71('0x11'));var qs=require(_0x1f71('0x12'));var as=require(_0x1f71('0x13'));var hardwareService=require(_0x1f71('0x14'));var logger=require(_0x1f71('0x15'))(_0x1f71('0x16'));var utils=require(_0x1f71('0x17'));var config=require(_0x1f71('0x18'));var licenseUtil=require(_0x1f71('0x19'));var db=require(_0x1f71('0x1a'))['db'];function respondWithStatusCode(_0x56c824,_0x3669c3){_0x3669c3=_0x3669c3||0xcc;return function(_0x14a397){if(_0x14a397){return _0x56c824[_0x1f71('0x1b')](_0x3669c3);}return _0x56c824['status'](_0x3669c3)['end']();};}function respondWithResult(_0x531d33,_0x3695e7){_0x3695e7=_0x3695e7||0xc8;return function(_0x4d53f8){if(_0x4d53f8){return _0x531d33[_0x1f71('0x1c')](_0x3695e7)['json'](_0x4d53f8);}};}function respondWithFilteredResult(_0x540213,_0x373bb2){return function(_0x400d9b){if(_0x400d9b){var _0x5b467b=typeof _0x373bb2['offset']===_0x1f71('0x1d')&&typeof _0x373bb2[_0x1f71('0x1e')]==='undefined';var _0xf0222b=_0x400d9b[_0x1f71('0x1f')];var _0x12bb00=_0x5b467b?0x0:_0x373bb2[_0x1f71('0x20')];var _0x51a8ef=_0x5b467b?_0x400d9b[_0x1f71('0x1f')]:_0x373bb2[_0x1f71('0x20')]+_0x373bb2['limit'];var _0x6cbfac;if(_0x51a8ef>=_0xf0222b){_0x51a8ef=_0xf0222b;_0x6cbfac=0xc8;}else{_0x6cbfac=0xce;}_0x540213[_0x1f71('0x1c')](_0x6cbfac);return _0x540213[_0x1f71('0x21')]('Content-Range',_0x12bb00+'-'+_0x51a8ef+'/'+_0xf0222b)[_0x1f71('0x22')](_0x400d9b);}return null;};}function patchUpdates(_0x260889){return function(_0x5dd663){try{jsonpatch[_0x1f71('0x23')](_0x5dd663,_0x260889,!![]);}catch(_0x1b3a29){return BPromise[_0x1f71('0x24')](_0x1b3a29);}return _0x5dd663[_0x1f71('0x25')]();};}function saveUpdates(_0x5d18fe,_0x5bd13e){return function(_0x1bf4fa){if(_0x1bf4fa){return _0x1bf4fa[_0x1f71('0x26')](_0x5d18fe)['then'](function(_0x2088ae){return _0x2088ae;});}return null;};}function removeEntity(_0x4b749e,_0x3fe433){return function(_0x12566e){if(_0x12566e){return _0x12566e[_0x1f71('0x27')]()['then'](function(){_0x4b749e['status'](0xcc)[_0x1f71('0x28')]();});}};}function handleEntityNotFound(_0x48fdc4,_0x399c29){return function(_0x1e2e4d){if(!_0x1e2e4d){_0x48fdc4[_0x1f71('0x1b')](0x194);}return _0x1e2e4d;};}function handleError(_0xb5c2d7,_0x9d1c04){_0x9d1c04=_0x9d1c04||0x1f4;return function(_0x5e3489){logger[_0x1f71('0x29')](_0x5e3489['stack']);if(_0x5e3489['name']){delete _0x5e3489[_0x1f71('0x2a')];}_0xb5c2d7[_0x1f71('0x1c')](_0x9d1c04)[_0x1f71('0x2b')](_0x5e3489);};}exports[_0x1f71('0x2c')]=function(_0x3f6a69,_0x1c956f){var _0xf80984={},_0x1c4c67={},_0x10adda={'count':0x0,'rows':[]};var _0x143674=_[_0x1f71('0x2d')](db[_0x1f71('0x2e')][_0x1f71('0x2f')],function(_0x5f0a7f){return{'name':_0x5f0a7f['fieldName'],'type':_0x5f0a7f[_0x1f71('0x30')][_0x1f71('0x31')]};});_0x1c4c67[_0x1f71('0x32')]=_[_0x1f71('0x2d')](_0x143674,_0x1f71('0x2a'));_0x1c4c67[_0x1f71('0x33')]=_['keys'](_0x3f6a69[_0x1f71('0x33')]);_0x1c4c67[_0x1f71('0x34')]=_[_0x1f71('0x35')](_0x1c4c67[_0x1f71('0x32')],_0x1c4c67['query']);_0xf80984[_0x1f71('0x36')]=_['intersection'](_0x1c4c67[_0x1f71('0x32')],qs['fields'](_0x3f6a69[_0x1f71('0x33')]['fields']));_0xf80984[_0x1f71('0x36')]=_0xf80984[_0x1f71('0x36')][_0x1f71('0x37')]?_0xf80984[_0x1f71('0x36')]:_0x1c4c67[_0x1f71('0x32')];if(!_0x3f6a69[_0x1f71('0x33')][_0x1f71('0x38')](_0x1f71('0x39'))){_0xf80984[_0x1f71('0x1e')]=qs[_0x1f71('0x1e')](_0x3f6a69[_0x1f71('0x33')]['limit']);_0xf80984['offset']=qs['offset'](_0x3f6a69[_0x1f71('0x33')][_0x1f71('0x20')]);}_0xf80984['order']=qs[_0x1f71('0x3a')](_0x3f6a69[_0x1f71('0x33')][_0x1f71('0x3a')]);_0xf80984[_0x1f71('0x3b')]=qs[_0x1f71('0x34')](_[_0x1f71('0x3c')](_0x3f6a69['query'],_0x1c4c67['filters']),_0x143674);if(_0x3f6a69[_0x1f71('0x33')]['filter']){_0xf80984[_0x1f71('0x3b')]=_[_0x1f71('0x3d')](_0xf80984[_0x1f71('0x3b')],{'$or':_[_0x1f71('0x2d')](_0x143674,function(_0xa4e88){if(_0xa4e88[_0x1f71('0x30')]!==_0x1f71('0x3e')){var _0xbd9a94={};_0xbd9a94[_0xa4e88[_0x1f71('0x2a')]]={'$like':'%'+_0x3f6a69['query']['filter']+'%'};return _0xbd9a94;}})});}_0xf80984=_[_0x1f71('0x3d')]({},_0xf80984,_0x3f6a69[_0x1f71('0x3f')]);var _0xabdfc1={'where':_0xf80984[_0x1f71('0x3b')]};return db['OpenchannelTransferReport']['count'](_0xabdfc1)[_0x1f71('0x40')](function(_0x4347f4){_0x10adda['count']=_0x4347f4;if(_0x3f6a69[_0x1f71('0x33')][_0x1f71('0x41')]){_0xf80984['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0xf80984);})[_0x1f71('0x40')](function(_0x123dbb){_0x10adda[_0x1f71('0x42')]=_0x123dbb;return _0x10adda;})[_0x1f71('0x40')](respondWithFilteredResult(_0x1c956f,_0xf80984))[_0x1f71('0x43')](handleError(_0x1c956f,null));};exports[_0x1f71('0x44')]=function(_0x5a155d,_0xa1be8f){var _0x391266={'raw':!![],'where':{'id':_0x5a155d['params']['id']}},_0x2c6214={};_0x2c6214[_0x1f71('0x32')]=_['keys'](db[_0x1f71('0x2e')][_0x1f71('0x2f')]);_0x2c6214[_0x1f71('0x33')]=_[_0x1f71('0x45')](_0x5a155d[_0x1f71('0x33')]);_0x2c6214[_0x1f71('0x34')]=_[_0x1f71('0x35')](_0x2c6214[_0x1f71('0x32')],_0x2c6214[_0x1f71('0x33')]);_0x391266[_0x1f71('0x36')]=_['intersection'](_0x2c6214['model'],qs['fields'](_0x5a155d[_0x1f71('0x33')][_0x1f71('0x46')]));_0x391266[_0x1f71('0x36')]=_0x391266[_0x1f71('0x36')][_0x1f71('0x37')]?_0x391266[_0x1f71('0x36')]:_0x2c6214[_0x1f71('0x32')];if(_0x5a155d['query']['includeAll']){_0x391266['include']=[{'all':!![]}];}_0x391266=_[_0x1f71('0x3d')]({},_0x391266,_0x5a155d[_0x1f71('0x3f')]);return db[_0x1f71('0x2e')][_0x1f71('0x47')](_0x391266)[_0x1f71('0x40')](handleEntityNotFound(_0xa1be8f,null))[_0x1f71('0x40')](respondWithResult(_0xa1be8f,null))[_0x1f71('0x43')](handleError(_0xa1be8f,null));};exports[_0x1f71('0x48')]=function(_0x1df2f9,_0x5b7716){return db['OpenchannelTransferReport'][_0x1f71('0x48')](_0x1df2f9['body'],{})[_0x1f71('0x40')](respondWithResult(_0x5b7716,0xc9))[_0x1f71('0x43')](handleError(_0x5b7716,null));};exports['update']=function(_0x20f4c7,_0x54f1c7){if(_0x20f4c7['body']['id']){delete _0x20f4c7[_0x1f71('0x49')]['id'];}return db[_0x1f71('0x2e')][_0x1f71('0x47')]({'where':{'id':_0x20f4c7[_0x1f71('0x4a')]['id']}})[_0x1f71('0x40')](handleEntityNotFound(_0x54f1c7,null))[_0x1f71('0x40')](saveUpdates(_0x20f4c7[_0x1f71('0x49')],null))[_0x1f71('0x40')](respondWithResult(_0x54f1c7,null))[_0x1f71('0x43')](handleError(_0x54f1c7,null));};exports[_0x1f71('0x27')]=function(_0x38e610,_0x1ce3c1){return db[_0x1f71('0x2e')][_0x1f71('0x47')]({'where':{'id':_0x38e610[_0x1f71('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ce3c1,null))['then'](removeEntity(_0x1ce3c1,null))[_0x1f71('0x43')](handleError(_0x1ce3c1,null));};exports[_0x1f71('0x4b')]=function(_0x1b5fb7,_0x243d24){return db[_0x1f71('0x2e')]['describe']()[_0x1f71('0x40')](respondWithResult(_0x243d24,null))['catch'](handleError(_0x243d24,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9f845bb..25c7e9c 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 _0xe630=['path','rimraf','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4a6979,_0x5f3d1a){var _0x226f93=function(_0x471572){while(--_0x471572){_0x4a6979['push'](_0x4a6979['shift']());}};_0x226f93(++_0x5f3d1a);}(_0xe630,0x17a));var _0x0e63=function(_0x4a93e9,_0x5b569f){_0x4a93e9=_0x4a93e9-0x0;var _0x4b3ba7=_0xe630[_0x4a93e9];return _0x4b3ba7;};'use strict';var _=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var logger=require(_0x0e63('0x2'))(_0x0e63('0x3'));var moment=require('moment');var BPromise=require(_0x0e63('0x4'));var rp=require(_0x0e63('0x5'));var fs=require('fs');var path=require(_0x0e63('0x6'));var rimraf=require(_0x0e63('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e63('0x8'));module['exports']=function(_0x549e11,_0x16c39b){return _0x549e11['define'](_0x0e63('0x9'),attributes,{'tableName':_0x0e63('0xa'),'paranoid':![],'indexes':[{'name':_0x0e63('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x48a5=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','api','moment'];(function(_0x5f12eb,_0x2cd664){var _0x1fb94e=function(_0x5cd871){while(--_0x5cd871){_0x5f12eb['push'](_0x5f12eb['shift']());}};_0x1fb94e(++_0x2cd664);}(_0x48a5,0x1de));var _0x548a=function(_0x3d521e,_0x27b7cf){_0x3d521e=_0x3d521e-0x0;var _0x20d199=_0x48a5[_0x3d521e];return _0x20d199;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x548a('0x0'));var moment=require(_0x548a('0x1'));var BPromise=require(_0x548a('0x2'));var rp=require(_0x548a('0x3'));var fs=require('fs');var path=require(_0x548a('0x4'));var rimraf=require(_0x548a('0x5'));var config=require(_0x548a('0x6'));var attributes=require(_0x548a('0x7'));module[_0x548a('0x8')]=function(_0xba0f5e,_0x570fd9){return _0xba0f5e[_0x548a('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0x548a('0xa'),'paranoid':![],'indexes':[{'name':_0x548a('0xb'),'fields':[_0x548a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index fa4885b..464e9bf 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0960=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring'];(function(_0x162be7,_0x399cd5){var _0x58da4c=function(_0x4d5a49){while(--_0x4d5a49){_0x162be7['push'](_0x162be7['shift']());}};_0x58da4c(++_0x399cd5);}(_0x0960,0xc2));var _0x0096=function(_0x250a5a,_0x487c09){_0x250a5a=_0x250a5a-0x0;var _0x5a3ce1=_0x0960[_0x250a5a];return _0x5a3ce1;};'use strict';var _=require(_0x0096('0x0'));var util=require(_0x0096('0x1'));var moment=require('moment');var BPromise=require(_0x0096('0x2'));var rs=require(_0x0096('0x3'));var fs=require('fs');var Redis=require(_0x0096('0x4'));var db=require(_0x0096('0x5'))['db'];var utils=require(_0x0096('0x6'));var logger=require(_0x0096('0x7'))(_0x0096('0x8'));var config=require(_0x0096('0x9'));var jayson=require(_0x0096('0xa'));var client=jayson[_0x0096('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81cc41,_0x57390a,_0x1d35f1){return new BPromise(function(_0x44e168,_0x407f3a){return client['request'](_0x81cc41,_0x1d35f1)[_0x0096('0xc')](function(_0x3e97ce){logger[_0x0096('0xd')](_0x0096('0xe'),_0x57390a,'request\x20sent');logger[_0x0096('0xf')](_0x0096('0x10'),_0x57390a,'request\x20sent',JSON[_0x0096('0x11')](_0x3e97ce));if(_0x3e97ce['error']){if(_0x3e97ce[_0x0096('0x12')]['code']===0x1f4){logger[_0x0096('0x12')](_0x0096('0xe'),_0x57390a,_0x3e97ce['error'][_0x0096('0x13')]);return _0x407f3a(_0x3e97ce[_0x0096('0x12')]['message']);}logger['error'](_0x0096('0xe'),_0x57390a,_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);return _0x44e168(_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x57390a,_0x0096('0x14'));_0x44e168(_0x3e97ce['result']['message']);}})[_0x0096('0x15')](function(_0x37f0e4){logger['error'](_0x0096('0xe'),_0x57390a,_0x37f0e4);_0x407f3a(_0x37f0e4);});});} \ No newline at end of file +var _0x6334=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x34c82c,_0x287bb6){var _0x15e07e=function(_0x40ff94){while(--_0x40ff94){_0x34c82c['push'](_0x34c82c['shift']());}};_0x15e07e(++_0x287bb6);}(_0x6334,0x119));var _0x4633=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x6334[_0x18e52b];return _0x3d3062;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a8997,_0x5647f1,_0x56891d){return new BPromise(function(_0x21af74,_0x148e72){return client['request'](_0x4a8997,_0x56891d)[_0x4633('0xd')](function(_0x31e794){logger[_0x4633('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'));logger[_0x4633('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'),JSON[_0x4633('0x11')](_0x31e794));if(_0x31e794[_0x4633('0x12')]){if(_0x31e794[_0x4633('0x12')]['code']===0x1f4){logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794[_0x4633('0x12')]['message']);return _0x148e72(_0x31e794['error']['message']);}logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794['error']['message']);return _0x21af74(_0x31e794[_0x4633('0x12')]['message']);}else{logger[_0x4633('0xe')](_0x4633('0x13'),_0x5647f1,_0x4633('0xf'));_0x21af74(_0x31e794[_0x4633('0x14')]['message']);}})[_0x4633('0x15')](function(_0x15bd98){logger[_0x4633('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5647f1,_0x15bd98);_0x148e72(_0x15bd98);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8919e0a..c3f2c9d 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 _0xb44b=['post','isAuthenticated','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','show'];(function(_0xbb710f,_0x52774e){var _0x17f35b=function(_0x55d680){while(--_0x55d680){_0xbb710f['push'](_0xbb710f['shift']());}};_0x17f35b(++_0x52774e);}(_0xb44b,0x118));var _0xbb44=function(_0x28b12e,_0x59f4f5){_0x28b12e=_0x28b12e-0x0;var _0x2c3bd1=_0xb44b[_0x28b12e];return _0x2c3bd1;};'use strict';var multer=require(_0xbb44('0x0'));var util=require(_0xbb44('0x1'));var path=require('path');var timeout=require(_0xbb44('0x2'));var express=require(_0xbb44('0x3'));var router=express[_0xbb44('0x4')]();var fs_extra=require(_0xbb44('0x5'));var auth=require(_0xbb44('0x6'));var interaction=require(_0xbb44('0x7'));var config=require(_0xbb44('0x8'));var controller=require(_0xbb44('0x9'));router[_0xbb44('0xa')]('/',auth['isAuthenticated'](),controller[_0xbb44('0xb')]);router[_0xbb44('0xa')](_0xbb44('0xc'),auth['isAuthenticated'](),controller[_0xbb44('0xd')]);router[_0xbb44('0xe')]('/',auth[_0xbb44('0xf')](),controller[_0xbb44('0x10')]);router[_0xbb44('0x11')](_0xbb44('0xc'),auth['isAuthenticated'](),controller[_0xbb44('0x12')]);router[_0xbb44('0x13')](_0xbb44('0xc'),auth[_0xbb44('0xf')](),controller['destroy']);module[_0xbb44('0x14')]=router; \ No newline at end of file +var _0xe9db=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer'];(function(_0x4ef826,_0x2e0ac8){var _0x154b8=function(_0x4fae58){while(--_0x4fae58){_0x4ef826['push'](_0x4ef826['shift']());}};_0x154b8(++_0x2e0ac8);}(_0xe9db,0xbc));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe9d('0x0'));var util=require(_0xbe9d('0x1'));var path=require(_0xbe9d('0x2'));var timeout=require(_0xbe9d('0x3'));var express=require(_0xbe9d('0x4'));var router=express[_0xbe9d('0x5')]();var fs_extra=require(_0xbe9d('0x6'));var auth=require(_0xbe9d('0x7'));var interaction=require(_0xbe9d('0x8'));var config=require(_0xbe9d('0x9'));var controller=require(_0xbe9d('0xa'));router[_0xbe9d('0xb')]('/',auth[_0xbe9d('0xc')](),controller[_0xbe9d('0xd')]);router['get'](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller[_0xbe9d('0xf')]);router[_0xbe9d('0x10')]('/',auth[_0xbe9d('0xc')](),controller[_0xbe9d('0x11')]);router[_0xbe9d('0x12')](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller[_0xbe9d('0x13')]);router[_0xbe9d('0x14')](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller['destroy']);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 12efce6..848941a 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 _0x0e9d=['name','sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e9d,0xdc));var _0xd0e9=function(_0x503eb0,_0x1fd586){_0x503eb0=_0x503eb0-0x0;var _0x413372=_0x0e9d[_0x503eb0];return _0x413372;};'use strict';var Sequelize=require(_0xd0e9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0e9('0x1')],'unique':_0xd0e9('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3588=['name','sequelize','exports','STRING'];(function(_0x488447,_0x48e0c7){var _0x1816cb=function(_0x75b118){while(--_0x75b118){_0x488447['push'](_0x488447['shift']());}};_0x1816cb(++_0x48e0c7);}(_0x3588,0x159));var _0x8358=function(_0x1510c5,_0xde9022){_0x1510c5=_0x1510c5-0x0;var _0x433a86=_0x3588[_0x1510c5];return _0x433a86;};'use strict';var Sequelize=require(_0x8358('0x0'));module[_0x8358('0x1')]={'name':{'type':Sequelize[_0x8358('0x2')],'unique':_0x8358('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0a38dea..9f323a4 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 _0x8c78=['apply','update','then','destroy','get','Pauses','error','stack','name','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8c78,0x12b));var _0x88c7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8c78[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x88c7('0x0'));var rimraf=require(_0x88c7('0x1'));var zipdir=require(_0x88c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x88c7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x88c7('0x4'));var util=require(_0x88c7('0x5'));var path=require(_0x88c7('0x6'));var sox=require(_0x88c7('0x7'));var csv=require('to-csv');var ejs=require(_0x88c7('0x8'));var fs=require('fs');var fs_extra=require(_0x88c7('0x9'));var _=require(_0x88c7('0xa'));var squel=require(_0x88c7('0xb'));var crypto=require('crypto');var jsforce=require(_0x88c7('0xc'));var deskjs=require(_0x88c7('0xd'));var toCsv=require(_0x88c7('0xe'));var querystring=require(_0x88c7('0xf'));var Papa=require(_0x88c7('0x10'));var Redis=require(_0x88c7('0x11'));var authService=require(_0x88c7('0x12'));var qs=require(_0x88c7('0x13'));var as=require(_0x88c7('0x14'));var hardwareService=require(_0x88c7('0x15'));var logger=require(_0x88c7('0x16'))(_0x88c7('0x17'));var utils=require(_0x88c7('0x18'));var config=require(_0x88c7('0x19'));var licenseUtil=require(_0x88c7('0x1a'));var db=require(_0x88c7('0x1b'))['db'];function respondWithStatusCode(_0x178ab5,_0x47afc5){_0x47afc5=_0x47afc5||0xcc;return function(_0x46175a){if(_0x46175a){return _0x178ab5[_0x88c7('0x1c')](_0x47afc5);}return _0x178ab5[_0x88c7('0x1d')](_0x47afc5)[_0x88c7('0x1e')]();};}function respondWithResult(_0x12273f,_0x576ef1){_0x576ef1=_0x576ef1||0xc8;return function(_0x4fff3c){if(_0x4fff3c){return _0x12273f['status'](_0x576ef1)[_0x88c7('0x1f')](_0x4fff3c);}};}function respondWithFilteredResult(_0xce8b1a,_0x510144){return function(_0x1e5842){if(_0x1e5842){var _0x9b22e5=typeof _0x510144[_0x88c7('0x20')]==='undefined'&&typeof _0x510144[_0x88c7('0x21')]===_0x88c7('0x22');var _0x435b3f=_0x1e5842['count'];var _0x39b73b=_0x9b22e5?0x0:_0x510144[_0x88c7('0x20')];var _0x1cc21a=_0x9b22e5?_0x1e5842[_0x88c7('0x23')]:_0x510144[_0x88c7('0x20')]+_0x510144[_0x88c7('0x21')];var _0x23fba0;if(_0x1cc21a>=_0x435b3f){_0x1cc21a=_0x435b3f;_0x23fba0=0xc8;}else{_0x23fba0=0xce;}_0xce8b1a['status'](_0x23fba0);return _0xce8b1a['set'](_0x88c7('0x24'),_0x39b73b+'-'+_0x1cc21a+'/'+_0x435b3f)[_0x88c7('0x1f')](_0x1e5842);}return null;};}function patchUpdates(_0x21bcb0){return function(_0x5b601d){try{jsonpatch[_0x88c7('0x25')](_0x5b601d,_0x21bcb0,!![]);}catch(_0x4844a2){return BPromise['reject'](_0x4844a2);}return _0x5b601d['save']();};}function saveUpdates(_0x40494b,_0x436105){return function(_0x2819a4){if(_0x2819a4){return _0x2819a4[_0x88c7('0x26')](_0x40494b)[_0x88c7('0x27')](function(_0x14f875){return _0x14f875;});}return null;};}function removeEntity(_0x360ec9,_0x1a2852){return function(_0x32293f){if(_0x32293f){return _0x32293f[_0x88c7('0x28')]()[_0x88c7('0x27')](function(){var _0x2546cb=_0x32293f[_0x88c7('0x29')]({'plain':!![]});var _0x1719bb=_0x88c7('0x2a');return db['UserProfileResource'][_0x88c7('0x28')]({'where':{'type':_0x1719bb,'resourceId':_0x2546cb['id']}})[_0x88c7('0x27')](function(){return _0x32293f;});})[_0x88c7('0x27')](function(){_0x360ec9['status'](0xcc)[_0x88c7('0x1e')]();});}};}function handleEntityNotFound(_0xf23cd0,_0x2cb456){return function(_0x379e83){if(!_0x379e83){_0xf23cd0[_0x88c7('0x1c')](0x194);}return _0x379e83;};}function handleError(_0x2384c4,_0x575b8b){_0x575b8b=_0x575b8b||0x1f4;return function(_0x42c6c4){logger[_0x88c7('0x2b')](_0x42c6c4[_0x88c7('0x2c')]);if(_0x42c6c4[_0x88c7('0x2d')]){delete _0x42c6c4[_0x88c7('0x2d')];}_0x2384c4[_0x88c7('0x1d')](_0x575b8b)['send'](_0x42c6c4);};}exports['index']=function(_0x176da3,_0x1de55d){var _0x3a947b={},_0x100fc6={},_0x369b26={'count':0x0,'rows':[]};var _0x57f7f9=_['map'](db['Pause'][_0x88c7('0x2e')],function(_0x30fa6d){return{'name':_0x30fa6d[_0x88c7('0x2f')],'type':_0x30fa6d[_0x88c7('0x30')]['key']};});_0x100fc6[_0x88c7('0x31')]=_[_0x88c7('0x32')](_0x57f7f9,_0x88c7('0x2d'));_0x100fc6[_0x88c7('0x33')]=_[_0x88c7('0x34')](_0x176da3[_0x88c7('0x33')]);_0x100fc6['filters']=_[_0x88c7('0x35')](_0x100fc6[_0x88c7('0x31')],_0x100fc6[_0x88c7('0x33')]);_0x3a947b[_0x88c7('0x36')]=_[_0x88c7('0x35')](_0x100fc6[_0x88c7('0x31')],qs[_0x88c7('0x37')](_0x176da3[_0x88c7('0x33')][_0x88c7('0x37')]));_0x3a947b['attributes']=_0x3a947b[_0x88c7('0x36')]['length']?_0x3a947b[_0x88c7('0x36')]:_0x100fc6[_0x88c7('0x31')];if(!_0x176da3[_0x88c7('0x33')][_0x88c7('0x38')](_0x88c7('0x39'))){_0x3a947b['limit']=qs[_0x88c7('0x21')](_0x176da3['query']['limit']);_0x3a947b['offset']=qs['offset'](_0x176da3[_0x88c7('0x33')][_0x88c7('0x20')]);}_0x3a947b[_0x88c7('0x3a')]=qs[_0x88c7('0x3b')](_0x176da3[_0x88c7('0x33')][_0x88c7('0x3b')]);_0x3a947b[_0x88c7('0x3c')]=qs['filters'](_[_0x88c7('0x3d')](_0x176da3[_0x88c7('0x33')],_0x100fc6[_0x88c7('0x3e')]),_0x57f7f9);if(_0x176da3[_0x88c7('0x33')][_0x88c7('0x3f')]){_0x3a947b[_0x88c7('0x3c')]=_[_0x88c7('0x40')](_0x3a947b[_0x88c7('0x3c')],{'$or':_[_0x88c7('0x32')](_0x57f7f9,function(_0x13b9bc){if(_0x13b9bc[_0x88c7('0x30')]!==_0x88c7('0x41')){var _0x4ab37b={};_0x4ab37b[_0x13b9bc[_0x88c7('0x2d')]]={'$like':'%'+_0x176da3['query']['filter']+'%'};return _0x4ab37b;}})});}_0x3a947b=_[_0x88c7('0x40')]({},_0x3a947b,_0x176da3[_0x88c7('0x42')]);var _0x175ede={'where':_0x3a947b['where']};return db[_0x88c7('0x43')]['count'](_0x175ede)['then'](function(_0x410aac){_0x369b26['count']=_0x410aac;if(_0x176da3[_0x88c7('0x33')][_0x88c7('0x44')]){_0x3a947b[_0x88c7('0x45')]=[{'all':!![]}];}return db[_0x88c7('0x43')][_0x88c7('0x46')](_0x3a947b);})[_0x88c7('0x27')](function(_0x1df977){_0x369b26[_0x88c7('0x47')]=_0x1df977;return _0x369b26;})[_0x88c7('0x27')](respondWithFilteredResult(_0x1de55d,_0x3a947b))[_0x88c7('0x48')](handleError(_0x1de55d,null));};exports[_0x88c7('0x49')]=function(_0x4067f9,_0x2f2ad1){var _0x20816a={'raw':!![],'where':{'id':_0x4067f9['params']['id']}},_0x121c07={};_0x121c07['model']=_[_0x88c7('0x34')](db[_0x88c7('0x43')][_0x88c7('0x2e')]);_0x121c07[_0x88c7('0x33')]=_['keys'](_0x4067f9[_0x88c7('0x33')]);_0x121c07[_0x88c7('0x3e')]=_['intersection'](_0x121c07[_0x88c7('0x31')],_0x121c07[_0x88c7('0x33')]);_0x20816a[_0x88c7('0x36')]=_[_0x88c7('0x35')](_0x121c07[_0x88c7('0x31')],qs['fields'](_0x4067f9[_0x88c7('0x33')]['fields']));_0x20816a[_0x88c7('0x36')]=_0x20816a[_0x88c7('0x36')][_0x88c7('0x4a')]?_0x20816a['attributes']:_0x121c07['model'];if(_0x4067f9[_0x88c7('0x33')]['includeAll']){_0x20816a[_0x88c7('0x45')]=[{'all':!![]}];}_0x20816a=_[_0x88c7('0x40')]({},_0x20816a,_0x4067f9[_0x88c7('0x42')]);return db[_0x88c7('0x43')][_0x88c7('0x4b')](_0x20816a)[_0x88c7('0x27')](handleEntityNotFound(_0x2f2ad1,null))[_0x88c7('0x27')](respondWithResult(_0x2f2ad1,null))[_0x88c7('0x48')](handleError(_0x2f2ad1,null));};exports['create']=function(_0x482bd9,_0x391c99){return db[_0x88c7('0x43')][_0x88c7('0x4c')](_0x482bd9[_0x88c7('0x4d')],{})[_0x88c7('0x27')](function(_0x1e2fee){var _0x1cceb8=_0x482bd9[_0x88c7('0x4e')]['get']({'plain':!![]});if(!_0x1cceb8)throw new Error(_0x88c7('0x4f'));if(_0x1cceb8['role']===_0x88c7('0x4e')){var _0x41e88b=_0x1e2fee['get']({'plain':!![]});var _0x456b9c=_0x88c7('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x456b9c,'userProfileId':_0x1cceb8[_0x88c7('0x50')]},'raw':!![]})[_0x88c7('0x27')](function(_0x329d4c){if(_0x329d4c&&_0x329d4c[_0x88c7('0x51')]===0x0){return db['UserProfileResource'][_0x88c7('0x4c')]({'name':_0x41e88b[_0x88c7('0x2d')],'resourceId':_0x41e88b['id'],'type':_0x329d4c['name'],'sectionId':_0x329d4c['id']},{})[_0x88c7('0x27')](function(){return _0x1e2fee;});}else{return _0x1e2fee;}})[_0x88c7('0x48')](function(_0x16e9d9){logger[_0x88c7('0x2b')](_0x88c7('0x52'),_0x16e9d9);throw _0x16e9d9;});}return _0x1e2fee;})[_0x88c7('0x27')](respondWithResult(_0x391c99,0xc9))[_0x88c7('0x48')](handleError(_0x391c99,null));};exports[_0x88c7('0x26')]=function(_0x187e23,_0x566000){if(_0x187e23[_0x88c7('0x4d')]['id']){delete _0x187e23[_0x88c7('0x4d')]['id'];}return db[_0x88c7('0x43')][_0x88c7('0x4b')]({'where':{'id':_0x187e23['params']['id']}})[_0x88c7('0x27')](handleEntityNotFound(_0x566000,null))[_0x88c7('0x27')](saveUpdates(_0x187e23[_0x88c7('0x4d')],null))['then'](respondWithResult(_0x566000,null))[_0x88c7('0x48')](handleError(_0x566000,null));};exports[_0x88c7('0x28')]=function(_0x3ecccf,_0x39935e){return db[_0x88c7('0x43')]['find']({'where':{'id':_0x3ecccf[_0x88c7('0x53')]['id']}})['then'](handleEntityNotFound(_0x39935e,null))[_0x88c7('0x27')](removeEntity(_0x39935e,null))['catch'](handleError(_0x39935e,null));}; \ No newline at end of file +var _0xb5ea=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','get','Pauses','UserProfileResource','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x5e371d,_0x4fdc6b){var _0x5b2f77=function(_0x240d73){while(--_0x240d73){_0x5e371d['push'](_0x5e371d['shift']());}};_0x5b2f77(++_0x4fdc6b);}(_0xb5ea,0x1e4));var _0xab5e=function(_0x4d9f5d,_0x1df37d){_0x4d9f5d=_0x4d9f5d-0x0;var _0x4c0e51=_0xb5ea[_0x4d9f5d];return _0x4c0e51;};'use strict';var emlformat=require(_0xab5e('0x0'));var rimraf=require(_0xab5e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xab5e('0x2'));var moment=require(_0xab5e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xab5e('0x4'));var util=require(_0xab5e('0x5'));var path=require(_0xab5e('0x6'));var sox=require(_0xab5e('0x7'));var csv=require('to-csv');var ejs=require(_0xab5e('0x8'));var fs=require('fs');var fs_extra=require(_0xab5e('0x9'));var _=require(_0xab5e('0xa'));var squel=require(_0xab5e('0xb'));var crypto=require(_0xab5e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xab5e('0xd'));var toCsv=require(_0xab5e('0xe'));var querystring=require(_0xab5e('0xf'));var Papa=require('papaparse');var Redis=require(_0xab5e('0x10'));var authService=require(_0xab5e('0x11'));var qs=require(_0xab5e('0x12'));var as=require(_0xab5e('0x13'));var hardwareService=require(_0xab5e('0x14'));var logger=require(_0xab5e('0x15'))('api');var utils=require(_0xab5e('0x16'));var config=require(_0xab5e('0x17'));var licenseUtil=require(_0xab5e('0x18'));var db=require(_0xab5e('0x19'))['db'];function respondWithStatusCode(_0x47a70b,_0x31f69a){_0x31f69a=_0x31f69a||0xcc;return function(_0x17619a){if(_0x17619a){return _0x47a70b[_0xab5e('0x1a')](_0x31f69a);}return _0x47a70b[_0xab5e('0x1b')](_0x31f69a)['end']();};}function respondWithResult(_0x401c4a,_0x38c2ff){_0x38c2ff=_0x38c2ff||0xc8;return function(_0x2c28d5){if(_0x2c28d5){return _0x401c4a[_0xab5e('0x1b')](_0x38c2ff)[_0xab5e('0x1c')](_0x2c28d5);}};}function respondWithFilteredResult(_0x14baca,_0x4df013){return function(_0x3164eb){if(_0x3164eb){var _0x2b790b=typeof _0x4df013['offset']===_0xab5e('0x1d')&&typeof _0x4df013[_0xab5e('0x1e')]===_0xab5e('0x1d');var _0x2b7519=_0x3164eb['count'];var _0x4f1529=_0x2b790b?0x0:_0x4df013['offset'];var _0x528178=_0x2b790b?_0x3164eb[_0xab5e('0x1f')]:_0x4df013[_0xab5e('0x20')]+_0x4df013[_0xab5e('0x1e')];var _0x5e997f;if(_0x528178>=_0x2b7519){_0x528178=_0x2b7519;_0x5e997f=0xc8;}else{_0x5e997f=0xce;}_0x14baca['status'](_0x5e997f);return _0x14baca[_0xab5e('0x21')]('Content-Range',_0x4f1529+'-'+_0x528178+'/'+_0x2b7519)['json'](_0x3164eb);}return null;};}function patchUpdates(_0x127e92){return function(_0x263680){try{jsonpatch[_0xab5e('0x22')](_0x263680,_0x127e92,!![]);}catch(_0x575f5f){return BPromise['reject'](_0x575f5f);}return _0x263680[_0xab5e('0x23')]();};}function saveUpdates(_0x26a6e1,_0x1e48e9){return function(_0x50a1de){if(_0x50a1de){return _0x50a1de[_0xab5e('0x24')](_0x26a6e1)['then'](function(_0x29d911){return _0x29d911;});}return null;};}function removeEntity(_0x3ae00b,_0x92c0e7){return function(_0x40326c){if(_0x40326c){return _0x40326c[_0xab5e('0x25')]()[_0xab5e('0x26')](function(){var _0x5c90a1=_0x40326c[_0xab5e('0x27')]({'plain':!![]});var _0x3b3c9a=_0xab5e('0x28');return db[_0xab5e('0x29')][_0xab5e('0x25')]({'where':{'type':_0x3b3c9a,'resourceId':_0x5c90a1['id']}})[_0xab5e('0x26')](function(){return _0x40326c;});})[_0xab5e('0x26')](function(){_0x3ae00b[_0xab5e('0x1b')](0xcc)[_0xab5e('0x2a')]();});}};}function handleEntityNotFound(_0x510d0b,_0x383a7f){return function(_0x49b475){if(!_0x49b475){_0x510d0b[_0xab5e('0x1a')](0x194);}return _0x49b475;};}function handleError(_0x2861c0,_0x2a7b75){_0x2a7b75=_0x2a7b75||0x1f4;return function(_0x11e44e){logger[_0xab5e('0x2b')](_0x11e44e[_0xab5e('0x2c')]);if(_0x11e44e[_0xab5e('0x2d')]){delete _0x11e44e['name'];}_0x2861c0[_0xab5e('0x1b')](_0x2a7b75)[_0xab5e('0x2e')](_0x11e44e);};}exports[_0xab5e('0x2f')]=function(_0x199edb,_0x58dfe0){var _0x215abc={},_0x180273={},_0x2828b5={'count':0x0,'rows':[]};var _0x3e0b4f=_[_0xab5e('0x30')](db[_0xab5e('0x31')][_0xab5e('0x32')],function(_0xeb7d12){return{'name':_0xeb7d12[_0xab5e('0x33')],'type':_0xeb7d12[_0xab5e('0x34')]['key']};});_0x180273[_0xab5e('0x35')]=_['map'](_0x3e0b4f,_0xab5e('0x2d'));_0x180273['query']=_['keys'](_0x199edb[_0xab5e('0x36')]);_0x180273[_0xab5e('0x37')]=_['intersection'](_0x180273[_0xab5e('0x35')],_0x180273['query']);_0x215abc[_0xab5e('0x38')]=_[_0xab5e('0x39')](_0x180273[_0xab5e('0x35')],qs[_0xab5e('0x3a')](_0x199edb[_0xab5e('0x36')][_0xab5e('0x3a')]));_0x215abc[_0xab5e('0x38')]=_0x215abc[_0xab5e('0x38')][_0xab5e('0x3b')]?_0x215abc[_0xab5e('0x38')]:_0x180273[_0xab5e('0x35')];if(!_0x199edb[_0xab5e('0x36')][_0xab5e('0x3c')](_0xab5e('0x3d'))){_0x215abc[_0xab5e('0x1e')]=qs[_0xab5e('0x1e')](_0x199edb[_0xab5e('0x36')][_0xab5e('0x1e')]);_0x215abc['offset']=qs[_0xab5e('0x20')](_0x199edb[_0xab5e('0x36')][_0xab5e('0x20')]);}_0x215abc[_0xab5e('0x3e')]=qs['sort'](_0x199edb[_0xab5e('0x36')]['sort']);_0x215abc[_0xab5e('0x3f')]=qs[_0xab5e('0x37')](_[_0xab5e('0x40')](_0x199edb[_0xab5e('0x36')],_0x180273[_0xab5e('0x37')]),_0x3e0b4f);if(_0x199edb['query'][_0xab5e('0x41')]){_0x215abc[_0xab5e('0x3f')]=_['merge'](_0x215abc['where'],{'$or':_[_0xab5e('0x30')](_0x3e0b4f,function(_0x1470fa){if(_0x1470fa[_0xab5e('0x34')]!==_0xab5e('0x42')){var _0x2522eb={};_0x2522eb[_0x1470fa['name']]={'$like':'%'+_0x199edb[_0xab5e('0x36')][_0xab5e('0x41')]+'%'};return _0x2522eb;}})});}_0x215abc=_[_0xab5e('0x43')]({},_0x215abc,_0x199edb[_0xab5e('0x44')]);var _0x4017f2={'where':_0x215abc[_0xab5e('0x3f')]};return db[_0xab5e('0x31')]['count'](_0x4017f2)['then'](function(_0x4dcb29){_0x2828b5['count']=_0x4dcb29;if(_0x199edb[_0xab5e('0x36')][_0xab5e('0x45')]){_0x215abc[_0xab5e('0x46')]=[{'all':!![]}];}return db['Pause'][_0xab5e('0x47')](_0x215abc);})[_0xab5e('0x26')](function(_0x18f03a){_0x2828b5[_0xab5e('0x48')]=_0x18f03a;return _0x2828b5;})[_0xab5e('0x26')](respondWithFilteredResult(_0x58dfe0,_0x215abc))[_0xab5e('0x49')](handleError(_0x58dfe0,null));};exports['show']=function(_0x2036a0,_0x4a39af){var _0x578ced={'raw':!![],'where':{'id':_0x2036a0['params']['id']}},_0x878959={};_0x878959[_0xab5e('0x35')]=_[_0xab5e('0x4a')](db[_0xab5e('0x31')][_0xab5e('0x32')]);_0x878959[_0xab5e('0x36')]=_[_0xab5e('0x4a')](_0x2036a0[_0xab5e('0x36')]);_0x878959[_0xab5e('0x37')]=_[_0xab5e('0x39')](_0x878959['model'],_0x878959[_0xab5e('0x36')]);_0x578ced[_0xab5e('0x38')]=_[_0xab5e('0x39')](_0x878959['model'],qs[_0xab5e('0x3a')](_0x2036a0['query'][_0xab5e('0x3a')]));_0x578ced[_0xab5e('0x38')]=_0x578ced['attributes']['length']?_0x578ced[_0xab5e('0x38')]:_0x878959['model'];if(_0x2036a0['query'][_0xab5e('0x45')]){_0x578ced[_0xab5e('0x46')]=[{'all':!![]}];}_0x578ced=_[_0xab5e('0x43')]({},_0x578ced,_0x2036a0[_0xab5e('0x44')]);return db[_0xab5e('0x31')]['find'](_0x578ced)['then'](handleEntityNotFound(_0x4a39af,null))[_0xab5e('0x26')](respondWithResult(_0x4a39af,null))['catch'](handleError(_0x4a39af,null));};exports[_0xab5e('0x4b')]=function(_0x117bc9,_0x5268d5){return db[_0xab5e('0x31')][_0xab5e('0x4b')](_0x117bc9['body'],{})['then'](function(_0x129e37){var _0x507930=_0x117bc9['user'][_0xab5e('0x27')]({'plain':!![]});if(!_0x507930)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x507930['role']==='user'){var _0x27093a=_0x129e37[_0xab5e('0x27')]({'plain':!![]});var _0x75c93=_0xab5e('0x28');return db[_0xab5e('0x4c')]['find']({'where':{'name':_0x75c93,'userProfileId':_0x507930[_0xab5e('0x4d')]},'raw':!![]})[_0xab5e('0x26')](function(_0x174ba6){if(_0x174ba6&&_0x174ba6[_0xab5e('0x4e')]===0x0){return db[_0xab5e('0x29')]['create']({'name':_0x27093a[_0xab5e('0x2d')],'resourceId':_0x27093a['id'],'type':_0x174ba6[_0xab5e('0x2d')],'sectionId':_0x174ba6['id']},{})[_0xab5e('0x26')](function(){return _0x129e37;});}else{return _0x129e37;}})[_0xab5e('0x49')](function(_0x420b52){logger[_0xab5e('0x2b')](_0xab5e('0x4f'),_0x420b52);throw _0x420b52;});}return _0x129e37;})[_0xab5e('0x26')](respondWithResult(_0x5268d5,0xc9))[_0xab5e('0x49')](handleError(_0x5268d5,null));};exports['update']=function(_0x32f549,_0x2509ba){if(_0x32f549[_0xab5e('0x50')]['id']){delete _0x32f549['body']['id'];}return db[_0xab5e('0x31')][_0xab5e('0x51')]({'where':{'id':_0x32f549[_0xab5e('0x52')]['id']}})[_0xab5e('0x26')](handleEntityNotFound(_0x2509ba,null))[_0xab5e('0x26')](saveUpdates(_0x32f549[_0xab5e('0x50')],null))['then'](respondWithResult(_0x2509ba,null))[_0xab5e('0x49')](handleError(_0x2509ba,null));};exports[_0xab5e('0x25')]=function(_0x19b400,_0x3700d9){return db[_0xab5e('0x31')][_0xab5e('0x51')]({'where':{'id':_0x19b400[_0xab5e('0x52')]['id']}})[_0xab5e('0x26')](handleEntityNotFound(_0x3700d9,null))[_0xab5e('0x26')](removeEntity(_0x3700d9,null))[_0xab5e('0x49')](handleError(_0x3700d9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a9edbe3..9c7d769 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3e2e82,_0x369bbe){_0x3e2e82=_0x3e2e82-0x0;var _0xba15aa=_0x7fbe[_0x3e2e82];return _0xba15aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 2ac9e1b..38beb94 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5931c2,_0x35062e){var _0x173cda=function(_0x2c94d4){while(--_0x2c94d4){_0x5931c2['push'](_0x5931c2['shift']());}};_0x173cda(++_0x35062e);}(_0x7a54,0x106));var _0x47a5=function(_0x3ff024,_0x32086a){_0x3ff024=_0x3ff024-0x0;var _0x14a507=_0x7a54[_0x3ff024];return _0x14a507;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x6024a,_0x3c4a99){var _0x4461b4=function(_0x653986){while(--_0x653986){_0x6024a['push'](_0x6024a['shift']());}};_0x4461b4(++_0x3c4a99);}(_0xb10b,0x12a));var _0xbb10=function(_0x5305f2,_0x180334){_0x5305f2=_0x5305f2-0x0;var _0x59a8f7=_0xb10b[_0x5305f2];return _0x59a8f7;};'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 08ecc7a..75344a6 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 _0x84ab=['show','/:id/download','isAuthenticated','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','/webhook','/:id'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x84ab,0x12f));var _0xb84a=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x84ab[_0x1e05c1];return _0x15f1ca;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),controller['webhookGet']);router[_0xb84a('0x9')](_0xb84a('0xb'),auth['isAuthenticated'](),controller[_0xb84a('0xc')]);router['get'](_0xb84a('0xd'),auth[_0xb84a('0xe')](),controller[_0xb84a('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a34f7,_0x591de9,_0x1e0180){_0x1e0180(null,path[_0xb84a('0x10')](config[_0xb84a('0x11')],_0xb84a('0x12')));},'filename':function(_0x1ed9ae,_0x4d3758,_0x83444e){_0x4d3758[_0xb84a('0x13')]=_0x4d3758[_0xb84a('0x13')][_0xb84a('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x83444e(null,util[_0xb84a('0x15')](_0xb84a('0x16'),path[_0xb84a('0x17')](_0x4d3758[_0xb84a('0x13')],path[_0xb84a('0x18')](_0x4d3758[_0xb84a('0x13')])),Date[_0xb84a('0x19')](),path[_0xb84a('0x18')](_0x4d3758['originalname'])));}})});router[_0xb84a('0x1a')]('/',upload[_0xb84a('0x1b')](_0xb84a('0x1c')),controller[_0xb84a('0x1d')]);router[_0xb84a('0x1a')](_0xb84a('0xa'),controller[_0xb84a('0x1e')]);router[_0xb84a('0x1f')](_0xb84a('0xb'),auth[_0xb84a('0xe')](),controller[_0xb84a('0x20')]);router[_0xb84a('0x21')](_0xb84a('0xb'),auth[_0xb84a('0xe')](),controller['delete']);module[_0xb84a('0x22')]=router; \ No newline at end of file +var _0x0b78=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','index','/webhook','webhookGet','get','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','isAuthenticated','update','delete','exports'];(function(_0x5d3eed,_0x440742){var _0x2955f3=function(_0x27b00d){while(--_0x27b00d){_0x5d3eed['push'](_0x5d3eed['shift']());}};_0x2955f3(++_0x440742);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),controller[_0x80b7('0xa')]);router[_0x80b7('0xb')](_0x80b7('0xc'),auth['isAuthenticated'](),controller[_0x80b7('0xd')]);router[_0x80b7('0xb')](_0x80b7('0xe'),auth['isAuthenticated'](),controller[_0x80b7('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b1a00,_0x4599c1,_0x3b19da){_0x3b19da(null,path[_0x80b7('0x10')](config[_0x80b7('0x11')],_0x80b7('0x12')));},'filename':function(_0x3f8c16,_0x145241,_0x323d06){_0x145241[_0x80b7('0x13')]=_0x145241[_0x80b7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d06(null,util[_0x80b7('0x14')](_0x80b7('0x15'),path['basename'](_0x145241[_0x80b7('0x13')],path[_0x80b7('0x16')](_0x145241['originalname'])),Date[_0x80b7('0x17')](),path[_0x80b7('0x16')](_0x145241[_0x80b7('0x13')])));}})});router[_0x80b7('0x18')]('/',upload[_0x80b7('0x19')](_0x80b7('0x1a')),controller[_0x80b7('0x1b')]);router[_0x80b7('0x18')](_0x80b7('0x9'),controller[_0x80b7('0x1c')]);router['put'](_0x80b7('0xc'),auth[_0x80b7('0x1d')](),controller[_0x80b7('0x1e')]);router[_0x80b7('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x80b7('0x1f')]);module[_0x80b7('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 7f2a300..a2ce752 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 _0xd515=['adminOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM'];(function(_0x1f1a45,_0xe4ea78){var _0x3f91=function(_0x5cb827){while(--_0x5cb827){_0x1f1a45['push'](_0x1f1a45['shift']());}};_0x3f91(++_0xe4ea78);}(_0xd515,0x1cb));var _0x5d51=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xd515[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x5d51('0x0'));module[_0x5d51('0x1')]={'name':{'type':Sequelize[_0x5d51('0x2')]},'type':{'type':Sequelize['ENUM'](_0x5d51('0x3'),_0x5d51('0x4'))},'description':{'type':Sequelize[_0x5d51('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5d51('0x2')],'comment':_0x5d51('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5d51('0x7')},'sidebar':{'type':Sequelize[_0x5d51('0x8')](_0x5d51('0x9'),'agentOnly','always',_0x5d51('0xa')),'defaultValue':_0x5d51('0xb'),'comment':_0x5d51('0xc')},'icon':{'type':Sequelize[_0x5d51('0x2')]},'adminUrl':{'type':Sequelize[_0x5d51('0x2')]},'agentUrl':{'type':Sequelize[_0x5d51('0x2')]},'scriptName':{'type':Sequelize[_0x5d51('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17ae=['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.','STRING','ENUM','html','script','BOOLEAN'];(function(_0xecd65e,_0x2485a5){var _0x3d42fa=function(_0xb8acc1){while(--_0xb8acc1){_0xecd65e['push'](_0xecd65e['shift']());}};_0x3d42fa(++_0x2485a5);}(_0x17ae,0x166));var _0xe17a=function(_0x35c05a,_0x41cf2c){_0x35c05a=_0x35c05a-0x0;var _0x361b18=_0x17ae[_0x35c05a];return _0x361b18;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe17a('0x0')]},'type':{'type':Sequelize[_0xe17a('0x1')](_0xe17a('0x2'),_0xe17a('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xe17a('0x4')],'defaultValue':0x0,'comment':_0xe17a('0x5')},'sidebar':{'type':Sequelize[_0xe17a('0x1')](_0xe17a('0x6'),_0xe17a('0x7'),_0xe17a('0x8'),_0xe17a('0x9')),'defaultValue':'always','comment':_0xe17a('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xe17a('0x0')]},'agentUrl':{'type':Sequelize[_0xe17a('0x0')]},'scriptName':{'type':Sequelize[_0xe17a('0x0')]},'scriptPath':{'type':Sequelize[_0xe17a('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f63a969..9703377 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 _0x53e3=['pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','catch','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','Plugins','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','rows','show','params','include','options','find','download','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive'];(function(_0x442ccd,_0x415d61){var _0x1a2c10=function(_0x4ddd45){while(--_0x4ddd45){_0x442ccd['push'](_0x442ccd['shift']());}};_0x1a2c10(++_0x415d61);}(_0x53e3,0x1ab));var _0x353e=function(_0x3d820e,_0x5d557e){_0x3d820e=_0x3d820e-0x0;var _0x2a3333=_0x53e3[_0x3d820e];return _0x2a3333;};'use strict';var emlformat=require(_0x353e('0x0'));var rimraf=require(_0x353e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x353e('0x2'));var rp=require(_0x353e('0x3'));var moment=require(_0x353e('0x4'));var BPromise=require(_0x353e('0x5'));var Mustache=require(_0x353e('0x6'));var util=require(_0x353e('0x7'));var path=require(_0x353e('0x8'));var sox=require(_0x353e('0x9'));var csv=require(_0x353e('0xa'));var ejs=require(_0x353e('0xb'));var fs=require('fs');var fs_extra=require(_0x353e('0xc'));var _=require('lodash');var squel=require(_0x353e('0xd'));var crypto=require(_0x353e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x353e('0xf'));var toCsv=require(_0x353e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x353e('0x10'));var rimraf=require(_0x353e('0x1'));var archiver=require(_0x353e('0x11'));var Redis=require(_0x353e('0x12'));var authService=require(_0x353e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x353e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x353e('0x15'))(_0x353e('0x16'));var utils=require(_0x353e('0x17'));var config=require(_0x353e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x353e('0x19'))['db'];config[_0x353e('0x1a')]=_[_0x353e('0x1b')](config[_0x353e('0x1a')],{'host':_0x353e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x353e('0x1a')]));require(_0x353e('0x1d'))[_0x353e('0x1e')](socket);function respondWithStatusCode(_0x57bfd3,_0x4416eb){_0x4416eb=_0x4416eb||0xcc;return function(_0x3f51e8){if(_0x3f51e8){return _0x57bfd3[_0x353e('0x1f')](_0x4416eb);}return _0x57bfd3[_0x353e('0x20')](_0x4416eb)[_0x353e('0x21')]();};}function respondWithResult(_0x50c46f,_0x51e9eb){_0x51e9eb=_0x51e9eb||0xc8;return function(_0x36d101){if(_0x36d101){return _0x50c46f[_0x353e('0x20')](_0x51e9eb)[_0x353e('0x22')](_0x36d101);}};}function respondWithFilteredResult(_0x1acf92,_0xa0535b){return function(_0x51cfde){if(_0x51cfde){var _0x934b5c=typeof _0xa0535b[_0x353e('0x23')]==='undefined'&&typeof _0xa0535b[_0x353e('0x24')]===_0x353e('0x25');var _0x3a8c38=_0x51cfde[_0x353e('0x26')];var _0x10dd6c=_0x934b5c?0x0:_0xa0535b['offset'];var _0x31144f=_0x934b5c?_0x51cfde['count']:_0xa0535b[_0x353e('0x23')]+_0xa0535b[_0x353e('0x24')];var _0xa0b8aa;if(_0x31144f>=_0x3a8c38){_0x31144f=_0x3a8c38;_0xa0b8aa=0xc8;}else{_0xa0b8aa=0xce;}_0x1acf92['status'](_0xa0b8aa);return _0x1acf92['set'](_0x353e('0x27'),_0x10dd6c+'-'+_0x31144f+'/'+_0x3a8c38)[_0x353e('0x22')](_0x51cfde);}return null;};}function patchUpdates(_0x207778){return function(_0x5018f3){try{jsonpatch[_0x353e('0x28')](_0x5018f3,_0x207778,!![]);}catch(_0x4a8fc1){return BPromise[_0x353e('0x29')](_0x4a8fc1);}return _0x5018f3[_0x353e('0x2a')]();};}function saveUpdates(_0x3eeb60,_0x1372d7){return function(_0x40ae4f){if(_0x40ae4f){return _0x40ae4f['update'](_0x3eeb60)[_0x353e('0x2b')](function(_0x4ddd6f){return _0x4ddd6f;});}return null;};}function removeEntity(_0x3ff549,_0x2255a4){return function(_0x246a50){if(_0x246a50){return _0x246a50[_0x353e('0x2c')]()[_0x353e('0x2b')](function(){var _0x3bf420=_0x246a50[_0x353e('0x2d')]({'plain':!![]});var _0x29312e=_0x353e('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x29312e,'resourceId':_0x3bf420['id']}})['then'](function(){return _0x246a50;});})[_0x353e('0x2b')](function(){_0x3ff549[_0x353e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0abc,_0x41a35b){return function(_0x63df9c){if(!_0x63df9c){_0x3d0abc[_0x353e('0x1f')](0x194);}return _0x63df9c;};}function handleError(_0x166e1d,_0x890c70){_0x890c70=_0x890c70||0x1f4;return function(_0x1b1f38){logger[_0x353e('0x2f')](_0x1b1f38[_0x353e('0x30')]);if(_0x1b1f38['name']){delete _0x1b1f38[_0x353e('0x31')];}_0x166e1d[_0x353e('0x20')](_0x890c70)[_0x353e('0x32')](_0x1b1f38);};}exports[_0x353e('0x33')]=function(_0x1ab667,_0xfc2f5b){var _0x48efaf={},_0x951f4b={},_0x26a4d2={'count':0x0,'rows':[]};var _0x4d0415=_['map'](db[_0x353e('0x34')][_0x353e('0x35')],function(_0x3d40cb){return{'name':_0x3d40cb[_0x353e('0x36')],'type':_0x3d40cb[_0x353e('0x37')][_0x353e('0x38')]};});_0x951f4b[_0x353e('0x39')]=_[_0x353e('0x3a')](_0x4d0415,_0x353e('0x31'));_0x951f4b['query']=_[_0x353e('0x3b')](_0x1ab667[_0x353e('0x3c')]);_0x951f4b['filters']=_[_0x353e('0x3d')](_0x951f4b[_0x353e('0x39')],_0x951f4b[_0x353e('0x3c')]);_0x48efaf['attributes']=_[_0x353e('0x3d')](_0x951f4b[_0x353e('0x39')],qs[_0x353e('0x3e')](_0x1ab667['query'][_0x353e('0x3e')]));_0x48efaf[_0x353e('0x3f')]=_0x48efaf['attributes'][_0x353e('0x40')]?_0x48efaf[_0x353e('0x3f')]:_0x951f4b[_0x353e('0x39')];if(!_0x1ab667[_0x353e('0x3c')]['hasOwnProperty'](_0x353e('0x41'))){_0x48efaf[_0x353e('0x24')]=qs[_0x353e('0x24')](_0x1ab667[_0x353e('0x3c')][_0x353e('0x24')]);_0x48efaf[_0x353e('0x23')]=qs[_0x353e('0x23')](_0x1ab667[_0x353e('0x3c')][_0x353e('0x23')]);}_0x48efaf[_0x353e('0x42')]=qs[_0x353e('0x43')](_0x1ab667[_0x353e('0x3c')][_0x353e('0x43')]);_0x48efaf[_0x353e('0x44')]=qs[_0x353e('0x45')](_['pick'](_0x1ab667[_0x353e('0x3c')],_0x951f4b['filters']),_0x4d0415);if(_0x1ab667['query'][_0x353e('0x46')]){_0x48efaf['where']=_[_0x353e('0x47')](_0x48efaf[_0x353e('0x44')],{'$or':_['map'](_0x4d0415,function(_0x5b5dfb){if(_0x5b5dfb['type']!=='VIRTUAL'){var _0x40c376={};_0x40c376[_0x5b5dfb[_0x353e('0x31')]]={'$like':'%'+_0x1ab667[_0x353e('0x3c')][_0x353e('0x46')]+'%'};return _0x40c376;}})});}_0x48efaf=_['merge']({},_0x48efaf,_0x1ab667['options']);var _0x13f8ba={'where':_0x48efaf[_0x353e('0x44')]};return db[_0x353e('0x34')][_0x353e('0x26')](_0x13f8ba)[_0x353e('0x2b')](function(_0x340c8b){_0x26a4d2[_0x353e('0x26')]=_0x340c8b;if(_0x1ab667[_0x353e('0x3c')]['includeAll']){_0x48efaf['include']=[{'all':!![]}];}return db[_0x353e('0x34')]['findAll'](_0x48efaf);})[_0x353e('0x2b')](function(_0x549917){_0x26a4d2[_0x353e('0x48')]=_0x549917;return _0x26a4d2;})[_0x353e('0x2b')](respondWithFilteredResult(_0xfc2f5b,_0x48efaf))['catch'](handleError(_0xfc2f5b,null));};exports[_0x353e('0x49')]=function(_0x219838,_0x43d2ce){var _0x36bb4f={'raw':!![],'where':{'id':_0x219838[_0x353e('0x4a')]['id']}},_0x149d13={};_0x149d13[_0x353e('0x39')]=_[_0x353e('0x3b')](db['Plugin'][_0x353e('0x35')]);_0x149d13[_0x353e('0x3c')]=_[_0x353e('0x3b')](_0x219838[_0x353e('0x3c')]);_0x149d13[_0x353e('0x45')]=_[_0x353e('0x3d')](_0x149d13['model'],_0x149d13[_0x353e('0x3c')]);_0x36bb4f[_0x353e('0x3f')]=_[_0x353e('0x3d')](_0x149d13['model'],qs[_0x353e('0x3e')](_0x219838[_0x353e('0x3c')][_0x353e('0x3e')]));_0x36bb4f[_0x353e('0x3f')]=_0x36bb4f[_0x353e('0x3f')][_0x353e('0x40')]?_0x36bb4f[_0x353e('0x3f')]:_0x149d13['model'];if(_0x219838[_0x353e('0x3c')]['includeAll']){_0x36bb4f[_0x353e('0x4b')]=[{'all':!![]}];}_0x36bb4f=_['merge']({},_0x36bb4f,_0x219838[_0x353e('0x4c')]);return db[_0x353e('0x34')][_0x353e('0x4d')](_0x36bb4f)[_0x353e('0x2b')](handleEntityNotFound(_0x43d2ce,null))['then'](respondWithResult(_0x43d2ce,null))['catch'](handleError(_0x43d2ce,null));};exports[_0x353e('0x4e')]=function(_0x507513,_0x21aee6,_0x5b073f){return db['Plugin']['find']({'where':{'id':_0x507513['params']['id']},'attributes':[_0x353e('0x31'),_0x353e('0x8')],'raw':!![]})[_0x353e('0x2b')](handleEntityNotFound(_0x21aee6,null))[_0x353e('0x2b')](function(_0x63e0f2){if(_0x63e0f2){var _0x2a7af1=path[_0x353e('0x4f')](config[_0x353e('0x50')],'server/files/plugins',util[_0x353e('0x51')](_0x353e('0x52'),path[_0x353e('0x53')](_0x63e0f2[_0x353e('0x8')])));var _0xe448bb=fs[_0x353e('0x54')](_0x2a7af1);var _0x3b0dde=archiver(_0x353e('0x55'),{'zlib':{'level':0x9}});_0x3b0dde['on'](_0x353e('0x56'),function(_0x358565){if(_0x358565[_0x353e('0x57')]===_0x353e('0x58')){logger[_0x353e('0x2f')](_0x358565);}else{throw new db[(_0x353e('0x59'))][(_0x353e('0x5a'))](_0x353e('0x5b'));}});_0x3b0dde['on']('error',function(_0x3636c9){throw new db['Sequelize'][(_0x353e('0x5a'))](_0x353e('0x5b'));});_0x3b0dde[_0x353e('0x5c')](_0xe448bb);_0x3b0dde[_0x353e('0x5d')](_0x353e('0x5e'),{'cwd':path[_0x353e('0x4f')](config[_0x353e('0x50')],_0x353e('0x5f'),path[_0x353e('0x60')](_0x63e0f2['path'])),'ignore':[path[_0x353e('0x4f')](path[_0x353e('0x53')](_0x63e0f2[_0x353e('0x8')]),_0x353e('0x61')),path[_0x353e('0x4f')](path[_0x353e('0x53')](_0x63e0f2[_0x353e('0x8')]),_0x353e('0x62'))],'nodir':!![]})[_0x353e('0x63')]();_0xe448bb['on'](_0x353e('0x64'),function(){if(!fs['existsSync'](_0x2a7af1)){throw new db[(_0x353e('0x59'))][(_0x353e('0x5a'))](_0x353e('0x65'));}return _0x21aee6['download'](_0x2a7af1,util[_0x353e('0x51')](_0x353e('0x52'),path[_0x353e('0x53')](_0x63e0f2['path'])),function(_0x2e2453){if(_0x2e2453){throw new db['Sequelize'][(_0x353e('0x5a'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x353e('0x66')](_0x2a7af1);logger[_0x353e('0x67')](_0x353e('0x68'));logger[_0x353e('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0x353e('0x69')](handleError(_0x21aee6,null));};exports[_0x353e('0x6a')]=function(_0x53c128,_0x262ebe,_0x49d6e9){var _0xc109ec=path[_0x353e('0x53')](_0x53c128[_0x353e('0x6b')][_0x353e('0x6c')],path[_0x353e('0x6d')](_0x53c128[_0x353e('0x6b')][_0x353e('0x6c')]));var _0x23623f=path[_0x353e('0x4f')](config['root'],_0x353e('0x5f'),_0x53c128[_0x353e('0x6b')][_0x353e('0x6c')]);var _0x461050=path[_0x353e('0x4f')](config[_0x353e('0x50')],_0x353e('0x5f'),_0xc109ec);logger[_0x353e('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x23623f);logger[_0x353e('0x67')](_0x353e('0x6e'),_0x461050);try{fs[_0x353e('0x6f')](_0x23623f,parseInt('0777',0x8));extract(_0x23623f,{'dir':_0x461050},function(_0x5d9e07){if(_0x5d9e07){logger['error'](_0x5d9e07);handleError(_0x5d9e07,!![]);};var _0xc318cb=fs[_0x353e('0x70')](_0x461050);if(_0xc318cb[_0x353e('0x40')]>0x1){removeReferences(_0x23623f,_0x461050);logger['error'](_0x353e('0x71'));return _0x49d6e9(new Error(_0x353e('0x71')));}var _0x20cfc2=fs['lstatSync'](path['join'](_0x461050,_0xc318cb[0x0]));if(_0x20cfc2[_0x353e('0x72')]()){removeReferences(_0x23623f,_0x461050);logger[_0x353e('0x2f')]('Invalid\x20plugin\x20structure');return _0x49d6e9(new Error(_0x353e('0x71')));}if(_0x20cfc2['isDirectory']()){var _0x2a8dae=fs[_0x353e('0x70')](path[_0x353e('0x4f')](_0x461050,_0xc318cb[0x0]));if(_0x2a8dae[_0x353e('0x40')]===0x0){removeReferences(_0x23623f,_0x461050);logger[_0x353e('0x2f')](_0x353e('0x71'));return _0x49d6e9(new Error(_0x353e('0x71')));}var _0x4b637=_0x2a8dae[_0x353e('0x73')](function(_0x4d18e7){return _0x4d18e7===_0x353e('0x74');});if(!_0x4b637){return _0x49d6e9(new Error(_0x353e('0x75')));}var _0x27319a=fs[_0x353e('0x76')](path['join'](_0x461050,_0xc318cb[0x0],_0x353e('0x74')));var _0xb44106=JSON[_0x353e('0x77')](_0x27319a);if(_0x353e('0x25')==typeof _0xb44106[_0x353e('0x31')]){return _0x49d6e9(new Error(_0x353e('0x78')));}if(_0x353e('0x25')==typeof _0xb44106[_0x353e('0x37')]){return _0x49d6e9(new Error(_0x353e('0x79')));}if(_0x353e('0x25')==typeof _0xb44106['version']){return _0x49d6e9(new Error(_0x353e('0x7a')));}if('undefined'==typeof _0xb44106['parameters']){return _0x49d6e9(new Error(_0x353e('0x7b')));}if(_0xb44106[_0x353e('0x37')]===_0x353e('0x7c')){if(_0x353e('0x25')==typeof _0xb44106[_0x353e('0x7d')][_0x353e('0x7e')]){return _0x49d6e9(new Error(_0x353e('0x7f')));}if(_0x353e('0x25')==typeof _0xb44106[_0x353e('0x7d')][_0x353e('0x7e')]['admin']&&'undefined'==typeof _0xb44106[_0x353e('0x7d')][_0x353e('0x7e')]['agent']){return _0x49d6e9(new Error(_0x353e('0x80')));}}else if(_0xb44106[_0x353e('0x37')]===_0x353e('0x81')){if(_0x353e('0x25')==typeof _0xb44106[_0x353e('0x7d')][_0x353e('0x82')]){return _0x49d6e9(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0xb44106[_0x353e('0x7d')]['scriptPath']){return _0x49d6e9(new Error(_0x353e('0x83')));}}else{return _0x49d6e9(new Error(_0x353e('0x84')));}var _0x2129fc=_0xb44106['name'];var _0x3e4d12=_0xb44106[_0x353e('0x85')];var _0xa9b6f9=_0xb44106['type'];var _0x55f567=_0xb44106[_0x353e('0x86')]?_0xb44106[_0x353e('0x86')]:_0x353e('0x87');var _0x20d2a4=_0xb44106[_0x353e('0x88')]?_0xb44106[_0x353e('0x88')]:_0x353e('0x89');var _0x2a5b71='';var _0x48bdba='';var _0x1eb0d2='';var _0x5c8bdf='';var _0x270421=_0xb44106[_0x353e('0x8a')];if(_0xa9b6f9==='html'){if(_0x353e('0x25')!=typeof _0xb44106['parameters'][_0x353e('0x7e')][_0x353e('0x8b')]){var _0x23989d=_0xb44106[_0x353e('0x7d')][_0x353e('0x7e')][_0x353e('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x353e('0x8c')](_0x23989d)){_0x2a5b71=path[_0x353e('0x4f')](_0x353e('0x8d'),_0xc109ec,_0xc318cb[0x0],_0x23989d);}else{_0x2a5b71=_0x23989d;}}else{logger['info'](_0x353e('0x8e'));}if(_0x353e('0x25')!=typeof _0xb44106['parameters']['views']['agent']){var _0x1c2829=_0xb44106[_0x353e('0x7d')][_0x353e('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x353e('0x8c')](_0x1c2829)){_0x48bdba=path[_0x353e('0x4f')](_0x353e('0x8d'),_0xc109ec,_0xc318cb[0x0],_0x1c2829);}else{_0x48bdba=_0x1c2829;}}else{logger[_0x353e('0x67')](_0x353e('0x8f'));}}else if(_0xa9b6f9===_0x353e('0x81')){_0x1eb0d2=_0xb44106[_0x353e('0x7d')][_0x353e('0x82')];_0x5c8bdf=_0xb44106[_0x353e('0x7d')]['scriptPath'];if(_0x353e('0x25')!=typeof _0xb44106[_0x353e('0x7d')][_0x353e('0x7e')]){if(_0x353e('0x25')!=typeof _0xb44106[_0x353e('0x7d')][_0x353e('0x7e')]['admin']){var _0x23989d=_0xb44106[_0x353e('0x7d')][_0x353e('0x7e')][_0x353e('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x353e('0x8c')](_0x23989d)){_0x2a5b71=path['join'](_0x353e('0x8d'),_0xc109ec,_0xc318cb[0x0],_0x23989d);}else{_0x2a5b71=_0x23989d;}}if(_0x353e('0x25')!=typeof _0xb44106[_0x353e('0x7d')]['views'][_0x353e('0x90')]){var _0x1c2829=_0xb44106[_0x353e('0x7d')][_0x353e('0x7e')][_0x353e('0x90')];if(!/^(f|ht)tps?:\/\//i[_0x353e('0x8c')](_0x1c2829)){_0x48bdba=path[_0x353e('0x4f')](_0x353e('0x8d'),_0xc109ec,_0xc318cb[0x0],_0x1c2829);}else{_0x48bdba=_0x1c2829;}}}}var _0x38a4f2={'name':_0x2129fc,'description':_0x3e4d12,'path':path[_0x353e('0x4f')](_0xc109ec,_0xc318cb[0x0]),'type':_0xa9b6f9,'sidebar':_0x55f567,'icon':_0x20d2a4,'adminUrl':_0x2a5b71,'agentUrl':_0x48bdba,'scriptName':_0x1eb0d2,'scriptPath':_0x5c8bdf,'version':_0x270421};removeReferences(_0x23623f,null);return db[_0x353e('0x34')][_0x353e('0x91')](_0x38a4f2)['then'](function(_0x1fb3da){var _0x37f670={'role':_0x53c128[_0x353e('0x92')]['role'],'userProfileId':_0x53c128[_0x353e('0x92')][_0x353e('0x93')]};if(!_0x37f670)throw new Error(_0x353e('0x94'));if(_0x37f670[_0x353e('0x95')]===_0x353e('0x96')){var _0x2114c3=_0x1fb3da['get']({'plain':!![]});return db[_0x353e('0x97')][_0x353e('0x4d')]({'where':{'name':_0x353e('0x2e'),'userProfileId':_0x37f670[_0x353e('0x93')]},'raw':!![]})['then'](function(_0x1ff8c1){if(_0x1ff8c1&&_0x1ff8c1[_0x353e('0x98')]===0x0){return db['UserProfileResource'][_0x353e('0x91')]({'name':_0x2114c3[_0x353e('0x31')],'resourceId':_0x2114c3['id'],'type':_0x1ff8c1[_0x353e('0x31')],'sectionId':_0x1ff8c1['id']},{})[_0x353e('0x2b')](function(){return _0x1fb3da;});}else{return _0x1fb3da;}})[_0x353e('0x69')](function(_0x175181){logger[_0x353e('0x2f')](_0x353e('0x99'),_0x175181);throw _0x175181;});}return _0x1fb3da;})[_0x353e('0x2b')](respondWithResult(_0x262ebe,null))[_0x353e('0x69')](handleError(_0x262ebe,null));}});}catch(_0x23c935){_0x262ebe[_0x353e('0x20')](0x1f4)[_0x353e('0x32')](_0x23c935);}};function removeReferences(_0xf4e33b,_0x4bc15c){try{if(_0xf4e33b){fs['unlinkSync'](_0xf4e33b);logger['info'](_0x353e('0x9a'));}if(_0x4bc15c){rimraf(_0x4bc15c,function(){});logger['info'](_0x353e('0x9b'));}}catch(_0x1aed38){logger[_0x353e('0x2f')](_0x1aed38);}}exports[_0x353e('0x9c')]=function(_0x49fcad,_0x570355,_0x418049){return db[_0x353e('0x34')][_0x353e('0x4d')]({'where':{'id':_0x49fcad[_0x353e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x570355,null))[_0x353e('0x2b')](saveUpdates(_0x49fcad[_0x353e('0x92')],null))['then'](respondWithResult(_0x570355,null))[_0x353e('0x69')](handleError(_0x570355,null));};exports[_0x353e('0x9d')]=function(_0x4e7e1e,_0xe612e9,_0x111e60){return db[_0x353e('0x34')][_0x353e('0x4d')]({'where':{'id':_0x4e7e1e[_0x353e('0x4a')]['id']}})['then'](function(_0x3306ba){if(_0x3306ba){return _0x3306ba[_0x353e('0x2c')]();}})[_0x353e('0x2b')](function(_0x816ce6){rimraf(path[_0x353e('0x4f')](config[_0x353e('0x50')],_0x353e('0x5f'),path[_0x353e('0x60')](_0x816ce6['path'])),function(){});return _0x816ce6;})['then'](handleEntityNotFound(_0xe612e9,null))[_0x353e('0x2b')](respondWithStatusCode(_0xe612e9,null))['catch'](handleError(_0xe612e9,null));};exports[_0x353e('0x9e')]=function(_0x400d92,_0x1ce39c,_0x1ea811){return BPromise[_0x353e('0x9f')]()['then'](function(){if(!_0x400d92[_0x353e('0x3c')][_0x353e('0x8')]){throw new Error(_0x353e('0xa0'));}if(!_0x400d92['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3c98ba=_0x400d92['query'][_0x353e('0xa1')]?_0x400d92['query'][_0x353e('0xa1')]+':'+_0x400d92[_0x353e('0x3c')][_0x353e('0xa2')]:'http://localhost:'+_0x400d92[_0x353e('0x3c')][_0x353e('0xa2')];var _0x53ce72=_0x400d92[_0x353e('0x3c')][_0x353e('0x22')]?_0x400d92[_0x353e('0x3c')]['json']:!![];var _0x7940b4=_0x400d92['query']['encoding']?_0x400d92[_0x353e('0x3c')][_0x353e('0xa3')]:null;var _0x31d8bd={'method':_0x400d92[_0x353e('0xa4')],'uri':util[_0x353e('0x51')](_0x353e('0xa5'),_0x3c98ba,_0x400d92[_0x353e('0x3c')]['path']),'json':_0x53ce72,'resolveWithFullResponse':!![],'encoding':_0x7940b4,'qs':_0x400d92[_0x353e('0x3c')]};if(_0x400d92[_0x353e('0xa6')]){_0x31d8bd[_0x353e('0xa6')]=_0x400d92[_0x353e('0xa6')];if(_0x31d8bd[_0x353e('0xa6')][_0x353e('0xa7')]){delete _0x31d8bd[_0x353e('0xa6')][_0x353e('0xa7')];}}if(_0x31d8bd['headers']['content-type']){delete _0x31d8bd['headers'][_0x353e('0xa8')];}return rp(_0x31d8bd);})[_0x353e('0x2b')](function(_0x11a749){if(_0x11a749){_0x1ce39c[_0x353e('0xa9')](_0x11a749[_0x353e('0xa6')]);logger[_0x353e('0x67')](_0x11a749[_0x353e('0x92')]);if(_[_0x353e('0xaa')](_0x400d92[_0x353e('0x3c')][_0x353e('0x8')],_0x353e('0x4e'))&&_0x11a749[_0x353e('0xab')]==0x1f4){return _0x1ce39c[_0x353e('0x1f')](_0x11a749[_0x353e('0xab')]);}else{return _0x1ce39c[_0x353e('0x20')](_0x11a749[_0x353e('0xab')])['send'](_0x11a749[_0x353e('0x92')]);}}else{return _0x1ce39c[_0x353e('0x1f')](0xc8);}})[_0x353e('0x69')](handleError(_0x1ce39c,null));};exports[_0x353e('0xac')]=function(_0x418c2,_0x147078,_0x58333b){return BPromise[_0x353e('0x9f')]()[_0x353e('0x2b')](function(){if(!_0x418c2[_0x353e('0x3c')][_0x353e('0x8')]){throw new Error(_0x353e('0xa0'));}if(!_0x418c2[_0x353e('0x3c')][_0x353e('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x24883c=_0x418c2[_0x353e('0x3c')][_0x353e('0xa1')]?_0x418c2['query'][_0x353e('0xa1')]+':'+_0x418c2[_0x353e('0x3c')][_0x353e('0xa2')]:'http://localhost:'+_0x418c2[_0x353e('0x3c')]['port'];var _0x417e3f=_0x418c2[_0x353e('0x3c')]['json']?_0x418c2['query']['json']:!![];var _0x2da347=_0x418c2[_0x353e('0x3c')][_0x353e('0xa3')]?_0x418c2['query'][_0x353e('0xa3')]:null;var _0x29cbd0={'method':_0x418c2['method'],'uri':util[_0x353e('0x51')](_0x353e('0xa5'),_0x24883c,_0x418c2[_0x353e('0x3c')]['path']),'json':_0x417e3f,'resolveWithFullResponse':!![],'encoding':_0x2da347,'body':_0x418c2[_0x353e('0x92')]};if(_0x418c2[_0x353e('0xa6')]){_0x29cbd0[_0x353e('0xa6')]=_0x418c2[_0x353e('0xa6')];if(_0x29cbd0[_0x353e('0xa6')][_0x353e('0xa7')]){delete _0x29cbd0[_0x353e('0xa6')][_0x353e('0xa7')];}}if(_0x29cbd0[_0x353e('0xa6')][_0x353e('0xa8')]){delete _0x29cbd0[_0x353e('0xa6')][_0x353e('0xa8')];}return rp(_0x29cbd0);})[_0x353e('0x2b')](function(_0x38ec0b){if(_0x38ec0b){_0x147078[_0x353e('0xa9')](_0x38ec0b[_0x353e('0xa6')]);logger[_0x353e('0x67')](_0x38ec0b['body']);return _0x147078['status'](_0x38ec0b[_0x353e('0xab')])[_0x353e('0x32')](_0x38ec0b[_0x353e('0x92')]);}else{return _0x147078['sendStatus'](0xc8);}})['catch'](handleError(_0x147078,null));}; \ No newline at end of file +var _0x97e5=['warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptName','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','headers','content-length','content-type','endsWith','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','rimraf','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','index','map','Plugin','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','join','root','server/files/plugins','%s.zip','basename'];(function(_0x29a109,_0x1332bc){var _0x51406d=function(_0x3af15f){while(--_0x3af15f){_0x29a109['push'](_0x29a109['shift']());}};_0x51406d(++_0x1332bc);}(_0x97e5,0xfb));var _0x597e=function(_0x4f957f,_0x2b171c){_0x4f957f=_0x4f957f-0x0;var _0x4cab94=_0x97e5[_0x4f957f];return _0x4cab94;};'use strict';var emlformat=require(_0x597e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x597e('0x1'));var rp=require(_0x597e('0x2'));var moment=require(_0x597e('0x3'));var BPromise=require(_0x597e('0x4'));var Mustache=require(_0x597e('0x5'));var util=require('util');var path=require(_0x597e('0x6'));var sox=require('sox');var csv=require(_0x597e('0x7'));var ejs=require(_0x597e('0x8'));var fs=require('fs');var fs_extra=require(_0x597e('0x9'));var _=require('lodash');var squel=require(_0x597e('0xa'));var crypto=require(_0x597e('0xb'));var jsforce=require(_0x597e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x597e('0x7'));var querystring=require(_0x597e('0xd'));var Papa=require(_0x597e('0xe'));var extract=require('extract-zip');var rimraf=require(_0x597e('0xf'));var archiver=require(_0x597e('0x10'));var Redis=require(_0x597e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x597e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x597e('0x13'));var logger=require(_0x597e('0x14'))(_0x597e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x597e('0x16'))['db'];config[_0x597e('0x17')]=_[_0x597e('0x18')](config[_0x597e('0x17')],{'host':_0x597e('0x19'),'port':0x18eb});var socket=require(_0x597e('0x1a'))(new Redis(config[_0x597e('0x17')]));require('./plugin.socket')[_0x597e('0x1b')](socket);function respondWithStatusCode(_0x33156b,_0x34cbaf){_0x34cbaf=_0x34cbaf||0xcc;return function(_0x346ee7){if(_0x346ee7){return _0x33156b[_0x597e('0x1c')](_0x34cbaf);}return _0x33156b[_0x597e('0x1d')](_0x34cbaf)[_0x597e('0x1e')]();};}function respondWithResult(_0x22a1e6,_0x43d2f0){_0x43d2f0=_0x43d2f0||0xc8;return function(_0x2998a3){if(_0x2998a3){return _0x22a1e6[_0x597e('0x1d')](_0x43d2f0)[_0x597e('0x1f')](_0x2998a3);}};}function respondWithFilteredResult(_0xa59e84,_0x427eee){return function(_0x4e3e37){if(_0x4e3e37){var _0x354105=typeof _0x427eee[_0x597e('0x20')]===_0x597e('0x21')&&typeof _0x427eee[_0x597e('0x22')]==='undefined';var _0x1fae62=_0x4e3e37[_0x597e('0x23')];var _0x5cf2a0=_0x354105?0x0:_0x427eee[_0x597e('0x20')];var _0x4dc74b=_0x354105?_0x4e3e37[_0x597e('0x23')]:_0x427eee[_0x597e('0x20')]+_0x427eee[_0x597e('0x22')];var _0x27e174;if(_0x4dc74b>=_0x1fae62){_0x4dc74b=_0x1fae62;_0x27e174=0xc8;}else{_0x27e174=0xce;}_0xa59e84['status'](_0x27e174);return _0xa59e84[_0x597e('0x24')](_0x597e('0x25'),_0x5cf2a0+'-'+_0x4dc74b+'/'+_0x1fae62)['json'](_0x4e3e37);}return null;};}function patchUpdates(_0xbd0213){return function(_0x10035b){try{jsonpatch[_0x597e('0x26')](_0x10035b,_0xbd0213,!![]);}catch(_0x2eec74){return BPromise[_0x597e('0x27')](_0x2eec74);}return _0x10035b[_0x597e('0x28')]();};}function saveUpdates(_0x305bd2,_0x5f1bf5){return function(_0x2cc8d4){if(_0x2cc8d4){return _0x2cc8d4[_0x597e('0x29')](_0x305bd2)[_0x597e('0x2a')](function(_0x48e3c9){return _0x48e3c9;});}return null;};}function removeEntity(_0x3ceb7c,_0x1f30db){return function(_0x465358){if(_0x465358){return _0x465358[_0x597e('0x2b')]()[_0x597e('0x2a')](function(){var _0x50e0bf=_0x465358[_0x597e('0x2c')]({'plain':!![]});var _0x388e6e=_0x597e('0x2d');return db[_0x597e('0x2e')]['destroy']({'where':{'type':_0x388e6e,'resourceId':_0x50e0bf['id']}})[_0x597e('0x2a')](function(){return _0x465358;});})[_0x597e('0x2a')](function(){_0x3ceb7c[_0x597e('0x1d')](0xcc)[_0x597e('0x1e')]();});}};}function handleEntityNotFound(_0x13e592,_0x267ea9){return function(_0x4a50b5){if(!_0x4a50b5){_0x13e592[_0x597e('0x1c')](0x194);}return _0x4a50b5;};}function handleError(_0x54f7a3,_0xdd40dd){_0xdd40dd=_0xdd40dd||0x1f4;return function(_0x33c011){logger[_0x597e('0x2f')](_0x33c011[_0x597e('0x30')]);if(_0x33c011['name']){delete _0x33c011[_0x597e('0x31')];}_0x54f7a3[_0x597e('0x1d')](_0xdd40dd)['send'](_0x33c011);};}exports[_0x597e('0x32')]=function(_0x3c666d,_0x528187){var _0xe498fa={},_0x1eb8e8={},_0x561b00={'count':0x0,'rows':[]};var _0x415cf3=_[_0x597e('0x33')](db[_0x597e('0x34')][_0x597e('0x35')],function(_0x309447){return{'name':_0x309447['fieldName'],'type':_0x309447[_0x597e('0x36')][_0x597e('0x37')]};});_0x1eb8e8[_0x597e('0x38')]=_['map'](_0x415cf3,_0x597e('0x31'));_0x1eb8e8['query']=_['keys'](_0x3c666d[_0x597e('0x39')]);_0x1eb8e8['filters']=_[_0x597e('0x3a')](_0x1eb8e8[_0x597e('0x38')],_0x1eb8e8['query']);_0xe498fa[_0x597e('0x3b')]=_[_0x597e('0x3a')](_0x1eb8e8[_0x597e('0x38')],qs[_0x597e('0x3c')](_0x3c666d['query'][_0x597e('0x3c')]));_0xe498fa[_0x597e('0x3b')]=_0xe498fa[_0x597e('0x3b')]['length']?_0xe498fa[_0x597e('0x3b')]:_0x1eb8e8[_0x597e('0x38')];if(!_0x3c666d['query'][_0x597e('0x3d')](_0x597e('0x3e'))){_0xe498fa['limit']=qs[_0x597e('0x22')](_0x3c666d[_0x597e('0x39')][_0x597e('0x22')]);_0xe498fa['offset']=qs[_0x597e('0x20')](_0x3c666d['query'][_0x597e('0x20')]);}_0xe498fa[_0x597e('0x3f')]=qs[_0x597e('0x40')](_0x3c666d['query']['sort']);_0xe498fa[_0x597e('0x41')]=qs[_0x597e('0x42')](_[_0x597e('0x43')](_0x3c666d[_0x597e('0x39')],_0x1eb8e8[_0x597e('0x42')]),_0x415cf3);if(_0x3c666d[_0x597e('0x39')][_0x597e('0x44')]){_0xe498fa[_0x597e('0x41')]=_[_0x597e('0x45')](_0xe498fa['where'],{'$or':_['map'](_0x415cf3,function(_0x577051){if(_0x577051[_0x597e('0x36')]!==_0x597e('0x46')){var _0x4425eb={};_0x4425eb[_0x577051['name']]={'$like':'%'+_0x3c666d[_0x597e('0x39')]['filter']+'%'};return _0x4425eb;}})});}_0xe498fa=_['merge']({},_0xe498fa,_0x3c666d[_0x597e('0x47')]);var _0x40b499={'where':_0xe498fa[_0x597e('0x41')]};return db[_0x597e('0x34')][_0x597e('0x23')](_0x40b499)[_0x597e('0x2a')](function(_0x14fddf){_0x561b00[_0x597e('0x23')]=_0x14fddf;if(_0x3c666d[_0x597e('0x39')][_0x597e('0x48')]){_0xe498fa[_0x597e('0x49')]=[{'all':!![]}];}return db[_0x597e('0x34')][_0x597e('0x4a')](_0xe498fa);})[_0x597e('0x2a')](function(_0x5898ac){_0x561b00[_0x597e('0x4b')]=_0x5898ac;return _0x561b00;})[_0x597e('0x2a')](respondWithFilteredResult(_0x528187,_0xe498fa))[_0x597e('0x4c')](handleError(_0x528187,null));};exports['show']=function(_0x550f7f,_0x57a68b){var _0x3c6f96={'raw':!![],'where':{'id':_0x550f7f['params']['id']}},_0x11fcd6={};_0x11fcd6[_0x597e('0x38')]=_['keys'](db['Plugin']['rawAttributes']);_0x11fcd6['query']=_[_0x597e('0x4d')](_0x550f7f[_0x597e('0x39')]);_0x11fcd6[_0x597e('0x42')]=_[_0x597e('0x3a')](_0x11fcd6[_0x597e('0x38')],_0x11fcd6[_0x597e('0x39')]);_0x3c6f96[_0x597e('0x3b')]=_[_0x597e('0x3a')](_0x11fcd6[_0x597e('0x38')],qs[_0x597e('0x3c')](_0x550f7f['query'][_0x597e('0x3c')]));_0x3c6f96['attributes']=_0x3c6f96[_0x597e('0x3b')][_0x597e('0x4e')]?_0x3c6f96[_0x597e('0x3b')]:_0x11fcd6[_0x597e('0x38')];if(_0x550f7f['query'][_0x597e('0x48')]){_0x3c6f96[_0x597e('0x49')]=[{'all':!![]}];}_0x3c6f96=_[_0x597e('0x45')]({},_0x3c6f96,_0x550f7f[_0x597e('0x47')]);return db[_0x597e('0x34')]['find'](_0x3c6f96)['then'](handleEntityNotFound(_0x57a68b,null))[_0x597e('0x2a')](respondWithResult(_0x57a68b,null))[_0x597e('0x4c')](handleError(_0x57a68b,null));};exports['download']=function(_0x4e956f,_0x4bda2f,_0x5dc408){return db[_0x597e('0x34')][_0x597e('0x4f')]({'where':{'id':_0x4e956f['params']['id']},'attributes':[_0x597e('0x31'),_0x597e('0x6')],'raw':!![]})[_0x597e('0x2a')](handleEntityNotFound(_0x4bda2f,null))[_0x597e('0x2a')](function(_0x10eb77){if(_0x10eb77){var _0x19b493=path[_0x597e('0x50')](config[_0x597e('0x51')],_0x597e('0x52'),util['format'](_0x597e('0x53'),path[_0x597e('0x54')](_0x10eb77[_0x597e('0x6')])));var _0x200f5e=fs['createWriteStream'](_0x19b493);var _0x46e5fc=archiver('zip',{'zlib':{'level':0x9}});_0x46e5fc['on'](_0x597e('0x55'),function(_0x2fa906){if(_0x2fa906['code']===_0x597e('0x56')){logger[_0x597e('0x2f')](_0x2fa906);}else{throw new db[(_0x597e('0x57'))][(_0x597e('0x58'))](_0x597e('0x59'));}});_0x46e5fc['on'](_0x597e('0x2f'),function(_0x20c1b5){throw new db['Sequelize'][(_0x597e('0x58'))](_0x597e('0x59'));});_0x46e5fc[_0x597e('0x5a')](_0x200f5e);_0x46e5fc[_0x597e('0x5b')]('**/*',{'cwd':path[_0x597e('0x50')](config[_0x597e('0x51')],_0x597e('0x52'),path[_0x597e('0x5c')](_0x10eb77[_0x597e('0x6')])),'ignore':[path['join'](path['basename'](_0x10eb77[_0x597e('0x6')]),_0x597e('0x5d')),path[_0x597e('0x50')](path[_0x597e('0x54')](_0x10eb77[_0x597e('0x6')]),_0x597e('0x5e'))],'nodir':!![]})[_0x597e('0x5f')]();_0x200f5e['on'](_0x597e('0x60'),function(){if(!fs[_0x597e('0x61')](_0x19b493)){throw new db[(_0x597e('0x57'))][(_0x597e('0x58'))](_0x597e('0x62'));}return _0x4bda2f[_0x597e('0x63')](_0x19b493,util[_0x597e('0x64')](_0x597e('0x53'),path[_0x597e('0x54')](_0x10eb77[_0x597e('0x6')])),function(_0x24f7b6){if(_0x24f7b6){throw new db[(_0x597e('0x57'))][(_0x597e('0x58'))](_0x597e('0x65'));}fs[_0x597e('0x66')](_0x19b493);logger[_0x597e('0x67')](_0x597e('0x68'));logger['info'](_0x597e('0x69'));});});}return null;})[_0x597e('0x4c')](handleError(_0x4bda2f,null));};exports[_0x597e('0x6a')]=function(_0x133f19,_0x59f8be,_0xe72eac){var _0x4c9d4e=path[_0x597e('0x54')](_0x133f19[_0x597e('0x6b')][_0x597e('0x6c')],path[_0x597e('0x6d')](_0x133f19['file'][_0x597e('0x6c')]));var _0x31cc3d=path[_0x597e('0x50')](config[_0x597e('0x51')],_0x597e('0x52'),_0x133f19[_0x597e('0x6b')][_0x597e('0x6c')]);var _0x3b6c3a=path[_0x597e('0x50')](config['root'],'server/files/plugins',_0x4c9d4e);logger[_0x597e('0x67')](_0x597e('0x6e'),_0x31cc3d);logger[_0x597e('0x67')](_0x597e('0x6f'),_0x3b6c3a);try{fs['chmodSync'](_0x31cc3d,parseInt(_0x597e('0x70'),0x8));extract(_0x31cc3d,{'dir':_0x3b6c3a},function(_0x157243){if(_0x157243){logger['error'](_0x157243);handleError(_0x157243,!![]);};var _0x364d70=fs[_0x597e('0x71')](_0x3b6c3a);if(_0x364d70[_0x597e('0x4e')]>0x1){removeReferences(_0x31cc3d,_0x3b6c3a);logger[_0x597e('0x2f')](_0x597e('0x72'));return _0xe72eac(new Error(_0x597e('0x72')));}var _0x36cff1=fs[_0x597e('0x73')](path[_0x597e('0x50')](_0x3b6c3a,_0x364d70[0x0]));if(_0x36cff1['isFile']()){removeReferences(_0x31cc3d,_0x3b6c3a);logger[_0x597e('0x2f')](_0x597e('0x72'));return _0xe72eac(new Error(_0x597e('0x72')));}if(_0x36cff1[_0x597e('0x74')]()){var _0x1c98a5=fs[_0x597e('0x71')](path[_0x597e('0x50')](_0x3b6c3a,_0x364d70[0x0]));if(_0x1c98a5['length']===0x0){removeReferences(_0x31cc3d,_0x3b6c3a);logger[_0x597e('0x2f')](_0x597e('0x72'));return _0xe72eac(new Error(_0x597e('0x72')));}var _0x30ab62=_0x1c98a5['some'](function(_0x5bbe61){return _0x5bbe61==='manifest.json';});if(!_0x30ab62){return _0xe72eac(new Error('Plugin\x20manifest\x20missing'));}var _0x30adac=fs[_0x597e('0x75')](path[_0x597e('0x50')](_0x3b6c3a,_0x364d70[0x0],_0x597e('0x76')));var _0x296a34=JSON[_0x597e('0x77')](_0x30adac);if(_0x597e('0x21')==typeof _0x296a34[_0x597e('0x31')]){return _0xe72eac(new Error(_0x597e('0x78')));}if(_0x597e('0x21')==typeof _0x296a34[_0x597e('0x36')]){return _0xe72eac(new Error(_0x597e('0x79')));}if('undefined'==typeof _0x296a34[_0x597e('0x7a')]){return _0xe72eac(new Error(_0x597e('0x7b')));}if(_0x597e('0x21')==typeof _0x296a34['parameters']){return _0xe72eac(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x296a34[_0x597e('0x36')]==='html'){if(_0x597e('0x21')==typeof _0x296a34[_0x597e('0x7c')][_0x597e('0x7d')]){return _0xe72eac(new Error(_0x597e('0x7e')));}if(_0x597e('0x21')==typeof _0x296a34[_0x597e('0x7c')][_0x597e('0x7d')][_0x597e('0x7f')]&&_0x597e('0x21')==typeof _0x296a34[_0x597e('0x7c')][_0x597e('0x7d')][_0x597e('0x80')]){return _0xe72eac(new Error(_0x597e('0x81')));}}else if(_0x296a34[_0x597e('0x36')]===_0x597e('0x82')){if(_0x597e('0x21')==typeof _0x296a34[_0x597e('0x7c')]['scriptName']){return _0xe72eac(new Error(_0x597e('0x83')));}if(_0x597e('0x21')==typeof _0x296a34[_0x597e('0x7c')][_0x597e('0x84')]){return _0xe72eac(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xe72eac(new Error(_0x597e('0x85')));}var _0x4d3798=_0x296a34[_0x597e('0x31')];var _0x5f5801=_0x296a34['description'];var _0x2fb1a1=_0x296a34[_0x597e('0x36')];var _0x5acb5c=_0x296a34[_0x597e('0x86')]?_0x296a34[_0x597e('0x86')]:'always';var _0x5dabed=_0x296a34[_0x597e('0x87')]?_0x296a34[_0x597e('0x87')]:_0x597e('0x88');var _0x53f2d3='';var _0x42bdc2='';var _0x2b0d54='';var _0x3febdb='';var _0x54122a=_0x296a34[_0x597e('0x7a')];if(_0x2fb1a1==='html'){if('undefined'!=typeof _0x296a34[_0x597e('0x7c')]['views']['admin']){var _0x53d5d0=_0x296a34[_0x597e('0x7c')][_0x597e('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x597e('0x89')](_0x53d5d0)){_0x53f2d3=path[_0x597e('0x50')](_0x597e('0x8a'),_0x4c9d4e,_0x364d70[0x0],_0x53d5d0);}else{_0x53f2d3=_0x53d5d0;}}else{logger[_0x597e('0x67')](_0x597e('0x8b'));}if(_0x597e('0x21')!=typeof _0x296a34[_0x597e('0x7c')][_0x597e('0x7d')]['agent']){var _0x1308de=_0x296a34[_0x597e('0x7c')][_0x597e('0x7d')][_0x597e('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x597e('0x89')](_0x1308de)){_0x42bdc2=path[_0x597e('0x50')](_0x597e('0x8a'),_0x4c9d4e,_0x364d70[0x0],_0x1308de);}else{_0x42bdc2=_0x1308de;}}else{logger[_0x597e('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2fb1a1==='script'){_0x2b0d54=_0x296a34[_0x597e('0x7c')][_0x597e('0x8c')];_0x3febdb=_0x296a34['parameters'][_0x597e('0x84')];if('undefined'!=typeof _0x296a34[_0x597e('0x7c')]['views']){if('undefined'!=typeof _0x296a34['parameters']['views']['admin']){var _0x53d5d0=_0x296a34[_0x597e('0x7c')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x597e('0x89')](_0x53d5d0)){_0x53f2d3=path[_0x597e('0x50')](_0x597e('0x8a'),_0x4c9d4e,_0x364d70[0x0],_0x53d5d0);}else{_0x53f2d3=_0x53d5d0;}}if(_0x597e('0x21')!=typeof _0x296a34[_0x597e('0x7c')]['views'][_0x597e('0x80')]){var _0x1308de=_0x296a34['parameters'][_0x597e('0x7d')][_0x597e('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1308de)){_0x42bdc2=path['join']('plugins',_0x4c9d4e,_0x364d70[0x0],_0x1308de);}else{_0x42bdc2=_0x1308de;}}}}var _0x1fbe11={'name':_0x4d3798,'description':_0x5f5801,'path':path[_0x597e('0x50')](_0x4c9d4e,_0x364d70[0x0]),'type':_0x2fb1a1,'sidebar':_0x5acb5c,'icon':_0x5dabed,'adminUrl':_0x53f2d3,'agentUrl':_0x42bdc2,'scriptName':_0x2b0d54,'scriptPath':_0x3febdb,'version':_0x54122a};removeReferences(_0x31cc3d,null);return db[_0x597e('0x34')][_0x597e('0x8d')](_0x1fbe11)[_0x597e('0x2a')](function(_0x4072e9){var _0x4da2ce={'role':_0x133f19[_0x597e('0x8e')]['role'],'userProfileId':_0x133f19[_0x597e('0x8e')]['userProfileId']};if(!_0x4da2ce)throw new Error(_0x597e('0x8f'));if(_0x4da2ce['role']===_0x597e('0x90')){var _0x2fb013=_0x4072e9['get']({'plain':!![]});return db[_0x597e('0x91')]['find']({'where':{'name':_0x597e('0x2d'),'userProfileId':_0x4da2ce[_0x597e('0x92')]},'raw':!![]})[_0x597e('0x2a')](function(_0x28545e){if(_0x28545e&&_0x28545e[_0x597e('0x93')]===0x0){return db['UserProfileResource'][_0x597e('0x8d')]({'name':_0x2fb013['name'],'resourceId':_0x2fb013['id'],'type':_0x28545e[_0x597e('0x31')],'sectionId':_0x28545e['id']},{})[_0x597e('0x2a')](function(){return _0x4072e9;});}else{return _0x4072e9;}})[_0x597e('0x4c')](function(_0x2b860f){logger['error'](_0x597e('0x94'),_0x2b860f);throw _0x2b860f;});}return _0x4072e9;})[_0x597e('0x2a')](respondWithResult(_0x59f8be,null))['catch'](handleError(_0x59f8be,null));}});}catch(_0x226a63){_0x59f8be['status'](0x1f4)[_0x597e('0x95')](_0x226a63);}};function removeReferences(_0x50addd,_0xe67015){try{if(_0x50addd){fs['unlinkSync'](_0x50addd);logger['info'](_0x597e('0x96'));}if(_0xe67015){rimraf(_0xe67015,function(){});logger[_0x597e('0x67')](_0x597e('0x97'));}}catch(_0x856e2a){logger[_0x597e('0x2f')](_0x856e2a);}}exports['update']=function(_0x297966,_0x6aeb40,_0x1028cd){return db['Plugin'][_0x597e('0x4f')]({'where':{'id':_0x297966[_0x597e('0x98')]['id']}})[_0x597e('0x2a')](handleEntityNotFound(_0x6aeb40,null))[_0x597e('0x2a')](saveUpdates(_0x297966[_0x597e('0x8e')],null))['then'](respondWithResult(_0x6aeb40,null))[_0x597e('0x4c')](handleError(_0x6aeb40,null));};exports['delete']=function(_0x279135,_0x205315,_0x202d22){return db['Plugin'][_0x597e('0x4f')]({'where':{'id':_0x279135[_0x597e('0x98')]['id']}})[_0x597e('0x2a')](function(_0x5da76d){if(_0x5da76d){return _0x5da76d[_0x597e('0x2b')]();}})['then'](function(_0x27ab08){rimraf(path[_0x597e('0x50')](config[_0x597e('0x51')],_0x597e('0x52'),path[_0x597e('0x5c')](_0x27ab08[_0x597e('0x6')])),function(){});return _0x27ab08;})[_0x597e('0x2a')](handleEntityNotFound(_0x205315,null))[_0x597e('0x2a')](respondWithStatusCode(_0x205315,null))[_0x597e('0x4c')](handleError(_0x205315,null));};exports[_0x597e('0x99')]=function(_0x16b0e2,_0x14d7ae,_0x207b87){return BPromise[_0x597e('0x9a')]()[_0x597e('0x2a')](function(){if(!_0x16b0e2[_0x597e('0x39')][_0x597e('0x6')]){throw new Error(_0x597e('0x9b'));}if(!_0x16b0e2[_0x597e('0x39')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4847f4=_0x16b0e2[_0x597e('0x39')][_0x597e('0x9c')]?_0x16b0e2['query'][_0x597e('0x9c')]+':'+_0x16b0e2['query']['port']:_0x597e('0x9d')+_0x16b0e2[_0x597e('0x39')][_0x597e('0x9e')];var _0x41e5b5=_0x16b0e2[_0x597e('0x39')]['json']?_0x16b0e2['query'][_0x597e('0x1f')]:!![];var _0x3bb35e=_0x16b0e2['query'][_0x597e('0x9f')]?_0x16b0e2[_0x597e('0x39')]['encoding']:null;var _0x4f127a={'method':_0x16b0e2[_0x597e('0xa0')],'uri':util[_0x597e('0x64')]('%s%s',_0x4847f4,_0x16b0e2[_0x597e('0x39')][_0x597e('0x6')]),'json':_0x41e5b5,'resolveWithFullResponse':!![],'encoding':_0x3bb35e,'qs':_0x16b0e2[_0x597e('0x39')]};if(_0x16b0e2['headers']){_0x4f127a[_0x597e('0xa1')]=_0x16b0e2['headers'];if(_0x4f127a[_0x597e('0xa1')][_0x597e('0xa2')]){delete _0x4f127a[_0x597e('0xa1')][_0x597e('0xa2')];}}if(_0x4f127a[_0x597e('0xa1')][_0x597e('0xa3')]){delete _0x4f127a['headers'][_0x597e('0xa3')];}return rp(_0x4f127a);})[_0x597e('0x2a')](function(_0x4dbb58){if(_0x4dbb58){_0x14d7ae[_0x597e('0x24')](_0x4dbb58[_0x597e('0xa1')]);logger[_0x597e('0x67')](_0x4dbb58[_0x597e('0x8e')]);if(_[_0x597e('0xa4')](_0x16b0e2[_0x597e('0x39')][_0x597e('0x6')],_0x597e('0x63'))&&_0x4dbb58[_0x597e('0xa5')]==0x1f4){return _0x14d7ae['sendStatus'](_0x4dbb58[_0x597e('0xa5')]);}else{return _0x14d7ae[_0x597e('0x1d')](_0x4dbb58[_0x597e('0xa5')])['send'](_0x4dbb58[_0x597e('0x8e')]);}}else{return _0x14d7ae[_0x597e('0x1c')](0xc8);}})['catch'](handleError(_0x14d7ae,null));};exports['webhookPost']=function(_0x137f85,_0x45d36a,_0x1db3a7){return BPromise[_0x597e('0x9a')]()[_0x597e('0x2a')](function(){if(!_0x137f85[_0x597e('0x39')][_0x597e('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x137f85[_0x597e('0x39')]['port']){throw new Error(_0x597e('0xa6'));}var _0x2a4f6d=_0x137f85[_0x597e('0x39')][_0x597e('0x9c')]?_0x137f85[_0x597e('0x39')][_0x597e('0x9c')]+':'+_0x137f85[_0x597e('0x39')][_0x597e('0x9e')]:_0x597e('0x9d')+_0x137f85[_0x597e('0x39')][_0x597e('0x9e')];var _0x55c061=_0x137f85[_0x597e('0x39')][_0x597e('0x1f')]?_0x137f85[_0x597e('0x39')][_0x597e('0x1f')]:!![];var _0x2a75a4=_0x137f85['query'][_0x597e('0x9f')]?_0x137f85[_0x597e('0x39')][_0x597e('0x9f')]:null;var _0x5a701e={'method':_0x137f85[_0x597e('0xa0')],'uri':util[_0x597e('0x64')](_0x597e('0xa7'),_0x2a4f6d,_0x137f85['query'][_0x597e('0x6')]),'json':_0x55c061,'resolveWithFullResponse':!![],'encoding':_0x2a75a4,'body':_0x137f85[_0x597e('0x8e')]};if(_0x137f85['headers']){_0x5a701e[_0x597e('0xa1')]=_0x137f85['headers'];if(_0x5a701e[_0x597e('0xa1')][_0x597e('0xa2')]){delete _0x5a701e[_0x597e('0xa1')][_0x597e('0xa2')];}}if(_0x5a701e[_0x597e('0xa1')][_0x597e('0xa3')]){delete _0x5a701e[_0x597e('0xa1')]['content-type'];}return rp(_0x5a701e);})[_0x597e('0x2a')](function(_0x3493d5){if(_0x3493d5){_0x45d36a[_0x597e('0x24')](_0x3493d5['headers']);logger['info'](_0x3493d5[_0x597e('0x8e')]);return _0x45d36a[_0x597e('0x1d')](_0x3493d5[_0x597e('0xa5')])[_0x597e('0x95')](_0x3493d5[_0x597e('0x8e')]);}else{return _0x45d36a[_0x597e('0x1c')](0xc8);}})['catch'](handleError(_0x45d36a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b8cebe5..a9e1133 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 _0x8917=['exports','events','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8917,0x1d7));var _0x7891=function(_0x619dd2,_0x25c6be){_0x619dd2=_0x619dd2-0x0;var _0x588daa=_0x8917[_0x619dd2];return _0x588daa;};'use strict';var EventEmitter=require(_0x7891('0x0'));var Plugin=require('../../mysqldb')['db'][_0x7891('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7891('0x2')](0x0);var events={'afterCreate':_0x7891('0x3'),'afterUpdate':_0x7891('0x4'),'afterDestroy':_0x7891('0x5')};function emitEvent(_0x17ae29){return function(_0x2b5570,_0x24234b,_0x251aa7){PluginEvents['emit'](_0x17ae29+':'+_0x2b5570['id'],_0x2b5570);PluginEvents[_0x7891('0x6')](_0x17ae29,_0x2b5570);_0x251aa7(null);};}for(var e in events){if(events[_0x7891('0x7')](e)){var event=events[e];Plugin[_0x7891('0x8')](e,emitEvent(event));}}module[_0x7891('0x9')]=PluginEvents; \ No newline at end of file +var _0x2d78=['../../mysqldb','Plugin','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2e069f,_0x1be8b8){var _0x49ac4e=function(_0x58222b){while(--_0x58222b){_0x2e069f['push'](_0x2e069f['shift']());}};_0x49ac4e(++_0x1be8b8);}(_0x2d78,0x199));var _0x82d7=function(_0x8fa4bc,_0x5cd2af){_0x8fa4bc=_0x8fa4bc-0x0;var _0x35b6a7=_0x2d78[_0x8fa4bc];return _0x35b6a7;};'use strict';var EventEmitter=require(_0x82d7('0x0'));var Plugin=require(_0x82d7('0x1'))['db'][_0x82d7('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82d7('0x3'),'afterUpdate':_0x82d7('0x4'),'afterDestroy':_0x82d7('0x5')};function emitEvent(_0x7f0495){return function(_0x3aed11,_0x23e4d0,_0x13fb9e){PluginEvents[_0x82d7('0x6')](_0x7f0495+':'+_0x3aed11['id'],_0x3aed11);PluginEvents[_0x82d7('0x6')](_0x7f0495,_0x3aed11);_0x13fb9e(null);};}for(var e in events){if(events[_0x82d7('0x7')](e)){var event=events[e];Plugin[_0x82d7('0x8')](e,emitEvent(event));}}module[_0x82d7('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index d4d3317..6cd2227 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 _0xd704=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash'];(function(_0x5b51d2,_0xd3846c){var _0x1ecc32=function(_0x26c8a1){while(--_0x26c8a1){_0x5b51d2['push'](_0x5b51d2['shift']());}};_0x1ecc32(++_0xd3846c);}(_0xd704,0xd0));var _0x4d70=function(_0x5c28a3,_0xbadbf3){_0x5c28a3=_0x5c28a3-0x0;var _0x9860ed=_0xd704[_0x5c28a3];return _0x9860ed;};'use strict';var _=require(_0x4d70('0x0'));var util=require('util');var logger=require(_0x4d70('0x1'))(_0x4d70('0x2'));var moment=require('moment');var BPromise=require(_0x4d70('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d70('0x4'));var rimraf=require(_0x4d70('0x5'));var config=require(_0x4d70('0x6'));var attributes=require(_0x4d70('0x7'));module[_0x4d70('0x8')]=function(_0xc3b24b,_0x48839f){return _0xc3b24b['define'](_0x4d70('0x9'),attributes,{'tableName':_0x4d70('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12b6=['./plugin.attributes','exports','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x186c66,_0x3c1028){var _0x36fba5=function(_0x52e302){while(--_0x52e302){_0x186c66['push'](_0x186c66['shift']());}};_0x36fba5(++_0x3c1028);}(_0x12b6,0x1e4));var _0x612b=function(_0x25fa82,_0xb1dfd7){_0x25fa82=_0x25fa82-0x0;var _0x475404=_0x12b6[_0x25fa82];return _0x475404;};'use strict';var _=require(_0x612b('0x0'));var util=require(_0x612b('0x1'));var logger=require(_0x612b('0x2'))(_0x612b('0x3'));var moment=require('moment');var BPromise=require(_0x612b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x612b('0x5'));var rimraf=require(_0x612b('0x6'));var config=require(_0x612b('0x7'));var attributes=require(_0x612b('0x8'));module[_0x612b('0x9')]=function(_0x3161e2,_0x10cc2c){return _0x3161e2['define'](_0x612b('0xa'),attributes,{'tableName':_0x612b('0xb'),'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 4641a76..f8f94be 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 _0xce01=['options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreatePlugin','Plugin','body'];(function(_0x77d949,_0x46c514){var _0x2434dd=function(_0x3ecb81){while(--_0x3ecb81){_0x77d949['push'](_0x77d949['shift']());}};_0x2434dd(++_0x46c514);}(_0xce01,0x1b4));var _0x1ce0=function(_0x1a5844,_0x564e42){_0x1a5844=_0x1a5844-0x0;var _0x5ecc75=_0xce01[_0x1a5844];return _0x5ecc75;};'use strict';var _=require(_0x1ce0('0x0'));var util=require('util');var moment=require(_0x1ce0('0x1'));var BPromise=require(_0x1ce0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ce0('0x3'));var db=require(_0x1ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ce0('0x5'))(_0x1ce0('0x6'));var config=require(_0x1ce0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ce0('0x8')][_0x1ce0('0x9')]({'port':0x232a});config['redis']=_[_0x1ce0('0xa')](config[_0x1ce0('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ce0('0xb')]));require(_0x1ce0('0xc'))[_0x1ce0('0xd')](socket);function respondWithRpcPromise(_0x14e3e8,_0x203cb3,_0x3bd24f){return new BPromise(function(_0x27a63b,_0x3d3415){return client[_0x1ce0('0xe')](_0x14e3e8,_0x3bd24f)[_0x1ce0('0xf')](function(_0x3130da){logger['info'](_0x1ce0('0x10'),_0x203cb3,_0x1ce0('0x11'));logger[_0x1ce0('0x12')](_0x1ce0('0x13'),_0x203cb3,_0x1ce0('0x11'),JSON[_0x1ce0('0x14')](_0x3130da));if(_0x3130da[_0x1ce0('0x15')]){if(_0x3130da[_0x1ce0('0x15')][_0x1ce0('0x16')]===0x1f4){logger['error'](_0x1ce0('0x10'),_0x203cb3,_0x3130da[_0x1ce0('0x15')][_0x1ce0('0x17')]);return _0x3d3415(_0x3130da['error'][_0x1ce0('0x17')]);}logger[_0x1ce0('0x15')]('Plugin,\x20%s,\x20%s',_0x203cb3,_0x3130da[_0x1ce0('0x15')]['message']);return _0x27a63b(_0x3130da[_0x1ce0('0x15')]['message']);}else{logger[_0x1ce0('0x18')](_0x1ce0('0x10'),_0x203cb3,'request\x20sent');_0x27a63b(_0x3130da[_0x1ce0('0x19')][_0x1ce0('0x17')]);}})['catch'](function(_0x5a5169){logger[_0x1ce0('0x15')](_0x1ce0('0x10'),_0x203cb3,_0x5a5169);_0x3d3415(_0x5a5169);});});}exports[_0x1ce0('0x1a')]=function(_0x175c6c){var _0x552914=this;return new Promise(function(_0x36df37,_0x10b2e7){return db[_0x1ce0('0x1b')]['create'](_0x175c6c[_0x1ce0('0x1c')],{'raw':_0x175c6c[_0x1ce0('0x1d')]?_0x175c6c[_0x1ce0('0x1d')][_0x1ce0('0x1e')]===undefined?!![]:![]:!![]})[_0x1ce0('0xf')](function(_0x12c1b6){logger[_0x1ce0('0x18')](_0x1ce0('0x1a'),_0x175c6c);logger[_0x1ce0('0x12')](_0x1ce0('0x1a'),_0x175c6c,JSON[_0x1ce0('0x14')](_0x12c1b6));_0x36df37(_0x12c1b6);})['catch'](function(_0x4f8be0){logger['error']('CreatePlugin',_0x4f8be0[_0x1ce0('0x17')],_0x175c6c);_0x10b2e7(_0x552914[_0x1ce0('0x15')](0x1f4,_0x4f8be0['message']));});});}; \ No newline at end of file +var _0x08bf=['localhost','socket.io-emitter','./plugin.socket','register','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x4b8a67,_0x83f8f2){var _0x4fd422=function(_0x1129a5){while(--_0x1129a5){_0x4b8a67['push'](_0x4b8a67['shift']());}};_0x4fd422(++_0x83f8f2);}(_0x08bf,0x112));var _0xf08b=function(_0xf7d8a9,_0x29f18b){_0xf7d8a9=_0xf7d8a9-0x0;var _0x37aeef=_0x08bf[_0xf7d8a9];return _0x37aeef;};'use strict';var _=require(_0xf08b('0x0'));var util=require(_0xf08b('0x1'));var moment=require(_0xf08b('0x2'));var BPromise=require(_0xf08b('0x3'));var rs=require(_0xf08b('0x4'));var fs=require('fs');var Redis=require(_0xf08b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf08b('0x6'));var logger=require(_0xf08b('0x7'))('rpc');var config=require(_0xf08b('0x8'));var jayson=require(_0xf08b('0x9'));var client=jayson[_0xf08b('0xa')][_0xf08b('0xb')]({'port':0x232a});config[_0xf08b('0xc')]=_[_0xf08b('0xd')](config['redis'],{'host':_0xf08b('0xe'),'port':0x18eb});var socket=require(_0xf08b('0xf'))(new Redis(config[_0xf08b('0xc')]));require(_0xf08b('0x10'))[_0xf08b('0x11')](socket);function respondWithRpcPromise(_0xe1881a,_0x1aee8a,_0x513695){return new BPromise(function(_0x295d4f,_0x422d4a){return client['request'](_0xe1881a,_0x513695)[_0xf08b('0x12')](function(_0x5e34e4){logger['info']('Plugin,\x20%s,\x20%s',_0x1aee8a,_0xf08b('0x13'));logger[_0xf08b('0x14')](_0xf08b('0x15'),_0x1aee8a,_0xf08b('0x13'),JSON[_0xf08b('0x16')](_0x5e34e4));if(_0x5e34e4['error']){if(_0x5e34e4[_0xf08b('0x17')][_0xf08b('0x18')]===0x1f4){logger[_0xf08b('0x17')](_0xf08b('0x19'),_0x1aee8a,_0x5e34e4['error'][_0xf08b('0x1a')]);return _0x422d4a(_0x5e34e4[_0xf08b('0x17')][_0xf08b('0x1a')]);}logger[_0xf08b('0x17')]('Plugin,\x20%s,\x20%s',_0x1aee8a,_0x5e34e4[_0xf08b('0x17')][_0xf08b('0x1a')]);return _0x295d4f(_0x5e34e4[_0xf08b('0x17')]['message']);}else{logger[_0xf08b('0x1b')]('Plugin,\x20%s,\x20%s',_0x1aee8a,_0xf08b('0x13'));_0x295d4f(_0x5e34e4[_0xf08b('0x1c')][_0xf08b('0x1a')]);}})[_0xf08b('0x1d')](function(_0x1a4363){logger['error']('Plugin,\x20%s,\x20%s',_0x1aee8a,_0x1a4363);_0x422d4a(_0x1a4363);});});}exports[_0xf08b('0x1e')]=function(_0x39d5ce){var _0x4d2c5f=this;return new Promise(function(_0xcf0dc5,_0x367b9e){return db[_0xf08b('0x1f')][_0xf08b('0x20')](_0x39d5ce[_0xf08b('0x21')],{'raw':_0x39d5ce['options']?_0x39d5ce[_0xf08b('0x22')][_0xf08b('0x23')]===undefined?!![]:![]:!![]})[_0xf08b('0x12')](function(_0x121297){logger[_0xf08b('0x1b')]('CreatePlugin',_0x39d5ce);logger[_0xf08b('0x14')]('CreatePlugin',_0x39d5ce,JSON[_0xf08b('0x16')](_0x121297));_0xcf0dc5(_0x121297);})[_0xf08b('0x1d')](function(_0x2c9367){logger['error'](_0xf08b('0x1e'),_0x2c9367[_0xf08b('0x1a')],_0x39d5ce);_0x367b9e(_0x4d2c5f[_0xf08b('0x17')](0x1f4,_0x2c9367[_0xf08b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5c0ba6c..990b826 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 _0x8349=['plugin:','./plugin.events','save','remove','update'];(function(_0x1acf45,_0x1eb474){var _0x220427=function(_0x59551e){while(--_0x59551e){_0x1acf45['push'](_0x1acf45['shift']());}};_0x220427(++_0x1eb474);}(_0x8349,0x15a));var _0x9834=function(_0x536256,_0x237fb5){_0x536256=_0x536256-0x0;var _0x1675f7=_0x8349[_0x536256];return _0x1675f7;};'use strict';var PluginEvents=require(_0x9834('0x0'));var events=[_0x9834('0x1'),_0x9834('0x2'),_0x9834('0x3')];function createListener(_0x1c5fff,_0x25a4dd){return function(_0x1bf308){_0x25a4dd['emit'](_0x1c5fff,_0x1bf308);};}function removeListener(_0x1ee549,_0x1cfc98){return function(){PluginEvents['removeListener'](_0x1ee549,_0x1cfc98);};}exports['register']=function(_0x2d4859){for(var _0x16dc48=0x0,_0x20ce57=events['length'];_0x16dc48<_0x20ce57;_0x16dc48++){var _0x574d1f=events[_0x16dc48];var _0x65305=createListener(_0x9834('0x4')+_0x574d1f,_0x2d4859);PluginEvents['on'](_0x574d1f,_0x65305);}}; \ No newline at end of file +var _0x19e2=['emit','removeListener','register','length','./plugin.events','save','remove','update'];(function(_0xce903e,_0x8c5304){var _0xc4e96a=function(_0x5e9427){while(--_0x5e9427){_0xce903e['push'](_0xce903e['shift']());}};_0xc4e96a(++_0x8c5304);}(_0x19e2,0x1ec));var _0x219e=function(_0x31a046,_0x5b0635){_0x31a046=_0x31a046-0x0;var _0x2d451b=_0x19e2[_0x31a046];return _0x2d451b;};'use strict';var PluginEvents=require(_0x219e('0x0'));var events=[_0x219e('0x1'),_0x219e('0x2'),_0x219e('0x3')];function createListener(_0x1306e1,_0x540e1f){return function(_0xfbe197){_0x540e1f[_0x219e('0x4')](_0x1306e1,_0xfbe197);};}function removeListener(_0x52747d,_0x4ed280){return function(){PluginEvents[_0x219e('0x5')](_0x52747d,_0x4ed280);};}exports[_0x219e('0x6')]=function(_0x15cd0e){for(var _0x4d8bdb=0x0,_0x198ccc=events[_0x219e('0x7')];_0x4d8bdb<_0x198ccc;_0x4d8bdb++){var _0x474f2d=events[_0x4d8bdb];var _0x54b544=createListener('plugin:'+_0x474f2d,_0x15cd0e);PluginEvents['on'](_0x474f2d,_0x54b544);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index efec656..934c688 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(_0x4da469,_0x5d527d){var _0x3c7c9c=function(_0x27ae35){while(--_0x27ae35){_0x4da469['push'](_0x4da469['shift']());}};_0x3c7c9c(++_0x5d527d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x1f60bd,_0x3d48ad){var _0x3018ed=function(_0x431888){while(--_0x431888){_0x1f60bd['push'](_0x1f60bd['shift']());}};_0x3018ed(++_0x3d48ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 80a6430..6336acc 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 _0xa902=['then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','update','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','list','reject','express','motion2','length'];(function(_0x29d9f4,_0x16b34e){var _0x1a0319=function(_0x2f2566){while(--_0x2f2566){_0x29d9f4['push'](_0x29d9f4['shift']());}};_0x1a0319(++_0x16b34e);}(_0xa902,0x8d));var _0x2a90=function(_0x55cdff,_0x2475cc){_0x55cdff=_0x55cdff-0x0;var _0xedd77c=_0xa902[_0x55cdff];return _0xedd77c;};'use strict';var _=require(_0x2a90('0x0'));var pm2=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var path=require(_0x2a90('0x4'));var exec=require('child_process')[_0x2a90('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x4961c2,_0x169808){return function(_0x2b40c0){if(!_0x2b40c0){_0x4961c2[_0x2a90('0x6')](0x194);;}return _0x2b40c0;};}function respondWithResult(_0x21e1d2,_0x4a32c7){_0x4a32c7=_0x4a32c7||0xc8;return function(_0x25bcfc){if(_0x25bcfc){return _0x21e1d2['status'](_0x4a32c7)[_0x2a90('0x7')](_0x25bcfc);}return null;};}function handleError(_0x570659,_0x5ec2b9){_0x5ec2b9=_0x5ec2b9||0x1f4;return function(_0xc75b6e){logger[_0x2a90('0x8')](_0xc75b6e[_0x2a90('0x9')]);if(_0xc75b6e[_0x2a90('0xa')]){delete _0xc75b6e[_0x2a90('0xa')];}_0x570659['status'](_0x5ec2b9)[_0x2a90('0xb')](_0xc75b6e);};}function execChildProcess(){return new BPromise(function(_0x3dadc2,_0x43c56d){exec(_0x2a90('0xc'),function(_0x541e22,_0x40e6aa,_0x52391c){logger[_0x2a90('0xd')](_0x40e6aa);logger['info'](_0x52391c);if(_0x541e22){logger[_0x2a90('0x8')](_0x541e22);return _0x43c56d(_0x541e22);}return _0x3dadc2(_0x40e6aa);});});}exports['index']=function(_0x407ce5,_0x30e166){return pm2[_0x2a90('0xe')]()['then'](function(_0x56d1b8){if(_0x56d1b8){var _0x57227c=_[_0x2a90('0xf')](_0x56d1b8,function(_0x3a42df){return _0x3a42df['name']===_0x2a90('0x10')||_0x3a42df[_0x2a90('0xa')]===_0x2a90('0x11');});return{'rows':_0x57227c,'count':_0x57227c[_0x2a90('0x12')]};}return null;})[_0x2a90('0x13')](respondWithResult(_0x30e166,null))[_0x2a90('0x14')](handleError(_0x30e166,null));};exports[_0x2a90('0x15')]=function(_0x10cf94,_0x43eea5){return pm2['describe'](_0x10cf94[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](respondWithResult(_0x43eea5,null))[_0x2a90('0x13')](handleEntityNotFound(_0x43eea5,null))['catch'](handleError(_0x43eea5,null));};exports[_0x2a90('0x17')]=function(_0x1f51a6,_0x148d18){if(_0x1f51a6[_0x2a90('0x18')][_0x2a90('0xa')]&&_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]){var _0x114d42=path[_0x2a90('0x1a')](__dirname,_0x2a90('0x1b'),_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]);var _0x4fdd62=process[_0x2a90('0x1c')]();process[_0x2a90('0x1d')](path[_0x2a90('0x1e')](_0x114d42));return execChildProcess()[_0x2a90('0x13')](function(_0x5912fd){process[_0x2a90('0x1d')](_0x4fdd62);return pm2[_0x2a90('0x1f')]({'name':_0x1f51a6['body'][_0x2a90('0xa')],'script':_0x114d42});})[_0x2a90('0x13')](function(_0x10a6dd){pm2[_0x2a90('0x20')]();return _0x10a6dd[0x0];})[_0x2a90('0x13')](respondWithResult(_0x148d18,0xc9))[_0x2a90('0x14')](handleError(_0x148d18,null));}else{return _0x148d18[_0x2a90('0x21')](0x1f4)[_0x2a90('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2a90('0x22')]=function(_0x17f978,_0x3934d4){if(_0x17f978[_0x2a90('0x18')]['id']){delete _0x17f978[_0x2a90('0x18')]['id'];}var _0x5208d8={'online':'restart','stopped':_0x2a90('0x23')};if(_0x5208d8['hasOwnProperty'](_0x17f978['body']['status'])){return pm2[_0x5208d8[_0x17f978[_0x2a90('0x18')][_0x2a90('0x21')]]](_0x17f978['params']['id'])['then'](respondWithResult(_0x3934d4,0xc8))[_0x2a90('0x14')](handleError(_0x3934d4,null));}else{return _0x3934d4['status'](0x1f4)[_0x2a90('0xb')]({'message':_0x2a90('0x24')});}};exports[_0x2a90('0x25')]=function(_0x27b6b6,_0xf18d11){if(_0x27b6b6[_0x2a90('0x18')]['id']){delete _0x27b6b6[_0x2a90('0x18')]['id'];}if(_0x27b6b6['params']['id']){return pm2[_0x2a90('0x26')](_0x27b6b6[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](function(_0x5cdeb4){pm2[_0x2a90('0x20')]();return _0x5cdeb4[0x0];})[_0x2a90('0x13')](respondWithResult(_0xf18d11,null))[_0x2a90('0x14')](handleError(_0xf18d11,null));}else{return _0xf18d11[_0x2a90('0x21')](0x1f4)['send']({'message':_0x2a90('0x27')});}}; \ No newline at end of file +var _0xf4eb=['join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','restart','stop','params','destroy','dump','Unknown\x20id','lodash','child_process','sendStatus','json','error','stack','name','status','send','npm\x20install','info','list','then','express','length','catch','show','create','body','script'];(function(_0x43a2b9,_0x20ba67){var _0x5d674a=function(_0x4c7d5b){while(--_0x4c7d5b){_0x43a2b9['push'](_0x43a2b9['shift']());}};_0x5d674a(++_0x20ba67);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5009e8,_0x26f2f4){_0x5009e8=_0x5009e8-0x0;var _0x89e95a=_0xf4eb[_0x5009e8];return _0x89e95a;};'use strict';var _=require(_0xbf4e('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0xbf4e('0x1'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2e3070,_0x1c7606){return function(_0x32d1d7){if(!_0x32d1d7){_0x2e3070[_0xbf4e('0x2')](0x194);;}return _0x32d1d7;};}function respondWithResult(_0xa4dcf5,_0x2fcfed){_0x2fcfed=_0x2fcfed||0xc8;return function(_0x15b99f){if(_0x15b99f){return _0xa4dcf5['status'](_0x2fcfed)[_0xbf4e('0x3')](_0x15b99f);}return null;};}function handleError(_0x5013c2,_0x5e23d4){_0x5e23d4=_0x5e23d4||0x1f4;return function(_0xa4280c){logger[_0xbf4e('0x4')](_0xa4280c[_0xbf4e('0x5')]);if(_0xa4280c[_0xbf4e('0x6')]){delete _0xa4280c[_0xbf4e('0x6')];}_0x5013c2[_0xbf4e('0x7')](_0x5e23d4)[_0xbf4e('0x8')](_0xa4280c);};}function execChildProcess(){return new BPromise(function(_0x580a26,_0x4d9a07){exec(_0xbf4e('0x9'),function(_0x5a8397,_0x448788,_0xcf6ba8){logger['info'](_0x448788);logger[_0xbf4e('0xa')](_0xcf6ba8);if(_0x5a8397){logger['error'](_0x5a8397);return _0x4d9a07(_0x5a8397);}return _0x580a26(_0x448788);});});}exports['index']=function(_0x209b25,_0x46c79c){return pm2[_0xbf4e('0xb')]()[_0xbf4e('0xc')](function(_0x3b74bd){if(_0x3b74bd){var _0x61bd54=_['reject'](_0x3b74bd,function(_0x59fb15){return _0x59fb15[_0xbf4e('0x6')]===_0xbf4e('0xd')||_0x59fb15[_0xbf4e('0x6')]==='motion2';});return{'rows':_0x61bd54,'count':_0x61bd54[_0xbf4e('0xe')]};}return null;})[_0xbf4e('0xc')](respondWithResult(_0x46c79c,null))[_0xbf4e('0xf')](handleError(_0x46c79c,null));};exports[_0xbf4e('0x10')]=function(_0x5a631e,_0x247322){return pm2['describe'](_0x5a631e['params']['id'])['then'](respondWithResult(_0x247322,null))['then'](handleEntityNotFound(_0x247322,null))[_0xbf4e('0xf')](handleError(_0x247322,null));};exports[_0xbf4e('0x11')]=function(_0x1fc800,_0x4d9c2a){if(_0x1fc800['body'][_0xbf4e('0x6')]&&_0x1fc800[_0xbf4e('0x12')][_0xbf4e('0x13')]){var _0x3a875b=path[_0xbf4e('0x14')](__dirname,_0xbf4e('0x15'),_0x1fc800[_0xbf4e('0x12')][_0xbf4e('0x13')]);var _0xd09e12=process[_0xbf4e('0x16')]();process[_0xbf4e('0x17')](path['dirname'](_0x3a875b));return execChildProcess()[_0xbf4e('0xc')](function(_0x2e7673){process['chdir'](_0xd09e12);return pm2[_0xbf4e('0x18')]({'name':_0x1fc800[_0xbf4e('0x12')][_0xbf4e('0x6')],'script':_0x3a875b});})[_0xbf4e('0xc')](function(_0x3a5d72){pm2['dump']();return _0x3a5d72[0x0];})[_0xbf4e('0xc')](respondWithResult(_0x4d9c2a,0xc9))[_0xbf4e('0xf')](handleError(_0x4d9c2a,null));}else{return _0x4d9c2a[_0xbf4e('0x7')](0x1f4)['send']({'message':_0xbf4e('0x19')});}};exports['update']=function(_0x5bcf71,_0x2bfccf){if(_0x5bcf71['body']['id']){delete _0x5bcf71[_0xbf4e('0x12')]['id'];}var _0x315df3={'online':_0xbf4e('0x1a'),'stopped':_0xbf4e('0x1b')};if(_0x315df3['hasOwnProperty'](_0x5bcf71[_0xbf4e('0x12')][_0xbf4e('0x7')])){return pm2[_0x315df3[_0x5bcf71[_0xbf4e('0x12')]['status']]](_0x5bcf71[_0xbf4e('0x1c')]['id'])['then'](respondWithResult(_0x2bfccf,0xc8))[_0xbf4e('0xf')](handleError(_0x2bfccf,null));}else{return _0x2bfccf[_0xbf4e('0x7')](0x1f4)[_0xbf4e('0x8')]({'message':'Unknown\x20status'});}};exports[_0xbf4e('0x1d')]=function(_0x362716,_0x2f3cf8){if(_0x362716[_0xbf4e('0x12')]['id']){delete _0x362716[_0xbf4e('0x12')]['id'];}if(_0x362716[_0xbf4e('0x1c')]['id']){return pm2['delete'](_0x362716[_0xbf4e('0x1c')]['id'])[_0xbf4e('0xc')](function(_0x5e32c0){pm2[_0xbf4e('0x1e')]();return _0x5e32c0[0x0];})[_0xbf4e('0xc')](respondWithResult(_0x2f3cf8,null))['catch'](handleError(_0x2f3cf8,null));}else{return _0x2f3cf8[_0xbf4e('0x7')](0x1f4)['send']({'message':_0xbf4e('0x1f')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index aafa61e..762630b 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 _0x2015=['/queues','isAuthenticated','getQueues','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x2015,0x193));var _0x5201=function(_0x3efcce,_0x3abec5){_0x3efcce=_0x3efcce-0x0;var _0x503290=_0x2015[_0x3efcce];return _0x503290;};'use strict';var express=require(_0x5201('0x0'));var router=express[_0x5201('0x1')]();var auth=require(_0x5201('0x2'));var controller=require(_0x5201('0x3'));router[_0x5201('0x4')](_0x5201('0x5'),auth[_0x5201('0x6')](),controller[_0x5201('0x7')]);module['exports']=router; \ No newline at end of file +var _0x8952=['get','/queues','getQueues','exports','Router','../../components/auth/service','./realtime.controller'];(function(_0x1ba5b5,_0x4fb5b7){var _0x489713=function(_0x326ac1){while(--_0x326ac1){_0x1ba5b5['push'](_0x1ba5b5['shift']());}};_0x489713(++_0x4fb5b7);}(_0x8952,0x17e));var _0x2895=function(_0x3e96a9,_0x4c7c03){_0x3e96a9=_0x3e96a9-0x0;var _0x3783ee=_0x8952[_0x3e96a9];return _0x3783ee;};'use strict';var express=require('express');var router=express[_0x2895('0x0')]();var auth=require(_0x2895('0x1'));var controller=require(_0x2895('0x2'));router[_0x2895('0x3')](_0x2895('0x4'),auth['isAuthenticated'](),controller[_0x2895('0x5')]);module[_0x2895('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e423626..2bbbf7c 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 _0x33af=['count','status','set','Content-Range','json','error','name','send','getQueues','mail','sms','fax','whatsapp','resolve','then','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','type','getOptions','role','user','userProfileId','UserProfile','getResources','findAndCountAll','voice','request','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','talking','paused','outbound','push','pTalking','originated','message','Trunk','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','loggedInDb','loggedIn','agents','rows','merge','getAgents','length','UserId','online','User','findAll','QueueId','agent','all','catch','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x33af,0xec));var _0xf33a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33af[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var _=require(_0xf33a('0x0'));var jayson=require('jayson/promise');var qs=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var client=jayson[_0xf33a('0x5')][_0xf33a('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xf33a('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x44cfa5,_0x583e54){return function(_0xc0dd13){if(_0xc0dd13){var _0x384b14=typeof _0x583e54[_0xf33a('0x7')]===_0xf33a('0x8')&&typeof _0x583e54[_0xf33a('0x9')]===_0xf33a('0x8');var _0x52517f=_0xc0dd13[_0xf33a('0xa')];var _0x14eb0e=_0x384b14?0x0:_0x583e54[_0xf33a('0x7')];var _0x457b3b=_0x384b14?_0xc0dd13[_0xf33a('0xa')]:_0x583e54[_0xf33a('0x7')]+_0x583e54['limit'];var _0x4ea282;if(_0x457b3b>=_0x52517f){_0x457b3b=_0x52517f;_0x4ea282=0xc8;}else{_0x4ea282=0xce;}_0x44cfa5[_0xf33a('0xb')](_0x4ea282);return _0x44cfa5[_0xf33a('0xc')](_0xf33a('0xd'),_0x14eb0e+'-'+_0x457b3b+'/'+_0x52517f)[_0xf33a('0xe')](_0xc0dd13);}return null;};}function handleError(_0x338d1b,_0x5959c9){_0x5959c9=_0x5959c9||0x1f4;return function(_0x9f87bc){logger[_0xf33a('0xf')](_0x9f87bc['stack']);if(_0x9f87bc['name']){delete _0x9f87bc[_0xf33a('0x10')];}_0x338d1b[_0xf33a('0xb')](_0x5959c9)[_0xf33a('0x11')](_0x9f87bc);};}exports[_0xf33a('0x12')]=function(_0x1e9be2,_0xc01217){var _0x45e311=[_0xf33a('0x13'),'chat',_0xf33a('0x14'),'openchannel',_0xf33a('0x15'),_0xf33a('0x16'),'voice'];var _0x37e76c={'count':0x0,'rows':[]},_0x25c931={},_0x524109;Promise[_0xf33a('0x17')]()[_0xf33a('0x18')](function(){if(_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')]){if(!_['includes'](_0x45e311,_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')][_0xf33a('0x1b')]()))throw new Error(_0xf33a('0x1c'));_0x524109=_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')][_0xf33a('0x1b')]();}var _0x288275=_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x1e');var _0x520dc4=_[_0xf33a('0x1f')](db[_0x288275][_0xf33a('0x20')],function(_0x1bf9bc){return{'name':_0x1bf9bc[_0xf33a('0x21')],'type':_0x1bf9bc[_0xf33a('0x22')]['key']};});_0x25c931=qs[_0xf33a('0x23')](_0x520dc4,_0x1e9be2);if(_0x1e9be2['user'][_0xf33a('0x24')]===_0xf33a('0x25')){var _0x394468={'params':{'id':_0x1e9be2[_0xf33a('0x25')][_0xf33a('0x26')]},'query':{'section':_0x524109==='voice'&&_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x22')]==='outbound'?'QueueCampaigns':_[_0xf33a('0x1d')](_0x524109)+'Queues','type':_0x1e9be2['query'][_0xf33a('0x22')],'nolimit':!![],'sort':'name','filter':_0x1e9be2[_0xf33a('0x19')]['filter']}};return db[_0xf33a('0x27')][_0xf33a('0x28')](_0x394468);}return db[_0x288275][_0xf33a('0x29')](_0x25c931);})[_0xf33a('0x18')](function(_0x4552c9){_0x37e76c[_0xf33a('0xa')]=_0x4552c9[_0xf33a('0xa')];var _0x1246ff=_0x524109===_0xf33a('0x2a')?client:routingClient;return _0x1246ff[_0xf33a('0x2b')](_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x2c'),_0x1e9be2)[_0xf33a('0x18')](function(_0x3f714e){if(_0x3f714e[_0xf33a('0xf')])throw new Error(util['format'](_0xf33a('0x2d'),_0x524109));var _0x293cb5=_0x3f714e[_0xf33a('0x2e')];var _0xbdc10e=['loggedIn',_0xf33a('0x2f'),_0xf33a('0x30'),_0xf33a('0x31'),_0xf33a('0x32')];if(_0x524109===_0xf33a('0x2a')&&_0x1e9be2[_0xf33a('0x19')]['type']===_0xf33a('0x33')){_0xbdc10e[_0xf33a('0x34')](_0xf33a('0x35'),_0xf33a('0x36'),_0xf33a('0x37'),'dialActive','dialMethod',_0xf33a('0x38'),'startPredictive','startProgressive','erlangCalls',_0xf33a('0x39'),_0xf33a('0x3a'),'erlangBusyFactor',_0xf33a('0x3b'),'dialPredictiveIntervalMaxThreshold',_0xf33a('0x3c'),_0xf33a('0x3d'),_0xf33a('0x3e'),_0xf33a('0x3f'),_0xf33a('0x40'),_0xf33a('0x41'),'predictiveIntervalAvgHoldtime',_0xf33a('0x42'));}var _0x29a39f=_0x4552c9['rows'][_0xf33a('0x1f')](function(_0x3793b4){var _0x3e0a98=_0x3793b4['get']({'plain':!![]});_0x3e0a98[_0xf33a('0x32')]=0x0;_0x3e0a98[_0xf33a('0x43')]=0x0;_0x3e0a98[_0xf33a('0x44')]=0x0;_0x3e0a98[_0xf33a('0x2f')]=0x0;_0x3e0a98[_0xf33a('0x32')]=0x0;_0x3e0a98[_0xf33a('0x30')]=0x0;if(_0x524109===_0xf33a('0x2a')){_0x3e0a98[_0xf33a('0x31')]=0x0;if(_0x1e9be2[_0xf33a('0x19')]['type']===_0xf33a('0x33')){_0x3e0a98[_0xf33a('0x35')]=0x0;_0x3e0a98['originated']=0x0;}}_0x3e0a98[_0xf33a('0x45')]=[];var _0x4c6906=_['find'](_0x293cb5[_0xf33a('0x46')],['id',_0x3e0a98['id']]);if(_0x4c6906)_[_0xf33a('0x47')](_0x3e0a98,_['pick'](_0x4c6906,_0xbdc10e));if(_0x524109===_0xf33a('0x2a')){return _0x3793b4[_0xf33a('0x48')]({'attributes':['id',_0xf33a('0x10'),'online'],'joinTableAttributes':[],'raw':!![]})[_0xf33a('0x18')](function(_0x21b8da){return _0x3793b4['getMembers']({'raw':!![]})[_0xf33a('0x18')](function(_0x20e57b){for(var _0x36b9c9=0x0;_0x36b9c9<_0x21b8da[_0xf33a('0x49')];_0x36b9c9++){var _0x40954c=_['find'](_0x20e57b,[_0xf33a('0x4a'),_0x21b8da[_0x36b9c9]['id']]);var _0x1722e5={'id':_0x21b8da[_0x36b9c9]['id'],'name':_0x21b8da[_0x36b9c9][_0xf33a('0x10')],'online':Boolean(_0x21b8da[_0x36b9c9][_0xf33a('0x4b')]),'paused':_0x40954c?Boolean(_0x40954c[_0xf33a('0x32')]):![]};if(_0x1722e5['online'])_0x3e0a98[_0xf33a('0x43')]++;if(_0x1722e5[_0xf33a('0x32')])_0x3e0a98[_0xf33a('0x32')]++;_0x3e0a98['agents'][_0xf33a('0x34')](_0x1722e5);}return _0x3e0a98;});});}else{var _0x43889e=_0xf33a('0x4c')+_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x1e');var _0x6380fa=_0x524109+'Pause';return db[_0x43889e][_0xf33a('0x4d')]({'where':{[_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x4e')]:_0x3793b4['id']},'raw':!![]})[_0xf33a('0x18')](function(_0x229533){return db['User'][_0xf33a('0x4d')]({'attributes':['id',_0xf33a('0x10'),_0xf33a('0x4b'),_0x6380fa],'where':{'id':_['map'](_0x229533,_0xf33a('0x4a')),'role':_0xf33a('0x4f')},'raw':!![]});})['then'](function(_0x4c0f24){for(var _0x3cb451=0x0;_0x3cb451<_0x4c0f24['length'];_0x3cb451++){var _0x36b8f6={'id':_0x4c0f24[_0x3cb451]['id'],'name':_0x4c0f24[_0x3cb451][_0xf33a('0x10')],'online':Boolean(_0x4c0f24[_0x3cb451][_0xf33a('0x4b')]),'paused':Boolean(_0x4c0f24[_0x3cb451][_0x6380fa])};if(_0x36b8f6[_0xf33a('0x4b')])_0x3e0a98[_0xf33a('0x43')]++;if(_0x36b8f6[_0xf33a('0x32')])_0x3e0a98[_0xf33a('0x32')]++;_0x3e0a98[_0xf33a('0x45')][_0xf33a('0x34')](_0x36b8f6);}return _0x3e0a98;});}});return Promise[_0xf33a('0x50')](_0x29a39f);});})[_0xf33a('0x18')](function(_0x4107b1){_0x37e76c[_0xf33a('0x46')]=_0x4107b1;return _0x37e76c;})[_0xf33a('0x18')](respondWithFilteredResult(_0xc01217,_0x25c931))[_0xf33a('0x51')](handleError(_0xc01217,null));}; \ No newline at end of file +var _0xafc4=['predictiveIntervalAvgTalktime','get','loggedInDb','agents','find','rows','merge','pick','getAgents','getMembers','length','online','User','Pause','findAll','QueueId','UserId','all','catch','util','jayson/promise','../../config/logger','api','../../mysqldb','client','offset','undefined','count','limit','status','set','json','error','stack','name','send','getQueues','chat','openchannel','fax','whatsapp','voice','resolve','then','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','map','fieldName','key','user','role','userProfileId','type','outbound','QueueCampaigns','Queues','findAndCountAll','format','result','loggedIn','available','waiting','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xafc4,0x69));var _0x4afc=function(_0x3282a2,_0x32a6c1){_0x3282a2=_0x3282a2-0x0;var _0x25c6bb=_0xafc4[_0x3282a2];return _0x25c6bb;};'use strict';var util=require(_0x4afc('0x0'));var _=require('lodash');var jayson=require(_0x4afc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x4afc('0x2'))(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var client=jayson[_0x4afc('0x5')]['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x36cb50,_0x471d45){return function(_0x16953b){if(_0x16953b){var _0x1bb281=typeof _0x471d45[_0x4afc('0x6')]===_0x4afc('0x7')&&typeof _0x471d45['limit']===_0x4afc('0x7');var _0x1c740c=_0x16953b[_0x4afc('0x8')];var _0x1e6bf5=_0x1bb281?0x0:_0x471d45[_0x4afc('0x6')];var _0x458fde=_0x1bb281?_0x16953b['count']:_0x471d45['offset']+_0x471d45[_0x4afc('0x9')];var _0x49222e;if(_0x458fde>=_0x1c740c){_0x458fde=_0x1c740c;_0x49222e=0xc8;}else{_0x49222e=0xce;}_0x36cb50[_0x4afc('0xa')](_0x49222e);return _0x36cb50[_0x4afc('0xb')]('Content-Range',_0x1e6bf5+'-'+_0x458fde+'/'+_0x1c740c)[_0x4afc('0xc')](_0x16953b);}return null;};}function handleError(_0x3fb54a,_0x2b191c){_0x2b191c=_0x2b191c||0x1f4;return function(_0x2768bf){logger[_0x4afc('0xd')](_0x2768bf[_0x4afc('0xe')]);if(_0x2768bf[_0x4afc('0xf')]){delete _0x2768bf[_0x4afc('0xf')];}_0x3fb54a['status'](_0x2b191c)[_0x4afc('0x10')](_0x2768bf);};}exports[_0x4afc('0x11')]=function(_0x2c636b,_0x1e2c31){var _0x5f2dc9=['mail',_0x4afc('0x12'),'sms',_0x4afc('0x13'),_0x4afc('0x14'),_0x4afc('0x15'),_0x4afc('0x16')];var _0x3a306f={'count':0x0,'rows':[]},_0x3ebdc8={},_0x22f809;Promise[_0x4afc('0x17')]()[_0x4afc('0x18')](function(){if(_0x2c636b[_0x4afc('0x19')][_0x4afc('0x1a')]){if(!_['includes'](_0x5f2dc9,_0x2c636b[_0x4afc('0x19')][_0x4afc('0x1a')][_0x4afc('0x1b')]()))throw new Error(_0x4afc('0x1c'));_0x22f809=_0x2c636b['query'][_0x4afc('0x1a')][_0x4afc('0x1b')]();}var _0x2de6e9=_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x1e');var _0x3add4c=_[_0x4afc('0x1f')](db[_0x2de6e9]['rawAttributes'],function(_0x5403e4){return{'name':_0x5403e4[_0x4afc('0x20')],'type':_0x5403e4['type'][_0x4afc('0x21')]};});_0x3ebdc8=qs['getOptions'](_0x3add4c,_0x2c636b);if(_0x2c636b[_0x4afc('0x22')][_0x4afc('0x23')]===_0x4afc('0x22')){var _0x2876f2={'params':{'id':_0x2c636b[_0x4afc('0x22')][_0x4afc('0x24')]},'query':{'section':_0x22f809===_0x4afc('0x16')&&_0x2c636b[_0x4afc('0x19')][_0x4afc('0x25')]===_0x4afc('0x26')?_0x4afc('0x27'):_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x28'),'type':_0x2c636b['query'][_0x4afc('0x25')],'nolimit':!![],'sort':_0x4afc('0xf'),'filter':_0x2c636b[_0x4afc('0x19')]['filter']}};return db['UserProfile']['getResources'](_0x2876f2);}return db[_0x2de6e9][_0x4afc('0x29')](_0x3ebdc8);})[_0x4afc('0x18')](function(_0x5e4747){_0x3a306f[_0x4afc('0x8')]=_0x5e4747[_0x4afc('0x8')];var _0x494fe7=_0x22f809==='voice'?client:routingClient;return _0x494fe7['request'](_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x28'),_0x2c636b)[_0x4afc('0x18')](function(_0x46357b){if(_0x46357b[_0x4afc('0xd')])throw new Error(util[_0x4afc('0x2a')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x22f809));var _0x290391=_0x46357b[_0x4afc('0x2b')];var _0x1ba6b5=[_0x4afc('0x2c'),_0x4afc('0x2d'),_0x4afc('0x2e'),_0x4afc('0x2f'),_0x4afc('0x30')];if(_0x22f809==='voice'&&_0x2c636b[_0x4afc('0x19')]['type']==='outbound'){_0x1ba6b5[_0x4afc('0x31')](_0x4afc('0x32'),_0x4afc('0x33'),_0x4afc('0x34'),_0x4afc('0x35'),_0x4afc('0x36'),'Trunk',_0x4afc('0x37'),_0x4afc('0x38'),_0x4afc('0x39'),_0x4afc('0x3a'),_0x4afc('0x3b'),_0x4afc('0x3c'),'dialPredictiveInterval',_0x4afc('0x3d'),_0x4afc('0x3e'),_0x4afc('0x3f'),_0x4afc('0x40'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x4afc('0x41'),_0x4afc('0x42'),_0x4afc('0x43'));}var _0x5edfe1=_0x5e4747['rows'][_0x4afc('0x1f')](function(_0x4a06cf){var _0x5947bb=_0x4a06cf[_0x4afc('0x44')]({'plain':!![]});_0x5947bb[_0x4afc('0x30')]=0x0;_0x5947bb[_0x4afc('0x45')]=0x0;_0x5947bb[_0x4afc('0x2c')]=0x0;_0x5947bb[_0x4afc('0x2d')]=0x0;_0x5947bb[_0x4afc('0x30')]=0x0;_0x5947bb[_0x4afc('0x2e')]=0x0;if(_0x22f809===_0x4afc('0x16')){_0x5947bb[_0x4afc('0x2f')]=0x0;if(_0x2c636b[_0x4afc('0x19')][_0x4afc('0x25')]===_0x4afc('0x26')){_0x5947bb[_0x4afc('0x32')]=0x0;_0x5947bb[_0x4afc('0x33')]=0x0;}}_0x5947bb[_0x4afc('0x46')]=[];var _0x5589be=_[_0x4afc('0x47')](_0x290391[_0x4afc('0x48')],['id',_0x5947bb['id']]);if(_0x5589be)_[_0x4afc('0x49')](_0x5947bb,_[_0x4afc('0x4a')](_0x5589be,_0x1ba6b5));if(_0x22f809===_0x4afc('0x16')){return _0x4a06cf[_0x4afc('0x4b')]({'attributes':['id',_0x4afc('0xf'),'online'],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x5ee5d7){return _0x4a06cf[_0x4afc('0x4c')]({'raw':!![]})[_0x4afc('0x18')](function(_0x5c515a){for(var _0xe62748=0x0;_0xe62748<_0x5ee5d7[_0x4afc('0x4d')];_0xe62748++){var _0x8ba5e6=_[_0x4afc('0x47')](_0x5c515a,['UserId',_0x5ee5d7[_0xe62748]['id']]);var _0x12b5db={'id':_0x5ee5d7[_0xe62748]['id'],'name':_0x5ee5d7[_0xe62748][_0x4afc('0xf')],'online':Boolean(_0x5ee5d7[_0xe62748][_0x4afc('0x4e')]),'paused':_0x8ba5e6?Boolean(_0x8ba5e6[_0x4afc('0x30')]):![]};if(_0x12b5db[_0x4afc('0x4e')])_0x5947bb[_0x4afc('0x45')]++;if(_0x12b5db['paused'])_0x5947bb[_0x4afc('0x30')]++;_0x5947bb['agents'][_0x4afc('0x31')](_0x12b5db);}return _0x5947bb;});});}else{var _0x33117f=_0x4afc('0x4f')+_['startCase'](_0x22f809)+'Queue';var _0x366eac=_0x22f809+_0x4afc('0x50');return db[_0x33117f][_0x4afc('0x51')]({'where':{[_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x52')]:_0x4a06cf['id']},'raw':!![]})[_0x4afc('0x18')](function(_0x42ecb6){return db[_0x4afc('0x4f')]['findAll']({'attributes':['id',_0x4afc('0xf'),_0x4afc('0x4e'),_0x366eac],'where':{'id':_['map'](_0x42ecb6,_0x4afc('0x53')),'role':'agent'},'raw':!![]});})[_0x4afc('0x18')](function(_0x24a731){for(var _0x16c6c4=0x0;_0x16c6c4<_0x24a731['length'];_0x16c6c4++){var _0xd0f517={'id':_0x24a731[_0x16c6c4]['id'],'name':_0x24a731[_0x16c6c4][_0x4afc('0xf')],'online':Boolean(_0x24a731[_0x16c6c4][_0x4afc('0x4e')]),'paused':Boolean(_0x24a731[_0x16c6c4][_0x366eac])};if(_0xd0f517[_0x4afc('0x4e')])_0x5947bb[_0x4afc('0x45')]++;if(_0xd0f517[_0x4afc('0x30')])_0x5947bb['paused']++;_0x5947bb['agents']['push'](_0xd0f517);}return _0x5947bb;});}});return Promise[_0x4afc('0x54')](_0x5edfe1);});})[_0x4afc('0x18')](function(_0x42e274){_0x3a306f[_0x4afc('0x48')]=_0x42e274;return _0x3a306f;})[_0x4afc('0x18')](respondWithFilteredResult(_0x1e2c31,_0x3ebdc8))[_0x4afc('0x55')](handleError(_0x1e2c31,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ad5bc81..cb8fdfc 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x340dc0,_0x2a3031){var _0x48fd67=function(_0x1a4280){while(--_0x1a4280){_0x340dc0['push'](_0x340dc0['shift']());}};_0x48fd67(++_0x2a3031);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4749bc,_0xd777b9){var _0x4b5918=function(_0x3f5cf4){while(--_0x3f5cf4){_0x4749bc['push'](_0x4749bc['shift']());}};_0x4b5918(++_0xd777b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 16497ff..15beb53 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 _0x7f94=['DATE','sequelize','INTEGER','STRING'];(function(_0x4db927,_0x8c733e){var _0x461aea=function(_0x2a7544){while(--_0x2a7544){_0x4db927['push'](_0x4db927['shift']());}};_0x461aea(++_0x8c733e);}(_0x7f94,0x65));var _0x47f9=function(_0xbc8066,_0x31264d){_0xbc8066=_0xbc8066-0x0;var _0x2ae2bd=_0x7f94[_0xbc8066];return _0x2ae2bd;};'use strict';var Sequelize=require(_0x47f9('0x0'));module['exports']={'state':{'type':Sequelize[_0x47f9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x47f9('0x2')]},'scheduledat':{'type':Sequelize[_0x47f9('0x3')]},'uniqueid':{'type':Sequelize[_0x47f9('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x47f9('0x3')]},'ringtime':{'type':Sequelize[_0x47f9('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x47f9('0x2')]},'campaigntype':{'type':Sequelize[_0x47f9('0x2')]},'membername':{'type':Sequelize[_0x47f9('0x2')]}}; \ No newline at end of file +var _0xb073=['STRING','DATE','INTEGER','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb073,0x187));var _0x3b07=function(_0x22d236,_0x250b09){_0x22d236=_0x22d236-0x0;var _0x1ac2b9=_0xb073[_0x22d236];return _0x1ac2b9;};'use strict';var Sequelize=require('sequelize');module[_0x3b07('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3b07('0x1')]},'scheduledat':{'type':Sequelize[_0x3b07('0x2')]},'uniqueid':{'type':Sequelize[_0x3b07('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3b07('0x2')]},'ringtime':{'type':Sequelize[_0x3b07('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3b07('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3b07('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index e620f04..0c04882 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 _0xffed=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','api','request-promise','path','rimraf'];(function(_0x51fe12,_0x127e56){var _0x4acf77=function(_0x1ec511){while(--_0x1ec511){_0x51fe12['push'](_0x51fe12['shift']());}};_0x4acf77(++_0x127e56);}(_0xffed,0x9b));var _0xdffe=function(_0x37e392,_0x517868){_0x37e392=_0x37e392-0x0;var _0x12e695=_0xffed[_0x37e392];return _0x12e695;};'use strict';var _=require(_0xdffe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdffe('0x2'));var fs=require('fs');var path=require(_0xdffe('0x3'));var rimraf=require(_0xdffe('0x4'));var config=require('../../config/environment');var attributes=require(_0xdffe('0x5'));module[_0xdffe('0x6')]=function(_0x4c669f,_0x32046f){return _0x4c669f[_0xdffe('0x7')](_0xdffe('0x8'),attributes,{'tableName':_0xdffe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe982=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x2a6c9c,_0x5b380d){var _0xed48d6=function(_0x24ec16){while(--_0x24ec16){_0x2a6c9c['push'](_0x2a6c9c['shift']());}};_0xed48d6(++_0x5b380d);}(_0xe982,0x159));var _0x2e98=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe982[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2e98('0x0'));var util=require(_0x2e98('0x1'));var logger=require(_0x2e98('0x2'))(_0x2e98('0x3'));var moment=require(_0x2e98('0x4'));var BPromise=require(_0x2e98('0x5'));var rp=require(_0x2e98('0x6'));var fs=require('fs');var path=require(_0x2e98('0x7'));var rimraf=require(_0x2e98('0x8'));var config=require(_0x2e98('0x9'));var attributes=require(_0x2e98('0xa'));module[_0x2e98('0xb')]=function(_0x43f246,_0x269dd4){return _0x43f246[_0x2e98('0xc')](_0x2e98('0xd'),attributes,{'tableName':_0x2e98('0xe'),'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 d8ad32c..7debbf6 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 _0xd14a=['message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x2c6e86,_0x594664){var _0x2a8a10=function(_0x22b6d2){while(--_0x22b6d2){_0x2c6e86['push'](_0x2c6e86['shift']());}};_0x2a8a10(++_0x594664);}(_0xd14a,0x1da));var _0xad14=function(_0x4ab845,_0x1c0a0b){_0x4ab845=_0x4ab845-0x0;var _0x5cfaf0=_0xd14a[_0x4ab845];return _0x5cfaf0;};'use strict';var _=require(_0xad14('0x0'));var util=require('util');var moment=require(_0xad14('0x1'));var BPromise=require(_0xad14('0x2'));var rs=require(_0xad14('0x3'));var fs=require('fs');var Redis=require(_0xad14('0x4'));var db=require(_0xad14('0x5'))['db'];var utils=require(_0xad14('0x6'));var logger=require(_0xad14('0x7'))(_0xad14('0x8'));var config=require('../../config/environment');var jayson=require(_0xad14('0x9'));var client=jayson[_0xad14('0xa')][_0xad14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24310b,_0x68b527,_0xa15874){return new BPromise(function(_0x5968a4,_0x2a81ad){return client[_0xad14('0xc')](_0x24310b,_0xa15874)[_0xad14('0xd')](function(_0x3bd618){logger[_0xad14('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x68b527,'request\x20sent');logger[_0xad14('0xf')](_0xad14('0x10'),_0x68b527,_0xad14('0x11'),JSON[_0xad14('0x12')](_0x3bd618));if(_0x3bd618['error']){if(_0x3bd618[_0xad14('0x13')][_0xad14('0x14')]===0x1f4){logger['error'](_0xad14('0x15'),_0x68b527,_0x3bd618[_0xad14('0x13')][_0xad14('0x16')]);return _0x2a81ad(_0x3bd618[_0xad14('0x13')][_0xad14('0x16')]);}logger[_0xad14('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x68b527,_0x3bd618['error']['message']);return _0x5968a4(_0x3bd618[_0xad14('0x13')][_0xad14('0x16')]);}else{logger[_0xad14('0xe')](_0xad14('0x15'),_0x68b527,_0xad14('0x11'));_0x5968a4(_0x3bd618[_0xad14('0x17')][_0xad14('0x16')]);}})[_0xad14('0x18')](function(_0x1b8d53){logger[_0xad14('0x13')](_0xad14('0x15'),_0x68b527,_0x1b8d53);_0x2a81ad(_0x1b8d53);});});}exports[_0xad14('0x19')]=function(_0x28c7dd){var _0x1c4078=this;return new Promise(function(_0x2f3d05,_0x20114e){return db[_0xad14('0x1a')][_0xad14('0x1b')](_0x28c7dd[_0xad14('0x1c')],{'raw':_0x28c7dd[_0xad14('0x1d')]?_0x28c7dd[_0xad14('0x1d')][_0xad14('0x1e')]===undefined?!![]:![]:!![]})[_0xad14('0xd')](function(_0x15ce14){logger['info'](_0xad14('0x19'),_0x28c7dd);logger[_0xad14('0xf')](_0xad14('0x19'),_0x28c7dd,JSON['stringify'](_0x15ce14));_0x2f3d05(_0x15ce14);})['catch'](function(_0x595f90){logger[_0xad14('0x13')](_0xad14('0x19'),_0x595f90[_0xad14('0x16')],_0x28c7dd);_0x20114e(_0x1c4078['error'](0x1f4,_0x595f90[_0xad14('0x16')]));});});}; \ No newline at end of file +var _0x96ab=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','util','moment','randomstring'];(function(_0x3f7a1e,_0x3c59c8){var _0x9d25d7=function(_0x468204){while(--_0x468204){_0x3f7a1e['push'](_0x3f7a1e['shift']());}};_0x9d25d7(++_0x3c59c8);}(_0x96ab,0xf0));var _0xb96a=function(_0x9c02ae,_0x38b639){_0x9c02ae=_0x9c02ae-0x0;var _0x26bc58=_0x96ab[_0x9c02ae];return _0x26bc58;};'use strict';var _=require('lodash');var util=require(_0xb96a('0x0'));var moment=require(_0xb96a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb96a('0x2'));var fs=require('fs');var Redis=require(_0xb96a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb96a('0x4'));var logger=require(_0xb96a('0x5'))('rpc');var config=require(_0xb96a('0x6'));var jayson=require(_0xb96a('0x7'));var client=jayson[_0xb96a('0x8')][_0xb96a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262404,_0x9e10a4,_0x278a8e){return new BPromise(function(_0x5133cd,_0x24440b){return client[_0xb96a('0xa')](_0x262404,_0x278a8e)[_0xb96a('0xb')](function(_0xf065de){logger[_0xb96a('0xc')](_0xb96a('0xd'),_0x9e10a4,_0xb96a('0xe'));logger[_0xb96a('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x9e10a4,_0xb96a('0xe'),JSON[_0xb96a('0x10')](_0xf065de));if(_0xf065de[_0xb96a('0x11')]){if(_0xf065de[_0xb96a('0x11')][_0xb96a('0x12')]===0x1f4){logger[_0xb96a('0x11')](_0xb96a('0xd'),_0x9e10a4,_0xf065de[_0xb96a('0x11')][_0xb96a('0x13')]);return _0x24440b(_0xf065de[_0xb96a('0x11')][_0xb96a('0x13')]);}logger[_0xb96a('0x11')](_0xb96a('0xd'),_0x9e10a4,_0xf065de[_0xb96a('0x11')]['message']);return _0x5133cd(_0xf065de['error'][_0xb96a('0x13')]);}else{logger['info'](_0xb96a('0xd'),_0x9e10a4,_0xb96a('0xe'));_0x5133cd(_0xf065de[_0xb96a('0x14')][_0xb96a('0x13')]);}})[_0xb96a('0x15')](function(_0xbd358e){logger[_0xb96a('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x9e10a4,_0xbd358e);_0x24440b(_0xbd358e);});});}exports[_0xb96a('0x16')]=function(_0x832c74){var _0x2551a6=this;return new Promise(function(_0x37ed44,_0xd44395){return db[_0xb96a('0x17')][_0xb96a('0x18')](_0x832c74[_0xb96a('0x19')],{'raw':_0x832c74[_0xb96a('0x1a')]?_0x832c74[_0xb96a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb96a('0xb')](function(_0x36ed86){logger[_0xb96a('0xc')](_0xb96a('0x16'),_0x832c74);logger[_0xb96a('0xf')]('CreateReportAgentPreview',_0x832c74,JSON[_0xb96a('0x10')](_0x36ed86));_0x37ed44(_0x36ed86);})[_0xb96a('0x15')](function(_0x555832){logger['error'](_0xb96a('0x16'),_0x555832['message'],_0x832c74);_0xd44395(_0x2551a6[_0xb96a('0x11')](0x1f4,_0x555832[_0xb96a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 35751f5..ddeebc0 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 _0x989b=['chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','post','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','Router','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x989b,0x187));var _0xb989=function(_0x2cea7f,_0x75d681){_0x2cea7f=_0x2cea7f-0x0;var _0x381779=_0x989b[_0x2cea7f];return _0x381779;};'use strict';var multer=require(_0xb989('0x0'));var util=require(_0xb989('0x1'));var path=require(_0xb989('0x2'));var express=require(_0xb989('0x3'));var router=express[_0xb989('0x4')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0xb989('0x5')](_0xb989('0x6'),auth[_0xb989('0x7')](),controller[_0xb989('0x8')]);router[_0xb989('0x5')](_0xb989('0x9'),auth[_0xb989('0x7')](),controller[_0xb989('0xa')]);router[_0xb989('0x5')](_0xb989('0xb'),auth[_0xb989('0x7')](),controller[_0xb989('0xc')]);router[_0xb989('0x5')]('/voice/queues',auth[_0xb989('0x7')](),controller[_0xb989('0xd')]);router[_0xb989('0x5')]('/chat/queues',auth[_0xb989('0x7')](),controller[_0xb989('0xe')]);router[_0xb989('0x5')](_0xb989('0xf'),auth[_0xb989('0x7')](),controller[_0xb989('0x10')]);router[_0xb989('0x5')]('/mail/accounts',auth[_0xb989('0x7')](),controller[_0xb989('0x11')]);router[_0xb989('0x5')](_0xb989('0x12'),auth[_0xb989('0x7')](),controller[_0xb989('0x13')]);router[_0xb989('0x5')](_0xb989('0x14'),auth['isAuthenticated'](),controller[_0xb989('0x15')]);router[_0xb989('0x5')](_0xb989('0x16'),auth[_0xb989('0x7')](),controller[_0xb989('0x17')]);router['get'](_0xb989('0x18'),auth[_0xb989('0x7')](),controller['faxQueues']);router[_0xb989('0x5')](_0xb989('0x19'),auth[_0xb989('0x7')](),controller[_0xb989('0x1a')]);router['get'](_0xb989('0x1b'),auth[_0xb989('0x7')](),controller[_0xb989('0x1c')]);router[_0xb989('0x5')](_0xb989('0x1d'),auth['isAuthenticated'](),controller[_0xb989('0x1e')]);router['get'](_0xb989('0x1f'),auth[_0xb989('0x7')](),controller[_0xb989('0x20')]);router[_0xb989('0x5')](_0xb989('0x21'),auth[_0xb989('0x7')](),controller[_0xb989('0x22')]);router['get'](_0xb989('0x23'),auth['isAuthenticated'](),controller[_0xb989('0x24')]);router[_0xb989('0x25')](_0xb989('0x23'),auth['isAuthenticated'](),controller[_0xb989('0x26')]);router[_0xb989('0x5')](_0xb989('0x27'),auth[_0xb989('0x7')](),controller[_0xb989('0x28')]);router[_0xb989('0x5')](_0xb989('0x29'),auth['isAuthenticated'](),controller[_0xb989('0x2a')]);router['get'](_0xb989('0x2b'),auth[_0xb989('0x7')](),controller['agents']);router[_0xb989('0x25')](_0xb989('0x2c'),auth['isAuthenticated'](),controller[_0xb989('0x2d')]);router[_0xb989('0x5')](_0xb989('0x2e'),auth[_0xb989('0x7')](),controller[_0xb989('0x2f')]);router['get']('/trunks',auth[_0xb989('0x7')](),controller[_0xb989('0x30')]);router[_0xb989('0x5')]('/campaigns',auth[_0xb989('0x7')](),controller[_0xb989('0x31')]);router[_0xb989('0x5')](_0xb989('0x32'),auth['isAuthenticated'](),controller['faxAccounts']);router['get'](_0xb989('0x33'),auth[_0xb989('0x7')](),controller[_0xb989('0x34')]);router[_0xb989('0x5')](_0xb989('0x35'),auth[_0xb989('0x7')](),controller[_0xb989('0x36')]);router[_0xb989('0x5')]('/openchannel/queues/waitinginteractions',auth[_0xb989('0x7')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xb989('0x7')](),controller[_0xb989('0x37')]);router['get'](_0xb989('0x38'),auth[_0xb989('0x7')](),controller[_0xb989('0x39')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xb989('0x7')](),controller[_0xb989('0x3a')]);router['get'](_0xb989('0x3b'),auth[_0xb989('0x7')](),controller[_0xb989('0x3c')]);router['post'](_0xb989('0x3d'),auth['isAuthenticated'](),controller[_0xb989('0x3e')](_0xb989('0x3f')));router['get'](_0xb989('0x40'),auth[_0xb989('0x7')](),controller[_0xb989('0x41')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb989('0x3e')]('chat'));router[_0xb989('0x5')](_0xb989('0x42'),auth['isAuthenticated'](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0xb989('0x7')](),controller[_0xb989('0x3e')](_0xb989('0x43')));router[_0xb989('0x5')](_0xb989('0x44'),auth[_0xb989('0x7')](),controller[_0xb989('0x45')]);router[_0xb989('0x46')](_0xb989('0x47'),auth[_0xb989('0x7')](),controller[_0xb989('0x3e')](_0xb989('0x48')));router[_0xb989('0x5')](_0xb989('0x49'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xb989('0x46')](_0xb989('0x4a'),auth[_0xb989('0x7')](),controller[_0xb989('0x3e')]('sms'));router[_0xb989('0x46')](_0xb989('0x4b'),auth[_0xb989('0x7')](),controller[_0xb989('0x3e')](_0xb989('0x4c')));router[_0xb989('0x5')](_0xb989('0x4d'),auth[_0xb989('0x7')](),controller[_0xb989('0x4e')]);router['get']('/whatsapp/queues/:id',auth[_0xb989('0x7')](),controller[_0xb989('0x4f')]);router[_0xb989('0x46')](_0xb989('0x50'),auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x828a=['telephones','/trunks','trunks','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','/agents/:id/capacity'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x828a,0xff));var _0xa828=function(_0x5efe42,_0x10ff15){_0x5efe42=_0x5efe42-0x0;var _0x25feb2=_0x828a[_0x5efe42];return _0x25feb2;};'use strict';var multer=require(_0xa828('0x0'));var util=require('util');var path=require(_0xa828('0x1'));var express=require(_0xa828('0x2'));var router=express[_0xa828('0x3')]();var auth=require(_0xa828('0x4'));var controller=require(_0xa828('0x5'));router[_0xa828('0x6')](_0xa828('0x7'),auth[_0xa828('0x8')](),controller[_0xa828('0x9')]);router[_0xa828('0x6')](_0xa828('0xa'),auth[_0xa828('0x8')](),controller['voiceChannelMixMonitor']);router[_0xa828('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xa828('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xa828('0x6')](_0xa828('0xb'),auth[_0xa828('0x8')](),controller['voiceQueues']);router[_0xa828('0x6')](_0xa828('0xc'),auth[_0xa828('0x8')](),controller[_0xa828('0xd')]);router[_0xa828('0x6')](_0xa828('0xe'),auth[_0xa828('0x8')](),controller[_0xa828('0xf')]);router[_0xa828('0x6')]('/mail/accounts',auth[_0xa828('0x8')](),controller[_0xa828('0x10')]);router[_0xa828('0x6')](_0xa828('0x11'),auth['isAuthenticated'](),controller[_0xa828('0x12')]);router[_0xa828('0x6')](_0xa828('0x13'),auth['isAuthenticated'](),controller[_0xa828('0x14')]);router[_0xa828('0x6')](_0xa828('0x15'),auth[_0xa828('0x8')](),controller['whatsappQueues']);router[_0xa828('0x6')](_0xa828('0x16'),auth['isAuthenticated'](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth[_0xa828('0x8')](),controller['voiceQueuesPreview']);router[_0xa828('0x6')](_0xa828('0x17'),auth[_0xa828('0x8')](),controller[_0xa828('0x18')]);router['get'](_0xa828('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xa828('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xa828('0x8')](),controller[_0xa828('0x1a')]);router[_0xa828('0x6')](_0xa828('0x1b'),auth['isAuthenticated'](),controller[_0xa828('0x1c')]);router[_0xa828('0x6')](_0xa828('0x1d'),auth[_0xa828('0x8')](),controller[_0xa828('0x1e')]);router[_0xa828('0x1f')]('/voice/queues/:id',auth[_0xa828('0x8')](),controller['updateVoiceQueue']);router[_0xa828('0x6')](_0xa828('0x20'),auth[_0xa828('0x8')](),controller[_0xa828('0x21')]);router['get'](_0xa828('0x22'),auth[_0xa828('0x8')](),controller['outboundChannels']);router[_0xa828('0x6')](_0xa828('0x23'),auth['isAuthenticated'](),controller['agents']);router[_0xa828('0x1f')](_0xa828('0x24'),auth[_0xa828('0x8')](),controller['agentCapacity']);router['get']('/telephones',auth[_0xa828('0x8')](),controller[_0xa828('0x25')]);router['get'](_0xa828('0x26'),auth[_0xa828('0x8')](),controller[_0xa828('0x27')]);router['get']('/campaigns',auth[_0xa828('0x8')](),controller['campaigns']);router[_0xa828('0x6')](_0xa828('0x28'),auth[_0xa828('0x8')](),controller[_0xa828('0x29')]);router[_0xa828('0x6')]('/chat/queues/waitinginteractions',auth[_0xa828('0x8')](),controller[_0xa828('0x2a')]);router['get'](_0xa828('0x2b'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xa828('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xa828('0x8')](),controller[_0xa828('0x2c')]);router['get'](_0xa828('0x2d'),auth['isAuthenticated'](),controller[_0xa828('0x2e')]);router[_0xa828('0x6')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xa828('0x2f')]);router[_0xa828('0x6')](_0xa828('0x30'),auth['isAuthenticated'](),controller[_0xa828('0x31')]);router[_0xa828('0x6')](_0xa828('0x32'),auth[_0xa828('0x8')](),controller[_0xa828('0x33')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0xa828('0x34')](_0xa828('0x35')));router['get'](_0xa828('0x36'),auth[_0xa828('0x8')](),controller['showMailQueues']);router[_0xa828('0x37')](_0xa828('0x38'),auth[_0xa828('0x8')](),controller[_0xa828('0x34')]('chat'));router[_0xa828('0x6')](_0xa828('0x39'),auth['isAuthenticated'](),controller[_0xa828('0x3a')]);router['post']('/fax/queues/:id/notify',auth[_0xa828('0x8')](),controller[_0xa828('0x34')](_0xa828('0x3b')));router[_0xa828('0x6')](_0xa828('0x3c'),auth[_0xa828('0x8')](),controller[_0xa828('0x3d')]);router[_0xa828('0x37')](_0xa828('0x3e'),auth[_0xa828('0x8')](),controller[_0xa828('0x34')]('openchannel'));router['get'](_0xa828('0x3f'),auth[_0xa828('0x8')](),controller['showOpenchannelQueues']);router[_0xa828('0x37')](_0xa828('0x40'),auth[_0xa828('0x8')](),controller[_0xa828('0x34')](_0xa828('0x41')));router[_0xa828('0x37')](_0xa828('0x42'),auth[_0xa828('0x8')](),controller[_0xa828('0x34')](_0xa828('0x43')));router[_0xa828('0x6')](_0xa828('0x44'),auth['isAuthenticated'](),controller[_0xa828('0x45')]);router[_0xa828('0x6')]('/whatsapp/queues/:id',auth[_0xa828('0x8')](),controller['showWhatsappQueues']);router['post'](_0xa828('0x46'),auth[_0xa828('0x8')](),controller[_0xa828('0x47')]);module[_0xa828('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8522927..e6227ee 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 _0x46ed=['send','isNil','rows','VoiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','name'];(function(_0xf8e505,_0x29fafc){var _0x46576e=function(_0x21219b){while(--_0x21219b){_0xf8e505['push'](_0xf8e505['shift']());}};_0x46576e(++_0x29fafc);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var BPromise=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var _=require('lodash');var util=require(_0xd46e('0x2'));var db=require(_0xd46e('0x3'))['db'];var logger=require(_0xd46e('0x4'))('api');var jayson=require(_0xd46e('0x5'));var amiClient=jayson[_0xd46e('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232b});var routingClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){var _0x19e4f4=_0x437ea0?_0x437ea0:amiClient;return _0x19e4f4[_0xd46e('0x8')](_0x45e680,_0x855f24)['then'](function(_0x7b2d69){if(_0x7b2d69[_0xd46e('0x9')]){if(_0x7b2d69['error'][_0xd46e('0xa')]===0x1f4){return _0x31259b(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}return _0x144687(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}else{_0x144687(_0x7b2d69[_0xd46e('0xc')]);}})['catch'](function(_0x24c54b){_0x31259b(_0x24c54b);});});}function respondWithResult(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xc8;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0xd')](_0x48550b)['json'](_0xf3048c);}return _0x5bc1da['sendStatus'](0x194);};}function handleError(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0x1f4;return function(_0x1e9aae){logger[_0xd46e('0x9')](_0x1e9aae['stack']);if(_0x1e9aae[_0xd46e('0xe')]){delete _0x1e9aae[_0xd46e('0xe')];}_0xacd799[_0xd46e('0xd')](_0x4688ae)[_0xd46e('0xf')](_0x1e9aae);};}function findById(_0x36a317){return function(_0x47fa8f){if(!_[_0xd46e('0x10')](_0x36a317)&&!_[_0xd46e('0x10')](_0x47fa8f)&&!_[_0xd46e('0x10')](_0x47fa8f['rows'])){return _['find'](_0x47fa8f[_0xd46e('0x11')],function(_0x1bd574){return _0x1bd574['id']==_0x36a317;});}return null;};}exports['voiceChannels']=function(_0x4fd1f2,_0x2d6f2c){return respondWithRpcPromise(_0xd46e('0x12'),_0x4fd1f2[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x2d6f2c,null))[_0xd46e('0x15')](handleError(_0x2d6f2c,null));};exports[_0xd46e('0x16')]=function(_0x3b5fa4,_0x327b7e){return respondWithRpcPromise(_0xd46e('0x17'),_[_0xd46e('0x18')](_0x3b5fa4[_0xd46e('0x13')],_0x3b5fa4['params']))[_0xd46e('0x14')](respondWithResult(_0x327b7e,null))[_0xd46e('0x15')](handleError(_0x327b7e,null));};exports[_0xd46e('0x19')]=function(_0x45ce0b,_0x128246){return respondWithRpcPromise(_0xd46e('0x1a'),_[_0xd46e('0x18')](_0x45ce0b[_0xd46e('0x13')],_0x45ce0b[_0xd46e('0x1b')]))['then'](respondWithResult(_0x128246,null))[_0xd46e('0x15')](handleError(_0x128246,null));};exports['voiceQueues']=function(_0x4b8f6a,_0x371054){return respondWithRpcPromise(_0xd46e('0x1c'),_0x4b8f6a[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x371054,null))[_0xd46e('0x15')](handleError(_0x371054,null));};exports[_0xd46e('0x1d')]=function(_0x1740d1,_0x4dab6a){return respondWithRpcPromise(_0xd46e('0x1c'),_0x1740d1[_0xd46e('0x13')])[_0xd46e('0x14')](findById(_0x1740d1[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4dab6a,null))[_0xd46e('0x15')](handleError(_0x4dab6a,null));};exports['updateVoiceQueue']=function(_0x465d54,_0x3a1ced){return respondWithRpcPromise(_0xd46e('0x1e'),_[_0xd46e('0x18')](_0x465d54[_0xd46e('0x1f')],_0x465d54[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x3a1ced,null))[_0xd46e('0x15')](handleError(_0x3a1ced,null));};exports[_0xd46e('0x20')]=function(_0x45ea47,_0x2ff785){return respondWithRpcPromise(_0xd46e('0x21'),_[_0xd46e('0x18')](_0x45ea47['query'],_0x45ea47[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x2ff785,null))[_0xd46e('0x15')](handleError(_0x2ff785,null));};exports[_0xd46e('0x22')]=function(_0x5ef248,_0x2eed3a){return respondWithRpcPromise(_0xd46e('0x23'),_0x5ef248['query'])[_0xd46e('0x14')](respondWithResult(_0x2eed3a,null))[_0xd46e('0x15')](handleError(_0x2eed3a,null));};exports['voiceQueuesChannel']=function(_0x306458,_0x1c15c9){return respondWithRpcPromise(_0xd46e('0x24'),_['merge'](_0x306458['query'],_0x306458[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x1c15c9,null))[_0xd46e('0x15')](handleError(_0x1c15c9,null));};exports[_0xd46e('0x25')]=function(_0x83526a,_0x423de9){return respondWithRpcPromise(_0xd46e('0x26'),_[_0xd46e('0x18')](_0x83526a['query'],_0x83526a[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x423de9,null))[_0xd46e('0x15')](handleError(_0x423de9,null));};exports[_0xd46e('0x27')]=function(_0x1fa66c,_0x1e0897){return respondWithRpcPromise(_0xd46e('0x28'),_['merge'](_0x1fa66c[_0xd46e('0x13')],_0x1fa66c[_0xd46e('0x1b')]))['then'](respondWithResult(_0x1e0897,null))[_0xd46e('0x15')](handleError(_0x1e0897,null));};exports[_0xd46e('0x29')]=function(_0x12ccf8,_0x3b6e67){return respondWithRpcPromise('Outbound',_0x12ccf8[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x3b6e67,null))[_0xd46e('0x15')](handleError(_0x3b6e67,null));};exports[_0xd46e('0x2a')]=function(_0xefe5f4,_0x1f58ad){return respondWithRpcPromise(_0xd46e('0x2b'),_0xefe5f4[_0xd46e('0x13')])['then'](respondWithResult(_0x1f58ad,null))[_0xd46e('0x15')](handleError(_0x1f58ad,null));};exports[_0xd46e('0x2c')]=function(_0xc83ea1,_0x25657a){var _0x165ce8;return respondWithRpcPromise('Agents',_0xc83ea1[_0xd46e('0x13')])['then'](function(_0x55230d){_0x165ce8=_0x55230d;return respondWithRpcPromise('Agents',_0xc83ea1['query'],routingClient);})[_0xd46e('0x14')](function(_0x54949f){return _[_0xd46e('0x18')]({},_0x54949f,_0x165ce8);})[_0xd46e('0x14')](respondWithResult(_0x25657a,null))['catch'](handleError(_0x25657a,null));};exports[_0xd46e('0x2d')]=function(_0x4114e6,_0x3bd5e9){if(_0x4114e6[_0xd46e('0x1f')]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')]&&_0x4114e6[_0xd46e('0x2f')]&&_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]){for(var _0xec367d in _0x4114e6[_0xd46e('0x1f')]['interaction']){if(_0x4114e6['body']['interaction'][_0xd46e('0x30')](_0xec367d)){db['MemberReport'][_0xd46e('0x31')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':_0xd46e('0x32'),'exitAt':null,'uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]['length']?{'$notIn':_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d]}:{'$ne':null}}})[_0xd46e('0x14')](function(_0x196e51){var _0x41a983=moment()[_0xd46e('0x33')](_0xd46e('0x34'));for(var _0x5d65ca=0x0,_0x384b6e=_0x196e51[_0xd46e('0x35')];_0x5d65ca<_0x384b6e;_0x5d65ca+=0x1){_0x196e51[_0x5d65ca][_0xd46e('0x36')]({'exitAt':_0x41a983});}});for(var _0xac268d=0x0;_0xac268d<_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d][_0xd46e('0x35')];_0xac268d+=0x1){db[_0xd46e('0x37')][_0xd46e('0x38')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':'INTERACTION','uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d][_0xac268d],'exitAt':null},'defaults':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'interface':_[_0xd46e('0x10')](_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')])?util[_0xd46e('0x33')]('SIP/%s',_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]):_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')],'type':_0xd46e('0x32'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd46e('0x3a'),'internal':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x3b')],'uniqueid':_0x4114e6['body']['interaction'][_0xec367d][_0xac268d]}});}}}}return respondWithRpcPromise(_0xd46e('0x3c'),{'id':_0x4114e6[_0xd46e('0x1b')]['id'],'capacity':_0x4114e6['body'][_0xd46e('0x3d')]},routingClient)[_0xd46e('0x14')](respondWithResult(_0x3bd5e9,null))[_0xd46e('0x15')](handleError(_0x3bd5e9,null));};exports[_0xd46e('0x3e')]=function(_0x1bd8a5,_0x34d4ca){return respondWithRpcPromise(_0xd46e('0x3f'),_0x1bd8a5[_0xd46e('0x13')])['then'](respondWithResult(_0x34d4ca,null))[_0xd46e('0x15')](handleError(_0x34d4ca,null));};exports[_0xd46e('0x40')]=function(_0x1c7f92,_0x63ee74){return respondWithRpcPromise('Trunks',_0x1c7f92['query'])[_0xd46e('0x14')](respondWithResult(_0x63ee74,null))['catch'](handleError(_0x63ee74,null));};exports[_0xd46e('0x41')]=function(_0x2af20b,_0x393cb9){return respondWithRpcPromise(_0xd46e('0x42'),_0x2af20b[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x393cb9,null))['catch'](handleError(_0x393cb9,null));};exports[_0xd46e('0x43')]=function(_0x354739,_0x51f45a){return respondWithRpcPromise('ChatQueues',_0x354739[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x51f45a,null))[_0xd46e('0x15')](handleError(_0x51f45a,null));};exports[_0xd46e('0x44')]=function(_0x1886e6,_0x2cc676){return respondWithRpcPromise(_0xd46e('0x45'),_0x1886e6[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x1886e6[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x2cc676,null))[_0xd46e('0x15')](handleError(_0x2cc676,null));};exports[_0xd46e('0x46')]=function(_0x402df2,_0x47a86c){return respondWithRpcPromise(_0xd46e('0x47'),_0x402df2[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x47a86c,null))[_0xd46e('0x15')](handleError(_0x47a86c,null));};exports['showMailQueues']=function(_0x636f15,_0x36e18a){return respondWithRpcPromise(_0xd46e('0x47'),_0x636f15[_0xd46e('0x13')],routingClient)['then'](findById(_0x636f15[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x36e18a,null))['catch'](handleError(_0x36e18a,null));};exports['mailAccounts']=function(_0x45e102,_0xd59920){return respondWithRpcPromise(_0xd46e('0x48'),_0x45e102['query'],mailClient)['then'](respondWithResult(_0xd59920,null))[_0xd46e('0x15')](handleError(_0xd59920,null));};exports[_0xd46e('0x49')]=function(_0x1f310d,_0x263425){return respondWithRpcPromise(_0xd46e('0x4a'),_0x1f310d[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x263425,null))[_0xd46e('0x15')](handleError(_0x263425,null));};exports[_0xd46e('0x4b')]=function(_0x2a172c,_0x4af44){return respondWithRpcPromise(_0xd46e('0x4a'),_0x2a172c[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2a172c[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4af44,null))['catch'](handleError(_0x4af44,null));};exports[_0xd46e('0x4c')]=function(_0x1a3771,_0x3a2dec){return respondWithRpcPromise('SmsQueues',_0x1a3771[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x3a2dec,null))['catch'](handleError(_0x3a2dec,null));};exports[_0xd46e('0x4d')]=function(_0x2c86fe,_0x1801d4){return respondWithRpcPromise('SmsQueues',_0x2c86fe[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2c86fe[_0xd46e('0x1b')]['id']))['then'](respondWithResult(_0x1801d4,null))[_0xd46e('0x15')](handleError(_0x1801d4,null));};exports['whatsappQueues']=function(_0x32eed0,_0x148187){return respondWithRpcPromise(_0xd46e('0x4e'),_0x32eed0['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x148187,null))[_0xd46e('0x15')](handleError(_0x148187,null));};exports[_0xd46e('0x4f')]=function(_0xbce76f,_0x502f37){return respondWithRpcPromise(_0xd46e('0x4e'),_0xbce76f[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0xbce76f[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x502f37,null))[_0xd46e('0x15')](handleError(_0x502f37,null));};exports[_0xd46e('0x50')]=function(_0x41057c,_0x24be84){return respondWithRpcPromise('FaxQueues',_0x41057c['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x24be84,null))[_0xd46e('0x15')](handleError(_0x24be84,null));};exports[_0xd46e('0x51')]=function(_0x2fff69,_0x249938){return respondWithRpcPromise('FaxQueues',_0x2fff69[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2fff69[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x249938,null))['catch'](handleError(_0x249938,null));};exports[_0xd46e('0x52')]=function(_0x9dd439,_0x5a36df){return respondWithRpcPromise(_0xd46e('0x53'),_0x9dd439[_0xd46e('0x13')])['then'](respondWithResult(_0x5a36df,null))[_0xd46e('0x15')](handleError(_0x5a36df,null));};exports[_0xd46e('0x54')]=function(_0x566e65,_0x44ba36){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x566e65[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x44ba36,null))['catch'](handleError(_0x44ba36,null));};exports['mailQueuesWaitingInteractions']=function(_0x475133,_0x3eb6b){return respondWithRpcPromise(_0xd46e('0x55'),_0x475133[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x3eb6b,null))[_0xd46e('0x15')](handleError(_0x3eb6b,null));};exports[_0xd46e('0x56')]=function(_0x510a1e,_0x10bcdb){return respondWithRpcPromise(_0xd46e('0x57'),_0x510a1e[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x10bcdb,null))[_0xd46e('0x15')](handleError(_0x10bcdb,null));};exports[_0xd46e('0x58')]=function(_0x21f193,_0xaf7c79){return respondWithRpcPromise(_0xd46e('0x57'),_0x21f193['query'],routingClient)[_0xd46e('0x14')](function(_0x1c1bae){if(_0x21f193['query'][_0xd46e('0x59')]!==undefined){var _0x3ba83f=_(_0x1c1bae[_0xd46e('0x11')])[_0xd46e('0x5a')]([_0x21f193[_0xd46e('0x13')][_0xd46e('0x59')],_0x21f193['params']['id']])['map'](_0xd46e('0x5b'))[_0xd46e('0x5c')]()['value']();return _0x1c1bae['rows']['filter'](function(_0x825746){return _0x3ba83f[_0xd46e('0x5d')](_0x825746[_0xd46e('0x5b')])>-0x1;});}else{return _0x1c1bae['rows'][_0xd46e('0x5a')](function(_0x69ade9){return _0x69ade9[_0xd46e('0x5b')]===parseInt(_0x21f193['params']['id']);});}})['then'](respondWithResult(_0xaf7c79,null))['catch'](handleError(_0xaf7c79,null));};exports['smsQueuesWaitingInteractions']=function(_0x2d4410,_0x5d7c51){return respondWithRpcPromise(_0xd46e('0x5e'),_0x2d4410['query'],routingClient)['then'](respondWithResult(_0x5d7c51,null))[_0xd46e('0x15')](handleError(_0x5d7c51,null));};exports[_0xd46e('0x5f')]=function(_0x3df2c2,_0x2754ff){return respondWithRpcPromise(_0xd46e('0x60'),_0x3df2c2[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x2754ff,null))['catch'](handleError(_0x2754ff,null));};exports[_0xd46e('0x61')]=function(_0x383919,_0x114f2c){return respondWithRpcPromise(_0xd46e('0x62'),_0x383919['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x114f2c,null))[_0xd46e('0x15')](handleError(_0x114f2c,null));};exports['queueNotify']=function(_0x1309b5){return function(_0x483ef1,_0x2abaee){var _0x24a2e1,_0x5b54b6;var _0x59fb83=_[_0xd46e('0x63')](_0x1309b5);var _0x2c11b8=_0x1309b5===_0xd46e('0x64')?'Website':_0xd46e('0x65');return db[_0x59fb83+_0xd46e('0x66')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x483ef1[_0xd46e('0x1b')]['id']}})[_0xd46e('0x14')](function(_0x88460a){if(_[_0xd46e('0x10')](_0x88460a)){throw new Error(_0x59fb83+_0xd46e('0x68'));}_0x24a2e1=_0x88460a;return db[_0x59fb83+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x483ef1[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x59fb83+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x59fb83+_0x2c11b8],'as':_0xd46e('0x65')}]});})[_0xd46e('0x14')](function(_0x441f73){if(_[_0xd46e('0x10')](_0x441f73)){throw new Error(_0x59fb83+'\x20Message\x20not\x20found');}_0x5b54b6=_0x441f73;return _0x441f73[_0xd46e('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3436ff={'uniqueid':_0x1309b5+'.'+_0x5b54b6['id']+'.'+_0x5b54b6[_0xd46e('0x6b')]['id'],'FromUserId':_0x483ef1['user']['id'],'type':_0xd46e('0x6d')};_0x3436ff[_0x59fb83+_0xd46e('0x6e')]=_0x5b54b6['id'];_0x3436ff[_0x59fb83+_0xd46e('0x6f')]=_0x5b54b6[_0xd46e('0x6b')]['id'];_0x3436ff[_0xd46e('0x70')+_0x59fb83+_0x2c11b8+'Id']=_0x5b54b6[_0xd46e('0x65')]['id'];_0x3436ff['To'+_0x59fb83+_0xd46e('0x71')]=_0x24a2e1['id'];return db[_0x59fb83+_0xd46e('0x72')][_0xd46e('0x73')](_0x3436ff);})[_0xd46e('0x14')](function(){return respondWithRpcPromise(_0xd46e('0x74'),{'channel':_0x1309b5,'interaction':_0x5b54b6['Interaction'],'message':_0x5b54b6,'account':_0x5b54b6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd46e('0x6d'),'appdata':_0x24a2e1[_0xd46e('0xe')]+','+(_0x5b54b6[_0xd46e('0x65')][_0xd46e('0x75')]||0x12c),'interval':_0xd46e('0x76')}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0x2abaee,null))['catch'](handleError(_0x2abaee,null));};};exports[_0xd46e('0x77')]=function(_0x127604,_0xa254f5){var _0x2c9703,_0x41443d;if(_[_0xd46e('0x10')](_0x127604['body'][_0xd46e('0x78')])){throw new Error(_0xd46e('0x79'));}var _0x59067a=_0x127604[_0xd46e('0x1f')][_0xd46e('0x78')];var _0x9e222d=_[_0xd46e('0x63')](_0x59067a);var _0x97ee80=_0x59067a===_0xd46e('0x64')?_0xd46e('0x7a'):_0xd46e('0x65');return db[_0xd46e('0x7b')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x127604[_0xd46e('0x1b')]['id'],'role':_0xd46e('0x3a')}})[_0xd46e('0x14')](function(_0x30dcfc){if(_['isNil'](_0x30dcfc)){throw new Error('Agent\x20not\x20found');}_0x2c9703=_0x30dcfc;return db[_0x9e222d+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x127604[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x9e222d+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x9e222d+_0x97ee80],'as':'Account'}]});})[_0xd46e('0x14')](function(_0x216143){if(_[_0xd46e('0x10')](_0x216143)){throw new Error(_0x9e222d+_0xd46e('0x7c'));}_0x41443d=_0x216143;return _0x216143['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd46e('0x14')](function(){var _0x191b48={'uniqueid':_0x59067a+'.'+_0x41443d['id']+'.'+_0x41443d['Interaction']['id'],'FromUserId':_0x127604[_0xd46e('0x2f')]['id'],'type':'queue','ToUserId':_0x2c9703['id']};_0x191b48[_0x9e222d+'MessageId']=_0x41443d['id'];_0x191b48[_0x9e222d+_0xd46e('0x6f')]=_0x41443d[_0xd46e('0x6b')]['id'];_0x191b48[_0xd46e('0x70')+_0x9e222d+_0x97ee80+'Id']=_0x41443d[_0xd46e('0x65')]['id'];return db[_0x9e222d+'TransferReport']['create'](_0x191b48);})[_0xd46e('0x14')](function(){return respondWithRpcPromise('Start',{'channel':_0x59067a,'interaction':_0x41443d[_0xd46e('0x6b')],'message':_0x41443d,'account':_0x41443d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2c9703[_0xd46e('0xe')]+','+(_0x41443d[_0xd46e('0x65')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0xa254f5,null))[_0xd46e('0x15')](handleError(_0xa254f5,null));}; \ No newline at end of file +var _0xac9d=['SIP/%s','INTERACTION','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','findOrCreate','interface','format'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0xac9d,0x14d));var _0xdac9=function(_0x3b6112,_0x31a6f3){_0x3b6112=_0x3b6112-0x0;var _0x263088=_0xac9d[_0x3b6112];return _0x263088;};'use strict';var BPromise=require(_0xdac9('0x0'));var moment=require(_0xdac9('0x1'));var _=require(_0xdac9('0x2'));var util=require(_0xdac9('0x3'));var db=require(_0xdac9('0x4'))['db'];var logger=require(_0xdac9('0x5'))(_0xdac9('0x6'));var jayson=require(_0xdac9('0x7'));var amiClient=jayson['client'][_0xdac9('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xdac9('0x8')]({'port':0x232b});var routingClient=jayson[_0xdac9('0x9')][_0xdac9('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){var _0x47d9fd=_0x39f560?_0x39f560:amiClient;return _0x47d9fd[_0xdac9('0xa')](_0x776b6c,_0x1c78c5)[_0xdac9('0xb')](function(_0x39c92c){if(_0x39c92c[_0xdac9('0xc')]){if(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xd')]===0x1f4){return _0x2b1d6f(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xe')]);}return _0x5531af(_0x39c92c[_0xdac9('0xc')]['message']);}else{_0x5531af(_0x39c92c[_0xdac9('0xf')]);}})[_0xdac9('0x10')](function(_0x5a9bde){_0x2b1d6f(_0x5a9bde);});});}function respondWithResult(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xc8;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['status'](_0xeddbc1)[_0xdac9('0x11')](_0xbfe6d8);}return _0x3d8e97[_0xdac9('0x12')](0x194);};}function handleError(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0x1f4;return function(_0x5dd536){logger[_0xdac9('0xc')](_0x5dd536[_0xdac9('0x13')]);if(_0x5dd536['name']){delete _0x5dd536[_0xdac9('0x14')];}_0x9e1bf6[_0xdac9('0x15')](_0x5f0bbd)[_0xdac9('0x16')](_0x5dd536);};}function findById(_0x5b2f1b){return function(_0x2221f8){if(!_[_0xdac9('0x17')](_0x5b2f1b)&&!_[_0xdac9('0x17')](_0x2221f8)&&!_[_0xdac9('0x17')](_0x2221f8['rows'])){return _[_0xdac9('0x18')](_0x2221f8[_0xdac9('0x19')],function(_0x571e07){return _0x571e07['id']==_0x5b2f1b;});}return null;};}exports[_0xdac9('0x1a')]=function(_0xa57f2d,_0x171df1){return respondWithRpcPromise(_0xdac9('0x1b'),_0xa57f2d['query'])['then'](respondWithResult(_0x171df1,null))[_0xdac9('0x10')](handleError(_0x171df1,null));};exports[_0xdac9('0x1c')]=function(_0x2b9d91,_0x395ec7){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xdac9('0x1d')](_0x2b9d91[_0xdac9('0x1e')],_0x2b9d91[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x395ec7,null))[_0xdac9('0x10')](handleError(_0x395ec7,null));};exports[_0xdac9('0x20')]=function(_0x41335a,_0xa1f726){return respondWithRpcPromise(_0xdac9('0x21'),_[_0xdac9('0x1d')](_0x41335a['query'],_0x41335a[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0xa1f726,null))[_0xdac9('0x10')](handleError(_0xa1f726,null));};exports[_0xdac9('0x22')]=function(_0x5ca076,_0x1e631a){return respondWithRpcPromise('VoiceQueues',_0x5ca076[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x1e631a,null))['catch'](handleError(_0x1e631a,null));};exports[_0xdac9('0x23')]=function(_0x5105f1,_0x450f91){return respondWithRpcPromise(_0xdac9('0x24'),_0x5105f1[_0xdac9('0x1e')])[_0xdac9('0xb')](findById(_0x5105f1['params']['id']))['then'](respondWithResult(_0x450f91,null))[_0xdac9('0x10')](handleError(_0x450f91,null));};exports[_0xdac9('0x25')]=function(_0x4fe3bd,_0x4c4e21){return respondWithRpcPromise(_0xdac9('0x26'),_[_0xdac9('0x1d')](_0x4fe3bd[_0xdac9('0x27')],_0x4fe3bd[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x4c4e21,null))[_0xdac9('0x10')](handleError(_0x4c4e21,null));};exports[_0xdac9('0x28')]=function(_0x2cda4d,_0x406ed0){return respondWithRpcPromise(_0xdac9('0x29'),_[_0xdac9('0x1d')](_0x2cda4d[_0xdac9('0x1e')],_0x2cda4d[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x406ed0,null))[_0xdac9('0x10')](handleError(_0x406ed0,null));};exports[_0xdac9('0x2a')]=function(_0x372f02,_0x44eff2){return respondWithRpcPromise(_0xdac9('0x2b'),_0x372f02[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x44eff2,null))['catch'](handleError(_0x44eff2,null));};exports['voiceQueuesChannel']=function(_0x1e6832,_0x416501){return respondWithRpcPromise(_0xdac9('0x2c'),_[_0xdac9('0x1d')](_0x1e6832[_0xdac9('0x1e')],_0x1e6832['params']))[_0xdac9('0xb')](respondWithResult(_0x416501,null))['catch'](handleError(_0x416501,null));};exports[_0xdac9('0x2d')]=function(_0x2a611e,_0x5cfebf){return respondWithRpcPromise(_0xdac9('0x2e'),_['merge'](_0x2a611e['query'],_0x2a611e[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x5cfebf,null))[_0xdac9('0x10')](handleError(_0x5cfebf,null));};exports[_0xdac9('0x2f')]=function(_0x3bab10,_0x363d93){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xdac9('0x1d')](_0x3bab10[_0xdac9('0x1e')],_0x3bab10['params']))[_0xdac9('0xb')](respondWithResult(_0x363d93,null))[_0xdac9('0x10')](handleError(_0x363d93,null));};exports[_0xdac9('0x30')]=function(_0x27bdfb,_0x35aa58){return respondWithRpcPromise(_0xdac9('0x31'),_0x27bdfb[_0xdac9('0x1e')])['then'](respondWithResult(_0x35aa58,null))[_0xdac9('0x10')](handleError(_0x35aa58,null));};exports[_0xdac9('0x32')]=function(_0x238769,_0x4b6b09){return respondWithRpcPromise(_0xdac9('0x33'),_0x238769[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4b6b09,null))[_0xdac9('0x10')](handleError(_0x4b6b09,null));};exports['agents']=function(_0x58fd14,_0x1d0243){var _0xe47a3c;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14[_0xdac9('0x1e')])[_0xdac9('0xb')](function(_0x579581){_0xe47a3c=_0x579581;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14['query'],routingClient);})[_0xdac9('0xb')](function(_0xaca43c){return _[_0xdac9('0x1d')]({},_0xaca43c,_0xe47a3c);})[_0xdac9('0xb')](respondWithResult(_0x1d0243,null))[_0xdac9('0x10')](handleError(_0x1d0243,null));};exports[_0xdac9('0x35')]=function(_0x413fb1,_0xb176e0){if(_0x413fb1[_0xdac9('0x27')]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]&&_0x413fb1[_0xdac9('0x37')]&&_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]){for(var _0x5335ae in _0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]){if(_0x413fb1['body'][_0xdac9('0x36')][_0xdac9('0x38')](_0x5335ae)){db[_0xdac9('0x39')][_0xdac9('0x3a')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')]?{'$notIn':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]}:{'$ne':null}}})['then'](function(_0x585f08){var _0xcb7b82=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4159fd=0x0,_0x15c332=_0x585f08['length'];_0x4159fd<_0x15c332;_0x4159fd+=0x1){_0x585f08[_0x4159fd]['updateAttributes']({'exitAt':_0xcb7b82});}});for(var _0x1666c5=0x0;_0x1666c5<_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')];_0x1666c5+=0x1){db[_0xdac9('0x39')][_0xdac9('0x3c')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','uniqueid':_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0x1666c5],'exitAt':null},'defaults':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'interface':_[_0xdac9('0x17')](_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')])?util[_0xdac9('0x3e')](_0xdac9('0x3f'),_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]):_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')],'type':_0xdac9('0x40'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x41')],'uniqueid':_0x413fb1['body'][_0xdac9('0x36')][_0x5335ae][_0x1666c5]}});}}}}return respondWithRpcPromise(_0xdac9('0x42'),{'id':_0x413fb1[_0xdac9('0x1f')]['id'],'capacity':_0x413fb1['body'][_0xdac9('0x43')]},routingClient)[_0xdac9('0xb')](respondWithResult(_0xb176e0,null))['catch'](handleError(_0xb176e0,null));};exports['telephones']=function(_0x46f1c0,_0x4469d8){return respondWithRpcPromise(_0xdac9('0x44'),_0x46f1c0[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4469d8,null))[_0xdac9('0x10')](handleError(_0x4469d8,null));};exports[_0xdac9('0x45')]=function(_0x3a77e3,_0x298c72){return respondWithRpcPromise(_0xdac9('0x46'),_0x3a77e3[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x298c72,null))[_0xdac9('0x10')](handleError(_0x298c72,null));};exports[_0xdac9('0x47')]=function(_0x35a378,_0x5d0b43){return respondWithRpcPromise(_0xdac9('0x48'),_0x35a378[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x5d0b43,null))[_0xdac9('0x10')](handleError(_0x5d0b43,null));};exports[_0xdac9('0x49')]=function(_0x3a391a,_0x4b118e){return respondWithRpcPromise(_0xdac9('0x4a'),_0x3a391a[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x4b118e,null))[_0xdac9('0x10')](handleError(_0x4b118e,null));};exports[_0xdac9('0x4b')]=function(_0x2a5bf9,_0x1eec39){return respondWithRpcPromise(_0xdac9('0x4a'),_0x2a5bf9[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2a5bf9[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x1eec39,null))[_0xdac9('0x10')](handleError(_0x1eec39,null));};exports[_0xdac9('0x4c')]=function(_0x2ca15d,_0x21ab3d){return respondWithRpcPromise('MailQueues',_0x2ca15d['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x21ab3d,null))[_0xdac9('0x10')](handleError(_0x21ab3d,null));};exports[_0xdac9('0x4d')]=function(_0x46017d,_0x1c1f5f){return respondWithRpcPromise(_0xdac9('0x4e'),_0x46017d['query'],routingClient)['then'](findById(_0x46017d['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x1c1f5f,null))[_0xdac9('0x10')](handleError(_0x1c1f5f,null));};exports[_0xdac9('0x4f')]=function(_0x2f581b,_0x52ad7b){return respondWithRpcPromise(_0xdac9('0x50'),_0x2f581b[_0xdac9('0x1e')],mailClient)[_0xdac9('0xb')](respondWithResult(_0x52ad7b,null))[_0xdac9('0x10')](handleError(_0x52ad7b,null));};exports[_0xdac9('0x51')]=function(_0x496d9c,_0x19a46e){return respondWithRpcPromise('OpenchannelQueues',_0x496d9c[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x19a46e,null))[_0xdac9('0x10')](handleError(_0x19a46e,null));};exports[_0xdac9('0x52')]=function(_0x2fd7c8,_0x360499){return respondWithRpcPromise(_0xdac9('0x53'),_0x2fd7c8[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x2fd7c8['params']['id']))['then'](respondWithResult(_0x360499,null))['catch'](handleError(_0x360499,null));};exports[_0xdac9('0x54')]=function(_0x42ba53,_0x830d54){return respondWithRpcPromise(_0xdac9('0x55'),_0x42ba53[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x830d54,null))[_0xdac9('0x10')](handleError(_0x830d54,null));};exports['showSmsQueues']=function(_0x2d81fc,_0x5b63d8){return respondWithRpcPromise('SmsQueues',_0x2d81fc[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2d81fc['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x5b63d8,null))[_0xdac9('0x10')](handleError(_0x5b63d8,null));};exports[_0xdac9('0x56')]=function(_0x55ce14,_0x552cac){return respondWithRpcPromise(_0xdac9('0x57'),_0x55ce14[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x552cac,null))[_0xdac9('0x10')](handleError(_0x552cac,null));};exports[_0xdac9('0x58')]=function(_0x26b9b5,_0x272f14){return respondWithRpcPromise(_0xdac9('0x57'),_0x26b9b5[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x26b9b5[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x272f14,null))[_0xdac9('0x10')](handleError(_0x272f14,null));};exports[_0xdac9('0x59')]=function(_0x1e2e7b,_0x5401e6){return respondWithRpcPromise(_0xdac9('0x5a'),_0x1e2e7b['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x5401e6,null))[_0xdac9('0x10')](handleError(_0x5401e6,null));};exports['showFaxQueues']=function(_0x3a6c78,_0x3bee81){return respondWithRpcPromise(_0xdac9('0x5a'),_0x3a6c78[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x3a6c78[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x3bee81,null))[_0xdac9('0x10')](handleError(_0x3bee81,null));};exports[_0xdac9('0x5b')]=function(_0x45f183,_0x263b84){return respondWithRpcPromise(_0xdac9('0x5c'),_0x45f183[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x263b84,null))[_0xdac9('0x10')](handleError(_0x263b84,null));};exports[_0xdac9('0x5d')]=function(_0x4c4a7b,_0x3a457b){return respondWithRpcPromise(_0xdac9('0x5e'),_0x4c4a7b[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x3a457b,null))['catch'](handleError(_0x3a457b,null));};exports[_0xdac9('0x5f')]=function(_0x31f56e,_0x1b6a68){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x31f56e[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x1b6a68,null))['catch'](handleError(_0x1b6a68,null));};exports[_0xdac9('0x60')]=function(_0x1b8ad9,_0x2a4d12){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1b8ad9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x2a4d12,null))[_0xdac9('0x10')](handleError(_0x2a4d12,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5c39e9,_0x108e03){return respondWithRpcPromise(_0xdac9('0x61'),_0x5c39e9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](function(_0x4110da){if(_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')]!==undefined){var _0x2de535=_(_0x4110da[_0xdac9('0x19')])[_0xdac9('0x63')]([_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')],_0x5c39e9[_0xdac9('0x1f')]['id']])['map']('queue_id')[_0xdac9('0x64')]()['value']();return _0x4110da['rows'][_0xdac9('0x63')](function(_0x199518){return _0x2de535[_0xdac9('0x65')](_0x199518[_0xdac9('0x66')])>-0x1;});}else{return _0x4110da['rows'][_0xdac9('0x63')](function(_0xff5be){return _0xff5be[_0xdac9('0x66')]===parseInt(_0x5c39e9['params']['id']);});}})[_0xdac9('0xb')](respondWithResult(_0x108e03,null))[_0xdac9('0x10')](handleError(_0x108e03,null));};exports['smsQueuesWaitingInteractions']=function(_0x3cc0f9,_0x59b5b2){return respondWithRpcPromise(_0xdac9('0x67'),_0x3cc0f9['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x59b5b2,null))[_0xdac9('0x10')](handleError(_0x59b5b2,null));};exports[_0xdac9('0x68')]=function(_0x251011,_0x9981f){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x251011[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x9981f,null))[_0xdac9('0x10')](handleError(_0x9981f,null));};exports[_0xdac9('0x69')]=function(_0x13be64,_0x227857){return respondWithRpcPromise(_0xdac9('0x6a'),_0x13be64[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x227857,null))['catch'](handleError(_0x227857,null));};exports[_0xdac9('0x6b')]=function(_0x300738){return function(_0x12c15b,_0x4f7f63){var _0x571130,_0x5650d1;var _0x5adc83=_['capitalize'](_0x300738);var _0x325407=_0x300738===_0xdac9('0x6c')?_0xdac9('0x6d'):_0xdac9('0x6e');return db[_0x5adc83+'Queue'][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x12c15b['params']['id']}})[_0xdac9('0xb')](function(_0x750de7){if(_[_0xdac9('0x17')](_0x750de7)){throw new Error(_0x5adc83+_0xdac9('0x70'));}_0x571130=_0x750de7;return db[_0x5adc83+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x12c15b[_0xdac9('0x27')][_0xdac9('0x71')]},'include':[{'model':db[_0x5adc83+_0xdac9('0x72')],'as':'Interaction'},{'model':db[_0x5adc83+_0x325407],'as':'Account'}]});})[_0xdac9('0xb')](function(_0x414f8a){if(_[_0xdac9('0x17')](_0x414f8a)){throw new Error(_0x5adc83+'\x20Message\x20not\x20found');}_0x5650d1=_0x414f8a;return _0x414f8a['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x111bff={'uniqueid':_0x300738+'.'+_0x5650d1['id']+'.'+_0x5650d1[_0xdac9('0x72')]['id'],'FromUserId':_0x12c15b[_0xdac9('0x37')]['id'],'type':_0xdac9('0x73')};_0x111bff[_0x5adc83+_0xdac9('0x74')]=_0x5650d1['id'];_0x111bff[_0x5adc83+_0xdac9('0x75')]=_0x5650d1[_0xdac9('0x72')]['id'];_0x111bff[_0xdac9('0x76')+_0x5adc83+_0x325407+'Id']=_0x5650d1[_0xdac9('0x6e')]['id'];_0x111bff['To'+_0x5adc83+_0xdac9('0x77')]=_0x571130['id'];return db[_0x5adc83+_0xdac9('0x78')][_0xdac9('0x79')](_0x111bff);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x300738,'interaction':_0x5650d1[_0xdac9('0x72')],'message':_0x5650d1,'account':_0x5650d1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xdac9('0x73'),'appdata':_0x571130['name']+','+(_0x5650d1[_0xdac9('0x6e')][_0xdac9('0x7b')]||0x12c),'interval':_0xdac9('0x7c')}]},routingClient);})[_0xdac9('0xb')](respondWithResult(_0x4f7f63,null))[_0xdac9('0x10')](handleError(_0x4f7f63,null));};};exports[_0xdac9('0x7d')]=function(_0x232876,_0x4463ca){var _0x171d38,_0x328fa2;if(_[_0xdac9('0x17')](_0x232876['body'][_0xdac9('0x7e')])){throw new Error(_0xdac9('0x7f'));}var _0x284247=_0x232876[_0xdac9('0x27')][_0xdac9('0x7e')];var _0x4d7208=_['capitalize'](_0x284247);var _0x363541=_0x284247==='chat'?'Website':_0xdac9('0x6e');return db[_0xdac9('0x80')][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x232876[_0xdac9('0x1f')]['id'],'role':'agent'}})[_0xdac9('0xb')](function(_0x8f37df){if(_[_0xdac9('0x17')](_0x8f37df)){throw new Error('Agent\x20not\x20found');}_0x171d38=_0x8f37df;return db[_0x4d7208+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x232876[_0xdac9('0x27')]['messageId']},'include':[{'model':db[_0x4d7208+'Interaction'],'as':'Interaction'},{'model':db[_0x4d7208+_0x363541],'as':_0xdac9('0x6e')}]});})[_0xdac9('0xb')](function(_0x131c78){if(_['isNil'](_0x131c78)){throw new Error(_0x4d7208+_0xdac9('0x81'));}_0x328fa2=_0x131c78;return _0x131c78[_0xdac9('0x82')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x2ab89f={'uniqueid':_0x284247+'.'+_0x328fa2['id']+'.'+_0x328fa2[_0xdac9('0x72')]['id'],'FromUserId':_0x232876['user']['id'],'type':_0xdac9('0x73'),'ToUserId':_0x171d38['id']};_0x2ab89f[_0x4d7208+_0xdac9('0x74')]=_0x328fa2['id'];_0x2ab89f[_0x4d7208+'InteractionId']=_0x328fa2[_0xdac9('0x72')]['id'];_0x2ab89f[_0xdac9('0x76')+_0x4d7208+_0x363541+'Id']=_0x328fa2[_0xdac9('0x6e')]['id'];return db[_0x4d7208+_0xdac9('0x78')]['create'](_0x2ab89f);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x284247,'interaction':_0x328fa2[_0xdac9('0x72')],'message':_0x328fa2,'account':_0x328fa2['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x171d38[_0xdac9('0x14')]+','+(_0x328fa2['Account'][_0xdac9('0x83')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x4463ca,null))[_0xdac9('0x10')](handleError(_0x4463ca,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8b25ca0..79c5a28 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 _0xd367=['show','/:id/run','run','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xd367,0x1d6));var _0x7d36=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd367[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7d36('0x0'));var util=require(_0x7d36('0x1'));var path=require(_0x7d36('0x2'));var timeout=require(_0x7d36('0x3'));var express=require(_0x7d36('0x4'));var router=express['Router']();var fs_extra=require(_0x7d36('0x5'));var auth=require(_0x7d36('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7d36('0x7'));var controller=require(_0x7d36('0x8'));router[_0x7d36('0x9')]('/',auth[_0x7d36('0xa')](),controller[_0x7d36('0xb')]);router[_0x7d36('0x9')](_0x7d36('0xc'),auth[_0x7d36('0xa')](),controller[_0x7d36('0xd')]);router[_0x7d36('0x9')](_0x7d36('0xe'),auth[_0x7d36('0xa')](),controller[_0x7d36('0xf')]);router['post']('/',auth[_0x7d36('0xa')](),controller[_0x7d36('0x10')]);router['put'](_0x7d36('0xc'),auth[_0x7d36('0xa')](),controller[_0x7d36('0x11')]);router[_0x7d36('0x12')](_0x7d36('0xc'),auth[_0x7d36('0xa')](),controller[_0x7d36('0x13')]);module[_0x7d36('0x14')]=router; \ No newline at end of file +var _0xe895=['run','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x14fbb1,_0x31e2b6){var _0x16fdf2=function(_0x382f1c){while(--_0x382f1c){_0x14fbb1['push'](_0x14fbb1['shift']());}};_0x16fdf2(++_0x31e2b6);}(_0xe895,0xa0));var _0x5e89=function(_0x319b97,_0x489c27){_0x319b97=_0x319b97-0x0;var _0x454f9e=_0xe895[_0x319b97];return _0x454f9e;};'use strict';var multer=require(_0x5e89('0x0'));var util=require(_0x5e89('0x1'));var path=require('path');var timeout=require(_0x5e89('0x2'));var express=require(_0x5e89('0x3'));var router=express['Router']();var fs_extra=require(_0x5e89('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e89('0x5'));var config=require(_0x5e89('0x6'));var controller=require('./schedule.controller');router[_0x5e89('0x7')]('/',auth[_0x5e89('0x8')](),controller[_0x5e89('0x9')]);router[_0x5e89('0x7')](_0x5e89('0xa'),auth[_0x5e89('0x8')](),controller['show']);router[_0x5e89('0x7')]('/:id/run',auth[_0x5e89('0x8')](),controller[_0x5e89('0xb')]);router[_0x5e89('0xc')]('/',auth['isAuthenticated'](),controller[_0x5e89('0xd')]);router[_0x5e89('0xe')](_0x5e89('0xa'),auth[_0x5e89('0x8')](),controller[_0x5e89('0xf')]);router[_0x5e89('0x10')]('/:id',auth[_0x5e89('0x8')](),controller[_0x5e89('0x11')]);module[_0x5e89('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0a61d17..2c81b2d 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 _0x6b0a=['weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','sequelize','exports','STRING','BOOLEAN','ENUM','years'];(function(_0x48e3b6,_0x305068){var _0x1e3023=function(_0x4e929c){while(--_0x4e929c){_0x48e3b6['push'](_0x48e3b6['shift']());}};_0x1e3023(++_0x305068);}(_0x6b0a,0x9f));var _0xa6b0=function(_0x4dc7f8,_0x135ddb){_0x4dc7f8=_0x4dc7f8-0x0;var _0x393136=_0x6b0a[_0x4dc7f8];return _0x393136;};'use strict';var Sequelize=require(_0xa6b0('0x0'));module[_0xa6b0('0x1')]={'name':{'type':Sequelize[_0xa6b0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa6b0('0x2')]},'active':{'type':Sequelize[_0xa6b0('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa6b0('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa6b0('0x4')](_0xa6b0('0x5'),'quarters','months',_0xa6b0('0x6'),_0xa6b0('0x7'),_0xa6b0('0x8'),_0xa6b0('0x9')),'allowNull':![],'defaultValue':_0xa6b0('0x7')},'output':{'type':Sequelize[_0xa6b0('0x4')](_0xa6b0('0xa'),_0xa6b0('0xb'),_0xa6b0('0xc')),'allowNull':![],'defaultValue':_0xa6b0('0xa')},'type':{'type':Sequelize['ENUM'](_0xa6b0('0xd'),_0xa6b0('0xe')),'allowNull':![],'defaultValue':_0xa6b0('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa6b0('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xa6b0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xff09=['pdf','xlsx','custom','TEXT','BOOLEAN','sequelize','exports','STRING','DATE','INTEGER','ENUM','years','quarters','weeks','days','minutes','csv'];(function(_0x4c7ebb,_0x1c5ed0){var _0xeec311=function(_0x25a56d){while(--_0x25a56d){_0x4c7ebb['push'](_0x4c7ebb['shift']());}};_0xeec311(++_0x1c5ed0);}(_0xff09,0x1f2));var _0x9ff0=function(_0x19b3b9,_0x943fdf){_0x19b3b9=_0x19b3b9-0x0;var _0x27eec5=_0xff09[_0x19b3b9];return _0x27eec5;};'use strict';var Sequelize=require(_0x9ff0('0x0'));module[_0x9ff0('0x1')]={'name':{'type':Sequelize[_0x9ff0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9ff0('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9ff0('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x9ff0('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9ff0('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9ff0('0x5')](_0x9ff0('0x6'),_0x9ff0('0x7'),'months',_0x9ff0('0x8'),_0x9ff0('0x9'),'hours',_0x9ff0('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x9ff0('0x5')](_0x9ff0('0xb'),_0x9ff0('0xc'),_0x9ff0('0xd')),'allowNull':![],'defaultValue':_0x9ff0('0xb')},'type':{'type':Sequelize['ENUM'](_0x9ff0('0xe'),'default'),'allowNull':![],'defaultValue':_0x9ff0('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x9ff0('0xf')]},'bcc':{'type':Sequelize[_0x9ff0('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x9ff0('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 2e097e0..cd8f6e0 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 _0xb49d=['save','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','run','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','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','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x846ae8,_0x33a70b){var _0x356b00=function(_0xa96f69){while(--_0xa96f69){_0x846ae8['push'](_0x846ae8['shift']());}};_0x356b00(++_0x33a70b);}(_0xb49d,0x8f));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdb49('0x0'));var rimraf=require(_0xdb49('0x1'));var zipdir=require(_0xdb49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb49('0x3'));var moment=require(_0xdb49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb49('0x5'));var util=require(_0xdb49('0x6'));var path=require(_0xdb49('0x7'));var sox=require(_0xdb49('0x8'));var csv=require('to-csv');var ejs=require(_0xdb49('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb49('0xa'));var squel=require(_0xdb49('0xb'));var crypto=require(_0xdb49('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb49('0xd'));var toCsv=require(_0xdb49('0xe'));var querystring=require(_0xdb49('0xf'));var Papa=require(_0xdb49('0x10'));var Redis=require('ioredis');var authService=require(_0xdb49('0x11'));var qs=require(_0xdb49('0x12'));var as=require(_0xdb49('0x13'));var hardwareService=require(_0xdb49('0x14'));var logger=require(_0xdb49('0x15'))('api');var utils=require(_0xdb49('0x16'));var config=require(_0xdb49('0x17'));var licenseUtil=require(_0xdb49('0x18'));var db=require(_0xdb49('0x19'))['db'];function respondWithStatusCode(_0x313ce8,_0x33d784){_0x33d784=_0x33d784||0xcc;return function(_0x40a0c7){if(_0x40a0c7){return _0x313ce8['sendStatus'](_0x33d784);}return _0x313ce8[_0xdb49('0x1a')](_0x33d784)[_0xdb49('0x1b')]();};}function respondWithResult(_0x1c7555,_0x101058){_0x101058=_0x101058||0xc8;return function(_0x3cd364){if(_0x3cd364){return _0x1c7555[_0xdb49('0x1a')](_0x101058)[_0xdb49('0x1c')](_0x3cd364);}};}function respondWithFilteredResult(_0x1adf54,_0x48b51f){return function(_0x325030){if(_0x325030){var _0x2eded0=typeof _0x48b51f[_0xdb49('0x1d')]==='undefined'&&typeof _0x48b51f[_0xdb49('0x1e')]===_0xdb49('0x1f');var _0x4065d4=_0x325030[_0xdb49('0x20')];var _0x339627=_0x2eded0?0x0:_0x48b51f[_0xdb49('0x1d')];var _0xf2a1de=_0x2eded0?_0x325030[_0xdb49('0x20')]:_0x48b51f[_0xdb49('0x1d')]+_0x48b51f[_0xdb49('0x1e')];var _0x11adcd;if(_0xf2a1de>=_0x4065d4){_0xf2a1de=_0x4065d4;_0x11adcd=0xc8;}else{_0x11adcd=0xce;}_0x1adf54[_0xdb49('0x1a')](_0x11adcd);return _0x1adf54[_0xdb49('0x21')](_0xdb49('0x22'),_0x339627+'-'+_0xf2a1de+'/'+_0x4065d4)[_0xdb49('0x1c')](_0x325030);}return null;};}function patchUpdates(_0xfbe96c){return function(_0x2edcd7){try{jsonpatch[_0xdb49('0x23')](_0x2edcd7,_0xfbe96c,!![]);}catch(_0x1015e5){return BPromise[_0xdb49('0x24')](_0x1015e5);}return _0x2edcd7[_0xdb49('0x25')]();};}function saveUpdates(_0x2df385,_0x7af5e1){return function(_0x3d6ceb){if(_0x3d6ceb){return _0x3d6ceb['update'](_0x2df385)[_0xdb49('0x26')](function(_0x267409){return _0x267409;});}return null;};}function removeEntity(_0x215364,_0x4c44a5){return function(_0x16054b){if(_0x16054b){return _0x16054b[_0xdb49('0x27')]()[_0xdb49('0x26')](function(){var _0x4fc022=_0x16054b[_0xdb49('0x28')]({'plain':!![]});var _0x25d76c=_0xdb49('0x29');return db[_0xdb49('0x2a')][_0xdb49('0x27')]({'where':{'type':_0x25d76c,'resourceId':_0x4fc022['id']}})[_0xdb49('0x26')](function(){return _0x16054b;});})[_0xdb49('0x26')](function(){_0x215364[_0xdb49('0x1a')](0xcc)[_0xdb49('0x1b')]();});}};}function handleEntityNotFound(_0x59de85,_0x51883c){return function(_0x1c8cea){if(!_0x1c8cea){_0x59de85[_0xdb49('0x2b')](0x194);}return _0x1c8cea;};}function handleError(_0x139943,_0x3bf41a){_0x3bf41a=_0x3bf41a||0x1f4;return function(_0x4e0419){logger[_0xdb49('0x2c')](_0x4e0419[_0xdb49('0x2d')]);if(_0x4e0419[_0xdb49('0x2e')]){delete _0x4e0419[_0xdb49('0x2e')];}_0x139943['status'](_0x3bf41a)[_0xdb49('0x2f')](_0x4e0419);};}exports[_0xdb49('0x30')]=function(_0xc90158,_0x230bc1){var _0x195583={},_0x4373fd={},_0xd72ed7={'count':0x0,'rows':[]};var _0x42fc2f=_['map'](db[_0xdb49('0x31')][_0xdb49('0x32')],function(_0x2d0709){return{'name':_0x2d0709['fieldName'],'type':_0x2d0709['type'][_0xdb49('0x33')]};});_0x4373fd[_0xdb49('0x34')]=_[_0xdb49('0x35')](_0x42fc2f,_0xdb49('0x2e'));_0x4373fd[_0xdb49('0x36')]=_['keys'](_0xc90158[_0xdb49('0x36')]);_0x4373fd[_0xdb49('0x37')]=_['intersection'](_0x4373fd[_0xdb49('0x34')],_0x4373fd[_0xdb49('0x36')]);_0x195583['attributes']=_[_0xdb49('0x38')](_0x4373fd[_0xdb49('0x34')],qs[_0xdb49('0x39')](_0xc90158[_0xdb49('0x36')]['fields']));_0x195583['attributes']=_0x195583[_0xdb49('0x3a')][_0xdb49('0x3b')]?_0x195583[_0xdb49('0x3a')]:_0x4373fd[_0xdb49('0x34')];if(!_0xc90158[_0xdb49('0x36')][_0xdb49('0x3c')](_0xdb49('0x3d'))){_0x195583[_0xdb49('0x1e')]=qs[_0xdb49('0x1e')](_0xc90158[_0xdb49('0x36')]['limit']);_0x195583[_0xdb49('0x1d')]=qs[_0xdb49('0x1d')](_0xc90158[_0xdb49('0x36')][_0xdb49('0x1d')]);}_0x195583[_0xdb49('0x3e')]=qs[_0xdb49('0x3f')](_0xc90158[_0xdb49('0x36')][_0xdb49('0x3f')]);_0x195583[_0xdb49('0x40')]=qs['filters'](_[_0xdb49('0x41')](_0xc90158[_0xdb49('0x36')],_0x4373fd[_0xdb49('0x37')]),_0x42fc2f);if(_0xc90158[_0xdb49('0x36')][_0xdb49('0x42')]){_0x195583[_0xdb49('0x40')]=_['merge'](_0x195583['where'],{'$or':_[_0xdb49('0x35')](_0x42fc2f,function(_0x561c13){if(_0x561c13[_0xdb49('0x43')]!==_0xdb49('0x44')){var _0x227c78={};_0x227c78[_0x561c13[_0xdb49('0x2e')]]={'$like':'%'+_0xc90158['query'][_0xdb49('0x42')]+'%'};return _0x227c78;}})});}_0x195583=_['merge']({},_0x195583,_0xc90158[_0xdb49('0x45')]);var _0xf52cbe={'where':_0x195583['where']};return db['Schedule'][_0xdb49('0x20')](_0xf52cbe)[_0xdb49('0x26')](function(_0x4fceb9){_0xd72ed7['count']=_0x4fceb9;if(_0xc90158['query'][_0xdb49('0x46')]){_0x195583['include']=[{'all':!![]}];}return db[_0xdb49('0x31')][_0xdb49('0x47')](_0x195583);})[_0xdb49('0x26')](function(_0x5c2995){_0xd72ed7['rows']=_0x5c2995;return _0xd72ed7;})[_0xdb49('0x26')](respondWithFilteredResult(_0x230bc1,_0x195583))[_0xdb49('0x48')](handleError(_0x230bc1,null));};exports[_0xdb49('0x49')]=function(_0x258cd2,_0x40e9f0){var _0x129d66={'raw':![],'where':{'id':_0x258cd2[_0xdb49('0x4a')]['id']}},_0x4ca4f6={};_0x4ca4f6['model']=_[_0xdb49('0x4b')](db['Schedule']['rawAttributes']);_0x4ca4f6['query']=_[_0xdb49('0x4b')](_0x258cd2[_0xdb49('0x36')]);_0x4ca4f6['filters']=_[_0xdb49('0x38')](_0x4ca4f6['model'],_0x4ca4f6['query']);_0x129d66[_0xdb49('0x3a')]=_[_0xdb49('0x38')](_0x4ca4f6[_0xdb49('0x34')],qs[_0xdb49('0x39')](_0x258cd2[_0xdb49('0x36')]['fields']));_0x129d66[_0xdb49('0x3a')]=_0x129d66[_0xdb49('0x3a')][_0xdb49('0x3b')]?_0x129d66[_0xdb49('0x3a')]:_0x4ca4f6[_0xdb49('0x34')];if(_0x258cd2[_0xdb49('0x36')][_0xdb49('0x46')]){_0x129d66[_0xdb49('0x4c')]=[{'all':!![]}];}_0x129d66=_[_0xdb49('0x4d')]({},_0x129d66,_0x258cd2[_0xdb49('0x45')]);return db[_0xdb49('0x31')][_0xdb49('0x4e')](_0x129d66)[_0xdb49('0x26')](handleEntityNotFound(_0x40e9f0,null))['then'](respondWithResult(_0x40e9f0,null))[_0xdb49('0x48')](handleError(_0x40e9f0,null));};exports[_0xdb49('0x4f')]=function(_0x1c4c80,_0x56daec){return db[_0xdb49('0x31')][_0xdb49('0x4f')](_0x1c4c80[_0xdb49('0x50')],{})[_0xdb49('0x26')](function(_0x23e7b8){var _0x3c7a0d=_0x1c4c80[_0xdb49('0x51')][_0xdb49('0x28')]({'plain':!![]});if(!_0x3c7a0d)throw new Error(_0xdb49('0x52'));if(_0x3c7a0d[_0xdb49('0x53')]===_0xdb49('0x51')){var _0x1d1896=_0x23e7b8[_0xdb49('0x28')]({'plain':!![]});var _0x3377c3=_0xdb49('0x29');return db[_0xdb49('0x54')][_0xdb49('0x4e')]({'where':{'name':_0x3377c3,'userProfileId':_0x3c7a0d[_0xdb49('0x55')]},'raw':!![]})['then'](function(_0x172411){if(_0x172411&&_0x172411[_0xdb49('0x56')]===0x0){return db[_0xdb49('0x2a')]['create']({'name':_0x1d1896[_0xdb49('0x2e')],'resourceId':_0x1d1896['id'],'type':_0x172411[_0xdb49('0x2e')],'sectionId':_0x172411['id']},{})[_0xdb49('0x26')](function(){return _0x23e7b8;});}else{return _0x23e7b8;}})[_0xdb49('0x48')](function(_0xfac9ce){logger[_0xdb49('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfac9ce);throw _0xfac9ce;});}return _0x23e7b8;})[_0xdb49('0x26')](respondWithResult(_0x56daec,0xc9))[_0xdb49('0x48')](handleError(_0x56daec,null));};exports[_0xdb49('0x57')]=function(_0x1d4105,_0x589ce4){if(_0x1d4105[_0xdb49('0x50')]['id']){delete _0x1d4105[_0xdb49('0x50')]['id'];}return db[_0xdb49('0x31')][_0xdb49('0x4e')]({'where':{'id':_0x1d4105[_0xdb49('0x4a')]['id']}})['then'](handleEntityNotFound(_0x589ce4,null))[_0xdb49('0x26')](saveUpdates(_0x1d4105[_0xdb49('0x50')],null))[_0xdb49('0x26')](respondWithResult(_0x589ce4,null))[_0xdb49('0x48')](handleError(_0x589ce4,null));};exports['destroy']=function(_0x316bcc,_0x405ab4){return db['Schedule']['find']({'where':{'id':_0x316bcc[_0xdb49('0x4a')]['id']}})['then'](handleEntityNotFound(_0x405ab4,null))[_0xdb49('0x26')](removeEntity(_0x405ab4,null))[_0xdb49('0x48')](handleError(_0x405ab4,null));};exports[_0xdb49('0x58')]=function(_0x2f6eb4,_0xdcff27,_0x8fa149){var _0x178384=require(_0xdb49('0x59'));return db['Schedule'][_0xdb49('0x4e')]({'where':{'id':_0x2f6eb4[_0xdb49('0x4a')]['id']},'raw':!![]})[_0xdb49('0x26')](handleEntityNotFound(_0xdcff27,null))[_0xdb49('0x26')](function(){_0x178384['run'](_0x2f6eb4['params']['id']);})[_0xdb49('0x26')](respondWithStatusCode(_0xdcff27,null))['catch'](handleError(_0xdcff27,null));}; \ No newline at end of file +var _0xcf84=['then','get','UserProfileResource','destroy','stack','name','send','map','Schedule','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','rows','show','params','keys','rawAttributes','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','update'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xcf84,0x1d8));var _0x4cf8=function(_0x2d4fee,_0xc38b94){_0x2d4fee=_0x2d4fee-0x0;var _0x265b33=_0xcf84[_0x2d4fee];return _0x265b33;};'use strict';var emlformat=require(_0x4cf8('0x0'));var rimraf=require(_0x4cf8('0x1'));var zipdir=require(_0x4cf8('0x2'));var jsonpatch=require(_0x4cf8('0x3'));var rp=require(_0x4cf8('0x4'));var moment=require(_0x4cf8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4cf8('0x6'));var path=require(_0x4cf8('0x7'));var sox=require(_0x4cf8('0x8'));var csv=require(_0x4cf8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4cf8('0xa'));var _=require(_0x4cf8('0xb'));var squel=require(_0x4cf8('0xc'));var crypto=require(_0x4cf8('0xd'));var jsforce=require(_0x4cf8('0xe'));var deskjs=require(_0x4cf8('0xf'));var toCsv=require(_0x4cf8('0x9'));var querystring=require(_0x4cf8('0x10'));var Papa=require(_0x4cf8('0x11'));var Redis=require(_0x4cf8('0x12'));var authService=require(_0x4cf8('0x13'));var qs=require(_0x4cf8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4cf8('0x15'));var logger=require(_0x4cf8('0x16'))(_0x4cf8('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4cf8('0x18'));var db=require(_0x4cf8('0x19'))['db'];function respondWithStatusCode(_0x54eb8f,_0x7ff09d){_0x7ff09d=_0x7ff09d||0xcc;return function(_0x2e5273){if(_0x2e5273){return _0x54eb8f[_0x4cf8('0x1a')](_0x7ff09d);}return _0x54eb8f[_0x4cf8('0x1b')](_0x7ff09d)[_0x4cf8('0x1c')]();};}function respondWithResult(_0xb4b8ab,_0x3faa02){_0x3faa02=_0x3faa02||0xc8;return function(_0x22f708){if(_0x22f708){return _0xb4b8ab[_0x4cf8('0x1b')](_0x3faa02)['json'](_0x22f708);}};}function respondWithFilteredResult(_0x263ff5,_0x25f947){return function(_0x25689c){if(_0x25689c){var _0x57303a=typeof _0x25f947[_0x4cf8('0x1d')]==='undefined'&&typeof _0x25f947['limit']===_0x4cf8('0x1e');var _0x560f3d=_0x25689c[_0x4cf8('0x1f')];var _0x4d0b4a=_0x57303a?0x0:_0x25f947[_0x4cf8('0x1d')];var _0x25d8ae=_0x57303a?_0x25689c[_0x4cf8('0x1f')]:_0x25f947['offset']+_0x25f947[_0x4cf8('0x20')];var _0x2dd553;if(_0x25d8ae>=_0x560f3d){_0x25d8ae=_0x560f3d;_0x2dd553=0xc8;}else{_0x2dd553=0xce;}_0x263ff5[_0x4cf8('0x1b')](_0x2dd553);return _0x263ff5[_0x4cf8('0x21')](_0x4cf8('0x22'),_0x4d0b4a+'-'+_0x25d8ae+'/'+_0x560f3d)[_0x4cf8('0x23')](_0x25689c);}return null;};}function patchUpdates(_0x56cca4){return function(_0x27e300){try{jsonpatch['apply'](_0x27e300,_0x56cca4,!![]);}catch(_0x3625c4){return BPromise[_0x4cf8('0x24')](_0x3625c4);}return _0x27e300['save']();};}function saveUpdates(_0x367345,_0x11a842){return function(_0x2575fc){if(_0x2575fc){return _0x2575fc[_0x4cf8('0x25')](_0x367345)[_0x4cf8('0x26')](function(_0x452a17){return _0x452a17;});}return null;};}function removeEntity(_0x2221a0,_0x3fab4a){return function(_0x105710){if(_0x105710){return _0x105710['destroy']()[_0x4cf8('0x26')](function(){var _0x34415f=_0x105710[_0x4cf8('0x27')]({'plain':!![]});var _0x17eee8='Scheduler';return db[_0x4cf8('0x28')][_0x4cf8('0x29')]({'where':{'type':_0x17eee8,'resourceId':_0x34415f['id']}})[_0x4cf8('0x26')](function(){return _0x105710;});})[_0x4cf8('0x26')](function(){_0x2221a0[_0x4cf8('0x1b')](0xcc)[_0x4cf8('0x1c')]();});}};}function handleEntityNotFound(_0x29cfb8,_0x4e53ea){return function(_0x320145){if(!_0x320145){_0x29cfb8['sendStatus'](0x194);}return _0x320145;};}function handleError(_0xc4833c,_0x406295){_0x406295=_0x406295||0x1f4;return function(_0x1ad7cd){logger['error'](_0x1ad7cd[_0x4cf8('0x2a')]);if(_0x1ad7cd[_0x4cf8('0x2b')]){delete _0x1ad7cd['name'];}_0xc4833c[_0x4cf8('0x1b')](_0x406295)[_0x4cf8('0x2c')](_0x1ad7cd);};}exports['index']=function(_0x57da9e,_0x2fa4cd){var _0x5bbe19={},_0x49bbeb={},_0x2d382d={'count':0x0,'rows':[]};var _0x34e13d=_[_0x4cf8('0x2d')](db[_0x4cf8('0x2e')]['rawAttributes'],function(_0x52d247){return{'name':_0x52d247[_0x4cf8('0x2f')],'type':_0x52d247['type'][_0x4cf8('0x30')]};});_0x49bbeb[_0x4cf8('0x31')]=_['map'](_0x34e13d,'name');_0x49bbeb[_0x4cf8('0x32')]=_['keys'](_0x57da9e['query']);_0x49bbeb['filters']=_['intersection'](_0x49bbeb[_0x4cf8('0x31')],_0x49bbeb['query']);_0x5bbe19[_0x4cf8('0x33')]=_[_0x4cf8('0x34')](_0x49bbeb['model'],qs[_0x4cf8('0x35')](_0x57da9e[_0x4cf8('0x32')][_0x4cf8('0x35')]));_0x5bbe19['attributes']=_0x5bbe19[_0x4cf8('0x33')][_0x4cf8('0x36')]?_0x5bbe19[_0x4cf8('0x33')]:_0x49bbeb['model'];if(!_0x57da9e[_0x4cf8('0x32')]['hasOwnProperty'](_0x4cf8('0x37'))){_0x5bbe19['limit']=qs[_0x4cf8('0x20')](_0x57da9e[_0x4cf8('0x32')][_0x4cf8('0x20')]);_0x5bbe19[_0x4cf8('0x1d')]=qs[_0x4cf8('0x1d')](_0x57da9e['query']['offset']);}_0x5bbe19['order']=qs[_0x4cf8('0x38')](_0x57da9e[_0x4cf8('0x32')][_0x4cf8('0x38')]);_0x5bbe19[_0x4cf8('0x39')]=qs[_0x4cf8('0x3a')](_['pick'](_0x57da9e[_0x4cf8('0x32')],_0x49bbeb[_0x4cf8('0x3a')]),_0x34e13d);if(_0x57da9e[_0x4cf8('0x32')][_0x4cf8('0x3b')]){_0x5bbe19[_0x4cf8('0x39')]=_[_0x4cf8('0x3c')](_0x5bbe19['where'],{'$or':_['map'](_0x34e13d,function(_0x425fe9){if(_0x425fe9[_0x4cf8('0x3d')]!==_0x4cf8('0x3e')){var _0x41b51a={};_0x41b51a[_0x425fe9['name']]={'$like':'%'+_0x57da9e['query'][_0x4cf8('0x3b')]+'%'};return _0x41b51a;}})});}_0x5bbe19=_['merge']({},_0x5bbe19,_0x57da9e[_0x4cf8('0x3f')]);var _0x5c1966={'where':_0x5bbe19[_0x4cf8('0x39')]};return db[_0x4cf8('0x2e')]['count'](_0x5c1966)[_0x4cf8('0x26')](function(_0x3b7617){_0x2d382d['count']=_0x3b7617;if(_0x57da9e[_0x4cf8('0x32')]['includeAll']){_0x5bbe19['include']=[{'all':!![]}];}return db[_0x4cf8('0x2e')][_0x4cf8('0x40')](_0x5bbe19);})[_0x4cf8('0x26')](function(_0x199aba){_0x2d382d[_0x4cf8('0x41')]=_0x199aba;return _0x2d382d;})[_0x4cf8('0x26')](respondWithFilteredResult(_0x2fa4cd,_0x5bbe19))['catch'](handleError(_0x2fa4cd,null));};exports[_0x4cf8('0x42')]=function(_0x112e15,_0x467c5b){var _0x58ea8f={'raw':![],'where':{'id':_0x112e15[_0x4cf8('0x43')]['id']}},_0x22401f={};_0x22401f[_0x4cf8('0x31')]=_[_0x4cf8('0x44')](db['Schedule'][_0x4cf8('0x45')]);_0x22401f[_0x4cf8('0x32')]=_[_0x4cf8('0x44')](_0x112e15[_0x4cf8('0x32')]);_0x22401f['filters']=_['intersection'](_0x22401f[_0x4cf8('0x31')],_0x22401f['query']);_0x58ea8f[_0x4cf8('0x33')]=_[_0x4cf8('0x34')](_0x22401f[_0x4cf8('0x31')],qs[_0x4cf8('0x35')](_0x112e15[_0x4cf8('0x32')]['fields']));_0x58ea8f[_0x4cf8('0x33')]=_0x58ea8f[_0x4cf8('0x33')][_0x4cf8('0x36')]?_0x58ea8f['attributes']:_0x22401f[_0x4cf8('0x31')];if(_0x112e15[_0x4cf8('0x32')][_0x4cf8('0x46')]){_0x58ea8f['include']=[{'all':!![]}];}_0x58ea8f=_[_0x4cf8('0x3c')]({},_0x58ea8f,_0x112e15['options']);return db[_0x4cf8('0x2e')]['find'](_0x58ea8f)[_0x4cf8('0x26')](handleEntityNotFound(_0x467c5b,null))[_0x4cf8('0x26')](respondWithResult(_0x467c5b,null))[_0x4cf8('0x47')](handleError(_0x467c5b,null));};exports[_0x4cf8('0x48')]=function(_0x4b07f6,_0x1e9c03){return db[_0x4cf8('0x2e')][_0x4cf8('0x48')](_0x4b07f6[_0x4cf8('0x49')],{})['then'](function(_0xfcf12e){var _0x1768f4=_0x4b07f6[_0x4cf8('0x4a')][_0x4cf8('0x27')]({'plain':!![]});if(!_0x1768f4)throw new Error(_0x4cf8('0x4b'));if(_0x1768f4[_0x4cf8('0x4c')]===_0x4cf8('0x4a')){var _0x42e367=_0xfcf12e[_0x4cf8('0x27')]({'plain':!![]});var _0x4f5bd1='Scheduler';return db[_0x4cf8('0x4d')][_0x4cf8('0x4e')]({'where':{'name':_0x4f5bd1,'userProfileId':_0x1768f4[_0x4cf8('0x4f')]},'raw':!![]})[_0x4cf8('0x26')](function(_0x5d7c4d){if(_0x5d7c4d&&_0x5d7c4d[_0x4cf8('0x50')]===0x0){return db['UserProfileResource'][_0x4cf8('0x48')]({'name':_0x42e367[_0x4cf8('0x2b')],'resourceId':_0x42e367['id'],'type':_0x5d7c4d['name'],'sectionId':_0x5d7c4d['id']},{})[_0x4cf8('0x26')](function(){return _0xfcf12e;});}else{return _0xfcf12e;}})['catch'](function(_0x5162ab){logger[_0x4cf8('0x51')](_0x4cf8('0x52'),_0x5162ab);throw _0x5162ab;});}return _0xfcf12e;})[_0x4cf8('0x26')](respondWithResult(_0x1e9c03,0xc9))[_0x4cf8('0x47')](handleError(_0x1e9c03,null));};exports[_0x4cf8('0x25')]=function(_0x455ded,_0x145ac7){if(_0x455ded[_0x4cf8('0x49')]['id']){delete _0x455ded[_0x4cf8('0x49')]['id'];}return db[_0x4cf8('0x2e')][_0x4cf8('0x4e')]({'where':{'id':_0x455ded[_0x4cf8('0x43')]['id']}})['then'](handleEntityNotFound(_0x145ac7,null))[_0x4cf8('0x26')](saveUpdates(_0x455ded['body'],null))[_0x4cf8('0x26')](respondWithResult(_0x145ac7,null))[_0x4cf8('0x47')](handleError(_0x145ac7,null));};exports[_0x4cf8('0x29')]=function(_0x948d14,_0x2e0901){return db[_0x4cf8('0x2e')][_0x4cf8('0x4e')]({'where':{'id':_0x948d14[_0x4cf8('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e0901,null))[_0x4cf8('0x26')](removeEntity(_0x2e0901,null))[_0x4cf8('0x47')](handleError(_0x2e0901,null));};exports[_0x4cf8('0x53')]=function(_0x2b929b,_0x4b5bc3,_0x461199){var _0x42b575=require(_0x4cf8('0x54'));return db['Schedule'][_0x4cf8('0x4e')]({'where':{'id':_0x2b929b['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4b5bc3,null))[_0x4cf8('0x26')](function(){_0x42b575[_0x4cf8('0x53')](_0x2b929b['params']['id']);})[_0x4cf8('0x26')](respondWithStatusCode(_0x4b5bc3,null))[_0x4cf8('0x47')](handleError(_0x4b5bc3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ea150da..49d4250 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 _0xa96c=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','tools_schedules','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa96c,0x104));var _0xca96=function(_0x59c447,_0x3de06b){_0x59c447=_0x59c447-0x0;var _0x4b6ca9=_0xa96c[_0x59c447];return _0x4b6ca9;};'use strict';var _=require(_0xca96('0x0'));var util=require(_0xca96('0x1'));var logger=require(_0xca96('0x2'))('api');var moment=require(_0xca96('0x3'));var BPromise=require(_0xca96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca96('0x5'));var rimraf=require(_0xca96('0x6'));var config=require(_0xca96('0x7'));var attributes=require('./schedule.attributes');module['exports']=function(_0x18647d,_0x3817b3){return _0x18647d['define']('Schedule',attributes,{'tableName':_0xca96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b53=['exports','define','Schedule','tools_schedules','util','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x1d8318,_0x5e3a78){var _0x32cba7=function(_0x50938e){while(--_0x50938e){_0x1d8318['push'](_0x1d8318['shift']());}};_0x32cba7(++_0x5e3a78);}(_0x9b53,0xd0));var _0x39b5=function(_0x433665,_0x385a4d){_0x433665=_0x433665-0x0;var _0x3fd5d5=_0x9b53[_0x433665];return _0x3fd5d5;};'use strict';var _=require('lodash');var util=require(_0x39b5('0x0'));var logger=require('../../config/logger')(_0x39b5('0x1'));var moment=require(_0x39b5('0x2'));var BPromise=require(_0x39b5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39b5('0x4'));var rimraf=require(_0x39b5('0x5'));var config=require(_0x39b5('0x6'));var attributes=require(_0x39b5('0x7'));module[_0x39b5('0x8')]=function(_0x4c80f1,_0x5e83df){return _0x4c80f1[_0x39b5('0x9')](_0x39b5('0xa'),attributes,{'tableName':_0x39b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 7d1ebcd..d1982f9 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 _0xf662=['code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x174f79,_0x17a7e3){var _0xf3a405=function(_0x3caca5){while(--_0x3caca5){_0x174f79['push'](_0x174f79['shift']());}};_0xf3a405(++_0x17a7e3);}(_0xf662,0xdf));var _0x2f66=function(_0x4ee695,_0x5a579b){_0x4ee695=_0x4ee695-0x0;var _0x165508=_0xf662[_0x4ee695];return _0x165508;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2f66('0x0'));var BPromise=require(_0x2f66('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f66('0x2'));var db=require(_0x2f66('0x3'))['db'];var utils=require(_0x2f66('0x4'));var logger=require(_0x2f66('0x5'))('rpc');var config=require(_0x2f66('0x6'));var jayson=require(_0x2f66('0x7'));var client=jayson[_0x2f66('0x8')][_0x2f66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cc47f,_0x24b007,_0x3b93dc){return new BPromise(function(_0x13b32f,_0xb5bdcb){return client[_0x2f66('0xa')](_0x4cc47f,_0x3b93dc)[_0x2f66('0xb')](function(_0xf7d95b){logger[_0x2f66('0xc')](_0x2f66('0xd'),_0x24b007,_0x2f66('0xe'));logger[_0x2f66('0xf')](_0x2f66('0x10'),_0x24b007,_0x2f66('0xe'),JSON[_0x2f66('0x11')](_0xf7d95b));if(_0xf7d95b[_0x2f66('0x12')]){if(_0xf7d95b[_0x2f66('0x12')][_0x2f66('0x13')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x24b007,_0xf7d95b[_0x2f66('0x12')][_0x2f66('0x14')]);return _0xb5bdcb(_0xf7d95b['error']['message']);}logger[_0x2f66('0x12')](_0x2f66('0xd'),_0x24b007,_0xf7d95b['error'][_0x2f66('0x14')]);return _0x13b32f(_0xf7d95b[_0x2f66('0x12')]['message']);}else{logger[_0x2f66('0xc')](_0x2f66('0xd'),_0x24b007,_0x2f66('0xe'));_0x13b32f(_0xf7d95b[_0x2f66('0x15')][_0x2f66('0x14')]);}})['catch'](function(_0x37bd94){logger[_0x2f66('0x12')](_0x2f66('0xd'),_0x24b007,_0x37bd94);_0xb5bdcb(_0x37bd94);});});} \ No newline at end of file +var _0x5428=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x16fb91,_0x44acf4){var _0x50f19b=function(_0x15d150){while(--_0x15d150){_0x16fb91['push'](_0x16fb91['shift']());}};_0x50f19b(++_0x44acf4);}(_0x5428,0x160));var _0x8542=function(_0x1ff0e6,_0x56b82d){_0x1ff0e6=_0x1ff0e6-0x0;var _0x4544b8=_0x5428[_0x1ff0e6];return _0x4544b8;};'use strict';var _=require(_0x8542('0x0'));var util=require(_0x8542('0x1'));var moment=require(_0x8542('0x2'));var BPromise=require(_0x8542('0x3'));var rs=require(_0x8542('0x4'));var fs=require('fs');var Redis=require(_0x8542('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8542('0x6'));var logger=require('../../config/logger')(_0x8542('0x7'));var config=require('../../config/environment');var jayson=require(_0x8542('0x8'));var client=jayson[_0x8542('0x9')][_0x8542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdadcf5,_0x1ecbd4,_0x2a3ac0){return new BPromise(function(_0x3c24c7,_0x1db40f){return client[_0x8542('0xb')](_0xdadcf5,_0x2a3ac0)[_0x8542('0xc')](function(_0x2cb6a8){logger[_0x8542('0xd')]('Schedule,\x20%s,\x20%s',_0x1ecbd4,_0x8542('0xe'));logger[_0x8542('0xf')](_0x8542('0x10'),_0x1ecbd4,'request\x20sent',JSON[_0x8542('0x11')](_0x2cb6a8));if(_0x2cb6a8['error']){if(_0x2cb6a8[_0x8542('0x12')][_0x8542('0x13')]===0x1f4){logger['error'](_0x8542('0x14'),_0x1ecbd4,_0x2cb6a8[_0x8542('0x12')][_0x8542('0x15')]);return _0x1db40f(_0x2cb6a8[_0x8542('0x12')][_0x8542('0x15')]);}logger[_0x8542('0x12')](_0x8542('0x14'),_0x1ecbd4,_0x2cb6a8['error']['message']);return _0x3c24c7(_0x2cb6a8[_0x8542('0x12')]['message']);}else{logger[_0x8542('0xd')](_0x8542('0x14'),_0x1ecbd4,_0x8542('0xe'));_0x3c24c7(_0x2cb6a8['result'][_0x8542('0x15')]);}})[_0x8542('0x16')](function(_0x4751a0){logger[_0x8542('0x12')](_0x8542('0x14'),_0x1ecbd4,_0x4751a0);_0x1db40f(_0x4751a0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 161ffae..69a7da4 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 _0xad0c=['../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','/:id/download','download','post','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1bd86,_0x1aacf2){var _0x3df04d=function(_0x238e4b){while(--_0x238e4b){_0x1bd86['push'](_0x1bd86['shift']());}};_0x3df04d(++_0x1aacf2);}(_0xad0c,0x1ed));var _0xcad0=function(_0x42f3ee,_0x2e9e0d){_0x42f3ee=_0x42f3ee-0x0;var _0x384c23=_0xad0c[_0x42f3ee];return _0x384c23;};'use strict';var multer=require(_0xcad0('0x0'));var util=require(_0xcad0('0x1'));var path=require(_0xcad0('0x2'));var timeout=require(_0xcad0('0x3'));var express=require(_0xcad0('0x4'));var router=express[_0xcad0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcad0('0x6'));var interaction=require(_0xcad0('0x7'));var config=require(_0xcad0('0x8'));var controller=require('./screenRecording.controller');router[_0xcad0('0x9')]('/',auth['isAuthenticated'](),controller[_0xcad0('0xa')]);router[_0xcad0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xcad0('0xb')]);router[_0xcad0('0x9')](_0xcad0('0xc'),auth[_0xcad0('0xd')](),controller[_0xcad0('0xe')]);router[_0xcad0('0x9')](_0xcad0('0xf'),auth['isAuthenticated'](),controller[_0xcad0('0x10')]);router[_0xcad0('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcad0('0xc'),auth[_0xcad0('0xd')](),controller['update']);router[_0xcad0('0x12')](_0xcad0('0xc'),auth[_0xcad0('0xd')](),controller[_0xcad0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2db5=['index','/describe','describe','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated'];(function(_0xc98562,_0x4aff40){var _0x5cb1d4=function(_0x1389b5){while(--_0x1389b5){_0xc98562['push'](_0xc98562['shift']());}};_0x5cb1d4(++_0x4aff40);}(_0x2db5,0x198));var _0x52db=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x2db5[_0x380307];return _0x9ea14b;};'use strict';var multer=require(_0x52db('0x0'));var util=require(_0x52db('0x1'));var path=require(_0x52db('0x2'));var timeout=require(_0x52db('0x3'));var express=require(_0x52db('0x4'));var router=express[_0x52db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x52db('0x6'));var interaction=require(_0x52db('0x7'));var config=require(_0x52db('0x8'));var controller=require(_0x52db('0x9'));router[_0x52db('0xa')]('/',auth[_0x52db('0xb')](),controller[_0x52db('0xc')]);router['get'](_0x52db('0xd'),auth[_0x52db('0xb')](),controller[_0x52db('0xe')]);router[_0x52db('0xa')]('/:id',auth[_0x52db('0xb')](),controller[_0x52db('0xf')]);router['get']('/:id/download',auth[_0x52db('0xb')](),controller['download']);router['post']('/',auth[_0x52db('0xb')](),controller[_0x52db('0x10')]);router['put'](_0x52db('0x11'),auth[_0x52db('0xb')](),controller['update']);router[_0x52db('0x12')](_0x52db('0x11'),auth[_0x52db('0xb')](),controller[_0x52db('0x13')]);module[_0x52db('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index dc821b8..279443a 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 _0xb846=['setDataValue','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','startedAt','subtract'];(function(_0xc83539,_0x2a0b8f){var _0x4b0745=function(_0x337ffe){while(--_0x337ffe){_0xc83539['push'](_0xc83539['shift']());}};_0x4b0745(++_0x2a0b8f);}(_0xb846,0x1d0));var _0x6b84=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb846[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0x6b84('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x6b84('0x1'));module[_0x6b84('0x2')]={'format':{'type':Sequelize[_0x6b84('0x3')],'get':function(){return this[_0x6b84('0x4')]('value')?path['extname'](this[_0x6b84('0x4')](_0x6b84('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x6b84('0x6')]},'channel':{'type':Sequelize[_0x6b84('0x6')]},'value':{'type':Sequelize[_0x6b84('0x6')],'set':function(_0x534d8e){var _0x54466a=_0x534d8e[_0x6b84('0x7')](/\\/g,'/');this['setDataValue'](_0x6b84('0x5'),_0x54466a);}},'rating':{'type':Sequelize[_0x6b84('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4faca2){this['setDataValue'](_0x6b84('0x9'),moment()[_0x6b84('0xa')](_0x4faca2,'ms'));this[_0x6b84('0xb')]('closedAt',moment());this['setDataValue']('duration',_0x4faca2);}},'startedAt':{'type':Sequelize[_0x6b84('0xc')],'get':function(){return moment(this[_0x6b84('0x4')](_0x6b84('0x9')))[_0x6b84('0xd')](_0x6b84('0xe'))[_0x6b84('0xf')]();}},'closedAt':{'type':Sequelize[_0x6b84('0xc')],'get':function(){return moment(this[_0x6b84('0x4')](_0x6b84('0x10')))[_0x6b84('0xd')](_0x6b84('0xe'))[_0x6b84('0xf')]();}},'createdAt':{'type':Sequelize[_0x6b84('0xc')],'get':function(){return moment(this['getDataValue'](_0x6b84('0x11')))['format'](_0x6b84('0xe'))[_0x6b84('0xf')]();}},'updatedAt':{'type':Sequelize[_0x6b84('0xc')],'get':function(){return moment(this[_0x6b84('0x4')](_0x6b84('0x12')))[_0x6b84('0xd')](_0x6b84('0xe'))[_0x6b84('0xf')]();}}}; \ No newline at end of file +var _0x1c7c=['moment','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize'];(function(_0xdc51ac,_0x45e375){var _0x495d75=function(_0x4f30bb){while(--_0x4f30bb){_0xdc51ac['push'](_0xdc51ac['shift']());}};_0x495d75(++_0x45e375);}(_0x1c7c,0x164));var _0xc1c7=function(_0x53d971,_0x2873f4){_0x53d971=_0x53d971-0x0;var _0x17ceea=_0x1c7c[_0x53d971];return _0x17ceea;};'use strict';var Sequelize=require(_0xc1c7('0x0'));var moment=require(_0xc1c7('0x1'));var path=require(_0xc1c7('0x2'));var config=require(_0xc1c7('0x3'));module['exports']={'format':{'type':Sequelize[_0xc1c7('0x4')],'get':function(){return this['getDataValue'](_0xc1c7('0x5'))?path[_0xc1c7('0x6')](this[_0xc1c7('0x7')](_0xc1c7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xc1c7('0x8')]},'channel':{'type':Sequelize[_0xc1c7('0x8')]},'value':{'type':Sequelize[_0xc1c7('0x8')],'set':function(_0x419138){var _0xce5bcd=_0x419138[_0xc1c7('0x9')](/\\/g,'/');this[_0xc1c7('0xa')](_0xc1c7('0x5'),_0xce5bcd);}},'rating':{'type':Sequelize[_0xc1c7('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc1c7('0xb')],'set':function(_0x339649){this[_0xc1c7('0xa')](_0xc1c7('0xc'),moment()['subtract'](_0x339649,'ms'));this[_0xc1c7('0xa')](_0xc1c7('0xd'),moment());this['setDataValue'](_0xc1c7('0xe'),_0x339649);}},'startedAt':{'type':Sequelize[_0xc1c7('0xf')],'get':function(){return moment(this[_0xc1c7('0x7')]('startedAt'))[_0xc1c7('0x10')](_0xc1c7('0x11'))[_0xc1c7('0x12')]();}},'closedAt':{'type':Sequelize[_0xc1c7('0xf')],'get':function(){return moment(this[_0xc1c7('0x7')](_0xc1c7('0xd')))[_0xc1c7('0x10')](_0xc1c7('0x11'))[_0xc1c7('0x12')]();}},'createdAt':{'type':Sequelize[_0xc1c7('0xf')],'get':function(){return moment(this[_0xc1c7('0x7')](_0xc1c7('0x13')))['format'](_0xc1c7('0x11'))[_0xc1c7('0x12')]();}},'updatedAt':{'type':Sequelize[_0xc1c7('0xf')],'get':function(){return moment(this['getDataValue'](_0xc1c7('0x14')))[_0xc1c7('0x10')](_0xc1c7('0x11'))[_0xc1c7('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ef5f0f2..d633efe 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 _0x24ca=['server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','ScreenRecording','include','findAll','rows','catch','show','model','includeAll','find','create','body','duration','createdAt','closedAt','params','describe','download','uniqueid','value','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','join'];(function(_0x14de19,_0x5e2ef6){var _0x102f9c=function(_0x30dd3d){while(--_0x30dd3d){_0x14de19['push'](_0x14de19['shift']());}};_0x102f9c(++_0x5e2ef6);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x24ca[_0x4c7935];return _0x30651d;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['ScreenRecording'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x32')](_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c')),['format']);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x28675f[_0xa24c('0x33')]);_0x5e491e['filters']=_[_0xa24c('0x35')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x33')]);_0x12dbdc[_0xa24c('0x36')]=_['intersection'](_0x5e491e['model'],qs[_0xa24c('0x37')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x37')]));_0x12dbdc[_0xa24c('0x36')]=_0x12dbdc[_0xa24c('0x36')][_0xa24c('0x38')]?_0x12dbdc[_0xa24c('0x36')]:_0x5e491e['model'];if(!_0x28675f[_0xa24c('0x33')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f[_0xa24c('0x33')]['offset']);}_0x12dbdc[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x3c')]);_0x12dbdc['where']=qs['filters'](_[_0xa24c('0x3d')](_0x28675f['query'],_0x5e491e[_0xa24c('0x3e')]),_0xc96ce7);if(_0x28675f[_0xa24c('0x33')][_0xa24c('0x3f')]){_0x12dbdc[_0xa24c('0x40')]=_[_0xa24c('0x41')](_0x12dbdc['where'],{'$or':_['map'](_0xc96ce7,function(_0x3121e){if(_0x3121e[_0xa24c('0x42')]!==_0xa24c('0x43')){var _0x213dc3={};_0x213dc3[_0x3121e[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x33')]['filter']+'%'};return _0x213dc3;}})});}_0x12dbdc=_['merge']({},_0x12dbdc,_0x28675f[_0xa24c('0x44')]);var _0x1ce83e={'where':_0x12dbdc[_0xa24c('0x40')]};return db[_0xa24c('0x45')][_0xa24c('0x20')](_0x1ce83e)['then'](function(_0x171c51){_0x21d2a8[_0xa24c('0x20')]=_0x171c51;if(_0x28675f['query']['includeAll']){_0x12dbdc[_0xa24c('0x46')]=[{'all':!![]}];}return db[_0xa24c('0x45')][_0xa24c('0x47')](_0x12dbdc);})['then'](function(_0x58ac8b){_0x21d2a8[_0xa24c('0x48')]=_0x58ac8b;return _0x21d2a8;})[_0xa24c('0x27')](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x49')](handleError(_0x152120,null));};exports[_0xa24c('0x4a')]=function(_0x3f640e,_0x1b7faf){var _0x23d1e0={'raw':![],'where':{'id':_0x3f640e['params']['id']}},_0x394d19={};_0x394d19['model']=_[_0xa24c('0x34')](db[_0xa24c('0x45')][_0xa24c('0x2f')]);_0x394d19['query']=_[_0xa24c('0x34')](_0x3f640e[_0xa24c('0x33')]);_0x394d19[_0xa24c('0x3e')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],_0x394d19[_0xa24c('0x33')]);_0x23d1e0[_0xa24c('0x36')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],qs[_0xa24c('0x37')](_0x3f640e['query'][_0xa24c('0x37')]));_0x23d1e0[_0xa24c('0x36')]=_0x23d1e0[_0xa24c('0x36')]['length']?_0x23d1e0[_0xa24c('0x36')]:_0x394d19[_0xa24c('0x4b')];if(_0x3f640e[_0xa24c('0x33')][_0xa24c('0x4c')]){_0x23d1e0[_0xa24c('0x46')]=[{'all':!![]}];}_0x23d1e0=_[_0xa24c('0x41')]({},_0x23d1e0,_0x3f640e[_0xa24c('0x44')]);return db[_0xa24c('0x45')][_0xa24c('0x4d')](_0x23d1e0)[_0xa24c('0x27')](handleEntityNotFound(_0x1b7faf,null))[_0xa24c('0x27')](respondWithResult(_0x1b7faf,null))['catch'](handleError(_0x1b7faf,null));};exports[_0xa24c('0x4e')]=function(_0x96b977,_0x42028b){return db[_0xa24c('0x45')][_0xa24c('0x4e')](_0x96b977[_0xa24c('0x4f')],{})[_0xa24c('0x27')](respondWithResult(_0x42028b,0xc9))[_0xa24c('0x49')](handleError(_0x42028b,null));};exports[_0xa24c('0x26')]=function(_0x4f56ae,_0x540da8){if(_0x4f56ae[_0xa24c('0x4f')]['id']){delete _0x4f56ae['body']['id'];}delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x50')];delete _0x4f56ae['body'][_0xa24c('0x51')];delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x52')];delete _0x4f56ae['body']['value'];return db[_0xa24c('0x45')]['find']({'where':{'id':_0x4f56ae[_0xa24c('0x53')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x540da8,null))[_0xa24c('0x27')](saveUpdates(_0x4f56ae[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x540da8,null))[_0xa24c('0x49')](handleError(_0x540da8,null));};exports[_0xa24c('0x54')]=function(_0x286d57,_0x22a0db){return db[_0xa24c('0x45')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x22a0db,null))[_0xa24c('0x49')](handleError(_0x22a0db,null));};exports[_0xa24c('0x55')]=function(_0x513271,_0x5bde94,_0x487cc9){var _0x2da4f0=require('../../components/encryptor');var _0x4757ff=![];var _0x21d0fc={};if(_0x513271['query'][_0xa24c('0x42')]&&_0x513271[_0xa24c('0x33')][_0xa24c('0x42')]===_0xa24c('0x56')){_0x21d0fc[_0xa24c('0x56')]=_0x513271[_0xa24c('0x53')]['id'];}else{_0x21d0fc['id']=_0x513271[_0xa24c('0x53')]['id'];}return db[_0xa24c('0x45')]['find']({'where':_0x21d0fc,'attributes':['id',_0xa24c('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x5bde94,null))['then'](function(_0x565f0a){if(_0x565f0a){var _0x5bd2af=path['join'](config[_0xa24c('0x58')],'server/files/screen_recordings',_0x565f0a[_0xa24c('0x57')]);var _0x3fd3f9=util[_0xa24c('0x59')](_0xa24c('0x5a'),_0x5bd2af);if(fs[_0xa24c('0x5b')](_0x3fd3f9)){_0x4757ff=!![];return _0x2da4f0[_0xa24c('0x5c')](_0x3fd3f9,_0x5bd2af,config[_0xa24c('0x5d')][_0xa24c('0x5e')])[_0xa24c('0x27')](function(){return _0x565f0a;});}return _0x565f0a;}})[_0xa24c('0x27')](function(_0x303b7d){if(_0x303b7d){var _0x37dbbd=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x303b7d['value']);if(!fs[_0xa24c('0x5b')](_0x37dbbd)){throw new db[(_0xa24c('0x61'))]['ValidationError'](_0xa24c('0x62'));}if(_0x303b7d[_0xa24c('0x63')]){return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,_0x303b7d[_0xa24c('0x63')]+path['extname'](_0x37dbbd),function(){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}else{return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,function(_0x5e9631){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}}})[_0xa24c('0x49')](function(_0x2515b1){if(_0x2515b1[_0xa24c('0x64')]===_0xa24c('0x62')){_0x5bde94['status'](0x194)['send'](_0xa24c('0x65'));}else{return handleError(_0x5bde94,null);}});};exports['destroy']=function(_0x52a895,_0xfcc193){return db[_0xa24c('0x45')][_0xa24c('0x4d')]({'where':{'id':_0x52a895['params']['id']}})[_0xa24c('0x27')](function(_0x128e5b){if(_['isNil'](_0x128e5b)){throw new ReferenceError(_0xa24c('0x66'));}return _0x128e5b;})[_0xa24c('0x27')](function(_0x3096bf){var _0x4bee5c=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x3096bf[_0xa24c('0x57')]);logger[_0xa24c('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x4bee5c);if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs[_0xa24c('0x5b')](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}_0x4bee5c=_0x4bee5c+'.cypher';if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs['existsSync'](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}return _0x3096bf;})[_0xa24c('0x27')](function(_0x3a241a){if(!_0x3a241a)throw new InternalError();return _0x3a241a[_0xa24c('0x28')]();})[_0xa24c('0x27')](function(){_0xfcc193[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();})['catch'](handleError(_0xfcc193,null));}; \ No newline at end of file +var _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x3a1ecb,_0x375564){var _0x2d5d6e=function(_0x27d150){while(--_0x27d150){_0x3a1ecb['push'](_0x3a1ecb['shift']());}};_0x2d5d6e(++_0x375564);}(_0x207c,0x1e8));var _0xc207=function(_0x21a798,_0x4b192f){_0x21a798=_0x21a798-0x0;var _0x137eb1=_0x207c[_0x21a798];return _0x137eb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7ef1ccf..57ad846 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 _0xdc20=['./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x2a509f,_0x2c5904){var _0x58a984=function(_0x336f23){while(--_0x336f23){_0x2a509f['push'](_0x2a509f['shift']());}};_0x58a984(++_0x2c5904);}(_0xdc20,0x118));var _0x0dc2=function(_0x5ed0b8,_0x9b2ac8){_0x5ed0b8=_0x5ed0b8-0x0;var _0x3ea84d=_0xdc20[_0x5ed0b8];return _0x3ea84d;};'use strict';var _=require('lodash');var util=require(_0x0dc2('0x0'));var logger=require('../../config/logger')(_0x0dc2('0x1'));var moment=require('moment');var BPromise=require(_0x0dc2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0dc2('0x3'));var rimraf=require(_0x0dc2('0x4'));var config=require(_0x0dc2('0x5'));var attributes=require(_0x0dc2('0x6'));module[_0x0dc2('0x7')]=function(_0x34d0a0,_0x3666f5){return _0x34d0a0[_0x0dc2('0x8')]('ScreenRecording',attributes,{'tableName':_0x0dc2('0x9'),'paranoid':![],'indexes':[{'name':_0x0dc2('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd327=['api','moment','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd327,0xe1));var _0x7d32=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd327[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7d32('0x0'));var util=require(_0x7d32('0x1'));var logger=require(_0x7d32('0x2'))(_0x7d32('0x3'));var moment=require(_0x7d32('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d32('0x5'));var rimraf=require(_0x7d32('0x6'));var config=require(_0x7d32('0x7'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x1760c0,_0xf48e3f){return _0x1760c0[_0x7d32('0x8')](_0x7d32('0x9'),attributes,{'tableName':_0x7d32('0xa'),'paranoid':![],'indexes':[{'name':_0x7d32('0xb'),'fields':[_0x7d32('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 17fc605..4eaadff 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 _0x4e94=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','catch'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x4e94,0x187));var _0x44e9=function(_0x8cb470,_0x2b9757){_0x8cb470=_0x8cb470-0x0;var _0x2ca139=_0x4e94[_0x8cb470];return _0x2ca139;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44e9('0x0'));var BPromise=require(_0x44e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44e9('0x2'));var db=require(_0x44e9('0x3'))['db'];var utils=require(_0x44e9('0x4'));var logger=require(_0x44e9('0x5'))('rpc');var config=require(_0x44e9('0x6'));var jayson=require(_0x44e9('0x7'));var client=jayson[_0x44e9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7e3a,_0x100704,_0x318acc){return new BPromise(function(_0x2810e4,_0x13c89c){return client['request'](_0x2d7e3a,_0x318acc)['then'](function(_0xcb180){logger[_0x44e9('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x100704,_0x44e9('0xa'));logger['debug'](_0x44e9('0xb'),_0x100704,_0x44e9('0xa'),JSON[_0x44e9('0xc')](_0xcb180));if(_0xcb180['error']){if(_0xcb180['error']['code']===0x1f4){logger[_0x44e9('0xd')](_0x44e9('0xe'),_0x100704,_0xcb180[_0x44e9('0xd')][_0x44e9('0xf')]);return _0x13c89c(_0xcb180['error']['message']);}logger[_0x44e9('0xd')](_0x44e9('0xe'),_0x100704,_0xcb180['error'][_0x44e9('0xf')]);return _0x2810e4(_0xcb180[_0x44e9('0xd')]['message']);}else{logger[_0x44e9('0x9')](_0x44e9('0xe'),_0x100704,_0x44e9('0xa'));_0x2810e4(_0xcb180['result'][_0x44e9('0xf')]);}})[_0x44e9('0x10')](function(_0x5ea2c){logger[_0x44e9('0xd')](_0x44e9('0xe'),_0x100704,_0x5ea2c);_0x13c89c(_0x5ea2c);});});} \ No newline at end of file +var _0xb6c4=['code','message','info','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb6c4,0xed));var _0x4b6c=function(_0x424030,_0x306c28){_0x424030=_0x424030-0x0;var _0x5ae703=_0xb6c4[_0x424030];return _0x5ae703;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4b6c('0x0'));var BPromise=require(_0x4b6c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b6c('0x2'));var db=require(_0x4b6c('0x3'))['db'];var utils=require(_0x4b6c('0x4'));var logger=require('../../config/logger')(_0x4b6c('0x5'));var config=require(_0x4b6c('0x6'));var jayson=require(_0x4b6c('0x7'));var client=jayson[_0x4b6c('0x8')][_0x4b6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f3577,_0x213578,_0x481ea8){return new BPromise(function(_0x58fe64,_0x1d2779){return client['request'](_0x1f3577,_0x481ea8)['then'](function(_0x43677a){logger['info'](_0x4b6c('0xa'),_0x213578,'request\x20sent');logger[_0x4b6c('0xb')](_0x4b6c('0xc'),_0x213578,'request\x20sent',JSON[_0x4b6c('0xd')](_0x43677a));if(_0x43677a[_0x4b6c('0xe')]){if(_0x43677a[_0x4b6c('0xe')][_0x4b6c('0xf')]===0x1f4){logger[_0x4b6c('0xe')](_0x4b6c('0xa'),_0x213578,_0x43677a[_0x4b6c('0xe')][_0x4b6c('0x10')]);return _0x1d2779(_0x43677a[_0x4b6c('0xe')]['message']);}logger[_0x4b6c('0xe')](_0x4b6c('0xa'),_0x213578,_0x43677a[_0x4b6c('0xe')]['message']);return _0x58fe64(_0x43677a[_0x4b6c('0xe')]['message']);}else{logger[_0x4b6c('0x11')](_0x4b6c('0xa'),_0x213578,_0x4b6c('0x12'));_0x58fe64(_0x43677a[_0x4b6c('0x13')][_0x4b6c('0x10')]);}})[_0x4b6c('0x14')](function(_0x514162){logger[_0x4b6c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x213578,_0x514162);_0x1d2779(_0x514162);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a28a81f..ed6492e 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 _0x4456=['join','root','logologin','post','addLogoLogin','server/files/images/logos/','preferred','originalname','addPreferred','favicon','addFavicon','put','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','format','%s%s','logo','extname','single','file','addLogo'];(function(_0x2a47ae,_0x2c27bc){var _0x30f40d=function(_0x3c7adb){while(--_0x3c7adb){_0x2a47ae['push'](_0x2a47ae['shift']());}};_0x30f40d(++_0x2c27bc);}(_0x4456,0xd5));var _0x6445=function(_0xa5f9c5,_0x2899d4){_0xa5f9c5=_0xa5f9c5-0x0;var _0x4d0b77=_0x4456[_0xa5f9c5];return _0x4d0b77;};'use strict';var multer=require('multer');var util=require(_0x6445('0x0'));var path=require('path');var timeout=require(_0x6445('0x1'));var express=require(_0x6445('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6445('0x3'));var config=require(_0x6445('0x4'));var controller=require(_0x6445('0x5'));router[_0x6445('0x6')]('/',auth[_0x6445('0x7')](),controller[_0x6445('0x8')]);router['get'](_0x6445('0x9'),controller[_0x6445('0xa')]);router[_0x6445('0x6')]('/:id',controller['show']);router[_0x6445('0x6')](_0x6445('0xb'),controller[_0x6445('0xc')]);router[_0x6445('0x6')](_0x6445('0xd'),controller[_0x6445('0xe')]);router[_0x6445('0x6')]('/:id/gdpr',controller[_0x6445('0xf')]);router[_0x6445('0x6')](_0x6445('0x10'),controller['getPreferred']);router['get'](_0x6445('0x11'),controller[_0x6445('0x12')]);var upload=multer({'storage':multer[_0x6445('0x13')]({'destination':function(_0x20f32c,_0x561d87,_0x279c14){_0x279c14(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x320387,_0x1a3852,_0x230bb0){_0x230bb0(null,util[_0x6445('0x14')](_0x6445('0x15'),_0x6445('0x16'),path[_0x6445('0x17')](_0x1a3852['originalname'])));}})});router['post']('/:id/logo',upload[_0x6445('0x18')](_0x6445('0x19')),controller[_0x6445('0x1a')]);var upload=multer({'storage':multer[_0x6445('0x13')]({'destination':function(_0x15a694,_0x58b5cb,_0x549891){_0x549891(null,path[_0x6445('0x1b')](config[_0x6445('0x1c')],'server/files/images/logos/'));},'filename':function(_0x50d91c,_0x2f7839,_0x361c66){_0x361c66(null,util[_0x6445('0x14')]('%s%s',_0x6445('0x1d'),path[_0x6445('0x17')](_0x2f7839['originalname'])));}})});router[_0x6445('0x1e')](_0x6445('0xd'),upload[_0x6445('0x18')]('file'),controller[_0x6445('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x108a24,_0x5ed560,_0x17d877){_0x17d877(null,path[_0x6445('0x1b')](config[_0x6445('0x1c')],_0x6445('0x20')));},'filename':function(_0x5df6f5,_0x5ba55b,_0x851e9d){_0x851e9d(null,util[_0x6445('0x14')](_0x6445('0x15'),_0x6445('0x21'),path[_0x6445('0x17')](_0x5ba55b[_0x6445('0x22')])));}})});router[_0x6445('0x1e')]('/:id/preferred',upload[_0x6445('0x18')](_0x6445('0x19')),controller[_0x6445('0x23')]);var upload=multer({'storage':multer[_0x6445('0x13')]({'destination':function(_0x3f337e,_0x9700b6,_0xc929b2){_0xc929b2(null,path[_0x6445('0x1b')](config[_0x6445('0x1c')],_0x6445('0x20')));},'filename':function(_0x4ebd15,_0x507acd,_0x20271a){_0x20271a(null,util[_0x6445('0x14')](_0x6445('0x15'),_0x6445('0x24'),path['extname'](_0x507acd[_0x6445('0x22')])));}})});router[_0x6445('0x1e')](_0x6445('0x11'),upload[_0x6445('0x18')]('file'),controller[_0x6445('0x25')]);router[_0x6445('0x26')]('/:id',auth[_0x6445('0x7')](),controller['update']);module[_0x6445('0x27')]=router; \ No newline at end of file +var _0x5214=['show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','post','addLogo','root','logologin','originalname','/:id/logo_login','file','preferred','single','favicon','addFavicon','put','/:id','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','get','/now','getDate'];(function(_0x1bb6b7,_0x55d889){var _0x4616ed=function(_0x456efd){while(--_0x456efd){_0x1bb6b7['push'](_0x1bb6b7['shift']());}};_0x4616ed(++_0x55d889);}(_0x5214,0x1a2));var _0x4521=function(_0x2ed5e3,_0x3c11fa){_0x2ed5e3=_0x2ed5e3-0x0;var _0x3aea48=_0x5214[_0x2ed5e3];return _0x3aea48;};'use strict';var multer=require(_0x4521('0x0'));var util=require(_0x4521('0x1'));var path=require(_0x4521('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4521('0x3')]();var fs_extra=require(_0x4521('0x4'));var auth=require(_0x4521('0x5'));var interaction=require(_0x4521('0x6'));var config=require('../../config/environment');var controller=require(_0x4521('0x7'));router['get']('/',auth[_0x4521('0x8')](),controller['index']);router[_0x4521('0x9')](_0x4521('0xa'),controller[_0x4521('0xb')]);router[_0x4521('0x9')]('/:id',controller[_0x4521('0xc')]);router[_0x4521('0x9')](_0x4521('0xd'),controller[_0x4521('0xe')]);router['get']('/:id/logo_login',controller[_0x4521('0xf')]);router[_0x4521('0x9')](_0x4521('0x10'),controller[_0x4521('0x11')]);router['get'](_0x4521('0x12'),controller[_0x4521('0x13')]);router[_0x4521('0x9')](_0x4521('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0x4521('0x15')]({'destination':function(_0xe77c00,_0xda6e56,_0x60972c){_0x60972c(null,path[_0x4521('0x16')](config['root'],_0x4521('0x17')));},'filename':function(_0x52b133,_0x2db989,_0x401dd4){_0x401dd4(null,util[_0x4521('0x18')](_0x4521('0x19'),_0x4521('0x1a'),path[_0x4521('0x1b')](_0x2db989['originalname'])));}})});router[_0x4521('0x1c')](_0x4521('0xd'),upload['single']('file'),controller[_0x4521('0x1d')]);var upload=multer({'storage':multer[_0x4521('0x15')]({'destination':function(_0x1400e4,_0x2ce910,_0x21e254){_0x21e254(null,path[_0x4521('0x16')](config[_0x4521('0x1e')],_0x4521('0x17')));},'filename':function(_0x1ffd7e,_0x5c921f,_0x5a2257){_0x5a2257(null,util[_0x4521('0x18')](_0x4521('0x19'),_0x4521('0x1f'),path[_0x4521('0x1b')](_0x5c921f[_0x4521('0x20')])));}})});router[_0x4521('0x1c')](_0x4521('0x21'),upload['single'](_0x4521('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x4521('0x15')]({'destination':function(_0x322bf6,_0x546cf3,_0x2a4e30){_0x2a4e30(null,path['join'](config[_0x4521('0x1e')],_0x4521('0x17')));},'filename':function(_0x2e9744,_0x4749be,_0x2ceb25){_0x2ceb25(null,util[_0x4521('0x18')](_0x4521('0x19'),_0x4521('0x23'),path[_0x4521('0x1b')](_0x4749be[_0x4521('0x20')])));}})});router[_0x4521('0x1c')](_0x4521('0x12'),upload[_0x4521('0x24')](_0x4521('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0x4521('0x15')]({'destination':function(_0x4d6391,_0x308979,_0x458e20){_0x458e20(null,path[_0x4521('0x16')](config[_0x4521('0x1e')],_0x4521('0x17')));},'filename':function(_0x38540e,_0x3babc9,_0x3b11a4){_0x3b11a4(null,util[_0x4521('0x18')](_0x4521('0x19'),_0x4521('0x25'),path['extname'](_0x3babc9[_0x4521('0x20')])));}})});router['post']('/:id/favicon',upload[_0x4521('0x24')]('file'),controller[_0x4521('0x26')]);router[_0x4521('0x27')](_0x4521('0x28'),auth[_0x4521('0x8')](),controller[_0x4521('0x29')]);module[_0x4521('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b82c8f8..c82d651 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 _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'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 95287e6..673ddba 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 _0x9d8c=['request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','end','name','send','Setting','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','ValidationError','\x20not\x20found','download','../../config/license/util','getLogoLogin','defaultPreferred','defaultFavicon','default_loginLogo.svg','Sequelize','gdpr','getLicense','defaultLoginLogo','default_preferred.png','getFavicon','default_favicon.ico','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch'];(function(_0x1982bf,_0x12e63a){var _0x2315de=function(_0x5d6eef){while(--_0x5d6eef){_0x1982bf['push'](_0x1982bf['shift']());}};_0x2315de(++_0x12e63a);}(_0x9d8c,0x162));var _0xc9d8=function(_0x15df76,_0x249a71){_0x15df76=_0x15df76-0x0;var _0x5598d4=_0x9d8c[_0x15df76];return _0x5598d4;};'use strict';var emlformat=require(_0xc9d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9d8('0x1'));var jsonpatch=require(_0xc9d8('0x2'));var rp=require(_0xc9d8('0x3'));var moment=require('moment');var BPromise=require(_0xc9d8('0x4'));var Mustache=require(_0xc9d8('0x5'));var util=require(_0xc9d8('0x6'));var path=require(_0xc9d8('0x7'));var sox=require('sox');var csv=require(_0xc9d8('0x8'));var ejs=require(_0xc9d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9d8('0xa'));var squel=require(_0xc9d8('0xb'));var crypto=require(_0xc9d8('0xc'));var jsforce=require(_0xc9d8('0xd'));var deskjs=require(_0xc9d8('0xe'));var toCsv=require(_0xc9d8('0x8'));var querystring=require(_0xc9d8('0xf'));var Papa=require(_0xc9d8('0x10'));var Redis=require(_0xc9d8('0x11'));var authService=require(_0xc9d8('0x12'));var qs=require(_0xc9d8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9d8('0x14'));var logger=require('../../config/logger')(_0xc9d8('0x15'));var utils=require('../../config/utils');var config=require(_0xc9d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9d8('0x17'))['db'];var jayson=require(_0xc9d8('0x18'));var client=jayson['client'][_0xc9d8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x46dc87,_0x1d2a70,_0x16d664,_0x775bf7){return new BPromise(function(_0x1f8692,_0xa6c244){var _0x3edc6c=_0x775bf7||client;return _0x3edc6c[_0xc9d8('0x1a')](_0x46dc87,_0x16d664)[_0xc9d8('0x1b')](function(_0x1b21ac){logger['info'](_0xc9d8('0x1c'),_0x1d2a70,_0xc9d8('0x1d'));logger[_0xc9d8('0x1e')](_0xc9d8('0x1f'),_0x1d2a70,_0xc9d8('0x1d'),JSON[_0xc9d8('0x20')](_0x1b21ac));if(_0x1b21ac[_0xc9d8('0x21')]){if(_0x1b21ac[_0xc9d8('0x21')]['code']===0x1f4){logger[_0xc9d8('0x21')](_0xc9d8('0x1c'),_0x1d2a70,_0x1b21ac['error'][_0xc9d8('0x22')]);return _0xa6c244(_0x1b21ac[_0xc9d8('0x21')][_0xc9d8('0x22')]);}logger[_0xc9d8('0x21')](_0xc9d8('0x1c'),_0x1d2a70,_0x1b21ac[_0xc9d8('0x21')]['message']);return _0x1f8692(_0x1b21ac[_0xc9d8('0x21')][_0xc9d8('0x22')]);}else{logger['info'](_0xc9d8('0x1c'),_0x1d2a70,_0xc9d8('0x1d'));_0x1f8692(_0x1b21ac[_0xc9d8('0x23')][_0xc9d8('0x22')]);}})['catch'](function(_0x468788){logger['error'](_0xc9d8('0x1c'),_0x1d2a70,_0x468788);_0xa6c244(_0x468788);});});}function respondWithStatusCode(_0x2edc39,_0x56fafb){_0x56fafb=_0x56fafb||0xcc;return function(_0x36dd96){if(_0x36dd96){return _0x2edc39[_0xc9d8('0x24')](_0x56fafb);}return _0x2edc39[_0xc9d8('0x25')](_0x56fafb)['end']();};}function respondWithResult(_0x3f05b5,_0x134988){_0x134988=_0x134988||0xc8;return function(_0x290c29){if(_0x290c29){return _0x3f05b5[_0xc9d8('0x25')](_0x134988)['json'](_0x290c29);}};}function respondWithFilteredResult(_0x45d7cc,_0x48a976){return function(_0x2f1300){if(_0x2f1300){var _0x14b75d=typeof _0x48a976[_0xc9d8('0x26')]===_0xc9d8('0x27')&&typeof _0x48a976['limit']==='undefined';var _0x151495=_0x2f1300[_0xc9d8('0x28')];var _0x3b2a5d=_0x14b75d?0x0:_0x48a976['offset'];var _0x453cd3=_0x14b75d?_0x2f1300['count']:_0x48a976[_0xc9d8('0x26')]+_0x48a976[_0xc9d8('0x29')];var _0x421e57;if(_0x453cd3>=_0x151495){_0x453cd3=_0x151495;_0x421e57=0xc8;}else{_0x421e57=0xce;}_0x45d7cc[_0xc9d8('0x25')](_0x421e57);return _0x45d7cc['set'](_0xc9d8('0x2a'),_0x3b2a5d+'-'+_0x453cd3+'/'+_0x151495)[_0xc9d8('0x2b')](_0x2f1300);}return null;};}function patchUpdates(_0x2b702b){return function(_0x211c58){try{jsonpatch[_0xc9d8('0x2c')](_0x211c58,_0x2b702b,!![]);}catch(_0xf8e1d1){return BPromise[_0xc9d8('0x2d')](_0xf8e1d1);}return _0x211c58[_0xc9d8('0x2e')]();};}function saveUpdates(_0x226411,_0x4f7d34){return function(_0x42ccfb){if(_0x42ccfb){return _0x42ccfb[_0xc9d8('0x2f')](_0x226411)[_0xc9d8('0x1b')](function(_0x30d083){return _0x30d083;});}return null;};}function removeEntity(_0xea2e47,_0x1edc34){return function(_0x539f25){if(_0x539f25){return _0x539f25['destroy']()['then'](function(){_0xea2e47[_0xc9d8('0x25')](0xcc)[_0xc9d8('0x30')]();});}};}function handleEntityNotFound(_0x400415,_0x437091){return function(_0xffd6f9){if(!_0xffd6f9){_0x400415[_0xc9d8('0x24')](0x194);}return _0xffd6f9;};}function handleError(_0x20444b,_0x4c257c){_0x4c257c=_0x4c257c||0x1f4;return function(_0x3dadd8){logger[_0xc9d8('0x21')](_0x3dadd8['stack']);if(_0x3dadd8[_0xc9d8('0x31')]){delete _0x3dadd8[_0xc9d8('0x31')];}_0x20444b[_0xc9d8('0x25')](_0x4c257c)[_0xc9d8('0x32')](_0x3dadd8);};}exports['index']=function(_0x2c6bcb,_0x475c70){var _0x5cca2b={},_0x44ff14={},_0x508fc0={'count':0x0,'rows':[]};var _0x1983f5=_['map'](db[_0xc9d8('0x33')][_0xc9d8('0x34')],function(_0x11d338){return{'name':_0x11d338[_0xc9d8('0x35')],'type':_0x11d338[_0xc9d8('0x36')][_0xc9d8('0x37')]};});_0x44ff14['model']=_['map'](_0x1983f5,_0xc9d8('0x31'));_0x44ff14[_0xc9d8('0x38')]=_[_0xc9d8('0x39')](_0x2c6bcb[_0xc9d8('0x38')]);_0x44ff14[_0xc9d8('0x3a')]=_[_0xc9d8('0x3b')](_0x44ff14[_0xc9d8('0x3c')],_0x44ff14[_0xc9d8('0x38')]);_0x5cca2b[_0xc9d8('0x3d')]=_[_0xc9d8('0x3b')](_0x44ff14[_0xc9d8('0x3c')],qs['fields'](_0x2c6bcb[_0xc9d8('0x38')][_0xc9d8('0x3e')]));_0x5cca2b[_0xc9d8('0x3d')]=_0x5cca2b[_0xc9d8('0x3d')][_0xc9d8('0x3f')]?_0x5cca2b[_0xc9d8('0x3d')]:_0x44ff14['model'];if(!_0x2c6bcb[_0xc9d8('0x38')][_0xc9d8('0x40')](_0xc9d8('0x41'))){_0x5cca2b[_0xc9d8('0x29')]=qs[_0xc9d8('0x29')](_0x2c6bcb[_0xc9d8('0x38')][_0xc9d8('0x29')]);_0x5cca2b[_0xc9d8('0x26')]=qs[_0xc9d8('0x26')](_0x2c6bcb[_0xc9d8('0x38')][_0xc9d8('0x26')]);}_0x5cca2b['order']=qs['sort'](_0x2c6bcb[_0xc9d8('0x38')][_0xc9d8('0x42')]);_0x5cca2b[_0xc9d8('0x43')]=qs['filters'](_[_0xc9d8('0x44')](_0x2c6bcb[_0xc9d8('0x38')],_0x44ff14[_0xc9d8('0x3a')]),_0x1983f5);if(_0x2c6bcb['query'][_0xc9d8('0x45')]){_0x5cca2b[_0xc9d8('0x43')]=_['merge'](_0x5cca2b[_0xc9d8('0x43')],{'$or':_[_0xc9d8('0x46')](_0x1983f5,function(_0x24bb94){if(_0x24bb94['type']!=='VIRTUAL'){var _0x56150c={};_0x56150c[_0x24bb94[_0xc9d8('0x31')]]={'$like':'%'+_0x2c6bcb[_0xc9d8('0x38')][_0xc9d8('0x45')]+'%'};return _0x56150c;}})});}_0x5cca2b=_[_0xc9d8('0x47')]({},_0x5cca2b,_0x2c6bcb[_0xc9d8('0x48')]);var _0x16f3d6={'where':_0x5cca2b[_0xc9d8('0x43')]};return db[_0xc9d8('0x33')][_0xc9d8('0x28')](_0x16f3d6)[_0xc9d8('0x1b')](function(_0x498a57){_0x508fc0[_0xc9d8('0x28')]=_0x498a57;if(_0x2c6bcb[_0xc9d8('0x38')][_0xc9d8('0x49')]){_0x5cca2b[_0xc9d8('0x4a')]=[{'all':!![]}];}return db[_0xc9d8('0x33')][_0xc9d8('0x4b')](_0x5cca2b);})[_0xc9d8('0x1b')](function(_0x2490b9){_0x508fc0[_0xc9d8('0x4c')]=_0x2490b9;return _0x508fc0;})[_0xc9d8('0x1b')](respondWithFilteredResult(_0x475c70,_0x5cca2b))[_0xc9d8('0x4d')](handleError(_0x475c70,null));};exports[_0xc9d8('0x4e')]=function(_0x4ef0de,_0x17e913){var _0x4cdb4c={'raw':![],'where':{'id':_0x4ef0de[_0xc9d8('0x4f')]['id']}},_0x4c6d68={};_0x4c6d68[_0xc9d8('0x3c')]=_[_0xc9d8('0x39')](db[_0xc9d8('0x33')][_0xc9d8('0x34')]);_0x4c6d68[_0xc9d8('0x38')]=_[_0xc9d8('0x39')](_0x4ef0de[_0xc9d8('0x38')]);_0x4c6d68['filters']=_[_0xc9d8('0x3b')](_0x4c6d68[_0xc9d8('0x3c')],_0x4c6d68['query']);_0x4cdb4c[_0xc9d8('0x3d')]=_['intersection'](_0x4c6d68['model'],qs[_0xc9d8('0x3e')](_0x4ef0de[_0xc9d8('0x38')][_0xc9d8('0x3e')]));_0x4cdb4c[_0xc9d8('0x3d')]=_0x4cdb4c['attributes'][_0xc9d8('0x3f')]?_0x4cdb4c[_0xc9d8('0x3d')]:_0x4c6d68[_0xc9d8('0x3c')];if(_0x4ef0de['query'][_0xc9d8('0x49')]){_0x4cdb4c['include']=[{'all':!![]}];}_0x4cdb4c=_[_0xc9d8('0x47')]({},_0x4cdb4c,_0x4ef0de['options']);return db['Setting']['find'](_0x4cdb4c)['then'](handleEntityNotFound(_0x17e913,null))[_0xc9d8('0x1b')](respondWithResult(_0x17e913,null))[_0xc9d8('0x4d')](handleError(_0x17e913,null));};exports[_0xc9d8('0x2f')]=function(_0x57781c,_0x4124c8){if(_0x57781c['body']['id']){delete _0x57781c[_0xc9d8('0x50')]['id'];}return db[_0xc9d8('0x33')][_0xc9d8('0x51')]({'where':{'id':_0x57781c[_0xc9d8('0x4f')]['id']}})[_0xc9d8('0x1b')](handleEntityNotFound(_0x4124c8,null))[_0xc9d8('0x1b')](saveUpdates(_0x57781c[_0xc9d8('0x50')],null))[_0xc9d8('0x1b')](respondWithResult(_0x4124c8,null))[_0xc9d8('0x4d')](handleError(_0x4124c8,null));};exports[_0xc9d8('0x52')]=function(_0x3d6276,_0x4ea11f,_0x1abf54){if(_0x3d6276[_0xc9d8('0x53')]&&_0x3d6276[_0xc9d8('0x53')]['filename']){_0x3d6276[_0xc9d8('0x50')][_0xc9d8('0x54')]=_0x3d6276[_0xc9d8('0x53')][_0xc9d8('0x55')];}return db[_0xc9d8('0x33')]['find']({'where':{'id':_0x3d6276['params']['id']}})[_0xc9d8('0x1b')](handleEntityNotFound(_0x4ea11f,null))['then'](saveUpdates(_0x3d6276[_0xc9d8('0x50')],null))[_0xc9d8('0x1b')](respondWithResult(_0x4ea11f,null))[_0xc9d8('0x4d')](handleError(_0x4ea11f,null));};exports[_0xc9d8('0x56')]=function(_0x51051d,_0x4c6653,_0x1bb359){if(_0x51051d[_0xc9d8('0x53')]&&_0x51051d[_0xc9d8('0x53')]['filename']){_0x51051d[_0xc9d8('0x50')][_0xc9d8('0x57')]=_0x51051d[_0xc9d8('0x53')][_0xc9d8('0x55')];}return db[_0xc9d8('0x33')][_0xc9d8('0x51')]({'where':{'id':_0x51051d[_0xc9d8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4c6653,null))[_0xc9d8('0x1b')](saveUpdates(_0x51051d[_0xc9d8('0x50')],null))[_0xc9d8('0x1b')](respondWithResult(_0x4c6653,null))[_0xc9d8('0x4d')](handleError(_0x4c6653,null));};var utilLicense=require('../../config/license/util');exports[_0xc9d8('0x58')]=function(_0x1cc18f,_0x19ed34,_0x19dce4){var _0x3d3e87=_0xc9d8('0x59');var _0x575ba9={'custom':![]};return utilLicense['getLicense']()[_0xc9d8('0x1b')](function(_0x37f3b7){if(_0x37f3b7){_0x575ba9=_0x37f3b7;}return db['Setting'][_0xc9d8('0x51')]({'where':{'id':_0x1cc18f[_0xc9d8('0x4f')]['id']},'attributes':['logo',_0xc9d8('0x57'),_0xc9d8('0x5a'),_0xc9d8('0x5b'),_0xc9d8('0x5c'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xc9d8('0x1b')](handleEntityNotFound(_0x19ed34,null))[_0xc9d8('0x1b')](function(_0x3f8134){if(_0x3f8134){var _0x1aa580=_0x3f8134[_0xc9d8('0x54')]&&fs[_0xc9d8('0x5d')](path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x3d3e87,_[_0xc9d8('0x60')](_0x3f8134['logo'])))?path[_0xc9d8('0x5e')](config['root'],_0x3d3e87,_[_0xc9d8('0x60')](_0x3f8134['logo'])):path['join'](config[_0xc9d8('0x5f')],_0x3d3e87,_[_0xc9d8('0x60')](_0xc9d8('0x61')));var _0x55c24b=_0xc9d8('0x62')+_[_0xc9d8('0x63')]('logo');if(_0x3f8134[_0x55c24b]||!_0x575ba9['custom']){_0x1aa580=path['join'](config['root'],_0x3d3e87,_[_0xc9d8('0x60')](_0xc9d8('0x61')));}if(!fs['existsSync'](_0x1aa580)){throw new db['Sequelize'][(_0xc9d8('0x64'))](_['upperFirst']('logo')+_0xc9d8('0x65'));}return _0x19ed34[_0xc9d8('0x66')](_0x1aa580);}})[_0xc9d8('0x4d')](handleError(_0x19ed34,null));};var utilLicense=require(_0xc9d8('0x67'));exports[_0xc9d8('0x68')]=function(_0x1a79db,_0x3209d8,_0x3e7616){var _0x359f45=_0xc9d8('0x59');var _0x23bef5={'custom':![]};return utilLicense['getLicense']()[_0xc9d8('0x1b')](function(_0x5c98c6){if(_0x5c98c6){_0x23bef5=_0x5c98c6;}return db[_0xc9d8('0x33')]['find']({'where':{'id':_0x1a79db[_0xc9d8('0x4f')]['id']},'attributes':['logo',_0xc9d8('0x57'),_0xc9d8('0x5a'),_0xc9d8('0x5b'),_0xc9d8('0x5c'),'defaultLoginLogo',_0xc9d8('0x69'),_0xc9d8('0x6a')],'raw':!![]});})[_0xc9d8('0x1b')](handleEntityNotFound(_0x3209d8,null))['then'](function(_0x55249a){if(_0x55249a){var _0x4f03b4=_0x55249a['loginLogo']&&fs['existsSync'](path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x359f45,_[_0xc9d8('0x60')](_0x55249a[_0xc9d8('0x57')])))?path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x359f45,_[_0xc9d8('0x60')](_0x55249a['loginLogo'])):path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x359f45,_[_0xc9d8('0x60')](_0xc9d8('0x6b')));var _0x26aaae=_0xc9d8('0x62')+_[_0xc9d8('0x63')](_0xc9d8('0x57'));if(_0x55249a[_0x26aaae]||!_0x23bef5['custom']){_0x4f03b4=path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x359f45,_['toLower'](_0xc9d8('0x6b')));}if(!fs[_0xc9d8('0x5d')](_0x4f03b4)){throw new db[(_0xc9d8('0x6c'))][(_0xc9d8('0x64'))](_[_0xc9d8('0x63')](_0xc9d8('0x57'))+_0xc9d8('0x65'));}return _0x3209d8[_0xc9d8('0x66')](_0x4f03b4);}})[_0xc9d8('0x4d')](handleError(_0x3209d8,null));};exports[_0xc9d8('0x6d')]=function(_0x286c32,_0x16f468){return db['Setting']['find']({'where':{'id':_0x286c32['params']['id']},'attributes':['securePassword']})[_0xc9d8('0x1b')](respondWithResult(_0x16f468,null))['catch'](handleError(_0x16f468,null));};exports['addPreferred']=function(_0x56ae74,_0x5c1cf1,_0x1c3529){if(_0x56ae74[_0xc9d8('0x53')]&&_0x56ae74['file']['filename']){_0x56ae74[_0xc9d8('0x50')][_0xc9d8('0x5a')]=_0x56ae74[_0xc9d8('0x53')][_0xc9d8('0x55')];}return db['Setting']['find']({'where':{'id':_0x56ae74[_0xc9d8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c1cf1,null))[_0xc9d8('0x1b')](saveUpdates(_0x56ae74[_0xc9d8('0x50')],null))[_0xc9d8('0x1b')](respondWithResult(_0x5c1cf1,null))['catch'](handleError(_0x5c1cf1,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x5b003d,_0x591dc1,_0x52d78f){var _0x1be18f=_0xc9d8('0x59');var _0x43319a={'custom':![]};return utilLicense[_0xc9d8('0x6e')]()[_0xc9d8('0x1b')](function(_0x979008){if(_0x979008){_0x43319a=_0x979008;}return db[_0xc9d8('0x33')][_0xc9d8('0x51')]({'where':{'id':_0x5b003d[_0xc9d8('0x4f')]['id']},'attributes':['logo',_0xc9d8('0x57'),_0xc9d8('0x5a'),_0xc9d8('0x5b'),_0xc9d8('0x5c'),_0xc9d8('0x6f'),_0xc9d8('0x69'),'defaultFavicon'],'raw':!![]});})[_0xc9d8('0x1b')](handleEntityNotFound(_0x591dc1,null))['then'](function(_0x5f1e11){if(_0x5f1e11){var _0xac9802=_0x5f1e11[_0xc9d8('0x5a')]&&fs[_0xc9d8('0x5d')](path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x1be18f,_[_0xc9d8('0x60')](_0x5f1e11['preferred'])))?path[_0xc9d8('0x5e')](config['root'],_0x1be18f,_['toLower'](_0x5f1e11[_0xc9d8('0x5a')])):path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x1be18f,_[_0xc9d8('0x60')](_0xc9d8('0x70')));var _0x1bfdb3=_0xc9d8('0x62')+_[_0xc9d8('0x63')](_0xc9d8('0x5a'));if(_0x5f1e11[_0x1bfdb3]||!_0x43319a['custom']||!_0x43319a[_0xc9d8('0x5a')]){_0xac9802=path['join'](config['root'],_0x1be18f,_['toLower'](_0xc9d8('0x70')));}if(!fs['existsSync'](_0xac9802)){throw new db['Sequelize'][(_0xc9d8('0x64'))](_[_0xc9d8('0x63')]('preferred')+'\x20not\x20found');}return _0x591dc1[_0xc9d8('0x66')](_0xac9802);}})[_0xc9d8('0x4d')](handleError(_0x591dc1,null));};exports['addFavicon']=function(_0x483149,_0x45e4a0,_0x4fa6ff){if(_0x483149[_0xc9d8('0x53')]&&_0x483149[_0xc9d8('0x53')]['filename']){_0x483149[_0xc9d8('0x50')][_0xc9d8('0x5b')]=_0x483149[_0xc9d8('0x53')][_0xc9d8('0x55')];}return db[_0xc9d8('0x33')][_0xc9d8('0x51')]({'where':{'id':_0x483149[_0xc9d8('0x4f')]['id']}})[_0xc9d8('0x1b')](handleEntityNotFound(_0x45e4a0,null))[_0xc9d8('0x1b')](saveUpdates(_0x483149[_0xc9d8('0x50')],null))[_0xc9d8('0x1b')](respondWithResult(_0x45e4a0,null))['catch'](handleError(_0x45e4a0,null));};var utilLicense=require('../../config/license/util');exports[_0xc9d8('0x71')]=function(_0x2bb238,_0x58989e,_0x8a0e83){var _0x1aaa93=_0xc9d8('0x59');var _0x2a0a8b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2de2a4){if(_0x2de2a4){_0x2a0a8b=_0x2de2a4;}return db[_0xc9d8('0x33')][_0xc9d8('0x51')]({'where':{'id':_0x2bb238['params']['id']},'attributes':[_0xc9d8('0x54'),'loginLogo',_0xc9d8('0x5a'),_0xc9d8('0x5b'),_0xc9d8('0x5c'),'defaultLoginLogo',_0xc9d8('0x69'),_0xc9d8('0x6a')],'raw':!![]});})[_0xc9d8('0x1b')](handleEntityNotFound(_0x58989e,null))[_0xc9d8('0x1b')](function(_0x1a1a88){if(_0x1a1a88){var _0x5ef4f2=_0x1a1a88[_0xc9d8('0x5b')]&&fs[_0xc9d8('0x5d')](path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x1aaa93,_[_0xc9d8('0x60')](_0x1a1a88[_0xc9d8('0x5b')])))?path['join'](config[_0xc9d8('0x5f')],_0x1aaa93,_[_0xc9d8('0x60')](_0x1a1a88[_0xc9d8('0x5b')])):path[_0xc9d8('0x5e')](config[_0xc9d8('0x5f')],_0x1aaa93,_[_0xc9d8('0x60')](_0xc9d8('0x72')));var _0x296cdf=_0xc9d8('0x62')+_[_0xc9d8('0x63')](_0xc9d8('0x5b'));if(_0x1a1a88[_0x296cdf]||!_0x2a0a8b['custom']){_0x5ef4f2=path['join'](config['root'],_0x1aaa93,_[_0xc9d8('0x60')](_0xc9d8('0x72')));}if(!fs[_0xc9d8('0x5d')](_0x5ef4f2)){throw new db[(_0xc9d8('0x6c'))][(_0xc9d8('0x64'))](_['upperFirst']('favicon')+_0xc9d8('0x65'));}return _0x58989e[_0xc9d8('0x66')](_0x5ef4f2);}})['catch'](handleError(_0x58989e,null));};exports['getDate']=function(_0x5171c9,_0x581c31){var _0x1c205c={'offset':moment()['utcOffset']()};_0x1c205c[_0xc9d8('0x73')]=moment()[_0xc9d8('0x74')](_0x1c205c[_0xc9d8('0x26')])[_0xc9d8('0x75')](_0xc9d8('0x76'));return _0x581c31[_0xc9d8('0x25')](0xc8)[_0xc9d8('0x32')](_0x1c205c);}; \ No newline at end of file +var _0x2a5e=['upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultFavicon','custom','default_loginLogo.svg','Sequelize','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','name','send','index','map','Setting','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','show','intersection','includeAll','body','find','params','addLogo','file','filename','logo','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','toLower','root','default'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2a5e,0xf6));var _0xe2a5=function(_0x2eac20,_0x4af6c5){_0x2eac20=_0x2eac20-0x0;var _0x14f35a=_0x2a5e[_0x2eac20];return _0x14f35a;};'use strict';var emlformat=require(_0xe2a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe2a5('0x1'));var rp=require(_0xe2a5('0x2'));var moment=require(_0xe2a5('0x3'));var BPromise=require(_0xe2a5('0x4'));var Mustache=require(_0xe2a5('0x5'));var util=require(_0xe2a5('0x6'));var path=require(_0xe2a5('0x7'));var sox=require(_0xe2a5('0x8'));var csv=require('to-csv');var ejs=require(_0xe2a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2a5('0xa'));var squel=require('squel');var crypto=require(_0xe2a5('0xb'));var jsforce=require(_0xe2a5('0xc'));var deskjs=require(_0xe2a5('0xd'));var toCsv=require(_0xe2a5('0xe'));var querystring=require('querystring');var Papa=require(_0xe2a5('0xf'));var Redis=require(_0xe2a5('0x10'));var authService=require(_0xe2a5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2a5('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe2a5('0x13'));var licenseUtil=require(_0xe2a5('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe2a5('0x15'));var client=jayson[_0xe2a5('0x16')][_0xe2a5('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5aea07,_0x167ccc,_0x1df15d,_0x4c6349){return new BPromise(function(_0x4fa29e,_0x3d9201){var _0x1b0065=_0x4c6349||client;return _0x1b0065['request'](_0x5aea07,_0x1df15d)[_0xe2a5('0x18')](function(_0x448a57){logger[_0xe2a5('0x19')](_0xe2a5('0x1a'),_0x167ccc,_0xe2a5('0x1b'));logger['debug'](_0xe2a5('0x1c'),_0x167ccc,_0xe2a5('0x1b'),JSON[_0xe2a5('0x1d')](_0x448a57));if(_0x448a57['error']){if(_0x448a57[_0xe2a5('0x1e')][_0xe2a5('0x1f')]===0x1f4){logger[_0xe2a5('0x1e')](_0xe2a5('0x1a'),_0x167ccc,_0x448a57[_0xe2a5('0x1e')]['message']);return _0x3d9201(_0x448a57['error']['message']);}logger[_0xe2a5('0x1e')](_0xe2a5('0x1a'),_0x167ccc,_0x448a57[_0xe2a5('0x1e')][_0xe2a5('0x20')]);return _0x4fa29e(_0x448a57[_0xe2a5('0x1e')][_0xe2a5('0x20')]);}else{logger[_0xe2a5('0x19')]('Setting,\x20%s,\x20%s',_0x167ccc,'request\x20sent');_0x4fa29e(_0x448a57[_0xe2a5('0x21')][_0xe2a5('0x20')]);}})[_0xe2a5('0x22')](function(_0x419152){logger[_0xe2a5('0x1e')](_0xe2a5('0x1a'),_0x167ccc,_0x419152);_0x3d9201(_0x419152);});});}function respondWithStatusCode(_0x4ef4b8,_0x5c7ea1){_0x5c7ea1=_0x5c7ea1||0xcc;return function(_0x4023c8){if(_0x4023c8){return _0x4ef4b8[_0xe2a5('0x23')](_0x5c7ea1);}return _0x4ef4b8[_0xe2a5('0x24')](_0x5c7ea1)[_0xe2a5('0x25')]();};}function respondWithResult(_0x407d06,_0x301dee){_0x301dee=_0x301dee||0xc8;return function(_0x4e24a5){if(_0x4e24a5){return _0x407d06[_0xe2a5('0x24')](_0x301dee)[_0xe2a5('0x26')](_0x4e24a5);}};}function respondWithFilteredResult(_0x38d11f,_0x815ace){return function(_0x1616a6){if(_0x1616a6){var _0x5cc160=typeof _0x815ace[_0xe2a5('0x27')]===_0xe2a5('0x28')&&typeof _0x815ace[_0xe2a5('0x29')]===_0xe2a5('0x28');var _0x3bcc15=_0x1616a6[_0xe2a5('0x2a')];var _0xe94c33=_0x5cc160?0x0:_0x815ace[_0xe2a5('0x27')];var _0xec31e0=_0x5cc160?_0x1616a6[_0xe2a5('0x2a')]:_0x815ace['offset']+_0x815ace[_0xe2a5('0x29')];var _0x4714ce;if(_0xec31e0>=_0x3bcc15){_0xec31e0=_0x3bcc15;_0x4714ce=0xc8;}else{_0x4714ce=0xce;}_0x38d11f['status'](_0x4714ce);return _0x38d11f['set'](_0xe2a5('0x2b'),_0xe94c33+'-'+_0xec31e0+'/'+_0x3bcc15)[_0xe2a5('0x26')](_0x1616a6);}return null;};}function patchUpdates(_0x344498){return function(_0x45c40f){try{jsonpatch['apply'](_0x45c40f,_0x344498,!![]);}catch(_0x721dec){return BPromise[_0xe2a5('0x2c')](_0x721dec);}return _0x45c40f[_0xe2a5('0x2d')]();};}function saveUpdates(_0x5c99c9,_0x3a9f70){return function(_0x271e3e){if(_0x271e3e){return _0x271e3e[_0xe2a5('0x2e')](_0x5c99c9)[_0xe2a5('0x18')](function(_0x3cf289){return _0x3cf289;});}return null;};}function removeEntity(_0x49a163,_0x51259a){return function(_0x2f21a2){if(_0x2f21a2){return _0x2f21a2[_0xe2a5('0x2f')]()['then'](function(){_0x49a163[_0xe2a5('0x24')](0xcc)[_0xe2a5('0x25')]();});}};}function handleEntityNotFound(_0x384ec1,_0x46b188){return function(_0x36ba85){if(!_0x36ba85){_0x384ec1[_0xe2a5('0x23')](0x194);}return _0x36ba85;};}function handleError(_0x43db9d,_0x3329ab){_0x3329ab=_0x3329ab||0x1f4;return function(_0x3f79a0){logger[_0xe2a5('0x1e')](_0x3f79a0['stack']);if(_0x3f79a0['name']){delete _0x3f79a0[_0xe2a5('0x30')];}_0x43db9d[_0xe2a5('0x24')](_0x3329ab)[_0xe2a5('0x31')](_0x3f79a0);};}exports[_0xe2a5('0x32')]=function(_0x3befde,_0x49a324){var _0x41da4e={},_0x268351={},_0x22cb29={'count':0x0,'rows':[]};var _0x2237a6=_[_0xe2a5('0x33')](db[_0xe2a5('0x34')][_0xe2a5('0x35')],function(_0x5be4c8){return{'name':_0x5be4c8['fieldName'],'type':_0x5be4c8[_0xe2a5('0x36')][_0xe2a5('0x37')]};});_0x268351[_0xe2a5('0x38')]=_['map'](_0x2237a6,_0xe2a5('0x30'));_0x268351[_0xe2a5('0x39')]=_[_0xe2a5('0x3a')](_0x3befde[_0xe2a5('0x39')]);_0x268351[_0xe2a5('0x3b')]=_['intersection'](_0x268351[_0xe2a5('0x38')],_0x268351[_0xe2a5('0x39')]);_0x41da4e[_0xe2a5('0x3c')]=_['intersection'](_0x268351[_0xe2a5('0x38')],qs[_0xe2a5('0x3d')](_0x3befde[_0xe2a5('0x39')][_0xe2a5('0x3d')]));_0x41da4e[_0xe2a5('0x3c')]=_0x41da4e['attributes'][_0xe2a5('0x3e')]?_0x41da4e[_0xe2a5('0x3c')]:_0x268351['model'];if(!_0x3befde[_0xe2a5('0x39')][_0xe2a5('0x3f')]('nolimit')){_0x41da4e[_0xe2a5('0x29')]=qs['limit'](_0x3befde[_0xe2a5('0x39')][_0xe2a5('0x29')]);_0x41da4e[_0xe2a5('0x27')]=qs['offset'](_0x3befde[_0xe2a5('0x39')][_0xe2a5('0x27')]);}_0x41da4e[_0xe2a5('0x40')]=qs[_0xe2a5('0x41')](_0x3befde['query'][_0xe2a5('0x41')]);_0x41da4e[_0xe2a5('0x42')]=qs['filters'](_['pick'](_0x3befde['query'],_0x268351[_0xe2a5('0x3b')]),_0x2237a6);if(_0x3befde[_0xe2a5('0x39')]['filter']){_0x41da4e['where']=_['merge'](_0x41da4e[_0xe2a5('0x42')],{'$or':_[_0xe2a5('0x33')](_0x2237a6,function(_0x23e60e){if(_0x23e60e[_0xe2a5('0x36')]!==_0xe2a5('0x43')){var _0x2cca53={};_0x2cca53[_0x23e60e['name']]={'$like':'%'+_0x3befde[_0xe2a5('0x39')][_0xe2a5('0x44')]+'%'};return _0x2cca53;}})});}_0x41da4e=_[_0xe2a5('0x45')]({},_0x41da4e,_0x3befde[_0xe2a5('0x46')]);var _0x4f2e3d={'where':_0x41da4e[_0xe2a5('0x42')]};return db[_0xe2a5('0x34')][_0xe2a5('0x2a')](_0x4f2e3d)[_0xe2a5('0x18')](function(_0x403e08){_0x22cb29[_0xe2a5('0x2a')]=_0x403e08;if(_0x3befde[_0xe2a5('0x39')]['includeAll']){_0x41da4e[_0xe2a5('0x47')]=[{'all':!![]}];}return db[_0xe2a5('0x34')][_0xe2a5('0x48')](_0x41da4e);})[_0xe2a5('0x18')](function(_0x44d0a8){_0x22cb29['rows']=_0x44d0a8;return _0x22cb29;})['then'](respondWithFilteredResult(_0x49a324,_0x41da4e))[_0xe2a5('0x22')](handleError(_0x49a324,null));};exports[_0xe2a5('0x49')]=function(_0x3b63cf,_0x55db3a){var _0x40273a={'raw':![],'where':{'id':_0x3b63cf['params']['id']}},_0x1f4584={};_0x1f4584[_0xe2a5('0x38')]=_['keys'](db[_0xe2a5('0x34')][_0xe2a5('0x35')]);_0x1f4584['query']=_[_0xe2a5('0x3a')](_0x3b63cf[_0xe2a5('0x39')]);_0x1f4584[_0xe2a5('0x3b')]=_['intersection'](_0x1f4584[_0xe2a5('0x38')],_0x1f4584[_0xe2a5('0x39')]);_0x40273a[_0xe2a5('0x3c')]=_[_0xe2a5('0x4a')](_0x1f4584[_0xe2a5('0x38')],qs['fields'](_0x3b63cf[_0xe2a5('0x39')][_0xe2a5('0x3d')]));_0x40273a[_0xe2a5('0x3c')]=_0x40273a[_0xe2a5('0x3c')]['length']?_0x40273a[_0xe2a5('0x3c')]:_0x1f4584[_0xe2a5('0x38')];if(_0x3b63cf[_0xe2a5('0x39')][_0xe2a5('0x4b')]){_0x40273a['include']=[{'all':!![]}];}_0x40273a=_[_0xe2a5('0x45')]({},_0x40273a,_0x3b63cf[_0xe2a5('0x46')]);return db[_0xe2a5('0x34')]['find'](_0x40273a)[_0xe2a5('0x18')](handleEntityNotFound(_0x55db3a,null))['then'](respondWithResult(_0x55db3a,null))['catch'](handleError(_0x55db3a,null));};exports['update']=function(_0x2953dc,_0x2741d4){if(_0x2953dc[_0xe2a5('0x4c')]['id']){delete _0x2953dc['body']['id'];}return db['Setting'][_0xe2a5('0x4d')]({'where':{'id':_0x2953dc[_0xe2a5('0x4e')]['id']}})[_0xe2a5('0x18')](handleEntityNotFound(_0x2741d4,null))[_0xe2a5('0x18')](saveUpdates(_0x2953dc['body'],null))['then'](respondWithResult(_0x2741d4,null))[_0xe2a5('0x22')](handleError(_0x2741d4,null));};exports[_0xe2a5('0x4f')]=function(_0x5b243e,_0x5043b8,_0x5b42b2){if(_0x5b243e[_0xe2a5('0x50')]&&_0x5b243e[_0xe2a5('0x50')][_0xe2a5('0x51')]){_0x5b243e['body'][_0xe2a5('0x52')]=_0x5b243e[_0xe2a5('0x50')][_0xe2a5('0x51')];}return db[_0xe2a5('0x34')][_0xe2a5('0x4d')]({'where':{'id':_0x5b243e[_0xe2a5('0x4e')]['id']}})[_0xe2a5('0x18')](handleEntityNotFound(_0x5043b8,null))['then'](saveUpdates(_0x5b243e['body'],null))[_0xe2a5('0x18')](respondWithResult(_0x5043b8,null))[_0xe2a5('0x22')](handleError(_0x5043b8,null));};exports['addLogoLogin']=function(_0x230d1a,_0xe82fc7,_0x362990){if(_0x230d1a[_0xe2a5('0x50')]&&_0x230d1a[_0xe2a5('0x50')][_0xe2a5('0x51')]){_0x230d1a[_0xe2a5('0x4c')][_0xe2a5('0x53')]=_0x230d1a['file'][_0xe2a5('0x51')];}return db[_0xe2a5('0x34')][_0xe2a5('0x4d')]({'where':{'id':_0x230d1a[_0xe2a5('0x4e')]['id']}})[_0xe2a5('0x18')](handleEntityNotFound(_0xe82fc7,null))[_0xe2a5('0x18')](saveUpdates(_0x230d1a[_0xe2a5('0x4c')],null))[_0xe2a5('0x18')](respondWithResult(_0xe82fc7,null))[_0xe2a5('0x22')](handleError(_0xe82fc7,null));};var utilLicense=require(_0xe2a5('0x14'));exports[_0xe2a5('0x54')]=function(_0x4a5d05,_0x14c359,_0x164e62){var _0x462d21='server/files/images/logos';var _0x5bfa68={'custom':![]};return utilLicense[_0xe2a5('0x55')]()[_0xe2a5('0x18')](function(_0x2c87f0){if(_0x2c87f0){_0x5bfa68=_0x2c87f0;}return db[_0xe2a5('0x34')]['find']({'where':{'id':_0x4a5d05[_0xe2a5('0x4e')]['id']},'attributes':[_0xe2a5('0x52'),_0xe2a5('0x53'),_0xe2a5('0x56'),_0xe2a5('0x57'),_0xe2a5('0x58'),_0xe2a5('0x59'),_0xe2a5('0x5a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x14c359,null))[_0xe2a5('0x18')](function(_0x6d0ac6){if(_0x6d0ac6){var _0x410f81=_0x6d0ac6[_0xe2a5('0x52')]&&fs[_0xe2a5('0x5b')](path[_0xe2a5('0x5c')](config['root'],_0x462d21,_[_0xe2a5('0x5d')](_0x6d0ac6[_0xe2a5('0x52')])))?path['join'](config[_0xe2a5('0x5e')],_0x462d21,_[_0xe2a5('0x5d')](_0x6d0ac6[_0xe2a5('0x52')])):path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x462d21,_[_0xe2a5('0x5d')]('default_logo.svg'));var _0x471004=_0xe2a5('0x5f')+_[_0xe2a5('0x60')]('logo');if(_0x6d0ac6[_0x471004]||!_0x5bfa68['custom']){_0x410f81=path[_0xe2a5('0x5c')](config['root'],_0x462d21,_['toLower']('default_logo.svg'));}if(!fs[_0xe2a5('0x5b')](_0x410f81)){throw new db['Sequelize'][(_0xe2a5('0x61'))](_[_0xe2a5('0x60')](_0xe2a5('0x52'))+_0xe2a5('0x62'));}return _0x14c359[_0xe2a5('0x63')](_0x410f81);}})['catch'](handleError(_0x14c359,null));};var utilLicense=require(_0xe2a5('0x14'));exports[_0xe2a5('0x64')]=function(_0xa06c95,_0x88f03f,_0x456b41){var _0x30e320=_0xe2a5('0x65');var _0x288639={'custom':![]};return utilLicense[_0xe2a5('0x55')]()[_0xe2a5('0x18')](function(_0x45e9b8){if(_0x45e9b8){_0x288639=_0x45e9b8;}return db[_0xe2a5('0x34')]['find']({'where':{'id':_0xa06c95[_0xe2a5('0x4e')]['id']},'attributes':['logo',_0xe2a5('0x53'),_0xe2a5('0x56'),'favicon',_0xe2a5('0x58'),'defaultLoginLogo',_0xe2a5('0x5a'),_0xe2a5('0x66')],'raw':!![]});})[_0xe2a5('0x18')](handleEntityNotFound(_0x88f03f,null))[_0xe2a5('0x18')](function(_0x181e1a){if(_0x181e1a){var _0x1ad1a9=_0x181e1a[_0xe2a5('0x53')]&&fs[_0xe2a5('0x5b')](path[_0xe2a5('0x5c')](config['root'],_0x30e320,_['toLower'](_0x181e1a[_0xe2a5('0x53')])))?path['join'](config[_0xe2a5('0x5e')],_0x30e320,_[_0xe2a5('0x5d')](_0x181e1a[_0xe2a5('0x53')])):path['join'](config[_0xe2a5('0x5e')],_0x30e320,_[_0xe2a5('0x5d')]('default_loginLogo.svg'));var _0x3ff427=_0xe2a5('0x5f')+_[_0xe2a5('0x60')](_0xe2a5('0x53'));if(_0x181e1a[_0x3ff427]||!_0x288639[_0xe2a5('0x67')]){_0x1ad1a9=path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x30e320,_['toLower'](_0xe2a5('0x68')));}if(!fs[_0xe2a5('0x5b')](_0x1ad1a9)){throw new db[(_0xe2a5('0x69'))][(_0xe2a5('0x61'))](_[_0xe2a5('0x60')]('loginLogo')+_0xe2a5('0x62'));}return _0x88f03f[_0xe2a5('0x63')](_0x1ad1a9);}})[_0xe2a5('0x22')](handleError(_0x88f03f,null));};exports[_0xe2a5('0x6a')]=function(_0x3478b4,_0x4dba03){return db['Setting'][_0xe2a5('0x4d')]({'where':{'id':_0x3478b4[_0xe2a5('0x4e')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4dba03,null))[_0xe2a5('0x22')](handleError(_0x4dba03,null));};exports[_0xe2a5('0x6b')]=function(_0x5d938e,_0x2e42ab,_0xa1a0fd){if(_0x5d938e[_0xe2a5('0x50')]&&_0x5d938e[_0xe2a5('0x50')][_0xe2a5('0x51')]){_0x5d938e['body'][_0xe2a5('0x56')]=_0x5d938e[_0xe2a5('0x50')]['filename'];}return db[_0xe2a5('0x34')]['find']({'where':{'id':_0x5d938e[_0xe2a5('0x4e')]['id']}})[_0xe2a5('0x18')](handleEntityNotFound(_0x2e42ab,null))[_0xe2a5('0x18')](saveUpdates(_0x5d938e['body'],null))[_0xe2a5('0x18')](respondWithResult(_0x2e42ab,null))[_0xe2a5('0x22')](handleError(_0x2e42ab,null));};var utilLicense=require('../../config/license/util');exports[_0xe2a5('0x6c')]=function(_0x380c8e,_0x5037da,_0x2209a8){var _0x1c79fd='server/files/images/logos';var _0x34d528={'custom':![]};return utilLicense[_0xe2a5('0x55')]()['then'](function(_0x1b205b){if(_0x1b205b){_0x34d528=_0x1b205b;}return db[_0xe2a5('0x34')]['find']({'where':{'id':_0x380c8e[_0xe2a5('0x4e')]['id']},'attributes':['logo','loginLogo','preferred',_0xe2a5('0x57'),_0xe2a5('0x58'),_0xe2a5('0x59'),_0xe2a5('0x5a'),_0xe2a5('0x66')],'raw':!![]});})['then'](handleEntityNotFound(_0x5037da,null))[_0xe2a5('0x18')](function(_0xc39a75){if(_0xc39a75){var _0x14dcbd=_0xc39a75[_0xe2a5('0x56')]&&fs[_0xe2a5('0x5b')](path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x1c79fd,_[_0xe2a5('0x5d')](_0xc39a75[_0xe2a5('0x56')])))?path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x1c79fd,_[_0xe2a5('0x5d')](_0xc39a75[_0xe2a5('0x56')])):path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x1c79fd,_['toLower'](_0xe2a5('0x6d')));var _0xcc77a9='default'+_['upperFirst'](_0xe2a5('0x56'));if(_0xc39a75[_0xcc77a9]||!_0x34d528[_0xe2a5('0x67')]||!_0x34d528[_0xe2a5('0x56')]){_0x14dcbd=path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x1c79fd,_['toLower']('default_preferred.png'));}if(!fs[_0xe2a5('0x5b')](_0x14dcbd)){throw new db['Sequelize'][(_0xe2a5('0x61'))](_['upperFirst'](_0xe2a5('0x56'))+_0xe2a5('0x62'));}return _0x5037da['download'](_0x14dcbd);}})['catch'](handleError(_0x5037da,null));};exports[_0xe2a5('0x6e')]=function(_0x25a818,_0x2cb4c4,_0x38beea){if(_0x25a818[_0xe2a5('0x50')]&&_0x25a818[_0xe2a5('0x50')][_0xe2a5('0x51')]){_0x25a818['body'][_0xe2a5('0x57')]=_0x25a818['file'][_0xe2a5('0x51')];}return db[_0xe2a5('0x34')][_0xe2a5('0x4d')]({'where':{'id':_0x25a818[_0xe2a5('0x4e')]['id']}})[_0xe2a5('0x18')](handleEntityNotFound(_0x2cb4c4,null))[_0xe2a5('0x18')](saveUpdates(_0x25a818[_0xe2a5('0x4c')],null))[_0xe2a5('0x18')](respondWithResult(_0x2cb4c4,null))[_0xe2a5('0x22')](handleError(_0x2cb4c4,null));};var utilLicense=require(_0xe2a5('0x14'));exports[_0xe2a5('0x6f')]=function(_0x437bb0,_0x405a00,_0x396e4e){var _0x23c586=_0xe2a5('0x65');var _0x5c361={'custom':![]};return utilLicense[_0xe2a5('0x55')]()['then'](function(_0x2501b0){if(_0x2501b0){_0x5c361=_0x2501b0;}return db[_0xe2a5('0x34')][_0xe2a5('0x4d')]({'where':{'id':_0x437bb0[_0xe2a5('0x4e')]['id']},'attributes':[_0xe2a5('0x52'),_0xe2a5('0x53'),_0xe2a5('0x56'),'favicon',_0xe2a5('0x58'),_0xe2a5('0x59'),_0xe2a5('0x5a'),_0xe2a5('0x66')],'raw':!![]});})[_0xe2a5('0x18')](handleEntityNotFound(_0x405a00,null))[_0xe2a5('0x18')](function(_0x3bd1b4){if(_0x3bd1b4){var _0x5e0ac7=_0x3bd1b4[_0xe2a5('0x57')]&&fs[_0xe2a5('0x5b')](path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x23c586,_[_0xe2a5('0x5d')](_0x3bd1b4[_0xe2a5('0x57')])))?path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x23c586,_[_0xe2a5('0x5d')](_0x3bd1b4[_0xe2a5('0x57')])):path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x23c586,_[_0xe2a5('0x5d')]('default_favicon.ico'));var _0x8c7bb5=_0xe2a5('0x5f')+_['upperFirst'](_0xe2a5('0x57'));if(_0x3bd1b4[_0x8c7bb5]||!_0x5c361[_0xe2a5('0x67')]){_0x5e0ac7=path[_0xe2a5('0x5c')](config[_0xe2a5('0x5e')],_0x23c586,_[_0xe2a5('0x5d')](_0xe2a5('0x70')));}if(!fs['existsSync'](_0x5e0ac7)){throw new db[(_0xe2a5('0x69'))][(_0xe2a5('0x61'))](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x405a00[_0xe2a5('0x63')](_0x5e0ac7);}})[_0xe2a5('0x22')](handleError(_0x405a00,null));};exports['getDate']=function(_0x3e2203,_0x22a6e1){var _0xa21b3d={'offset':moment()[_0xe2a5('0x71')]()};_0xa21b3d['now']=moment()[_0xe2a5('0x71')](_0xa21b3d[_0xe2a5('0x27')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x22a6e1[_0xe2a5('0x24')](0xc8)[_0xe2a5('0x31')](_0xa21b3d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ea9de49..fa67f97 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0x55ca,0x126));var _0xa55c=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0x55ca[_0x4b2b03];return _0x1bf0ed;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0xcc9c90,_0x15ff97){var _0x22f10c=function(_0xe05a83){while(--_0xe05a83){_0xcc9c90['push'](_0xcc9c90['shift']());}};_0x22f10c(++_0x15ff97);}(_0xedd9,0xfc));var _0x9edd=function(_0x28e6c4,_0x327488){_0x28e6c4=_0x28e6c4-0x0;var _0x4aa527=_0xedd9[_0x28e6c4];return _0x4aa527;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 32c1688..09aeca0 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 _0xab2f=['Setting','find','options','attributes','include','model','map','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting'];(function(_0x4d8570,_0x4424b0){var _0x3a644b=function(_0x38d616){while(--_0x38d616){_0x4d8570['push'](_0x4d8570['shift']());}};_0x3a644b(++_0x4424b0);}(_0xab2f,0xff));var _0xfab2=function(_0x4c7d82,_0x4a0fcf){_0x4c7d82=_0x4c7d82-0x0;var _0x3913c=_0xab2f[_0x4c7d82];return _0x3913c;};'use strict';var _=require(_0xfab2('0x0'));var util=require(_0xfab2('0x1'));var moment=require('moment');var BPromise=require(_0xfab2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfab2('0x3'));var db=require(_0xfab2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfab2('0x5'))(_0xfab2('0x6'));var config=require(_0xfab2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfab2('0x8')][_0xfab2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x163127,_0x2536f7,_0x2e03ce){return new BPromise(function(_0x8fe82a,_0x53cc82){return client[_0xfab2('0xa')](_0x163127,_0x2e03ce)[_0xfab2('0xb')](function(_0x24e665){logger[_0xfab2('0xc')](_0xfab2('0xd'),_0x2536f7,_0xfab2('0xe'));logger[_0xfab2('0xf')](_0xfab2('0x10'),_0x2536f7,_0xfab2('0xe'),JSON[_0xfab2('0x11')](_0x24e665));if(_0x24e665[_0xfab2('0x12')]){if(_0x24e665[_0xfab2('0x12')][_0xfab2('0x13')]===0x1f4){logger[_0xfab2('0x12')](_0xfab2('0xd'),_0x2536f7,_0x24e665['error'][_0xfab2('0x14')]);return _0x53cc82(_0x24e665[_0xfab2('0x12')][_0xfab2('0x14')]);}logger[_0xfab2('0x12')](_0xfab2('0xd'),_0x2536f7,_0x24e665[_0xfab2('0x12')][_0xfab2('0x14')]);return _0x8fe82a(_0x24e665['error'][_0xfab2('0x14')]);}else{logger[_0xfab2('0xc')](_0xfab2('0xd'),_0x2536f7,_0xfab2('0xe'));_0x8fe82a(_0x24e665[_0xfab2('0x15')][_0xfab2('0x14')]);}})[_0xfab2('0x16')](function(_0x5a0463){logger[_0xfab2('0x12')](_0xfab2('0xd'),_0x2536f7,_0x5a0463);_0x53cc82(_0x5a0463);});});}exports[_0xfab2('0x17')]=function(_0x696ac2){var _0x57e3d6=this;return new Promise(function(_0x549851,_0x5afbd7){return db[_0xfab2('0x18')][_0xfab2('0x19')]({'raw':_0x696ac2[_0xfab2('0x1a')]?_0x696ac2[_0xfab2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x696ac2[_0xfab2('0x1a')]?_0x696ac2['options']['where']||null:null,'attributes':_0x696ac2[_0xfab2('0x1a')]?_0x696ac2['options'][_0xfab2('0x1b')]||null:null,'include':_0x696ac2['options']?_0x696ac2[_0xfab2('0x1a')]['include']?_['map'](_0x696ac2[_0xfab2('0x1a')][_0xfab2('0x1c')],function(_0x3888d2){return{'model':db[_0x3888d2[_0xfab2('0x1d')]],'as':_0x3888d2['as'],'attributes':_0x3888d2['attributes'],'include':_0x3888d2[_0xfab2('0x1c')]?_[_0xfab2('0x1e')](_0x3888d2[_0xfab2('0x1c')],function(_0x4e4b91){return{'model':db[_0x4e4b91[_0xfab2('0x1d')]],'as':_0x4e4b91['as'],'attributes':_0x4e4b91['attributes'],'include':_0x4e4b91[_0xfab2('0x1c')]?_[_0xfab2('0x1e')](_0x4e4b91[_0xfab2('0x1c')],function(_0x519c84){return{'model':db[_0x519c84[_0xfab2('0x1d')]],'as':_0x519c84['as'],'attributes':_0x519c84['attributes']};}):[]};}):[]};}):[]:[]})[_0xfab2('0xb')](function(_0x4a55f5){logger[_0xfab2('0xc')](_0xfab2('0x17'),_0x696ac2);logger[_0xfab2('0xf')](_0xfab2('0x17'),_0x696ac2,JSON[_0xfab2('0x11')](_0x4a55f5));_0x549851(_0x4a55f5);})[_0xfab2('0x16')](function(_0x4f3677){logger[_0xfab2('0x12')](_0xfab2('0x17'),_0x4f3677[_0xfab2('0x14')],_0x696ac2);_0x5afbd7(_0x57e3d6[_0xfab2('0x12')](0x1f4,_0x4f3677[_0xfab2('0x14')]));});});}; \ No newline at end of file +var _0x0742=['Setting','find','options','raw','where','attributes','include','map','model','ShowSetting','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4c268b,_0x2237b5){var _0x3ed818=function(_0x38eaaa){while(--_0x38eaaa){_0x4c268b['push'](_0x4c268b['shift']());}};_0x3ed818(++_0x2237b5);}(_0x0742,0x6b));var _0x2074=function(_0x3a05a6,_0x5a2916){_0x3a05a6=_0x3a05a6-0x0;var _0x55a922=_0x0742[_0x3a05a6];return _0x55a922;};'use strict';var _=require(_0x2074('0x0'));var util=require('util');var moment=require(_0x2074('0x1'));var BPromise=require(_0x2074('0x2'));var rs=require(_0x2074('0x3'));var fs=require('fs');var Redis=require(_0x2074('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2074('0x5'));var logger=require(_0x2074('0x6'))(_0x2074('0x7'));var config=require('../../config/environment');var jayson=require(_0x2074('0x8'));var client=jayson[_0x2074('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x473699,_0x21e6d4,_0x1eeceb){return new BPromise(function(_0x29f672,_0x1808fe){return client[_0x2074('0xa')](_0x473699,_0x1eeceb)[_0x2074('0xb')](function(_0x1b2147){logger[_0x2074('0xc')](_0x2074('0xd'),_0x21e6d4,_0x2074('0xe'));logger[_0x2074('0xf')](_0x2074('0x10'),_0x21e6d4,_0x2074('0xe'),JSON['stringify'](_0x1b2147));if(_0x1b2147[_0x2074('0x11')]){if(_0x1b2147[_0x2074('0x11')][_0x2074('0x12')]===0x1f4){logger[_0x2074('0x11')](_0x2074('0xd'),_0x21e6d4,_0x1b2147[_0x2074('0x11')][_0x2074('0x13')]);return _0x1808fe(_0x1b2147[_0x2074('0x11')][_0x2074('0x13')]);}logger[_0x2074('0x11')](_0x2074('0xd'),_0x21e6d4,_0x1b2147[_0x2074('0x11')][_0x2074('0x13')]);return _0x29f672(_0x1b2147['error'][_0x2074('0x13')]);}else{logger[_0x2074('0xc')](_0x2074('0xd'),_0x21e6d4,_0x2074('0xe'));_0x29f672(_0x1b2147[_0x2074('0x14')][_0x2074('0x13')]);}})['catch'](function(_0x5c5ff2){logger[_0x2074('0x11')](_0x2074('0xd'),_0x21e6d4,_0x5c5ff2);_0x1808fe(_0x5c5ff2);});});}exports['ShowSetting']=function(_0x7ad651){var _0x26c4d2=this;return new Promise(function(_0x16a9f3,_0xd6a06f){return db[_0x2074('0x15')][_0x2074('0x16')]({'raw':_0x7ad651[_0x2074('0x17')]?_0x7ad651[_0x2074('0x17')][_0x2074('0x18')]===undefined?!![]:![]:!![],'where':_0x7ad651[_0x2074('0x17')]?_0x7ad651[_0x2074('0x17')][_0x2074('0x19')]||null:null,'attributes':_0x7ad651[_0x2074('0x17')]?_0x7ad651['options'][_0x2074('0x1a')]||null:null,'include':_0x7ad651['options']?_0x7ad651[_0x2074('0x17')][_0x2074('0x1b')]?_[_0x2074('0x1c')](_0x7ad651[_0x2074('0x17')][_0x2074('0x1b')],function(_0x54497f){return{'model':db[_0x54497f[_0x2074('0x1d')]],'as':_0x54497f['as'],'attributes':_0x54497f['attributes'],'include':_0x54497f[_0x2074('0x1b')]?_[_0x2074('0x1c')](_0x54497f[_0x2074('0x1b')],function(_0x487c60){return{'model':db[_0x487c60[_0x2074('0x1d')]],'as':_0x487c60['as'],'attributes':_0x487c60[_0x2074('0x1a')],'include':_0x487c60[_0x2074('0x1b')]?_[_0x2074('0x1c')](_0x487c60[_0x2074('0x1b')],function(_0x43929b){return{'model':db[_0x43929b[_0x2074('0x1d')]],'as':_0x43929b['as'],'attributes':_0x43929b[_0x2074('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2074('0xb')](function(_0x18d148){logger['info'](_0x2074('0x1e'),_0x7ad651);logger[_0x2074('0xf')]('ShowSetting',_0x7ad651,JSON[_0x2074('0x1f')](_0x18d148));_0x16a9f3(_0x18d148);})['catch'](function(_0x465d83){logger['error']('ShowSetting',_0x465d83[_0x2074('0x13')],_0x7ad651);_0xd6a06f(_0x26c4d2[_0x2074('0x11')](0x1f4,_0x465d83['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 58fdf50..89c2544 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(_0x3b86f5,_0x37aee3){var _0x21aaff=function(_0x41b79f){while(--_0x41b79f){_0x3b86f5['push'](_0x3b86f5['shift']());}};_0x21aaff(++_0x37aee3);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x58a25e,_0x4ac2de){var _0x46dbd9=function(_0x374dbb){while(--_0x374dbb){_0x58a25e['push'](_0x58a25e['shift']());}};_0x46dbd9(++_0x4ac2de);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7fbe[_0xbb091];return _0x467a04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 88791d4..881570b 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 _0x1865=['ENUM','twilio','skebby','connectel','clicksend','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','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name'];(function(_0x183ac4,_0x55a5df){var _0x3cf15a=function(_0x3f4cfc){while(--_0x3f4cfc){_0x183ac4['push'](_0x183ac4['shift']());}};_0x3cf15a(++_0x55a5df);}(_0x1865,0x1b1));var _0x5186=function(_0x3cb7dd,_0x5ccadb){_0x3cb7dd=_0x3cb7dd-0x0;var _0x481e7f=_0x1865[_0x3cb7dd];return _0x481e7f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5186('0x0'));module[_0x5186('0x1')]={'name':{'type':Sequelize[_0x5186('0x2')],'unique':_0x5186('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x5186('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5186('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5186('0x2')]},'type':{'type':Sequelize[_0x5186('0x4')](_0x5186('0x5'),_0x5186('0x6'),_0x5186('0x7'),_0x5186('0x8'),_0x5186('0x9'),_0x5186('0xa'),'bandwidth',_0x5186('0xb'),_0x5186('0xc'),_0x5186('0xd'))},'accountSid':{'type':Sequelize[_0x5186('0x2')]},'authId':{'type':Sequelize[_0x5186('0x2')]},'authToken':{'type':Sequelize[_0x5186('0x2')]},'smsMethod':{'type':Sequelize[_0x5186('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5186('0x2')]},'apiKey':{'type':Sequelize[_0x5186('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x5186('0x2')]},'senderString':{'type':Sequelize[_0x5186('0x2')]},'deliveryReport':{'type':Sequelize[_0x5186('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x5186('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5186('0xf')],'defaultValue':function(){return _0x5186('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5186('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5186('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5186('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5186('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5186('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5186('0x11')],'comment':_0x5186('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x5186('0xe')],'defaultValue':![],'comment':_0x5186('0x13'),'set':function(_0x3ff18c){if(!_0x3ff18c)this[_0x5186('0x14')](_0x5186('0x15'),null);this['setDataValue'](_0x5186('0x16'),_0x3ff18c);}}}; \ No newline at end of file +var _0x5be8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','exports','STRING','name','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x5be8,0xe6));var _0x85be=function(_0x449a5e,_0x3b83e8){_0x449a5e=_0x449a5e-0x0;var _0x4283e7=_0x5be8[_0x449a5e];return _0x4283e7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x85be('0x0')]={'name':{'type':Sequelize[_0x85be('0x1')],'unique':_0x85be('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x85be('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x85be('0x1')]},'type':{'type':Sequelize[_0x85be('0x3')](_0x85be('0x4'),_0x85be('0x5'),_0x85be('0x6'),_0x85be('0x7'),_0x85be('0x8'),_0x85be('0x9'),_0x85be('0xa'),_0x85be('0xb'),'infobip',_0x85be('0xc'))},'accountSid':{'type':Sequelize[_0x85be('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x85be('0x1')]},'smsMethod':{'type':Sequelize[_0x85be('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x85be('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x85be('0x1')]},'accountId':{'type':Sequelize[_0x85be('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x85be('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x85be('0x1')]},'notificationTemplate':{'type':Sequelize[_0x85be('0xe')],'defaultValue':function(){return _0x85be('0xf');}},'notificationSound':{'type':Sequelize[_0x85be('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x85be('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x85be('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x85be('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x85be('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x85be('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x85be('0x10')],'comment':_0x85be('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x85be('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xaa190e){if(!_0xaa190e)this[_0x85be('0x12')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0xaa190e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4103483..49abfc1 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 _0x7e2a=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','mandatoryDispositionPause','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','Disposition','getDispositions','findOne','keys','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','mobile','MessageSid','skebby','from','sender','text','clicksend','messageId','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','Tag','Tags','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x2ecefc,_0x168d05){var _0x5b77ae=function(_0x4a3e77){while(--_0x4a3e77){_0x2ecefc['push'](_0x2ecefc['shift']());}};_0x5b77ae(++_0x168d05);}(_0x7e2a,0xcc));var _0xa7e2=function(_0x214434,_0x3facc0){_0x214434=_0x214434-0x0;var _0x309f3b=_0x7e2a[_0x214434];return _0x309f3b;};'use strict';var emlformat=require(_0xa7e2('0x0'));var rimraf=require(_0xa7e2('0x1'));var zipdir=require(_0xa7e2('0x2'));var jsonpatch=require(_0xa7e2('0x3'));var rp=require(_0xa7e2('0x4'));var moment=require('moment');var BPromise=require(_0xa7e2('0x5'));var Mustache=require(_0xa7e2('0x6'));var util=require(_0xa7e2('0x7'));var path=require('path');var sox=require(_0xa7e2('0x8'));var csv=require(_0xa7e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7e2('0xa'));var _=require(_0xa7e2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa7e2('0xc'));var toCsv=require(_0xa7e2('0x9'));var querystring=require(_0xa7e2('0xd'));var Papa=require(_0xa7e2('0xe'));var Redis=require(_0xa7e2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa7e2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7e2('0x11'));var logger=require('../../config/logger')(_0xa7e2('0x12'));var utils=require(_0xa7e2('0x13'));var config=require(_0xa7e2('0x14'));var licenseUtil=require(_0xa7e2('0x15'));var db=require(_0xa7e2('0x16'))['db'];config[_0xa7e2('0x17')]=_['defaults'](config['redis'],{'host':_0xa7e2('0x18'),'port':0x18eb});var socket=require(_0xa7e2('0x19'))(new Redis(config['redis']));require(_0xa7e2('0x1a'))['register'](socket);var jayson=require(_0xa7e2('0x1b'));var client=jayson['client'][_0xa7e2('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5c409d,_0x44e733,_0x1840fd,_0x43a128){return new BPromise(function(_0x3df10a,_0x111c0e){var _0x4e8897=_0x43a128||client;return _0x4e8897['request'](_0x5c409d,_0x1840fd)[_0xa7e2('0x1d')](function(_0x4cf53a){logger[_0xa7e2('0x1e')](_0xa7e2('0x1f'),_0x44e733,_0xa7e2('0x20'));logger[_0xa7e2('0x21')](_0xa7e2('0x22'),_0x44e733,_0xa7e2('0x20'),JSON[_0xa7e2('0x23')](_0x4cf53a));if(_0x4cf53a[_0xa7e2('0x24')]){if(_0x4cf53a[_0xa7e2('0x24')]['code']===0x1f4){logger[_0xa7e2('0x24')](_0xa7e2('0x1f'),_0x44e733,_0x4cf53a['error'][_0xa7e2('0x25')]);return _0x111c0e(_0x4cf53a['error'][_0xa7e2('0x25')]);}logger[_0xa7e2('0x24')]('SmsAccount,\x20%s,\x20%s',_0x44e733,_0x4cf53a[_0xa7e2('0x24')]['message']);return _0x3df10a(_0x4cf53a['error'][_0xa7e2('0x25')]);}else{logger[_0xa7e2('0x1e')](_0xa7e2('0x1f'),_0x44e733,_0xa7e2('0x20'));_0x3df10a(_0x4cf53a[_0xa7e2('0x26')][_0xa7e2('0x25')]);}})[_0xa7e2('0x27')](function(_0x5c43ff){logger[_0xa7e2('0x24')]('SmsAccount,\x20%s,\x20%s',_0x44e733,_0x5c43ff);_0x111c0e(_0x5c43ff);});});}function respondWithStatusCode(_0x1b37da,_0x471fe4){_0x471fe4=_0x471fe4||0xcc;return function(_0x119fdb){if(_0x119fdb){return _0x1b37da[_0xa7e2('0x28')](_0x471fe4);}return _0x1b37da[_0xa7e2('0x29')](_0x471fe4)[_0xa7e2('0x2a')]();};}function respondWithResult(_0x47d44a,_0x2aa667){_0x2aa667=_0x2aa667||0xc8;return function(_0x5ee5ab){if(_0x5ee5ab){return _0x47d44a['status'](_0x2aa667)[_0xa7e2('0x2b')](_0x5ee5ab);}};}function respondWithFilteredResult(_0x11559e,_0x2a2b96){return function(_0x4b998b){if(_0x4b998b){var _0xdb4ce4=typeof _0x2a2b96[_0xa7e2('0x2c')]===_0xa7e2('0x2d')&&typeof _0x2a2b96[_0xa7e2('0x2e')]===_0xa7e2('0x2d');var _0x5aa2eb=_0x4b998b[_0xa7e2('0x2f')];var _0x48586f=_0xdb4ce4?0x0:_0x2a2b96['offset'];var _0x10554a=_0xdb4ce4?_0x4b998b[_0xa7e2('0x2f')]:_0x2a2b96[_0xa7e2('0x2c')]+_0x2a2b96[_0xa7e2('0x2e')];var _0x3ae206;if(_0x10554a>=_0x5aa2eb){_0x10554a=_0x5aa2eb;_0x3ae206=0xc8;}else{_0x3ae206=0xce;}_0x11559e[_0xa7e2('0x29')](_0x3ae206);return _0x11559e[_0xa7e2('0x30')](_0xa7e2('0x31'),_0x48586f+'-'+_0x10554a+'/'+_0x5aa2eb)[_0xa7e2('0x2b')](_0x4b998b);}return null;};}function patchUpdates(_0x3c8c45){return function(_0xc6dcb8){try{jsonpatch[_0xa7e2('0x32')](_0xc6dcb8,_0x3c8c45,!![]);}catch(_0x19f0e7){return BPromise['reject'](_0x19f0e7);}return _0xc6dcb8[_0xa7e2('0x33')]();};}function saveUpdates(_0x118500,_0x1f5a69){return function(_0x4dbad9){if(_0x4dbad9){return _0x4dbad9[_0xa7e2('0x34')](_0x118500)[_0xa7e2('0x1d')](function(_0x443ca7){return _0x443ca7;});}return null;};}function removeEntity(_0x479f47,_0x410143){return function(_0xa23de5){if(_0xa23de5){return _0xa23de5[_0xa7e2('0x35')]()[_0xa7e2('0x1d')](function(){var _0x2a61c9=_0xa23de5['get']({'plain':!![]});var _0x446fa9='SmsAccounts';return db['UserProfileResource'][_0xa7e2('0x35')]({'where':{'type':_0x446fa9,'resourceId':_0x2a61c9['id']}})[_0xa7e2('0x1d')](function(){return _0xa23de5;});})[_0xa7e2('0x1d')](function(){_0x479f47[_0xa7e2('0x29')](0xcc)[_0xa7e2('0x2a')]();});}};}function handleEntityNotFound(_0x231a16,_0x4e4d09){return function(_0x44d45b){if(!_0x44d45b){_0x231a16[_0xa7e2('0x28')](0x194);}return _0x44d45b;};}function handleError(_0x5f4626,_0x28b112){_0x28b112=_0x28b112||0x1f4;return function(_0x62d825){logger['error'](_0x62d825[_0xa7e2('0x36')]);if(_0x62d825[_0xa7e2('0x37')]){delete _0x62d825[_0xa7e2('0x37')];}_0x5f4626[_0xa7e2('0x29')](_0x28b112)[_0xa7e2('0x38')](_0x62d825);};}exports[_0xa7e2('0x39')]=function(_0x20ee1e,_0x43c98b){var _0x2de3d0={'include':[{'model':db[_0xa7e2('0x3a')],'as':'mandatoryDispositionPause'}]},_0x234387={},_0xdad0f8={'count':0x0,'rows':[]};var _0x22cc06=_['map'](db[_0xa7e2('0x3b')][_0xa7e2('0x3c')],function(_0x2394e4){return{'name':_0x2394e4[_0xa7e2('0x3d')],'type':_0x2394e4[_0xa7e2('0x3e')][_0xa7e2('0x3f')]};});_0x234387[_0xa7e2('0x40')]=_[_0xa7e2('0x41')](_0x22cc06,'name');_0x234387[_0xa7e2('0x42')]=_['keys'](_0x20ee1e[_0xa7e2('0x42')]);_0x234387[_0xa7e2('0x43')]=_['intersection'](_0x234387[_0xa7e2('0x40')],_0x234387[_0xa7e2('0x42')]);_0x2de3d0[_0xa7e2('0x44')]=_[_0xa7e2('0x45')](_0x234387[_0xa7e2('0x40')],qs[_0xa7e2('0x46')](_0x20ee1e['query'][_0xa7e2('0x46')]));_0x2de3d0[_0xa7e2('0x44')]=_0x2de3d0[_0xa7e2('0x44')][_0xa7e2('0x47')]?_0x2de3d0[_0xa7e2('0x44')]:_0x234387[_0xa7e2('0x40')];if(!_0x20ee1e[_0xa7e2('0x42')]['hasOwnProperty'](_0xa7e2('0x48'))){_0x2de3d0[_0xa7e2('0x2e')]=qs[_0xa7e2('0x2e')](_0x20ee1e['query'][_0xa7e2('0x2e')]);_0x2de3d0['offset']=qs[_0xa7e2('0x2c')](_0x20ee1e[_0xa7e2('0x42')][_0xa7e2('0x2c')]);}_0x2de3d0[_0xa7e2('0x49')]=qs['sort'](_0x20ee1e[_0xa7e2('0x42')][_0xa7e2('0x4a')]);_0x2de3d0[_0xa7e2('0x4b')]=qs[_0xa7e2('0x43')](_[_0xa7e2('0x4c')](_0x20ee1e[_0xa7e2('0x42')],_0x234387['filters']),_0x22cc06);if(_0x20ee1e[_0xa7e2('0x42')][_0xa7e2('0x4d')]){_0x2de3d0[_0xa7e2('0x4b')]=_[_0xa7e2('0x4e')](_0x2de3d0[_0xa7e2('0x4b')],{'$or':_[_0xa7e2('0x41')](_0x22cc06,function(_0x54dc47){if(_0x54dc47['type']!==_0xa7e2('0x4f')){var _0x1accd6={};_0x1accd6[_0x54dc47['name']]={'$like':'%'+_0x20ee1e[_0xa7e2('0x42')]['filter']+'%'};return _0x1accd6;}})});}_0x2de3d0=_[_0xa7e2('0x4e')]({},_0x2de3d0,_0x20ee1e['options']);var _0x5ca4a2={'where':_0x2de3d0[_0xa7e2('0x4b')]};return db[_0xa7e2('0x3b')][_0xa7e2('0x2f')](_0x5ca4a2)['then'](function(_0x34e945){_0xdad0f8[_0xa7e2('0x2f')]=_0x34e945;if(_0x20ee1e[_0xa7e2('0x42')][_0xa7e2('0x50')]){_0x2de3d0[_0xa7e2('0x51')]=[{'all':!![]}];}return db[_0xa7e2('0x3b')][_0xa7e2('0x52')](_0x2de3d0);})[_0xa7e2('0x1d')](function(_0x104f76){_0xdad0f8[_0xa7e2('0x53')]=_0x104f76;return _0xdad0f8;})[_0xa7e2('0x1d')](respondWithFilteredResult(_0x43c98b,_0x2de3d0))[_0xa7e2('0x27')](handleError(_0x43c98b,null));};exports[_0xa7e2('0x54')]=function(_0x4b75b4,_0xe2cef7){var _0x4f0b77={'raw':![],'where':{'id':_0x4b75b4['params']['id']},'include':[{'model':db[_0xa7e2('0x3a')],'as':_0xa7e2('0x55')}]},_0x121ade={};_0x121ade[_0xa7e2('0x40')]=_['keys'](db[_0xa7e2('0x3b')][_0xa7e2('0x3c')]);_0x121ade[_0xa7e2('0x42')]=_['keys'](_0x4b75b4[_0xa7e2('0x42')]);_0x121ade[_0xa7e2('0x43')]=_[_0xa7e2('0x45')](_0x121ade['model'],_0x121ade[_0xa7e2('0x42')]);_0x4f0b77[_0xa7e2('0x44')]=_[_0xa7e2('0x45')](_0x121ade['model'],qs['fields'](_0x4b75b4[_0xa7e2('0x42')][_0xa7e2('0x46')]));_0x4f0b77[_0xa7e2('0x44')]=_0x4f0b77['attributes'][_0xa7e2('0x47')]?_0x4f0b77['attributes']:_0x121ade[_0xa7e2('0x40')];if(_0x4b75b4[_0xa7e2('0x42')][_0xa7e2('0x50')]){_0x4f0b77[_0xa7e2('0x51')]=[{'all':!![]}];}_0x4f0b77=_[_0xa7e2('0x4e')]({},_0x4f0b77,_0x4b75b4[_0xa7e2('0x56')]);return db[_0xa7e2('0x3b')][_0xa7e2('0x57')](_0x4f0b77)[_0xa7e2('0x1d')](handleEntityNotFound(_0xe2cef7,null))[_0xa7e2('0x1d')](respondWithResult(_0xe2cef7,null))[_0xa7e2('0x27')](handleError(_0xe2cef7,null));};exports['create']=function(_0x25ec5b,_0x197281){return db[_0xa7e2('0x3b')][_0xa7e2('0x58')](_0x25ec5b[_0xa7e2('0x59')],{})[_0xa7e2('0x1d')](function(_0x4a4b41){var _0x4aed2d=_0x25ec5b[_0xa7e2('0x5a')][_0xa7e2('0x5b')]({'plain':!![]});if(!_0x4aed2d)throw new Error(_0xa7e2('0x5c'));if(_0x4aed2d[_0xa7e2('0x5d')]===_0xa7e2('0x5a')){var _0x59b6e2=_0x4a4b41['get']({'plain':!![]});var _0x1f42f5=_0xa7e2('0x5e');return db[_0xa7e2('0x5f')]['find']({'where':{'name':_0x1f42f5,'userProfileId':_0x4aed2d[_0xa7e2('0x60')]},'raw':!![]})[_0xa7e2('0x1d')](function(_0x306961){if(_0x306961&&_0x306961[_0xa7e2('0x61')]===0x0){return db['UserProfileResource'][_0xa7e2('0x58')]({'name':_0x59b6e2[_0xa7e2('0x37')],'resourceId':_0x59b6e2['id'],'type':_0x306961[_0xa7e2('0x37')],'sectionId':_0x306961['id']},{})['then'](function(){return _0x4a4b41;});}else{return _0x4a4b41;}})[_0xa7e2('0x27')](function(_0xcc3a22){logger[_0xa7e2('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcc3a22);throw _0xcc3a22;});}return _0x4a4b41;})[_0xa7e2('0x1d')](respondWithResult(_0x197281,0xc9))[_0xa7e2('0x27')](handleError(_0x197281,null));};exports[_0xa7e2('0x34')]=function(_0x5fa44a,_0x32b05c){if(_0x5fa44a[_0xa7e2('0x59')]['id']){delete _0x5fa44a[_0xa7e2('0x59')]['id'];}return db[_0xa7e2('0x3b')]['find']({'where':{'id':_0x5fa44a[_0xa7e2('0x62')]['id']},'include':[{'model':db[_0xa7e2('0x3a')],'as':_0xa7e2('0x55')}]})[_0xa7e2('0x1d')](handleEntityNotFound(_0x32b05c,null))[_0xa7e2('0x1d')](saveUpdates(_0x5fa44a[_0xa7e2('0x59')],null))[_0xa7e2('0x1d')](respondWithResult(_0x32b05c,null))['catch'](handleError(_0x32b05c,null));};exports[_0xa7e2('0x35')]=function(_0x1e94b0,_0x42d5d7){return db[_0xa7e2('0x3b')][_0xa7e2('0x57')]({'where':{'id':_0x1e94b0[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x42d5d7,null))[_0xa7e2('0x1d')](removeEntity(_0x42d5d7,null))[_0xa7e2('0x27')](handleError(_0x42d5d7,null));};exports[_0xa7e2('0x63')]=function(_0x5ee1f0,_0x7649d6){return db[_0xa7e2('0x3b')][_0xa7e2('0x63')]()['then'](respondWithResult(_0x7649d6,null))['catch'](handleError(_0x7649d6,null));};exports[_0xa7e2('0x64')]=function(_0x5be433,_0x5f0aeb,_0x10e67a){if(_0x5be433[_0xa7e2('0x59')]['id']){delete _0x5be433['body']['id'];}return db['SmsAccount'][_0xa7e2('0x57')]({'where':{'id':_0x5be433['params']['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x5f0aeb,null))[_0xa7e2('0x1d')](function(_0x35d5a9){if(_0x35d5a9){_0x5be433[_0xa7e2('0x59')]['SmsAccountId']=_0x35d5a9['id'];return db[_0xa7e2('0x65')]['create'](_0x5be433['body']);}})[_0xa7e2('0x1d')](respondWithResult(_0x5f0aeb,null))[_0xa7e2('0x27')](handleError(_0x5f0aeb,null));};exports[_0xa7e2('0x66')]=function(_0x21d304,_0x44d158,_0x498a9d){var _0x19e50a={'raw':![],'where':{}};var _0x55bf75={};var _0x38bba7={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa7e2('0x67')]({'where':{'id':_0x21d304[_0xa7e2('0x62')]['id']}})['then'](handleEntityNotFound(_0x44d158,null))['then'](function(_0x3010e4){if(_0x3010e4){_0x55bf75[_0xa7e2('0x40')]=_[_0xa7e2('0x68')](db['Disposition'][_0xa7e2('0x3c')]);_0x55bf75[_0xa7e2('0x42')]=_[_0xa7e2('0x68')](_0x21d304[_0xa7e2('0x42')]);_0x55bf75[_0xa7e2('0x43')]=_[_0xa7e2('0x45')](_0x55bf75[_0xa7e2('0x40')],_0x55bf75[_0xa7e2('0x42')]);_0x19e50a[_0xa7e2('0x44')]=_['intersection'](_0x55bf75[_0xa7e2('0x40')],qs[_0xa7e2('0x46')](_0x21d304['query']['fields']));_0x19e50a[_0xa7e2('0x44')]=_0x19e50a[_0xa7e2('0x44')][_0xa7e2('0x47')]?_0x19e50a['attributes']:_0x55bf75[_0xa7e2('0x40')];if(!_0x21d304['query']['hasOwnProperty'](_0xa7e2('0x48'))){_0x19e50a[_0xa7e2('0x2e')]=qs[_0xa7e2('0x2e')](_0x21d304[_0xa7e2('0x42')][_0xa7e2('0x2e')]);_0x19e50a[_0xa7e2('0x2c')]=qs[_0xa7e2('0x2c')](_0x21d304[_0xa7e2('0x42')][_0xa7e2('0x2c')]);}_0x19e50a['order']=qs[_0xa7e2('0x4a')](_0x21d304[_0xa7e2('0x42')][_0xa7e2('0x4a')]);_0x19e50a[_0xa7e2('0x4b')]=qs[_0xa7e2('0x43')](_['pick'](_0x21d304[_0xa7e2('0x42')],_0x55bf75[_0xa7e2('0x43')]));_0x19e50a[_0xa7e2('0x4b')][_0xa7e2('0x69')]=_0x3010e4['id'];if(_0x21d304['query'][_0xa7e2('0x4d')]){_0x19e50a[_0xa7e2('0x4b')]=_[_0xa7e2('0x4e')](_0x19e50a['where'],{'$or':_[_0xa7e2('0x41')](_0x19e50a[_0xa7e2('0x44')],function(_0x5b7166){var _0x469c1b={};_0x469c1b[_0x5b7166]={'$like':'%'+_0x21d304['query']['filter']+'%'};return _0x469c1b;})});}_0x19e50a=_['merge']({},_0x19e50a,_0x21d304[_0xa7e2('0x56')]);return db[_0xa7e2('0x65')][_0xa7e2('0x2f')]({'where':_0x19e50a[_0xa7e2('0x4b')]})[_0xa7e2('0x1d')](function(_0x2753b8){_0x38bba7[_0xa7e2('0x2f')]=_0x2753b8;if(_0x21d304[_0xa7e2('0x42')][_0xa7e2('0x50')]){_0x19e50a[_0xa7e2('0x51')]=[{'all':!![]}];}return db[_0xa7e2('0x65')]['findAll'](_0x19e50a);})[_0xa7e2('0x1d')](function(_0xdcce8f){_0x38bba7['rows']=_0xdcce8f;return _0x38bba7;});}})[_0xa7e2('0x1d')](respondWithFilteredResult(_0x44d158,_0x19e50a))[_0xa7e2('0x27')](handleError(_0x44d158,null));};exports[_0xa7e2('0x6a')]=function(_0xf86be2,_0x2a9836,_0xa22fcb){return db[_0xa7e2('0x3b')]['find']({'where':{'id':_0xf86be2[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x2a9836,null))[_0xa7e2('0x1d')](function(_0xb8e68b){if(_0xb8e68b){return _0xb8e68b[_0xa7e2('0x6a')](_0xf86be2[_0xa7e2('0x42')][_0xa7e2('0x6b')]);}})[_0xa7e2('0x1d')](respondWithStatusCode(_0x2a9836,null))[_0xa7e2('0x27')](handleError(_0x2a9836,null));};exports[_0xa7e2('0x6c')]=function(_0x120873,_0x4b0c9d,_0x455784){if(_0x120873[_0xa7e2('0x59')]['id']){delete _0x120873[_0xa7e2('0x59')]['id'];}return db[_0xa7e2('0x3b')]['find']({'where':{'id':_0x120873[_0xa7e2('0x62')]['id']}})['then'](handleEntityNotFound(_0x4b0c9d,null))[_0xa7e2('0x1d')](function(_0x4c638b){if(_0x4c638b){_0x120873['body'][_0xa7e2('0x69')]=_0x4c638b['id'];return db[_0xa7e2('0x6d')]['create'](_0x120873[_0xa7e2('0x59')]);}})[_0xa7e2('0x1d')](respondWithResult(_0x4b0c9d,null))[_0xa7e2('0x27')](handleError(_0x4b0c9d,null));};exports['getAnswers']=function(_0x182bb0,_0x13be7d,_0x114559){var _0x4c2a70={'raw':![],'where':{}};var _0x453122={};var _0xe0d33c={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa7e2('0x67')]({'where':{'id':_0x182bb0[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x13be7d,null))[_0xa7e2('0x1d')](function(_0x5a9a99){if(_0x5a9a99){_0x453122[_0xa7e2('0x40')]=_[_0xa7e2('0x68')](db['CannedAnswer'][_0xa7e2('0x3c')]);_0x453122['query']=_['keys'](_0x182bb0['query']);_0x453122[_0xa7e2('0x43')]=_[_0xa7e2('0x45')](_0x453122[_0xa7e2('0x40')],_0x453122[_0xa7e2('0x42')]);_0x4c2a70[_0xa7e2('0x44')]=_[_0xa7e2('0x45')](_0x453122[_0xa7e2('0x40')],qs[_0xa7e2('0x46')](_0x182bb0[_0xa7e2('0x42')][_0xa7e2('0x46')]));_0x4c2a70[_0xa7e2('0x44')]=_0x4c2a70[_0xa7e2('0x44')][_0xa7e2('0x47')]?_0x4c2a70[_0xa7e2('0x44')]:_0x453122['model'];if(!_0x182bb0[_0xa7e2('0x42')][_0xa7e2('0x6e')](_0xa7e2('0x48'))){_0x4c2a70[_0xa7e2('0x2e')]=qs[_0xa7e2('0x2e')](_0x182bb0[_0xa7e2('0x42')][_0xa7e2('0x2e')]);_0x4c2a70['offset']=qs[_0xa7e2('0x2c')](_0x182bb0[_0xa7e2('0x42')][_0xa7e2('0x2c')]);}_0x4c2a70[_0xa7e2('0x49')]=qs[_0xa7e2('0x4a')](_0x182bb0['query']['sort']);_0x4c2a70[_0xa7e2('0x4b')]=qs[_0xa7e2('0x43')](_['pick'](_0x182bb0[_0xa7e2('0x42')],_0x453122[_0xa7e2('0x43')]));_0x4c2a70[_0xa7e2('0x4b')][_0xa7e2('0x69')]=_0x5a9a99['id'];if(_0x182bb0[_0xa7e2('0x42')][_0xa7e2('0x4d')]){_0x4c2a70[_0xa7e2('0x4b')]=_[_0xa7e2('0x4e')](_0x4c2a70[_0xa7e2('0x4b')],{'$or':_[_0xa7e2('0x41')](_0x4c2a70[_0xa7e2('0x44')],function(_0x4bbc59){var _0x122e54={};_0x122e54[_0x4bbc59]={'$like':'%'+_0x182bb0[_0xa7e2('0x42')]['filter']+'%'};return _0x122e54;})});}_0x4c2a70=_['merge']({},_0x4c2a70,_0x182bb0['options']);return db[_0xa7e2('0x6d')][_0xa7e2('0x2f')]({'where':_0x4c2a70[_0xa7e2('0x4b')]})[_0xa7e2('0x1d')](function(_0x580900){_0xe0d33c[_0xa7e2('0x2f')]=_0x580900;if(_0x182bb0[_0xa7e2('0x42')][_0xa7e2('0x50')]){_0x4c2a70['include']=[{'all':!![]}];}return db[_0xa7e2('0x6d')][_0xa7e2('0x52')](_0x4c2a70);})[_0xa7e2('0x1d')](function(_0x58d49e){_0xe0d33c[_0xa7e2('0x53')]=_0x58d49e;return _0xe0d33c;});}})[_0xa7e2('0x1d')](respondWithFilteredResult(_0x13be7d,_0x4c2a70))[_0xa7e2('0x27')](handleError(_0x13be7d,null));};exports[_0xa7e2('0x6f')]=function(_0x5d7785,_0x2c6be8,_0x4448c0){return db[_0xa7e2('0x3b')][_0xa7e2('0x57')]({'where':{'id':_0x5d7785['params']['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x2c6be8,null))['then'](function(_0x5d3644){if(_0x5d3644){return _0x5d3644[_0xa7e2('0x6f')](_0x5d7785['query'][_0xa7e2('0x6b')]);}})['then'](respondWithStatusCode(_0x2c6be8,null))[_0xa7e2('0x27')](handleError(_0x2c6be8,null));};exports[_0xa7e2('0x70')]=function(_0x42b629,_0x245a95,_0x5d9884){var _0x45b31a={'channel':_0xa7e2('0x71')};var _0x395b50=[];var _0x5b0556=[];var _0x3af4fc={};return db['SmsAccount'][_0xa7e2('0x57')]({'where':{'id':_0x42b629['params']['id']},'include':[{'model':db[_0xa7e2('0x72')],'as':_0xa7e2('0x73')}]})[_0xa7e2('0x1d')](handleEntityNotFound(_0x245a95,null))[_0xa7e2('0x1d')](function(_0x374be8){_0x45b31a['account']=_0x374be8;_0x45b31a[_0xa7e2('0x74')]=_[_0xa7e2('0x75')](_0x374be8[_0xa7e2('0x73')],[_0xa7e2('0x76')],['asc']);if(_0x45b31a[_0xa7e2('0x77')][_0xa7e2('0x73')]){delete _0x45b31a['account']['Applications'];}return db[_0xa7e2('0x78')][_0xa7e2('0x63')]();})[_0xa7e2('0x1d')](function(_0x1ac167){if(!_0x1ac167){throw new db['Sequelize'][(_0xa7e2('0x79'))](_0xa7e2('0x7a'));}_0x395b50=_[_0xa7e2('0x7b')](_[_0xa7e2('0x68')](_0x1ac167),['createdAt',_0xa7e2('0x7c')]);_0x5b0556=_[_0xa7e2('0x7b')](_[_0xa7e2('0x68')](_0x1ac167),['createdAt',_0xa7e2('0x7c'),'CompanyId','ListId']);_0x45b31a[_0xa7e2('0x59')]={'mapKey':_0xa7e2('0x7d')};if(_0x45b31a[_0xa7e2('0x77')][_0xa7e2('0x3e')]){switch(_0x45b31a[_0xa7e2('0x77')][_0xa7e2('0x3e')]){case'twilio':_0x45b31a[_0xa7e2('0x59')]['from']=_0x42b629['body']['From'];_0x45b31a[_0xa7e2('0x59')]['body']=_0x42b629[_0xa7e2('0x59')]['Body'];_0x45b31a[_0xa7e2('0x59')]['messageId']=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x7e')];break;case _0xa7e2('0x7f'):_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x80')]='+'+_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x81')];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x82')];break;case'connectel':_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x80')]=_0x42b629[_0xa7e2('0x59')]['from'];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x25')];break;case _0xa7e2('0x83'):_0x45b31a[_0xa7e2('0x59')]['from']=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x80')];_0x45b31a['body'][_0xa7e2('0x59')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x59')];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x84')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x85')];break;case _0xa7e2('0x86'):_0x45b31a[_0xa7e2('0x59')]['from']=_0x42b629[_0xa7e2('0x59')]['From'];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')]=_0x42b629[_0xa7e2('0x59')]['Text'];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x84')]=_0x42b629['body'][_0xa7e2('0x87')];break;case _0xa7e2('0x88'):_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x80')]='+'+_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x89')][0x0]['from'];_0x45b31a[_0xa7e2('0x59')]['body']=_0x42b629['body'][_0xa7e2('0x89')][0x0][_0xa7e2('0x82')];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x84')]=_0x42b629[_0xa7e2('0x59')]['results'][0x0][_0xa7e2('0x84')];break;case _0xa7e2('0x8a'):_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x80')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x8b')];_0x45b31a[_0xa7e2('0x59')]['body']=_0x42b629[_0xa7e2('0x59')]['segmentedMessage']['message'];break;case _0xa7e2('0x8c'):_0x45b31a[_0xa7e2('0x59')]['from']=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x8d')];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')]=_0x42b629['body'][_0xa7e2('0x82')];_0x45b31a['body'][_0xa7e2('0x84')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x8e')];break;case _0xa7e2('0x8f'):_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x84')]=_0x42b629['body'][0x0][_0xa7e2('0x25')]['id'];_0x45b31a['body'][_0xa7e2('0x80')]=_0x42b629[_0xa7e2('0x59')][0x0][_0xa7e2('0x25')][_0xa7e2('0x80')];_0x45b31a['body'][_0xa7e2('0x59')]=_0x42b629[_0xa7e2('0x59')][0x0]['message'][_0xa7e2('0x82')];break;case _0xa7e2('0x90'):_0x45b31a['body']['from']=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x80')];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x25')];_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x84')]=_0x42b629[_0xa7e2('0x59')][_0xa7e2('0x91')];break;}}if(_0x45b31a[_0xa7e2('0x59')]['id']){delete _0x45b31a[_0xa7e2('0x59')]['id'];}if(_['isNil'](_0x45b31a['body'][_0xa7e2('0x80')])){throw new db['Sequelize'][(_0xa7e2('0x79'))](_0xa7e2('0x92'));}if(_[_0xa7e2('0x93')](_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')])||_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')]===''){throw new db[(_0xa7e2('0x94'))][(_0xa7e2('0x79'))](_0xa7e2('0x95'));}if(_[_0xa7e2('0x93')](_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x96')])){throw new db[(_0xa7e2('0x94'))]['ValidationError'](_0xa7e2('0x97')+_0x5b0556);}if(!_['includes'](_0x5b0556,_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x96')])){throw new db['Sequelize']['ValidationError'](_0xa7e2('0x98')+_0x5b0556);}_0x3af4fc[_0x45b31a['body'][_0xa7e2('0x96')]]=_0x45b31a['body'][_0xa7e2('0x80')];return db[_0xa7e2('0x99')][_0xa7e2('0x57')]({'where':{'id':_0x45b31a[_0xa7e2('0x77')][_0xa7e2('0x9a')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3af4fc,'limit':0x1,'order':[[_0xa7e2('0x7c'),_0xa7e2('0x9b')]]}]});})[_0xa7e2('0x1d')](handleEntityNotFound(_0x245a95,null))[_0xa7e2('0x1d')](function(_0x3771a){if(_0x3771a){_0x45b31a[_0xa7e2('0x9c')]=_[_0xa7e2('0x9d')](_0x3771a,[_0xa7e2('0x9e')]);if(_0x3771a[_0xa7e2('0x9e')][_0xa7e2('0x47')]){return _0x3771a['Contacts'][0x0];}var _0x3bb6b7=_[_0xa7e2('0x9f')](_0x45b31a[_0xa7e2('0x59')],{'firstName':_0x45b31a['body'][_0xa7e2('0x80')],'ListId':_0x3771a['id']});_0x3bb6b7[_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x96')]]=_0x45b31a[_0xa7e2('0x59')]['from'];return db[_0xa7e2('0x78')][_0xa7e2('0x58')](_0x3bb6b7,{'fields':_0x395b50,'raw':!![]});}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x245a95,null))[_0xa7e2('0x1d')](function(_0x2163b8){if(_0x2163b8){_0x45b31a[_0xa7e2('0xa0')]=_0x2163b8;var _0x82ec48={'ContactId':_0x2163b8['id'],'phone':_0x45b31a[_0xa7e2('0x59')]['from'],'SmsAccountId':_0x42b629[_0xa7e2('0x62')]['id']};var _0x2cda80={'ContactId':_0x2163b8['id'],'SmsAccountId':_0x42b629[_0xa7e2('0x62')]['id'],'closed':![]};return db[_0xa7e2('0xa1')][_0xa7e2('0x57')]({'where':_0x2cda80})[_0xa7e2('0x1d')](function(_0x452b97){if(_0x452b97){return[_0x452b97,![]];}return db[_0xa7e2('0xa1')][_0xa7e2('0x58')](_0x82ec48)['then'](function(_0x12bb64){return[_0x12bb64,!![]];});});}})[_0xa7e2('0xa2')](function(_0x17376f,_0x16ee07){_0x45b31a[_0xa7e2('0xa3')]=_0x17376f[_0xa7e2('0x5b')]({'plain':!![]});_0x45b31a[_0xa7e2('0xa3')][_0xa7e2('0xa4')]=![];if(_0x16ee07){if(_0x45b31a['account'][_0xa7e2('0xa5')]){_0x45b31a['applications'][_0xa7e2('0xa6')]({'id':0x0,'priority':_0x45b31a[_0xa7e2('0x74')][_0xa7e2('0x47')]+0x1,'app':_0xa7e2('0xa7'),'appdata':_0xa7e2('0xa8'),'interval':'*,*,*,*'});}_0x45b31a['interaction'][_0xa7e2('0xa4')]=!![];}return db[_0xa7e2('0xa9')][_0xa7e2('0x58')]({'phone':_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x80')],'messageId':_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x84')],'body':_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0x59')],'SmsAccountId':_0x42b629['params']['id'],'SmsInteractionId':_0x17376f['id'],'direction':'in','ContactId':_0x17376f[_0xa7e2('0xaa')],'AttachmentId':_0x45b31a[_0xa7e2('0x59')][_0xa7e2('0xab')]});})[_0xa7e2('0x1d')](function(_0x3d7bfa){_0x45b31a[_0xa7e2('0x25')]=_0x3d7bfa;if(_0x45b31a[_0xa7e2('0xa3')]['UserId']){return db[_0xa7e2('0xac')][_0xa7e2('0x57')]({'attributes':['id','name'],'where':{'id':_0x45b31a[_0xa7e2('0xa3')][_0xa7e2('0xad')]}})[_0xa7e2('0x1d')](function(_0x544f3c){if(_0x544f3c){_0x45b31a[_0xa7e2('0x74')][_0xa7e2('0xae')]({'id':0x0,'priority':0x0,'app':_0xa7e2('0xaf'),'appdata':_0x544f3c['name']+','+(_0x45b31a[_0xa7e2('0x77')][_0xa7e2('0xb0')]||0xa),'interval':_0xa7e2('0xb1')});}return respondWithRpcPromise('Start',_0xa7e2('0xb2'),_0x45b31a);});}return respondWithRpcPromise(_0xa7e2('0xb3'),'startRouting',_0x45b31a);})[_0xa7e2('0x1d')](function(_0x342039){if(_0x342039){var _0x42ee35=0xc8;var _0x590b4c='receiveMessage';logger['info'](_0xa7e2('0x22'),_0x590b4c,_0x42ee35,_0xa7e2('0xb4'));logger[_0xa7e2('0x21')](_0xa7e2('0xb5'),_0x590b4c,_0x42ee35,_0xa7e2('0xb4'),JSON[_0xa7e2('0x23')](_0x342039));if(_0x45b31a[_0xa7e2('0x77')][_0xa7e2('0x3e')]==='twilio'){return _0x245a95[_0xa7e2('0x29')](_0x42ee35)['set'](_0xa7e2('0xb6'),_0xa7e2('0xb7'))['send'](_0xa7e2('0xb8'));}else{return _0x245a95[_0xa7e2('0x29')](_0x42ee35)[_0xa7e2('0x2b')](_0x342039);}}})[_0xa7e2('0x27')](handleError(_0x245a95,null));};exports[_0xa7e2('0xb9')]=function(_0x850739,_0x2cfdf3,_0x251840){return db[_0xa7e2('0x3b')][_0xa7e2('0x67')]({'where':{'id':_0x850739[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x2cfdf3,null))['then'](function(_0x8d1564){if(_0x8d1564){return db[_0xa7e2('0xba')][_0xa7e2('0xbb')](function(_0x2e3251){return db[_0xa7e2('0x72')]['destroy']({'where':{'SmsAccountId':_0x850739['params']['id']},'transaction':_0x2e3251})[_0xa7e2('0x1d')](function(_0x1b0df1){var _0x41c446=_[_0xa7e2('0x41')](_0x850739[_0xa7e2('0x59')],function(_0x389148){_0x389148[_0xa7e2('0x69')]=_0x850739[_0xa7e2('0x62')]['id'];return _0x389148;});return db[_0xa7e2('0x72')][_0xa7e2('0xbc')](_0x41c446,{'transaction':_0x2e3251});});})[_0xa7e2('0x1d')](function(){return db[_0xa7e2('0x72')]['findAndCountAll']({'where':{'SmsAccountId':_0x850739[_0xa7e2('0x62')]['id']},'order':_0xa7e2('0x76')});});}})[_0xa7e2('0x1d')](respondWithResult(_0x2cfdf3,null))[_0xa7e2('0x27')](handleError(_0x2cfdf3,null));};exports['getApplications']=function(_0x468167,_0x5a5c48,_0x114873){var _0x1a7c88={};var _0x4eec06={};var _0x31bb8f;var _0x910737;return db[_0xa7e2('0x3b')][_0xa7e2('0x67')]({'where':{'id':_0x468167[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x5a5c48,null))[_0xa7e2('0x1d')](function(_0x4bc049){if(_0x4bc049){_0x31bb8f=_0x4bc049;_0x4eec06[_0xa7e2('0x40')]=_[_0xa7e2('0x68')](db[_0xa7e2('0x72')][_0xa7e2('0x3c')]);_0x4eec06[_0xa7e2('0x42')]=_[_0xa7e2('0x68')](_0x468167[_0xa7e2('0x42')]);_0x4eec06[_0xa7e2('0x43')]=_[_0xa7e2('0x45')](_0x4eec06[_0xa7e2('0x40')],_0x4eec06[_0xa7e2('0x42')]);_0x1a7c88['attributes']=_[_0xa7e2('0x45')](_0x4eec06[_0xa7e2('0x40')],qs[_0xa7e2('0x46')](_0x468167[_0xa7e2('0x42')][_0xa7e2('0x46')]));_0x1a7c88[_0xa7e2('0x44')]=_0x1a7c88[_0xa7e2('0x44')]['length']?_0x1a7c88[_0xa7e2('0x44')]:_0x4eec06[_0xa7e2('0x40')];_0x1a7c88[_0xa7e2('0x49')]=qs['sort'](_0x468167['query'][_0xa7e2('0x4a')]);_0x1a7c88[_0xa7e2('0x4b')]=qs[_0xa7e2('0x43')](_['pick'](_0x468167[_0xa7e2('0x42')],_0x4eec06[_0xa7e2('0x43')]));if(_0x468167['query'][_0xa7e2('0x4d')]){_0x1a7c88[_0xa7e2('0x4b')]=_[_0xa7e2('0x4e')](_0x1a7c88[_0xa7e2('0x4b')],{'$or':_[_0xa7e2('0x41')](_0x1a7c88[_0xa7e2('0x44')],function(_0x33e84e){var _0x2c8709={};_0x2c8709[_0x33e84e]={'$like':'%'+_0x468167[_0xa7e2('0x42')]['filter']+'%'};return _0x2c8709;})});}_0x1a7c88=_[_0xa7e2('0x4e')]({},_0x1a7c88,_0x468167['options']);return _0x31bb8f[_0xa7e2('0xbd')](_0x1a7c88);}})[_0xa7e2('0x1d')](function(_0x5cbccc){if(_0x5cbccc){_0x910737=_0x5cbccc[_0xa7e2('0x47')];if(!_0x468167['query'][_0xa7e2('0x6e')](_0xa7e2('0x48'))){_0x1a7c88[_0xa7e2('0x2e')]=qs[_0xa7e2('0x2e')](_0x468167[_0xa7e2('0x42')][_0xa7e2('0x2e')]);_0x1a7c88['offset']=qs[_0xa7e2('0x2c')](_0x468167[_0xa7e2('0x42')][_0xa7e2('0x2c')]);}return _0x31bb8f['getApplications'](_0x1a7c88);}})[_0xa7e2('0x1d')](function(_0x23df54){if(_0x23df54){return _0x23df54?{'count':_0x910737,'rows':_0x23df54}:null;}})[_0xa7e2('0x1d')](respondWithResult(_0x5a5c48,null))[_0xa7e2('0x27')](handleError(_0x5a5c48,null));};exports[_0xa7e2('0xbe')]=function(_0x2c8312,_0x1930dc,_0x2a14cd){var _0x5598f7={'raw':![],'where':{}};var _0x23eaaa={};var _0x5580c1={'count':0x0,'rows':[]};return db[_0xa7e2('0x3b')][_0xa7e2('0x67')]({'where':{'id':_0x2c8312[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x1930dc,null))['then'](function(_0x3c8f73){if(_0x3c8f73){_0x23eaaa[_0xa7e2('0x40')]=_[_0xa7e2('0x68')](db[_0xa7e2('0xa1')][_0xa7e2('0x3c')]);_0x23eaaa[_0xa7e2('0x42')]=_[_0xa7e2('0x68')](_0x2c8312['query']);_0x23eaaa[_0xa7e2('0x43')]=_['intersection'](_0x23eaaa['model'],_0x23eaaa['query']);_0x5598f7['attributes']=_['intersection'](_0x23eaaa[_0xa7e2('0x40')],qs[_0xa7e2('0x46')](_0x2c8312['query'][_0xa7e2('0x46')]));_0x5598f7[_0xa7e2('0x44')]=_0x5598f7['attributes'][_0xa7e2('0x47')]?_0x5598f7['attributes']:_0x23eaaa[_0xa7e2('0x40')];if(!_0x2c8312[_0xa7e2('0x42')][_0xa7e2('0x6e')](_0xa7e2('0x48'))){_0x5598f7[_0xa7e2('0x2e')]=qs[_0xa7e2('0x2e')](_0x2c8312[_0xa7e2('0x42')][_0xa7e2('0x2e')]);_0x5598f7[_0xa7e2('0x2c')]=qs[_0xa7e2('0x2c')](_0x2c8312[_0xa7e2('0x42')][_0xa7e2('0x2c')]);}_0x5598f7['order']=qs[_0xa7e2('0x4a')](_0x2c8312['query'][_0xa7e2('0x4a')]);_0x5598f7[_0xa7e2('0x4b')]=qs['filters'](_[_0xa7e2('0x4c')](_0x2c8312['query'],_0x23eaaa[_0xa7e2('0x43')]));_0x5598f7['where'][_0xa7e2('0x69')]=_0x3c8f73['id'];if(_0x2c8312[_0xa7e2('0x42')][_0xa7e2('0x4d')]){_0x5598f7[_0xa7e2('0x4b')]=_[_0xa7e2('0x4e')](_0x5598f7[_0xa7e2('0x4b')],{'$or':_[_0xa7e2('0x41')](_0x5598f7[_0xa7e2('0x44')],function(_0x2cb108){var _0x133229={};_0x133229[_0x2cb108]={'$like':'%'+_0x2c8312[_0xa7e2('0x42')]['filter']+'%'};return _0x133229;})});}_0x5598f7=_[_0xa7e2('0x4e')]({},_0x5598f7,_0x2c8312[_0xa7e2('0x56')]);return db[_0xa7e2('0xa1')][_0xa7e2('0x2f')]({'where':_0x5598f7[_0xa7e2('0x4b')]})[_0xa7e2('0x1d')](function(_0x331abe){_0x5580c1[_0xa7e2('0x2f')]=_0x331abe;if(_0x2c8312[_0xa7e2('0x42')][_0xa7e2('0x50')]){_0x5598f7[_0xa7e2('0x51')]=[{'model':db[_0xa7e2('0x78')],'as':_0xa7e2('0xbf'),'required':![]},{'model':db[_0xa7e2('0xac')],'as':_0xa7e2('0xc0'),'attributes':[_0xa7e2('0x37'),'fullname','internal'],'required':![]},{'model':db[_0xa7e2('0xc1')],'as':_0xa7e2('0xc2'),'attributes':['id',_0xa7e2('0x37'),'color'],'where':_0x2c8312[_0xa7e2('0x42')]['tag']?{'id':_0x2c8312[_0xa7e2('0x42')][_0xa7e2('0xc3')]}:undefined,'required':_0x2c8312[_0xa7e2('0x42')][_0xa7e2('0xc3')]?!![]:![]}];}return db[_0xa7e2('0xa1')][_0xa7e2('0x52')](_0x5598f7);})[_0xa7e2('0x1d')](function(_0x451df2){_0x5580c1[_0xa7e2('0x53')]=_0x451df2;return _0x5580c1;});}})[_0xa7e2('0x1d')](respondWithFilteredResult(_0x1930dc,_0x5598f7))[_0xa7e2('0x27')](handleError(_0x1930dc,null));};exports['send']=function(_0x532151,_0x227920,_0x2ecf00){var _0x2d8fd2,_0x1f3a64,_0x4bbd93;if(_[_0xa7e2('0x93')](_0x532151[_0xa7e2('0x59')][_0xa7e2('0x59')])||_0x532151[_0xa7e2('0x59')][_0xa7e2('0x59')]===''){throw new db[(_0xa7e2('0x94'))]['ValidationError'](_0xa7e2('0x95'));}if(_[_0xa7e2('0x93')](_0x532151[_0xa7e2('0x59')]['to'])){throw new db[(_0xa7e2('0x94'))][(_0xa7e2('0x79'))](_0xa7e2('0xc4'));}_0x2d8fd2=_0x532151[_0xa7e2('0x59')]['to'];return db[_0xa7e2('0x3b')][_0xa7e2('0x57')]({'where':{'id':_0x532151[_0xa7e2('0x62')]['id']},'include':[{'model':db[_0xa7e2('0x99')],'as':_0xa7e2('0xc5'),'include':[{'model':db[_0xa7e2('0x78')],'as':_0xa7e2('0x9e'),'where':{'mobile':_0x2d8fd2},'limit':0x1,'order':[[_0xa7e2('0x7c'),'DESC']]}]}]})[_0xa7e2('0x1d')](handleEntityNotFound(_0x227920,null))[_0xa7e2('0x1d')](function(_0x1fc201){if(_0x1fc201&&_0x1fc201[_0xa7e2('0xc5')]){_0x1f3a64=_0x1fc201[_0xa7e2('0x5b')]({'plain':!![]});if(_0x1f3a64['List']&&_0x1f3a64[_0xa7e2('0xc5')][_0xa7e2('0x9e')][_0xa7e2('0x47')]){return _0x1f3a64['List'][_0xa7e2('0x9e')][0x0];}return db[_0xa7e2('0x78')]['create'](_[_0xa7e2('0x9f')](_0x532151[_0xa7e2('0x59')],{'firstName':_0x2d8fd2,'mobile':_0x2d8fd2,'phone':_0x2d8fd2,'ListId':_0x1f3a64['ListId']}));}})['then'](handleEntityNotFound(_0x227920,null))['then'](function(_0x462f69){if(_0x462f69){_0x4bbd93=_0x462f69;return db[_0xa7e2('0xa1')][_0xa7e2('0x57')]({'where':{'ContactId':_0x4bbd93['id'],'closed':![],'SmsAccountId':_0x1f3a64['id']}})[_0xa7e2('0x1d')](function(_0x1e2b5c){if(_0x1e2b5c){return[_0x1e2b5c,![]];}return db['SmsInteraction'][_0xa7e2('0x58')]({'UserId':_0x532151['user']['id'],'ContactId':_0x4bbd93['id'],'SmsAccountId':_0x1f3a64['id'],'phone':_0x2d8fd2,'firstMsgDirection':_0xa7e2('0xc6'),'Messages':[_['merge'](_0x532151[_0xa7e2('0x59')],{'read':![],'body':_0x532151[_0xa7e2('0x59')][_0xa7e2('0x59')],'phone':_0x2d8fd2,'SmsAccountId':_0x1f3a64['id'],'UserId':_0x532151['user']['id'],'ContactId':_0x4bbd93['id']})]},{'include':[{'model':db[_0xa7e2('0xa9')],'as':'Messages'}]})[_0xa7e2('0x1d')](function(_0x21d9aa){return[_0x21d9aa,!![]];});});}})['spread'](function(_0x27086e,_0x4b2592){if(_0x4b2592){return _0x27086e;}return db[_0xa7e2('0xa9')][_0xa7e2('0x58')](_['merge'](_0x532151[_0xa7e2('0x59')],{'read':![],'body':_0x532151[_0xa7e2('0x59')][_0xa7e2('0x59')],'phone':_0x2d8fd2,'SmsAccountId':_0x1f3a64['id'],'SmsInteractionId':_0x27086e['id'],'UserId':_0x532151[_0xa7e2('0x5a')]['id'],'ContactId':_0x4bbd93['id']}))['then'](function(_0x151123){_0x27086e[_0xa7e2('0xc7')][_0xa7e2('0xc8')]=[];_0x27086e[_0xa7e2('0xc7')][_0xa7e2('0xc8')][_0xa7e2('0xa6')](_0x151123[_0xa7e2('0xc7')]);return _0x27086e;});})[_0xa7e2('0x1d')](respondWithResult(_0x227920,null))[_0xa7e2('0x27')](handleError(_0x227920,null));};exports[_0xa7e2('0x29')]=function(_0x171e4e,_0x5dcaa6,_0x5022b2){if(_0x171e4e['body']['id']){delete _0x171e4e[_0xa7e2('0x59')]['id'];}var _0x10a802,_0x5aca0c,_0x2dfd49;return db[_0xa7e2('0x3b')][_0xa7e2('0x57')]({'where':{'id':_0x171e4e[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x5dcaa6,null))[_0xa7e2('0x1d')](function(_0x322ce0){if(_0x322ce0){_0x2dfd49=_0x322ce0;logger[_0xa7e2('0x21')](_0xa7e2('0x22'),_0xa7e2('0x29'),'received\x20delivery\x20report\x20from',_0x322ce0[_0xa7e2('0x3e')],util[_0xa7e2('0xc9')](_0x171e4e['body'],{'showHidden':![],'depth':null}));switch(_0x322ce0[_0xa7e2('0x3e')]){case _0xa7e2('0x7f'):if(_0x171e4e[_0xa7e2('0x59')]['skebby_dispatch_id']&&_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0x29')]){_0x5aca0c=_0x171e4e['body'][_0xa7e2('0x29')];return db[_0xa7e2('0xa9')][_0xa7e2('0x57')]({'where':{'messageId':_0x171e4e['body'][_0xa7e2('0xca')]}});}break;case _0xa7e2('0xcb'):if(_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0xcc')]&&_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0xcd')]){_0x5aca0c=_0x171e4e[_0xa7e2('0x59')]['statusInt'];return db[_0xa7e2('0xa9')][_0xa7e2('0x57')]({'where':{'messageId':_0x171e4e['body']['requestid']}});}break;case'clicksend':if(_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0x85')]&&_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0xce')]){_0x5aca0c=_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0xce')];return db[_0xa7e2('0xa9')][_0xa7e2('0x57')]({'where':{'messageId':_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0x85')]}});}break;case'infobip':var _0x3b0b44=_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0x89')][0x0];if(_0x3b0b44['messageId']&&_0x3b0b44[_0xa7e2('0x29')][_0xa7e2('0xcf')]===_0xa7e2('0xd0')){_0x5aca0c=_0x3b0b44[_0xa7e2('0x29')][_0xa7e2('0xcf')];return db['SmsMessage'][_0xa7e2('0x57')]({'where':{'messageId':_0x3b0b44['messageId']}});}break;case _0xa7e2('0x8c'):if(_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0x84')]&&_0x171e4e[_0xa7e2('0x59')]['status']){_0x5aca0c=_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0x29')];return db[_0xa7e2('0xa9')][_0xa7e2('0x57')]({'where':{'messageId':_0x171e4e['body']['messageId']}});}break;case _0xa7e2('0x8f'):if(_0x171e4e[_0xa7e2('0x59')][0x0][_0xa7e2('0x25')]['id']){_0x5aca0c=_0x171e4e[_0xa7e2('0x59')][0x0][_0xa7e2('0x3e')];return db[_0xa7e2('0xa9')][_0xa7e2('0x57')]({'where':{'messageId':_0x171e4e[_0xa7e2('0x59')][0x0][_0xa7e2('0x25')]['id']}});}break;case'intelepeer':if(_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0xd1')]&&_0x171e4e[_0xa7e2('0x59')]['status']){_0x5aca0c=_0x171e4e['body']['status'];return db['SmsMessage'][_0xa7e2('0x57')]({'where':{'messageId':_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0xd1')]}});}break;}}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x5dcaa6,null))[_0xa7e2('0x1d')](function(_0x584246){if(_0x584246){_0x10a802=_0x584246;switch(_0x2dfd49['type']){case _0xa7e2('0x7f'):if(_0x5aca0c===_0xa7e2('0xd0')){return _0x10a802[_0xa7e2('0x34')]({'read':!![]});}else{logger[_0xa7e2('0x24')](_0xa7e2('0x22'),_0xa7e2('0x29'),_0xa7e2('0x7f'),util['inspect'](_0x171e4e[_0xa7e2('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa7e2('0xcb'):if(_0x5aca0c==='1'){return _0x10a802[_0xa7e2('0x34')]({'read':!![]});}else{logger[_0xa7e2('0x24')](_0xa7e2('0x22'),_0xa7e2('0x29'),_0xa7e2('0x7f'),util[_0xa7e2('0xc9')](_0x171e4e[_0xa7e2('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x171e4e[_0xa7e2('0x59')]['error_code']&&_0x5aca0c>=0xc8&&_0x5aca0c<=0xce){return _0x10a802[_0xa7e2('0x34')]({'read':!![]});}else{logger[_0xa7e2('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa7e2('0x29'),_0xa7e2('0x83'),util['inspect'](_0x171e4e[_0xa7e2('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa7e2('0x88'):var _0x4f86a2=_0x171e4e[_0xa7e2('0x59')][_0xa7e2('0x89')][0x0];if(_0x4f86a2[_0xa7e2('0x29')][_0xa7e2('0xcf')]===_0xa7e2('0xd0')){return _0x10a802['update']({'read':!![]});}else{logger[_0xa7e2('0x24')](_0xa7e2('0x22'),'status',_0xa7e2('0x88'),util['inspect'](_0x171e4e[_0xa7e2('0x59')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5aca0c==_0xa7e2('0xd2')||_0x5aca0c=='RECEIVED_BY_RECIPIENT'){return _0x10a802[_0xa7e2('0x34')]({'read':!![]});}else{logger[_0xa7e2('0x24')](_0xa7e2('0x22'),_0xa7e2('0x29'),_0xa7e2('0x8c'),util[_0xa7e2('0xc9')](_0x171e4e[_0xa7e2('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa7e2('0x8f'):if(_0x5aca0c=='message-delivered'){return _0x10a802[_0xa7e2('0x34')]({'read':!![]});}else{logger[_0xa7e2('0x24')](_0xa7e2('0x22'),'status','bandwidth',util[_0xa7e2('0xc9')](_0x171e4e[_0xa7e2('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5aca0c===_0xa7e2('0xd3')||_0x5aca0c===_0xa7e2('0xd4')){return _0x10a802[_0xa7e2('0x34')]({'read':!![]});}else{logger[_0xa7e2('0x24')](_0xa7e2('0x22'),_0xa7e2('0x29'),_0xa7e2('0x90'),util[_0xa7e2('0xc9')](_0x171e4e[_0xa7e2('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x10a802;}})[_0xa7e2('0x1d')](respondWithResult(_0x5dcaa6,null))[_0xa7e2('0x27')](handleError(_0x5dcaa6,null));};exports[_0xa7e2('0xd5')]=function(_0x29b806,_0x28381b,_0x572854){var _0x4609f8,_0x500638,_0x5c75f4;return db[_0xa7e2('0x3b')][_0xa7e2('0x57')]({'where':{'id':_0x29b806[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x28381b,null))[_0xa7e2('0x1d')](function(_0x4c02a2){if(_0x4c02a2){_0x5c75f4=_0x4c02a2;logger['debug'](_0xa7e2('0x22'),'status',_0xa7e2('0xd6'),_0x4c02a2[_0xa7e2('0x3e')],util[_0xa7e2('0xc9')](_0x29b806[_0xa7e2('0x42')],{'showHidden':![],'depth':null}));switch(_0x4c02a2['type']){case _0xa7e2('0x8a'):if(_0x29b806[_0xa7e2('0x42')]['message-id']&&_0x29b806[_0xa7e2('0x42')]['state']){_0x500638=_0x29b806[_0xa7e2('0x42')]['state'];return db[_0xa7e2('0xa9')][_0xa7e2('0x57')]({'where':{'messageId':_0x29b806[_0xa7e2('0x42')]['message-id']}});}break;}}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x28381b,null))[_0xa7e2('0x1d')](function(_0x588061){if(_0x588061){_0x4609f8=_0x588061;switch(_0x5c75f4[_0xa7e2('0x3e')]){case _0xa7e2('0x8a'):if(_0x500638==='2'||_0x500638==='6'){return _0x4609f8[_0xa7e2('0x34')]({'read':!![]});}else{logger[_0xa7e2('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa7e2('0x29'),_0xa7e2('0x8a'),util[_0xa7e2('0xc9')](_0x29b806[_0xa7e2('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x4609f8;}})['then'](respondWithResult(_0x28381b,null))[_0xa7e2('0x27')](handleError(_0x28381b,null));};exports[_0xa7e2('0xd7')]=function(_0x1b135b,_0x51920f,_0x113885){return db[_0xa7e2('0x3b')]['find']({'where':{'id':_0x1b135b[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x51920f,null))[_0xa7e2('0x1d')](function(_0x1cf14d){if(_0x1cf14d){return _0x1cf14d[_0xa7e2('0xd7')](_0x1b135b[_0xa7e2('0x59')][_0xa7e2('0x6b')],_['omit'](_0x1b135b[_0xa7e2('0x59')],[_0xa7e2('0x6b'),'id'])||{})[_0xa7e2('0xa2')](function(_0xd18247){for(var _0x4345aa=0x0;_0x4345aa<_0x1b135b['body'][_0xa7e2('0x6b')]['length'];_0x4345aa+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x1b135b[_0xa7e2('0x59')][_0xa7e2('0x6b')][_0x4345aa]),'SmsAccountId':Number(_0x1b135b[_0xa7e2('0x62')]['id'])});}return _0xd18247;});}})[_0xa7e2('0x1d')](respondWithResult(_0x51920f,null))[_0xa7e2('0x27')](handleError(_0x51920f,null));};exports[_0xa7e2('0xd8')]=function(_0x2bc231,_0x536a0f,_0x34ab90){return db[_0xa7e2('0x3b')][_0xa7e2('0x57')]({'where':{'id':_0x2bc231[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x536a0f,null))[_0xa7e2('0x1d')](function(_0x30c335){if(_0x30c335){return _0x30c335['removeAgents'](_0x2bc231[_0xa7e2('0x42')][_0xa7e2('0x6b')])['then'](function(){if(_[_0xa7e2('0xd9')](_0x2bc231[_0xa7e2('0x42')][_0xa7e2('0x6b')])){for(var _0x49a45d=0x0;_0x49a45d<_0x2bc231['query'][_0xa7e2('0x6b')][_0xa7e2('0x47')];_0x49a45d+=0x1){socket[_0xa7e2('0xda')](_0xa7e2('0xdb'),{'UserId':Number(_0x2bc231['query'][_0xa7e2('0x6b')][_0x49a45d]),'SmsAccountId':Number(_0x2bc231[_0xa7e2('0x62')]['id'])});}}else{socket[_0xa7e2('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x2bc231[_0xa7e2('0x42')]['ids']),'SmsAccountId':Number(_0x2bc231[_0xa7e2('0x62')]['id'])});}});}})[_0xa7e2('0x1d')](respondWithStatusCode(_0x536a0f,null))[_0xa7e2('0x27')](handleError(_0x536a0f,null));};exports[_0xa7e2('0xdc')]=function(_0x404bea,_0x6162ae,_0xc9f1de){var _0x268f9a={};var _0x39e8c2={};var _0x187f9d;var _0x2d4ef0;return db['SmsAccount']['findOne']({'where':{'id':_0x404bea[_0xa7e2('0x62')]['id']}})[_0xa7e2('0x1d')](handleEntityNotFound(_0x6162ae,null))[_0xa7e2('0x1d')](function(_0x3b6d1f){if(_0x3b6d1f){_0x187f9d=_0x3b6d1f;_0x39e8c2['model']=_['keys'](db[_0xa7e2('0xac')][_0xa7e2('0x3c')]);_0x39e8c2[_0xa7e2('0x42')]=_['keys'](_0x404bea['query']);_0x39e8c2[_0xa7e2('0x43')]=_[_0xa7e2('0x45')](_0x39e8c2[_0xa7e2('0x40')],_0x39e8c2[_0xa7e2('0x42')]);_0x268f9a[_0xa7e2('0x44')]=_[_0xa7e2('0x45')](_0x39e8c2[_0xa7e2('0x40')],qs[_0xa7e2('0x46')](_0x404bea[_0xa7e2('0x42')][_0xa7e2('0x46')]));_0x268f9a[_0xa7e2('0x44')]=_0x268f9a[_0xa7e2('0x44')]['length']?_0x268f9a[_0xa7e2('0x44')]:_0x39e8c2['model'];_0x268f9a['order']=qs['sort'](_0x404bea[_0xa7e2('0x42')][_0xa7e2('0x4a')]);_0x268f9a['where']=qs['filters'](_[_0xa7e2('0x4c')](_0x404bea[_0xa7e2('0x42')],_0x39e8c2[_0xa7e2('0x43')]));if(_0x404bea['query'][_0xa7e2('0x4d')]){_0x268f9a[_0xa7e2('0x4b')]=_['merge'](_0x268f9a[_0xa7e2('0x4b')],{'$or':_['map'](_0x268f9a['attributes'],function(_0x412226){var _0x2066c6={};_0x2066c6[_0x412226]={'$like':'%'+_0x404bea['query'][_0xa7e2('0x4d')]+'%'};return _0x2066c6;})});}_0x268f9a=_['merge']({},_0x268f9a,_0x404bea[_0xa7e2('0x56')]);return _0x187f9d[_0xa7e2('0xdc')](_0x268f9a);}})[_0xa7e2('0x1d')](function(_0x4f92b2){if(_0x4f92b2){_0x2d4ef0=_0x4f92b2['length'];if(!_0x404bea[_0xa7e2('0x42')][_0xa7e2('0x6e')](_0xa7e2('0x48'))){_0x268f9a[_0xa7e2('0x2e')]=qs[_0xa7e2('0x2e')](_0x404bea[_0xa7e2('0x42')][_0xa7e2('0x2e')]);_0x268f9a[_0xa7e2('0x2c')]=qs['offset'](_0x404bea[_0xa7e2('0x42')][_0xa7e2('0x2c')]);}return _0x187f9d[_0xa7e2('0xdc')](_0x268f9a);}})[_0xa7e2('0x1d')](function(_0x286bfe){if(_0x286bfe){return _0x286bfe?{'count':_0x2d4ef0,'rows':_0x286bfe}:null;}})['then'](respondWithResult(_0x6162ae,null))[_0xa7e2('0x27')](handleError(_0x6162ae,null));}; \ No newline at end of file +var _0x85cb=['params','mandatoryDispositionPause','rawAttributes','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsAccounts','UserProfileSection','autoAssociation','update','body','describe','addDisposition','Disposition','findOne','pick','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','plivo','MessageUUID','results','text','csc','clickatell','fromNumber','replyMessageId','bandwidth','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','Contacts','omit','contact','SmsInteraction','spread','interaction','push','close','unmanaged','created','SmsMessage','ContactId','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','defaults','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','inspect','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','UserProfileResource','destroy','stack','name','send','index','Pause','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SmsAccount','include','findAll','catch'];(function(_0x332074,_0x2b2cdf){var _0x3e431b=function(_0x37c998){while(--_0x37c998){_0x332074['push'](_0x332074['shift']());}};_0x3e431b(++_0x2b2cdf);}(_0x85cb,0x8a));var _0xb85c=function(_0x464e5d,_0x4c1c42){_0x464e5d=_0x464e5d-0x0;var _0x11e1fc=_0x85cb[_0x464e5d];return _0x11e1fc;};'use strict';var emlformat=require(_0xb85c('0x0'));var rimraf=require(_0xb85c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb85c('0x2'));var Mustache=require(_0xb85c('0x3'));var util=require(_0xb85c('0x4'));var path=require(_0xb85c('0x5'));var sox=require(_0xb85c('0x6'));var csv=require(_0xb85c('0x7'));var ejs=require(_0xb85c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb85c('0x9'));var squel=require(_0xb85c('0xa'));var crypto=require(_0xb85c('0xb'));var jsforce=require(_0xb85c('0xc'));var deskjs=require(_0xb85c('0xd'));var toCsv=require(_0xb85c('0x7'));var querystring=require('querystring');var Papa=require(_0xb85c('0xe'));var Redis=require(_0xb85c('0xf'));var authService=require(_0xb85c('0x10'));var qs=require(_0xb85c('0x11'));var as=require(_0xb85c('0x12'));var hardwareService=require(_0xb85c('0x13'));var logger=require(_0xb85c('0x14'))(_0xb85c('0x15'));var utils=require(_0xb85c('0x16'));var config=require(_0xb85c('0x17'));var licenseUtil=require(_0xb85c('0x18'));var db=require('../../mysqldb')['db'];config[_0xb85c('0x19')]=_['defaults'](config['redis'],{'host':_0xb85c('0x1a'),'port':0x18eb});var socket=require(_0xb85c('0x1b'))(new Redis(config[_0xb85c('0x19')]));require(_0xb85c('0x1c'))['register'](socket);var jayson=require(_0xb85c('0x1d'));var client=jayson[_0xb85c('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc518e7,_0x540c34,_0x3fe247,_0x10c901){return new BPromise(function(_0x50d992,_0x295ad5){var _0x42a2c2=_0x10c901||client;return _0x42a2c2[_0xb85c('0x1f')](_0xc518e7,_0x3fe247)[_0xb85c('0x20')](function(_0x28a500){logger[_0xb85c('0x21')](_0xb85c('0x22'),_0x540c34,_0xb85c('0x23'));logger[_0xb85c('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x540c34,_0xb85c('0x23'),JSON[_0xb85c('0x25')](_0x28a500));if(_0x28a500[_0xb85c('0x26')]){if(_0x28a500[_0xb85c('0x26')][_0xb85c('0x27')]===0x1f4){logger[_0xb85c('0x26')](_0xb85c('0x22'),_0x540c34,_0x28a500[_0xb85c('0x26')][_0xb85c('0x28')]);return _0x295ad5(_0x28a500['error'][_0xb85c('0x28')]);}logger['error'](_0xb85c('0x22'),_0x540c34,_0x28a500[_0xb85c('0x26')]['message']);return _0x50d992(_0x28a500['error'][_0xb85c('0x28')]);}else{logger[_0xb85c('0x21')](_0xb85c('0x22'),_0x540c34,_0xb85c('0x23'));_0x50d992(_0x28a500[_0xb85c('0x29')][_0xb85c('0x28')]);}})['catch'](function(_0x55d79e){logger[_0xb85c('0x26')](_0xb85c('0x22'),_0x540c34,_0x55d79e);_0x295ad5(_0x55d79e);});});}function respondWithStatusCode(_0x49dff7,_0x20fabb){_0x20fabb=_0x20fabb||0xcc;return function(_0x412f11){if(_0x412f11){return _0x49dff7[_0xb85c('0x2a')](_0x20fabb);}return _0x49dff7[_0xb85c('0x2b')](_0x20fabb)[_0xb85c('0x2c')]();};}function respondWithResult(_0x313ece,_0x3e7bfa){_0x3e7bfa=_0x3e7bfa||0xc8;return function(_0x2ce678){if(_0x2ce678){return _0x313ece[_0xb85c('0x2b')](_0x3e7bfa)[_0xb85c('0x2d')](_0x2ce678);}};}function respondWithFilteredResult(_0x36d0ec,_0x3ba2e5){return function(_0x4e4907){if(_0x4e4907){var _0x600683=typeof _0x3ba2e5[_0xb85c('0x2e')]===_0xb85c('0x2f')&&typeof _0x3ba2e5['limit']===_0xb85c('0x2f');var _0x1ad7af=_0x4e4907[_0xb85c('0x30')];var _0x2bb276=_0x600683?0x0:_0x3ba2e5['offset'];var _0x1ee162=_0x600683?_0x4e4907[_0xb85c('0x30')]:_0x3ba2e5['offset']+_0x3ba2e5[_0xb85c('0x31')];var _0x4c1667;if(_0x1ee162>=_0x1ad7af){_0x1ee162=_0x1ad7af;_0x4c1667=0xc8;}else{_0x4c1667=0xce;}_0x36d0ec[_0xb85c('0x2b')](_0x4c1667);return _0x36d0ec['set'](_0xb85c('0x32'),_0x2bb276+'-'+_0x1ee162+'/'+_0x1ad7af)[_0xb85c('0x2d')](_0x4e4907);}return null;};}function patchUpdates(_0x3af7b9){return function(_0xcc498a){try{jsonpatch['apply'](_0xcc498a,_0x3af7b9,!![]);}catch(_0x4fbb67){return BPromise['reject'](_0x4fbb67);}return _0xcc498a[_0xb85c('0x33')]();};}function saveUpdates(_0x27a7ab,_0x10d620){return function(_0x50834f){if(_0x50834f){return _0x50834f['update'](_0x27a7ab)['then'](function(_0x5a7d98){return _0x5a7d98;});}return null;};}function removeEntity(_0x5c4b0c,_0xeb4257){return function(_0x41787b){if(_0x41787b){return _0x41787b['destroy']()[_0xb85c('0x20')](function(){var _0x551dac=_0x41787b['get']({'plain':!![]});var _0x3e3385='SmsAccounts';return db[_0xb85c('0x34')][_0xb85c('0x35')]({'where':{'type':_0x3e3385,'resourceId':_0x551dac['id']}})['then'](function(){return _0x41787b;});})[_0xb85c('0x20')](function(){_0x5c4b0c[_0xb85c('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4145b4,_0x237782){return function(_0x1f2a1f){if(!_0x1f2a1f){_0x4145b4['sendStatus'](0x194);}return _0x1f2a1f;};}function handleError(_0x490956,_0x1806db){_0x1806db=_0x1806db||0x1f4;return function(_0x53135b){logger[_0xb85c('0x26')](_0x53135b[_0xb85c('0x36')]);if(_0x53135b[_0xb85c('0x37')]){delete _0x53135b[_0xb85c('0x37')];}_0x490956[_0xb85c('0x2b')](_0x1806db)[_0xb85c('0x38')](_0x53135b);};}exports[_0xb85c('0x39')]=function(_0x5e04f8,_0x2814a0){var _0x47b230={'include':[{'model':db[_0xb85c('0x3a')],'as':'mandatoryDispositionPause'}]},_0x4c2e58={},_0x485534={'count':0x0,'rows':[]};var _0x49fb3e=_[_0xb85c('0x3b')](db['SmsAccount']['rawAttributes'],function(_0x59e239){return{'name':_0x59e239[_0xb85c('0x3c')],'type':_0x59e239[_0xb85c('0x3d')]['key']};});_0x4c2e58[_0xb85c('0x3e')]=_[_0xb85c('0x3b')](_0x49fb3e,_0xb85c('0x37'));_0x4c2e58[_0xb85c('0x3f')]=_[_0xb85c('0x40')](_0x5e04f8[_0xb85c('0x3f')]);_0x4c2e58[_0xb85c('0x41')]=_[_0xb85c('0x42')](_0x4c2e58[_0xb85c('0x3e')],_0x4c2e58[_0xb85c('0x3f')]);_0x47b230[_0xb85c('0x43')]=_[_0xb85c('0x42')](_0x4c2e58[_0xb85c('0x3e')],qs[_0xb85c('0x44')](_0x5e04f8[_0xb85c('0x3f')]['fields']));_0x47b230[_0xb85c('0x43')]=_0x47b230[_0xb85c('0x43')][_0xb85c('0x45')]?_0x47b230['attributes']:_0x4c2e58[_0xb85c('0x3e')];if(!_0x5e04f8['query'][_0xb85c('0x46')](_0xb85c('0x47'))){_0x47b230[_0xb85c('0x31')]=qs['limit'](_0x5e04f8[_0xb85c('0x3f')][_0xb85c('0x31')]);_0x47b230[_0xb85c('0x2e')]=qs[_0xb85c('0x2e')](_0x5e04f8[_0xb85c('0x3f')][_0xb85c('0x2e')]);}_0x47b230[_0xb85c('0x48')]=qs[_0xb85c('0x49')](_0x5e04f8['query'][_0xb85c('0x49')]);_0x47b230[_0xb85c('0x4a')]=qs['filters'](_['pick'](_0x5e04f8[_0xb85c('0x3f')],_0x4c2e58['filters']),_0x49fb3e);if(_0x5e04f8[_0xb85c('0x3f')][_0xb85c('0x4b')]){_0x47b230[_0xb85c('0x4a')]=_[_0xb85c('0x4c')](_0x47b230[_0xb85c('0x4a')],{'$or':_['map'](_0x49fb3e,function(_0x41c691){if(_0x41c691['type']!==_0xb85c('0x4d')){var _0x16ff8c={};_0x16ff8c[_0x41c691[_0xb85c('0x37')]]={'$like':'%'+_0x5e04f8[_0xb85c('0x3f')][_0xb85c('0x4b')]+'%'};return _0x16ff8c;}})});}_0x47b230=_[_0xb85c('0x4c')]({},_0x47b230,_0x5e04f8[_0xb85c('0x4e')]);var _0x5f5d5d={'where':_0x47b230['where']};return db[_0xb85c('0x4f')][_0xb85c('0x30')](_0x5f5d5d)[_0xb85c('0x20')](function(_0x47f1f5){_0x485534[_0xb85c('0x30')]=_0x47f1f5;if(_0x5e04f8[_0xb85c('0x3f')]['includeAll']){_0x47b230[_0xb85c('0x50')]=[{'all':!![]}];}return db[_0xb85c('0x4f')][_0xb85c('0x51')](_0x47b230);})['then'](function(_0x92753a){_0x485534['rows']=_0x92753a;return _0x485534;})[_0xb85c('0x20')](respondWithFilteredResult(_0x2814a0,_0x47b230))[_0xb85c('0x52')](handleError(_0x2814a0,null));};exports['show']=function(_0x5a9cac,_0x3acca2){var _0x364f24={'raw':![],'where':{'id':_0x5a9cac[_0xb85c('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xb85c('0x54')}]},_0x34a88c={};_0x34a88c[_0xb85c('0x3e')]=_[_0xb85c('0x40')](db[_0xb85c('0x4f')][_0xb85c('0x55')]);_0x34a88c[_0xb85c('0x3f')]=_[_0xb85c('0x40')](_0x5a9cac['query']);_0x34a88c['filters']=_[_0xb85c('0x42')](_0x34a88c['model'],_0x34a88c['query']);_0x364f24[_0xb85c('0x43')]=_['intersection'](_0x34a88c[_0xb85c('0x3e')],qs[_0xb85c('0x44')](_0x5a9cac[_0xb85c('0x3f')][_0xb85c('0x44')]));_0x364f24[_0xb85c('0x43')]=_0x364f24['attributes']['length']?_0x364f24[_0xb85c('0x43')]:_0x34a88c[_0xb85c('0x3e')];if(_0x5a9cac[_0xb85c('0x3f')][_0xb85c('0x56')]){_0x364f24[_0xb85c('0x50')]=[{'all':!![]}];}_0x364f24=_['merge']({},_0x364f24,_0x5a9cac[_0xb85c('0x4e')]);return db[_0xb85c('0x4f')][_0xb85c('0x57')](_0x364f24)[_0xb85c('0x20')](handleEntityNotFound(_0x3acca2,null))[_0xb85c('0x20')](respondWithResult(_0x3acca2,null))[_0xb85c('0x52')](handleError(_0x3acca2,null));};exports[_0xb85c('0x58')]=function(_0x53a8ac,_0x430d3a){return db[_0xb85c('0x4f')][_0xb85c('0x58')](_0x53a8ac['body'],{})['then'](function(_0x43c864){var _0x644eb7=_0x53a8ac['user'][_0xb85c('0x59')]({'plain':!![]});if(!_0x644eb7)throw new Error(_0xb85c('0x5a'));if(_0x644eb7['role']===_0xb85c('0x5b')){var _0x3d7f87=_0x43c864[_0xb85c('0x59')]({'plain':!![]});var _0x5f5247=_0xb85c('0x5c');return db[_0xb85c('0x5d')]['find']({'where':{'name':_0x5f5247,'userProfileId':_0x644eb7['userProfileId']},'raw':!![]})[_0xb85c('0x20')](function(_0x792a9c){if(_0x792a9c&&_0x792a9c[_0xb85c('0x5e')]===0x0){return db['UserProfileResource'][_0xb85c('0x58')]({'name':_0x3d7f87[_0xb85c('0x37')],'resourceId':_0x3d7f87['id'],'type':_0x792a9c[_0xb85c('0x37')],'sectionId':_0x792a9c['id']},{})[_0xb85c('0x20')](function(){return _0x43c864;});}else{return _0x43c864;}})[_0xb85c('0x52')](function(_0x2be244){logger[_0xb85c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2be244);throw _0x2be244;});}return _0x43c864;})[_0xb85c('0x20')](respondWithResult(_0x430d3a,0xc9))[_0xb85c('0x52')](handleError(_0x430d3a,null));};exports[_0xb85c('0x5f')]=function(_0x122f38,_0x35ba0f){if(_0x122f38[_0xb85c('0x60')]['id']){delete _0x122f38['body']['id'];}return db[_0xb85c('0x4f')][_0xb85c('0x57')]({'where':{'id':_0x122f38[_0xb85c('0x53')]['id']},'include':[{'model':db[_0xb85c('0x3a')],'as':_0xb85c('0x54')}]})[_0xb85c('0x20')](handleEntityNotFound(_0x35ba0f,null))[_0xb85c('0x20')](saveUpdates(_0x122f38[_0xb85c('0x60')],null))[_0xb85c('0x20')](respondWithResult(_0x35ba0f,null))[_0xb85c('0x52')](handleError(_0x35ba0f,null));};exports[_0xb85c('0x35')]=function(_0x33f17c,_0x377746){return db[_0xb85c('0x4f')][_0xb85c('0x57')]({'where':{'id':_0x33f17c[_0xb85c('0x53')]['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x377746,null))[_0xb85c('0x20')](removeEntity(_0x377746,null))[_0xb85c('0x52')](handleError(_0x377746,null));};exports[_0xb85c('0x61')]=function(_0x57684e,_0x47aeef){return db[_0xb85c('0x4f')][_0xb85c('0x61')]()['then'](respondWithResult(_0x47aeef,null))[_0xb85c('0x52')](handleError(_0x47aeef,null));};exports[_0xb85c('0x62')]=function(_0x3d2acf,_0x5c9bcb,_0x39845e){if(_0x3d2acf[_0xb85c('0x60')]['id']){delete _0x3d2acf[_0xb85c('0x60')]['id'];}return db[_0xb85c('0x4f')]['find']({'where':{'id':_0x3d2acf[_0xb85c('0x53')]['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x5c9bcb,null))[_0xb85c('0x20')](function(_0x4cc031){if(_0x4cc031){_0x3d2acf[_0xb85c('0x60')]['SmsAccountId']=_0x4cc031['id'];return db[_0xb85c('0x63')][_0xb85c('0x58')](_0x3d2acf[_0xb85c('0x60')]);}})[_0xb85c('0x20')](respondWithResult(_0x5c9bcb,null))['catch'](handleError(_0x5c9bcb,null));};exports['getDispositions']=function(_0x4f22f2,_0x64a45d,_0x5d7128){var _0x3d608f={'raw':![],'where':{}};var _0x1d19cd={};var _0x4585cb={'count':0x0,'rows':[]};return db[_0xb85c('0x4f')][_0xb85c('0x64')]({'where':{'id':_0x4f22f2['params']['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x64a45d,null))[_0xb85c('0x20')](function(_0x3bc28d){if(_0x3bc28d){_0x1d19cd[_0xb85c('0x3e')]=_[_0xb85c('0x40')](db[_0xb85c('0x63')]['rawAttributes']);_0x1d19cd['query']=_[_0xb85c('0x40')](_0x4f22f2[_0xb85c('0x3f')]);_0x1d19cd['filters']=_[_0xb85c('0x42')](_0x1d19cd['model'],_0x1d19cd[_0xb85c('0x3f')]);_0x3d608f[_0xb85c('0x43')]=_[_0xb85c('0x42')](_0x1d19cd[_0xb85c('0x3e')],qs[_0xb85c('0x44')](_0x4f22f2[_0xb85c('0x3f')][_0xb85c('0x44')]));_0x3d608f[_0xb85c('0x43')]=_0x3d608f['attributes'][_0xb85c('0x45')]?_0x3d608f[_0xb85c('0x43')]:_0x1d19cd[_0xb85c('0x3e')];if(!_0x4f22f2[_0xb85c('0x3f')][_0xb85c('0x46')]('nolimit')){_0x3d608f[_0xb85c('0x31')]=qs[_0xb85c('0x31')](_0x4f22f2[_0xb85c('0x3f')][_0xb85c('0x31')]);_0x3d608f[_0xb85c('0x2e')]=qs['offset'](_0x4f22f2[_0xb85c('0x3f')][_0xb85c('0x2e')]);}_0x3d608f[_0xb85c('0x48')]=qs[_0xb85c('0x49')](_0x4f22f2[_0xb85c('0x3f')][_0xb85c('0x49')]);_0x3d608f[_0xb85c('0x4a')]=qs[_0xb85c('0x41')](_[_0xb85c('0x65')](_0x4f22f2[_0xb85c('0x3f')],_0x1d19cd[_0xb85c('0x41')]));_0x3d608f[_0xb85c('0x4a')][_0xb85c('0x66')]=_0x3bc28d['id'];if(_0x4f22f2[_0xb85c('0x3f')][_0xb85c('0x4b')]){_0x3d608f[_0xb85c('0x4a')]=_[_0xb85c('0x4c')](_0x3d608f[_0xb85c('0x4a')],{'$or':_[_0xb85c('0x3b')](_0x3d608f[_0xb85c('0x43')],function(_0x1fc8b4){var _0x38915d={};_0x38915d[_0x1fc8b4]={'$like':'%'+_0x4f22f2[_0xb85c('0x3f')]['filter']+'%'};return _0x38915d;})});}_0x3d608f=_[_0xb85c('0x4c')]({},_0x3d608f,_0x4f22f2['options']);return db[_0xb85c('0x63')][_0xb85c('0x30')]({'where':_0x3d608f[_0xb85c('0x4a')]})[_0xb85c('0x20')](function(_0x43a446){_0x4585cb[_0xb85c('0x30')]=_0x43a446;if(_0x4f22f2[_0xb85c('0x3f')]['includeAll']){_0x3d608f[_0xb85c('0x50')]=[{'all':!![]}];}return db[_0xb85c('0x63')][_0xb85c('0x51')](_0x3d608f);})['then'](function(_0x3aaff2){_0x4585cb['rows']=_0x3aaff2;return _0x4585cb;});}})['then'](respondWithFilteredResult(_0x64a45d,_0x3d608f))['catch'](handleError(_0x64a45d,null));};exports[_0xb85c('0x67')]=function(_0x8b52cd,_0x142c28,_0x3954a7){return db['SmsAccount'][_0xb85c('0x57')]({'where':{'id':_0x8b52cd['params']['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x142c28,null))[_0xb85c('0x20')](function(_0x4e432c){if(_0x4e432c){return _0x4e432c[_0xb85c('0x67')](_0x8b52cd[_0xb85c('0x3f')][_0xb85c('0x68')]);}})['then'](respondWithStatusCode(_0x142c28,null))[_0xb85c('0x52')](handleError(_0x142c28,null));};exports[_0xb85c('0x69')]=function(_0x321d59,_0x1780cb,_0xe10f9f){if(_0x321d59['body']['id']){delete _0x321d59['body']['id'];}return db['SmsAccount'][_0xb85c('0x57')]({'where':{'id':_0x321d59['params']['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x1780cb,null))[_0xb85c('0x20')](function(_0x115d27){if(_0x115d27){_0x321d59[_0xb85c('0x60')]['SmsAccountId']=_0x115d27['id'];return db['CannedAnswer'][_0xb85c('0x58')](_0x321d59[_0xb85c('0x60')]);}})[_0xb85c('0x20')](respondWithResult(_0x1780cb,null))[_0xb85c('0x52')](handleError(_0x1780cb,null));};exports['getAnswers']=function(_0x7cd493,_0x4794e5,_0x39ed96){var _0x130e46={'raw':![],'where':{}};var _0x3a07c3={};var _0xf33f68={'count':0x0,'rows':[]};return db['SmsAccount'][_0xb85c('0x64')]({'where':{'id':_0x7cd493[_0xb85c('0x53')]['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x4794e5,null))[_0xb85c('0x20')](function(_0x4344a4){if(_0x4344a4){_0x3a07c3[_0xb85c('0x3e')]=_[_0xb85c('0x40')](db['CannedAnswer'][_0xb85c('0x55')]);_0x3a07c3[_0xb85c('0x3f')]=_[_0xb85c('0x40')](_0x7cd493[_0xb85c('0x3f')]);_0x3a07c3[_0xb85c('0x41')]=_['intersection'](_0x3a07c3[_0xb85c('0x3e')],_0x3a07c3[_0xb85c('0x3f')]);_0x130e46[_0xb85c('0x43')]=_['intersection'](_0x3a07c3[_0xb85c('0x3e')],qs['fields'](_0x7cd493[_0xb85c('0x3f')][_0xb85c('0x44')]));_0x130e46[_0xb85c('0x43')]=_0x130e46[_0xb85c('0x43')][_0xb85c('0x45')]?_0x130e46[_0xb85c('0x43')]:_0x3a07c3[_0xb85c('0x3e')];if(!_0x7cd493['query'][_0xb85c('0x46')](_0xb85c('0x47'))){_0x130e46[_0xb85c('0x31')]=qs[_0xb85c('0x31')](_0x7cd493[_0xb85c('0x3f')][_0xb85c('0x31')]);_0x130e46[_0xb85c('0x2e')]=qs[_0xb85c('0x2e')](_0x7cd493[_0xb85c('0x3f')][_0xb85c('0x2e')]);}_0x130e46[_0xb85c('0x48')]=qs[_0xb85c('0x49')](_0x7cd493[_0xb85c('0x3f')]['sort']);_0x130e46['where']=qs[_0xb85c('0x41')](_[_0xb85c('0x65')](_0x7cd493[_0xb85c('0x3f')],_0x3a07c3[_0xb85c('0x41')]));_0x130e46['where'][_0xb85c('0x66')]=_0x4344a4['id'];if(_0x7cd493[_0xb85c('0x3f')][_0xb85c('0x4b')]){_0x130e46['where']=_[_0xb85c('0x4c')](_0x130e46[_0xb85c('0x4a')],{'$or':_[_0xb85c('0x3b')](_0x130e46[_0xb85c('0x43')],function(_0x4de06f){var _0x146706={};_0x146706[_0x4de06f]={'$like':'%'+_0x7cd493['query']['filter']+'%'};return _0x146706;})});}_0x130e46=_[_0xb85c('0x4c')]({},_0x130e46,_0x7cd493['options']);return db['CannedAnswer']['count']({'where':_0x130e46['where']})['then'](function(_0x1487d5){_0xf33f68[_0xb85c('0x30')]=_0x1487d5;if(_0x7cd493['query'][_0xb85c('0x56')]){_0x130e46[_0xb85c('0x50')]=[{'all':!![]}];}return db[_0xb85c('0x6a')]['findAll'](_0x130e46);})[_0xb85c('0x20')](function(_0x1f0764){_0xf33f68[_0xb85c('0x6b')]=_0x1f0764;return _0xf33f68;});}})[_0xb85c('0x20')](respondWithFilteredResult(_0x4794e5,_0x130e46))[_0xb85c('0x52')](handleError(_0x4794e5,null));};exports[_0xb85c('0x6c')]=function(_0x237883,_0x6143a4,_0x5c0779){return db['SmsAccount'][_0xb85c('0x57')]({'where':{'id':_0x237883[_0xb85c('0x53')]['id']}})['then'](handleEntityNotFound(_0x6143a4,null))[_0xb85c('0x20')](function(_0x4bf0dc){if(_0x4bf0dc){return _0x4bf0dc[_0xb85c('0x6c')](_0x237883[_0xb85c('0x3f')][_0xb85c('0x68')]);}})[_0xb85c('0x20')](respondWithStatusCode(_0x6143a4,null))['catch'](handleError(_0x6143a4,null));};exports['notify']=function(_0x1e9d2e,_0x25002e,_0x32bb2d){var _0x57f88c={'channel':'sms'};var _0x401fdd=[];var _0x2d079b=[];var _0x7b4e41={};return db[_0xb85c('0x4f')][_0xb85c('0x57')]({'where':{'id':_0x1e9d2e[_0xb85c('0x53')]['id']},'include':[{'model':db[_0xb85c('0x6d')],'as':_0xb85c('0x6e')}]})[_0xb85c('0x20')](handleEntityNotFound(_0x25002e,null))[_0xb85c('0x20')](function(_0x43739f){_0x57f88c[_0xb85c('0x6f')]=_0x43739f;_0x57f88c[_0xb85c('0x70')]=_['orderBy'](_0x43739f['Applications'],[_0xb85c('0x71')],[_0xb85c('0x72')]);if(_0x57f88c['account'][_0xb85c('0x6e')]){delete _0x57f88c[_0xb85c('0x6f')][_0xb85c('0x6e')];}return db[_0xb85c('0x73')][_0xb85c('0x61')]();})[_0xb85c('0x20')](function(_0x53f47b){if(!_0x53f47b){throw new db[(_0xb85c('0x74'))][(_0xb85c('0x75'))](_0xb85c('0x76'));}_0x401fdd=_[_0xb85c('0x77')](_[_0xb85c('0x40')](_0x53f47b),['createdAt',_0xb85c('0x78')]);_0x2d079b=_['difference'](_[_0xb85c('0x40')](_0x53f47b),[_0xb85c('0x79'),_0xb85c('0x78'),'CompanyId','ListId']);_0x57f88c[_0xb85c('0x60')]={'mapKey':'mobile'};if(_0x57f88c[_0xb85c('0x6f')][_0xb85c('0x3d')]){switch(_0x57f88c['account'][_0xb85c('0x3d')]){case _0xb85c('0x7a'):_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x7c')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x7d')];_0x57f88c['body'][_0xb85c('0x7e')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x7f')];break;case _0xb85c('0x80'):_0x57f88c['body'][_0xb85c('0x7b')]='+'+_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x81')];_0x57f88c['body'][_0xb85c('0x60')]=_0x1e9d2e['body']['text'];break;case _0xb85c('0x82'):_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x7b')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x28')];break;case _0xb85c('0x83'):_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')]=_0x1e9d2e['body'][_0xb85c('0x7b')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]=_0x1e9d2e['body'][_0xb85c('0x60')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7e')]=_0x1e9d2e[_0xb85c('0x60')]['message_id'];break;case _0xb85c('0x84'):_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x7c')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]=_0x1e9d2e[_0xb85c('0x60')]['Text'];_0x57f88c[_0xb85c('0x60')]['messageId']=_0x1e9d2e['body'][_0xb85c('0x85')];break;case'infobip':_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')]='+'+_0x1e9d2e['body'][_0xb85c('0x86')][0x0][_0xb85c('0x7b')];_0x57f88c['body']['body']=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x86')][0x0][_0xb85c('0x87')];_0x57f88c[_0xb85c('0x60')]['messageId']=_0x1e9d2e['body'][_0xb85c('0x86')][0x0][_0xb85c('0x7e')];break;case _0xb85c('0x88'):_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')]=_0x1e9d2e[_0xb85c('0x60')]['originatingAddress'];_0x57f88c[_0xb85c('0x60')]['body']=_0x1e9d2e[_0xb85c('0x60')]['segmentedMessage'][_0xb85c('0x28')];break;case _0xb85c('0x89'):_0x57f88c[_0xb85c('0x60')]['from']=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x8a')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x87')];_0x57f88c['body'][_0xb85c('0x7e')]=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x8b')];break;case _0xb85c('0x8c'):_0x57f88c['body']['messageId']=_0x1e9d2e[_0xb85c('0x60')][0x0][_0xb85c('0x28')]['id'];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')]=_0x1e9d2e[_0xb85c('0x60')][0x0][_0xb85c('0x28')][_0xb85c('0x7b')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]=_0x1e9d2e['body'][0x0]['message']['text'];break;case'intelepeer':_0x57f88c[_0xb85c('0x60')]['from']=_0x1e9d2e[_0xb85c('0x60')][_0xb85c('0x7b')];_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]=_0x1e9d2e['body'][_0xb85c('0x28')];_0x57f88c['body'][_0xb85c('0x7e')]=_0x1e9d2e[_0xb85c('0x60')]['refid'];break;}}if(_0x57f88c[_0xb85c('0x60')]['id']){delete _0x57f88c[_0xb85c('0x60')]['id'];}if(_[_0xb85c('0x8d')](_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')])){throw new db[(_0xb85c('0x74'))][(_0xb85c('0x75'))](_0xb85c('0x8e'));}if(_[_0xb85c('0x8d')](_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')])||_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb85c('0x8d')](_0x57f88c['body']['mapKey'])){throw new db[(_0xb85c('0x74'))][(_0xb85c('0x75'))](_0xb85c('0x8f')+_0x2d079b);}if(!_[_0xb85c('0x90')](_0x2d079b,_0x57f88c[_0xb85c('0x60')]['mapKey'])){throw new db['Sequelize'][(_0xb85c('0x75'))](_0xb85c('0x91')+_0x2d079b);}_0x7b4e41[_0x57f88c[_0xb85c('0x60')][_0xb85c('0x92')]]=_0x57f88c[_0xb85c('0x60')]['from'];return db[_0xb85c('0x93')][_0xb85c('0x57')]({'where':{'id':_0x57f88c['account'][_0xb85c('0x94')]},'include':[{'model':db[_0xb85c('0x73')],'as':_0xb85c('0x95'),'where':_0x7b4e41,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xb85c('0x20')](handleEntityNotFound(_0x25002e,null))[_0xb85c('0x20')](function(_0x5357d1){if(_0x5357d1){_0x57f88c['list']=_[_0xb85c('0x96')](_0x5357d1,[_0xb85c('0x95')]);if(_0x5357d1[_0xb85c('0x95')][_0xb85c('0x45')]){return _0x5357d1[_0xb85c('0x95')][0x0];}var _0x237d20=_['defaults'](_0x57f88c[_0xb85c('0x60')],{'firstName':_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')],'ListId':_0x5357d1['id']});_0x237d20[_0x57f88c[_0xb85c('0x60')]['mapKey']]=_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')];return db[_0xb85c('0x73')][_0xb85c('0x58')](_0x237d20,{'fields':_0x401fdd,'raw':!![]});}})[_0xb85c('0x20')](handleEntityNotFound(_0x25002e,null))[_0xb85c('0x20')](function(_0x3e58c7){if(_0x3e58c7){_0x57f88c[_0xb85c('0x97')]=_0x3e58c7;var _0x14b4ea={'ContactId':_0x3e58c7['id'],'phone':_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')],'SmsAccountId':_0x1e9d2e[_0xb85c('0x53')]['id']};var _0x22cd30={'ContactId':_0x3e58c7['id'],'SmsAccountId':_0x1e9d2e[_0xb85c('0x53')]['id'],'closed':![]};return db[_0xb85c('0x98')][_0xb85c('0x57')]({'where':_0x22cd30})['then'](function(_0x1839e7){if(_0x1839e7){return[_0x1839e7,![]];}return db[_0xb85c('0x98')]['create'](_0x14b4ea)[_0xb85c('0x20')](function(_0x442214){return[_0x442214,!![]];});});}})[_0xb85c('0x99')](function(_0x58e5e4,_0x3c6ebf){_0x57f88c[_0xb85c('0x9a')]=_0x58e5e4['get']({'plain':!![]});_0x57f88c[_0xb85c('0x9a')]['created']=![];if(_0x3c6ebf){if(_0x57f88c[_0xb85c('0x6f')]['autoclose']){_0x57f88c[_0xb85c('0x70')][_0xb85c('0x9b')]({'id':0x0,'priority':_0x57f88c[_0xb85c('0x70')][_0xb85c('0x45')]+0x1,'app':_0xb85c('0x9c'),'appdata':_0xb85c('0x9d'),'interval':'*,*,*,*'});}_0x57f88c[_0xb85c('0x9a')][_0xb85c('0x9e')]=!![];}return db[_0xb85c('0x9f')][_0xb85c('0x58')]({'phone':_0x57f88c[_0xb85c('0x60')][_0xb85c('0x7b')],'messageId':_0x57f88c['body'][_0xb85c('0x7e')],'body':_0x57f88c[_0xb85c('0x60')][_0xb85c('0x60')],'SmsAccountId':_0x1e9d2e[_0xb85c('0x53')]['id'],'SmsInteractionId':_0x58e5e4['id'],'direction':'in','ContactId':_0x58e5e4[_0xb85c('0xa0')],'AttachmentId':_0x57f88c[_0xb85c('0x60')][_0xb85c('0xa1')]});})[_0xb85c('0x20')](function(_0x5e169c){_0x57f88c[_0xb85c('0x28')]=_0x5e169c;if(_0x57f88c[_0xb85c('0x9a')][_0xb85c('0xa2')]){return db['User'][_0xb85c('0x57')]({'attributes':['id',_0xb85c('0x37')],'where':{'id':_0x57f88c[_0xb85c('0x9a')]['UserId']}})[_0xb85c('0x20')](function(_0x3059e7){if(_0x3059e7){_0x57f88c[_0xb85c('0x70')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb85c('0xa3'),'appdata':_0x3059e7['name']+','+(_0x57f88c[_0xb85c('0x6f')]['waitForTheAssignedAgent']||0xa),'interval':_0xb85c('0xa4')});}return respondWithRpcPromise(_0xb85c('0xa5'),_0xb85c('0xa6'),_0x57f88c);});}return respondWithRpcPromise(_0xb85c('0xa5'),_0xb85c('0xa6'),_0x57f88c);})[_0xb85c('0x20')](function(_0x213fa6){if(_0x213fa6){var _0x38fc0a=0xc8;var _0x435ecc=_0xb85c('0xa7');logger[_0xb85c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x435ecc,_0x38fc0a,_0xb85c('0xa8'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x435ecc,_0x38fc0a,'entity\x20found',JSON['stringify'](_0x213fa6));if(_0x57f88c[_0xb85c('0x6f')][_0xb85c('0x3d')]===_0xb85c('0x7a')){return _0x25002e[_0xb85c('0x2b')](_0x38fc0a)['set'](_0xb85c('0xa9'),_0xb85c('0xaa'))[_0xb85c('0x38')](_0xb85c('0xab'));}else{return _0x25002e[_0xb85c('0x2b')](_0x38fc0a)[_0xb85c('0x2d')](_0x213fa6);}}})[_0xb85c('0x52')](handleError(_0x25002e,null));};exports[_0xb85c('0xac')]=function(_0x360d00,_0x3b4685,_0x70e2a5){return db[_0xb85c('0x4f')][_0xb85c('0x64')]({'where':{'id':_0x360d00['params']['id']}})['then'](handleEntityNotFound(_0x3b4685,null))[_0xb85c('0x20')](function(_0x214547){if(_0x214547){return db['sequelize'][_0xb85c('0xad')](function(_0x2a7fa8){return db[_0xb85c('0x6d')][_0xb85c('0x35')]({'where':{'SmsAccountId':_0x360d00[_0xb85c('0x53')]['id']},'transaction':_0x2a7fa8})[_0xb85c('0x20')](function(_0x24d40f){var _0x9c8522=_[_0xb85c('0x3b')](_0x360d00[_0xb85c('0x60')],function(_0x5baf78){_0x5baf78[_0xb85c('0x66')]=_0x360d00['params']['id'];return _0x5baf78;});return db[_0xb85c('0x6d')][_0xb85c('0xae')](_0x9c8522,{'transaction':_0x2a7fa8});});})[_0xb85c('0x20')](function(){return db[_0xb85c('0x6d')][_0xb85c('0xaf')]({'where':{'SmsAccountId':_0x360d00[_0xb85c('0x53')]['id']},'order':_0xb85c('0x71')});});}})[_0xb85c('0x20')](respondWithResult(_0x3b4685,null))[_0xb85c('0x52')](handleError(_0x3b4685,null));};exports['getApplications']=function(_0x11719e,_0x148ace,_0x453b99){var _0x460b36={};var _0x198963={};var _0x59d236;var _0x2b498b;return db[_0xb85c('0x4f')][_0xb85c('0x64')]({'where':{'id':_0x11719e['params']['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x148ace,null))[_0xb85c('0x20')](function(_0x1cd0e0){if(_0x1cd0e0){_0x59d236=_0x1cd0e0;_0x198963['model']=_[_0xb85c('0x40')](db[_0xb85c('0x6d')][_0xb85c('0x55')]);_0x198963[_0xb85c('0x3f')]=_[_0xb85c('0x40')](_0x11719e[_0xb85c('0x3f')]);_0x198963[_0xb85c('0x41')]=_[_0xb85c('0x42')](_0x198963[_0xb85c('0x3e')],_0x198963[_0xb85c('0x3f')]);_0x460b36['attributes']=_[_0xb85c('0x42')](_0x198963['model'],qs[_0xb85c('0x44')](_0x11719e[_0xb85c('0x3f')][_0xb85c('0x44')]));_0x460b36[_0xb85c('0x43')]=_0x460b36['attributes'][_0xb85c('0x45')]?_0x460b36[_0xb85c('0x43')]:_0x198963[_0xb85c('0x3e')];_0x460b36[_0xb85c('0x48')]=qs[_0xb85c('0x49')](_0x11719e[_0xb85c('0x3f')][_0xb85c('0x49')]);_0x460b36['where']=qs['filters'](_[_0xb85c('0x65')](_0x11719e['query'],_0x198963['filters']));if(_0x11719e[_0xb85c('0x3f')][_0xb85c('0x4b')]){_0x460b36[_0xb85c('0x4a')]=_[_0xb85c('0x4c')](_0x460b36[_0xb85c('0x4a')],{'$or':_[_0xb85c('0x3b')](_0x460b36[_0xb85c('0x43')],function(_0x189cd6){var _0x54b533={};_0x54b533[_0x189cd6]={'$like':'%'+_0x11719e[_0xb85c('0x3f')][_0xb85c('0x4b')]+'%'};return _0x54b533;})});}_0x460b36=_[_0xb85c('0x4c')]({},_0x460b36,_0x11719e['options']);return _0x59d236[_0xb85c('0xb0')](_0x460b36);}})['then'](function(_0x453131){if(_0x453131){_0x2b498b=_0x453131[_0xb85c('0x45')];if(!_0x11719e[_0xb85c('0x3f')][_0xb85c('0x46')](_0xb85c('0x47'))){_0x460b36[_0xb85c('0x31')]=qs['limit'](_0x11719e['query'][_0xb85c('0x31')]);_0x460b36[_0xb85c('0x2e')]=qs[_0xb85c('0x2e')](_0x11719e['query'][_0xb85c('0x2e')]);}return _0x59d236[_0xb85c('0xb0')](_0x460b36);}})['then'](function(_0x19aac4){if(_0x19aac4){return _0x19aac4?{'count':_0x2b498b,'rows':_0x19aac4}:null;}})[_0xb85c('0x20')](respondWithResult(_0x148ace,null))[_0xb85c('0x52')](handleError(_0x148ace,null));};exports[_0xb85c('0xb1')]=function(_0x4e46d7,_0x394bac,_0x244d74){var _0x37a13a={'raw':![],'where':{}};var _0x4d7c63={};var _0x483189={'count':0x0,'rows':[]};return db[_0xb85c('0x4f')]['findOne']({'where':{'id':_0x4e46d7[_0xb85c('0x53')]['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x394bac,null))[_0xb85c('0x20')](function(_0x38eee0){if(_0x38eee0){_0x4d7c63[_0xb85c('0x3e')]=_[_0xb85c('0x40')](db[_0xb85c('0x98')][_0xb85c('0x55')]);_0x4d7c63[_0xb85c('0x3f')]=_['keys'](_0x4e46d7[_0xb85c('0x3f')]);_0x4d7c63['filters']=_[_0xb85c('0x42')](_0x4d7c63['model'],_0x4d7c63[_0xb85c('0x3f')]);_0x37a13a[_0xb85c('0x43')]=_[_0xb85c('0x42')](_0x4d7c63[_0xb85c('0x3e')],qs[_0xb85c('0x44')](_0x4e46d7[_0xb85c('0x3f')][_0xb85c('0x44')]));_0x37a13a[_0xb85c('0x43')]=_0x37a13a[_0xb85c('0x43')][_0xb85c('0x45')]?_0x37a13a[_0xb85c('0x43')]:_0x4d7c63['model'];if(!_0x4e46d7[_0xb85c('0x3f')]['hasOwnProperty']('nolimit')){_0x37a13a[_0xb85c('0x31')]=qs['limit'](_0x4e46d7['query'][_0xb85c('0x31')]);_0x37a13a['offset']=qs[_0xb85c('0x2e')](_0x4e46d7['query'][_0xb85c('0x2e')]);}_0x37a13a[_0xb85c('0x48')]=qs[_0xb85c('0x49')](_0x4e46d7[_0xb85c('0x3f')]['sort']);_0x37a13a[_0xb85c('0x4a')]=qs['filters'](_[_0xb85c('0x65')](_0x4e46d7[_0xb85c('0x3f')],_0x4d7c63[_0xb85c('0x41')]));_0x37a13a[_0xb85c('0x4a')][_0xb85c('0x66')]=_0x38eee0['id'];if(_0x4e46d7[_0xb85c('0x3f')][_0xb85c('0x4b')]){_0x37a13a[_0xb85c('0x4a')]=_[_0xb85c('0x4c')](_0x37a13a['where'],{'$or':_[_0xb85c('0x3b')](_0x37a13a[_0xb85c('0x43')],function(_0x35b40c){var _0x565cd2={};_0x565cd2[_0x35b40c]={'$like':'%'+_0x4e46d7[_0xb85c('0x3f')]['filter']+'%'};return _0x565cd2;})});}_0x37a13a=_[_0xb85c('0x4c')]({},_0x37a13a,_0x4e46d7[_0xb85c('0x4e')]);return db[_0xb85c('0x98')][_0xb85c('0x30')]({'where':_0x37a13a[_0xb85c('0x4a')]})[_0xb85c('0x20')](function(_0x1b819c){_0x483189[_0xb85c('0x30')]=_0x1b819c;if(_0x4e46d7[_0xb85c('0x3f')][_0xb85c('0x56')]){_0x37a13a[_0xb85c('0x50')]=[{'model':db['CmContact'],'as':_0xb85c('0xb2'),'required':![]},{'model':db[_0xb85c('0xb3')],'as':_0xb85c('0xb4'),'attributes':['name',_0xb85c('0xb5'),_0xb85c('0xb6')],'required':![]},{'model':db[_0xb85c('0xb7')],'as':_0xb85c('0xb8'),'attributes':['id',_0xb85c('0x37'),_0xb85c('0xb9')],'where':_0x4e46d7[_0xb85c('0x3f')][_0xb85c('0xba')]?{'id':_0x4e46d7[_0xb85c('0x3f')][_0xb85c('0xba')]}:undefined,'required':_0x4e46d7[_0xb85c('0x3f')][_0xb85c('0xba')]?!![]:![]}];}return db[_0xb85c('0x98')]['findAll'](_0x37a13a);})['then'](function(_0x10bef9){_0x483189[_0xb85c('0x6b')]=_0x10bef9;return _0x483189;});}})[_0xb85c('0x20')](respondWithFilteredResult(_0x394bac,_0x37a13a))['catch'](handleError(_0x394bac,null));};exports[_0xb85c('0x38')]=function(_0x333115,_0x4d2c82,_0x4cf14e){var _0x29cf58,_0xd0b4da,_0x54444c;if(_[_0xb85c('0x8d')](_0x333115['body'][_0xb85c('0x60')])||_0x333115[_0xb85c('0x60')][_0xb85c('0x60')]===''){throw new db[(_0xb85c('0x74'))][(_0xb85c('0x75'))](_0xb85c('0xbb'));}if(_[_0xb85c('0x8d')](_0x333115[_0xb85c('0x60')]['to'])){throw new db['Sequelize'][(_0xb85c('0x75'))](_0xb85c('0xbc'));}_0x29cf58=_0x333115[_0xb85c('0x60')]['to'];return db[_0xb85c('0x4f')][_0xb85c('0x57')]({'where':{'id':_0x333115[_0xb85c('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0xb85c('0xbd'),'include':[{'model':db['CmContact'],'as':_0xb85c('0x95'),'where':{'mobile':_0x29cf58},'limit':0x1,'order':[[_0xb85c('0x78'),_0xb85c('0xbe')]]}]}]})[_0xb85c('0x20')](handleEntityNotFound(_0x4d2c82,null))[_0xb85c('0x20')](function(_0x3b901c){if(_0x3b901c&&_0x3b901c[_0xb85c('0xbd')]){_0xd0b4da=_0x3b901c['get']({'plain':!![]});if(_0xd0b4da[_0xb85c('0xbd')]&&_0xd0b4da['List'][_0xb85c('0x95')][_0xb85c('0x45')]){return _0xd0b4da[_0xb85c('0xbd')][_0xb85c('0x95')][0x0];}return db['CmContact'][_0xb85c('0x58')](_[_0xb85c('0xbf')](_0x333115['body'],{'firstName':_0x29cf58,'mobile':_0x29cf58,'phone':_0x29cf58,'ListId':_0xd0b4da['ListId']}));}})[_0xb85c('0x20')](handleEntityNotFound(_0x4d2c82,null))[_0xb85c('0x20')](function(_0x1dea6a){if(_0x1dea6a){_0x54444c=_0x1dea6a;return db['SmsInteraction'][_0xb85c('0x57')]({'where':{'ContactId':_0x54444c['id'],'closed':![],'SmsAccountId':_0xd0b4da['id']}})[_0xb85c('0x20')](function(_0x1f664b){if(_0x1f664b){return[_0x1f664b,![]];}return db[_0xb85c('0x98')]['create']({'UserId':_0x333115[_0xb85c('0x5b')]['id'],'ContactId':_0x54444c['id'],'SmsAccountId':_0xd0b4da['id'],'phone':_0x29cf58,'firstMsgDirection':'out','Messages':[_[_0xb85c('0x4c')](_0x333115[_0xb85c('0x60')],{'read':![],'body':_0x333115[_0xb85c('0x60')][_0xb85c('0x60')],'phone':_0x29cf58,'SmsAccountId':_0xd0b4da['id'],'UserId':_0x333115[_0xb85c('0x5b')]['id'],'ContactId':_0x54444c['id']})]},{'include':[{'model':db[_0xb85c('0x9f')],'as':'Messages'}]})['then'](function(_0x4e3119){return[_0x4e3119,!![]];});});}})[_0xb85c('0x99')](function(_0x5d148d,_0x539a5b){if(_0x539a5b){return _0x5d148d;}return db['SmsMessage'][_0xb85c('0x58')](_['merge'](_0x333115[_0xb85c('0x60')],{'read':![],'body':_0x333115['body']['body'],'phone':_0x29cf58,'SmsAccountId':_0xd0b4da['id'],'SmsInteractionId':_0x5d148d['id'],'UserId':_0x333115[_0xb85c('0x5b')]['id'],'ContactId':_0x54444c['id']}))['then'](function(_0xe15436){_0x5d148d['dataValues']['Messages']=[];_0x5d148d[_0xb85c('0xc0')]['Messages']['push'](_0xe15436[_0xb85c('0xc0')]);return _0x5d148d;});})[_0xb85c('0x20')](respondWithResult(_0x4d2c82,null))[_0xb85c('0x52')](handleError(_0x4d2c82,null));};exports[_0xb85c('0x2b')]=function(_0x4fad9a,_0x59e1bc,_0x5e340b){if(_0x4fad9a[_0xb85c('0x60')]['id']){delete _0x4fad9a[_0xb85c('0x60')]['id'];}var _0x41d398,_0x5dd068,_0x29adcb;return db[_0xb85c('0x4f')][_0xb85c('0x57')]({'where':{'id':_0x4fad9a['params']['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x59e1bc,null))[_0xb85c('0x20')](function(_0x3d8eba){if(_0x3d8eba){_0x29adcb=_0x3d8eba;logger['debug'](_0xb85c('0xc1'),_0xb85c('0x2b'),_0xb85c('0xc2'),_0x3d8eba['type'],util['inspect'](_0x4fad9a[_0xb85c('0x60')],{'showHidden':![],'depth':null}));switch(_0x3d8eba[_0xb85c('0x3d')]){case _0xb85c('0x80'):if(_0x4fad9a['body'][_0xb85c('0xc3')]&&_0x4fad9a[_0xb85c('0x60')][_0xb85c('0x2b')]){_0x5dd068=_0x4fad9a[_0xb85c('0x60')][_0xb85c('0x2b')];return db[_0xb85c('0x9f')][_0xb85c('0x57')]({'where':{'messageId':_0x4fad9a[_0xb85c('0x60')][_0xb85c('0xc3')]}});}break;case _0xb85c('0x82'):if(_0x4fad9a['body'][_0xb85c('0xc4')]&&_0x4fad9a['body'][_0xb85c('0xc5')]){_0x5dd068=_0x4fad9a[_0xb85c('0x60')][_0xb85c('0xc5')];return db[_0xb85c('0x9f')][_0xb85c('0x57')]({'where':{'messageId':_0x4fad9a[_0xb85c('0x60')][_0xb85c('0xc4')]}});}break;case _0xb85c('0x83'):if(_0x4fad9a[_0xb85c('0x60')]['message_id']&&_0x4fad9a['body'][_0xb85c('0xc6')]){_0x5dd068=_0x4fad9a[_0xb85c('0x60')][_0xb85c('0xc6')];return db[_0xb85c('0x9f')][_0xb85c('0x57')]({'where':{'messageId':_0x4fad9a[_0xb85c('0x60')]['message_id']}});}break;case'infobip':var _0x3b40da=_0x4fad9a[_0xb85c('0x60')][_0xb85c('0x86')][0x0];if(_0x3b40da[_0xb85c('0x7e')]&&_0x3b40da[_0xb85c('0x2b')][_0xb85c('0xc7')]===_0xb85c('0xc8')){_0x5dd068=_0x3b40da['status']['groupName'];return db['SmsMessage']['find']({'where':{'messageId':_0x3b40da[_0xb85c('0x7e')]}});}break;case'clickatell':if(_0x4fad9a['body'][_0xb85c('0x7e')]&&_0x4fad9a['body']['status']){_0x5dd068=_0x4fad9a[_0xb85c('0x60')][_0xb85c('0x2b')];return db[_0xb85c('0x9f')][_0xb85c('0x57')]({'where':{'messageId':_0x4fad9a['body'][_0xb85c('0x7e')]}});}break;case _0xb85c('0x8c'):if(_0x4fad9a[_0xb85c('0x60')][0x0][_0xb85c('0x28')]['id']){_0x5dd068=_0x4fad9a[_0xb85c('0x60')][0x0][_0xb85c('0x3d')];return db[_0xb85c('0x9f')][_0xb85c('0x57')]({'where':{'messageId':_0x4fad9a['body'][0x0][_0xb85c('0x28')]['id']}});}break;case _0xb85c('0xc9'):if(_0x4fad9a[_0xb85c('0x60')]['redif']&&_0x4fad9a[_0xb85c('0x60')][_0xb85c('0x2b')]){_0x5dd068=_0x4fad9a[_0xb85c('0x60')][_0xb85c('0x2b')];return db[_0xb85c('0x9f')][_0xb85c('0x57')]({'where':{'messageId':_0x4fad9a[_0xb85c('0x60')][_0xb85c('0xca')]}});}break;}}})[_0xb85c('0x20')](handleEntityNotFound(_0x59e1bc,null))['then'](function(_0x21b1a0){if(_0x21b1a0){_0x41d398=_0x21b1a0;switch(_0x29adcb[_0xb85c('0x3d')]){case'skebby':if(_0x5dd068===_0xb85c('0xc8')){return _0x41d398[_0xb85c('0x5f')]({'read':!![]});}else{logger[_0xb85c('0x26')](_0xb85c('0xc1'),_0xb85c('0x2b'),'skebby',util[_0xb85c('0xcb')](_0x4fad9a[_0xb85c('0x60')],{'showHidden':![],'depth':null}));}break;case _0xb85c('0x82'):if(_0x5dd068==='1'){return _0x41d398[_0xb85c('0x5f')]({'read':!![]});}else{logger['error'](_0xb85c('0xc1'),'status',_0xb85c('0x80'),util['inspect'](_0x4fad9a['body'],{'showHidden':![],'depth':null}));}break;case _0xb85c('0x83'):if(!_0x4fad9a[_0xb85c('0x60')][_0xb85c('0xcc')]&&_0x5dd068>=0xc8&&_0x5dd068<=0xce){return _0x41d398[_0xb85c('0x5f')]({'read':!![]});}else{logger['error'](_0xb85c('0xc1'),_0xb85c('0x2b'),_0xb85c('0x83'),util[_0xb85c('0xcb')](_0x4fad9a[_0xb85c('0x60')],{'showHidden':![],'depth':null}));}break;case _0xb85c('0xcd'):var _0x4397b2=_0x4fad9a[_0xb85c('0x60')][_0xb85c('0x86')][0x0];if(_0x4397b2[_0xb85c('0x2b')][_0xb85c('0xc7')]===_0xb85c('0xc8')){return _0x41d398['update']({'read':!![]});}else{logger[_0xb85c('0x26')](_0xb85c('0xc1'),_0xb85c('0x2b'),_0xb85c('0xcd'),util[_0xb85c('0xcb')](_0x4fad9a[_0xb85c('0x60')],{'showHidden':![],'depth':null}));}break;case _0xb85c('0x89'):if(_0x5dd068==_0xb85c('0xce')||_0x5dd068==_0xb85c('0xcf')){return _0x41d398[_0xb85c('0x5f')]({'read':!![]});}else{logger[_0xb85c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb85c('0x89'),util[_0xb85c('0xcb')](_0x4fad9a['body'],{'showHidden':![],'depth':null}));}break;case _0xb85c('0x8c'):if(_0x5dd068==_0xb85c('0xd0')){return _0x41d398['update']({'read':!![]});}else{logger[_0xb85c('0x26')](_0xb85c('0xc1'),'status',_0xb85c('0x8c'),util['inspect'](_0x4fad9a[_0xb85c('0x60')],{'showHidden':![],'depth':null}));}break;case _0xb85c('0xc9'):if(_0x5dd068===_0xb85c('0xd1')||_0x5dd068===_0xb85c('0xd2')){return _0x41d398[_0xb85c('0x5f')]({'read':!![]});}else{logger[_0xb85c('0x26')](_0xb85c('0xc1'),'status',_0xb85c('0xc9'),util[_0xb85c('0xcb')](_0x4fad9a[_0xb85c('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x41d398;}})['then'](respondWithResult(_0x59e1bc,null))['catch'](handleError(_0x59e1bc,null));};exports[_0xb85c('0xd3')]=function(_0x224d4f,_0x345aa4,_0x477590){var _0x495490,_0x1406ac,_0x46ad7b;return db[_0xb85c('0x4f')][_0xb85c('0x57')]({'where':{'id':_0x224d4f[_0xb85c('0x53')]['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x345aa4,null))[_0xb85c('0x20')](function(_0x3fc688){if(_0x3fc688){_0x46ad7b=_0x3fc688;logger[_0xb85c('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb85c('0xc2'),_0x3fc688[_0xb85c('0x3d')],util[_0xb85c('0xcb')](_0x224d4f[_0xb85c('0x3f')],{'showHidden':![],'depth':null}));switch(_0x3fc688['type']){case _0xb85c('0x88'):if(_0x224d4f['query'][_0xb85c('0xd4')]&&_0x224d4f[_0xb85c('0x3f')]['state']){_0x1406ac=_0x224d4f[_0xb85c('0x3f')][_0xb85c('0xd5')];return db['SmsMessage'][_0xb85c('0x57')]({'where':{'messageId':_0x224d4f[_0xb85c('0x3f')][_0xb85c('0xd4')]}});}break;}}})[_0xb85c('0x20')](handleEntityNotFound(_0x345aa4,null))['then'](function(_0x2872aa){if(_0x2872aa){_0x495490=_0x2872aa;switch(_0x46ad7b[_0xb85c('0x3d')]){case _0xb85c('0x88'):if(_0x1406ac==='2'||_0x1406ac==='6'){return _0x495490[_0xb85c('0x5f')]({'read':!![]});}else{logger['error'](_0xb85c('0xc1'),'status',_0xb85c('0x88'),util[_0xb85c('0xcb')](_0x224d4f[_0xb85c('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x495490;}})['then'](respondWithResult(_0x345aa4,null))[_0xb85c('0x52')](handleError(_0x345aa4,null));};exports[_0xb85c('0xd6')]=function(_0x4e0f7c,_0x11246c,_0x410783){return db[_0xb85c('0x4f')][_0xb85c('0x57')]({'where':{'id':_0x4e0f7c[_0xb85c('0x53')]['id']}})['then'](handleEntityNotFound(_0x11246c,null))[_0xb85c('0x20')](function(_0xe80ce1){if(_0xe80ce1){return _0xe80ce1[_0xb85c('0xd6')](_0x4e0f7c['body']['ids'],_[_0xb85c('0x96')](_0x4e0f7c['body'],[_0xb85c('0x68'),'id'])||{})[_0xb85c('0x99')](function(_0x23e53f){for(var _0x43114c=0x0;_0x43114c<_0x4e0f7c[_0xb85c('0x60')][_0xb85c('0x68')][_0xb85c('0x45')];_0x43114c+=0x1){socket[_0xb85c('0xd7')](_0xb85c('0xd8'),{'UserId':Number(_0x4e0f7c[_0xb85c('0x60')][_0xb85c('0x68')][_0x43114c]),'SmsAccountId':Number(_0x4e0f7c[_0xb85c('0x53')]['id'])});}return _0x23e53f;});}})[_0xb85c('0x20')](respondWithResult(_0x11246c,null))[_0xb85c('0x52')](handleError(_0x11246c,null));};exports[_0xb85c('0xd9')]=function(_0x23901a,_0x405ac7,_0x190bcf){return db['SmsAccount']['find']({'where':{'id':_0x23901a[_0xb85c('0x53')]['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x405ac7,null))[_0xb85c('0x20')](function(_0xa57458){if(_0xa57458){return _0xa57458[_0xb85c('0xd9')](_0x23901a[_0xb85c('0x3f')][_0xb85c('0x68')])[_0xb85c('0x20')](function(){if(_[_0xb85c('0xda')](_0x23901a[_0xb85c('0x3f')][_0xb85c('0x68')])){for(var _0x3fff6c=0x0;_0x3fff6c<_0x23901a[_0xb85c('0x3f')][_0xb85c('0x68')][_0xb85c('0x45')];_0x3fff6c+=0x1){socket['emit'](_0xb85c('0xdb'),{'UserId':Number(_0x23901a[_0xb85c('0x3f')]['ids'][_0x3fff6c]),'SmsAccountId':Number(_0x23901a[_0xb85c('0x53')]['id'])});}}else{socket['emit'](_0xb85c('0xdb'),{'UserId':Number(_0x23901a[_0xb85c('0x3f')]['ids']),'SmsAccountId':Number(_0x23901a[_0xb85c('0x53')]['id'])});}});}})[_0xb85c('0x20')](respondWithStatusCode(_0x405ac7,null))[_0xb85c('0x52')](handleError(_0x405ac7,null));};exports[_0xb85c('0xdc')]=function(_0x59175b,_0x1919ef,_0xb484d1){var _0x569a77={};var _0x586a1c={};var _0x32fd3e;var _0x2071df;return db[_0xb85c('0x4f')][_0xb85c('0x64')]({'where':{'id':_0x59175b[_0xb85c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1919ef,null))['then'](function(_0x42f0da){if(_0x42f0da){_0x32fd3e=_0x42f0da;_0x586a1c[_0xb85c('0x3e')]=_['keys'](db[_0xb85c('0xb3')][_0xb85c('0x55')]);_0x586a1c['query']=_['keys'](_0x59175b['query']);_0x586a1c[_0xb85c('0x41')]=_[_0xb85c('0x42')](_0x586a1c[_0xb85c('0x3e')],_0x586a1c[_0xb85c('0x3f')]);_0x569a77['attributes']=_[_0xb85c('0x42')](_0x586a1c[_0xb85c('0x3e')],qs[_0xb85c('0x44')](_0x59175b['query'][_0xb85c('0x44')]));_0x569a77[_0xb85c('0x43')]=_0x569a77['attributes'][_0xb85c('0x45')]?_0x569a77[_0xb85c('0x43')]:_0x586a1c[_0xb85c('0x3e')];_0x569a77[_0xb85c('0x48')]=qs['sort'](_0x59175b[_0xb85c('0x3f')]['sort']);_0x569a77[_0xb85c('0x4a')]=qs[_0xb85c('0x41')](_[_0xb85c('0x65')](_0x59175b[_0xb85c('0x3f')],_0x586a1c[_0xb85c('0x41')]));if(_0x59175b['query'][_0xb85c('0x4b')]){_0x569a77[_0xb85c('0x4a')]=_[_0xb85c('0x4c')](_0x569a77[_0xb85c('0x4a')],{'$or':_[_0xb85c('0x3b')](_0x569a77['attributes'],function(_0x100954){var _0x409fd0={};_0x409fd0[_0x100954]={'$like':'%'+_0x59175b[_0xb85c('0x3f')][_0xb85c('0x4b')]+'%'};return _0x409fd0;})});}_0x569a77=_[_0xb85c('0x4c')]({},_0x569a77,_0x59175b[_0xb85c('0x4e')]);return _0x32fd3e['getAgents'](_0x569a77);}})[_0xb85c('0x20')](function(_0x150ea8){if(_0x150ea8){_0x2071df=_0x150ea8['length'];if(!_0x59175b[_0xb85c('0x3f')]['hasOwnProperty']('nolimit')){_0x569a77[_0xb85c('0x31')]=qs[_0xb85c('0x31')](_0x59175b[_0xb85c('0x3f')][_0xb85c('0x31')]);_0x569a77['offset']=qs[_0xb85c('0x2e')](_0x59175b[_0xb85c('0x3f')][_0xb85c('0x2e')]);}return _0x32fd3e[_0xb85c('0xdc')](_0x569a77);}})[_0xb85c('0x20')](function(_0x178a17){if(_0x178a17){return _0x178a17?{'count':_0x2071df,'rows':_0x178a17}:null;}})[_0xb85c('0x20')](respondWithResult(_0x1919ef,null))[_0xb85c('0x52')](handleError(_0x1919ef,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 4f52bd1..3dc8a36 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 _0xa7f3=['events','../../mysqldb','remove','emit','hasOwnProperty','hook','exports'];(function(_0x26f30e,_0x531319){var _0x3072ab=function(_0x421299){while(--_0x421299){_0x26f30e['push'](_0x26f30e['shift']());}};_0x3072ab(++_0x531319);}(_0xa7f3,0x165));var _0x3a7f=function(_0x4a4fc9,_0x4acc29){_0x4a4fc9=_0x4a4fc9-0x0;var _0x322e30=_0xa7f3[_0x4a4fc9];return _0x322e30;};'use strict';var EventEmitter=require(_0x3a7f('0x0'));var SmsAccount=require(_0x3a7f('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3a7f('0x2')};function emitEvent(_0x46b99c){return function(_0x16c8f7,_0x2264df,_0x207cab){SmsAccountEvents[_0x3a7f('0x3')](_0x46b99c+':'+_0x16c8f7['id'],_0x16c8f7);SmsAccountEvents[_0x3a7f('0x3')](_0x46b99c,_0x16c8f7);_0x207cab(null);};}for(var e in events){if(events[_0x3a7f('0x4')](e)){var event=events[e];SmsAccount[_0x3a7f('0x5')](e,emitEvent(event));}}module[_0x3a7f('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x213a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount'];(function(_0x1bc5ce,_0xb03b3a){var _0x3d2d0d=function(_0xdb6a46){while(--_0xdb6a46){_0x1bc5ce['push'](_0x1bc5ce['shift']());}};_0x3d2d0d(++_0xb03b3a);}(_0x213a,0xd9));var _0xa213=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x213a[_0x3e44fa];return _0x2a0aba;};'use strict';var EventEmitter=require(_0xa213('0x0'));var SmsAccount=require(_0xa213('0x1'))['db'][_0xa213('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa213('0x3')](0x0);var events={'afterCreate':_0xa213('0x4'),'afterUpdate':_0xa213('0x5'),'afterDestroy':_0xa213('0x6')};function emitEvent(_0x249107){return function(_0x397b19,_0x58f0e1,_0x2dd533){SmsAccountEvents[_0xa213('0x7')](_0x249107+':'+_0x397b19['id'],_0x397b19);SmsAccountEvents[_0xa213('0x7')](_0x249107,_0x397b19);_0x2dd533(null);};}for(var e in events){if(events[_0xa213('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xa213('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e4ef9f6..66882cc 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 _0x3948=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','SmsAccount','sms_accounts','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3948,0x6c));var _0x8394=function(_0x4a0f76,_0x2428cb){_0x4a0f76=_0x4a0f76-0x0;var _0x13f003=_0x3948[_0x4a0f76];return _0x13f003;};'use strict';var _=require(_0x8394('0x0'));var util=require(_0x8394('0x1'));var logger=require(_0x8394('0x2'))(_0x8394('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8394('0x4'));var fs=require('fs');var path=require(_0x8394('0x5'));var rimraf=require(_0x8394('0x6'));var config=require(_0x8394('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x50fc5a,_0x168fad){return _0x50fc5a['define'](_0x8394('0x8'),attributes,{'tableName':_0x8394('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfc3=['moment','request-promise','path','rimraf','../../config/environment','SmsAccount','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdfc3,0x6e));var _0x3dfc=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xdfc3[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x3dfc('0x0'));var util=require(_0x3dfc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3dfc('0x2'));var BPromise=require('bluebird');var rp=require(_0x3dfc('0x3'));var fs=require('fs');var path=require(_0x3dfc('0x4'));var rimraf=require(_0x3dfc('0x5'));var config=require(_0x3dfc('0x6'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x160146,_0x5bb863){return _0x160146['define'](_0x3dfc('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index fd21189..c884ce1 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 _0x88cb=['SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','./smsAccount.socket','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x3fd422,_0x58f7e3){var _0x12cf51=function(_0x613b5e){while(--_0x613b5e){_0x3fd422['push'](_0x3fd422['shift']());}};_0x12cf51(++_0x58f7e3);}(_0x88cb,0x162));var _0xb88c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x88cb[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xb88c('0x0'));var util=require(_0xb88c('0x1'));var moment=require('moment');var BPromise=require(_0xb88c('0x2'));var rs=require(_0xb88c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb88c('0x4'))['db'];var utils=require(_0xb88c('0x5'));var logger=require(_0xb88c('0x6'))(_0xb88c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb88c('0x8'));var client=jayson['client'][_0xb88c('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb88c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb88c('0xb'))(new Redis(config['redis']));require(_0xb88c('0xc'))['register'](socket);function respondWithRpcPromise(_0xe9e670,_0x452af2,_0x217b7b){return new BPromise(function(_0x5de089,_0x26adc5){return client[_0xb88c('0xd')](_0xe9e670,_0x217b7b)['then'](function(_0x3553df){logger[_0xb88c('0xe')]('SmsAccount,\x20%s,\x20%s',_0x452af2,_0xb88c('0xf'));logger[_0xb88c('0x10')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x452af2,_0xb88c('0xf'),JSON[_0xb88c('0x11')](_0x3553df));if(_0x3553df[_0xb88c('0x12')]){if(_0x3553df['error'][_0xb88c('0x13')]===0x1f4){logger[_0xb88c('0x12')](_0xb88c('0x14'),_0x452af2,_0x3553df['error'][_0xb88c('0x15')]);return _0x26adc5(_0x3553df[_0xb88c('0x12')][_0xb88c('0x15')]);}logger[_0xb88c('0x12')](_0xb88c('0x14'),_0x452af2,_0x3553df[_0xb88c('0x12')]['message']);return _0x5de089(_0x3553df[_0xb88c('0x12')][_0xb88c('0x15')]);}else{logger[_0xb88c('0xe')]('SmsAccount,\x20%s,\x20%s',_0x452af2,'request\x20sent');_0x5de089(_0x3553df[_0xb88c('0x16')][_0xb88c('0x15')]);}})[_0xb88c('0x17')](function(_0x3a4ebd){logger[_0xb88c('0x12')](_0xb88c('0x14'),_0x452af2,_0x3a4ebd);_0x26adc5(_0x3a4ebd);});});}exports[_0xb88c('0x18')]=function(_0x3faf19){var _0x5b99da=this;return new Promise(function(_0x35d29d,_0x387f47){return db['SmsAccount'][_0xb88c('0x19')]({'raw':_0x3faf19[_0xb88c('0x1a')]?_0x3faf19[_0xb88c('0x1a')][_0xb88c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3faf19[_0xb88c('0x1a')]?_0x3faf19['options'][_0xb88c('0x1c')]||null:null,'attributes':_0x3faf19[_0xb88c('0x1a')]?_0x3faf19['options'][_0xb88c('0x1d')]||null:null,'include':_0x3faf19['options']?_0x3faf19[_0xb88c('0x1a')][_0xb88c('0x1e')]?_[_0xb88c('0x1f')](_0x3faf19['options'][_0xb88c('0x1e')],function(_0x51452a){return{'model':db[_0x51452a[_0xb88c('0x20')]],'as':_0x51452a['as'],'attributes':_0x51452a[_0xb88c('0x1d')],'include':_0x51452a['include']?_[_0xb88c('0x1f')](_0x51452a[_0xb88c('0x1e')],function(_0x4c8866){return{'model':db[_0x4c8866[_0xb88c('0x20')]],'as':_0x4c8866['as'],'attributes':_0x4c8866[_0xb88c('0x1d')],'include':_0x4c8866[_0xb88c('0x1e')]?_[_0xb88c('0x1f')](_0x4c8866['include'],function(_0xfa1cc1){return{'model':db[_0xfa1cc1[_0xb88c('0x20')]],'as':_0xfa1cc1['as'],'attributes':_0xfa1cc1['attributes']};}):[]};}):[]};}):[]:[]})[_0xb88c('0x21')](function(_0x1d893c){logger[_0xb88c('0xe')](_0xb88c('0x18'),_0x3faf19);logger[_0xb88c('0x10')]('ShowSmsAccount',_0x3faf19,JSON[_0xb88c('0x11')](_0x1d893c));_0x35d29d(_0x1d893c);})[_0xb88c('0x17')](function(_0x3eba32){logger[_0xb88c('0x12')](_0xb88c('0x18'),_0x3eba32[_0xb88c('0x15')],_0x3faf19);_0x387f47(_0x5b99da['error'](0x1f4,_0x3eba32['message']));});});}; \ No newline at end of file +var _0x30d8=['socket.io-emitter','./smsAccount.socket','register','request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','attributes','include','map','model','then','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x503c18,_0x1a4116){var _0x163467=function(_0x4df39b){while(--_0x4df39b){_0x503c18['push'](_0x503c18['shift']());}};_0x163467(++_0x1a4116);}(_0x30d8,0x140));var _0x830d=function(_0x3f7737,_0x505a19){_0x3f7737=_0x3f7737-0x0;var _0x5108ca=_0x30d8[_0x3f7737];return _0x5108ca;};'use strict';var _=require('lodash');var util=require(_0x830d('0x0'));var moment=require(_0x830d('0x1'));var BPromise=require(_0x830d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x830d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x830d('0x4'))(_0x830d('0x5'));var config=require(_0x830d('0x6'));var jayson=require(_0x830d('0x7'));var client=jayson[_0x830d('0x8')][_0x830d('0x9')]({'port':0x232a});config[_0x830d('0xa')]=_[_0x830d('0xb')](config[_0x830d('0xa')],{'host':_0x830d('0xc'),'port':0x18eb});var socket=require(_0x830d('0xd'))(new Redis(config[_0x830d('0xa')]));require(_0x830d('0xe'))[_0x830d('0xf')](socket);function respondWithRpcPromise(_0x2613cf,_0x52ffd2,_0x1f1d3d){return new BPromise(function(_0x4a1318,_0x126ac8){return client[_0x830d('0x10')](_0x2613cf,_0x1f1d3d)['then'](function(_0x2927d5){logger[_0x830d('0x11')]('SmsAccount,\x20%s,\x20%s',_0x52ffd2,_0x830d('0x12'));logger[_0x830d('0x13')](_0x830d('0x14'),_0x52ffd2,'request\x20sent',JSON['stringify'](_0x2927d5));if(_0x2927d5[_0x830d('0x15')]){if(_0x2927d5[_0x830d('0x15')][_0x830d('0x16')]===0x1f4){logger[_0x830d('0x15')]('SmsAccount,\x20%s,\x20%s',_0x52ffd2,_0x2927d5[_0x830d('0x15')][_0x830d('0x17')]);return _0x126ac8(_0x2927d5[_0x830d('0x15')][_0x830d('0x17')]);}logger[_0x830d('0x15')](_0x830d('0x18'),_0x52ffd2,_0x2927d5[_0x830d('0x15')]['message']);return _0x4a1318(_0x2927d5[_0x830d('0x15')][_0x830d('0x17')]);}else{logger['info'](_0x830d('0x18'),_0x52ffd2,_0x830d('0x12'));_0x4a1318(_0x2927d5[_0x830d('0x19')][_0x830d('0x17')]);}})[_0x830d('0x1a')](function(_0x252a26){logger['error'](_0x830d('0x18'),_0x52ffd2,_0x252a26);_0x126ac8(_0x252a26);});});}exports[_0x830d('0x1b')]=function(_0xd60a5f){var _0x2d5835=this;return new Promise(function(_0x2bdd34,_0x1761ec){return db[_0x830d('0x1c')][_0x830d('0x1d')]({'raw':_0xd60a5f['options']?_0xd60a5f['options'][_0x830d('0x1e')]===undefined?!![]:![]:!![],'where':_0xd60a5f[_0x830d('0x1f')]?_0xd60a5f[_0x830d('0x1f')]['where']||null:null,'attributes':_0xd60a5f[_0x830d('0x1f')]?_0xd60a5f[_0x830d('0x1f')][_0x830d('0x20')]||null:null,'include':_0xd60a5f[_0x830d('0x1f')]?_0xd60a5f['options'][_0x830d('0x21')]?_[_0x830d('0x22')](_0xd60a5f[_0x830d('0x1f')][_0x830d('0x21')],function(_0x3c243e){return{'model':db[_0x3c243e[_0x830d('0x23')]],'as':_0x3c243e['as'],'attributes':_0x3c243e[_0x830d('0x20')],'include':_0x3c243e[_0x830d('0x21')]?_[_0x830d('0x22')](_0x3c243e[_0x830d('0x21')],function(_0x1383c6){return{'model':db[_0x1383c6[_0x830d('0x23')]],'as':_0x1383c6['as'],'attributes':_0x1383c6[_0x830d('0x20')],'include':_0x1383c6[_0x830d('0x21')]?_['map'](_0x1383c6['include'],function(_0x5885c8){return{'model':db[_0x5885c8['model']],'as':_0x5885c8['as'],'attributes':_0x5885c8['attributes']};}):[]};}):[]};}):[]:[]})[_0x830d('0x24')](function(_0x4eba9a){logger[_0x830d('0x11')](_0x830d('0x1b'),_0xd60a5f);logger[_0x830d('0x13')](_0x830d('0x1b'),_0xd60a5f,JSON['stringify'](_0x4eba9a));_0x2bdd34(_0x4eba9a);})[_0x830d('0x1a')](function(_0x18443a){logger[_0x830d('0x15')]('ShowSmsAccount',_0x18443a[_0x830d('0x17')],_0xd60a5f);_0x1761ec(_0x2d5835[_0x830d('0x15')](0x1f4,_0x18443a[_0x830d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index bfa756d..b1e668c 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 59bdf53..e8a198e 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x810309,_0x39cd87){var _0x501f13=function(_0x49fb8a){while(--_0x49fb8a){_0x810309['push'](_0x810309['shift']());}};_0x501f13(++_0x39cd87);}(_0x008c,0x188));var _0xc008=function(_0x251fde,_0x384469){_0x251fde=_0x251fde-0x0;var _0x350af6=_0x008c[_0x251fde];return _0x350af6;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x555357,_0x39c51f){var _0x5bed46=function(_0x43515f){while(--_0x43515f){_0x555357['push'](_0x555357['shift']());}};_0x5bed46(++_0x39c51f);}(_0x008c,0x188));var _0xc008=function(_0x554292,_0x82948a){_0x554292=_0x554292-0x0;var _0x3dd555=_0x008c[_0x554292];return _0x3dd555;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b5273d5..ad81ad4 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 _0x454b=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x2637d8,_0x5c1b04){var _0x580be0=function(_0x5a3811){while(--_0x5a3811){_0x2637d8['push'](_0x2637d8['shift']());}};_0x580be0(++_0x5c1b04);}(_0x454b,0x19c));var _0xb454=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x454b[_0x236d24];return _0x1574cf;};'use strict';var Sequelize=require(_0xb454('0x0'));module[_0xb454('0x1')]={'priority':{'type':Sequelize[_0xb454('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb454('0x3')],'allowNull':![],'defaultValue':_0xb454('0x4')},'appdata':{'type':Sequelize[_0xb454('0x5')]()},'description':{'type':Sequelize[_0xb454('0x3')]},'interval':{'type':Sequelize[_0xb454('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe2b2=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe2b2,0xcf));var _0x2e2b=function(_0x1eb3f4,_0x416e65){_0x1eb3f4=_0x1eb3f4-0x0;var _0x293ce4=_0xe2b2[_0x1eb3f4];return _0x293ce4;};'use strict';var Sequelize=require(_0x2e2b('0x0'));module[_0x2e2b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2e2b('0x2')],'allowNull':![],'defaultValue':_0x2e2b('0x3')},'appdata':{'type':Sequelize[_0x2e2b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2e2b('0x2')],'defaultValue':_0x2e2b('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6072b71..1a86702 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 _0xc9e2=['body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','error','name','send','rawAttributes','type','key','map','query','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','SmsApplication','findAll','rows','catch','show','params','keys','length','create'];(function(_0xead5cb,_0x390b9a){var _0xa9f499=function(_0x451615){while(--_0x451615){_0xead5cb['push'](_0xead5cb['shift']());}};_0xa9f499(++_0x390b9a);}(_0xc9e2,0x1ec));var _0x2c9e=function(_0x438e5e,_0x3f1b9e){_0x438e5e=_0x438e5e-0x0;var _0x418231=_0xc9e2[_0x438e5e];return _0x418231;};'use strict';var emlformat=require(_0x2c9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c9e('0x1'));var jsonpatch=require(_0x2c9e('0x2'));var rp=require('request-promise');var moment=require(_0x2c9e('0x3'));var BPromise=require(_0x2c9e('0x4'));var Mustache=require(_0x2c9e('0x5'));var util=require(_0x2c9e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2c9e('0x7'));var ejs=require(_0x2c9e('0x8'));var fs=require('fs');var fs_extra=require(_0x2c9e('0x9'));var _=require(_0x2c9e('0xa'));var squel=require(_0x2c9e('0xb'));var crypto=require(_0x2c9e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2c9e('0x7'));var querystring=require(_0x2c9e('0xd'));var Papa=require(_0x2c9e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c9e('0xf'));var as=require(_0x2c9e('0x10'));var hardwareService=require(_0x2c9e('0x11'));var logger=require(_0x2c9e('0x12'))(_0x2c9e('0x13'));var utils=require('../../config/utils');var config=require(_0x2c9e('0x14'));var licenseUtil=require(_0x2c9e('0x15'));var db=require(_0x2c9e('0x16'))['db'];function respondWithStatusCode(_0x176ecf,_0x4e9fd1){_0x4e9fd1=_0x4e9fd1||0xcc;return function(_0x16be82){if(_0x16be82){return _0x176ecf['sendStatus'](_0x4e9fd1);}return _0x176ecf[_0x2c9e('0x17')](_0x4e9fd1)[_0x2c9e('0x18')]();};}function respondWithResult(_0x3defb0,_0x414709){_0x414709=_0x414709||0xc8;return function(_0x2d15c1){if(_0x2d15c1){return _0x3defb0[_0x2c9e('0x17')](_0x414709)['json'](_0x2d15c1);}};}function respondWithFilteredResult(_0x567c91,_0x4d92f6){return function(_0x3806d4){if(_0x3806d4){var _0x275813=typeof _0x4d92f6[_0x2c9e('0x19')]===_0x2c9e('0x1a')&&typeof _0x4d92f6[_0x2c9e('0x1b')]===_0x2c9e('0x1a');var _0x1059a9=_0x3806d4[_0x2c9e('0x1c')];var _0x5174ca=_0x275813?0x0:_0x4d92f6[_0x2c9e('0x19')];var _0x36e96b=_0x275813?_0x3806d4[_0x2c9e('0x1c')]:_0x4d92f6[_0x2c9e('0x19')]+_0x4d92f6[_0x2c9e('0x1b')];var _0x462141;if(_0x36e96b>=_0x1059a9){_0x36e96b=_0x1059a9;_0x462141=0xc8;}else{_0x462141=0xce;}_0x567c91[_0x2c9e('0x17')](_0x462141);return _0x567c91['set'](_0x2c9e('0x1d'),_0x5174ca+'-'+_0x36e96b+'/'+_0x1059a9)[_0x2c9e('0x1e')](_0x3806d4);}return null;};}function patchUpdates(_0x1838a3){return function(_0x3cac60){try{jsonpatch['apply'](_0x3cac60,_0x1838a3,!![]);}catch(_0x129390){return BPromise[_0x2c9e('0x1f')](_0x129390);}return _0x3cac60['save']();};}function saveUpdates(_0x5c62a1,_0x2c8d39){return function(_0x45f56f){if(_0x45f56f){return _0x45f56f[_0x2c9e('0x20')](_0x5c62a1)[_0x2c9e('0x21')](function(_0x8396ff){return _0x8396ff;});}return null;};}function removeEntity(_0x10485a,_0x270fed){return function(_0x4b49b2){if(_0x4b49b2){return _0x4b49b2[_0x2c9e('0x22')]()[_0x2c9e('0x21')](function(){_0x10485a[_0x2c9e('0x17')](0xcc)[_0x2c9e('0x18')]();});}};}function handleEntityNotFound(_0x34e76d,_0x166a85){return function(_0x32dde4){if(!_0x32dde4){_0x34e76d['sendStatus'](0x194);}return _0x32dde4;};}function handleError(_0x8d83d3,_0xb59b6b){_0xb59b6b=_0xb59b6b||0x1f4;return function(_0x154e2f){logger[_0x2c9e('0x23')](_0x154e2f['stack']);if(_0x154e2f[_0x2c9e('0x24')]){delete _0x154e2f[_0x2c9e('0x24')];}_0x8d83d3[_0x2c9e('0x17')](_0xb59b6b)[_0x2c9e('0x25')](_0x154e2f);};}exports['index']=function(_0x117a8e,_0x27827a){var _0x516501={},_0xcb94d1={},_0xbf3198={'count':0x0,'rows':[]};var _0x5b344a=_['map'](db['SmsApplication'][_0x2c9e('0x26')],function(_0x4d0d5a){return{'name':_0x4d0d5a['fieldName'],'type':_0x4d0d5a[_0x2c9e('0x27')][_0x2c9e('0x28')]};});_0xcb94d1['model']=_[_0x2c9e('0x29')](_0x5b344a,'name');_0xcb94d1[_0x2c9e('0x2a')]=_['keys'](_0x117a8e[_0x2c9e('0x2a')]);_0xcb94d1[_0x2c9e('0x2b')]=_['intersection'](_0xcb94d1['model'],_0xcb94d1[_0x2c9e('0x2a')]);_0x516501[_0x2c9e('0x2c')]=_[_0x2c9e('0x2d')](_0xcb94d1['model'],qs['fields'](_0x117a8e['query'][_0x2c9e('0x2e')]));_0x516501['attributes']=_0x516501['attributes']['length']?_0x516501[_0x2c9e('0x2c')]:_0xcb94d1[_0x2c9e('0x2f')];if(!_0x117a8e['query'][_0x2c9e('0x30')](_0x2c9e('0x31'))){_0x516501[_0x2c9e('0x1b')]=qs[_0x2c9e('0x1b')](_0x117a8e[_0x2c9e('0x2a')][_0x2c9e('0x1b')]);_0x516501['offset']=qs[_0x2c9e('0x19')](_0x117a8e[_0x2c9e('0x2a')][_0x2c9e('0x19')]);}_0x516501[_0x2c9e('0x32')]=qs[_0x2c9e('0x33')](_0x117a8e[_0x2c9e('0x2a')][_0x2c9e('0x33')]);_0x516501[_0x2c9e('0x34')]=qs[_0x2c9e('0x2b')](_['pick'](_0x117a8e[_0x2c9e('0x2a')],_0xcb94d1[_0x2c9e('0x2b')]),_0x5b344a);if(_0x117a8e[_0x2c9e('0x2a')][_0x2c9e('0x35')]){_0x516501[_0x2c9e('0x34')]=_[_0x2c9e('0x36')](_0x516501[_0x2c9e('0x34')],{'$or':_[_0x2c9e('0x29')](_0x5b344a,function(_0x2f1bba){if(_0x2f1bba[_0x2c9e('0x27')]!==_0x2c9e('0x37')){var _0x3be249={};_0x3be249[_0x2f1bba['name']]={'$like':'%'+_0x117a8e[_0x2c9e('0x2a')][_0x2c9e('0x35')]+'%'};return _0x3be249;}})});}_0x516501=_[_0x2c9e('0x36')]({},_0x516501,_0x117a8e[_0x2c9e('0x38')]);var _0x1e6e96={'where':_0x516501[_0x2c9e('0x34')]};return db['SmsApplication']['count'](_0x1e6e96)[_0x2c9e('0x21')](function(_0x1ccbab){_0xbf3198[_0x2c9e('0x1c')]=_0x1ccbab;if(_0x117a8e[_0x2c9e('0x2a')][_0x2c9e('0x39')]){_0x516501[_0x2c9e('0x3a')]=[{'all':!![]}];}return db[_0x2c9e('0x3b')][_0x2c9e('0x3c')](_0x516501);})[_0x2c9e('0x21')](function(_0x1db7d5){_0xbf3198[_0x2c9e('0x3d')]=_0x1db7d5;return _0xbf3198;})[_0x2c9e('0x21')](respondWithFilteredResult(_0x27827a,_0x516501))[_0x2c9e('0x3e')](handleError(_0x27827a,null));};exports[_0x2c9e('0x3f')]=function(_0x3e0238,_0x2a6f7d){var _0x4abae4={'raw':!![],'where':{'id':_0x3e0238[_0x2c9e('0x40')]['id']}},_0x4298ce={};_0x4298ce['model']=_[_0x2c9e('0x41')](db[_0x2c9e('0x3b')]['rawAttributes']);_0x4298ce[_0x2c9e('0x2a')]=_[_0x2c9e('0x41')](_0x3e0238[_0x2c9e('0x2a')]);_0x4298ce[_0x2c9e('0x2b')]=_[_0x2c9e('0x2d')](_0x4298ce[_0x2c9e('0x2f')],_0x4298ce['query']);_0x4abae4['attributes']=_[_0x2c9e('0x2d')](_0x4298ce[_0x2c9e('0x2f')],qs['fields'](_0x3e0238[_0x2c9e('0x2a')][_0x2c9e('0x2e')]));_0x4abae4[_0x2c9e('0x2c')]=_0x4abae4[_0x2c9e('0x2c')][_0x2c9e('0x42')]?_0x4abae4['attributes']:_0x4298ce[_0x2c9e('0x2f')];if(_0x3e0238[_0x2c9e('0x2a')][_0x2c9e('0x39')]){_0x4abae4[_0x2c9e('0x3a')]=[{'all':!![]}];}_0x4abae4=_[_0x2c9e('0x36')]({},_0x4abae4,_0x3e0238[_0x2c9e('0x38')]);return db[_0x2c9e('0x3b')]['find'](_0x4abae4)[_0x2c9e('0x21')](handleEntityNotFound(_0x2a6f7d,null))['then'](respondWithResult(_0x2a6f7d,null))['catch'](handleError(_0x2a6f7d,null));};exports[_0x2c9e('0x43')]=function(_0x38b034,_0x4242d1){return db[_0x2c9e('0x3b')]['create'](_0x38b034['body'],{})[_0x2c9e('0x21')](respondWithResult(_0x4242d1,0xc9))['catch'](handleError(_0x4242d1,null));};exports[_0x2c9e('0x20')]=function(_0x39487d,_0x24fd7b){if(_0x39487d[_0x2c9e('0x44')]['id']){delete _0x39487d[_0x2c9e('0x44')]['id'];}return db[_0x2c9e('0x3b')]['find']({'where':{'id':_0x39487d[_0x2c9e('0x40')]['id']}})[_0x2c9e('0x21')](handleEntityNotFound(_0x24fd7b,null))[_0x2c9e('0x21')](saveUpdates(_0x39487d['body'],null))[_0x2c9e('0x21')](respondWithResult(_0x24fd7b,null))[_0x2c9e('0x3e')](handleError(_0x24fd7b,null));};exports[_0x2c9e('0x22')]=function(_0x5680a5,_0x1148e4){return db['SmsApplication'][_0x2c9e('0x45')]({'where':{'id':_0x5680a5['params']['id']}})[_0x2c9e('0x21')](handleEntityNotFound(_0x1148e4,null))[_0x2c9e('0x21')](removeEntity(_0x1148e4,null))[_0x2c9e('0x3e')](handleError(_0x1148e4,null));}; \ No newline at end of file +var _0x9144=['save','then','destroy','stack','name','send','index','map','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','SmsApplication','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set'];(function(_0x19545c,_0x201139){var _0x1d7507=function(_0x2e8c69){while(--_0x2e8c69){_0x19545c['push'](_0x19545c['shift']());}};_0x1d7507(++_0x201139);}(_0x9144,0x103));var _0x4914=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x9144[_0x4d35f3];return _0x382fea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4914('0x0'));var zipdir=require(_0x4914('0x1'));var jsonpatch=require(_0x4914('0x2'));var rp=require('request-promise');var moment=require(_0x4914('0x3'));var BPromise=require(_0x4914('0x4'));var Mustache=require('mustache');var util=require(_0x4914('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4914('0x6'));var ejs=require(_0x4914('0x7'));var fs=require('fs');var fs_extra=require(_0x4914('0x8'));var _=require(_0x4914('0x9'));var squel=require(_0x4914('0xa'));var crypto=require(_0x4914('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4914('0xc'));var toCsv=require(_0x4914('0x6'));var querystring=require(_0x4914('0xd'));var Papa=require(_0x4914('0xe'));var Redis=require(_0x4914('0xf'));var authService=require(_0x4914('0x10'));var qs=require(_0x4914('0x11'));var as=require(_0x4914('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4914('0x13'))(_0x4914('0x14'));var utils=require(_0x4914('0x15'));var config=require(_0x4914('0x16'));var licenseUtil=require(_0x4914('0x17'));var db=require(_0x4914('0x18'))['db'];function respondWithStatusCode(_0x200606,_0x5b3e05){_0x5b3e05=_0x5b3e05||0xcc;return function(_0x3b704f){if(_0x3b704f){return _0x200606[_0x4914('0x19')](_0x5b3e05);}return _0x200606[_0x4914('0x1a')](_0x5b3e05)[_0x4914('0x1b')]();};}function respondWithResult(_0x7a3b83,_0xf0a321){_0xf0a321=_0xf0a321||0xc8;return function(_0x254d9a){if(_0x254d9a){return _0x7a3b83[_0x4914('0x1a')](_0xf0a321)[_0x4914('0x1c')](_0x254d9a);}};}function respondWithFilteredResult(_0x1e7b10,_0x502fa6){return function(_0x9d2997){if(_0x9d2997){var _0x4fc79c=typeof _0x502fa6['offset']===_0x4914('0x1d')&&typeof _0x502fa6[_0x4914('0x1e')]===_0x4914('0x1d');var _0x14e4ee=_0x9d2997['count'];var _0x5655d8=_0x4fc79c?0x0:_0x502fa6[_0x4914('0x1f')];var _0x42b97b=_0x4fc79c?_0x9d2997['count']:_0x502fa6[_0x4914('0x1f')]+_0x502fa6[_0x4914('0x1e')];var _0x20b56a;if(_0x42b97b>=_0x14e4ee){_0x42b97b=_0x14e4ee;_0x20b56a=0xc8;}else{_0x20b56a=0xce;}_0x1e7b10[_0x4914('0x1a')](_0x20b56a);return _0x1e7b10[_0x4914('0x20')]('Content-Range',_0x5655d8+'-'+_0x42b97b+'/'+_0x14e4ee)['json'](_0x9d2997);}return null;};}function patchUpdates(_0xe603c6){return function(_0x10cb2e){try{jsonpatch['apply'](_0x10cb2e,_0xe603c6,!![]);}catch(_0x18dad0){return BPromise['reject'](_0x18dad0);}return _0x10cb2e[_0x4914('0x21')]();};}function saveUpdates(_0x209a86,_0x115a5a){return function(_0x394e76){if(_0x394e76){return _0x394e76['update'](_0x209a86)[_0x4914('0x22')](function(_0x3b15e7){return _0x3b15e7;});}return null;};}function removeEntity(_0x265ddf,_0x375109){return function(_0x475a38){if(_0x475a38){return _0x475a38[_0x4914('0x23')]()[_0x4914('0x22')](function(){_0x265ddf[_0x4914('0x1a')](0xcc)[_0x4914('0x1b')]();});}};}function handleEntityNotFound(_0x59dcc2,_0x42e051){return function(_0x4322fd){if(!_0x4322fd){_0x59dcc2[_0x4914('0x19')](0x194);}return _0x4322fd;};}function handleError(_0x2cb74d,_0x39de14){_0x39de14=_0x39de14||0x1f4;return function(_0x209378){logger['error'](_0x209378[_0x4914('0x24')]);if(_0x209378[_0x4914('0x25')]){delete _0x209378['name'];}_0x2cb74d['status'](_0x39de14)[_0x4914('0x26')](_0x209378);};}exports[_0x4914('0x27')]=function(_0x9c0fa4,_0x27d2b6){var _0xe05aa7={},_0x58fe9d={},_0xd96045={'count':0x0,'rows':[]};var _0x2eb0eb=_[_0x4914('0x28')](db['SmsApplication']['rawAttributes'],function(_0x516836){return{'name':_0x516836[_0x4914('0x29')],'type':_0x516836['type']['key']};});_0x58fe9d['model']=_[_0x4914('0x28')](_0x2eb0eb,_0x4914('0x25'));_0x58fe9d[_0x4914('0x2a')]=_[_0x4914('0x2b')](_0x9c0fa4[_0x4914('0x2a')]);_0x58fe9d[_0x4914('0x2c')]=_[_0x4914('0x2d')](_0x58fe9d[_0x4914('0x2e')],_0x58fe9d['query']);_0xe05aa7[_0x4914('0x2f')]=_['intersection'](_0x58fe9d['model'],qs[_0x4914('0x30')](_0x9c0fa4[_0x4914('0x2a')][_0x4914('0x30')]));_0xe05aa7[_0x4914('0x2f')]=_0xe05aa7[_0x4914('0x2f')][_0x4914('0x31')]?_0xe05aa7['attributes']:_0x58fe9d[_0x4914('0x2e')];if(!_0x9c0fa4[_0x4914('0x2a')][_0x4914('0x32')](_0x4914('0x33'))){_0xe05aa7[_0x4914('0x1e')]=qs[_0x4914('0x1e')](_0x9c0fa4['query'][_0x4914('0x1e')]);_0xe05aa7[_0x4914('0x1f')]=qs['offset'](_0x9c0fa4[_0x4914('0x2a')]['offset']);}_0xe05aa7[_0x4914('0x34')]=qs[_0x4914('0x35')](_0x9c0fa4['query'][_0x4914('0x35')]);_0xe05aa7[_0x4914('0x36')]=qs['filters'](_[_0x4914('0x37')](_0x9c0fa4[_0x4914('0x2a')],_0x58fe9d[_0x4914('0x2c')]),_0x2eb0eb);if(_0x9c0fa4[_0x4914('0x2a')]['filter']){_0xe05aa7[_0x4914('0x36')]=_['merge'](_0xe05aa7[_0x4914('0x36')],{'$or':_[_0x4914('0x28')](_0x2eb0eb,function(_0x34827f){if(_0x34827f[_0x4914('0x38')]!=='VIRTUAL'){var _0x1fa249={};_0x1fa249[_0x34827f[_0x4914('0x25')]]={'$like':'%'+_0x9c0fa4[_0x4914('0x2a')][_0x4914('0x39')]+'%'};return _0x1fa249;}})});}_0xe05aa7=_[_0x4914('0x3a')]({},_0xe05aa7,_0x9c0fa4[_0x4914('0x3b')]);var _0x5e5013={'where':_0xe05aa7['where']};return db[_0x4914('0x3c')][_0x4914('0x3d')](_0x5e5013)[_0x4914('0x22')](function(_0x529905){_0xd96045[_0x4914('0x3d')]=_0x529905;if(_0x9c0fa4['query'][_0x4914('0x3e')]){_0xe05aa7[_0x4914('0x3f')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0xe05aa7);})[_0x4914('0x22')](function(_0x55ba3a){_0xd96045[_0x4914('0x40')]=_0x55ba3a;return _0xd96045;})[_0x4914('0x22')](respondWithFilteredResult(_0x27d2b6,_0xe05aa7))[_0x4914('0x41')](handleError(_0x27d2b6,null));};exports[_0x4914('0x42')]=function(_0x2ce9bc,_0x144d6f){var _0x47ef14={'raw':!![],'where':{'id':_0x2ce9bc[_0x4914('0x43')]['id']}},_0x5da525={};_0x5da525['model']=_[_0x4914('0x2b')](db[_0x4914('0x3c')][_0x4914('0x44')]);_0x5da525[_0x4914('0x2a')]=_[_0x4914('0x2b')](_0x2ce9bc['query']);_0x5da525[_0x4914('0x2c')]=_['intersection'](_0x5da525[_0x4914('0x2e')],_0x5da525[_0x4914('0x2a')]);_0x47ef14[_0x4914('0x2f')]=_[_0x4914('0x2d')](_0x5da525['model'],qs[_0x4914('0x30')](_0x2ce9bc[_0x4914('0x2a')][_0x4914('0x30')]));_0x47ef14['attributes']=_0x47ef14[_0x4914('0x2f')][_0x4914('0x31')]?_0x47ef14[_0x4914('0x2f')]:_0x5da525[_0x4914('0x2e')];if(_0x2ce9bc['query'][_0x4914('0x3e')]){_0x47ef14['include']=[{'all':!![]}];}_0x47ef14=_[_0x4914('0x3a')]({},_0x47ef14,_0x2ce9bc['options']);return db[_0x4914('0x3c')][_0x4914('0x45')](_0x47ef14)[_0x4914('0x22')](handleEntityNotFound(_0x144d6f,null))[_0x4914('0x22')](respondWithResult(_0x144d6f,null))[_0x4914('0x41')](handleError(_0x144d6f,null));};exports[_0x4914('0x46')]=function(_0x578ef4,_0x207e00){return db[_0x4914('0x3c')][_0x4914('0x46')](_0x578ef4[_0x4914('0x47')],{})['then'](respondWithResult(_0x207e00,0xc9))[_0x4914('0x41')](handleError(_0x207e00,null));};exports[_0x4914('0x48')]=function(_0x4fb0bc,_0x39a07e){if(_0x4fb0bc[_0x4914('0x47')]['id']){delete _0x4fb0bc['body']['id'];}return db[_0x4914('0x3c')][_0x4914('0x45')]({'where':{'id':_0x4fb0bc['params']['id']}})[_0x4914('0x22')](handleEntityNotFound(_0x39a07e,null))[_0x4914('0x22')](saveUpdates(_0x4fb0bc[_0x4914('0x47')],null))[_0x4914('0x22')](respondWithResult(_0x39a07e,null))['catch'](handleError(_0x39a07e,null));};exports['destroy']=function(_0x5403d7,_0x3b381d){return db['SmsApplication'][_0x4914('0x45')]({'where':{'id':_0x5403d7[_0x4914('0x43')]['id']}})[_0x4914('0x22')](handleEntityNotFound(_0x3b381d,null))[_0x4914('0x22')](removeEntity(_0x3b381d,null))[_0x4914('0x41')](handleError(_0x3b381d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 808ec67..f589792 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 _0x6836=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash','util','api','moment','bluebird'];(function(_0x24d621,_0x4a2aac){var _0x49dbbe=function(_0x2e3809){while(--_0x2e3809){_0x24d621['push'](_0x24d621['shift']());}};_0x49dbbe(++_0x4a2aac);}(_0x6836,0x133));var _0x6683=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x6836[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var logger=require('../../config/logger')(_0x6683('0x2'));var moment=require(_0x6683('0x3'));var BPromise=require(_0x6683('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6683('0x5'));var rimraf=require(_0x6683('0x6'));var config=require(_0x6683('0x7'));var attributes=require(_0x6683('0x8'));module[_0x6683('0x9')]=function(_0x51779a,_0x57649d){return _0x51779a[_0x6683('0xa')](_0x6683('0xb'),attributes,{'tableName':_0x6683('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb453=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xb453,0x1e8));var _0x3b45=function(_0x1129b1,_0x218696){_0x1129b1=_0x1129b1-0x0;var _0x8c1015=_0xb453[_0x1129b1];return _0x8c1015;};'use strict';var _=require(_0x3b45('0x0'));var util=require(_0x3b45('0x1'));var logger=require('../../config/logger')(_0x3b45('0x2'));var moment=require(_0x3b45('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b45('0x4'));var rimraf=require(_0x3b45('0x5'));var config=require(_0x3b45('0x6'));var attributes=require(_0x3b45('0x7'));module[_0x3b45('0x8')]=function(_0x210775,_0x2f4baa){return _0x210775[_0x3b45('0x9')](_0x3b45('0xa'),attributes,{'tableName':_0x3b45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3b45('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 600a348..041cdc7 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 _0xa76e=['result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa76e,0xfe));var _0xea76=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xa76e[_0x191154];return _0x3dcd73;};'use strict';var _=require('lodash');var util=require(_0xea76('0x0'));var moment=require(_0xea76('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea76('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xea76('0x3'));var logger=require(_0xea76('0x4'))(_0xea76('0x5'));var config=require('../../config/environment');var jayson=require(_0xea76('0x6'));var client=jayson['client'][_0xea76('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ee974,_0x45ac1b,_0x1735ff){return new BPromise(function(_0x5eb746,_0x55aae7){return client[_0xea76('0x8')](_0x4ee974,_0x1735ff)[_0xea76('0x9')](function(_0x1c6723){logger[_0xea76('0xa')]('SmsApplication,\x20%s,\x20%s',_0x45ac1b,_0xea76('0xb'));logger[_0xea76('0xc')](_0xea76('0xd'),_0x45ac1b,'request\x20sent',JSON[_0xea76('0xe')](_0x1c6723));if(_0x1c6723[_0xea76('0xf')]){if(_0x1c6723[_0xea76('0xf')][_0xea76('0x10')]===0x1f4){logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);return _0x55aae7(_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);}logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);return _0x5eb746(_0x1c6723[_0xea76('0xf')]['message']);}else{logger[_0xea76('0xa')](_0xea76('0x11'),_0x45ac1b,_0xea76('0xb'));_0x5eb746(_0x1c6723[_0xea76('0x13')][_0xea76('0x12')]);}})[_0xea76('0x14')](function(_0x3b47fa){logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x3b47fa);_0x55aae7(_0x3b47fa);});});} \ No newline at end of file +var _0x75b6=['result','catch','lodash','bluebird','randomstring','ioredis','../../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','stringify','error','code','message'];(function(_0x53daed,_0x137f4e){var _0x965a06=function(_0x59da92){while(--_0x59da92){_0x53daed['push'](_0x53daed['shift']());}};_0x965a06(++_0x137f4e);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x675b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x675b('0x1'));var rs=require(_0x675b('0x2'));var fs=require('fs');var Redis=require(_0x675b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x675b('0x4'));var logger=require(_0x675b('0x5'))(_0x675b('0x6'));var config=require('../../config/environment');var jayson=require(_0x675b('0x7'));var client=jayson['client'][_0x675b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a7a7a,_0x3f34b8,_0x556239){return new BPromise(function(_0x1bff7d,_0x4f55d4){return client[_0x675b('0x9')](_0x3a7a7a,_0x556239)[_0x675b('0xa')](function(_0x24cf1c){logger[_0x675b('0xb')](_0x675b('0xc'),_0x3f34b8,_0x675b('0xd'));logger[_0x675b('0xe')](_0x675b('0xf'),_0x3f34b8,_0x675b('0xd'),JSON[_0x675b('0x10')](_0x24cf1c));if(_0x24cf1c['error']){if(_0x24cf1c[_0x675b('0x11')][_0x675b('0x12')]===0x1f4){logger[_0x675b('0x11')](_0x675b('0xc'),_0x3f34b8,_0x24cf1c['error']['message']);return _0x4f55d4(_0x24cf1c['error']['message']);}logger['error'](_0x675b('0xc'),_0x3f34b8,_0x24cf1c['error']['message']);return _0x1bff7d(_0x24cf1c[_0x675b('0x11')][_0x675b('0x13')]);}else{logger[_0x675b('0xb')](_0x675b('0xc'),_0x3f34b8,'request\x20sent');_0x1bff7d(_0x24cf1c[_0x675b('0x14')][_0x675b('0x13')]);}})[_0x675b('0x15')](function(_0x17c3fc){logger[_0x675b('0x11')](_0x675b('0xc'),_0x3f34b8,_0x17c3fc);_0x4f55d4(_0x17c3fc);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c5f4876..232d493 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 _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x4e3389,_0x40d312){_0x4e3389=_0x4e3389-0x0;var _0x2a47a8=_0x757a[_0x4e3389];return _0x2a47a8;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x4593c5,_0x59a1bb){var _0x204c8e=function(_0x34dc96){while(--_0x34dc96){_0x4593c5['push'](_0x4593c5['shift']());}};_0x204c8e(++_0x59a1bb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/download',auth[_0x0d8b('0x7')](),controller['download']);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0xf')](_0x0d8b('0x12'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15')),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x17')),controller['update']);router[_0x0d8b('0x18')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x19')),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x18')]('/:id/tags',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x1b')]);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9c7013a..4904e91 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 _0xa1aa=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x459f6d,_0x2a091f){var _0x236e07=function(_0x1bc66e){while(--_0x1bc66e){_0x459f6d['push'](_0x459f6d['shift']());}};_0x236e07(++_0x2a091f);}(_0xa1aa,0x88));var _0xaa1a=function(_0x2eb0c2,_0x107810){_0x2eb0c2=_0x2eb0c2-0x0;var _0x3a2466=_0xa1aa[_0x2eb0c2];return _0x3a2466;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xaa1a('0x0')]={'closed':{'type':Sequelize[_0xaa1a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaa1a('0x2')]},'disposition':{'type':Sequelize[_0xaa1a('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa1a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa1a('0x3')]},'note':{'type':Sequelize[_0xaa1a('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xaa1a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xaa1a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa1a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xaa1a('0x4')]('in',_0xaa1a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaa1a('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xbd10=['sequelize','moment','exports','DATE','STRING','ENUM','out'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd10,0x85));var _0x0bd1=function(_0xa15fbb,_0x3e6528){_0xa15fbb=_0xa15fbb-0x0;var _0x3462f0=_0xbd10[_0xa15fbb];return _0x3462f0;};'use strict';var Sequelize=require(_0x0bd1('0x0'));var moment=require(_0x0bd1('0x1'));module[_0x0bd1('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0bd1('0x3')]},'disposition':{'type':Sequelize[_0x0bd1('0x4')]},'secondDisposition':{'type':Sequelize[_0x0bd1('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0bd1('0x4')]},'phone':{'type':Sequelize[_0x0bd1('0x4')]},'read1stAt':{'type':Sequelize[_0x0bd1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0bd1('0x5')]('in',_0x0bd1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0bd1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0bd1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index db93746..436c17c 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 _0x99ab=['order','contactName','DESC','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','includeAll','merge','create','destroy','addMessage','SmsMessage','ids','getMessages','findOne','SmsInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','omit','spread','emit','smsInteractionTags:save','removeTags','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','direction','SmsAccount','Account','fullname','Sms','Owner','N.A.','closed','closedAt','disposition','Messages','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','select','field','color','from','tools_tags','u.fullname','user_has_sms_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)'];(function(_0x348a1c,_0x473ff2){var _0x16b380=function(_0x319dff){while(--_0x319dff){_0x348a1c['push'](_0x348a1c['shift']());}};_0x16b380(++_0x473ff2);}(_0x99ab,0x146));var _0xb99a=function(_0x33aaee,_0x9332ac){_0x33aaee=_0x33aaee-0x0;var _0x260f2b=_0x99ab[_0x33aaee];return _0x260f2b;};'use strict';var emlformat=require(_0xb99a('0x0'));var rimraf=require(_0xb99a('0x1'));var zipdir=require(_0xb99a('0x2'));var jsonpatch=require(_0xb99a('0x3'));var rp=require(_0xb99a('0x4'));var moment=require(_0xb99a('0x5'));var BPromise=require(_0xb99a('0x6'));var Mustache=require(_0xb99a('0x7'));var util=require('util');var path=require(_0xb99a('0x8'));var sox=require(_0xb99a('0x9'));var csv=require(_0xb99a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb99a('0xb'));var _=require(_0xb99a('0xc'));var squel=require(_0xb99a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb99a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb99a('0xf'));var Papa=require(_0xb99a('0x10'));var Redis=require('ioredis');var authService=require(_0xb99a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb99a('0x12'));var pdf=require(_0xb99a('0x13'));var hardwareService=require(_0xb99a('0x14'));var logger=require(_0xb99a('0x15'))(_0xb99a('0x16'));var utils=require(_0xb99a('0x17'));var config=require(_0xb99a('0x18'));var licenseUtil=require(_0xb99a('0x19'));var db=require(_0xb99a('0x1a'))['db'];config[_0xb99a('0x1b')]=_[_0xb99a('0x1c')](config[_0xb99a('0x1b')],{'host':_0xb99a('0x1d'),'port':0x18eb});var socket=require(_0xb99a('0x1e'))(new Redis(config[_0xb99a('0x1b')]));require(_0xb99a('0x1f'))[_0xb99a('0x20')](socket);function respondWithStatusCode(_0x44eb3a,_0x5e3786){_0x5e3786=_0x5e3786||0xcc;return function(_0xcaf975){if(_0xcaf975){return _0x44eb3a[_0xb99a('0x21')](_0x5e3786);}return _0x44eb3a[_0xb99a('0x22')](_0x5e3786)[_0xb99a('0x23')]();};}function respondWithResult(_0x2f7b71,_0x30a3ec){_0x30a3ec=_0x30a3ec||0xc8;return function(_0x43c609){if(_0x43c609){return _0x2f7b71[_0xb99a('0x22')](_0x30a3ec)['json'](_0x43c609);}};}function respondWithFilteredResult(_0x459c4d,_0xa5da2c){return function(_0x1cf69f){if(_0x1cf69f){var _0x3185d5=typeof _0xa5da2c['offset']===_0xb99a('0x24')&&typeof _0xa5da2c[_0xb99a('0x25')]===_0xb99a('0x24');var _0x777331=_0x1cf69f[_0xb99a('0x26')];var _0x5c23e5=_0x3185d5?0x0:_0xa5da2c[_0xb99a('0x27')];var _0x9c7140=_0x3185d5?_0x1cf69f['count']:_0xa5da2c['offset']+_0xa5da2c[_0xb99a('0x25')];var _0x199c38;if(_0x9c7140>=_0x777331){_0x9c7140=_0x777331;_0x199c38=0xc8;}else{_0x199c38=0xce;}_0x459c4d[_0xb99a('0x22')](_0x199c38);return _0x459c4d[_0xb99a('0x28')](_0xb99a('0x29'),_0x5c23e5+'-'+_0x9c7140+'/'+_0x777331)[_0xb99a('0x2a')](_0x1cf69f);}return null;};}function patchUpdates(_0x52421f){return function(_0x389522){try{jsonpatch[_0xb99a('0x2b')](_0x389522,_0x52421f,!![]);}catch(_0x4acfa7){return BPromise[_0xb99a('0x2c')](_0x4acfa7);}return _0x389522['save']();};}function saveUpdates(_0x13be65,_0x5a1a57){return function(_0x519ecc){if(_0x519ecc){return _0x519ecc[_0xb99a('0x2d')](_0x13be65)[_0xb99a('0x2e')](function(_0x7cce65){return _0x7cce65;});}return null;};}function removeEntity(_0x2df6b2,_0x3a3891){return function(_0x5908a4){if(_0x5908a4){return _0x5908a4['destroy']()['then'](function(){_0x2df6b2[_0xb99a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57f7b5,_0x434797){return function(_0x21731c){if(!_0x21731c){_0x57f7b5[_0xb99a('0x21')](0x194);}return _0x21731c;};}function handleError(_0x20c20f,_0x8ce51c){_0x8ce51c=_0x8ce51c||0x1f4;return function(_0x25ad35){logger[_0xb99a('0x2f')](_0x25ad35[_0xb99a('0x30')]);if(_0x25ad35['name']){delete _0x25ad35[_0xb99a('0x31')];}_0x20c20f['status'](_0x8ce51c)[_0xb99a('0x32')](_0x25ad35);};}function getInteractionUsers(_0x2ef954,_0x36d778){return new BPromise(function(_0x4068b8,_0x33979a){try{if(_0x36d778[_0x2ef954['id']]){_0x2ef954[_0xb99a('0x33')]=_[_0xb99a('0x34')](_0x36d778[_0x2ef954['id']],function(_0x4d1884){return{'id':_0x4d1884['id'],'fullname':_0x4d1884['fullname']};});}}catch(_0x34635f){_0x33979a(_0x34635f);}_0x4068b8(_0x2ef954);});}function getInteractionTags(_0x1362c2,_0x373302){return new BPromise(function(_0x41f9e9,_0x39830c){try{if(_0x1362c2[_0xb99a('0x35')]){_0x1362c2[_0xb99a('0x36')]=[];_0x1362c2['TagIds'][_0xb99a('0x37')](',')[_0xb99a('0x38')](function(_0x3a9a29){_0x1362c2[_0xb99a('0x36')][_0xb99a('0x39')](_0x373302[_0x3a9a29]);});}delete _0x1362c2['TagIds'];}catch(_0x5af4d6){_0x39830c(_0x5af4d6);}_0x41f9e9(_0x1362c2);});}function updateSmsInteraction(_0x1e3552,_0x5488e1,_0x5dad50){return new BPromise(function(_0x6a5b08,_0x143ae3){return getInteractionUsers(_0x1e3552,_0x5dad50)[_0xb99a('0x2e')](function(_0x3cf926){return getInteractionTags(_0x3cf926,_0x5488e1);})[_0xb99a('0x2e')](function(_0x355511){_0x6a5b08(_0x355511);})[_0xb99a('0x3a')](function(_0x5641c5){_0x143ae3(_0x5641c5);});});}exports[_0xb99a('0x3b')]=function(_0x462323,_0x14c50d){var _0x3fb02a={},_0x251c4c={},_0x2c2e7a={'count':0x0,'rows':[]};var _0x58f5c7=_[_0xb99a('0x34')](db[_0xb99a('0x3c')][_0xb99a('0x3d')],function(_0x46f424){return{'name':_0x46f424[_0xb99a('0x3e')],'type':_0x46f424[_0xb99a('0x3f')]['key']};});_0x251c4c['model']=_[_0xb99a('0x34')](_0x58f5c7,_0xb99a('0x31'));_0x251c4c[_0xb99a('0x40')]=_['keys'](_0x462323[_0xb99a('0x40')]);_0x251c4c['filters']=_['intersection'](_0x251c4c[_0xb99a('0x41')],_0x251c4c[_0xb99a('0x40')]);_0x3fb02a[_0xb99a('0x42')]=_[_0xb99a('0x43')](_0x251c4c['model'],qs[_0xb99a('0x44')](_0x462323['query'][_0xb99a('0x44')]));_0x3fb02a[_0xb99a('0x42')]=_0x3fb02a[_0xb99a('0x42')][_0xb99a('0x45')]?_0x3fb02a[_0xb99a('0x42')]:_0x251c4c['model'];if(!_0x462323[_0xb99a('0x40')][_0xb99a('0x46')](_0xb99a('0x47'))){_0x3fb02a[_0xb99a('0x25')]=qs[_0xb99a('0x25')](_0x462323[_0xb99a('0x40')][_0xb99a('0x25')]);_0x3fb02a[_0xb99a('0x27')]=qs[_0xb99a('0x27')](_0x462323['query']['offset']);}_0x3fb02a['order']=qs[_0xb99a('0x48')](_0x462323[_0xb99a('0x40')][_0xb99a('0x48')]);_0x3fb02a[_0xb99a('0x49')]=qs['filters'](_[_0xb99a('0x4a')](_0x462323[_0xb99a('0x40')],_0x251c4c[_0xb99a('0x4b')]),_0x58f5c7);var _0x52b644=[];var _0xd06403=squel[_0xb99a('0x4c')]()[_0xb99a('0x4d')]('id')[_0xb99a('0x4d')](_0xb99a('0x31'))[_0xb99a('0x4d')](_0xb99a('0x4e'))[_0xb99a('0x4f')](_0xb99a('0x50'));var _0x2f379d=squel['select']()[_0xb99a('0x4d')]('u.id')['field'](_0xb99a('0x51'))[_0xb99a('0x4d')]('ui.SmsInteractionId')[_0xb99a('0x4f')](_0xb99a('0x52'),'ui')[_0xb99a('0x53')](_0xb99a('0x54'),'u','u.id\x20=\x20ui.UserId');var _0xa77fdd=squel[_0xb99a('0x4c')]()[_0xb99a('0x4f')]('sms_interactions','i')['left_join'](_0xb99a('0x55'),'c',_0xb99a('0x56'))[_0xb99a('0x53')](_0xb99a('0x54'),'o',_0xb99a('0x57'))[_0xb99a('0x53')]('sms_accounts','a',_0xb99a('0x58'))['left_join']('sms_messages','me',_0xb99a('0x59'))[_0xb99a('0x53')](_0xb99a('0x5a'),'it',_0xb99a('0x5b'))[_0xb99a('0x53')](_0xb99a('0x50'),'t','t.id\x20=\x20it.TagId');var _0x27aff8=squel[_0xb99a('0x5c')]();var _0x1ac249=[];var _0x30c9cf=squel['expr']();var _0x35850f;if(_0x462323[_0xb99a('0x40')][_0xb99a('0x5d')]){_0x35850f=as[_0xb99a('0x5e')](_0x462323[_0xb99a('0x40')]['search']);var _0x4e7faa=_0x35850f[_0xb99a('0x5f')];for(var _0x2fd512=0x0;_0x2fd512<_0x35850f['conditions'][_0xb99a('0x45')];_0x2fd512++){var _0x205a11=_0x35850f[_0xb99a('0x60')][_0x2fd512];var _0x374fdc='i';var _0x1e3c0e=_[_0xb99a('0x61')](_0x58f5c7,[_0xb99a('0x31'),_0x205a11[_0xb99a('0x4d')]]);if(!_0x1e3c0e){switch(_0x205a11[_0xb99a('0x4d')]){case _0xb99a('0x62'):if(_0x205a11[_0xb99a('0x63')]==0x1){_0xa77fdd[_0xb99a('0x64')]('`'+_0x205a11[_0xb99a('0x4d')]+_0xb99a('0x65'));}else{_0xa77fdd[_0xb99a('0x64')]('`'+_0x205a11['field']+_0xb99a('0x66'));}break;case _0xb99a('0x67'):if(_0x205a11[_0xb99a('0x68')]===_0xb99a('0x69')){if(_0x205a11[_0xb99a('0x63')][_0xb99a('0x37')]('\x20')[_0xb99a('0x45')]>0x1){_0x27aff8[_0x4e7faa]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb99a('0x6a')](_0x205a11['value']),null);}else{var _0x173ee8='%'+_0x205a11[_0xb99a('0x63')]+'%';_0x27aff8[_0x4e7faa]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x173ee8,_0x173ee8,_0x173ee8);}}else{_0x1e3c0e=_['find'](_0x58f5c7,[_0xb99a('0x31'),_0xb99a('0x6b')]);_0x205a11[_0xb99a('0x4d')]='ContactId';_0x4551ed=as[_0xb99a('0x6c')](_0x374fdc,_0x1e3c0e[_0xb99a('0x3f')],_0x205a11);_0x27aff8[_0x4e7faa](_0x4551ed[_0xb99a('0x6d')],_0x4551ed[_0xb99a('0x63')][_0xb99a('0x6e')],_0x4551ed[_0xb99a('0x63')][_0xb99a('0x23')]);}break;case _0xb99a('0x6f'):var _0x2635e7=_0x205a11['value']['split'](',')['map'](function(_0x284499){return Number(_0x284499);});_0x2635e7[_0xb99a('0x38')](function(_0x1ac36b){_0x30c9cf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ac36b+',%');});_0x1ac249=_['union'](_0x1ac249,_0x2635e7);break;case'User':if(_0x205a11[_0xb99a('0x68')]===_0xb99a('0x69')){_0x27aff8[_0x4e7faa](_0xb99a('0x70'),'%'+_0x205a11[_0xb99a('0x63')]+'%',null);}else{_0x1e3c0e=_[_0xb99a('0x61')](_0x58f5c7,['name',_0xb99a('0x71')]);_0x205a11[_0xb99a('0x4d')]=_0xb99a('0x71');_0x4551ed=as[_0xb99a('0x6c')](_0x374fdc,_0x1e3c0e[_0xb99a('0x3f')],_0x205a11);_0x27aff8[_0x4e7faa](_0x4551ed[_0xb99a('0x6d')],_0x4551ed[_0xb99a('0x63')][_0xb99a('0x6e')],_0x4551ed['value']['end']);}break;case _0xb99a('0x72'):_0x4551ed=as[_0xb99a('0x6c')]('me',null,_0x205a11);_0x27aff8[_0x4e7faa](_0x4551ed[_0xb99a('0x6d')],_0x4551ed[_0xb99a('0x63')][_0xb99a('0x6e')],_0x4551ed[_0xb99a('0x63')][_0xb99a('0x23')]);break;}}else{var _0x4551ed=as[_0xb99a('0x6c')](_0x374fdc,_0x1e3c0e['type'],_0x205a11);_0x27aff8[_0x4e7faa](_0x4551ed[_0xb99a('0x6d')],_0x4551ed['value']['start'],_0x4551ed['value'][_0xb99a('0x23')]);}}}else{var _0x4bcefd=_(_0x462323['query'])[_0xb99a('0x73')]()[_0xb99a('0x34')](function(_0x451c62){return _[_0xb99a('0x74')](_0x58f5c7,[_0xb99a('0x31'),_0x451c62])?_0x451c62:undefined;})[_0xb99a('0x75')]()[_0xb99a('0x63')]();if(!_[_0xb99a('0x76')](_0x4bcefd)){_0x4bcefd[_0xb99a('0x38')](function(_0x2bd6c5){if(_0x2bd6c5==='SmsAccountId'){_0xa77fdd['where'](_0xb99a('0x77'),[]['concat'](_0x462323[_0xb99a('0x40')][_0x2bd6c5]));}else if(_0x2bd6c5===_0xb99a('0x78')){var _0x418901=JSON[_0xb99a('0x79')](_0x462323[_0xb99a('0x40')][_0x2bd6c5])['$gte'];var _0x55e4ee=JSON['parse'](_0x462323[_0xb99a('0x40')][_0x2bd6c5])[_0xb99a('0x7a')];_0xa77fdd[_0xb99a('0x49')](_0xb99a('0x7b'),_0x418901,_0x55e4ee);}else{if(_0x462323[_0xb99a('0x40')][_0x2bd6c5]===_0xb99a('0x7c')){_0xa77fdd[_0xb99a('0x49')]('i.'+_0x2bd6c5+_0xb99a('0x7d'));}else{_0xa77fdd['where']('i.'+_0x2bd6c5+_0xb99a('0x7e'),_0x462323[_0xb99a('0x40')][_0x2bd6c5]);}}});}if(_0x462323['query']['read']){if(_0x462323[_0xb99a('0x40')][_0xb99a('0x7f')]==0x1){_0xa77fdd['having'](_0xb99a('0x80'));}else{_0xa77fdd[_0xb99a('0x64')](_0xb99a('0x81'));}}if(_0x462323[_0xb99a('0x40')][_0xb99a('0x82')]){_0x1ac249=_[_0xb99a('0x83')](_0x462323[_0xb99a('0x40')][_0xb99a('0x82')])?_0x462323[_0xb99a('0x40')]['tag']:new Array(_0x462323[_0xb99a('0x40')][_0xb99a('0x82')]);_0x1ac249['forEach'](function(_0x2dbbe6){_0x30c9cf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2dbbe6+',%');});}if(_0x462323[_0xb99a('0x40')][_0xb99a('0x84')]){var _0x487881=_0x462323['query'][_0xb99a('0x84')][_0xb99a('0x85')]('\x5c','\x5c\x5c')[_0xb99a('0x85')](/'/g,'\x27\x27');if(qs[_0xb99a('0x86')](_0x487881)){_0x27aff8['or'](_0xb99a('0x87'),_0x487881+'%')['or']('i.phone\x20LIKE\x20?',_0x487881+'%');}else{_0x27aff8['or'](_0xb99a('0x88'),qs[_0xb99a('0x6a')](_0x487881))['or'](_0xb99a('0x89'),_0x487881+'%');}}}_0xa77fdd[_0xb99a('0x49')](_0x27aff8);_0xa77fdd[_0xb99a('0x8a')]('i.id');var _0x5eb3ed={'type':db[_0xb99a('0x8b')]['QueryTypes'][_0xb99a('0x8c')],'raw':!![]};var _0x38c7e3=_0xa77fdd[_0xb99a('0x8d')]();_0x38c7e3[_0xb99a('0x4d')](_0xb99a('0x8e'));_0x38c7e3['field'](_0xb99a('0x8f'),_0xb99a('0x62'));if(_0x3fb02a[_0xb99a('0x90')]){_0x3fb02a['order'][_0xb99a('0x38')](function(_0x381487){var _0x2afbee=_0x381487[0x0]===_0xb99a('0x91')?_0x381487[0x0]:'i.'+_0x381487[0x0];_0xa77fdd[_0xb99a('0x90')](_0x2afbee,_0x381487[0x1]===_0xb99a('0x92')?![]:!![]);});}if(!_[_0xb99a('0x76')](_0x1ac249)){_0xa77fdd[_0xb99a('0x64')](_0x30c9cf);_0x38c7e3['where']('t.id\x20IN\x20?',_0x1ac249);}BPromise['resolve']()[_0xb99a('0x2e')](function(){if(!_0x35850f){if(_0x462323[_0xb99a('0x40')][_0xb99a('0x93')])return;_0x38c7e3[_0xb99a('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0xa77fdd[_0xb99a('0x49')](_0xb99a('0x94'));return;}if(_0x462323['user'][_0xb99a('0x95')]!==_0xb99a('0x96'))return;return _0x462323[_0xb99a('0x97')][_0xb99a('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x6249f2){if(_[_0xb99a('0x76')](_0x6249f2)){_0x38c7e3['where'](_0xb99a('0x99'));_0xa77fdd[_0xb99a('0x49')](_0xb99a('0x99'));}else{_0x38c7e3['where'](_0xb99a('0x77'),_[_0xb99a('0x34')](_0x6249f2,'id'));_0xa77fdd[_0xb99a('0x49')](_0xb99a('0x77'),_['map'](_0x6249f2,'id'));}});})[_0xb99a('0x2e')](function(){if(_0x462323[_0xb99a('0x97')][_0xb99a('0x95')]==='agent'&&!_0x35850f&&!_0x462323[_0xb99a('0x40')][_0xb99a('0x93')])return[];return db[_0xb99a('0x9a')][_0xb99a('0x40')](_0x38c7e3[_0xb99a('0x9b')](),_0x5eb3ed);})[_0xb99a('0x2e')](function(_0xdb093d){_0x2c2e7a[_0xb99a('0x26')]=_0xdb093d['length'];if(_0x2c2e7a['count']===0x0)return[];return db[_0xb99a('0x9a')]['query'](_0xd06403[_0xb99a('0x9b')](),_0x5eb3ed)[_0xb99a('0x2e')](function(_0x1d8a0f){_0x52b644=_['keyBy'](_0x1d8a0f,'id');_0x5eb3ed=_['merge'](_0x5eb3ed,{'model':db[_0xb99a('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x462323[_0xb99a('0x40')]['fields']){_0x3fb02a[_0xb99a('0x42')]['forEach'](function(_0x4be278){_0xa77fdd['field']('i.'+_0x4be278);});}else{_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0x8f'),'unreadMessages');_0xa77fdd['field']('a.key',_0xb99a('0x9c'));_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0x9d'),_0xb99a('0x9e'));_0xa77fdd[_0xb99a('0x4d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0x9f'));_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0xa0'),_0xb99a('0xa1'));_0xa77fdd[_0xb99a('0x4d')]('c.lastName','Contact.lastName');_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0xa2'),_0xb99a('0xa3'));_0xa77fdd['field'](_0xb99a('0xa4'),_0xb99a('0xa5'));_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0xa6'),_0xb99a('0xa7'));_0xa77fdd['field'](_0xb99a('0xa8'),_0xb99a('0xa9'));_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0xaa'),_0xb99a('0xab'));_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0xac'),_0xb99a('0xad'));_0xa77fdd[_0xb99a('0x4d')](_0xb99a('0xae'),'TagIds');}if(_0x3fb02a[_0xb99a('0x25')])_0xa77fdd['limit'](_0x3fb02a['limit']);if(_0x3fb02a[_0xb99a('0x27')])_0xa77fdd['offset'](_0x3fb02a[_0xb99a('0x27')]);return db[_0xb99a('0x9a')][_0xb99a('0x40')](_0xa77fdd['toString'](),_0x5eb3ed);})['then'](function(_0x4fc424){if(_0x4fc424[_0xb99a('0x45')]>0x0)_0x2f379d[_0xb99a('0x49')]('ui.SmsInteractionId\x20IN\x20?',_[_0xb99a('0x34')](_0x4fc424,'id'));return db[_0xb99a('0x9a')][_0xb99a('0x40')](_0x2f379d['toString'](),_0x5eb3ed)[_0xb99a('0x2e')](function(_0x19f18a){var _0x964356=_[_0xb99a('0xaf')](_0x19f18a,'SmsInteractionId');var _0x1c5442=[];_0x4fc424[_0xb99a('0x38')](function(_0x57f16d){_0x1c5442[_0xb99a('0x39')](updateSmsInteraction(_0x57f16d,_0x52b644,_0x964356));});return BPromise[_0xb99a('0xb0')](_0x1c5442);});});})[_0xb99a('0x2e')](function(_0x5be457){_0x2c2e7a[_0xb99a('0xb1')]=_0x5be457;return _0x2c2e7a;})[_0xb99a('0x2e')](respondWithFilteredResult(_0x14c50d,_0x3fb02a))['catch'](handleError(_0x14c50d,null));};exports[_0xb99a('0xb2')]=function(_0x5d6f08,_0x41a599){var _0x40e5ef={'raw':![],'where':{'id':_0x5d6f08[_0xb99a('0xb3')]['id']}},_0x170dbf={};_0x170dbf[_0xb99a('0x41')]=_['keys'](db[_0xb99a('0x3c')][_0xb99a('0x3d')]);_0x170dbf[_0xb99a('0x40')]=_[_0xb99a('0x73')](_0x5d6f08['query']);_0x170dbf[_0xb99a('0x4b')]=_[_0xb99a('0x43')](_0x170dbf['model'],_0x170dbf['query']);_0x40e5ef[_0xb99a('0x42')]=_[_0xb99a('0x43')](_0x170dbf[_0xb99a('0x41')],qs[_0xb99a('0x44')](_0x5d6f08[_0xb99a('0x40')]['fields']));_0x40e5ef[_0xb99a('0x42')]=_0x40e5ef[_0xb99a('0x42')][_0xb99a('0x45')]?_0x40e5ef[_0xb99a('0x42')]:_0x170dbf[_0xb99a('0x41')];if(_0x5d6f08[_0xb99a('0x40')][_0xb99a('0xb4')]){_0x40e5ef['include']=[{'all':!![]}];}_0x40e5ef=_[_0xb99a('0xb5')]({},_0x40e5ef,_0x5d6f08['options']);return db[_0xb99a('0x3c')][_0xb99a('0x61')](_0x40e5ef)[_0xb99a('0x2e')](handleEntityNotFound(_0x41a599,null))[_0xb99a('0x2e')](respondWithResult(_0x41a599,null))[_0xb99a('0x3a')](handleError(_0x41a599,null));};exports[_0xb99a('0xb6')]=function(_0x21d96c,_0x27e2eb){return db[_0xb99a('0x3c')][_0xb99a('0xb6')](_0x21d96c['body'],{})[_0xb99a('0x2e')](respondWithResult(_0x27e2eb,0xc9))['catch'](handleError(_0x27e2eb,null));};exports[_0xb99a('0x2d')]=function(_0x3950d2,_0x570d11){if(_0x3950d2[_0xb99a('0x72')]['id']){delete _0x3950d2[_0xb99a('0x72')]['id'];}return db[_0xb99a('0x3c')][_0xb99a('0x61')]({'where':{'id':_0x3950d2[_0xb99a('0xb3')]['id']}})[_0xb99a('0x2e')](handleEntityNotFound(_0x570d11,null))[_0xb99a('0x2e')](saveUpdates(_0x3950d2[_0xb99a('0x72')],null))['then'](respondWithResult(_0x570d11,null))[_0xb99a('0x3a')](handleError(_0x570d11,null));};exports[_0xb99a('0xb7')]=function(_0x4c1e62,_0x4fac16){return db['SmsInteraction'][_0xb99a('0x61')]({'where':{'id':_0x4c1e62[_0xb99a('0xb3')]['id']}})[_0xb99a('0x2e')](handleEntityNotFound(_0x4fac16,null))['then'](removeEntity(_0x4fac16,null))[_0xb99a('0x3a')](handleError(_0x4fac16,null));};exports['describe']=function(_0x5b2fca,_0x5407bf){return db[_0xb99a('0x3c')]['describe']()[_0xb99a('0x2e')](respondWithResult(_0x5407bf,null))['catch'](handleError(_0x5407bf,null));};exports[_0xb99a('0xb8')]=function(_0xaa741d,_0x108ba0,_0x56076c){return db[_0xb99a('0xb9')][_0xb99a('0x61')]({'where':{'id':_0xaa741d[_0xb99a('0xb3')]['id']}})[_0xb99a('0x2e')](handleEntityNotFound(_0x108ba0,null))[_0xb99a('0x2e')](function(_0x4af496){if(_0x4af496){return _0x4af496[_0xb99a('0xb8')](_0xaa741d[_0xb99a('0x72')][_0xb99a('0xba')],_['omit'](_0xaa741d[_0xb99a('0x72')],[_0xb99a('0xba'),'id'])||{});}})[_0xb99a('0x2e')](respondWithResult(_0x108ba0,null))[_0xb99a('0x3a')](handleError(_0x108ba0,null));};exports[_0xb99a('0xbb')]=function(_0x2bb733,_0x702e98,_0xd9c222){var _0xa35038={'raw':![],'where':{}};var _0x253d31={};var _0x121003={'count':0x0,'rows':[]};return db[_0xb99a('0x3c')][_0xb99a('0xbc')]({'where':{'id':_0x2bb733[_0xb99a('0xb3')]['id']}})['then'](handleEntityNotFound(_0x702e98,null))[_0xb99a('0x2e')](function(_0x44cbb8){if(_0x44cbb8){_0x253d31['model']=_[_0xb99a('0x73')](db[_0xb99a('0xb9')][_0xb99a('0x3d')]);_0x253d31[_0xb99a('0x40')]=_['keys'](_0x2bb733[_0xb99a('0x40')]);_0x253d31[_0xb99a('0x4b')]=_['intersection'](_0x253d31[_0xb99a('0x41')],_0x253d31[_0xb99a('0x40')]);_0xa35038[_0xb99a('0x42')]=_[_0xb99a('0x43')](_0x253d31[_0xb99a('0x41')],qs['fields'](_0x2bb733['query']['fields']));_0xa35038['attributes']=_0xa35038[_0xb99a('0x42')][_0xb99a('0x45')]?_0xa35038[_0xb99a('0x42')]:_0x253d31[_0xb99a('0x41')];if(!_0x2bb733[_0xb99a('0x40')][_0xb99a('0x46')]('nolimit')){_0xa35038[_0xb99a('0x25')]=qs[_0xb99a('0x25')](_0x2bb733[_0xb99a('0x40')][_0xb99a('0x25')]);_0xa35038['offset']=qs[_0xb99a('0x27')](_0x2bb733[_0xb99a('0x40')][_0xb99a('0x27')]);}_0xa35038[_0xb99a('0x90')]=qs[_0xb99a('0x48')](_0x2bb733[_0xb99a('0x40')]['sort']);_0xa35038[_0xb99a('0x49')]=qs[_0xb99a('0x4b')](_[_0xb99a('0x4a')](_0x2bb733[_0xb99a('0x40')],_0x253d31['filters']));_0xa35038[_0xb99a('0x49')][_0xb99a('0xbd')]=_0x44cbb8['id'];if(_0x2bb733['query'][_0xb99a('0x84')]){_0xa35038[_0xb99a('0x49')]=_[_0xb99a('0xb5')](_0xa35038[_0xb99a('0x49')],{'$or':_['map'](_0xa35038[_0xb99a('0x42')],function(_0x47765c){var _0x823028={};_0x823028[_0x47765c]={'$like':'%'+_0x2bb733['query'][_0xb99a('0x84')]+'%'};return _0x823028;})});}if(_0x2bb733['query']['$gte']){var _0x5baf80=_0x2bb733[_0xb99a('0x40')][_0xb99a('0xbe')][_0xb99a('0x37')](',');var _0x2fa8ec={};_0x2fa8ec[_0x5baf80[0x0]]={'$gte':moment(_0x5baf80[0x1])[_0xb99a('0xbf')](_0xb99a('0xc0'))};_0xa35038[_0xb99a('0x49')]=_['merge'](_0xa35038[_0xb99a('0x49')],_0x2fa8ec);}_0xa35038=_[_0xb99a('0xb5')]({},_0xa35038,_0x2bb733[_0xb99a('0xc1')]);return db['SmsMessage'][_0xb99a('0x26')]({'where':_0xa35038[_0xb99a('0x49')]})[_0xb99a('0x2e')](function(_0x4e417b){_0x121003[_0xb99a('0x26')]=_0x4e417b;if(_0x2bb733[_0xb99a('0x40')][_0xb99a('0xb4')]){_0xa35038[_0xb99a('0xc2')]=[{'all':!![]}];}return db[_0xb99a('0xb9')][_0xb99a('0xc3')](_0xa35038);})[_0xb99a('0x2e')](function(_0x21e55d){_0x121003[_0xb99a('0xb1')]=_0x21e55d;return _0x121003;});}})[_0xb99a('0x2e')](respondWithFilteredResult(_0x702e98,_0xa35038))[_0xb99a('0x3a')](handleError(_0x702e98,null));};exports[_0xb99a('0xc4')]=function(_0x3d4994,_0x251e5c,_0x4e76cb){return db[_0xb99a('0x3c')]['find']({'where':{'id':_0x3d4994['params']['id']}})[_0xb99a('0x2e')](handleEntityNotFound(_0x251e5c,null))['then'](function(_0x3623d9){if(_0x3623d9){return _0x3623d9['setTags'](_0x3d4994['body'][_0xb99a('0xba')],_[_0xb99a('0xc5')](_0x3d4994[_0xb99a('0x72')],[_0xb99a('0xba'),'id'])||{})[_0xb99a('0xc6')](function(){return db['Tag'][_0xb99a('0xc3')]({'attributes':['id',_0xb99a('0x31'),_0xb99a('0x4e')],'where':{'id':_0x3d4994[_0xb99a('0x72')][_0xb99a('0xba')]}});})[_0xb99a('0x2e')](function(_0x195d5f){socket[_0xb99a('0xc7')](_0xb99a('0xc8'),{'id':Number(_0x3d4994[_0xb99a('0xb3')]['id']),'tags':_0x195d5f||[]});return{'id':Number(_0x3d4994[_0xb99a('0xb3')]['id']),'tags':_0x195d5f||[]};});}})['then'](respondWithResult(_0x251e5c,null))['catch'](handleError(_0x251e5c,null));};exports[_0xb99a('0xc9')]=function(_0x35533c,_0xf5cb79,_0x2de606){return db[_0xb99a('0x3c')][_0xb99a('0x61')]({'where':{'id':_0x35533c[_0xb99a('0xb3')]['id']}})[_0xb99a('0x2e')](handleEntityNotFound(_0xf5cb79,null))['then'](function(_0x2b1c4b){if(_0x2b1c4b){return _0x2b1c4b[_0xb99a('0xc9')](_0x35533c[_0xb99a('0x40')][_0xb99a('0xba')]);}})[_0xb99a('0x2e')](respondWithStatusCode(_0xf5cb79,null))[_0xb99a('0x3a')](handleError(_0xf5cb79,null));};exports['download']=function(_0x4b1877,_0x3168a5){var _0x4a7fc2=moment()['unix']()[_0xb99a('0x9b')]();var _0x386a50=path[_0xb99a('0xca')](config[_0xb99a('0xcb')],_0xb99a('0xcc'),'files',_0xb99a('0xcd'));var _0x438dbd=path[_0xb99a('0xca')](config[_0xb99a('0xcb')],'server',_0xb99a('0xce'),_0xb99a('0xcf'));var _0x307486=path['join'](_0x386a50,_0x4a7fc2);var _0x3f55f9=util['format'](_0xb99a('0xd0'),_0x4b1877[_0xb99a('0xb3')]['id'],_0x4a7fc2);var _0x33e279=path[_0xb99a('0xca')](_0x386a50,_0x3f55f9);var _0x5c6867=[];_0x5c6867['push']({'model':db[_0xb99a('0xd1')],'as':_0xb99a('0xd1'),'attributes':['id','fullname'],'raw':!![]});_0x5c6867[_0xb99a('0x39')]({'model':db[_0xb99a('0xd2')],'as':_0xb99a('0x67'),'attributes':['id',_0xb99a('0xd3'),_0xb99a('0xd4')],'raw':!![]});var _0x4de6e0=[{'model':db[_0xb99a('0xb9')],'as':'Messages','attributes':['id',_0xb99a('0x72'),_0xb99a('0x78'),_0xb99a('0xd5'),'secret','read'],'include':_0x5c6867}];_0x4de6e0[_0xb99a('0x39')]({'model':db[_0xb99a('0xd6')],'as':_0xb99a('0xd7'),'attributes':['id','name']});_0x4de6e0[_0xb99a('0x39')]({'model':db[_0xb99a('0xd1')],'as':'Owner','attributes':['id',_0xb99a('0xd8')]});return db['SmsInteraction'][_0xb99a('0x61')]({'where':{'id':_0x4b1877[_0xb99a('0xb3')]['id']},'include':_0x4de6e0})[_0xb99a('0x2e')](handleEntityNotFound(_0x3168a5,null))['then'](function(_0x3b5bf1){if(_0x3b5bf1){var _0x426809=_0x3b5bf1['get']({'plain':!![]});fs['mkdirSync'](_0x307486);var _0x207cd2={'channel':_0xb99a('0xd9'),'account':_0x426809[_0xb99a('0xd7')][_0xb99a('0x31')],'agent':_0x426809[_0xb99a('0xda')]?_0x426809['Owner'][_0xb99a('0xd8')]:_0xb99a('0xdb'),'createdAt':moment(_0x426809[_0xb99a('0x78')])[_0xb99a('0xbf')](_0xb99a('0xc0'))[_0xb99a('0x9b')](),'closedAt':_0x426809[_0xb99a('0xdc')]?moment(_0x426809[_0xb99a('0xdd')])['format'](_0xb99a('0xc0'))[_0xb99a('0x9b')]():'','disposition':_0x426809[_0xb99a('0xde')],'messages':_(_0x426809[_0xb99a('0xdf')])['filter']({'secret':![]})[_0xb99a('0x34')](function(_0x3f42b4){return{'date':moment(_0x3f42b4[_0xb99a('0x78')])[_0xb99a('0xbf')](_0xb99a('0xc0'))[_0xb99a('0x9b')](),'sender':_0x3f42b4[_0xb99a('0xd5')]===_0xb99a('0xe0')?_0x3f42b4['User']?_0x3f42b4[_0xb99a('0xd1')]['fullname']:_0xb99a('0xe1'):_0x3f42b4[_0xb99a('0x67')]['firstName']+(_0x3f42b4[_0xb99a('0x67')][_0xb99a('0xd4')]?'\x20'+_0x3f42b4[_0xb99a('0x67')][_0xb99a('0xd4')]:''),'body':_0x3f42b4[_0xb99a('0x72')],'direction':_0x3f42b4[_0xb99a('0xd5')]===_0xb99a('0xe0')?'A':'C','secret':_0x3f42b4['secret'],'read':_0x3f42b4[_0xb99a('0x7f')]};})[_0xb99a('0x63')]()};return ejs[_0xb99a('0xe2')](path[_0xb99a('0xca')](config[_0xb99a('0xcb')],_0xb99a('0xcc'),_0xb99a('0xe3'),'downloadInteraction.ejs'),{'interaction':_0x207cd2})[_0xb99a('0x2e')](function(_0x1ee0f4){var _0x327fd0=path[_0xb99a('0xca')](_0x307486,_0xb99a('0xe4')+_0x426809['id']+'-'+_0x4a7fc2+_0xb99a('0xe5'));var _0x38c4a3={'path':_0x327fd0,'channel':_0xb99a('0xd9'),'interactionId':_0x426809['id']};return pdf[_0xb99a('0xe6')](_0x1ee0f4,_0x38c4a3);})[_0xb99a('0x2e')](function(){return new BPromise(function(_0x332e28,_0x74d6bd){zipdir(_0x307486,{'saveTo':_0x33e279},function(_0xc299fd,_0x8f4cee){if(_0xc299fd)return _0x74d6bd(_0xc299fd);return _0x332e28(_0x8f4cee);});})[_0xb99a('0x2e')](function(){return new BPromise(function(_0x4e0df9,_0x39652a){rimraf(_0x307486,function(_0x2c3db6){if(_0x2c3db6)_0x39652a(_0x2c3db6);return _0x4e0df9();});});})[_0xb99a('0x2e')](function(){return _0x3168a5[_0xb99a('0xe7')](_0x33e279,_0x3f55f9,function(_0x175568){if(_0x175568){console[_0xb99a('0xe8')](_0xb99a('0xe9'),_0x175568);}else{fs[_0xb99a('0xea')](_0x33e279);}});});});}else{return _0x3168a5[_0xb99a('0x21')](0xc8);}})[_0xb99a('0x3a')](handleError(_0x3168a5,null));}; \ No newline at end of file +var _0x9be6=['tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','create','destroy','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','join','root','server','tmp','attachments','transcript-%d-%s.zip','User','CmContact','Contact','Messages','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closed','closedAt','format','disposition','direction','out','firstName','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','name','Users','map','fullname','Tags','TagIds','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','sort','where','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x9be6,0x66));var _0x69be=function(_0x3764d8,_0x316248){_0x3764d8=_0x3764d8-0x0;var _0x301ea2=_0x9be6[_0x3764d8];return _0x301ea2;};'use strict';var emlformat=require(_0x69be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69be('0x1'));var jsonpatch=require(_0x69be('0x2'));var rp=require('request-promise');var moment=require(_0x69be('0x3'));var BPromise=require(_0x69be('0x4'));var Mustache=require('mustache');var util=require(_0x69be('0x5'));var path=require('path');var sox=require(_0x69be('0x6'));var csv=require('to-csv');var ejs=require(_0x69be('0x7'));var fs=require('fs');var fs_extra=require(_0x69be('0x8'));var _=require('lodash');var squel=require(_0x69be('0x9'));var crypto=require(_0x69be('0xa'));var jsforce=require(_0x69be('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69be('0xc'));var Redis=require('ioredis');var authService=require(_0x69be('0xd'));var qs=require(_0x69be('0xe'));var as=require(_0x69be('0xf'));var pdf=require(_0x69be('0x10'));var hardwareService=require(_0x69be('0x11'));var logger=require(_0x69be('0x12'))(_0x69be('0x13'));var utils=require(_0x69be('0x14'));var config=require(_0x69be('0x15'));var licenseUtil=require(_0x69be('0x16'));var db=require(_0x69be('0x17'))['db'];config['redis']=_[_0x69be('0x18')](config['redis'],{'host':_0x69be('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x69be('0x1a')]));require('./smsInteraction.socket')[_0x69be('0x1b')](socket);function respondWithStatusCode(_0x58e731,_0x5f33de){_0x5f33de=_0x5f33de||0xcc;return function(_0xc295bc){if(_0xc295bc){return _0x58e731['sendStatus'](_0x5f33de);}return _0x58e731['status'](_0x5f33de)['end']();};}function respondWithResult(_0x5a661d,_0x394d03){_0x394d03=_0x394d03||0xc8;return function(_0x56bd97){if(_0x56bd97){return _0x5a661d[_0x69be('0x1c')](_0x394d03)[_0x69be('0x1d')](_0x56bd97);}};}function respondWithFilteredResult(_0x5d2243,_0x2a39be){return function(_0x29f45f){if(_0x29f45f){var _0x539db7=typeof _0x2a39be[_0x69be('0x1e')]===_0x69be('0x1f')&&typeof _0x2a39be['limit']===_0x69be('0x1f');var _0x413f49=_0x29f45f[_0x69be('0x20')];var _0x1ba8b4=_0x539db7?0x0:_0x2a39be[_0x69be('0x1e')];var _0x118d82=_0x539db7?_0x29f45f[_0x69be('0x20')]:_0x2a39be['offset']+_0x2a39be[_0x69be('0x21')];var _0x1654dd;if(_0x118d82>=_0x413f49){_0x118d82=_0x413f49;_0x1654dd=0xc8;}else{_0x1654dd=0xce;}_0x5d2243[_0x69be('0x1c')](_0x1654dd);return _0x5d2243['set'](_0x69be('0x22'),_0x1ba8b4+'-'+_0x118d82+'/'+_0x413f49)[_0x69be('0x1d')](_0x29f45f);}return null;};}function patchUpdates(_0x32424a){return function(_0x2d0912){try{jsonpatch[_0x69be('0x23')](_0x2d0912,_0x32424a,!![]);}catch(_0x334a58){return BPromise[_0x69be('0x24')](_0x334a58);}return _0x2d0912[_0x69be('0x25')]();};}function saveUpdates(_0x306929,_0x52922e){return function(_0x599d9c){if(_0x599d9c){return _0x599d9c[_0x69be('0x26')](_0x306929)[_0x69be('0x27')](function(_0x2d91e3){return _0x2d91e3;});}return null;};}function removeEntity(_0x4e6185,_0x3f405e){return function(_0x561b6e){if(_0x561b6e){return _0x561b6e['destroy']()[_0x69be('0x27')](function(){_0x4e6185[_0x69be('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x421fb4,_0x52ae81){return function(_0x486171){if(!_0x486171){_0x421fb4[_0x69be('0x28')](0x194);}return _0x486171;};}function handleError(_0x1ec8a5,_0x13562b){_0x13562b=_0x13562b||0x1f4;return function(_0x5e2391){logger[_0x69be('0x29')](_0x5e2391['stack']);if(_0x5e2391['name']){delete _0x5e2391[_0x69be('0x2a')];}_0x1ec8a5[_0x69be('0x1c')](_0x13562b)['send'](_0x5e2391);};}function getInteractionUsers(_0x4681c8,_0x5f1848){return new BPromise(function(_0x348b63,_0x2b5085){try{if(_0x5f1848[_0x4681c8['id']]){_0x4681c8[_0x69be('0x2b')]=_[_0x69be('0x2c')](_0x5f1848[_0x4681c8['id']],function(_0x5c93fc){return{'id':_0x5c93fc['id'],'fullname':_0x5c93fc[_0x69be('0x2d')]};});}}catch(_0x16947e){_0x2b5085(_0x16947e);}_0x348b63(_0x4681c8);});}function getInteractionTags(_0x409430,_0x3cfe36){return new BPromise(function(_0x2af2df,_0xddea7e){try{if(_0x409430['TagIds']){_0x409430[_0x69be('0x2e')]=[];_0x409430[_0x69be('0x2f')]['split'](',')[_0x69be('0x30')](function(_0xa7c347){_0x409430[_0x69be('0x2e')][_0x69be('0x31')](_0x3cfe36[_0xa7c347]);});}delete _0x409430[_0x69be('0x2f')];}catch(_0x44223c){_0xddea7e(_0x44223c);}_0x2af2df(_0x409430);});}function updateSmsInteraction(_0x317dff,_0x596daa,_0x5bd9ca){return new BPromise(function(_0x1400d3,_0x52934b){return getInteractionUsers(_0x317dff,_0x5bd9ca)[_0x69be('0x27')](function(_0x325372){return getInteractionTags(_0x325372,_0x596daa);})['then'](function(_0x3589f5){_0x1400d3(_0x3589f5);})[_0x69be('0x32')](function(_0x1721e5){_0x52934b(_0x1721e5);});});}exports[_0x69be('0x33')]=function(_0x2dcf7f,_0x4165c0){var _0x56c9fd={},_0x3f61a0={},_0x5857e0={'count':0x0,'rows':[]};var _0x3c034f=_[_0x69be('0x2c')](db[_0x69be('0x34')][_0x69be('0x35')],function(_0x49511a){return{'name':_0x49511a[_0x69be('0x36')],'type':_0x49511a[_0x69be('0x37')][_0x69be('0x38')]};});_0x3f61a0[_0x69be('0x39')]=_[_0x69be('0x2c')](_0x3c034f,_0x69be('0x2a'));_0x3f61a0['query']=_[_0x69be('0x3a')](_0x2dcf7f[_0x69be('0x3b')]);_0x3f61a0['filters']=_[_0x69be('0x3c')](_0x3f61a0[_0x69be('0x39')],_0x3f61a0[_0x69be('0x3b')]);_0x56c9fd[_0x69be('0x3d')]=_[_0x69be('0x3c')](_0x3f61a0['model'],qs[_0x69be('0x3e')](_0x2dcf7f['query'][_0x69be('0x3e')]));_0x56c9fd[_0x69be('0x3d')]=_0x56c9fd[_0x69be('0x3d')][_0x69be('0x3f')]?_0x56c9fd[_0x69be('0x3d')]:_0x3f61a0['model'];if(!_0x2dcf7f[_0x69be('0x3b')]['hasOwnProperty']('nolimit')){_0x56c9fd[_0x69be('0x21')]=qs[_0x69be('0x21')](_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x21')]);_0x56c9fd[_0x69be('0x1e')]=qs[_0x69be('0x1e')](_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x1e')]);}_0x56c9fd['order']=qs[_0x69be('0x40')](_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x40')]);_0x56c9fd[_0x69be('0x41')]=qs[_0x69be('0x42')](_[_0x69be('0x43')](_0x2dcf7f[_0x69be('0x3b')],_0x3f61a0['filters']),_0x3c034f);var _0x3afeb1=[];var _0x564616=squel['select']()[_0x69be('0x44')]('id')[_0x69be('0x44')]('name')[_0x69be('0x44')](_0x69be('0x45'))[_0x69be('0x46')](_0x69be('0x47'));var _0x4eb4f5=squel[_0x69be('0x48')]()['field'](_0x69be('0x49'))[_0x69be('0x44')](_0x69be('0x4a'))[_0x69be('0x44')](_0x69be('0x4b'))[_0x69be('0x46')](_0x69be('0x4c'),'ui')[_0x69be('0x4d')](_0x69be('0x4e'),'u',_0x69be('0x4f'));var _0x584113=squel[_0x69be('0x48')]()[_0x69be('0x46')](_0x69be('0x50'),'i')[_0x69be('0x4d')](_0x69be('0x51'),'c',_0x69be('0x52'))['left_join'](_0x69be('0x4e'),'o','o.id\x20=\x20i.UserId')[_0x69be('0x4d')](_0x69be('0x53'),'a',_0x69be('0x54'))['left_join'](_0x69be('0x55'),'me',_0x69be('0x56'))['left_join'](_0x69be('0x57'),'it',_0x69be('0x58'))[_0x69be('0x4d')](_0x69be('0x47'),'t',_0x69be('0x59'));var _0x28ed48=squel[_0x69be('0x5a')]();var _0x3afa91=[];var _0x32b619=squel['expr']();var _0x2d768c;if(_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x5b')]){_0x2d768c=as[_0x69be('0x5c')](_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x5b')]);var _0x4f5f14=_0x2d768c[_0x69be('0x5d')];for(var _0x8b0511=0x0;_0x8b0511<_0x2d768c[_0x69be('0x5e')][_0x69be('0x3f')];_0x8b0511++){var _0x5d9e1d=_0x2d768c[_0x69be('0x5e')][_0x8b0511];var _0x37e3f6='i';var _0x41af38=_['find'](_0x3c034f,['name',_0x5d9e1d[_0x69be('0x44')]]);if(!_0x41af38){switch(_0x5d9e1d[_0x69be('0x44')]){case _0x69be('0x5f'):if(_0x5d9e1d[_0x69be('0x60')]==0x1){_0x584113['having']('`'+_0x5d9e1d[_0x69be('0x44')]+_0x69be('0x61'));}else{_0x584113[_0x69be('0x62')]('`'+_0x5d9e1d['field']+_0x69be('0x63'));}break;case'Contact':if(_0x5d9e1d[_0x69be('0x64')]==='$substring'){if(_0x5d9e1d[_0x69be('0x60')][_0x69be('0x65')]('\x20')[_0x69be('0x3f')]>0x1){_0x28ed48[_0x4f5f14](_0x69be('0x66'),qs[_0x69be('0x67')](_0x5d9e1d[_0x69be('0x60')]),null);}else{var _0x1e9952='%'+_0x5d9e1d[_0x69be('0x60')]+'%';_0x28ed48[_0x4f5f14]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1e9952,_0x1e9952,_0x1e9952);}}else{_0x41af38=_[_0x69be('0x68')](_0x3c034f,['name',_0x69be('0x69')]);_0x5d9e1d['field']=_0x69be('0x69');_0x424794=as[_0x69be('0x6a')](_0x37e3f6,_0x41af38[_0x69be('0x37')],_0x5d9e1d);_0x28ed48[_0x4f5f14](_0x424794[_0x69be('0x6b')],_0x424794[_0x69be('0x60')][_0x69be('0x6c')],_0x424794[_0x69be('0x60')][_0x69be('0x6d')]);}break;case _0x69be('0x6e'):var _0x257125=_0x5d9e1d[_0x69be('0x60')]['split'](',')['map'](function(_0x3862f8){return Number(_0x3862f8);});_0x257125['forEach'](function(_0x33ebea){_0x32b619['or'](_0x69be('0x6f'),'%,'+_0x33ebea+',%');});_0x3afa91=_[_0x69be('0x70')](_0x3afa91,_0x257125);break;case'User':if(_0x5d9e1d['operator']===_0x69be('0x71')){_0x28ed48[_0x4f5f14](_0x69be('0x72'),'%'+_0x5d9e1d['value']+'%',null);}else{_0x41af38=_[_0x69be('0x68')](_0x3c034f,[_0x69be('0x2a'),_0x69be('0x73')]);_0x5d9e1d[_0x69be('0x44')]='UserId';_0x424794=as[_0x69be('0x6a')](_0x37e3f6,_0x41af38[_0x69be('0x37')],_0x5d9e1d);_0x28ed48[_0x4f5f14](_0x424794['text'],_0x424794['value'][_0x69be('0x6c')],_0x424794['value'][_0x69be('0x6d')]);}break;case _0x69be('0x74'):_0x424794=as[_0x69be('0x6a')]('me',null,_0x5d9e1d);_0x28ed48[_0x4f5f14](_0x424794[_0x69be('0x6b')],_0x424794[_0x69be('0x60')][_0x69be('0x6c')],_0x424794['value'][_0x69be('0x6d')]);break;}}else{var _0x424794=as[_0x69be('0x6a')](_0x37e3f6,_0x41af38[_0x69be('0x37')],_0x5d9e1d);_0x28ed48[_0x4f5f14](_0x424794[_0x69be('0x6b')],_0x424794[_0x69be('0x60')][_0x69be('0x6c')],_0x424794[_0x69be('0x60')]['end']);}}}else{var _0x109b8f=_(_0x2dcf7f['query'])[_0x69be('0x3a')]()[_0x69be('0x2c')](function(_0x33ef9f){return _[_0x69be('0x75')](_0x3c034f,[_0x69be('0x2a'),_0x33ef9f])?_0x33ef9f:undefined;})['compact']()[_0x69be('0x60')]();if(!_[_0x69be('0x76')](_0x109b8f)){_0x109b8f[_0x69be('0x30')](function(_0x1843a9){if(_0x1843a9===_0x69be('0x77')){_0x584113[_0x69be('0x41')](_0x69be('0x78'),[][_0x69be('0x79')](_0x2dcf7f[_0x69be('0x3b')][_0x1843a9]));}else if(_0x1843a9===_0x69be('0x7a')){var _0x5b592c=JSON[_0x69be('0x7b')](_0x2dcf7f[_0x69be('0x3b')][_0x1843a9])[_0x69be('0x7c')];var _0x19701d=JSON['parse'](_0x2dcf7f[_0x69be('0x3b')][_0x1843a9])[_0x69be('0x7d')];_0x584113[_0x69be('0x41')](_0x69be('0x7e'),_0x5b592c,_0x19701d);}else{if(_0x2dcf7f[_0x69be('0x3b')][_0x1843a9]==='null'){_0x584113[_0x69be('0x41')]('i.'+_0x1843a9+_0x69be('0x7f'));}else{_0x584113[_0x69be('0x41')]('i.'+_0x1843a9+_0x69be('0x80'),_0x2dcf7f[_0x69be('0x3b')][_0x1843a9]);}}});}if(_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x81')]){if(_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x81')]==0x1){_0x584113[_0x69be('0x62')](_0x69be('0x82'));}else{_0x584113[_0x69be('0x62')](_0x69be('0x83'));}}if(_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x84')]){_0x3afa91=_[_0x69be('0x85')](_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x84')])?_0x2dcf7f[_0x69be('0x3b')]['tag']:new Array(_0x2dcf7f['query'][_0x69be('0x84')]);_0x3afa91['forEach'](function(_0xaf65ec){_0x32b619['or'](_0x69be('0x6f'),'%,'+_0xaf65ec+',%');});}if(_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x86')]){var _0x51b441=_0x2dcf7f[_0x69be('0x3b')][_0x69be('0x86')]['replace']('\x5c','\x5c\x5c')[_0x69be('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x51b441)){_0x28ed48['or'](_0x69be('0x88'),_0x51b441+'%')['or'](_0x69be('0x89'),_0x51b441+'%');}else{_0x28ed48['or'](_0x69be('0x8a'),qs[_0x69be('0x67')](_0x51b441))['or'](_0x69be('0x8b'),_0x51b441+'%');}}}_0x584113[_0x69be('0x41')](_0x28ed48);_0x584113[_0x69be('0x8c')](_0x69be('0x8d'));var _0x3cbe08={'type':db['Sequelize'][_0x69be('0x8e')][_0x69be('0x8f')],'raw':!![]};var _0x3f2b36=_0x584113[_0x69be('0x90')]();_0x3f2b36['field'](_0x69be('0x8d'));_0x3f2b36[_0x69be('0x44')](_0x69be('0x91'),_0x69be('0x5f'));if(_0x56c9fd[_0x69be('0x92')]){_0x56c9fd[_0x69be('0x92')][_0x69be('0x30')](function(_0x38ca8b){var _0x194cda=_0x38ca8b[0x0]===_0x69be('0x93')?_0x38ca8b[0x0]:'i.'+_0x38ca8b[0x0];_0x584113['order'](_0x194cda,_0x38ca8b[0x1]===_0x69be('0x94')?![]:!![]);});}if(!_[_0x69be('0x76')](_0x3afa91)){_0x584113['having'](_0x32b619);_0x3f2b36[_0x69be('0x41')](_0x69be('0x95'),_0x3afa91);}BPromise['resolve']()['then'](function(){if(!_0x2d768c){if(_0x2dcf7f['query'][_0x69be('0x77')])return;_0x3f2b36['where'](_0x69be('0x96'));_0x584113['where'](_0x69be('0x96'));return;}if(_0x2dcf7f[_0x69be('0x97')][_0x69be('0x98')]!==_0x69be('0x99'))return;return _0x2dcf7f['user'][_0x69be('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x72000){if(_[_0x69be('0x76')](_0x72000)){_0x3f2b36['where'](_0x69be('0x9b'));_0x584113[_0x69be('0x41')](_0x69be('0x9b'));}else{_0x3f2b36[_0x69be('0x41')](_0x69be('0x78'),_[_0x69be('0x2c')](_0x72000,'id'));_0x584113[_0x69be('0x41')](_0x69be('0x78'),_[_0x69be('0x2c')](_0x72000,'id'));}});})[_0x69be('0x27')](function(){if(_0x2dcf7f['user'][_0x69be('0x98')]===_0x69be('0x99')&&!_0x2d768c&&!_0x2dcf7f['query']['SmsAccountId'])return[];return db[_0x69be('0x9c')]['query'](_0x3f2b36['toString'](),_0x3cbe08);})[_0x69be('0x27')](function(_0x361f94){_0x5857e0[_0x69be('0x20')]=_0x361f94[_0x69be('0x3f')];if(_0x5857e0[_0x69be('0x20')]===0x0)return[];return db['sequelize'][_0x69be('0x3b')](_0x564616[_0x69be('0x9d')](),_0x3cbe08)[_0x69be('0x27')](function(_0x341475){_0x3afeb1=_[_0x69be('0x9e')](_0x341475,'id');_0x3cbe08=_[_0x69be('0x9f')](_0x3cbe08,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dcf7f[_0x69be('0x3b')]['fields']){_0x56c9fd[_0x69be('0x3d')]['forEach'](function(_0x31b671){_0x584113[_0x69be('0x44')]('i.'+_0x31b671);});}else{_0x584113['field'](_0x69be('0x91'),_0x69be('0x5f'));_0x584113[_0x69be('0x44')](_0x69be('0xa0'),'Account.key');_0x584113['field'](_0x69be('0xa1'),_0x69be('0xa2'));_0x584113['field'](_0x69be('0xa3'),_0x69be('0x93'));_0x584113['field'](_0x69be('0xa4'));_0x584113[_0x69be('0x44')](_0x69be('0xa5'),'Contact.firstName');_0x584113[_0x69be('0x44')]('c.lastName',_0x69be('0xa6'));_0x584113[_0x69be('0x44')](_0x69be('0xa7'),_0x69be('0xa8'));_0x584113['field'](_0x69be('0xa9'),_0x69be('0xaa'));_0x584113[_0x69be('0x44')](_0x69be('0xab'),_0x69be('0xac'));_0x584113[_0x69be('0x44')](_0x69be('0xad'),_0x69be('0xae'));_0x584113[_0x69be('0x44')](_0x69be('0xaf'),'Owner.fullname');_0x584113[_0x69be('0x44')]('o.internal','Owner.internal');_0x584113[_0x69be('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x69be('0x2f'));}if(_0x56c9fd[_0x69be('0x21')])_0x584113[_0x69be('0x21')](_0x56c9fd['limit']);if(_0x56c9fd['offset'])_0x584113[_0x69be('0x1e')](_0x56c9fd[_0x69be('0x1e')]);return db[_0x69be('0x9c')][_0x69be('0x3b')](_0x584113[_0x69be('0x9d')](),_0x3cbe08);})['then'](function(_0x27971f){if(_0x27971f[_0x69be('0x3f')]>0x0)_0x4eb4f5['where'](_0x69be('0xb0'),_[_0x69be('0x2c')](_0x27971f,'id'));return db['sequelize'][_0x69be('0x3b')](_0x4eb4f5[_0x69be('0x9d')](),_0x3cbe08)[_0x69be('0x27')](function(_0x15de0e){var _0x22187a=_[_0x69be('0xb1')](_0x15de0e,_0x69be('0xb2'));var _0x47adab=[];_0x27971f[_0x69be('0x30')](function(_0x34d854){_0x47adab[_0x69be('0x31')](updateSmsInteraction(_0x34d854,_0x3afeb1,_0x22187a));});return BPromise[_0x69be('0xb3')](_0x47adab);});});})[_0x69be('0x27')](function(_0xfd0fde){_0x5857e0[_0x69be('0xb4')]=_0xfd0fde;return _0x5857e0;})[_0x69be('0x27')](respondWithFilteredResult(_0x4165c0,_0x56c9fd))[_0x69be('0x32')](handleError(_0x4165c0,null));};exports[_0x69be('0xb5')]=function(_0x30c6b4,_0x4d7602){var _0x74f874={'raw':![],'where':{'id':_0x30c6b4[_0x69be('0xb6')]['id']}},_0x1b398b={};_0x1b398b[_0x69be('0x39')]=_['keys'](db[_0x69be('0x34')]['rawAttributes']);_0x1b398b['query']=_['keys'](_0x30c6b4[_0x69be('0x3b')]);_0x1b398b[_0x69be('0x42')]=_[_0x69be('0x3c')](_0x1b398b[_0x69be('0x39')],_0x1b398b[_0x69be('0x3b')]);_0x74f874['attributes']=_['intersection'](_0x1b398b[_0x69be('0x39')],qs[_0x69be('0x3e')](_0x30c6b4[_0x69be('0x3b')][_0x69be('0x3e')]));_0x74f874[_0x69be('0x3d')]=_0x74f874[_0x69be('0x3d')][_0x69be('0x3f')]?_0x74f874['attributes']:_0x1b398b[_0x69be('0x39')];if(_0x30c6b4[_0x69be('0x3b')][_0x69be('0xb7')]){_0x74f874['include']=[{'all':!![]}];}_0x74f874=_[_0x69be('0x9f')]({},_0x74f874,_0x30c6b4['options']);return db['SmsInteraction'][_0x69be('0x68')](_0x74f874)['then'](handleEntityNotFound(_0x4d7602,null))[_0x69be('0x27')](respondWithResult(_0x4d7602,null))[_0x69be('0x32')](handleError(_0x4d7602,null));};exports['create']=function(_0x444743,_0xa41501){return db['SmsInteraction'][_0x69be('0xb8')](_0x444743['body'],{})[_0x69be('0x27')](respondWithResult(_0xa41501,0xc9))[_0x69be('0x32')](handleError(_0xa41501,null));};exports[_0x69be('0x26')]=function(_0x16d1da,_0x5d2e7f){if(_0x16d1da[_0x69be('0x74')]['id']){delete _0x16d1da[_0x69be('0x74')]['id'];}return db[_0x69be('0x34')][_0x69be('0x68')]({'where':{'id':_0x16d1da[_0x69be('0xb6')]['id']}})[_0x69be('0x27')](handleEntityNotFound(_0x5d2e7f,null))[_0x69be('0x27')](saveUpdates(_0x16d1da['body'],null))[_0x69be('0x27')](respondWithResult(_0x5d2e7f,null))['catch'](handleError(_0x5d2e7f,null));};exports[_0x69be('0xb9')]=function(_0x780f8c,_0x1c2aeb){return db[_0x69be('0x34')][_0x69be('0x68')]({'where':{'id':_0x780f8c[_0x69be('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1c2aeb,null))[_0x69be('0x27')](removeEntity(_0x1c2aeb,null))[_0x69be('0x32')](handleError(_0x1c2aeb,null));};exports[_0x69be('0xba')]=function(_0x41fbf6,_0x1c4dbb){return db['SmsInteraction'][_0x69be('0xba')]()[_0x69be('0x27')](respondWithResult(_0x1c4dbb,null))[_0x69be('0x32')](handleError(_0x1c4dbb,null));};exports['addMessage']=function(_0x5eff2b,_0x55fc8b,_0x33e637){return db[_0x69be('0xbb')]['find']({'where':{'id':_0x5eff2b[_0x69be('0xb6')]['id']}})[_0x69be('0x27')](handleEntityNotFound(_0x55fc8b,null))['then'](function(_0x513a68){if(_0x513a68){return _0x513a68[_0x69be('0xbc')](_0x5eff2b[_0x69be('0x74')][_0x69be('0xbd')],_[_0x69be('0xbe')](_0x5eff2b['body'],[_0x69be('0xbd'),'id'])||{});}})[_0x69be('0x27')](respondWithResult(_0x55fc8b,null))[_0x69be('0x32')](handleError(_0x55fc8b,null));};exports[_0x69be('0xbf')]=function(_0x168095,_0x3e69af,_0x4a09ca){var _0x59fa30={'raw':![],'where':{}};var _0x3114f2={};var _0x4e8db0={'count':0x0,'rows':[]};return db[_0x69be('0x34')][_0x69be('0xc0')]({'where':{'id':_0x168095[_0x69be('0xb6')]['id']}})[_0x69be('0x27')](handleEntityNotFound(_0x3e69af,null))['then'](function(_0x3f4ff9){if(_0x3f4ff9){_0x3114f2[_0x69be('0x39')]=_[_0x69be('0x3a')](db['SmsMessage'][_0x69be('0x35')]);_0x3114f2[_0x69be('0x3b')]=_[_0x69be('0x3a')](_0x168095[_0x69be('0x3b')]);_0x3114f2[_0x69be('0x42')]=_['intersection'](_0x3114f2[_0x69be('0x39')],_0x3114f2[_0x69be('0x3b')]);_0x59fa30[_0x69be('0x3d')]=_[_0x69be('0x3c')](_0x3114f2['model'],qs[_0x69be('0x3e')](_0x168095['query']['fields']));_0x59fa30[_0x69be('0x3d')]=_0x59fa30['attributes'][_0x69be('0x3f')]?_0x59fa30[_0x69be('0x3d')]:_0x3114f2[_0x69be('0x39')];if(!_0x168095[_0x69be('0x3b')][_0x69be('0xc1')]('nolimit')){_0x59fa30['limit']=qs[_0x69be('0x21')](_0x168095['query'][_0x69be('0x21')]);_0x59fa30[_0x69be('0x1e')]=qs[_0x69be('0x1e')](_0x168095[_0x69be('0x3b')][_0x69be('0x1e')]);}_0x59fa30[_0x69be('0x92')]=qs['sort'](_0x168095['query'][_0x69be('0x40')]);_0x59fa30['where']=qs['filters'](_[_0x69be('0x43')](_0x168095[_0x69be('0x3b')],_0x3114f2[_0x69be('0x42')]));_0x59fa30[_0x69be('0x41')][_0x69be('0xb2')]=_0x3f4ff9['id'];if(_0x168095[_0x69be('0x3b')][_0x69be('0x86')]){_0x59fa30[_0x69be('0x41')]=_[_0x69be('0x9f')](_0x59fa30[_0x69be('0x41')],{'$or':_[_0x69be('0x2c')](_0x59fa30['attributes'],function(_0x5e62b5){var _0x5bb13d={};_0x5bb13d[_0x5e62b5]={'$like':'%'+_0x168095[_0x69be('0x3b')][_0x69be('0x86')]+'%'};return _0x5bb13d;})});}if(_0x168095[_0x69be('0x3b')][_0x69be('0x7c')]){var _0x2c0345=_0x168095[_0x69be('0x3b')][_0x69be('0x7c')][_0x69be('0x65')](',');var _0x552732={};_0x552732[_0x2c0345[0x0]]={'$gte':moment(_0x2c0345[0x1])['format'](_0x69be('0xc2'))};_0x59fa30[_0x69be('0x41')]=_[_0x69be('0x9f')](_0x59fa30['where'],_0x552732);}_0x59fa30=_[_0x69be('0x9f')]({},_0x59fa30,_0x168095['options']);return db[_0x69be('0xbb')]['count']({'where':_0x59fa30[_0x69be('0x41')]})[_0x69be('0x27')](function(_0x3ae397){_0x4e8db0[_0x69be('0x20')]=_0x3ae397;if(_0x168095[_0x69be('0x3b')][_0x69be('0xb7')]){_0x59fa30['include']=[{'all':!![]}];}return db[_0x69be('0xbb')][_0x69be('0xc3')](_0x59fa30);})[_0x69be('0x27')](function(_0x1a0ee2){_0x4e8db0[_0x69be('0xb4')]=_0x1a0ee2;return _0x4e8db0;});}})[_0x69be('0x27')](respondWithFilteredResult(_0x3e69af,_0x59fa30))[_0x69be('0x32')](handleError(_0x3e69af,null));};exports[_0x69be('0xc4')]=function(_0x2df55e,_0x16a7ec,_0xae2cbc){return db[_0x69be('0x34')][_0x69be('0x68')]({'where':{'id':_0x2df55e[_0x69be('0xb6')]['id']}})[_0x69be('0x27')](handleEntityNotFound(_0x16a7ec,null))[_0x69be('0x27')](function(_0x2375bf){if(_0x2375bf){return _0x2375bf[_0x69be('0xc5')](_0x2df55e[_0x69be('0x74')][_0x69be('0xbd')],_[_0x69be('0xbe')](_0x2df55e['body'],['ids','id'])||{})[_0x69be('0xc6')](function(){return db[_0x69be('0x6e')][_0x69be('0xc3')]({'attributes':['id',_0x69be('0x2a'),_0x69be('0x45')],'where':{'id':_0x2df55e[_0x69be('0x74')][_0x69be('0xbd')]}});})[_0x69be('0x27')](function(_0x3c136f){socket[_0x69be('0xc7')]('smsInteractionTags:save',{'id':Number(_0x2df55e[_0x69be('0xb6')]['id']),'tags':_0x3c136f||[]});return{'id':Number(_0x2df55e[_0x69be('0xb6')]['id']),'tags':_0x3c136f||[]};});}})[_0x69be('0x27')](respondWithResult(_0x16a7ec,null))[_0x69be('0x32')](handleError(_0x16a7ec,null));};exports[_0x69be('0xc8')]=function(_0x5e7112,_0x7dd7a7,_0x345ce3){return db['SmsInteraction'][_0x69be('0x68')]({'where':{'id':_0x5e7112[_0x69be('0xb6')]['id']}})[_0x69be('0x27')](handleEntityNotFound(_0x7dd7a7,null))[_0x69be('0x27')](function(_0x3ddec7){if(_0x3ddec7){return _0x3ddec7[_0x69be('0xc8')](_0x5e7112[_0x69be('0x3b')][_0x69be('0xbd')]);}})[_0x69be('0x27')](respondWithStatusCode(_0x7dd7a7,null))[_0x69be('0x32')](handleError(_0x7dd7a7,null));};exports['download']=function(_0x2c186c,_0x299851){var _0x456ca5=moment()['unix']()['toString']();var _0x590167=path[_0x69be('0xc9')](config[_0x69be('0xca')],_0x69be('0xcb'),'files',_0x69be('0xcc'));var _0x2bdbec=path[_0x69be('0xc9')](config['root'],_0x69be('0xcb'),'files',_0x69be('0xcd'));var _0x4439a6=path[_0x69be('0xc9')](_0x590167,_0x456ca5);var _0x5a0f0e=util['format'](_0x69be('0xce'),_0x2c186c[_0x69be('0xb6')]['id'],_0x456ca5);var _0x1c880c=path[_0x69be('0xc9')](_0x590167,_0x5a0f0e);var _0x3c2b36=[];_0x3c2b36[_0x69be('0x31')]({'model':db['User'],'as':_0x69be('0xcf'),'attributes':['id',_0x69be('0x2d')],'raw':!![]});_0x3c2b36['push']({'model':db[_0x69be('0xd0')],'as':_0x69be('0xd1'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x2e325e=[{'model':db[_0x69be('0xbb')],'as':_0x69be('0xd2'),'attributes':['id','body',_0x69be('0x7a'),'direction',_0x69be('0xd3'),_0x69be('0x81')],'include':_0x3c2b36}];_0x2e325e[_0x69be('0x31')]({'model':db[_0x69be('0xd4')],'as':_0x69be('0xd5'),'attributes':['id','name']});_0x2e325e[_0x69be('0x31')]({'model':db['User'],'as':_0x69be('0xd6'),'attributes':['id',_0x69be('0x2d')]});return db[_0x69be('0x34')][_0x69be('0x68')]({'where':{'id':_0x2c186c[_0x69be('0xb6')]['id']},'include':_0x2e325e})[_0x69be('0x27')](handleEntityNotFound(_0x299851,null))[_0x69be('0x27')](function(_0x188f22){if(_0x188f22){var _0x22bc32=_0x188f22['get']({'plain':!![]});fs[_0x69be('0xd7')](_0x4439a6);var _0x1e1ccd={'channel':_0x69be('0xd8'),'account':_0x22bc32[_0x69be('0xd5')][_0x69be('0x2a')],'agent':_0x22bc32['Owner']?_0x22bc32[_0x69be('0xd6')][_0x69be('0x2d')]:_0x69be('0xd9'),'createdAt':moment(_0x22bc32['createdAt'])['format'](_0x69be('0xc2'))['toString'](),'closedAt':_0x22bc32[_0x69be('0xda')]?moment(_0x22bc32[_0x69be('0xdb')])[_0x69be('0xdc')](_0x69be('0xc2'))[_0x69be('0x9d')]():'','disposition':_0x22bc32[_0x69be('0xdd')],'messages':_(_0x22bc32[_0x69be('0xd2')])[_0x69be('0x86')]({'secret':![]})['map'](function(_0x3fb0a0){return{'date':moment(_0x3fb0a0[_0x69be('0x7a')])[_0x69be('0xdc')](_0x69be('0xc2'))[_0x69be('0x9d')](),'sender':_0x3fb0a0[_0x69be('0xde')]===_0x69be('0xdf')?_0x3fb0a0[_0x69be('0xcf')]?_0x3fb0a0['User']['fullname']:'System':_0x3fb0a0[_0x69be('0xd1')][_0x69be('0xe0')]+(_0x3fb0a0[_0x69be('0xd1')][_0x69be('0xe1')]?'\x20'+_0x3fb0a0['Contact'][_0x69be('0xe1')]:''),'body':_0x3fb0a0['body'],'direction':_0x3fb0a0[_0x69be('0xde')]==='out'?'A':'C','secret':_0x3fb0a0[_0x69be('0xd3')],'read':_0x3fb0a0['read']};})[_0x69be('0x60')]()};return ejs[_0x69be('0xe2')](path[_0x69be('0xc9')](config[_0x69be('0xca')],_0x69be('0xcb'),_0x69be('0xe3'),'downloadInteraction.ejs'),{'interaction':_0x1e1ccd})[_0x69be('0x27')](function(_0xcc3118){var _0x4b6cf0=path[_0x69be('0xc9')](_0x4439a6,_0x69be('0xe4')+_0x22bc32['id']+'-'+_0x456ca5+_0x69be('0xe5'));var _0x171d18={'path':_0x4b6cf0,'channel':'Sms','interactionId':_0x22bc32['id']};return pdf[_0x69be('0xe6')](_0xcc3118,_0x171d18);})['then'](function(){return new BPromise(function(_0x2ca6b6,_0x4a2398){zipdir(_0x4439a6,{'saveTo':_0x1c880c},function(_0x27b78f,_0x2ce427){if(_0x27b78f)return _0x4a2398(_0x27b78f);return _0x2ca6b6(_0x2ce427);});})[_0x69be('0x27')](function(){return new BPromise(function(_0x4b59cd,_0x215356){rimraf(_0x4439a6,function(_0x58164){if(_0x58164)_0x215356(_0x58164);return _0x4b59cd();});});})[_0x69be('0x27')](function(){return _0x299851[_0x69be('0xe7')](_0x1c880c,_0x5a0f0e,function(_0xbdcf4b){if(_0xbdcf4b){console['log'](_0x69be('0xe8'),_0xbdcf4b);}else{fs[_0x69be('0xe9')](_0x1c880c);}});});});}else{return _0x299851[_0x69be('0x28')](0xc8);}})[_0x69be('0x32')](handleError(_0x299851,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e3af025..7d6987d 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 _0xfef3=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x3fb897,_0x40908f){var _0x38dea9=function(_0x44f26b){while(--_0x44f26b){_0x3fb897['push'](_0x3fb897['shift']());}};_0x38dea9(++_0x40908f);}(_0xfef3,0x118));var _0x3fef=function(_0x2d398b,_0x5e98f8){_0x2d398b=_0x2d398b-0x0;var _0x5d8b9d=_0xfef3[_0x2d398b];return _0x5d8b9d;};'use strict';var EventEmitter=require(_0x3fef('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x3fef('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x3fef('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3fef('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fef('0x4'),'afterDestroy':_0x3fef('0x5')};function emitEvent(_0x538f28){return function(_0x2f88b8,_0x1351b1,_0x5dd9fb){_0x2f88b8[_0x3fef('0x6')]({'attributes':['id'],'raw':!![]})[_0x3fef('0x7')](function(_0x800850){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0x9'),_0x800850[_0x3fef('0xa')](function(_0x356ad8){return{'id':_0x356ad8['id']};}));return SmsMessage[_0x3fef('0xb')]({'where':{'SmsInteractionId':_0x2f88b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fef('0x7')](function(_0x307586){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0xc'),_0x307586[_0x3fef('0xd')]);SmsInteractionEvents[_0x3fef('0xe')](_0x538f28+':'+_0x2f88b8['id'],_0x2f88b8);SmsInteractionEvents['emit'](_0x538f28,_0x2f88b8);_0x5dd9fb(null);})[_0x3fef('0xf')](_0x5dd9fb(null));};}for(var e in events){if(events[_0x3fef('0x10')](e)){var event=events[e];SmsInteraction[_0x3fef('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x5eb8=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','then','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0xe762d,_0x5b5597){var _0x4b6c46=function(_0x16d927){while(--_0x16d927){_0xe762d['push'](_0xe762d['shift']());}};_0x4b6c46(++_0x5b5597);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0x5eb8[_0x5a7dd3];return _0x2f4d07;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x85eb('0x0')];var SmsMessage=require(_0x85eb('0x1'))['db'][_0x85eb('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x85eb('0x3')](0x0);var events={'afterCreate':_0x85eb('0x4'),'afterUpdate':_0x85eb('0x5'),'afterDestroy':_0x85eb('0x6')};function emitEvent(_0x44e313){return function(_0x3c5798,_0x1fde1a,_0x2bf83c){_0x3c5798[_0x85eb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x16d7b9){_0x3c5798[_0x85eb('0x8')](_0x85eb('0x9'),_0x16d7b9['map'](function(_0x2da3b0){return{'id':_0x2da3b0['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3c5798['id'],'direction':'in','read':![]},'raw':!![]});})[_0x85eb('0xa')](function(_0x40d6b6){_0x3c5798[_0x85eb('0x8')](_0x85eb('0xb'),_0x40d6b6[_0x85eb('0xc')]);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313+':'+_0x3c5798['id'],_0x3c5798);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313,_0x3c5798);_0x2bf83c(null);})['catch'](_0x2bf83c(null));};}for(var e in events){if(events[_0x85eb('0xe')](e)){var event=events[e];SmsInteraction[_0x85eb('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index dc6e70c..50468dc 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 _0x9ff3=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0x4b800e,_0x3cd84d){var _0x36bf7a=function(_0x346500){while(--_0x346500){_0x4b800e['push'](_0x4b800e['shift']());}};_0x36bf7a(++_0x3cd84d);}(_0x9ff3,0x182));var _0x39ff=function(_0x36ce35,_0x3b844f){_0x36ce35=_0x36ce35-0x0;var _0x122b04=_0x9ff3[_0x36ce35];return _0x122b04;};'use strict';var _=require(_0x39ff('0x0'));var util=require(_0x39ff('0x1'));var logger=require(_0x39ff('0x2'))(_0x39ff('0x3'));var moment=require(_0x39ff('0x4'));var BPromise=require(_0x39ff('0x5'));var rp=require(_0x39ff('0x6'));var fs=require('fs');var path=require(_0x39ff('0x7'));var rimraf=require(_0x39ff('0x8'));var config=require(_0x39ff('0x9'));var attributes=require(_0x39ff('0xa'));module[_0x39ff('0xb')]=function(_0x2a5b8e,_0x3503b4){return _0x2a5b8e['define'](_0x39ff('0xc'),attributes,{'tableName':_0x39ff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46b7cb,_0x328174,_0x295fa2){if(_0x46b7cb[_0x39ff('0xe')](_0x39ff('0xf'))){_0x46b7cb[_0x39ff('0x10')]=moment()[_0x39ff('0x11')](_0x39ff('0x12'));}_0x295fa2(null,_0x46b7cb);}}});}; \ No newline at end of file +var _0x30c3=['moment','bluebird','request-promise','rimraf','./smsInteraction.attributes','define','changed','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x30c3,0x159));var _0x330c=function(_0x37091d,_0x2fa386){_0x37091d=_0x37091d-0x0;var _0x460173=_0x30c3[_0x37091d];return _0x460173;};'use strict';var _=require('lodash');var util=require(_0x330c('0x0'));var logger=require(_0x330c('0x1'))(_0x330c('0x2'));var moment=require(_0x330c('0x3'));var BPromise=require(_0x330c('0x4'));var rp=require(_0x330c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x330c('0x6'));var config=require('../../config/environment');var attributes=require(_0x330c('0x7'));module['exports']=function(_0x51137e,_0x127e1b){return _0x51137e[_0x330c('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f497c,_0x2ff81d,_0x5e3686){if(_0x1f497c[_0x330c('0x9')](_0x330c('0xa'))){_0x1f497c['closedAt']=moment()['format'](_0x330c('0xb'));}_0x5e3686(null,_0x1f497c);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d013088..0f76b21 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 _0x8644=['catch','UpdateSmsInteraction','SmsInteraction','options','where','limit','debug','AddTagsToSmsInteraction','find','body','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','./smsInteraction.socket','request','then','info','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x8644,0x151));var _0x4864=function(_0x509755,_0x27e1c6){_0x509755=_0x509755-0x0;var _0x47df7e=_0x8644[_0x509755];return _0x47df7e;};'use strict';var _=require(_0x4864('0x0'));var util=require(_0x4864('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4864('0x2'));var fs=require('fs');var Redis=require(_0x4864('0x3'));var db=require(_0x4864('0x4'))['db'];var utils=require(_0x4864('0x5'));var logger=require(_0x4864('0x6'))(_0x4864('0x7'));var config=require(_0x4864('0x8'));var jayson=require(_0x4864('0x9'));var client=jayson[_0x4864('0xa')]['http']({'port':0x232a});config[_0x4864('0xb')]=_['defaults'](config[_0x4864('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4864('0xb')]));require(_0x4864('0xc'))['register'](socket);function respondWithRpcPromise(_0x1a9d33,_0x2361b6,_0x258a70){return new BPromise(function(_0x5478ec,_0x17f002){return client[_0x4864('0xd')](_0x1a9d33,_0x258a70)[_0x4864('0xe')](function(_0x27f68d){logger[_0x4864('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x2361b6,_0x4864('0x10'));logger['debug'](_0x4864('0x11'),_0x2361b6,_0x4864('0x10'),JSON[_0x4864('0x12')](_0x27f68d));if(_0x27f68d[_0x4864('0x13')]){if(_0x27f68d[_0x4864('0x13')][_0x4864('0x14')]===0x1f4){logger[_0x4864('0x13')](_0x4864('0x15'),_0x2361b6,_0x27f68d[_0x4864('0x13')]['message']);return _0x17f002(_0x27f68d[_0x4864('0x13')][_0x4864('0x16')]);}logger[_0x4864('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x2361b6,_0x27f68d[_0x4864('0x13')]['message']);return _0x5478ec(_0x27f68d[_0x4864('0x13')]['message']);}else{logger[_0x4864('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x2361b6,_0x4864('0x10'));_0x5478ec(_0x27f68d['result'][_0x4864('0x16')]);}})[_0x4864('0x17')](function(_0xa4e3b6){logger[_0x4864('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x2361b6,_0xa4e3b6);_0x17f002(_0xa4e3b6);});});}exports[_0x4864('0x18')]=function(_0x336af8){var _0x57f24b=this;return new Promise(function(_0xc36cf2,_0x3c72d0){return db[_0x4864('0x19')]['update'](_0x336af8['body'],{'raw':_0x336af8[_0x4864('0x1a')]?_0x336af8[_0x4864('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x336af8[_0x4864('0x1a')]?_0x336af8['options'][_0x4864('0x1b')]||null:null,'attributes':_0x336af8['options']?_0x336af8['options']['attributes']||null:null,'limit':_0x336af8[_0x4864('0x1a')]?_0x336af8[_0x4864('0x1a')][_0x4864('0x1c')]||null:null})[_0x4864('0xe')](function(_0x45920b){logger[_0x4864('0xf')]('UpdateSmsInteraction',_0x336af8);logger[_0x4864('0x1d')]('UpdateSmsInteraction',_0x336af8,JSON['stringify'](_0x45920b));_0xc36cf2(_0x45920b);})['catch'](function(_0x2f89f7){logger[_0x4864('0x13')]('UpdateSmsInteraction',_0x2f89f7['message'],_0x336af8);_0x3c72d0(_0x57f24b['error'](0x1f4,_0x2f89f7['message']));});});};exports[_0x4864('0x1e')]=function(_0x87e404){return new Promise(function(_0x456fb2,_0x29d274){return db['SmsInteraction'][_0x4864('0x1f')]({'where':_0x87e404[_0x4864('0x1a')]?_0x87e404[_0x4864('0x1a')][_0x4864('0x1b')]||null:null})[_0x4864('0xe')](function(_0x55d491){if(_0x55d491){return _0x55d491['addTags'](_0x87e404[_0x4864('0x20')]['ids'],_['omit'](_0x87e404['body'],[_0x4864('0x21'),'id'])||{});}})[_0x4864('0x22')](function(_0x5f13f3){logger[_0x4864('0xf')]('AddTags',_0x87e404);logger[_0x4864('0x1d')](_0x4864('0x23'),_0x87e404,JSON[_0x4864('0x12')](_0x5f13f3));_0x456fb2(_0x5f13f3);})[_0x4864('0x17')](function(_0x23fac8){logger[_0x4864('0x13')]('AddTags',_0x23fac8['message'],_0x87e404);_0x29d274(_this[_0x4864('0x13')](0x1f4,_0x23fac8[_0x4864('0x16')]));});});}; \ No newline at end of file +var _0xc0c8=['localhost','socket.io-emitter','register','request','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','info','result','catch','SmsInteraction','body','options','raw','attributes','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults'];(function(_0x5002b6,_0x29f0ab){var _0x14bed9=function(_0x5ded29){while(--_0x5ded29){_0x5002b6['push'](_0x5002b6['shift']());}};_0x14bed9(++_0x29f0ab);}(_0xc0c8,0x15d));var _0x8c0c=function(_0x11d0a5,_0x1ba3a1){_0x11d0a5=_0x11d0a5-0x0;var _0x50f1e8=_0xc0c8[_0x11d0a5];return _0x50f1e8;};'use strict';var _=require(_0x8c0c('0x0'));var util=require('util');var moment=require(_0x8c0c('0x1'));var BPromise=require(_0x8c0c('0x2'));var rs=require(_0x8c0c('0x3'));var fs=require('fs');var Redis=require(_0x8c0c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c0c('0x5'));var logger=require(_0x8c0c('0x6'))('rpc');var config=require(_0x8c0c('0x7'));var jayson=require(_0x8c0c('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x8c0c('0x9')]=_[_0x8c0c('0xa')](config[_0x8c0c('0x9')],{'host':_0x8c0c('0xb'),'port':0x18eb});var socket=require(_0x8c0c('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x8c0c('0xd')](socket);function respondWithRpcPromise(_0x3d4982,_0xb9e279,_0x5ce3c6){return new BPromise(function(_0x11b3f1,_0x59eb76){return client[_0x8c0c('0xe')](_0x3d4982,_0x5ce3c6)['then'](function(_0x2e4803){logger['info']('SmsInteraction,\x20%s,\x20%s',_0xb9e279,_0x8c0c('0xf'));logger[_0x8c0c('0x10')](_0x8c0c('0x11'),_0xb9e279,'request\x20sent',JSON[_0x8c0c('0x12')](_0x2e4803));if(_0x2e4803[_0x8c0c('0x13')]){if(_0x2e4803[_0x8c0c('0x13')][_0x8c0c('0x14')]===0x1f4){logger[_0x8c0c('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xb9e279,_0x2e4803[_0x8c0c('0x13')][_0x8c0c('0x15')]);return _0x59eb76(_0x2e4803[_0x8c0c('0x13')][_0x8c0c('0x15')]);}logger[_0x8c0c('0x13')](_0x8c0c('0x16'),_0xb9e279,_0x2e4803[_0x8c0c('0x13')][_0x8c0c('0x15')]);return _0x11b3f1(_0x2e4803[_0x8c0c('0x13')][_0x8c0c('0x15')]);}else{logger[_0x8c0c('0x17')](_0x8c0c('0x16'),_0xb9e279,'request\x20sent');_0x11b3f1(_0x2e4803[_0x8c0c('0x18')]['message']);}})[_0x8c0c('0x19')](function(_0x1271a1){logger['error'](_0x8c0c('0x16'),_0xb9e279,_0x1271a1);_0x59eb76(_0x1271a1);});});}exports['UpdateSmsInteraction']=function(_0x6d2f50){var _0x1f55eb=this;return new Promise(function(_0x16696b,_0x21530b){return db[_0x8c0c('0x1a')]['update'](_0x6d2f50[_0x8c0c('0x1b')],{'raw':_0x6d2f50[_0x8c0c('0x1c')]?_0x6d2f50[_0x8c0c('0x1c')][_0x8c0c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6d2f50[_0x8c0c('0x1c')]?_0x6d2f50[_0x8c0c('0x1c')]['where']||null:null,'attributes':_0x6d2f50['options']?_0x6d2f50[_0x8c0c('0x1c')][_0x8c0c('0x1e')]||null:null,'limit':_0x6d2f50[_0x8c0c('0x1c')]?_0x6d2f50[_0x8c0c('0x1c')]['limit']||null:null})[_0x8c0c('0x1f')](function(_0x56d651){logger[_0x8c0c('0x17')]('UpdateSmsInteraction',_0x6d2f50);logger[_0x8c0c('0x10')]('UpdateSmsInteraction',_0x6d2f50,JSON[_0x8c0c('0x12')](_0x56d651));_0x16696b(_0x56d651);})[_0x8c0c('0x19')](function(_0x64a000){logger[_0x8c0c('0x13')](_0x8c0c('0x20'),_0x64a000[_0x8c0c('0x15')],_0x6d2f50);_0x21530b(_0x1f55eb['error'](0x1f4,_0x64a000['message']));});});};exports[_0x8c0c('0x21')]=function(_0x3b32d3){return new Promise(function(_0x341569,_0x2b5895){return db[_0x8c0c('0x1a')][_0x8c0c('0x22')]({'where':_0x3b32d3[_0x8c0c('0x1c')]?_0x3b32d3[_0x8c0c('0x1c')][_0x8c0c('0x23')]||null:null})[_0x8c0c('0x1f')](function(_0x96399a){if(_0x96399a){return _0x96399a[_0x8c0c('0x24')](_0x3b32d3[_0x8c0c('0x1b')][_0x8c0c('0x25')],_[_0x8c0c('0x26')](_0x3b32d3[_0x8c0c('0x1b')],[_0x8c0c('0x25'),'id'])||{});}})['spread'](function(_0x400783){logger['info'](_0x8c0c('0x27'),_0x3b32d3);logger[_0x8c0c('0x10')](_0x8c0c('0x27'),_0x3b32d3,JSON['stringify'](_0x400783));_0x341569(_0x400783);})[_0x8c0c('0x19')](function(_0x3a8ea6){logger[_0x8c0c('0x13')](_0x8c0c('0x27'),_0x3a8ea6[_0x8c0c('0x15')],_0x3b32d3);_0x2b5895(_this[_0x8c0c('0x13')](0x1f4,_0x3a8ea6[_0x8c0c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5242c1c..0ee3042 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 _0x1e65=['save','remove','update','removeListener','register','smsInteraction:','./smsInteraction.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e65,0x99));var _0x51e6=function(_0x2f8df4,_0xec4258){_0x2f8df4=_0x2f8df4-0x0;var _0x3551c9=_0x1e65[_0x2f8df4];return _0x3551c9;};'use strict';var SmsInteractionEvents=require(_0x51e6('0x0'));var events=[_0x51e6('0x1'),_0x51e6('0x2'),_0x51e6('0x3')];function createListener(_0x43b02b,_0x37eda1){return function(_0x1cecb7){_0x37eda1['emit'](_0x43b02b,_0x1cecb7);};}function removeListener(_0x5dd9d9,_0x3418d3){return function(){SmsInteractionEvents[_0x51e6('0x4')](_0x5dd9d9,_0x3418d3);};}exports[_0x51e6('0x5')]=function(_0x108efa){for(var _0x4d26f4=0x0,_0x5283a0=events['length'];_0x4d26f4<_0x5283a0;_0x4d26f4++){var _0x5eaf2d=events[_0x4d26f4];var _0x1a0fb1=createListener(_0x51e6('0x6')+_0x5eaf2d,_0x108efa);SmsInteractionEvents['on'](_0x5eaf2d,_0x1a0fb1);}}; \ No newline at end of file +var _0x4b75=['update','emit','register','length','./smsInteraction.events','save'];(function(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0x4b75,0xf4));var _0x54b7=function(_0x53db62,_0x15e00e){_0x53db62=_0x53db62-0x0;var _0x3e95eb=_0x4b75[_0x53db62];return _0x3e95eb;};'use strict';var SmsInteractionEvents=require(_0x54b7('0x0'));var events=[_0x54b7('0x1'),'remove',_0x54b7('0x2')];function createListener(_0x2bb849,_0x195ce8){return function(_0x354857){_0x195ce8[_0x54b7('0x3')](_0x2bb849,_0x354857);};}function removeListener(_0x26d208,_0x2936ed){return function(){SmsInteractionEvents['removeListener'](_0x26d208,_0x2936ed);};}exports[_0x54b7('0x4')]=function(_0x460e8a){for(var _0x52e820=0x0,_0x14e92b=events[_0x54b7('0x5')];_0x52e820<_0x14e92b;_0x52e820++){var _0x7bacd6=events[_0x52e820];var _0x421f9d=createListener('smsInteraction:'+_0x7bacd6,_0x460e8a);SmsInteractionEvents['on'](_0x7bacd6,_0x421f9d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f2b73f4..73ee234 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 _0xabbd=['/describe','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','/:id','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x1501e5,_0x5c84a9){var _0xb581ea=function(_0x350bf8){while(--_0x350bf8){_0x1501e5['push'](_0x1501e5['shift']());}};_0xb581ea(++_0x5c84a9);}(_0xabbd,0x1f2));var _0xdabb=function(_0x3f16ed,_0x81c877){_0x3f16ed=_0x3f16ed-0x0;var _0x3aa7bb=_0xabbd[_0x3f16ed];return _0x3aa7bb;};'use strict';var multer=require(_0xdabb('0x0'));var util=require(_0xdabb('0x1'));var path=require(_0xdabb('0x2'));var timeout=require(_0xdabb('0x3'));var express=require(_0xdabb('0x4'));var router=express[_0xdabb('0x5')]();var fs_extra=require(_0xdabb('0x6'));var auth=require(_0xdabb('0x7'));var interaction=require(_0xdabb('0x8'));var config=require(_0xdabb('0x9'));var controller=require(_0xdabb('0xa'));router[_0xdabb('0xb')]('/',auth[_0xdabb('0xc')](),controller[_0xdabb('0xd')]);router[_0xdabb('0xb')](_0xdabb('0xe'),auth['isAuthenticated'](),controller[_0xdabb('0xf')]);router[_0xdabb('0xb')]('/:id',auth[_0xdabb('0xc')](),controller[_0xdabb('0x10')]);router[_0xdabb('0x11')]('/',auth[_0xdabb('0xc')](),interaction[_0xdabb('0x12')](_0xdabb('0x13'),_0xdabb('0x14')),controller[_0xdabb('0x15')]);router[_0xdabb('0x11')](_0xdabb('0x16'),controller['status']);router['put'](_0xdabb('0x17'),auth[_0xdabb('0xc')](),controller[_0xdabb('0x18')]);router[_0xdabb('0x19')](_0xdabb('0x1a'),auth[_0xdabb('0xc')](),controller[_0xdabb('0x1b')]);router[_0xdabb('0x19')]('/:id/reject',auth[_0xdabb('0xc')](),controller[_0xdabb('0x1c')]);router[_0xdabb('0x1d')](_0xdabb('0x17'),auth[_0xdabb('0xc')](),controller[_0xdabb('0x1e')]);module[_0xdabb('0x1f')]=router; \ No newline at end of file +var _0xcb62=['reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','tracked','create','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xcb62,0xf7));var _0x2cb6=function(_0x2fef65,_0x7aae13){_0x2fef65=_0x2fef65-0x0;var _0x25b449=_0xcb62[_0x2fef65];return _0x25b449;};'use strict';var multer=require(_0x2cb6('0x0'));var util=require(_0x2cb6('0x1'));var path=require(_0x2cb6('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cb6('0x3'));var router=express['Router']();var fs_extra=require(_0x2cb6('0x4'));var auth=require(_0x2cb6('0x5'));var interaction=require(_0x2cb6('0x6'));var config=require('../../config/environment');var controller=require(_0x2cb6('0x7'));router['get']('/',auth[_0x2cb6('0x8')](),controller[_0x2cb6('0x9')]);router[_0x2cb6('0xa')](_0x2cb6('0xb'),auth[_0x2cb6('0x8')](),controller[_0x2cb6('0xc')]);router[_0x2cb6('0xa')](_0x2cb6('0xd'),auth[_0x2cb6('0x8')](),controller['show']);router[_0x2cb6('0xe')]('/',auth['isAuthenticated'](),interaction[_0x2cb6('0xf')]('sms','smsmessage:create'),controller[_0x2cb6('0x10')]);router[_0x2cb6('0xe')]('/:id/status',controller[_0x2cb6('0x11')]);router[_0x2cb6('0x12')]('/:id',auth[_0x2cb6('0x8')](),controller[_0x2cb6('0x13')]);router[_0x2cb6('0x12')](_0x2cb6('0x14'),auth['isAuthenticated'](),controller[_0x2cb6('0x15')]);router['put'](_0x2cb6('0x16'),auth[_0x2cb6('0x8')](),controller[_0x2cb6('0x17')]);router[_0x2cb6('0x18')](_0x2cb6('0xd'),auth['isAuthenticated'](),controller[_0x2cb6('0x19')]);module[_0x2cb6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f8f546f..23f90bd 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 _0xcd86=['STRING','DATE','BOOLEAN','exports','TEXT','ENUM','out'];(function(_0x254842,_0x159c1f){var _0x364fad=function(_0x305392){while(--_0x305392){_0x254842['push'](_0x254842['shift']());}};_0x364fad(++_0x159c1f);}(_0xcd86,0x16f));var _0x6cd8=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0xcd86[_0x2e913b];return _0x173899;};'use strict';var Sequelize=require('sequelize');module[_0x6cd8('0x0')]={'body':{'type':Sequelize[_0x6cd8('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6cd8('0x2')]('in',_0x6cd8('0x3')),'defaultValue':_0x6cd8('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6cd8('0x4')](0xbe)},'phone':{'type':Sequelize[_0x6cd8('0x4')]},'readAt':{'type':Sequelize[_0x6cd8('0x5')]},'secret':{'type':Sequelize[_0x6cd8('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6cd8('0x1')]}}; \ No newline at end of file +var _0x19b9=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x34480c,_0x58729e){var _0x1fb512=function(_0x8373b8){while(--_0x8373b8){_0x34480c['push'](_0x34480c['shift']());}};_0x1fb512(++_0x58729e);}(_0x19b9,0xea));var _0x919b=function(_0x4eac77,_0x1a5c7c){_0x4eac77=_0x4eac77-0x0;var _0x36655c=_0x19b9[_0x4eac77];return _0x36655c;};'use strict';var Sequelize=require(_0x919b('0x0'));module[_0x919b('0x1')]={'body':{'type':Sequelize[_0x919b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x919b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x919b('0x4')]('in',_0x919b('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x919b('0x6')](0xbe)},'phone':{'type':Sequelize[_0x919b('0x6')]},'readAt':{'type':Sequelize[_0x919b('0x7')]},'secret':{'type':Sequelize[_0x919b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x919b('0x6')]},'providerResponse':{'type':Sequelize[_0x919b('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 98d115f..046ccdc 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 _0x29f4=['interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','null','ContactId','SELECT','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','SmsMessage','includeAll','include','rows','show','keys','fields','find','create','body','params','describe','../../config/logger','accept','read','readAt','format','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x29f4,0x1d1));var _0x429f=function(_0x237206,_0xb0df37){_0x237206=_0x237206-0x0;var _0x44f5be=_0x29f4[_0x237206];return _0x44f5be;};'use strict';var emlformat=require(_0x429f('0x0'));var rimraf=require(_0x429f('0x1'));var zipdir=require(_0x429f('0x2'));var jsonpatch=require(_0x429f('0x3'));var rp=require(_0x429f('0x4'));var moment=require(_0x429f('0x5'));var BPromise=require(_0x429f('0x6'));var Mustache=require(_0x429f('0x7'));var util=require(_0x429f('0x8'));var path=require(_0x429f('0x9'));var sox=require(_0x429f('0xa'));var csv=require('to-csv');var ejs=require(_0x429f('0xb'));var fs=require('fs');var fs_extra=require(_0x429f('0xc'));var _=require(_0x429f('0xd'));var squel=require(_0x429f('0xe'));var crypto=require('crypto');var jsforce=require(_0x429f('0xf'));var deskjs=require(_0x429f('0x10'));var toCsv=require(_0x429f('0x11'));var querystring=require('querystring');var Papa=require(_0x429f('0x12'));var Redis=require('ioredis');var authService=require(_0x429f('0x13'));var qs=require(_0x429f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x429f('0x15'));var logger=require('../../config/logger')(_0x429f('0x16'));var utils=require(_0x429f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x429f('0x18'))['db'];config[_0x429f('0x19')]=_[_0x429f('0x1a')](config[_0x429f('0x19')],{'host':_0x429f('0x1b'),'port':0x18eb});var socket=require(_0x429f('0x1c'))(new Redis(config[_0x429f('0x19')]));require('./smsMessage.socket')[_0x429f('0x1d')](socket);var jayson=require(_0x429f('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x429f('0x1f')][_0x429f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2aee9b,_0x24a12c,_0xea3a53,_0xcea7c7){return new BPromise(function(_0x39e8dd,_0x29d04e){var _0x187e4a=_0xcea7c7||client;return _0x187e4a[_0x429f('0x21')](_0x2aee9b,_0xea3a53)[_0x429f('0x22')](function(_0x46ad81){logger[_0x429f('0x23')](_0x429f('0x24'),_0x24a12c,_0x429f('0x25'));logger['debug'](_0x429f('0x26'),_0x24a12c,_0x429f('0x25'),JSON[_0x429f('0x27')](_0x46ad81));if(_0x46ad81[_0x429f('0x28')]){if(_0x46ad81[_0x429f('0x28')][_0x429f('0x29')]===0x1f4){logger[_0x429f('0x28')](_0x429f('0x24'),_0x24a12c,_0x46ad81[_0x429f('0x28')][_0x429f('0x2a')]);return _0x29d04e(_0x46ad81[_0x429f('0x28')][_0x429f('0x2a')]);}logger[_0x429f('0x28')](_0x429f('0x24'),_0x24a12c,_0x46ad81[_0x429f('0x28')][_0x429f('0x2a')]);return _0x39e8dd(_0x46ad81[_0x429f('0x28')][_0x429f('0x2a')]);}else{logger[_0x429f('0x23')](_0x429f('0x24'),_0x24a12c,_0x429f('0x25'));_0x39e8dd(_0x46ad81[_0x429f('0x2b')]['message']);}})[_0x429f('0x2c')](function(_0x22af11){logger[_0x429f('0x28')](_0x429f('0x24'),_0x24a12c,_0x22af11);_0x29d04e(_0x22af11);});});}function respondWithStatusCode(_0x1ec627,_0x3bb20a){_0x3bb20a=_0x3bb20a||0xcc;return function(_0x10b7e2){if(_0x10b7e2){return _0x1ec627[_0x429f('0x2d')](_0x3bb20a);}return _0x1ec627[_0x429f('0x2e')](_0x3bb20a)['end']();};}function respondWithResult(_0x5ce926,_0x552aa4){_0x552aa4=_0x552aa4||0xc8;return function(_0x2215fd){if(_0x2215fd){return _0x5ce926[_0x429f('0x2e')](_0x552aa4)[_0x429f('0x2f')](_0x2215fd);}};}function respondWithFilteredResult(_0x55e153,_0x2a8a38){return function(_0x21c2ae){if(_0x21c2ae){var _0x41299a=typeof _0x2a8a38[_0x429f('0x30')]===_0x429f('0x31')&&typeof _0x2a8a38[_0x429f('0x32')]===_0x429f('0x31');var _0x121983=_0x21c2ae[_0x429f('0x33')];var _0x469a38=_0x41299a?0x0:_0x2a8a38[_0x429f('0x30')];var _0x3c9a7b=_0x41299a?_0x21c2ae['count']:_0x2a8a38[_0x429f('0x30')]+_0x2a8a38[_0x429f('0x32')];var _0x1f5456;if(_0x3c9a7b>=_0x121983){_0x3c9a7b=_0x121983;_0x1f5456=0xc8;}else{_0x1f5456=0xce;}_0x55e153[_0x429f('0x2e')](_0x1f5456);return _0x55e153['set']('Content-Range',_0x469a38+'-'+_0x3c9a7b+'/'+_0x121983)['json'](_0x21c2ae);}return null;};}function patchUpdates(_0x5e336e){return function(_0x57bd3b){try{jsonpatch['apply'](_0x57bd3b,_0x5e336e,!![]);}catch(_0x54acf2){return BPromise[_0x429f('0x34')](_0x54acf2);}return _0x57bd3b[_0x429f('0x35')]();};}function saveUpdates(_0x467fad,_0x3e708a){return function(_0x18ea3c){if(_0x18ea3c){return _0x18ea3c[_0x429f('0x36')](_0x467fad)[_0x429f('0x22')](function(_0x5556e0){return _0x5556e0;});}return null;};}function removeEntity(_0x51a535,_0xce07e3){return function(_0xc0a197){if(_0xc0a197){return _0xc0a197[_0x429f('0x37')]()['then'](function(){_0x51a535[_0x429f('0x2e')](0xcc)[_0x429f('0x38')]();});}};}function handleEntityNotFound(_0x54b514,_0x18a9b1){return function(_0x588419){if(!_0x588419){_0x54b514['sendStatus'](0x194);}return _0x588419;};}function handleError(_0x4a632f,_0x3c76b2){_0x3c76b2=_0x3c76b2||0x1f4;return function(_0x23d90f){logger['error'](_0x23d90f[_0x429f('0x39')]);if(_0x23d90f[_0x429f('0x3a')]){delete _0x23d90f[_0x429f('0x3a')];}_0x4a632f['status'](_0x3c76b2)[_0x429f('0x3b')](_0x23d90f);};}exports[_0x429f('0x3c')]=function(_0x41a6fd,_0x1ced88){var _0x4cca40={},_0x267c98={},_0x4b9251={'count':0x0,'rows':[]};var _0x518e4c=_['map'](db['SmsMessage'][_0x429f('0x3d')],function(_0x4a65e5){return{'name':_0x4a65e5[_0x429f('0x3e')],'type':_0x4a65e5[_0x429f('0x3f')][_0x429f('0x40')]};});_0x267c98[_0x429f('0x41')]=_['map'](_0x518e4c,'name');_0x267c98['query']=_['keys'](_0x41a6fd[_0x429f('0x42')]);_0x267c98[_0x429f('0x43')]=_[_0x429f('0x44')](_0x267c98[_0x429f('0x41')],_0x267c98[_0x429f('0x42')]);_0x4cca40[_0x429f('0x45')]=_['intersection'](_0x267c98[_0x429f('0x41')],qs['fields'](_0x41a6fd[_0x429f('0x42')]['fields']));_0x4cca40[_0x429f('0x45')]=_0x4cca40[_0x429f('0x45')][_0x429f('0x46')]?_0x4cca40['attributes']:_0x267c98[_0x429f('0x41')];if(!_0x41a6fd['query']['hasOwnProperty'](_0x429f('0x47'))){_0x4cca40['limit']=qs[_0x429f('0x32')](_0x41a6fd[_0x429f('0x42')][_0x429f('0x32')]);_0x4cca40[_0x429f('0x30')]=qs['offset'](_0x41a6fd['query'][_0x429f('0x30')]);}_0x4cca40['order']=qs[_0x429f('0x48')](_0x41a6fd[_0x429f('0x42')][_0x429f('0x48')]);_0x4cca40[_0x429f('0x49')]=qs[_0x429f('0x43')](_[_0x429f('0x4a')](_0x41a6fd[_0x429f('0x42')],_0x267c98[_0x429f('0x43')]),_0x518e4c);if(_0x41a6fd[_0x429f('0x42')][_0x429f('0x4b')]){_0x4cca40[_0x429f('0x49')]=_['merge'](_0x4cca40['where'],{'$or':_[_0x429f('0x4c')](_0x518e4c,function(_0x33957b){if(_0x33957b[_0x429f('0x3f')]!==_0x429f('0x4d')){var _0x54ac2e={};_0x54ac2e[_0x33957b[_0x429f('0x3a')]]={'$like':'%'+_0x41a6fd[_0x429f('0x42')]['filter']+'%'};return _0x54ac2e;}})});}_0x4cca40=_[_0x429f('0x4e')]({},_0x4cca40,_0x41a6fd['options']);var _0x3c1e30={'where':_0x4cca40[_0x429f('0x49')]};return db[_0x429f('0x4f')]['count'](_0x3c1e30)[_0x429f('0x22')](function(_0x410648){_0x4b9251[_0x429f('0x33')]=_0x410648;if(_0x41a6fd[_0x429f('0x42')][_0x429f('0x50')]){_0x4cca40[_0x429f('0x51')]=[{'all':!![]}];}return db[_0x429f('0x4f')]['findAll'](_0x4cca40);})[_0x429f('0x22')](function(_0x2d2fff){_0x4b9251[_0x429f('0x52')]=_0x2d2fff;return _0x4b9251;})[_0x429f('0x22')](respondWithFilteredResult(_0x1ced88,_0x4cca40))['catch'](handleError(_0x1ced88,null));};exports[_0x429f('0x53')]=function(_0x506a1f,_0x7eb597){var _0x286c89={'raw':!![],'where':{'id':_0x506a1f['params']['id']}},_0x44d61b={};_0x44d61b[_0x429f('0x41')]=_[_0x429f('0x54')](db['SmsMessage'][_0x429f('0x3d')]);_0x44d61b['query']=_[_0x429f('0x54')](_0x506a1f[_0x429f('0x42')]);_0x44d61b[_0x429f('0x43')]=_['intersection'](_0x44d61b['model'],_0x44d61b[_0x429f('0x42')]);_0x286c89['attributes']=_[_0x429f('0x44')](_0x44d61b[_0x429f('0x41')],qs[_0x429f('0x55')](_0x506a1f['query'][_0x429f('0x55')]));_0x286c89[_0x429f('0x45')]=_0x286c89[_0x429f('0x45')]['length']?_0x286c89[_0x429f('0x45')]:_0x44d61b[_0x429f('0x41')];if(_0x506a1f['query'][_0x429f('0x50')]){_0x286c89[_0x429f('0x51')]=[{'all':!![]}];}_0x286c89=_[_0x429f('0x4e')]({},_0x286c89,_0x506a1f['options']);return db[_0x429f('0x4f')][_0x429f('0x56')](_0x286c89)['then'](handleEntityNotFound(_0x7eb597,null))[_0x429f('0x22')](respondWithResult(_0x7eb597,null))[_0x429f('0x2c')](handleError(_0x7eb597,null));};exports[_0x429f('0x57')]=function(_0x120cdc,_0x3a1aac){return db['SmsMessage'][_0x429f('0x57')](_0x120cdc['body'],{})[_0x429f('0x22')](respondWithResult(_0x3a1aac,0xc9))['catch'](handleError(_0x3a1aac,null));};exports['update']=function(_0x417a06,_0x170ff3){if(_0x417a06[_0x429f('0x58')]['id']){delete _0x417a06[_0x429f('0x58')]['id'];}return db[_0x429f('0x4f')][_0x429f('0x56')]({'where':{'id':_0x417a06[_0x429f('0x59')]['id']}})[_0x429f('0x22')](handleEntityNotFound(_0x170ff3,null))[_0x429f('0x22')](saveUpdates(_0x417a06[_0x429f('0x58')],null))[_0x429f('0x22')](respondWithResult(_0x170ff3,null))[_0x429f('0x2c')](handleError(_0x170ff3,null));};exports[_0x429f('0x37')]=function(_0x37904a,_0x29ba2e){return db[_0x429f('0x4f')][_0x429f('0x56')]({'where':{'id':_0x37904a[_0x429f('0x59')]['id']}})[_0x429f('0x22')](handleEntityNotFound(_0x29ba2e,null))[_0x429f('0x22')](removeEntity(_0x29ba2e,null))[_0x429f('0x2c')](handleError(_0x29ba2e,null));};exports[_0x429f('0x5a')]=function(_0x34a396,_0x34985c){return db[_0x429f('0x4f')][_0x429f('0x5a')]()[_0x429f('0x22')](respondWithResult(_0x34985c,null))[_0x429f('0x2c')](handleError(_0x34985c,null));};var interaction_log=require(_0x429f('0x5b'))('sms-interactions');exports[_0x429f('0x5c')]=function(_0x62b5b4,_0x4059ce,_0xae27a5){var _0x9b2e2={'agent':{},'channel':'sms'};if(_0x62b5b4[_0x429f('0x58')]['id']){delete _0x62b5b4[_0x429f('0x58')]['id'];}_0x62b5b4[_0x429f('0x58')][_0x429f('0x5d')]=!![];_0x62b5b4['body'][_0x429f('0x5e')]=moment()[_0x429f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x62b5b4[_0x429f('0x58')][_0x429f('0x60')]=_0x62b5b4['body'][_0x429f('0x60')]||_0x62b5b4[_0x429f('0x61')]['id'];_0x9b2e2['agent']['id']=_0x62b5b4[_0x429f('0x58')][_0x429f('0x60')];return db['SmsMessage'][_0x429f('0x56')]({'where':{'id':_0x62b5b4['params']['id'],'UserId':null}})[_0x429f('0x22')](handleEntityNotFound(_0x4059ce,null))[_0x429f('0x22')](saveUpdates(_0x62b5b4[_0x429f('0x58')],null))[_0x429f('0x22')](function(_0x1f8419){if(_0x1f8419){_0x9b2e2[_0x429f('0x2a')]=_0x1f8419[_0x429f('0x62')]({'plain':!![]});return db[_0x429f('0x63')][_0x429f('0x56')]({'where':{'id':_0x1f8419[_0x429f('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x4059ce,null))[_0x429f('0x22')](function(_0x4afdf3){if(_0x4afdf3){return _0x4afdf3[_0x429f('0x36')]({'UserId':_0x62b5b4[_0x429f('0x58')][_0x429f('0x60')],'read1stAt':_[_0x429f('0x65')](_0x4afdf3[_0x429f('0x66')])?moment()[_0x429f('0x5f')](_0x429f('0x67')):undefined});}return null;})['then'](function(_0x215a4f){if(_0x215a4f){_0x9b2e2[_0x429f('0x68')]=_0x215a4f[_0x429f('0x62')]({'plain':!![]});interaction_log['info'](_0x429f('0x69'),_0x62b5b4[_0x429f('0x61')]['id'],_0x62b5b4['user'][_0x429f('0x3a')],_0x62b5b4[_0x429f('0x61')][_0x429f('0x6a')],_0x9b2e2[_0x429f('0x68')]['id'],_0x62b5b4[_0x429f('0x58')]?JSON[_0x429f('0x27')](_0x62b5b4[_0x429f('0x58')]):'null');return respondWithRpcPromise(_0x429f('0x6b'),_0x429f('0x6c'),_0x9b2e2);}return null;})['then'](function(_0x27655a){var _0x73873f=_0x429f('0x6d')+_0x27655a[_0x429f('0x2a')]['ContactId'];return db[_0x429f('0x6e')][_0x429f('0x42')](_0x73873f,{'type':db[_0x429f('0x6f')][_0x429f('0x70')]['SELECT'],'raw':!![]})[_0x429f('0x22')](function(_0x4e7d47){return _0x4e7d47;});})[_0x429f('0x22')](function(_0x14ea07){if(_0x14ea07){_0x9b2e2[_0x429f('0x2a')][_0x429f('0x71')]=_0x14ea07[0x0];if(!_0x62b5b4[_0x429f('0x58')]['UserId'])return;return db[_0x429f('0x72')][_0x429f('0x56')]({'where':{'id':_0x62b5b4[_0x429f('0x58')][_0x429f('0x60')],'role':_0x429f('0x73')},'attributes':['id',_0x429f('0x3a'),_0x429f('0x74'),_0x429f('0x75'),_0x429f('0x76')],'raw':!![]});}return null;})[_0x429f('0x22')](function(_0x2edcf8){if(!_0x2edcf8)return null;_0x9b2e2['message'][_0x429f('0x73')]=_0x2edcf8;return _0x9b2e2;})[_0x429f('0x22')](function(_0x3d28dd){if(_0x3d28dd){if(_0x62b5b4['body']['manual']){_0x9b2e2[_0x429f('0x2a')][_0x429f('0x77')]=util[_0x429f('0x5f')](_0x429f('0x78'),_0x62b5b4[_0x429f('0x61')][_0x429f('0x3a')]);_0x9b2e2[_0x429f('0x2a')][_0x429f('0x79')]=_0x9b2e2[_0x429f('0x79')];_0x9b2e2[_0x429f('0x2a')][_0x429f('0x7a')]=_0x9b2e2[_0x429f('0x79')];_0x9b2e2['message'][_0x429f('0x7b')]=_0x429f('0x5c');return respondWithRpcPromise(_0x429f('0x7c'),_0x429f('0x7c'),{'event':'acceptmessage','message':_0x9b2e2[_0x429f('0x2a')]},client9002)[_0x429f('0x22')](function(){return _0x9b2e2;});}return _0x9b2e2;}return null;})[_0x429f('0x22')](respondWithResult(_0x4059ce,null))['catch'](handleError(_0x4059ce,null));};var interaction_log=require(_0x429f('0x5b'))(_0x429f('0x7d'));exports[_0x429f('0x34')]=function(_0xe4a540,_0x2c0eb1,_0x2faa0c){var _0x371d68={'agent':{},'channel':'sms'};if(_0xe4a540[_0x429f('0x58')]['id']){delete _0xe4a540[_0x429f('0x58')]['id'];}_0xe4a540['body'][_0x429f('0x60')]=_0xe4a540['body'][_0x429f('0x60')]||_0xe4a540['user']['id'];_0x371d68[_0x429f('0x73')]['id']=_0xe4a540[_0x429f('0x58')]['UserId'];return db['SmsMessage'][_0x429f('0x56')]({'where':{'id':_0xe4a540[_0x429f('0x59')]['id'],'UserId':null}})[_0x429f('0x22')](handleEntityNotFound(_0x2c0eb1,null))[_0x429f('0x22')](function(_0x58a776){if(_0x58a776){_0x371d68['message']=_0x58a776[_0x429f('0x62')]({'plain':!![]});return db[_0x429f('0x63')][_0x429f('0x56')]({'where':{'id':_0x58a776[_0x429f('0x64')]}});}return null;})[_0x429f('0x22')](handleEntityNotFound(_0x2c0eb1,null))['then'](function(_0xa40eda){if(_0xa40eda){_0x371d68[_0x429f('0x68')]=_0xa40eda[_0x429f('0x62')]({'plain':!![]});interaction_log[_0x429f('0x23')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe4a540['user']['id'],_0xe4a540[_0x429f('0x61')][_0x429f('0x3a')],_0xe4a540[_0x429f('0x61')][_0x429f('0x6a')],_0x371d68[_0x429f('0x68')]['id'],_0xe4a540[_0x429f('0x58')]?JSON[_0x429f('0x27')](_0xe4a540[_0x429f('0x58')]):_0x429f('0x7e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x371d68);}return null;})[_0x429f('0x22')](function(_0x5c4780){var _0x257a19=_0x429f('0x6d')+_0x5c4780[_0x429f('0x2a')][_0x429f('0x7f')];return db[_0x429f('0x6e')][_0x429f('0x42')](_0x257a19,{'type':db[_0x429f('0x6f')][_0x429f('0x70')][_0x429f('0x80')],'raw':!![]})['then'](function(_0x32759a){return _0x32759a;});})[_0x429f('0x22')](function(_0x218fc2){if(_0x218fc2){_0x371d68[_0x429f('0x2a')][_0x429f('0x71')]=_0x218fc2[0x0];if(!_0xe4a540[_0x429f('0x58')][_0x429f('0x60')])return;return db[_0x429f('0x72')][_0x429f('0x56')]({'where':{'id':_0xe4a540[_0x429f('0x58')][_0x429f('0x60')],'role':_0x429f('0x73')},'attributes':['id',_0x429f('0x3a'),_0x429f('0x74'),_0x429f('0x75'),_0x429f('0x76')],'raw':!![]});}return null;})['then'](function(_0xa763c7){if(!_0xa763c7)return null;_0x371d68['message'][_0x429f('0x73')]=_0xa763c7;return _0x371d68;})[_0x429f('0x22')](function(_0xedfcdd){if(_0xedfcdd){_0xedfcdd[_0x429f('0x2a')][_0x429f('0x77')]=util[_0x429f('0x5f')](_0x429f('0x78'),_0xe4a540[_0x429f('0x61')]['name']);_0xedfcdd['message'][_0x429f('0x79')]=_0x371d68[_0x429f('0x79')];_0xedfcdd[_0x429f('0x2a')][_0x429f('0x7a')]=_0x371d68[_0x429f('0x79')];_0xedfcdd[_0x429f('0x2a')]['event']=_0x429f('0x34');respondWithRpcPromise(_0x429f('0x7c'),'EventManager',{'event':'rejectmessage','message':_0xedfcdd[_0x429f('0x2a')]},client9002);return _0x371d68;}return null;})[_0x429f('0x22')](respondWithResult(_0x2c0eb1,null))[_0x429f('0x2c')](handleError(_0x2c0eb1,null));};exports[_0x429f('0x2e')]=function(_0x2a7110,_0x212400,_0x50ec5c){if(_0x2a7110['body']['id']){delete _0x2a7110['body']['id'];}var _0x5c4cae;return db[_0x429f('0x4f')][_0x429f('0x56')]({'where':{'id':_0x2a7110[_0x429f('0x59')]['id']}})['then'](handleEntityNotFound(_0x212400,null))['then'](function(_0x56f4b8){if(_0x56f4b8){_0x5c4cae=_0x56f4b8;return db['SmsAccount'][_0x429f('0x56')]({'where':{'id':_0x56f4b8[_0x429f('0x81')]}});}})[_0x429f('0x22')](handleEntityNotFound(_0x212400,null))[_0x429f('0x22')](function(_0x244bb7){if(_0x244bb7){logger['debug'](_0x429f('0x26'),_0x429f('0x2e'),_0x429f('0x82'),_0x244bb7[_0x429f('0x3f')],util['inspect'](_0x2a7110[_0x429f('0x58')],{'showHidden':![],'depth':null}));switch(_0x244bb7[_0x429f('0x3f')]){case _0x429f('0x83'):if(_0x2a7110['body'][_0x429f('0x84')]&&_0x2a7110[_0x429f('0x58')][_0x429f('0x84')]===_0x5c4cae[_0x429f('0x85')]){return _0x5c4cae[_0x429f('0x36')]({'read':!![]});}else{logger[_0x429f('0x28')](_0x429f('0x86'),_0x429f('0x2e'),_0x429f('0x83'),util[_0x429f('0x87')](_0x2a7110[_0x429f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x429f('0x88'):if(_0x2a7110[_0x429f('0x58')]['MessageUUID']&&_0x2a7110[_0x429f('0x58')][_0x429f('0x89')]===_0x5c4cae[_0x429f('0x85')]&&_[_0x429f('0x8a')]([_0x429f('0x8b'),_0x429f('0x8c')],_0x2a7110['body']['Status'])>=0x0){return _0x5c4cae[_0x429f('0x36')]({'read':!![]});}else{logger[_0x429f('0x28')](_0x429f('0x86'),'status',_0x429f('0x8d'),util[_0x429f('0x87')](_0x2a7110[_0x429f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x429f('0x8e'):var _0x531d92=_0x2a7110[_0x429f('0x58')][_0x429f('0x8f')][0x0];if(_0x531d92[_0x429f('0x2e')][_0x429f('0x90')]===_0x429f('0x91')){return _0x5c4cae[_0x429f('0x36')]({'read':!![]});}else{logger[_0x429f('0x28')](_0x429f('0x86'),_0x429f('0x2e'),'infobip',util[_0x429f('0x87')](_0x2a7110[_0x429f('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5c4cae;}})[_0x429f('0x22')](respondWithResult(_0x212400,null))[_0x429f('0x2c')](handleError(_0x212400,null));}; \ No newline at end of file +var _0x2525=['null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','User','email','internal','agent','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','fullname','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','send','index','map','SmsMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','rawAttributes','length','include','find','create','body','params','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x1e26a0,_0x24350a){var _0x4e23e3=function(_0x6cb0a){while(--_0x6cb0a){_0x1e26a0['push'](_0x1e26a0['shift']());}};_0x4e23e3(++_0x24350a);}(_0x2525,0x1f0));var _0x5252=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x2525[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0x5252('0x0'));var rimraf=require(_0x5252('0x1'));var zipdir=require(_0x5252('0x2'));var jsonpatch=require(_0x5252('0x3'));var rp=require(_0x5252('0x4'));var moment=require(_0x5252('0x5'));var BPromise=require(_0x5252('0x6'));var Mustache=require(_0x5252('0x7'));var util=require(_0x5252('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5252('0x9'));var ejs=require(_0x5252('0xa'));var fs=require('fs');var fs_extra=require(_0x5252('0xb'));var _=require(_0x5252('0xc'));var squel=require(_0x5252('0xd'));var crypto=require(_0x5252('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5252('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5252('0x10'));var Papa=require(_0x5252('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5252('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5252('0x13'));var logger=require(_0x5252('0x14'))(_0x5252('0x15'));var utils=require(_0x5252('0x16'));var config=require(_0x5252('0x17'));var licenseUtil=require(_0x5252('0x18'));var db=require(_0x5252('0x19'))['db'];config[_0x5252('0x1a')]=_[_0x5252('0x1b')](config[_0x5252('0x1a')],{'host':_0x5252('0x1c'),'port':0x18eb});var socket=require(_0x5252('0x1d'))(new Redis(config[_0x5252('0x1a')]));require(_0x5252('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5252('0x1f')][_0x5252('0x20')]({'port':0x232c});var client9002=jayson[_0x5252('0x1f')][_0x5252('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x399a71,_0x3e54d1,_0x3aeab1,_0x5e1fb4){return new BPromise(function(_0x4b244a,_0x4f7a8d){var _0xa24f14=_0x5e1fb4||client;return _0xa24f14[_0x5252('0x21')](_0x399a71,_0x3aeab1)[_0x5252('0x22')](function(_0x10eb1e){logger[_0x5252('0x23')](_0x5252('0x24'),_0x3e54d1,_0x5252('0x25'));logger['debug'](_0x5252('0x26'),_0x3e54d1,_0x5252('0x25'),JSON[_0x5252('0x27')](_0x10eb1e));if(_0x10eb1e[_0x5252('0x28')]){if(_0x10eb1e[_0x5252('0x28')]['code']===0x1f4){logger[_0x5252('0x28')](_0x5252('0x24'),_0x3e54d1,_0x10eb1e[_0x5252('0x28')][_0x5252('0x29')]);return _0x4f7a8d(_0x10eb1e[_0x5252('0x28')][_0x5252('0x29')]);}logger['error'](_0x5252('0x24'),_0x3e54d1,_0x10eb1e[_0x5252('0x28')]['message']);return _0x4b244a(_0x10eb1e['error']['message']);}else{logger['info'](_0x5252('0x24'),_0x3e54d1,_0x5252('0x25'));_0x4b244a(_0x10eb1e['result'][_0x5252('0x29')]);}})[_0x5252('0x2a')](function(_0x5976e5){logger['error'](_0x5252('0x24'),_0x3e54d1,_0x5976e5);_0x4f7a8d(_0x5976e5);});});}function respondWithStatusCode(_0x57f24c,_0x2d74af){_0x2d74af=_0x2d74af||0xcc;return function(_0xc7f144){if(_0xc7f144){return _0x57f24c[_0x5252('0x2b')](_0x2d74af);}return _0x57f24c[_0x5252('0x2c')](_0x2d74af)[_0x5252('0x2d')]();};}function respondWithResult(_0x5d1b23,_0x537f52){_0x537f52=_0x537f52||0xc8;return function(_0x39e1fd){if(_0x39e1fd){return _0x5d1b23['status'](_0x537f52)[_0x5252('0x2e')](_0x39e1fd);}};}function respondWithFilteredResult(_0x5abb6a,_0x4a7d0b){return function(_0x4fb047){if(_0x4fb047){var _0x4ac8b8=typeof _0x4a7d0b[_0x5252('0x2f')]===_0x5252('0x30')&&typeof _0x4a7d0b[_0x5252('0x31')]==='undefined';var _0x23b62c=_0x4fb047[_0x5252('0x32')];var _0x8fd7df=_0x4ac8b8?0x0:_0x4a7d0b[_0x5252('0x2f')];var _0x346f0a=_0x4ac8b8?_0x4fb047[_0x5252('0x32')]:_0x4a7d0b[_0x5252('0x2f')]+_0x4a7d0b[_0x5252('0x31')];var _0x494fb1;if(_0x346f0a>=_0x23b62c){_0x346f0a=_0x23b62c;_0x494fb1=0xc8;}else{_0x494fb1=0xce;}_0x5abb6a[_0x5252('0x2c')](_0x494fb1);return _0x5abb6a['set'](_0x5252('0x33'),_0x8fd7df+'-'+_0x346f0a+'/'+_0x23b62c)[_0x5252('0x2e')](_0x4fb047);}return null;};}function patchUpdates(_0x3554c7){return function(_0x571883){try{jsonpatch[_0x5252('0x34')](_0x571883,_0x3554c7,!![]);}catch(_0x55ea27){return BPromise[_0x5252('0x35')](_0x55ea27);}return _0x571883[_0x5252('0x36')]();};}function saveUpdates(_0x11708e,_0x452dfb){return function(_0x482dd2){if(_0x482dd2){return _0x482dd2[_0x5252('0x37')](_0x11708e)['then'](function(_0x5cf891){return _0x5cf891;});}return null;};}function removeEntity(_0x5cd743,_0x372edc){return function(_0x5773e8){if(_0x5773e8){return _0x5773e8[_0x5252('0x38')]()[_0x5252('0x22')](function(){_0x5cd743[_0x5252('0x2c')](0xcc)[_0x5252('0x2d')]();});}};}function handleEntityNotFound(_0x4aeb94,_0x4e1c96){return function(_0x4e3b3d){if(!_0x4e3b3d){_0x4aeb94['sendStatus'](0x194);}return _0x4e3b3d;};}function handleError(_0x21a892,_0x1a8480){_0x1a8480=_0x1a8480||0x1f4;return function(_0x3cb4ea){logger[_0x5252('0x28')](_0x3cb4ea['stack']);if(_0x3cb4ea[_0x5252('0x39')]){delete _0x3cb4ea[_0x5252('0x39')];}_0x21a892['status'](_0x1a8480)[_0x5252('0x3a')](_0x3cb4ea);};}exports[_0x5252('0x3b')]=function(_0x43c1ce,_0x5f1cdb){var _0x5b7004={},_0xd54c3d={},_0x536bb8={'count':0x0,'rows':[]};var _0xf96489=_[_0x5252('0x3c')](db[_0x5252('0x3d')]['rawAttributes'],function(_0x2e7a13){return{'name':_0x2e7a13[_0x5252('0x3e')],'type':_0x2e7a13['type'][_0x5252('0x3f')]};});_0xd54c3d[_0x5252('0x40')]=_['map'](_0xf96489,_0x5252('0x39'));_0xd54c3d[_0x5252('0x41')]=_[_0x5252('0x42')](_0x43c1ce[_0x5252('0x41')]);_0xd54c3d[_0x5252('0x43')]=_[_0x5252('0x44')](_0xd54c3d['model'],_0xd54c3d['query']);_0x5b7004[_0x5252('0x45')]=_['intersection'](_0xd54c3d[_0x5252('0x40')],qs['fields'](_0x43c1ce[_0x5252('0x41')][_0x5252('0x46')]));_0x5b7004['attributes']=_0x5b7004[_0x5252('0x45')]['length']?_0x5b7004[_0x5252('0x45')]:_0xd54c3d[_0x5252('0x40')];if(!_0x43c1ce[_0x5252('0x41')][_0x5252('0x47')](_0x5252('0x48'))){_0x5b7004[_0x5252('0x31')]=qs['limit'](_0x43c1ce['query'][_0x5252('0x31')]);_0x5b7004[_0x5252('0x2f')]=qs[_0x5252('0x2f')](_0x43c1ce[_0x5252('0x41')]['offset']);}_0x5b7004['order']=qs[_0x5252('0x49')](_0x43c1ce[_0x5252('0x41')][_0x5252('0x49')]);_0x5b7004['where']=qs[_0x5252('0x43')](_[_0x5252('0x4a')](_0x43c1ce['query'],_0xd54c3d[_0x5252('0x43')]),_0xf96489);if(_0x43c1ce[_0x5252('0x41')][_0x5252('0x4b')]){_0x5b7004['where']=_[_0x5252('0x4c')](_0x5b7004[_0x5252('0x4d')],{'$or':_['map'](_0xf96489,function(_0x1019a7){if(_0x1019a7['type']!==_0x5252('0x4e')){var _0x5a3f76={};_0x5a3f76[_0x1019a7[_0x5252('0x39')]]={'$like':'%'+_0x43c1ce['query'][_0x5252('0x4b')]+'%'};return _0x5a3f76;}})});}_0x5b7004=_[_0x5252('0x4c')]({},_0x5b7004,_0x43c1ce[_0x5252('0x4f')]);var _0x2520d7={'where':_0x5b7004[_0x5252('0x4d')]};return db[_0x5252('0x3d')]['count'](_0x2520d7)[_0x5252('0x22')](function(_0x5a7bf5){_0x536bb8[_0x5252('0x32')]=_0x5a7bf5;if(_0x43c1ce[_0x5252('0x41')][_0x5252('0x50')]){_0x5b7004['include']=[{'all':!![]}];}return db['SmsMessage'][_0x5252('0x51')](_0x5b7004);})['then'](function(_0x2c9c42){_0x536bb8['rows']=_0x2c9c42;return _0x536bb8;})[_0x5252('0x22')](respondWithFilteredResult(_0x5f1cdb,_0x5b7004))[_0x5252('0x2a')](handleError(_0x5f1cdb,null));};exports[_0x5252('0x52')]=function(_0x4dbd29,_0x3c9d5d){var _0x18becf={'raw':!![],'where':{'id':_0x4dbd29['params']['id']}},_0x592677={};_0x592677['model']=_['keys'](db[_0x5252('0x3d')][_0x5252('0x53')]);_0x592677['query']=_['keys'](_0x4dbd29['query']);_0x592677[_0x5252('0x43')]=_[_0x5252('0x44')](_0x592677[_0x5252('0x40')],_0x592677[_0x5252('0x41')]);_0x18becf[_0x5252('0x45')]=_['intersection'](_0x592677['model'],qs[_0x5252('0x46')](_0x4dbd29[_0x5252('0x41')][_0x5252('0x46')]));_0x18becf[_0x5252('0x45')]=_0x18becf['attributes'][_0x5252('0x54')]?_0x18becf[_0x5252('0x45')]:_0x592677['model'];if(_0x4dbd29[_0x5252('0x41')][_0x5252('0x50')]){_0x18becf[_0x5252('0x55')]=[{'all':!![]}];}_0x18becf=_['merge']({},_0x18becf,_0x4dbd29[_0x5252('0x4f')]);return db[_0x5252('0x3d')][_0x5252('0x56')](_0x18becf)['then'](handleEntityNotFound(_0x3c9d5d,null))['then'](respondWithResult(_0x3c9d5d,null))['catch'](handleError(_0x3c9d5d,null));};exports[_0x5252('0x57')]=function(_0xeeee06,_0x3151aa){return db[_0x5252('0x3d')][_0x5252('0x57')](_0xeeee06[_0x5252('0x58')],{})[_0x5252('0x22')](respondWithResult(_0x3151aa,0xc9))[_0x5252('0x2a')](handleError(_0x3151aa,null));};exports[_0x5252('0x37')]=function(_0x516dae,_0x49f62f){if(_0x516dae[_0x5252('0x58')]['id']){delete _0x516dae['body']['id'];}return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x516dae['params']['id']}})[_0x5252('0x22')](handleEntityNotFound(_0x49f62f,null))[_0x5252('0x22')](saveUpdates(_0x516dae[_0x5252('0x58')],null))['then'](respondWithResult(_0x49f62f,null))[_0x5252('0x2a')](handleError(_0x49f62f,null));};exports['destroy']=function(_0xdd056d,_0x5b3a79){return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0xdd056d[_0x5252('0x59')]['id']}})[_0x5252('0x22')](handleEntityNotFound(_0x5b3a79,null))[_0x5252('0x22')](removeEntity(_0x5b3a79,null))[_0x5252('0x2a')](handleError(_0x5b3a79,null));};exports[_0x5252('0x5a')]=function(_0x1b4e84,_0x1f2ab7){return db[_0x5252('0x3d')][_0x5252('0x5a')]()['then'](respondWithResult(_0x1f2ab7,null))[_0x5252('0x2a')](handleError(_0x1f2ab7,null));};var interaction_log=require(_0x5252('0x14'))(_0x5252('0x5b'));exports[_0x5252('0x5c')]=function(_0x4b52fe,_0xe613bc,_0x541222){var _0x385bbe={'agent':{},'channel':_0x5252('0x5d')};if(_0x4b52fe['body']['id']){delete _0x4b52fe[_0x5252('0x58')]['id'];}_0x4b52fe['body']['read']=!![];_0x4b52fe[_0x5252('0x58')][_0x5252('0x5e')]=moment()[_0x5252('0x5f')](_0x5252('0x60'));_0x4b52fe[_0x5252('0x58')]['UserId']=_0x4b52fe[_0x5252('0x58')]['UserId']||_0x4b52fe[_0x5252('0x61')]['id'];_0x385bbe['agent']['id']=_0x4b52fe[_0x5252('0x58')]['UserId'];return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x4b52fe['params']['id'],'UserId':null}})[_0x5252('0x22')](handleEntityNotFound(_0xe613bc,null))[_0x5252('0x22')](saveUpdates(_0x4b52fe[_0x5252('0x58')],null))[_0x5252('0x22')](function(_0x5b2c5d){if(_0x5b2c5d){_0x385bbe['message']=_0x5b2c5d[_0x5252('0x62')]({'plain':!![]});return db[_0x5252('0x63')][_0x5252('0x56')]({'where':{'id':_0x5b2c5d[_0x5252('0x64')]}});}return null;})[_0x5252('0x22')](handleEntityNotFound(_0xe613bc,null))['then'](function(_0x2cc8a5){if(_0x2cc8a5){return _0x2cc8a5['update']({'UserId':_0x4b52fe[_0x5252('0x58')]['UserId'],'read1stAt':_['isNil'](_0x2cc8a5['read1stAt'])?moment()[_0x5252('0x5f')](_0x5252('0x60')):undefined});}return null;})[_0x5252('0x22')](function(_0x331462){if(_0x331462){_0x385bbe[_0x5252('0x65')]=_0x331462[_0x5252('0x62')]({'plain':!![]});interaction_log[_0x5252('0x23')](_0x5252('0x66'),_0x4b52fe[_0x5252('0x61')]['id'],_0x4b52fe[_0x5252('0x61')][_0x5252('0x39')],_0x4b52fe[_0x5252('0x61')][_0x5252('0x67')],_0x385bbe[_0x5252('0x65')]['id'],_0x4b52fe[_0x5252('0x58')]?JSON[_0x5252('0x27')](_0x4b52fe[_0x5252('0x58')]):_0x5252('0x68'));return respondWithRpcPromise(_0x5252('0x69'),'acceptMessage',_0x385bbe);}return null;})[_0x5252('0x22')](function(_0x572106){var _0x3b4f3c=_0x5252('0x6a')+_0x572106[_0x5252('0x29')]['ContactId'];return db[_0x5252('0x6b')][_0x5252('0x41')](_0x3b4f3c,{'type':db[_0x5252('0x6c')][_0x5252('0x6d')][_0x5252('0x6e')],'raw':!![]})[_0x5252('0x22')](function(_0x4a9530){return _0x4a9530;});})['then'](function(_0x3b7e2e){if(_0x3b7e2e){_0x385bbe[_0x5252('0x29')][_0x5252('0x6f')]=_0x3b7e2e[0x0];if(!_0x4b52fe[_0x5252('0x58')][_0x5252('0x70')])return;return db[_0x5252('0x71')]['find']({'where':{'id':_0x4b52fe[_0x5252('0x58')][_0x5252('0x70')],'role':'agent'},'attributes':['id',_0x5252('0x39'),'fullname',_0x5252('0x72'),_0x5252('0x73')],'raw':!![]});}return null;})[_0x5252('0x22')](function(_0x2f86f2){if(!_0x2f86f2)return null;_0x385bbe['message'][_0x5252('0x74')]=_0x2f86f2;return _0x385bbe;})[_0x5252('0x22')](function(_0x3c98a8){if(_0x3c98a8){if(_0x4b52fe['body'][_0x5252('0x75')]){_0x385bbe[_0x5252('0x29')][_0x5252('0x76')]=util[_0x5252('0x5f')]('SIP/%s',_0x4b52fe[_0x5252('0x61')][_0x5252('0x39')]);_0x385bbe['message'][_0x5252('0x77')]=_0x385bbe[_0x5252('0x77')];_0x385bbe[_0x5252('0x29')][_0x5252('0x78')]=_0x385bbe[_0x5252('0x77')];_0x385bbe[_0x5252('0x29')][_0x5252('0x79')]=_0x5252('0x5c');return respondWithRpcPromise('EventManager',_0x5252('0x7a'),{'event':_0x5252('0x7b'),'message':_0x385bbe[_0x5252('0x29')]},client9002)[_0x5252('0x22')](function(){return _0x385bbe;});}return _0x385bbe;}return null;})[_0x5252('0x22')](respondWithResult(_0xe613bc,null))[_0x5252('0x2a')](handleError(_0xe613bc,null));};var interaction_log=require(_0x5252('0x14'))('sms-interactions');exports[_0x5252('0x35')]=function(_0x5e69fd,_0x1fc279,_0x28cd47){var _0x24ccb7={'agent':{},'channel':_0x5252('0x5d')};if(_0x5e69fd[_0x5252('0x58')]['id']){delete _0x5e69fd['body']['id'];}_0x5e69fd['body'][_0x5252('0x70')]=_0x5e69fd[_0x5252('0x58')][_0x5252('0x70')]||_0x5e69fd[_0x5252('0x61')]['id'];_0x24ccb7[_0x5252('0x74')]['id']=_0x5e69fd[_0x5252('0x58')][_0x5252('0x70')];return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x5e69fd[_0x5252('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fc279,null))[_0x5252('0x22')](function(_0x39b1b8){if(_0x39b1b8){_0x24ccb7[_0x5252('0x29')]=_0x39b1b8[_0x5252('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x39b1b8['SmsInteractionId']}});}return null;})[_0x5252('0x22')](handleEntityNotFound(_0x1fc279,null))[_0x5252('0x22')](function(_0x2ef099){if(_0x2ef099){_0x24ccb7[_0x5252('0x65')]=_0x2ef099['get']({'plain':!![]});interaction_log[_0x5252('0x23')](_0x5252('0x7c'),_0x5e69fd[_0x5252('0x61')]['id'],_0x5e69fd[_0x5252('0x61')]['name'],_0x5e69fd[_0x5252('0x61')][_0x5252('0x67')],_0x24ccb7['interaction']['id'],_0x5e69fd[_0x5252('0x58')]?JSON[_0x5252('0x27')](_0x5e69fd[_0x5252('0x58')]):_0x5252('0x68'));return respondWithRpcPromise(_0x5252('0x7d'),_0x5252('0x7e'),_0x24ccb7);}return null;})[_0x5252('0x22')](function(_0x43def3){var _0x34a592=_0x5252('0x6a')+_0x43def3['message'][_0x5252('0x7f')];return db['sequelize'][_0x5252('0x41')](_0x34a592,{'type':db[_0x5252('0x6c')][_0x5252('0x6d')]['SELECT'],'raw':!![]})[_0x5252('0x22')](function(_0x3991a6){return _0x3991a6;});})[_0x5252('0x22')](function(_0x2a7c6d){if(_0x2a7c6d){_0x24ccb7[_0x5252('0x29')]['contact']=_0x2a7c6d[0x0];if(!_0x5e69fd[_0x5252('0x58')]['UserId'])return;return db[_0x5252('0x71')][_0x5252('0x56')]({'where':{'id':_0x5e69fd[_0x5252('0x58')][_0x5252('0x70')],'role':_0x5252('0x74')},'attributes':['id',_0x5252('0x39'),_0x5252('0x80'),_0x5252('0x72'),_0x5252('0x73')],'raw':!![]});}return null;})['then'](function(_0x216c21){if(!_0x216c21)return null;_0x24ccb7[_0x5252('0x29')]['agent']=_0x216c21;return _0x24ccb7;})[_0x5252('0x22')](function(_0x27cce8){if(_0x27cce8){_0x27cce8[_0x5252('0x29')]['interface']=util[_0x5252('0x5f')](_0x5252('0x81'),_0x5e69fd[_0x5252('0x61')][_0x5252('0x39')]);_0x27cce8[_0x5252('0x29')][_0x5252('0x77')]=_0x24ccb7['channel'];_0x27cce8[_0x5252('0x29')][_0x5252('0x78')]=_0x24ccb7[_0x5252('0x77')];_0x27cce8['message'][_0x5252('0x79')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x5252('0x82'),'message':_0x27cce8[_0x5252('0x29')]},client9002);return _0x24ccb7;}return null;})['then'](respondWithResult(_0x1fc279,null))[_0x5252('0x2a')](handleError(_0x1fc279,null));};exports[_0x5252('0x2c')]=function(_0x21ad3d,_0x47b378,_0x26bed0){if(_0x21ad3d[_0x5252('0x58')]['id']){delete _0x21ad3d[_0x5252('0x58')]['id'];}var _0x46beb1;return db[_0x5252('0x3d')][_0x5252('0x56')]({'where':{'id':_0x21ad3d[_0x5252('0x59')]['id']}})[_0x5252('0x22')](handleEntityNotFound(_0x47b378,null))[_0x5252('0x22')](function(_0x422e63){if(_0x422e63){_0x46beb1=_0x422e63;return db[_0x5252('0x83')]['find']({'where':{'id':_0x422e63[_0x5252('0x84')]}});}})['then'](handleEntityNotFound(_0x47b378,null))[_0x5252('0x22')](function(_0x4f1a9b){if(_0x4f1a9b){logger['debug'](_0x5252('0x26'),_0x5252('0x2c'),_0x5252('0x85'),_0x4f1a9b[_0x5252('0x86')],util[_0x5252('0x87')](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));switch(_0x4f1a9b[_0x5252('0x86')]){case _0x5252('0x88'):if(_0x21ad3d[_0x5252('0x58')][_0x5252('0x89')]&&_0x21ad3d['body'][_0x5252('0x89')]===_0x46beb1[_0x5252('0x8a')]){return _0x46beb1[_0x5252('0x37')]({'read':!![]});}else{logger['error'](_0x5252('0x8b'),_0x5252('0x2c'),'twilio',util['inspect'](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5252('0x8c'):if(_0x21ad3d['body'][_0x5252('0x8d')]&&_0x21ad3d[_0x5252('0x58')][_0x5252('0x8d')]===_0x46beb1['messageId']&&_[_0x5252('0x8e')]([_0x5252('0x8f'),_0x5252('0x90')],_0x21ad3d[_0x5252('0x58')][_0x5252('0x91')])>=0x0){return _0x46beb1[_0x5252('0x37')]({'read':!![]});}else{logger['error'](_0x5252('0x8b'),_0x5252('0x2c'),'plivio',util[_0x5252('0x87')](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5c8ff7=_0x21ad3d[_0x5252('0x58')][_0x5252('0x92')][0x0];if(_0x5c8ff7[_0x5252('0x2c')][_0x5252('0x93')]===_0x5252('0x94')){return _0x46beb1['update']({'read':!![]});}else{logger[_0x5252('0x28')](_0x5252('0x8b'),_0x5252('0x2c'),_0x5252('0x95'),util[_0x5252('0x87')](_0x21ad3d[_0x5252('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x46beb1;}})[_0x5252('0x22')](respondWithResult(_0x47b378,null))['catch'](handleError(_0x47b378,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a47c432..deec96c 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 _0x2f0e=['SmsMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x53ca7f,_0x30d459){var _0x2344e5=function(_0x11ec21){while(--_0x11ec21){_0x53ca7f['push'](_0x53ca7f['shift']());}};_0x2344e5(++_0x30d459);}(_0x2f0e,0x116));var _0xe2f0=function(_0x375f65,_0xe40f2d){_0x375f65=_0x375f65-0x0;var _0x41984b=_0x2f0e[_0x375f65];return _0x41984b;};'use strict';var EventEmitter=require(_0xe2f0('0x0'));var SmsMessage=require(_0xe2f0('0x1'))['db'][_0xe2f0('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe2f0('0x3')](0x0);var events={'afterCreate':_0xe2f0('0x4'),'afterUpdate':'update','afterDestroy':_0xe2f0('0x5')};function emitEvent(_0x1d49e0){return function(_0x492bc0,_0x2ad1c7,_0x181a65){SmsMessageEvents[_0xe2f0('0x6')](_0x1d49e0+':'+_0x492bc0['id'],_0x492bc0);SmsMessageEvents['emit'](_0x1d49e0,_0x492bc0);_0x181a65(null);};}for(var e in events){if(events[_0xe2f0('0x7')](e)){var event=events[e];SmsMessage[_0xe2f0('0x8')](e,emitEvent(event));}}module[_0xe2f0('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xc58a=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc58a,0x102));var _0xac58=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xc58a[_0x4914e2];return _0x2dcd07;};'use strict';var EventEmitter=require(_0xac58('0x0'));var SmsMessage=require(_0xac58('0x1'))['db'][_0xac58('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xac58('0x3')](0x0);var events={'afterCreate':_0xac58('0x4'),'afterUpdate':_0xac58('0x5'),'afterDestroy':_0xac58('0x6')};function emitEvent(_0x5b3d34){return function(_0x1b3a70,_0x3f64b8,_0x33b230){SmsMessageEvents[_0xac58('0x7')](_0x5b3d34+':'+_0x1b3a70['id'],_0x1b3a70);SmsMessageEvents[_0xac58('0x7')](_0x5b3d34,_0x1b3a70);_0x33b230(null);};}for(var e in events){if(events[_0xac58('0x8')](e)){var event=events[e];SmsMessage[_0xac58('0x9')](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 294658a..cd4d684 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 _0x867f=['rimraf','exports','define','SmsMessage','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','SmsInteraction','SmsInteractionId','update','createdAt','catch','error','find','twilio','authToken','phone','accountSid','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','username','&password=','GET','then','POST','user_key','session_key','total_sent','read','connectel','senderString','requestid','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','/api/sms/messages/','authId','base64','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','login','sender','text','timestamp','keys','sort','apiKey','digest','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','Basic\x20%s','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f72bd,_0x5b837e){var _0x20725a=function(_0x532377){while(--_0x532377){_0x3f72bd['push'](_0x3f72bd['shift']());}};_0x20725a(++_0x5b837e);}(_0x867f,0xe6));var _0xf867=function(_0x4eb6e3,_0x555008){_0x4eb6e3=_0x4eb6e3-0x0;var _0x11bd33=_0x867f[_0x4eb6e3];return _0x11bd33;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))(_0xf867('0x3'));var moment=require(_0xf867('0x4'));var BPromise=require(_0xf867('0x5'));var rp=require(_0xf867('0x6'));var fs=require('fs');var path=require(_0xf867('0x7'));var rimraf=require(_0xf867('0x8'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xf867('0x9')]=function(_0x2e0691,_0x2c09b1){return _0x2e0691[_0xf867('0xa')](_0xf867('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xf867('0xc')]},{'name':'fti_sms_messages','fields':[_0xf867('0xd')],'type':_0xf867('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cf341,_0xb26c33,_0x4a385d){var _0x462870=_0x2e0691[_0xf867('0xf')];var _0x3c9a3f=_0x1cf341['get']({'plain':!![]});if(_0x3c9a3f[_0xf867('0x10')]['toLowerCase']()==='in'||_0x3c9a3f['direction'][_0xf867('0x11')]()===_0xf867('0x12')&&!_0x3c9a3f[_0xf867('0x13')]&&!_['isNil'](_0x3c9a3f['UserId'])){_0x462870[_0xf867('0x14')]['findOne']({'where':{'id':_0x3c9a3f[_0xf867('0x15')]}})['then'](function(_0x48ff28){if(_0x48ff28){_0x48ff28[_0xf867('0x16')]({'lastMsgAt':_0x3c9a3f[_0xf867('0x17')],'lastMsgDirection':_0x3c9a3f[_0xf867('0x10')][_0xf867('0x11')]()});}})[_0xf867('0x18')](function(_0x1e5161){console[_0xf867('0x19')](_0x1e5161);});}if(_0x3c9a3f[_0xf867('0x10')]===_0xf867('0x12')&&!_0x3c9a3f['secret']){var _0x44f6f1;_0x462870['SmsAccount'][_0xf867('0x1a')]({'where':{'id':_0x3c9a3f['SmsAccountId']},'raw':!![]})['then'](function(_0x1a5592){_0x44f6f1=_0x1a5592;if(_0x44f6f1&&_0x44f6f1['type']){switch(_0x44f6f1['type']){case _0xf867('0x1b'):var _0xc4ed76=require('twilio');if(_0x44f6f1['accountSid']&&_0x44f6f1[_0xf867('0x1c')]&&_0x44f6f1[_0xf867('0x1d')]){var _0x1456ce=new _0xc4ed76(_0x44f6f1[_0xf867('0x1e')],_0x44f6f1[_0xf867('0x1c')]);_0x1456ce[_0xf867('0x1f')][_0xf867('0x20')]({'body':_0x3c9a3f[_0xf867('0xd')],'to':_0x3c9a3f['phone'],'from':_0x44f6f1['phone'],'statusCallback':_0x44f6f1[_0xf867('0x21')]+'/api/sms/messages/'+_0x3c9a3f['id']+_0xf867('0x22')+_0x44f6f1[_0xf867('0x23')]})['then'](function(_0x419b6f){if(_0x419b6f[_0xf867('0x24')]){return _0x1cf341['update']({'messageId':_0x419b6f[_0xf867('0x24')]});}})[_0xf867('0x18')](function(_0x167e70){logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x1b'),util[_0xf867('0x27')](_0x167e70,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x1b'),_0xf867('0x28'));}break;case _0xf867('0x29'):var _0x327a13=_0xf867('0x2a');if(_0x44f6f1['username']&&_0x44f6f1[_0xf867('0x2b')]){var _0x3981d0={'recipient':[_0x3c9a3f[_0xf867('0x1d')]],'message':_0x3c9a3f[_0xf867('0xd')],'message_type':_0x44f6f1[_0xf867('0x2c')]};if(_0x44f6f1[_0xf867('0x2c')]&&_0x44f6f1[_0xf867('0x2c')]!=='SI'){_0x3981d0['sender']=_0x44f6f1[_0xf867('0x1d')];}var _0x5d4ca5={'url':_0x327a13+_0xf867('0x2d')+_0x44f6f1[_0xf867('0x2e')]+_0xf867('0x2f')+_0x44f6f1[_0xf867('0x2b')],'method':_0xf867('0x30')};rp(_0x5d4ca5)[_0xf867('0x31')](function(_0x4ffce9){var _0x4552f8=_0x4ffce9['split'](';');var _0x4c08df={'user_key':_0x4552f8[0x0],'session_key':_0x4552f8[0x1]};_0x5d4ca5={'url':_0x327a13+'sms','method':_0xf867('0x32'),'headers':{'user_key':_0x4c08df[_0xf867('0x33')],'Session_key':_0x4c08df[_0xf867('0x34')]},'json':!![],'body':_0x3981d0};return rp(_0x5d4ca5);})['then'](function(_0x3ae447){if(_0x3ae447[_0xf867('0x35')]>=0x1){var _0x4f29fa={'messageId':_0x3ae447['internal_order_id']};if(_0x44f6f1[_0xf867('0x2c')]!=='GP'||!_0x44f6f1['deliveryReport']){_0x4f29fa[_0xf867('0x36')]=!![];}return _0x1cf341[_0xf867('0x16')](_0x4f29fa);}else{return logger[_0xf867('0x19')](_0xf867('0x25'),'afterCreate','skebby',util[_0xf867('0x27')](_0x3ae447,{'showHidden':![],'depth':null}));}})[_0xf867('0x18')](function(_0x2bad0e){return logger['error'](_0xf867('0x25'),_0xf867('0x26'),'skebby',util[_0xf867('0x27')](_0x2bad0e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf867('0x37'):if(_0x44f6f1['authToken']){var _0x1c1c90={'recipient':_0x3c9a3f[_0xf867('0x1d')],'message':_0x3c9a3f[_0xf867('0xd')],'sender':_0x44f6f1[_0xf867('0x38')]||_0x44f6f1[_0xf867('0x1d')],'authorization':_0x44f6f1[_0xf867('0x1c')]};var _0xb26c33={'method':_0xf867('0x32'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x1c1c90,'json':!![]};rp(_0xb26c33)['then'](function(_0x4a877){var _0x1e1074={'messageId':_0x4a877[_0xf867('0x39')]};if(!_0x44f6f1[_0xf867('0x3a')]){_0x1e1074[_0xf867('0x36')]=!![];}return _0x1cf341[_0xf867('0x16')](_0x1e1074);})[_0xf867('0x18')](function(_0x4acc2b){logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x37'),util[_0xf867('0x27')](_0x4acc2b,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x37'),'Missing\x20parameters:\x20authToken');}break;case _0xf867('0x3b'):if(_0x44f6f1['username']&&_0x44f6f1[_0xf867('0x2b')]){var _0x1c1c90={'messages':[{'source':_0xf867('0x3c'),'to':_0x3c9a3f['phone'],'body':_0x3c9a3f[_0xf867('0xd')],'from':_0x44f6f1[_0xf867('0x38')]||_0x44f6f1[_0xf867('0x1d')]}]};var _0x23bc57=util[_0xf867('0x3d')](_0xf867('0x3e'),_0x44f6f1['username'],_0x44f6f1[_0xf867('0x2b')]);var _0xb26c33={'method':_0xf867('0x32'),'uri':_0xf867('0x3f'),'body':_0x1c1c90,'headers':{'Authorization':util[_0xf867('0x3d')]('Basic\x20%s',new Buffer(_0x23bc57)[_0xf867('0x40')]('base64'))},'json':!![]};rp(_0xb26c33)[_0xf867('0x31')](function(_0xf1fddf){if(_0xf1fddf['http_code']>=0xc8&&_0xf1fddf[_0xf867('0x41')]<=0xce){if(_0xf1fddf[_0xf867('0x42')]&&_0xf1fddf[_0xf867('0x42')][_0xf867('0x43')]>0x0){var _0x272c18=_[_0xf867('0x44')](_0xf1fddf['data'][_0xf867('0x1f')]);var _0x59b6ec={'messageId':_0x272c18[_0xf867('0x45')]};if(!_0x44f6f1[_0xf867('0x3a')]){_0x59b6ec[_0xf867('0x36')]=!![];}return _0x1cf341[_0xf867('0x16')](_0x59b6ec);}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),'clickSend',util['inspect'](_0xf1fddf,{'showHidden':![],'depth':null}));}}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),'clickSend',util[_0xf867('0x27')](_0xf1fddf,{'showHidden':![],'depth':null}));}})[_0xf867('0x18')](function(_0x8199d8){logger['error'](_0xf867('0x25'),'afterCreate',_0xf867('0x46'),util[_0xf867('0x27')](_0x8199d8,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x46'),_0xf867('0x47'));}break;case _0xf867('0x48'):if(_0x44f6f1['authId']&&_0x44f6f1['authToken']){var _0x1c1c90={'dst':_0x3c9a3f[_0xf867('0x1d')],'text':_0x3c9a3f[_0xf867('0xd')],'src':_0x44f6f1[_0xf867('0x38')]||_0x44f6f1[_0xf867('0x1d')],'url':_0x44f6f1[_0xf867('0x21')]+_0xf867('0x49')+_0x3c9a3f['id']+'/status?token='+_0x44f6f1[_0xf867('0x23')]};var _0x23bc57=util[_0xf867('0x3d')](_0xf867('0x3e'),_0x44f6f1['authId'],_0x44f6f1[_0xf867('0x1c')]);var _0xb26c33={'method':'POST','uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x44f6f1[_0xf867('0x4a')]),'body':_0x1c1c90,'headers':{'Authorization':util[_0xf867('0x3d')]('Basic\x20%s',new Buffer(_0x23bc57)[_0xf867('0x40')](_0xf867('0x4b')))},'json':!![]};rp(_0xb26c33)['then'](function(_0x109a06){var _0x3041cf={'messageId':_0x109a06['message_uuid'][0x0]};return _0x1cf341[_0xf867('0x16')](_0x3041cf);})[_0xf867('0x18')](function(_0x27f03a){logger[_0xf867('0x19')](_0xf867('0x25'),'afterCreate','plivo',util[_0xf867('0x27')](_0x27f03a,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x48'),_0xf867('0x4c'));}break;case'infobip':if(_0x44f6f1[_0xf867('0x2e')]&&_0x44f6f1[_0xf867('0x2b')]){if(_0x44f6f1[_0xf867('0x4d')]){var _0x23c2d9={'method':_0xf867('0x32'),'uri':_0x44f6f1[_0xf867('0x4d')]+_0xf867('0x4e'),'body':{'username':_0x44f6f1[_0xf867('0x2e')],'password':_0x44f6f1[_0xf867('0x2b')]},'json':!![]};return rp(_0x23c2d9)[_0xf867('0x31')](function(_0xe60950){var _0x591267={'method':_0xf867('0x32'),'uri':_0x44f6f1[_0xf867('0x4d')]+_0xf867('0x4f'),'body':{'messages':[{'from':_0x44f6f1['phone'],'destinations':[{'to':_0x3c9a3f[_0xf867('0x1d')]}],'text':_0x3c9a3f[_0xf867('0xd')],'notifyUrl':_0x44f6f1[_0xf867('0x21')]+_0xf867('0x49')+_0x3c9a3f['id']+'/status?token='+_0x44f6f1['token'],'notifyContentType':_0xf867('0x50'),'callbackData':_0x44f6f1[_0xf867('0x1d')]+';'+_0x3c9a3f[_0xf867('0xd')]}]},'headers':{'Authorization':_0xf867('0x51')+_0xe60950['token']},'json':!![]};return rp(_0x591267)[_0xf867('0x31')](function(_0x526027){if(_0x526027[_0xf867('0x1f')]){var _0x36160e={'messageId':_0x526027[_0xf867('0x1f')][0x0]['messageId']};if(!_0x44f6f1[_0xf867('0x3a')]){_0x36160e[_0xf867('0x36')]=!![];}return _0x1cf341['update'](_0x36160e);}else{return logger['error'](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x52'),util[_0xf867('0x27')](_0x526027,{'showHidden':![],'depth':null}));}});})[_0xf867('0x18')](function(_0x267d60){return logger[_0xf867('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf867('0x26'),_0xf867('0x52'),util[_0xf867('0x27')](_0x267d60,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x52'),_0xf867('0x53'));}}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x52'),_0xf867('0x47'));}break;case'csc':var _0x34c45c=require(_0xf867('0x54'));if(_0x44f6f1['apiKey']){var _0x1454bb={};_0x1454bb[_0xf867('0x55')]=_0x44f6f1[_0xf867('0x2e')];_0x1454bb['phone']=_0x3c9a3f[_0xf867('0x1d')];_0x1454bb[_0xf867('0x56')]=_0x44f6f1['phone'];_0x1454bb[_0xf867('0x57')]=_0x3c9a3f[_0xf867('0xd')];_0x1454bb[_0xf867('0x58')]=+new Date();var _0x4f67ef='';var _0xee316f='';var _0x34d729=Object[_0xf867('0x59')](_0x1454bb);_0x34d729[_0xf867('0x5a')]();for(var _0x4334d1=0x0;_0x4334d1<_0x34d729['length'];_0x4334d1++){if(_0x4f67ef!=''){_0x4f67ef+='&';}_0x4f67ef+=_0x34d729[_0x4334d1]+'='+encodeURIComponent(_0x1454bb[_0x34d729[_0x4334d1]]);_0xee316f+=_0x1454bb[_0x34d729[_0x4334d1]];}_0xee316f+=_0x44f6f1[_0xf867('0x5b')];_0xee316f=_0x34c45c['createHash']('md5')[_0xf867('0x16')](_0xee316f)[_0xf867('0x5c')](_0xf867('0x5d'));if(_0x4f67ef!==''){_0x4f67ef+='&';}_0x4f67ef+=_0xf867('0x5e')+_0xee316f;var _0x5d4ca5={'method':_0xf867('0x30'),'uri':_0x44f6f1[_0xf867('0x4d')]+_0xf867('0x5f')+_0x4f67ef,'json':!![]};return rp(_0x5d4ca5)[_0xf867('0x31')](function(_0xf0fe5c){var _0xe767a7=Object['keys'](_0xf0fe5c);if(_0xf0fe5c[_0xe767a7[0x0]][_0xf867('0x19')]&&parseInt(_0xf0fe5c[_0xe767a7[0x0]][_0xf867('0x19')])===0x0){var _0x9ec9bd={'messageId':_0xf0fe5c[_0xe767a7[0x0]][_0xf867('0x60')]};if(!_0x44f6f1['deliveryReport']){_0x9ec9bd[_0xf867('0x36')]=!![];}return _0x1cf341['update'](_0x9ec9bd);}else{return logger[_0xf867('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf867('0x61'),util['inspect'](_0xf0fe5c['error'],{'showHidden':![],'depth':null}));}})[_0xf867('0x18')](function(_0x648f77){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf867('0x26'),_0xf867('0x61'),util['inspect'](_0x648f77,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),'csc',_0xf867('0x62'));}break;case _0xf867('0x63'):if(_0x44f6f1['apiKey']){var _0x58bab7={'method':'POST','uri':_0xf867('0x64'),'headers':{'Authorization':_0x44f6f1[_0xf867('0x5b')]},'body':{'content':_0x3c9a3f[_0xf867('0xd')],'to':[_0x3c9a3f['phone']],'from':_0x44f6f1[_0xf867('0x1d')],'binary':![],'clientMessageId':'uuid','charset':_0xf867('0x65')},'json':!![]};rp(_0x58bab7)[_0xf867('0x31')](function(_0x17625c){if(!_0x17625c['error']){var _0x421cee={'messageId':_0x17625c[_0xf867('0x1f')][0x0][_0xf867('0x66')]};if(!_0x44f6f1[_0xf867('0x3a')]){_0x421cee[_0xf867('0x36')]=!![];}return _0x1cf341['update'](_0x421cee);}else{return logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x63'),util[_0xf867('0x27')](_0x17625c['error'],{'showHidden':![],'depth':null}));}})[_0xf867('0x18')](function(_0x1456f8){return logger['error'](_0xf867('0x25'),_0xf867('0x26'),'clickatell',util[_0xf867('0x27')](_0x1456f8,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x63'),_0xf867('0x62'));}break;case _0xf867('0x67'):if(_0x44f6f1[_0xf867('0x2e')]&&_0x44f6f1['password']){var _0x23bc57=util[_0xf867('0x3d')]('%s:%s',_0x44f6f1[_0xf867('0x2e')],_0x44f6f1[_0xf867('0x2b')]);var _0xb26c33={'method':_0xf867('0x32'),'uri':_0xf867('0x68')+_0x44f6f1[_0xf867('0x69')]+_0xf867('0x6a'),'body':{'to':[_0x3c9a3f[_0xf867('0x1d')]],'text':_0x3c9a3f[_0xf867('0xd')],'from':_0x44f6f1[_0xf867('0x1d')],'applicationId':_0x44f6f1['applicationId']},'headers':{'Authorization':util['format'](_0xf867('0x6b'),new Buffer(_0x23bc57)[_0xf867('0x40')](_0xf867('0x4b')))},'json':!![]};rp(_0xb26c33)[_0xf867('0x31')](function(_0x23c830){if(_0x23c830['id']){var _0x6201e3={'messageId':_0x23c830['id']};return _0x1cf341['update'](_0x6201e3);}else{logger['error'](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x67'),util['inspect'](_0x23c830,{'showHidden':![],'depth':null}));}})[_0xf867('0x18')](function(_0x1127e6){logger[_0xf867('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf867('0x67'),util[_0xf867('0x27')](_0x1127e6,{'showHidden':![],'depth':null}));});}else{logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x67'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x44f6f1['apiKey']){var _0x2fde83={};var _0x5d4ca5={'method':'POST','uri':_0xf867('0x6c'),'headers':{'Authorization':_0xf867('0x6d')+_0x44f6f1['apiKey'],'Content-Type':_0xf867('0x50')},'body':{'from':_0x44f6f1['phone'],'to':_0x3c9a3f[_0xf867('0x1d')],'text':_0x3c9a3f[_0xf867('0xd')]},'json':!![]};return rp(_0x5d4ca5)[_0xf867('0x31')](function(_0x7f4d49){if(_0x7f4d49[_0xf867('0x6e')]==0xca){_0x2fde83[_0xf867('0x6f')]=_0x7f4d49;var _0x3b01e3={'method':_0xf867('0x32'),'uri':_0xf867('0x70'),'headers':{'Authorization':_0xf867('0x6d')+_0x44f6f1['apiKey'],'Content-Type':_0xf867('0x50')},'body':{'refid':_0x2fde83[_0xf867('0x6f')][_0xf867('0x71')]},'json':!![]};return rp(_0x3b01e3)[_0xf867('0x31')](function(_0x243665){_0x2fde83[_0xf867('0x72')]=_0x243665;var _0x37deeb={'messageId':_0x2fde83[_0xf867('0x6f')]['refid'],'read':!![]};return _0x1cf341[_0xf867('0x16')](_0x37deeb);});}else{return logger['error'](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x73'),util['inspect'](_0x7f4d49,{'showHidden':![],'depth':null}));}})[_0xf867('0x18')](function(_0xa4c182){return logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x73'),util['inspect'](_0xa4c182,{'showHidden':![],'depth':null}));});}else{return logger[_0xf867('0x19')](_0xf867('0x25'),_0xf867('0x26'),_0xf867('0x73'),_0xf867('0x74'));}break;}}})[_0xf867('0x75')](function(){_0x4a385d();});}else{_0x4a385d();}}},'charset':_0xf867('0x76'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x12fd=['senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender','text','keys','sort','md5','digest','hex','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','models','toLowerCase','secret','isNil','SmsInteraction','findOne','update','createdAt','direction','catch','error','out','SmsAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','POST','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion'];(function(_0x4f314a,_0x168db1){var _0xbc944=function(_0xa961f9){while(--_0xa961f9){_0x4f314a['push'](_0x4f314a['shift']());}};_0xbc944(++_0x168db1);}(_0x12fd,0x199));var _0xd12f=function(_0x2f1f21,_0x15dbc6){_0x2f1f21=_0x2f1f21-0x0;var _0x512775=_0x12fd[_0x2f1f21];return _0x512775;};'use strict';var _=require(_0xd12f('0x0'));var util=require(_0xd12f('0x1'));var logger=require(_0xd12f('0x2'))(_0xd12f('0x3'));var moment=require(_0xd12f('0x4'));var BPromise=require('bluebird');var rp=require(_0xd12f('0x5'));var fs=require('fs');var path=require(_0xd12f('0x6'));var rimraf=require(_0xd12f('0x7'));var config=require(_0xd12f('0x8'));var attributes=require(_0xd12f('0x9'));module[_0xd12f('0xa')]=function(_0x55bb7d,_0x3f733d){return _0x55bb7d['define'](_0xd12f('0xb'),attributes,{'tableName':_0xd12f('0xc'),'paranoid':![],'indexes':[{'name':_0xd12f('0xd'),'fields':[_0xd12f('0xd')]},{'name':'fti_sms_messages','fields':[_0xd12f('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd848dd,_0x5108a9,_0x59c17c){var _0x4a1677=_0x55bb7d[_0xd12f('0xf')];var _0x1c31c8=_0xd848dd['get']({'plain':!![]});if(_0x1c31c8['direction']['toLowerCase']()==='in'||_0x1c31c8['direction'][_0xd12f('0x10')]()==='out'&&!_0x1c31c8[_0xd12f('0x11')]&&!_[_0xd12f('0x12')](_0x1c31c8['UserId'])){_0x4a1677[_0xd12f('0x13')][_0xd12f('0x14')]({'where':{'id':_0x1c31c8['SmsInteractionId']}})['then'](function(_0x49afdf){if(_0x49afdf){_0x49afdf[_0xd12f('0x15')]({'lastMsgAt':_0x1c31c8[_0xd12f('0x16')],'lastMsgDirection':_0x1c31c8[_0xd12f('0x17')][_0xd12f('0x10')]()});}})[_0xd12f('0x18')](function(_0x60b06a){console[_0xd12f('0x19')](_0x60b06a);});}if(_0x1c31c8[_0xd12f('0x17')]===_0xd12f('0x1a')&&!_0x1c31c8['secret']){var _0x4b00a2;_0x4a1677[_0xd12f('0x1b')][_0xd12f('0x1c')]({'where':{'id':_0x1c31c8['SmsAccountId']},'raw':!![]})[_0xd12f('0x1d')](function(_0x12c884){_0x4b00a2=_0x12c884;if(_0x4b00a2&&_0x4b00a2[_0xd12f('0x1e')]){switch(_0x4b00a2['type']){case'twilio':var _0x22577d=require(_0xd12f('0x1f'));if(_0x4b00a2[_0xd12f('0x20')]&&_0x4b00a2[_0xd12f('0x21')]&&_0x4b00a2[_0xd12f('0x22')]){var _0x354cf0=new _0x22577d(_0x4b00a2['accountSid'],_0x4b00a2[_0xd12f('0x21')]);_0x354cf0[_0xd12f('0x23')][_0xd12f('0x24')]({'body':_0x1c31c8[_0xd12f('0xe')],'to':_0x1c31c8[_0xd12f('0x22')],'from':_0x4b00a2[_0xd12f('0x22')],'statusCallback':_0x4b00a2[_0xd12f('0x25')]+_0xd12f('0x26')+_0x1c31c8['id']+_0xd12f('0x27')+_0x4b00a2[_0xd12f('0x28')]})[_0xd12f('0x1d')](function(_0x322f78){if(_0x322f78[_0xd12f('0x29')]){return _0xd848dd[_0xd12f('0x15')]({'messageId':_0x322f78[_0xd12f('0x29')]});}})[_0xd12f('0x18')](function(_0x2218fe){logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x1f'),util[_0xd12f('0x2c')](_0x2218fe,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd12f('0x2b'),'twilio',_0xd12f('0x2d'));}break;case _0xd12f('0x2e'):var _0x4a5c97=_0xd12f('0x2f');if(_0x4b00a2['username']&&_0x4b00a2[_0xd12f('0x30')]){var _0x31ae8e={'recipient':[_0x1c31c8[_0xd12f('0x22')]],'message':_0x1c31c8[_0xd12f('0xe')],'message_type':_0x4b00a2['smsMethod']};if(_0x4b00a2['smsMethod']&&_0x4b00a2[_0xd12f('0x31')]!=='SI'){_0x31ae8e['sender']=_0x4b00a2[_0xd12f('0x22')];}var _0x45765e={'url':_0x4a5c97+'login?username='+_0x4b00a2['username']+'&password='+_0x4b00a2[_0xd12f('0x30')],'method':'GET'};rp(_0x45765e)[_0xd12f('0x1d')](function(_0x3b5d90){var _0x1de94d=_0x3b5d90['split'](';');var _0x17ab32={'user_key':_0x1de94d[0x0],'session_key':_0x1de94d[0x1]};_0x45765e={'url':_0x4a5c97+'sms','method':_0xd12f('0x32'),'headers':{'user_key':_0x17ab32['user_key'],'Session_key':_0x17ab32['session_key']},'json':!![],'body':_0x31ae8e};return rp(_0x45765e);})[_0xd12f('0x1d')](function(_0x39290e){if(_0x39290e[_0xd12f('0x33')]>=0x1){var _0x1dcc20={'messageId':_0x39290e[_0xd12f('0x34')]};if(_0x4b00a2[_0xd12f('0x31')]!=='GP'||!_0x4b00a2[_0xd12f('0x35')]){_0x1dcc20[_0xd12f('0x36')]=!![];}return _0xd848dd['update'](_0x1dcc20);}else{return logger['error'](_0xd12f('0x2a'),'afterCreate',_0xd12f('0x2e'),util[_0xd12f('0x2c')](_0x39290e,{'showHidden':![],'depth':null}));}})['catch'](function(_0xa668d4){return logger[_0xd12f('0x19')](_0xd12f('0x2a'),'afterCreate','skebby',util['inspect'](_0xa668d4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd12f('0x2a'),_0xd12f('0x2b'),'skebby',_0xd12f('0x37'));}break;case _0xd12f('0x38'):if(_0x4b00a2[_0xd12f('0x21')]){var _0x168b05={'recipient':_0x1c31c8[_0xd12f('0x22')],'message':_0x1c31c8['body'],'sender':_0x4b00a2['senderString']||_0x4b00a2['phone'],'authorization':_0x4b00a2[_0xd12f('0x21')]};var _0x5108a9={'method':_0xd12f('0x32'),'uri':_0xd12f('0x39'),'body':_0x168b05,'json':!![]};rp(_0x5108a9)[_0xd12f('0x1d')](function(_0x2ce514){var _0x5cb281={'messageId':_0x2ce514[_0xd12f('0x3a')]};if(!_0x4b00a2[_0xd12f('0x35')]){_0x5cb281[_0xd12f('0x36')]=!![];}return _0xd848dd[_0xd12f('0x15')](_0x5cb281);})['catch'](function(_0x3fa8f6){logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x38'),util[_0xd12f('0x2c')](_0x3fa8f6,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x38'),_0xd12f('0x3b'));}break;case _0xd12f('0x3c'):if(_0x4b00a2[_0xd12f('0x3d')]&&_0x4b00a2['password']){var _0x168b05={'messages':[{'source':_0xd12f('0x3e'),'to':_0x1c31c8[_0xd12f('0x22')],'body':_0x1c31c8['body'],'from':_0x4b00a2[_0xd12f('0x3f')]||_0x4b00a2[_0xd12f('0x22')]}]};var _0x5df28f=util[_0xd12f('0x40')]('%s:%s',_0x4b00a2[_0xd12f('0x3d')],_0x4b00a2[_0xd12f('0x30')]);var _0x5108a9={'method':'POST','uri':_0xd12f('0x41'),'body':_0x168b05,'headers':{'Authorization':util[_0xd12f('0x40')](_0xd12f('0x42'),new Buffer(_0x5df28f)[_0xd12f('0x43')](_0xd12f('0x44')))},'json':!![]};rp(_0x5108a9)[_0xd12f('0x1d')](function(_0x1ab77e){if(_0x1ab77e[_0xd12f('0x45')]>=0xc8&&_0x1ab77e['http_code']<=0xce){if(_0x1ab77e[_0xd12f('0x46')]&&_0x1ab77e[_0xd12f('0x46')][_0xd12f('0x47')]>0x0){var _0x2c2385=_[_0xd12f('0x48')](_0x1ab77e['data'][_0xd12f('0x23')]);var _0x5ef50b={'messageId':_0x2c2385[_0xd12f('0x49')]};if(!_0x4b00a2[_0xd12f('0x35')]){_0x5ef50b[_0xd12f('0x36')]=!![];}return _0xd848dd[_0xd12f('0x15')](_0x5ef50b);}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x4a'),util[_0xd12f('0x2c')](_0x1ab77e,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd12f('0x4a'),util['inspect'](_0x1ab77e,{'showHidden':![],'depth':null}));}})[_0xd12f('0x18')](function(_0x48f312){logger[_0xd12f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd12f('0x2b'),_0xd12f('0x4a'),util[_0xd12f('0x2c')](_0x48f312,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd12f('0x2b'),'clickSend',_0xd12f('0x37'));}break;case _0xd12f('0x4b'):if(_0x4b00a2[_0xd12f('0x4c')]&&_0x4b00a2[_0xd12f('0x21')]){var _0x168b05={'dst':_0x1c31c8['phone'],'text':_0x1c31c8[_0xd12f('0xe')],'src':_0x4b00a2[_0xd12f('0x3f')]||_0x4b00a2[_0xd12f('0x22')],'url':_0x4b00a2[_0xd12f('0x25')]+'/api/sms/messages/'+_0x1c31c8['id']+_0xd12f('0x27')+_0x4b00a2['token']};var _0x5df28f=util['format']('%s:%s',_0x4b00a2[_0xd12f('0x4c')],_0x4b00a2[_0xd12f('0x21')]);var _0x5108a9={'method':_0xd12f('0x32'),'uri':util[_0xd12f('0x40')](_0xd12f('0x4d'),_0x4b00a2[_0xd12f('0x4c')]),'body':_0x168b05,'headers':{'Authorization':util[_0xd12f('0x40')](_0xd12f('0x42'),new Buffer(_0x5df28f)[_0xd12f('0x43')](_0xd12f('0x44')))},'json':!![]};rp(_0x5108a9)[_0xd12f('0x1d')](function(_0x2dea93){var _0x3890c6={'messageId':_0x2dea93['message_uuid'][0x0]};return _0xd848dd[_0xd12f('0x15')](_0x3890c6);})[_0xd12f('0x18')](function(_0x4fb3ae){logger['error'](_0xd12f('0x2a'),'afterCreate',_0xd12f('0x4b'),util[_0xd12f('0x2c')](_0x4fb3ae,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x4b'),_0xd12f('0x4e'));}break;case _0xd12f('0x4f'):if(_0x4b00a2[_0xd12f('0x3d')]&&_0x4b00a2['password']){if(_0x4b00a2[_0xd12f('0x50')]){var _0x3d4402={'method':_0xd12f('0x32'),'uri':_0x4b00a2['baseUrl']+_0xd12f('0x51'),'body':{'username':_0x4b00a2['username'],'password':_0x4b00a2['password']},'json':!![]};return rp(_0x3d4402)[_0xd12f('0x1d')](function(_0x49df52){var _0x3899c3={'method':_0xd12f('0x32'),'uri':_0x4b00a2['baseUrl']+_0xd12f('0x52'),'body':{'messages':[{'from':_0x4b00a2[_0xd12f('0x22')],'destinations':[{'to':_0x1c31c8[_0xd12f('0x22')]}],'text':_0x1c31c8[_0xd12f('0xe')],'notifyUrl':_0x4b00a2[_0xd12f('0x25')]+_0xd12f('0x26')+_0x1c31c8['id']+'/status?token='+_0x4b00a2['token'],'notifyContentType':_0xd12f('0x53'),'callbackData':_0x4b00a2[_0xd12f('0x22')]+';'+_0x1c31c8['body']}]},'headers':{'Authorization':_0xd12f('0x54')+_0x49df52[_0xd12f('0x28')]},'json':!![]};return rp(_0x3899c3)[_0xd12f('0x1d')](function(_0x4feca){if(_0x4feca[_0xd12f('0x23')]){var _0x46c870={'messageId':_0x4feca[_0xd12f('0x23')][0x0]['messageId']};if(!_0x4b00a2[_0xd12f('0x35')]){_0x46c870['read']=!![];}return _0xd848dd[_0xd12f('0x15')](_0x46c870);}else{return logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x4f'),util[_0xd12f('0x2c')](_0x4feca,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x74db43){return logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x4f'),util['inspect'](_0x74db43,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x4f'),_0xd12f('0x55'));}}else{logger['error'](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x4f'),_0xd12f('0x37'));}break;case'csc':var _0x5195bc=require(_0xd12f('0x56'));if(_0x4b00a2[_0xd12f('0x57')]){var _0x31b4b7={};_0x31b4b7[_0xd12f('0x58')]=_0x4b00a2[_0xd12f('0x3d')];_0x31b4b7[_0xd12f('0x22')]=_0x1c31c8[_0xd12f('0x22')];_0x31b4b7[_0xd12f('0x59')]=_0x4b00a2[_0xd12f('0x22')];_0x31b4b7[_0xd12f('0x5a')]=_0x1c31c8['body'];_0x31b4b7['timestamp']=+new Date();var _0x1cc1e4='';var _0x4586d6='';var _0x280074=Object[_0xd12f('0x5b')](_0x31b4b7);_0x280074[_0xd12f('0x5c')]();for(var _0x3bb69a=0x0;_0x3bb69a<_0x280074['length'];_0x3bb69a++){if(_0x1cc1e4!=''){_0x1cc1e4+='&';}_0x1cc1e4+=_0x280074[_0x3bb69a]+'='+encodeURIComponent(_0x31b4b7[_0x280074[_0x3bb69a]]);_0x4586d6+=_0x31b4b7[_0x280074[_0x3bb69a]];}_0x4586d6+=_0x4b00a2[_0xd12f('0x57')];_0x4586d6=_0x5195bc['createHash'](_0xd12f('0x5d'))[_0xd12f('0x15')](_0x4586d6)[_0xd12f('0x5e')](_0xd12f('0x5f'));if(_0x1cc1e4!==''){_0x1cc1e4+='&';}_0x1cc1e4+='signature='+_0x4586d6;var _0x45765e={'method':'GET','uri':_0x4b00a2['baseUrl']+'/external/get/send.php?'+_0x1cc1e4,'json':!![]};return rp(_0x45765e)[_0xd12f('0x1d')](function(_0x313276){var _0x40f4d1=Object[_0xd12f('0x5b')](_0x313276);if(_0x313276[_0x40f4d1[0x0]]['error']&&parseInt(_0x313276[_0x40f4d1[0x0]][_0xd12f('0x19')])===0x0){var _0x16400d={'messageId':_0x313276[_0x40f4d1[0x0]][_0xd12f('0x60')]};if(!_0x4b00a2[_0xd12f('0x35')]){_0x16400d[_0xd12f('0x36')]=!![];}return _0xd848dd[_0xd12f('0x15')](_0x16400d);}else{return logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x61'),util['inspect'](_0x313276[_0xd12f('0x19')],{'showHidden':![],'depth':null}));}})[_0xd12f('0x18')](function(_0x82460e){return logger[_0xd12f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd12f('0x2b'),'csc',util[_0xd12f('0x2c')](_0x82460e,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x61'),_0xd12f('0x62'));}break;case'clickatell':if(_0x4b00a2[_0xd12f('0x57')]){var _0x245984={'method':_0xd12f('0x32'),'uri':_0xd12f('0x63'),'headers':{'Authorization':_0x4b00a2[_0xd12f('0x57')]},'body':{'content':_0x1c31c8[_0xd12f('0xe')],'to':[_0x1c31c8[_0xd12f('0x22')]],'from':_0x4b00a2['phone'],'binary':![],'clientMessageId':_0xd12f('0x64'),'charset':'UTF-8'},'json':!![]};rp(_0x245984)['then'](function(_0x3f076a){if(!_0x3f076a['error']){var _0x7a86ef={'messageId':_0x3f076a['messages'][0x0][_0xd12f('0x65')]};if(!_0x4b00a2[_0xd12f('0x35')]){_0x7a86ef[_0xd12f('0x36')]=!![];}return _0xd848dd[_0xd12f('0x15')](_0x7a86ef);}else{return logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x66'),util['inspect'](_0x3f076a[_0xd12f('0x19')],{'showHidden':![],'depth':null}));}})[_0xd12f('0x18')](function(_0x2471a9){return logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x66'),util[_0xd12f('0x2c')](_0x2471a9,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0xd12f('0x67'):if(_0x4b00a2[_0xd12f('0x3d')]&&_0x4b00a2[_0xd12f('0x30')]){var _0x5df28f=util[_0xd12f('0x40')](_0xd12f('0x68'),_0x4b00a2[_0xd12f('0x3d')],_0x4b00a2[_0xd12f('0x30')]);var _0x5108a9={'method':_0xd12f('0x32'),'uri':_0xd12f('0x69')+_0x4b00a2['accountId']+_0xd12f('0x6a'),'body':{'to':[_0x1c31c8[_0xd12f('0x22')]],'text':_0x1c31c8[_0xd12f('0xe')],'from':_0x4b00a2[_0xd12f('0x22')],'applicationId':_0x4b00a2[_0xd12f('0x6b')]},'headers':{'Authorization':util[_0xd12f('0x40')](_0xd12f('0x42'),new Buffer(_0x5df28f)[_0xd12f('0x43')]('base64'))},'json':!![]};rp(_0x5108a9)[_0xd12f('0x1d')](function(_0x50217f){if(_0x50217f['id']){var _0x3016e5={'messageId':_0x50217f['id']};return _0xd848dd['update'](_0x3016e5);}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),'afterCreate',_0xd12f('0x67'),util[_0xd12f('0x2c')](_0x50217f,{'showHidden':![],'depth':null}));}})[_0xd12f('0x18')](function(_0x5699f5){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0xd12f('0x2c')](_0x5699f5,{'showHidden':![],'depth':null}));});}else{logger[_0xd12f('0x19')](_0xd12f('0x2a'),'afterCreate',_0xd12f('0x67'),_0xd12f('0x37'));}break;case _0xd12f('0x6c'):if(_0x4b00a2['apiKey']){var _0x2c8fb7={};var _0x45765e={'method':'POST','uri':_0xd12f('0x6d'),'headers':{'Authorization':_0xd12f('0x6e')+_0x4b00a2[_0xd12f('0x57')],'Content-Type':_0xd12f('0x53')},'body':{'from':_0x4b00a2[_0xd12f('0x22')],'to':_0x1c31c8[_0xd12f('0x22')],'text':_0x1c31c8[_0xd12f('0xe')]},'json':!![]};return rp(_0x45765e)[_0xd12f('0x1d')](function(_0x5b2781){if(_0x5b2781['code']==0xca){_0x2c8fb7['message']=_0x5b2781;var _0x5076d9={'method':'POST','uri':_0xd12f('0x6f'),'headers':{'Authorization':_0xd12f('0x6e')+_0x4b00a2['apiKey'],'Content-Type':_0xd12f('0x53')},'body':{'refid':_0x2c8fb7[_0xd12f('0x70')][_0xd12f('0x71')]},'json':!![]};return rp(_0x5076d9)['then'](function(_0x1f6892){_0x2c8fb7['status']=_0x1f6892;var _0x14aec9={'messageId':_0x2c8fb7['message'][_0xd12f('0x71')],'read':!![]};return _0xd848dd[_0xd12f('0x15')](_0x14aec9);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd12f('0x2b'),'intelepeer',util[_0xd12f('0x2c')](_0x5b2781,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3b0a0a){return logger[_0xd12f('0x19')](_0xd12f('0x2a'),_0xd12f('0x2b'),_0xd12f('0x6c'),util[_0xd12f('0x2c')](_0x3b0a0a,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd12f('0x2a'),_0xd12f('0x2b'),'intelepeer',_0xd12f('0x72'));}break;}}})[_0xd12f('0x73')](function(){_0x59c17c();});}else{_0x59c17c();}}},'charset':_0xd12f('0x74'),'collate':_0xd12f('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2f9306a..962a35c 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 _0x04f9=['register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket'];(function(_0x167b27,_0x2bf9d9){var _0x86c6b9=function(_0x913f53){while(--_0x913f53){_0x167b27['push'](_0x167b27['shift']());}};_0x86c6b9(++_0x2bf9d9);}(_0x04f9,0x11b));var _0x904f=function(_0x647bb0,_0x30fb89){_0x647bb0=_0x647bb0-0x0;var _0x57f357=_0x04f9[_0x647bb0];return _0x57f357;};'use strict';var _=require(_0x904f('0x0'));var util=require('util');var moment=require(_0x904f('0x1'));var BPromise=require(_0x904f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x904f('0x3'))['db'];var utils=require(_0x904f('0x4'));var logger=require(_0x904f('0x5'))('rpc');var config=require(_0x904f('0x6'));var jayson=require(_0x904f('0x7'));var client=jayson[_0x904f('0x8')][_0x904f('0x9')]({'port':0x232a});config[_0x904f('0xa')]=_[_0x904f('0xb')](config[_0x904f('0xa')],{'host':_0x904f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x904f('0xa')]));require(_0x904f('0xd'))[_0x904f('0xe')](socket);function respondWithRpcPromise(_0x7891c5,_0x19a39d,_0x4c342d){return new BPromise(function(_0x508cea,_0x415a34){return client[_0x904f('0xf')](_0x7891c5,_0x4c342d)[_0x904f('0x10')](function(_0x329073){logger['info'](_0x904f('0x11'),_0x19a39d,_0x904f('0x12'));logger[_0x904f('0x13')](_0x904f('0x14'),_0x19a39d,_0x904f('0x12'),JSON[_0x904f('0x15')](_0x329073));if(_0x329073[_0x904f('0x16')]){if(_0x329073[_0x904f('0x16')][_0x904f('0x17')]===0x1f4){logger[_0x904f('0x16')](_0x904f('0x11'),_0x19a39d,_0x329073[_0x904f('0x16')][_0x904f('0x18')]);return _0x415a34(_0x329073[_0x904f('0x16')]['message']);}logger[_0x904f('0x16')](_0x904f('0x11'),_0x19a39d,_0x329073[_0x904f('0x16')][_0x904f('0x18')]);return _0x508cea(_0x329073[_0x904f('0x16')][_0x904f('0x18')]);}else{logger[_0x904f('0x19')]('SmsMessage,\x20%s,\x20%s',_0x19a39d,_0x904f('0x12'));_0x508cea(_0x329073[_0x904f('0x1a')][_0x904f('0x18')]);}})[_0x904f('0x1b')](function(_0x621978){logger[_0x904f('0x16')](_0x904f('0x11'),_0x19a39d,_0x621978);_0x415a34(_0x621978);});});}exports[_0x904f('0x1c')]=function(_0x81d37){var _0x5f55ab=this;return new Promise(function(_0x56c8d4,_0x42e6c9){return db[_0x904f('0x1d')][_0x904f('0x1e')](_0x81d37[_0x904f('0x1f')],{'raw':_0x81d37[_0x904f('0x20')]?_0x81d37[_0x904f('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5684e7){logger[_0x904f('0x19')]('CreateSmsMessage',_0x81d37);logger[_0x904f('0x13')](_0x904f('0x1c'),_0x81d37,JSON[_0x904f('0x15')](_0x5684e7));_0x56c8d4(_0x5684e7);})[_0x904f('0x1b')](function(_0x2030a4){logger[_0x904f('0x16')](_0x904f('0x1c'),_0x2030a4[_0x904f('0x18')],_0x81d37);_0x42e6c9(_0x5f55ab[_0x904f('0x16')](0x1f4,_0x2030a4[_0x904f('0x18')]));});});}; \ No newline at end of file +var _0x1aef=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SmsMessage','body','options','info','CreateSmsMessage','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x3ba58f,_0x1de6f3){var _0x4c8682=function(_0x1931da){while(--_0x1931da){_0x3ba58f['push'](_0x3ba58f['shift']());}};_0x4c8682(++_0x1de6f3);}(_0x1aef,0x19f));var _0xf1ae=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x1aef[_0x9df060];return _0x338dfe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf1ae('0x0'));var BPromise=require(_0xf1ae('0x1'));var rs=require(_0xf1ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf1ae('0x3'));var logger=require(_0xf1ae('0x4'))('rpc');var config=require(_0xf1ae('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf1ae('0x6')][_0xf1ae('0x7')]({'port':0x232a});config['redis']=_[_0xf1ae('0x8')](config[_0xf1ae('0x9')],{'host':_0xf1ae('0xa'),'port':0x18eb});var socket=require(_0xf1ae('0xb'))(new Redis(config['redis']));require(_0xf1ae('0xc'))[_0xf1ae('0xd')](socket);function respondWithRpcPromise(_0x306c0c,_0x4bbcc8,_0x4f9ea3){return new BPromise(function(_0x152940,_0x93706e){return client[_0xf1ae('0xe')](_0x306c0c,_0x4f9ea3)[_0xf1ae('0xf')](function(_0xb54bea){logger['info'](_0xf1ae('0x10'),_0x4bbcc8,_0xf1ae('0x11'));logger[_0xf1ae('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bbcc8,_0xf1ae('0x11'),JSON[_0xf1ae('0x13')](_0xb54bea));if(_0xb54bea[_0xf1ae('0x14')]){if(_0xb54bea[_0xf1ae('0x14')][_0xf1ae('0x15')]===0x1f4){logger['error'](_0xf1ae('0x10'),_0x4bbcc8,_0xb54bea['error']['message']);return _0x93706e(_0xb54bea[_0xf1ae('0x14')][_0xf1ae('0x16')]);}logger[_0xf1ae('0x14')](_0xf1ae('0x10'),_0x4bbcc8,_0xb54bea[_0xf1ae('0x14')][_0xf1ae('0x16')]);return _0x152940(_0xb54bea[_0xf1ae('0x14')]['message']);}else{logger['info'](_0xf1ae('0x10'),_0x4bbcc8,_0xf1ae('0x11'));_0x152940(_0xb54bea[_0xf1ae('0x17')][_0xf1ae('0x16')]);}})['catch'](function(_0x18419e){logger['error'](_0xf1ae('0x10'),_0x4bbcc8,_0x18419e);_0x93706e(_0x18419e);});});}exports['CreateSmsMessage']=function(_0x32af53){var _0x39c0cc=this;return new Promise(function(_0x4439ad,_0x3e62a3){return db[_0xf1ae('0x18')]['create'](_0x32af53[_0xf1ae('0x19')],{'raw':_0x32af53[_0xf1ae('0x1a')]?_0x32af53['options']['raw']===undefined?!![]:![]:!![]})[_0xf1ae('0xf')](function(_0x286a47){logger[_0xf1ae('0x1b')]('CreateSmsMessage',_0x32af53);logger[_0xf1ae('0x12')](_0xf1ae('0x1c'),_0x32af53,JSON[_0xf1ae('0x13')](_0x286a47));_0x4439ad(_0x286a47);})[_0xf1ae('0x1d')](function(_0x45b0b9){logger[_0xf1ae('0x14')](_0xf1ae('0x1c'),_0x45b0b9[_0xf1ae('0x16')],_0x32af53);_0x3e62a3(_0x39c0cc[_0xf1ae('0x14')](0x1f4,_0x45b0b9[_0xf1ae('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1797504..8790e19 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 _0x28e5=['update','register','smsMessage:','remove'];(function(_0x17038a,_0xfbda08){var _0x1a0aa1=function(_0x37d250){while(--_0x37d250){_0x17038a['push'](_0x17038a['shift']());}};_0x1a0aa1(++_0xfbda08);}(_0x28e5,0x11f));var _0x528e=function(_0x4160e2,_0x445a1d){_0x4160e2=_0x4160e2-0x0;var _0x512bd9=_0x28e5[_0x4160e2];return _0x512bd9;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x528e('0x0'),_0x528e('0x1')];function createListener(_0x1f3d60,_0x39f630){return function(_0x38c7d2){_0x39f630['emit'](_0x1f3d60,_0x38c7d2);};}function removeListener(_0x368838,_0x1b83a3){return function(){SmsMessageEvents['removeListener'](_0x368838,_0x1b83a3);};}exports[_0x528e('0x2')]=function(_0x1c23b2){for(var _0x311200=0x0,_0x2c6738=events['length'];_0x311200<_0x2c6738;_0x311200++){var _0x331b25=events[_0x311200];var _0x4eec98=createListener(_0x528e('0x3')+_0x331b25,_0x1c23b2);SmsMessageEvents['on'](_0x331b25,_0x4eec98);}}; \ No newline at end of file +var _0xec08=['emit','removeListener','register','length','smsMessage:','save','update'];(function(_0x1e3f92,_0x728070){var _0x10e99d=function(_0x10c3b4){while(--_0x10c3b4){_0x1e3f92['push'](_0x1e3f92['shift']());}};_0x10e99d(++_0x728070);}(_0xec08,0xad));var _0x8ec0=function(_0x503615,_0xbf65a7){_0x503615=_0x503615-0x0;var _0x169742=_0xec08[_0x503615];return _0x169742;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x8ec0('0x0'),'remove',_0x8ec0('0x1')];function createListener(_0x39b554,_0x450c3f){return function(_0x39a07b){_0x450c3f[_0x8ec0('0x2')](_0x39b554,_0x39a07b);};}function removeListener(_0x429e29,_0x28705b){return function(){SmsMessageEvents[_0x8ec0('0x3')](_0x429e29,_0x28705b);};}exports[_0x8ec0('0x4')]=function(_0xb911ef){for(var _0x3e50c7=0x0,_0xe6f4dc=events[_0x8ec0('0x5')];_0x3e50c7<_0xe6f4dc;_0x3e50c7++){var _0x1a06c8=events[_0x3e50c7];var _0x590a23=createListener(_0x8ec0('0x6')+_0x1a06c8,_0xb911ef);SmsMessageEvents['on'](_0x1a06c8,_0x590a23);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c451ea6..9e02b8a 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 _0x5c51=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','describe','show','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','util','path'];(function(_0x21964f,_0x242993){var _0x6f2a30=function(_0x505e1b){while(--_0x505e1b){_0x21964f['push'](_0x21964f['shift']());}};_0x6f2a30(++_0x242993);}(_0x5c51,0x115));var _0x15c5=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x5c51[_0x42bb6d];return _0x1db89b;};'use strict';var multer=require('multer');var util=require(_0x15c5('0x0'));var path=require(_0x15c5('0x1'));var timeout=require(_0x15c5('0x2'));var express=require(_0x15c5('0x3'));var router=express[_0x15c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x15c5('0x5'));var interaction=require(_0x15c5('0x6'));var config=require(_0x15c5('0x7'));var controller=require(_0x15c5('0x8'));router[_0x15c5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x15c5('0xa'),auth['isAuthenticated'](),controller[_0x15c5('0xb')]);router[_0x15c5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x15c5('0xc')]);router[_0x15c5('0x9')](_0x15c5('0xd'),auth[_0x15c5('0xe')](),controller[_0x15c5('0xf')]);router[_0x15c5('0x9')](_0x15c5('0x10'),auth[_0x15c5('0xe')](),controller[_0x15c5('0x11')]);router['get'](_0x15c5('0x12'),auth[_0x15c5('0xe')](),controller[_0x15c5('0x13')]);router[_0x15c5('0x14')]('/',auth['isAuthenticated'](),controller[_0x15c5('0x15')]);router['post']('/:id/teams',auth[_0x15c5('0xe')](),controller[_0x15c5('0x16')]);router[_0x15c5('0x14')]('/:id/users',auth[_0x15c5('0xe')](),controller[_0x15c5('0x17')]);router[_0x15c5('0x18')](_0x15c5('0x19'),auth[_0x15c5('0xe')](),controller['update']);router[_0x15c5('0x1a')]('/:id',auth[_0x15c5('0xe')](),controller[_0x15c5('0x1b')]);router['delete'](_0x15c5('0x10'),auth[_0x15c5('0xe')](),controller[_0x15c5('0x1c')]);router[_0x15c5('0x1a')](_0x15c5('0x12'),auth[_0x15c5('0xe')](),controller[_0x15c5('0x1d')]);module[_0x15c5('0x1e')]=router; \ No newline at end of file +var _0x13ea=['../../config/environment','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x383a2c,_0x51413d){var _0x21167c=function(_0x550959){while(--_0x550959){_0x383a2c['push'](_0x383a2c['shift']());}};_0x21167c(++_0x51413d);}(_0x13ea,0x1ba));var _0xa13e=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0x13ea[_0x456bd2];return _0x2218c1;};'use strict';var multer=require(_0xa13e('0x0'));var util=require(_0xa13e('0x1'));var path=require(_0xa13e('0x2'));var timeout=require(_0xa13e('0x3'));var express=require('express');var router=express[_0xa13e('0x4')]();var fs_extra=require(_0xa13e('0x5'));var auth=require(_0xa13e('0x6'));var interaction=require(_0xa13e('0x7'));var config=require(_0xa13e('0x8'));var controller=require(_0xa13e('0x9'));router['get']('/',auth[_0xa13e('0xa')](),controller[_0xa13e('0xb')]);router[_0xa13e('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xa13e('0xd')]);router[_0xa13e('0xc')](_0xa13e('0xe'),auth[_0xa13e('0xa')](),controller[_0xa13e('0xf')]);router[_0xa13e('0xc')](_0xa13e('0x10'),auth[_0xa13e('0xa')](),controller['getMembers']);router[_0xa13e('0xc')]('/:id/teams',auth[_0xa13e('0xa')](),controller[_0xa13e('0x11')]);router['get'](_0xa13e('0x12'),auth[_0xa13e('0xa')](),controller[_0xa13e('0x13')]);router[_0xa13e('0x14')]('/',auth[_0xa13e('0xa')](),controller[_0xa13e('0x15')]);router['post'](_0xa13e('0x16'),auth[_0xa13e('0xa')](),controller[_0xa13e('0x17')]);router[_0xa13e('0x14')](_0xa13e('0x12'),auth[_0xa13e('0xa')](),controller[_0xa13e('0x18')]);router[_0xa13e('0x19')]('/:id',auth[_0xa13e('0xa')](),controller['update']);router[_0xa13e('0x1a')](_0xa13e('0xe'),auth[_0xa13e('0xa')](),controller[_0xa13e('0x1b')]);router[_0xa13e('0x1a')](_0xa13e('0x16'),auth[_0xa13e('0xa')](),controller['removeTeams']);router[_0xa13e('0x1a')](_0xa13e('0x12'),auth[_0xa13e('0xa')](),controller[_0xa13e('0x1c')]);module[_0xa13e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 3bc99b3..357399f 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 _0x9f4a=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x1407d2,_0x1f93b5){var _0x158c07=function(_0x2f418c){while(--_0x2f418c){_0x1407d2['push'](_0x1407d2['shift']());}};_0x158c07(++_0x1f93b5);}(_0x9f4a,0x14e));var _0xa9f4=function(_0x5e9c9d,_0x56fa0b){_0x5e9c9d=_0x5e9c9d-0x0;var _0x24404e=_0x9f4a[_0x5e9c9d];return _0x24404e;};'use strict';var Sequelize=require(_0xa9f4('0x0'));module[_0xa9f4('0x1')]={'name':{'type':Sequelize[_0xa9f4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa9f4('0x2')]},'timeout':{'type':Sequelize[_0xa9f4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa9f4('0x4')]('rrmemory',_0xa9f4('0x5'),_0xa9f4('0x6'))}}; \ No newline at end of file +var _0x5dbb=['beepall','sequelize','STRING','INTEGER','rrmemory'];(function(_0x4f689e,_0x183d9e){var _0x4a6193=function(_0x29cb51){while(--_0x29cb51){_0x4f689e['push'](_0x4f689e['shift']());}};_0x4a6193(++_0x183d9e);}(_0x5dbb,0x10f));var _0xb5db=function(_0x43c6e1,_0x52a038){_0x43c6e1=_0x43c6e1-0x0;var _0x129d1a=_0x5dbb[_0x43c6e1];return _0x129d1a;};'use strict';var Sequelize=require(_0xb5db('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5db('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb5db('0x1')]},'timeout':{'type':Sequelize[_0xb5db('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb5db('0x3'),_0xb5db('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ad0aa95..e783a40 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 _0x9e7b=['type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','length','create','body','user','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','index','map','SmsQueue','fieldName'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9e7b,0xed));var _0xb9e7=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9e7b[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0xb9e7('0x0'));var rimraf=require(_0xb9e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9e7('0x2'));var rp=require(_0xb9e7('0x3'));var moment=require(_0xb9e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb9e7('0x5'));var util=require(_0xb9e7('0x6'));var path=require(_0xb9e7('0x7'));var sox=require(_0xb9e7('0x8'));var csv=require(_0xb9e7('0x9'));var ejs=require(_0xb9e7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9e7('0xb'));var squel=require(_0xb9e7('0xc'));var crypto=require(_0xb9e7('0xd'));var jsforce=require(_0xb9e7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb9e7('0x9'));var querystring=require(_0xb9e7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb9e7('0x10'));var qs=require(_0xb9e7('0x11'));var as=require(_0xb9e7('0x12'));var hardwareService=require(_0xb9e7('0x13'));var logger=require(_0xb9e7('0x14'))('api');var utils=require(_0xb9e7('0x15'));var config=require(_0xb9e7('0x16'));var licenseUtil=require(_0xb9e7('0x17'));var db=require(_0xb9e7('0x18'))['db'];config[_0xb9e7('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb9e7('0x1a'))(new Redis(config[_0xb9e7('0x19')]));require(_0xb9e7('0x1b'))[_0xb9e7('0x1c')](socket);function respondWithStatusCode(_0x1ba2ec,_0x4ca423){_0x4ca423=_0x4ca423||0xcc;return function(_0x36b87c){if(_0x36b87c){return _0x1ba2ec[_0xb9e7('0x1d')](_0x4ca423);}return _0x1ba2ec['status'](_0x4ca423)[_0xb9e7('0x1e')]();};}function respondWithResult(_0x337552,_0x5157af){_0x5157af=_0x5157af||0xc8;return function(_0x32a300){if(_0x32a300){return _0x337552[_0xb9e7('0x1f')](_0x5157af)[_0xb9e7('0x20')](_0x32a300);}};}function respondWithFilteredResult(_0x4dd995,_0x1188ec){return function(_0x458113){if(_0x458113){var _0x280839=typeof _0x1188ec['offset']===_0xb9e7('0x21')&&typeof _0x1188ec[_0xb9e7('0x22')]===_0xb9e7('0x21');var _0x46c9a7=_0x458113[_0xb9e7('0x23')];var _0x4c3290=_0x280839?0x0:_0x1188ec[_0xb9e7('0x24')];var _0x70e0f8=_0x280839?_0x458113[_0xb9e7('0x23')]:_0x1188ec[_0xb9e7('0x24')]+_0x1188ec['limit'];var _0x3c20d0;if(_0x70e0f8>=_0x46c9a7){_0x70e0f8=_0x46c9a7;_0x3c20d0=0xc8;}else{_0x3c20d0=0xce;}_0x4dd995[_0xb9e7('0x1f')](_0x3c20d0);return _0x4dd995[_0xb9e7('0x25')]('Content-Range',_0x4c3290+'-'+_0x70e0f8+'/'+_0x46c9a7)['json'](_0x458113);}return null;};}function patchUpdates(_0x31f4ee){return function(_0x57c827){try{jsonpatch[_0xb9e7('0x26')](_0x57c827,_0x31f4ee,!![]);}catch(_0x31acec){return BPromise[_0xb9e7('0x27')](_0x31acec);}return _0x57c827[_0xb9e7('0x28')]();};}function saveUpdates(_0x5375d4,_0x91fdeb){return function(_0x139068){if(_0x139068){return _0x139068[_0xb9e7('0x29')](_0x5375d4)[_0xb9e7('0x2a')](function(_0x278b33){return _0x278b33;});}return null;};}function removeEntity(_0x527473,_0x555d87){return function(_0x4d35ca){if(_0x4d35ca){return _0x4d35ca[_0xb9e7('0x2b')]()[_0xb9e7('0x2a')](function(){var _0x442fbe=_0x4d35ca['get']({'plain':!![]});var _0x57a5af=_0xb9e7('0x2c');return db[_0xb9e7('0x2d')][_0xb9e7('0x2b')]({'where':{'type':_0x57a5af,'resourceId':_0x442fbe['id']}})[_0xb9e7('0x2a')](function(){return _0x4d35ca;});})['then'](function(){_0x527473[_0xb9e7('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c725e,_0x30df1d){return function(_0x49b789){if(!_0x49b789){_0x3c725e[_0xb9e7('0x1d')](0x194);}return _0x49b789;};}function handleError(_0xde6b64,_0xe82bd8){_0xe82bd8=_0xe82bd8||0x1f4;return function(_0x186ea4){logger[_0xb9e7('0x2e')](_0x186ea4[_0xb9e7('0x2f')]);if(_0x186ea4[_0xb9e7('0x30')]){delete _0x186ea4[_0xb9e7('0x30')];}_0xde6b64[_0xb9e7('0x1f')](_0xe82bd8)['send'](_0x186ea4);};}exports[_0xb9e7('0x31')]=function(_0x409d33,_0x11d418){var _0x18734a={},_0x1ffb7d={},_0x445c9d={'count':0x0,'rows':[]};var _0x40565e=_[_0xb9e7('0x32')](db[_0xb9e7('0x33')]['rawAttributes'],function(_0x113c9b){return{'name':_0x113c9b[_0xb9e7('0x34')],'type':_0x113c9b[_0xb9e7('0x35')][_0xb9e7('0x36')]};});_0x1ffb7d[_0xb9e7('0x37')]=_[_0xb9e7('0x32')](_0x40565e,_0xb9e7('0x30'));_0x1ffb7d[_0xb9e7('0x38')]=_[_0xb9e7('0x39')](_0x409d33[_0xb9e7('0x38')]);_0x1ffb7d[_0xb9e7('0x3a')]=_[_0xb9e7('0x3b')](_0x1ffb7d[_0xb9e7('0x37')],_0x1ffb7d[_0xb9e7('0x38')]);_0x18734a[_0xb9e7('0x3c')]=_['intersection'](_0x1ffb7d[_0xb9e7('0x37')],qs['fields'](_0x409d33[_0xb9e7('0x38')]['fields']));_0x18734a['attributes']=_0x18734a[_0xb9e7('0x3c')]['length']?_0x18734a[_0xb9e7('0x3c')]:_0x1ffb7d[_0xb9e7('0x37')];if(!_0x409d33[_0xb9e7('0x38')][_0xb9e7('0x3d')](_0xb9e7('0x3e'))){_0x18734a[_0xb9e7('0x22')]=qs[_0xb9e7('0x22')](_0x409d33[_0xb9e7('0x38')][_0xb9e7('0x22')]);_0x18734a[_0xb9e7('0x24')]=qs[_0xb9e7('0x24')](_0x409d33[_0xb9e7('0x38')][_0xb9e7('0x24')]);}_0x18734a[_0xb9e7('0x3f')]=qs[_0xb9e7('0x40')](_0x409d33[_0xb9e7('0x38')]['sort']);_0x18734a[_0xb9e7('0x41')]=qs[_0xb9e7('0x3a')](_['pick'](_0x409d33['query'],_0x1ffb7d[_0xb9e7('0x3a')]),_0x40565e);if(_0x409d33[_0xb9e7('0x38')]['filter']){_0x18734a[_0xb9e7('0x41')]=_[_0xb9e7('0x42')](_0x18734a['where'],{'$or':_[_0xb9e7('0x32')](_0x40565e,function(_0x39ae0){if(_0x39ae0[_0xb9e7('0x35')]!=='VIRTUAL'){var _0x3348c8={};_0x3348c8[_0x39ae0[_0xb9e7('0x30')]]={'$like':'%'+_0x409d33['query'][_0xb9e7('0x43')]+'%'};return _0x3348c8;}})});}_0x18734a=_[_0xb9e7('0x42')]({},_0x18734a,_0x409d33[_0xb9e7('0x44')]);var _0x9be6ed={'where':_0x18734a[_0xb9e7('0x41')]};return db[_0xb9e7('0x33')][_0xb9e7('0x23')](_0x9be6ed)[_0xb9e7('0x2a')](function(_0x1c77f8){_0x445c9d['count']=_0x1c77f8;if(_0x409d33[_0xb9e7('0x38')][_0xb9e7('0x45')]){_0x18734a[_0xb9e7('0x46')]=[{'all':!![]}];}return db[_0xb9e7('0x33')]['findAll'](_0x18734a);})[_0xb9e7('0x2a')](function(_0x508f61){_0x445c9d[_0xb9e7('0x47')]=_0x508f61;return _0x445c9d;})[_0xb9e7('0x2a')](respondWithFilteredResult(_0x11d418,_0x18734a))[_0xb9e7('0x48')](handleError(_0x11d418,null));};exports[_0xb9e7('0x49')]=function(_0x9e2fdb,_0x265c9f){var _0x153167={'raw':!![],'where':{'id':_0x9e2fdb[_0xb9e7('0x4a')]['id']}},_0x5891fd={};_0x5891fd['model']=_[_0xb9e7('0x39')](db[_0xb9e7('0x33')][_0xb9e7('0x4b')]);_0x5891fd['query']=_[_0xb9e7('0x39')](_0x9e2fdb[_0xb9e7('0x38')]);_0x5891fd[_0xb9e7('0x3a')]=_[_0xb9e7('0x3b')](_0x5891fd[_0xb9e7('0x37')],_0x5891fd[_0xb9e7('0x38')]);_0x153167[_0xb9e7('0x3c')]=_[_0xb9e7('0x3b')](_0x5891fd[_0xb9e7('0x37')],qs[_0xb9e7('0x4c')](_0x9e2fdb[_0xb9e7('0x38')]['fields']));_0x153167[_0xb9e7('0x3c')]=_0x153167[_0xb9e7('0x3c')][_0xb9e7('0x4d')]?_0x153167[_0xb9e7('0x3c')]:_0x5891fd[_0xb9e7('0x37')];if(_0x9e2fdb['query'][_0xb9e7('0x45')]){_0x153167[_0xb9e7('0x46')]=[{'all':!![]}];}_0x153167=_[_0xb9e7('0x42')]({},_0x153167,_0x9e2fdb['options']);return db['SmsQueue']['find'](_0x153167)[_0xb9e7('0x2a')](handleEntityNotFound(_0x265c9f,null))['then'](respondWithResult(_0x265c9f,null))[_0xb9e7('0x48')](handleError(_0x265c9f,null));};exports['create']=function(_0x50a81f,_0x2094a8){return db[_0xb9e7('0x33')][_0xb9e7('0x4e')](_0x50a81f[_0xb9e7('0x4f')],{})[_0xb9e7('0x2a')](function(_0x2080be){var _0x3cedad=_0x50a81f[_0xb9e7('0x50')][_0xb9e7('0x51')]({'plain':!![]});if(!_0x3cedad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cedad[_0xb9e7('0x52')]==='user'){var _0x1f6df6=_0x2080be['get']({'plain':!![]});var _0x1fc7f7=_0xb9e7('0x2c');return db['UserProfileSection'][_0xb9e7('0x53')]({'where':{'name':_0x1fc7f7,'userProfileId':_0x3cedad[_0xb9e7('0x54')]},'raw':!![]})[_0xb9e7('0x2a')](function(_0x3b4d73){if(_0x3b4d73&&_0x3b4d73[_0xb9e7('0x55')]===0x0){return db[_0xb9e7('0x2d')][_0xb9e7('0x4e')]({'name':_0x1f6df6[_0xb9e7('0x30')],'resourceId':_0x1f6df6['id'],'type':_0x3b4d73[_0xb9e7('0x30')],'sectionId':_0x3b4d73['id']},{})[_0xb9e7('0x2a')](function(){return _0x2080be;});}else{return _0x2080be;}})[_0xb9e7('0x48')](function(_0x5523e2){logger['error'](_0xb9e7('0x56'),_0x5523e2);throw _0x5523e2;});}return _0x2080be;})[_0xb9e7('0x2a')](respondWithResult(_0x2094a8,0xc9))[_0xb9e7('0x48')](handleError(_0x2094a8,null));};exports[_0xb9e7('0x29')]=function(_0x5a3fe9,_0x5412e9){if(_0x5a3fe9[_0xb9e7('0x4f')]['id']){delete _0x5a3fe9['body']['id'];}return db[_0xb9e7('0x33')][_0xb9e7('0x53')]({'where':{'id':_0x5a3fe9[_0xb9e7('0x4a')]['id']}})[_0xb9e7('0x2a')](handleEntityNotFound(_0x5412e9,null))[_0xb9e7('0x2a')](saveUpdates(_0x5a3fe9[_0xb9e7('0x4f')],null))['then'](respondWithResult(_0x5412e9,null))[_0xb9e7('0x48')](handleError(_0x5412e9,null));};exports['destroy']=function(_0x4af930,_0x306f4c){return db['SmsQueue'][_0xb9e7('0x53')]({'where':{'id':_0x4af930[_0xb9e7('0x4a')]['id']}})[_0xb9e7('0x2a')](handleEntityNotFound(_0x306f4c,null))[_0xb9e7('0x2a')](removeEntity(_0x306f4c,null))[_0xb9e7('0x48')](handleError(_0x306f4c,null));};exports[_0xb9e7('0x57')]=function(_0x47fd36,_0x376ba6){return db[_0xb9e7('0x33')][_0xb9e7('0x57')]()[_0xb9e7('0x2a')](respondWithResult(_0x376ba6,null))[_0xb9e7('0x48')](handleError(_0x376ba6,null));};exports[_0xb9e7('0x58')]=function(_0x44c2c7,_0x5e184a,_0x28f10c){var _0x236057={'raw':!![],'where':{}},_0xb868db={},_0x5b5675;return db[_0xb9e7('0x33')][_0xb9e7('0x59')]({'where':{'id':_0x44c2c7[_0xb9e7('0x4a')]['id']}})[_0xb9e7('0x2a')](handleEntityNotFound(_0x5e184a,null))['then'](function(_0x4868f0){if(_0x4868f0){_0x5b5675=_0x4868f0['get']({'plain':!![]});_0xb868db['model']=_[_0xb9e7('0x39')](db[_0xb9e7('0x5a')][_0xb9e7('0x4b')]);_0xb868db[_0xb9e7('0x38')]=_['keys'](_0x44c2c7['query']);_0xb868db[_0xb9e7('0x3a')]=_[_0xb9e7('0x3b')](_0xb868db[_0xb9e7('0x37')],_0xb868db['query']);_0x236057[_0xb9e7('0x3c')]=_['intersection'](_0xb868db[_0xb9e7('0x37')],qs['fields'](_0x44c2c7[_0xb9e7('0x38')][_0xb9e7('0x4c')]));_0x236057[_0xb9e7('0x3c')]=_0x236057['attributes'][_0xb9e7('0x4d')]?_0x236057[_0xb9e7('0x3c')]:_0xb868db[_0xb9e7('0x37')];if(!_0x44c2c7[_0xb9e7('0x38')][_0xb9e7('0x3d')]('nolimit')){_0x236057[_0xb9e7('0x22')]=qs[_0xb9e7('0x22')](_0x44c2c7[_0xb9e7('0x38')][_0xb9e7('0x22')]);_0x236057['offset']=qs['offset'](_0x44c2c7[_0xb9e7('0x38')][_0xb9e7('0x24')]);}_0x236057['order']=qs[_0xb9e7('0x40')](_0x44c2c7[_0xb9e7('0x38')][_0xb9e7('0x40')]);_0x236057[_0xb9e7('0x41')]=qs[_0xb9e7('0x3a')](_[_0xb9e7('0x5b')](_0x44c2c7['query'],_0xb868db['filters']));_0x236057[_0xb9e7('0x41')][_0xb9e7('0x5c')]=_0x4868f0['id'];if(_0x44c2c7[_0xb9e7('0x38')][_0xb9e7('0x43')]){_0x236057[_0xb9e7('0x41')]=_['merge'](_0x236057['where'],{'$or':_[_0xb9e7('0x32')](_0x236057['attributes'],function(_0x5e3d0c){var _0x1fb093={};_0x1fb093[_0x5e3d0c]={'$like':'%'+_0x44c2c7[_0xb9e7('0x38')]['filter']+'%'};return _0x1fb093;})});}_0x236057=_[_0xb9e7('0x42')]({},_0x236057,_0x44c2c7[_0xb9e7('0x44')]);return db[_0xb9e7('0x5a')][_0xb9e7('0x5d')](_0x236057);}})['then'](function(_0x30f9a4){if(_0x30f9a4){return db[_0xb9e7('0x5e')][_0xb9e7('0x5f')]({'where':{'id':_['map'](_0x30f9a4,_0xb9e7('0x60')),'role':_0xb9e7('0x61')},'attributes':['id',_0xb9e7('0x30'),_0xb9e7('0x62'),_0xb9e7('0x63'),_0xb9e7('0x64')]});}})['then'](function(_0x2dead7){if(_0x2dead7){return{'count':_0x2dead7[_0xb9e7('0x23')],'rows':_['map'](_0x2dead7[_0xb9e7('0x47')],function(_0xc43470){return{'membername':_0xc43470[_0xb9e7('0x30')],'UserId':_0xc43470['id'],'queue_name':_0x5b5675[_0xb9e7('0x30')],'SmsQueueId':_0x5b5675['id'],'interface':util[_0xb9e7('0x65')](_0xb9e7('0x66'),_0xb9e7('0x67'),_0xc43470[_0xb9e7('0x30')]),'penalty':0x0,'paused':_0xc43470[_0xb9e7('0x62')],'createdAt':_0xc43470[_0xb9e7('0x64')],'updatedAt':_0xc43470[_0xb9e7('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb9e7('0x2a')](respondWithFilteredResult(_0x5e184a,_0x236057))[_0xb9e7('0x48')](handleError(_0x5e184a,null));};exports['getTeams']=function(_0x2c3552,_0x131c2c,_0x1fcd0c){var _0x40f36a={};var _0x5de9a7={};var _0x4bce59;var _0x4a3820;return db['SmsQueue'][_0xb9e7('0x59')]({'where':{'id':_0x2c3552['params']['id']}})[_0xb9e7('0x2a')](handleEntityNotFound(_0x131c2c,null))[_0xb9e7('0x2a')](function(_0x469543){if(_0x469543){_0x4bce59=_0x469543;_0x5de9a7['model']=_['keys'](db[_0xb9e7('0x68')][_0xb9e7('0x4b')]);_0x5de9a7['query']=_[_0xb9e7('0x39')](_0x2c3552[_0xb9e7('0x38')]);_0x5de9a7['filters']=_[_0xb9e7('0x3b')](_0x5de9a7[_0xb9e7('0x37')],_0x5de9a7['query']);_0x40f36a[_0xb9e7('0x3c')]=_[_0xb9e7('0x3b')](_0x5de9a7[_0xb9e7('0x37')],qs['fields'](_0x2c3552[_0xb9e7('0x38')][_0xb9e7('0x4c')]));_0x40f36a[_0xb9e7('0x3c')]=_0x40f36a['attributes'][_0xb9e7('0x4d')]?_0x40f36a['attributes']:_0x5de9a7[_0xb9e7('0x37')];_0x40f36a[_0xb9e7('0x3f')]=qs[_0xb9e7('0x40')](_0x2c3552['query'][_0xb9e7('0x40')]);_0x40f36a[_0xb9e7('0x41')]=qs['filters'](_[_0xb9e7('0x5b')](_0x2c3552['query'],_0x5de9a7[_0xb9e7('0x3a')]));if(_0x2c3552['query']['filter']){_0x40f36a['where']=_['merge'](_0x40f36a['where'],{'$or':_[_0xb9e7('0x32')](_0x40f36a[_0xb9e7('0x3c')],function(_0x5ac80b){var _0xc5ac14={};_0xc5ac14[_0x5ac80b]={'$like':'%'+_0x2c3552[_0xb9e7('0x38')][_0xb9e7('0x43')]+'%'};return _0xc5ac14;})});}_0x40f36a=_[_0xb9e7('0x42')]({},_0x40f36a,_0x2c3552['options']);return _0x4bce59[_0xb9e7('0x69')](_0x40f36a);}})[_0xb9e7('0x2a')](function(_0x270247){if(_0x270247){_0x4a3820=_0x270247['length'];if(!_0x2c3552[_0xb9e7('0x38')][_0xb9e7('0x3d')](_0xb9e7('0x3e'))){_0x40f36a[_0xb9e7('0x22')]=qs[_0xb9e7('0x22')](_0x2c3552[_0xb9e7('0x38')]['limit']);_0x40f36a['offset']=qs[_0xb9e7('0x24')](_0x2c3552['query'][_0xb9e7('0x24')]);}return _0x4bce59[_0xb9e7('0x69')](_0x40f36a);}})[_0xb9e7('0x2a')](function(_0x18aafe){if(_0x18aafe){return _0x18aafe?{'count':_0x4a3820,'rows':_0x18aafe}:null;}})[_0xb9e7('0x2a')](respondWithResult(_0x131c2c,null))[_0xb9e7('0x48')](handleError(_0x131c2c,null));};exports['addTeams']=function(_0x48c578,_0x2062a2,_0x51ca24){var _0xa74a3f=_0x48c578['body'][_0xb9e7('0x6a')];return db['Team'][_0xb9e7('0x5d')]({'where':{'id':_0xa74a3f},'attributes':['id'],'include':[{'model':db[_0xb9e7('0x5e')],'as':_0xb9e7('0x6b'),'attributes':['id','name',_0xb9e7('0x6c'),_0xb9e7('0x6d'),_0xb9e7('0x6e')],'raw':!![]}]})[_0xb9e7('0x2a')](function(_0x4fc274){if(_0x4fc274){var _0x3b1b3f=_[_0xb9e7('0x6f')](_0x4fc274,function(_0x4122b5){var _0x248956=_0x4122b5['get']({'plain':!![]});return _0x248956[_0xb9e7('0x6b')];});return db[_0xb9e7('0x33')][_0xb9e7('0x53')]({'where':{'id':_0x48c578[_0xb9e7('0x4a')]['id']}})[_0xb9e7('0x2a')](function(_0x12baeb){return db[_0xb9e7('0x70')]['transaction'](function(_0x3ae89f){return _0x12baeb[_0xb9e7('0x71')](_0xa74a3f,{'transaction':_0x3ae89f})[_0xb9e7('0x2a')](function(){return BPromise[_0xb9e7('0x72')](_0x3b1b3f,function(_0x2de6ab){return db['UserSmsQueue'][_0xb9e7('0x73')]({'where':{'UserId':_0x2de6ab['id'],'SmsQueueId':_0x48c578[_0xb9e7('0x4a')]['id']},'transaction':_0x3ae89f});});})[_0xb9e7('0x2a')](function(){_0x3b1b3f[_0xb9e7('0x74')](function(_0x55b088){socket[_0xb9e7('0x75')](_0xb9e7('0x76'),{'UserId':_0x55b088['id'],'SmsQueueId':_0x12baeb['id']});});});});});}})[_0xb9e7('0x2a')](respondWithStatusCode(_0x2062a2,null))[_0xb9e7('0x48')](handleError(_0x2062a2,null));};exports[_0xb9e7('0x77')]=function(_0xc04890,_0x17a04e,_0xbda634){return db[_0xb9e7('0x68')][_0xb9e7('0x5d')]({'where':{'id':_0xc04890[_0xb9e7('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb9e7('0x5e')],'as':_0xb9e7('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xb9e7('0x2a')](handleEntityNotFound(_0x17a04e,null))[_0xb9e7('0x2a')](function(_0x1a3f1b){var _0x375670=_[_0xb9e7('0x32')](_0x1a3f1b,'id');var _0x493293=[];var _0x465f5f=[];var _0x44cdd5=squel[_0xb9e7('0x78')]();_0x44cdd5[_0xb9e7('0x79')](_0xb9e7('0x7a'))['from'](_0xb9e7('0x7b'),'tq')[_0xb9e7('0x7c')](_0xb9e7('0x7d'),'ut',_0xb9e7('0x7e'))['where']('SmsQueueId\x20=\x20?',_0xc04890[_0xb9e7('0x4a')]['id']);for(var _0x4a6e76=0x0;_0x4a6e76<_0x1a3f1b['length'];_0x4a6e76+=0x1){let _0x225b5b=_0x1a3f1b[_0x4a6e76];for(var _0xe996dd=0x0;_0xe996dd<_0x225b5b['Agents'][_0xb9e7('0x4d')];_0xe996dd+=0x1){let _0x47a62e=_0x225b5b['Agents'][_0xe996dd];var _0x416621=_0x44cdd5[_0xb9e7('0x7f')]();_0x416621[_0xb9e7('0x41')]('ut.UserId\x20=\x20?',_0x47a62e['id']);_0x465f5f[_0xb9e7('0x80')](db[_0xb9e7('0x70')][_0xb9e7('0x38')](_0x416621[_0xb9e7('0x81')](),{'type':db[_0xb9e7('0x70')]['QueryTypes'][_0xb9e7('0x82')]})[_0xb9e7('0x2a')](function(_0x15f683){if(_0x15f683[_0xb9e7('0x4d')]===0x1){return _0x47a62e['id'];}else{var _0x445317=_[_0xb9e7('0x83')](_[_0xb9e7('0x32')](_0x15f683,_0xb9e7('0x84')),function(_0x5c7da5){return _[_0xb9e7('0x85')](_0x375670,_0x5c7da5);});if(_0x445317){return _0x47a62e['id'];}}}));}}return BPromise[_0xb9e7('0x86')](_0x465f5f)['then'](function(_0x2f299f){_0x493293=_(_0x493293)[_0xb9e7('0x87')](_0x2f299f)[_0xb9e7('0x88')]()[_0xb9e7('0x89')]();return db['SmsQueue'][_0xb9e7('0x53')]({'where':{'id':_0xc04890[_0xb9e7('0x4a')]['id']}})['then'](function(_0x1a96c5){return db[_0xb9e7('0x70')]['transaction'](function(_0x2ff4d1){return _0x1a96c5[_0xb9e7('0x77')](_0xc04890[_0xb9e7('0x38')][_0xb9e7('0x6a')],{'transaction':_0x2ff4d1})[_0xb9e7('0x2a')](function(){if(!_[_0xb9e7('0x8a')](_0x493293)){return _0x1a96c5[_0xb9e7('0x8b')](_0x493293,{'transaction':_0x2ff4d1});}})[_0xb9e7('0x2a')](function(){_0x493293[_0xb9e7('0x74')](function(_0x3689f6){socket[_0xb9e7('0x75')](_0xb9e7('0x8c'),{'UserId':_0x3689f6,'SmsQueueId':_0x1a96c5['id']});});});});});});})[_0xb9e7('0x2a')](respondWithStatusCode(_0x17a04e,null))[_0xb9e7('0x48')](handleError(_0x17a04e,null));};exports[_0xb9e7('0x8d')]=function(_0x47661b,_0x3abe86,_0x1837ac){return db['SmsQueue'][_0xb9e7('0x53')]({'where':{'id':_0x47661b[_0xb9e7('0x4a')]['id']}})[_0xb9e7('0x2a')](handleEntityNotFound(_0x3abe86,null))['then'](function(_0x24308a){if(_0x24308a){return _0x24308a[_0xb9e7('0x8d')](_0x47661b[_0xb9e7('0x4f')][_0xb9e7('0x6a')],_[_0xb9e7('0x8e')](_0x47661b[_0xb9e7('0x4f')],[_0xb9e7('0x6a'),'id'])||{})['spread'](function(_0x1551ad){for(var _0x509962=0x0;_0x509962<_0x47661b[_0xb9e7('0x4f')]['ids'][_0xb9e7('0x4d')];_0x509962+=0x1){socket[_0xb9e7('0x75')](_0xb9e7('0x76'),{'UserId':Number(_0x47661b['body'][_0xb9e7('0x6a')][_0x509962]),'SmsQueueId':Number(_0x47661b['params']['id'])});}return _0x1551ad;});}})[_0xb9e7('0x2a')](respondWithResult(_0x3abe86,null))[_0xb9e7('0x48')](handleError(_0x3abe86,null));};exports[_0xb9e7('0x8b')]=function(_0x3b3360,_0x31d6f8,_0x376b21){return db[_0xb9e7('0x33')]['find']({'where':{'id':_0x3b3360[_0xb9e7('0x4a')]['id']}})[_0xb9e7('0x2a')](handleEntityNotFound(_0x31d6f8,null))[_0xb9e7('0x2a')](function(_0x3635e8){if(_0x3635e8){return _0x3635e8[_0xb9e7('0x8b')](_0x3b3360['query'][_0xb9e7('0x6a')])[_0xb9e7('0x2a')](function(){if(_[_0xb9e7('0x8f')](_0x3b3360[_0xb9e7('0x38')]['ids'])){for(var _0x4e5709=0x0;_0x4e5709<_0x3b3360[_0xb9e7('0x38')][_0xb9e7('0x6a')][_0xb9e7('0x4d')];_0x4e5709+=0x1){socket[_0xb9e7('0x75')]('userSmsQueue:remove',{'UserId':Number(_0x3b3360[_0xb9e7('0x38')][_0xb9e7('0x6a')][_0x4e5709]),'SmsQueueId':Number(_0x3b3360[_0xb9e7('0x4a')]['id'])});}}else{socket['emit'](_0xb9e7('0x8c'),{'UserId':Number(_0x3b3360['query'][_0xb9e7('0x6a')]),'SmsQueueId':Number(_0x3b3360['params']['id'])});}});}})[_0xb9e7('0x2a')](respondWithStatusCode(_0x31d6f8,null))[_0xb9e7('0x48')](handleError(_0x31d6f8,null));};exports[_0xb9e7('0x90')]=function(_0x29f1f3,_0x158f6c,_0xec383){var _0x1f005c={};var _0x4be913={};var _0x4388fe;var _0x5bef75;return db[_0xb9e7('0x33')][_0xb9e7('0x59')]({'where':{'id':_0x29f1f3[_0xb9e7('0x4a')]['id']}})[_0xb9e7('0x2a')](handleEntityNotFound(_0x158f6c,null))['then'](function(_0x37a0ce){if(_0x37a0ce){_0x4388fe=_0x37a0ce;_0x4be913[_0xb9e7('0x37')]=_[_0xb9e7('0x39')](db['User'][_0xb9e7('0x4b')]);_0x4be913[_0xb9e7('0x38')]=_[_0xb9e7('0x39')](_0x29f1f3[_0xb9e7('0x38')]);_0x4be913[_0xb9e7('0x3a')]=_[_0xb9e7('0x3b')](_0x4be913[_0xb9e7('0x37')],_0x4be913[_0xb9e7('0x38')]);_0x1f005c[_0xb9e7('0x3c')]=_['intersection'](_0x4be913[_0xb9e7('0x37')],qs['fields'](_0x29f1f3['query']['fields']));_0x1f005c[_0xb9e7('0x3c')]=_0x1f005c[_0xb9e7('0x3c')]['length']?_0x1f005c[_0xb9e7('0x3c')]:_0x4be913[_0xb9e7('0x37')];_0x1f005c[_0xb9e7('0x3f')]=qs[_0xb9e7('0x40')](_0x29f1f3[_0xb9e7('0x38')][_0xb9e7('0x40')]);_0x1f005c[_0xb9e7('0x41')]=qs[_0xb9e7('0x3a')](_[_0xb9e7('0x5b')](_0x29f1f3[_0xb9e7('0x38')],_0x4be913[_0xb9e7('0x3a')]));if(_0x29f1f3[_0xb9e7('0x38')][_0xb9e7('0x43')]){_0x1f005c[_0xb9e7('0x41')]=_[_0xb9e7('0x42')](_0x1f005c[_0xb9e7('0x41')],{'$or':_[_0xb9e7('0x32')](_0x1f005c[_0xb9e7('0x3c')],function(_0x4b43e4){var _0x256d12={};_0x256d12[_0x4b43e4]={'$like':'%'+_0x29f1f3[_0xb9e7('0x38')][_0xb9e7('0x43')]+'%'};return _0x256d12;})});}_0x1f005c=_['merge']({},_0x1f005c,_0x29f1f3[_0xb9e7('0x44')]);return _0x4388fe[_0xb9e7('0x90')](_0x1f005c);}})['then'](function(_0x5d2293){if(_0x5d2293){_0x5bef75=_0x5d2293['length'];if(!_0x29f1f3[_0xb9e7('0x38')][_0xb9e7('0x3d')](_0xb9e7('0x3e'))){_0x1f005c[_0xb9e7('0x22')]=qs[_0xb9e7('0x22')](_0x29f1f3[_0xb9e7('0x38')][_0xb9e7('0x22')]);_0x1f005c['offset']=qs[_0xb9e7('0x24')](_0x29f1f3[_0xb9e7('0x38')][_0xb9e7('0x24')]);}return _0x4388fe['getAgents'](_0x1f005c);}})[_0xb9e7('0x2a')](function(_0x14953a){if(_0x14953a){return _0x14953a?{'count':_0x5bef75,'rows':_0x14953a}:null;}})['then'](respondWithResult(_0x158f6c,null))['catch'](handleError(_0x158f6c,null));}; \ No newline at end of file +var _0xd8d6=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','SmsQueues','UserProfileResource','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','model','keys','filters','query','fields','attributes','length','order','sort','where','filter','merge','options','include','findAll','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','nolimit','pick','SmsQueueId','User','findAndCountAll','UserId','smsPause','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','emit','userSmsQueue:save','select','field','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4fb1d4,_0x22b151){var _0x1f108d=function(_0x520a94){while(--_0x520a94){_0x4fb1d4['push'](_0x4fb1d4['shift']());}};_0x1f108d(++_0x22b151);}(_0xd8d6,0x7b));var _0x6d8d=function(_0x451201,_0x462158){_0x451201=_0x451201-0x0;var _0x6fe437=_0xd8d6[_0x451201];return _0x6fe437;};'use strict';var emlformat=require(_0x6d8d('0x0'));var rimraf=require(_0x6d8d('0x1'));var zipdir=require(_0x6d8d('0x2'));var jsonpatch=require(_0x6d8d('0x3'));var rp=require(_0x6d8d('0x4'));var moment=require(_0x6d8d('0x5'));var BPromise=require(_0x6d8d('0x6'));var Mustache=require(_0x6d8d('0x7'));var util=require(_0x6d8d('0x8'));var path=require(_0x6d8d('0x9'));var sox=require(_0x6d8d('0xa'));var csv=require(_0x6d8d('0xb'));var ejs=require(_0x6d8d('0xc'));var fs=require('fs');var fs_extra=require(_0x6d8d('0xd'));var _=require(_0x6d8d('0xe'));var squel=require(_0x6d8d('0xf'));var crypto=require(_0x6d8d('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x6d8d('0x11'));var toCsv=require(_0x6d8d('0xb'));var querystring=require('querystring');var Papa=require(_0x6d8d('0x12'));var Redis=require(_0x6d8d('0x13'));var authService=require(_0x6d8d('0x14'));var qs=require(_0x6d8d('0x15'));var as=require(_0x6d8d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d8d('0x17'));var utils=require(_0x6d8d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6d8d('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6d8d('0x1a')](config[_0x6d8d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d8d('0x1c'))(new Redis(config[_0x6d8d('0x1b')]));require(_0x6d8d('0x1d'))['register'](socket);function respondWithStatusCode(_0x563a4c,_0x2efbbd){_0x2efbbd=_0x2efbbd||0xcc;return function(_0x4938f3){if(_0x4938f3){return _0x563a4c[_0x6d8d('0x1e')](_0x2efbbd);}return _0x563a4c[_0x6d8d('0x1f')](_0x2efbbd)[_0x6d8d('0x20')]();};}function respondWithResult(_0x3ab0f8,_0x5dd92b){_0x5dd92b=_0x5dd92b||0xc8;return function(_0x1909a4){if(_0x1909a4){return _0x3ab0f8[_0x6d8d('0x1f')](_0x5dd92b)[_0x6d8d('0x21')](_0x1909a4);}};}function respondWithFilteredResult(_0x37942d,_0x3d09be){return function(_0x3b47e0){if(_0x3b47e0){var _0xf41749=typeof _0x3d09be[_0x6d8d('0x22')]===_0x6d8d('0x23')&&typeof _0x3d09be[_0x6d8d('0x24')]===_0x6d8d('0x23');var _0x309b00=_0x3b47e0['count'];var _0x4f853a=_0xf41749?0x0:_0x3d09be['offset'];var _0x6af748=_0xf41749?_0x3b47e0[_0x6d8d('0x25')]:_0x3d09be['offset']+_0x3d09be['limit'];var _0xd68ef3;if(_0x6af748>=_0x309b00){_0x6af748=_0x309b00;_0xd68ef3=0xc8;}else{_0xd68ef3=0xce;}_0x37942d[_0x6d8d('0x1f')](_0xd68ef3);return _0x37942d[_0x6d8d('0x26')]('Content-Range',_0x4f853a+'-'+_0x6af748+'/'+_0x309b00)[_0x6d8d('0x21')](_0x3b47e0);}return null;};}function patchUpdates(_0x549089){return function(_0x3bd49b){try{jsonpatch['apply'](_0x3bd49b,_0x549089,!![]);}catch(_0x5cb921){return BPromise[_0x6d8d('0x27')](_0x5cb921);}return _0x3bd49b[_0x6d8d('0x28')]();};}function saveUpdates(_0x45fd80,_0x473771){return function(_0x5dc84d){if(_0x5dc84d){return _0x5dc84d['update'](_0x45fd80)[_0x6d8d('0x29')](function(_0x50b4bd){return _0x50b4bd;});}return null;};}function removeEntity(_0x1e5206,_0x1cea03){return function(_0x114338){if(_0x114338){return _0x114338[_0x6d8d('0x2a')]()['then'](function(){var _0x1fc833=_0x114338[_0x6d8d('0x2b')]({'plain':!![]});var _0x144a8b=_0x6d8d('0x2c');return db[_0x6d8d('0x2d')][_0x6d8d('0x2a')]({'where':{'type':_0x144a8b,'resourceId':_0x1fc833['id']}})[_0x6d8d('0x29')](function(){return _0x114338;});})['then'](function(){_0x1e5206[_0x6d8d('0x1f')](0xcc)[_0x6d8d('0x20')]();});}};}function handleEntityNotFound(_0x5c0c11,_0x5c4926){return function(_0x1edb97){if(!_0x1edb97){_0x5c0c11[_0x6d8d('0x1e')](0x194);}return _0x1edb97;};}function handleError(_0x5927bb,_0xda310b){_0xda310b=_0xda310b||0x1f4;return function(_0x3af4f7){logger['error'](_0x3af4f7['stack']);if(_0x3af4f7[_0x6d8d('0x2e')]){delete _0x3af4f7[_0x6d8d('0x2e')];}_0x5927bb[_0x6d8d('0x1f')](_0xda310b)[_0x6d8d('0x2f')](_0x3af4f7);};}exports[_0x6d8d('0x30')]=function(_0x4eb427,_0x5a9c02){var _0x171960={},_0x1c682f={},_0x32df8e={'count':0x0,'rows':[]};var _0x39f98a=_[_0x6d8d('0x31')](db[_0x6d8d('0x32')][_0x6d8d('0x33')],function(_0x4d436b){return{'name':_0x4d436b[_0x6d8d('0x34')],'type':_0x4d436b[_0x6d8d('0x35')]['key']};});_0x1c682f[_0x6d8d('0x36')]=_['map'](_0x39f98a,_0x6d8d('0x2e'));_0x1c682f['query']=_[_0x6d8d('0x37')](_0x4eb427['query']);_0x1c682f[_0x6d8d('0x38')]=_['intersection'](_0x1c682f['model'],_0x1c682f[_0x6d8d('0x39')]);_0x171960['attributes']=_['intersection'](_0x1c682f[_0x6d8d('0x36')],qs[_0x6d8d('0x3a')](_0x4eb427['query'][_0x6d8d('0x3a')]));_0x171960[_0x6d8d('0x3b')]=_0x171960[_0x6d8d('0x3b')][_0x6d8d('0x3c')]?_0x171960[_0x6d8d('0x3b')]:_0x1c682f[_0x6d8d('0x36')];if(!_0x4eb427[_0x6d8d('0x39')]['hasOwnProperty']('nolimit')){_0x171960[_0x6d8d('0x24')]=qs['limit'](_0x4eb427[_0x6d8d('0x39')][_0x6d8d('0x24')]);_0x171960[_0x6d8d('0x22')]=qs[_0x6d8d('0x22')](_0x4eb427[_0x6d8d('0x39')]['offset']);}_0x171960[_0x6d8d('0x3d')]=qs[_0x6d8d('0x3e')](_0x4eb427[_0x6d8d('0x39')][_0x6d8d('0x3e')]);_0x171960[_0x6d8d('0x3f')]=qs['filters'](_['pick'](_0x4eb427[_0x6d8d('0x39')],_0x1c682f['filters']),_0x39f98a);if(_0x4eb427[_0x6d8d('0x39')][_0x6d8d('0x40')]){_0x171960[_0x6d8d('0x3f')]=_[_0x6d8d('0x41')](_0x171960[_0x6d8d('0x3f')],{'$or':_[_0x6d8d('0x31')](_0x39f98a,function(_0x3bafa5){if(_0x3bafa5[_0x6d8d('0x35')]!=='VIRTUAL'){var _0x430c4d={};_0x430c4d[_0x3bafa5['name']]={'$like':'%'+_0x4eb427[_0x6d8d('0x39')]['filter']+'%'};return _0x430c4d;}})});}_0x171960=_[_0x6d8d('0x41')]({},_0x171960,_0x4eb427[_0x6d8d('0x42')]);var _0x5df175={'where':_0x171960['where']};return db['SmsQueue'][_0x6d8d('0x25')](_0x5df175)[_0x6d8d('0x29')](function(_0x3bd7e7){_0x32df8e[_0x6d8d('0x25')]=_0x3bd7e7;if(_0x4eb427[_0x6d8d('0x39')]['includeAll']){_0x171960[_0x6d8d('0x43')]=[{'all':!![]}];}return db[_0x6d8d('0x32')][_0x6d8d('0x44')](_0x171960);})[_0x6d8d('0x29')](function(_0xebb9a7){_0x32df8e['rows']=_0xebb9a7;return _0x32df8e;})[_0x6d8d('0x29')](respondWithFilteredResult(_0x5a9c02,_0x171960))[_0x6d8d('0x45')](handleError(_0x5a9c02,null));};exports[_0x6d8d('0x46')]=function(_0x2a79c6,_0x128d85){var _0x5b7f4d={'raw':!![],'where':{'id':_0x2a79c6[_0x6d8d('0x47')]['id']}},_0xcd1dc={};_0xcd1dc[_0x6d8d('0x36')]=_['keys'](db[_0x6d8d('0x32')][_0x6d8d('0x33')]);_0xcd1dc[_0x6d8d('0x39')]=_['keys'](_0x2a79c6['query']);_0xcd1dc[_0x6d8d('0x38')]=_[_0x6d8d('0x48')](_0xcd1dc[_0x6d8d('0x36')],_0xcd1dc['query']);_0x5b7f4d[_0x6d8d('0x3b')]=_[_0x6d8d('0x48')](_0xcd1dc[_0x6d8d('0x36')],qs[_0x6d8d('0x3a')](_0x2a79c6[_0x6d8d('0x39')]['fields']));_0x5b7f4d[_0x6d8d('0x3b')]=_0x5b7f4d[_0x6d8d('0x3b')][_0x6d8d('0x3c')]?_0x5b7f4d[_0x6d8d('0x3b')]:_0xcd1dc[_0x6d8d('0x36')];if(_0x2a79c6[_0x6d8d('0x39')]['includeAll']){_0x5b7f4d[_0x6d8d('0x43')]=[{'all':!![]}];}_0x5b7f4d=_[_0x6d8d('0x41')]({},_0x5b7f4d,_0x2a79c6[_0x6d8d('0x42')]);return db[_0x6d8d('0x32')][_0x6d8d('0x49')](_0x5b7f4d)['then'](handleEntityNotFound(_0x128d85,null))[_0x6d8d('0x29')](respondWithResult(_0x128d85,null))[_0x6d8d('0x45')](handleError(_0x128d85,null));};exports[_0x6d8d('0x4a')]=function(_0x801b57,_0x156670){return db[_0x6d8d('0x32')][_0x6d8d('0x4a')](_0x801b57[_0x6d8d('0x4b')],{})['then'](function(_0x1eba7e){var _0x34352d=_0x801b57[_0x6d8d('0x4c')][_0x6d8d('0x2b')]({'plain':!![]});if(!_0x34352d)throw new Error(_0x6d8d('0x4d'));if(_0x34352d[_0x6d8d('0x4e')]===_0x6d8d('0x4c')){var _0x42a06b=_0x1eba7e['get']({'plain':!![]});var _0x590a1f='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x590a1f,'userProfileId':_0x34352d[_0x6d8d('0x4f')]},'raw':!![]})[_0x6d8d('0x29')](function(_0x2d82c1){if(_0x2d82c1&&_0x2d82c1['autoAssociation']===0x0){return db[_0x6d8d('0x2d')][_0x6d8d('0x4a')]({'name':_0x42a06b[_0x6d8d('0x2e')],'resourceId':_0x42a06b['id'],'type':_0x2d82c1[_0x6d8d('0x2e')],'sectionId':_0x2d82c1['id']},{})[_0x6d8d('0x29')](function(){return _0x1eba7e;});}else{return _0x1eba7e;}})[_0x6d8d('0x45')](function(_0x221dcd){logger[_0x6d8d('0x50')](_0x6d8d('0x51'),_0x221dcd);throw _0x221dcd;});}return _0x1eba7e;})[_0x6d8d('0x29')](respondWithResult(_0x156670,0xc9))[_0x6d8d('0x45')](handleError(_0x156670,null));};exports['update']=function(_0x5bc7f3,_0x57f8b6){if(_0x5bc7f3[_0x6d8d('0x4b')]['id']){delete _0x5bc7f3[_0x6d8d('0x4b')]['id'];}return db[_0x6d8d('0x32')][_0x6d8d('0x49')]({'where':{'id':_0x5bc7f3['params']['id']}})[_0x6d8d('0x29')](handleEntityNotFound(_0x57f8b6,null))[_0x6d8d('0x29')](saveUpdates(_0x5bc7f3[_0x6d8d('0x4b')],null))[_0x6d8d('0x29')](respondWithResult(_0x57f8b6,null))[_0x6d8d('0x45')](handleError(_0x57f8b6,null));};exports[_0x6d8d('0x2a')]=function(_0x358f5f,_0x12ec88){return db[_0x6d8d('0x32')]['find']({'where':{'id':_0x358f5f[_0x6d8d('0x47')]['id']}})[_0x6d8d('0x29')](handleEntityNotFound(_0x12ec88,null))[_0x6d8d('0x29')](removeEntity(_0x12ec88,null))[_0x6d8d('0x45')](handleError(_0x12ec88,null));};exports[_0x6d8d('0x52')]=function(_0x3c2d0b,_0xc5776e){return db[_0x6d8d('0x32')][_0x6d8d('0x52')]()['then'](respondWithResult(_0xc5776e,null))[_0x6d8d('0x45')](handleError(_0xc5776e,null));};exports[_0x6d8d('0x53')]=function(_0x100edc,_0x5dfd75,_0xcafbf1){var _0xe4cf4b={'raw':!![],'where':{}},_0x50f65c={},_0x573994;return db['SmsQueue'][_0x6d8d('0x54')]({'where':{'id':_0x100edc[_0x6d8d('0x47')]['id']}})['then'](handleEntityNotFound(_0x5dfd75,null))[_0x6d8d('0x29')](function(_0x126128){if(_0x126128){_0x573994=_0x126128[_0x6d8d('0x2b')]({'plain':!![]});_0x50f65c[_0x6d8d('0x36')]=_[_0x6d8d('0x37')](db[_0x6d8d('0x55')]['rawAttributes']);_0x50f65c['query']=_[_0x6d8d('0x37')](_0x100edc[_0x6d8d('0x39')]);_0x50f65c['filters']=_[_0x6d8d('0x48')](_0x50f65c[_0x6d8d('0x36')],_0x50f65c['query']);_0xe4cf4b[_0x6d8d('0x3b')]=_[_0x6d8d('0x48')](_0x50f65c[_0x6d8d('0x36')],qs[_0x6d8d('0x3a')](_0x100edc['query'][_0x6d8d('0x3a')]));_0xe4cf4b[_0x6d8d('0x3b')]=_0xe4cf4b['attributes'][_0x6d8d('0x3c')]?_0xe4cf4b['attributes']:_0x50f65c[_0x6d8d('0x36')];if(!_0x100edc[_0x6d8d('0x39')][_0x6d8d('0x56')](_0x6d8d('0x57'))){_0xe4cf4b[_0x6d8d('0x24')]=qs['limit'](_0x100edc[_0x6d8d('0x39')][_0x6d8d('0x24')]);_0xe4cf4b[_0x6d8d('0x22')]=qs[_0x6d8d('0x22')](_0x100edc['query']['offset']);}_0xe4cf4b[_0x6d8d('0x3d')]=qs['sort'](_0x100edc['query'][_0x6d8d('0x3e')]);_0xe4cf4b[_0x6d8d('0x3f')]=qs[_0x6d8d('0x38')](_[_0x6d8d('0x58')](_0x100edc[_0x6d8d('0x39')],_0x50f65c['filters']));_0xe4cf4b[_0x6d8d('0x3f')][_0x6d8d('0x59')]=_0x126128['id'];if(_0x100edc[_0x6d8d('0x39')][_0x6d8d('0x40')]){_0xe4cf4b['where']=_[_0x6d8d('0x41')](_0xe4cf4b[_0x6d8d('0x3f')],{'$or':_['map'](_0xe4cf4b['attributes'],function(_0xa8119f){var _0x1fed5d={};_0x1fed5d[_0xa8119f]={'$like':'%'+_0x100edc[_0x6d8d('0x39')][_0x6d8d('0x40')]+'%'};return _0x1fed5d;})});}_0xe4cf4b=_['merge']({},_0xe4cf4b,_0x100edc['options']);return db[_0x6d8d('0x55')]['findAll'](_0xe4cf4b);}})[_0x6d8d('0x29')](function(_0x2790a3){if(_0x2790a3){return db[_0x6d8d('0x5a')][_0x6d8d('0x5b')]({'where':{'id':_[_0x6d8d('0x31')](_0x2790a3,_0x6d8d('0x5c')),'role':'agent'},'attributes':['id',_0x6d8d('0x2e'),_0x6d8d('0x5d'),'updatedAt',_0x6d8d('0x5e')]});}})['then'](function(_0x45a50c){if(_0x45a50c){return{'count':_0x45a50c['count'],'rows':_[_0x6d8d('0x31')](_0x45a50c[_0x6d8d('0x5f')],function(_0x97e312){return{'membername':_0x97e312[_0x6d8d('0x2e')],'UserId':_0x97e312['id'],'queue_name':_0x573994[_0x6d8d('0x2e')],'SmsQueueId':_0x573994['id'],'interface':util[_0x6d8d('0x60')](_0x6d8d('0x61'),'SIP',_0x97e312['name']),'penalty':0x0,'paused':_0x97e312[_0x6d8d('0x5d')],'createdAt':_0x97e312[_0x6d8d('0x5e')],'updatedAt':_0x97e312['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6d8d('0x29')](respondWithFilteredResult(_0x5dfd75,_0xe4cf4b))['catch'](handleError(_0x5dfd75,null));};exports[_0x6d8d('0x62')]=function(_0x87d5f,_0x1abd1a,_0x3f9f98){var _0x5ac750={};var _0x22f373={};var _0x4c6434;var _0xab3e8d;return db[_0x6d8d('0x32')]['findOne']({'where':{'id':_0x87d5f['params']['id']}})[_0x6d8d('0x29')](handleEntityNotFound(_0x1abd1a,null))[_0x6d8d('0x29')](function(_0x31e504){if(_0x31e504){_0x4c6434=_0x31e504;_0x22f373['model']=_[_0x6d8d('0x37')](db[_0x6d8d('0x63')]['rawAttributes']);_0x22f373[_0x6d8d('0x39')]=_['keys'](_0x87d5f[_0x6d8d('0x39')]);_0x22f373['filters']=_[_0x6d8d('0x48')](_0x22f373[_0x6d8d('0x36')],_0x22f373[_0x6d8d('0x39')]);_0x5ac750['attributes']=_[_0x6d8d('0x48')](_0x22f373[_0x6d8d('0x36')],qs[_0x6d8d('0x3a')](_0x87d5f[_0x6d8d('0x39')][_0x6d8d('0x3a')]));_0x5ac750['attributes']=_0x5ac750[_0x6d8d('0x3b')][_0x6d8d('0x3c')]?_0x5ac750[_0x6d8d('0x3b')]:_0x22f373[_0x6d8d('0x36')];_0x5ac750[_0x6d8d('0x3d')]=qs[_0x6d8d('0x3e')](_0x87d5f[_0x6d8d('0x39')][_0x6d8d('0x3e')]);_0x5ac750[_0x6d8d('0x3f')]=qs['filters'](_['pick'](_0x87d5f['query'],_0x22f373[_0x6d8d('0x38')]));if(_0x87d5f[_0x6d8d('0x39')][_0x6d8d('0x40')]){_0x5ac750['where']=_[_0x6d8d('0x41')](_0x5ac750[_0x6d8d('0x3f')],{'$or':_[_0x6d8d('0x31')](_0x5ac750['attributes'],function(_0xde6f37){var _0x4d4afc={};_0x4d4afc[_0xde6f37]={'$like':'%'+_0x87d5f['query'][_0x6d8d('0x40')]+'%'};return _0x4d4afc;})});}_0x5ac750=_[_0x6d8d('0x41')]({},_0x5ac750,_0x87d5f[_0x6d8d('0x42')]);return _0x4c6434['getTeams'](_0x5ac750);}})[_0x6d8d('0x29')](function(_0x7cea18){if(_0x7cea18){_0xab3e8d=_0x7cea18[_0x6d8d('0x3c')];if(!_0x87d5f[_0x6d8d('0x39')]['hasOwnProperty'](_0x6d8d('0x57'))){_0x5ac750[_0x6d8d('0x24')]=qs[_0x6d8d('0x24')](_0x87d5f['query']['limit']);_0x5ac750[_0x6d8d('0x22')]=qs[_0x6d8d('0x22')](_0x87d5f[_0x6d8d('0x39')]['offset']);}return _0x4c6434['getTeams'](_0x5ac750);}})[_0x6d8d('0x29')](function(_0xb233d4){if(_0xb233d4){return _0xb233d4?{'count':_0xab3e8d,'rows':_0xb233d4}:null;}})[_0x6d8d('0x29')](respondWithResult(_0x1abd1a,null))[_0x6d8d('0x45')](handleError(_0x1abd1a,null));};exports[_0x6d8d('0x64')]=function(_0xdf69d1,_0x53d3dd,_0x5435f9){var _0x2611b1=_0xdf69d1[_0x6d8d('0x4b')][_0x6d8d('0x65')];return db[_0x6d8d('0x63')]['findAll']({'where':{'id':_0x2611b1},'attributes':['id'],'include':[{'model':db[_0x6d8d('0x5a')],'as':_0x6d8d('0x66'),'attributes':['id','name','online',_0x6d8d('0x67'),_0x6d8d('0x68')],'raw':!![]}]})[_0x6d8d('0x29')](function(_0x31dd35){if(_0x31dd35){var _0x3abb24=_[_0x6d8d('0x69')](_0x31dd35,function(_0x3b4a90){var _0x5c0024=_0x3b4a90[_0x6d8d('0x2b')]({'plain':!![]});return _0x5c0024[_0x6d8d('0x66')];});return db[_0x6d8d('0x32')][_0x6d8d('0x49')]({'where':{'id':_0xdf69d1[_0x6d8d('0x47')]['id']}})[_0x6d8d('0x29')](function(_0x461baf){return db[_0x6d8d('0x6a')][_0x6d8d('0x6b')](function(_0x5134e3){return _0x461baf[_0x6d8d('0x64')](_0x2611b1,{'transaction':_0x5134e3})[_0x6d8d('0x29')](function(){return BPromise[_0x6d8d('0x6c')](_0x3abb24,function(_0x1b4de3){return db[_0x6d8d('0x55')]['findOrCreate']({'where':{'UserId':_0x1b4de3['id'],'SmsQueueId':_0xdf69d1[_0x6d8d('0x47')]['id']},'transaction':_0x5134e3});});})[_0x6d8d('0x29')](function(){_0x3abb24['forEach'](function(_0x20790a){socket[_0x6d8d('0x6d')](_0x6d8d('0x6e'),{'UserId':_0x20790a['id'],'SmsQueueId':_0x461baf['id']});});});});});}})['then'](respondWithStatusCode(_0x53d3dd,null))[_0x6d8d('0x45')](handleError(_0x53d3dd,null));};exports['removeTeams']=function(_0x3ed55c,_0x871a45,_0x5ab288){return db[_0x6d8d('0x63')]['findAll']({'where':{'id':_0x3ed55c[_0x6d8d('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6d8d('0x5a')],'as':_0x6d8d('0x66'),'attributes':['id'],'raw':!![]}]})[_0x6d8d('0x29')](handleEntityNotFound(_0x871a45,null))[_0x6d8d('0x29')](function(_0x2c454e){var _0x6c1bc3=_[_0x6d8d('0x31')](_0x2c454e,'id');var _0x5d085c=[];var _0x74be61=[];var _0x26239e=squel[_0x6d8d('0x6f')]();_0x26239e[_0x6d8d('0x70')]('tq.TeamId')[_0x6d8d('0x71')](_0x6d8d('0x72'),'tq')[_0x6d8d('0x73')](_0x6d8d('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6d8d('0x3f')](_0x6d8d('0x75'),_0x3ed55c['params']['id']);for(var _0x588e52=0x0;_0x588e52<_0x2c454e[_0x6d8d('0x3c')];_0x588e52+=0x1){let _0x146659=_0x2c454e[_0x588e52];for(var _0x32e502=0x0;_0x32e502<_0x146659['Agents'][_0x6d8d('0x3c')];_0x32e502+=0x1){let _0x1ecb4a=_0x146659['Agents'][_0x32e502];var _0x308cda=_0x26239e['clone']();_0x308cda[_0x6d8d('0x3f')](_0x6d8d('0x76'),_0x1ecb4a['id']);_0x74be61[_0x6d8d('0x77')](db[_0x6d8d('0x6a')]['query'](_0x308cda[_0x6d8d('0x78')](),{'type':db[_0x6d8d('0x6a')]['QueryTypes'][_0x6d8d('0x79')]})[_0x6d8d('0x29')](function(_0x52249b){if(_0x52249b['length']===0x1){return _0x1ecb4a['id'];}else{var _0x1406ff=_[_0x6d8d('0x7a')](_[_0x6d8d('0x31')](_0x52249b,_0x6d8d('0x7b')),function(_0x450871){return _['includes'](_0x6c1bc3,_0x450871);});if(_0x1406ff){return _0x1ecb4a['id'];}}}));}}return BPromise[_0x6d8d('0x7c')](_0x74be61)[_0x6d8d('0x29')](function(_0x3acc9d){_0x5d085c=_(_0x5d085c)[_0x6d8d('0x7d')](_0x3acc9d)[_0x6d8d('0x7e')]()['value']();return db['SmsQueue'][_0x6d8d('0x49')]({'where':{'id':_0x3ed55c['params']['id']}})[_0x6d8d('0x29')](function(_0x140c75){return db[_0x6d8d('0x6a')][_0x6d8d('0x6b')](function(_0xed5b1b){return _0x140c75[_0x6d8d('0x7f')](_0x3ed55c['query']['ids'],{'transaction':_0xed5b1b})[_0x6d8d('0x29')](function(){if(!_[_0x6d8d('0x80')](_0x5d085c)){return _0x140c75[_0x6d8d('0x81')](_0x5d085c,{'transaction':_0xed5b1b});}})[_0x6d8d('0x29')](function(){_0x5d085c[_0x6d8d('0x82')](function(_0x984211){socket[_0x6d8d('0x6d')](_0x6d8d('0x83'),{'UserId':_0x984211,'SmsQueueId':_0x140c75['id']});});});});});});})[_0x6d8d('0x29')](respondWithStatusCode(_0x871a45,null))[_0x6d8d('0x45')](handleError(_0x871a45,null));};exports[_0x6d8d('0x84')]=function(_0x4b1ba2,_0x423620,_0x55db37){return db['SmsQueue'][_0x6d8d('0x49')]({'where':{'id':_0x4b1ba2[_0x6d8d('0x47')]['id']}})[_0x6d8d('0x29')](handleEntityNotFound(_0x423620,null))[_0x6d8d('0x29')](function(_0x58bd57){if(_0x58bd57){return _0x58bd57[_0x6d8d('0x84')](_0x4b1ba2[_0x6d8d('0x4b')][_0x6d8d('0x65')],_[_0x6d8d('0x85')](_0x4b1ba2[_0x6d8d('0x4b')],['ids','id'])||{})[_0x6d8d('0x86')](function(_0x937f3c){for(var _0x13fd90=0x0;_0x13fd90<_0x4b1ba2[_0x6d8d('0x4b')][_0x6d8d('0x65')]['length'];_0x13fd90+=0x1){socket['emit'](_0x6d8d('0x6e'),{'UserId':Number(_0x4b1ba2['body'][_0x6d8d('0x65')][_0x13fd90]),'SmsQueueId':Number(_0x4b1ba2[_0x6d8d('0x47')]['id'])});}return _0x937f3c;});}})[_0x6d8d('0x29')](respondWithResult(_0x423620,null))['catch'](handleError(_0x423620,null));};exports['removeAgents']=function(_0x330d5c,_0x1a3e0f,_0xdd6a27){return db[_0x6d8d('0x32')]['find']({'where':{'id':_0x330d5c[_0x6d8d('0x47')]['id']}})[_0x6d8d('0x29')](handleEntityNotFound(_0x1a3e0f,null))['then'](function(_0x3d9337){if(_0x3d9337){return _0x3d9337['removeAgents'](_0x330d5c[_0x6d8d('0x39')][_0x6d8d('0x65')])[_0x6d8d('0x29')](function(){if(_[_0x6d8d('0x87')](_0x330d5c[_0x6d8d('0x39')][_0x6d8d('0x65')])){for(var _0x373e31=0x0;_0x373e31<_0x330d5c['query'][_0x6d8d('0x65')][_0x6d8d('0x3c')];_0x373e31+=0x1){socket[_0x6d8d('0x6d')](_0x6d8d('0x83'),{'UserId':Number(_0x330d5c[_0x6d8d('0x39')][_0x6d8d('0x65')][_0x373e31]),'SmsQueueId':Number(_0x330d5c[_0x6d8d('0x47')]['id'])});}}else{socket[_0x6d8d('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x330d5c[_0x6d8d('0x39')][_0x6d8d('0x65')]),'SmsQueueId':Number(_0x330d5c['params']['id'])});}});}})[_0x6d8d('0x29')](respondWithStatusCode(_0x1a3e0f,null))[_0x6d8d('0x45')](handleError(_0x1a3e0f,null));};exports[_0x6d8d('0x88')]=function(_0x1c62a3,_0x5622a0,_0xa462b7){var _0x3cf1ed={};var _0x450c7c={};var _0x173b86;var _0x52fd9b;return db['SmsQueue']['findOne']({'where':{'id':_0x1c62a3[_0x6d8d('0x47')]['id']}})[_0x6d8d('0x29')](handleEntityNotFound(_0x5622a0,null))[_0x6d8d('0x29')](function(_0x1646aa){if(_0x1646aa){_0x173b86=_0x1646aa;_0x450c7c['model']=_[_0x6d8d('0x37')](db[_0x6d8d('0x5a')][_0x6d8d('0x33')]);_0x450c7c[_0x6d8d('0x39')]=_[_0x6d8d('0x37')](_0x1c62a3[_0x6d8d('0x39')]);_0x450c7c[_0x6d8d('0x38')]=_[_0x6d8d('0x48')](_0x450c7c[_0x6d8d('0x36')],_0x450c7c[_0x6d8d('0x39')]);_0x3cf1ed[_0x6d8d('0x3b')]=_[_0x6d8d('0x48')](_0x450c7c[_0x6d8d('0x36')],qs[_0x6d8d('0x3a')](_0x1c62a3['query']['fields']));_0x3cf1ed['attributes']=_0x3cf1ed[_0x6d8d('0x3b')][_0x6d8d('0x3c')]?_0x3cf1ed['attributes']:_0x450c7c[_0x6d8d('0x36')];_0x3cf1ed[_0x6d8d('0x3d')]=qs[_0x6d8d('0x3e')](_0x1c62a3[_0x6d8d('0x39')][_0x6d8d('0x3e')]);_0x3cf1ed[_0x6d8d('0x3f')]=qs[_0x6d8d('0x38')](_[_0x6d8d('0x58')](_0x1c62a3[_0x6d8d('0x39')],_0x450c7c['filters']));if(_0x1c62a3[_0x6d8d('0x39')][_0x6d8d('0x40')]){_0x3cf1ed['where']=_[_0x6d8d('0x41')](_0x3cf1ed[_0x6d8d('0x3f')],{'$or':_[_0x6d8d('0x31')](_0x3cf1ed['attributes'],function(_0x10b516){var _0x74427={};_0x74427[_0x10b516]={'$like':'%'+_0x1c62a3['query'][_0x6d8d('0x40')]+'%'};return _0x74427;})});}_0x3cf1ed=_[_0x6d8d('0x41')]({},_0x3cf1ed,_0x1c62a3[_0x6d8d('0x42')]);return _0x173b86[_0x6d8d('0x88')](_0x3cf1ed);}})[_0x6d8d('0x29')](function(_0x4024e5){if(_0x4024e5){_0x52fd9b=_0x4024e5['length'];if(!_0x1c62a3[_0x6d8d('0x39')][_0x6d8d('0x56')](_0x6d8d('0x57'))){_0x3cf1ed[_0x6d8d('0x24')]=qs[_0x6d8d('0x24')](_0x1c62a3['query'][_0x6d8d('0x24')]);_0x3cf1ed['offset']=qs[_0x6d8d('0x22')](_0x1c62a3['query']['offset']);}return _0x173b86[_0x6d8d('0x88')](_0x3cf1ed);}})[_0x6d8d('0x29')](function(_0x5d3890){if(_0x5d3890){return _0x5d3890?{'count':_0x52fd9b,'rows':_0x5d3890}:null;}})[_0x6d8d('0x29')](respondWithResult(_0x5622a0,null))[_0x6d8d('0x45')](handleError(_0x5622a0,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ed57670..80b2818 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 _0xdda9=['save','remove','emit','hook','exports','events','SmsQueue','setMaxListeners'];(function(_0x4f839f,_0x292796){var _0x598e94=function(_0x51ecff){while(--_0x51ecff){_0x4f839f['push'](_0x4f839f['shift']());}};_0x598e94(++_0x292796);}(_0xdda9,0x11d));var _0x9dda=function(_0x324808,_0x3e329b){_0x324808=_0x324808-0x0;var _0x58f680=_0xdda9[_0x324808];return _0x58f680;};'use strict';var EventEmitter=require(_0x9dda('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x9dda('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9dda('0x2')](0x0);var events={'afterCreate':_0x9dda('0x3'),'afterUpdate':'update','afterDestroy':_0x9dda('0x4')};function emitEvent(_0x197051){return function(_0x591ef6,_0x37c5b0,_0x312888){SmsQueueEvents[_0x9dda('0x5')](_0x197051+':'+_0x591ef6['id'],_0x591ef6);SmsQueueEvents['emit'](_0x197051,_0x591ef6);_0x312888(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x9dda('0x6')](e,emitEvent(event));}}module[_0x9dda('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x4b4e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0xa77950,_0x26bc86){var _0x49d598=function(_0x16a7cd){while(--_0x16a7cd){_0xa77950['push'](_0xa77950['shift']());}};_0x49d598(++_0x26bc86);}(_0x4b4e,0xef));var _0xe4b4=function(_0x3cdd8a,_0x5ce669){_0x3cdd8a=_0x3cdd8a-0x0;var _0x2c4d11=_0x4b4e[_0x3cdd8a];return _0x2c4d11;};'use strict';var EventEmitter=require(_0xe4b4('0x0'));var SmsQueue=require(_0xe4b4('0x1'))['db'][_0xe4b4('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe4b4('0x3')](0x0);var events={'afterCreate':_0xe4b4('0x4'),'afterUpdate':_0xe4b4('0x5'),'afterDestroy':_0xe4b4('0x6')};function emitEvent(_0x32b2f1){return function(_0x2985ba,_0x12ebf1,_0x294cc3){SmsQueueEvents[_0xe4b4('0x7')](_0x32b2f1+':'+_0x2985ba['id'],_0x2985ba);SmsQueueEvents['emit'](_0x32b2f1,_0x2985ba);_0x294cc3(null);};}for(var e in events){if(events[_0xe4b4('0x8')](e)){var event=events[e];SmsQueue[_0xe4b4('0x9')](e,emitEvent(event));}}module[_0xe4b4('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 83cf783..8041a46 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 _0xba4d=['./smsQueue.attributes','define','SmsQueue','sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1609e1,_0x11c1da){var _0x144e42=function(_0xb087e8){while(--_0xb087e8){_0x1609e1['push'](_0x1609e1['shift']());}};_0x144e42(++_0x11c1da);}(_0xba4d,0x16f));var _0xdba4=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0xba4d[_0x7a112];return _0x136dc5;};'use strict';var _=require('lodash');var util=require(_0xdba4('0x0'));var logger=require(_0xdba4('0x1'))(_0xdba4('0x2'));var moment=require('moment');var BPromise=require(_0xdba4('0x3'));var rp=require(_0xdba4('0x4'));var fs=require('fs');var path=require(_0xdba4('0x5'));var rimraf=require(_0xdba4('0x6'));var config=require('../../config/environment');var attributes=require(_0xdba4('0x7'));module['exports']=function(_0x1616d2,_0x43cfb3){return _0x1616d2[_0xdba4('0x8')](_0xdba4('0x9'),attributes,{'tableName':_0xdba4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9104=['util','../../config/logger','api','request-promise','path','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash'];(function(_0x3a03e9,_0x465284){var _0x3e4a39=function(_0x2ae76a){while(--_0x2ae76a){_0x3a03e9['push'](_0x3a03e9['shift']());}};_0x3e4a39(++_0x465284);}(_0x9104,0x1a1));var _0x4910=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0x9104[_0x15f27e];return _0x18da4f;};'use strict';var _=require(_0x4910('0x0'));var util=require(_0x4910('0x1'));var logger=require(_0x4910('0x2'))(_0x4910('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4910('0x4'));var fs=require('fs');var path=require(_0x4910('0x5'));var rimraf=require('rimraf');var config=require(_0x4910('0x6'));var attributes=require(_0x4910('0x7'));module[_0x4910('0x8')]=function(_0x3bf4b5,_0x2b5ce3){return _0x3bf4b5['define'](_0x4910('0x9'),attributes,{'tableName':_0x4910('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 50113cd..2eedc0f 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 _0x1690=['redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','where','limit','include','attributes','map','model','then','debug','ShowSmsQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x47ef01,_0x1371f6){var _0x1dbb3c=function(_0x518b79){while(--_0x518b79){_0x47ef01['push'](_0x47ef01['shift']());}};_0x1dbb3c(++_0x1371f6);}(_0x1690,0x6d));var _0x0169=function(_0x1f2ea4,_0x4faa88){_0x1f2ea4=_0x1f2ea4-0x0;var _0x535890=_0x1690[_0x1f2ea4];return _0x535890;};'use strict';var _=require(_0x0169('0x0'));var util=require('util');var moment=require(_0x0169('0x1'));var BPromise=require(_0x0169('0x2'));var rs=require(_0x0169('0x3'));var fs=require('fs');var Redis=require(_0x0169('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0169('0x5'));var logger=require(_0x0169('0x6'))(_0x0169('0x7'));var config=require('../../config/environment');var jayson=require(_0x0169('0x8'));var client=jayson[_0x0169('0x9')][_0x0169('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0169('0xb')],{'host':_0x0169('0xc'),'port':0x18eb});var socket=require(_0x0169('0xd'))(new Redis(config[_0x0169('0xb')]));require(_0x0169('0xe'))[_0x0169('0xf')](socket);function respondWithRpcPromise(_0x25d362,_0x37da20,_0x4ab2db){return new BPromise(function(_0x13ffcc,_0x575fe4){return client[_0x0169('0x10')](_0x25d362,_0x4ab2db)['then'](function(_0x3be0f1){logger[_0x0169('0x11')](_0x0169('0x12'),_0x37da20,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x37da20,_0x0169('0x13'),JSON[_0x0169('0x14')](_0x3be0f1));if(_0x3be0f1[_0x0169('0x15')]){if(_0x3be0f1['error'][_0x0169('0x16')]===0x1f4){logger[_0x0169('0x15')]('SmsQueue,\x20%s,\x20%s',_0x37da20,_0x3be0f1[_0x0169('0x15')][_0x0169('0x17')]);return _0x575fe4(_0x3be0f1[_0x0169('0x15')][_0x0169('0x17')]);}logger[_0x0169('0x15')](_0x0169('0x12'),_0x37da20,_0x3be0f1[_0x0169('0x15')][_0x0169('0x17')]);return _0x13ffcc(_0x3be0f1[_0x0169('0x15')][_0x0169('0x17')]);}else{logger[_0x0169('0x11')](_0x0169('0x12'),_0x37da20,_0x0169('0x13'));_0x13ffcc(_0x3be0f1['result'][_0x0169('0x17')]);}})[_0x0169('0x18')](function(_0x4d90f0){logger[_0x0169('0x15')](_0x0169('0x12'),_0x37da20,_0x4d90f0);_0x575fe4(_0x4d90f0);});});}exports[_0x0169('0x19')]=function(_0x50b954){var _0x2b1f1c=this;return new Promise(function(_0x560701,_0x389db9){return db[_0x0169('0x1a')][_0x0169('0x1b')]({'raw':_0x50b954[_0x0169('0x1c')]?_0x50b954[_0x0169('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x50b954[_0x0169('0x1c')]?_0x50b954['options'][_0x0169('0x1d')]||null:null,'attributes':_0x50b954[_0x0169('0x1c')]?_0x50b954[_0x0169('0x1c')]['attributes']||null:null,'limit':_0x50b954[_0x0169('0x1c')]?_0x50b954[_0x0169('0x1c')][_0x0169('0x1e')]||null:null,'include':_0x50b954[_0x0169('0x1c')]?_0x50b954[_0x0169('0x1c')][_0x0169('0x1f')]?_['map'](_0x50b954['options']['include'],function(_0x59f6a){return{'model':db[_0x59f6a['model']],'as':_0x59f6a['as'],'attributes':_0x59f6a[_0x0169('0x20')],'include':_0x59f6a[_0x0169('0x1f')]?_[_0x0169('0x21')](_0x59f6a[_0x0169('0x1f')],function(_0x2c4603){return{'model':db[_0x2c4603[_0x0169('0x22')]],'as':_0x2c4603['as'],'attributes':_0x2c4603['attributes'],'include':_0x2c4603[_0x0169('0x1f')]?_[_0x0169('0x21')](_0x2c4603[_0x0169('0x1f')],function(_0x3a61c2){return{'model':db[_0x3a61c2[_0x0169('0x22')]],'as':_0x3a61c2['as'],'attributes':_0x3a61c2[_0x0169('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0169('0x23')](function(_0x20705f){logger[_0x0169('0x11')]('GetSmsQueue',_0x50b954);logger[_0x0169('0x24')](_0x0169('0x19'),_0x50b954,JSON[_0x0169('0x14')](_0x20705f));_0x560701(_0x20705f);})[_0x0169('0x18')](function(_0x4d045e){logger[_0x0169('0x15')](_0x0169('0x19'),_0x4d045e['message'],_0x50b954);_0x389db9(_0x2b1f1c['error'](0x1f4,_0x4d045e[_0x0169('0x17')]));});});};exports[_0x0169('0x25')]=function(_0x5a2b72){var _0x3b4d97=this;return new Promise(function(_0x38137d,_0x2f9699){return db[_0x0169('0x1a')][_0x0169('0x26')]({'raw':_0x5a2b72[_0x0169('0x1c')]?_0x5a2b72['options'][_0x0169('0x27')]===undefined?!![]:![]:!![],'where':_0x5a2b72['options']?_0x5a2b72[_0x0169('0x1c')][_0x0169('0x1d')]||null:null,'attributes':_0x5a2b72[_0x0169('0x1c')]?_0x5a2b72[_0x0169('0x1c')][_0x0169('0x20')]||null:null,'include':_0x5a2b72[_0x0169('0x1c')]?_0x5a2b72[_0x0169('0x1c')][_0x0169('0x1f')]?_[_0x0169('0x21')](_0x5a2b72['options'][_0x0169('0x1f')],function(_0x56ca9c){return{'model':db[_0x56ca9c['model']],'as':_0x56ca9c['as'],'attributes':_0x56ca9c[_0x0169('0x20')],'include':_0x56ca9c['include']?_[_0x0169('0x21')](_0x56ca9c[_0x0169('0x1f')],function(_0x521d66){return{'model':db[_0x521d66[_0x0169('0x22')]],'as':_0x521d66['as'],'attributes':_0x521d66[_0x0169('0x20')],'include':_0x521d66[_0x0169('0x1f')]?_[_0x0169('0x21')](_0x521d66['include'],function(_0x3bdc30){return{'model':db[_0x3bdc30[_0x0169('0x22')]],'as':_0x3bdc30['as'],'attributes':_0x3bdc30[_0x0169('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e8511){logger[_0x0169('0x11')](_0x0169('0x25'),_0x5a2b72);logger[_0x0169('0x24')]('ShowSmsQueue',_0x5a2b72,JSON[_0x0169('0x14')](_0x1e8511));_0x38137d(_0x1e8511);})[_0x0169('0x18')](function(_0x294d88){logger[_0x0169('0x15')](_0x0169('0x25'),_0x294d88[_0x0169('0x17')],_0x5a2b72);_0x2f9699(_0x3b4d97[_0x0169('0x15')](0x1f4,_0x294d88[_0x0169('0x17')]));});});}; \ No newline at end of file +var _0x8015=['ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','attributes','include','map','GetSmsQueue','find','model'];(function(_0x97d6d5,_0x4453e7){var _0x3baaa2=function(_0x1df1a8){while(--_0x1df1a8){_0x97d6d5['push'](_0x97d6d5['shift']());}};_0x3baaa2(++_0x4453e7);}(_0x8015,0x1c9));var _0x5801=function(_0x1ae6b8,_0x449a54){_0x1ae6b8=_0x1ae6b8-0x0;var _0x369328=_0x8015[_0x1ae6b8];return _0x369328;};'use strict';var _=require(_0x5801('0x0'));var util=require('util');var moment=require(_0x5801('0x1'));var BPromise=require(_0x5801('0x2'));var rs=require(_0x5801('0x3'));var fs=require('fs');var Redis=require(_0x5801('0x4'));var db=require(_0x5801('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5801('0x6'))('rpc');var config=require(_0x5801('0x7'));var jayson=require(_0x5801('0x8'));var client=jayson['client'][_0x5801('0x9')]({'port':0x232a});config[_0x5801('0xa')]=_[_0x5801('0xb')](config[_0x5801('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5801('0xc'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x5801('0xd')](socket);function respondWithRpcPromise(_0x402e8f,_0x58df01,_0x40d6f7){return new BPromise(function(_0x24fe09,_0x4ae203){return client[_0x5801('0xe')](_0x402e8f,_0x40d6f7)[_0x5801('0xf')](function(_0x522925){logger[_0x5801('0x10')](_0x5801('0x11'),_0x58df01,_0x5801('0x12'));logger[_0x5801('0x13')](_0x5801('0x14'),_0x58df01,_0x5801('0x12'),JSON[_0x5801('0x15')](_0x522925));if(_0x522925[_0x5801('0x16')]){if(_0x522925[_0x5801('0x16')][_0x5801('0x17')]===0x1f4){logger[_0x5801('0x16')](_0x5801('0x11'),_0x58df01,_0x522925[_0x5801('0x16')][_0x5801('0x18')]);return _0x4ae203(_0x522925['error'][_0x5801('0x18')]);}logger[_0x5801('0x16')](_0x5801('0x11'),_0x58df01,_0x522925[_0x5801('0x16')][_0x5801('0x18')]);return _0x24fe09(_0x522925[_0x5801('0x16')][_0x5801('0x18')]);}else{logger[_0x5801('0x10')](_0x5801('0x11'),_0x58df01,_0x5801('0x12'));_0x24fe09(_0x522925[_0x5801('0x19')][_0x5801('0x18')]);}})[_0x5801('0x1a')](function(_0x5876bb){logger[_0x5801('0x16')]('SmsQueue,\x20%s,\x20%s',_0x58df01,_0x5876bb);_0x4ae203(_0x5876bb);});});}exports['GetSmsQueue']=function(_0x718696){var _0x38d827=this;return new Promise(function(_0x34cd95,_0x1c5cb2){return db[_0x5801('0x1b')][_0x5801('0x1c')]({'raw':_0x718696[_0x5801('0x1d')]?_0x718696[_0x5801('0x1d')][_0x5801('0x1e')]===undefined?!![]:![]:!![],'where':_0x718696[_0x5801('0x1d')]?_0x718696[_0x5801('0x1d')]['where']||null:null,'attributes':_0x718696[_0x5801('0x1d')]?_0x718696[_0x5801('0x1d')][_0x5801('0x1f')]||null:null,'limit':_0x718696['options']?_0x718696['options']['limit']||null:null,'include':_0x718696[_0x5801('0x1d')]?_0x718696[_0x5801('0x1d')][_0x5801('0x20')]?_[_0x5801('0x21')](_0x718696[_0x5801('0x1d')][_0x5801('0x20')],function(_0x151841){return{'model':db[_0x151841['model']],'as':_0x151841['as'],'attributes':_0x151841[_0x5801('0x1f')],'include':_0x151841[_0x5801('0x20')]?_[_0x5801('0x21')](_0x151841[_0x5801('0x20')],function(_0x3043c7){return{'model':db[_0x3043c7['model']],'as':_0x3043c7['as'],'attributes':_0x3043c7[_0x5801('0x1f')],'include':_0x3043c7[_0x5801('0x20')]?_[_0x5801('0x21')](_0x3043c7[_0x5801('0x20')],function(_0x46ff26){return{'model':db[_0x46ff26['model']],'as':_0x46ff26['as'],'attributes':_0x46ff26[_0x5801('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5801('0xf')](function(_0x4928d7){logger[_0x5801('0x10')](_0x5801('0x22'),_0x718696);logger[_0x5801('0x13')](_0x5801('0x22'),_0x718696,JSON[_0x5801('0x15')](_0x4928d7));_0x34cd95(_0x4928d7);})[_0x5801('0x1a')](function(_0x478514){logger[_0x5801('0x16')](_0x5801('0x22'),_0x478514[_0x5801('0x18')],_0x718696);_0x1c5cb2(_0x38d827[_0x5801('0x16')](0x1f4,_0x478514[_0x5801('0x18')]));});});};exports['ShowSmsQueue']=function(_0x5076e5){var _0x404fc0=this;return new Promise(function(_0x55e985,_0x4be8d7){return db[_0x5801('0x1b')][_0x5801('0x23')]({'raw':_0x5076e5[_0x5801('0x1d')]?_0x5076e5[_0x5801('0x1d')][_0x5801('0x1e')]===undefined?!![]:![]:!![],'where':_0x5076e5[_0x5801('0x1d')]?_0x5076e5[_0x5801('0x1d')]['where']||null:null,'attributes':_0x5076e5['options']?_0x5076e5[_0x5801('0x1d')][_0x5801('0x1f')]||null:null,'include':_0x5076e5[_0x5801('0x1d')]?_0x5076e5[_0x5801('0x1d')][_0x5801('0x20')]?_[_0x5801('0x21')](_0x5076e5[_0x5801('0x1d')][_0x5801('0x20')],function(_0x560262){return{'model':db[_0x560262[_0x5801('0x24')]],'as':_0x560262['as'],'attributes':_0x560262[_0x5801('0x1f')],'include':_0x560262[_0x5801('0x20')]?_[_0x5801('0x21')](_0x560262[_0x5801('0x20')],function(_0x2561de){return{'model':db[_0x2561de['model']],'as':_0x2561de['as'],'attributes':_0x2561de[_0x5801('0x1f')],'include':_0x2561de['include']?_['map'](_0x2561de[_0x5801('0x20')],function(_0x4cc94e){return{'model':db[_0x4cc94e[_0x5801('0x24')]],'as':_0x4cc94e['as'],'attributes':_0x4cc94e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5801('0xf')](function(_0x376bfb){logger[_0x5801('0x10')](_0x5801('0x25'),_0x5076e5);logger[_0x5801('0x13')]('ShowSmsQueue',_0x5076e5,JSON[_0x5801('0x15')](_0x376bfb));_0x55e985(_0x376bfb);})[_0x5801('0x1a')](function(_0x446295){logger[_0x5801('0x16')]('ShowSmsQueue',_0x446295[_0x5801('0x18')],_0x5076e5);_0x4be8d7(_0x404fc0[_0x5801('0x16')](0x1f4,_0x446295[_0x5801('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 4d0ffb2..ff9df11 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 _0xc249=['removeListener','smsQueue:','./smsQueue.events','update','emit'];(function(_0xc230,_0x1baacd){var _0x17b169=function(_0x2a808f){while(--_0x2a808f){_0xc230['push'](_0xc230['shift']());}};_0x17b169(++_0x1baacd);}(_0xc249,0x1c9));var _0x9c24=function(_0xdac179,_0x2bd97c){_0xdac179=_0xdac179-0x0;var _0x5d18cf=_0xc249[_0xdac179];return _0x5d18cf;};'use strict';var SmsQueueEvents=require(_0x9c24('0x0'));var events=['save','remove',_0x9c24('0x1')];function createListener(_0x277d7c,_0xa21166){return function(_0x382723){_0xa21166[_0x9c24('0x2')](_0x277d7c,_0x382723);};}function removeListener(_0x4e342b,_0x7a3cb2){return function(){SmsQueueEvents[_0x9c24('0x3')](_0x4e342b,_0x7a3cb2);};}exports['register']=function(_0xdefbc5){for(var _0x4d94e6=0x0,_0x3b5f4c=events['length'];_0x4d94e6<_0x3b5f4c;_0x4d94e6++){var _0x4310f8=events[_0x4d94e6];var _0x2d3e5a=createListener(_0x9c24('0x4')+_0x4310f8,_0xdefbc5);SmsQueueEvents['on'](_0x4310f8,_0x2d3e5a);}}; \ No newline at end of file +var _0xb5e1=['removeListener','length','smsQueue:','remove','update'];(function(_0x3b5230,_0x220be3){var _0xf694f4=function(_0x1b1b14){while(--_0x1b1b14){_0x3b5230['push'](_0x3b5230['shift']());}};_0xf694f4(++_0x220be3);}(_0xb5e1,0x1e3));var _0x1b5e=function(_0x4fe64b,_0x33af85){_0x4fe64b=_0x4fe64b-0x0;var _0x142fed=_0xb5e1[_0x4fe64b];return _0x142fed;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0x1b5e('0x0'),_0x1b5e('0x1')];function createListener(_0x3d25d7,_0x5ad836){return function(_0x2e8396){_0x5ad836['emit'](_0x3d25d7,_0x2e8396);};}function removeListener(_0x1358d5,_0x20be54){return function(){SmsQueueEvents[_0x1b5e('0x2')](_0x1358d5,_0x20be54);};}exports['register']=function(_0x312b32){for(var _0x44c388=0x0,_0x1d3a16=events[_0x1b5e('0x3')];_0x44c388<_0x1d3a16;_0x44c388++){var _0x3ceefa=events[_0x44c388];var _0x1a64af=createListener(_0x1b5e('0x4')+_0x3ceefa,_0x312b32);SmsQueueEvents['on'](_0x3ceefa,_0x1a64af);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index faf5a29..abeced1 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 _0x5f25=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','util'];(function(_0x2aeca6,_0x565154){var _0x48c8c9=function(_0x739357){while(--_0x739357){_0x2aeca6['push'](_0x2aeca6['shift']());}};_0x48c8c9(++_0x565154);}(_0x5f25,0xfb));var _0x55f2=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x5f25[_0x2675da];return _0x5e6153;};'use strict';var multer=require('multer');var util=require(_0x55f2('0x0'));var path=require(_0x55f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x55f2('0x2'));var router=express[_0x55f2('0x3')]();var fs_extra=require(_0x55f2('0x4'));var auth=require(_0x55f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55f2('0x6'));var controller=require(_0x55f2('0x7'));router[_0x55f2('0x8')]('/',auth[_0x55f2('0x9')](),controller[_0x55f2('0xa')]);router['get'](_0x55f2('0xb'),auth[_0x55f2('0x9')](),controller[_0x55f2('0xc')]);router['get'](_0x55f2('0xd'),auth[_0x55f2('0x9')](),controller['show']);router[_0x55f2('0xe')]('/',auth[_0x55f2('0x9')](),controller[_0x55f2('0xf')]);router[_0x55f2('0x10')](_0x55f2('0xd'),auth[_0x55f2('0x9')](),controller['update']);router[_0x55f2('0x11')]('/:id',auth[_0x55f2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbeba=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x44571d,_0x4a7e33){var _0x2d5989=function(_0xe98b62){while(--_0xe98b62){_0x44571d['push'](_0x44571d['shift']());}};_0x2d5989(++_0x4a7e33);}(_0xbeba,0x64));var _0xabeb=function(_0x5445c3,_0x3cc97a){_0x5445c3=_0x5445c3-0x0;var _0x5ec36b=_0xbeba[_0x5445c3];return _0x5ec36b;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require('path');var timeout=require(_0xabeb('0x2'));var express=require(_0xabeb('0x3'));var router=express[_0xabeb('0x4')]();var fs_extra=require(_0xabeb('0x5'));var auth=require(_0xabeb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabeb('0x7'));var controller=require(_0xabeb('0x8'));router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x9')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller['describe']);router['get'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['show']);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xf')]);router['put'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['update']);router[_0xabeb('0x10')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x11')]);module[_0xabeb('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 01a64bf..02c8496 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 _0x522d=['STRING','DATE','moment'];(function(_0x585ff5,_0x42f0f8){var _0x424de5=function(_0xf729f9){while(--_0xf729f9){_0x585ff5['push'](_0x585ff5['shift']());}};_0x424de5(++_0x42f0f8);}(_0x522d,0x158));var _0xd522=function(_0x8c3556,_0x21dc44){_0x8c3556=_0x8c3556-0x0;var _0x37d23b=_0x522d[_0x8c3556];return _0x37d23b;};'use strict';var moment=require(_0xd522('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd522('0x1')]},'joinAt':{'type':Sequelize[_0xd522('0x2')]},'leaveAt':{'type':Sequelize[_0xd522('0x2')]},'acceptAt':{'type':Sequelize[_0xd522('0x2')]},'exitAt':{'type':Sequelize[_0xd522('0x2')]},'reason':{'type':Sequelize[_0xd522('0x1')]}}; \ No newline at end of file +var _0xd019=['STRING','DATE','exports'];(function(_0x7b360c,_0x5cec49){var _0x2dad8e=function(_0x560e7f){while(--_0x560e7f){_0x7b360c['push'](_0x7b360c['shift']());}};_0x2dad8e(++_0x5cec49);}(_0xd019,0x158));var _0x9d01=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0xd019[_0x270a54];return _0x4d07d0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9d01('0x0')]={'uniqueid':{'type':Sequelize[_0x9d01('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9d01('0x2')]},'acceptAt':{'type':Sequelize[_0x9d01('0x2')]},'exitAt':{'type':Sequelize[_0x9d01('0x2')]},'reason':{'type':Sequelize[_0x9d01('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b387968..33361c0 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 _0xb0f2=['to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','update','then','destroy','end','error','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xb0f2,0x11d));var _0x2b0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0f2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2b0f('0x0'));var rimraf=require(_0x2b0f('0x1'));var zipdir=require(_0x2b0f('0x2'));var jsonpatch=require(_0x2b0f('0x3'));var rp=require(_0x2b0f('0x4'));var moment=require(_0x2b0f('0x5'));var BPromise=require(_0x2b0f('0x6'));var Mustache=require(_0x2b0f('0x7'));var util=require(_0x2b0f('0x8'));var path=require(_0x2b0f('0x9'));var sox=require(_0x2b0f('0xa'));var csv=require(_0x2b0f('0xb'));var ejs=require(_0x2b0f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b0f('0xd'));var squel=require(_0x2b0f('0xe'));var crypto=require('crypto');var jsforce=require(_0x2b0f('0xf'));var deskjs=require(_0x2b0f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b0f('0x11'));var Redis=require(_0x2b0f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2b0f('0x13'));var as=require(_0x2b0f('0x14'));var hardwareService=require(_0x2b0f('0x15'));var logger=require('../../config/logger')(_0x2b0f('0x16'));var utils=require(_0x2b0f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b0f('0x18'))['db'];function respondWithStatusCode(_0x5c5515,_0x4d02db){_0x4d02db=_0x4d02db||0xcc;return function(_0xb076d9){if(_0xb076d9){return _0x5c5515[_0x2b0f('0x19')](_0x4d02db);}return _0x5c5515['status'](_0x4d02db)['end']();};}function respondWithResult(_0x3b1aed,_0x3ecfba){_0x3ecfba=_0x3ecfba||0xc8;return function(_0x4484f6){if(_0x4484f6){return _0x3b1aed[_0x2b0f('0x1a')](_0x3ecfba)[_0x2b0f('0x1b')](_0x4484f6);}};}function respondWithFilteredResult(_0x448c93,_0xd7528f){return function(_0x12a934){if(_0x12a934){var _0x479dcd=typeof _0xd7528f['offset']===_0x2b0f('0x1c')&&typeof _0xd7528f['limit']===_0x2b0f('0x1c');var _0x2c0ae2=_0x12a934[_0x2b0f('0x1d')];var _0x5b2a96=_0x479dcd?0x0:_0xd7528f[_0x2b0f('0x1e')];var _0x394199=_0x479dcd?_0x12a934[_0x2b0f('0x1d')]:_0xd7528f[_0x2b0f('0x1e')]+_0xd7528f[_0x2b0f('0x1f')];var _0x4e76a0;if(_0x394199>=_0x2c0ae2){_0x394199=_0x2c0ae2;_0x4e76a0=0xc8;}else{_0x4e76a0=0xce;}_0x448c93[_0x2b0f('0x1a')](_0x4e76a0);return _0x448c93[_0x2b0f('0x20')]('Content-Range',_0x5b2a96+'-'+_0x394199+'/'+_0x2c0ae2)[_0x2b0f('0x1b')](_0x12a934);}return null;};}function patchUpdates(_0x466880){return function(_0x2b7926){try{jsonpatch[_0x2b0f('0x21')](_0x2b7926,_0x466880,!![]);}catch(_0x4f17ef){return BPromise[_0x2b0f('0x22')](_0x4f17ef);}return _0x2b7926['save']();};}function saveUpdates(_0x159990,_0x391dca){return function(_0x35a32b){if(_0x35a32b){return _0x35a32b[_0x2b0f('0x23')](_0x159990)[_0x2b0f('0x24')](function(_0x20a604){return _0x20a604;});}return null;};}function removeEntity(_0xf0853c,_0x4c836f){return function(_0x22ce7){if(_0x22ce7){return _0x22ce7[_0x2b0f('0x25')]()[_0x2b0f('0x24')](function(){_0xf0853c[_0x2b0f('0x1a')](0xcc)[_0x2b0f('0x26')]();});}};}function handleEntityNotFound(_0x19366d,_0x36edfc){return function(_0x4c7d1c){if(!_0x4c7d1c){_0x19366d[_0x2b0f('0x19')](0x194);}return _0x4c7d1c;};}function handleError(_0x188b4f,_0x141c39){_0x141c39=_0x141c39||0x1f4;return function(_0x4e3688){logger[_0x2b0f('0x27')](_0x4e3688['stack']);if(_0x4e3688['name']){delete _0x4e3688[_0x2b0f('0x28')];}_0x188b4f[_0x2b0f('0x1a')](_0x141c39)[_0x2b0f('0x29')](_0x4e3688);};}exports[_0x2b0f('0x2a')]=function(_0x2aaad3,_0x19d2d9){var _0x48d28d={},_0x22ad67={},_0x257e7c={'count':0x0,'rows':[]};var _0xa85e3b=_[_0x2b0f('0x2b')](db[_0x2b0f('0x2c')][_0x2b0f('0x2d')],function(_0x296d0c){return{'name':_0x296d0c['fieldName'],'type':_0x296d0c[_0x2b0f('0x2e')][_0x2b0f('0x2f')]};});_0x22ad67[_0x2b0f('0x30')]=_[_0x2b0f('0x2b')](_0xa85e3b,_0x2b0f('0x28'));_0x22ad67['query']=_[_0x2b0f('0x31')](_0x2aaad3[_0x2b0f('0x32')]);_0x22ad67[_0x2b0f('0x33')]=_[_0x2b0f('0x34')](_0x22ad67[_0x2b0f('0x30')],_0x22ad67[_0x2b0f('0x32')]);_0x48d28d[_0x2b0f('0x35')]=_[_0x2b0f('0x34')](_0x22ad67[_0x2b0f('0x30')],qs[_0x2b0f('0x36')](_0x2aaad3[_0x2b0f('0x32')][_0x2b0f('0x36')]));_0x48d28d[_0x2b0f('0x35')]=_0x48d28d['attributes'][_0x2b0f('0x37')]?_0x48d28d[_0x2b0f('0x35')]:_0x22ad67[_0x2b0f('0x30')];if(!_0x2aaad3['query']['hasOwnProperty'](_0x2b0f('0x38'))){_0x48d28d[_0x2b0f('0x1f')]=qs[_0x2b0f('0x1f')](_0x2aaad3[_0x2b0f('0x32')][_0x2b0f('0x1f')]);_0x48d28d[_0x2b0f('0x1e')]=qs[_0x2b0f('0x1e')](_0x2aaad3[_0x2b0f('0x32')]['offset']);}_0x48d28d[_0x2b0f('0x39')]=qs['sort'](_0x2aaad3['query'][_0x2b0f('0x3a')]);_0x48d28d[_0x2b0f('0x3b')]=qs[_0x2b0f('0x33')](_[_0x2b0f('0x3c')](_0x2aaad3[_0x2b0f('0x32')],_0x22ad67['filters']),_0xa85e3b);if(_0x2aaad3[_0x2b0f('0x32')][_0x2b0f('0x3d')]){_0x48d28d[_0x2b0f('0x3b')]=_[_0x2b0f('0x3e')](_0x48d28d[_0x2b0f('0x3b')],{'$or':_['map'](_0xa85e3b,function(_0x209d36){if(_0x209d36['type']!=='VIRTUAL'){var _0x51f652={};_0x51f652[_0x209d36[_0x2b0f('0x28')]]={'$like':'%'+_0x2aaad3[_0x2b0f('0x32')][_0x2b0f('0x3d')]+'%'};return _0x51f652;}})});}_0x48d28d=_[_0x2b0f('0x3e')]({},_0x48d28d,_0x2aaad3[_0x2b0f('0x3f')]);var _0x3daf84={'where':_0x48d28d['where']};return db[_0x2b0f('0x2c')]['count'](_0x3daf84)[_0x2b0f('0x24')](function(_0x2fa315){_0x257e7c['count']=_0x2fa315;if(_0x2aaad3['query'][_0x2b0f('0x40')]){_0x48d28d[_0x2b0f('0x41')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x48d28d);})[_0x2b0f('0x24')](function(_0x260f4e){_0x257e7c[_0x2b0f('0x42')]=_0x260f4e;return _0x257e7c;})[_0x2b0f('0x24')](respondWithFilteredResult(_0x19d2d9,_0x48d28d))[_0x2b0f('0x43')](handleError(_0x19d2d9,null));};exports[_0x2b0f('0x44')]=function(_0x43da9a,_0x26d0dc){var _0x59ffd6={'raw':!![],'where':{'id':_0x43da9a[_0x2b0f('0x45')]['id']}},_0x398a16={};_0x398a16[_0x2b0f('0x30')]=_[_0x2b0f('0x31')](db[_0x2b0f('0x2c')][_0x2b0f('0x2d')]);_0x398a16[_0x2b0f('0x32')]=_[_0x2b0f('0x31')](_0x43da9a[_0x2b0f('0x32')]);_0x398a16['filters']=_[_0x2b0f('0x34')](_0x398a16[_0x2b0f('0x30')],_0x398a16['query']);_0x59ffd6['attributes']=_[_0x2b0f('0x34')](_0x398a16['model'],qs[_0x2b0f('0x36')](_0x43da9a[_0x2b0f('0x32')][_0x2b0f('0x36')]));_0x59ffd6[_0x2b0f('0x35')]=_0x59ffd6[_0x2b0f('0x35')][_0x2b0f('0x37')]?_0x59ffd6[_0x2b0f('0x35')]:_0x398a16[_0x2b0f('0x30')];if(_0x43da9a[_0x2b0f('0x32')][_0x2b0f('0x40')]){_0x59ffd6[_0x2b0f('0x41')]=[{'all':!![]}];}_0x59ffd6=_[_0x2b0f('0x3e')]({},_0x59ffd6,_0x43da9a[_0x2b0f('0x3f')]);return db[_0x2b0f('0x2c')]['find'](_0x59ffd6)[_0x2b0f('0x24')](handleEntityNotFound(_0x26d0dc,null))[_0x2b0f('0x24')](respondWithResult(_0x26d0dc,null))[_0x2b0f('0x43')](handleError(_0x26d0dc,null));};exports[_0x2b0f('0x46')]=function(_0xff0001,_0x148e5b){return db[_0x2b0f('0x2c')][_0x2b0f('0x46')](_0xff0001[_0x2b0f('0x47')],{})[_0x2b0f('0x24')](respondWithResult(_0x148e5b,0xc9))[_0x2b0f('0x43')](handleError(_0x148e5b,null));};exports[_0x2b0f('0x23')]=function(_0x34aecd,_0x4204c7){if(_0x34aecd['body']['id']){delete _0x34aecd[_0x2b0f('0x47')]['id'];}return db[_0x2b0f('0x2c')][_0x2b0f('0x48')]({'where':{'id':_0x34aecd[_0x2b0f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4204c7,null))[_0x2b0f('0x24')](saveUpdates(_0x34aecd['body'],null))[_0x2b0f('0x24')](respondWithResult(_0x4204c7,null))['catch'](handleError(_0x4204c7,null));};exports[_0x2b0f('0x25')]=function(_0x25113e,_0xbf539e){return db[_0x2b0f('0x2c')][_0x2b0f('0x48')]({'where':{'id':_0x25113e[_0x2b0f('0x45')]['id']}})[_0x2b0f('0x24')](handleEntityNotFound(_0xbf539e,null))['then'](removeEntity(_0xbf539e,null))[_0x2b0f('0x43')](handleError(_0xbf539e,null));};exports[_0x2b0f('0x49')]=function(_0x212def,_0x4c7266){return db['SmsQueueReport']['describe']()[_0x2b0f('0x24')](respondWithResult(_0x4c7266,null))['catch'](handleError(_0x4c7266,null));}; \ No newline at end of file +var _0xa18d=['update','then','error','stack','name','send','index','SmsQueueReport','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save'];(function(_0x4c8dfa,_0xd9c68b){var _0x2ec23b=function(_0x3e151b){while(--_0x3e151b){_0x4c8dfa['push'](_0x4c8dfa['shift']());}};_0x2ec23b(++_0xd9c68b);}(_0xa18d,0xba));var _0xda18=function(_0x695b50,_0x47f9df){_0x695b50=_0x695b50-0x0;var _0x4c7994=_0xa18d[_0x695b50];return _0x4c7994;};'use strict';var emlformat=require(_0xda18('0x0'));var rimraf=require(_0xda18('0x1'));var zipdir=require(_0xda18('0x2'));var jsonpatch=require(_0xda18('0x3'));var rp=require(_0xda18('0x4'));var moment=require(_0xda18('0x5'));var BPromise=require(_0xda18('0x6'));var Mustache=require('mustache');var util=require(_0xda18('0x7'));var path=require(_0xda18('0x8'));var sox=require(_0xda18('0x9'));var csv=require(_0xda18('0xa'));var ejs=require(_0xda18('0xb'));var fs=require('fs');var fs_extra=require(_0xda18('0xc'));var _=require(_0xda18('0xd'));var squel=require(_0xda18('0xe'));var crypto=require(_0xda18('0xf'));var jsforce=require(_0xda18('0x10'));var deskjs=require(_0xda18('0x11'));var toCsv=require(_0xda18('0xa'));var querystring=require(_0xda18('0x12'));var Papa=require('papaparse');var Redis=require(_0xda18('0x13'));var authService=require(_0xda18('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda18('0x15'));var logger=require(_0xda18('0x16'))(_0xda18('0x17'));var utils=require(_0xda18('0x18'));var config=require(_0xda18('0x19'));var licenseUtil=require(_0xda18('0x1a'));var db=require(_0xda18('0x1b'))['db'];function respondWithStatusCode(_0x1b3c06,_0x47881f){_0x47881f=_0x47881f||0xcc;return function(_0x4ba0cb){if(_0x4ba0cb){return _0x1b3c06[_0xda18('0x1c')](_0x47881f);}return _0x1b3c06[_0xda18('0x1d')](_0x47881f)[_0xda18('0x1e')]();};}function respondWithResult(_0xb69362,_0x5e16e9){_0x5e16e9=_0x5e16e9||0xc8;return function(_0x378a75){if(_0x378a75){return _0xb69362[_0xda18('0x1d')](_0x5e16e9)['json'](_0x378a75);}};}function respondWithFilteredResult(_0x35cdf5,_0x50996b){return function(_0x136b77){if(_0x136b77){var _0x512719=typeof _0x50996b[_0xda18('0x1f')]===_0xda18('0x20')&&typeof _0x50996b[_0xda18('0x21')]==='undefined';var _0x1c97f9=_0x136b77[_0xda18('0x22')];var _0x54cb94=_0x512719?0x0:_0x50996b['offset'];var _0x2e9fae=_0x512719?_0x136b77[_0xda18('0x22')]:_0x50996b['offset']+_0x50996b[_0xda18('0x21')];var _0x3c236d;if(_0x2e9fae>=_0x1c97f9){_0x2e9fae=_0x1c97f9;_0x3c236d=0xc8;}else{_0x3c236d=0xce;}_0x35cdf5[_0xda18('0x1d')](_0x3c236d);return _0x35cdf5['set'](_0xda18('0x23'),_0x54cb94+'-'+_0x2e9fae+'/'+_0x1c97f9)[_0xda18('0x24')](_0x136b77);}return null;};}function patchUpdates(_0x2de682){return function(_0x3dd93d){try{jsonpatch[_0xda18('0x25')](_0x3dd93d,_0x2de682,!![]);}catch(_0x546825){return BPromise['reject'](_0x546825);}return _0x3dd93d[_0xda18('0x26')]();};}function saveUpdates(_0x371ed4,_0x248ce2){return function(_0x55021b){if(_0x55021b){return _0x55021b[_0xda18('0x27')](_0x371ed4)[_0xda18('0x28')](function(_0x3f6a47){return _0x3f6a47;});}return null;};}function removeEntity(_0x5411aa,_0x34b93c){return function(_0x45da31){if(_0x45da31){return _0x45da31['destroy']()[_0xda18('0x28')](function(){_0x5411aa[_0xda18('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d183,_0x455886){return function(_0x3e9705){if(!_0x3e9705){_0x53d183[_0xda18('0x1c')](0x194);}return _0x3e9705;};}function handleError(_0x987298,_0x4fa463){_0x4fa463=_0x4fa463||0x1f4;return function(_0x204ffb){logger[_0xda18('0x29')](_0x204ffb[_0xda18('0x2a')]);if(_0x204ffb[_0xda18('0x2b')]){delete _0x204ffb[_0xda18('0x2b')];}_0x987298[_0xda18('0x1d')](_0x4fa463)[_0xda18('0x2c')](_0x204ffb);};}exports[_0xda18('0x2d')]=function(_0x9c9dcd,_0x156d97){var _0x551094={},_0x17b072={},_0x4ef06b={'count':0x0,'rows':[]};var _0x38599a=_['map'](db[_0xda18('0x2e')]['rawAttributes'],function(_0x1a8b2b){return{'name':_0x1a8b2b[_0xda18('0x2f')],'type':_0x1a8b2b[_0xda18('0x30')]['key']};});_0x17b072[_0xda18('0x31')]=_['map'](_0x38599a,_0xda18('0x2b'));_0x17b072['query']=_[_0xda18('0x32')](_0x9c9dcd[_0xda18('0x33')]);_0x17b072['filters']=_[_0xda18('0x34')](_0x17b072[_0xda18('0x31')],_0x17b072[_0xda18('0x33')]);_0x551094[_0xda18('0x35')]=_[_0xda18('0x34')](_0x17b072[_0xda18('0x31')],qs['fields'](_0x9c9dcd[_0xda18('0x33')][_0xda18('0x36')]));_0x551094[_0xda18('0x35')]=_0x551094[_0xda18('0x35')][_0xda18('0x37')]?_0x551094[_0xda18('0x35')]:_0x17b072['model'];if(!_0x9c9dcd[_0xda18('0x33')]['hasOwnProperty'](_0xda18('0x38'))){_0x551094['limit']=qs['limit'](_0x9c9dcd[_0xda18('0x33')]['limit']);_0x551094[_0xda18('0x1f')]=qs[_0xda18('0x1f')](_0x9c9dcd[_0xda18('0x33')]['offset']);}_0x551094[_0xda18('0x39')]=qs[_0xda18('0x3a')](_0x9c9dcd[_0xda18('0x33')]['sort']);_0x551094[_0xda18('0x3b')]=qs[_0xda18('0x3c')](_['pick'](_0x9c9dcd[_0xda18('0x33')],_0x17b072[_0xda18('0x3c')]),_0x38599a);if(_0x9c9dcd[_0xda18('0x33')]['filter']){_0x551094[_0xda18('0x3b')]=_['merge'](_0x551094[_0xda18('0x3b')],{'$or':_['map'](_0x38599a,function(_0x534a9d){if(_0x534a9d[_0xda18('0x30')]!==_0xda18('0x3d')){var _0x3ed04e={};_0x3ed04e[_0x534a9d[_0xda18('0x2b')]]={'$like':'%'+_0x9c9dcd[_0xda18('0x33')][_0xda18('0x3e')]+'%'};return _0x3ed04e;}})});}_0x551094=_['merge']({},_0x551094,_0x9c9dcd[_0xda18('0x3f')]);var _0x1669c1={'where':_0x551094['where']};return db['SmsQueueReport'][_0xda18('0x22')](_0x1669c1)['then'](function(_0x475957){_0x4ef06b[_0xda18('0x22')]=_0x475957;if(_0x9c9dcd['query'][_0xda18('0x40')]){_0x551094[_0xda18('0x41')]=[{'all':!![]}];}return db[_0xda18('0x2e')][_0xda18('0x42')](_0x551094);})['then'](function(_0x491d6b){_0x4ef06b['rows']=_0x491d6b;return _0x4ef06b;})[_0xda18('0x28')](respondWithFilteredResult(_0x156d97,_0x551094))[_0xda18('0x43')](handleError(_0x156d97,null));};exports[_0xda18('0x44')]=function(_0x4edcbd,_0x16c752){var _0x356dce={'raw':!![],'where':{'id':_0x4edcbd['params']['id']}},_0x3190fd={};_0x3190fd[_0xda18('0x31')]=_[_0xda18('0x32')](db[_0xda18('0x2e')]['rawAttributes']);_0x3190fd[_0xda18('0x33')]=_[_0xda18('0x32')](_0x4edcbd[_0xda18('0x33')]);_0x3190fd[_0xda18('0x3c')]=_[_0xda18('0x34')](_0x3190fd[_0xda18('0x31')],_0x3190fd['query']);_0x356dce['attributes']=_[_0xda18('0x34')](_0x3190fd[_0xda18('0x31')],qs[_0xda18('0x36')](_0x4edcbd[_0xda18('0x33')][_0xda18('0x36')]));_0x356dce['attributes']=_0x356dce['attributes'][_0xda18('0x37')]?_0x356dce[_0xda18('0x35')]:_0x3190fd['model'];if(_0x4edcbd['query'][_0xda18('0x40')]){_0x356dce[_0xda18('0x41')]=[{'all':!![]}];}_0x356dce=_[_0xda18('0x45')]({},_0x356dce,_0x4edcbd['options']);return db[_0xda18('0x2e')][_0xda18('0x46')](_0x356dce)[_0xda18('0x28')](handleEntityNotFound(_0x16c752,null))[_0xda18('0x28')](respondWithResult(_0x16c752,null))[_0xda18('0x43')](handleError(_0x16c752,null));};exports[_0xda18('0x47')]=function(_0x1b499d,_0xe37bfe){return db[_0xda18('0x2e')]['create'](_0x1b499d[_0xda18('0x48')],{})[_0xda18('0x28')](respondWithResult(_0xe37bfe,0xc9))[_0xda18('0x43')](handleError(_0xe37bfe,null));};exports[_0xda18('0x27')]=function(_0x2f6c68,_0x203283){if(_0x2f6c68[_0xda18('0x48')]['id']){delete _0x2f6c68[_0xda18('0x48')]['id'];}return db[_0xda18('0x2e')]['find']({'where':{'id':_0x2f6c68[_0xda18('0x49')]['id']}})[_0xda18('0x28')](handleEntityNotFound(_0x203283,null))['then'](saveUpdates(_0x2f6c68[_0xda18('0x48')],null))['then'](respondWithResult(_0x203283,null))[_0xda18('0x43')](handleError(_0x203283,null));};exports['destroy']=function(_0x10c5df,_0x2defef){return db[_0xda18('0x2e')][_0xda18('0x46')]({'where':{'id':_0x10c5df[_0xda18('0x49')]['id']}})[_0xda18('0x28')](handleEntityNotFound(_0x2defef,null))[_0xda18('0x28')](removeEntity(_0x2defef,null))[_0xda18('0x43')](handleError(_0x2defef,null));};exports[_0xda18('0x4a')]=function(_0x186691,_0x19bab7){return db[_0xda18('0x2e')]['describe']()[_0xda18('0x28')](respondWithResult(_0x19bab7,null))['catch'](handleError(_0x19bab7,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ea0e828..bdfafda 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x5e89d7,_0x33f5f1){var _0x1a3662=function(_0x19f50e){while(--_0x19f50e){_0x5e89d7['push'](_0x5e89d7['shift']());}};_0x1a3662(++_0x33f5f1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'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 +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0xce395c,_0x3e8f19){var _0x4cf889=function(_0x19dbf0){while(--_0x19dbf0){_0xce395c['push'](_0xce395c['shift']());}};_0x4cf889(++_0x3e8f19);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xcb91[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ac9a250..60e7c27 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 _0x8b0d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','randomstring','ioredis'];(function(_0x3e1e52,_0x294ca3){var _0x2f2987=function(_0x53f5d9){while(--_0x53f5d9){_0x3e1e52['push'](_0x3e1e52['shift']());}};_0x2f2987(++_0x294ca3);}(_0x8b0d,0xfc));var _0xd8b0=function(_0x1c963e,_0x39f314){_0x1c963e=_0x1c963e-0x0;var _0x295646=_0x8b0d[_0x1c963e];return _0x295646;};'use strict';var _=require(_0xd8b0('0x0'));var util=require(_0xd8b0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8b0('0x2'));var fs=require('fs');var Redis=require(_0xd8b0('0x3'));var db=require(_0xd8b0('0x4'))['db'];var utils=require(_0xd8b0('0x5'));var logger=require(_0xd8b0('0x6'))(_0xd8b0('0x7'));var config=require(_0xd8b0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8b0('0x9')][_0xd8b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19a2ce,_0x39e35e,_0x26c868){return new BPromise(function(_0x32eada,_0x11b02b){return client[_0xd8b0('0xb')](_0x19a2ce,_0x26c868)[_0xd8b0('0xc')](function(_0x569a61){logger[_0xd8b0('0xd')](_0xd8b0('0xe'),_0x39e35e,_0xd8b0('0xf'));logger[_0xd8b0('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x39e35e,'request\x20sent',JSON[_0xd8b0('0x11')](_0x569a61));if(_0x569a61[_0xd8b0('0x12')]){if(_0x569a61['error'][_0xd8b0('0x13')]===0x1f4){logger['error'](_0xd8b0('0xe'),_0x39e35e,_0x569a61['error'][_0xd8b0('0x14')]);return _0x11b02b(_0x569a61[_0xd8b0('0x12')][_0xd8b0('0x14')]);}logger[_0xd8b0('0x12')](_0xd8b0('0xe'),_0x39e35e,_0x569a61[_0xd8b0('0x12')][_0xd8b0('0x14')]);return _0x32eada(_0x569a61[_0xd8b0('0x12')]['message']);}else{logger[_0xd8b0('0xd')](_0xd8b0('0xe'),_0x39e35e,'request\x20sent');_0x32eada(_0x569a61['result']['message']);}})[_0xd8b0('0x15')](function(_0x73a9e7){logger['error'](_0xd8b0('0xe'),_0x39e35e,_0x73a9e7);_0x11b02b(_0x73a9e7);});});}exports[_0xd8b0('0x16')]=function(_0x158339){var _0x55ecb2=this;return new Promise(function(_0x1681ec,_0x4c8916){return db[_0xd8b0('0x17')]['create'](_0x158339[_0xd8b0('0x18')],{'raw':_0x158339[_0xd8b0('0x19')]?_0x158339[_0xd8b0('0x19')][_0xd8b0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1cebef){logger[_0xd8b0('0xd')](_0xd8b0('0x16'),_0x158339);logger[_0xd8b0('0x10')](_0xd8b0('0x16'),_0x158339,JSON['stringify'](_0x1cebef));_0x1681ec(_0x1cebef);})[_0xd8b0('0x15')](function(_0x284561){logger['error'](_0xd8b0('0x16'),_0x284561[_0xd8b0('0x14')],_0x158339);_0x4c8916(_0x55ecb2[_0xd8b0('0x12')](0x1f4,_0x284561[_0xd8b0('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0xa85147){var _0x1451d2=this;return new Promise(function(_0x6803c1,_0x18e050){return db[_0xd8b0('0x17')][_0xd8b0('0x1b')](_0xa85147[_0xd8b0('0x18')],{'raw':_0xa85147[_0xd8b0('0x19')]?_0xa85147[_0xd8b0('0x19')][_0xd8b0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa85147[_0xd8b0('0x19')]?_0xa85147[_0xd8b0('0x19')][_0xd8b0('0x1c')]||null:null,'attributes':_0xa85147[_0xd8b0('0x19')]?_0xa85147[_0xd8b0('0x19')][_0xd8b0('0x1d')]||null:null,'limit':_0xa85147['options']?_0xa85147[_0xd8b0('0x19')][_0xd8b0('0x1e')]||null:null})[_0xd8b0('0xc')](function(_0x36f292){logger[_0xd8b0('0xd')](_0xd8b0('0x1f'),_0xa85147);logger[_0xd8b0('0x10')]('UpdateSmsQueueReport',_0xa85147,JSON[_0xd8b0('0x11')](_0x36f292));_0x6803c1(_0x36f292);})[_0xd8b0('0x15')](function(_0x1dbf8a){logger[_0xd8b0('0x12')](_0xd8b0('0x1f'),_0x1dbf8a[_0xd8b0('0x14')],_0xa85147);_0x18e050(_0x1451d2[_0xd8b0('0x12')](0x1f4,_0x1dbf8a[_0xd8b0('0x14')]));});});}; \ No newline at end of file +var _0x26e6=['SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x773d12,_0xba15a5){var _0x5cf11a=function(_0xc0561f){while(--_0xc0561f){_0x773d12['push'](_0x773d12['shift']());}};_0x5cf11a(++_0xba15a5);}(_0x26e6,0x128));var _0x626e=function(_0x2a7812,_0x1ce83a){_0x2a7812=_0x2a7812-0x0;var _0x3e1342=_0x26e6[_0x2a7812];return _0x3e1342;};'use strict';var _=require(_0x626e('0x0'));var util=require(_0x626e('0x1'));var moment=require('moment');var BPromise=require(_0x626e('0x2'));var rs=require(_0x626e('0x3'));var fs=require('fs');var Redis=require(_0x626e('0x4'));var db=require(_0x626e('0x5'))['db'];var utils=require(_0x626e('0x6'));var logger=require(_0x626e('0x7'))(_0x626e('0x8'));var config=require(_0x626e('0x9'));var jayson=require(_0x626e('0xa'));var client=jayson[_0x626e('0xb')][_0x626e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20224b,_0x526e25,_0x46b38a){return new BPromise(function(_0x153f12,_0x30be95){return client[_0x626e('0xd')](_0x20224b,_0x46b38a)['then'](function(_0x19d93d){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x526e25,'request\x20sent');logger[_0x626e('0xe')](_0x626e('0xf'),_0x526e25,_0x626e('0x10'),JSON[_0x626e('0x11')](_0x19d93d));if(_0x19d93d[_0x626e('0x12')]){if(_0x19d93d[_0x626e('0x12')]['code']===0x1f4){logger['error'](_0x626e('0x13'),_0x526e25,_0x19d93d[_0x626e('0x12')][_0x626e('0x14')]);return _0x30be95(_0x19d93d[_0x626e('0x12')][_0x626e('0x14')]);}logger[_0x626e('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x526e25,_0x19d93d[_0x626e('0x12')][_0x626e('0x14')]);return _0x153f12(_0x19d93d[_0x626e('0x12')][_0x626e('0x14')]);}else{logger[_0x626e('0x15')](_0x626e('0x13'),_0x526e25,_0x626e('0x10'));_0x153f12(_0x19d93d[_0x626e('0x16')][_0x626e('0x14')]);}})[_0x626e('0x17')](function(_0x229594){logger[_0x626e('0x12')](_0x626e('0x13'),_0x526e25,_0x229594);_0x30be95(_0x229594);});});}exports[_0x626e('0x18')]=function(_0x4e3945){var _0x280d37=this;return new Promise(function(_0x1e74b9,_0x4eb86d){return db[_0x626e('0x19')][_0x626e('0x1a')](_0x4e3945[_0x626e('0x1b')],{'raw':_0x4e3945[_0x626e('0x1c')]?_0x4e3945[_0x626e('0x1c')][_0x626e('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x196bfd){logger[_0x626e('0x15')](_0x626e('0x18'),_0x4e3945);logger[_0x626e('0xe')](_0x626e('0x18'),_0x4e3945,JSON[_0x626e('0x11')](_0x196bfd));_0x1e74b9(_0x196bfd);})[_0x626e('0x17')](function(_0x116745){logger['error'](_0x626e('0x18'),_0x116745[_0x626e('0x14')],_0x4e3945);_0x4eb86d(_0x280d37['error'](0x1f4,_0x116745[_0x626e('0x14')]));});});};exports[_0x626e('0x1e')]=function(_0x47560c){var _0x9b76f5=this;return new Promise(function(_0x174db,_0x333a8c){return db['SmsQueueReport'][_0x626e('0x1f')](_0x47560c[_0x626e('0x1b')],{'raw':_0x47560c[_0x626e('0x1c')]?_0x47560c[_0x626e('0x1c')][_0x626e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47560c[_0x626e('0x1c')]?_0x47560c[_0x626e('0x1c')][_0x626e('0x20')]||null:null,'attributes':_0x47560c['options']?_0x47560c[_0x626e('0x1c')][_0x626e('0x21')]||null:null,'limit':_0x47560c['options']?_0x47560c[_0x626e('0x1c')]['limit']||null:null})[_0x626e('0x22')](function(_0x457dd2){logger[_0x626e('0x15')](_0x626e('0x1e'),_0x47560c);logger[_0x626e('0xe')](_0x626e('0x1e'),_0x47560c,JSON[_0x626e('0x11')](_0x457dd2));_0x174db(_0x457dd2);})[_0x626e('0x17')](function(_0x4e838b){logger[_0x626e('0x12')]('UpdateSmsQueueReport',_0x4e838b[_0x626e('0x14')],_0x47560c);_0x333a8c(_0x9b76f5[_0x626e('0x12')](0x1f4,_0x4e838b[_0x626e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9905767..005ef1d 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 _0xe5b3=['../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xdd6375,_0x1a209d){var _0x178ca6=function(_0x497faa){while(--_0x497faa){_0xdd6375['push'](_0xdd6375['shift']());}};_0x178ca6(++_0x1a209d);}(_0xe5b3,0x133));var _0x3e5b=function(_0x52a4c7,_0x363d8c){_0x52a4c7=_0x52a4c7-0x0;var _0x3d0ceb=_0xe5b3[_0x52a4c7];return _0x3d0ceb;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file +var _0xf2ca=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','delete'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3c8b46,_0x34e053){_0x3c8b46=_0x3c8b46-0x0;var _0x4bf0a8=_0xf2ca[_0x3c8b46];return _0x4bf0a8;};'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('./smsTransferReport.controller');router[_0xaf2c('0x9')]('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0x9')]('/describe',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xc')]);router['get'](_0xaf2c('0xd'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['post']('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaf2c('0x11')](_0xaf2c('0xd'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x12')]);module[_0xaf2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 6f849bd..7304c31 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3f0f24,_0x249dad){_0x3f0f24=_0x3f0f24-0x0;var _0x17af8e=_0xb43b[_0x3f0f24];return _0x17af8e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x428ff6,_0x47b868){var _0x94b64=function(_0x1489fa){while(--_0x1489fa){_0x428ff6['push'](_0x428ff6['shift']());}};_0x94b64(++_0x47b868);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b0affe1..4c3aeeb 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 _0xd14f=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x19829c,_0x1dd03d){var _0xe8916b=function(_0x2c4ef9){while(--_0x2c4ef9){_0x19829c['push'](_0x19829c['shift']());}};_0xe8916b(++_0x1dd03d);}(_0xd14f,0x81));var _0xfd14=function(_0x123580,_0x168fa7){_0x123580=_0x123580-0x0;var _0x2c3fba=_0xd14f[_0x123580];return _0x2c3fba;};'use strict';var emlformat=require(_0xfd14('0x0'));var rimraf=require(_0xfd14('0x1'));var zipdir=require(_0xfd14('0x2'));var jsonpatch=require(_0xfd14('0x3'));var rp=require(_0xfd14('0x4'));var moment=require(_0xfd14('0x5'));var BPromise=require(_0xfd14('0x6'));var Mustache=require(_0xfd14('0x7'));var util=require(_0xfd14('0x8'));var path=require(_0xfd14('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfd14('0xa'));var fs=require('fs');var fs_extra=require(_0xfd14('0xb'));var _=require(_0xfd14('0xc'));var squel=require(_0xfd14('0xd'));var crypto=require(_0xfd14('0xe'));var jsforce=require(_0xfd14('0xf'));var deskjs=require(_0xfd14('0x10'));var toCsv=require(_0xfd14('0x11'));var querystring=require(_0xfd14('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfd14('0x13'));var qs=require(_0xfd14('0x14'));var as=require(_0xfd14('0x15'));var hardwareService=require(_0xfd14('0x16'));var logger=require(_0xfd14('0x17'))(_0xfd14('0x18'));var utils=require(_0xfd14('0x19'));var config=require(_0xfd14('0x1a'));var licenseUtil=require(_0xfd14('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b8020,_0xc3a85a){_0xc3a85a=_0xc3a85a||0xcc;return function(_0x164cf4){if(_0x164cf4){return _0x1b8020[_0xfd14('0x1c')](_0xc3a85a);}return _0x1b8020[_0xfd14('0x1d')](_0xc3a85a)[_0xfd14('0x1e')]();};}function respondWithResult(_0x5051ed,_0x3a42d2){_0x3a42d2=_0x3a42d2||0xc8;return function(_0x37472b){if(_0x37472b){return _0x5051ed[_0xfd14('0x1d')](_0x3a42d2)[_0xfd14('0x1f')](_0x37472b);}};}function respondWithFilteredResult(_0x2b5005,_0x58c37f){return function(_0x25bfb4){if(_0x25bfb4){var _0x3bd7af=typeof _0x58c37f[_0xfd14('0x20')]===_0xfd14('0x21')&&typeof _0x58c37f[_0xfd14('0x22')]===_0xfd14('0x21');var _0x568543=_0x25bfb4[_0xfd14('0x23')];var _0x1e7951=_0x3bd7af?0x0:_0x58c37f[_0xfd14('0x20')];var _0x408a9b=_0x3bd7af?_0x25bfb4[_0xfd14('0x23')]:_0x58c37f[_0xfd14('0x20')]+_0x58c37f[_0xfd14('0x22')];var _0x10d5b0;if(_0x408a9b>=_0x568543){_0x408a9b=_0x568543;_0x10d5b0=0xc8;}else{_0x10d5b0=0xce;}_0x2b5005[_0xfd14('0x1d')](_0x10d5b0);return _0x2b5005['set'](_0xfd14('0x24'),_0x1e7951+'-'+_0x408a9b+'/'+_0x568543)['json'](_0x25bfb4);}return null;};}function patchUpdates(_0x2b64f5){return function(_0x4ac712){try{jsonpatch['apply'](_0x4ac712,_0x2b64f5,!![]);}catch(_0x2fa035){return BPromise['reject'](_0x2fa035);}return _0x4ac712[_0xfd14('0x25')]();};}function saveUpdates(_0x4d0443,_0xdae1b8){return function(_0x468ae5){if(_0x468ae5){return _0x468ae5[_0xfd14('0x26')](_0x4d0443)[_0xfd14('0x27')](function(_0x107515){return _0x107515;});}return null;};}function removeEntity(_0x119a52,_0x39ad18){return function(_0x10b334){if(_0x10b334){return _0x10b334['destroy']()['then'](function(){_0x119a52[_0xfd14('0x1d')](0xcc)[_0xfd14('0x1e')]();});}};}function handleEntityNotFound(_0x229b5c,_0x100ee0){return function(_0x2ddefb){if(!_0x2ddefb){_0x229b5c[_0xfd14('0x1c')](0x194);}return _0x2ddefb;};}function handleError(_0x204e4b,_0x23b42c){_0x23b42c=_0x23b42c||0x1f4;return function(_0x4287da){logger[_0xfd14('0x28')](_0x4287da['stack']);if(_0x4287da[_0xfd14('0x29')]){delete _0x4287da[_0xfd14('0x29')];}_0x204e4b[_0xfd14('0x1d')](_0x23b42c)[_0xfd14('0x2a')](_0x4287da);};}exports[_0xfd14('0x2b')]=function(_0x58f117,_0x262727){var _0x11e71f={},_0x529260={},_0x150b00={'count':0x0,'rows':[]};var _0x200e21=_[_0xfd14('0x2c')](db[_0xfd14('0x2d')][_0xfd14('0x2e')],function(_0x31509d){return{'name':_0x31509d[_0xfd14('0x2f')],'type':_0x31509d[_0xfd14('0x30')]['key']};});_0x529260[_0xfd14('0x31')]=_[_0xfd14('0x2c')](_0x200e21,'name');_0x529260[_0xfd14('0x32')]=_['keys'](_0x58f117[_0xfd14('0x32')]);_0x529260[_0xfd14('0x33')]=_[_0xfd14('0x34')](_0x529260[_0xfd14('0x31')],_0x529260[_0xfd14('0x32')]);_0x11e71f[_0xfd14('0x35')]=_[_0xfd14('0x34')](_0x529260[_0xfd14('0x31')],qs[_0xfd14('0x36')](_0x58f117[_0xfd14('0x32')][_0xfd14('0x36')]));_0x11e71f[_0xfd14('0x35')]=_0x11e71f[_0xfd14('0x35')][_0xfd14('0x37')]?_0x11e71f['attributes']:_0x529260[_0xfd14('0x31')];if(!_0x58f117[_0xfd14('0x32')][_0xfd14('0x38')]('nolimit')){_0x11e71f[_0xfd14('0x22')]=qs[_0xfd14('0x22')](_0x58f117[_0xfd14('0x32')]['limit']);_0x11e71f[_0xfd14('0x20')]=qs[_0xfd14('0x20')](_0x58f117[_0xfd14('0x32')][_0xfd14('0x20')]);}_0x11e71f[_0xfd14('0x39')]=qs[_0xfd14('0x3a')](_0x58f117['query'][_0xfd14('0x3a')]);_0x11e71f[_0xfd14('0x3b')]=qs[_0xfd14('0x33')](_[_0xfd14('0x3c')](_0x58f117[_0xfd14('0x32')],_0x529260[_0xfd14('0x33')]),_0x200e21);if(_0x58f117[_0xfd14('0x32')]['filter']){_0x11e71f[_0xfd14('0x3b')]=_[_0xfd14('0x3d')](_0x11e71f['where'],{'$or':_[_0xfd14('0x2c')](_0x200e21,function(_0x43bbe1){if(_0x43bbe1[_0xfd14('0x30')]!==_0xfd14('0x3e')){var _0x1006a5={};_0x1006a5[_0x43bbe1[_0xfd14('0x29')]]={'$like':'%'+_0x58f117['query'][_0xfd14('0x3f')]+'%'};return _0x1006a5;}})});}_0x11e71f=_[_0xfd14('0x3d')]({},_0x11e71f,_0x58f117['options']);var _0x3986b4={'where':_0x11e71f[_0xfd14('0x3b')]};return db[_0xfd14('0x2d')]['count'](_0x3986b4)[_0xfd14('0x27')](function(_0x139127){_0x150b00[_0xfd14('0x23')]=_0x139127;if(_0x58f117[_0xfd14('0x32')][_0xfd14('0x40')]){_0x11e71f['include']=[{'all':!![]}];}return db[_0xfd14('0x2d')]['findAll'](_0x11e71f);})['then'](function(_0x533744){_0x150b00[_0xfd14('0x41')]=_0x533744;return _0x150b00;})['then'](respondWithFilteredResult(_0x262727,_0x11e71f))[_0xfd14('0x42')](handleError(_0x262727,null));};exports[_0xfd14('0x43')]=function(_0x87cef8,_0xd82cb2){var _0x432903={'raw':!![],'where':{'id':_0x87cef8[_0xfd14('0x44')]['id']}},_0x9cba37={};_0x9cba37[_0xfd14('0x31')]=_[_0xfd14('0x45')](db['SmsTransferReport'][_0xfd14('0x2e')]);_0x9cba37['query']=_[_0xfd14('0x45')](_0x87cef8[_0xfd14('0x32')]);_0x9cba37[_0xfd14('0x33')]=_['intersection'](_0x9cba37[_0xfd14('0x31')],_0x9cba37[_0xfd14('0x32')]);_0x432903[_0xfd14('0x35')]=_[_0xfd14('0x34')](_0x9cba37[_0xfd14('0x31')],qs['fields'](_0x87cef8[_0xfd14('0x32')][_0xfd14('0x36')]));_0x432903[_0xfd14('0x35')]=_0x432903[_0xfd14('0x35')][_0xfd14('0x37')]?_0x432903['attributes']:_0x9cba37[_0xfd14('0x31')];if(_0x87cef8[_0xfd14('0x32')]['includeAll']){_0x432903[_0xfd14('0x46')]=[{'all':!![]}];}_0x432903=_[_0xfd14('0x3d')]({},_0x432903,_0x87cef8[_0xfd14('0x47')]);return db[_0xfd14('0x2d')][_0xfd14('0x48')](_0x432903)[_0xfd14('0x27')](handleEntityNotFound(_0xd82cb2,null))[_0xfd14('0x27')](respondWithResult(_0xd82cb2,null))[_0xfd14('0x42')](handleError(_0xd82cb2,null));};exports[_0xfd14('0x49')]=function(_0x5b8059,_0x482b86){return db[_0xfd14('0x2d')]['create'](_0x5b8059[_0xfd14('0x4a')],{})[_0xfd14('0x27')](respondWithResult(_0x482b86,0xc9))[_0xfd14('0x42')](handleError(_0x482b86,null));};exports[_0xfd14('0x26')]=function(_0x42d732,_0x1eaabd){if(_0x42d732[_0xfd14('0x4a')]['id']){delete _0x42d732['body']['id'];}return db['SmsTransferReport'][_0xfd14('0x48')]({'where':{'id':_0x42d732[_0xfd14('0x44')]['id']}})[_0xfd14('0x27')](handleEntityNotFound(_0x1eaabd,null))['then'](saveUpdates(_0x42d732[_0xfd14('0x4a')],null))[_0xfd14('0x27')](respondWithResult(_0x1eaabd,null))[_0xfd14('0x42')](handleError(_0x1eaabd,null));};exports[_0xfd14('0x4b')]=function(_0x103273,_0xcea3ee){return db[_0xfd14('0x2d')][_0xfd14('0x48')]({'where':{'id':_0x103273[_0xfd14('0x44')]['id']}})[_0xfd14('0x27')](handleEntityNotFound(_0xcea3ee,null))[_0xfd14('0x27')](removeEntity(_0xcea3ee,null))[_0xfd14('0x42')](handleError(_0xcea3ee,null));};exports[_0xfd14('0x4c')]=function(_0x3802de,_0x5145ce){return db['SmsTransferReport'][_0xfd14('0x4c')]()[_0xfd14('0x27')](respondWithResult(_0x5145ce,null))[_0xfd14('0x42')](handleError(_0x5145ce,null));}; \ No newline at end of file +var _0xefa2=['include','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','index','map','SmsTransferReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','then','includeAll'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0xefa2,0x123));var _0x2efa=function(_0x1b8c49,_0x250d99){_0x1b8c49=_0x1b8c49-0x0;var _0x435194=_0xefa2[_0x1b8c49];return _0x435194;};'use strict';var emlformat=require(_0x2efa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2efa('0x1'));var moment=require(_0x2efa('0x2'));var BPromise=require(_0x2efa('0x3'));var Mustache=require(_0x2efa('0x4'));var util=require('util');var path=require(_0x2efa('0x5'));var sox=require('sox');var csv=require(_0x2efa('0x6'));var ejs=require(_0x2efa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2efa('0x8'));var jsforce=require(_0x2efa('0x9'));var deskjs=require(_0x2efa('0xa'));var toCsv=require(_0x2efa('0x6'));var querystring=require(_0x2efa('0xb'));var Papa=require('papaparse');var Redis=require(_0x2efa('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2efa('0xd'));var as=require(_0x2efa('0xe'));var hardwareService=require(_0x2efa('0xf'));var logger=require(_0x2efa('0x10'))(_0x2efa('0x11'));var utils=require(_0x2efa('0x12'));var config=require(_0x2efa('0x13'));var licenseUtil=require(_0x2efa('0x14'));var db=require(_0x2efa('0x15'))['db'];function respondWithStatusCode(_0x5e6b31,_0x304c04){_0x304c04=_0x304c04||0xcc;return function(_0xc77af8){if(_0xc77af8){return _0x5e6b31['sendStatus'](_0x304c04);}return _0x5e6b31[_0x2efa('0x16')](_0x304c04)['end']();};}function respondWithResult(_0x2a8b62,_0x3daa26){_0x3daa26=_0x3daa26||0xc8;return function(_0x466b74){if(_0x466b74){return _0x2a8b62[_0x2efa('0x16')](_0x3daa26)[_0x2efa('0x17')](_0x466b74);}};}function respondWithFilteredResult(_0x227e37,_0x1bcc4d){return function(_0x5f5643){if(_0x5f5643){var _0x3cb51a=typeof _0x1bcc4d['offset']===_0x2efa('0x18')&&typeof _0x1bcc4d[_0x2efa('0x19')]===_0x2efa('0x18');var _0x238184=_0x5f5643['count'];var _0x3eda24=_0x3cb51a?0x0:_0x1bcc4d[_0x2efa('0x1a')];var _0x40d3f9=_0x3cb51a?_0x5f5643[_0x2efa('0x1b')]:_0x1bcc4d[_0x2efa('0x1a')]+_0x1bcc4d[_0x2efa('0x19')];var _0x433844;if(_0x40d3f9>=_0x238184){_0x40d3f9=_0x238184;_0x433844=0xc8;}else{_0x433844=0xce;}_0x227e37['status'](_0x433844);return _0x227e37[_0x2efa('0x1c')](_0x2efa('0x1d'),_0x3eda24+'-'+_0x40d3f9+'/'+_0x238184)[_0x2efa('0x17')](_0x5f5643);}return null;};}function patchUpdates(_0x196106){return function(_0x374385){try{jsonpatch['apply'](_0x374385,_0x196106,!![]);}catch(_0xea9663){return BPromise[_0x2efa('0x1e')](_0xea9663);}return _0x374385[_0x2efa('0x1f')]();};}function saveUpdates(_0x4c51dd,_0x1290ff){return function(_0x48120a){if(_0x48120a){return _0x48120a[_0x2efa('0x20')](_0x4c51dd)['then'](function(_0x575880){return _0x575880;});}return null;};}function removeEntity(_0x45ef4d,_0x3344d7){return function(_0x5495d3){if(_0x5495d3){return _0x5495d3[_0x2efa('0x21')]()['then'](function(){_0x45ef4d[_0x2efa('0x16')](0xcc)[_0x2efa('0x22')]();});}};}function handleEntityNotFound(_0x52dded,_0x5734b3){return function(_0x27ecf9){if(!_0x27ecf9){_0x52dded[_0x2efa('0x23')](0x194);}return _0x27ecf9;};}function handleError(_0x1fa857,_0x59ee10){_0x59ee10=_0x59ee10||0x1f4;return function(_0x2d73b6){logger['error'](_0x2d73b6[_0x2efa('0x24')]);if(_0x2d73b6[_0x2efa('0x25')]){delete _0x2d73b6[_0x2efa('0x25')];}_0x1fa857[_0x2efa('0x16')](_0x59ee10)['send'](_0x2d73b6);};}exports[_0x2efa('0x26')]=function(_0x544604,_0x3427f9){var _0x9c97c9={},_0x221c97={},_0x371651={'count':0x0,'rows':[]};var _0xe9db9=_[_0x2efa('0x27')](db[_0x2efa('0x28')][_0x2efa('0x29')],function(_0x3dda48){return{'name':_0x3dda48['fieldName'],'type':_0x3dda48[_0x2efa('0x2a')]['key']};});_0x221c97[_0x2efa('0x2b')]=_[_0x2efa('0x27')](_0xe9db9,_0x2efa('0x25'));_0x221c97['query']=_[_0x2efa('0x2c')](_0x544604[_0x2efa('0x2d')]);_0x221c97[_0x2efa('0x2e')]=_[_0x2efa('0x2f')](_0x221c97[_0x2efa('0x2b')],_0x221c97[_0x2efa('0x2d')]);_0x9c97c9[_0x2efa('0x30')]=_['intersection'](_0x221c97['model'],qs[_0x2efa('0x31')](_0x544604[_0x2efa('0x2d')][_0x2efa('0x31')]));_0x9c97c9[_0x2efa('0x30')]=_0x9c97c9[_0x2efa('0x30')][_0x2efa('0x32')]?_0x9c97c9['attributes']:_0x221c97['model'];if(!_0x544604[_0x2efa('0x2d')][_0x2efa('0x33')](_0x2efa('0x34'))){_0x9c97c9[_0x2efa('0x19')]=qs['limit'](_0x544604[_0x2efa('0x2d')]['limit']);_0x9c97c9[_0x2efa('0x1a')]=qs[_0x2efa('0x1a')](_0x544604[_0x2efa('0x2d')]['offset']);}_0x9c97c9['order']=qs[_0x2efa('0x35')](_0x544604[_0x2efa('0x2d')]['sort']);_0x9c97c9[_0x2efa('0x36')]=qs[_0x2efa('0x2e')](_[_0x2efa('0x37')](_0x544604[_0x2efa('0x2d')],_0x221c97[_0x2efa('0x2e')]),_0xe9db9);if(_0x544604[_0x2efa('0x2d')]['filter']){_0x9c97c9['where']=_['merge'](_0x9c97c9['where'],{'$or':_[_0x2efa('0x27')](_0xe9db9,function(_0x1f7c67){if(_0x1f7c67['type']!=='VIRTUAL'){var _0x3dfdd4={};_0x3dfdd4[_0x1f7c67[_0x2efa('0x25')]]={'$like':'%'+_0x544604['query']['filter']+'%'};return _0x3dfdd4;}})});}_0x9c97c9=_[_0x2efa('0x38')]({},_0x9c97c9,_0x544604['options']);var _0x3b3219={'where':_0x9c97c9[_0x2efa('0x36')]};return db[_0x2efa('0x28')][_0x2efa('0x1b')](_0x3b3219)[_0x2efa('0x39')](function(_0x545867){_0x371651[_0x2efa('0x1b')]=_0x545867;if(_0x544604[_0x2efa('0x2d')][_0x2efa('0x3a')]){_0x9c97c9[_0x2efa('0x3b')]=[{'all':!![]}];}return db[_0x2efa('0x28')][_0x2efa('0x3c')](_0x9c97c9);})['then'](function(_0x1022c3){_0x371651[_0x2efa('0x3d')]=_0x1022c3;return _0x371651;})['then'](respondWithFilteredResult(_0x3427f9,_0x9c97c9))[_0x2efa('0x3e')](handleError(_0x3427f9,null));};exports[_0x2efa('0x3f')]=function(_0x3ad1db,_0xcfc4f9){var _0xa86b4a={'raw':!![],'where':{'id':_0x3ad1db['params']['id']}},_0x4574ee={};_0x4574ee['model']=_[_0x2efa('0x2c')](db[_0x2efa('0x28')]['rawAttributes']);_0x4574ee['query']=_['keys'](_0x3ad1db[_0x2efa('0x2d')]);_0x4574ee['filters']=_[_0x2efa('0x2f')](_0x4574ee['model'],_0x4574ee[_0x2efa('0x2d')]);_0xa86b4a['attributes']=_[_0x2efa('0x2f')](_0x4574ee[_0x2efa('0x2b')],qs[_0x2efa('0x31')](_0x3ad1db['query']['fields']));_0xa86b4a[_0x2efa('0x30')]=_0xa86b4a[_0x2efa('0x30')]['length']?_0xa86b4a[_0x2efa('0x30')]:_0x4574ee['model'];if(_0x3ad1db['query'][_0x2efa('0x3a')]){_0xa86b4a[_0x2efa('0x3b')]=[{'all':!![]}];}_0xa86b4a=_[_0x2efa('0x38')]({},_0xa86b4a,_0x3ad1db[_0x2efa('0x40')]);return db[_0x2efa('0x28')][_0x2efa('0x41')](_0xa86b4a)[_0x2efa('0x39')](handleEntityNotFound(_0xcfc4f9,null))[_0x2efa('0x39')](respondWithResult(_0xcfc4f9,null))[_0x2efa('0x3e')](handleError(_0xcfc4f9,null));};exports[_0x2efa('0x42')]=function(_0x3d353f,_0x38bffa){return db[_0x2efa('0x28')][_0x2efa('0x42')](_0x3d353f[_0x2efa('0x43')],{})[_0x2efa('0x39')](respondWithResult(_0x38bffa,0xc9))[_0x2efa('0x3e')](handleError(_0x38bffa,null));};exports[_0x2efa('0x20')]=function(_0x20c917,_0x44b992){if(_0x20c917[_0x2efa('0x43')]['id']){delete _0x20c917[_0x2efa('0x43')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x20c917[_0x2efa('0x44')]['id']}})[_0x2efa('0x39')](handleEntityNotFound(_0x44b992,null))[_0x2efa('0x39')](saveUpdates(_0x20c917[_0x2efa('0x43')],null))['then'](respondWithResult(_0x44b992,null))['catch'](handleError(_0x44b992,null));};exports['destroy']=function(_0x1e3606,_0x6ea610){return db[_0x2efa('0x28')][_0x2efa('0x41')]({'where':{'id':_0x1e3606['params']['id']}})[_0x2efa('0x39')](handleEntityNotFound(_0x6ea610,null))['then'](removeEntity(_0x6ea610,null))[_0x2efa('0x3e')](handleError(_0x6ea610,null));};exports[_0x2efa('0x45')]=function(_0x423385,_0x133b08){return db[_0x2efa('0x28')]['describe']()[_0x2efa('0x39')](respondWithResult(_0x133b08,null))[_0x2efa('0x3e')](handleError(_0x133b08,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index fd53c1b..d514add 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 _0x2bbb=['uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer'];(function(_0x5b4499,_0x586339){var _0x3854fa=function(_0x2add49){while(--_0x2add49){_0x5b4499['push'](_0x5b4499['shift']());}};_0x3854fa(++_0x586339);}(_0x2bbb,0x85));var _0xb2bb=function(_0x55f2c8,_0x534fae){_0x55f2c8=_0x55f2c8-0x0;var _0x53632f=_0x2bbb[_0x55f2c8];return _0x53632f;};'use strict';var _=require('lodash');var util=require(_0xb2bb('0x0'));var logger=require(_0xb2bb('0x1'))(_0xb2bb('0x2'));var moment=require('moment');var BPromise=require(_0xb2bb('0x3'));var rp=require(_0xb2bb('0x4'));var fs=require('fs');var path=require(_0xb2bb('0x5'));var rimraf=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var attributes=require(_0xb2bb('0x8'));module['exports']=function(_0x3581e2,_0x5bee47){return _0x3581e2['define'](_0xb2bb('0x9'),attributes,{'tableName':_0xb2bb('0xa'),'paranoid':![],'indexes':[{'name':_0xb2bb('0xb'),'fields':[_0xb2bb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b0c=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x2126f6,_0x3cad9d){var _0x278d8f=function(_0x8928d4){while(--_0x8928d4){_0x2126f6['push'](_0x2126f6['shift']());}};_0x278d8f(++_0x3cad9d);}(_0x4b0c,0x138));var _0xc4b0=function(_0x1669b7,_0x52bd2a){_0x1669b7=_0x1669b7-0x0;var _0x48d99a=_0x4b0c[_0x1669b7];return _0x48d99a;};'use strict';var _=require(_0xc4b0('0x0'));var util=require('util');var logger=require(_0xc4b0('0x1'))(_0xc4b0('0x2'));var moment=require('moment');var BPromise=require(_0xc4b0('0x3'));var rp=require(_0xc4b0('0x4'));var fs=require('fs');var path=require(_0xc4b0('0x5'));var rimraf=require(_0xc4b0('0x6'));var config=require(_0xc4b0('0x7'));var attributes=require(_0xc4b0('0x8'));module[_0xc4b0('0x9')]=function(_0x138527,_0x563c49){return _0x138527[_0xc4b0('0xa')](_0xc4b0('0xb'),attributes,{'tableName':_0xc4b0('0xc'),'paranoid':![],'indexes':[{'name':_0xc4b0('0xd'),'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 9338f4d..8c0bb9a 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 _0xaa5c=['client','http','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','../../config/logger','jayson/promise'];(function(_0x572dd2,_0x5d5100){var _0x2df3ed=function(_0x4760a4){while(--_0x4760a4){_0x572dd2['push'](_0x572dd2['shift']());}};_0x2df3ed(++_0x5d5100);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x2c46e0,_0x49988d){_0x2c46e0=_0x2c46e0-0x0;var _0x5b7f03=_0xaa5c[_0x2c46e0];return _0x5b7f03;};'use strict';var _=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var moment=require(_0xcaa5('0x2'));var BPromise=require(_0xcaa5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcaa5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcaa5('0x5'));var client=jayson[_0xcaa5('0x6')][_0xcaa5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f56bc,_0x3d0a81,_0x24edf5){return new BPromise(function(_0xb27ac1,_0x1b8683){return client['request'](_0x5f56bc,_0x24edf5)[_0xcaa5('0x8')](function(_0x11b4d1){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3d0a81,_0xcaa5('0x9'));logger[_0xcaa5('0xa')](_0xcaa5('0xb'),_0x3d0a81,'request\x20sent',JSON[_0xcaa5('0xc')](_0x11b4d1));if(_0x11b4d1['error']){if(_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0xe')]===0x1f4){logger[_0xcaa5('0xd')](_0xcaa5('0xf'),_0x3d0a81,_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0x10')]);return _0x1b8683(_0x11b4d1[_0xcaa5('0xd')]['message']);}logger[_0xcaa5('0xd')](_0xcaa5('0xf'),_0x3d0a81,_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0x10')]);return _0xb27ac1(_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0x10')]);}else{logger[_0xcaa5('0x11')](_0xcaa5('0xf'),_0x3d0a81,_0xcaa5('0x9'));_0xb27ac1(_0x11b4d1['result'][_0xcaa5('0x10')]);}})['catch'](function(_0x17e3d2){logger[_0xcaa5('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x3d0a81,_0x17e3d2);_0x1b8683(_0x17e3d2);});});} \ No newline at end of file +var _0x63b6=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x314c2e,_0x115083){var _0x3cc50a=function(_0x3fdf17){while(--_0x3fdf17){_0x314c2e['push'](_0x314c2e['shift']());}};_0x3cc50a(++_0x115083);}(_0x63b6,0x127));var _0x663b=function(_0x4aadd0,_0x278b52){_0x4aadd0=_0x4aadd0-0x0;var _0x4cd01e=_0x63b6[_0x4aadd0];return _0x4cd01e;};'use strict';var _=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var moment=require(_0x663b('0x2'));var BPromise=require('bluebird');var rs=require(_0x663b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x663b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x663b('0x5'))(_0x663b('0x6'));var config=require(_0x663b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x663b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x210eb1,_0x53f5cf,_0x414dc2){return new BPromise(function(_0x2976ff,_0xf8f3ff){return client[_0x663b('0x9')](_0x210eb1,_0x414dc2)[_0x663b('0xa')](function(_0x1e1698){logger['info'](_0x663b('0xb'),_0x53f5cf,_0x663b('0xc'));logger[_0x663b('0xd')](_0x663b('0xe'),_0x53f5cf,_0x663b('0xc'),JSON[_0x663b('0xf')](_0x1e1698));if(_0x1e1698[_0x663b('0x10')]){if(_0x1e1698[_0x663b('0x10')][_0x663b('0x11')]===0x1f4){logger[_0x663b('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x53f5cf,_0x1e1698['error'][_0x663b('0x12')]);return _0xf8f3ff(_0x1e1698[_0x663b('0x10')][_0x663b('0x12')]);}logger[_0x663b('0x10')](_0x663b('0xb'),_0x53f5cf,_0x1e1698[_0x663b('0x10')]['message']);return _0x2976ff(_0x1e1698[_0x663b('0x10')][_0x663b('0x12')]);}else{logger[_0x663b('0x13')](_0x663b('0xb'),_0x53f5cf,_0x663b('0xc'));_0x2976ff(_0x1e1698[_0x663b('0x14')][_0x663b('0x12')]);}})[_0x663b('0x15')](function(_0x63443b){logger[_0x663b('0x10')](_0x663b('0xb'),_0x53f5cf,_0x63443b);_0xf8f3ff(_0x63443b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 20201ba..d25ab1a 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 _0xfd20=['index','/:id','show','/:id/download','root','replace','format','basename','originalname','single','file','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1e42ea,_0x23898f){var _0x361037=function(_0x849525){while(--_0x849525){_0x1e42ea['push'](_0x1e42ea['shift']());}};_0x361037(++_0x23898f);}(_0xfd20,0x116));var _0x0fd2=function(_0x1daeaa,_0x297e73){_0x1daeaa=_0x1daeaa-0x0;var _0x2a6032=_0xfd20[_0x1daeaa];return _0x2a6032;};'use strict';var multer=require(_0x0fd2('0x0'));var util=require(_0x0fd2('0x1'));var path=require(_0x0fd2('0x2'));var timeout=require(_0x0fd2('0x3'));var express=require(_0x0fd2('0x4'));var router=express[_0x0fd2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0fd2('0x6'));var config=require(_0x0fd2('0x7'));var controller=require('./sound.controller');router[_0x0fd2('0x8')]('/',auth[_0x0fd2('0x9')](),controller[_0x0fd2('0xa')]);router['get'](_0x0fd2('0xb'),auth[_0x0fd2('0x9')](),controller[_0x0fd2('0xc')]);router[_0x0fd2('0x8')](_0x0fd2('0xd'),auth[_0x0fd2('0x9')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2023fc,_0x4b8dbd,_0x48b534){_0x48b534(null,path['join'](config[_0x0fd2('0xe')],'server/files/sounds/original/'));},'filename':function(_0x2c1135,_0x3f1d04,_0x32c470){_0x3f1d04['originalname']=_0x3f1d04['originalname'][_0x0fd2('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x32c470(null,util[_0x0fd2('0x10')]('%s-%s%s',path[_0x0fd2('0x11')](_0x3f1d04[_0x0fd2('0x12')],path['extname'](_0x3f1d04[_0x0fd2('0x12')])),Date['now'](),path['extname'](_0x3f1d04['originalname'])));}})});router['post']('/',upload[_0x0fd2('0x13')](_0x0fd2('0x14')),controller[_0x0fd2('0x15')]);router[_0x0fd2('0x16')]('/:id',auth[_0x0fd2('0x9')](),controller[_0x0fd2('0x17')]);router['delete'](_0x0fd2('0xb'),auth[_0x0fd2('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xa1da=['extname','now','post','single','file','create','put','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','index','/:id','isAuthenticated','get','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xa1da,0x134));var _0xaa1d=function(_0x5e6596,_0x3def6c){_0x5e6596=_0x5e6596-0x0;var _0x3f0d00=_0xa1da[_0x5e6596];return _0x3f0d00;};'use strict';var multer=require(_0xaa1d('0x0'));var util=require('util');var path=require(_0xaa1d('0x1'));var timeout=require(_0xaa1d('0x2'));var express=require('express');var router=express[_0xaa1d('0x3')]();var fs_extra=require(_0xaa1d('0x4'));var auth=require(_0xaa1d('0x5'));var interaction=require(_0xaa1d('0x6'));var config=require(_0xaa1d('0x7'));var controller=require(_0xaa1d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xaa1d('0x9')]);router['get'](_0xaa1d('0xa'),auth[_0xaa1d('0xb')](),controller['show']);router[_0xaa1d('0xc')](_0xaa1d('0xd'),auth['isAuthenticated'](),controller[_0xaa1d('0xe')]);var upload=multer({'storage':multer[_0xaa1d('0xf')]({'destination':function(_0x19bb4c,_0x2ad535,_0x1af896){_0x1af896(null,path['join'](config[_0xaa1d('0x10')],_0xaa1d('0x11')));},'filename':function(_0x45db53,_0x1751a3,_0x580b27){_0x1751a3[_0xaa1d('0x12')]=_0x1751a3['originalname'][_0xaa1d('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x580b27(null,util[_0xaa1d('0x14')](_0xaa1d('0x15'),path['basename'](_0x1751a3[_0xaa1d('0x12')],path[_0xaa1d('0x16')](_0x1751a3[_0xaa1d('0x12')])),Date[_0xaa1d('0x17')](),path[_0xaa1d('0x16')](_0x1751a3[_0xaa1d('0x12')])));}})});router[_0xaa1d('0x18')]('/',upload[_0xaa1d('0x19')](_0xaa1d('0x1a')),controller[_0xaa1d('0x1b')]);router[_0xaa1d('0x1c')]('/:id',auth[_0xaa1d('0xb')](),controller['update']);router[_0xaa1d('0x1d')]('/:id',auth[_0xaa1d('0xb')](),controller['delete']);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 e40f0b2..2de12f8 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 _0x0eab=['FLOAT','INTEGER','BIGINT','sequelize','exports','name','STRING'];(function(_0x5bd5bf,_0x37558a){var _0x242af0=function(_0x7b81df){while(--_0x7b81df){_0x5bd5bf['push'](_0x5bd5bf['shift']());}};_0x242af0(++_0x37558a);}(_0x0eab,0x114));var _0xb0ea=function(_0x12ce03,_0xa2bc91){_0x12ce03=_0x12ce03-0x0;var _0x631db=_0x0eab[_0x12ce03];return _0x631db;};'use strict';var Sequelize=require(_0xb0ea('0x0'));module[_0xb0ea('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb0ea('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb0ea('0x3')]},'display_name':{'type':Sequelize[_0xb0ea('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xb0ea('0x3')]},'original_format':{'type':Sequelize[_0xb0ea('0x3')]},'original_duration':{'type':Sequelize[_0xb0ea('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xb0ea('0x5')]},'original_bitRate':{'type':Sequelize[_0xb0ea('0x6')]},'original_sampleRate':{'type':Sequelize[_0xb0ea('0x5')]},'converted_format':{'type':Sequelize[_0xb0ea('0x3')]},'converted_duration':{'type':Sequelize[_0xb0ea('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xb0ea('0x6')]},'converted_channelCount':{'type':Sequelize[_0xb0ea('0x5')]},'converted_bitRate':{'type':Sequelize[_0xb0ea('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xb0ea('0x5')]}}; \ No newline at end of file +var _0x89bb=['FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x89bb,0x1e8));var _0xb89b=function(_0x47b95e,_0x40f30a){_0x47b95e=_0x47b95e-0x0;var _0x579e42=_0x89bb[_0x47b95e];return _0x579e42;};'use strict';var Sequelize=require(_0xb89b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xb89b('0x1')]},'display_name':{'type':Sequelize[_0xb89b('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xb89b('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xb89b('0x2')]},'original_sampleCount':{'type':Sequelize[_0xb89b('0x3')]},'original_channelCount':{'type':Sequelize[_0xb89b('0x4')]},'original_bitRate':{'type':Sequelize[_0xb89b('0x3')]},'original_sampleRate':{'type':Sequelize[_0xb89b('0x4')]},'converted_format':{'type':Sequelize[_0xb89b('0x1')]},'converted_duration':{'type':Sequelize[_0xb89b('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xb89b('0x3')]},'converted_channelCount':{'type':Sequelize[_0xb89b('0x4')]},'converted_bitRate':{'type':Sequelize[_0xb89b('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xb89b('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1d95ddf..eb6ce05 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 _0xa379=['save','update','then','destroy','get','Sounds','UserProfileResource','error','map','Sound','rawAttributes','fieldName','key','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','download','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','root','server/files/sounds/original','info','0777','transcode','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','start','description','original_format','unlinkSync','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply'];(function(_0x3e28cb,_0x2e2b6a){var _0x433d47=function(_0x1ba2bd){while(--_0x1ba2bd){_0x3e28cb['push'](_0x3e28cb['shift']());}};_0x433d47(++_0x2e2b6a);}(_0xa379,0x14f));var _0x9a37=function(_0xdd483c,_0xd008c0){_0xdd483c=_0xdd483c-0x0;var _0x142d87=_0xa379[_0xdd483c];return _0x142d87;};'use strict';var emlformat=require(_0x9a37('0x0'));var rimraf=require(_0x9a37('0x1'));var zipdir=require(_0x9a37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a37('0x3'));var BPromise=require(_0x9a37('0x4'));var Mustache=require(_0x9a37('0x5'));var util=require('util');var path=require(_0x9a37('0x6'));var sox=require(_0x9a37('0x7'));var csv=require(_0x9a37('0x8'));var ejs=require(_0x9a37('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a37('0xa'));var squel=require(_0x9a37('0xb'));var crypto=require(_0x9a37('0xc'));var jsforce=require(_0x9a37('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9a37('0xe'));var Redis=require(_0x9a37('0xf'));var authService=require(_0x9a37('0x10'));var qs=require(_0x9a37('0x11'));var as=require(_0x9a37('0x12'));var hardwareService=require(_0x9a37('0x13'));var logger=require(_0x9a37('0x14'))(_0x9a37('0x15'));var utils=require(_0x9a37('0x16'));var config=require(_0x9a37('0x17'));var licenseUtil=require(_0x9a37('0x18'));var db=require(_0x9a37('0x19'))['db'];function respondWithStatusCode(_0x3bbffe,_0x205e31){_0x205e31=_0x205e31||0xcc;return function(_0xf35fbe){if(_0xf35fbe){return _0x3bbffe[_0x9a37('0x1a')](_0x205e31);}return _0x3bbffe[_0x9a37('0x1b')](_0x205e31)[_0x9a37('0x1c')]();};}function respondWithResult(_0x142d47,_0x39b0fb){_0x39b0fb=_0x39b0fb||0xc8;return function(_0x194d82){if(_0x194d82){return _0x142d47[_0x9a37('0x1b')](_0x39b0fb)['json'](_0x194d82);}};}function respondWithFilteredResult(_0x1d6da3,_0x5b5575){return function(_0x57bc03){if(_0x57bc03){var _0xc3904c=typeof _0x5b5575[_0x9a37('0x1d')]==='undefined'&&typeof _0x5b5575['limit']===_0x9a37('0x1e');var _0x31a922=_0x57bc03[_0x9a37('0x1f')];var _0x1d9bb7=_0xc3904c?0x0:_0x5b5575['offset'];var _0x32a0db=_0xc3904c?_0x57bc03[_0x9a37('0x1f')]:_0x5b5575[_0x9a37('0x1d')]+_0x5b5575[_0x9a37('0x20')];var _0x20825e;if(_0x32a0db>=_0x31a922){_0x32a0db=_0x31a922;_0x20825e=0xc8;}else{_0x20825e=0xce;}_0x1d6da3[_0x9a37('0x1b')](_0x20825e);return _0x1d6da3[_0x9a37('0x21')](_0x9a37('0x22'),_0x1d9bb7+'-'+_0x32a0db+'/'+_0x31a922)[_0x9a37('0x23')](_0x57bc03);}return null;};}function patchUpdates(_0x3373ed){return function(_0x386354){try{jsonpatch[_0x9a37('0x24')](_0x386354,_0x3373ed,!![]);}catch(_0x3552fb){return BPromise['reject'](_0x3552fb);}return _0x386354[_0x9a37('0x25')]();};}function saveUpdates(_0x2afc31,_0x39bbe2){return function(_0x4173a4){if(_0x4173a4){return _0x4173a4[_0x9a37('0x26')](_0x2afc31)[_0x9a37('0x27')](function(_0xd65087){return _0xd65087;});}return null;};}function removeEntity(_0xfdb54,_0x35dbcc){return function(_0x16f08d){if(_0x16f08d){return _0x16f08d[_0x9a37('0x28')]()['then'](function(){var _0x1db089=_0x16f08d[_0x9a37('0x29')]({'plain':!![]});var _0x11a92e=_0x9a37('0x2a');return db[_0x9a37('0x2b')][_0x9a37('0x28')]({'where':{'type':_0x11a92e,'resourceId':_0x1db089['id']}})[_0x9a37('0x27')](function(){return _0x16f08d;});})['then'](function(){_0xfdb54[_0x9a37('0x1b')](0xcc)[_0x9a37('0x1c')]();});}};}function handleEntityNotFound(_0x5bd923,_0x1df4bf){return function(_0x4b9c1f){if(!_0x4b9c1f){_0x5bd923[_0x9a37('0x1a')](0x194);}return _0x4b9c1f;};}function handleError(_0x154742,_0x5d7777){_0x5d7777=_0x5d7777||0x1f4;return function(_0x3268ed){logger[_0x9a37('0x2c')](_0x3268ed['stack']);if(_0x3268ed['name']){delete _0x3268ed['name'];}_0x154742[_0x9a37('0x1b')](_0x5d7777)['send'](_0x3268ed);};}exports['index']=function(_0x36022c,_0x27421d){var _0x5282f0={},_0x55b476={},_0x589c58={'count':0x0,'rows':[]};var _0xe30914=_[_0x9a37('0x2d')](db[_0x9a37('0x2e')][_0x9a37('0x2f')],function(_0x1d0eb2){return{'name':_0x1d0eb2[_0x9a37('0x30')],'type':_0x1d0eb2['type'][_0x9a37('0x31')]};});_0x55b476[_0x9a37('0x32')]=_[_0x9a37('0x2d')](_0xe30914,_0x9a37('0x33'));_0x55b476['query']=_[_0x9a37('0x34')](_0x36022c[_0x9a37('0x35')]);_0x55b476[_0x9a37('0x36')]=_['intersection'](_0x55b476['model'],_0x55b476[_0x9a37('0x35')]);_0x5282f0[_0x9a37('0x37')]=_[_0x9a37('0x38')](_0x55b476[_0x9a37('0x32')],qs['fields'](_0x36022c[_0x9a37('0x35')][_0x9a37('0x39')]));_0x5282f0[_0x9a37('0x37')]=_0x5282f0[_0x9a37('0x37')][_0x9a37('0x3a')]?_0x5282f0[_0x9a37('0x37')]:_0x55b476[_0x9a37('0x32')];if(!_0x36022c['query'][_0x9a37('0x3b')](_0x9a37('0x3c'))){_0x5282f0['limit']=qs['limit'](_0x36022c['query']['limit']);_0x5282f0[_0x9a37('0x1d')]=qs[_0x9a37('0x1d')](_0x36022c[_0x9a37('0x35')][_0x9a37('0x1d')]);}_0x5282f0[_0x9a37('0x3d')]=qs['sort'](_0x36022c[_0x9a37('0x35')][_0x9a37('0x3e')]);_0x5282f0[_0x9a37('0x3f')]=qs[_0x9a37('0x36')](_[_0x9a37('0x40')](_0x36022c['query'],_0x55b476[_0x9a37('0x36')]),_0xe30914);if(_0x36022c[_0x9a37('0x35')][_0x9a37('0x41')]){_0x5282f0[_0x9a37('0x3f')]=_[_0x9a37('0x42')](_0x5282f0[_0x9a37('0x3f')],{'$or':_[_0x9a37('0x2d')](_0xe30914,function(_0x58d89c){if(_0x58d89c[_0x9a37('0x43')]!=='VIRTUAL'){var _0x19416f={};_0x19416f[_0x58d89c[_0x9a37('0x33')]]={'$like':'%'+_0x36022c[_0x9a37('0x35')]['filter']+'%'};return _0x19416f;}})});}_0x5282f0=_['merge']({},_0x5282f0,_0x36022c[_0x9a37('0x44')]);var _0x390425={'where':_0x5282f0[_0x9a37('0x3f')]};return db[_0x9a37('0x2e')][_0x9a37('0x1f')](_0x390425)['then'](function(_0x349426){_0x589c58[_0x9a37('0x1f')]=_0x349426;if(_0x36022c[_0x9a37('0x35')][_0x9a37('0x45')]){_0x5282f0['include']=[{'all':!![]}];}return db[_0x9a37('0x2e')][_0x9a37('0x46')](_0x5282f0);})['then'](function(_0x18b904){_0x589c58[_0x9a37('0x47')]=_0x18b904;return _0x589c58;})['then'](respondWithFilteredResult(_0x27421d,_0x5282f0))[_0x9a37('0x48')](handleError(_0x27421d,null));};exports[_0x9a37('0x49')]=function(_0x3005a5,_0x5c9321){var _0x4277ed={'raw':!![],'where':{'id':_0x3005a5[_0x9a37('0x4a')]['id']}},_0x16e16a={};_0x16e16a[_0x9a37('0x32')]=_['keys'](db['Sound'][_0x9a37('0x2f')]);_0x16e16a['query']=_[_0x9a37('0x34')](_0x3005a5[_0x9a37('0x35')]);_0x16e16a[_0x9a37('0x36')]=_[_0x9a37('0x38')](_0x16e16a[_0x9a37('0x32')],_0x16e16a[_0x9a37('0x35')]);_0x4277ed[_0x9a37('0x37')]=_['intersection'](_0x16e16a[_0x9a37('0x32')],qs[_0x9a37('0x39')](_0x3005a5[_0x9a37('0x35')][_0x9a37('0x39')]));_0x4277ed[_0x9a37('0x37')]=_0x4277ed[_0x9a37('0x37')]['length']?_0x4277ed['attributes']:_0x16e16a[_0x9a37('0x32')];if(_0x3005a5[_0x9a37('0x35')][_0x9a37('0x45')]){_0x4277ed[_0x9a37('0x4b')]=[{'all':!![]}];}_0x4277ed=_[_0x9a37('0x42')]({},_0x4277ed,_0x3005a5['options']);return db[_0x9a37('0x2e')][_0x9a37('0x4c')](_0x4277ed)[_0x9a37('0x27')](handleEntityNotFound(_0x5c9321,null))[_0x9a37('0x27')](respondWithResult(_0x5c9321,null))['catch'](handleError(_0x5c9321,null));};exports[_0x9a37('0x4d')]=function(_0x336824,_0x100ba5,_0x2b7c33){return db[_0x9a37('0x2e')]['find']({'where':{'id':_0x336824['params']['id']},'attributes':[_0x9a37('0x33'),'save_name',_0x9a37('0x4e')],'raw':!![]})[_0x9a37('0x27')](handleEntityNotFound(_0x100ba5,null))[_0x9a37('0x27')](function(_0x1182ec){if(_0x1182ec){if(!fs[_0x9a37('0x4f')](path[_0x9a37('0x50')](config['root'],_0x9a37('0x51'),_0x1182ec[_0x9a37('0x52')]+'.'+_0x1182ec['converted_format']))){throw new db[(_0x9a37('0x53'))][(_0x9a37('0x54'))](_0x9a37('0x55'));}return _0x100ba5[_0x9a37('0x4d')](path[_0x9a37('0x50')](config['root'],_0x9a37('0x51'),util[_0x9a37('0x56')](_0x9a37('0x57'),_0x1182ec[_0x9a37('0x52')],_0x1182ec['converted_format'])),util[_0x9a37('0x56')](_0x9a37('0x57'),_0x1182ec[_0x9a37('0x33')],_0x1182ec[_0x9a37('0x4e')]));}return null;})[_0x9a37('0x48')](handleError(_0x100ba5,null));};exports[_0x9a37('0x58')]=function(_0x33e957,_0x11e5c3,_0x3a6f83){var _0x52befc={'name':path[_0x9a37('0x59')](_0x33e957[_0x9a37('0x5a')][_0x9a37('0x5b')],path[_0x9a37('0x5c')](_0x33e957[_0x9a37('0x5a')][_0x9a37('0x5b')])),'save_name':path[_0x9a37('0x59')](_0x33e957['file'][_0x9a37('0x5d')],path[_0x9a37('0x5c')](_0x33e957['file'][_0x9a37('0x5d')])),'original_format':path[_0x9a37('0x5c')](_0x33e957[_0x9a37('0x5a')]['originalname'])['substring'](0x1),'converted_format':_0x9a37('0x5e')};var _0x3547b9=path['join'](config[_0x9a37('0x5f')],_0x9a37('0x60'),_0x33e957[_0x9a37('0x5a')][_0x9a37('0x5d')]);var _0x52fb77=path[_0x9a37('0x50')](config['root'],_0x9a37('0x51'),util[_0x9a37('0x56')](_0x9a37('0x57'),path['basename'](_0x33e957[_0x9a37('0x5a')][_0x9a37('0x5d')],path['extname'](_0x33e957[_0x9a37('0x5a')]['filename'])),_0x52befc['converted_format']));logger[_0x9a37('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x3547b9);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x52fb77);try{fs['chmodSync'](_0x3547b9,parseInt(_0x9a37('0x62'),0x8));var _0x4ddf75=sox[_0x9a37('0x63')](_0x3547b9,_0x52fb77,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4ddf75['on']('error',function(_0xa6106f){fs['unlinkSync'](_0x3547b9);_0x11e5c3[_0x9a37('0x1b')](0x1f4)[_0x9a37('0x64')](_0xa6106f);});_0x4ddf75['on'](_0x9a37('0x65'),function(_0x1e35a0){_0x52befc[_0x9a37('0x66')]=isNaN(_0x1e35a0['duration'])?null:_0x1e35a0[_0x9a37('0x67')]*0x3e8;_0x52befc[_0x9a37('0x68')]=isNaN(_0x1e35a0['sampleCount'])?null:_0x1e35a0[_0x9a37('0x69')];_0x52befc['original_channelCount']=isNaN(_0x1e35a0[_0x9a37('0x6a')])?null:_0x1e35a0[_0x9a37('0x6a')];_0x52befc[_0x9a37('0x6b')]=isNaN(_0x1e35a0[_0x9a37('0x6c')])?null:_0x1e35a0['bitRate'];_0x52befc['original_sampleRate']=isNaN(_0x1e35a0[_0x9a37('0x6d')])?null:_0x1e35a0[_0x9a37('0x6d')];});_0x4ddf75['on'](_0x9a37('0x6e'),function(_0x952ad3){_0x52befc[_0x9a37('0x6f')]=isNaN(_0x952ad3[_0x9a37('0x67')])?null:_0x952ad3[_0x9a37('0x67')]*0x3e8;_0x52befc['converted_sampleCount']=isNaN(_0x952ad3[_0x9a37('0x69')])?null:_0x952ad3[_0x9a37('0x69')];_0x52befc[_0x9a37('0x70')]=isNaN(_0x952ad3[_0x9a37('0x6a')])?null:_0x952ad3[_0x9a37('0x6a')];_0x52befc[_0x9a37('0x71')]=isNaN(_0x952ad3[_0x9a37('0x6c')])?null:_0x952ad3['bitRate'];_0x52befc[_0x9a37('0x72')]=isNaN(_0x952ad3['sampleRate'])?null:_0x952ad3[_0x9a37('0x6d')];});_0x4ddf75['on']('end',function(){fs[_0x9a37('0x73')](_0x52fb77,parseInt('0777',0x8));return db['Sound']['create'](_0x52befc)[_0x9a37('0x27')](function(_0x18b9f6){var _0x473549={'role':_0x33e957[_0x9a37('0x74')][_0x9a37('0x75')],'userProfileId':_0x33e957[_0x9a37('0x74')][_0x9a37('0x76')]};if(!_0x473549)throw new Error(_0x9a37('0x77'));if(_0x473549[_0x9a37('0x75')]==='user'){var _0x29066d=_0x18b9f6[_0x9a37('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x9a37('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x473549[_0x9a37('0x76')]},'raw':!![]})['then'](function(_0x559276){if(_0x559276&&_0x559276['autoAssociation']===0x0){return db[_0x9a37('0x2b')][_0x9a37('0x58')]({'name':_0x29066d[_0x9a37('0x33')],'resourceId':_0x29066d['id'],'type':_0x559276[_0x9a37('0x33')],'sectionId':_0x559276['id']},{})[_0x9a37('0x27')](function(){return _0x18b9f6;});}else{return _0x18b9f6;}})[_0x9a37('0x48')](function(_0x5357d3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5357d3);throw _0x5357d3;});}return _0x18b9f6;})[_0x9a37('0x27')](respondWithResult(_0x11e5c3,null))['catch'](handleError(_0x11e5c3,null));});_0x4ddf75[_0x9a37('0x78')]();}catch(_0x5d0b28){_0x11e5c3[_0x9a37('0x1b')](0x1f4)[_0x9a37('0x64')](_0x5d0b28);}};exports[_0x9a37('0x26')]=function(_0x420431,_0x5e94ca,_0x46e0d0){return db[_0x9a37('0x2e')][_0x9a37('0x4c')]({'where':{'id':_0x420431[_0x9a37('0x4a')]['id']}})[_0x9a37('0x27')](handleEntityNotFound(_0x5e94ca,null))['then'](saveUpdates(_[_0x9a37('0x40')](_0x420431[_0x9a37('0x74')],[_0x9a37('0x33'),_0x9a37('0x79')]),null))[_0x9a37('0x27')](respondWithResult(_0x5e94ca,null))[_0x9a37('0x48')](handleError(_0x5e94ca,null));};exports['delete']=function(_0x48e927,_0x4e72ef,_0x4db1da){return db['Sound'][_0x9a37('0x4c')]({'where':{'id':_0x48e927[_0x9a37('0x4a')]['id']}})[_0x9a37('0x27')](function(_0x4b97d0){if(_0x4b97d0){return _0x4b97d0['destroy']();}})[_0x9a37('0x27')](function(_0x35b906){var _0x3a9ec5=path[_0x9a37('0x50')](config[_0x9a37('0x5f')],_0x9a37('0x60'),util[_0x9a37('0x56')](_0x9a37('0x57'),_0x35b906[_0x9a37('0x52')],_0x35b906[_0x9a37('0x7a')]));var _0x3acd02=path[_0x9a37('0x50')](config[_0x9a37('0x5f')],_0x9a37('0x51'),util[_0x9a37('0x56')](_0x9a37('0x57'),_0x35b906['save_name'],_0x35b906['converted_format']));fs['unlinkSync'](_0x3a9ec5);fs[_0x9a37('0x7b')](_0x3acd02);return _0x35b906;})[_0x9a37('0x27')](function(_0x284f85){if(_0x284f85){return _0x4e72ef[_0x9a37('0x1b')](0xcc)[_0x9a37('0x1c')]();}})[_0x9a37('0x27')](handleEntityNotFound(_0x4e72ef,null))[_0x9a37('0x48')](handleError(_0x4e72ef,null));}; \ No newline at end of file +var _0x8f87=['info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','0777','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Sounds','end','error','name','index','map','Sound','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original'];(function(_0x378680,_0x1fdee0){var _0x1b35cd=function(_0x4d0a8c){while(--_0x4d0a8c){_0x378680['push'](_0x378680['shift']());}};_0x1b35cd(++_0x1fdee0);}(_0x8f87,0x99));var _0x78f8=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x8f87[_0x14a0a0];return _0x56b651;};'use strict';var emlformat=require(_0x78f8('0x0'));var rimraf=require(_0x78f8('0x1'));var zipdir=require(_0x78f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78f8('0x3'));var moment=require('moment');var BPromise=require(_0x78f8('0x4'));var Mustache=require('mustache');var util=require(_0x78f8('0x5'));var path=require(_0x78f8('0x6'));var sox=require(_0x78f8('0x7'));var csv=require('to-csv');var ejs=require(_0x78f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x78f8('0x9'));var squel=require(_0x78f8('0xa'));var crypto=require(_0x78f8('0xb'));var jsforce=require(_0x78f8('0xc'));var deskjs=require(_0x78f8('0xd'));var toCsv=require(_0x78f8('0xe'));var querystring=require('querystring');var Papa=require(_0x78f8('0xf'));var Redis=require(_0x78f8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x78f8('0x11'));var as=require(_0x78f8('0x12'));var hardwareService=require(_0x78f8('0x13'));var logger=require('../../config/logger')(_0x78f8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x78f8('0x15'));var db=require(_0x78f8('0x16'))['db'];function respondWithStatusCode(_0x4d38dc,_0x3c7215){_0x3c7215=_0x3c7215||0xcc;return function(_0x2bd61d){if(_0x2bd61d){return _0x4d38dc[_0x78f8('0x17')](_0x3c7215);}return _0x4d38dc[_0x78f8('0x18')](_0x3c7215)['end']();};}function respondWithResult(_0xcb2bc7,_0x5585a1){_0x5585a1=_0x5585a1||0xc8;return function(_0xd9f030){if(_0xd9f030){return _0xcb2bc7[_0x78f8('0x18')](_0x5585a1)['json'](_0xd9f030);}};}function respondWithFilteredResult(_0x9c3423,_0xf0fb6a){return function(_0x2db3ff){if(_0x2db3ff){var _0xdeead1=typeof _0xf0fb6a[_0x78f8('0x19')]===_0x78f8('0x1a')&&typeof _0xf0fb6a[_0x78f8('0x1b')]===_0x78f8('0x1a');var _0x5c4e63=_0x2db3ff[_0x78f8('0x1c')];var _0x1bf45e=_0xdeead1?0x0:_0xf0fb6a[_0x78f8('0x19')];var _0x3007b3=_0xdeead1?_0x2db3ff[_0x78f8('0x1c')]:_0xf0fb6a[_0x78f8('0x19')]+_0xf0fb6a['limit'];var _0x195312;if(_0x3007b3>=_0x5c4e63){_0x3007b3=_0x5c4e63;_0x195312=0xc8;}else{_0x195312=0xce;}_0x9c3423['status'](_0x195312);return _0x9c3423[_0x78f8('0x1d')]('Content-Range',_0x1bf45e+'-'+_0x3007b3+'/'+_0x5c4e63)['json'](_0x2db3ff);}return null;};}function patchUpdates(_0x228e7c){return function(_0xe6ae60){try{jsonpatch[_0x78f8('0x1e')](_0xe6ae60,_0x228e7c,!![]);}catch(_0x1ba59d){return BPromise[_0x78f8('0x1f')](_0x1ba59d);}return _0xe6ae60[_0x78f8('0x20')]();};}function saveUpdates(_0x52bd5d,_0x28e9f7){return function(_0xcebd08){if(_0xcebd08){return _0xcebd08[_0x78f8('0x21')](_0x52bd5d)[_0x78f8('0x22')](function(_0x240012){return _0x240012;});}return null;};}function removeEntity(_0x5dba90,_0x4a954e){return function(_0x551cce){if(_0x551cce){return _0x551cce[_0x78f8('0x23')]()['then'](function(){var _0x23b66c=_0x551cce['get']({'plain':!![]});var _0x3125b2=_0x78f8('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x3125b2,'resourceId':_0x23b66c['id']}})[_0x78f8('0x22')](function(){return _0x551cce;});})['then'](function(){_0x5dba90['status'](0xcc)[_0x78f8('0x25')]();});}};}function handleEntityNotFound(_0x5738e7,_0x3197ab){return function(_0x5af7aa){if(!_0x5af7aa){_0x5738e7['sendStatus'](0x194);}return _0x5af7aa;};}function handleError(_0x137963,_0x52808d){_0x52808d=_0x52808d||0x1f4;return function(_0x53ca5e){logger[_0x78f8('0x26')](_0x53ca5e['stack']);if(_0x53ca5e[_0x78f8('0x27')]){delete _0x53ca5e[_0x78f8('0x27')];}_0x137963[_0x78f8('0x18')](_0x52808d)['send'](_0x53ca5e);};}exports[_0x78f8('0x28')]=function(_0x58fa60,_0x3c70b0){var _0xb9f5eb={},_0x2256b1={},_0x11ddcc={'count':0x0,'rows':[]};var _0xa0ca20=_[_0x78f8('0x29')](db[_0x78f8('0x2a')]['rawAttributes'],function(_0x3cc83e){return{'name':_0x3cc83e[_0x78f8('0x2b')],'type':_0x3cc83e[_0x78f8('0x2c')]['key']};});_0x2256b1[_0x78f8('0x2d')]=_[_0x78f8('0x29')](_0xa0ca20,_0x78f8('0x27'));_0x2256b1[_0x78f8('0x2e')]=_['keys'](_0x58fa60['query']);_0x2256b1[_0x78f8('0x2f')]=_[_0x78f8('0x30')](_0x2256b1[_0x78f8('0x2d')],_0x2256b1[_0x78f8('0x2e')]);_0xb9f5eb[_0x78f8('0x31')]=_[_0x78f8('0x30')](_0x2256b1[_0x78f8('0x2d')],qs[_0x78f8('0x32')](_0x58fa60[_0x78f8('0x2e')]['fields']));_0xb9f5eb['attributes']=_0xb9f5eb[_0x78f8('0x31')]['length']?_0xb9f5eb[_0x78f8('0x31')]:_0x2256b1[_0x78f8('0x2d')];if(!_0x58fa60['query'][_0x78f8('0x33')]('nolimit')){_0xb9f5eb['limit']=qs[_0x78f8('0x1b')](_0x58fa60[_0x78f8('0x2e')][_0x78f8('0x1b')]);_0xb9f5eb[_0x78f8('0x19')]=qs[_0x78f8('0x19')](_0x58fa60[_0x78f8('0x2e')][_0x78f8('0x19')]);}_0xb9f5eb[_0x78f8('0x34')]=qs[_0x78f8('0x35')](_0x58fa60[_0x78f8('0x2e')][_0x78f8('0x35')]);_0xb9f5eb[_0x78f8('0x36')]=qs[_0x78f8('0x2f')](_[_0x78f8('0x37')](_0x58fa60['query'],_0x2256b1['filters']),_0xa0ca20);if(_0x58fa60['query'][_0x78f8('0x38')]){_0xb9f5eb['where']=_[_0x78f8('0x39')](_0xb9f5eb['where'],{'$or':_[_0x78f8('0x29')](_0xa0ca20,function(_0x3e81a9){if(_0x3e81a9[_0x78f8('0x2c')]!=='VIRTUAL'){var _0x7fa396={};_0x7fa396[_0x3e81a9['name']]={'$like':'%'+_0x58fa60[_0x78f8('0x2e')]['filter']+'%'};return _0x7fa396;}})});}_0xb9f5eb=_[_0x78f8('0x39')]({},_0xb9f5eb,_0x58fa60[_0x78f8('0x3a')]);var _0x14d945={'where':_0xb9f5eb['where']};return db[_0x78f8('0x2a')][_0x78f8('0x1c')](_0x14d945)['then'](function(_0x2ebc6d){_0x11ddcc[_0x78f8('0x1c')]=_0x2ebc6d;if(_0x58fa60[_0x78f8('0x2e')][_0x78f8('0x3b')]){_0xb9f5eb[_0x78f8('0x3c')]=[{'all':!![]}];}return db['Sound'][_0x78f8('0x3d')](_0xb9f5eb);})[_0x78f8('0x22')](function(_0x3d51d2){_0x11ddcc[_0x78f8('0x3e')]=_0x3d51d2;return _0x11ddcc;})[_0x78f8('0x22')](respondWithFilteredResult(_0x3c70b0,_0xb9f5eb))[_0x78f8('0x3f')](handleError(_0x3c70b0,null));};exports[_0x78f8('0x40')]=function(_0x5f1a66,_0x26f2a5){var _0x46efb6={'raw':!![],'where':{'id':_0x5f1a66[_0x78f8('0x41')]['id']}},_0x1b6c01={};_0x1b6c01['model']=_[_0x78f8('0x42')](db[_0x78f8('0x2a')][_0x78f8('0x43')]);_0x1b6c01[_0x78f8('0x2e')]=_[_0x78f8('0x42')](_0x5f1a66[_0x78f8('0x2e')]);_0x1b6c01['filters']=_[_0x78f8('0x30')](_0x1b6c01[_0x78f8('0x2d')],_0x1b6c01[_0x78f8('0x2e')]);_0x46efb6[_0x78f8('0x31')]=_[_0x78f8('0x30')](_0x1b6c01['model'],qs[_0x78f8('0x32')](_0x5f1a66['query']['fields']));_0x46efb6[_0x78f8('0x31')]=_0x46efb6[_0x78f8('0x31')][_0x78f8('0x44')]?_0x46efb6[_0x78f8('0x31')]:_0x1b6c01[_0x78f8('0x2d')];if(_0x5f1a66[_0x78f8('0x2e')]['includeAll']){_0x46efb6['include']=[{'all':!![]}];}_0x46efb6=_[_0x78f8('0x39')]({},_0x46efb6,_0x5f1a66['options']);return db[_0x78f8('0x2a')][_0x78f8('0x45')](_0x46efb6)[_0x78f8('0x22')](handleEntityNotFound(_0x26f2a5,null))[_0x78f8('0x22')](respondWithResult(_0x26f2a5,null))[_0x78f8('0x3f')](handleError(_0x26f2a5,null));};exports[_0x78f8('0x46')]=function(_0x3dbe00,_0x2468f6,_0xdcd70a){return db[_0x78f8('0x2a')][_0x78f8('0x45')]({'where':{'id':_0x3dbe00[_0x78f8('0x41')]['id']},'attributes':[_0x78f8('0x27'),'save_name',_0x78f8('0x47')],'raw':!![]})[_0x78f8('0x22')](handleEntityNotFound(_0x2468f6,null))['then'](function(_0x436812){if(_0x436812){if(!fs[_0x78f8('0x48')](path[_0x78f8('0x49')](config[_0x78f8('0x4a')],_0x78f8('0x4b'),_0x436812[_0x78f8('0x4c')]+'.'+_0x436812[_0x78f8('0x47')]))){throw new db[(_0x78f8('0x4d'))]['ValidationError']('Sound\x20not\x20found');}return _0x2468f6[_0x78f8('0x46')](path['join'](config[_0x78f8('0x4a')],_0x78f8('0x4b'),util[_0x78f8('0x4e')]('%s.%s',_0x436812[_0x78f8('0x4c')],_0x436812[_0x78f8('0x47')])),util[_0x78f8('0x4e')](_0x78f8('0x4f'),_0x436812['name'],_0x436812[_0x78f8('0x47')]));}return null;})['catch'](handleError(_0x2468f6,null));};exports[_0x78f8('0x50')]=function(_0x44116b,_0x594580,_0x27f5f4){var _0x2eaf1a={'name':path['basename'](_0x44116b[_0x78f8('0x51')][_0x78f8('0x52')],path[_0x78f8('0x53')](_0x44116b[_0x78f8('0x51')][_0x78f8('0x52')])),'save_name':path[_0x78f8('0x54')](_0x44116b[_0x78f8('0x51')][_0x78f8('0x55')],path[_0x78f8('0x53')](_0x44116b[_0x78f8('0x51')]['filename'])),'original_format':path[_0x78f8('0x53')](_0x44116b[_0x78f8('0x51')][_0x78f8('0x52')])[_0x78f8('0x56')](0x1),'converted_format':_0x78f8('0x57')};var _0x2a3a0b=path[_0x78f8('0x49')](config[_0x78f8('0x4a')],_0x78f8('0x58'),_0x44116b[_0x78f8('0x51')][_0x78f8('0x55')]);var _0x3830f8=path[_0x78f8('0x49')](config[_0x78f8('0x4a')],_0x78f8('0x4b'),util[_0x78f8('0x4e')](_0x78f8('0x4f'),path['basename'](_0x44116b[_0x78f8('0x51')][_0x78f8('0x55')],path[_0x78f8('0x53')](_0x44116b[_0x78f8('0x51')][_0x78f8('0x55')])),_0x2eaf1a[_0x78f8('0x47')]));logger[_0x78f8('0x59')](_0x78f8('0x5a'),_0x2a3a0b);logger['info'](_0x78f8('0x5b'),_0x3830f8);try{fs['chmodSync'](_0x2a3a0b,parseInt('0777',0x8));var _0x45cf1f=sox[_0x78f8('0x5c')](_0x2a3a0b,_0x3830f8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45cf1f['on'](_0x78f8('0x26'),function(_0x3a14a9){fs[_0x78f8('0x5d')](_0x2a3a0b);_0x594580[_0x78f8('0x18')](0x1f4)[_0x78f8('0x5e')](_0x3a14a9);});_0x45cf1f['on'](_0x78f8('0x5f'),function(_0x2b29c5){_0x2eaf1a['original_duration']=isNaN(_0x2b29c5[_0x78f8('0x60')])?null:_0x2b29c5['duration']*0x3e8;_0x2eaf1a[_0x78f8('0x61')]=isNaN(_0x2b29c5[_0x78f8('0x62')])?null:_0x2b29c5['sampleCount'];_0x2eaf1a[_0x78f8('0x63')]=isNaN(_0x2b29c5[_0x78f8('0x64')])?null:_0x2b29c5[_0x78f8('0x64')];_0x2eaf1a[_0x78f8('0x65')]=isNaN(_0x2b29c5['bitRate'])?null:_0x2b29c5[_0x78f8('0x66')];_0x2eaf1a[_0x78f8('0x67')]=isNaN(_0x2b29c5[_0x78f8('0x68')])?null:_0x2b29c5['sampleRate'];});_0x45cf1f['on'](_0x78f8('0x69'),function(_0x41670c){_0x2eaf1a[_0x78f8('0x6a')]=isNaN(_0x41670c[_0x78f8('0x60')])?null:_0x41670c[_0x78f8('0x60')]*0x3e8;_0x2eaf1a[_0x78f8('0x6b')]=isNaN(_0x41670c[_0x78f8('0x62')])?null:_0x41670c[_0x78f8('0x62')];_0x2eaf1a['converted_channelCount']=isNaN(_0x41670c[_0x78f8('0x64')])?null:_0x41670c[_0x78f8('0x64')];_0x2eaf1a[_0x78f8('0x6c')]=isNaN(_0x41670c[_0x78f8('0x66')])?null:_0x41670c[_0x78f8('0x66')];_0x2eaf1a[_0x78f8('0x6d')]=isNaN(_0x41670c[_0x78f8('0x68')])?null:_0x41670c[_0x78f8('0x68')];});_0x45cf1f['on']('end',function(){fs[_0x78f8('0x6e')](_0x3830f8,parseInt(_0x78f8('0x6f'),0x8));return db[_0x78f8('0x2a')][_0x78f8('0x50')](_0x2eaf1a)[_0x78f8('0x22')](function(_0x4bd3e3){var _0x1de934={'role':_0x44116b['body'][_0x78f8('0x70')],'userProfileId':_0x44116b[_0x78f8('0x71')][_0x78f8('0x72')]};if(!_0x1de934)throw new Error(_0x78f8('0x73'));if(_0x1de934[_0x78f8('0x70')]===_0x78f8('0x74')){var _0x5c67ed=_0x4bd3e3[_0x78f8('0x75')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x78f8('0x24'),'userProfileId':_0x1de934[_0x78f8('0x72')]},'raw':!![]})[_0x78f8('0x22')](function(_0x1482ed){if(_0x1482ed&&_0x1482ed[_0x78f8('0x76')]===0x0){return db['UserProfileResource'][_0x78f8('0x50')]({'name':_0x5c67ed['name'],'resourceId':_0x5c67ed['id'],'type':_0x1482ed['name'],'sectionId':_0x1482ed['id']},{})[_0x78f8('0x22')](function(){return _0x4bd3e3;});}else{return _0x4bd3e3;}})[_0x78f8('0x3f')](function(_0x416a09){logger['error'](_0x78f8('0x77'),_0x416a09);throw _0x416a09;});}return _0x4bd3e3;})[_0x78f8('0x22')](respondWithResult(_0x594580,null))[_0x78f8('0x3f')](handleError(_0x594580,null));});_0x45cf1f[_0x78f8('0x78')]();}catch(_0x91907){_0x594580['status'](0x1f4)[_0x78f8('0x5e')](_0x91907);}};exports[_0x78f8('0x21')]=function(_0x56b0e5,_0x3d6cf6,_0x2b8afa){return db[_0x78f8('0x2a')][_0x78f8('0x45')]({'where':{'id':_0x56b0e5['params']['id']}})[_0x78f8('0x22')](handleEntityNotFound(_0x3d6cf6,null))['then'](saveUpdates(_['pick'](_0x56b0e5[_0x78f8('0x71')],[_0x78f8('0x27'),'description']),null))[_0x78f8('0x22')](respondWithResult(_0x3d6cf6,null))['catch'](handleError(_0x3d6cf6,null));};exports['delete']=function(_0x317756,_0x4e356f,_0x2b61d2){return db[_0x78f8('0x2a')][_0x78f8('0x45')]({'where':{'id':_0x317756[_0x78f8('0x41')]['id']}})[_0x78f8('0x22')](function(_0x5a3f92){if(_0x5a3f92){return _0x5a3f92[_0x78f8('0x23')]();}})['then'](function(_0x3fdb27){var _0x2bf65a=path['join'](config[_0x78f8('0x4a')],_0x78f8('0x58'),util[_0x78f8('0x4e')](_0x78f8('0x4f'),_0x3fdb27[_0x78f8('0x4c')],_0x3fdb27['original_format']));var _0x5383e8=path[_0x78f8('0x49')](config[_0x78f8('0x4a')],'server/files/sounds/converted',util['format'](_0x78f8('0x4f'),_0x3fdb27[_0x78f8('0x4c')],_0x3fdb27[_0x78f8('0x47')]));fs[_0x78f8('0x5d')](_0x2bf65a);fs[_0x78f8('0x5d')](_0x5383e8);return _0x3fdb27;})['then'](function(_0x42d2b2){if(_0x42d2b2){return _0x4e356f[_0x78f8('0x18')](0xcc)[_0x78f8('0x25')]();}})['then'](handleEntityNotFound(_0x4e356f,null))[_0x78f8('0x3f')](handleError(_0x4e356f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 01baaaf..61384b2 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 _0xe0a5=['api','moment','bluebird','path','rimraf','../../config/environment','./sound.attributes','define','Sound','lodash','util','../../config/logger'];(function(_0x3182f2,_0x242888){var _0x5ed78d=function(_0x1e7274){while(--_0x1e7274){_0x3182f2['push'](_0x3182f2['shift']());}};_0x5ed78d(++_0x242888);}(_0xe0a5,0xd5));var _0x5e0a=function(_0xc2a130,_0x900599){_0xc2a130=_0xc2a130-0x0;var _0x247f87=_0xe0a5[_0xc2a130];return _0x247f87;};'use strict';var _=require(_0x5e0a('0x0'));var util=require(_0x5e0a('0x1'));var logger=require(_0x5e0a('0x2'))(_0x5e0a('0x3'));var moment=require(_0x5e0a('0x4'));var BPromise=require(_0x5e0a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e0a('0x6'));var rimraf=require(_0x5e0a('0x7'));var config=require(_0x5e0a('0x8'));var attributes=require(_0x5e0a('0x9'));module['exports']=function(_0x8c9565,_0x28a44f){return _0x8c9565[_0x5e0a('0xa')](_0x5e0a('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x740c=['Sound','lodash','../../config/logger','api','moment','bluebird','request-promise','./sound.attributes','exports'];(function(_0x1aa90e,_0x84a9a0){var _0x2a34cc=function(_0x53273d){while(--_0x53273d){_0x1aa90e['push'](_0x1aa90e['shift']());}};_0x2a34cc(++_0x84a9a0);}(_0x740c,0xbe));var _0xc740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc740('0x0'));var util=require('util');var logger=require(_0xc740('0x1'))(_0xc740('0x2'));var moment=require(_0xc740('0x3'));var BPromise=require(_0xc740('0x4'));var rp=require(_0xc740('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc740('0x6'));module[_0xc740('0x7')]=function(_0xa6029f,_0x102052){return _0xa6029f['define'](_0xc740('0x8'),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 ca796e2..c439b46 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 _0xfce7=['stringify','error','code','message','result','catch','find','options','raw','where','attributes','include','map','model','then','info','ShowSound','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xfce7,0x171));var _0x7fce=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0xfce7[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x7fce('0x0'));var util=require('util');var moment=require(_0x7fce('0x1'));var BPromise=require(_0x7fce('0x2'));var rs=require(_0x7fce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fce('0x4'))['db'];var utils=require(_0x7fce('0x5'));var logger=require(_0x7fce('0x6'))(_0x7fce('0x7'));var config=require(_0x7fce('0x8'));var jayson=require(_0x7fce('0x9'));var client=jayson['client'][_0x7fce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3efde8,_0x4925c2,_0x454815){return new BPromise(function(_0xb2096f,_0x2cfe0b){return client['request'](_0x3efde8,_0x454815)['then'](function(_0x466ef8){logger['info'](_0x7fce('0xb'),_0x4925c2,_0x7fce('0xc'));logger[_0x7fce('0xd')](_0x7fce('0xe'),_0x4925c2,_0x7fce('0xc'),JSON[_0x7fce('0xf')](_0x466ef8));if(_0x466ef8[_0x7fce('0x10')]){if(_0x466ef8['error'][_0x7fce('0x11')]===0x1f4){logger[_0x7fce('0x10')](_0x7fce('0xb'),_0x4925c2,_0x466ef8['error'][_0x7fce('0x12')]);return _0x2cfe0b(_0x466ef8['error'][_0x7fce('0x12')]);}logger[_0x7fce('0x10')](_0x7fce('0xb'),_0x4925c2,_0x466ef8['error'][_0x7fce('0x12')]);return _0xb2096f(_0x466ef8['error']['message']);}else{logger['info'](_0x7fce('0xb'),_0x4925c2,'request\x20sent');_0xb2096f(_0x466ef8[_0x7fce('0x13')][_0x7fce('0x12')]);}})[_0x7fce('0x14')](function(_0x2164fb){logger[_0x7fce('0x10')]('Sound,\x20%s,\x20%s',_0x4925c2,_0x2164fb);_0x2cfe0b(_0x2164fb);});});}exports['ShowSound']=function(_0x112c98){var _0x4deff1=this;return new Promise(function(_0x11faea,_0x1d5a76){return db['Sound'][_0x7fce('0x15')]({'raw':_0x112c98[_0x7fce('0x16')]?_0x112c98[_0x7fce('0x16')][_0x7fce('0x17')]===undefined?!![]:![]:!![],'where':_0x112c98[_0x7fce('0x16')]?_0x112c98[_0x7fce('0x16')][_0x7fce('0x18')]||null:null,'attributes':_0x112c98[_0x7fce('0x16')]?_0x112c98['options'][_0x7fce('0x19')]||null:null,'include':_0x112c98[_0x7fce('0x16')]?_0x112c98[_0x7fce('0x16')][_0x7fce('0x1a')]?_['map'](_0x112c98[_0x7fce('0x16')]['include'],function(_0x39c7e0){return{'model':db[_0x39c7e0['model']],'as':_0x39c7e0['as'],'attributes':_0x39c7e0[_0x7fce('0x19')],'include':_0x39c7e0[_0x7fce('0x1a')]?_[_0x7fce('0x1b')](_0x39c7e0[_0x7fce('0x1a')],function(_0x5d4680){return{'model':db[_0x5d4680[_0x7fce('0x1c')]],'as':_0x5d4680['as'],'attributes':_0x5d4680[_0x7fce('0x19')],'include':_0x5d4680[_0x7fce('0x1a')]?_[_0x7fce('0x1b')](_0x5d4680[_0x7fce('0x1a')],function(_0x219e49){return{'model':db[_0x219e49[_0x7fce('0x1c')]],'as':_0x219e49['as'],'attributes':_0x219e49[_0x7fce('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7fce('0x1d')](function(_0x3c935a){logger[_0x7fce('0x1e')](_0x7fce('0x1f'),_0x112c98);logger[_0x7fce('0xd')](_0x7fce('0x1f'),_0x112c98,JSON[_0x7fce('0xf')](_0x3c935a));_0x11faea(_0x3c935a);})['catch'](function(_0x10a61e){logger['error'](_0x7fce('0x1f'),_0x10a61e['message'],_0x112c98);_0x1d5a76(_0x4deff1['error'](0x1f4,_0x10a61e[_0x7fce('0x12')]));});});}; \ No newline at end of file +var _0xa9a4=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','lodash','moment'];(function(_0x3f9318,_0x3c45a7){var _0x3f4a1b=function(_0x29ebaf){while(--_0x29ebaf){_0x3f9318['push'](_0x3f9318['shift']());}};_0x3f4a1b(++_0x3c45a7);}(_0xa9a4,0x1a2));var _0x4a9a=function(_0x4251f6,_0xf0c67c){_0x4251f6=_0x4251f6-0x0;var _0x124e90=_0xa9a4[_0x4251f6];return _0x124e90;};'use strict';var _=require(_0x4a9a('0x0'));var util=require('util');var moment=require(_0x4a9a('0x1'));var BPromise=require(_0x4a9a('0x2'));var rs=require(_0x4a9a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a9a('0x4'))['db'];var utils=require(_0x4a9a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a9a('0x6'));var jayson=require(_0x4a9a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52dd59,_0x2bb9df,_0x3fa2e1){return new BPromise(function(_0x47bf42,_0x4e2348){return client[_0x4a9a('0x8')](_0x52dd59,_0x3fa2e1)[_0x4a9a('0x9')](function(_0x193c6e){logger[_0x4a9a('0xa')]('Sound,\x20%s,\x20%s',_0x2bb9df,'request\x20sent');logger[_0x4a9a('0xb')](_0x4a9a('0xc'),_0x2bb9df,_0x4a9a('0xd'),JSON[_0x4a9a('0xe')](_0x193c6e));if(_0x193c6e[_0x4a9a('0xf')]){if(_0x193c6e[_0x4a9a('0xf')]['code']===0x1f4){logger[_0x4a9a('0xf')](_0x4a9a('0x10'),_0x2bb9df,_0x193c6e[_0x4a9a('0xf')][_0x4a9a('0x11')]);return _0x4e2348(_0x193c6e[_0x4a9a('0xf')][_0x4a9a('0x11')]);}logger[_0x4a9a('0xf')](_0x4a9a('0x10'),_0x2bb9df,_0x193c6e[_0x4a9a('0xf')][_0x4a9a('0x11')]);return _0x47bf42(_0x193c6e[_0x4a9a('0xf')][_0x4a9a('0x11')]);}else{logger[_0x4a9a('0xa')](_0x4a9a('0x10'),_0x2bb9df,_0x4a9a('0xd'));_0x47bf42(_0x193c6e[_0x4a9a('0x12')][_0x4a9a('0x11')]);}})[_0x4a9a('0x13')](function(_0x41c6e5){logger['error'](_0x4a9a('0x10'),_0x2bb9df,_0x41c6e5);_0x4e2348(_0x41c6e5);});});}exports[_0x4a9a('0x14')]=function(_0x1369f1){var _0x529628=this;return new Promise(function(_0x1eb875,_0xe2aa97){return db[_0x4a9a('0x15')][_0x4a9a('0x16')]({'raw':_0x1369f1[_0x4a9a('0x17')]?_0x1369f1['options'][_0x4a9a('0x18')]===undefined?!![]:![]:!![],'where':_0x1369f1[_0x4a9a('0x17')]?_0x1369f1[_0x4a9a('0x17')][_0x4a9a('0x19')]||null:null,'attributes':_0x1369f1[_0x4a9a('0x17')]?_0x1369f1[_0x4a9a('0x17')][_0x4a9a('0x1a')]||null:null,'include':_0x1369f1[_0x4a9a('0x17')]?_0x1369f1['options']['include']?_[_0x4a9a('0x1b')](_0x1369f1['options'][_0x4a9a('0x1c')],function(_0x3dc18b){return{'model':db[_0x3dc18b[_0x4a9a('0x1d')]],'as':_0x3dc18b['as'],'attributes':_0x3dc18b['attributes'],'include':_0x3dc18b[_0x4a9a('0x1c')]?_[_0x4a9a('0x1b')](_0x3dc18b['include'],function(_0x376a21){return{'model':db[_0x376a21[_0x4a9a('0x1d')]],'as':_0x376a21['as'],'attributes':_0x376a21[_0x4a9a('0x1a')],'include':_0x376a21[_0x4a9a('0x1c')]?_[_0x4a9a('0x1b')](_0x376a21[_0x4a9a('0x1c')],function(_0x4f164b){return{'model':db[_0x4f164b[_0x4a9a('0x1d')]],'as':_0x4f164b['as'],'attributes':_0x4f164b[_0x4a9a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4a9a('0x9')](function(_0x35bf80){logger['info'](_0x4a9a('0x14'),_0x1369f1);logger[_0x4a9a('0xb')](_0x4a9a('0x14'),_0x1369f1,JSON[_0x4a9a('0xe')](_0x35bf80));_0x1eb875(_0x35bf80);})[_0x4a9a('0x13')](function(_0x29ff3e){logger[_0x4a9a('0xf')]('ShowSound',_0x29ff3e[_0x4a9a('0x11')],_0x1369f1);_0xe2aa97(_0x529628[_0x4a9a('0xf')](0x1f4,_0x29ff3e[_0x4a9a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e847ccd..6e5007d 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x335d63,_0x5d8378){var _0x49bcda=function(_0x4b3ea4){while(--_0x4b3ea4){_0x335d63['push'](_0x335d63['shift']());}};_0x49bcda(++_0x5d8378);}(_0x0b0e,0x187));var _0xe0b0=function(_0x49b984,_0x387c83){_0x49b984=_0x49b984-0x0;var _0x49d1e0=_0x0b0e[_0x49b984];return _0x49d1e0;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x581feb,_0x475a85){var _0x29fe1a=function(_0x34b44d){while(--_0x34b44d){_0x581feb['push'](_0x581feb['shift']());}};_0x29fe1a(++_0x475a85);}(_0xda2d,0x102));var _0xdda2=function(_0x305ac0,_0x5c85af){_0x305ac0=_0x305ac0-0x0;var _0x1c7230=_0xda2d[_0x305ac0];return _0x1c7230;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9dbc044..b6e7bb3 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 _0x6d4d=['ENUM','out','exports','STRING','TEXT','medium'];(function(_0x3ff3cc,_0x19e197){var _0x52c95a=function(_0x4264bf){while(--_0x4264bf){_0x3ff3cc['push'](_0x3ff3cc['shift']());}};_0x52c95a(++_0x19e197);}(_0x6d4d,0x15e));var _0xd6d4=function(_0x3a936c,_0x5c8756){_0x3a936c=_0x3a936c-0x0;var _0x222953=_0x6d4d[_0x3a936c];return _0x222953;};'use strict';var Sequelize=require('sequelize');module[_0xd6d4('0x0')]={'uniqueid':{'type':Sequelize[_0xd6d4('0x1')]},'body':{'type':Sequelize[_0xd6d4('0x2')](_0xd6d4('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xd6d4('0x4')]('in',_0xd6d4('0x5')),'defaultValue':_0xd6d4('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd6d4('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfd0c=['TEXT','ENUM','out','exports','STRING'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xfd0c,0x8f));var _0xcfd0=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0xfd0c[_0x67b075];return _0x39d030;};'use strict';var Sequelize=require('sequelize');module[_0xcfd0('0x0')]={'uniqueid':{'type':Sequelize[_0xcfd0('0x1')]},'body':{'type':Sequelize[_0xcfd0('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xcfd0('0x3')]('in','out'),'defaultValue':_0xcfd0('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xcfd0('0x1')]},'providerResponse':{'type':Sequelize[_0xcfd0('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a22000a..c22ec23 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 _0xc26e=['offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','include','rows','catch','show','params','options','create','body','find','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json'];(function(_0x4dadc8,_0x356056){var _0x62cf92=function(_0x1838be){while(--_0x1838be){_0x4dadc8['push'](_0x4dadc8['shift']());}};_0x62cf92(++_0x356056);}(_0xc26e,0x103));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec26('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec26('0x1'));var moment=require(_0xec26('0x2'));var BPromise=require(_0xec26('0x3'));var Mustache=require(_0xec26('0x4'));var util=require('util');var path=require(_0xec26('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xec26('0x6'));var fs=require('fs');var fs_extra=require(_0xec26('0x7'));var _=require(_0xec26('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec26('0x9'));var deskjs=require(_0xec26('0xa'));var toCsv=require(_0xec26('0xb'));var querystring=require(_0xec26('0xc'));var Papa=require(_0xec26('0xd'));var Redis=require(_0xec26('0xe'));var authService=require(_0xec26('0xf'));var qs=require(_0xec26('0x10'));var as=require(_0xec26('0x11'));var hardwareService=require(_0xec26('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xec26('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xec26('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ad16,_0x545660){_0x545660=_0x545660||0xcc;return function(_0x43db74){if(_0x43db74){return _0x59ad16[_0xec26('0x15')](_0x545660);}return _0x59ad16[_0xec26('0x16')](_0x545660)[_0xec26('0x17')]();};}function respondWithResult(_0x172448,_0x3b5ce0){_0x3b5ce0=_0x3b5ce0||0xc8;return function(_0x60c4f7){if(_0x60c4f7){return _0x172448['status'](_0x3b5ce0)[_0xec26('0x18')](_0x60c4f7);}};}function respondWithFilteredResult(_0x58cdaf,_0x1e31d4){return function(_0x34e328){if(_0x34e328){var _0x454b2f=typeof _0x1e31d4[_0xec26('0x19')]===_0xec26('0x1a')&&typeof _0x1e31d4['limit']===_0xec26('0x1a');var _0x2b4d0e=_0x34e328['count'];var _0x1c5fcc=_0x454b2f?0x0:_0x1e31d4[_0xec26('0x19')];var _0x330d56=_0x454b2f?_0x34e328[_0xec26('0x1b')]:_0x1e31d4[_0xec26('0x19')]+_0x1e31d4[_0xec26('0x1c')];var _0x3cd4b4;if(_0x330d56>=_0x2b4d0e){_0x330d56=_0x2b4d0e;_0x3cd4b4=0xc8;}else{_0x3cd4b4=0xce;}_0x58cdaf['status'](_0x3cd4b4);return _0x58cdaf[_0xec26('0x1d')](_0xec26('0x1e'),_0x1c5fcc+'-'+_0x330d56+'/'+_0x2b4d0e)[_0xec26('0x18')](_0x34e328);}return null;};}function patchUpdates(_0x41d862){return function(_0x5a8f22){try{jsonpatch[_0xec26('0x1f')](_0x5a8f22,_0x41d862,!![]);}catch(_0x36661e){return BPromise['reject'](_0x36661e);}return _0x5a8f22[_0xec26('0x20')]();};}function saveUpdates(_0x5bd11e,_0xb5eb98){return function(_0x3100f9){if(_0x3100f9){return _0x3100f9[_0xec26('0x21')](_0x5bd11e)[_0xec26('0x22')](function(_0x1a102e){return _0x1a102e;});}return null;};}function removeEntity(_0x4b1116,_0x4f88dc){return function(_0x72e561){if(_0x72e561){return _0x72e561[_0xec26('0x23')]()[_0xec26('0x22')](function(){_0x4b1116[_0xec26('0x16')](0xcc)[_0xec26('0x17')]();});}};}function handleEntityNotFound(_0x41eedc,_0x4ad225){return function(_0x4e861c){if(!_0x4e861c){_0x41eedc[_0xec26('0x15')](0x194);}return _0x4e861c;};}function handleError(_0xbbe2fd,_0x39e8b5){_0x39e8b5=_0x39e8b5||0x1f4;return function(_0x5dd9bd){logger[_0xec26('0x24')](_0x5dd9bd[_0xec26('0x25')]);if(_0x5dd9bd['name']){delete _0x5dd9bd[_0xec26('0x26')];}_0xbbe2fd[_0xec26('0x16')](_0x39e8b5)[_0xec26('0x27')](_0x5dd9bd);};}exports[_0xec26('0x28')]=function(_0x4ea3e7,_0x4d73f6){var _0x542ac0={},_0x5c18a2={},_0x3558d4={'count':0x0,'rows':[]};var _0x3a801b=_[_0xec26('0x29')](db[_0xec26('0x2a')][_0xec26('0x2b')],function(_0xbe56c9){return{'name':_0xbe56c9['fieldName'],'type':_0xbe56c9[_0xec26('0x2c')][_0xec26('0x2d')]};});_0x5c18a2[_0xec26('0x2e')]=_['map'](_0x3a801b,_0xec26('0x26'));_0x5c18a2['query']=_[_0xec26('0x2f')](_0x4ea3e7['query']);_0x5c18a2[_0xec26('0x30')]=_[_0xec26('0x31')](_0x5c18a2['model'],_0x5c18a2[_0xec26('0x32')]);_0x542ac0[_0xec26('0x33')]=_[_0xec26('0x31')](_0x5c18a2['model'],qs[_0xec26('0x34')](_0x4ea3e7[_0xec26('0x32')][_0xec26('0x34')]));_0x542ac0['attributes']=_0x542ac0[_0xec26('0x33')][_0xec26('0x35')]?_0x542ac0[_0xec26('0x33')]:_0x5c18a2[_0xec26('0x2e')];if(!_0x4ea3e7[_0xec26('0x32')][_0xec26('0x36')]('nolimit')){_0x542ac0['limit']=qs['limit'](_0x4ea3e7[_0xec26('0x32')][_0xec26('0x1c')]);_0x542ac0[_0xec26('0x19')]=qs[_0xec26('0x19')](_0x4ea3e7[_0xec26('0x32')]['offset']);}_0x542ac0[_0xec26('0x37')]=qs[_0xec26('0x38')](_0x4ea3e7['query'][_0xec26('0x38')]);_0x542ac0['where']=qs[_0xec26('0x30')](_[_0xec26('0x39')](_0x4ea3e7[_0xec26('0x32')],_0x5c18a2[_0xec26('0x30')]),_0x3a801b);if(_0x4ea3e7[_0xec26('0x32')]['filter']){_0x542ac0[_0xec26('0x3a')]=_[_0xec26('0x3b')](_0x542ac0[_0xec26('0x3a')],{'$or':_[_0xec26('0x29')](_0x3a801b,function(_0x4176df){if(_0x4176df[_0xec26('0x2c')]!==_0xec26('0x3c')){var _0x5828b8={};_0x5828b8[_0x4176df[_0xec26('0x26')]]={'$like':'%'+_0x4ea3e7[_0xec26('0x32')][_0xec26('0x3d')]+'%'};return _0x5828b8;}})});}_0x542ac0=_['merge']({},_0x542ac0,_0x4ea3e7['options']);var _0x1a9a4c={'where':_0x542ac0[_0xec26('0x3a')]};return db[_0xec26('0x2a')]['count'](_0x1a9a4c)['then'](function(_0xdd07d5){_0x3558d4[_0xec26('0x1b')]=_0xdd07d5;if(_0x4ea3e7['query']['includeAll']){_0x542ac0[_0xec26('0x3e')]=[{'all':!![]}];}return db[_0xec26('0x2a')]['findAll'](_0x542ac0);})['then'](function(_0x556829){_0x3558d4[_0xec26('0x3f')]=_0x556829;return _0x3558d4;})[_0xec26('0x22')](respondWithFilteredResult(_0x4d73f6,_0x542ac0))[_0xec26('0x40')](handleError(_0x4d73f6,null));};exports[_0xec26('0x41')]=function(_0x2958ff,_0x2847df){var _0xb09551={'raw':!![],'where':{'id':_0x2958ff[_0xec26('0x42')]['id']}},_0x4ea701={};_0x4ea701['model']=_[_0xec26('0x2f')](db[_0xec26('0x2a')][_0xec26('0x2b')]);_0x4ea701[_0xec26('0x32')]=_[_0xec26('0x2f')](_0x2958ff[_0xec26('0x32')]);_0x4ea701[_0xec26('0x30')]=_[_0xec26('0x31')](_0x4ea701[_0xec26('0x2e')],_0x4ea701['query']);_0xb09551[_0xec26('0x33')]=_[_0xec26('0x31')](_0x4ea701[_0xec26('0x2e')],qs[_0xec26('0x34')](_0x2958ff[_0xec26('0x32')]['fields']));_0xb09551[_0xec26('0x33')]=_0xb09551['attributes'][_0xec26('0x35')]?_0xb09551[_0xec26('0x33')]:_0x4ea701[_0xec26('0x2e')];if(_0x2958ff['query']['includeAll']){_0xb09551[_0xec26('0x3e')]=[{'all':!![]}];}_0xb09551=_['merge']({},_0xb09551,_0x2958ff[_0xec26('0x43')]);return db[_0xec26('0x2a')]['find'](_0xb09551)[_0xec26('0x22')](handleEntityNotFound(_0x2847df,null))['then'](respondWithResult(_0x2847df,null))[_0xec26('0x40')](handleError(_0x2847df,null));};exports[_0xec26('0x44')]=function(_0x1b6130,_0x228676){return db[_0xec26('0x2a')][_0xec26('0x44')](_0x1b6130[_0xec26('0x45')],{})['then'](respondWithResult(_0x228676,0xc9))[_0xec26('0x40')](handleError(_0x228676,null));};exports[_0xec26('0x21')]=function(_0x57f472,_0x5b94b3){if(_0x57f472['body']['id']){delete _0x57f472[_0xec26('0x45')]['id'];}return db['SquareMessage'][_0xec26('0x46')]({'where':{'id':_0x57f472[_0xec26('0x42')]['id']}})[_0xec26('0x22')](handleEntityNotFound(_0x5b94b3,null))[_0xec26('0x22')](saveUpdates(_0x57f472[_0xec26('0x45')],null))[_0xec26('0x22')](respondWithResult(_0x5b94b3,null))['catch'](handleError(_0x5b94b3,null));};exports[_0xec26('0x23')]=function(_0x553090,_0x2880c5){return db[_0xec26('0x2a')]['find']({'where':{'id':_0x553090['params']['id']}})['then'](handleEntityNotFound(_0x2880c5,null))[_0xec26('0x22')](removeEntity(_0x2880c5,null))[_0xec26('0x40')](handleError(_0x2880c5,null));}; \ No newline at end of file +var _0x7ebf=['destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','findAll','rows','catch','show','params','fields','include','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','offset','limit','count','status','set','Content-Range','json','apply','reject','update','then'];(function(_0x55f672,_0x5d247a){var _0x35aaee=function(_0x2d2cef){while(--_0x2d2cef){_0x55f672['push'](_0x55f672['shift']());}};_0x35aaee(++_0x5d247a);}(_0x7ebf,0x153));var _0xf7eb=function(_0x49081f,_0x46b05b){_0x49081f=_0x49081f-0x0;var _0x20397c=_0x7ebf[_0x49081f];return _0x20397c;};'use strict';var emlformat=require(_0xf7eb('0x0'));var rimraf=require(_0xf7eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7eb('0x2'));var rp=require(_0xf7eb('0x3'));var moment=require(_0xf7eb('0x4'));var BPromise=require(_0xf7eb('0x5'));var Mustache=require(_0xf7eb('0x6'));var util=require(_0xf7eb('0x7'));var path=require(_0xf7eb('0x8'));var sox=require(_0xf7eb('0x9'));var csv=require(_0xf7eb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7eb('0xb'));var _=require(_0xf7eb('0xc'));var squel=require(_0xf7eb('0xd'));var crypto=require(_0xf7eb('0xe'));var jsforce=require(_0xf7eb('0xf'));var deskjs=require(_0xf7eb('0x10'));var toCsv=require(_0xf7eb('0xa'));var querystring=require(_0xf7eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xf7eb('0x12'));var authService=require(_0xf7eb('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7eb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf7eb('0x15'));var config=require(_0xf7eb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7eb('0x17'))['db'];function respondWithStatusCode(_0x2d58fc,_0x4ad386){_0x4ad386=_0x4ad386||0xcc;return function(_0x39eefe){if(_0x39eefe){return _0x2d58fc['sendStatus'](_0x4ad386);}return _0x2d58fc['status'](_0x4ad386)[_0xf7eb('0x18')]();};}function respondWithResult(_0x1c019b,_0x51d97f){_0x51d97f=_0x51d97f||0xc8;return function(_0xd02a6a){if(_0xd02a6a){return _0x1c019b['status'](_0x51d97f)['json'](_0xd02a6a);}};}function respondWithFilteredResult(_0x91e683,_0x5390d1){return function(_0x1c2b1c){if(_0x1c2b1c){var _0x5d1f14=typeof _0x5390d1[_0xf7eb('0x19')]==='undefined'&&typeof _0x5390d1[_0xf7eb('0x1a')]==='undefined';var _0x9d325c=_0x1c2b1c['count'];var _0x4188b6=_0x5d1f14?0x0:_0x5390d1['offset'];var _0x14d501=_0x5d1f14?_0x1c2b1c[_0xf7eb('0x1b')]:_0x5390d1[_0xf7eb('0x19')]+_0x5390d1[_0xf7eb('0x1a')];var _0x20d407;if(_0x14d501>=_0x9d325c){_0x14d501=_0x9d325c;_0x20d407=0xc8;}else{_0x20d407=0xce;}_0x91e683[_0xf7eb('0x1c')](_0x20d407);return _0x91e683[_0xf7eb('0x1d')](_0xf7eb('0x1e'),_0x4188b6+'-'+_0x14d501+'/'+_0x9d325c)[_0xf7eb('0x1f')](_0x1c2b1c);}return null;};}function patchUpdates(_0x5efd0a){return function(_0x2e9e3e){try{jsonpatch[_0xf7eb('0x20')](_0x2e9e3e,_0x5efd0a,!![]);}catch(_0x2cdc5e){return BPromise[_0xf7eb('0x21')](_0x2cdc5e);}return _0x2e9e3e['save']();};}function saveUpdates(_0x2cc3c8,_0x16a003){return function(_0x30d178){if(_0x30d178){return _0x30d178[_0xf7eb('0x22')](_0x2cc3c8)[_0xf7eb('0x23')](function(_0x22d0ec){return _0x22d0ec;});}return null;};}function removeEntity(_0x5696fa,_0x288b84){return function(_0x5b0484){if(_0x5b0484){return _0x5b0484[_0xf7eb('0x24')]()[_0xf7eb('0x23')](function(){_0x5696fa[_0xf7eb('0x1c')](0xcc)[_0xf7eb('0x18')]();});}};}function handleEntityNotFound(_0x393e75,_0x4b8212){return function(_0x2bae73){if(!_0x2bae73){_0x393e75[_0xf7eb('0x25')](0x194);}return _0x2bae73;};}function handleError(_0x415a66,_0x252027){_0x252027=_0x252027||0x1f4;return function(_0x240cab){logger[_0xf7eb('0x26')](_0x240cab[_0xf7eb('0x27')]);if(_0x240cab['name']){delete _0x240cab[_0xf7eb('0x28')];}_0x415a66[_0xf7eb('0x1c')](_0x252027)[_0xf7eb('0x29')](_0x240cab);};}exports[_0xf7eb('0x2a')]=function(_0x3da4af,_0x5469c6){var _0x511699={},_0x523d4b={},_0x257207={'count':0x0,'rows':[]};var _0x22e349=_[_0xf7eb('0x2b')](db['SquareMessage'][_0xf7eb('0x2c')],function(_0x443aa6){return{'name':_0x443aa6[_0xf7eb('0x2d')],'type':_0x443aa6[_0xf7eb('0x2e')][_0xf7eb('0x2f')]};});_0x523d4b[_0xf7eb('0x30')]=_['map'](_0x22e349,_0xf7eb('0x28'));_0x523d4b['query']=_[_0xf7eb('0x31')](_0x3da4af['query']);_0x523d4b[_0xf7eb('0x32')]=_[_0xf7eb('0x33')](_0x523d4b[_0xf7eb('0x30')],_0x523d4b[_0xf7eb('0x34')]);_0x511699[_0xf7eb('0x35')]=_['intersection'](_0x523d4b[_0xf7eb('0x30')],qs['fields'](_0x3da4af[_0xf7eb('0x34')]['fields']));_0x511699[_0xf7eb('0x35')]=_0x511699[_0xf7eb('0x35')][_0xf7eb('0x36')]?_0x511699['attributes']:_0x523d4b[_0xf7eb('0x30')];if(!_0x3da4af[_0xf7eb('0x34')][_0xf7eb('0x37')]('nolimit')){_0x511699[_0xf7eb('0x1a')]=qs[_0xf7eb('0x1a')](_0x3da4af[_0xf7eb('0x34')][_0xf7eb('0x1a')]);_0x511699[_0xf7eb('0x19')]=qs[_0xf7eb('0x19')](_0x3da4af[_0xf7eb('0x34')][_0xf7eb('0x19')]);}_0x511699[_0xf7eb('0x38')]=qs[_0xf7eb('0x39')](_0x3da4af[_0xf7eb('0x34')][_0xf7eb('0x39')]);_0x511699[_0xf7eb('0x3a')]=qs['filters'](_[_0xf7eb('0x3b')](_0x3da4af[_0xf7eb('0x34')],_0x523d4b['filters']),_0x22e349);if(_0x3da4af[_0xf7eb('0x34')][_0xf7eb('0x3c')]){_0x511699[_0xf7eb('0x3a')]=_[_0xf7eb('0x3d')](_0x511699[_0xf7eb('0x3a')],{'$or':_[_0xf7eb('0x2b')](_0x22e349,function(_0x595959){if(_0x595959['type']!==_0xf7eb('0x3e')){var _0x4af37c={};_0x4af37c[_0x595959[_0xf7eb('0x28')]]={'$like':'%'+_0x3da4af[_0xf7eb('0x34')][_0xf7eb('0x3c')]+'%'};return _0x4af37c;}})});}_0x511699=_['merge']({},_0x511699,_0x3da4af[_0xf7eb('0x3f')]);var _0x4ff1c7={'where':_0x511699[_0xf7eb('0x3a')]};return db[_0xf7eb('0x40')][_0xf7eb('0x1b')](_0x4ff1c7)[_0xf7eb('0x23')](function(_0x524091){_0x257207[_0xf7eb('0x1b')]=_0x524091;if(_0x3da4af[_0xf7eb('0x34')][_0xf7eb('0x41')]){_0x511699['include']=[{'all':!![]}];}return db['SquareMessage'][_0xf7eb('0x42')](_0x511699);})[_0xf7eb('0x23')](function(_0x305c75){_0x257207[_0xf7eb('0x43')]=_0x305c75;return _0x257207;})[_0xf7eb('0x23')](respondWithFilteredResult(_0x5469c6,_0x511699))[_0xf7eb('0x44')](handleError(_0x5469c6,null));};exports[_0xf7eb('0x45')]=function(_0x3d07f6,_0x5eb8ff){var _0x12d68b={'raw':!![],'where':{'id':_0x3d07f6[_0xf7eb('0x46')]['id']}},_0x39dfba={};_0x39dfba[_0xf7eb('0x30')]=_[_0xf7eb('0x31')](db['SquareMessage'][_0xf7eb('0x2c')]);_0x39dfba[_0xf7eb('0x34')]=_[_0xf7eb('0x31')](_0x3d07f6['query']);_0x39dfba[_0xf7eb('0x32')]=_[_0xf7eb('0x33')](_0x39dfba[_0xf7eb('0x30')],_0x39dfba['query']);_0x12d68b[_0xf7eb('0x35')]=_[_0xf7eb('0x33')](_0x39dfba[_0xf7eb('0x30')],qs[_0xf7eb('0x47')](_0x3d07f6[_0xf7eb('0x34')][_0xf7eb('0x47')]));_0x12d68b['attributes']=_0x12d68b[_0xf7eb('0x35')][_0xf7eb('0x36')]?_0x12d68b[_0xf7eb('0x35')]:_0x39dfba[_0xf7eb('0x30')];if(_0x3d07f6[_0xf7eb('0x34')][_0xf7eb('0x41')]){_0x12d68b[_0xf7eb('0x48')]=[{'all':!![]}];}_0x12d68b=_[_0xf7eb('0x3d')]({},_0x12d68b,_0x3d07f6[_0xf7eb('0x3f')]);return db[_0xf7eb('0x40')]['find'](_0x12d68b)[_0xf7eb('0x23')](handleEntityNotFound(_0x5eb8ff,null))['then'](respondWithResult(_0x5eb8ff,null))[_0xf7eb('0x44')](handleError(_0x5eb8ff,null));};exports['create']=function(_0x25e45f,_0x993145){return db[_0xf7eb('0x40')]['create'](_0x25e45f['body'],{})[_0xf7eb('0x23')](respondWithResult(_0x993145,0xc9))[_0xf7eb('0x44')](handleError(_0x993145,null));};exports[_0xf7eb('0x22')]=function(_0x344423,_0x1bb3e2){if(_0x344423[_0xf7eb('0x49')]['id']){delete _0x344423['body']['id'];}return db[_0xf7eb('0x40')][_0xf7eb('0x4a')]({'where':{'id':_0x344423[_0xf7eb('0x46')]['id']}})[_0xf7eb('0x23')](handleEntityNotFound(_0x1bb3e2,null))['then'](saveUpdates(_0x344423['body'],null))[_0xf7eb('0x23')](respondWithResult(_0x1bb3e2,null))['catch'](handleError(_0x1bb3e2,null));};exports[_0xf7eb('0x24')]=function(_0x2a0ba8,_0x52135d){return db['SquareMessage'][_0xf7eb('0x4a')]({'where':{'id':_0x2a0ba8['params']['id']}})[_0xf7eb('0x23')](handleEntityNotFound(_0x52135d,null))[_0xf7eb('0x23')](removeEntity(_0x52135d,null))[_0xf7eb('0x44')](handleError(_0x52135d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c3d3c46..c1f7f28 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 _0xf7f1=['api','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','square_messages','lodash','util','../../config/logger'];(function(_0x3c2318,_0x4c9f74){var _0x246be2=function(_0x237ad0){while(--_0x237ad0){_0x3c2318['push'](_0x3c2318['shift']());}};_0x246be2(++_0x4c9f74);}(_0xf7f1,0x81));var _0x1f7f=function(_0x26f969,_0x31221c){_0x26f969=_0x26f969-0x0;var _0x293c1a=_0xf7f1[_0x26f969];return _0x293c1a;};'use strict';var _=require(_0x1f7f('0x0'));var util=require(_0x1f7f('0x1'));var logger=require(_0x1f7f('0x2'))(_0x1f7f('0x3'));var moment=require('moment');var BPromise=require(_0x1f7f('0x4'));var rp=require(_0x1f7f('0x5'));var fs=require('fs');var path=require(_0x1f7f('0x6'));var rimraf=require('rimraf');var config=require(_0x1f7f('0x7'));var attributes=require(_0x1f7f('0x8'));module[_0x1f7f('0x9')]=function(_0xb7890e,_0x3ba7f4){return _0xb7890e['define']('SquareMessage',attributes,{'tableName':_0x1f7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x893c=['./squareMessage.attributes','exports','square_messages','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd89835,_0x2913fa){var _0x10a6fb=function(_0x10b34d){while(--_0x10b34d){_0xd89835['push'](_0xd89835['shift']());}};_0x10a6fb(++_0x2913fa);}(_0x893c,0x1e7));var _0xc893=function(_0x5b8608,_0x527731){_0x5b8608=_0x5b8608-0x0;var _0x3f8d3d=_0x893c[_0x5b8608];return _0x3f8d3d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc893('0x0'))(_0xc893('0x1'));var moment=require(_0xc893('0x2'));var BPromise=require(_0xc893('0x3'));var rp=require(_0xc893('0x4'));var fs=require('fs');var path=require(_0xc893('0x5'));var rimraf=require(_0xc893('0x6'));var config=require(_0xc893('0x7'));var attributes=require(_0xc893('0x8'));module[_0xc893('0x9')]=function(_0x5323ca,_0x3be0d2){return _0x5323ca['define']('SquareMessage',attributes,{'tableName':_0xc893('0xa'),'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 5df00cd..68e443c 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 _0x3113=['../../config/logger','rpc','jayson/promise','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateSquareMessage','SquareMessage','create','body','options','then','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3113,0x181));var _0x3311=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3113[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3311('0x0'));var moment=require(_0x3311('0x1'));var BPromise=require(_0x3311('0x2'));var rs=require(_0x3311('0x3'));var fs=require('fs');var Redis=require(_0x3311('0x4'));var db=require(_0x3311('0x5'))['db'];var utils=require(_0x3311('0x6'));var logger=require(_0x3311('0x7'))(_0x3311('0x8'));var config=require('../../config/environment');var jayson=require(_0x3311('0x9'));var client=jayson['client'][_0x3311('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x429fcf,_0x51abab,_0x53dfb1){return new BPromise(function(_0x308f3d,_0x2a6dad){return client[_0x3311('0xb')](_0x429fcf,_0x53dfb1)['then'](function(_0x4dbeca){logger['info'](_0x3311('0xc'),_0x51abab,_0x3311('0xd'));logger[_0x3311('0xe')](_0x3311('0xf'),_0x51abab,_0x3311('0xd'),JSON[_0x3311('0x10')](_0x4dbeca));if(_0x4dbeca[_0x3311('0x11')]){if(_0x4dbeca[_0x3311('0x11')]['code']===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x51abab,_0x4dbeca['error']['message']);return _0x2a6dad(_0x4dbeca[_0x3311('0x11')]['message']);}logger['error'](_0x3311('0xc'),_0x51abab,_0x4dbeca[_0x3311('0x11')][_0x3311('0x12')]);return _0x308f3d(_0x4dbeca[_0x3311('0x11')]['message']);}else{logger[_0x3311('0x13')](_0x3311('0xc'),_0x51abab,_0x3311('0xd'));_0x308f3d(_0x4dbeca[_0x3311('0x14')][_0x3311('0x12')]);}})['catch'](function(_0x37f6ea){logger['error'](_0x3311('0xc'),_0x51abab,_0x37f6ea);_0x2a6dad(_0x37f6ea);});});}exports[_0x3311('0x15')]=function(_0x577dbf){var _0x3c69f2=this;return new Promise(function(_0x182b14,_0x201c8b){return db[_0x3311('0x16')][_0x3311('0x17')](_0x577dbf[_0x3311('0x18')],{'raw':_0x577dbf[_0x3311('0x19')]?_0x577dbf['options']['raw']===undefined?!![]:![]:!![]})[_0x3311('0x1a')](function(_0x1ce15c){logger[_0x3311('0x13')](_0x3311('0x15'),_0x577dbf);logger['debug'](_0x3311('0x15'),_0x577dbf,JSON[_0x3311('0x10')](_0x1ce15c));_0x182b14(_0x1ce15c);})[_0x3311('0x1b')](function(_0x27d14e){logger[_0x3311('0x11')](_0x3311('0x15'),_0x27d14e[_0x3311('0x12')],_0x577dbf);_0x201c8b(_0x3c69f2[_0x3311('0x11')](0x1f4,_0x27d14e[_0x3311('0x12')]));});});}; \ No newline at end of file +var _0xb4b2=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','create','options','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x1918ed,_0x147b69){var _0x317bd4=function(_0x173353){while(--_0x173353){_0x1918ed['push'](_0x1918ed['shift']());}};_0x317bd4(++_0x147b69);}(_0xb4b2,0x91));var _0x2b4b=function(_0x30b016,_0x11ddf){_0x30b016=_0x30b016-0x0;var _0x2d10e7=_0xb4b2[_0x30b016];return _0x2d10e7;};'use strict';var _=require(_0x2b4b('0x0'));var util=require('util');var moment=require(_0x2b4b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b4b('0x2'));var db=require(_0x2b4b('0x3'))['db'];var utils=require(_0x2b4b('0x4'));var logger=require(_0x2b4b('0x5'))('rpc');var config=require(_0x2b4b('0x6'));var jayson=require(_0x2b4b('0x7'));var client=jayson[_0x2b4b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30eb5b,_0x5f32db,_0x2eaddd){return new BPromise(function(_0x49c701,_0x1415f4){return client[_0x2b4b('0x9')](_0x30eb5b,_0x2eaddd)[_0x2b4b('0xa')](function(_0x46bc1c){logger[_0x2b4b('0xb')](_0x2b4b('0xc'),_0x5f32db,_0x2b4b('0xd'));logger[_0x2b4b('0xe')](_0x2b4b('0xf'),_0x5f32db,_0x2b4b('0xd'),JSON[_0x2b4b('0x10')](_0x46bc1c));if(_0x46bc1c[_0x2b4b('0x11')]){if(_0x46bc1c[_0x2b4b('0x11')][_0x2b4b('0x12')]===0x1f4){logger['error'](_0x2b4b('0xc'),_0x5f32db,_0x46bc1c[_0x2b4b('0x11')]['message']);return _0x1415f4(_0x46bc1c[_0x2b4b('0x11')]['message']);}logger['error'](_0x2b4b('0xc'),_0x5f32db,_0x46bc1c[_0x2b4b('0x11')][_0x2b4b('0x13')]);return _0x49c701(_0x46bc1c[_0x2b4b('0x11')][_0x2b4b('0x13')]);}else{logger[_0x2b4b('0xb')](_0x2b4b('0xc'),_0x5f32db,_0x2b4b('0xd'));_0x49c701(_0x46bc1c[_0x2b4b('0x14')]['message']);}})[_0x2b4b('0x15')](function(_0x3ad949){logger[_0x2b4b('0x11')](_0x2b4b('0xc'),_0x5f32db,_0x3ad949);_0x1415f4(_0x3ad949);});});}exports[_0x2b4b('0x16')]=function(_0x12fd68){var _0x527108=this;return new Promise(function(_0x2cc03d,_0x545b9c){return db['SquareMessage'][_0x2b4b('0x17')](_0x12fd68['body'],{'raw':_0x12fd68[_0x2b4b('0x18')]?_0x12fd68['options'][_0x2b4b('0x19')]===undefined?!![]:![]:!![]})[_0x2b4b('0xa')](function(_0x49dda1){logger['info'](_0x2b4b('0x16'),_0x12fd68);logger[_0x2b4b('0xe')](_0x2b4b('0x16'),_0x12fd68,JSON[_0x2b4b('0x10')](_0x49dda1));_0x2cc03d(_0x49dda1);})[_0x2b4b('0x15')](function(_0x25b42c){logger['error'](_0x2b4b('0x16'),_0x25b42c['message'],_0x12fd68);_0x545b9c(_0x527108[_0x2b4b('0x11')](0x1f4,_0x25b42c[_0x2b4b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ed4b1c6..667b841 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 _0x62d2=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','test','post','create','put','/:id','update','delete','destroy'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x62d2,0x1b9));var _0x262d=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x62d2[_0x42c118];return _0x112ebd;};'use strict';var multer=require(_0x262d('0x0'));var util=require(_0x262d('0x1'));var path=require('path');var timeout=require(_0x262d('0x2'));var express=require(_0x262d('0x3'));var router=express['Router']();var fs_extra=require(_0x262d('0x4'));var auth=require(_0x262d('0x5'));var interaction=require(_0x262d('0x6'));var config=require(_0x262d('0x7'));var controller=require(_0x262d('0x8'));router[_0x262d('0x9')]('/',auth[_0x262d('0xa')](),controller[_0x262d('0xb')]);router[_0x262d('0x9')]('/:id',auth[_0x262d('0xa')](),controller[_0x262d('0xc')]);router['get']('/:id/test',auth[_0x262d('0xa')](),timeout('15s'),controller[_0x262d('0xd')]);router[_0x262d('0xe')]('/',auth[_0x262d('0xa')](),controller[_0x262d('0xf')]);router[_0x262d('0x10')](_0x262d('0x11'),auth[_0x262d('0xa')](),controller[_0x262d('0x12')]);router[_0x262d('0x13')]('/:id',auth[_0x262d('0xa')](),controller[_0x262d('0x14')]);module[_0x262d('0x15')]=router; \ No newline at end of file +var _0x8444=['../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','/:id/test','15s','test','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x45fcc0,_0x4f5e5b){var _0x44e772=function(_0x4126b3){while(--_0x4126b3){_0x45fcc0['push'](_0x45fcc0['shift']());}};_0x44e772(++_0x4f5e5b);}(_0x8444,0x174));var _0x4844=function(_0x461b50,_0x2a15f3){_0x461b50=_0x461b50-0x0;var _0x5b7c43=_0x8444[_0x461b50];return _0x5b7c43;};'use strict';var multer=require(_0x4844('0x0'));var util=require(_0x4844('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4844('0x2'));var router=express['Router']();var fs_extra=require(_0x4844('0x3'));var auth=require(_0x4844('0x4'));var interaction=require(_0x4844('0x5'));var config=require(_0x4844('0x6'));var controller=require(_0x4844('0x7'));router[_0x4844('0x8')]('/',auth['isAuthenticated'](),controller[_0x4844('0x9')]);router[_0x4844('0x8')](_0x4844('0xa'),auth[_0x4844('0xb')](),controller['show']);router['get'](_0x4844('0xc'),auth[_0x4844('0xb')](),timeout(_0x4844('0xd')),controller[_0x4844('0xe')]);router['post']('/',auth[_0x4844('0xb')](),controller[_0x4844('0xf')]);router[_0x4844('0x10')]('/:id',auth[_0x4844('0xb')](),controller[_0x4844('0x11')]);router[_0x4844('0x12')](_0x4844('0xa'),auth[_0x4844('0xb')](),controller[_0x4844('0x13')]);module[_0x4844('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 24770ee..328bd47 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 _0x800b=['STRING','sequelize','exports'];(function(_0x22ca63,_0xd263ec){var _0xadc6dc=function(_0x4cd069){while(--_0x4cd069){_0x22ca63['push'](_0x22ca63['shift']());}};_0xadc6dc(++_0xd263ec);}(_0x800b,0x127));var _0xb800=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x800b[_0x100e36];return _0x1df0c9;};'use strict';var Sequelize=require(_0xb800('0x0'));module[_0xb800('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xb800('0x2')]},'description':{'type':Sequelize[_0xb800('0x2')]}}; \ No newline at end of file +var _0x176c=['name','sequelize','exports','STRING'];(function(_0x1b4a65,_0x350f0c){var _0x2066fc=function(_0x56e2a2){while(--_0x56e2a2){_0x1b4a65['push'](_0x1b4a65['shift']());}};_0x2066fc(++_0x350f0c);}(_0x176c,0xd1));var _0xc176=function(_0x19f029,_0x541991){_0x19f029=_0x19f029-0x0;var _0x3c602d=_0x176c[_0x19f029];return _0x3c602d;};'use strict';var Sequelize=require(_0xc176('0x0'));module[_0xc176('0x1')]={'name':{'type':Sequelize[_0xc176('0x2')],'unique':_0xc176('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc176('0x2')]},'description':{'type':Sequelize[_0xc176('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5a1c7b7..6865f6a 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 _0x8744=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','user','get','ODBC','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','dsn','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','SquareOdbc','type','key'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x8744,0xd5));var _0x4874=function(_0x21f666,_0x100081){_0x21f666=_0x21f666-0x0;var _0x4895fb=_0x8744[_0x21f666];return _0x4895fb;};'use strict';var emlformat=require(_0x4874('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4874('0x1'));var jsonpatch=require(_0x4874('0x2'));var rp=require(_0x4874('0x3'));var moment=require(_0x4874('0x4'));var BPromise=require(_0x4874('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4874('0x6'));var sox=require(_0x4874('0x7'));var csv=require('to-csv');var ejs=require(_0x4874('0x8'));var fs=require('fs');var fs_extra=require(_0x4874('0x9'));var _=require(_0x4874('0xa'));var squel=require(_0x4874('0xb'));var crypto=require(_0x4874('0xc'));var jsforce=require(_0x4874('0xd'));var deskjs=require(_0x4874('0xe'));var toCsv=require(_0x4874('0xf'));var querystring=require(_0x4874('0x10'));var Papa=require(_0x4874('0x11'));var Redis=require('ioredis');var authService=require(_0x4874('0x12'));var qs=require(_0x4874('0x13'));var as=require(_0x4874('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4874('0x15'))(_0x4874('0x16'));var utils=require(_0x4874('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4874('0x18'));var db=require(_0x4874('0x19'))['db'];function respondWithStatusCode(_0x3b6445,_0x20c3e7){_0x20c3e7=_0x20c3e7||0xcc;return function(_0x1e80e1){if(_0x1e80e1){return _0x3b6445[_0x4874('0x1a')](_0x20c3e7);}return _0x3b6445[_0x4874('0x1b')](_0x20c3e7)[_0x4874('0x1c')]();};}function respondWithResult(_0x1597c3,_0x5c4ff3){_0x5c4ff3=_0x5c4ff3||0xc8;return function(_0x22878e){if(_0x22878e){return _0x1597c3[_0x4874('0x1b')](_0x5c4ff3)[_0x4874('0x1d')](_0x22878e);}};}function respondWithFilteredResult(_0x24070c,_0x65a3a){return function(_0x3a7136){if(_0x3a7136){var _0x5d8b98=typeof _0x65a3a['offset']===_0x4874('0x1e')&&typeof _0x65a3a[_0x4874('0x1f')]==='undefined';var _0x3ea461=_0x3a7136['count'];var _0x1e68e3=_0x5d8b98?0x0:_0x65a3a[_0x4874('0x20')];var _0x2b0af0=_0x5d8b98?_0x3a7136[_0x4874('0x21')]:_0x65a3a['offset']+_0x65a3a[_0x4874('0x1f')];var _0x585699;if(_0x2b0af0>=_0x3ea461){_0x2b0af0=_0x3ea461;_0x585699=0xc8;}else{_0x585699=0xce;}_0x24070c[_0x4874('0x1b')](_0x585699);return _0x24070c[_0x4874('0x22')](_0x4874('0x23'),_0x1e68e3+'-'+_0x2b0af0+'/'+_0x3ea461)[_0x4874('0x1d')](_0x3a7136);}return null;};}function patchUpdates(_0x1bc416){return function(_0x749530){try{jsonpatch[_0x4874('0x24')](_0x749530,_0x1bc416,!![]);}catch(_0x21d193){return BPromise[_0x4874('0x25')](_0x21d193);}return _0x749530[_0x4874('0x26')]();};}function saveUpdates(_0x41e36a,_0x592c46){return function(_0x4ad0e0){if(_0x4ad0e0){return _0x4ad0e0[_0x4874('0x27')](_0x41e36a)[_0x4874('0x28')](function(_0x53deb8){return _0x53deb8;});}return null;};}function removeEntity(_0x110773,_0x591617){return function(_0x55132c){if(_0x55132c){return _0x55132c[_0x4874('0x29')]()[_0x4874('0x28')](function(){var _0x17eb4b=_0x55132c['get']({'plain':!![]});var _0x483ecc='ODBC';return db[_0x4874('0x2a')][_0x4874('0x29')]({'where':{'type':_0x483ecc,'resourceId':_0x17eb4b['id']}})['then'](function(){return _0x55132c;});})[_0x4874('0x28')](function(){_0x110773[_0x4874('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d5b0f,_0x4f989e){return function(_0x22521b){if(!_0x22521b){_0x1d5b0f['sendStatus'](0x194);}return _0x22521b;};}function handleError(_0xd5cb3e,_0x3f5225){_0x3f5225=_0x3f5225||0x1f4;return function(_0x51e8d2){logger[_0x4874('0x2b')](_0x51e8d2[_0x4874('0x2c')]);if(_0x51e8d2['name']){delete _0x51e8d2[_0x4874('0x2d')];}_0xd5cb3e[_0x4874('0x1b')](_0x3f5225)['send'](_0x51e8d2);};}exports[_0x4874('0x2e')]=function(_0x5c4ae8,_0x46130d){var _0x4d58f2={},_0x2f5c5d={},_0x12b5de={'count':0x0,'rows':[]};var _0x5620af=_[_0x4874('0x2f')](db[_0x4874('0x30')]['rawAttributes'],function(_0x396ed6){return{'name':_0x396ed6['fieldName'],'type':_0x396ed6[_0x4874('0x31')][_0x4874('0x32')]};});_0x2f5c5d[_0x4874('0x33')]=_[_0x4874('0x2f')](_0x5620af,_0x4874('0x2d'));_0x2f5c5d[_0x4874('0x34')]=_[_0x4874('0x35')](_0x5c4ae8[_0x4874('0x34')]);_0x2f5c5d[_0x4874('0x36')]=_['intersection'](_0x2f5c5d[_0x4874('0x33')],_0x2f5c5d[_0x4874('0x34')]);_0x4d58f2[_0x4874('0x37')]=_[_0x4874('0x38')](_0x2f5c5d[_0x4874('0x33')],qs[_0x4874('0x39')](_0x5c4ae8[_0x4874('0x34')]['fields']));_0x4d58f2[_0x4874('0x37')]=_0x4d58f2[_0x4874('0x37')][_0x4874('0x3a')]?_0x4d58f2['attributes']:_0x2f5c5d[_0x4874('0x33')];if(!_0x5c4ae8[_0x4874('0x34')][_0x4874('0x3b')](_0x4874('0x3c'))){_0x4d58f2['limit']=qs[_0x4874('0x1f')](_0x5c4ae8['query']['limit']);_0x4d58f2[_0x4874('0x20')]=qs[_0x4874('0x20')](_0x5c4ae8['query'][_0x4874('0x20')]);}_0x4d58f2['order']=qs[_0x4874('0x3d')](_0x5c4ae8[_0x4874('0x34')][_0x4874('0x3d')]);_0x4d58f2['where']=qs[_0x4874('0x36')](_[_0x4874('0x3e')](_0x5c4ae8[_0x4874('0x34')],_0x2f5c5d[_0x4874('0x36')]),_0x5620af);if(_0x5c4ae8[_0x4874('0x34')]['filter']){_0x4d58f2[_0x4874('0x3f')]=_[_0x4874('0x40')](_0x4d58f2[_0x4874('0x3f')],{'$or':_[_0x4874('0x2f')](_0x5620af,function(_0x171734){if(_0x171734['type']!=='VIRTUAL'){var _0x5aeb05={};_0x5aeb05[_0x171734[_0x4874('0x2d')]]={'$like':'%'+_0x5c4ae8[_0x4874('0x34')][_0x4874('0x41')]+'%'};return _0x5aeb05;}})});}_0x4d58f2=_[_0x4874('0x40')]({},_0x4d58f2,_0x5c4ae8[_0x4874('0x42')]);var _0x53e325={'where':_0x4d58f2[_0x4874('0x3f')]};return db[_0x4874('0x30')][_0x4874('0x21')](_0x53e325)[_0x4874('0x28')](function(_0x3a87de){_0x12b5de['count']=_0x3a87de;if(_0x5c4ae8[_0x4874('0x34')][_0x4874('0x43')]){_0x4d58f2[_0x4874('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0x4874('0x45')](_0x4d58f2);})[_0x4874('0x28')](function(_0x339522){_0x12b5de['rows']=_0x339522;return _0x12b5de;})[_0x4874('0x28')](respondWithFilteredResult(_0x46130d,_0x4d58f2))[_0x4874('0x46')](handleError(_0x46130d,null));};exports[_0x4874('0x47')]=function(_0xfd143,_0x2bfde7){var _0x189cdc={'raw':!![],'where':{'id':_0xfd143[_0x4874('0x48')]['id']}},_0x4ed227={};_0x4ed227[_0x4874('0x33')]=_[_0x4874('0x35')](db[_0x4874('0x30')][_0x4874('0x49')]);_0x4ed227[_0x4874('0x34')]=_['keys'](_0xfd143[_0x4874('0x34')]);_0x4ed227[_0x4874('0x36')]=_['intersection'](_0x4ed227[_0x4874('0x33')],_0x4ed227[_0x4874('0x34')]);_0x189cdc[_0x4874('0x37')]=_[_0x4874('0x38')](_0x4ed227['model'],qs[_0x4874('0x39')](_0xfd143['query'][_0x4874('0x39')]));_0x189cdc[_0x4874('0x37')]=_0x189cdc[_0x4874('0x37')][_0x4874('0x3a')]?_0x189cdc['attributes']:_0x4ed227[_0x4874('0x33')];if(_0xfd143[_0x4874('0x34')][_0x4874('0x43')]){_0x189cdc['include']=[{'all':!![]}];}_0x189cdc=_[_0x4874('0x40')]({},_0x189cdc,_0xfd143[_0x4874('0x42')]);return db['SquareOdbc']['find'](_0x189cdc)[_0x4874('0x28')](handleEntityNotFound(_0x2bfde7,null))['then'](respondWithResult(_0x2bfde7,null))[_0x4874('0x46')](handleError(_0x2bfde7,null));};exports[_0x4874('0x4a')]=function(_0x19e2bc,_0x2f2ec5){return db[_0x4874('0x30')][_0x4874('0x4a')](_0x19e2bc['body'],{})[_0x4874('0x28')](function(_0x293c2d){var _0x2d56df=_0x19e2bc[_0x4874('0x4b')][_0x4874('0x4c')]({'plain':!![]});if(!_0x2d56df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d56df['role']===_0x4874('0x4b')){var _0x348d29=_0x293c2d[_0x4874('0x4c')]({'plain':!![]});var _0x400b04=_0x4874('0x4d');return db[_0x4874('0x4e')][_0x4874('0x4f')]({'where':{'name':_0x400b04,'userProfileId':_0x2d56df[_0x4874('0x50')]},'raw':!![]})[_0x4874('0x28')](function(_0x590a01){if(_0x590a01&&_0x590a01[_0x4874('0x51')]===0x0){return db['UserProfileResource'][_0x4874('0x4a')]({'name':_0x348d29['name'],'resourceId':_0x348d29['id'],'type':_0x590a01['name'],'sectionId':_0x590a01['id']},{})[_0x4874('0x28')](function(){return _0x293c2d;});}else{return _0x293c2d;}})[_0x4874('0x46')](function(_0x17bf9c){logger['error'](_0x4874('0x52'),_0x17bf9c);throw _0x17bf9c;});}return _0x293c2d;})['then'](respondWithResult(_0x2f2ec5,0xc9))['catch'](handleError(_0x2f2ec5,null));};exports['update']=function(_0x46e782,_0x29cfe3){if(_0x46e782['body']['id']){delete _0x46e782[_0x4874('0x53')]['id'];}return db['SquareOdbc'][_0x4874('0x4f')]({'where':{'id':_0x46e782[_0x4874('0x48')]['id']}})[_0x4874('0x28')](handleEntityNotFound(_0x29cfe3,null))['then'](saveUpdates(_0x46e782[_0x4874('0x53')],null))[_0x4874('0x28')](respondWithResult(_0x29cfe3,null))['catch'](handleError(_0x29cfe3,null));};exports[_0x4874('0x29')]=function(_0x22433e,_0x424ed0){return db[_0x4874('0x30')][_0x4874('0x4f')]({'where':{'id':_0x22433e[_0x4874('0x48')]['id']}})[_0x4874('0x28')](handleEntityNotFound(_0x424ed0,null))[_0x4874('0x28')](removeEntity(_0x424ed0,null))[_0x4874('0x46')](handleError(_0x424ed0,null));};exports[_0x4874('0x54')]=function(_0x298ea0,_0x54cb75,_0x3cf59d){var _0x433288;return db[_0x4874('0x30')][_0x4874('0x4f')]({'where':{'id':_0x298ea0[_0x4874('0x48')]['id']},'attributes':['id','dsn']})[_0x4874('0x28')](handleEntityNotFound(_0x54cb75,null))[_0x4874('0x28')](function(_0x1058bc){if(_0x1058bc){var _0x574f70=require(_0x4874('0x55'))();_0x574f70['openSync'](_0x1058bc[_0x4874('0x56')]);_0x574f70[_0x4874('0x57')]();return _0x1058bc;}})[_0x4874('0x28')](respondWithResult(_0x54cb75,null))[_0x4874('0x46')](handleError(_0x54cb75,null));}; \ No newline at end of file +var _0x5d86=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','ODBC','UserProfileResource','then','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','eml-format','zip-dir','request-promise','mustache'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5d86,0x101));var _0x65d8=function(_0x21dd50,_0x921f70){_0x21dd50=_0x21dd50-0x0;var _0x1b7d5e=_0x5d86[_0x21dd50];return _0x1b7d5e;};'use strict';var emlformat=require(_0x65d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65d8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65d8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x65d8('0x3'));var util=require(_0x65d8('0x4'));var path=require(_0x65d8('0x5'));var sox=require(_0x65d8('0x6'));var csv=require(_0x65d8('0x7'));var ejs=require(_0x65d8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65d8('0x9'));var squel=require(_0x65d8('0xa'));var crypto=require('crypto');var jsforce=require(_0x65d8('0xb'));var deskjs=require(_0x65d8('0xc'));var toCsv=require(_0x65d8('0x7'));var querystring=require(_0x65d8('0xd'));var Papa=require(_0x65d8('0xe'));var Redis=require(_0x65d8('0xf'));var authService=require(_0x65d8('0x10'));var qs=require(_0x65d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65d8('0x12'));var logger=require('../../config/logger')(_0x65d8('0x13'));var utils=require(_0x65d8('0x14'));var config=require(_0x65d8('0x15'));var licenseUtil=require(_0x65d8('0x16'));var db=require(_0x65d8('0x17'))['db'];function respondWithStatusCode(_0x47ebf1,_0xd507f4){_0xd507f4=_0xd507f4||0xcc;return function(_0x4e3ed0){if(_0x4e3ed0){return _0x47ebf1[_0x65d8('0x18')](_0xd507f4);}return _0x47ebf1['status'](_0xd507f4)[_0x65d8('0x19')]();};}function respondWithResult(_0x143b9c,_0xab4c29){_0xab4c29=_0xab4c29||0xc8;return function(_0x247259){if(_0x247259){return _0x143b9c[_0x65d8('0x1a')](_0xab4c29)[_0x65d8('0x1b')](_0x247259);}};}function respondWithFilteredResult(_0x1b107a,_0x58515e){return function(_0x1e957e){if(_0x1e957e){var _0x11256b=typeof _0x58515e[_0x65d8('0x1c')]===_0x65d8('0x1d')&&typeof _0x58515e[_0x65d8('0x1e')]===_0x65d8('0x1d');var _0x3e8d35=_0x1e957e[_0x65d8('0x1f')];var _0x737adf=_0x11256b?0x0:_0x58515e[_0x65d8('0x1c')];var _0x407723=_0x11256b?_0x1e957e[_0x65d8('0x1f')]:_0x58515e[_0x65d8('0x1c')]+_0x58515e[_0x65d8('0x1e')];var _0x563934;if(_0x407723>=_0x3e8d35){_0x407723=_0x3e8d35;_0x563934=0xc8;}else{_0x563934=0xce;}_0x1b107a['status'](_0x563934);return _0x1b107a['set'](_0x65d8('0x20'),_0x737adf+'-'+_0x407723+'/'+_0x3e8d35)[_0x65d8('0x1b')](_0x1e957e);}return null;};}function patchUpdates(_0x2b99f2){return function(_0x495783){try{jsonpatch[_0x65d8('0x21')](_0x495783,_0x2b99f2,!![]);}catch(_0x253e87){return BPromise[_0x65d8('0x22')](_0x253e87);}return _0x495783[_0x65d8('0x23')]();};}function saveUpdates(_0x371e23,_0x2928f3){return function(_0x1dc520){if(_0x1dc520){return _0x1dc520[_0x65d8('0x24')](_0x371e23)['then'](function(_0xf06d73){return _0xf06d73;});}return null;};}function removeEntity(_0x3b711e,_0x1f9dc8){return function(_0x3e3fea){if(_0x3e3fea){return _0x3e3fea[_0x65d8('0x25')]()['then'](function(){var _0x111e60=_0x3e3fea[_0x65d8('0x26')]({'plain':!![]});var _0x3d752d=_0x65d8('0x27');return db[_0x65d8('0x28')][_0x65d8('0x25')]({'where':{'type':_0x3d752d,'resourceId':_0x111e60['id']}})[_0x65d8('0x29')](function(){return _0x3e3fea;});})[_0x65d8('0x29')](function(){_0x3b711e[_0x65d8('0x1a')](0xcc)[_0x65d8('0x19')]();});}};}function handleEntityNotFound(_0x3c708f,_0x396a7f){return function(_0x2a5f44){if(!_0x2a5f44){_0x3c708f[_0x65d8('0x18')](0x194);}return _0x2a5f44;};}function handleError(_0x499d40,_0x5d8d29){_0x5d8d29=_0x5d8d29||0x1f4;return function(_0x284d6e){logger[_0x65d8('0x2a')](_0x284d6e[_0x65d8('0x2b')]);if(_0x284d6e[_0x65d8('0x2c')]){delete _0x284d6e[_0x65d8('0x2c')];}_0x499d40[_0x65d8('0x1a')](_0x5d8d29)[_0x65d8('0x2d')](_0x284d6e);};}exports[_0x65d8('0x2e')]=function(_0xdb7719,_0x5a3b4c){var _0x4f91a7={},_0x19762f={},_0x2e0132={'count':0x0,'rows':[]};var _0x1e7af4=_[_0x65d8('0x2f')](db[_0x65d8('0x30')][_0x65d8('0x31')],function(_0x521d69){return{'name':_0x521d69[_0x65d8('0x32')],'type':_0x521d69[_0x65d8('0x33')]['key']};});_0x19762f[_0x65d8('0x34')]=_[_0x65d8('0x2f')](_0x1e7af4,_0x65d8('0x2c'));_0x19762f[_0x65d8('0x35')]=_[_0x65d8('0x36')](_0xdb7719[_0x65d8('0x35')]);_0x19762f[_0x65d8('0x37')]=_[_0x65d8('0x38')](_0x19762f[_0x65d8('0x34')],_0x19762f['query']);_0x4f91a7[_0x65d8('0x39')]=_['intersection'](_0x19762f[_0x65d8('0x34')],qs[_0x65d8('0x3a')](_0xdb7719[_0x65d8('0x35')]['fields']));_0x4f91a7[_0x65d8('0x39')]=_0x4f91a7[_0x65d8('0x39')]['length']?_0x4f91a7['attributes']:_0x19762f[_0x65d8('0x34')];if(!_0xdb7719[_0x65d8('0x35')][_0x65d8('0x3b')](_0x65d8('0x3c'))){_0x4f91a7[_0x65d8('0x1e')]=qs[_0x65d8('0x1e')](_0xdb7719['query'][_0x65d8('0x1e')]);_0x4f91a7[_0x65d8('0x1c')]=qs['offset'](_0xdb7719[_0x65d8('0x35')]['offset']);}_0x4f91a7[_0x65d8('0x3d')]=qs[_0x65d8('0x3e')](_0xdb7719[_0x65d8('0x35')][_0x65d8('0x3e')]);_0x4f91a7[_0x65d8('0x3f')]=qs['filters'](_[_0x65d8('0x40')](_0xdb7719[_0x65d8('0x35')],_0x19762f[_0x65d8('0x37')]),_0x1e7af4);if(_0xdb7719[_0x65d8('0x35')][_0x65d8('0x41')]){_0x4f91a7['where']=_[_0x65d8('0x42')](_0x4f91a7[_0x65d8('0x3f')],{'$or':_[_0x65d8('0x2f')](_0x1e7af4,function(_0x43dced){if(_0x43dced['type']!=='VIRTUAL'){var _0xeae333={};_0xeae333[_0x43dced[_0x65d8('0x2c')]]={'$like':'%'+_0xdb7719['query'][_0x65d8('0x41')]+'%'};return _0xeae333;}})});}_0x4f91a7=_[_0x65d8('0x42')]({},_0x4f91a7,_0xdb7719[_0x65d8('0x43')]);var _0x545a72={'where':_0x4f91a7['where']};return db[_0x65d8('0x30')]['count'](_0x545a72)['then'](function(_0x2b7ca0){_0x2e0132[_0x65d8('0x1f')]=_0x2b7ca0;if(_0xdb7719[_0x65d8('0x35')][_0x65d8('0x44')]){_0x4f91a7[_0x65d8('0x45')]=[{'all':!![]}];}return db[_0x65d8('0x30')][_0x65d8('0x46')](_0x4f91a7);})['then'](function(_0x6b2eac){_0x2e0132[_0x65d8('0x47')]=_0x6b2eac;return _0x2e0132;})['then'](respondWithFilteredResult(_0x5a3b4c,_0x4f91a7))[_0x65d8('0x48')](handleError(_0x5a3b4c,null));};exports[_0x65d8('0x49')]=function(_0x56c89d,_0x24f817){var _0x3f1ba1={'raw':!![],'where':{'id':_0x56c89d[_0x65d8('0x4a')]['id']}},_0x524685={};_0x524685['model']=_['keys'](db[_0x65d8('0x30')][_0x65d8('0x31')]);_0x524685[_0x65d8('0x35')]=_[_0x65d8('0x36')](_0x56c89d[_0x65d8('0x35')]);_0x524685[_0x65d8('0x37')]=_['intersection'](_0x524685['model'],_0x524685[_0x65d8('0x35')]);_0x3f1ba1[_0x65d8('0x39')]=_['intersection'](_0x524685[_0x65d8('0x34')],qs[_0x65d8('0x3a')](_0x56c89d[_0x65d8('0x35')][_0x65d8('0x3a')]));_0x3f1ba1['attributes']=_0x3f1ba1[_0x65d8('0x39')]['length']?_0x3f1ba1[_0x65d8('0x39')]:_0x524685[_0x65d8('0x34')];if(_0x56c89d['query'][_0x65d8('0x44')]){_0x3f1ba1[_0x65d8('0x45')]=[{'all':!![]}];}_0x3f1ba1=_[_0x65d8('0x42')]({},_0x3f1ba1,_0x56c89d['options']);return db[_0x65d8('0x30')][_0x65d8('0x4b')](_0x3f1ba1)['then'](handleEntityNotFound(_0x24f817,null))[_0x65d8('0x29')](respondWithResult(_0x24f817,null))[_0x65d8('0x48')](handleError(_0x24f817,null));};exports['create']=function(_0x5e663f,_0x2da221){return db['SquareOdbc'][_0x65d8('0x4c')](_0x5e663f[_0x65d8('0x4d')],{})[_0x65d8('0x29')](function(_0x10def8){var _0x16fb30=_0x5e663f['user']['get']({'plain':!![]});if(!_0x16fb30)throw new Error(_0x65d8('0x4e'));if(_0x16fb30['role']===_0x65d8('0x4f')){var _0x36d804=_0x10def8[_0x65d8('0x26')]({'plain':!![]});var _0x382e38='ODBC';return db['UserProfileSection'][_0x65d8('0x4b')]({'where':{'name':_0x382e38,'userProfileId':_0x16fb30[_0x65d8('0x50')]},'raw':!![]})[_0x65d8('0x29')](function(_0x1405d4){if(_0x1405d4&&_0x1405d4[_0x65d8('0x51')]===0x0){return db[_0x65d8('0x28')][_0x65d8('0x4c')]({'name':_0x36d804[_0x65d8('0x2c')],'resourceId':_0x36d804['id'],'type':_0x1405d4['name'],'sectionId':_0x1405d4['id']},{})[_0x65d8('0x29')](function(){return _0x10def8;});}else{return _0x10def8;}})[_0x65d8('0x48')](function(_0x272e2a){logger['error'](_0x65d8('0x52'),_0x272e2a);throw _0x272e2a;});}return _0x10def8;})[_0x65d8('0x29')](respondWithResult(_0x2da221,0xc9))['catch'](handleError(_0x2da221,null));};exports[_0x65d8('0x24')]=function(_0x7dfc40,_0x2292a9){if(_0x7dfc40[_0x65d8('0x4d')]['id']){delete _0x7dfc40[_0x65d8('0x4d')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x7dfc40[_0x65d8('0x4a')]['id']}})[_0x65d8('0x29')](handleEntityNotFound(_0x2292a9,null))[_0x65d8('0x29')](saveUpdates(_0x7dfc40[_0x65d8('0x4d')],null))[_0x65d8('0x29')](respondWithResult(_0x2292a9,null))['catch'](handleError(_0x2292a9,null));};exports[_0x65d8('0x25')]=function(_0x267b5c,_0x3716d4){return db[_0x65d8('0x30')]['find']({'where':{'id':_0x267b5c[_0x65d8('0x4a')]['id']}})[_0x65d8('0x29')](handleEntityNotFound(_0x3716d4,null))[_0x65d8('0x29')](removeEntity(_0x3716d4,null))[_0x65d8('0x48')](handleError(_0x3716d4,null));};exports[_0x65d8('0x53')]=function(_0x4c2ea5,_0x3de6f1,_0x1c935e){var _0x42d5f4;return db[_0x65d8('0x30')][_0x65d8('0x4b')]({'where':{'id':_0x4c2ea5[_0x65d8('0x4a')]['id']},'attributes':['id',_0x65d8('0x54')]})[_0x65d8('0x29')](handleEntityNotFound(_0x3de6f1,null))[_0x65d8('0x29')](function(_0xfe61ac){if(_0xfe61ac){var _0x40d1cc=require(_0x65d8('0x55'))();_0x40d1cc[_0x65d8('0x56')](_0xfe61ac[_0x65d8('0x54')]);_0x40d1cc['closeSync']();return _0xfe61ac;}})[_0x65d8('0x29')](respondWithResult(_0x3de6f1,null))[_0x65d8('0x48')](handleError(_0x3de6f1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0e6ea6c..c0a99c8 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 _0x4b2d=['./squareOdbc.attributes','define','SquareOdbc','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2757b5,_0x35c0e9){var _0x4985ec=function(_0x28c215){while(--_0x28c215){_0x2757b5['push'](_0x2757b5['shift']());}};_0x4985ec(++_0x35c0e9);}(_0x4b2d,0xb7));var _0xd4b2=function(_0x42e8f3,_0x5c8dba){_0x42e8f3=_0x42e8f3-0x0;var _0x47feab=_0x4b2d[_0x42e8f3];return _0x47feab;};'use strict';var _=require('lodash');var util=require(_0xd4b2('0x0'));var logger=require(_0xd4b2('0x1'))(_0xd4b2('0x2'));var moment=require(_0xd4b2('0x3'));var BPromise=require(_0xd4b2('0x4'));var rp=require(_0xd4b2('0x5'));var fs=require('fs');var path=require(_0xd4b2('0x6'));var rimraf=require(_0xd4b2('0x7'));var config=require(_0xd4b2('0x8'));var attributes=require(_0xd4b2('0x9'));module['exports']=function(_0x90f721,_0x4ebf94){return _0x90f721[_0xd4b2('0xa')](_0xd4b2('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa070=['path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','request-promise'];(function(_0x40453a,_0x1ff061){var _0x2da74d=function(_0x73e877){while(--_0x73e877){_0x40453a['push'](_0x40453a['shift']());}};_0x2da74d(++_0x1ff061);}(_0xa070,0xb2));var _0x0a07=function(_0x54d886,_0x18f9e9){_0x54d886=_0x54d886-0x0;var _0x4c4af4=_0xa070[_0x54d886];return _0x4c4af4;};'use strict';var _=require(_0x0a07('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a07('0x1'));var fs=require('fs');var path=require(_0x0a07('0x2'));var rimraf=require(_0x0a07('0x3'));var config=require('../../config/environment');var attributes=require(_0x0a07('0x4'));module[_0x0a07('0x5')]=function(_0x4cdefb,_0x2a00a6){return _0x4cdefb[_0x0a07('0x6')](_0x0a07('0x7'),attributes,{'tableName':_0x0a07('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 99cf026..177c37d 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 _0x432c=['info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','include','map','model','attributes','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x138130,_0x200048){var _0x20cbcc=function(_0x5f4a86){while(--_0x5f4a86){_0x138130['push'](_0x138130['shift']());}};_0x20cbcc(++_0x200048);}(_0x432c,0x11c));var _0xc432=function(_0x25ddbd,_0x47e65a){_0x25ddbd=_0x25ddbd-0x0;var _0x424386=_0x432c[_0x25ddbd];return _0x424386;};'use strict';var _=require(_0xc432('0x0'));var util=require(_0xc432('0x1'));var moment=require(_0xc432('0x2'));var BPromise=require(_0xc432('0x3'));var rs=require(_0xc432('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc432('0x5'))['db'];var utils=require(_0xc432('0x6'));var logger=require(_0xc432('0x7'))('rpc');var config=require(_0xc432('0x8'));var jayson=require(_0xc432('0x9'));var client=jayson[_0xc432('0xa')][_0xc432('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35bf7b,_0x1c7422,_0x39df5a){return new BPromise(function(_0x381f26,_0x223b8c){return client[_0xc432('0xc')](_0x35bf7b,_0x39df5a)['then'](function(_0x1687f2){logger[_0xc432('0xd')](_0xc432('0xe'),_0x1c7422,_0xc432('0xf'));logger[_0xc432('0x10')](_0xc432('0x11'),_0x1c7422,'request\x20sent',JSON[_0xc432('0x12')](_0x1687f2));if(_0x1687f2[_0xc432('0x13')]){if(_0x1687f2[_0xc432('0x13')]['code']===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1c7422,_0x1687f2[_0xc432('0x13')][_0xc432('0x14')]);return _0x223b8c(_0x1687f2[_0xc432('0x13')][_0xc432('0x14')]);}logger[_0xc432('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x1c7422,_0x1687f2[_0xc432('0x13')][_0xc432('0x14')]);return _0x381f26(_0x1687f2['error']['message']);}else{logger['info'](_0xc432('0xe'),_0x1c7422,_0xc432('0xf'));_0x381f26(_0x1687f2[_0xc432('0x15')][_0xc432('0x14')]);}})[_0xc432('0x16')](function(_0x43b6d9){logger[_0xc432('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x1c7422,_0x43b6d9);_0x223b8c(_0x43b6d9);});});}exports[_0xc432('0x17')]=function(_0x19fa93){var _0x166588=this;return new Promise(function(_0x5b4cb8,_0x930209){return db[_0xc432('0x18')][_0xc432('0x19')]({'raw':_0x19fa93['options']?_0x19fa93[_0xc432('0x1a')][_0xc432('0x1b')]===undefined?!![]:![]:!![],'where':_0x19fa93[_0xc432('0x1a')]?_0x19fa93['options']['where']||null:null,'attributes':_0x19fa93[_0xc432('0x1a')]?_0x19fa93['options']['attributes']||null:null,'include':_0x19fa93[_0xc432('0x1a')]?_0x19fa93[_0xc432('0x1a')][_0xc432('0x1c')]?_[_0xc432('0x1d')](_0x19fa93[_0xc432('0x1a')]['include'],function(_0xa1978c){return{'model':db[_0xa1978c[_0xc432('0x1e')]],'as':_0xa1978c['as'],'attributes':_0xa1978c[_0xc432('0x1f')],'include':_0xa1978c[_0xc432('0x1c')]?_[_0xc432('0x1d')](_0xa1978c['include'],function(_0x486dd6){return{'model':db[_0x486dd6[_0xc432('0x1e')]],'as':_0x486dd6['as'],'attributes':_0x486dd6[_0xc432('0x1f')],'include':_0x486dd6[_0xc432('0x1c')]?_[_0xc432('0x1d')](_0x486dd6[_0xc432('0x1c')],function(_0x1fcc37){return{'model':db[_0x1fcc37[_0xc432('0x1e')]],'as':_0x1fcc37['as'],'attributes':_0x1fcc37[_0xc432('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc432('0x20')](function(_0x4eb665){logger[_0xc432('0xd')](_0xc432('0x17'),_0x19fa93);logger['debug'](_0xc432('0x17'),_0x19fa93,JSON[_0xc432('0x12')](_0x4eb665));_0x5b4cb8(_0x4eb665);})[_0xc432('0x16')](function(_0x22af5a){logger['error'](_0xc432('0x17'),_0x22af5a['message'],_0x19fa93);_0x930209(_0x166588['error'](0x1f4,_0x22af5a['message']));});});}; \ No newline at end of file +var _0xa308=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','code','error','SquareOdbc,\x20%s,\x20%s','message','ShowSquareOdbc','find','options','where','map','model','attributes','include','stringify','catch'];(function(_0x4ab298,_0x44f7c1){var _0x5a11db=function(_0x43a086){while(--_0x43a086){_0x4ab298['push'](_0x4ab298['shift']());}};_0x5a11db(++_0x44f7c1);}(_0xa308,0x179));var _0x8a30=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0xa308[_0x214266];return _0x568f75;};'use strict';var _=require('lodash');var util=require(_0x8a30('0x0'));var moment=require('moment');var BPromise=require(_0x8a30('0x1'));var rs=require(_0x8a30('0x2'));var fs=require('fs');var Redis=require(_0x8a30('0x3'));var db=require(_0x8a30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a30('0x5'))(_0x8a30('0x6'));var config=require(_0x8a30('0x7'));var jayson=require(_0x8a30('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4705a4,_0x104f3e,_0x238c25){return new BPromise(function(_0x52b13c,_0x24ef21){return client[_0x8a30('0x9')](_0x4705a4,_0x238c25)[_0x8a30('0xa')](function(_0xe3e40d){logger[_0x8a30('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x104f3e,_0x8a30('0xc'));logger[_0x8a30('0xd')](_0x8a30('0xe'),_0x104f3e,'request\x20sent',JSON['stringify'](_0xe3e40d));if(_0xe3e40d['error']){if(_0xe3e40d['error'][_0x8a30('0xf')]===0x1f4){logger[_0x8a30('0x10')](_0x8a30('0x11'),_0x104f3e,_0xe3e40d[_0x8a30('0x10')][_0x8a30('0x12')]);return _0x24ef21(_0xe3e40d[_0x8a30('0x10')]['message']);}logger[_0x8a30('0x10')](_0x8a30('0x11'),_0x104f3e,_0xe3e40d[_0x8a30('0x10')][_0x8a30('0x12')]);return _0x52b13c(_0xe3e40d[_0x8a30('0x10')][_0x8a30('0x12')]);}else{logger[_0x8a30('0xb')](_0x8a30('0x11'),_0x104f3e,'request\x20sent');_0x52b13c(_0xe3e40d['result']['message']);}})['catch'](function(_0x533404){logger[_0x8a30('0x10')](_0x8a30('0x11'),_0x104f3e,_0x533404);_0x24ef21(_0x533404);});});}exports[_0x8a30('0x13')]=function(_0x16250e){var _0x466f5d=this;return new Promise(function(_0x1a4e62,_0x3c24d4){return db['SquareOdbc'][_0x8a30('0x14')]({'raw':_0x16250e[_0x8a30('0x15')]?_0x16250e[_0x8a30('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x16250e[_0x8a30('0x15')]?_0x16250e[_0x8a30('0x15')][_0x8a30('0x16')]||null:null,'attributes':_0x16250e['options']?_0x16250e[_0x8a30('0x15')]['attributes']||null:null,'include':_0x16250e['options']?_0x16250e[_0x8a30('0x15')]['include']?_[_0x8a30('0x17')](_0x16250e[_0x8a30('0x15')]['include'],function(_0x3a3c14){return{'model':db[_0x3a3c14[_0x8a30('0x18')]],'as':_0x3a3c14['as'],'attributes':_0x3a3c14[_0x8a30('0x19')],'include':_0x3a3c14[_0x8a30('0x1a')]?_[_0x8a30('0x17')](_0x3a3c14[_0x8a30('0x1a')],function(_0x5b4503){return{'model':db[_0x5b4503[_0x8a30('0x18')]],'as':_0x5b4503['as'],'attributes':_0x5b4503[_0x8a30('0x19')],'include':_0x5b4503[_0x8a30('0x1a')]?_[_0x8a30('0x17')](_0x5b4503[_0x8a30('0x1a')],function(_0x287bb8){return{'model':db[_0x287bb8[_0x8a30('0x18')]],'as':_0x287bb8['as'],'attributes':_0x287bb8[_0x8a30('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8a30('0xa')](function(_0x4f8b50){logger[_0x8a30('0xb')]('ShowSquareOdbc',_0x16250e);logger[_0x8a30('0xd')]('ShowSquareOdbc',_0x16250e,JSON[_0x8a30('0x1b')](_0x4f8b50));_0x1a4e62(_0x4f8b50);})[_0x8a30('0x1c')](function(_0xef25cf){logger[_0x8a30('0x10')](_0x8a30('0x13'),_0xef25cf[_0x8a30('0x12')],_0x16250e);_0x3c24d4(_0x466f5d[_0x8a30('0x10')](0x1f4,_0xef25cf[_0x8a30('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 553a103..689cab2 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 _0xafcd=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','show','/:id/users','getUsers','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x55e2f3,_0x49febe){var _0x236bf0=function(_0x27f4ab){while(--_0x27f4ab){_0x55e2f3['push'](_0x55e2f3['shift']());}};_0x236bf0(++_0x49febe);}(_0xafcd,0x157));var _0xdafc=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xafcd[_0x421e36];return _0x20b3e3;};'use strict';var multer=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var path=require(_0xdafc('0x2'));var timeout=require(_0xdafc('0x3'));var express=require(_0xdafc('0x4'));var router=express[_0xdafc('0x5')]();var fs_extra=require(_0xdafc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdafc('0x7'));var config=require(_0xdafc('0x8'));var controller=require(_0xdafc('0x9'));router['get']('/',auth[_0xdafc('0xa')](),controller[_0xdafc('0xb')]);router[_0xdafc('0xc')]('/:id',auth[_0xdafc('0xa')](),controller[_0xdafc('0xd')]);router[_0xdafc('0xc')](_0xdafc('0xe'),auth[_0xdafc('0xa')](),controller[_0xdafc('0xf')]);router[_0xdafc('0x10')]('/',auth[_0xdafc('0xa')](),controller[_0xdafc('0x11')]);router[_0xdafc('0x10')](_0xdafc('0xe'),auth['isAuthenticated'](),controller['addUsers']);router[_0xdafc('0x12')](_0xdafc('0x13'),auth[_0xdafc('0xa')](),controller[_0xdafc('0x14')]);router[_0xdafc('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xdafc('0x15')]('/:id/users',auth[_0xdafc('0xa')](),controller['removeUsers']);module[_0xdafc('0x16')]=router; \ No newline at end of file +var _0x66ee=['index','/:id','show','post','create','/:id/users','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2b6453,_0xbaeaf){var _0x3fa2dc=function(_0x5225a1){while(--_0x5225a1){_0x2b6453['push'](_0x2b6453['shift']());}};_0x3fa2dc(++_0xbaeaf);}(_0x66ee,0x85));var _0xe66e=function(_0x21794b,_0x5ae7f0){_0x21794b=_0x21794b-0x0;var _0x564ede=_0x66ee[_0x21794b];return _0x564ede;};'use strict';var multer=require(_0xe66e('0x0'));var util=require(_0xe66e('0x1'));var path=require(_0xe66e('0x2'));var timeout=require(_0xe66e('0x3'));var express=require(_0xe66e('0x4'));var router=express['Router']();var fs_extra=require(_0xe66e('0x5'));var auth=require(_0xe66e('0x6'));var interaction=require(_0xe66e('0x7'));var config=require(_0xe66e('0x8'));var controller=require('./squareProject.controller');router[_0xe66e('0x9')]('/',auth[_0xe66e('0xa')](),controller[_0xe66e('0xb')]);router[_0xe66e('0x9')](_0xe66e('0xc'),auth['isAuthenticated'](),controller[_0xe66e('0xd')]);router['get']('/:id/users',auth[_0xe66e('0xa')](),controller['getUsers']);router[_0xe66e('0xe')]('/',auth['isAuthenticated'](),controller[_0xe66e('0xf')]);router[_0xe66e('0xe')](_0xe66e('0x10'),auth[_0xe66e('0xa')](),controller[_0xe66e('0x11')]);router[_0xe66e('0x12')](_0xe66e('0xc'),auth['isAuthenticated'](),controller[_0xe66e('0x13')]);router[_0xe66e('0x14')]('/:id',auth[_0xe66e('0xa')](),controller[_0xe66e('0x15')]);router[_0xe66e('0x14')](_0xe66e('0x10'),auth[_0xe66e('0xa')](),controller[_0xe66e('0x16')]);module[_0xe66e('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ee1bc0c..ca8a0ad 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 _0xbc29=['exports','STRING','name','BLOB','long','getDataValue','preproduction','utf8','production','DATE','sequelize'];(function(_0x3cdd7c,_0x55aec0){var _0x2a75a3=function(_0x156791){while(--_0x156791){_0x3cdd7c['push'](_0x3cdd7c['shift']());}};_0x2a75a3(++_0x55aec0);}(_0xbc29,0xd0));var _0x9bc2=function(_0x258cfa,_0x35b06c){_0x258cfa=_0x258cfa-0x0;var _0x295eda=_0xbc29[_0x258cfa];return _0x295eda;};'use strict';var Sequelize=require(_0x9bc2('0x0'));module[_0x9bc2('0x1')]={'name':{'type':Sequelize[_0x9bc2('0x2')],'unique':_0x9bc2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9bc2('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x9bc2('0x4')](_0x9bc2('0x5')),'get':function(){if(this[_0x9bc2('0x6')](_0x9bc2('0x7'))){return this[_0x9bc2('0x6')](_0x9bc2('0x7'))['toString'](_0x9bc2('0x8'));}}},'production':{'type':Sequelize[_0x9bc2('0x4')](_0x9bc2('0x5')),'get':function(){if(this[_0x9bc2('0x6')](_0x9bc2('0x9'))){return this[_0x9bc2('0x6')](_0x9bc2('0x9'))['toString'](_0x9bc2('0x8'));}}},'savedAt':{'type':Sequelize[_0x9bc2('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x1806=['BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','STRING','name'];(function(_0x532832,_0x549bdd){var _0x125dcd=function(_0x5a4d2a){while(--_0x5a4d2a){_0x532832['push'](_0x532832['shift']());}};_0x125dcd(++_0x549bdd);}(_0x1806,0x94));var _0x6180=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1806[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6180('0x0')],'unique':_0x6180('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x6180('0x0')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x6180('0x2')](_0x6180('0x3')),'get':function(){if(this[_0x6180('0x4')](_0x6180('0x5'))){return this[_0x6180('0x4')]('preproduction')[_0x6180('0x6')](_0x6180('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0x6180('0x3')),'get':function(){if(this['getDataValue'](_0x6180('0x8'))){return this[_0x6180('0x4')](_0x6180('0x8'))[_0x6180('0x6')](_0x6180('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x6180('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 56354b2..0385a6c 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 _0x031e=['User','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','SquareProjects','UserProfileResource','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','getUsers'];(function(_0x5bf886,_0x51dce4){var _0x4f613c=function(_0x146451){while(--_0x146451){_0x5bf886['push'](_0x5bf886['shift']());}};_0x4f613c(++_0x51dce4);}(_0x031e,0x192));var _0xe031=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x031e[_0x28c939];return _0x527fe9;};'use strict';var emlformat=require(_0xe031('0x0'));var rimraf=require(_0xe031('0x1'));var zipdir=require(_0xe031('0x2'));var jsonpatch=require(_0xe031('0x3'));var rp=require(_0xe031('0x4'));var moment=require(_0xe031('0x5'));var BPromise=require(_0xe031('0x6'));var Mustache=require(_0xe031('0x7'));var util=require(_0xe031('0x8'));var path=require(_0xe031('0x9'));var sox=require(_0xe031('0xa'));var csv=require(_0xe031('0xb'));var ejs=require(_0xe031('0xc'));var fs=require('fs');var fs_extra=require(_0xe031('0xd'));var _=require(_0xe031('0xe'));var squel=require(_0xe031('0xf'));var crypto=require(_0xe031('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe031('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe031('0x12'));var Papa=require(_0xe031('0x13'));var Redis=require('ioredis');var authService=require(_0xe031('0x14'));var qs=require(_0xe031('0x15'));var as=require(_0xe031('0x16'));var hardwareService=require(_0xe031('0x17'));var logger=require(_0xe031('0x18'))(_0xe031('0x19'));var utils=require('../../config/utils');var config=require(_0xe031('0x1a'));var licenseUtil=require(_0xe031('0x1b'));var db=require(_0xe031('0x1c'))['db'];config[_0xe031('0x1d')]=_[_0xe031('0x1e')](config['redis'],{'host':_0xe031('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe031('0x1d')]));require(_0xe031('0x20'))['register'](socket);function respondWithStatusCode(_0x29e172,_0x3cffc6){_0x3cffc6=_0x3cffc6||0xcc;return function(_0x1a8d0a){if(_0x1a8d0a){return _0x29e172['sendStatus'](_0x3cffc6);}return _0x29e172[_0xe031('0x21')](_0x3cffc6)['end']();};}function respondWithResult(_0x3f9cbd,_0x5e103f){_0x5e103f=_0x5e103f||0xc8;return function(_0x7b19a0){if(_0x7b19a0){return _0x3f9cbd['status'](_0x5e103f)[_0xe031('0x22')](_0x7b19a0);}};}function respondWithFilteredResult(_0x45cec0,_0x2e351a){return function(_0x46afec){if(_0x46afec){var _0x1ca850=typeof _0x2e351a[_0xe031('0x23')]===_0xe031('0x24')&&typeof _0x2e351a[_0xe031('0x25')]===_0xe031('0x24');var _0xbfb5f7=_0x46afec[_0xe031('0x26')];var _0x3234c4=_0x1ca850?0x0:_0x2e351a[_0xe031('0x23')];var _0x24be84=_0x1ca850?_0x46afec[_0xe031('0x26')]:_0x2e351a[_0xe031('0x23')]+_0x2e351a['limit'];var _0x235e33;if(_0x24be84>=_0xbfb5f7){_0x24be84=_0xbfb5f7;_0x235e33=0xc8;}else{_0x235e33=0xce;}_0x45cec0[_0xe031('0x21')](_0x235e33);return _0x45cec0[_0xe031('0x27')](_0xe031('0x28'),_0x3234c4+'-'+_0x24be84+'/'+_0xbfb5f7)[_0xe031('0x22')](_0x46afec);}return null;};}function patchUpdates(_0x1b624a){return function(_0x4e958b){try{jsonpatch[_0xe031('0x29')](_0x4e958b,_0x1b624a,!![]);}catch(_0x2787cb){return BPromise[_0xe031('0x2a')](_0x2787cb);}return _0x4e958b[_0xe031('0x2b')]();};}function saveUpdates(_0x14fb39,_0x10aca2){return function(_0x2bc07a){if(_0x2bc07a){return _0x2bc07a[_0xe031('0x2c')](_0x14fb39)['then'](function(_0x5b06f8){return _0x5b06f8;});}return null;};}function removeEntity(_0x282239,_0x45f001){return function(_0x1af08a){if(_0x1af08a){return _0x1af08a[_0xe031('0x2d')]()[_0xe031('0x2e')](function(){var _0x4c2447=_0x1af08a[_0xe031('0x2f')]({'plain':!![]});var _0x125085=_0xe031('0x30');return db[_0xe031('0x31')]['destroy']({'where':{'type':_0x125085,'resourceId':_0x4c2447['id']}})[_0xe031('0x2e')](function(){return _0x1af08a;});})[_0xe031('0x2e')](function(){_0x282239[_0xe031('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca96c,_0x2b9019){return function(_0x70306a){if(!_0x70306a){_0x2ca96c[_0xe031('0x32')](0x194);}return _0x70306a;};}function handleError(_0x5e7c71,_0xa424d9){_0xa424d9=_0xa424d9||0x1f4;return function(_0x5323d6){logger[_0xe031('0x33')](_0x5323d6[_0xe031('0x34')]);if(_0x5323d6['name']){delete _0x5323d6[_0xe031('0x35')];}_0x5e7c71[_0xe031('0x21')](_0xa424d9)[_0xe031('0x36')](_0x5323d6);};}exports['index']=function(_0x408441,_0x38cd78){var _0x116cc8={},_0x12aff5={},_0xb3cbb={'count':0x0,'rows':[]};var _0x1841fc=_[_0xe031('0x37')](db[_0xe031('0x38')][_0xe031('0x39')],function(_0x52a473){return{'name':_0x52a473[_0xe031('0x3a')],'type':_0x52a473[_0xe031('0x3b')]['key']};});_0x12aff5['model']=_[_0xe031('0x37')](_0x1841fc,'name');_0x12aff5[_0xe031('0x3c')]=_[_0xe031('0x3d')](_0x408441[_0xe031('0x3c')]);_0x12aff5['filters']=_[_0xe031('0x3e')](_0x12aff5[_0xe031('0x3f')],_0x12aff5[_0xe031('0x3c')]);_0x116cc8[_0xe031('0x40')]=_[_0xe031('0x3e')](_0x12aff5[_0xe031('0x3f')],qs[_0xe031('0x41')](_0x408441[_0xe031('0x3c')][_0xe031('0x41')]));_0x116cc8[_0xe031('0x40')]=_0x116cc8['attributes']['length']?_0x116cc8[_0xe031('0x40')]:_0x12aff5[_0xe031('0x3f')];if(!_0x408441[_0xe031('0x3c')]['hasOwnProperty'](_0xe031('0x42'))){_0x116cc8[_0xe031('0x25')]=qs['limit'](_0x408441[_0xe031('0x3c')][_0xe031('0x25')]);_0x116cc8[_0xe031('0x23')]=qs['offset'](_0x408441[_0xe031('0x3c')][_0xe031('0x23')]);}_0x116cc8[_0xe031('0x43')]=qs[_0xe031('0x44')](_0x408441[_0xe031('0x3c')]['sort']);_0x116cc8['where']=qs['filters'](_['pick'](_0x408441[_0xe031('0x3c')],_0x12aff5[_0xe031('0x45')]),_0x1841fc);if(_0x408441[_0xe031('0x3c')][_0xe031('0x46')]){_0x116cc8[_0xe031('0x47')]=_['merge'](_0x116cc8['where'],{'$or':_[_0xe031('0x37')](_0x1841fc,function(_0x336721){if(_0x336721[_0xe031('0x3b')]!==_0xe031('0x48')){var _0x351b30={};_0x351b30[_0x336721['name']]={'$like':'%'+_0x408441[_0xe031('0x3c')]['filter']+'%'};return _0x351b30;}})});}_0x116cc8=_[_0xe031('0x49')]({},_0x116cc8,_0x408441[_0xe031('0x4a')]);var _0x392991={'where':_0x116cc8['where']};return db[_0xe031('0x38')][_0xe031('0x26')](_0x392991)[_0xe031('0x2e')](function(_0x191e97){_0xb3cbb[_0xe031('0x26')]=_0x191e97;if(_0x408441[_0xe031('0x3c')][_0xe031('0x4b')]){_0x116cc8['include']=[{'all':!![]}];}return db[_0xe031('0x38')]['findAll'](_0x116cc8);})[_0xe031('0x2e')](function(_0xd7fac9){_0xb3cbb[_0xe031('0x4c')]=_0xd7fac9;return _0xb3cbb;})['then'](respondWithFilteredResult(_0x38cd78,_0x116cc8))[_0xe031('0x4d')](handleError(_0x38cd78,null));};exports[_0xe031('0x4e')]=function(_0x31c385,_0x4b4c77){var _0x8ed9a7={'raw':![],'where':{'id':_0x31c385['params']['id']}},_0x171e5b={};_0x171e5b[_0xe031('0x3f')]=_[_0xe031('0x3d')](db['SquareProject'][_0xe031('0x39')]);_0x171e5b[_0xe031('0x3c')]=_[_0xe031('0x3d')](_0x31c385['query']);_0x171e5b[_0xe031('0x45')]=_[_0xe031('0x3e')](_0x171e5b[_0xe031('0x3f')],_0x171e5b[_0xe031('0x3c')]);_0x8ed9a7[_0xe031('0x40')]=_[_0xe031('0x3e')](_0x171e5b[_0xe031('0x3f')],qs['fields'](_0x31c385[_0xe031('0x3c')][_0xe031('0x41')]));_0x8ed9a7[_0xe031('0x40')]=_0x8ed9a7[_0xe031('0x40')][_0xe031('0x4f')]?_0x8ed9a7['attributes']:_0x171e5b[_0xe031('0x3f')];if(_0x31c385[_0xe031('0x3c')][_0xe031('0x4b')]){_0x8ed9a7['include']=[{'all':!![]}];}_0x8ed9a7=_[_0xe031('0x49')]({},_0x8ed9a7,_0x31c385[_0xe031('0x4a')]);return db[_0xe031('0x38')]['find'](_0x8ed9a7)[_0xe031('0x2e')](handleEntityNotFound(_0x4b4c77,null))[_0xe031('0x2e')](respondWithResult(_0x4b4c77,null))[_0xe031('0x4d')](handleError(_0x4b4c77,null));};exports['create']=function(_0x4420ba,_0x3aad89){return db[_0xe031('0x38')][_0xe031('0x50')](_0x4420ba[_0xe031('0x51')],{})[_0xe031('0x2e')](function(_0xd0ed6f){var _0x4065a0=_0x4420ba[_0xe031('0x52')][_0xe031('0x2f')]({'plain':!![]});if(!_0x4065a0)throw new Error(_0xe031('0x53'));if(_0x4065a0[_0xe031('0x54')]===_0xe031('0x52')){var _0x50bd81=_0xd0ed6f[_0xe031('0x2f')]({'plain':!![]});var _0xad0433=_0xe031('0x30');return db[_0xe031('0x55')]['find']({'where':{'name':_0xad0433,'userProfileId':_0x4065a0[_0xe031('0x56')]},'raw':!![]})[_0xe031('0x2e')](function(_0x554d4a){if(_0x554d4a&&_0x554d4a[_0xe031('0x57')]===0x0){return db[_0xe031('0x31')][_0xe031('0x50')]({'name':_0x50bd81[_0xe031('0x35')],'resourceId':_0x50bd81['id'],'type':_0x554d4a[_0xe031('0x35')],'sectionId':_0x554d4a['id']},{})[_0xe031('0x2e')](function(){return _0xd0ed6f;});}else{return _0xd0ed6f;}})[_0xe031('0x4d')](function(_0x3ae3fa){logger['error'](_0xe031('0x58'),_0x3ae3fa);throw _0x3ae3fa;});}return _0xd0ed6f;})['then'](respondWithResult(_0x3aad89,0xc9))[_0xe031('0x4d')](handleError(_0x3aad89,null));};exports[_0xe031('0x2c')]=function(_0x263af5,_0x3b91b4){if(_0x263af5[_0xe031('0x51')]['id']){delete _0x263af5[_0xe031('0x51')]['id'];}return db[_0xe031('0x38')][_0xe031('0x59')]({'where':{'id':_0x263af5[_0xe031('0x5a')]['id']}})[_0xe031('0x2e')](handleEntityNotFound(_0x3b91b4,null))[_0xe031('0x2e')](saveUpdates(_0x263af5[_0xe031('0x51')],null))[_0xe031('0x2e')](respondWithResult(_0x3b91b4,null))['catch'](handleError(_0x3b91b4,null));};exports['destroy']=function(_0x3b3a17,_0x23018e){return db['SquareProject'][_0xe031('0x59')]({'where':{'id':_0x3b3a17[_0xe031('0x5a')]['id']}})[_0xe031('0x2e')](handleEntityNotFound(_0x23018e,null))[_0xe031('0x2e')](removeEntity(_0x23018e,null))[_0xe031('0x4d')](handleError(_0x23018e,null));};exports[_0xe031('0x5b')]=function(_0x392f77,_0x1de3c1,_0x3bbf6e){return db[_0xe031('0x38')][_0xe031('0x59')]({'where':{'id':_0x392f77[_0xe031('0x5a')]['id']}})[_0xe031('0x2e')](handleEntityNotFound(_0x1de3c1,null))[_0xe031('0x2e')](function(_0x20b941){if(_0x20b941){return _0x20b941['addUsers'](_0x392f77[_0xe031('0x51')]['ids'],_[_0xe031('0x5c')](_0x392f77['body'],[_0xe031('0x5d'),'id'])||{});}})[_0xe031('0x2e')](respondWithResult(_0x1de3c1,null))[_0xe031('0x4d')](handleError(_0x1de3c1,null));};exports['removeUsers']=function(_0x479d69,_0x3aa10a,_0x5e4f01){return db[_0xe031('0x38')]['find']({'where':{'id':_0x479d69['params']['id']}})['then'](handleEntityNotFound(_0x3aa10a,null))[_0xe031('0x2e')](function(_0x2236bd){if(_0x2236bd){return _0x2236bd[_0xe031('0x5e')](_0x479d69[_0xe031('0x3c')][_0xe031('0x5d')])[_0xe031('0x2e')](function(){if(_[_0xe031('0x5f')](_0x479d69['query'][_0xe031('0x5d')])){for(var _0x55861b=0x0;_0x55861b<_0x479d69[_0xe031('0x3c')]['ids'][_0xe031('0x4f')];_0x55861b+=0x1){socket['emit'](_0xe031('0x60'),{'UserId':Number(_0x479d69['query'][_0xe031('0x5d')][_0x55861b]),'SquareProjectId':Number(_0x479d69[_0xe031('0x5a')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x479d69[_0xe031('0x3c')][_0xe031('0x5d')]),'SquareProjectId':Number(_0x479d69[_0xe031('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3aa10a,null))[_0xe031('0x4d')](handleError(_0x3aa10a,null));};exports[_0xe031('0x61')]=function(_0x34209f,_0x2653a1,_0x414160){var _0x4a97a3={};var _0xfffed1={};var _0x38cba1;var _0x5db9fe;return db[_0xe031('0x38')]['findOne']({'where':{'id':_0x34209f[_0xe031('0x5a')]['id']}})[_0xe031('0x2e')](handleEntityNotFound(_0x2653a1,null))['then'](function(_0x52899d){if(_0x52899d){_0x38cba1=_0x52899d;_0xfffed1[_0xe031('0x3f')]=_[_0xe031('0x3d')](db[_0xe031('0x62')][_0xe031('0x39')]);_0xfffed1[_0xe031('0x3c')]=_[_0xe031('0x3d')](_0x34209f[_0xe031('0x3c')]);_0xfffed1[_0xe031('0x45')]=_[_0xe031('0x3e')](_0xfffed1[_0xe031('0x3f')],_0xfffed1[_0xe031('0x3c')]);_0x4a97a3[_0xe031('0x40')]=_['intersection'](_0xfffed1[_0xe031('0x3f')],qs[_0xe031('0x41')](_0x34209f['query'][_0xe031('0x41')]));_0x4a97a3[_0xe031('0x40')]=_0x4a97a3[_0xe031('0x40')]['length']?_0x4a97a3[_0xe031('0x40')]:_0xfffed1[_0xe031('0x3f')];_0x4a97a3['order']=qs[_0xe031('0x44')](_0x34209f[_0xe031('0x3c')][_0xe031('0x44')]);_0x4a97a3[_0xe031('0x47')]=qs['filters'](_[_0xe031('0x63')](_0x34209f[_0xe031('0x3c')],_0xfffed1[_0xe031('0x45')]));if(_0x34209f['query'][_0xe031('0x46')]){_0x4a97a3[_0xe031('0x47')]=_[_0xe031('0x49')](_0x4a97a3[_0xe031('0x47')],{'$or':_[_0xe031('0x37')](_0x4a97a3[_0xe031('0x40')],function(_0x9bb859){var _0x267241={};_0x267241[_0x9bb859]={'$like':'%'+_0x34209f[_0xe031('0x3c')]['filter']+'%'};return _0x267241;})});}_0x4a97a3=_[_0xe031('0x49')]({},_0x4a97a3,_0x34209f[_0xe031('0x4a')]);return _0x38cba1['getUsers'](_0x4a97a3);}})[_0xe031('0x2e')](function(_0x4f2e4b){if(_0x4f2e4b){_0x5db9fe=_0x4f2e4b['length'];if(!_0x34209f[_0xe031('0x3c')]['hasOwnProperty']('nolimit')){_0x4a97a3[_0xe031('0x25')]=qs[_0xe031('0x25')](_0x34209f[_0xe031('0x3c')][_0xe031('0x25')]);_0x4a97a3[_0xe031('0x23')]=qs[_0xe031('0x23')](_0x34209f['query'][_0xe031('0x23')]);}return _0x38cba1[_0xe031('0x61')](_0x4a97a3);}})[_0xe031('0x2e')](function(_0x511f60){if(_0x511f60){return _0x511f60?{'count':_0x5db9fe,'rows':_0x511f60}:null;}})[_0xe031('0x2e')](respondWithResult(_0x2653a1,null))['catch'](handleError(_0x2653a1,null));}; \ No newline at end of file +var _0x0bde=['query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','includeAll','include','rows','catch','show','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','get','SquareProjects','UserProfileResource','error','name','send','index','map','SquareProject','type','key'];(function(_0x2c67d8,_0x7d6f94){var _0x366f27=function(_0x3dd3b0){while(--_0x3dd3b0){_0x2c67d8['push'](_0x2c67d8['shift']());}};_0x366f27(++_0x7d6f94);}(_0x0bde,0x1a5));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xe0bd('0x0'));var rimraf=require(_0xe0bd('0x1'));var zipdir=require(_0xe0bd('0x2'));var jsonpatch=require(_0xe0bd('0x3'));var rp=require('request-promise');var moment=require(_0xe0bd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe0bd('0x5'));var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0bd('0xa'));var squel=require('squel');var crypto=require(_0xe0bd('0xb'));var jsforce=require(_0xe0bd('0xc'));var deskjs=require(_0xe0bd('0xd'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0xe'));var Papa=require(_0xe0bd('0xf'));var Redis=require(_0xe0bd('0x10'));var authService=require(_0xe0bd('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bd('0x12'));var logger=require(_0xe0bd('0x13'))(_0xe0bd('0x14'));var utils=require(_0xe0bd('0x15'));var config=require(_0xe0bd('0x16'));var licenseUtil=require(_0xe0bd('0x17'));var db=require(_0xe0bd('0x18'))['db'];config['redis']=_[_0xe0bd('0x19')](config[_0xe0bd('0x1a')],{'host':_0xe0bd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0bd('0x1a')]));require('./squareProject.socket')[_0xe0bd('0x1c')](socket);function respondWithStatusCode(_0x1f3a7a,_0x37aa60){_0x37aa60=_0x37aa60||0xcc;return function(_0x1b4180){if(_0x1b4180){return _0x1f3a7a[_0xe0bd('0x1d')](_0x37aa60);}return _0x1f3a7a[_0xe0bd('0x1e')](_0x37aa60)[_0xe0bd('0x1f')]();};}function respondWithResult(_0xb74d4f,_0x542f4a){_0x542f4a=_0x542f4a||0xc8;return function(_0x198175){if(_0x198175){return _0xb74d4f[_0xe0bd('0x1e')](_0x542f4a)[_0xe0bd('0x20')](_0x198175);}};}function respondWithFilteredResult(_0x2728a0,_0x3207a6){return function(_0x350bd7){if(_0x350bd7){var _0x7b5ad2=typeof _0x3207a6[_0xe0bd('0x21')]===_0xe0bd('0x22')&&typeof _0x3207a6[_0xe0bd('0x23')]===_0xe0bd('0x22');var _0x4eaa4d=_0x350bd7[_0xe0bd('0x24')];var _0x2c001d=_0x7b5ad2?0x0:_0x3207a6[_0xe0bd('0x21')];var _0x292152=_0x7b5ad2?_0x350bd7[_0xe0bd('0x24')]:_0x3207a6[_0xe0bd('0x21')]+_0x3207a6[_0xe0bd('0x23')];var _0x45f062;if(_0x292152>=_0x4eaa4d){_0x292152=_0x4eaa4d;_0x45f062=0xc8;}else{_0x45f062=0xce;}_0x2728a0[_0xe0bd('0x1e')](_0x45f062);return _0x2728a0[_0xe0bd('0x25')]('Content-Range',_0x2c001d+'-'+_0x292152+'/'+_0x4eaa4d)['json'](_0x350bd7);}return null;};}function patchUpdates(_0x53f1b2){return function(_0x3bb1a2){try{jsonpatch[_0xe0bd('0x26')](_0x3bb1a2,_0x53f1b2,!![]);}catch(_0x2413d6){return BPromise['reject'](_0x2413d6);}return _0x3bb1a2[_0xe0bd('0x27')]();};}function saveUpdates(_0x127463,_0x462c72){return function(_0x247049){if(_0x247049){return _0x247049[_0xe0bd('0x28')](_0x127463)['then'](function(_0x55df9a){return _0x55df9a;});}return null;};}function removeEntity(_0x5cbcb9,_0x4dd4da){return function(_0x5c03f3){if(_0x5c03f3){return _0x5c03f3[_0xe0bd('0x29')]()[_0xe0bd('0x2a')](function(){var _0x47cb22=_0x5c03f3[_0xe0bd('0x2b')]({'plain':!![]});var _0x50434e=_0xe0bd('0x2c');return db[_0xe0bd('0x2d')][_0xe0bd('0x29')]({'where':{'type':_0x50434e,'resourceId':_0x47cb22['id']}})[_0xe0bd('0x2a')](function(){return _0x5c03f3;});})[_0xe0bd('0x2a')](function(){_0x5cbcb9[_0xe0bd('0x1e')](0xcc)[_0xe0bd('0x1f')]();});}};}function handleEntityNotFound(_0x5b6519,_0x252a57){return function(_0x2d9eb8){if(!_0x2d9eb8){_0x5b6519[_0xe0bd('0x1d')](0x194);}return _0x2d9eb8;};}function handleError(_0x17fbe0,_0x2ae646){_0x2ae646=_0x2ae646||0x1f4;return function(_0x555742){logger[_0xe0bd('0x2e')](_0x555742['stack']);if(_0x555742[_0xe0bd('0x2f')]){delete _0x555742[_0xe0bd('0x2f')];}_0x17fbe0['status'](_0x2ae646)[_0xe0bd('0x30')](_0x555742);};}exports[_0xe0bd('0x31')]=function(_0x7adc11,_0xa40b4b){var _0x2ad07a={},_0x1a1f1d={},_0x2153d3={'count':0x0,'rows':[]};var _0x4980f3=_[_0xe0bd('0x32')](db[_0xe0bd('0x33')]['rawAttributes'],function(_0x1f0c02){return{'name':_0x1f0c02['fieldName'],'type':_0x1f0c02[_0xe0bd('0x34')][_0xe0bd('0x35')]};});_0x1a1f1d['model']=_[_0xe0bd('0x32')](_0x4980f3,_0xe0bd('0x2f'));_0x1a1f1d[_0xe0bd('0x36')]=_[_0xe0bd('0x37')](_0x7adc11[_0xe0bd('0x36')]);_0x1a1f1d[_0xe0bd('0x38')]=_[_0xe0bd('0x39')](_0x1a1f1d[_0xe0bd('0x3a')],_0x1a1f1d[_0xe0bd('0x36')]);_0x2ad07a['attributes']=_[_0xe0bd('0x39')](_0x1a1f1d[_0xe0bd('0x3a')],qs[_0xe0bd('0x3b')](_0x7adc11[_0xe0bd('0x36')][_0xe0bd('0x3b')]));_0x2ad07a[_0xe0bd('0x3c')]=_0x2ad07a[_0xe0bd('0x3c')][_0xe0bd('0x3d')]?_0x2ad07a['attributes']:_0x1a1f1d[_0xe0bd('0x3a')];if(!_0x7adc11[_0xe0bd('0x36')]['hasOwnProperty'](_0xe0bd('0x3e'))){_0x2ad07a[_0xe0bd('0x23')]=qs[_0xe0bd('0x23')](_0x7adc11['query'][_0xe0bd('0x23')]);_0x2ad07a[_0xe0bd('0x21')]=qs[_0xe0bd('0x21')](_0x7adc11[_0xe0bd('0x36')][_0xe0bd('0x21')]);}_0x2ad07a[_0xe0bd('0x3f')]=qs[_0xe0bd('0x40')](_0x7adc11[_0xe0bd('0x36')]['sort']);_0x2ad07a[_0xe0bd('0x41')]=qs[_0xe0bd('0x38')](_[_0xe0bd('0x42')](_0x7adc11[_0xe0bd('0x36')],_0x1a1f1d['filters']),_0x4980f3);if(_0x7adc11[_0xe0bd('0x36')][_0xe0bd('0x43')]){_0x2ad07a[_0xe0bd('0x41')]=_['merge'](_0x2ad07a[_0xe0bd('0x41')],{'$or':_[_0xe0bd('0x32')](_0x4980f3,function(_0x5c64aa){if(_0x5c64aa[_0xe0bd('0x34')]!=='VIRTUAL'){var _0x4db872={};_0x4db872[_0x5c64aa[_0xe0bd('0x2f')]]={'$like':'%'+_0x7adc11['query']['filter']+'%'};return _0x4db872;}})});}_0x2ad07a=_['merge']({},_0x2ad07a,_0x7adc11['options']);var _0x5d3b78={'where':_0x2ad07a[_0xe0bd('0x41')]};return db[_0xe0bd('0x33')][_0xe0bd('0x24')](_0x5d3b78)[_0xe0bd('0x2a')](function(_0x5d3cd2){_0x2153d3[_0xe0bd('0x24')]=_0x5d3cd2;if(_0x7adc11[_0xe0bd('0x36')][_0xe0bd('0x44')]){_0x2ad07a[_0xe0bd('0x45')]=[{'all':!![]}];}return db[_0xe0bd('0x33')]['findAll'](_0x2ad07a);})[_0xe0bd('0x2a')](function(_0x103cd9){_0x2153d3[_0xe0bd('0x46')]=_0x103cd9;return _0x2153d3;})[_0xe0bd('0x2a')](respondWithFilteredResult(_0xa40b4b,_0x2ad07a))[_0xe0bd('0x47')](handleError(_0xa40b4b,null));};exports[_0xe0bd('0x48')]=function(_0xd4d900,_0x50eefb){var _0x1c872e={'raw':![],'where':{'id':_0xd4d900['params']['id']}},_0x1bf320={};_0x1bf320[_0xe0bd('0x3a')]=_['keys'](db[_0xe0bd('0x33')]['rawAttributes']);_0x1bf320[_0xe0bd('0x36')]=_[_0xe0bd('0x37')](_0xd4d900[_0xe0bd('0x36')]);_0x1bf320[_0xe0bd('0x38')]=_['intersection'](_0x1bf320[_0xe0bd('0x3a')],_0x1bf320[_0xe0bd('0x36')]);_0x1c872e[_0xe0bd('0x3c')]=_['intersection'](_0x1bf320[_0xe0bd('0x3a')],qs[_0xe0bd('0x3b')](_0xd4d900[_0xe0bd('0x36')][_0xe0bd('0x3b')]));_0x1c872e[_0xe0bd('0x3c')]=_0x1c872e[_0xe0bd('0x3c')]['length']?_0x1c872e[_0xe0bd('0x3c')]:_0x1bf320[_0xe0bd('0x3a')];if(_0xd4d900['query'][_0xe0bd('0x44')]){_0x1c872e[_0xe0bd('0x45')]=[{'all':!![]}];}_0x1c872e=_[_0xe0bd('0x49')]({},_0x1c872e,_0xd4d900[_0xe0bd('0x4a')]);return db[_0xe0bd('0x33')][_0xe0bd('0x4b')](_0x1c872e)[_0xe0bd('0x2a')](handleEntityNotFound(_0x50eefb,null))['then'](respondWithResult(_0x50eefb,null))[_0xe0bd('0x47')](handleError(_0x50eefb,null));};exports[_0xe0bd('0x4c')]=function(_0xdf704d,_0x24343d){return db['SquareProject'][_0xe0bd('0x4c')](_0xdf704d[_0xe0bd('0x4d')],{})[_0xe0bd('0x2a')](function(_0x5ee64d){var _0x413321=_0xdf704d[_0xe0bd('0x4e')][_0xe0bd('0x2b')]({'plain':!![]});if(!_0x413321)throw new Error(_0xe0bd('0x4f'));if(_0x413321[_0xe0bd('0x50')]===_0xe0bd('0x4e')){var _0x3db61b=_0x5ee64d[_0xe0bd('0x2b')]({'plain':!![]});var _0x34c12d='SquareProjects';return db[_0xe0bd('0x51')][_0xe0bd('0x4b')]({'where':{'name':_0x34c12d,'userProfileId':_0x413321[_0xe0bd('0x52')]},'raw':!![]})[_0xe0bd('0x2a')](function(_0x13994b){if(_0x13994b&&_0x13994b[_0xe0bd('0x53')]===0x0){return db[_0xe0bd('0x2d')][_0xe0bd('0x4c')]({'name':_0x3db61b[_0xe0bd('0x2f')],'resourceId':_0x3db61b['id'],'type':_0x13994b[_0xe0bd('0x2f')],'sectionId':_0x13994b['id']},{})[_0xe0bd('0x2a')](function(){return _0x5ee64d;});}else{return _0x5ee64d;}})[_0xe0bd('0x47')](function(_0x2d3b92){logger[_0xe0bd('0x2e')](_0xe0bd('0x54'),_0x2d3b92);throw _0x2d3b92;});}return _0x5ee64d;})[_0xe0bd('0x2a')](respondWithResult(_0x24343d,0xc9))[_0xe0bd('0x47')](handleError(_0x24343d,null));};exports['update']=function(_0x1b51d5,_0x48978e){if(_0x1b51d5['body']['id']){delete _0x1b51d5[_0xe0bd('0x4d')]['id'];}return db['SquareProject'][_0xe0bd('0x4b')]({'where':{'id':_0x1b51d5[_0xe0bd('0x55')]['id']}})[_0xe0bd('0x2a')](handleEntityNotFound(_0x48978e,null))[_0xe0bd('0x2a')](saveUpdates(_0x1b51d5[_0xe0bd('0x4d')],null))[_0xe0bd('0x2a')](respondWithResult(_0x48978e,null))['catch'](handleError(_0x48978e,null));};exports['destroy']=function(_0x445fc4,_0x405ae1){return db['SquareProject']['find']({'where':{'id':_0x445fc4[_0xe0bd('0x55')]['id']}})[_0xe0bd('0x2a')](handleEntityNotFound(_0x405ae1,null))['then'](removeEntity(_0x405ae1,null))[_0xe0bd('0x47')](handleError(_0x405ae1,null));};exports[_0xe0bd('0x56')]=function(_0x43eaca,_0x27aaf1,_0x381eae){return db[_0xe0bd('0x33')]['find']({'where':{'id':_0x43eaca['params']['id']}})['then'](handleEntityNotFound(_0x27aaf1,null))[_0xe0bd('0x2a')](function(_0x4e7a93){if(_0x4e7a93){return _0x4e7a93[_0xe0bd('0x56')](_0x43eaca[_0xe0bd('0x4d')]['ids'],_[_0xe0bd('0x57')](_0x43eaca[_0xe0bd('0x4d')],[_0xe0bd('0x58'),'id'])||{});}})[_0xe0bd('0x2a')](respondWithResult(_0x27aaf1,null))[_0xe0bd('0x47')](handleError(_0x27aaf1,null));};exports[_0xe0bd('0x59')]=function(_0x49ca20,_0x9aeb19,_0xea7491){return db['SquareProject'][_0xe0bd('0x4b')]({'where':{'id':_0x49ca20[_0xe0bd('0x55')]['id']}})[_0xe0bd('0x2a')](handleEntityNotFound(_0x9aeb19,null))[_0xe0bd('0x2a')](function(_0x4b6b21){if(_0x4b6b21){return _0x4b6b21[_0xe0bd('0x59')](_0x49ca20[_0xe0bd('0x36')][_0xe0bd('0x58')])[_0xe0bd('0x2a')](function(){if(_[_0xe0bd('0x5a')](_0x49ca20[_0xe0bd('0x36')]['ids'])){for(var _0x1bed38=0x0;_0x1bed38<_0x49ca20[_0xe0bd('0x36')][_0xe0bd('0x58')][_0xe0bd('0x3d')];_0x1bed38+=0x1){socket[_0xe0bd('0x5b')](_0xe0bd('0x5c'),{'UserId':Number(_0x49ca20[_0xe0bd('0x36')][_0xe0bd('0x58')][_0x1bed38]),'SquareProjectId':Number(_0x49ca20[_0xe0bd('0x55')]['id'])});}}else{socket['emit'](_0xe0bd('0x5c'),{'UserId':Number(_0x49ca20[_0xe0bd('0x36')][_0xe0bd('0x58')]),'SquareProjectId':Number(_0x49ca20['params']['id'])});}});}})[_0xe0bd('0x2a')](respondWithStatusCode(_0x9aeb19,null))['catch'](handleError(_0x9aeb19,null));};exports[_0xe0bd('0x5d')]=function(_0x368e14,_0xe8e8b5,_0x156599){var _0x3baddd={};var _0x4f31f2={};var _0xe0c5b;var _0x435385;return db[_0xe0bd('0x33')]['findOne']({'where':{'id':_0x368e14[_0xe0bd('0x55')]['id']}})[_0xe0bd('0x2a')](handleEntityNotFound(_0xe8e8b5,null))[_0xe0bd('0x2a')](function(_0x5c2c5b){if(_0x5c2c5b){_0xe0c5b=_0x5c2c5b;_0x4f31f2['model']=_[_0xe0bd('0x37')](db[_0xe0bd('0x5e')]['rawAttributes']);_0x4f31f2[_0xe0bd('0x36')]=_['keys'](_0x368e14[_0xe0bd('0x36')]);_0x4f31f2['filters']=_['intersection'](_0x4f31f2['model'],_0x4f31f2['query']);_0x3baddd['attributes']=_['intersection'](_0x4f31f2[_0xe0bd('0x3a')],qs[_0xe0bd('0x3b')](_0x368e14[_0xe0bd('0x36')][_0xe0bd('0x3b')]));_0x3baddd[_0xe0bd('0x3c')]=_0x3baddd[_0xe0bd('0x3c')][_0xe0bd('0x3d')]?_0x3baddd[_0xe0bd('0x3c')]:_0x4f31f2['model'];_0x3baddd[_0xe0bd('0x3f')]=qs[_0xe0bd('0x40')](_0x368e14['query'][_0xe0bd('0x40')]);_0x3baddd[_0xe0bd('0x41')]=qs['filters'](_[_0xe0bd('0x42')](_0x368e14['query'],_0x4f31f2[_0xe0bd('0x38')]));if(_0x368e14[_0xe0bd('0x36')]['filter']){_0x3baddd[_0xe0bd('0x41')]=_['merge'](_0x3baddd[_0xe0bd('0x41')],{'$or':_[_0xe0bd('0x32')](_0x3baddd[_0xe0bd('0x3c')],function(_0xb020bf){var _0x450d50={};_0x450d50[_0xb020bf]={'$like':'%'+_0x368e14[_0xe0bd('0x36')][_0xe0bd('0x43')]+'%'};return _0x450d50;})});}_0x3baddd=_[_0xe0bd('0x49')]({},_0x3baddd,_0x368e14[_0xe0bd('0x4a')]);return _0xe0c5b[_0xe0bd('0x5d')](_0x3baddd);}})[_0xe0bd('0x2a')](function(_0x3eff5a){if(_0x3eff5a){_0x435385=_0x3eff5a['length'];if(!_0x368e14[_0xe0bd('0x36')]['hasOwnProperty']('nolimit')){_0x3baddd[_0xe0bd('0x23')]=qs[_0xe0bd('0x23')](_0x368e14[_0xe0bd('0x36')][_0xe0bd('0x23')]);_0x3baddd[_0xe0bd('0x21')]=qs[_0xe0bd('0x21')](_0x368e14[_0xe0bd('0x36')][_0xe0bd('0x21')]);}return _0xe0c5b['getUsers'](_0x3baddd);}})['then'](function(_0x19395e){if(_0x19395e){return _0x19395e?{'count':_0x435385,'rows':_0x19395e}:null;}})[_0xe0bd('0x2a')](respondWithResult(_0xe8e8b5,null))[_0xe0bd('0x47')](handleError(_0xe8e8b5,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8e0a548..ec21400 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 _0x05fa=['update','remove','emit','hasOwnProperty','hook','events','SquareProject','setMaxListeners','save'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x05fa,0x10a));var _0xa05f=function(_0x383523,_0x262138){_0x383523=_0x383523-0x0;var _0x29c502=_0x05fa[_0x383523];return _0x29c502;};'use strict';var EventEmitter=require(_0xa05f('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa05f('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa05f('0x2')](0x0);var events={'afterCreate':_0xa05f('0x3'),'afterUpdate':_0xa05f('0x4'),'afterDestroy':_0xa05f('0x5')};function emitEvent(_0x55ef7f){return function(_0x1c2381,_0x180688,_0x12d91b){SquareProjectEvents[_0xa05f('0x6')](_0x55ef7f+':'+_0x1c2381['id'],_0x1c2381);SquareProjectEvents[_0xa05f('0x6')](_0x55ef7f,_0x1c2381);_0x12d91b(null);};}for(var e in events){if(events[_0xa05f('0x7')](e)){var event=events[e];SquareProject[_0xa05f('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xd737=['../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xd737,0x170));var _0x7d73=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0xd737[_0x493a51];return _0xc85756;};'use strict';var EventEmitter=require(_0x7d73('0x0'));var SquareProject=require(_0x7d73('0x1'))['db'][_0x7d73('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7d73('0x3')](0x0);var events={'afterCreate':_0x7d73('0x4'),'afterUpdate':'update','afterDestroy':_0x7d73('0x5')};function emitEvent(_0x3b18d2){return function(_0x1b46e8,_0x3e5493,_0x3cac4a){SquareProjectEvents[_0x7d73('0x6')](_0x3b18d2+':'+_0x1b46e8['id'],_0x1b46e8);SquareProjectEvents['emit'](_0x3b18d2,_0x1b46e8);_0x3cac4a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x7d73('0x7')](e,emitEvent(event));}}module[_0x7d73('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b188d6c..4d43711 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 _0x7e08=['./squareProject.attributes','exports','define','SquareProject','square_projects','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x4e28e2,_0x287b19){var _0x9bd1ee=function(_0xcee473){while(--_0xcee473){_0x4e28e2['push'](_0x4e28e2['shift']());}};_0x9bd1ee(++_0x287b19);}(_0x7e08,0x1f3));var _0x87e0=function(_0x4df35d,_0x105bde){_0x4df35d=_0x4df35d-0x0;var _0x29e715=_0x7e08[_0x4df35d];return _0x29e715;};'use strict';var _=require(_0x87e0('0x0'));var util=require('util');var logger=require(_0x87e0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x87e0('0x2'));var rp=require(_0x87e0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x87e0('0x4'));var attributes=require(_0x87e0('0x5'));module[_0x87e0('0x6')]=function(_0x97be89,_0x358e9c){return _0x97be89[_0x87e0('0x7')](_0x87e0('0x8'),attributes,{'tableName':_0x87e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x476ac6,_0x667e9f,_0x3a95f4){if(_0x476ac6['changed']('preproduction')){_0x476ac6[_0x87e0('0xa')]=moment()[_0x87e0('0xb')](_0x87e0('0xc'));}if(_0x476ac6['changed'](_0x87e0('0xd'))){_0x476ac6['publishedAt']=moment()['format'](_0x87e0('0xc'));}_0x3a95f4(null,_0x476ac6);}}});}; \ No newline at end of file +var _0x5398=['square_projects','preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','exports','define'];(function(_0x510bbf,_0x223db9){var _0x21def9=function(_0xbabb40){while(--_0xbabb40){_0x510bbf['push'](_0x510bbf['shift']());}};_0x21def9(++_0x223db9);}(_0x5398,0x1ce));var _0x8539=function(_0x550936,_0x404c35){_0x550936=_0x550936-0x0;var _0x1539a8=_0x5398[_0x550936];return _0x1539a8;};'use strict';var _=require(_0x8539('0x0'));var util=require('util');var logger=require(_0x8539('0x1'))('api');var moment=require(_0x8539('0x2'));var BPromise=require(_0x8539('0x3'));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('./squareProject.attributes');module[_0x8539('0x4')]=function(_0x4fde8d,_0x575078){return _0x4fde8d[_0x8539('0x5')]('SquareProject',attributes,{'tableName':_0x8539('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ff480,_0x3eaecd,_0x158e2c){if(_0x1ff480['changed'](_0x8539('0x7'))){_0x1ff480[_0x8539('0x8')]=moment()[_0x8539('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1ff480['changed'](_0x8539('0xa'))){_0x1ff480['publishedAt']=moment()[_0x8539('0x9')](_0x8539('0xb'));}_0x158e2c(null,_0x1ff480);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 939ac18..7437e7a 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 _0xd021=['request\x20sent','debug','stringify','error','code','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','map','include','model','attributes','lodash','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s'];(function(_0x3d11ed,_0x47a4b8){var _0xbbd56c=function(_0x49b4d7){while(--_0x49b4d7){_0x3d11ed['push'](_0x3d11ed['shift']());}};_0xbbd56c(++_0x47a4b8);}(_0xd021,0x17c));var _0x1d02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd021[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d02('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d02('0x1'));var fs=require('fs');var Redis=require(_0x1d02('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d02('0x3'));var logger=require(_0x1d02('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1d02('0x5'));var client=jayson['client'][_0x1d02('0x6')]({'port':0x232a});config[_0x1d02('0x7')]=_[_0x1d02('0x8')](config['redis'],{'host':_0x1d02('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d02('0x7')]));require(_0x1d02('0xa'))[_0x1d02('0xb')](socket);function respondWithRpcPromise(_0x3988e5,_0xf83cec,_0xb4d4dc){return new BPromise(function(_0x2a56a9,_0x371bd5){return client[_0x1d02('0xc')](_0x3988e5,_0xb4d4dc)[_0x1d02('0xd')](function(_0x33f4cc){logger[_0x1d02('0xe')](_0x1d02('0xf'),_0xf83cec,_0x1d02('0x10'));logger[_0x1d02('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0xf83cec,_0x1d02('0x10'),JSON[_0x1d02('0x12')](_0x33f4cc));if(_0x33f4cc[_0x1d02('0x13')]){if(_0x33f4cc[_0x1d02('0x13')][_0x1d02('0x14')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0xf83cec,_0x33f4cc[_0x1d02('0x13')][_0x1d02('0x15')]);return _0x371bd5(_0x33f4cc[_0x1d02('0x13')][_0x1d02('0x15')]);}logger[_0x1d02('0x13')](_0x1d02('0xf'),_0xf83cec,_0x33f4cc[_0x1d02('0x13')]['message']);return _0x2a56a9(_0x33f4cc['error'][_0x1d02('0x15')]);}else{logger[_0x1d02('0xe')](_0x1d02('0xf'),_0xf83cec,_0x1d02('0x10'));_0x2a56a9(_0x33f4cc['result'][_0x1d02('0x15')]);}})[_0x1d02('0x16')](function(_0x4c5e74){logger[_0x1d02('0x13')](_0x1d02('0xf'),_0xf83cec,_0x4c5e74);_0x371bd5(_0x4c5e74);});});}exports[_0x1d02('0x17')]=function(_0x5dddfa){var _0x7c87ac=this;return new Promise(function(_0x3c8d53,_0x3ece32){return db[_0x1d02('0x18')][_0x1d02('0x19')]({'raw':_0x5dddfa[_0x1d02('0x1a')]?_0x5dddfa[_0x1d02('0x1a')][_0x1d02('0x1b')]===undefined?!![]:![]:!![],'where':_0x5dddfa[_0x1d02('0x1a')]?_0x5dddfa['options'][_0x1d02('0x1c')]||null:null,'attributes':_0x5dddfa['options']?_0x5dddfa[_0x1d02('0x1a')]['attributes']||null:null,'include':_0x5dddfa[_0x1d02('0x1a')]?_0x5dddfa[_0x1d02('0x1a')]['include']?_[_0x1d02('0x1d')](_0x5dddfa['options'][_0x1d02('0x1e')],function(_0x59525f){return{'model':db[_0x59525f[_0x1d02('0x1f')]],'as':_0x59525f['as'],'attributes':_0x59525f[_0x1d02('0x20')],'include':_0x59525f['include']?_[_0x1d02('0x1d')](_0x59525f[_0x1d02('0x1e')],function(_0x28b2d9){return{'model':db[_0x28b2d9[_0x1d02('0x1f')]],'as':_0x28b2d9['as'],'attributes':_0x28b2d9[_0x1d02('0x20')],'include':_0x28b2d9[_0x1d02('0x1e')]?_[_0x1d02('0x1d')](_0x28b2d9[_0x1d02('0x1e')],function(_0x5df705){return{'model':db[_0x5df705[_0x1d02('0x1f')]],'as':_0x5df705['as'],'attributes':_0x5df705[_0x1d02('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1d02('0xd')](function(_0x4e15d7){logger[_0x1d02('0xe')](_0x1d02('0x17'),_0x5dddfa);logger[_0x1d02('0x11')](_0x1d02('0x17'),_0x5dddfa,JSON['stringify'](_0x4e15d7));_0x3c8d53(_0x4e15d7);})[_0x1d02('0x16')](function(_0x1c767f){logger[_0x1d02('0x13')](_0x1d02('0x17'),_0x1c767f[_0x1d02('0x15')],_0x5dddfa);_0x3ece32(_0x7c87ac[_0x1d02('0x13')](0x1f4,_0x1c767f[_0x1d02('0x15')]));});});}; \ No newline at end of file +var _0xee48=['info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','include','model','attributes','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xee48,0x1cb));var _0x8ee4=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xee48[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x8ee4('0x0'));var util=require(_0x8ee4('0x1'));var moment=require(_0x8ee4('0x2'));var BPromise=require(_0x8ee4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ee4('0x4'));var db=require(_0x8ee4('0x5'))['db'];var utils=require(_0x8ee4('0x6'));var logger=require(_0x8ee4('0x7'))(_0x8ee4('0x8'));var config=require(_0x8ee4('0x9'));var jayson=require(_0x8ee4('0xa'));var client=jayson[_0x8ee4('0xb')][_0x8ee4('0xc')]({'port':0x232a});config['redis']=_[_0x8ee4('0xd')](config[_0x8ee4('0xe')],{'host':_0x8ee4('0xf'),'port':0x18eb});var socket=require(_0x8ee4('0x10'))(new Redis(config[_0x8ee4('0xe')]));require(_0x8ee4('0x11'))[_0x8ee4('0x12')](socket);function respondWithRpcPromise(_0x18a52c,_0x533fa5,_0x42f0a5){return new BPromise(function(_0x2441cb,_0x3e3b6b){return client[_0x8ee4('0x13')](_0x18a52c,_0x42f0a5)[_0x8ee4('0x14')](function(_0x59767e){logger[_0x8ee4('0x15')](_0x8ee4('0x16'),_0x533fa5,_0x8ee4('0x17'));logger[_0x8ee4('0x18')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x533fa5,_0x8ee4('0x17'),JSON[_0x8ee4('0x19')](_0x59767e));if(_0x59767e[_0x8ee4('0x1a')]){if(_0x59767e[_0x8ee4('0x1a')][_0x8ee4('0x1b')]===0x1f4){logger['error'](_0x8ee4('0x16'),_0x533fa5,_0x59767e['error'][_0x8ee4('0x1c')]);return _0x3e3b6b(_0x59767e['error'][_0x8ee4('0x1c')]);}logger['error'](_0x8ee4('0x16'),_0x533fa5,_0x59767e['error'][_0x8ee4('0x1c')]);return _0x2441cb(_0x59767e[_0x8ee4('0x1a')][_0x8ee4('0x1c')]);}else{logger[_0x8ee4('0x15')](_0x8ee4('0x16'),_0x533fa5,_0x8ee4('0x17'));_0x2441cb(_0x59767e[_0x8ee4('0x1d')]['message']);}})[_0x8ee4('0x1e')](function(_0x2e9a7e){logger[_0x8ee4('0x1a')](_0x8ee4('0x16'),_0x533fa5,_0x2e9a7e);_0x3e3b6b(_0x2e9a7e);});});}exports[_0x8ee4('0x1f')]=function(_0x1f06d7){var _0x1a201d=this;return new Promise(function(_0x4f45ad,_0x3fdec6){return db[_0x8ee4('0x20')][_0x8ee4('0x21')]({'raw':_0x1f06d7[_0x8ee4('0x22')]?_0x1f06d7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f06d7[_0x8ee4('0x22')]?_0x1f06d7[_0x8ee4('0x22')][_0x8ee4('0x23')]||null:null,'attributes':_0x1f06d7[_0x8ee4('0x22')]?_0x1f06d7['options']['attributes']||null:null,'include':_0x1f06d7[_0x8ee4('0x22')]?_0x1f06d7['options'][_0x8ee4('0x24')]?_['map'](_0x1f06d7[_0x8ee4('0x22')][_0x8ee4('0x24')],function(_0x37167d){return{'model':db[_0x37167d[_0x8ee4('0x25')]],'as':_0x37167d['as'],'attributes':_0x37167d[_0x8ee4('0x26')],'include':_0x37167d[_0x8ee4('0x24')]?_[_0x8ee4('0x27')](_0x37167d[_0x8ee4('0x24')],function(_0x4bc564){return{'model':db[_0x4bc564[_0x8ee4('0x25')]],'as':_0x4bc564['as'],'attributes':_0x4bc564[_0x8ee4('0x26')],'include':_0x4bc564[_0x8ee4('0x24')]?_[_0x8ee4('0x27')](_0x4bc564[_0x8ee4('0x24')],function(_0x52c0d7){return{'model':db[_0x52c0d7['model']],'as':_0x52c0d7['as'],'attributes':_0x52c0d7[_0x8ee4('0x26')]};}):[]};}):[]};}):[]:[]})[_0x8ee4('0x14')](function(_0xa650f8){logger[_0x8ee4('0x15')](_0x8ee4('0x1f'),_0x1f06d7);logger['debug'](_0x8ee4('0x1f'),_0x1f06d7,JSON[_0x8ee4('0x19')](_0xa650f8));_0x4f45ad(_0xa650f8);})[_0x8ee4('0x1e')](function(_0x391a33){logger[_0x8ee4('0x1a')](_0x8ee4('0x1f'),_0x391a33[_0x8ee4('0x1c')],_0x1f06d7);_0x3fdec6(_0x1a201d[_0x8ee4('0x1a')](0x1f4,_0x391a33[_0x8ee4('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d6d87bd..a547e0c 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 _0xdf47=['register','squareProject:','./squareProject.events','save','update','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf47,0x110));var _0x7df4=function(_0xa3b49f,_0x32efbb){_0xa3b49f=_0xa3b49f-0x0;var _0x3a1710=_0xdf47[_0xa3b49f];return _0x3a1710;};'use strict';var SquareProjectEvents=require(_0x7df4('0x0'));var events=[_0x7df4('0x1'),'remove',_0x7df4('0x2')];function createListener(_0x5e474d,_0xde61c5){return function(_0x2ed8b5){_0xde61c5['emit'](_0x5e474d,_0x2ed8b5);};}function removeListener(_0x51d4c9,_0x11d6a2){return function(){SquareProjectEvents[_0x7df4('0x3')](_0x51d4c9,_0x11d6a2);};}exports[_0x7df4('0x4')]=function(_0x303259){for(var _0x43ea25=0x0,_0x3b505e=events['length'];_0x43ea25<_0x3b505e;_0x43ea25++){var _0x5d7d37=events[_0x43ea25];var _0x33c1ce=createListener(_0x7df4('0x5')+_0x5d7d37,_0x303259);SquareProjectEvents['on'](_0x5d7d37,_0x33c1ce);}}; \ No newline at end of file +var _0xb7ad=['length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x499cf2,_0x552608){var _0x2e75d2=function(_0x575ecb){while(--_0x575ecb){_0x499cf2['push'](_0x499cf2['shift']());}};_0x2e75d2(++_0x552608);}(_0xb7ad,0x110));var _0xdb7a=function(_0x3d7b37,_0x4610f1){_0x3d7b37=_0x3d7b37-0x0;var _0x199798=_0xb7ad[_0x3d7b37];return _0x199798;};'use strict';var SquareProjectEvents=require(_0xdb7a('0x0'));var events=[_0xdb7a('0x1'),_0xdb7a('0x2'),_0xdb7a('0x3')];function createListener(_0x339d62,_0x2e22e9){return function(_0x48c2fd){_0x2e22e9[_0xdb7a('0x4')](_0x339d62,_0x48c2fd);};}function removeListener(_0x4566ca,_0x492789){return function(){SquareProjectEvents[_0xdb7a('0x5')](_0x4566ca,_0x492789);};}exports[_0xdb7a('0x6')]=function(_0x16280c){for(var _0x5279c5=0x0,_0x39373c=events[_0xdb7a('0x7')];_0x5279c5<_0x39373c;_0x5279c5++){var _0x494439=events[_0x5279c5];var _0x5a9fb7=createListener(_0xdb7a('0x8')+_0x494439,_0x16280c);SquareProjectEvents['on'](_0x494439,_0x5a9fb7);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e18ce7d..1cc47c8 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x2ec06f,_0x3bb56d){var _0x3a1c71=function(_0x5ca631){while(--_0x5ca631){_0x2ec06f['push'](_0x2ec06f['shift']());}};_0x3a1c71(++_0x3bb56d);}(_0x326f,0xd1));var _0xf326=function(_0x59ec60,_0x2305f2){_0x59ec60=_0x59ec60-0x0;var _0x1a2a93=_0x326f[_0x59ec60];return _0x1a2a93;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x8d7c19,_0x49500d){var _0x5ed8c9=function(_0x4489d7){while(--_0x4489d7){_0x8d7c19['push'](_0x8d7c19['shift']());}};_0x5ed8c9(++_0x49500d);}(_0x53ec,0x192));var _0xc53e=function(_0xdaffc7,_0x453662){_0xdaffc7=_0xdaffc7-0x0;var _0x503d65=_0x53ec[_0xdaffc7];return _0x503d65;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 55efbab..3de4b88 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 _0x55ca=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x55ca,0x126));var _0xa55c=function(_0x32cce8,_0x18762f){_0x32cce8=_0x32cce8-0x0;var _0x4a732b=_0x55ca[_0x32cce8];return _0x4a732b;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa55c('0x2')]},'extension':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'dnid':{'type':Sequelize[_0xa55c('0x2')]},'projectName':{'type':Sequelize[_0xa55c('0x2')]},'saveName':{'type':Sequelize[_0xa55c('0x2')]},'filename':{'type':Sequelize[_0xa55c('0x2')]},'savePath':{'type':Sequelize[_0xa55c('0x2')]},'format':{'type':Sequelize[_0xa55c('0x3')],'get':function(){var _0x4d0624='';var _0x2121fd=this[_0xa55c('0x4')]('savePath');if(_0x2121fd){_0x4d0624=_0x2121fd[_0xa55c('0x5')](_0x2121fd[_0xa55c('0x6')]('.'));}return _0x4d0624;}}}; \ No newline at end of file +var _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x522c9d,_0x323a25){var _0x3aabcf=function(_0x43717b){while(--_0x43717b){_0x522c9d['push'](_0x522c9d['shift']());}};_0x3aabcf(++_0x323a25);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x48b4bd,_0x53a810){_0x48b4bd=_0x48b4bd-0x0;var _0x378976=_0xdbf5[_0x48b4bd];return _0x378976;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c176b39..6dc8222 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 _0x455a=['map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','update','download','uniqueid','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x455a,0x100));var _0xa455=function(_0x54b9c6,_0x2c697e){_0x54b9c6=_0x54b9c6-0x0;var _0x251824=_0x455a[_0x54b9c6];return _0x251824;};'use strict';var emlformat=require(_0xa455('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa455('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa455('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa455('0x3'));var path=require(_0xa455('0x4'));var sox=require('sox');var csv=require(_0xa455('0x5'));var ejs=require(_0xa455('0x6'));var fs=require('fs');var fs_extra=require(_0xa455('0x7'));var _=require(_0xa455('0x8'));var squel=require('squel');var crypto=require(_0xa455('0x9'));var jsforce=require(_0xa455('0xa'));var deskjs=require(_0xa455('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa455('0xc'));var Redis=require(_0xa455('0xd'));var authService=require(_0xa455('0xe'));var qs=require(_0xa455('0xf'));var as=require(_0xa455('0x10'));var hardwareService=require(_0xa455('0x11'));var logger=require(_0xa455('0x12'))(_0xa455('0x13'));var utils=require(_0xa455('0x14'));var config=require(_0xa455('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe53273,_0x5ead88){_0x5ead88=_0x5ead88||0xcc;return function(_0x4405eb){if(_0x4405eb){return _0xe53273['sendStatus'](_0x5ead88);}return _0xe53273[_0xa455('0x16')](_0x5ead88)[_0xa455('0x17')]();};}function respondWithResult(_0x3c7aad,_0x389696){_0x389696=_0x389696||0xc8;return function(_0x587cdd){if(_0x587cdd){return _0x3c7aad[_0xa455('0x16')](_0x389696)['json'](_0x587cdd);}};}function respondWithFilteredResult(_0x1f1d66,_0x4572b9){return function(_0x3f977d){if(_0x3f977d){var _0x46a7c3=typeof _0x4572b9[_0xa455('0x18')]==='undefined'&&typeof _0x4572b9[_0xa455('0x19')]===_0xa455('0x1a');var _0x59852f=_0x3f977d['count'];var _0x1c0c2a=_0x46a7c3?0x0:_0x4572b9['offset'];var _0x15f2b8=_0x46a7c3?_0x3f977d[_0xa455('0x1b')]:_0x4572b9['offset']+_0x4572b9['limit'];var _0x52a689;if(_0x15f2b8>=_0x59852f){_0x15f2b8=_0x59852f;_0x52a689=0xc8;}else{_0x52a689=0xce;}_0x1f1d66[_0xa455('0x16')](_0x52a689);return _0x1f1d66[_0xa455('0x1c')](_0xa455('0x1d'),_0x1c0c2a+'-'+_0x15f2b8+'/'+_0x59852f)['json'](_0x3f977d);}return null;};}function patchUpdates(_0x238e4f){return function(_0x4941b4){try{jsonpatch[_0xa455('0x1e')](_0x4941b4,_0x238e4f,!![]);}catch(_0x5723c6){return BPromise[_0xa455('0x1f')](_0x5723c6);}return _0x4941b4[_0xa455('0x20')]();};}function saveUpdates(_0x217cb3,_0x1bb516){return function(_0x54610a){if(_0x54610a){return _0x54610a['update'](_0x217cb3)[_0xa455('0x21')](function(_0x895cb7){return _0x895cb7;});}return null;};}function removeEntity(_0x2942f2,_0x2475d1){return function(_0x164ebe){if(_0x164ebe){return _0x164ebe[_0xa455('0x22')]()['then'](function(){_0x2942f2[_0xa455('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d39ff,_0x13c3b0){return function(_0xd058e4){if(!_0xd058e4){_0x4d39ff[_0xa455('0x23')](0x194);}return _0xd058e4;};}function handleError(_0xa29113,_0x37d5de){_0x37d5de=_0x37d5de||0x1f4;return function(_0x388ae2){logger[_0xa455('0x24')](_0x388ae2[_0xa455('0x25')]);if(_0x388ae2['name']){delete _0x388ae2[_0xa455('0x26')];}_0xa29113[_0xa455('0x16')](_0x37d5de)[_0xa455('0x27')](_0x388ae2);};}exports[_0xa455('0x28')]=function(_0x136728,_0x5e3212){var _0x3ddf50={},_0x255243={},_0x41bbc5={'count':0x0,'rows':[]};var _0x15a79e=_[_0xa455('0x29')](db[_0xa455('0x2a')][_0xa455('0x2b')],function(_0x259a4d){return{'name':_0x259a4d[_0xa455('0x2c')],'type':_0x259a4d[_0xa455('0x2d')][_0xa455('0x2e')]};});_0x255243[_0xa455('0x2f')]=_[_0xa455('0x29')](_0x15a79e,_0xa455('0x26'));_0x255243[_0xa455('0x30')]=_['keys'](_0x136728['query']);_0x255243[_0xa455('0x31')]=_[_0xa455('0x32')](_0x255243['model'],_0x255243[_0xa455('0x30')]);_0x3ddf50[_0xa455('0x33')]=_['intersection'](_0x255243[_0xa455('0x2f')],qs[_0xa455('0x34')](_0x136728[_0xa455('0x30')]['fields']));_0x3ddf50[_0xa455('0x33')]=_0x3ddf50['attributes'][_0xa455('0x35')]?_0x3ddf50['attributes']:_0x255243[_0xa455('0x2f')];if(!_0x136728[_0xa455('0x30')][_0xa455('0x36')]('nolimit')){_0x3ddf50[_0xa455('0x19')]=qs['limit'](_0x136728[_0xa455('0x30')]['limit']);_0x3ddf50['offset']=qs[_0xa455('0x18')](_0x136728[_0xa455('0x30')][_0xa455('0x18')]);}_0x3ddf50[_0xa455('0x37')]=qs[_0xa455('0x38')](_0x136728[_0xa455('0x30')][_0xa455('0x38')]);_0x3ddf50[_0xa455('0x39')]=qs[_0xa455('0x31')](_[_0xa455('0x3a')](_0x136728[_0xa455('0x30')],_0x255243[_0xa455('0x31')]),_0x15a79e);if(_0x136728[_0xa455('0x30')][_0xa455('0x3b')]){_0x3ddf50[_0xa455('0x39')]=_[_0xa455('0x3c')](_0x3ddf50[_0xa455('0x39')],{'$or':_[_0xa455('0x29')](_0x15a79e,function(_0x3ec92c){if(_0x3ec92c[_0xa455('0x2d')]!==_0xa455('0x3d')){var _0x4c45b6={};_0x4c45b6[_0x3ec92c['name']]={'$like':'%'+_0x136728[_0xa455('0x30')][_0xa455('0x3b')]+'%'};return _0x4c45b6;}})});}_0x3ddf50=_['merge']({},_0x3ddf50,_0x136728[_0xa455('0x3e')]);var _0x5f2bd3={'where':_0x3ddf50[_0xa455('0x39')]};return db[_0xa455('0x2a')][_0xa455('0x1b')](_0x5f2bd3)[_0xa455('0x21')](function(_0x5674f1){_0x41bbc5[_0xa455('0x1b')]=_0x5674f1;if(_0x136728['query'][_0xa455('0x3f')]){_0x3ddf50['include']=[{'all':!![]}];}return db[_0xa455('0x2a')][_0xa455('0x40')](_0x3ddf50);})[_0xa455('0x21')](function(_0x4a141c){_0x41bbc5[_0xa455('0x41')]=_0x4a141c;return _0x41bbc5;})[_0xa455('0x21')](respondWithFilteredResult(_0x5e3212,_0x3ddf50))[_0xa455('0x42')](handleError(_0x5e3212,null));};exports[_0xa455('0x43')]=function(_0x25f026,_0x33a9bb){var _0x39b0c5={'raw':!![],'where':{'id':_0x25f026[_0xa455('0x44')]['id']}},_0x171f1d={};_0x171f1d[_0xa455('0x2f')]=_[_0xa455('0x45')](db['SquareRecording']['rawAttributes']);_0x171f1d['query']=_[_0xa455('0x45')](_0x25f026[_0xa455('0x30')]);_0x171f1d[_0xa455('0x31')]=_['intersection'](_0x171f1d[_0xa455('0x2f')],_0x171f1d[_0xa455('0x30')]);_0x39b0c5[_0xa455('0x33')]=_['intersection'](_0x171f1d[_0xa455('0x2f')],qs[_0xa455('0x34')](_0x25f026['query'][_0xa455('0x34')]));_0x39b0c5[_0xa455('0x33')]=_0x39b0c5[_0xa455('0x33')][_0xa455('0x35')]?_0x39b0c5[_0xa455('0x33')]:_0x171f1d[_0xa455('0x2f')];if(_0x25f026['query'][_0xa455('0x3f')]){_0x39b0c5[_0xa455('0x46')]=[{'all':!![]}];}_0x39b0c5=_[_0xa455('0x3c')]({},_0x39b0c5,_0x25f026[_0xa455('0x3e')]);return db[_0xa455('0x2a')][_0xa455('0x47')](_0x39b0c5)[_0xa455('0x21')](handleEntityNotFound(_0x33a9bb,null))['then'](respondWithResult(_0x33a9bb,null))['catch'](handleError(_0x33a9bb,null));};exports[_0xa455('0x48')]=function(_0x39be3c,_0x9140fd){return db[_0xa455('0x2a')][_0xa455('0x48')](_0x39be3c[_0xa455('0x49')],{})[_0xa455('0x21')](respondWithResult(_0x9140fd,0xc9))[_0xa455('0x42')](handleError(_0x9140fd,null));};exports[_0xa455('0x4a')]=function(_0x3d3595,_0x35e5ad){if(_0x3d3595[_0xa455('0x49')]['id']){delete _0x3d3595[_0xa455('0x49')]['id'];}return db[_0xa455('0x2a')]['find']({'where':{'id':_0x3d3595[_0xa455('0x44')]['id']}})[_0xa455('0x21')](handleEntityNotFound(_0x35e5ad,null))[_0xa455('0x21')](saveUpdates(_0x3d3595['body'],null))[_0xa455('0x21')](respondWithResult(_0x35e5ad,null))['catch'](handleError(_0x35e5ad,null));};exports[_0xa455('0x4b')]=function(_0x41a0e7,_0x1a0c35,_0x389759){var _0x154385=require('../../components/encryptor');var _0x8b007c=![];var _0x24dbec={};if(_0x41a0e7[_0xa455('0x30')]['type']&&_0x41a0e7['query'][_0xa455('0x2d')]===_0xa455('0x4c')){_0x24dbec[_0xa455('0x4c')]=_0x41a0e7[_0xa455('0x44')]['id'];}else{_0x24dbec['id']=_0x41a0e7[_0xa455('0x44')]['id'];}return db[_0xa455('0x2a')][_0xa455('0x47')]({'where':_0x24dbec,'attributes':['id','savePath',_0xa455('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x1a0c35,null))[_0xa455('0x21')](function(_0x2e8342){if(_0x2e8342){var _0x58fab3=_0x2e8342['savePath'];var _0x3ffed0=util[_0xa455('0x4e')](_0xa455('0x4f'),_0x58fab3);if(fs[_0xa455('0x50')](_0x3ffed0)){_0x8b007c=!![];return _0x154385[_0xa455('0x51')](_0x3ffed0,_0x58fab3,config[_0xa455('0x52')][_0xa455('0x53')])['then'](function(){return _0x2e8342;});}return _0x2e8342;}})[_0xa455('0x21')](function(_0x2eb9a){if(_0x2eb9a){var _0x325adc=_0x2eb9a[_0xa455('0x54')];if(!fs[_0xa455('0x50')](_0x325adc)){throw new db[(_0xa455('0x55'))][(_0xa455('0x56'))](_0xa455('0x57'));}if(_0x2eb9a[_0xa455('0x4d')]){return _0x1a0c35['download'](_0x325adc,_0x2eb9a[_0xa455('0x4d')]+path[_0xa455('0x58')](_0x325adc),function(){if(_0x8b007c){fs['unlink'](_0x325adc);}});}else{return _0x1a0c35['download'](_0x325adc,function(_0x4f62b9){if(_0x8b007c){fs[_0xa455('0x59')](_0x325adc);}});}}})[_0xa455('0x42')](function(_0x3284de){if(_0x3284de[_0xa455('0x5a')]===_0xa455('0x57')){_0x1a0c35[_0xa455('0x16')](0x194)[_0xa455('0x27')]('Not\x20found');}else{return handleError(_0x1a0c35,null);}});};exports[_0xa455('0x22')]=function(_0x517e07,_0x1a6769){return db[_0xa455('0x2a')][_0xa455('0x47')]({'where':{'id':_0x517e07[_0xa455('0x44')]['id']}})[_0xa455('0x21')](function(_0x39eb35){if(_[_0xa455('0x5b')](_0x39eb35)){throw new ReferenceError(_0xa455('0x5c'));}return _0x39eb35;})[_0xa455('0x21')](function(_0x50f5bd){var _0x48e34c=_0x50f5bd['savePath'];logger['info'](_0xa455('0x5d'),_0x48e34c);if(!_[_0xa455('0x5b')](_0x50f5bd['savePath'])&&fs[_0xa455('0x50')](_0x48e34c)){logger[_0xa455('0x5e')](_0xa455('0x5f')+_0x48e34c+_0xa455('0x60'));fs[_0xa455('0x61')](_0x48e34c);}_0x48e34c=_0x48e34c+_0xa455('0x62');if(!_[_0xa455('0x5b')](_0x50f5bd[_0xa455('0x54')])&&fs[_0xa455('0x50')](_0x48e34c)){logger['info'](_0xa455('0x5f')+_0x48e34c+_0xa455('0x60'));fs[_0xa455('0x61')](_0x48e34c);}return _0x50f5bd;})[_0xa455('0x21')](function(_0x267aeb){if(!_0x267aeb)throw new InternalError();return _0x267aeb[_0xa455('0x22')]();})[_0xa455('0x21')](function(){_0x1a6769['status'](0xcc)['end']();})[_0xa455('0x42')](handleError(_0x1a6769,null));}; \ No newline at end of file +var _0xfa5c=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','find','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2e3178,_0x2d89c5){var _0x34d0a2=function(_0x30c845){while(--_0x30c845){_0x2e3178['push'](_0x2e3178['shift']());}};_0x34d0a2(++_0x2d89c5);}(_0xfa5c,0x1cb));var _0xcfa5=function(_0x1c49c8,_0x5e691f){_0x1c49c8=_0x1c49c8-0x0;var _0x1e8525=_0xfa5c[_0x1c49c8];return _0x1e8525;};'use strict';var emlformat=require(_0xcfa5('0x0'));var rimraf=require(_0xcfa5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfa5('0x2'));var rp=require(_0xcfa5('0x3'));var moment=require(_0xcfa5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcfa5('0x5'));var path=require(_0xcfa5('0x6'));var sox=require(_0xcfa5('0x7'));var csv=require(_0xcfa5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfa5('0x9'));var _=require(_0xcfa5('0xa'));var squel=require(_0xcfa5('0xb'));var crypto=require(_0xcfa5('0xc'));var jsforce=require(_0xcfa5('0xd'));var deskjs=require(_0xcfa5('0xe'));var toCsv=require(_0xcfa5('0x8'));var querystring=require(_0xcfa5('0xf'));var Papa=require(_0xcfa5('0x10'));var Redis=require(_0xcfa5('0x11'));var authService=require(_0xcfa5('0x12'));var qs=require(_0xcfa5('0x13'));var as=require(_0xcfa5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfa5('0x15'))('api');var utils=require(_0xcfa5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcfa5('0x17'))['db'];function respondWithStatusCode(_0x20a3e4,_0x227c69){_0x227c69=_0x227c69||0xcc;return function(_0x5f4bdd){if(_0x5f4bdd){return _0x20a3e4[_0xcfa5('0x18')](_0x227c69);}return _0x20a3e4[_0xcfa5('0x19')](_0x227c69)[_0xcfa5('0x1a')]();};}function respondWithResult(_0x25ef66,_0x346ce2){_0x346ce2=_0x346ce2||0xc8;return function(_0x26fecb){if(_0x26fecb){return _0x25ef66[_0xcfa5('0x19')](_0x346ce2)[_0xcfa5('0x1b')](_0x26fecb);}};}function respondWithFilteredResult(_0x392eb8,_0x333cca){return function(_0x177b96){if(_0x177b96){var _0x334842=typeof _0x333cca[_0xcfa5('0x1c')]===_0xcfa5('0x1d')&&typeof _0x333cca[_0xcfa5('0x1e')]===_0xcfa5('0x1d');var _0xcc6cb1=_0x177b96[_0xcfa5('0x1f')];var _0x3b34c7=_0x334842?0x0:_0x333cca[_0xcfa5('0x1c')];var _0x2f6b55=_0x334842?_0x177b96['count']:_0x333cca[_0xcfa5('0x1c')]+_0x333cca[_0xcfa5('0x1e')];var _0x42114b;if(_0x2f6b55>=_0xcc6cb1){_0x2f6b55=_0xcc6cb1;_0x42114b=0xc8;}else{_0x42114b=0xce;}_0x392eb8[_0xcfa5('0x19')](_0x42114b);return _0x392eb8[_0xcfa5('0x20')](_0xcfa5('0x21'),_0x3b34c7+'-'+_0x2f6b55+'/'+_0xcc6cb1)[_0xcfa5('0x1b')](_0x177b96);}return null;};}function patchUpdates(_0x1d3063){return function(_0x180a84){try{jsonpatch[_0xcfa5('0x22')](_0x180a84,_0x1d3063,!![]);}catch(_0xfff8e3){return BPromise[_0xcfa5('0x23')](_0xfff8e3);}return _0x180a84[_0xcfa5('0x24')]();};}function saveUpdates(_0x4351f2,_0x113cf2){return function(_0x3ebdab){if(_0x3ebdab){return _0x3ebdab[_0xcfa5('0x25')](_0x4351f2)[_0xcfa5('0x26')](function(_0x41b9a8){return _0x41b9a8;});}return null;};}function removeEntity(_0x3c1b92,_0x29eef0){return function(_0x469d39){if(_0x469d39){return _0x469d39[_0xcfa5('0x27')]()[_0xcfa5('0x26')](function(){_0x3c1b92[_0xcfa5('0x19')](0xcc)[_0xcfa5('0x1a')]();});}};}function handleEntityNotFound(_0x1f454a,_0x4b3fbb){return function(_0x1b9568){if(!_0x1b9568){_0x1f454a[_0xcfa5('0x18')](0x194);}return _0x1b9568;};}function handleError(_0x31dd6d,_0x597b11){_0x597b11=_0x597b11||0x1f4;return function(_0xbac1a1){logger[_0xcfa5('0x28')](_0xbac1a1[_0xcfa5('0x29')]);if(_0xbac1a1[_0xcfa5('0x2a')]){delete _0xbac1a1[_0xcfa5('0x2a')];}_0x31dd6d['status'](_0x597b11)[_0xcfa5('0x2b')](_0xbac1a1);};}exports[_0xcfa5('0x2c')]=function(_0x22662a,_0x3738b1){var _0x4a4b5d={},_0x2013be={},_0x11ae20={'count':0x0,'rows':[]};var _0x5cd4e1=_[_0xcfa5('0x2d')](db[_0xcfa5('0x2e')]['rawAttributes'],function(_0x27d2c1){return{'name':_0x27d2c1[_0xcfa5('0x2f')],'type':_0x27d2c1['type'][_0xcfa5('0x30')]};});_0x2013be[_0xcfa5('0x31')]=_[_0xcfa5('0x2d')](_0x5cd4e1,_0xcfa5('0x2a'));_0x2013be[_0xcfa5('0x32')]=_[_0xcfa5('0x33')](_0x22662a[_0xcfa5('0x32')]);_0x2013be[_0xcfa5('0x34')]=_[_0xcfa5('0x35')](_0x2013be['model'],_0x2013be[_0xcfa5('0x32')]);_0x4a4b5d[_0xcfa5('0x36')]=_['intersection'](_0x2013be[_0xcfa5('0x31')],qs[_0xcfa5('0x37')](_0x22662a[_0xcfa5('0x32')][_0xcfa5('0x37')]));_0x4a4b5d['attributes']=_0x4a4b5d[_0xcfa5('0x36')][_0xcfa5('0x38')]?_0x4a4b5d['attributes']:_0x2013be[_0xcfa5('0x31')];if(!_0x22662a[_0xcfa5('0x32')][_0xcfa5('0x39')]('nolimit')){_0x4a4b5d['limit']=qs[_0xcfa5('0x1e')](_0x22662a[_0xcfa5('0x32')][_0xcfa5('0x1e')]);_0x4a4b5d['offset']=qs[_0xcfa5('0x1c')](_0x22662a[_0xcfa5('0x32')][_0xcfa5('0x1c')]);}_0x4a4b5d[_0xcfa5('0x3a')]=qs[_0xcfa5('0x3b')](_0x22662a[_0xcfa5('0x32')][_0xcfa5('0x3b')]);_0x4a4b5d['where']=qs[_0xcfa5('0x34')](_[_0xcfa5('0x3c')](_0x22662a[_0xcfa5('0x32')],_0x2013be[_0xcfa5('0x34')]),_0x5cd4e1);if(_0x22662a['query'][_0xcfa5('0x3d')]){_0x4a4b5d[_0xcfa5('0x3e')]=_[_0xcfa5('0x3f')](_0x4a4b5d['where'],{'$or':_[_0xcfa5('0x2d')](_0x5cd4e1,function(_0x395fde){if(_0x395fde[_0xcfa5('0x40')]!==_0xcfa5('0x41')){var _0x305ea7={};_0x305ea7[_0x395fde['name']]={'$like':'%'+_0x22662a['query'][_0xcfa5('0x3d')]+'%'};return _0x305ea7;}})});}_0x4a4b5d=_[_0xcfa5('0x3f')]({},_0x4a4b5d,_0x22662a['options']);var _0x2cff6d={'where':_0x4a4b5d['where']};return db[_0xcfa5('0x2e')][_0xcfa5('0x1f')](_0x2cff6d)[_0xcfa5('0x26')](function(_0x53e747){_0x11ae20[_0xcfa5('0x1f')]=_0x53e747;if(_0x22662a[_0xcfa5('0x32')][_0xcfa5('0x42')]){_0x4a4b5d[_0xcfa5('0x43')]=[{'all':!![]}];}return db[_0xcfa5('0x2e')]['findAll'](_0x4a4b5d);})['then'](function(_0x22920c){_0x11ae20[_0xcfa5('0x44')]=_0x22920c;return _0x11ae20;})['then'](respondWithFilteredResult(_0x3738b1,_0x4a4b5d))[_0xcfa5('0x45')](handleError(_0x3738b1,null));};exports[_0xcfa5('0x46')]=function(_0x1d7da1,_0x23c326){var _0x4c35e0={'raw':!![],'where':{'id':_0x1d7da1[_0xcfa5('0x47')]['id']}},_0xed1f24={};_0xed1f24[_0xcfa5('0x31')]=_[_0xcfa5('0x33')](db[_0xcfa5('0x2e')][_0xcfa5('0x48')]);_0xed1f24[_0xcfa5('0x32')]=_[_0xcfa5('0x33')](_0x1d7da1['query']);_0xed1f24[_0xcfa5('0x34')]=_[_0xcfa5('0x35')](_0xed1f24[_0xcfa5('0x31')],_0xed1f24[_0xcfa5('0x32')]);_0x4c35e0['attributes']=_[_0xcfa5('0x35')](_0xed1f24[_0xcfa5('0x31')],qs[_0xcfa5('0x37')](_0x1d7da1[_0xcfa5('0x32')][_0xcfa5('0x37')]));_0x4c35e0['attributes']=_0x4c35e0['attributes'][_0xcfa5('0x38')]?_0x4c35e0['attributes']:_0xed1f24['model'];if(_0x1d7da1[_0xcfa5('0x32')]['includeAll']){_0x4c35e0[_0xcfa5('0x43')]=[{'all':!![]}];}_0x4c35e0=_[_0xcfa5('0x3f')]({},_0x4c35e0,_0x1d7da1['options']);return db[_0xcfa5('0x2e')]['find'](_0x4c35e0)['then'](handleEntityNotFound(_0x23c326,null))[_0xcfa5('0x26')](respondWithResult(_0x23c326,null))[_0xcfa5('0x45')](handleError(_0x23c326,null));};exports[_0xcfa5('0x49')]=function(_0x30cb92,_0x1396da){return db[_0xcfa5('0x2e')]['create'](_0x30cb92[_0xcfa5('0x4a')],{})['then'](respondWithResult(_0x1396da,0xc9))[_0xcfa5('0x45')](handleError(_0x1396da,null));};exports[_0xcfa5('0x25')]=function(_0x5a11c0,_0x2f840d){if(_0x5a11c0['body']['id']){delete _0x5a11c0[_0xcfa5('0x4a')]['id'];}return db[_0xcfa5('0x2e')]['find']({'where':{'id':_0x5a11c0[_0xcfa5('0x47')]['id']}})[_0xcfa5('0x26')](handleEntityNotFound(_0x2f840d,null))[_0xcfa5('0x26')](saveUpdates(_0x5a11c0[_0xcfa5('0x4a')],null))[_0xcfa5('0x26')](respondWithResult(_0x2f840d,null))['catch'](handleError(_0x2f840d,null));};exports[_0xcfa5('0x4b')]=function(_0x3c2bcd,_0x2f8099,_0x4518aa){var _0x191851=require(_0xcfa5('0x4c'));var _0x70cd79=![];var _0x4979eb={};if(_0x3c2bcd[_0xcfa5('0x32')]['type']&&_0x3c2bcd[_0xcfa5('0x32')][_0xcfa5('0x40')]===_0xcfa5('0x4d')){_0x4979eb['uniqueid']=_0x3c2bcd[_0xcfa5('0x47')]['id'];}else{_0x4979eb['id']=_0x3c2bcd['params']['id'];}return db[_0xcfa5('0x2e')]['find']({'where':_0x4979eb,'attributes':['id',_0xcfa5('0x4e'),'filename'],'raw':!![]})[_0xcfa5('0x26')](handleEntityNotFound(_0x2f8099,null))[_0xcfa5('0x26')](function(_0x55cf1c){if(_0x55cf1c){var _0x2cbabc=_0x55cf1c[_0xcfa5('0x4e')];var _0x379743=util[_0xcfa5('0x4f')](_0xcfa5('0x50'),_0x2cbabc);if(fs[_0xcfa5('0x51')](_0x379743)){_0x70cd79=!![];return _0x191851[_0xcfa5('0x52')](_0x379743,_0x2cbabc,config['secrets'][_0xcfa5('0x53')])[_0xcfa5('0x26')](function(){return _0x55cf1c;});}return _0x55cf1c;}})['then'](function(_0x343e02){if(_0x343e02){var _0x40645b=_0x343e02[_0xcfa5('0x4e')];if(!fs[_0xcfa5('0x51')](_0x40645b)){throw new db[(_0xcfa5('0x54'))][(_0xcfa5('0x55'))](_0xcfa5('0x56'));}if(_0x343e02[_0xcfa5('0x57')]){return _0x2f8099[_0xcfa5('0x4b')](_0x40645b,_0x343e02[_0xcfa5('0x57')]+path[_0xcfa5('0x58')](_0x40645b),function(){if(_0x70cd79){fs[_0xcfa5('0x59')](_0x40645b);}});}else{return _0x2f8099[_0xcfa5('0x4b')](_0x40645b,function(_0x59c9a3){if(_0x70cd79){fs['unlink'](_0x40645b);}});}}})[_0xcfa5('0x45')](function(_0x19cc2e){if(_0x19cc2e[_0xcfa5('0x5a')]===_0xcfa5('0x56')){_0x2f8099[_0xcfa5('0x19')](0x194)['send'](_0xcfa5('0x5b'));}else{return handleError(_0x2f8099,null);}});};exports[_0xcfa5('0x27')]=function(_0x347c91,_0x3a1ebd){return db['SquareRecording'][_0xcfa5('0x5c')]({'where':{'id':_0x347c91[_0xcfa5('0x47')]['id']}})[_0xcfa5('0x26')](function(_0x938771){if(_['isNil'](_0x938771)){throw new ReferenceError(_0xcfa5('0x5d'));}return _0x938771;})['then'](function(_0x3a525a){var _0x346da2=_0x3a525a[_0xcfa5('0x4e')];logger[_0xcfa5('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x346da2);if(!_[_0xcfa5('0x5f')](_0x3a525a[_0xcfa5('0x4e')])&&fs['existsSync'](_0x346da2)){logger[_0xcfa5('0x5e')]('File:\x20\x22'+_0x346da2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x346da2);}_0x346da2=_0x346da2+'.cypher';if(!_[_0xcfa5('0x5f')](_0x3a525a[_0xcfa5('0x4e')])&&fs[_0xcfa5('0x51')](_0x346da2)){logger[_0xcfa5('0x5e')](_0xcfa5('0x60')+_0x346da2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcfa5('0x61')](_0x346da2);}return _0x3a525a;})[_0xcfa5('0x26')](function(_0x1281af){if(!_0x1281af)throw new InternalError();return _0x1281af[_0xcfa5('0x27')]();})[_0xcfa5('0x26')](function(){_0x3a1ebd[_0xcfa5('0x19')](0xcc)[_0xcfa5('0x1a')]();})['catch'](handleError(_0x3a1ebd,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index efd60cf..eda9973 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 _0xc3ed=['moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','api'];(function(_0x3e25fa,_0x4b5427){var _0x5b7448=function(_0x279b9c){while(--_0x279b9c){_0x3e25fa['push'](_0x3e25fa['shift']());}};_0x5b7448(++_0x4b5427);}(_0xc3ed,0x111));var _0xdc3e=function(_0x4f0804,_0xd157e7){_0x4f0804=_0x4f0804-0x0;var _0x2773c6=_0xc3ed[_0x4f0804];return _0x2773c6;};'use strict';var _=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var logger=require('../../config/logger')(_0xdc3e('0x2'));var moment=require(_0xdc3e('0x3'));var BPromise=require(_0xdc3e('0x4'));var rp=require(_0xdc3e('0x5'));var fs=require('fs');var path=require(_0xdc3e('0x6'));var rimraf=require('rimraf');var config=require(_0xdc3e('0x7'));var attributes=require('./squareRecording.attributes');module[_0xdc3e('0x8')]=function(_0x27b691,_0x3f6e1c){return _0x27b691[_0xdc3e('0x9')](_0xdc3e('0xa'),attributes,{'tableName':_0xdc3e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x0120,0x6f));var _0x0012=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0120[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'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 c8ff3ce..f9b2a1b 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 _0xa1a1=['request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateSquareRecording','SquareRecording','body','options','raw','then','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0xa1a1,0x144));var _0x1a1a=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xa1a1[_0x4c3ffe];return _0x28d3eb;};'use strict';var _=require('lodash');var util=require(_0x1a1a('0x0'));var moment=require(_0x1a1a('0x1'));var BPromise=require(_0x1a1a('0x2'));var rs=require(_0x1a1a('0x3'));var fs=require('fs');var Redis=require(_0x1a1a('0x4'));var db=require(_0x1a1a('0x5'))['db'];var utils=require(_0x1a1a('0x6'));var logger=require(_0x1a1a('0x7'))('rpc');var config=require(_0x1a1a('0x8'));var jayson=require(_0x1a1a('0x9'));var client=jayson[_0x1a1a('0xa')][_0x1a1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294278,_0x5210fd,_0x25c2af){return new BPromise(function(_0x2027cb,_0x4ba049){return client[_0x1a1a('0xc')](_0x294278,_0x25c2af)['then'](function(_0x100490){logger[_0x1a1a('0xd')](_0x1a1a('0xe'),_0x5210fd,_0x1a1a('0xf'));logger[_0x1a1a('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5210fd,_0x1a1a('0xf'),JSON[_0x1a1a('0x11')](_0x100490));if(_0x100490[_0x1a1a('0x12')]){if(_0x100490[_0x1a1a('0x12')][_0x1a1a('0x13')]===0x1f4){logger[_0x1a1a('0x12')](_0x1a1a('0xe'),_0x5210fd,_0x100490[_0x1a1a('0x12')][_0x1a1a('0x14')]);return _0x4ba049(_0x100490['error'][_0x1a1a('0x14')]);}logger[_0x1a1a('0x12')](_0x1a1a('0xe'),_0x5210fd,_0x100490[_0x1a1a('0x12')][_0x1a1a('0x14')]);return _0x2027cb(_0x100490[_0x1a1a('0x12')]['message']);}else{logger['info'](_0x1a1a('0xe'),_0x5210fd,_0x1a1a('0xf'));_0x2027cb(_0x100490['result']['message']);}})['catch'](function(_0x341f9c){logger[_0x1a1a('0x12')](_0x1a1a('0xe'),_0x5210fd,_0x341f9c);_0x4ba049(_0x341f9c);});});}exports[_0x1a1a('0x15')]=function(_0x5a73c2){var _0x15e291=this;return new Promise(function(_0x2fc81a,_0x22df92){return db[_0x1a1a('0x16')]['create'](_0x5a73c2[_0x1a1a('0x17')],{'raw':_0x5a73c2[_0x1a1a('0x18')]?_0x5a73c2[_0x1a1a('0x18')][_0x1a1a('0x19')]===undefined?!![]:![]:!![]})[_0x1a1a('0x1a')](function(_0x472cbb){logger[_0x1a1a('0xd')]('CreateSquareRecording',_0x5a73c2);logger['debug'](_0x1a1a('0x15'),_0x5a73c2,JSON[_0x1a1a('0x11')](_0x472cbb));_0x2fc81a(_0x472cbb);})[_0x1a1a('0x1b')](function(_0xc1aba4){logger[_0x1a1a('0x12')](_0x1a1a('0x15'),_0xc1aba4['message'],_0x5a73c2);_0x22df92(_0x15e291[_0x1a1a('0x12')](0x1f4,_0xc1aba4[_0x1a1a('0x14')]));});});}; \ No newline at end of file +var _0x2210=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','body','options','raw','lodash','util','moment','randomstring','ioredis'];(function(_0x1723fa,_0x4a36ff){var _0x1da8d5=function(_0x3860d0){while(--_0x3860d0){_0x1723fa['push'](_0x1723fa['shift']());}};_0x1da8d5(++_0x4a36ff);}(_0x2210,0x113));var _0x0221=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2210[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x0221('0x0'));var util=require(_0x0221('0x1'));var moment=require(_0x0221('0x2'));var BPromise=require('bluebird');var rs=require(_0x0221('0x3'));var fs=require('fs');var Redis=require(_0x0221('0x4'));var db=require(_0x0221('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0221('0x6'));var config=require(_0x0221('0x7'));var jayson=require(_0x0221('0x8'));var client=jayson[_0x0221('0x9')][_0x0221('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x562a4c,_0x17bc83,_0x132fb8){return new BPromise(function(_0x19a6b2,_0x20d244){return client[_0x0221('0xb')](_0x562a4c,_0x132fb8)[_0x0221('0xc')](function(_0x4f48d7){logger[_0x0221('0xd')](_0x0221('0xe'),_0x17bc83,'request\x20sent');logger[_0x0221('0xf')](_0x0221('0x10'),_0x17bc83,_0x0221('0x11'),JSON[_0x0221('0x12')](_0x4f48d7));if(_0x4f48d7['error']){if(_0x4f48d7[_0x0221('0x13')][_0x0221('0x14')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x17bc83,_0x4f48d7[_0x0221('0x13')]['message']);return _0x20d244(_0x4f48d7['error'][_0x0221('0x15')]);}logger['error'](_0x0221('0xe'),_0x17bc83,_0x4f48d7[_0x0221('0x13')][_0x0221('0x15')]);return _0x19a6b2(_0x4f48d7[_0x0221('0x13')][_0x0221('0x15')]);}else{logger[_0x0221('0xd')]('SquareRecording,\x20%s,\x20%s',_0x17bc83,_0x0221('0x11'));_0x19a6b2(_0x4f48d7[_0x0221('0x16')][_0x0221('0x15')]);}})[_0x0221('0x17')](function(_0xbab277){logger[_0x0221('0x13')](_0x0221('0xe'),_0x17bc83,_0xbab277);_0x20d244(_0xbab277);});});}exports[_0x0221('0x18')]=function(_0x39b363){var _0x5b5ff1=this;return new Promise(function(_0x4c2ae4,_0x338802){return db['SquareRecording']['create'](_0x39b363[_0x0221('0x19')],{'raw':_0x39b363[_0x0221('0x1a')]?_0x39b363[_0x0221('0x1a')][_0x0221('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5ec6c2){logger[_0x0221('0xd')](_0x0221('0x18'),_0x39b363);logger['debug'](_0x0221('0x18'),_0x39b363,JSON[_0x0221('0x12')](_0x5ec6c2));_0x4c2ae4(_0x5ec6c2);})[_0x0221('0x17')](function(_0x5da328){logger[_0x0221('0x13')](_0x0221('0x18'),_0x5da328[_0x0221('0x15')],_0x39b363);_0x338802(_0x5b5ff1['error'](0x1f4,_0x5da328['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ebf5a89..d095f44 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(_0x5dc20b,_0x1ba3ca){var _0x1d13ff=function(_0x3a73c6){while(--_0x3a73c6){_0x5dc20b['push'](_0x5dc20b['shift']());}};_0x1d13ff(++_0x1ba3ca);}(_0xe706,0xa3));var _0x6e70=function(_0x2d21cc,_0x27ef2a){_0x2d21cc=_0x2d21cc-0x0;var _0x7ab87e=_0xe706[_0x2d21cc];return _0x7ab87e;};'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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1a8869,_0x421679){var _0x3874f5=function(_0x557794){while(--_0x557794){_0x1a8869['push'](_0x1a8869['shift']());}};_0x3874f5(++_0x421679);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 80a69ac..5e4d57e 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 _0xb020=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x1dad92,_0x2f948c){var _0x90a9f6=function(_0x5644db){while(--_0x5644db){_0x1dad92['push'](_0x1dad92['shift']());}};_0x90a9f6(++_0x2f948c);}(_0xb020,0x86));var _0x0b02=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0xb020[_0x3ccdf8];return _0x243dab;};'use strict';var Sequelize=require(_0x0b02('0x0'));module['exports']={'network':{'type':Sequelize[_0x0b02('0x1')]},'network_script':{'type':Sequelize[_0x0b02('0x1')]},'request':{'type':Sequelize[_0x0b02('0x1')]},'channel':{'type':Sequelize[_0x0b02('0x1')]},'language':{'type':Sequelize[_0x0b02('0x1')]},'type':{'type':Sequelize[_0x0b02('0x1')]},'uniqueid':{'type':Sequelize[_0x0b02('0x1')]},'version':{'type':Sequelize[_0x0b02('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0b02('0x1')]},'callingpres':{'type':Sequelize[_0x0b02('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x0b02('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0b02('0x1')]},'extension':{'type':Sequelize[_0x0b02('0x1')]},'priority':{'type':Sequelize[_0x0b02('0x1')]},'enhanced':{'type':Sequelize[_0x0b02('0x1')]},'accountcode':{'type':Sequelize[_0x0b02('0x1')]},'threadid':{'type':Sequelize[_0x0b02('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0b02('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x0b02('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3552=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x42696b,_0x1d1652){var _0x2866f5=function(_0x282fdf){while(--_0x282fdf){_0x42696b['push'](_0x42696b['shift']());}};_0x2866f5(++_0x1d1652);}(_0x3552,0x74));var _0x2355=function(_0x575c36,_0x41d6f1){_0x575c36=_0x575c36-0x0;var _0x3dc154=_0x3552[_0x575c36];return _0x3dc154;};'use strict';var Sequelize=require(_0x2355('0x0'));module[_0x2355('0x1')]={'network':{'type':Sequelize[_0x2355('0x2')]},'network_script':{'type':Sequelize[_0x2355('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2355('0x2')]},'language':{'type':Sequelize[_0x2355('0x2')]},'type':{'type':Sequelize[_0x2355('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x2355('0x2')]},'callerid':{'type':Sequelize[_0x2355('0x2')]},'calleridname':{'type':Sequelize[_0x2355('0x2')]},'callingpres':{'type':Sequelize[_0x2355('0x2')]},'callingani2':{'type':Sequelize[_0x2355('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2355('0x2')]},'dnid':{'type':Sequelize[_0x2355('0x2')]},'rdnis':{'type':Sequelize[_0x2355('0x2')]},'context':{'type':Sequelize[_0x2355('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2355('0x2')]},'enhanced':{'type':Sequelize[_0x2355('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2355('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x2355('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6a7a58d..0de05bc 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 _0xc3d3=['index','map','SquareReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','findAll','catch','show','keys','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','error','name','send'];(function(_0x2b4526,_0x297306){var _0x3b2883=function(_0x44fa29){while(--_0x44fa29){_0x2b4526['push'](_0x2b4526['shift']());}};_0x3b2883(++_0x297306);}(_0xc3d3,0x1bf));var _0x3c3d=function(_0x449097,_0x4033b8){_0x449097=_0x449097-0x0;var _0x3af138=_0xc3d3[_0x449097];return _0x3af138;};'use strict';var emlformat=require(_0x3c3d('0x0'));var rimraf=require(_0x3c3d('0x1'));var zipdir=require(_0x3c3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c3d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3c3d('0x4'));var util=require(_0x3c3d('0x5'));var path=require(_0x3c3d('0x6'));var sox=require('sox');var csv=require(_0x3c3d('0x7'));var ejs=require(_0x3c3d('0x8'));var fs=require('fs');var fs_extra=require(_0x3c3d('0x9'));var _=require(_0x3c3d('0xa'));var squel=require(_0x3c3d('0xb'));var crypto=require(_0x3c3d('0xc'));var jsforce=require(_0x3c3d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3c3d('0x7'));var querystring=require(_0x3c3d('0xe'));var Papa=require(_0x3c3d('0xf'));var Redis=require('ioredis');var authService=require(_0x3c3d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c3d('0x11'));var logger=require(_0x3c3d('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3c3d('0x13'));var db=require(_0x3c3d('0x14'))['db'];function respondWithStatusCode(_0x11fad8,_0x69d93f){_0x69d93f=_0x69d93f||0xcc;return function(_0x27cefe){if(_0x27cefe){return _0x11fad8[_0x3c3d('0x15')](_0x69d93f);}return _0x11fad8[_0x3c3d('0x16')](_0x69d93f)[_0x3c3d('0x17')]();};}function respondWithResult(_0x3ee326,_0x2deaeb){_0x2deaeb=_0x2deaeb||0xc8;return function(_0xb19d0b){if(_0xb19d0b){return _0x3ee326[_0x3c3d('0x16')](_0x2deaeb)[_0x3c3d('0x18')](_0xb19d0b);}};}function respondWithFilteredResult(_0x1af445,_0x5a2ba6){return function(_0x2af57f){if(_0x2af57f){var _0x3783e9=typeof _0x5a2ba6[_0x3c3d('0x19')]===_0x3c3d('0x1a')&&typeof _0x5a2ba6[_0x3c3d('0x1b')]==='undefined';var _0x49ffba=_0x2af57f['count'];var _0x58aa65=_0x3783e9?0x0:_0x5a2ba6[_0x3c3d('0x19')];var _0x429518=_0x3783e9?_0x2af57f[_0x3c3d('0x1c')]:_0x5a2ba6['offset']+_0x5a2ba6['limit'];var _0x32b675;if(_0x429518>=_0x49ffba){_0x429518=_0x49ffba;_0x32b675=0xc8;}else{_0x32b675=0xce;}_0x1af445[_0x3c3d('0x16')](_0x32b675);return _0x1af445['set'](_0x3c3d('0x1d'),_0x58aa65+'-'+_0x429518+'/'+_0x49ffba)['json'](_0x2af57f);}return null;};}function patchUpdates(_0x37426d){return function(_0x1316d8){try{jsonpatch[_0x3c3d('0x1e')](_0x1316d8,_0x37426d,!![]);}catch(_0x38ac0d){return BPromise[_0x3c3d('0x1f')](_0x38ac0d);}return _0x1316d8['save']();};}function saveUpdates(_0x5906d3,_0x4b91e7){return function(_0x19ede2){if(_0x19ede2){return _0x19ede2['update'](_0x5906d3)['then'](function(_0x2f8b44){return _0x2f8b44;});}return null;};}function removeEntity(_0x1e5e3f,_0x63917a){return function(_0xd15d73){if(_0xd15d73){return _0xd15d73[_0x3c3d('0x20')]()['then'](function(){_0x1e5e3f[_0x3c3d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6c95,_0x46b9f3){return function(_0xe5d706){if(!_0xe5d706){_0x5b6c95[_0x3c3d('0x15')](0x194);}return _0xe5d706;};}function handleError(_0x1ce8e2,_0x16dcba){_0x16dcba=_0x16dcba||0x1f4;return function(_0x40d190){logger[_0x3c3d('0x21')](_0x40d190['stack']);if(_0x40d190[_0x3c3d('0x22')]){delete _0x40d190[_0x3c3d('0x22')];}_0x1ce8e2[_0x3c3d('0x16')](_0x16dcba)[_0x3c3d('0x23')](_0x40d190);};}exports[_0x3c3d('0x24')]=function(_0xf2c77a,_0x46571f){var _0xe8809f={},_0x5a18f7={},_0x2d935d={'count':0x0,'rows':[]};var _0x25a6f8=_[_0x3c3d('0x25')](db[_0x3c3d('0x26')][_0x3c3d('0x27')],function(_0x5cbb8d){return{'name':_0x5cbb8d[_0x3c3d('0x28')],'type':_0x5cbb8d[_0x3c3d('0x29')]['key']};});_0x5a18f7[_0x3c3d('0x2a')]=_[_0x3c3d('0x25')](_0x25a6f8,_0x3c3d('0x22'));_0x5a18f7['query']=_['keys'](_0xf2c77a[_0x3c3d('0x2b')]);_0x5a18f7[_0x3c3d('0x2c')]=_[_0x3c3d('0x2d')](_0x5a18f7[_0x3c3d('0x2a')],_0x5a18f7[_0x3c3d('0x2b')]);_0xe8809f['attributes']=_[_0x3c3d('0x2d')](_0x5a18f7[_0x3c3d('0x2a')],qs['fields'](_0xf2c77a[_0x3c3d('0x2b')][_0x3c3d('0x2e')]));_0xe8809f[_0x3c3d('0x2f')]=_0xe8809f[_0x3c3d('0x2f')][_0x3c3d('0x30')]?_0xe8809f[_0x3c3d('0x2f')]:_0x5a18f7[_0x3c3d('0x2a')];if(!_0xf2c77a[_0x3c3d('0x2b')][_0x3c3d('0x31')](_0x3c3d('0x32'))){_0xe8809f[_0x3c3d('0x1b')]=qs['limit'](_0xf2c77a[_0x3c3d('0x2b')][_0x3c3d('0x1b')]);_0xe8809f[_0x3c3d('0x19')]=qs[_0x3c3d('0x19')](_0xf2c77a[_0x3c3d('0x2b')][_0x3c3d('0x19')]);}_0xe8809f[_0x3c3d('0x33')]=qs[_0x3c3d('0x34')](_0xf2c77a[_0x3c3d('0x2b')][_0x3c3d('0x34')]);_0xe8809f[_0x3c3d('0x35')]=qs[_0x3c3d('0x2c')](_[_0x3c3d('0x36')](_0xf2c77a['query'],_0x5a18f7[_0x3c3d('0x2c')]),_0x25a6f8);if(_0xf2c77a[_0x3c3d('0x2b')]['filter']){_0xe8809f[_0x3c3d('0x35')]=_[_0x3c3d('0x37')](_0xe8809f[_0x3c3d('0x35')],{'$or':_['map'](_0x25a6f8,function(_0x3a182a){if(_0x3a182a['type']!==_0x3c3d('0x38')){var _0x3a2e99={};_0x3a2e99[_0x3a182a[_0x3c3d('0x22')]]={'$like':'%'+_0xf2c77a[_0x3c3d('0x2b')]['filter']+'%'};return _0x3a2e99;}})});}_0xe8809f=_[_0x3c3d('0x37')]({},_0xe8809f,_0xf2c77a[_0x3c3d('0x39')]);var _0x356b0d={'where':_0xe8809f[_0x3c3d('0x35')]};return db[_0x3c3d('0x26')]['count'](_0x356b0d)[_0x3c3d('0x3a')](function(_0x26e848){_0x2d935d[_0x3c3d('0x1c')]=_0x26e848;if(_0xf2c77a['query']['includeAll']){_0xe8809f['include']=[{'all':!![]}];}return db['SquareReport'][_0x3c3d('0x3b')](_0xe8809f);})[_0x3c3d('0x3a')](function(_0x19e2d2){_0x2d935d['rows']=_0x19e2d2;return _0x2d935d;})[_0x3c3d('0x3a')](respondWithFilteredResult(_0x46571f,_0xe8809f))[_0x3c3d('0x3c')](handleError(_0x46571f,null));};exports[_0x3c3d('0x3d')]=function(_0x49a3c7,_0x1175ee){var _0x3a6b92={'raw':!![],'where':{'id':_0x49a3c7['params']['id']}},_0x4261e7={};_0x4261e7['model']=_[_0x3c3d('0x3e')](db['SquareReport'][_0x3c3d('0x27')]);_0x4261e7[_0x3c3d('0x2b')]=_[_0x3c3d('0x3e')](_0x49a3c7[_0x3c3d('0x2b')]);_0x4261e7[_0x3c3d('0x2c')]=_[_0x3c3d('0x2d')](_0x4261e7['model'],_0x4261e7[_0x3c3d('0x2b')]);_0x3a6b92['attributes']=_[_0x3c3d('0x2d')](_0x4261e7[_0x3c3d('0x2a')],qs[_0x3c3d('0x2e')](_0x49a3c7['query'][_0x3c3d('0x2e')]));_0x3a6b92[_0x3c3d('0x2f')]=_0x3a6b92['attributes']['length']?_0x3a6b92[_0x3c3d('0x2f')]:_0x4261e7[_0x3c3d('0x2a')];if(_0x49a3c7[_0x3c3d('0x2b')]['includeAll']){_0x3a6b92['include']=[{'all':!![]}];}_0x3a6b92=_['merge']({},_0x3a6b92,_0x49a3c7[_0x3c3d('0x39')]);return db[_0x3c3d('0x26')][_0x3c3d('0x3f')](_0x3a6b92)[_0x3c3d('0x3a')](handleEntityNotFound(_0x1175ee,null))[_0x3c3d('0x3a')](respondWithResult(_0x1175ee,null))[_0x3c3d('0x3c')](handleError(_0x1175ee,null));};exports[_0x3c3d('0x40')]=function(_0x2ced9b,_0x4bbbfe){return db[_0x3c3d('0x26')][_0x3c3d('0x40')](_0x2ced9b['body'],{})[_0x3c3d('0x3a')](respondWithResult(_0x4bbbfe,0xc9))[_0x3c3d('0x3c')](handleError(_0x4bbbfe,null));};exports[_0x3c3d('0x41')]=function(_0x1dec30,_0x109d20){if(_0x1dec30['body']['id']){delete _0x1dec30[_0x3c3d('0x42')]['id'];}return db[_0x3c3d('0x26')][_0x3c3d('0x3f')]({'where':{'id':_0x1dec30[_0x3c3d('0x43')]['id']}})[_0x3c3d('0x3a')](handleEntityNotFound(_0x109d20,null))[_0x3c3d('0x3a')](saveUpdates(_0x1dec30['body'],null))[_0x3c3d('0x3a')](respondWithResult(_0x109d20,null))[_0x3c3d('0x3c')](handleError(_0x109d20,null));};exports[_0x3c3d('0x20')]=function(_0x1a5468,_0x5e279f){return db[_0x3c3d('0x26')][_0x3c3d('0x3f')]({'where':{'id':_0x1a5468[_0x3c3d('0x43')]['id']}})[_0x3c3d('0x3a')](handleEntityNotFound(_0x5e279f,null))[_0x3c3d('0x3a')](removeEntity(_0x5e279f,null))[_0x3c3d('0x3c')](handleError(_0x5e279f,null));};exports['describe']=function(_0x4d7ea0,_0x242f75){return db[_0x3c3d('0x26')][_0x3c3d('0x44')]()[_0x3c3d('0x3a')](respondWithResult(_0x242f75,null))[_0x3c3d('0x3c')](handleError(_0x242f75,null));}; \ No newline at end of file +var _0x3d3d=['limit','count','json','apply','reject','save','update','then','error','stack','name','index','map','SquareReport','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x3a83b5,_0x125dc0){var _0x57df1c=function(_0x369ace){while(--_0x369ace){_0x3a83b5['push'](_0x3a83b5['shift']());}};_0x57df1c(++_0x125dc0);}(_0x3d3d,0xc4));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd3d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3d3('0x1'));var jsonpatch=require(_0xd3d3('0x2'));var rp=require(_0xd3d3('0x3'));var moment=require(_0xd3d3('0x4'));var BPromise=require(_0xd3d3('0x5'));var Mustache=require(_0xd3d3('0x6'));var util=require(_0xd3d3('0x7'));var path=require(_0xd3d3('0x8'));var sox=require(_0xd3d3('0x9'));var csv=require(_0xd3d3('0xa'));var ejs=require(_0xd3d3('0xb'));var fs=require('fs');var fs_extra=require(_0xd3d3('0xc'));var _=require('lodash');var squel=require(_0xd3d3('0xd'));var crypto=require(_0xd3d3('0xe'));var jsforce=require(_0xd3d3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd3d3('0x10'));var Papa=require('papaparse');var Redis=require(_0xd3d3('0x11'));var authService=require(_0xd3d3('0x12'));var qs=require(_0xd3d3('0x13'));var as=require(_0xd3d3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3d3('0x15'))(_0xd3d3('0x16'));var utils=require(_0xd3d3('0x17'));var config=require(_0xd3d3('0x18'));var licenseUtil=require(_0xd3d3('0x19'));var db=require(_0xd3d3('0x1a'))['db'];function respondWithStatusCode(_0x100a3a,_0xe7df44){_0xe7df44=_0xe7df44||0xcc;return function(_0x28f51d){if(_0x28f51d){return _0x100a3a[_0xd3d3('0x1b')](_0xe7df44);}return _0x100a3a[_0xd3d3('0x1c')](_0xe7df44)[_0xd3d3('0x1d')]();};}function respondWithResult(_0x4eeb9f,_0x33c923){_0x33c923=_0x33c923||0xc8;return function(_0x39e60f){if(_0x39e60f){return _0x4eeb9f[_0xd3d3('0x1c')](_0x33c923)['json'](_0x39e60f);}};}function respondWithFilteredResult(_0x102da7,_0x412b3b){return function(_0x4145e9){if(_0x4145e9){var _0x35d44e=typeof _0x412b3b[_0xd3d3('0x1e')]===_0xd3d3('0x1f')&&typeof _0x412b3b[_0xd3d3('0x20')]===_0xd3d3('0x1f');var _0x3eb90c=_0x4145e9[_0xd3d3('0x21')];var _0x2b550f=_0x35d44e?0x0:_0x412b3b[_0xd3d3('0x1e')];var _0x38d4a=_0x35d44e?_0x4145e9[_0xd3d3('0x21')]:_0x412b3b[_0xd3d3('0x1e')]+_0x412b3b[_0xd3d3('0x20')];var _0x3c7ef8;if(_0x38d4a>=_0x3eb90c){_0x38d4a=_0x3eb90c;_0x3c7ef8=0xc8;}else{_0x3c7ef8=0xce;}_0x102da7[_0xd3d3('0x1c')](_0x3c7ef8);return _0x102da7['set']('Content-Range',_0x2b550f+'-'+_0x38d4a+'/'+_0x3eb90c)[_0xd3d3('0x22')](_0x4145e9);}return null;};}function patchUpdates(_0x48069c){return function(_0x14145c){try{jsonpatch[_0xd3d3('0x23')](_0x14145c,_0x48069c,!![]);}catch(_0x111488){return BPromise[_0xd3d3('0x24')](_0x111488);}return _0x14145c[_0xd3d3('0x25')]();};}function saveUpdates(_0x580364,_0x55f4e9){return function(_0x1a59e6){if(_0x1a59e6){return _0x1a59e6[_0xd3d3('0x26')](_0x580364)[_0xd3d3('0x27')](function(_0x4c9e38){return _0x4c9e38;});}return null;};}function removeEntity(_0x2c2064,_0x367640){return function(_0x1f72a6){if(_0x1f72a6){return _0x1f72a6['destroy']()[_0xd3d3('0x27')](function(){_0x2c2064[_0xd3d3('0x1c')](0xcc)[_0xd3d3('0x1d')]();});}};}function handleEntityNotFound(_0x404fd2,_0x26c4db){return function(_0x470db6){if(!_0x470db6){_0x404fd2[_0xd3d3('0x1b')](0x194);}return _0x470db6;};}function handleError(_0x25cae0,_0x1da6e7){_0x1da6e7=_0x1da6e7||0x1f4;return function(_0x527c36){logger[_0xd3d3('0x28')](_0x527c36[_0xd3d3('0x29')]);if(_0x527c36[_0xd3d3('0x2a')]){delete _0x527c36[_0xd3d3('0x2a')];}_0x25cae0[_0xd3d3('0x1c')](_0x1da6e7)['send'](_0x527c36);};}exports[_0xd3d3('0x2b')]=function(_0x488521,_0x3c5b6d){var _0x3c8202={},_0xfe263b={},_0x4f70bf={'count':0x0,'rows':[]};var _0x467919=_[_0xd3d3('0x2c')](db[_0xd3d3('0x2d')][_0xd3d3('0x2e')],function(_0x23cc4e){return{'name':_0x23cc4e['fieldName'],'type':_0x23cc4e['type']['key']};});_0xfe263b[_0xd3d3('0x2f')]=_[_0xd3d3('0x2c')](_0x467919,_0xd3d3('0x2a'));_0xfe263b[_0xd3d3('0x30')]=_['keys'](_0x488521['query']);_0xfe263b[_0xd3d3('0x31')]=_[_0xd3d3('0x32')](_0xfe263b[_0xd3d3('0x2f')],_0xfe263b[_0xd3d3('0x30')]);_0x3c8202[_0xd3d3('0x33')]=_[_0xd3d3('0x32')](_0xfe263b[_0xd3d3('0x2f')],qs[_0xd3d3('0x34')](_0x488521[_0xd3d3('0x30')][_0xd3d3('0x34')]));_0x3c8202[_0xd3d3('0x33')]=_0x3c8202[_0xd3d3('0x33')][_0xd3d3('0x35')]?_0x3c8202['attributes']:_0xfe263b[_0xd3d3('0x2f')];if(!_0x488521[_0xd3d3('0x30')][_0xd3d3('0x36')](_0xd3d3('0x37'))){_0x3c8202['limit']=qs[_0xd3d3('0x20')](_0x488521['query'][_0xd3d3('0x20')]);_0x3c8202[_0xd3d3('0x1e')]=qs[_0xd3d3('0x1e')](_0x488521[_0xd3d3('0x30')][_0xd3d3('0x1e')]);}_0x3c8202[_0xd3d3('0x38')]=qs[_0xd3d3('0x39')](_0x488521[_0xd3d3('0x30')]['sort']);_0x3c8202[_0xd3d3('0x3a')]=qs[_0xd3d3('0x31')](_[_0xd3d3('0x3b')](_0x488521[_0xd3d3('0x30')],_0xfe263b['filters']),_0x467919);if(_0x488521[_0xd3d3('0x30')][_0xd3d3('0x3c')]){_0x3c8202[_0xd3d3('0x3a')]=_['merge'](_0x3c8202[_0xd3d3('0x3a')],{'$or':_[_0xd3d3('0x2c')](_0x467919,function(_0x30300f){if(_0x30300f['type']!=='VIRTUAL'){var _0x1fd411={};_0x1fd411[_0x30300f['name']]={'$like':'%'+_0x488521[_0xd3d3('0x30')][_0xd3d3('0x3c')]+'%'};return _0x1fd411;}})});}_0x3c8202=_['merge']({},_0x3c8202,_0x488521[_0xd3d3('0x3d')]);var _0x2668d7={'where':_0x3c8202[_0xd3d3('0x3a')]};return db[_0xd3d3('0x2d')]['count'](_0x2668d7)[_0xd3d3('0x27')](function(_0xcd94d9){_0x4f70bf[_0xd3d3('0x21')]=_0xcd94d9;if(_0x488521[_0xd3d3('0x30')][_0xd3d3('0x3e')]){_0x3c8202[_0xd3d3('0x3f')]=[{'all':!![]}];}return db[_0xd3d3('0x2d')][_0xd3d3('0x40')](_0x3c8202);})[_0xd3d3('0x27')](function(_0x19633b){_0x4f70bf[_0xd3d3('0x41')]=_0x19633b;return _0x4f70bf;})['then'](respondWithFilteredResult(_0x3c5b6d,_0x3c8202))[_0xd3d3('0x42')](handleError(_0x3c5b6d,null));};exports[_0xd3d3('0x43')]=function(_0x171aa5,_0x526602){var _0x154fab={'raw':!![],'where':{'id':_0x171aa5['params']['id']}},_0x212773={};_0x212773[_0xd3d3('0x2f')]=_[_0xd3d3('0x44')](db[_0xd3d3('0x2d')]['rawAttributes']);_0x212773[_0xd3d3('0x30')]=_[_0xd3d3('0x44')](_0x171aa5[_0xd3d3('0x30')]);_0x212773[_0xd3d3('0x31')]=_['intersection'](_0x212773[_0xd3d3('0x2f')],_0x212773[_0xd3d3('0x30')]);_0x154fab[_0xd3d3('0x33')]=_[_0xd3d3('0x32')](_0x212773[_0xd3d3('0x2f')],qs['fields'](_0x171aa5['query']['fields']));_0x154fab['attributes']=_0x154fab[_0xd3d3('0x33')][_0xd3d3('0x35')]?_0x154fab['attributes']:_0x212773[_0xd3d3('0x2f')];if(_0x171aa5['query'][_0xd3d3('0x3e')]){_0x154fab[_0xd3d3('0x3f')]=[{'all':!![]}];}_0x154fab=_[_0xd3d3('0x45')]({},_0x154fab,_0x171aa5[_0xd3d3('0x3d')]);return db[_0xd3d3('0x2d')][_0xd3d3('0x46')](_0x154fab)[_0xd3d3('0x27')](handleEntityNotFound(_0x526602,null))[_0xd3d3('0x27')](respondWithResult(_0x526602,null))[_0xd3d3('0x42')](handleError(_0x526602,null));};exports[_0xd3d3('0x47')]=function(_0xbd7369,_0x2142f1){return db[_0xd3d3('0x2d')][_0xd3d3('0x47')](_0xbd7369[_0xd3d3('0x48')],{})[_0xd3d3('0x27')](respondWithResult(_0x2142f1,0xc9))['catch'](handleError(_0x2142f1,null));};exports[_0xd3d3('0x26')]=function(_0x2091d9,_0x30e75c){if(_0x2091d9[_0xd3d3('0x48')]['id']){delete _0x2091d9[_0xd3d3('0x48')]['id'];}return db[_0xd3d3('0x2d')]['find']({'where':{'id':_0x2091d9[_0xd3d3('0x49')]['id']}})[_0xd3d3('0x27')](handleEntityNotFound(_0x30e75c,null))[_0xd3d3('0x27')](saveUpdates(_0x2091d9[_0xd3d3('0x48')],null))['then'](respondWithResult(_0x30e75c,null))[_0xd3d3('0x42')](handleError(_0x30e75c,null));};exports[_0xd3d3('0x4a')]=function(_0x16a41,_0x4c706c){return db[_0xd3d3('0x2d')][_0xd3d3('0x46')]({'where':{'id':_0x16a41[_0xd3d3('0x49')]['id']}})[_0xd3d3('0x27')](handleEntityNotFound(_0x4c706c,null))[_0xd3d3('0x27')](removeEntity(_0x4c706c,null))[_0xd3d3('0x42')](handleError(_0x4c706c,null));};exports[_0xd3d3('0x4b')]=function(_0xe27ba2,_0x449d10){return db[_0xd3d3('0x2d')][_0xd3d3('0x4b')]()[_0xd3d3('0x27')](respondWithResult(_0x449d10,null))[_0xd3d3('0x42')](handleError(_0x449d10,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7eb4949..880481d 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 _0x78bc=['define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','api','moment','bluebird','../../config/environment','exports'];(function(_0x3363ae,_0x5c3f3f){var _0x2bc795=function(_0xd9803c){while(--_0xd9803c){_0x3363ae['push'](_0x3363ae['shift']());}};_0x2bc795(++_0x5c3f3f);}(_0x78bc,0x162));var _0xc78b=function(_0x292c6a,_0x287295){_0x292c6a=_0x292c6a-0x0;var _0x3fbf0d=_0x78bc[_0x292c6a];return _0x3fbf0d;};'use strict';var _=require(_0xc78b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc78b('0x1'));var moment=require(_0xc78b('0x2'));var BPromise=require(_0xc78b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc78b('0x4'));var attributes=require('./squareReport.attributes');module[_0xc78b('0x5')]=function(_0x4c12ca,_0x1985ae){return _0x4c12ca[_0xc78b('0x6')]('SquareReport',attributes,{'tableName':_0xc78b('0x7'),'paranoid':![],'indexes':[{'name':_0xc78b('0x8'),'fields':[_0xc78b('0x9'),_0xc78b('0xa')]},{'name':_0xc78b('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e89=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','leaveAt'];(function(_0x2763a3,_0x45b02a){var _0x3aa4fc=function(_0x12994c){while(--_0x12994c){_0x2763a3['push'](_0x2763a3['shift']());}};_0x3aa4fc(++_0x45b02a);}(_0x8e89,0x87));var _0x98e8=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x8e89[_0x502598];return _0xbdee21;};'use strict';var _=require(_0x98e8('0x0'));var util=require(_0x98e8('0x1'));var logger=require('../../config/logger')(_0x98e8('0x2'));var moment=require('moment');var BPromise=require(_0x98e8('0x3'));var rp=require(_0x98e8('0x4'));var fs=require('fs');var path=require(_0x98e8('0x5'));var rimraf=require(_0x98e8('0x6'));var config=require(_0x98e8('0x7'));var attributes=require(_0x98e8('0x8'));module['exports']=function(_0x420973,_0x3cf1c8){return _0x420973[_0x98e8('0x9')](_0x98e8('0xa'),attributes,{'tableName':_0x98e8('0xb'),'paranoid':![],'indexes':[{'name':_0x98e8('0xc'),'fields':[_0x98e8('0xd'),'project_name']},{'name':'leaveAt','fields':[_0x98e8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 22ed98b..bf72339 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 _0xea0f=['catch','CreateSquareReport','body','options','raw','then','debug','stringify','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x39b6a1,_0x58658e){var _0x237fa6=function(_0x89cb25){while(--_0x89cb25){_0x39b6a1['push'](_0x39b6a1['shift']());}};_0x237fa6(++_0x58658e);}(_0xea0f,0x9a));var _0xfea0=function(_0x5510b4,_0x3b0119){_0x5510b4=_0x5510b4-0x0;var _0x48af0e=_0xea0f[_0x5510b4];return _0x48af0e;};'use strict';var _=require(_0xfea0('0x0'));var util=require(_0xfea0('0x1'));var moment=require(_0xfea0('0x2'));var BPromise=require(_0xfea0('0x3'));var rs=require(_0xfea0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfea0('0x5'))['db'];var utils=require(_0xfea0('0x6'));var logger=require(_0xfea0('0x7'))(_0xfea0('0x8'));var config=require(_0xfea0('0x9'));var jayson=require(_0xfea0('0xa'));var client=jayson[_0xfea0('0xb')][_0xfea0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ac2aa,_0x4b33fe,_0x3fe717){return new BPromise(function(_0x1ac927,_0x24219a){return client[_0xfea0('0xd')](_0x3ac2aa,_0x3fe717)['then'](function(_0x24ef5d){logger[_0xfea0('0xe')](_0xfea0('0xf'),_0x4b33fe,_0xfea0('0x10'));logger['debug'](_0xfea0('0x11'),_0x4b33fe,'request\x20sent',JSON['stringify'](_0x24ef5d));if(_0x24ef5d[_0xfea0('0x12')]){if(_0x24ef5d['error'][_0xfea0('0x13')]===0x1f4){logger[_0xfea0('0x12')](_0xfea0('0xf'),_0x4b33fe,_0x24ef5d[_0xfea0('0x12')][_0xfea0('0x14')]);return _0x24219a(_0x24ef5d[_0xfea0('0x12')][_0xfea0('0x14')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x4b33fe,_0x24ef5d[_0xfea0('0x12')][_0xfea0('0x14')]);return _0x1ac927(_0x24ef5d[_0xfea0('0x12')][_0xfea0('0x14')]);}else{logger[_0xfea0('0xe')](_0xfea0('0xf'),_0x4b33fe,'request\x20sent');_0x1ac927(_0x24ef5d['result']['message']);}})[_0xfea0('0x15')](function(_0x5eb804){logger[_0xfea0('0x12')](_0xfea0('0xf'),_0x4b33fe,_0x5eb804);_0x24219a(_0x5eb804);});});}exports[_0xfea0('0x16')]=function(_0x12c4b8){var _0x53e480=this;return new Promise(function(_0x11c4b9,_0x2aa248){return db['SquareReport']['create'](_0x12c4b8[_0xfea0('0x17')],{'raw':_0x12c4b8[_0xfea0('0x18')]?_0x12c4b8[_0xfea0('0x18')][_0xfea0('0x19')]===undefined?!![]:![]:!![]})[_0xfea0('0x1a')](function(_0x20a86a){logger[_0xfea0('0xe')]('CreateSquareReport',_0x12c4b8);logger[_0xfea0('0x1b')](_0xfea0('0x16'),_0x12c4b8,JSON[_0xfea0('0x1c')](_0x20a86a));_0x11c4b9(_0x20a86a);})[_0xfea0('0x15')](function(_0x2e0122){logger[_0xfea0('0x12')](_0xfea0('0x16'),_0x2e0122[_0xfea0('0x14')],_0x12c4b8);_0x2aa248(_0x53e480[_0xfea0('0x12')](0x1f4,_0x2e0122[_0xfea0('0x14')]));});});};exports[_0xfea0('0x1d')]=function(_0x185a86){var _0x10f600=this;return new Promise(function(_0x42d04f,_0x33b845){return db[_0xfea0('0x1e')][_0xfea0('0x1f')](_0x185a86[_0xfea0('0x17')],{'raw':_0x185a86[_0xfea0('0x18')]?_0x185a86['options'][_0xfea0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x185a86['options']?_0x185a86['options'][_0xfea0('0x20')]||null:null,'attributes':_0x185a86[_0xfea0('0x18')]?_0x185a86['options'][_0xfea0('0x21')]||null:null,'limit':_0x185a86[_0xfea0('0x18')]?_0x185a86[_0xfea0('0x18')][_0xfea0('0x22')]||null:null})[_0xfea0('0x1a')](function(_0x597f87){logger[_0xfea0('0xe')](_0xfea0('0x1d'),_0x185a86);logger[_0xfea0('0x1b')](_0xfea0('0x1d'),_0x185a86,JSON[_0xfea0('0x1c')](_0x597f87));_0x42d04f(_0x597f87);})[_0xfea0('0x15')](function(_0x5bae00){logger[_0xfea0('0x12')](_0xfea0('0x1d'),_0x5bae00[_0xfea0('0x14')],_0x185a86);_0x33b845(_0x10f600[_0xfea0('0x12')](0x1f4,_0x5bae00[_0xfea0('0x14')]));});});}; \ No newline at end of file +var _0x5c4f=['message','info','result','CreateSquareReport','body','options','raw','debug','stringify','catch','update','where','attributes','limit','UpdateSquareReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','request\x20sent','error','code','SquareReport,\x20%s,\x20%s'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x5c4f,0x1ef));var _0xf5c4=function(_0x5e4a5e,_0x19eb7a){_0x5e4a5e=_0x5e4a5e-0x0;var _0x450acd=_0x5c4f[_0x5e4a5e];return _0x450acd;};'use strict';var _=require('lodash');var util=require(_0xf5c4('0x0'));var moment=require(_0xf5c4('0x1'));var BPromise=require(_0xf5c4('0x2'));var rs=require(_0xf5c4('0x3'));var fs=require('fs');var Redis=require(_0xf5c4('0x4'));var db=require(_0xf5c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf5c4('0x6'));var config=require(_0xf5c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x238591,_0x1630fe,_0x321bcf){return new BPromise(function(_0x3c4bba,_0x273357){return client[_0xf5c4('0x9')](_0x238591,_0x321bcf)[_0xf5c4('0xa')](function(_0x4cf15c){logger['info']('SquareReport,\x20%s,\x20%s',_0x1630fe,_0xf5c4('0xb'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1630fe,_0xf5c4('0xb'),JSON['stringify'](_0x4cf15c));if(_0x4cf15c[_0xf5c4('0xc')]){if(_0x4cf15c['error'][_0xf5c4('0xd')]===0x1f4){logger[_0xf5c4('0xc')](_0xf5c4('0xe'),_0x1630fe,_0x4cf15c['error']['message']);return _0x273357(_0x4cf15c[_0xf5c4('0xc')][_0xf5c4('0xf')]);}logger[_0xf5c4('0xc')](_0xf5c4('0xe'),_0x1630fe,_0x4cf15c['error'][_0xf5c4('0xf')]);return _0x3c4bba(_0x4cf15c[_0xf5c4('0xc')][_0xf5c4('0xf')]);}else{logger[_0xf5c4('0x10')](_0xf5c4('0xe'),_0x1630fe,_0xf5c4('0xb'));_0x3c4bba(_0x4cf15c[_0xf5c4('0x11')][_0xf5c4('0xf')]);}})['catch'](function(_0x20229c){logger[_0xf5c4('0xc')](_0xf5c4('0xe'),_0x1630fe,_0x20229c);_0x273357(_0x20229c);});});}exports[_0xf5c4('0x12')]=function(_0x261eef){var _0x1380ab=this;return new Promise(function(_0x458042,_0x428632){return db['SquareReport']['create'](_0x261eef[_0xf5c4('0x13')],{'raw':_0x261eef[_0xf5c4('0x14')]?_0x261eef[_0xf5c4('0x14')][_0xf5c4('0x15')]===undefined?!![]:![]:!![]})[_0xf5c4('0xa')](function(_0x4424aa){logger[_0xf5c4('0x10')](_0xf5c4('0x12'),_0x261eef);logger[_0xf5c4('0x16')](_0xf5c4('0x12'),_0x261eef,JSON[_0xf5c4('0x17')](_0x4424aa));_0x458042(_0x4424aa);})[_0xf5c4('0x18')](function(_0x50cf58){logger[_0xf5c4('0xc')](_0xf5c4('0x12'),_0x50cf58['message'],_0x261eef);_0x428632(_0x1380ab[_0xf5c4('0xc')](0x1f4,_0x50cf58[_0xf5c4('0xf')]));});});};exports['UpdateSquareReport']=function(_0x46435a){var _0x5254f1=this;return new Promise(function(_0x2df1c5,_0x32fec3){return db['SquareReport'][_0xf5c4('0x19')](_0x46435a[_0xf5c4('0x13')],{'raw':_0x46435a[_0xf5c4('0x14')]?_0x46435a[_0xf5c4('0x14')][_0xf5c4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46435a[_0xf5c4('0x14')]?_0x46435a['options'][_0xf5c4('0x1a')]||null:null,'attributes':_0x46435a[_0xf5c4('0x14')]?_0x46435a[_0xf5c4('0x14')][_0xf5c4('0x1b')]||null:null,'limit':_0x46435a[_0xf5c4('0x14')]?_0x46435a[_0xf5c4('0x14')][_0xf5c4('0x1c')]||null:null})[_0xf5c4('0xa')](function(_0x4b6112){logger['info'](_0xf5c4('0x1d'),_0x46435a);logger[_0xf5c4('0x16')](_0xf5c4('0x1d'),_0x46435a,JSON[_0xf5c4('0x17')](_0x4b6112));_0x2df1c5(_0x4b6112);})[_0xf5c4('0x18')](function(_0x653015){logger['error']('UpdateSquareReport',_0x653015[_0xf5c4('0xf')],_0x46435a);_0x32fec3(_0x5254f1[_0xf5c4('0xc')](0x1f4,_0x653015['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ded76a9..7a753fb 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 _0x1757=['Router','fs-extra','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get','describe','/:id','show','post','create','update','destroy','exports','util','path','connect-timeout'];(function(_0x599612,_0x13a516){var _0x52d1c7=function(_0x165108){while(--_0x165108){_0x599612['push'](_0x599612['shift']());}};_0x52d1c7(++_0x13a516);}(_0x1757,0xb1));var _0x7175=function(_0x3e4720,_0x42638f){_0x3e4720=_0x3e4720-0x0;var _0x4c7364=_0x1757[_0x3e4720];return _0x4c7364;};'use strict';var multer=require('multer');var util=require(_0x7175('0x0'));var path=require(_0x7175('0x1'));var timeout=require(_0x7175('0x2'));var express=require('express');var router=express[_0x7175('0x3')]();var fs_extra=require(_0x7175('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7175('0x5'));var config=require('../../config/environment');var controller=require(_0x7175('0x6'));router['get']('/',auth[_0x7175('0x7')](),controller[_0x7175('0x8')]);router[_0x7175('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x7175('0xa')]);router[_0x7175('0x9')](_0x7175('0xb'),auth[_0x7175('0x7')](),controller[_0x7175('0xc')]);router[_0x7175('0xd')]('/',auth[_0x7175('0x7')](),controller[_0x7175('0xe')]);router['put'](_0x7175('0xb'),auth[_0x7175('0x7')](),controller[_0x7175('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7175('0x10')]);module[_0x7175('0x11')]=router; \ No newline at end of file +var _0x0a36=['show','post','create','/:id','update','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','describe'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x0a36,0x1c0));var _0x60a3=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x0a36[_0x58547b];return _0x1d3fd2;};'use strict';var multer=require(_0x60a3('0x0'));var util=require(_0x60a3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60a3('0x2'));var router=express[_0x60a3('0x3')]();var fs_extra=require(_0x60a3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x60a3('0x5'));var config=require('../../config/environment');var controller=require(_0x60a3('0x6'));router[_0x60a3('0x7')]('/',auth[_0x60a3('0x8')](),controller[_0x60a3('0x9')]);router[_0x60a3('0x7')]('/describe',auth[_0x60a3('0x8')](),controller[_0x60a3('0xa')]);router[_0x60a3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x60a3('0xb')]);router[_0x60a3('0xc')]('/',auth['isAuthenticated'](),controller[_0x60a3('0xd')]);router['put'](_0x60a3('0xe'),auth['isAuthenticated'](),controller[_0x60a3('0xf')]);router['delete'](_0x60a3('0xe'),auth[_0x60a3('0x8')](),controller['destroy']);module[_0x60a3('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3ac7e02..bc080f0 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 _0x680d=['exports','STRING','TEXT','sequelize'];(function(_0xf6e8e2,_0x3163dd){var _0x527545=function(_0x1ec5c2){while(--_0x1ec5c2){_0xf6e8e2['push'](_0xf6e8e2['shift']());}};_0x527545(++_0x3163dd);}(_0x680d,0x18b));var _0xd680=function(_0x1bb49a,_0x29c0e7){_0x1bb49a=_0x1bb49a-0x0;var _0xfc9d77=_0x680d[_0x1bb49a];return _0xfc9d77;};'use strict';var Sequelize=require(_0xd680('0x0'));module[_0xd680('0x1')]={'uniqueid':{'type':Sequelize[_0xd680('0x2')]},'node':{'type':Sequelize[_0xd680('0x2')]},'application':{'type':Sequelize[_0xd680('0x2')]},'data':{'type':Sequelize[_0xd680('0x3')]},'project_name':{'type':Sequelize[_0xd680('0x2')]},'callerid':{'type':Sequelize[_0xd680('0x2')]}}; \ No newline at end of file +var _0x9159=['STRING','TEXT','sequelize','exports'];(function(_0x68b141,_0x314737){var _0x1e3e02=function(_0x2a211c){while(--_0x2a211c){_0x68b141['push'](_0x68b141['shift']());}};_0x1e3e02(++_0x314737);}(_0x9159,0xc2));var _0x9915=function(_0x2cb3eb,_0x4d83aa){_0x2cb3eb=_0x2cb3eb-0x0;var _0x2759ee=_0x9159[_0x2cb3eb];return _0x2759ee;};'use strict';var Sequelize=require(_0x9915('0x0'));module[_0x9915('0x1')]={'uniqueid':{'type':Sequelize[_0x9915('0x2')]},'node':{'type':Sequelize[_0x9915('0x2')]},'application':{'type':Sequelize[_0x9915('0x2')]},'data':{'type':Sequelize[_0x9915('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9915('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4ee4eaa..1be23df 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 _0x47a8=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','SquareDetailsReport','show','params','filters','length','find','catch','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x47a8,0xd0));var _0x847a=function(_0x215bdb,_0x10a05c){_0x215bdb=_0x215bdb-0x0;var _0x430d33=_0x47a8[_0x215bdb];return _0x430d33;};'use strict';var emlformat=require(_0x847a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x847a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x847a('0x2'));var BPromise=require(_0x847a('0x3'));var Mustache=require(_0x847a('0x4'));var util=require(_0x847a('0x5'));var path=require(_0x847a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x847a('0x7'));var fs=require('fs');var fs_extra=require(_0x847a('0x8'));var _=require(_0x847a('0x9'));var squel=require('squel');var crypto=require(_0x847a('0xa'));var jsforce=require(_0x847a('0xb'));var deskjs=require(_0x847a('0xc'));var toCsv=require(_0x847a('0xd'));var querystring=require(_0x847a('0xe'));var Papa=require('papaparse');var Redis=require(_0x847a('0xf'));var authService=require(_0x847a('0x10'));var qs=require(_0x847a('0x11'));var as=require(_0x847a('0x12'));var hardwareService=require(_0x847a('0x13'));var logger=require('../../config/logger')(_0x847a('0x14'));var utils=require(_0x847a('0x15'));var config=require(_0x847a('0x16'));var licenseUtil=require(_0x847a('0x17'));var db=require(_0x847a('0x18'))['db'];function respondWithStatusCode(_0x51b55a,_0x4a4882){_0x4a4882=_0x4a4882||0xcc;return function(_0x313d2f){if(_0x313d2f){return _0x51b55a[_0x847a('0x19')](_0x4a4882);}return _0x51b55a[_0x847a('0x1a')](_0x4a4882)['end']();};}function respondWithResult(_0x5f449d,_0x2df03d){_0x2df03d=_0x2df03d||0xc8;return function(_0x30b512){if(_0x30b512){return _0x5f449d[_0x847a('0x1a')](_0x2df03d)['json'](_0x30b512);}};}function respondWithFilteredResult(_0x21afb4,_0x58afaa){return function(_0x2c1a59){if(_0x2c1a59){var _0x12923c=typeof _0x58afaa[_0x847a('0x1b')]===_0x847a('0x1c')&&typeof _0x58afaa[_0x847a('0x1d')]===_0x847a('0x1c');var _0x16a484=_0x2c1a59[_0x847a('0x1e')];var _0x27c88d=_0x12923c?0x0:_0x58afaa['offset'];var _0x458976=_0x12923c?_0x2c1a59[_0x847a('0x1e')]:_0x58afaa[_0x847a('0x1b')]+_0x58afaa[_0x847a('0x1d')];var _0x48b2bb;if(_0x458976>=_0x16a484){_0x458976=_0x16a484;_0x48b2bb=0xc8;}else{_0x48b2bb=0xce;}_0x21afb4[_0x847a('0x1a')](_0x48b2bb);return _0x21afb4['set']('Content-Range',_0x27c88d+'-'+_0x458976+'/'+_0x16a484)[_0x847a('0x1f')](_0x2c1a59);}return null;};}function patchUpdates(_0xb137a){return function(_0x43f8a5){try{jsonpatch[_0x847a('0x20')](_0x43f8a5,_0xb137a,!![]);}catch(_0x34330d){return BPromise[_0x847a('0x21')](_0x34330d);}return _0x43f8a5['save']();};}function saveUpdates(_0x3b3b2c,_0x165662){return function(_0x34d4af){if(_0x34d4af){return _0x34d4af[_0x847a('0x22')](_0x3b3b2c)[_0x847a('0x23')](function(_0xe24ae9){return _0xe24ae9;});}return null;};}function removeEntity(_0x581765,_0x2dd0e3){return function(_0x30bece){if(_0x30bece){return _0x30bece[_0x847a('0x24')]()[_0x847a('0x23')](function(){_0x581765[_0x847a('0x1a')](0xcc)[_0x847a('0x25')]();});}};}function handleEntityNotFound(_0x2b9414,_0x43bd28){return function(_0x56769a){if(!_0x56769a){_0x2b9414['sendStatus'](0x194);}return _0x56769a;};}function handleError(_0x1a1db8,_0x21acae){_0x21acae=_0x21acae||0x1f4;return function(_0x150fb0){logger[_0x847a('0x26')](_0x150fb0[_0x847a('0x27')]);if(_0x150fb0[_0x847a('0x28')]){delete _0x150fb0[_0x847a('0x28')];}_0x1a1db8[_0x847a('0x1a')](_0x21acae)[_0x847a('0x29')](_0x150fb0);};}exports['index']=function(_0x31a31b,_0x2b2466){var _0x51aa10={},_0x19dddb={},_0x5b1ad5={'count':0x0,'rows':[]};var _0x4e117b=_[_0x847a('0x2a')](db['SquareDetailsReport'][_0x847a('0x2b')],function(_0x32ddb2){return{'name':_0x32ddb2[_0x847a('0x2c')],'type':_0x32ddb2[_0x847a('0x2d')]['key']};});_0x19dddb[_0x847a('0x2e')]=_[_0x847a('0x2a')](_0x4e117b,_0x847a('0x28'));_0x19dddb['query']=_[_0x847a('0x2f')](_0x31a31b[_0x847a('0x30')]);_0x19dddb['filters']=_[_0x847a('0x31')](_0x19dddb[_0x847a('0x2e')],_0x19dddb[_0x847a('0x30')]);_0x51aa10[_0x847a('0x32')]=_[_0x847a('0x31')](_0x19dddb[_0x847a('0x2e')],qs[_0x847a('0x33')](_0x31a31b['query'][_0x847a('0x33')]));_0x51aa10[_0x847a('0x32')]=_0x51aa10[_0x847a('0x32')]['length']?_0x51aa10[_0x847a('0x32')]:_0x19dddb['model'];if(!_0x31a31b[_0x847a('0x30')][_0x847a('0x34')](_0x847a('0x35'))){_0x51aa10['limit']=qs[_0x847a('0x1d')](_0x31a31b[_0x847a('0x30')][_0x847a('0x1d')]);_0x51aa10[_0x847a('0x1b')]=qs[_0x847a('0x1b')](_0x31a31b[_0x847a('0x30')][_0x847a('0x1b')]);}_0x51aa10[_0x847a('0x36')]=qs['sort'](_0x31a31b[_0x847a('0x30')]['sort']);_0x51aa10['where']=qs['filters'](_['pick'](_0x31a31b[_0x847a('0x30')],_0x19dddb['filters']),_0x4e117b);if(_0x31a31b['query']['filter']){_0x51aa10[_0x847a('0x37')]=_[_0x847a('0x38')](_0x51aa10[_0x847a('0x37')],{'$or':_[_0x847a('0x2a')](_0x4e117b,function(_0x4077fc){if(_0x4077fc[_0x847a('0x2d')]!==_0x847a('0x39')){var _0x2ab50b={};_0x2ab50b[_0x4077fc[_0x847a('0x28')]]={'$like':'%'+_0x31a31b[_0x847a('0x30')][_0x847a('0x3a')]+'%'};return _0x2ab50b;}})});}_0x51aa10=_['merge']({},_0x51aa10,_0x31a31b[_0x847a('0x3b')]);var _0x21d6e3={'where':_0x51aa10[_0x847a('0x37')]};return db['SquareDetailsReport'][_0x847a('0x1e')](_0x21d6e3)[_0x847a('0x23')](function(_0x5afa20){_0x5b1ad5[_0x847a('0x1e')]=_0x5afa20;if(_0x31a31b['query'][_0x847a('0x3c')]){_0x51aa10[_0x847a('0x3d')]=[{'all':!![]}];}return db[_0x847a('0x3e')]['findAll'](_0x51aa10);})[_0x847a('0x23')](function(_0x4a0a36){_0x5b1ad5['rows']=_0x4a0a36;return _0x5b1ad5;})[_0x847a('0x23')](respondWithFilteredResult(_0x2b2466,_0x51aa10))['catch'](handleError(_0x2b2466,null));};exports[_0x847a('0x3f')]=function(_0x1d6c33,_0x4040d0){var _0x36e35f={'raw':!![],'where':{'id':_0x1d6c33[_0x847a('0x40')]['id']}},_0x52d6d8={};_0x52d6d8['model']=_[_0x847a('0x2f')](db[_0x847a('0x3e')][_0x847a('0x2b')]);_0x52d6d8['query']=_[_0x847a('0x2f')](_0x1d6c33[_0x847a('0x30')]);_0x52d6d8[_0x847a('0x41')]=_[_0x847a('0x31')](_0x52d6d8['model'],_0x52d6d8[_0x847a('0x30')]);_0x36e35f[_0x847a('0x32')]=_['intersection'](_0x52d6d8[_0x847a('0x2e')],qs[_0x847a('0x33')](_0x1d6c33['query'][_0x847a('0x33')]));_0x36e35f[_0x847a('0x32')]=_0x36e35f[_0x847a('0x32')][_0x847a('0x42')]?_0x36e35f[_0x847a('0x32')]:_0x52d6d8[_0x847a('0x2e')];if(_0x1d6c33['query'][_0x847a('0x3c')]){_0x36e35f[_0x847a('0x3d')]=[{'all':!![]}];}_0x36e35f=_[_0x847a('0x38')]({},_0x36e35f,_0x1d6c33[_0x847a('0x3b')]);return db['SquareDetailsReport'][_0x847a('0x43')](_0x36e35f)['then'](handleEntityNotFound(_0x4040d0,null))[_0x847a('0x23')](respondWithResult(_0x4040d0,null))[_0x847a('0x44')](handleError(_0x4040d0,null));};exports['create']=function(_0x264d75,_0x2bb9d5){return db['SquareDetailsReport'][_0x847a('0x45')](_0x264d75[_0x847a('0x46')],{})[_0x847a('0x23')](respondWithResult(_0x2bb9d5,0xc9))[_0x847a('0x44')](handleError(_0x2bb9d5,null));};exports['update']=function(_0x48a626,_0x15063a){if(_0x48a626['body']['id']){delete _0x48a626[_0x847a('0x46')]['id'];}return db[_0x847a('0x3e')]['find']({'where':{'id':_0x48a626[_0x847a('0x40')]['id']}})[_0x847a('0x23')](handleEntityNotFound(_0x15063a,null))[_0x847a('0x23')](saveUpdates(_0x48a626[_0x847a('0x46')],null))['then'](respondWithResult(_0x15063a,null))['catch'](handleError(_0x15063a,null));};exports[_0x847a('0x24')]=function(_0x475040,_0x2612f3){return db[_0x847a('0x3e')][_0x847a('0x43')]({'where':{'id':_0x475040['params']['id']}})[_0x847a('0x23')](handleEntityNotFound(_0x2612f3,null))['then'](removeEntity(_0x2612f3,null))['catch'](handleError(_0x2612f3,null));};exports['describe']=function(_0x28dfea,_0x4e61f4){return db['SquareDetailsReport'][_0x847a('0x47')]()[_0x847a('0x23')](respondWithResult(_0x4e61f4,null))[_0x847a('0x44')](handleError(_0x4e61f4,null));}; \ No newline at end of file +var _0x280f=['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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','SquareDetailsReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','length','options','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x280f,0xe2));var _0xf280=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0x280f[_0x1c06f4];return _0x1a727e;};'use strict';var emlformat=require(_0xf280('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf280('0x1'));var jsonpatch=require(_0xf280('0x2'));var rp=require(_0xf280('0x3'));var moment=require(_0xf280('0x4'));var BPromise=require(_0xf280('0x5'));var Mustache=require(_0xf280('0x6'));var util=require(_0xf280('0x7'));var path=require('path');var sox=require(_0xf280('0x8'));var csv=require(_0xf280('0x9'));var ejs=require(_0xf280('0xa'));var fs=require('fs');var fs_extra=require(_0xf280('0xb'));var _=require(_0xf280('0xc'));var squel=require('squel');var crypto=require(_0xf280('0xd'));var jsforce=require(_0xf280('0xe'));var deskjs=require(_0xf280('0xf'));var toCsv=require(_0xf280('0x9'));var querystring=require(_0xf280('0x10'));var Papa=require(_0xf280('0x11'));var Redis=require('ioredis');var authService=require(_0xf280('0x12'));var qs=require(_0xf280('0x13'));var as=require(_0xf280('0x14'));var hardwareService=require(_0xf280('0x15'));var logger=require(_0xf280('0x16'))(_0xf280('0x17'));var utils=require(_0xf280('0x18'));var config=require(_0xf280('0x19'));var licenseUtil=require(_0xf280('0x1a'));var db=require(_0xf280('0x1b'))['db'];function respondWithStatusCode(_0x148d24,_0x56221f){_0x56221f=_0x56221f||0xcc;return function(_0x566eb7){if(_0x566eb7){return _0x148d24[_0xf280('0x1c')](_0x56221f);}return _0x148d24[_0xf280('0x1d')](_0x56221f)[_0xf280('0x1e')]();};}function respondWithResult(_0x1d7175,_0x3e9acc){_0x3e9acc=_0x3e9acc||0xc8;return function(_0x59fb22){if(_0x59fb22){return _0x1d7175[_0xf280('0x1d')](_0x3e9acc)[_0xf280('0x1f')](_0x59fb22);}};}function respondWithFilteredResult(_0x34cadb,_0x224162){return function(_0x1e8f4d){if(_0x1e8f4d){var _0x462177=typeof _0x224162[_0xf280('0x20')]==='undefined'&&typeof _0x224162['limit']==='undefined';var _0x30a9a6=_0x1e8f4d['count'];var _0x11c2b0=_0x462177?0x0:_0x224162['offset'];var _0x2a19e7=_0x462177?_0x1e8f4d[_0xf280('0x21')]:_0x224162['offset']+_0x224162[_0xf280('0x22')];var _0x59b8af;if(_0x2a19e7>=_0x30a9a6){_0x2a19e7=_0x30a9a6;_0x59b8af=0xc8;}else{_0x59b8af=0xce;}_0x34cadb[_0xf280('0x1d')](_0x59b8af);return _0x34cadb[_0xf280('0x23')](_0xf280('0x24'),_0x11c2b0+'-'+_0x2a19e7+'/'+_0x30a9a6)[_0xf280('0x1f')](_0x1e8f4d);}return null;};}function patchUpdates(_0x11db7d){return function(_0x3a4eff){try{jsonpatch[_0xf280('0x25')](_0x3a4eff,_0x11db7d,!![]);}catch(_0x469bdf){return BPromise[_0xf280('0x26')](_0x469bdf);}return _0x3a4eff['save']();};}function saveUpdates(_0x1ad62a,_0x5a1aa1){return function(_0xfb624e){if(_0xfb624e){return _0xfb624e[_0xf280('0x27')](_0x1ad62a)[_0xf280('0x28')](function(_0x32039f){return _0x32039f;});}return null;};}function removeEntity(_0x3de08f,_0x42020c){return function(_0x4c3618){if(_0x4c3618){return _0x4c3618[_0xf280('0x29')]()[_0xf280('0x28')](function(){_0x3de08f[_0xf280('0x1d')](0xcc)[_0xf280('0x1e')]();});}};}function handleEntityNotFound(_0x35cd2d,_0x302132){return function(_0x4509c1){if(!_0x4509c1){_0x35cd2d[_0xf280('0x1c')](0x194);}return _0x4509c1;};}function handleError(_0x485788,_0x368b24){_0x368b24=_0x368b24||0x1f4;return function(_0x1b21fb){logger[_0xf280('0x2a')](_0x1b21fb[_0xf280('0x2b')]);if(_0x1b21fb['name']){delete _0x1b21fb['name'];}_0x485788['status'](_0x368b24)['send'](_0x1b21fb);};}exports['index']=function(_0x3da40e,_0x2409f4){var _0xa1fbb7={},_0x34edaf={},_0x545ccf={'count':0x0,'rows':[]};var _0x1cdf05=_['map'](db[_0xf280('0x2c')][_0xf280('0x2d')],function(_0x534233){return{'name':_0x534233[_0xf280('0x2e')],'type':_0x534233[_0xf280('0x2f')][_0xf280('0x30')]};});_0x34edaf[_0xf280('0x31')]=_['map'](_0x1cdf05,_0xf280('0x32'));_0x34edaf[_0xf280('0x33')]=_[_0xf280('0x34')](_0x3da40e[_0xf280('0x33')]);_0x34edaf[_0xf280('0x35')]=_[_0xf280('0x36')](_0x34edaf[_0xf280('0x31')],_0x34edaf[_0xf280('0x33')]);_0xa1fbb7['attributes']=_[_0xf280('0x36')](_0x34edaf[_0xf280('0x31')],qs[_0xf280('0x37')](_0x3da40e[_0xf280('0x33')]['fields']));_0xa1fbb7['attributes']=_0xa1fbb7[_0xf280('0x38')]['length']?_0xa1fbb7[_0xf280('0x38')]:_0x34edaf[_0xf280('0x31')];if(!_0x3da40e[_0xf280('0x33')][_0xf280('0x39')](_0xf280('0x3a'))){_0xa1fbb7['limit']=qs['limit'](_0x3da40e['query'][_0xf280('0x22')]);_0xa1fbb7['offset']=qs[_0xf280('0x20')](_0x3da40e[_0xf280('0x33')]['offset']);}_0xa1fbb7[_0xf280('0x3b')]=qs[_0xf280('0x3c')](_0x3da40e[_0xf280('0x33')][_0xf280('0x3c')]);_0xa1fbb7[_0xf280('0x3d')]=qs[_0xf280('0x35')](_[_0xf280('0x3e')](_0x3da40e[_0xf280('0x33')],_0x34edaf[_0xf280('0x35')]),_0x1cdf05);if(_0x3da40e[_0xf280('0x33')]['filter']){_0xa1fbb7[_0xf280('0x3d')]=_[_0xf280('0x3f')](_0xa1fbb7[_0xf280('0x3d')],{'$or':_[_0xf280('0x40')](_0x1cdf05,function(_0x263a56){if(_0x263a56['type']!==_0xf280('0x41')){var _0x1f9365={};_0x1f9365[_0x263a56['name']]={'$like':'%'+_0x3da40e[_0xf280('0x33')][_0xf280('0x42')]+'%'};return _0x1f9365;}})});}_0xa1fbb7=_[_0xf280('0x3f')]({},_0xa1fbb7,_0x3da40e['options']);var _0x1ff055={'where':_0xa1fbb7[_0xf280('0x3d')]};return db['SquareDetailsReport'][_0xf280('0x21')](_0x1ff055)[_0xf280('0x28')](function(_0x422f4c){_0x545ccf[_0xf280('0x21')]=_0x422f4c;if(_0x3da40e[_0xf280('0x33')][_0xf280('0x43')]){_0xa1fbb7[_0xf280('0x44')]=[{'all':!![]}];}return db[_0xf280('0x2c')][_0xf280('0x45')](_0xa1fbb7);})[_0xf280('0x28')](function(_0x22822e){_0x545ccf['rows']=_0x22822e;return _0x545ccf;})[_0xf280('0x28')](respondWithFilteredResult(_0x2409f4,_0xa1fbb7))[_0xf280('0x46')](handleError(_0x2409f4,null));};exports[_0xf280('0x47')]=function(_0x408be4,_0x4dcffd){var _0x2ef2c6={'raw':!![],'where':{'id':_0x408be4[_0xf280('0x48')]['id']}},_0x456ac6={};_0x456ac6[_0xf280('0x31')]=_[_0xf280('0x34')](db['SquareDetailsReport'][_0xf280('0x2d')]);_0x456ac6['query']=_[_0xf280('0x34')](_0x408be4['query']);_0x456ac6[_0xf280('0x35')]=_[_0xf280('0x36')](_0x456ac6[_0xf280('0x31')],_0x456ac6['query']);_0x2ef2c6['attributes']=_[_0xf280('0x36')](_0x456ac6[_0xf280('0x31')],qs['fields'](_0x408be4[_0xf280('0x33')][_0xf280('0x37')]));_0x2ef2c6[_0xf280('0x38')]=_0x2ef2c6[_0xf280('0x38')][_0xf280('0x49')]?_0x2ef2c6['attributes']:_0x456ac6[_0xf280('0x31')];if(_0x408be4[_0xf280('0x33')][_0xf280('0x43')]){_0x2ef2c6[_0xf280('0x44')]=[{'all':!![]}];}_0x2ef2c6=_[_0xf280('0x3f')]({},_0x2ef2c6,_0x408be4[_0xf280('0x4a')]);return db[_0xf280('0x2c')]['find'](_0x2ef2c6)[_0xf280('0x28')](handleEntityNotFound(_0x4dcffd,null))[_0xf280('0x28')](respondWithResult(_0x4dcffd,null))[_0xf280('0x46')](handleError(_0x4dcffd,null));};exports[_0xf280('0x4b')]=function(_0x5648cc,_0x29c7f0){return db[_0xf280('0x2c')]['create'](_0x5648cc[_0xf280('0x4c')],{})[_0xf280('0x28')](respondWithResult(_0x29c7f0,0xc9))['catch'](handleError(_0x29c7f0,null));};exports[_0xf280('0x27')]=function(_0x4991d9,_0x5f45ca){if(_0x4991d9[_0xf280('0x4c')]['id']){delete _0x4991d9[_0xf280('0x4c')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x4991d9[_0xf280('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f45ca,null))[_0xf280('0x28')](saveUpdates(_0x4991d9[_0xf280('0x4c')],null))[_0xf280('0x28')](respondWithResult(_0x5f45ca,null))[_0xf280('0x46')](handleError(_0x5f45ca,null));};exports[_0xf280('0x29')]=function(_0x1c4522,_0xc3a873){return db['SquareDetailsReport'][_0xf280('0x4d')]({'where':{'id':_0x1c4522[_0xf280('0x48')]['id']}})['then'](handleEntityNotFound(_0xc3a873,null))['then'](removeEntity(_0xc3a873,null))['catch'](handleError(_0xc3a873,null));};exports['describe']=function(_0x5a8325,_0x1ed725){return db[_0xf280('0x2c')]['describe']()[_0xf280('0x28')](respondWithResult(_0x1ed725,null))[_0xf280('0x46')](handleError(_0x1ed725,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 42509b6..6b442f4 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 _0x47cd=['define','SquareDetailsReport','report_square_details','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x1948ce,_0x2cde41){var _0x58777d=function(_0x4a17f7){while(--_0x4a17f7){_0x1948ce['push'](_0x1948ce['shift']());}};_0x58777d(++_0x2cde41);}(_0x47cd,0x1c5));var _0xd47c=function(_0x5a08a0,_0xc74a2e){_0x5a08a0=_0x5a08a0-0x0;var _0x5bd3e3=_0x47cd[_0x5a08a0];return _0x5bd3e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd47c('0x0'))('api');var moment=require(_0xd47c('0x1'));var BPromise=require(_0xd47c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd47c('0x3'));var rimraf=require(_0xd47c('0x4'));var config=require(_0xd47c('0x5'));var attributes=require(_0xd47c('0x6'));module['exports']=function(_0x21e939,_0x9897f4){return _0x21e939[_0xd47c('0x7')](_0xd47c('0x8'),attributes,{'tableName':_0xd47c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d6f=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x57ba09,_0x2a594c){var _0xc06ec4=function(_0x2cb1a7){while(--_0x2cb1a7){_0x57ba09['push'](_0x57ba09['shift']());}};_0xc06ec4(++_0x2a594c);}(_0x1d6f,0xac));var _0xf1d6=function(_0xe3acc7,_0x8c7de0){_0xe3acc7=_0xe3acc7-0x0;var _0x1aefb0=_0x1d6f[_0xe3acc7];return _0x1aefb0;};'use strict';var _=require(_0xf1d6('0x0'));var util=require(_0xf1d6('0x1'));var logger=require(_0xf1d6('0x2'))(_0xf1d6('0x3'));var moment=require('moment');var BPromise=require(_0xf1d6('0x4'));var rp=require(_0xf1d6('0x5'));var fs=require('fs');var path=require(_0xf1d6('0x6'));var rimraf=require(_0xf1d6('0x7'));var config=require(_0xf1d6('0x8'));var attributes=require(_0xf1d6('0x9'));module['exports']=function(_0x10f8d3,_0x810075){return _0x10f8d3[_0xf1d6('0xa')](_0xf1d6('0xb'),attributes,{'tableName':_0xf1d6('0xc'),'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 3b1a4ee..346dc77 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 _0xcecc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info'];(function(_0x4430a9,_0x5f0b8d){var _0x2432da=function(_0x1cf2d2){while(--_0x1cf2d2){_0x4430a9['push'](_0x4430a9['shift']());}};_0x2432da(++_0x5f0b8d);}(_0xcecc,0x186));var _0xccec=function(_0x53b6af,_0x46a8f4){_0x53b6af=_0x53b6af-0x0;var _0x515770=_0xcecc[_0x53b6af];return _0x515770;};'use strict';var _=require(_0xccec('0x0'));var util=require('util');var moment=require(_0xccec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccec('0x2'));var db=require(_0xccec('0x3'))['db'];var utils=require(_0xccec('0x4'));var logger=require(_0xccec('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xccec('0x6'));var client=jayson['client'][_0xccec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44ed01,_0x2a66e5,_0x5788aa){return new BPromise(function(_0x372ea6,_0x3d7b1a){return client['request'](_0x44ed01,_0x5788aa)[_0xccec('0x8')](function(_0xbbf504){logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,'request\x20sent');logger[_0xccec('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2a66e5,_0xccec('0xc'),JSON[_0xccec('0xd')](_0xbbf504));if(_0xbbf504['error']){if(_0xbbf504[_0xccec('0xe')][_0xccec('0xf')]===0x1f4){logger[_0xccec('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);return _0x3d7b1a(_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);}logger[_0xccec('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')]['message']);return _0x372ea6(_0xbbf504['error']['message']);}else{logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,_0xccec('0xc'));_0x372ea6(_0xbbf504[_0xccec('0x11')][_0xccec('0x10')]);}})[_0xccec('0x12')](function(_0x7abe38){logger[_0xccec('0xe')](_0xccec('0xa'),_0x2a66e5,_0x7abe38);_0x3d7b1a(_0x7abe38);});});}exports['CreateSquareDetailsReport']=function(_0x518016){var _0x56b926=this;return new Promise(function(_0x970c66,_0x551d33){return db[_0xccec('0x13')][_0xccec('0x14')](_0x518016[_0xccec('0x15')],{'raw':_0x518016['options']?_0x518016[_0xccec('0x16')][_0xccec('0x17')]===undefined?!![]:![]:!![]})[_0xccec('0x8')](function(_0x4a7f08){logger[_0xccec('0x9')](_0xccec('0x18'),_0x518016);logger[_0xccec('0xb')]('CreateSquareDetailsReport',_0x518016,JSON[_0xccec('0xd')](_0x4a7f08));_0x970c66(_0x4a7f08);})['catch'](function(_0x9065a3){logger['error'](_0xccec('0x18'),_0x9065a3[_0xccec('0x10')],_0x518016);_0x551d33(_0x56b926[_0xccec('0xe')](0x1f4,_0x9065a3[_0xccec('0x10')]));});});}; \ No newline at end of file +var _0x49db=['../../config/utils','../../config/logger','../../config/environment','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x43e485,_0x3540d9){var _0x57006d=function(_0x54622f){while(--_0x54622f){_0x43e485['push'](_0x43e485['shift']());}};_0x57006d(++_0x3540d9);}(_0x49db,0xc5));var _0xb49d=function(_0x456a6f,_0x4e6a7b){_0x456a6f=_0x456a6f-0x0;var _0xe5c93f=_0x49db[_0x456a6f];return _0xe5c93f;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var moment=require(_0xb49d('0x2'));var BPromise=require(_0xb49d('0x3'));var rs=require(_0xb49d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb49d('0x5'))['db'];var utils=require(_0xb49d('0x6'));var logger=require(_0xb49d('0x7'))('rpc');var config=require(_0xb49d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb49d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4180c8,_0x15f52f,_0x572ee4){return new BPromise(function(_0x12e114,_0x128caa){return client[_0xb49d('0xa')](_0x4180c8,_0x572ee4)[_0xb49d('0xb')](function(_0x3d4825){logger[_0xb49d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x15f52f,'request\x20sent');logger[_0xb49d('0xd')](_0xb49d('0xe'),_0x15f52f,_0xb49d('0xf'),JSON[_0xb49d('0x10')](_0x3d4825));if(_0x3d4825[_0xb49d('0x11')]){if(_0x3d4825[_0xb49d('0x11')][_0xb49d('0x12')]===0x1f4){logger[_0xb49d('0x11')](_0xb49d('0x13'),_0x15f52f,_0x3d4825['error'][_0xb49d('0x14')]);return _0x128caa(_0x3d4825[_0xb49d('0x11')][_0xb49d('0x14')]);}logger[_0xb49d('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x15f52f,_0x3d4825[_0xb49d('0x11')][_0xb49d('0x14')]);return _0x12e114(_0x3d4825['error'][_0xb49d('0x14')]);}else{logger[_0xb49d('0xc')](_0xb49d('0x13'),_0x15f52f,_0xb49d('0xf'));_0x12e114(_0x3d4825[_0xb49d('0x15')][_0xb49d('0x14')]);}})[_0xb49d('0x16')](function(_0x584ade){logger[_0xb49d('0x11')](_0xb49d('0x13'),_0x15f52f,_0x584ade);_0x128caa(_0x584ade);});});}exports[_0xb49d('0x17')]=function(_0xf0bdff){var _0x4abce4=this;return new Promise(function(_0x4f3988,_0xfd7a95){return db[_0xb49d('0x18')][_0xb49d('0x19')](_0xf0bdff[_0xb49d('0x1a')],{'raw':_0xf0bdff[_0xb49d('0x1b')]?_0xf0bdff['options'][_0xb49d('0x1c')]===undefined?!![]:![]:!![]})[_0xb49d('0xb')](function(_0x3bf7a2){logger[_0xb49d('0xc')](_0xb49d('0x17'),_0xf0bdff);logger[_0xb49d('0xd')](_0xb49d('0x17'),_0xf0bdff,JSON[_0xb49d('0x10')](_0x3bf7a2));_0x4f3988(_0x3bf7a2);})[_0xb49d('0x16')](function(_0x38be04){logger[_0xb49d('0x11')](_0xb49d('0x17'),_0x38be04[_0xb49d('0x14')],_0xf0bdff);_0xfd7a95(_0x4abce4[_0xb49d('0x11')](0x1f4,_0x38be04[_0xb49d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 760f9d3..a1b7f8e 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 _0xe87f=['killProcess','express','../../components/auth/service','get','index','/process/:pid/kill','isAuthenticated'];(function(_0x23fdb2,_0x1e71e9){var _0x353754=function(_0x2f1b63){while(--_0x2f1b63){_0x23fdb2['push'](_0x23fdb2['shift']());}};_0x353754(++_0x1e71e9);}(_0xe87f,0x10b));var _0xfe87=function(_0x52aad8,_0x3d3dd0){_0x52aad8=_0x52aad8-0x0;var _0x4a25fb=_0xe87f[_0x52aad8];return _0x4a25fb;};'use strict';var express=require(_0xfe87('0x0'));var router=express['Router']();var auth=require(_0xfe87('0x1'));var controller=require('./system.controller');router[_0xfe87('0x2')]('/',auth['isAuthenticated'](),controller[_0xfe87('0x3')]);router['get'](_0xfe87('0x4'),auth[_0xfe87('0x5')](),controller[_0xfe87('0x6')]);module['exports']=router; \ No newline at end of file +var _0xb40e=['Router','../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xb40e,0x1ec));var _0xeb40=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0xb40e[_0x4503df];return _0x3f1b2b;};'use strict';var express=require('express');var router=express[_0xeb40('0x0')]();var auth=require(_0xeb40('0x1'));var controller=require(_0xeb40('0x2'));router['get']('/',auth[_0xeb40('0x3')](),controller[_0xeb40('0x4')]);router['get'](_0xeb40('0x5'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 118f30d..7b156f4 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 _0xaf69=['components/import/cm','format','params','pid','split','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xaf69,0x1c9));var _0x9af6=function(_0x48aad7,_0x1004f4){_0x48aad7=_0x48aad7-0x0;var _0x369618=_0xaf69[_0x48aad7];return _0x369618;};'use strict';var info=require(_0x9af6('0x0'));var exec=require(_0x9af6('0x1'))[_0x9af6('0x2')];var logger=require(_0x9af6('0x3'))('api');var util=require(_0x9af6('0x4'));var BPromise=require(_0x9af6('0x5'));var _=require(_0x9af6('0x6'));function handleError(_0x1082ea,_0x30ca0c,_0x102d84){_0x30ca0c=_0x30ca0c||0x1f4;return function(_0x32b58a){logger[_0x9af6('0x7')](_0x9af6('0x8'),_0x102d84,_0x30ca0c,util[_0x9af6('0x9')](_0x32b58a,{'showHidden':![],'depth':null}));delete _0x32b58a[_0x9af6('0xa')];_0x1082ea[_0x9af6('0xb')](_0x30ca0c)[_0x9af6('0xc')](_0x32b58a);};}exports[_0x9af6('0xd')]=function(_0x2f9679,_0x4fe015){return info[_0x9af6('0xe')]()[_0x9af6('0xf')](function(_0x16bdf5){return _0x4fe015[_0x9af6('0xb')](0xc8)[_0x9af6('0x10')](_0x16bdf5);})[_0x9af6('0x11')](function(_0x268225){return _0x4fe015[_0x9af6('0xb')](0x1f4)[_0x9af6('0x10')](_0x268225);});};exports[_0x9af6('0x12')]=function(_0x27e2e3,_0x353ac8){var _0x1a5f8e=[_0x9af6('0x13')];return new BPromise(function(_0x2998e2,_0x1221d6){return exec(util[_0x9af6('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x27e2e3[_0x9af6('0x15')][_0x9af6('0x16')]),function(_0x4fd92f,_0x12dc5d,_0x29b24a){if(_0x4fd92f){return _0x1221d6(_0x4fd92f);}return _0x2998e2(_0x12dc5d);});})[_0x9af6('0xf')](function(_0x5c1f4a){var _0x183076=![];var _0x216491=_0x5c1f4a[_0x9af6('0x17')](/\n/);for(var _0x2f81bd=0x0,_0x22c41b=_0x1a5f8e['length'];_0x2f81bd<_0x22c41b,_0x183076===![];_0x2f81bd+=0x1){if(_0x5c1f4a[_0x9af6('0x18')](_0x1a5f8e[_0x2f81bd])>=0x0){_0x183076=!![];}}if(!_0x183076){throw new Error(util[_0x9af6('0x14')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x27e2e3['params'][_0x9af6('0x16')]));}process[_0x9af6('0x19')](_0x27e2e3['params'][_0x9af6('0x16')],_0x9af6('0x1a'));return _0x353ac8[_0x9af6('0xb')](0xc8)[_0x9af6('0x10')]({'message':util[_0x9af6('0x14')](_0x9af6('0x1b'),_0x27e2e3['params']['pid'])});})['catch'](handleError(_0x353ac8,null,_0x9af6('0x12')));}; \ No newline at end of file +var _0x34f0=['components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','catch','killProcess'];(function(_0x593a32,_0x500670){var _0x5b4b0=function(_0x1df389){while(--_0x1df389){_0x593a32['push'](_0x593a32['shift']());}};_0x5b4b0(++_0x500670);}(_0x34f0,0xf4));var _0x034f=function(_0x4fc9fc,_0x36f33d){_0x4fc9fc=_0x4fc9fc-0x0;var _0x2ffa73=_0x34f0[_0x4fc9fc];return _0x2ffa73;};'use strict';var info=require(_0x034f('0x0'));var exec=require(_0x034f('0x1'))[_0x034f('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x034f('0x3'));var BPromise=require(_0x034f('0x4'));var _=require(_0x034f('0x5'));function handleError(_0x5c331e,_0x59abe7,_0x1fde0f){_0x59abe7=_0x59abe7||0x1f4;return function(_0x346e76){logger[_0x034f('0x6')](_0x034f('0x7'),_0x1fde0f,_0x59abe7,util[_0x034f('0x8')](_0x346e76,{'showHidden':![],'depth':null}));delete _0x346e76[_0x034f('0x9')];_0x5c331e[_0x034f('0xa')](_0x59abe7)['send'](_0x346e76);};}exports[_0x034f('0xb')]=function(_0x1644e8,_0x1ce771){return info[_0x034f('0xc')]()[_0x034f('0xd')](function(_0x380151){return _0x1ce771[_0x034f('0xa')](0xc8)[_0x034f('0xe')](_0x380151);})[_0x034f('0xf')](function(_0x59c961){return _0x1ce771[_0x034f('0xa')](0x1f4)['json'](_0x59c961);});};exports[_0x034f('0x10')]=function(_0x1e018e,_0x184caa){var _0x3634ab=[_0x034f('0x11')];return new BPromise(function(_0xe84e79,_0x1e1dcc){return exec(util['format'](_0x034f('0x12'),_0x1e018e[_0x034f('0x13')][_0x034f('0x14')]),function(_0xe67ea2,_0x4f903c,_0x5d0be3){if(_0xe67ea2){return _0x1e1dcc(_0xe67ea2);}return _0xe84e79(_0x4f903c);});})['then'](function(_0x3de5d9){var _0x3bcfd2=![];var _0xf7f48c=_0x3de5d9[_0x034f('0x15')](/\n/);for(var _0x354f51=0x0,_0x4289fe=_0x3634ab[_0x034f('0x16')];_0x354f51<_0x4289fe,_0x3bcfd2===![];_0x354f51+=0x1){if(_0x3de5d9[_0x034f('0x17')](_0x3634ab[_0x354f51])>=0x0){_0x3bcfd2=!![];}}if(!_0x3bcfd2){throw new Error(util['format'](_0x034f('0x18'),_0x1e018e[_0x034f('0x13')]['pid']));}process[_0x034f('0x19')](_0x1e018e[_0x034f('0x13')][_0x034f('0x14')],_0x034f('0x1a'));return _0x184caa['status'](0xc8)[_0x034f('0xe')]({'message':util[_0x034f('0x1b')](_0x034f('0x1c'),_0x1e018e[_0x034f('0x13')]['pid'])});})[_0x034f('0xf')](handleError(_0x184caa,null,_0x034f('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index bc0b677..11cbfe0 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 _0x80e4=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x3b9412,_0x59d699){var _0x23639a=function(_0x106ee8){while(--_0x106ee8){_0x3b9412['push'](_0x3b9412['shift']());}};_0x23639a(++_0x59d699);}(_0x80e4,0x103));var _0x480e=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x80e4[_0x4d7f3f];return _0x5d67cc;};'use strict';var multer=require(_0x480e('0x0'));var util=require(_0x480e('0x1'));var path=require(_0x480e('0x2'));var timeout=require('connect-timeout');var express=require(_0x480e('0x3'));var router=express[_0x480e('0x4')]();var fs_extra=require(_0x480e('0x5'));var auth=require(_0x480e('0x6'));var interaction=require(_0x480e('0x7'));var config=require('../../config/environment');var controller=require(_0x480e('0x8'));router[_0x480e('0x9')]('/',auth[_0x480e('0xa')](),controller[_0x480e('0xb')]);router[_0x480e('0x9')](_0x480e('0xc'),auth[_0x480e('0xa')](),controller[_0x480e('0xd')]);router[_0x480e('0xe')]('/',auth[_0x480e('0xa')](),controller[_0x480e('0xf')]);router[_0x480e('0x10')]('/:id',auth[_0x480e('0xa')](),controller[_0x480e('0x11')]);router[_0x480e('0x12')](_0x480e('0xc'),auth[_0x480e('0xa')](),controller[_0x480e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0fe9=['Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x4b305b,_0x36cea0){var _0x452fff=function(_0x2a10ca){while(--_0x2a10ca){_0x4b305b['push'](_0x4b305b['shift']());}};_0x452fff(++_0x36cea0);}(_0x0fe9,0x74));var _0x90fe=function(_0x1e49fc,_0x4bfa6d){_0x1e49fc=_0x1e49fc-0x0;var _0x350dcd=_0x0fe9[_0x1e49fc];return _0x350dcd;};'use strict';var multer=require(_0x90fe('0x0'));var util=require(_0x90fe('0x1'));var path=require('path');var timeout=require(_0x90fe('0x2'));var express=require(_0x90fe('0x3'));var router=express[_0x90fe('0x4')]();var fs_extra=require(_0x90fe('0x5'));var auth=require(_0x90fe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x90fe('0x7'));var controller=require(_0x90fe('0x8'));router[_0x90fe('0x9')]('/',auth[_0x90fe('0xa')](),controller[_0x90fe('0xb')]);router[_0x90fe('0x9')](_0x90fe('0xc'),auth[_0x90fe('0xa')](),controller[_0x90fe('0xd')]);router[_0x90fe('0xe')]('/',auth[_0x90fe('0xa')](),controller[_0x90fe('0xf')]);router[_0x90fe('0x10')](_0x90fe('0xc'),auth[_0x90fe('0xa')](),controller[_0x90fe('0x11')]);router[_0x90fe('0x12')](_0x90fe('0xc'),auth['isAuthenticated'](),controller[_0x90fe('0x13')]);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 23ea9a7..96a9941 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 _0xe9ad=['sequelize','exports','STRING','name','#0091EA'];(function(_0x5a0b69,_0x219438){var _0x2dd990=function(_0x4400cd){while(--_0x4400cd){_0x5a0b69['push'](_0x5a0b69['shift']());}};_0x2dd990(++_0x219438);}(_0xe9ad,0x82));var _0xde9a=function(_0x13fd59,_0x2e05b1){_0x13fd59=_0x13fd59-0x0;var _0x2e6ce7=_0xe9ad[_0x13fd59];return _0x2e6ce7;};'use strict';var Sequelize=require(_0xde9a('0x0'));module[_0xde9a('0x1')]={'name':{'type':Sequelize[_0xde9a('0x2')],'unique':_0xde9a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xde9a('0x2')],'defaultValue':_0xde9a('0x4')},'description':{'type':Sequelize[_0xde9a('0x2')]}}; \ No newline at end of file +var _0x6215=['sequelize','exports','STRING','#0091EA'];(function(_0x52f4b8,_0x5eaed9){var _0x52c0f9=function(_0x4a5e95){while(--_0x4a5e95){_0x52f4b8['push'](_0x52f4b8['shift']());}};_0x52c0f9(++_0x5eaed9);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5621('0x0'));module[_0x5621('0x1')]={'name':{'type':Sequelize[_0x5621('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5621('0x2')],'defaultValue':_0x5621('0x3')},'description':{'type':Sequelize[_0x5621('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 4b9b6dd..d009d49 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 _0xd64b=['Tags','stack','name','send','index','map','Tag','rawAttributes','type','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','merge','filter','options','includeAll','include','findAll','catch','params','filters','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','apply','reject','update','then','destroy','get'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0xd64b,0xc1));var _0xbd64=function(_0x237d51,_0x5382b0){_0x237d51=_0x237d51-0x0;var _0x4d3eb0=_0xd64b[_0x237d51];return _0x4d3eb0;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136f60,_0x2729d8){_0x2729d8=_0x2729d8||0xcc;return function(_0x3a941c){if(_0x3a941c){return _0x136f60[_0xbd64('0x16')](_0x2729d8);}return _0x136f60[_0xbd64('0x17')](_0x2729d8)[_0xbd64('0x18')]();};}function respondWithResult(_0x2e23f2,_0x269e2f){_0x269e2f=_0x269e2f||0xc8;return function(_0x2b5808){if(_0x2b5808){return _0x2e23f2['status'](_0x269e2f)[_0xbd64('0x19')](_0x2b5808);}};}function respondWithFilteredResult(_0x13e7a4,_0x3ff550){return function(_0x32fd34){if(_0x32fd34){var _0x29fc16=typeof _0x3ff550['offset']===_0xbd64('0x1a')&&typeof _0x3ff550['limit']===_0xbd64('0x1a');var _0x1432a6=_0x32fd34[_0xbd64('0x1b')];var _0x1d7a14=_0x29fc16?0x0:_0x3ff550[_0xbd64('0x1c')];var _0x2f4554=_0x29fc16?_0x32fd34[_0xbd64('0x1b')]:_0x3ff550[_0xbd64('0x1c')]+_0x3ff550['limit'];var _0x305545;if(_0x2f4554>=_0x1432a6){_0x2f4554=_0x1432a6;_0x305545=0xc8;}else{_0x305545=0xce;}_0x13e7a4[_0xbd64('0x17')](_0x305545);return _0x13e7a4['set']('Content-Range',_0x1d7a14+'-'+_0x2f4554+'/'+_0x1432a6)[_0xbd64('0x19')](_0x32fd34);}return null;};}function patchUpdates(_0x42b328){return function(_0x196d21){try{jsonpatch[_0xbd64('0x1d')](_0x196d21,_0x42b328,!![]);}catch(_0x2c5551){return BPromise[_0xbd64('0x1e')](_0x2c5551);}return _0x196d21['save']();};}function saveUpdates(_0x4d4a16,_0x6038f){return function(_0x41f2f){if(_0x41f2f){return _0x41f2f[_0xbd64('0x1f')](_0x4d4a16)[_0xbd64('0x20')](function(_0x55e74c){return _0x55e74c;});}return null;};}function removeEntity(_0x51d118,_0x28497c){return function(_0x4afaff){if(_0x4afaff){return _0x4afaff[_0xbd64('0x21')]()['then'](function(){var _0x33452d=_0x4afaff[_0xbd64('0x22')]({'plain':!![]});var _0x3d12a0=_0xbd64('0x23');return db['UserProfileResource'][_0xbd64('0x21')]({'where':{'type':_0x3d12a0,'resourceId':_0x33452d['id']}})[_0xbd64('0x20')](function(){return _0x4afaff;});})[_0xbd64('0x20')](function(){_0x51d118[_0xbd64('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8719,_0x29c9c8){return function(_0x49eac5){if(!_0x49eac5){_0x4e8719['sendStatus'](0x194);}return _0x49eac5;};}function handleError(_0xfa918,_0x5aacdd){_0x5aacdd=_0x5aacdd||0x1f4;return function(_0x3cf5b7){logger['error'](_0x3cf5b7[_0xbd64('0x24')]);if(_0x3cf5b7['name']){delete _0x3cf5b7[_0xbd64('0x25')];}_0xfa918[_0xbd64('0x17')](_0x5aacdd)[_0xbd64('0x26')](_0x3cf5b7);};}exports[_0xbd64('0x27')]=function(_0x306f19,_0x207ffc){var _0x4ed44a={},_0x35bdd5={},_0xe876c9={'count':0x0,'rows':[]};var _0xc44280=_[_0xbd64('0x28')](db[_0xbd64('0x29')][_0xbd64('0x2a')],function(_0x5e70d3){return{'name':_0x5e70d3['fieldName'],'type':_0x5e70d3[_0xbd64('0x2b')]['key']};});_0x35bdd5[_0xbd64('0x2c')]=_[_0xbd64('0x28')](_0xc44280,'name');_0x35bdd5['query']=_[_0xbd64('0x2d')](_0x306f19['query']);_0x35bdd5['filters']=_[_0xbd64('0x2e')](_0x35bdd5[_0xbd64('0x2c')],_0x35bdd5[_0xbd64('0x2f')]);_0x4ed44a['attributes']=_[_0xbd64('0x2e')](_0x35bdd5['model'],qs[_0xbd64('0x30')](_0x306f19[_0xbd64('0x2f')][_0xbd64('0x30')]));_0x4ed44a[_0xbd64('0x31')]=_0x4ed44a[_0xbd64('0x31')][_0xbd64('0x32')]?_0x4ed44a['attributes']:_0x35bdd5['model'];if(!_0x306f19[_0xbd64('0x2f')][_0xbd64('0x33')](_0xbd64('0x34'))){_0x4ed44a[_0xbd64('0x35')]=qs[_0xbd64('0x35')](_0x306f19[_0xbd64('0x2f')]['limit']);_0x4ed44a['offset']=qs[_0xbd64('0x1c')](_0x306f19[_0xbd64('0x2f')][_0xbd64('0x1c')]);}_0x4ed44a['order']=qs['sort'](_0x306f19[_0xbd64('0x2f')]['sort']);_0x4ed44a[_0xbd64('0x36')]=qs['filters'](_[_0xbd64('0x37')](_0x306f19[_0xbd64('0x2f')],_0x35bdd5['filters']),_0xc44280);if(_0x306f19[_0xbd64('0x2f')]['filter']){_0x4ed44a['where']=_[_0xbd64('0x38')](_0x4ed44a[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0xc44280,function(_0x52f401){if(_0x52f401['type']!=='VIRTUAL'){var _0x344d46={};_0x344d46[_0x52f401[_0xbd64('0x25')]]={'$like':'%'+_0x306f19['query'][_0xbd64('0x39')]+'%'};return _0x344d46;}})});}_0x4ed44a=_[_0xbd64('0x38')]({},_0x4ed44a,_0x306f19[_0xbd64('0x3a')]);var _0x27fd12={'where':_0x4ed44a['where']};return db['Tag'][_0xbd64('0x1b')](_0x27fd12)['then'](function(_0x595a91){_0xe876c9[_0xbd64('0x1b')]=_0x595a91;if(_0x306f19[_0xbd64('0x2f')][_0xbd64('0x3b')]){_0x4ed44a[_0xbd64('0x3c')]=[{'all':!![]}];}return db[_0xbd64('0x29')][_0xbd64('0x3d')](_0x4ed44a);})[_0xbd64('0x20')](function(_0x762380){_0xe876c9['rows']=_0x762380;return _0xe876c9;})[_0xbd64('0x20')](respondWithFilteredResult(_0x207ffc,_0x4ed44a))[_0xbd64('0x3e')](handleError(_0x207ffc,null));};exports['show']=function(_0x41b27a,_0x1e4983){var _0xe5b069={'raw':!![],'where':{'id':_0x41b27a[_0xbd64('0x3f')]['id']}},_0x2bc972={};_0x2bc972[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db['Tag'][_0xbd64('0x2a')]);_0x2bc972['query']=_[_0xbd64('0x2d')](_0x41b27a['query']);_0x2bc972[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x2bc972[_0xbd64('0x2c')],_0x2bc972['query']);_0xe5b069[_0xbd64('0x31')]=_['intersection'](_0x2bc972['model'],qs['fields'](_0x41b27a[_0xbd64('0x2f')][_0xbd64('0x30')]));_0xe5b069[_0xbd64('0x31')]=_0xe5b069[_0xbd64('0x31')][_0xbd64('0x32')]?_0xe5b069[_0xbd64('0x31')]:_0x2bc972[_0xbd64('0x2c')];if(_0x41b27a['query'][_0xbd64('0x3b')]){_0xe5b069[_0xbd64('0x3c')]=[{'all':!![]}];}_0xe5b069=_[_0xbd64('0x38')]({},_0xe5b069,_0x41b27a['options']);return db[_0xbd64('0x29')][_0xbd64('0x41')](_0xe5b069)[_0xbd64('0x20')](handleEntityNotFound(_0x1e4983,null))[_0xbd64('0x20')](respondWithResult(_0x1e4983,null))[_0xbd64('0x3e')](handleError(_0x1e4983,null));};exports['create']=function(_0x283699,_0x1a9ec8){return db[_0xbd64('0x29')][_0xbd64('0x42')](_0x283699['body'],{})['then'](function(_0x1e008f){var _0x2a7eec=_0x283699[_0xbd64('0x43')][_0xbd64('0x22')]({'plain':!![]});if(!_0x2a7eec)throw new Error(_0xbd64('0x44'));if(_0x2a7eec[_0xbd64('0x45')]===_0xbd64('0x43')){var _0x3807a7=_0x1e008f[_0xbd64('0x22')]({'plain':!![]});var _0x2709b2=_0xbd64('0x23');return db[_0xbd64('0x46')][_0xbd64('0x41')]({'where':{'name':_0x2709b2,'userProfileId':_0x2a7eec[_0xbd64('0x47')]},'raw':!![]})[_0xbd64('0x20')](function(_0x5bd444){if(_0x5bd444&&_0x5bd444[_0xbd64('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x3807a7['name'],'resourceId':_0x3807a7['id'],'type':_0x5bd444['name'],'sectionId':_0x5bd444['id']},{})[_0xbd64('0x20')](function(){return _0x1e008f;});}else{return _0x1e008f;}})[_0xbd64('0x3e')](function(_0x5480f5){logger[_0xbd64('0x49')](_0xbd64('0x4a'),_0x5480f5);throw _0x5480f5;});}return _0x1e008f;})[_0xbd64('0x20')](respondWithResult(_0x1a9ec8,0xc9))['catch'](handleError(_0x1a9ec8,null));};exports[_0xbd64('0x1f')]=function(_0x371bad,_0x44cd4f){if(_0x371bad[_0xbd64('0x4b')]['id']){delete _0x371bad[_0xbd64('0x4b')]['id'];}return db[_0xbd64('0x29')]['find']({'where':{'id':_0x371bad['params']['id']}})['then'](handleEntityNotFound(_0x44cd4f,null))[_0xbd64('0x20')](saveUpdates(_0x371bad[_0xbd64('0x4b')],null))[_0xbd64('0x20')](respondWithResult(_0x44cd4f,null))[_0xbd64('0x3e')](handleError(_0x44cd4f,null));};exports['destroy']=function(_0x1d0d9f,_0x20b275){return db[_0xbd64('0x29')][_0xbd64('0x41')]({'where':{'id':_0x1d0d9f[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x20b275,null))['then'](removeEntity(_0x20b275,null))[_0xbd64('0x3e')](handleError(_0x20b275,null));}; \ No newline at end of file +var _0x9099=['includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','get','Tags','destroy','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x8956db,_0x565a5f){var _0x175a41=function(_0x51a8d0){while(--_0x51a8d0){_0x8956db['push'](_0x8956db['shift']());}};_0x175a41(++_0x565a5f);}(_0x9099,0x1ac));var _0x9909=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x9099[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0x9909('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9909('0x1'));var jsonpatch=require(_0x9909('0x2'));var rp=require(_0x9909('0x3'));var moment=require(_0x9909('0x4'));var BPromise=require(_0x9909('0x5'));var Mustache=require(_0x9909('0x6'));var util=require(_0x9909('0x7'));var path=require(_0x9909('0x8'));var sox=require(_0x9909('0x9'));var csv=require(_0x9909('0xa'));var ejs=require(_0x9909('0xb'));var fs=require('fs');var fs_extra=require(_0x9909('0xc'));var _=require(_0x9909('0xd'));var squel=require(_0x9909('0xe'));var crypto=require('crypto');var jsforce=require(_0x9909('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9909('0x11'));var as=require(_0x9909('0x12'));var hardwareService=require(_0x9909('0x13'));var logger=require('../../config/logger')(_0x9909('0x14'));var utils=require('../../config/utils');var config=require(_0x9909('0x15'));var licenseUtil=require(_0x9909('0x16'));var db=require(_0x9909('0x17'))['db'];function respondWithStatusCode(_0x3ba080,_0x1c69bb){_0x1c69bb=_0x1c69bb||0xcc;return function(_0x5cc11e){if(_0x5cc11e){return _0x3ba080[_0x9909('0x18')](_0x1c69bb);}return _0x3ba080[_0x9909('0x19')](_0x1c69bb)[_0x9909('0x1a')]();};}function respondWithResult(_0xef3295,_0x1c2668){_0x1c2668=_0x1c2668||0xc8;return function(_0x38c2e3){if(_0x38c2e3){return _0xef3295[_0x9909('0x19')](_0x1c2668)['json'](_0x38c2e3);}};}function respondWithFilteredResult(_0x33a8e3,_0x55e800){return function(_0x1f32cc){if(_0x1f32cc){var _0x5bd7e7=typeof _0x55e800[_0x9909('0x1b')]===_0x9909('0x1c')&&typeof _0x55e800[_0x9909('0x1d')]==='undefined';var _0x9a16a6=_0x1f32cc[_0x9909('0x1e')];var _0x180929=_0x5bd7e7?0x0:_0x55e800[_0x9909('0x1b')];var _0x1106e5=_0x5bd7e7?_0x1f32cc[_0x9909('0x1e')]:_0x55e800[_0x9909('0x1b')]+_0x55e800['limit'];var _0x1b038f;if(_0x1106e5>=_0x9a16a6){_0x1106e5=_0x9a16a6;_0x1b038f=0xc8;}else{_0x1b038f=0xce;}_0x33a8e3[_0x9909('0x19')](_0x1b038f);return _0x33a8e3['set'](_0x9909('0x1f'),_0x180929+'-'+_0x1106e5+'/'+_0x9a16a6)[_0x9909('0x20')](_0x1f32cc);}return null;};}function patchUpdates(_0x20c236){return function(_0x1553ae){try{jsonpatch[_0x9909('0x21')](_0x1553ae,_0x20c236,!![]);}catch(_0x222cd9){return BPromise[_0x9909('0x22')](_0x222cd9);}return _0x1553ae['save']();};}function saveUpdates(_0x112727,_0x319c31){return function(_0x4a626b){if(_0x4a626b){return _0x4a626b['update'](_0x112727)[_0x9909('0x23')](function(_0x176593){return _0x176593;});}return null;};}function removeEntity(_0xdd5088,_0x19e66b){return function(_0x2f15fa){if(_0x2f15fa){return _0x2f15fa['destroy']()['then'](function(){var _0x2d83a5=_0x2f15fa[_0x9909('0x24')]({'plain':!![]});var _0x614308=_0x9909('0x25');return db['UserProfileResource'][_0x9909('0x26')]({'where':{'type':_0x614308,'resourceId':_0x2d83a5['id']}})[_0x9909('0x23')](function(){return _0x2f15fa;});})[_0x9909('0x23')](function(){_0xdd5088[_0x9909('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x405c5e,_0x22ff12){return function(_0x19c7e8){if(!_0x19c7e8){_0x405c5e[_0x9909('0x18')](0x194);}return _0x19c7e8;};}function handleError(_0x5250d8,_0xb0b66f){_0xb0b66f=_0xb0b66f||0x1f4;return function(_0x175d52){logger[_0x9909('0x27')](_0x175d52[_0x9909('0x28')]);if(_0x175d52[_0x9909('0x29')]){delete _0x175d52[_0x9909('0x29')];}_0x5250d8[_0x9909('0x19')](_0xb0b66f)['send'](_0x175d52);};}exports[_0x9909('0x2a')]=function(_0x3a3f4f,_0x87ac8a){var _0x42f1e5={},_0x3e4e07={},_0x519066={'count':0x0,'rows':[]};var _0x4245eb=_[_0x9909('0x2b')](db[_0x9909('0x2c')][_0x9909('0x2d')],function(_0xc1bd06){return{'name':_0xc1bd06[_0x9909('0x2e')],'type':_0xc1bd06[_0x9909('0x2f')][_0x9909('0x30')]};});_0x3e4e07['model']=_['map'](_0x4245eb,_0x9909('0x29'));_0x3e4e07[_0x9909('0x31')]=_['keys'](_0x3a3f4f[_0x9909('0x31')]);_0x3e4e07[_0x9909('0x32')]=_[_0x9909('0x33')](_0x3e4e07[_0x9909('0x34')],_0x3e4e07[_0x9909('0x31')]);_0x42f1e5[_0x9909('0x35')]=_[_0x9909('0x33')](_0x3e4e07['model'],qs[_0x9909('0x36')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x36')]));_0x42f1e5[_0x9909('0x35')]=_0x42f1e5[_0x9909('0x35')]['length']?_0x42f1e5[_0x9909('0x35')]:_0x3e4e07[_0x9909('0x34')];if(!_0x3a3f4f['query'][_0x9909('0x37')](_0x9909('0x38'))){_0x42f1e5[_0x9909('0x1d')]=qs[_0x9909('0x1d')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x1d')]);_0x42f1e5['offset']=qs[_0x9909('0x1b')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x1b')]);}_0x42f1e5[_0x9909('0x39')]=qs[_0x9909('0x3a')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x3a')]);_0x42f1e5[_0x9909('0x3b')]=qs[_0x9909('0x32')](_[_0x9909('0x3c')](_0x3a3f4f[_0x9909('0x31')],_0x3e4e07[_0x9909('0x32')]),_0x4245eb);if(_0x3a3f4f[_0x9909('0x31')][_0x9909('0x3d')]){_0x42f1e5[_0x9909('0x3b')]=_[_0x9909('0x3e')](_0x42f1e5[_0x9909('0x3b')],{'$or':_[_0x9909('0x2b')](_0x4245eb,function(_0x1b5e2b){if(_0x1b5e2b[_0x9909('0x2f')]!==_0x9909('0x3f')){var _0x1b224d={};_0x1b224d[_0x1b5e2b[_0x9909('0x29')]]={'$like':'%'+_0x3a3f4f['query']['filter']+'%'};return _0x1b224d;}})});}_0x42f1e5=_[_0x9909('0x3e')]({},_0x42f1e5,_0x3a3f4f['options']);var _0x52724f={'where':_0x42f1e5[_0x9909('0x3b')]};return db[_0x9909('0x2c')][_0x9909('0x1e')](_0x52724f)[_0x9909('0x23')](function(_0x556fad){_0x519066[_0x9909('0x1e')]=_0x556fad;if(_0x3a3f4f[_0x9909('0x31')][_0x9909('0x40')]){_0x42f1e5['include']=[{'all':!![]}];}return db[_0x9909('0x2c')][_0x9909('0x41')](_0x42f1e5);})[_0x9909('0x23')](function(_0x4b0a4c){_0x519066[_0x9909('0x42')]=_0x4b0a4c;return _0x519066;})[_0x9909('0x23')](respondWithFilteredResult(_0x87ac8a,_0x42f1e5))[_0x9909('0x43')](handleError(_0x87ac8a,null));};exports[_0x9909('0x44')]=function(_0x1f57bd,_0x856057){var _0xef5aa6={'raw':!![],'where':{'id':_0x1f57bd['params']['id']}},_0x3b1844={};_0x3b1844[_0x9909('0x34')]=_[_0x9909('0x45')](db['Tag'][_0x9909('0x2d')]);_0x3b1844[_0x9909('0x31')]=_['keys'](_0x1f57bd['query']);_0x3b1844[_0x9909('0x32')]=_[_0x9909('0x33')](_0x3b1844[_0x9909('0x34')],_0x3b1844[_0x9909('0x31')]);_0xef5aa6[_0x9909('0x35')]=_[_0x9909('0x33')](_0x3b1844[_0x9909('0x34')],qs[_0x9909('0x36')](_0x1f57bd[_0x9909('0x31')][_0x9909('0x36')]));_0xef5aa6['attributes']=_0xef5aa6[_0x9909('0x35')][_0x9909('0x46')]?_0xef5aa6[_0x9909('0x35')]:_0x3b1844[_0x9909('0x34')];if(_0x1f57bd['query']['includeAll']){_0xef5aa6[_0x9909('0x47')]=[{'all':!![]}];}_0xef5aa6=_['merge']({},_0xef5aa6,_0x1f57bd[_0x9909('0x48')]);return db[_0x9909('0x2c')][_0x9909('0x49')](_0xef5aa6)['then'](handleEntityNotFound(_0x856057,null))[_0x9909('0x23')](respondWithResult(_0x856057,null))[_0x9909('0x43')](handleError(_0x856057,null));};exports[_0x9909('0x4a')]=function(_0x54152c,_0x271984){return db[_0x9909('0x2c')][_0x9909('0x4a')](_0x54152c[_0x9909('0x4b')],{})[_0x9909('0x23')](function(_0x137fb6){var _0x8fbd0c=_0x54152c['user'][_0x9909('0x24')]({'plain':!![]});if(!_0x8fbd0c)throw new Error(_0x9909('0x4c'));if(_0x8fbd0c['role']===_0x9909('0x4d')){var _0x240947=_0x137fb6[_0x9909('0x24')]({'plain':!![]});var _0x37697d=_0x9909('0x25');return db['UserProfileSection'][_0x9909('0x49')]({'where':{'name':_0x37697d,'userProfileId':_0x8fbd0c['userProfileId']},'raw':!![]})[_0x9909('0x23')](function(_0x159e08){if(_0x159e08&&_0x159e08[_0x9909('0x4e')]===0x0){return db[_0x9909('0x4f')][_0x9909('0x4a')]({'name':_0x240947[_0x9909('0x29')],'resourceId':_0x240947['id'],'type':_0x159e08[_0x9909('0x29')],'sectionId':_0x159e08['id']},{})[_0x9909('0x23')](function(){return _0x137fb6;});}else{return _0x137fb6;}})['catch'](function(_0x51b214){logger[_0x9909('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51b214);throw _0x51b214;});}return _0x137fb6;})['then'](respondWithResult(_0x271984,0xc9))[_0x9909('0x43')](handleError(_0x271984,null));};exports[_0x9909('0x50')]=function(_0x49659a,_0x1144e0){if(_0x49659a[_0x9909('0x4b')]['id']){delete _0x49659a[_0x9909('0x4b')]['id'];}return db[_0x9909('0x2c')][_0x9909('0x49')]({'where':{'id':_0x49659a[_0x9909('0x51')]['id']}})['then'](handleEntityNotFound(_0x1144e0,null))[_0x9909('0x23')](saveUpdates(_0x49659a[_0x9909('0x4b')],null))['then'](respondWithResult(_0x1144e0,null))['catch'](handleError(_0x1144e0,null));};exports[_0x9909('0x26')]=function(_0x508b6a,_0x180cf5){return db[_0x9909('0x2c')][_0x9909('0x49')]({'where':{'id':_0x508b6a[_0x9909('0x51')]['id']}})['then'](handleEntityNotFound(_0x180cf5,null))['then'](removeEntity(_0x180cf5,null))['catch'](handleError(_0x180cf5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7a36db6..96236a0 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 _0x8ae8=['request-promise','path','rimraf','../../config/environment','exports','define','Tag','lodash','../../config/logger','api','moment','bluebird'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x8ae8,0x163));var _0x88ae=function(_0xd73be6,_0x15e94d){_0xd73be6=_0xd73be6-0x0;var _0x155ad0=_0x8ae8[_0xd73be6];return _0x155ad0;};'use strict';var _=require(_0x88ae('0x0'));var util=require('util');var logger=require(_0x88ae('0x1'))(_0x88ae('0x2'));var moment=require(_0x88ae('0x3'));var BPromise=require(_0x88ae('0x4'));var rp=require(_0x88ae('0x5'));var fs=require('fs');var path=require(_0x88ae('0x6'));var rimraf=require(_0x88ae('0x7'));var config=require(_0x88ae('0x8'));var attributes=require('./tag.attributes');module[_0x88ae('0x9')]=function(_0x2874cd,_0x4037fc){return _0x2874cd[_0x88ae('0xa')](_0x88ae('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8840=['path','rimraf','../../config/environment','define','Tag','lodash','../../config/logger','bluebird','request-promise'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x8840,0x1ac));var _0x0884=function(_0x2859f2,_0x1e3102){_0x2859f2=_0x2859f2-0x0;var _0x4974cd=_0x8840[_0x2859f2];return _0x4974cd;};'use strict';var _=require(_0x0884('0x0'));var util=require('util');var logger=require(_0x0884('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0884('0x2'));var rp=require(_0x0884('0x3'));var fs=require('fs');var path=require(_0x0884('0x4'));var rimraf=require(_0x0884('0x5'));var config=require(_0x0884('0x6'));var attributes=require('./tag.attributes');module['exports']=function(_0x3011e4,_0x5d1866){return _0x3011e4[_0x0884('0x7')](_0x0884('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a45f8ef..5c28273 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 _0xbec5=['info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x6f3151,_0x406745){var _0x305fb8=function(_0x24e5a8){while(--_0x24e5a8){_0x6f3151['push'](_0x6f3151['shift']());}};_0x305fb8(++_0x406745);}(_0xbec5,0xe5));var _0x5bec=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0xbec5[_0x59710f];return _0xaae66a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('Tag,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x87ddb8,_0x32f007){var _0x352d4e=function(_0x36038c){while(--_0x36038c){_0x87ddb8['push'](_0x87ddb8['shift']());}};_0x352d4e(++_0x32f007);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 61c265f..2d5f94e 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_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['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 65ab238..64e3db3 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 _0x757a=['exports','STRING'];(function(_0x407bb4,_0xecf04e){var _0x158ffb=function(_0xe3e75b){while(--_0xe3e75b){_0x407bb4['push'](_0x407bb4['shift']());}};_0x158ffb(++_0xecf04e);}(_0x757a,0xde));var _0xa757=function(_0x33a10a,_0x3f55b9){_0x33a10a=_0x33a10a-0x0;var _0x3d4084=_0x757a[_0x33a10a];return _0x3d4084;};'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(_0x3f47de,_0x442a12){var _0x2646d1=function(_0x485b93){while(--_0x485b93){_0x3f47de['push'](_0x3f47de['shift']());}};_0x2646d1(++_0x442a12);}(_0xb10b,0x12a));var _0xbb10=function(_0x338c8c,_0x19df14){_0x338c8c=_0x338c8c-0x0;var _0x371a9a=_0xb10b[_0x338c8c];return _0x371a9a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index fbb22ce..a98be41 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 _0xca2c=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','Team','query','keys','intersection','attributes','model','fields','length','order','where','filters','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','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','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserProfileResource','end','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','sort','pick','capitalize','Queues','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','through','User','findOrCreate','emit','Queue:save','QueueId','interface','UserVoiceQueueRt','upsert','isNil','format','voicePause','all','TeamVoicePrefix','VoicePrefixId','addAgents','removeAgents','Queue:remove','UserVoicePrefix','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','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/environment'];(function(_0x188832,_0x49101d){var _0x2b990f=function(_0x231635){while(--_0x231635){_0x188832['push'](_0x188832['shift']());}};_0x2b990f(++_0x49101d);}(_0xca2c,0x1b8));var _0xcca2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xca2c[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xcca2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcca2('0x1'));var jsonpatch=require(_0xcca2('0x2'));var rp=require(_0xcca2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcca2('0x4'));var util=require(_0xcca2('0x5'));var path=require(_0xcca2('0x6'));var sox=require(_0xcca2('0x7'));var csv=require(_0xcca2('0x8'));var ejs=require(_0xcca2('0x9'));var fs=require('fs');var fs_extra=require(_0xcca2('0xa'));var _=require(_0xcca2('0xb'));var squel=require(_0xcca2('0xc'));var crypto=require(_0xcca2('0xd'));var jsforce=require(_0xcca2('0xe'));var deskjs=require(_0xcca2('0xf'));var toCsv=require(_0xcca2('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcca2('0x10'));var authService=require(_0xcca2('0x11'));var qs=require(_0xcca2('0x12'));var as=require(_0xcca2('0x13'));var hardwareService=require(_0xcca2('0x14'));var logger=require(_0xcca2('0x15'))(_0xcca2('0x16'));var utils=require(_0xcca2('0x17'));var config=require(_0xcca2('0x18'));var licenseUtil=require(_0xcca2('0x19'));var db=require(_0xcca2('0x1a'))['db'];config[_0xcca2('0x1b')]=_[_0xcca2('0x1c')](config[_0xcca2('0x1b')],{'host':_0xcca2('0x1d'),'port':0x18eb});var socket=require(_0xcca2('0x1e'))(new Redis(config[_0xcca2('0x1b')]));require(_0xcca2('0x1f'))[_0xcca2('0x20')](socket);function respondWithStatusCode(_0x5a698c,_0x4fd2b3){_0x4fd2b3=_0x4fd2b3||0xcc;return function(_0x5788e7){if(_0x5788e7){return _0x5a698c[_0xcca2('0x21')](_0x4fd2b3);}return _0x5a698c['status'](_0x4fd2b3)['end']();};}function respondWithResult(_0x2f0e4f,_0x3d338a){_0x3d338a=_0x3d338a||0xc8;return function(_0x1c47d1){if(_0x1c47d1){return _0x2f0e4f['status'](_0x3d338a)['json'](_0x1c47d1);}};}function respondWithFilteredResult(_0x8646cf,_0xa75796){return function(_0x3709ff){if(_0x3709ff){var _0x27c661=typeof _0xa75796[_0xcca2('0x22')]==='undefined'&&typeof _0xa75796['limit']===_0xcca2('0x23');var _0x2c610f=_0x3709ff[_0xcca2('0x24')];var _0x26de32=_0x27c661?0x0:_0xa75796[_0xcca2('0x22')];var _0x1b8727=_0x27c661?_0x3709ff['count']:_0xa75796[_0xcca2('0x22')]+_0xa75796[_0xcca2('0x25')];var _0x184818;if(_0x1b8727>=_0x2c610f){_0x1b8727=_0x2c610f;_0x184818=0xc8;}else{_0x184818=0xce;}_0x8646cf[_0xcca2('0x26')](_0x184818);return _0x8646cf[_0xcca2('0x27')](_0xcca2('0x28'),_0x26de32+'-'+_0x1b8727+'/'+_0x2c610f)[_0xcca2('0x29')](_0x3709ff);}return null;};}function patchUpdates(_0x3e9c4c){return function(_0x58c25c){try{jsonpatch['apply'](_0x58c25c,_0x3e9c4c,!![]);}catch(_0x39b2fa){return BPromise[_0xcca2('0x2a')](_0x39b2fa);}return _0x58c25c[_0xcca2('0x2b')]();};}function saveUpdates(_0x5ef2f9,_0x10d777){return function(_0x307c23){if(_0x307c23){return _0x307c23[_0xcca2('0x2c')](_0x5ef2f9)[_0xcca2('0x2d')](function(_0x3923f9){return _0x3923f9;});}return null;};}function handleEntityNotFound(_0x13f433,_0x2702a5){return function(_0xffd383){if(!_0xffd383){_0x13f433[_0xcca2('0x21')](0x194);}return _0xffd383;};}function handleError(_0x5509a6,_0x4901ec){_0x4901ec=_0x4901ec||0x1f4;return function(_0x39033f){logger['error'](_0x39033f[_0xcca2('0x2e')]);if(_0x39033f[_0xcca2('0x2f')]){delete _0x39033f[_0xcca2('0x2f')];}_0x5509a6[_0xcca2('0x26')](_0x4901ec)[_0xcca2('0x30')](_0x39033f);};}exports[_0xcca2('0x31')]=function(_0x45d012,_0x178f67){var _0x3f9f8e={},_0x3908d5={},_0x1acf0b={'count':0x0,'rows':[]};var _0x1b1d02=_[_0xcca2('0x32')](db[_0xcca2('0x33')]['rawAttributes'],function(_0x20db54){return{'name':_0x20db54['fieldName'],'type':_0x20db54['type']['key']};});_0x3908d5['model']=_[_0xcca2('0x32')](_0x1b1d02,'name');_0x3908d5[_0xcca2('0x34')]=_[_0xcca2('0x35')](_0x45d012[_0xcca2('0x34')]);_0x3908d5['filters']=_[_0xcca2('0x36')](_0x3908d5['model'],_0x3908d5[_0xcca2('0x34')]);_0x3f9f8e[_0xcca2('0x37')]=_[_0xcca2('0x36')](_0x3908d5[_0xcca2('0x38')],qs[_0xcca2('0x39')](_0x45d012[_0xcca2('0x34')][_0xcca2('0x39')]));_0x3f9f8e['attributes']=_0x3f9f8e[_0xcca2('0x37')][_0xcca2('0x3a')]?_0x3f9f8e[_0xcca2('0x37')]:_0x3908d5[_0xcca2('0x38')];if(!_0x45d012[_0xcca2('0x34')]['hasOwnProperty']('nolimit')){_0x3f9f8e[_0xcca2('0x25')]=qs[_0xcca2('0x25')](_0x45d012[_0xcca2('0x34')][_0xcca2('0x25')]);_0x3f9f8e[_0xcca2('0x22')]=qs[_0xcca2('0x22')](_0x45d012[_0xcca2('0x34')][_0xcca2('0x22')]);}_0x3f9f8e[_0xcca2('0x3b')]=qs['sort'](_0x45d012[_0xcca2('0x34')]['sort']);_0x3f9f8e[_0xcca2('0x3c')]=qs[_0xcca2('0x3d')](_['pick'](_0x45d012['query'],_0x3908d5[_0xcca2('0x3d')]),_0x1b1d02);if(_0x45d012[_0xcca2('0x34')][_0xcca2('0x3e')]){_0x3f9f8e[_0xcca2('0x3c')]=_[_0xcca2('0x3f')](_0x3f9f8e[_0xcca2('0x3c')],{'$or':_['map'](_0x1b1d02,function(_0x46ac88){if(_0x46ac88[_0xcca2('0x40')]!==_0xcca2('0x41')){var _0x5338f7={};_0x5338f7[_0x46ac88['name']]={'$like':'%'+_0x45d012[_0xcca2('0x34')][_0xcca2('0x3e')]+'%'};return _0x5338f7;}})});}_0x3f9f8e=_[_0xcca2('0x3f')]({},_0x3f9f8e,_0x45d012['options']);var _0x4b2f10={'where':_0x3f9f8e[_0xcca2('0x3c')]};return db[_0xcca2('0x33')]['count'](_0x4b2f10)[_0xcca2('0x2d')](function(_0x423a30){_0x1acf0b[_0xcca2('0x24')]=_0x423a30;if(_0x45d012[_0xcca2('0x34')][_0xcca2('0x42')]){_0x3f9f8e['include']=[{'all':!![]}];}return db[_0xcca2('0x33')][_0xcca2('0x43')](_0x3f9f8e);})[_0xcca2('0x2d')](function(_0x23c217){_0x1acf0b[_0xcca2('0x44')]=_0x23c217;return _0x1acf0b;})[_0xcca2('0x2d')](respondWithFilteredResult(_0x178f67,_0x3f9f8e))[_0xcca2('0x45')](handleError(_0x178f67,null));};exports[_0xcca2('0x46')]=function(_0x9615,_0x174c4b){var _0x130ad0={'raw':![],'where':{'id':_0x9615[_0xcca2('0x47')]['id']}},_0x47f6d5={};_0x47f6d5[_0xcca2('0x38')]=_[_0xcca2('0x35')](db[_0xcca2('0x33')][_0xcca2('0x48')]);_0x47f6d5[_0xcca2('0x34')]=_[_0xcca2('0x35')](_0x9615['query']);_0x47f6d5[_0xcca2('0x3d')]=_[_0xcca2('0x36')](_0x47f6d5[_0xcca2('0x38')],_0x47f6d5[_0xcca2('0x34')]);_0x130ad0[_0xcca2('0x37')]=_[_0xcca2('0x36')](_0x47f6d5[_0xcca2('0x38')],qs[_0xcca2('0x39')](_0x9615[_0xcca2('0x34')][_0xcca2('0x39')]));_0x130ad0[_0xcca2('0x37')]=_0x130ad0[_0xcca2('0x37')][_0xcca2('0x3a')]?_0x130ad0[_0xcca2('0x37')]:_0x47f6d5[_0xcca2('0x38')];if(_0x9615[_0xcca2('0x34')][_0xcca2('0x42')]){_0x130ad0[_0xcca2('0x49')]=[{'all':!![]}];}_0x130ad0=_['merge']({},_0x130ad0,_0x9615['options']);return db['Team'][_0xcca2('0x4a')](_0x130ad0)[_0xcca2('0x2d')](handleEntityNotFound(_0x174c4b,null))[_0xcca2('0x2d')](respondWithResult(_0x174c4b,null))[_0xcca2('0x45')](handleError(_0x174c4b,null));};exports[_0xcca2('0x4b')]=function(_0x54e69d,_0x5c2031){return db['Team'][_0xcca2('0x4b')](_0x54e69d['body'],{})['then'](function(_0xb7e644){var _0x58dd38=_0x54e69d['user'][_0xcca2('0x4c')]({'plain':!![]});if(!_0x58dd38)throw new Error(_0xcca2('0x4d'));if(_0x58dd38['role']===_0xcca2('0x4e')){var _0x4ac20e=_0xb7e644[_0xcca2('0x4c')]({'plain':!![]});var _0x5bcb67=_0xcca2('0x4f');return db[_0xcca2('0x50')][_0xcca2('0x4a')]({'where':{'name':_0x5bcb67,'userProfileId':_0x58dd38[_0xcca2('0x51')]},'raw':!![]})[_0xcca2('0x2d')](function(_0x5b1d88){if(_0x5b1d88&&_0x5b1d88[_0xcca2('0x52')]===0x0){return db['UserProfileResource'][_0xcca2('0x4b')]({'name':_0x4ac20e[_0xcca2('0x2f')],'resourceId':_0x4ac20e['id'],'type':_0x5b1d88[_0xcca2('0x2f')],'sectionId':_0x5b1d88['id']},{})[_0xcca2('0x2d')](function(){return _0xb7e644;});}else{return _0xb7e644;}})[_0xcca2('0x45')](function(_0x27f067){logger[_0xcca2('0x53')](_0xcca2('0x54'),_0x27f067);throw _0x27f067;});}return _0xb7e644;})[_0xcca2('0x2d')](respondWithResult(_0x5c2031,0xc9))[_0xcca2('0x45')](handleError(_0x5c2031,null));};exports['update']=function(_0x444ef0,_0x184ef1){if(_0x444ef0[_0xcca2('0x55')]['id']){delete _0x444ef0[_0xcca2('0x55')]['id'];}return db['Team'][_0xcca2('0x4a')]({'where':{'id':_0x444ef0['params']['id']}})[_0xcca2('0x2d')](handleEntityNotFound(_0x184ef1,null))[_0xcca2('0x2d')](saveUpdates(_0x444ef0['body'],null))['then'](respondWithResult(_0x184ef1,null))[_0xcca2('0x45')](handleError(_0x184ef1,null));};exports[_0xcca2('0x56')]=function(_0x1cdac3,_0x182856){var _0x218759=_0x1cdac3[_0xcca2('0x47')]['id'];var _0x24ef41=[];return db[_0xcca2('0x57')][_0xcca2('0x58')](function(_0x51471c){var _0x1e951e=_0xcca2('0x59')+_0x218759;return db[_0xcca2('0x57')][_0xcca2('0x34')](_0x1e951e,{'type':db[_0xcca2('0x5a')][_0xcca2('0x5b')][_0xcca2('0x5c')],'raw':!![],'transaction':_0x51471c})['then'](function(_0x583b95){_0x24ef41=_[_0xcca2('0x32')](_0x583b95,function(_0xc7a72d){return Number(_0xc7a72d[_0xcca2('0x5d')]);});})['then'](function(){var _0x344e1b=_0xcca2('0x5e')+_0x218759;return db[_0xcca2('0x57')][_0xcca2('0x34')](_0x344e1b,{'type':db[_0xcca2('0x5a')][_0xcca2('0x5b')][_0xcca2('0x5c')],'raw':!![],'transaction':_0x51471c});})[_0xcca2('0x2d')](function(_0x2f2962){var _0x1aaf14=_[_0xcca2('0x32')](_0x2f2962,function(_0x17576d){return Number(_0x17576d[_0xcca2('0x5f')]);});return db[_0xcca2('0x60')][_0xcca2('0x56')]({'where':{'UserId':{'$in':_0x24ef41},'VoiceQueueId':{'$in':_0x1aaf14}},'transaction':_0x51471c});})[_0xcca2('0x2d')](function(){var _0x3bcb23=_0xcca2('0x61')+_0x218759;return db[_0xcca2('0x57')]['query'](_0x3bcb23,{'type':db[_0xcca2('0x5a')]['QueryTypes'][_0xcca2('0x5c')],'raw':!![],'transaction':_0x51471c});})['then'](function(_0x218de8){var _0x564819=_[_0xcca2('0x32')](_0x218de8,function(_0x6518f2){return Number(_0x6518f2[_0xcca2('0x62')]);});return db[_0xcca2('0x63')][_0xcca2('0x56')]({'where':{'UserId':{'$in':_0x24ef41},'MailQueueId':{'$in':_0x564819}},'transaction':_0x51471c});})[_0xcca2('0x2d')](function(){var _0x47079e='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x218759;return db[_0xcca2('0x57')][_0xcca2('0x34')](_0x47079e,{'type':db[_0xcca2('0x5a')][_0xcca2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x51471c});})[_0xcca2('0x2d')](function(_0x18cd15){var _0x54bb17=_[_0xcca2('0x32')](_0x18cd15,function(_0x5549af){return Number(_0x5549af[_0xcca2('0x64')]);});return db[_0xcca2('0x65')][_0xcca2('0x56')]({'where':{'UserId':{'$in':_0x24ef41},'SmsQueueId':{'$in':_0x54bb17}},'transaction':_0x51471c});})['then'](function(){var _0x56f128=_0xcca2('0x66')+_0x218759;return db[_0xcca2('0x57')]['query'](_0x56f128,{'type':db[_0xcca2('0x5a')][_0xcca2('0x5b')][_0xcca2('0x5c')],'raw':!![],'transaction':_0x51471c});})['then'](function(_0x265c19){var _0x1b5e6e=_['map'](_0x265c19,function(_0x5a2c21){return Number(_0x5a2c21[_0xcca2('0x67')]);});return db['UserChatQueue'][_0xcca2('0x56')]({'where':{'UserId':{'$in':_0x24ef41},'ChatQueueId':{'$in':_0x1b5e6e}},'transaction':_0x51471c});})['then'](function(){var _0x51b1d7=_0xcca2('0x68')+_0x218759;return db[_0xcca2('0x57')][_0xcca2('0x34')](_0x51b1d7,{'type':db[_0xcca2('0x5a')][_0xcca2('0x5b')][_0xcca2('0x5c')],'raw':!![],'transaction':_0x51471c});})[_0xcca2('0x2d')](function(_0x28d743){var _0x77310c=_[_0xcca2('0x32')](_0x28d743,function(_0x6eea66){return Number(_0x6eea66['FaxQueueId']);});return db[_0xcca2('0x69')]['destroy']({'where':{'UserId':{'$in':_0x24ef41},'FaxQueueId':{'$in':_0x77310c}},'transaction':_0x51471c});})[_0xcca2('0x2d')](function(){var _0x6cf565=_0xcca2('0x6a')+_0x218759;return db[_0xcca2('0x57')][_0xcca2('0x34')](_0x6cf565,{'type':db[_0xcca2('0x5a')][_0xcca2('0x5b')][_0xcca2('0x5c')],'raw':!![],'transaction':_0x51471c});})[_0xcca2('0x2d')](function(_0x148afe){var _0x4b289d=_[_0xcca2('0x32')](_0x148afe,function(_0xf811a){return Number(_0xf811a[_0xcca2('0x6b')]);});return db[_0xcca2('0x6c')][_0xcca2('0x56')]({'where':{'UserId':{'$in':_0x24ef41},'OpenchannelQueueId':{'$in':_0x4b289d}},'transaction':_0x51471c});})[_0xcca2('0x2d')](function(){var _0xf79c16=_0xcca2('0x6d')+_0x218759;return db[_0xcca2('0x57')][_0xcca2('0x34')](_0xf79c16,{'type':db[_0xcca2('0x5a')]['QueryTypes'][_0xcca2('0x5c')],'raw':!![],'transaction':_0x51471c});})[_0xcca2('0x2d')](function(_0x539f42){var _0x502459=_[_0xcca2('0x32')](_0x539f42,function(_0x313344){return Number(_0x313344['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xcca2('0x56')]({'where':{'UserId':{'$in':_0x24ef41},'WhatsappQueueId':{'$in':_0x502459}},'transaction':_0x51471c});})[_0xcca2('0x2d')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x218759}});})[_0xcca2('0x2d')](function(_0x139dec){if(_0x139dec===null){return;}return db['UserVoicePrefix'][_0xcca2('0x56')]({'where':{'UserId':{'$in':_0x24ef41},'VoicePrefixId':_0x139dec['VoicePrefixId']},'transaction':_0x51471c});})[_0xcca2('0x2d')](function(){return db[_0xcca2('0x33')][_0xcca2('0x56')]({'where':{'id':_0x218759},'cascade':!![],'transaction':_0x51471c});})[_0xcca2('0x2d')](function(_0x37f1e2){if(_0x37f1e2===0x0){_0x182856[_0xcca2('0x21')](0x194);}else{return db[_0xcca2('0x6e')][_0xcca2('0x56')]({'where':{'type':_0xcca2('0x4f'),'resourceId':_0x218759},'cascade':!![],'transaction':_0x51471c})[_0xcca2('0x2d')](function(){_0x182856[_0xcca2('0x26')](0xcc)[_0xcca2('0x6f')]();});}})[_0xcca2('0x45')](function(_0x536d1a){_0x182856[_0xcca2('0x26')](0x1f4)[_0xcca2('0x30')](_0x536d1a);});});};exports['getQueues']=function(_0x7dc47d,_0x343efc,_0x1c811a){return db['Team'][_0xcca2('0x70')]({'where':{'id':_0x7dc47d['params']['id']}})[_0xcca2('0x2d')](handleEntityNotFound(_0x343efc,null))['then'](function(_0x2a6f2c){if(!_0x7dc47d[_0xcca2('0x34')][_0xcca2('0x71')]||!utils[_0xcca2('0x72')](_0x7dc47d[_0xcca2('0x34')][_0xcca2('0x71')])){throw new db[(_0xcca2('0x5a'))][(_0xcca2('0x73'))](_0xcca2('0x74'));}var _0x157fbf={};var _0x3a6e57={};_0x3a6e57[_0xcca2('0x38')]=_[_0xcca2('0x35')](db[_['capitalize'](_0x7dc47d[_0xcca2('0x34')][_0xcca2('0x71')][_0xcca2('0x75')]())+_0xcca2('0x76')]['rawAttributes']);_0x3a6e57['query']=_[_0xcca2('0x35')](_0x7dc47d[_0xcca2('0x34')]);_0x3a6e57[_0xcca2('0x3d')]=_[_0xcca2('0x36')](_0x3a6e57['model'],_0x3a6e57['query']);_0x157fbf['attributes']=_[_0xcca2('0x36')](_0x3a6e57['model'],qs[_0xcca2('0x39')](_0x7dc47d['query'][_0xcca2('0x39')]));_0x157fbf[_0xcca2('0x37')]=_0x157fbf[_0xcca2('0x37')][_0xcca2('0x3a')]?_0x157fbf[_0xcca2('0x37')]:_0x3a6e57[_0xcca2('0x38')];_0x157fbf[_0xcca2('0x25')]=qs['limit'](_0x7dc47d[_0xcca2('0x34')][_0xcca2('0x25')]);_0x157fbf['offset']=qs[_0xcca2('0x22')](_0x7dc47d[_0xcca2('0x34')][_0xcca2('0x22')]);_0x157fbf['order']=qs[_0xcca2('0x77')](_0x7dc47d[_0xcca2('0x34')][_0xcca2('0x77')]);_0x157fbf[_0xcca2('0x3c')]=qs[_0xcca2('0x3d')](_[_0xcca2('0x78')](_0x7dc47d[_0xcca2('0x34')],_0x3a6e57[_0xcca2('0x3d')]));_0x157fbf=_[_0xcca2('0x3f')]({},_0x157fbf,_0x7dc47d['options']);return _0x2a6f2c[_0xcca2('0x4c')+_[_0xcca2('0x79')](_0x7dc47d[_0xcca2('0x34')]['channel'][_0xcca2('0x75')]())+_0xcca2('0x7a')](_0x157fbf);})[_0xcca2('0x2d')](respondWithResult(_0x343efc,null))[_0xcca2('0x45')](handleError(_0x343efc,null));};exports['addQueues']=function(_0x22a6fa,_0x250732,_0x1dab05){return db[_0xcca2('0x33')][_0xcca2('0x70')]({'where':{'id':_0x22a6fa[_0xcca2('0x47')]['id']}})[_0xcca2('0x2d')](function(_0x11cd72){if(_0x11cd72){if(!_0x22a6fa[_0xcca2('0x55')]['channel']||!utils['isValidChannel'](_0x22a6fa['body'][_0xcca2('0x71')])){throw new db[(_0xcca2('0x5a'))][(_0xcca2('0x73'))](_0xcca2('0x74'));}return _0x11cd72[_0xcca2('0x7b')+_['capitalize'](_0x22a6fa['body'][_0xcca2('0x71')][_0xcca2('0x75')]())+'Queues'](_0x22a6fa[_0xcca2('0x55')][_0xcca2('0x7c')]);}return null;})[_0xcca2('0x2d')](handleEntityNotFound(_0x250732,null))[_0xcca2('0x2d')](respondWithStatusCode(_0x250732,null))[_0xcca2('0x45')](handleError(_0x250732,null));};exports[_0xcca2('0x7d')]=function(_0x4599fd,_0x1f30c0,_0x112bd6){return db[_0xcca2('0x33')][_0xcca2('0x70')]({'where':{'id':_0x4599fd['params']['id']}})[_0xcca2('0x2d')](function(_0x45cd36){if(_0x45cd36){if(!_0x4599fd[_0xcca2('0x34')][_0xcca2('0x71')]||!utils['isValidChannel'](_0x4599fd['query'][_0xcca2('0x71')])){throw new db['Sequelize'][(_0xcca2('0x73'))](_0xcca2('0x74'));}return _0x45cd36[_0xcca2('0x7e')+_[_0xcca2('0x79')](_0x4599fd[_0xcca2('0x34')]['channel'][_0xcca2('0x75')]())+_0xcca2('0x7a')](_0x4599fd['query'][_0xcca2('0x7c')]);}return null;})[_0xcca2('0x2d')](handleEntityNotFound(_0x1f30c0,null))['then'](respondWithStatusCode(_0x1f30c0,null))[_0xcca2('0x45')](handleError(_0x1f30c0,null));};exports['addAgents']=function(_0xf0f85c,_0x1950ac){var _0x2b458f=_[_0xcca2('0x7f')](_0xf0f85c[_0xcca2('0x55')]['ids'])?_0xf0f85c['body'][_0xcca2('0x7c')]:[_0xf0f85c[_0xcca2('0x55')]['ids']];var _0x1dff7c=_0xf0f85c[_0xcca2('0x47')]['id'];return db[_0xcca2('0x33')][_0xcca2('0x4a')]({'where':{'id':_0x1dff7c}})[_0xcca2('0x2d')](handleEntityNotFound(_0x1950ac,null))[_0xcca2('0x2d')](function(_0x4a79c7){if(_0x4a79c7){var _0x29f0b3=[_0xcca2('0x80'),_0xcca2('0x81'),_0xcca2('0x82'),_0xcca2('0x83'),_0xcca2('0x84'),_0xcca2('0x85'),'Whatsapp'];return db[_0xcca2('0x57')][_0xcca2('0x58')](function(_0x193fcf){var _0x367396=_[_0xcca2('0x32')](_0x29f0b3,function(_0x2e2cf4){var _0x5e103c={'attributes':['id',_0xcca2('0x2f')]};if(_0x2e2cf4===_0xcca2('0x80')){_0x5e103c[_0xcca2('0x86')]={'attributes':['penalty']};}return _0x4a79c7['get'+_0x2e2cf4+'Queues'](_0x5e103c)[_0xcca2('0x2d')](function(_0x4c8d17){var _0x41d344=_[_0xcca2('0x32')](_0x4c8d17,function(_0x322e82){var _0x195bd1=_[_0xcca2('0x32')](_0x2b458f,function(_0x5b3c9c){var _0x37bae8={'where':{'UserId':_0x5b3c9c,[_0x2e2cf4+'QueueId']:_0x322e82['id']},'transaction':_0x193fcf};if(_0x2e2cf4===_0xcca2('0x80')){_0x37bae8[_0xcca2('0x1c')]={'penalty':_0x322e82['TeamVoiceQueue']['penalty']};}return db[_0xcca2('0x87')+_0x2e2cf4+_0xcca2('0x76')][_0xcca2('0x88')](_0x37bae8)[_0xcca2('0x2d')](function(){socket[_0xcca2('0x89')](_0xcca2('0x4e')+_0x2e2cf4+_0xcca2('0x8a'),{'UserId':_0x5b3c9c,[_0x2e2cf4+_0xcca2('0x8b')]:_0x322e82['id']});if(_0x2e2cf4!==_0xcca2('0x80')){return;}return db['User'][_0xcca2('0x43')]({'where':{'id':_0x2b458f,'online':0x1},'attributes':['id',_0xcca2('0x2f'),'online','voicePause',_0xcca2('0x8c')],'raw':!![]})['then'](function(_0x42635c){var _0x1b4571=_[_0xcca2('0x32')](_0x42635c,function(_0x38d848){return db[_0xcca2('0x8d')][_0xcca2('0x8e')]({'membername':_0x38d848['name'],'UserId':_0x38d848['id'],'queue_name':_0x322e82['name'],'VoiceQueueId':_0x322e82['id'],'interface':_[_0xcca2('0x8f')](_0x38d848[_0xcca2('0x8c')])?util[_0xcca2('0x90')]('SIP/%s',_0x38d848[_0xcca2('0x2f')]):_0x38d848[_0xcca2('0x8c')],'paused':_0x38d848[_0xcca2('0x91')]||![],'penalty':_0x322e82['TeamVoiceQueue']['penalty']},{'transaction':_0x193fcf});});return Promise['all'](_0x1b4571);});});});return Promise[_0xcca2('0x92')](_0x195bd1);});return Promise[_0xcca2('0x92')](_0x41d344);})[_0xcca2('0x2d')](function(){return db[_0xcca2('0x93')][_0xcca2('0x70')]({'where':{'teamId':_0x1dff7c}})['then'](function(_0x2abf8d){if(_0x2abf8d){var _0x323be3=_[_0xcca2('0x32')](_0x2b458f,function(_0x551bd0){db['UserVoicePrefix'][_0xcca2('0x8e')]({'UserId':_0x551bd0,'VoicePrefixId':_0x2abf8d[_0xcca2('0x94')]});});return Promise[_0xcca2('0x92')](_0x323be3);}});});});return Promise[_0xcca2('0x92')](_0x367396)['then'](function(){return _0x4a79c7[_0xcca2('0x95')](_0x2b458f,{'transaction':_0x193fcf})['spread'](function(_0x645ad3){return _0x645ad3;});});});}})[_0xcca2('0x2d')](respondWithResult(_0x1950ac,null))[_0xcca2('0x45')](handleError(_0x1950ac,null));};exports[_0xcca2('0x96')]=function(_0x584947,_0x449059){var _0xa64f0d=_[_0xcca2('0x7f')](_0x584947[_0xcca2('0x34')]['ids'])?_0x584947[_0xcca2('0x34')][_0xcca2('0x7c')]:[_0x584947[_0xcca2('0x34')][_0xcca2('0x7c')]];var _0x3a2db4=_0x584947['params']['id'];return db[_0xcca2('0x33')][_0xcca2('0x4a')]({'where':{'id':_0x3a2db4}})['then'](handleEntityNotFound(_0x449059,null))[_0xcca2('0x2d')](function(_0x5d4259){if(_0x5d4259){var _0x1c2051=[_0xcca2('0x80'),_0xcca2('0x81'),_0xcca2('0x82'),_0xcca2('0x83'),_0xcca2('0x84'),_0xcca2('0x85'),'Whatsapp'];return db[_0xcca2('0x57')]['transaction'](function(_0x1b16e5){var _0x24bdd3=_[_0xcca2('0x32')](_0x1c2051,function(_0x3e9e12){var _0x44f219={'attributes':['id',_0xcca2('0x2f')]};return _0x5d4259[_0xcca2('0x4c')+_0x3e9e12+'Queues'](_0x44f219)[_0xcca2('0x2d')](function(_0x5021d6){var _0x424e3a=_[_0xcca2('0x32')](_0x5021d6,function(_0x47870e){return _0x47870e['removeAgents'](_0xa64f0d,{'transaction':_0x1b16e5})[_0xcca2('0x2d')](function(){var _0x23faae=_[_0xcca2('0x32')](_0xa64f0d,function(_0x3d0e8d){socket[_0xcca2('0x89')](_0xcca2('0x4e')+_0x3e9e12+_0xcca2('0x97'),{'UserId':Number(_0x3d0e8d),[_0x3e9e12+_0xcca2('0x8b')]:_0x47870e['id']});if(_0x3e9e12!==_0xcca2('0x80')){return;}return db[_0xcca2('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x47870e['id'],'UserId':_0x3d0e8d},'transaction':_0x1b16e5});});return Promise[_0xcca2('0x92')](_0x23faae);});});return Promise[_0xcca2('0x92')](_0x424e3a);});});return Promise['all'](_0x24bdd3)['then'](function(){return _0x5d4259['removeAgents'](_0xa64f0d,{'transaction':_0x1b16e5});})[_0xcca2('0x2d')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x3a2db4}})['then'](function(_0x322e84){if(_0x322e84){var _0x55b6f5=_[_0xcca2('0x32')](_0xa64f0d,function(_0x50df9b){db[_0xcca2('0x98')][_0xcca2('0x56')]({'where':{'UserId':_0x50df9b,'VoicePrefixId':_0x322e84[_0xcca2('0x94')]}});});return Promise['all'](_0x55b6f5);}});});});}})['then'](respondWithStatusCode(_0x449059,null))[_0xcca2('0x45')](handleError(_0x449059,null));};exports['getAgents']=function(_0x4a7e4e,_0x5c62d0,_0x31312a){var _0x20b74e={};var _0x58cb3b={};var _0x2d5153;var _0x23f424;return db['Team'][_0xcca2('0x70')]({'where':{'id':_0x4a7e4e[_0xcca2('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c62d0,null))['then'](function(_0x1bfc59){if(_0x1bfc59){_0x2d5153=_0x1bfc59;_0x58cb3b[_0xcca2('0x38')]=_['keys'](db[_0xcca2('0x87')][_0xcca2('0x48')]);_0x58cb3b['query']=_[_0xcca2('0x35')](_0x4a7e4e['query']);_0x58cb3b[_0xcca2('0x3d')]=_[_0xcca2('0x36')](_0x58cb3b[_0xcca2('0x38')],_0x58cb3b[_0xcca2('0x34')]);_0x20b74e[_0xcca2('0x37')]=_[_0xcca2('0x36')](_0x58cb3b[_0xcca2('0x38')],qs['fields'](_0x4a7e4e[_0xcca2('0x34')][_0xcca2('0x39')]));_0x20b74e[_0xcca2('0x37')]=_0x20b74e['attributes'][_0xcca2('0x3a')]?_0x20b74e[_0xcca2('0x37')]:_0x58cb3b[_0xcca2('0x38')];_0x20b74e[_0xcca2('0x3b')]=qs[_0xcca2('0x77')](_0x4a7e4e[_0xcca2('0x34')][_0xcca2('0x77')]);_0x20b74e['where']=qs[_0xcca2('0x3d')](_[_0xcca2('0x78')](_0x4a7e4e[_0xcca2('0x34')],_0x58cb3b[_0xcca2('0x3d')]));if(_0x4a7e4e[_0xcca2('0x34')][_0xcca2('0x3e')]){_0x20b74e[_0xcca2('0x3c')]=_['merge'](_0x20b74e[_0xcca2('0x3c')],{'$or':_['map'](_0x20b74e[_0xcca2('0x37')],function(_0x41d5d9){var _0x5c7e5a={};_0x5c7e5a[_0x41d5d9]={'$like':'%'+_0x4a7e4e['query']['filter']+'%'};return _0x5c7e5a;})});}_0x20b74e=_[_0xcca2('0x3f')]({},_0x20b74e,_0x4a7e4e['options']);return _0x2d5153[_0xcca2('0x99')](_0x20b74e);}})['then'](function(_0x2fdca4){if(_0x2fdca4){_0x23f424=_0x2fdca4[_0xcca2('0x3a')];if(!_0x4a7e4e[_0xcca2('0x34')][_0xcca2('0x9a')]('nolimit')){_0x20b74e[_0xcca2('0x25')]=qs['limit'](_0x4a7e4e[_0xcca2('0x34')][_0xcca2('0x25')]);_0x20b74e[_0xcca2('0x22')]=qs[_0xcca2('0x22')](_0x4a7e4e[_0xcca2('0x34')][_0xcca2('0x22')]);}return _0x2d5153[_0xcca2('0x99')](_0x20b74e);}})[_0xcca2('0x2d')](function(_0x2ed941){if(_0x2ed941){return _0x2ed941?{'count':_0x23f424,'rows':_0x2ed941}:null;}})[_0xcca2('0x2d')](respondWithResult(_0x5c62d0,null))[_0xcca2('0x45')](handleError(_0x5c62d0,null));}; \ No newline at end of file +var _0x4851=['all','TeamVoicePrefix','VoicePrefixId','addAgents','removeAgents','Mail','emit','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','error','stack','name','send','index','map','Team','fieldName','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','find','create','body','user','role','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','MailQueueId','UserMailQueue','SmsQueueId','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserVoicePrefix','Teams','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','Queues','addQueues','add','ids','remove','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','online','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','voicePause'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4851,0x137));var _0x1485=function(_0x8d42a0,_0x340910){_0x8d42a0=_0x8d42a0-0x0;var _0x1cb0b3=_0x4851[_0x8d42a0];return _0x1cb0b3;};'use strict';var emlformat=require(_0x1485('0x0'));var rimraf=require(_0x1485('0x1'));var zipdir=require(_0x1485('0x2'));var jsonpatch=require(_0x1485('0x3'));var rp=require(_0x1485('0x4'));var moment=require(_0x1485('0x5'));var BPromise=require(_0x1485('0x6'));var Mustache=require(_0x1485('0x7'));var util=require(_0x1485('0x8'));var path=require(_0x1485('0x9'));var sox=require(_0x1485('0xa'));var csv=require(_0x1485('0xb'));var ejs=require(_0x1485('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1485('0xd'));var squel=require(_0x1485('0xe'));var crypto=require(_0x1485('0xf'));var jsforce=require(_0x1485('0x10'));var deskjs=require(_0x1485('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1485('0x12'));var Papa=require('papaparse');var Redis=require(_0x1485('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1485('0x14'));var as=require(_0x1485('0x15'));var hardwareService=require(_0x1485('0x16'));var logger=require(_0x1485('0x17'))('api');var utils=require(_0x1485('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1485('0x19'));var db=require(_0x1485('0x1a'))['db'];config[_0x1485('0x1b')]=_[_0x1485('0x1c')](config[_0x1485('0x1b')],{'host':_0x1485('0x1d'),'port':0x18eb});var socket=require(_0x1485('0x1e'))(new Redis(config[_0x1485('0x1b')]));require(_0x1485('0x1f'))[_0x1485('0x20')](socket);function respondWithStatusCode(_0x4f79d8,_0x126b25){_0x126b25=_0x126b25||0xcc;return function(_0x2f2990){if(_0x2f2990){return _0x4f79d8[_0x1485('0x21')](_0x126b25);}return _0x4f79d8[_0x1485('0x22')](_0x126b25)[_0x1485('0x23')]();};}function respondWithResult(_0xfdd82e,_0x37f565){_0x37f565=_0x37f565||0xc8;return function(_0x9372bc){if(_0x9372bc){return _0xfdd82e[_0x1485('0x22')](_0x37f565)['json'](_0x9372bc);}};}function respondWithFilteredResult(_0x18de6b,_0x45b14e){return function(_0x3fd72b){if(_0x3fd72b){var _0xa8c492=typeof _0x45b14e[_0x1485('0x24')]===_0x1485('0x25')&&typeof _0x45b14e[_0x1485('0x26')]===_0x1485('0x25');var _0x1e73ac=_0x3fd72b[_0x1485('0x27')];var _0x1911fd=_0xa8c492?0x0:_0x45b14e[_0x1485('0x24')];var _0x207421=_0xa8c492?_0x3fd72b['count']:_0x45b14e[_0x1485('0x24')]+_0x45b14e['limit'];var _0x1ae1bf;if(_0x207421>=_0x1e73ac){_0x207421=_0x1e73ac;_0x1ae1bf=0xc8;}else{_0x1ae1bf=0xce;}_0x18de6b[_0x1485('0x22')](_0x1ae1bf);return _0x18de6b[_0x1485('0x28')]('Content-Range',_0x1911fd+'-'+_0x207421+'/'+_0x1e73ac)[_0x1485('0x29')](_0x3fd72b);}return null;};}function patchUpdates(_0x160592){return function(_0x2127f1){try{jsonpatch['apply'](_0x2127f1,_0x160592,!![]);}catch(_0x2bd5f2){return BPromise['reject'](_0x2bd5f2);}return _0x2127f1['save']();};}function saveUpdates(_0x124473,_0x2d841d){return function(_0x5d9a54){if(_0x5d9a54){return _0x5d9a54[_0x1485('0x2a')](_0x124473)['then'](function(_0x251625){return _0x251625;});}return null;};}function handleEntityNotFound(_0x31c97d,_0x227a61){return function(_0x1a0611){if(!_0x1a0611){_0x31c97d['sendStatus'](0x194);}return _0x1a0611;};}function handleError(_0x4ea0a3,_0x304f6f){_0x304f6f=_0x304f6f||0x1f4;return function(_0x5cc00f){logger[_0x1485('0x2b')](_0x5cc00f[_0x1485('0x2c')]);if(_0x5cc00f[_0x1485('0x2d')]){delete _0x5cc00f[_0x1485('0x2d')];}_0x4ea0a3[_0x1485('0x22')](_0x304f6f)[_0x1485('0x2e')](_0x5cc00f);};}exports[_0x1485('0x2f')]=function(_0x3d8e65,_0x543ca7){var _0x3a5d4c={},_0x109620={},_0x146a8f={'count':0x0,'rows':[]};var _0x5ef0b6=_[_0x1485('0x30')](db[_0x1485('0x31')]['rawAttributes'],function(_0x4f75f5){return{'name':_0x4f75f5[_0x1485('0x32')],'type':_0x4f75f5['type']['key']};});_0x109620[_0x1485('0x33')]=_[_0x1485('0x30')](_0x5ef0b6,_0x1485('0x2d'));_0x109620[_0x1485('0x34')]=_[_0x1485('0x35')](_0x3d8e65[_0x1485('0x34')]);_0x109620['filters']=_[_0x1485('0x36')](_0x109620[_0x1485('0x33')],_0x109620[_0x1485('0x34')]);_0x3a5d4c['attributes']=_[_0x1485('0x36')](_0x109620['model'],qs[_0x1485('0x37')](_0x3d8e65[_0x1485('0x34')][_0x1485('0x37')]));_0x3a5d4c[_0x1485('0x38')]=_0x3a5d4c['attributes'][_0x1485('0x39')]?_0x3a5d4c[_0x1485('0x38')]:_0x109620[_0x1485('0x33')];if(!_0x3d8e65[_0x1485('0x34')]['hasOwnProperty']('nolimit')){_0x3a5d4c[_0x1485('0x26')]=qs[_0x1485('0x26')](_0x3d8e65['query'][_0x1485('0x26')]);_0x3a5d4c[_0x1485('0x24')]=qs['offset'](_0x3d8e65['query'][_0x1485('0x24')]);}_0x3a5d4c[_0x1485('0x3a')]=qs[_0x1485('0x3b')](_0x3d8e65[_0x1485('0x34')][_0x1485('0x3b')]);_0x3a5d4c[_0x1485('0x3c')]=qs[_0x1485('0x3d')](_[_0x1485('0x3e')](_0x3d8e65['query'],_0x109620[_0x1485('0x3d')]),_0x5ef0b6);if(_0x3d8e65[_0x1485('0x34')][_0x1485('0x3f')]){_0x3a5d4c[_0x1485('0x3c')]=_[_0x1485('0x40')](_0x3a5d4c[_0x1485('0x3c')],{'$or':_[_0x1485('0x30')](_0x5ef0b6,function(_0x3e1848){if(_0x3e1848[_0x1485('0x41')]!==_0x1485('0x42')){var _0x437e7c={};_0x437e7c[_0x3e1848['name']]={'$like':'%'+_0x3d8e65[_0x1485('0x34')]['filter']+'%'};return _0x437e7c;}})});}_0x3a5d4c=_[_0x1485('0x40')]({},_0x3a5d4c,_0x3d8e65[_0x1485('0x43')]);var _0x3b493c={'where':_0x3a5d4c[_0x1485('0x3c')]};return db[_0x1485('0x31')][_0x1485('0x27')](_0x3b493c)['then'](function(_0x5471a8){_0x146a8f['count']=_0x5471a8;if(_0x3d8e65[_0x1485('0x34')][_0x1485('0x44')]){_0x3a5d4c[_0x1485('0x45')]=[{'all':!![]}];}return db[_0x1485('0x31')][_0x1485('0x46')](_0x3a5d4c);})['then'](function(_0x5b5146){_0x146a8f['rows']=_0x5b5146;return _0x146a8f;})[_0x1485('0x47')](respondWithFilteredResult(_0x543ca7,_0x3a5d4c))[_0x1485('0x48')](handleError(_0x543ca7,null));};exports[_0x1485('0x49')]=function(_0x14bc66,_0x31487c){var _0x5e8c47={'raw':![],'where':{'id':_0x14bc66[_0x1485('0x4a')]['id']}},_0x5e8b8f={};_0x5e8b8f[_0x1485('0x33')]=_[_0x1485('0x35')](db[_0x1485('0x31')]['rawAttributes']);_0x5e8b8f[_0x1485('0x34')]=_[_0x1485('0x35')](_0x14bc66['query']);_0x5e8b8f['filters']=_['intersection'](_0x5e8b8f[_0x1485('0x33')],_0x5e8b8f['query']);_0x5e8c47[_0x1485('0x38')]=_[_0x1485('0x36')](_0x5e8b8f[_0x1485('0x33')],qs['fields'](_0x14bc66[_0x1485('0x34')]['fields']));_0x5e8c47[_0x1485('0x38')]=_0x5e8c47['attributes'][_0x1485('0x39')]?_0x5e8c47[_0x1485('0x38')]:_0x5e8b8f[_0x1485('0x33')];if(_0x14bc66[_0x1485('0x34')][_0x1485('0x44')]){_0x5e8c47['include']=[{'all':!![]}];}_0x5e8c47=_[_0x1485('0x40')]({},_0x5e8c47,_0x14bc66[_0x1485('0x43')]);return db[_0x1485('0x31')][_0x1485('0x4b')](_0x5e8c47)['then'](handleEntityNotFound(_0x31487c,null))['then'](respondWithResult(_0x31487c,null))[_0x1485('0x48')](handleError(_0x31487c,null));};exports[_0x1485('0x4c')]=function(_0xaacadf,_0x3d8ff3){return db[_0x1485('0x31')][_0x1485('0x4c')](_0xaacadf[_0x1485('0x4d')],{})['then'](function(_0x1665f0){var _0x309ba6=_0xaacadf[_0x1485('0x4e')]['get']({'plain':!![]});if(!_0x309ba6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x309ba6[_0x1485('0x4f')]===_0x1485('0x4e')){var _0x542195=_0x1665f0[_0x1485('0x50')]({'plain':!![]});var _0x41c538='Teams';return db['UserProfileSection'][_0x1485('0x4b')]({'where':{'name':_0x41c538,'userProfileId':_0x309ba6['userProfileId']},'raw':!![]})['then'](function(_0x21d732){if(_0x21d732&&_0x21d732[_0x1485('0x51')]===0x0){return db[_0x1485('0x52')][_0x1485('0x4c')]({'name':_0x542195[_0x1485('0x2d')],'resourceId':_0x542195['id'],'type':_0x21d732[_0x1485('0x2d')],'sectionId':_0x21d732['id']},{})['then'](function(){return _0x1665f0;});}else{return _0x1665f0;}})[_0x1485('0x48')](function(_0x3fc8e4){logger[_0x1485('0x2b')](_0x1485('0x53'),_0x3fc8e4);throw _0x3fc8e4;});}return _0x1665f0;})[_0x1485('0x47')](respondWithResult(_0x3d8ff3,0xc9))['catch'](handleError(_0x3d8ff3,null));};exports[_0x1485('0x2a')]=function(_0x53f807,_0x4d4cbf){if(_0x53f807[_0x1485('0x4d')]['id']){delete _0x53f807[_0x1485('0x4d')]['id'];}return db[_0x1485('0x31')][_0x1485('0x4b')]({'where':{'id':_0x53f807[_0x1485('0x4a')]['id']}})[_0x1485('0x47')](handleEntityNotFound(_0x4d4cbf,null))[_0x1485('0x47')](saveUpdates(_0x53f807[_0x1485('0x4d')],null))[_0x1485('0x47')](respondWithResult(_0x4d4cbf,null))[_0x1485('0x48')](handleError(_0x4d4cbf,null));};exports[_0x1485('0x54')]=function(_0x3cc925,_0x17490f){var _0x304d32=_0x3cc925['params']['id'];var _0x4de4a9=[];return db[_0x1485('0x55')]['transaction'](function(_0x563e9f){var _0xafc00b=_0x1485('0x56')+_0x304d32;return db['sequelize'][_0x1485('0x34')](_0xafc00b,{'type':db[_0x1485('0x57')][_0x1485('0x58')][_0x1485('0x59')],'raw':!![],'transaction':_0x563e9f})['then'](function(_0x542983){_0x4de4a9=_[_0x1485('0x30')](_0x542983,function(_0x3b1246){return Number(_0x3b1246[_0x1485('0x5a')]);});})['then'](function(){var _0x6a9ebf='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x304d32;return db[_0x1485('0x55')][_0x1485('0x34')](_0x6a9ebf,{'type':db['Sequelize'][_0x1485('0x58')][_0x1485('0x59')],'raw':!![],'transaction':_0x563e9f});})['then'](function(_0x1e95e0){var _0x4defa3=_['map'](_0x1e95e0,function(_0x149e36){return Number(_0x149e36[_0x1485('0x5b')]);});return db['UserVoiceQueue'][_0x1485('0x54')]({'where':{'UserId':{'$in':_0x4de4a9},'VoiceQueueId':{'$in':_0x4defa3}},'transaction':_0x563e9f});})[_0x1485('0x47')](function(){var _0x43bc96='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x304d32;return db[_0x1485('0x55')][_0x1485('0x34')](_0x43bc96,{'type':db['Sequelize']['QueryTypes'][_0x1485('0x59')],'raw':!![],'transaction':_0x563e9f});})[_0x1485('0x47')](function(_0x30d8b5){var _0x16462b=_[_0x1485('0x30')](_0x30d8b5,function(_0xf8a17d){return Number(_0xf8a17d[_0x1485('0x5c')]);});return db[_0x1485('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x4de4a9},'MailQueueId':{'$in':_0x16462b}},'transaction':_0x563e9f});})[_0x1485('0x47')](function(){var _0x5d7bce='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x304d32;return db[_0x1485('0x55')]['query'](_0x5d7bce,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x563e9f});})[_0x1485('0x47')](function(_0x40594e){var _0x2ff25a=_[_0x1485('0x30')](_0x40594e,function(_0x45b51e){return Number(_0x45b51e[_0x1485('0x5e')]);});return db['UserSmsQueue'][_0x1485('0x54')]({'where':{'UserId':{'$in':_0x4de4a9},'SmsQueueId':{'$in':_0x2ff25a}},'transaction':_0x563e9f});})[_0x1485('0x47')](function(){var _0x201493='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x304d32;return db[_0x1485('0x55')][_0x1485('0x34')](_0x201493,{'type':db[_0x1485('0x57')][_0x1485('0x58')]['SELECT'],'raw':!![],'transaction':_0x563e9f});})[_0x1485('0x47')](function(_0x196ea6){var _0x54bf74=_['map'](_0x196ea6,function(_0x3d3066){return Number(_0x3d3066[_0x1485('0x5f')]);});return db[_0x1485('0x60')][_0x1485('0x54')]({'where':{'UserId':{'$in':_0x4de4a9},'ChatQueueId':{'$in':_0x54bf74}},'transaction':_0x563e9f});})['then'](function(){var _0x47ac61=_0x1485('0x61')+_0x304d32;return db[_0x1485('0x55')]['query'](_0x47ac61,{'type':db[_0x1485('0x57')][_0x1485('0x58')][_0x1485('0x59')],'raw':!![],'transaction':_0x563e9f});})['then'](function(_0x422574){var _0x21e4cb=_[_0x1485('0x30')](_0x422574,function(_0x56c3dd){return Number(_0x56c3dd[_0x1485('0x62')]);});return db[_0x1485('0x63')][_0x1485('0x54')]({'where':{'UserId':{'$in':_0x4de4a9},'FaxQueueId':{'$in':_0x21e4cb}},'transaction':_0x563e9f});})[_0x1485('0x47')](function(){var _0x244565=_0x1485('0x64')+_0x304d32;return db[_0x1485('0x55')][_0x1485('0x34')](_0x244565,{'type':db['Sequelize'][_0x1485('0x58')][_0x1485('0x59')],'raw':!![],'transaction':_0x563e9f});})[_0x1485('0x47')](function(_0x2d7c1f){var _0xdc18bd=_[_0x1485('0x30')](_0x2d7c1f,function(_0x13c86d){return Number(_0x13c86d[_0x1485('0x65')]);});return db[_0x1485('0x66')][_0x1485('0x54')]({'where':{'UserId':{'$in':_0x4de4a9},'OpenchannelQueueId':{'$in':_0xdc18bd}},'transaction':_0x563e9f});})['then'](function(){var _0x44de7a=_0x1485('0x67')+_0x304d32;return db[_0x1485('0x55')][_0x1485('0x34')](_0x44de7a,{'type':db['Sequelize'][_0x1485('0x58')][_0x1485('0x59')],'raw':!![],'transaction':_0x563e9f});})[_0x1485('0x47')](function(_0x5ccb4f){var _0x576806=_[_0x1485('0x30')](_0x5ccb4f,function(_0x4368be){return Number(_0x4368be['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x4de4a9},'WhatsappQueueId':{'$in':_0x576806}},'transaction':_0x563e9f});})['then'](function(){return db['TeamVoicePrefix'][_0x1485('0x4b')]({'where':{'TeamId':_0x304d32}});})['then'](function(_0x4a8e70){if(_0x4a8e70===null){return;}return db[_0x1485('0x68')][_0x1485('0x54')]({'where':{'UserId':{'$in':_0x4de4a9},'VoicePrefixId':_0x4a8e70['VoicePrefixId']},'transaction':_0x563e9f});})[_0x1485('0x47')](function(){return db[_0x1485('0x31')][_0x1485('0x54')]({'where':{'id':_0x304d32},'cascade':!![],'transaction':_0x563e9f});})[_0x1485('0x47')](function(_0x25dd8d){if(_0x25dd8d===0x0){_0x17490f[_0x1485('0x21')](0x194);}else{return db[_0x1485('0x52')][_0x1485('0x54')]({'where':{'type':_0x1485('0x69'),'resourceId':_0x304d32},'cascade':!![],'transaction':_0x563e9f})[_0x1485('0x47')](function(){_0x17490f[_0x1485('0x22')](0xcc)[_0x1485('0x23')]();});}})[_0x1485('0x48')](function(_0x33efa8){_0x17490f[_0x1485('0x22')](0x1f4)[_0x1485('0x2e')](_0x33efa8);});});};exports['getQueues']=function(_0x437494,_0x3447a1,_0xd1400e){return db['Team'][_0x1485('0x6a')]({'where':{'id':_0x437494[_0x1485('0x4a')]['id']}})[_0x1485('0x47')](handleEntityNotFound(_0x3447a1,null))[_0x1485('0x47')](function(_0x5d2544){if(!_0x437494[_0x1485('0x34')][_0x1485('0x6b')]||!utils[_0x1485('0x6c')](_0x437494[_0x1485('0x34')]['channel'])){throw new db['Sequelize'][(_0x1485('0x6d'))](_0x1485('0x6e'));}var _0x2f2fdf={};var _0x1bca72={};_0x1bca72[_0x1485('0x33')]=_[_0x1485('0x35')](db[_[_0x1485('0x6f')](_0x437494[_0x1485('0x34')][_0x1485('0x6b')][_0x1485('0x70')]())+_0x1485('0x71')][_0x1485('0x72')]);_0x1bca72[_0x1485('0x34')]=_[_0x1485('0x35')](_0x437494[_0x1485('0x34')]);_0x1bca72['filters']=_[_0x1485('0x36')](_0x1bca72[_0x1485('0x33')],_0x1bca72[_0x1485('0x34')]);_0x2f2fdf[_0x1485('0x38')]=_[_0x1485('0x36')](_0x1bca72[_0x1485('0x33')],qs['fields'](_0x437494[_0x1485('0x34')][_0x1485('0x37')]));_0x2f2fdf[_0x1485('0x38')]=_0x2f2fdf[_0x1485('0x38')][_0x1485('0x39')]?_0x2f2fdf[_0x1485('0x38')]:_0x1bca72[_0x1485('0x33')];_0x2f2fdf['limit']=qs[_0x1485('0x26')](_0x437494[_0x1485('0x34')][_0x1485('0x26')]);_0x2f2fdf['offset']=qs['offset'](_0x437494[_0x1485('0x34')][_0x1485('0x24')]);_0x2f2fdf[_0x1485('0x3a')]=qs['sort'](_0x437494[_0x1485('0x34')]['sort']);_0x2f2fdf[_0x1485('0x3c')]=qs[_0x1485('0x3d')](_[_0x1485('0x3e')](_0x437494[_0x1485('0x34')],_0x1bca72[_0x1485('0x3d')]));_0x2f2fdf=_[_0x1485('0x40')]({},_0x2f2fdf,_0x437494['options']);return _0x5d2544[_0x1485('0x50')+_['capitalize'](_0x437494[_0x1485('0x34')][_0x1485('0x6b')][_0x1485('0x70')]())+_0x1485('0x73')](_0x2f2fdf);})['then'](respondWithResult(_0x3447a1,null))[_0x1485('0x48')](handleError(_0x3447a1,null));};exports[_0x1485('0x74')]=function(_0x1fa4e5,_0x1f9f34,_0x420da6){return db[_0x1485('0x31')][_0x1485('0x6a')]({'where':{'id':_0x1fa4e5['params']['id']}})['then'](function(_0x1eb55b){if(_0x1eb55b){if(!_0x1fa4e5['body']['channel']||!utils[_0x1485('0x6c')](_0x1fa4e5[_0x1485('0x4d')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x1485('0x6e'));}return _0x1eb55b[_0x1485('0x75')+_[_0x1485('0x6f')](_0x1fa4e5[_0x1485('0x4d')]['channel'][_0x1485('0x70')]())+_0x1485('0x73')](_0x1fa4e5['body'][_0x1485('0x76')]);}return null;})[_0x1485('0x47')](handleEntityNotFound(_0x1f9f34,null))['then'](respondWithStatusCode(_0x1f9f34,null))[_0x1485('0x48')](handleError(_0x1f9f34,null));};exports['removeQueues']=function(_0x40a199,_0x26190d,_0x2c78f8){return db['Team'][_0x1485('0x6a')]({'where':{'id':_0x40a199['params']['id']}})[_0x1485('0x47')](function(_0x118982){if(_0x118982){if(!_0x40a199[_0x1485('0x34')][_0x1485('0x6b')]||!utils[_0x1485('0x6c')](_0x40a199[_0x1485('0x34')]['channel'])){throw new db[(_0x1485('0x57'))][(_0x1485('0x6d'))](_0x1485('0x6e'));}return _0x118982[_0x1485('0x77')+_[_0x1485('0x6f')](_0x40a199[_0x1485('0x34')][_0x1485('0x6b')]['toLowerCase']())+_0x1485('0x73')](_0x40a199[_0x1485('0x34')][_0x1485('0x76')]);}return null;})['then'](handleEntityNotFound(_0x26190d,null))[_0x1485('0x47')](respondWithStatusCode(_0x26190d,null))[_0x1485('0x48')](handleError(_0x26190d,null));};exports['addAgents']=function(_0x1a69fd,_0x280494){var _0x82df5f=_[_0x1485('0x78')](_0x1a69fd[_0x1485('0x4d')][_0x1485('0x76')])?_0x1a69fd[_0x1485('0x4d')][_0x1485('0x76')]:[_0x1a69fd['body'][_0x1485('0x76')]];var _0x54a831=_0x1a69fd['params']['id'];return db['Team']['find']({'where':{'id':_0x54a831}})[_0x1485('0x47')](handleEntityNotFound(_0x280494,null))['then'](function(_0x3b26b1){if(_0x3b26b1){var _0x5b9cd0=[_0x1485('0x79'),_0x1485('0x7a'),'Mail',_0x1485('0x7b'),_0x1485('0x7c'),_0x1485('0x7d'),_0x1485('0x7e')];return db[_0x1485('0x55')][_0x1485('0x7f')](function(_0x480f03){var _0x85a4a8=_[_0x1485('0x30')](_0x5b9cd0,function(_0x42bb7f){var _0x4815ae={'attributes':['id',_0x1485('0x2d')]};if(_0x42bb7f==='Voice'){_0x4815ae[_0x1485('0x80')]={'attributes':[_0x1485('0x81')]};}return _0x3b26b1[_0x1485('0x50')+_0x42bb7f+'Queues'](_0x4815ae)[_0x1485('0x47')](function(_0xaa3c85){var _0x17962d=_[_0x1485('0x30')](_0xaa3c85,function(_0x1e6a39){var _0x11726f=_['map'](_0x82df5f,function(_0x3fdf7a){var _0x408d1f={'where':{'UserId':_0x3fdf7a,[_0x42bb7f+_0x1485('0x82')]:_0x1e6a39['id']},'transaction':_0x480f03};if(_0x42bb7f===_0x1485('0x79')){_0x408d1f['defaults']={'penalty':_0x1e6a39[_0x1485('0x83')][_0x1485('0x81')]};}return db[_0x1485('0x84')+_0x42bb7f+_0x1485('0x71')][_0x1485('0x85')](_0x408d1f)[_0x1485('0x47')](function(){socket['emit'](_0x1485('0x4e')+_0x42bb7f+'Queue:save',{'UserId':_0x3fdf7a,[_0x42bb7f+_0x1485('0x82')]:_0x1e6a39['id']});if(_0x42bb7f!==_0x1485('0x79')){return;}return db[_0x1485('0x84')][_0x1485('0x46')]({'where':{'id':_0x82df5f,'online':0x1},'attributes':['id',_0x1485('0x2d'),_0x1485('0x86'),'voicePause','interface'],'raw':!![]})[_0x1485('0x47')](function(_0x202cc6){var _0x2b56c7=_['map'](_0x202cc6,function(_0x335ba9){return db[_0x1485('0x87')][_0x1485('0x88')]({'membername':_0x335ba9['name'],'UserId':_0x335ba9['id'],'queue_name':_0x1e6a39['name'],'VoiceQueueId':_0x1e6a39['id'],'interface':_[_0x1485('0x89')](_0x335ba9[_0x1485('0x8a')])?util[_0x1485('0x8b')](_0x1485('0x8c'),_0x335ba9[_0x1485('0x2d')]):_0x335ba9['interface'],'paused':_0x335ba9[_0x1485('0x8d')]||![],'penalty':_0x1e6a39[_0x1485('0x83')][_0x1485('0x81')]},{'transaction':_0x480f03});});return Promise[_0x1485('0x8e')](_0x2b56c7);});});});return Promise[_0x1485('0x8e')](_0x11726f);});return Promise['all'](_0x17962d);})[_0x1485('0x47')](function(){return db[_0x1485('0x8f')][_0x1485('0x6a')]({'where':{'teamId':_0x54a831}})['then'](function(_0x375129){if(_0x375129){var _0x88944c=_[_0x1485('0x30')](_0x82df5f,function(_0x45caab){db[_0x1485('0x68')]['upsert']({'UserId':_0x45caab,'VoicePrefixId':_0x375129[_0x1485('0x90')]});});return Promise[_0x1485('0x8e')](_0x88944c);}});});});return Promise[_0x1485('0x8e')](_0x85a4a8)['then'](function(){return _0x3b26b1[_0x1485('0x91')](_0x82df5f,{'transaction':_0x480f03})['spread'](function(_0x5003f1){return _0x5003f1;});});});}})[_0x1485('0x47')](respondWithResult(_0x280494,null))[_0x1485('0x48')](handleError(_0x280494,null));};exports[_0x1485('0x92')]=function(_0xb747e9,_0x3a4b8a){var _0x3fe6f6=_[_0x1485('0x78')](_0xb747e9['query']['ids'])?_0xb747e9[_0x1485('0x34')]['ids']:[_0xb747e9[_0x1485('0x34')][_0x1485('0x76')]];var _0x42d916=_0xb747e9[_0x1485('0x4a')]['id'];return db[_0x1485('0x31')][_0x1485('0x4b')]({'where':{'id':_0x42d916}})[_0x1485('0x47')](handleEntityNotFound(_0x3a4b8a,null))[_0x1485('0x47')](function(_0x1b311b){if(_0x1b311b){var _0x5dca5c=[_0x1485('0x79'),_0x1485('0x7a'),_0x1485('0x93'),_0x1485('0x7b'),_0x1485('0x7c'),'Openchannel',_0x1485('0x7e')];return db[_0x1485('0x55')][_0x1485('0x7f')](function(_0x2ad523){var _0x2904f5=_[_0x1485('0x30')](_0x5dca5c,function(_0x3bac98){var _0x40486f={'attributes':['id',_0x1485('0x2d')]};return _0x1b311b[_0x1485('0x50')+_0x3bac98+_0x1485('0x73')](_0x40486f)['then'](function(_0x5e2197){var _0x3ffd08=_[_0x1485('0x30')](_0x5e2197,function(_0x44b16f){return _0x44b16f[_0x1485('0x92')](_0x3fe6f6,{'transaction':_0x2ad523})['then'](function(){var _0x7082e6=_[_0x1485('0x30')](_0x3fe6f6,function(_0x561d3c){socket[_0x1485('0x94')](_0x1485('0x4e')+_0x3bac98+'Queue:remove',{'UserId':Number(_0x561d3c),[_0x3bac98+_0x1485('0x82')]:_0x44b16f['id']});if(_0x3bac98!==_0x1485('0x79')){return;}return db['UserVoiceQueueRt'][_0x1485('0x54')]({'where':{'VoiceQueueId':_0x44b16f['id'],'UserId':_0x561d3c},'transaction':_0x2ad523});});return Promise['all'](_0x7082e6);});});return Promise[_0x1485('0x8e')](_0x3ffd08);});});return Promise[_0x1485('0x8e')](_0x2904f5)[_0x1485('0x47')](function(){return _0x1b311b[_0x1485('0x92')](_0x3fe6f6,{'transaction':_0x2ad523});})['then'](function(){return db['TeamVoicePrefix'][_0x1485('0x6a')]({'where':{'teamId':_0x42d916}})['then'](function(_0x4d3588){if(_0x4d3588){var _0x1abf48=_[_0x1485('0x30')](_0x3fe6f6,function(_0x1c27ce){db['UserVoicePrefix'][_0x1485('0x54')]({'where':{'UserId':_0x1c27ce,'VoicePrefixId':_0x4d3588[_0x1485('0x90')]}});});return Promise[_0x1485('0x8e')](_0x1abf48);}});});});}})[_0x1485('0x47')](respondWithStatusCode(_0x3a4b8a,null))['catch'](handleError(_0x3a4b8a,null));};exports[_0x1485('0x95')]=function(_0x4cf347,_0x3d816f,_0x39c962){var _0x4ef525={};var _0x1436f3={};var _0x2b4efe;var _0x559e3a;return db[_0x1485('0x31')][_0x1485('0x6a')]({'where':{'id':_0x4cf347['params']['id']}})[_0x1485('0x47')](handleEntityNotFound(_0x3d816f,null))[_0x1485('0x47')](function(_0x4d1f81){if(_0x4d1f81){_0x2b4efe=_0x4d1f81;_0x1436f3[_0x1485('0x33')]=_[_0x1485('0x35')](db['User']['rawAttributes']);_0x1436f3[_0x1485('0x34')]=_['keys'](_0x4cf347['query']);_0x1436f3['filters']=_[_0x1485('0x36')](_0x1436f3[_0x1485('0x33')],_0x1436f3['query']);_0x4ef525[_0x1485('0x38')]=_[_0x1485('0x36')](_0x1436f3['model'],qs['fields'](_0x4cf347[_0x1485('0x34')][_0x1485('0x37')]));_0x4ef525[_0x1485('0x38')]=_0x4ef525[_0x1485('0x38')]['length']?_0x4ef525['attributes']:_0x1436f3['model'];_0x4ef525[_0x1485('0x3a')]=qs[_0x1485('0x3b')](_0x4cf347[_0x1485('0x34')][_0x1485('0x3b')]);_0x4ef525[_0x1485('0x3c')]=qs[_0x1485('0x3d')](_['pick'](_0x4cf347['query'],_0x1436f3[_0x1485('0x3d')]));if(_0x4cf347[_0x1485('0x34')][_0x1485('0x3f')]){_0x4ef525[_0x1485('0x3c')]=_[_0x1485('0x40')](_0x4ef525['where'],{'$or':_[_0x1485('0x30')](_0x4ef525[_0x1485('0x38')],function(_0x34a108){var _0x25d758={};_0x25d758[_0x34a108]={'$like':'%'+_0x4cf347[_0x1485('0x34')][_0x1485('0x3f')]+'%'};return _0x25d758;})});}_0x4ef525=_[_0x1485('0x40')]({},_0x4ef525,_0x4cf347[_0x1485('0x43')]);return _0x2b4efe[_0x1485('0x95')](_0x4ef525);}})[_0x1485('0x47')](function(_0x137c1a){if(_0x137c1a){_0x559e3a=_0x137c1a[_0x1485('0x39')];if(!_0x4cf347['query'][_0x1485('0x96')]('nolimit')){_0x4ef525[_0x1485('0x26')]=qs[_0x1485('0x26')](_0x4cf347[_0x1485('0x34')]['limit']);_0x4ef525[_0x1485('0x24')]=qs[_0x1485('0x24')](_0x4cf347[_0x1485('0x34')]['offset']);}return _0x2b4efe[_0x1485('0x95')](_0x4ef525);}})['then'](function(_0x4f8e41){if(_0x4f8e41){return _0x4f8e41?{'count':_0x559e3a,'rows':_0x4f8e41}:null;}})[_0x1485('0x47')](respondWithResult(_0x3d816f,null))[_0x1485('0x48')](handleError(_0x3d816f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f2c493d..8ea93c5 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 _0x2da4=['hook','exports','../../mysqldb','Team','setMaxListeners','save','update','emit'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x2da4,0x16a));var _0x42da=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2da4[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var Team=require(_0x42da('0x0'))['db'][_0x42da('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x42da('0x2')](0x0);var events={'afterCreate':_0x42da('0x3'),'afterUpdate':_0x42da('0x4'),'afterDestroy':'remove'};function emitEvent(_0x23e1dc){return function(_0x11c24e,_0x2bf85c,_0x252fc3){TeamEvents['emit'](_0x23e1dc+':'+_0x11c24e['id'],_0x11c24e);TeamEvents[_0x42da('0x5')](_0x23e1dc,_0x11c24e);_0x252fc3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x42da('0x6')](e,emitEvent(event));}}module[_0x42da('0x7')]=TeamEvents; \ No newline at end of file +var _0x3601=['Team','setMaxListeners','save','update','remove','emit','exports'];(function(_0x3a0a1a,_0x512134){var _0x29d408=function(_0x147c0a){while(--_0x147c0a){_0x3a0a1a['push'](_0x3a0a1a['shift']());}};_0x29d408(++_0x512134);}(_0x3601,0x1ce));var _0x1360=function(_0x4025e1,_0x483169){_0x4025e1=_0x4025e1-0x0;var _0xa92381=_0x3601[_0x4025e1];return _0xa92381;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x1360('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x1360('0x1')](0x0);var events={'afterCreate':_0x1360('0x2'),'afterUpdate':_0x1360('0x3'),'afterDestroy':_0x1360('0x4')};function emitEvent(_0x27c1af){return function(_0xa6f488,_0x1e5ad7,_0x439b87){TeamEvents[_0x1360('0x5')](_0x27c1af+':'+_0xa6f488['id'],_0xa6f488);TeamEvents[_0x1360('0x5')](_0x27c1af,_0xa6f488);_0x439b87(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x1360('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index dc22bc8..5f5cdfc 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 _0x6741=['exports','define','Team','teams','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ca744,_0x487ecc){var _0x5c3627=function(_0x3b5ecf){while(--_0x3b5ecf){_0x3ca744['push'](_0x3ca744['shift']());}};_0x5c3627(++_0x487ecc);}(_0x6741,0x124));var _0x1674=function(_0x4b0fd7,_0x27c667){_0x4b0fd7=_0x4b0fd7-0x0;var _0x2a34f9=_0x6741[_0x4b0fd7];return _0x2a34f9;};'use strict';var _=require('lodash');var util=require(_0x1674('0x0'));var logger=require(_0x1674('0x1'))(_0x1674('0x2'));var moment=require('moment');var BPromise=require(_0x1674('0x3'));var rp=require(_0x1674('0x4'));var fs=require('fs');var path=require(_0x1674('0x5'));var rimraf=require(_0x1674('0x6'));var config=require(_0x1674('0x7'));var attributes=require('./team.attributes');module[_0x1674('0x8')]=function(_0xca7649,_0x1b748d){return _0xca7649[_0x1674('0x9')](_0x1674('0xa'),attributes,{'tableName':_0x1674('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfd0=['lodash','util','moment','request-promise','path','../../config/environment','exports','define','teams'];(function(_0x13a275,_0x3959a5){var _0x45919a=function(_0x56cb70){while(--_0x56cb70){_0x13a275['push'](_0x13a275['shift']());}};_0x45919a(++_0x3959a5);}(_0xdfd0,0x1e6));var _0x0dfd=function(_0x30f4c2,_0x54292f){_0x30f4c2=_0x30f4c2-0x0;var _0x15a3a6=_0xdfd0[_0x30f4c2];return _0x15a3a6;};'use strict';var _=require(_0x0dfd('0x0'));var util=require(_0x0dfd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0dfd('0x2'));var BPromise=require('bluebird');var rp=require(_0x0dfd('0x3'));var fs=require('fs');var path=require(_0x0dfd('0x4'));var rimraf=require('rimraf');var config=require(_0x0dfd('0x5'));var attributes=require('./team.attributes');module[_0x0dfd('0x6')]=function(_0x432a6c,_0x28dbf2){return _0x432a6c[_0x0dfd('0x7')]('Team',attributes,{'tableName':_0x0dfd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d3fc2b0..31144fe 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 _0x94a8=['Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info'];(function(_0x45b769,_0xcd107e){var _0x20022d=function(_0x16dba3){while(--_0x16dba3){_0x45b769['push'](_0x45b769['shift']());}};_0x20022d(++_0xcd107e);}(_0x94a8,0x18f));var _0x894a=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x94a8[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x894a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x894a('0x1'));var rs=require(_0x894a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x894a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x894a('0x4'))(_0x894a('0x5'));var config=require(_0x894a('0x6'));var jayson=require(_0x894a('0x7'));var client=jayson[_0x894a('0x8')][_0x894a('0x9')]({'port':0x232a});config[_0x894a('0xa')]=_[_0x894a('0xb')](config[_0x894a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x894a('0xc'))(new Redis(config[_0x894a('0xa')]));require('./team.socket')[_0x894a('0xd')](socket);function respondWithRpcPromise(_0x356bda,_0x516ab9,_0x23a38b){return new BPromise(function(_0x3e1aec,_0xc2633f){return client[_0x894a('0xe')](_0x356bda,_0x23a38b)[_0x894a('0xf')](function(_0x344e0d){logger[_0x894a('0x10')](_0x894a('0x11'),_0x516ab9,'request\x20sent');logger[_0x894a('0x12')](_0x894a('0x13'),_0x516ab9,_0x894a('0x14'),JSON['stringify'](_0x344e0d));if(_0x344e0d[_0x894a('0x15')]){if(_0x344e0d[_0x894a('0x15')][_0x894a('0x16')]===0x1f4){logger[_0x894a('0x15')](_0x894a('0x11'),_0x516ab9,_0x344e0d[_0x894a('0x15')][_0x894a('0x17')]);return _0xc2633f(_0x344e0d[_0x894a('0x15')][_0x894a('0x17')]);}logger[_0x894a('0x15')](_0x894a('0x11'),_0x516ab9,_0x344e0d['error'][_0x894a('0x17')]);return _0x3e1aec(_0x344e0d[_0x894a('0x15')][_0x894a('0x17')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x516ab9,'request\x20sent');_0x3e1aec(_0x344e0d[_0x894a('0x18')][_0x894a('0x17')]);}})[_0x894a('0x19')](function(_0x105597){logger[_0x894a('0x15')](_0x894a('0x11'),_0x516ab9,_0x105597);_0xc2633f(_0x105597);});});} \ No newline at end of file +var _0x50dc=['request\x20sent','stringify','error','code','message','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./team.socket','request','then','info','Team,\x20%s,\x20%s'];(function(_0x5b42bd,_0x3d0de5){var _0x51a035=function(_0x5670e7){while(--_0x5670e7){_0x5b42bd['push'](_0x5b42bd['shift']());}};_0x51a035(++_0x3d0de5);}(_0x50dc,0x194));var _0xc50d=function(_0x152b8b,_0x4a55da){_0x152b8b=_0x152b8b-0x0;var _0xf01ac6=_0x50dc[_0x152b8b];return _0xf01ac6;};'use strict';var _=require('lodash');var util=require(_0xc50d('0x0'));var moment=require('moment');var BPromise=require(_0xc50d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc50d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc50d('0x3'));var logger=require(_0xc50d('0x4'))(_0xc50d('0x5'));var config=require(_0xc50d('0x6'));var jayson=require(_0xc50d('0x7'));var client=jayson[_0xc50d('0x8')][_0xc50d('0x9')]({'port':0x232a});config[_0xc50d('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc50d('0xb'))['register'](socket);function respondWithRpcPromise(_0x35152b,_0x22a28d,_0x410bda){return new BPromise(function(_0x3a1ad8,_0x1e63f4){return client[_0xc50d('0xc')](_0x35152b,_0x410bda)[_0xc50d('0xd')](function(_0x285f69){logger[_0xc50d('0xe')](_0xc50d('0xf'),_0x22a28d,_0xc50d('0x10'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x22a28d,_0xc50d('0x10'),JSON[_0xc50d('0x11')](_0x285f69));if(_0x285f69[_0xc50d('0x12')]){if(_0x285f69[_0xc50d('0x12')][_0xc50d('0x13')]===0x1f4){logger[_0xc50d('0x12')](_0xc50d('0xf'),_0x22a28d,_0x285f69[_0xc50d('0x12')]['message']);return _0x1e63f4(_0x285f69[_0xc50d('0x12')]['message']);}logger[_0xc50d('0x12')](_0xc50d('0xf'),_0x22a28d,_0x285f69[_0xc50d('0x12')]['message']);return _0x3a1ad8(_0x285f69[_0xc50d('0x12')][_0xc50d('0x14')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x22a28d,_0xc50d('0x10'));_0x3a1ad8(_0x285f69['result'][_0xc50d('0x14')]);}})['catch'](function(_0x43c420){logger[_0xc50d('0x12')]('Team,\x20%s,\x20%s',_0x22a28d,_0x43c420);_0x1e63f4(_0x43c420);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index cb08946..1925d86 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 _0x68cc=['register','team:','./team.events','remove','update','emit'];(function(_0x58b46a,_0x4d50d3){var _0x3169f1=function(_0x3ef146){while(--_0x3ef146){_0x58b46a['push'](_0x58b46a['shift']());}};_0x3169f1(++_0x4d50d3);}(_0x68cc,0xd4));var _0xc68c=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x68cc[_0x5d4607];return _0x5e4a86;};'use strict';var TeamEvents=require(_0xc68c('0x0'));var events=['save',_0xc68c('0x1'),_0xc68c('0x2')];function createListener(_0x3a5ab1,_0xaf7332){return function(_0x3c9cea){_0xaf7332[_0xc68c('0x3')](_0x3a5ab1,_0x3c9cea);};}function removeListener(_0x337a40,_0x5f301b){return function(){TeamEvents['removeListener'](_0x337a40,_0x5f301b);};}exports[_0xc68c('0x4')]=function(_0x9ef020){for(var _0x1a5ba1=0x0,_0x3ecee8=events['length'];_0x1a5ba1<_0x3ecee8;_0x1a5ba1++){var _0x4d8b7b=events[_0x1a5ba1];var _0xd2a107=createListener(_0xc68c('0x5')+_0x4d8b7b,_0x9ef020);TeamEvents['on'](_0x4d8b7b,_0xd2a107);}}; \ No newline at end of file +var _0x4c6b=['remove','update','emit','removeListener','register','length','team:','./team.events'];(function(_0x2a1395,_0x1d62a6){var _0x47d534=function(_0x109565){while(--_0x109565){_0x2a1395['push'](_0x2a1395['shift']());}};_0x47d534(++_0x1d62a6);}(_0x4c6b,0x87));var _0xb4c6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4c6b[_0x42cae2];return _0x5f256f;};'use strict';var TeamEvents=require(_0xb4c6('0x0'));var events=['save',_0xb4c6('0x1'),_0xb4c6('0x2')];function createListener(_0x1f63a1,_0x32c1f2){return function(_0x4dc3bf){_0x32c1f2[_0xb4c6('0x3')](_0x1f63a1,_0x4dc3bf);};}function removeListener(_0x16d089,_0x14714f){return function(){TeamEvents[_0xb4c6('0x4')](_0x16d089,_0x14714f);};}exports[_0xb4c6('0x5')]=function(_0x5dfe17){for(var _0x4734e5=0x0,_0x31760a=events[_0xb4c6('0x6')];_0x4734e5<_0x31760a;_0x4734e5++){var _0x160275=events[_0x4734e5];var _0x44d66e=createListener(_0xb4c6('0x7')+_0x160275,_0x5dfe17);TeamEvents['on'](_0x160275,_0x44d66e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index ee2957e..0d77828 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 _0x86fd=['exports','INTEGER','sequelize'];(function(_0xdeab26,_0xb58d7d){var _0x174650=function(_0x50b8ef){while(--_0x50b8ef){_0xdeab26['push'](_0xdeab26['shift']());}};_0x174650(++_0xb58d7d);}(_0x86fd,0xa7));var _0xd86f=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0x86fd[_0x29e3b6];return _0x55d4b0;};'use strict';var Sequelize=require(_0xd86f('0x0'));module[_0xd86f('0x1')]={'TeamId':{'type':Sequelize[_0xd86f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd86f('0x2')]}}; \ No newline at end of file +var _0xc5e6=['exports','INTEGER','sequelize'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xc5e6,0x83));var _0x6c5e=function(_0x112aa9,_0x51a391){_0x112aa9=_0x112aa9-0x0;var _0xebc169=_0xc5e6[_0x112aa9];return _0xebc169;};'use strict';var Sequelize=require(_0x6c5e('0x0'));module[_0x6c5e('0x1')]={'TeamId':{'type':Sequelize[_0x6c5e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x6c5e('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 3496b84..5a04ef8 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 _0x7382=['define','team_has_voice_prefixes','util','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x45c0a4,_0x43b30b){var _0x426472=function(_0x40b764){while(--_0x40b764){_0x45c0a4['push'](_0x45c0a4['shift']());}};_0x426472(++_0x43b30b);}(_0x7382,0x1f2));var _0x2738=function(_0x26bb43,_0x2abe9a){_0x26bb43=_0x26bb43-0x0;var _0x12afc0=_0x7382[_0x26bb43];return _0x12afc0;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2738('0x1'));var BPromise=require('bluebird');var rp=require(_0x2738('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2738('0x3'));var config=require(_0x2738('0x4'));var attributes=require('./teamVoicePrefix.attributes');module[_0x2738('0x5')]=function(_0x267a1a,_0x457c61){return _0x267a1a[_0x2738('0x6')]('TeamVoicePrefix',attributes,{'tableName':_0x2738('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x151b=['request-promise','path','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','bluebird'];(function(_0x15ebd0,_0x5354df){var _0x239bf3=function(_0x250ac9){while(--_0x250ac9){_0x15ebd0['push'](_0x15ebd0['shift']());}};_0x239bf3(++_0x5354df);}(_0x151b,0x153));var _0xb151=function(_0x1657d0,_0x80dbf1){_0x1657d0=_0x1657d0-0x0;var _0x34bb81=_0x151b[_0x1657d0];return _0x34bb81;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb151('0x1'));var moment=require('moment');var BPromise=require(_0xb151('0x2'));var rp=require(_0xb151('0x3'));var fs=require('fs');var path=require(_0xb151('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb151('0x5'));module[_0xb151('0x6')]=function(_0x56b93e,_0x3ef028){return _0x56b93e['define'](_0xb151('0x7'),attributes,{'tableName':_0xb151('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 31a919e..6718f9f 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e6fdc,_0x46e4d9){var _0x430894=function(_0x5a8e57){while(--_0x5a8e57){_0x4e6fdc['push'](_0x4e6fdc['shift']());}};_0x430894(++_0x46e4d9);}(_0xe706,0xa3));var _0x6e70=function(_0x413221,_0x348dee){_0x413221=_0x413221-0x0;var _0x22db25=_0xe706[_0x413221];return _0x22db25;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x7c2339,_0x5319d4){var _0x447c46=function(_0x5754f1){while(--_0x5754f1){_0x7c2339['push'](_0x7c2339['shift']());}};_0x447c46(++_0x5319d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0xcb91[_0x2892da];return _0x28cff2;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 947f604..435e9e0 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 _0xbd3c=['exports','INTEGER'];(function(_0x2b0acc,_0x4ae9d9){var _0x4d2cfb=function(_0x45a5c8){while(--_0x45a5c8){_0x2b0acc['push'](_0x2b0acc['shift']());}};_0x4d2cfb(++_0x4ae9d9);}(_0xbd3c,0x184));var _0xcbd3=function(_0x4475e1,_0x5c4a94){_0x4475e1=_0x4475e1-0x0;var _0x4cf98e=_0xbd3c[_0x4475e1];return _0x4cf98e;};'use strict';var Sequelize=require('sequelize');module[_0xcbd3('0x0')]={'penalty':{'type':Sequelize[_0xcbd3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfe1f=['INTEGER','sequelize','exports'];(function(_0x2c32fb,_0x45b9a8){var _0x1f2836=function(_0x277504){while(--_0x277504){_0x2c32fb['push'](_0x2c32fb['shift']());}};_0x1f2836(++_0x45b9a8);}(_0xfe1f,0x1c3));var _0xffe1=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0xfe1f[_0x481df5];return _0x32726e;};'use strict';var Sequelize=require(_0xffe1('0x0'));module[_0xffe1('0x1')]={'penalty':{'type':Sequelize[_0xffe1('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 8d17e77..38fd281 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 _0xcea2=['../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x218713,_0x2e7b7f){var _0xfde9ad=function(_0x511811){while(--_0x511811){_0x218713['push'](_0x218713['shift']());}};_0xfde9ad(++_0x2e7b7f);}(_0xcea2,0x15a));var _0x2cea=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xcea2[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b7f=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4dde60,_0x37c1fa){var _0xe64b3b=function(_0x51e919){while(--_0x51e919){_0x4dde60['push'](_0x4dde60['shift']());}};_0xe64b3b(++_0x37c1fa);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x298af0,_0x597527){_0x298af0=_0x298af0-0x0;var _0xfd7bbe=_0x5b7f[_0x298af0];return _0xfd7bbe;};'use strict';var _=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var logger=require(_0xf5b7('0x2'))(_0xf5b7('0x3'));var moment=require(_0xf5b7('0x4'));var BPromise=require(_0xf5b7('0x5'));var rp=require(_0xf5b7('0x6'));var fs=require('fs');var path=require(_0xf5b7('0x7'));var rimraf=require(_0xf5b7('0x8'));var config=require(_0xf5b7('0x9'));var attributes=require(_0xf5b7('0xa'));module[_0xf5b7('0xb')]=function(_0x1e67ac,_0x984337){return _0x1e67ac[_0xf5b7('0xc')](_0xf5b7('0xd'),attributes,{'tableName':_0xf5b7('0xe'),'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 1d2884d..2076571 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 _0xc4b6=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x4f6afc,_0x4dfa88){var _0x256eeb=function(_0x216559){while(--_0x216559){_0x4f6afc['push'](_0x4f6afc['shift']());}};_0x256eeb(++_0x4dfa88);}(_0xc4b6,0x1b8));var _0x6c4b=function(_0xfc0170,_0x77b289){_0xfc0170=_0xfc0170-0x0;var _0x3603c1=_0xc4b6[_0xfc0170];return _0x3603c1;};'use strict';var _=require('lodash');var util=require(_0x6c4b('0x0'));var moment=require(_0x6c4b('0x1'));var BPromise=require(_0x6c4b('0x2'));var rs=require(_0x6c4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c4b('0x4'))['db'];var utils=require(_0x6c4b('0x5'));var logger=require(_0x6c4b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c4b('0x7'));var client=jayson[_0x6c4b('0x8')][_0x6c4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7b4a8b,_0x701172,_0x1c75e0){return new BPromise(function(_0x11ecbf,_0x4d86e3){return client[_0x6c4b('0xa')](_0x7b4a8b,_0x1c75e0)[_0x6c4b('0xb')](function(_0x4b4fda){logger['info'](_0x6c4b('0xc'),_0x701172,'request\x20sent');logger[_0x6c4b('0xd')](_0x6c4b('0xe'),_0x701172,_0x6c4b('0xf'),JSON[_0x6c4b('0x10')](_0x4b4fda));if(_0x4b4fda[_0x6c4b('0x11')]){if(_0x4b4fda['error'][_0x6c4b('0x12')]===0x1f4){logger[_0x6c4b('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x701172,_0x4b4fda[_0x6c4b('0x11')][_0x6c4b('0x13')]);return _0x4d86e3(_0x4b4fda[_0x6c4b('0x11')]['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x701172,_0x4b4fda[_0x6c4b('0x11')][_0x6c4b('0x13')]);return _0x11ecbf(_0x4b4fda[_0x6c4b('0x11')]['message']);}else{logger['info'](_0x6c4b('0xc'),_0x701172,_0x6c4b('0xf'));_0x11ecbf(_0x4b4fda[_0x6c4b('0x14')][_0x6c4b('0x13')]);}})['catch'](function(_0x344db8){logger[_0x6c4b('0x11')](_0x6c4b('0xc'),_0x701172,_0x344db8);_0x4d86e3(_0x344db8);});});} \ No newline at end of file +var _0x4fdc=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xe49085,_0xf5d78b){var _0x3226af=function(_0x5a6fa0){while(--_0x5a6fa0){_0xe49085['push'](_0xe49085['shift']());}};_0x3226af(++_0xf5d78b);}(_0x4fdc,0xf9));var _0xc4fd=function(_0x3198b2,_0x3d85b0){_0x3198b2=_0x3198b2-0x0;var _0x27bc48=_0x4fdc[_0x3198b2];return _0x27bc48;};'use strict';var _=require(_0xc4fd('0x0'));var util=require(_0xc4fd('0x1'));var moment=require(_0xc4fd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4fd('0x3'));var db=require(_0xc4fd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4fd('0x5'))(_0xc4fd('0x6'));var config=require(_0xc4fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4fd('0x8')][_0xc4fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x348ede,_0x517ffd,_0x4204f0){return new BPromise(function(_0xf60880,_0x346d46){return client[_0xc4fd('0xa')](_0x348ede,_0x4204f0)['then'](function(_0x4eaeeb){logger[_0xc4fd('0xb')](_0xc4fd('0xc'),_0x517ffd,_0xc4fd('0xd'));logger[_0xc4fd('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x517ffd,'request\x20sent',JSON[_0xc4fd('0xf')](_0x4eaeeb));if(_0x4eaeeb[_0xc4fd('0x10')]){if(_0x4eaeeb['error'][_0xc4fd('0x11')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x517ffd,_0x4eaeeb[_0xc4fd('0x10')][_0xc4fd('0x12')]);return _0x346d46(_0x4eaeeb[_0xc4fd('0x10')][_0xc4fd('0x12')]);}logger[_0xc4fd('0x10')](_0xc4fd('0xc'),_0x517ffd,_0x4eaeeb[_0xc4fd('0x10')][_0xc4fd('0x12')]);return _0xf60880(_0x4eaeeb[_0xc4fd('0x10')]['message']);}else{logger[_0xc4fd('0xb')](_0xc4fd('0xc'),_0x517ffd,'request\x20sent');_0xf60880(_0x4eaeeb[_0xc4fd('0x13')]['message']);}})[_0xc4fd('0x14')](function(_0x4d0407){logger[_0xc4fd('0x10')](_0xc4fd('0xc'),_0x517ffd,_0x4d0407);_0x346d46(_0x4d0407);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c037d06..b0d9fce 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 _0x7a52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','put','delete','multer','path','connect-timeout','express','Router'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7a52,0x1bd));var _0x27a5=function(_0x56eda3,_0xda3e68){_0x56eda3=_0x56eda3-0x0;var _0x57c9c3=_0x7a52[_0x56eda3];return _0x57c9c3;};'use strict';var multer=require(_0x27a5('0x0'));var util=require('util');var path=require(_0x27a5('0x1'));var timeout=require(_0x27a5('0x2'));var express=require(_0x27a5('0x3'));var router=express[_0x27a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27a5('0x5'));var interaction=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));var controller=require(_0x27a5('0x8'));router[_0x27a5('0x9')]('/',auth[_0x27a5('0xa')](),controller[_0x27a5('0xb')]);router['get'](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['show']);router['post']('/',auth[_0x27a5('0xa')](),controller['create']);router[_0x27a5('0xd')](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['update']);router[_0x27a5('0xe')](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb4d9=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb4d9,0xce));var _0x9b4d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb4d9[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var path=require('path');var timeout=require(_0x9b4d('0x2'));var express=require(_0x9b4d('0x3'));var router=express[_0x9b4d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b4d('0x5'));var interaction=require(_0x9b4d('0x6'));var config=require(_0x9b4d('0x7'));var controller=require(_0x9b4d('0x8'));router[_0x9b4d('0x9')]('/',auth[_0x9b4d('0xa')](),controller[_0x9b4d('0xb')]);router[_0x9b4d('0x9')](_0x9b4d('0xc'),auth[_0x9b4d('0xa')](),controller[_0x9b4d('0xd')]);router['post']('/',auth[_0x9b4d('0xa')](),controller['create']);router[_0x9b4d('0xe')]('/:id',auth[_0x9b4d('0xa')](),controller[_0x9b4d('0xf')]);router[_0x9b4d('0x10')](_0x9b4d('0xc'),auth[_0x9b4d('0xa')](),controller[_0x9b4d('0x11')]);module[_0x9b4d('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 16e19a6..bc276d1 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 _0x3bc3=['sequelize','exports','STRING'];(function(_0x1415bd,_0x534e27){var _0x354175=function(_0x58562b){while(--_0x58562b){_0x1415bd['push'](_0x1415bd['shift']());}};_0x354175(++_0x534e27);}(_0x3bc3,0xc3));var _0x33bc=function(_0x3793c4,_0x2b4771){_0x3793c4=_0x3793c4-0x0;var _0x1851a7=_0x3bc3[_0x3793c4];return _0x1851a7;};'use strict';var Sequelize=require(_0x33bc('0x0'));module[_0x33bc('0x1')]={'name':{'type':Sequelize[_0x33bc('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbff1=['exports','STRING','TEXT','sequelize'];(function(_0x369a41,_0x5ed95c){var _0x16807d=function(_0x189d9f){while(--_0x189d9f){_0x369a41['push'](_0x369a41['shift']());}};_0x16807d(++_0x5ed95c);}(_0xbff1,0x1af));var _0x1bff=function(_0x5db129,_0x151303){_0x5db129=_0x5db129-0x0;var _0x5ec143=_0xbff1[_0x5db129];return _0x5ec143;};'use strict';var Sequelize=require(_0x1bff('0x0'));module[_0x1bff('0x1')]={'name':{'type':Sequelize[_0x1bff('0x2')]},'description':{'type':Sequelize[_0x1bff('0x2')]},'html':{'type':Sequelize[_0x1bff('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1a02f4d..f54138a 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 _0x761f=['json','limit','undefined','offset','Content-Range','apply','reject','save','update','then','get','Templates','destroy','end','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x4e8401,_0x51b328){var _0x17269f=function(_0x35ac65){while(--_0x35ac65){_0x4e8401['push'](_0x4e8401['shift']());}};_0x17269f(++_0x51b328);}(_0x761f,0x1ce));var _0xf761=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x761f[_0xa45395];return _0x3c83d2;};'use strict';var emlformat=require(_0xf761('0x0'));var rimraf=require(_0xf761('0x1'));var zipdir=require(_0xf761('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf761('0x3'));var Mustache=require(_0xf761('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf761('0x5'));var csv=require(_0xf761('0x6'));var ejs=require(_0xf761('0x7'));var fs=require('fs');var fs_extra=require(_0xf761('0x8'));var _=require(_0xf761('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf761('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf761('0xb'));var Papa=require(_0xf761('0xc'));var Redis=require(_0xf761('0xd'));var authService=require(_0xf761('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf761('0xf'));var hardwareService=require(_0xf761('0x10'));var logger=require(_0xf761('0x11'))('api');var utils=require(_0xf761('0x12'));var config=require(_0xf761('0x13'));var licenseUtil=require(_0xf761('0x14'));var db=require(_0xf761('0x15'))['db'];function respondWithStatusCode(_0x25b59c,_0x1ad781){_0x1ad781=_0x1ad781||0xcc;return function(_0x4951c6){if(_0x4951c6){return _0x25b59c[_0xf761('0x16')](_0x1ad781);}return _0x25b59c[_0xf761('0x17')](_0x1ad781)['end']();};}function respondWithResult(_0x384585,_0x469efa){_0x469efa=_0x469efa||0xc8;return function(_0x4b73fe){if(_0x4b73fe){return _0x384585[_0xf761('0x17')](_0x469efa)[_0xf761('0x18')](_0x4b73fe);}};}function respondWithFilteredResult(_0x4d75f2,_0x48bcf1){return function(_0x5b1f50){if(_0x5b1f50){var _0x1cb7b9=typeof _0x48bcf1['offset']==='undefined'&&typeof _0x48bcf1[_0xf761('0x19')]===_0xf761('0x1a');var _0xc0ad52=_0x5b1f50['count'];var _0x5535e3=_0x1cb7b9?0x0:_0x48bcf1[_0xf761('0x1b')];var _0x42331c=_0x1cb7b9?_0x5b1f50['count']:_0x48bcf1['offset']+_0x48bcf1['limit'];var _0x1a4793;if(_0x42331c>=_0xc0ad52){_0x42331c=_0xc0ad52;_0x1a4793=0xc8;}else{_0x1a4793=0xce;}_0x4d75f2[_0xf761('0x17')](_0x1a4793);return _0x4d75f2['set'](_0xf761('0x1c'),_0x5535e3+'-'+_0x42331c+'/'+_0xc0ad52)[_0xf761('0x18')](_0x5b1f50);}return null;};}function patchUpdates(_0x5c6aa6){return function(_0x3cb8da){try{jsonpatch[_0xf761('0x1d')](_0x3cb8da,_0x5c6aa6,!![]);}catch(_0x5702d6){return BPromise[_0xf761('0x1e')](_0x5702d6);}return _0x3cb8da[_0xf761('0x1f')]();};}function saveUpdates(_0x42d082,_0x4254cc){return function(_0x7a61c4){if(_0x7a61c4){return _0x7a61c4[_0xf761('0x20')](_0x42d082)[_0xf761('0x21')](function(_0xee88e6){return _0xee88e6;});}return null;};}function removeEntity(_0xb1ab3e,_0x1ec814){return function(_0x2ad54f){if(_0x2ad54f){return _0x2ad54f['destroy']()[_0xf761('0x21')](function(){var _0x135f32=_0x2ad54f[_0xf761('0x22')]({'plain':!![]});var _0x43d359=_0xf761('0x23');return db['UserProfileResource'][_0xf761('0x24')]({'where':{'type':_0x43d359,'resourceId':_0x135f32['id']}})['then'](function(){return _0x2ad54f;});})[_0xf761('0x21')](function(){_0xb1ab3e[_0xf761('0x17')](0xcc)[_0xf761('0x25')]();});}};}function handleEntityNotFound(_0x42eed5,_0x5d1354){return function(_0x2230d5){if(!_0x2230d5){_0x42eed5[_0xf761('0x16')](0x194);}return _0x2230d5;};}function handleError(_0x3a35b5,_0x3608f3){_0x3608f3=_0x3608f3||0x1f4;return function(_0x3894b9){logger['error'](_0x3894b9['stack']);if(_0x3894b9[_0xf761('0x26')]){delete _0x3894b9[_0xf761('0x26')];}_0x3a35b5[_0xf761('0x17')](_0x3608f3)[_0xf761('0x27')](_0x3894b9);};}exports[_0xf761('0x28')]=function(_0x1266b8,_0x3a50d3){var _0x2a0cf3={},_0x54522f={},_0x5acaf2={'count':0x0,'rows':[]};var _0x3720eb=_[_0xf761('0x29')](db[_0xf761('0x2a')][_0xf761('0x2b')],function(_0x179b78){return{'name':_0x179b78[_0xf761('0x2c')],'type':_0x179b78[_0xf761('0x2d')]['key']};});_0x54522f[_0xf761('0x2e')]=_[_0xf761('0x29')](_0x3720eb,_0xf761('0x26'));_0x54522f[_0xf761('0x2f')]=_[_0xf761('0x30')](_0x1266b8[_0xf761('0x2f')]);_0x54522f['filters']=_[_0xf761('0x31')](_0x54522f['model'],_0x54522f[_0xf761('0x2f')]);_0x2a0cf3['attributes']=_[_0xf761('0x31')](_0x54522f[_0xf761('0x2e')],qs[_0xf761('0x32')](_0x1266b8[_0xf761('0x2f')][_0xf761('0x32')]));_0x2a0cf3[_0xf761('0x33')]=_0x2a0cf3[_0xf761('0x33')][_0xf761('0x34')]?_0x2a0cf3[_0xf761('0x33')]:_0x54522f[_0xf761('0x2e')];if(!_0x1266b8[_0xf761('0x2f')][_0xf761('0x35')](_0xf761('0x36'))){_0x2a0cf3['limit']=qs['limit'](_0x1266b8['query']['limit']);_0x2a0cf3['offset']=qs[_0xf761('0x1b')](_0x1266b8['query'][_0xf761('0x1b')]);}_0x2a0cf3[_0xf761('0x37')]=qs[_0xf761('0x38')](_0x1266b8[_0xf761('0x2f')][_0xf761('0x38')]);_0x2a0cf3[_0xf761('0x39')]=qs[_0xf761('0x3a')](_[_0xf761('0x3b')](_0x1266b8[_0xf761('0x2f')],_0x54522f[_0xf761('0x3a')]),_0x3720eb);if(_0x1266b8[_0xf761('0x2f')][_0xf761('0x3c')]){_0x2a0cf3['where']=_[_0xf761('0x3d')](_0x2a0cf3[_0xf761('0x39')],{'$or':_[_0xf761('0x29')](_0x3720eb,function(_0x65d1fd){if(_0x65d1fd[_0xf761('0x2d')]!==_0xf761('0x3e')){var _0x4a6997={};_0x4a6997[_0x65d1fd['name']]={'$like':'%'+_0x1266b8[_0xf761('0x2f')][_0xf761('0x3c')]+'%'};return _0x4a6997;}})});}_0x2a0cf3=_['merge']({},_0x2a0cf3,_0x1266b8[_0xf761('0x3f')]);var _0x54179f={'where':_0x2a0cf3['where']};return db[_0xf761('0x2a')]['count'](_0x54179f)['then'](function(_0x3b282d){_0x5acaf2['count']=_0x3b282d;if(_0x1266b8['query']['includeAll']){_0x2a0cf3['include']=[{'all':!![]}];}return db['Template'][_0xf761('0x40')](_0x2a0cf3);})[_0xf761('0x21')](function(_0x49d971){_0x5acaf2[_0xf761('0x41')]=_0x49d971;return _0x5acaf2;})['then'](respondWithFilteredResult(_0x3a50d3,_0x2a0cf3))[_0xf761('0x42')](handleError(_0x3a50d3,null));};exports[_0xf761('0x43')]=function(_0x11b15e,_0x322461){var _0x3dbf67={'raw':!![],'where':{'id':_0x11b15e[_0xf761('0x44')]['id']}},_0x1dc34d={};_0x1dc34d['model']=_[_0xf761('0x30')](db[_0xf761('0x2a')][_0xf761('0x2b')]);_0x1dc34d['query']=_['keys'](_0x11b15e[_0xf761('0x2f')]);_0x1dc34d['filters']=_[_0xf761('0x31')](_0x1dc34d['model'],_0x1dc34d[_0xf761('0x2f')]);_0x3dbf67['attributes']=_[_0xf761('0x31')](_0x1dc34d[_0xf761('0x2e')],qs[_0xf761('0x32')](_0x11b15e['query'][_0xf761('0x32')]));_0x3dbf67['attributes']=_0x3dbf67['attributes']['length']?_0x3dbf67['attributes']:_0x1dc34d['model'];if(_0x11b15e[_0xf761('0x2f')]['includeAll']){_0x3dbf67['include']=[{'all':!![]}];}_0x3dbf67=_[_0xf761('0x3d')]({},_0x3dbf67,_0x11b15e[_0xf761('0x3f')]);return db[_0xf761('0x2a')][_0xf761('0x45')](_0x3dbf67)[_0xf761('0x21')](handleEntityNotFound(_0x322461,null))[_0xf761('0x21')](respondWithResult(_0x322461,null))[_0xf761('0x42')](handleError(_0x322461,null));};exports[_0xf761('0x46')]=function(_0xb3dfd4,_0x55d496){return db['Template'][_0xf761('0x46')](_0xb3dfd4['body'],{})[_0xf761('0x21')](function(_0x4bd887){var _0x87d466=_0xb3dfd4['user'][_0xf761('0x22')]({'plain':!![]});if(!_0x87d466)throw new Error(_0xf761('0x47'));if(_0x87d466[_0xf761('0x48')]===_0xf761('0x49')){var _0x9397c6=_0x4bd887[_0xf761('0x22')]({'plain':!![]});var _0x535bbc=_0xf761('0x23');return db[_0xf761('0x4a')][_0xf761('0x45')]({'where':{'name':_0x535bbc,'userProfileId':_0x87d466[_0xf761('0x4b')]},'raw':!![]})[_0xf761('0x21')](function(_0x56ef4f){if(_0x56ef4f&&_0x56ef4f[_0xf761('0x4c')]===0x0){return db[_0xf761('0x4d')][_0xf761('0x46')]({'name':_0x9397c6[_0xf761('0x26')],'resourceId':_0x9397c6['id'],'type':_0x56ef4f[_0xf761('0x26')],'sectionId':_0x56ef4f['id']},{})[_0xf761('0x21')](function(){return _0x4bd887;});}else{return _0x4bd887;}})[_0xf761('0x42')](function(_0x293bb5){logger[_0xf761('0x4e')](_0xf761('0x4f'),_0x293bb5);throw _0x293bb5;});}return _0x4bd887;})[_0xf761('0x21')](respondWithResult(_0x55d496,0xc9))[_0xf761('0x42')](handleError(_0x55d496,null));};exports[_0xf761('0x20')]=function(_0x1d14dd,_0x1e90da){if(_0x1d14dd[_0xf761('0x50')]['id']){delete _0x1d14dd[_0xf761('0x50')]['id'];}return db[_0xf761('0x2a')][_0xf761('0x45')]({'where':{'id':_0x1d14dd[_0xf761('0x44')]['id']}})[_0xf761('0x21')](handleEntityNotFound(_0x1e90da,null))['then'](saveUpdates(_0x1d14dd[_0xf761('0x50')],null))[_0xf761('0x21')](respondWithResult(_0x1e90da,null))[_0xf761('0x42')](handleError(_0x1e90da,null));};exports[_0xf761('0x24')]=function(_0x263970,_0x29ef1d){return db[_0xf761('0x2a')][_0xf761('0x45')]({'where':{'id':_0x263970[_0xf761('0x44')]['id']}})[_0xf761('0x21')](handleEntityNotFound(_0x29ef1d,null))[_0xf761('0x21')](removeEntity(_0x29ef1d,null))[_0xf761('0x42')](handleError(_0x29ef1d,null));}; \ No newline at end of file +var _0xd16e=['bluebird','mustache','path','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/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','map','Template','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x47b8ef,_0x557dd9){var _0x240c8d=function(_0x1ed5e9){while(--_0x1ed5e9){_0x47b8ef['push'](_0x47b8ef['shift']());}};_0x240c8d(++_0x557dd9);}(_0xd16e,0xf7));var _0xed16=function(_0x12304b,_0x3133ad){_0x12304b=_0x12304b-0x0;var _0x49d207=_0xd16e[_0x12304b];return _0x49d207;};'use strict';var emlformat=require(_0xed16('0x0'));var rimraf=require(_0xed16('0x1'));var zipdir=require(_0xed16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed16('0x3'));var moment=require(_0xed16('0x4'));var BPromise=require(_0xed16('0x5'));var Mustache=require(_0xed16('0x6'));var util=require('util');var path=require(_0xed16('0x7'));var sox=require('sox');var csv=require(_0xed16('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed16('0x9'));var _=require(_0xed16('0xa'));var squel=require(_0xed16('0xb'));var crypto=require(_0xed16('0xc'));var jsforce=require(_0xed16('0xd'));var deskjs=require(_0xed16('0xe'));var toCsv=require(_0xed16('0x8'));var querystring=require(_0xed16('0xf'));var Papa=require(_0xed16('0x10'));var Redis=require(_0xed16('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xed16('0x12'));var as=require(_0xed16('0x13'));var hardwareService=require(_0xed16('0x14'));var logger=require(_0xed16('0x15'))(_0xed16('0x16'));var utils=require(_0xed16('0x17'));var config=require(_0xed16('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xed16('0x19'))['db'];function respondWithStatusCode(_0x578960,_0x2da08d){_0x2da08d=_0x2da08d||0xcc;return function(_0x406e11){if(_0x406e11){return _0x578960[_0xed16('0x1a')](_0x2da08d);}return _0x578960['status'](_0x2da08d)[_0xed16('0x1b')]();};}function respondWithResult(_0x45e648,_0x2873a7){_0x2873a7=_0x2873a7||0xc8;return function(_0x142571){if(_0x142571){return _0x45e648['status'](_0x2873a7)[_0xed16('0x1c')](_0x142571);}};}function respondWithFilteredResult(_0x4faa40,_0x1289e8){return function(_0x16d8a7){if(_0x16d8a7){var _0x553356=typeof _0x1289e8[_0xed16('0x1d')]==='undefined'&&typeof _0x1289e8[_0xed16('0x1e')]===_0xed16('0x1f');var _0x16c257=_0x16d8a7[_0xed16('0x20')];var _0x1f0ca6=_0x553356?0x0:_0x1289e8[_0xed16('0x1d')];var _0xbacbb=_0x553356?_0x16d8a7[_0xed16('0x20')]:_0x1289e8['offset']+_0x1289e8[_0xed16('0x1e')];var _0x5dc0f4;if(_0xbacbb>=_0x16c257){_0xbacbb=_0x16c257;_0x5dc0f4=0xc8;}else{_0x5dc0f4=0xce;}_0x4faa40[_0xed16('0x21')](_0x5dc0f4);return _0x4faa40[_0xed16('0x22')](_0xed16('0x23'),_0x1f0ca6+'-'+_0xbacbb+'/'+_0x16c257)[_0xed16('0x1c')](_0x16d8a7);}return null;};}function patchUpdates(_0x5b502f){return function(_0x3300de){try{jsonpatch[_0xed16('0x24')](_0x3300de,_0x5b502f,!![]);}catch(_0xb0ef9a){return BPromise[_0xed16('0x25')](_0xb0ef9a);}return _0x3300de[_0xed16('0x26')]();};}function saveUpdates(_0x5c0ee9,_0x1665e8){return function(_0x1b0b84){if(_0x1b0b84){return _0x1b0b84[_0xed16('0x27')](_0x5c0ee9)[_0xed16('0x28')](function(_0x63800d){return _0x63800d;});}return null;};}function removeEntity(_0x586233,_0x14682a){return function(_0x5c3f60){if(_0x5c3f60){return _0x5c3f60[_0xed16('0x29')]()[_0xed16('0x28')](function(){var _0x3d1b3d=_0x5c3f60[_0xed16('0x2a')]({'plain':!![]});var _0x46f76f=_0xed16('0x2b');return db[_0xed16('0x2c')]['destroy']({'where':{'type':_0x46f76f,'resourceId':_0x3d1b3d['id']}})[_0xed16('0x28')](function(){return _0x5c3f60;});})[_0xed16('0x28')](function(){_0x586233['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51fe6d,_0x5f42a7){return function(_0x55ac3e){if(!_0x55ac3e){_0x51fe6d[_0xed16('0x1a')](0x194);}return _0x55ac3e;};}function handleError(_0x180411,_0x24ee53){_0x24ee53=_0x24ee53||0x1f4;return function(_0x37532b){logger['error'](_0x37532b[_0xed16('0x2d')]);if(_0x37532b[_0xed16('0x2e')]){delete _0x37532b[_0xed16('0x2e')];}_0x180411[_0xed16('0x21')](_0x24ee53)[_0xed16('0x2f')](_0x37532b);};}exports[_0xed16('0x30')]=function(_0x211a14,_0x41f1e6){var _0xded232={},_0xcef584={},_0x1b8557={'count':0x0,'rows':[]};var _0xb35594=_[_0xed16('0x31')](db[_0xed16('0x32')][_0xed16('0x33')],function(_0x6f993e){return{'name':_0x6f993e['fieldName'],'type':_0x6f993e[_0xed16('0x34')]['key']};});_0xcef584['model']=_[_0xed16('0x31')](_0xb35594,_0xed16('0x2e'));_0xcef584[_0xed16('0x35')]=_['keys'](_0x211a14['query']);_0xcef584[_0xed16('0x36')]=_[_0xed16('0x37')](_0xcef584['model'],_0xcef584['query']);_0xded232['attributes']=_[_0xed16('0x37')](_0xcef584[_0xed16('0x38')],qs[_0xed16('0x39')](_0x211a14[_0xed16('0x35')][_0xed16('0x39')]));_0xded232[_0xed16('0x3a')]=_0xded232[_0xed16('0x3a')][_0xed16('0x3b')]?_0xded232[_0xed16('0x3a')]:_0xcef584['model'];if(!_0x211a14['query'][_0xed16('0x3c')]('nolimit')){_0xded232[_0xed16('0x1e')]=qs[_0xed16('0x1e')](_0x211a14[_0xed16('0x35')][_0xed16('0x1e')]);_0xded232[_0xed16('0x1d')]=qs['offset'](_0x211a14[_0xed16('0x35')][_0xed16('0x1d')]);}_0xded232[_0xed16('0x3d')]=qs[_0xed16('0x3e')](_0x211a14['query'][_0xed16('0x3e')]);_0xded232[_0xed16('0x3f')]=qs['filters'](_['pick'](_0x211a14[_0xed16('0x35')],_0xcef584[_0xed16('0x36')]),_0xb35594);if(_0x211a14[_0xed16('0x35')][_0xed16('0x40')]){_0xded232[_0xed16('0x3f')]=_[_0xed16('0x41')](_0xded232[_0xed16('0x3f')],{'$or':_['map'](_0xb35594,function(_0x2cd6d6){if(_0x2cd6d6['type']!==_0xed16('0x42')){var _0x19acb0={};_0x19acb0[_0x2cd6d6[_0xed16('0x2e')]]={'$like':'%'+_0x211a14[_0xed16('0x35')][_0xed16('0x40')]+'%'};return _0x19acb0;}})});}_0xded232=_[_0xed16('0x41')]({},_0xded232,_0x211a14[_0xed16('0x43')]);var _0xae3a2a={'where':_0xded232[_0xed16('0x3f')]};return db[_0xed16('0x32')][_0xed16('0x20')](_0xae3a2a)[_0xed16('0x28')](function(_0x43d9b0){_0x1b8557[_0xed16('0x20')]=_0x43d9b0;if(_0x211a14[_0xed16('0x35')][_0xed16('0x44')]){_0xded232[_0xed16('0x45')]=[{'all':!![]}];}return db['Template'][_0xed16('0x46')](_0xded232);})[_0xed16('0x28')](function(_0x389a40){_0x1b8557['rows']=_0x389a40;return _0x1b8557;})['then'](respondWithFilteredResult(_0x41f1e6,_0xded232))[_0xed16('0x47')](handleError(_0x41f1e6,null));};exports[_0xed16('0x48')]=function(_0x5510fd,_0x5a3eb8){var _0x24906d={'raw':!![],'where':{'id':_0x5510fd[_0xed16('0x49')]['id']}},_0x2b48b5={};_0x2b48b5[_0xed16('0x38')]=_[_0xed16('0x4a')](db[_0xed16('0x32')]['rawAttributes']);_0x2b48b5[_0xed16('0x35')]=_['keys'](_0x5510fd[_0xed16('0x35')]);_0x2b48b5[_0xed16('0x36')]=_[_0xed16('0x37')](_0x2b48b5[_0xed16('0x38')],_0x2b48b5[_0xed16('0x35')]);_0x24906d['attributes']=_[_0xed16('0x37')](_0x2b48b5[_0xed16('0x38')],qs['fields'](_0x5510fd[_0xed16('0x35')][_0xed16('0x39')]));_0x24906d[_0xed16('0x3a')]=_0x24906d['attributes'][_0xed16('0x3b')]?_0x24906d[_0xed16('0x3a')]:_0x2b48b5['model'];if(_0x5510fd[_0xed16('0x35')][_0xed16('0x44')]){_0x24906d[_0xed16('0x45')]=[{'all':!![]}];}_0x24906d=_[_0xed16('0x41')]({},_0x24906d,_0x5510fd[_0xed16('0x43')]);return db[_0xed16('0x32')][_0xed16('0x4b')](_0x24906d)[_0xed16('0x28')](handleEntityNotFound(_0x5a3eb8,null))['then'](respondWithResult(_0x5a3eb8,null))[_0xed16('0x47')](handleError(_0x5a3eb8,null));};exports[_0xed16('0x4c')]=function(_0x5f3b4f,_0x1397f0){return db[_0xed16('0x32')][_0xed16('0x4c')](_0x5f3b4f[_0xed16('0x4d')],{})['then'](function(_0x1e39e0){var _0x4b68b9=_0x5f3b4f[_0xed16('0x4e')][_0xed16('0x2a')]({'plain':!![]});if(!_0x4b68b9)throw new Error(_0xed16('0x4f'));if(_0x4b68b9['role']==='user'){var _0x20d2f8=_0x1e39e0[_0xed16('0x2a')]({'plain':!![]});var _0x2014a4=_0xed16('0x2b');return db[_0xed16('0x50')][_0xed16('0x4b')]({'where':{'name':_0x2014a4,'userProfileId':_0x4b68b9[_0xed16('0x51')]},'raw':!![]})[_0xed16('0x28')](function(_0x4d73eb){if(_0x4d73eb&&_0x4d73eb[_0xed16('0x52')]===0x0){return db['UserProfileResource'][_0xed16('0x4c')]({'name':_0x20d2f8[_0xed16('0x2e')],'resourceId':_0x20d2f8['id'],'type':_0x4d73eb['name'],'sectionId':_0x4d73eb['id']},{})[_0xed16('0x28')](function(){return _0x1e39e0;});}else{return _0x1e39e0;}})[_0xed16('0x47')](function(_0x340cf8){logger['error'](_0xed16('0x53'),_0x340cf8);throw _0x340cf8;});}return _0x1e39e0;})[_0xed16('0x28')](respondWithResult(_0x1397f0,0xc9))['catch'](handleError(_0x1397f0,null));};exports[_0xed16('0x27')]=function(_0x509244,_0x2d0e21){if(_0x509244['body']['id']){delete _0x509244[_0xed16('0x4d')]['id'];}return db[_0xed16('0x32')][_0xed16('0x4b')]({'where':{'id':_0x509244['params']['id']}})[_0xed16('0x28')](handleEntityNotFound(_0x2d0e21,null))[_0xed16('0x28')](saveUpdates(_0x509244[_0xed16('0x4d')],null))['then'](respondWithResult(_0x2d0e21,null))[_0xed16('0x47')](handleError(_0x2d0e21,null));};exports[_0xed16('0x29')]=function(_0x538772,_0x717a2a){return db[_0xed16('0x32')][_0xed16('0x4b')]({'where':{'id':_0x538772[_0xed16('0x49')]['id']}})[_0xed16('0x28')](handleEntityNotFound(_0x717a2a,null))[_0xed16('0x28')](removeEntity(_0x717a2a,null))['catch'](handleError(_0x717a2a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e21b496..4d29a78 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 _0x137b=['../../config/logger','api','moment','request-promise','path','rimraf','define','Template','lodash','util'];(function(_0x5080ff,_0x1214a1){var _0x219ae5=function(_0x4c357c){while(--_0x4c357c){_0x5080ff['push'](_0x5080ff['shift']());}};_0x219ae5(++_0x1214a1);}(_0x137b,0x116));var _0xb137=function(_0x4753b7,_0x2660d1){_0x4753b7=_0x4753b7-0x0;var _0x3e6fa9=_0x137b[_0x4753b7];return _0x3e6fa9;};'use strict';var _=require(_0xb137('0x0'));var util=require(_0xb137('0x1'));var logger=require(_0xb137('0x2'))(_0xb137('0x3'));var moment=require(_0xb137('0x4'));var BPromise=require('bluebird');var rp=require(_0xb137('0x5'));var fs=require('fs');var path=require(_0xb137('0x6'));var rimraf=require(_0xb137('0x7'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x28b18c,_0x570149){return _0x28b18c[_0xb137('0x8')](_0xb137('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x889a=['rimraf','../../config/environment','exports','define','Template','lodash','util','api','moment','bluebird'];(function(_0x3afee9,_0x59b038){var _0x15951d=function(_0x255df7){while(--_0x255df7){_0x3afee9['push'](_0x3afee9['shift']());}};_0x15951d(++_0x59b038);}(_0x889a,0x127));var _0xa889=function(_0xf0e2ef,_0x4ca0ff){_0xf0e2ef=_0xf0e2ef-0x0;var _0x59491d=_0x889a[_0xf0e2ef];return _0x59491d;};'use strict';var _=require(_0xa889('0x0'));var util=require(_0xa889('0x1'));var logger=require('../../config/logger')(_0xa889('0x2'));var moment=require(_0xa889('0x3'));var BPromise=require(_0xa889('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa889('0x5'));var config=require(_0xa889('0x6'));var attributes=require('./template.attributes');module[_0xa889('0x7')]=function(_0x1066e9,_0xd90d2){return _0x1066e9[_0xa889('0x8')](_0xa889('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 43f25f0..b1ba47b 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 _0x0ba7=['Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x0ba7,0xdb));var _0x70ba=function(_0x27e7f0,_0x1a265c){_0x27e7f0=_0x27e7f0-0x0;var _0x14f7cb=_0x0ba7[_0x27e7f0];return _0x14f7cb;};'use strict';var _=require(_0x70ba('0x0'));var util=require(_0x70ba('0x1'));var moment=require(_0x70ba('0x2'));var BPromise=require(_0x70ba('0x3'));var rs=require(_0x70ba('0x4'));var fs=require('fs');var Redis=require(_0x70ba('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require('../../config/environment');var jayson=require(_0x70ba('0x8'));var client=jayson[_0x70ba('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dc569,_0x4a1c5a,_0x49dad8){return new BPromise(function(_0x140ba8,_0x8d78eb){return client[_0x70ba('0xa')](_0x2dc569,_0x49dad8)[_0x70ba('0xb')](function(_0x352969){logger['info'](_0x70ba('0xc'),_0x4a1c5a,_0x70ba('0xd'));logger[_0x70ba('0xe')](_0x70ba('0xf'),_0x4a1c5a,_0x70ba('0xd'),JSON[_0x70ba('0x10')](_0x352969));if(_0x352969[_0x70ba('0x11')]){if(_0x352969[_0x70ba('0x11')][_0x70ba('0x12')]===0x1f4){logger[_0x70ba('0x11')]('Template,\x20%s,\x20%s',_0x4a1c5a,_0x352969['error'][_0x70ba('0x13')]);return _0x8d78eb(_0x352969[_0x70ba('0x11')][_0x70ba('0x13')]);}logger[_0x70ba('0x11')]('Template,\x20%s,\x20%s',_0x4a1c5a,_0x352969[_0x70ba('0x11')][_0x70ba('0x13')]);return _0x140ba8(_0x352969[_0x70ba('0x11')]['message']);}else{logger[_0x70ba('0x14')](_0x70ba('0xc'),_0x4a1c5a,_0x70ba('0xd'));_0x140ba8(_0x352969[_0x70ba('0x15')][_0x70ba('0x13')]);}})['catch'](function(_0xdfb59f){logger['error']('Template,\x20%s,\x20%s',_0x4a1c5a,_0xdfb59f);_0x8d78eb(_0xdfb59f);});});}exports[_0x70ba('0x16')]=function(_0x125931){var _0x4e161f=this;return new Promise(function(_0x274ab3,_0x31fc61){return db[_0x70ba('0x17')][_0x70ba('0x18')]({'raw':_0x125931[_0x70ba('0x19')]?_0x125931[_0x70ba('0x19')][_0x70ba('0x1a')]===undefined?!![]:![]:!![],'where':_0x125931[_0x70ba('0x19')]?_0x125931[_0x70ba('0x19')]['where']||null:null,'attributes':_0x125931['options']?_0x125931[_0x70ba('0x19')][_0x70ba('0x1b')]||null:null,'limit':_0x125931[_0x70ba('0x19')]?_0x125931['options'][_0x70ba('0x1c')]||null:null,'include':_0x125931[_0x70ba('0x19')]?_0x125931[_0x70ba('0x19')][_0x70ba('0x1d')]?_[_0x70ba('0x1e')](_0x125931[_0x70ba('0x19')][_0x70ba('0x1d')],function(_0x478f1a){return{'model':db[_0x478f1a['model']],'as':_0x478f1a['as'],'attributes':_0x478f1a[_0x70ba('0x1b')],'include':_0x478f1a[_0x70ba('0x1d')]?_['map'](_0x478f1a[_0x70ba('0x1d')],function(_0x4fc557){return{'model':db[_0x4fc557[_0x70ba('0x1f')]],'as':_0x4fc557['as'],'attributes':_0x4fc557[_0x70ba('0x1b')],'include':_0x4fc557['include']?_[_0x70ba('0x1e')](_0x4fc557[_0x70ba('0x1d')],function(_0x38370a){return{'model':db[_0x38370a[_0x70ba('0x1f')]],'as':_0x38370a['as'],'attributes':_0x38370a['attributes']};}):[]};}):[]};}):[]:[]})[_0x70ba('0xb')](function(_0x338703){logger[_0x70ba('0x14')](_0x70ba('0x16'),_0x125931);logger[_0x70ba('0xe')](_0x70ba('0x16'),_0x125931,JSON[_0x70ba('0x10')](_0x338703));_0x274ab3(_0x338703);})[_0x70ba('0x20')](function(_0xe3dbba){logger[_0x70ba('0x11')](_0x70ba('0x16'),_0xe3dbba[_0x70ba('0x13')],_0x125931);_0x31fc61(_0x4e161f['error'](0x1f4,_0xe3dbba['message']));});});}; \ No newline at end of file +var _0xfc47=['code','message','GetTemplate','findAll','options','where','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xfc47,0x1cb));var _0x7fc4=function(_0x117f85,_0x5afa65){_0x117f85=_0x117f85-0x0;var _0x1c61a7=_0xfc47[_0x117f85];return _0x1c61a7;};'use strict';var _=require(_0x7fc4('0x0'));var util=require(_0x7fc4('0x1'));var moment=require(_0x7fc4('0x2'));var BPromise=require(_0x7fc4('0x3'));var rs=require(_0x7fc4('0x4'));var fs=require('fs');var Redis=require(_0x7fc4('0x5'));var db=require(_0x7fc4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fc4('0x7'))(_0x7fc4('0x8'));var config=require(_0x7fc4('0x9'));var jayson=require(_0x7fc4('0xa'));var client=jayson[_0x7fc4('0xb')][_0x7fc4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31782e,_0x5ba041,_0x5d772e){return new BPromise(function(_0x46d0ca,_0x154922){return client[_0x7fc4('0xd')](_0x31782e,_0x5d772e)[_0x7fc4('0xe')](function(_0x5a26de){logger[_0x7fc4('0xf')](_0x7fc4('0x10'),_0x5ba041,'request\x20sent');logger[_0x7fc4('0x11')]('Template,\x20%s,\x20%s,\x20%s',_0x5ba041,_0x7fc4('0x12'),JSON[_0x7fc4('0x13')](_0x5a26de));if(_0x5a26de[_0x7fc4('0x14')]){if(_0x5a26de[_0x7fc4('0x14')][_0x7fc4('0x15')]===0x1f4){logger[_0x7fc4('0x14')](_0x7fc4('0x10'),_0x5ba041,_0x5a26de[_0x7fc4('0x14')][_0x7fc4('0x16')]);return _0x154922(_0x5a26de[_0x7fc4('0x14')][_0x7fc4('0x16')]);}logger[_0x7fc4('0x14')](_0x7fc4('0x10'),_0x5ba041,_0x5a26de['error'][_0x7fc4('0x16')]);return _0x46d0ca(_0x5a26de[_0x7fc4('0x14')][_0x7fc4('0x16')]);}else{logger[_0x7fc4('0xf')](_0x7fc4('0x10'),_0x5ba041,'request\x20sent');_0x46d0ca(_0x5a26de['result'][_0x7fc4('0x16')]);}})['catch'](function(_0x4cbe7f){logger[_0x7fc4('0x14')](_0x7fc4('0x10'),_0x5ba041,_0x4cbe7f);_0x154922(_0x4cbe7f);});});}exports[_0x7fc4('0x17')]=function(_0x460e46){var _0x447a9f=this;return new Promise(function(_0x13ce13,_0x3cf523){return db['Template'][_0x7fc4('0x18')]({'raw':_0x460e46[_0x7fc4('0x19')]?_0x460e46[_0x7fc4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x460e46['options']?_0x460e46['options'][_0x7fc4('0x1a')]||null:null,'attributes':_0x460e46[_0x7fc4('0x19')]?_0x460e46[_0x7fc4('0x19')][_0x7fc4('0x1b')]||null:null,'limit':_0x460e46[_0x7fc4('0x19')]?_0x460e46[_0x7fc4('0x19')]['limit']||null:null,'include':_0x460e46['options']?_0x460e46[_0x7fc4('0x19')][_0x7fc4('0x1c')]?_['map'](_0x460e46[_0x7fc4('0x19')][_0x7fc4('0x1c')],function(_0x4e9ea3){return{'model':db[_0x4e9ea3[_0x7fc4('0x1d')]],'as':_0x4e9ea3['as'],'attributes':_0x4e9ea3[_0x7fc4('0x1b')],'include':_0x4e9ea3[_0x7fc4('0x1c')]?_[_0x7fc4('0x1e')](_0x4e9ea3[_0x7fc4('0x1c')],function(_0xcc3e37){return{'model':db[_0xcc3e37[_0x7fc4('0x1d')]],'as':_0xcc3e37['as'],'attributes':_0xcc3e37[_0x7fc4('0x1b')],'include':_0xcc3e37[_0x7fc4('0x1c')]?_[_0x7fc4('0x1e')](_0xcc3e37[_0x7fc4('0x1c')],function(_0x23d043){return{'model':db[_0x23d043[_0x7fc4('0x1d')]],'as':_0x23d043['as'],'attributes':_0x23d043[_0x7fc4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7fc4('0xe')](function(_0x235789){logger[_0x7fc4('0xf')](_0x7fc4('0x17'),_0x460e46);logger[_0x7fc4('0x11')](_0x7fc4('0x17'),_0x460e46,JSON[_0x7fc4('0x13')](_0x235789));_0x13ce13(_0x235789);})[_0x7fc4('0x1f')](function(_0x3dce9a){logger[_0x7fc4('0x14')](_0x7fc4('0x17'),_0x3dce9a[_0x7fc4('0x16')],_0x460e46);_0x3cf523(_0x447a9f[_0x7fc4('0x14')](0x1f4,_0x3dce9a[_0x7fc4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 302754c..8ab6312 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 _0x760b=['post','/:id/actions','addAction','put','delete','/:id','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','create'];(function(_0x412886,_0x464cc3){var _0x1989cf=function(_0x415832){while(--_0x415832){_0x412886['push'](_0x412886['shift']());}};_0x1989cf(++_0x464cc3);}(_0x760b,0x97));var _0xb760=function(_0x34aaca,_0x4b0afe){_0x34aaca=_0x34aaca-0x0;var _0x353dae=_0x760b[_0x34aaca];return _0x353dae;};'use strict';var multer=require(_0xb760('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb760('0x1')]();var fs_extra=require(_0xb760('0x2'));var auth=require(_0xb760('0x3'));var interaction=require(_0xb760('0x4'));var config=require(_0xb760('0x5'));var controller=require(_0xb760('0x6'));router[_0xb760('0x7')]('/',auth[_0xb760('0x8')](),controller[_0xb760('0x9')]);router[_0xb760('0x7')]('/:id',auth[_0xb760('0x8')](),controller[_0xb760('0xa')]);router['get'](_0xb760('0xb'),auth[_0xb760('0x8')](),controller[_0xb760('0xc')]);router['get'](_0xb760('0xd'),auth[_0xb760('0x8')](),controller[_0xb760('0xe')]);router[_0xb760('0x7')]('/:id/actions',auth['isAuthenticated'](),controller[_0xb760('0xf')]);router['post']('/',auth[_0xb760('0x8')](),controller[_0xb760('0x10')]);router[_0xb760('0x11')](_0xb760('0xb'),auth[_0xb760('0x8')](),controller['addAllCondition']);router[_0xb760('0x11')](_0xb760('0xd'),auth[_0xb760('0x8')](),controller['addAnyCondition']);router[_0xb760('0x11')](_0xb760('0x12'),auth[_0xb760('0x8')](),controller[_0xb760('0x13')]);router[_0xb760('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb760('0x15')](_0xb760('0x16'),auth[_0xb760('0x8')](),controller['destroy']);module[_0xb760('0x17')]=router; \ No newline at end of file +var _0x32b6=['/:id/actions','getActions','post','create','/:id/any_conditions','addAction','put','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','getAnyConditions'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x32b6,0x1d1));var _0x632b=function(_0x9a8bb6,_0x1f21a7){_0x9a8bb6=_0x9a8bb6-0x0;var _0x3838b3=_0x32b6[_0x9a8bb6];return _0x3838b3;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x632b('0x4'));var interaction=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var controller=require(_0x632b('0x7'));router[_0x632b('0x8')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0xa')]);router[_0x632b('0x8')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['show']);router[_0x632b('0x8')](_0x632b('0xc'),auth[_0x632b('0x9')](),controller[_0x632b('0xd')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x632b('0xe')]);router['get'](_0x632b('0xf'),auth[_0x632b('0x9')](),controller[_0x632b('0x10')]);router[_0x632b('0x11')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0x12')]);router[_0x632b('0x11')](_0x632b('0xc'),auth[_0x632b('0x9')](),controller['addAllCondition']);router[_0x632b('0x11')](_0x632b('0x13'),auth[_0x632b('0x9')](),controller['addAnyCondition']);router[_0x632b('0x11')](_0x632b('0xf'),auth[_0x632b('0x9')](),controller[_0x632b('0x14')]);router[_0x632b('0x15')](_0x632b('0xb'),auth['isAuthenticated'](),controller[_0x632b('0x16')]);router['delete']('/:id',auth[_0x632b('0x9')](),controller['destroy']);module[_0x632b('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 7530423..e5a6092 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 _0xb682=['BOOLEAN','exports','STRING'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xb682,0x79));var _0x2b68=function(_0x5c9499,_0x221b1){_0x5c9499=_0x5c9499-0x0;var _0x1370d4=_0xb682[_0x5c9499];return _0x1370d4;};'use strict';var Sequelize=require('sequelize');module[_0x2b68('0x0')]={'name':{'type':Sequelize[_0x2b68('0x1')]},'channel':{'type':Sequelize[_0x2b68('0x1')]},'description':{'type':Sequelize[_0x2b68('0x1')]},'status':{'type':Sequelize[_0x2b68('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc109=['exports','STRING','BOOLEAN'];(function(_0x2323c3,_0x221062){var _0x2d51bb=function(_0x1a337a){while(--_0x1a337a){_0x2323c3['push'](_0x2323c3['shift']());}};_0x2d51bb(++_0x221062);}(_0xc109,0x1dd));var _0x9c10=function(_0x21cbcd,_0x4ba851){_0x21cbcd=_0x21cbcd-0x0;var _0x59a138=_0xc109[_0x21cbcd];return _0x59a138;};'use strict';var Sequelize=require('sequelize');module[_0x9c10('0x0')]={'name':{'type':Sequelize[_0x9c10('0x1')]},'channel':{'type':Sequelize[_0x9c10('0x1')]},'description':{'type':Sequelize[_0x9c10('0x1')]},'status':{'type':Sequelize[_0x9c10('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4f5080c..2e7810a 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 _0xc09d=['options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','pick','hasOwnProperty','getAnyConditions','nolimit','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0xc09d,0x7d));var _0xdc09=function(_0x34b442,_0x251822){_0x34b442=_0x34b442-0x0;var _0xda3430=_0xc09d[_0x34b442];return _0xda3430;};'use strict';var emlformat=require(_0xdc09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc09('0x1'));var jsonpatch=require(_0xdc09('0x2'));var rp=require(_0xdc09('0x3'));var moment=require(_0xdc09('0x4'));var BPromise=require(_0xdc09('0x5'));var Mustache=require(_0xdc09('0x6'));var util=require(_0xdc09('0x7'));var path=require(_0xdc09('0x8'));var sox=require(_0xdc09('0x9'));var csv=require(_0xdc09('0xa'));var ejs=require(_0xdc09('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc09('0xc'));var squel=require('squel');var crypto=require(_0xdc09('0xd'));var jsforce=require(_0xdc09('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc09('0xf'));var Papa=require(_0xdc09('0x10'));var Redis=require('ioredis');var authService=require(_0xdc09('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdc09('0x12'));var hardwareService=require(_0xdc09('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdc09('0x14'));var licenseUtil=require(_0xdc09('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x513ae4,_0x106357){_0x106357=_0x106357||0xcc;return function(_0x1a1db5){if(_0x1a1db5){return _0x513ae4[_0xdc09('0x16')](_0x106357);}return _0x513ae4[_0xdc09('0x17')](_0x106357)[_0xdc09('0x18')]();};}function respondWithResult(_0x23a41a,_0x38f33b){_0x38f33b=_0x38f33b||0xc8;return function(_0x1acf5b){if(_0x1acf5b){return _0x23a41a[_0xdc09('0x17')](_0x38f33b)[_0xdc09('0x19')](_0x1acf5b);}};}function respondWithFilteredResult(_0x5ca857,_0x44406d){return function(_0x3f40e6){if(_0x3f40e6){var _0x396003=typeof _0x44406d[_0xdc09('0x1a')]===_0xdc09('0x1b')&&typeof _0x44406d[_0xdc09('0x1c')]===_0xdc09('0x1b');var _0x3e995e=_0x3f40e6[_0xdc09('0x1d')];var _0x18ba30=_0x396003?0x0:_0x44406d[_0xdc09('0x1a')];var _0x1c8ac8=_0x396003?_0x3f40e6[_0xdc09('0x1d')]:_0x44406d[_0xdc09('0x1a')]+_0x44406d[_0xdc09('0x1c')];var _0x1ea767;if(_0x1c8ac8>=_0x3e995e){_0x1c8ac8=_0x3e995e;_0x1ea767=0xc8;}else{_0x1ea767=0xce;}_0x5ca857[_0xdc09('0x17')](_0x1ea767);return _0x5ca857[_0xdc09('0x1e')](_0xdc09('0x1f'),_0x18ba30+'-'+_0x1c8ac8+'/'+_0x3e995e)[_0xdc09('0x19')](_0x3f40e6);}return null;};}function patchUpdates(_0x1ccf3e){return function(_0x5876c1){try{jsonpatch[_0xdc09('0x20')](_0x5876c1,_0x1ccf3e,!![]);}catch(_0x5a28c7){return BPromise[_0xdc09('0x21')](_0x5a28c7);}return _0x5876c1['save']();};}function saveUpdates(_0x5b8a56,_0x280c6a){return function(_0x5f0840){if(_0x5f0840){return _0x5f0840[_0xdc09('0x22')](_0x5b8a56)[_0xdc09('0x23')](function(_0x16e329){return _0x16e329;});}return null;};}function removeEntity(_0x2455f8,_0x4fad4b){return function(_0x3911ed){if(_0x3911ed){return _0x3911ed['destroy']()[_0xdc09('0x23')](function(){var _0x538ec1=_0x3911ed[_0xdc09('0x24')]({'plain':!![]});var _0x5014c6='Triggers';return db[_0xdc09('0x25')][_0xdc09('0x26')]({'where':{'type':_0x5014c6,'resourceId':_0x538ec1['id']}})[_0xdc09('0x23')](function(){return _0x3911ed;});})[_0xdc09('0x23')](function(){_0x2455f8[_0xdc09('0x17')](0xcc)[_0xdc09('0x18')]();});}};}function handleEntityNotFound(_0x1a8b6e,_0x5f3bbf){return function(_0x134095){if(!_0x134095){_0x1a8b6e[_0xdc09('0x16')](0x194);}return _0x134095;};}function handleError(_0x451118,_0x36ea73){_0x36ea73=_0x36ea73||0x1f4;return function(_0x3c2773){logger[_0xdc09('0x27')](_0x3c2773[_0xdc09('0x28')]);if(_0x3c2773[_0xdc09('0x29')]){delete _0x3c2773['name'];}_0x451118[_0xdc09('0x17')](_0x36ea73)[_0xdc09('0x2a')](_0x3c2773);};}exports[_0xdc09('0x2b')]=function(_0x3330c1,_0xaacd3e){var _0x3d0bca={},_0x335c39={},_0x5bd9c3={'count':0x0,'rows':[]};var _0x5d0abe=_[_0xdc09('0x2c')](db[_0xdc09('0x2d')]['rawAttributes'],function(_0x25582b){return{'name':_0x25582b[_0xdc09('0x2e')],'type':_0x25582b[_0xdc09('0x2f')][_0xdc09('0x30')]};});_0x335c39[_0xdc09('0x31')]=_['map'](_0x5d0abe,'name');_0x335c39[_0xdc09('0x32')]=_[_0xdc09('0x33')](_0x3330c1['query']);_0x335c39['filters']=_[_0xdc09('0x34')](_0x335c39['model'],_0x335c39[_0xdc09('0x32')]);_0x3d0bca['attributes']=_['intersection'](_0x335c39[_0xdc09('0x31')],qs['fields'](_0x3330c1['query'][_0xdc09('0x35')]));_0x3d0bca[_0xdc09('0x36')]=_0x3d0bca[_0xdc09('0x36')][_0xdc09('0x37')]?_0x3d0bca[_0xdc09('0x36')]:_0x335c39['model'];if(!_0x3330c1[_0xdc09('0x32')]['hasOwnProperty']('nolimit')){_0x3d0bca[_0xdc09('0x1c')]=qs[_0xdc09('0x1c')](_0x3330c1['query']['limit']);_0x3d0bca[_0xdc09('0x1a')]=qs['offset'](_0x3330c1[_0xdc09('0x32')][_0xdc09('0x1a')]);}_0x3d0bca[_0xdc09('0x38')]=qs['sort'](_0x3330c1[_0xdc09('0x32')][_0xdc09('0x39')]);_0x3d0bca[_0xdc09('0x3a')]=qs[_0xdc09('0x3b')](_['pick'](_0x3330c1[_0xdc09('0x32')],_0x335c39[_0xdc09('0x3b')]),_0x5d0abe);if(_0x3330c1['query'][_0xdc09('0x3c')]){_0x3d0bca[_0xdc09('0x3a')]=_[_0xdc09('0x3d')](_0x3d0bca[_0xdc09('0x3a')],{'$or':_[_0xdc09('0x2c')](_0x5d0abe,function(_0x46d7af){if(_0x46d7af[_0xdc09('0x2f')]!==_0xdc09('0x3e')){var _0x3ea1da={};_0x3ea1da[_0x46d7af[_0xdc09('0x29')]]={'$like':'%'+_0x3330c1[_0xdc09('0x32')][_0xdc09('0x3c')]+'%'};return _0x3ea1da;}})});}_0x3d0bca=_[_0xdc09('0x3d')]({},_0x3d0bca,_0x3330c1[_0xdc09('0x3f')]);var _0x1e0e64={'where':_0x3d0bca['where']};return db[_0xdc09('0x2d')][_0xdc09('0x1d')](_0x1e0e64)[_0xdc09('0x23')](function(_0x6f1201){_0x5bd9c3[_0xdc09('0x1d')]=_0x6f1201;if(_0x3330c1['query'][_0xdc09('0x40')]){_0x3d0bca[_0xdc09('0x41')]=[{'all':!![]}];}return db['Trigger'][_0xdc09('0x42')](_0x3d0bca);})['then'](function(_0x2ffd80){_0x5bd9c3[_0xdc09('0x43')]=_0x2ffd80;return _0x5bd9c3;})[_0xdc09('0x23')](respondWithFilteredResult(_0xaacd3e,_0x3d0bca))['catch'](handleError(_0xaacd3e,null));};exports[_0xdc09('0x44')]=function(_0x1d425e,_0x4205d8){var _0x245e66={'raw':![],'where':{'id':_0x1d425e[_0xdc09('0x45')]['id']}},_0x41d439={};_0x41d439[_0xdc09('0x31')]=_[_0xdc09('0x33')](db[_0xdc09('0x2d')][_0xdc09('0x46')]);_0x41d439[_0xdc09('0x32')]=_[_0xdc09('0x33')](_0x1d425e['query']);_0x41d439[_0xdc09('0x3b')]=_[_0xdc09('0x34')](_0x41d439[_0xdc09('0x31')],_0x41d439[_0xdc09('0x32')]);_0x245e66[_0xdc09('0x36')]=_[_0xdc09('0x34')](_0x41d439[_0xdc09('0x31')],qs['fields'](_0x1d425e[_0xdc09('0x32')][_0xdc09('0x35')]));_0x245e66['attributes']=_0x245e66[_0xdc09('0x36')][_0xdc09('0x37')]?_0x245e66[_0xdc09('0x36')]:_0x41d439[_0xdc09('0x31')];if(_0x1d425e['query'][_0xdc09('0x40')]){_0x245e66[_0xdc09('0x41')]=[{'all':!![]}];}_0x245e66=_['merge']({},_0x245e66,_0x1d425e['options']);return db[_0xdc09('0x2d')][_0xdc09('0x47')](_0x245e66)['then'](handleEntityNotFound(_0x4205d8,null))[_0xdc09('0x23')](respondWithResult(_0x4205d8,null))[_0xdc09('0x48')](handleError(_0x4205d8,null));};exports[_0xdc09('0x49')]=function(_0x1d9c45,_0x483d56){return db['Trigger'][_0xdc09('0x49')](_0x1d9c45[_0xdc09('0x4a')],{})[_0xdc09('0x23')](function(_0x3dfc3b){var _0x4e43f8=_0x1d9c45[_0xdc09('0x4b')]['get']({'plain':!![]});if(!_0x4e43f8)throw new Error(_0xdc09('0x4c'));if(_0x4e43f8[_0xdc09('0x4d')]==='user'){var _0x3518d9=_0x3dfc3b[_0xdc09('0x24')]({'plain':!![]});var _0x4a7bd8=_0xdc09('0x4e');return db[_0xdc09('0x4f')]['find']({'where':{'name':_0x4a7bd8,'userProfileId':_0x4e43f8[_0xdc09('0x50')]},'raw':!![]})[_0xdc09('0x23')](function(_0xdcfef1){if(_0xdcfef1&&_0xdcfef1['autoAssociation']===0x0){return db[_0xdc09('0x25')][_0xdc09('0x49')]({'name':_0x3518d9[_0xdc09('0x29')],'resourceId':_0x3518d9['id'],'type':_0xdcfef1[_0xdc09('0x29')],'sectionId':_0xdcfef1['id']},{})[_0xdc09('0x23')](function(){return _0x3dfc3b;});}else{return _0x3dfc3b;}})['catch'](function(_0x2f7d16){logger['error'](_0xdc09('0x51'),_0x2f7d16);throw _0x2f7d16;});}return _0x3dfc3b;})[_0xdc09('0x23')](respondWithResult(_0x483d56,0xc9))[_0xdc09('0x48')](handleError(_0x483d56,null));};exports[_0xdc09('0x22')]=function(_0x2109c1,_0x349144){if(_0x2109c1['body']['id']){delete _0x2109c1[_0xdc09('0x4a')]['id'];}return db[_0xdc09('0x2d')][_0xdc09('0x47')]({'where':{'id':_0x2109c1[_0xdc09('0x45')]['id']}})[_0xdc09('0x23')](handleEntityNotFound(_0x349144,null))['then'](saveUpdates(_0x2109c1[_0xdc09('0x4a')],null))[_0xdc09('0x23')](respondWithResult(_0x349144,null))[_0xdc09('0x48')](handleError(_0x349144,null));};exports[_0xdc09('0x26')]=function(_0x1d0a66,_0x15f38f){return db[_0xdc09('0x2d')][_0xdc09('0x47')]({'where':{'id':_0x1d0a66[_0xdc09('0x45')]['id']}})[_0xdc09('0x23')](handleEntityNotFound(_0x15f38f,null))[_0xdc09('0x23')](removeEntity(_0x15f38f,null))['catch'](handleError(_0x15f38f,null));};exports[_0xdc09('0x52')]=function(_0x5e8a53,_0x31bb21,_0x1d481a){if(_0x5e8a53[_0xdc09('0x4a')]['id']){delete _0x5e8a53['body']['id'];}return db[_0xdc09('0x2d')]['find']({'where':{'id':_0x5e8a53[_0xdc09('0x45')]['id']}})[_0xdc09('0x23')](handleEntityNotFound(_0x31bb21,null))[_0xdc09('0x23')](function(_0x2ae2ca){if(_0x2ae2ca){_0x5e8a53['body']['TriggerAllId']=_0x2ae2ca['id'];return db[_0xdc09('0x53')][_0xdc09('0x49')](_0x5e8a53['body']);}})[_0xdc09('0x23')](respondWithResult(_0x31bb21,null))['catch'](handleError(_0x31bb21,null));};exports[_0xdc09('0x54')]=function(_0x1121fb,_0x9f8b76,_0x1878da){if(_0x1121fb['body']['id']){delete _0x1121fb['body']['id'];}return db[_0xdc09('0x2d')][_0xdc09('0x47')]({'where':{'id':_0x1121fb['params']['id']}})[_0xdc09('0x23')](handleEntityNotFound(_0x9f8b76,null))['then'](function(_0x5017fe){if(_0x5017fe){_0x1121fb[_0xdc09('0x4a')][_0xdc09('0x55')]=_0x5017fe['id'];return db[_0xdc09('0x53')][_0xdc09('0x49')](_0x1121fb['body']);}})['then'](respondWithResult(_0x9f8b76,null))[_0xdc09('0x48')](handleError(_0x9f8b76,null));};exports['getAllConditions']=function(_0x51b685,_0x4d4e2b,_0x48057d){var _0x1638f5={};var _0x556e16={};var _0x53f5d8;var _0x249ad7;return db[_0xdc09('0x2d')][_0xdc09('0x56')]({'where':{'id':_0x51b685[_0xdc09('0x45')]['id']}})[_0xdc09('0x23')](handleEntityNotFound(_0x4d4e2b,null))[_0xdc09('0x23')](function(_0x1c3d3d){if(_0x1c3d3d){_0x53f5d8=_0x1c3d3d;_0x556e16[_0xdc09('0x31')]=_['keys'](db['Condition'][_0xdc09('0x46')]);_0x556e16['query']=_[_0xdc09('0x33')](_0x51b685[_0xdc09('0x32')]);_0x556e16[_0xdc09('0x3b')]=_[_0xdc09('0x34')](_0x556e16[_0xdc09('0x31')],_0x556e16[_0xdc09('0x32')]);_0x1638f5[_0xdc09('0x36')]=_[_0xdc09('0x34')](_0x556e16[_0xdc09('0x31')],qs[_0xdc09('0x35')](_0x51b685[_0xdc09('0x32')][_0xdc09('0x35')]));_0x1638f5[_0xdc09('0x36')]=_0x1638f5[_0xdc09('0x36')][_0xdc09('0x37')]?_0x1638f5[_0xdc09('0x36')]:_0x556e16[_0xdc09('0x31')];_0x1638f5[_0xdc09('0x38')]=qs[_0xdc09('0x39')](_0x51b685['query'][_0xdc09('0x39')]);_0x1638f5[_0xdc09('0x3a')]=qs['filters'](_[_0xdc09('0x57')](_0x51b685[_0xdc09('0x32')],_0x556e16['filters']));if(_0x51b685['query'][_0xdc09('0x3c')]){_0x1638f5['where']=_['merge'](_0x1638f5[_0xdc09('0x3a')],{'$or':_[_0xdc09('0x2c')](_0x1638f5[_0xdc09('0x36')],function(_0x138884){var _0x394130={};_0x394130[_0x138884]={'$like':'%'+_0x51b685['query'][_0xdc09('0x3c')]+'%'};return _0x394130;})});}_0x1638f5=_[_0xdc09('0x3d')]({},_0x1638f5,_0x51b685[_0xdc09('0x3f')]);return _0x53f5d8['getAllConditions'](_0x1638f5);}})['then'](function(_0xcaf3da){if(_0xcaf3da){_0x249ad7=_0xcaf3da[_0xdc09('0x37')];if(!_0x51b685['query'][_0xdc09('0x58')]('nolimit')){_0x1638f5[_0xdc09('0x1c')]=qs['limit'](_0x51b685[_0xdc09('0x32')][_0xdc09('0x1c')]);_0x1638f5['offset']=qs[_0xdc09('0x1a')](_0x51b685[_0xdc09('0x32')][_0xdc09('0x1a')]);}return _0x53f5d8['getAllConditions'](_0x1638f5);}})['then'](function(_0x1f8b74){if(_0x1f8b74){return _0x1f8b74?{'count':_0x249ad7,'rows':_0x1f8b74}:null;}})['then'](respondWithResult(_0x4d4e2b,null))[_0xdc09('0x48')](handleError(_0x4d4e2b,null));};exports['getAnyConditions']=function(_0x37f69f,_0x128fea,_0x2e54ff){var _0x18b860={};var _0x35152e={};var _0x22e3af;var _0x2f54dd;return db[_0xdc09('0x2d')]['findOne']({'where':{'id':_0x37f69f[_0xdc09('0x45')]['id']}})['then'](handleEntityNotFound(_0x128fea,null))[_0xdc09('0x23')](function(_0x2bef49){if(_0x2bef49){_0x22e3af=_0x2bef49;_0x35152e[_0xdc09('0x31')]=_['keys'](db[_0xdc09('0x53')][_0xdc09('0x46')]);_0x35152e[_0xdc09('0x32')]=_[_0xdc09('0x33')](_0x37f69f[_0xdc09('0x32')]);_0x35152e[_0xdc09('0x3b')]=_[_0xdc09('0x34')](_0x35152e[_0xdc09('0x31')],_0x35152e[_0xdc09('0x32')]);_0x18b860[_0xdc09('0x36')]=_[_0xdc09('0x34')](_0x35152e[_0xdc09('0x31')],qs[_0xdc09('0x35')](_0x37f69f[_0xdc09('0x32')][_0xdc09('0x35')]));_0x18b860['attributes']=_0x18b860[_0xdc09('0x36')][_0xdc09('0x37')]?_0x18b860[_0xdc09('0x36')]:_0x35152e[_0xdc09('0x31')];_0x18b860[_0xdc09('0x38')]=qs[_0xdc09('0x39')](_0x37f69f[_0xdc09('0x32')]['sort']);_0x18b860[_0xdc09('0x3a')]=qs[_0xdc09('0x3b')](_[_0xdc09('0x57')](_0x37f69f[_0xdc09('0x32')],_0x35152e[_0xdc09('0x3b')]));if(_0x37f69f['query']['filter']){_0x18b860['where']=_[_0xdc09('0x3d')](_0x18b860[_0xdc09('0x3a')],{'$or':_['map'](_0x18b860[_0xdc09('0x36')],function(_0x1f8b88){var _0x12b025={};_0x12b025[_0x1f8b88]={'$like':'%'+_0x37f69f[_0xdc09('0x32')][_0xdc09('0x3c')]+'%'};return _0x12b025;})});}_0x18b860=_[_0xdc09('0x3d')]({},_0x18b860,_0x37f69f[_0xdc09('0x3f')]);return _0x22e3af[_0xdc09('0x59')](_0x18b860);}})[_0xdc09('0x23')](function(_0x48a9a6){if(_0x48a9a6){_0x2f54dd=_0x48a9a6[_0xdc09('0x37')];if(!_0x37f69f['query'][_0xdc09('0x58')](_0xdc09('0x5a'))){_0x18b860[_0xdc09('0x1c')]=qs[_0xdc09('0x1c')](_0x37f69f['query'][_0xdc09('0x1c')]);_0x18b860[_0xdc09('0x1a')]=qs['offset'](_0x37f69f['query']['offset']);}return _0x22e3af[_0xdc09('0x59')](_0x18b860);}})[_0xdc09('0x23')](function(_0x3daf43){if(_0x3daf43){return _0x3daf43?{'count':_0x2f54dd,'rows':_0x3daf43}:null;}})[_0xdc09('0x23')](respondWithResult(_0x128fea,null))[_0xdc09('0x48')](handleError(_0x128fea,null));};exports['addAction']=function(_0x1594d7,_0x5784f0,_0x17236d){if(_0x1594d7[_0xdc09('0x4a')]['id']){delete _0x1594d7['body']['id'];}return db[_0xdc09('0x2d')][_0xdc09('0x47')]({'where':{'id':_0x1594d7['params']['id']}})[_0xdc09('0x23')](handleEntityNotFound(_0x5784f0,null))['then'](function(_0x55e001){if(_0x55e001){_0x1594d7[_0xdc09('0x4a')][_0xdc09('0x5b')]=_0x55e001['id'];return db[_0xdc09('0x5c')][_0xdc09('0x49')](_0x1594d7[_0xdc09('0x4a')]);}})[_0xdc09('0x23')](respondWithResult(_0x5784f0,null))['catch'](handleError(_0x5784f0,null));};exports['getActions']=function(_0x2ed153,_0x529b14,_0x2a203f){var _0x365624={};var _0x21e2a5={};var _0xf8410a;var _0x5458bc;return db[_0xdc09('0x2d')][_0xdc09('0x56')]({'where':{'id':_0x2ed153[_0xdc09('0x45')]['id']}})[_0xdc09('0x23')](handleEntityNotFound(_0x529b14,null))[_0xdc09('0x23')](function(_0x201401){if(_0x201401){_0xf8410a=_0x201401;_0x21e2a5[_0xdc09('0x31')]=_[_0xdc09('0x33')](db[_0xdc09('0x5c')][_0xdc09('0x46')]);_0x21e2a5['query']=_[_0xdc09('0x33')](_0x2ed153[_0xdc09('0x32')]);_0x21e2a5[_0xdc09('0x3b')]=_['intersection'](_0x21e2a5['model'],_0x21e2a5['query']);_0x365624[_0xdc09('0x36')]=_[_0xdc09('0x34')](_0x21e2a5[_0xdc09('0x31')],qs[_0xdc09('0x35')](_0x2ed153['query']['fields']));_0x365624['attributes']=_0x365624['attributes'][_0xdc09('0x37')]?_0x365624[_0xdc09('0x36')]:_0x21e2a5[_0xdc09('0x31')];_0x365624[_0xdc09('0x38')]=qs['sort'](_0x2ed153[_0xdc09('0x32')][_0xdc09('0x39')]);_0x365624[_0xdc09('0x3a')]=qs[_0xdc09('0x3b')](_[_0xdc09('0x57')](_0x2ed153[_0xdc09('0x32')],_0x21e2a5['filters']));if(_0x2ed153['query']['filter']){_0x365624['where']=_[_0xdc09('0x3d')](_0x365624['where'],{'$or':_[_0xdc09('0x2c')](_0x365624[_0xdc09('0x36')],function(_0x3b1b11){var _0x1f989f={};_0x1f989f[_0x3b1b11]={'$like':'%'+_0x2ed153[_0xdc09('0x32')][_0xdc09('0x3c')]+'%'};return _0x1f989f;})});}_0x365624=_[_0xdc09('0x3d')]({},_0x365624,_0x2ed153['options']);return _0xf8410a[_0xdc09('0x5d')](_0x365624);}})[_0xdc09('0x23')](function(_0x3402ba){if(_0x3402ba){_0x5458bc=_0x3402ba[_0xdc09('0x37')];if(!_0x2ed153[_0xdc09('0x32')][_0xdc09('0x58')](_0xdc09('0x5a'))){_0x365624[_0xdc09('0x1c')]=qs[_0xdc09('0x1c')](_0x2ed153[_0xdc09('0x32')][_0xdc09('0x1c')]);_0x365624[_0xdc09('0x1a')]=qs[_0xdc09('0x1a')](_0x2ed153['query']['offset']);}return _0xf8410a[_0xdc09('0x5d')](_0x365624);}})[_0xdc09('0x23')](function(_0xfc6dad){if(_0xfc6dad){return _0xfc6dad?{'count':_0x5458bc,'rows':_0xfc6dad}:null;}})[_0xdc09('0x23')](respondWithResult(_0x529b14,null))[_0xdc09('0x48')](handleError(_0x529b14,null));}; \ No newline at end of file +var _0x03ca=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','Content-Range','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','Trigger','count','includeAll','rows','catch','show','length','include','merge','find','create','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5b9dd7,_0x43a06e){var _0x49ec19=function(_0x45d4b7){while(--_0x45d4b7){_0x5b9dd7['push'](_0x5b9dd7['shift']());}};_0x49ec19(++_0x43a06e);}(_0x03ca,0xa7));var _0xa03c=function(_0x494908,_0x4a6a7b){_0x494908=_0x494908-0x0;var _0x1f5e38=_0x03ca[_0x494908];return _0x1f5e38;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa03c('0x0'));var jsonpatch=require(_0xa03c('0x1'));var rp=require(_0xa03c('0x2'));var moment=require('moment');var BPromise=require(_0xa03c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa03c('0x4'));var sox=require(_0xa03c('0x5'));var csv=require(_0xa03c('0x6'));var ejs=require(_0xa03c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa03c('0x8'));var squel=require(_0xa03c('0x9'));var crypto=require(_0xa03c('0xa'));var jsforce=require(_0xa03c('0xb'));var deskjs=require(_0xa03c('0xc'));var toCsv=require(_0xa03c('0x6'));var querystring=require(_0xa03c('0xd'));var Papa=require(_0xa03c('0xe'));var Redis=require(_0xa03c('0xf'));var authService=require(_0xa03c('0x10'));var qs=require(_0xa03c('0x11'));var as=require(_0xa03c('0x12'));var hardwareService=require(_0xa03c('0x13'));var logger=require(_0xa03c('0x14'))(_0xa03c('0x15'));var utils=require(_0xa03c('0x16'));var config=require(_0xa03c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa03c('0x18'))['db'];function respondWithStatusCode(_0x3c9f77,_0x3a0dc4){_0x3a0dc4=_0x3a0dc4||0xcc;return function(_0x3a0f06){if(_0x3a0f06){return _0x3c9f77[_0xa03c('0x19')](_0x3a0dc4);}return _0x3c9f77['status'](_0x3a0dc4)[_0xa03c('0x1a')]();};}function respondWithResult(_0x21a2bb,_0x31587f){_0x31587f=_0x31587f||0xc8;return function(_0x41031c){if(_0x41031c){return _0x21a2bb['status'](_0x31587f)[_0xa03c('0x1b')](_0x41031c);}};}function respondWithFilteredResult(_0xe124ff,_0x277c58){return function(_0x2a835e){if(_0x2a835e){var _0x32c9ba=typeof _0x277c58[_0xa03c('0x1c')]===_0xa03c('0x1d')&&typeof _0x277c58[_0xa03c('0x1e')]===_0xa03c('0x1d');var _0xbc8042=_0x2a835e['count'];var _0xbc922f=_0x32c9ba?0x0:_0x277c58[_0xa03c('0x1c')];var _0x34b09c=_0x32c9ba?_0x2a835e['count']:_0x277c58[_0xa03c('0x1c')]+_0x277c58[_0xa03c('0x1e')];var _0x4438da;if(_0x34b09c>=_0xbc8042){_0x34b09c=_0xbc8042;_0x4438da=0xc8;}else{_0x4438da=0xce;}_0xe124ff[_0xa03c('0x1f')](_0x4438da);return _0xe124ff['set'](_0xa03c('0x20'),_0xbc922f+'-'+_0x34b09c+'/'+_0xbc8042)[_0xa03c('0x1b')](_0x2a835e);}return null;};}function patchUpdates(_0x141ed1){return function(_0x25d975){try{jsonpatch['apply'](_0x25d975,_0x141ed1,!![]);}catch(_0x25a5d6){return BPromise[_0xa03c('0x21')](_0x25a5d6);}return _0x25d975[_0xa03c('0x22')]();};}function saveUpdates(_0x1a6a81,_0x59fbd5){return function(_0x3e9f62){if(_0x3e9f62){return _0x3e9f62['update'](_0x1a6a81)[_0xa03c('0x23')](function(_0x24cce3){return _0x24cce3;});}return null;};}function removeEntity(_0x103fe3,_0x3904f5){return function(_0x4d6759){if(_0x4d6759){return _0x4d6759[_0xa03c('0x24')]()[_0xa03c('0x23')](function(){var _0x3e1e72=_0x4d6759[_0xa03c('0x25')]({'plain':!![]});var _0x4a522e=_0xa03c('0x26');return db[_0xa03c('0x27')][_0xa03c('0x24')]({'where':{'type':_0x4a522e,'resourceId':_0x3e1e72['id']}})[_0xa03c('0x23')](function(){return _0x4d6759;});})[_0xa03c('0x23')](function(){_0x103fe3[_0xa03c('0x1f')](0xcc)[_0xa03c('0x1a')]();});}};}function handleEntityNotFound(_0x54d0b0,_0x5d9889){return function(_0x25a9e0){if(!_0x25a9e0){_0x54d0b0['sendStatus'](0x194);}return _0x25a9e0;};}function handleError(_0x53db41,_0x584e23){_0x584e23=_0x584e23||0x1f4;return function(_0x39b4ae){logger[_0xa03c('0x28')](_0x39b4ae[_0xa03c('0x29')]);if(_0x39b4ae[_0xa03c('0x2a')]){delete _0x39b4ae[_0xa03c('0x2a')];}_0x53db41['status'](_0x584e23)[_0xa03c('0x2b')](_0x39b4ae);};}exports[_0xa03c('0x2c')]=function(_0x238820,_0x2fa246){var _0x3a9204={},_0x19d930={},_0x13455e={'count':0x0,'rows':[]};var _0x4b477c=_[_0xa03c('0x2d')](db['Trigger'][_0xa03c('0x2e')],function(_0x193e85){return{'name':_0x193e85[_0xa03c('0x2f')],'type':_0x193e85['type'][_0xa03c('0x30')]};});_0x19d930[_0xa03c('0x31')]=_[_0xa03c('0x2d')](_0x4b477c,_0xa03c('0x2a'));_0x19d930[_0xa03c('0x32')]=_[_0xa03c('0x33')](_0x238820[_0xa03c('0x32')]);_0x19d930[_0xa03c('0x34')]=_[_0xa03c('0x35')](_0x19d930['model'],_0x19d930[_0xa03c('0x32')]);_0x3a9204[_0xa03c('0x36')]=_[_0xa03c('0x35')](_0x19d930[_0xa03c('0x31')],qs[_0xa03c('0x37')](_0x238820['query'][_0xa03c('0x37')]));_0x3a9204[_0xa03c('0x36')]=_0x3a9204[_0xa03c('0x36')]['length']?_0x3a9204['attributes']:_0x19d930[_0xa03c('0x31')];if(!_0x238820[_0xa03c('0x32')][_0xa03c('0x38')](_0xa03c('0x39'))){_0x3a9204['limit']=qs[_0xa03c('0x1e')](_0x238820[_0xa03c('0x32')][_0xa03c('0x1e')]);_0x3a9204[_0xa03c('0x1c')]=qs[_0xa03c('0x1c')](_0x238820[_0xa03c('0x32')][_0xa03c('0x1c')]);}_0x3a9204[_0xa03c('0x3a')]=qs[_0xa03c('0x3b')](_0x238820[_0xa03c('0x32')][_0xa03c('0x3b')]);_0x3a9204[_0xa03c('0x3c')]=qs['filters'](_[_0xa03c('0x3d')](_0x238820[_0xa03c('0x32')],_0x19d930[_0xa03c('0x34')]),_0x4b477c);if(_0x238820[_0xa03c('0x32')][_0xa03c('0x3e')]){_0x3a9204[_0xa03c('0x3c')]=_['merge'](_0x3a9204[_0xa03c('0x3c')],{'$or':_[_0xa03c('0x2d')](_0x4b477c,function(_0x561047){if(_0x561047[_0xa03c('0x3f')]!==_0xa03c('0x40')){var _0xb6f452={};_0xb6f452[_0x561047[_0xa03c('0x2a')]]={'$like':'%'+_0x238820[_0xa03c('0x32')][_0xa03c('0x3e')]+'%'};return _0xb6f452;}})});}_0x3a9204=_['merge']({},_0x3a9204,_0x238820[_0xa03c('0x41')]);var _0x3bf240={'where':_0x3a9204[_0xa03c('0x3c')]};return db[_0xa03c('0x42')][_0xa03c('0x43')](_0x3bf240)[_0xa03c('0x23')](function(_0x549d0a){_0x13455e[_0xa03c('0x43')]=_0x549d0a;if(_0x238820[_0xa03c('0x32')][_0xa03c('0x44')]){_0x3a9204['include']=[{'all':!![]}];}return db['Trigger']['findAll'](_0x3a9204);})[_0xa03c('0x23')](function(_0x1021d6){_0x13455e[_0xa03c('0x45')]=_0x1021d6;return _0x13455e;})[_0xa03c('0x23')](respondWithFilteredResult(_0x2fa246,_0x3a9204))[_0xa03c('0x46')](handleError(_0x2fa246,null));};exports[_0xa03c('0x47')]=function(_0x1d49a7,_0x428aa3){var _0x22a814={'raw':![],'where':{'id':_0x1d49a7['params']['id']}},_0x42ff3e={};_0x42ff3e[_0xa03c('0x31')]=_[_0xa03c('0x33')](db[_0xa03c('0x42')][_0xa03c('0x2e')]);_0x42ff3e[_0xa03c('0x32')]=_[_0xa03c('0x33')](_0x1d49a7[_0xa03c('0x32')]);_0x42ff3e[_0xa03c('0x34')]=_[_0xa03c('0x35')](_0x42ff3e[_0xa03c('0x31')],_0x42ff3e[_0xa03c('0x32')]);_0x22a814[_0xa03c('0x36')]=_[_0xa03c('0x35')](_0x42ff3e['model'],qs[_0xa03c('0x37')](_0x1d49a7[_0xa03c('0x32')]['fields']));_0x22a814[_0xa03c('0x36')]=_0x22a814['attributes'][_0xa03c('0x48')]?_0x22a814[_0xa03c('0x36')]:_0x42ff3e[_0xa03c('0x31')];if(_0x1d49a7[_0xa03c('0x32')][_0xa03c('0x44')]){_0x22a814[_0xa03c('0x49')]=[{'all':!![]}];}_0x22a814=_[_0xa03c('0x4a')]({},_0x22a814,_0x1d49a7[_0xa03c('0x41')]);return db[_0xa03c('0x42')][_0xa03c('0x4b')](_0x22a814)[_0xa03c('0x23')](handleEntityNotFound(_0x428aa3,null))[_0xa03c('0x23')](respondWithResult(_0x428aa3,null))[_0xa03c('0x46')](handleError(_0x428aa3,null));};exports[_0xa03c('0x4c')]=function(_0xec1f13,_0x3d61c2){return db[_0xa03c('0x42')][_0xa03c('0x4c')](_0xec1f13['body'],{})[_0xa03c('0x23')](function(_0x205c2){var _0x24f0ff=_0xec1f13[_0xa03c('0x4d')][_0xa03c('0x25')]({'plain':!![]});if(!_0x24f0ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24f0ff[_0xa03c('0x4e')]===_0xa03c('0x4d')){var _0x579a62=_0x205c2[_0xa03c('0x25')]({'plain':!![]});var _0xd5dcc7=_0xa03c('0x26');return db[_0xa03c('0x4f')]['find']({'where':{'name':_0xd5dcc7,'userProfileId':_0x24f0ff['userProfileId']},'raw':!![]})[_0xa03c('0x23')](function(_0x53d2f8){if(_0x53d2f8&&_0x53d2f8['autoAssociation']===0x0){return db[_0xa03c('0x27')][_0xa03c('0x4c')]({'name':_0x579a62[_0xa03c('0x2a')],'resourceId':_0x579a62['id'],'type':_0x53d2f8['name'],'sectionId':_0x53d2f8['id']},{})[_0xa03c('0x23')](function(){return _0x205c2;});}else{return _0x205c2;}})[_0xa03c('0x46')](function(_0x12e203){logger[_0xa03c('0x28')](_0xa03c('0x50'),_0x12e203);throw _0x12e203;});}return _0x205c2;})[_0xa03c('0x23')](respondWithResult(_0x3d61c2,0xc9))[_0xa03c('0x46')](handleError(_0x3d61c2,null));};exports['update']=function(_0x47ac8e,_0x160ba4){if(_0x47ac8e[_0xa03c('0x51')]['id']){delete _0x47ac8e[_0xa03c('0x51')]['id'];}return db[_0xa03c('0x42')][_0xa03c('0x4b')]({'where':{'id':_0x47ac8e['params']['id']}})['then'](handleEntityNotFound(_0x160ba4,null))['then'](saveUpdates(_0x47ac8e['body'],null))[_0xa03c('0x23')](respondWithResult(_0x160ba4,null))[_0xa03c('0x46')](handleError(_0x160ba4,null));};exports['destroy']=function(_0x1230ca,_0x30fcf7){return db[_0xa03c('0x42')][_0xa03c('0x4b')]({'where':{'id':_0x1230ca[_0xa03c('0x52')]['id']}})[_0xa03c('0x23')](handleEntityNotFound(_0x30fcf7,null))[_0xa03c('0x23')](removeEntity(_0x30fcf7,null))[_0xa03c('0x46')](handleError(_0x30fcf7,null));};exports['addAllCondition']=function(_0x3cf4b8,_0x300185,_0x260475){if(_0x3cf4b8[_0xa03c('0x51')]['id']){delete _0x3cf4b8[_0xa03c('0x51')]['id'];}return db[_0xa03c('0x42')]['find']({'where':{'id':_0x3cf4b8[_0xa03c('0x52')]['id']}})[_0xa03c('0x23')](handleEntityNotFound(_0x300185,null))['then'](function(_0x3f636c){if(_0x3f636c){_0x3cf4b8[_0xa03c('0x51')][_0xa03c('0x53')]=_0x3f636c['id'];return db[_0xa03c('0x54')][_0xa03c('0x4c')](_0x3cf4b8[_0xa03c('0x51')]);}})['then'](respondWithResult(_0x300185,null))[_0xa03c('0x46')](handleError(_0x300185,null));};exports[_0xa03c('0x55')]=function(_0x260869,_0xccd4b9,_0x42f4ad){if(_0x260869[_0xa03c('0x51')]['id']){delete _0x260869[_0xa03c('0x51')]['id'];}return db['Trigger'][_0xa03c('0x4b')]({'where':{'id':_0x260869[_0xa03c('0x52')]['id']}})[_0xa03c('0x23')](handleEntityNotFound(_0xccd4b9,null))[_0xa03c('0x23')](function(_0x68efbf){if(_0x68efbf){_0x260869['body']['TriggerAnyId']=_0x68efbf['id'];return db[_0xa03c('0x54')][_0xa03c('0x4c')](_0x260869['body']);}})[_0xa03c('0x23')](respondWithResult(_0xccd4b9,null))[_0xa03c('0x46')](handleError(_0xccd4b9,null));};exports[_0xa03c('0x56')]=function(_0x2234d5,_0x50072c,_0x56770b){var _0x1a4bb6={};var _0x55828c={};var _0x40406d;var _0x266466;return db[_0xa03c('0x42')][_0xa03c('0x57')]({'where':{'id':_0x2234d5[_0xa03c('0x52')]['id']}})[_0xa03c('0x23')](handleEntityNotFound(_0x50072c,null))[_0xa03c('0x23')](function(_0x628292){if(_0x628292){_0x40406d=_0x628292;_0x55828c['model']=_['keys'](db[_0xa03c('0x54')][_0xa03c('0x2e')]);_0x55828c['query']=_['keys'](_0x2234d5[_0xa03c('0x32')]);_0x55828c[_0xa03c('0x34')]=_[_0xa03c('0x35')](_0x55828c[_0xa03c('0x31')],_0x55828c[_0xa03c('0x32')]);_0x1a4bb6['attributes']=_[_0xa03c('0x35')](_0x55828c[_0xa03c('0x31')],qs['fields'](_0x2234d5[_0xa03c('0x32')][_0xa03c('0x37')]));_0x1a4bb6[_0xa03c('0x36')]=_0x1a4bb6['attributes']['length']?_0x1a4bb6[_0xa03c('0x36')]:_0x55828c[_0xa03c('0x31')];_0x1a4bb6[_0xa03c('0x3a')]=qs[_0xa03c('0x3b')](_0x2234d5['query'][_0xa03c('0x3b')]);_0x1a4bb6[_0xa03c('0x3c')]=qs[_0xa03c('0x34')](_[_0xa03c('0x3d')](_0x2234d5[_0xa03c('0x32')],_0x55828c[_0xa03c('0x34')]));if(_0x2234d5[_0xa03c('0x32')]['filter']){_0x1a4bb6['where']=_[_0xa03c('0x4a')](_0x1a4bb6['where'],{'$or':_['map'](_0x1a4bb6[_0xa03c('0x36')],function(_0x56535a){var _0x4b9463={};_0x4b9463[_0x56535a]={'$like':'%'+_0x2234d5['query'][_0xa03c('0x3e')]+'%'};return _0x4b9463;})});}_0x1a4bb6=_[_0xa03c('0x4a')]({},_0x1a4bb6,_0x2234d5[_0xa03c('0x41')]);return _0x40406d[_0xa03c('0x56')](_0x1a4bb6);}})[_0xa03c('0x23')](function(_0xfbd9e7){if(_0xfbd9e7){_0x266466=_0xfbd9e7[_0xa03c('0x48')];if(!_0x2234d5[_0xa03c('0x32')][_0xa03c('0x38')](_0xa03c('0x39'))){_0x1a4bb6[_0xa03c('0x1e')]=qs[_0xa03c('0x1e')](_0x2234d5[_0xa03c('0x32')][_0xa03c('0x1e')]);_0x1a4bb6['offset']=qs[_0xa03c('0x1c')](_0x2234d5[_0xa03c('0x32')]['offset']);}return _0x40406d[_0xa03c('0x56')](_0x1a4bb6);}})[_0xa03c('0x23')](function(_0x4f36d9){if(_0x4f36d9){return _0x4f36d9?{'count':_0x266466,'rows':_0x4f36d9}:null;}})[_0xa03c('0x23')](respondWithResult(_0x50072c,null))[_0xa03c('0x46')](handleError(_0x50072c,null));};exports[_0xa03c('0x58')]=function(_0xb12844,_0x26bb2e,_0x23c004){var _0x69beac={};var _0x3d2475={};var _0x29cb71;var _0xd3d16e;return db[_0xa03c('0x42')][_0xa03c('0x57')]({'where':{'id':_0xb12844[_0xa03c('0x52')]['id']}})[_0xa03c('0x23')](handleEntityNotFound(_0x26bb2e,null))[_0xa03c('0x23')](function(_0x528480){if(_0x528480){_0x29cb71=_0x528480;_0x3d2475[_0xa03c('0x31')]=_[_0xa03c('0x33')](db['Condition'][_0xa03c('0x2e')]);_0x3d2475[_0xa03c('0x32')]=_['keys'](_0xb12844[_0xa03c('0x32')]);_0x3d2475[_0xa03c('0x34')]=_[_0xa03c('0x35')](_0x3d2475[_0xa03c('0x31')],_0x3d2475[_0xa03c('0x32')]);_0x69beac[_0xa03c('0x36')]=_[_0xa03c('0x35')](_0x3d2475['model'],qs[_0xa03c('0x37')](_0xb12844[_0xa03c('0x32')][_0xa03c('0x37')]));_0x69beac[_0xa03c('0x36')]=_0x69beac[_0xa03c('0x36')][_0xa03c('0x48')]?_0x69beac[_0xa03c('0x36')]:_0x3d2475[_0xa03c('0x31')];_0x69beac['order']=qs['sort'](_0xb12844['query'][_0xa03c('0x3b')]);_0x69beac['where']=qs[_0xa03c('0x34')](_['pick'](_0xb12844[_0xa03c('0x32')],_0x3d2475[_0xa03c('0x34')]));if(_0xb12844[_0xa03c('0x32')][_0xa03c('0x3e')]){_0x69beac[_0xa03c('0x3c')]=_[_0xa03c('0x4a')](_0x69beac[_0xa03c('0x3c')],{'$or':_[_0xa03c('0x2d')](_0x69beac['attributes'],function(_0x4d205f){var _0x382a5b={};_0x382a5b[_0x4d205f]={'$like':'%'+_0xb12844[_0xa03c('0x32')]['filter']+'%'};return _0x382a5b;})});}_0x69beac=_[_0xa03c('0x4a')]({},_0x69beac,_0xb12844['options']);return _0x29cb71['getAnyConditions'](_0x69beac);}})['then'](function(_0x3282b7){if(_0x3282b7){_0xd3d16e=_0x3282b7[_0xa03c('0x48')];if(!_0xb12844['query'][_0xa03c('0x38')]('nolimit')){_0x69beac['limit']=qs[_0xa03c('0x1e')](_0xb12844['query'][_0xa03c('0x1e')]);_0x69beac[_0xa03c('0x1c')]=qs[_0xa03c('0x1c')](_0xb12844[_0xa03c('0x32')][_0xa03c('0x1c')]);}return _0x29cb71[_0xa03c('0x58')](_0x69beac);}})[_0xa03c('0x23')](function(_0x5d0e86){if(_0x5d0e86){return _0x5d0e86?{'count':_0xd3d16e,'rows':_0x5d0e86}:null;}})[_0xa03c('0x23')](respondWithResult(_0x26bb2e,null))[_0xa03c('0x46')](handleError(_0x26bb2e,null));};exports[_0xa03c('0x59')]=function(_0x11e573,_0x2b5cf3,_0x2c8e0e){if(_0x11e573[_0xa03c('0x51')]['id']){delete _0x11e573['body']['id'];}return db[_0xa03c('0x42')][_0xa03c('0x4b')]({'where':{'id':_0x11e573[_0xa03c('0x52')]['id']}})[_0xa03c('0x23')](handleEntityNotFound(_0x2b5cf3,null))['then'](function(_0x2ccbb3){if(_0x2ccbb3){_0x11e573['body'][_0xa03c('0x5a')]=_0x2ccbb3['id'];return db[_0xa03c('0x5b')][_0xa03c('0x4c')](_0x11e573[_0xa03c('0x51')]);}})['then'](respondWithResult(_0x2b5cf3,null))['catch'](handleError(_0x2b5cf3,null));};exports['getActions']=function(_0x37e1d7,_0x46179e,_0x452c95){var _0x831bdc={};var _0x44f77c={};var _0x9a454b;var _0x1b767d;return db[_0xa03c('0x42')][_0xa03c('0x57')]({'where':{'id':_0x37e1d7[_0xa03c('0x52')]['id']}})[_0xa03c('0x23')](handleEntityNotFound(_0x46179e,null))[_0xa03c('0x23')](function(_0x27e53c){if(_0x27e53c){_0x9a454b=_0x27e53c;_0x44f77c[_0xa03c('0x31')]=_['keys'](db[_0xa03c('0x5b')][_0xa03c('0x2e')]);_0x44f77c[_0xa03c('0x32')]=_[_0xa03c('0x33')](_0x37e1d7[_0xa03c('0x32')]);_0x44f77c[_0xa03c('0x34')]=_[_0xa03c('0x35')](_0x44f77c['model'],_0x44f77c[_0xa03c('0x32')]);_0x831bdc[_0xa03c('0x36')]=_[_0xa03c('0x35')](_0x44f77c[_0xa03c('0x31')],qs['fields'](_0x37e1d7['query'][_0xa03c('0x37')]));_0x831bdc['attributes']=_0x831bdc[_0xa03c('0x36')]['length']?_0x831bdc['attributes']:_0x44f77c[_0xa03c('0x31')];_0x831bdc[_0xa03c('0x3a')]=qs['sort'](_0x37e1d7[_0xa03c('0x32')]['sort']);_0x831bdc[_0xa03c('0x3c')]=qs[_0xa03c('0x34')](_[_0xa03c('0x3d')](_0x37e1d7[_0xa03c('0x32')],_0x44f77c['filters']));if(_0x37e1d7[_0xa03c('0x32')][_0xa03c('0x3e')]){_0x831bdc[_0xa03c('0x3c')]=_[_0xa03c('0x4a')](_0x831bdc[_0xa03c('0x3c')],{'$or':_[_0xa03c('0x2d')](_0x831bdc[_0xa03c('0x36')],function(_0x120aab){var _0x57cf41={};_0x57cf41[_0x120aab]={'$like':'%'+_0x37e1d7[_0xa03c('0x32')]['filter']+'%'};return _0x57cf41;})});}_0x831bdc=_[_0xa03c('0x4a')]({},_0x831bdc,_0x37e1d7['options']);return _0x9a454b['getActions'](_0x831bdc);}})[_0xa03c('0x23')](function(_0x308d11){if(_0x308d11){_0x1b767d=_0x308d11[_0xa03c('0x48')];if(!_0x37e1d7['query']['hasOwnProperty'](_0xa03c('0x39'))){_0x831bdc['limit']=qs['limit'](_0x37e1d7[_0xa03c('0x32')][_0xa03c('0x1e')]);_0x831bdc['offset']=qs['offset'](_0x37e1d7[_0xa03c('0x32')][_0xa03c('0x1c')]);}return _0x9a454b[_0xa03c('0x5c')](_0x831bdc);}})['then'](function(_0x14ed09){if(_0x14ed09){return _0x14ed09?{'count':_0x1b767d,'rows':_0x14ed09}:null;}})['then'](respondWithResult(_0x46179e,null))[_0xa03c('0x46')](handleError(_0x46179e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 836dc21..160d3d8 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 _0xf041=['path','../../config/environment','define','Trigger','tools_triggers','../../config/logger','api','moment','bluebird'];(function(_0x202d69,_0x5e45a8){var _0x58d286=function(_0x42326a){while(--_0x42326a){_0x202d69['push'](_0x202d69['shift']());}};_0x58d286(++_0x5e45a8);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./trigger.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x502a=['path','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','api','moment'];(function(_0x47545a,_0x5250b){var _0x4fd606=function(_0x537718){while(--_0x537718){_0x47545a['push'](_0x47545a['shift']());}};_0x4fd606(++_0x5250b);}(_0x502a,0xd8));var _0xa502=function(_0x5123df,_0x58b731){_0x5123df=_0x5123df-0x0;var _0x3cd7e8=_0x502a[_0x5123df];return _0x3cd7e8;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var moment=require(_0xa502('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa502('0x4'));var rimraf=require('rimraf');var config=require(_0xa502('0x5'));var attributes=require(_0xa502('0x6'));module[_0xa502('0x7')]=function(_0x1cb2e4,_0x136d51){return _0x1cb2e4['define'](_0xa502('0x8'),attributes,{'tableName':_0xa502('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 2f4dc09..331830a 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 _0xe5bb=['stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x593a25,_0x37b3ea){var _0x1c9aef=function(_0x1c3962){while(--_0x1c3962){_0x593a25['push'](_0x593a25['shift']());}};_0x1c9aef(++_0x37b3ea);}(_0xe5bb,0x166));var _0xbe5b=function(_0x1d51ba,_0x58b617){_0x1d51ba=_0x1d51ba-0x0;var _0x141ede=_0xe5bb[_0x1d51ba];return _0x141ede;};'use strict';var _=require(_0xbe5b('0x0'));var util=require(_0xbe5b('0x1'));var moment=require('moment');var BPromise=require(_0xbe5b('0x2'));var rs=require(_0xbe5b('0x3'));var fs=require('fs');var Redis=require(_0xbe5b('0x4'));var db=require(_0xbe5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe5b('0x6'))(_0xbe5b('0x7'));var config=require(_0xbe5b('0x8'));var jayson=require(_0xbe5b('0x9'));var client=jayson['client'][_0xbe5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ea278,_0x3986e9,_0xca35ac){return new BPromise(function(_0x7fbfac,_0x2076ce){return client['request'](_0x3ea278,_0xca35ac)[_0xbe5b('0xb')](function(_0x440798){logger[_0xbe5b('0xc')](_0xbe5b('0xd'),_0x3986e9,'request\x20sent');logger[_0xbe5b('0xe')](_0xbe5b('0xf'),_0x3986e9,'request\x20sent',JSON[_0xbe5b('0x10')](_0x440798));if(_0x440798['error']){if(_0x440798[_0xbe5b('0x11')][_0xbe5b('0x12')]===0x1f4){logger[_0xbe5b('0x11')]('Trigger,\x20%s,\x20%s',_0x3986e9,_0x440798['error'][_0xbe5b('0x13')]);return _0x2076ce(_0x440798['error'][_0xbe5b('0x13')]);}logger[_0xbe5b('0x11')]('Trigger,\x20%s,\x20%s',_0x3986e9,_0x440798[_0xbe5b('0x11')][_0xbe5b('0x13')]);return _0x7fbfac(_0x440798[_0xbe5b('0x11')][_0xbe5b('0x13')]);}else{logger[_0xbe5b('0xc')]('Trigger,\x20%s,\x20%s',_0x3986e9,'request\x20sent');_0x7fbfac(_0x440798[_0xbe5b('0x14')][_0xbe5b('0x13')]);}})[_0xbe5b('0x15')](function(_0x5e14da){logger['error'](_0xbe5b('0xd'),_0x3986e9,_0x5e14da);_0x2076ce(_0x5e14da);});});}exports[_0xbe5b('0x16')]=function(_0x471c5b){var _0x4b9274=this;return new Promise(function(_0x323564,_0x4f65c9){return db[_0xbe5b('0x17')][_0xbe5b('0x18')]({'raw':_0x471c5b[_0xbe5b('0x19')]?_0x471c5b[_0xbe5b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x471c5b[_0xbe5b('0x19')]?_0x471c5b['options'][_0xbe5b('0x1a')]||null:null,'attributes':_0x471c5b['options']?_0x471c5b['options'][_0xbe5b('0x1b')]||null:null,'limit':_0x471c5b[_0xbe5b('0x19')]?_0x471c5b[_0xbe5b('0x19')][_0xbe5b('0x1c')]||null:null,'include':_0x471c5b['options']?_0x471c5b['options'][_0xbe5b('0x1d')]?_['map'](_0x471c5b['options'][_0xbe5b('0x1d')],function(_0x3280ef){return{'model':db[_0x3280ef['model']],'as':_0x3280ef['as'],'attributes':_0x3280ef[_0xbe5b('0x1b')],'include':_0x3280ef[_0xbe5b('0x1d')]?_[_0xbe5b('0x1e')](_0x3280ef[_0xbe5b('0x1d')],function(_0x1e013b){return{'model':db[_0x1e013b[_0xbe5b('0x1f')]],'as':_0x1e013b['as'],'attributes':_0x1e013b[_0xbe5b('0x1b')],'include':_0x1e013b[_0xbe5b('0x1d')]?_[_0xbe5b('0x1e')](_0x1e013b[_0xbe5b('0x1d')],function(_0x10455a){return{'model':db[_0x10455a[_0xbe5b('0x1f')]],'as':_0x10455a['as'],'attributes':_0x10455a['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe5b('0xb')](function(_0x38df32){logger[_0xbe5b('0xc')]('GetTrigger',_0x471c5b);logger[_0xbe5b('0xe')](_0xbe5b('0x16'),_0x471c5b,JSON['stringify'](_0x38df32));_0x323564(_0x38df32);})[_0xbe5b('0x15')](function(_0x1fcf78){logger[_0xbe5b('0x11')](_0xbe5b('0x16'),_0x1fcf78[_0xbe5b('0x13')],_0x471c5b);_0x4f65c9(_0x4b9274[_0xbe5b('0x11')](0x1f4,_0x1fcf78['message']));});});};exports[_0xbe5b('0x20')]=function(_0x574620){var _0x5475f6=this;return new Promise(function(_0x1cc5e4,_0x1f5d46){return db[_0xbe5b('0x17')][_0xbe5b('0x21')]({'raw':_0x574620[_0xbe5b('0x19')]?_0x574620[_0xbe5b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x574620[_0xbe5b('0x19')]?_0x574620['options'][_0xbe5b('0x1a')]||null:null,'attributes':_0x574620['options']?_0x574620[_0xbe5b('0x19')][_0xbe5b('0x1b')]||null:null,'include':_0x574620[_0xbe5b('0x19')]?_0x574620[_0xbe5b('0x19')][_0xbe5b('0x1d')]?_[_0xbe5b('0x1e')](_0x574620['options'][_0xbe5b('0x1d')],function(_0x3c9574){return{'model':db[_0x3c9574['model']],'as':_0x3c9574['as'],'attributes':_0x3c9574[_0xbe5b('0x1b')],'include':_0x3c9574[_0xbe5b('0x1d')]?_['map'](_0x3c9574[_0xbe5b('0x1d')],function(_0xcb08ad){return{'model':db[_0xcb08ad[_0xbe5b('0x1f')]],'as':_0xcb08ad['as'],'attributes':_0xcb08ad[_0xbe5b('0x1b')],'include':_0xcb08ad[_0xbe5b('0x1d')]?_['map'](_0xcb08ad[_0xbe5b('0x1d')],function(_0x122183){return{'model':db[_0x122183['model']],'as':_0x122183['as'],'attributes':_0x122183[_0xbe5b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbe5b('0xb')](function(_0x2163a7){logger[_0xbe5b('0xc')](_0xbe5b('0x20'),_0x574620);logger[_0xbe5b('0xe')](_0xbe5b('0x20'),_0x574620,JSON[_0xbe5b('0x10')](_0x2163a7));_0x1cc5e4(_0x2163a7);})[_0xbe5b('0x15')](function(_0x1f0e94){logger[_0xbe5b('0x11')](_0xbe5b('0x20'),_0x1f0e94[_0xbe5b('0x13')],_0x574620);_0x1f5d46(_0x5475f6[_0xbe5b('0x11')](0x1f4,_0x1f0e94[_0xbe5b('0x13')]));});});}; \ No newline at end of file +var _0xc9ae=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','result','catch','GetTrigger','Trigger','options','raw','where','include','model','attributes','map','debug','find','ShowTrigger','lodash'];(function(_0xa62128,_0x4edd8d){var _0x2a01ba=function(_0x5acee6){while(--_0x5acee6){_0xa62128['push'](_0xa62128['shift']());}};_0x2a01ba(++_0x4edd8d);}(_0xc9ae,0x180));var _0xec9a=function(_0x1636d3,_0x4241e7){_0x1636d3=_0x1636d3-0x0;var _0x623e27=_0xc9ae[_0x1636d3];return _0x623e27;};'use strict';var _=require(_0xec9a('0x0'));var util=require(_0xec9a('0x1'));var moment=require('moment');var BPromise=require(_0xec9a('0x2'));var rs=require(_0xec9a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec9a('0x4'))['db'];var utils=require(_0xec9a('0x5'));var logger=require(_0xec9a('0x6'))('rpc');var config=require(_0xec9a('0x7'));var jayson=require(_0xec9a('0x8'));var client=jayson[_0xec9a('0x9')][_0xec9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37ef27,_0x4927e3,_0x47e762){return new BPromise(function(_0x187698,_0x3a60bf){return client[_0xec9a('0xb')](_0x37ef27,_0x47e762)[_0xec9a('0xc')](function(_0x56e26a){logger['info']('Trigger,\x20%s,\x20%s',_0x4927e3,_0xec9a('0xd'));logger['debug'](_0xec9a('0xe'),_0x4927e3,_0xec9a('0xd'),JSON[_0xec9a('0xf')](_0x56e26a));if(_0x56e26a[_0xec9a('0x10')]){if(_0x56e26a[_0xec9a('0x10')][_0xec9a('0x11')]===0x1f4){logger[_0xec9a('0x10')](_0xec9a('0x12'),_0x4927e3,_0x56e26a[_0xec9a('0x10')][_0xec9a('0x13')]);return _0x3a60bf(_0x56e26a['error'][_0xec9a('0x13')]);}logger[_0xec9a('0x10')](_0xec9a('0x12'),_0x4927e3,_0x56e26a[_0xec9a('0x10')][_0xec9a('0x13')]);return _0x187698(_0x56e26a['error']['message']);}else{logger[_0xec9a('0x14')](_0xec9a('0x12'),_0x4927e3,_0xec9a('0xd'));_0x187698(_0x56e26a[_0xec9a('0x15')][_0xec9a('0x13')]);}})[_0xec9a('0x16')](function(_0x4250d2){logger['error'](_0xec9a('0x12'),_0x4927e3,_0x4250d2);_0x3a60bf(_0x4250d2);});});}exports[_0xec9a('0x17')]=function(_0x382d83){var _0x202090=this;return new Promise(function(_0x1415ed,_0x3b1580){return db[_0xec9a('0x18')]['findAll']({'raw':_0x382d83['options']?_0x382d83[_0xec9a('0x19')][_0xec9a('0x1a')]===undefined?!![]:![]:!![],'where':_0x382d83[_0xec9a('0x19')]?_0x382d83['options'][_0xec9a('0x1b')]||null:null,'attributes':_0x382d83[_0xec9a('0x19')]?_0x382d83['options']['attributes']||null:null,'limit':_0x382d83['options']?_0x382d83[_0xec9a('0x19')]['limit']||null:null,'include':_0x382d83[_0xec9a('0x19')]?_0x382d83[_0xec9a('0x19')][_0xec9a('0x1c')]?_['map'](_0x382d83[_0xec9a('0x19')][_0xec9a('0x1c')],function(_0x34c057){return{'model':db[_0x34c057[_0xec9a('0x1d')]],'as':_0x34c057['as'],'attributes':_0x34c057[_0xec9a('0x1e')],'include':_0x34c057['include']?_[_0xec9a('0x1f')](_0x34c057[_0xec9a('0x1c')],function(_0x3bc74f){return{'model':db[_0x3bc74f[_0xec9a('0x1d')]],'as':_0x3bc74f['as'],'attributes':_0x3bc74f['attributes'],'include':_0x3bc74f[_0xec9a('0x1c')]?_[_0xec9a('0x1f')](_0x3bc74f[_0xec9a('0x1c')],function(_0x279237){return{'model':db[_0x279237[_0xec9a('0x1d')]],'as':_0x279237['as'],'attributes':_0x279237[_0xec9a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xec9a('0xc')](function(_0x1a27c8){logger[_0xec9a('0x14')]('GetTrigger',_0x382d83);logger[_0xec9a('0x20')]('GetTrigger',_0x382d83,JSON[_0xec9a('0xf')](_0x1a27c8));_0x1415ed(_0x1a27c8);})[_0xec9a('0x16')](function(_0x43c32b){logger[_0xec9a('0x10')](_0xec9a('0x17'),_0x43c32b['message'],_0x382d83);_0x3b1580(_0x202090[_0xec9a('0x10')](0x1f4,_0x43c32b[_0xec9a('0x13')]));});});};exports['ShowTrigger']=function(_0x445b6f){var _0x5a2895=this;return new Promise(function(_0x4a0f3b,_0x2f5ad2){return db[_0xec9a('0x18')][_0xec9a('0x21')]({'raw':_0x445b6f[_0xec9a('0x19')]?_0x445b6f[_0xec9a('0x19')][_0xec9a('0x1a')]===undefined?!![]:![]:!![],'where':_0x445b6f[_0xec9a('0x19')]?_0x445b6f[_0xec9a('0x19')][_0xec9a('0x1b')]||null:null,'attributes':_0x445b6f[_0xec9a('0x19')]?_0x445b6f[_0xec9a('0x19')]['attributes']||null:null,'include':_0x445b6f['options']?_0x445b6f[_0xec9a('0x19')][_0xec9a('0x1c')]?_[_0xec9a('0x1f')](_0x445b6f[_0xec9a('0x19')][_0xec9a('0x1c')],function(_0x3163c4){return{'model':db[_0x3163c4[_0xec9a('0x1d')]],'as':_0x3163c4['as'],'attributes':_0x3163c4[_0xec9a('0x1e')],'include':_0x3163c4[_0xec9a('0x1c')]?_[_0xec9a('0x1f')](_0x3163c4[_0xec9a('0x1c')],function(_0x5dca69){return{'model':db[_0x5dca69[_0xec9a('0x1d')]],'as':_0x5dca69['as'],'attributes':_0x5dca69[_0xec9a('0x1e')],'include':_0x5dca69[_0xec9a('0x1c')]?_[_0xec9a('0x1f')](_0x5dca69['include'],function(_0x1eb61a){return{'model':db[_0x1eb61a[_0xec9a('0x1d')]],'as':_0x1eb61a['as'],'attributes':_0x1eb61a[_0xec9a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3013c1){logger[_0xec9a('0x14')](_0xec9a('0x22'),_0x445b6f);logger['debug']('ShowTrigger',_0x445b6f,JSON['stringify'](_0x3013c1));_0x4a0f3b(_0x3013c1);})['catch'](function(_0x3efeaf){logger[_0xec9a('0x10')](_0xec9a('0x22'),_0x3efeaf[_0xec9a('0x13')],_0x445b6f);_0x2f5ad2(_0x5a2895[_0xec9a('0x10')](0x1f4,_0x3efeaf[_0xec9a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 318a936..79ad01c 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 _0xf60d=['clone','create','put','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','post','/:id/clone'];(function(_0x4e3a4c,_0x345774){var _0x4dcef3=function(_0x48f1a){while(--_0x48f1a){_0x4e3a4c['push'](_0x4e3a4c['shift']());}};_0x4dcef3(++_0x345774);}(_0xf60d,0x16c));var _0xdf60=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xf60d[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require('multer');var util=require(_0xdf60('0x0'));var path=require(_0xdf60('0x1'));var timeout=require('connect-timeout');var express=require(_0xdf60('0x2'));var router=express[_0xdf60('0x3')]();var fs_extra=require(_0xdf60('0x4'));var auth=require(_0xdf60('0x5'));var interaction=require(_0xdf60('0x6'));var config=require(_0xdf60('0x7'));var controller=require(_0xdf60('0x8'));router[_0xdf60('0x9')]('/',auth[_0xdf60('0xa')](),controller['index']);router[_0xdf60('0x9')](_0xdf60('0xb'),auth[_0xdf60('0xa')](),controller['show']);router[_0xdf60('0xc')](_0xdf60('0xd'),auth['isAuthenticated'](),controller[_0xdf60('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdf60('0xf')]);router[_0xdf60('0x10')](_0xdf60('0xb'),auth[_0xdf60('0xa')](),controller['update']);router[_0xdf60('0x11')](_0xdf60('0xb'),auth[_0xdf60('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc9b0=['../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','update','delete','util','path','express','Router'];(function(_0x6b6340,_0x6302c4){var _0x3609bf=function(_0x1620a0){while(--_0x1620a0){_0x6b6340['push'](_0x6b6340['shift']());}};_0x3609bf(++_0x6302c4);}(_0xc9b0,0x1bc));var _0x0c9b=function(_0x292b0e,_0x398db9){_0x292b0e=_0x292b0e-0x0;var _0x4cdb74=_0xc9b0[_0x292b0e];return _0x4cdb74;};'use strict';var multer=require('multer');var util=require(_0x0c9b('0x0'));var path=require(_0x0c9b('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c9b('0x2'));var router=express[_0x0c9b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0c9b('0x4'));var config=require('../../config/environment');var controller=require(_0x0c9b('0x5'));router[_0x0c9b('0x6')]('/',auth[_0x0c9b('0x7')](),controller[_0x0c9b('0x8')]);router[_0x0c9b('0x6')](_0x0c9b('0x9'),auth['isAuthenticated'](),controller[_0x0c9b('0xa')]);router[_0x0c9b('0xb')](_0x0c9b('0xc'),auth[_0x0c9b('0x7')](),controller['clone']);router[_0x0c9b('0xb')]('/',auth[_0x0c9b('0x7')](),controller[_0x0c9b('0xd')]);router['put'](_0x0c9b('0x9'),auth[_0x0c9b('0x7')](),controller[_0x0c9b('0xe')]);router[_0x0c9b('0xf')](_0x0c9b('0x9'),auth[_0x0c9b('0x7')](),controller['destroy']);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 950b313..d5c1585 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 _0xb3bc=['uas','pai','fingerprint','active','actpass','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','join','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'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb3bc,0x114));var _0xcb3b=function(_0x108f68,_0x3c9a03){_0x108f68=_0x108f68-0x0;var _0x5f130d=_0xb3bc[_0x108f68];return _0x5f130d;};'use strict';var Sequelize=require(_0xcb3b('0x0'));module[_0xcb3b('0x1')]={'name':{'type':Sequelize[_0xcb3b('0x2')],'allowNull':![],'unique':_0xcb3b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x5'),_0xcb3b('0x6'),'peer'),'allowNull':![],'defaultValue':_0xcb3b('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcb3b('0x7')},'callingpres':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x8'),_0xcb3b('0x9'),_0xcb3b('0xa'),_0xcb3b('0xb'),'PROHIB_NOT_SCREENED',_0xcb3b('0xc'),'PROHIB_FAILED_SCREEN',_0xcb3b('0xd'))},'deny':{'type':Sequelize[_0xcb3b('0x2')]},'permit':{'type':Sequelize[_0xcb3b('0x2')]},'secret':{'type':Sequelize[_0xcb3b('0x2')]},'md5secret':{'type':Sequelize[_0xcb3b('0x2')]},'remotesecret':{'type':Sequelize[_0xcb3b('0x2')]},'transport':{'type':Sequelize[_0xcb3b('0x2')],'defaultValue':_0xcb3b('0xe'),'set':function(_0xac0aa9){this[_0xcb3b('0xf')](_0xcb3b('0x10'),_0xac0aa9?_0xac0aa9['join'](','):null);},'get':function(){return this[_0xcb3b('0x11')](_0xcb3b('0x10'))?this[_0xcb3b('0x11')](_0xcb3b('0x10'))['split'](','):null;},'comment':_0xcb3b('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0xcb3b('0x13'),_0xcb3b('0x14'),_0xcb3b('0x15'),_0xcb3b('0x16'),_0xcb3b('0x17')),'defaultValue':_0xcb3b('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0xcb3b('0x18'),'no',_0xcb3b('0x19'),_0xcb3b('0x1a'),_0xcb3b('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcb3b('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xcb3b('0x2')],'defaultValue':_0xcb3b('0x1c'),'set':function(_0x29860a){this['setDataValue'](_0xcb3b('0x1d'),_0x29860a?_0x29860a['join'](','):null);},'get':function(){return this[_0xcb3b('0x11')]('nat')?this[_0xcb3b('0x11')](_0xcb3b('0x1d'))[_0xcb3b('0x1e')](','):null;},'comment':_0xcb3b('0x1f')},'callgroup':{'type':Sequelize[_0xcb3b('0x2')]},'namedcallgroup':{'type':Sequelize[_0xcb3b('0x2')]},'pickupgroup':{'type':Sequelize[_0xcb3b('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xcb3b('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcb3b('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcb3b('0x2')],'defaultValue':_0xcb3b('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcb3b('0x21'),'set':function(_0x46ff12){this[_0xcb3b('0xf')]('allow',_0x46ff12?_0x46ff12['join'](';'):_0xcb3b('0x21'));},'get':function(){return this[_0xcb3b('0x11')](_0xcb3b('0x22'))?this['getDataValue'](_0xcb3b('0x22'))[_0xcb3b('0x1e')](';'):null;},'comment':_0xcb3b('0x23')},'autoframing':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'insecure':{'type':Sequelize[_0xcb3b('0x2')],'defaultValue':_0xcb3b('0x24'),'set':function(_0x1fc0ba){this[_0xcb3b('0xf')]('insecure',_0x1fc0ba?_0x1fc0ba[_0xcb3b('0x25')](','):null);},'get':function(){return this[_0xcb3b('0x11')]('insecure')?this[_0xcb3b('0x11')](_0xcb3b('0x26'))[_0xcb3b('0x1e')](','):null;},'comment':_0xcb3b('0x27')},'trustrpid':{'type':Sequelize[_0xcb3b('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xcb3b('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no',_0xcb3b('0x28'))},'promiscredir':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'accountcode':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'setvar':{'type':Sequelize[_0xcb3b('0x2')]},'callerid':{'type':Sequelize[_0xcb3b('0x2')],'defaultValue':_0xcb3b('0x2a')},'amaflags':{'type':Sequelize[_0xcb3b('0x2')]},'callcounter':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no'),'defaultValue':_0xcb3b('0x18')},'busylevel':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xcb3b('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xcb3b('0x2')]},'videosupport':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no',_0xcb3b('0x2b')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x2c'),_0xcb3b('0x2d'),_0xcb3b('0x2e'))},'session_expires':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x2f'),_0xcb3b('0x30')),'defaultValue':_0xcb3b('0x30')},'t38pt_usertpsource':{'type':Sequelize[_0xcb3b('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xcb3b('0x2')]},'fromuser':{'type':Sequelize[_0xcb3b('0x2')]},'port':{'type':Sequelize[_0xcb3b('0x29')](0x5)},'qualify':{'type':Sequelize[_0xcb3b('0x4')]('yes','no'),'defaultValue':_0xcb3b('0x18')},'keepalive':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'defaultip':{'type':Sequelize[_0xcb3b('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no',_0xcb3b('0x31')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcb3b('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0xcb3b('0x2')]},'contactdeny':{'type':Sequelize[_0xcb3b('0x2')]},'contactacl':{'type':Sequelize[_0xcb3b('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xcb3b('0x2')]},'use_q850_reason':{'type':Sequelize[_0xcb3b('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'force_avp':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'icesupport':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xcb3b('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xcb3b('0x18'),'no',_0xcb3b('0x32'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xcb3b('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0xcb3b('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xcb3b('0x2')]},'dtlscipher':{'type':Sequelize[_0xcb3b('0x2')]},'dtlscafile':{'type':Sequelize[_0xcb3b('0x2')]},'dtlscapath':{'type':Sequelize[_0xcb3b('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xcb3b('0x33'),'passive',_0xcb3b('0x34')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcb3b('0x2')]},'usereqphone':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcb3b('0x2')]},'recordofffeature':{'type':Sequelize[_0xcb3b('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcb3b('0x4')](_0xcb3b('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xcb3b('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xcb3b('0x2')]},'mohsuggest':{'type':Sequelize[_0xcb3b('0x2')]},'parkinglot':{'type':Sequelize[_0xcb3b('0x2')]},'description':{'type':Sequelize[_0xcb3b('0x2')]},'host':{'type':Sequelize[_0xcb3b('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xcb3b('0x18'),'no',_0xcb3b('0x19'),_0xcb3b('0x1a'),_0xcb3b('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xcb3b('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcb3b('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xff31=['udp','getDataValue','transport','ENUM','rfc2833','info','inband','auto','yes','nonat','update','force_rport,comedia','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','setDataValue','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xff31,0x15f));var _0x1ff3=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xff31[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require(_0x1ff3('0x0'));module[_0x1ff3('0x1')]={'name':{'type':Sequelize[_0x1ff3('0x2')],'allowNull':![],'unique':_0x1ff3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x1ff3('0x4'),'peer'),'allowNull':![],'defaultValue':_0x1ff3('0x5')},'context':{'type':Sequelize[_0x1ff3('0x2')],'allowNull':![],'defaultValue':_0x1ff3('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x1ff3('0x7'),_0x1ff3('0x8'),_0x1ff3('0x9'),'ALLOWED',_0x1ff3('0xa'),_0x1ff3('0xb'),_0x1ff3('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x1ff3('0x2')]},'permit':{'type':Sequelize[_0x1ff3('0x2')]},'secret':{'type':Sequelize[_0x1ff3('0x2')]},'md5secret':{'type':Sequelize[_0x1ff3('0x2')]},'remotesecret':{'type':Sequelize[_0x1ff3('0x2')]},'transport':{'type':Sequelize[_0x1ff3('0x2')],'defaultValue':_0x1ff3('0xd'),'set':function(_0x2594a5){this['setDataValue']('transport',_0x2594a5?_0x2594a5['join'](','):null);},'get':function(){return this[_0x1ff3('0xe')](_0x1ff3('0xf'))?this[_0x1ff3('0xe')](_0x1ff3('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x11'),_0x1ff3('0x12'),'shortinfo',_0x1ff3('0x13'),_0x1ff3('0x14')),'defaultValue':_0x1ff3('0x11')},'directmedia':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no',_0x1ff3('0x16'),_0x1ff3('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1ff3('0x2')]},'directmediadeny':{'type':Sequelize[_0x1ff3('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x1ff3('0x18'),'set':function(_0x3d63f2){this['setDataValue']('nat',_0x3d63f2?_0x3d63f2[_0x1ff3('0x19')](','):null);},'get':function(){return this['getDataValue'](_0x1ff3('0x1a'))?this[_0x1ff3('0xe')]('nat')[_0x1ff3('0x1b')](','):null;},'comment':_0x1ff3('0x1c')},'callgroup':{'type':Sequelize[_0x1ff3('0x2')]},'namedcallgroup':{'type':Sequelize[_0x1ff3('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x1ff3('0x2')]},'language':{'type':Sequelize[_0x1ff3('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1ff3('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1ff3('0x2')],'defaultValue':_0x1ff3('0x1d')},'allow':{'type':Sequelize[_0x1ff3('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4e6db5){this[_0x1ff3('0x1e')](_0x1ff3('0x1f'),_0x4e6db5?_0x4e6db5[_0x1ff3('0x19')](';'):_0x1ff3('0x20'));},'get':function(){return this[_0x1ff3('0xe')](_0x1ff3('0x1f'))?this['getDataValue'](_0x1ff3('0x1f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1ff3('0x15'),'no')},'insecure':{'type':Sequelize[_0x1ff3('0x2')],'defaultValue':_0x1ff3('0x21'),'set':function(_0x2e7d47){this[_0x1ff3('0x1e')](_0x1ff3('0x22'),_0x2e7d47?_0x2e7d47[_0x1ff3('0x19')](','):null);},'get':function(){return this[_0x1ff3('0xe')]('insecure')?this['getDataValue'](_0x1ff3('0x22'))[_0x1ff3('0x1b')](','):null;},'comment':_0x1ff3('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x1ff3('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no',_0x1ff3('0x24'))},'promiscredir':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'accountcode':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'setvar':{'type':Sequelize[_0x1ff3('0x2')]},'callerid':{'type':Sequelize[_0x1ff3('0x2')],'defaultValue':_0x1ff3('0x26')},'amaflags':{'type':Sequelize[_0x1ff3('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x1ff3('0x15'),'no'),'defaultValue':_0x1ff3('0x15')},'busylevel':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x1ff3('0x2')]},'template':{'type':Sequelize[_0x1ff3('0x2')]},'videosupport':{'type':Sequelize[_0x1ff3('0x10')]('yes','no',_0x1ff3('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'mailbox':{'type':Sequelize[_0x1ff3('0x2')]},'session_timers':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x28'),'refuse',_0x1ff3('0x29'))},'session_expires':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x2a'),_0x1ff3('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1ff3('0x2')]},'regexten':{'type':Sequelize[_0x1ff3('0x2')]},'fromdomain':{'type':Sequelize[_0x1ff3('0x2')]},'fromuser':{'type':Sequelize[_0x1ff3('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no'),'defaultValue':_0x1ff3('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x1ff3('0x2')]},'defaultuser':{'type':Sequelize[_0x1ff3('0x2')]},'rtptimeout':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x1ff3('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x1ff3('0x2')]},'timert1':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'timerb':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x1ff3('0x2')]},'contactdeny':{'type':Sequelize[_0x1ff3('0x2')]},'contactacl':{'type':Sequelize[_0x1ff3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x1ff3('0x2')]},'use_q850_reason':{'type':Sequelize[_0x1ff3('0x2')]},'maxforwards':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'encryption':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'icesupport':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no',_0x1ff3('0x2d'),_0x1ff3('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x1ff3('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1ff3('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x1ff3('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1ff3('0x2')]},'dtlscapath':{'type':Sequelize[_0x1ff3('0x2')]},'dtlssetup':{'type':Sequelize[_0x1ff3('0x10')]('active',_0x1ff3('0x2f'),_0x1ff3('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1ff3('0x2')]},'usereqphone':{'type':Sequelize[_0x1ff3('0x10')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x1ff3('0x2')]},'call_limit':{'type':Sequelize[_0x1ff3('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no')},'vmexten':{'type':Sequelize[_0x1ff3('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1ff3('0x2')]},'description':{'type':Sequelize[_0x1ff3('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x1ff3('0x31')},'canreinvite':{'type':Sequelize[_0x1ff3('0x10')](_0x1ff3('0x15'),'no','nonat',_0x1ff3('0x17'),_0x1ff3('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x1ff3('0x2')]},'active':{'type':Sequelize[_0x1ff3('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1ff3('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 3aac00f..d16a14f 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x581078,_0x5d256e){var _0x5b8340=function(_0x7e254d){while(--_0x7e254d){_0x581078['push'](_0x581078['shift']());}};_0x5b8340(++_0x5d256e);}(_0x6aa7,0x178));var _0x76aa=function(_0x26962f,_0x3fbd9c){_0x26962f=_0x26962f-0x0;var _0x35a116=_0x6aa7[_0x26962f];return _0x35a116;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x242c29,_0x168f0a){var _0x3f4d1c=function(_0x87d119){while(--_0x87d119){_0x242c29['push'](_0x242c29['shift']());}};_0x3f4d1c(++_0x168f0a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5046c5,_0xd3806b){_0x5046c5=_0x5046c5-0x0;var _0x3898e8=_0xe5b3[_0x5046c5];return _0x3898e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 0e9546b..905be57 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 _0x0c5c=['request-promise','path','rimraf','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','api','bluebird'];(function(_0x528cd4,_0x278665){var _0x3e20fc=function(_0x38ecba){while(--_0x38ecba){_0x528cd4['push'](_0x528cd4['shift']());}};_0x3e20fc(++_0x278665);}(_0x0c5c,0x8b));var _0xc0c5=function(_0x91103c,_0x250852){_0x91103c=_0x91103c-0x0;var _0x2ef0e1=_0x0c5c[_0x91103c];return _0x2ef0e1;};'use strict';var _=require(_0xc0c5('0x0'));var util=require(_0xc0c5('0x1'));var logger=require('../../config/logger')(_0xc0c5('0x2'));var moment=require('moment');var BPromise=require(_0xc0c5('0x3'));var rp=require(_0xc0c5('0x4'));var fs=require('fs');var path=require(_0xc0c5('0x5'));var rimraf=require(_0xc0c5('0x6'));var config=require('../../config/environment');var attributes=require(_0xc0c5('0x7'));module['exports']=function(_0x4739de,_0x1b76d0){return _0x4739de[_0xc0c5('0x8')](_0xc0c5('0x9'),attributes,{'tableName':_0xc0c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ec1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','Trunk','tools_trunks','lodash','../../config/logger','api'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x7ec1,0x99));var _0x17ec=function(_0x5741f4,_0x2ce7d4){_0x5741f4=_0x5741f4-0x0;var _0x123f70=_0x7ec1[_0x5741f4];return _0x123f70;};'use strict';var _=require(_0x17ec('0x0'));var util=require('util');var logger=require(_0x17ec('0x1'))(_0x17ec('0x2'));var moment=require(_0x17ec('0x3'));var BPromise=require(_0x17ec('0x4'));var rp=require(_0x17ec('0x5'));var fs=require('fs');var path=require(_0x17ec('0x6'));var rimraf=require(_0x17ec('0x7'));var config=require(_0x17ec('0x8'));var attributes=require(_0x17ec('0x9'));module['exports']=function(_0x428ac7,_0x1c47da){return _0x428ac7['define'](_0x17ec('0xa'),attributes,{'tableName':_0x17ec('0xb'),'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 cd17fd0..5504b48 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 _0xae7f=['GetTrunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xfb8f31,_0x2d3880){var _0x28b6e0=function(_0x4a3f1e){while(--_0x4a3f1e){_0xfb8f31['push'](_0xfb8f31['shift']());}};_0x28b6e0(++_0x2d3880);}(_0xae7f,0x174));var _0xfae7=function(_0x499b96,_0x3866dd){_0x499b96=_0x499b96-0x0;var _0x2ac812=_0xae7f[_0x499b96];return _0x2ac812;};'use strict';var _=require(_0xfae7('0x0'));var util=require(_0xfae7('0x1'));var moment=require(_0xfae7('0x2'));var BPromise=require(_0xfae7('0x3'));var rs=require(_0xfae7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfae7('0x5'))['db'];var utils=require(_0xfae7('0x6'));var logger=require('../../config/logger')(_0xfae7('0x7'));var config=require(_0xfae7('0x8'));var jayson=require(_0xfae7('0x9'));var client=jayson[_0xfae7('0xa')][_0xfae7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43c651,_0x2bf756,_0x114798){return new BPromise(function(_0xb90695,_0x118ff1){return client['request'](_0x43c651,_0x114798)[_0xfae7('0xc')](function(_0x106c87){logger[_0xfae7('0xd')](_0xfae7('0xe'),_0x2bf756,_0xfae7('0xf'));logger[_0xfae7('0x10')](_0xfae7('0x11'),_0x2bf756,_0xfae7('0xf'),JSON[_0xfae7('0x12')](_0x106c87));if(_0x106c87[_0xfae7('0x13')]){if(_0x106c87[_0xfae7('0x13')][_0xfae7('0x14')]===0x1f4){logger[_0xfae7('0x13')](_0xfae7('0xe'),_0x2bf756,_0x106c87[_0xfae7('0x13')]['message']);return _0x118ff1(_0x106c87[_0xfae7('0x13')]['message']);}logger[_0xfae7('0x13')]('Trunk,\x20%s,\x20%s',_0x2bf756,_0x106c87[_0xfae7('0x13')][_0xfae7('0x15')]);return _0xb90695(_0x106c87[_0xfae7('0x13')]['message']);}else{logger[_0xfae7('0xd')](_0xfae7('0xe'),_0x2bf756,_0xfae7('0xf'));_0xb90695(_0x106c87[_0xfae7('0x16')]['message']);}})[_0xfae7('0x17')](function(_0x360cbf){logger[_0xfae7('0x13')](_0xfae7('0xe'),_0x2bf756,_0x360cbf);_0x118ff1(_0x360cbf);});});}exports[_0xfae7('0x18')]=function(_0x18b047){var _0x2bb4d9=this;return new Promise(function(_0x3b9995,_0x336fe9){return db['Trunk'][_0xfae7('0x19')]({'raw':_0x18b047['options']?_0x18b047[_0xfae7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x18b047[_0xfae7('0x1a')]?_0x18b047['options'][_0xfae7('0x1b')]||null:null,'attributes':_0x18b047[_0xfae7('0x1a')]?_0x18b047[_0xfae7('0x1a')][_0xfae7('0x1c')]||null:null,'limit':_0x18b047[_0xfae7('0x1a')]?_0x18b047[_0xfae7('0x1a')][_0xfae7('0x1d')]||null:null,'include':_0x18b047['options']?_0x18b047[_0xfae7('0x1a')][_0xfae7('0x1e')]?_[_0xfae7('0x1f')](_0x18b047['options'][_0xfae7('0x1e')],function(_0x5e2d9f){return{'model':db[_0x5e2d9f[_0xfae7('0x20')]],'as':_0x5e2d9f['as'],'attributes':_0x5e2d9f[_0xfae7('0x1c')],'include':_0x5e2d9f[_0xfae7('0x1e')]?_[_0xfae7('0x1f')](_0x5e2d9f[_0xfae7('0x1e')],function(_0xadeb9d){return{'model':db[_0xadeb9d[_0xfae7('0x20')]],'as':_0xadeb9d['as'],'attributes':_0xadeb9d['attributes'],'include':_0xadeb9d[_0xfae7('0x1e')]?_[_0xfae7('0x1f')](_0xadeb9d[_0xfae7('0x1e')],function(_0x22ac32){return{'model':db[_0x22ac32[_0xfae7('0x20')]],'as':_0x22ac32['as'],'attributes':_0x22ac32[_0xfae7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x590323){logger['info'](_0xfae7('0x18'),_0x18b047);logger[_0xfae7('0x10')](_0xfae7('0x18'),_0x18b047,JSON[_0xfae7('0x12')](_0x590323));_0x3b9995(_0x590323);})['catch'](function(_0x2e09c6){logger[_0xfae7('0x13')](_0xfae7('0x18'),_0x2e09c6['message'],_0x18b047);_0x336fe9(_0x2bb4d9[_0xfae7('0x13')](0x1f4,_0x2e09c6['message']));});});};exports[_0xfae7('0x21')]=function(_0x30111b){var _0x11fe91=this;return new Promise(function(_0x1b7e65,_0x4a2a35){return db['Trunk'][_0xfae7('0x22')]({'raw':_0x30111b['options']?_0x30111b[_0xfae7('0x1a')][_0xfae7('0x23')]===undefined?!![]:![]:!![],'where':_0x30111b[_0xfae7('0x1a')]?_0x30111b[_0xfae7('0x1a')]['where']||null:null,'attributes':_0x30111b['options']?_0x30111b[_0xfae7('0x1a')][_0xfae7('0x1c')]||null:null,'include':_0x30111b[_0xfae7('0x1a')]?_0x30111b[_0xfae7('0x1a')][_0xfae7('0x1e')]?_[_0xfae7('0x1f')](_0x30111b['options']['include'],function(_0x41e55d){return{'model':db[_0x41e55d[_0xfae7('0x20')]],'as':_0x41e55d['as'],'attributes':_0x41e55d[_0xfae7('0x1c')],'include':_0x41e55d[_0xfae7('0x1e')]?_[_0xfae7('0x1f')](_0x41e55d[_0xfae7('0x1e')],function(_0x3a78f1){return{'model':db[_0x3a78f1[_0xfae7('0x20')]],'as':_0x3a78f1['as'],'attributes':_0x3a78f1['attributes'],'include':_0x3a78f1[_0xfae7('0x1e')]?_['map'](_0x3a78f1[_0xfae7('0x1e')],function(_0x1cf245){return{'model':db[_0x1cf245[_0xfae7('0x20')]],'as':_0x1cf245['as'],'attributes':_0x1cf245[_0xfae7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfae7('0xc')](function(_0x346ecd){logger[_0xfae7('0xd')](_0xfae7('0x21'),_0x30111b);logger[_0xfae7('0x10')](_0xfae7('0x21'),_0x30111b,JSON['stringify'](_0x346ecd));_0x1b7e65(_0x346ecd);})[_0xfae7('0x17')](function(_0x2e9559){logger[_0xfae7('0x13')](_0xfae7('0x21'),_0x2e9559[_0xfae7('0x15')],_0x30111b);_0x4a2a35(_0x11fe91[_0xfae7('0x13')](0x1f4,_0x2e9559[_0xfae7('0x15')]));});});}; \ No newline at end of file +var _0x84b8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','ShowTrunk','debug','lodash','util','moment','randomstring'];(function(_0x1d8fa1,_0x18d00f){var _0x528467=function(_0x259e18){while(--_0x259e18){_0x1d8fa1['push'](_0x1d8fa1['shift']());}};_0x528467(++_0x18d00f);}(_0x84b8,0x7c));var _0x884b=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x84b8[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x884b('0x0'));var util=require(_0x884b('0x1'));var moment=require(_0x884b('0x2'));var BPromise=require('bluebird');var rs=require(_0x884b('0x3'));var fs=require('fs');var Redis=require(_0x884b('0x4'));var db=require(_0x884b('0x5'))['db'];var utils=require(_0x884b('0x6'));var logger=require(_0x884b('0x7'))(_0x884b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x884b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49463d,_0x44c5e1,_0x2194da){return new BPromise(function(_0x218948,_0xaa5112){return client[_0x884b('0xa')](_0x49463d,_0x2194da)[_0x884b('0xb')](function(_0x2f58e8){logger[_0x884b('0xc')](_0x884b('0xd'),_0x44c5e1,_0x884b('0xe'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x44c5e1,'request\x20sent',JSON[_0x884b('0xf')](_0x2f58e8));if(_0x2f58e8[_0x884b('0x10')]){if(_0x2f58e8[_0x884b('0x10')][_0x884b('0x11')]===0x1f4){logger[_0x884b('0x10')]('Trunk,\x20%s,\x20%s',_0x44c5e1,_0x2f58e8[_0x884b('0x10')][_0x884b('0x12')]);return _0xaa5112(_0x2f58e8[_0x884b('0x10')][_0x884b('0x12')]);}logger[_0x884b('0x10')]('Trunk,\x20%s,\x20%s',_0x44c5e1,_0x2f58e8[_0x884b('0x10')]['message']);return _0x218948(_0x2f58e8[_0x884b('0x10')]['message']);}else{logger[_0x884b('0xc')](_0x884b('0xd'),_0x44c5e1,_0x884b('0xe'));_0x218948(_0x2f58e8['result'][_0x884b('0x12')]);}})[_0x884b('0x13')](function(_0x5ab7df){logger['error'](_0x884b('0xd'),_0x44c5e1,_0x5ab7df);_0xaa5112(_0x5ab7df);});});}exports[_0x884b('0x14')]=function(_0x140f8f){var _0x53c8fe=this;return new Promise(function(_0x27c241,_0x598782){return db[_0x884b('0x15')]['findAll']({'raw':_0x140f8f[_0x884b('0x16')]?_0x140f8f[_0x884b('0x16')][_0x884b('0x17')]===undefined?!![]:![]:!![],'where':_0x140f8f[_0x884b('0x16')]?_0x140f8f['options'][_0x884b('0x18')]||null:null,'attributes':_0x140f8f[_0x884b('0x16')]?_0x140f8f[_0x884b('0x16')][_0x884b('0x19')]||null:null,'limit':_0x140f8f[_0x884b('0x16')]?_0x140f8f[_0x884b('0x16')][_0x884b('0x1a')]||null:null,'include':_0x140f8f[_0x884b('0x16')]?_0x140f8f['options'][_0x884b('0x1b')]?_['map'](_0x140f8f[_0x884b('0x16')][_0x884b('0x1b')],function(_0x4ded53){return{'model':db[_0x4ded53[_0x884b('0x1c')]],'as':_0x4ded53['as'],'attributes':_0x4ded53[_0x884b('0x19')],'include':_0x4ded53['include']?_[_0x884b('0x1d')](_0x4ded53[_0x884b('0x1b')],function(_0x47571b){return{'model':db[_0x47571b[_0x884b('0x1c')]],'as':_0x47571b['as'],'attributes':_0x47571b['attributes'],'include':_0x47571b['include']?_[_0x884b('0x1d')](_0x47571b[_0x884b('0x1b')],function(_0x5ae893){return{'model':db[_0x5ae893[_0x884b('0x1c')]],'as':_0x5ae893['as'],'attributes':_0x5ae893[_0x884b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x884b('0xb')](function(_0x446472){logger[_0x884b('0xc')](_0x884b('0x14'),_0x140f8f);logger['debug'](_0x884b('0x14'),_0x140f8f,JSON['stringify'](_0x446472));_0x27c241(_0x446472);})[_0x884b('0x13')](function(_0x5c3a52){logger['error'](_0x884b('0x14'),_0x5c3a52['message'],_0x140f8f);_0x598782(_0x53c8fe[_0x884b('0x10')](0x1f4,_0x5c3a52[_0x884b('0x12')]));});});};exports[_0x884b('0x1e')]=function(_0x5dc04a){var _0x7ae7e1=this;return new Promise(function(_0x5b73d0,_0x391390){return db[_0x884b('0x15')]['find']({'raw':_0x5dc04a[_0x884b('0x16')]?_0x5dc04a[_0x884b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5dc04a[_0x884b('0x16')]?_0x5dc04a[_0x884b('0x16')][_0x884b('0x18')]||null:null,'attributes':_0x5dc04a['options']?_0x5dc04a['options'][_0x884b('0x19')]||null:null,'include':_0x5dc04a[_0x884b('0x16')]?_0x5dc04a[_0x884b('0x16')][_0x884b('0x1b')]?_['map'](_0x5dc04a[_0x884b('0x16')][_0x884b('0x1b')],function(_0x1b9f83){return{'model':db[_0x1b9f83[_0x884b('0x1c')]],'as':_0x1b9f83['as'],'attributes':_0x1b9f83[_0x884b('0x19')],'include':_0x1b9f83[_0x884b('0x1b')]?_['map'](_0x1b9f83[_0x884b('0x1b')],function(_0x4a3939){return{'model':db[_0x4a3939['model']],'as':_0x4a3939['as'],'attributes':_0x4a3939[_0x884b('0x19')],'include':_0x4a3939[_0x884b('0x1b')]?_[_0x884b('0x1d')](_0x4a3939['include'],function(_0x45e572){return{'model':db[_0x45e572['model']],'as':_0x45e572['as'],'attributes':_0x45e572[_0x884b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x884b('0xb')](function(_0x119a0d){logger[_0x884b('0xc')](_0x884b('0x1e'),_0x5dc04a);logger[_0x884b('0x1f')]('ShowTrunk',_0x5dc04a,JSON['stringify'](_0x119a0d));_0x5b73d0(_0x119a0d);})[_0x884b('0x13')](function(_0x5eec2d){logger[_0x884b('0x10')]('ShowTrunk',_0x5eec2d[_0x884b('0x12')],_0x5dc04a);_0x391390(_0x7ae7e1[_0x884b('0x10')](0x1f4,_0x5eec2d['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c44af99..2629265 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 _0x2dd8=['/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','whoami','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','getAgents'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0x2dd8,0xbe));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var path=require(_0x82dd('0x2'));var timeout=require(_0x82dd('0x3'));var express=require(_0x82dd('0x4'));var router=express['Router']();var fs_extra=require(_0x82dd('0x5'));var auth=require(_0x82dd('0x6'));var interaction=require(_0x82dd('0x7'));var config=require(_0x82dd('0x8'));var controller=require(_0x82dd('0x9'));router['get']('/',auth[_0x82dd('0xa')](),controller[_0x82dd('0xb')]);router[_0x82dd('0xc')]('/describe',auth[_0x82dd('0xa')](),controller[_0x82dd('0xd')]);router['get'](_0x82dd('0xe'),auth[_0x82dd('0xa')](),controller[_0x82dd('0xf')]);router[_0x82dd('0xc')]('/presence',auth[_0x82dd('0xa')](),controller['getPresence']);router[_0x82dd('0xc')]('/:id',auth[_0x82dd('0xa')](),controller[_0x82dd('0x10')]);router[_0x82dd('0xc')](_0x82dd('0x11'),controller[_0x82dd('0x12')]);router[_0x82dd('0xc')](_0x82dd('0x13'),auth['isAuthenticated'](),controller[_0x82dd('0x14')]);router['get'](_0x82dd('0x15'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x16')]);router[_0x82dd('0xc')](_0x82dd('0x17'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x18')]);router[_0x82dd('0xc')](_0x82dd('0x19'),auth['isAuthenticated'](),controller[_0x82dd('0x1a')]);router['get'](_0x82dd('0x1b'),auth[_0x82dd('0xa')](),controller['getGroups']);router[_0x82dd('0xc')]('/:id/recordings',auth[_0x82dd('0xa')](),controller[_0x82dd('0x1c')]);router[_0x82dd('0xc')](_0x82dd('0x1d'),auth['isAuthenticated'](),controller[_0x82dd('0x1e')]);router['get'](_0x82dd('0x1f'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x20')]);router[_0x82dd('0xc')]('/:id/openchannel/interactions',auth[_0x82dd('0xa')](),controller[_0x82dd('0x21')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x82dd('0x22')]);router['get'](_0x82dd('0x23'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x82dd('0xc')](_0x82dd('0x24'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x25')]);router['get'](_0x82dd('0x26'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x27')]);router[_0x82dd('0xc')](_0x82dd('0x28'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x29')]);router['get']('/:id/lists',auth[_0x82dd('0xa')](),controller[_0x82dd('0x2a')]);router[_0x82dd('0xc')]('/:id/agents',auth['isAuthenticated'](),controller[_0x82dd('0x2b')]);router[_0x82dd('0xc')](_0x82dd('0x2c'),auth['isAuthenticated'](),controller[_0x82dd('0x2d')]);router[_0x82dd('0xc')](_0x82dd('0x2e'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x2f')]);router[_0x82dd('0xc')](_0x82dd('0x30'),auth['isAuthenticated'](),controller[_0x82dd('0x31')]);router['get'](_0x82dd('0x32'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x33')]);router['get']('/:id/sms_accounts',auth[_0x82dd('0xa')](),controller[_0x82dd('0x34')]);router['get'](_0x82dd('0x35'),auth['isAuthenticated'](),controller[_0x82dd('0x36')]);router[_0x82dd('0xc')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x82dd('0x37')]);router[_0x82dd('0xc')](_0x82dd('0x38'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x39')]);router[_0x82dd('0xc')](_0x82dd('0x3a'),auth['isAuthenticated'](),controller[_0x82dd('0x3b')]);router[_0x82dd('0xc')](_0x82dd('0x3c'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x3d')]);router['post']('/:id/contacts',auth[_0x82dd('0xa')](),controller[_0x82dd('0x3e')]);router[_0x82dd('0x3f')]('/',auth[_0x82dd('0xa')](),controller['create']);router[_0x82dd('0x3f')](_0x82dd('0x40'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x41')]);router[_0x82dd('0x3f')](_0x82dd('0x17'),auth[_0x82dd('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x82dd('0x42')]({'destination':function(_0x4a84b4,_0x45be41,_0x2c1210){_0x2c1210(null,path[_0x82dd('0x43')](config[_0x82dd('0x44')],_0x82dd('0x45')));},'filename':function(_0x227b70,_0x39b252,_0x4e1541){_0x4e1541(null,util[_0x82dd('0x46')](_0x82dd('0x47'),Date[_0x82dd('0x48')](),_0x39b252['originalname']));}})});router[_0x82dd('0x3f')](_0x82dd('0x11'),upload[_0x82dd('0x49')]('file'),controller['addAvatar']);router[_0x82dd('0x3f')]('/:id/login',auth[_0x82dd('0xa')](),controller[_0x82dd('0x4a')]);router[_0x82dd('0x3f')](_0x82dd('0x4b'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x4c')]);router[_0x82dd('0x3f')](_0x82dd('0x4d'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x4e')]);router[_0x82dd('0x3f')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x82dd('0x4f')]);router[_0x82dd('0x3f')](_0x82dd('0x28'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x50')]);router[_0x82dd('0x3f')](_0x82dd('0x51'),auth[_0x82dd('0xa')](),controller['addChatInteractions']);router['post'](_0x82dd('0x52'),auth[_0x82dd('0xa')](),controller['addMailInteractions']);router[_0x82dd('0x3f')](_0x82dd('0x53'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x54')]);router[_0x82dd('0x3f')](_0x82dd('0x55'),auth['isAuthenticated'](),controller[_0x82dd('0x56')]);router[_0x82dd('0x3f')]('/:id/openchannel_interactions',auth[_0x82dd('0xa')](),controller[_0x82dd('0x57')]);router[_0x82dd('0x3f')](_0x82dd('0x58'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x59')]);router[_0x82dd('0x3f')](_0x82dd('0x2e'),auth['isAuthenticated'](),controller[_0x82dd('0x5a')]);router['post'](_0x82dd('0x30'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x5b')]);router[_0x82dd('0x3f')](_0x82dd('0x32'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x82dd('0x3f')](_0x82dd('0x5c'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x5d')]);router[_0x82dd('0x3f')](_0x82dd('0x35'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x5e')]);router[_0x82dd('0x3f')](_0x82dd('0x5f'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x60')]);router[_0x82dd('0x3f')](_0x82dd('0x38'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x61')]);router[_0x82dd('0x3f')]('/:id/api_key',auth[_0x82dd('0xa')](),controller[_0x82dd('0x62')]);router[_0x82dd('0x63')](_0x82dd('0x64'),auth[_0x82dd('0xa')](),controller['update']);router[_0x82dd('0x63')]('/:id/password',auth[_0x82dd('0xa')](),controller[_0x82dd('0x65')]);router['delete'](_0x82dd('0x17'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x66')]);router[_0x82dd('0x67')](_0x82dd('0x28'),auth[_0x82dd('0xa')](),controller['removeTeams']);router[_0x82dd('0x67')](_0x82dd('0x64'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x68')]);router[_0x82dd('0x67')]('/:id/chat_interactions',auth[_0x82dd('0xa')](),controller[_0x82dd('0x69')]);router[_0x82dd('0x67')](_0x82dd('0x52'),auth[_0x82dd('0xa')](),controller['removeMailInteractions']);router[_0x82dd('0x67')](_0x82dd('0x53'),auth['isAuthenticated'](),controller[_0x82dd('0x6a')]);router['delete'](_0x82dd('0x55'),auth['isAuthenticated'](),controller[_0x82dd('0x6b')]);router['delete'](_0x82dd('0x6c'),auth[_0x82dd('0xa')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/whatsapp_interactions',auth[_0x82dd('0xa')](),controller[_0x82dd('0x6d')]);router[_0x82dd('0x67')](_0x82dd('0x2e'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x6e')]);router['delete'](_0x82dd('0x30'),auth['isAuthenticated'](),controller[_0x82dd('0x6f')]);router[_0x82dd('0x67')](_0x82dd('0x32'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x70')]);router[_0x82dd('0x67')](_0x82dd('0x5c'),auth['isAuthenticated'](),controller[_0x82dd('0x71')]);router[_0x82dd('0x67')](_0x82dd('0x35'),auth[_0x82dd('0xa')](),controller[_0x82dd('0x72')]);router[_0x82dd('0x67')](_0x82dd('0x5f'),auth['isAuthenticated'](),controller[_0x82dd('0x73')]);router[_0x82dd('0x67')](_0x82dd('0x38'),auth[_0x82dd('0xa')](),controller['removeSquareProjects']);router[_0x82dd('0x67')]('/:id/api_key',auth[_0x82dd('0xa')](),controller['removeApiKey']);module[_0x82dd('0x74')]=router; \ No newline at end of file +var _0x2aff=['/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','removeQueues','delete','removeTeams','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/whatsapp_accounts','removeSquareProjects','removeApiKey','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/: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','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes'];(function(_0x51f50c,_0x496dbc){var _0x145d2c=function(_0x568263){while(--_0x568263){_0x51f50c['push'](_0x51f50c['shift']());}};_0x145d2c(++_0x496dbc);}(_0x2aff,0xbc));var _0xf2af=function(_0x2c0952,_0x4fecf2){_0x2c0952=_0x2c0952-0x0;var _0x4671e0=_0x2aff[_0x2c0952];return _0x4671e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf2af('0x0'));var timeout=require(_0xf2af('0x1'));var express=require(_0xf2af('0x2'));var router=express[_0xf2af('0x3')]();var fs_extra=require(_0xf2af('0x4'));var auth=require(_0xf2af('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2af('0x6'));router[_0xf2af('0x7')]('/',auth[_0xf2af('0x8')](),controller[_0xf2af('0x9')]);router[_0xf2af('0x7')](_0xf2af('0xa'),auth['isAuthenticated'](),controller[_0xf2af('0xb')]);router[_0xf2af('0x7')](_0xf2af('0xc'),auth['isAuthenticated'](),controller[_0xf2af('0xd')]);router[_0xf2af('0x7')](_0xf2af('0xe'),auth['isAuthenticated'](),controller[_0xf2af('0xf')]);router[_0xf2af('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf2af('0x7')](_0xf2af('0x10'),controller['getAvatar']);router['get'](_0xf2af('0x11'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0xf2af('0x7')](_0xf2af('0x12'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x13')]);router['get'](_0xf2af('0x14'),auth['isAuthenticated'](),controller[_0xf2af('0x15')]);router[_0xf2af('0x7')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xf2af('0x7')]('/:id/groups',auth[_0xf2af('0x8')](),controller['getGroups']);router[_0xf2af('0x7')](_0xf2af('0x16'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x17')]);router['get'](_0xf2af('0x18'),auth['isAuthenticated'](),controller[_0xf2af('0x19')]);router[_0xf2af('0x7')](_0xf2af('0x1a'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x1b')]);router[_0xf2af('0x7')](_0xf2af('0x1c'),auth[_0xf2af('0x8')](),controller['getOpenchannelInteractions']);router[_0xf2af('0x7')](_0xf2af('0x1d'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x1e')]);router['get'](_0xf2af('0x1f'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x20')]);router['get'](_0xf2af('0x21'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x22')]);router['get']('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xf2af('0x23')]);router[_0xf2af('0x7')](_0xf2af('0x24'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x25')]);router[_0xf2af('0x7')](_0xf2af('0x26'),auth['isAuthenticated'](),controller[_0xf2af('0x27')]);router[_0xf2af('0x7')](_0xf2af('0x28'),auth['isAuthenticated'](),controller[_0xf2af('0x29')]);router[_0xf2af('0x7')](_0xf2af('0x2a'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x2b')]);router[_0xf2af('0x7')](_0xf2af('0x2c'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x2d')]);router[_0xf2af('0x7')]('/:id/mail_accounts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x2e')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xf2af('0x2f')]);router[_0xf2af('0x7')]('/:id/sms_accounts',auth[_0xf2af('0x8')](),controller['getSmsAccounts']);router['get'](_0xf2af('0x30'),auth[_0xf2af('0x8')](),controller['getChatWebsites']);router[_0xf2af('0x7')]('/:id/whatsapp_accounts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x31')]);router[_0xf2af('0x7')](_0xf2af('0x32'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x33')]);router[_0xf2af('0x7')](_0xf2af('0x34'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x35')]);router[_0xf2af('0x7')](_0xf2af('0x36'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x37')]);router[_0xf2af('0x38')]('/:id/contacts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x39')]);router[_0xf2af('0x38')]('/',auth['isAuthenticated'](),controller[_0xf2af('0x3a')]);router['post'](_0xf2af('0x3b'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x3c')]);router[_0xf2af('0x38')]('/:id/queues',auth[_0xf2af('0x8')](),controller[_0xf2af('0x3d')]);var upload=multer({'storage':multer[_0xf2af('0x3e')]({'destination':function(_0x7b91cf,_0x53cf6b,_0x57dc7c){_0x57dc7c(null,path[_0xf2af('0x3f')](config[_0xf2af('0x40')],_0xf2af('0x41')));},'filename':function(_0x496bcd,_0x431663,_0xdcf7c0){_0xdcf7c0(null,util[_0xf2af('0x42')](_0xf2af('0x43'),Date[_0xf2af('0x44')](),_0x431663['originalname']));}})});router['post'](_0xf2af('0x10'),upload[_0xf2af('0x45')]('file'),controller[_0xf2af('0x46')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0xf2af('0x47')]);router['post'](_0xf2af('0x48'),auth['isAuthenticated'](),controller[_0xf2af('0x49')]);router[_0xf2af('0x38')](_0xf2af('0x4a'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x4b')]);router[_0xf2af('0x38')](_0xf2af('0x4c'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x4d')]);router['post']('/:id/teams',auth[_0xf2af('0x8')](),controller[_0xf2af('0x4e')]);router['post']('/:id/chat_interactions',auth[_0xf2af('0x8')](),controller[_0xf2af('0x4f')]);router['post'](_0xf2af('0x50'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x51')]);router[_0xf2af('0x38')](_0xf2af('0x52'),auth[_0xf2af('0x8')](),controller['addFaxInteractions']);router['post'](_0xf2af('0x53'),auth['isAuthenticated'](),controller[_0xf2af('0x54')]);router[_0xf2af('0x38')](_0xf2af('0x55'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x56')]);router[_0xf2af('0x38')](_0xf2af('0x57'),auth[_0xf2af('0x8')](),controller['addWhatsappInteractions']);router[_0xf2af('0x38')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xf2af('0x58')]);router['post'](_0xf2af('0x59'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x5a')]);router[_0xf2af('0x38')]('/:id/openchannel_accounts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x5b')]);router['post'](_0xf2af('0x5c'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x5d')]);router[_0xf2af('0x38')](_0xf2af('0x30'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x5e')]);router[_0xf2af('0x38')]('/:id/whatsapp_accounts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x5f')]);router[_0xf2af('0x38')](_0xf2af('0x32'),auth[_0xf2af('0x8')](),controller['addSquareProjects']);router[_0xf2af('0x38')](_0xf2af('0x36'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x60')]);router[_0xf2af('0x61')](_0xf2af('0x62'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x63')]);router[_0xf2af('0x61')](_0xf2af('0x64'),auth[_0xf2af('0x8')](),controller['changePassword']);router['delete'](_0xf2af('0x14'),auth['isAuthenticated'](),controller[_0xf2af('0x65')]);router[_0xf2af('0x66')](_0xf2af('0x24'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x67')]);router[_0xf2af('0x66')](_0xf2af('0x62'),auth[_0xf2af('0x8')](),controller['destroy']);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xf2af('0x66')]('/:id/mail_interactions',auth[_0xf2af('0x8')](),controller[_0xf2af('0x68')]);router[_0xf2af('0x66')]('/:id/fax_interactions',auth[_0xf2af('0x8')](),controller['removeFaxInteractions']);router['delete'](_0xf2af('0x53'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x69')]);router[_0xf2af('0x66')](_0xf2af('0x55'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x6a')]);router['delete'](_0xf2af('0x57'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x6b')]);router['delete']('/:id/fax_accounts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x6c')]);router[_0xf2af('0x66')]('/:id/mail_accounts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x6d')]);router[_0xf2af('0x66')]('/:id/openchannel_accounts',auth[_0xf2af('0x8')](),controller[_0xf2af('0x6e')]);router[_0xf2af('0x66')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xf2af('0x6f')]);router[_0xf2af('0x66')](_0xf2af('0x30'),auth[_0xf2af('0x8')](),controller['removeChatWebsites']);router[_0xf2af('0x66')](_0xf2af('0x70'),auth[_0xf2af('0x8')](),controller['removeWhatsappAccounts']);router[_0xf2af('0x66')](_0xf2af('0x32'),auth[_0xf2af('0x8')](),controller[_0xf2af('0x71')]);router[_0xf2af('0x66')](_0xf2af('0x36'),auth['isAuthenticated'](),controller[_0xf2af('0x72')]);module[_0xf2af('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1d7609e..df2d200 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 _0x31c2=['info','shortinfo','inband','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','uas','fingerprint','certificate','passive','nonat','TEXT','wss','avpf','force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','encryption','dtlsenable','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833'];(function(_0x28ee74,_0x289441){var _0x6cc80c=function(_0x16ee15){while(--_0x16ee15){_0x28ee74['push'](_0x28ee74['shift']());}};_0x6cc80c(++_0x289441);}(_0x31c2,0x1e1));var _0x231c=function(_0x1c0c20,_0x210cf9){_0x1c0c20=_0x1c0c20-0x0;var _0x541748=_0x31c2[_0x1c0c20];return _0x541748;};'use strict';var Sequelize=require(_0x231c('0x0'));var moment=require(_0x231c('0x1'));var util=require(_0x231c('0x2'));var _=require(_0x231c('0x3'));module[_0x231c('0x4')]={'name':{'type':Sequelize[_0x231c('0x5')],'allowNull':![],'unique':_0x231c('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5a8f6b){this['setDataValue']('name',_0x5a8f6b);this[_0x231c('0x7')](_0x231c('0x8'),_0x5a8f6b);},'comment':_0x231c('0x9')},'fullname':{'type':Sequelize[_0x231c('0x5')],'allowNull':![],'set':function(_0x48bfb2){this[_0x231c('0x7')]('fullname',_0x48bfb2);this[_0x231c('0x7')](_0x231c('0xa'),util[_0x231c('0xb')]('\x22%s\x22\x20<%s>',_0x48bfb2,this[_0x231c('0xc')](_0x231c('0xd'))));}},'alias':{'type':Sequelize[_0x231c('0x5')]},'email':{'type':Sequelize[_0x231c('0x5')],'allowNull':![],'unique':_0x231c('0xe'),'validate':{'isEmail':!![]},'set':function(_0x46c0a6){if(_0x46c0a6){this[_0x231c('0x7')]('email',_0x46c0a6[_0x231c('0xf')]());}}},'role':{'type':Sequelize[_0x231c('0x10')]('admin',_0x231c('0x11'),_0x231c('0x12'),_0x231c('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x231c('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x231c('0x5')],'defaultValue':_0x231c('0x14')},'internal':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':![],'unique':_0x231c('0xd'),'set':function(_0xc09de5){this[_0x231c('0x7')](_0x231c('0xd'),_0xc09de5);this[_0x231c('0x7')](_0x231c('0x16'),_0xc09de5);this[_0x231c('0x7')](_0x231c('0xa'),util[_0x231c('0xb')](_0x231c('0x17'),this[_0x231c('0xc')](_0x231c('0x18')),_0xc09de5));}},'salt':{'type':Sequelize[_0x231c('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x231c('0x5')]},'address':{'type':Sequelize[_0x231c('0x5')]},'zipcode':{'type':Sequelize[_0x231c('0x5')]},'userpic':{'type':Sequelize[_0x231c('0x5')]},'city':{'type':Sequelize[_0x231c('0x5')]},'country':{'type':Sequelize[_0x231c('0x5')]},'online':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x231c('0x1a')]},'voicePause':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x231c('0x5')],'defaultValue':_0x231c('0x1b')},'lastPauseAt':{'type':Sequelize[_0x231c('0x1a')]},'chatCapacity':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x231c('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x231c('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![],'defaultValue':_0x231c('0x1c')},'ipaddr':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x231c('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x1d'),_0x231c('0x11'),_0x231c('0x1e')),'allowNull':!![],'defaultValue':_0x231c('0x1d')},'context':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![],'defaultValue':_0x231c('0x1f')},'callingpres':{'type':Sequelize['ENUM'](_0x231c('0x20'),_0x231c('0x21'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x231c('0x22'),'PROHIB_FAILED_SCREEN',_0x231c('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x231c('0x24'),'set':function(_0x379017){this[_0x231c('0x7')](_0x231c('0x25'),_0x379017?_0x379017[_0x231c('0x26')](','):null);},'get':function(){return this[_0x231c('0xc')](_0x231c('0x25'))?this[_0x231c('0xc')]('transport')['split'](','):null;},'comment':_0x231c('0x27')},'dtmfmode':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x28'),_0x231c('0x29'),_0x231c('0x2a'),_0x231c('0x2b'),'auto'),'allowNull':!![],'defaultValue':_0x231c('0x28')},'directmedia':{'type':Sequelize[_0x231c('0x10')]('yes','no','nonat',_0x231c('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x231c('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x231c('0x2d'),'set':function(_0x433952){this[_0x231c('0x7')]('nat',_0x433952?_0x433952[_0x231c('0x26')](','):null);},'get':function(){return this[_0x231c('0xc')](_0x231c('0x2e'))?this[_0x231c('0xc')](_0x231c('0x2e'))[_0x231c('0x2f')](','):null;},'comment':_0x231c('0x30')},'callgroup':{'type':Sequelize[_0x231c('0x5')]},'namedcallgroup':{'type':Sequelize[_0x231c('0x5')]},'pickupgroup':{'type':Sequelize[_0x231c('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x231c('0x5')]},'language':{'type':Sequelize[_0x231c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x231c('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x231c('0x31')},'allow':{'type':Sequelize[_0x231c('0x5')],'allowNull':![],'defaultValue':_0x231c('0x32'),'set':function(_0x2f763d){this[_0x231c('0x7')]('allow',_0x2f763d?_0x2f763d[_0x231c('0x26')](';'):_0x231c('0x32'));},'get':function(){return this[_0x231c('0xc')]('allow')?this[_0x231c('0xc')](_0x231c('0x33'))[_0x231c('0x2f')](';'):null;},'comment':_0x231c('0x34')},'autoframing':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x256c51){this[_0x231c('0x7')](_0x231c('0x36'),_0x256c51?_0x256c51[_0x231c('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x231c('0x36'))?this['getDataValue'](_0x231c('0x36'))['split'](','):null;},'comment':_0x231c('0x37')},'trustrpid':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x231c('0x10')]('yes','no',_0x231c('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x231c('0x35'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x231c('0x35'),'no'),'allowNull':!![],'defaultValue':_0x231c('0x35')},'busylevel':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x231c('0x10')]('yes','no',_0x231c('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x231c('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x231c('0x10')]('uac',_0x231c('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x231c('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x231c('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x231c('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no',_0x231c('0x3c'),_0x231c('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x231c('0x10')]('active',_0x231c('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x231c('0x3f'),_0x231c('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x231c('0x1a')]},'passwordResetAt':{'type':Sequelize[_0x231c('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x231c('0x40')]},'showWebBar':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0,'set':function(_0x48198c){this[_0x231c('0x7')]('showWebBar',_0x48198c);var _0x13fd0f=this['get']({'plain':!![]});switch(_0x48198c){case 0x0:case 0x1:var _0x55594b=_0x13fd0f[_0x231c('0x25')]?_['isArray'](_0x13fd0f[_0x231c('0x25')])?_0x13fd0f[_0x231c('0x25')]['join']():_0x13fd0f[_0x231c('0x25')]:_0x231c('0x24');if(_0x55594b===_0x231c('0x41')){_0x55594b=_0x231c('0x24');}this[_0x231c('0x7')](_0x231c('0x25'),_0x55594b);this['setDataValue']('encryption','no');this['setDataValue'](_0x231c('0x42'),null);this[_0x231c('0x7')](_0x231c('0x43'),null);this[_0x231c('0x7')](_0x231c('0x44'),null);this['setDataValue']('dtlsenable',null);this[_0x231c('0x7')](_0x231c('0x45'),null);this[_0x231c('0x7')]('dtlssetup',null);this[_0x231c('0x7')](_0x231c('0x46'),null);this[_0x231c('0x7')](_0x231c('0x47'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x231c('0x25'),_0x231c('0x41'));this['setDataValue'](_0x231c('0x48'),_0x231c('0x35'));this[_0x231c('0x7')](_0x231c('0x42'),_0x231c('0x35'));this[_0x231c('0x7')]('force_avp',_0x231c('0x35'));this[_0x231c('0x7')](_0x231c('0x44'),'yes');this[_0x231c('0x7')](_0x231c('0x49'),_0x231c('0x35'));this['setDataValue'](_0x231c('0x45'),'no');this[_0x231c('0x7')]('dtlssetup','actpass');this[_0x231c('0x7')](_0x231c('0x46'),_0x13fd0f[_0x231c('0x46')]||_0x231c('0x4a'));this[_0x231c('0x7')](_0x231c('0x47'),_0x13fd0f[_0x231c('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x231c('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x231c('0x40')],'set':function(_0x1ce389){this['setDataValue'](_0x231c('0x4c'),_0x1ce389?_0x1ce389[_0x231c('0x26')](','):[]);},'get':function(){return this['getDataValue'](_0x231c('0x4c'))?_['map'](this[_0x231c('0xc')](_0x231c('0x4c'))['split'](','),function(_0xfd2993){return parseInt(_0xfd2993,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x231c('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x231c('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x231c('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x231c('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x231c('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x231c('0x10')](_0x231c('0x35'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x231c('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x231c('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x231c('0x4d')],'get':function(){return this[_0x231c('0xc')](_0x231c('0x4e'))?this[_0x231c('0xc')](_0x231c('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0x231c('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x231c('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![],'set':function(_0x5c6fa5){if(typeof _0x5c6fa5===_0x231c('0x4f')){var _0x38091f=_0x5c6fa5==='1'?!![]:_0x5c6fa5==='0'?![]:_0x5c6fa5===_0x231c('0x50')?!![]:_0x5c6fa5===_0x231c('0x51')?![]:![];this['setDataValue']('screenrecording',_0x38091f);}else{this['setDataValue'](_0x231c('0x52'),_0x5c6fa5);}}},'blocked':{'type':Sequelize[_0x231c('0x19')],'defaultValue':![],'set':function(_0x5d9530){this[_0x231c('0x7')](_0x231c('0x53'),_0x5d9530);if(_0x5d9530===!![]){this['setDataValue'](_0x231c('0x54'),moment());this['setDataValue'](_0x231c('0x55'),0x0);}else{this[_0x231c('0x7')](_0x231c('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x231c('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x231c('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x231c('0x15')](0x5)[_0x231c('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x231c('0x19')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x231c('0x19')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02a7=['active','passive','actpass','showWebBar','get','isArray','udp','wss','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','uac','uas','fingerprint'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x02a7,0x7a));var _0x702a=function(_0x275188,_0x3fc7ee){_0x275188=_0x275188-0x0;var _0x196295=_0x02a7[_0x275188];return _0x196295;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x702a('0x0'));var util=require('util');var _=require('lodash');module[_0x702a('0x1')]={'name':{'type':Sequelize[_0x702a('0x2')],'allowNull':![],'unique':_0x702a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xd65b34){this[_0x702a('0x4')](_0x702a('0x3'),_0xd65b34);this[_0x702a('0x4')]('defaultuser',_0xd65b34);},'comment':_0x702a('0x5')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x26b25e){this[_0x702a('0x4')](_0x702a('0x6'),_0x26b25e);this[_0x702a('0x4')](_0x702a('0x7'),util[_0x702a('0x8')](_0x702a('0x9'),_0x26b25e,this['getDataValue'](_0x702a('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x702a('0xb'),'validate':{'isEmail':!![]},'set':function(_0x3b81cb){if(_0x3b81cb){this[_0x702a('0x4')](_0x702a('0xb'),_0x3b81cb['toLowerCase']());}}},'role':{'type':Sequelize[_0x702a('0xc')](_0x702a('0xd'),_0x702a('0xe'),_0x702a('0xf'),_0x702a('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x702a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x702a('0x2')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x702a('0xa'),'set':function(_0x57f5fc){this['setDataValue']('internal',_0x57f5fc);this['setDataValue']('accountcode',_0x57f5fc);this[_0x702a('0x4')](_0x702a('0x7'),util[_0x702a('0x8')]('\x22%s\x22\x20<%s>',this['getDataValue']('fullname'),_0x57f5fc));}},'salt':{'type':Sequelize[_0x702a('0x2')]},'phone':{'type':Sequelize[_0x702a('0x2')]},'mobile':{'type':Sequelize[_0x702a('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x702a('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x702a('0x2')]},'country':{'type':Sequelize[_0x702a('0x2')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x702a('0x2')],'defaultValue':_0x702a('0x12')},'lastPauseAt':{'type':Sequelize[_0x702a('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x702a('0x11')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x702a('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x702a('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'description':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![],'defaultValue':_0x702a('0x15')},'ipaddr':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x702a('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x16'),_0x702a('0xe'),_0x702a('0x17')),'allowNull':!![],'defaultValue':_0x702a('0x16')},'context':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x18'),_0x702a('0x19'),_0x702a('0x1a'),_0x702a('0x1b'),_0x702a('0x1c'),'PROHIB_PASSED_SCREEN',_0x702a('0x1d'),_0x702a('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x5b71ea){this[_0x702a('0x4')](_0x702a('0x1f'),_0x5b71ea?_0x5b71ea[_0x702a('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x702a('0x1f'))?this[_0x702a('0x21')](_0x702a('0x1f'))[_0x702a('0x22')](','):null;},'comment':_0x702a('0x23')},'dtmfmode':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x24'),_0x702a('0x25'),_0x702a('0x26'),_0x702a('0x27'),_0x702a('0x28')),'allowNull':!![],'defaultValue':_0x702a('0x24')},'directmedia':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no',_0x702a('0x2a'),_0x702a('0x2b'),_0x702a('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x702a('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![],'defaultValue':_0x702a('0x2d'),'set':function(_0x927fd7){this[_0x702a('0x4')](_0x702a('0x2e'),_0x927fd7?_0x927fd7[_0x702a('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x702a('0x2e'))?this[_0x702a('0x21')](_0x702a('0x2e'))[_0x702a('0x22')](','):null;},'comment':_0x702a('0x2f')},'callgroup':{'type':Sequelize[_0x702a('0x2')]},'namedcallgroup':{'type':Sequelize[_0x702a('0x2')]},'pickupgroup':{'type':Sequelize[_0x702a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x702a('0x2')]},'language':{'type':Sequelize[_0x702a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x702a('0x2')]},'disallow':{'type':Sequelize[_0x702a('0x2')],'allowNull':![],'defaultValue':_0x702a('0x30')},'allow':{'type':Sequelize[_0x702a('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x252b54){this[_0x702a('0x4')](_0x702a('0x31'),_0x252b54?_0x252b54['join'](';'):_0x702a('0x32'));},'get':function(){return this[_0x702a('0x21')](_0x702a('0x31'))?this[_0x702a('0x21')](_0x702a('0x31'))[_0x702a('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![],'set':function(_0x274a02){this[_0x702a('0x4')](_0x702a('0x33'),_0x274a02?_0x274a02[_0x702a('0x20')](','):null);},'get':function(){return this[_0x702a('0x21')]('insecure')?this[_0x702a('0x21')]('insecure')[_0x702a('0x22')](','):null;},'comment':_0x702a('0x34')},'trustrpid':{'type':Sequelize[_0x702a('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no',_0x702a('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![],'defaultValue':_0x702a('0x29')},'busylevel':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x702a('0x29'),'no',_0x702a('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x37'),_0x702a('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x702a('0x39'),_0x702a('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![],'defaultValue':_0x702a('0x29')},'keepalive':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x702a('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x702a('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x702a('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x3c'),_0x702a('0x3d'),_0x702a('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x702a('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x702a('0xc')](_0x702a('0x29'),'no','nonat',_0x702a('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x702a('0x13')]},'passwordResetAt':{'type':Sequelize[_0x702a('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0,'set':function(_0x312bca){this[_0x702a('0x4')](_0x702a('0x3f'),_0x312bca);var _0x4bfcae=this[_0x702a('0x40')]({'plain':!![]});switch(_0x312bca){case 0x0:case 0x1:var _0x232591=_0x4bfcae[_0x702a('0x1f')]?_[_0x702a('0x41')](_0x4bfcae[_0x702a('0x1f')])?_0x4bfcae[_0x702a('0x1f')][_0x702a('0x20')]():_0x4bfcae[_0x702a('0x1f')]:_0x702a('0x42');if(_0x232591===_0x702a('0x43')){_0x232591='udp';}this[_0x702a('0x4')](_0x702a('0x1f'),_0x232591);this[_0x702a('0x4')]('encryption','no');this[_0x702a('0x4')](_0x702a('0x44'),null);this[_0x702a('0x4')](_0x702a('0x45'),null);this[_0x702a('0x4')](_0x702a('0x46'),null);this[_0x702a('0x4')]('dtlsenable',null);this['setDataValue'](_0x702a('0x47'),null);this[_0x702a('0x4')](_0x702a('0x48'),null);this[_0x702a('0x4')]('dtlscertfile',null);this[_0x702a('0x4')](_0x702a('0x49'),null);this[_0x702a('0x4')](_0x702a('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x702a('0x1f'),'wss');this[_0x702a('0x4')](_0x702a('0x4b'),'yes');this[_0x702a('0x4')](_0x702a('0x44'),_0x702a('0x29'));this[_0x702a('0x4')]('force_avp',_0x702a('0x29'));this[_0x702a('0x4')]('icesupport','yes');this[_0x702a('0x4')]('dtlsenable',_0x702a('0x29'));this[_0x702a('0x4')](_0x702a('0x47'),'no');this['setDataValue'](_0x702a('0x48'),_0x702a('0x3e'));this[_0x702a('0x4')]('dtlscertfile',_0x4bfcae[_0x702a('0x4c')]||_0x702a('0x4d'));this[_0x702a('0x4')](_0x702a('0x49'),_0x4bfcae[_0x702a('0x49')]||_0x702a('0x4e'));this[_0x702a('0x4')]('rtcp_mux',_0x702a('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x702a('0x4f')],'set':function(_0xdb8cec){this['setDataValue'](_0x702a('0x50'),_0xdb8cec?_0xdb8cec[_0x702a('0x20')](','):[]);},'get':function(){return this[_0x702a('0x21')](_0x702a('0x50'))?_['map'](this[_0x702a('0x21')](_0x702a('0x50'))[_0x702a('0x22')](','),function(_0x5c171f){return parseInt(_0x5c171f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x702a('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x702a('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x702a('0x2')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x702a('0x11')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x702a('0x11')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x702a('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x702a('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x702a('0x11')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x702a('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x702a('0x51')],'get':function(){return this[_0x702a('0x21')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x702a('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'interface':{'type':Sequelize[_0x702a('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x702a('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2768f9){if(typeof _0x2768f9===_0x702a('0x53')){var _0x5a7ae9=_0x2768f9==='1'?!![]:_0x2768f9==='0'?![]:_0x2768f9===_0x702a('0x54')?!![]:_0x2768f9===_0x702a('0x55')?![]:![];this[_0x702a('0x4')](_0x702a('0x56'),_0x5a7ae9);}else{this[_0x702a('0x4')]('screenrecording',_0x2768f9);}}},'blocked':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![],'set':function(_0x15f845){this['setDataValue'](_0x702a('0x57'),_0x15f845);if(_0x15f845===!![]){this[_0x702a('0x4')](_0x702a('0x58'),moment());this[_0x702a('0x4')](_0x702a('0x59'),0x0);}else{this[_0x702a('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x702a('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x702a('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x702a('0x11')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x702a('0x11')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x702a('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x702a('0x11')],'defaultValue':!![]},'downloadVoiceRecordings':{'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 498fb8a..a65fd6b 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 _0x47c5=['telephone','filter','ignore','map','value','includes','stack','name','send','rawAttributes','fieldName','salt','where','User','query','includeAll','include','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','model','differenceBy','keys','password','intersection','fields','options','find','true','update','body','describe','addContacts','ids','internal','Setting','findById','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','fullname','email','permissions','101','113','110','104','105','108','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','isEmpty','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','format','each','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','Unknown\x20channel','remove','Queue:remove','voice','addAvatar','file','filename','root','userpic','download','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','CmContact','filters','order','sort','pick','CmList','List','Tag','color','tag','nolimit','limit','getContacts','getQueues','Queue','merge','Unknown\x20role','hasOwnProperty','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','count','getScreenRecordings','ScreenRecording','UserId','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','isMiddleware','resolve','QueuePause','pause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','faxPause','openchannelPause','pauseType','lastPauseAt','%s%s','manual','getTeams','Team','addTeams','omit','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','Sms','Whatsapp','getFaxQueues','Fax','Openchannel','transaction','addAgent','getDataValue','TeamVoicePrefix','VoicePrefixId','removeTeams','getVoiceQueues','getWhatsappQueues','flatten','removeAgent','UserVoicePrefix','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','isArray','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','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','firstName','phone','Contact','getApiKey','retrieveApiKey','token','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','VoiceQueue','inbound','lower','col','asc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','voiceStatus','slice','charAt','toUpperCase','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','toString','moment','bluebird','util','path','lodash','squel','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','set','Content-Range','destroy','get','role','admin','user','Agents','agent','Telephones'];(function(_0x4d2b97,_0x33923f){var _0x4488e7=function(_0xa5130e){while(--_0xa5130e){_0x4d2b97['push'](_0x4d2b97['shift']());}};_0x4488e7(++_0x33923f);}(_0x47c5,0x165));var _0x547c=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x47c5[_0x15e6fe];return _0x34894d;};'use strict';var moment=require(_0x547c('0x0'));var BPromise=require(_0x547c('0x1'));var util=require(_0x547c('0x2'));var path=require(_0x547c('0x3'));var fs=require('fs');var _=require(_0x547c('0x4'));var squel=require(_0x547c('0x5'));var jayson=require('jayson/promise');var Redis=require(_0x547c('0x6'));var authService=require(_0x547c('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x547c('0x8'))(_0x547c('0x9'));var utils=require('../../config/utils');var config=require(_0x547c('0xa'));var licenseUtil=require(_0x547c('0xb'));var db=require(_0x547c('0xc'))['db'];var socket=require(_0x547c('0xd'))(new Redis(config[_0x547c('0xe')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);config[_0x547c('0xe')]=_[_0x547c('0x11')](config[_0x547c('0xe')],{'host':_0x547c('0x12'),'port':0x18eb});var client=jayson[_0x547c('0x13')][_0x547c('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x2455e9,_0x386e2c,_0x8addbe,_0x44ab17){return new BPromise(function(_0x549bf0,_0x13a103){var _0x39dce7=_0x44ab17||client;return _0x39dce7['request'](_0x2455e9,_0x8addbe)[_0x547c('0x15')](function(_0x201d95){logger[_0x547c('0x16')](_0x547c('0x17'),_0x386e2c,_0x547c('0x18'));logger[_0x547c('0x19')](_0x547c('0x1a'),_0x386e2c,_0x547c('0x18'),JSON[_0x547c('0x1b')](_0x201d95));if(_0x201d95[_0x547c('0x1c')]){if(_0x201d95[_0x547c('0x1c')][_0x547c('0x1d')]===0x1f4){logger[_0x547c('0x1c')](_0x547c('0x17'),_0x386e2c,_0x201d95[_0x547c('0x1c')][_0x547c('0x1e')]);return _0x13a103(_0x201d95[_0x547c('0x1c')][_0x547c('0x1e')]);}logger['error']('User,\x20%s,\x20%s',_0x386e2c,_0x201d95[_0x547c('0x1c')][_0x547c('0x1e')]);return _0x549bf0(_0x201d95[_0x547c('0x1c')]['message']);}else{logger[_0x547c('0x16')](_0x547c('0x17'),_0x386e2c,_0x547c('0x18'));_0x549bf0(_0x201d95['result'][_0x547c('0x1e')]);}})[_0x547c('0x1f')](function(_0x496c38){logger['error'](_0x547c('0x17'),_0x386e2c,_0x496c38);_0x13a103(_0x496c38);});});}function respondWithStatusCode(_0x4ce2a6,_0x4f20c1){_0x4f20c1=_0x4f20c1||0xcc;return function(_0x11e709){if(_0x11e709){return _0x4ce2a6[_0x547c('0x20')](_0x4f20c1);}return _0x4ce2a6['status'](_0x4f20c1)[_0x547c('0x21')]();};}function respondWithResult(_0x17fd97,_0x436e67){_0x436e67=_0x436e67||0xc8;return function(_0x4c718c){if(_0x4c718c){return _0x17fd97[_0x547c('0x22')](_0x436e67)[_0x547c('0x23')](_0x4c718c);}};}function respondWithFilteredResult(_0x470694,_0x26823c){return function(_0x1f3581){if(_0x1f3581){var _0x2663bc=typeof _0x26823c[_0x547c('0x24')]===_0x547c('0x25')&&typeof _0x26823c['limit']===_0x547c('0x25');var _0x4c66b9=_0x1f3581['count'];var _0x4855fd=_0x2663bc?0x0:_0x26823c['offset'];var _0x2c725d=_0x2663bc?_0x1f3581['count']:_0x26823c[_0x547c('0x24')]+_0x26823c['limit'];var _0x3ea493;if(_0x2c725d>=_0x4c66b9){_0x2c725d=_0x4c66b9;_0x3ea493=0xc8;}else{_0x3ea493=0xce;}_0x470694['status'](_0x3ea493);return _0x470694[_0x547c('0x26')](_0x547c('0x27'),_0x4855fd+'-'+_0x2c725d+'/'+_0x4c66b9)[_0x547c('0x23')](_0x1f3581);}return null;};}function saveUpdates(_0x30a96c){return function(_0x198afb){if(_0x198afb){return _0x198afb['update'](_0x30a96c)['then'](function(_0x28c282){return _0x28c282;});}return null;};}function removeEntity(_0x54de6f){return function(_0x303b57){if(_0x303b57){return _0x303b57[_0x547c('0x28')]()[_0x547c('0x15')](function(){var _0x1695be=_0x303b57[_0x547c('0x29')]({'plain':!![]});if(_0x1695be[_0x547c('0x2a')]===_0x547c('0x2b'))return;var _0x4d4dbd=[{'name':'Users','value':_0x547c('0x2c'),'ignore':!![]},{'name':_0x547c('0x2d'),'value':_0x547c('0x2e'),'ignore':![]},{'name':_0x547c('0x2f'),'value':_0x547c('0x30'),'ignore':![]}];var _0x18d7c1=_(_0x4d4dbd)[_0x547c('0x31')](_0x547c('0x32'))[_0x547c('0x33')](_0x547c('0x34'))[_0x547c('0x34')]();if(_[_0x547c('0x35')](_0x18d7c1,_0x1695be[_0x547c('0x2a')])){return;}var _0x385275=_['find'](_0x4d4dbd,[_0x547c('0x34'),_0x1695be['role']])['name'];return db['UserProfileResource'][_0x547c('0x28')]({'where':{'type':_0x385275,'resourceId':_0x1695be['id']}})[_0x547c('0x15')](function(){return _0x303b57;});})[_0x547c('0x15')](function(){_0x54de6f[_0x547c('0x22')](0xcc)[_0x547c('0x21')]();});}};}function handleEntityNotFound(_0x45f724){return function(_0x5c920e){if(!_0x5c920e){_0x45f724['sendStatus'](0x194);}return _0x5c920e;};}function handleError(_0x5ea2c7,_0xb51625){_0xb51625=_0xb51625||0x1f4;return function(_0x338b6b){logger[_0x547c('0x1c')](_0x338b6b[_0x547c('0x36')]);if(_0x338b6b[_0x547c('0x37')]){delete _0x338b6b[_0x547c('0x37')];}_0x5ea2c7['status'](_0xb51625)[_0x547c('0x38')](_0x338b6b);};}exports['index']=function(_0x32308f,_0x18fcc5){var _0x5b80f4={},_0x380705={'count':0x0,'rows':[]};var _0x5c57ae=_(db['User'][_0x547c('0x39')])[_0x547c('0x33')](function(_0x36bffe){return{'name':_0x36bffe[_0x547c('0x3a')],'type':_0x36bffe['type']['key']};})[_0x547c('0x31')](function(_0x1e8dd0){return!_[_0x547c('0x35')](['password',_0x547c('0x3b')],_0x1e8dd0[_0x547c('0x37')]);})[_0x547c('0x34')]();_0x5b80f4=qs['getOptions'](_0x5c57ae,_0x32308f);var _0x40184f={'where':_0x5b80f4[_0x547c('0x3c')]};return db[_0x547c('0x3d')]['count'](_0x40184f)[_0x547c('0x15')](function(_0xc28dc0){_0x380705['count']=_0xc28dc0;if(_0x32308f[_0x547c('0x3e')][_0x547c('0x3f')]){_0x5b80f4[_0x547c('0x40')]=[{'all':!![]}];}if(!_['includes'](_0x5b80f4[_0x547c('0x41')],'id')){_0x5b80f4['attributes'][_0x547c('0x42')]('id');}return db['User'][_0x547c('0x43')](_0x5b80f4);})[_0x547c('0x15')](function(_0x3d37d7){_0x380705[_0x547c('0x44')]=_0x3d37d7;if(_0x32308f[_0x547c('0x3e')][_0x547c('0x45')]==='true'){var _0x4ccbcf=[];for(var _0x1457ab=0x0;_0x1457ab<_0x380705[_0x547c('0x44')][_0x547c('0x46')];_0x1457ab++){_0x4ccbcf['push'](get_open_tabs(_0x547c('0x47'),_0x380705[_0x547c('0x44')][_0x1457ab][_0x547c('0x48')]));_0x4ccbcf[_0x547c('0x42')](get_open_tabs(_0x547c('0x49'),_0x380705[_0x547c('0x44')][_0x1457ab]['dataValues']));_0x4ccbcf[_0x547c('0x42')](get_open_tabs(_0x547c('0x4a'),_0x380705[_0x547c('0x44')][_0x1457ab]['dataValues']));_0x4ccbcf[_0x547c('0x42')](get_open_tabs(_0x547c('0x4b'),_0x380705[_0x547c('0x44')][_0x1457ab][_0x547c('0x48')]));_0x4ccbcf['push'](get_open_tabs(_0x547c('0x4c'),_0x380705['rows'][_0x1457ab][_0x547c('0x48')]));_0x4ccbcf['push'](get_open_tabs(_0x547c('0x4d'),_0x380705[_0x547c('0x44')][_0x1457ab]['dataValues']));}return BPromise[_0x547c('0x4e')](_0x4ccbcf)[_0x547c('0x15')](function(_0xa005cc){return _0x380705;});}else{return _0x380705;}})[_0x547c('0x15')](respondWithFilteredResult(_0x18fcc5,_0x5b80f4))['catch'](handleError(_0x18fcc5,null));};exports[_0x547c('0x4f')]=function(_0x484ede,_0x5649b6){var _0x4d4a92={'raw':![],'where':{'id':_0x484ede[_0x547c('0x50')]['id']}},_0x91fa04={};_0x91fa04[_0x547c('0x51')]=_[_0x547c('0x52')](_[_0x547c('0x53')](db[_0x547c('0x3d')][_0x547c('0x39')]),[_0x547c('0x54'),_0x547c('0x3b')]);_0x91fa04[_0x547c('0x3e')]=_[_0x547c('0x53')](_0x484ede['query']);_0x91fa04['filters']=_[_0x547c('0x55')](_0x91fa04[_0x547c('0x51')],_0x91fa04['query']);_0x4d4a92[_0x547c('0x41')]=_[_0x547c('0x55')](_0x91fa04[_0x547c('0x51')],qs[_0x547c('0x56')](_0x484ede[_0x547c('0x3e')][_0x547c('0x56')]));_0x4d4a92['attributes']=_0x4d4a92[_0x547c('0x41')]['length']?_0x4d4a92[_0x547c('0x41')]:_0x91fa04[_0x547c('0x51')];if(_0x484ede[_0x547c('0x3e')]['includeAll']){_0x4d4a92[_0x547c('0x40')]=[{'all':!![]}];}_0x4d4a92=_['merge']({},_0x4d4a92,_0x484ede[_0x547c('0x57')]);if(!_[_0x547c('0x35')](_0x4d4a92['attributes'],'id')){_0x4d4a92[_0x547c('0x41')][_0x547c('0x42')]('id');}return db[_0x547c('0x3d')][_0x547c('0x58')](_0x4d4a92)[_0x547c('0x15')](handleEntityNotFound(_0x5649b6,null))[_0x547c('0x15')](function(_0x224040){var _0x4a42d1=[];values=_0x224040;if(_0x484ede[_0x547c('0x3e')]['openTabs']===_0x547c('0x59')){_0x4a42d1[_0x547c('0x42')](get_open_tabs(_0x547c('0x47'),_0x224040[_0x547c('0x48')]));_0x4a42d1[_0x547c('0x42')](get_open_tabs('sms',_0x224040[_0x547c('0x48')]));_0x4a42d1['push'](get_open_tabs(_0x547c('0x4c'),_0x224040[_0x547c('0x48')]));_0x4a42d1[_0x547c('0x42')](get_open_tabs(_0x547c('0x4d'),_0x224040[_0x547c('0x48')]));_0x4a42d1['push'](get_open_tabs(_0x547c('0x4a'),_0x224040[_0x547c('0x48')]));_0x4a42d1['push'](get_open_tabs(_0x547c('0x4b'),_0x224040[_0x547c('0x48')]));return BPromise[_0x547c('0x4e')](_0x4a42d1);}else{return values;}})[_0x547c('0x15')](function(_0x53fed6){return values;})['then'](respondWithResult(_0x5649b6,null))['catch'](handleError(_0x5649b6,null));};exports[_0x547c('0x5a')]=function(_0x455467,_0x5e0e21){if(_0x455467[_0x547c('0x5b')]['id']){delete _0x455467['body']['id'];}delete _0x455467[_0x547c('0x5b')][_0x547c('0x2a')];return db[_0x547c('0x3d')][_0x547c('0x58')]({'where':{'id':_0x455467[_0x547c('0x50')]['id']}})[_0x547c('0x15')](handleEntityNotFound(_0x5e0e21,null))[_0x547c('0x15')](saveUpdates(_0x455467['body'],null))['then'](respondWithResult(_0x5e0e21,null))[_0x547c('0x1f')](handleError(_0x5e0e21,null));};exports[_0x547c('0x5c')]=function(_0x3105cb,_0x64bf1e){return db[_0x547c('0x3d')]['describe']()['then'](respondWithResult(_0x64bf1e,null))['catch'](handleError(_0x64bf1e,null));};exports['addContacts']=function(_0x5d6c7f,_0x16ebb7){return db[_0x547c('0x3d')][_0x547c('0x58')]({'where':{'id':_0x5d6c7f['params']['id']}})[_0x547c('0x15')](handleEntityNotFound(_0x16ebb7,null))[_0x547c('0x15')](function(_0x1d9666){if(_0x1d9666){return _0x1d9666[_0x547c('0x5d')](_0x5d6c7f['body']['ids'],_['omit'](_0x5d6c7f[_0x547c('0x5b')],[_0x547c('0x5e'),'id'])||{});}})[_0x547c('0x15')](respondWithResult(_0x16ebb7,null))[_0x547c('0x1f')](handleError(_0x16ebb7,null));};function validateUser(_0x345192){return new BPromise(function(_0x4dd4dc,_0x4e0da1){if(_0x345192[_0x547c('0x5f')])return _0x4dd4dc(_0x345192);return db[_0x547c('0x60')][_0x547c('0x61')](0x1)[_0x547c('0x15')](function(_0xa0fd35){if(_0xa0fd35['securePassword'])authService['validatePasswordPattern'](_0x345192['password']);db[_0x547c('0x3d')]['max'](_0x547c('0x5f'))[_0x547c('0x15')](function(_0x3d9ff6){if(_['isNil'](_0x3d9ff6)){_0x345192['internal']=_0xa0fd35[_0x547c('0x62')]||0x1;return;}if(_[_0x547c('0x63')](_0xa0fd35[_0x547c('0x62')])||_0xa0fd35[_0x547c('0x62')]===_0x3d9ff6){_0x345192[_0x547c('0x5f')]=_0x3d9ff6+0x1;return;}if(_0xa0fd35[_0x547c('0x62')]>_0x3d9ff6){_0x345192[_0x547c('0x5f')]=_0xa0fd35['min_internal'];return;}return db[_0x547c('0x64')][_0x547c('0x3e')](_0x547c('0x65'),{'type':db[_0x547c('0x64')][_0x547c('0x66')][_0x547c('0x67')]})[_0x547c('0x15')](function(_0x4066ce){if(_0x4066ce&&_0x4066ce['length']){for(var _0x1fa11a=0x0,_0x284fb7=_0x4066ce[_0x547c('0x46')];_0x1fa11a<_0x284fb7&&_[_0x547c('0x63')](_0x345192['internal']);_0x1fa11a++){if(_0xa0fd35[_0x547c('0x62')]<=_0x4066ce[_0x1fa11a][_0x547c('0x68')]){_0x345192[_0x547c('0x5f')]=_0x4066ce[_0x1fa11a]['from'];}else if(_0xa0fd35['min_internal']>_0x4066ce[_0x1fa11a]['from']&&_0xa0fd35[_0x547c('0x62')]<=_0x4066ce[_0x1fa11a]['to']){_0x345192[_0x547c('0x5f')]=_0xa0fd35[_0x547c('0x62')];}}}if(_['isNil'](_0x345192[_0x547c('0x5f')])){_0x345192[_0x547c('0x5f')]=_0x3d9ff6+0x1;}return _0x4dd4dc(_0x345192);});});})[_0x547c('0x1f')](function(_0x24a8f7){_0x4e0da1(_0x24a8f7);});});}function updateUser(_0x590e5f){return new BPromise(function(_0x482afb,_0x6b4445){try{if(_0x590e5f['voicemail']){_0x590e5f[_0x547c('0x69')]=_0x590e5f[_0x547c('0x5f')];_0x590e5f['VoiceMail']={'mailbox':_0x590e5f[_0x547c('0x5f')],'password':_0x590e5f['password'],'fullname':_0x590e5f[_0x547c('0x6a')],'email':_0x590e5f[_0x547c('0x6b')]};}if(_0x590e5f['role']===_0x547c('0x2e')){if(!_0x590e5f[_0x547c('0x6c')])_0x590e5f[_0x547c('0x6c')]=[_0x547c('0x6d'),'102','103',_0x547c('0x6e'),_0x547c('0x6f'),_0x547c('0x70'),_0x547c('0x71'),'106','107',_0x547c('0x72'),_0x547c('0x73'),_0x547c('0x74'),_0x547c('0x75'),_0x547c('0x76'),_0x547c('0x77')];}_0x482afb(_0x590e5f);}catch(_0x1e9026){_0x6b4445(_0x1e9026);}});}exports[_0x547c('0x78')]=function(_0x42ef60,_0x91bbf){if(_0x42ef60[_0x547c('0x2c')][_0x547c('0x2a')]===_0x547c('0x2e'))throw new Error('Unauthorized');if(_0x42ef60['body']['role']===_0x547c('0x2c')&&_0x42ef60['user']['role']!==_0x547c('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x42ef60['body'][_0x547c('0x2a')]===_0x547c('0x2b')&&_0x42ef60[_0x547c('0x2c')][_0x547c('0x2a')]!=='admin'){throw new Error(_0x547c('0x79'));}return licenseUtil[_0x547c('0x7a')]([_0x42ef60['body']])['then'](function(){return validateUser(_0x42ef60[_0x547c('0x5b')]);})[_0x547c('0x15')](function(_0x2fecce){return updateUser(_0x2fecce)[_0x547c('0x15')](function(_0x204aad){if(_0x204aad[_0x547c('0x2a')]===_0x547c('0x2b')){_0x204aad[_0x547c('0x7b')]=_0x42ef60['user'][_0x547c('0x7b')];delete _0x204aad[_0x547c('0x7c')];}return _0x204aad;});})[_0x547c('0x15')](function(_0x5c2e3c){return db[_0x547c('0x3d')][_0x547c('0x78')](_0x5c2e3c,{'include':[{'model':db[_0x547c('0x7d')],'as':_0x547c('0x7d')}]});})[_0x547c('0x15')](function(_0x10c1a7){if(_0x42ef60[_0x547c('0x5b')][_0x547c('0x2a')]===_0x547c('0x2c'))return _0x10c1a7;if(_0x42ef60[_0x547c('0x2c')][_0x547c('0x2a')]!==_0x547c('0x2c'))return _0x10c1a7;return db[_0x547c('0x7e')][_0x547c('0x58')]({'where':{'name':_0x10c1a7['role']===_0x547c('0x2e')?_0x547c('0x2d'):_0x547c('0x2f'),'userProfileId':_0x42ef60['user'][_0x547c('0x7c')]},'raw':!![]})[_0x547c('0x15')](function(_0x185176){if(!_0x185176||_0x185176[_0x547c('0x7f')]!=0x0)return _0x10c1a7;return db[_0x547c('0x80')][_0x547c('0x78')]({'name':_0x10c1a7[_0x547c('0x37')],'resourceId':_0x10c1a7['id'],'type':_0x185176[_0x547c('0x37')],'sectionId':_0x185176['id']},{})[_0x547c('0x15')](function(){return _0x10c1a7;});})[_0x547c('0x1f')](function(_0x224f62){logger[_0x547c('0x1c')](_0x547c('0x81'),_0x224f62);throw _0x224f62;});})['then'](respondWithResult(_0x91bbf,0xc9))['catch'](handleError(_0x91bbf,null));};exports['bulkCreate']=function(_0x588e2b,_0x5bafab){var _0x4b09fb=_0x588e2b[_0x547c('0x5b')];var _0x3bf455=[];if(_0x588e2b[_0x547c('0x2c')][_0x547c('0x2a')]==='agent')throw new Error(_0x547c('0x82'));if(_[_0x547c('0x83')](_0x4b09fb,[_0x547c('0x2a'),'user'])&&_0x588e2b[_0x547c('0x2c')][_0x547c('0x2a')]!==_0x547c('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x4b09fb,['role',_0x547c('0x2b')])&&_0x588e2b['user'][_0x547c('0x2a')]!==_0x547c('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x547c('0x7a')](_0x4b09fb)[_0x547c('0x15')](function(){return validateUser(_0x4b09fb[0x0]);})[_0x547c('0x15')](function(){for(var _0x3f54cf=0x1;_0x3f54cf<_0x4b09fb[_0x547c('0x46')];_0x3f54cf++){var _0x5a067c=_0x4b09fb[_0x3f54cf-0x1][_0x547c('0x5f')];if(!_0x4b09fb[_0x3f54cf]['internal'])_0x4b09fb[_0x3f54cf][_0x547c('0x5f')]=_0x5a067c+0x1;_0x3bf455[_0x547c('0x42')](validateUser(_0x4b09fb[_0x3f54cf]));}return BPromise[_0x547c('0x4e')](_0x3bf455);})[_0x547c('0x15')](function(){_0x3bf455=[];for(var _0x4e8596=0x0;_0x4e8596<_0x4b09fb[_0x547c('0x46')];_0x4e8596++){_0x3bf455['push'](updateUser(_0x4b09fb[_0x4e8596]));}return BPromise[_0x547c('0x4e')](_0x3bf455);})[_0x547c('0x15')](function(){return BPromise['each'](_0x4b09fb,function(_0x348ef8){return db['User'][_0x547c('0x78')](_0x348ef8,{'include':[{'model':db[_0x547c('0x7d')],'as':_0x547c('0x7d')}]})[_0x547c('0x15')](function(_0x55411b){_0x348ef8['id']=_0x55411b['id'];return _0x348ef8;});});})[_0x547c('0x15')](function(_0x311cb8){if(_0x588e2b[_0x547c('0x5b')][_0x547c('0x2a')]===_0x547c('0x2c'))return _0x311cb8;if(_0x588e2b['user'][_0x547c('0x2a')]!==_0x547c('0x2c'))return _0x311cb8;var _0x28cbee=_['some'](_0x311cb8,function(_0xcf70f8){return _0xcf70f8[_0x547c('0x2a')]===_0x547c('0x2e')||_0xcf70f8[_0x547c('0x2a')]==='telephone';});if(!_0x28cbee)return _0x311cb8;return db[_0x547c('0x7e')]['findAll']({'where':{'name':{'$or':[_0x547c('0x2d'),'Telephones']},'userProfileId':_0x588e2b[_0x547c('0x2c')][_0x547c('0x7c')]},'raw':!![]})[_0x547c('0x15')](function(_0x27b3ff){if(_[_0x547c('0x84')](_0x27b3ff)||!_[_0x547c('0x83')](_0x27b3ff,['autoAssociation',0x0]))return _0x311cb8;_0x3bf455=[];var _0x481894=_(_0x27b3ff)['map'](function(_0x449255){if(_0x449255[_0x547c('0x7f')]===0x1)return;return _0x449255[_0x547c('0x37')]===_0x547c('0x2d')?'agent':_0x547c('0x30');})['compact']()[_0x547c('0x34')]();for(var _0xad8038=0x0;_0xad8038<_0x311cb8[_0x547c('0x46')];_0xad8038++){if(!_[_0x547c('0x35')](_0x481894,_0x311cb8[_0xad8038][_0x547c('0x2a')]))return;var _0x15778c=_0x311cb8[_0xad8038]['role']===_0x547c('0x2e')?'Agents':_0x547c('0x2f');_0x3bf455[_0x547c('0x42')](db['UserProfileResource'][_0x547c('0x78')]({'name':_0x311cb8[_0xad8038][_0x547c('0x37')],'resourceId':_0x311cb8[_0xad8038]['id'],'type':_0x15778c,'sectionId':_[_0x547c('0x58')](_0x27b3ff,[_0x547c('0x37'),_0x15778c])['id']},{}));}return BPromise[_0x547c('0x4e')](_0x3bf455);});})[_0x547c('0x15')](respondWithResult(_0x5bafab,0xc9))[_0x547c('0x1f')](handleError(_0x5bafab,null));};exports['changePassword']=function(_0xcdd93f,_0x1e242f){if(_0xcdd93f[_0x547c('0x5b')]['id']){delete _0xcdd93f['body']['id'];}return db[_0x547c('0x3d')]['find']({'where':{'id':_0xcdd93f[_0x547c('0x50')]['id']}})['then'](function(_0x44b5e9){if(!_0x44b5e9)return null;if(_0x44b5e9['id']===_0xcdd93f[_0x547c('0x2c')]['id']){if(!_0xcdd93f[_0x547c('0x5b')][_0x547c('0x85')]||!_0xcdd93f['body'][_0x547c('0x86')]){throw new db[(_0x547c('0x87'))][(_0x547c('0x88'))](_0x547c('0x89'));}if(!_0x44b5e9['authenticate'](_0xcdd93f['body'][_0x547c('0x85')])){throw new db[(_0x547c('0x87'))]['ValidationError'](_0x547c('0x8a'));}if(_0xcdd93f['body']['oldPassword']===_0xcdd93f['body'][_0x547c('0x86')]){throw new db[(_0x547c('0x87'))][(_0x547c('0x88'))](_0x547c('0x8b'));}}else if(_0xcdd93f['user'][_0x547c('0x2a')]===_0x547c('0x2b')){if(!_0xcdd93f[_0x547c('0x5b')]['newPassword']){throw new db[(_0x547c('0x87'))]['ValidationError'](_0x547c('0x8c'));}}else if(_0xcdd93f[_0x547c('0x2c')][_0x547c('0x2a')]==='user'){if(!_0xcdd93f[_0x547c('0x5b')][_0x547c('0x86')]){throw new db['Sequelize'][(_0x547c('0x88'))](_0x547c('0x8c'));}if(_0x44b5e9[_0x547c('0x2a')]!==_0x547c('0x2e')){throw new db[(_0x547c('0x87'))][(_0x547c('0x88'))](_0x547c('0x82'));}}else{throw new db[(_0x547c('0x87'))][(_0x547c('0x88'))](_0x547c('0x82'));}return _0x44b5e9;})['then'](handleEntityNotFound(_0x1e242f,null))['then'](function(_0x4267e3){return db['Setting'][_0x547c('0x8d')]({'attributes':['id','securePassword',_0x547c('0x8e'),_0x547c('0x8f')]})[_0x547c('0x15')](function(_0x39cb92){if(_0x39cb92[_0x547c('0x90')])authService[_0x547c('0x91')](_0xcdd93f[_0x547c('0x5b')]['newPassword']);if(!_0x39cb92[_0x547c('0x8e')]||!_0x4267e3[_0x547c('0x92')])return _0x4267e3;authService[_0x547c('0x93')](_0xcdd93f[_0x547c('0x5b')][_0x547c('0x86')],_0x4267e3[_0x547c('0x92')],_0x39cb92[_0x547c('0x8f')]);return _0x4267e3;})[_0x547c('0x15')](saveUpdates({'password':_0xcdd93f[_0x547c('0x5b')][_0x547c('0x86')],'passwordResetAt':_0xcdd93f[_0x547c('0x2c')]['id']==_0xcdd93f[_0x547c('0x50')]['id']?moment():null,'previousPasswords':authService[_0x547c('0x94')](_0xcdd93f['body'][_0x547c('0x86')],_0x4267e3[_0x547c('0x92')])},null));})[_0x547c('0x15')](respondWithResult(_0x1e242f,null))[_0x547c('0x1f')](handleError(_0x1e242f,null));};exports[_0x547c('0x95')]=function(_0x11e9fd,_0x35b426){var _0x3fae07=_0x11e9fd['body'][_0x547c('0x96')];return db[_0x547c('0x3d')][_0x547c('0x58')]({'where':{'id':_0x11e9fd['params']['id']},'attributes':['id','name',_0x547c('0x2a'),_0x547c('0x97'),_0x547c('0x98'),_0x547c('0x99'),_0x547c('0x9a')]})[_0x547c('0x15')](handleEntityNotFound(_0x35b426,null))[_0x547c('0x15')](function(_0xb541a7){if(_0xb541a7){if(!utils['isValidChannel'](_0x3fae07)){throw new db[(_0x547c('0x87'))][(_0x547c('0x88'))]('Unknown\x20channel');}return _0xb541a7[_0x547c('0x9b')+_[_0x547c('0x9c')](_0x3fae07[_0x547c('0x9d')]())+_0x547c('0x9e')](_0x11e9fd['body'][_0x547c('0x5e')],{'penalty':_0x11e9fd[_0x547c('0x5b')][_0x547c('0x9f')]||0x0})[_0x547c('0xa0')](function(_0x21938c){for(var _0x2c0a98=0x0;_0x2c0a98<_0x11e9fd[_0x547c('0x5b')]['ids'][_0x547c('0x46')];_0x2c0a98+=0x1){var _0x1564b8={'UserId':Number(_0x11e9fd[_0x547c('0x50')]['id'])};_0x1564b8[_[_0x547c('0x9c')](_0x3fae07['toLowerCase']())+_0x547c('0xa1')]=Number(_0x11e9fd['body']['ids'][_0x2c0a98]);socket[_0x547c('0xa2')](_0x547c('0x2c')+_['capitalize'](_0x3fae07[_0x547c('0x9d')]())+_0x547c('0xa3'),_0x1564b8);}return _0x21938c;})[_0x547c('0x15')](function(){if(_0x3fae07==='voice'){return db['VoiceQueue'][_0x547c('0x43')]({'where':{'id':_0x11e9fd['body'][_0x547c('0x5e')]||[]},'raw':!![],'attributes':['id',_0x547c('0x37')]});}})[_0x547c('0x15')](function(_0x4cb529){var _0x4a2612=_0xb541a7[_0x547c('0x29')]({'plain':!![]});var _0xea7f3f=[];if(_0x3fae07==='voice'&&_0x4a2612[_0x547c('0x2a')]===_0x547c('0x2e')&&_0x4a2612['online']){for(var _0x1764f2=0x0;_0x1764f2<_0x4cb529[_0x547c('0x46')];_0x1764f2+=0x1){_0xea7f3f[_0x547c('0x42')]({'membername':_0x4a2612['name'],'UserId':_0x4a2612['id'],'queue_name':_0x4cb529[_0x1764f2][_0x547c('0x37')],'VoiceQueueId':_0x4cb529[_0x1764f2]['id'],'interface':_['isNil'](_0x4a2612['interface'])?util[_0x547c('0xa4')]('SIP/%s',_0x4a2612[_0x547c('0x37')]):_0x4a2612['interface'],'paused':_0x4a2612[_0x547c('0x99')]||![],'penalty':_0x11e9fd['body'][_0x547c('0x9f')]||0x0});}return BPromise[_0x547c('0xa5')](_0xea7f3f,function(_0x2a1bbf){return db[_0x547c('0xa6')][_0x547c('0xa7')](_0x2a1bbf);});}return _0xb541a7;});}})[_0x547c('0x15')](respondWithStatusCode(_0x35b426,null))[_0x547c('0x1f')](handleError(_0x35b426,null));};exports[_0x547c('0xa8')]=function(_0x54fb86,_0x2a560a){var _0x3131af;return db[_0x547c('0x3d')][_0x547c('0x58')]({'where':{'id':_0x54fb86[_0x547c('0x50')]['id']},'attributes':['id',_0x547c('0x37'),_0x547c('0x2a')]})[_0x547c('0x15')](handleEntityNotFound(_0x2a560a,null))[_0x547c('0x15')](function(_0x9e9307){if(_0x9e9307){_0x3131af=_0x9e9307;if(!_0x54fb86[_0x547c('0x3e')][_0x547c('0x96')]||!utils[_0x547c('0xa9')](_0x54fb86[_0x547c('0x3e')]['channel'])){throw new db[(_0x547c('0x87'))][(_0x547c('0x88'))](_0x547c('0xaa'));}return _0x9e9307[_0x547c('0xab')+_['capitalize'](_0x54fb86[_0x547c('0x3e')][_0x547c('0x96')][_0x547c('0x9d')]())+_0x547c('0x9e')](_0x54fb86[_0x547c('0x3e')][_0x547c('0x5e')]);}})[_0x547c('0x15')](function(_0xecf19c){if(_['isArray'](_0x54fb86[_0x547c('0x3e')][_0x547c('0x5e')])){for(var _0x17520a=0x0;_0x17520a<_0x54fb86[_0x547c('0x3e')][_0x547c('0x5e')][_0x547c('0x46')];_0x17520a+=0x1){var _0x3b20e9={'UserId':Number(_0x54fb86[_0x547c('0x50')]['id'])};_0x3b20e9[_[_0x547c('0x9c')](_0x54fb86[_0x547c('0x3e')][_0x547c('0x96')][_0x547c('0x9d')]())+'QueueId']=Number(_0x54fb86[_0x547c('0x3e')][_0x547c('0x5e')][_0x17520a]);socket[_0x547c('0xa2')](_0x547c('0x2c')+_[_0x547c('0x9c')](_0x54fb86['query']['channel'][_0x547c('0x9d')]())+_0x547c('0xac'),_0x3b20e9);}}else{var _0x3b20e9={'UserId':Number(_0x54fb86['params']['id'])};_0x3b20e9[_[_0x547c('0x9c')](_0x54fb86[_0x547c('0x3e')][_0x547c('0x96')][_0x547c('0x9d')]())+_0x547c('0xa1')]=Number(_0x54fb86[_0x547c('0x3e')][_0x547c('0x5e')]);socket[_0x547c('0xa2')](_0x547c('0x2c')+_['capitalize'](_0x54fb86['query'][_0x547c('0x96')][_0x547c('0x9d')]())+'Queue:remove',_0x3b20e9);}return _0xecf19c;})[_0x547c('0x15')](function(){if(_0x54fb86[_0x547c('0x3e')][_0x547c('0x96')]===_0x547c('0xad')){return db[_0x547c('0xa6')][_0x547c('0x28')]({'where':{'UserId':_0x54fb86[_0x547c('0x50')]['id'],'VoiceQueueId':_0x54fb86[_0x547c('0x3e')]['ids']},'individualHooks':!![]})['then'](function(){return _0x3131af;});}return _0x3131af;})[_0x547c('0x15')](respondWithStatusCode(_0x2a560a,null))['catch'](handleError(_0x2a560a,null));};exports[_0x547c('0xae')]=function(_0x3d9a66,_0x592246){_0x3d9a66[_0x547c('0x5b')]['userpic']=_0x3d9a66[_0x547c('0xaf')][_0x547c('0xb0')];return db['User'][_0x547c('0x58')]({'where':{'id':_0x3d9a66[_0x547c('0x50')]['id']}})[_0x547c('0x15')](handleEntityNotFound(_0x592246,null))[_0x547c('0x15')](saveUpdates(_0x3d9a66[_0x547c('0x5b')],null))[_0x547c('0x15')](respondWithResult(_0x592246,null))[_0x547c('0x1f')](handleError(_0x592246,null));};exports['getAvatar']=function(_0x4c7336,_0x21c274){var _0x2a0b2b=path['join'](config[_0x547c('0xb1')],'server/files/images/logos/default_profile.png');return db[_0x547c('0x3d')][_0x547c('0x58')]({'where':{'id':_0x4c7336[_0x547c('0x50')]['id']},'attributes':['id',_0x547c('0xb2')],'raw':!![]})['then'](handleEntityNotFound(_0x21c274,null))[_0x547c('0x15')](function(_0x434d03){if(_0x434d03){if(_[_0x547c('0x63')](_0x434d03['userpic'])){return _0x21c274[_0x547c('0xb3')](_0x2a0b2b);}else{if(!fs['existsSync'](path[_0x547c('0xb4')](config[_0x547c('0xb1')],_0x547c('0xb5'),_0x434d03[_0x547c('0xb2')]))){return _0x21c274[_0x547c('0xb3')](_0x2a0b2b);}return _0x21c274[_0x547c('0xb3')](path[_0x547c('0xb4')](config[_0x547c('0xb1')],'server/files/images/',_0x434d03['userpic']));}}})[_0x547c('0x1f')](handleError(_0x21c274,null));};exports[_0x547c('0xb6')]=function(_0x5e70bc,_0x352781){return db[_0x547c('0x3d')]['find']({'where':{'id':_0x5e70bc['params']['id']},'attributes':['id']})[_0x547c('0x15')](handleEntityNotFound(_0x352781,null))[_0x547c('0x15')](function(_0x3cdca2){var _0xf2d9a7=[];values=_0x3cdca2['dataValues'];_0xf2d9a7[_0x547c('0x42')](get_open_tabs(_0x547c('0x47'),_0x3cdca2[_0x547c('0x48')]));_0xf2d9a7[_0x547c('0x42')](get_open_tabs('sms',_0x3cdca2[_0x547c('0x48')]));_0xf2d9a7[_0x547c('0x42')](get_open_tabs(_0x547c('0x4c'),_0x3cdca2[_0x547c('0x48')]));_0xf2d9a7[_0x547c('0x42')](get_open_tabs(_0x547c('0x4d'),_0x3cdca2[_0x547c('0x48')]));_0xf2d9a7[_0x547c('0x42')](get_open_tabs(_0x547c('0x4a'),_0x3cdca2[_0x547c('0x48')]));_0xf2d9a7[_0x547c('0x42')](get_open_tabs(_0x547c('0x4b'),_0x3cdca2[_0x547c('0x48')]));return BPromise[_0x547c('0x4e')](_0xf2d9a7);})['then'](function(_0x5b28f7){var _0x307b25=[];if(_0x5b28f7){for(var _0x4e4a63=0x0;_0x4e4a63=_0x588e00){_0x585073=_0x588e00;_0x2499a2=0xc8;}else{_0x2499a2=0xce;}_0x29f25f['status'](_0x2499a2);return _0x29f25f[_0x6709('0x26')]('Content-Range',_0x3076fe+'-'+_0x585073+'/'+_0x588e00)[_0x6709('0x27')](_0x2bcc73);}return null;};}function saveUpdates(_0x3cd555){return function(_0x5b6906){if(_0x5b6906){return _0x5b6906[_0x6709('0x28')](_0x3cd555)['then'](function(_0xe066d8){return _0xe066d8;});}return null;};}function removeEntity(_0x388aee){return function(_0x4ad1c3){if(_0x4ad1c3){return _0x4ad1c3[_0x6709('0x29')]()['then'](function(){var _0x138318=_0x4ad1c3[_0x6709('0x2a')]({'plain':!![]});if(_0x138318['role']==='admin')return;var _0x37b3ce=[{'name':_0x6709('0x2b'),'value':_0x6709('0x2c'),'ignore':!![]},{'name':_0x6709('0x2d'),'value':_0x6709('0x2e'),'ignore':![]},{'name':_0x6709('0x2f'),'value':_0x6709('0x30'),'ignore':![]}];var _0x402e45=_(_0x37b3ce)[_0x6709('0x31')]('ignore')[_0x6709('0x32')](_0x6709('0x33'))[_0x6709('0x33')]();if(_[_0x6709('0x34')](_0x402e45,_0x138318['role'])){return;}var _0x7e783d=_[_0x6709('0x35')](_0x37b3ce,[_0x6709('0x33'),_0x138318[_0x6709('0x36')]])['name'];return db[_0x6709('0x37')][_0x6709('0x29')]({'where':{'type':_0x7e783d,'resourceId':_0x138318['id']}})['then'](function(){return _0x4ad1c3;});})[_0x6709('0x14')](function(){_0x388aee[_0x6709('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6863f9){return function(_0x12b78b){if(!_0x12b78b){_0x6863f9[_0x6709('0x1f')](0x194);}return _0x12b78b;};}function handleError(_0xf30c4c,_0x4f2a68){_0x4f2a68=_0x4f2a68||0x1f4;return function(_0x43309a){logger[_0x6709('0x1a')](_0x43309a['stack']);if(_0x43309a[_0x6709('0x38')]){delete _0x43309a[_0x6709('0x38')];}_0xf30c4c['status'](_0x4f2a68)[_0x6709('0x39')](_0x43309a);};}exports[_0x6709('0x3a')]=function(_0x6b5f39,_0x2bb89c){var _0x3d5930={},_0x1c12bb={'count':0x0,'rows':[]};var _0x4b5d60=_(db[_0x6709('0x3b')]['rawAttributes'])[_0x6709('0x32')](function(_0xbb7a64){return{'name':_0xbb7a64[_0x6709('0x3c')],'type':_0xbb7a64['type'][_0x6709('0x3d')]};})[_0x6709('0x31')](function(_0x2d9879){return!_[_0x6709('0x34')]([_0x6709('0x3e'),_0x6709('0x3f')],_0x2d9879[_0x6709('0x38')]);})['value']();_0x3d5930=qs[_0x6709('0x40')](_0x4b5d60,_0x6b5f39);var _0x197f2e={'where':_0x3d5930[_0x6709('0x41')]};return db[_0x6709('0x3b')][_0x6709('0x25')](_0x197f2e)[_0x6709('0x14')](function(_0x2765da){_0x1c12bb['count']=_0x2765da;if(_0x6b5f39['query'][_0x6709('0x42')]){_0x3d5930[_0x6709('0x43')]=[{'all':!![]}];}if(!_[_0x6709('0x34')](_0x3d5930[_0x6709('0x44')],'id')){_0x3d5930['attributes']['push']('id');}return db['User'][_0x6709('0x45')](_0x3d5930);})[_0x6709('0x14')](function(_0x54f74e){_0x1c12bb[_0x6709('0x46')]=_0x54f74e;if(_0x6b5f39[_0x6709('0x47')]['openTabs']==='true'){var _0x2b24b3=[];for(var _0x2a4445=0x0;_0x2a4445<_0x1c12bb[_0x6709('0x46')][_0x6709('0x48')];_0x2a4445++){_0x2b24b3[_0x6709('0x49')](get_open_tabs('chat',_0x1c12bb[_0x6709('0x46')][_0x2a4445]['dataValues']));_0x2b24b3[_0x6709('0x49')](get_open_tabs(_0x6709('0x4a'),_0x1c12bb[_0x6709('0x46')][_0x2a4445]['dataValues']));_0x2b24b3[_0x6709('0x49')](get_open_tabs('fax',_0x1c12bb['rows'][_0x2a4445][_0x6709('0x4b')]));_0x2b24b3[_0x6709('0x49')](get_open_tabs(_0x6709('0x4c'),_0x1c12bb[_0x6709('0x46')][_0x2a4445][_0x6709('0x4b')]));_0x2b24b3[_0x6709('0x49')](get_open_tabs(_0x6709('0x4d'),_0x1c12bb[_0x6709('0x46')][_0x2a4445][_0x6709('0x4b')]));_0x2b24b3[_0x6709('0x49')](get_open_tabs(_0x6709('0x4e'),_0x1c12bb[_0x6709('0x46')][_0x2a4445][_0x6709('0x4b')]));}return BPromise[_0x6709('0x4f')](_0x2b24b3)[_0x6709('0x14')](function(_0x4f82a0){return _0x1c12bb;});}else{return _0x1c12bb;}})[_0x6709('0x14')](respondWithFilteredResult(_0x2bb89c,_0x3d5930))['catch'](handleError(_0x2bb89c,null));};exports['show']=function(_0x594c43,_0x3091b8){var _0x483e15={'raw':![],'where':{'id':_0x594c43[_0x6709('0x50')]['id']}},_0xe8dd1={};_0xe8dd1[_0x6709('0x51')]=_[_0x6709('0x52')](_[_0x6709('0x53')](db['User'][_0x6709('0x54')]),[_0x6709('0x3e'),_0x6709('0x3f')]);_0xe8dd1[_0x6709('0x47')]=_['keys'](_0x594c43[_0x6709('0x47')]);_0xe8dd1['filters']=_[_0x6709('0x55')](_0xe8dd1[_0x6709('0x51')],_0xe8dd1[_0x6709('0x47')]);_0x483e15[_0x6709('0x44')]=_[_0x6709('0x55')](_0xe8dd1['model'],qs[_0x6709('0x56')](_0x594c43[_0x6709('0x47')][_0x6709('0x56')]));_0x483e15[_0x6709('0x44')]=_0x483e15[_0x6709('0x44')]['length']?_0x483e15['attributes']:_0xe8dd1[_0x6709('0x51')];if(_0x594c43['query']['includeAll']){_0x483e15[_0x6709('0x43')]=[{'all':!![]}];}_0x483e15=_[_0x6709('0x57')]({},_0x483e15,_0x594c43[_0x6709('0x58')]);if(!_[_0x6709('0x34')](_0x483e15[_0x6709('0x44')],'id')){_0x483e15[_0x6709('0x44')][_0x6709('0x49')]('id');}return db[_0x6709('0x3b')][_0x6709('0x35')](_0x483e15)[_0x6709('0x14')](handleEntityNotFound(_0x3091b8,null))[_0x6709('0x14')](function(_0x4d4ff9){var _0x125b32=[];values=_0x4d4ff9;if(_0x594c43[_0x6709('0x47')]['openTabs']==='true'){_0x125b32[_0x6709('0x49')](get_open_tabs(_0x6709('0x59'),_0x4d4ff9[_0x6709('0x4b')]));_0x125b32[_0x6709('0x49')](get_open_tabs('sms',_0x4d4ff9[_0x6709('0x4b')]));_0x125b32['push'](get_open_tabs(_0x6709('0x4d'),_0x4d4ff9[_0x6709('0x4b')]));_0x125b32[_0x6709('0x49')](get_open_tabs(_0x6709('0x4e'),_0x4d4ff9[_0x6709('0x4b')]));_0x125b32['push'](get_open_tabs('fax',_0x4d4ff9[_0x6709('0x4b')]));_0x125b32[_0x6709('0x49')](get_open_tabs('mail',_0x4d4ff9[_0x6709('0x4b')]));return BPromise[_0x6709('0x4f')](_0x125b32);}else{return values;}})['then'](function(_0xbb78ba){return values;})[_0x6709('0x14')](respondWithResult(_0x3091b8,null))[_0x6709('0x1e')](handleError(_0x3091b8,null));};exports[_0x6709('0x28')]=function(_0x4f596e,_0x4dca92){if(_0x4f596e[_0x6709('0x5a')]['id']){delete _0x4f596e['body']['id'];}delete _0x4f596e[_0x6709('0x5a')][_0x6709('0x36')];return db[_0x6709('0x3b')]['find']({'where':{'id':_0x4f596e[_0x6709('0x50')]['id']}})['then'](handleEntityNotFound(_0x4dca92,null))['then'](saveUpdates(_0x4f596e[_0x6709('0x5a')],null))['then'](respondWithResult(_0x4dca92,null))[_0x6709('0x1e')](handleError(_0x4dca92,null));};exports['describe']=function(_0x3e52e7,_0x34f790){return db[_0x6709('0x3b')][_0x6709('0x5b')]()['then'](respondWithResult(_0x34f790,null))[_0x6709('0x1e')](handleError(_0x34f790,null));};exports[_0x6709('0x5c')]=function(_0x27d041,_0x11c435){return db[_0x6709('0x3b')][_0x6709('0x35')]({'where':{'id':_0x27d041[_0x6709('0x50')]['id']}})['then'](handleEntityNotFound(_0x11c435,null))[_0x6709('0x14')](function(_0x123898){if(_0x123898){return _0x123898[_0x6709('0x5c')](_0x27d041[_0x6709('0x5a')][_0x6709('0x5d')],_[_0x6709('0x5e')](_0x27d041[_0x6709('0x5a')],[_0x6709('0x5d'),'id'])||{});}})[_0x6709('0x14')](respondWithResult(_0x11c435,null))['catch'](handleError(_0x11c435,null));};function validateUser(_0x469289){return new BPromise(function(_0x122080,_0x50f992){if(_0x469289[_0x6709('0x5f')])return _0x122080(_0x469289);return db[_0x6709('0x60')][_0x6709('0x61')](0x1)[_0x6709('0x14')](function(_0xfd93ef){if(_0xfd93ef[_0x6709('0x62')])authService[_0x6709('0x63')](_0x469289[_0x6709('0x3e')]);db[_0x6709('0x3b')]['max'](_0x6709('0x5f'))[_0x6709('0x14')](function(_0x114435){if(_[_0x6709('0x64')](_0x114435)){_0x469289[_0x6709('0x5f')]=_0xfd93ef[_0x6709('0x65')]||0x1;return;}if(_[_0x6709('0x64')](_0xfd93ef[_0x6709('0x65')])||_0xfd93ef[_0x6709('0x65')]===_0x114435){_0x469289[_0x6709('0x5f')]=_0x114435+0x1;return;}if(_0xfd93ef[_0x6709('0x65')]>_0x114435){_0x469289['internal']=_0xfd93ef[_0x6709('0x65')];return;}return db['sequelize']['query'](_0x6709('0x66'),{'type':db[_0x6709('0x67')][_0x6709('0x68')][_0x6709('0x69')]})[_0x6709('0x14')](function(_0x3c27bb){if(_0x3c27bb&&_0x3c27bb[_0x6709('0x48')]){for(var _0x5c1132=0x0,_0x5a61b8=_0x3c27bb[_0x6709('0x48')];_0x5c1132<_0x5a61b8&&_['isNil'](_0x469289[_0x6709('0x5f')]);_0x5c1132++){if(_0xfd93ef['min_internal']<=_0x3c27bb[_0x5c1132][_0x6709('0x6a')]){_0x469289[_0x6709('0x5f')]=_0x3c27bb[_0x5c1132]['from'];}else if(_0xfd93ef['min_internal']>_0x3c27bb[_0x5c1132]['from']&&_0xfd93ef[_0x6709('0x65')]<=_0x3c27bb[_0x5c1132]['to']){_0x469289[_0x6709('0x5f')]=_0xfd93ef[_0x6709('0x65')];}}}if(_[_0x6709('0x64')](_0x469289[_0x6709('0x5f')])){_0x469289[_0x6709('0x5f')]=_0x114435+0x1;}return _0x122080(_0x469289);});});})[_0x6709('0x1e')](function(_0x305e0d){_0x50f992(_0x305e0d);});});}function updateUser(_0x38520c){return new BPromise(function(_0x398c12,_0x1d2f35){try{if(_0x38520c[_0x6709('0x6b')]){_0x38520c[_0x6709('0x6c')]=_0x38520c['internal'];_0x38520c[_0x6709('0x6d')]={'mailbox':_0x38520c[_0x6709('0x5f')],'password':_0x38520c[_0x6709('0x3e')],'fullname':_0x38520c[_0x6709('0x6e')],'email':_0x38520c['email']};}if(_0x38520c['role']===_0x6709('0x2e')){if(!_0x38520c['permissions'])_0x38520c['permissions']=[_0x6709('0x6f'),_0x6709('0x70'),'103',_0x6709('0x71'),_0x6709('0x72'),_0x6709('0x73'),_0x6709('0x74'),_0x6709('0x75'),'107','108',_0x6709('0x76'),_0x6709('0x77'),'111',_0x6709('0x78'),_0x6709('0x79')];}_0x398c12(_0x38520c);}catch(_0x1c90d7){_0x1d2f35(_0x1c90d7);}});}exports['create']=function(_0x3963c2,_0x174a28){if(_0x3963c2[_0x6709('0x2c')][_0x6709('0x36')]==='agent')throw new Error('Unauthorized');if(_0x3963c2[_0x6709('0x5a')][_0x6709('0x36')]===_0x6709('0x2c')&&_0x3963c2[_0x6709('0x2c')][_0x6709('0x36')]!=='admin'){throw new Error(_0x6709('0x7a'));}if(_0x3963c2[_0x6709('0x5a')]['role']===_0x6709('0x7b')&&_0x3963c2[_0x6709('0x2c')][_0x6709('0x36')]!==_0x6709('0x7b')){throw new Error(_0x6709('0x7c'));}return licenseUtil['checkUserLimits']([_0x3963c2[_0x6709('0x5a')]])['then'](function(){return validateUser(_0x3963c2[_0x6709('0x5a')]);})['then'](function(_0x1a16c4){return updateUser(_0x1a16c4)[_0x6709('0x14')](function(_0x25b11d){if(_0x25b11d[_0x6709('0x36')]==='admin'){_0x25b11d[_0x6709('0x7d')]=_0x3963c2[_0x6709('0x2c')][_0x6709('0x7d')];delete _0x25b11d[_0x6709('0x7e')];}return _0x25b11d;});})[_0x6709('0x14')](function(_0x2c1aa6){return db['User'][_0x6709('0x7f')](_0x2c1aa6,{'include':[{'model':db[_0x6709('0x6d')],'as':_0x6709('0x6d')}]});})['then'](function(_0x308b8b){if(_0x3963c2[_0x6709('0x5a')]['role']===_0x6709('0x2c'))return _0x308b8b;if(_0x3963c2[_0x6709('0x2c')][_0x6709('0x36')]!=='user')return _0x308b8b;return db[_0x6709('0x80')][_0x6709('0x35')]({'where':{'name':_0x308b8b[_0x6709('0x36')]==='agent'?_0x6709('0x2d'):_0x6709('0x2f'),'userProfileId':_0x3963c2[_0x6709('0x2c')][_0x6709('0x7e')]},'raw':!![]})[_0x6709('0x14')](function(_0x5a48dc){if(!_0x5a48dc||_0x5a48dc['autoAssociation']!=0x0)return _0x308b8b;return db[_0x6709('0x37')][_0x6709('0x7f')]({'name':_0x308b8b['name'],'resourceId':_0x308b8b['id'],'type':_0x5a48dc[_0x6709('0x38')],'sectionId':_0x5a48dc['id']},{})[_0x6709('0x14')](function(){return _0x308b8b;});})[_0x6709('0x1e')](function(_0x5c69ee){logger[_0x6709('0x1a')](_0x6709('0x81'),_0x5c69ee);throw _0x5c69ee;});})[_0x6709('0x14')](respondWithResult(_0x174a28,0xc9))[_0x6709('0x1e')](handleError(_0x174a28,null));};exports[_0x6709('0x82')]=function(_0x22a4e6,_0x477a1d){var _0x48dce5=_0x22a4e6[_0x6709('0x5a')];var _0x4161d5=[];if(_0x22a4e6[_0x6709('0x2c')][_0x6709('0x36')]===_0x6709('0x2e'))throw new Error(_0x6709('0x83'));if(_[_0x6709('0x84')](_0x48dce5,['role',_0x6709('0x2c')])&&_0x22a4e6['user'][_0x6709('0x36')]!==_0x6709('0x7b')){throw new Error(_0x6709('0x7a'));}if(_[_0x6709('0x84')](_0x48dce5,[_0x6709('0x36'),_0x6709('0x7b')])&&_0x22a4e6[_0x6709('0x2c')][_0x6709('0x36')]!==_0x6709('0x7b')){throw new Error(_0x6709('0x85'));}return licenseUtil[_0x6709('0x86')](_0x48dce5)[_0x6709('0x14')](function(){return validateUser(_0x48dce5[0x0]);})[_0x6709('0x14')](function(){for(var _0x1a7b87=0x1;_0x1a7b87<_0x48dce5['length'];_0x1a7b87++){var _0x5be0df=_0x48dce5[_0x1a7b87-0x1][_0x6709('0x5f')];if(!_0x48dce5[_0x1a7b87][_0x6709('0x5f')])_0x48dce5[_0x1a7b87]['internal']=_0x5be0df+0x1;_0x4161d5[_0x6709('0x49')](validateUser(_0x48dce5[_0x1a7b87]));}return BPromise[_0x6709('0x4f')](_0x4161d5);})[_0x6709('0x14')](function(){_0x4161d5=[];for(var _0x25975d=0x0;_0x25975d<_0x48dce5[_0x6709('0x48')];_0x25975d++){_0x4161d5[_0x6709('0x49')](updateUser(_0x48dce5[_0x25975d]));}return BPromise[_0x6709('0x4f')](_0x4161d5);})['then'](function(){return BPromise[_0x6709('0x87')](_0x48dce5,function(_0x2385cb){return db[_0x6709('0x3b')][_0x6709('0x7f')](_0x2385cb,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x6709('0x14')](function(_0x17d074){_0x2385cb['id']=_0x17d074['id'];return _0x2385cb;});});})[_0x6709('0x14')](function(_0x1473ab){if(_0x22a4e6[_0x6709('0x5a')][_0x6709('0x36')]===_0x6709('0x2c'))return _0x1473ab;if(_0x22a4e6[_0x6709('0x2c')][_0x6709('0x36')]!==_0x6709('0x2c'))return _0x1473ab;var _0x1c9bc1=_[_0x6709('0x84')](_0x1473ab,function(_0x4969ab){return _0x4969ab[_0x6709('0x36')]===_0x6709('0x2e')||_0x4969ab[_0x6709('0x36')]==='telephone';});if(!_0x1c9bc1)return _0x1473ab;return db[_0x6709('0x80')][_0x6709('0x45')]({'where':{'name':{'$or':['Agents',_0x6709('0x2f')]},'userProfileId':_0x22a4e6['user'][_0x6709('0x7e')]},'raw':!![]})[_0x6709('0x14')](function(_0x1a247b){if(_[_0x6709('0x88')](_0x1a247b)||!_[_0x6709('0x84')](_0x1a247b,[_0x6709('0x89'),0x0]))return _0x1473ab;_0x4161d5=[];var _0x286aaf=_(_0x1a247b)[_0x6709('0x32')](function(_0x5d227a){if(_0x5d227a[_0x6709('0x89')]===0x1)return;return _0x5d227a[_0x6709('0x38')]===_0x6709('0x2d')?'agent':'telephone';})['compact']()[_0x6709('0x33')]();for(var _0xc95c8d=0x0;_0xc95c8d<_0x1473ab[_0x6709('0x48')];_0xc95c8d++){if(!_[_0x6709('0x34')](_0x286aaf,_0x1473ab[_0xc95c8d][_0x6709('0x36')]))return;var _0x57e2a9=_0x1473ab[_0xc95c8d][_0x6709('0x36')]==='agent'?_0x6709('0x2d'):_0x6709('0x2f');_0x4161d5[_0x6709('0x49')](db[_0x6709('0x37')]['create']({'name':_0x1473ab[_0xc95c8d][_0x6709('0x38')],'resourceId':_0x1473ab[_0xc95c8d]['id'],'type':_0x57e2a9,'sectionId':_[_0x6709('0x35')](_0x1a247b,['name',_0x57e2a9])['id']},{}));}return BPromise[_0x6709('0x4f')](_0x4161d5);});})[_0x6709('0x14')](respondWithResult(_0x477a1d,0xc9))[_0x6709('0x1e')](handleError(_0x477a1d,null));};exports[_0x6709('0x8a')]=function(_0x3b4539,_0x2dea9b){if(_0x3b4539[_0x6709('0x5a')]['id']){delete _0x3b4539[_0x6709('0x5a')]['id'];}return db[_0x6709('0x3b')][_0x6709('0x35')]({'where':{'id':_0x3b4539['params']['id']}})['then'](function(_0x49e603){if(!_0x49e603)return null;if(_0x49e603['id']===_0x3b4539['user']['id']){if(!_0x3b4539['body']['oldPassword']||!_0x3b4539['body'][_0x6709('0x8b')]){throw new db[(_0x6709('0x8c'))][(_0x6709('0x8d'))](_0x6709('0x8e'));}if(!_0x49e603[_0x6709('0x8f')](_0x3b4539[_0x6709('0x5a')][_0x6709('0x90')])){throw new db[(_0x6709('0x8c'))]['ValidationError'](_0x6709('0x91'));}if(_0x3b4539[_0x6709('0x5a')][_0x6709('0x90')]===_0x3b4539[_0x6709('0x5a')][_0x6709('0x8b')]){throw new db[(_0x6709('0x8c'))][(_0x6709('0x8d'))](_0x6709('0x92'));}}else if(_0x3b4539[_0x6709('0x2c')]['role']==='admin'){if(!_0x3b4539[_0x6709('0x5a')]['newPassword']){throw new db['Sequelize'][(_0x6709('0x8d'))](_0x6709('0x93'));}}else if(_0x3b4539[_0x6709('0x2c')][_0x6709('0x36')]===_0x6709('0x2c')){if(!_0x3b4539['body'][_0x6709('0x8b')]){throw new db['Sequelize'][(_0x6709('0x8d'))](_0x6709('0x93'));}if(_0x49e603['role']!=='agent'){throw new db[(_0x6709('0x8c'))][(_0x6709('0x8d'))]('Unauthorized');}}else{throw new db[(_0x6709('0x8c'))][(_0x6709('0x8d'))](_0x6709('0x83'));}return _0x49e603;})[_0x6709('0x14')](handleEntityNotFound(_0x2dea9b,null))[_0x6709('0x14')](function(_0x31aa88){return db[_0x6709('0x60')]['findOne']({'attributes':['id',_0x6709('0x62'),_0x6709('0x94'),_0x6709('0x95')]})[_0x6709('0x14')](function(_0x839d85){if(_0x839d85['securePassword'])authService[_0x6709('0x63')](_0x3b4539[_0x6709('0x5a')]['newPassword']);if(!_0x839d85['enforcePasswordHistory']||!_0x31aa88['previousPasswords'])return _0x31aa88;authService[_0x6709('0x96')](_0x3b4539['body'][_0x6709('0x8b')],_0x31aa88[_0x6709('0x97')],_0x839d85[_0x6709('0x95')]);return _0x31aa88;})[_0x6709('0x14')](saveUpdates({'password':_0x3b4539[_0x6709('0x5a')]['newPassword'],'passwordResetAt':_0x3b4539[_0x6709('0x2c')]['id']==_0x3b4539[_0x6709('0x50')]['id']?moment():null,'previousPasswords':authService[_0x6709('0x98')](_0x3b4539[_0x6709('0x5a')]['newPassword'],_0x31aa88[_0x6709('0x97')])},null));})['then'](respondWithResult(_0x2dea9b,null))['catch'](handleError(_0x2dea9b,null));};exports[_0x6709('0x99')]=function(_0x56eac7,_0x1bb733){var _0x40340f=_0x56eac7['body']['channel'];return db[_0x6709('0x3b')][_0x6709('0x35')]({'where':{'id':_0x56eac7['params']['id']},'attributes':['id','name',_0x6709('0x36'),_0x6709('0x9a'),'loginInPause',_0x6709('0x9b'),_0x6709('0x9c')]})[_0x6709('0x14')](handleEntityNotFound(_0x1bb733,null))[_0x6709('0x14')](function(_0x233e31){if(_0x233e31){if(!utils[_0x6709('0x9d')](_0x40340f)){throw new db[(_0x6709('0x8c'))][(_0x6709('0x8d'))](_0x6709('0x9e'));}return _0x233e31[_0x6709('0x9f')+_[_0x6709('0xa0')](_0x40340f[_0x6709('0xa1')]())+_0x6709('0xa2')](_0x56eac7['body'][_0x6709('0x5d')],{'penalty':_0x56eac7[_0x6709('0x5a')][_0x6709('0xa3')]||0x0})['spread'](function(_0x35504a){for(var _0x551010=0x0;_0x551010<_0x56eac7[_0x6709('0x5a')]['ids'][_0x6709('0x48')];_0x551010+=0x1){var _0xaca234={'UserId':Number(_0x56eac7[_0x6709('0x50')]['id'])};_0xaca234[_[_0x6709('0xa0')](_0x40340f[_0x6709('0xa1')]())+'QueueId']=Number(_0x56eac7[_0x6709('0x5a')]['ids'][_0x551010]);socket[_0x6709('0xa4')](_0x6709('0x2c')+_[_0x6709('0xa0')](_0x40340f['toLowerCase']())+'Queue:save',_0xaca234);}return _0x35504a;})[_0x6709('0x14')](function(){if(_0x40340f===_0x6709('0xa5')){return db[_0x6709('0xa6')]['findAll']({'where':{'id':_0x56eac7[_0x6709('0x5a')][_0x6709('0x5d')]||[]},'raw':!![],'attributes':['id',_0x6709('0x38')]});}})[_0x6709('0x14')](function(_0x1ea7e9){var _0x1d9c45=_0x233e31[_0x6709('0x2a')]({'plain':!![]});var _0x4c5ab8=[];if(_0x40340f==='voice'&&_0x1d9c45['role']===_0x6709('0x2e')&&_0x1d9c45['online']){for(var _0x1ce949=0x0;_0x1ce949<_0x1ea7e9[_0x6709('0x48')];_0x1ce949+=0x1){_0x4c5ab8[_0x6709('0x49')]({'membername':_0x1d9c45[_0x6709('0x38')],'UserId':_0x1d9c45['id'],'queue_name':_0x1ea7e9[_0x1ce949][_0x6709('0x38')],'VoiceQueueId':_0x1ea7e9[_0x1ce949]['id'],'interface':_['isNil'](_0x1d9c45['interface'])?util[_0x6709('0xa7')](_0x6709('0xa8'),_0x1d9c45[_0x6709('0x38')]):_0x1d9c45[_0x6709('0x9c')],'paused':_0x1d9c45['voicePause']||![],'penalty':_0x56eac7[_0x6709('0x5a')][_0x6709('0xa3')]||0x0});}return BPromise[_0x6709('0x87')](_0x4c5ab8,function(_0x27e527){return db[_0x6709('0xa9')][_0x6709('0xaa')](_0x27e527);});}return _0x233e31;});}})[_0x6709('0x14')](respondWithStatusCode(_0x1bb733,null))[_0x6709('0x1e')](handleError(_0x1bb733,null));};exports[_0x6709('0xab')]=function(_0xe6c75e,_0x437077){var _0x37b6f4;return db[_0x6709('0x3b')]['find']({'where':{'id':_0xe6c75e['params']['id']},'attributes':['id',_0x6709('0x38'),'role']})['then'](handleEntityNotFound(_0x437077,null))[_0x6709('0x14')](function(_0x5b9339){if(_0x5b9339){_0x37b6f4=_0x5b9339;if(!_0xe6c75e[_0x6709('0x47')][_0x6709('0xac')]||!utils[_0x6709('0x9d')](_0xe6c75e[_0x6709('0x47')][_0x6709('0xac')])){throw new db[(_0x6709('0x8c'))][(_0x6709('0x8d'))](_0x6709('0x9e'));}return _0x5b9339[_0x6709('0xad')+_['capitalize'](_0xe6c75e['query']['channel'][_0x6709('0xa1')]())+_0x6709('0xa2')](_0xe6c75e[_0x6709('0x47')][_0x6709('0x5d')]);}})[_0x6709('0x14')](function(_0x5ae419){if(_[_0x6709('0xae')](_0xe6c75e[_0x6709('0x47')][_0x6709('0x5d')])){for(var _0x1507b0=0x0;_0x1507b0<_0xe6c75e[_0x6709('0x47')][_0x6709('0x5d')]['length'];_0x1507b0+=0x1){var _0x576280={'UserId':Number(_0xe6c75e['params']['id'])};_0x576280[_['capitalize'](_0xe6c75e[_0x6709('0x47')][_0x6709('0xac')][_0x6709('0xa1')]())+'QueueId']=Number(_0xe6c75e['query'][_0x6709('0x5d')][_0x1507b0]);socket[_0x6709('0xa4')](_0x6709('0x2c')+_[_0x6709('0xa0')](_0xe6c75e['query'][_0x6709('0xac')][_0x6709('0xa1')]())+'Queue:remove',_0x576280);}}else{var _0x576280={'UserId':Number(_0xe6c75e[_0x6709('0x50')]['id'])};_0x576280[_[_0x6709('0xa0')](_0xe6c75e['query']['channel']['toLowerCase']())+'QueueId']=Number(_0xe6c75e['query'][_0x6709('0x5d')]);socket[_0x6709('0xa4')]('user'+_[_0x6709('0xa0')](_0xe6c75e[_0x6709('0x47')][_0x6709('0xac')][_0x6709('0xa1')]())+_0x6709('0xaf'),_0x576280);}return _0x5ae419;})[_0x6709('0x14')](function(){if(_0xe6c75e[_0x6709('0x47')][_0x6709('0xac')]===_0x6709('0xa5')){return db[_0x6709('0xa9')][_0x6709('0x29')]({'where':{'UserId':_0xe6c75e['params']['id'],'VoiceQueueId':_0xe6c75e[_0x6709('0x47')][_0x6709('0x5d')]},'individualHooks':!![]})[_0x6709('0x14')](function(){return _0x37b6f4;});}return _0x37b6f4;})[_0x6709('0x14')](respondWithStatusCode(_0x437077,null))[_0x6709('0x1e')](handleError(_0x437077,null));};exports[_0x6709('0xb0')]=function(_0x29478c,_0x197150){_0x29478c['body']['userpic']=_0x29478c[_0x6709('0xb1')][_0x6709('0xb2')];return db[_0x6709('0x3b')][_0x6709('0x35')]({'where':{'id':_0x29478c[_0x6709('0x50')]['id']}})['then'](handleEntityNotFound(_0x197150,null))[_0x6709('0x14')](saveUpdates(_0x29478c[_0x6709('0x5a')],null))['then'](respondWithResult(_0x197150,null))[_0x6709('0x1e')](handleError(_0x197150,null));};exports['getAvatar']=function(_0x49e954,_0x13ac21){var _0x20ef0f=path[_0x6709('0xb3')](config['root'],_0x6709('0xb4'));return db[_0x6709('0x3b')][_0x6709('0x35')]({'where':{'id':_0x49e954['params']['id']},'attributes':['id',_0x6709('0xb5')],'raw':!![]})[_0x6709('0x14')](handleEntityNotFound(_0x13ac21,null))[_0x6709('0x14')](function(_0x27bc21){if(_0x27bc21){if(_[_0x6709('0x64')](_0x27bc21[_0x6709('0xb5')])){return _0x13ac21['download'](_0x20ef0f);}else{if(!fs[_0x6709('0xb6')](path[_0x6709('0xb3')](config[_0x6709('0xb7')],_0x6709('0xb8'),_0x27bc21[_0x6709('0xb5')]))){return _0x13ac21['download'](_0x20ef0f);}return _0x13ac21['download'](path[_0x6709('0xb3')](config['root'],'server/files/images/',_0x27bc21['userpic']));}}})[_0x6709('0x1e')](handleError(_0x13ac21,null));};exports['getOpenTabs']=function(_0x4320f6,_0x33c55e){return db['User'][_0x6709('0x35')]({'where':{'id':_0x4320f6['params']['id']},'attributes':['id']})[_0x6709('0x14')](handleEntityNotFound(_0x33c55e,null))[_0x6709('0x14')](function(_0x13f9c4){var _0x554b8c=[];values=_0x13f9c4['dataValues'];_0x554b8c[_0x6709('0x49')](get_open_tabs(_0x6709('0x59'),_0x13f9c4[_0x6709('0x4b')]));_0x554b8c[_0x6709('0x49')](get_open_tabs('sms',_0x13f9c4[_0x6709('0x4b')]));_0x554b8c[_0x6709('0x49')](get_open_tabs('openchannel',_0x13f9c4[_0x6709('0x4b')]));_0x554b8c[_0x6709('0x49')](get_open_tabs(_0x6709('0x4e'),_0x13f9c4[_0x6709('0x4b')]));_0x554b8c['push'](get_open_tabs(_0x6709('0xb9'),_0x13f9c4[_0x6709('0x4b')]));_0x554b8c[_0x6709('0x49')](get_open_tabs(_0x6709('0x4c'),_0x13f9c4[_0x6709('0x4b')]));return BPromise['all'](_0x554b8c);})['then'](function(_0x80fc09){var _0x51ef62=[];if(_0x80fc09){for(var _0x458667=0x0;_0x458667=_0x10f34c['agents']){throw new Error(_0xa916('0x54'));}})[_0xa916('0xf')](function(){if(_0x19755f){return db[_0xa916('0x2b')][_0xa916('0x55')]({'where':{'membername':_0x19755f['name']},'individualHooks':!![]});}})[_0xa916('0xf')](function(){if(_0x19755f){return _0x19755f[_0xa916('0x56')]({'raw':!![]});}})[_0xa916('0xf')](function(_0x1ce48e){if(_0x19755f){if(_0x1ce48e){var _0x15e929=[];_0x4e26de=_0x1ce48e;if(_0x4e26de[_0xa916('0x2f')]){for(var _0x694050=0x0;_0x694050<_0x4e26de[_0xa916('0x2f')];_0x694050++){_0x15e929[_0xa916('0x34')](db[_0xa916('0x2b')]['upsert']({'membername':_0x19755f[_0xa916('0x27')],'UserId':_0x19755f['id'],'queue_name':_0x4e26de[_0x694050][_0xa916('0x27')],'VoiceQueueId':_0x4e26de[_0x694050]['id'],'interface':_0x3aa115,'paused':_0x19755f[_0xa916('0x4e')]||![],'penalty':_0x4e26de[_0x694050][_0xa916('0x57')]||0x0}));}return BPromise[_0xa916('0x4c')](_0x15e929);}}}})[_0xa916('0xf')](function(){if(_0x19755f){return db[_0xa916('0x3c')][_0xa916('0x2d')]({'where':{'membername':_0x19755f[_0xa916('0x27')],'exitAt':null}});}})['then'](function(_0xecbff0){if(_0x19755f){if(_0xecbff0&&_0xecbff0[_0xa916('0x2f')]){var _0x3765fd=[];_0xecbff0[_0xa916('0x33')](function(_0x17382f){_0x3765fd[_0xa916('0x34')](_0x17382f[_0xa916('0x2c')]({'exitAt':moment()[_0xa916('0x30')](_0xa916('0x37'))}));});return BPromise[_0xa916('0x4c')](_0x3765fd);}}})[_0xa916('0xf')](function(_0x24a614){if(_0x19755f){var _0x260de2=[];var _0x4c5719=[];var _0x282f71=utils['getChannels']();var _0x2557d={'membername':_0x19755f['name'],'interface':_0x3aa115,'enterAt':moment()[_0xa916('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x19755f[_0xa916('0x28')],'internal':_0x19755f[_0xa916('0x29')]};_0x282f71[_0xa916('0x33')](function(_0x2c583f){_0x260de2['push'](_[_0xa916('0x58')]({'channel':_0x2c583f,'type':'LOGIN','data1':'callysquare','data2':_0x3aa115},_0x2557d));if(_0x19755f[_0xa916('0x4e')]){_0x4c5719[_0xa916('0x34')](_[_0xa916('0x58')]({'channel':_0x2c583f,'type':_0xa916('0x2e'),'data1':_0xa916('0x59')},_0x2557d));}});return db[_0xa916('0x3c')][_0xa916('0x3d')](_0x260de2['concat'](_0x4c5719),{'individualHooks':!![]});}})[_0xa916('0xf')](function(){if(_0x19755f){return _0x19755f[_0xa916('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xa916('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x19755f[_0xa916('0x4e')]||![],'mailPause':_0x19755f['loginInPause']||![],'chatPause':_0x19755f[_0xa916('0x4e')]||![],'faxPause':_0x19755f['loginInPause']||![],'smsPause':_0x19755f[_0xa916('0x4e')]||![],'openchannelPause':_0x19755f['loginInPause']||![],'pauseType':_0x19755f[_0xa916('0x4e')]?_0xa916('0x59'):null,'lastPauseAt':moment()[_0xa916('0x30')](_0xa916('0x37')),'interface':_0x3aa115});}})[_0xa916('0xf')](function(_0x4cd27e){_0x588786(_0x4cd27e);})[_0xa916('0x1a')](function(_0x433900){_0x338501(_0x70136b[_0xa916('0x16')](0x1f4,_0x433900[_0xa916('0x18')]));});});}; \ No newline at end of file +var _0xf8a9=['Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','result','GetUser','User','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowUser','find','stringify','PauseUser','name','role','internal','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','interface','body','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','UserVoiceQueueRt','system','mail','chat','fax','openchannel','set','%s%s','Pause','all','LogoutUser','destroy','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xf8a9,0x67));var _0x9f8a=function(_0x341d5d,_0x18af43){_0x341d5d=_0x341d5d-0x0;var _0x43aeea=_0xf8a9[_0x341d5d];return _0x43aeea;};'use strict';var _=require('lodash');var util=require(_0x9f8a('0x0'));var moment=require('moment');var BPromise=require(_0x9f8a('0x1'));var rs=require(_0x9f8a('0x2'));var fs=require('fs');var Redis=require(_0x9f8a('0x3'));var db=require(_0x9f8a('0x4'))['db'];var utils=require(_0x9f8a('0x5'));var logger=require(_0x9f8a('0x6'))(_0x9f8a('0x7'));var config=require(_0x9f8a('0x8'));var jayson=require(_0x9f8a('0x9'));var client=jayson[_0x9f8a('0xa')][_0x9f8a('0xb')]({'port':0x232a});config[_0x9f8a('0xc')]=_[_0x9f8a('0xd')](config[_0x9f8a('0xc')],{'host':_0x9f8a('0xe'),'port':0x18eb});var socket=require(_0x9f8a('0xf'))(new Redis(config[_0x9f8a('0xc')]));require(_0x9f8a('0x10'))['register'](socket);function respondWithRpcPromise(_0x339655,_0x25f484,_0x278596){return new BPromise(function(_0x5d19eb,_0x60ab9c){return client[_0x9f8a('0x11')](_0x339655,_0x278596)[_0x9f8a('0x12')](function(_0x187214){logger[_0x9f8a('0x13')](_0x9f8a('0x14'),_0x25f484,_0x9f8a('0x15'));logger[_0x9f8a('0x16')](_0x9f8a('0x17'),_0x25f484,_0x9f8a('0x15'),JSON['stringify'](_0x187214));if(_0x187214[_0x9f8a('0x18')]){if(_0x187214[_0x9f8a('0x18')]['code']===0x1f4){logger[_0x9f8a('0x18')](_0x9f8a('0x14'),_0x25f484,_0x187214['error'][_0x9f8a('0x19')]);return _0x60ab9c(_0x187214[_0x9f8a('0x18')][_0x9f8a('0x19')]);}logger[_0x9f8a('0x18')](_0x9f8a('0x14'),_0x25f484,_0x187214['error'][_0x9f8a('0x19')]);return _0x5d19eb(_0x187214[_0x9f8a('0x18')][_0x9f8a('0x19')]);}else{logger[_0x9f8a('0x13')](_0x9f8a('0x14'),_0x25f484,_0x9f8a('0x15'));_0x5d19eb(_0x187214[_0x9f8a('0x1a')][_0x9f8a('0x19')]);}})['catch'](function(_0xea851c){logger[_0x9f8a('0x18')](_0x9f8a('0x14'),_0x25f484,_0xea851c);_0x60ab9c(_0xea851c);});});}exports[_0x9f8a('0x1b')]=function(_0x126051){var _0x4018fe=this;return new Promise(function(_0x20118c,_0x1fe477){return db[_0x9f8a('0x1c')][_0x9f8a('0x1d')]({'raw':_0x126051['options']?_0x126051[_0x9f8a('0x1e')][_0x9f8a('0x1f')]===undefined?!![]:![]:!![],'where':_0x126051[_0x9f8a('0x1e')]?_0x126051[_0x9f8a('0x1e')][_0x9f8a('0x20')]||null:null,'attributes':_0x126051[_0x9f8a('0x1e')]?_0x126051[_0x9f8a('0x1e')][_0x9f8a('0x21')]||null:null,'limit':_0x126051[_0x9f8a('0x1e')]?_0x126051[_0x9f8a('0x1e')][_0x9f8a('0x22')]||null:null,'include':_0x126051[_0x9f8a('0x1e')]?_0x126051[_0x9f8a('0x1e')][_0x9f8a('0x23')]?_['map'](_0x126051[_0x9f8a('0x1e')][_0x9f8a('0x23')],function(_0x541efa){return{'model':db[_0x541efa[_0x9f8a('0x24')]],'as':_0x541efa['as'],'attributes':_0x541efa['attributes'],'include':_0x541efa['include']?_[_0x9f8a('0x25')](_0x541efa[_0x9f8a('0x23')],function(_0x576b34){return{'model':db[_0x576b34[_0x9f8a('0x24')]],'as':_0x576b34['as'],'attributes':_0x576b34[_0x9f8a('0x21')],'include':_0x576b34[_0x9f8a('0x23')]?_['map'](_0x576b34['include'],function(_0xa21edb){return{'model':db[_0xa21edb[_0x9f8a('0x24')]],'as':_0xa21edb['as'],'attributes':_0xa21edb[_0x9f8a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9f8a('0x12')](function(_0x5b4bf4){logger['info'](_0x9f8a('0x1b'),_0x126051);logger['debug'](_0x9f8a('0x1b'),_0x126051,JSON['stringify'](_0x5b4bf4));_0x20118c(_0x5b4bf4);})[_0x9f8a('0x26')](function(_0x330fcc){logger[_0x9f8a('0x18')](_0x9f8a('0x1b'),_0x330fcc['message'],_0x126051);_0x1fe477(_0x4018fe[_0x9f8a('0x18')](0x1f4,_0x330fcc[_0x9f8a('0x19')]));});});};exports[_0x9f8a('0x27')]=function(_0x36b341){var _0x206faa=this;return new Promise(function(_0x723dff,_0x1a46c6){return db['User'][_0x9f8a('0x28')]({'raw':_0x36b341[_0x9f8a('0x1e')]?_0x36b341[_0x9f8a('0x1e')][_0x9f8a('0x1f')]===undefined?!![]:![]:!![],'where':_0x36b341['options']?_0x36b341[_0x9f8a('0x1e')][_0x9f8a('0x20')]||null:null,'attributes':_0x36b341[_0x9f8a('0x1e')]?_0x36b341[_0x9f8a('0x1e')][_0x9f8a('0x21')]||null:null,'include':_0x36b341[_0x9f8a('0x1e')]?_0x36b341['options']['include']?_[_0x9f8a('0x25')](_0x36b341[_0x9f8a('0x1e')][_0x9f8a('0x23')],function(_0xb28e07){return{'model':db[_0xb28e07['model']],'as':_0xb28e07['as'],'attributes':_0xb28e07['attributes'],'include':_0xb28e07[_0x9f8a('0x23')]?_[_0x9f8a('0x25')](_0xb28e07['include'],function(_0x117139){return{'model':db[_0x117139[_0x9f8a('0x24')]],'as':_0x117139['as'],'attributes':_0x117139[_0x9f8a('0x21')],'include':_0x117139[_0x9f8a('0x23')]?_['map'](_0x117139['include'],function(_0x214bdd){return{'model':db[_0x214bdd[_0x9f8a('0x24')]],'as':_0x214bdd['as'],'attributes':_0x214bdd[_0x9f8a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9f8a('0x12')](function(_0x434f8f){logger[_0x9f8a('0x13')]('ShowUser',_0x36b341);logger[_0x9f8a('0x16')]('ShowUser',_0x36b341,JSON[_0x9f8a('0x29')](_0x434f8f));_0x723dff(_0x434f8f);})[_0x9f8a('0x26')](function(_0x4bc2ed){logger[_0x9f8a('0x18')](_0x9f8a('0x27'),_0x4bc2ed[_0x9f8a('0x19')],_0x36b341);_0x1a46c6(_0x206faa[_0x9f8a('0x18')](0x1f4,_0x4bc2ed[_0x9f8a('0x19')]));});});};exports[_0x9f8a('0x2a')]=function(_0x306307){var _0xefe6cb=this;return new Promise(function(_0x423bf8,_0x1144e7){var _0x3223b1;return db[_0x9f8a('0x1c')][_0x9f8a('0x28')]({'where':_0x306307[_0x9f8a('0x1e')][_0x9f8a('0x20')]||{},'attributes':['id',_0x9f8a('0x2b'),_0x9f8a('0x2c'),_0x9f8a('0x2d'),'interface']})[_0x9f8a('0x12')](function(_0x506eb6){if(_0x506eb6){_0x3223b1=_0x506eb6;return db['UserVoiceQueueRt'][_0x9f8a('0x2e')]({'paused':0x1},{'where':{'UserId':_0x3223b1['id']},'individualHooks':!![]});}})[_0x9f8a('0x12')](function(){if(_0x3223b1){return db['MemberReport'][_0x9f8a('0x1d')]({'where':{'membername':_0x3223b1[_0x9f8a('0x2b')],'type':_0x9f8a('0x2f'),'exitAt':null}});}})[_0x9f8a('0x12')](function(_0x4fa526){if(_0x3223b1){if(_0x4fa526&&_0x4fa526[_0x9f8a('0x30')]){var _0x435af5=moment()[_0x9f8a('0x31')](_0x9f8a('0x32'));for(var _0x73cccc=0x0,_0x3784ca=_0x4fa526[_0x9f8a('0x30')];_0x73cccc<_0x3784ca;_0x73cccc++){_0x4fa526[_0x73cccc]['updateAttributes']({'exitAt':_0x435af5});}}}})[_0x9f8a('0x12')](function(){if(_0x3223b1){var _0x56fb69=[];var _0x5d4f59=utils[_0x9f8a('0x33')]();_0x5d4f59[_0x9f8a('0x34')](function(_0x978e2f){_0x56fb69[_0x9f8a('0x35')]({'channel':_0x978e2f,'membername':_0x3223b1[_0x9f8a('0x2b')],'interface':_[_0x9f8a('0x36')](_0x3223b1['interface'])?util[_0x9f8a('0x31')]('SIP/%s',_0x3223b1['name']):_0x3223b1[_0x9f8a('0x37')],'type':_0x9f8a('0x2f'),'enterAt':moment()[_0x9f8a('0x31')](_0x9f8a('0x32')),'data1':_0x306307[_0x9f8a('0x38')]['type']||_0x9f8a('0x39'),'role':_0x3223b1['role'],'internal':_0x3223b1[_0x9f8a('0x2d')],'uniqueid':_0x306307[_0x9f8a('0x38')][_0x9f8a('0x3a')]||null});});return db[_0x9f8a('0x3b')][_0x9f8a('0x3c')](_0x56fb69,{'individualHooks':!![]});}})['then'](function(){if(_0x3223b1){return _0x3223b1['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x306307[_0x9f8a('0x38')][_0x9f8a('0x3d')]||_0x9f8a('0x39'),'lastPauseAt':moment()[_0x9f8a('0x31')](_0x9f8a('0x32'))});}})[_0x9f8a('0x12')](function(_0x2f4dc4){_0x423bf8(_0x2f4dc4);})[_0x9f8a('0x26')](function(_0x222fb2){_0x1144e7(_0xefe6cb['error'](0x1f4,_0x222fb2[_0x9f8a('0x19')]));});});};exports[_0x9f8a('0x3e')]=function(_0x45cc41){var _0x50bfde=this;return new Promise(function(_0x5d0216,_0x400561){var _0x2a85d8;return db[_0x9f8a('0x1c')][_0x9f8a('0x3f')]({'where':_0x45cc41['options']['where']||{},'attributes':['id',_0x9f8a('0x2b')]})[_0x9f8a('0x12')](function(_0x4e5adf){if(_0x4e5adf){_0x2a85d8=_0x4e5adf;if(_0x45cc41[_0x9f8a('0x38')][_0x9f8a('0x40')]&&!utils[_0x9f8a('0x41')](_0x45cc41['body'][_0x9f8a('0x40')])){throw new Error(_0x9f8a('0x42'));}switch(_0x45cc41[_0x9f8a('0x38')][_0x9f8a('0x40')]){case'voice':return db[_0x9f8a('0x43')][_0x9f8a('0x2e')]({'paused':0x0},{'where':{'UserId':_0x2a85d8['id']}})[_0x9f8a('0x12')](function(){return db[_0x9f8a('0x3b')][_0x9f8a('0x28')]({'where':{'channel':_0x45cc41[_0x9f8a('0x38')][_0x9f8a('0x40')],'membername':_0x2a85d8[_0x9f8a('0x2b')],'type':_0x9f8a('0x2f'),'exitAt':null}});})['then'](function(_0x57ee05){if(_0x57ee05){return _0x57ee05[_0x9f8a('0x2e')]({'exitAt':moment()[_0x9f8a('0x31')](_0x9f8a('0x32')),'data2':_0x9f8a('0x44')},{'individualHooks':!![]});}return null;})[_0x9f8a('0x12')](function(){return _0x2a85d8['update']({'voicePause':![]});});case _0x9f8a('0x45'):case _0x9f8a('0x46'):case _0x9f8a('0x47'):case'sms':case _0x9f8a('0x48'):case'whatsapp':return db['MemberReport'][_0x9f8a('0x28')]({'where':{'channel':_0x45cc41[_0x9f8a('0x38')][_0x9f8a('0x40')],'membername':_0x2a85d8[_0x9f8a('0x2b')],'type':'PAUSE','exitAt':null}})[_0x9f8a('0x12')](function(_0x380f46){return _0x380f46['update']({'exitAt':moment()[_0x9f8a('0x31')](_0x9f8a('0x32')),'data2':'system'},{'individualHooks':!![]});})[_0x9f8a('0x12')](function(){var _0x2d84a4={};_[_0x9f8a('0x49')](_0x2d84a4,util[_0x9f8a('0x31')](_0x9f8a('0x4a'),_0x45cc41[_0x9f8a('0x38')][_0x9f8a('0x40')],_0x9f8a('0x4b')),![]);return _0x2a85d8['update'](_0x2d84a4);});default:return db[_0x9f8a('0x43')]['update']({'paused':0x0},{'where':{'UserId':_0x2a85d8['id']}})['then'](function(){return db['MemberReport'][_0x9f8a('0x1d')]({'where':{'membername':_0x2a85d8[_0x9f8a('0x2b')],'type':'PAUSE','exitAt':null}});})[_0x9f8a('0x12')](function(_0x111609){var _0x5d921c=[];_0x111609[_0x9f8a('0x34')](function(_0x102098){_0x5d921c[_0x9f8a('0x35')](_0x102098[_0x9f8a('0x2e')]({'exitAt':moment()[_0x9f8a('0x31')](_0x9f8a('0x32')),'data2':_0x9f8a('0x44')}));});return BPromise[_0x9f8a('0x4c')](_0x5d921c);})['then'](function(){return _0x2a85d8[_0x9f8a('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x26dee1){_0x5d0216(_0x26dee1);})['catch'](function(_0x157882){_0x400561(_0x50bfde[_0x9f8a('0x18')](0x1f4,_0x157882[_0x9f8a('0x19')]));});});};exports[_0x9f8a('0x4d')]=function(_0x58cc8b){var _0x339c99=this;return new Promise(function(_0x50cbf8,_0x1a0360){var _0x494055;return db[_0x9f8a('0x1c')][_0x9f8a('0x3f')]({'where':_0x58cc8b[_0x9f8a('0x1e')][_0x9f8a('0x20')]||{},'attributes':['id','name']})[_0x9f8a('0x12')](function(_0x953c95){if(_0x953c95){_0x494055=_0x953c95;return db[_0x9f8a('0x43')][_0x9f8a('0x4e')]({'where':{'membername':_0x494055['name']},'individualHooks':!![]});}})[_0x9f8a('0x12')](function(){if(_0x494055){return db['MemberReport'][_0x9f8a('0x1d')]({'where':{'membername':_0x494055['name'],'exitAt':null}});}})[_0x9f8a('0x12')](function(_0x466ca8){if(_0x494055){if(_0x466ca8&&_0x466ca8[_0x9f8a('0x30')]){var _0x8b3ce3=[];_0x466ca8[_0x9f8a('0x34')](function(_0x2e6e85){_0x8b3ce3[_0x9f8a('0x35')](_0x2e6e85['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9f8a('0x4c')](_0x8b3ce3);}}})[_0x9f8a('0x12')](function(){if(_0x494055){return _0x494055['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9f8a('0x12')](function(_0x13d74e){_0x50cbf8(_0x13d74e);})['catch'](function(_0x41c240){_0x1a0360(_0x339c99[_0x9f8a('0x18')](0x1f4,_0x41c240[_0x9f8a('0x19')]));});});};exports['LoginUser']=function(_0x365b64){var _0x380b07=this;return new Promise(function(_0x1dc6d0,_0x1e95e8){var _0x569ea0;var _0x5a3995;var _0x23707e;var _0x42c568;return db['User'][_0x9f8a('0x3f')]({'where':_0x365b64['options'][_0x9f8a('0x20')]||{},'attributes':['id',_0x9f8a('0x2b'),_0x9f8a('0x2c'),_0x9f8a('0x4f'),_0x9f8a('0x50'),'internal',_0x9f8a('0x51'),'interface']})['then'](function(_0xb32e9c){if(_0xb32e9c){_0x569ea0=_0xb32e9c;_0x42c568=_0x365b64['body'][_0x9f8a('0x37')]?_0x365b64[_0x9f8a('0x38')]['interface']:util[_0x9f8a('0x31')]('SIP/%s',_0x569ea0[_0x9f8a('0x2b')]);return db[_0x9f8a('0x1c')][_0x9f8a('0x52')]({'where':{'role':_0x9f8a('0x53'),'online':!![],'id':{'$ne':_0x569ea0['id']}}});}})[_0x9f8a('0x12')](function(_0x5ca5b3){if(_0x5ca5b3){_0x23707e=_0x5ca5b3;return require(_0x9f8a('0x54'))[_0x9f8a('0x55')]();}})['then'](function(_0x2a3386){if(_0x2a3386&&_0x2a3386[_0x9f8a('0x56')]&&_0x23707e>=_0x2a3386[_0x9f8a('0x56')]){throw new Error(_0x9f8a('0x57'));}})[_0x9f8a('0x12')](function(){if(_0x569ea0){return db[_0x9f8a('0x43')][_0x9f8a('0x4e')]({'where':{'membername':_0x569ea0['name']},'individualHooks':!![]});}})[_0x9f8a('0x12')](function(){if(_0x569ea0){return _0x569ea0[_0x9f8a('0x58')]({'raw':!![]});}})[_0x9f8a('0x12')](function(_0xb17c2b){if(_0x569ea0){if(_0xb17c2b){var _0x191eee=[];_0x5a3995=_0xb17c2b;if(_0x5a3995[_0x9f8a('0x30')]){for(var _0x300e48=0x0;_0x300e48<_0x5a3995[_0x9f8a('0x30')];_0x300e48++){_0x191eee[_0x9f8a('0x35')](db[_0x9f8a('0x43')][_0x9f8a('0x59')]({'membername':_0x569ea0[_0x9f8a('0x2b')],'UserId':_0x569ea0['id'],'queue_name':_0x5a3995[_0x300e48]['name'],'VoiceQueueId':_0x5a3995[_0x300e48]['id'],'interface':_0x42c568,'paused':_0x569ea0[_0x9f8a('0x51')]||![],'penalty':_0x5a3995[_0x300e48][_0x9f8a('0x5a')]||0x0}));}return BPromise[_0x9f8a('0x4c')](_0x191eee);}}}})['then'](function(){if(_0x569ea0){return db['MemberReport'][_0x9f8a('0x1d')]({'where':{'membername':_0x569ea0['name'],'exitAt':null}});}})[_0x9f8a('0x12')](function(_0x86ac0c){if(_0x569ea0){if(_0x86ac0c&&_0x86ac0c[_0x9f8a('0x30')]){var _0x5d4672=[];_0x86ac0c['forEach'](function(_0x3f36f2){_0x5d4672[_0x9f8a('0x35')](_0x3f36f2['update']({'exitAt':moment()[_0x9f8a('0x31')](_0x9f8a('0x32'))}));});return BPromise[_0x9f8a('0x4c')](_0x5d4672);}}})[_0x9f8a('0x12')](function(_0x223877){if(_0x569ea0){var _0x1537f5=[];var _0x2d18ec=[];var _0x574851=utils[_0x9f8a('0x33')]();var _0x50dcdf={'membername':_0x569ea0['name'],'interface':_0x42c568,'enterAt':moment()[_0x9f8a('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x569ea0['role'],'internal':_0x569ea0[_0x9f8a('0x2d')]};_0x574851[_0x9f8a('0x34')](function(_0x1556f8){_0x1537f5[_0x9f8a('0x35')](_[_0x9f8a('0x5b')]({'channel':_0x1556f8,'type':_0x9f8a('0x5c'),'data1':_0x9f8a('0x5d'),'data2':_0x42c568},_0x50dcdf));if(_0x569ea0['loginInPause']){_0x2d18ec[_0x9f8a('0x35')](_['merge']({'channel':_0x1556f8,'type':_0x9f8a('0x2f'),'data1':_0x9f8a('0x5e')},_0x50dcdf));}});return db['MemberReport'][_0x9f8a('0x3c')](_0x1537f5['concat'](_0x2d18ec),{'individualHooks':!![]});}})[_0x9f8a('0x12')](function(){if(_0x569ea0){return _0x569ea0[_0x9f8a('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x9f8a('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x569ea0[_0x9f8a('0x51')]||![],'mailPause':_0x569ea0[_0x9f8a('0x51')]||![],'chatPause':_0x569ea0['loginInPause']||![],'faxPause':_0x569ea0[_0x9f8a('0x51')]||![],'smsPause':_0x569ea0[_0x9f8a('0x51')]||![],'openchannelPause':_0x569ea0[_0x9f8a('0x51')]||![],'pauseType':_0x569ea0['loginInPause']?_0x9f8a('0x5e'):null,'lastPauseAt':moment()['format'](_0x9f8a('0x32')),'interface':_0x42c568});}})['then'](function(_0x375513){_0x1dc6d0(_0x375513);})[_0x9f8a('0x26')](function(_0x5d8613){_0x1e95e8(_0x380b07[_0x9f8a('0x18')](0x1f4,_0x5d8613[_0x9f8a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d0ca5f2..8c47239 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 _0x21a5=['./user.events','remove','removeListener','register','length','user:'];(function(_0x33bca5,_0x23ae49){var _0x3009c2=function(_0x2b1ac7){while(--_0x2b1ac7){_0x33bca5['push'](_0x33bca5['shift']());}};_0x3009c2(++_0x23ae49);}(_0x21a5,0x1b6));var _0x521a=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0x21a5[_0xd93b26];return _0x25f668;};'use strict';var UserEvents=require(_0x521a('0x0'));var events=['save',_0x521a('0x1'),'update'];function createListener(_0x421faa,_0x5e297e){return function(_0x1bfc99){_0x5e297e['emit'](_0x421faa,_0x1bfc99);};}function removeListener(_0x5e4bc6,_0x21a2d2){return function(){UserEvents[_0x521a('0x2')](_0x5e4bc6,_0x21a2d2);};}exports[_0x521a('0x3')]=function(_0x4717e0){for(var _0x25de63=0x0,_0x261695=events[_0x521a('0x4')];_0x25de63<_0x261695;_0x25de63++){var _0x509e2a=events[_0x25de63];var _0x2ec7b1=createListener(_0x521a('0x5')+_0x509e2a,_0x4717e0);UserEvents['on'](_0x509e2a,_0x2ec7b1);}}; \ No newline at end of file +var _0x0157=['save','remove','update','register','./user.events'];(function(_0x44a8d4,_0x4a4e24){var _0x2530f3=function(_0x2358f0){while(--_0x2358f0){_0x44a8d4['push'](_0x44a8d4['shift']());}};_0x2530f3(++_0x4a4e24);}(_0x0157,0x1a3));var _0x7015=function(_0x10a12a,_0xee7529){_0x10a12a=_0x10a12a-0x0;var _0x1905af=_0x0157[_0x10a12a];return _0x1905af;};'use strict';var UserEvents=require(_0x7015('0x0'));var events=[_0x7015('0x1'),_0x7015('0x2'),_0x7015('0x3')];function createListener(_0x352a07,_0x5c2ad6){return function(_0x10b765){_0x5c2ad6['emit'](_0x352a07,_0x10b765);};}function removeListener(_0x388bde,_0x3844f1){return function(){UserEvents['removeListener'](_0x388bde,_0x3844f1);};}exports[_0x7015('0x4')]=function(_0x5ee124){for(var _0x256ed6=0x0,_0x50c05c=events['length'];_0x256ed6<_0x50c05c;_0x256ed6++){var _0x1327a8=events[_0x256ed6];var _0x8a8168=createListener('user:'+_0x1327a8,_0x5ee124);UserEvents['on'](_0x1327a8,_0x8a8168);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ab9639d..7fb2df8 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5f5730,_0x23e2fe){var _0x2eda7d=function(_0x27eeb5){while(--_0x27eeb5){_0x5f5730['push'](_0x5f5730['shift']());}};_0x2eda7d(++_0x23e2fe);}(_0xedd9,0xfc));var _0x9edd=function(_0x570f72,_0x2e4eaa){_0x570f72=_0x570f72-0x0;var _0x4881b4=_0xedd9[_0x570f72];return _0x4881b4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x417465,_0x3612ae){var _0x261298=function(_0x5b33a2){while(--_0x5b33a2){_0x417465['push'](_0x417465['shift']());}};_0x261298(++_0x3612ae);}(_0x70e0,0x17b));var _0x070e=function(_0x29c4ce,_0x1025b1){_0x29c4ce=_0x29c4ce-0x0;var _0xbd1816=_0x70e0[_0x29c4ce];return _0xbd1816;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4dffa75..753362e 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 _0x2629=['exports','sequelize'];(function(_0x142289,_0x1dcc40){var _0x574b75=function(_0x3df539){while(--_0x3df539){_0x142289['push'](_0x142289['shift']());}};_0x574b75(++_0x1dcc40);}(_0x2629,0x1c7));var _0x9262=function(_0x1ee8cb,_0x4d1c68){_0x1ee8cb=_0x1ee8cb-0x0;var _0x21f29b=_0x2629[_0x1ee8cb];return _0x21f29b;};'use strict';var Sequelize=require(_0x9262('0x0'));module[_0x9262('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcc6c=['sequelize','exports'];(function(_0x449a5a,_0x1e1917){var _0x5943a2=function(_0x1ba0be){while(--_0x1ba0be){_0x449a5a['push'](_0x449a5a['shift']());}};_0x5943a2(++_0x1e1917);}(_0xcc6c,0x106));var _0xccc6=function(_0x16cb08,_0x2a7cd5){_0x16cb08=_0x16cb08-0x0;var _0x1bb700=_0xcc6c[_0x16cb08];return _0x1bb700;};'use strict';var Sequelize=require(_0xccc6('0x0'));module[_0xccc6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b513b23..5d4fc9b 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 _0x0fff=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x0fff,0x96));var _0xf0ff=function(_0x1bb2e8,_0x11c917){_0x1bb2e8=_0x1bb2e8-0x0;var _0x58e8cd=_0x0fff[_0x1bb2e8];return _0x58e8cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf0ff('0x0'))(_0xf0ff('0x1'));var moment=require(_0xf0ff('0x2'));var BPromise=require(_0xf0ff('0x3'));var rp=require(_0xf0ff('0x4'));var fs=require('fs');var path=require(_0xf0ff('0x5'));var rimraf=require(_0xf0ff('0x6'));var config=require(_0xf0ff('0x7'));var attributes=require(_0xf0ff('0x8'));module[_0xf0ff('0x9')]=function(_0x4bf87f,_0x54a399){return _0x4bf87f[_0xf0ff('0xa')](_0xf0ff('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedb2=['define','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird','request-promise','path','./userChatQueue.attributes','exports'];(function(_0x3f22d4,_0x2bcb5e){var _0x3a4839=function(_0x950f20){while(--_0x950f20){_0x3f22d4['push'](_0x3f22d4['shift']());}};_0x3a4839(++_0x2bcb5e);}(_0xedb2,0xbe));var _0x2edb=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xedb2[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x2edb('0x0'));var util=require(_0x2edb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2edb('0x2'));var BPromise=require(_0x2edb('0x3'));var rp=require(_0x2edb('0x4'));var fs=require('fs');var path=require(_0x2edb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2edb('0x6'));module[_0x2edb('0x7')]=function(_0x3311e3,_0x4a2d7a){return _0x3311e3[_0x2edb('0x8')](_0x2edb('0x9'),attributes,{'tableName':_0x2edb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 20870a0..19e2441 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 _0x4a23=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2bd39e,_0x4ade72){var _0xc11190=function(_0x38e585){while(--_0x38e585){_0x2bd39e['push'](_0x2bd39e['shift']());}};_0xc11190(++_0x4ade72);}(_0x4a23,0x197));var _0x34a2=function(_0x35fc2e,_0x3f518c){_0x35fc2e=_0x35fc2e-0x0;var _0x171d9a=_0x4a23[_0x35fc2e];return _0x171d9a;};'use strict';var _=require('lodash');var util=require(_0x34a2('0x0'));var moment=require('moment');var BPromise=require(_0x34a2('0x1'));var rs=require(_0x34a2('0x2'));var fs=require('fs');var Redis=require(_0x34a2('0x3'));var db=require(_0x34a2('0x4'))['db'];var utils=require(_0x34a2('0x5'));var logger=require(_0x34a2('0x6'))(_0x34a2('0x7'));var config=require(_0x34a2('0x8'));var jayson=require(_0x34a2('0x9'));var client=jayson[_0x34a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4164ed,_0x5c01c8,_0x4b4a03){return new BPromise(function(_0x4af47d,_0x23c84d){return client[_0x34a2('0xb')](_0x4164ed,_0x4b4a03)[_0x34a2('0xc')](function(_0x2dbbb2){logger[_0x34a2('0xd')](_0x34a2('0xe'),_0x5c01c8,_0x34a2('0xf'));logger[_0x34a2('0x10')](_0x34a2('0x11'),_0x5c01c8,_0x34a2('0xf'),JSON[_0x34a2('0x12')](_0x2dbbb2));if(_0x2dbbb2['error']){if(_0x2dbbb2['error'][_0x34a2('0x13')]===0x1f4){logger['error'](_0x34a2('0xe'),_0x5c01c8,_0x2dbbb2[_0x34a2('0x14')][_0x34a2('0x15')]);return _0x23c84d(_0x2dbbb2[_0x34a2('0x14')][_0x34a2('0x15')]);}logger[_0x34a2('0x14')](_0x34a2('0xe'),_0x5c01c8,_0x2dbbb2['error'][_0x34a2('0x15')]);return _0x4af47d(_0x2dbbb2[_0x34a2('0x14')][_0x34a2('0x15')]);}else{logger[_0x34a2('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x5c01c8,_0x34a2('0xf'));_0x4af47d(_0x2dbbb2['result']['message']);}})[_0x34a2('0x16')](function(_0x35f5cb){logger['error'](_0x34a2('0xe'),_0x5c01c8,_0x35f5cb);_0x23c84d(_0x35f5cb);});});} \ No newline at end of file +var _0xe814=['stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x279335,_0x935585){var _0x1caf11=function(_0x2fa62d){while(--_0x2fa62d){_0x279335['push'](_0x279335['shift']());}};_0x1caf11(++_0x935585);}(_0xe814,0x9e));var _0x4e81=function(_0x34ff90,_0xa35c93){_0x34ff90=_0x34ff90-0x0;var _0x38f116=_0xe814[_0x34ff90];return _0x38f116;};'use strict';var _=require(_0x4e81('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e81('0x1'));var db=require(_0x4e81('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e81('0x3'))(_0x4e81('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e81('0x5')][_0x4e81('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x222b39,_0x493794,_0x137ca7){return new BPromise(function(_0x23f90b,_0x1f8315){return client[_0x4e81('0x7')](_0x222b39,_0x137ca7)[_0x4e81('0x8')](function(_0x13afbb){logger[_0x4e81('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x493794,_0x4e81('0xa'));logger[_0x4e81('0xb')](_0x4e81('0xc'),_0x493794,_0x4e81('0xa'),JSON[_0x4e81('0xd')](_0x13afbb));if(_0x13afbb[_0x4e81('0xe')]){if(_0x13afbb[_0x4e81('0xe')][_0x4e81('0xf')]===0x1f4){logger['error'](_0x4e81('0x10'),_0x493794,_0x13afbb['error'][_0x4e81('0x11')]);return _0x1f8315(_0x13afbb[_0x4e81('0xe')][_0x4e81('0x11')]);}logger['error'](_0x4e81('0x10'),_0x493794,_0x13afbb[_0x4e81('0xe')]['message']);return _0x23f90b(_0x13afbb[_0x4e81('0xe')][_0x4e81('0x11')]);}else{logger[_0x4e81('0x9')](_0x4e81('0x10'),_0x493794,_0x4e81('0xa'));_0x23f90b(_0x13afbb['result'][_0x4e81('0x11')]);}})[_0x4e81('0x12')](function(_0x91586){logger[_0x4e81('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x493794,_0x91586);_0x1f8315(_0x91586);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 21ed747..ef778db 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x10a4e8,_0x255316){var _0x4e3442=function(_0x3613bf){while(--_0x3613bf){_0x10a4e8['push'](_0x10a4e8['shift']());}};_0x4e3442(++_0x255316);}(_0xedd9,0xfc));var _0x9edd=function(_0xb56b31,_0x2db4e4){_0xb56b31=_0xb56b31-0x0;var _0x375292=_0xedd9[_0xb56b31];return _0x375292;};'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(_0x32f502,_0x5d9d9f){var _0x2bac2e=function(_0x3bc37a){while(--_0x3bc37a){_0x32f502['push'](_0x32f502['shift']());}};_0x2bac2e(++_0x5d9d9f);}(_0xe706,0xa3));var _0x6e70=function(_0x326a44,_0x41c393){_0x326a44=_0x326a44-0x0;var _0x218e10=_0xe706[_0x326a44];return _0x218e10;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2bd6002..73e93a2 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 _0xcdaa=['STRING','sequelize','INTEGER'];(function(_0x71821,_0x2f2405){var _0x523fb4=function(_0x17f158){while(--_0x17f158){_0x71821['push'](_0x71821['shift']());}};_0x523fb4(++_0x2f2405);}(_0xcdaa,0x1c6));var _0xacda=function(_0x12f383,_0x407236){_0x12f383=_0x12f383-0x0;var _0x534cfd=_0xcdaa[_0x12f383];return _0x534cfd;};'use strict';var Sequelize=require(_0xacda('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xacda('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xacda('0x2')]}}; \ No newline at end of file +var _0x160c=['INTEGER','STRING','sequelize'];(function(_0xda7100,_0x56d4e1){var _0x5e7ff4=function(_0x408ed1){while(--_0x408ed1){_0xda7100['push'](_0xda7100['shift']());}};_0x5e7ff4(++_0x56d4e1);}(_0x160c,0x13d));var _0xc160=function(_0x3d6e62,_0x14f5a1){_0x3d6e62=_0x3d6e62-0x0;var _0x52249b=_0x160c[_0x3d6e62];return _0x52249b;};'use strict';var Sequelize=require(_0xc160('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc160('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc160('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc160('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d6be905..0fa3ae0 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 _0xe7c6=['moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','util','../../config/logger','api'];(function(_0x2a69ee,_0x415ce9){var _0x3b8d4d=function(_0x16469a){while(--_0x16469a){_0x2a69ee['push'](_0x2a69ee['shift']());}};_0x3b8d4d(++_0x415ce9);}(_0xe7c6,0x1cb));var _0x6e7c=function(_0x226ae5,_0x230a19){_0x226ae5=_0x226ae5-0x0;var _0x51056f=_0xe7c6[_0x226ae5];return _0x51056f;};'use strict';var _=require('lodash');var util=require(_0x6e7c('0x0'));var logger=require(_0x6e7c('0x1'))(_0x6e7c('0x2'));var moment=require(_0x6e7c('0x3'));var BPromise=require(_0x6e7c('0x4'));var rp=require(_0x6e7c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e7c('0x6'));var config=require(_0x6e7c('0x7'));var attributes=require(_0x6e7c('0x8'));module[_0x6e7c('0x9')]=function(_0x5d3074,_0xa33b8c){return _0x5d3074[_0x6e7c('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf96e=['./userFaxQueue.attributes','exports','define','user_has_fax_queues','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf96e,0x70));var _0xef96=function(_0x541d90,_0x51157a){_0x541d90=_0x541d90-0x0;var _0x553489=_0xf96e[_0x541d90];return _0x553489;};'use strict';var _=require('lodash');var util=require(_0xef96('0x0'));var logger=require(_0xef96('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xef96('0x2'));var rimraf=require(_0xef96('0x3'));var config=require(_0xef96('0x4'));var attributes=require(_0xef96('0x5'));module[_0xef96('0x6')]=function(_0x3c9fc6,_0x5919f9){return _0x3c9fc6[_0xef96('0x7')]('UserFaxQueue',attributes,{'tableName':_0xef96('0x8'),'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 366d93c..75b6bf5 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 _0xa2f0=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x5b0a93,_0x4fb22a){var _0x376708=function(_0x542b24){while(--_0x542b24){_0x5b0a93['push'](_0x5b0a93['shift']());}};_0x376708(++_0x4fb22a);}(_0xa2f0,0xb8));var _0x0a2f=function(_0x4037c6,_0x22a02e){_0x4037c6=_0x4037c6-0x0;var _0x5531b9=_0xa2f0[_0x4037c6];return _0x5531b9;};'use strict';var _=require(_0x0a2f('0x0'));var util=require(_0x0a2f('0x1'));var moment=require(_0x0a2f('0x2'));var BPromise=require(_0x0a2f('0x3'));var rs=require(_0x0a2f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a2f('0x6'))(_0x0a2f('0x7'));var config=require('../../config/environment');var jayson=require(_0x0a2f('0x8'));var client=jayson[_0x0a2f('0x9')][_0x0a2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15976c,_0x13c5a6,_0xfce886){return new BPromise(function(_0xeda5b8,_0x4c19dd){return client[_0x0a2f('0xb')](_0x15976c,_0xfce886)[_0x0a2f('0xc')](function(_0x615725){logger[_0x0a2f('0xd')](_0x0a2f('0xe'),_0x13c5a6,_0x0a2f('0xf'));logger['debug'](_0x0a2f('0x10'),_0x13c5a6,_0x0a2f('0xf'),JSON[_0x0a2f('0x11')](_0x615725));if(_0x615725[_0x0a2f('0x12')]){if(_0x615725[_0x0a2f('0x12')]['code']===0x1f4){logger['error'](_0x0a2f('0xe'),_0x13c5a6,_0x615725[_0x0a2f('0x12')][_0x0a2f('0x13')]);return _0x4c19dd(_0x615725[_0x0a2f('0x12')][_0x0a2f('0x13')]);}logger['error'](_0x0a2f('0xe'),_0x13c5a6,_0x615725[_0x0a2f('0x12')][_0x0a2f('0x13')]);return _0xeda5b8(_0x615725[_0x0a2f('0x12')][_0x0a2f('0x13')]);}else{logger[_0x0a2f('0xd')](_0x0a2f('0xe'),_0x13c5a6,_0x0a2f('0xf'));_0xeda5b8(_0x615725['result'][_0x0a2f('0x13')]);}})['catch'](function(_0x10d763){logger[_0x0a2f('0x12')](_0x0a2f('0xe'),_0x13c5a6,_0x10d763);_0x4c19dd(_0x10d763);});});} \ No newline at end of file +var _0x1ae1=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x164a59,_0x32c635){var _0x4ce622=function(_0x15cb1f){while(--_0x15cb1f){_0x164a59['push'](_0x164a59['shift']());}};_0x4ce622(++_0x32c635);}(_0x1ae1,0x1c9));var _0x11ae=function(_0x44da6a,_0x62a5e9){_0x44da6a=_0x44da6a-0x0;var _0x3171d5=_0x1ae1[_0x44da6a];return _0x3171d5;};'use strict';var _=require(_0x11ae('0x0'));var util=require(_0x11ae('0x1'));var moment=require('moment');var BPromise=require(_0x11ae('0x2'));var rs=require(_0x11ae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11ae('0x4'))['db'];var utils=require(_0x11ae('0x5'));var logger=require(_0x11ae('0x6'))(_0x11ae('0x7'));var config=require(_0x11ae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x11ae('0x9')][_0x11ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b94d8,_0x32058e,_0x8cb826){return new BPromise(function(_0x5638f2,_0x26cc30){return client[_0x11ae('0xb')](_0x4b94d8,_0x8cb826)['then'](function(_0x2c20e0){logger['info'](_0x11ae('0xc'),_0x32058e,_0x11ae('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x32058e,_0x11ae('0xd'),JSON[_0x11ae('0xe')](_0x2c20e0));if(_0x2c20e0[_0x11ae('0xf')]){if(_0x2c20e0[_0x11ae('0xf')][_0x11ae('0x10')]===0x1f4){logger[_0x11ae('0xf')](_0x11ae('0xc'),_0x32058e,_0x2c20e0[_0x11ae('0xf')]['message']);return _0x26cc30(_0x2c20e0[_0x11ae('0xf')]['message']);}logger[_0x11ae('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x32058e,_0x2c20e0[_0x11ae('0xf')][_0x11ae('0x11')]);return _0x5638f2(_0x2c20e0['error'][_0x11ae('0x11')]);}else{logger[_0x11ae('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x32058e,_0x11ae('0xd'));_0x5638f2(_0x2c20e0[_0x11ae('0x13')][_0x11ae('0x11')]);}})[_0x11ae('0x14')](function(_0x23e76c){logger['error'](_0x11ae('0xc'),_0x32058e,_0x23e76c);_0x26cc30(_0x23e76c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6684507..6105359 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x8f6047,_0x4241da){var _0x1aff61=function(_0x3bd342){while(--_0x3bd342){_0x8f6047['push'](_0x8f6047['shift']());}};_0x1aff61(++_0x4241da);}(_0x70e0,0x17b));var _0x070e=function(_0x4f4cc6,_0x1e48a9){_0x4f4cc6=_0x4f4cc6-0x0;var _0x1f1728=_0x70e0[_0x4f4cc6];return _0x1f1728;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xce06e4,_0x2532fe){var _0x41b0b5=function(_0x7b368d){while(--_0x7b368d){_0xce06e4['push'](_0xce06e4['shift']());}};_0x41b0b5(++_0x2532fe);}(_0xedd9,0xfc));var _0x9edd=function(_0x46ccd5,_0x2c29ac){_0x46ccd5=_0x46ccd5-0x0;var _0x46fd6c=_0xedd9[_0x46ccd5];return _0x46fd6c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index cd616df..02d5d0b 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 _0xd807=['exports','INTEGER','sequelize'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xd807,0x152));var _0x7d80=function(_0x40c07e,_0x2ccabe){_0x40c07e=_0x40c07e-0x0;var _0x19dc84=_0xd807[_0x40c07e];return _0x19dc84;};'use strict';var Sequelize=require(_0x7d80('0x0'));module[_0x7d80('0x1')]={'penalty':{'type':Sequelize[_0x7d80('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa1e=['INTEGER','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfa1e,0xb1));var _0xefa1=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0xfa1e[_0x5ad220];return _0xdec77d;};'use strict';var Sequelize=require(_0xefa1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xefa1('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 84a8fed..6893ce0 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 _0xe140=['user_has_mail_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','UserMailQueue'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xe140,0x109));var _0x0e14=function(_0x478aa1,_0x4f26d7){_0x478aa1=_0x478aa1-0x0;var _0x32782e=_0xe140[_0x478aa1];return _0x32782e;};'use strict';var _=require(_0x0e14('0x0'));var util=require(_0x0e14('0x1'));var logger=require(_0x0e14('0x2'))('api');var moment=require(_0x0e14('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e14('0x4'));var fs=require('fs');var path=require(_0x0e14('0x5'));var rimraf=require('rimraf');var config=require(_0x0e14('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x0e14('0x7')]=function(_0x49e0a5,_0xb47e96){return _0x49e0a5[_0x0e14('0x8')](_0x0e14('0x9'),attributes,{'tableName':_0x0e14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06d4=['user_has_mail_queues','lodash','api','moment','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x8d8ecc,_0xbb93ce){var _0x227427=function(_0x401e09){while(--_0x401e09){_0x8d8ecc['push'](_0x8d8ecc['shift']());}};_0x227427(++_0xbb93ce);}(_0x06d4,0x1e1));var _0x406d=function(_0x11ac31,_0x26d0ab){_0x11ac31=_0x11ac31-0x0;var _0x3d1600=_0x06d4[_0x11ac31];return _0x3d1600;};'use strict';var _=require(_0x406d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x406d('0x1'));var moment=require(_0x406d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x406d('0x3'));var rimraf=require('rimraf');var config=require(_0x406d('0x4'));var attributes=require(_0x406d('0x5'));module[_0x406d('0x6')]=function(_0x482057,_0x5bb874){return _0x482057[_0x406d('0x7')](_0x406d('0x8'),attributes,{'tableName':_0x406d('0x9'),'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 91dff22..2c65418 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 _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(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'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 +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x518253,_0x405e34){var _0x5adeec=function(_0x10f63f){while(--_0x10f63f){_0x518253['push'](_0x518253['shift']());}};_0x5adeec(++_0x405e34);}(_0x55ca,0x126));var _0xa55c=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x55ca[_0x337a10];return _0x575f98;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 83009b4..f80e7a7 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 _0x0332=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x253fc1,_0x564f04){var _0x492b54=function(_0x29f81e){while(--_0x29f81e){_0x253fc1['push'](_0x253fc1['shift']());}};_0x492b54(++_0x564f04);}(_0x0332,0x9b));var _0x2033=function(_0x268b2e,_0x1528d9){_0x268b2e=_0x268b2e-0x0;var _0x1c814b=_0x0332[_0x268b2e];return _0x1c814b;};'use strict';var multer=require(_0x2033('0x0'));var util=require('util');var path=require(_0x2033('0x1'));var timeout=require(_0x2033('0x2'));var express=require(_0x2033('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2033('0x4'));var interaction=require(_0x2033('0x5'));var config=require(_0x2033('0x6'));var controller=require(_0x2033('0x7'));router[_0x2033('0x8')]('/',auth[_0x2033('0x9')](),controller[_0x2033('0xa')]);module[_0x2033('0xb')]=router; \ No newline at end of file +var _0x64d4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','connect-timeout','express','Router'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x64d4,0x1f4));var _0x464d=function(_0x47f58a,_0x27d313){_0x47f58a=_0x47f58a-0x0;var _0x17d912=_0x64d4[_0x47f58a];return _0x17d912;};'use strict';var multer=require('multer');var util=require(_0x464d('0x0'));var path=require('path');var timeout=require(_0x464d('0x1'));var express=require(_0x464d('0x2'));var router=express[_0x464d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x464d('0x4'));var interaction=require(_0x464d('0x5'));var config=require(_0x464d('0x6'));var controller=require(_0x464d('0x7'));router[_0x464d('0x8')]('/',auth[_0x464d('0x9')](),controller[_0x464d('0xa')]);module[_0x464d('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index eab8284..79806ec 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 _0xda10=['exports','TEXT','BOOLEAN','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xda10,0xd3));var _0x0da1=function(_0x24796d,_0x3a7571){_0x24796d=_0x24796d-0x0;var _0x560c3c=_0xda10[_0x24796d];return _0x560c3c;};'use strict';var Sequelize=require(_0x0da1('0x0'));module[_0x0da1('0x1')]={'body':{'type':Sequelize[_0x0da1('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x0da1('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x0da1('0x3')]}}; \ No newline at end of file +var _0xd1f4=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0xd1f4,0x1a0));var _0x4d1f=function(_0x311699,_0x2f9357){_0x311699=_0x311699-0x0;var _0x303f99=_0xd1f4[_0x311699];return _0x303f99;};'use strict';var Sequelize=require(_0x4d1f('0x0'));module[_0x4d1f('0x1')]={'body':{'type':Sequelize[_0x4d1f('0x2')]},'senderName':{'type':Sequelize[_0x4d1f('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x4d1f('0x3')]},'beep':{'type':Sequelize[_0x4d1f('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index bded6e8..8466f51 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 _0x2a5b=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','sendStatus','error','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','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','SenderId','then','recipientsId','join','sequelize','UserNotification','create','beep','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','render','startCase','User','ids','queue','Queue','push','union','flatten','map','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x18d3b6,_0x215259){var _0x406720=function(_0x3bb959){while(--_0x3bb959){_0x18d3b6['push'](_0x18d3b6['shift']());}};_0x406720(++_0x215259);}(_0x2a5b,0xbe));var _0xb2a5=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x2a5b[_0x1147ab];return _0x55cb5a;};'use strict';var emlformat=require(_0xb2a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2a5('0x1'));var jsonpatch=require(_0xb2a5('0x2'));var rp=require(_0xb2a5('0x3'));var moment=require('moment');var BPromise=require(_0xb2a5('0x4'));var Mustache=require('mustache');var util=require(_0xb2a5('0x5'));var path=require(_0xb2a5('0x6'));var sox=require(_0xb2a5('0x7'));var csv=require(_0xb2a5('0x8'));var ejs=require(_0xb2a5('0x9'));var fs=require('fs');var fs_extra=require(_0xb2a5('0xa'));var _=require('lodash');var squel=require(_0xb2a5('0xb'));var crypto=require(_0xb2a5('0xc'));var jsforce=require(_0xb2a5('0xd'));var deskjs=require(_0xb2a5('0xe'));var toCsv=require(_0xb2a5('0x8'));var querystring=require('querystring');var Papa=require(_0xb2a5('0xf'));var Redis=require(_0xb2a5('0x10'));var authService=require(_0xb2a5('0x11'));var qs=require(_0xb2a5('0x12'));var as=require(_0xb2a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2a5('0x14'))(_0xb2a5('0x15'));var utils=require(_0xb2a5('0x16'));var config=require(_0xb2a5('0x17'));var licenseUtil=require(_0xb2a5('0x18'));var db=require(_0xb2a5('0x19'))['db'];config[_0xb2a5('0x1a')]=_[_0xb2a5('0x1b')](config['redis'],{'host':_0xb2a5('0x1c'),'port':0x18eb});var socket=require(_0xb2a5('0x1d'))(new Redis(config[_0xb2a5('0x1a')]));require(_0xb2a5('0x1e'))[_0xb2a5('0x1f')](socket);function respondWithStatusCode(_0x534dac,_0x210e2d){_0x210e2d=_0x210e2d||0xcc;return function(_0x1c496d){if(_0x1c496d){return _0x534dac['sendStatus'](_0x210e2d);}return _0x534dac[_0xb2a5('0x20')](_0x210e2d)[_0xb2a5('0x21')]();};}function respondWithResult(_0x4ee8a1,_0x50a731){_0x50a731=_0x50a731||0xc8;return function(_0x333b51){if(_0x333b51){return _0x4ee8a1[_0xb2a5('0x20')](_0x50a731)[_0xb2a5('0x22')](_0x333b51);}};}function respondWithFilteredResult(_0x326b51,_0x4d6897){return function(_0x20e918){if(_0x20e918){var _0x3dd6db=typeof _0x4d6897[_0xb2a5('0x23')]===_0xb2a5('0x24')&&typeof _0x4d6897[_0xb2a5('0x25')]==='undefined';var _0x19fed1=_0x20e918[_0xb2a5('0x26')];var _0x4cb07b=_0x3dd6db?0x0:_0x4d6897[_0xb2a5('0x23')];var _0x449928=_0x3dd6db?_0x20e918[_0xb2a5('0x26')]:_0x4d6897[_0xb2a5('0x23')]+_0x4d6897['limit'];var _0x529da8;if(_0x449928>=_0x19fed1){_0x449928=_0x19fed1;_0x529da8=0xc8;}else{_0x529da8=0xce;}_0x326b51[_0xb2a5('0x20')](_0x529da8);return _0x326b51['set'](_0xb2a5('0x27'),_0x4cb07b+'-'+_0x449928+'/'+_0x19fed1)[_0xb2a5('0x22')](_0x20e918);}return null;};}function patchUpdates(_0x4e60fa){return function(_0x7a4b87){try{jsonpatch[_0xb2a5('0x28')](_0x7a4b87,_0x4e60fa,!![]);}catch(_0x574a08){return BPromise[_0xb2a5('0x29')](_0x574a08);}return _0x7a4b87[_0xb2a5('0x2a')]();};}function saveUpdates(_0x35792c,_0x5d6261){return function(_0x3cda53){if(_0x3cda53){return _0x3cda53['update'](_0x35792c)['then'](function(_0x5a79c5){return _0x5a79c5;});}return null;};}function removeEntity(_0x57543d,_0x453e66){return function(_0x5af1dd){if(_0x5af1dd){return _0x5af1dd[_0xb2a5('0x2b')]()['then'](function(){_0x57543d[_0xb2a5('0x20')](0xcc)[_0xb2a5('0x21')]();});}};}function handleEntityNotFound(_0x49e719,_0x42781d){return function(_0x238b6b){if(!_0x238b6b){_0x49e719[_0xb2a5('0x2c')](0x194);}return _0x238b6b;};}function handleError(_0x3baeb0,_0x4ba7e8){_0x4ba7e8=_0x4ba7e8||0x1f4;return function(_0x3e8d02){logger[_0xb2a5('0x2d')](_0x3e8d02['stack']);if(_0x3e8d02[_0xb2a5('0x2e')]){delete _0x3e8d02[_0xb2a5('0x2e')];}_0x3baeb0['status'](_0x4ba7e8)[_0xb2a5('0x2f')](_0x3e8d02);};}exports[_0xb2a5('0x30')]=function(_0x3b937b,_0xc8be3f,_0x2176e2){if(!_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x32')](_0xb2a5('0x33'))&&!_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x32')](_0xb2a5('0x34'))){throw new db[(_0xb2a5('0x35'))][(_0xb2a5('0x36'))](_0xb2a5('0x37'));}else{if(_0x3b937b[_0xb2a5('0x31')]['hasOwnProperty'](_0xb2a5('0x34'))&&!_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x32')](_0xb2a5('0x38'))){throw new db['Sequelize']['ValidationError'](_0xb2a5('0x39'));}if(!_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x32')](_0xb2a5('0x3a'))){throw new db[(_0xb2a5('0x35'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x19de26=JSON[_0xb2a5('0x3b')](_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x3a')]);}catch(_0xf69194){logger[_0xb2a5('0x2d')](_0xf69194);throw new db[(_0xb2a5('0x35'))][(_0xb2a5('0x36'))](_0xb2a5('0x3c'));}var _0x1b2ca0=[_0xb2a5('0x3d'),'faxqueue','mailqueue',_0xb2a5('0x3e'),_0xb2a5('0x3f'),_0xb2a5('0x40'),_0xb2a5('0x41'),'team',_0xb2a5('0x42')];if(_[_0xb2a5('0x43')](_0x19de26,function(_0x134cc1){return!_[_0xb2a5('0x44')](_0x1b2ca0,_0x134cc1[_0xb2a5('0x45')][_0xb2a5('0x46')]());})){throw new db[(_0xb2a5('0x35'))][(_0xb2a5('0x36'))](_0xb2a5('0x47'));}}}var _0x35eff0={};_0x35eff0[_0xb2a5('0x48')]=_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x32')](_0xb2a5('0x48'))?_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x48')]:_0x3b937b[_0xb2a5('0x42')][_0xb2a5('0x49')];_0x35eff0[_0xb2a5('0x4a')]=_[_0xb2a5('0x4b')](_0x3b937b['body'][_0xb2a5('0x4a')])?null:_0x3b937b[_0xb2a5('0x31')][_0xb2a5('0x4a')];_0x35eff0['beep']=_0x3b937b['body']['beep']||![];_0x35eff0[_0xb2a5('0x4c')]=_0x3b937b[_0xb2a5('0x42')]['id'];return getContent(_0x3b937b[_0xb2a5('0x31')])[_0xb2a5('0x4d')](function(_0x550fb9){_0x35eff0['body']=_0x550fb9;return getRecipients(_0x19de26);})[_0xb2a5('0x4d')](function(_0x291f9b){_0x35eff0[_0xb2a5('0x4e')]=_['sortBy'](_0x291f9b)[_0xb2a5('0x4f')](',');return db[_0xb2a5('0x50')]['transaction'](function(_0x4e4cf9){return db[_0xb2a5('0x51')][_0xb2a5('0x52')](_0x35eff0,{'raw':!![],'transaction':_0x4e4cf9})[_0xb2a5('0x4d')](function(_0x4e6310){var _0xe60c13={'sender':_0x35eff0[_0xb2a5('0x48')],'description':_0x35eff0[_0xb2a5('0x4a')],'content':_0x35eff0[_0xb2a5('0x31')],'beep':_0x35eff0[_0xb2a5('0x53')]};_0x291f9b[_0xb2a5('0x54')](function(_0x31078b){_0xe60c13[_0xb2a5('0x55')]=_0x31078b;socket[_0xb2a5('0x56')](_0xb2a5('0x57'),_0xe60c13);});return _0x4e6310;});});})[_0xb2a5('0x4d')](respondWithResult(_0xc8be3f,0xc9))[_0xb2a5('0x58')](handleError(_0xc8be3f,null));};function getContent(_0x3a5d29){return new BPromise(function(_0x13b2bc,_0x4aa48a){if(_0x3a5d29['text']){_0x13b2bc(_0x3a5d29['text']);return;}return db[_0xb2a5('0x59')][_0xb2a5('0x5a')]({'attributes':[_0xb2a5('0x5b')],'where':{'id':_0x3a5d29[_0xb2a5('0x34')]},'raw':!![]})[_0xb2a5('0x4d')](function(_0x1ffb71){if(!_0x1ffb71)throw new db[(_0xb2a5('0x35'))][(_0xb2a5('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1f96b3=Mustache[_0xb2a5('0x5c')](_0x1ffb71[_0xb2a5('0x5b')],_0x3a5d29['view']);_0x13b2bc(_0x1f96b3);})[_0xb2a5('0x58')](function(_0xb054af){_0x4aa48a(_0xb054af);});});}function getRecipients(_0xb02a48){return new BPromise(function(_0x21c5fe,_0x1a9918){var _0x59cac2=[];var _0x17e9c3=[];_0xb02a48[_0xb2a5('0x54')](function(_0x48b2db){var _0xc924b0=_[_0xb2a5('0x5d')](_0x48b2db[_0xb2a5('0x45')][_0xb2a5('0x46')]());if(_0xc924b0===_0xb2a5('0x5e')){_0x59cac2=_['union'](_0x59cac2,_0x48b2db[_0xb2a5('0x5f')]);}else{if(_[_0xb2a5('0x44')](_0xc924b0,_0xb2a5('0x60')))_0xc924b0=_0xc924b0['replace']('queue',_0xb2a5('0x61'));_0x48b2db[_0xb2a5('0x5f')][_0xb2a5('0x54')](function(_0x3714d7){_0x17e9c3[_0xb2a5('0x62')](getAgents(_0xc924b0,_0x3714d7));});}});return BPromise['all'](_0x17e9c3)[_0xb2a5('0x4d')](function(_0x574290){_0x59cac2=_[_0xb2a5('0x63')](_0x59cac2,_[_0xb2a5('0x64')](_0x574290));_0x21c5fe(_0x59cac2);})[_0xb2a5('0x58')](function(_0x59bc00){_0x1a9918(_0x59bc00);});});}function getAgents(_0x387d8b,_0x1ac487){return new BPromise(function(_0x1b774d,_0x39fc69){return db[_0x387d8b][_0xb2a5('0x5a')]({'where':{'id':_0x1ac487}})[_0xb2a5('0x4d')](function(_0x4f23d0){return _0x4f23d0['getAgents']({'attributes':['id'],'raw':!![]})[_0xb2a5('0x4d')](function(_0x15ab25){var _0x3a0b83=_[_0xb2a5('0x65')](_0x15ab25,'id');_0x1b774d(_0x3a0b83);});})[_0xb2a5('0x58')](function(_0x25de78){_0x39fc69(_0x25de78);});});} \ No newline at end of file +var _0x558b=['flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','model','toLowerCase','ids','queue','replace','push','all','union'];(function(_0x4bd486,_0x32d2cd){var _0x1e9976=function(_0x48569c){while(--_0x48569c){_0x4bd486['push'](_0x4bd486['shift']());}};_0x1e9976(++_0x32d2cd);}(_0x558b,0x126));var _0xb558=function(_0x5a8b7b,_0x2b9b3c){_0x5a8b7b=_0x5a8b7b-0x0;var _0x57a8e1=_0x558b[_0x5a8b7b];return _0x57a8e1;};'use strict';var emlformat=require(_0xb558('0x0'));var rimraf=require(_0xb558('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb558('0x2'));var rp=require(_0xb558('0x3'));var moment=require(_0xb558('0x4'));var BPromise=require(_0xb558('0x5'));var Mustache=require(_0xb558('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb558('0x7'));var ejs=require(_0xb558('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb558('0x9'));var squel=require(_0xb558('0xa'));var crypto=require(_0xb558('0xb'));var jsforce=require(_0xb558('0xc'));var deskjs=require(_0xb558('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb558('0xe'));var Papa=require(_0xb558('0xf'));var Redis=require(_0xb558('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb558('0x11'));var hardwareService=require(_0xb558('0x12'));var logger=require(_0xb558('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb558('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb558('0x15'))['db'];config['redis']=_[_0xb558('0x16')](config[_0xb558('0x17')],{'host':_0xb558('0x18'),'port':0x18eb});var socket=require(_0xb558('0x19'))(new Redis(config[_0xb558('0x17')]));require(_0xb558('0x1a'))[_0xb558('0x1b')](socket);function respondWithStatusCode(_0x1b1174,_0xcb7108){_0xcb7108=_0xcb7108||0xcc;return function(_0x4e5499){if(_0x4e5499){return _0x1b1174[_0xb558('0x1c')](_0xcb7108);}return _0x1b1174['status'](_0xcb7108)[_0xb558('0x1d')]();};}function respondWithResult(_0x481e73,_0x48fb67){_0x48fb67=_0x48fb67||0xc8;return function(_0x16aec3){if(_0x16aec3){return _0x481e73[_0xb558('0x1e')](_0x48fb67)['json'](_0x16aec3);}};}function respondWithFilteredResult(_0x450230,_0x22485c){return function(_0x14bc0c){if(_0x14bc0c){var _0x62dd7d=typeof _0x22485c[_0xb558('0x1f')]==='undefined'&&typeof _0x22485c[_0xb558('0x20')]===_0xb558('0x21');var _0x281191=_0x14bc0c[_0xb558('0x22')];var _0x1d0ae2=_0x62dd7d?0x0:_0x22485c[_0xb558('0x1f')];var _0x4e5e8d=_0x62dd7d?_0x14bc0c[_0xb558('0x22')]:_0x22485c[_0xb558('0x1f')]+_0x22485c[_0xb558('0x20')];var _0x3258a5;if(_0x4e5e8d>=_0x281191){_0x4e5e8d=_0x281191;_0x3258a5=0xc8;}else{_0x3258a5=0xce;}_0x450230[_0xb558('0x1e')](_0x3258a5);return _0x450230[_0xb558('0x23')](_0xb558('0x24'),_0x1d0ae2+'-'+_0x4e5e8d+'/'+_0x281191)['json'](_0x14bc0c);}return null;};}function patchUpdates(_0x30fcd9){return function(_0x5a8802){try{jsonpatch['apply'](_0x5a8802,_0x30fcd9,!![]);}catch(_0x5a1c37){return BPromise[_0xb558('0x25')](_0x5a1c37);}return _0x5a8802['save']();};}function saveUpdates(_0x3166d4,_0x4f2fa2){return function(_0x29d4f3){if(_0x29d4f3){return _0x29d4f3[_0xb558('0x26')](_0x3166d4)[_0xb558('0x27')](function(_0x95286f){return _0x95286f;});}return null;};}function removeEntity(_0x12d3a2,_0x2b38ac){return function(_0x317962){if(_0x317962){return _0x317962[_0xb558('0x28')]()[_0xb558('0x27')](function(){_0x12d3a2[_0xb558('0x1e')](0xcc)[_0xb558('0x1d')]();});}};}function handleEntityNotFound(_0x4081ff,_0x434602){return function(_0x37ed36){if(!_0x37ed36){_0x4081ff[_0xb558('0x1c')](0x194);}return _0x37ed36;};}function handleError(_0x4b4a76,_0x5cfff0){_0x5cfff0=_0x5cfff0||0x1f4;return function(_0x18f3a1){logger['error'](_0x18f3a1[_0xb558('0x29')]);if(_0x18f3a1['name']){delete _0x18f3a1[_0xb558('0x2a')];}_0x4b4a76[_0xb558('0x1e')](_0x5cfff0)[_0xb558('0x2b')](_0x18f3a1);};}exports[_0xb558('0x2c')]=function(_0x5a1db4,_0x320a09,_0x3c6b9f){if(!_0x5a1db4[_0xb558('0x2d')][_0xb558('0x2e')]('text')&&!_0x5a1db4[_0xb558('0x2d')][_0xb558('0x2e')]('TemplateId')){throw new db[(_0xb558('0x2f'))][(_0xb558('0x30'))](_0xb558('0x31'));}else{if(_0x5a1db4[_0xb558('0x2d')][_0xb558('0x2e')](_0xb558('0x32'))&&!_0x5a1db4[_0xb558('0x2d')]['hasOwnProperty']('view')){throw new db[(_0xb558('0x2f'))][(_0xb558('0x30'))](_0xb558('0x33'));}if(!_0x5a1db4[_0xb558('0x2d')][_0xb558('0x2e')](_0xb558('0x34'))){throw new db[(_0xb558('0x2f'))][(_0xb558('0x30'))](_0xb558('0x35'));}else{try{var _0x2e615a=JSON[_0xb558('0x36')](_0x5a1db4['body'][_0xb558('0x34')]);}catch(_0x1ee592){logger['error'](_0x1ee592);throw new db[(_0xb558('0x2f'))][(_0xb558('0x30'))](_0xb558('0x37'));}var _0x2bc194=[_0xb558('0x38'),_0xb558('0x39'),_0xb558('0x3a'),_0xb558('0x3b'),'smsqueue',_0xb558('0x3c'),_0xb558('0x3d'),_0xb558('0x3e'),_0xb558('0x3f')];if(_[_0xb558('0x40')](_0x2e615a,function(_0x531c58){return!_[_0xb558('0x41')](_0x2bc194,_0x531c58['model']['toLowerCase']());})){throw new db['Sequelize'][(_0xb558('0x30'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2cb6fc={};_0x2cb6fc[_0xb558('0x42')]=_0x5a1db4[_0xb558('0x2d')][_0xb558('0x2e')](_0xb558('0x42'))?_0x5a1db4[_0xb558('0x2d')][_0xb558('0x42')]:_0x5a1db4[_0xb558('0x3f')][_0xb558('0x43')];_0x2cb6fc[_0xb558('0x44')]=_[_0xb558('0x45')](_0x5a1db4[_0xb558('0x2d')][_0xb558('0x44')])?null:_0x5a1db4[_0xb558('0x2d')]['recipientsDescription'];_0x2cb6fc[_0xb558('0x46')]=_0x5a1db4['body'][_0xb558('0x46')]||![];_0x2cb6fc[_0xb558('0x47')]=_0x5a1db4[_0xb558('0x3f')]['id'];return getContent(_0x5a1db4[_0xb558('0x2d')])[_0xb558('0x27')](function(_0x259c73){_0x2cb6fc[_0xb558('0x2d')]=_0x259c73;return getRecipients(_0x2e615a);})['then'](function(_0x2d0998){_0x2cb6fc[_0xb558('0x48')]=_['sortBy'](_0x2d0998)['join'](',');return db[_0xb558('0x49')][_0xb558('0x4a')](function(_0x5c12b7){return db[_0xb558('0x4b')]['create'](_0x2cb6fc,{'raw':!![],'transaction':_0x5c12b7})['then'](function(_0x5bb141){var _0x3dae0b={'sender':_0x2cb6fc[_0xb558('0x42')],'description':_0x2cb6fc[_0xb558('0x44')],'content':_0x2cb6fc[_0xb558('0x2d')],'beep':_0x2cb6fc['beep']};_0x2d0998['forEach'](function(_0x6905){_0x3dae0b[_0xb558('0x4c')]=_0x6905;socket[_0xb558('0x4d')](_0xb558('0x4e'),_0x3dae0b);});return _0x5bb141;});});})[_0xb558('0x27')](respondWithResult(_0x320a09,0xc9))[_0xb558('0x4f')](handleError(_0x320a09,null));};function getContent(_0x569d5b){return new BPromise(function(_0x5a7fc5,_0x46518b){if(_0x569d5b[_0xb558('0x50')]){_0x5a7fc5(_0x569d5b['text']);return;}return db[_0xb558('0x51')][_0xb558('0x52')]({'attributes':[_0xb558('0x53')],'where':{'id':_0x569d5b['TemplateId']},'raw':!![]})[_0xb558('0x27')](function(_0x2fa9eb){if(!_0x2fa9eb)throw new db[(_0xb558('0x2f'))][(_0xb558('0x30'))](_0xb558('0x54'));var _0x123440=Mustache[_0xb558('0x55')](_0x2fa9eb['html'],_0x569d5b['view']);_0x5a7fc5(_0x123440);})[_0xb558('0x4f')](function(_0x4d0da8){_0x46518b(_0x4d0da8);});});}function getRecipients(_0xdd2317){return new BPromise(function(_0x2cafe0,_0x419908){var _0x5a1f3e=[];var _0x45ddf8=[];_0xdd2317['forEach'](function(_0x5607e3){var _0x5af76b=_['startCase'](_0x5607e3[_0xb558('0x56')][_0xb558('0x57')]());if(_0x5af76b==='User'){_0x5a1f3e=_['union'](_0x5a1f3e,_0x5607e3[_0xb558('0x58')]);}else{if(_[_0xb558('0x41')](_0x5af76b,_0xb558('0x59')))_0x5af76b=_0x5af76b[_0xb558('0x5a')](_0xb558('0x59'),'Queue');_0x5607e3[_0xb558('0x58')]['forEach'](function(_0x4a5d64){_0x45ddf8[_0xb558('0x5b')](getAgents(_0x5af76b,_0x4a5d64));});}});return BPromise[_0xb558('0x5c')](_0x45ddf8)[_0xb558('0x27')](function(_0x20a156){_0x5a1f3e=_[_0xb558('0x5d')](_0x5a1f3e,_[_0xb558('0x5e')](_0x20a156));_0x2cafe0(_0x5a1f3e);})[_0xb558('0x4f')](function(_0x34d19b){_0x419908(_0x34d19b);});});}function getAgents(_0xfad72c,_0x4b13fc){return new BPromise(function(_0x105c9f,_0x17dde6){return db[_0xfad72c][_0xb558('0x52')]({'where':{'id':_0x4b13fc}})['then'](function(_0x2bf811){return _0x2bf811[_0xb558('0x5f')]({'attributes':['id'],'raw':!![]})[_0xb558('0x27')](function(_0x4eb277){var _0x29dc55=_[_0xb558('0x60')](_0x4eb277,'id');_0x105c9f(_0x29dc55);});})['catch'](function(_0x30d965){_0x17dde6(_0x30d965);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 72b35dd..e006eb7 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 _0x5348=['save','update','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x3ce555,_0x46abe4){var _0x448dcd=function(_0x54e2ba){while(--_0x54e2ba){_0x3ce555['push'](_0x3ce555['shift']());}};_0x448dcd(++_0x46abe4);}(_0x5348,0x185));var _0x8534=function(_0x985946,_0x3d0e8e){_0x985946=_0x985946-0x0;var _0x4cdc79=_0x5348[_0x985946];return _0x4cdc79;};'use strict';var EventEmitter=require(_0x8534('0x0'));var UserNotification=require(_0x8534('0x1'))['db'][_0x8534('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8534('0x3'),'afterUpdate':_0x8534('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c03b3){return function(_0x319335,_0x260b86,_0x2f7148){UserNotificationEvents['emit'](_0x4c03b3+':'+_0x319335['id'],_0x319335);UserNotificationEvents['emit'](_0x4c03b3,_0x319335);_0x2f7148(null);};}for(var e in events){if(events[_0x8534('0x5')](e)){var event=events[e];UserNotification[_0x8534('0x6')](e,emitEvent(event));}}module[_0x8534('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x48bf=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x48bf,0x8f));var _0xf48b=function(_0x39eaf1,_0x56f6b9){_0x39eaf1=_0x39eaf1-0x0;var _0x116705=_0x48bf[_0x39eaf1];return _0x116705;};'use strict';var EventEmitter=require(_0xf48b('0x0'));var UserNotification=require(_0xf48b('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf48b('0x2')](0x0);var events={'afterCreate':_0xf48b('0x3'),'afterUpdate':_0xf48b('0x4'),'afterDestroy':_0xf48b('0x5')};function emitEvent(_0x56185d){return function(_0xf1a01e,_0x3d8eaa,_0x1350c7){UserNotificationEvents[_0xf48b('0x6')](_0x56185d+':'+_0xf1a01e['id'],_0xf1a01e);UserNotificationEvents[_0xf48b('0x6')](_0x56185d,_0xf1a01e);_0x1350c7(null);};}for(var e in events){if(events[_0xf48b('0x7')](e)){var event=events[e];UserNotification[_0xf48b('0x8')](e,emitEvent(event));}}module[_0xf48b('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index fcd305e..871cf53 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 _0xa552=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x2a4902,_0x53ac8a){var _0x5126dc=function(_0x259251){while(--_0x259251){_0x2a4902['push'](_0x2a4902['shift']());}};_0x5126dc(++_0x53ac8a);}(_0xa552,0x147));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2a55('0x0'));var util=require(_0x2a55('0x1'));var logger=require(_0x2a55('0x2'))(_0x2a55('0x3'));var moment=require('moment');var BPromise=require(_0x2a55('0x4'));var rp=require(_0x2a55('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a55('0x6'));var attributes=require(_0x2a55('0x7'));module[_0x2a55('0x8')]=function(_0x461019,_0x1b2da0){return _0x461019[_0x2a55('0x9')](_0x2a55('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a55('0xb'),'collate':_0x2a55('0xc')});}; \ No newline at end of file +var _0x7ff7=['../../config/logger','api','moment','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x380ad2,_0x4dbef2){var _0x57a7b3=function(_0xbbce48){while(--_0xbbce48){_0x380ad2['push'](_0x380ad2['shift']());}};_0x57a7b3(++_0x4dbef2);}(_0x7ff7,0xef));var _0x77ff=function(_0x26ac09,_0x45bffb){_0x26ac09=_0x26ac09-0x0;var _0x4e541a=_0x7ff7[_0x26ac09];return _0x4e541a;};'use strict';var _=require(_0x77ff('0x0'));var util=require('util');var logger=require(_0x77ff('0x1'))(_0x77ff('0x2'));var moment=require(_0x77ff('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77ff('0x4'));var rimraf=require(_0x77ff('0x5'));var config=require(_0x77ff('0x6'));var attributes=require(_0x77ff('0x7'));module['exports']=function(_0x5e3b10,_0x3a5e03){return _0x5e3b10[_0x77ff('0x8')](_0x77ff('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x77ff('0xa'),'collate':_0x77ff('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c735cc8..69fd8bf 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 _0x1777=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x2afe24,_0x4897){var _0x41a3d3=function(_0x62e824){while(--_0x62e824){_0x2afe24['push'](_0x2afe24['shift']());}};_0x41a3d3(++_0x4897);}(_0x1777,0x13f));var _0x7177=function(_0x46607f,_0x2a6bb8){_0x46607f=_0x46607f-0x0;var _0x2209d8=_0x1777[_0x46607f];return _0x2209d8;};'use strict';var _=require(_0x7177('0x0'));var util=require(_0x7177('0x1'));var moment=require(_0x7177('0x2'));var BPromise=require(_0x7177('0x3'));var rs=require(_0x7177('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7177('0x5'));var logger=require('../../config/logger')(_0x7177('0x6'));var config=require(_0x7177('0x7'));var jayson=require(_0x7177('0x8'));var client=jayson[_0x7177('0x9')]['http']({'port':0x232a});config[_0x7177('0xa')]=_['defaults'](config['redis'],{'host':_0x7177('0xb'),'port':0x18eb});var socket=require(_0x7177('0xc'))(new Redis(config[_0x7177('0xa')]));require(_0x7177('0xd'))[_0x7177('0xe')](socket);function respondWithRpcPromise(_0x2be570,_0x8f1348,_0x4fd89e){return new BPromise(function(_0x2ccf66,_0x1fe7e6){return client['request'](_0x2be570,_0x4fd89e)[_0x7177('0xf')](function(_0x475eca){logger[_0x7177('0x10')](_0x7177('0x11'),_0x8f1348,_0x7177('0x12'));logger[_0x7177('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x8f1348,_0x7177('0x12'),JSON[_0x7177('0x14')](_0x475eca));if(_0x475eca['error']){if(_0x475eca[_0x7177('0x15')][_0x7177('0x16')]===0x1f4){logger[_0x7177('0x15')](_0x7177('0x11'),_0x8f1348,_0x475eca['error'][_0x7177('0x17')]);return _0x1fe7e6(_0x475eca[_0x7177('0x15')]['message']);}logger[_0x7177('0x15')](_0x7177('0x11'),_0x8f1348,_0x475eca['error']['message']);return _0x2ccf66(_0x475eca[_0x7177('0x15')][_0x7177('0x17')]);}else{logger[_0x7177('0x10')](_0x7177('0x11'),_0x8f1348,_0x7177('0x12'));_0x2ccf66(_0x475eca[_0x7177('0x18')]['message']);}})[_0x7177('0x19')](function(_0x44ef20){logger[_0x7177('0x15')](_0x7177('0x11'),_0x8f1348,_0x44ef20);_0x1fe7e6(_0x44ef20);});});} \ No newline at end of file +var _0x42ac=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','socket.io-emitter','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','moment'];(function(_0x4aa036,_0x484894){var _0x1016be=function(_0x5d7149){while(--_0x5d7149){_0x4aa036['push'](_0x4aa036['shift']());}};_0x1016be(++_0x484894);}(_0x42ac,0x6c));var _0xc42a=function(_0x586040,_0x159a50){_0x586040=_0x586040-0x0;var _0x503024=_0x42ac[_0x586040];return _0x503024;};'use strict';var _=require(_0xc42a('0x0'));var util=require('util');var moment=require(_0xc42a('0x1'));var BPromise=require(_0xc42a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc42a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc42a('0x4'));var logger=require(_0xc42a('0x5'))('rpc');var config=require(_0xc42a('0x6'));var jayson=require(_0xc42a('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xc42a('0x8')]=_['defaults'](config[_0xc42a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc42a('0x9'))(new Redis(config['redis']));require('./userNotification.socket')[_0xc42a('0xa')](socket);function respondWithRpcPromise(_0xc8c79f,_0x45d882,_0x1efda3){return new BPromise(function(_0x40753b,_0x3fd998){return client[_0xc42a('0xb')](_0xc8c79f,_0x1efda3)[_0xc42a('0xc')](function(_0x2d94de){logger['info'](_0xc42a('0xd'),_0x45d882,_0xc42a('0xe'));logger[_0xc42a('0xf')](_0xc42a('0x10'),_0x45d882,_0xc42a('0xe'),JSON['stringify'](_0x2d94de));if(_0x2d94de['error']){if(_0x2d94de[_0xc42a('0x11')][_0xc42a('0x12')]===0x1f4){logger[_0xc42a('0x11')](_0xc42a('0xd'),_0x45d882,_0x2d94de[_0xc42a('0x11')][_0xc42a('0x13')]);return _0x3fd998(_0x2d94de[_0xc42a('0x11')][_0xc42a('0x13')]);}logger[_0xc42a('0x11')](_0xc42a('0xd'),_0x45d882,_0x2d94de[_0xc42a('0x11')]['message']);return _0x40753b(_0x2d94de[_0xc42a('0x11')][_0xc42a('0x13')]);}else{logger[_0xc42a('0x14')](_0xc42a('0xd'),_0x45d882,_0xc42a('0xe'));_0x40753b(_0x2d94de[_0xc42a('0x15')]['message']);}})['catch'](function(_0x1c3366){logger[_0xc42a('0x11')](_0xc42a('0xd'),_0x45d882,_0x1c3366);_0x3fd998(_0x1c3366);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3055b71..554f953 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 _0x2f30=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x5df762,_0x2f6b79){var _0x3b3864=function(_0x9c549d){while(--_0x9c549d){_0x5df762['push'](_0x5df762['shift']());}};_0x3b3864(++_0x2f6b79);}(_0x2f30,0xb1));var _0x02f3=function(_0x5ed367,_0x8bb3a0){_0x5ed367=_0x5ed367-0x0;var _0x1de7b7=_0x2f30[_0x5ed367];return _0x1de7b7;};'use strict';var UserNotificationEvents=require(_0x02f3('0x0'));var events=[_0x02f3('0x1'),_0x02f3('0x2'),_0x02f3('0x3')];function createListener(_0xd270d8,_0x2ed3d7){return function(_0x21fdce){_0x2ed3d7[_0x02f3('0x4')](_0xd270d8,_0x21fdce);};}function removeListener(_0x52e645,_0x112834){return function(){UserNotificationEvents[_0x02f3('0x5')](_0x52e645,_0x112834);};}exports[_0x02f3('0x6')]=function(_0x2e4cb){for(var _0x278b32=0x0,_0x4d2e83=events[_0x02f3('0x7')];_0x278b32<_0x4d2e83;_0x278b32++){var _0x4c31ef=events[_0x278b32];var _0x2cb1f2=createListener(_0x02f3('0x8')+_0x4c31ef,_0x2e4cb);UserNotificationEvents['on'](_0x4c31ef,_0x2cb1f2);}}; \ No newline at end of file +var _0x80c5=['register','length','userNotification:','./userNotification.events','save','update','removeListener'];(function(_0x45943a,_0x594756){var _0x96f728=function(_0x3de100){while(--_0x3de100){_0x45943a['push'](_0x45943a['shift']());}};_0x96f728(++_0x594756);}(_0x80c5,0x1df));var _0x580c=function(_0x264a63,_0x245726){_0x264a63=_0x264a63-0x0;var _0x3c4bfe=_0x80c5[_0x264a63];return _0x3c4bfe;};'use strict';var UserNotificationEvents=require(_0x580c('0x0'));var events=[_0x580c('0x1'),'remove',_0x580c('0x2')];function createListener(_0x4ec460,_0x1fd23a){return function(_0x1b0c7d){_0x1fd23a['emit'](_0x4ec460,_0x1b0c7d);};}function removeListener(_0x5d3d30,_0x2b70a4){return function(){UserNotificationEvents[_0x580c('0x3')](_0x5d3d30,_0x2b70a4);};}exports[_0x580c('0x4')]=function(_0x4fa3d4){for(var _0x3aa4aa=0x0,_0x1b102d=events[_0x580c('0x5')];_0x3aa4aa<_0x1b102d;_0x3aa4aa++){var _0x2ac2cc=events[_0x3aa4aa];var _0x2f599e=createListener(_0x580c('0x6')+_0x2ac2cc,_0x4fa3d4);UserNotificationEvents['on'](_0x2ac2cc,_0x2f599e);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9837599..275272d 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(_0x2c5df9,_0x2811cb){var _0x39d1d0=function(_0x57c343){while(--_0x57c343){_0x2c5df9['push'](_0x2c5df9['shift']());}};_0x39d1d0(++_0x2811cb);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d7a99,_0x33a550){var _0x44c725=function(_0x3942bd){while(--_0x3942bd){_0x3d7a99['push'](_0x3d7a99['shift']());}};_0x44c725(++_0x33a550);}(_0xe706,0xa3));var _0x6e70=function(_0x5076e9,_0x22454a){_0x5076e9=_0x5076e9-0x0;var _0x2a0de1=_0xe706[_0x5076e9];return _0x2a0de1;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 2a29672..fd197dd 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 _0xabe0=['exports','INTEGER','sequelize'];(function(_0x5475ed,_0x53d30d){var _0x2206f8=function(_0x3940ac){while(--_0x3940ac){_0x5475ed['push'](_0x5475ed['shift']());}};_0x2206f8(++_0x53d30d);}(_0xabe0,0x182));var _0x0abe=function(_0x1e35b2,_0x28f60a){_0x1e35b2=_0x1e35b2-0x0;var _0x3f9479=_0xabe0[_0x1e35b2];return _0x3f9479;};'use strict';var Sequelize=require(_0x0abe('0x0'));module[_0x0abe('0x1')]={'penalty':{'type':Sequelize[_0x0abe('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe891=['sequelize'];(function(_0x3dcead,_0x33e5f1){var _0x20a5cb=function(_0x2e73cb){while(--_0x2e73cb){_0x3dcead['push'](_0x3dcead['shift']());}};_0x20a5cb(++_0x33e5f1);}(_0xe891,0xcf));var _0x1e89=function(_0x3f276c,_0x3d145a){_0x3f276c=_0x3f276c-0x0;var _0x2b2c10=_0xe891[_0x3f276c];return _0x2b2c10;};'use strict';var Sequelize=require(_0x1e89('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 7f130e9..a5ac024 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 _0xb983=['./userOpenchannelQueue.attributes','UserOpenchannelQueue','api','moment','rimraf','../../config/environment'];(function(_0x1351fe,_0x3b5113){var _0x1030b3=function(_0x8d3944){while(--_0x8d3944){_0x1351fe['push'](_0x1351fe['shift']());}};_0x1030b3(++_0x3b5113);}(_0xb983,0xd4));var _0x3b98=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0xb983[_0x40b493];return _0x548365;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3b98('0x0'));var moment=require(_0x3b98('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3b98('0x2'));var config=require(_0x3b98('0x3'));var attributes=require(_0x3b98('0x4'));module['exports']=function(_0x33fdac,_0x30f2ca){return _0x33fdac['define'](_0x3b98('0x5'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6fc=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x19a35b,_0x535b7){var _0x10aff5=function(_0x2850e0){while(--_0x2850e0){_0x19a35b['push'](_0x19a35b['shift']());}};_0x10aff5(++_0x535b7);}(_0xe6fc,0x9b));var _0xce6f=function(_0x382001,_0xd98668){_0x382001=_0x382001-0x0;var _0x4e7b36=_0xe6fc[_0x382001];return _0x4e7b36;};'use strict';var _=require(_0xce6f('0x0'));var util=require(_0xce6f('0x1'));var logger=require(_0xce6f('0x2'))(_0xce6f('0x3'));var moment=require(_0xce6f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xce6f('0x5'));module[_0xce6f('0x6')]=function(_0x422f5e,_0x5d4998){return _0x422f5e[_0xce6f('0x7')](_0xce6f('0x8'),attributes,{'tableName':_0xce6f('0x9'),'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 29d428a..7e031b5 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 _0x6169=['../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6169,0x115));var _0x9616=function(_0xa7d27,_0x1f30e2){_0xa7d27=_0xa7d27-0x0;var _0x1d1cd2=_0x6169[_0xa7d27];return _0x1d1cd2;};'use strict';var _=require(_0x9616('0x0'));var util=require(_0x9616('0x1'));var moment=require(_0x9616('0x2'));var BPromise=require(_0x9616('0x3'));var rs=require(_0x9616('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9616('0x5'))['db'];var utils=require(_0x9616('0x6'));var logger=require(_0x9616('0x7'))(_0x9616('0x8'));var config=require(_0x9616('0x9'));var jayson=require(_0x9616('0xa'));var client=jayson[_0x9616('0xb')][_0x9616('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x518771,_0x451522,_0x385231){return new BPromise(function(_0x5136ec,_0x524f1a){return client[_0x9616('0xd')](_0x518771,_0x385231)[_0x9616('0xe')](function(_0x1190ff){logger['info'](_0x9616('0xf'),_0x451522,_0x9616('0x10'));logger[_0x9616('0x11')](_0x9616('0x12'),_0x451522,_0x9616('0x10'),JSON[_0x9616('0x13')](_0x1190ff));if(_0x1190ff[_0x9616('0x14')]){if(_0x1190ff[_0x9616('0x14')][_0x9616('0x15')]===0x1f4){logger[_0x9616('0x14')](_0x9616('0xf'),_0x451522,_0x1190ff[_0x9616('0x14')][_0x9616('0x16')]);return _0x524f1a(_0x1190ff['error'][_0x9616('0x16')]);}logger[_0x9616('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x451522,_0x1190ff[_0x9616('0x14')][_0x9616('0x16')]);return _0x5136ec(_0x1190ff[_0x9616('0x14')][_0x9616('0x16')]);}else{logger[_0x9616('0x17')](_0x9616('0xf'),_0x451522,_0x9616('0x10'));_0x5136ec(_0x1190ff[_0x9616('0x18')]['message']);}})[_0x9616('0x19')](function(_0x44fa64){logger['error'](_0x9616('0xf'),_0x451522,_0x44fa64);_0x524f1a(_0x44fa64);});});} \ No newline at end of file +var _0x497d=['util','moment','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x5a71cd,_0x3d4357){var _0x52b5ba=function(_0x48b9aa){while(--_0x48b9aa){_0x5a71cd['push'](_0x5a71cd['shift']());}};_0x52b5ba(++_0x3d4357);}(_0x497d,0xc7));var _0xd497=function(_0x23d947,_0x2a54e1){_0x23d947=_0x23d947-0x0;var _0xcbf25e=_0x497d[_0x23d947];return _0xcbf25e;};'use strict';var _=require(_0xd497('0x0'));var util=require(_0xd497('0x1'));var moment=require(_0xd497('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd497('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd497('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd497('0x5'));var client=jayson[_0xd497('0x6')][_0xd497('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x544b87,_0x1fee1b,_0x4665bd){return new BPromise(function(_0x2632f4,_0x312456){return client[_0xd497('0x8')](_0x544b87,_0x4665bd)[_0xd497('0x9')](function(_0x3f3fa5){logger[_0xd497('0xa')](_0xd497('0xb'),_0x1fee1b,'request\x20sent');logger['debug'](_0xd497('0xc'),_0x1fee1b,'request\x20sent',JSON[_0xd497('0xd')](_0x3f3fa5));if(_0x3f3fa5['error']){if(_0x3f3fa5[_0xd497('0xe')][_0xd497('0xf')]===0x1f4){logger[_0xd497('0xe')](_0xd497('0xb'),_0x1fee1b,_0x3f3fa5[_0xd497('0xe')]['message']);return _0x312456(_0x3f3fa5[_0xd497('0xe')][_0xd497('0x10')]);}logger['error'](_0xd497('0xb'),_0x1fee1b,_0x3f3fa5[_0xd497('0xe')][_0xd497('0x10')]);return _0x2632f4(_0x3f3fa5['error']['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1fee1b,_0xd497('0x11'));_0x2632f4(_0x3f3fa5[_0xd497('0x12')][_0xd497('0x10')]);}})[_0xd497('0x13')](function(_0x1e2701){logger[_0xd497('0xe')](_0xd497('0xb'),_0x1fee1b,_0x1e2701);_0x312456(_0x1e2701);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1ea4bb6..d7a2c02 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 _0x439f=['/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','destroy','delete','removeSections','removeResources','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x242a4b,_0x4b4c89){var _0x577b12=function(_0x3b87a9){while(--_0x3b87a9){_0x242a4b['push'](_0x242a4b['shift']());}};_0x577b12(++_0x4b4c89);}(_0x439f,0x6b));var _0xf439=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x439f[_0x2e4cbf];return _0x52840f;};'use strict';var multer=require(_0xf439('0x0'));var util=require('util');var path=require(_0xf439('0x1'));var timeout=require(_0xf439('0x2'));var express=require(_0xf439('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf439('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf439('0x5'));var controller=require('./userProfile.controller');router[_0xf439('0x6')]('/',auth[_0xf439('0x7')](),controller[_0xf439('0x8')]);router['get'](_0xf439('0x9'),auth[_0xf439('0x7')](),controller[_0xf439('0xa')]);router[_0xf439('0x6')](_0xf439('0xb'),auth[_0xf439('0x7')](),controller[_0xf439('0xc')]);router[_0xf439('0x6')](_0xf439('0xd'),auth[_0xf439('0x7')](),controller[_0xf439('0xe')]);router[_0xf439('0x6')](_0xf439('0xf'),auth['isAuthenticated'](),controller[_0xf439('0x10')]);router[_0xf439('0x11')]('/',auth['isAuthenticated'](),controller[_0xf439('0x12')]);router['post'](_0xf439('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0xf439('0x11')](_0xf439('0xd'),auth[_0xf439('0x7')](),controller[_0xf439('0x14')]);router[_0xf439('0x11')](_0xf439('0xf'),auth[_0xf439('0x7')](),controller[_0xf439('0x15')]);router[_0xf439('0x16')](_0xf439('0xb'),auth[_0xf439('0x7')](),controller[_0xf439('0x17')]);router['delete']('/:id',auth[_0xf439('0x7')](),controller[_0xf439('0x18')]);router[_0xf439('0x19')](_0xf439('0xd'),auth[_0xf439('0x7')](),controller[_0xf439('0x1a')]);router[_0xf439('0x19')](_0xf439('0xf'),auth[_0xf439('0x7')](),controller[_0xf439('0x1b')]);module[_0xf439('0x1c')]=router; \ No newline at end of file +var _0x1d9d=['removeSections','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','update','delete','destroy'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x1d9d,0x1e8));var _0xd1d9=function(_0x3746f3,_0x7ad7b7){_0x3746f3=_0x3746f3-0x0;var _0x3be9d7=_0x1d9d[_0x3746f3];return _0x3be9d7;};'use strict';var multer=require('multer');var util=require(_0xd1d9('0x0'));var path=require('path');var timeout=require(_0xd1d9('0x1'));var express=require(_0xd1d9('0x2'));var router=express['Router']();var fs_extra=require(_0xd1d9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd1d9('0x4'));var config=require(_0xd1d9('0x5'));var controller=require(_0xd1d9('0x6'));router[_0xd1d9('0x7')]('/',auth[_0xd1d9('0x8')](),controller[_0xd1d9('0x9')]);router[_0xd1d9('0x7')](_0xd1d9('0xa'),auth['isAuthenticated'](),controller[_0xd1d9('0xb')]);router[_0xd1d9('0x7')](_0xd1d9('0xc'),auth[_0xd1d9('0x8')](),controller[_0xd1d9('0xd')]);router[_0xd1d9('0x7')](_0xd1d9('0xe'),auth[_0xd1d9('0x8')](),controller['getSections']);router[_0xd1d9('0x7')](_0xd1d9('0xf'),auth['isAuthenticated'](),controller['getResources']);router[_0xd1d9('0x10')]('/',auth[_0xd1d9('0x8')](),controller[_0xd1d9('0x11')]);router[_0xd1d9('0x10')](_0xd1d9('0x12'),auth[_0xd1d9('0x8')](),controller[_0xd1d9('0x13')]);router[_0xd1d9('0x10')](_0xd1d9('0xe'),auth[_0xd1d9('0x8')](),controller[_0xd1d9('0x14')]);router[_0xd1d9('0x10')](_0xd1d9('0xf'),auth[_0xd1d9('0x8')](),controller[_0xd1d9('0x15')]);router['put'](_0xd1d9('0xc'),auth[_0xd1d9('0x8')](),controller[_0xd1d9('0x16')]);router[_0xd1d9('0x17')]('/:id',auth[_0xd1d9('0x8')](),controller[_0xd1d9('0x18')]);router[_0xd1d9('0x17')](_0xd1d9('0xe'),auth['isAuthenticated'](),controller[_0xd1d9('0x19')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0xd1d9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 274fc35..181b418 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 _0x1c04=['STRING','setDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','name'];(function(_0x1f618f,_0x13e460){var _0x520d48=function(_0x45e838){while(--_0x45e838){_0x1f618f['push'](_0x1f618f['shift']());}};_0x520d48(++_0x13e460);}(_0x1c04,0x12d));var _0x41c0=function(_0x2fc5db,_0x2253b1){_0x2fc5db=_0x2fc5db-0x0;var _0x1ef11b=_0x1c04[_0x2fc5db];return _0x1ef11b;};'use strict';var Sequelize=require(_0x41c0('0x0'));module[_0x41c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x41c0('0x2')},'crudPermissions':{'type':Sequelize[_0x41c0('0x3')],'set':function(_0x1d44b9){this[_0x41c0('0x4')](_0x41c0('0x5'),_0x1d44b9?_0x1d44b9['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0x41c0('0x5'))[_0x41c0('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x41c0('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x429c=['getDataValue','crudPermissions','split','BOOLEAN','sequelize','STRING','name','join'];(function(_0x4ee896,_0x3ac43f){var _0x565165=function(_0x14579a){while(--_0x14579a){_0x4ee896['push'](_0x4ee896['shift']());}};_0x565165(++_0x3ac43f);}(_0x429c,0x1c4));var _0xc429=function(_0x27c100,_0x137560){_0x27c100=_0x27c100-0x0;var _0x11a60e=_0x429c[_0x27c100];return _0x11a60e;};'use strict';var Sequelize=require(_0xc429('0x0'));module['exports']={'name':{'type':Sequelize[_0xc429('0x1')],'allowNull':![],'unique':_0xc429('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x488a35){this['setDataValue']('crudPermissions',_0x488a35?_0x488a35[_0xc429('0x3')](''):[]);},'get':function(){return this[_0xc429('0x4')](_0xc429('0x5'))?this[_0xc429('0x4')]('crudPermissions')[_0xc429('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc429('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc429('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc429('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc429('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc429('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc429('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc429('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f33ea28..67b183c 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 _0xd945=['addSections','sectionId','push','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','hasOwnProperty','getResources','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','UserProfile','rawAttributes','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','catch','params','length','includeAll','find','create','body','clone','include','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','map','userProfileId','Resources','UserProfileResource','describe'];(function(_0x290ed3,_0x25e51d){var _0x2ddd2e=function(_0x262883){while(--_0x262883){_0x290ed3['push'](_0x290ed3['shift']());}};_0x2ddd2e(++_0x25e51d);}(_0xd945,0x84));var _0x5d94=function(_0x31118a,_0x4aeb23){_0x31118a=_0x31118a-0x0;var _0x522e1f=_0xd945[_0x31118a];return _0x522e1f;};'use strict';var emlformat=require(_0x5d94('0x0'));var rimraf=require(_0x5d94('0x1'));var zipdir=require(_0x5d94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d94('0x3'));var moment=require(_0x5d94('0x4'));var BPromise=require(_0x5d94('0x5'));var Mustache=require(_0x5d94('0x6'));var util=require(_0x5d94('0x7'));var path=require('path');var sox=require(_0x5d94('0x8'));var csv=require(_0x5d94('0x9'));var ejs=require(_0x5d94('0xa'));var fs=require('fs');var fs_extra=require(_0x5d94('0xb'));var _=require(_0x5d94('0xc'));var squel=require('squel');var crypto=require(_0x5d94('0xd'));var jsforce=require(_0x5d94('0xe'));var deskjs=require(_0x5d94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d94('0x10'));var Papa=require(_0x5d94('0x11'));var Redis=require(_0x5d94('0x12'));var authService=require(_0x5d94('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d94('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d94('0x15'))(_0x5d94('0x16'));var utils=require(_0x5d94('0x17'));var config=require(_0x5d94('0x18'));var licenseUtil=require(_0x5d94('0x19'));var db=require(_0x5d94('0x1a'))['db'];config[_0x5d94('0x1b')]=_[_0x5d94('0x1c')](config[_0x5d94('0x1b')],{'host':_0x5d94('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d94('0x1b')]));require(_0x5d94('0x1e'))['register'](socket);function respondWithStatusCode(_0x1d8291,_0x427eb2){_0x427eb2=_0x427eb2||0xcc;return function(_0xd78460){if(_0xd78460){return _0x1d8291[_0x5d94('0x1f')](_0x427eb2);}return _0x1d8291[_0x5d94('0x20')](_0x427eb2)[_0x5d94('0x21')]();};}function respondWithResult(_0x5c4d65,_0x555419){_0x555419=_0x555419||0xc8;return function(_0x541ef1){if(_0x541ef1){return _0x5c4d65[_0x5d94('0x20')](_0x555419)[_0x5d94('0x22')](_0x541ef1);}};}function respondWithFilteredResult(_0x1ef529,_0x133ee5){return function(_0x12c238){if(_0x12c238){var _0x47ea45=typeof _0x133ee5[_0x5d94('0x23')]===_0x5d94('0x24')&&typeof _0x133ee5[_0x5d94('0x25')]===_0x5d94('0x24');var _0x176f5c=_0x12c238[_0x5d94('0x26')];var _0x66be60=_0x47ea45?0x0:_0x133ee5[_0x5d94('0x23')];var _0x36f6d4=_0x47ea45?_0x12c238[_0x5d94('0x26')]:_0x133ee5[_0x5d94('0x23')]+_0x133ee5[_0x5d94('0x25')];var _0xe21853;if(_0x36f6d4>=_0x176f5c){_0x36f6d4=_0x176f5c;_0xe21853=0xc8;}else{_0xe21853=0xce;}_0x1ef529['status'](_0xe21853);return _0x1ef529[_0x5d94('0x27')](_0x5d94('0x28'),_0x66be60+'-'+_0x36f6d4+'/'+_0x176f5c)[_0x5d94('0x22')](_0x12c238);}return null;};}function patchUpdates(_0x2a643f){return function(_0x2b867b){try{jsonpatch[_0x5d94('0x29')](_0x2b867b,_0x2a643f,!![]);}catch(_0xd0fbf0){return BPromise[_0x5d94('0x2a')](_0xd0fbf0);}return _0x2b867b[_0x5d94('0x2b')]();};}function saveUpdates(_0x40c0a6,_0x100aa2){return function(_0x330d46){if(_0x330d46){return _0x330d46[_0x5d94('0x2c')](_0x40c0a6)[_0x5d94('0x2d')](function(_0x1c1344){return _0x1c1344;});}return null;};}function removeEntity(_0x478c39,_0x374c3f){return function(_0x452ad7){if(_0x452ad7){return _0x452ad7[_0x5d94('0x2e')]()[_0x5d94('0x2d')](function(){_0x478c39[_0x5d94('0x20')](0xcc)[_0x5d94('0x21')]();});}};}function handleEntityNotFound(_0x27426f,_0x140f8a){return function(_0x2f3b3e){if(!_0x2f3b3e){_0x27426f[_0x5d94('0x1f')](0x194);}return _0x2f3b3e;};}function handleError(_0x235d18,_0x4a0398){_0x4a0398=_0x4a0398||0x1f4;return function(_0x5a117f){logger[_0x5d94('0x2f')](_0x5a117f['stack']);if(_0x5a117f[_0x5d94('0x30')]){delete _0x5a117f[_0x5d94('0x30')];}_0x235d18[_0x5d94('0x20')](_0x4a0398)[_0x5d94('0x31')](_0x5a117f);};}exports[_0x5d94('0x32')]=function(_0x27a401,_0x124b59){var _0x12a145={},_0x20f6ba={},_0x150f56={'count':0x0,'rows':[]};var _0x530fe5=_['map'](db[_0x5d94('0x33')][_0x5d94('0x34')],function(_0x38ca6f){return{'name':_0x38ca6f['fieldName'],'type':_0x38ca6f['type']['key']};});_0x20f6ba[_0x5d94('0x35')]=_['map'](_0x530fe5,_0x5d94('0x30'));_0x20f6ba[_0x5d94('0x36')]=_[_0x5d94('0x37')](_0x27a401[_0x5d94('0x36')]);_0x20f6ba[_0x5d94('0x38')]=_[_0x5d94('0x39')](_0x20f6ba[_0x5d94('0x35')],_0x20f6ba[_0x5d94('0x36')]);_0x12a145['attributes']=_[_0x5d94('0x39')](_0x20f6ba[_0x5d94('0x35')],qs[_0x5d94('0x3a')](_0x27a401[_0x5d94('0x36')]['fields']));_0x12a145['attributes']=_0x12a145[_0x5d94('0x3b')]['length']?_0x12a145['attributes']:_0x20f6ba[_0x5d94('0x35')];if(!_0x27a401[_0x5d94('0x36')]['hasOwnProperty']('nolimit')){_0x12a145[_0x5d94('0x25')]=qs[_0x5d94('0x25')](_0x27a401['query'][_0x5d94('0x25')]);_0x12a145[_0x5d94('0x23')]=qs[_0x5d94('0x23')](_0x27a401[_0x5d94('0x36')][_0x5d94('0x23')]);}_0x12a145[_0x5d94('0x3c')]=qs[_0x5d94('0x3d')](_0x27a401[_0x5d94('0x36')][_0x5d94('0x3d')]);_0x12a145[_0x5d94('0x3e')]=qs['filters'](_[_0x5d94('0x3f')](_0x27a401[_0x5d94('0x36')],_0x20f6ba[_0x5d94('0x38')]),_0x530fe5);if(_0x27a401[_0x5d94('0x36')]['filter']){_0x12a145[_0x5d94('0x3e')]=_[_0x5d94('0x40')](_0x12a145['where'],{'$or':_['map'](_0x530fe5,function(_0x158cf4){if(_0x158cf4[_0x5d94('0x41')]!==_0x5d94('0x42')){var _0x42f130={};_0x42f130[_0x158cf4[_0x5d94('0x30')]]={'$like':'%'+_0x27a401['query'][_0x5d94('0x43')]+'%'};return _0x42f130;}})});}_0x12a145=_[_0x5d94('0x40')]({},_0x12a145,_0x27a401[_0x5d94('0x44')]);var _0x1fc5e1={'where':_0x12a145['where']};return db[_0x5d94('0x33')][_0x5d94('0x26')](_0x1fc5e1)[_0x5d94('0x2d')](function(_0x4b9b02){_0x150f56[_0x5d94('0x26')]=_0x4b9b02;if(_0x27a401['query']['includeAll']){_0x12a145['include']=[{'all':!![]}];}return db[_0x5d94('0x33')][_0x5d94('0x45')](_0x12a145);})[_0x5d94('0x2d')](function(_0x1822ad){_0x150f56['rows']=_0x1822ad;return _0x150f56;})[_0x5d94('0x2d')](respondWithFilteredResult(_0x124b59,_0x12a145))[_0x5d94('0x46')](handleError(_0x124b59,null));};exports['show']=function(_0x478784,_0x2083f2){var _0x257836={'raw':![],'where':{'id':_0x478784[_0x5d94('0x47')]['id']}},_0x5b0a31={};_0x5b0a31['model']=_[_0x5d94('0x37')](db['UserProfile'][_0x5d94('0x34')]);_0x5b0a31[_0x5d94('0x36')]=_[_0x5d94('0x37')](_0x478784[_0x5d94('0x36')]);_0x5b0a31[_0x5d94('0x38')]=_[_0x5d94('0x39')](_0x5b0a31['model'],_0x5b0a31[_0x5d94('0x36')]);_0x257836[_0x5d94('0x3b')]=_[_0x5d94('0x39')](_0x5b0a31[_0x5d94('0x35')],qs['fields'](_0x478784[_0x5d94('0x36')]['fields']));_0x257836['attributes']=_0x257836[_0x5d94('0x3b')][_0x5d94('0x48')]?_0x257836[_0x5d94('0x3b')]:_0x5b0a31[_0x5d94('0x35')];if(_0x478784[_0x5d94('0x36')][_0x5d94('0x49')]){_0x257836['include']=[{'all':!![]}];}_0x257836=_['merge']({},_0x257836,_0x478784[_0x5d94('0x44')]);return db[_0x5d94('0x33')][_0x5d94('0x4a')](_0x257836)[_0x5d94('0x2d')](handleEntityNotFound(_0x2083f2,null))[_0x5d94('0x2d')](respondWithResult(_0x2083f2,null))[_0x5d94('0x46')](handleError(_0x2083f2,null));};exports[_0x5d94('0x4b')]=function(_0x5ce78c,_0x45a6c9){return db[_0x5d94('0x33')]['create'](_0x5ce78c[_0x5d94('0x4c')],{})[_0x5d94('0x2d')](respondWithResult(_0x45a6c9,0xc9))[_0x5d94('0x46')](handleError(_0x45a6c9,null));};exports[_0x5d94('0x4d')]=function(_0x40e595,_0x12e049){var _0x195463={'where':{'id':_0x40e595['params']['id']}},_0x2b7c09={};_0x2b7c09['model']=_[_0x5d94('0x37')](db[_0x5d94('0x33')][_0x5d94('0x34')]);_0x195463[_0x5d94('0x3b')]=_['intersection'](_0x2b7c09[_0x5d94('0x35')],qs[_0x5d94('0x3a')](_0x40e595[_0x5d94('0x36')]['fields']));_0x195463[_0x5d94('0x3b')]=_0x195463[_0x5d94('0x3b')][_0x5d94('0x48')]?_0x195463[_0x5d94('0x3b')]:_0x2b7c09['model'];if(_0x40e595[_0x5d94('0x36')][_0x5d94('0x49')]){_0x195463[_0x5d94('0x4e')]=[{'all':!![]}];}_0x195463=_['merge']({},_0x195463,_0x40e595[_0x5d94('0x44')]);return db[_0x5d94('0x33')][_0x5d94('0x4a')](_0x195463)['then'](handleEntityNotFound(_0x12e049,null))[_0x5d94('0x2d')](function(_0x15ed7e){if(_0x15ed7e){var _0x447338=_0x15ed7e[_0x5d94('0x4f')]({'plain':!![]});_0x447338=qs[_0x5d94('0x50')](_0x447338,['id',_0x5d94('0x51'),_0x5d94('0x52'),_0x5d94('0x53')]);_0x40e595[_0x5d94('0x4c')]=_[_0x5d94('0x50')](_0x40e595['body'],['id',_0x5d94('0x51'),_0x5d94('0x52')]);return db[_0x5d94('0x54')][_0x5d94('0x55')](function(_0x32944c){return db[_0x5d94('0x33')]['create'](_[_0x5d94('0x40')](_0x447338,_0x40e595[_0x5d94('0x4c')]),{'include':_0x40e595[_0x5d94('0x36')][_0x5d94('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x32944c})[_0x5d94('0x2d')](function(_0x330698){var _0x5ddd2e=_0x330698[_0x5d94('0x4f')]({'plain':!![]});return db[_0x5d94('0x56')]['findAll']({'where':{'userProfileId':_0x40e595['params']['id']},'raw':!![]})[_0x5d94('0x2d')](function(_0x51de26){if(_0x51de26){return BPromise[_0x5d94('0x57')](_0x51de26,function(_0x13ab17){return new BPromise(function(_0x1288dc,_0x2b448e){if(_0x13ab17[_0x5d94('0x58')]===null||_0x13ab17['autoAssociation']===0x1)_0x1288dc(null);return db['UserProfileResource'][_0x5d94('0x45')]({'where':{'sectionId':_0x13ab17['id']},'raw':!![]})['then'](function(_0x4203f7){var _0x12aec2=_[_0x5d94('0x59')](_0x4203f7,function(_0x1c2409){return qs[_0x5d94('0x50')](_0x1c2409,['id','createdAt',_0x5d94('0x52'),'sectionId']);});_0x1288dc(_0x12aec2);})[_0x5d94('0x46')](function(_0x17e08d){_0x2b448e(_0x17e08d);});})[_0x5d94('0x2d')](function(_0x1d47d2){var _0x3ffd95=qs[_0x5d94('0x50')](_0x13ab17,['id',_0x5d94('0x51'),_0x5d94('0x52')]);_0x3ffd95[_0x5d94('0x5a')]=_0x5ddd2e['id'];if(_0x1d47d2)_0x3ffd95[_0x5d94('0x5b')]=_0x1d47d2;return _0x3ffd95;})[_0x5d94('0x2d')](function(_0xb13c0){return db[_0x5d94('0x56')][_0x5d94('0x4b')](_0xb13c0,{'include':[{'model':db[_0x5d94('0x5c')],'as':_0x5d94('0x5b')}],'raw':!![],'transaction':_0x32944c});});})[_0x5d94('0x2d')](function(){return _0x5ddd2e;});}});});});}})[_0x5d94('0x2d')](respondWithResult(_0x12e049,0xc9))[_0x5d94('0x46')](handleError(_0x12e049,null));};exports[_0x5d94('0x2c')]=function(_0x3cff37,_0x3c2f0a){if(_0x3cff37['body']['id']){delete _0x3cff37[_0x5d94('0x4c')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x3cff37[_0x5d94('0x47')]['id']}})[_0x5d94('0x2d')](handleEntityNotFound(_0x3c2f0a,null))['then'](saveUpdates(_0x3cff37[_0x5d94('0x4c')],null))[_0x5d94('0x2d')](respondWithResult(_0x3c2f0a,null))[_0x5d94('0x46')](handleError(_0x3c2f0a,null));};exports[_0x5d94('0x2e')]=function(_0x18c714,_0x2e88b6){return db[_0x5d94('0x33')][_0x5d94('0x4a')]({'where':{'id':_0x18c714[_0x5d94('0x47')]['id']}})[_0x5d94('0x2d')](handleEntityNotFound(_0x2e88b6,null))[_0x5d94('0x2d')](removeEntity(_0x2e88b6,null))['catch'](handleError(_0x2e88b6,null));};exports[_0x5d94('0x5d')]=function(_0x1f0f46,_0x3405b9){return db[_0x5d94('0x33')][_0x5d94('0x5d')]()['then'](respondWithResult(_0x3405b9,null))[_0x5d94('0x46')](handleError(_0x3405b9,null));};exports[_0x5d94('0x5e')]=function(_0x3b59e3,_0x4c5525){var _0x4fb1ae=_0x3b59e3[_0x5d94('0x4c')];return db['UserProfile'][_0x5d94('0x4a')]({'where':{'id':_0x3b59e3[_0x5d94('0x47')]['id']}})[_0x5d94('0x2d')](handleEntityNotFound(_0x4c5525,null))[_0x5d94('0x2d')](function(_0x1e8edc){if(_0x1e8edc){return db[_0x5d94('0x54')][_0x5d94('0x55')](function(_0x1f2247){return db[_0x5d94('0x56')]['destroy']({'where':{'userProfileId':_0x3b59e3[_0x5d94('0x47')]['id'],'sectionId':_['map'](_0x4fb1ae,function(_0xa8576d){return _0xa8576d[_0x5d94('0x5f')];})},'transaction':_0x1f2247})[_0x5d94('0x2d')](function(){var _0x23dee9=_[_0x5d94('0x59')](_0x4fb1ae,function(_0x5deac8){_0x5deac8['userProfileId']=_0x3b59e3[_0x5d94('0x47')]['id'];return _0x5deac8;});var _0x4eb447=[];return BPromise[_0x5d94('0x57')](_0x23dee9,function(_0x42a461){return db[_0x5d94('0x56')][_0x5d94('0x4b')](_0x42a461,{'include':[{'model':db[_0x5d94('0x5c')],'as':_0x5d94('0x5b')}],'raw':!![],'transaction':_0x1f2247})[_0x5d94('0x2d')](function(_0x5e75e1){_0x4eb447[_0x5d94('0x60')](_0x5e75e1[_0x5d94('0x4f')]({'plain':!![]}));});})['then'](function(){return _0x4eb447;});});});}})[_0x5d94('0x2d')](function(_0x4ddb87){return _0x4ddb87;})['then'](respondWithResult(_0x4c5525,null))[_0x5d94('0x46')](handleError(_0x4c5525,null));};exports['removeSections']=function(_0x35b053,_0x195dd8){var _0x5f3d69;return db[_0x5d94('0x33')][_0x5d94('0x4a')]({'where':{'id':_0x35b053['params']['id']},'attributes':['id',_0x5d94('0x30')]})[_0x5d94('0x2d')](handleEntityNotFound(_0x195dd8,null))[_0x5d94('0x2d')](function(_0x5eed0b){if(_0x5eed0b){_0x5f3d69=_0x5eed0b;return db[_0x5d94('0x56')][_0x5d94('0x2e')]({'where':{'userProfileId':_0x35b053['params']['id'],'sectionId':_0x35b053[_0x5d94('0x36')][_0x5d94('0x61')]}});}})[_0x5d94('0x2d')](function(){return _0x5f3d69;})['then'](respondWithStatusCode(_0x195dd8,null))[_0x5d94('0x46')](handleError(_0x195dd8,null));};exports[_0x5d94('0x62')]=function(_0x5ea9ae,_0x8f7f3c){var _0x2ddd84=[];var _0x31c548=[];return db['UserProfileSection'][_0x5d94('0x45')]({'where':{'userProfileId':_0x5ea9ae[_0x5d94('0x47')]['id']},'raw':!![]})[_0x5d94('0x2d')](function(_0x570742){_0x2ddd84=_[_0x5d94('0x43')](_0x570742,function(_0x3af6c1){return _0x3af6c1[_0x5d94('0x63')]===0x1||_[_0x5d94('0x64')]([0x3eb,0x709],_0x3af6c1[_0x5d94('0x5f')]);});if(!_[_0x5d94('0x65')](_0x2ddd84)){return _[_0x5d94('0x59')](_0x2ddd84,function(_0x32418e){return _0x32418e[_0x5d94('0x5f')];});}else{return;}})[_0x5d94('0x2d')](function(_0x5253f4){if(_0x5253f4)_0x31c548=_0x5253f4;if(_[_0x5d94('0x64')](_0x31c548,0x64)){var _0x4a38d3=_['find'](_0x2ddd84,{'sectionId':0x64});return hasDefaultDashboard(_0x4a38d3)[_0x5d94('0x2d')](function(_0x4e13aa){return _[_0x5d94('0x59')](_0x2ddd84,function(_0x179774){if(_0x179774[_0x5d94('0x5f')]===0x64){_0x179774[_0x5d94('0x66')]=_0x4e13aa;}return _0x179774;});});}else{return;}})['then'](function(_0x499bf9){if(_0x499bf9)_0x2ddd84=_0x499bf9;if(_[_0x5d94('0x64')](_0x31c548,0x3eb)){var _0x156da9=_[_0x5d94('0x4a')](_0x2ddd84,{'sectionId':0x3eb});return getCustomDashboards(_0x156da9)[_0x5d94('0x2d')](function(_0x5481fc){return _[_0x5d94('0x59')](_0x2ddd84,function(_0x393ada){if(_0x156da9['enabled']){if(_0x393ada[_0x5d94('0x5f')]===0x3eb){_0x393ada[_0x5d94('0x66')]=_0x5481fc;}}else{if(_0x393ada[_0x5d94('0x5f')]===0x64){_0x393ada[_0x5d94('0x66')]=_0x5481fc;}}return _0x393ada;});});}else{return;}})[_0x5d94('0x2d')](function(_0x542134){if(_0x542134)_0x2ddd84=_0x542134;if(_[_0x5d94('0x64')](_0x31c548,0x709)){var _0x2911ae=_[_0x5d94('0x4a')](_0x2ddd84,{'sectionId':0x709});return getPlugins(_0x2911ae)[_0x5d94('0x2d')](function(_0x56f639){if(_0x2911ae[_0x5d94('0x63')]){return _[_0x5d94('0x59')](_0x2ddd84,function(_0x50382c){if(_0x50382c[_0x5d94('0x5f')]===0x709){_0x50382c[_0x5d94('0x66')]=_0x56f639;}return _0x50382c;});}else{var _0x1983e3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x56f639};var _0x81b380=_[_0x5d94('0x59')](_0x2ddd84);_0x81b380[_0x5d94('0x60')](_0x1983e3);return _0x81b380;}});}else{return;}})[_0x5d94('0x2d')](function(_0x4078ba){if(_0x4078ba)_0x2ddd84=_0x4078ba;return _[_0x5d94('0x43')](_0x2ddd84,[_0x5d94('0x63'),0x1]);})['then'](respondWithResult(_0x8f7f3c,null))['catch'](handleError(_0x8f7f3c,null));};function hasDefaultDashboard(_0x16d5e4){var _0x3f9595=[0x65];return new BPromise(function(_0x31a1ed,_0xcb8ccd){try{if(_0x16d5e4[_0x5d94('0x58')]){_0x31a1ed(_0x3f9595);}else{return db[_0x5d94('0x5c')][_0x5d94('0x67')]({'where':{'sectionId':_0x16d5e4['id']},'raw':!![]})[_0x5d94('0x2d')](function(_0x411b1b){_0x411b1b?_0x31a1ed(_0x3f9595):_0x31a1ed();});}}catch(_0x34c631){_0xcb8ccd(_0x34c631);}});}function getCustomDashboards(_0x49ba7a){var _0x4fde77=[];return new BPromise(function(_0x26586f,_0x526990){try{if(_0x49ba7a['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0x5d94('0x2d')](function(_0x5021f1){_0x5021f1[_0x5d94('0x68')](function(_0x5f34bf){_0x4fde77[_0x5d94('0x60')](_0x5f34bf['id']+0x1869f);});_0x26586f(_0x4fde77);});}else{return db[_0x5d94('0x5c')][_0x5d94('0x45')]({'where':{'sectionId':_0x49ba7a['id']},'raw':!![]})[_0x5d94('0x2d')](function(_0x4a8e9a){_0x4a8e9a[_0x5d94('0x68')](function(_0x54530f){_0x4fde77[_0x5d94('0x60')](_0x54530f[_0x5d94('0x69')]+0x1869f);});_0x26586f(_0x4fde77);});}}catch(_0x112cc6){_0x526990(_0x112cc6);}});}function getPlugins(_0x2864d7){var _0x51fd62=[];return new BPromise(function(_0x12e683,_0x1a97b0){try{if(_0x2864d7[_0x5d94('0x58')]){return db[_0x5d94('0x6a')][_0x5d94('0x45')]({'raw':!![]})[_0x5d94('0x2d')](function(_0x4bee31){_0x4bee31[_0x5d94('0x68')](function(_0x2540ee){_0x51fd62[_0x5d94('0x60')](_0x2540ee['id']+0x15b38);});_0x12e683(_0x51fd62);});}else{return db['UserProfileResource'][_0x5d94('0x45')]({'where':{'sectionId':_0x2864d7['id']},'raw':!![]})[_0x5d94('0x2d')](function(_0x31b51c){_0x31b51c[_0x5d94('0x68')](function(_0x35ed48){_0x51fd62['push'](_0x35ed48['resourceId']+0x15b38);});_0x12e683(_0x51fd62);});}}catch(_0xa324ac){_0x1a97b0(_0xa324ac);}});}exports[_0x5d94('0x6b')]=function(_0x55ae28,_0xf7d503){return db[_0x5d94('0x33')][_0x5d94('0x4a')]({'where':{'id':_0x55ae28[_0x5d94('0x47')]['id']}})['then'](handleEntityNotFound(_0xf7d503,null))[_0x5d94('0x2d')](function(_0x1c52b2){if(_0x1c52b2){return db['sequelize']['transaction'](function(_0x255b37){return db[_0x5d94('0x56')][_0x5d94('0x45')]({'where':{'userProfileId':_0x55ae28[_0x5d94('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x5d94('0x2d')](function(_0x383c98){if(_0x383c98){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x55ae28[_0x5d94('0x47')]['id'],'id':_[_0x5d94('0x59')](_0x383c98,function(_0x335eb6){return _0x335eb6['id'];})},'transaction':_0x255b37});}})[_0x5d94('0x2d')](function(_0x232db2){var _0x2943a6=_[_0x5d94('0x59')](_0x55ae28[_0x5d94('0x4c')],function(_0x352bc1){_0x352bc1[_0x5d94('0x5a')]=_0x55ae28[_0x5d94('0x47')]['id'];return _0x352bc1;});return db[_0x5d94('0x56')]['bulkCreate'](_0x2943a6,{'raw':!![],'transaction':_0x255b37});})[_0x5d94('0x2d')](function(_0x539309){var _0x310916=_[_0x5d94('0x43')](_[_0x5d94('0x59')](_0x539309,function(_0x217dfd){return _0x217dfd[_0x5d94('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x310916){return db[_0x5d94('0x56')][_0x5d94('0x45')]({'where':{'userProfileId':_0x55ae28[_0x5d94('0x47')]['id'],'sectionId':_[_0x5d94('0x59')](_0x310916,function(_0x434504){return _0x434504['sectionId'];})},'attributes':['id',_0x5d94('0x5f')],'raw':!![]})[_0x5d94('0x2d')](function(_0x281095){var _0x27698c=_[_0x5d94('0x59')](_0x55ae28[_0x5d94('0x4c')],function(_0x22f30e){_0x22f30e[_0x5d94('0x5a')]=_0x55ae28[_0x5d94('0x47')]['id'];return _0x22f30e;});return db[_0x5d94('0x5c')][_0x5d94('0x6c')](_0x27698c,{'raw':!![],'transaction':_0x255b37});});}})[_0x5d94('0x46')](handleError(_0xf7d503,null));});}})[_0x5d94('0x2d')](function(_0x4e587d){var _0xf455f9=_[_0x5d94('0x59')](_0x4e587d,function(_0x5651b7){return _0x5651b7[_0x5d94('0x4f')]({'plain':!![]});});})['then'](respondWithResult(_0xf7d503,null))[_0x5d94('0x46')](handleError(_0xf7d503,null));};exports['removeResources']=function(_0x3ca129,_0xd51fce,_0x129c7e){return db[_0x5d94('0x33')][_0x5d94('0x4a')]({'where':{'id':_0x3ca129[_0x5d94('0x47')]['id']}})[_0x5d94('0x2d')](handleEntityNotFound(_0xd51fce,null))[_0x5d94('0x2d')](function(_0x3960c2){if(_0x3960c2){return _0x3960c2[_0x5d94('0x6d')](_0x3ca129[_0x5d94('0x36')][_0x5d94('0x61')]);}})[_0x5d94('0x2d')](respondWithStatusCode(_0xd51fce,null))['catch'](handleError(_0xd51fce,null));};exports['getResources']=function(_0x549047,_0xeada6){var _0x3f055b={};if(!_0x549047['query'][_0x5d94('0x6e')])throw new Error('Missing\x20section\x20parameter');if(!_0x549047[_0x5d94('0x36')][_0x5d94('0x6f')]('nolimit')){_0x3f055b[_0x5d94('0x25')]=qs[_0x5d94('0x25')](_0x549047['query'][_0x5d94('0x25')]);_0x3f055b[_0x5d94('0x23')]=qs[_0x5d94('0x23')](_0x549047['query'][_0x5d94('0x23')]);}return db[_0x5d94('0x33')][_0x5d94('0x4a')]({'where':{'id':_0x549047['params']['id']}})[_0x5d94('0x2d')](function(_0x22d3ee){if(!_0x22d3ee)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x549047[_0x5d94('0x47')]['id']);return db[_0x5d94('0x33')][_0x5d94('0x70')](_0x549047);})['then'](respondWithFilteredResult(_0xeada6,_0x3f055b))[_0x5d94('0x46')](handleError(_0xeada6,null));}; \ No newline at end of file +var _0xe0dc=['filters','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','intersection','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','params','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','UserProfile','rawAttributes','key','model','keys','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where'];(function(_0x466264,_0x1e46a8){var _0x4660fb=function(_0x4de8bd){while(--_0x4de8bd){_0x466264['push'](_0x466264['shift']());}};_0x4660fb(++_0x1e46a8);}(_0xe0dc,0x190));var _0xce0d=function(_0x5b710b,_0x103f64){_0x5b710b=_0x5b710b-0x0;var _0x40ccbe=_0xe0dc[_0x5b710b];return _0x40ccbe;};'use strict';var emlformat=require(_0xce0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce0d('0x1'));var jsonpatch=require(_0xce0d('0x2'));var rp=require('request-promise');var moment=require(_0xce0d('0x3'));var BPromise=require(_0xce0d('0x4'));var Mustache=require(_0xce0d('0x5'));var util=require(_0xce0d('0x6'));var path=require('path');var sox=require(_0xce0d('0x7'));var csv=require('to-csv');var ejs=require(_0xce0d('0x8'));var fs=require('fs');var fs_extra=require(_0xce0d('0x9'));var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0xf'));var querystring=require(_0xce0d('0x10'));var Papa=require(_0xce0d('0x11'));var Redis=require(_0xce0d('0x12'));var authService=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var as=require(_0xce0d('0x15'));var hardwareService=require(_0xce0d('0x16'));var logger=require(_0xce0d('0x17'))(_0xce0d('0x18'));var utils=require(_0xce0d('0x19'));var config=require(_0xce0d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0d('0x1b'))['db'];config[_0xce0d('0x1c')]=_[_0xce0d('0x1d')](config[_0xce0d('0x1c')],{'host':_0xce0d('0x1e'),'port':0x18eb});var socket=require(_0xce0d('0x1f'))(new Redis(config[_0xce0d('0x1c')]));require(_0xce0d('0x20'))[_0xce0d('0x21')](socket);function respondWithStatusCode(_0xfba354,_0x15b11f){_0x15b11f=_0x15b11f||0xcc;return function(_0x2db05a){if(_0x2db05a){return _0xfba354[_0xce0d('0x22')](_0x15b11f);}return _0xfba354[_0xce0d('0x23')](_0x15b11f)[_0xce0d('0x24')]();};}function respondWithResult(_0x176c81,_0x936728){_0x936728=_0x936728||0xc8;return function(_0x39ed8){if(_0x39ed8){return _0x176c81[_0xce0d('0x23')](_0x936728)[_0xce0d('0x25')](_0x39ed8);}};}function respondWithFilteredResult(_0x2044df,_0x35dfa1){return function(_0x1dc8aa){if(_0x1dc8aa){var _0x1e03c1=typeof _0x35dfa1[_0xce0d('0x26')]===_0xce0d('0x27')&&typeof _0x35dfa1[_0xce0d('0x28')]===_0xce0d('0x27');var _0x37aae8=_0x1dc8aa[_0xce0d('0x29')];var _0x155567=_0x1e03c1?0x0:_0x35dfa1[_0xce0d('0x26')];var _0x1fda5a=_0x1e03c1?_0x1dc8aa[_0xce0d('0x29')]:_0x35dfa1[_0xce0d('0x26')]+_0x35dfa1[_0xce0d('0x28')];var _0x16788f;if(_0x1fda5a>=_0x37aae8){_0x1fda5a=_0x37aae8;_0x16788f=0xc8;}else{_0x16788f=0xce;}_0x2044df['status'](_0x16788f);return _0x2044df['set'](_0xce0d('0x2a'),_0x155567+'-'+_0x1fda5a+'/'+_0x37aae8)['json'](_0x1dc8aa);}return null;};}function patchUpdates(_0x2727c2){return function(_0x302476){try{jsonpatch[_0xce0d('0x2b')](_0x302476,_0x2727c2,!![]);}catch(_0x58d7c5){return BPromise[_0xce0d('0x2c')](_0x58d7c5);}return _0x302476['save']();};}function saveUpdates(_0x298f3e,_0x51aac8){return function(_0x5b759){if(_0x5b759){return _0x5b759[_0xce0d('0x2d')](_0x298f3e)['then'](function(_0x516609){return _0x516609;});}return null;};}function removeEntity(_0x31300f,_0x201167){return function(_0x2a3815){if(_0x2a3815){return _0x2a3815[_0xce0d('0x2e')]()[_0xce0d('0x2f')](function(){_0x31300f['status'](0xcc)[_0xce0d('0x24')]();});}};}function handleEntityNotFound(_0x25c356,_0x31ace8){return function(_0x5b197c){if(!_0x5b197c){_0x25c356[_0xce0d('0x22')](0x194);}return _0x5b197c;};}function handleError(_0x4c9d05,_0x228a1c){_0x228a1c=_0x228a1c||0x1f4;return function(_0x1eb234){logger[_0xce0d('0x30')](_0x1eb234[_0xce0d('0x31')]);if(_0x1eb234[_0xce0d('0x32')]){delete _0x1eb234[_0xce0d('0x32')];}_0x4c9d05[_0xce0d('0x23')](_0x228a1c)[_0xce0d('0x33')](_0x1eb234);};}exports[_0xce0d('0x34')]=function(_0x1dc21a,_0x4171cb){var _0x336114={},_0x5c4ec9={},_0x4a3308={'count':0x0,'rows':[]};var _0x2c3de1=_[_0xce0d('0x35')](db[_0xce0d('0x36')][_0xce0d('0x37')],function(_0x3b1bc8){return{'name':_0x3b1bc8['fieldName'],'type':_0x3b1bc8['type'][_0xce0d('0x38')]};});_0x5c4ec9[_0xce0d('0x39')]=_['map'](_0x2c3de1,'name');_0x5c4ec9['query']=_[_0xce0d('0x3a')](_0x1dc21a['query']);_0x5c4ec9['filters']=_['intersection'](_0x5c4ec9[_0xce0d('0x39')],_0x5c4ec9['query']);_0x336114['attributes']=_['intersection'](_0x5c4ec9['model'],qs['fields'](_0x1dc21a['query'][_0xce0d('0x3b')]));_0x336114[_0xce0d('0x3c')]=_0x336114[_0xce0d('0x3c')][_0xce0d('0x3d')]?_0x336114[_0xce0d('0x3c')]:_0x5c4ec9[_0xce0d('0x39')];if(!_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x3f')](_0xce0d('0x40'))){_0x336114['limit']=qs[_0xce0d('0x28')](_0x1dc21a[_0xce0d('0x3e')]['limit']);_0x336114[_0xce0d('0x26')]=qs[_0xce0d('0x26')](_0x1dc21a['query']['offset']);}_0x336114[_0xce0d('0x41')]=qs[_0xce0d('0x42')](_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x42')]);_0x336114[_0xce0d('0x43')]=qs['filters'](_['pick'](_0x1dc21a[_0xce0d('0x3e')],_0x5c4ec9[_0xce0d('0x44')]),_0x2c3de1);if(_0x1dc21a['query']['filter']){_0x336114[_0xce0d('0x43')]=_[_0xce0d('0x45')](_0x336114[_0xce0d('0x43')],{'$or':_[_0xce0d('0x35')](_0x2c3de1,function(_0x3f54b){if(_0x3f54b[_0xce0d('0x46')]!=='VIRTUAL'){var _0x37da5b={};_0x37da5b[_0x3f54b[_0xce0d('0x32')]]={'$like':'%'+_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x47')]+'%'};return _0x37da5b;}})});}_0x336114=_[_0xce0d('0x45')]({},_0x336114,_0x1dc21a[_0xce0d('0x48')]);var _0x18faeb={'where':_0x336114[_0xce0d('0x43')]};return db['UserProfile'][_0xce0d('0x29')](_0x18faeb)['then'](function(_0x6352f9){_0x4a3308[_0xce0d('0x29')]=_0x6352f9;if(_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x49')]){_0x336114[_0xce0d('0x4a')]=[{'all':!![]}];}return db['UserProfile'][_0xce0d('0x4b')](_0x336114);})[_0xce0d('0x2f')](function(_0x5457d8){_0x4a3308[_0xce0d('0x4c')]=_0x5457d8;return _0x4a3308;})['then'](respondWithFilteredResult(_0x4171cb,_0x336114))[_0xce0d('0x4d')](handleError(_0x4171cb,null));};exports[_0xce0d('0x4e')]=function(_0x191e8f,_0x4b31e3){var _0x3fd83e={'raw':![],'where':{'id':_0x191e8f['params']['id']}},_0x46003d={};_0x46003d['model']=_[_0xce0d('0x3a')](db[_0xce0d('0x36')][_0xce0d('0x37')]);_0x46003d[_0xce0d('0x3e')]=_[_0xce0d('0x3a')](_0x191e8f['query']);_0x46003d['filters']=_['intersection'](_0x46003d[_0xce0d('0x39')],_0x46003d[_0xce0d('0x3e')]);_0x3fd83e[_0xce0d('0x3c')]=_[_0xce0d('0x4f')](_0x46003d[_0xce0d('0x39')],qs[_0xce0d('0x3b')](_0x191e8f[_0xce0d('0x3e')]['fields']));_0x3fd83e['attributes']=_0x3fd83e[_0xce0d('0x3c')][_0xce0d('0x3d')]?_0x3fd83e[_0xce0d('0x3c')]:_0x46003d[_0xce0d('0x39')];if(_0x191e8f[_0xce0d('0x3e')][_0xce0d('0x49')]){_0x3fd83e[_0xce0d('0x4a')]=[{'all':!![]}];}_0x3fd83e=_['merge']({},_0x3fd83e,_0x191e8f[_0xce0d('0x48')]);return db['UserProfile']['find'](_0x3fd83e)[_0xce0d('0x2f')](handleEntityNotFound(_0x4b31e3,null))[_0xce0d('0x2f')](respondWithResult(_0x4b31e3,null))[_0xce0d('0x4d')](handleError(_0x4b31e3,null));};exports['create']=function(_0x641547,_0x36f502){return db['UserProfile'][_0xce0d('0x50')](_0x641547[_0xce0d('0x51')],{})[_0xce0d('0x2f')](respondWithResult(_0x36f502,0xc9))[_0xce0d('0x4d')](handleError(_0x36f502,null));};exports[_0xce0d('0x52')]=function(_0x306657,_0x17919a){var _0x45b887={'where':{'id':_0x306657['params']['id']}},_0x12b423={};_0x12b423[_0xce0d('0x39')]=_[_0xce0d('0x3a')](db[_0xce0d('0x36')][_0xce0d('0x37')]);_0x45b887['attributes']=_[_0xce0d('0x4f')](_0x12b423[_0xce0d('0x39')],qs['fields'](_0x306657[_0xce0d('0x3e')]['fields']));_0x45b887[_0xce0d('0x3c')]=_0x45b887['attributes']['length']?_0x45b887[_0xce0d('0x3c')]:_0x12b423[_0xce0d('0x39')];if(_0x306657[_0xce0d('0x3e')][_0xce0d('0x49')]){_0x45b887[_0xce0d('0x4a')]=[{'all':!![]}];}_0x45b887=_[_0xce0d('0x45')]({},_0x45b887,_0x306657[_0xce0d('0x48')]);return db[_0xce0d('0x36')][_0xce0d('0x53')](_0x45b887)[_0xce0d('0x2f')](handleEntityNotFound(_0x17919a,null))['then'](function(_0x56d7f7){if(_0x56d7f7){var _0x47323a=_0x56d7f7[_0xce0d('0x54')]({'plain':!![]});_0x47323a=qs[_0xce0d('0x55')](_0x47323a,['id',_0xce0d('0x56'),_0xce0d('0x57'),_0xce0d('0x58')]);_0x306657[_0xce0d('0x51')]=_[_0xce0d('0x55')](_0x306657['body'],['id',_0xce0d('0x56'),_0xce0d('0x57')]);return db[_0xce0d('0x59')][_0xce0d('0x5a')](function(_0x1f9716){return db[_0xce0d('0x36')]['create'](_['merge'](_0x47323a,_0x306657['body']),{'include':_0x306657['query'][_0xce0d('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x1f9716})['then'](function(_0x1c35d9){var _0x3b3929=_0x1c35d9[_0xce0d('0x54')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x306657[_0xce0d('0x5b')]['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x41ac2a){if(_0x41ac2a){return BPromise['each'](_0x41ac2a,function(_0x1c9702){return new BPromise(function(_0x4de7e3,_0x43df19){if(_0x1c9702['autoAssociation']===null||_0x1c9702[_0xce0d('0x5c')]===0x1)_0x4de7e3(null);return db[_0xce0d('0x5d')][_0xce0d('0x4b')]({'where':{'sectionId':_0x1c9702['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x5a52ef){var _0xd47a82=_[_0xce0d('0x35')](_0x5a52ef,function(_0xeb6cbc){return qs['omit'](_0xeb6cbc,['id',_0xce0d('0x56'),_0xce0d('0x57'),_0xce0d('0x5e')]);});_0x4de7e3(_0xd47a82);})[_0xce0d('0x4d')](function(_0x57acd8){_0x43df19(_0x57acd8);});})['then'](function(_0x5d09e0){var _0x76d67a=qs[_0xce0d('0x55')](_0x1c9702,['id',_0xce0d('0x56'),'updatedAt']);_0x76d67a[_0xce0d('0x5f')]=_0x3b3929['id'];if(_0x5d09e0)_0x76d67a[_0xce0d('0x60')]=_0x5d09e0;return _0x76d67a;})['then'](function(_0x1a24db){return db[_0xce0d('0x61')][_0xce0d('0x50')](_0x1a24db,{'include':[{'model':db[_0xce0d('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x1f9716});});})[_0xce0d('0x2f')](function(){return _0x3b3929;});}});});});}})['then'](respondWithResult(_0x17919a,0xc9))['catch'](handleError(_0x17919a,null));};exports[_0xce0d('0x2d')]=function(_0x313d3a,_0x119204){if(_0x313d3a[_0xce0d('0x51')]['id']){delete _0x313d3a['body']['id'];}return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x313d3a[_0xce0d('0x5b')]['id']}})[_0xce0d('0x2f')](handleEntityNotFound(_0x119204,null))[_0xce0d('0x2f')](saveUpdates(_0x313d3a['body'],null))[_0xce0d('0x2f')](respondWithResult(_0x119204,null))['catch'](handleError(_0x119204,null));};exports[_0xce0d('0x2e')]=function(_0x4e3d99,_0x682a6d){return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x4e3d99[_0xce0d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x682a6d,null))[_0xce0d('0x2f')](removeEntity(_0x682a6d,null))[_0xce0d('0x4d')](handleError(_0x682a6d,null));};exports[_0xce0d('0x62')]=function(_0x1646cc,_0x1b4ffe){return db[_0xce0d('0x36')][_0xce0d('0x62')]()['then'](respondWithResult(_0x1b4ffe,null))['catch'](handleError(_0x1b4ffe,null));};exports['addSections']=function(_0x55b75a,_0x3355e3){var _0x3609a5=_0x55b75a[_0xce0d('0x51')];return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x55b75a[_0xce0d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3355e3,null))[_0xce0d('0x2f')](function(_0x47307d){if(_0x47307d){return db[_0xce0d('0x59')][_0xce0d('0x5a')](function(_0x231403){return db['UserProfileSection'][_0xce0d('0x2e')]({'where':{'userProfileId':_0x55b75a[_0xce0d('0x5b')]['id'],'sectionId':_[_0xce0d('0x35')](_0x3609a5,function(_0x7552be){return _0x7552be[_0xce0d('0x5e')];})},'transaction':_0x231403})[_0xce0d('0x2f')](function(){var _0x5531a5=_[_0xce0d('0x35')](_0x3609a5,function(_0x121ee4){_0x121ee4['userProfileId']=_0x55b75a['params']['id'];return _0x121ee4;});var _0x9fb17=[];return BPromise['each'](_0x5531a5,function(_0x1df5c8){return db['UserProfileSection'][_0xce0d('0x50')](_0x1df5c8,{'include':[{'model':db[_0xce0d('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x231403})[_0xce0d('0x2f')](function(_0x5abe1d){_0x9fb17[_0xce0d('0x63')](_0x5abe1d['get']({'plain':!![]}));});})[_0xce0d('0x2f')](function(){return _0x9fb17;});});});}})[_0xce0d('0x2f')](function(_0x491ae7){return _0x491ae7;})[_0xce0d('0x2f')](respondWithResult(_0x3355e3,null))[_0xce0d('0x4d')](handleError(_0x3355e3,null));};exports[_0xce0d('0x64')]=function(_0x49db9f,_0x636f1a){var _0x2d53e9;return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x49db9f[_0xce0d('0x5b')]['id']},'attributes':['id',_0xce0d('0x32')]})[_0xce0d('0x2f')](handleEntityNotFound(_0x636f1a,null))[_0xce0d('0x2f')](function(_0x5266e1){if(_0x5266e1){_0x2d53e9=_0x5266e1;return db[_0xce0d('0x61')][_0xce0d('0x2e')]({'where':{'userProfileId':_0x49db9f[_0xce0d('0x5b')]['id'],'sectionId':_0x49db9f[_0xce0d('0x3e')][_0xce0d('0x65')]}});}})[_0xce0d('0x2f')](function(){return _0x2d53e9;})[_0xce0d('0x2f')](respondWithStatusCode(_0x636f1a,null))[_0xce0d('0x4d')](handleError(_0x636f1a,null));};exports[_0xce0d('0x66')]=function(_0x5aaa23,_0x380375){var _0xda5005=[];var _0x213e29=[];return db[_0xce0d('0x61')][_0xce0d('0x4b')]({'where':{'userProfileId':_0x5aaa23[_0xce0d('0x5b')]['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x524955){_0xda5005=_[_0xce0d('0x47')](_0x524955,function(_0x443827){return _0x443827[_0xce0d('0x67')]===0x1||_['includes']([0x3eb,0x709],_0x443827[_0xce0d('0x5e')]);});if(!_[_0xce0d('0x68')](_0xda5005)){return _[_0xce0d('0x35')](_0xda5005,function(_0x8ad438){return _0x8ad438[_0xce0d('0x5e')];});}else{return;}})[_0xce0d('0x2f')](function(_0x226f80){if(_0x226f80)_0x213e29=_0x226f80;if(_[_0xce0d('0x69')](_0x213e29,0x64)){var _0x2222a2=_[_0xce0d('0x53')](_0xda5005,{'sectionId':0x64});return hasDefaultDashboard(_0x2222a2)[_0xce0d('0x2f')](function(_0x41a72a){return _[_0xce0d('0x35')](_0xda5005,function(_0x3a7e5c){if(_0x3a7e5c[_0xce0d('0x5e')]===0x64){_0x3a7e5c[_0xce0d('0x6a')]=_0x41a72a;}return _0x3a7e5c;});});}else{return;}})[_0xce0d('0x2f')](function(_0x2fc92a){if(_0x2fc92a)_0xda5005=_0x2fc92a;if(_[_0xce0d('0x69')](_0x213e29,0x3eb)){var _0x22b745=_[_0xce0d('0x53')](_0xda5005,{'sectionId':0x3eb});return getCustomDashboards(_0x22b745)[_0xce0d('0x2f')](function(_0x8059af){return _[_0xce0d('0x35')](_0xda5005,function(_0x3bb7ca){if(_0x22b745['enabled']){if(_0x3bb7ca[_0xce0d('0x5e')]===0x3eb){_0x3bb7ca[_0xce0d('0x6a')]=_0x8059af;}}else{if(_0x3bb7ca['sectionId']===0x64){_0x3bb7ca[_0xce0d('0x6a')]=_0x8059af;}}return _0x3bb7ca;});});}else{return;}})['then'](function(_0x44b7da){if(_0x44b7da)_0xda5005=_0x44b7da;if(_['includes'](_0x213e29,0x709)){var _0x1e1807=_[_0xce0d('0x53')](_0xda5005,{'sectionId':0x709});return getPlugins(_0x1e1807)['then'](function(_0x505068){if(_0x1e1807[_0xce0d('0x67')]){return _['map'](_0xda5005,function(_0x326185){if(_0x326185['sectionId']===0x709){_0x326185[_0xce0d('0x6a')]=_0x505068;}return _0x326185;});}else{var _0x4d0d14={'sectionId':0x76c,'enabled':0x1,'subsections':_0x505068};var _0x3cde4f=_['map'](_0xda5005);_0x3cde4f[_0xce0d('0x63')](_0x4d0d14);return _0x3cde4f;}});}else{return;}})[_0xce0d('0x2f')](function(_0x1662ce){if(_0x1662ce)_0xda5005=_0x1662ce;return _[_0xce0d('0x47')](_0xda5005,[_0xce0d('0x67'),0x1]);})[_0xce0d('0x2f')](respondWithResult(_0x380375,null))['catch'](handleError(_0x380375,null));};function hasDefaultDashboard(_0x2573de){var _0x55ea8d=[0x65];return new BPromise(function(_0xbd36af,_0x5ad7b5){try{if(_0x2573de['autoAssociation']){_0xbd36af(_0x55ea8d);}else{return db[_0xce0d('0x5d')][_0xce0d('0x6b')]({'where':{'sectionId':_0x2573de['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0xbe8813){_0xbe8813?_0xbd36af(_0x55ea8d):_0xbd36af();});}}catch(_0x41ba80){_0x5ad7b5(_0x41ba80);}});}function getCustomDashboards(_0x2f93e9){var _0x502457=[];return new BPromise(function(_0x83703f,_0x6a0858){try{if(_0x2f93e9[_0xce0d('0x5c')]){return db[_0xce0d('0x6c')][_0xce0d('0x4b')]({'raw':!![]})[_0xce0d('0x2f')](function(_0x29dd68){_0x29dd68[_0xce0d('0x6d')](function(_0x1d05af){_0x502457[_0xce0d('0x63')](_0x1d05af['id']+0x1869f);});_0x83703f(_0x502457);});}else{return db['UserProfileResource'][_0xce0d('0x4b')]({'where':{'sectionId':_0x2f93e9['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x4bb7e4){_0x4bb7e4[_0xce0d('0x6d')](function(_0x30015a){_0x502457[_0xce0d('0x63')](_0x30015a[_0xce0d('0x6e')]+0x1869f);});_0x83703f(_0x502457);});}}catch(_0x31a331){_0x6a0858(_0x31a331);}});}function getPlugins(_0xe5aef2){var _0x13640c=[];return new BPromise(function(_0x8eeb0e,_0x211b55){try{if(_0xe5aef2[_0xce0d('0x5c')]){return db[_0xce0d('0x6f')]['findAll']({'raw':!![]})[_0xce0d('0x2f')](function(_0x491498){_0x491498[_0xce0d('0x6d')](function(_0x1d858e){_0x13640c[_0xce0d('0x63')](_0x1d858e['id']+0x15b38);});_0x8eeb0e(_0x13640c);});}else{return db[_0xce0d('0x5d')]['findAll']({'where':{'sectionId':_0xe5aef2['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x5bdd29){_0x5bdd29['forEach'](function(_0x426c0f){_0x13640c[_0xce0d('0x63')](_0x426c0f[_0xce0d('0x6e')]+0x15b38);});_0x8eeb0e(_0x13640c);});}}catch(_0x5aa658){_0x211b55(_0x5aa658);}});}exports[_0xce0d('0x70')]=function(_0x599a2a,_0x33dd67){return db[_0xce0d('0x36')]['find']({'where':{'id':_0x599a2a[_0xce0d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x33dd67,null))['then'](function(_0x164a3d){if(_0x164a3d){return db[_0xce0d('0x59')][_0xce0d('0x5a')](function(_0x180ac0){return db[_0xce0d('0x61')][_0xce0d('0x4b')]({'where':{'userProfileId':_0x599a2a[_0xce0d('0x5b')]['id']},'attributes':['id'],'raw':!![]})[_0xce0d('0x2f')](function(_0x1d53a0){if(_0x1d53a0){return db[_0xce0d('0x61')][_0xce0d('0x2e')]({'where':{'userProfileId':_0x599a2a[_0xce0d('0x5b')]['id'],'id':_[_0xce0d('0x35')](_0x1d53a0,function(_0x5ee4f4){return _0x5ee4f4['id'];})},'transaction':_0x180ac0});}})['then'](function(_0x24802a){var _0x3e06a2=_[_0xce0d('0x35')](_0x599a2a[_0xce0d('0x51')],function(_0x9d75fd){_0x9d75fd[_0xce0d('0x5f')]=_0x599a2a['params']['id'];return _0x9d75fd;});return db[_0xce0d('0x61')][_0xce0d('0x71')](_0x3e06a2,{'raw':!![],'transaction':_0x180ac0});})[_0xce0d('0x2f')](function(_0x1fa275){var _0x5e7a6a=_[_0xce0d('0x47')](_[_0xce0d('0x35')](_0x1fa275,function(_0x3ed9f8){return _0x3ed9f8[_0xce0d('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x5e7a6a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x599a2a[_0xce0d('0x5b')]['id'],'sectionId':_['map'](_0x5e7a6a,function(_0x640655){return _0x640655[_0xce0d('0x5e')];})},'attributes':['id',_0xce0d('0x5e')],'raw':!![]})['then'](function(_0x55272e){var _0x19c4b5=_[_0xce0d('0x35')](_0x599a2a[_0xce0d('0x51')],function(_0x2ab3f0){_0x2ab3f0[_0xce0d('0x5f')]=_0x599a2a[_0xce0d('0x5b')]['id'];return _0x2ab3f0;});return db[_0xce0d('0x5d')][_0xce0d('0x71')](_0x19c4b5,{'raw':!![],'transaction':_0x180ac0});});}})[_0xce0d('0x4d')](handleError(_0x33dd67,null));});}})[_0xce0d('0x2f')](function(_0x4840f6){var _0x21cbbd=_[_0xce0d('0x35')](_0x4840f6,function(_0x237d84){return _0x237d84[_0xce0d('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x33dd67,null))['catch'](handleError(_0x33dd67,null));};exports[_0xce0d('0x72')]=function(_0x5a0094,_0x4bde6e,_0x4c0421){return db['UserProfile'][_0xce0d('0x53')]({'where':{'id':_0x5a0094['params']['id']}})[_0xce0d('0x2f')](handleEntityNotFound(_0x4bde6e,null))['then'](function(_0x23d0e2){if(_0x23d0e2){return _0x23d0e2[_0xce0d('0x72')](_0x5a0094[_0xce0d('0x3e')][_0xce0d('0x65')]);}})[_0xce0d('0x2f')](respondWithStatusCode(_0x4bde6e,null))['catch'](handleError(_0x4bde6e,null));};exports[_0xce0d('0x73')]=function(_0x375ae7,_0x55db7f){var _0x52d394={};if(!_0x375ae7['query'][_0xce0d('0x74')])throw new Error('Missing\x20section\x20parameter');if(!_0x375ae7[_0xce0d('0x3e')]['hasOwnProperty'](_0xce0d('0x40'))){_0x52d394['limit']=qs[_0xce0d('0x28')](_0x375ae7['query'][_0xce0d('0x28')]);_0x52d394[_0xce0d('0x26')]=qs[_0xce0d('0x26')](_0x375ae7[_0xce0d('0x3e')]['offset']);}return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x375ae7[_0xce0d('0x5b')]['id']}})['then'](function(_0x2baec8){if(!_0x2baec8)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x375ae7['params']['id']);return db[_0xce0d('0x36')][_0xce0d('0x73')](_0x375ae7);})[_0xce0d('0x2f')](respondWithFilteredResult(_0x55db7f,_0x52d394))[_0xce0d('0x4d')](handleError(_0x55db7f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 23cb070..4dd5ba8 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 _0x1c77=['UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x4032f9,_0x15773a){var _0x1ce101=function(_0x25db41){while(--_0x25db41){_0x4032f9['push'](_0x4032f9['shift']());}};_0x1ce101(++_0x15773a);}(_0x1c77,0xed));var _0x71c7=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0x1c77[_0x2bf5bd];return _0xc810c0;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x71c7('0x0'))['db'][_0x71c7('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x71c7('0x2')](0x0);var events={'afterCreate':_0x71c7('0x3'),'afterUpdate':_0x71c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29ab58){return function(_0x37620a,_0x1f314c,_0x305ff7){UserProfileEvents[_0x71c7('0x5')](_0x29ab58+':'+_0x37620a['id'],_0x37620a);UserProfileEvents[_0x71c7('0x5')](_0x29ab58,_0x37620a);_0x305ff7(null);};}for(var e in events){if(events[_0x71c7('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xaa56=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserProfile'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa56,0xc6));var _0x6aa5=function(_0xe587f7,_0x1af593){_0xe587f7=_0xe587f7-0x0;var _0x23d65f=_0xaa56[_0xe587f7];return _0x23d65f;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x6aa5('0x0'))['db'][_0x6aa5('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6aa5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6aa5('0x3'),'afterDestroy':_0x6aa5('0x4')};function emitEvent(_0x34842d){return function(_0x39e1a6,_0x1662ee,_0x52b3d3){UserProfileEvents[_0x6aa5('0x5')](_0x34842d+':'+_0x39e1a6['id'],_0x39e1a6);UserProfileEvents['emit'](_0x34842d,_0x39e1a6);_0x52b3d3(null);};}for(var e in events){if(events[_0x6aa5('0x6')](e)){var event=events[e];UserProfile[_0x6aa5('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 09e774d..6b54a7d 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 _0xa6b0=['filter','field','value','findAll','associatedResources','map','catch','then','name','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','projectName','projects','contacts','CmContact','Lists','ListId','CmList','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','type','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','pauses','Pause','scheduler','sounds','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','reportId','charAt','toUpperCase','slice','select','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','section','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','limit','offset','sort','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','custom','CustomReports','count','rows','Tags','color','tag','openTabs','chat','sms','dataValues','fax','mail','whatsapp','lodash','./userProfile.attributes','exports'];(function(_0x587d53,_0x2d8077){var _0x2f558f=function(_0x221006){while(--_0x221006){_0x587d53['push'](_0x587d53['shift']());}};_0x2f558f(++_0x2d8077);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x2bd5ae,_0x29da13){_0x2bd5ae=_0x2bd5ae-0x0;var _0x537e1f=_0xa6b0[_0x2bd5ae];return _0x537e1f;};'use strict';var _=require(_0x0a6b('0x0'));var attributes=require(_0x0a6b('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x0a6b('0x2')]=function(_0x2c0d7f){var _0x13d4d5=_0x2c0d7f['models'];function _0x29ff80(_0x33e8c3,_0x195697){return new Promise(function(_0xc7140c,_0x3dc2b0){if(!_0x195697)return _0xc7140c(null);var _0x3b6967=_0x195697[_0x0a6b('0x3')]?{[_0x195697[_0x0a6b('0x3')][_0x0a6b('0x4')]]:_0x195697[_0x0a6b('0x3')][_0x0a6b('0x5')]}:undefined;return _0x13d4d5[_0x33e8c3][_0x0a6b('0x6')]({'where':_0x3b6967,'raw':!![]})['then'](function(_0x493948){_0x195697[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x493948,'id');_0xc7140c(_0x195697);})[_0x0a6b('0x9')](function(_0x25ad47){_0x3dc2b0(_0x25ad47);});});}function _0x81a412(_0xe681c9,_0x1489c5){return new Promise(function(_0x405046,_0x8bbed9){var _0x354e10=_0xe681c9[_0x0a6b('0x3')]?{[_0xe681c9[_0x0a6b('0x3')][_0x0a6b('0x4')]]:_0xe681c9[_0x0a6b('0x3')]['value']}:undefined;return _0x13d4d5[_0xe681c9['model']][_0x0a6b('0x6')]({'where':_0x354e10,'raw':!![]})[_0x0a6b('0xa')](function(_0x2abc4e){_0x1489c5[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x2abc4e,function(_0x45fc9f){return _0x45fc9f[_0x0a6b('0xb')];});_0x405046(_0x1489c5);})[_0x0a6b('0x9')](function(_0x1205a3){_0x8bbed9(_0x1205a3);});});}function _0x9d7aba(_0x4797d1,_0xa36d75,_0x1538f4){if(!_0xa36d75)return Promise['resolve'](null);return new Promise(function(_0x290f7f,_0x4d0e3b){return _0x13d4d5[_0x0a6b('0xc')][_0x0a6b('0x6')]({'where':{'sectionId':_0xa36d75['id']},'raw':!![]})[_0x0a6b('0xa')](function(_0x1ad45d){if(_0x4797d1['field']&&_0x4797d1[_0x0a6b('0x4')]!=='id'){_0xa36d75[_0x0a6b('0x7')]=_['map'](_0x1ad45d,function(_0x19848c){return _0x19848c[_0x4797d1[_0x0a6b('0x4')]];});}else{if(_0x1538f4===_0x0a6b('0xd')){_0xa36d75['associatedResources']=_[_0x0a6b('0x8')](_0x1ad45d,function(_0x93a465){return{'id':_0x93a465[_0x0a6b('0xe')],'type':_0x93a465['type']};});}else{_0xa36d75[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x1ad45d,function(_0xe4c2b9){return _0xe4c2b9[_0x0a6b('0xe')];});}}_0x290f7f(_0xa36d75);})[_0x0a6b('0x9')](function(_0x53848c){_0x4d0e3b(_0x53848c);});});}function _0x1e5065(_0xdda188,_0x3d153f){var _0x5c77fb={'parentSections':[]};switch(_0xdda188[_0x0a6b('0xf')]()){case _0x0a6b('0x10'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x12');break;case _0x0a6b('0x13'):_0x5c77fb['childModel']=_0x0a6b('0x14');break;case _0x0a6b('0x15'):_0x5c77fb[_0x0a6b('0x11')]='SquareRecording';_0x5c77fb[_0x0a6b('0x16')]=[{'name':'SquareProjects','field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x17')}];break;case _0x0a6b('0x18'):_0x5c77fb['childModel']='JscriptyProject';break;case _0x0a6b('0x19'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1a');_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x1b'),'field':'id','foreignKey':_0x0a6b('0x1c')}];break;case'lists':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1d');break;case'companies':_0x5c77fb[_0x0a6b('0x11')]='CmCompany';break;case'globalcustomfields':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1e');break;case _0x0a6b('0x1f'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x20');break;case'chatwebsites':_0x5c77fb['childModel']=_0x0a6b('0x21');break;case _0x0a6b('0x22'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x23');break;case'faxaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x24');break;case'inboundroutes':case'internalroutes':case _0x0a6b('0x25'):_0x5c77fb[_0x0a6b('0x11')]='VoiceExtension';break;case _0x0a6b('0x26'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x27');break;case _0x0a6b('0x28'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x29');break;case _0x0a6b('0x2a'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2b');_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x2c'),'field':_0x0a6b('0xb'),'foreignKey':'membername','model':_0x0a6b('0x2d'),'filter':{'field':_0x0a6b('0x2e'),'value':['agent']}},{'name':_0x0a6b('0x2f'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x30'),'model':_0x0a6b('0x2d'),'filter':{'field':_0x0a6b('0x2e'),'value':[_0x0a6b('0x31')]}},{'name':_0x0a6b('0x32'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x33'),'model':'VoiceQueue','filter':{'field':_0x0a6b('0x34'),'value':[_0x0a6b('0x35')]}},{'name':_0x0a6b('0x36'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x33'),'model':_0x0a6b('0x37'),'filter':{'field':_0x0a6b('0x34'),'value':[_0x0a6b('0x38')]}}];break;case _0x0a6b('0x39'):_0x5c77fb['childModel']=_0x0a6b('0x3a');break;case _0x0a6b('0x3b'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x3c');break;case _0x0a6b('0x3d'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x3e');break;case _0x0a6b('0x3f'):_0x5c77fb[_0x0a6b('0x11')]='Campaign';break;case _0x0a6b('0x40'):_0x5c77fb['childModel']='MailQueue';break;case _0x0a6b('0x41'):_0x5c77fb['childModel']='MailAccount';break;case _0x0a6b('0x42'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x43');break;case'openchannelqueues':_0x5c77fb[_0x0a6b('0x11')]='OpenchannelQueue';break;case'openchannelaccounts':_0x5c77fb[_0x0a6b('0x11')]='OpenchannelAccount';break;case _0x0a6b('0x44'):_0x5c77fb['childModel']=_0x0a6b('0x45');break;case'smsaccounts':_0x5c77fb['childModel']=_0x0a6b('0x46');break;case _0x0a6b('0x47'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x48');break;case'whatsappaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x49');break;case _0x0a6b('0x4a'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x4b');break;case _0x0a6b('0x4c'):case _0x0a6b('0x4d'):_0x5c77fb['childModel']=_0x0a6b('0x37');if(_0x3d153f){_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x32')},{'name':_0x0a6b('0x36')}];}break;case _0x0a6b('0x4e'):case _0x0a6b('0x4f'):case _0x0a6b('0x50'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2d');if(_0x3d153f){_0x5c77fb['parentSections']=[{'name':_0x0a6b('0x51'),'filter':{'field':_0x0a6b('0x2e'),'value':[_0x0a6b('0x52'),_0x0a6b('0x53')]},'ignore':!![]},{'name':_0x0a6b('0x2c')},{'name':_0x0a6b('0x2f')}];}break;case _0x0a6b('0x54'):_0x5c77fb['childModel']='ZendeskAccount';break;case _0x0a6b('0x55'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x56');break;case _0x0a6b('0x57'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x58');break;case _0x0a6b('0x59'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5a');break;case'deskaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5b');break;case _0x0a6b('0x5c'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5d');break;case'vtigeraccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2d');break;case _0x0a6b('0x5e'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5f');break;case _0x0a6b('0x60'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x61');break;case _0x0a6b('0x62'):_0x5c77fb[_0x0a6b('0x11')]='Dashboard';break;case'intervals':_0x5c77fb[_0x0a6b('0x11')]='Interval';break;case _0x0a6b('0x63'):_0x5c77fb['childModel']=_0x0a6b('0x64');break;case _0x0a6b('0x65'):_0x5c77fb[_0x0a6b('0x11')]='Schedule';break;case _0x0a6b('0x66'):_0x5c77fb[_0x0a6b('0x11')]='Sound';break;case _0x0a6b('0x67'):_0x5c77fb['childModel']=_0x0a6b('0x68');break;case _0x0a6b('0x69'):_0x5c77fb['childModel']=_0x0a6b('0x6a');break;case'triggers':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x6b');break;case _0x0a6b('0x6c'):_0x5c77fb['childModel']=_0x0a6b('0x6d');break;case _0x0a6b('0x6e'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x6f');break;case _0x0a6b('0x70'):_0x5c77fb[_0x0a6b('0x11')]='Plugin';break;case'extractedreports':_0x5c77fb['childModel']=_0x0a6b('0xd');_0x5c77fb['parentSections']=[{'name':_0x0a6b('0x71'),'field':'id','foreignKey':_0x0a6b('0x72')}];break;case'metrics':_0x5c77fb['childModel']='AnalyticMetric';break;}return _0x5c77fb;}function _0x19e9a6(_0x187c12,_0x4b7f32){var _0xb84ccf=_0x187c12[_0x0a6b('0x73')](0x0)[_0x0a6b('0x74')]()+_0x187c12[_0x0a6b('0x75')](0x1);var _0x2ebd68={'type':_0x13d4d5['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x40cba9,_0x2fb572){var _0x58d4ce=squel[_0x0a6b('0x76')]()['field'](_0x0a6b('0x77')+_0xb84ccf+_0x0a6b('0x78'),'id')[_0x0a6b('0x4')](_0x0a6b('0x79'))[_0x0a6b('0x7a')]('user_has_'+_0x187c12+_0x0a6b('0x7b'),'ui')[_0x0a6b('0x7c')](_0x0a6b('0x7d'),_0x4b7f32['id']);return _0x13d4d5[_0x0a6b('0x7e')]['query'](_0x58d4ce[_0x0a6b('0x7f')](),_0x2ebd68)[_0x0a6b('0xa')](function(_0x292c87){_0x4b7f32[_0xb84ccf+_0x0a6b('0x80')]=_0x292c87;_0x40cba9(_0x292c87);})[_0x0a6b('0x9')](function(_0x581738){_0x2fb572(_0x581738);});});}return _0x2c0d7f[_0x0a6b('0x81')](_0x0a6b('0x82'),attributes,{'tableName':_0x0a6b('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x24b829){var _0x16c13a={'raw':![],'where':{}};var _0x1f4e0d={};var _0x1f715b={'count':0x0,'rows':[]};var _0xa1b7e7=_0x24b829['query'][_0x0a6b('0x84')];var _0x10830a=_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x86')]||![];var _0x583b01=_0x1e5065(_0xa1b7e7,_0x10830a);if(!_0x583b01[_0x0a6b('0x11')])throw new Error(_0x0a6b('0x87')+_0xa1b7e7+'\x27');var _0x3b2a20=[{'name':_0xa1b7e7}];if(!_[_0x0a6b('0x88')](_0x583b01[_0x0a6b('0x16')]))_0x3b2a20=_0x583b01[_0x0a6b('0x16')];var _0x3db026=[];for(var _0x45f990=0x0;_0x45f990<_0x3b2a20[_0x0a6b('0x89')];_0x45f990++){_0x3db026[_0x0a6b('0x8a')](_0x13d4d5[_0x0a6b('0x8b')][_0x0a6b('0x8c')]({'where':{'userProfileId':_0x24b829[_0x0a6b('0x8d')]['id'],'name':_0x3b2a20[_0x45f990][_0x0a6b('0xb')]},'raw':!![]}));}return Promise[_0x0a6b('0x8e')](_0x3db026)['then'](function(_0x55b386){var _0x3703c3=_[_0x0a6b('0x3')](_0x55b386,function(_0x4a3161){return _0x4a3161?_0x4a3161:undefined;});var _0x4502aa=_[_0x0a6b('0x3')](_0x3b2a20,[_0x0a6b('0x8f'),!![]]);var _0x21b9dc=_[_0x0a6b('0x88')](_0x3703c3)&&_[_0x0a6b('0x88')](_0x4502aa)?null:_[_0x0a6b('0x90')](_0x4502aa,_0x3703c3);if(!_0x21b9dc)return null;var _0x47d2c7=[];for(var _0x16f42f=0x0;_0x16f42f<_0x21b9dc[_0x0a6b('0x89')];_0x16f42f++){var _0x240426=_['find'](_0x3b2a20,function(_0x3b6b10){return _0x21b9dc[_0x16f42f]?_0x3b6b10['name']===_0x21b9dc[_0x16f42f][_0x0a6b('0xb')]:null;});if(_0x240426){if(_0x21b9dc[_0x16f42f][_0x0a6b('0x8f')]){_0x47d2c7[_0x0a6b('0x8a')](_0x29ff80(_0x583b01[_0x0a6b('0x11')],_0x21b9dc[_0x16f42f]));}else{if(!_0x21b9dc[_0x16f42f][_0x0a6b('0x91')]){_0x47d2c7[_0x0a6b('0x8a')](_0x9d7aba(_0x240426,_0x21b9dc[_0x16f42f],_0x583b01[_0x0a6b('0x11')]));}else{if(_0x240426['model']){_0x47d2c7[_0x0a6b('0x8a')](_0x81a412(_0x240426,_0x21b9dc[_0x16f42f]));}}}}}return Promise[_0x0a6b('0x8e')](_0x47d2c7);})[_0x0a6b('0xa')](function(_0x356d70){var _0x374dbd=_0x356d70;var _0x56db5d=null;if(_0x374dbd){_0x56db5d=_0x374dbd[_0x0a6b('0x89')]===0x1?_0x374dbd[0x0]:null;}if(!_0x56db5d&&!_0x374dbd)return _0x1f715b;var _0x5bf4d7=_0x13d4d5[_0x583b01['childModel']][_0x0a6b('0x92')];_0x1f4e0d[_0x0a6b('0x93')]=_[_0x0a6b('0x94')](_0x5bf4d7);_0x1f4e0d[_0x0a6b('0x85')]=_[_0x0a6b('0x94')](_0x24b829[_0x0a6b('0x85')]);_0x1f4e0d[_0x0a6b('0x95')]=_[_0x0a6b('0x96')](_0x1f4e0d[_0x0a6b('0x93')],_0x1f4e0d[_0x0a6b('0x85')]);_0x16c13a[_0x0a6b('0x97')]=_[_0x0a6b('0x96')](_0x1f4e0d['model'],qs[_0x0a6b('0x98')](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x98')]));_0x16c13a[_0x0a6b('0x97')]=_0x16c13a['attributes'][_0x0a6b('0x89')]?_0x16c13a['attributes']:_0x1f4e0d[_0x0a6b('0x93')];if(!_0x24b829[_0x0a6b('0x85')]['hasOwnProperty']('nolimit')){_0x16c13a[_0x0a6b('0x99')]=qs['limit'](_0x24b829[_0x0a6b('0x85')]['limit']);_0x16c13a[_0x0a6b('0x9a')]=qs['offset'](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x9a')]);}_0x16c13a['order']=qs['sort'](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x9b')]);_0x16c13a[_0x0a6b('0x7c')]=qs[_0x0a6b('0x95')](_['pick'](_0x24b829[_0x0a6b('0x85')],_0x1f4e0d['filters']));if(_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x3')]){_0x16c13a[_0x0a6b('0x7c')]=_[_0x0a6b('0x9c')](_0x16c13a[_0x0a6b('0x7c')],{'$or':_[_0x0a6b('0x8')](_0x5bf4d7,function(_0x157c6f){if(_0x157c6f[_0x0a6b('0x34')]['key']!==_0x0a6b('0x9d')){var _0x5e565a={};_0x5e565a[_0x157c6f[_0x0a6b('0x4')]]={'$like':'%'+_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x3')]+'%'};return _0x5e565a;}})});}var _0x3ea550=[];var _0x4d9cfe=null;var _0x94db76={};if(_0x56db5d){_0x4d9cfe=_[_0x0a6b('0x8c')](_0x3b2a20,['name',_0x56db5d[_0x0a6b('0xb')]]);if(_0x4d9cfe['field']){_0x94db76={};if(_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0xd')){_0x94db76[_0x4d9cfe['foreignKey']]=_['map'](_0x56db5d[_0x0a6b('0x7')],'id');}else{_0x94db76[_0x4d9cfe[_0x0a6b('0x9e')]]=_0x56db5d['associatedResources'];}_0x3ea550[_0x0a6b('0x8a')](_0x94db76);}else{_0x16c13a[_0x0a6b('0x7c')]['id']=_0x56db5d['associatedResources'];}}else{for(var _0x33231d=0x0;_0x33231d<_0x374dbd[_0x0a6b('0x89')];_0x33231d++){_0x4d9cfe=_[_0x0a6b('0x8c')](_0x3b2a20,['name',_0x374dbd[_0x33231d][_0x0a6b('0xb')]]);if(_0x4d9cfe[_0x0a6b('0x4')]){_0x94db76={};_0x94db76[_0x4d9cfe[_0x0a6b('0x9e')]]=_0x374dbd[_0x33231d][_0x0a6b('0x7')];_0x3ea550['push'](_0x94db76);}else{if(!_0x16c13a[_0x0a6b('0x7c')]['id'])_0x16c13a['where']['id']=[];_0x374dbd[_0x33231d]['associatedResources'][_0x0a6b('0x9f')](function(_0x204626){_0x16c13a[_0x0a6b('0x7c')]['id'][_0x0a6b('0x8a')](_0x204626);});}}}if(!_['isEmpty'](_0x3ea550)){_0x16c13a[_0x0a6b('0x7c')]=_[_0x0a6b('0x9c')](_0x16c13a[_0x0a6b('0x7c')],{'$and':{'$or':_0x3ea550}});}_0x16c13a=_[_0x0a6b('0x9c')]({},_0x16c13a,_0x24b829[_0x0a6b('0xa0')]);if(_0x56db5d&&!_0x56db5d[_0x0a6b('0x91')]&&_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0xd')){if(_0x24b829[_0x0a6b('0x85')][_0x0a6b('0xa1')]){_0x16c13a[_0x0a6b('0xa2')]=[{'all':!![]}];}return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0x6')](_0x16c13a)['then'](function(_0x482878){var _0x38c60d=[];_0x482878['forEach'](function(_0x2d73c2){var _0xb5e93d;switch(_0x2d73c2['reportType']){case _0x0a6b('0xa3'):_0xb5e93d=_[_0x0a6b('0x8c')](_0x56db5d[_0x0a6b('0x7')],function(_0x3158e9){return _0x3158e9['id']===_0x2d73c2['reportId']&&_0x3158e9[_0x0a6b('0x34')]==='DefaultReports';});break;case _0x0a6b('0xa4'):_0xb5e93d=_[_0x0a6b('0x8c')](_0x56db5d[_0x0a6b('0x7')],function(_0x74ce8d){return _0x74ce8d['id']===_0x2d73c2[_0x0a6b('0x72')]&&_0x74ce8d[_0x0a6b('0x34')]===_0x0a6b('0xa5');});break;}if(_0xb5e93d)_0x38c60d[_0x0a6b('0x8a')](_0x2d73c2);});_0x1f715b[_0x0a6b('0xa6')]=_0x38c60d[_0x0a6b('0x89')];_0x1f715b[_0x0a6b('0xa7')]=_0x38c60d;return _0x1f715b;});}else{return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0xa6')]({'where':_0x16c13a[_0x0a6b('0x7c')]})['then'](function(_0x4387d0){_0x1f715b[_0x0a6b('0xa6')]=_0x4387d0;if(_0x24b829['query'][_0x0a6b('0xa1')]){if(_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0x1a')){_0x16c13a['include']=[{'model':_0x13d4d5[_0x0a6b('0x68')],'as':_0x0a6b('0xa8'),'attributes':['id',_0x0a6b('0xb'),'color'],'required':_0x24b829[_0x0a6b('0x85')]['tag']?!![]:![]},{'model':_0x13d4d5[_0x0a6b('0x68')],'as':'ThroughTags','attributes':['id',_0x0a6b('0xb'),_0x0a6b('0xa9')],'through':_0x24b829['query']['tag']?{'attributes':[],'where':{'TagId':_0x24b829['query'][_0x0a6b('0xaa')]||undefined}}:{},'required':_0x24b829[_0x0a6b('0x85')][_0x0a6b('0xaa')]?!![]:![]}];}else{_0x16c13a[_0x0a6b('0xa2')]=[{'all':!![]}];}}return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0x6')](_0x16c13a);})[_0x0a6b('0xa')](function(_0x4b9e79){_0x1f715b[_0x0a6b('0xa7')]=_0x4b9e79;if(_0xa1b7e7===_0x0a6b('0x2c')&&_0x24b829['query'][_0x0a6b('0xab')]==='true'){var _0x5b8e37=[];for(var _0x25a602=0x0;_0x25a602<_0x1f715b[_0x0a6b('0xa7')]['length'];_0x25a602++){_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xac'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602]['dataValues']));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xad'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xaf'),_0x1f715b['rows'][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37['push'](_0x19e9a6(_0x0a6b('0xb0'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6('openchannel',_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37['push'](_0x19e9a6(_0x0a6b('0xb1'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));}return Promise[_0x0a6b('0x8e')](_0x5b8e37)['then'](function(){return _0x1f715b;});}return _0x1f715b;});}});}}});}; \ No newline at end of file +var _0x0adf=['Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','trunks','Plugin','Reports','reportId','metrics','AnalyticMetric','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','ignore','union','push','autoAssociation','rawAttributes','keys','intersection','attributes','fields','nolimit','limit','offset','sort','filters','merge','key','VIRTUAL','foreignKey','options','includeAll','forEach','reportType','default','DefaultReports','custom','count','rows','include','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','associatedResources','catch','model','name','resolve','map','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','internalroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','Users','role','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses'];(function(_0x1f52f5,_0x404fcc){var _0x3921be=function(_0x3085b5){while(--_0x3085b5){_0x1f52f5['push'](_0x1f52f5['shift']());}};_0x3921be(++_0x404fcc);}(_0x0adf,0x1d2));var _0xf0ad=function(_0xec0af,_0x41e133){_0xec0af=_0xec0af-0x0;var _0x444dfb=_0x0adf[_0xec0af];return _0x444dfb;};'use strict';var _=require(_0xf0ad('0x0'));var attributes=require(_0xf0ad('0x1'));var qs=require(_0xf0ad('0x2'));var squel=require('squel');module[_0xf0ad('0x3')]=function(_0x10cf5b){var _0x5d1191=_0x10cf5b[_0xf0ad('0x4')];function _0x27d666(_0x459e70,_0x719547){return new Promise(function(_0x59a588,_0x3bbf85){if(!_0x719547)return _0x59a588(null);var _0x53221f=_0x719547[_0xf0ad('0x5')]?{[_0x719547[_0xf0ad('0x5')][_0xf0ad('0x6')]]:_0x719547[_0xf0ad('0x5')][_0xf0ad('0x7')]}:undefined;return _0x5d1191[_0x459e70][_0xf0ad('0x8')]({'where':_0x53221f,'raw':!![]})[_0xf0ad('0x9')](function(_0x5bdf69){_0x719547[_0xf0ad('0xa')]=_['map'](_0x5bdf69,'id');_0x59a588(_0x719547);})[_0xf0ad('0xb')](function(_0x1f2952){_0x3bbf85(_0x1f2952);});});}function _0x43fb01(_0x2a5d0e,_0x3daf42){return new Promise(function(_0x4f2b79,_0x59b1a5){var _0x13ed94=_0x2a5d0e[_0xf0ad('0x5')]?{[_0x2a5d0e[_0xf0ad('0x5')][_0xf0ad('0x6')]]:_0x2a5d0e['filter'][_0xf0ad('0x7')]}:undefined;return _0x5d1191[_0x2a5d0e[_0xf0ad('0xc')]]['findAll']({'where':_0x13ed94,'raw':!![]})['then'](function(_0x5332e9){_0x3daf42[_0xf0ad('0xa')]=_['map'](_0x5332e9,function(_0x1dad7b){return _0x1dad7b[_0xf0ad('0xd')];});_0x4f2b79(_0x3daf42);})[_0xf0ad('0xb')](function(_0xfa829e){_0x59b1a5(_0xfa829e);});});}function _0x237dd9(_0x5c23ff,_0x1ad9e0,_0x285ab0){if(!_0x1ad9e0)return Promise[_0xf0ad('0xe')](null);return new Promise(function(_0x1c9fac,_0x47fa2b){return _0x5d1191['UserProfileResource'][_0xf0ad('0x8')]({'where':{'sectionId':_0x1ad9e0['id']},'raw':!![]})[_0xf0ad('0x9')](function(_0x49f2ec){if(_0x5c23ff[_0xf0ad('0x6')]&&_0x5c23ff[_0xf0ad('0x6')]!=='id'){_0x1ad9e0[_0xf0ad('0xa')]=_[_0xf0ad('0xf')](_0x49f2ec,function(_0x4cc08a){return _0x4cc08a[_0x5c23ff['field']];});}else{if(_0x285ab0===_0xf0ad('0x10')){_0x1ad9e0[_0xf0ad('0xa')]=_[_0xf0ad('0xf')](_0x49f2ec,function(_0x20c5f3){return{'id':_0x20c5f3[_0xf0ad('0x11')],'type':_0x20c5f3[_0xf0ad('0x12')]};});}else{_0x1ad9e0['associatedResources']=_[_0xf0ad('0xf')](_0x49f2ec,function(_0x16e62a){return _0x16e62a[_0xf0ad('0x11')];});}}_0x1c9fac(_0x1ad9e0);})[_0xf0ad('0xb')](function(_0x29d647){_0x47fa2b(_0x29d647);});});}function _0x88b47b(_0xb91769,_0x276322){var _0x3fc97e={'parentSections':[]};switch(_0xb91769[_0xf0ad('0x13')]()){case _0xf0ad('0x14'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x16');break;case _0xf0ad('0x17'):_0x3fc97e[_0xf0ad('0x15')]='SquareOdbc';break;case _0xf0ad('0x18'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x19');_0x3fc97e[_0xf0ad('0x1a')]=[{'name':_0xf0ad('0x1b'),'field':_0xf0ad('0xd'),'foreignKey':'projectName'}];break;case _0xf0ad('0x1c'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x1d');break;case _0xf0ad('0x1e'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x1f');_0x3fc97e[_0xf0ad('0x1a')]=[{'name':_0xf0ad('0x20'),'field':'id','foreignKey':_0xf0ad('0x21')}];break;case _0xf0ad('0x22'):_0x3fc97e[_0xf0ad('0x15')]='CmList';break;case _0xf0ad('0x23'):_0x3fc97e['childModel']=_0xf0ad('0x24');break;case'globalcustomfields':_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x25');break;case _0xf0ad('0x26'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x27');break;case _0xf0ad('0x28'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x29');break;case'faxqueues':_0x3fc97e['childModel']=_0xf0ad('0x2a');break;case _0xf0ad('0x2b'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x2c');break;case'inboundroutes':case _0xf0ad('0x2d'):case'outboundroutes':_0x3fc97e[_0xf0ad('0x15')]='VoiceExtension';break;case _0xf0ad('0x2e'):_0x3fc97e['childModel']=_0xf0ad('0x2f');break;case _0xf0ad('0x30'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x31');break;case _0xf0ad('0x32'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x33');_0x3fc97e[_0xf0ad('0x1a')]=[{'name':'Agents','field':_0xf0ad('0xd'),'foreignKey':'membername','model':_0xf0ad('0x34'),'filter':{'field':'role','value':[_0xf0ad('0x35')]}},{'name':_0xf0ad('0x36'),'field':_0xf0ad('0xd'),'foreignKey':_0xf0ad('0x37'),'model':_0xf0ad('0x34'),'filter':{'field':'role','value':[_0xf0ad('0x38')]}},{'name':_0xf0ad('0x39'),'field':_0xf0ad('0xd'),'foreignKey':_0xf0ad('0x3a'),'model':_0xf0ad('0x3b'),'filter':{'field':_0xf0ad('0x12'),'value':[_0xf0ad('0x3c')]}},{'name':'QueueCampaigns','field':_0xf0ad('0xd'),'foreignKey':_0xf0ad('0x3a'),'model':_0xf0ad('0x3b'),'filter':{'field':_0xf0ad('0x12'),'value':[_0xf0ad('0x3d')]}}];break;case _0xf0ad('0x3e'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x3f');break;case _0xf0ad('0x40'):_0x3fc97e['childModel']=_0xf0ad('0x41');break;case _0xf0ad('0x42'):_0x3fc97e[_0xf0ad('0x15')]='VoicePrefix';break;case'ivrcampaigns':_0x3fc97e['childModel']=_0xf0ad('0x43');break;case _0xf0ad('0x44'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x45');break;case _0xf0ad('0x46'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x47');break;case _0xf0ad('0x48'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x49');break;case _0xf0ad('0x4a'):_0x3fc97e['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x4b');break;case'smsqueues':_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x4c');break;case'smsaccounts':_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x4d');break;case _0xf0ad('0x4e'):_0x3fc97e[_0xf0ad('0x15')]='WhatsappQueue';break;case _0xf0ad('0x4f'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x50');break;case _0xf0ad('0x51'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x52');break;case _0xf0ad('0x53'):case _0xf0ad('0x54'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x3b');if(_0x276322){_0x3fc97e[_0xf0ad('0x1a')]=[{'name':'VoiceQueues'},{'name':_0xf0ad('0x55')}];}break;case _0xf0ad('0x56'):case _0xf0ad('0x57'):case'telephones':_0x3fc97e['childModel']=_0xf0ad('0x34');if(_0x276322){_0x3fc97e[_0xf0ad('0x1a')]=[{'name':_0xf0ad('0x58'),'filter':{'field':_0xf0ad('0x59'),'value':[_0xf0ad('0x5a'),_0xf0ad('0x5b')]},'ignore':!![]},{'name':_0xf0ad('0x5c')},{'name':'Telephones'}];}break;case _0xf0ad('0x5d'):_0x3fc97e['childModel']=_0xf0ad('0x5e');break;case _0xf0ad('0x5f'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x60');break;case _0xf0ad('0x61'):_0x3fc97e['childModel']='FreshdeskAccount';break;case _0xf0ad('0x62'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x63');break;case _0xf0ad('0x64'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x65');break;case _0xf0ad('0x66'):_0x3fc97e['childModel']=_0xf0ad('0x67');break;case _0xf0ad('0x68'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x34');break;case _0xf0ad('0x69'):_0x3fc97e['childModel']=_0xf0ad('0x6a');break;case _0xf0ad('0x6b'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x6c');break;case _0xf0ad('0x6d'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x6e');break;case'intervals':_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x6f');break;case _0xf0ad('0x70'):_0x3fc97e['childModel']=_0xf0ad('0x71');break;case _0xf0ad('0x72'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x73');break;case _0xf0ad('0x74'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x75');break;case _0xf0ad('0x76'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x77');break;case _0xf0ad('0x78'):_0x3fc97e['childModel']='Template';break;case _0xf0ad('0x79'):_0x3fc97e[_0xf0ad('0x15')]='Trigger';break;case _0xf0ad('0x7a'):_0x3fc97e[_0xf0ad('0x15')]='Trunk';break;case'variables':_0x3fc97e[_0xf0ad('0x15')]='Variable';break;case'plugins':_0x3fc97e['childModel']=_0xf0ad('0x7b');break;case'extractedreports':_0x3fc97e['childModel']=_0xf0ad('0x10');_0x3fc97e[_0xf0ad('0x1a')]=[{'name':_0xf0ad('0x7c'),'field':'id','foreignKey':_0xf0ad('0x7d')}];break;case _0xf0ad('0x7e'):_0x3fc97e[_0xf0ad('0x15')]=_0xf0ad('0x7f');break;}return _0x3fc97e;}function _0x52075c(_0x60fc33,_0x509efb){var _0x51a84a=_0x60fc33['charAt'](0x0)['toUpperCase']()+_0x60fc33[_0xf0ad('0x80')](0x1);var _0x1149a9={'type':_0x5d1191[_0xf0ad('0x81')][_0xf0ad('0x82')][_0xf0ad('0x83')],'raw':!![]};return new Promise(function(_0x32c1d5,_0x410988){var _0x45a96e=squel[_0xf0ad('0x84')]()[_0xf0ad('0x6')](_0xf0ad('0x85')+_0x51a84a+'InteractionId','id')['field'](_0xf0ad('0x86'))[_0xf0ad('0x87')]('user_has_'+_0x60fc33+_0xf0ad('0x88'),'ui')[_0xf0ad('0x89')]('ui.UserId\x20=\x20?',_0x509efb['id']);return _0x5d1191[_0xf0ad('0x8a')][_0xf0ad('0x8b')](_0x45a96e[_0xf0ad('0x8c')](),_0x1149a9)['then'](function(_0x1fe9df){_0x509efb[_0x51a84a+_0xf0ad('0x8d')]=_0x1fe9df;_0x32c1d5(_0x1fe9df);})[_0xf0ad('0xb')](function(_0x3ed619){_0x410988(_0x3ed619);});});}return _0x10cf5b[_0xf0ad('0x8e')](_0xf0ad('0x8f'),attributes,{'tableName':_0xf0ad('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x15739e){var _0x57e096={'raw':![],'where':{}};var _0x1a6664={};var _0x55bb24={'count':0x0,'rows':[]};var _0x2db8fe=_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0x91')];var _0x5e9a3c=_0x15739e[_0xf0ad('0x8b')]['mergeResources']||![];var _0x41a5ba=_0x88b47b(_0x2db8fe,_0x5e9a3c);if(!_0x41a5ba[_0xf0ad('0x15')])throw new Error(_0xf0ad('0x92')+_0x2db8fe+'\x27');var _0x187d76=[{'name':_0x2db8fe}];if(!_[_0xf0ad('0x93')](_0x41a5ba[_0xf0ad('0x1a')]))_0x187d76=_0x41a5ba[_0xf0ad('0x1a')];var _0x53d8e0=[];for(var _0x1ea760=0x0;_0x1ea760<_0x187d76[_0xf0ad('0x94')];_0x1ea760++){_0x53d8e0['push'](_0x5d1191[_0xf0ad('0x95')][_0xf0ad('0x96')]({'where':{'userProfileId':_0x15739e[_0xf0ad('0x97')]['id'],'name':_0x187d76[_0x1ea760][_0xf0ad('0xd')]},'raw':!![]}));}return Promise[_0xf0ad('0x98')](_0x53d8e0)[_0xf0ad('0x9')](function(_0x3d6f53){var _0x15152d=_[_0xf0ad('0x5')](_0x3d6f53,function(_0x3b56d3){return _0x3b56d3?_0x3b56d3:undefined;});var _0x2463cd=_[_0xf0ad('0x5')](_0x187d76,[_0xf0ad('0x99'),!![]]);var _0x51eb6d=_[_0xf0ad('0x93')](_0x15152d)&&_[_0xf0ad('0x93')](_0x2463cd)?null:_[_0xf0ad('0x9a')](_0x2463cd,_0x15152d);if(!_0x51eb6d)return null;var _0x232c6b=[];for(var _0x4e48df=0x0;_0x4e48df<_0x51eb6d[_0xf0ad('0x94')];_0x4e48df++){var _0x3afe0e=_[_0xf0ad('0x96')](_0x187d76,function(_0x4c3d0f){return _0x51eb6d[_0x4e48df]?_0x4c3d0f[_0xf0ad('0xd')]===_0x51eb6d[_0x4e48df]['name']:null;});if(_0x3afe0e){if(_0x51eb6d[_0x4e48df][_0xf0ad('0x99')]){_0x232c6b[_0xf0ad('0x9b')](_0x27d666(_0x41a5ba[_0xf0ad('0x15')],_0x51eb6d[_0x4e48df]));}else{if(!_0x51eb6d[_0x4e48df][_0xf0ad('0x9c')]){_0x232c6b['push'](_0x237dd9(_0x3afe0e,_0x51eb6d[_0x4e48df],_0x41a5ba[_0xf0ad('0x15')]));}else{if(_0x3afe0e['model']){_0x232c6b['push'](_0x43fb01(_0x3afe0e,_0x51eb6d[_0x4e48df]));}}}}}return Promise[_0xf0ad('0x98')](_0x232c6b);})[_0xf0ad('0x9')](function(_0x119b0d){var _0x33bc17=_0x119b0d;var _0x37b261=null;if(_0x33bc17){_0x37b261=_0x33bc17['length']===0x1?_0x33bc17[0x0]:null;}if(!_0x37b261&&!_0x33bc17)return _0x55bb24;var _0x540b2b=_0x5d1191[_0x41a5ba[_0xf0ad('0x15')]][_0xf0ad('0x9d')];_0x1a6664[_0xf0ad('0xc')]=_[_0xf0ad('0x9e')](_0x540b2b);_0x1a6664[_0xf0ad('0x8b')]=_[_0xf0ad('0x9e')](_0x15739e[_0xf0ad('0x8b')]);_0x1a6664['filters']=_[_0xf0ad('0x9f')](_0x1a6664[_0xf0ad('0xc')],_0x1a6664[_0xf0ad('0x8b')]);_0x57e096[_0xf0ad('0xa0')]=_[_0xf0ad('0x9f')](_0x1a6664[_0xf0ad('0xc')],qs['fields'](_0x15739e['query'][_0xf0ad('0xa1')]));_0x57e096[_0xf0ad('0xa0')]=_0x57e096[_0xf0ad('0xa0')][_0xf0ad('0x94')]?_0x57e096['attributes']:_0x1a6664[_0xf0ad('0xc')];if(!_0x15739e['query']['hasOwnProperty'](_0xf0ad('0xa2'))){_0x57e096['limit']=qs[_0xf0ad('0xa3')](_0x15739e['query']['limit']);_0x57e096[_0xf0ad('0xa4')]=qs[_0xf0ad('0xa4')](_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0xa4')]);}_0x57e096['order']=qs[_0xf0ad('0xa5')](_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0xa5')]);_0x57e096['where']=qs['filters'](_['pick'](_0x15739e[_0xf0ad('0x8b')],_0x1a6664[_0xf0ad('0xa6')]));if(_0x15739e['query'][_0xf0ad('0x5')]){_0x57e096[_0xf0ad('0x89')]=_[_0xf0ad('0xa7')](_0x57e096[_0xf0ad('0x89')],{'$or':_[_0xf0ad('0xf')](_0x540b2b,function(_0x29e70e){if(_0x29e70e[_0xf0ad('0x12')][_0xf0ad('0xa8')]!==_0xf0ad('0xa9')){var _0x56bda2={};_0x56bda2[_0x29e70e[_0xf0ad('0x6')]]={'$like':'%'+_0x15739e[_0xf0ad('0x8b')]['filter']+'%'};return _0x56bda2;}})});}var _0x2cd0ce=[];var _0x2ec429=null;var _0x13c804={};if(_0x37b261){_0x2ec429=_[_0xf0ad('0x96')](_0x187d76,[_0xf0ad('0xd'),_0x37b261[_0xf0ad('0xd')]]);if(_0x2ec429[_0xf0ad('0x6')]){_0x13c804={};if(_0x41a5ba[_0xf0ad('0x15')]===_0xf0ad('0x10')){_0x13c804[_0x2ec429[_0xf0ad('0xaa')]]=_['map'](_0x37b261[_0xf0ad('0xa')],'id');}else{_0x13c804[_0x2ec429[_0xf0ad('0xaa')]]=_0x37b261[_0xf0ad('0xa')];}_0x2cd0ce[_0xf0ad('0x9b')](_0x13c804);}else{_0x57e096['where']['id']=_0x37b261[_0xf0ad('0xa')];}}else{for(var _0x276a08=0x0;_0x276a08<_0x33bc17[_0xf0ad('0x94')];_0x276a08++){_0x2ec429=_[_0xf0ad('0x96')](_0x187d76,[_0xf0ad('0xd'),_0x33bc17[_0x276a08][_0xf0ad('0xd')]]);if(_0x2ec429[_0xf0ad('0x6')]){_0x13c804={};_0x13c804[_0x2ec429[_0xf0ad('0xaa')]]=_0x33bc17[_0x276a08][_0xf0ad('0xa')];_0x2cd0ce[_0xf0ad('0x9b')](_0x13c804);}else{if(!_0x57e096['where']['id'])_0x57e096[_0xf0ad('0x89')]['id']=[];_0x33bc17[_0x276a08][_0xf0ad('0xa')]['forEach'](function(_0x70e504){_0x57e096[_0xf0ad('0x89')]['id']['push'](_0x70e504);});}}}if(!_[_0xf0ad('0x93')](_0x2cd0ce)){_0x57e096[_0xf0ad('0x89')]=_[_0xf0ad('0xa7')](_0x57e096[_0xf0ad('0x89')],{'$and':{'$or':_0x2cd0ce}});}_0x57e096=_[_0xf0ad('0xa7')]({},_0x57e096,_0x15739e[_0xf0ad('0xab')]);if(_0x37b261&&!_0x37b261[_0xf0ad('0x9c')]&&_0x41a5ba[_0xf0ad('0x15')]==='AnalyticExtractedReport'){if(_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0xac')]){_0x57e096['include']=[{'all':!![]}];}return _0x5d1191[_0x41a5ba[_0xf0ad('0x15')]][_0xf0ad('0x8')](_0x57e096)[_0xf0ad('0x9')](function(_0xa74339){var _0x347ec5=[];_0xa74339[_0xf0ad('0xad')](function(_0x15c25b){var _0x57205f;switch(_0x15c25b[_0xf0ad('0xae')]){case _0xf0ad('0xaf'):_0x57205f=_['find'](_0x37b261[_0xf0ad('0xa')],function(_0x1ff58e){return _0x1ff58e['id']===_0x15c25b[_0xf0ad('0x7d')]&&_0x1ff58e[_0xf0ad('0x12')]===_0xf0ad('0xb0');});break;case _0xf0ad('0xb1'):_0x57205f=_['find'](_0x37b261[_0xf0ad('0xa')],function(_0x284b96){return _0x284b96['id']===_0x15c25b[_0xf0ad('0x7d')]&&_0x284b96[_0xf0ad('0x12')]==='CustomReports';});break;}if(_0x57205f)_0x347ec5[_0xf0ad('0x9b')](_0x15c25b);});_0x55bb24[_0xf0ad('0xb2')]=_0x347ec5[_0xf0ad('0x94')];_0x55bb24[_0xf0ad('0xb3')]=_0x347ec5;return _0x55bb24;});}else{return _0x5d1191[_0x41a5ba[_0xf0ad('0x15')]][_0xf0ad('0xb2')]({'where':_0x57e096[_0xf0ad('0x89')]})[_0xf0ad('0x9')](function(_0x28a74e){_0x55bb24[_0xf0ad('0xb2')]=_0x28a74e;if(_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0xac')]){if(_0x41a5ba[_0xf0ad('0x15')]===_0xf0ad('0x1f')){_0x57e096[_0xf0ad('0xb4')]=[{'model':_0x5d1191[_0xf0ad('0x77')],'as':_0xf0ad('0xb5'),'attributes':['id','name',_0xf0ad('0xb6')],'required':_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0xb7')]?!![]:![]},{'model':_0x5d1191[_0xf0ad('0x77')],'as':_0xf0ad('0xb8'),'attributes':['id',_0xf0ad('0xd'),_0xf0ad('0xb6')],'through':_0x15739e['query']['tag']?{'attributes':[],'where':{'TagId':_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0xb7')]||undefined}}:{},'required':_0x15739e[_0xf0ad('0x8b')]['tag']?!![]:![]}];}else{_0x57e096[_0xf0ad('0xb4')]=[{'all':!![]}];}}return _0x5d1191[_0x41a5ba['childModel']]['findAll'](_0x57e096);})['then'](function(_0x168523){_0x55bb24[_0xf0ad('0xb3')]=_0x168523;if(_0x2db8fe==='Agents'&&_0x15739e[_0xf0ad('0x8b')][_0xf0ad('0xb9')]===_0xf0ad('0xba')){var _0x25079f=[];for(var _0x4932c4=0x0;_0x4932c4<_0x55bb24[_0xf0ad('0xb3')]['length'];_0x4932c4++){_0x25079f['push'](_0x52075c(_0xf0ad('0xbb'),_0x55bb24[_0xf0ad('0xb3')][_0x4932c4][_0xf0ad('0xbc')]));_0x25079f[_0xf0ad('0x9b')](_0x52075c('sms',_0x55bb24['rows'][_0x4932c4][_0xf0ad('0xbc')]));_0x25079f['push'](_0x52075c(_0xf0ad('0xbd'),_0x55bb24['rows'][_0x4932c4][_0xf0ad('0xbc')]));_0x25079f['push'](_0x52075c(_0xf0ad('0xbe'),_0x55bb24['rows'][_0x4932c4][_0xf0ad('0xbc')]));_0x25079f[_0xf0ad('0x9b')](_0x52075c(_0xf0ad('0xbf'),_0x55bb24[_0xf0ad('0xb3')][_0x4932c4][_0xf0ad('0xbc')]));_0x25079f['push'](_0x52075c(_0xf0ad('0xc0'),_0x55bb24[_0xf0ad('0xb3')][_0x4932c4]['dataValues']));}return Promise[_0xf0ad('0x98')](_0x25079f)[_0xf0ad('0x9')](function(){return _0x55bb24;});}return _0x55bb24;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d5ed86e..e27311e 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 _0x7eff=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf7ef('0x0'));var moment=require(_0xf7ef('0x1'));var BPromise=require(_0xf7ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7ef('0x3'));var db=require(_0xf7ef('0x4'))['db'];var utils=require(_0xf7ef('0x5'));var logger=require(_0xf7ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7ef('0x7'));var client=jayson[_0xf7ef('0x8')][_0xf7ef('0x9')]({'port':0x232a});config[_0xf7ef('0xa')]=_[_0xf7ef('0xb')](config[_0xf7ef('0xa')],{'host':_0xf7ef('0xc'),'port':0x18eb});var socket=require(_0xf7ef('0xd'))(new Redis(config['redis']));require(_0xf7ef('0xe'))[_0xf7ef('0xf')](socket);function respondWithRpcPromise(_0x48c84f,_0x25c6c5,_0x5bbb90){return new BPromise(function(_0x5044c4,_0x598fc5){return client['request'](_0x48c84f,_0x5bbb90)[_0xf7ef('0x10')](function(_0x4a7d97){logger['info']('UserProfile,\x20%s,\x20%s',_0x25c6c5,_0xf7ef('0x11'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x25c6c5,'request\x20sent',JSON[_0xf7ef('0x12')](_0x4a7d97));if(_0x4a7d97[_0xf7ef('0x13')]){if(_0x4a7d97[_0xf7ef('0x13')][_0xf7ef('0x14')]===0x1f4){logger['error'](_0xf7ef('0x15'),_0x25c6c5,_0x4a7d97['error'][_0xf7ef('0x16')]);return _0x598fc5(_0x4a7d97[_0xf7ef('0x13')]['message']);}logger[_0xf7ef('0x13')]('UserProfile,\x20%s,\x20%s',_0x25c6c5,_0x4a7d97[_0xf7ef('0x13')][_0xf7ef('0x16')]);return _0x5044c4(_0x4a7d97[_0xf7ef('0x13')][_0xf7ef('0x16')]);}else{logger[_0xf7ef('0x17')](_0xf7ef('0x15'),_0x25c6c5,_0xf7ef('0x11'));_0x5044c4(_0x4a7d97['result']['message']);}})['catch'](function(_0x3138a3){logger['error'](_0xf7ef('0x15'),_0x25c6c5,_0x3138a3);_0x598fc5(_0x3138a3);});});} \ No newline at end of file +var _0xe6e9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe6e9,0x182));var _0x9e6e=function(_0x56d74b,_0x447c5c){_0x56d74b=_0x56d74b-0x0;var _0x2227b7=_0xe6e9[_0x56d74b];return _0x2227b7;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var moment=require(_0x9e6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e6e('0x3'));var fs=require('fs');var Redis=require(_0x9e6e('0x4'));var db=require(_0x9e6e('0x5'))['db'];var utils=require(_0x9e6e('0x6'));var logger=require(_0x9e6e('0x7'))('rpc');var config=require(_0x9e6e('0x8'));var jayson=require(_0x9e6e('0x9'));var client=jayson[_0x9e6e('0xa')][_0x9e6e('0xb')]({'port':0x232a});config[_0x9e6e('0xc')]=_['defaults'](config[_0x9e6e('0xc')],{'host':_0x9e6e('0xd'),'port':0x18eb});var socket=require(_0x9e6e('0xe'))(new Redis(config[_0x9e6e('0xc')]));require(_0x9e6e('0xf'))[_0x9e6e('0x10')](socket);function respondWithRpcPromise(_0x4862cb,_0x1b683d,_0x40360d){return new BPromise(function(_0x286351,_0xbf2d04){return client['request'](_0x4862cb,_0x40360d)[_0x9e6e('0x11')](function(_0x4697d1){logger['info'](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));logger[_0x9e6e('0x14')](_0x9e6e('0x15'),_0x1b683d,'request\x20sent',JSON[_0x9e6e('0x16')](_0x4697d1));if(_0x4697d1[_0x9e6e('0x17')]){if(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x18')]===0x1f4){logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0xbf2d04(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0x286351(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}else{logger[_0x9e6e('0x1a')](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));_0x286351(_0x4697d1[_0x9e6e('0x1b')][_0x9e6e('0x19')]);}})['catch'](function(_0x54ba62){logger['error'](_0x9e6e('0x12'),_0x1b683d,_0x54ba62);_0xbf2d04(_0x54ba62);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6abb52a..b03c0d3 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 _0x21d2=['emit','removeListener','register','length','save','remove','update'];(function(_0x188c88,_0x210793){var _0x4e4c38=function(_0x3d9e41){while(--_0x3d9e41){_0x188c88['push'](_0x188c88['shift']());}};_0x4e4c38(++_0x210793);}(_0x21d2,0x17e));var _0x221d=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x21d2[_0x45783c];return _0x1161da;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x221d('0x0'),_0x221d('0x1'),_0x221d('0x2')];function createListener(_0x643b99,_0x2d1ed4){return function(_0x533983){_0x2d1ed4[_0x221d('0x3')](_0x643b99,_0x533983);};}function removeListener(_0x3763d0,_0x5c74c2){return function(){UserProfileEvents[_0x221d('0x4')](_0x3763d0,_0x5c74c2);};}exports[_0x221d('0x5')]=function(_0x1ac7d0){for(var _0x5dd7e0=0x0,_0x4e8f58=events[_0x221d('0x6')];_0x5dd7e0<_0x4e8f58;_0x5dd7e0++){var _0x1018b4=events[_0x5dd7e0];var _0x46dfcf=createListener('userProfile:'+_0x1018b4,_0x1ac7d0);UserProfileEvents['on'](_0x1018b4,_0x46dfcf);}}; \ No newline at end of file +var _0xf9dd=['update','emit','removeListener','length','userProfile:','./userProfile.events','remove'];(function(_0x49dc3c,_0x18c872){var _0x2607ec=function(_0x2c6718){while(--_0x2c6718){_0x49dc3c['push'](_0x49dc3c['shift']());}};_0x2607ec(++_0x18c872);}(_0xf9dd,0x186));var _0xdf9d=function(_0x3e50a0,_0x200906){_0x3e50a0=_0x3e50a0-0x0;var _0x4cc857=_0xf9dd[_0x3e50a0];return _0x4cc857;};'use strict';var UserProfileEvents=require(_0xdf9d('0x0'));var events=['save',_0xdf9d('0x1'),_0xdf9d('0x2')];function createListener(_0x43ca2f,_0x472fb5){return function(_0xe2dc9e){_0x472fb5[_0xdf9d('0x3')](_0x43ca2f,_0xe2dc9e);};}function removeListener(_0x56195a,_0x5dde6a){return function(){UserProfileEvents[_0xdf9d('0x4')](_0x56195a,_0x5dde6a);};}exports['register']=function(_0x5e4af4){for(var _0x2f57d6=0x0,_0x4ec709=events[_0xdf9d('0x5')];_0x2f57d6<_0x4ec709;_0x2f57d6++){var _0x3352d9=events[_0x2f57d6];var _0x5dbc43=createListener(_0xdf9d('0x6')+_0x3352d9,_0x5e4af4);UserProfileEvents['on'](_0x3352d9,_0x5dbc43);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f65e69e..813c2b2 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 _0x6ec6=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','exports'];(function(_0x4c6ea5,_0x2a4b09){var _0x12e37e=function(_0x588aa7){while(--_0x588aa7){_0x4c6ea5['push'](_0x4c6ea5['shift']());}};_0x12e37e(++_0x2a4b09);}(_0x6ec6,0x143));var _0x66ec=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x6ec6[_0x125ff8];return _0x2d9ef;};'use strict';var multer=require(_0x66ec('0x0'));var util=require(_0x66ec('0x1'));var path=require(_0x66ec('0x2'));var timeout=require(_0x66ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x66ec('0x4'));var auth=require(_0x66ec('0x5'));var interaction=require(_0x66ec('0x6'));var config=require('../../config/environment');var controller=require(_0x66ec('0x7'));router[_0x66ec('0x8')]('/',auth[_0x66ec('0x9')](),controller[_0x66ec('0xa')]);router['get'](_0x66ec('0xb'),auth[_0x66ec('0x9')](),controller[_0x66ec('0xc')]);router[_0x66ec('0x8')](_0x66ec('0xd'),auth[_0x66ec('0x9')](),controller['show']);router[_0x66ec('0xe')]('/',auth[_0x66ec('0x9')](),controller[_0x66ec('0xf')]);router['put'](_0x66ec('0xd'),auth[_0x66ec('0x9')](),controller[_0x66ec('0x10')]);router[_0x66ec('0x11')]('/:id',auth[_0x66ec('0x9')](),controller['destroy']);module[_0x66ec('0x12')]=router; \ No newline at end of file +var _0x38ac=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','Router','../../components/auth/service'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0x38ac,0x161));var _0xc38a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x38ac[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xc38a('0x0'));var util=require(_0xc38a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc38a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc38a('0x3'));var interaction=require(_0xc38a('0x4'));var config=require(_0xc38a('0x5'));var controller=require(_0xc38a('0x6'));router[_0xc38a('0x7')]('/',auth[_0xc38a('0x8')](),controller[_0xc38a('0x9')]);router[_0xc38a('0x7')](_0xc38a('0xa'),auth['isAuthenticated'](),controller[_0xc38a('0xb')]);router[_0xc38a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc38a('0xc')]);router[_0xc38a('0xd')]('/',auth['isAuthenticated'](),controller[_0xc38a('0xe')]);router[_0xc38a('0xf')](_0xc38a('0x10'),auth[_0xc38a('0x8')](),controller[_0xc38a('0x11')]);router[_0xc38a('0x12')](_0xc38a('0x10'),auth[_0xc38a('0x8')](),controller[_0xc38a('0x13')]);module[_0xc38a('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index eee2e31..79aa587 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 _0xc9e9=['sequelize','exports','STRING','INTEGER'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0xc9e9,0xb0));var _0x9c9e=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0xc9e9[_0x4e198a];return _0xb84bfe;};'use strict';var Sequelize=require(_0x9c9e('0x0'));module[_0x9c9e('0x1')]={'name':{'type':Sequelize[_0x9c9e('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9c9e('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb40c=['STRING','INTEGER','sequelize','exports'];(function(_0x5971c6,_0x48e6ba){var _0x2545a3=function(_0x12fb7d){while(--_0x12fb7d){_0x5971c6['push'](_0x5971c6['shift']());}};_0x2545a3(++_0x48e6ba);}(_0xb40c,0x1c6));var _0xcb40=function(_0x39b91c,_0x21d18b){_0x39b91c=_0x39b91c-0x0;var _0x1c8c2e=_0xb40c[_0x39b91c];return _0x1c8c2e;};'use strict';var Sequelize=require(_0xcb40('0x0'));module[_0xcb40('0x1')]={'name':{'type':Sequelize[_0xcb40('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xcb40('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xcb40('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 096b906..4aa7a59 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 _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','UserProfileResource','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x8952,0x17e));var _0x2895=function(_0x3f20a4,_0x596980){_0x3f20a4=_0x3f20a4-0x0;var _0x392956=_0x8952[_0x3f20a4];return _0x392956;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['UserProfileResource'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file +var _0x4c60=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','UserProfileResource','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x3b2035,_0x375ce8){var _0x161ca3=function(_0x1b8e3a){while(--_0x1b8e3a){_0x3b2035['push'](_0x3b2035['shift']());}};_0x161ca3(++_0x375ce8);}(_0x4c60,0xc1));var _0x04c6=function(_0x17c720,_0xa7beb6){_0x17c720=_0x17c720-0x0;var _0x35cb28=_0x4c60[_0x17c720];return _0x35cb28;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['UserProfileResource'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['UserProfileResource'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['UserProfileResource'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['UserProfileResource'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));};exports[_0x04c6('0x46')]=function(_0x1b8fa4,_0x160f91){return db[_0x04c6('0x27')][_0x04c6('0x46')]()[_0x04c6('0x1f')](respondWithResult(_0x160f91,null))[_0x04c6('0x3e')](handleError(_0x160f91,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4b68d9e..10addf4 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 _0x386c=['./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x42ac93,_0x5952b2){var _0x465580=function(_0xbd8069){while(--_0xbd8069){_0x42ac93['push'](_0x42ac93['shift']());}};_0x465580(++_0x5952b2);}(_0x386c,0xa1));var _0xc386=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x386c[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xc386('0x0'));var util=require(_0xc386('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc386('0x2'));var BPromise=require(_0xc386('0x3'));var rp=require(_0xc386('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc386('0x5'));var config=require(_0xc386('0x6'));var attributes=require(_0xc386('0x7'));module[_0xc386('0x8')]=function(_0x5793e6,_0x178975){return _0x5793e6[_0xc386('0x9')]('UserProfileResource',attributes,{'tableName':_0xc386('0xa'),'paranoid':![],'indexes':[{'name':_0xc386('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa54b=['resourceId','lodash','../../config/logger','api','request-promise','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x3286a7,_0xdce617){var _0x50e291=function(_0x544e40){while(--_0x544e40){_0x3286a7['push'](_0x3286a7['shift']());}};_0x50e291(++_0xdce617);}(_0xa54b,0x10f));var _0xba54=function(_0x2165c8,_0x4b7025){_0x2165c8=_0x2165c8-0x0;var _0x1444b2=_0xa54b[_0x2165c8];return _0x1444b2;};'use strict';var _=require(_0xba54('0x0'));var util=require('util');var logger=require(_0xba54('0x1'))(_0xba54('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba54('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba54('0x4'));var attributes=require(_0xba54('0x5'));module['exports']=function(_0x837605,_0x1f7e4a){return _0x837605['define'](_0xba54('0x6'),attributes,{'tableName':_0xba54('0x7'),'paranoid':![],'indexes':[{'name':_0xba54('0x8'),'fields':[_0xba54('0x9'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 338e3fe..72d506d 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 _0xb770=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message','info','result','util'];(function(_0x4d78fb,_0x280202){var _0x2898bf=function(_0x11ba3c){while(--_0x11ba3c){_0x4d78fb['push'](_0x4d78fb['shift']());}};_0x2898bf(++_0x280202);}(_0xb770,0x1e2));var _0x0b77=function(_0x6eb857,_0x573b1a){_0x6eb857=_0x6eb857-0x0;var _0x5c7aea=_0xb770[_0x6eb857];return _0x5c7aea;};'use strict';var _=require('lodash');var util=require(_0x0b77('0x0'));var moment=require(_0x0b77('0x1'));var BPromise=require(_0x0b77('0x2'));var rs=require(_0x0b77('0x3'));var fs=require('fs');var Redis=require(_0x0b77('0x4'));var db=require(_0x0b77('0x5'))['db'];var utils=require(_0x0b77('0x6'));var logger=require(_0x0b77('0x7'))(_0x0b77('0x8'));var config=require(_0x0b77('0x9'));var jayson=require(_0x0b77('0xa'));var client=jayson[_0x0b77('0xb')][_0x0b77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55e9b6,_0x176698,_0x5bed15){return new BPromise(function(_0x1b802a,_0x32ff80){return client[_0x0b77('0xd')](_0x55e9b6,_0x5bed15)[_0x0b77('0xe')](function(_0x2bcb59){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x176698,_0x0b77('0xf'));logger[_0x0b77('0x10')](_0x0b77('0x11'),_0x176698,_0x0b77('0xf'),JSON['stringify'](_0x2bcb59));if(_0x2bcb59['error']){if(_0x2bcb59[_0x0b77('0x12')]['code']===0x1f4){logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x2bcb59[_0x0b77('0x12')][_0x0b77('0x14')]);return _0x32ff80(_0x2bcb59['error'][_0x0b77('0x14')]);}logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x2bcb59[_0x0b77('0x12')]['message']);return _0x1b802a(_0x2bcb59['error']['message']);}else{logger[_0x0b77('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x176698,_0x0b77('0xf'));_0x1b802a(_0x2bcb59[_0x0b77('0x16')][_0x0b77('0x14')]);}})['catch'](function(_0x4265e9){logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x4265e9);_0x32ff80(_0x4265e9);});});} \ No newline at end of file +var _0x772f=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3ec06e,_0x746cef){var _0x48c8b2=function(_0x2d4438){while(--_0x2d4438){_0x3ec06e['push'](_0x3ec06e['shift']());}};_0x48c8b2(++_0x746cef);}(_0x772f,0x1a3));var _0xf772=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0x772f[_0x34f545];return _0x1ff6b8;};'use strict';var _=require(_0xf772('0x0'));var util=require(_0xf772('0x1'));var moment=require('moment');var BPromise=require(_0xf772('0x2'));var rs=require(_0xf772('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf772('0x4'))['db'];var utils=require(_0xf772('0x5'));var logger=require(_0xf772('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf772('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3615d4,_0x31cbb7,_0x282d77){return new BPromise(function(_0x27ef1c,_0x5f47fe){return client[_0xf772('0x8')](_0x3615d4,_0x282d77)[_0xf772('0x9')](function(_0xec4a){logger[_0xf772('0xa')](_0xf772('0xb'),_0x31cbb7,_0xf772('0xc'));logger[_0xf772('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x31cbb7,_0xf772('0xc'),JSON[_0xf772('0xe')](_0xec4a));if(_0xec4a[_0xf772('0xf')]){if(_0xec4a[_0xf772('0xf')][_0xf772('0x10')]===0x1f4){logger['error'](_0xf772('0xb'),_0x31cbb7,_0xec4a[_0xf772('0xf')]['message']);return _0x5f47fe(_0xec4a[_0xf772('0xf')][_0xf772('0x11')]);}logger['error'](_0xf772('0xb'),_0x31cbb7,_0xec4a[_0xf772('0xf')][_0xf772('0x11')]);return _0x27ef1c(_0xec4a[_0xf772('0xf')]['message']);}else{logger[_0xf772('0xa')](_0xf772('0xb'),_0x31cbb7,_0xf772('0xc'));_0x27ef1c(_0xec4a['result'][_0xf772('0x11')]);}})[_0xf772('0x12')](function(_0x1401d5){logger['error'](_0xf772('0xb'),_0x31cbb7,_0x1401d5);_0x5f47fe(_0x1401d5);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a61f01d..4ba1828 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 _0x5f0f=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','post','create','put','/:id','update','delete','destroy','exports','path','express','Router','fs-extra'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5f0f,0x12e));var _0xf5f0=function(_0x195601,_0xdae54f){_0x195601=_0x195601-0x0;var _0x5263d6=_0x5f0f[_0x195601];return _0x5263d6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5f0('0x0'));var timeout=require('connect-timeout');var express=require(_0xf5f0('0x1'));var router=express[_0xf5f0('0x2')]();var fs_extra=require(_0xf5f0('0x3'));var auth=require(_0xf5f0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf5f0('0x5'));var controller=require('./userProfileSection.controller');router[_0xf5f0('0x6')]('/',auth[_0xf5f0('0x7')](),controller[_0xf5f0('0x8')]);router[_0xf5f0('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xf5f0('0x9')]);router['get']('/:id',auth[_0xf5f0('0x7')](),controller['show']);router[_0xf5f0('0xa')]('/',auth[_0xf5f0('0x7')](),controller[_0xf5f0('0xb')]);router[_0xf5f0('0xc')](_0xf5f0('0xd'),auth[_0xf5f0('0x7')](),controller[_0xf5f0('0xe')]);router[_0xf5f0('0xf')](_0xf5f0('0xd'),auth['isAuthenticated'](),controller[_0xf5f0('0x10')]);module[_0xf5f0('0x11')]=router; \ No newline at end of file +var _0x7118=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7118,0xe5));var _0x8711=function(_0x4d0087,_0x22ab19){_0x4d0087=_0x4d0087-0x0;var _0x44c1d2=_0x7118[_0x4d0087];return _0x44c1d2;};'use strict';var multer=require(_0x8711('0x0'));var util=require(_0x8711('0x1'));var path=require(_0x8711('0x2'));var timeout=require(_0x8711('0x3'));var express=require('express');var router=express[_0x8711('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8711('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8711('0x6'));var controller=require(_0x8711('0x7'));router[_0x8711('0x8')]('/',auth[_0x8711('0x9')](),controller[_0x8711('0xa')]);router[_0x8711('0x8')]('/describe',auth[_0x8711('0x9')](),controller[_0x8711('0xb')]);router[_0x8711('0x8')](_0x8711('0xc'),auth[_0x8711('0x9')](),controller['show']);router[_0x8711('0xd')]('/',auth['isAuthenticated'](),controller[_0x8711('0xe')]);router['put'](_0x8711('0xc'),auth[_0x8711('0x9')](),controller[_0x8711('0xf')]);router[_0x8711('0x10')](_0x8711('0xc'),auth[_0x8711('0x9')](),controller[_0x8711('0x11')]);module[_0x8711('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 50d26f6..5a44ca8 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 _0x4e81=['join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x4e81,0x1bc));var _0x14e8=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x4e81[_0x200827];return _0x120047;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'name':{'type':Sequelize[_0x14e8('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x14e8('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x14e8('0x2')],'set':function(_0x224121){this[_0x14e8('0x4')](_0x14e8('0x5'),_0x224121?_0x224121[_0x14e8('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x14e8('0x7')](_0x14e8('0x5'))[_0x14e8('0x8')](''):[];}}}; \ No newline at end of file +var _0x8603=['BOOLEAN','crudPermissions','getDataValue','split','exports','STRING'];(function(_0x36a04e,_0x2c5f3a){var _0x1b638b=function(_0x407bd6){while(--_0x407bd6){_0x36a04e['push'](_0x36a04e['shift']());}};_0x1b638b(++_0x2c5f3a);}(_0x8603,0x190));var _0x3860=function(_0x510ab3,_0x51e30f){_0x510ab3=_0x510ab3-0x0;var _0x552438=_0x8603[_0x510ab3];return _0x552438;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x3860('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3860('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3860('0x1')],'set':function(_0x2f56a3){this['setDataValue'](_0x3860('0x3'),_0x2f56a3?_0x2f56a3['join'](''):[]);},'get':function(){return this[_0x3860('0x4')](_0x3860('0x3'))?this[_0x3860('0x4')](_0x3860('0x3'))[_0x3860('0x5')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9452fda..c2bf20a 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 _0x3430=['send','index','UserProfileSection','rawAttributes','type','key','model','map','query','keys','filters','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x306902,_0x15482c){var _0x3d6f3c=function(_0x38e1e9){while(--_0x38e1e9){_0x306902['push'](_0x306902['shift']());}};_0x3d6f3c(++_0x15482c);}(_0x3430,0x1d8));var _0x0343=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x3430[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x0343('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0343('0x1'));var jsonpatch=require(_0x0343('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0343('0x3'));var Mustache=require('mustache');var util=require(_0x0343('0x4'));var path=require(_0x0343('0x5'));var sox=require(_0x0343('0x6'));var csv=require('to-csv');var ejs=require(_0x0343('0x7'));var fs=require('fs');var fs_extra=require(_0x0343('0x8'));var _=require('lodash');var squel=require(_0x0343('0x9'));var crypto=require(_0x0343('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0343('0xb'));var Papa=require('papaparse');var Redis=require(_0x0343('0xc'));var authService=require(_0x0343('0xd'));var qs=require(_0x0343('0xe'));var as=require(_0x0343('0xf'));var hardwareService=require(_0x0343('0x10'));var logger=require(_0x0343('0x11'))(_0x0343('0x12'));var utils=require(_0x0343('0x13'));var config=require(_0x0343('0x14'));var licenseUtil=require(_0x0343('0x15'));var db=require(_0x0343('0x16'))['db'];function respondWithStatusCode(_0x2dab76,_0xc8f11f){_0xc8f11f=_0xc8f11f||0xcc;return function(_0x2bcea4){if(_0x2bcea4){return _0x2dab76[_0x0343('0x17')](_0xc8f11f);}return _0x2dab76[_0x0343('0x18')](_0xc8f11f)[_0x0343('0x19')]();};}function respondWithResult(_0x3722fc,_0x3b87e8){_0x3b87e8=_0x3b87e8||0xc8;return function(_0xe75b02){if(_0xe75b02){return _0x3722fc['status'](_0x3b87e8)[_0x0343('0x1a')](_0xe75b02);}};}function respondWithFilteredResult(_0x4e2605,_0x35ec23){return function(_0x4a7d98){if(_0x4a7d98){var _0x8393ad=typeof _0x35ec23['offset']===_0x0343('0x1b')&&typeof _0x35ec23['limit']==='undefined';var _0x37f4f5=_0x4a7d98['count'];var _0x11f3d3=_0x8393ad?0x0:_0x35ec23[_0x0343('0x1c')];var _0x40d357=_0x8393ad?_0x4a7d98[_0x0343('0x1d')]:_0x35ec23[_0x0343('0x1c')]+_0x35ec23[_0x0343('0x1e')];var _0x1a114d;if(_0x40d357>=_0x37f4f5){_0x40d357=_0x37f4f5;_0x1a114d=0xc8;}else{_0x1a114d=0xce;}_0x4e2605[_0x0343('0x18')](_0x1a114d);return _0x4e2605['set'](_0x0343('0x1f'),_0x11f3d3+'-'+_0x40d357+'/'+_0x37f4f5)[_0x0343('0x1a')](_0x4a7d98);}return null;};}function patchUpdates(_0x585a2b){return function(_0x5b0756){try{jsonpatch[_0x0343('0x20')](_0x5b0756,_0x585a2b,!![]);}catch(_0x3ef824){return BPromise[_0x0343('0x21')](_0x3ef824);}return _0x5b0756['save']();};}function saveUpdates(_0x4fc4be,_0x486416){return function(_0xe74bb0){if(_0xe74bb0){return _0xe74bb0[_0x0343('0x22')](_0x4fc4be)[_0x0343('0x23')](function(_0x328220){return _0x328220;});}return null;};}function removeEntity(_0x3170de,_0x58d31c){return function(_0x4a08a5){if(_0x4a08a5){return _0x4a08a5[_0x0343('0x24')]()[_0x0343('0x23')](function(){_0x3170de[_0x0343('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4268f4,_0x222c2c){return function(_0x191fab){if(!_0x191fab){_0x4268f4[_0x0343('0x17')](0x194);}return _0x191fab;};}function handleError(_0x531674,_0x36b88b){_0x36b88b=_0x36b88b||0x1f4;return function(_0x514785){logger['error'](_0x514785[_0x0343('0x25')]);if(_0x514785[_0x0343('0x26')]){delete _0x514785[_0x0343('0x26')];}_0x531674['status'](_0x36b88b)[_0x0343('0x27')](_0x514785);};}exports[_0x0343('0x28')]=function(_0x1bb89c,_0x2bef99){var _0x25dbba={},_0x5bf915={},_0x893b49={'count':0x0,'rows':[]};var _0x4c5892=_['map'](db[_0x0343('0x29')][_0x0343('0x2a')],function(_0x59eadc){return{'name':_0x59eadc['fieldName'],'type':_0x59eadc[_0x0343('0x2b')][_0x0343('0x2c')]};});_0x5bf915[_0x0343('0x2d')]=_[_0x0343('0x2e')](_0x4c5892,_0x0343('0x26'));_0x5bf915[_0x0343('0x2f')]=_[_0x0343('0x30')](_0x1bb89c[_0x0343('0x2f')]);_0x5bf915[_0x0343('0x31')]=_['intersection'](_0x5bf915[_0x0343('0x2d')],_0x5bf915['query']);_0x25dbba['attributes']=_['intersection'](_0x5bf915[_0x0343('0x2d')],qs[_0x0343('0x32')](_0x1bb89c[_0x0343('0x2f')]['fields']));_0x25dbba['attributes']=_0x25dbba['attributes'][_0x0343('0x33')]?_0x25dbba[_0x0343('0x34')]:_0x5bf915[_0x0343('0x2d')];if(!_0x1bb89c[_0x0343('0x2f')][_0x0343('0x35')](_0x0343('0x36'))){_0x25dbba[_0x0343('0x1e')]=qs[_0x0343('0x1e')](_0x1bb89c[_0x0343('0x2f')]['limit']);_0x25dbba[_0x0343('0x1c')]=qs[_0x0343('0x1c')](_0x1bb89c['query']['offset']);}_0x25dbba['order']=qs[_0x0343('0x37')](_0x1bb89c[_0x0343('0x2f')]['sort']);_0x25dbba[_0x0343('0x38')]=qs['filters'](_['pick'](_0x1bb89c[_0x0343('0x2f')],_0x5bf915[_0x0343('0x31')]),_0x4c5892);if(_0x1bb89c[_0x0343('0x2f')][_0x0343('0x39')]){_0x25dbba['where']=_['merge'](_0x25dbba['where'],{'$or':_[_0x0343('0x2e')](_0x4c5892,function(_0x586f9b){if(_0x586f9b[_0x0343('0x2b')]!==_0x0343('0x3a')){var _0x1ab51f={};_0x1ab51f[_0x586f9b[_0x0343('0x26')]]={'$like':'%'+_0x1bb89c['query']['filter']+'%'};return _0x1ab51f;}})});}_0x25dbba=_[_0x0343('0x3b')]({},_0x25dbba,_0x1bb89c[_0x0343('0x3c')]);var _0x2e0d80={'where':_0x25dbba[_0x0343('0x38')]};return db[_0x0343('0x29')][_0x0343('0x1d')](_0x2e0d80)[_0x0343('0x23')](function(_0x289a82){_0x893b49[_0x0343('0x1d')]=_0x289a82;if(_0x1bb89c[_0x0343('0x2f')][_0x0343('0x3d')]){_0x25dbba[_0x0343('0x3e')]=[{'all':!![]}];}return db[_0x0343('0x29')][_0x0343('0x3f')](_0x25dbba);})[_0x0343('0x23')](function(_0xe8fd){_0x893b49[_0x0343('0x40')]=_0xe8fd;return _0x893b49;})[_0x0343('0x23')](respondWithFilteredResult(_0x2bef99,_0x25dbba))[_0x0343('0x41')](handleError(_0x2bef99,null));};exports[_0x0343('0x42')]=function(_0x9af3de,_0x5b9106){var _0x148568={'raw':![],'where':{'id':_0x9af3de[_0x0343('0x43')]['id']}},_0x272663={};_0x272663[_0x0343('0x2d')]=_[_0x0343('0x30')](db['UserProfileSection'][_0x0343('0x2a')]);_0x272663[_0x0343('0x2f')]=_[_0x0343('0x30')](_0x9af3de[_0x0343('0x2f')]);_0x272663[_0x0343('0x31')]=_[_0x0343('0x44')](_0x272663[_0x0343('0x2d')],_0x272663[_0x0343('0x2f')]);_0x148568[_0x0343('0x34')]=_[_0x0343('0x44')](_0x272663[_0x0343('0x2d')],qs[_0x0343('0x32')](_0x9af3de[_0x0343('0x2f')][_0x0343('0x32')]));_0x148568[_0x0343('0x34')]=_0x148568[_0x0343('0x34')][_0x0343('0x33')]?_0x148568[_0x0343('0x34')]:_0x272663[_0x0343('0x2d')];if(_0x9af3de['query'][_0x0343('0x3d')]){_0x148568['include']=[{'all':!![]}];}_0x148568=_[_0x0343('0x3b')]({},_0x148568,_0x9af3de['options']);return db[_0x0343('0x29')][_0x0343('0x45')](_0x148568)[_0x0343('0x23')](handleEntityNotFound(_0x5b9106,null))[_0x0343('0x23')](respondWithResult(_0x5b9106,null))[_0x0343('0x41')](handleError(_0x5b9106,null));};exports[_0x0343('0x46')]=function(_0x16f5e5,_0x8cb808){return db[_0x0343('0x29')][_0x0343('0x46')](_0x16f5e5['body'],{})[_0x0343('0x23')](respondWithResult(_0x8cb808,0xc9))[_0x0343('0x41')](handleError(_0x8cb808,null));};exports[_0x0343('0x22')]=function(_0x53e17d,_0x6b13b4){if(_0x53e17d[_0x0343('0x47')]['id']){delete _0x53e17d[_0x0343('0x47')]['id'];}return db[_0x0343('0x29')][_0x0343('0x45')]({'where':{'id':_0x53e17d[_0x0343('0x43')]['id']}})[_0x0343('0x23')](handleEntityNotFound(_0x6b13b4,null))[_0x0343('0x23')](saveUpdates(_0x53e17d[_0x0343('0x47')],null))[_0x0343('0x23')](respondWithResult(_0x6b13b4,null))[_0x0343('0x41')](handleError(_0x6b13b4,null));};exports[_0x0343('0x24')]=function(_0x36e080,_0x5292c9){return db[_0x0343('0x29')][_0x0343('0x45')]({'where':{'id':_0x36e080[_0x0343('0x43')]['id']}})[_0x0343('0x23')](handleEntityNotFound(_0x5292c9,null))[_0x0343('0x23')](removeEntity(_0x5292c9,null))[_0x0343('0x41')](handleError(_0x5292c9,null));};exports[_0x0343('0x48')]=function(_0x12a7f9,_0x482fd9){return db[_0x0343('0x29')][_0x0343('0x48')]()['then'](respondWithResult(_0x482fd9,null))[_0x0343('0x41')](handleError(_0x482fd9,null));}; \ No newline at end of file +var _0x6ccc=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','UserProfileSection','length','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','jsforce'];(function(_0x4c5fca,_0xeb6b74){var _0x1363ce=function(_0x59d245){while(--_0x59d245){_0x4c5fca['push'](_0x4c5fca['shift']());}};_0x1363ce(++_0xeb6b74);}(_0x6ccc,0x1f4));var _0xc6cc=function(_0x515ae8,_0x2a964f){_0x515ae8=_0x515ae8-0x0;var _0x4cf66a=_0x6ccc[_0x515ae8];return _0x4cf66a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6cc('0x0'));var zipdir=require(_0xc6cc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6cc('0x2'));var moment=require(_0xc6cc('0x3'));var BPromise=require(_0xc6cc('0x4'));var Mustache=require(_0xc6cc('0x5'));var util=require('util');var path=require(_0xc6cc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc6cc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc6cc('0x8'));var crypto=require(_0xc6cc('0x9'));var jsforce=require(_0xc6cc('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6cc('0xb'));var Papa=require(_0xc6cc('0xc'));var Redis=require(_0xc6cc('0xd'));var authService=require(_0xc6cc('0xe'));var qs=require(_0xc6cc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6cc('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc6cc('0x11'));var licenseUtil=require(_0xc6cc('0x12'));var db=require(_0xc6cc('0x13'))['db'];function respondWithStatusCode(_0x14eabe,_0x27f7f7){_0x27f7f7=_0x27f7f7||0xcc;return function(_0x2cf594){if(_0x2cf594){return _0x14eabe[_0xc6cc('0x14')](_0x27f7f7);}return _0x14eabe['status'](_0x27f7f7)[_0xc6cc('0x15')]();};}function respondWithResult(_0x3ff847,_0x5e18c3){_0x5e18c3=_0x5e18c3||0xc8;return function(_0x62c17d){if(_0x62c17d){return _0x3ff847[_0xc6cc('0x16')](_0x5e18c3)[_0xc6cc('0x17')](_0x62c17d);}};}function respondWithFilteredResult(_0x23ff00,_0x18b6a6){return function(_0x5de24e){if(_0x5de24e){var _0x4ae137=typeof _0x18b6a6[_0xc6cc('0x18')]===_0xc6cc('0x19')&&typeof _0x18b6a6[_0xc6cc('0x1a')]==='undefined';var _0x295843=_0x5de24e[_0xc6cc('0x1b')];var _0x3bc6b7=_0x4ae137?0x0:_0x18b6a6[_0xc6cc('0x18')];var _0x123d98=_0x4ae137?_0x5de24e['count']:_0x18b6a6[_0xc6cc('0x18')]+_0x18b6a6[_0xc6cc('0x1a')];var _0x53b6b4;if(_0x123d98>=_0x295843){_0x123d98=_0x295843;_0x53b6b4=0xc8;}else{_0x53b6b4=0xce;}_0x23ff00[_0xc6cc('0x16')](_0x53b6b4);return _0x23ff00[_0xc6cc('0x1c')](_0xc6cc('0x1d'),_0x3bc6b7+'-'+_0x123d98+'/'+_0x295843)[_0xc6cc('0x17')](_0x5de24e);}return null;};}function patchUpdates(_0x3074b6){return function(_0x359368){try{jsonpatch[_0xc6cc('0x1e')](_0x359368,_0x3074b6,!![]);}catch(_0x409c39){return BPromise[_0xc6cc('0x1f')](_0x409c39);}return _0x359368[_0xc6cc('0x20')]();};}function saveUpdates(_0x332266,_0x3c09a5){return function(_0x106479){if(_0x106479){return _0x106479[_0xc6cc('0x21')](_0x332266)[_0xc6cc('0x22')](function(_0x57f3af){return _0x57f3af;});}return null;};}function removeEntity(_0x52affc,_0x5e44cb){return function(_0x317720){if(_0x317720){return _0x317720[_0xc6cc('0x23')]()['then'](function(){_0x52affc[_0xc6cc('0x16')](0xcc)[_0xc6cc('0x15')]();});}};}function handleEntityNotFound(_0x2ab401,_0x1bd8c4){return function(_0x35e115){if(!_0x35e115){_0x2ab401[_0xc6cc('0x14')](0x194);}return _0x35e115;};}function handleError(_0x238596,_0x4d1333){_0x4d1333=_0x4d1333||0x1f4;return function(_0x1e0546){logger[_0xc6cc('0x24')](_0x1e0546['stack']);if(_0x1e0546['name']){delete _0x1e0546['name'];}_0x238596[_0xc6cc('0x16')](_0x4d1333)[_0xc6cc('0x25')](_0x1e0546);};}exports[_0xc6cc('0x26')]=function(_0x116704,_0x2083b5){var _0x577fe2={},_0xa599ee={},_0xad85d={'count':0x0,'rows':[]};var _0x1c3d28=_['map'](db['UserProfileSection'][_0xc6cc('0x27')],function(_0x17a65e){return{'name':_0x17a65e['fieldName'],'type':_0x17a65e[_0xc6cc('0x28')][_0xc6cc('0x29')]};});_0xa599ee[_0xc6cc('0x2a')]=_[_0xc6cc('0x2b')](_0x1c3d28,'name');_0xa599ee[_0xc6cc('0x2c')]=_[_0xc6cc('0x2d')](_0x116704[_0xc6cc('0x2c')]);_0xa599ee['filters']=_[_0xc6cc('0x2e')](_0xa599ee[_0xc6cc('0x2a')],_0xa599ee[_0xc6cc('0x2c')]);_0x577fe2[_0xc6cc('0x2f')]=_[_0xc6cc('0x2e')](_0xa599ee[_0xc6cc('0x2a')],qs[_0xc6cc('0x30')](_0x116704[_0xc6cc('0x2c')]['fields']));_0x577fe2[_0xc6cc('0x2f')]=_0x577fe2['attributes']['length']?_0x577fe2[_0xc6cc('0x2f')]:_0xa599ee[_0xc6cc('0x2a')];if(!_0x116704[_0xc6cc('0x2c')][_0xc6cc('0x31')](_0xc6cc('0x32'))){_0x577fe2[_0xc6cc('0x1a')]=qs['limit'](_0x116704['query']['limit']);_0x577fe2[_0xc6cc('0x18')]=qs[_0xc6cc('0x18')](_0x116704[_0xc6cc('0x2c')][_0xc6cc('0x18')]);}_0x577fe2['order']=qs[_0xc6cc('0x33')](_0x116704['query'][_0xc6cc('0x33')]);_0x577fe2[_0xc6cc('0x34')]=qs['filters'](_[_0xc6cc('0x35')](_0x116704[_0xc6cc('0x2c')],_0xa599ee[_0xc6cc('0x36')]),_0x1c3d28);if(_0x116704[_0xc6cc('0x2c')][_0xc6cc('0x37')]){_0x577fe2[_0xc6cc('0x34')]=_[_0xc6cc('0x38')](_0x577fe2['where'],{'$or':_[_0xc6cc('0x2b')](_0x1c3d28,function(_0xd32cfd){if(_0xd32cfd[_0xc6cc('0x28')]!==_0xc6cc('0x39')){var _0x5abe24={};_0x5abe24[_0xd32cfd[_0xc6cc('0x3a')]]={'$like':'%'+_0x116704[_0xc6cc('0x2c')][_0xc6cc('0x37')]+'%'};return _0x5abe24;}})});}_0x577fe2=_[_0xc6cc('0x38')]({},_0x577fe2,_0x116704[_0xc6cc('0x3b')]);var _0x22b1d7={'where':_0x577fe2['where']};return db['UserProfileSection'][_0xc6cc('0x1b')](_0x22b1d7)[_0xc6cc('0x22')](function(_0x50f4ed){_0xad85d[_0xc6cc('0x1b')]=_0x50f4ed;if(_0x116704[_0xc6cc('0x2c')][_0xc6cc('0x3c')]){_0x577fe2[_0xc6cc('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0xc6cc('0x3e')](_0x577fe2);})[_0xc6cc('0x22')](function(_0x3fcb7b){_0xad85d[_0xc6cc('0x3f')]=_0x3fcb7b;return _0xad85d;})[_0xc6cc('0x22')](respondWithFilteredResult(_0x2083b5,_0x577fe2))[_0xc6cc('0x40')](handleError(_0x2083b5,null));};exports[_0xc6cc('0x41')]=function(_0x223afd,_0x56ec59){var _0x2d5060={'raw':![],'where':{'id':_0x223afd[_0xc6cc('0x42')]['id']}},_0x2c606f={};_0x2c606f[_0xc6cc('0x2a')]=_[_0xc6cc('0x2d')](db[_0xc6cc('0x43')][_0xc6cc('0x27')]);_0x2c606f[_0xc6cc('0x2c')]=_['keys'](_0x223afd[_0xc6cc('0x2c')]);_0x2c606f[_0xc6cc('0x36')]=_[_0xc6cc('0x2e')](_0x2c606f[_0xc6cc('0x2a')],_0x2c606f[_0xc6cc('0x2c')]);_0x2d5060[_0xc6cc('0x2f')]=_[_0xc6cc('0x2e')](_0x2c606f[_0xc6cc('0x2a')],qs[_0xc6cc('0x30')](_0x223afd['query'][_0xc6cc('0x30')]));_0x2d5060[_0xc6cc('0x2f')]=_0x2d5060['attributes'][_0xc6cc('0x44')]?_0x2d5060[_0xc6cc('0x2f')]:_0x2c606f[_0xc6cc('0x2a')];if(_0x223afd['query'][_0xc6cc('0x3c')]){_0x2d5060['include']=[{'all':!![]}];}_0x2d5060=_[_0xc6cc('0x38')]({},_0x2d5060,_0x223afd[_0xc6cc('0x3b')]);return db[_0xc6cc('0x43')][_0xc6cc('0x45')](_0x2d5060)[_0xc6cc('0x22')](handleEntityNotFound(_0x56ec59,null))[_0xc6cc('0x22')](respondWithResult(_0x56ec59,null))['catch'](handleError(_0x56ec59,null));};exports[_0xc6cc('0x46')]=function(_0x3bb345,_0x2bc741){return db[_0xc6cc('0x43')][_0xc6cc('0x46')](_0x3bb345[_0xc6cc('0x47')],{})['then'](respondWithResult(_0x2bc741,0xc9))[_0xc6cc('0x40')](handleError(_0x2bc741,null));};exports['update']=function(_0x5579a8,_0x228320){if(_0x5579a8[_0xc6cc('0x47')]['id']){delete _0x5579a8['body']['id'];}return db['UserProfileSection'][_0xc6cc('0x45')]({'where':{'id':_0x5579a8['params']['id']}})[_0xc6cc('0x22')](handleEntityNotFound(_0x228320,null))[_0xc6cc('0x22')](saveUpdates(_0x5579a8['body'],null))[_0xc6cc('0x22')](respondWithResult(_0x228320,null))['catch'](handleError(_0x228320,null));};exports['destroy']=function(_0x3f88b8,_0x44126f){return db[_0xc6cc('0x43')][_0xc6cc('0x45')]({'where':{'id':_0x3f88b8[_0xc6cc('0x42')]['id']}})[_0xc6cc('0x22')](handleEntityNotFound(_0x44126f,null))[_0xc6cc('0x22')](removeEntity(_0x44126f,null))[_0xc6cc('0x40')](handleError(_0x44126f,null));};exports[_0xc6cc('0x48')]=function(_0xdf37d1,_0x1ad798){return db[_0xc6cc('0x43')][_0xc6cc('0x48')]()[_0xc6cc('0x22')](respondWithResult(_0x1ad798,null))[_0xc6cc('0x40')](handleError(_0x1ad798,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2a6c2f8..c953284 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 _0x4c5c=['request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x557273,_0x544976){var _0x2baa9b=function(_0xc4c3a4){while(--_0xc4c3a4){_0x557273['push'](_0x557273['shift']());}};_0x2baa9b(++_0x544976);}(_0x4c5c,0xb5));var _0xc4c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4c5('0x0'));var util=require(_0xc4c5('0x1'));var logger=require(_0xc4c5('0x2'))(_0xc4c5('0x3'));var moment=require(_0xc4c5('0x4'));var BPromise=require(_0xc4c5('0x5'));var rp=require(_0xc4c5('0x6'));var fs=require('fs');var path=require(_0xc4c5('0x7'));var rimraf=require(_0xc4c5('0x8'));var config=require(_0xc4c5('0x9'));var attributes=require(_0xc4c5('0xa'));module[_0xc4c5('0xb')]=function(_0x2c55ba,_0xd348b6){return _0x2c55ba[_0xc4c5('0xc')](_0xc4c5('0xd'),attributes,{'tableName':_0xc4c5('0xe'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc4c5('0xf'),_0xc4c5('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa828=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','api'];(function(_0x13d2d6,_0x3a9c4d){var _0x474051=function(_0x40a916){while(--_0x40a916){_0x13d2d6['push'](_0x13d2d6['shift']());}};_0x474051(++_0x3a9c4d);}(_0xa828,0xc1));var _0x8a82=function(_0xdddac,_0x511e95){_0xdddac=_0xdddac-0x0;var _0x518892=_0xa828[_0xdddac];return _0x518892;};'use strict';var _=require('lodash');var util=require(_0x8a82('0x0'));var logger=require(_0x8a82('0x1'))(_0x8a82('0x2'));var moment=require(_0x8a82('0x3'));var BPromise=require(_0x8a82('0x4'));var rp=require(_0x8a82('0x5'));var fs=require('fs');var path=require(_0x8a82('0x6'));var rimraf=require(_0x8a82('0x7'));var config=require(_0x8a82('0x8'));var attributes=require(_0x8a82('0x9'));module[_0x8a82('0xa')]=function(_0x5b86b3,_0x5e571e){return _0x5b86b3['define']('UserProfileSection',attributes,{'tableName':_0x8a82('0xb'),'paranoid':![],'indexes':[{'name':_0x8a82('0xc'),'fields':['sectionId',_0x8a82('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 20d6fe0..2dc1550 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 _0x64ee=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x53da50,_0x2b4efc){var _0x365cb3=function(_0x2a7313){while(--_0x2a7313){_0x53da50['push'](_0x53da50['shift']());}};_0x365cb3(++_0x2b4efc);}(_0x64ee,0x87));var _0xe64e=function(_0x48c9fc,_0x1d86fa){_0x48c9fc=_0x48c9fc-0x0;var _0xf03afd=_0x64ee[_0x48c9fc];return _0xf03afd;};'use strict';var _=require(_0xe64e('0x0'));var util=require('util');var moment=require(_0xe64e('0x1'));var BPromise=require(_0xe64e('0x2'));var rs=require(_0xe64e('0x3'));var fs=require('fs');var Redis=require(_0xe64e('0x4'));var db=require(_0xe64e('0x5'))['db'];var utils=require(_0xe64e('0x6'));var logger=require('../../config/logger')(_0xe64e('0x7'));var config=require('../../config/environment');var jayson=require(_0xe64e('0x8'));var client=jayson[_0xe64e('0x9')][_0xe64e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x62277,_0x6de30d,_0x1e0fed){return new BPromise(function(_0x2bce6d,_0x50aa42){return client['request'](_0x62277,_0x1e0fed)['then'](function(_0x22254b){logger[_0xe64e('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x6de30d,_0xe64e('0xc'));logger[_0xe64e('0xd')](_0xe64e('0xe'),_0x6de30d,_0xe64e('0xc'),JSON[_0xe64e('0xf')](_0x22254b));if(_0x22254b[_0xe64e('0x10')]){if(_0x22254b['error'][_0xe64e('0x11')]===0x1f4){logger[_0xe64e('0x10')](_0xe64e('0x12'),_0x6de30d,_0x22254b[_0xe64e('0x10')]['message']);return _0x50aa42(_0x22254b[_0xe64e('0x10')][_0xe64e('0x13')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x6de30d,_0x22254b[_0xe64e('0x10')][_0xe64e('0x13')]);return _0x2bce6d(_0x22254b['error'][_0xe64e('0x13')]);}else{logger[_0xe64e('0xb')](_0xe64e('0x12'),_0x6de30d,'request\x20sent');_0x2bce6d(_0x22254b['result'][_0xe64e('0x13')]);}})['catch'](function(_0x5b06ec){logger[_0xe64e('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x6de30d,_0x5b06ec);_0x50aa42(_0x5b06ec);});});} \ No newline at end of file +var _0x0899=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x2371f2,_0x2bdf5f){var _0x3fc0bd=function(_0x3bef58){while(--_0x3bef58){_0x2371f2['push'](_0x2371f2['shift']());}};_0x3fc0bd(++_0x2bdf5f);}(_0x0899,0x183));var _0x9089=function(_0x36b886,_0x349b28){_0x36b886=_0x36b886-0x0;var _0x51d44b=_0x0899[_0x36b886];return _0x51d44b;};'use strict';var _=require(_0x9089('0x0'));var util=require(_0x9089('0x1'));var moment=require(_0x9089('0x2'));var BPromise=require(_0x9089('0x3'));var rs=require(_0x9089('0x4'));var fs=require('fs');var Redis=require(_0x9089('0x5'));var db=require(_0x9089('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9089('0x7'))(_0x9089('0x8'));var config=require(_0x9089('0x9'));var jayson=require(_0x9089('0xa'));var client=jayson['client'][_0x9089('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50bc60,_0x545db2,_0x533e67){return new BPromise(function(_0x2a9f13,_0x880f82){return client[_0x9089('0xc')](_0x50bc60,_0x533e67)[_0x9089('0xd')](function(_0x502526){logger['info'](_0x9089('0xe'),_0x545db2,'request\x20sent');logger[_0x9089('0xf')](_0x9089('0x10'),_0x545db2,_0x9089('0x11'),JSON[_0x9089('0x12')](_0x502526));if(_0x502526[_0x9089('0x13')]){if(_0x502526[_0x9089('0x13')]['code']===0x1f4){logger[_0x9089('0x13')](_0x9089('0xe'),_0x545db2,_0x502526[_0x9089('0x13')][_0x9089('0x14')]);return _0x880f82(_0x502526[_0x9089('0x13')][_0x9089('0x14')]);}logger[_0x9089('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x545db2,_0x502526[_0x9089('0x13')][_0x9089('0x14')]);return _0x2a9f13(_0x502526[_0x9089('0x13')][_0x9089('0x14')]);}else{logger[_0x9089('0x15')]('UserProfileSection,\x20%s,\x20%s',_0x545db2,_0x9089('0x11'));_0x2a9f13(_0x502526['result']['message']);}})[_0x9089('0x16')](function(_0x3391f8){logger['error'](_0x9089('0xe'),_0x545db2,_0x3391f8);_0x880f82(_0x3391f8);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 70b7e94..0da427f 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x493791,_0x42c7e6){var _0x202307=function(_0x2a9800){while(--_0x2a9800){_0x493791['push'](_0x493791['shift']());}};_0x202307(++_0x42c7e6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x24d982,_0x1d638b){var _0x2441c4=function(_0x290e43){while(--_0x290e43){_0x24d982['push'](_0x24d982['shift']());}};_0x2441c4(++_0x1d638b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 423664a..0d18adf 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 _0xbc58=['exports','INTEGER','sequelize'];(function(_0x1a7417,_0x5874bf){var _0x19fa30=function(_0x2c6749){while(--_0x2c6749){_0x1a7417['push'](_0x1a7417['shift']());}};_0x19fa30(++_0x5874bf);}(_0xbc58,0x1b2));var _0x8bc5=function(_0x1c9293,_0x132e4b){_0x1c9293=_0x1c9293-0x0;var _0x30a78b=_0xbc58[_0x1c9293];return _0x30a78b;};'use strict';var Sequelize=require(_0x8bc5('0x0'));module[_0x8bc5('0x1')]={'penalty':{'type':Sequelize[_0x8bc5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x28aa=['exports','INTEGER'];(function(_0x121fa1,_0x46d3ae){var _0x94d512=function(_0x15824f){while(--_0x15824f){_0x121fa1['push'](_0x121fa1['shift']());}};_0x94d512(++_0x46d3ae);}(_0x28aa,0xf8));var _0xa28a=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x28aa[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require('sequelize');module[_0xa28a('0x0')]={'penalty':{'type':Sequelize[_0xa28a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 11c3d8a..d8b9e09 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 _0xf40b=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment'];(function(_0x497d31,_0x3f7178){var _0x86dff4=function(_0x54a053){while(--_0x54a053){_0x497d31['push'](_0x497d31['shift']());}};_0x86dff4(++_0x3f7178);}(_0xf40b,0xb0));var _0xbf40=function(_0x277fda,_0x57df6e){_0x277fda=_0x277fda-0x0;var _0x34475a=_0xf40b[_0x277fda];return _0x34475a;};'use strict';var _=require('lodash');var util=require(_0xbf40('0x0'));var logger=require(_0xbf40('0x1'))(_0xbf40('0x2'));var moment=require(_0xbf40('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf40('0x4'));var fs=require('fs');var path=require(_0xbf40('0x5'));var rimraf=require(_0xbf40('0x6'));var config=require(_0xbf40('0x7'));var attributes=require(_0xbf40('0x8'));module['exports']=function(_0x2e74b5,_0xbe1c47){return _0x2e74b5[_0xbf40('0x9')](_0xbf40('0xa'),attributes,{'tableName':_0xbf40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x33e075,_0x28d84d){var _0xc0f143=function(_0x706f0b){while(--_0x706f0b){_0x33e075['push'](_0x33e075['shift']());}};_0xc0f143(++_0x28d84d);}(_0xdb28,0x106));var _0x8db2=function(_0x5e5f84,_0x230c17){_0x5e5f84=_0x5e5f84-0x0;var _0x5dcd2e=_0xdb28[_0x5e5f84];return _0x5dcd2e;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('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 6038745..c62bf86 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 _0x91a5=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x91a5,0x187));var _0x591a=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x91a5[_0x4a5f6c];return _0x281ffd;};'use strict';var _=require(_0x591a('0x0'));var util=require(_0x591a('0x1'));var moment=require('moment');var BPromise=require(_0x591a('0x2'));var rs=require(_0x591a('0x3'));var fs=require('fs');var Redis=require(_0x591a('0x4'));var db=require(_0x591a('0x5'))['db'];var utils=require(_0x591a('0x6'));var logger=require(_0x591a('0x7'))('rpc');var config=require(_0x591a('0x8'));var jayson=require(_0x591a('0x9'));var client=jayson[_0x591a('0xa')][_0x591a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d1b7,_0x51e999,_0x856414){return new BPromise(function(_0x13bf44,_0x3afd2b){return client[_0x591a('0xc')](_0x37d1b7,_0x856414)['then'](function(_0x2811b1){logger[_0x591a('0xd')](_0x591a('0xe'),_0x51e999,'request\x20sent');logger[_0x591a('0xf')](_0x591a('0x10'),_0x51e999,_0x591a('0x11'),JSON[_0x591a('0x12')](_0x2811b1));if(_0x2811b1[_0x591a('0x13')]){if(_0x2811b1['error']['code']===0x1f4){logger[_0x591a('0x13')](_0x591a('0xe'),_0x51e999,_0x2811b1['error'][_0x591a('0x14')]);return _0x3afd2b(_0x2811b1['error']['message']);}logger[_0x591a('0x13')](_0x591a('0xe'),_0x51e999,_0x2811b1['error'][_0x591a('0x14')]);return _0x13bf44(_0x2811b1[_0x591a('0x13')][_0x591a('0x14')]);}else{logger['info'](_0x591a('0xe'),_0x51e999,_0x591a('0x11'));_0x13bf44(_0x2811b1[_0x591a('0x15')][_0x591a('0x14')]);}})['catch'](function(_0x461079){logger[_0x591a('0x13')](_0x591a('0xe'),_0x51e999,_0x461079);_0x3afd2b(_0x461079);});});} \ No newline at end of file +var _0xeda6=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4d8496,_0x55e4fd){var _0x3bf9ef=function(_0x7cfe89){while(--_0x7cfe89){_0x4d8496['push'](_0x4d8496['shift']());}};_0x3bf9ef(++_0x55e4fd);}(_0xeda6,0x135));var _0x6eda=function(_0x174d5f,_0x30c6ec){_0x174d5f=_0x174d5f-0x0;var _0x4c6f15=_0xeda6[_0x174d5f];return _0x4c6f15;};'use strict';var _=require(_0x6eda('0x0'));var util=require('util');var moment=require(_0x6eda('0x1'));var BPromise=require(_0x6eda('0x2'));var rs=require(_0x6eda('0x3'));var fs=require('fs');var Redis=require(_0x6eda('0x4'));var db=require(_0x6eda('0x5'))['db'];var utils=require(_0x6eda('0x6'));var logger=require(_0x6eda('0x7'))(_0x6eda('0x8'));var config=require(_0x6eda('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eda('0xa')][_0x6eda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bdc58,_0x33b23a,_0x57f7ed){return new BPromise(function(_0x57f88a,_0x2ace4e){return client[_0x6eda('0xc')](_0x3bdc58,_0x57f7ed)[_0x6eda('0xd')](function(_0x229b6c){logger[_0x6eda('0xe')](_0x6eda('0xf'),_0x33b23a,_0x6eda('0x10'));logger['debug'](_0x6eda('0x11'),_0x33b23a,_0x6eda('0x10'),JSON[_0x6eda('0x12')](_0x229b6c));if(_0x229b6c[_0x6eda('0x13')]){if(_0x229b6c['error'][_0x6eda('0x14')]===0x1f4){logger['error'](_0x6eda('0xf'),_0x33b23a,_0x229b6c[_0x6eda('0x13')]['message']);return _0x2ace4e(_0x229b6c[_0x6eda('0x13')]['message']);}logger[_0x6eda('0x13')](_0x6eda('0xf'),_0x33b23a,_0x229b6c[_0x6eda('0x13')]['message']);return _0x57f88a(_0x229b6c['error'][_0x6eda('0x15')]);}else{logger[_0x6eda('0xe')](_0x6eda('0xf'),_0x33b23a,_0x6eda('0x10'));_0x57f88a(_0x229b6c['result']['message']);}})[_0x6eda('0x16')](function(_0x5a6ace){logger[_0x6eda('0x13')](_0x6eda('0xf'),_0x33b23a,_0x5a6ace);_0x2ace4e(_0x5a6ace);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 2e4761a..f7cfc8e 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 _0xb172=['INTEGER','sequelize','exports'];(function(_0xf60584,_0x3ed18e){var _0x501f90=function(_0x41b0c1){while(--_0x41b0c1){_0xf60584['push'](_0xf60584['shift']());}};_0x501f90(++_0x3ed18e);}(_0xb172,0x76));var _0x2b17=function(_0x582555,_0x3ec1ea){_0x582555=_0x582555-0x0;var _0x8a354c=_0xb172[_0x582555];return _0x8a354c;};'use strict';var Sequelize=require(_0x2b17('0x0'));module[_0x2b17('0x1')]={'UserId':{'type':Sequelize[_0x2b17('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2b17('0x2')]}}; \ No newline at end of file +var _0x0166=['sequelize','exports','INTEGER'];(function(_0x4d2ed7,_0x1999e5){var _0x12af27=function(_0x28e2d4){while(--_0x28e2d4){_0x4d2ed7['push'](_0x4d2ed7['shift']());}};_0x12af27(++_0x1999e5);}(_0x0166,0x102));var _0x6016=function(_0x5ca9d3,_0x104ff8){_0x5ca9d3=_0x5ca9d3-0x0;var _0x33b520=_0x0166[_0x5ca9d3];return _0x33b520;};'use strict';var Sequelize=require(_0x6016('0x0'));module[_0x6016('0x1')]={'UserId':{'type':Sequelize[_0x6016('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 23e9c0b..161137e 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(_0xd128eb,_0x4c2b6b){var _0x1a65f2=function(_0x4edfd1){while(--_0x4edfd1){_0xd128eb['push'](_0xd128eb['shift']());}};_0x1a65f2(++_0x4c2b6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0xa78862,_0x4dfe39){var _0x15b69=function(_0x9dc696){while(--_0x9dc696){_0xa78862['push'](_0xa78862['shift']());}};_0x15b69(++_0x4dfe39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 c3000c9..f259a7d 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x283ce1,_0x52f230){var _0xda31d8=function(_0x3762b8){while(--_0x3762b8){_0x283ce1['push'](_0x283ce1['shift']());}};_0xda31d8(++_0x52f230);}(_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(_0x34fe88,_0x36a469){var _0x3d6cd0=function(_0x3e4fea){while(--_0x3e4fea){_0x34fe88['push'](_0x34fe88['shift']());}};_0x3d6cd0(++_0x36a469);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 80fe944..d858033 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 _0xb550=['exports','sequelize'];(function(_0x5e32cb,_0x4a7d72){var _0x118b5d=function(_0x2eeaa4){while(--_0x2eeaa4){_0x5e32cb['push'](_0x5e32cb['shift']());}};_0x118b5d(++_0x4a7d72);}(_0xb550,0x183));var _0x0b55=function(_0x5185d0,_0x3dd800){_0x5185d0=_0x5185d0-0x0;var _0x5432ec=_0xb550[_0x5185d0];return _0x5432ec;};'use strict';var Sequelize=require(_0x0b55('0x0'));module[_0x0b55('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8b50=['INTEGER','sequelize','exports'];(function(_0x2041c5,_0x15ef7e){var _0x3cfb70=function(_0x136778){while(--_0x136778){_0x2041c5['push'](_0x2041c5['shift']());}};_0x3cfb70(++_0x15ef7e);}(_0x8b50,0x13f));var _0x08b5=function(_0xf6b0fe,_0x4281f7){_0xf6b0fe=_0xf6b0fe-0x0;var _0x5f4610=_0x8b50[_0xf6b0fe];return _0x5f4610;};'use strict';var Sequelize=require(_0x08b5('0x0'));module[_0x08b5('0x1')]={'penalty':{'type':Sequelize[_0x08b5('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 4506d64..ce4eaa6 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 _0x72e8=['rimraf','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','request-promise','path'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x72e8,0x123));var _0x872e=function(_0xdffa09,_0xf565b6){_0xdffa09=_0xdffa09-0x0;var _0x5272e8=_0x72e8[_0xdffa09];return _0x5272e8;};'use strict';var _=require(_0x872e('0x0'));var util=require(_0x872e('0x1'));var logger=require('../../config/logger')(_0x872e('0x2'));var moment=require(_0x872e('0x3'));var BPromise=require('bluebird');var rp=require(_0x872e('0x4'));var fs=require('fs');var path=require(_0x872e('0x5'));var rimraf=require(_0x872e('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x872e('0x7')]=function(_0x59f6e9,_0x4922cd){return _0x59f6e9[_0x872e('0x8')](_0x872e('0x9'),attributes,{'tableName':_0x872e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95dc=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x356076,_0x1bd264){var _0xba48a9=function(_0x287daf){while(--_0x287daf){_0x356076['push'](_0x356076['shift']());}};_0xba48a9(++_0x1bd264);}(_0x95dc,0x1d9));var _0xc95d=function(_0x3ba0af,_0xccb8a1){_0x3ba0af=_0x3ba0af-0x0;var _0x650db7=_0x95dc[_0x3ba0af];return _0x650db7;};'use strict';var _=require(_0xc95d('0x0'));var util=require(_0xc95d('0x1'));var logger=require(_0xc95d('0x2'))(_0xc95d('0x3'));var moment=require(_0xc95d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc95d('0x5'));var rimraf=require(_0xc95d('0x6'));var config=require('../../config/environment');var attributes=require(_0xc95d('0x7'));module[_0xc95d('0x8')]=function(_0xf1fc6,_0x278642){return _0xf1fc6[_0xc95d('0x9')](_0xc95d('0xa'),attributes,{'tableName':_0xc95d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 86eacaf..94b97c8 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 _0x56ab=['then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../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);}(_0x56ab,0x195));var _0xb56a=function(_0x1d7d79,_0x59b674){_0x1d7d79=_0x1d7d79-0x0;var _0x3cc995=_0x56ab[_0x1d7d79];return _0x3cc995;};'use strict';var _=require('lodash');var util=require(_0xb56a('0x0'));var moment=require(_0xb56a('0x1'));var BPromise=require(_0xb56a('0x2'));var rs=require(_0xb56a('0x3'));var fs=require('fs');var Redis=require(_0xb56a('0x4'));var db=require(_0xb56a('0x5'))['db'];var utils=require(_0xb56a('0x6'));var logger=require(_0xb56a('0x7'))(_0xb56a('0x8'));var config=require(_0xb56a('0x9'));var jayson=require(_0xb56a('0xa'));var client=jayson[_0xb56a('0xb')][_0xb56a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x224106,_0x8ed8cb,_0x3efb66){return new BPromise(function(_0x3e283e,_0x9e200f){return client['request'](_0x224106,_0x3efb66)[_0xb56a('0xd')](function(_0x93f715){logger[_0xb56a('0xe')](_0xb56a('0xf'),_0x8ed8cb,'request\x20sent');logger[_0xb56a('0x10')](_0xb56a('0x11'),_0x8ed8cb,'request\x20sent',JSON[_0xb56a('0x12')](_0x93f715));if(_0x93f715['error']){if(_0x93f715[_0xb56a('0x13')]['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x8ed8cb,_0x93f715['error']['message']);return _0x9e200f(_0x93f715['error'][_0xb56a('0x14')]);}logger['error'](_0xb56a('0xf'),_0x8ed8cb,_0x93f715[_0xb56a('0x13')][_0xb56a('0x14')]);return _0x3e283e(_0x93f715[_0xb56a('0x13')][_0xb56a('0x14')]);}else{logger[_0xb56a('0xe')](_0xb56a('0xf'),_0x8ed8cb,_0xb56a('0x15'));_0x3e283e(_0x93f715['result']['message']);}})['catch'](function(_0x1240b5){logger['error'](_0xb56a('0xf'),_0x8ed8cb,_0x1240b5);_0x9e200f(_0x1240b5);});});} \ No newline at end of file +var _0xe56f=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','info','result','catch'];(function(_0x2a98e3,_0x488997){var _0x370a71=function(_0x3b71cb){while(--_0x3b71cb){_0x2a98e3['push'](_0x2a98e3['shift']());}};_0x370a71(++_0x488997);}(_0xe56f,0x1ce));var _0xfe56=function(_0x432c74,_0x49d10b){_0x432c74=_0x432c74-0x0;var _0x35709f=_0xe56f[_0x432c74];return _0x35709f;};'use strict';var _=require(_0xfe56('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfe56('0x1'));var rs=require(_0xfe56('0x2'));var fs=require('fs');var Redis=require(_0xfe56('0x3'));var db=require(_0xfe56('0x4'))['db'];var utils=require(_0xfe56('0x5'));var logger=require(_0xfe56('0x6'))(_0xfe56('0x7'));var config=require(_0xfe56('0x8'));var jayson=require(_0xfe56('0x9'));var client=jayson[_0xfe56('0xa')][_0xfe56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd5598e,_0x3e6afb,_0x29214a){return new BPromise(function(_0xfca08b,_0xed728a){return client['request'](_0xd5598e,_0x29214a)[_0xfe56('0xc')](function(_0x1057fc){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3e6afb,_0xfe56('0xd'));logger[_0xfe56('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3e6afb,_0xfe56('0xd'),JSON[_0xfe56('0xf')](_0x1057fc));if(_0x1057fc[_0xfe56('0x10')]){if(_0x1057fc[_0xfe56('0x10')]['code']===0x1f4){logger[_0xfe56('0x10')](_0xfe56('0x11'),_0x3e6afb,_0x1057fc[_0xfe56('0x10')][_0xfe56('0x12')]);return _0xed728a(_0x1057fc[_0xfe56('0x10')][_0xfe56('0x12')]);}logger['error'](_0xfe56('0x11'),_0x3e6afb,_0x1057fc[_0xfe56('0x10')][_0xfe56('0x12')]);return _0xfca08b(_0x1057fc[_0xfe56('0x10')]['message']);}else{logger[_0xfe56('0x13')](_0xfe56('0x11'),_0x3e6afb,_0xfe56('0xd'));_0xfca08b(_0x1057fc[_0xfe56('0x14')]['message']);}})[_0xfe56('0x15')](function(_0x1c8cfa){logger[_0xfe56('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x3e6afb,_0x1c8cfa);_0xed728a(_0x1c8cfa);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8df2066..5bb84b8 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(_0x39c44a,_0xe7b2b9){var _0x3f053c=function(_0x33111f){while(--_0x33111f){_0x39c44a['push'](_0x39c44a['shift']());}};_0x3f053c(++_0xe7b2b9);}(_0x70e0,0x17b));var _0x070e=function(_0x1bdb05,_0x394903){_0x1bdb05=_0x1bdb05-0x0;var _0x17e515=_0x70e0[_0x1bdb05];return _0x17e515;};'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(_0x3721da,_0x2d70a6){var _0x16ae2e=function(_0x24e24f){while(--_0x24e24f){_0x3721da['push'](_0x3721da['shift']());}};_0x16ae2e(++_0x2d70a6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0xcb91[_0x455150];return _0x12ca9c;};'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 2f3cf69..c884dd4 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 _0x0505=['INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x0505,0x13f));var _0x5050=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0505[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5050('0x0')},'membername':{'type':Sequelize[_0x5050('0x1')],'allowNull':![],'comment':_0x5050('0x0')},'UserId':{'type':Sequelize[_0x5050('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5050('0x1')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x5050('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5050('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0x5050('0x0')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x5050('0x0')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xde0f=['STRING','queue_interface','INTEGER','Required\x20by\x20Asterisk'];(function(_0x4389f6,_0x11f2b9){var _0x583c3d=function(_0x344583){while(--_0x344583){_0x4389f6['push'](_0x4389f6['shift']());}};_0x583c3d(++_0x11f2b9);}(_0xde0f,0xa2));var _0xfde0=function(_0x446bf7,_0x25d430){_0x446bf7=_0x446bf7-0x0;var _0x57640e=_0xde0f[_0x446bf7];return _0x57640e;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfde0('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xfde0('0x1')},'membername':{'type':Sequelize[_0xfde0('0x2')],'allowNull':![],'comment':_0xfde0('0x1')},'UserId':{'type':Sequelize[_0xfde0('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfde0('0x3'),'comment':_0xfde0('0x1')},'VoiceQueueId':{'type':Sequelize[_0xfde0('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0xfde0('0x2')],'allowNull':![],'unique':_0xfde0('0x3'),'comment':_0xfde0('0x1')},'penalty':{'type':Sequelize[_0xfde0('0x0')](0xb),'defaultValue':0x0,'comment':_0xfde0('0x1')},'paused':{'type':Sequelize[_0xfde0('0x0')](0xb),'defaultValue':0x0,'comment':_0xfde0('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4d34601..e878f4c 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 _0xcb56=['hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','save','update','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcb56,0xe1));var _0x6cb5=function(_0x2e6169,_0x1b9a5c){_0x2e6169=_0x2e6169-0x0;var _0x43b22f=_0xcb56[_0x2e6169];return _0x43b22f;};'use strict';var EventEmitter=require(_0x6cb5('0x0'));var UserVoiceQueueRt=require(_0x6cb5('0x1'))['db'][_0x6cb5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cb5('0x3'),'afterUpdate':_0x6cb5('0x4'),'afterDestroy':_0x6cb5('0x5')};function emitEvent(_0x403e7e){return function(_0x38ac62,_0x152323,_0x43fe0f){UserVoiceQueueRtEvents['emit'](_0x403e7e+':'+_0x38ac62['id'],_0x38ac62);UserVoiceQueueRtEvents['emit'](_0x403e7e,_0x38ac62);_0x43fe0f(null);};}for(var e in events){if(events[_0x6cb5('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xad5a=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit'];(function(_0x3fc773,_0x3f9139){var _0x39ab69=function(_0x35d6a1){while(--_0x35d6a1){_0x3fc773['push'](_0x3fc773['shift']());}};_0x39ab69(++_0x3f9139);}(_0xad5a,0x1bb));var _0xaad5=function(_0x2232fc,_0x3a0ddc){_0x2232fc=_0x2232fc-0x0;var _0x30f50c=_0xad5a[_0x2232fc];return _0x30f50c;};'use strict';var EventEmitter=require(_0xaad5('0x0'));var UserVoiceQueueRt=require(_0xaad5('0x1'))['db'][_0xaad5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xaad5('0x3')](0x0);var events={'afterCreate':_0xaad5('0x4'),'afterUpdate':_0xaad5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x47d91d){return function(_0x2ca2a7,_0x7c5a58,_0x3a2251){UserVoiceQueueRtEvents[_0xaad5('0x6')](_0x47d91d+':'+_0x2ca2a7['id'],_0x2ca2a7);UserVoiceQueueRtEvents[_0xaad5('0x6')](_0x47d91d,_0x2ca2a7);_0x3a2251(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xaad5('0x7')](e,emitEvent(event));}}module[_0xaad5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index b84f8f6..a561767 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 _0x45f3=['user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserVoiceQueueRt'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x45f3,0x169));var _0x345f=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x45f3[_0x5a5395];return _0x4da43d;};'use strict';var _=require(_0x345f('0x0'));var util=require(_0x345f('0x1'));var logger=require(_0x345f('0x2'))('api');var moment=require(_0x345f('0x3'));var BPromise=require(_0x345f('0x4'));var rp=require(_0x345f('0x5'));var fs=require('fs');var path=require(_0x345f('0x6'));var rimraf=require(_0x345f('0x7'));var config=require(_0x345f('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x345f('0x9')]=function(_0x124037,_0x3a8d09){return _0x124037['define'](_0x345f('0xa'),attributes,{'tableName':_0x345f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e87=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x174188,_0x5b300e){var _0x119761=function(_0x50ea8d){while(--_0x50ea8d){_0x174188['push'](_0x174188['shift']());}};_0x119761(++_0x5b300e);}(_0x7e87,0xf7));var _0x77e8=function(_0x5359cc,_0x463f20){_0x5359cc=_0x5359cc-0x0;var _0x2b3c99=_0x7e87[_0x5359cc];return _0x2b3c99;};'use strict';var _=require(_0x77e8('0x0'));var util=require('util');var logger=require(_0x77e8('0x1'))(_0x77e8('0x2'));var moment=require(_0x77e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x77e8('0x4'));var config=require(_0x77e8('0x5'));var attributes=require(_0x77e8('0x6'));module[_0x77e8('0x7')]=function(_0x3ee48e,_0x15146d){return _0x3ee48e[_0x77e8('0x8')](_0x77e8('0x9'),attributes,{'tableName':_0x77e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1c4cbb6..171ec8a 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 _0x1dd3=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x4ed1ab,_0x2915eb){var _0x1107d6=function(_0x5b04af){while(--_0x5b04af){_0x4ed1ab['push'](_0x4ed1ab['shift']());}};_0x1107d6(++_0x2915eb);}(_0x1dd3,0x1c8));var _0x31dd=function(_0x3fb256,_0xa066af){_0x3fb256=_0x3fb256-0x0;var _0x1ca90f=_0x1dd3[_0x3fb256];return _0x1ca90f;};'use strict';var _=require(_0x31dd('0x0'));var util=require('util');var moment=require(_0x31dd('0x1'));var BPromise=require(_0x31dd('0x2'));var rs=require(_0x31dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x31dd('0x4'))(_0x31dd('0x5'));var config=require(_0x31dd('0x6'));var jayson=require(_0x31dd('0x7'));var client=jayson[_0x31dd('0x8')]['http']({'port':0x232a});config[_0x31dd('0x9')]=_[_0x31dd('0xa')](config[_0x31dd('0x9')],{'host':_0x31dd('0xb'),'port':0x18eb});var socket=require(_0x31dd('0xc'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x31dd('0xd')](socket);function respondWithRpcPromise(_0x4ca70a,_0x23d005,_0x571524){return new BPromise(function(_0x7dca93,_0x1b4ef5){return client['request'](_0x4ca70a,_0x571524)[_0x31dd('0xe')](function(_0x3d30d5){logger[_0x31dd('0xf')](_0x31dd('0x10'),_0x23d005,_0x31dd('0x11'));logger[_0x31dd('0x12')](_0x31dd('0x13'),_0x23d005,_0x31dd('0x11'),JSON[_0x31dd('0x14')](_0x3d30d5));if(_0x3d30d5[_0x31dd('0x15')]){if(_0x3d30d5['error'][_0x31dd('0x16')]===0x1f4){logger['error'](_0x31dd('0x10'),_0x23d005,_0x3d30d5[_0x31dd('0x15')]['message']);return _0x1b4ef5(_0x3d30d5[_0x31dd('0x15')]['message']);}logger[_0x31dd('0x15')](_0x31dd('0x10'),_0x23d005,_0x3d30d5[_0x31dd('0x15')][_0x31dd('0x17')]);return _0x7dca93(_0x3d30d5[_0x31dd('0x15')][_0x31dd('0x17')]);}else{logger[_0x31dd('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x23d005,_0x31dd('0x11'));_0x7dca93(_0x3d30d5[_0x31dd('0x18')][_0x31dd('0x17')]);}})[_0x31dd('0x19')](function(_0x44d8d8){logger[_0x31dd('0x15')](_0x31dd('0x10'),_0x23d005,_0x44d8d8);_0x1b4ef5(_0x44d8d8);});});}exports[_0x31dd('0x1a')]=function(_0x367e0d){var _0x576975=this;return new Promise(function(_0x4ce190,_0x5bee30){return db[_0x31dd('0x1b')]['findAll']({'raw':_0x367e0d[_0x31dd('0x1c')]?_0x367e0d['options'][_0x31dd('0x1d')]===undefined?!![]:![]:!![],'where':_0x367e0d['options']?_0x367e0d['options']['where']||null:null,'attributes':[[db[_0x31dd('0x1e')]['fn']('COUNT',db[_0x31dd('0x1e')]['fn']('IF',db[_0x31dd('0x1e')]['literal'](_0x31dd('0x1f')))),_0x31dd('0x20')]]})[_0x31dd('0xe')](function(_0x2148d2){logger[_0x31dd('0xf')]('GetVoiceQueueRtPauses',_0x367e0d);logger['debug'](_0x31dd('0x1a'),_0x367e0d,JSON[_0x31dd('0x14')](_0x2148d2));_0x4ce190(_0x2148d2);})[_0x31dd('0x19')](function(_0x39555d){logger['error'](_0x31dd('0x1a'),_0x39555d['message'],_0x367e0d);_0x5bee30(_0x576975[_0x31dd('0x15')](0x1f4,_0x39555d[_0x31dd('0x17')]));});});}; \ No newline at end of file +var _0xe6fa=['register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x5aee3a,_0x362a49){var _0x5d0707=function(_0x55ea9c){while(--_0x55ea9c){_0x5aee3a['push'](_0x5aee3a['shift']());}};_0x5d0707(++_0x362a49);}(_0xe6fa,0x13e));var _0xae6f=function(_0x185617,_0xefd895){_0x185617=_0x185617-0x0;var _0x4264d8=_0xe6fa[_0x185617];return _0x4264d8;};'use strict';var _=require(_0xae6f('0x0'));var util=require(_0xae6f('0x1'));var moment=require(_0xae6f('0x2'));var BPromise=require('bluebird');var rs=require(_0xae6f('0x3'));var fs=require('fs');var Redis=require(_0xae6f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae6f('0x5'));var logger=require(_0xae6f('0x6'))(_0xae6f('0x7'));var config=require(_0xae6f('0x8'));var jayson=require(_0xae6f('0x9'));var client=jayson[_0xae6f('0xa')][_0xae6f('0xb')]({'port':0x232a});config[_0xae6f('0xc')]=_[_0xae6f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae6f('0xe'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xae6f('0xf')](socket);function respondWithRpcPromise(_0x56bf81,_0x1bd3cb,_0x486b24){return new BPromise(function(_0x14d00f,_0x17178e){return client[_0xae6f('0x10')](_0x56bf81,_0x486b24)['then'](function(_0x55fd51){logger[_0xae6f('0x11')](_0xae6f('0x12'),_0x1bd3cb,_0xae6f('0x13'));logger[_0xae6f('0x14')](_0xae6f('0x15'),_0x1bd3cb,_0xae6f('0x13'),JSON[_0xae6f('0x16')](_0x55fd51));if(_0x55fd51[_0xae6f('0x17')]){if(_0x55fd51[_0xae6f('0x17')]['code']===0x1f4){logger['error'](_0xae6f('0x12'),_0x1bd3cb,_0x55fd51[_0xae6f('0x17')][_0xae6f('0x18')]);return _0x17178e(_0x55fd51[_0xae6f('0x17')][_0xae6f('0x18')]);}logger[_0xae6f('0x17')](_0xae6f('0x12'),_0x1bd3cb,_0x55fd51[_0xae6f('0x17')][_0xae6f('0x18')]);return _0x14d00f(_0x55fd51['error']['message']);}else{logger[_0xae6f('0x11')](_0xae6f('0x12'),_0x1bd3cb,_0xae6f('0x13'));_0x14d00f(_0x55fd51[_0xae6f('0x19')][_0xae6f('0x18')]);}})[_0xae6f('0x1a')](function(_0x2dbe83){logger[_0xae6f('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1bd3cb,_0x2dbe83);_0x17178e(_0x2dbe83);});});}exports[_0xae6f('0x1b')]=function(_0x3714ac){var _0x3c86e3=this;return new Promise(function(_0x5983ef,_0x40d938){return db[_0xae6f('0x1c')][_0xae6f('0x1d')]({'raw':_0x3714ac[_0xae6f('0x1e')]?_0x3714ac[_0xae6f('0x1e')][_0xae6f('0x1f')]===undefined?!![]:![]:!![],'where':_0x3714ac[_0xae6f('0x1e')]?_0x3714ac['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xae6f('0x20')]['fn']('IF',db[_0xae6f('0x20')][_0xae6f('0x21')](_0xae6f('0x22')))),_0xae6f('0x23')]]})[_0xae6f('0x24')](function(_0x2c428d){logger[_0xae6f('0x11')]('GetVoiceQueueRtPauses',_0x3714ac);logger['debug'](_0xae6f('0x1b'),_0x3714ac,JSON['stringify'](_0x2c428d));_0x5983ef(_0x2c428d);})[_0xae6f('0x1a')](function(_0x17a013){logger['error']('GetVoiceQueueRtPauses',_0x17a013['message'],_0x3714ac);_0x40d938(_0x3c86e3[_0xae6f('0x17')](0x1f4,_0x17a013[_0xae6f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c484620..5f632d9 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 _0xbf25=['./userVoiceQueueRt.events','remove','update','emit','register','length','userVoiceQueueRt:'];(function(_0x1026dd,_0x2bcdf1){var _0x565b96=function(_0x3f4467){while(--_0x3f4467){_0x1026dd['push'](_0x1026dd['shift']());}};_0x565b96(++_0x2bcdf1);}(_0xbf25,0x15e));var _0x5bf2=function(_0x595af9,_0x8c8478){_0x595af9=_0x595af9-0x0;var _0x592f54=_0xbf25[_0x595af9];return _0x592f54;};'use strict';var UserVoiceQueueRtEvents=require(_0x5bf2('0x0'));var events=['save',_0x5bf2('0x1'),_0x5bf2('0x2')];function createListener(_0x40e05e,_0xa41a9){return function(_0x19e291){_0xa41a9[_0x5bf2('0x3')](_0x40e05e,_0x19e291);};}function removeListener(_0x52323c,_0x861180){return function(){UserVoiceQueueRtEvents['removeListener'](_0x52323c,_0x861180);};}exports[_0x5bf2('0x4')]=function(_0x3f47fd){for(var _0x5ed7d8=0x0,_0x29c6c8=events[_0x5bf2('0x5')];_0x5ed7d8<_0x29c6c8;_0x5ed7d8++){var _0x3fa095=events[_0x5ed7d8];var _0x53acc6=createListener(_0x5bf2('0x6')+_0x3fa095,_0x3f47fd);UserVoiceQueueRtEvents['on'](_0x3fa095,_0x53acc6);}}; \ No newline at end of file +var _0x87f1=['emit','register','length','userVoiceQueueRt:','save','remove','update'];(function(_0x44bc0f,_0x1027ce){var _0x3917f1=function(_0x4cd1c3){while(--_0x4cd1c3){_0x44bc0f['push'](_0x44bc0f['shift']());}};_0x3917f1(++_0x1027ce);}(_0x87f1,0x170));var _0x187f=function(_0x223f51,_0x2b59b8){_0x223f51=_0x223f51-0x0;var _0x43a51b=_0x87f1[_0x223f51];return _0x43a51b;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x187f('0x0'),_0x187f('0x1'),_0x187f('0x2')];function createListener(_0xbc0de1,_0x7ec131){return function(_0x399e9a){_0x7ec131[_0x187f('0x3')](_0xbc0de1,_0x399e9a);};}function removeListener(_0x5eafdc,_0x19e8fb){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5eafdc,_0x19e8fb);};}exports[_0x187f('0x4')]=function(_0x591147){for(var _0x1115d1=0x0,_0x58ab4a=events[_0x187f('0x5')];_0x1115d1<_0x58ab4a;_0x1115d1++){var _0x349f6e=events[_0x1115d1];var _0xb61ae=createListener(_0x187f('0x6')+_0x349f6e,_0x591147);UserVoiceQueueRtEvents['on'](_0x349f6e,_0xb61ae);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ce69bc7..7628946 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x570294,_0x139ae4){var _0x41b542=function(_0xea92ff){while(--_0xea92ff){_0x570294['push'](_0x570294['shift']());}};_0x41b542(++_0x139ae4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x332bb4,_0x24246d){var _0x136f0b=function(_0x7e5a11){while(--_0x7e5a11){_0x332bb4['push'](_0x332bb4['shift']());}};_0x136f0b(++_0x24246d);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f9170be..ec87930 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 _0x8d50=['exports','INTEGER','sequelize'];(function(_0x1c2755,_0x481827){var _0x2bced2=function(_0x187ede){while(--_0x187ede){_0x1c2755['push'](_0x1c2755['shift']());}};_0x2bced2(++_0x481827);}(_0x8d50,0xb3));var _0x08d5=function(_0x311dd9,_0x123cb0){_0x311dd9=_0x311dd9-0x0;var _0x384041=_0x8d50[_0x311dd9];return _0x384041;};'use strict';var Sequelize=require(_0x08d5('0x0'));module[_0x08d5('0x1')]={'penalty':{'type':Sequelize[_0x08d5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8ff=['INTEGER','sequelize','exports'];(function(_0x5278f9,_0x3a03af){var _0x36c30d=function(_0x4985fc){while(--_0x4985fc){_0x5278f9['push'](_0x5278f9['shift']());}};_0x36c30d(++_0x3a03af);}(_0xd8ff,0x124));var _0xfd8f=function(_0x433439,_0x2483b5){_0x433439=_0x433439-0x0;var _0x4e8348=_0xd8ff[_0x433439];return _0x4e8348;};'use strict';var Sequelize=require(_0xfd8f('0x0'));module[_0xfd8f('0x1')]={'penalty':{'type':Sequelize[_0xfd8f('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 e576793..884c332 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 _0x6ee2=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0xe5d54f,_0x143d93){var _0x2a74bf=function(_0x3e56cb){while(--_0x3e56cb){_0xe5d54f['push'](_0xe5d54f['shift']());}};_0x2a74bf(++_0x143d93);}(_0x6ee2,0x1d6));var _0x26ee=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x6ee2[_0x1da04e];return _0xdd8c41;};'use strict';var _=require('lodash');var util=require(_0x26ee('0x0'));var logger=require(_0x26ee('0x1'))('api');var moment=require(_0x26ee('0x2'));var BPromise=require(_0x26ee('0x3'));var rp=require(_0x26ee('0x4'));var fs=require('fs');var path=require(_0x26ee('0x5'));var rimraf=require(_0x26ee('0x6'));var config=require(_0x26ee('0x7'));var attributes=require(_0x26ee('0x8'));module[_0x26ee('0x9')]=function(_0x3efc3c,_0x566928){return _0x3efc3c['define'](_0x26ee('0xa'),attributes,{'tableName':_0x26ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1802=['api','moment','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','lodash','../../config/logger'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x1802,0xbe));var _0x2180=function(_0x3860d9,_0x531d3c){_0x3860d9=_0x3860d9-0x0;var _0x289908=_0x1802[_0x3860d9];return _0x289908;};'use strict';var _=require(_0x2180('0x0'));var util=require('util');var logger=require(_0x2180('0x1'))(_0x2180('0x2'));var moment=require(_0x2180('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2180('0x4'));var config=require(_0x2180('0x5'));var attributes=require(_0x2180('0x6'));module[_0x2180('0x7')]=function(_0x41a919,_0x5af587){return _0x41a919['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index eaff407..477d10d 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 _0x2c7e=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x3b1d1e,_0x10d8d9){var _0x5670b7=function(_0x2ed53a){while(--_0x2ed53a){_0x3b1d1e['push'](_0x3b1d1e['shift']());}};_0x5670b7(++_0x10d8d9);}(_0x2c7e,0x1cd));var _0xe2c7=function(_0x324137,_0x55389c){_0x324137=_0x324137-0x0;var _0x2e1ec2=_0x2c7e[_0x324137];return _0x2e1ec2;};'use strict';var _=require(_0xe2c7('0x0'));var util=require(_0xe2c7('0x1'));var moment=require(_0xe2c7('0x2'));var BPromise=require('bluebird');var rs=require(_0xe2c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe2c7('0x4'));var logger=require(_0xe2c7('0x5'))(_0xe2c7('0x6'));var config=require('../../config/environment');var jayson=require(_0xe2c7('0x7'));var client=jayson[_0xe2c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39ef65,_0xfde279,_0x5ea19b){return new BPromise(function(_0x25a2e0,_0x53e23e){return client[_0xe2c7('0x9')](_0x39ef65,_0x5ea19b)[_0xe2c7('0xa')](function(_0x252a38){logger['info'](_0xe2c7('0xb'),_0xfde279,_0xe2c7('0xc'));logger[_0xe2c7('0xd')](_0xe2c7('0xe'),_0xfde279,'request\x20sent',JSON[_0xe2c7('0xf')](_0x252a38));if(_0x252a38[_0xe2c7('0x10')]){if(_0x252a38[_0xe2c7('0x10')][_0xe2c7('0x11')]===0x1f4){logger[_0xe2c7('0x10')](_0xe2c7('0xb'),_0xfde279,_0x252a38['error'][_0xe2c7('0x12')]);return _0x53e23e(_0x252a38[_0xe2c7('0x10')][_0xe2c7('0x12')]);}logger['error'](_0xe2c7('0xb'),_0xfde279,_0x252a38[_0xe2c7('0x10')][_0xe2c7('0x12')]);return _0x25a2e0(_0x252a38[_0xe2c7('0x10')]['message']);}else{logger[_0xe2c7('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0xfde279,_0xe2c7('0xc'));_0x25a2e0(_0x252a38[_0xe2c7('0x14')][_0xe2c7('0x12')]);}})[_0xe2c7('0x15')](function(_0x2985e6){logger[_0xe2c7('0x10')](_0xe2c7('0xb'),_0xfde279,_0x2985e6);_0x53e23e(_0x2985e6);});});} \ No newline at end of file +var _0xa154=['client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x535398,_0xbe85c4){var _0x48451f=function(_0x3177d0){while(--_0x3177d0){_0x535398['push'](_0x535398['shift']());}};_0x48451f(++_0xbe85c4);}(_0xa154,0xf0));var _0x4a15=function(_0x3fa37f,_0x397f16){_0x3fa37f=_0x3fa37f-0x0;var _0x5a01d5=_0xa154[_0x3fa37f];return _0x5a01d5;};'use strict';var _=require(_0x4a15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a15('0x1'));var rs=require(_0x4a15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a15('0x3'))['db'];var utils=require(_0x4a15('0x4'));var logger=require(_0x4a15('0x5'))('rpc');var config=require(_0x4a15('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4a15('0x7')][_0x4a15('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22c886,_0x5b033a,_0x1305cb){return new BPromise(function(_0x3b680c,_0x3abdda){return client[_0x4a15('0x9')](_0x22c886,_0x1305cb)[_0x4a15('0xa')](function(_0x1a1cd){logger[_0x4a15('0xb')](_0x4a15('0xc'),_0x5b033a,_0x4a15('0xd'));logger[_0x4a15('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5b033a,_0x4a15('0xd'),JSON['stringify'](_0x1a1cd));if(_0x1a1cd[_0x4a15('0xf')]){if(_0x1a1cd[_0x4a15('0xf')][_0x4a15('0x10')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x5b033a,_0x1a1cd[_0x4a15('0xf')][_0x4a15('0x11')]);return _0x3abdda(_0x1a1cd[_0x4a15('0xf')]['message']);}logger[_0x4a15('0xf')](_0x4a15('0xc'),_0x5b033a,_0x1a1cd[_0x4a15('0xf')][_0x4a15('0x11')]);return _0x3b680c(_0x1a1cd[_0x4a15('0xf')][_0x4a15('0x11')]);}else{logger[_0x4a15('0xb')](_0x4a15('0xc'),_0x5b033a,'request\x20sent');_0x3b680c(_0x1a1cd[_0x4a15('0x12')][_0x4a15('0x11')]);}})['catch'](function(_0x3a2102){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x5b033a,_0x3a2102);_0x3abdda(_0x3a2102);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index fc03482..e878103 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 _0xde6c=['../../config/environment','./variable.controller','isAuthenticated','index','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xde6c,0x119));var _0xcde6=function(_0xeb6bb1,_0xc83c4c){_0xeb6bb1=_0xeb6bb1-0x0;var _0x387e00=_0xde6c[_0xeb6bb1];return _0x387e00;};'use strict';var multer=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var path=require('path');var timeout=require(_0xcde6('0x2'));var express=require(_0xcde6('0x3'));var router=express[_0xcde6('0x4')]();var fs_extra=require(_0xcde6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcde6('0x6'));var config=require(_0xcde6('0x7'));var controller=require(_0xcde6('0x8'));router['get']('/',auth[_0xcde6('0x9')](),controller[_0xcde6('0xa')]);router['get']('/:id',auth[_0xcde6('0x9')](),controller['show']);router[_0xcde6('0xb')]('/',auth[_0xcde6('0x9')](),controller[_0xcde6('0xc')]);router[_0xcde6('0xd')]('/:id',auth[_0xcde6('0x9')](),controller[_0xcde6('0xe')]);router['delete'](_0xcde6('0xf'),auth[_0xcde6('0x9')](),controller[_0xcde6('0x10')]);module[_0xcde6('0x11')]=router; \ No newline at end of file +var _0x2209=['post','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2209,0x95));var _0x9220=function(_0x27be54,_0x2e3bc0){_0x27be54=_0x27be54-0x0;var _0x892ac4=_0x2209[_0x27be54];return _0x892ac4;};'use strict';var multer=require(_0x9220('0x0'));var util=require(_0x9220('0x1'));var path=require(_0x9220('0x2'));var timeout=require(_0x9220('0x3'));var express=require(_0x9220('0x4'));var router=express['Router']();var fs_extra=require(_0x9220('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9220('0x6'));var config=require(_0x9220('0x7'));var controller=require(_0x9220('0x8'));router[_0x9220('0x9')]('/',auth[_0x9220('0xa')](),controller[_0x9220('0xb')]);router[_0x9220('0x9')](_0x9220('0xc'),auth[_0x9220('0xa')](),controller['show']);router[_0x9220('0xd')]('/',auth[_0x9220('0xa')](),controller['create']);router[_0x9220('0xe')](_0x9220('0xc'),auth[_0x9220('0xa')](),controller[_0x9220('0xf')]);router['delete'](_0x9220('0xc'),auth[_0x9220('0xa')](),controller[_0x9220('0x10')]);module[_0x9220('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a01c82a..2abac5a 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 _0xa5ef=['sequelize','exports','STRING','name'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xa5ef,0x120));var _0xfa5e=function(_0x4acf20,_0x3f4636){_0x4acf20=_0x4acf20-0x0;var _0x50eabc=_0xa5ef[_0x4acf20];return _0x50eabc;};'use strict';var Sequelize=require(_0xfa5e('0x0'));module[_0xfa5e('0x1')]={'name':{'type':Sequelize[_0xfa5e('0x2')],'unique':_0xfa5e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfa5e('0x2')]}}; \ No newline at end of file +var _0x014e=['STRING','name','exports'];(function(_0x34ccd6,_0x378fcc){var _0x3f14cd=function(_0x292dc8){while(--_0x292dc8){_0x34ccd6['push'](_0x34ccd6['shift']());}};_0x3f14cd(++_0x378fcc);}(_0x014e,0x16d));var _0xe014=function(_0x43e1af,_0x52ec99){_0x43e1af=_0x43e1af-0x0;var _0x1fc1c0=_0x014e[_0x43e1af];return _0x1fc1c0;};'use strict';var Sequelize=require('sequelize');module[_0xe014('0x0')]={'name':{'type':Sequelize[_0xe014('0x1')],'unique':_0xe014('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe014('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3b36941..9d9de3d 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 _0x05a4=['Variables','UserProfileResource','destroy','error','stack','send','map','Variable','rawAttributes','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','get'];(function(_0x5a706b,_0x163c9f){var _0x1d1798=function(_0x61b988){while(--_0x61b988){_0x5a706b['push'](_0x5a706b['shift']());}};_0x1d1798(++_0x163c9f);}(_0x05a4,0x16a));var _0x405a=function(_0x2c60ec,_0x57ed85){_0x2c60ec=_0x2c60ec-0x0;var _0x515c72=_0x05a4[_0x2c60ec];return _0x515c72;};'use strict';var emlformat=require(_0x405a('0x0'));var rimraf=require(_0x405a('0x1'));var zipdir=require(_0x405a('0x2'));var jsonpatch=require(_0x405a('0x3'));var rp=require('request-promise');var moment=require(_0x405a('0x4'));var BPromise=require(_0x405a('0x5'));var Mustache=require(_0x405a('0x6'));var util=require(_0x405a('0x7'));var path=require('path');var sox=require(_0x405a('0x8'));var csv=require(_0x405a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x405a('0xa'));var squel=require(_0x405a('0xb'));var crypto=require(_0x405a('0xc'));var jsforce=require(_0x405a('0xd'));var deskjs=require(_0x405a('0xe'));var toCsv=require(_0x405a('0x9'));var querystring=require(_0x405a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x405a('0x10'));var qs=require(_0x405a('0x11'));var as=require(_0x405a('0x12'));var hardwareService=require(_0x405a('0x13'));var logger=require(_0x405a('0x14'))(_0x405a('0x15'));var utils=require('../../config/utils');var config=require(_0x405a('0x16'));var licenseUtil=require(_0x405a('0x17'));var db=require(_0x405a('0x18'))['db'];function respondWithStatusCode(_0x4e0f10,_0x503c87){_0x503c87=_0x503c87||0xcc;return function(_0x28190b){if(_0x28190b){return _0x4e0f10[_0x405a('0x19')](_0x503c87);}return _0x4e0f10[_0x405a('0x1a')](_0x503c87)[_0x405a('0x1b')]();};}function respondWithResult(_0x2cf56b,_0x3fb8d5){_0x3fb8d5=_0x3fb8d5||0xc8;return function(_0x405246){if(_0x405246){return _0x2cf56b[_0x405a('0x1a')](_0x3fb8d5)[_0x405a('0x1c')](_0x405246);}};}function respondWithFilteredResult(_0x2f2fca,_0x16c4c9){return function(_0x3fd4df){if(_0x3fd4df){var _0x2d5b97=typeof _0x16c4c9[_0x405a('0x1d')]===_0x405a('0x1e')&&typeof _0x16c4c9[_0x405a('0x1f')]===_0x405a('0x1e');var _0x51a01=_0x3fd4df[_0x405a('0x20')];var _0x8123e6=_0x2d5b97?0x0:_0x16c4c9[_0x405a('0x1d')];var _0x5c9fb8=_0x2d5b97?_0x3fd4df[_0x405a('0x20')]:_0x16c4c9[_0x405a('0x1d')]+_0x16c4c9['limit'];var _0x2e9d3c;if(_0x5c9fb8>=_0x51a01){_0x5c9fb8=_0x51a01;_0x2e9d3c=0xc8;}else{_0x2e9d3c=0xce;}_0x2f2fca[_0x405a('0x1a')](_0x2e9d3c);return _0x2f2fca[_0x405a('0x21')]('Content-Range',_0x8123e6+'-'+_0x5c9fb8+'/'+_0x51a01)[_0x405a('0x1c')](_0x3fd4df);}return null;};}function patchUpdates(_0x5c6d26){return function(_0x156279){try{jsonpatch['apply'](_0x156279,_0x5c6d26,!![]);}catch(_0x48bbb5){return BPromise[_0x405a('0x22')](_0x48bbb5);}return _0x156279['save']();};}function saveUpdates(_0xb6cbab,_0x88ffff){return function(_0x9efdd8){if(_0x9efdd8){return _0x9efdd8[_0x405a('0x23')](_0xb6cbab)[_0x405a('0x24')](function(_0x1b3f06){return _0x1b3f06;});}return null;};}function removeEntity(_0x44bdf2,_0x252985){return function(_0x58327b){if(_0x58327b){return _0x58327b['destroy']()[_0x405a('0x24')](function(){var _0x2c2b51=_0x58327b[_0x405a('0x25')]({'plain':!![]});var _0x3a5f66=_0x405a('0x26');return db[_0x405a('0x27')][_0x405a('0x28')]({'where':{'type':_0x3a5f66,'resourceId':_0x2c2b51['id']}})[_0x405a('0x24')](function(){return _0x58327b;});})[_0x405a('0x24')](function(){_0x44bdf2[_0x405a('0x1a')](0xcc)[_0x405a('0x1b')]();});}};}function handleEntityNotFound(_0x241956,_0x41ffff){return function(_0x576127){if(!_0x576127){_0x241956[_0x405a('0x19')](0x194);}return _0x576127;};}function handleError(_0x3f3dd3,_0x2102dd){_0x2102dd=_0x2102dd||0x1f4;return function(_0x27da22){logger[_0x405a('0x29')](_0x27da22[_0x405a('0x2a')]);if(_0x27da22['name']){delete _0x27da22['name'];}_0x3f3dd3[_0x405a('0x1a')](_0x2102dd)[_0x405a('0x2b')](_0x27da22);};}exports['index']=function(_0xc37540,_0x1e447d){var _0x504ad9={},_0x5b8996={},_0x18a146={'count':0x0,'rows':[]};var _0x475aa3=_[_0x405a('0x2c')](db[_0x405a('0x2d')][_0x405a('0x2e')],function(_0x22ee79){return{'name':_0x22ee79['fieldName'],'type':_0x22ee79['type']['key']};});_0x5b8996[_0x405a('0x2f')]=_[_0x405a('0x2c')](_0x475aa3,_0x405a('0x30'));_0x5b8996[_0x405a('0x31')]=_[_0x405a('0x32')](_0xc37540[_0x405a('0x31')]);_0x5b8996[_0x405a('0x33')]=_[_0x405a('0x34')](_0x5b8996[_0x405a('0x2f')],_0x5b8996[_0x405a('0x31')]);_0x504ad9[_0x405a('0x35')]=_[_0x405a('0x34')](_0x5b8996[_0x405a('0x2f')],qs['fields'](_0xc37540[_0x405a('0x31')][_0x405a('0x36')]));_0x504ad9[_0x405a('0x35')]=_0x504ad9[_0x405a('0x35')][_0x405a('0x37')]?_0x504ad9[_0x405a('0x35')]:_0x5b8996[_0x405a('0x2f')];if(!_0xc37540[_0x405a('0x31')]['hasOwnProperty']('nolimit')){_0x504ad9[_0x405a('0x1f')]=qs['limit'](_0xc37540[_0x405a('0x31')]['limit']);_0x504ad9['offset']=qs['offset'](_0xc37540[_0x405a('0x31')][_0x405a('0x1d')]);}_0x504ad9[_0x405a('0x38')]=qs['sort'](_0xc37540[_0x405a('0x31')][_0x405a('0x39')]);_0x504ad9[_0x405a('0x3a')]=qs[_0x405a('0x33')](_[_0x405a('0x3b')](_0xc37540[_0x405a('0x31')],_0x5b8996[_0x405a('0x33')]),_0x475aa3);if(_0xc37540[_0x405a('0x31')][_0x405a('0x3c')]){_0x504ad9[_0x405a('0x3a')]=_[_0x405a('0x3d')](_0x504ad9[_0x405a('0x3a')],{'$or':_[_0x405a('0x2c')](_0x475aa3,function(_0x20dc15){if(_0x20dc15[_0x405a('0x3e')]!==_0x405a('0x3f')){var _0x186d6a={};_0x186d6a[_0x20dc15[_0x405a('0x30')]]={'$like':'%'+_0xc37540['query']['filter']+'%'};return _0x186d6a;}})});}_0x504ad9=_[_0x405a('0x3d')]({},_0x504ad9,_0xc37540['options']);var _0x351a69={'where':_0x504ad9['where']};return db['Variable'][_0x405a('0x20')](_0x351a69)[_0x405a('0x24')](function(_0x271ec6){_0x18a146[_0x405a('0x20')]=_0x271ec6;if(_0xc37540['query'][_0x405a('0x40')]){_0x504ad9[_0x405a('0x41')]=[{'all':!![]}];}return db[_0x405a('0x2d')][_0x405a('0x42')](_0x504ad9);})['then'](function(_0x2ba6d9){_0x18a146[_0x405a('0x43')]=_0x2ba6d9;return _0x18a146;})[_0x405a('0x24')](respondWithFilteredResult(_0x1e447d,_0x504ad9))[_0x405a('0x44')](handleError(_0x1e447d,null));};exports[_0x405a('0x45')]=function(_0x1ab3b9,_0x418a32){var _0x228822={'raw':!![],'where':{'id':_0x1ab3b9[_0x405a('0x46')]['id']}},_0x3d1985={};_0x3d1985[_0x405a('0x2f')]=_[_0x405a('0x32')](db[_0x405a('0x2d')]['rawAttributes']);_0x3d1985[_0x405a('0x31')]=_['keys'](_0x1ab3b9[_0x405a('0x31')]);_0x3d1985['filters']=_[_0x405a('0x34')](_0x3d1985[_0x405a('0x2f')],_0x3d1985['query']);_0x228822[_0x405a('0x35')]=_['intersection'](_0x3d1985['model'],qs['fields'](_0x1ab3b9[_0x405a('0x31')]['fields']));_0x228822[_0x405a('0x35')]=_0x228822[_0x405a('0x35')]['length']?_0x228822[_0x405a('0x35')]:_0x3d1985[_0x405a('0x2f')];if(_0x1ab3b9[_0x405a('0x31')][_0x405a('0x40')]){_0x228822[_0x405a('0x41')]=[{'all':!![]}];}_0x228822=_[_0x405a('0x3d')]({},_0x228822,_0x1ab3b9[_0x405a('0x47')]);return db['Variable'][_0x405a('0x48')](_0x228822)[_0x405a('0x24')](handleEntityNotFound(_0x418a32,null))[_0x405a('0x24')](respondWithResult(_0x418a32,null))['catch'](handleError(_0x418a32,null));};exports['create']=function(_0xce9c2,_0x312ff2){return db['Variable'][_0x405a('0x49')](_0xce9c2['body'],{})[_0x405a('0x24')](function(_0x7faba4){var _0x55e246=_0xce9c2[_0x405a('0x4a')]['get']({'plain':!![]});if(!_0x55e246)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55e246['role']===_0x405a('0x4a')){var _0x25e8ad=_0x7faba4[_0x405a('0x25')]({'plain':!![]});var _0xc2797b=_0x405a('0x26');return db[_0x405a('0x4b')]['find']({'where':{'name':_0xc2797b,'userProfileId':_0x55e246[_0x405a('0x4c')]},'raw':!![]})[_0x405a('0x24')](function(_0x1de24c){if(_0x1de24c&&_0x1de24c[_0x405a('0x4d')]===0x0){return db[_0x405a('0x27')][_0x405a('0x49')]({'name':_0x25e8ad[_0x405a('0x30')],'resourceId':_0x25e8ad['id'],'type':_0x1de24c[_0x405a('0x30')],'sectionId':_0x1de24c['id']},{})[_0x405a('0x24')](function(){return _0x7faba4;});}else{return _0x7faba4;}})[_0x405a('0x44')](function(_0x39221a){logger[_0x405a('0x29')](_0x405a('0x4e'),_0x39221a);throw _0x39221a;});}return _0x7faba4;})['then'](respondWithResult(_0x312ff2,0xc9))[_0x405a('0x44')](handleError(_0x312ff2,null));};exports[_0x405a('0x23')]=function(_0x32fa1e,_0x9d346e){if(_0x32fa1e[_0x405a('0x4f')]['id']){delete _0x32fa1e['body']['id'];}return db[_0x405a('0x2d')][_0x405a('0x48')]({'where':{'id':_0x32fa1e[_0x405a('0x46')]['id']}})[_0x405a('0x24')](handleEntityNotFound(_0x9d346e,null))['then'](saveUpdates(_0x32fa1e[_0x405a('0x4f')],null))[_0x405a('0x24')](respondWithResult(_0x9d346e,null))[_0x405a('0x44')](handleError(_0x9d346e,null));};exports[_0x405a('0x28')]=function(_0x21e5f4,_0x45c85d){return db[_0x405a('0x2d')]['find']({'where':{'id':_0x21e5f4[_0x405a('0x46')]['id']}})[_0x405a('0x24')](handleEntityNotFound(_0x45c85d,null))[_0x405a('0x24')](removeEntity(_0x45c85d,null))[_0x405a('0x44')](handleError(_0x45c85d,null));}; \ No newline at end of file +var _0xaec4=['where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','get','Variables','error','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x2bdd09,_0x4627f7){var _0x2728a6=function(_0x7f043a){while(--_0x7f043a){_0x2bdd09['push'](_0x2bdd09['shift']());}};_0x2728a6(++_0x4627f7);}(_0xaec4,0x69));var _0x4aec=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xaec4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x4aec('0x0'));var rimraf=require(_0x4aec('0x1'));var zipdir=require(_0x4aec('0x2'));var jsonpatch=require(_0x4aec('0x3'));var rp=require(_0x4aec('0x4'));var moment=require(_0x4aec('0x5'));var BPromise=require(_0x4aec('0x6'));var Mustache=require(_0x4aec('0x7'));var util=require(_0x4aec('0x8'));var path=require(_0x4aec('0x9'));var sox=require(_0x4aec('0xa'));var csv=require('to-csv');var ejs=require(_0x4aec('0xb'));var fs=require('fs');var fs_extra=require(_0x4aec('0xc'));var _=require('lodash');var squel=require(_0x4aec('0xd'));var crypto=require(_0x4aec('0xe'));var jsforce=require(_0x4aec('0xf'));var deskjs=require(_0x4aec('0x10'));var toCsv=require(_0x4aec('0x11'));var querystring=require(_0x4aec('0x12'));var Papa=require(_0x4aec('0x13'));var Redis=require('ioredis');var authService=require(_0x4aec('0x14'));var qs=require(_0x4aec('0x15'));var as=require(_0x4aec('0x16'));var hardwareService=require(_0x4aec('0x17'));var logger=require(_0x4aec('0x18'))(_0x4aec('0x19'));var utils=require(_0x4aec('0x1a'));var config=require(_0x4aec('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x4aec('0x1c'))['db'];function respondWithStatusCode(_0x3a0e5f,_0x4e5f8b){_0x4e5f8b=_0x4e5f8b||0xcc;return function(_0x4a4011){if(_0x4a4011){return _0x3a0e5f['sendStatus'](_0x4e5f8b);}return _0x3a0e5f['status'](_0x4e5f8b)[_0x4aec('0x1d')]();};}function respondWithResult(_0x559475,_0x5aaa8b){_0x5aaa8b=_0x5aaa8b||0xc8;return function(_0x241b31){if(_0x241b31){return _0x559475[_0x4aec('0x1e')](_0x5aaa8b)['json'](_0x241b31);}};}function respondWithFilteredResult(_0x188859,_0x4cca0e){return function(_0x188520){if(_0x188520){var _0xc763c4=typeof _0x4cca0e['offset']===_0x4aec('0x1f')&&typeof _0x4cca0e[_0x4aec('0x20')]==='undefined';var _0x29ea9a=_0x188520[_0x4aec('0x21')];var _0x108853=_0xc763c4?0x0:_0x4cca0e[_0x4aec('0x22')];var _0x5a3935=_0xc763c4?_0x188520[_0x4aec('0x21')]:_0x4cca0e[_0x4aec('0x22')]+_0x4cca0e[_0x4aec('0x20')];var _0x389fe6;if(_0x5a3935>=_0x29ea9a){_0x5a3935=_0x29ea9a;_0x389fe6=0xc8;}else{_0x389fe6=0xce;}_0x188859[_0x4aec('0x1e')](_0x389fe6);return _0x188859['set'](_0x4aec('0x23'),_0x108853+'-'+_0x5a3935+'/'+_0x29ea9a)[_0x4aec('0x24')](_0x188520);}return null;};}function patchUpdates(_0x5d877d){return function(_0xd60b2c){try{jsonpatch[_0x4aec('0x25')](_0xd60b2c,_0x5d877d,!![]);}catch(_0x5b6795){return BPromise['reject'](_0x5b6795);}return _0xd60b2c[_0x4aec('0x26')]();};}function saveUpdates(_0x1dc49f,_0x3821dd){return function(_0x170f56){if(_0x170f56){return _0x170f56[_0x4aec('0x27')](_0x1dc49f)[_0x4aec('0x28')](function(_0x230f44){return _0x230f44;});}return null;};}function removeEntity(_0xaa9573,_0x2ec47a){return function(_0x39633c){if(_0x39633c){return _0x39633c[_0x4aec('0x29')]()[_0x4aec('0x28')](function(){var _0x5148af=_0x39633c[_0x4aec('0x2a')]({'plain':!![]});var _0x7ce949=_0x4aec('0x2b');return db['UserProfileResource'][_0x4aec('0x29')]({'where':{'type':_0x7ce949,'resourceId':_0x5148af['id']}})[_0x4aec('0x28')](function(){return _0x39633c;});})[_0x4aec('0x28')](function(){_0xaa9573[_0x4aec('0x1e')](0xcc)[_0x4aec('0x1d')]();});}};}function handleEntityNotFound(_0x137441,_0x54c5eb){return function(_0x1c9967){if(!_0x1c9967){_0x137441['sendStatus'](0x194);}return _0x1c9967;};}function handleError(_0x113bd5,_0x477c78){_0x477c78=_0x477c78||0x1f4;return function(_0x23f8af){logger[_0x4aec('0x2c')](_0x23f8af['stack']);if(_0x23f8af['name']){delete _0x23f8af[_0x4aec('0x2d')];}_0x113bd5[_0x4aec('0x1e')](_0x477c78)[_0x4aec('0x2e')](_0x23f8af);};}exports[_0x4aec('0x2f')]=function(_0x47c442,_0x3e40b5){var _0x3a7ef8={},_0x249aa9={},_0x4aadda={'count':0x0,'rows':[]};var _0x12910c=_[_0x4aec('0x30')](db[_0x4aec('0x31')][_0x4aec('0x32')],function(_0x18a652){return{'name':_0x18a652[_0x4aec('0x33')],'type':_0x18a652[_0x4aec('0x34')][_0x4aec('0x35')]};});_0x249aa9[_0x4aec('0x36')]=_[_0x4aec('0x30')](_0x12910c,_0x4aec('0x2d'));_0x249aa9[_0x4aec('0x37')]=_[_0x4aec('0x38')](_0x47c442[_0x4aec('0x37')]);_0x249aa9[_0x4aec('0x39')]=_[_0x4aec('0x3a')](_0x249aa9[_0x4aec('0x36')],_0x249aa9[_0x4aec('0x37')]);_0x3a7ef8[_0x4aec('0x3b')]=_[_0x4aec('0x3a')](_0x249aa9[_0x4aec('0x36')],qs[_0x4aec('0x3c')](_0x47c442[_0x4aec('0x37')][_0x4aec('0x3c')]));_0x3a7ef8[_0x4aec('0x3b')]=_0x3a7ef8[_0x4aec('0x3b')][_0x4aec('0x3d')]?_0x3a7ef8[_0x4aec('0x3b')]:_0x249aa9[_0x4aec('0x36')];if(!_0x47c442[_0x4aec('0x37')]['hasOwnProperty'](_0x4aec('0x3e'))){_0x3a7ef8[_0x4aec('0x20')]=qs['limit'](_0x47c442[_0x4aec('0x37')]['limit']);_0x3a7ef8[_0x4aec('0x22')]=qs[_0x4aec('0x22')](_0x47c442[_0x4aec('0x37')][_0x4aec('0x22')]);}_0x3a7ef8[_0x4aec('0x3f')]=qs[_0x4aec('0x40')](_0x47c442[_0x4aec('0x37')][_0x4aec('0x40')]);_0x3a7ef8[_0x4aec('0x41')]=qs['filters'](_[_0x4aec('0x42')](_0x47c442['query'],_0x249aa9[_0x4aec('0x39')]),_0x12910c);if(_0x47c442['query'][_0x4aec('0x43')]){_0x3a7ef8[_0x4aec('0x41')]=_[_0x4aec('0x44')](_0x3a7ef8[_0x4aec('0x41')],{'$or':_[_0x4aec('0x30')](_0x12910c,function(_0x4ce7af){if(_0x4ce7af[_0x4aec('0x34')]!=='VIRTUAL'){var _0x5e80e3={};_0x5e80e3[_0x4ce7af[_0x4aec('0x2d')]]={'$like':'%'+_0x47c442[_0x4aec('0x37')][_0x4aec('0x43')]+'%'};return _0x5e80e3;}})});}_0x3a7ef8=_[_0x4aec('0x44')]({},_0x3a7ef8,_0x47c442[_0x4aec('0x45')]);var _0x2203e9={'where':_0x3a7ef8[_0x4aec('0x41')]};return db[_0x4aec('0x31')][_0x4aec('0x21')](_0x2203e9)[_0x4aec('0x28')](function(_0x3f4403){_0x4aadda[_0x4aec('0x21')]=_0x3f4403;if(_0x47c442[_0x4aec('0x37')]['includeAll']){_0x3a7ef8['include']=[{'all':!![]}];}return db[_0x4aec('0x31')][_0x4aec('0x46')](_0x3a7ef8);})['then'](function(_0x497d5f){_0x4aadda[_0x4aec('0x47')]=_0x497d5f;return _0x4aadda;})[_0x4aec('0x28')](respondWithFilteredResult(_0x3e40b5,_0x3a7ef8))[_0x4aec('0x48')](handleError(_0x3e40b5,null));};exports[_0x4aec('0x49')]=function(_0x21dfe,_0x349c76){var _0x105617={'raw':!![],'where':{'id':_0x21dfe[_0x4aec('0x4a')]['id']}},_0xbdebb1={};_0xbdebb1[_0x4aec('0x36')]=_[_0x4aec('0x38')](db[_0x4aec('0x31')][_0x4aec('0x32')]);_0xbdebb1['query']=_['keys'](_0x21dfe['query']);_0xbdebb1['filters']=_[_0x4aec('0x3a')](_0xbdebb1['model'],_0xbdebb1['query']);_0x105617[_0x4aec('0x3b')]=_[_0x4aec('0x3a')](_0xbdebb1[_0x4aec('0x36')],qs[_0x4aec('0x3c')](_0x21dfe[_0x4aec('0x37')][_0x4aec('0x3c')]));_0x105617[_0x4aec('0x3b')]=_0x105617[_0x4aec('0x3b')][_0x4aec('0x3d')]?_0x105617['attributes']:_0xbdebb1['model'];if(_0x21dfe[_0x4aec('0x37')][_0x4aec('0x4b')]){_0x105617[_0x4aec('0x4c')]=[{'all':!![]}];}_0x105617=_[_0x4aec('0x44')]({},_0x105617,_0x21dfe[_0x4aec('0x45')]);return db[_0x4aec('0x31')]['find'](_0x105617)['then'](handleEntityNotFound(_0x349c76,null))['then'](respondWithResult(_0x349c76,null))[_0x4aec('0x48')](handleError(_0x349c76,null));};exports[_0x4aec('0x4d')]=function(_0x499ffb,_0x1e9c6d){return db['Variable'][_0x4aec('0x4d')](_0x499ffb[_0x4aec('0x4e')],{})['then'](function(_0x2821a8){var _0xe8944f=_0x499ffb[_0x4aec('0x4f')]['get']({'plain':!![]});if(!_0xe8944f)throw new Error(_0x4aec('0x50'));if(_0xe8944f['role']===_0x4aec('0x4f')){var _0x21f6c8=_0x2821a8['get']({'plain':!![]});var _0x4ea1c8=_0x4aec('0x2b');return db['UserProfileSection'][_0x4aec('0x51')]({'where':{'name':_0x4ea1c8,'userProfileId':_0xe8944f[_0x4aec('0x52')]},'raw':!![]})[_0x4aec('0x28')](function(_0x2f0efa){if(_0x2f0efa&&_0x2f0efa['autoAssociation']===0x0){return db[_0x4aec('0x53')][_0x4aec('0x4d')]({'name':_0x21f6c8['name'],'resourceId':_0x21f6c8['id'],'type':_0x2f0efa['name'],'sectionId':_0x2f0efa['id']},{})[_0x4aec('0x28')](function(){return _0x2821a8;});}else{return _0x2821a8;}})['catch'](function(_0x5867a5){logger[_0x4aec('0x2c')](_0x4aec('0x54'),_0x5867a5);throw _0x5867a5;});}return _0x2821a8;})[_0x4aec('0x28')](respondWithResult(_0x1e9c6d,0xc9))[_0x4aec('0x48')](handleError(_0x1e9c6d,null));};exports[_0x4aec('0x27')]=function(_0x15be7a,_0x48238e){if(_0x15be7a[_0x4aec('0x4e')]['id']){delete _0x15be7a['body']['id'];}return db[_0x4aec('0x31')][_0x4aec('0x51')]({'where':{'id':_0x15be7a[_0x4aec('0x4a')]['id']}})[_0x4aec('0x28')](handleEntityNotFound(_0x48238e,null))[_0x4aec('0x28')](saveUpdates(_0x15be7a[_0x4aec('0x4e')],null))[_0x4aec('0x28')](respondWithResult(_0x48238e,null))[_0x4aec('0x48')](handleError(_0x48238e,null));};exports[_0x4aec('0x29')]=function(_0x1cc84c,_0x2ec734){return db[_0x4aec('0x31')][_0x4aec('0x51')]({'where':{'id':_0x1cc84c[_0x4aec('0x4a')]['id']}})[_0x4aec('0x28')](handleEntityNotFound(_0x2ec734,null))[_0x4aec('0x28')](removeEntity(_0x2ec734,null))[_0x4aec('0x48')](handleError(_0x2ec734,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6bcab89..8dd1931 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 _0x05a2=['util','api','moment','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0x121078,_0xc410bd){var _0x3add67=function(_0x42ec2c){while(--_0x42ec2c){_0x121078['push'](_0x121078['shift']());}};_0x3add67(++_0xc410bd);}(_0x05a2,0x1df));var _0x205a=function(_0x48b9e0,_0x13bfee){_0x48b9e0=_0x48b9e0-0x0;var _0x5a1b0f=_0x05a2[_0x48b9e0];return _0x5a1b0f;};'use strict';var _=require(_0x205a('0x0'));var util=require(_0x205a('0x1'));var logger=require('../../config/logger')(_0x205a('0x2'));var moment=require(_0x205a('0x3'));var BPromise=require('bluebird');var rp=require(_0x205a('0x4'));var fs=require('fs');var path=require(_0x205a('0x5'));var rimraf=require(_0x205a('0x6'));var config=require('../../config/environment');var attributes=require(_0x205a('0x7'));module[_0x205a('0x8')]=function(_0x305bfe,_0xbb7af8){return _0x305bfe[_0x205a('0x9')](_0x205a('0xa'),attributes,{'tableName':_0x205a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbacb=['define','tools_variables','lodash','api','moment','bluebird','request-promise','path','./variable.attributes','exports'];(function(_0x5e990c,_0x9de850){var _0x4761d8=function(_0x3a14f9){while(--_0x3a14f9){_0x5e990c['push'](_0x5e990c['shift']());}};_0x4761d8(++_0x9de850);}(_0xbacb,0xb6));var _0xbbac=function(_0x119bd9,_0x21cdf5){_0x119bd9=_0x119bd9-0x0;var _0x5f2e77=_0xbacb[_0x119bd9];return _0x5f2e77;};'use strict';var _=require(_0xbbac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbbac('0x1'));var moment=require(_0xbbac('0x2'));var BPromise=require(_0xbbac('0x3'));var rp=require(_0xbbac('0x4'));var fs=require('fs');var path=require(_0xbbac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbac('0x6'));module[_0xbbac('0x7')]=function(_0x228cca,_0x522d29){return _0x228cca[_0xbbac('0x8')]('Variable',attributes,{'tableName':_0xbbac('0x9'),'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 1ecff39..8b138bb 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x45943c,_0x292e90){var _0xe1cf98=function(_0x4ba1ae){while(--_0x4ba1ae){_0x45943c['push'](_0x45943c['shift']());}};_0xe1cf98(++_0x292e90);}(_0x8ef6,0xf2));var _0x68ef=function(_0x575a30,_0x4bf663){_0x575a30=_0x575a30-0x0;var _0x2926e5=_0x8ef6[_0x575a30];return _0x2926e5;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _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(_0xbaf65f,_0x4eb9d0){var _0x16dd39=function(_0x37e3ad){while(--_0x37e3ad){_0xbaf65f['push'](_0xbaf65f['shift']());}};_0x16dd39(++_0x4eb9d0);}(_0x814b,0x1a2));var _0xb814=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x814b[_0x2ade6c];return _0x2cb372;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 2b4e6e1..d9928e3 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 _0x2838=['../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','exports','express'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x2838,0x16f));var _0x8283=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x2838[_0x3a6efd];return _0x487b9a;};'use strict';var express=require(_0x8283('0x0'));var router=express['Router']();var auth=require(_0x8283('0x1'));var controller=require(_0x8283('0x2'));router[_0x8283('0x3')]('/',controller[_0x8283('0x4')]);router['get'](_0x8283('0x5'),auth[_0x8283('0x6')](),auth[_0x8283('0x7')](),controller[_0x8283('0x8')]);router[_0x8283('0x3')](_0x8283('0x9'),auth[_0x8283('0x6')](),auth[_0x8283('0x7')](),controller[_0x8283('0xa')]);router[_0x8283('0x3')](_0x8283('0xb'),auth[_0x8283('0x6')](),auth[_0x8283('0x7')](),controller[_0x8283('0xc')]);router[_0x8283('0x3')](_0x8283('0xd'),auth[_0x8283('0x6')](),controller['restart']);router[_0x8283('0x3')](_0x8283('0xe'),controller['migrations']);module[_0x8283('0xf')]=router; \ No newline at end of file +var _0x5fc6=['reset','/pull','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5fc6,0x157));var _0x65fc=function(_0x574523,_0x271677){_0x574523=_0x574523-0x0;var _0x90c8ea=_0x5fc6[_0x574523];return _0x90c8ea;};'use strict';var express=require(_0x65fc('0x0'));var router=express[_0x65fc('0x1')]();var auth=require(_0x65fc('0x2'));var controller=require('./version.controller');router[_0x65fc('0x3')]('/',controller[_0x65fc('0x4')]);router[_0x65fc('0x3')](_0x65fc('0x5'),auth[_0x65fc('0x6')](),auth[_0x65fc('0x7')](),controller[_0x65fc('0x8')]);router[_0x65fc('0x3')]('/reset',auth['isAuthenticated'](),auth[_0x65fc('0x7')](),controller[_0x65fc('0x9')]);router[_0x65fc('0x3')](_0x65fc('0xa'),auth[_0x65fc('0x6')](),auth[_0x65fc('0x7')](),controller[_0x65fc('0xb')]);router[_0x65fc('0x3')]('/restart',auth['isAuthenticated'](),controller[_0x65fc('0xc')]);router[_0x65fc('0x3')](_0x65fc('0xd'),controller[_0x65fc('0xe')]);module[_0x65fc('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 9d2234e..f1e5712 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 _0x635c=['readdirSync','join','root','server','migrations','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','query','latest','fetch','exports','2.0.0','status','origin','error','json','git\x20fetch','reset','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x635c,0x81));var _0xc635=function(_0x4c6872,_0x3083fa){_0x4c6872=_0x4c6872-0x0;var _0x3a278f=_0x635c[_0x4c6872];return _0x3a278f;};'use strict';var Umzug=require(_0xc635('0x0'));var path=require(_0xc635('0x1'));var fs=require('fs');var _=require(_0xc635('0x2'));var pkginfo=require(_0xc635('0x3'))(module,_0xc635('0x4'));var compareVersions=require(_0xc635('0x5'));var exec=require('child_process')[_0xc635('0x6')];var db=require(_0xc635('0x7'))['db'];var config=require(_0xc635('0x8'));var pm2=require(_0xc635('0x9'));var logger=require(_0xc635('0xa'))(_0xc635('0xb'));var git=require(_0xc635('0xc'))(config['root']);exports[_0xc635('0xd')]=function(_0x4741f7,_0x22b9be){var _0x34a304={'current':module['exports'][_0xc635('0x4')],'phonebar':0x2};if(_0x4741f7['query']&&_0x4741f7[_0xc635('0xe')][_0xc635('0xf')]){return git[_0xc635('0x10')]()['tags'](function(_0x306694,_0x4b3dac){_0x34a304['latest']=(_0x306694?module[_0xc635('0x11')]['version']:_0x4b3dac[_0xc635('0xf')])||_0xc635('0x12');return _0x22b9be[_0xc635('0x13')](0xc8)['json'](_0x34a304);});}else{return _0x22b9be['status'](0xc8)['json'](_0x34a304);}};exports[_0xc635('0x10')]=function(_0x48b8d9,_0x382b6e){return git['fetch']([_0xc635('0x14'),'master'],function(_0x451ce7){if(_0x451ce7){logger[_0xc635('0x15')](_0x451ce7);return _0x382b6e[_0xc635('0x13')](0x1f4)[_0xc635('0x16')](_0x451ce7);}logger['info'](_0xc635('0x17'));return _0x382b6e[_0xc635('0x13')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xc635('0x18')]=function(_0x5af8aa,_0x7215b5){return git[_0xc635('0x18')](['--hard',_0xc635('0x19')],function(_0x481f48){if(_0x481f48){logger[_0xc635('0x15')](_0x481f48);return _0x7215b5[_0xc635('0x13')](0x1f4)[_0xc635('0x16')](_0x481f48);}logger[_0xc635('0x1a')](_0xc635('0x1b'));return _0x7215b5[_0xc635('0x13')](0xc8)[_0xc635('0x16')]({'output':_0xc635('0x1c')});});};exports[_0xc635('0x1d')]=function(_0x331131,_0x4f1aac){exec(_0xc635('0x1e'),function(_0x43b9a2,_0x2c80c8,_0x37cee1){logger['info'](_0x2c80c8);logger[_0xc635('0x1a')](_0x37cee1);if(_0x43b9a2){logger[_0xc635('0x15')](_0x43b9a2);return _0x4f1aac[_0xc635('0x13')](0x1f4)[_0xc635('0x16')](_0x43b9a2);}return _0x4f1aac[_0xc635('0x13')](0xc8)[_0xc635('0x16')]({'output':_0x2c80c8});});};exports['restart']=function(_0x4f571a,_0x5b030c){return pm2[_0xc635('0x1f')](_0xc635('0x20'))[_0xc635('0x21')](function(_0x3d097a){logger[_0xc635('0x1a')](_0xc635('0x22'),_0x3d097a);return _0x5b030c[_0xc635('0x13')](0xc8)[_0xc635('0x16')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xc635('0x23')](function(_0xb4b837){logger['error'](_0xb4b837);return _0x5b030c[_0xc635('0x13')](0x1f4)[_0xc635('0x16')](_0xb4b837);});};exports['migrations']=function(_0x5c7c55,_0x1f3877){var _0x4d6973=fs[_0xc635('0x24')](path[_0xc635('0x25')](config[_0xc635('0x26')],_0xc635('0x27'),_0xc635('0x28')));var _0x19876b=[];for(var _0x2eb77a=0x0;_0x2eb77a<_0x4d6973[_0xc635('0x29')];_0x2eb77a++){var _0x14067d=_0x4d6973[_0x2eb77a]['replace'](_0xc635('0x2a'),'');if(compareVersions(module['exports'][_0xc635('0x4')],_0x14067d)===-0x1){_0x19876b[_0xc635('0x2b')](_0x14067d);}}if(_0x19876b[_0xc635('0x29')]){var _0x56bfb2=_0x19876b[_0xc635('0x2c')](compareVersions);var _0x31c7fd=new Umzug({'storage':_0xc635('0x2d'),'storageOptions':{'model':db[_0xc635('0x2e')],'modelName':'Migration','columnName':_0xc635('0x4')},'migrations':{'params':[db['sequelize'][_0xc635('0x2f')](),db[_0xc635('0x2d')][_0xc635('0x30')],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[_0xc635('0x25')](config['root'],_0xc635('0x27'),_0xc635('0x28')),'pattern':/\.js$/}});_0x31c7fd['up']({'migrations':_[_0xc635('0x31')](_0x56bfb2,function(_0x4f7a66){return _0x4f7a66+_0xc635('0x2a');})})[_0xc635('0x21')](function(){return _0x1f3877[_0xc635('0x13')](0xc8)[_0xc635('0x16')]({'output':_0xc635('0x32')+module[_0xc635('0x11')][_0xc635('0x4')]+_0xc635('0x33')+_[_0xc635('0x34')](_0x56bfb2),'migrations':_[_0xc635('0x25')](_0x56bfb2)});})[_0xc635('0x23')](function(_0x40e299){if(_0x40e299 instanceof db[_0xc635('0x2d')][_0xc635('0x35')]){return _0x1f3877['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1f3877[_0xc635('0x13')](0x1f4)[_0xc635('0x16')](_0x40e299);}});}else{return _0x1f3877['status'](0xc8)['json']({'output':_0xc635('0x36')});}}; \ No newline at end of file +var _0xc027=['info','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','error','migrations','join','server','replace','.js','version','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','../../mysqldb','../../config/logger','update','simple-git','root','query','latest','exports','2.0.0','status','json','fetch'];(function(_0x3cb786,_0x10e575){var _0x197d49=function(_0x5d3289){while(--_0x5d3289){_0x3cb786['push'](_0x3cb786['shift']());}};_0x197d49(++_0x10e575);}(_0xc027,0xab));var _0x7c02=function(_0x34365b,_0x418c5a){_0x34365b=_0x34365b-0x0;var _0x12d73a=_0xc027[_0x34365b];return _0x12d73a;};'use strict';var Umzug=require(_0x7c02('0x0'));var path=require(_0x7c02('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x7c02('0x2'))(module,'version');var compareVersions=require(_0x7c02('0x3'));var exec=require(_0x7c02('0x4'))['exec'];var db=require(_0x7c02('0x5'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x7c02('0x6'))(_0x7c02('0x7'));var git=require(_0x7c02('0x8'))(config[_0x7c02('0x9')]);exports['index']=function(_0x48a864,_0x5b27f5){var _0x481ad7={'current':module['exports']['version'],'phonebar':0x2};if(_0x48a864['query']&&_0x48a864[_0x7c02('0xa')][_0x7c02('0xb')]){return git['fetch']()['tags'](function(_0x3e7a02,_0x24cf4a){_0x481ad7['latest']=(_0x3e7a02?module[_0x7c02('0xc')]['version']:_0x24cf4a[_0x7c02('0xb')])||_0x7c02('0xd');return _0x5b27f5[_0x7c02('0xe')](0xc8)[_0x7c02('0xf')](_0x481ad7);});}else{return _0x5b27f5['status'](0xc8)[_0x7c02('0xf')](_0x481ad7);}};exports['fetch']=function(_0x1bbb11,_0x1b03c2){return git[_0x7c02('0x10')](['origin','master'],function(_0x202001){if(_0x202001){logger['error'](_0x202001);return _0x1b03c2['status'](0x1f4)[_0x7c02('0xf')](_0x202001);}logger[_0x7c02('0x11')]('git\x20fetch');return _0x1b03c2[_0x7c02('0xe')](0xc8)[_0x7c02('0xf')]({'output':_0x7c02('0x12')});});};exports['reset']=function(_0x59ddb8,_0x120492){return git['reset']([_0x7c02('0x13'),_0x7c02('0x14')],function(_0x33ebde){if(_0x33ebde){logger['error'](_0x33ebde);return _0x120492[_0x7c02('0xe')](0x1f4)[_0x7c02('0xf')](_0x33ebde);}logger['info'](_0x7c02('0x15'));return _0x120492['status'](0xc8)[_0x7c02('0xf')]({'output':_0x7c02('0x16')});});};exports[_0x7c02('0x17')]=function(_0x1beefa,_0x3bca5e){exec('npm\x20install\x20--production',function(_0x1e69f4,_0x58a8ca,_0xe9bf6d){logger['info'](_0x58a8ca);logger[_0x7c02('0x11')](_0xe9bf6d);if(_0x1e69f4){logger['error'](_0x1e69f4);return _0x3bca5e[_0x7c02('0xe')](0x1f4)[_0x7c02('0xf')](_0x1e69f4);}return _0x3bca5e[_0x7c02('0xe')](0xc8)[_0x7c02('0xf')]({'output':_0x58a8ca});});};exports[_0x7c02('0x18')]=function(_0x3450ea,_0x56efce){return pm2[_0x7c02('0x18')](_0x7c02('0x19'))[_0x7c02('0x1a')](function(_0x1975fe){logger[_0x7c02('0x11')]('pm2\x20restart\x20motion\x20%s',_0x1975fe);return _0x56efce[_0x7c02('0xe')](0xc8)[_0x7c02('0xf')]({'output':_0x7c02('0x1b')});})[_0x7c02('0x1c')](function(_0x59dae3){logger[_0x7c02('0x1d')](_0x59dae3);return _0x56efce[_0x7c02('0xe')](0x1f4)[_0x7c02('0xf')](_0x59dae3);});};exports[_0x7c02('0x1e')]=function(_0x2595f4,_0x1b4866){var _0x5cc780=fs['readdirSync'](path[_0x7c02('0x1f')](config[_0x7c02('0x9')],_0x7c02('0x20'),_0x7c02('0x1e')));var _0x2ee7a0=[];for(var _0x1a3996=0x0;_0x1a3996<_0x5cc780['length'];_0x1a3996++){var _0x58a1bc=_0x5cc780[_0x1a3996][_0x7c02('0x21')](_0x7c02('0x22'),'');if(compareVersions(module[_0x7c02('0xc')][_0x7c02('0x23')],_0x58a1bc)===-0x1){_0x2ee7a0[_0x7c02('0x24')](_0x58a1bc);}}if(_0x2ee7a0['length']){var _0x40f27c=_0x2ee7a0['sort'](compareVersions);var _0x352e41=new Umzug({'storage':_0x7c02('0x25'),'storageOptions':{'model':db[_0x7c02('0x26')],'modelName':_0x7c02('0x26'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x7c02('0x27')](),db[_0x7c02('0x25')][_0x7c02('0x28')],function(){throw new Error(_0x7c02('0x29'));}],'path':path[_0x7c02('0x1f')](config[_0x7c02('0x9')],_0x7c02('0x20'),_0x7c02('0x1e')),'pattern':/\.js$/}});_0x352e41['up']({'migrations':_[_0x7c02('0x2a')](_0x40f27c,function(_0x36275b){return _0x36275b+'.js';})})['then'](function(){return _0x1b4866[_0x7c02('0xe')](0xc8)['json']({'output':_0x7c02('0x2b')+module[_0x7c02('0xc')][_0x7c02('0x23')]+_0x7c02('0x2c')+_[_0x7c02('0x2d')](_0x40f27c),'migrations':_[_0x7c02('0x1f')](_0x40f27c)});})[_0x7c02('0x1c')](function(_0x407383){if(_0x407383 instanceof db[_0x7c02('0x25')]['UniqueConstraintError']){return _0x1b4866[_0x7c02('0xe')](0xc8)[_0x7c02('0xf')]({'output':_0x7c02('0x2e')});}else{return _0x1b4866['status'](0x1f4)['json'](_0x407383);}});}else{return _0x1b4866[_0x7c02('0xe')](0xc8)[_0x7c02('0xf')]({'output':_0x7c02('0x2e')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b13a60e..898cf7e 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 _0xf16a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x35ba71,_0xa2fbbd){var _0x5f04f4=function(_0x30a04f){while(--_0x30a04f){_0x35ba71['push'](_0x35ba71['shift']());}};_0x5f04f4(++_0xa2fbbd);}(_0xf16a,0xcd));var _0xaf16=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf16a[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0xaf16('0x0'));var path=require(_0xaf16('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf16('0x2'));var router=express[_0xaf16('0x3')]();var fs_extra=require(_0xaf16('0x4'));var auth=require(_0xaf16('0x5'));var interaction=require(_0xaf16('0x6'));var config=require(_0xaf16('0x7'));var controller=require(_0xaf16('0x8'));router[_0xaf16('0x9')]('/',auth[_0xaf16('0xa')](),controller[_0xaf16('0xb')]);router[_0xaf16('0x9')](_0xaf16('0xc'),auth[_0xaf16('0xa')](),controller[_0xaf16('0xd')]);router[_0xaf16('0x9')](_0xaf16('0xe'),auth[_0xaf16('0xa')](),controller[_0xaf16('0xf')]);router['post']('/',auth[_0xaf16('0xa')](),controller[_0xaf16('0x10')]);router[_0xaf16('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xaf16('0x12')]);router['delete'](_0xaf16('0xe'),auth[_0xaf16('0xa')](),controller[_0xaf16('0x13')]);module[_0xaf16('0x14')]=router; \ No newline at end of file +var _0xcdfc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcdfc,0x126));var _0xccdf=function(_0xa507ad,_0x35138c){_0xa507ad=_0xa507ad-0x0;var _0x101b2f=_0xcdfc[_0xa507ad];return _0x101b2f;};'use strict';var multer=require(_0xccdf('0x0'));var util=require(_0xccdf('0x1'));var path=require(_0xccdf('0x2'));var timeout=require('connect-timeout');var express=require(_0xccdf('0x3'));var router=express[_0xccdf('0x4')]();var fs_extra=require(_0xccdf('0x5'));var auth=require(_0xccdf('0x6'));var interaction=require(_0xccdf('0x7'));var config=require(_0xccdf('0x8'));var controller=require(_0xccdf('0x9'));router[_0xccdf('0xa')]('/',auth[_0xccdf('0xb')](),controller[_0xccdf('0xc')]);router['get']('/describe',auth[_0xccdf('0xb')](),controller['describe']);router[_0xccdf('0xa')](_0xccdf('0xd'),auth['isAuthenticated'](),controller[_0xccdf('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xccdf('0xf')]);router[_0xccdf('0x10')](_0xccdf('0xd'),auth[_0xccdf('0xb')](),controller[_0xccdf('0x11')]);router['delete']('/:id',auth[_0xccdf('0xb')](),controller[_0xccdf('0x12')]);module[_0xccdf('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 5458516..f86b380 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 _0x1131=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x3f4d3b,_0x26e43d){var _0x1dc7b8=function(_0x1e6309){while(--_0x1e6309){_0x3f4d3b['push'](_0x3f4d3b['shift']());}};_0x1dc7b8(++_0x26e43d);}(_0x1131,0x71));var _0x1113=function(_0x34d1bf,_0x391552){_0x34d1bf=_0x34d1bf-0x0;var _0x5067fb=_0x1131[_0x34d1bf];return _0x5067fb;};'use strict';var Sequelize=require('sequelize');module[_0x1113('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1113('0x1')]},'queue':{'type':Sequelize[_0x1113('0x1')]},'interface':{'type':Sequelize[_0x1113('0x1')]},'membername':{'type':Sequelize[_0x1113('0x1')]},'agentcalledAt':{'type':Sequelize[_0x1113('0x2')]},'agentconnectAt':{'type':Sequelize[_0x1113('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x1113('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x1113('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1113('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1113('0x3')]},'agentacw':{'type':Sequelize[_0x1113('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1113('0x3')]},'reason':{'type':Sequelize[_0x1113('0x1')]},'lastevent':{'type':Sequelize[_0x1113('0x1')]},'channel':{'type':Sequelize[_0x1113('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1113('0x1')]},'connectedlinename':{'type':Sequelize[_0x1113('0x1')]},'language':{'type':Sequelize[_0x1113('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1113('0x1')]},'exten':{'type':Sequelize[_0x1113('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1113('0x1')]},'destchannelstate':{'type':Sequelize[_0x1113('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1113('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1113('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1113('0x1')]},'destcontext':{'type':Sequelize[_0x1113('0x1')]},'destexten':{'type':Sequelize[_0x1113('0x1')]},'destpriority':{'type':Sequelize[_0x1113('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x1113('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x1113('0x1')]},'transfer':{'type':Sequelize[_0x1113('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1113('0x1')],'comment':_0x1113('0x5')},'transferexten':{'type':Sequelize[_0x1113('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1113('0x1')]},'agententerreason':{'type':Sequelize[_0x1113('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b0e=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x5db818,_0x10281e){var _0x2dba88=function(_0x484410){while(--_0x484410){_0x5db818['push'](_0x5db818['shift']());}};_0x2dba88(++_0x10281e);}(_0x1b0e,0x132));var _0xe1b0=function(_0x545bcd,_0x9ac474){_0x545bcd=_0x545bcd-0x0;var _0x4d6541=_0x1b0e[_0x545bcd];return _0x4d6541;};'use strict';var Sequelize=require(_0xe1b0('0x0'));module[_0xe1b0('0x1')]={'type':{'type':Sequelize[_0xe1b0('0x2')]},'uniqueid':{'type':Sequelize[_0xe1b0('0x2')]},'calleridnum':{'type':Sequelize[_0xe1b0('0x2')]},'calleridname':{'type':Sequelize[_0xe1b0('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe1b0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe1b0('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xe1b0('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe1b0('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe1b0('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe1b0('0x5')]},'agentacw':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe1b0('0x5')]},'reason':{'type':Sequelize[_0xe1b0('0x2')]},'lastevent':{'type':Sequelize[_0xe1b0('0x2')]},'channel':{'type':Sequelize[_0xe1b0('0x2')]},'channelstate':{'type':Sequelize[_0xe1b0('0x5')]},'channelstatedesc':{'type':Sequelize[_0xe1b0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe1b0('0x2')]},'connectedlinename':{'type':Sequelize[_0xe1b0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe1b0('0x2')]},'context':{'type':Sequelize[_0xe1b0('0x2')]},'exten':{'type':Sequelize[_0xe1b0('0x2')]},'priority':{'type':Sequelize[_0xe1b0('0x2')]},'destchannel':{'type':Sequelize[_0xe1b0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe1b0('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xe1b0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe1b0('0x2')]},'destcalleridname':{'type':Sequelize[_0xe1b0('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe1b0('0x2')]},'destlanguage':{'type':Sequelize[_0xe1b0('0x2')]},'destaccountcode':{'type':Sequelize[_0xe1b0('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe1b0('0x2')]},'destuniqueid':{'type':Sequelize[_0xe1b0('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe1b0('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe1b0('0x2')]},'transfer':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe1b0('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xe1b0('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe1b0('0x2')]},'agententerreason':{'type':Sequelize[_0xe1b0('0x5')],'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 008c85e..f7aa530 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(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 4d6ca28..dc9ab3f 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 _0xc03e=['bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api'];(function(_0x1ee807,_0x49ae76){var _0x453276=function(_0xc77139){while(--_0xc77139){_0x1ee807['push'](_0x1ee807['shift']());}};_0x453276(++_0x49ae76);}(_0xc03e,0x15a));var _0xec03=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc03e[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xec03('0xa'),_0xec03('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68f5=['bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment'];(function(_0x26f44c,_0x55d729){var _0x43d26e=function(_0x5c9346){while(--_0x5c9346){_0x26f44c['push'](_0x26f44c['shift']());}};_0x43d26e(++_0x55d729);}(_0x68f5,0x11a));var _0x568f=function(_0x52d28a,_0xcea297){_0x52d28a=_0x52d28a-0x0;var _0x3ad972=_0x68f5[_0x52d28a];return _0x3ad972;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))('api');var moment=require(_0x568f('0x3'));var BPromise=require(_0x568f('0x4'));var rp=require(_0x568f('0x5'));var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x31444b,_0x3181fd){return _0x31444b['define']('VoiceAgentReport',attributes,{'tableName':_0x568f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x568f('0xb'),_0x568f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1ebd1ef..30769c3 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 _0x8a08=['attributes','limit','then','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','UpdateVoiceAgentReport','where'];(function(_0x59d2bf,_0x39f68d){var _0x465188=function(_0x45c55f){while(--_0x45c55f){_0x59d2bf['push'](_0x59d2bf['shift']());}};_0x465188(++_0x39f68d);}(_0x8a08,0x94));var _0x88a0=function(_0x1ef75d,_0x27a85b){_0x1ef75d=_0x1ef75d-0x0;var _0x37cb2f=_0x8a08[_0x1ef75d];return _0x37cb2f;};'use strict';var _=require(_0x88a0('0x0'));var util=require(_0x88a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a0('0x2'));var db=require(_0x88a0('0x3'))['db'];var utils=require(_0x88a0('0x4'));var logger=require(_0x88a0('0x5'))(_0x88a0('0x6'));var config=require(_0x88a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x88a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdab96f,_0x896c13,_0x1310e4){return new BPromise(function(_0x508340,_0x498cd4){return client[_0x88a0('0x9')](_0xdab96f,_0x1310e4)['then'](function(_0x15d69a){logger[_0x88a0('0xa')](_0x88a0('0xb'),_0x896c13,_0x88a0('0xc'));logger['debug'](_0x88a0('0xd'),_0x896c13,_0x88a0('0xc'),JSON['stringify'](_0x15d69a));if(_0x15d69a[_0x88a0('0xe')]){if(_0x15d69a[_0x88a0('0xe')][_0x88a0('0xf')]===0x1f4){logger[_0x88a0('0xe')](_0x88a0('0xb'),_0x896c13,_0x15d69a['error']['message']);return _0x498cd4(_0x15d69a[_0x88a0('0xe')][_0x88a0('0x10')]);}logger[_0x88a0('0xe')](_0x88a0('0xb'),_0x896c13,_0x15d69a[_0x88a0('0xe')]['message']);return _0x508340(_0x15d69a[_0x88a0('0xe')][_0x88a0('0x10')]);}else{logger[_0x88a0('0xa')](_0x88a0('0xb'),_0x896c13,_0x88a0('0xc'));_0x508340(_0x15d69a['result']['message']);}})[_0x88a0('0x11')](function(_0x28f2b6){logger[_0x88a0('0xe')](_0x88a0('0xb'),_0x896c13,_0x28f2b6);_0x498cd4(_0x28f2b6);});});}exports[_0x88a0('0x12')]=function(_0x5680a6){var _0x29d77a=this;return new Promise(function(_0x6cb35b,_0x379acd){return db[_0x88a0('0x13')][_0x88a0('0x14')](_0x5680a6['body'],{'raw':_0x5680a6[_0x88a0('0x15')]?_0x5680a6['options'][_0x88a0('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2bf3de){logger['info'](_0x88a0('0x12'),_0x5680a6);logger['debug'](_0x88a0('0x12'),_0x5680a6,JSON[_0x88a0('0x17')](_0x2bf3de));_0x6cb35b(_0x2bf3de);})[_0x88a0('0x11')](function(_0x3ef884){logger['error'](_0x88a0('0x12'),_0x3ef884['message'],_0x5680a6);_0x379acd(_0x29d77a['error'](0x1f4,_0x3ef884['message']));});});};exports[_0x88a0('0x18')]=function(_0x259800){var _0x5a84e5=this;return new Promise(function(_0x38fc80,_0x2af6b2){return db[_0x88a0('0x13')]['update'](_0x259800['body'],{'raw':_0x259800[_0x88a0('0x15')]?_0x259800[_0x88a0('0x15')][_0x88a0('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x259800[_0x88a0('0x15')]?_0x259800['options'][_0x88a0('0x19')]||null:null,'attributes':_0x259800[_0x88a0('0x15')]?_0x259800[_0x88a0('0x15')][_0x88a0('0x1a')]||null:null,'limit':_0x259800['options']?_0x259800['options'][_0x88a0('0x1b')]||null:null})[_0x88a0('0x1c')](function(_0x1e9fde){logger[_0x88a0('0xa')](_0x88a0('0x18'),_0x259800);logger['debug']('UpdateVoiceAgentReport',_0x259800,JSON['stringify'](_0x1e9fde));_0x38fc80(_0x1e9fde);})[_0x88a0('0x11')](function(_0x386a9a){logger[_0x88a0('0xe')](_0x88a0('0x18'),_0x386a9a['message'],_0x259800);_0x2af6b2(_0x5a84e5[_0x88a0('0xe')](0x1f4,_0x386a9a[_0x88a0('0x10')]));});});}; \ No newline at end of file +var _0x0d25=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','VoiceAgentReport','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xa99439,_0x2400f9){var _0x121716=function(_0x3a7295){while(--_0x3a7295){_0xa99439['push'](_0xa99439['shift']());}};_0x121716(++_0x2400f9);}(_0x0d25,0x1d5));var _0x50d2=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0x0d25[_0x10aa73];return _0x3496d9;};'use strict';var _=require(_0x50d2('0x0'));var util=require(_0x50d2('0x1'));var moment=require(_0x50d2('0x2'));var BPromise=require(_0x50d2('0x3'));var rs=require(_0x50d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50d2('0x5'))['db'];var utils=require(_0x50d2('0x6'));var logger=require(_0x50d2('0x7'))(_0x50d2('0x8'));var config=require(_0x50d2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x50d2('0xa')][_0x50d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a00bd,_0x2d9454,_0x1ea8fb){return new BPromise(function(_0x588518,_0x31f84c){return client[_0x50d2('0xc')](_0x5a00bd,_0x1ea8fb)[_0x50d2('0xd')](function(_0x4dae6e){logger[_0x50d2('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x2d9454,'request\x20sent');logger[_0x50d2('0xf')](_0x50d2('0x10'),_0x2d9454,_0x50d2('0x11'),JSON[_0x50d2('0x12')](_0x4dae6e));if(_0x4dae6e['error']){if(_0x4dae6e[_0x50d2('0x13')][_0x50d2('0x14')]===0x1f4){logger[_0x50d2('0x13')](_0x50d2('0x15'),_0x2d9454,_0x4dae6e['error']['message']);return _0x31f84c(_0x4dae6e[_0x50d2('0x13')][_0x50d2('0x16')]);}logger[_0x50d2('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x2d9454,_0x4dae6e[_0x50d2('0x13')]['message']);return _0x588518(_0x4dae6e[_0x50d2('0x13')][_0x50d2('0x16')]);}else{logger[_0x50d2('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x2d9454,_0x50d2('0x11'));_0x588518(_0x4dae6e['result'][_0x50d2('0x16')]);}})[_0x50d2('0x17')](function(_0x2ebfc3){logger[_0x50d2('0x13')](_0x50d2('0x15'),_0x2d9454,_0x2ebfc3);_0x31f84c(_0x2ebfc3);});});}exports['CreateVoiceAgentReport']=function(_0x404ba0){var _0x3be9ed=this;return new Promise(function(_0x3d1e92,_0x5b7b8a){return db[_0x50d2('0x18')]['create'](_0x404ba0[_0x50d2('0x19')],{'raw':_0x404ba0[_0x50d2('0x1a')]?_0x404ba0['options']['raw']===undefined?!![]:![]:!![]})[_0x50d2('0xd')](function(_0x24fdb9){logger[_0x50d2('0xe')]('CreateVoiceAgentReport',_0x404ba0);logger['debug'](_0x50d2('0x1b'),_0x404ba0,JSON[_0x50d2('0x12')](_0x24fdb9));_0x3d1e92(_0x24fdb9);})[_0x50d2('0x17')](function(_0x1ac390){logger[_0x50d2('0x13')](_0x50d2('0x1b'),_0x1ac390['message'],_0x404ba0);_0x5b7b8a(_0x3be9ed['error'](0x1f4,_0x1ac390[_0x50d2('0x16')]));});});};exports[_0x50d2('0x1c')]=function(_0x1ec2c7){var _0x45ed8c=this;return new Promise(function(_0x275f2f,_0x170a23){return db['VoiceAgentReport'][_0x50d2('0x1d')](_0x1ec2c7[_0x50d2('0x19')],{'raw':_0x1ec2c7[_0x50d2('0x1a')]?_0x1ec2c7[_0x50d2('0x1a')][_0x50d2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec2c7['options']?_0x1ec2c7[_0x50d2('0x1a')][_0x50d2('0x1f')]||null:null,'attributes':_0x1ec2c7[_0x50d2('0x1a')]?_0x1ec2c7[_0x50d2('0x1a')][_0x50d2('0x20')]||null:null,'limit':_0x1ec2c7['options']?_0x1ec2c7[_0x50d2('0x1a')][_0x50d2('0x21')]||null:null})[_0x50d2('0xd')](function(_0x46265f){logger[_0x50d2('0xe')](_0x50d2('0x1c'),_0x1ec2c7);logger[_0x50d2('0xf')]('UpdateVoiceAgentReport',_0x1ec2c7,JSON[_0x50d2('0x12')](_0x46265f));_0x275f2f(_0x46265f);})[_0x50d2('0x17')](function(_0x4089e7){logger[_0x50d2('0x13')](_0x50d2('0x1c'),_0x4089e7[_0x50d2('0x16')],_0x1ec2c7);_0x170a23(_0x45ed8c['error'](0x1f4,_0x4089e7[_0x50d2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4bcd40f..863f0f5 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 _0x0309=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','path','express'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0309,0x165));var _0x9030=function(_0x6ae24d,_0x590046){_0x6ae24d=_0x6ae24d-0x0;var _0x2ec273=_0x0309[_0x6ae24d];return _0x2ec273;};'use strict';var multer=require(_0x9030('0x0'));var util=require('util');var path=require(_0x9030('0x1'));var timeout=require('connect-timeout');var express=require(_0x9030('0x2'));var router=express[_0x9030('0x3')]();var fs_extra=require(_0x9030('0x4'));var auth=require(_0x9030('0x5'));var interaction=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var controller=require(_0x9030('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9030('0x9')]);router[_0x9030('0xa')]('/describe',auth[_0x9030('0xb')](),controller['describe']);router[_0x9030('0xa')](_0x9030('0xc'),auth[_0x9030('0xb')](),controller['show']);router[_0x9030('0xd')]('/',auth[_0x9030('0xb')](),controller[_0x9030('0xe')]);router['put'](_0x9030('0xc'),auth[_0x9030('0xb')](),controller[_0x9030('0xf')]);router[_0x9030('0x10')](_0x9030('0xc'),auth[_0x9030('0xb')](),controller[_0x9030('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6334=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2579ca,_0x3724bd){var _0x5c9645=function(_0xc1b0c1){while(--_0xc1b0c1){_0x2579ca['push'](_0x2579ca['shift']());}};_0x5c9645(++_0x3724bd);}(_0x6334,0x119));var _0x4633=function(_0xea1570,_0x2f7856){_0xea1570=_0xea1570-0x0;var _0x579e74=_0x6334[_0xea1570];return _0x579e74;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0xe')]);router[_0x4633('0xa')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0xf')]);router[_0x4633('0x10')]('/',auth['isAuthenticated'](),controller[_0x4633('0x11')]);router[_0x4633('0x12')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0x13')]);router[_0x4633('0x14')](_0x4633('0x15'),auth['isAuthenticated'](),controller[_0x4633('0x16')]);module[_0x4633('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6b7a8b1..42fbcd9 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 _0xcabe=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','internal','outbound'];(function(_0x4ae525,_0x2ebe1a){var _0x522bdc=function(_0x149cda){while(--_0x149cda){_0x4ae525['push'](_0x4ae525['shift']());}};_0x522bdc(++_0x2ebe1a);}(_0xcabe,0x1ef));var _0xecab=function(_0x421372,_0x40eb37){_0x421372=_0x421372-0x0;var _0xed0d73=_0xcabe[_0x421372];return _0xed0d73;};'use strict';var Sequelize=require(_0xecab('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xecab('0x1')]},'type':{'type':Sequelize[_0xecab('0x2')]('inbound',_0xecab('0x3'),_0xecab('0x4'),'inbound-fax',_0xecab('0x5'),_0xecab('0x6'))},'tag':{'type':Sequelize[_0xecab('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xecab('0x1')]},'destination':{'type':Sequelize[_0xecab('0x1')]},'destinationcontext':{'type':Sequelize[_0xecab('0x1')]},'callerid':{'type':Sequelize[_0xecab('0x1')]},'channel':{'type':Sequelize[_0xecab('0x1')]},'destinationchannel':{'type':Sequelize[_0xecab('0x1')]},'lastapplication':{'type':Sequelize[_0xecab('0x1')]},'lastdata':{'type':Sequelize[_0xecab('0x7')]},'starttime':{'type':Sequelize[_0xecab('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xecab('0x8')]},'duration':{'type':Sequelize[_0xecab('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xecab('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xecab('0x1')]},'amaflags':{'type':Sequelize[_0xecab('0x1')]},'userfield':{'type':Sequelize[_0xecab('0x1')]},'userDisposition':{'type':Sequelize[_0xecab('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xecab('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xecab('0x1')]},'prefix':{'type':Sequelize[_0xecab('0x1')]},'routeid':{'type':Sequelize[_0xecab('0x9')]},'sipcallid':{'type':Sequelize[_0xecab('0x1')]}}; \ No newline at end of file +var _0x8651=['TEXT','DATE','INTEGER','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x8651,0x142));var _0x1865=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x8651[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require('sequelize');module[_0x1865('0x0')]={'uniqueid':{'type':Sequelize[_0x1865('0x1')]},'type':{'type':Sequelize['ENUM'](_0x1865('0x2'),_0x1865('0x3'),_0x1865('0x4'),_0x1865('0x5'),_0x1865('0x6'),_0x1865('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x1865('0x1')]},'destinationcontext':{'type':Sequelize[_0x1865('0x1')]},'callerid':{'type':Sequelize[_0x1865('0x1')]},'channel':{'type':Sequelize[_0x1865('0x1')]},'destinationchannel':{'type':Sequelize[_0x1865('0x1')]},'lastapplication':{'type':Sequelize[_0x1865('0x1')]},'lastdata':{'type':Sequelize[_0x1865('0x8')]},'starttime':{'type':Sequelize[_0x1865('0x9')]},'systemanswertime':{'type':Sequelize[_0x1865('0x9')]},'answertime':{'type':Sequelize[_0x1865('0x9')]},'endtime':{'type':Sequelize[_0x1865('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x1865('0xa')]},'mohtime':{'type':Sequelize[_0x1865('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1865('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x1865('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x1865('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1865('0x1')]},'routeid':{'type':Sequelize[_0x1865('0xa')]},'sipcallid':{'type':Sequelize[_0x1865('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7486d16..258a5df 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x3bb7ed,_0x207533){_0x3bb7ed=_0x3bb7ed-0x0;var _0x3db7cc=_0x2032[_0x3bb7ed];return _0x3db7cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x474208,_0xc96190){var _0xbd3146=function(_0x3b3d2d){while(--_0x3b3d2d){_0x474208['push'](_0x474208['shift']());}};_0xbd3146(++_0xc96190);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d773f,_0x3462b3){_0x3d773f=_0x3d773f-0x0;var _0x22bf3a=_0x0b0e[_0x3d773f];return _0x22bf3a;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 5809711..f849e8d 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 _0x6244=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x5d99bb,_0x10e04b){var _0xdfe846=function(_0x2e3377){while(--_0x2e3377){_0x5d99bb['push'](_0x5d99bb['shift']());}};_0xdfe846(++_0x10e04b);}(_0x6244,0x17b));var _0x4624=function(_0x4363f5,_0x20f286){_0x4363f5=_0x4363f5-0x0;var _0x48636b=_0x6244[_0x4363f5];return _0x48636b;};'use strict';var _=require(_0x4624('0x0'));var util=require(_0x4624('0x1'));var logger=require('../../config/logger')(_0x4624('0x2'));var moment=require(_0x4624('0x3'));var BPromise=require(_0x4624('0x4'));var rp=require(_0x4624('0x5'));var fs=require('fs');var path=require(_0x4624('0x6'));var rimraf=require(_0x4624('0x7'));var config=require(_0x4624('0x8'));var attributes=require(_0x4624('0x9'));module[_0x4624('0xa')]=function(_0x2c89f7,_0x12d583){return _0x2c89f7['define'](_0x4624('0xb'),attributes,{'tableName':_0x4624('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4624('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ea=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceCallReport.attributes','define','VoiceCallReport','report_call'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0xd8ea,0xb7));var _0xad8e=function(_0x471b36,_0x2095a9){_0x471b36=_0x471b36-0x0;var _0x1e10c6=_0xd8ea[_0x471b36];return _0x1e10c6;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var logger=require(_0xad8e('0x2'))(_0xad8e('0x3'));var moment=require(_0xad8e('0x4'));var BPromise=require(_0xad8e('0x5'));var rp=require(_0xad8e('0x6'));var fs=require('fs');var path=require(_0xad8e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad8e('0x8'));module['exports']=function(_0x57f633,_0x4f05d1){return _0x57f633[_0xad8e('0x9')](_0xad8e('0xa'),attributes,{'tableName':_0xad8e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xad8e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 82b5b6d..c3ea922 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 _0xa669=['randomstring','../../mysqldb','../../config/utils','jayson/promise','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','CreateVoiceCallReport','create','catch','UpdateVoiceCallReport','update','body','lodash','util','bluebird'];(function(_0x34716c,_0x3555e0){var _0x2d2c70=function(_0x443828){while(--_0x443828){_0x34716c['push'](_0x34716c['shift']());}};_0x2d2c70(++_0x3555e0);}(_0xa669,0x1b7));var _0x9a66=function(_0x27e707,_0x365d81){_0x27e707=_0x27e707-0x0;var _0x2c04a5=_0xa669[_0x27e707];return _0x2c04a5;};'use strict';var _=require(_0x9a66('0x0'));var util=require(_0x9a66('0x1'));var moment=require('moment');var BPromise=require(_0x9a66('0x2'));var rs=require(_0x9a66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a66('0x4'))['db'];var utils=require(_0x9a66('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9a66('0x6'));var client=jayson['client'][_0x9a66('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x121e17,_0x367987,_0x3ffd03){return new BPromise(function(_0x294281,_0x519f11){return client['request'](_0x121e17,_0x3ffd03)[_0x9a66('0x8')](function(_0xb3672){logger[_0x9a66('0x9')](_0x9a66('0xa'),_0x367987,_0x9a66('0xb'));logger[_0x9a66('0xc')](_0x9a66('0xd'),_0x367987,_0x9a66('0xb'),JSON[_0x9a66('0xe')](_0xb3672));if(_0xb3672['error']){if(_0xb3672[_0x9a66('0xf')]['code']===0x1f4){logger[_0x9a66('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x367987,_0xb3672[_0x9a66('0xf')][_0x9a66('0x10')]);return _0x519f11(_0xb3672[_0x9a66('0xf')][_0x9a66('0x10')]);}logger['error'](_0x9a66('0xa'),_0x367987,_0xb3672[_0x9a66('0xf')][_0x9a66('0x10')]);return _0x294281(_0xb3672[_0x9a66('0xf')][_0x9a66('0x10')]);}else{logger[_0x9a66('0x9')](_0x9a66('0xa'),_0x367987,'request\x20sent');_0x294281(_0xb3672[_0x9a66('0x11')][_0x9a66('0x10')]);}})['catch'](function(_0x3f54d6){logger[_0x9a66('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x367987,_0x3f54d6);_0x519f11(_0x3f54d6);});});}exports[_0x9a66('0x12')]=function(_0x5589e0){var _0x206a88=this;return new Promise(function(_0x1d0846,_0x5a2440){return db[_0x9a66('0x13')]['findAll']({'raw':_0x5589e0['options']?_0x5589e0[_0x9a66('0x14')][_0x9a66('0x15')]===undefined?!![]:![]:!![],'where':_0x5589e0['options']?_0x5589e0[_0x9a66('0x14')][_0x9a66('0x16')]||null:null,'attributes':_0x5589e0[_0x9a66('0x14')]?_0x5589e0['options'][_0x9a66('0x17')]||null:null,'limit':_0x5589e0[_0x9a66('0x14')]?_0x5589e0['options'][_0x9a66('0x18')]||null:null,'include':_0x5589e0['options']?_0x5589e0[_0x9a66('0x14')]['include']?_[_0x9a66('0x19')](_0x5589e0[_0x9a66('0x14')][_0x9a66('0x1a')],function(_0x4bb109){return{'model':db[_0x4bb109[_0x9a66('0x1b')]],'as':_0x4bb109['as'],'attributes':_0x4bb109[_0x9a66('0x17')],'include':_0x4bb109[_0x9a66('0x1a')]?_['map'](_0x4bb109[_0x9a66('0x1a')],function(_0x25e679){return{'model':db[_0x25e679[_0x9a66('0x1b')]],'as':_0x25e679['as'],'attributes':_0x25e679['attributes'],'include':_0x25e679[_0x9a66('0x1a')]?_[_0x9a66('0x19')](_0x25e679['include'],function(_0x522feb){return{'model':db[_0x522feb['model']],'as':_0x522feb['as'],'attributes':_0x522feb[_0x9a66('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9a66('0x8')](function(_0x10fb8b){logger[_0x9a66('0x9')](_0x9a66('0x12'),_0x5589e0);logger[_0x9a66('0xc')](_0x9a66('0x12'),_0x5589e0,JSON[_0x9a66('0xe')](_0x10fb8b));_0x1d0846(_0x10fb8b);})['catch'](function(_0x6c3a3d){logger['error'](_0x9a66('0x12'),_0x6c3a3d[_0x9a66('0x10')],_0x5589e0);_0x5a2440(_0x206a88['error'](0x1f4,_0x6c3a3d['message']));});});};exports[_0x9a66('0x1c')]=function(_0x3e0222){var _0x432c10=this;return new Promise(function(_0xd2a7e2,_0x44ca78){return db['VoiceCallReport'][_0x9a66('0x1d')](_0x3e0222['body'],{'raw':_0x3e0222[_0x9a66('0x14')]?_0x3e0222[_0x9a66('0x14')][_0x9a66('0x15')]===undefined?!![]:![]:!![]})[_0x9a66('0x8')](function(_0x3a63b9){logger[_0x9a66('0x9')](_0x9a66('0x1c'),_0x3e0222);logger['debug'](_0x9a66('0x1c'),_0x3e0222,JSON[_0x9a66('0xe')](_0x3a63b9));_0xd2a7e2(_0x3a63b9);})[_0x9a66('0x1e')](function(_0x88cb33){logger[_0x9a66('0xf')](_0x9a66('0x1c'),_0x88cb33['message'],_0x3e0222);_0x44ca78(_0x432c10[_0x9a66('0xf')](0x1f4,_0x88cb33[_0x9a66('0x10')]));});});};exports[_0x9a66('0x1f')]=function(_0x9f82aa){var _0xbea9ca=this;return new Promise(function(_0x6336a,_0x48f916){return db['VoiceCallReport'][_0x9a66('0x20')](_0x9f82aa[_0x9a66('0x21')],{'raw':_0x9f82aa[_0x9a66('0x14')]?_0x9f82aa[_0x9a66('0x14')][_0x9a66('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9f82aa[_0x9a66('0x14')]?_0x9f82aa['options'][_0x9a66('0x16')]||null:null,'attributes':_0x9f82aa['options']?_0x9f82aa[_0x9a66('0x14')][_0x9a66('0x17')]||null:null,'limit':_0x9f82aa['options']?_0x9f82aa[_0x9a66('0x14')][_0x9a66('0x18')]||null:null})[_0x9a66('0x8')](function(_0x725cba){logger[_0x9a66('0x9')](_0x9a66('0x1f'),_0x9f82aa);logger[_0x9a66('0xc')]('UpdateVoiceCallReport',_0x9f82aa,JSON[_0x9a66('0xe')](_0x725cba));_0x6336a(_0x725cba);})[_0x9a66('0x1e')](function(_0xf07ae5){logger[_0x9a66('0xf')]('UpdateVoiceCallReport',_0xf07ae5[_0x9a66('0x10')],_0x9f82aa);_0x48f916(_0xbea9ca[_0x9a66('0xf')](0x1f4,_0xf07ae5[_0x9a66('0x10')]));});});}; \ No newline at end of file +var _0xb8fc=['attributes','limit','include','map','model','CreateVoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','options','where'];(function(_0x4d770a,_0x4bd9ca){var _0x154cac=function(_0x2e8e1d){while(--_0x2e8e1d){_0x4d770a['push'](_0x4d770a['shift']());}};_0x154cac(++_0x4bd9ca);}(_0xb8fc,0x186));var _0xcb8f=function(_0x38d034,_0x22f267){_0x38d034=_0x38d034-0x0;var _0x1a3768=_0xb8fc[_0x38d034];return _0x1a3768;};'use strict';var _=require(_0xcb8f('0x0'));var util=require(_0xcb8f('0x1'));var moment=require(_0xcb8f('0x2'));var BPromise=require(_0xcb8f('0x3'));var rs=require(_0xcb8f('0x4'));var fs=require('fs');var Redis=require(_0xcb8f('0x5'));var db=require(_0xcb8f('0x6'))['db'];var utils=require(_0xcb8f('0x7'));var logger=require(_0xcb8f('0x8'))(_0xcb8f('0x9'));var config=require('../../config/environment');var jayson=require(_0xcb8f('0xa'));var client=jayson['client'][_0xcb8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x468a7d,_0x437c0d,_0x163a92){return new BPromise(function(_0x48ca55,_0x32a6e5){return client[_0xcb8f('0xc')](_0x468a7d,_0x163a92)[_0xcb8f('0xd')](function(_0x1691c3){logger[_0xcb8f('0xe')](_0xcb8f('0xf'),_0x437c0d,_0xcb8f('0x10'));logger[_0xcb8f('0x11')](_0xcb8f('0x12'),_0x437c0d,_0xcb8f('0x10'),JSON[_0xcb8f('0x13')](_0x1691c3));if(_0x1691c3[_0xcb8f('0x14')]){if(_0x1691c3['error'][_0xcb8f('0x15')]===0x1f4){logger['error'](_0xcb8f('0xf'),_0x437c0d,_0x1691c3[_0xcb8f('0x14')][_0xcb8f('0x16')]);return _0x32a6e5(_0x1691c3[_0xcb8f('0x14')][_0xcb8f('0x16')]);}logger[_0xcb8f('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x437c0d,_0x1691c3[_0xcb8f('0x14')][_0xcb8f('0x16')]);return _0x48ca55(_0x1691c3['error'][_0xcb8f('0x16')]);}else{logger[_0xcb8f('0xe')](_0xcb8f('0xf'),_0x437c0d,_0xcb8f('0x10'));_0x48ca55(_0x1691c3['result']['message']);}})[_0xcb8f('0x17')](function(_0x4ede6e){logger[_0xcb8f('0x14')](_0xcb8f('0xf'),_0x437c0d,_0x4ede6e);_0x32a6e5(_0x4ede6e);});});}exports[_0xcb8f('0x18')]=function(_0xa623c){var _0x338bb6=this;return new Promise(function(_0x1b273e,_0x124d68){return db[_0xcb8f('0x19')]['findAll']({'raw':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1b')]||null:null,'attributes':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1c')]||null:null,'limit':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1d')]||null:null,'include':_0xa623c[_0xcb8f('0x1a')]?_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1e')]?_[_0xcb8f('0x1f')](_0xa623c[_0xcb8f('0x1a')][_0xcb8f('0x1e')],function(_0x4e2b6f){return{'model':db[_0x4e2b6f[_0xcb8f('0x20')]],'as':_0x4e2b6f['as'],'attributes':_0x4e2b6f[_0xcb8f('0x1c')],'include':_0x4e2b6f[_0xcb8f('0x1e')]?_['map'](_0x4e2b6f[_0xcb8f('0x1e')],function(_0x57580d){return{'model':db[_0x57580d[_0xcb8f('0x20')]],'as':_0x57580d['as'],'attributes':_0x57580d[_0xcb8f('0x1c')],'include':_0x57580d[_0xcb8f('0x1e')]?_['map'](_0x57580d[_0xcb8f('0x1e')],function(_0x18633b){return{'model':db[_0x18633b[_0xcb8f('0x20')]],'as':_0x18633b['as'],'attributes':_0x18633b[_0xcb8f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcb8f('0xd')](function(_0x3068f4){logger[_0xcb8f('0xe')]('GetVoiceCallReport',_0xa623c);logger['debug']('GetVoiceCallReport',_0xa623c,JSON['stringify'](_0x3068f4));_0x1b273e(_0x3068f4);})['catch'](function(_0x4d41c3){logger['error'](_0xcb8f('0x18'),_0x4d41c3[_0xcb8f('0x16')],_0xa623c);_0x124d68(_0x338bb6['error'](0x1f4,_0x4d41c3['message']));});});};exports[_0xcb8f('0x21')]=function(_0x3e3acc){var _0x319b82=this;return new Promise(function(_0x58a0d8,_0x54dcd){return db[_0xcb8f('0x19')][_0xcb8f('0x22')](_0x3e3acc['body'],{'raw':_0x3e3acc['options']?_0x3e3acc['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x82aff4){logger['info']('CreateVoiceCallReport',_0x3e3acc);logger[_0xcb8f('0x11')](_0xcb8f('0x21'),_0x3e3acc,JSON[_0xcb8f('0x13')](_0x82aff4));_0x58a0d8(_0x82aff4);})[_0xcb8f('0x17')](function(_0x1ab70c){logger[_0xcb8f('0x14')]('CreateVoiceCallReport',_0x1ab70c[_0xcb8f('0x16')],_0x3e3acc);_0x54dcd(_0x319b82['error'](0x1f4,_0x1ab70c[_0xcb8f('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x260242){var _0x322f0a=this;return new Promise(function(_0x908c67,_0x1cfab5){return db['VoiceCallReport'][_0xcb8f('0x23')](_0x260242[_0xcb8f('0x24')],{'raw':_0x260242[_0xcb8f('0x1a')]?_0x260242['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260242['options']?_0x260242[_0xcb8f('0x1a')][_0xcb8f('0x1b')]||null:null,'attributes':_0x260242['options']?_0x260242[_0xcb8f('0x1a')][_0xcb8f('0x1c')]||null:null,'limit':_0x260242['options']?_0x260242['options'][_0xcb8f('0x1d')]||null:null})[_0xcb8f('0xd')](function(_0x4cda55){logger[_0xcb8f('0xe')](_0xcb8f('0x25'),_0x260242);logger[_0xcb8f('0x11')](_0xcb8f('0x25'),_0x260242,JSON['stringify'](_0x4cda55));_0x908c67(_0x4cda55);})['catch'](function(_0x4105f7){logger[_0xcb8f('0x14')](_0xcb8f('0x25'),_0x4105f7[_0xcb8f('0x16')],_0x260242);_0x1cfab5(_0x322f0a[_0xcb8f('0x14')](0x1f4,_0x4105f7[_0xcb8f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b6e8394..ad6a250 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 _0x2e06=['index','/:id','show','post','isAuthenticated','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x4c99af,_0x4c4319){var _0x6cb2bd=function(_0x53c43b){while(--_0x53c43b){_0x4c99af['push'](_0x4c99af['shift']());}};_0x6cb2bd(++_0x4c4319);}(_0x2e06,0xa9));var _0x62e0=function(_0x4d5ce7,_0x512cc4){_0x4d5ce7=_0x4d5ce7-0x0;var _0x292c73=_0x2e06[_0x4d5ce7];return _0x292c73;};'use strict';var multer=require(_0x62e0('0x0'));var util=require(_0x62e0('0x1'));var path=require(_0x62e0('0x2'));var timeout=require('connect-timeout');var express=require(_0x62e0('0x3'));var router=express[_0x62e0('0x4')]();var fs_extra=require(_0x62e0('0x5'));var auth=require(_0x62e0('0x6'));var interaction=require(_0x62e0('0x7'));var config=require(_0x62e0('0x8'));var controller=require(_0x62e0('0x9'));router[_0x62e0('0xa')]('/',auth['isAuthenticated'](),controller[_0x62e0('0xb')]);router[_0x62e0('0xa')](_0x62e0('0xc'),auth['isAuthenticated'](),controller[_0x62e0('0xd')]);router[_0x62e0('0xe')]('/',auth[_0x62e0('0xf')](),controller[_0x62e0('0x10')]);router['put'](_0x62e0('0xc'),auth[_0x62e0('0xf')](),controller[_0x62e0('0x11')]);router[_0x62e0('0x12')](_0x62e0('0xc'),auth[_0x62e0('0xf')](),controller['destroy']);module[_0x62e0('0x13')]=router; \ No newline at end of file +var _0x3d34=['update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','show','post','/:id'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x3d34,0x1a4));var _0x43d3=function(_0x3a62c9,_0x4656c3){_0x3a62c9=_0x3a62c9-0x0;var _0x26f7b2=_0x3d34[_0x3a62c9];return _0x26f7b2;};'use strict';var multer=require(_0x43d3('0x0'));var util=require(_0x43d3('0x1'));var path=require(_0x43d3('0x2'));var timeout=require(_0x43d3('0x3'));var express=require(_0x43d3('0x4'));var router=express[_0x43d3('0x5')]();var fs_extra=require(_0x43d3('0x6'));var auth=require(_0x43d3('0x7'));var interaction=require(_0x43d3('0x8'));var config=require(_0x43d3('0x9'));var controller=require(_0x43d3('0xa'));router['get']('/',auth[_0x43d3('0xb')](),controller[_0x43d3('0xc')]);router[_0x43d3('0xd')]('/:id',auth[_0x43d3('0xb')](),controller[_0x43d3('0xe')]);router[_0x43d3('0xf')]('/',auth[_0x43d3('0xb')](),controller['create']);router['put'](_0x43d3('0x10'),auth[_0x43d3('0xb')](),controller[_0x43d3('0x11')]);router[_0x43d3('0x12')]('/:id',auth[_0x43d3('0xb')](),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 dc6a6d0..3640ace 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 _0x283e=['STRING','name','setDataValue','join','getDataValue','options','split','sequelize','exports'];(function(_0x5d9848,_0x2fe24c){var _0x13310b=function(_0x108de0){while(--_0x108de0){_0x5d9848['push'](_0x5d9848['shift']());}};_0x13310b(++_0x2fe24c);}(_0x283e,0x1a5));var _0xe283=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x283e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe283('0x0'));module[_0xe283('0x1')]={'name':{'type':Sequelize[_0xe283('0x2')]},'prefix':{'type':Sequelize[_0xe283('0x2')],'unique':_0xe283('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe283('0x2')],'set':function(_0x58742f){this[_0xe283('0x4')]('options',_0x58742f?_0x58742f[_0xe283('0x5')](''):[]);},'get':function(){return this[_0xe283('0x6')](_0xe283('0x7'))?this[_0xe283('0x6')](_0xe283('0x7'))[_0xe283('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe283('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe283('0x2')]},'description':{'type':Sequelize[_0xe283('0x2')]}}; \ No newline at end of file +var _0xf237=['exports','STRING','name','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x3b2d7c,_0x1f7b07){var _0x3e9350=function(_0x586ca9){while(--_0x586ca9){_0x3b2d7c['push'](_0x3b2d7c['shift']());}};_0x3e9350(++_0x1f7b07);}(_0xf237,0x1af));var _0x7f23=function(_0x22b0d5,_0x34f821){_0x22b0d5=_0x22b0d5-0x0;var _0xe1887c=_0xf237[_0x22b0d5];return _0xe1887c;};'use strict';var Sequelize=require(_0x7f23('0x0'));module[_0x7f23('0x1')]={'name':{'type':Sequelize[_0x7f23('0x2')]},'prefix':{'type':Sequelize[_0x7f23('0x2')],'unique':_0x7f23('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x7f23('0x2')],'set':function(_0x592c6a){this['setDataValue']('options',_0x592c6a?_0x592c6a['join'](''):[]);},'get':function(){return this[_0x7f23('0x4')](_0x7f23('0x5'))?this[_0x7f23('0x4')](_0x7f23('0x5'))[_0x7f23('0x6')](''):[];}},'auth':{'type':Sequelize[_0x7f23('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x7f23('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7f23('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6e7df6c..6a2ee08 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 _0x0328=['set','json','apply','reject','update','destroy','then','get','ChanSpies','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count'];(function(_0xce2d7e,_0x56dac4){var _0x3143d9=function(_0x52633b){while(--_0x52633b){_0xce2d7e['push'](_0xce2d7e['shift']());}};_0x3143d9(++_0x56dac4);}(_0x0328,0x172));var _0x8032=function(_0x371268,_0x587020){_0x371268=_0x371268-0x0;var _0x23eca6=_0x0328[_0x371268];return _0x23eca6;};'use strict';var emlformat=require(_0x8032('0x0'));var rimraf=require(_0x8032('0x1'));var zipdir=require(_0x8032('0x2'));var jsonpatch=require(_0x8032('0x3'));var rp=require(_0x8032('0x4'));var moment=require(_0x8032('0x5'));var BPromise=require(_0x8032('0x6'));var Mustache=require('mustache');var util=require(_0x8032('0x7'));var path=require(_0x8032('0x8'));var sox=require(_0x8032('0x9'));var csv=require('to-csv');var ejs=require(_0x8032('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8032('0xb'));var crypto=require(_0x8032('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8032('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8032('0xe'));var Papa=require(_0x8032('0xf'));var Redis=require(_0x8032('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8032('0x11'));var as=require(_0x8032('0x12'));var hardwareService=require(_0x8032('0x13'));var logger=require('../../config/logger')(_0x8032('0x14'));var utils=require('../../config/utils');var config=require(_0x8032('0x15'));var licenseUtil=require(_0x8032('0x16'));var db=require(_0x8032('0x17'))['db'];function respondWithStatusCode(_0x3cb6a9,_0x4290a1){_0x4290a1=_0x4290a1||0xcc;return function(_0x2204e2){if(_0x2204e2){return _0x3cb6a9[_0x8032('0x18')](_0x4290a1);}return _0x3cb6a9[_0x8032('0x19')](_0x4290a1)['end']();};}function respondWithResult(_0x5ac3eb,_0x45dc11){_0x45dc11=_0x45dc11||0xc8;return function(_0x26cfa4){if(_0x26cfa4){return _0x5ac3eb[_0x8032('0x19')](_0x45dc11)['json'](_0x26cfa4);}};}function respondWithFilteredResult(_0x147a17,_0x14a9ba){return function(_0x46c55f){if(_0x46c55f){var _0xb239fe=typeof _0x14a9ba[_0x8032('0x1a')]===_0x8032('0x1b')&&typeof _0x14a9ba[_0x8032('0x1c')]===_0x8032('0x1b');var _0x53cc86=_0x46c55f[_0x8032('0x1d')];var _0x50fde0=_0xb239fe?0x0:_0x14a9ba['offset'];var _0x337e73=_0xb239fe?_0x46c55f[_0x8032('0x1d')]:_0x14a9ba[_0x8032('0x1a')]+_0x14a9ba[_0x8032('0x1c')];var _0x2b6db2;if(_0x337e73>=_0x53cc86){_0x337e73=_0x53cc86;_0x2b6db2=0xc8;}else{_0x2b6db2=0xce;}_0x147a17[_0x8032('0x19')](_0x2b6db2);return _0x147a17[_0x8032('0x1e')]('Content-Range',_0x50fde0+'-'+_0x337e73+'/'+_0x53cc86)[_0x8032('0x1f')](_0x46c55f);}return null;};}function patchUpdates(_0x46abbe){return function(_0x28ccb3){try{jsonpatch[_0x8032('0x20')](_0x28ccb3,_0x46abbe,!![]);}catch(_0x5de784){return BPromise[_0x8032('0x21')](_0x5de784);}return _0x28ccb3['save']();};}function saveUpdates(_0x1da188,_0x1407b6){return function(_0x206951){if(_0x206951){return _0x206951[_0x8032('0x22')](_0x1da188)['then'](function(_0x2e6107){return _0x2e6107;});}return null;};}function removeEntity(_0x109d9e,_0x232a7f){return function(_0x2d5784){if(_0x2d5784){return _0x2d5784[_0x8032('0x23')]()[_0x8032('0x24')](function(){var _0x556c6e=_0x2d5784[_0x8032('0x25')]({'plain':!![]});var _0x2051e7=_0x8032('0x26');return db[_0x8032('0x27')][_0x8032('0x23')]({'where':{'type':_0x2051e7,'resourceId':_0x556c6e['id']}})[_0x8032('0x24')](function(){return _0x2d5784;});})[_0x8032('0x24')](function(){_0x109d9e[_0x8032('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b83b5,_0x1e284f){return function(_0xeb4e88){if(!_0xeb4e88){_0x1b83b5[_0x8032('0x18')](0x194);}return _0xeb4e88;};}function handleError(_0x4d7f5b,_0x15c0d1){_0x15c0d1=_0x15c0d1||0x1f4;return function(_0x3e4e24){logger['error'](_0x3e4e24[_0x8032('0x28')]);if(_0x3e4e24[_0x8032('0x29')]){delete _0x3e4e24[_0x8032('0x29')];}_0x4d7f5b['status'](_0x15c0d1)[_0x8032('0x2a')](_0x3e4e24);};}exports[_0x8032('0x2b')]=function(_0x18dc49,_0x51bbfe){var _0x49d87b={},_0x37ea5e={},_0x41aa48={'count':0x0,'rows':[]};var _0x1f9bfa=_[_0x8032('0x2c')](db['VoiceChanSpy'][_0x8032('0x2d')],function(_0xc57674){return{'name':_0xc57674['fieldName'],'type':_0xc57674[_0x8032('0x2e')][_0x8032('0x2f')]};});_0x37ea5e[_0x8032('0x30')]=_['map'](_0x1f9bfa,_0x8032('0x29'));_0x37ea5e[_0x8032('0x31')]=_[_0x8032('0x32')](_0x18dc49['query']);_0x37ea5e[_0x8032('0x33')]=_[_0x8032('0x34')](_0x37ea5e[_0x8032('0x30')],_0x37ea5e['query']);_0x49d87b[_0x8032('0x35')]=_[_0x8032('0x34')](_0x37ea5e[_0x8032('0x30')],qs[_0x8032('0x36')](_0x18dc49['query'][_0x8032('0x36')]));_0x49d87b['attributes']=_0x49d87b['attributes'][_0x8032('0x37')]?_0x49d87b['attributes']:_0x37ea5e[_0x8032('0x30')];if(!_0x18dc49[_0x8032('0x31')][_0x8032('0x38')](_0x8032('0x39'))){_0x49d87b[_0x8032('0x1c')]=qs[_0x8032('0x1c')](_0x18dc49['query']['limit']);_0x49d87b['offset']=qs['offset'](_0x18dc49['query'][_0x8032('0x1a')]);}_0x49d87b['order']=qs['sort'](_0x18dc49['query'][_0x8032('0x3a')]);_0x49d87b['where']=qs[_0x8032('0x33')](_['pick'](_0x18dc49[_0x8032('0x31')],_0x37ea5e[_0x8032('0x33')]),_0x1f9bfa);if(_0x18dc49[_0x8032('0x31')][_0x8032('0x3b')]){_0x49d87b['where']=_[_0x8032('0x3c')](_0x49d87b[_0x8032('0x3d')],{'$or':_[_0x8032('0x2c')](_0x1f9bfa,function(_0x243199){if(_0x243199[_0x8032('0x2e')]!=='VIRTUAL'){var _0x59547c={};_0x59547c[_0x243199[_0x8032('0x29')]]={'$like':'%'+_0x18dc49[_0x8032('0x31')][_0x8032('0x3b')]+'%'};return _0x59547c;}})});}_0x49d87b=_[_0x8032('0x3c')]({},_0x49d87b,_0x18dc49['options']);var _0x4aefac={'where':_0x49d87b[_0x8032('0x3d')]};return db[_0x8032('0x3e')][_0x8032('0x1d')](_0x4aefac)['then'](function(_0x70909e){_0x41aa48[_0x8032('0x1d')]=_0x70909e;if(_0x18dc49[_0x8032('0x31')][_0x8032('0x3f')]){_0x49d87b[_0x8032('0x40')]=[{'all':!![]}];}return db[_0x8032('0x3e')][_0x8032('0x41')](_0x49d87b);})[_0x8032('0x24')](function(_0x9d6243){_0x41aa48[_0x8032('0x42')]=_0x9d6243;return _0x41aa48;})[_0x8032('0x24')](respondWithFilteredResult(_0x51bbfe,_0x49d87b))[_0x8032('0x43')](handleError(_0x51bbfe,null));};exports[_0x8032('0x44')]=function(_0x21daef,_0x5ad6e7){var _0x86419d={'raw':![],'where':{'id':_0x21daef['params']['id']}},_0x154534={};_0x154534[_0x8032('0x30')]=_['keys'](db[_0x8032('0x3e')][_0x8032('0x2d')]);_0x154534[_0x8032('0x31')]=_[_0x8032('0x32')](_0x21daef[_0x8032('0x31')]);_0x154534['filters']=_[_0x8032('0x34')](_0x154534[_0x8032('0x30')],_0x154534[_0x8032('0x31')]);_0x86419d[_0x8032('0x35')]=_[_0x8032('0x34')](_0x154534[_0x8032('0x30')],qs[_0x8032('0x36')](_0x21daef[_0x8032('0x31')][_0x8032('0x36')]));_0x86419d[_0x8032('0x35')]=_0x86419d[_0x8032('0x35')][_0x8032('0x37')]?_0x86419d[_0x8032('0x35')]:_0x154534['model'];if(_0x21daef['query'][_0x8032('0x3f')]){_0x86419d[_0x8032('0x40')]=[{'all':!![]}];}_0x86419d=_[_0x8032('0x3c')]({},_0x86419d,_0x21daef[_0x8032('0x45')]);return db[_0x8032('0x3e')][_0x8032('0x46')](_0x86419d)[_0x8032('0x24')](handleEntityNotFound(_0x5ad6e7,null))[_0x8032('0x24')](respondWithResult(_0x5ad6e7,null))['catch'](handleError(_0x5ad6e7,null));};exports[_0x8032('0x47')]=function(_0x4be745,_0x52fc85){return db[_0x8032('0x3e')][_0x8032('0x47')](_0x4be745[_0x8032('0x48')],{})[_0x8032('0x24')](function(_0x5db266){var _0x164d45=_0x4be745[_0x8032('0x49')]['get']({'plain':!![]});if(!_0x164d45)throw new Error(_0x8032('0x4a'));if(_0x164d45[_0x8032('0x4b')]==='user'){var _0x5895c0=_0x5db266['get']({'plain':!![]});var _0x32a7e7='ChanSpies';return db[_0x8032('0x4c')][_0x8032('0x46')]({'where':{'name':_0x32a7e7,'userProfileId':_0x164d45[_0x8032('0x4d')]},'raw':!![]})[_0x8032('0x24')](function(_0x46e60d){if(_0x46e60d&&_0x46e60d['autoAssociation']===0x0){return db[_0x8032('0x27')][_0x8032('0x47')]({'name':_0x5895c0[_0x8032('0x29')],'resourceId':_0x5895c0['id'],'type':_0x46e60d[_0x8032('0x29')],'sectionId':_0x46e60d['id']},{})[_0x8032('0x24')](function(){return _0x5db266;});}else{return _0x5db266;}})['catch'](function(_0x237af3){logger['error'](_0x8032('0x4e'),_0x237af3);throw _0x237af3;});}return _0x5db266;})['then'](respondWithResult(_0x52fc85,0xc9))['catch'](handleError(_0x52fc85,null));};exports[_0x8032('0x22')]=function(_0x2e61cd,_0x3af4df){if(_0x2e61cd[_0x8032('0x48')]['id']){delete _0x2e61cd[_0x8032('0x48')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x2e61cd[_0x8032('0x4f')]['id']}})[_0x8032('0x24')](handleEntityNotFound(_0x3af4df,null))[_0x8032('0x24')](saveUpdates(_0x2e61cd[_0x8032('0x48')],null))[_0x8032('0x24')](respondWithResult(_0x3af4df,null))[_0x8032('0x43')](handleError(_0x3af4df,null));};exports[_0x8032('0x23')]=function(_0x375a2d,_0x163389){return db[_0x8032('0x3e')][_0x8032('0x46')]({'where':{'id':_0x375a2d[_0x8032('0x4f')]['id']}})[_0x8032('0x24')](handleEntityNotFound(_0x163389,null))[_0x8032('0x24')](removeEntity(_0x163389,null))[_0x8032('0x43')](handleError(_0x163389,null));}; \ No newline at end of file +var _0x8e44=['intersection','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','ChanSpies','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','VoiceChanSpy','includeAll','include','findAll','catch','show'];(function(_0x50a463,_0x517a1a){var _0x2971df=function(_0x1f9cf1){while(--_0x1f9cf1){_0x50a463['push'](_0x50a463['shift']());}};_0x2971df(++_0x517a1a);}(_0x8e44,0x1ac));var _0x48e4=function(_0xe41ba8,_0xfd2419){_0xe41ba8=_0xe41ba8-0x0;var _0x4872f6=_0x8e44[_0xe41ba8];return _0x4872f6;};'use strict';var emlformat=require(_0x48e4('0x0'));var rimraf=require(_0x48e4('0x1'));var zipdir=require(_0x48e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48e4('0x3'));var BPromise=require(_0x48e4('0x4'));var Mustache=require(_0x48e4('0x5'));var util=require(_0x48e4('0x6'));var path=require('path');var sox=require(_0x48e4('0x7'));var csv=require(_0x48e4('0x8'));var ejs=require(_0x48e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x48e4('0xa'));var crypto=require(_0x48e4('0xb'));var jsforce=require(_0x48e4('0xc'));var deskjs=require(_0x48e4('0xd'));var toCsv=require(_0x48e4('0x8'));var querystring=require(_0x48e4('0xe'));var Papa=require(_0x48e4('0xf'));var Redis=require(_0x48e4('0x10'));var authService=require(_0x48e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48e4('0x12'));var hardwareService=require(_0x48e4('0x13'));var logger=require(_0x48e4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x48e4('0x15'));var licenseUtil=require(_0x48e4('0x16'));var db=require(_0x48e4('0x17'))['db'];function respondWithStatusCode(_0x13c61c,_0x55a9ab){_0x55a9ab=_0x55a9ab||0xcc;return function(_0x28c15a){if(_0x28c15a){return _0x13c61c['sendStatus'](_0x55a9ab);}return _0x13c61c[_0x48e4('0x18')](_0x55a9ab)[_0x48e4('0x19')]();};}function respondWithResult(_0x4146f4,_0xb1f558){_0xb1f558=_0xb1f558||0xc8;return function(_0x12f7af){if(_0x12f7af){return _0x4146f4[_0x48e4('0x18')](_0xb1f558)[_0x48e4('0x1a')](_0x12f7af);}};}function respondWithFilteredResult(_0x55ab05,_0x1c82d2){return function(_0x15519c){if(_0x15519c){var _0x5c8fe5=typeof _0x1c82d2[_0x48e4('0x1b')]===_0x48e4('0x1c')&&typeof _0x1c82d2['limit']===_0x48e4('0x1c');var _0x627366=_0x15519c[_0x48e4('0x1d')];var _0x4ffc0d=_0x5c8fe5?0x0:_0x1c82d2[_0x48e4('0x1b')];var _0x16e405=_0x5c8fe5?_0x15519c[_0x48e4('0x1d')]:_0x1c82d2['offset']+_0x1c82d2[_0x48e4('0x1e')];var _0x565916;if(_0x16e405>=_0x627366){_0x16e405=_0x627366;_0x565916=0xc8;}else{_0x565916=0xce;}_0x55ab05['status'](_0x565916);return _0x55ab05[_0x48e4('0x1f')](_0x48e4('0x20'),_0x4ffc0d+'-'+_0x16e405+'/'+_0x627366)[_0x48e4('0x1a')](_0x15519c);}return null;};}function patchUpdates(_0xad2f7d){return function(_0xda50d1){try{jsonpatch['apply'](_0xda50d1,_0xad2f7d,!![]);}catch(_0x59eff5){return BPromise[_0x48e4('0x21')](_0x59eff5);}return _0xda50d1[_0x48e4('0x22')]();};}function saveUpdates(_0x260f1a,_0x131817){return function(_0x846128){if(_0x846128){return _0x846128[_0x48e4('0x23')](_0x260f1a)[_0x48e4('0x24')](function(_0x378573){return _0x378573;});}return null;};}function removeEntity(_0x73f81c,_0x3c0082){return function(_0x1a80ed){if(_0x1a80ed){return _0x1a80ed['destroy']()[_0x48e4('0x24')](function(){var _0xa1002a=_0x1a80ed['get']({'plain':!![]});var _0x2beac2=_0x48e4('0x25');return db['UserProfileResource'][_0x48e4('0x26')]({'where':{'type':_0x2beac2,'resourceId':_0xa1002a['id']}})[_0x48e4('0x24')](function(){return _0x1a80ed;});})[_0x48e4('0x24')](function(){_0x73f81c[_0x48e4('0x18')](0xcc)[_0x48e4('0x19')]();});}};}function handleEntityNotFound(_0x11bc8a,_0x45ae1b){return function(_0x4ae6ba){if(!_0x4ae6ba){_0x11bc8a[_0x48e4('0x27')](0x194);}return _0x4ae6ba;};}function handleError(_0xcaa9cb,_0x4a5520){_0x4a5520=_0x4a5520||0x1f4;return function(_0x5679d9){logger[_0x48e4('0x28')](_0x5679d9['stack']);if(_0x5679d9[_0x48e4('0x29')]){delete _0x5679d9[_0x48e4('0x29')];}_0xcaa9cb['status'](_0x4a5520)[_0x48e4('0x2a')](_0x5679d9);};}exports[_0x48e4('0x2b')]=function(_0x14b545,_0xea1c5b){var _0x15a413={},_0x4f6459={},_0x108f46={'count':0x0,'rows':[]};var _0x53511e=_['map'](db['VoiceChanSpy'][_0x48e4('0x2c')],function(_0x1450cb){return{'name':_0x1450cb[_0x48e4('0x2d')],'type':_0x1450cb[_0x48e4('0x2e')][_0x48e4('0x2f')]};});_0x4f6459[_0x48e4('0x30')]=_[_0x48e4('0x31')](_0x53511e,_0x48e4('0x29'));_0x4f6459[_0x48e4('0x32')]=_[_0x48e4('0x33')](_0x14b545[_0x48e4('0x32')]);_0x4f6459['filters']=_['intersection'](_0x4f6459['model'],_0x4f6459[_0x48e4('0x32')]);_0x15a413[_0x48e4('0x34')]=_['intersection'](_0x4f6459[_0x48e4('0x30')],qs[_0x48e4('0x35')](_0x14b545['query'][_0x48e4('0x35')]));_0x15a413[_0x48e4('0x34')]=_0x15a413[_0x48e4('0x34')][_0x48e4('0x36')]?_0x15a413['attributes']:_0x4f6459[_0x48e4('0x30')];if(!_0x14b545[_0x48e4('0x32')]['hasOwnProperty']('nolimit')){_0x15a413[_0x48e4('0x1e')]=qs[_0x48e4('0x1e')](_0x14b545[_0x48e4('0x32')]['limit']);_0x15a413[_0x48e4('0x1b')]=qs[_0x48e4('0x1b')](_0x14b545['query'][_0x48e4('0x1b')]);}_0x15a413[_0x48e4('0x37')]=qs[_0x48e4('0x38')](_0x14b545[_0x48e4('0x32')][_0x48e4('0x38')]);_0x15a413['where']=qs[_0x48e4('0x39')](_[_0x48e4('0x3a')](_0x14b545[_0x48e4('0x32')],_0x4f6459['filters']),_0x53511e);if(_0x14b545[_0x48e4('0x32')]['filter']){_0x15a413[_0x48e4('0x3b')]=_[_0x48e4('0x3c')](_0x15a413[_0x48e4('0x3b')],{'$or':_[_0x48e4('0x31')](_0x53511e,function(_0x2c392e){if(_0x2c392e[_0x48e4('0x2e')]!==_0x48e4('0x3d')){var _0x25c5fe={};_0x25c5fe[_0x2c392e[_0x48e4('0x29')]]={'$like':'%'+_0x14b545[_0x48e4('0x32')][_0x48e4('0x3e')]+'%'};return _0x25c5fe;}})});}_0x15a413=_['merge']({},_0x15a413,_0x14b545[_0x48e4('0x3f')]);var _0x2d5945={'where':_0x15a413[_0x48e4('0x3b')]};return db[_0x48e4('0x40')][_0x48e4('0x1d')](_0x2d5945)[_0x48e4('0x24')](function(_0x186451){_0x108f46['count']=_0x186451;if(_0x14b545[_0x48e4('0x32')][_0x48e4('0x41')]){_0x15a413[_0x48e4('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x48e4('0x43')](_0x15a413);})[_0x48e4('0x24')](function(_0x3cc197){_0x108f46['rows']=_0x3cc197;return _0x108f46;})['then'](respondWithFilteredResult(_0xea1c5b,_0x15a413))[_0x48e4('0x44')](handleError(_0xea1c5b,null));};exports[_0x48e4('0x45')]=function(_0x5d7c55,_0x2a9c6a){var _0x5824d8={'raw':![],'where':{'id':_0x5d7c55['params']['id']}},_0x4f1714={};_0x4f1714['model']=_[_0x48e4('0x33')](db[_0x48e4('0x40')][_0x48e4('0x2c')]);_0x4f1714[_0x48e4('0x32')]=_[_0x48e4('0x33')](_0x5d7c55[_0x48e4('0x32')]);_0x4f1714['filters']=_[_0x48e4('0x46')](_0x4f1714[_0x48e4('0x30')],_0x4f1714['query']);_0x5824d8['attributes']=_[_0x48e4('0x46')](_0x4f1714[_0x48e4('0x30')],qs[_0x48e4('0x35')](_0x5d7c55[_0x48e4('0x32')]['fields']));_0x5824d8[_0x48e4('0x34')]=_0x5824d8[_0x48e4('0x34')][_0x48e4('0x36')]?_0x5824d8[_0x48e4('0x34')]:_0x4f1714[_0x48e4('0x30')];if(_0x5d7c55[_0x48e4('0x32')]['includeAll']){_0x5824d8[_0x48e4('0x42')]=[{'all':!![]}];}_0x5824d8=_[_0x48e4('0x3c')]({},_0x5824d8,_0x5d7c55[_0x48e4('0x3f')]);return db[_0x48e4('0x40')][_0x48e4('0x47')](_0x5824d8)[_0x48e4('0x24')](handleEntityNotFound(_0x2a9c6a,null))[_0x48e4('0x24')](respondWithResult(_0x2a9c6a,null))[_0x48e4('0x44')](handleError(_0x2a9c6a,null));};exports[_0x48e4('0x48')]=function(_0x2b1d16,_0x2436fb){return db['VoiceChanSpy'][_0x48e4('0x48')](_0x2b1d16['body'],{})['then'](function(_0x1713d8){var _0x51012d=_0x2b1d16[_0x48e4('0x49')][_0x48e4('0x4a')]({'plain':!![]});if(!_0x51012d)throw new Error(_0x48e4('0x4b'));if(_0x51012d[_0x48e4('0x4c')]===_0x48e4('0x49')){var _0xb7525f=_0x1713d8[_0x48e4('0x4a')]({'plain':!![]});var _0x57c9e5='ChanSpies';return db[_0x48e4('0x4d')]['find']({'where':{'name':_0x57c9e5,'userProfileId':_0x51012d[_0x48e4('0x4e')]},'raw':!![]})[_0x48e4('0x24')](function(_0x2bbf8f){if(_0x2bbf8f&&_0x2bbf8f['autoAssociation']===0x0){return db[_0x48e4('0x4f')][_0x48e4('0x48')]({'name':_0xb7525f[_0x48e4('0x29')],'resourceId':_0xb7525f['id'],'type':_0x2bbf8f['name'],'sectionId':_0x2bbf8f['id']},{})[_0x48e4('0x24')](function(){return _0x1713d8;});}else{return _0x1713d8;}})[_0x48e4('0x44')](function(_0x91b42d){logger[_0x48e4('0x28')](_0x48e4('0x50'),_0x91b42d);throw _0x91b42d;});}return _0x1713d8;})['then'](respondWithResult(_0x2436fb,0xc9))[_0x48e4('0x44')](handleError(_0x2436fb,null));};exports[_0x48e4('0x23')]=function(_0x544137,_0x45e99d){if(_0x544137[_0x48e4('0x51')]['id']){delete _0x544137[_0x48e4('0x51')]['id'];}return db[_0x48e4('0x40')]['find']({'where':{'id':_0x544137['params']['id']}})['then'](handleEntityNotFound(_0x45e99d,null))['then'](saveUpdates(_0x544137[_0x48e4('0x51')],null))[_0x48e4('0x24')](respondWithResult(_0x45e99d,null))[_0x48e4('0x44')](handleError(_0x45e99d,null));};exports[_0x48e4('0x26')]=function(_0x32abe0,_0x2cd6a7){return db[_0x48e4('0x40')][_0x48e4('0x47')]({'where':{'id':_0x32abe0[_0x48e4('0x52')]['id']}})[_0x48e4('0x24')](handleEntityNotFound(_0x2cd6a7,null))[_0x48e4('0x24')](removeEntity(_0x2cd6a7,null))[_0x48e4('0x44')](handleError(_0x2cd6a7,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ab2bac6..68fcace 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 _0x75d8=['bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','merge','format','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','agent','exports','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension'];(function(_0xfa8f6e,_0x270c7d){var _0x1d4886=function(_0x327e6c){while(--_0x327e6c){_0xfa8f6e['push'](_0xfa8f6e['shift']());}};_0x1d4886(++_0x270c7d);}(_0x75d8,0x175));var _0x875d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x875d('0x0'));var util=require('util');var BPromise=require(_0x875d('0x1'));var attributes=require(_0x875d('0x2'));var getUserApplications=function(_0x509303,_0x408f3b,_0x7a44d2){var _0x551bce=0x1;var _0x30de3a=[];var _0x293624={'context':_0x408f3b[_0x875d('0x3')]||_0x875d('0x4'),'exten':util['format'](_0x875d('0x5'),_0x509303[_0x875d('0x6')],_0x7a44d2),'type':_0x875d('0x7'),'isApp':![],'ChanSpyId':_0x509303['id'],'UserId':_0x408f3b['id']};_0x30de3a[_0x875d('0x8')](_[_0x875d('0x9')]({'app':'Set','appdata':util[_0x875d('0xa')]('CDR(type)=%s',_0x875d('0xb')),'priority':_0x551bce++},_0x293624));if(_0x509303[_0x875d('0xc')]){_0x30de3a[_0x875d('0x8')](_[_0x875d('0x9')]({'app':_0x875d('0xd'),'appdata':util[_0x875d('0xa')](_0x875d('0xe'),_0x509303[_0x875d('0xf')]),'priority':_0x551bce++},_0x293624));}if(_0x509303[_0x875d('0x10')]){_0x30de3a[_0x875d('0x8')](_[_0x875d('0x9')]({'app':_0x875d('0x11'),'appdata':_0x509303['password'],'priority':_0x551bce++},_0x293624));}_0x30de3a['push'](_[_0x875d('0x9')]({'app':_0x875d('0x12'),'appdata':util[_0x875d('0xa')](_0x875d('0x13'),_0x408f3b[_0x875d('0x14')],_0x509303[_0x875d('0x15')]?_0x509303['options'][_0x875d('0x16')](''):''),'priority':_0x551bce++},_0x293624));if(_0x509303['record']){_0x30de3a[_0x875d('0x8')](_['merge']({'app':_0x875d('0x17'),'priority':_0x551bce++},_0x293624));}return _0x30de3a;};var getChanSpyApplications=function(_0x3580d0,_0x38aecb){var _0xc2312f=[];for(var _0x343e0e=0x0,_0x2ffbd0=0x1;_0x343e0e<_0x38aecb[_0x875d('0x18')];_0x343e0e++,_0x2ffbd0=0x1){_0xc2312f=_0xc2312f[_0x875d('0x19')](getUserApplications(_0x3580d0,_0x38aecb[_0x343e0e],_0x38aecb[_0x343e0e][_0x875d('0x1a')]));if(_0x38aecb[_0x343e0e][_0x875d('0x1a')]!=_0x38aecb[_0x343e0e][_0x875d('0x14')]){_0xc2312f=_0xc2312f[_0x875d('0x19')](getUserApplications(_0x3580d0,_0x38aecb[_0x343e0e],_0x38aecb[_0x343e0e][_0x875d('0x14')]));}}return _0xc2312f;};var getChanSpyPromise=function(_0x5defad,_0x5b7adc){return new BPromise(function(_0x56e9c3,_0x4fb183){return _0x5defad['User']['findAll']({'attributes':['id',_0x875d('0x14'),'internal'],'where':{'role':_0x875d('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5e1936){if(_0x5e1936){return _0x56e9c3(getChanSpyApplications(_0x5b7adc,_0x5e1936));}return _0x56e9c3([]);})['catch'](function(_0x17a6fb){_0x4fb183(_0x17a6fb);});});};module[_0x875d('0x1c')]=function(_0x5e55c4,_0x1a1b3b){var _0x4d11b3=_0x5e55c4[_0x875d('0x1d')];return _0x5e55c4['define'](_0x875d('0x1e'),attributes,{'tableName':_0x875d('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x8497ca,_0x475c9a,_0x2b356d){return getChanSpyPromise(_0x4d11b3,_0x8497ca)[_0x875d('0x20')](function(_0x8f2aad){if(_0x8f2aad&&_0x8f2aad[_0x875d('0x18')]){return _0x4d11b3[_0x875d('0x21')][_0x875d('0x22')](_0x8f2aad);}})['then'](function(){_0x2b356d();})[_0x875d('0x23')](function(_0xce70b3){_0x2b356d(_0xce70b3);});},'afterUpdate':function(_0x491a53,_0x36ddfc,_0x2c2fe3){return _0x4d11b3['VoiceExtension'][_0x875d('0x24')]({'where':{'ChanSpyId':_0x491a53['id']}})['then'](function(){return getChanSpyPromise(_0x4d11b3,_0x491a53);})[_0x875d('0x20')](function(_0x37f56f){if(_0x37f56f&&_0x37f56f[_0x875d('0x18')]){return _0x4d11b3[_0x875d('0x21')]['bulkCreate'](_0x37f56f);}})[_0x875d('0x20')](function(){_0x2c2fe3();})[_0x875d('0x23')](function(_0x50058a){_0x2c2fe3(_0x50058a);});},'afterDestroy':function(_0x3d15e2,_0xf812c4,_0x3142f2){return _0x4d11b3[_0x875d('0x21')][_0x875d('0x24')]({'where':{'ChanSpyId':_0x3d15e2['id']}})[_0x875d('0x20')](function(){_0x3142f2();})[_0x875d('0x23')](function(_0x381e3e){_0x3142f2(_0x381e3e);});}}});}; \ No newline at end of file +var _0x10e9=['prefix','system','merge','CDR(type)=%s','record','MixMonitor','recordingFormat','auth','push','password','ChanSpy','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','exports','models','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','format','%s%s'];(function(_0x2638b5,_0x4b10fd){var _0x1a0977=function(_0x2caf37){while(--_0x2caf37){_0x2638b5['push'](_0x2638b5['shift']());}};_0x1a0977(++_0x4b10fd);}(_0x10e9,0x194));var _0x910e=function(_0x19c64a,_0x5de14e){_0x19c64a=_0x19c64a-0x0;var _0x1b1a06=_0x10e9[_0x19c64a];return _0x1b1a06;};'use strict';var _=require(_0x910e('0x0'));var util=require('util');var BPromise=require(_0x910e('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2af03d,_0x7a2127,_0x578b33){var _0x5089e8=0x1;var _0x2645af=[];var _0x2c2205={'context':_0x7a2127['context']||'from-sip','exten':util[_0x910e('0x2')](_0x910e('0x3'),_0x2af03d[_0x910e('0x4')],_0x578b33),'type':_0x910e('0x5'),'isApp':![],'ChanSpyId':_0x2af03d['id'],'UserId':_0x7a2127['id']};_0x2645af['push'](_[_0x910e('0x6')]({'app':'Set','appdata':util[_0x910e('0x2')](_0x910e('0x7'),'chanspy'),'priority':_0x5089e8++},_0x2c2205));if(_0x2af03d[_0x910e('0x8')]){_0x2645af['push'](_['merge']({'app':_0x910e('0x9'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x2af03d[_0x910e('0xa')]),'priority':_0x5089e8++},_0x2c2205));}if(_0x2af03d[_0x910e('0xb')]){_0x2645af[_0x910e('0xc')](_[_0x910e('0x6')]({'app':'Authenticate','appdata':_0x2af03d[_0x910e('0xd')],'priority':_0x5089e8++},_0x2c2205));}_0x2645af[_0x910e('0xc')](_[_0x910e('0x6')]({'app':_0x910e('0xe'),'appdata':util[_0x910e('0x2')]('SIP/%s,%s',_0x7a2127[_0x910e('0xf')],_0x2af03d['options']?_0x2af03d[_0x910e('0x10')][_0x910e('0x11')](''):''),'priority':_0x5089e8++},_0x2c2205));if(_0x2af03d[_0x910e('0x8')]){_0x2645af[_0x910e('0xc')](_[_0x910e('0x6')]({'app':_0x910e('0x12'),'priority':_0x5089e8++},_0x2c2205));}return _0x2645af;};var getChanSpyApplications=function(_0x311acb,_0x3b8203){var _0x784021=[];for(var _0x31df9f=0x0,_0x170eda=0x1;_0x31df9f<_0x3b8203['length'];_0x31df9f++,_0x170eda=0x1){_0x784021=_0x784021[_0x910e('0x13')](getUserApplications(_0x311acb,_0x3b8203[_0x31df9f],_0x3b8203[_0x31df9f][_0x910e('0x14')]));if(_0x3b8203[_0x31df9f][_0x910e('0x14')]!=_0x3b8203[_0x31df9f][_0x910e('0xf')]){_0x784021=_0x784021[_0x910e('0x13')](getUserApplications(_0x311acb,_0x3b8203[_0x31df9f],_0x3b8203[_0x31df9f][_0x910e('0xf')]));}}return _0x784021;};var getChanSpyPromise=function(_0x563c0d,_0x57b94f){return new BPromise(function(_0x184542,_0x1d2840){return _0x563c0d[_0x910e('0x15')][_0x910e('0x16')]({'attributes':['id',_0x910e('0xf'),_0x910e('0x14')],'where':{'role':_0x910e('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x37ef27){if(_0x37ef27){return _0x184542(getChanSpyApplications(_0x57b94f,_0x37ef27));}return _0x184542([]);})[_0x910e('0x18')](function(_0x5aeb57){_0x1d2840(_0x5aeb57);});});};module[_0x910e('0x19')]=function(_0x24f3b7,_0x3b5f14){var _0x43b1c5=_0x24f3b7[_0x910e('0x1a')];return _0x24f3b7['define'](_0x910e('0x1b'),attributes,{'tableName':_0x910e('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c5216,_0x1d0b4f,_0x4be516){return getChanSpyPromise(_0x43b1c5,_0x1c5216)[_0x910e('0x1d')](function(_0x22f888){if(_0x22f888&&_0x22f888[_0x910e('0x1e')]){return _0x43b1c5[_0x910e('0x1f')][_0x910e('0x20')](_0x22f888);}})[_0x910e('0x1d')](function(){_0x4be516();})[_0x910e('0x18')](function(_0x5cbcfd){_0x4be516(_0x5cbcfd);});},'afterUpdate':function(_0x4cc6fa,_0x50dda5,_0x5bfa68){return _0x43b1c5[_0x910e('0x1f')]['destroy']({'where':{'ChanSpyId':_0x4cc6fa['id']}})[_0x910e('0x1d')](function(){return getChanSpyPromise(_0x43b1c5,_0x4cc6fa);})[_0x910e('0x1d')](function(_0xe91274){if(_0xe91274&&_0xe91274[_0x910e('0x1e')]){return _0x43b1c5[_0x910e('0x1f')]['bulkCreate'](_0xe91274);}})['then'](function(){_0x5bfa68();})[_0x910e('0x18')](function(_0x5ac81a){_0x5bfa68(_0x5ac81a);});},'afterDestroy':function(_0x34cf03,_0x2a0d72,_0xaa019e){return _0x43b1c5['VoiceExtension'][_0x910e('0x21')]({'where':{'ChanSpyId':_0x34cf03['id']}})[_0x910e('0x1d')](function(){_0xaa019e();})[_0x910e('0x18')](function(_0x194f74){_0xaa019e(_0x194f74);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4065896..a7b27ae 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 _0x4e81=['VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d9443,_0x1ba4e2){var _0x3eb010=function(_0x27b2d3){while(--_0x27b2d3){_0x4d9443['push'](_0x4d9443['shift']());}};_0x3eb010(++_0x1ba4e2);}(_0x4e81,0x1bc));var _0x14e8=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0x4e81[_0x101802];return _0x5d61ce;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});} \ No newline at end of file +var _0x2bc6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','lodash','util','moment','../../config/utils','rpc'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x2bc6,0x163));var _0x62bc=function(_0x5f51d2,_0x4f0133){_0x5f51d2=_0x5f51d2-0x0;var _0x24bf08=_0x2bc6[_0x5f51d2];return _0x24bf08;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62bc('0x3'));var logger=require('../../config/logger')(_0x62bc('0x4'));var config=require(_0x62bc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x6')][_0x62bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40af10,_0x3f3dc9,_0x3ed6ad){return new BPromise(function(_0x3f625c,_0x5bedeb){return client[_0x62bc('0x8')](_0x40af10,_0x3ed6ad)[_0x62bc('0x9')](function(_0x1917e1){logger[_0x62bc('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f3dc9,_0x62bc('0xb'));logger[_0x62bc('0xc')](_0x62bc('0xd'),_0x3f3dc9,'request\x20sent',JSON[_0x62bc('0xe')](_0x1917e1));if(_0x1917e1[_0x62bc('0xf')]){if(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x10')]===0x1f4){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')]['message']);return _0x5bedeb(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);}logger['error'](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);return _0x3f625c(_0x1917e1['error'][_0x62bc('0x12')]);}else{logger[_0x62bc('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f3dc9,'request\x20sent');_0x3f625c(_0x1917e1[_0x62bc('0x13')][_0x62bc('0x12')]);}})['catch'](function(_0x278893){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x278893);_0x5bedeb(_0x278893);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 1d0fcb1..7cba29d 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 _0xa366=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','get','index','post'];(function(_0x4b9338,_0x5d362f){var _0x1fc03a=function(_0x1ae4ae){while(--_0x1ae4ae){_0x4b9338['push'](_0x4b9338['shift']());}};_0x1fc03a(++_0x5d362f);}(_0xa366,0x17d));var _0x6a36=function(_0x45d898,_0x1603ab){_0x45d898=_0x45d898-0x0;var _0x36a0fd=_0xa366[_0x45d898];return _0x36a0fd;};'use strict';var multer=require(_0x6a36('0x0'));var util=require(_0x6a36('0x1'));var path=require(_0x6a36('0x2'));var timeout=require(_0x6a36('0x3'));var express=require(_0x6a36('0x4'));var router=express[_0x6a36('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x6a36('0x6')]('/',auth['isAuthenticated'](),controller[_0x6a36('0x7')]);router[_0x6a36('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6a36('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6a36('0x9'),auth[_0x6a36('0xa')](),controller[_0x6a36('0xb')]);router[_0x6a36('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x6a36('0xd')]);module[_0x6a36('0xe')]=router; \ No newline at end of file +var _0x903c=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x35727c,_0x28594c){var _0x20fae4=function(_0xe41739){while(--_0xe41739){_0x35727c['push'](_0x35727c['shift']());}};_0x20fae4(++_0x28594c);}(_0x903c,0x121));var _0xc903=function(_0x35ef8b,_0x1f89ac){_0x35ef8b=_0x35ef8b-0x0;var _0x2240ce=_0x903c[_0x35ef8b];return _0x2240ce;};'use strict';var multer=require(_0xc903('0x0'));var util=require(_0xc903('0x1'));var path=require(_0xc903('0x2'));var timeout=require(_0xc903('0x3'));var express=require(_0xc903('0x4'));var router=express[_0xc903('0x5')]();var fs_extra=require(_0xc903('0x6'));var auth=require(_0xc903('0x7'));var interaction=require(_0xc903('0x8'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xc903('0x9')]('/',auth[_0xc903('0xa')](),controller[_0xc903('0xb')]);router[_0xc903('0x9')](_0xc903('0xc'),auth[_0xc903('0xa')](),controller[_0xc903('0xd')]);router[_0xc903('0xe')]('/',auth[_0xc903('0xa')](),controller[_0xc903('0xf')]);router[_0xc903('0x10')](_0xc903('0xc'),auth[_0xc903('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc903('0xa')](),controller[_0xc903('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ce159f6..23c887f 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 _0x67a3=['exports','STRING','name','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x67a3,0x1e3));var _0x367a=function(_0x4c1078,_0x279c61){_0x4c1078=_0x4c1078-0x0;var _0x164ffe=_0x67a3[_0x4c1078];return _0x164ffe;};'use strict';var Sequelize=require(_0x367a('0x0'));module[_0x367a('0x1')]={'name':{'type':Sequelize[_0x367a('0x2')],'unique':_0x367a('0x3')},'description':{'type':Sequelize[_0x367a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa96=['BOOLEAN','sequelize','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa96,0x13d));var _0x6aa9=function(_0x4e70c9,_0x10395a){_0x4e70c9=_0x4e70c9-0x0;var _0x59baa1=_0xaa96[_0x4e70c9];return _0x59baa1;};'use strict';var Sequelize=require(_0x6aa9('0x0'));module['exports']={'name':{'type':Sequelize[_0x6aa9('0x1')],'unique':_0x6aa9('0x2')},'description':{'type':Sequelize[_0x6aa9('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6aa9('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 827b500..8fda4d3 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 _0x2034=['code','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','sendStatus','stack','send','index','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','VoiceContext','includeAll','include','findAll','show','params','options','find','create','body','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','chan_sip.so','root','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x4ecaf1,_0x1f2ad8){var _0x3dda3f=function(_0x86c82d){while(--_0x86c82d){_0x4ecaf1['push'](_0x4ecaf1['shift']());}};_0x3dda3f(++_0x1f2ad8);}(_0x2034,0x1dd));var _0x4203=function(_0x25d819,_0x51a522){_0x25d819=_0x25d819-0x0;var _0x24fd83=_0x2034[_0x25d819];return _0x24fd83;};'use strict';var emlformat=require(_0x4203('0x0'));var rimraf=require(_0x4203('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4203('0x2'));var rp=require('request-promise');var moment=require(_0x4203('0x3'));var BPromise=require(_0x4203('0x4'));var Mustache=require(_0x4203('0x5'));var util=require(_0x4203('0x6'));var path=require(_0x4203('0x7'));var sox=require('sox');var csv=require(_0x4203('0x8'));var ejs=require(_0x4203('0x9'));var fs=require('fs');var fs_extra=require(_0x4203('0xa'));var _=require('lodash');var squel=require(_0x4203('0xb'));var crypto=require(_0x4203('0xc'));var jsforce=require(_0x4203('0xd'));var deskjs=require(_0x4203('0xe'));var toCsv=require(_0x4203('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4203('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4203('0x10'));var as=require(_0x4203('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4203('0x12'));var utils=require('../../config/utils');var config=require(_0x4203('0x13'));var licenseUtil=require(_0x4203('0x14'));var db=require(_0x4203('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b812e,_0x26a819,_0x4531a4,_0x58123f){return new BPromise(function(_0x455ac9,_0x5860a4){var _0x7fd6a0=_0x58123f||client;return _0x7fd6a0['request'](_0x5b812e,_0x4531a4)[_0x4203('0x16')](function(_0x3c7c90){logger[_0x4203('0x17')](_0x4203('0x18'),_0x26a819,_0x4203('0x19'));logger[_0x4203('0x1a')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x26a819,_0x4203('0x19'),JSON['stringify'](_0x3c7c90));if(_0x3c7c90[_0x4203('0x1b')]){if(_0x3c7c90[_0x4203('0x1b')][_0x4203('0x1c')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x26a819,_0x3c7c90[_0x4203('0x1b')][_0x4203('0x1d')]);return _0x5860a4(_0x3c7c90[_0x4203('0x1b')][_0x4203('0x1d')]);}logger[_0x4203('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x26a819,_0x3c7c90['error'][_0x4203('0x1d')]);return _0x455ac9(_0x3c7c90[_0x4203('0x1b')][_0x4203('0x1d')]);}else{logger['info'](_0x4203('0x18'),_0x26a819,_0x4203('0x19'));_0x455ac9(_0x3c7c90['result'][_0x4203('0x1d')]);}})[_0x4203('0x1e')](function(_0x52cbe3){logger['error'](_0x4203('0x18'),_0x26a819,_0x52cbe3);_0x5860a4(_0x52cbe3);});});}function respondWithStatusCode(_0x3c7d64,_0x2d45cb){_0x2d45cb=_0x2d45cb||0xcc;return function(_0x5c9e30){if(_0x5c9e30){return _0x3c7d64['sendStatus'](_0x2d45cb);}return _0x3c7d64[_0x4203('0x1f')](_0x2d45cb)[_0x4203('0x20')]();};}function respondWithResult(_0x454b21,_0x514cbf){_0x514cbf=_0x514cbf||0xc8;return function(_0x1c140b){if(_0x1c140b){return _0x454b21['status'](_0x514cbf)['json'](_0x1c140b);}};}function respondWithFilteredResult(_0x542457,_0x27f785){return function(_0x364be5){if(_0x364be5){var _0x2c66a9=typeof _0x27f785[_0x4203('0x21')]===_0x4203('0x22')&&typeof _0x27f785[_0x4203('0x23')]===_0x4203('0x22');var _0x2a3b93=_0x364be5[_0x4203('0x24')];var _0x5802a5=_0x2c66a9?0x0:_0x27f785[_0x4203('0x21')];var _0x25479a=_0x2c66a9?_0x364be5['count']:_0x27f785['offset']+_0x27f785[_0x4203('0x23')];var _0x214a9a;if(_0x25479a>=_0x2a3b93){_0x25479a=_0x2a3b93;_0x214a9a=0xc8;}else{_0x214a9a=0xce;}_0x542457[_0x4203('0x1f')](_0x214a9a);return _0x542457[_0x4203('0x25')](_0x4203('0x26'),_0x5802a5+'-'+_0x25479a+'/'+_0x2a3b93)[_0x4203('0x27')](_0x364be5);}return null;};}function patchUpdates(_0x3d89a4){return function(_0x5bf9e2){try{jsonpatch[_0x4203('0x28')](_0x5bf9e2,_0x3d89a4,!![]);}catch(_0x2c1a4a){return BPromise[_0x4203('0x29')](_0x2c1a4a);}return _0x5bf9e2[_0x4203('0x2a')]();};}function saveUpdates(_0x453452,_0x52bef7){return function(_0x53165e){if(_0x53165e){return _0x53165e[_0x4203('0x2b')](_0x453452)[_0x4203('0x16')](function(_0x19df3c){return _0x19df3c;});}return null;};}function removeEntity(_0x3d9011,_0xef4f8c){return function(_0x16b6c1){if(_0x16b6c1){return _0x16b6c1[_0x4203('0x2c')]()[_0x4203('0x16')](function(){var _0x47ca92=_0x16b6c1[_0x4203('0x2d')]({'plain':!![]});var _0x4a8407='Contexts';return db['UserProfileResource'][_0x4203('0x2c')]({'where':{'type':_0x4a8407,'resourceId':_0x47ca92['id']}})[_0x4203('0x16')](function(){return _0x16b6c1;});})[_0x4203('0x16')](function(){_0x3d9011[_0x4203('0x1f')](0xcc)[_0x4203('0x20')]();});}};}function handleEntityNotFound(_0x51f3ac,_0x1fb346){return function(_0x95fd3d){if(!_0x95fd3d){_0x51f3ac[_0x4203('0x2e')](0x194);}return _0x95fd3d;};}function handleError(_0x531043,_0x344519){_0x344519=_0x344519||0x1f4;return function(_0x3ab7ef){logger[_0x4203('0x1b')](_0x3ab7ef[_0x4203('0x2f')]);if(_0x3ab7ef['name']){delete _0x3ab7ef['name'];}_0x531043[_0x4203('0x1f')](_0x344519)[_0x4203('0x30')](_0x3ab7ef);};}exports[_0x4203('0x31')]=function(_0x440a50,_0x56eeec){var _0x5dd2a6={},_0x3ace8a={},_0xd98400={'count':0x0,'rows':[]};var _0x305aff=_['map'](db['VoiceContext'][_0x4203('0x32')],function(_0x4a2e88){return{'name':_0x4a2e88[_0x4203('0x33')],'type':_0x4a2e88[_0x4203('0x34')][_0x4203('0x35')]};});_0x3ace8a['model']=_['map'](_0x305aff,'name');_0x3ace8a[_0x4203('0x36')]=_[_0x4203('0x37')](_0x440a50['query']);_0x3ace8a['filters']=_['intersection'](_0x3ace8a[_0x4203('0x38')],_0x3ace8a[_0x4203('0x36')]);_0x5dd2a6['attributes']=_[_0x4203('0x39')](_0x3ace8a[_0x4203('0x38')],qs[_0x4203('0x3a')](_0x440a50['query'][_0x4203('0x3a')]));_0x5dd2a6['attributes']=_0x5dd2a6['attributes'][_0x4203('0x3b')]?_0x5dd2a6[_0x4203('0x3c')]:_0x3ace8a['model'];if(!_0x440a50[_0x4203('0x36')][_0x4203('0x3d')](_0x4203('0x3e'))){_0x5dd2a6[_0x4203('0x23')]=qs['limit'](_0x440a50[_0x4203('0x36')][_0x4203('0x23')]);_0x5dd2a6[_0x4203('0x21')]=qs[_0x4203('0x21')](_0x440a50[_0x4203('0x36')]['offset']);}_0x5dd2a6[_0x4203('0x3f')]=qs[_0x4203('0x40')](_0x440a50[_0x4203('0x36')][_0x4203('0x40')]);_0x5dd2a6[_0x4203('0x41')]=qs[_0x4203('0x42')](_[_0x4203('0x43')](_0x440a50[_0x4203('0x36')],_0x3ace8a[_0x4203('0x42')]),_0x305aff);if(_0x440a50[_0x4203('0x36')][_0x4203('0x44')]){_0x5dd2a6[_0x4203('0x41')]=_[_0x4203('0x45')](_0x5dd2a6[_0x4203('0x41')],{'$or':_['map'](_0x305aff,function(_0x80b713){if(_0x80b713[_0x4203('0x34')]!==_0x4203('0x46')){var _0x50ba24={};_0x50ba24[_0x80b713[_0x4203('0x47')]]={'$like':'%'+_0x440a50[_0x4203('0x36')][_0x4203('0x44')]+'%'};return _0x50ba24;}})});}_0x5dd2a6=_['merge']({},_0x5dd2a6,_0x440a50['options']);var _0x7ce445={'where':_0x5dd2a6[_0x4203('0x41')]};return db[_0x4203('0x48')][_0x4203('0x24')](_0x7ce445)[_0x4203('0x16')](function(_0x59d9a8){_0xd98400[_0x4203('0x24')]=_0x59d9a8;if(_0x440a50[_0x4203('0x36')][_0x4203('0x49')]){_0x5dd2a6[_0x4203('0x4a')]=[{'all':!![]}];}return db[_0x4203('0x48')][_0x4203('0x4b')](_0x5dd2a6);})['then'](function(_0x1147f3){_0xd98400['rows']=_0x1147f3;return _0xd98400;})[_0x4203('0x16')](respondWithFilteredResult(_0x56eeec,_0x5dd2a6))[_0x4203('0x1e')](handleError(_0x56eeec,null));};exports[_0x4203('0x4c')]=function(_0xabc4e6,_0x3449d7){var _0x41d701={'raw':![],'where':{'id':_0xabc4e6[_0x4203('0x4d')]['id']}},_0x51e03a={};_0x51e03a[_0x4203('0x38')]=_[_0x4203('0x37')](db[_0x4203('0x48')][_0x4203('0x32')]);_0x51e03a[_0x4203('0x36')]=_[_0x4203('0x37')](_0xabc4e6['query']);_0x51e03a['filters']=_[_0x4203('0x39')](_0x51e03a[_0x4203('0x38')],_0x51e03a[_0x4203('0x36')]);_0x41d701[_0x4203('0x3c')]=_[_0x4203('0x39')](_0x51e03a[_0x4203('0x38')],qs[_0x4203('0x3a')](_0xabc4e6[_0x4203('0x36')]['fields']));_0x41d701[_0x4203('0x3c')]=_0x41d701[_0x4203('0x3c')][_0x4203('0x3b')]?_0x41d701[_0x4203('0x3c')]:_0x51e03a[_0x4203('0x38')];if(_0xabc4e6[_0x4203('0x36')][_0x4203('0x49')]){_0x41d701[_0x4203('0x4a')]=[{'all':!![]}];}_0x41d701=_[_0x4203('0x45')]({},_0x41d701,_0xabc4e6[_0x4203('0x4e')]);return db[_0x4203('0x48')][_0x4203('0x4f')](_0x41d701)[_0x4203('0x16')](handleEntityNotFound(_0x3449d7,null))['then'](respondWithResult(_0x3449d7,null))[_0x4203('0x1e')](handleError(_0x3449d7,null));};exports[_0x4203('0x50')]=function(_0x4ed89c,_0x4f2646,_0x3392ce){var _0x786a02;return db[_0x4203('0x48')]['create'](_0x4ed89c[_0x4203('0x51')],{'raw':!![]})[_0x4203('0x16')](function(_0x26280e){_0x786a02=_0x26280e;return db['VoiceContext'][_0x4203('0x4b')]({'raw':!![]});})[_0x4203('0x16')](function(_0x4d90d5){var _0x25a5aa=fs['readFileSync'](path[_0x4203('0x52')](config['root'],_0x4203('0x53')),_0x4203('0x54'));var _0x3b1ec9=ejs[_0x4203('0x55')](_0x25a5aa,{'contexts':_0x4d90d5||[]});fs[_0x4203('0x56')](_0x4203('0x57'),_0x3b1ec9);})[_0x4203('0x16')](function(){return respondWithRpcPromise(_0x4203('0x58'),_0x4203('0x50'),{'module':'chan_sip.so'});})[_0x4203('0x16')](function(){var _0x477f07=_0x4ed89c[_0x4203('0x59')][_0x4203('0x2d')]({'plain':!![]});if(!_0x477f07)throw new Error(_0x4203('0x5a'));if(_0x477f07[_0x4203('0x5b')]===_0x4203('0x59')){var _0x37c9d2=_0x786a02[_0x4203('0x2d')]({'plain':!![]});return db[_0x4203('0x5c')][_0x4203('0x4f')]({'where':{'name':_0x4203('0x5d'),'userProfileId':_0x477f07[_0x4203('0x5e')]},'raw':!![]})[_0x4203('0x16')](function(_0x4c89c9){if(_0x4c89c9&&_0x4c89c9[_0x4203('0x5f')]===0x0){return db[_0x4203('0x60')][_0x4203('0x50')]({'name':_0x37c9d2['name'],'resourceId':_0x37c9d2['id'],'type':_0x4c89c9[_0x4203('0x47')],'sectionId':_0x4c89c9['id']},{})['then'](function(){return _0x786a02;});}else{return _0x786a02;}})[_0x4203('0x1e')](function(_0x34cb2b){logger[_0x4203('0x1b')](_0x4203('0x61'),_0x34cb2b);throw _0x34cb2b;});}return _0x786a02;})[_0x4203('0x16')](respondWithResult(_0x4f2646,0xc9))[_0x4203('0x1e')](handleError(_0x4f2646,null));};exports[_0x4203('0x2b')]=function(_0x5d91ac,_0x55148b,_0x337575){var _0x455402;return db['VoiceContext'][_0x4203('0x4f')]({'where':{'id':_0x5d91ac[_0x4203('0x4d')]['id']}})[_0x4203('0x16')](handleEntityNotFound(_0x55148b,null))['then'](saveUpdates(_0x5d91ac[_0x4203('0x51')],null))['then'](function(_0x4800b7){if(_0x4800b7){_0x455402=_0x4800b7;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x4203('0x16')](function(_0x4f05bc){var _0x41d136=fs[_0x4203('0x62')](path[_0x4203('0x52')](config['root'],_0x4203('0x53')),'utf8');var _0x14a903=ejs[_0x4203('0x55')](_0x41d136,{'contexts':_0x4f05bc||[]});fs[_0x4203('0x56')](_0x4203('0x57'),_0x14a903);})[_0x4203('0x16')](function(){return respondWithRpcPromise('Reload',_0x4203('0x2b'),{'module':_0x4203('0x63')});})['then'](function(){return _0x455402;})[_0x4203('0x16')](respondWithResult(_0x55148b,null))[_0x4203('0x1e')](handleError(_0x55148b,null));};exports[_0x4203('0x2c')]=function(_0x551406,_0x2c1017,_0x2611b4){var _0x538ccf;return db[_0x4203('0x48')][_0x4203('0x4f')]({'where':{'id':_0x551406['params']['id']}})[_0x4203('0x16')](handleEntityNotFound(_0x2c1017,null))[_0x4203('0x16')](removeEntity(_0x2c1017,null))[_0x4203('0x16')](function(){return db[_0x4203('0x48')][_0x4203('0x4b')]({'raw':!![]});})[_0x4203('0x16')](function(_0x2aab45){var _0x5205a1=fs[_0x4203('0x62')](path[_0x4203('0x52')](config[_0x4203('0x64')],_0x4203('0x53')),_0x4203('0x54'));var _0x2b8ffd=ejs[_0x4203('0x55')](_0x5205a1,{'contexts':_0x2aab45});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2b8ffd);return respondWithRpcPromise(_0x4203('0x58'),_0x4203('0x2c'),{'module':_0x4203('0x63')});})['catch'](handleError(_0x2c1017,null));}; \ No newline at end of file +var _0xc147=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','Contexts','UserProfileResource','destroy','stack','name','map','rawAttributes','fieldName','type','keys','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','rows','show','params','options','find','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','create','chan_sip.so','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','Reload','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../mysqldb','client','http','request','then','info','request\x20sent'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc147,0x179));var _0x7c14=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0xc147[_0x4fb1b8];return _0x146c71;};'use strict';var emlformat=require(_0x7c14('0x0'));var rimraf=require(_0x7c14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7c14('0x2'));var moment=require(_0x7c14('0x3'));var BPromise=require(_0x7c14('0x4'));var Mustache=require(_0x7c14('0x5'));var util=require(_0x7c14('0x6'));var path=require(_0x7c14('0x7'));var sox=require(_0x7c14('0x8'));var csv=require(_0x7c14('0x9'));var ejs=require(_0x7c14('0xa'));var fs=require('fs');var fs_extra=require(_0x7c14('0xb'));var _=require(_0x7c14('0xc'));var squel=require(_0x7c14('0xd'));var crypto=require(_0x7c14('0xe'));var jsforce=require(_0x7c14('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7c14('0x9'));var querystring=require('querystring');var Papa=require(_0x7c14('0x10'));var Redis=require(_0x7c14('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c14('0x12'));var logger=require(_0x7c14('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7c14('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7c14('0x15')][_0x7c14('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3362b3,_0x842d1e,_0x2b7e80,_0x352b3b){return new BPromise(function(_0x3962e1,_0x55f823){var _0x43047d=_0x352b3b||client;return _0x43047d[_0x7c14('0x17')](_0x3362b3,_0x2b7e80)[_0x7c14('0x18')](function(_0x2da990){logger[_0x7c14('0x19')]('VoiceContext,\x20%s,\x20%s',_0x842d1e,_0x7c14('0x1a'));logger[_0x7c14('0x1b')](_0x7c14('0x1c'),_0x842d1e,'request\x20sent',JSON[_0x7c14('0x1d')](_0x2da990));if(_0x2da990[_0x7c14('0x1e')]){if(_0x2da990['error']['code']===0x1f4){logger[_0x7c14('0x1e')](_0x7c14('0x1f'),_0x842d1e,_0x2da990['error'][_0x7c14('0x20')]);return _0x55f823(_0x2da990['error'][_0x7c14('0x20')]);}logger[_0x7c14('0x1e')](_0x7c14('0x1f'),_0x842d1e,_0x2da990[_0x7c14('0x1e')][_0x7c14('0x20')]);return _0x3962e1(_0x2da990['error'][_0x7c14('0x20')]);}else{logger[_0x7c14('0x19')]('VoiceContext,\x20%s,\x20%s',_0x842d1e,_0x7c14('0x1a'));_0x3962e1(_0x2da990[_0x7c14('0x21')]['message']);}})[_0x7c14('0x22')](function(_0x58c583){logger[_0x7c14('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x842d1e,_0x58c583);_0x55f823(_0x58c583);});});}function respondWithStatusCode(_0x6615ca,_0x479ba3){_0x479ba3=_0x479ba3||0xcc;return function(_0x1ae215){if(_0x1ae215){return _0x6615ca[_0x7c14('0x23')](_0x479ba3);}return _0x6615ca[_0x7c14('0x24')](_0x479ba3)[_0x7c14('0x25')]();};}function respondWithResult(_0x5a17cd,_0xedb162){_0xedb162=_0xedb162||0xc8;return function(_0x3b638a){if(_0x3b638a){return _0x5a17cd['status'](_0xedb162)[_0x7c14('0x26')](_0x3b638a);}};}function respondWithFilteredResult(_0x7c5330,_0x3017de){return function(_0x428d1b){if(_0x428d1b){var _0x20a459=typeof _0x3017de[_0x7c14('0x27')]===_0x7c14('0x28')&&typeof _0x3017de[_0x7c14('0x29')]===_0x7c14('0x28');var _0x4657ab=_0x428d1b[_0x7c14('0x2a')];var _0x2f051a=_0x20a459?0x0:_0x3017de[_0x7c14('0x27')];var _0x4d2c6a=_0x20a459?_0x428d1b[_0x7c14('0x2a')]:_0x3017de[_0x7c14('0x27')]+_0x3017de[_0x7c14('0x29')];var _0x1c659e;if(_0x4d2c6a>=_0x4657ab){_0x4d2c6a=_0x4657ab;_0x1c659e=0xc8;}else{_0x1c659e=0xce;}_0x7c5330[_0x7c14('0x24')](_0x1c659e);return _0x7c5330[_0x7c14('0x2b')](_0x7c14('0x2c'),_0x2f051a+'-'+_0x4d2c6a+'/'+_0x4657ab)[_0x7c14('0x26')](_0x428d1b);}return null;};}function patchUpdates(_0x7cd6f4){return function(_0x6b7b2d){try{jsonpatch[_0x7c14('0x2d')](_0x6b7b2d,_0x7cd6f4,!![]);}catch(_0x51dd56){return BPromise['reject'](_0x51dd56);}return _0x6b7b2d[_0x7c14('0x2e')]();};}function saveUpdates(_0x15f34e,_0x289577){return function(_0x4f22b1){if(_0x4f22b1){return _0x4f22b1[_0x7c14('0x2f')](_0x15f34e)['then'](function(_0x14a1a6){return _0x14a1a6;});}return null;};}function removeEntity(_0x2877eb,_0x467598){return function(_0x119d53){if(_0x119d53){return _0x119d53['destroy']()['then'](function(){var _0x4a9a74=_0x119d53['get']({'plain':!![]});var _0x1d57f1=_0x7c14('0x30');return db[_0x7c14('0x31')][_0x7c14('0x32')]({'where':{'type':_0x1d57f1,'resourceId':_0x4a9a74['id']}})[_0x7c14('0x18')](function(){return _0x119d53;});})[_0x7c14('0x18')](function(){_0x2877eb[_0x7c14('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3867df,_0x332f6e){return function(_0x435508){if(!_0x435508){_0x3867df[_0x7c14('0x23')](0x194);}return _0x435508;};}function handleError(_0x1d2e66,_0x3e0f06){_0x3e0f06=_0x3e0f06||0x1f4;return function(_0x54e6b3){logger[_0x7c14('0x1e')](_0x54e6b3[_0x7c14('0x33')]);if(_0x54e6b3[_0x7c14('0x34')]){delete _0x54e6b3[_0x7c14('0x34')];}_0x1d2e66[_0x7c14('0x24')](_0x3e0f06)['send'](_0x54e6b3);};}exports['index']=function(_0x531bdc,_0x3966af){var _0x4feb44={},_0x45180d={},_0x985687={'count':0x0,'rows':[]};var _0x3611a5=_[_0x7c14('0x35')](db['VoiceContext'][_0x7c14('0x36')],function(_0x563e15){return{'name':_0x563e15[_0x7c14('0x37')],'type':_0x563e15[_0x7c14('0x38')]['key']};});_0x45180d['model']=_[_0x7c14('0x35')](_0x3611a5,'name');_0x45180d['query']=_[_0x7c14('0x39')](_0x531bdc['query']);_0x45180d[_0x7c14('0x3a')]=_['intersection'](_0x45180d['model'],_0x45180d[_0x7c14('0x3b')]);_0x4feb44['attributes']=_[_0x7c14('0x3c')](_0x45180d[_0x7c14('0x3d')],qs[_0x7c14('0x3e')](_0x531bdc['query'][_0x7c14('0x3e')]));_0x4feb44[_0x7c14('0x3f')]=_0x4feb44[_0x7c14('0x3f')][_0x7c14('0x40')]?_0x4feb44[_0x7c14('0x3f')]:_0x45180d['model'];if(!_0x531bdc['query'][_0x7c14('0x41')](_0x7c14('0x42'))){_0x4feb44[_0x7c14('0x29')]=qs[_0x7c14('0x29')](_0x531bdc[_0x7c14('0x3b')][_0x7c14('0x29')]);_0x4feb44['offset']=qs[_0x7c14('0x27')](_0x531bdc['query'][_0x7c14('0x27')]);}_0x4feb44[_0x7c14('0x43')]=qs[_0x7c14('0x44')](_0x531bdc['query']['sort']);_0x4feb44[_0x7c14('0x45')]=qs[_0x7c14('0x3a')](_[_0x7c14('0x46')](_0x531bdc[_0x7c14('0x3b')],_0x45180d[_0x7c14('0x3a')]),_0x3611a5);if(_0x531bdc[_0x7c14('0x3b')]['filter']){_0x4feb44[_0x7c14('0x45')]=_[_0x7c14('0x47')](_0x4feb44['where'],{'$or':_['map'](_0x3611a5,function(_0x107054){if(_0x107054['type']!==_0x7c14('0x48')){var _0x37fdcd={};_0x37fdcd[_0x107054['name']]={'$like':'%'+_0x531bdc[_0x7c14('0x3b')]['filter']+'%'};return _0x37fdcd;}})});}_0x4feb44=_[_0x7c14('0x47')]({},_0x4feb44,_0x531bdc['options']);var _0x465653={'where':_0x4feb44[_0x7c14('0x45')]};return db[_0x7c14('0x49')][_0x7c14('0x2a')](_0x465653)['then'](function(_0xbc37af){_0x985687[_0x7c14('0x2a')]=_0xbc37af;if(_0x531bdc[_0x7c14('0x3b')][_0x7c14('0x4a')]){_0x4feb44[_0x7c14('0x4b')]=[{'all':!![]}];}return db[_0x7c14('0x49')][_0x7c14('0x4c')](_0x4feb44);})['then'](function(_0x27556f){_0x985687[_0x7c14('0x4d')]=_0x27556f;return _0x985687;})[_0x7c14('0x18')](respondWithFilteredResult(_0x3966af,_0x4feb44))[_0x7c14('0x22')](handleError(_0x3966af,null));};exports[_0x7c14('0x4e')]=function(_0x1f01fb,_0x4b2130){var _0x146777={'raw':![],'where':{'id':_0x1f01fb[_0x7c14('0x4f')]['id']}},_0x2de1ee={};_0x2de1ee['model']=_['keys'](db[_0x7c14('0x49')][_0x7c14('0x36')]);_0x2de1ee[_0x7c14('0x3b')]=_[_0x7c14('0x39')](_0x1f01fb['query']);_0x2de1ee[_0x7c14('0x3a')]=_[_0x7c14('0x3c')](_0x2de1ee[_0x7c14('0x3d')],_0x2de1ee[_0x7c14('0x3b')]);_0x146777[_0x7c14('0x3f')]=_['intersection'](_0x2de1ee[_0x7c14('0x3d')],qs[_0x7c14('0x3e')](_0x1f01fb[_0x7c14('0x3b')][_0x7c14('0x3e')]));_0x146777[_0x7c14('0x3f')]=_0x146777[_0x7c14('0x3f')][_0x7c14('0x40')]?_0x146777[_0x7c14('0x3f')]:_0x2de1ee[_0x7c14('0x3d')];if(_0x1f01fb[_0x7c14('0x3b')][_0x7c14('0x4a')]){_0x146777[_0x7c14('0x4b')]=[{'all':!![]}];}_0x146777=_['merge']({},_0x146777,_0x1f01fb[_0x7c14('0x50')]);return db[_0x7c14('0x49')][_0x7c14('0x51')](_0x146777)[_0x7c14('0x18')](handleEntityNotFound(_0x4b2130,null))[_0x7c14('0x18')](respondWithResult(_0x4b2130,null))[_0x7c14('0x22')](handleError(_0x4b2130,null));};exports['create']=function(_0x13670d,_0x3e2e69,_0x438d77){var _0x4b5dfc;return db[_0x7c14('0x49')]['create'](_0x13670d[_0x7c14('0x52')],{'raw':!![]})[_0x7c14('0x18')](function(_0x3838c4){_0x4b5dfc=_0x3838c4;return db[_0x7c14('0x49')]['findAll']({'raw':!![]});})[_0x7c14('0x18')](function(_0x31d342){var _0x70f2b7=fs['readFileSync'](path[_0x7c14('0x53')](config[_0x7c14('0x54')],_0x7c14('0x55')),_0x7c14('0x56'));var _0x3f5aca=ejs[_0x7c14('0x57')](_0x70f2b7,{'contexts':_0x31d342||[]});fs[_0x7c14('0x58')](_0x7c14('0x59'),_0x3f5aca);})['then'](function(){return respondWithRpcPromise('Reload',_0x7c14('0x5a'),{'module':_0x7c14('0x5b')});})[_0x7c14('0x18')](function(){var _0x4947ec=_0x13670d[_0x7c14('0x5c')][_0x7c14('0x5d')]({'plain':!![]});if(!_0x4947ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4947ec[_0x7c14('0x5e')]===_0x7c14('0x5c')){var _0x305c33=_0x4b5dfc[_0x7c14('0x5d')]({'plain':!![]});return db[_0x7c14('0x5f')][_0x7c14('0x51')]({'where':{'name':_0x7c14('0x30'),'userProfileId':_0x4947ec[_0x7c14('0x60')]},'raw':!![]})[_0x7c14('0x18')](function(_0x5d429c){if(_0x5d429c&&_0x5d429c[_0x7c14('0x61')]===0x0){return db[_0x7c14('0x31')][_0x7c14('0x5a')]({'name':_0x305c33[_0x7c14('0x34')],'resourceId':_0x305c33['id'],'type':_0x5d429c[_0x7c14('0x34')],'sectionId':_0x5d429c['id']},{})[_0x7c14('0x18')](function(){return _0x4b5dfc;});}else{return _0x4b5dfc;}})[_0x7c14('0x22')](function(_0x59fa6c){logger[_0x7c14('0x1e')](_0x7c14('0x62'),_0x59fa6c);throw _0x59fa6c;});}return _0x4b5dfc;})[_0x7c14('0x18')](respondWithResult(_0x3e2e69,0xc9))[_0x7c14('0x22')](handleError(_0x3e2e69,null));};exports[_0x7c14('0x2f')]=function(_0xdeb158,_0x5ced09,_0x1aa4b3){var _0x4aeb40;return db[_0x7c14('0x49')][_0x7c14('0x51')]({'where':{'id':_0xdeb158['params']['id']}})[_0x7c14('0x18')](handleEntityNotFound(_0x5ced09,null))[_0x7c14('0x18')](saveUpdates(_0xdeb158[_0x7c14('0x52')],null))[_0x7c14('0x18')](function(_0x4be2a4){if(_0x4be2a4){_0x4aeb40=_0x4be2a4;return db[_0x7c14('0x49')][_0x7c14('0x4c')]({'raw':!![]});}})[_0x7c14('0x18')](function(_0xe26745){var _0x5353e5=fs[_0x7c14('0x63')](path[_0x7c14('0x53')](config[_0x7c14('0x54')],_0x7c14('0x55')),_0x7c14('0x56'));var _0x54c42e=ejs['render'](_0x5353e5,{'contexts':_0xe26745||[]});fs[_0x7c14('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x54c42e);})[_0x7c14('0x18')](function(){return respondWithRpcPromise(_0x7c14('0x64'),'update',{'module':_0x7c14('0x5b')});})[_0x7c14('0x18')](function(){return _0x4aeb40;})[_0x7c14('0x18')](respondWithResult(_0x5ced09,null))['catch'](handleError(_0x5ced09,null));};exports[_0x7c14('0x32')]=function(_0x3d3b62,_0x46b334,_0xb65837){var _0x216d5a;return db[_0x7c14('0x49')]['find']({'where':{'id':_0x3d3b62[_0x7c14('0x4f')]['id']}})[_0x7c14('0x18')](handleEntityNotFound(_0x46b334,null))[_0x7c14('0x18')](removeEntity(_0x46b334,null))['then'](function(){return db[_0x7c14('0x49')][_0x7c14('0x4c')]({'raw':!![]});})['then'](function(_0x188f9c){var _0x3c03bb=fs[_0x7c14('0x63')](path[_0x7c14('0x53')](config[_0x7c14('0x54')],_0x7c14('0x55')),_0x7c14('0x56'));var _0x278754=ejs[_0x7c14('0x57')](_0x3c03bb,{'contexts':_0x188f9c});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x278754);return respondWithRpcPromise(_0x7c14('0x64'),_0x7c14('0x32'),{'module':'chan_sip.so'});})[_0x7c14('0x22')](handleError(_0x46b334,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3d5eacf..52bcb8b 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 _0xe574=['path','./voiceContext.attributes','define','voice_contexts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xe574,0x1ea));var _0x4e57=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe574[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e57('0x0'))(_0x4e57('0x1'));var moment=require(_0x4e57('0x2'));var BPromise=require(_0x4e57('0x3'));var rp=require(_0x4e57('0x4'));var fs=require('fs');var path=require(_0x4e57('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e57('0x6'));module['exports']=function(_0x27a81c,_0x37620d){return _0x27a81c[_0x4e57('0x7')]('VoiceContext',attributes,{'tableName':_0x4e57('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e73=['./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x13a125,_0x17b337){var _0x20f5d6=function(_0x384e42){while(--_0x384e42){_0x13a125['push'](_0x13a125['shift']());}};_0x20f5d6(++_0x17b337);}(_0x7e73,0xbf));var _0x37e7=function(_0x635b8,_0x108729){_0x635b8=_0x635b8-0x0;var _0x1e1857=_0x7e73[_0x635b8];return _0x1e1857;};'use strict';var _=require(_0x37e7('0x0'));var util=require('util');var logger=require(_0x37e7('0x1'))(_0x37e7('0x2'));var moment=require('moment');var BPromise=require(_0x37e7('0x3'));var rp=require(_0x37e7('0x4'));var fs=require('fs');var path=require(_0x37e7('0x5'));var rimraf=require('rimraf');var config=require(_0x37e7('0x6'));var attributes=require(_0x37e7('0x7'));module['exports']=function(_0x178b26,_0x5e3323){return _0x178b26[_0x37e7('0x8')](_0x37e7('0x9'),attributes,{'tableName':_0x37e7('0xa'),'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 8b7d34a..8760718 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 _0x2ca5=['code','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x2ca5,0x108));var _0x52ca=function(_0x1619c1,_0x21b9fd){_0x1619c1=_0x1619c1-0x0;var _0x424d3f=_0x2ca5[_0x1619c1];return _0x424d3f;};'use strict';var _=require('lodash');var util=require(_0x52ca('0x0'));var moment=require(_0x52ca('0x1'));var BPromise=require(_0x52ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x52ca('0x4'))(_0x52ca('0x5'));var config=require(_0x52ca('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f735b,_0x597e31,_0x5d3c5d){return new BPromise(function(_0x37db18,_0x4713f1){return client[_0x52ca('0x7')](_0x2f735b,_0x5d3c5d)[_0x52ca('0x8')](function(_0x477e8b){logger[_0x52ca('0x9')](_0x52ca('0xa'),_0x597e31,'request\x20sent');logger[_0x52ca('0xb')](_0x52ca('0xc'),_0x597e31,_0x52ca('0xd'),JSON[_0x52ca('0xe')](_0x477e8b));if(_0x477e8b[_0x52ca('0xf')]){if(_0x477e8b[_0x52ca('0xf')][_0x52ca('0x10')]===0x1f4){logger[_0x52ca('0xf')]('VoiceContext,\x20%s,\x20%s',_0x597e31,_0x477e8b[_0x52ca('0xf')][_0x52ca('0x11')]);return _0x4713f1(_0x477e8b[_0x52ca('0xf')][_0x52ca('0x11')]);}logger[_0x52ca('0xf')](_0x52ca('0xa'),_0x597e31,_0x477e8b[_0x52ca('0xf')][_0x52ca('0x11')]);return _0x37db18(_0x477e8b[_0x52ca('0xf')]['message']);}else{logger['info'](_0x52ca('0xa'),_0x597e31,_0x52ca('0xd'));_0x37db18(_0x477e8b[_0x52ca('0x12')][_0x52ca('0x11')]);}})[_0x52ca('0x13')](function(_0x1b886f){logger[_0x52ca('0xf')](_0x52ca('0xa'),_0x597e31,_0x1b886f);_0x4713f1(_0x1b886f);});});} \ No newline at end of file +var _0x1df7=['jayson/promise','client','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d584f,_0x385fcd){var _0x383793=function(_0x309159){while(--_0x309159){_0x4d584f['push'](_0x4d584f['shift']());}};_0x383793(++_0x385fcd);}(_0x1df7,0x6e));var _0x71df=function(_0x5dc115,_0x248f61){_0x5dc115=_0x5dc115-0x0;var _0x4af8e7=_0x1df7[_0x5dc115];return _0x4af8e7;};'use strict';var _=require('lodash');var util=require(_0x71df('0x0'));var moment=require(_0x71df('0x1'));var BPromise=require(_0x71df('0x2'));var rs=require(_0x71df('0x3'));var fs=require('fs');var Redis=require(_0x71df('0x4'));var db=require(_0x71df('0x5'))['db'];var utils=require(_0x71df('0x6'));var logger=require(_0x71df('0x7'))(_0x71df('0x8'));var config=require(_0x71df('0x9'));var jayson=require(_0x71df('0xa'));var client=jayson[_0x71df('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fe258,_0x487f3d,_0xc2d7ef){return new BPromise(function(_0x88acfd,_0x4a21c4){return client[_0x71df('0xc')](_0x2fe258,_0xc2d7ef)['then'](function(_0x3cb3be){logger[_0x71df('0xd')]('VoiceContext,\x20%s,\x20%s',_0x487f3d,_0x71df('0xe'));logger[_0x71df('0xf')](_0x71df('0x10'),_0x487f3d,'request\x20sent',JSON[_0x71df('0x11')](_0x3cb3be));if(_0x3cb3be[_0x71df('0x12')]){if(_0x3cb3be['error'][_0x71df('0x13')]===0x1f4){logger[_0x71df('0x12')](_0x71df('0x14'),_0x487f3d,_0x3cb3be['error']['message']);return _0x4a21c4(_0x3cb3be[_0x71df('0x12')][_0x71df('0x15')]);}logger['error'](_0x71df('0x14'),_0x487f3d,_0x3cb3be[_0x71df('0x12')][_0x71df('0x15')]);return _0x88acfd(_0x3cb3be[_0x71df('0x12')][_0x71df('0x15')]);}else{logger[_0x71df('0xd')](_0x71df('0x14'),_0x487f3d,_0x71df('0xe'));_0x88acfd(_0x3cb3be[_0x71df('0x16')][_0x71df('0x15')]);}})[_0x71df('0x17')](function(_0x2ed677){logger['error'](_0x71df('0x14'),_0x487f3d,_0x2ed677);_0x4a21c4(_0x2ed677);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e852262..9979c6f 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 _0xbc0f=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','post','create','put','/:id','delete','destroy','multer'];(function(_0x14c199,_0x232e60){var _0x330273=function(_0xaec810){while(--_0xaec810){_0x14c199['push'](_0x14c199['shift']());}};_0x330273(++_0x232e60);}(_0xbc0f,0x175));var _0xfbc0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xbc0f[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xfbc0('0x0'));var util=require(_0xfbc0('0x1'));var path=require('path');var timeout=require(_0xfbc0('0x2'));var express=require(_0xfbc0('0x3'));var router=express[_0xfbc0('0x4')]();var fs_extra=require(_0xfbc0('0x5'));var auth=require(_0xfbc0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xfbc0('0x7')]('/',auth[_0xfbc0('0x8')](),controller[_0xfbc0('0x9')]);router[_0xfbc0('0x7')]('/describe',auth[_0xfbc0('0x8')](),controller[_0xfbc0('0xa')]);router[_0xfbc0('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfbc0('0xb')]('/',auth['isAuthenticated'](),controller[_0xfbc0('0xc')]);router[_0xfbc0('0xd')](_0xfbc0('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xfbc0('0xf')](_0xfbc0('0xe'),auth['isAuthenticated'](),controller[_0xfbc0('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc922=['../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2d38da,_0x2ef0e6){var _0x2e1edc=function(_0x130744){while(--_0x130744){_0x2d38da['push'](_0x2d38da['shift']());}};_0x2e1edc(++_0x2ef0e6);}(_0xc922,0x1b0));var _0x2c92=function(_0x2a72e7,_0x2aee32){_0x2a72e7=_0x2a72e7-0x0;var _0x52c690=_0xc922[_0x2a72e7];return _0x52c690;};'use strict';var multer=require('multer');var util=require(_0x2c92('0x0'));var path=require('path');var timeout=require(_0x2c92('0x1'));var express=require(_0x2c92('0x2'));var router=express['Router']();var fs_extra=require(_0x2c92('0x3'));var auth=require(_0x2c92('0x4'));var interaction=require(_0x2c92('0x5'));var config=require(_0x2c92('0x6'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2c92('0x7')]);router[_0x2c92('0x8')](_0x2c92('0x9'),auth[_0x2c92('0xa')](),controller[_0x2c92('0xb')]);router[_0x2c92('0x8')](_0x2c92('0xc'),auth['isAuthenticated'](),controller[_0x2c92('0xd')]);router['post']('/',auth[_0x2c92('0xa')](),controller[_0x2c92('0xe')]);router[_0x2c92('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2c92('0x10')](_0x2c92('0xc'),auth['isAuthenticated'](),controller[_0x2c92('0x11')]);module[_0x2c92('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 9b3cfd8..20f6a31 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 _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x195ca6,_0x1edb2c){var _0x3b627d=function(_0x1081f2){while(--_0x1081f2){_0x195ca6['push'](_0x195ca6['shift']());}};_0x3b627d(++_0x1edb2c);}(_0x425d,0x1e0));var _0xd425=function(_0x274e84,_0x306f4e){_0x274e84=_0x274e84-0x0;var _0x3591b0=_0x425d[_0x274e84];return _0x3591b0;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x4f837a,_0x57ad06){var _0x1cd2de=function(_0x5df6ee){while(--_0x5df6ee){_0x4f837a['push'](_0x4f837a['shift']());}};_0x1cd2de(++_0x57ad06);}(_0x98a8,0x12c));var _0x898a=function(_0x5358e0,_0x2282b5){_0x5358e0=_0x5358e0-0x0;var _0x14eee7=_0x98a8[_0x5358e0];return _0x14eee7;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 46d458f..1b80b5c 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 _0x1a79=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','length','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x56d1b5,_0x289333){var _0x4ad91e=function(_0x15f467){while(--_0x15f467){_0x56d1b5['push'](_0x56d1b5['shift']());}};_0x4ad91e(++_0x289333);}(_0x1a79,0x125));var _0x91a7=function(_0x54fc91,_0x5b1ea7){_0x54fc91=_0x54fc91-0x0;var _0x436697=_0x1a79[_0x54fc91];return _0x436697;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x91a7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91a7('0x1'));var rp=require(_0x91a7('0x2'));var moment=require(_0x91a7('0x3'));var BPromise=require(_0x91a7('0x4'));var Mustache=require(_0x91a7('0x5'));var util=require(_0x91a7('0x6'));var path=require(_0x91a7('0x7'));var sox=require(_0x91a7('0x8'));var csv=require(_0x91a7('0x9'));var ejs=require(_0x91a7('0xa'));var fs=require('fs');var fs_extra=require(_0x91a7('0xb'));var _=require(_0x91a7('0xc'));var squel=require('squel');var crypto=require(_0x91a7('0xd'));var jsforce=require(_0x91a7('0xe'));var deskjs=require(_0x91a7('0xf'));var toCsv=require(_0x91a7('0x9'));var querystring=require('querystring');var Papa=require(_0x91a7('0x10'));var Redis=require(_0x91a7('0x11'));var authService=require(_0x91a7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x91a7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91a7('0x14'))(_0x91a7('0x15'));var utils=require(_0x91a7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x91a7('0x17'));var db=require(_0x91a7('0x18'))['db'];function respondWithStatusCode(_0x4cfa17,_0x54d84d){_0x54d84d=_0x54d84d||0xcc;return function(_0x8c79ae){if(_0x8c79ae){return _0x4cfa17['sendStatus'](_0x54d84d);}return _0x4cfa17[_0x91a7('0x19')](_0x54d84d)[_0x91a7('0x1a')]();};}function respondWithResult(_0x2cbaaf,_0x7a3901){_0x7a3901=_0x7a3901||0xc8;return function(_0x37377d){if(_0x37377d){return _0x2cbaaf[_0x91a7('0x19')](_0x7a3901)[_0x91a7('0x1b')](_0x37377d);}};}function respondWithFilteredResult(_0x435e21,_0x429d7d){return function(_0x55156c){if(_0x55156c){var _0x2709be=typeof _0x429d7d[_0x91a7('0x1c')]===_0x91a7('0x1d')&&typeof _0x429d7d[_0x91a7('0x1e')]===_0x91a7('0x1d');var _0x4dd85e=_0x55156c['count'];var _0xe8312d=_0x2709be?0x0:_0x429d7d[_0x91a7('0x1c')];var _0x5242da=_0x2709be?_0x55156c[_0x91a7('0x1f')]:_0x429d7d[_0x91a7('0x1c')]+_0x429d7d[_0x91a7('0x1e')];var _0x590b8a;if(_0x5242da>=_0x4dd85e){_0x5242da=_0x4dd85e;_0x590b8a=0xc8;}else{_0x590b8a=0xce;}_0x435e21['status'](_0x590b8a);return _0x435e21[_0x91a7('0x20')](_0x91a7('0x21'),_0xe8312d+'-'+_0x5242da+'/'+_0x4dd85e)['json'](_0x55156c);}return null;};}function patchUpdates(_0x48987c){return function(_0x297a1b){try{jsonpatch[_0x91a7('0x22')](_0x297a1b,_0x48987c,!![]);}catch(_0x2a69bc){return BPromise['reject'](_0x2a69bc);}return _0x297a1b[_0x91a7('0x23')]();};}function saveUpdates(_0x1c6ace,_0x4ce9e3){return function(_0x42b3b2){if(_0x42b3b2){return _0x42b3b2[_0x91a7('0x24')](_0x1c6ace)[_0x91a7('0x25')](function(_0x526428){return _0x526428;});}return null;};}function removeEntity(_0x1262c8,_0x3f4074){return function(_0x398bea){if(_0x398bea){return _0x398bea[_0x91a7('0x26')]()['then'](function(){_0x1262c8[_0x91a7('0x19')](0xcc)[_0x91a7('0x1a')]();});}};}function handleEntityNotFound(_0x1b7c67,_0x265bca){return function(_0x34921b){if(!_0x34921b){_0x1b7c67[_0x91a7('0x27')](0x194);}return _0x34921b;};}function handleError(_0x4a0612,_0x8ddd93){_0x8ddd93=_0x8ddd93||0x1f4;return function(_0x4c7fe1){logger[_0x91a7('0x28')](_0x4c7fe1[_0x91a7('0x29')]);if(_0x4c7fe1[_0x91a7('0x2a')]){delete _0x4c7fe1['name'];}_0x4a0612[_0x91a7('0x19')](_0x8ddd93)['send'](_0x4c7fe1);};}exports['index']=function(_0x5d9e59,_0x2822d9){var _0x461e19={},_0x564a25={},_0x168f7c={'count':0x0,'rows':[]};var _0x3b95d2=_['map'](db[_0x91a7('0x2b')][_0x91a7('0x2c')],function(_0x3d654){return{'name':_0x3d654[_0x91a7('0x2d')],'type':_0x3d654[_0x91a7('0x2e')][_0x91a7('0x2f')]};});_0x564a25[_0x91a7('0x30')]=_['map'](_0x3b95d2,_0x91a7('0x2a'));_0x564a25[_0x91a7('0x31')]=_['keys'](_0x5d9e59[_0x91a7('0x31')]);_0x564a25[_0x91a7('0x32')]=_['intersection'](_0x564a25[_0x91a7('0x30')],_0x564a25[_0x91a7('0x31')]);_0x461e19[_0x91a7('0x33')]=_[_0x91a7('0x34')](_0x564a25[_0x91a7('0x30')],qs[_0x91a7('0x35')](_0x5d9e59[_0x91a7('0x31')][_0x91a7('0x35')]));_0x461e19['attributes']=_0x461e19[_0x91a7('0x33')]['length']?_0x461e19[_0x91a7('0x33')]:_0x564a25['model'];if(!_0x5d9e59[_0x91a7('0x31')][_0x91a7('0x36')](_0x91a7('0x37'))){_0x461e19[_0x91a7('0x1e')]=qs[_0x91a7('0x1e')](_0x5d9e59[_0x91a7('0x31')][_0x91a7('0x1e')]);_0x461e19[_0x91a7('0x1c')]=qs[_0x91a7('0x1c')](_0x5d9e59[_0x91a7('0x31')]['offset']);}_0x461e19[_0x91a7('0x38')]=qs[_0x91a7('0x39')](_0x5d9e59[_0x91a7('0x31')]['sort']);_0x461e19[_0x91a7('0x3a')]=qs[_0x91a7('0x32')](_[_0x91a7('0x3b')](_0x5d9e59[_0x91a7('0x31')],_0x564a25[_0x91a7('0x32')]),_0x3b95d2);if(_0x5d9e59[_0x91a7('0x31')][_0x91a7('0x3c')]){_0x461e19[_0x91a7('0x3a')]=_['merge'](_0x461e19['where'],{'$or':_[_0x91a7('0x3d')](_0x3b95d2,function(_0x1a32fb){if(_0x1a32fb[_0x91a7('0x2e')]!==_0x91a7('0x3e')){var _0x16bcb8={};_0x16bcb8[_0x1a32fb[_0x91a7('0x2a')]]={'$like':'%'+_0x5d9e59[_0x91a7('0x31')][_0x91a7('0x3c')]+'%'};return _0x16bcb8;}})});}_0x461e19=_[_0x91a7('0x3f')]({},_0x461e19,_0x5d9e59[_0x91a7('0x40')]);var _0x1470bf={'where':_0x461e19[_0x91a7('0x3a')]};return db[_0x91a7('0x2b')][_0x91a7('0x1f')](_0x1470bf)['then'](function(_0x23e409){_0x168f7c[_0x91a7('0x1f')]=_0x23e409;if(_0x5d9e59['query'][_0x91a7('0x41')]){_0x461e19[_0x91a7('0x42')]=[{'all':!![]}];}return db[_0x91a7('0x2b')]['findAll'](_0x461e19);})[_0x91a7('0x25')](function(_0x1ee0bb){_0x168f7c[_0x91a7('0x43')]=_0x1ee0bb;return _0x168f7c;})[_0x91a7('0x25')](respondWithFilteredResult(_0x2822d9,_0x461e19))['catch'](handleError(_0x2822d9,null));};exports[_0x91a7('0x44')]=function(_0x2315e0,_0x38f029){var _0x7628a9={'raw':!![],'where':{'id':_0x2315e0[_0x91a7('0x45')]['id']}},_0x17b34e={};_0x17b34e[_0x91a7('0x30')]=_[_0x91a7('0x46')](db[_0x91a7('0x2b')][_0x91a7('0x2c')]);_0x17b34e['query']=_[_0x91a7('0x46')](_0x2315e0[_0x91a7('0x31')]);_0x17b34e[_0x91a7('0x32')]=_[_0x91a7('0x34')](_0x17b34e['model'],_0x17b34e[_0x91a7('0x31')]);_0x7628a9['attributes']=_[_0x91a7('0x34')](_0x17b34e[_0x91a7('0x30')],qs[_0x91a7('0x35')](_0x2315e0[_0x91a7('0x31')][_0x91a7('0x35')]));_0x7628a9[_0x91a7('0x33')]=_0x7628a9[_0x91a7('0x33')][_0x91a7('0x47')]?_0x7628a9[_0x91a7('0x33')]:_0x17b34e[_0x91a7('0x30')];if(_0x2315e0[_0x91a7('0x31')][_0x91a7('0x41')]){_0x7628a9['include']=[{'all':!![]}];}_0x7628a9=_['merge']({},_0x7628a9,_0x2315e0[_0x91a7('0x40')]);return db[_0x91a7('0x2b')][_0x91a7('0x48')](_0x7628a9)[_0x91a7('0x25')](handleEntityNotFound(_0x38f029,null))[_0x91a7('0x25')](respondWithResult(_0x38f029,null))[_0x91a7('0x49')](handleError(_0x38f029,null));};exports[_0x91a7('0x4a')]=function(_0x4267da,_0x267a22){return db[_0x91a7('0x2b')][_0x91a7('0x4a')](_0x4267da['body'],{})[_0x91a7('0x25')](respondWithResult(_0x267a22,0xc9))['catch'](handleError(_0x267a22,null));};exports[_0x91a7('0x24')]=function(_0x14d24f,_0x49fbf4){if(_0x14d24f[_0x91a7('0x4b')]['id']){delete _0x14d24f[_0x91a7('0x4b')]['id'];}return db[_0x91a7('0x2b')]['find']({'where':{'id':_0x14d24f[_0x91a7('0x45')]['id']}})['then'](handleEntityNotFound(_0x49fbf4,null))[_0x91a7('0x25')](saveUpdates(_0x14d24f[_0x91a7('0x4b')],null))[_0x91a7('0x25')](respondWithResult(_0x49fbf4,null))[_0x91a7('0x49')](handleError(_0x49fbf4,null));};exports[_0x91a7('0x26')]=function(_0x30d068,_0x918e9f){return db[_0x91a7('0x2b')][_0x91a7('0x48')]({'where':{'id':_0x30d068[_0x91a7('0x45')]['id']}})['then'](handleEntityNotFound(_0x918e9f,null))[_0x91a7('0x25')](removeEntity(_0x918e9f,null))['catch'](handleError(_0x918e9f,null));};exports[_0x91a7('0x4c')]=function(_0x38c390,_0xf0b4da){return db['VoiceDialReport'][_0x91a7('0x4c')]()[_0x91a7('0x25')](respondWithResult(_0xf0b4da,null))[_0x91a7('0x49')](handleError(_0xf0b4da,null));}; \ No newline at end of file +var _0x45b0=['Content-Range','save','update','destroy','then','end','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x168eeb,_0x322629){var _0x239d01=function(_0xba49b7){while(--_0xba49b7){_0x168eeb['push'](_0x168eeb['shift']());}};_0x239d01(++_0x322629);}(_0x45b0,0x152));var _0x045b=function(_0x2de36b,_0x3bde7d){_0x2de36b=_0x2de36b-0x0;var _0x557ad1=_0x45b0[_0x2de36b];return _0x557ad1;};'use strict';var emlformat=require(_0x045b('0x0'));var rimraf=require(_0x045b('0x1'));var zipdir=require(_0x045b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x045b('0x3'));var moment=require(_0x045b('0x4'));var BPromise=require(_0x045b('0x5'));var Mustache=require(_0x045b('0x6'));var util=require(_0x045b('0x7'));var path=require(_0x045b('0x8'));var sox=require(_0x045b('0x9'));var csv=require(_0x045b('0xa'));var ejs=require(_0x045b('0xb'));var fs=require('fs');var fs_extra=require(_0x045b('0xc'));var _=require(_0x045b('0xd'));var squel=require(_0x045b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x045b('0xa'));var querystring=require(_0x045b('0xf'));var Papa=require(_0x045b('0x10'));var Redis=require(_0x045b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x045b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x045b('0x13'));var logger=require('../../config/logger')(_0x045b('0x14'));var utils=require(_0x045b('0x15'));var config=require(_0x045b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x045b('0x17'))['db'];function respondWithStatusCode(_0x184127,_0x2427d9){_0x2427d9=_0x2427d9||0xcc;return function(_0x1806ee){if(_0x1806ee){return _0x184127[_0x045b('0x18')](_0x2427d9);}return _0x184127['status'](_0x2427d9)['end']();};}function respondWithResult(_0x35d8b9,_0x473b64){_0x473b64=_0x473b64||0xc8;return function(_0xf35025){if(_0xf35025){return _0x35d8b9[_0x045b('0x19')](_0x473b64)[_0x045b('0x1a')](_0xf35025);}};}function respondWithFilteredResult(_0x4bc1ad,_0xf1174c){return function(_0xd0b7e8){if(_0xd0b7e8){var _0x57bdeb=typeof _0xf1174c[_0x045b('0x1b')]===_0x045b('0x1c')&&typeof _0xf1174c[_0x045b('0x1d')]===_0x045b('0x1c');var _0x461c47=_0xd0b7e8[_0x045b('0x1e')];var _0x3b1642=_0x57bdeb?0x0:_0xf1174c[_0x045b('0x1b')];var _0xfacf7e=_0x57bdeb?_0xd0b7e8[_0x045b('0x1e')]:_0xf1174c['offset']+_0xf1174c['limit'];var _0x436985;if(_0xfacf7e>=_0x461c47){_0xfacf7e=_0x461c47;_0x436985=0xc8;}else{_0x436985=0xce;}_0x4bc1ad[_0x045b('0x19')](_0x436985);return _0x4bc1ad[_0x045b('0x1f')](_0x045b('0x20'),_0x3b1642+'-'+_0xfacf7e+'/'+_0x461c47)[_0x045b('0x1a')](_0xd0b7e8);}return null;};}function patchUpdates(_0x1e3d1b){return function(_0x15ef58){try{jsonpatch['apply'](_0x15ef58,_0x1e3d1b,!![]);}catch(_0x22dd86){return BPromise['reject'](_0x22dd86);}return _0x15ef58[_0x045b('0x21')]();};}function saveUpdates(_0x433e89,_0xf8b75f){return function(_0xb42f7d){if(_0xb42f7d){return _0xb42f7d[_0x045b('0x22')](_0x433e89)['then'](function(_0x3f91ef){return _0x3f91ef;});}return null;};}function removeEntity(_0x34e9cf,_0x41dd10){return function(_0x4952a2){if(_0x4952a2){return _0x4952a2[_0x045b('0x23')]()[_0x045b('0x24')](function(){_0x34e9cf[_0x045b('0x19')](0xcc)[_0x045b('0x25')]();});}};}function handleEntityNotFound(_0x2f0d6d,_0x1093c1){return function(_0x146967){if(!_0x146967){_0x2f0d6d['sendStatus'](0x194);}return _0x146967;};}function handleError(_0x2c9a83,_0x3cdece){_0x3cdece=_0x3cdece||0x1f4;return function(_0x10890e){logger[_0x045b('0x26')](_0x10890e[_0x045b('0x27')]);if(_0x10890e[_0x045b('0x28')]){delete _0x10890e[_0x045b('0x28')];}_0x2c9a83['status'](_0x3cdece)['send'](_0x10890e);};}exports[_0x045b('0x29')]=function(_0x2d3135,_0x532cf1){var _0x56586a={},_0x363e1f={},_0x717b06={'count':0x0,'rows':[]};var _0x16d883=_[_0x045b('0x2a')](db[_0x045b('0x2b')][_0x045b('0x2c')],function(_0x2d56b4){return{'name':_0x2d56b4[_0x045b('0x2d')],'type':_0x2d56b4[_0x045b('0x2e')][_0x045b('0x2f')]};});_0x363e1f[_0x045b('0x30')]=_[_0x045b('0x2a')](_0x16d883,'name');_0x363e1f[_0x045b('0x31')]=_[_0x045b('0x32')](_0x2d3135[_0x045b('0x31')]);_0x363e1f['filters']=_['intersection'](_0x363e1f[_0x045b('0x30')],_0x363e1f[_0x045b('0x31')]);_0x56586a[_0x045b('0x33')]=_[_0x045b('0x34')](_0x363e1f[_0x045b('0x30')],qs[_0x045b('0x35')](_0x2d3135[_0x045b('0x31')]['fields']));_0x56586a[_0x045b('0x33')]=_0x56586a[_0x045b('0x33')][_0x045b('0x36')]?_0x56586a[_0x045b('0x33')]:_0x363e1f[_0x045b('0x30')];if(!_0x2d3135[_0x045b('0x31')][_0x045b('0x37')](_0x045b('0x38'))){_0x56586a[_0x045b('0x1d')]=qs[_0x045b('0x1d')](_0x2d3135[_0x045b('0x31')]['limit']);_0x56586a[_0x045b('0x1b')]=qs['offset'](_0x2d3135[_0x045b('0x31')]['offset']);}_0x56586a['order']=qs['sort'](_0x2d3135[_0x045b('0x31')]['sort']);_0x56586a[_0x045b('0x39')]=qs[_0x045b('0x3a')](_[_0x045b('0x3b')](_0x2d3135['query'],_0x363e1f[_0x045b('0x3a')]),_0x16d883);if(_0x2d3135[_0x045b('0x31')][_0x045b('0x3c')]){_0x56586a[_0x045b('0x39')]=_[_0x045b('0x3d')](_0x56586a[_0x045b('0x39')],{'$or':_[_0x045b('0x2a')](_0x16d883,function(_0x476a0a){if(_0x476a0a['type']!=='VIRTUAL'){var _0x13ab2d={};_0x13ab2d[_0x476a0a['name']]={'$like':'%'+_0x2d3135[_0x045b('0x31')][_0x045b('0x3c')]+'%'};return _0x13ab2d;}})});}_0x56586a=_[_0x045b('0x3d')]({},_0x56586a,_0x2d3135[_0x045b('0x3e')]);var _0x50eb39={'where':_0x56586a[_0x045b('0x39')]};return db['VoiceDialReport'][_0x045b('0x1e')](_0x50eb39)[_0x045b('0x24')](function(_0x6c698f){_0x717b06[_0x045b('0x1e')]=_0x6c698f;if(_0x2d3135['query'][_0x045b('0x3f')]){_0x56586a[_0x045b('0x40')]=[{'all':!![]}];}return db[_0x045b('0x2b')][_0x045b('0x41')](_0x56586a);})[_0x045b('0x24')](function(_0xa26e3f){_0x717b06[_0x045b('0x42')]=_0xa26e3f;return _0x717b06;})[_0x045b('0x24')](respondWithFilteredResult(_0x532cf1,_0x56586a))['catch'](handleError(_0x532cf1,null));};exports[_0x045b('0x43')]=function(_0x268703,_0xd28bfc){var _0x1919fa={'raw':!![],'where':{'id':_0x268703[_0x045b('0x44')]['id']}},_0x3d7071={};_0x3d7071['model']=_[_0x045b('0x32')](db[_0x045b('0x2b')]['rawAttributes']);_0x3d7071['query']=_['keys'](_0x268703[_0x045b('0x31')]);_0x3d7071[_0x045b('0x3a')]=_[_0x045b('0x34')](_0x3d7071[_0x045b('0x30')],_0x3d7071[_0x045b('0x31')]);_0x1919fa[_0x045b('0x33')]=_['intersection'](_0x3d7071[_0x045b('0x30')],qs['fields'](_0x268703[_0x045b('0x31')]['fields']));_0x1919fa[_0x045b('0x33')]=_0x1919fa[_0x045b('0x33')][_0x045b('0x36')]?_0x1919fa[_0x045b('0x33')]:_0x3d7071[_0x045b('0x30')];if(_0x268703[_0x045b('0x31')][_0x045b('0x3f')]){_0x1919fa['include']=[{'all':!![]}];}_0x1919fa=_[_0x045b('0x3d')]({},_0x1919fa,_0x268703[_0x045b('0x3e')]);return db['VoiceDialReport'][_0x045b('0x45')](_0x1919fa)[_0x045b('0x24')](handleEntityNotFound(_0xd28bfc,null))[_0x045b('0x24')](respondWithResult(_0xd28bfc,null))['catch'](handleError(_0xd28bfc,null));};exports[_0x045b('0x46')]=function(_0x41d363,_0xa5c2d4){return db[_0x045b('0x2b')][_0x045b('0x46')](_0x41d363[_0x045b('0x47')],{})['then'](respondWithResult(_0xa5c2d4,0xc9))[_0x045b('0x48')](handleError(_0xa5c2d4,null));};exports[_0x045b('0x22')]=function(_0x2d34f2,_0x2b9729){if(_0x2d34f2[_0x045b('0x47')]['id']){delete _0x2d34f2['body']['id'];}return db['VoiceDialReport'][_0x045b('0x45')]({'where':{'id':_0x2d34f2[_0x045b('0x44')]['id']}})[_0x045b('0x24')](handleEntityNotFound(_0x2b9729,null))[_0x045b('0x24')](saveUpdates(_0x2d34f2['body'],null))[_0x045b('0x24')](respondWithResult(_0x2b9729,null))[_0x045b('0x48')](handleError(_0x2b9729,null));};exports['destroy']=function(_0x5727cf,_0x39e4f1){return db[_0x045b('0x2b')]['find']({'where':{'id':_0x5727cf[_0x045b('0x44')]['id']}})[_0x045b('0x24')](handleEntityNotFound(_0x39e4f1,null))[_0x045b('0x24')](removeEntity(_0x39e4f1,null))['catch'](handleError(_0x39e4f1,null));};exports[_0x045b('0x49')]=function(_0xf26d33,_0x2829ee){return db[_0x045b('0x2b')]['describe']()[_0x045b('0x24')](respondWithResult(_0x2829ee,null))[_0x045b('0x48')](handleError(_0x2829ee,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a687b90..291ada5 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 _0x0f44=['../../config/environment','./voiceDialReport.attributes','report_dial','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x1cb9bd,_0x37af34){var _0x7065c7=function(_0xbc1ba3){while(--_0xbc1ba3){_0x1cb9bd['push'](_0x1cb9bd['shift']());}};_0x7065c7(++_0x37af34);}(_0x0f44,0x7d));var _0x40f4=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0x0f44[_0x334f9a];return _0x2b219d;};'use strict';var _=require(_0x40f4('0x0'));var util=require(_0x40f4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x40f4('0x2'));var BPromise=require(_0x40f4('0x3'));var rp=require(_0x40f4('0x4'));var fs=require('fs');var path=require(_0x40f4('0x5'));var rimraf=require(_0x40f4('0x6'));var config=require(_0x40f4('0x7'));var attributes=require(_0x40f4('0x8'));module['exports']=function(_0x46d92e,_0x4a45aa){return _0x46d92e['define']('VoiceDialReport',attributes,{'tableName':_0x40f4('0x9'),'paranoid':![],'indexes':[{'fields':[_0x40f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x307e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x2c59df,_0x36617c){var _0x4ed6a1=function(_0x3f2ac7){while(--_0x3f2ac7){_0x2c59df['push'](_0x2c59df['shift']());}};_0x4ed6a1(++_0x36617c);}(_0x307e,0x1ec));var _0xe307=function(_0x1c2a5a,_0x3574e5){_0x1c2a5a=_0x1c2a5a-0x0;var _0x735096=_0x307e[_0x1c2a5a];return _0x735096;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe307('0x0'))(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require(_0xe307('0x3'));var rp=require(_0xe307('0x4'));var fs=require('fs');var path=require(_0xe307('0x5'));var rimraf=require(_0xe307('0x6'));var config=require('../../config/environment');var attributes=require(_0xe307('0x7'));module['exports']=function(_0x275a35,_0x2eaf40){return _0x275a35[_0xe307('0x8')](_0xe307('0x9'),attributes,{'tableName':_0xe307('0xa'),'paranoid':![],'indexes':[{'fields':[_0xe307('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index e2199db..7741de2 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 _0xbb7d=['result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x56101f,_0xbfb727){var _0x883fe5=function(_0x27de19){while(--_0x27de19){_0x56101f['push'](_0x56101f['shift']());}};_0x883fe5(++_0xbfb727);}(_0xbb7d,0x18c));var _0xdbb7=function(_0x3ac182,_0x1e1e03){_0x3ac182=_0x3ac182-0x0;var _0x3d08d2=_0xbb7d[_0x3ac182];return _0x3d08d2;};'use strict';var _=require('lodash');var util=require(_0xdbb7('0x0'));var moment=require(_0xdbb7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbb7('0x2'));var db=require(_0xdbb7('0x3'))['db'];var utils=require(_0xdbb7('0x4'));var logger=require('../../config/logger')(_0xdbb7('0x5'));var config=require(_0xdbb7('0x6'));var jayson=require(_0xdbb7('0x7'));var client=jayson[_0xdbb7('0x8')][_0xdbb7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4122ea,_0x247dae,_0x572135){return new BPromise(function(_0x3f31e2,_0x3b3f0c){return client[_0xdbb7('0xa')](_0x4122ea,_0x572135)[_0xdbb7('0xb')](function(_0x138020){logger[_0xdbb7('0xc')](_0xdbb7('0xd'),_0x247dae,_0xdbb7('0xe'));logger[_0xdbb7('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x247dae,_0xdbb7('0xe'),JSON[_0xdbb7('0x10')](_0x138020));if(_0x138020['error']){if(_0x138020[_0xdbb7('0x11')][_0xdbb7('0x12')]===0x1f4){logger[_0xdbb7('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x247dae,_0x138020[_0xdbb7('0x11')][_0xdbb7('0x13')]);return _0x3b3f0c(_0x138020['error'][_0xdbb7('0x13')]);}logger[_0xdbb7('0x11')](_0xdbb7('0xd'),_0x247dae,_0x138020[_0xdbb7('0x11')]['message']);return _0x3f31e2(_0x138020['error']['message']);}else{logger['info'](_0xdbb7('0xd'),_0x247dae,'request\x20sent');_0x3f31e2(_0x138020[_0xdbb7('0x14')][_0xdbb7('0x13')]);}})['catch'](function(_0x15990d){logger[_0xdbb7('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x247dae,_0x15990d);_0x3b3f0c(_0x15990d);});});}exports[_0xdbb7('0x15')]=function(_0x393776){var _0x55e211=this;return new Promise(function(_0x467c1b,_0x20a3c2){return db[_0xdbb7('0x16')][_0xdbb7('0x17')](_0x393776[_0xdbb7('0x18')],{'raw':_0x393776['options']?_0x393776[_0xdbb7('0x19')][_0xdbb7('0x1a')]===undefined?!![]:![]:!![]})[_0xdbb7('0xb')](function(_0x35c41c){logger[_0xdbb7('0xc')](_0xdbb7('0x15'),_0x393776);logger[_0xdbb7('0xf')](_0xdbb7('0x15'),_0x393776,JSON['stringify'](_0x35c41c));_0x467c1b(_0x35c41c);})[_0xdbb7('0x1b')](function(_0x3aca23){logger[_0xdbb7('0x11')](_0xdbb7('0x15'),_0x3aca23[_0xdbb7('0x13')],_0x393776);_0x20a3c2(_0x55e211[_0xdbb7('0x11')](0x1f4,_0x3aca23[_0xdbb7('0x13')]));});});};exports[_0xdbb7('0x1c')]=function(_0x282005){var _0xc68d4b=this;return new Promise(function(_0x57f776,_0x1fe890){return db['VoiceDialReport']['update'](_0x282005['body'],{'raw':_0x282005[_0xdbb7('0x19')]?_0x282005['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x282005['options']?_0x282005['options'][_0xdbb7('0x1d')]||null:null,'attributes':_0x282005[_0xdbb7('0x19')]?_0x282005[_0xdbb7('0x19')][_0xdbb7('0x1e')]||null:null,'limit':_0x282005[_0xdbb7('0x19')]?_0x282005[_0xdbb7('0x19')][_0xdbb7('0x1f')]||null:null})[_0xdbb7('0xb')](function(_0x5b0452){logger[_0xdbb7('0xc')](_0xdbb7('0x1c'),_0x282005);logger[_0xdbb7('0xf')](_0xdbb7('0x1c'),_0x282005,JSON[_0xdbb7('0x10')](_0x5b0452));_0x57f776(_0x5b0452);})[_0xdbb7('0x1b')](function(_0x3be5e6){logger[_0xdbb7('0x11')](_0xdbb7('0x1c'),_0x3be5e6[_0xdbb7('0x13')],_0x282005);_0x1fe890(_0xc68d4b[_0xdbb7('0x11')](0x1f4,_0x3be5e6[_0xdbb7('0x13')]));});});}; \ No newline at end of file +var _0xb286=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','VoiceDialReport','options','CreateVoiceDialReport','UpdateVoiceDialReport','update','body','raw','where','attributes','limit','lodash','util','moment','../../config/utils','../../config/logger','rpc'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0xb286,0x14f));var _0x6b28=function(_0x58f6a5,_0x31f15e){_0x58f6a5=_0x58f6a5-0x0;var _0x4c4f67=_0xb286[_0x58f6a5];return _0x4c4f67;};'use strict';var _=require(_0x6b28('0x0'));var util=require(_0x6b28('0x1'));var moment=require(_0x6b28('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b28('0x3'));var logger=require(_0x6b28('0x4'))(_0x6b28('0x5'));var config=require(_0x6b28('0x6'));var jayson=require(_0x6b28('0x7'));var client=jayson[_0x6b28('0x8')][_0x6b28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f87ba,_0x2461f0,_0x32d2d1){return new BPromise(function(_0x40e025,_0x3abbb8){return client[_0x6b28('0xa')](_0x1f87ba,_0x32d2d1)[_0x6b28('0xb')](function(_0x4d3dde){logger[_0x6b28('0xc')](_0x6b28('0xd'),_0x2461f0,'request\x20sent');logger[_0x6b28('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2461f0,'request\x20sent',JSON[_0x6b28('0xf')](_0x4d3dde));if(_0x4d3dde[_0x6b28('0x10')]){if(_0x4d3dde[_0x6b28('0x10')][_0x6b28('0x11')]===0x1f4){logger[_0x6b28('0x10')](_0x6b28('0xd'),_0x2461f0,_0x4d3dde[_0x6b28('0x10')][_0x6b28('0x12')]);return _0x3abbb8(_0x4d3dde['error'][_0x6b28('0x12')]);}logger[_0x6b28('0x10')](_0x6b28('0xd'),_0x2461f0,_0x4d3dde[_0x6b28('0x10')][_0x6b28('0x12')]);return _0x40e025(_0x4d3dde[_0x6b28('0x10')][_0x6b28('0x12')]);}else{logger['info'](_0x6b28('0xd'),_0x2461f0,_0x6b28('0x13'));_0x40e025(_0x4d3dde['result'][_0x6b28('0x12')]);}})[_0x6b28('0x14')](function(_0x127528){logger['error'](_0x6b28('0xd'),_0x2461f0,_0x127528);_0x3abbb8(_0x127528);});});}exports['CreateVoiceDialReport']=function(_0x870891){var _0x446777=this;return new Promise(function(_0x57120f,_0x5726b0){return db[_0x6b28('0x15')]['create'](_0x870891['body'],{'raw':_0x870891['options']?_0x870891[_0x6b28('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x11ba85){logger[_0x6b28('0xc')](_0x6b28('0x17'),_0x870891);logger[_0x6b28('0xe')](_0x6b28('0x17'),_0x870891,JSON[_0x6b28('0xf')](_0x11ba85));_0x57120f(_0x11ba85);})['catch'](function(_0x351f15){logger['error'](_0x6b28('0x17'),_0x351f15['message'],_0x870891);_0x5726b0(_0x446777['error'](0x1f4,_0x351f15[_0x6b28('0x12')]));});});};exports[_0x6b28('0x18')]=function(_0x280282){var _0x5e29c7=this;return new Promise(function(_0x583ce4,_0x262cae){return db[_0x6b28('0x15')][_0x6b28('0x19')](_0x280282[_0x6b28('0x1a')],{'raw':_0x280282[_0x6b28('0x16')]?_0x280282[_0x6b28('0x16')][_0x6b28('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x280282[_0x6b28('0x16')]?_0x280282[_0x6b28('0x16')][_0x6b28('0x1c')]||null:null,'attributes':_0x280282[_0x6b28('0x16')]?_0x280282[_0x6b28('0x16')][_0x6b28('0x1d')]||null:null,'limit':_0x280282[_0x6b28('0x16')]?_0x280282['options'][_0x6b28('0x1e')]||null:null})['then'](function(_0x4ab714){logger['info'](_0x6b28('0x18'),_0x280282);logger[_0x6b28('0xe')](_0x6b28('0x18'),_0x280282,JSON[_0x6b28('0xf')](_0x4ab714));_0x583ce4(_0x4ab714);})[_0x6b28('0x14')](function(_0x1ac9b5){logger[_0x6b28('0x10')](_0x6b28('0x18'),_0x1ac9b5[_0x6b28('0x12')],_0x280282);_0x262cae(_0x5e29c7['error'](0x1f4,_0x1ac9b5[_0x6b28('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f98b74d..f1646bc 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 _0xdaa8=['post','/:id/applications','addApplications','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0x4ac3a4,_0x7ad218){var _0x5e4558=function(_0x3ab333){while(--_0x3ab333){_0x4ac3a4['push'](_0x4ac3a4['shift']());}};_0x5e4558(++_0x7ad218);}(_0xdaa8,0xa6));var _0x8daa=function(_0x23696a,_0x3cd395){_0x23696a=_0x23696a-0x0;var _0x3e9b2b=_0xdaa8[_0x23696a];return _0x3e9b2b;};'use strict';var multer=require(_0x8daa('0x0'));var util=require('util');var path=require(_0x8daa('0x1'));var timeout=require(_0x8daa('0x2'));var express=require(_0x8daa('0x3'));var router=express[_0x8daa('0x4')]();var fs_extra=require(_0x8daa('0x5'));var auth=require(_0x8daa('0x6'));var interaction=require(_0x8daa('0x7'));var config=require(_0x8daa('0x8'));var controller=require(_0x8daa('0x9'));router[_0x8daa('0xa')]('/',auth[_0x8daa('0xb')](),controller[_0x8daa('0xc')]);router['get'](_0x8daa('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8daa('0xe')]('/',auth[_0x8daa('0xb')](),controller['create']);router[_0x8daa('0xe')](_0x8daa('0xf'),auth[_0x8daa('0xb')](),controller[_0x8daa('0x10')]);router['put']('/:id',auth[_0x8daa('0xb')](),controller[_0x8daa('0x11')]);router[_0x8daa('0x12')]('/:id',auth[_0x8daa('0xb')](),controller[_0x8daa('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6619=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceExtension.controller','get','index','/:id','post','isAuthenticated','create','addApplications','update','delete','destroy','exports','multer','util'];(function(_0x58bc0c,_0x39db28){var _0xea6fff=function(_0x275a31){while(--_0x275a31){_0x58bc0c['push'](_0x58bc0c['shift']());}};_0xea6fff(++_0x39db28);}(_0x6619,0x9e));var _0x9661=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x6619[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require(_0x9661('0x0'));var util=require(_0x9661('0x1'));var path=require(_0x9661('0x2'));var timeout=require(_0x9661('0x3'));var express=require(_0x9661('0x4'));var router=express[_0x9661('0x5')]();var fs_extra=require(_0x9661('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9661('0x7'));var controller=require(_0x9661('0x8'));router[_0x9661('0x9')]('/',auth['isAuthenticated'](),controller[_0x9661('0xa')]);router['get'](_0x9661('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9661('0xc')]('/',auth[_0x9661('0xd')](),controller[_0x9661('0xe')]);router[_0x9661('0xc')]('/:id/applications',auth[_0x9661('0xd')](),controller[_0x9661('0xf')]);router['put'](_0x9661('0xb'),auth['isAuthenticated'](),controller[_0x9661('0x10')]);router[_0x9661('0x11')](_0x9661('0xb'),auth[_0x9661('0xd')](),controller[_0x9661('0x12')]);module[_0x9661('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d3c4c65..5f8b2ef 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 _0x76af=['compositeIndex','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','STRING'];(function(_0x1ebc88,_0x638cd6){var _0xcef294=function(_0x5104bb){while(--_0x5104bb){_0x1ebc88['push'](_0x1ebc88['shift']());}};_0xcef294(++_0x638cd6);}(_0x76af,0x176));var _0xf76a=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x76af[_0x25fc41];return _0x1371d1;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xf76a('0x0')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf76a('0x0')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xf76a('0x0')],'allowNull':![],'defaultValue':'1','unique':_0xf76a('0x1')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf76a('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xf76a('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf76a('0x2')](_0xf76a('0x3'),'outbound',_0xf76a('0x4'),_0xf76a('0x5'),_0xf76a('0x6'),_0xf76a('0x7'),_0xf76a('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xf76a('0x0')]},'interval':{'type':Sequelize[_0xf76a('0x0')],'allowNull':![],'defaultValue':_0xf76a('0x9')},'IntervalId':{'type':Sequelize[_0xf76a('0xa')]},'isApp':{'type':Sequelize[_0xf76a('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf76a('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf76a('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xf76a('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf76a('0xa')]},'recordingFormat':{'type':Sequelize[_0xf76a('0x0')],'defaultValue':_0xf76a('0xc')},'answer':{'type':Sequelize[_0xf76a('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf76a('0xd')],'get':function(_0x2bc5ee){return this[_0xf76a('0xe')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x663a=['wav','VIRTUAL','getDataValue','exten','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN'];(function(_0xa8573c,_0x431025){var _0x1f8fe2=function(_0x5d1d45){while(--_0x5d1d45){_0xa8573c['push'](_0xa8573c['shift']());}};_0x1f8fe2(++_0x431025);}(_0x663a,0xbf));var _0xa663=function(_0xc4335,_0x5cb306){_0xc4335=_0xc4335-0x0;var _0x10881f=_0x663a[_0xc4335];return _0x10881f;};'use strict';var Sequelize=require('sequelize');module[_0xa663('0x0')]={'context':{'type':Sequelize[_0xa663('0x1')],'allowNull':![],'unique':_0xa663('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xa663('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xa663('0x2')},'tag':{'type':Sequelize[_0xa663('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa663('0x1')],'allowNull':![],'defaultValue':_0xa663('0x3')},'appdata':{'type':Sequelize[_0xa663('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xa663('0x4'),_0xa663('0x5'),_0xa663('0x6'),_0xa663('0x7'),'outbound-fax',_0xa663('0x8'),_0xa663('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xa663('0x1')]},'interval':{'type':Sequelize[_0xa663('0x1')],'allowNull':![],'defaultValue':_0xa663('0xa')},'IntervalId':{'type':Sequelize[_0xa663('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xa663('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xa663('0x1')],'defaultValue':_0xa663('0xd')},'answer':{'type':Sequelize[_0xa663('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa663('0xe')],'get':function(_0xe9a9ae){return this[_0xa663('0xf')](_0xa663('0x10'));}},'alias':{'type':Sequelize[_0xa663('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 6c39cf1..f044975 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 _0x3b31=['recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','VoiceExtensionId','isApp','createRouting','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','lodash','ioredis','api','redis','defaults','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','map','value','includes','find','type','UserProfileResource','error','stack','name','send','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','keys','length','include','params','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OutboundRoutes','UserProfileSection','userProfileId','update','pick','context'];(function(_0x3523ab,_0x108984){var _0x1408db=function(_0x1d3282){while(--_0x1d3282){_0x3523ab['push'](_0x3523ab['shift']());}};_0x1408db(++_0x108984);}(_0x3b31,0x64));var _0x13b3=function(_0x5f0d2e,_0x10768d){_0x5f0d2e=_0x5f0d2e-0x0;var _0x31172b=_0x3b31[_0x5f0d2e];return _0x31172b;};'use strict';var _=require(_0x13b3('0x0'));var Redis=require(_0x13b3('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x13b3('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x13b3('0x3')]=_[_0x13b3('0x4')](config[_0x13b3('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0x13b3('0x5'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x13b3('0x6')](socket);function respondWithStatusCode(_0x17432e,_0xa6f9e9){_0xa6f9e9=_0xa6f9e9||0xcc;return function(_0xc4d449){if(_0xc4d449){return _0x17432e['sendStatus'](_0xa6f9e9);}return _0x17432e[_0x13b3('0x7')](_0xa6f9e9)[_0x13b3('0x8')]();};}function respondWithResult(_0x3dbfd6,_0x14b9a1){_0x14b9a1=_0x14b9a1||0xc8;return function(_0x9ebff8){if(_0x9ebff8){return _0x3dbfd6['status'](_0x14b9a1)['json'](_0x9ebff8);}};}function respondWithFilteredResult(_0x1c25bc,_0x1aef50){return function(_0x462364){if(_0x462364){var _0x36652f=typeof _0x1aef50[_0x13b3('0x9')]===_0x13b3('0xa')&&typeof _0x1aef50[_0x13b3('0xb')]==='undefined';var _0x2a4522=_0x462364[_0x13b3('0xc')];var _0x1df49f=_0x36652f?0x0:_0x1aef50[_0x13b3('0x9')];var _0x465c54=_0x36652f?_0x462364['count']:_0x1aef50[_0x13b3('0x9')]+_0x1aef50[_0x13b3('0xb')];var _0x4b4bbb;if(_0x465c54>=_0x2a4522){_0x465c54=_0x2a4522;_0x4b4bbb=0xc8;}else{_0x4b4bbb=0xce;}_0x1c25bc[_0x13b3('0x7')](_0x4b4bbb);return _0x1c25bc[_0x13b3('0xd')](_0x13b3('0xe'),_0x1df49f+'-'+_0x465c54+'/'+_0x2a4522)[_0x13b3('0xf')](_0x462364);}return null;};}function removeEntity(_0x3dbe7a){return function(_0x3c4834){if(_0x3c4834){return _0x3c4834[_0x13b3('0x10')]()[_0x13b3('0x11')](function(){var _0xf3e4df=_0x3c4834[_0x13b3('0x12')]({'plain':!![]});var _0x1703c5=[{'name':_0x13b3('0x13'),'value':_0x13b3('0x14'),'ignore':![]},{'name':'OutboundRoutes','value':_0x13b3('0x15'),'ignore':![]},{'name':_0x13b3('0x16'),'value':_0x13b3('0x17'),'ignore':![]}];var _0x26fb07=_(_0x1703c5)[_0x13b3('0x18')]('ignore')[_0x13b3('0x19')](_0x13b3('0x1a'))[_0x13b3('0x1a')]();if(_[_0x13b3('0x1b')](_0x26fb07,_0xf3e4df['type'])){return;}var _0x442a32=_[_0x13b3('0x1c')](_0x1703c5,[_0x13b3('0x1a'),_0xf3e4df[_0x13b3('0x1d')]])['name'];return db[_0x13b3('0x1e')][_0x13b3('0x10')]({'where':{'type':_0x442a32,'resourceId':_0xf3e4df['id']}})['then'](function(){return _0x3c4834;});})[_0x13b3('0x11')](function(){_0x3dbe7a[_0x13b3('0x7')](0xcc)[_0x13b3('0x8')]();});}};}function handleEntityNotFound(_0x3ba2fe){return function(_0x5bd08b){if(!_0x5bd08b){_0x3ba2fe['sendStatus'](0x194);}return _0x5bd08b;};}function handleError(_0x582505,_0x52d4cf){_0x52d4cf=_0x52d4cf||0x1f4;return function(_0x3246b4){logger[_0x13b3('0x1f')](_0x3246b4[_0x13b3('0x20')]);if(_0x3246b4[_0x13b3('0x21')]){delete _0x3246b4[_0x13b3('0x21')];}_0x582505[_0x13b3('0x7')](_0x52d4cf)[_0x13b3('0x22')](_0x3246b4);};}exports['index']=function(_0x5e8d82,_0x301079){var _0x3ec464={},_0x197b00={},_0x3f38c5={'count':0x0,'rows':[]};var _0x25a269=_['map'](db[_0x13b3('0x23')][_0x13b3('0x24')],function(_0x47fa68){return{'name':_0x47fa68[_0x13b3('0x25')],'type':_0x47fa68[_0x13b3('0x1d')][_0x13b3('0x26')]};});_0x197b00[_0x13b3('0x27')]=_['map'](_0x25a269,_0x13b3('0x21'));_0x197b00[_0x13b3('0x28')]=_['keys'](_0x5e8d82[_0x13b3('0x28')]);_0x197b00[_0x13b3('0x29')]=_[_0x13b3('0x2a')](_0x197b00[_0x13b3('0x27')],_0x197b00[_0x13b3('0x28')]);_0x3ec464['attributes']=_[_0x13b3('0x2a')](_0x197b00[_0x13b3('0x27')],qs[_0x13b3('0x2b')](_0x5e8d82[_0x13b3('0x28')][_0x13b3('0x2b')]));_0x3ec464['attributes']=_0x3ec464['attributes']['length']?_0x3ec464[_0x13b3('0x2c')]:_0x197b00[_0x13b3('0x27')];if(!_0x5e8d82[_0x13b3('0x28')][_0x13b3('0x2d')]('nolimit')){_0x3ec464['limit']=qs[_0x13b3('0xb')](_0x5e8d82[_0x13b3('0x28')]['limit']);_0x3ec464[_0x13b3('0x9')]=qs[_0x13b3('0x9')](_0x5e8d82[_0x13b3('0x28')][_0x13b3('0x9')]);}_0x3ec464[_0x13b3('0x2e')]=qs[_0x13b3('0x2f')](_0x5e8d82[_0x13b3('0x28')][_0x13b3('0x2f')]);_0x3ec464[_0x13b3('0x30')]=qs['filters'](_['pick'](_0x5e8d82[_0x13b3('0x28')],_0x197b00[_0x13b3('0x29')]),_0x25a269);if(_0x5e8d82[_0x13b3('0x28')]['filter']){_0x3ec464[_0x13b3('0x30')]=_['merge'](_0x3ec464['where'],{'$or':_[_0x13b3('0x19')](_0x25a269,function(_0x39c842){if(_0x39c842[_0x13b3('0x1d')]!==_0x13b3('0x31')){var _0x6eb1af={};_0x6eb1af[_0x39c842[_0x13b3('0x21')]]={'$like':'%'+_0x5e8d82['query']['filter']+'%'};return _0x6eb1af;}})});}_0x3ec464=_[_0x13b3('0x32')]({},_0x3ec464,_0x5e8d82[_0x13b3('0x33')]);var _0x4b6058={'where':_0x3ec464[_0x13b3('0x30')]};return db[_0x13b3('0x23')]['count'](_0x4b6058)[_0x13b3('0x11')](function(_0x38b063){_0x3f38c5[_0x13b3('0xc')]=_0x38b063;if(_0x5e8d82[_0x13b3('0x28')][_0x13b3('0x34')]){_0x3ec464['include']=[{'all':!![]}];}return db[_0x13b3('0x23')][_0x13b3('0x35')](_0x3ec464);})[_0x13b3('0x11')](function(_0x277b83){_0x3f38c5[_0x13b3('0x36')]=_0x277b83;return _0x3f38c5;})['then'](respondWithFilteredResult(_0x301079,_0x3ec464))[_0x13b3('0x37')](handleError(_0x301079,null));};exports[_0x13b3('0x38')]=function(_0x261924,_0x39b97d){var _0x39e413={'raw':![],'where':{'id':_0x261924['params']['id']}},_0x54e89e={};_0x54e89e[_0x13b3('0x27')]=_[_0x13b3('0x39')](db['VoiceExtension'][_0x13b3('0x24')]);_0x54e89e['query']=_[_0x13b3('0x39')](_0x261924[_0x13b3('0x28')]);_0x54e89e[_0x13b3('0x29')]=_[_0x13b3('0x2a')](_0x54e89e[_0x13b3('0x27')],_0x54e89e[_0x13b3('0x28')]);_0x39e413[_0x13b3('0x2c')]=_[_0x13b3('0x2a')](_0x54e89e[_0x13b3('0x27')],qs[_0x13b3('0x2b')](_0x261924['query'][_0x13b3('0x2b')]));_0x39e413[_0x13b3('0x2c')]=_0x39e413[_0x13b3('0x2c')][_0x13b3('0x3a')]?_0x39e413['attributes']:_0x54e89e[_0x13b3('0x27')];if(_0x261924['query'][_0x13b3('0x34')]){_0x39e413[_0x13b3('0x3b')]=[{'all':!![]}];}_0x39e413=_[_0x13b3('0x32')]({},_0x39e413,_0x261924[_0x13b3('0x33')]);return db['VoiceExtension'][_0x13b3('0x1c')](_0x39e413)[_0x13b3('0x11')](handleEntityNotFound(_0x39b97d,null))['then'](respondWithResult(_0x39b97d,null))[_0x13b3('0x37')](handleError(_0x39b97d,null));};exports[_0x13b3('0x10')]=function(_0x95ed2e,_0x321260){return db[_0x13b3('0x23')]['find']({'where':{'id':_0x95ed2e[_0x13b3('0x3c')]['id']}})[_0x13b3('0x11')](handleEntityNotFound(_0x321260,null))[_0x13b3('0x11')](removeEntity(_0x321260,null))[_0x13b3('0x37')](handleError(_0x321260,null));};exports[_0x13b3('0x3d')]=function(_0xb26ca4,_0x4caeaf){if(_0xb26ca4[_0x13b3('0x3e')][_0x13b3('0x1d')]==='outbound'&&!_[_0x13b3('0x3f')](_0xb26ca4[_0x13b3('0x3e')][_0x13b3('0x40')],'_')){_0xb26ca4[_0x13b3('0x3e')][_0x13b3('0x40')]='_'['concat'](_0xb26ca4[_0x13b3('0x3e')][_0x13b3('0x40')]);}return db['VoiceExtension'][_0x13b3('0x3d')](_0xb26ca4[_0x13b3('0x3e')],{'raw':![]})[_0x13b3('0x11')](function(_0xeb56d4){var _0x398790=_0xb26ca4['user'][_0x13b3('0x12')]({'plain':!![]});if(!_0x398790)throw new Error(_0x13b3('0x41'));if(_0x398790[_0x13b3('0x42')]===_0x13b3('0x43')){var _0x45a406=_0xeb56d4[_0x13b3('0x12')]({'plain':!![]});var _0x4cc1cc=[{'name':_0x13b3('0x13'),'value':_0x13b3('0x14')},{'name':_0x13b3('0x44'),'value':_0x13b3('0x15')},{'name':_0x13b3('0x16'),'value':_0x13b3('0x17')}];var _0x51597f=_[_0x13b3('0x1c')](_0x4cc1cc,['value',_0x45a406[_0x13b3('0x1d')]])[_0x13b3('0x21')];return db[_0x13b3('0x45')][_0x13b3('0x1c')]({'where':{'name':_0x51597f,'userProfileId':_0x398790[_0x13b3('0x46')]},'raw':!![]})[_0x13b3('0x11')](function(_0x1865a6){if(_0x1865a6&&_0x1865a6['autoAssociation']===0x0){return db[_0x13b3('0x1e')][_0x13b3('0x3d')]({'name':_0x45a406[_0x13b3('0x21')],'resourceId':_0x45a406['id'],'type':_0x1865a6[_0x13b3('0x21')],'sectionId':_0x1865a6['id']},{})[_0x13b3('0x11')](function(){return _0xeb56d4;});}else{return _0xeb56d4;}})[_0x13b3('0x37')](function(_0x1b16c4){logger[_0x13b3('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b16c4);throw _0x1b16c4;});}return _0xeb56d4;})[_0x13b3('0x11')](respondWithResult(_0x4caeaf,0xc9))[_0x13b3('0x37')](handleError(_0x4caeaf,null));};exports[_0x13b3('0x47')]=function(_0x4e723c,_0x28f651){if(_0x4e723c[_0x13b3('0x3e')]['id']){delete _0x4e723c[_0x13b3('0x3e')]['id'];}return db[_0x13b3('0x23')][_0x13b3('0x1c')]({'where':{'id':_0x4e723c[_0x13b3('0x3c')]['id']}})[_0x13b3('0x11')](handleEntityNotFound(_0x28f651,null))[_0x13b3('0x11')](function(_0xda451e){if(_0xda451e){return db[_0x13b3('0x23')][_0x13b3('0x47')](_[_0x13b3('0x48')](_0x4e723c[_0x13b3('0x3e')],[_0x13b3('0x40'),_0x13b3('0x49'),'description',_0x13b3('0x4a'),_0x13b3('0x4b'),_0x13b3('0x4c'),_0x13b3('0x4d')]),{'where':{'context':_0xda451e['context'],'exten':_0xda451e['exten']},'individualHooks':!![]})['then'](function(_0x52479a){return _0x52479a;});}return null;})['then'](respondWithStatusCode(_0x28f651,null))['catch'](handleError(_0x28f651,null));};exports[_0x13b3('0x4e')]=function(_0x4f41f4,_0x4e5cb5){return db[_0x13b3('0x23')]['findOne']({'where':{'id':_0x4f41f4[_0x13b3('0x3c')]['id']}})[_0x13b3('0x11')](function(_0x442205){if(_0x442205){return db[_0x13b3('0x4f')][_0x13b3('0x50')](function(_0x10be2c){return db['VoiceExtension'][_0x13b3('0x10')]({'where':{'VoiceExtensionId':_0x4f41f4[_0x13b3('0x3c')]['id']},'transaction':_0x10be2c})['then'](function(){var _0x4e4943=_['map'](_0x4f41f4[_0x13b3('0x3e')],function(_0x15a524){_0x15a524[_0x13b3('0x51')]=_0x4f41f4['params']['id'];_0x15a524[_0x13b3('0x52')]=!![];return _0x15a524;});return _0x442205[_0x13b3('0x53')](_0x4e4943);})[_0x13b3('0x11')](function(_0x4a066e){console['log'](_0x13b3('0x54'),_0x4a066e);return db['VoiceExtension'][_0x13b3('0x55')](_0x4a066e,{'transaction':_0x10be2c});});})[_0x13b3('0x11')](function(){return db[_0x13b3('0x23')][_0x13b3('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4f41f4[_0x13b3('0x3c')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x13b3('0x11')](respondWithResult(_0x4e5cb5,null))['catch'](handleError(_0x4e5cb5,null));}; \ No newline at end of file +var _0xece7=['ignore','map','value','type','find','name','UserProfileResource','destroy','sendStatus','stack','send','index','VoiceExtension','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','options','includeAll','findAll','rows','catch','show','params','include','create','startsWith','body','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','context','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','createRouting','log','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','api','../../config/environment','redis','defaults','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter'];(function(_0x114749,_0x9b572a){var _0x499080=function(_0x564790){while(--_0x564790){_0x114749['push'](_0x114749['shift']());}};_0x499080(++_0x9b572a);}(_0xece7,0x95));var _0x7ece=function(_0x303862,_0x20b5ab){_0x303862=_0x303862-0x0;var _0xe6f228=_0xece7[_0x303862];return _0xe6f228;};'use strict';var _=require(_0x7ece('0x0'));var Redis=require(_0x7ece('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7ece('0x2'));var config=require(_0x7ece('0x3'));var db=require('../../mysqldb')['db'];config[_0x7ece('0x4')]=_[_0x7ece('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7ece('0x6'))(new Redis(config[_0x7ece('0x4')]));require('./voiceExtension.socket')[_0x7ece('0x7')](socket);function respondWithStatusCode(_0x18dea4,_0x1e5a7b){_0x1e5a7b=_0x1e5a7b||0xcc;return function(_0x55bd78){if(_0x55bd78){return _0x18dea4['sendStatus'](_0x1e5a7b);}return _0x18dea4[_0x7ece('0x8')](_0x1e5a7b)[_0x7ece('0x9')]();};}function respondWithResult(_0x192778,_0x203c86){_0x203c86=_0x203c86||0xc8;return function(_0x1fff28){if(_0x1fff28){return _0x192778[_0x7ece('0x8')](_0x203c86)[_0x7ece('0xa')](_0x1fff28);}};}function respondWithFilteredResult(_0x2afce3,_0x27dd9b){return function(_0x48b862){if(_0x48b862){var _0x44c73e=typeof _0x27dd9b[_0x7ece('0xb')]==='undefined'&&typeof _0x27dd9b[_0x7ece('0xc')]===_0x7ece('0xd');var _0x4e9093=_0x48b862[_0x7ece('0xe')];var _0x3aca38=_0x44c73e?0x0:_0x27dd9b[_0x7ece('0xb')];var _0x126cf6=_0x44c73e?_0x48b862[_0x7ece('0xe')]:_0x27dd9b[_0x7ece('0xb')]+_0x27dd9b[_0x7ece('0xc')];var _0x2a574a;if(_0x126cf6>=_0x4e9093){_0x126cf6=_0x4e9093;_0x2a574a=0xc8;}else{_0x2a574a=0xce;}_0x2afce3[_0x7ece('0x8')](_0x2a574a);return _0x2afce3[_0x7ece('0xf')](_0x7ece('0x10'),_0x3aca38+'-'+_0x126cf6+'/'+_0x4e9093)['json'](_0x48b862);}return null;};}function removeEntity(_0x780ff8){return function(_0x30deb8){if(_0x30deb8){return _0x30deb8['destroy']()[_0x7ece('0x11')](function(){var _0x63d061=_0x30deb8[_0x7ece('0x12')]({'plain':!![]});var _0x22c9c8=[{'name':_0x7ece('0x13'),'value':_0x7ece('0x14'),'ignore':![]},{'name':'OutboundRoutes','value':_0x7ece('0x15'),'ignore':![]},{'name':_0x7ece('0x16'),'value':_0x7ece('0x17'),'ignore':![]}];var _0xf14876=_(_0x22c9c8)[_0x7ece('0x18')](_0x7ece('0x19'))[_0x7ece('0x1a')](_0x7ece('0x1b'))['value']();if(_['includes'](_0xf14876,_0x63d061[_0x7ece('0x1c')])){return;}var _0x3a7ce7=_[_0x7ece('0x1d')](_0x22c9c8,[_0x7ece('0x1b'),_0x63d061[_0x7ece('0x1c')]])[_0x7ece('0x1e')];return db[_0x7ece('0x1f')][_0x7ece('0x20')]({'where':{'type':_0x3a7ce7,'resourceId':_0x63d061['id']}})[_0x7ece('0x11')](function(){return _0x30deb8;});})[_0x7ece('0x11')](function(){_0x780ff8[_0x7ece('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26faa1){return function(_0x9325e3){if(!_0x9325e3){_0x26faa1[_0x7ece('0x21')](0x194);}return _0x9325e3;};}function handleError(_0xdcefb0,_0x2b3c81){_0x2b3c81=_0x2b3c81||0x1f4;return function(_0x400086){logger['error'](_0x400086[_0x7ece('0x22')]);if(_0x400086[_0x7ece('0x1e')]){delete _0x400086[_0x7ece('0x1e')];}_0xdcefb0[_0x7ece('0x8')](_0x2b3c81)[_0x7ece('0x23')](_0x400086);};}exports[_0x7ece('0x24')]=function(_0x4af234,_0x5434a1){var _0x198e81={},_0x271e6d={},_0x1893e2={'count':0x0,'rows':[]};var _0x578b68=_[_0x7ece('0x1a')](db[_0x7ece('0x25')][_0x7ece('0x26')],function(_0x2d2d44){return{'name':_0x2d2d44['fieldName'],'type':_0x2d2d44[_0x7ece('0x1c')]['key']};});_0x271e6d[_0x7ece('0x27')]=_[_0x7ece('0x1a')](_0x578b68,'name');_0x271e6d[_0x7ece('0x28')]=_[_0x7ece('0x29')](_0x4af234['query']);_0x271e6d[_0x7ece('0x2a')]=_[_0x7ece('0x2b')](_0x271e6d[_0x7ece('0x27')],_0x271e6d['query']);_0x198e81['attributes']=_[_0x7ece('0x2b')](_0x271e6d['model'],qs[_0x7ece('0x2c')](_0x4af234['query'][_0x7ece('0x2c')]));_0x198e81[_0x7ece('0x2d')]=_0x198e81[_0x7ece('0x2d')][_0x7ece('0x2e')]?_0x198e81[_0x7ece('0x2d')]:_0x271e6d['model'];if(!_0x4af234['query'][_0x7ece('0x2f')](_0x7ece('0x30'))){_0x198e81[_0x7ece('0xc')]=qs[_0x7ece('0xc')](_0x4af234[_0x7ece('0x28')]['limit']);_0x198e81['offset']=qs[_0x7ece('0xb')](_0x4af234[_0x7ece('0x28')][_0x7ece('0xb')]);}_0x198e81[_0x7ece('0x31')]=qs['sort'](_0x4af234[_0x7ece('0x28')]['sort']);_0x198e81['where']=qs[_0x7ece('0x2a')](_[_0x7ece('0x32')](_0x4af234[_0x7ece('0x28')],_0x271e6d[_0x7ece('0x2a')]),_0x578b68);if(_0x4af234[_0x7ece('0x28')]['filter']){_0x198e81[_0x7ece('0x33')]=_['merge'](_0x198e81[_0x7ece('0x33')],{'$or':_[_0x7ece('0x1a')](_0x578b68,function(_0x563ca8){if(_0x563ca8['type']!=='VIRTUAL'){var _0x573f50={};_0x573f50[_0x563ca8['name']]={'$like':'%'+_0x4af234[_0x7ece('0x28')][_0x7ece('0x18')]+'%'};return _0x573f50;}})});}_0x198e81=_['merge']({},_0x198e81,_0x4af234[_0x7ece('0x34')]);var _0x429166={'where':_0x198e81[_0x7ece('0x33')]};return db[_0x7ece('0x25')][_0x7ece('0xe')](_0x429166)[_0x7ece('0x11')](function(_0x4c965f){_0x1893e2['count']=_0x4c965f;if(_0x4af234[_0x7ece('0x28')][_0x7ece('0x35')]){_0x198e81['include']=[{'all':!![]}];}return db[_0x7ece('0x25')][_0x7ece('0x36')](_0x198e81);})[_0x7ece('0x11')](function(_0x234f76){_0x1893e2[_0x7ece('0x37')]=_0x234f76;return _0x1893e2;})['then'](respondWithFilteredResult(_0x5434a1,_0x198e81))[_0x7ece('0x38')](handleError(_0x5434a1,null));};exports[_0x7ece('0x39')]=function(_0x30c7bb,_0xafc8e){var _0x5f47e4={'raw':![],'where':{'id':_0x30c7bb[_0x7ece('0x3a')]['id']}},_0x4d0a7f={};_0x4d0a7f['model']=_[_0x7ece('0x29')](db[_0x7ece('0x25')][_0x7ece('0x26')]);_0x4d0a7f[_0x7ece('0x28')]=_['keys'](_0x30c7bb[_0x7ece('0x28')]);_0x4d0a7f[_0x7ece('0x2a')]=_['intersection'](_0x4d0a7f[_0x7ece('0x27')],_0x4d0a7f[_0x7ece('0x28')]);_0x5f47e4[_0x7ece('0x2d')]=_[_0x7ece('0x2b')](_0x4d0a7f[_0x7ece('0x27')],qs[_0x7ece('0x2c')](_0x30c7bb[_0x7ece('0x28')][_0x7ece('0x2c')]));_0x5f47e4[_0x7ece('0x2d')]=_0x5f47e4[_0x7ece('0x2d')][_0x7ece('0x2e')]?_0x5f47e4[_0x7ece('0x2d')]:_0x4d0a7f['model'];if(_0x30c7bb['query'][_0x7ece('0x35')]){_0x5f47e4[_0x7ece('0x3b')]=[{'all':!![]}];}_0x5f47e4=_['merge']({},_0x5f47e4,_0x30c7bb[_0x7ece('0x34')]);return db['VoiceExtension'][_0x7ece('0x1d')](_0x5f47e4)[_0x7ece('0x11')](handleEntityNotFound(_0xafc8e,null))[_0x7ece('0x11')](respondWithResult(_0xafc8e,null))[_0x7ece('0x38')](handleError(_0xafc8e,null));};exports[_0x7ece('0x20')]=function(_0x59c529,_0x3276d2){return db[_0x7ece('0x25')][_0x7ece('0x1d')]({'where':{'id':_0x59c529[_0x7ece('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3276d2,null))[_0x7ece('0x11')](removeEntity(_0x3276d2,null))[_0x7ece('0x38')](handleError(_0x3276d2,null));};exports[_0x7ece('0x3c')]=function(_0x1c6ae4,_0x2d4b09){if(_0x1c6ae4['body'][_0x7ece('0x1c')]===_0x7ece('0x15')&&!_[_0x7ece('0x3d')](_0x1c6ae4[_0x7ece('0x3e')][_0x7ece('0x3f')],'_')){_0x1c6ae4[_0x7ece('0x3e')][_0x7ece('0x3f')]='_'['concat'](_0x1c6ae4[_0x7ece('0x3e')][_0x7ece('0x3f')]);}return db[_0x7ece('0x25')][_0x7ece('0x3c')](_0x1c6ae4[_0x7ece('0x3e')],{'raw':![]})[_0x7ece('0x11')](function(_0x859998){var _0x59a60a=_0x1c6ae4['user']['get']({'plain':!![]});if(!_0x59a60a)throw new Error(_0x7ece('0x40'));if(_0x59a60a[_0x7ece('0x41')]==='user'){var _0x10fced=_0x859998[_0x7ece('0x12')]({'plain':!![]});var _0xe3b3e8=[{'name':'InboundRoutes','value':_0x7ece('0x14')},{'name':_0x7ece('0x42'),'value':_0x7ece('0x15')},{'name':'InternalRoutes','value':'internal'}];var _0x8ed906=_[_0x7ece('0x1d')](_0xe3b3e8,['value',_0x10fced[_0x7ece('0x1c')]])[_0x7ece('0x1e')];return db[_0x7ece('0x43')][_0x7ece('0x1d')]({'where':{'name':_0x8ed906,'userProfileId':_0x59a60a[_0x7ece('0x44')]},'raw':!![]})[_0x7ece('0x11')](function(_0x234494){if(_0x234494&&_0x234494[_0x7ece('0x45')]===0x0){return db['UserProfileResource']['create']({'name':_0x10fced[_0x7ece('0x1e')],'resourceId':_0x10fced['id'],'type':_0x234494[_0x7ece('0x1e')],'sectionId':_0x234494['id']},{})[_0x7ece('0x11')](function(){return _0x859998;});}else{return _0x859998;}})[_0x7ece('0x38')](function(_0x499148){logger[_0x7ece('0x46')](_0x7ece('0x47'),_0x499148);throw _0x499148;});}return _0x859998;})[_0x7ece('0x11')](respondWithResult(_0x2d4b09,0xc9))[_0x7ece('0x38')](handleError(_0x2d4b09,null));};exports[_0x7ece('0x48')]=function(_0x38595c,_0x3b1001){if(_0x38595c['body']['id']){delete _0x38595c['body']['id'];}return db['VoiceExtension'][_0x7ece('0x1d')]({'where':{'id':_0x38595c[_0x7ece('0x3a')]['id']}})[_0x7ece('0x11')](handleEntityNotFound(_0x3b1001,null))[_0x7ece('0x11')](function(_0x45fe6b){if(_0x45fe6b){return db[_0x7ece('0x25')][_0x7ece('0x48')](_[_0x7ece('0x32')](_0x38595c[_0x7ece('0x3e')],['exten','context',_0x7ece('0x49'),_0x7ece('0x4a'),'cutdigits','mandatoryDisposition','alias']),{'where':{'context':_0x45fe6b[_0x7ece('0x4b')],'exten':_0x45fe6b[_0x7ece('0x3f')]},'individualHooks':!![]})[_0x7ece('0x11')](function(_0x4d9df1){return _0x4d9df1;});}return null;})[_0x7ece('0x11')](respondWithStatusCode(_0x3b1001,null))['catch'](handleError(_0x3b1001,null));};exports[_0x7ece('0x4c')]=function(_0x2c7ccd,_0x50142d){return db['VoiceExtension'][_0x7ece('0x4d')]({'where':{'id':_0x2c7ccd[_0x7ece('0x3a')]['id']}})[_0x7ece('0x11')](function(_0xda94ee){if(_0xda94ee){return db[_0x7ece('0x4e')][_0x7ece('0x4f')](function(_0x513d37){return db[_0x7ece('0x25')][_0x7ece('0x20')]({'where':{'VoiceExtensionId':_0x2c7ccd['params']['id']},'transaction':_0x513d37})['then'](function(){var _0x54bd62=_[_0x7ece('0x1a')](_0x2c7ccd[_0x7ece('0x3e')],function(_0x162824){_0x162824[_0x7ece('0x50')]=_0x2c7ccd[_0x7ece('0x3a')]['id'];_0x162824[_0x7ece('0x51')]=!![];return _0x162824;});return _0xda94ee[_0x7ece('0x52')](_0x54bd62);})[_0x7ece('0x11')](function(_0x41cba6){console[_0x7ece('0x53')]('LOG\x20~\x20.then\x20~\x20routing',_0x41cba6);return db[_0x7ece('0x25')][_0x7ece('0x54')](_0x41cba6,{'transaction':_0x513d37});});})[_0x7ece('0x11')](function(){return db[_0x7ece('0x25')][_0x7ece('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2c7ccd[_0x7ece('0x3a')]['id']},'order':_0x7ece('0x56')});});}})[_0x7ece('0x11')](respondWithResult(_0x50142d,null))[_0x7ece('0x38')](handleError(_0x50142d,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c182607..77f0bf2 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 _0x49cd=['save','update','remove','emit','hasOwnProperty','exports','VoiceExtension','setMaxListeners'];(function(_0x4ab09f,_0x76a026){var _0x3148f8=function(_0x3f2af1){while(--_0x3f2af1){_0x4ab09f['push'](_0x4ab09f['shift']());}};_0x3148f8(++_0x76a026);}(_0x49cd,0x17e));var _0xd49c=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x49cd[_0x587ba2];return _0x50ec73;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xd49c('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd49c('0x1')](0x0);var events={'afterCreate':_0xd49c('0x2'),'afterUpdate':_0xd49c('0x3'),'afterDestroy':_0xd49c('0x4')};function emitEvent(_0xcd8346){return function(_0x3e8d97,_0x16388e,_0x45153a){VoiceExtensionEvents[_0xd49c('0x5')](_0xcd8346+':'+_0x3e8d97['id'],_0x3e8d97);VoiceExtensionEvents[_0xd49c('0x5')](_0xcd8346,_0x3e8d97);_0x45153a(null);};}for(var e in events){if(events[_0xd49c('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xd49c('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x31cd=['exports','events','../../mysqldb','VoiceExtension','update','remove','emit','hasOwnProperty','hook'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x31cd,0xe2));var _0xd31c=function(_0x826357,_0x6824fb){_0x826357=_0x826357-0x0;var _0x267c5e=_0x31cd[_0x826357];return _0x267c5e;};'use strict';var EventEmitter=require(_0xd31c('0x0'));var VoiceExtension=require(_0xd31c('0x1'))['db'][_0xd31c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd31c('0x3'),'afterDestroy':_0xd31c('0x4')};function emitEvent(_0x4fe6ad){return function(_0x4b21f9,_0x3e898b,_0x381af2){VoiceExtensionEvents['emit'](_0x4fe6ad+':'+_0x4b21f9['id'],_0x4b21f9);VoiceExtensionEvents[_0xd31c('0x5')](_0x4fe6ad,_0x4b21f9);_0x381af2(null);};}for(var e in events){if(events[_0xd31c('0x6')](e)){var event=events[e];VoiceExtension[_0xd31c('0x7')](e,emitEvent(event));}}module[_0xd31c('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 2d64b4e..68ddc6d 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 _0x09f4=['NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','name','param','prefix','phone','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','then','interval','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias'];(function(_0x3272ea,_0x1e5457){var _0x355315=function(_0x4674ec){while(--_0x4674ec){_0x3272ea['push'](_0x3272ea['shift']());}};_0x355315(++_0x1e5457);}(_0x09f4,0x1a5));var _0x409f=function(_0x583fe1,_0x214d87){_0x583fe1=_0x583fe1-0x0;var _0x158303=_0x09f4[_0x583fe1];return _0x158303;};'use strict';var _=require('lodash');var attributes=require(_0x409f('0x0'));module[_0x409f('0x1')]=function(_0x4c2965){var _0x188057=_0x4c2965[_0x409f('0x2')];function _0x55498f(_0x2926cc){var _0x1e52b5=0x2;var _0x49d0df=[{'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':_0x409f('0x5')+_0x2926cc[_0x409f('0x3')],'context':_0x2926cc[_0x409f('0x6')],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']},{'type':_0x2926cc[_0x409f('0x3')],'app':_0x2926cc[_0x409f('0x8')]?_0x409f('0x4'):_0x409f('0x9'),'appdata':_0x2926cc[_0x409f('0x8')]?_0x409f('0xa')+_0x2926cc[_0x409f('0x8')]:_0x409f('0xb'),'context':_0x2926cc[_0x409f('0x6')],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']}];if(_0x2926cc[_0x409f('0x3')]===_0x409f('0xc')){_0x49d0df[_0x409f('0xd')]({'type':_0x409f('0xc'),'app':_0x409f('0x4'),'appdata':'CDR(routeid)='+_0x2926cc['id'],'context':_0x2926cc['context'],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']});}_0x49d0df[_0x409f('0xd')]({'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':_0x409f('0xe'),'context':_0x2926cc['context'],'exten':_0x2926cc['exten'],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']},{'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2926cc[_0x409f('0x6')],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']},{'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':_0x409f('0xf'),'context':_0x2926cc['context'],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']});return _0x49d0df;}function _0x35a201(_0x86fbdc){var _0x593453=0x2;var _0x44b064=[{'type':_0x409f('0x10'),'app':'Set','appdata':_0x409f('0x11'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':'outbound','app':_0x86fbdc['alias']?_0x409f('0x4'):_0x409f('0x9'),'appdata':_0x86fbdc[_0x409f('0x8')]?_0x409f('0xa')+_0x86fbdc[_0x409f('0x8')]:_0x409f('0xb'),'context':_0x86fbdc['context'],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x12')+(_0x86fbdc['cutdigits']?_0x409f('0x13')+_0x86fbdc[_0x409f('0x14')]+'}':'${EXTEN}'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x15')+_0x86fbdc['id'],'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x16'),'appdata':_0x409f('0x17')+(_0x593453+0x2)+'):Goto('+(_0x593453+0x1)+')','context':_0x86fbdc['context'],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x86fbdc[_0x409f('0x14')]?_0x409f('0x18')+_0x86fbdc['cutdigits']+'}':_0x409f('0x19'),'context':_0x86fbdc['context'],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0xe'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':'outbound','app':'Set','appdata':_0x409f('0x1a'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':'outbound','app':_0x409f('0x4'),'appdata':_0x409f('0x1b')+_0x86fbdc['id'],'context':_0x86fbdc['context'],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']}];if(_0x86fbdc['hasOwnProperty'](_0x409f('0x1c'))&&_0x86fbdc[_0x409f('0x1c')]!==_0x409f('0x1d')){_0x44b064[_0x409f('0xd')]({'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x1e'),'context':_0x86fbdc['context'],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x1f')+_0x86fbdc[_0x409f('0x1c')]||_0x409f('0x20'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']});}return _0x44b064;}function _0x31800b(_0x52fb31,_0x2c84c8){var _0x5592c8=[{'name':_0x409f('0x21'),'param':0x0},{'name':_0x409f('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':_0x409f('0x23'),'param':0x3}];var _0x2a5e9f={};var _0x5c0a73=_0x2c84c8[_0x409f('0x24')](',');var _0x2a1f93=[];for(var _0x300343=0x0;_0x300343<_0x5592c8[_0x409f('0x25')];_0x300343++){switch(_0x5592c8[_0x300343][_0x409f('0x26')]){case _0x409f('0x21'):_0x2a5e9f[_0x409f('0x21')]=_0x5c0a73[_0x5592c8[_0x300343][_0x409f('0x27')]]['split']('/')[0x1];_0x2a5e9f['phone']=_0x5c0a73[_0x5592c8[_0x300343][_0x409f('0x27')]][_0x409f('0x24')]('/')[0x2];_0x2a5e9f[_0x409f('0x28')]=_0x2a5e9f['phone']?_0x2a5e9f['phone'][_0x409f('0x24')]('$')[0x0]:undefined;_0x2a5e9f[_0x409f('0x29')]=_0x52fb31['cutdigits']?(_0x2a5e9f[_0x409f('0x28')]||'')+_0x409f('0x13')+_0x52fb31[_0x409f('0x14')]+'}':(_0x2a5e9f['prefix']||'')+_0x409f('0x2a');_0x2a1f93[_0x5592c8[_0x300343][_0x409f('0x27')]]=[_0x409f('0x2b'),_0x2a5e9f['trunk'],_0x2a5e9f[_0x409f('0x29')]][_0x409f('0x2c')]('/');break;case _0x409f('0x2d'):_0x2a5e9f['options']=_0x5c0a73[_0x5592c8[_0x300343]['param']];if(_0x52fb31[_0x409f('0x1c')]!==_0x409f('0x1d')){if(_0x2a5e9f[_0x409f('0x2d')][_0x409f('0x2e')](_0x409f('0x2f'))<0x0){_0x2a5e9f[_0x409f('0x2d')]+=_0x409f('0x2f');}}else{_0x2a5e9f['options']=_0x2a5e9f[_0x409f('0x2d')][_0x409f('0x30')](_0x409f('0x2f'),'');}_0x2a1f93[_0x5592c8[_0x300343][_0x409f('0x27')]]=_0x2a5e9f[_0x409f('0x2d')];break;default:_0x2a1f93[_0x5592c8[_0x300343][_0x409f('0x27')]]=_0x5c0a73[_0x5592c8[_0x300343]['param']];}}return _0x2a1f93[_0x409f('0x2c')](',');}function _0x5464e8(_0x597147,_0x4efbc1,_0x4327c8){return new Promise(function(_0x49cdc7,_0x273851){var _0x2dda13=[];if(_[_0x409f('0x31')](_0x4efbc1))return _0x49cdc7(_0x2dda13);_0x188057[_0x409f('0x32')]['findAll']({'attributes':['id','interval',_0x409f('0x33')],'raw':!![]})[_0x409f('0x34')](function(_0x3bd899){for(var _0x24ce23=0x0,_0x532056=0x0;_0x24ce23<_0x4efbc1['length'];_0x24ce23++,_0x532056=0x0){var _0xc54f16=_0x4efbc1[_0x24ce23];var _0x126845=[];var _0x237e47=[];delete _0xc54f16['id'];if(_0xc54f16[_0x409f('0x35')]!==_0x409f('0x36')){_0xc54f16['intervals']=[_0xc54f16['interval']];}else{_0xc54f16['intervals']=_0xc54f16[_0x409f('0x33')]?_[_0x409f('0x37')](_[_0x409f('0x38')](_0x3bd899,{'IntervalId':_0xc54f16['IntervalId']}),'interval'):[];}_0xc54f16[_0x409f('0x6')]=_0x597147[_0x409f('0x6')];_0xc54f16[_0x409f('0x7')]=_0x597147['exten'];if(_0xc54f16[_0x409f('0x3')])_0xc54f16[_0x409f('0x3')]=_0xc54f16[_0x409f('0x3')][_0x409f('0x39')]();if(_0x597147[_0x409f('0x3')]===_0x409f('0x10')){if(_0xc54f16['hasOwnProperty']('tag')&&_0xc54f16['tag']&&_0xc54f16[_0x409f('0x3a')]!=='--'){_0x126845['push']({'type':_0xc54f16[_0x409f('0x3')]['toLowerCase'](),'app':_0x409f('0x4'),'appdata':_0x409f('0x3b')+_0xc54f16[_0x409f('0x3a')],'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}_0x126845[_0x409f('0xd')]({'type':_0xc54f16['type'][_0x409f('0x39')](),'app':_0x409f('0x16'),'appdata':_0x409f('0x3d')+(_0xc54f16['callerID']?_0x409f('0x3e')+_0xc54f16[_0x409f('0x3f')]+')':_0x409f('0x40')),'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}else{if(_0xc54f16['hasOwnProperty'](_0x409f('0x41'))){if(['queue',_0x409f('0x42')]['includes'](_0xc54f16[_0x409f('0x43')][_0x409f('0x39')]())&&_0xc54f16[_0x409f('0x44')]!==_0x409f('0x45')){if(_0xc54f16[_0x409f('0x41')]){_0x126845[_0x409f('0xd')]({'type':_0xc54f16[_0x409f('0x3')]['toLowerCase'](),'app':_0x409f('0x16'),'appdata':_0x409f('0x46'),'context':_0x597147[_0x409f('0x6')],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')]['length']+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});_0x126845[_0x409f('0xd')]({'type':_0xc54f16[_0x409f('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x409f('0x47'),'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}else{_0x126845['push']({'type':_0xc54f16[_0x409f('0x3')][_0x409f('0x39')](),'app':'ExecIf','appdata':_0x409f('0x48'),'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});_0x126845[_0x409f('0xd')]({'type':_0xc54f16[_0x409f('0x3')][_0x409f('0x39')](),'app':'Set','appdata':_0x409f('0x49'),'context':_0x597147[_0x409f('0x6')],'exten':_0x597147['exten'],'priority':_0xc54f16[_0x409f('0x3c')]['length']+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}}}}for(var _0x4bc2f5=0x0;_0x4bc2f5<_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')];_0x4bc2f5++){var _0x3763cc=_0x4327c8+_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')];var _0xf85613=_0x4bc2f5===_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]-0x1?_0x4327c8+_0x126845[_0x409f('0x25')]+_0x237e47[_0x409f('0x25')]+0x2:_0x4327c8+_0x4bc2f5+0x1;_0x126845[_0x409f('0x4a')](_0x4bc2f5,0x0,{'type':_0x597147['type'],'app':_0x409f('0x4b'),'appdata':_0xc54f16[_0x409f('0x3c')][_0x4bc2f5]+'?'+_0x597147['context']+',${EXTEN},'+_0x3763cc+':'+_0x597147[_0x409f('0x6')]+_0x409f('0x4c')+_0xf85613,'exten':_0x597147[_0x409f('0x7')],'context':_0x597147[_0x409f('0x6')],'priority':_0x4327c8+_0x4bc2f5,'VoiceExtensionId':_0x597147['id']});}if(_0xc54f16[_0x409f('0x44')]===_0x409f('0x4d'))_0xc54f16[_0x409f('0x4e')]=_0x31800b(_0x597147,_0xc54f16['appdata']);_0xc54f16[_0x409f('0x4f')]=_0x126845['length']?_[_0x409f('0x50')](_0x126845)['priority']+0x1:_0x4327c8;_0x2dda13=_['concat'](_0x2dda13,_0x126845,[_0xc54f16],_0x237e47);_0x4327c8=_[_0x409f('0x50')](_0x2dda13)['priority']+0x1;}return _0x49cdc7(_0x2dda13);})[_0x409f('0x51')](function(_0x598e4e){_0x273851(_0x598e4e);});});}return _0x4c2965[_0x409f('0x52')](_0x409f('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x32cc50){var _0xe86405=this[_0x409f('0x54')]({'plain':!![]});var _0x245be1=_0xe86405[_0x409f('0x3')]===_0x409f('0x10')?_0x35a201(_0xe86405):_0x55498f(_0xe86405);return _0x5464e8(_0xe86405,_0x32cc50,_[_0x409f('0x50')](_0x245be1)['priority']+0x1)[_0x409f('0x34')](function(_0x4c8653){var _0x3df14f=_['concat'](_0x245be1,_0x4c8653);_0x3df14f[_0x409f('0xd')]({'type':_0xe86405[_0x409f('0x3')],'app':_0x409f('0x55'),'exten':_0xe86405[_0x409f('0x7')],'context':_0xe86405[_0x409f('0x6')],'priority':_[_0x409f('0x50')](_0x3df14f)[_0x409f('0x4f')]+0x1,'VoiceExtensionId':_0xe86405['id']});return _0x3df14f;});}}});}; \ No newline at end of file +var _0xd67b=['_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','length','name','trunk','param','phone','prefix','join','none','options','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','IntervalId','then','interval','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x3ea7c6,_0x58e36a){var _0x4345a4=function(_0x180221){while(--_0x180221){_0x3ea7c6['push'](_0x3ea7c6['shift']());}};_0x4345a4(++_0x58e36a);}(_0xd67b,0x133));var _0xbd67=function(_0x10b5a2,_0x26a2ba){_0x10b5a2=_0x10b5a2-0x0;var _0x3c713a=_0xd67b[_0x10b5a2];return _0x3c713a;};'use strict';var _=require('lodash');var attributes=require(_0xbd67('0x0'));module['exports']=function(_0x1da24d){var _0x280954=_0x1da24d[_0xbd67('0x1')];function _0x5e967b(_0x40e384){var _0x50da5a=0x2;var _0x1bf96=[{'type':_0x40e384['type'],'app':_0xbd67('0x2'),'appdata':_0xbd67('0x3')+_0x40e384[_0xbd67('0x4')],'context':_0x40e384[_0xbd67('0x5')],'exten':_0x40e384[_0xbd67('0x6')],'priority':_0x50da5a++,'VoiceExtensionId':_0x40e384['id']},{'type':_0x40e384[_0xbd67('0x4')],'app':_0x40e384[_0xbd67('0x7')]?_0xbd67('0x2'):_0xbd67('0x8'),'appdata':_0x40e384[_0xbd67('0x7')]?_0xbd67('0x9')+_0x40e384[_0xbd67('0x7')]:_0xbd67('0xa'),'context':_0x40e384['context'],'exten':_0x40e384['exten'],'priority':_0x50da5a++,'VoiceExtensionId':_0x40e384['id']}];if(_0x40e384[_0xbd67('0x4')]==='inbound'){_0x1bf96[_0xbd67('0xb')]({'type':_0xbd67('0xc'),'app':_0xbd67('0x2'),'appdata':_0xbd67('0xd')+_0x40e384['id'],'context':_0x40e384[_0xbd67('0x5')],'exten':_0x40e384[_0xbd67('0x6')],'priority':_0x50da5a++,'VoiceExtensionId':_0x40e384['id']});}_0x1bf96[_0xbd67('0xb')]({'type':_0x40e384[_0xbd67('0x4')],'app':_0xbd67('0x2'),'appdata':_0xbd67('0xe'),'context':_0x40e384['context'],'exten':_0x40e384[_0xbd67('0x6')],'priority':_0x50da5a++,'VoiceExtensionId':_0x40e384['id']},{'type':_0x40e384[_0xbd67('0x4')],'app':_0xbd67('0x2'),'appdata':_0xbd67('0xf'),'context':_0x40e384[_0xbd67('0x5')],'exten':_0x40e384[_0xbd67('0x6')],'priority':_0x50da5a++,'VoiceExtensionId':_0x40e384['id']},{'type':_0x40e384[_0xbd67('0x4')],'app':_0xbd67('0x2'),'appdata':_0xbd67('0x10'),'context':_0x40e384[_0xbd67('0x5')],'exten':_0x40e384['exten'],'priority':_0x50da5a++,'VoiceExtensionId':_0x40e384['id']});return _0x1bf96;}function _0x4ab3a6(_0x36b990){var _0x475e36=0x2;var _0xff31b=[{'type':'outbound','app':_0xbd67('0x2'),'appdata':_0xbd67('0x11'),'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990['exten'],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':_0xbd67('0x12'),'app':_0x36b990['alias']?_0xbd67('0x2'):_0xbd67('0x8'),'appdata':_0x36b990[_0xbd67('0x7')]?'CDR(routeAlias)='+_0x36b990[_0xbd67('0x7')]:_0xbd67('0xa'),'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':_0xbd67('0x12'),'app':_0xbd67('0x2'),'appdata':'CDR(destination)='+(_0x36b990[_0xbd67('0x13')]?_0xbd67('0x14')+_0x36b990[_0xbd67('0x13')]+'}':_0xbd67('0x15')),'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':_0xbd67('0x12'),'app':_0xbd67('0x2'),'appdata':_0xbd67('0xd')+_0x36b990['id'],'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':'outbound','app':_0xbd67('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x475e36+0x2)+_0xbd67('0x17')+(_0x475e36+0x1)+')','context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':'outbound','app':_0xbd67('0x2'),'appdata':_0x36b990[_0xbd67('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x36b990[_0xbd67('0x13')]+'}':_0xbd67('0x18'),'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':_0xbd67('0x12'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':_0xbd67('0x12'),'app':_0xbd67('0x2'),'appdata':_0xbd67('0xf'),'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':_0xbd67('0x12'),'app':_0xbd67('0x2'),'appdata':_0xbd67('0x10'),'context':_0x36b990['context'],'exten':_0x36b990['exten'],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':_0xbd67('0x12'),'app':_0xbd67('0x2'),'appdata':_0xbd67('0x19')+_0x36b990['id'],'context':_0x36b990['context'],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']}];if(_0x36b990[_0xbd67('0x1a')](_0xbd67('0x1b'))&&_0x36b990[_0xbd67('0x1b')]!=='none'){_0xff31b['push']({'type':'outbound','app':_0xbd67('0x2'),'appdata':_0xbd67('0x1c'),'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990['exten'],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']},{'type':'outbound','app':_0xbd67('0x2'),'appdata':_0xbd67('0x1d')+_0x36b990[_0xbd67('0x1b')]||_0xbd67('0x1e'),'context':_0x36b990[_0xbd67('0x5')],'exten':_0x36b990[_0xbd67('0x6')],'priority':_0x475e36++,'VoiceExtensionId':_0x36b990['id']});}return _0xff31b;}function _0x4919e4(_0x34dcb6,_0xba97cf){var _0x443d45=[{'name':'trunk','param':0x0},{'name':_0xbd67('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0xbd67('0x20'),'param':0x3}];var _0x146d69={};var _0x4f7f21=_0xba97cf[_0xbd67('0x21')](',');var _0x126514=[];for(var _0x20eb75=0x0;_0x20eb75<_0x443d45[_0xbd67('0x22')];_0x20eb75++){switch(_0x443d45[_0x20eb75][_0xbd67('0x23')]){case _0xbd67('0x24'):_0x146d69['trunk']=_0x4f7f21[_0x443d45[_0x20eb75][_0xbd67('0x25')]][_0xbd67('0x21')]('/')[0x1];_0x146d69[_0xbd67('0x26')]=_0x4f7f21[_0x443d45[_0x20eb75][_0xbd67('0x25')]][_0xbd67('0x21')]('/')[0x2];_0x146d69['prefix']=_0x146d69['phone']?_0x146d69[_0xbd67('0x26')][_0xbd67('0x21')]('$')[0x0]:undefined;_0x146d69[_0xbd67('0x26')]=_0x34dcb6['cutdigits']?(_0x146d69[_0xbd67('0x27')]||'')+_0xbd67('0x14')+_0x34dcb6[_0xbd67('0x13')]+'}':(_0x146d69[_0xbd67('0x27')]||'')+'${EXTEN}';_0x126514[_0x443d45[_0x20eb75]['param']]=['SIP',_0x146d69['trunk'],_0x146d69['phone']][_0xbd67('0x28')]('/');break;case'options':_0x146d69['options']=_0x4f7f21[_0x443d45[_0x20eb75]['param']];if(_0x34dcb6[_0xbd67('0x1b')]!==_0xbd67('0x29')){if(_0x146d69[_0xbd67('0x2a')][_0xbd67('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x146d69[_0xbd67('0x2a')]+=_0xbd67('0x2c');}}else{_0x146d69[_0xbd67('0x2a')]=_0x146d69[_0xbd67('0x2a')][_0xbd67('0x2d')](_0xbd67('0x2c'),'');}_0x126514[_0x443d45[_0x20eb75][_0xbd67('0x25')]]=_0x146d69['options'];break;default:_0x126514[_0x443d45[_0x20eb75][_0xbd67('0x25')]]=_0x4f7f21[_0x443d45[_0x20eb75]['param']];}}return _0x126514[_0xbd67('0x28')](',');}function _0x391d53(_0x372b61,_0x1743fd,_0x1f158d){return new Promise(function(_0x3ec233,_0x308e15){var _0xfe170b=[];if(_['isEmpty'](_0x1743fd))return _0x3ec233(_0xfe170b);_0x280954[_0xbd67('0x2e')][_0xbd67('0x2f')]({'attributes':['id','interval',_0xbd67('0x30')],'raw':!![]})[_0xbd67('0x31')](function(_0x20cdb7){for(var _0x548442=0x0,_0x49167f=0x0;_0x548442<_0x1743fd[_0xbd67('0x22')];_0x548442++,_0x49167f=0x0){var _0x368803=_0x1743fd[_0x548442];var _0x2d53fc=[];var _0x48f4ea=[];delete _0x368803['id'];if(_0x368803[_0xbd67('0x32')]!==_0xbd67('0x33')){_0x368803['intervals']=[_0x368803['interval']];}else{_0x368803['intervals']=_0x368803['IntervalId']?_[_0xbd67('0x34')](_[_0xbd67('0x35')](_0x20cdb7,{'IntervalId':_0x368803[_0xbd67('0x30')]}),_0xbd67('0x32')):[];}_0x368803[_0xbd67('0x5')]=_0x372b61['context'];_0x368803[_0xbd67('0x6')]=_0x372b61[_0xbd67('0x6')];if(_0x368803['type'])_0x368803[_0xbd67('0x4')]=_0x368803[_0xbd67('0x4')][_0xbd67('0x36')]();if(_0x372b61[_0xbd67('0x4')]===_0xbd67('0x12')){if(_0x368803['hasOwnProperty'](_0xbd67('0x37'))&&_0x368803['tag']&&_0x368803[_0xbd67('0x37')]!=='--'){_0x2d53fc[_0xbd67('0xb')]({'type':_0x368803['type'][_0xbd67('0x36')](),'app':_0xbd67('0x2'),'appdata':_0xbd67('0x38')+_0x368803['tag'],'context':_0x372b61[_0xbd67('0x5')],'exten':_0x372b61[_0xbd67('0x6')],'priority':_0x368803[_0xbd67('0x39')][_0xbd67('0x22')]+_0x1f158d+_0x49167f++,'VoiceExtensionId':_0x372b61['id']});}_0x2d53fc[_0xbd67('0xb')]({'type':_0x368803[_0xbd67('0x4')][_0xbd67('0x36')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x368803[_0xbd67('0x3a')]?_0xbd67('0x3b')+_0x368803[_0xbd67('0x3a')]+')':_0xbd67('0x3c')),'context':_0x372b61[_0xbd67('0x5')],'exten':_0x372b61['exten'],'priority':_0x368803['intervals'][_0xbd67('0x22')]+_0x1f158d+_0x49167f++,'VoiceExtensionId':_0x372b61['id']});}else{if(_0x368803[_0xbd67('0x1a')](_0xbd67('0x3d'))){if([_0xbd67('0x3e'),_0xbd67('0x3f')][_0xbd67('0x40')](_0x368803[_0xbd67('0x41')][_0xbd67('0x36')]())&&_0x368803[_0xbd67('0x42')]!==_0xbd67('0x43')){if(_0x368803['answer']){_0x2d53fc['push']({'type':_0x368803[_0xbd67('0x4')]['toLowerCase'](),'app':_0xbd67('0x16'),'appdata':_0xbd67('0x44'),'context':_0x372b61[_0xbd67('0x5')],'exten':_0x372b61[_0xbd67('0x6')],'priority':_0x368803['intervals'][_0xbd67('0x22')]+_0x1f158d+_0x49167f++,'VoiceExtensionId':_0x372b61['id']});_0x2d53fc[_0xbd67('0xb')]({'type':_0x368803[_0xbd67('0x4')]['toLowerCase'](),'app':_0xbd67('0x2'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x372b61[_0xbd67('0x5')],'exten':_0x372b61[_0xbd67('0x6')],'priority':_0x368803['intervals'][_0xbd67('0x22')]+_0x1f158d+_0x49167f++,'VoiceExtensionId':_0x372b61['id']});}else{_0x2d53fc[_0xbd67('0xb')]({'type':_0x368803[_0xbd67('0x4')][_0xbd67('0x36')](),'app':_0xbd67('0x16'),'appdata':_0xbd67('0x45'),'context':_0x372b61[_0xbd67('0x5')],'exten':_0x372b61[_0xbd67('0x6')],'priority':_0x368803[_0xbd67('0x39')][_0xbd67('0x22')]+_0x1f158d+_0x49167f++,'VoiceExtensionId':_0x372b61['id']});_0x2d53fc[_0xbd67('0xb')]({'type':_0x368803[_0xbd67('0x4')][_0xbd67('0x36')](),'app':_0xbd67('0x2'),'appdata':_0xbd67('0x46'),'context':_0x372b61[_0xbd67('0x5')],'exten':_0x372b61[_0xbd67('0x6')],'priority':_0x368803['intervals']['length']+_0x1f158d+_0x49167f++,'VoiceExtensionId':_0x372b61['id']});}}}}for(var _0x2aeb29=0x0;_0x2aeb29<_0x368803[_0xbd67('0x39')]['length'];_0x2aeb29++){var _0x25707a=_0x1f158d+_0x368803[_0xbd67('0x39')][_0xbd67('0x22')];var _0x56197f=_0x2aeb29===_0x368803[_0xbd67('0x39')][_0xbd67('0x22')]-0x1?_0x1f158d+_0x2d53fc[_0xbd67('0x22')]+_0x48f4ea[_0xbd67('0x22')]+0x2:_0x1f158d+_0x2aeb29+0x1;_0x2d53fc[_0xbd67('0x47')](_0x2aeb29,0x0,{'type':_0x372b61[_0xbd67('0x4')],'app':'GotoIfTime','appdata':_0x368803[_0xbd67('0x39')][_0x2aeb29]+'?'+_0x372b61['context']+_0xbd67('0x48')+_0x25707a+':'+_0x372b61[_0xbd67('0x5')]+',${EXTEN},'+_0x56197f,'exten':_0x372b61['exten'],'context':_0x372b61[_0xbd67('0x5')],'priority':_0x1f158d+_0x2aeb29,'VoiceExtensionId':_0x372b61['id']});}if(_0x368803[_0xbd67('0x42')]===_0xbd67('0x49'))_0x368803[_0xbd67('0x4a')]=_0x4919e4(_0x372b61,_0x368803[_0xbd67('0x4a')]);_0x368803['priority']=_0x2d53fc[_0xbd67('0x22')]?_[_0xbd67('0x4b')](_0x2d53fc)[_0xbd67('0x4c')]+0x1:_0x1f158d;_0xfe170b=_[_0xbd67('0x4d')](_0xfe170b,_0x2d53fc,[_0x368803],_0x48f4ea);_0x1f158d=_[_0xbd67('0x4b')](_0xfe170b)[_0xbd67('0x4c')]+0x1;}return _0x3ec233(_0xfe170b);})[_0xbd67('0x4e')](function(_0x24e57b){_0x308e15(_0x24e57b);});});}return _0x1da24d[_0xbd67('0x4f')](_0xbd67('0x50'),attributes,{'tableName':_0xbd67('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4b7828){var _0x1493ff=this[_0xbd67('0x52')]({'plain':!![]});var _0x4c36a5=_0x1493ff[_0xbd67('0x4')]===_0xbd67('0x12')?_0x4ab3a6(_0x1493ff):_0x5e967b(_0x1493ff);return _0x391d53(_0x1493ff,_0x4b7828,_[_0xbd67('0x4b')](_0x4c36a5)['priority']+0x1)['then'](function(_0x40499e){var _0x4a6321=_[_0xbd67('0x4d')](_0x4c36a5,_0x40499e);_0x4a6321[_0xbd67('0xb')]({'type':_0x1493ff['type'],'app':_0xbd67('0x53'),'exten':_0x1493ff[_0xbd67('0x6')],'context':_0x1493ff[_0xbd67('0x5')],'priority':_[_0xbd67('0x4b')](_0x4a6321)['priority']+0x1,'VoiceExtensionId':_0x1493ff['id']});return _0x4a6321;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index bf16e15..b223e82 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 _0x2087=['options','raw','where','limit','include','map','model','attributes','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll'];(function(_0x3abc45,_0x426704){var _0x216feb=function(_0x1af3f8){while(--_0x1af3f8){_0x3abc45['push'](_0x3abc45['shift']());}};_0x216feb(++_0x426704);}(_0x2087,0xf3));var _0x7208=function(_0x262bc8,_0x27f87d){_0x262bc8=_0x262bc8-0x0;var _0x2c7d40=_0x2087[_0x262bc8];return _0x2c7d40;};'use strict';var _=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var moment=require(_0x7208('0x2'));var BPromise=require(_0x7208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7208('0x4'));var db=require(_0x7208('0x5'))['db'];var utils=require(_0x7208('0x6'));var logger=require(_0x7208('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7208('0x8'));var client=jayson['client'][_0x7208('0x9')]({'port':0x232a});config['redis']=_[_0x7208('0xa')](config[_0x7208('0xb')],{'host':_0x7208('0xc'),'port':0x18eb});var socket=require(_0x7208('0xd'))(new Redis(config[_0x7208('0xb')]));require(_0x7208('0xe'))[_0x7208('0xf')](socket);function respondWithRpcPromise(_0x533d6a,_0x1949bc,_0x17e320){return new BPromise(function(_0x92a88e,_0x32db48){return client[_0x7208('0x10')](_0x533d6a,_0x17e320)[_0x7208('0x11')](function(_0x5b30f8){logger[_0x7208('0x12')](_0x7208('0x13'),_0x1949bc,_0x7208('0x14'));logger[_0x7208('0x15')](_0x7208('0x16'),_0x1949bc,_0x7208('0x14'),JSON['stringify'](_0x5b30f8));if(_0x5b30f8[_0x7208('0x17')]){if(_0x5b30f8[_0x7208('0x17')][_0x7208('0x18')]===0x1f4){logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);return _0x32db48(_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);}logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x5b30f8['error']['message']);return _0x92a88e(_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);}else{logger['info'](_0x7208('0x13'),_0x1949bc,_0x7208('0x14'));_0x92a88e(_0x5b30f8['result'][_0x7208('0x19')]);}})[_0x7208('0x1a')](function(_0x18f0e2){logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x18f0e2);_0x32db48(_0x18f0e2);});});}exports[_0x7208('0x1b')]=function(_0x15aade){var _0x10f670=this;return new Promise(function(_0x322df1,_0x41cd3a){return db[_0x7208('0x1c')][_0x7208('0x1d')]({'raw':_0x15aade[_0x7208('0x1e')]?_0x15aade[_0x7208('0x1e')][_0x7208('0x1f')]===undefined?!![]:![]:!![],'where':_0x15aade['options']?_0x15aade['options'][_0x7208('0x20')]||null:null,'attributes':_0x15aade[_0x7208('0x1e')]?_0x15aade[_0x7208('0x1e')]['attributes']||null:null,'limit':_0x15aade[_0x7208('0x1e')]?_0x15aade[_0x7208('0x1e')][_0x7208('0x21')]||null:null,'include':_0x15aade[_0x7208('0x1e')]?_0x15aade[_0x7208('0x1e')][_0x7208('0x22')]?_[_0x7208('0x23')](_0x15aade[_0x7208('0x1e')][_0x7208('0x22')],function(_0x12f4ff){return{'model':db[_0x12f4ff[_0x7208('0x24')]],'as':_0x12f4ff['as'],'attributes':_0x12f4ff[_0x7208('0x25')],'include':_0x12f4ff[_0x7208('0x22')]?_[_0x7208('0x23')](_0x12f4ff[_0x7208('0x22')],function(_0x3c15f6){return{'model':db[_0x3c15f6[_0x7208('0x24')]],'as':_0x3c15f6['as'],'attributes':_0x3c15f6[_0x7208('0x25')],'include':_0x3c15f6[_0x7208('0x22')]?_['map'](_0x3c15f6[_0x7208('0x22')],function(_0x5c5394){return{'model':db[_0x5c5394['model']],'as':_0x5c5394['as'],'attributes':_0x5c5394[_0x7208('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7208('0x11')](function(_0x480ce3){logger[_0x7208('0x12')](_0x7208('0x1b'),_0x15aade);logger[_0x7208('0x15')](_0x7208('0x1b'),_0x15aade,JSON[_0x7208('0x26')](_0x480ce3));_0x322df1(_0x480ce3);})[_0x7208('0x1a')](function(_0x1a01d2){logger['error'](_0x7208('0x1b'),_0x1a01d2[_0x7208('0x19')],_0x15aade);_0x41cd3a(_0x10f670[_0x7208('0x17')](0x1f4,_0x1a01d2['message']));});});}; \ No newline at end of file +var _0x4ce6=['limit','include','map','model','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes'];(function(_0x553ed2,_0x188255){var _0x24a28a=function(_0x33ae55){while(--_0x33ae55){_0x553ed2['push'](_0x553ed2['shift']());}};_0x24a28a(++_0x188255);}(_0x4ce6,0x108));var _0x64ce=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x4ce6[_0x3d9176];return _0x12adc5;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var moment=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var rs=require(_0x64ce('0x3'));var fs=require('fs');var Redis=require(_0x64ce('0x4'));var db=require(_0x64ce('0x5'))['db'];var utils=require(_0x64ce('0x6'));var logger=require('../../config/logger')(_0x64ce('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64ce('0x8')][_0x64ce('0x9')]({'port':0x232a});config['redis']=_[_0x64ce('0xa')](config[_0x64ce('0xb')],{'host':_0x64ce('0xc'),'port':0x18eb});var socket=require(_0x64ce('0xd'))(new Redis(config[_0x64ce('0xb')]));require(_0x64ce('0xe'))[_0x64ce('0xf')](socket);function respondWithRpcPromise(_0x37d7ac,_0x42eada,_0xd36fc4){return new BPromise(function(_0x54dd1f,_0x3d7259){return client[_0x64ce('0x10')](_0x37d7ac,_0xd36fc4)[_0x64ce('0x11')](function(_0x14eb42){logger[_0x64ce('0x12')](_0x64ce('0x13'),_0x42eada,_0x64ce('0x14'));logger[_0x64ce('0x15')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x42eada,_0x64ce('0x14'),JSON['stringify'](_0x14eb42));if(_0x14eb42['error']){if(_0x14eb42[_0x64ce('0x16')]['code']===0x1f4){logger[_0x64ce('0x16')](_0x64ce('0x13'),_0x42eada,_0x14eb42[_0x64ce('0x16')][_0x64ce('0x17')]);return _0x3d7259(_0x14eb42[_0x64ce('0x16')][_0x64ce('0x17')]);}logger[_0x64ce('0x16')](_0x64ce('0x13'),_0x42eada,_0x14eb42[_0x64ce('0x16')]['message']);return _0x54dd1f(_0x14eb42['error']['message']);}else{logger[_0x64ce('0x12')](_0x64ce('0x13'),_0x42eada,_0x64ce('0x14'));_0x54dd1f(_0x14eb42[_0x64ce('0x18')][_0x64ce('0x17')]);}})[_0x64ce('0x19')](function(_0x1107c1){logger[_0x64ce('0x16')](_0x64ce('0x13'),_0x42eada,_0x1107c1);_0x3d7259(_0x1107c1);});});}exports[_0x64ce('0x1a')]=function(_0x509752){var _0x54dc91=this;return new Promise(function(_0x21ca39,_0x17a36b){return db['VoiceExtension'][_0x64ce('0x1b')]({'raw':_0x509752[_0x64ce('0x1c')]?_0x509752[_0x64ce('0x1c')][_0x64ce('0x1d')]===undefined?!![]:![]:!![],'where':_0x509752[_0x64ce('0x1c')]?_0x509752[_0x64ce('0x1c')][_0x64ce('0x1e')]||null:null,'attributes':_0x509752['options']?_0x509752[_0x64ce('0x1c')][_0x64ce('0x1f')]||null:null,'limit':_0x509752['options']?_0x509752[_0x64ce('0x1c')][_0x64ce('0x20')]||null:null,'include':_0x509752['options']?_0x509752[_0x64ce('0x1c')][_0x64ce('0x21')]?_[_0x64ce('0x22')](_0x509752[_0x64ce('0x1c')][_0x64ce('0x21')],function(_0x2e941c){return{'model':db[_0x2e941c['model']],'as':_0x2e941c['as'],'attributes':_0x2e941c[_0x64ce('0x1f')],'include':_0x2e941c[_0x64ce('0x21')]?_['map'](_0x2e941c[_0x64ce('0x21')],function(_0x2b47fe){return{'model':db[_0x2b47fe['model']],'as':_0x2b47fe['as'],'attributes':_0x2b47fe[_0x64ce('0x1f')],'include':_0x2b47fe[_0x64ce('0x21')]?_[_0x64ce('0x22')](_0x2b47fe['include'],function(_0x24181c){return{'model':db[_0x24181c[_0x64ce('0x23')]],'as':_0x24181c['as'],'attributes':_0x24181c[_0x64ce('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x64ce('0x11')](function(_0x2fa80d){logger[_0x64ce('0x12')](_0x64ce('0x1a'),_0x509752);logger[_0x64ce('0x15')](_0x64ce('0x1a'),_0x509752,JSON[_0x64ce('0x24')](_0x2fa80d));_0x21ca39(_0x2fa80d);})[_0x64ce('0x19')](function(_0xba6e8b){logger['error'](_0x64ce('0x1a'),_0xba6e8b['message'],_0x509752);_0x17a36b(_0x54dc91[_0x64ce('0x16')](0x1f4,_0xba6e8b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a87c7f0..823ba28 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0xadeb4d,_0x1dcf82){var _0x2e3354=function(_0x3af632){while(--_0x3af632){_0xadeb4d['push'](_0xadeb4d['shift']());}};_0x2e3354(++_0x1dcf82);}(_0x4975,0x86));var _0x5497=function(_0x3ddbf4,_0x5a8dc6){_0x3ddbf4=_0x3ddbf4-0x0;var _0x5db5ce=_0x4975[_0x3ddbf4];return _0x5db5ce;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x595953,_0x2b9942){var _0x1a54fb=function(_0x1ee211){while(--_0x1ee211){_0x595953['push'](_0x595953['shift']());}};_0x1a54fb(++_0x2b9942);}(_0x5fc3,0xa8));var _0x35fc=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0x5fc3[_0x35485a];return _0x5148e6;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ba6c282..766cc44 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 _0x3d04=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','show','/:id/messages','getMessages','create','update','delete','/:id','destroy'];(function(_0x5b4f0b,_0x2b0de3){var _0x3c696b=function(_0x20acfb){while(--_0x20acfb){_0x5b4f0b['push'](_0x5b4f0b['shift']());}};_0x3c696b(++_0x2b0de3);}(_0x3d04,0xbe));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43d0('0xf')]);router['put']('/:id',auth[_0x43d0('0xb')](),controller[_0x43d0('0x10')]);router[_0x43d0('0x11')](_0x43d0('0x12'),auth['isAuthenticated'](),controller[_0x43d0('0x13')]);module[_0x43d0('0x14')]=router; \ No newline at end of file +var _0x4c60=['exports','multer','util','path','connect-timeout','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','put','update','destroy'];(function(_0x360b89,_0x4d7b59){var _0x4c7536=function(_0x2b12ef){while(--_0x2b12ef){_0x360b89['push'](_0x360b89['shift']());}};_0x4c7536(++_0x4d7b59);}(_0x4c60,0xc1));var _0x04c6=function(_0x2d5b72,_0x1042b9){_0x2d5b72=_0x2d5b72-0x0;var _0x22490f=_0x4c60[_0x2d5b72];return _0x22490f;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['show']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x04c6('0xc')]('/:id',auth[_0x04c6('0x7')](),controller[_0x04c6('0xd')]);router['delete'](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xe')]);module[_0x04c6('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 1a26614..230f6b3 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 _0xeeb2=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','fullname','getDataValue','mailbox','sequelize'];(function(_0x5e073a,_0x1db620){var _0x81be84=function(_0xa4f8c4){while(--_0xa4f8c4){_0x5e073a['push'](_0x5e073a['shift']());}};_0x81be84(++_0x1db620);}(_0xeeb2,0x197));var _0x2eeb=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0xeeb2[_0x4df6f9];return _0x4b1a73;};'use strict';var Sequelize=require(_0x2eeb('0x0'));module[_0x2eeb('0x1')]={'customer_id':{'type':Sequelize[_0x2eeb('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x2eeb('0x3'),'unique':_0x2eeb('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2eeb('0x2')]},'fullname':{'type':Sequelize[_0x2eeb('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4d8fe1){this[_0x2eeb('0x5')](_0x2eeb('0x6'),typeof _0x4d8fe1===_0x2eeb('0x7')&&_0x4d8fe1[_0x2eeb('0x8')]()?_0x4d8fe1[_0x2eeb('0x8')]():null);}},'pager':{'type':Sequelize[_0x2eeb('0x2')]},'tz':{'type':Sequelize[_0x2eeb('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':_0x2eeb('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':_0x2eeb('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2eeb('0x2')]},'callback':{'type':Sequelize[_0x2eeb('0x2')]},'review':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2eeb('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2eeb('0x9')](_0x2eeb('0xa'),'no'),'defaultValue':_0x2eeb('0xa'),'allowNull':![]},'stamp':{'type':_0x2eeb('0xc')},'emailsubject':{'type':Sequelize[_0x2eeb('0x2')]},'emailbody':{'type':Sequelize[_0x2eeb('0x2')]},'maxsecs':{'type':Sequelize[_0x2eeb('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2eeb('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x2eeb('0xe'))+'\x20-\x20'+this[_0x2eeb('0xf')](_0x2eeb('0x10'));}}}; \ No newline at end of file +var _0xbedf=['fullname','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x2888ab,_0x4f8bd1){var _0x311ee5=function(_0x539e1e){while(--_0x539e1e){_0x2888ab['push'](_0x2888ab['shift']());}};_0x311ee5(++_0x4f8bd1);}(_0xbedf,0xa6));var _0xfbed=function(_0x11579f,_0x26ab6b){_0x11579f=_0x11579f-0x0;var _0x56e613=_0xbedf[_0x11579f];return _0x56e613;};'use strict';var Sequelize=require(_0xfbed('0x0'));module[_0xfbed('0x1')]={'customer_id':{'type':Sequelize[_0xfbed('0x2')]},'context':{'type':Sequelize[_0xfbed('0x2')],'defaultValue':_0xfbed('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfbed('0x2')],'defaultValue':'','allowNull':![],'unique':_0xfbed('0x4')},'password':{'type':Sequelize[_0xfbed('0x2')]},'fullname':{'type':Sequelize[_0xfbed('0x2')]},'email':{'type':Sequelize[_0xfbed('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1512ae){this[_0xfbed('0x5')]('email',typeof _0x1512ae==='string'&&_0x1512ae['trim']()?_0x1512ae['trim']():null);}},'pager':{'type':Sequelize[_0xfbed('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xfbed('0x6')},'attach':{'type':Sequelize[_0xfbed('0x7')](_0xfbed('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xfbed('0x7')](_0xfbed('0x8'),'no'),'defaultValue':_0xfbed('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfbed('0x2')]},'callback':{'type':Sequelize[_0xfbed('0x2')]},'review':{'type':Sequelize['ENUM'](_0xfbed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfbed('0x7')](_0xfbed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfbed('0x7')](_0xfbed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfbed('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfbed('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xfbed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xfbed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xfbed('0x8'),'no'),'defaultValue':_0xfbed('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xfbed('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfbed('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfbed('0x7')](_0xfbed('0x8'),'no'),'defaultValue':_0xfbed('0x8'),'allowNull':![]},'stamp':{'type':_0xfbed('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xfbed('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfbed('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfbed('0xc')],'get':function(){return this[_0xfbed('0xd')](_0xfbed('0xe'))+'\x20-\x20'+this[_0xfbed('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 83f212c..2450b00 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 _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_0x22d666,_0x4ef149){var _0xfedc00=function(_0x534b7c){while(--_0x534b7c){_0x22d666['push'](_0x22d666['shift']());}};_0xfedc00(++_0x4ef149);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xc1eca,_0x4b7281){_0xc1eca=_0xc1eca-0x0;var _0x21bae9=_0x6f7a[_0xc1eca];return _0x21bae9;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['VoiceMail'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['VoiceMail'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['VoiceMail'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));};exports[_0xa6f7('0x51')]=function(_0x139192,_0x4496f1,_0x5908e3){return db['VoiceMail'][_0xa6f7('0x52')]({'where':{'id':_0x139192[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4496f1,null))[_0xa6f7('0x25')](function(_0x301327){var _0x269249;var _0x1fcb72={},_0x5efd49={};_0x5efd49[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db[_0xa6f7('0x53')][_0xa6f7('0x2d')]);_0x5efd49[_0xa6f7('0x32')]=_[_0xa6f7('0x47')](_0x139192[_0xa6f7('0x32')]);_0x5efd49[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x5efd49[_0xa6f7('0x30')],_0x5efd49[_0xa6f7('0x32')]);_0x1fcb72['attributes']=_[_0xa6f7('0x33')](_0x5efd49['model'],qs[_0xa6f7('0x35')](_0x139192['query'][_0xa6f7('0x35')]));_0x1fcb72[_0xa6f7('0x34')]=_0x1fcb72['attributes'][_0xa6f7('0x36')]?_0x1fcb72[_0xa6f7('0x34')]:_0x5efd49[_0xa6f7('0x30')];if(!_0x139192['query'][_0xa6f7('0x37')]('nolimit')){_0x1fcb72[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x139192['query'][_0xa6f7('0x1d')]);_0x1fcb72['offset']=qs[_0xa6f7('0x1e')](_0x139192['query'][_0xa6f7('0x1e')]);}_0x1fcb72[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x139192[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x1fcb72[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x139192[_0xa6f7('0x32')],_0x5efd49[_0xa6f7('0x3b')]));if(_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'$or':_[_0xa6f7('0x31')](_0x1fcb72[_0xa6f7('0x34')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]+'%'};return _0x3a464e;})});}_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'mailboxuser':_0x301327[_0xa6f7('0x54')]});_0x1fcb72=_['merge']({},_0x1fcb72,_0x139192[_0xa6f7('0x40')]);return db[_0xa6f7('0x53')][_0xa6f7('0x55')](_0x1fcb72)[_0xa6f7('0x25')](respondWithFilteredResult(_0x4496f1,_0x1fcb72));})[_0xa6f7('0x45')](handleError(_0x4496f1,null));}; \ No newline at end of file +var _0xb9a7=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','findOne','VoiceMailMessage','rawAttributes','nolimit','findAndCountAll','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type'];(function(_0x539013,_0x1f3ab3){var _0x314216=function(_0x3817eb){while(--_0x3817eb){_0x539013['push'](_0x539013['shift']());}};_0x314216(++_0x1f3ab3);}(_0xb9a7,0x112));var _0x7b9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb9a7[_0x46698a];return _0x356db0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){var _0x5b2f52=_0x269c07[_0x7b9a('0x20')]({'plain':!![]});var _0x23219e='Voicemails';return db[_0x7b9a('0x21')]['destroy']({'where':{'type':_0x23219e,'resourceId':_0x5b2f52['id']}})[_0x7b9a('0x1e')](function(){return _0x269c07;});})[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d886,_0x55301c){return function(_0x54df8a){if(!_0x54df8a){_0x24d886[_0x7b9a('0x22')](0x194);}return _0x54df8a;};}function handleError(_0x58fec8,_0x5be740){_0x5be740=_0x5be740||0x1f4;return function(_0x3847b4){logger['error'](_0x3847b4[_0x7b9a('0x23')]);if(_0x3847b4[_0x7b9a('0x24')]){delete _0x3847b4['name'];}_0x58fec8[_0x7b9a('0x14')](_0x5be740)[_0x7b9a('0x25')](_0x3847b4);};}exports[_0x7b9a('0x26')]=function(_0x5b64d7,_0x45ccf5){var _0x2ce78b={},_0x181e9c={},_0x6c8b1f={'count':0x0,'rows':[]};var _0x5028e7=_[_0x7b9a('0x27')](db['VoiceMail']['rawAttributes'],function(_0x2d278e){return{'name':_0x2d278e[_0x7b9a('0x28')],'type':_0x2d278e[_0x7b9a('0x29')]['key']};});_0x181e9c[_0x7b9a('0x2a')]=_[_0x7b9a('0x27')](_0x5028e7,'name');_0x181e9c['query']=_[_0x7b9a('0x2b')](_0x5b64d7[_0x7b9a('0x2c')]);_0x181e9c['filters']=_[_0x7b9a('0x2d')](_0x181e9c[_0x7b9a('0x2a')],_0x181e9c[_0x7b9a('0x2c')]);_0x2ce78b[_0x7b9a('0x2e')]=_[_0x7b9a('0x2d')](_0x181e9c['model'],qs[_0x7b9a('0x2f')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x2ce78b[_0x7b9a('0x2e')]=_0x2ce78b[_0x7b9a('0x2e')][_0x7b9a('0x30')]?_0x2ce78b['attributes']:_0x181e9c['model'];if(!_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x31')]('nolimit')){_0x2ce78b[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x5b64d7[_0x7b9a('0x2c')]['limit']);_0x2ce78b[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x5b64d7['query']['offset']);}_0x2ce78b[_0x7b9a('0x32')]=qs[_0x7b9a('0x33')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x33')]);_0x2ce78b[_0x7b9a('0x34')]=qs[_0x7b9a('0x35')](_[_0x7b9a('0x36')](_0x5b64d7[_0x7b9a('0x2c')],_0x181e9c['filters']),_0x5028e7);if(_0x5b64d7[_0x7b9a('0x2c')]['filter']){_0x2ce78b[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x2ce78b[_0x7b9a('0x34')],{'$or':_[_0x7b9a('0x27')](_0x5028e7,function(_0x3fa4cd){if(_0x3fa4cd[_0x7b9a('0x29')]!=='VIRTUAL'){var _0x34eebe={};_0x34eebe[_0x3fa4cd[_0x7b9a('0x24')]]={'$like':'%'+_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x38')]+'%'};return _0x34eebe;}})});}_0x2ce78b=_['merge']({},_0x2ce78b,_0x5b64d7[_0x7b9a('0x39')]);var _0xf86939={'where':_0x2ce78b[_0x7b9a('0x34')]};return db[_0x7b9a('0x3a')]['count'](_0xf86939)[_0x7b9a('0x1e')](function(_0x53d89a){_0x6c8b1f[_0x7b9a('0x19')]=_0x53d89a;if(_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x3b')]){_0x2ce78b[_0x7b9a('0x3c')]=[{'all':!![]}];}return db[_0x7b9a('0x3a')][_0x7b9a('0x3d')](_0x2ce78b);})['then'](function(_0x33edc6){_0x6c8b1f[_0x7b9a('0x3e')]=_0x33edc6;return _0x6c8b1f;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x45ccf5,_0x2ce78b))['catch'](handleError(_0x45ccf5,null));};exports['show']=function(_0x3724fe,_0x454b35){var _0x995d59={'raw':!![],'where':{'id':_0x3724fe[_0x7b9a('0x3f')]['id']}},_0x5cd3dd={};_0x5cd3dd[_0x7b9a('0x2a')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x5cd3dd[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x3724fe['query']);_0x5cd3dd[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0x5cd3dd[_0x7b9a('0x2a')],_0x5cd3dd['query']);_0x995d59[_0x7b9a('0x2e')]=_['intersection'](_0x5cd3dd[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x3724fe[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x995d59[_0x7b9a('0x2e')]=_0x995d59['attributes'][_0x7b9a('0x30')]?_0x995d59['attributes']:_0x5cd3dd[_0x7b9a('0x2a')];if(_0x3724fe['query']['includeAll']){_0x995d59[_0x7b9a('0x3c')]=[{'all':!![]}];}_0x995d59=_[_0x7b9a('0x37')]({},_0x995d59,_0x3724fe[_0x7b9a('0x39')]);return db[_0x7b9a('0x3a')][_0x7b9a('0x40')](_0x995d59)[_0x7b9a('0x1e')](handleEntityNotFound(_0x454b35,null))[_0x7b9a('0x1e')](respondWithResult(_0x454b35,null))[_0x7b9a('0x41')](handleError(_0x454b35,null));};exports[_0x7b9a('0x42')]=function(_0x5088c7,_0x1d7957){return db[_0x7b9a('0x3a')]['create'](_0x5088c7['body'],{})['then'](function(_0x1b3e65){var _0x30296e=_0x5088c7[_0x7b9a('0x43')][_0x7b9a('0x20')]({'plain':!![]});if(!_0x30296e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30296e[_0x7b9a('0x44')]===_0x7b9a('0x43')){var _0x287dea=_0x1b3e65[_0x7b9a('0x20')]({'plain':!![]});var _0x2d083b='Voicemails';return db[_0x7b9a('0x45')]['find']({'where':{'name':_0x2d083b,'userProfileId':_0x30296e[_0x7b9a('0x46')]},'raw':!![]})[_0x7b9a('0x1e')](function(_0x239146){if(_0x239146&&_0x239146[_0x7b9a('0x47')]===0x0){return db['UserProfileResource'][_0x7b9a('0x42')]({'name':_0x287dea[_0x7b9a('0x24')],'resourceId':_0x287dea['id'],'type':_0x239146[_0x7b9a('0x24')],'sectionId':_0x239146['id']},{})[_0x7b9a('0x1e')](function(){return _0x1b3e65;});}else{return _0x1b3e65;}})[_0x7b9a('0x41')](function(_0x3e2f1b){logger[_0x7b9a('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2f1b);throw _0x3e2f1b;});}return _0x1b3e65;})['then'](respondWithResult(_0x1d7957,0xc9))['catch'](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1d')]=function(_0x2f8929,_0x5a1b7d){if(_0x2f8929['body']['id']){delete _0x2f8929['body']['id'];}return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x2f8929[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x5a1b7d,null))[_0x7b9a('0x1e')](saveUpdates(_0x2f8929[_0x7b9a('0x49')],null))[_0x7b9a('0x1e')](respondWithResult(_0x5a1b7d,null))[_0x7b9a('0x41')](handleError(_0x5a1b7d,null));};exports[_0x7b9a('0x1f')]=function(_0x5dc17e,_0x1f99f5){return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x5dc17e[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1f99f5,null))[_0x7b9a('0x1e')](removeEntity(_0x1f99f5,null))[_0x7b9a('0x41')](handleError(_0x1f99f5,null));};exports['getMessages']=function(_0x25ec82,_0x491804,_0x3d2df4){return db[_0x7b9a('0x3a')][_0x7b9a('0x4a')]({'where':{'id':_0x25ec82['params']['id']}})['then'](handleEntityNotFound(_0x491804,null))['then'](function(_0x4f6843){var _0x33375c;var _0x8a777f={},_0xb91099={};_0xb91099['model']=_[_0x7b9a('0x2b')](db[_0x7b9a('0x4b')][_0x7b9a('0x4c')]);_0xb91099[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x25ec82['query']);_0xb91099[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0xb91099[_0x7b9a('0x2a')],_0xb91099['query']);_0x8a777f['attributes']=_['intersection'](_0xb91099[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x25ec82[_0x7b9a('0x2c')]['fields']));_0x8a777f[_0x7b9a('0x2e')]=_0x8a777f[_0x7b9a('0x2e')]['length']?_0x8a777f[_0x7b9a('0x2e')]:_0xb91099['model'];if(!_0x25ec82[_0x7b9a('0x2c')]['hasOwnProperty'](_0x7b9a('0x4d'))){_0x8a777f[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x25ec82[_0x7b9a('0x2c')]['limit']);_0x8a777f[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x25ec82[_0x7b9a('0x2c')][_0x7b9a('0x17')]);}_0x8a777f['order']=qs[_0x7b9a('0x33')](_0x25ec82['query'][_0x7b9a('0x33')]);_0x8a777f['where']=qs[_0x7b9a('0x35')](_['pick'](_0x25ec82['query'],_0xb91099['filters']));if(_0x25ec82['query'][_0x7b9a('0x38')]){_0x8a777f[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'$or':_['map'](_0x8a777f[_0x7b9a('0x2e')],function(_0x4b9462){var _0x50b6f1={};_0x50b6f1[_0x4b9462]={'$like':'%'+_0x25ec82[_0x7b9a('0x2c')]['filter']+'%'};return _0x50b6f1;})});}_0x8a777f['where']=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'mailboxuser':_0x4f6843['mailbox']});_0x8a777f=_[_0x7b9a('0x37')]({},_0x8a777f,_0x25ec82['options']);return db[_0x7b9a('0x4b')][_0x7b9a('0x4e')](_0x8a777f)[_0x7b9a('0x1e')](respondWithFilteredResult(_0x491804,_0x8a777f));})['catch'](handleError(_0x491804,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 783d2a9..72459ed 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 _0x0e18=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x44f0a8,_0x12d758){var _0x40d935=function(_0xb3d60f){while(--_0xb3d60f){_0x44f0a8['push'](_0x44f0a8['shift']());}};_0x40d935(++_0x12d758);}(_0x0e18,0x158));var _0x80e1=function(_0x587beb,_0x170212){_0x587beb=_0x587beb-0x0;var _0x40c272=_0x0e18[_0x587beb];return _0x40c272;};'use strict';var _=require(_0x80e1('0x0'));var util=require('util');var logger=require(_0x80e1('0x1'))(_0x80e1('0x2'));var moment=require(_0x80e1('0x3'));var BPromise=require(_0x80e1('0x4'));var rp=require(_0x80e1('0x5'));var fs=require('fs');var path=require(_0x80e1('0x6'));var rimraf=require('rimraf');var config=require(_0x80e1('0x7'));var attributes=require(_0x80e1('0x8'));module[_0x80e1('0x9')]=function(_0x4e1fb8,_0x11c40d){return _0x4e1fb8[_0x80e1('0xa')](_0x80e1('0xb'),attributes,{'tableName':_0x80e1('0xc'),'paranoid':![],'indexes':[{'name':_0x80e1('0xd'),'fields':[_0x80e1('0xe'),_0x80e1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e1f=['mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail'];(function(_0x131bb1,_0x5c91cc){var _0x4b006b=function(_0x236496){while(--_0x236496){_0x131bb1['push'](_0x131bb1['shift']());}};_0x4b006b(++_0x5c91cc);}(_0x6e1f,0x1f2));var _0xf6e1=function(_0x509fb1,_0x2efa01){_0x509fb1=_0x509fb1-0x0;var _0x264d3b=_0x6e1f[_0x509fb1];return _0x264d3b;};'use strict';var _=require(_0xf6e1('0x0'));var util=require(_0xf6e1('0x1'));var logger=require(_0xf6e1('0x2'))(_0xf6e1('0x3'));var moment=require(_0xf6e1('0x4'));var BPromise=require(_0xf6e1('0x5'));var rp=require(_0xf6e1('0x6'));var fs=require('fs');var path=require(_0xf6e1('0x7'));var rimraf=require(_0xf6e1('0x8'));var config=require(_0xf6e1('0x9'));var attributes=require(_0xf6e1('0xa'));module[_0xf6e1('0xb')]=function(_0x28487d,_0x2aafb7){return _0x28487d['define'](_0xf6e1('0xc'),attributes,{'tableName':_0xf6e1('0xd'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xf6e1('0xe'),_0xf6e1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index bea6082..b482bac 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 _0x5d1b=['jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d7318,_0x1dcaf3){var _0x50d0e6=function(_0x3c3447){while(--_0x3c3447){_0x3d7318['push'](_0x3d7318['shift']());}};_0x50d0e6(++_0x1dcaf3);}(_0x5d1b,0x97));var _0xb5d1=function(_0x5e715b,_0x96d5b1){_0x5e715b=_0x5e715b-0x0;var _0x430419=_0x5d1b[_0x5e715b];return _0x430419;};'use strict';var _=require(_0xb5d1('0x0'));var util=require(_0xb5d1('0x1'));var moment=require(_0xb5d1('0x2'));var BPromise=require(_0xb5d1('0x3'));var rs=require(_0xb5d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5d1('0x5'))['db'];var utils=require(_0xb5d1('0x6'));var logger=require(_0xb5d1('0x7'))(_0xb5d1('0x8'));var config=require(_0xb5d1('0x9'));var jayson=require(_0xb5d1('0xa'));var client=jayson[_0xb5d1('0xb')][_0xb5d1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a14fc,_0x499acd,_0x5ddfa9){return new BPromise(function(_0x2b7c9d,_0xa4ca09){return client[_0xb5d1('0xd')](_0x1a14fc,_0x5ddfa9)[_0xb5d1('0xe')](function(_0x3d41df){logger['info'](_0xb5d1('0xf'),_0x499acd,_0xb5d1('0x10'));logger[_0xb5d1('0x11')](_0xb5d1('0x12'),_0x499acd,_0xb5d1('0x10'),JSON[_0xb5d1('0x13')](_0x3d41df));if(_0x3d41df[_0xb5d1('0x14')]){if(_0x3d41df[_0xb5d1('0x14')]['code']===0x1f4){logger[_0xb5d1('0x14')](_0xb5d1('0xf'),_0x499acd,_0x3d41df[_0xb5d1('0x14')][_0xb5d1('0x15')]);return _0xa4ca09(_0x3d41df[_0xb5d1('0x14')][_0xb5d1('0x15')]);}logger[_0xb5d1('0x14')](_0xb5d1('0xf'),_0x499acd,_0x3d41df[_0xb5d1('0x14')][_0xb5d1('0x15')]);return _0x2b7c9d(_0x3d41df['error'][_0xb5d1('0x15')]);}else{logger[_0xb5d1('0x16')]('VoiceMail,\x20%s,\x20%s',_0x499acd,_0xb5d1('0x10'));_0x2b7c9d(_0x3d41df['result']['message']);}})['catch'](function(_0x7f1c37){logger[_0xb5d1('0x14')](_0xb5d1('0xf'),_0x499acd,_0x7f1c37);_0xa4ca09(_0x7f1c37);});});} \ No newline at end of file +var _0x0ca2=['jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1e4c37,_0xdf253e){var _0xec3469=function(_0x169c0e){while(--_0x169c0e){_0x1e4c37['push'](_0x1e4c37['shift']());}};_0xec3469(++_0xdf253e);}(_0x0ca2,0x122));var _0x20ca=function(_0x153810,_0x4b3117){_0x153810=_0x153810-0x0;var _0x3df31a=_0x0ca2[_0x153810];return _0x3df31a;};'use strict';var _=require(_0x20ca('0x0'));var util=require('util');var moment=require(_0x20ca('0x1'));var BPromise=require(_0x20ca('0x2'));var rs=require(_0x20ca('0x3'));var fs=require('fs');var Redis=require(_0x20ca('0x4'));var db=require(_0x20ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20ca('0x6'))(_0x20ca('0x7'));var config=require(_0x20ca('0x8'));var jayson=require(_0x20ca('0x9'));var client=jayson['client'][_0x20ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fab4e,_0x32c981,_0x3495e9){return new BPromise(function(_0x8bec3c,_0x56f4e6){return client[_0x20ca('0xb')](_0x2fab4e,_0x3495e9)[_0x20ca('0xc')](function(_0x2dba67){logger[_0x20ca('0xd')](_0x20ca('0xe'),_0x32c981,'request\x20sent');logger[_0x20ca('0xf')](_0x20ca('0x10'),_0x32c981,_0x20ca('0x11'),JSON[_0x20ca('0x12')](_0x2dba67));if(_0x2dba67['error']){if(_0x2dba67[_0x20ca('0x13')]['code']===0x1f4){logger[_0x20ca('0x13')](_0x20ca('0xe'),_0x32c981,_0x2dba67[_0x20ca('0x13')][_0x20ca('0x14')]);return _0x56f4e6(_0x2dba67[_0x20ca('0x13')][_0x20ca('0x14')]);}logger[_0x20ca('0x13')]('VoiceMail,\x20%s,\x20%s',_0x32c981,_0x2dba67['error']['message']);return _0x8bec3c(_0x2dba67[_0x20ca('0x13')][_0x20ca('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x32c981,_0x20ca('0x11'));_0x8bec3c(_0x2dba67[_0x20ca('0x15')][_0x20ca('0x14')]);}})[_0x20ca('0x16')](function(_0x1d0284){logger[_0x20ca('0x13')]('VoiceMail,\x20%s,\x20%s',_0x32c981,_0x1d0284);_0x56f4e6(_0x1d0284);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3f5022e..017b2b5 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 _0xe402=['../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','get','download','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x2a26c5,_0x3ff70b){var _0x205669=function(_0x2f701b){while(--_0x2f701b){_0x2a26c5['push'](_0x2a26c5['shift']());}};_0x205669(++_0x3ff70b);}(_0xe402,0xf6));var _0x2e40=function(_0x46bed1,_0xbdca16){_0x46bed1=_0x46bed1-0x0;var _0x4276f3=_0xe402[_0x46bed1];return _0x4276f3;};'use strict';var multer=require(_0x2e40('0x0'));var util=require(_0x2e40('0x1'));var path=require('path');var timeout=require(_0x2e40('0x2'));var express=require(_0x2e40('0x3'));var router=express['Router']();var fs_extra=require(_0x2e40('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2e40('0x5'));var config=require(_0x2e40('0x6'));var controller=require(_0x2e40('0x7'));router['get']('/',auth[_0x2e40('0x8')](),controller[_0x2e40('0x9')]);router['get'](_0x2e40('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2e40('0xb')]('/:id/download',auth[_0x2e40('0x8')](),controller[_0x2e40('0xc')]);router['post']('/',auth[_0x2e40('0x8')](),controller[_0x2e40('0xd')]);router[_0x2e40('0xe')](_0x2e40('0xa'),auth[_0x2e40('0x8')](),controller[_0x2e40('0xf')]);router[_0x2e40('0x10')](_0x2e40('0xa'),auth[_0x2e40('0x8')](),controller['destroy']);module[_0x2e40('0x11')]=router; \ No newline at end of file +var _0x970d=['/:id','download','post','create','put','update','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x970d,0x1b7));var _0xd970=function(_0x58b44a,_0x1a7aa6){_0x58b44a=_0x58b44a-0x0;var _0xd6779d=_0x970d[_0x58b44a];return _0xd6779d;};'use strict';var multer=require(_0xd970('0x0'));var util=require('util');var path=require(_0xd970('0x1'));var timeout=require(_0xd970('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd970('0x3'));var auth=require(_0xd970('0x4'));var interaction=require(_0xd970('0x5'));var config=require(_0xd970('0x6'));var controller=require(_0xd970('0x7'));router[_0xd970('0x8')]('/',auth[_0xd970('0x9')](),controller[_0xd970('0xa')]);router[_0xd970('0x8')](_0xd970('0xb'),auth[_0xd970('0x9')](),controller['show']);router[_0xd970('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xd970('0xc')]);router[_0xd970('0xd')]('/',auth['isAuthenticated'](),controller[_0xd970('0xe')]);router[_0xd970('0xf')]('/:id',auth[_0xd970('0x9')](),controller[_0xd970('0x10')]);router['delete'](_0xd970('0xb'),auth[_0xd970('0x9')](),controller['destroy']);module[_0xd970('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8c1f6ec..b1f7c08 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 _0xc887=['sequelize','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3f1fa1,_0x210da){var _0x3cf762=function(_0x340ef0){while(--_0x340ef0){_0x3f1fa1['push'](_0x3f1fa1['shift']());}};_0x3cf762(++_0x210da);}(_0xc887,0x138));var _0x7c88=function(_0xa044e8,_0x55dc72){_0xa044e8=_0xa044e8-0x0;var _0x279317=_0xc887[_0xa044e8];return _0x279317;};'use strict';var Sequelize=require(_0x7c88('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x41744e){return this[_0x7c88('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x7c88('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x7c88('0x4')](_0x7c88('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x7c88('0x3')],'defaultValue':''},'stamp':{'type':_0x7c88('0x6'),'defaultValue':Sequelize['literal'](_0x7c88('0x7'))}}; \ No newline at end of file +var _0xea5f=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x56ead1,_0x25a14c){var _0x183081=function(_0x43da1f){while(--_0x43da1f){_0x56ead1['push'](_0x56ead1['shift']());}};_0x183081(++_0x25a14c);}(_0xea5f,0x142));var _0xfea5=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xea5f[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0xfea5('0x0'));module[_0xfea5('0x1')]={'name':{'type':Sequelize[_0xfea5('0x2')],'get':function(_0x3ec117){return this[_0xfea5('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xfea5('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfea5('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xfea5('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xfea5('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xfea5('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xfea5('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xfea5('0x6')](_0xfea5('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xfea5('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xfea5('0x8'),'defaultValue':Sequelize['literal'](_0xfea5('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6f32be5..29fb5af 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 _0xac3e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','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','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','model','differenceBy','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VoiceMailMessage','include','findAll','rows','catch','params','includeAll','options','find','create','body','download','recording','Sequelize','ValidationError','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','set','eml-format','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac3e,0x15a));var _0xeac3=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0xac3e[_0x9b5bb2];return _0x2e1e92;};'use strict';var emlformat=require(_0xeac3('0x0'));var rimraf=require(_0xeac3('0x1'));var zipdir=require(_0xeac3('0x2'));var jsonpatch=require(_0xeac3('0x3'));var rp=require(_0xeac3('0x4'));var moment=require(_0xeac3('0x5'));var BPromise=require(_0xeac3('0x6'));var Mustache=require(_0xeac3('0x7'));var util=require(_0xeac3('0x8'));var path=require(_0xeac3('0x9'));var sox=require(_0xeac3('0xa'));var csv=require(_0xeac3('0xb'));var ejs=require(_0xeac3('0xc'));var fs=require('fs');var fs_extra=require(_0xeac3('0xd'));var _=require('lodash');var squel=require(_0xeac3('0xe'));var crypto=require(_0xeac3('0xf'));var jsforce=require(_0xeac3('0x10'));var deskjs=require(_0xeac3('0x11'));var toCsv=require(_0xeac3('0xb'));var querystring=require('querystring');var Papa=require(_0xeac3('0x12'));var Redis=require(_0xeac3('0x13'));var authService=require(_0xeac3('0x14'));var qs=require(_0xeac3('0x15'));var as=require(_0xeac3('0x16'));var hardwareService=require(_0xeac3('0x17'));var logger=require('../../config/logger')(_0xeac3('0x18'));var utils=require(_0xeac3('0x19'));var config=require(_0xeac3('0x1a'));var licenseUtil=require(_0xeac3('0x1b'));var db=require(_0xeac3('0x1c'))['db'];function respondWithStatusCode(_0x524cb8,_0x428f09){_0x428f09=_0x428f09||0xcc;return function(_0x87ba1f){if(_0x87ba1f){return _0x524cb8[_0xeac3('0x1d')](_0x428f09);}return _0x524cb8[_0xeac3('0x1e')](_0x428f09)[_0xeac3('0x1f')]();};}function respondWithResult(_0x1bd8ec,_0x4e43a9){_0x4e43a9=_0x4e43a9||0xc8;return function(_0x4de3fa){if(_0x4de3fa){return _0x1bd8ec[_0xeac3('0x1e')](_0x4e43a9)['json'](_0x4de3fa);}};}function respondWithFilteredResult(_0x2b0f17,_0x241857){return function(_0x1192db){if(_0x1192db){var _0x14753a=typeof _0x241857['offset']===_0xeac3('0x20')&&typeof _0x241857[_0xeac3('0x21')]===_0xeac3('0x20');var _0x3c4dcd=_0x1192db[_0xeac3('0x22')];var _0x363a12=_0x14753a?0x0:_0x241857[_0xeac3('0x23')];var _0x4ed1a0=_0x14753a?_0x1192db[_0xeac3('0x22')]:_0x241857[_0xeac3('0x23')]+_0x241857[_0xeac3('0x21')];var _0x105f55;if(_0x4ed1a0>=_0x3c4dcd){_0x4ed1a0=_0x3c4dcd;_0x105f55=0xc8;}else{_0x105f55=0xce;}_0x2b0f17['status'](_0x105f55);return _0x2b0f17['set'](_0xeac3('0x24'),_0x363a12+'-'+_0x4ed1a0+'/'+_0x3c4dcd)[_0xeac3('0x25')](_0x1192db);}return null;};}function patchUpdates(_0x1b58f1){return function(_0x221bcc){try{jsonpatch[_0xeac3('0x26')](_0x221bcc,_0x1b58f1,!![]);}catch(_0x90e539){return BPromise[_0xeac3('0x27')](_0x90e539);}return _0x221bcc[_0xeac3('0x28')]();};}function saveUpdates(_0xf1d416,_0x1648df){return function(_0x336edf){if(_0x336edf){return _0x336edf[_0xeac3('0x29')](_0xf1d416)[_0xeac3('0x2a')](function(_0x4aa667){return _0x4aa667;});}return null;};}function removeEntity(_0x41a0db,_0x544474){return function(_0x5abe3d){if(_0x5abe3d){return _0x5abe3d[_0xeac3('0x2b')]()[_0xeac3('0x2a')](function(){_0x41a0db[_0xeac3('0x1e')](0xcc)[_0xeac3('0x1f')]();});}};}function handleEntityNotFound(_0x187718,_0x50fa1c){return function(_0x51ef91){if(!_0x51ef91){_0x187718[_0xeac3('0x1d')](0x194);}return _0x51ef91;};}function handleError(_0xa0af0e,_0x2cf6ee){_0x2cf6ee=_0x2cf6ee||0x1f4;return function(_0x5e2cdc){logger[_0xeac3('0x2c')](_0x5e2cdc['stack']);if(_0x5e2cdc[_0xeac3('0x2d')]){delete _0x5e2cdc[_0xeac3('0x2d')];}_0xa0af0e[_0xeac3('0x1e')](_0x2cf6ee)[_0xeac3('0x2e')](_0x5e2cdc);};}exports['index']=function(_0x153b22,_0x5c8112){var _0x6bc581={},_0x50fb52={},_0x32a64c={'count':0x0,'rows':[]};var _0xb67421=_[_0xeac3('0x2f')](db['VoiceMailMessage'][_0xeac3('0x30')],function(_0x3e565b){return{'name':_0x3e565b[_0xeac3('0x31')],'type':_0x3e565b['type']['key']};});_0x50fb52[_0xeac3('0x32')]=_[_0xeac3('0x33')](_[_0xeac3('0x2f')](_0xb67421,'name'),[_0xeac3('0x2d')]);_0x50fb52['query']=_[_0xeac3('0x34')](_0x153b22[_0xeac3('0x35')]);_0x50fb52[_0xeac3('0x36')]=_[_0xeac3('0x37')](_0x50fb52[_0xeac3('0x32')],_0x50fb52[_0xeac3('0x35')]);_0x6bc581[_0xeac3('0x38')]=_[_0xeac3('0x37')](_0x50fb52['model'],qs['fields'](_0x153b22['query']['fields']));_0x6bc581[_0xeac3('0x38')]=_0x6bc581[_0xeac3('0x38')][_0xeac3('0x39')]?_0x6bc581['attributes']:_0x50fb52['model'];if(!_0x153b22[_0xeac3('0x35')][_0xeac3('0x3a')](_0xeac3('0x3b'))){_0x6bc581[_0xeac3('0x21')]=qs['limit'](_0x153b22['query'][_0xeac3('0x21')]);_0x6bc581['offset']=qs[_0xeac3('0x23')](_0x153b22[_0xeac3('0x35')][_0xeac3('0x23')]);}_0x6bc581[_0xeac3('0x3c')]=qs['sort'](_0x153b22['query'][_0xeac3('0x3d')]);_0x6bc581[_0xeac3('0x3e')]=qs[_0xeac3('0x36')](_[_0xeac3('0x3f')](_0x153b22[_0xeac3('0x35')],_0x50fb52['filters']),_0xb67421);if(_0x153b22[_0xeac3('0x35')][_0xeac3('0x40')]){_0x6bc581[_0xeac3('0x3e')]=_[_0xeac3('0x41')](_0x6bc581[_0xeac3('0x3e')],{'$or':_[_0xeac3('0x2f')](_0xb67421,function(_0x2f7455){if(_0x2f7455[_0xeac3('0x42')]!=='VIRTUAL'){var _0x568106={};_0x568106[_0x2f7455[_0xeac3('0x2d')]]={'$like':'%'+_0x153b22[_0xeac3('0x35')][_0xeac3('0x40')]+'%'};return _0x568106;}})});}_0x6bc581=_[_0xeac3('0x41')]({},_0x6bc581,_0x153b22['options']);var _0x587d8d={'where':_0x6bc581['where']};return db[_0xeac3('0x43')]['count'](_0x587d8d)[_0xeac3('0x2a')](function(_0x438ce0){_0x32a64c['count']=_0x438ce0;if(_0x153b22[_0xeac3('0x35')]['includeAll']){_0x6bc581[_0xeac3('0x44')]=[{'all':!![]}];}return db[_0xeac3('0x43')][_0xeac3('0x45')](_0x6bc581);})[_0xeac3('0x2a')](function(_0x5a9efb){_0x32a64c[_0xeac3('0x46')]=_0x5a9efb;return _0x32a64c;})[_0xeac3('0x2a')](respondWithFilteredResult(_0x5c8112,_0x6bc581))[_0xeac3('0x47')](handleError(_0x5c8112,null));};exports['show']=function(_0x15fc35,_0x448ab2){var _0x3d9a3d={'raw':!![],'where':{'id':_0x15fc35[_0xeac3('0x48')]['id']}},_0x597a3b={};_0x597a3b[_0xeac3('0x32')]=_[_0xeac3('0x34')](db[_0xeac3('0x43')][_0xeac3('0x30')]);_0x597a3b[_0xeac3('0x35')]=_['keys'](_0x15fc35[_0xeac3('0x35')]);_0x597a3b['filters']=_['intersection'](_0x597a3b[_0xeac3('0x32')],_0x597a3b[_0xeac3('0x35')]);_0x3d9a3d['attributes']=_[_0xeac3('0x37')](_0x597a3b[_0xeac3('0x32')],qs['fields'](_0x15fc35[_0xeac3('0x35')]['fields']));_0x3d9a3d[_0xeac3('0x38')]=_0x3d9a3d[_0xeac3('0x38')][_0xeac3('0x39')]?_0x3d9a3d['attributes']:_0x597a3b[_0xeac3('0x32')];if(_0x15fc35['query'][_0xeac3('0x49')]){_0x3d9a3d['include']=[{'all':!![]}];}_0x3d9a3d=_['merge']({},_0x3d9a3d,_0x15fc35[_0xeac3('0x4a')]);return db['VoiceMailMessage'][_0xeac3('0x4b')](_0x3d9a3d)[_0xeac3('0x2a')](handleEntityNotFound(_0x448ab2,null))[_0xeac3('0x2a')](respondWithResult(_0x448ab2,null))[_0xeac3('0x47')](handleError(_0x448ab2,null));};exports[_0xeac3('0x4c')]=function(_0x321860,_0x4cd19a){return db['VoiceMailMessage']['create'](_0x321860['body'],{})[_0xeac3('0x2a')](respondWithResult(_0x4cd19a,0xc9))[_0xeac3('0x47')](handleError(_0x4cd19a,null));};exports[_0xeac3('0x29')]=function(_0x1b38d4,_0x35a4e0){if(_0x1b38d4[_0xeac3('0x4d')]['id']){delete _0x1b38d4[_0xeac3('0x4d')]['id'];}return db[_0xeac3('0x43')]['find']({'where':{'id':_0x1b38d4[_0xeac3('0x48')]['id']}})[_0xeac3('0x2a')](handleEntityNotFound(_0x35a4e0,null))[_0xeac3('0x2a')](saveUpdates(_0x1b38d4[_0xeac3('0x4d')],null))[_0xeac3('0x2a')](respondWithResult(_0x35a4e0,null))[_0xeac3('0x47')](handleError(_0x35a4e0,null));};exports[_0xeac3('0x2b')]=function(_0x35acf3,_0x34922d){return db['VoiceMailMessage'][_0xeac3('0x4b')]({'where':{'id':_0x35acf3[_0xeac3('0x48')]['id']}})[_0xeac3('0x2a')](handleEntityNotFound(_0x34922d,null))[_0xeac3('0x2a')](removeEntity(_0x34922d,null))[_0xeac3('0x47')](handleError(_0x34922d,null));};exports[_0xeac3('0x4e')]=function(_0x48d72a,_0x5f3a24,_0x1f3fae){return db[_0xeac3('0x43')][_0xeac3('0x4b')]({'where':{'id':_0x48d72a[_0xeac3('0x48')]['id']},'attributes':['id',_0xeac3('0x4f'),'msg_id']})[_0xeac3('0x2a')](handleEntityNotFound(_0x5f3a24,null))['then'](function(_0x4497cb){if(_0x4497cb){if(!_0x4497cb['recording']){throw new db[(_0xeac3('0x50'))][(_0xeac3('0x51'))]('VoiceMailMessage\x20not\x20found');}var _0x58b324={'Content-Type':_0xeac3('0x52'),'Content-Disposition':'attachment'};if(_0x4497cb[_0xeac3('0x53')]){_0x58b324[_0xeac3('0x54')]=_0xeac3('0x55')+_0x4497cb[_0xeac3('0x53')]+'.wav\x22';}_0x5f3a24[_0xeac3('0x56')](_0x58b324);return _0x5f3a24[_0xeac3('0x2e')](new Buffer(_0x4497cb[_0xeac3('0x4f')]));}})[_0xeac3('0x47')](handleError(_0x5f3a24,null));}; \ No newline at end of file +var _0x55b9=['fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','send','index','map','rawAttributes','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','name','VoiceMailMessage','includeAll','include','show','params','keys','options','find','catch','create','body','update','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x8b247c,_0x1cfe46){var _0x159e23=function(_0x1f2deb){while(--_0x1f2deb){_0x8b247c['push'](_0x8b247c['shift']());}};_0x159e23(++_0x1cfe46);}(_0x55b9,0x140));var _0x955b=function(_0x2bbec9,_0x544d55){_0x2bbec9=_0x2bbec9-0x0;var _0x55f13d=_0x55b9[_0x2bbec9];return _0x55f13d;};'use strict';var emlformat=require(_0x955b('0x0'));var rimraf=require(_0x955b('0x1'));var zipdir=require(_0x955b('0x2'));var jsonpatch=require(_0x955b('0x3'));var rp=require(_0x955b('0x4'));var moment=require(_0x955b('0x5'));var BPromise=require(_0x955b('0x6'));var Mustache=require(_0x955b('0x7'));var util=require(_0x955b('0x8'));var path=require(_0x955b('0x9'));var sox=require('sox');var csv=require(_0x955b('0xa'));var ejs=require(_0x955b('0xb'));var fs=require('fs');var fs_extra=require(_0x955b('0xc'));var _=require('lodash');var squel=require(_0x955b('0xd'));var crypto=require('crypto');var jsforce=require(_0x955b('0xe'));var deskjs=require(_0x955b('0xf'));var toCsv=require(_0x955b('0xa'));var querystring=require(_0x955b('0x10'));var Papa=require('papaparse');var Redis=require(_0x955b('0x11'));var authService=require(_0x955b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x955b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x955b('0x14'))(_0x955b('0x15'));var utils=require('../../config/utils');var config=require(_0x955b('0x16'));var licenseUtil=require(_0x955b('0x17'));var db=require(_0x955b('0x18'))['db'];function respondWithStatusCode(_0x2b28a0,_0x4e869c){_0x4e869c=_0x4e869c||0xcc;return function(_0x44bbff){if(_0x44bbff){return _0x2b28a0[_0x955b('0x19')](_0x4e869c);}return _0x2b28a0[_0x955b('0x1a')](_0x4e869c)[_0x955b('0x1b')]();};}function respondWithResult(_0x570df6,_0x41a129){_0x41a129=_0x41a129||0xc8;return function(_0x17a4e4){if(_0x17a4e4){return _0x570df6[_0x955b('0x1a')](_0x41a129)[_0x955b('0x1c')](_0x17a4e4);}};}function respondWithFilteredResult(_0x3110a5,_0x2d932d){return function(_0x1d0b9a){if(_0x1d0b9a){var _0x3d75fa=typeof _0x2d932d[_0x955b('0x1d')]===_0x955b('0x1e')&&typeof _0x2d932d[_0x955b('0x1f')]===_0x955b('0x1e');var _0x137e3c=_0x1d0b9a[_0x955b('0x20')];var _0x50ca66=_0x3d75fa?0x0:_0x2d932d[_0x955b('0x1d')];var _0x5747f=_0x3d75fa?_0x1d0b9a[_0x955b('0x20')]:_0x2d932d[_0x955b('0x1d')]+_0x2d932d[_0x955b('0x1f')];var _0xf43456;if(_0x5747f>=_0x137e3c){_0x5747f=_0x137e3c;_0xf43456=0xc8;}else{_0xf43456=0xce;}_0x3110a5[_0x955b('0x1a')](_0xf43456);return _0x3110a5[_0x955b('0x21')](_0x955b('0x22'),_0x50ca66+'-'+_0x5747f+'/'+_0x137e3c)[_0x955b('0x1c')](_0x1d0b9a);}return null;};}function patchUpdates(_0x3a73e1){return function(_0x5b828b){try{jsonpatch[_0x955b('0x23')](_0x5b828b,_0x3a73e1,!![]);}catch(_0x572195){return BPromise['reject'](_0x572195);}return _0x5b828b[_0x955b('0x24')]();};}function saveUpdates(_0x4e0813,_0x1bd988){return function(_0x5344fa){if(_0x5344fa){return _0x5344fa['update'](_0x4e0813)[_0x955b('0x25')](function(_0x4f8d8c){return _0x4f8d8c;});}return null;};}function removeEntity(_0x36215a,_0x1bd2b3){return function(_0x1f9a7e){if(_0x1f9a7e){return _0x1f9a7e[_0x955b('0x26')]()['then'](function(){_0x36215a[_0x955b('0x1a')](0xcc)[_0x955b('0x1b')]();});}};}function handleEntityNotFound(_0x5f073d,_0x397b95){return function(_0x192cb1){if(!_0x192cb1){_0x5f073d[_0x955b('0x19')](0x194);}return _0x192cb1;};}function handleError(_0x1b96f7,_0x93eedf){_0x93eedf=_0x93eedf||0x1f4;return function(_0x1ddb58){logger[_0x955b('0x27')](_0x1ddb58['stack']);if(_0x1ddb58['name']){delete _0x1ddb58['name'];}_0x1b96f7['status'](_0x93eedf)[_0x955b('0x28')](_0x1ddb58);};}exports[_0x955b('0x29')]=function(_0xad542b,_0x41eb3d){var _0x52b62b={},_0x3056aa={},_0x578358={'count':0x0,'rows':[]};var _0x21514a=_[_0x955b('0x2a')](db['VoiceMailMessage'][_0x955b('0x2b')],function(_0x5ab4ad){return{'name':_0x5ab4ad['fieldName'],'type':_0x5ab4ad[_0x955b('0x2c')][_0x955b('0x2d')]};});_0x3056aa[_0x955b('0x2e')]=_[_0x955b('0x2f')](_[_0x955b('0x2a')](_0x21514a,'name'),['name']);_0x3056aa[_0x955b('0x30')]=_['keys'](_0xad542b[_0x955b('0x30')]);_0x3056aa[_0x955b('0x31')]=_[_0x955b('0x32')](_0x3056aa['model'],_0x3056aa['query']);_0x52b62b['attributes']=_['intersection'](_0x3056aa[_0x955b('0x2e')],qs[_0x955b('0x33')](_0xad542b[_0x955b('0x30')][_0x955b('0x33')]));_0x52b62b[_0x955b('0x34')]=_0x52b62b[_0x955b('0x34')][_0x955b('0x35')]?_0x52b62b[_0x955b('0x34')]:_0x3056aa[_0x955b('0x2e')];if(!_0xad542b[_0x955b('0x30')][_0x955b('0x36')](_0x955b('0x37'))){_0x52b62b[_0x955b('0x1f')]=qs[_0x955b('0x1f')](_0xad542b[_0x955b('0x30')][_0x955b('0x1f')]);_0x52b62b[_0x955b('0x1d')]=qs['offset'](_0xad542b[_0x955b('0x30')][_0x955b('0x1d')]);}_0x52b62b['order']=qs[_0x955b('0x38')](_0xad542b[_0x955b('0x30')][_0x955b('0x38')]);_0x52b62b[_0x955b('0x39')]=qs[_0x955b('0x31')](_['pick'](_0xad542b[_0x955b('0x30')],_0x3056aa[_0x955b('0x31')]),_0x21514a);if(_0xad542b[_0x955b('0x30')][_0x955b('0x3a')]){_0x52b62b[_0x955b('0x39')]=_[_0x955b('0x3b')](_0x52b62b[_0x955b('0x39')],{'$or':_['map'](_0x21514a,function(_0x3f3d67){if(_0x3f3d67[_0x955b('0x2c')]!==_0x955b('0x3c')){var _0x5468df={};_0x5468df[_0x3f3d67[_0x955b('0x3d')]]={'$like':'%'+_0xad542b[_0x955b('0x30')][_0x955b('0x3a')]+'%'};return _0x5468df;}})});}_0x52b62b=_[_0x955b('0x3b')]({},_0x52b62b,_0xad542b['options']);var _0x9eb20e={'where':_0x52b62b['where']};return db[_0x955b('0x3e')]['count'](_0x9eb20e)[_0x955b('0x25')](function(_0x47c66d){_0x578358[_0x955b('0x20')]=_0x47c66d;if(_0xad542b[_0x955b('0x30')][_0x955b('0x3f')]){_0x52b62b[_0x955b('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x52b62b);})[_0x955b('0x25')](function(_0x5368d5){_0x578358['rows']=_0x5368d5;return _0x578358;})[_0x955b('0x25')](respondWithFilteredResult(_0x41eb3d,_0x52b62b))['catch'](handleError(_0x41eb3d,null));};exports[_0x955b('0x41')]=function(_0x4c6d17,_0x1050a5){var _0x2d2392={'raw':!![],'where':{'id':_0x4c6d17[_0x955b('0x42')]['id']}},_0x28e336={};_0x28e336[_0x955b('0x2e')]=_[_0x955b('0x43')](db[_0x955b('0x3e')][_0x955b('0x2b')]);_0x28e336[_0x955b('0x30')]=_['keys'](_0x4c6d17[_0x955b('0x30')]);_0x28e336['filters']=_[_0x955b('0x32')](_0x28e336['model'],_0x28e336['query']);_0x2d2392[_0x955b('0x34')]=_[_0x955b('0x32')](_0x28e336[_0x955b('0x2e')],qs['fields'](_0x4c6d17[_0x955b('0x30')][_0x955b('0x33')]));_0x2d2392[_0x955b('0x34')]=_0x2d2392[_0x955b('0x34')][_0x955b('0x35')]?_0x2d2392[_0x955b('0x34')]:_0x28e336['model'];if(_0x4c6d17[_0x955b('0x30')][_0x955b('0x3f')]){_0x2d2392['include']=[{'all':!![]}];}_0x2d2392=_[_0x955b('0x3b')]({},_0x2d2392,_0x4c6d17[_0x955b('0x44')]);return db[_0x955b('0x3e')][_0x955b('0x45')](_0x2d2392)[_0x955b('0x25')](handleEntityNotFound(_0x1050a5,null))[_0x955b('0x25')](respondWithResult(_0x1050a5,null))[_0x955b('0x46')](handleError(_0x1050a5,null));};exports[_0x955b('0x47')]=function(_0x597ee0,_0x11061d){return db[_0x955b('0x3e')]['create'](_0x597ee0[_0x955b('0x48')],{})[_0x955b('0x25')](respondWithResult(_0x11061d,0xc9))['catch'](handleError(_0x11061d,null));};exports[_0x955b('0x49')]=function(_0x1498dd,_0x7bfef7){if(_0x1498dd['body']['id']){delete _0x1498dd[_0x955b('0x48')]['id'];}return db['VoiceMailMessage'][_0x955b('0x45')]({'where':{'id':_0x1498dd['params']['id']}})[_0x955b('0x25')](handleEntityNotFound(_0x7bfef7,null))[_0x955b('0x25')](saveUpdates(_0x1498dd[_0x955b('0x48')],null))['then'](respondWithResult(_0x7bfef7,null))[_0x955b('0x46')](handleError(_0x7bfef7,null));};exports['destroy']=function(_0x2ddf4f,_0x8f059){return db['VoiceMailMessage'][_0x955b('0x45')]({'where':{'id':_0x2ddf4f['params']['id']}})[_0x955b('0x25')](handleEntityNotFound(_0x8f059,null))['then'](removeEntity(_0x8f059,null))[_0x955b('0x46')](handleError(_0x8f059,null));};exports[_0x955b('0x4a')]=function(_0x156bfe,_0x5a6d7a,_0x50272f){return db[_0x955b('0x3e')]['find']({'where':{'id':_0x156bfe['params']['id']},'attributes':['id',_0x955b('0x4b'),_0x955b('0x4c')]})[_0x955b('0x25')](handleEntityNotFound(_0x5a6d7a,null))[_0x955b('0x25')](function(_0x2dddd0){if(_0x2dddd0){if(!_0x2dddd0[_0x955b('0x4b')]){throw new db[(_0x955b('0x4d'))]['ValidationError'](_0x955b('0x4e'));}var _0x26e946={'Content-Type':_0x955b('0x4f'),'Content-Disposition':_0x955b('0x50')};if(_0x2dddd0[_0x955b('0x4c')]){_0x26e946[_0x955b('0x51')]=_0x955b('0x52')+_0x2dddd0[_0x955b('0x4c')]+'.wav\x22';}_0x5a6d7a['set'](_0x26e946);return _0x5a6d7a[_0x955b('0x28')](new Buffer(_0x2dddd0[_0x955b('0x4b')]));}})['catch'](handleError(_0x5a6d7a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 9747e49..84e37ad 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 _0x43a3=['api','moment','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','util','../../config/logger'];(function(_0x4f2cec,_0x51601d){var _0x2866ec=function(_0x1962d8){while(--_0x1962d8){_0x4f2cec['push'](_0x4f2cec['shift']());}};_0x2866ec(++_0x51601d);}(_0x43a3,0x111));var _0x343a=function(_0x1d93dc,_0x31f63e){_0x1d93dc=_0x1d93dc-0x0;var _0x37181e=_0x43a3[_0x1d93dc];return _0x37181e;};'use strict';var _=require('lodash');var util=require(_0x343a('0x0'));var logger=require(_0x343a('0x1'))(_0x343a('0x2'));var moment=require(_0x343a('0x3'));var BPromise=require('bluebird');var rp=require(_0x343a('0x4'));var fs=require('fs');var path=require(_0x343a('0x5'));var rimraf=require(_0x343a('0x6'));var config=require('../../config/environment');var attributes=require(_0x343a('0x7'));module[_0x343a('0x8')]=function(_0x5e5b0a,_0x16547f){return _0x5e5b0a['define'](_0x343a('0x9'),attributes,{'tableName':_0x343a('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x5d3f=['path','rimraf','../../config/environment','exports','define','VoiceMailMessage','dir','api','bluebird'];(function(_0x59dbce,_0x44854e){var _0x52dc48=function(_0x5c2f0c){while(--_0x5c2f0c){_0x59dbce['push'](_0x59dbce['shift']());}};_0x52dc48(++_0x44854e);}(_0x5d3f,0xa9));var _0xf5d3=function(_0x21183c,_0x552d70){_0x21183c=_0x21183c-0x0;var _0x13b5d9=_0x5d3f[_0x21183c];return _0x13b5d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf5d3('0x0'));var moment=require('moment');var BPromise=require(_0xf5d3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5d3('0x2'));var rimraf=require(_0xf5d3('0x3'));var config=require(_0xf5d3('0x4'));var attributes=require('./voiceMailMessage.attributes');module[_0xf5d3('0x5')]=function(_0x3d60bc,_0x1b4d23){return _0x3d60bc[_0xf5d3('0x6')](_0xf5d3('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xf5d3('0x8'),'fields':[_0xf5d3('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index e326a09..dee7a9f 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 _0x54d1=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x54d1,0x159));var _0x154d=function(_0x27c5b3,_0x14847f){_0x27c5b3=_0x27c5b3-0x0;var _0x32063b=_0x54d1[_0x27c5b3];return _0x32063b;};'use strict';var _=require(_0x154d('0x0'));var util=require(_0x154d('0x1'));var moment=require('moment');var BPromise=require(_0x154d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x154d('0x3'));var db=require(_0x154d('0x4'))['db'];var utils=require(_0x154d('0x5'));var logger=require(_0x154d('0x6'))(_0x154d('0x7'));var config=require(_0x154d('0x8'));var jayson=require(_0x154d('0x9'));var client=jayson[_0x154d('0xa')][_0x154d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55b90c,_0x4a7585,_0x286d9a){return new BPromise(function(_0x585baa,_0xc861fc){return client[_0x154d('0xc')](_0x55b90c,_0x286d9a)[_0x154d('0xd')](function(_0x148960){logger[_0x154d('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x4a7585,_0x154d('0xf'));logger['debug'](_0x154d('0x10'),_0x4a7585,_0x154d('0xf'),JSON[_0x154d('0x11')](_0x148960));if(_0x148960[_0x154d('0x12')]){if(_0x148960[_0x154d('0x12')][_0x154d('0x13')]===0x1f4){logger[_0x154d('0x12')](_0x154d('0x14'),_0x4a7585,_0x148960[_0x154d('0x12')][_0x154d('0x15')]);return _0xc861fc(_0x148960['error'][_0x154d('0x15')]);}logger['error'](_0x154d('0x14'),_0x4a7585,_0x148960[_0x154d('0x12')][_0x154d('0x15')]);return _0x585baa(_0x148960[_0x154d('0x12')]['message']);}else{logger[_0x154d('0xe')](_0x154d('0x14'),_0x4a7585,_0x154d('0xf'));_0x585baa(_0x148960[_0x154d('0x16')][_0x154d('0x15')]);}})['catch'](function(_0x716680){logger[_0x154d('0x12')](_0x154d('0x14'),_0x4a7585,_0x716680);_0xc861fc(_0x716680);});});} \ No newline at end of file +var _0x413d=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4819c1,_0x11e719){var _0x45d265=function(_0x339f3f){while(--_0x339f3f){_0x4819c1['push'](_0x4819c1['shift']());}};_0x45d265(++_0x11e719);}(_0x413d,0x1b2));var _0xd413=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x413d[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xd413('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd413('0x1'));var rs=require(_0xd413('0x2'));var fs=require('fs');var Redis=require(_0xd413('0x3'));var db=require(_0xd413('0x4'))['db'];var utils=require(_0xd413('0x5'));var logger=require(_0xd413('0x6'))('rpc');var config=require(_0xd413('0x7'));var jayson=require(_0xd413('0x8'));var client=jayson[_0xd413('0x9')][_0xd413('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d5d16,_0x27f8ae,_0x2ac731){return new BPromise(function(_0x37db21,_0x21e069){return client[_0xd413('0xb')](_0x4d5d16,_0x2ac731)[_0xd413('0xc')](function(_0x499d36){logger[_0xd413('0xd')](_0xd413('0xe'),_0x27f8ae,_0xd413('0xf'));logger[_0xd413('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x27f8ae,'request\x20sent',JSON[_0xd413('0x11')](_0x499d36));if(_0x499d36[_0xd413('0x12')]){if(_0x499d36['error']['code']===0x1f4){logger[_0xd413('0x12')](_0xd413('0xe'),_0x27f8ae,_0x499d36['error'][_0xd413('0x13')]);return _0x21e069(_0x499d36[_0xd413('0x12')][_0xd413('0x13')]);}logger[_0xd413('0x12')](_0xd413('0xe'),_0x27f8ae,_0x499d36[_0xd413('0x12')][_0xd413('0x13')]);return _0x37db21(_0x499d36[_0xd413('0x12')][_0xd413('0x13')]);}else{logger[_0xd413('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x27f8ae,_0xd413('0xf'));_0x37db21(_0x499d36['result'][_0xd413('0x13')]);}})['catch'](function(_0xb16ae9){logger[_0xd413('0x12')](_0xd413('0xe'),_0x27f8ae,_0xb16ae9);_0x21e069(_0xb16ae9);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 2d8b2c9..b14f63f 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 _0x6bb0=['../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','show','/:id/sounds','post','create','addSound','put','/:id','update','delete','/:id/sounds/:id2','removeSound','multer','path','connect-timeout','express'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6bb0,0x1dc));var _0x06bb=function(_0x16f775,_0x45b10f){_0x16f775=_0x16f775-0x0;var _0x17d9e2=_0x6bb0[_0x16f775];return _0x17d9e2;};'use strict';var multer=require(_0x06bb('0x0'));var util=require('util');var path=require(_0x06bb('0x1'));var timeout=require(_0x06bb('0x2'));var express=require(_0x06bb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x06bb('0x5'));var controller=require(_0x06bb('0x6'));router['get']('/',auth[_0x06bb('0x7')](),controller['index']);router[_0x06bb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x06bb('0x9')]);router[_0x06bb('0x8')](_0x06bb('0xa'),auth[_0x06bb('0x7')](),controller['getSounds']);router[_0x06bb('0xb')]('/',auth[_0x06bb('0x7')](),controller[_0x06bb('0xc')]);router[_0x06bb('0xb')](_0x06bb('0xa'),auth[_0x06bb('0x7')](),controller[_0x06bb('0xd')]);router[_0x06bb('0xe')](_0x06bb('0xf'),auth[_0x06bb('0x7')](),controller[_0x06bb('0x10')]);router[_0x06bb('0x11')](_0x06bb('0xf'),auth[_0x06bb('0x7')](),controller['destroy']);router[_0x06bb('0x11')](_0x06bb('0x12'),auth[_0x06bb('0x7')](),controller[_0x06bb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf9c2=['/:id/sounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show'];(function(_0x39584f,_0x5046c9){var _0x815215=function(_0x3eadbf){while(--_0x3eadbf){_0x39584f['push'](_0x39584f['shift']());}};_0x815215(++_0x5046c9);}(_0xf9c2,0xdb));var _0x2f9c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf9c2[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x2f9c('0x0'));var util=require(_0x2f9c('0x1'));var path=require(_0x2f9c('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f9c('0x3'));var router=express[_0x2f9c('0x4')]();var fs_extra=require(_0x2f9c('0x5'));var auth=require(_0x2f9c('0x6'));var interaction=require(_0x2f9c('0x7'));var config=require(_0x2f9c('0x8'));var controller=require(_0x2f9c('0x9'));router[_0x2f9c('0xa')]('/',auth[_0x2f9c('0xb')](),controller[_0x2f9c('0xc')]);router['get'](_0x2f9c('0xd'),auth[_0x2f9c('0xb')](),controller[_0x2f9c('0xe')]);router[_0x2f9c('0xa')](_0x2f9c('0xf'),auth['isAuthenticated'](),controller['getSounds']);router[_0x2f9c('0x10')]('/',auth['isAuthenticated'](),controller[_0x2f9c('0x11')]);router[_0x2f9c('0x10')](_0x2f9c('0xf'),auth[_0x2f9c('0xb')](),controller[_0x2f9c('0x12')]);router[_0x2f9c('0x13')](_0x2f9c('0xd'),auth[_0x2f9c('0xb')](),controller[_0x2f9c('0x14')]);router[_0x2f9c('0x15')]('/:id',auth[_0x2f9c('0xb')](),controller[_0x2f9c('0x16')]);router[_0x2f9c('0x15')](_0x2f9c('0x17'),auth[_0x2f9c('0xb')](),controller[_0x2f9c('0x18')]);module[_0x2f9c('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 8b60316..baac1af 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 _0xad94=['quietmp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0xb3243c,_0x393f32){var _0x4d71d7=function(_0x50ac51){while(--_0x50ac51){_0xb3243c['push'](_0xb3243c['shift']());}};_0x4d71d7(++_0x393f32);}(_0xad94,0x1dc));var _0x4ad9=function(_0xd086d9,_0x405406){_0xd086d9=_0xd086d9-0x0;var _0x37dce1=_0xad94[_0xd086d9];return _0x37dce1;};'use strict';var Sequelize=require(_0x4ad9('0x0'));module[_0x4ad9('0x1')]={'name':{'type':Sequelize[_0x4ad9('0x2')],'allowNull':![],'unique':_0x4ad9('0x3')},'mode':{'type':Sequelize[_0x4ad9('0x4')](_0x4ad9('0x5'),_0x4ad9('0x6'),_0x4ad9('0x7'),'quietmp3nb',_0x4ad9('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x4ad9('0x6')},'directory':{'type':Sequelize[_0x4ad9('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4ad9('0x9')},'format':{'type':Sequelize[_0x4ad9('0x2')],'allowNull':!![]},'stamp':{'type':_0x4ad9('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f77=['mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','files','mp3nb','quietmp3nb','quietmp3'];(function(_0xbe81f1,_0x9d4fe6){var _0x30bb0e=function(_0x34d2f6){while(--_0x34d2f6){_0xbe81f1['push'](_0xbe81f1['shift']());}};_0x30bb0e(++_0x9d4fe6);}(_0x0f77,0x94));var _0x70f7=function(_0x1cb568,_0x2cba5f){_0x1cb568=_0x1cb568-0x0;var _0x191caa=_0x0f77[_0x1cb568];return _0x191caa;};'use strict';var Sequelize=require(_0x70f7('0x0'));module[_0x70f7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x70f7('0x2')},'mode':{'type':Sequelize[_0x70f7('0x3')]('custom',_0x70f7('0x4'),_0x70f7('0x5'),_0x70f7('0x6'),_0x70f7('0x7'),_0x70f7('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x70f7('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x70f7('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x70f7('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x70f7('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x70f7('0xb')},'defaultEntry':{'type':Sequelize[_0x70f7('0xc')],'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 a3192aa..7c5ab38 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 _0xe737=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','root','server/files/sounds/converted','format','%s.%s','basename','save_name','converted_format','ValidationError','message','removeSound','id2','createdAt','getSounds','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','MusicOnHolds','UserProfileResource','status','sendStatus','stack','name','send','index','map','VoiceMusicOnHold','type','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','merge','options','find','body','create','sequelize','files','directory','join','server/files/moh','mkdirSync','0777','user'];(function(_0x249d7c,_0x17163a){var _0x20f24b=function(_0x5db7c4){while(--_0x5db7c4){_0x249d7c['push'](_0x249d7c['shift']());}};_0x20f24b(++_0x17163a);}(_0xe737,0x17a));var _0x7e73=function(_0xa8f760,_0x1c5d6a){_0xa8f760=_0xa8f760-0x0;var _0x51bbb5=_0xe737[_0xa8f760];return _0x51bbb5;};'use strict';var emlformat=require(_0x7e73('0x0'));var rimraf=require(_0x7e73('0x1'));var zipdir=require(_0x7e73('0x2'));var jsonpatch=require(_0x7e73('0x3'));var rp=require('request-promise');var moment=require(_0x7e73('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7e73('0x5'));var util=require(_0x7e73('0x6'));var path=require(_0x7e73('0x7'));var sox=require(_0x7e73('0x8'));var csv=require(_0x7e73('0x9'));var ejs=require(_0x7e73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e73('0xb'));var squel=require(_0x7e73('0xc'));var crypto=require(_0x7e73('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e73('0xe'));var toCsv=require(_0x7e73('0x9'));var querystring=require(_0x7e73('0xf'));var Papa=require(_0x7e73('0x10'));var Redis=require('ioredis');var authService=require(_0x7e73('0x11'));var qs=require(_0x7e73('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e73('0x13'))(_0x7e73('0x14'));var utils=require(_0x7e73('0x15'));var config=require(_0x7e73('0x16'));var licenseUtil=require(_0x7e73('0x17'));var db=require(_0x7e73('0x18'))['db'];function respondWithStatusCode(_0x3804db,_0x334476){_0x334476=_0x334476||0xcc;return function(_0xeea5df){if(_0xeea5df){return _0x3804db['sendStatus'](_0x334476);}return _0x3804db['status'](_0x334476)[_0x7e73('0x19')]();};}function respondWithResult(_0x5ae307,_0x5df356){_0x5df356=_0x5df356||0xc8;return function(_0x2aa44b){if(_0x2aa44b){return _0x5ae307['status'](_0x5df356)[_0x7e73('0x1a')](_0x2aa44b);}};}function respondWithFilteredResult(_0x3f99c5,_0x14e71f){return function(_0x232553){if(_0x232553){var _0x160e44=typeof _0x14e71f['offset']===_0x7e73('0x1b')&&typeof _0x14e71f['limit']===_0x7e73('0x1b');var _0x1f03ac=_0x232553[_0x7e73('0x1c')];var _0x4dda63=_0x160e44?0x0:_0x14e71f[_0x7e73('0x1d')];var _0x9012eb=_0x160e44?_0x232553['count']:_0x14e71f[_0x7e73('0x1d')]+_0x14e71f['limit'];var _0xc4d42a;if(_0x9012eb>=_0x1f03ac){_0x9012eb=_0x1f03ac;_0xc4d42a=0xc8;}else{_0xc4d42a=0xce;}_0x3f99c5['status'](_0xc4d42a);return _0x3f99c5[_0x7e73('0x1e')](_0x7e73('0x1f'),_0x4dda63+'-'+_0x9012eb+'/'+_0x1f03ac)[_0x7e73('0x1a')](_0x232553);}return null;};}function patchUpdates(_0x22727b){return function(_0x444fa9){try{jsonpatch[_0x7e73('0x20')](_0x444fa9,_0x22727b,!![]);}catch(_0x105e06){return BPromise['reject'](_0x105e06);}return _0x444fa9[_0x7e73('0x21')]();};}function saveUpdates(_0x1e3c4f,_0x2eba0c){return function(_0x3b1eb2){if(_0x3b1eb2){return _0x3b1eb2[_0x7e73('0x22')](_0x1e3c4f)[_0x7e73('0x23')](function(_0x2f6c12){return _0x2f6c12;});}return null;};}function removeEntity(_0x307265,_0xc599f3){return function(_0x3b3257){if(_0x3b3257){return _0x3b3257[_0x7e73('0x24')]()[_0x7e73('0x23')](function(){var _0x932446=_0x3b3257['get']({'plain':!![]});var _0xeb6377=_0x7e73('0x25');return db[_0x7e73('0x26')][_0x7e73('0x24')]({'where':{'type':_0xeb6377,'resourceId':_0x932446['id']}})['then'](function(){return _0x3b3257;});})[_0x7e73('0x23')](function(){_0x307265[_0x7e73('0x27')](0xcc)[_0x7e73('0x19')]();});}};}function handleEntityNotFound(_0x5224d3,_0x353f33){return function(_0xbe722e){if(!_0xbe722e){_0x5224d3[_0x7e73('0x28')](0x194);}return _0xbe722e;};}function handleError(_0x5b1ce3,_0x1935e7){_0x1935e7=_0x1935e7||0x1f4;return function(_0x281873){logger['error'](_0x281873[_0x7e73('0x29')]);if(_0x281873['name']){delete _0x281873[_0x7e73('0x2a')];}_0x5b1ce3[_0x7e73('0x27')](_0x1935e7)[_0x7e73('0x2b')](_0x281873);};}exports[_0x7e73('0x2c')]=function(_0x29842a,_0x21c4e2){var _0x321c3c={},_0x33df14={},_0x519e39={'count':0x0,'rows':[]};var _0x4e8b17=_[_0x7e73('0x2d')](db[_0x7e73('0x2e')]['rawAttributes'],function(_0x2ad95a){return{'name':_0x2ad95a['fieldName'],'type':_0x2ad95a[_0x7e73('0x2f')][_0x7e73('0x30')]};});_0x33df14[_0x7e73('0x31')]=_[_0x7e73('0x2d')](_0x4e8b17,_0x7e73('0x2a'));_0x33df14['query']=_[_0x7e73('0x32')](_0x29842a[_0x7e73('0x33')]);_0x33df14[_0x7e73('0x34')]=_['intersection'](_0x33df14[_0x7e73('0x31')],_0x33df14[_0x7e73('0x33')]);_0x321c3c[_0x7e73('0x35')]=_[_0x7e73('0x36')](_0x33df14['model'],qs['fields'](_0x29842a['query']['fields']));_0x321c3c[_0x7e73('0x35')]=_0x321c3c[_0x7e73('0x35')][_0x7e73('0x37')]?_0x321c3c[_0x7e73('0x35')]:_0x33df14['model'];if(!_0x29842a['query'][_0x7e73('0x38')](_0x7e73('0x39'))){_0x321c3c[_0x7e73('0x3a')]=qs['limit'](_0x29842a['query'][_0x7e73('0x3a')]);_0x321c3c['offset']=qs[_0x7e73('0x1d')](_0x29842a[_0x7e73('0x33')]['offset']);}_0x321c3c['order']=qs['sort'](_0x29842a[_0x7e73('0x33')][_0x7e73('0x3b')]);delete _0x29842a[_0x7e73('0x33')][_0x7e73('0x3b')];_0x321c3c[_0x7e73('0x3c')]=qs['filters'](_[_0x7e73('0x3d')](_0x29842a['query'],_0x33df14[_0x7e73('0x34')]),_0x4e8b17);if(_0x29842a[_0x7e73('0x33')][_0x7e73('0x3e')]){_0x321c3c[_0x7e73('0x3c')]=_['merge'](_0x321c3c[_0x7e73('0x3c')],{'$or':_['map'](_0x4e8b17,function(_0x2a1e68){if(_0x2a1e68[_0x7e73('0x2f')]!==_0x7e73('0x3f')){var _0x50799a={};_0x50799a[_0x2a1e68['name']]={'$like':'%'+_0x29842a[_0x7e73('0x33')][_0x7e73('0x3e')]+'%'};return _0x50799a;}})});}_0x321c3c=_['merge']({},_0x321c3c,_0x29842a['options']);var _0x478bd5={'where':_0x321c3c['where']};return db['VoiceMusicOnHold']['count'](_0x478bd5)[_0x7e73('0x23')](function(_0x25a558){_0x519e39['count']=_0x25a558;if(_0x29842a['query']['includeAll']){_0x321c3c[_0x7e73('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x7e73('0x41')](_0x321c3c);})[_0x7e73('0x23')](function(_0x14126f){_0x519e39[_0x7e73('0x42')]=_0x14126f;return _0x519e39;})[_0x7e73('0x23')](respondWithFilteredResult(_0x21c4e2,_0x321c3c))[_0x7e73('0x43')](handleError(_0x21c4e2,null));};exports[_0x7e73('0x44')]=function(_0x55554e,_0xdfd448){var _0x40fb38={'raw':![],'where':{'id':_0x55554e[_0x7e73('0x45')]['id']}},_0x3675e0={};_0x3675e0['model']=_[_0x7e73('0x32')](db['VoiceMusicOnHold'][_0x7e73('0x46')]);_0x3675e0[_0x7e73('0x33')]=_[_0x7e73('0x32')](_0x55554e[_0x7e73('0x33')]);_0x3675e0['filters']=_['intersection'](_0x3675e0[_0x7e73('0x31')],_0x3675e0[_0x7e73('0x33')]);_0x40fb38[_0x7e73('0x35')]=_[_0x7e73('0x36')](_0x3675e0[_0x7e73('0x31')],qs[_0x7e73('0x47')](_0x55554e[_0x7e73('0x33')][_0x7e73('0x47')]));_0x40fb38[_0x7e73('0x35')]=_0x40fb38[_0x7e73('0x35')]['length']?_0x40fb38[_0x7e73('0x35')]:_0x3675e0[_0x7e73('0x31')];if(_0x55554e[_0x7e73('0x33')][_0x7e73('0x48')]){_0x40fb38[_0x7e73('0x40')]=[{'all':!![]}];}_0x40fb38=_[_0x7e73('0x49')]({},_0x40fb38,_0x55554e[_0x7e73('0x4a')]);return db['VoiceMusicOnHold'][_0x7e73('0x4b')](_0x40fb38)[_0x7e73('0x23')](handleEntityNotFound(_0xdfd448,null))[_0x7e73('0x23')](respondWithResult(_0xdfd448,null))[_0x7e73('0x43')](handleError(_0xdfd448,null));};exports['update']=function(_0x9859f2,_0x2990b2){if(_0x9859f2[_0x7e73('0x4c')]['id']){delete _0x9859f2[_0x7e73('0x4c')]['id'];}return db['VoiceMusicOnHold'][_0x7e73('0x4b')]({'where':{'id':_0x9859f2['params']['id']}})[_0x7e73('0x23')](handleEntityNotFound(_0x2990b2,null))['then'](saveUpdates(_0x9859f2[_0x7e73('0x4c')],null))[_0x7e73('0x23')](respondWithResult(_0x2990b2,null))[_0x7e73('0x43')](handleError(_0x2990b2,null));};exports[_0x7e73('0x4d')]=function(_0x2cabba,_0x4823b6,_0x103a38){return db[_0x7e73('0x4e')]['transaction'](function(_0x5155e4){if(_0x2cabba[_0x7e73('0x4c')]['mode']===_0x7e73('0x4f')){_0x2cabba[_0x7e73('0x4c')][_0x7e73('0x50')]=path[_0x7e73('0x51')](config['root'],_0x7e73('0x52'),_0x2cabba[_0x7e73('0x4c')][_0x7e73('0x2a')]);}return db[_0x7e73('0x2e')]['create'](_0x2cabba[_0x7e73('0x4c')],{'transaction':_0x5155e4})['then'](function(_0x5f1363){if(_0x2cabba[_0x7e73('0x4c')]['mode']===_0x7e73('0x4f')){fs[_0x7e73('0x53')](_0x5f1363[_0x7e73('0x50')],parseInt(_0x7e73('0x54'),0x8));}var _0x394872=_0x2cabba[_0x7e73('0x55')]['get']({'plain':!![]});if(!_0x394872)throw new Error(_0x7e73('0x56'));if(_0x394872[_0x7e73('0x57')]===_0x7e73('0x55')){var _0x554597=_0x5f1363[_0x7e73('0x58')]({'plain':!![]});return db[_0x7e73('0x59')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x394872[_0x7e73('0x5a')]},'raw':!![]})[_0x7e73('0x23')](function(_0x1df1c9){if(_0x1df1c9&&_0x1df1c9[_0x7e73('0x5b')]===0x0){return db[_0x7e73('0x26')]['create']({'name':_0x554597[_0x7e73('0x2a')],'resourceId':_0x554597['id'],'type':_0x1df1c9[_0x7e73('0x2a')],'sectionId':_0x1df1c9['id']},{})[_0x7e73('0x23')](function(){return _0x5f1363;});}else{return _0x5f1363;}})[_0x7e73('0x43')](function(_0x5af90e){logger[_0x7e73('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5af90e);});}return _0x5f1363;});})[_0x7e73('0x23')](respondWithResult(_0x4823b6,0xc9))[_0x7e73('0x43')](handleError(_0x4823b6,null));};exports[_0x7e73('0x24')]=function(_0x29d21d,_0x17e71e,_0x269642){var _0x11534b;return db[_0x7e73('0x2e')][_0x7e73('0x4b')]({'where':{'id':_0x29d21d[_0x7e73('0x45')]['id']}})[_0x7e73('0x23')](function(_0x1794c5){if(_0x1794c5){return db['sequelize'][_0x7e73('0x5d')](function(_0x46e5c6){return _0x1794c5['destroy']({'transaction':_0x46e5c6,'raw':!![]})[_0x7e73('0x23')](function(_0x3d82be){if(_0x3d82be[_0x7e73('0x50')]){fs[_0x7e73('0x5e')](_0x3d82be['directory'])[_0x7e73('0x5f')](function(_0x2d64a6){fs[_0x7e73('0x60')](path[_0x7e73('0x51')](_0x3d82be[_0x7e73('0x50')],_0x2d64a6));});fs[_0x7e73('0x61')](_0x3d82be[_0x7e73('0x50')]);}return _0x3d82be;});})[_0x7e73('0x43')](function(_0x3e25f2){throw new db[(_0x7e73('0x62'))]['ValidationError'](_0x3e25f2['message']);});}})[_0x7e73('0x23')](handleEntityNotFound(_0x17e71e,null))[_0x7e73('0x23')](removeEntity(_0x17e71e,null))[_0x7e73('0x43')](handleError(_0x17e71e,null));};exports[_0x7e73('0x63')]=function(_0x155fb0,_0x46125b,_0xc6dea4){return db['sequelize'][_0x7e73('0x5d')](function(_0x56f1d5){var _0x4fab22;return db[_0x7e73('0x2e')][_0x7e73('0x4b')]({'where':{'id':_0x155fb0[_0x7e73('0x45')]['id']}})[_0x7e73('0x23')](function(_0x3c9691){if(_0x3c9691){_0x4fab22=_0x3c9691;return _0x3c9691[_0x7e73('0x63')](_0x155fb0[_0x7e73('0x4c')]['id'],{'transaction':_0x56f1d5});}})[_0x7e73('0x23')](function(_0x9d1674){if(_0x9d1674){return db[_0x7e73('0x64')][_0x7e73('0x65')]({'where':{'id':_0x155fb0['body']['id']},'attributes':['id','name','save_name','converted_format','createdAt'],'raw':!![]});}})[_0x7e73('0x23')](function(_0x525c3a){if(_0x525c3a){var _0xb05fe=path['join'](config[_0x7e73('0x66')],_0x7e73('0x67'),util[_0x7e73('0x68')](_0x7e73('0x69'),path[_0x7e73('0x6a')](_0x525c3a[_0x7e73('0x6b')],path['extname'](_0x525c3a['save_name'])),_0x525c3a[_0x7e73('0x6c')]));var _0x20b7f6=path[_0x7e73('0x51')](config['root'],_0x7e73('0x52'),_0x4fab22[_0x7e73('0x2a')],util['format'](_0x7e73('0x69'),_0x525c3a[_0x7e73('0x2a')],_0x525c3a[_0x7e73('0x6c')]));fs['symlinkSync'](_0xb05fe,_0x20b7f6);return _0x525c3a;}})['catch'](function(_0x38d485){throw new db[(_0x7e73('0x62'))][(_0x7e73('0x6d'))](_0x38d485[_0x7e73('0x6e')]);});})[_0x7e73('0x23')](handleEntityNotFound(_0x46125b,null))[_0x7e73('0x23')](respondWithResult(_0x46125b,0xc9))['catch'](handleError(_0x46125b,null));};exports['removeSound']=function(_0x1e5cfb,_0x18e4e5,_0x286a9e){return db[_0x7e73('0x4e')][_0x7e73('0x5d')](function(_0x5218ad){var _0x11ae7a;return db[_0x7e73('0x2e')][_0x7e73('0x65')]({'where':{'id':_0x1e5cfb['params']['id']}})[_0x7e73('0x23')](handleEntityNotFound(_0x18e4e5,null))['then'](function(_0x551fef){if(_0x551fef){_0x11ae7a=_0x551fef;return _0x551fef[_0x7e73('0x6f')](_0x1e5cfb[_0x7e73('0x45')][_0x7e73('0x70')]);}})[_0x7e73('0x23')](function(_0x3a404d){if(_0x3a404d){return db['Sound'][_0x7e73('0x65')]({'where':{'id':_0x1e5cfb['params'][_0x7e73('0x70')]},'attributes':['id',_0x7e73('0x2a'),_0x7e73('0x6b'),_0x7e73('0x6c'),_0x7e73('0x71')],'raw':!![]});}})[_0x7e73('0x23')](function(_0x4238b7){if(_0x4238b7){fs['unlinkSync'](path[_0x7e73('0x51')](_0x11ae7a[_0x7e73('0x50')],util[_0x7e73('0x68')](_0x7e73('0x69'),_0x4238b7[_0x7e73('0x2a')],_0x4238b7['converted_format'])));return _0x4238b7;}})[_0x7e73('0x43')](function(_0x278859){throw new db[(_0x7e73('0x62'))]['ValidationError'](_0x278859[_0x7e73('0x6e')]);});})['then'](handleEntityNotFound(_0x18e4e5,null))[_0x7e73('0x23')](respondWithStatusCode(_0x18e4e5,0xcc))[_0x7e73('0x43')](handleError(_0x18e4e5,null));};exports[_0x7e73('0x72')]=function(_0xf76d01,_0x3e1cf9,_0x600d82){var _0x126118={};var _0x252bec={};var _0x3f367c;var _0x1b9300;return db[_0x7e73('0x2e')][_0x7e73('0x65')]({'where':{'id':_0xf76d01[_0x7e73('0x45')]['id']}})[_0x7e73('0x23')](handleEntityNotFound(_0x3e1cf9,null))[_0x7e73('0x23')](function(_0x42de31){if(_0x42de31){_0x3f367c=_0x42de31;_0x252bec[_0x7e73('0x31')]=_[_0x7e73('0x32')](db[_0x7e73('0x64')][_0x7e73('0x46')]);_0x252bec[_0x7e73('0x33')]=_['keys'](_0xf76d01['query']);_0x252bec[_0x7e73('0x34')]=_[_0x7e73('0x36')](_0x252bec[_0x7e73('0x31')],_0x252bec[_0x7e73('0x33')]);_0x126118[_0x7e73('0x35')]=_['intersection'](_0x252bec[_0x7e73('0x31')],qs[_0x7e73('0x47')](_0xf76d01[_0x7e73('0x33')][_0x7e73('0x47')]));_0x126118['attributes']=_0x126118[_0x7e73('0x35')][_0x7e73('0x37')]?_0x126118['attributes']:_0x252bec[_0x7e73('0x31')];_0x126118[_0x7e73('0x73')]=qs[_0x7e73('0x3b')](_0xf76d01[_0x7e73('0x33')][_0x7e73('0x3b')]);_0x126118[_0x7e73('0x3c')]=qs[_0x7e73('0x34')](_[_0x7e73('0x3d')](_0xf76d01[_0x7e73('0x33')],_0x252bec[_0x7e73('0x34')]));if(_0xf76d01[_0x7e73('0x33')]['filter']){_0x126118['where']=_[_0x7e73('0x49')](_0x126118['where'],{'$or':_['map'](_0x126118[_0x7e73('0x35')],function(_0x455f6b){var _0x3696f5={};_0x3696f5[_0x455f6b]={'$like':'%'+_0xf76d01[_0x7e73('0x33')][_0x7e73('0x3e')]+'%'};return _0x3696f5;})});}_0x126118=_[_0x7e73('0x49')]({},_0x126118,_0xf76d01[_0x7e73('0x4a')]);return _0x3f367c[_0x7e73('0x72')](_0x126118);}})[_0x7e73('0x23')](function(_0x5d18b6){if(_0x5d18b6){_0x1b9300=_0x5d18b6[_0x7e73('0x37')];if(!_0xf76d01[_0x7e73('0x33')][_0x7e73('0x38')]('nolimit')){_0x126118[_0x7e73('0x3a')]=qs[_0x7e73('0x3a')](_0xf76d01[_0x7e73('0x33')]['limit']);_0x126118[_0x7e73('0x1d')]=qs[_0x7e73('0x1d')](_0xf76d01['query'][_0x7e73('0x1d')]);}return _0x3f367c[_0x7e73('0x72')](_0x126118);}})[_0x7e73('0x23')](function(_0x3d00c4){if(_0x3d00c4){return _0x3d00c4?{'count':_0x1b9300,'rows':_0x3d00c4}:null;}})[_0x7e73('0x23')](respondWithResult(_0x3e1cf9,null))[_0x7e73('0x43')](handleError(_0x3e1cf9,null));}; \ No newline at end of file +var _0xeb34=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','Sound','findOne','save_name','converted_format','createdAt','format','basename','extname','server/files/moh','%s.%s','symlinkSync','Sequelize','removeSound','id2','getSounds','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','MusicOnHolds','UserProfileResource','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','intersection','find','update','body','params','create','transaction','mode','directory','root','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x5c17c9,_0x2c4432){var _0xaa6779=function(_0x2f39db){while(--_0x2f39db){_0x5c17c9['push'](_0x5c17c9['shift']());}};_0xaa6779(++_0x2c4432);}(_0xeb34,0x1d4));var _0x4eb3=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xeb34[_0x469ac7];return _0x22f3b0;};'use strict';var emlformat=require(_0x4eb3('0x0'));var rimraf=require(_0x4eb3('0x1'));var zipdir=require(_0x4eb3('0x2'));var jsonpatch=require(_0x4eb3('0x3'));var rp=require(_0x4eb3('0x4'));var moment=require(_0x4eb3('0x5'));var BPromise=require(_0x4eb3('0x6'));var Mustache=require(_0x4eb3('0x7'));var util=require(_0x4eb3('0x8'));var path=require(_0x4eb3('0x9'));var sox=require(_0x4eb3('0xa'));var csv=require(_0x4eb3('0xb'));var ejs=require(_0x4eb3('0xc'));var fs=require('fs');var fs_extra=require(_0x4eb3('0xd'));var _=require(_0x4eb3('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4eb3('0xf'));var deskjs=require(_0x4eb3('0x10'));var toCsv=require(_0x4eb3('0xb'));var querystring=require(_0x4eb3('0x11'));var Papa=require(_0x4eb3('0x12'));var Redis=require('ioredis');var authService=require(_0x4eb3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb3('0x14'));var hardwareService=require(_0x4eb3('0x15'));var logger=require(_0x4eb3('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4eb3('0x17'))['db'];function respondWithStatusCode(_0x119c75,_0x4a01c4){_0x4a01c4=_0x4a01c4||0xcc;return function(_0x117cea){if(_0x117cea){return _0x119c75[_0x4eb3('0x18')](_0x4a01c4);}return _0x119c75[_0x4eb3('0x19')](_0x4a01c4)[_0x4eb3('0x1a')]();};}function respondWithResult(_0x5c4a7f,_0xf90ef6){_0xf90ef6=_0xf90ef6||0xc8;return function(_0x20f4ed){if(_0x20f4ed){return _0x5c4a7f['status'](_0xf90ef6)[_0x4eb3('0x1b')](_0x20f4ed);}};}function respondWithFilteredResult(_0xc5653,_0x337a2b){return function(_0x354ad2){if(_0x354ad2){var _0x3a847e=typeof _0x337a2b[_0x4eb3('0x1c')]===_0x4eb3('0x1d')&&typeof _0x337a2b[_0x4eb3('0x1e')]===_0x4eb3('0x1d');var _0x32f27a=_0x354ad2[_0x4eb3('0x1f')];var _0x2f52a1=_0x3a847e?0x0:_0x337a2b[_0x4eb3('0x1c')];var _0xbe8b84=_0x3a847e?_0x354ad2[_0x4eb3('0x1f')]:_0x337a2b[_0x4eb3('0x1c')]+_0x337a2b[_0x4eb3('0x1e')];var _0x50358d;if(_0xbe8b84>=_0x32f27a){_0xbe8b84=_0x32f27a;_0x50358d=0xc8;}else{_0x50358d=0xce;}_0xc5653['status'](_0x50358d);return _0xc5653[_0x4eb3('0x20')](_0x4eb3('0x21'),_0x2f52a1+'-'+_0xbe8b84+'/'+_0x32f27a)[_0x4eb3('0x1b')](_0x354ad2);}return null;};}function patchUpdates(_0x2f4051){return function(_0x2fd9e9){try{jsonpatch['apply'](_0x2fd9e9,_0x2f4051,!![]);}catch(_0x488542){return BPromise['reject'](_0x488542);}return _0x2fd9e9[_0x4eb3('0x22')]();};}function saveUpdates(_0x1e83d8,_0x4df413){return function(_0xd8aded){if(_0xd8aded){return _0xd8aded['update'](_0x1e83d8)[_0x4eb3('0x23')](function(_0xe4b128){return _0xe4b128;});}return null;};}function removeEntity(_0x3bccc4,_0x10e910){return function(_0x356929){if(_0x356929){return _0x356929[_0x4eb3('0x24')]()[_0x4eb3('0x23')](function(){var _0x5809fe=_0x356929[_0x4eb3('0x25')]({'plain':!![]});var _0x4dfe86=_0x4eb3('0x26');return db[_0x4eb3('0x27')][_0x4eb3('0x24')]({'where':{'type':_0x4dfe86,'resourceId':_0x5809fe['id']}})[_0x4eb3('0x23')](function(){return _0x356929;});})['then'](function(){_0x3bccc4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca78f,_0x4d16be){return function(_0x459045){if(!_0x459045){_0x3ca78f[_0x4eb3('0x18')](0x194);}return _0x459045;};}function handleError(_0x13e348,_0x5ceb8e){_0x5ceb8e=_0x5ceb8e||0x1f4;return function(_0x465caf){logger['error'](_0x465caf['stack']);if(_0x465caf['name']){delete _0x465caf[_0x4eb3('0x28')];}_0x13e348[_0x4eb3('0x19')](_0x5ceb8e)['send'](_0x465caf);};}exports[_0x4eb3('0x29')]=function(_0xbebdc9,_0x5d95a6){var _0x1fb5e5={},_0x2a34aa={},_0x45824e={'count':0x0,'rows':[]};var _0x1a90c8=_[_0x4eb3('0x2a')](db['VoiceMusicOnHold'][_0x4eb3('0x2b')],function(_0x3d2407){return{'name':_0x3d2407[_0x4eb3('0x2c')],'type':_0x3d2407[_0x4eb3('0x2d')][_0x4eb3('0x2e')]};});_0x2a34aa[_0x4eb3('0x2f')]=_[_0x4eb3('0x2a')](_0x1a90c8,_0x4eb3('0x28'));_0x2a34aa['query']=_[_0x4eb3('0x30')](_0xbebdc9[_0x4eb3('0x31')]);_0x2a34aa[_0x4eb3('0x32')]=_['intersection'](_0x2a34aa[_0x4eb3('0x2f')],_0x2a34aa[_0x4eb3('0x31')]);_0x1fb5e5[_0x4eb3('0x33')]=_['intersection'](_0x2a34aa[_0x4eb3('0x2f')],qs[_0x4eb3('0x34')](_0xbebdc9['query'][_0x4eb3('0x34')]));_0x1fb5e5[_0x4eb3('0x33')]=_0x1fb5e5[_0x4eb3('0x33')][_0x4eb3('0x35')]?_0x1fb5e5[_0x4eb3('0x33')]:_0x2a34aa[_0x4eb3('0x2f')];if(!_0xbebdc9[_0x4eb3('0x31')][_0x4eb3('0x36')]('nolimit')){_0x1fb5e5[_0x4eb3('0x1e')]=qs[_0x4eb3('0x1e')](_0xbebdc9['query']['limit']);_0x1fb5e5[_0x4eb3('0x1c')]=qs[_0x4eb3('0x1c')](_0xbebdc9['query']['offset']);}_0x1fb5e5['order']=qs['sort'](_0xbebdc9['query'][_0x4eb3('0x37')]);delete _0xbebdc9[_0x4eb3('0x31')][_0x4eb3('0x37')];_0x1fb5e5[_0x4eb3('0x38')]=qs['filters'](_['pick'](_0xbebdc9[_0x4eb3('0x31')],_0x2a34aa[_0x4eb3('0x32')]),_0x1a90c8);if(_0xbebdc9['query'][_0x4eb3('0x39')]){_0x1fb5e5['where']=_[_0x4eb3('0x3a')](_0x1fb5e5['where'],{'$or':_[_0x4eb3('0x2a')](_0x1a90c8,function(_0x10fe3f){if(_0x10fe3f['type']!==_0x4eb3('0x3b')){var _0x363db8={};_0x363db8[_0x10fe3f[_0x4eb3('0x28')]]={'$like':'%'+_0xbebdc9[_0x4eb3('0x31')][_0x4eb3('0x39')]+'%'};return _0x363db8;}})});}_0x1fb5e5=_[_0x4eb3('0x3a')]({},_0x1fb5e5,_0xbebdc9[_0x4eb3('0x3c')]);var _0x428d06={'where':_0x1fb5e5['where']};return db[_0x4eb3('0x3d')][_0x4eb3('0x1f')](_0x428d06)[_0x4eb3('0x23')](function(_0x21ff86){_0x45824e['count']=_0x21ff86;if(_0xbebdc9[_0x4eb3('0x31')][_0x4eb3('0x3e')]){_0x1fb5e5['include']=[{'all':!![]}];}return db[_0x4eb3('0x3d')][_0x4eb3('0x3f')](_0x1fb5e5);})[_0x4eb3('0x23')](function(_0x40c6fa){_0x45824e[_0x4eb3('0x40')]=_0x40c6fa;return _0x45824e;})[_0x4eb3('0x23')](respondWithFilteredResult(_0x5d95a6,_0x1fb5e5))[_0x4eb3('0x41')](handleError(_0x5d95a6,null));};exports['show']=function(_0x3e2e96,_0x5328b5){var _0xbfd8d0={'raw':![],'where':{'id':_0x3e2e96['params']['id']}},_0x14c275={};_0x14c275[_0x4eb3('0x2f')]=_[_0x4eb3('0x30')](db[_0x4eb3('0x3d')][_0x4eb3('0x2b')]);_0x14c275[_0x4eb3('0x31')]=_[_0x4eb3('0x30')](_0x3e2e96['query']);_0x14c275[_0x4eb3('0x32')]=_[_0x4eb3('0x42')](_0x14c275[_0x4eb3('0x2f')],_0x14c275[_0x4eb3('0x31')]);_0xbfd8d0[_0x4eb3('0x33')]=_[_0x4eb3('0x42')](_0x14c275[_0x4eb3('0x2f')],qs[_0x4eb3('0x34')](_0x3e2e96[_0x4eb3('0x31')]['fields']));_0xbfd8d0[_0x4eb3('0x33')]=_0xbfd8d0[_0x4eb3('0x33')]['length']?_0xbfd8d0['attributes']:_0x14c275[_0x4eb3('0x2f')];if(_0x3e2e96[_0x4eb3('0x31')][_0x4eb3('0x3e')]){_0xbfd8d0['include']=[{'all':!![]}];}_0xbfd8d0=_[_0x4eb3('0x3a')]({},_0xbfd8d0,_0x3e2e96['options']);return db[_0x4eb3('0x3d')][_0x4eb3('0x43')](_0xbfd8d0)['then'](handleEntityNotFound(_0x5328b5,null))[_0x4eb3('0x23')](respondWithResult(_0x5328b5,null))[_0x4eb3('0x41')](handleError(_0x5328b5,null));};exports[_0x4eb3('0x44')]=function(_0x218788,_0x29b992){if(_0x218788[_0x4eb3('0x45')]['id']){delete _0x218788['body']['id'];}return db[_0x4eb3('0x3d')][_0x4eb3('0x43')]({'where':{'id':_0x218788[_0x4eb3('0x46')]['id']}})['then'](handleEntityNotFound(_0x29b992,null))['then'](saveUpdates(_0x218788[_0x4eb3('0x45')],null))[_0x4eb3('0x23')](respondWithResult(_0x29b992,null))[_0x4eb3('0x41')](handleError(_0x29b992,null));};exports[_0x4eb3('0x47')]=function(_0x79d15f,_0x49e3ae,_0x49d621){return db['sequelize'][_0x4eb3('0x48')](function(_0x201d83){if(_0x79d15f[_0x4eb3('0x45')][_0x4eb3('0x49')]==='files'){_0x79d15f[_0x4eb3('0x45')][_0x4eb3('0x4a')]=path['join'](config[_0x4eb3('0x4b')],'server/files/moh',_0x79d15f[_0x4eb3('0x45')][_0x4eb3('0x28')]);}return db[_0x4eb3('0x3d')]['create'](_0x79d15f[_0x4eb3('0x45')],{'transaction':_0x201d83})[_0x4eb3('0x23')](function(_0x10c1f3){if(_0x79d15f[_0x4eb3('0x45')][_0x4eb3('0x49')]===_0x4eb3('0x4c')){fs[_0x4eb3('0x4d')](_0x10c1f3['directory'],parseInt(_0x4eb3('0x4e'),0x8));}var _0x17844c=_0x79d15f[_0x4eb3('0x4f')][_0x4eb3('0x25')]({'plain':!![]});if(!_0x17844c)throw new Error(_0x4eb3('0x50'));if(_0x17844c[_0x4eb3('0x51')]==='user'){var _0x2cf6df=_0x10c1f3[_0x4eb3('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x4eb3('0x43')]({'where':{'name':_0x4eb3('0x26'),'userProfileId':_0x17844c[_0x4eb3('0x52')]},'raw':!![]})[_0x4eb3('0x23')](function(_0x492ea2){if(_0x492ea2&&_0x492ea2[_0x4eb3('0x53')]===0x0){return db[_0x4eb3('0x27')][_0x4eb3('0x47')]({'name':_0x2cf6df['name'],'resourceId':_0x2cf6df['id'],'type':_0x492ea2[_0x4eb3('0x28')],'sectionId':_0x492ea2['id']},{})[_0x4eb3('0x23')](function(){return _0x10c1f3;});}else{return _0x10c1f3;}})[_0x4eb3('0x41')](function(_0x470be1){logger['error'](_0x4eb3('0x54'),_0x470be1);});}return _0x10c1f3;});})['then'](respondWithResult(_0x49e3ae,0xc9))['catch'](handleError(_0x49e3ae,null));};exports[_0x4eb3('0x24')]=function(_0x42ea7f,_0x300288,_0x5b49b9){var _0xb1f0e8;return db[_0x4eb3('0x3d')][_0x4eb3('0x43')]({'where':{'id':_0x42ea7f[_0x4eb3('0x46')]['id']}})[_0x4eb3('0x23')](function(_0x11d7e7){if(_0x11d7e7){return db[_0x4eb3('0x55')][_0x4eb3('0x48')](function(_0x2da1e3){return _0x11d7e7['destroy']({'transaction':_0x2da1e3,'raw':!![]})[_0x4eb3('0x23')](function(_0x16c93b){if(_0x16c93b[_0x4eb3('0x4a')]){fs[_0x4eb3('0x56')](_0x16c93b[_0x4eb3('0x4a')])[_0x4eb3('0x57')](function(_0x1fcc22){fs[_0x4eb3('0x58')](path[_0x4eb3('0x59')](_0x16c93b[_0x4eb3('0x4a')],_0x1fcc22));});fs[_0x4eb3('0x5a')](_0x16c93b[_0x4eb3('0x4a')]);}return _0x16c93b;});})[_0x4eb3('0x41')](function(_0x42007f){throw new db['Sequelize']['ValidationError'](_0x42007f[_0x4eb3('0x5b')]);});}})[_0x4eb3('0x23')](handleEntityNotFound(_0x300288,null))['then'](removeEntity(_0x300288,null))[_0x4eb3('0x41')](handleError(_0x300288,null));};exports[_0x4eb3('0x5c')]=function(_0x34e6b9,_0x3aebdc,_0x1f4f37){return db[_0x4eb3('0x55')][_0x4eb3('0x48')](function(_0x3770ad){var _0x4afe0d;return db[_0x4eb3('0x3d')][_0x4eb3('0x43')]({'where':{'id':_0x34e6b9['params']['id']}})[_0x4eb3('0x23')](function(_0x2ceb42){if(_0x2ceb42){_0x4afe0d=_0x2ceb42;return _0x2ceb42[_0x4eb3('0x5c')](_0x34e6b9[_0x4eb3('0x45')]['id'],{'transaction':_0x3770ad});}})[_0x4eb3('0x23')](function(_0x49d6ff){if(_0x49d6ff){return db[_0x4eb3('0x5d')][_0x4eb3('0x5e')]({'where':{'id':_0x34e6b9[_0x4eb3('0x45')]['id']},'attributes':['id',_0x4eb3('0x28'),_0x4eb3('0x5f'),_0x4eb3('0x60'),_0x4eb3('0x61')],'raw':!![]});}})[_0x4eb3('0x23')](function(_0x15a0c8){if(_0x15a0c8){var _0x180956=path[_0x4eb3('0x59')](config[_0x4eb3('0x4b')],'server/files/sounds/converted',util[_0x4eb3('0x62')]('%s.%s',path[_0x4eb3('0x63')](_0x15a0c8[_0x4eb3('0x5f')],path[_0x4eb3('0x64')](_0x15a0c8[_0x4eb3('0x5f')])),_0x15a0c8[_0x4eb3('0x60')]));var _0x5eef0e=path[_0x4eb3('0x59')](config[_0x4eb3('0x4b')],_0x4eb3('0x65'),_0x4afe0d['name'],util[_0x4eb3('0x62')](_0x4eb3('0x66'),_0x15a0c8['name'],_0x15a0c8[_0x4eb3('0x60')]));fs[_0x4eb3('0x67')](_0x180956,_0x5eef0e);return _0x15a0c8;}})[_0x4eb3('0x41')](function(_0x56bd9b){throw new db[(_0x4eb3('0x68'))]['ValidationError'](_0x56bd9b['message']);});})[_0x4eb3('0x23')](handleEntityNotFound(_0x3aebdc,null))[_0x4eb3('0x23')](respondWithResult(_0x3aebdc,0xc9))['catch'](handleError(_0x3aebdc,null));};exports[_0x4eb3('0x69')]=function(_0xa3da3c,_0x5c8189,_0x20458e){return db[_0x4eb3('0x55')][_0x4eb3('0x48')](function(_0x2974b2){var _0x478ba0;return db[_0x4eb3('0x3d')][_0x4eb3('0x5e')]({'where':{'id':_0xa3da3c[_0x4eb3('0x46')]['id']}})[_0x4eb3('0x23')](handleEntityNotFound(_0x5c8189,null))['then'](function(_0x2c9b84){if(_0x2c9b84){_0x478ba0=_0x2c9b84;return _0x2c9b84[_0x4eb3('0x69')](_0xa3da3c[_0x4eb3('0x46')][_0x4eb3('0x6a')]);}})['then'](function(_0x1abb40){if(_0x1abb40){return db[_0x4eb3('0x5d')]['findOne']({'where':{'id':_0xa3da3c[_0x4eb3('0x46')]['id2']},'attributes':['id','name',_0x4eb3('0x5f'),_0x4eb3('0x60'),'createdAt'],'raw':!![]});}})[_0x4eb3('0x23')](function(_0x5471e0){if(_0x5471e0){fs[_0x4eb3('0x58')](path['join'](_0x478ba0['directory'],util[_0x4eb3('0x62')](_0x4eb3('0x66'),_0x5471e0[_0x4eb3('0x28')],_0x5471e0['converted_format'])));return _0x5471e0;}})[_0x4eb3('0x41')](function(_0x529cae){throw new db[(_0x4eb3('0x68'))]['ValidationError'](_0x529cae['message']);});})[_0x4eb3('0x23')](handleEntityNotFound(_0x5c8189,null))[_0x4eb3('0x23')](respondWithStatusCode(_0x5c8189,0xcc))[_0x4eb3('0x41')](handleError(_0x5c8189,null));};exports[_0x4eb3('0x6b')]=function(_0x3398cb,_0x1fedb7,_0xf6ef87){var _0x176533={};var _0x4d79bf={};var _0x2c7425;var _0x20524c;return db[_0x4eb3('0x3d')]['findOne']({'where':{'id':_0x3398cb[_0x4eb3('0x46')]['id']}})[_0x4eb3('0x23')](handleEntityNotFound(_0x1fedb7,null))['then'](function(_0x374f6f){if(_0x374f6f){_0x2c7425=_0x374f6f;_0x4d79bf[_0x4eb3('0x2f')]=_[_0x4eb3('0x30')](db[_0x4eb3('0x5d')][_0x4eb3('0x2b')]);_0x4d79bf[_0x4eb3('0x31')]=_[_0x4eb3('0x30')](_0x3398cb[_0x4eb3('0x31')]);_0x4d79bf['filters']=_[_0x4eb3('0x42')](_0x4d79bf[_0x4eb3('0x2f')],_0x4d79bf[_0x4eb3('0x31')]);_0x176533[_0x4eb3('0x33')]=_[_0x4eb3('0x42')](_0x4d79bf['model'],qs[_0x4eb3('0x34')](_0x3398cb[_0x4eb3('0x31')][_0x4eb3('0x34')]));_0x176533[_0x4eb3('0x33')]=_0x176533[_0x4eb3('0x33')]['length']?_0x176533[_0x4eb3('0x33')]:_0x4d79bf[_0x4eb3('0x2f')];_0x176533[_0x4eb3('0x6c')]=qs[_0x4eb3('0x37')](_0x3398cb[_0x4eb3('0x31')][_0x4eb3('0x37')]);_0x176533[_0x4eb3('0x38')]=qs[_0x4eb3('0x32')](_[_0x4eb3('0x6d')](_0x3398cb[_0x4eb3('0x31')],_0x4d79bf[_0x4eb3('0x32')]));if(_0x3398cb[_0x4eb3('0x31')][_0x4eb3('0x39')]){_0x176533['where']=_[_0x4eb3('0x3a')](_0x176533[_0x4eb3('0x38')],{'$or':_[_0x4eb3('0x2a')](_0x176533['attributes'],function(_0x1b48f5){var _0x2ba980={};_0x2ba980[_0x1b48f5]={'$like':'%'+_0x3398cb['query'][_0x4eb3('0x39')]+'%'};return _0x2ba980;})});}_0x176533=_['merge']({},_0x176533,_0x3398cb['options']);return _0x2c7425[_0x4eb3('0x6b')](_0x176533);}})[_0x4eb3('0x23')](function(_0x46f864){if(_0x46f864){_0x20524c=_0x46f864[_0x4eb3('0x35')];if(!_0x3398cb['query'][_0x4eb3('0x36')]('nolimit')){_0x176533['limit']=qs[_0x4eb3('0x1e')](_0x3398cb['query'][_0x4eb3('0x1e')]);_0x176533[_0x4eb3('0x1c')]=qs[_0x4eb3('0x1c')](_0x3398cb[_0x4eb3('0x31')]['offset']);}return _0x2c7425[_0x4eb3('0x6b')](_0x176533);}})[_0x4eb3('0x23')](function(_0x30cba2){if(_0x30cba2){return _0x30cba2?{'count':_0x20524c,'rows':_0x30cba2}:null;}})[_0x4eb3('0x23')](respondWithResult(_0x1fedb7,null))[_0x4eb3('0x41')](handleError(_0x1fedb7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a02b983..aa60a0b 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 _0xfa8f=['path','rimraf','../../config/environment','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','request-promise'];(function(_0x106cdb,_0x27210f){var _0x119517=function(_0x2b3a05){while(--_0x2b3a05){_0x106cdb['push'](_0x106cdb['shift']());}};_0x119517(++_0x27210f);}(_0xfa8f,0xcd));var _0xffa8=function(_0x3c3408,_0x2c99c1){_0x3c3408=_0x3c3408-0x0;var _0x188f9d=_0xfa8f[_0x3c3408];return _0x188f9d;};'use strict';var _=require(_0xffa8('0x0'));var util=require(_0xffa8('0x1'));var logger=require(_0xffa8('0x2'))('api');var moment=require(_0xffa8('0x3'));var BPromise=require('bluebird');var rp=require(_0xffa8('0x4'));var fs=require('fs');var path=require(_0xffa8('0x5'));var rimraf=require(_0xffa8('0x6'));var config=require(_0xffa8('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x5cfbb2,_0x19bf1e){return _0x5cfbb2['define'](_0xffa8('0x8'),attributes,{'tableName':_0xffa8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a3c=['rimraf','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x32f17c,_0xfa94ad){var _0x27b32e=function(_0x4b3beb){while(--_0x4b3beb){_0x32f17c['push'](_0x32f17c['shift']());}};_0x27b32e(++_0xfa94ad);}(_0x8a3c,0x1e5));var _0xc8a3=function(_0x3a2295,_0x3064c9){_0x3a2295=_0x3a2295-0x0;var _0x569710=_0x8a3c[_0x3a2295];return _0x569710;};'use strict';var _=require(_0xc8a3('0x0'));var util=require(_0xc8a3('0x1'));var logger=require('../../config/logger')(_0xc8a3('0x2'));var moment=require(_0xc8a3('0x3'));var BPromise=require(_0xc8a3('0x4'));var rp=require(_0xc8a3('0x5'));var fs=require('fs');var path=require(_0xc8a3('0x6'));var rimraf=require(_0xc8a3('0x7'));var config=require('../../config/environment');var attributes=require(_0xc8a3('0x8'));module[_0xc8a3('0x9')]=function(_0x4f0dfe,_0x2560fd){return _0x4f0dfe['define'](_0xc8a3('0xa'),attributes,{'tableName':_0xc8a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 3e2db47..558c824 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x4f4df2,_0x13c453){var _0x303e4b=function(_0x15f7dc){while(--_0x15f7dc){_0x4f4df2['push'](_0x4f4df2['shift']());}};_0x303e4b(++_0x13c453);}(_0xedd9,0xfc));var _0x9edd=function(_0x5c5bf5,_0x2b3e1b){_0x5c5bf5=_0x5c5bf5-0x0;var _0x188b4b=_0xedd9[_0x5c5bf5];return _0x188b4b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x35ab34,_0x461237){var _0x445a4d=function(_0x229a3f){while(--_0x229a3f){_0x35ab34['push'](_0x35ab34['shift']());}};_0x445a4d(++_0x461237);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 117c830..154c409 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 _0x83c8=['getAgents','get','getTeams','post','create','addAgents','/:id/teams','addTeams','put','delete','removeAgents','removeTeams','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','describe','/:id','show','/:id/users'];(function(_0x5b4432,_0x171814){var _0x5256ce=function(_0x2623c5){while(--_0x2623c5){_0x5b4432['push'](_0x5b4432['shift']());}};_0x5256ce(++_0x171814);}(_0x83c8,0x8a));var _0x883c=function(_0x1b87fb,_0x3e6870){_0x1b87fb=_0x1b87fb-0x0;var _0xc7de31=_0x83c8[_0x1b87fb];return _0xc7de31;};'use strict';var multer=require(_0x883c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x883c('0x1'));var express=require('express');var router=express[_0x883c('0x2')]();var fs_extra=require(_0x883c('0x3'));var auth=require(_0x883c('0x4'));var interaction=require(_0x883c('0x5'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x883c('0x6')](),controller[_0x883c('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x883c('0x8')]);router['get'](_0x883c('0x9'),auth[_0x883c('0x6')](),controller[_0x883c('0xa')]);router['get'](_0x883c('0xb'),auth[_0x883c('0x6')](),controller[_0x883c('0xc')]);router[_0x883c('0xd')]('/:id/teams',auth[_0x883c('0x6')](),controller[_0x883c('0xe')]);router[_0x883c('0xf')]('/',auth['isAuthenticated'](),controller[_0x883c('0x10')]);router['post'](_0x883c('0xb'),auth[_0x883c('0x6')](),controller[_0x883c('0x11')]);router[_0x883c('0xf')](_0x883c('0x12'),auth['isAuthenticated'](),controller[_0x883c('0x13')]);router[_0x883c('0x14')](_0x883c('0x9'),auth[_0x883c('0x6')](),controller['update']);router[_0x883c('0x15')]('/:id',auth[_0x883c('0x6')](),controller['destroy']);router['delete'](_0x883c('0xb'),auth[_0x883c('0x6')](),controller[_0x883c('0x16')]);router[_0x883c('0x15')](_0x883c('0x12'),auth['isAuthenticated'](),controller[_0x883c('0x17')]);module[_0x883c('0x18')]=router; \ No newline at end of file +var _0x734f=['destroy','removeAgents','delete','removeTeams','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','getAgents','getTeams','post','create','/:id/teams','addTeams','put','update'];(function(_0x2c5780,_0x501a47){var _0x294c50=function(_0x585406){while(--_0x585406){_0x2c5780['push'](_0x2c5780['shift']());}};_0x294c50(++_0x501a47);}(_0x734f,0x71));var _0xf734=function(_0x3da7c2,_0x5c0ec3){_0x3da7c2=_0x3da7c2-0x0;var _0x4eb160=_0x734f[_0x3da7c2];return _0x4eb160;};'use strict';var multer=require(_0xf734('0x0'));var util=require(_0xf734('0x1'));var path=require('path');var timeout=require(_0xf734('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf734('0x3'));var auth=require(_0xf734('0x4'));var interaction=require(_0xf734('0x5'));var config=require(_0xf734('0x6'));var controller=require('./voicePrefix.controller');router[_0xf734('0x7')]('/',auth[_0xf734('0x8')](),controller[_0xf734('0x9')]);router[_0xf734('0x7')](_0xf734('0xa'),auth[_0xf734('0x8')](),controller[_0xf734('0xb')]);router['get'](_0xf734('0xc'),auth[_0xf734('0x8')](),controller['show']);router[_0xf734('0x7')](_0xf734('0xd'),auth[_0xf734('0x8')](),controller[_0xf734('0xe')]);router['get']('/:id/teams',auth[_0xf734('0x8')](),controller[_0xf734('0xf')]);router[_0xf734('0x10')]('/',auth['isAuthenticated'](),controller[_0xf734('0x11')]);router[_0xf734('0x10')](_0xf734('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf734('0x10')](_0xf734('0x12'),auth[_0xf734('0x8')](),controller[_0xf734('0x13')]);router[_0xf734('0x14')](_0xf734('0xc'),auth[_0xf734('0x8')](),controller[_0xf734('0x15')]);router['delete']('/:id',auth[_0xf734('0x8')](),controller[_0xf734('0x16')]);router['delete'](_0xf734('0xd'),auth[_0xf734('0x8')](),controller[_0xf734('0x17')]);router[_0xf734('0x18')]('/:id/teams',auth[_0xf734('0x8')](),controller[_0xf734('0x19')]);module[_0xf734('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7a7a73c..d15e067 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 _0xab0c=['name','STRING'];(function(_0x268032,_0x120e4c){var _0x32c135=function(_0x191ac1){while(--_0x191ac1){_0x268032['push'](_0x268032['shift']());}};_0x32c135(++_0x120e4c);}(_0xab0c,0x13f));var _0xcab0=function(_0x318eec,_0x3c411c){_0x318eec=_0x318eec-0x0;var _0x33c3b3=_0xab0c[_0x318eec];return _0x33c3b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcab0('0x0')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ad501){return'system-'+this['getDataValue'](_0xcab0('0x1'))+'-';}},'description':{'type':Sequelize[_0xcab0('0x0')]},'callerIdAll':{'type':Sequelize[_0xcab0('0x0')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbf32=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x580b22,_0x336edb){var _0x197e5d=function(_0xdef197){while(--_0xdef197){_0x580b22['push'](_0x580b22['shift']());}};_0x197e5d(++_0x336edb);}(_0xbf32,0xd1));var _0x2bf3=function(_0x563ef4,_0x299b8b){_0x563ef4=_0x563ef4-0x0;var _0x45cbb8=_0xbf32[_0x563ef4];return _0x45cbb8;};'use strict';var Sequelize=require(_0x2bf3('0x0'));module[_0x2bf3('0x1')]={'name':{'type':Sequelize[_0x2bf3('0x2')],'allowNull':![],'unique':_0x2bf3('0x3')},'prefix':{'type':Sequelize[_0x2bf3('0x4')],'get':function(_0x5e8b10){return _0x2bf3('0x5')+this[_0x2bf3('0x6')](_0x2bf3('0x3'))+'-';}},'description':{'type':Sequelize[_0x2bf3('0x2')]},'callerIdAll':{'type':Sequelize[_0x2bf3('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2bf3('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index cd80abc..61b1f82 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 _0x4888=['send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name'];(function(_0x23dde4,_0x519bf4){var _0x138ade=function(_0x27b619){while(--_0x27b619){_0x23dde4['push'](_0x23dde4['shift']());}};_0x138ade(++_0x519bf4);}(_0x4888,0x198));var _0x8488=function(_0x34c6a3,_0x3e1a91){_0x34c6a3=_0x34c6a3-0x0;var _0x58fcda=_0x4888[_0x34c6a3];return _0x58fcda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];config[_0x8488('0x17')]=_[_0x8488('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8488('0x19'))(new Redis(config['redis']));require(_0x8488('0x1a'))['register'](socket);function respondWithStatusCode(_0x5161a3,_0x24d0a0){_0x24d0a0=_0x24d0a0||0xcc;return function(_0x3635da){if(_0x3635da){return _0x5161a3[_0x8488('0x1b')](_0x24d0a0);}return _0x5161a3[_0x8488('0x1c')](_0x24d0a0)[_0x8488('0x1d')]();};}function respondWithResult(_0x8d3b3d,_0x165139){_0x165139=_0x165139||0xc8;return function(_0x4e44af){if(_0x4e44af){return _0x8d3b3d[_0x8488('0x1c')](_0x165139)[_0x8488('0x1e')](_0x4e44af);}};}function respondWithFilteredResult(_0x3edfe4,_0x37361d){return function(_0x60ae2f){if(_0x60ae2f){var _0x39775f=typeof _0x37361d[_0x8488('0x1f')]===_0x8488('0x20')&&typeof _0x37361d[_0x8488('0x21')]===_0x8488('0x20');var _0x10bfd6=_0x60ae2f[_0x8488('0x22')];var _0x3dd93e=_0x39775f?0x0:_0x37361d['offset'];var _0x4a1b45=_0x39775f?_0x60ae2f[_0x8488('0x22')]:_0x37361d[_0x8488('0x1f')]+_0x37361d[_0x8488('0x21')];var _0x3c9fc2;if(_0x4a1b45>=_0x10bfd6){_0x4a1b45=_0x10bfd6;_0x3c9fc2=0xc8;}else{_0x3c9fc2=0xce;}_0x3edfe4[_0x8488('0x1c')](_0x3c9fc2);return _0x3edfe4[_0x8488('0x23')](_0x8488('0x24'),_0x3dd93e+'-'+_0x4a1b45+'/'+_0x10bfd6)[_0x8488('0x1e')](_0x60ae2f);}return null;};}function patchUpdates(_0x39dd43){return function(_0x5123d0){try{jsonpatch[_0x8488('0x25')](_0x5123d0,_0x39dd43,!![]);}catch(_0x4e07e1){return BPromise[_0x8488('0x26')](_0x4e07e1);}return _0x5123d0[_0x8488('0x27')]();};}function saveUpdates(_0x290b33,_0x54ecda){return function(_0x577234){if(_0x577234){return _0x577234['update'](_0x290b33)['then'](function(_0x472624){return _0x472624;});}return null;};}function removeEntity(_0x51fe30,_0x58057a){return function(_0x26bdbb){if(_0x26bdbb){return _0x26bdbb[_0x8488('0x28')]()[_0x8488('0x29')](function(){var _0x6ebee0=_0x26bdbb[_0x8488('0x2a')]({'plain':!![]});var _0x503b83=_0x8488('0x2b');return db[_0x8488('0x2c')][_0x8488('0x28')]({'where':{'type':_0x503b83,'resourceId':_0x6ebee0['id']}})[_0x8488('0x29')](function(){return _0x26bdbb;});})[_0x8488('0x29')](function(){_0x51fe30[_0x8488('0x1c')](0xcc)[_0x8488('0x1d')]();});}};}function handleEntityNotFound(_0x296b6c,_0x368f9c){return function(_0x1d9317){if(!_0x1d9317){_0x296b6c[_0x8488('0x1b')](0x194);}return _0x1d9317;};}function handleError(_0x58d0cc,_0x57ce3c){_0x57ce3c=_0x57ce3c||0x1f4;return function(_0x4e3fe2){logger[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);if(_0x4e3fe2[_0x8488('0x2f')]){delete _0x4e3fe2[_0x8488('0x2f')];}_0x58d0cc[_0x8488('0x1c')](_0x57ce3c)[_0x8488('0x30')](_0x4e3fe2);};}exports['index']=function(_0x2292e0,_0x14f378){var _0x208753={},_0x3649f7={},_0x18eb27={'count':0x0,'rows':[]};var _0x501981=_[_0x8488('0x31')](db[_0x8488('0x32')]['rawAttributes'],function(_0x1b0637){return{'name':_0x1b0637[_0x8488('0x33')],'type':_0x1b0637[_0x8488('0x34')][_0x8488('0x35')]};});_0x3649f7[_0x8488('0x36')]=_['map'](_0x501981,_0x8488('0x2f'));_0x3649f7[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2292e0['query']);_0x3649f7[_0x8488('0x39')]=_['intersection'](_0x3649f7[_0x8488('0x36')],_0x3649f7[_0x8488('0x37')]);_0x208753[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x3649f7['model'],qs[_0x8488('0x3c')](_0x2292e0[_0x8488('0x37')][_0x8488('0x3c')]));_0x208753['attributes']=_0x208753[_0x8488('0x3a')][_0x8488('0x3d')]?_0x208753[_0x8488('0x3a')]:_0x3649f7[_0x8488('0x36')];if(!_0x2292e0[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x208753[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2292e0[_0x8488('0x37')][_0x8488('0x21')]);_0x208753['offset']=qs['offset'](_0x2292e0[_0x8488('0x37')][_0x8488('0x1f')]);}_0x208753[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2292e0[_0x8488('0x37')][_0x8488('0x41')]);_0x208753[_0x8488('0x42')]=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x2292e0['query'],_0x3649f7[_0x8488('0x39')]),_0x501981);if(_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]){_0x208753['where']=_[_0x8488('0x45')](_0x208753[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x501981,function(_0x28bc84){if(_0x28bc84[_0x8488('0x34')]!==_0x8488('0x46')){var _0x1aac4b={};_0x1aac4b[_0x28bc84['name']]={'$like':'%'+_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x1aac4b;}})});}_0x208753=_[_0x8488('0x45')]({},_0x208753,_0x2292e0['options']);var _0x3649ae={'where':_0x208753['where']};return db[_0x8488('0x32')][_0x8488('0x22')](_0x3649ae)['then'](function(_0x22a3f3){_0x18eb27[_0x8488('0x22')]=_0x22a3f3;if(_0x2292e0[_0x8488('0x37')][_0x8488('0x47')]){_0x208753[_0x8488('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8488('0x49')](_0x208753);})['then'](function(_0x3440ae){_0x18eb27[_0x8488('0x4a')]=_0x3440ae;return _0x18eb27;})[_0x8488('0x29')](respondWithFilteredResult(_0x14f378,_0x208753))[_0x8488('0x4b')](handleError(_0x14f378,null));};exports[_0x8488('0x4c')]=function(_0x3dd1cb,_0x1ae9af){var _0x192617={'raw':![],'where':{'id':_0x3dd1cb[_0x8488('0x4d')]['id']}},_0xfe2e8f={};_0xfe2e8f[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x32')][_0x8488('0x4e')]);_0xfe2e8f[_0x8488('0x37')]=_[_0x8488('0x38')](_0x3dd1cb[_0x8488('0x37')]);_0xfe2e8f['filters']=_[_0x8488('0x3b')](_0xfe2e8f[_0x8488('0x36')],_0xfe2e8f[_0x8488('0x37')]);_0x192617[_0x8488('0x3a')]=_['intersection'](_0xfe2e8f[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x3dd1cb[_0x8488('0x37')][_0x8488('0x3c')]));_0x192617['attributes']=_0x192617[_0x8488('0x3a')][_0x8488('0x3d')]?_0x192617[_0x8488('0x3a')]:_0xfe2e8f[_0x8488('0x36')];if(_0x3dd1cb[_0x8488('0x37')][_0x8488('0x47')]){_0x192617[_0x8488('0x48')]=[{'all':!![]}];}_0x192617=_[_0x8488('0x45')]({},_0x192617,_0x3dd1cb[_0x8488('0x4f')]);return db[_0x8488('0x32')][_0x8488('0x50')](_0x192617)[_0x8488('0x29')](handleEntityNotFound(_0x1ae9af,null))[_0x8488('0x29')](respondWithResult(_0x1ae9af,null))['catch'](handleError(_0x1ae9af,null));};exports['destroy']=function(_0x8267e1,_0x1a66ff){return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x8267e1[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x1a66ff,null))[_0x8488('0x29')](removeEntity(_0x1a66ff,null))[_0x8488('0x4b')](handleError(_0x1a66ff,null));};exports[_0x8488('0x51')]=function(_0x481975,_0x474a0b){return db[_0x8488('0x32')]['describe']()[_0x8488('0x29')](respondWithResult(_0x474a0b,null))[_0x8488('0x4b')](handleError(_0x474a0b,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){var _0x198328;return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x5c55bf){return db[_0x8488('0x32')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x55')],{'transaction':_0x5c55bf})[_0x8488('0x29')](function(_0x48caa1){_0x198328=_0x48caa1[_0x8488('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x198328[_0x8488('0x56')]},'raw':!![]})['then'](function(_0x3453c7){return createVoicePrefixExtensions(_0x198328,_0x3453c7,_0x5c55bf);});});})[_0x8488('0x29')](function(){var _0x417afa=_0x1ff9c5[_0x8488('0x57')][_0x8488('0x2a')]({'plain':!![]});if(!_0x417afa)throw new Error(_0x8488('0x58'));if(_0x417afa['role']===_0x8488('0x57')){var _0x693741=_0x198328;return db[_0x8488('0x59')][_0x8488('0x50')]({'where':{'name':_0x8488('0x2b'),'userProfileId':_0x417afa['userProfileId']},'raw':!![]})[_0x8488('0x29')](function(_0x5a04d7){if(_0x5a04d7&&_0x5a04d7[_0x8488('0x5a')]===0x0){return db[_0x8488('0x2c')]['create']({'name':_0x693741[_0x8488('0x2f')],'resourceId':_0x693741['id'],'type':_0x5a04d7[_0x8488('0x2f')],'sectionId':_0x5a04d7['id']},{})[_0x8488('0x29')](function(){return _0x198328;});}else{return _0x198328;}})[_0x8488('0x4b')](function(_0x4041e5){logger[_0x8488('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4041e5);throw _0x4041e5;});}return _0x198328;})[_0x8488('0x29')](respondWithResult(_0x4f80fb,null))['catch'](handleError(_0x4f80fb,null));};function Extension(_0x31dcc6,_0x3fa6e2,_0x3c06a4,_0x3fa288){this[_0x8488('0x5b')]=_0x8488('0x5c');this['exten']=_0x31dcc6;this[_0x8488('0x5d')]=_0x3c06a4;this['type']=_0x8488('0x5e');this[_0x8488('0x5f')]=_0x8488('0x60');this[_0x8488('0x61')]=_0x3fa6e2;this[_0x8488('0x62')]=_0x3fa288;}function createVoicePrefixExtensions(_0x24ba2d,_0x4facfb,_0x5755af){return new BPromise(function(_0x5c8310,_0x28ddb0){var _0x1988cf=new Extension(formatPrefixName(_0x24ba2d[_0x8488('0x63')]),0x1,_0x8488('0x64'),_0x8488('0x65'));_0x1988cf[_0x8488('0x66')]=_0x24ba2d['id'];return db[_0x8488('0x67')][_0x8488('0x52')](_0x1988cf,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0xa90a65){var _0x57fdbb=_0xa90a65[_0x8488('0x2a')]({'plain':!![]});var _0x174c57=_[_0x8488('0x31')](addVoicePrefixExtensions(_0x24ba2d,_0x4facfb),function(_0x4ba14e){_0x4ba14e['VoiceExtensionId']=_0x57fdbb['id'];_0x4ba14e[_0x8488('0x66')]=_0x24ba2d['id'];return _0x4ba14e;});return db[_0x8488('0x67')][_0x8488('0x68')](_0x174c57,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0x52bc90){if(!_0x52bc90){return _0x28ddb0('Extensions\x20creation\x20failed');}else{return _0x5c8310(_0x52bc90);}})[_0x8488('0x4b')](function(_0x26e0cc){return _0x28ddb0(_0x26e0cc);});});;});};function addVoicePrefixExtensions(_0x50897,_0x4856fc){var _0x3c3e89=[];var _0x401f4d=formatPrefixName(_0x50897[_0x8488('0x63')]);_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x2,_0x8488('0x6a'),'CDR(prefix)='+_0x50897[_0x8488('0x2f')]));if(_0x50897[_0x8488('0x6b')]){_0x3c3e89['push'](new Extension(_0x401f4d,0x3,_0x8488('0x6a'),_0x8488('0x6c')+_0x50897['callerIdAll']));}else{_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x3,_0x8488('0x64'),_0x8488('0x6d')));}_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x4,_0x8488('0x6e'),_0x4856fc[_0x8488('0x5b')]+','+_0x8488('0x6f')+(0x8+_0x50897['name'][_0x8488('0x3d')])+'}'+','+0x1));return _0x3c3e89;}function formatPrefixName(_0x3b7aa8){var _0x480666='_';for(var _0x49ef10=0x0;_0x49ef10<_0x3b7aa8[_0x8488('0x3d')];_0x49ef10++){if(_0x3b7aa8[_0x8488('0x70')](_0x49ef10)=='-'){_0x480666+=_0x3b7aa8[_0x8488('0x70')](_0x49ef10);}else{_0x480666+='['+_0x3b7aa8['charAt'](_0x49ef10)+']';}}_0x480666+='.';return _0x480666;}exports[_0x8488('0x71')]=function(_0x852e08,_0x56b35a,_0x42b5c5){var _0x59da4a=_0x852e08[_0x8488('0x55')];_0x59da4a[_0x8488('0x63')]=_0x8488('0x72')+_0x59da4a['name']+'-';return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x57955d){return db['VoicePrefix'][_0x8488('0x71')](_0x59da4a,{'where':{'id':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x28')]({'where':{'VoicePrefixId':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x50')]({'where':{'id':_0x59da4a[_0x8488('0x56')]},'raw':!![]})[_0x8488('0x29')](function(_0x1ff111){return createVoicePrefixExtensions(_0x59da4a,_0x1ff111,_0x57955d);});});});})['then'](function(){return db[_0x8488('0x32')]['findById'](_0x59da4a['id']);})[_0x8488('0x29')](respondWithResult(_0x56b35a,null))[_0x8488('0x4b')](handleError(_0x56b35a,null));};exports[_0x8488('0x73')]=function(_0x3349e3,_0x54283a,_0x1b96c5){return db[_0x8488('0x32')]['find']({'where':{'id':_0x3349e3[_0x8488('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54283a,null))[_0x8488('0x29')](function(_0x15b919){if(_0x15b919){return _0x15b919[_0x8488('0x73')](_0x3349e3[_0x8488('0x55')][_0x8488('0x74')],_[_0x8488('0x75')](_0x3349e3[_0x8488('0x55')],[_0x8488('0x74'),'id'])||{})['spread'](function(_0x1ce726){for(var _0x53d87e=0x0;_0x53d87e<_0x3349e3['body'][_0x8488('0x74')][_0x8488('0x3d')];_0x53d87e+=0x1){socket[_0x8488('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x3349e3['body'][_0x8488('0x74')][_0x53d87e]),'VoicePrefixId':Number(_0x3349e3[_0x8488('0x4d')]['id'])});}return _0x1ce726;});}})['then'](respondWithResult(_0x54283a,null))[_0x8488('0x4b')](handleError(_0x54283a,null));};exports[_0x8488('0x77')]=function(_0x924138,_0x173d35,_0x2a3acf){return db[_0x8488('0x32')]['find']({'where':{'id':_0x924138[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x173d35,null))[_0x8488('0x29')](function(_0x4a2fd9){if(_0x4a2fd9){return _0x4a2fd9[_0x8488('0x77')](_0x924138[_0x8488('0x37')][_0x8488('0x74')])['then'](function(){if(_[_0x8488('0x78')](_0x924138[_0x8488('0x37')]['ids'])){for(var _0x48860c=0x0;_0x48860c<_0x924138[_0x8488('0x37')][_0x8488('0x74')]['length'];_0x48860c+=0x1){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':Number(_0x924138['query']['ids'][_0x48860c]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}}else{socket['emit'](_0x8488('0x79'),{'UserId':Number(_0x924138[_0x8488('0x37')][_0x8488('0x74')]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173d35,null))[_0x8488('0x4b')](handleError(_0x173d35,null));};exports['getAgents']=function(_0x2b2989,_0x4d0d20,_0x2f137a){var _0x1a3a2d={};var _0x267401={};var _0x1e635a;var _0x31ab35;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x2b2989[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x4d0d20,null))[_0x8488('0x29')](function(_0xce1d1a){if(_0xce1d1a){_0x1e635a=_0xce1d1a;_0x267401[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x7b')]['rawAttributes']);_0x267401[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2b2989['query']);_0x267401[_0x8488('0x39')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],_0x267401[_0x8488('0x37')]);_0x1a3a2d[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x2b2989[_0x8488('0x37')][_0x8488('0x3c')]));_0x1a3a2d[_0x8488('0x3a')]=_0x1a3a2d['attributes'][_0x8488('0x3d')]?_0x1a3a2d[_0x8488('0x3a')]:_0x267401['model'];_0x1a3a2d[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2b2989[_0x8488('0x37')][_0x8488('0x41')]);_0x1a3a2d[_0x8488('0x42')]=qs['filters'](_['pick'](_0x2b2989[_0x8488('0x37')],_0x267401[_0x8488('0x39')]));if(_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]){_0x1a3a2d[_0x8488('0x42')]=_[_0x8488('0x45')](_0x1a3a2d[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x1a3a2d[_0x8488('0x3a')],function(_0x167437){var _0x3152d0={};_0x3152d0[_0x167437]={'$like':'%'+_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x3152d0;})});}_0x1a3a2d=_[_0x8488('0x45')]({},_0x1a3a2d,_0x2b2989[_0x8488('0x4f')]);return _0x1e635a['getAgents'](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x5d5234){if(_0x5d5234){_0x31ab35=_0x5d5234['length'];if(!_0x2b2989[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x1a3a2d[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2b2989[_0x8488('0x37')][_0x8488('0x21')]);_0x1a3a2d[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x2b2989[_0x8488('0x37')]['offset']);}return _0x1e635a[_0x8488('0x7c')](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x179637){if(_0x179637){return _0x179637?{'count':_0x31ab35,'rows':_0x179637}:null;}})[_0x8488('0x29')](respondWithResult(_0x4d0d20,null))[_0x8488('0x4b')](handleError(_0x4d0d20,null));};exports[_0x8488('0x7d')]=function(_0x47f7c5,_0x2d7a33,_0x5b0d69){var _0x36f6e4={};var _0x3936b6={};var _0x4be018;var _0x57a4e7;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x47f7c5[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x2d7a33,null))[_0x8488('0x29')](function(_0x5718a7){if(_0x5718a7){_0x4be018=_0x5718a7;_0x3936b6[_0x8488('0x36')]=_[_0x8488('0x38')](db['Team']['rawAttributes']);_0x3936b6[_0x8488('0x37')]=_[_0x8488('0x38')](_0x47f7c5[_0x8488('0x37')]);_0x3936b6['filters']=_['intersection'](_0x3936b6[_0x8488('0x36')],_0x3936b6[_0x8488('0x37')]);_0x36f6e4[_0x8488('0x3a')]=_['intersection'](_0x3936b6[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x3c')]));_0x36f6e4[_0x8488('0x3a')]=_0x36f6e4[_0x8488('0x3a')][_0x8488('0x3d')]?_0x36f6e4[_0x8488('0x3a')]:_0x3936b6[_0x8488('0x36')];_0x36f6e4[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x41')]);_0x36f6e4['where']=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x47f7c5[_0x8488('0x37')],_0x3936b6['filters']));if(_0x47f7c5[_0x8488('0x37')]['filter']){_0x36f6e4[_0x8488('0x42')]=_['merge'](_0x36f6e4['where'],{'$or':_[_0x8488('0x31')](_0x36f6e4['attributes'],function(_0x42f36b){var _0x186e19={};_0x186e19[_0x42f36b]={'$like':'%'+_0x47f7c5[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x186e19;})});}_0x36f6e4=_['merge']({},_0x36f6e4,_0x47f7c5[_0x8488('0x4f')]);return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})[_0x8488('0x29')](function(_0x37ca73){if(_0x37ca73){_0x57a4e7=_0x37ca73['length'];if(!_0x47f7c5[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x36f6e4[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x47f7c5['query']['limit']);_0x36f6e4[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x1f')]);}return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})['then'](function(_0x4806f8){if(_0x4806f8){return _0x4806f8?{'count':_0x57a4e7,'rows':_0x4806f8}:null;}})['then'](respondWithResult(_0x2d7a33,null))[_0x8488('0x4b')](handleError(_0x2d7a33,null));};exports[_0x8488('0x7e')]=function(_0x2bab71,_0x5dacab,_0x30aab3){var _0x6c2e31=_0x2bab71['body'][_0x8488('0x74')];var _0x20cdc8;return db[_0x8488('0x7f')][_0x8488('0x49')]({'where':{'id':_0x6c2e31},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id',_0x8488('0x2f'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83')],'raw':!![]}]})[_0x8488('0x29')](function(_0x13add2){if(_0x13add2){_0x20cdc8=_0x13add2;var _0xa0c692=_['flatMap'](_0x13add2,function(_0x8fc636){var _0x17c6e1=_0x8fc636['get']({'plain':!![]});return _0x17c6e1['Agents'];});return db['VoicePrefix'][_0x8488('0x50')]({'where':{'id':_0x2bab71[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](function(_0x4ba801){return db[_0x8488('0x53')]['transaction'](function(_0x447535){return _0x4ba801[_0x8488('0x7e')](_0x6c2e31,{'transaction':_0x447535})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0x20cdc8,function(_0x1e45ac){return db['TeamVoicePrefix'][_0x8488('0x85')]({'TeamId':_0x1e45ac['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},{'transaction':_0x447535});});})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0xa0c692,function(_0x584f02){return db['UserVoicePrefix'][_0x8488('0x86')]({'where':{'UserId':_0x584f02['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},'transaction':_0x447535});});})[_0x8488('0x29')](function(){_0xa0c692[_0x8488('0x87')](function(_0x2f8191){socket[_0x8488('0x76')](_0x8488('0x88'),{'UserId':_0x2f8191['id'],'VoicePrefixId':_0x4ba801['id']});});});});});}})[_0x8488('0x29')](respondWithStatusCode(_0x5dacab,null))[_0x8488('0x4b')](handleError(_0x5dacab,null));};exports[_0x8488('0x89')]=function(_0x1f5a8b,_0x1e7617,_0x315136){return db[_0x8488('0x7f')]['findAll']({'where':{'id':_0x1f5a8b['query'][_0x8488('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x29')](handleEntityNotFound(_0x1e7617,null))[_0x8488('0x29')](function(_0x22f2de){var _0x280c77=_[_0x8488('0x31')](_0x22f2de,'id');var _0x2a822b=[];var _0x4d611a=[];var _0x46195e=squel[_0x8488('0x8a')]();_0x46195e[_0x8488('0x8b')]('tq.TeamId')[_0x8488('0x8c')](_0x8488('0x8d'),'tq')[_0x8488('0x8e')](_0x8488('0x8f'),'ut',_0x8488('0x90'))[_0x8488('0x42')](_0x8488('0x91'),_0x1f5a8b[_0x8488('0x4d')]['id']);for(var _0x4a7be5=0x0;_0x4a7be5<_0x22f2de['length'];_0x4a7be5+=0x1){let _0x548a7a=_0x22f2de[_0x4a7be5];for(var _0x215d7e=0x0;_0x215d7e<_0x548a7a[_0x8488('0x80')][_0x8488('0x3d')];_0x215d7e+=0x1){let _0x1865f5=_0x548a7a[_0x8488('0x80')][_0x215d7e];var _0x2966ec=_0x46195e['clone']();_0x2966ec[_0x8488('0x42')]('ut.UserId\x20=\x20?',_0x1865f5['id']);_0x4d611a[_0x8488('0x69')](db[_0x8488('0x53')][_0x8488('0x37')](_0x2966ec[_0x8488('0x92')](),{'type':db[_0x8488('0x53')]['QueryTypes'][_0x8488('0x93')]})[_0x8488('0x29')](function(_0x300294){if(_0x300294[_0x8488('0x3d')]===0x1){return _0x1865f5['id'];}else{var _0x14e4a9=_[_0x8488('0x94')](_[_0x8488('0x31')](_0x300294,'TeamId'),function(_0x36600b){return _['includes'](_0x280c77,_0x36600b);});if(_0x14e4a9){return _0x1865f5['id'];}}}));}}return BPromise['all'](_0x4d611a)[_0x8488('0x29')](function(_0x323343){_0x2a822b=_(_0x2a822b)['union'](_0x323343)[_0x8488('0x95')]()[_0x8488('0x96')]();return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x1f5a8b[_0x8488('0x4d')]['id']}})['then'](function(_0x541b76){return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x3e2f85){return _0x541b76[_0x8488('0x89')](_0x1f5a8b[_0x8488('0x37')]['ids'],{'transaction':_0x3e2f85})['then'](function(){if(!_[_0x8488('0x97')](_0x2a822b)){return _0x541b76[_0x8488('0x77')](_0x2a822b,{'transaction':_0x3e2f85});}})[_0x8488('0x29')](function(){_0x2a822b[_0x8488('0x87')](function(_0x258985){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':_0x258985,'VoicePrefixId':_0x541b76['id']});});});});});});})[_0x8488('0x29')](respondWithStatusCode(_0x1e7617,null))[_0x8488('0x4b')](handleError(_0x1e7617,null));}; \ No newline at end of file +var _0x8e3f=['charAt','update','system-','findById','addAgents','ids','omit','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','getTeams','online','voicePause','interface','flatMap','get','Agents','addTeams','each','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','join','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','includes','all','union','compact','removeTeams','isEmpty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoicePrefix','findAll','catch','includeAll','include','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:'];(function(_0x5ab61c,_0x4e28d3){var _0xe1edb5=function(_0x1fcf4e){while(--_0x1fcf4e){_0x5ab61c['push'](_0x5ab61c['shift']());}};_0xe1edb5(++_0x4e28d3);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];config[_0xf8e3('0x1a')]=_[_0xf8e3('0x1b')](config[_0xf8e3('0x1a')],{'host':_0xf8e3('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8e3('0x1a')]));require(_0xf8e3('0x1d'))[_0xf8e3('0x1e')](socket);function respondWithStatusCode(_0x4af736,_0x44f631){_0x44f631=_0x44f631||0xcc;return function(_0x5136c6){if(_0x5136c6){return _0x4af736[_0xf8e3('0x1f')](_0x44f631);}return _0x4af736[_0xf8e3('0x20')](_0x44f631)[_0xf8e3('0x21')]();};}function respondWithResult(_0x570ee3,_0x529c92){_0x529c92=_0x529c92||0xc8;return function(_0x564f43){if(_0x564f43){return _0x570ee3[_0xf8e3('0x20')](_0x529c92)[_0xf8e3('0x22')](_0x564f43);}};}function respondWithFilteredResult(_0x3b01ac,_0x110a78){return function(_0x11d4cc){if(_0x11d4cc){var _0x7a81c3=typeof _0x110a78[_0xf8e3('0x23')]===_0xf8e3('0x24')&&typeof _0x110a78[_0xf8e3('0x25')]==='undefined';var _0x20cc64=_0x11d4cc[_0xf8e3('0x26')];var _0x24e8d6=_0x7a81c3?0x0:_0x110a78[_0xf8e3('0x23')];var _0x3128ad=_0x7a81c3?_0x11d4cc[_0xf8e3('0x26')]:_0x110a78[_0xf8e3('0x23')]+_0x110a78[_0xf8e3('0x25')];var _0x5b99b1;if(_0x3128ad>=_0x20cc64){_0x3128ad=_0x20cc64;_0x5b99b1=0xc8;}else{_0x5b99b1=0xce;}_0x3b01ac[_0xf8e3('0x20')](_0x5b99b1);return _0x3b01ac[_0xf8e3('0x27')](_0xf8e3('0x28'),_0x24e8d6+'-'+_0x3128ad+'/'+_0x20cc64)[_0xf8e3('0x22')](_0x11d4cc);}return null;};}function patchUpdates(_0x4a1e5f){return function(_0x39df34){try{jsonpatch['apply'](_0x39df34,_0x4a1e5f,!![]);}catch(_0x286059){return BPromise[_0xf8e3('0x29')](_0x286059);}return _0x39df34[_0xf8e3('0x2a')]();};}function saveUpdates(_0x2dc856,_0x1f4b68){return function(_0x3ac384){if(_0x3ac384){return _0x3ac384['update'](_0x2dc856)[_0xf8e3('0x2b')](function(_0x2fc674){return _0x2fc674;});}return null;};}function removeEntity(_0x3373ca,_0x417b42){return function(_0x1f1363){if(_0x1f1363){return _0x1f1363[_0xf8e3('0x2c')]()[_0xf8e3('0x2b')](function(){var _0x157a2d=_0x1f1363['get']({'plain':!![]});var _0x356e0a=_0xf8e3('0x2d');return db[_0xf8e3('0x2e')][_0xf8e3('0x2c')]({'where':{'type':_0x356e0a,'resourceId':_0x157a2d['id']}})[_0xf8e3('0x2b')](function(){return _0x1f1363;});})[_0xf8e3('0x2b')](function(){_0x3373ca[_0xf8e3('0x20')](0xcc)[_0xf8e3('0x21')]();});}};}function handleEntityNotFound(_0x4f2ae9,_0x21e1c0){return function(_0x243e28){if(!_0x243e28){_0x4f2ae9[_0xf8e3('0x1f')](0x194);}return _0x243e28;};}function handleError(_0x28b2f2,_0x567153){_0x567153=_0x567153||0x1f4;return function(_0x2e507c){logger[_0xf8e3('0x2f')](_0x2e507c[_0xf8e3('0x30')]);if(_0x2e507c[_0xf8e3('0x31')]){delete _0x2e507c[_0xf8e3('0x31')];}_0x28b2f2[_0xf8e3('0x20')](_0x567153)[_0xf8e3('0x32')](_0x2e507c);};}exports[_0xf8e3('0x33')]=function(_0x50ad3f,_0x2c07bf){var _0x527337={},_0x4acd6c={},_0x5d2dd5={'count':0x0,'rows':[]};var _0x5cc1ed=_[_0xf8e3('0x34')](db['VoicePrefix'][_0xf8e3('0x35')],function(_0x41faaa){return{'name':_0x41faaa[_0xf8e3('0x36')],'type':_0x41faaa[_0xf8e3('0x37')]['key']};});_0x4acd6c['model']=_[_0xf8e3('0x34')](_0x5cc1ed,_0xf8e3('0x31'));_0x4acd6c[_0xf8e3('0x38')]=_[_0xf8e3('0x39')](_0x50ad3f[_0xf8e3('0x38')]);_0x4acd6c[_0xf8e3('0x3a')]=_['intersection'](_0x4acd6c[_0xf8e3('0x3b')],_0x4acd6c['query']);_0x527337['attributes']=_[_0xf8e3('0x3c')](_0x4acd6c[_0xf8e3('0x3b')],qs[_0xf8e3('0x3d')](_0x50ad3f[_0xf8e3('0x38')]['fields']));_0x527337['attributes']=_0x527337[_0xf8e3('0x3e')][_0xf8e3('0x3f')]?_0x527337['attributes']:_0x4acd6c[_0xf8e3('0x3b')];if(!_0x50ad3f[_0xf8e3('0x38')][_0xf8e3('0x40')](_0xf8e3('0x41'))){_0x527337['limit']=qs['limit'](_0x50ad3f['query'][_0xf8e3('0x25')]);_0x527337[_0xf8e3('0x23')]=qs[_0xf8e3('0x23')](_0x50ad3f[_0xf8e3('0x38')]['offset']);}_0x527337[_0xf8e3('0x42')]=qs['sort'](_0x50ad3f[_0xf8e3('0x38')][_0xf8e3('0x43')]);_0x527337[_0xf8e3('0x44')]=qs[_0xf8e3('0x3a')](_[_0xf8e3('0x45')](_0x50ad3f[_0xf8e3('0x38')],_0x4acd6c[_0xf8e3('0x3a')]),_0x5cc1ed);if(_0x50ad3f[_0xf8e3('0x38')][_0xf8e3('0x46')]){_0x527337['where']=_[_0xf8e3('0x47')](_0x527337['where'],{'$or':_[_0xf8e3('0x34')](_0x5cc1ed,function(_0x1e8917){if(_0x1e8917[_0xf8e3('0x37')]!==_0xf8e3('0x48')){var _0x64bfc6={};_0x64bfc6[_0x1e8917[_0xf8e3('0x31')]]={'$like':'%'+_0x50ad3f[_0xf8e3('0x38')][_0xf8e3('0x46')]+'%'};return _0x64bfc6;}})});}_0x527337=_['merge']({},_0x527337,_0x50ad3f[_0xf8e3('0x49')]);var _0x108b81={'where':_0x527337[_0xf8e3('0x44')]};return db[_0xf8e3('0x4a')][_0xf8e3('0x26')](_0x108b81)[_0xf8e3('0x2b')](function(_0x792190){_0x5d2dd5[_0xf8e3('0x26')]=_0x792190;if(_0x50ad3f['query']['includeAll']){_0x527337['include']=[{'all':!![]}];}return db[_0xf8e3('0x4a')][_0xf8e3('0x4b')](_0x527337);})['then'](function(_0x181908){_0x5d2dd5['rows']=_0x181908;return _0x5d2dd5;})[_0xf8e3('0x2b')](respondWithFilteredResult(_0x2c07bf,_0x527337))[_0xf8e3('0x4c')](handleError(_0x2c07bf,null));};exports['show']=function(_0x1fb64d,_0x4b0791){var _0x679519={'raw':![],'where':{'id':_0x1fb64d['params']['id']}},_0x6875a6={};_0x6875a6[_0xf8e3('0x3b')]=_[_0xf8e3('0x39')](db[_0xf8e3('0x4a')][_0xf8e3('0x35')]);_0x6875a6['query']=_['keys'](_0x1fb64d['query']);_0x6875a6[_0xf8e3('0x3a')]=_[_0xf8e3('0x3c')](_0x6875a6[_0xf8e3('0x3b')],_0x6875a6['query']);_0x679519[_0xf8e3('0x3e')]=_['intersection'](_0x6875a6[_0xf8e3('0x3b')],qs[_0xf8e3('0x3d')](_0x1fb64d['query']['fields']));_0x679519[_0xf8e3('0x3e')]=_0x679519[_0xf8e3('0x3e')][_0xf8e3('0x3f')]?_0x679519[_0xf8e3('0x3e')]:_0x6875a6[_0xf8e3('0x3b')];if(_0x1fb64d[_0xf8e3('0x38')][_0xf8e3('0x4d')]){_0x679519[_0xf8e3('0x4e')]=[{'all':!![]}];}_0x679519=_[_0xf8e3('0x47')]({},_0x679519,_0x1fb64d[_0xf8e3('0x49')]);return db[_0xf8e3('0x4a')]['find'](_0x679519)[_0xf8e3('0x2b')](handleEntityNotFound(_0x4b0791,null))[_0xf8e3('0x2b')](respondWithResult(_0x4b0791,null))[_0xf8e3('0x4c')](handleError(_0x4b0791,null));};exports[_0xf8e3('0x2c')]=function(_0x385a8f,_0x3256e6){return db['VoicePrefix'][_0xf8e3('0x4f')]({'where':{'id':_0x385a8f[_0xf8e3('0x50')]['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0x3256e6,null))[_0xf8e3('0x2b')](removeEntity(_0x3256e6,null))[_0xf8e3('0x4c')](handleError(_0x3256e6,null));};exports[_0xf8e3('0x51')]=function(_0x5855f2,_0x260f67){return db[_0xf8e3('0x4a')][_0xf8e3('0x51')]()[_0xf8e3('0x2b')](respondWithResult(_0x260f67,null))[_0xf8e3('0x4c')](handleError(_0x260f67,null));};exports[_0xf8e3('0x52')]=function(_0x5990fc,_0x394e45){var _0x1f425f;return db[_0xf8e3('0x53')][_0xf8e3('0x54')](function(_0x452b00){return db['VoicePrefix'][_0xf8e3('0x52')](_0x5990fc[_0xf8e3('0x55')],{'transaction':_0x452b00})[_0xf8e3('0x2b')](function(_0x53c897){_0x1f425f=_0x53c897['get']({'plain':!![]});return db[_0xf8e3('0x56')][_0xf8e3('0x4f')]({'where':{'id':_0x1f425f[_0xf8e3('0x57')]},'raw':!![]})[_0xf8e3('0x2b')](function(_0x58ad2f){return createVoicePrefixExtensions(_0x1f425f,_0x58ad2f,_0x452b00);});});})[_0xf8e3('0x2b')](function(){var _0x16bddb=_0x5990fc['user']['get']({'plain':!![]});if(!_0x16bddb)throw new Error(_0xf8e3('0x58'));if(_0x16bddb[_0xf8e3('0x59')]===_0xf8e3('0x5a')){var _0x505477=_0x1f425f;return db['UserProfileSection']['find']({'where':{'name':_0xf8e3('0x2d'),'userProfileId':_0x16bddb[_0xf8e3('0x5b')]},'raw':!![]})['then'](function(_0x4937fc){if(_0x4937fc&&_0x4937fc['autoAssociation']===0x0){return db[_0xf8e3('0x2e')][_0xf8e3('0x52')]({'name':_0x505477['name'],'resourceId':_0x505477['id'],'type':_0x4937fc[_0xf8e3('0x31')],'sectionId':_0x4937fc['id']},{})[_0xf8e3('0x2b')](function(){return _0x1f425f;});}else{return _0x1f425f;}})[_0xf8e3('0x4c')](function(_0x560f42){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x560f42);throw _0x560f42;});}return _0x1f425f;})['then'](respondWithResult(_0x394e45,null))[_0xf8e3('0x4c')](handleError(_0x394e45,null));};function Extension(_0x3b120a,_0x3ef144,_0x447efe,_0x442349){this[_0xf8e3('0x5c')]=_0xf8e3('0x5d');this[_0xf8e3('0x5e')]=_0x3b120a;this[_0xf8e3('0x5f')]=_0x447efe;this['type']='system';this[_0xf8e3('0x60')]=_0xf8e3('0x61');this[_0xf8e3('0x62')]=_0x3ef144;this['appdata']=_0x442349;}function createVoicePrefixExtensions(_0x234b06,_0x131c0b,_0x4879c7){return new BPromise(function(_0x48bb3f,_0x256cd5){var _0x4763eb=new Extension(formatPrefixName(_0x234b06[_0xf8e3('0x63')]),0x1,_0xf8e3('0x64'),'Voice\x20Prefix');_0x4763eb['VoicePrefixId']=_0x234b06['id'];return db[_0xf8e3('0x56')][_0xf8e3('0x52')](_0x4763eb,{'transaction':_0x4879c7})[_0xf8e3('0x2b')](function(_0x392d99){var _0x4f1ddb=_0x392d99['get']({'plain':!![]});var _0x324ad5=_[_0xf8e3('0x34')](addVoicePrefixExtensions(_0x234b06,_0x131c0b),function(_0x56a07e){_0x56a07e[_0xf8e3('0x57')]=_0x4f1ddb['id'];_0x56a07e[_0xf8e3('0x65')]=_0x234b06['id'];return _0x56a07e;});return db[_0xf8e3('0x56')][_0xf8e3('0x66')](_0x324ad5,{'transaction':_0x4879c7})['then'](function(_0x11ebb2){if(!_0x11ebb2){return _0x256cd5('Extensions\x20creation\x20failed');}else{return _0x48bb3f(_0x11ebb2);}})[_0xf8e3('0x4c')](function(_0x1cad38){return _0x256cd5(_0x1cad38);});});;});};function addVoicePrefixExtensions(_0x5cbdc6,_0x2ec4f6){var _0x31568b=[];var _0x55418c=formatPrefixName(_0x5cbdc6[_0xf8e3('0x63')]);_0x31568b[_0xf8e3('0x67')](new Extension(_0x55418c,0x2,_0xf8e3('0x68'),_0xf8e3('0x69')+_0x5cbdc6['name']));if(_0x5cbdc6[_0xf8e3('0x6a')]){_0x31568b[_0xf8e3('0x67')](new Extension(_0x55418c,0x3,_0xf8e3('0x68'),_0xf8e3('0x6b')+_0x5cbdc6[_0xf8e3('0x6a')]));}else{_0x31568b[_0xf8e3('0x67')](new Extension(_0x55418c,0x3,_0xf8e3('0x64'),_0xf8e3('0x6c')));}_0x31568b[_0xf8e3('0x67')](new Extension(_0x55418c,0x4,_0xf8e3('0x6d'),_0x2ec4f6[_0xf8e3('0x5c')]+','+_0xf8e3('0x6e')+(0x8+_0x5cbdc6['name']['length'])+'}'+','+0x1));return _0x31568b;}function formatPrefixName(_0x2f6cf4){var _0x32eaab='_';for(var _0x5ccdb2=0x0;_0x5ccdb2<_0x2f6cf4[_0xf8e3('0x3f')];_0x5ccdb2++){if(_0x2f6cf4[_0xf8e3('0x6f')](_0x5ccdb2)=='-'){_0x32eaab+=_0x2f6cf4[_0xf8e3('0x6f')](_0x5ccdb2);}else{_0x32eaab+='['+_0x2f6cf4[_0xf8e3('0x6f')](_0x5ccdb2)+']';}}_0x32eaab+='.';return _0x32eaab;}exports[_0xf8e3('0x70')]=function(_0x5804eb,_0x3e501c,_0x1dcd23){var _0x52e996=_0x5804eb[_0xf8e3('0x55')];_0x52e996['prefix']=_0xf8e3('0x71')+_0x52e996['name']+'-';return db[_0xf8e3('0x53')][_0xf8e3('0x54')](function(_0x45361d){return db[_0xf8e3('0x4a')][_0xf8e3('0x70')](_0x52e996,{'where':{'id':_0x52e996['id']},'transaction':_0x45361d})['then'](function(){return db[_0xf8e3('0x56')][_0xf8e3('0x2c')]({'where':{'VoicePrefixId':_0x52e996['id']},'transaction':_0x45361d})[_0xf8e3('0x2b')](function(){return db[_0xf8e3('0x56')][_0xf8e3('0x4f')]({'where':{'id':_0x52e996[_0xf8e3('0x57')]},'raw':!![]})[_0xf8e3('0x2b')](function(_0x2ccd34){return createVoicePrefixExtensions(_0x52e996,_0x2ccd34,_0x45361d);});});});})[_0xf8e3('0x2b')](function(){return db[_0xf8e3('0x4a')][_0xf8e3('0x72')](_0x52e996['id']);})[_0xf8e3('0x2b')](respondWithResult(_0x3e501c,null))['catch'](handleError(_0x3e501c,null));};exports[_0xf8e3('0x73')]=function(_0x280f06,_0x3dc049,_0x4b69db){return db[_0xf8e3('0x4a')][_0xf8e3('0x4f')]({'where':{'id':_0x280f06[_0xf8e3('0x50')]['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0x3dc049,null))[_0xf8e3('0x2b')](function(_0x40174a){if(_0x40174a){return _0x40174a[_0xf8e3('0x73')](_0x280f06[_0xf8e3('0x55')][_0xf8e3('0x74')],_[_0xf8e3('0x75')](_0x280f06[_0xf8e3('0x55')],[_0xf8e3('0x74'),'id'])||{})['spread'](function(_0x118cc6){for(var _0xf7cb3a=0x0;_0xf7cb3a<_0x280f06[_0xf8e3('0x55')][_0xf8e3('0x74')]['length'];_0xf7cb3a+=0x1){socket['emit'](_0xf8e3('0x76'),{'UserId':Number(_0x280f06[_0xf8e3('0x55')]['ids'][_0xf7cb3a]),'VoicePrefixId':Number(_0x280f06['params']['id'])});}return _0x118cc6;});}})[_0xf8e3('0x2b')](respondWithResult(_0x3dc049,null))[_0xf8e3('0x4c')](handleError(_0x3dc049,null));};exports['removeAgents']=function(_0x2a2c6,_0xca5962,_0x16e69a){return db[_0xf8e3('0x4a')][_0xf8e3('0x4f')]({'where':{'id':_0x2a2c6['params']['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0xca5962,null))[_0xf8e3('0x2b')](function(_0x54db4e){if(_0x54db4e){return _0x54db4e['removeAgents'](_0x2a2c6[_0xf8e3('0x38')][_0xf8e3('0x74')])[_0xf8e3('0x2b')](function(){if(_[_0xf8e3('0x77')](_0x2a2c6[_0xf8e3('0x38')][_0xf8e3('0x74')])){for(var _0x3823b9=0x0;_0x3823b9<_0x2a2c6[_0xf8e3('0x38')]['ids'][_0xf8e3('0x3f')];_0x3823b9+=0x1){socket[_0xf8e3('0x78')](_0xf8e3('0x79'),{'UserId':Number(_0x2a2c6[_0xf8e3('0x38')][_0xf8e3('0x74')][_0x3823b9]),'VoicePrefixId':Number(_0x2a2c6[_0xf8e3('0x50')]['id'])});}}else{socket['emit'](_0xf8e3('0x79'),{'UserId':Number(_0x2a2c6[_0xf8e3('0x38')][_0xf8e3('0x74')]),'VoicePrefixId':Number(_0x2a2c6['params']['id'])});}});}})['then'](respondWithStatusCode(_0xca5962,null))[_0xf8e3('0x4c')](handleError(_0xca5962,null));};exports[_0xf8e3('0x7a')]=function(_0x25805c,_0xc01ac,_0x4659ed){var _0x5b8840={};var _0x25bf6c={};var _0x1f5a80;var _0x1bfe33;return db[_0xf8e3('0x4a')][_0xf8e3('0x7b')]({'where':{'id':_0x25805c[_0xf8e3('0x50')]['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0xc01ac,null))[_0xf8e3('0x2b')](function(_0x40b66c){if(_0x40b66c){_0x1f5a80=_0x40b66c;_0x25bf6c['model']=_[_0xf8e3('0x39')](db[_0xf8e3('0x7c')][_0xf8e3('0x35')]);_0x25bf6c[_0xf8e3('0x38')]=_[_0xf8e3('0x39')](_0x25805c[_0xf8e3('0x38')]);_0x25bf6c[_0xf8e3('0x3a')]=_['intersection'](_0x25bf6c['model'],_0x25bf6c[_0xf8e3('0x38')]);_0x5b8840[_0xf8e3('0x3e')]=_['intersection'](_0x25bf6c[_0xf8e3('0x3b')],qs[_0xf8e3('0x3d')](_0x25805c[_0xf8e3('0x38')][_0xf8e3('0x3d')]));_0x5b8840[_0xf8e3('0x3e')]=_0x5b8840[_0xf8e3('0x3e')][_0xf8e3('0x3f')]?_0x5b8840['attributes']:_0x25bf6c[_0xf8e3('0x3b')];_0x5b8840[_0xf8e3('0x42')]=qs[_0xf8e3('0x43')](_0x25805c[_0xf8e3('0x38')][_0xf8e3('0x43')]);_0x5b8840[_0xf8e3('0x44')]=qs[_0xf8e3('0x3a')](_[_0xf8e3('0x45')](_0x25805c[_0xf8e3('0x38')],_0x25bf6c[_0xf8e3('0x3a')]));if(_0x25805c[_0xf8e3('0x38')]['filter']){_0x5b8840['where']=_[_0xf8e3('0x47')](_0x5b8840['where'],{'$or':_[_0xf8e3('0x34')](_0x5b8840['attributes'],function(_0x1a3843){var _0x1b2249={};_0x1b2249[_0x1a3843]={'$like':'%'+_0x25805c[_0xf8e3('0x38')]['filter']+'%'};return _0x1b2249;})});}_0x5b8840=_[_0xf8e3('0x47')]({},_0x5b8840,_0x25805c[_0xf8e3('0x49')]);return _0x1f5a80[_0xf8e3('0x7a')](_0x5b8840);}})[_0xf8e3('0x2b')](function(_0x3619cd){if(_0x3619cd){_0x1bfe33=_0x3619cd['length'];if(!_0x25805c[_0xf8e3('0x38')]['hasOwnProperty'](_0xf8e3('0x41'))){_0x5b8840[_0xf8e3('0x25')]=qs[_0xf8e3('0x25')](_0x25805c[_0xf8e3('0x38')][_0xf8e3('0x25')]);_0x5b8840[_0xf8e3('0x23')]=qs[_0xf8e3('0x23')](_0x25805c['query'][_0xf8e3('0x23')]);}return _0x1f5a80[_0xf8e3('0x7a')](_0x5b8840);}})[_0xf8e3('0x2b')](function(_0x1a9ba6){if(_0x1a9ba6){return _0x1a9ba6?{'count':_0x1bfe33,'rows':_0x1a9ba6}:null;}})['then'](respondWithResult(_0xc01ac,null))[_0xf8e3('0x4c')](handleError(_0xc01ac,null));};exports[_0xf8e3('0x7d')]=function(_0x3f7c0e,_0x2da8fb,_0x22fa2f){var _0x18fbd2={};var _0x477589={};var _0x1bb12c;var _0x4a5ad8;return db['VoicePrefix'][_0xf8e3('0x7b')]({'where':{'id':_0x3f7c0e[_0xf8e3('0x50')]['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0x2da8fb,null))[_0xf8e3('0x2b')](function(_0x131625){if(_0x131625){_0x1bb12c=_0x131625;_0x477589[_0xf8e3('0x3b')]=_[_0xf8e3('0x39')](db['Team'][_0xf8e3('0x35')]);_0x477589['query']=_[_0xf8e3('0x39')](_0x3f7c0e[_0xf8e3('0x38')]);_0x477589[_0xf8e3('0x3a')]=_[_0xf8e3('0x3c')](_0x477589['model'],_0x477589[_0xf8e3('0x38')]);_0x18fbd2['attributes']=_['intersection'](_0x477589[_0xf8e3('0x3b')],qs[_0xf8e3('0x3d')](_0x3f7c0e[_0xf8e3('0x38')][_0xf8e3('0x3d')]));_0x18fbd2['attributes']=_0x18fbd2['attributes'][_0xf8e3('0x3f')]?_0x18fbd2[_0xf8e3('0x3e')]:_0x477589['model'];_0x18fbd2['order']=qs[_0xf8e3('0x43')](_0x3f7c0e[_0xf8e3('0x38')]['sort']);_0x18fbd2[_0xf8e3('0x44')]=qs[_0xf8e3('0x3a')](_[_0xf8e3('0x45')](_0x3f7c0e[_0xf8e3('0x38')],_0x477589[_0xf8e3('0x3a')]));if(_0x3f7c0e[_0xf8e3('0x38')][_0xf8e3('0x46')]){_0x18fbd2['where']=_[_0xf8e3('0x47')](_0x18fbd2[_0xf8e3('0x44')],{'$or':_['map'](_0x18fbd2[_0xf8e3('0x3e')],function(_0x4a8866){var _0x1ca81d={};_0x1ca81d[_0x4a8866]={'$like':'%'+_0x3f7c0e[_0xf8e3('0x38')][_0xf8e3('0x46')]+'%'};return _0x1ca81d;})});}_0x18fbd2=_['merge']({},_0x18fbd2,_0x3f7c0e[_0xf8e3('0x49')]);return _0x1bb12c['getTeams'](_0x18fbd2);}})[_0xf8e3('0x2b')](function(_0x41ca1b){if(_0x41ca1b){_0x4a5ad8=_0x41ca1b[_0xf8e3('0x3f')];if(!_0x3f7c0e[_0xf8e3('0x38')]['hasOwnProperty']('nolimit')){_0x18fbd2[_0xf8e3('0x25')]=qs[_0xf8e3('0x25')](_0x3f7c0e[_0xf8e3('0x38')][_0xf8e3('0x25')]);_0x18fbd2[_0xf8e3('0x23')]=qs[_0xf8e3('0x23')](_0x3f7c0e['query'][_0xf8e3('0x23')]);}return _0x1bb12c[_0xf8e3('0x7d')](_0x18fbd2);}})[_0xf8e3('0x2b')](function(_0x348e59){if(_0x348e59){return _0x348e59?{'count':_0x4a5ad8,'rows':_0x348e59}:null;}})['then'](respondWithResult(_0x2da8fb,null))[_0xf8e3('0x4c')](handleError(_0x2da8fb,null));};exports['addTeams']=function(_0x3b51c7,_0xf88bb2,_0x4b27e3){var _0x108168=_0x3b51c7['body'][_0xf8e3('0x74')];var _0x3fba66;return db['Team'][_0xf8e3('0x4b')]({'where':{'id':_0x108168},'attributes':['id'],'include':[{'model':db[_0xf8e3('0x7c')],'as':'Agents','attributes':['id',_0xf8e3('0x31'),_0xf8e3('0x7e'),_0xf8e3('0x7f'),_0xf8e3('0x80')],'raw':!![]}]})[_0xf8e3('0x2b')](function(_0x3b79e1){if(_0x3b79e1){_0x3fba66=_0x3b79e1;var _0x13f467=_[_0xf8e3('0x81')](_0x3b79e1,function(_0x29c04b){var _0x271ed0=_0x29c04b[_0xf8e3('0x82')]({'plain':!![]});return _0x271ed0[_0xf8e3('0x83')];});return db['VoicePrefix'][_0xf8e3('0x4f')]({'where':{'id':_0x3b51c7[_0xf8e3('0x50')]['id']}})[_0xf8e3('0x2b')](function(_0x48230e){return db[_0xf8e3('0x53')][_0xf8e3('0x54')](function(_0x7e83fd){return _0x48230e[_0xf8e3('0x84')](_0x108168,{'transaction':_0x7e83fd})[_0xf8e3('0x2b')](function(){return BPromise[_0xf8e3('0x85')](_0x3fba66,function(_0x6d4c09){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x6d4c09['id'],'VoicePrefixId':_0x3b51c7[_0xf8e3('0x50')]['id']},{'transaction':_0x7e83fd});});})[_0xf8e3('0x2b')](function(){return BPromise['each'](_0x13f467,function(_0x1a85cf){return db[_0xf8e3('0x86')]['findOrCreate']({'where':{'UserId':_0x1a85cf['id'],'VoicePrefixId':_0x3b51c7[_0xf8e3('0x50')]['id']},'transaction':_0x7e83fd});});})[_0xf8e3('0x2b')](function(){_0x13f467[_0xf8e3('0x87')](function(_0x27d0b6){socket[_0xf8e3('0x78')]('userVoicePrefix:save',{'UserId':_0x27d0b6['id'],'VoicePrefixId':_0x48230e['id']});});});});});}})[_0xf8e3('0x2b')](respondWithStatusCode(_0xf88bb2,null))[_0xf8e3('0x4c')](handleError(_0xf88bb2,null));};exports['removeTeams']=function(_0x4f02bb,_0x237eb6,_0xd9e796){return db[_0xf8e3('0x88')][_0xf8e3('0x4b')]({'where':{'id':_0x4f02bb[_0xf8e3('0x38')][_0xf8e3('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf8e3('0x83'),'attributes':['id'],'raw':!![]}]})[_0xf8e3('0x2b')](handleEntityNotFound(_0x237eb6,null))['then'](function(_0x5ae078){var _0x512d8d=_[_0xf8e3('0x34')](_0x5ae078,'id');var _0x186e42=[];var _0x417af2=[];var _0x29f5d0=squel[_0xf8e3('0x89')]();_0x29f5d0[_0xf8e3('0x8a')](_0xf8e3('0x8b'))['from']('team_has_voice_prefixes','tq')[_0xf8e3('0x8c')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf8e3('0x44')](_0xf8e3('0x8d'),_0x4f02bb['params']['id']);for(var _0x1cff32=0x0;_0x1cff32<_0x5ae078[_0xf8e3('0x3f')];_0x1cff32+=0x1){let _0x876d0c=_0x5ae078[_0x1cff32];for(var _0x2c4060=0x0;_0x2c4060<_0x876d0c[_0xf8e3('0x83')][_0xf8e3('0x3f')];_0x2c4060+=0x1){let _0x1b8e99=_0x876d0c[_0xf8e3('0x83')][_0x2c4060];var _0x107896=_0x29f5d0[_0xf8e3('0x8e')]();_0x107896[_0xf8e3('0x44')](_0xf8e3('0x8f'),_0x1b8e99['id']);_0x417af2[_0xf8e3('0x67')](db[_0xf8e3('0x53')][_0xf8e3('0x38')](_0x107896['toString'](),{'type':db[_0xf8e3('0x53')][_0xf8e3('0x90')]['SELECT']})[_0xf8e3('0x2b')](function(_0x4e8329){if(_0x4e8329['length']===0x1){return _0x1b8e99['id'];}else{var _0x5a66ee=_[_0xf8e3('0x91')](_[_0xf8e3('0x34')](_0x4e8329,'TeamId'),function(_0x207393){return _[_0xf8e3('0x92')](_0x512d8d,_0x207393);});if(_0x5a66ee){return _0x1b8e99['id'];}}}));}}return BPromise[_0xf8e3('0x93')](_0x417af2)['then'](function(_0x3a39a8){_0x186e42=_(_0x186e42)[_0xf8e3('0x94')](_0x3a39a8)[_0xf8e3('0x95')]()['value']();return db[_0xf8e3('0x4a')][_0xf8e3('0x4f')]({'where':{'id':_0x4f02bb[_0xf8e3('0x50')]['id']}})['then'](function(_0x42d800){return db[_0xf8e3('0x53')][_0xf8e3('0x54')](function(_0x13782d){return _0x42d800[_0xf8e3('0x96')](_0x4f02bb[_0xf8e3('0x38')]['ids'],{'transaction':_0x13782d})[_0xf8e3('0x2b')](function(){if(!_[_0xf8e3('0x97')](_0x186e42)){return _0x42d800['removeAgents'](_0x186e42,{'transaction':_0x13782d});}})[_0xf8e3('0x2b')](function(){_0x186e42[_0xf8e3('0x87')](function(_0xcf534f){socket[_0xf8e3('0x78')]('userVoicePrefix:remove',{'UserId':_0xcf534f,'VoicePrefixId':_0x42d800['id']});});});});});});})[_0xf8e3('0x2b')](respondWithStatusCode(_0x237eb6,null))['catch'](handleError(_0x237eb6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 13346a2..6bec3bd 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 _0x2e35=['hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5b17ee,_0x5d343b){var _0x47c53d=function(_0x309ba1){while(--_0x309ba1){_0x5b17ee['push'](_0x5b17ee['shift']());}};_0x47c53d(++_0x5d343b);}(_0x2e35,0x1ba));var _0x52e3=function(_0x6ac30d,_0x190930){_0x6ac30d=_0x6ac30d-0x0;var _0x5a2a7f=_0x2e35[_0x6ac30d];return _0x5a2a7f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x52e3('0x0'))['db'][_0x52e3('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x52e3('0x2')](0x0);var events={'afterCreate':_0x52e3('0x3'),'afterUpdate':_0x52e3('0x4'),'afterDestroy':_0x52e3('0x5')};function emitEvent(_0x1bc633){return function(_0x490220,_0x14c174,_0x2182a0){VoicePrefixEvents[_0x52e3('0x6')](_0x1bc633+':'+_0x490220['id'],_0x490220);VoicePrefixEvents[_0x52e3('0x6')](_0x1bc633,_0x490220);_0x2182a0(null);};}for(var e in events){if(events[_0x52e3('0x7')](e)){var event=events[e];VoicePrefix[_0x52e3('0x8')](e,emitEvent(event));}}module[_0x52e3('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x4560=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update','remove'];(function(_0x3d1fea,_0x2aea3e){var _0x1adb6f=function(_0x178998){while(--_0x178998){_0x3d1fea['push'](_0x3d1fea['shift']());}};_0x1adb6f(++_0x2aea3e);}(_0x4560,0x1d4));var _0x0456=function(_0x320193,_0x56b53d){_0x320193=_0x320193-0x0;var _0x5852b7=_0x4560[_0x320193];return _0x5852b7;};'use strict';var EventEmitter=require(_0x0456('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0456('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0456('0x2'),'afterDestroy':_0x0456('0x3')};function emitEvent(_0x162237){return function(_0x541c63,_0x13d3b1,_0x54ffd6){VoicePrefixEvents[_0x0456('0x4')](_0x162237+':'+_0x541c63['id'],_0x541c63);VoicePrefixEvents[_0x0456('0x4')](_0x162237,_0x541c63);_0x54ffd6(null);};}for(var e in events){if(events[_0x0456('0x5')](e)){var event=events[e];VoicePrefix[_0x0456('0x6')](e,emitEvent(event));}}module[_0x0456('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 98dc0c7..800801a 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 _0x88e1=['moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x133d90,_0x55764d){var _0x45ca2b=function(_0x39ccb7){while(--_0x39ccb7){_0x133d90['push'](_0x133d90['shift']());}};_0x45ca2b(++_0x55764d);}(_0x88e1,0x110));var _0x188e=function(_0xc31458,_0x45ee76){_0xc31458=_0xc31458-0x0;var _0x1b4a90=_0x88e1[_0xc31458];return _0x1b4a90;};'use strict';var _=require(_0x188e('0x0'));var util=require(_0x188e('0x1'));var logger=require(_0x188e('0x2'))(_0x188e('0x3'));var moment=require(_0x188e('0x4'));var BPromise=require(_0x188e('0x5'));var rp=require(_0x188e('0x6'));var fs=require('fs');var path=require(_0x188e('0x7'));var rimraf=require('rimraf');var config=require(_0x188e('0x8'));var attributes=require(_0x188e('0x9'));module['exports']=function(_0x433d2b,_0x3a5a46){return _0x433d2b[_0x188e('0xa')]('VoicePrefix',attributes,{'tableName':_0x188e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e76=['rimraf','./voicePrefix.attributes','define','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x371f77,_0x41739a){var _0x588a44=function(_0x5c7af3){while(--_0x5c7af3){_0x371f77['push'](_0x371f77['shift']());}};_0x588a44(++_0x41739a);}(_0x2e76,0x1a3));var _0x62e7=function(_0x300007,_0x4ae5a4){_0x300007=_0x300007-0x0;var _0x157c7d=_0x2e76[_0x300007];return _0x157c7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62e7('0x0'))(_0x62e7('0x1'));var moment=require(_0x62e7('0x2'));var BPromise=require(_0x62e7('0x3'));var rp=require(_0x62e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62e7('0x5'));var config=require('../../config/environment');var attributes=require(_0x62e7('0x6'));module['exports']=function(_0x2041bc,_0x4d17b2){return _0x2041bc[_0x62e7('0x7')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','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 f61681e..40a87b6 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 _0xbd10=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x5411e8,_0x35b51e){var _0x4344cc=function(_0x3f90dc){while(--_0x3f90dc){_0x5411e8['push'](_0x5411e8['shift']());}};_0x4344cc(++_0x35b51e);}(_0xbd10,0x85));var _0x0bd1=function(_0x3bd5cf,_0x4313eb){_0x3bd5cf=_0x3bd5cf-0x0;var _0x48f8a8=_0xbd10[_0x3bd5cf];return _0x48f8a8;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd1('0x3'));var fs=require('fs');var Redis=require(_0x0bd1('0x4'));var db=require(_0x0bd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bd1('0x6'))(_0x0bd1('0x7'));var config=require(_0x0bd1('0x8'));var jayson=require(_0x0bd1('0x9'));var client=jayson[_0x0bd1('0xa')][_0x0bd1('0xb')]({'port':0x232a});config['redis']=_[_0x0bd1('0xc')](config['redis'],{'host':_0x0bd1('0xd'),'port':0x18eb});var socket=require(_0x0bd1('0xe'))(new Redis(config[_0x0bd1('0xf')]));require(_0x0bd1('0x10'))['register'](socket);function respondWithRpcPromise(_0x22b38f,_0x631d20,_0x6e9f80){return new BPromise(function(_0x32eedd,_0x154b4f){return client[_0x0bd1('0x11')](_0x22b38f,_0x6e9f80)['then'](function(_0x159b15){logger[_0x0bd1('0x12')](_0x0bd1('0x13'),_0x631d20,_0x0bd1('0x14'));logger[_0x0bd1('0x15')](_0x0bd1('0x16'),_0x631d20,'request\x20sent',JSON[_0x0bd1('0x17')](_0x159b15));if(_0x159b15[_0x0bd1('0x18')]){if(_0x159b15[_0x0bd1('0x18')]['code']===0x1f4){logger['error'](_0x0bd1('0x13'),_0x631d20,_0x159b15[_0x0bd1('0x18')][_0x0bd1('0x19')]);return _0x154b4f(_0x159b15['error']['message']);}logger[_0x0bd1('0x18')](_0x0bd1('0x13'),_0x631d20,_0x159b15[_0x0bd1('0x18')]['message']);return _0x32eedd(_0x159b15[_0x0bd1('0x18')][_0x0bd1('0x19')]);}else{logger[_0x0bd1('0x12')](_0x0bd1('0x13'),_0x631d20,'request\x20sent');_0x32eedd(_0x159b15[_0x0bd1('0x1a')][_0x0bd1('0x19')]);}})['catch'](function(_0x28b18f){logger[_0x0bd1('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x631d20,_0x28b18f);_0x154b4f(_0x28b18f);});});} \ No newline at end of file +var _0xe9ef=['http','redis','socket.io-emitter','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xa369ed,_0x49ccad){var _0xfe2f9d=function(_0x15d351){while(--_0x15d351){_0xa369ed['push'](_0xa369ed['shift']());}};_0xfe2f9d(++_0x49ccad);}(_0xe9ef,0x16e));var _0xfe9e=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0xe9ef[_0xfbe06e];return _0x24e5b6;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var moment=require(_0xfe9e('0x1'));var BPromise=require(_0xfe9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe9e('0x4'));var logger=require(_0xfe9e('0x5'))(_0xfe9e('0x6'));var config=require(_0xfe9e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe9e('0x8')][_0xfe9e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfe9e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe9e('0xb'))(new Redis(config[_0xfe9e('0xa')]));require(_0xfe9e('0xc'))['register'](socket);function respondWithRpcPromise(_0x165c47,_0x210da6,_0xba1c64){return new BPromise(function(_0x5ab3bd,_0x1cc515){return client['request'](_0x165c47,_0xba1c64)[_0xfe9e('0xd')](function(_0x318158){logger[_0xfe9e('0xe')](_0xfe9e('0xf'),_0x210da6,_0xfe9e('0x10'));logger[_0xfe9e('0x11')](_0xfe9e('0x12'),_0x210da6,_0xfe9e('0x10'),JSON[_0xfe9e('0x13')](_0x318158));if(_0x318158['error']){if(_0x318158[_0xfe9e('0x14')][_0xfe9e('0x15')]===0x1f4){logger['error'](_0xfe9e('0xf'),_0x210da6,_0x318158[_0xfe9e('0x14')][_0xfe9e('0x16')]);return _0x1cc515(_0x318158[_0xfe9e('0x14')]['message']);}logger['error'](_0xfe9e('0xf'),_0x210da6,_0x318158[_0xfe9e('0x14')][_0xfe9e('0x16')]);return _0x5ab3bd(_0x318158[_0xfe9e('0x14')]['message']);}else{logger[_0xfe9e('0xe')](_0xfe9e('0xf'),_0x210da6,_0xfe9e('0x10'));_0x5ab3bd(_0x318158[_0xfe9e('0x17')]['message']);}})[_0xfe9e('0x18')](function(_0x114434){logger[_0xfe9e('0x14')](_0xfe9e('0xf'),_0x210da6,_0x114434);_0x1cc515(_0x114434);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 919dd55..ebfee59 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 _0xcffe=['update','emit','length','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcffe,0x1a1));var _0xecff=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0xcffe[_0xd2e2ab];return _0x1703a2;};'use strict';var VoicePrefixEvents=require(_0xecff('0x0'));var events=[_0xecff('0x1'),_0xecff('0x2'),_0xecff('0x3')];function createListener(_0x2336f1,_0x2b364d){return function(_0xfe1d81){_0x2b364d[_0xecff('0x4')](_0x2336f1,_0xfe1d81);};}function removeListener(_0x352a15,_0xfffe9b){return function(){VoicePrefixEvents['removeListener'](_0x352a15,_0xfffe9b);};}exports['register']=function(_0x3020d9){for(var _0x25572c=0x0,_0x2e2fa9=events[_0xecff('0x5')];_0x25572c<_0x2e2fa9;_0x25572c++){var _0x50c98b=events[_0x25572c];var _0x298c19=createListener(_0xecff('0x6')+_0x50c98b,_0x3020d9);VoicePrefixEvents['on'](_0x50c98b,_0x298c19);}}; \ No newline at end of file +var _0x851d=['./voicePrefix.events','remove','update','emit','removeListener','length','voicePrefix:'];(function(_0x1bc322,_0x5dd2a6){var _0x427c8b=function(_0x14fbff){while(--_0x14fbff){_0x1bc322['push'](_0x1bc322['shift']());}};_0x427c8b(++_0x5dd2a6);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0xd851('0x0'));var events=['save',_0xd851('0x1'),_0xd851('0x2')];function createListener(_0x4c3a8c,_0x384e44){return function(_0x16201e){_0x384e44[_0xd851('0x3')](_0x4c3a8c,_0x16201e);};}function removeListener(_0x265b0e,_0x36eb20){return function(){VoicePrefixEvents[_0xd851('0x4')](_0x265b0e,_0x36eb20);};}exports['register']=function(_0x578809){for(var _0x1fff93=0x0,_0x2b63e4=events[_0xd851('0x5')];_0x1fff93<_0x2b63e4;_0x1fff93++){var _0x2f9540=events[_0x1fff93];var _0x60bef0=createListener(_0xd851('0x6')+_0x2f9540,_0x578809);VoicePrefixEvents['on'](_0x2f9540,_0x60bef0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4c337c3..9ab524d 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 _0xadfc=['/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','addLists','addBlackLists','put','delete','destroy','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x3a4e92,_0x580b8e){var _0x4c5226=function(_0xe409ee){while(--_0xe409ee){_0x3a4e92['push'](_0x3a4e92['shift']());}};_0x4c5226(++_0x580b8e);}(_0xadfc,0x1bd));var _0xcadf=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xadfc[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0xcadf('0x0'));var util=require('util');var path=require(_0xcadf('0x1'));var timeout=require(_0xcadf('0x2'));var express=require(_0xcadf('0x3'));var router=express[_0xcadf('0x4')]();var fs_extra=require(_0xcadf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcadf('0x6'));var config=require('../../config/environment');var controller=require(_0xcadf('0x7'));router[_0xcadf('0x8')]('/',auth[_0xcadf('0x9')](),controller['index']);router[_0xcadf('0x8')](_0xcadf('0xa'),auth['isAuthenticated'](),controller[_0xcadf('0xb')]);router[_0xcadf('0x8')](_0xcadf('0xc'),auth[_0xcadf('0x9')](),controller['getHoppers']);router['get'](_0xcadf('0xd'),auth[_0xcadf('0x9')](),controller[_0xcadf('0xe')]);router[_0xcadf('0x8')](_0xcadf('0xf'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x10')]);router[_0xcadf('0x8')](_0xcadf('0x11'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x12')]);router[_0xcadf('0x8')](_0xcadf('0x13'),auth[_0xcadf('0x9')](),controller['getTeams']);router['get'](_0xcadf('0x14'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x15')]);router[_0xcadf('0x8')]('/:id/members',auth[_0xcadf('0x9')](),controller[_0xcadf('0x16')]);router['get'](_0xcadf('0x17'),auth['isAuthenticated'](),controller[_0xcadf('0x18')]);router[_0xcadf('0x8')](_0xcadf('0x19'),auth['isAuthenticated'](),controller[_0xcadf('0x1a')]);router[_0xcadf('0x1b')]('/',auth[_0xcadf('0x9')](),controller[_0xcadf('0x1c')]);router['post'](_0xcadf('0x1d'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x1e')]);router[_0xcadf('0x1b')](_0xcadf('0x13'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x1f')]);router[_0xcadf('0x1b')]('/:id/users',auth[_0xcadf('0x9')](),controller[_0xcadf('0x20')]);router['post'](_0xcadf('0x17'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x21')]);router[_0xcadf('0x1b')](_0xcadf('0x19'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x22')]);router[_0xcadf('0x23')](_0xcadf('0xa'),auth[_0xcadf('0x9')](),controller['update']);router[_0xcadf('0x24')](_0xcadf('0xa'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x25')]);router[_0xcadf('0x24')](_0xcadf('0x13'),auth[_0xcadf('0x9')](),controller['removeTeams']);router[_0xcadf('0x24')]('/:id/users',auth[_0xcadf('0x9')](),controller[_0xcadf('0x26')]);router[_0xcadf('0x24')](_0xcadf('0x17'),auth[_0xcadf('0x9')](),controller[_0xcadf('0x27')]);router[_0xcadf('0x24')]('/:id/blacklists',auth[_0xcadf('0x9')](),controller[_0xcadf('0x28')]);module[_0xcadf('0x29')]=router; \ No newline at end of file +var _0x18ca=['show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','getMembers','/:id/lists','getLists','getBlackLists','post','/:id/clone','addTeams','/:id/users','addAgents','addLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','/:id/blacklists','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id'];(function(_0x33a97b,_0x291407){var _0x13d691=function(_0x267cff){while(--_0x267cff){_0x33a97b['push'](_0x33a97b['shift']());}};_0x13d691(++_0x291407);}(_0x18ca,0x6e));var _0xa18c=function(_0x360fac,_0x40541f){_0x360fac=_0x360fac-0x0;var _0x1f3393=_0x18ca[_0x360fac];return _0x1f3393;};'use strict';var multer=require(_0xa18c('0x0'));var util=require(_0xa18c('0x1'));var path=require(_0xa18c('0x2'));var timeout=require(_0xa18c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa18c('0x4'));var auth=require(_0xa18c('0x5'));var interaction=require(_0xa18c('0x6'));var config=require(_0xa18c('0x7'));var controller=require(_0xa18c('0x8'));router[_0xa18c('0x9')]('/',auth[_0xa18c('0xa')](),controller[_0xa18c('0xb')]);router[_0xa18c('0x9')](_0xa18c('0xc'),auth[_0xa18c('0xa')](),controller[_0xa18c('0xd')]);router[_0xa18c('0x9')](_0xa18c('0xe'),auth['isAuthenticated'](),controller[_0xa18c('0xf')]);router['get'](_0xa18c('0x10'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x11')]);router['get']('/:id/hopper_finals',auth[_0xa18c('0xa')](),controller[_0xa18c('0x12')]);router[_0xa18c('0x9')]('/:id/hopper_black',auth[_0xa18c('0xa')](),controller[_0xa18c('0x13')]);router[_0xa18c('0x9')](_0xa18c('0x14'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x15')]);router[_0xa18c('0x9')]('/:id/users',auth[_0xa18c('0xa')](),controller['getAgents']);router['get']('/:id/members',auth[_0xa18c('0xa')](),controller[_0xa18c('0x16')]);router[_0xa18c('0x9')](_0xa18c('0x17'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x18')]);router[_0xa18c('0x9')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xa18c('0x19')]);router[_0xa18c('0x1a')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa18c('0x1a')](_0xa18c('0x1b'),auth[_0xa18c('0xa')](),controller['clone']);router[_0xa18c('0x1a')](_0xa18c('0x14'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x1c')]);router['post'](_0xa18c('0x1d'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x1e')]);router['post'](_0xa18c('0x17'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x1f')]);router[_0xa18c('0x1a')]('/:id/blacklists',auth[_0xa18c('0xa')](),controller['addBlackLists']);router[_0xa18c('0x20')](_0xa18c('0xc'),auth['isAuthenticated'](),controller[_0xa18c('0x21')]);router[_0xa18c('0x22')](_0xa18c('0xc'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x23')]);router[_0xa18c('0x22')](_0xa18c('0x14'),auth['isAuthenticated'](),controller[_0xa18c('0x24')]);router[_0xa18c('0x22')](_0xa18c('0x1d'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x25')]);router[_0xa18c('0x22')](_0xa18c('0x17'),auth[_0xa18c('0xa')](),controller[_0xa18c('0x26')]);router[_0xa18c('0x22')](_0xa18c('0x27'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xa18c('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 65188c6..e89043e 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 _0xe011=['linear','wrandom','rrordered','setDataValue','strategy','dialMethod','getDataValue','booked','roundrobin','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','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)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory'];(function(_0x4b9290,_0x548f3c){var _0x2a585a=function(_0x19500f){while(--_0x19500f){_0x4b9290['push'](_0x4b9290['shift']());}};_0x2a585a(++_0x548f3c);}(_0xe011,0x14c));var _0x1e01=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xe011[_0x5e8eae];return _0xdd09cd;};'use strict';var Sequelize=require(_0x1e01('0x0'));module[_0x1e01('0x1')]={'name':{'type':Sequelize[_0x1e01('0x2')],'allowNull':![],'unique':_0x1e01('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1e01('0x4')]('inbound',_0x1e01('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':_0x1e01('0x6')},'announce':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1e01('0x4')]('rr',_0x1e01('0x7'),_0x1e01('0x8'),_0x1e01('0x9'),_0x1e01('0xa'),_0x1e01('0xb'),_0x1e01('0xc'),_0x1e01('0xd'),_0x1e01('0xe')),'allowNull':![],'defaultValue':_0x1e01('0x7'),'set':function(_0x5d79bc){this[_0x1e01('0xf')](_0x1e01('0x10'),_0x5d79bc?_0x5d79bc:_0x1e01('0xb'));},'get':function(){var _0x209c7b=this['getDataValue']('type');var _0x51f418=this['getDataValue'](_0x1e01('0x11'));var _0x45754c=this[_0x1e01('0x12')](_0x1e01('0x10'));if(_0x209c7b==='inbound'){return _0x45754c;}if(_0x51f418===_0x1e01('0x13')&&_0x45754c===_0x1e01('0xb')||_0x51f418===_0x1e01('0x13')&&_0x45754c===_0x1e01('0x14')){return _0x45754c;}if(_0x51f418==='progressive'||_0x51f418===_0x1e01('0x15')||_0x51f418==='power'){return _0x45754c;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x1e01('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1e01('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x1e01('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1e01('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no'),'defaultValue':_0x1e01('0x17')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x1e01('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1e01('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1e01('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1e01('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x1e01('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1e01('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1e01('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1e01('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x1e01('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no',_0x1e01('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1e01('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x1e01('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1e01('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1e01('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1e01('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1e01('0x2')]},'queue_quantity1':{'type':Sequelize[_0x1e01('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x1e01('0x2')]},'queue_less_than':{'type':Sequelize[_0x1e01('0x2')]},'periodic_announce':{'type':Sequelize[_0x1e01('0x1a')],'set':function(_0x2bc0dc){this['setDataValue'](_0x1e01('0x1b'),_0x2bc0dc?_0x2bc0dc['join'](','):[]);},'get':function(){return this[_0x1e01('0x12')](_0x1e01('0x1b'))?this[_0x1e01('0x12')](_0x1e01('0x1b'))[_0x1e01('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':'yes','set':function(_0x520d2d){this[_0x1e01('0xf')](_0x1e01('0x1d'),_0x520d2d?_0x520d2d[_0x1e01('0x1e')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue'](_0x1e01('0x1d'))[_0x1e01('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':'no','set':function(_0x4a9d71){this[_0x1e01('0xf')](_0x1e01('0x1f'),_0x4a9d71?_0x4a9d71[_0x1e01('0x1e')](','):undefined);},'get':function(){return this[_0x1e01('0x12')]('leavewhenempty')?this[_0x1e01('0x12')](_0x1e01('0x1f'))[_0x1e01('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1e01('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1e01('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x1e01('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1e01('0x2')]},'acw':{'type':Sequelize[_0x1e01('0x20')],'defaultValue':0x0,'set':function(_0x582a3e){this[_0x1e01('0xf')](_0x1e01('0x21'),_0x582a3e);if(_0x582a3e){if(this['getDataValue'](_0x1e01('0x22'))<0x2){this[_0x1e01('0xf')](_0x1e01('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x1e01('0x23'),_0x1e01('0x24'),_0x1e01('0x25'),_0x1e01('0x15'),'booked'),'defaultValue':_0x1e01('0x24'),'comment':_0x1e01('0x26')},'dialLimitChannel':{'type':Sequelize[_0x1e01('0x16')](0x4)[_0x1e01('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1e01('0x28')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1e01('0x29')},'dialPowerLevel':{'type':Sequelize[_0x1e01('0x2a')](0x2)[_0x1e01('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1e01('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x1e01('0x4')](_0x1e01('0x2c'),_0x1e01('0x2d')),'defaultValue':'dropRate','comment':_0x1e01('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1e01('0x2a')](0x2)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1e01('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1e01('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1e01('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1e01('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':_0x1e01('0x31'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e01('0x32')},'dialQueueProject':{'type':Sequelize[_0x1e01('0x2')],'comment':_0x1e01('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e01('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1e01('0x16')](0x5)[_0x1e01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e01('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e01('0x36')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'comment':_0x1e01('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1e01('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1e01('0x38')},'dialTimezone':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1e01('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1e01('0x4')]('always',_0x1e01('0x39'),'onlyIfOpen'),'defaultValue':_0x1e01('0x3a')},'dialAMDActive':{'type':Sequelize[_0x1e01('0x20')],'defaultValue':0x0,'comment':_0x1e01('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x1e01('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1e01('0x3c')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1e01('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1e01('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1e01('0x16')](0x9)[_0x1e01('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1e01('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1e01('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1e01('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x1e01('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1e01('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1e01('0x16')](0x9)[_0x1e01('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1e01('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1e01('0x16')](0x9)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1e01('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1e01('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1e01('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1e01('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1e01('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x1e01('0x16')](0x5)[_0x1e01('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1e01('0x45')},'dialRecallInQueue':{'type':Sequelize[_0x1e01('0x20')],'defaultValue':0x0,'comment':_0x1e01('0x46')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1e01('0x4')]('DESC',_0x1e01('0x47')),'defaultValue':_0x1e01('0x48')},'dialQueueProject2':{'type':Sequelize[_0x1e01('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1e01('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1e01('0x49')},'dialCutDigit':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1e01('0x4a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1e01('0x16')](0x5)[_0x1e01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e01('0x4b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e01('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1e01('0x16')](0x5)[_0x1e01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e01('0x4d')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e01('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1e01('0x16')](0x5)[_0x1e01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e01('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e01('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1e01('0x16')](0x5)[_0x1e01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e01('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1e01('0x16')],'allowNull':!![],'comment':_0x1e01('0x52')},'mandatoryDisposition':{'type':Sequelize[_0x1e01('0x20')],'defaultValue':![],'comment':_0x1e01('0x53'),'set':function(_0x20b380){if(!_0x20b380)this[_0x1e01('0xf')](_0x1e01('0x54'),null);this[_0x1e01('0xf')](_0x1e01('0x55'),_0x20b380);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1e01('0x16')](0x3)[_0x1e01('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xec39=['sequelize','exports','STRING','name','ENUM','inbound','outbound','default','fewestcalls','random','rrmemory','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','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).','agentBusyFactor','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x110924,_0x1374bb){var _0x12905b=function(_0x47d32c){while(--_0x47d32c){_0x110924['push'](_0x110924['shift']());}};_0x12905b(++_0x1374bb);}(_0xec39,0x19f));var _0x9ec3=function(_0x23204c,_0x574bfd){_0x23204c=_0x23204c-0x0;var _0x4ba1ba=_0xec39[_0x23204c];return _0x4ba1ba;};'use strict';var Sequelize=require(_0x9ec3('0x0'));module[_0x9ec3('0x1')]={'name':{'type':Sequelize[_0x9ec3('0x2')],'allowNull':![],'unique':_0x9ec3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x5'),_0x9ec3('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':_0x9ec3('0x7')},'announce':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent',_0x9ec3('0x8'),_0x9ec3('0x9'),_0x9ec3('0xa'),'linear',_0x9ec3('0xb'),_0x9ec3('0xc')),'allowNull':![],'defaultValue':_0x9ec3('0xd'),'set':function(_0x2d0c30){this[_0x9ec3('0xe')](_0x9ec3('0xf'),_0x2d0c30?_0x2d0c30:_0x9ec3('0xa'));},'get':function(){var _0x5a54bb=this[_0x9ec3('0x10')](_0x9ec3('0x11'));var _0x3c68b3=this[_0x9ec3('0x10')](_0x9ec3('0x12'));var _0x18ef85=this[_0x9ec3('0x10')]('strategy');if(_0x5a54bb===_0x9ec3('0x5')){return _0x18ef85;}if(_0x3c68b3===_0x9ec3('0x13')&&_0x18ef85===_0x9ec3('0xa')||_0x3c68b3==='booked'&&_0x18ef85===_0x9ec3('0x14')){return _0x18ef85;}if(_0x3c68b3==='progressive'||_0x3c68b3===_0x9ec3('0x15')||_0x3c68b3===_0x9ec3('0x16')){return _0x18ef85;}return null;}},'servicelevel':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9ec3('0x17')](0xb)},'timeout':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9ec3('0x2')]},'weight':{'type':Sequelize[_0x9ec3('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9ec3('0x4')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no',_0x9ec3('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9ec3('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x9ec3('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9ec3('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x9ec3('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x9ec3('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x9ec3('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9ec3('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9ec3('0x4')]('yes','no'),'defaultValue':_0x9ec3('0x18')},'announce_holdtime':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no',_0x9ec3('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x9ec3('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9ec3('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9ec3('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9ec3('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9ec3('0x2')]},'queue_quantity1':{'type':Sequelize[_0x9ec3('0x2')]},'queue_quantity2':{'type':Sequelize[_0x9ec3('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x9ec3('0x2')]},'queue_less_than':{'type':Sequelize[_0x9ec3('0x2')]},'periodic_announce':{'type':Sequelize[_0x9ec3('0x1b')],'set':function(_0xa91ee5){this[_0x9ec3('0xe')](_0x9ec3('0x1c'),_0xa91ee5?_0xa91ee5[_0x9ec3('0x1d')](','):[]);},'get':function(){return this[_0x9ec3('0x10')](_0x9ec3('0x1c'))?this[_0x9ec3('0x10')](_0x9ec3('0x1c'))[_0x9ec3('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4c50fd){this[_0x9ec3('0xe')](_0x9ec3('0x1f'),_0x4c50fd?_0x4c50fd[_0x9ec3('0x1d')](','):undefined);},'get':function(){return this[_0x9ec3('0x10')](_0x9ec3('0x1f'))?this[_0x9ec3('0x10')](_0x9ec3('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':'no','set':function(_0x22910c){this[_0x9ec3('0xe')]('leavewhenempty',_0x22910c?_0x22910c[_0x9ec3('0x1d')](','):undefined);},'get':function(){return this[_0x9ec3('0x10')]('leavewhenempty')?this[_0x9ec3('0x10')](_0x9ec3('0x20'))[_0x9ec3('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x9ec3('0x21')],'defaultValue':0x0,'set':function(_0x47936d){this[_0x9ec3('0xe')](_0x9ec3('0x22'),_0x47936d);if(_0x47936d){if(this[_0x9ec3('0x10')](_0x9ec3('0x23'))<0x2){this['setDataValue'](_0x9ec3('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9ec3('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9ec3('0x21')],'defaultValue':0x0,'comment':_0x9ec3('0x24')},'dialMethod':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x25'),'progressive','power','predictive',_0x9ec3('0x13')),'defaultValue':_0x9ec3('0x26'),'comment':_0x9ec3('0x27')},'dialLimitChannel':{'type':Sequelize[_0x9ec3('0x17')](0x4)[_0x9ec3('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9ec3('0x29')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x9ec3('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9ec3('0x2a')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x9ec3('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9ec3('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x2c'),'dropRate'),'defaultValue':_0x9ec3('0x2d'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9ec3('0x2e')](0x2)[_0x9ec3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9ec3('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x9ec3('0x17')](0x3)[_0x9ec3('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9ec3('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':'tTxX','comment':_0x9ec3('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x9ec3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ec3('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x9ec3('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9ec3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ec3('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9ec3('0x17')](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9ec3('0x17')](0x3)[_0x9ec3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x9ec3('0x17')](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ec3('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9ec3('0x17')](0x3)[_0x9ec3('0x28')],'defaultValue':0x3,'comment':_0x9ec3('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9ec3('0x17')](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9ec3('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9ec3('0x2')],'defaultValue':_0x9ec3('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x38'),_0x9ec3('0x39'),_0x9ec3('0x3a')),'defaultValue':_0x9ec3('0x38')},'dialAMDActive':{'type':Sequelize[_0x9ec3('0x21')],'defaultValue':0x0,'comment':_0x9ec3('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x9ec3('0x17')](0x9)[_0x9ec3('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9ec3('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x9ec3('0x17')](0x9)[_0x9ec3('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9ec3('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9ec3('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9ec3('0x17')](0x9)[_0x9ec3('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9ec3('0x3e')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9ec3('0x17')](0x9)[_0x9ec3('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9ec3('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9ec3('0x17')](0x5)[_0x9ec3('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9ec3('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9ec3('0x17')](0x9)[_0x9ec3('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9ec3('0x41')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9ec3('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x9ec3('0x21')],'defaultValue':0x0,'comment':_0x9ec3('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9ec3('0x4')](_0x9ec3('0x44'),_0x9ec3('0x45')),'defaultValue':_0x9ec3('0x44')},'dialQueueProject2':{'type':Sequelize[_0x9ec3('0x2')],'comment':_0x9ec3('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9ec3('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9ec3('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ec3('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ec3('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x9ec3('0x17')](0x3)[_0x9ec3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ec3('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ec3('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9ec3('0x17')](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ec3('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x9ec3('0x17')](0x3)[_0x9ec3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ec3('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9ec3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ec3('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9ec3('0x17')](0x5)[_0x9ec3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ec3('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ec3('0x17')],'allowNull':!![],'comment':_0x9ec3('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x9ec3('0x21')],'defaultValue':![],'comment':_0x9ec3('0x50'),'set':function(_0x1d41ff){if(!_0x1d41ff)this[_0x9ec3('0xe')](_0x9ec3('0x51'),null);this[_0x9ec3('0xe')](_0x9ec3('0x52'),_0x1d41ff);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9ec3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9ec3('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index b520209..ba38707 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 _0x5a64=['options','VoiceQueue','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','role','QueueCampaigns','destroy','findOne','CmHopper','hasOwnProperty','VoiceQueueId','getHopperHistories','order','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','User','online','Agents','forEach','penalty','sequelize','transaction','addTeams','TeamVoiceQueue','each','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','voicePause','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','compact','removeAgents','userVoiceQueue:remove','addAgents','ids','spread','isEmpty','SIP/%s','isArray','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','NOW()','updatedAt','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','removeLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','VoiceQueues','inbound','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x42ca5d,_0x4bc7f9){var _0x5388de=function(_0x1a7765){while(--_0x1a7765){_0x42ca5d['push'](_0x42ca5d['shift']());}};_0x5388de(++_0x4bc7f9);}(_0x5a64,0x6d));var _0x45a6=function(_0x428670,_0x1b8c94){_0x428670=_0x428670-0x0;var _0x31d3ea=_0x5a64[_0x428670];return _0x31d3ea;};'use strict';var emlformat=require(_0x45a6('0x0'));var rimraf=require(_0x45a6('0x1'));var zipdir=require(_0x45a6('0x2'));var jsonpatch=require(_0x45a6('0x3'));var rp=require(_0x45a6('0x4'));var moment=require(_0x45a6('0x5'));var BPromise=require(_0x45a6('0x6'));var Mustache=require(_0x45a6('0x7'));var util=require(_0x45a6('0x8'));var path=require('path');var sox=require(_0x45a6('0x9'));var csv=require(_0x45a6('0xa'));var ejs=require(_0x45a6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45a6('0xc'));var squel=require(_0x45a6('0xd'));var crypto=require(_0x45a6('0xe'));var jsforce=require(_0x45a6('0xf'));var deskjs=require(_0x45a6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x45a6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x45a6('0x12'));var qs=require(_0x45a6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45a6('0x14'));var logger=require(_0x45a6('0x15'))(_0x45a6('0x16'));var utils=require(_0x45a6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x45a6('0x18'));var db=require(_0x45a6('0x19'))['db'];config[_0x45a6('0x1a')]=_['defaults'](config[_0x45a6('0x1a')],{'host':_0x45a6('0x1b'),'port':0x18eb});var socket=require(_0x45a6('0x1c'))(new Redis(config[_0x45a6('0x1a')]));require(_0x45a6('0x1d'))[_0x45a6('0x1e')](socket);function respondWithStatusCode(_0xaf6a89,_0x374897){_0x374897=_0x374897||0xcc;return function(_0x32c011){if(_0x32c011){return _0xaf6a89[_0x45a6('0x1f')](_0x374897);}return _0xaf6a89['status'](_0x374897)['end']();};}function respondWithResult(_0x2b7aa0,_0x56b2dd){_0x56b2dd=_0x56b2dd||0xc8;return function(_0x5dacc9){if(_0x5dacc9){return _0x2b7aa0[_0x45a6('0x20')](_0x56b2dd)[_0x45a6('0x21')](_0x5dacc9);}};}function respondWithFilteredResult(_0x3adce1,_0x10073d){return function(_0x54acc5){if(_0x54acc5){var _0x3a3797=typeof _0x10073d['offset']===_0x45a6('0x22')&&typeof _0x10073d[_0x45a6('0x23')]===_0x45a6('0x22');var _0x266ead=_0x54acc5[_0x45a6('0x24')];var _0x4c69b9=_0x3a3797?0x0:_0x10073d[_0x45a6('0x25')];var _0x1e6fb5=_0x3a3797?_0x54acc5[_0x45a6('0x24')]:_0x10073d[_0x45a6('0x25')]+_0x10073d[_0x45a6('0x23')];var _0x4e791a;if(_0x1e6fb5>=_0x266ead){_0x1e6fb5=_0x266ead;_0x4e791a=0xc8;}else{_0x4e791a=0xce;}_0x3adce1[_0x45a6('0x20')](_0x4e791a);return _0x3adce1[_0x45a6('0x26')](_0x45a6('0x27'),_0x4c69b9+'-'+_0x1e6fb5+'/'+_0x266ead)[_0x45a6('0x21')](_0x54acc5);}return null;};}function patchUpdates(_0x42e0e4){return function(_0x1a83e1){try{jsonpatch[_0x45a6('0x28')](_0x1a83e1,_0x42e0e4,!![]);}catch(_0x44cc76){return BPromise['reject'](_0x44cc76);}return _0x1a83e1[_0x45a6('0x29')]();};}function saveUpdates(_0x2cc643,_0x3c204b){return function(_0x4fc525){if(_0x4fc525){return _0x4fc525[_0x45a6('0x2a')](_0x2cc643)['then'](function(_0x187d8e){return _0x187d8e;});}return null;};}function removeEntity(_0x16e9f4,_0x4845a1){return function(_0x42979d){if(_0x42979d){return _0x42979d['destroy']()[_0x45a6('0x2b')](function(){var _0x3f9460=_0x42979d[_0x45a6('0x2c')]({'plain':!![]});var _0x5d979a=[{'name':_0x45a6('0x2d'),'value':_0x45a6('0x2e'),'ignore':![]},{'name':'QueueCampaigns','value':_0x45a6('0x2f'),'ignore':![]}];var _0x42074c=_(_0x5d979a)[_0x45a6('0x30')]('ignore')[_0x45a6('0x31')](_0x45a6('0x32'))['value']();if(_[_0x45a6('0x33')](_0x42074c,_0x3f9460[_0x45a6('0x34')])){return;}var _0x197b23=_[_0x45a6('0x35')](_0x5d979a,[_0x45a6('0x32'),_0x3f9460[_0x45a6('0x34')]])[_0x45a6('0x36')];return db[_0x45a6('0x37')]['destroy']({'where':{'type':_0x197b23,'resourceId':_0x3f9460['id']}})[_0x45a6('0x2b')](function(){return _0x42979d;});})[_0x45a6('0x2b')](function(){_0x16e9f4[_0x45a6('0x20')](0xcc)[_0x45a6('0x38')]();});}};}function handleEntityNotFound(_0x2c2ec6,_0x18ac1b){return function(_0x369101){if(!_0x369101){_0x2c2ec6['sendStatus'](0x194);}return _0x369101;};}function handleError(_0x3c8215,_0x4a1ae0){_0x4a1ae0=_0x4a1ae0||0x1f4;return function(_0x5ab5ce){logger[_0x45a6('0x39')](_0x5ab5ce[_0x45a6('0x3a')]);if(_0x5ab5ce[_0x45a6('0x36')]){delete _0x5ab5ce[_0x45a6('0x36')];}_0x3c8215['status'](_0x4a1ae0)[_0x45a6('0x3b')](_0x5ab5ce);};}exports[_0x45a6('0x3c')]=function(_0x56259d,_0x292215){var _0x275191={},_0x139f92={},_0x41a9c3={'count':0x0,'rows':[]};var _0x2cb9fc=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x1594d7){return{'name':_0x1594d7[_0x45a6('0x3d')],'type':_0x1594d7['type'][_0x45a6('0x3e')]};});_0x139f92['model']=_[_0x45a6('0x31')](_0x2cb9fc,_0x45a6('0x36'));_0x139f92['query']=_[_0x45a6('0x3f')](_0x56259d[_0x45a6('0x40')]);_0x139f92[_0x45a6('0x41')]=_[_0x45a6('0x42')](_0x139f92[_0x45a6('0x43')],_0x139f92[_0x45a6('0x40')]);_0x275191[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x139f92[_0x45a6('0x43')],qs['fields'](_0x56259d[_0x45a6('0x40')][_0x45a6('0x45')]));_0x275191['attributes']=_0x275191['attributes'][_0x45a6('0x46')]?_0x275191['attributes']:_0x139f92[_0x45a6('0x43')];if(!_0x56259d[_0x45a6('0x40')]['hasOwnProperty'](_0x45a6('0x47'))){_0x275191[_0x45a6('0x23')]=qs[_0x45a6('0x23')](_0x56259d[_0x45a6('0x40')][_0x45a6('0x23')]);_0x275191[_0x45a6('0x25')]=qs['offset'](_0x56259d[_0x45a6('0x40')]['offset']);}_0x275191['order']=qs[_0x45a6('0x48')](_0x56259d[_0x45a6('0x40')]['sort']);_0x275191[_0x45a6('0x49')]=qs[_0x45a6('0x41')](_[_0x45a6('0x4a')](_0x56259d[_0x45a6('0x40')],_0x139f92[_0x45a6('0x41')]),_0x2cb9fc);if(_0x56259d[_0x45a6('0x40')]['filter']){_0x275191['where']=_[_0x45a6('0x4b')](_0x275191[_0x45a6('0x49')],{'$or':_[_0x45a6('0x31')](_0x2cb9fc,function(_0x1dcadd){if(_0x1dcadd[_0x45a6('0x34')]!==_0x45a6('0x4c')){var _0xffa9ec={};_0xffa9ec[_0x1dcadd['name']]={'$like':'%'+_0x56259d[_0x45a6('0x40')]['filter']+'%'};return _0xffa9ec;}})});}_0x275191=_['merge']({},_0x275191,_0x56259d[_0x45a6('0x4d')]);var _0x3d60ae={'where':_0x275191[_0x45a6('0x49')]};return db[_0x45a6('0x4e')][_0x45a6('0x24')](_0x3d60ae)[_0x45a6('0x2b')](function(_0x3a6e9c){_0x41a9c3[_0x45a6('0x24')]=_0x3a6e9c;if(_0x56259d[_0x45a6('0x40')][_0x45a6('0x4f')]){_0x275191[_0x45a6('0x50')]=[{'all':!![]}];}return db[_0x45a6('0x4e')][_0x45a6('0x51')](_0x275191);})[_0x45a6('0x2b')](function(_0x2e4b8c){_0x41a9c3[_0x45a6('0x52')]=_0x2e4b8c;return _0x41a9c3;})['then'](respondWithFilteredResult(_0x292215,_0x275191))['catch'](handleError(_0x292215,null));};exports[_0x45a6('0x53')]=function(_0x371a95,_0x1a8539){var _0x2d080a={'raw':![],'where':{'id':_0x371a95[_0x45a6('0x54')]['id']}},_0x294ef2={};_0x294ef2[_0x45a6('0x43')]=_[_0x45a6('0x3f')](db[_0x45a6('0x4e')][_0x45a6('0x55')]);_0x294ef2[_0x45a6('0x40')]=_['keys'](_0x371a95['query']);_0x294ef2[_0x45a6('0x41')]=_[_0x45a6('0x42')](_0x294ef2[_0x45a6('0x43')],_0x294ef2[_0x45a6('0x40')]);_0x2d080a[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x294ef2['model'],qs['fields'](_0x371a95['query'][_0x45a6('0x45')]));_0x2d080a[_0x45a6('0x44')]=_0x2d080a[_0x45a6('0x44')][_0x45a6('0x46')]?_0x2d080a[_0x45a6('0x44')]:_0x294ef2['model'];if(_0x371a95[_0x45a6('0x40')][_0x45a6('0x4f')]){_0x2d080a[_0x45a6('0x50')]=[{'all':!![]}];}_0x2d080a=_[_0x45a6('0x4b')]({},_0x2d080a,_0x371a95[_0x45a6('0x4d')]);return db[_0x45a6('0x4e')][_0x45a6('0x35')](_0x2d080a)[_0x45a6('0x2b')](handleEntityNotFound(_0x1a8539,null))[_0x45a6('0x2b')](respondWithResult(_0x1a8539,null))[_0x45a6('0x56')](handleError(_0x1a8539,null));};exports[_0x45a6('0x57')]=function(_0x2c9531,_0x21b6f7){return db['VoiceQueue'][_0x45a6('0x57')](_0x2c9531[_0x45a6('0x58')],{})[_0x45a6('0x2b')](function(_0x8ed6fd){var _0x50f86d=_0x2c9531[_0x45a6('0x59')][_0x45a6('0x2c')]({'plain':!![]});if(!_0x50f86d)throw new Error(_0x45a6('0x5a'));if(_0x50f86d['role']===_0x45a6('0x59')){var _0x45da15=_0x8ed6fd['get']({'plain':!![]});var _0x5a4446=[{'name':_0x45a6('0x2d'),'value':_0x45a6('0x2e')},{'name':'QueueCampaigns','value':_0x45a6('0x2f')}];var _0x37d4de=_['find'](_0x5a4446,[_0x45a6('0x32'),_0x45da15[_0x45a6('0x34')]])['name'];return db[_0x45a6('0x5b')]['find']({'where':{'name':_0x37d4de,'userProfileId':_0x50f86d[_0x45a6('0x5c')]},'raw':!![]})['then'](function(_0x17f7b7){if(_0x17f7b7&&_0x17f7b7[_0x45a6('0x5d')]===0x0){return db['UserProfileResource'][_0x45a6('0x57')]({'name':_0x45da15[_0x45a6('0x36')],'resourceId':_0x45da15['id'],'type':_0x17f7b7[_0x45a6('0x36')],'sectionId':_0x17f7b7['id']},{})[_0x45a6('0x2b')](function(){return _0x8ed6fd;});}else{return _0x8ed6fd;}})[_0x45a6('0x56')](function(_0x11e5b7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11e5b7);throw _0x11e5b7;});}return _0x8ed6fd;})[_0x45a6('0x2b')](respondWithResult(_0x21b6f7,0xc9))[_0x45a6('0x56')](handleError(_0x21b6f7,null));};exports['clone']=function(_0x43f647,_0xee5943){var _0x4711ef={'where':{'id':_0x43f647[_0x45a6('0x54')]['id']}},_0x3bd388={};_0x3bd388[_0x45a6('0x43')]=_[_0x45a6('0x3f')](db[_0x45a6('0x4e')][_0x45a6('0x55')]);_0x4711ef[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x3bd388[_0x45a6('0x43')],qs[_0x45a6('0x45')](_0x43f647['query'][_0x45a6('0x45')]));_0x4711ef[_0x45a6('0x44')]=_0x4711ef[_0x45a6('0x44')]['length']?_0x4711ef['attributes']:_0x3bd388[_0x45a6('0x43')];if(_0x43f647[_0x45a6('0x40')][_0x45a6('0x4f')]){_0x4711ef[_0x45a6('0x50')]=[{'all':!![]}];}_0x4711ef=_[_0x45a6('0x4b')]({},_0x4711ef,_0x43f647[_0x45a6('0x4d')]);return db['VoiceQueue'][_0x45a6('0x35')](_0x4711ef)[_0x45a6('0x2b')](handleEntityNotFound(_0xee5943,null))[_0x45a6('0x2b')](function(_0x434114){if(_0x434114){var _0x17dc04=_0x434114[_0x45a6('0x2c')]({'plain':!![]});_0x17dc04=qs[_0x45a6('0x5e')](_0x17dc04,['id',_0x45a6('0x5f'),'updatedAt']);_0x43f647[_0x45a6('0x58')]=_[_0x45a6('0x5e')](_0x43f647[_0x45a6('0x58')],['id',_0x45a6('0x5f'),'updatedAt']);return db[_0x45a6('0x4e')][_0x45a6('0x57')](_['merge'](_0x17dc04,_0x43f647[_0x45a6('0x58')]),{'include':_0x43f647[_0x45a6('0x40')][_0x45a6('0x4f')]?[{'all':!![]}]:undefined})[_0x45a6('0x2b')](function(_0x19a708){var _0x28ec60=_0x43f647['user']['get']({'plain':!![]});if(!_0x28ec60)throw new Error(_0x45a6('0x5a'));if(_0x28ec60[_0x45a6('0x60')]===_0x45a6('0x59')){var _0x3662aa=_0x19a708[_0x45a6('0x2c')]({'plain':!![]});var _0xa9e055=[{'name':_0x45a6('0x2d'),'value':'inbound'},{'name':_0x45a6('0x61'),'value':'outbound'}];var _0x4e91e5=_['find'](_0xa9e055,['value',_0x3662aa['type']])['name'];return db[_0x45a6('0x5b')][_0x45a6('0x35')]({'where':{'name':_0x4e91e5,'userProfileId':_0x28ec60['userProfileId']},'raw':!![]})[_0x45a6('0x2b')](function(_0x434d61){if(_0x434d61&&_0x434d61[_0x45a6('0x5d')]===0x0){return db[_0x45a6('0x37')][_0x45a6('0x57')]({'name':_0x3662aa[_0x45a6('0x36')],'resourceId':_0x3662aa['id'],'type':_0x434d61['name'],'sectionId':_0x434d61['id']},{})[_0x45a6('0x2b')](function(){return _0x19a708;});}else{return _0x19a708;}})[_0x45a6('0x56')](function(_0x9c4fa2){logger[_0x45a6('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9c4fa2);throw _0x9c4fa2;});}return _0x19a708;});}})[_0x45a6('0x2b')](respondWithResult(_0xee5943,0xc9))[_0x45a6('0x56')](handleError(_0xee5943,null));};exports[_0x45a6('0x2a')]=function(_0x2145a5,_0x3368f1){if(_0x2145a5[_0x45a6('0x58')]['id']){delete _0x2145a5[_0x45a6('0x58')]['id'];}return db[_0x45a6('0x4e')][_0x45a6('0x35')]({'where':{'id':_0x2145a5[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x3368f1,null))[_0x45a6('0x2b')](saveUpdates(_0x2145a5[_0x45a6('0x58')],null))['then'](respondWithResult(_0x3368f1,null))[_0x45a6('0x56')](handleError(_0x3368f1,null));};exports[_0x45a6('0x62')]=function(_0x53c950,_0x1fec66){return db[_0x45a6('0x4e')]['find']({'where':{'id':_0x53c950[_0x45a6('0x54')]['id']}})['then'](handleEntityNotFound(_0x1fec66,null))[_0x45a6('0x2b')](removeEntity(_0x1fec66,null))[_0x45a6('0x56')](handleError(_0x1fec66,null));};exports['getHoppers']=function(_0x2a0aa,_0x1ab578,_0x54db14){var _0xe75d28={'raw':![],'where':{}};var _0x260389={};var _0x410a99={'count':0x0,'rows':[]};return db[_0x45a6('0x4e')][_0x45a6('0x63')]({'where':{'id':_0x2a0aa[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x1ab578,null))['then'](function(_0xb9c9bf){if(_0xb9c9bf){_0x260389[_0x45a6('0x43')]=_[_0x45a6('0x3f')](db[_0x45a6('0x64')][_0x45a6('0x55')]);_0x260389['query']=_['keys'](_0x2a0aa['query']);_0x260389[_0x45a6('0x41')]=_[_0x45a6('0x42')](_0x260389[_0x45a6('0x43')],_0x260389[_0x45a6('0x40')]);_0xe75d28[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x260389[_0x45a6('0x43')],qs[_0x45a6('0x45')](_0x2a0aa['query'][_0x45a6('0x45')]));_0xe75d28[_0x45a6('0x44')]=_0xe75d28['attributes'][_0x45a6('0x46')]?_0xe75d28[_0x45a6('0x44')]:_0x260389[_0x45a6('0x43')];if(!_0x2a0aa[_0x45a6('0x40')][_0x45a6('0x65')](_0x45a6('0x47'))){_0xe75d28['limit']=qs['limit'](_0x2a0aa[_0x45a6('0x40')]['limit']);_0xe75d28[_0x45a6('0x25')]=qs['offset'](_0x2a0aa[_0x45a6('0x40')][_0x45a6('0x25')]);}_0xe75d28['order']=qs[_0x45a6('0x48')](_0x2a0aa[_0x45a6('0x40')]['sort']);_0xe75d28['where']=qs[_0x45a6('0x41')](_['pick'](_0x2a0aa[_0x45a6('0x40')],_0x260389[_0x45a6('0x41')]));_0xe75d28['where'][_0x45a6('0x66')]=_0xb9c9bf['id'];if(_0x2a0aa[_0x45a6('0x40')][_0x45a6('0x30')]){_0xe75d28['where']=_[_0x45a6('0x4b')](_0xe75d28[_0x45a6('0x49')],{'$or':_[_0x45a6('0x31')](_0xe75d28[_0x45a6('0x44')],function(_0x40e366){var _0x77e797={};_0x77e797[_0x40e366]={'$like':'%'+_0x2a0aa[_0x45a6('0x40')][_0x45a6('0x30')]+'%'};return _0x77e797;})});}_0xe75d28=_[_0x45a6('0x4b')]({},_0xe75d28,_0x2a0aa['options']);return db[_0x45a6('0x64')]['count']({'where':_0xe75d28[_0x45a6('0x49')]})[_0x45a6('0x2b')](function(_0x190caa){_0x410a99[_0x45a6('0x24')]=_0x190caa;if(_0x2a0aa[_0x45a6('0x40')]['includeAll']){_0xe75d28[_0x45a6('0x50')]=[{'all':!![]}];}return db[_0x45a6('0x64')]['findAll'](_0xe75d28);})['then'](function(_0x92ff1){_0x410a99[_0x45a6('0x52')]=_0x92ff1;return _0x410a99;});}})['then'](respondWithFilteredResult(_0x1ab578,_0xe75d28))[_0x45a6('0x56')](handleError(_0x1ab578,null));};exports[_0x45a6('0x67')]=function(_0x3402a7,_0x434b75,_0x96e567){var _0x1a2e36={'raw':!![],'where':{}};var _0x18afe1={};var _0x3cdbf3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x45a6('0x63')]({'where':{'id':_0x3402a7['params']['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x434b75,null))[_0x45a6('0x2b')](function(_0x693e13){if(_0x693e13){_0x18afe1[_0x45a6('0x43')]=_['keys'](db['CmHopperHistory'][_0x45a6('0x55')]);_0x18afe1[_0x45a6('0x40')]=_[_0x45a6('0x3f')](_0x3402a7[_0x45a6('0x40')]);_0x18afe1[_0x45a6('0x41')]=_[_0x45a6('0x42')](_0x18afe1[_0x45a6('0x43')],_0x18afe1[_0x45a6('0x40')]);_0x1a2e36[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x18afe1[_0x45a6('0x43')],qs[_0x45a6('0x45')](_0x3402a7['query']['fields']));_0x1a2e36[_0x45a6('0x44')]=_0x1a2e36[_0x45a6('0x44')][_0x45a6('0x46')]?_0x1a2e36[_0x45a6('0x44')]:_0x18afe1[_0x45a6('0x43')];if(!_0x3402a7[_0x45a6('0x40')][_0x45a6('0x65')](_0x45a6('0x47'))){_0x1a2e36[_0x45a6('0x23')]=qs[_0x45a6('0x23')](_0x3402a7['query'][_0x45a6('0x23')]);_0x1a2e36['offset']=qs[_0x45a6('0x25')](_0x3402a7['query'][_0x45a6('0x25')]);}_0x1a2e36[_0x45a6('0x68')]=qs['sort'](_0x3402a7['query'][_0x45a6('0x48')]);_0x1a2e36[_0x45a6('0x49')]=qs[_0x45a6('0x41')](_[_0x45a6('0x4a')](_0x3402a7['query'],_0x18afe1[_0x45a6('0x41')]));_0x1a2e36['where'][_0x45a6('0x66')]=_0x693e13['id'];if(_0x3402a7['query'][_0x45a6('0x30')]){_0x1a2e36[_0x45a6('0x49')]=_['merge'](_0x1a2e36[_0x45a6('0x49')],{'$or':_[_0x45a6('0x31')](_0x1a2e36[_0x45a6('0x44')],function(_0x260a96){var _0x138190={};_0x138190[_0x260a96]={'$like':'%'+_0x3402a7[_0x45a6('0x40')][_0x45a6('0x30')]+'%'};return _0x138190;})});}_0x1a2e36=_[_0x45a6('0x4b')]({},_0x1a2e36,_0x3402a7['options']);return db[_0x45a6('0x69')][_0x45a6('0x24')]({'where':_0x1a2e36[_0x45a6('0x49')]})[_0x45a6('0x2b')](function(_0x40ab18){_0x3cdbf3[_0x45a6('0x24')]=_0x40ab18;if(_0x3402a7[_0x45a6('0x40')][_0x45a6('0x4f')]){_0x1a2e36[_0x45a6('0x50')]=[{'all':!![]}];}return db[_0x45a6('0x69')][_0x45a6('0x51')](_0x1a2e36);})['then'](function(_0x11aaf1){_0x3cdbf3['rows']=_0x11aaf1;return _0x3cdbf3;});}})[_0x45a6('0x2b')](respondWithFilteredResult(_0x434b75,_0x1a2e36))[_0x45a6('0x56')](handleError(_0x434b75,null));};exports[_0x45a6('0x6a')]=function(_0x482b3f,_0x5aac74,_0x198ba8){var _0x468451={'raw':!![],'where':{}};var _0x2ff2a6={};var _0xb999bb={'count':0x0,'rows':[]};return db[_0x45a6('0x4e')][_0x45a6('0x63')]({'where':{'id':_0x482b3f['params']['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x5aac74,null))[_0x45a6('0x2b')](function(_0x16da45){if(_0x16da45){_0x2ff2a6[_0x45a6('0x43')]=_[_0x45a6('0x3f')](db['CmHopperFinal'][_0x45a6('0x55')]);_0x2ff2a6[_0x45a6('0x40')]=_['keys'](_0x482b3f['query']);_0x2ff2a6['filters']=_[_0x45a6('0x42')](_0x2ff2a6[_0x45a6('0x43')],_0x2ff2a6[_0x45a6('0x40')]);_0x468451[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x2ff2a6['model'],qs[_0x45a6('0x45')](_0x482b3f[_0x45a6('0x40')][_0x45a6('0x45')]));_0x468451[_0x45a6('0x44')]=_0x468451[_0x45a6('0x44')]['length']?_0x468451['attributes']:_0x2ff2a6[_0x45a6('0x43')];if(!_0x482b3f[_0x45a6('0x40')][_0x45a6('0x65')](_0x45a6('0x47'))){_0x468451[_0x45a6('0x23')]=qs['limit'](_0x482b3f[_0x45a6('0x40')][_0x45a6('0x23')]);_0x468451['offset']=qs[_0x45a6('0x25')](_0x482b3f['query'][_0x45a6('0x25')]);}_0x468451[_0x45a6('0x68')]=qs[_0x45a6('0x48')](_0x482b3f[_0x45a6('0x40')][_0x45a6('0x48')]);_0x468451[_0x45a6('0x49')]=qs[_0x45a6('0x41')](_[_0x45a6('0x4a')](_0x482b3f[_0x45a6('0x40')],_0x2ff2a6[_0x45a6('0x41')]));_0x468451[_0x45a6('0x49')]['VoiceQueueId']=_0x16da45['id'];if(_0x482b3f[_0x45a6('0x40')][_0x45a6('0x30')]){_0x468451[_0x45a6('0x49')]=_[_0x45a6('0x4b')](_0x468451[_0x45a6('0x49')],{'$or':_[_0x45a6('0x31')](_0x468451[_0x45a6('0x44')],function(_0x50127a){var _0xd26550={};_0xd26550[_0x50127a]={'$like':'%'+_0x482b3f[_0x45a6('0x40')][_0x45a6('0x30')]+'%'};return _0xd26550;})});}_0x468451=_[_0x45a6('0x4b')]({},_0x468451,_0x482b3f[_0x45a6('0x4d')]);return db[_0x45a6('0x6b')][_0x45a6('0x24')]({'where':_0x468451[_0x45a6('0x49')]})['then'](function(_0x2f440f){_0xb999bb['count']=_0x2f440f;if(_0x482b3f[_0x45a6('0x40')][_0x45a6('0x4f')]){_0x468451[_0x45a6('0x50')]=[{'all':!![]}];}return db[_0x45a6('0x6b')][_0x45a6('0x51')](_0x468451);})['then'](function(_0x3248a7){_0xb999bb['rows']=_0x3248a7;return _0xb999bb;});}})[_0x45a6('0x2b')](respondWithFilteredResult(_0x5aac74,_0x468451))[_0x45a6('0x56')](handleError(_0x5aac74,null));};exports[_0x45a6('0x6c')]=function(_0x79fe2,_0x735275,_0x36d09b){var _0x495c6a={'raw':!![],'where':{}};var _0x4e016d={};var _0x4f33a8={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x45a6('0x63')]({'where':{'id':_0x79fe2['params']['id']}})['then'](handleEntityNotFound(_0x735275,null))[_0x45a6('0x2b')](function(_0xc62787){if(_0xc62787){_0x4e016d['model']=_[_0x45a6('0x3f')](db[_0x45a6('0x6d')]['rawAttributes']);_0x4e016d[_0x45a6('0x40')]=_[_0x45a6('0x3f')](_0x79fe2[_0x45a6('0x40')]);_0x4e016d[_0x45a6('0x41')]=_['intersection'](_0x4e016d[_0x45a6('0x43')],_0x4e016d['query']);_0x495c6a['attributes']=_[_0x45a6('0x42')](_0x4e016d[_0x45a6('0x43')],qs[_0x45a6('0x45')](_0x79fe2[_0x45a6('0x40')]['fields']));_0x495c6a[_0x45a6('0x44')]=_0x495c6a[_0x45a6('0x44')][_0x45a6('0x46')]?_0x495c6a['attributes']:_0x4e016d['model'];if(!_0x79fe2[_0x45a6('0x40')]['hasOwnProperty'](_0x45a6('0x47'))){_0x495c6a[_0x45a6('0x23')]=qs[_0x45a6('0x23')](_0x79fe2[_0x45a6('0x40')]['limit']);_0x495c6a[_0x45a6('0x25')]=qs['offset'](_0x79fe2[_0x45a6('0x40')]['offset']);}_0x495c6a[_0x45a6('0x68')]=qs[_0x45a6('0x48')](_0x79fe2[_0x45a6('0x40')][_0x45a6('0x48')]);_0x495c6a[_0x45a6('0x49')]=qs[_0x45a6('0x41')](_['pick'](_0x79fe2[_0x45a6('0x40')],_0x4e016d[_0x45a6('0x41')]));_0x495c6a[_0x45a6('0x49')]['VoiceQueueId']=_0xc62787['id'];if(_0x79fe2[_0x45a6('0x40')]['filter']){_0x495c6a[_0x45a6('0x49')]=_[_0x45a6('0x4b')](_0x495c6a['where'],{'$or':_['map'](_0x495c6a[_0x45a6('0x44')],function(_0x48892a){var _0x380031={};_0x380031[_0x48892a]={'$like':'%'+_0x79fe2[_0x45a6('0x40')]['filter']+'%'};return _0x380031;})});}_0x495c6a=_[_0x45a6('0x4b')]({},_0x495c6a,_0x79fe2[_0x45a6('0x4d')]);return db[_0x45a6('0x6d')]['count']({'where':_0x495c6a[_0x45a6('0x49')]})['then'](function(_0x584cd8){_0x4f33a8[_0x45a6('0x24')]=_0x584cd8;if(_0x79fe2[_0x45a6('0x40')]['includeAll']){_0x495c6a['include']=[{'all':!![]}];}return db[_0x45a6('0x6d')][_0x45a6('0x51')](_0x495c6a);})[_0x45a6('0x2b')](function(_0x2e326d){_0x4f33a8[_0x45a6('0x52')]=_0x2e326d;return _0x4f33a8;});}})[_0x45a6('0x2b')](respondWithFilteredResult(_0x735275,_0x495c6a))[_0x45a6('0x56')](handleError(_0x735275,null));};exports['getTeams']=function(_0x16cc30,_0x2411b6,_0x70b834){var _0x42adad={};var _0x5415ac={};var _0x407693;var _0x738305;return db[_0x45a6('0x4e')]['findOne']({'where':{'id':_0x16cc30['params']['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x2411b6,null))[_0x45a6('0x2b')](function(_0x19a9e9){if(_0x19a9e9){_0x407693=_0x19a9e9;_0x5415ac[_0x45a6('0x43')]=_[_0x45a6('0x3f')](db[_0x45a6('0x6e')][_0x45a6('0x55')]);_0x5415ac[_0x45a6('0x40')]=_[_0x45a6('0x3f')](_0x16cc30[_0x45a6('0x40')]);_0x5415ac[_0x45a6('0x41')]=_[_0x45a6('0x42')](_0x5415ac[_0x45a6('0x43')],_0x5415ac[_0x45a6('0x40')]);_0x42adad[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x5415ac[_0x45a6('0x43')],qs['fields'](_0x16cc30['query']['fields']));_0x42adad[_0x45a6('0x44')]=_0x42adad[_0x45a6('0x44')][_0x45a6('0x46')]?_0x42adad[_0x45a6('0x44')]:_0x5415ac[_0x45a6('0x43')];_0x42adad[_0x45a6('0x68')]=qs[_0x45a6('0x48')](_0x16cc30[_0x45a6('0x40')][_0x45a6('0x48')]);_0x42adad[_0x45a6('0x49')]=qs['filters'](_[_0x45a6('0x4a')](_0x16cc30[_0x45a6('0x40')],_0x5415ac[_0x45a6('0x41')]));if(_0x16cc30[_0x45a6('0x40')][_0x45a6('0x30')]){_0x42adad[_0x45a6('0x49')]=_['merge'](_0x42adad['where'],{'$or':_[_0x45a6('0x31')](_0x42adad[_0x45a6('0x44')],function(_0x2f1d68){var _0x454809={};_0x454809[_0x2f1d68]={'$like':'%'+_0x16cc30['query']['filter']+'%'};return _0x454809;})});}_0x42adad=_[_0x45a6('0x4b')]({},_0x42adad,_0x16cc30['options']);return _0x407693[_0x45a6('0x6f')](_0x42adad);}})[_0x45a6('0x2b')](function(_0x58ef53){if(_0x58ef53){_0x738305=_0x58ef53[_0x45a6('0x46')];if(!_0x16cc30[_0x45a6('0x40')]['hasOwnProperty']('nolimit')){_0x42adad[_0x45a6('0x23')]=qs[_0x45a6('0x23')](_0x16cc30[_0x45a6('0x40')][_0x45a6('0x23')]);_0x42adad[_0x45a6('0x25')]=qs[_0x45a6('0x25')](_0x16cc30[_0x45a6('0x40')]['offset']);}return _0x407693[_0x45a6('0x6f')](_0x42adad);}})[_0x45a6('0x2b')](function(_0x2d223a){if(_0x2d223a){return _0x2d223a?{'count':_0x738305,'rows':_0x2d223a}:null;}})[_0x45a6('0x2b')](respondWithResult(_0x2411b6,null))[_0x45a6('0x56')](handleError(_0x2411b6,null));};exports['addTeams']=function(_0x4a7859,_0x38effd,_0x4b2f13){var _0x85e8ae=_0x4a7859['body']['teams'];var _0x5ce1db=_[_0x45a6('0x31')](_0x85e8ae,'id');return db[_0x45a6('0x6e')]['findAll']({'where':{'id':_0x5ce1db},'attributes':['id'],'include':[{'model':db[_0x45a6('0x70')],'as':'Agents','attributes':['id','name',_0x45a6('0x71'),'voicePause','interface'],'raw':!![]}]})[_0x45a6('0x2b')](function(_0x26eee3){if(_0x26eee3){var _0x528ae9=_['flatMap'](_0x26eee3,function(_0x42b393){var _0x3ebbda=_0x42b393['get']({'plain':!![]});_0x3ebbda[_0x45a6('0x72')][_0x45a6('0x73')](function(_0x265473){_0x265473[_0x45a6('0x74')]=_['find'](_0x85e8ae,{'id':_0x3ebbda['id']})['penalty'];});return _0x3ebbda[_0x45a6('0x72')];});return db[_0x45a6('0x4e')][_0x45a6('0x35')]({'where':{'id':_0x4a7859[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](function(_0x3640e2){return db[_0x45a6('0x75')][_0x45a6('0x76')](function(_0x154b08){return _0x3640e2[_0x45a6('0x77')](_0x5ce1db,{'transaction':_0x154b08})[_0x45a6('0x2b')](function(){return BPromise['each'](_0x85e8ae,function(_0x37480e){return db[_0x45a6('0x78')]['upsert']({'TeamId':_0x37480e['id'],'VoiceQueueId':_0x4a7859['params']['id'],'penalty':_0x37480e[_0x45a6('0x74')]},{'transaction':_0x154b08});});})[_0x45a6('0x2b')](function(){return BPromise[_0x45a6('0x79')](_0x528ae9,function(_0x22d18f){return db[_0x45a6('0x7a')][_0x45a6('0x7b')]({'where':{'UserId':_0x22d18f['id'],'VoiceQueueId':_0x4a7859['params']['id']},'defaults':{'penalty':_0x22d18f[_0x45a6('0x74')]},'transaction':_0x154b08});});})[_0x45a6('0x2b')](function(){return BPromise[_0x45a6('0x79')](_[_0x45a6('0x30')](_0x528ae9,{'online':!![]}),function(_0x2397e6){return db['UserVoiceQueueRt'][_0x45a6('0x7c')]({'membername':_0x2397e6[_0x45a6('0x36')],'UserId':_0x2397e6['id'],'queue_name':_0x3640e2[_0x45a6('0x36')],'VoiceQueueId':_0x3640e2['id'],'interface':_[_0x45a6('0x7d')](_0x2397e6[_0x45a6('0x7e')])?util[_0x45a6('0x7f')]('SIP/%s',_0x2397e6[_0x45a6('0x36')]):_0x2397e6[_0x45a6('0x7e')],'paused':_0x2397e6[_0x45a6('0x80')]||![],'penalty':_0x2397e6[_0x45a6('0x74')]},{'transaction':_0x154b08});});})[_0x45a6('0x2b')](function(){_0x528ae9['forEach'](function(_0x1535b5){socket[_0x45a6('0x81')](_0x45a6('0x82'),{'UserId':_0x1535b5['id'],'VoiceQueueId':_0x3640e2['id']});});});});});}})[_0x45a6('0x2b')](respondWithStatusCode(_0x38effd,null))[_0x45a6('0x56')](handleError(_0x38effd,null));};exports[_0x45a6('0x83')]=function(_0x582eb4,_0x3f25aa,_0x4d79f2){return db[_0x45a6('0x6e')][_0x45a6('0x51')]({'where':{'id':_0x582eb4[_0x45a6('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x45a6('0x70')],'as':_0x45a6('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3f25aa,null))['then'](function(_0x3e9bf5){var _0x118fcf=_['map'](_0x3e9bf5,'id');var _0x35960f=[];var _0x3b9f9d=[];var _0x2da2a1=squel[_0x45a6('0x84')]();_0x2da2a1[_0x45a6('0x85')](_0x45a6('0x86'))[_0x45a6('0x87')]('team_has_voice_queues','tq')['join'](_0x45a6('0x88'),'ut',_0x45a6('0x89'))[_0x45a6('0x49')]('VoiceQueueId\x20=\x20?',_0x582eb4['params']['id']);for(var _0x3ddd21=0x0;_0x3ddd21<_0x3e9bf5['length'];_0x3ddd21+=0x1){let _0x29a4dd=_0x3e9bf5[_0x3ddd21];for(var _0x197587=0x0;_0x197587<_0x29a4dd[_0x45a6('0x72')]['length'];_0x197587+=0x1){let _0x1c0590=_0x29a4dd[_0x45a6('0x72')][_0x197587];var _0x2a8ad8=_0x2da2a1[_0x45a6('0x8a')]();_0x2a8ad8[_0x45a6('0x49')](_0x45a6('0x8b'),_0x1c0590['id']);_0x3b9f9d[_0x45a6('0x8c')](db[_0x45a6('0x75')][_0x45a6('0x40')](_0x2a8ad8[_0x45a6('0x8d')](),{'type':db[_0x45a6('0x75')]['QueryTypes'][_0x45a6('0x8e')]})['then'](function(_0x4b1ea7){if(_0x4b1ea7[_0x45a6('0x46')]===0x1){return _0x1c0590['id'];}else{var _0x5b4d16=_[_0x45a6('0x8f')](_[_0x45a6('0x31')](_0x4b1ea7,_0x45a6('0x90')),function(_0x520b8e){return _[_0x45a6('0x33')](_0x118fcf,_0x520b8e);});if(_0x5b4d16){return _0x1c0590['id'];}}}));}}return BPromise[_0x45a6('0x91')](_0x3b9f9d)[_0x45a6('0x2b')](function(_0x11acef){_0x35960f=_(_0x35960f)['union'](_0x11acef)[_0x45a6('0x92')]()[_0x45a6('0x32')]();return db['VoiceQueue']['find']({'where':{'id':_0x582eb4[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](function(_0x36c6dd){return db['sequelize'][_0x45a6('0x76')](function(_0x3c65f5){return _0x36c6dd[_0x45a6('0x83')](_0x582eb4[_0x45a6('0x40')]['ids'],{'transaction':_0x3c65f5})[_0x45a6('0x2b')](function(){if(!_['isEmpty'](_0x35960f)){return _0x36c6dd[_0x45a6('0x93')](_0x35960f,{'transaction':_0x3c65f5})['then'](function(){return db['UserVoiceQueueRt'][_0x45a6('0x62')]({'where':{'VoiceQueueId':_0x582eb4['params']['id'],'UserId':_0x35960f},'transaction':_0x3c65f5});});}})[_0x45a6('0x2b')](function(){_0x35960f['forEach'](function(_0x1febe8){socket['emit'](_0x45a6('0x94'),{'UserId':_0x1febe8,'VoiceQueueId':_0x36c6dd['id']});});});});});});})[_0x45a6('0x2b')](respondWithStatusCode(_0x3f25aa,null))[_0x45a6('0x56')](handleError(_0x3f25aa,null));};exports[_0x45a6('0x95')]=function(_0xe11ff5,_0x18cbb2,_0x212ee2){var _0x126bb9,_0xb9305c;return db[_0x45a6('0x4e')][_0x45a6('0x35')]({'where':{'id':_0xe11ff5['params']['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x18cbb2,null))[_0x45a6('0x2b')](function(_0x35b7bd){if(_0x35b7bd){_0xb9305c=_0x35b7bd;return _0x35b7bd['addAgents'](_0xe11ff5[_0x45a6('0x58')][_0x45a6('0x96')],_['omit'](_0xe11ff5[_0x45a6('0x58')],[_0x45a6('0x96'),'id'])||{})[_0x45a6('0x97')](function(_0x2f6a48){for(var _0x1ca99a=0x0;_0x1ca99a<_0xe11ff5[_0x45a6('0x58')][_0x45a6('0x96')][_0x45a6('0x46')];_0x1ca99a+=0x1){socket[_0x45a6('0x81')]('userVoiceQueue:save',{'UserId':Number(_0xe11ff5[_0x45a6('0x58')]['ids'][_0x1ca99a]),'VoiceQueueId':Number(_0xe11ff5[_0x45a6('0x54')]['id'])});}return _0x2f6a48;});}})['then'](function(_0x200003){_0x126bb9=_0x200003||[];if(_0xb9305c){return db[_0x45a6('0x70')][_0x45a6('0x51')]({'where':{'id':_0xe11ff5[_0x45a6('0x58')][_0x45a6('0x96')]},'attributes':['id','name',_0x45a6('0x71'),_0x45a6('0x80'),'interface'],'raw':!![]});}})['then'](function(_0x1e522e){if(!_[_0x45a6('0x98')](_0x1e522e)){var _0x15c784=[];for(var _0x507d1d=0x0;_0x507d1d<_0x1e522e[_0x45a6('0x46')];_0x507d1d++){if(_0x1e522e[_0x507d1d][_0x45a6('0x71')]){_0x15c784[_0x45a6('0x8c')](db['UserVoiceQueueRt'][_0x45a6('0x7c')]({'membername':_0x1e522e[_0x507d1d][_0x45a6('0x36')],'UserId':_0x1e522e[_0x507d1d]['id'],'queue_name':_0xb9305c[_0x45a6('0x36')],'VoiceQueueId':_0xb9305c['id'],'interface':_[_0x45a6('0x7d')](_0x1e522e[_0x507d1d][_0x45a6('0x7e')])?util[_0x45a6('0x7f')](_0x45a6('0x99'),_0x1e522e[_0x507d1d][_0x45a6('0x36')]):_0x1e522e[_0x507d1d][_0x45a6('0x7e')],'paused':_0x1e522e[_0x507d1d][_0x45a6('0x80')]||![],'penalty':_0xe11ff5[_0x45a6('0x58')][_0x45a6('0x74')]||0x0}));}}return BPromise[_0x45a6('0x91')](_0x15c784);}})['then'](function(){return _0x126bb9;})[_0x45a6('0x2b')](respondWithResult(_0x18cbb2,null))['catch'](handleError(_0x18cbb2,null));};exports[_0x45a6('0x93')]=function(_0x477412,_0x248bf4,_0x417385){return db[_0x45a6('0x4e')]['find']({'where':{'id':_0x477412[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x248bf4,null))[_0x45a6('0x2b')](function(_0x157a2b){if(_0x157a2b){return _0x157a2b['removeAgents'](_0x477412[_0x45a6('0x40')][_0x45a6('0x96')])[_0x45a6('0x2b')](function(){if(_[_0x45a6('0x9a')](_0x477412[_0x45a6('0x40')][_0x45a6('0x96')])){for(var _0x51aa27=0x0;_0x51aa27<_0x477412[_0x45a6('0x40')]['ids'][_0x45a6('0x46')];_0x51aa27+=0x1){socket[_0x45a6('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x477412[_0x45a6('0x40')][_0x45a6('0x96')][_0x51aa27]),'VoiceQueueId':Number(_0x477412['params']['id'])});}}else{socket[_0x45a6('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x477412['query'][_0x45a6('0x96')]),'VoiceQueueId':Number(_0x477412[_0x45a6('0x54')]['id'])});}});}})[_0x45a6('0x2b')](function(_0x1299dc){return db[_0x45a6('0x9b')][_0x45a6('0x62')]({'where':{'VoiceQueueId':_0x477412['params']['id'],'UserId':_0x477412[_0x45a6('0x40')]['ids']}})[_0x45a6('0x2b')](function(){return _0x1299dc;});})['then'](respondWithStatusCode(_0x248bf4,null))[_0x45a6('0x56')](handleError(_0x248bf4,null));};exports['getAgents']=function(_0x96166a,_0x3d2791,_0x236f44){var _0x51a44b={};var _0x518d25={};var _0x5c3ff6;var _0x2abd64;return db[_0x45a6('0x4e')][_0x45a6('0x63')]({'where':{'id':_0x96166a[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x3d2791,null))[_0x45a6('0x2b')](function(_0x557b6a){if(_0x557b6a){_0x5c3ff6=_0x557b6a;_0x518d25[_0x45a6('0x43')]=_[_0x45a6('0x3f')](db[_0x45a6('0x70')]['rawAttributes']);_0x518d25[_0x45a6('0x40')]=_[_0x45a6('0x3f')](_0x96166a[_0x45a6('0x40')]);_0x518d25['filters']=_[_0x45a6('0x42')](_0x518d25[_0x45a6('0x43')],_0x518d25[_0x45a6('0x40')]);_0x51a44b[_0x45a6('0x44')]=_[_0x45a6('0x42')](_0x518d25[_0x45a6('0x43')],qs[_0x45a6('0x45')](_0x96166a['query'][_0x45a6('0x45')]));_0x51a44b[_0x45a6('0x44')]=_0x51a44b[_0x45a6('0x44')][_0x45a6('0x46')]?_0x51a44b[_0x45a6('0x44')]:_0x518d25[_0x45a6('0x43')];_0x51a44b[_0x45a6('0x68')]=qs[_0x45a6('0x48')](_0x96166a[_0x45a6('0x40')]['sort']);_0x51a44b['where']=qs[_0x45a6('0x41')](_[_0x45a6('0x4a')](_0x96166a[_0x45a6('0x40')],_0x518d25[_0x45a6('0x41')]));if(_0x96166a[_0x45a6('0x40')]['filter']){_0x51a44b[_0x45a6('0x49')]=_[_0x45a6('0x4b')](_0x51a44b[_0x45a6('0x49')],{'$or':_[_0x45a6('0x31')](_0x51a44b[_0x45a6('0x44')],function(_0x2a07b4){var _0x4dd61a={};_0x4dd61a[_0x2a07b4]={'$like':'%'+_0x96166a[_0x45a6('0x40')][_0x45a6('0x30')]+'%'};return _0x4dd61a;})});}_0x51a44b=_['merge']({},_0x51a44b,_0x96166a[_0x45a6('0x4d')]);return _0x5c3ff6['getAgents'](_0x51a44b);}})[_0x45a6('0x2b')](function(_0x44f574){if(_0x44f574){_0x2abd64=_0x44f574['length'];if(!_0x96166a[_0x45a6('0x40')][_0x45a6('0x65')](_0x45a6('0x47'))){_0x51a44b[_0x45a6('0x23')]=qs['limit'](_0x96166a[_0x45a6('0x40')][_0x45a6('0x23')]);_0x51a44b[_0x45a6('0x25')]=qs[_0x45a6('0x25')](_0x96166a['query'][_0x45a6('0x25')]);}return _0x5c3ff6[_0x45a6('0x9c')](_0x51a44b);}})[_0x45a6('0x2b')](function(_0x405257){if(_0x405257){return _0x405257?{'count':_0x2abd64,'rows':_0x405257}:null;}})[_0x45a6('0x2b')](respondWithResult(_0x3d2791,null))[_0x45a6('0x56')](handleError(_0x3d2791,null));};exports['getMembers']=function(_0x42f892,_0x5f0a7f,_0x4018cf){var _0x46bb05={};var _0x517b16={};var _0x440993;var _0x2b090a;return db['VoiceQueue'][_0x45a6('0x63')]({'where':{'id':_0x42f892[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x5f0a7f,null))[_0x45a6('0x2b')](function(_0x4083ed){if(_0x4083ed){_0x440993=_0x4083ed;_0x517b16[_0x45a6('0x43')]=_['keys'](db[_0x45a6('0x9b')][_0x45a6('0x55')]);_0x517b16['query']=_[_0x45a6('0x3f')](_0x42f892['query']);_0x517b16[_0x45a6('0x41')]=_['intersection'](_0x517b16[_0x45a6('0x43')],_0x517b16[_0x45a6('0x40')]);_0x46bb05[_0x45a6('0x44')]=_['intersection'](_0x517b16[_0x45a6('0x43')],qs['fields'](_0x42f892[_0x45a6('0x40')][_0x45a6('0x45')]));_0x46bb05[_0x45a6('0x44')]=_0x46bb05[_0x45a6('0x44')][_0x45a6('0x46')]?_0x46bb05[_0x45a6('0x44')]:_0x517b16[_0x45a6('0x43')];_0x46bb05[_0x45a6('0x68')]=qs['sort'](_0x42f892[_0x45a6('0x40')][_0x45a6('0x48')]);_0x46bb05[_0x45a6('0x49')]=qs[_0x45a6('0x41')](_[_0x45a6('0x4a')](_0x42f892[_0x45a6('0x40')],_0x517b16[_0x45a6('0x41')]));if(_0x42f892['query'][_0x45a6('0x30')]){_0x46bb05['where']=_[_0x45a6('0x4b')](_0x46bb05[_0x45a6('0x49')],{'$or':_[_0x45a6('0x31')](_0x46bb05[_0x45a6('0x44')],function(_0x4083df){var _0x394c7c={};_0x394c7c[_0x4083df]={'$like':'%'+_0x42f892['query'][_0x45a6('0x30')]+'%'};return _0x394c7c;})});}_0x46bb05=_[_0x45a6('0x4b')]({},_0x46bb05,_0x42f892[_0x45a6('0x4d')]);return _0x440993['getMembers'](_0x46bb05);}})[_0x45a6('0x2b')](function(_0x32cc36){if(_0x32cc36){_0x2b090a=_0x32cc36[_0x45a6('0x46')];if(!_0x42f892['query'][_0x45a6('0x65')](_0x45a6('0x47'))){_0x46bb05['limit']=qs[_0x45a6('0x23')](_0x42f892[_0x45a6('0x40')][_0x45a6('0x23')]);_0x46bb05[_0x45a6('0x25')]=qs[_0x45a6('0x25')](_0x42f892['query']['offset']);}return _0x440993[_0x45a6('0x9d')](_0x46bb05);}})['then'](function(_0x1d6631){return _0x1d6631?{'count':_0x2b090a,'rows':_0x1d6631}:null;})[_0x45a6('0x2b')](respondWithResult(_0x5f0a7f,null))[_0x45a6('0x56')](handleError(_0x5f0a7f,null));};exports[_0x45a6('0x9e')]=function(_0x11820c,_0x31c5d3,_0xf21d02){var _0x25b9de={};var _0xf6c41d={};var _0x37b481;var _0x216c12;return db[_0x45a6('0x4e')][_0x45a6('0x63')]({'where':{'id':_0x11820c[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x31c5d3,null))['then'](function(_0x122d26){if(_0x122d26){_0x37b481=_0x122d26;_0xf6c41d['model']=_[_0x45a6('0x3f')](db[_0x45a6('0x9f')][_0x45a6('0x55')]);_0xf6c41d[_0x45a6('0x40')]=_['keys'](_0x11820c[_0x45a6('0x40')]);_0xf6c41d['filters']=_[_0x45a6('0x42')](_0xf6c41d[_0x45a6('0x43')],_0xf6c41d[_0x45a6('0x40')]);_0x25b9de[_0x45a6('0x44')]=_['intersection'](_0xf6c41d[_0x45a6('0x43')],qs[_0x45a6('0x45')](_0x11820c['query'][_0x45a6('0x45')]));_0x25b9de['attributes']=_0x25b9de['attributes'][_0x45a6('0x46')]?_0x25b9de[_0x45a6('0x44')]:_0xf6c41d[_0x45a6('0x43')];_0x25b9de[_0x45a6('0x68')]=qs[_0x45a6('0x48')](_0x11820c[_0x45a6('0x40')][_0x45a6('0x48')]);_0x25b9de[_0x45a6('0x49')]=qs[_0x45a6('0x41')](_[_0x45a6('0x4a')](_0x11820c[_0x45a6('0x40')],_0xf6c41d['filters']));if(_0x11820c['query']['filter']){_0x25b9de[_0x45a6('0x49')]=_[_0x45a6('0x4b')](_0x25b9de[_0x45a6('0x49')],{'$or':_['map'](_0x25b9de[_0x45a6('0x44')],function(_0x442696){var _0x73340d={};_0x73340d[_0x442696]={'$like':'%'+_0x11820c[_0x45a6('0x40')][_0x45a6('0x30')]+'%'};return _0x73340d;})});}_0x25b9de=_['merge']({},_0x25b9de,_0x11820c[_0x45a6('0x4d')]);return _0x37b481[_0x45a6('0x9e')](_0x25b9de);}})[_0x45a6('0x2b')](function(_0x1065bb){if(_0x1065bb){_0x216c12=_0x1065bb[_0x45a6('0x46')];if(!_0x11820c['query'][_0x45a6('0x65')](_0x45a6('0x47'))){_0x25b9de[_0x45a6('0x23')]=qs[_0x45a6('0x23')](_0x11820c[_0x45a6('0x40')][_0x45a6('0x23')]);_0x25b9de[_0x45a6('0x25')]=qs[_0x45a6('0x25')](_0x11820c[_0x45a6('0x40')][_0x45a6('0x25')]);}return _0x37b481[_0x45a6('0x9e')](_0x25b9de);}})[_0x45a6('0x2b')](function(_0x53e106){if(_0x53e106){return _0x53e106?{'count':_0x216c12,'rows':_0x53e106}:null;}})[_0x45a6('0x2b')](respondWithResult(_0x31c5d3,null))[_0x45a6('0x56')](handleError(_0x31c5d3,null));};exports[_0x45a6('0xa0')]=function(_0x39723f,_0x456e8f,_0x54b6de){var _0x527818,_0xedead9;return db[_0x45a6('0x4e')][_0x45a6('0x35')]({'where':{'id':_0x39723f['params']['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x456e8f,null))[_0x45a6('0x2b')](function(_0x3f752b){if(_0x3f752b){_0xedead9=_0x3f752b;return _0x3f752b[_0x45a6('0xa0')](_0x39723f[_0x45a6('0x58')]['ids'],_[_0x45a6('0x5e')](_0x39723f[_0x45a6('0x58')],[_0x45a6('0x96'),'id'])||{});}return null;})[_0x45a6('0x97')](function(_0xd667c4){var _0x2af44c;_0x527818=_0xd667c4||[];var _0x5e039e=[];if(_0xd667c4){for(var _0x38c56e=0x0;_0x38c56e<_0xd667c4['length'];_0x38c56e+=0x1){var _0x3a4a2=_0xd667c4[_0x38c56e][_0x45a6('0x2c')]({'plain':!![]});_0xedead9[_0x45a6('0xa1')]=_0x39723f[_0x45a6('0x58')]['dialCheckDuplicateType']?_0x39723f[_0x45a6('0x58')]['dialCheckDuplicateType']:_0xedead9[_0x45a6('0xa1')];switch(_0xedead9[_0x45a6('0xa1')]){case'always':_0x2af44c=squel[_0x45a6('0xa2')]()[_0x45a6('0xa3')](_0x45a6('0xa4'))[_0x45a6('0xa5')](['phone',_0x45a6('0xa6'),_0x45a6('0xa7'),_0x45a6('0xa8'),_0x45a6('0x66'),'createdAt','updatedAt'],squel[_0x45a6('0x84')]()[_0x45a6('0x85')](_0x45a6('0xa9'),_0x45a6('0xa9'))[_0x45a6('0x85')](_0x45a6('0xaa'),_0x45a6('0xa6'))[_0x45a6('0x85')]('id',_0x45a6('0xa7'))[_0x45a6('0x85')](_0x3a4a2['CmListId']['toString'](),'ListId')[_0x45a6('0x85')](_0x39723f[_0x45a6('0x54')]['id'][_0x45a6('0x8d')](),'VoiceQueueId')[_0x45a6('0x85')]('NOW()',_0x45a6('0x5f'))[_0x45a6('0x85')](_0x45a6('0xaa'),_0x45a6('0xab'))[_0x45a6('0x87')](_0x45a6('0xac'))[_0x45a6('0x49')](_0x45a6('0xad'))[_0x45a6('0x49')]('ListId\x20=\x20?',_0x3a4a2[_0x45a6('0xae')][_0x45a6('0x8d')]())[_0x45a6('0x49')](_0x45a6('0xaf'))[_0x45a6('0x49')](_0x45a6('0xb0'),squel[_0x45a6('0x84')]()[_0x45a6('0x85')](_0x45a6('0xb1'))[_0x45a6('0x87')](_0x45a6('0xb2'))[_0x45a6('0x49')](_0x45a6('0xb3'),_0x39723f[_0x45a6('0x54')]['id'][_0x45a6('0x8d')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x45a6('0x84')]()[_0x45a6('0x85')](_0x45a6('0xb4'))[_0x45a6('0x87')]('cm_hopper')[_0x45a6('0x49')](_0x45a6('0xb3'),_0x39723f[_0x45a6('0x54')]['id'][_0x45a6('0x8d')]())))[_0x45a6('0x8d')]();break;case _0x45a6('0xb5'):_0x2af44c=squel[_0x45a6('0xa2')]()[_0x45a6('0xa3')](_0x45a6('0xa4'))[_0x45a6('0xa5')]([_0x45a6('0xa9'),_0x45a6('0xa6'),_0x45a6('0xa7'),_0x45a6('0xa8'),_0x45a6('0x66'),'createdAt','updatedAt'],squel['select']()[_0x45a6('0x85')](_0x45a6('0xa9'),_0x45a6('0xa9'))[_0x45a6('0x85')](_0x45a6('0xaa'),_0x45a6('0xa6'))[_0x45a6('0x85')]('id','ContactId')['field'](_0x3a4a2[_0x45a6('0xae')]['toString'](),'ListId')[_0x45a6('0x85')](_0x39723f['params']['id'][_0x45a6('0x8d')](),_0x45a6('0x66'))['field']('NOW()',_0x45a6('0x5f'))['field']('NOW()',_0x45a6('0xab'))[_0x45a6('0x87')]('cm_contacts')[_0x45a6('0x49')](_0x45a6('0xad'))[_0x45a6('0x49')](_0x45a6('0xb6'),_0x3a4a2[_0x45a6('0xae')][_0x45a6('0x8d')]())[_0x45a6('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0x45a6('0x49')](_0x45a6('0xb0'),squel['select']()['field'](_0x45a6('0xb4'))[_0x45a6('0x87')](_0x45a6('0xa4'))[_0x45a6('0x49')](_0x45a6('0xb3'),_0x39723f['params']['id']['toString']())))[_0x45a6('0x8d')]();break;default:_0x2af44c=squel[_0x45a6('0xa2')]()[_0x45a6('0xa3')](_0x45a6('0xa4'))[_0x45a6('0xa5')]([_0x45a6('0xa9'),'scheduledAt',_0x45a6('0xa7'),_0x45a6('0xa8'),'VoiceQueueId','createdAt','updatedAt'],squel['select']()[_0x45a6('0x85')](_0x45a6('0xa9'),_0x45a6('0xa9'))[_0x45a6('0x85')]('NOW()',_0x45a6('0xa6'))[_0x45a6('0x85')]('id',_0x45a6('0xa7'))[_0x45a6('0x85')](_0x3a4a2[_0x45a6('0xae')]['toString'](),_0x45a6('0xa8'))['field'](_0x39723f[_0x45a6('0x54')]['id'][_0x45a6('0x8d')](),_0x45a6('0x66'))[_0x45a6('0x85')](_0x45a6('0xaa'),_0x45a6('0x5f'))['field'](_0x45a6('0xaa'),_0x45a6('0xab'))['from'](_0x45a6('0xac'))['where'](_0x45a6('0xad'))['where'](_0x45a6('0xb6'),_0x3a4a2[_0x45a6('0xae')]['toString']())['where'](_0x45a6('0xaf')))[_0x45a6('0x8d')]();}_0x5e039e[_0x45a6('0x8c')](db[_0x45a6('0x75')]['query'](_0x2af44c));}return BPromise[_0x45a6('0x91')](_0x5e039e);}})[_0x45a6('0x2b')](function(){return _0x527818;})['then'](respondWithResult(_0x456e8f,null))[_0x45a6('0x56')](handleError(_0x456e8f,null));};exports['removeLists']=function(_0x17211b,_0x29a755,_0x2b1778){return db['VoiceQueue'][_0x45a6('0x35')]({'where':{'id':_0x17211b[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x29a755,null))[_0x45a6('0x2b')](function(_0x1c1b7c){if(_0x1c1b7c){return _0x1c1b7c[_0x45a6('0xb7')](_0x17211b['query'][_0x45a6('0x96')]);}})[_0x45a6('0x2b')](function(_0x4324db){if(_0x4324db){return db[_0x45a6('0x64')][_0x45a6('0x62')]({'where':{'ListId':_0x17211b[_0x45a6('0x40')][_0x45a6('0x96')],'VoiceQueueId':_0x17211b[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](function(){return _0x4324db;});}})[_0x45a6('0x2b')](respondWithStatusCode(_0x29a755,null))[_0x45a6('0x56')](handleError(_0x29a755,null));};exports['getBlackLists']=function(_0x73927f,_0x3cbbbf,_0x2785ad){var _0x35342c={};var _0x36e6c3={};var _0x32a3d2;var _0x7f1ad2;return db[_0x45a6('0x4e')][_0x45a6('0x63')]({'where':{'id':_0x73927f[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x3cbbbf,null))[_0x45a6('0x2b')](function(_0x47d19a){if(_0x47d19a){_0x32a3d2=_0x47d19a;_0x36e6c3[_0x45a6('0x43')]=_[_0x45a6('0x3f')](db['CmList'][_0x45a6('0x55')]);_0x36e6c3['query']=_[_0x45a6('0x3f')](_0x73927f[_0x45a6('0x40')]);_0x36e6c3['filters']=_[_0x45a6('0x42')](_0x36e6c3[_0x45a6('0x43')],_0x36e6c3[_0x45a6('0x40')]);_0x35342c[_0x45a6('0x44')]=_['intersection'](_0x36e6c3[_0x45a6('0x43')],qs['fields'](_0x73927f[_0x45a6('0x40')]['fields']));_0x35342c[_0x45a6('0x44')]=_0x35342c[_0x45a6('0x44')][_0x45a6('0x46')]?_0x35342c[_0x45a6('0x44')]:_0x36e6c3['model'];_0x35342c[_0x45a6('0x68')]=qs['sort'](_0x73927f[_0x45a6('0x40')][_0x45a6('0x48')]);_0x35342c['where']=qs[_0x45a6('0x41')](_[_0x45a6('0x4a')](_0x73927f['query'],_0x36e6c3[_0x45a6('0x41')]));if(_0x73927f[_0x45a6('0x40')][_0x45a6('0x30')]){_0x35342c[_0x45a6('0x49')]=_[_0x45a6('0x4b')](_0x35342c[_0x45a6('0x49')],{'$or':_[_0x45a6('0x31')](_0x35342c[_0x45a6('0x44')],function(_0x14a43b){var _0x3d18ee={};_0x3d18ee[_0x14a43b]={'$like':'%'+_0x73927f[_0x45a6('0x40')][_0x45a6('0x30')]+'%'};return _0x3d18ee;})});}_0x35342c=_[_0x45a6('0x4b')]({},_0x35342c,_0x73927f[_0x45a6('0x4d')]);return _0x32a3d2['getBlackLists'](_0x35342c);}})[_0x45a6('0x2b')](function(_0x11789d){if(_0x11789d){_0x7f1ad2=_0x11789d[_0x45a6('0x46')];if(!_0x73927f[_0x45a6('0x40')][_0x45a6('0x65')]('nolimit')){_0x35342c[_0x45a6('0x23')]=qs['limit'](_0x73927f[_0x45a6('0x40')]['limit']);_0x35342c[_0x45a6('0x25')]=qs[_0x45a6('0x25')](_0x73927f[_0x45a6('0x40')][_0x45a6('0x25')]);}return _0x32a3d2['getBlackLists'](_0x35342c);}})['then'](function(_0xb05eaf){if(_0xb05eaf){return _0xb05eaf?{'count':_0x7f1ad2,'rows':_0xb05eaf}:null;}})[_0x45a6('0x2b')](respondWithResult(_0x3cbbbf,null))[_0x45a6('0x56')](handleError(_0x3cbbbf,null));};exports[_0x45a6('0xb8')]=function(_0x458220,_0x1cc682,_0x51424e){var _0x4fe1bc,_0x3da6ee;return db[_0x45a6('0x4e')]['find']({'where':{'id':_0x458220['params']['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0x1cc682,null))[_0x45a6('0x2b')](function(_0xdba14b){if(_0xdba14b){_0x3da6ee=_0xdba14b;return _0xdba14b[_0x45a6('0xb8')](_0x458220['body']['ids'],_[_0x45a6('0x5e')](_0x458220[_0x45a6('0x58')],[_0x45a6('0x96'),'id'])||{});}return null;})[_0x45a6('0x97')](function(_0x29ab13){var _0x3a7d70;_0x4fe1bc=_0x29ab13||[];var _0x51030a=[];if(_0x29ab13){for(var _0x6c5af=0x0;_0x6c5af<_0x29ab13[_0x45a6('0x46')];_0x6c5af+=0x1){var _0x3b224d=_0x29ab13[_0x6c5af][_0x45a6('0x2c')]({'plain':!![]});_0x3a7d70=squel[_0x45a6('0xa2')]()[_0x45a6('0xa3')]('cm_hopper_black')[_0x45a6('0xa5')]([_0x45a6('0xa9'),'ContactId',_0x45a6('0xa8'),_0x45a6('0x66'),_0x45a6('0x5f'),_0x45a6('0xab')],squel[_0x45a6('0x84')]()[_0x45a6('0x85')](_0x45a6('0xa9'),_0x45a6('0xa9'))[_0x45a6('0x85')]('id','ContactId')['field'](_0x3b224d[_0x45a6('0xae')][_0x45a6('0x8d')](),_0x45a6('0xa8'))[_0x45a6('0x85')](_0x458220[_0x45a6('0x54')]['id'][_0x45a6('0x8d')](),_0x45a6('0x66'))[_0x45a6('0x85')]('NOW()',_0x45a6('0x5f'))[_0x45a6('0x85')](_0x45a6('0xaa'),_0x45a6('0xab'))[_0x45a6('0x87')](_0x45a6('0xac'))[_0x45a6('0x49')](_0x45a6('0xad'))['where'](_0x45a6('0xb6'),_0x3b224d[_0x45a6('0xae')][_0x45a6('0x8d')]())['where'](_0x45a6('0xaf')))['toString']();_0x51030a[_0x45a6('0x8c')](db[_0x45a6('0x75')][_0x45a6('0x40')](_0x3a7d70));}return BPromise['all'](_0x51030a);}})[_0x45a6('0x2b')](function(){return _0x4fe1bc;})[_0x45a6('0x2b')](respondWithResult(_0x1cc682,null))[_0x45a6('0x56')](handleError(_0x1cc682,null));};exports[_0x45a6('0xb9')]=function(_0x1fe494,_0xb81b60,_0x12372a){return db['VoiceQueue'][_0x45a6('0x35')]({'where':{'id':_0x1fe494[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](handleEntityNotFound(_0xb81b60,null))[_0x45a6('0x2b')](function(_0x13f567){if(_0x13f567){return _0x13f567[_0x45a6('0xb9')](_0x1fe494[_0x45a6('0x40')]['ids']);}})['then'](function(_0x4404f8){if(_0x4404f8){return db['CmHopperBlack'][_0x45a6('0x62')]({'where':{'ListId':_0x1fe494[_0x45a6('0x40')][_0x45a6('0x96')],'VoiceQueueId':_0x1fe494[_0x45a6('0x54')]['id']}})[_0x45a6('0x2b')](function(){return _0x4404f8;});}})[_0x45a6('0x2b')](respondWithStatusCode(_0xb81b60,null))['catch'](handleError(_0xb81b60,null));}; \ No newline at end of file +var _0x0460=['value','includes','type','find','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getHoppers','findOne','CmHopper','rows','getHopperHistories','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','removeTeams','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','toString','QueryTypes','SELECT','every','TeamId','union','ids','isEmpty','emit','addAgents','spread','userVoiceQueue:save','push','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ListId','field','NOW()','ContactId','CmListId','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','onlyIfOpen','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0460,0x89));var _0x0046=function(_0x8b0efc,_0x1c44fb){_0x8b0efc=_0x8b0efc-0x0;var _0x135945=_0x0460[_0x8b0efc];return _0x135945;};'use strict';var emlformat=require(_0x0046('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0046('0x1'));var jsonpatch=require(_0x0046('0x2'));var rp=require(_0x0046('0x3'));var moment=require(_0x0046('0x4'));var BPromise=require(_0x0046('0x5'));var Mustache=require(_0x0046('0x6'));var util=require(_0x0046('0x7'));var path=require('path');var sox=require(_0x0046('0x8'));var csv=require(_0x0046('0x9'));var ejs=require(_0x0046('0xa'));var fs=require('fs');var fs_extra=require(_0x0046('0xb'));var _=require('lodash');var squel=require(_0x0046('0xc'));var crypto=require(_0x0046('0xd'));var jsforce=require(_0x0046('0xe'));var deskjs=require(_0x0046('0xf'));var toCsv=require(_0x0046('0x9'));var querystring=require(_0x0046('0x10'));var Papa=require(_0x0046('0x11'));var Redis=require(_0x0046('0x12'));var authService=require(_0x0046('0x13'));var qs=require(_0x0046('0x14'));var as=require(_0x0046('0x15'));var hardwareService=require(_0x0046('0x16'));var logger=require(_0x0046('0x17'))(_0x0046('0x18'));var utils=require(_0x0046('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0046('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0046('0x1b')](config[_0x0046('0x1c')],{'host':_0x0046('0x1d'),'port':0x18eb});var socket=require(_0x0046('0x1e'))(new Redis(config['redis']));require(_0x0046('0x1f'))['register'](socket);function respondWithStatusCode(_0x19392d,_0x128cee){_0x128cee=_0x128cee||0xcc;return function(_0x286148){if(_0x286148){return _0x19392d[_0x0046('0x20')](_0x128cee);}return _0x19392d[_0x0046('0x21')](_0x128cee)[_0x0046('0x22')]();};}function respondWithResult(_0x138883,_0x2df813){_0x2df813=_0x2df813||0xc8;return function(_0x222c8c){if(_0x222c8c){return _0x138883['status'](_0x2df813)[_0x0046('0x23')](_0x222c8c);}};}function respondWithFilteredResult(_0x5d9c2a,_0x33c9b5){return function(_0x4b5429){if(_0x4b5429){var _0x558f6b=typeof _0x33c9b5[_0x0046('0x24')]==='undefined'&&typeof _0x33c9b5[_0x0046('0x25')]===_0x0046('0x26');var _0xc805a3=_0x4b5429[_0x0046('0x27')];var _0x55cc45=_0x558f6b?0x0:_0x33c9b5[_0x0046('0x24')];var _0x241520=_0x558f6b?_0x4b5429[_0x0046('0x27')]:_0x33c9b5[_0x0046('0x24')]+_0x33c9b5[_0x0046('0x25')];var _0x317836;if(_0x241520>=_0xc805a3){_0x241520=_0xc805a3;_0x317836=0xc8;}else{_0x317836=0xce;}_0x5d9c2a[_0x0046('0x21')](_0x317836);return _0x5d9c2a[_0x0046('0x28')](_0x0046('0x29'),_0x55cc45+'-'+_0x241520+'/'+_0xc805a3)[_0x0046('0x23')](_0x4b5429);}return null;};}function patchUpdates(_0x2ce268){return function(_0x70b03e){try{jsonpatch['apply'](_0x70b03e,_0x2ce268,!![]);}catch(_0x4ecbbd){return BPromise[_0x0046('0x2a')](_0x4ecbbd);}return _0x70b03e[_0x0046('0x2b')]();};}function saveUpdates(_0x1d4847,_0x52770e){return function(_0xdf7cb3){if(_0xdf7cb3){return _0xdf7cb3[_0x0046('0x2c')](_0x1d4847)[_0x0046('0x2d')](function(_0x27b48d){return _0x27b48d;});}return null;};}function removeEntity(_0x41c02d,_0x5379d0){return function(_0x14c96d){if(_0x14c96d){return _0x14c96d[_0x0046('0x2e')]()[_0x0046('0x2d')](function(){var _0xbc3833=_0x14c96d['get']({'plain':!![]});var _0x4cbb49=[{'name':_0x0046('0x2f'),'value':_0x0046('0x30'),'ignore':![]},{'name':_0x0046('0x31'),'value':_0x0046('0x32'),'ignore':![]}];var _0x31ebbb=_(_0x4cbb49)[_0x0046('0x33')](_0x0046('0x34'))['map']('value')[_0x0046('0x35')]();if(_[_0x0046('0x36')](_0x31ebbb,_0xbc3833[_0x0046('0x37')])){return;}var _0x4372ed=_[_0x0046('0x38')](_0x4cbb49,[_0x0046('0x35'),_0xbc3833[_0x0046('0x37')]])[_0x0046('0x39')];return db[_0x0046('0x3a')][_0x0046('0x2e')]({'where':{'type':_0x4372ed,'resourceId':_0xbc3833['id']}})[_0x0046('0x2d')](function(){return _0x14c96d;});})[_0x0046('0x2d')](function(){_0x41c02d[_0x0046('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x311b5e,_0x592862){return function(_0x5e6104){if(!_0x5e6104){_0x311b5e['sendStatus'](0x194);}return _0x5e6104;};}function handleError(_0x32bddf,_0x2c4f58){_0x2c4f58=_0x2c4f58||0x1f4;return function(_0x9413e8){logger[_0x0046('0x3b')](_0x9413e8['stack']);if(_0x9413e8['name']){delete _0x9413e8[_0x0046('0x39')];}_0x32bddf[_0x0046('0x21')](_0x2c4f58)[_0x0046('0x3c')](_0x9413e8);};}exports[_0x0046('0x3d')]=function(_0x44fb56,_0x44405a){var _0x49dc04={},_0x952851={},_0x3ae22e={'count':0x0,'rows':[]};var _0x21f30c=_['map'](db[_0x0046('0x3e')][_0x0046('0x3f')],function(_0x58c919){return{'name':_0x58c919[_0x0046('0x40')],'type':_0x58c919[_0x0046('0x37')][_0x0046('0x41')]};});_0x952851[_0x0046('0x42')]=_[_0x0046('0x43')](_0x21f30c,'name');_0x952851[_0x0046('0x44')]=_[_0x0046('0x45')](_0x44fb56[_0x0046('0x44')]);_0x952851['filters']=_['intersection'](_0x952851[_0x0046('0x42')],_0x952851[_0x0046('0x44')]);_0x49dc04[_0x0046('0x46')]=_[_0x0046('0x47')](_0x952851['model'],qs[_0x0046('0x48')](_0x44fb56[_0x0046('0x44')]['fields']));_0x49dc04['attributes']=_0x49dc04[_0x0046('0x46')][_0x0046('0x49')]?_0x49dc04[_0x0046('0x46')]:_0x952851[_0x0046('0x42')];if(!_0x44fb56[_0x0046('0x44')][_0x0046('0x4a')](_0x0046('0x4b'))){_0x49dc04[_0x0046('0x25')]=qs[_0x0046('0x25')](_0x44fb56['query']['limit']);_0x49dc04['offset']=qs[_0x0046('0x24')](_0x44fb56[_0x0046('0x44')][_0x0046('0x24')]);}_0x49dc04[_0x0046('0x4c')]=qs[_0x0046('0x4d')](_0x44fb56['query'][_0x0046('0x4d')]);_0x49dc04[_0x0046('0x4e')]=qs['filters'](_[_0x0046('0x4f')](_0x44fb56[_0x0046('0x44')],_0x952851[_0x0046('0x50')]),_0x21f30c);if(_0x44fb56[_0x0046('0x44')][_0x0046('0x33')]){_0x49dc04[_0x0046('0x4e')]=_[_0x0046('0x51')](_0x49dc04[_0x0046('0x4e')],{'$or':_['map'](_0x21f30c,function(_0x3d785a){if(_0x3d785a[_0x0046('0x37')]!==_0x0046('0x52')){var _0x531691={};_0x531691[_0x3d785a[_0x0046('0x39')]]={'$like':'%'+_0x44fb56[_0x0046('0x44')][_0x0046('0x33')]+'%'};return _0x531691;}})});}_0x49dc04=_[_0x0046('0x51')]({},_0x49dc04,_0x44fb56[_0x0046('0x53')]);var _0x2819f7={'where':_0x49dc04['where']};return db[_0x0046('0x3e')]['count'](_0x2819f7)[_0x0046('0x2d')](function(_0x2e16dd){_0x3ae22e['count']=_0x2e16dd;if(_0x44fb56[_0x0046('0x44')][_0x0046('0x54')]){_0x49dc04[_0x0046('0x55')]=[{'all':!![]}];}return db[_0x0046('0x3e')][_0x0046('0x56')](_0x49dc04);})[_0x0046('0x2d')](function(_0x2223b8){_0x3ae22e['rows']=_0x2223b8;return _0x3ae22e;})[_0x0046('0x2d')](respondWithFilteredResult(_0x44405a,_0x49dc04))[_0x0046('0x57')](handleError(_0x44405a,null));};exports[_0x0046('0x58')]=function(_0x5883ee,_0x199ed7){var _0x1f770f={'raw':![],'where':{'id':_0x5883ee[_0x0046('0x59')]['id']}},_0xb14cb4={};_0xb14cb4[_0x0046('0x42')]=_['keys'](db[_0x0046('0x3e')][_0x0046('0x3f')]);_0xb14cb4[_0x0046('0x44')]=_['keys'](_0x5883ee[_0x0046('0x44')]);_0xb14cb4[_0x0046('0x50')]=_[_0x0046('0x47')](_0xb14cb4['model'],_0xb14cb4[_0x0046('0x44')]);_0x1f770f[_0x0046('0x46')]=_[_0x0046('0x47')](_0xb14cb4[_0x0046('0x42')],qs[_0x0046('0x48')](_0x5883ee[_0x0046('0x44')][_0x0046('0x48')]));_0x1f770f[_0x0046('0x46')]=_0x1f770f[_0x0046('0x46')]['length']?_0x1f770f['attributes']:_0xb14cb4[_0x0046('0x42')];if(_0x5883ee[_0x0046('0x44')]['includeAll']){_0x1f770f[_0x0046('0x55')]=[{'all':!![]}];}_0x1f770f=_[_0x0046('0x51')]({},_0x1f770f,_0x5883ee[_0x0046('0x53')]);return db[_0x0046('0x3e')][_0x0046('0x38')](_0x1f770f)[_0x0046('0x2d')](handleEntityNotFound(_0x199ed7,null))[_0x0046('0x2d')](respondWithResult(_0x199ed7,null))[_0x0046('0x57')](handleError(_0x199ed7,null));};exports['create']=function(_0x37b6e1,_0x283e5c){return db['VoiceQueue'][_0x0046('0x5a')](_0x37b6e1[_0x0046('0x5b')],{})[_0x0046('0x2d')](function(_0x3cad3b){var _0x22d96d=_0x37b6e1[_0x0046('0x5c')]['get']({'plain':!![]});if(!_0x22d96d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22d96d['role']===_0x0046('0x5c')){var _0x580710=_0x3cad3b[_0x0046('0x5d')]({'plain':!![]});var _0x513205=[{'name':_0x0046('0x2f'),'value':_0x0046('0x30')},{'name':_0x0046('0x31'),'value':_0x0046('0x32')}];var _0x478d12=_['find'](_0x513205,['value',_0x580710[_0x0046('0x37')]])[_0x0046('0x39')];return db['UserProfileSection'][_0x0046('0x38')]({'where':{'name':_0x478d12,'userProfileId':_0x22d96d[_0x0046('0x5e')]},'raw':!![]})[_0x0046('0x2d')](function(_0x54c0b9){if(_0x54c0b9&&_0x54c0b9[_0x0046('0x5f')]===0x0){return db[_0x0046('0x3a')][_0x0046('0x5a')]({'name':_0x580710[_0x0046('0x39')],'resourceId':_0x580710['id'],'type':_0x54c0b9[_0x0046('0x39')],'sectionId':_0x54c0b9['id']},{})['then'](function(){return _0x3cad3b;});}else{return _0x3cad3b;}})[_0x0046('0x57')](function(_0x162f5e){logger[_0x0046('0x3b')](_0x0046('0x60'),_0x162f5e);throw _0x162f5e;});}return _0x3cad3b;})[_0x0046('0x2d')](respondWithResult(_0x283e5c,0xc9))[_0x0046('0x57')](handleError(_0x283e5c,null));};exports[_0x0046('0x61')]=function(_0xc68c47,_0xb34213){var _0x5a3f69={'where':{'id':_0xc68c47['params']['id']}},_0x69c9ce={};_0x69c9ce[_0x0046('0x42')]=_[_0x0046('0x45')](db[_0x0046('0x3e')][_0x0046('0x3f')]);_0x5a3f69[_0x0046('0x46')]=_[_0x0046('0x47')](_0x69c9ce[_0x0046('0x42')],qs[_0x0046('0x48')](_0xc68c47[_0x0046('0x44')][_0x0046('0x48')]));_0x5a3f69[_0x0046('0x46')]=_0x5a3f69[_0x0046('0x46')][_0x0046('0x49')]?_0x5a3f69['attributes']:_0x69c9ce[_0x0046('0x42')];if(_0xc68c47[_0x0046('0x44')]['includeAll']){_0x5a3f69[_0x0046('0x55')]=[{'all':!![]}];}_0x5a3f69=_['merge']({},_0x5a3f69,_0xc68c47['options']);return db[_0x0046('0x3e')][_0x0046('0x38')](_0x5a3f69)[_0x0046('0x2d')](handleEntityNotFound(_0xb34213,null))['then'](function(_0x37f396){if(_0x37f396){var _0x367bae=_0x37f396[_0x0046('0x5d')]({'plain':!![]});_0x367bae=qs[_0x0046('0x62')](_0x367bae,['id',_0x0046('0x63'),_0x0046('0x64')]);_0xc68c47['body']=_[_0x0046('0x62')](_0xc68c47[_0x0046('0x5b')],['id',_0x0046('0x63'),_0x0046('0x64')]);return db['VoiceQueue'][_0x0046('0x5a')](_['merge'](_0x367bae,_0xc68c47['body']),{'include':_0xc68c47[_0x0046('0x44')][_0x0046('0x54')]?[{'all':!![]}]:undefined})[_0x0046('0x2d')](function(_0x51ef55){var _0x1c9804=_0xc68c47[_0x0046('0x5c')][_0x0046('0x5d')]({'plain':!![]});if(!_0x1c9804)throw new Error(_0x0046('0x65'));if(_0x1c9804[_0x0046('0x66')]===_0x0046('0x5c')){var _0x17a44a=_0x51ef55['get']({'plain':!![]});var _0x455077=[{'name':_0x0046('0x2f'),'value':_0x0046('0x30')},{'name':_0x0046('0x31'),'value':_0x0046('0x32')}];var _0xe4317a=_[_0x0046('0x38')](_0x455077,[_0x0046('0x35'),_0x17a44a[_0x0046('0x37')]])[_0x0046('0x39')];return db['UserProfileSection']['find']({'where':{'name':_0xe4317a,'userProfileId':_0x1c9804['userProfileId']},'raw':!![]})[_0x0046('0x2d')](function(_0x55d4a4){if(_0x55d4a4&&_0x55d4a4[_0x0046('0x5f')]===0x0){return db[_0x0046('0x3a')][_0x0046('0x5a')]({'name':_0x17a44a[_0x0046('0x39')],'resourceId':_0x17a44a['id'],'type':_0x55d4a4[_0x0046('0x39')],'sectionId':_0x55d4a4['id']},{})[_0x0046('0x2d')](function(){return _0x51ef55;});}else{return _0x51ef55;}})[_0x0046('0x57')](function(_0x2d6bb5){logger['error'](_0x0046('0x60'),_0x2d6bb5);throw _0x2d6bb5;});}return _0x51ef55;});}})[_0x0046('0x2d')](respondWithResult(_0xb34213,0xc9))[_0x0046('0x57')](handleError(_0xb34213,null));};exports[_0x0046('0x2c')]=function(_0x37dcb4,_0x1e3222){if(_0x37dcb4[_0x0046('0x5b')]['id']){delete _0x37dcb4['body']['id'];}return db[_0x0046('0x3e')]['find']({'where':{'id':_0x37dcb4[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x1e3222,null))['then'](saveUpdates(_0x37dcb4[_0x0046('0x5b')],null))[_0x0046('0x2d')](respondWithResult(_0x1e3222,null))[_0x0046('0x57')](handleError(_0x1e3222,null));};exports[_0x0046('0x2e')]=function(_0x5387de,_0x393030){return db[_0x0046('0x3e')][_0x0046('0x38')]({'where':{'id':_0x5387de['params']['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x393030,null))[_0x0046('0x2d')](removeEntity(_0x393030,null))[_0x0046('0x57')](handleError(_0x393030,null));};exports[_0x0046('0x67')]=function(_0xc648de,_0x48648e,_0x4f125b){var _0x26cf39={'raw':![],'where':{}};var _0x2686e7={};var _0x15d9ab={'count':0x0,'rows':[]};return db[_0x0046('0x3e')][_0x0046('0x68')]({'where':{'id':_0xc648de['params']['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x48648e,null))[_0x0046('0x2d')](function(_0x234494){if(_0x234494){_0x2686e7[_0x0046('0x42')]=_['keys'](db[_0x0046('0x69')][_0x0046('0x3f')]);_0x2686e7['query']=_[_0x0046('0x45')](_0xc648de[_0x0046('0x44')]);_0x2686e7[_0x0046('0x50')]=_['intersection'](_0x2686e7[_0x0046('0x42')],_0x2686e7['query']);_0x26cf39[_0x0046('0x46')]=_[_0x0046('0x47')](_0x2686e7[_0x0046('0x42')],qs[_0x0046('0x48')](_0xc648de[_0x0046('0x44')][_0x0046('0x48')]));_0x26cf39[_0x0046('0x46')]=_0x26cf39[_0x0046('0x46')][_0x0046('0x49')]?_0x26cf39[_0x0046('0x46')]:_0x2686e7[_0x0046('0x42')];if(!_0xc648de['query']['hasOwnProperty'](_0x0046('0x4b'))){_0x26cf39[_0x0046('0x25')]=qs['limit'](_0xc648de[_0x0046('0x44')]['limit']);_0x26cf39[_0x0046('0x24')]=qs[_0x0046('0x24')](_0xc648de['query'][_0x0046('0x24')]);}_0x26cf39[_0x0046('0x4c')]=qs['sort'](_0xc648de[_0x0046('0x44')][_0x0046('0x4d')]);_0x26cf39[_0x0046('0x4e')]=qs[_0x0046('0x50')](_['pick'](_0xc648de[_0x0046('0x44')],_0x2686e7['filters']));_0x26cf39['where']['VoiceQueueId']=_0x234494['id'];if(_0xc648de['query']['filter']){_0x26cf39[_0x0046('0x4e')]=_[_0x0046('0x51')](_0x26cf39[_0x0046('0x4e')],{'$or':_['map'](_0x26cf39['attributes'],function(_0x13ccdf){var _0x1dfe36={};_0x1dfe36[_0x13ccdf]={'$like':'%'+_0xc648de[_0x0046('0x44')][_0x0046('0x33')]+'%'};return _0x1dfe36;})});}_0x26cf39=_[_0x0046('0x51')]({},_0x26cf39,_0xc648de[_0x0046('0x53')]);return db[_0x0046('0x69')][_0x0046('0x27')]({'where':_0x26cf39[_0x0046('0x4e')]})[_0x0046('0x2d')](function(_0x220f14){_0x15d9ab[_0x0046('0x27')]=_0x220f14;if(_0xc648de['query'][_0x0046('0x54')]){_0x26cf39[_0x0046('0x55')]=[{'all':!![]}];}return db['CmHopper'][_0x0046('0x56')](_0x26cf39);})['then'](function(_0xbef3dc){_0x15d9ab[_0x0046('0x6a')]=_0xbef3dc;return _0x15d9ab;});}})[_0x0046('0x2d')](respondWithFilteredResult(_0x48648e,_0x26cf39))[_0x0046('0x57')](handleError(_0x48648e,null));};exports[_0x0046('0x6b')]=function(_0x198237,_0x5a88e8,_0x122d7a){var _0x225df4={'raw':!![],'where':{}};var _0x44c648={};var _0x51063d={'count':0x0,'rows':[]};return db[_0x0046('0x3e')][_0x0046('0x68')]({'where':{'id':_0x198237[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x5a88e8,null))[_0x0046('0x2d')](function(_0x5472da){if(_0x5472da){_0x44c648[_0x0046('0x42')]=_[_0x0046('0x45')](db['CmHopperHistory'][_0x0046('0x3f')]);_0x44c648['query']=_[_0x0046('0x45')](_0x198237['query']);_0x44c648[_0x0046('0x50')]=_[_0x0046('0x47')](_0x44c648[_0x0046('0x42')],_0x44c648['query']);_0x225df4[_0x0046('0x46')]=_[_0x0046('0x47')](_0x44c648[_0x0046('0x42')],qs[_0x0046('0x48')](_0x198237['query'][_0x0046('0x48')]));_0x225df4[_0x0046('0x46')]=_0x225df4[_0x0046('0x46')]['length']?_0x225df4[_0x0046('0x46')]:_0x44c648[_0x0046('0x42')];if(!_0x198237[_0x0046('0x44')][_0x0046('0x4a')]('nolimit')){_0x225df4['limit']=qs['limit'](_0x198237['query'][_0x0046('0x25')]);_0x225df4['offset']=qs[_0x0046('0x24')](_0x198237['query'][_0x0046('0x24')]);}_0x225df4[_0x0046('0x4c')]=qs[_0x0046('0x4d')](_0x198237['query'][_0x0046('0x4d')]);_0x225df4[_0x0046('0x4e')]=qs[_0x0046('0x50')](_[_0x0046('0x4f')](_0x198237[_0x0046('0x44')],_0x44c648[_0x0046('0x50')]));_0x225df4['where'][_0x0046('0x6c')]=_0x5472da['id'];if(_0x198237[_0x0046('0x44')][_0x0046('0x33')]){_0x225df4[_0x0046('0x4e')]=_[_0x0046('0x51')](_0x225df4['where'],{'$or':_[_0x0046('0x43')](_0x225df4['attributes'],function(_0x34b32b){var _0x5cb0cc={};_0x5cb0cc[_0x34b32b]={'$like':'%'+_0x198237['query'][_0x0046('0x33')]+'%'};return _0x5cb0cc;})});}_0x225df4=_[_0x0046('0x51')]({},_0x225df4,_0x198237[_0x0046('0x53')]);return db['CmHopperHistory'][_0x0046('0x27')]({'where':_0x225df4[_0x0046('0x4e')]})[_0x0046('0x2d')](function(_0x128951){_0x51063d[_0x0046('0x27')]=_0x128951;if(_0x198237['query'][_0x0046('0x54')]){_0x225df4['include']=[{'all':!![]}];}return db[_0x0046('0x6d')][_0x0046('0x56')](_0x225df4);})[_0x0046('0x2d')](function(_0xbd55bc){_0x51063d[_0x0046('0x6a')]=_0xbd55bc;return _0x51063d;});}})[_0x0046('0x2d')](respondWithFilteredResult(_0x5a88e8,_0x225df4))[_0x0046('0x57')](handleError(_0x5a88e8,null));};exports[_0x0046('0x6e')]=function(_0x17d709,_0x44cb5d,_0x8b7d77){var _0x9439f8={'raw':!![],'where':{}};var _0x268e68={};var _0x4cce75={'count':0x0,'rows':[]};return db[_0x0046('0x3e')]['findOne']({'where':{'id':_0x17d709[_0x0046('0x59')]['id']}})['then'](handleEntityNotFound(_0x44cb5d,null))[_0x0046('0x2d')](function(_0x184f4e){if(_0x184f4e){_0x268e68[_0x0046('0x42')]=_[_0x0046('0x45')](db['CmHopperFinal'][_0x0046('0x3f')]);_0x268e68[_0x0046('0x44')]=_['keys'](_0x17d709['query']);_0x268e68[_0x0046('0x50')]=_[_0x0046('0x47')](_0x268e68[_0x0046('0x42')],_0x268e68[_0x0046('0x44')]);_0x9439f8[_0x0046('0x46')]=_[_0x0046('0x47')](_0x268e68['model'],qs[_0x0046('0x48')](_0x17d709[_0x0046('0x44')][_0x0046('0x48')]));_0x9439f8['attributes']=_0x9439f8['attributes']['length']?_0x9439f8[_0x0046('0x46')]:_0x268e68['model'];if(!_0x17d709[_0x0046('0x44')][_0x0046('0x4a')]('nolimit')){_0x9439f8[_0x0046('0x25')]=qs[_0x0046('0x25')](_0x17d709[_0x0046('0x44')]['limit']);_0x9439f8[_0x0046('0x24')]=qs[_0x0046('0x24')](_0x17d709[_0x0046('0x44')][_0x0046('0x24')]);}_0x9439f8['order']=qs[_0x0046('0x4d')](_0x17d709[_0x0046('0x44')][_0x0046('0x4d')]);_0x9439f8[_0x0046('0x4e')]=qs['filters'](_[_0x0046('0x4f')](_0x17d709[_0x0046('0x44')],_0x268e68[_0x0046('0x50')]));_0x9439f8[_0x0046('0x4e')][_0x0046('0x6c')]=_0x184f4e['id'];if(_0x17d709[_0x0046('0x44')][_0x0046('0x33')]){_0x9439f8[_0x0046('0x4e')]=_[_0x0046('0x51')](_0x9439f8[_0x0046('0x4e')],{'$or':_[_0x0046('0x43')](_0x9439f8[_0x0046('0x46')],function(_0x32544c){var _0x309598={};_0x309598[_0x32544c]={'$like':'%'+_0x17d709['query'][_0x0046('0x33')]+'%'};return _0x309598;})});}_0x9439f8=_[_0x0046('0x51')]({},_0x9439f8,_0x17d709[_0x0046('0x53')]);return db[_0x0046('0x6f')][_0x0046('0x27')]({'where':_0x9439f8[_0x0046('0x4e')]})['then'](function(_0xc2dd9e){_0x4cce75[_0x0046('0x27')]=_0xc2dd9e;if(_0x17d709['query'][_0x0046('0x54')]){_0x9439f8[_0x0046('0x55')]=[{'all':!![]}];}return db[_0x0046('0x6f')][_0x0046('0x56')](_0x9439f8);})[_0x0046('0x2d')](function(_0x19b430){_0x4cce75['rows']=_0x19b430;return _0x4cce75;});}})[_0x0046('0x2d')](respondWithFilteredResult(_0x44cb5d,_0x9439f8))[_0x0046('0x57')](handleError(_0x44cb5d,null));};exports[_0x0046('0x70')]=function(_0x35b745,_0x496b18,_0x279546){var _0x719e6d={'raw':!![],'where':{}};var _0x2176b5={};var _0x33c1f5={'count':0x0,'rows':[]};return db[_0x0046('0x3e')][_0x0046('0x68')]({'where':{'id':_0x35b745[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x496b18,null))[_0x0046('0x2d')](function(_0xa7c433){if(_0xa7c433){_0x2176b5['model']=_[_0x0046('0x45')](db[_0x0046('0x71')]['rawAttributes']);_0x2176b5[_0x0046('0x44')]=_[_0x0046('0x45')](_0x35b745[_0x0046('0x44')]);_0x2176b5[_0x0046('0x50')]=_['intersection'](_0x2176b5['model'],_0x2176b5[_0x0046('0x44')]);_0x719e6d['attributes']=_['intersection'](_0x2176b5[_0x0046('0x42')],qs[_0x0046('0x48')](_0x35b745[_0x0046('0x44')][_0x0046('0x48')]));_0x719e6d['attributes']=_0x719e6d[_0x0046('0x46')][_0x0046('0x49')]?_0x719e6d['attributes']:_0x2176b5[_0x0046('0x42')];if(!_0x35b745['query'][_0x0046('0x4a')](_0x0046('0x4b'))){_0x719e6d[_0x0046('0x25')]=qs[_0x0046('0x25')](_0x35b745[_0x0046('0x44')][_0x0046('0x25')]);_0x719e6d[_0x0046('0x24')]=qs[_0x0046('0x24')](_0x35b745[_0x0046('0x44')][_0x0046('0x24')]);}_0x719e6d[_0x0046('0x4c')]=qs[_0x0046('0x4d')](_0x35b745[_0x0046('0x44')][_0x0046('0x4d')]);_0x719e6d['where']=qs[_0x0046('0x50')](_[_0x0046('0x4f')](_0x35b745[_0x0046('0x44')],_0x2176b5['filters']));_0x719e6d['where']['VoiceQueueId']=_0xa7c433['id'];if(_0x35b745[_0x0046('0x44')][_0x0046('0x33')]){_0x719e6d['where']=_['merge'](_0x719e6d[_0x0046('0x4e')],{'$or':_[_0x0046('0x43')](_0x719e6d['attributes'],function(_0x312fe6){var _0x68b6ce={};_0x68b6ce[_0x312fe6]={'$like':'%'+_0x35b745['query'][_0x0046('0x33')]+'%'};return _0x68b6ce;})});}_0x719e6d=_[_0x0046('0x51')]({},_0x719e6d,_0x35b745['options']);return db['CmHopperBlack'][_0x0046('0x27')]({'where':_0x719e6d[_0x0046('0x4e')]})['then'](function(_0x14266a){_0x33c1f5[_0x0046('0x27')]=_0x14266a;if(_0x35b745[_0x0046('0x44')][_0x0046('0x54')]){_0x719e6d[_0x0046('0x55')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0046('0x56')](_0x719e6d);})['then'](function(_0x5177db){_0x33c1f5[_0x0046('0x6a')]=_0x5177db;return _0x33c1f5;});}})[_0x0046('0x2d')](respondWithFilteredResult(_0x496b18,_0x719e6d))[_0x0046('0x57')](handleError(_0x496b18,null));};exports[_0x0046('0x72')]=function(_0x29754f,_0x52af25,_0xfeb527){var _0x261805={};var _0x14972c={};var _0x1da374;var _0x3bf4d5;return db[_0x0046('0x3e')]['findOne']({'where':{'id':_0x29754f[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x52af25,null))['then'](function(_0x22366c){if(_0x22366c){_0x1da374=_0x22366c;_0x14972c[_0x0046('0x42')]=_[_0x0046('0x45')](db[_0x0046('0x73')][_0x0046('0x3f')]);_0x14972c['query']=_['keys'](_0x29754f[_0x0046('0x44')]);_0x14972c[_0x0046('0x50')]=_[_0x0046('0x47')](_0x14972c['model'],_0x14972c[_0x0046('0x44')]);_0x261805['attributes']=_[_0x0046('0x47')](_0x14972c[_0x0046('0x42')],qs[_0x0046('0x48')](_0x29754f[_0x0046('0x44')][_0x0046('0x48')]));_0x261805[_0x0046('0x46')]=_0x261805[_0x0046('0x46')][_0x0046('0x49')]?_0x261805[_0x0046('0x46')]:_0x14972c[_0x0046('0x42')];_0x261805[_0x0046('0x4c')]=qs[_0x0046('0x4d')](_0x29754f[_0x0046('0x44')]['sort']);_0x261805[_0x0046('0x4e')]=qs[_0x0046('0x50')](_['pick'](_0x29754f[_0x0046('0x44')],_0x14972c[_0x0046('0x50')]));if(_0x29754f[_0x0046('0x44')][_0x0046('0x33')]){_0x261805[_0x0046('0x4e')]=_[_0x0046('0x51')](_0x261805['where'],{'$or':_[_0x0046('0x43')](_0x261805[_0x0046('0x46')],function(_0x521194){var _0x35009a={};_0x35009a[_0x521194]={'$like':'%'+_0x29754f[_0x0046('0x44')][_0x0046('0x33')]+'%'};return _0x35009a;})});}_0x261805=_[_0x0046('0x51')]({},_0x261805,_0x29754f['options']);return _0x1da374['getTeams'](_0x261805);}})['then'](function(_0x2dfc31){if(_0x2dfc31){_0x3bf4d5=_0x2dfc31['length'];if(!_0x29754f['query'][_0x0046('0x4a')](_0x0046('0x4b'))){_0x261805['limit']=qs[_0x0046('0x25')](_0x29754f[_0x0046('0x44')][_0x0046('0x25')]);_0x261805['offset']=qs[_0x0046('0x24')](_0x29754f[_0x0046('0x44')][_0x0046('0x24')]);}return _0x1da374[_0x0046('0x72')](_0x261805);}})[_0x0046('0x2d')](function(_0x3b0ff4){if(_0x3b0ff4){return _0x3b0ff4?{'count':_0x3bf4d5,'rows':_0x3b0ff4}:null;}})['then'](respondWithResult(_0x52af25,null))[_0x0046('0x57')](handleError(_0x52af25,null));};exports['addTeams']=function(_0x5f520d,_0x1a44f3,_0x4a684b){var _0x88e164=_0x5f520d['body'][_0x0046('0x74')];var _0x104d57=_[_0x0046('0x43')](_0x88e164,'id');return db[_0x0046('0x73')]['findAll']({'where':{'id':_0x104d57},'attributes':['id'],'include':[{'model':db[_0x0046('0x75')],'as':'Agents','attributes':['id',_0x0046('0x39'),_0x0046('0x76'),_0x0046('0x77'),_0x0046('0x78')],'raw':!![]}]})['then'](function(_0x42b775){if(_0x42b775){var _0x13aadf=_[_0x0046('0x79')](_0x42b775,function(_0x19db22){var _0x29b3ea=_0x19db22[_0x0046('0x5d')]({'plain':!![]});_0x29b3ea[_0x0046('0x7a')][_0x0046('0x7b')](function(_0x8ea3c4){_0x8ea3c4[_0x0046('0x7c')]=_[_0x0046('0x38')](_0x88e164,{'id':_0x29b3ea['id']})[_0x0046('0x7c')];});return _0x29b3ea['Agents'];});return db[_0x0046('0x3e')]['find']({'where':{'id':_0x5f520d[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](function(_0x12090a){return db[_0x0046('0x7d')][_0x0046('0x7e')](function(_0x4d8065){return _0x12090a[_0x0046('0x7f')](_0x104d57,{'transaction':_0x4d8065})[_0x0046('0x2d')](function(){return BPromise[_0x0046('0x80')](_0x88e164,function(_0x4ae8fe){return db[_0x0046('0x81')][_0x0046('0x82')]({'TeamId':_0x4ae8fe['id'],'VoiceQueueId':_0x5f520d[_0x0046('0x59')]['id'],'penalty':_0x4ae8fe[_0x0046('0x7c')]},{'transaction':_0x4d8065});});})[_0x0046('0x2d')](function(){return BPromise['each'](_0x13aadf,function(_0x1b2152){return db[_0x0046('0x83')][_0x0046('0x84')]({'where':{'UserId':_0x1b2152['id'],'VoiceQueueId':_0x5f520d[_0x0046('0x59')]['id']},'defaults':{'penalty':_0x1b2152[_0x0046('0x7c')]},'transaction':_0x4d8065});});})['then'](function(){return BPromise[_0x0046('0x80')](_['filter'](_0x13aadf,{'online':!![]}),function(_0x2d7d8e){return db[_0x0046('0x85')][_0x0046('0x82')]({'membername':_0x2d7d8e[_0x0046('0x39')],'UserId':_0x2d7d8e['id'],'queue_name':_0x12090a[_0x0046('0x39')],'VoiceQueueId':_0x12090a['id'],'interface':_[_0x0046('0x86')](_0x2d7d8e[_0x0046('0x78')])?util['format'](_0x0046('0x87'),_0x2d7d8e[_0x0046('0x39')]):_0x2d7d8e[_0x0046('0x78')],'paused':_0x2d7d8e['voicePause']||![],'penalty':_0x2d7d8e['penalty']},{'transaction':_0x4d8065});});})[_0x0046('0x2d')](function(){_0x13aadf[_0x0046('0x7b')](function(_0x115ca6){socket['emit']('userVoiceQueue:save',{'UserId':_0x115ca6['id'],'VoiceQueueId':_0x12090a['id']});});});});});}})['then'](respondWithStatusCode(_0x1a44f3,null))[_0x0046('0x57')](handleError(_0x1a44f3,null));};exports[_0x0046('0x88')]=function(_0x21152b,_0x385b98,_0x4b3294){return db[_0x0046('0x73')][_0x0046('0x56')]({'where':{'id':_0x21152b[_0x0046('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0046('0x75')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x385b98,null))[_0x0046('0x2d')](function(_0x2fc91e){var _0x11439e=_[_0x0046('0x43')](_0x2fc91e,'id');var _0x47281b=[];var _0x2be060=[];var _0x4be635=squel[_0x0046('0x89')]();_0x4be635['field'](_0x0046('0x8a'))[_0x0046('0x8b')]('team_has_voice_queues','tq')[_0x0046('0x8c')]('user_has_teams','ut',_0x0046('0x8d'))['where']('VoiceQueueId\x20=\x20?',_0x21152b[_0x0046('0x59')]['id']);for(var _0x9110c5=0x0;_0x9110c5<_0x2fc91e[_0x0046('0x49')];_0x9110c5+=0x1){let _0x33ea0a=_0x2fc91e[_0x9110c5];for(var _0x58dcfb=0x0;_0x58dcfb<_0x33ea0a[_0x0046('0x7a')]['length'];_0x58dcfb+=0x1){let _0x2f0523=_0x33ea0a['Agents'][_0x58dcfb];var _0x48f7db=_0x4be635[_0x0046('0x61')]();_0x48f7db[_0x0046('0x4e')]('ut.UserId\x20=\x20?',_0x2f0523['id']);_0x2be060['push'](db[_0x0046('0x7d')][_0x0046('0x44')](_0x48f7db[_0x0046('0x8e')](),{'type':db[_0x0046('0x7d')][_0x0046('0x8f')][_0x0046('0x90')]})[_0x0046('0x2d')](function(_0x5d04ba){if(_0x5d04ba['length']===0x1){return _0x2f0523['id'];}else{var _0x22920e=_[_0x0046('0x91')](_['map'](_0x5d04ba,_0x0046('0x92')),function(_0x2979a0){return _[_0x0046('0x36')](_0x11439e,_0x2979a0);});if(_0x22920e){return _0x2f0523['id'];}}}));}}return BPromise['all'](_0x2be060)[_0x0046('0x2d')](function(_0x5cecdd){_0x47281b=_(_0x47281b)[_0x0046('0x93')](_0x5cecdd)['compact']()[_0x0046('0x35')]();return db['VoiceQueue'][_0x0046('0x38')]({'where':{'id':_0x21152b[_0x0046('0x59')]['id']}})['then'](function(_0x46be8a){return db[_0x0046('0x7d')][_0x0046('0x7e')](function(_0x3dce17){return _0x46be8a[_0x0046('0x88')](_0x21152b[_0x0046('0x44')][_0x0046('0x94')],{'transaction':_0x3dce17})[_0x0046('0x2d')](function(){if(!_[_0x0046('0x95')](_0x47281b)){return _0x46be8a['removeAgents'](_0x47281b,{'transaction':_0x3dce17})[_0x0046('0x2d')](function(){return db['UserVoiceQueueRt'][_0x0046('0x2e')]({'where':{'VoiceQueueId':_0x21152b['params']['id'],'UserId':_0x47281b},'transaction':_0x3dce17});});}})['then'](function(){_0x47281b[_0x0046('0x7b')](function(_0x5ec5e4){socket[_0x0046('0x96')]('userVoiceQueue:remove',{'UserId':_0x5ec5e4,'VoiceQueueId':_0x46be8a['id']});});});});});});})[_0x0046('0x2d')](respondWithStatusCode(_0x385b98,null))[_0x0046('0x57')](handleError(_0x385b98,null));};exports[_0x0046('0x97')]=function(_0x86fe5f,_0x22490d,_0x39d13d){var _0x2107b6,_0xb8201f;return db[_0x0046('0x3e')][_0x0046('0x38')]({'where':{'id':_0x86fe5f['params']['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x22490d,null))[_0x0046('0x2d')](function(_0x5823e2){if(_0x5823e2){_0xb8201f=_0x5823e2;return _0x5823e2[_0x0046('0x97')](_0x86fe5f[_0x0046('0x5b')]['ids'],_['omit'](_0x86fe5f[_0x0046('0x5b')],[_0x0046('0x94'),'id'])||{})[_0x0046('0x98')](function(_0x26cfcd){for(var _0x275fa7=0x0;_0x275fa7<_0x86fe5f[_0x0046('0x5b')][_0x0046('0x94')][_0x0046('0x49')];_0x275fa7+=0x1){socket[_0x0046('0x96')](_0x0046('0x99'),{'UserId':Number(_0x86fe5f['body'][_0x0046('0x94')][_0x275fa7]),'VoiceQueueId':Number(_0x86fe5f[_0x0046('0x59')]['id'])});}return _0x26cfcd;});}})[_0x0046('0x2d')](function(_0x4b37e6){_0x2107b6=_0x4b37e6||[];if(_0xb8201f){return db[_0x0046('0x75')][_0x0046('0x56')]({'where':{'id':_0x86fe5f[_0x0046('0x5b')][_0x0046('0x94')]},'attributes':['id',_0x0046('0x39'),'online',_0x0046('0x77'),'interface'],'raw':!![]});}})[_0x0046('0x2d')](function(_0x57884e){if(!_[_0x0046('0x95')](_0x57884e)){var _0x556fb7=[];for(var _0x369427=0x0;_0x369427<_0x57884e['length'];_0x369427++){if(_0x57884e[_0x369427]['online']){_0x556fb7[_0x0046('0x9a')](db['UserVoiceQueueRt'][_0x0046('0x82')]({'membername':_0x57884e[_0x369427][_0x0046('0x39')],'UserId':_0x57884e[_0x369427]['id'],'queue_name':_0xb8201f[_0x0046('0x39')],'VoiceQueueId':_0xb8201f['id'],'interface':_[_0x0046('0x86')](_0x57884e[_0x369427][_0x0046('0x78')])?util['format'](_0x0046('0x87'),_0x57884e[_0x369427]['name']):_0x57884e[_0x369427][_0x0046('0x78')],'paused':_0x57884e[_0x369427][_0x0046('0x77')]||![],'penalty':_0x86fe5f['body']['penalty']||0x0}));}}return BPromise['all'](_0x556fb7);}})[_0x0046('0x2d')](function(){return _0x2107b6;})[_0x0046('0x2d')](respondWithResult(_0x22490d,null))['catch'](handleError(_0x22490d,null));};exports['removeAgents']=function(_0x26d0e2,_0x437966,_0x334850){return db['VoiceQueue'][_0x0046('0x38')]({'where':{'id':_0x26d0e2[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x437966,null))[_0x0046('0x2d')](function(_0x59d6b0){if(_0x59d6b0){return _0x59d6b0[_0x0046('0x9b')](_0x26d0e2[_0x0046('0x44')][_0x0046('0x94')])[_0x0046('0x2d')](function(){if(_[_0x0046('0x9c')](_0x26d0e2['query'][_0x0046('0x94')])){for(var _0xa82ec0=0x0;_0xa82ec0<_0x26d0e2[_0x0046('0x44')]['ids'][_0x0046('0x49')];_0xa82ec0+=0x1){socket['emit'](_0x0046('0x9d'),{'UserId':Number(_0x26d0e2[_0x0046('0x44')][_0x0046('0x94')][_0xa82ec0]),'VoiceQueueId':Number(_0x26d0e2['params']['id'])});}}else{socket[_0x0046('0x96')](_0x0046('0x9d'),{'UserId':Number(_0x26d0e2[_0x0046('0x44')][_0x0046('0x94')]),'VoiceQueueId':Number(_0x26d0e2[_0x0046('0x59')]['id'])});}});}})[_0x0046('0x2d')](function(_0x54c3bb){return db[_0x0046('0x85')]['destroy']({'where':{'VoiceQueueId':_0x26d0e2[_0x0046('0x59')]['id'],'UserId':_0x26d0e2[_0x0046('0x44')][_0x0046('0x94')]}})[_0x0046('0x2d')](function(){return _0x54c3bb;});})['then'](respondWithStatusCode(_0x437966,null))[_0x0046('0x57')](handleError(_0x437966,null));};exports[_0x0046('0x9e')]=function(_0x415206,_0x296c0a,_0x1834eb){var _0x36f371={};var _0x3fd3f2={};var _0x166c5a;var _0x5d5110;return db[_0x0046('0x3e')][_0x0046('0x68')]({'where':{'id':_0x415206[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x296c0a,null))[_0x0046('0x2d')](function(_0x10dad6){if(_0x10dad6){_0x166c5a=_0x10dad6;_0x3fd3f2[_0x0046('0x42')]=_[_0x0046('0x45')](db[_0x0046('0x75')][_0x0046('0x3f')]);_0x3fd3f2['query']=_[_0x0046('0x45')](_0x415206[_0x0046('0x44')]);_0x3fd3f2['filters']=_[_0x0046('0x47')](_0x3fd3f2[_0x0046('0x42')],_0x3fd3f2['query']);_0x36f371[_0x0046('0x46')]=_[_0x0046('0x47')](_0x3fd3f2[_0x0046('0x42')],qs[_0x0046('0x48')](_0x415206[_0x0046('0x44')]['fields']));_0x36f371[_0x0046('0x46')]=_0x36f371[_0x0046('0x46')][_0x0046('0x49')]?_0x36f371['attributes']:_0x3fd3f2[_0x0046('0x42')];_0x36f371[_0x0046('0x4c')]=qs[_0x0046('0x4d')](_0x415206[_0x0046('0x44')]['sort']);_0x36f371['where']=qs[_0x0046('0x50')](_[_0x0046('0x4f')](_0x415206['query'],_0x3fd3f2[_0x0046('0x50')]));if(_0x415206[_0x0046('0x44')]['filter']){_0x36f371[_0x0046('0x4e')]=_[_0x0046('0x51')](_0x36f371[_0x0046('0x4e')],{'$or':_[_0x0046('0x43')](_0x36f371[_0x0046('0x46')],function(_0x42e9c4){var _0x33a92b={};_0x33a92b[_0x42e9c4]={'$like':'%'+_0x415206[_0x0046('0x44')][_0x0046('0x33')]+'%'};return _0x33a92b;})});}_0x36f371=_['merge']({},_0x36f371,_0x415206['options']);return _0x166c5a[_0x0046('0x9e')](_0x36f371);}})[_0x0046('0x2d')](function(_0x283979){if(_0x283979){_0x5d5110=_0x283979[_0x0046('0x49')];if(!_0x415206[_0x0046('0x44')][_0x0046('0x4a')](_0x0046('0x4b'))){_0x36f371[_0x0046('0x25')]=qs[_0x0046('0x25')](_0x415206[_0x0046('0x44')][_0x0046('0x25')]);_0x36f371[_0x0046('0x24')]=qs[_0x0046('0x24')](_0x415206['query'][_0x0046('0x24')]);}return _0x166c5a[_0x0046('0x9e')](_0x36f371);}})[_0x0046('0x2d')](function(_0x227d4a){if(_0x227d4a){return _0x227d4a?{'count':_0x5d5110,'rows':_0x227d4a}:null;}})[_0x0046('0x2d')](respondWithResult(_0x296c0a,null))[_0x0046('0x57')](handleError(_0x296c0a,null));};exports[_0x0046('0x9f')]=function(_0xf7c89b,_0x541541,_0xbde82a){var _0x38d140={};var _0x18dfe3={};var _0x55261d;var _0x2016b4;return db[_0x0046('0x3e')][_0x0046('0x68')]({'where':{'id':_0xf7c89b[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x541541,null))[_0x0046('0x2d')](function(_0x2ad22e){if(_0x2ad22e){_0x55261d=_0x2ad22e;_0x18dfe3['model']=_[_0x0046('0x45')](db[_0x0046('0x85')]['rawAttributes']);_0x18dfe3[_0x0046('0x44')]=_['keys'](_0xf7c89b[_0x0046('0x44')]);_0x18dfe3['filters']=_[_0x0046('0x47')](_0x18dfe3[_0x0046('0x42')],_0x18dfe3[_0x0046('0x44')]);_0x38d140[_0x0046('0x46')]=_['intersection'](_0x18dfe3['model'],qs[_0x0046('0x48')](_0xf7c89b[_0x0046('0x44')][_0x0046('0x48')]));_0x38d140[_0x0046('0x46')]=_0x38d140[_0x0046('0x46')][_0x0046('0x49')]?_0x38d140['attributes']:_0x18dfe3[_0x0046('0x42')];_0x38d140['order']=qs['sort'](_0xf7c89b[_0x0046('0x44')]['sort']);_0x38d140[_0x0046('0x4e')]=qs[_0x0046('0x50')](_[_0x0046('0x4f')](_0xf7c89b[_0x0046('0x44')],_0x18dfe3[_0x0046('0x50')]));if(_0xf7c89b[_0x0046('0x44')][_0x0046('0x33')]){_0x38d140[_0x0046('0x4e')]=_['merge'](_0x38d140[_0x0046('0x4e')],{'$or':_[_0x0046('0x43')](_0x38d140['attributes'],function(_0x55a4b4){var _0x349200={};_0x349200[_0x55a4b4]={'$like':'%'+_0xf7c89b[_0x0046('0x44')][_0x0046('0x33')]+'%'};return _0x349200;})});}_0x38d140=_[_0x0046('0x51')]({},_0x38d140,_0xf7c89b[_0x0046('0x53')]);return _0x55261d[_0x0046('0x9f')](_0x38d140);}})['then'](function(_0x38e30d){if(_0x38e30d){_0x2016b4=_0x38e30d[_0x0046('0x49')];if(!_0xf7c89b[_0x0046('0x44')][_0x0046('0x4a')](_0x0046('0x4b'))){_0x38d140[_0x0046('0x25')]=qs[_0x0046('0x25')](_0xf7c89b[_0x0046('0x44')][_0x0046('0x25')]);_0x38d140[_0x0046('0x24')]=qs[_0x0046('0x24')](_0xf7c89b['query'][_0x0046('0x24')]);}return _0x55261d[_0x0046('0x9f')](_0x38d140);}})['then'](function(_0x2f025b){return _0x2f025b?{'count':_0x2016b4,'rows':_0x2f025b}:null;})[_0x0046('0x2d')](respondWithResult(_0x541541,null))[_0x0046('0x57')](handleError(_0x541541,null));};exports[_0x0046('0xa0')]=function(_0x3fac0b,_0x521fb8,_0x58631f){var _0x164aaf={};var _0x21f1a5={};var _0x2a8721;var _0x517c94;return db[_0x0046('0x3e')][_0x0046('0x68')]({'where':{'id':_0x3fac0b[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x521fb8,null))[_0x0046('0x2d')](function(_0x2594e7){if(_0x2594e7){_0x2a8721=_0x2594e7;_0x21f1a5[_0x0046('0x42')]=_[_0x0046('0x45')](db[_0x0046('0xa1')]['rawAttributes']);_0x21f1a5[_0x0046('0x44')]=_['keys'](_0x3fac0b['query']);_0x21f1a5['filters']=_['intersection'](_0x21f1a5[_0x0046('0x42')],_0x21f1a5[_0x0046('0x44')]);_0x164aaf['attributes']=_[_0x0046('0x47')](_0x21f1a5[_0x0046('0x42')],qs[_0x0046('0x48')](_0x3fac0b[_0x0046('0x44')]['fields']));_0x164aaf[_0x0046('0x46')]=_0x164aaf[_0x0046('0x46')][_0x0046('0x49')]?_0x164aaf[_0x0046('0x46')]:_0x21f1a5[_0x0046('0x42')];_0x164aaf[_0x0046('0x4c')]=qs[_0x0046('0x4d')](_0x3fac0b[_0x0046('0x44')]['sort']);_0x164aaf[_0x0046('0x4e')]=qs['filters'](_[_0x0046('0x4f')](_0x3fac0b[_0x0046('0x44')],_0x21f1a5[_0x0046('0x50')]));if(_0x3fac0b[_0x0046('0x44')]['filter']){_0x164aaf[_0x0046('0x4e')]=_[_0x0046('0x51')](_0x164aaf[_0x0046('0x4e')],{'$or':_[_0x0046('0x43')](_0x164aaf[_0x0046('0x46')],function(_0x2426e1){var _0x5efd88={};_0x5efd88[_0x2426e1]={'$like':'%'+_0x3fac0b['query'][_0x0046('0x33')]+'%'};return _0x5efd88;})});}_0x164aaf=_[_0x0046('0x51')]({},_0x164aaf,_0x3fac0b[_0x0046('0x53')]);return _0x2a8721[_0x0046('0xa0')](_0x164aaf);}})['then'](function(_0x10eaf4){if(_0x10eaf4){_0x517c94=_0x10eaf4['length'];if(!_0x3fac0b[_0x0046('0x44')]['hasOwnProperty']('nolimit')){_0x164aaf['limit']=qs[_0x0046('0x25')](_0x3fac0b[_0x0046('0x44')][_0x0046('0x25')]);_0x164aaf['offset']=qs[_0x0046('0x24')](_0x3fac0b[_0x0046('0x44')][_0x0046('0x24')]);}return _0x2a8721[_0x0046('0xa0')](_0x164aaf);}})['then'](function(_0x323613){if(_0x323613){return _0x323613?{'count':_0x517c94,'rows':_0x323613}:null;}})[_0x0046('0x2d')](respondWithResult(_0x521fb8,null))['catch'](handleError(_0x521fb8,null));};exports[_0x0046('0xa2')]=function(_0x3127d3,_0x3cce08,_0x3e6405){var _0x26d3d1,_0x404b99;return db[_0x0046('0x3e')][_0x0046('0x38')]({'where':{'id':_0x3127d3['params']['id']}})['then'](handleEntityNotFound(_0x3cce08,null))[_0x0046('0x2d')](function(_0xef46d1){if(_0xef46d1){_0x404b99=_0xef46d1;return _0xef46d1['addLists'](_0x3127d3['body'][_0x0046('0x94')],_[_0x0046('0x62')](_0x3127d3[_0x0046('0x5b')],['ids','id'])||{});}return null;})[_0x0046('0x98')](function(_0x418a60){var _0x4fdf8b;_0x26d3d1=_0x418a60||[];var _0x9ead26=[];if(_0x418a60){for(var _0x3e126b=0x0;_0x3e126b<_0x418a60[_0x0046('0x49')];_0x3e126b+=0x1){var _0x36f115=_0x418a60[_0x3e126b][_0x0046('0x5d')]({'plain':!![]});_0x404b99[_0x0046('0xa3')]=_0x3127d3[_0x0046('0x5b')]['dialCheckDuplicateType']?_0x3127d3['body'][_0x0046('0xa3')]:_0x404b99[_0x0046('0xa3')];switch(_0x404b99[_0x0046('0xa3')]){case'always':_0x4fdf8b=squel[_0x0046('0xa4')]()[_0x0046('0xa5')](_0x0046('0xa6'))['fromQuery']([_0x0046('0xa7'),_0x0046('0xa8'),'ContactId',_0x0046('0xa9'),_0x0046('0x6c'),_0x0046('0x63'),'updatedAt'],squel[_0x0046('0x89')]()[_0x0046('0xaa')](_0x0046('0xa7'),_0x0046('0xa7'))[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0xa8'))[_0x0046('0xaa')]('id',_0x0046('0xac'))['field'](_0x36f115[_0x0046('0xad')][_0x0046('0x8e')](),'ListId')[_0x0046('0xaa')](_0x3127d3[_0x0046('0x59')]['id'][_0x0046('0x8e')](),'VoiceQueueId')[_0x0046('0xaa')]('NOW()','createdAt')[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0x64'))[_0x0046('0x8b')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x0046('0x4e')](_0x0046('0xae'),_0x36f115[_0x0046('0xad')]['toString']())[_0x0046('0x4e')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0046('0x89')]()[_0x0046('0xaa')](_0x0046('0xaf'))['from'](_0x0046('0xb0'))[_0x0046('0x4e')]('VoiceQueueId\x20=\x20?',_0x3127d3['params']['id'][_0x0046('0x8e')]()))[_0x0046('0x4e')](_0x0046('0xb1'),squel[_0x0046('0x89')]()[_0x0046('0xaa')]('COALESCE(phone,\x27\x27)')[_0x0046('0x8b')]('cm_hopper')[_0x0046('0x4e')](_0x0046('0xb2'),_0x3127d3['params']['id'][_0x0046('0x8e')]())))[_0x0046('0x8e')]();break;case _0x0046('0xb3'):_0x4fdf8b=squel[_0x0046('0xa4')]()[_0x0046('0xa5')](_0x0046('0xa6'))[_0x0046('0xb4')]([_0x0046('0xa7'),_0x0046('0xa8'),_0x0046('0xac'),_0x0046('0xa9'),_0x0046('0x6c'),_0x0046('0x63'),_0x0046('0x64')],squel[_0x0046('0x89')]()['field'](_0x0046('0xa7'),_0x0046('0xa7'))[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0xa8'))[_0x0046('0xaa')]('id',_0x0046('0xac'))[_0x0046('0xaa')](_0x36f115['CmListId']['toString'](),_0x0046('0xa9'))[_0x0046('0xaa')](_0x3127d3[_0x0046('0x59')]['id'][_0x0046('0x8e')](),_0x0046('0x6c'))[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0x63'))[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0x64'))[_0x0046('0x8b')](_0x0046('0xb5'))[_0x0046('0x4e')](_0x0046('0xb6'))[_0x0046('0x4e')](_0x0046('0xae'),_0x36f115[_0x0046('0xad')][_0x0046('0x8e')]())[_0x0046('0x4e')](_0x0046('0xb7'))[_0x0046('0x4e')](_0x0046('0xb1'),squel[_0x0046('0x89')]()[_0x0046('0xaa')]('COALESCE(phone,\x27\x27)')[_0x0046('0x8b')](_0x0046('0xa6'))[_0x0046('0x4e')]('VoiceQueueId\x20=\x20?',_0x3127d3[_0x0046('0x59')]['id'][_0x0046('0x8e')]())))[_0x0046('0x8e')]();break;default:_0x4fdf8b=squel[_0x0046('0xa4')]()['into'](_0x0046('0xa6'))[_0x0046('0xb4')](['phone',_0x0046('0xa8'),_0x0046('0xac'),'ListId','VoiceQueueId',_0x0046('0x63'),_0x0046('0x64')],squel[_0x0046('0x89')]()[_0x0046('0xaa')](_0x0046('0xa7'),'phone')[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0xa8'))[_0x0046('0xaa')]('id',_0x0046('0xac'))[_0x0046('0xaa')](_0x36f115[_0x0046('0xad')][_0x0046('0x8e')](),_0x0046('0xa9'))[_0x0046('0xaa')](_0x3127d3['params']['id'][_0x0046('0x8e')](),'VoiceQueueId')[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0x63'))[_0x0046('0xaa')]('NOW()',_0x0046('0x64'))[_0x0046('0x8b')](_0x0046('0xb5'))['where'](_0x0046('0xb6'))[_0x0046('0x4e')]('ListId\x20=\x20?',_0x36f115[_0x0046('0xad')][_0x0046('0x8e')]())[_0x0046('0x4e')](_0x0046('0xb7')))[_0x0046('0x8e')]();}_0x9ead26[_0x0046('0x9a')](db[_0x0046('0x7d')]['query'](_0x4fdf8b));}return BPromise[_0x0046('0xb8')](_0x9ead26);}})['then'](function(){return _0x26d3d1;})[_0x0046('0x2d')](respondWithResult(_0x3cce08,null))[_0x0046('0x57')](handleError(_0x3cce08,null));};exports[_0x0046('0xb9')]=function(_0x5145d6,_0x2edb22,_0x5344b8){return db[_0x0046('0x3e')][_0x0046('0x38')]({'where':{'id':_0x5145d6[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x2edb22,null))[_0x0046('0x2d')](function(_0x17c55d){if(_0x17c55d){return _0x17c55d[_0x0046('0xb9')](_0x5145d6[_0x0046('0x44')][_0x0046('0x94')]);}})['then'](function(_0x47cb8b){if(_0x47cb8b){return db['CmHopper'][_0x0046('0x2e')]({'where':{'ListId':_0x5145d6['query'][_0x0046('0x94')],'VoiceQueueId':_0x5145d6['params']['id']}})['then'](function(){return _0x47cb8b;});}})[_0x0046('0x2d')](respondWithStatusCode(_0x2edb22,null))[_0x0046('0x57')](handleError(_0x2edb22,null));};exports[_0x0046('0xba')]=function(_0x328c09,_0x2d911b,_0x3882af){var _0x6b0181={};var _0x641594={};var _0x11ada6;var _0x4ea883;return db[_0x0046('0x3e')][_0x0046('0x68')]({'where':{'id':_0x328c09['params']['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x2d911b,null))['then'](function(_0x47ac49){if(_0x47ac49){_0x11ada6=_0x47ac49;_0x641594['model']=_[_0x0046('0x45')](db[_0x0046('0xa1')][_0x0046('0x3f')]);_0x641594[_0x0046('0x44')]=_[_0x0046('0x45')](_0x328c09[_0x0046('0x44')]);_0x641594['filters']=_['intersection'](_0x641594[_0x0046('0x42')],_0x641594[_0x0046('0x44')]);_0x6b0181[_0x0046('0x46')]=_[_0x0046('0x47')](_0x641594[_0x0046('0x42')],qs['fields'](_0x328c09[_0x0046('0x44')][_0x0046('0x48')]));_0x6b0181[_0x0046('0x46')]=_0x6b0181[_0x0046('0x46')][_0x0046('0x49')]?_0x6b0181[_0x0046('0x46')]:_0x641594[_0x0046('0x42')];_0x6b0181[_0x0046('0x4c')]=qs[_0x0046('0x4d')](_0x328c09[_0x0046('0x44')]['sort']);_0x6b0181[_0x0046('0x4e')]=qs[_0x0046('0x50')](_[_0x0046('0x4f')](_0x328c09[_0x0046('0x44')],_0x641594[_0x0046('0x50')]));if(_0x328c09[_0x0046('0x44')]['filter']){_0x6b0181['where']=_[_0x0046('0x51')](_0x6b0181[_0x0046('0x4e')],{'$or':_['map'](_0x6b0181[_0x0046('0x46')],function(_0x5afd93){var _0x4b06aa={};_0x4b06aa[_0x5afd93]={'$like':'%'+_0x328c09[_0x0046('0x44')][_0x0046('0x33')]+'%'};return _0x4b06aa;})});}_0x6b0181=_['merge']({},_0x6b0181,_0x328c09[_0x0046('0x53')]);return _0x11ada6[_0x0046('0xba')](_0x6b0181);}})[_0x0046('0x2d')](function(_0x43ddbb){if(_0x43ddbb){_0x4ea883=_0x43ddbb['length'];if(!_0x328c09[_0x0046('0x44')][_0x0046('0x4a')](_0x0046('0x4b'))){_0x6b0181[_0x0046('0x25')]=qs[_0x0046('0x25')](_0x328c09[_0x0046('0x44')]['limit']);_0x6b0181[_0x0046('0x24')]=qs[_0x0046('0x24')](_0x328c09[_0x0046('0x44')]['offset']);}return _0x11ada6[_0x0046('0xba')](_0x6b0181);}})[_0x0046('0x2d')](function(_0x16a48a){if(_0x16a48a){return _0x16a48a?{'count':_0x4ea883,'rows':_0x16a48a}:null;}})[_0x0046('0x2d')](respondWithResult(_0x2d911b,null))['catch'](handleError(_0x2d911b,null));};exports[_0x0046('0xbb')]=function(_0x526745,_0x102676,_0x2361b4){var _0x40766b,_0x5a7fb4;return db['VoiceQueue']['find']({'where':{'id':_0x526745[_0x0046('0x59')]['id']}})['then'](handleEntityNotFound(_0x102676,null))[_0x0046('0x2d')](function(_0x586f7a){if(_0x586f7a){_0x5a7fb4=_0x586f7a;return _0x586f7a[_0x0046('0xbb')](_0x526745[_0x0046('0x5b')][_0x0046('0x94')],_[_0x0046('0x62')](_0x526745['body'],[_0x0046('0x94'),'id'])||{});}return null;})[_0x0046('0x98')](function(_0x55d643){var _0x4934af;_0x40766b=_0x55d643||[];var _0x1eb91b=[];if(_0x55d643){for(var _0x51b946=0x0;_0x51b946<_0x55d643[_0x0046('0x49')];_0x51b946+=0x1){var _0x1a6032=_0x55d643[_0x51b946][_0x0046('0x5d')]({'plain':!![]});_0x4934af=squel[_0x0046('0xa4')]()[_0x0046('0xa5')](_0x0046('0xbc'))[_0x0046('0xb4')](['phone',_0x0046('0xac'),_0x0046('0xa9'),'VoiceQueueId',_0x0046('0x63'),_0x0046('0x64')],squel[_0x0046('0x89')]()[_0x0046('0xaa')](_0x0046('0xa7'),'phone')['field']('id',_0x0046('0xac'))['field'](_0x1a6032[_0x0046('0xad')][_0x0046('0x8e')](),_0x0046('0xa9'))[_0x0046('0xaa')](_0x526745[_0x0046('0x59')]['id'][_0x0046('0x8e')](),_0x0046('0x6c'))['field'](_0x0046('0xab'),_0x0046('0x63'))[_0x0046('0xaa')](_0x0046('0xab'),_0x0046('0x64'))[_0x0046('0x8b')]('cm_contacts')[_0x0046('0x4e')](_0x0046('0xb6'))[_0x0046('0x4e')](_0x0046('0xae'),_0x1a6032[_0x0046('0xad')][_0x0046('0x8e')]())[_0x0046('0x4e')](_0x0046('0xb7')))[_0x0046('0x8e')]();_0x1eb91b[_0x0046('0x9a')](db['sequelize']['query'](_0x4934af));}return BPromise[_0x0046('0xb8')](_0x1eb91b);}})[_0x0046('0x2d')](function(){return _0x40766b;})[_0x0046('0x2d')](respondWithResult(_0x102676,null))['catch'](handleError(_0x102676,null));};exports[_0x0046('0xbd')]=function(_0xa460ef,_0x5e547b,_0x1a3ebb){return db[_0x0046('0x3e')][_0x0046('0x38')]({'where':{'id':_0xa460ef[_0x0046('0x59')]['id']}})[_0x0046('0x2d')](handleEntityNotFound(_0x5e547b,null))[_0x0046('0x2d')](function(_0x56271a){if(_0x56271a){return _0x56271a[_0x0046('0xbd')](_0xa460ef[_0x0046('0x44')]['ids']);}})[_0x0046('0x2d')](function(_0x1e8103){if(_0x1e8103){return db[_0x0046('0x71')][_0x0046('0x2e')]({'where':{'ListId':_0xa460ef[_0x0046('0x44')][_0x0046('0x94')],'VoiceQueueId':_0xa460ef['params']['id']}})[_0x0046('0x2d')](function(){return _0x1e8103;});}})[_0x0046('0x2d')](respondWithStatusCode(_0x5e547b,null))[_0x0046('0x57')](handleError(_0x5e547b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e47dc6c..296bffd 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 _0xd764=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x563688,_0x707f73){var _0x168cb1=function(_0x47def9){while(--_0x47def9){_0x563688['push'](_0x563688['shift']());}};_0x168cb1(++_0x707f73);}(_0xd764,0x135));var _0x4d76=function(_0x31708b,_0x439620){_0x31708b=_0x31708b-0x0;var _0x5b0dd8=_0xd764[_0x31708b];return _0x5b0dd8;};'use strict';var EventEmitter=require(_0x4d76('0x0'));var VoiceQueue=require(_0x4d76('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4d76('0x2')](0x0);var events={'afterCreate':_0x4d76('0x3'),'afterUpdate':_0x4d76('0x4'),'afterDestroy':_0x4d76('0x5')};function emitEvent(_0x4a2751){return function(_0x218ea7,_0x4050f3,_0x27b956){VoiceQueueEvents[_0x4d76('0x6')](_0x4a2751+':'+_0x218ea7['id'],_0x218ea7);VoiceQueueEvents[_0x4d76('0x6')](_0x4a2751,_0x218ea7);_0x27b956(null);};}for(var e in events){if(events[_0x4d76('0x7')](e)){var event=events[e];VoiceQueue[_0x4d76('0x8')](e,emitEvent(event));}}module[_0x4d76('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xcd08=['../../mysqldb','VoiceQueue','update','remove','hasOwnProperty','hook','events'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0xcd08,0x15d));var _0x8cd0=function(_0x2aa20b,_0x1fc009){_0x2aa20b=_0x2aa20b-0x0;var _0x3844c2=_0xcd08[_0x2aa20b];return _0x3844c2;};'use strict';var EventEmitter=require(_0x8cd0('0x0'));var VoiceQueue=require(_0x8cd0('0x1'))['db'][_0x8cd0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8cd0('0x3'),'afterDestroy':_0x8cd0('0x4')};function emitEvent(_0x3f1e29){return function(_0x18dce2,_0x230cda,_0x4a1cec){VoiceQueueEvents['emit'](_0x3f1e29+':'+_0x18dce2['id'],_0x18dce2);VoiceQueueEvents['emit'](_0x3f1e29,_0x18dce2);_0x4a1cec(null);};}for(var e in events){if(events[_0x8cd0('0x5')](e)){var event=events[e];VoiceQueue[_0x8cd0('0x6')](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 b3a75e3..4349e6c 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0xd4313c,_0x453988){var _0x14477a=function(_0x58e7ac){while(--_0x58e7ac){_0xd4313c['push'](_0xd4313c['shift']());}};_0x14477a(++_0x453988);}(_0x70e0,0x17b));var _0x070e=function(_0x4d31d4,_0x27e825){_0x4d31d4=_0x4d31d4-0x0;var _0x17d4eb=_0x70e0[_0x4d31d4];return _0x17d4eb;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x5e400c,_0x2b0c4d){var _0x56ce89=function(_0x4df7e6){while(--_0x4df7e6){_0x5e400c['push'](_0x5e400c['shift']());}};_0x56ce89(++_0x2b0c4d);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 6cd77a3..a84de54 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 _0xcc72=['message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xcc72,0x158));var _0x2cc7=function(_0xc332fe,_0x12735e){_0xc332fe=_0xc332fe-0x0;var _0x384c91=_0xcc72[_0xc332fe];return _0x384c91;};'use strict';var _=require(_0x2cc7('0x0'));var util=require(_0x2cc7('0x1'));var moment=require('moment');var BPromise=require(_0x2cc7('0x2'));var rs=require(_0x2cc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cc7('0x4'))['db'];var utils=require(_0x2cc7('0x5'));var logger=require(_0x2cc7('0x6'))('rpc');var config=require(_0x2cc7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cc7('0x8')]['http']({'port':0x232a});config[_0x2cc7('0x9')]=_[_0x2cc7('0xa')](config[_0x2cc7('0x9')],{'host':_0x2cc7('0xb'),'port':0x18eb});var socket=require(_0x2cc7('0xc'))(new Redis(config[_0x2cc7('0x9')]));require(_0x2cc7('0xd'))[_0x2cc7('0xe')](socket);function respondWithRpcPromise(_0x385471,_0x139f09,_0x1cf2ab){return new BPromise(function(_0x458e76,_0x30896f){return client[_0x2cc7('0xf')](_0x385471,_0x1cf2ab)[_0x2cc7('0x10')](function(_0x70fee){logger[_0x2cc7('0x11')](_0x2cc7('0x12'),_0x139f09,'request\x20sent');logger[_0x2cc7('0x13')](_0x2cc7('0x14'),_0x139f09,_0x2cc7('0x15'),JSON[_0x2cc7('0x16')](_0x70fee));if(_0x70fee['error']){if(_0x70fee[_0x2cc7('0x17')][_0x2cc7('0x18')]===0x1f4){logger[_0x2cc7('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x139f09,_0x70fee[_0x2cc7('0x17')][_0x2cc7('0x19')]);return _0x30896f(_0x70fee['error'][_0x2cc7('0x19')]);}logger[_0x2cc7('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x139f09,_0x70fee[_0x2cc7('0x17')][_0x2cc7('0x19')]);return _0x458e76(_0x70fee['error'][_0x2cc7('0x19')]);}else{logger[_0x2cc7('0x11')](_0x2cc7('0x12'),_0x139f09,_0x2cc7('0x15'));_0x458e76(_0x70fee[_0x2cc7('0x1a')]['message']);}})[_0x2cc7('0x1b')](function(_0x40d495){logger[_0x2cc7('0x17')](_0x2cc7('0x12'),_0x139f09,_0x40d495);_0x30896f(_0x40d495);});});}exports[_0x2cc7('0x1c')]=function(_0x116bf9){var _0x985826=this;return new Promise(function(_0x5a54f5,_0x464cf2){return db[_0x2cc7('0x1d')][_0x2cc7('0x1e')]({'raw':_0x116bf9[_0x2cc7('0x1f')]?_0x116bf9[_0x2cc7('0x1f')][_0x2cc7('0x20')]===undefined?!![]:![]:!![],'where':_0x116bf9['options']?_0x116bf9[_0x2cc7('0x1f')][_0x2cc7('0x21')]||null:null,'attributes':_0x116bf9[_0x2cc7('0x1f')]?_0x116bf9['options']['attributes']||null:null,'limit':_0x116bf9[_0x2cc7('0x1f')]?_0x116bf9[_0x2cc7('0x1f')][_0x2cc7('0x22')]||null:null,'include':_0x116bf9['options']?_0x116bf9[_0x2cc7('0x1f')]['include']?_[_0x2cc7('0x23')](_0x116bf9[_0x2cc7('0x1f')][_0x2cc7('0x24')],function(_0x3c072e){return{'model':db[_0x3c072e[_0x2cc7('0x25')]],'as':_0x3c072e['as'],'attributes':_0x3c072e[_0x2cc7('0x26')],'include':_0x3c072e['include']?_['map'](_0x3c072e[_0x2cc7('0x24')],function(_0x113740){return{'model':db[_0x113740[_0x2cc7('0x25')]],'as':_0x113740['as'],'attributes':_0x113740[_0x2cc7('0x26')],'include':_0x113740[_0x2cc7('0x24')]?_[_0x2cc7('0x23')](_0x113740[_0x2cc7('0x24')],function(_0x234702){return{'model':db[_0x234702['model']],'as':_0x234702['as'],'attributes':_0x234702[_0x2cc7('0x26')]};}):[]};}):[]};}):[]:[]})[_0x2cc7('0x10')](function(_0x69063){logger['info']('GetVoiceQueue',_0x116bf9);logger['debug'](_0x2cc7('0x1c'),_0x116bf9,JSON[_0x2cc7('0x16')](_0x69063));_0x5a54f5(_0x69063);})[_0x2cc7('0x1b')](function(_0x2bab90){logger[_0x2cc7('0x17')](_0x2cc7('0x1c'),_0x2bab90[_0x2cc7('0x19')],_0x116bf9);_0x464cf2(_0x985826[_0x2cc7('0x17')](0x1f4,_0x2bab90[_0x2cc7('0x19')]));});});};exports[_0x2cc7('0x27')]=function(_0xfb1655){var _0x5e52c7=this;return new Promise(function(_0x6724f8,_0x3a7a44){return db['VoiceQueue'][_0x2cc7('0x28')]({'raw':_0xfb1655[_0x2cc7('0x1f')]?_0xfb1655[_0x2cc7('0x1f')][_0x2cc7('0x20')]===undefined?!![]:![]:!![],'where':_0xfb1655[_0x2cc7('0x1f')]?_0xfb1655[_0x2cc7('0x1f')][_0x2cc7('0x21')]||null:null,'attributes':_0xfb1655[_0x2cc7('0x1f')]?_0xfb1655[_0x2cc7('0x1f')][_0x2cc7('0x26')]||null:null,'include':_0xfb1655[_0x2cc7('0x1f')]?_0xfb1655['options'][_0x2cc7('0x24')]?_[_0x2cc7('0x23')](_0xfb1655[_0x2cc7('0x1f')]['include'],function(_0x2fc351){return{'model':db[_0x2fc351[_0x2cc7('0x25')]],'as':_0x2fc351['as'],'attributes':_0x2fc351['attributes'],'include':_0x2fc351[_0x2cc7('0x24')]?_[_0x2cc7('0x23')](_0x2fc351[_0x2cc7('0x24')],function(_0x1b7347){return{'model':db[_0x1b7347['model']],'as':_0x1b7347['as'],'attributes':_0x1b7347[_0x2cc7('0x26')],'include':_0x1b7347[_0x2cc7('0x24')]?_[_0x2cc7('0x23')](_0x1b7347[_0x2cc7('0x24')],function(_0x99e80d){return{'model':db[_0x99e80d[_0x2cc7('0x25')]],'as':_0x99e80d['as'],'attributes':_0x99e80d[_0x2cc7('0x26')]};}):[]};}):[]};}):[]:[]})[_0x2cc7('0x10')](function(_0x50e00b){logger[_0x2cc7('0x11')](_0x2cc7('0x27'),_0xfb1655);logger[_0x2cc7('0x13')](_0x2cc7('0x27'),_0xfb1655,JSON[_0x2cc7('0x16')](_0x50e00b));_0x6724f8(_0x50e00b);})['catch'](function(_0x3b35e1){logger[_0x2cc7('0x17')]('ShowVoiceQueue',_0x3b35e1[_0x2cc7('0x19')],_0xfb1655);_0x3a7a44(_0x5e52c7[_0x2cc7('0x17')](0x1f4,_0x3b35e1['message']));});});}; \ No newline at end of file +var _0x7ba3=['VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','include','map','model','attributes','stringify','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x7ba3,0x1c2));var _0x37ba=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x7ba3[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require(_0x37ba('0x0'));var util=require(_0x37ba('0x1'));var moment=require(_0x37ba('0x2'));var BPromise=require(_0x37ba('0x3'));var rs=require(_0x37ba('0x4'));var fs=require('fs');var Redis=require(_0x37ba('0x5'));var db=require(_0x37ba('0x6'))['db'];var utils=require(_0x37ba('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x37ba('0x8'));var jayson=require(_0x37ba('0x9'));var client=jayson[_0x37ba('0xa')][_0x37ba('0xb')]({'port':0x232a});config['redis']=_[_0x37ba('0xc')](config[_0x37ba('0xd')],{'host':_0x37ba('0xe'),'port':0x18eb});var socket=require(_0x37ba('0xf'))(new Redis(config[_0x37ba('0xd')]));require(_0x37ba('0x10'))[_0x37ba('0x11')](socket);function respondWithRpcPromise(_0x20851b,_0x50bef4,_0x1958a7){return new BPromise(function(_0xd708fb,_0x3fa676){return client[_0x37ba('0x12')](_0x20851b,_0x1958a7)[_0x37ba('0x13')](function(_0x3b930d){logger['info'](_0x37ba('0x14'),_0x50bef4,_0x37ba('0x15'));logger[_0x37ba('0x16')](_0x37ba('0x17'),_0x50bef4,_0x37ba('0x15'),JSON['stringify'](_0x3b930d));if(_0x3b930d['error']){if(_0x3b930d['error']['code']===0x1f4){logger['error'](_0x37ba('0x14'),_0x50bef4,_0x3b930d['error']['message']);return _0x3fa676(_0x3b930d[_0x37ba('0x18')][_0x37ba('0x19')]);}logger[_0x37ba('0x18')](_0x37ba('0x14'),_0x50bef4,_0x3b930d[_0x37ba('0x18')][_0x37ba('0x19')]);return _0xd708fb(_0x3b930d['error'][_0x37ba('0x19')]);}else{logger[_0x37ba('0x1a')](_0x37ba('0x14'),_0x50bef4,_0x37ba('0x15'));_0xd708fb(_0x3b930d[_0x37ba('0x1b')][_0x37ba('0x19')]);}})[_0x37ba('0x1c')](function(_0xf6a437){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x50bef4,_0xf6a437);_0x3fa676(_0xf6a437);});});}exports[_0x37ba('0x1d')]=function(_0x24025b){var _0x37c296=this;return new Promise(function(_0x55a18e,_0x1c18e7){return db[_0x37ba('0x1e')][_0x37ba('0x1f')]({'raw':_0x24025b['options']?_0x24025b['options']['raw']===undefined?!![]:![]:!![],'where':_0x24025b[_0x37ba('0x20')]?_0x24025b[_0x37ba('0x20')][_0x37ba('0x21')]||null:null,'attributes':_0x24025b[_0x37ba('0x20')]?_0x24025b[_0x37ba('0x20')]['attributes']||null:null,'limit':_0x24025b['options']?_0x24025b[_0x37ba('0x20')][_0x37ba('0x22')]||null:null,'include':_0x24025b[_0x37ba('0x20')]?_0x24025b[_0x37ba('0x20')][_0x37ba('0x23')]?_[_0x37ba('0x24')](_0x24025b[_0x37ba('0x20')]['include'],function(_0x5f305c){return{'model':db[_0x5f305c[_0x37ba('0x25')]],'as':_0x5f305c['as'],'attributes':_0x5f305c[_0x37ba('0x26')],'include':_0x5f305c[_0x37ba('0x23')]?_[_0x37ba('0x24')](_0x5f305c['include'],function(_0x35f6bc){return{'model':db[_0x35f6bc['model']],'as':_0x35f6bc['as'],'attributes':_0x35f6bc[_0x37ba('0x26')],'include':_0x35f6bc[_0x37ba('0x23')]?_[_0x37ba('0x24')](_0x35f6bc['include'],function(_0x45cb37){return{'model':db[_0x45cb37[_0x37ba('0x25')]],'as':_0x45cb37['as'],'attributes':_0x45cb37[_0x37ba('0x26')]};}):[]};}):[]};}):[]:[]})[_0x37ba('0x13')](function(_0x299474){logger[_0x37ba('0x1a')](_0x37ba('0x1d'),_0x24025b);logger['debug'](_0x37ba('0x1d'),_0x24025b,JSON[_0x37ba('0x27')](_0x299474));_0x55a18e(_0x299474);})[_0x37ba('0x1c')](function(_0x259e8b){logger[_0x37ba('0x18')](_0x37ba('0x1d'),_0x259e8b[_0x37ba('0x19')],_0x24025b);_0x1c18e7(_0x37c296[_0x37ba('0x18')](0x1f4,_0x259e8b[_0x37ba('0x19')]));});});};exports[_0x37ba('0x28')]=function(_0x26261d){var _0x136bb6=this;return new Promise(function(_0xefe8c6,_0x12b73a){return db[_0x37ba('0x1e')][_0x37ba('0x29')]({'raw':_0x26261d[_0x37ba('0x20')]?_0x26261d[_0x37ba('0x20')][_0x37ba('0x2a')]===undefined?!![]:![]:!![],'where':_0x26261d[_0x37ba('0x20')]?_0x26261d[_0x37ba('0x20')][_0x37ba('0x21')]||null:null,'attributes':_0x26261d['options']?_0x26261d[_0x37ba('0x20')][_0x37ba('0x26')]||null:null,'include':_0x26261d['options']?_0x26261d['options'][_0x37ba('0x23')]?_[_0x37ba('0x24')](_0x26261d[_0x37ba('0x20')][_0x37ba('0x23')],function(_0x1633b9){return{'model':db[_0x1633b9[_0x37ba('0x25')]],'as':_0x1633b9['as'],'attributes':_0x1633b9[_0x37ba('0x26')],'include':_0x1633b9[_0x37ba('0x23')]?_['map'](_0x1633b9[_0x37ba('0x23')],function(_0x25a8c5){return{'model':db[_0x25a8c5[_0x37ba('0x25')]],'as':_0x25a8c5['as'],'attributes':_0x25a8c5['attributes'],'include':_0x25a8c5[_0x37ba('0x23')]?_[_0x37ba('0x24')](_0x25a8c5[_0x37ba('0x23')],function(_0x5b0ed4){return{'model':db[_0x5b0ed4[_0x37ba('0x25')]],'as':_0x5b0ed4['as'],'attributes':_0x5b0ed4[_0x37ba('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x501909){logger[_0x37ba('0x1a')](_0x37ba('0x28'),_0x26261d);logger[_0x37ba('0x16')](_0x37ba('0x28'),_0x26261d,JSON[_0x37ba('0x27')](_0x501909));_0xefe8c6(_0x501909);})[_0x37ba('0x1c')](function(_0x573bc7){logger[_0x37ba('0x18')](_0x37ba('0x28'),_0x573bc7['message'],_0x26261d);_0x12b73a(_0x136bb6[_0x37ba('0x18')](0x1f4,_0x573bc7[_0x37ba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d98d6f7..1d8ef70 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 _0xc5d0=['voiceQueue:','remove','emit','register','length'];(function(_0x3f9a1b,_0x474051){var _0xb419cd=function(_0x5a8633){while(--_0x5a8633){_0x3f9a1b['push'](_0x3f9a1b['shift']());}};_0xb419cd(++_0x474051);}(_0xc5d0,0x169));var _0x0c5d=function(_0x402dbb,_0x22a80f){_0x402dbb=_0x402dbb-0x0;var _0x69b4b=_0xc5d0[_0x402dbb];return _0x69b4b;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x0c5d('0x0'),'update'];function createListener(_0x6a79ec,_0x2b7a33){return function(_0x208d53){_0x2b7a33[_0x0c5d('0x1')](_0x6a79ec,_0x208d53);};}function removeListener(_0x5a74f4,_0x5b4211){return function(){VoiceQueueEvents['removeListener'](_0x5a74f4,_0x5b4211);};}exports[_0x0c5d('0x2')]=function(_0x5c5346){for(var _0x4c2c7b=0x0,_0x1081a9=events[_0x0c5d('0x3')];_0x4c2c7b<_0x1081a9;_0x4c2c7b++){var _0x889313=events[_0x4c2c7b];var _0x7cdddd=createListener(_0x0c5d('0x4')+_0x889313,_0x5c5346);VoiceQueueEvents['on'](_0x889313,_0x7cdddd);}}; \ No newline at end of file +var _0xc396=['removeListener','voiceQueue:','./voiceQueue.events','remove','update','emit'];(function(_0x25a7e6,_0x18de96){var _0x592645=function(_0x19d2a0){while(--_0x19d2a0){_0x25a7e6['push'](_0x25a7e6['shift']());}};_0x592645(++_0x18de96);}(_0xc396,0x134));var _0x6c39=function(_0x3a86c8,_0x591464){_0x3a86c8=_0x3a86c8-0x0;var _0x3291e0=_0xc396[_0x3a86c8];return _0x3291e0;};'use strict';var VoiceQueueEvents=require(_0x6c39('0x0'));var events=['save',_0x6c39('0x1'),_0x6c39('0x2')];function createListener(_0x3d125d,_0x3fe8ff){return function(_0x2b2d86){_0x3fe8ff[_0x6c39('0x3')](_0x3d125d,_0x2b2d86);};}function removeListener(_0xa58ae3,_0x196d90){return function(){VoiceQueueEvents[_0x6c39('0x4')](_0xa58ae3,_0x196d90);};}exports['register']=function(_0x57c534){for(var _0x2a5a8a=0x0,_0x1309f3=events['length'];_0x2a5a8a<_0x1309f3;_0x2a5a8a++){var _0x45c4e8=events[_0x2a5a8a];var _0x10c23c=createListener(_0x6c39('0x5')+_0x45c4e8,_0x57c534);VoiceQueueEvents['on'](_0x45c4e8,_0x10c23c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index fb693f7..8422075 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 _0x5289=['delete','destroy','multer','path','Router','../../components/auth/service','../../config/environment','get','index','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x563301,_0x81a41b){var _0x4af438=function(_0x23f48f){while(--_0x23f48f){_0x563301['push'](_0x563301['shift']());}};_0x4af438(++_0x81a41b);}(_0x5289,0x191));var _0x9528=function(_0x4ee6b9,_0x385676){_0x4ee6b9=_0x4ee6b9-0x0;var _0x33b572=_0x5289[_0x4ee6b9];return _0x33b572;};'use strict';var multer=require(_0x9528('0x0'));var util=require('util');var path=require(_0x9528('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9528('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9528('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9528('0x4'));var controller=require('./voiceQueueReport.controller');router[_0x9528('0x5')]('/',auth['isAuthenticated'](),controller[_0x9528('0x6')]);router[_0x9528('0x5')](_0x9528('0x7'),auth['isAuthenticated'](),controller[_0x9528('0x8')]);router[_0x9528('0x5')](_0x9528('0x9'),auth[_0x9528('0xa')](),controller[_0x9528('0xb')]);router[_0x9528('0x5')](_0x9528('0xc'),auth[_0x9528('0xa')](),controller[_0x9528('0xd')]);router[_0x9528('0xe')]('/',auth[_0x9528('0xa')](),controller[_0x9528('0xf')]);router[_0x9528('0x10')](_0x9528('0xc'),auth[_0x9528('0xa')](),controller['update']);router[_0x9528('0x11')](_0x9528('0xc'),auth[_0x9528('0xa')](),controller[_0x9528('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8208=['./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','put','delete','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x24333d,_0x2f30b0){var _0x40d01b=function(_0x4ff6ec){while(--_0x4ff6ec){_0x24333d['push'](_0x24333d['shift']());}};_0x40d01b(++_0x2f30b0);}(_0x8208,0x150));var _0x8820=function(_0x39a2c0,_0x358f57){_0x39a2c0=_0x39a2c0-0x0;var _0xe8c260=_0x8208[_0x39a2c0];return _0xe8c260;};'use strict';var multer=require(_0x8820('0x0'));var util=require('util');var path=require(_0x8820('0x1'));var timeout=require('connect-timeout');var express=require(_0x8820('0x2'));var router=express[_0x8820('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8820('0x4'));var config=require(_0x8820('0x5'));var controller=require(_0x8820('0x6'));router[_0x8820('0x7')]('/',auth[_0x8820('0x8')](),controller[_0x8820('0x9')]);router[_0x8820('0x7')](_0x8820('0xa'),auth['isAuthenticated'](),controller[_0x8820('0xb')]);router[_0x8820('0x7')](_0x8820('0xc'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x8820('0x7')](_0x8820('0xd'),auth[_0x8820('0x8')](),controller[_0x8820('0xe')]);router[_0x8820('0xf')]('/',auth[_0x8820('0x8')](),controller['create']);router[_0x8820('0x10')](_0x8820('0xd'),auth[_0x8820('0x8')](),controller['update']);router[_0x8820('0x11')](_0x8820('0xd'),auth[_0x8820('0x8')](),controller[_0x8820('0x12')]);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 d7a596b..dc897e0 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 _0xed15=['sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2af11a,_0x443532){var _0x40d52e=function(_0xcfe7b2){while(--_0xcfe7b2){_0x2af11a['push'](_0x2af11a['shift']());}};_0x40d52e(++_0x443532);}(_0xed15,0xcc));var _0x5ed1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xed15[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x5ed1('0x0'));var moment=require(_0x5ed1('0x1'));module['exports']={'type':{'type':Sequelize[_0x5ed1('0x2')]},'uniqueid':{'type':Sequelize[_0x5ed1('0x2')]},'calleridnum':{'type':Sequelize[_0x5ed1('0x2')]},'calleridname':{'type':Sequelize[_0x5ed1('0x2')]},'queue':{'type':Sequelize[_0x5ed1('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x5ed1('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3f5b68){var _0x3c9530=moment(_0x3f5b68);var _0x47d557=moment(this[_0x5ed1('0x4')](_0x5ed1('0x5')))[_0x5ed1('0x6')](_0x5ed1('0x7'));var _0x50a768=_0x3c9530[_0x5ed1('0x8')](_0x47d557,_0x5ed1('0x9'));this[_0x5ed1('0xa')](_0x5ed1('0xb'),_0x3f5b68);this[_0x5ed1('0xa')](_0x5ed1('0xc'),_0x50a768||null);}},'position':{'type':Sequelize[_0x5ed1('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5ed1('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5ed1('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5ed1('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x5ed1('0x2')],'comment':_0x5ed1('0xf')},'originalposition':{'type':Sequelize[_0x5ed1('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5ed1('0x2')]},'connectedlinename':{'type':Sequelize[_0x5ed1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5ed1('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5ed1('0x2')]},'holdtime':{'type':Sequelize[_0x5ed1('0xd')]},'mohtime':{'type':Sequelize[_0x5ed1('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5ed1('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5ed1('0x2')]},'transfer':{'type':Sequelize[_0x5ed1('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5ed1('0x2')],'comment':_0x5ed1('0x10')},'transferexten':{'type':Sequelize[_0x5ed1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5ed1('0x2')]},'disposition':{'type':Sequelize[_0x5ed1('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5ed1('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5ed1('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d3a=['queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue'];(function(_0x2ef714,_0x49e1c4){var _0x252ab0=function(_0x868e73){while(--_0x868e73){_0x2ef714['push'](_0x2ef714['shift']());}};_0x252ab0(++_0x49e1c4);}(_0x4d3a,0x193));var _0xa4d3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x4d3a[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa4d3('0x0'));module[_0xa4d3('0x1')]={'type':{'type':Sequelize[_0xa4d3('0x2')]},'uniqueid':{'type':Sequelize[_0xa4d3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa4d3('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xa4d3('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xa4d3('0x3')],'set':function(_0x348685){var _0x1f335c=moment(_0x348685);var _0x1cc5a7=moment(this[_0xa4d3('0x4')](_0xa4d3('0x5')))[_0xa4d3('0x6')](_0xa4d3('0x7'));var _0x15f2ea=_0x1f335c[_0xa4d3('0x8')](_0x1cc5a7,_0xa4d3('0x9'));this[_0xa4d3('0xa')](_0xa4d3('0xb'),_0x348685);this['setDataValue'](_0xa4d3('0xc'),_0x15f2ea||null);}},'position':{'type':Sequelize[_0xa4d3('0xd')]},'count':{'type':Sequelize[_0xa4d3('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xa4d3('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa4d3('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xa4d3('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa4d3('0x3')]},'queuecallerexit':{'type':Sequelize[_0xa4d3('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa4d3('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xa4d3('0x2')],'comment':_0xa4d3('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa4d3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa4d3('0x2')]},'context':{'type':Sequelize[_0xa4d3('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa4d3('0x2')]},'holdtime':{'type':Sequelize[_0xa4d3('0xd')]},'mohtime':{'type':Sequelize[_0xa4d3('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa4d3('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa4d3('0x2')]},'transfer':{'type':Sequelize[_0xa4d3('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa4d3('0x2')],'comment':_0xa4d3('0x10')},'transferexten':{'type':Sequelize[_0xa4d3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xa4d3('0x2')]},'secondDisposition':{'type':Sequelize[_0xa4d3('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xa4d3('0xd')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 1c65add..c6df304 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 _0xcc77=['pick','getVoiceQueuesReport','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','update','params','describe','order'];(function(_0x4e0f47,_0x382e57){var _0x36a384=function(_0x1c3e63){while(--_0x1c3e63){_0x4e0f47['push'](_0x4e0f47['shift']());}};_0x36a384(++_0x382e57);}(_0xcc77,0xa6));var _0x7cc7=function(_0x1de484,_0x270cd3){_0x1de484=_0x1de484-0x0;var _0x3e2ff3=_0xcc77[_0x1de484];return _0x3e2ff3;};'use strict';var emlformat=require(_0x7cc7('0x0'));var rimraf=require(_0x7cc7('0x1'));var zipdir=require(_0x7cc7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7cc7('0x3'));var BPromise=require(_0x7cc7('0x4'));var Mustache=require(_0x7cc7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7cc7('0x6'));var csv=require(_0x7cc7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cc7('0x8'));var _=require(_0x7cc7('0x9'));var squel=require(_0x7cc7('0xa'));var crypto=require(_0x7cc7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7cc7('0xc'));var toCsv=require(_0x7cc7('0x7'));var querystring=require(_0x7cc7('0xd'));var Papa=require(_0x7cc7('0xe'));var Redis=require(_0x7cc7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7cc7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cc7('0x11'))(_0x7cc7('0x12'));var utils=require(_0x7cc7('0x13'));var config=require(_0x7cc7('0x14'));var licenseUtil=require(_0x7cc7('0x15'));var db=require(_0x7cc7('0x16'))['db'];config['redis']=_['defaults'](config[_0x7cc7('0x17')],{'host':_0x7cc7('0x18'),'port':0x18eb});var socket=require(_0x7cc7('0x19'))(new Redis(config[_0x7cc7('0x17')]));require(_0x7cc7('0x1a'))[_0x7cc7('0x1b')](socket);function respondWithStatusCode(_0x3c4624,_0x4a9405){_0x4a9405=_0x4a9405||0xcc;return function(_0x5d1c46){if(_0x5d1c46){return _0x3c4624[_0x7cc7('0x1c')](_0x4a9405);}return _0x3c4624[_0x7cc7('0x1d')](_0x4a9405)[_0x7cc7('0x1e')]();};}function respondWithResult(_0x3967f3,_0x46c3fb){_0x46c3fb=_0x46c3fb||0xc8;return function(_0x25d00f){if(_0x25d00f){return _0x3967f3[_0x7cc7('0x1d')](_0x46c3fb)[_0x7cc7('0x1f')](_0x25d00f);}};}function respondWithFilteredResult(_0x4771d2,_0x5bf62d){return function(_0x152984){if(_0x152984){var _0x5e137e=typeof _0x5bf62d[_0x7cc7('0x20')]===_0x7cc7('0x21')&&typeof _0x5bf62d['limit']===_0x7cc7('0x21');var _0x3cb376=_0x152984['count'];var _0x736753=_0x5e137e?0x0:_0x5bf62d[_0x7cc7('0x20')];var _0x1f4d46=_0x5e137e?_0x152984[_0x7cc7('0x22')]:_0x5bf62d['offset']+_0x5bf62d[_0x7cc7('0x23')];var _0x1ecc5b;if(_0x1f4d46>=_0x3cb376){_0x1f4d46=_0x3cb376;_0x1ecc5b=0xc8;}else{_0x1ecc5b=0xce;}_0x4771d2[_0x7cc7('0x1d')](_0x1ecc5b);return _0x4771d2['set'](_0x7cc7('0x24'),_0x736753+'-'+_0x1f4d46+'/'+_0x3cb376)[_0x7cc7('0x1f')](_0x152984);}return null;};}function patchUpdates(_0x340fcb){return function(_0x20b689){try{jsonpatch[_0x7cc7('0x25')](_0x20b689,_0x340fcb,!![]);}catch(_0x64a2d3){return BPromise[_0x7cc7('0x26')](_0x64a2d3);}return _0x20b689[_0x7cc7('0x27')]();};}function saveUpdates(_0xcfa18,_0x3c5b20){return function(_0x23014b){if(_0x23014b){return _0x23014b['update'](_0xcfa18)[_0x7cc7('0x28')](function(_0x3a087a){return _0x3a087a;});}return null;};}function removeEntity(_0x434805,_0x521135){return function(_0xcb8587){if(_0xcb8587){return _0xcb8587[_0x7cc7('0x29')]()[_0x7cc7('0x28')](function(){_0x434805[_0x7cc7('0x1d')](0xcc)[_0x7cc7('0x1e')]();});}};}function handleEntityNotFound(_0x97f650,_0x8ede29){return function(_0x5946f2){if(!_0x5946f2){_0x97f650['sendStatus'](0x194);}return _0x5946f2;};}function handleError(_0x4578bb,_0x35e9ef){_0x35e9ef=_0x35e9ef||0x1f4;return function(_0x48071a){logger[_0x7cc7('0x2a')](_0x48071a[_0x7cc7('0x2b')]);if(_0x48071a[_0x7cc7('0x2c')]){delete _0x48071a['name'];}_0x4578bb[_0x7cc7('0x1d')](_0x35e9ef)[_0x7cc7('0x2d')](_0x48071a);};}exports['index']=function(_0x390e25,_0x20d9ad){var _0x433c80={},_0x20e8f2={},_0x87df64={'count':0x0,'rows':[]};var _0x32d2e2=_[_0x7cc7('0x2e')](db[_0x7cc7('0x2f')]['rawAttributes'],function(_0x5a06ed){return{'name':_0x5a06ed[_0x7cc7('0x30')],'type':_0x5a06ed[_0x7cc7('0x31')][_0x7cc7('0x32')]};});_0x20e8f2[_0x7cc7('0x33')]=_[_0x7cc7('0x2e')](_0x32d2e2,'name');_0x20e8f2[_0x7cc7('0x34')]=_[_0x7cc7('0x35')](_0x390e25['query']);_0x20e8f2[_0x7cc7('0x36')]=_[_0x7cc7('0x37')](_0x20e8f2['model'],_0x20e8f2['query']);_0x433c80[_0x7cc7('0x38')]=_[_0x7cc7('0x37')](_0x20e8f2[_0x7cc7('0x33')],qs[_0x7cc7('0x39')](_0x390e25['query']['fields']));_0x433c80[_0x7cc7('0x38')]=_0x433c80[_0x7cc7('0x38')][_0x7cc7('0x3a')]?_0x433c80[_0x7cc7('0x38')]:_0x20e8f2[_0x7cc7('0x33')];if(!_0x390e25[_0x7cc7('0x34')][_0x7cc7('0x3b')](_0x7cc7('0x3c'))){_0x433c80[_0x7cc7('0x23')]=qs[_0x7cc7('0x23')](_0x390e25[_0x7cc7('0x34')][_0x7cc7('0x23')]);_0x433c80[_0x7cc7('0x20')]=qs[_0x7cc7('0x20')](_0x390e25[_0x7cc7('0x34')][_0x7cc7('0x20')]);}_0x433c80['order']=qs['sort'](_0x390e25['query'][_0x7cc7('0x3d')]);_0x433c80[_0x7cc7('0x3e')]=qs[_0x7cc7('0x36')](_['pick'](_0x390e25[_0x7cc7('0x34')],_0x20e8f2[_0x7cc7('0x36')]),_0x32d2e2);if(_0x390e25[_0x7cc7('0x34')][_0x7cc7('0x3f')]){_0x433c80[_0x7cc7('0x3e')]=_['merge'](_0x433c80[_0x7cc7('0x3e')],{'$or':_[_0x7cc7('0x2e')](_0x32d2e2,function(_0x4d4795){if(_0x4d4795[_0x7cc7('0x31')]!==_0x7cc7('0x40')){var _0x474b0e={};_0x474b0e[_0x4d4795['name']]={'$like':'%'+_0x390e25[_0x7cc7('0x34')]['filter']+'%'};return _0x474b0e;}})});}_0x433c80=_[_0x7cc7('0x41')]({},_0x433c80,_0x390e25[_0x7cc7('0x42')]);var _0x3b3038={'where':_0x433c80['where']};return db[_0x7cc7('0x2f')]['count'](_0x3b3038)['then'](function(_0x2ab618){_0x87df64[_0x7cc7('0x22')]=_0x2ab618;if(_0x390e25[_0x7cc7('0x34')][_0x7cc7('0x43')]){_0x433c80[_0x7cc7('0x44')]=[{'all':!![]}];}return db[_0x7cc7('0x2f')][_0x7cc7('0x45')](_0x433c80);})['then'](function(_0x1dcd62){_0x87df64[_0x7cc7('0x46')]=_0x1dcd62;return _0x87df64;})[_0x7cc7('0x28')](respondWithFilteredResult(_0x20d9ad,_0x433c80))[_0x7cc7('0x47')](handleError(_0x20d9ad,null));};exports['show']=function(_0x4fad5e,_0x3bcf39){var _0x21b67e={'raw':![],'where':{'id':_0x4fad5e['params']['id']}},_0x3213f1={};_0x3213f1[_0x7cc7('0x33')]=_[_0x7cc7('0x35')](db[_0x7cc7('0x2f')][_0x7cc7('0x48')]);_0x3213f1[_0x7cc7('0x34')]=_[_0x7cc7('0x35')](_0x4fad5e[_0x7cc7('0x34')]);_0x3213f1['filters']=_['intersection'](_0x3213f1[_0x7cc7('0x33')],_0x3213f1[_0x7cc7('0x34')]);_0x21b67e[_0x7cc7('0x38')]=_['intersection'](_0x3213f1[_0x7cc7('0x33')],qs[_0x7cc7('0x39')](_0x4fad5e[_0x7cc7('0x34')][_0x7cc7('0x39')]));_0x21b67e['attributes']=_0x21b67e[_0x7cc7('0x38')][_0x7cc7('0x3a')]?_0x21b67e[_0x7cc7('0x38')]:_0x3213f1[_0x7cc7('0x33')];if(_0x4fad5e[_0x7cc7('0x34')][_0x7cc7('0x43')]){_0x21b67e[_0x7cc7('0x44')]=[{'all':!![]}];}_0x21b67e=_[_0x7cc7('0x41')]({},_0x21b67e,_0x4fad5e['options']);return db[_0x7cc7('0x2f')][_0x7cc7('0x49')](_0x21b67e)['then'](handleEntityNotFound(_0x3bcf39,null))[_0x7cc7('0x28')](respondWithResult(_0x3bcf39,null))['catch'](handleError(_0x3bcf39,null));};exports[_0x7cc7('0x4a')]=function(_0x599138,_0x34cec3){return db[_0x7cc7('0x2f')][_0x7cc7('0x4a')](_0x599138[_0x7cc7('0x4b')],{})[_0x7cc7('0x28')](respondWithResult(_0x34cec3,0xc9))[_0x7cc7('0x47')](handleError(_0x34cec3,null));};exports[_0x7cc7('0x4c')]=function(_0x47e900,_0x40658b){if(_0x47e900[_0x7cc7('0x4b')]['id']){delete _0x47e900[_0x7cc7('0x4b')]['id'];}return db['VoiceQueueReport'][_0x7cc7('0x49')]({'where':{'id':_0x47e900[_0x7cc7('0x4d')]['id']}})[_0x7cc7('0x28')](handleEntityNotFound(_0x40658b,null))[_0x7cc7('0x28')](saveUpdates(_0x47e900[_0x7cc7('0x4b')],null))[_0x7cc7('0x28')](respondWithResult(_0x40658b,null))[_0x7cc7('0x47')](handleError(_0x40658b,null));};exports[_0x7cc7('0x29')]=function(_0x4ba677,_0x2c3e6b){return db[_0x7cc7('0x2f')][_0x7cc7('0x49')]({'where':{'id':_0x4ba677[_0x7cc7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c3e6b,null))[_0x7cc7('0x28')](removeEntity(_0x2c3e6b,null))['catch'](handleError(_0x2c3e6b,null));};exports[_0x7cc7('0x4e')]=function(_0x187fe3,_0x3452f2){return db[_0x7cc7('0x2f')][_0x7cc7('0x4e')]()[_0x7cc7('0x28')](respondWithResult(_0x3452f2,null))[_0x7cc7('0x47')](handleError(_0x3452f2,null));};exports['getVoiceQueuesReport']=function(_0x33f5c4,_0x46a736){var _0x45fd2f={},_0x10b05d={},_0x2a0c8e={'count':0x0,'rows':[]};_0x10b05d['model']=_[_0x7cc7('0x35')](db[_0x7cc7('0x2f')][_0x7cc7('0x48')]);_0x10b05d[_0x7cc7('0x34')]=_['keys'](_0x33f5c4['query']);_0x10b05d[_0x7cc7('0x36')]=_[_0x7cc7('0x37')](_0x10b05d[_0x7cc7('0x33')],_0x10b05d[_0x7cc7('0x34')]);_0x45fd2f[_0x7cc7('0x38')]=_[_0x7cc7('0x37')](_0x10b05d[_0x7cc7('0x33')],qs['fields'](_0x33f5c4[_0x7cc7('0x34')][_0x7cc7('0x39')]));_0x45fd2f[_0x7cc7('0x38')]=_0x45fd2f[_0x7cc7('0x38')][_0x7cc7('0x3a')]?_0x45fd2f['attributes']:_0x10b05d[_0x7cc7('0x33')];if(!_0x33f5c4[_0x7cc7('0x34')][_0x7cc7('0x3b')](_0x7cc7('0x3c'))){_0x45fd2f['limit']=qs[_0x7cc7('0x23')](_0x33f5c4[_0x7cc7('0x34')][_0x7cc7('0x23')]);_0x45fd2f[_0x7cc7('0x20')]=qs[_0x7cc7('0x20')](_0x33f5c4['query'][_0x7cc7('0x20')]);}_0x45fd2f[_0x7cc7('0x4f')]=qs[_0x7cc7('0x3d')](_0x33f5c4[_0x7cc7('0x34')][_0x7cc7('0x3d')]);_0x45fd2f[_0x7cc7('0x3e')]=qs[_0x7cc7('0x36')](_[_0x7cc7('0x50')](_0x33f5c4['query'],_0x10b05d[_0x7cc7('0x36')]));if(_0x33f5c4[_0x7cc7('0x34')][_0x7cc7('0x3f')]){_0x45fd2f[_0x7cc7('0x3e')]=_[_0x7cc7('0x41')](_0x45fd2f['where'],{'$or':_[_0x7cc7('0x2e')](_0x45fd2f['attributes'],function(_0x6ac190){var _0x558ec3={};_0x558ec3[_0x6ac190]={'$like':'%'+_0x33f5c4[_0x7cc7('0x34')][_0x7cc7('0x3f')]+'%'};return _0x558ec3;})});}_0x45fd2f=_[_0x7cc7('0x41')]({},_0x45fd2f,_0x33f5c4[_0x7cc7('0x42')]);var _0x4477e3={'where':_0x45fd2f[_0x7cc7('0x3e')]};return db[_0x7cc7('0x2f')]['count'](_0x4477e3)[_0x7cc7('0x28')](function(_0x144cfc){_0x2a0c8e[_0x7cc7('0x22')]=_0x144cfc;if(_0x33f5c4[_0x7cc7('0x34')][_0x7cc7('0x43')]){_0x45fd2f[_0x7cc7('0x44')]=[{'all':!![]}];}return db[_0x7cc7('0x2f')][_0x7cc7('0x45')](_0x45fd2f);})['then'](function(_0x13c558){_0x2a0c8e[_0x7cc7('0x46')]=_0x13c558;return _0x2a0c8e;})[_0x7cc7('0x28')](respondWithFilteredResult(_0x46a736,_0x45fd2f,'getVoiceQueuesReport'))['catch'](handleError(_0x46a736,null,_0x7cc7('0x51')));}; \ No newline at end of file +var _0x6380=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VoiceQueueReport','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','getVoiceQueuesReport','rows'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x6380,0xf6));var _0x0638=function(_0x377b43,_0x25e8df){_0x377b43=_0x377b43-0x0;var _0x5b93d1=_0x6380[_0x377b43];return _0x5b93d1;};'use strict';var emlformat=require(_0x0638('0x0'));var rimraf=require(_0x0638('0x1'));var zipdir=require(_0x0638('0x2'));var jsonpatch=require(_0x0638('0x3'));var rp=require(_0x0638('0x4'));var moment=require('moment');var BPromise=require(_0x0638('0x5'));var Mustache=require(_0x0638('0x6'));var util=require('util');var path=require(_0x0638('0x7'));var sox=require('sox');var csv=require(_0x0638('0x8'));var ejs=require(_0x0638('0x9'));var fs=require('fs');var fs_extra=require(_0x0638('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0638('0xb'));var jsforce=require(_0x0638('0xc'));var deskjs=require(_0x0638('0xd'));var toCsv=require(_0x0638('0x8'));var querystring=require(_0x0638('0xe'));var Papa=require(_0x0638('0xf'));var Redis=require(_0x0638('0x10'));var authService=require(_0x0638('0x11'));var qs=require(_0x0638('0x12'));var as=require(_0x0638('0x13'));var hardwareService=require(_0x0638('0x14'));var logger=require('../../config/logger')(_0x0638('0x15'));var utils=require(_0x0638('0x16'));var config=require(_0x0638('0x17'));var licenseUtil=require(_0x0638('0x18'));var db=require(_0x0638('0x19'))['db'];config['redis']=_[_0x0638('0x1a')](config[_0x0638('0x1b')],{'host':_0x0638('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0638('0x1d'))[_0x0638('0x1e')](socket);function respondWithStatusCode(_0x29ff73,_0x3bd26f){_0x3bd26f=_0x3bd26f||0xcc;return function(_0x255e35){if(_0x255e35){return _0x29ff73[_0x0638('0x1f')](_0x3bd26f);}return _0x29ff73[_0x0638('0x20')](_0x3bd26f)[_0x0638('0x21')]();};}function respondWithResult(_0x66076a,_0x312ee2){_0x312ee2=_0x312ee2||0xc8;return function(_0x348289){if(_0x348289){return _0x66076a[_0x0638('0x20')](_0x312ee2)[_0x0638('0x22')](_0x348289);}};}function respondWithFilteredResult(_0x584683,_0x206e84){return function(_0x395c78){if(_0x395c78){var _0x82437b=typeof _0x206e84[_0x0638('0x23')]===_0x0638('0x24')&&typeof _0x206e84[_0x0638('0x25')]===_0x0638('0x24');var _0x32f256=_0x395c78['count'];var _0xbd5298=_0x82437b?0x0:_0x206e84[_0x0638('0x23')];var _0x54ad95=_0x82437b?_0x395c78[_0x0638('0x26')]:_0x206e84[_0x0638('0x23')]+_0x206e84['limit'];var _0x4c40cb;if(_0x54ad95>=_0x32f256){_0x54ad95=_0x32f256;_0x4c40cb=0xc8;}else{_0x4c40cb=0xce;}_0x584683[_0x0638('0x20')](_0x4c40cb);return _0x584683[_0x0638('0x27')]('Content-Range',_0xbd5298+'-'+_0x54ad95+'/'+_0x32f256)[_0x0638('0x22')](_0x395c78);}return null;};}function patchUpdates(_0x3bbd02){return function(_0x1b90e3){try{jsonpatch[_0x0638('0x28')](_0x1b90e3,_0x3bbd02,!![]);}catch(_0x229bdd){return BPromise[_0x0638('0x29')](_0x229bdd);}return _0x1b90e3['save']();};}function saveUpdates(_0x147dc4,_0x2ff44b){return function(_0x46fec8){if(_0x46fec8){return _0x46fec8[_0x0638('0x2a')](_0x147dc4)[_0x0638('0x2b')](function(_0x3c6ee4){return _0x3c6ee4;});}return null;};}function removeEntity(_0x4c6b86,_0x3f62b0){return function(_0x5c7406){if(_0x5c7406){return _0x5c7406[_0x0638('0x2c')]()[_0x0638('0x2b')](function(){_0x4c6b86[_0x0638('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da78b,_0x28b516){return function(_0x46ea80){if(!_0x46ea80){_0x3da78b[_0x0638('0x1f')](0x194);}return _0x46ea80;};}function handleError(_0xf8e488,_0x4e2485){_0x4e2485=_0x4e2485||0x1f4;return function(_0x11c11e){logger[_0x0638('0x2d')](_0x11c11e['stack']);if(_0x11c11e['name']){delete _0x11c11e[_0x0638('0x2e')];}_0xf8e488['status'](_0x4e2485)[_0x0638('0x2f')](_0x11c11e);};}exports[_0x0638('0x30')]=function(_0x1a7a68,_0x3af871){var _0x120015={},_0x4bb89c={},_0x5c0f56={'count':0x0,'rows':[]};var _0x49e8f1=_['map'](db['VoiceQueueReport'][_0x0638('0x31')],function(_0x170f7f){return{'name':_0x170f7f['fieldName'],'type':_0x170f7f[_0x0638('0x32')]['key']};});_0x4bb89c[_0x0638('0x33')]=_[_0x0638('0x34')](_0x49e8f1,_0x0638('0x2e'));_0x4bb89c[_0x0638('0x35')]=_['keys'](_0x1a7a68['query']);_0x4bb89c[_0x0638('0x36')]=_[_0x0638('0x37')](_0x4bb89c[_0x0638('0x33')],_0x4bb89c[_0x0638('0x35')]);_0x120015[_0x0638('0x38')]=_[_0x0638('0x37')](_0x4bb89c['model'],qs[_0x0638('0x39')](_0x1a7a68[_0x0638('0x35')][_0x0638('0x39')]));_0x120015[_0x0638('0x38')]=_0x120015['attributes'][_0x0638('0x3a')]?_0x120015[_0x0638('0x38')]:_0x4bb89c[_0x0638('0x33')];if(!_0x1a7a68[_0x0638('0x35')][_0x0638('0x3b')](_0x0638('0x3c'))){_0x120015[_0x0638('0x25')]=qs['limit'](_0x1a7a68[_0x0638('0x35')][_0x0638('0x25')]);_0x120015[_0x0638('0x23')]=qs['offset'](_0x1a7a68[_0x0638('0x35')][_0x0638('0x23')]);}_0x120015[_0x0638('0x3d')]=qs[_0x0638('0x3e')](_0x1a7a68['query'][_0x0638('0x3e')]);_0x120015[_0x0638('0x3f')]=qs[_0x0638('0x36')](_[_0x0638('0x40')](_0x1a7a68[_0x0638('0x35')],_0x4bb89c[_0x0638('0x36')]),_0x49e8f1);if(_0x1a7a68[_0x0638('0x35')][_0x0638('0x41')]){_0x120015['where']=_[_0x0638('0x42')](_0x120015[_0x0638('0x3f')],{'$or':_[_0x0638('0x34')](_0x49e8f1,function(_0x5f1c13){if(_0x5f1c13[_0x0638('0x32')]!=='VIRTUAL'){var _0x2d7f07={};_0x2d7f07[_0x5f1c13[_0x0638('0x2e')]]={'$like':'%'+_0x1a7a68[_0x0638('0x35')][_0x0638('0x41')]+'%'};return _0x2d7f07;}})});}_0x120015=_[_0x0638('0x42')]({},_0x120015,_0x1a7a68['options']);var _0x5e1d1a={'where':_0x120015[_0x0638('0x3f')]};return db[_0x0638('0x43')]['count'](_0x5e1d1a)[_0x0638('0x2b')](function(_0x42a500){_0x5c0f56[_0x0638('0x26')]=_0x42a500;if(_0x1a7a68[_0x0638('0x35')][_0x0638('0x44')]){_0x120015[_0x0638('0x45')]=[{'all':!![]}];}return db[_0x0638('0x43')][_0x0638('0x46')](_0x120015);})[_0x0638('0x2b')](function(_0x37bb61){_0x5c0f56['rows']=_0x37bb61;return _0x5c0f56;})[_0x0638('0x2b')](respondWithFilteredResult(_0x3af871,_0x120015))[_0x0638('0x47')](handleError(_0x3af871,null));};exports[_0x0638('0x48')]=function(_0x28543c,_0x14edd2){var _0x4d94a2={'raw':![],'where':{'id':_0x28543c[_0x0638('0x49')]['id']}},_0x384254={};_0x384254[_0x0638('0x33')]=_['keys'](db['VoiceQueueReport'][_0x0638('0x31')]);_0x384254[_0x0638('0x35')]=_[_0x0638('0x4a')](_0x28543c['query']);_0x384254[_0x0638('0x36')]=_[_0x0638('0x37')](_0x384254[_0x0638('0x33')],_0x384254[_0x0638('0x35')]);_0x4d94a2[_0x0638('0x38')]=_['intersection'](_0x384254[_0x0638('0x33')],qs[_0x0638('0x39')](_0x28543c[_0x0638('0x35')]['fields']));_0x4d94a2[_0x0638('0x38')]=_0x4d94a2[_0x0638('0x38')][_0x0638('0x3a')]?_0x4d94a2[_0x0638('0x38')]:_0x384254['model'];if(_0x28543c[_0x0638('0x35')][_0x0638('0x44')]){_0x4d94a2['include']=[{'all':!![]}];}_0x4d94a2=_['merge']({},_0x4d94a2,_0x28543c[_0x0638('0x4b')]);return db['VoiceQueueReport'][_0x0638('0x4c')](_0x4d94a2)[_0x0638('0x2b')](handleEntityNotFound(_0x14edd2,null))[_0x0638('0x2b')](respondWithResult(_0x14edd2,null))['catch'](handleError(_0x14edd2,null));};exports[_0x0638('0x4d')]=function(_0x27f555,_0x5b5111){return db['VoiceQueueReport'][_0x0638('0x4d')](_0x27f555[_0x0638('0x4e')],{})[_0x0638('0x2b')](respondWithResult(_0x5b5111,0xc9))[_0x0638('0x47')](handleError(_0x5b5111,null));};exports[_0x0638('0x2a')]=function(_0x1b2cbc,_0x37a2bf){if(_0x1b2cbc[_0x0638('0x4e')]['id']){delete _0x1b2cbc[_0x0638('0x4e')]['id'];}return db[_0x0638('0x43')][_0x0638('0x4c')]({'where':{'id':_0x1b2cbc[_0x0638('0x49')]['id']}})[_0x0638('0x2b')](handleEntityNotFound(_0x37a2bf,null))['then'](saveUpdates(_0x1b2cbc['body'],null))[_0x0638('0x2b')](respondWithResult(_0x37a2bf,null))['catch'](handleError(_0x37a2bf,null));};exports[_0x0638('0x2c')]=function(_0x1475ff,_0x436a42){return db['VoiceQueueReport'][_0x0638('0x4c')]({'where':{'id':_0x1475ff[_0x0638('0x49')]['id']}})[_0x0638('0x2b')](handleEntityNotFound(_0x436a42,null))[_0x0638('0x2b')](removeEntity(_0x436a42,null))['catch'](handleError(_0x436a42,null));};exports[_0x0638('0x4f')]=function(_0x15694a,_0x1a4824){return db['VoiceQueueReport'][_0x0638('0x4f')]()[_0x0638('0x2b')](respondWithResult(_0x1a4824,null))[_0x0638('0x47')](handleError(_0x1a4824,null));};exports[_0x0638('0x50')]=function(_0x41b28f,_0x3dafff){var _0x439827={},_0x344354={},_0xad63dc={'count':0x0,'rows':[]};_0x344354[_0x0638('0x33')]=_[_0x0638('0x4a')](db[_0x0638('0x43')][_0x0638('0x31')]);_0x344354[_0x0638('0x35')]=_[_0x0638('0x4a')](_0x41b28f['query']);_0x344354[_0x0638('0x36')]=_[_0x0638('0x37')](_0x344354['model'],_0x344354['query']);_0x439827[_0x0638('0x38')]=_[_0x0638('0x37')](_0x344354['model'],qs[_0x0638('0x39')](_0x41b28f[_0x0638('0x35')]['fields']));_0x439827['attributes']=_0x439827[_0x0638('0x38')][_0x0638('0x3a')]?_0x439827[_0x0638('0x38')]:_0x344354[_0x0638('0x33')];if(!_0x41b28f[_0x0638('0x35')]['hasOwnProperty'](_0x0638('0x3c'))){_0x439827['limit']=qs[_0x0638('0x25')](_0x41b28f['query'][_0x0638('0x25')]);_0x439827[_0x0638('0x23')]=qs['offset'](_0x41b28f['query'][_0x0638('0x23')]);}_0x439827[_0x0638('0x3d')]=qs['sort'](_0x41b28f['query']['sort']);_0x439827[_0x0638('0x3f')]=qs[_0x0638('0x36')](_['pick'](_0x41b28f[_0x0638('0x35')],_0x344354[_0x0638('0x36')]));if(_0x41b28f[_0x0638('0x35')][_0x0638('0x41')]){_0x439827[_0x0638('0x3f')]=_[_0x0638('0x42')](_0x439827[_0x0638('0x3f')],{'$or':_['map'](_0x439827[_0x0638('0x38')],function(_0x1bb4da){var _0x35616f={};_0x35616f[_0x1bb4da]={'$like':'%'+_0x41b28f['query']['filter']+'%'};return _0x35616f;})});}_0x439827=_['merge']({},_0x439827,_0x41b28f[_0x0638('0x4b')]);var _0x1fec20={'where':_0x439827['where']};return db[_0x0638('0x43')][_0x0638('0x26')](_0x1fec20)[_0x0638('0x2b')](function(_0x6f854b){_0xad63dc[_0x0638('0x26')]=_0x6f854b;if(_0x41b28f[_0x0638('0x35')][_0x0638('0x44')]){_0x439827[_0x0638('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x0638('0x46')](_0x439827);})[_0x0638('0x2b')](function(_0x9a4905){_0xad63dc[_0x0638('0x51')]=_0x9a4905;return _0xad63dc;})[_0x0638('0x2b')](respondWithFilteredResult(_0x3dafff,_0x439827,_0x0638('0x50')))[_0x0638('0x47')](handleError(_0x3dafff,null,_0x0638('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6fe2bd1..2f1119d 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 _0x03af=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','events'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x03af,0xbf));var _0xf03a=function(_0x4411ca,_0x3fc390){_0x4411ca=_0x4411ca-0x0;var _0x39be36=_0x03af[_0x4411ca];return _0x39be36;};'use strict';var EventEmitter=require(_0xf03a('0x0'));var VoiceQueueReport=require(_0xf03a('0x1'))['db'][_0xf03a('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf03a('0x3')](0x0);var events={'afterCreate':_0xf03a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x327742){return function(_0xaef742,_0x4ba714,_0x313655){VoiceQueueReportEvents[_0xf03a('0x5')](_0x327742+':'+_0xaef742['id'],_0xaef742);VoiceQueueReportEvents[_0xf03a('0x5')](_0x327742,_0xaef742);_0x313655(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x0260=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0xb1ac47,_0x643ac1){var _0x2d964d=function(_0x1b6188){while(--_0x1b6188){_0xb1ac47['push'](_0xb1ac47['shift']());}};_0x2d964d(++_0x643ac1);}(_0x0260,0x98));var _0x0026=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x0260[_0x1ae5ab];return _0x1ce001;};'use strict';var EventEmitter=require(_0x0026('0x0'));var VoiceQueueReport=require(_0x0026('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0026('0x2'),'afterUpdate':_0x0026('0x3'),'afterDestroy':_0x0026('0x4')};function emitEvent(_0x4b2026){return function(_0x381c06,_0x33b016,_0x150306){VoiceQueueReportEvents[_0x0026('0x5')](_0x4b2026+':'+_0x381c06['id'],_0x381c06);VoiceQueueReportEvents[_0x0026('0x5')](_0x4b2026,_0x381c06);_0x150306(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x0026('0x6')](e,emitEvent(event));}}module[_0x0026('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 175e523..e5304a5 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 _0xdebb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util'];(function(_0x1ecccb,_0x276430){var _0x104829=function(_0x240971){while(--_0x240971){_0x1ecccb['push'](_0x1ecccb['shift']());}};_0x104829(++_0x276430);}(_0xdebb,0x13f));var _0xbdeb=function(_0x5e9a79,_0x327752){_0x5e9a79=_0x5e9a79-0x0;var _0x14bb0=_0xdebb[_0x5e9a79];return _0x14bb0;};'use strict';var _=require('lodash');var util=require(_0xbdeb('0x0'));var logger=require(_0xbdeb('0x1'))(_0xbdeb('0x2'));var moment=require(_0xbdeb('0x3'));var BPromise=require(_0xbdeb('0x4'));var rp=require(_0xbdeb('0x5'));var fs=require('fs');var path=require(_0xbdeb('0x6'));var rimraf=require(_0xbdeb('0x7'));var config=require(_0xbdeb('0x8'));var attributes=require(_0xbdeb('0x9'));module[_0xbdeb('0xa')]=function(_0x3db9f8,_0x31aa14){return _0x3db9f8[_0xbdeb('0xb')](_0xbdeb('0xc'),attributes,{'tableName':_0xbdeb('0xd'),'paranoid':![],'indexes':[{'fields':[_0xbdeb('0xe')]},{'fields':[_0xbdeb('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa92f=['lodash','../../config/logger','api','moment','path','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x4fc461,_0x566c03){var _0x1b0133=function(_0x547a4f){while(--_0x547a4f){_0x4fc461['push'](_0x4fc461['shift']());}};_0x1b0133(++_0x566c03);}(_0xa92f,0x6e));var _0xfa92=function(_0x3cc656,_0x2ed7d8){_0x3cc656=_0x3cc656-0x0;var _0x1aec0d=_0xa92f[_0x3cc656];return _0x1aec0d;};'use strict';var _=require(_0xfa92('0x0'));var util=require('util');var logger=require(_0xfa92('0x1'))(_0xfa92('0x2'));var moment=require(_0xfa92('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa92('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa92('0x5'));module['exports']=function(_0x2fddac,_0x4516a1){return _0x2fddac[_0xfa92('0x6')](_0xfa92('0x7'),attributes,{'tableName':_0xfa92('0x8'),'paranoid':![],'indexes':[{'fields':[_0xfa92('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 67c4570..36063c2 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 _0xbfa5=['error','code','message','result','GetVoiceQueueReport','options','where','limit','include','map','model','attributes','then','catch','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','VoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x7f66b3,_0x2bb2aa){var _0x4088c5=function(_0x46b49d){while(--_0x46b49d){_0x7f66b3['push'](_0x7f66b3['shift']());}};_0x4088c5(++_0x2bb2aa);}(_0xbfa5,0x157));var _0x5bfa=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbfa5[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5bfa('0x0'));var util=require(_0x5bfa('0x1'));var moment=require(_0x5bfa('0x2'));var BPromise=require(_0x5bfa('0x3'));var rs=require(_0x5bfa('0x4'));var fs=require('fs');var Redis=require(_0x5bfa('0x5'));var db=require(_0x5bfa('0x6'))['db'];var utils=require(_0x5bfa('0x7'));var logger=require(_0x5bfa('0x8'))(_0x5bfa('0x9'));var config=require('../../config/environment');var jayson=require(_0x5bfa('0xa'));var client=jayson[_0x5bfa('0xb')][_0x5bfa('0xc')]({'port':0x232a});config[_0x5bfa('0xd')]=_[_0x5bfa('0xe')](config[_0x5bfa('0xd')],{'host':_0x5bfa('0xf'),'port':0x18eb});var socket=require(_0x5bfa('0x10'))(new Redis(config[_0x5bfa('0xd')]));require(_0x5bfa('0x11'))[_0x5bfa('0x12')](socket);function respondWithRpcPromise(_0x2685e0,_0x292eff,_0x422cdb){return new BPromise(function(_0x517835,_0x19bcfe){return client[_0x5bfa('0x13')](_0x2685e0,_0x422cdb)['then'](function(_0xa82168){logger[_0x5bfa('0x14')](_0x5bfa('0x15'),_0x292eff,_0x5bfa('0x16'));logger[_0x5bfa('0x17')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x292eff,_0x5bfa('0x16'),JSON[_0x5bfa('0x18')](_0xa82168));if(_0xa82168[_0x5bfa('0x19')]){if(_0xa82168[_0x5bfa('0x19')][_0x5bfa('0x1a')]===0x1f4){logger[_0x5bfa('0x19')](_0x5bfa('0x15'),_0x292eff,_0xa82168[_0x5bfa('0x19')][_0x5bfa('0x1b')]);return _0x19bcfe(_0xa82168['error']['message']);}logger[_0x5bfa('0x19')](_0x5bfa('0x15'),_0x292eff,_0xa82168[_0x5bfa('0x19')]['message']);return _0x517835(_0xa82168['error'][_0x5bfa('0x1b')]);}else{logger[_0x5bfa('0x14')](_0x5bfa('0x15'),_0x292eff,_0x5bfa('0x16'));_0x517835(_0xa82168[_0x5bfa('0x1c')]['message']);}})['catch'](function(_0x5bfeaa){logger[_0x5bfa('0x19')](_0x5bfa('0x15'),_0x292eff,_0x5bfeaa);_0x19bcfe(_0x5bfeaa);});});}exports[_0x5bfa('0x1d')]=function(_0x109f60){var _0x17b24c=this;return new Promise(function(_0x110acf,_0x1ceea0){return db['VoiceQueueReport']['findAll']({'raw':_0x109f60[_0x5bfa('0x1e')]?_0x109f60[_0x5bfa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x109f60['options']?_0x109f60['options'][_0x5bfa('0x1f')]||null:null,'attributes':_0x109f60[_0x5bfa('0x1e')]?_0x109f60[_0x5bfa('0x1e')]['attributes']||null:null,'limit':_0x109f60[_0x5bfa('0x1e')]?_0x109f60['options'][_0x5bfa('0x20')]||null:null,'include':_0x109f60[_0x5bfa('0x1e')]?_0x109f60['options'][_0x5bfa('0x21')]?_[_0x5bfa('0x22')](_0x109f60[_0x5bfa('0x1e')][_0x5bfa('0x21')],function(_0x48f0f5){return{'model':db[_0x48f0f5[_0x5bfa('0x23')]],'as':_0x48f0f5['as'],'attributes':_0x48f0f5[_0x5bfa('0x24')],'include':_0x48f0f5['include']?_[_0x5bfa('0x22')](_0x48f0f5[_0x5bfa('0x21')],function(_0x13b4c5){return{'model':db[_0x13b4c5[_0x5bfa('0x23')]],'as':_0x13b4c5['as'],'attributes':_0x13b4c5[_0x5bfa('0x24')],'include':_0x13b4c5[_0x5bfa('0x21')]?_[_0x5bfa('0x22')](_0x13b4c5[_0x5bfa('0x21')],function(_0x19509a){return{'model':db[_0x19509a[_0x5bfa('0x23')]],'as':_0x19509a['as'],'attributes':_0x19509a[_0x5bfa('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5bfa('0x25')](function(_0x153f51){logger[_0x5bfa('0x14')](_0x5bfa('0x1d'),_0x109f60);logger['debug'](_0x5bfa('0x1d'),_0x109f60,JSON['stringify'](_0x153f51));_0x110acf(_0x153f51);})[_0x5bfa('0x26')](function(_0x16915e){logger['error'](_0x5bfa('0x1d'),_0x16915e[_0x5bfa('0x1b')],_0x109f60);_0x1ceea0(_0x17b24c['error'](0x1f4,_0x16915e['message']));});});};exports[_0x5bfa('0x27')]=function(_0x55fcfb){var _0xb6edc=this;return new Promise(function(_0x13d5dc,_0x3c778f){return db['VoiceQueueReport'][_0x5bfa('0x28')](_0x55fcfb[_0x5bfa('0x29')],{'raw':_0x55fcfb[_0x5bfa('0x1e')]?_0x55fcfb[_0x5bfa('0x1e')][_0x5bfa('0x2a')]===undefined?!![]:![]:!![]})[_0x5bfa('0x25')](function(_0xcf5049){logger['info'](_0x5bfa('0x27'),_0x55fcfb);logger[_0x5bfa('0x17')]('CreateVoiceQueueReport',_0x55fcfb,JSON[_0x5bfa('0x18')](_0xcf5049));_0x13d5dc(_0xcf5049);})[_0x5bfa('0x26')](function(_0x5ee4dc){logger[_0x5bfa('0x19')](_0x5bfa('0x27'),_0x5ee4dc[_0x5bfa('0x1b')],_0x55fcfb);_0x3c778f(_0xb6edc['error'](0x1f4,_0x5ee4dc[_0x5bfa('0x1b')]));});});};exports[_0x5bfa('0x2b')]=function(_0x52670c){var _0x28b0b6=this;return new Promise(function(_0x1559b4,_0x2b4c9e){return db[_0x5bfa('0x2c')][_0x5bfa('0x2d')](_0x52670c[_0x5bfa('0x29')],{'raw':_0x52670c[_0x5bfa('0x1e')]?_0x52670c[_0x5bfa('0x1e')][_0x5bfa('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52670c[_0x5bfa('0x1e')]?_0x52670c['options'][_0x5bfa('0x1f')]||null:null,'attributes':_0x52670c[_0x5bfa('0x1e')]?_0x52670c[_0x5bfa('0x1e')][_0x5bfa('0x24')]||null:null,'limit':_0x52670c[_0x5bfa('0x1e')]?_0x52670c[_0x5bfa('0x1e')][_0x5bfa('0x20')]||null:null})[_0x5bfa('0x25')](function(_0x3940fe){logger[_0x5bfa('0x14')](_0x5bfa('0x2b'),_0x52670c);logger['debug']('UpdateVoiceQueueReport',_0x52670c,JSON['stringify'](_0x3940fe));_0x1559b4(_0x3940fe);})[_0x5bfa('0x26')](function(_0x8f7124){logger[_0x5bfa('0x19')](_0x5bfa('0x2b'),_0x8f7124[_0x5bfa('0x1b')],_0x52670c);_0x2b4c9e(_0x28b0b6[_0x5bfa('0x19')](0x1f4,_0x8f7124[_0x5bfa('0x1b')]));});});}; \ No newline at end of file +var _0x6379=['limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueueReport','findAll','options','where','attributes'];(function(_0x17dcc0,_0x24eafa){var _0x1d8c59=function(_0x22c8e8){while(--_0x22c8e8){_0x17dcc0['push'](_0x17dcc0['shift']());}};_0x1d8c59(++_0x24eafa);}(_0x6379,0x186));var _0x9637=function(_0x164b96,_0x12f735){_0x164b96=_0x164b96-0x0;var _0x5489d9=_0x6379[_0x164b96];return _0x5489d9;};'use strict';var _=require('lodash');var util=require(_0x9637('0x0'));var moment=require(_0x9637('0x1'));var BPromise=require(_0x9637('0x2'));var rs=require(_0x9637('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9637('0x4'));var logger=require(_0x9637('0x5'))(_0x9637('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9637('0x7')]=_[_0x9637('0x8')](config[_0x9637('0x7')],{'host':_0x9637('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9637('0x7')]));require(_0x9637('0xa'))['register'](socket);function respondWithRpcPromise(_0x5d88ae,_0x341a13,_0x22f823){return new BPromise(function(_0xe12e42,_0x447f1e){return client[_0x9637('0xb')](_0x5d88ae,_0x22f823)[_0x9637('0xc')](function(_0xfd301){logger[_0x9637('0xd')](_0x9637('0xe'),_0x341a13,_0x9637('0xf'));logger[_0x9637('0x10')](_0x9637('0x11'),_0x341a13,_0x9637('0xf'),JSON[_0x9637('0x12')](_0xfd301));if(_0xfd301[_0x9637('0x13')]){if(_0xfd301[_0x9637('0x13')]['code']===0x1f4){logger[_0x9637('0x13')](_0x9637('0xe'),_0x341a13,_0xfd301[_0x9637('0x13')][_0x9637('0x14')]);return _0x447f1e(_0xfd301[_0x9637('0x13')][_0x9637('0x14')]);}logger[_0x9637('0x13')](_0x9637('0xe'),_0x341a13,_0xfd301['error'][_0x9637('0x14')]);return _0xe12e42(_0xfd301['error'][_0x9637('0x14')]);}else{logger[_0x9637('0xd')](_0x9637('0xe'),_0x341a13,_0x9637('0xf'));_0xe12e42(_0xfd301[_0x9637('0x15')][_0x9637('0x14')]);}})[_0x9637('0x16')](function(_0x1e9b59){logger['error'](_0x9637('0xe'),_0x341a13,_0x1e9b59);_0x447f1e(_0x1e9b59);});});}exports['GetVoiceQueueReport']=function(_0x4b60ae){var _0x5b5de6=this;return new Promise(function(_0x1f90ff,_0x3b57e9){return db[_0x9637('0x17')][_0x9637('0x18')]({'raw':_0x4b60ae['options']?_0x4b60ae[_0x9637('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4b60ae[_0x9637('0x19')]?_0x4b60ae[_0x9637('0x19')][_0x9637('0x1a')]||null:null,'attributes':_0x4b60ae['options']?_0x4b60ae[_0x9637('0x19')][_0x9637('0x1b')]||null:null,'limit':_0x4b60ae[_0x9637('0x19')]?_0x4b60ae[_0x9637('0x19')][_0x9637('0x1c')]||null:null,'include':_0x4b60ae['options']?_0x4b60ae[_0x9637('0x19')][_0x9637('0x1d')]?_[_0x9637('0x1e')](_0x4b60ae[_0x9637('0x19')][_0x9637('0x1d')],function(_0x75267e){return{'model':db[_0x75267e[_0x9637('0x1f')]],'as':_0x75267e['as'],'attributes':_0x75267e[_0x9637('0x1b')],'include':_0x75267e[_0x9637('0x1d')]?_['map'](_0x75267e[_0x9637('0x1d')],function(_0x1ed5dd){return{'model':db[_0x1ed5dd[_0x9637('0x1f')]],'as':_0x1ed5dd['as'],'attributes':_0x1ed5dd[_0x9637('0x1b')],'include':_0x1ed5dd[_0x9637('0x1d')]?_[_0x9637('0x1e')](_0x1ed5dd['include'],function(_0x244fa4){return{'model':db[_0x244fa4[_0x9637('0x1f')]],'as':_0x244fa4['as'],'attributes':_0x244fa4['attributes']};}):[]};}):[]};}):[]:[]})[_0x9637('0xc')](function(_0xdc701b){logger[_0x9637('0xd')](_0x9637('0x20'),_0x4b60ae);logger[_0x9637('0x10')](_0x9637('0x20'),_0x4b60ae,JSON[_0x9637('0x12')](_0xdc701b));_0x1f90ff(_0xdc701b);})[_0x9637('0x16')](function(_0x1f5ff1){logger[_0x9637('0x13')]('GetVoiceQueueReport',_0x1f5ff1[_0x9637('0x14')],_0x4b60ae);_0x3b57e9(_0x5b5de6[_0x9637('0x13')](0x1f4,_0x1f5ff1[_0x9637('0x14')]));});});};exports[_0x9637('0x21')]=function(_0x1ce8db){var _0x2644da=this;return new Promise(function(_0x39d551,_0x1126e5){return db['VoiceQueueReport'][_0x9637('0x22')](_0x1ce8db[_0x9637('0x23')],{'raw':_0x1ce8db[_0x9637('0x19')]?_0x1ce8db['options'][_0x9637('0x24')]===undefined?!![]:![]:!![]})[_0x9637('0xc')](function(_0x37de53){logger['info'](_0x9637('0x21'),_0x1ce8db);logger['debug'](_0x9637('0x21'),_0x1ce8db,JSON[_0x9637('0x12')](_0x37de53));_0x39d551(_0x37de53);})['catch'](function(_0x3dc2ed){logger[_0x9637('0x13')]('CreateVoiceQueueReport',_0x3dc2ed[_0x9637('0x14')],_0x1ce8db);_0x1126e5(_0x2644da[_0x9637('0x13')](0x1f4,_0x3dc2ed[_0x9637('0x14')]));});});};exports[_0x9637('0x25')]=function(_0x32dd32){var _0x2fdb66=this;return new Promise(function(_0x3c7eee,_0xb0c731){return db[_0x9637('0x17')]['update'](_0x32dd32[_0x9637('0x23')],{'raw':_0x32dd32['options']?_0x32dd32['options'][_0x9637('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32dd32['options']?_0x32dd32['options']['where']||null:null,'attributes':_0x32dd32[_0x9637('0x19')]?_0x32dd32[_0x9637('0x19')][_0x9637('0x1b')]||null:null,'limit':_0x32dd32['options']?_0x32dd32[_0x9637('0x19')][_0x9637('0x1c')]||null:null})[_0x9637('0xc')](function(_0x427200){logger[_0x9637('0xd')](_0x9637('0x25'),_0x32dd32);logger[_0x9637('0x10')](_0x9637('0x25'),_0x32dd32,JSON[_0x9637('0x12')](_0x427200));_0x3c7eee(_0x427200);})[_0x9637('0x16')](function(_0x30b692){logger['error'](_0x9637('0x25'),_0x30b692[_0x9637('0x14')],_0x32dd32);_0xb0c731(_0x2fdb66[_0x9637('0x13')](0x1f4,_0x30b692['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0bd8bd7..b30957c 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 _0x40cb=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x14e1c5,_0x4484dd){var _0x2fe8d7=function(_0x21256b){while(--_0x21256b){_0x14e1c5['push'](_0x14e1c5['shift']());}};_0x2fe8d7(++_0x4484dd);}(_0x40cb,0x108));var _0xb40c=function(_0x5827e3,_0x37a819){_0x5827e3=_0x5827e3-0x0;var _0xe862cf=_0x40cb[_0x5827e3];return _0xe862cf;};'use strict';var VoiceQueueReportEvents=require(_0xb40c('0x0'));var events=[_0xb40c('0x1'),_0xb40c('0x2'),_0xb40c('0x3')];function createListener(_0x48a65d,_0x20eaa){return function(_0x428c68){_0x20eaa[_0xb40c('0x4')](_0x48a65d,_0x428c68);};}function removeListener(_0x1b7dbf,_0x52aacd){return function(){VoiceQueueReportEvents[_0xb40c('0x5')](_0x1b7dbf,_0x52aacd);};}exports[_0xb40c('0x6')]=function(_0x4c650d){for(var _0x36120e=0x0,_0xb9fba5=events[_0xb40c('0x7')];_0x36120e<_0xb9fba5;_0x36120e++){var _0x3f0e0e=events[_0x36120e];var _0x345f54=createListener(_0xb40c('0x8')+_0x3f0e0e,_0x4c650d);VoiceQueueReportEvents['on'](_0x3f0e0e,_0x345f54);}}; \ No newline at end of file +var _0xd56f=['remove','emit','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3b048d,_0x450938){var _0x31b2d4=function(_0x13ebc0){while(--_0x13ebc0){_0x3b048d['push'](_0x3b048d['shift']());}};_0x31b2d4(++_0x450938);}(_0xd56f,0xe8));var _0xfd56=function(_0x37e9c1,_0x20ff2a){_0x37e9c1=_0x37e9c1-0x0;var _0x3b12bd=_0xd56f[_0x37e9c1];return _0x3b12bd;};'use strict';var VoiceQueueReportEvents=require(_0xfd56('0x0'));var events=[_0xfd56('0x1'),_0xfd56('0x2'),'update'];function createListener(_0x4299d1,_0x5b83cb){return function(_0x1b786e){_0x5b83cb[_0xfd56('0x3')](_0x4299d1,_0x1b786e);};}function removeListener(_0x529405,_0x27ff71){return function(){VoiceQueueReportEvents['removeListener'](_0x529405,_0x27ff71);};}exports['register']=function(_0x2454ba){for(var _0x1b0f15=0x0,_0x19a142=events[_0xfd56('0x4')];_0x1b0f15<_0x19a142;_0x1b0f15++){var _0x27c05a=events[_0x1b0f15];var _0x2cf392=createListener(_0xfd56('0x5')+_0x27c05a,_0x2454ba);VoiceQueueReportEvents['on'](_0x27c05a,_0x2cf392);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8c13b88..4b06601 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 _0x6a39=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a39,0x140));var _0x96a3=function(_0x24eb2f,_0x361426){_0x24eb2f=_0x24eb2f-0x0;var _0x231c1b=_0x6a39[_0x24eb2f];return _0x231c1b;};'use strict';var multer=require(_0x96a3('0x0'));var util=require(_0x96a3('0x1'));var path=require(_0x96a3('0x2'));var timeout=require(_0x96a3('0x3'));var express=require(_0x96a3('0x4'));var router=express[_0x96a3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x96a3('0x6'));var interaction=require(_0x96a3('0x7'));var config=require(_0x96a3('0x8'));var controller=require(_0x96a3('0x9'));router[_0x96a3('0xa')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0xc')]);router[_0x96a3('0xa')](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller['show']);router[_0x96a3('0xe')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0xf')]);router['put'](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x10')]);router[_0x96a3('0x11')](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x12')]);module[_0x96a3('0x13')]=router; \ No newline at end of file +var _0x23f2=['create','update','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post'];(function(_0x5895b8,_0x60ff7b){var _0x4e959b=function(_0x1400d6){while(--_0x1400d6){_0x5895b8['push'](_0x5895b8['shift']());}};_0x4e959b(++_0x60ff7b);}(_0x23f2,0x1ce));var _0x223f=function(_0x4bc846,_0x382e50){_0x4bc846=_0x4bc846-0x0;var _0x1911f6=_0x23f2[_0x4bc846];return _0x1911f6;};'use strict';var multer=require('multer');var util=require(_0x223f('0x0'));var path=require(_0x223f('0x1'));var timeout=require(_0x223f('0x2'));var express=require(_0x223f('0x3'));var router=express['Router']();var fs_extra=require(_0x223f('0x4'));var auth=require(_0x223f('0x5'));var interaction=require(_0x223f('0x6'));var config=require(_0x223f('0x7'));var controller=require(_0x223f('0x8'));router[_0x223f('0x9')]('/',auth[_0x223f('0xa')](),controller[_0x223f('0xb')]);router['get'](_0x223f('0xc'),auth[_0x223f('0xa')](),controller['show']);router[_0x223f('0xd')]('/',auth['isAuthenticated'](),controller[_0x223f('0xe')]);router['put'](_0x223f('0xc'),auth[_0x223f('0xa')](),controller[_0x223f('0xf')]);router[_0x223f('0x10')](_0x223f('0xc'),auth[_0x223f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d048dfb..c335b92 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 _0x19dd=['exports','STRING','DATE','format','sequelize'];(function(_0x5e211d,_0x26e878){var _0x42e65b=function(_0x487e44){while(--_0x487e44){_0x5e211d['push'](_0x5e211d['shift']());}};_0x42e65b(++_0x26e878);}(_0x19dd,0x18a));var _0xd19d=function(_0x425e6a,_0x169c75){_0x425e6a=_0x425e6a-0x0;var _0x17f5e9=_0x19dd[_0x425e6a];return _0x17f5e9;};'use strict';var Sequelize=require(_0xd19d('0x0'));var moment=require('moment');module[_0xd19d('0x1')]={'time':{'type':Sequelize[_0xd19d('0x2')]},'callid':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd19d('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd19d('0x3')],'allowNull':![],'defaultValue':moment()[_0xd19d('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xa94f=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x2ffa30,_0x13e57b){var _0x3284cc=function(_0xdfd9a2){while(--_0xdfd9a2){_0x2ffa30['push'](_0x2ffa30['shift']());}};_0x3284cc(++_0x13e57b);}(_0xa94f,0xad));var _0xfa94=function(_0x4c7c7c,_0x5a639b){_0x4c7c7c=_0x4c7c7c-0x0;var _0x2e6b21=_0xa94f[_0x4c7c7c];return _0x2e6b21;};'use strict';var Sequelize=require(_0xfa94('0x0'));var moment=require('moment');module[_0xfa94('0x1')]={'time':{'type':Sequelize[_0xfa94('0x2')]},'callid':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfa94('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfa94('0x3')],'allowNull':![],'defaultValue':moment()[_0xfa94('0x4')](_0xfa94('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 5d224cd..a4e33d1 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 _0x30e4=['error','stack','name','send','index','map','VoiceQueuesLog','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','sendStatus'];(function(_0x552c30,_0x30d4b6){var _0x4a3ff8=function(_0x5048a8){while(--_0x5048a8){_0x552c30['push'](_0x552c30['shift']());}};_0x4a3ff8(++_0x30d4b6);}(_0x30e4,0x115));var _0x430e=function(_0x4ab889,_0x2eebe7){_0x4ab889=_0x4ab889-0x0;var _0x5037b7=_0x30e4[_0x4ab889];return _0x5037b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x430e('0x0'));var zipdir=require(_0x430e('0x1'));var jsonpatch=require(_0x430e('0x2'));var rp=require('request-promise');var moment=require(_0x430e('0x3'));var BPromise=require(_0x430e('0x4'));var Mustache=require(_0x430e('0x5'));var util=require(_0x430e('0x6'));var path=require(_0x430e('0x7'));var sox=require(_0x430e('0x8'));var csv=require(_0x430e('0x9'));var ejs=require(_0x430e('0xa'));var fs=require('fs');var fs_extra=require(_0x430e('0xb'));var _=require(_0x430e('0xc'));var squel=require(_0x430e('0xd'));var crypto=require('crypto');var jsforce=require(_0x430e('0xe'));var deskjs=require(_0x430e('0xf'));var toCsv=require(_0x430e('0x9'));var querystring=require('querystring');var Papa=require(_0x430e('0x10'));var Redis=require(_0x430e('0x11'));var authService=require(_0x430e('0x12'));var qs=require(_0x430e('0x13'));var as=require(_0x430e('0x14'));var hardwareService=require(_0x430e('0x15'));var logger=require(_0x430e('0x16'))(_0x430e('0x17'));var utils=require(_0x430e('0x18'));var config=require(_0x430e('0x19'));var licenseUtil=require(_0x430e('0x1a'));var db=require(_0x430e('0x1b'))['db'];function respondWithStatusCode(_0x389a47,_0x509ccb){_0x509ccb=_0x509ccb||0xcc;return function(_0x55fee5){if(_0x55fee5){return _0x389a47['sendStatus'](_0x509ccb);}return _0x389a47['status'](_0x509ccb)[_0x430e('0x1c')]();};}function respondWithResult(_0x40398b,_0xb1e644){_0xb1e644=_0xb1e644||0xc8;return function(_0x8cab86){if(_0x8cab86){return _0x40398b['status'](_0xb1e644)[_0x430e('0x1d')](_0x8cab86);}};}function respondWithFilteredResult(_0x97a204,_0x3e8858){return function(_0x1e4881){if(_0x1e4881){var _0x4c1850=typeof _0x3e8858['offset']===_0x430e('0x1e')&&typeof _0x3e8858[_0x430e('0x1f')]==='undefined';var _0x51327f=_0x1e4881[_0x430e('0x20')];var _0x405e23=_0x4c1850?0x0:_0x3e8858[_0x430e('0x21')];var _0x4505d0=_0x4c1850?_0x1e4881[_0x430e('0x20')]:_0x3e8858[_0x430e('0x21')]+_0x3e8858[_0x430e('0x1f')];var _0x4b583c;if(_0x4505d0>=_0x51327f){_0x4505d0=_0x51327f;_0x4b583c=0xc8;}else{_0x4b583c=0xce;}_0x97a204[_0x430e('0x22')](_0x4b583c);return _0x97a204[_0x430e('0x23')](_0x430e('0x24'),_0x405e23+'-'+_0x4505d0+'/'+_0x51327f)['json'](_0x1e4881);}return null;};}function patchUpdates(_0x4267b1){return function(_0x54649){try{jsonpatch[_0x430e('0x25')](_0x54649,_0x4267b1,!![]);}catch(_0x152712){return BPromise[_0x430e('0x26')](_0x152712);}return _0x54649['save']();};}function saveUpdates(_0x9a3b58,_0x30be42){return function(_0x13bffc){if(_0x13bffc){return _0x13bffc[_0x430e('0x27')](_0x9a3b58)[_0x430e('0x28')](function(_0x11c0b4){return _0x11c0b4;});}return null;};}function removeEntity(_0x38e1cb,_0x274fdf){return function(_0x50e51b){if(_0x50e51b){return _0x50e51b[_0x430e('0x29')]()[_0x430e('0x28')](function(){_0x38e1cb[_0x430e('0x22')](0xcc)[_0x430e('0x1c')]();});}};}function handleEntityNotFound(_0xc4b74c,_0xb1e1d6){return function(_0x6fe6ff){if(!_0x6fe6ff){_0xc4b74c[_0x430e('0x2a')](0x194);}return _0x6fe6ff;};}function handleError(_0x111b5b,_0x556768){_0x556768=_0x556768||0x1f4;return function(_0x28a652){logger[_0x430e('0x2b')](_0x28a652[_0x430e('0x2c')]);if(_0x28a652[_0x430e('0x2d')]){delete _0x28a652[_0x430e('0x2d')];}_0x111b5b[_0x430e('0x22')](_0x556768)[_0x430e('0x2e')](_0x28a652);};}exports[_0x430e('0x2f')]=function(_0x428831,_0x27c837){var _0x48ddfb={},_0x207035={},_0x1a01a6={'count':0x0,'rows':[]};var _0x17ca17=_[_0x430e('0x30')](db[_0x430e('0x31')]['rawAttributes'],function(_0x24f4fe){return{'name':_0x24f4fe[_0x430e('0x32')],'type':_0x24f4fe['type'][_0x430e('0x33')]};});_0x207035[_0x430e('0x34')]=_[_0x430e('0x30')](_0x17ca17,'name');_0x207035[_0x430e('0x35')]=_[_0x430e('0x36')](_0x428831['query']);_0x207035[_0x430e('0x37')]=_[_0x430e('0x38')](_0x207035[_0x430e('0x34')],_0x207035[_0x430e('0x35')]);_0x48ddfb[_0x430e('0x39')]=_['intersection'](_0x207035[_0x430e('0x34')],qs[_0x430e('0x3a')](_0x428831['query'][_0x430e('0x3a')]));_0x48ddfb[_0x430e('0x39')]=_0x48ddfb['attributes'][_0x430e('0x3b')]?_0x48ddfb[_0x430e('0x39')]:_0x207035[_0x430e('0x34')];if(!_0x428831[_0x430e('0x35')]['hasOwnProperty'](_0x430e('0x3c'))){_0x48ddfb[_0x430e('0x1f')]=qs['limit'](_0x428831[_0x430e('0x35')][_0x430e('0x1f')]);_0x48ddfb['offset']=qs[_0x430e('0x21')](_0x428831[_0x430e('0x35')][_0x430e('0x21')]);}_0x48ddfb[_0x430e('0x3d')]=qs[_0x430e('0x3e')](_0x428831['query'][_0x430e('0x3e')]);_0x48ddfb[_0x430e('0x3f')]=qs[_0x430e('0x37')](_[_0x430e('0x40')](_0x428831[_0x430e('0x35')],_0x207035[_0x430e('0x37')]),_0x17ca17);if(_0x428831[_0x430e('0x35')]['filter']){_0x48ddfb[_0x430e('0x3f')]=_[_0x430e('0x41')](_0x48ddfb[_0x430e('0x3f')],{'$or':_['map'](_0x17ca17,function(_0x84e689){if(_0x84e689[_0x430e('0x42')]!==_0x430e('0x43')){var _0x1fada4={};_0x1fada4[_0x84e689[_0x430e('0x2d')]]={'$like':'%'+_0x428831[_0x430e('0x35')][_0x430e('0x44')]+'%'};return _0x1fada4;}})});}_0x48ddfb=_['merge']({},_0x48ddfb,_0x428831['options']);var _0x2bbdec={'where':_0x48ddfb['where']};return db[_0x430e('0x31')][_0x430e('0x20')](_0x2bbdec)[_0x430e('0x28')](function(_0x4cac1b){_0x1a01a6[_0x430e('0x20')]=_0x4cac1b;if(_0x428831['query'][_0x430e('0x45')]){_0x48ddfb[_0x430e('0x46')]=[{'all':!![]}];}return db[_0x430e('0x31')][_0x430e('0x47')](_0x48ddfb);})[_0x430e('0x28')](function(_0x22787e){_0x1a01a6[_0x430e('0x48')]=_0x22787e;return _0x1a01a6;})[_0x430e('0x28')](respondWithFilteredResult(_0x27c837,_0x48ddfb))[_0x430e('0x49')](handleError(_0x27c837,null));};exports[_0x430e('0x4a')]=function(_0x24ecc7,_0x4102d7){var _0x35275d={'raw':!![],'where':{'id':_0x24ecc7[_0x430e('0x4b')]['id']}},_0x3173dc={};_0x3173dc[_0x430e('0x34')]=_['keys'](db[_0x430e('0x31')]['rawAttributes']);_0x3173dc['query']=_[_0x430e('0x36')](_0x24ecc7[_0x430e('0x35')]);_0x3173dc[_0x430e('0x37')]=_[_0x430e('0x38')](_0x3173dc['model'],_0x3173dc['query']);_0x35275d[_0x430e('0x39')]=_[_0x430e('0x38')](_0x3173dc[_0x430e('0x34')],qs[_0x430e('0x3a')](_0x24ecc7[_0x430e('0x35')][_0x430e('0x3a')]));_0x35275d[_0x430e('0x39')]=_0x35275d[_0x430e('0x39')][_0x430e('0x3b')]?_0x35275d['attributes']:_0x3173dc[_0x430e('0x34')];if(_0x24ecc7['query'][_0x430e('0x45')]){_0x35275d['include']=[{'all':!![]}];}_0x35275d=_['merge']({},_0x35275d,_0x24ecc7[_0x430e('0x4c')]);return db[_0x430e('0x31')][_0x430e('0x4d')](_0x35275d)[_0x430e('0x28')](handleEntityNotFound(_0x4102d7,null))[_0x430e('0x28')](respondWithResult(_0x4102d7,null))[_0x430e('0x49')](handleError(_0x4102d7,null));};exports[_0x430e('0x4e')]=function(_0x10d44f,_0x19deaf){return db[_0x430e('0x31')][_0x430e('0x4e')](_0x10d44f[_0x430e('0x4f')],{})[_0x430e('0x28')](respondWithResult(_0x19deaf,0xc9))[_0x430e('0x49')](handleError(_0x19deaf,null));};exports[_0x430e('0x27')]=function(_0x9ca896,_0x5a023d){if(_0x9ca896[_0x430e('0x4f')]['id']){delete _0x9ca896[_0x430e('0x4f')]['id'];}return db[_0x430e('0x31')][_0x430e('0x4d')]({'where':{'id':_0x9ca896[_0x430e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a023d,null))[_0x430e('0x28')](saveUpdates(_0x9ca896[_0x430e('0x4f')],null))[_0x430e('0x28')](respondWithResult(_0x5a023d,null))[_0x430e('0x49')](handleError(_0x5a023d,null));};exports[_0x430e('0x29')]=function(_0x57ae1c,_0x21e57c){return db['VoiceQueuesLog'][_0x430e('0x4d')]({'where':{'id':_0x57ae1c['params']['id']}})[_0x430e('0x28')](handleEntityNotFound(_0x21e57c,null))[_0x430e('0x28')](removeEntity(_0x21e57c,null))[_0x430e('0x49')](handleError(_0x21e57c,null));}; \ No newline at end of file +var _0xa64c=['rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include'];(function(_0x5e2a54,_0x424ad7){var _0x1c8b6b=function(_0x718a9b){while(--_0x718a9b){_0x5e2a54['push'](_0x5e2a54['shift']());}};_0x1c8b6b(++_0x424ad7);}(_0xa64c,0x1b7));var _0xca64=function(_0x106030,_0x9c38d0){_0x106030=_0x106030-0x0;var _0x1aa4a4=_0xa64c[_0x106030];return _0x1aa4a4;};'use strict';var emlformat=require(_0xca64('0x0'));var rimraf=require(_0xca64('0x1'));var zipdir=require(_0xca64('0x2'));var jsonpatch=require(_0xca64('0x3'));var rp=require(_0xca64('0x4'));var moment=require(_0xca64('0x5'));var BPromise=require(_0xca64('0x6'));var Mustache=require(_0xca64('0x7'));var util=require(_0xca64('0x8'));var path=require('path');var sox=require(_0xca64('0x9'));var csv=require(_0xca64('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca64('0xb'));var _=require(_0xca64('0xc'));var squel=require(_0xca64('0xd'));var crypto=require('crypto');var jsforce=require(_0xca64('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xca64('0xa'));var querystring=require(_0xca64('0xf'));var Papa=require(_0xca64('0x10'));var Redis=require(_0xca64('0x11'));var authService=require(_0xca64('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xca64('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca64('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xca64('0x15'));var licenseUtil=require(_0xca64('0x16'));var db=require(_0xca64('0x17'))['db'];function respondWithStatusCode(_0xd3b038,_0x14cbbc){_0x14cbbc=_0x14cbbc||0xcc;return function(_0x2f4404){if(_0x2f4404){return _0xd3b038[_0xca64('0x18')](_0x14cbbc);}return _0xd3b038[_0xca64('0x19')](_0x14cbbc)['end']();};}function respondWithResult(_0x5b74dc,_0x3975ea){_0x3975ea=_0x3975ea||0xc8;return function(_0x215479){if(_0x215479){return _0x5b74dc[_0xca64('0x19')](_0x3975ea)[_0xca64('0x1a')](_0x215479);}};}function respondWithFilteredResult(_0x283c3d,_0x3dff47){return function(_0x1e4b8d){if(_0x1e4b8d){var _0xd49dd0=typeof _0x3dff47[_0xca64('0x1b')]===_0xca64('0x1c')&&typeof _0x3dff47[_0xca64('0x1d')]===_0xca64('0x1c');var _0x3545b3=_0x1e4b8d['count'];var _0x2208e5=_0xd49dd0?0x0:_0x3dff47[_0xca64('0x1b')];var _0xa6854e=_0xd49dd0?_0x1e4b8d['count']:_0x3dff47[_0xca64('0x1b')]+_0x3dff47[_0xca64('0x1d')];var _0x4ca58f;if(_0xa6854e>=_0x3545b3){_0xa6854e=_0x3545b3;_0x4ca58f=0xc8;}else{_0x4ca58f=0xce;}_0x283c3d['status'](_0x4ca58f);return _0x283c3d['set'](_0xca64('0x1e'),_0x2208e5+'-'+_0xa6854e+'/'+_0x3545b3)[_0xca64('0x1a')](_0x1e4b8d);}return null;};}function patchUpdates(_0xabd5c1){return function(_0x397192){try{jsonpatch['apply'](_0x397192,_0xabd5c1,!![]);}catch(_0x46c0a6){return BPromise[_0xca64('0x1f')](_0x46c0a6);}return _0x397192[_0xca64('0x20')]();};}function saveUpdates(_0x1f9f40,_0x5aee98){return function(_0xe51147){if(_0xe51147){return _0xe51147[_0xca64('0x21')](_0x1f9f40)['then'](function(_0x5c273f){return _0x5c273f;});}return null;};}function removeEntity(_0x35ffe3,_0x46449e){return function(_0x132cf1){if(_0x132cf1){return _0x132cf1[_0xca64('0x22')]()[_0xca64('0x23')](function(){_0x35ffe3['status'](0xcc)[_0xca64('0x24')]();});}};}function handleEntityNotFound(_0x43abb3,_0x9fc3a2){return function(_0x17dc46){if(!_0x17dc46){_0x43abb3[_0xca64('0x18')](0x194);}return _0x17dc46;};}function handleError(_0x3e9c9c,_0x5f2d51){_0x5f2d51=_0x5f2d51||0x1f4;return function(_0xc0b1f5){logger[_0xca64('0x25')](_0xc0b1f5[_0xca64('0x26')]);if(_0xc0b1f5[_0xca64('0x27')]){delete _0xc0b1f5[_0xca64('0x27')];}_0x3e9c9c[_0xca64('0x19')](_0x5f2d51)['send'](_0xc0b1f5);};}exports[_0xca64('0x28')]=function(_0x20e0ff,_0x5ef5cd){var _0x2b03d9={},_0x29f933={},_0x519296={'count':0x0,'rows':[]};var _0x5a5612=_[_0xca64('0x29')](db[_0xca64('0x2a')][_0xca64('0x2b')],function(_0x4ea28c){return{'name':_0x4ea28c['fieldName'],'type':_0x4ea28c[_0xca64('0x2c')]['key']};});_0x29f933[_0xca64('0x2d')]=_['map'](_0x5a5612,'name');_0x29f933[_0xca64('0x2e')]=_[_0xca64('0x2f')](_0x20e0ff[_0xca64('0x2e')]);_0x29f933[_0xca64('0x30')]=_[_0xca64('0x31')](_0x29f933['model'],_0x29f933[_0xca64('0x2e')]);_0x2b03d9[_0xca64('0x32')]=_[_0xca64('0x31')](_0x29f933[_0xca64('0x2d')],qs[_0xca64('0x33')](_0x20e0ff[_0xca64('0x2e')][_0xca64('0x33')]));_0x2b03d9['attributes']=_0x2b03d9[_0xca64('0x32')][_0xca64('0x34')]?_0x2b03d9[_0xca64('0x32')]:_0x29f933['model'];if(!_0x20e0ff['query'][_0xca64('0x35')](_0xca64('0x36'))){_0x2b03d9[_0xca64('0x1d')]=qs['limit'](_0x20e0ff[_0xca64('0x2e')]['limit']);_0x2b03d9[_0xca64('0x1b')]=qs['offset'](_0x20e0ff[_0xca64('0x2e')][_0xca64('0x1b')]);}_0x2b03d9[_0xca64('0x37')]=qs[_0xca64('0x38')](_0x20e0ff[_0xca64('0x2e')][_0xca64('0x38')]);_0x2b03d9[_0xca64('0x39')]=qs[_0xca64('0x30')](_['pick'](_0x20e0ff['query'],_0x29f933[_0xca64('0x30')]),_0x5a5612);if(_0x20e0ff['query'][_0xca64('0x3a')]){_0x2b03d9[_0xca64('0x39')]=_['merge'](_0x2b03d9[_0xca64('0x39')],{'$or':_[_0xca64('0x29')](_0x5a5612,function(_0xada604){if(_0xada604['type']!==_0xca64('0x3b')){var _0x53a9cf={};_0x53a9cf[_0xada604[_0xca64('0x27')]]={'$like':'%'+_0x20e0ff['query']['filter']+'%'};return _0x53a9cf;}})});}_0x2b03d9=_[_0xca64('0x3c')]({},_0x2b03d9,_0x20e0ff[_0xca64('0x3d')]);var _0x23013e={'where':_0x2b03d9[_0xca64('0x39')]};return db['VoiceQueuesLog'][_0xca64('0x3e')](_0x23013e)['then'](function(_0x4f6e97){_0x519296['count']=_0x4f6e97;if(_0x20e0ff[_0xca64('0x2e')][_0xca64('0x3f')]){_0x2b03d9[_0xca64('0x40')]=[{'all':!![]}];}return db[_0xca64('0x2a')]['findAll'](_0x2b03d9);})[_0xca64('0x23')](function(_0x250e4f){_0x519296[_0xca64('0x41')]=_0x250e4f;return _0x519296;})[_0xca64('0x23')](respondWithFilteredResult(_0x5ef5cd,_0x2b03d9))[_0xca64('0x42')](handleError(_0x5ef5cd,null));};exports[_0xca64('0x43')]=function(_0x3fbd64,_0x3f2e32){var _0x4e4980={'raw':!![],'where':{'id':_0x3fbd64[_0xca64('0x44')]['id']}},_0x46e9bb={};_0x46e9bb[_0xca64('0x2d')]=_[_0xca64('0x2f')](db[_0xca64('0x2a')][_0xca64('0x2b')]);_0x46e9bb[_0xca64('0x2e')]=_[_0xca64('0x2f')](_0x3fbd64[_0xca64('0x2e')]);_0x46e9bb['filters']=_['intersection'](_0x46e9bb['model'],_0x46e9bb[_0xca64('0x2e')]);_0x4e4980[_0xca64('0x32')]=_[_0xca64('0x31')](_0x46e9bb[_0xca64('0x2d')],qs[_0xca64('0x33')](_0x3fbd64['query']['fields']));_0x4e4980['attributes']=_0x4e4980[_0xca64('0x32')][_0xca64('0x34')]?_0x4e4980[_0xca64('0x32')]:_0x46e9bb[_0xca64('0x2d')];if(_0x3fbd64[_0xca64('0x2e')][_0xca64('0x3f')]){_0x4e4980['include']=[{'all':!![]}];}_0x4e4980=_[_0xca64('0x3c')]({},_0x4e4980,_0x3fbd64[_0xca64('0x3d')]);return db['VoiceQueuesLog'][_0xca64('0x45')](_0x4e4980)['then'](handleEntityNotFound(_0x3f2e32,null))[_0xca64('0x23')](respondWithResult(_0x3f2e32,null))[_0xca64('0x42')](handleError(_0x3f2e32,null));};exports[_0xca64('0x46')]=function(_0x11eb7a,_0xfa2051){return db['VoiceQueuesLog'][_0xca64('0x46')](_0x11eb7a['body'],{})[_0xca64('0x23')](respondWithResult(_0xfa2051,0xc9))[_0xca64('0x42')](handleError(_0xfa2051,null));};exports[_0xca64('0x21')]=function(_0x272d6a,_0x167e01){if(_0x272d6a[_0xca64('0x47')]['id']){delete _0x272d6a[_0xca64('0x47')]['id'];}return db[_0xca64('0x2a')][_0xca64('0x45')]({'where':{'id':_0x272d6a[_0xca64('0x44')]['id']}})[_0xca64('0x23')](handleEntityNotFound(_0x167e01,null))[_0xca64('0x23')](saveUpdates(_0x272d6a['body'],null))[_0xca64('0x23')](respondWithResult(_0x167e01,null))[_0xca64('0x42')](handleError(_0x167e01,null));};exports['destroy']=function(_0x51f260,_0x561be0){return db[_0xca64('0x2a')][_0xca64('0x45')]({'where':{'id':_0x51f260['params']['id']}})['then'](handleEntityNotFound(_0x561be0,null))[_0xca64('0x23')](removeEntity(_0x561be0,null))[_0xca64('0x42')](handleError(_0x561be0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8605839..badd704 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 _0x0f10=['lodash','../../config/logger','api','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0x0f10,0xc3));var _0x00f1=function(_0x4ca4e2,_0x4e42f5){_0x4ca4e2=_0x4ca4e2-0x0;var _0x1ad7e1=_0x0f10[_0x4ca4e2];return _0x1ad7e1;};'use strict';var _=require(_0x00f1('0x0'));var util=require('util');var logger=require(_0x00f1('0x1'))(_0x00f1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x00f1('0x3'));var fs=require('fs');var path=require(_0x00f1('0x4'));var rimraf=require(_0x00f1('0x5'));var config=require('../../config/environment');var attributes=require(_0x00f1('0x6'));module[_0x00f1('0x7')]=function(_0x2881ae,_0x3b4421){return _0x2881ae[_0x00f1('0x8')](_0x00f1('0x9'),attributes,{'tableName':_0x00f1('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x00f1('0xb'),_0x00f1('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1311=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger','api','path','../../config/environment'];(function(_0x1f65e2,_0x5b370a){var _0x553275=function(_0x422c2e){while(--_0x422c2e){_0x1f65e2['push'](_0x1f65e2['shift']());}};_0x553275(++_0x5b370a);}(_0x1311,0x1ab));var _0x1131=function(_0x5a1bdb,_0x1b170e){_0x5a1bdb=_0x5a1bdb-0x0;var _0x594049=_0x1311[_0x5a1bdb];return _0x594049;};'use strict';var _=require('lodash');var util=require(_0x1131('0x0'));var logger=require(_0x1131('0x1'))(_0x1131('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1131('0x3'));var rimraf=require('rimraf');var config=require(_0x1131('0x4'));var attributes=require(_0x1131('0x5'));module[_0x1131('0x6')]=function(_0x2fc23e,_0x3a8a76){return _0x2fc23e[_0x1131('0x7')](_0x1131('0x8'),attributes,{'tableName':_0x1131('0x9'),'paranoid':![],'indexes':[{'name':_0x1131('0xa'),'fields':['event',_0x1131('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index daa2791..2c11e09 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 _0x2b29=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0x2b29,0x135));var _0x92b2=function(_0x55a839,_0x133513){_0x55a839=_0x55a839-0x0;var _0x5d35ca=_0x2b29[_0x55a839];return _0x5d35ca;};'use strict';var _=require(_0x92b2('0x0'));var util=require('util');var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92b2('0x3'));var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))('rpc');var config=require(_0x92b2('0x7'));var jayson=require(_0x92b2('0x8'));var client=jayson['client'][_0x92b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542994,_0x54874e,_0x18b8c1){return new BPromise(function(_0x40375b,_0x5d23f3){return client[_0x92b2('0xa')](_0x542994,_0x18b8c1)[_0x92b2('0xb')](function(_0x1bbb38){logger[_0x92b2('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x54874e,_0x92b2('0xd'));logger[_0x92b2('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x54874e,_0x92b2('0xd'),JSON[_0x92b2('0xf')](_0x1bbb38));if(_0x1bbb38[_0x92b2('0x10')]){if(_0x1bbb38['error'][_0x92b2('0x11')]===0x1f4){logger[_0x92b2('0x10')](_0x92b2('0x12'),_0x54874e,_0x1bbb38[_0x92b2('0x10')][_0x92b2('0x13')]);return _0x5d23f3(_0x1bbb38[_0x92b2('0x10')][_0x92b2('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x54874e,_0x1bbb38['error']['message']);return _0x40375b(_0x1bbb38[_0x92b2('0x10')][_0x92b2('0x13')]);}else{logger[_0x92b2('0xc')](_0x92b2('0x12'),_0x54874e,_0x92b2('0xd'));_0x40375b(_0x1bbb38[_0x92b2('0x14')][_0x92b2('0x13')]);}})['catch'](function(_0x5cf4db){logger['error'](_0x92b2('0x12'),_0x54874e,_0x5cf4db);_0x5d23f3(_0x5cf4db);});});} \ No newline at end of file +var _0xd167=['stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd167,0xc3));var _0x7d16=function(_0x169ab0,_0xac0797){_0x169ab0=_0x169ab0-0x0;var _0x86141a=_0xd167[_0x169ab0];return _0x86141a;};'use strict';var _=require(_0x7d16('0x0'));var util=require(_0x7d16('0x1'));var moment=require('moment');var BPromise=require(_0x7d16('0x2'));var rs=require(_0x7d16('0x3'));var fs=require('fs');var Redis=require(_0x7d16('0x4'));var db=require(_0x7d16('0x5'))['db'];var utils=require(_0x7d16('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7d16('0x7'));var jayson=require(_0x7d16('0x8'));var client=jayson[_0x7d16('0x9')][_0x7d16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x93df31,_0x17e6b3,_0x5cdcd4){return new BPromise(function(_0x1d1d2e,_0x5402c3){return client['request'](_0x93df31,_0x5cdcd4)['then'](function(_0x3ae69b){logger[_0x7d16('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x17e6b3,_0x7d16('0xc'));logger[_0x7d16('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x17e6b3,_0x7d16('0xc'),JSON[_0x7d16('0xe')](_0x3ae69b));if(_0x3ae69b['error']){if(_0x3ae69b['error']['code']===0x1f4){logger[_0x7d16('0xf')](_0x7d16('0x10'),_0x17e6b3,_0x3ae69b[_0x7d16('0xf')][_0x7d16('0x11')]);return _0x5402c3(_0x3ae69b[_0x7d16('0xf')][_0x7d16('0x11')]);}logger[_0x7d16('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x17e6b3,_0x3ae69b[_0x7d16('0xf')]['message']);return _0x1d1d2e(_0x3ae69b[_0x7d16('0xf')]['message']);}else{logger[_0x7d16('0xb')](_0x7d16('0x10'),_0x17e6b3,_0x7d16('0xc'));_0x1d1d2e(_0x3ae69b[_0x7d16('0x12')][_0x7d16('0x11')]);}})['catch'](function(_0x4d6971){logger[_0x7d16('0xf')](_0x7d16('0x10'),_0x17e6b3,_0x4d6971);_0x5402c3(_0x4d6971);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7e6b53a..209e1a7 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 _0x0539=['/:id','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','update','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1851b9,_0x9ee09a){var _0x20bcbd=function(_0x583384){while(--_0x583384){_0x1851b9['push'](_0x1851b9['shift']());}};_0x20bcbd(++_0x9ee09a);}(_0x0539,0x1d8));var _0x9053=function(_0x19f615,_0x42661e){_0x19f615=_0x19f615-0x0;var _0x9d416f=_0x0539[_0x19f615];return _0x9d416f;};'use strict';var multer=require('multer');var util=require(_0x9053('0x0'));var path=require(_0x9053('0x1'));var timeout=require('connect-timeout');var express=require(_0x9053('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9053('0x3'));var interaction=require(_0x9053('0x4'));var config=require('../../config/environment');var controller=require(_0x9053('0x5'));router[_0x9053('0x6')]('/',auth[_0x9053('0x7')](),controller[_0x9053('0x8')]);router[_0x9053('0x6')](_0x9053('0x9'),auth[_0x9053('0x7')](),controller[_0x9053('0xa')]);router[_0x9053('0x6')](_0x9053('0xb'),auth[_0x9053('0x7')](),controller[_0x9053('0xc')]);router[_0x9053('0x6')](_0x9053('0xd'),auth[_0x9053('0x7')](),controller['download']);router[_0x9053('0x6')](_0x9053('0xe'),controller['downloads']);router[_0x9053('0x6')](_0x9053('0xf'),auth[_0x9053('0x7')](),controller[_0x9053('0x10')]);router[_0x9053('0x11')]('/',auth[_0x9053('0x7')](),controller['create']);router[_0x9053('0x11')](_0x9053('0xf'),auth[_0x9053('0x7')](),controller['runTranscribe']);router['put'](_0x9053('0xb'),auth[_0x9053('0x7')](),controller[_0x9053('0x12')]);router['delete'](_0x9053('0xb'),auth[_0x9053('0x7')](),controller[_0x9053('0x13')]);module[_0x9053('0x14')]=router; \ No newline at end of file +var _0x8146=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','put','update'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8146,0xb2));var _0x6814=function(_0x416569,_0x1d0fd9){_0x416569=_0x416569-0x0;var _0x443b79=_0x8146[_0x416569];return _0x443b79;};'use strict';var multer=require(_0x6814('0x0'));var util=require(_0x6814('0x1'));var path=require(_0x6814('0x2'));var timeout=require(_0x6814('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6814('0x4'));var config=require('../../config/environment');var controller=require(_0x6814('0x5'));router['get']('/',auth[_0x6814('0x6')](),controller[_0x6814('0x7')]);router['get'](_0x6814('0x8'),auth[_0x6814('0x6')](),controller[_0x6814('0x9')]);router[_0x6814('0xa')](_0x6814('0xb'),auth[_0x6814('0x6')](),controller[_0x6814('0xc')]);router[_0x6814('0xa')](_0x6814('0xd'),auth[_0x6814('0x6')](),controller[_0x6814('0xe')]);router[_0x6814('0xa')](_0x6814('0xf'),controller[_0x6814('0x10')]);router[_0x6814('0xa')](_0x6814('0x11'),auth[_0x6814('0x6')](),controller[_0x6814('0x12')]);router[_0x6814('0x13')]('/',auth[_0x6814('0x6')](),controller['create']);router['post'](_0x6814('0x11'),auth[_0x6814('0x6')](),controller['runTranscribe']);router[_0x6814('0x14')](_0x6814('0xb'),auth['isAuthenticated'](),controller[_0x6814('0x15')]);router[_0x6814('0x16')]('/:id',auth[_0x6814('0x6')](),controller[_0x6814('0x17')]);module[_0x6814('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 391b6a5..56b2e00 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(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 82c360d..3e146ca 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 _0xf927=['lodash','squel','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','VoiceRecording','rawAttributes','type','key','differenceBy','format','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','fs-extra'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf927,0x8b));var _0x7f92=function(_0xd89345,_0xe1ce3){_0xd89345=_0xd89345-0x0;var _0x26fad8=_0xf927[_0xd89345];return _0x26fad8;};'use strict';var emlformat=require(_0x7f92('0x0'));var rimraf=require(_0x7f92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f92('0x2'));var moment=require(_0x7f92('0x3'));var BPromise=require(_0x7f92('0x4'));var Mustache=require(_0x7f92('0x5'));var util=require(_0x7f92('0x6'));var path=require('path');var sox=require(_0x7f92('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f92('0x8'));var _=require(_0x7f92('0x9'));var squel=require(_0x7f92('0xa'));var crypto=require('crypto');var jsforce=require(_0x7f92('0xb'));var deskjs=require(_0x7f92('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f92('0xd'));var AWS=require(_0x7f92('0xe'));var uuidv4=require(_0x7f92('0xf'));var Redis=require(_0x7f92('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f92('0x11'));var logger=require('../../config/logger')(_0x7f92('0x12'));var utils=require(_0x7f92('0x13'));var config=require(_0x7f92('0x14'));var licenseUtil=require(_0x7f92('0x15'));var db=require(_0x7f92('0x16'))['db'];function respondWithStatusCode(_0x4dd3d8,_0x35285c){_0x35285c=_0x35285c||0xcc;return function(_0x1b3667){if(_0x1b3667){return _0x4dd3d8['sendStatus'](_0x35285c);}return _0x4dd3d8[_0x7f92('0x17')](_0x35285c)[_0x7f92('0x18')]();};}function respondWithResult(_0x1efa8b,_0x5c16ca){_0x5c16ca=_0x5c16ca||0xc8;return function(_0x42457c){if(_0x42457c){return _0x1efa8b['status'](_0x5c16ca)[_0x7f92('0x19')](_0x42457c);}};}function respondWithFilteredResult(_0x39950d,_0x3bf100){return function(_0x136a76){if(_0x136a76){var _0x57bc70=typeof _0x3bf100[_0x7f92('0x1a')]==='undefined'&&typeof _0x3bf100[_0x7f92('0x1b')]===_0x7f92('0x1c');var _0x6f5144=_0x136a76[_0x7f92('0x1d')];var _0x450713=_0x57bc70?0x0:_0x3bf100[_0x7f92('0x1a')];var _0x216c92=_0x57bc70?_0x136a76[_0x7f92('0x1d')]:_0x3bf100['offset']+_0x3bf100[_0x7f92('0x1b')];var _0x22c7d7;if(_0x216c92>=_0x6f5144){_0x216c92=_0x6f5144;_0x22c7d7=0xc8;}else{_0x22c7d7=0xce;}_0x39950d[_0x7f92('0x17')](_0x22c7d7);return _0x39950d[_0x7f92('0x1e')](_0x7f92('0x1f'),_0x450713+'-'+_0x216c92+'/'+_0x6f5144)[_0x7f92('0x19')](_0x136a76);}return null;};}function patchUpdates(_0x1c52d1){return function(_0x565ef3){try{jsonpatch[_0x7f92('0x20')](_0x565ef3,_0x1c52d1,!![]);}catch(_0x2999e2){return BPromise['reject'](_0x2999e2);}return _0x565ef3[_0x7f92('0x21')]();};}function saveUpdates(_0x56cb8d,_0x23bf2a){return function(_0x4d6937){if(_0x4d6937){return _0x4d6937[_0x7f92('0x22')](_0x56cb8d)[_0x7f92('0x23')](function(_0x46651e){return _0x46651e;});}return null;};}function removeEntity(_0x450271,_0x49b291){return function(_0x37d716){if(_0x37d716){return _0x37d716[_0x7f92('0x24')]()['then'](function(){_0x450271[_0x7f92('0x17')](0xcc)[_0x7f92('0x18')]();});}};}function handleEntityNotFound(_0x563598,_0x87c8cd){return function(_0xde93f8){if(!_0xde93f8){_0x563598['sendStatus'](0x194);}return _0xde93f8;};}function handleError(_0x116043,_0x25b1d4){_0x25b1d4=_0x25b1d4||0x1f4;return function(_0x45a0f4){logger[_0x7f92('0x25')](_0x45a0f4[_0x7f92('0x26')]);if(_0x45a0f4['name']){delete _0x45a0f4[_0x7f92('0x27')];}_0x116043[_0x7f92('0x17')](_0x25b1d4)['send'](_0x45a0f4);};}exports['index']=function(_0x36ea9c,_0x5c61d6){var _0x12cde3={},_0x5e51ac={},_0xb5e17e={'count':0x0,'rows':[]};var _0x2da880=_[_0x7f92('0x28')](db[_0x7f92('0x29')][_0x7f92('0x2a')],function(_0x2a6e4b){return{'name':_0x2a6e4b['fieldName'],'type':_0x2a6e4b[_0x7f92('0x2b')][_0x7f92('0x2c')]};});_0x5e51ac['model']=_[_0x7f92('0x2d')](_[_0x7f92('0x28')](_0x2da880,_0x7f92('0x27')),[_0x7f92('0x2e')]);_0x5e51ac['query']=_['keys'](_0x36ea9c[_0x7f92('0x2f')]);_0x5e51ac[_0x7f92('0x30')]=_[_0x7f92('0x31')](_0x5e51ac['model'],_0x5e51ac['query']);_0x12cde3['attributes']=_['intersection'](_0x5e51ac[_0x7f92('0x32')],qs[_0x7f92('0x33')](_0x36ea9c[_0x7f92('0x2f')][_0x7f92('0x33')]));_0x12cde3[_0x7f92('0x34')]=_0x12cde3[_0x7f92('0x34')][_0x7f92('0x35')]?_0x12cde3[_0x7f92('0x34')]:_0x5e51ac[_0x7f92('0x32')];if(!_0x36ea9c[_0x7f92('0x2f')]['hasOwnProperty'](_0x7f92('0x36'))){_0x12cde3[_0x7f92('0x1b')]=qs[_0x7f92('0x1b')](_0x36ea9c[_0x7f92('0x2f')][_0x7f92('0x1b')]);_0x12cde3[_0x7f92('0x1a')]=qs[_0x7f92('0x1a')](_0x36ea9c[_0x7f92('0x2f')]['offset']);}_0x12cde3['order']=qs[_0x7f92('0x37')](_0x36ea9c[_0x7f92('0x2f')]['sort']);_0x12cde3[_0x7f92('0x38')]=qs['filters'](_['pick'](_0x36ea9c[_0x7f92('0x2f')],_0x5e51ac[_0x7f92('0x30')]),_0x2da880);if(_0x36ea9c[_0x7f92('0x2f')][_0x7f92('0x39')]){_0x12cde3[_0x7f92('0x38')]=_[_0x7f92('0x3a')](_0x12cde3[_0x7f92('0x38')],{'$or':_[_0x7f92('0x28')](_0x2da880,function(_0x574754){if(_0x574754[_0x7f92('0x2b')]!==_0x7f92('0x3b')){var _0x279789={};_0x279789[_0x574754[_0x7f92('0x27')]]={'$like':'%'+_0x36ea9c[_0x7f92('0x2f')][_0x7f92('0x39')]+'%'};return _0x279789;}})});}_0x12cde3=_[_0x7f92('0x3a')]({},_0x12cde3,_0x36ea9c[_0x7f92('0x3c')]);var _0xea0c11={'where':_0x12cde3[_0x7f92('0x38')]};return db[_0x7f92('0x29')][_0x7f92('0x1d')](_0xea0c11)['then'](function(_0x8ded4e){_0xb5e17e[_0x7f92('0x1d')]=_0x8ded4e;if(_0x36ea9c[_0x7f92('0x2f')][_0x7f92('0x3d')]){_0x12cde3[_0x7f92('0x3e')]=[{'all':!![]}];}return db[_0x7f92('0x29')][_0x7f92('0x3f')](_0x12cde3);})['then'](function(_0x5b66c4){_0xb5e17e[_0x7f92('0x40')]=_0x5b66c4;return _0xb5e17e;})[_0x7f92('0x23')](respondWithFilteredResult(_0x5c61d6,_0x12cde3))[_0x7f92('0x41')](handleError(_0x5c61d6,null));};exports[_0x7f92('0x42')]=function(_0xb5d2fb,_0x29adb8){var _0x3ac6c2={'raw':![],'where':{'id':_0xb5d2fb[_0x7f92('0x43')]['id']}},_0x5e953c={};_0x5e953c[_0x7f92('0x32')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x5e953c['query']=_[_0x7f92('0x44')](_0xb5d2fb[_0x7f92('0x2f')]);_0x5e953c[_0x7f92('0x30')]=_[_0x7f92('0x31')](_0x5e953c[_0x7f92('0x32')],_0x5e953c['query']);_0x3ac6c2[_0x7f92('0x34')]=_[_0x7f92('0x31')](_0x5e953c['model'],qs[_0x7f92('0x33')](_0xb5d2fb[_0x7f92('0x2f')][_0x7f92('0x33')]));_0x3ac6c2[_0x7f92('0x34')]=_0x3ac6c2['attributes'][_0x7f92('0x35')]?_0x3ac6c2[_0x7f92('0x34')]:_0x5e953c[_0x7f92('0x32')];if(_0xb5d2fb[_0x7f92('0x2f')][_0x7f92('0x3d')]){_0x3ac6c2[_0x7f92('0x3e')]=[{'all':!![]}];}_0x3ac6c2=_['merge']({},_0x3ac6c2,_0xb5d2fb['options']);return db[_0x7f92('0x29')][_0x7f92('0x45')](_0x3ac6c2)[_0x7f92('0x23')](handleEntityNotFound(_0x29adb8,null))[_0x7f92('0x23')](respondWithResult(_0x29adb8,null))[_0x7f92('0x41')](handleError(_0x29adb8,null));};exports[_0x7f92('0x46')]=function(_0x7da87d,_0x4ff911){return db[_0x7f92('0x29')]['create'](_0x7da87d[_0x7f92('0x47')],{})[_0x7f92('0x23')](respondWithResult(_0x4ff911,0xc9))[_0x7f92('0x41')](handleError(_0x4ff911,null));};exports[_0x7f92('0x22')]=function(_0xa42720,_0x43604b){if(_0xa42720['body']['id']){delete _0xa42720['body']['id'];}return db[_0x7f92('0x29')]['find']({'where':{'id':_0xa42720['params']['id']}})[_0x7f92('0x23')](handleEntityNotFound(_0x43604b,null))[_0x7f92('0x23')](saveUpdates(_0xa42720[_0x7f92('0x47')],null))[_0x7f92('0x23')](respondWithResult(_0x43604b,null))[_0x7f92('0x41')](handleError(_0x43604b,null));};exports['describe']=function(_0x40bc34,_0x5cd38d){return db[_0x7f92('0x29')]['describe']()[_0x7f92('0x23')](respondWithResult(_0x5cd38d,null))['catch'](handleError(_0x5cd38d,null));};exports[_0x7f92('0x48')]=function(_0x1f8724,_0x5e7234,_0x4dc6d9){var _0x281db9=require(_0x7f92('0x49'));var _0x22d5c2=![];var _0x5c4334={};if(_0x1f8724[_0x7f92('0x2f')][_0x7f92('0x2b')]&&_0x1f8724[_0x7f92('0x2f')][_0x7f92('0x2b')]===_0x7f92('0x4a')){_0x5c4334[_0x7f92('0x4a')]=_0x1f8724[_0x7f92('0x43')]['id'];}else{_0x5c4334['id']=_0x1f8724[_0x7f92('0x43')]['id'];}return db['VoiceRecording'][_0x7f92('0x45')]({'where':_0x5c4334,'attributes':['id',_0x7f92('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x5e7234,null))[_0x7f92('0x23')](function(_0x1cd4f0){if(_0x1cd4f0){var _0x4a135b=_0x1cd4f0[_0x7f92('0x4b')];var _0x32df5a=util['format']('%s.cypher',_0x4a135b);if(fs[_0x7f92('0x4c')](_0x32df5a)){_0x22d5c2=!![];return _0x281db9[_0x7f92('0x4d')](_0x32df5a,_0x4a135b,config[_0x7f92('0x4e')][_0x7f92('0x4f')])[_0x7f92('0x23')](function(){return _0x1cd4f0;});}return _0x1cd4f0;}})[_0x7f92('0x23')](function(_0x3fc958){if(_0x3fc958){var _0x33027d=_0x3fc958[_0x7f92('0x4b')];if(!fs[_0x7f92('0x4c')](_0x33027d)){throw new db[(_0x7f92('0x50'))][(_0x7f92('0x51'))](_0x7f92('0x52'));}if(_0x3fc958['filename']){return _0x5e7234[_0x7f92('0x48')](_0x33027d,_0x3fc958[_0x7f92('0x53')]+path[_0x7f92('0x54')](_0x33027d),function(){if(_0x22d5c2){fs[_0x7f92('0x55')](_0x33027d);}});}else{return _0x5e7234[_0x7f92('0x48')](_0x33027d,function(_0x4db252){if(_0x22d5c2){fs[_0x7f92('0x55')](_0x33027d);}});}}})[_0x7f92('0x41')](function(_0x52419f){if(_0x52419f['message']===_0x7f92('0x52')){_0x5e7234[_0x7f92('0x17')](0x194)[_0x7f92('0x56')](_0x7f92('0x57'));}else{return handleError(_0x5e7234,null);}});};exports[_0x7f92('0x58')]=function(_0x2b9680,_0x31dfc4,_0x110422){var _0x329dae=require(_0x7f92('0x49'));var _0x3dfc1b=![];var _0x205714={'$and':[db['sequelize'][_0x7f92('0x38')](db[_0x7f92('0x59')]['fn'](_0x7f92('0x5a'),db[_0x7f92('0x59')][_0x7f92('0x5b')](_0x7f92('0x4a'))),_0x2b9680[_0x7f92('0x2f')][_0x7f92('0x5c')])]};if(_0x2b9680[_0x7f92('0x2f')][_0x7f92('0x2b')]&&_0x2b9680['query'][_0x7f92('0x2b')]==='uniqueid'){_0x205714[_0x7f92('0x5d')]['push']({'uniqueid':_0x2b9680[_0x7f92('0x43')]['id']});}else{_0x205714[_0x7f92('0x5d')][_0x7f92('0x5e')]({'id':_0x2b9680[_0x7f92('0x43')]['id']});}return db['VoiceRecording'][_0x7f92('0x45')]({'where':_0x205714,'attributes':['id',_0x7f92('0x4b')],'raw':!![]})[_0x7f92('0x23')](handleEntityNotFound(_0x31dfc4,null))[_0x7f92('0x23')](function(_0x1214a4){if(_0x1214a4){var _0x34f0fd=util['format'](_0x7f92('0x5f'),_0x1214a4[_0x7f92('0x4b')]);if(fs[_0x7f92('0x4c')](_0x34f0fd)){_0x3dfc1b=!![];return _0x329dae[_0x7f92('0x4d')](_0x34f0fd,_0x1214a4[_0x7f92('0x4b')],config[_0x7f92('0x4e')][_0x7f92('0x4f')])['then'](function(){return _0x1214a4;});}return _0x1214a4;}})['then'](function(_0x5af858){if(_0x5af858){if(!fs['existsSync'](_0x5af858[_0x7f92('0x4b')])){throw new db[(_0x7f92('0x50'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x5af858[_0x7f92('0x53')]){return _0x31dfc4[_0x7f92('0x48')](_0x5af858[_0x7f92('0x4b')],_0x5af858[_0x7f92('0x53')]+path[_0x7f92('0x54')](_0x5af858[_0x7f92('0x4b')]),function(){if(_0x3dfc1b){fs[_0x7f92('0x55')](_0x5af858[_0x7f92('0x4b')]);}});}else{return _0x31dfc4[_0x7f92('0x48')](_0x5af858[_0x7f92('0x4b')],function(_0x5900ec){if(_0x3dfc1b){fs['unlink'](_0x5af858['value']);}});}}})[_0x7f92('0x41')](handleError(_0x31dfc4,null));};exports[_0x7f92('0x24')]=function(_0x45d5fa,_0x42a4f7){return db[_0x7f92('0x29')][_0x7f92('0x45')]({'where':{'id':_0x45d5fa[_0x7f92('0x43')]['id']}})[_0x7f92('0x23')](function(_0x3dcec5){if(_[_0x7f92('0x60')](_0x3dcec5)){throw new ReferenceError(_0x7f92('0x61'));}return _0x3dcec5;})[_0x7f92('0x23')](function(_0x481661){var _0x3427f2=_0x481661['value'];logger[_0x7f92('0x62')](_0x7f92('0x63'),_0x3427f2);if(!_[_0x7f92('0x60')](_0x481661[_0x7f92('0x4b')])&&fs[_0x7f92('0x4c')](_0x3427f2)){logger['info'](_0x7f92('0x64')+_0x3427f2+_0x7f92('0x65'));fs[_0x7f92('0x66')](_0x3427f2);}_0x3427f2=_0x3427f2+_0x7f92('0x67');if(!_['isNil'](_0x481661[_0x7f92('0x4b')])&&fs[_0x7f92('0x4c')](_0x3427f2)){logger[_0x7f92('0x62')](_0x7f92('0x64')+_0x3427f2+_0x7f92('0x65'));fs['unlinkSync'](_0x3427f2);}return _0x481661;})[_0x7f92('0x23')](function(_0x34b957){if(!_0x34b957)throw new InternalError();return _0x34b957[_0x7f92('0x24')]();})[_0x7f92('0x23')](function(){_0x42a4f7[_0x7f92('0x17')](0xcc)['end']();})[_0x7f92('0x41')](handleError(_0x42a4f7,null));};function getBucketslist(_0x810259,_0x2cfea1,_0x463346){return new Promise(function(_0x41f731,_0x2bbfaf){var _0x5880a3=new AWS['S3']({'accessKeyId':_0x2cfea1,'secretAccessKey':_0x810259,'region':_0x463346});_0x5880a3['listBuckets']({},function(_0x25f211,_0x279606){if(_0x25f211){return _0x2bbfaf(_0x25f211);}else{return _0x41f731(_0x279606);}});});}function createBucket(_0x47c00b,_0x4d998e,_0x408069,_0x57963b){return new Promise(function(_0x43508e,_0x4b1b4e){var _0x570d47=new AWS['S3']({'accessKeyId':_0x4d998e,'secretAccessKey':_0x47c00b,'region':_0x408069});_0x570d47[_0x7f92('0x68')]({'Bucket':_0x57963b},function(_0x27b992,_0x2b3eb3){if(_0x27b992){return _0x4b1b4e(_0x27b992);}else{return _0x43508e(_0x2b3eb3);}});});}function uploadFile(_0x4c1268,_0x5db481,_0xcaa611,_0x3dc359,_0x24120d,_0x163034){return new Promise(function(_0x5f2785,_0x1d3931){var _0x4aa6ec=new AWS['S3']({'accessKeyId':_0x5db481,'secretAccessKey':_0x4c1268,'region':_0xcaa611});_0x4aa6ec['upload']({'Bucket':_0x3dc359,'Key':_0x24120d,'Body':_0x163034},function(_0x3653c7,_0x2bcec6){if(_0x3653c7){return _0x1d3931(_0x3653c7);}else{return _0x5f2785(_0x2bcec6);}});});}function startTranscribe(_0x21ff07,_0x51ce25,_0x2d3f7d,_0x2a9fc6,_0xbb0b1e,_0x204361){return new Promise(function(_0x554d7e,_0x1d8e62){var _0x1dd05e=new AWS[(_0x7f92('0x69'))]({'accessKeyId':_0x51ce25,'secretAccessKey':_0x21ff07,'region':_0x2d3f7d});_0x1dd05e['startTranscriptionJob']({'TranscriptionJobName':_0x2a9fc6,'LanguageCode':_0xbb0b1e,'Media':{'MediaFileUri':_0x204361}},function(_0x5a346c,_0x323994){if(_0x5a346c){return _0x1d8e62(_0x5a346c);}else{return _0x554d7e(_0x323994);}});});}function transcribe(_0x587750,_0x26559e,_0x24c562,_0x49c587,_0x3535dc,_0x46f88c,_0xe1bfd){return new Promise(function(_0x45b585,_0x3165a4){var _0x2f48d1={};logger['info'](util[_0x7f92('0x2e')](_0x7f92('0x6a'),_0x587750,_0x3535dc));return uploadFile(_0x26559e,_0x24c562,_0x49c587,_0x3535dc,path[_0x7f92('0x6b')](_0x46f88c),fs[_0x7f92('0x6c')](_0x46f88c))['then'](function(_0x3e0a8f){logger[_0x7f92('0x62')](util['format'](_0x7f92('0x6d'),_0x587750,_0x3535dc,_0x3e0a8f[_0x7f92('0x6e')]));_0x2f48d1[_0x7f92('0x6f')]=_0x3e0a8f['Bucket'];_0x2f48d1[_0x7f92('0x70')]=_0x3e0a8f[_0x7f92('0x6e')];logger[_0x7f92('0x62')](util[_0x7f92('0x2e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x587750));return startTranscribe(_0x26559e,_0x24c562,_0x49c587,uuidv4(),_0xe1bfd,_0x3e0a8f[_0x7f92('0x6e')]);})[_0x7f92('0x23')](function(_0x378d42){logger[_0x7f92('0x62')](util[_0x7f92('0x2e')](_0x7f92('0x71'),_0x587750,_0x378d42['TranscriptionJob'][_0x7f92('0x72')]));_0x2f48d1[_0x7f92('0x73')]=_0x378d42[_0x7f92('0x74')][_0x7f92('0x72')];_0x2f48d1[_0x7f92('0x75')]=_0x378d42['TranscriptionJob'][_0x7f92('0x76')];return _0x45b585(_0x2f48d1);})[_0x7f92('0x41')](function(_0x22079a){return _0x3165a4(_0x22079a);});});}exports[_0x7f92('0x77')]=function(_0x3ee909,_0x475700,_0x4b45b8){var _0x291ab8;var _0x423bfe;var _0x2e2810;var _0x1ea3c0=require(_0x7f92('0x49'));return db[_0x7f92('0x29')]['findOne']({'where':{'id':_0x3ee909[_0x7f92('0x43')]['id']}})['then'](function(_0x498a11){if(_0x498a11){var _0x1ee682=util[_0x7f92('0x2e')](_0x7f92('0x5f'),_0x498a11[_0x7f92('0x4b')]);if(fs['existsSync'](_0x1ee682)){cypher=!![];return _0x1ea3c0['decryptFile'](_0x1ee682,_0x498a11['value'],config[_0x7f92('0x4e')][_0x7f92('0x4f')])['then'](function(){return _0x498a11;});}return _0x498a11;}})['then'](function(_0xfb62f8){if(!_0xfb62f8){throw new db['Sequelize'][(_0x7f92('0x51'))](_0x7f92('0x78'));}_0x423bfe=_0xfb62f8;return db[_0x7f92('0x79')][_0x7f92('0x7a')]({'where':{'id':0x1}});})[_0x7f92('0x23')](handleEntityNotFound(_0x475700,null))['then'](function(_0xd0ce3c){if(_0xd0ce3c){_0x291ab8=_0xd0ce3c;if(!_0x291ab8[_0x7f92('0x7b')]||!_0x291ab8[_0x7f92('0x7c')]||!_0x291ab8[_0x7f92('0x7d')]||!_0x291ab8[_0x7f92('0x7e')]||!_0x291ab8[_0x7f92('0x6f')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x3ee909[_0x7f92('0x47')]['runSentiment']&&(!_0x291ab8[_0x7f92('0x7f')]||!_0x291ab8[_0x7f92('0x80')]||!_0x291ab8[_0x7f92('0x81')]||!_0x291ab8[_0x7f92('0x7e')]||!_0x291ab8[_0x7f92('0x6f')])){throw new db[(_0x7f92('0x50'))][(_0x7f92('0x51'))](_0x7f92('0x82'));}return db[_0x7f92('0x83')]['findOne']({'where':{'id':_0x291ab8[_0x7f92('0x7c')]}});}})[_0x7f92('0x23')](function(_0x3bd2e9){if(!_0x3bd2e9){throw new db[(_0x7f92('0x50'))][(_0x7f92('0x51'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3bd2e9['data1']||!_0x3bd2e9[_0x7f92('0x84')]){throw new db['Sequelize'][(_0x7f92('0x51'))](_0x7f92('0x85'));}_0x2e2810=_0x3bd2e9;return getBucketslist(_0x2e2810[_0x7f92('0x86')],_0x2e2810['data2'],_0x291ab8[_0x7f92('0x7d')]);})['then'](function(_0x1f7b79){if(_0x1f7b79&&_0x1f7b79[_0x7f92('0x87')]){var _0x35fe2a=_[_0x7f92('0x45')](_0x1f7b79['Buckets'],function(_0x17ff15){return _0x17ff15[_0x7f92('0x88')]===_0x291ab8[_0x7f92('0x6f')];});if(!_0x35fe2a){logger['info'](util['format'](_0x7f92('0x89'),_0x3ee909[_0x7f92('0x43')]['id'],_0x291ab8[_0x7f92('0x6f')]));return createBucket(_0x2e2810['data1'],_0x2e2810[_0x7f92('0x84')],_0x291ab8[_0x7f92('0x7d')],_0x291ab8[_0x7f92('0x6f')]);}logger[_0x7f92('0x62')](util['format'](_0x7f92('0x8a'),_0x3ee909[_0x7f92('0x43')]['id'],_0x291ab8['bucket']));return;}})[_0x7f92('0x23')](function(_0x358ab7){if(_0x423bfe['transcribeStatus']===_0x7f92('0x8b')){return transcribe(_0x3ee909[_0x7f92('0x43')]['id'],_0x2e2810[_0x7f92('0x86')],_0x2e2810['data2'],_0x291ab8[_0x7f92('0x7d')],_0x291ab8['bucket'],_0x423bfe[_0x7f92('0x4b')],_0x291ab8[_0x7f92('0x7e')]);}else{logger['info'](util[_0x7f92('0x2e')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3ee909[_0x7f92('0x43')]['id']));return{'transcribeStatus':_0x7f92('0x8c')};}})[_0x7f92('0x23')](function(_0x845a5b){if(_0x845a5b){_0x845a5b[_0x7f92('0x8d')]=_0x3ee909['body']['runSentiment'];return _0x423bfe[_0x7f92('0x8e')](_0x845a5b);}})[_0x7f92('0x23')](respondWithResult(_0x475700,null))[_0x7f92('0x41')](handleError(_0x475700,null));};function writeFile(_0x267946,_0x85f24f){return new Promise(function(_0x1caf7f,_0x417099){fs[_0x7f92('0x8f')](_0x85f24f,_0x267946,function(_0x106fc4,_0xecad52){if(_0x106fc4){return _0x417099(_0x106fc4);}else{return _0x1caf7f(_0xecad52);}});});}exports['downloadTranscribe']=function(_0x2bf5e0,_0x3e4dc6,_0x218cbf){return db[_0x7f92('0x29')][_0x7f92('0x7a')]({'where':{'id':_0x2bf5e0[_0x7f92('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e4dc6))[_0x7f92('0x23')](function(_0x308f9e){if(_0x308f9e&&_0x308f9e[_0x7f92('0x90')]){var _0x20a8aa=_0x308f9e['fileText'];var _0x429771=config[_0x7f92('0x91')]+_0x7f92('0x92')+_0x308f9e['id']+_0x7f92('0x93');if(fs[_0x7f92('0x4c')](_0x429771)){return _0x429771;}return writeFile(_0x20a8aa,_0x429771)['then'](function(){return _0x429771;});}else{throw new db[(_0x7f92('0x50'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x7f92('0x23')](function(_0x338f81){return _0x3e4dc6[_0x7f92('0x48')](_0x338f81);})[_0x7f92('0x41')](handleError(_0x3e4dc6));}; \ No newline at end of file +var _0x83ef=['set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','catch','params','options','find','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','token','$and','push','ValidationError','download','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeRegion','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83ef,0x76));var _0xf83e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x83ef[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf83e('0x0'));var jsonpatch=require(_0xf83e('0x1'));var rp=require(_0xf83e('0x2'));var moment=require(_0xf83e('0x3'));var BPromise=require(_0xf83e('0x4'));var Mustache=require(_0xf83e('0x5'));var util=require(_0xf83e('0x6'));var path=require(_0xf83e('0x7'));var sox=require(_0xf83e('0x8'));var csv=require(_0xf83e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf83e('0xa'));var squel=require(_0xf83e('0xb'));var crypto=require('crypto');var jsforce=require(_0xf83e('0xc'));var deskjs=require(_0xf83e('0xd'));var toCsv=require(_0xf83e('0x9'));var querystring=require(_0xf83e('0xe'));var Papa=require(_0xf83e('0xf'));var AWS=require(_0xf83e('0x10'));var uuidv4=require(_0xf83e('0x11'));var Redis=require(_0xf83e('0x12'));var authService=require(_0xf83e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf83e('0x14'));var hardwareService=require(_0xf83e('0x15'));var logger=require(_0xf83e('0x16'))(_0xf83e('0x17'));var utils=require(_0xf83e('0x18'));var config=require(_0xf83e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf83e('0x1a'))['db'];function respondWithStatusCode(_0x13fdc2,_0x57f6a7){_0x57f6a7=_0x57f6a7||0xcc;return function(_0x33695f){if(_0x33695f){return _0x13fdc2[_0xf83e('0x1b')](_0x57f6a7);}return _0x13fdc2[_0xf83e('0x1c')](_0x57f6a7)[_0xf83e('0x1d')]();};}function respondWithResult(_0x316185,_0x51b333){_0x51b333=_0x51b333||0xc8;return function(_0x4ad7e9){if(_0x4ad7e9){return _0x316185['status'](_0x51b333)[_0xf83e('0x1e')](_0x4ad7e9);}};}function respondWithFilteredResult(_0x3dabcc,_0x56e6d9){return function(_0x5d72b9){if(_0x5d72b9){var _0x1ff378=typeof _0x56e6d9['offset']===_0xf83e('0x1f')&&typeof _0x56e6d9['limit']==='undefined';var _0x3f8454=_0x5d72b9[_0xf83e('0x20')];var _0x4deca3=_0x1ff378?0x0:_0x56e6d9[_0xf83e('0x21')];var _0x58ccf0=_0x1ff378?_0x5d72b9['count']:_0x56e6d9[_0xf83e('0x21')]+_0x56e6d9[_0xf83e('0x22')];var _0x5830f0;if(_0x58ccf0>=_0x3f8454){_0x58ccf0=_0x3f8454;_0x5830f0=0xc8;}else{_0x5830f0=0xce;}_0x3dabcc[_0xf83e('0x1c')](_0x5830f0);return _0x3dabcc[_0xf83e('0x23')](_0xf83e('0x24'),_0x4deca3+'-'+_0x58ccf0+'/'+_0x3f8454)[_0xf83e('0x1e')](_0x5d72b9);}return null;};}function patchUpdates(_0x488893){return function(_0xd75f67){try{jsonpatch[_0xf83e('0x25')](_0xd75f67,_0x488893,!![]);}catch(_0x378f85){return BPromise[_0xf83e('0x26')](_0x378f85);}return _0xd75f67['save']();};}function saveUpdates(_0x215d59,_0x3e69f9){return function(_0x12b177){if(_0x12b177){return _0x12b177[_0xf83e('0x27')](_0x215d59)[_0xf83e('0x28')](function(_0x36f31a){return _0x36f31a;});}return null;};}function removeEntity(_0x37e675,_0x3839a4){return function(_0x2b4630){if(_0x2b4630){return _0x2b4630[_0xf83e('0x29')]()[_0xf83e('0x28')](function(){_0x37e675[_0xf83e('0x1c')](0xcc)[_0xf83e('0x1d')]();});}};}function handleEntityNotFound(_0x495c5f,_0x596ed2){return function(_0xa2e9ce){if(!_0xa2e9ce){_0x495c5f[_0xf83e('0x1b')](0x194);}return _0xa2e9ce;};}function handleError(_0x32d24f,_0x1f3c70){_0x1f3c70=_0x1f3c70||0x1f4;return function(_0x22b36e){logger['error'](_0x22b36e['stack']);if(_0x22b36e[_0xf83e('0x2a')]){delete _0x22b36e[_0xf83e('0x2a')];}_0x32d24f[_0xf83e('0x1c')](_0x1f3c70)[_0xf83e('0x2b')](_0x22b36e);};}exports[_0xf83e('0x2c')]=function(_0x5db3b1,_0x4fac2c){var _0x4e3d8e={},_0x1fbf85={},_0x24a5a9={'count':0x0,'rows':[]};var _0xf0fadb=_[_0xf83e('0x2d')](db[_0xf83e('0x2e')][_0xf83e('0x2f')],function(_0x1df28f){return{'name':_0x1df28f[_0xf83e('0x30')],'type':_0x1df28f[_0xf83e('0x31')]['key']};});_0x1fbf85[_0xf83e('0x32')]=_[_0xf83e('0x33')](_[_0xf83e('0x2d')](_0xf0fadb,'name'),[_0xf83e('0x34')]);_0x1fbf85[_0xf83e('0x35')]=_[_0xf83e('0x36')](_0x5db3b1['query']);_0x1fbf85[_0xf83e('0x37')]=_[_0xf83e('0x38')](_0x1fbf85[_0xf83e('0x32')],_0x1fbf85[_0xf83e('0x35')]);_0x4e3d8e[_0xf83e('0x39')]=_[_0xf83e('0x38')](_0x1fbf85[_0xf83e('0x32')],qs[_0xf83e('0x3a')](_0x5db3b1['query']['fields']));_0x4e3d8e['attributes']=_0x4e3d8e[_0xf83e('0x39')][_0xf83e('0x3b')]?_0x4e3d8e[_0xf83e('0x39')]:_0x1fbf85[_0xf83e('0x32')];if(!_0x5db3b1[_0xf83e('0x35')][_0xf83e('0x3c')]('nolimit')){_0x4e3d8e['limit']=qs[_0xf83e('0x22')](_0x5db3b1['query']['limit']);_0x4e3d8e[_0xf83e('0x21')]=qs[_0xf83e('0x21')](_0x5db3b1[_0xf83e('0x35')][_0xf83e('0x21')]);}_0x4e3d8e[_0xf83e('0x3d')]=qs[_0xf83e('0x3e')](_0x5db3b1['query'][_0xf83e('0x3e')]);_0x4e3d8e[_0xf83e('0x3f')]=qs['filters'](_[_0xf83e('0x40')](_0x5db3b1[_0xf83e('0x35')],_0x1fbf85[_0xf83e('0x37')]),_0xf0fadb);if(_0x5db3b1[_0xf83e('0x35')][_0xf83e('0x41')]){_0x4e3d8e[_0xf83e('0x3f')]=_[_0xf83e('0x42')](_0x4e3d8e['where'],{'$or':_[_0xf83e('0x2d')](_0xf0fadb,function(_0x14db97){if(_0x14db97['type']!==_0xf83e('0x43')){var _0x908022={};_0x908022[_0x14db97['name']]={'$like':'%'+_0x5db3b1[_0xf83e('0x35')]['filter']+'%'};return _0x908022;}})});}_0x4e3d8e=_['merge']({},_0x4e3d8e,_0x5db3b1['options']);var _0x4b318b={'where':_0x4e3d8e['where']};return db[_0xf83e('0x2e')]['count'](_0x4b318b)[_0xf83e('0x28')](function(_0x167866){_0x24a5a9['count']=_0x167866;if(_0x5db3b1['query']['includeAll']){_0x4e3d8e[_0xf83e('0x44')]=[{'all':!![]}];}return db[_0xf83e('0x2e')]['findAll'](_0x4e3d8e);})[_0xf83e('0x28')](function(_0x99afd5){_0x24a5a9['rows']=_0x99afd5;return _0x24a5a9;})[_0xf83e('0x28')](respondWithFilteredResult(_0x4fac2c,_0x4e3d8e))[_0xf83e('0x45')](handleError(_0x4fac2c,null));};exports['show']=function(_0x279bc7,_0x276634){var _0x43b1af={'raw':![],'where':{'id':_0x279bc7[_0xf83e('0x46')]['id']}},_0x3b18a8={};_0x3b18a8[_0xf83e('0x32')]=_['keys'](db[_0xf83e('0x2e')]['rawAttributes']);_0x3b18a8[_0xf83e('0x35')]=_[_0xf83e('0x36')](_0x279bc7[_0xf83e('0x35')]);_0x3b18a8['filters']=_['intersection'](_0x3b18a8['model'],_0x3b18a8[_0xf83e('0x35')]);_0x43b1af[_0xf83e('0x39')]=_[_0xf83e('0x38')](_0x3b18a8[_0xf83e('0x32')],qs[_0xf83e('0x3a')](_0x279bc7[_0xf83e('0x35')][_0xf83e('0x3a')]));_0x43b1af['attributes']=_0x43b1af['attributes']['length']?_0x43b1af[_0xf83e('0x39')]:_0x3b18a8[_0xf83e('0x32')];if(_0x279bc7[_0xf83e('0x35')]['includeAll']){_0x43b1af[_0xf83e('0x44')]=[{'all':!![]}];}_0x43b1af=_['merge']({},_0x43b1af,_0x279bc7[_0xf83e('0x47')]);return db[_0xf83e('0x2e')][_0xf83e('0x48')](_0x43b1af)[_0xf83e('0x28')](handleEntityNotFound(_0x276634,null))[_0xf83e('0x28')](respondWithResult(_0x276634,null))[_0xf83e('0x45')](handleError(_0x276634,null));};exports['create']=function(_0x700e9e,_0x6aedf2){return db['VoiceRecording']['create'](_0x700e9e[_0xf83e('0x49')],{})[_0xf83e('0x28')](respondWithResult(_0x6aedf2,0xc9))['catch'](handleError(_0x6aedf2,null));};exports[_0xf83e('0x27')]=function(_0x68a29d,_0x28d19e){if(_0x68a29d[_0xf83e('0x49')]['id']){delete _0x68a29d[_0xf83e('0x49')]['id'];}return db[_0xf83e('0x2e')]['find']({'where':{'id':_0x68a29d[_0xf83e('0x46')]['id']}})['then'](handleEntityNotFound(_0x28d19e,null))[_0xf83e('0x28')](saveUpdates(_0x68a29d['body'],null))[_0xf83e('0x28')](respondWithResult(_0x28d19e,null))[_0xf83e('0x45')](handleError(_0x28d19e,null));};exports[_0xf83e('0x4a')]=function(_0x2e69e4,_0x564c0f){return db[_0xf83e('0x2e')][_0xf83e('0x4a')]()[_0xf83e('0x28')](respondWithResult(_0x564c0f,null))[_0xf83e('0x45')](handleError(_0x564c0f,null));};exports['download']=function(_0x1e8f2d,_0x516a15,_0x6b17ca){var _0x58cc04=require(_0xf83e('0x4b'));var _0x16d8d1=![];var _0x17bf1f={};if(_0x1e8f2d[_0xf83e('0x35')][_0xf83e('0x31')]&&_0x1e8f2d[_0xf83e('0x35')][_0xf83e('0x31')]===_0xf83e('0x4c')){_0x17bf1f['uniqueid']=_0x1e8f2d[_0xf83e('0x46')]['id'];}else{_0x17bf1f['id']=_0x1e8f2d[_0xf83e('0x46')]['id'];}return db[_0xf83e('0x2e')]['find']({'where':_0x17bf1f,'attributes':['id',_0xf83e('0x4d')],'raw':!![]})[_0xf83e('0x28')](handleEntityNotFound(_0x516a15,null))[_0xf83e('0x28')](function(_0x1f5693){if(_0x1f5693){var _0x108281=_0x1f5693[_0xf83e('0x4d')];var _0x9edfa4=util['format'](_0xf83e('0x4e'),_0x108281);if(fs[_0xf83e('0x4f')](_0x9edfa4)){_0x16d8d1=!![];return _0x58cc04[_0xf83e('0x50')](_0x9edfa4,_0x108281,config[_0xf83e('0x51')][_0xf83e('0x52')])[_0xf83e('0x28')](function(){return _0x1f5693;});}return _0x1f5693;}})[_0xf83e('0x28')](function(_0x1af6e0){if(_0x1af6e0){var _0x3c3fbb=_0x1af6e0[_0xf83e('0x4d')];if(!fs[_0xf83e('0x4f')](_0x3c3fbb)){throw new db[(_0xf83e('0x53'))]['ValidationError'](_0xf83e('0x54'));}if(_0x1af6e0[_0xf83e('0x55')]){return _0x516a15['download'](_0x3c3fbb,_0x1af6e0[_0xf83e('0x55')]+path[_0xf83e('0x56')](_0x3c3fbb),function(){if(_0x16d8d1){fs[_0xf83e('0x57')](_0x3c3fbb);}});}else{return _0x516a15['download'](_0x3c3fbb,function(_0x349feb){if(_0x16d8d1){fs[_0xf83e('0x57')](_0x3c3fbb);}});}}})['catch'](function(_0x541952){if(_0x541952['message']==='VoiceRecording\x20not\x20found'){_0x516a15['status'](0x194)[_0xf83e('0x2b')](_0xf83e('0x58'));}else{return handleError(_0x516a15,null);}});};exports[_0xf83e('0x59')]=function(_0x2d5e7,_0x390605,_0x5f5d97){var _0x18d20f=require(_0xf83e('0x4b'));var _0x1fd225=![];var _0x314f8c={'$and':[db['sequelize']['where'](db[_0xf83e('0x5a')]['fn'](_0xf83e('0x5b'),db['sequelize']['col'](_0xf83e('0x4c'))),_0x2d5e7['query'][_0xf83e('0x5c')])]};if(_0x2d5e7[_0xf83e('0x35')][_0xf83e('0x31')]&&_0x2d5e7[_0xf83e('0x35')][_0xf83e('0x31')]==='uniqueid'){_0x314f8c[_0xf83e('0x5d')][_0xf83e('0x5e')]({'uniqueid':_0x2d5e7[_0xf83e('0x46')]['id']});}else{_0x314f8c['$and'][_0xf83e('0x5e')]({'id':_0x2d5e7[_0xf83e('0x46')]['id']});}return db[_0xf83e('0x2e')][_0xf83e('0x48')]({'where':_0x314f8c,'attributes':['id',_0xf83e('0x4d')],'raw':!![]})[_0xf83e('0x28')](handleEntityNotFound(_0x390605,null))['then'](function(_0x2689b0){if(_0x2689b0){var _0x276d76=util[_0xf83e('0x34')](_0xf83e('0x4e'),_0x2689b0['value']);if(fs['existsSync'](_0x276d76)){_0x1fd225=!![];return _0x18d20f[_0xf83e('0x50')](_0x276d76,_0x2689b0[_0xf83e('0x4d')],config[_0xf83e('0x51')][_0xf83e('0x52')])[_0xf83e('0x28')](function(){return _0x2689b0;});}return _0x2689b0;}})[_0xf83e('0x28')](function(_0x5892ca){if(_0x5892ca){if(!fs[_0xf83e('0x4f')](_0x5892ca[_0xf83e('0x4d')])){throw new db[(_0xf83e('0x53'))][(_0xf83e('0x5f'))]('VoiceRecording\x20not\x20found');}if(_0x5892ca[_0xf83e('0x55')]){return _0x390605['download'](_0x5892ca[_0xf83e('0x4d')],_0x5892ca[_0xf83e('0x55')]+path[_0xf83e('0x56')](_0x5892ca[_0xf83e('0x4d')]),function(){if(_0x1fd225){fs['unlink'](_0x5892ca[_0xf83e('0x4d')]);}});}else{return _0x390605[_0xf83e('0x60')](_0x5892ca[_0xf83e('0x4d')],function(_0x126ed9){if(_0x1fd225){fs[_0xf83e('0x57')](_0x5892ca[_0xf83e('0x4d')]);}});}}})[_0xf83e('0x45')](handleError(_0x390605,null));};exports['destroy']=function(_0x5434d0,_0x4bd4e1){return db[_0xf83e('0x2e')][_0xf83e('0x48')]({'where':{'id':_0x5434d0[_0xf83e('0x46')]['id']}})[_0xf83e('0x28')](function(_0x2a8f47){if(_['isNil'](_0x2a8f47)){throw new ReferenceError(_0xf83e('0x61'));}return _0x2a8f47;})[_0xf83e('0x28')](function(_0x3d05fe){var _0x1bfd93=_0x3d05fe['value'];logger[_0xf83e('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x1bfd93);if(!_[_0xf83e('0x63')](_0x3d05fe[_0xf83e('0x4d')])&&fs[_0xf83e('0x4f')](_0x1bfd93)){logger[_0xf83e('0x62')](_0xf83e('0x64')+_0x1bfd93+_0xf83e('0x65'));fs['unlinkSync'](_0x1bfd93);}_0x1bfd93=_0x1bfd93+_0xf83e('0x66');if(!_[_0xf83e('0x63')](_0x3d05fe[_0xf83e('0x4d')])&&fs['existsSync'](_0x1bfd93)){logger[_0xf83e('0x62')]('File:\x20\x22'+_0x1bfd93+_0xf83e('0x65'));fs['unlinkSync'](_0x1bfd93);}return _0x3d05fe;})[_0xf83e('0x28')](function(_0x143bd3){if(!_0x143bd3)throw new InternalError();return _0x143bd3[_0xf83e('0x29')]();})['then'](function(){_0x4bd4e1[_0xf83e('0x1c')](0xcc)[_0xf83e('0x1d')]();})[_0xf83e('0x45')](handleError(_0x4bd4e1,null));};function getBucketslist(_0x34a64b,_0x359dd9,_0x14a379){return new Promise(function(_0x1184bd,_0x33beba){var _0x36e57e=new AWS['S3']({'accessKeyId':_0x359dd9,'secretAccessKey':_0x34a64b,'region':_0x14a379});_0x36e57e[_0xf83e('0x67')]({},function(_0x4cdfd8,_0x5fd0e4){if(_0x4cdfd8){return _0x33beba(_0x4cdfd8);}else{return _0x1184bd(_0x5fd0e4);}});});}function createBucket(_0x4fa23b,_0x5de953,_0x3d2d91,_0xad57e8){return new Promise(function(_0x63065a,_0x316454){var _0x328ef8=new AWS['S3']({'accessKeyId':_0x5de953,'secretAccessKey':_0x4fa23b,'region':_0x3d2d91});_0x328ef8[_0xf83e('0x68')]({'Bucket':_0xad57e8},function(_0x48fb64,_0x29513d){if(_0x48fb64){return _0x316454(_0x48fb64);}else{return _0x63065a(_0x29513d);}});});}function uploadFile(_0x13e06b,_0x274254,_0x27a3a7,_0x5c99e2,_0x82f7d0,_0x3063b0){return new Promise(function(_0x31c7c7,_0x274c25){var _0x10f6a7=new AWS['S3']({'accessKeyId':_0x274254,'secretAccessKey':_0x13e06b,'region':_0x27a3a7});_0x10f6a7[_0xf83e('0x69')]({'Bucket':_0x5c99e2,'Key':_0x82f7d0,'Body':_0x3063b0},function(_0x3adecc,_0x54d2db){if(_0x3adecc){return _0x274c25(_0x3adecc);}else{return _0x31c7c7(_0x54d2db);}});});}function startTranscribe(_0x496c76,_0x329838,_0x5d543f,_0x3b5e55,_0x19b893,_0x9fd0f7){return new Promise(function(_0x1eb547,_0x411113){var _0x3b0dbb=new AWS['TranscribeService']({'accessKeyId':_0x329838,'secretAccessKey':_0x496c76,'region':_0x5d543f});_0x3b0dbb[_0xf83e('0x6a')]({'TranscriptionJobName':_0x3b5e55,'LanguageCode':_0x19b893,'Media':{'MediaFileUri':_0x9fd0f7}},function(_0x520a6d,_0x73f733){if(_0x520a6d){return _0x411113(_0x520a6d);}else{return _0x1eb547(_0x73f733);}});});}function transcribe(_0x2371fc,_0x2ff877,_0x24d51a,_0x1521fd,_0x568439,_0x589d61,_0x35713d){return new Promise(function(_0x3d417c,_0x18b01f){var _0xc0629b={};logger['info'](util[_0xf83e('0x34')](_0xf83e('0x6b'),_0x2371fc,_0x568439));return uploadFile(_0x2ff877,_0x24d51a,_0x1521fd,_0x568439,path[_0xf83e('0x6c')](_0x589d61),fs[_0xf83e('0x6d')](_0x589d61))[_0xf83e('0x28')](function(_0x4b1121){logger[_0xf83e('0x62')](util[_0xf83e('0x34')](_0xf83e('0x6e'),_0x2371fc,_0x568439,_0x4b1121[_0xf83e('0x6f')]));_0xc0629b[_0xf83e('0x70')]=_0x4b1121[_0xf83e('0x71')];_0xc0629b[_0xf83e('0x72')]=_0x4b1121[_0xf83e('0x6f')];logger[_0xf83e('0x62')](util[_0xf83e('0x34')](_0xf83e('0x73'),_0x2371fc));return startTranscribe(_0x2ff877,_0x24d51a,_0x1521fd,uuidv4(),_0x35713d,_0x4b1121[_0xf83e('0x6f')]);})[_0xf83e('0x28')](function(_0x524157){logger[_0xf83e('0x62')](util[_0xf83e('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x2371fc,_0x524157['TranscriptionJob'][_0xf83e('0x74')]));_0xc0629b[_0xf83e('0x75')]=_0x524157[_0xf83e('0x76')][_0xf83e('0x74')];_0xc0629b['transcribeStatus']=_0x524157[_0xf83e('0x76')][_0xf83e('0x77')];return _0x3d417c(_0xc0629b);})['catch'](function(_0x59c7f0){return _0x18b01f(_0x59c7f0);});});}exports[_0xf83e('0x78')]=function(_0x100c8a,_0x8d6f02,_0x23b591){var _0x480b94;var _0x22f810;var _0x5e99fc;var _0xe9c66e=require(_0xf83e('0x4b'));return db[_0xf83e('0x2e')]['findOne']({'where':{'id':_0x100c8a[_0xf83e('0x46')]['id']}})[_0xf83e('0x28')](function(_0xd2bac9){if(_0xd2bac9){var _0x2980a0=util[_0xf83e('0x34')]('%s.cypher',_0xd2bac9['value']);if(fs[_0xf83e('0x4f')](_0x2980a0)){cypher=!![];return _0xe9c66e[_0xf83e('0x50')](_0x2980a0,_0xd2bac9[_0xf83e('0x4d')],config[_0xf83e('0x51')][_0xf83e('0x52')])[_0xf83e('0x28')](function(){return _0xd2bac9;});}return _0xd2bac9;}})[_0xf83e('0x28')](function(_0x3da6b9){if(!_0x3da6b9){throw new db[(_0xf83e('0x53'))][(_0xf83e('0x5f'))](_0xf83e('0x79'));}_0x22f810=_0x3da6b9;return db['Setting'][_0xf83e('0x7a')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x8d6f02,null))[_0xf83e('0x28')](function(_0x38982e){if(_0x38982e){_0x480b94=_0x38982e;if(!_0x480b94[_0xf83e('0x7b')]||!_0x480b94['transcribeAccountId']||!_0x480b94[_0xf83e('0x7c')]||!_0x480b94['language']||!_0x480b94['bucket']){throw new db[(_0xf83e('0x53'))][(_0xf83e('0x5f'))](_0xf83e('0x7d'));}if(_0x100c8a[_0xf83e('0x49')]['runSentiment']&&(!_0x480b94[_0xf83e('0x7e')]||!_0x480b94[_0xf83e('0x7f')]||!_0x480b94[_0xf83e('0x80')]||!_0x480b94[_0xf83e('0x81')]||!_0x480b94[_0xf83e('0x70')])){throw new db[(_0xf83e('0x53'))][(_0xf83e('0x5f'))](_0xf83e('0x82'));}return db[_0xf83e('0x83')][_0xf83e('0x7a')]({'where':{'id':_0x480b94[_0xf83e('0x84')]}});}})[_0xf83e('0x28')](function(_0x2845af){if(!_0x2845af){throw new db['Sequelize']['ValidationError'](_0xf83e('0x85'));}if(!_0x2845af['data1']||!_0x2845af[_0xf83e('0x86')]){throw new db[(_0xf83e('0x53'))][(_0xf83e('0x5f'))](_0xf83e('0x87'));}_0x5e99fc=_0x2845af;return getBucketslist(_0x5e99fc[_0xf83e('0x88')],_0x5e99fc[_0xf83e('0x86')],_0x480b94['transcribeRegion']);})[_0xf83e('0x28')](function(_0x4f64a9){if(_0x4f64a9&&_0x4f64a9[_0xf83e('0x89')]){var _0x3938e4=_[_0xf83e('0x48')](_0x4f64a9['Buckets'],function(_0x4ac82d){return _0x4ac82d['Name']===_0x480b94['bucket'];});if(!_0x3938e4){logger[_0xf83e('0x62')](util[_0xf83e('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x100c8a[_0xf83e('0x46')]['id'],_0x480b94[_0xf83e('0x70')]));return createBucket(_0x5e99fc[_0xf83e('0x88')],_0x5e99fc[_0xf83e('0x86')],_0x480b94[_0xf83e('0x7c')],_0x480b94[_0xf83e('0x70')]);}logger[_0xf83e('0x62')](util[_0xf83e('0x34')](_0xf83e('0x8a'),_0x100c8a['params']['id'],_0x480b94[_0xf83e('0x70')]));return;}})[_0xf83e('0x28')](function(_0x238072){if(_0x22f810[_0xf83e('0x8b')]===_0xf83e('0x8c')){return transcribe(_0x100c8a[_0xf83e('0x46')]['id'],_0x5e99fc['data1'],_0x5e99fc['data2'],_0x480b94[_0xf83e('0x7c')],_0x480b94[_0xf83e('0x70')],_0x22f810[_0xf83e('0x4d')],_0x480b94['language']);}else{logger[_0xf83e('0x62')](util[_0xf83e('0x34')](_0xf83e('0x8d'),_0x100c8a[_0xf83e('0x46')]['id']));return{'transcribeStatus':_0xf83e('0x8e')};}})[_0xf83e('0x28')](function(_0x1f1079){if(_0x1f1079){_0x1f1079[_0xf83e('0x8f')]=_0x100c8a[_0xf83e('0x49')][_0xf83e('0x90')];return _0x22f810[_0xf83e('0x91')](_0x1f1079);}})['then'](respondWithResult(_0x8d6f02,null))[_0xf83e('0x45')](handleError(_0x8d6f02,null));};function writeFile(_0x12f91d,_0xbd36a0){return new Promise(function(_0x1ce182,_0xe2b855){fs[_0xf83e('0x92')](_0xbd36a0,_0x12f91d,function(_0x559da3,_0x57fccd){if(_0x559da3){return _0xe2b855(_0x559da3);}else{return _0x1ce182(_0x57fccd);}});});}exports[_0xf83e('0x93')]=function(_0x319c68,_0x47233b,_0x1c84b7){return db[_0xf83e('0x2e')][_0xf83e('0x7a')]({'where':{'id':_0x319c68[_0xf83e('0x46')]['id']}})[_0xf83e('0x28')](handleEntityNotFound(_0x47233b))[_0xf83e('0x28')](function(_0x55ddd3){if(_0x55ddd3&&_0x55ddd3['fileText']){var _0x34d34b=_0x55ddd3[_0xf83e('0x94')];var _0x4b865e=config[_0xf83e('0x95')]+_0xf83e('0x96')+_0x55ddd3['id']+_0xf83e('0x97');if(fs['existsSync'](_0x4b865e)){return _0x4b865e;}return writeFile(_0x34d34b,_0x4b865e)[_0xf83e('0x28')](function(){return _0x4b865e;});}else{throw new db[(_0xf83e('0x53'))][(_0xf83e('0x5f'))](_0xf83e('0x98'));}})['then'](function(_0xadc805){return _0x47233b[_0xf83e('0x60')](_0xadc805);})['catch'](handleError(_0x47233b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 19f906a..ee29a57 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 _0xa44d=['../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','util','api','moment','bluebird','request-promise','path'];(function(_0x293ebd,_0x1ee736){var _0x1f73a3=function(_0x307dce){while(--_0x307dce){_0x293ebd['push'](_0x293ebd['shift']());}};_0x1f73a3(++_0x1ee736);}(_0xa44d,0xf6));var _0xda44=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0xa44d[_0x57645b];return _0xe82f00;};'use strict';var _=require('lodash');var util=require(_0xda44('0x0'));var logger=require('../../config/logger')(_0xda44('0x1'));var moment=require(_0xda44('0x2'));var BPromise=require(_0xda44('0x3'));var rp=require(_0xda44('0x4'));var fs=require('fs');var path=require(_0xda44('0x5'));var rimraf=require('rimraf');var config=require(_0xda44('0x6'));var attributes=require(_0xda44('0x7'));module[_0xda44('0x8')]=function(_0x358b7f,_0x81160a){return _0x358b7f[_0xda44('0x9')]('VoiceRecording',attributes,{'tableName':_0xda44('0xa'),'paranoid':![],'indexes':[{'name':_0xda44('0xb'),'fields':[_0xda44('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf93=['exports','define','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x39d18b,_0x497c48){var _0x3dbf1e=function(_0x2b7da1){while(--_0x2b7da1){_0x39d18b['push'](_0x39d18b['shift']());}};_0x3dbf1e(++_0x497c48);}(_0xdf93,0x13b));var _0x3df9=function(_0x170b88,_0x45e33e){_0x170b88=_0x170b88-0x0;var _0x5b0dbe=_0xdf93[_0x170b88];return _0x5b0dbe;};'use strict';var _=require(_0x3df9('0x0'));var util=require(_0x3df9('0x1'));var logger=require(_0x3df9('0x2'))('api');var moment=require(_0x3df9('0x3'));var BPromise=require(_0x3df9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3df9('0x5'));var rimraf=require(_0x3df9('0x6'));var config=require(_0x3df9('0x7'));var attributes=require(_0x3df9('0x8'));module[_0x3df9('0x9')]=function(_0x286688,_0x58632e){return _0x286688[_0x3df9('0xa')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x3df9('0xb'),'fields':[_0x3df9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 31e2ecc..db9246a 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 _0x81c6=['unlink','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','limit','../../components/encryptor','Setting','findOne','create','body','existsSync','value','%s.cypher','encryptFile','secrets'];(function(_0x5b73f6,_0x1e54ae){var _0x2c8edb=function(_0x5ae4c3){while(--_0x5ae4c3){_0x5b73f6['push'](_0x5b73f6['shift']());}};_0x2c8edb(++_0x1e54ae);}(_0x81c6,0x1d5));var _0x681c=function(_0x2b8388,_0x246b8f){_0x2b8388=_0x2b8388-0x0;var _0x3ba12a=_0x81c6[_0x2b8388];return _0x3ba12a;};'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')]('VoiceRecording,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('VoiceRecording,\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')](_0x42f506['body'],{'raw':_0x42f506[_0x681c('0x18')]?_0x42f506['options'][_0x681c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1a')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506['options']['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]||null:null})[_0x681c('0x9')](function(_0x27b8a0){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger[_0x681c('0xb')](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x27b8a0));_0x42304f(_0x27b8a0);})[_0x681c('0x14')](function(_0x2be552){logger[_0x681c('0x10')](_0x681c('0x15'),_0x2be552[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192[_0x681c('0x10')](0x1f4,_0x2be552[_0x681c('0x11')]));});});};exports['CreateVoiceRecording']=function(_0x11063b){var _0x5705a7=this;return new Promise(function(_0x5f8d64,_0x4bf08e){var _0x583499=require(_0x681c('0x1c'));var _0x17ea7c;return db[_0x681c('0x1d')][_0x681c('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x681c('0x9')](function(_0x39fca3){_0x17ea7c=_0x39fca3;return db[_0x681c('0x16')][_0x681c('0x1f')](_0x11063b[_0x681c('0x20')]);})[_0x681c('0x9')](function(_0x2c619f){if(_0x17ea7c['callRecordingEncryption']&&fs[_0x681c('0x21')](_0x2c619f[_0x681c('0x22')])){var _0x2e783d=util['format'](_0x681c('0x23'),_0x2c619f[_0x681c('0x22')]);return _0x583499[_0x681c('0x24')](_0x2c619f['value'],_0x2e783d,config[_0x681c('0x25')]['recording'])['then'](function(){fs[_0x681c('0x26')](_0x2c619f[_0x681c('0x22')]);logger[_0x681c('0x12')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2c619f;});}return _0x2c619f;})[_0x681c('0x9')](function(_0x508fb9){logger[_0x681c('0x12')]('CreateVoiceRecording',_0x11063b);logger['debug']('CreateVoiceRecording',_0x11063b,JSON[_0x681c('0xe')](_0x508fb9));_0x5f8d64(_0x508fb9);})[_0x681c('0x14')](function(_0x5a349a){logger[_0x681c('0x10')]('CreateVoiceRecording',_0x5a349a['message'],_0x11063b);_0x4bf08e(_0x5705a7[_0x681c('0x10')](0x1f4,_0x5a349a['message']));});});}; \ No newline at end of file +var _0xacf4=['limit','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes'];(function(_0xe9dbe9,_0x14b58a){var _0x4b9ebd=function(_0x3d045e){while(--_0x3d045e){_0xe9dbe9['push'](_0xe9dbe9['shift']());}};_0x4b9ebd(++_0x14b58a);}(_0xacf4,0xe7));var _0x4acf=function(_0x545cc1,_0x149880){_0x545cc1=_0x545cc1-0x0;var _0xfdf00f=_0xacf4[_0x545cc1];return _0xfdf00f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});}exports[_0x4acf('0x13')]=function(_0x240c00){var _0x4b1d93=this;return new Promise(function(_0x2a678b,_0x137302){return db[_0x4acf('0x14')][_0x4acf('0x15')](_0x240c00[_0x4acf('0x16')],{'raw':_0x240c00[_0x4acf('0x17')]?_0x240c00[_0x4acf('0x17')][_0x4acf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240c00[_0x4acf('0x17')]?_0x240c00[_0x4acf('0x17')][_0x4acf('0x19')]||null:null,'attributes':_0x240c00['options']?_0x240c00[_0x4acf('0x17')][_0x4acf('0x1a')]||null:null,'limit':_0x240c00['options']?_0x240c00[_0x4acf('0x17')][_0x4acf('0x1b')]||null:null})['then'](function(_0x3b26ac){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1c')]('UpdateVoiceRecording',_0x240c00,JSON[_0x4acf('0x1d')](_0x3b26ac));_0x2a678b(_0x3b26ac);})[_0x4acf('0x12')](function(_0x57e595){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57e595['message'],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57e595[_0x4acf('0x10')]));});});};exports[_0x4acf('0x1e')]=function(_0x16458f){var _0x571a30=this;return new Promise(function(_0x50236d,_0x17a756){var _0x3f548a=require(_0x4acf('0x1f'));var _0x42c90c;return db[_0x4acf('0x20')][_0x4acf('0x21')]({'attributes':['id',_0x4acf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x4acf('0xa')](function(_0x382c41){_0x42c90c=_0x382c41;return db[_0x4acf('0x14')]['create'](_0x16458f[_0x4acf('0x16')]);})[_0x4acf('0xa')](function(_0xd027c7){if(_0x42c90c[_0x4acf('0x22')]&&fs[_0x4acf('0x23')](_0xd027c7[_0x4acf('0x24')])){var _0x27384c=util['format'](_0x4acf('0x25'),_0xd027c7[_0x4acf('0x24')]);return _0x3f548a[_0x4acf('0x26')](_0xd027c7['value'],_0x27384c,config[_0x4acf('0x27')][_0x4acf('0x28')])[_0x4acf('0xa')](function(){fs[_0x4acf('0x29')](_0xd027c7['value']);logger[_0x4acf('0xb')](_0x4acf('0x2a'));return _0xd027c7;});}return _0xd027c7;})[_0x4acf('0xa')](function(_0x5e2332){logger[_0x4acf('0xb')](_0x4acf('0x1e'),_0x16458f);logger[_0x4acf('0x1c')](_0x4acf('0x1e'),_0x16458f,JSON[_0x4acf('0x1d')](_0x5e2332));_0x50236d(_0x5e2332);})[_0x4acf('0x12')](function(_0x490880){logger[_0x4acf('0xf')](_0x4acf('0x1e'),_0x490880['message'],_0x16458f);_0x17a756(_0x571a30[_0x4acf('0xf')](0x1f4,_0x490880['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 864fd57..a857e4f 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 _0x26b9=['/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26b9,0xef));var _0x926b=function(_0x58eb93,_0x3b8263){_0x58eb93=_0x58eb93-0x0;var _0xc0d5c0=_0x26b9[_0x58eb93];return _0xc0d5c0;};'use strict';var multer=require(_0x926b('0x0'));var util=require(_0x926b('0x1'));var path=require('path');var timeout=require(_0x926b('0x2'));var express=require(_0x926b('0x3'));var router=express[_0x926b('0x4')]();var fs_extra=require(_0x926b('0x5'));var auth=require(_0x926b('0x6'));var interaction=require(_0x926b('0x7'));var config=require(_0x926b('0x8'));var controller=require(_0x926b('0x9'));router[_0x926b('0xa')]('/',auth[_0x926b('0xb')](),controller[_0x926b('0xc')]);router[_0x926b('0xa')]('/describe',auth[_0x926b('0xb')](),controller['describe']);router[_0x926b('0xa')](_0x926b('0xd'),auth['isAuthenticated'](),controller[_0x926b('0xe')]);router[_0x926b('0xf')]('/',auth['isAuthenticated'](),controller[_0x926b('0x10')]);router[_0x926b('0x11')](_0x926b('0xd'),auth[_0x926b('0xb')](),controller[_0x926b('0x12')]);router['delete']('/:id',auth[_0x926b('0xb')](),controller[_0x926b('0x13')]);module[_0x926b('0x14')]=router; \ No newline at end of file +var _0x5277=['post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x500908,_0x260722){var _0x44a3b2=function(_0x42c0ee){while(--_0x42c0ee){_0x500908['push'](_0x500908['shift']());}};_0x44a3b2(++_0x260722);}(_0x5277,0x16e));var _0x7527=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5277[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7527('0x0'));var util=require(_0x7527('0x1'));var path=require(_0x7527('0x2'));var timeout=require(_0x7527('0x3'));var express=require(_0x7527('0x4'));var router=express[_0x7527('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7527('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7527('0x7'));router[_0x7527('0x8')]('/',auth[_0x7527('0x9')](),controller[_0x7527('0xa')]);router[_0x7527('0x8')](_0x7527('0xb'),auth[_0x7527('0x9')](),controller[_0x7527('0xc')]);router[_0x7527('0x8')](_0x7527('0xd'),auth[_0x7527('0x9')](),controller['show']);router[_0x7527('0xe')]('/',auth[_0x7527('0x9')](),controller[_0x7527('0xf')]);router['put'](_0x7527('0xd'),auth[_0x7527('0x9')](),controller[_0x7527('0x10')]);router[_0x7527('0x11')](_0x7527('0xd'),auth[_0x7527('0x9')](),controller['destroy']);module[_0x7527('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 39782d7..5e4fa35 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 _0xacf3=['STRING','exports','ENUM','blind'];(function(_0x21c9ae,_0x5ba2da){var _0x10d87b=function(_0x377c3c){while(--_0x377c3c){_0x21c9ae['push'](_0x21c9ae['shift']());}};_0x10d87b(++_0x5ba2da);}(_0xacf3,0x115));var _0x3acf=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xacf3[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3acf('0x0')]={'type':{'type':Sequelize[_0x3acf('0x1')](_0x3acf('0x2'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x3acf('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x3acf('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x3acf('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x3acf('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x3acf('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x3acf('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x3acf('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3acf('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x3acf('0x3')]},'transfereecontext':{'type':Sequelize[_0x3acf('0x3')]},'transfereeexten':{'type':Sequelize[_0x3acf('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x3acf('0x3')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3acf('0x3')]}}; \ No newline at end of file +var _0x4fbd=['attended','STRING','sequelize','exports','ENUM','blind'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x4fbd,0x1dc));var _0xd4fb=function(_0x29d20b,_0x4a8539){_0x29d20b=_0x29d20b-0x0;var _0x58f6d6=_0x4fbd[_0x29d20b];return _0x58f6d6;};'use strict';var Sequelize=require(_0xd4fb('0x0'));var moment=require('moment');module[_0xd4fb('0x1')]={'type':{'type':Sequelize[_0xd4fb('0x2')](_0xd4fb('0x3'),_0xd4fb('0x4'))},'result':{'type':Sequelize[_0xd4fb('0x5')]},'transfererchannel':{'type':Sequelize[_0xd4fb('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xd4fb('0x5')]},'transferercalleridname':{'type':Sequelize[_0xd4fb('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd4fb('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xd4fb('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xd4fb('0x5')]},'transfererexten':{'type':Sequelize[_0xd4fb('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xd4fb('0x5')]},'transfereechannel':{'type':Sequelize[_0xd4fb('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xd4fb('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xd4fb('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd4fb('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xd4fb('0x5')]},'transfereecontext':{'type':Sequelize[_0xd4fb('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xd4fb('0x5')]},'isexternal':{'type':Sequelize[_0xd4fb('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xd4fb('0x5')]},'extension':{'type':Sequelize[_0xd4fb('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 03346be..0d436a7 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 _0x8dd0=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x574cfa,_0x4cd608){var _0x4d3ac5=function(_0x1a9198){while(--_0x1a9198){_0x574cfa['push'](_0x574cfa['shift']());}};_0x4d3ac5(++_0x4cd608);}(_0x8dd0,0x16d));var _0x08dd=function(_0x49c9eb,_0x25b227){_0x49c9eb=_0x49c9eb-0x0;var _0x29374c=_0x8dd0[_0x49c9eb];return _0x29374c;};'use strict';var emlformat=require(_0x08dd('0x0'));var rimraf=require(_0x08dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08dd('0x2'));var rp=require(_0x08dd('0x3'));var moment=require(_0x08dd('0x4'));var BPromise=require(_0x08dd('0x5'));var Mustache=require(_0x08dd('0x6'));var util=require(_0x08dd('0x7'));var path=require(_0x08dd('0x8'));var sox=require(_0x08dd('0x9'));var csv=require('to-csv');var ejs=require(_0x08dd('0xa'));var fs=require('fs');var fs_extra=require(_0x08dd('0xb'));var _=require(_0x08dd('0xc'));var squel=require('squel');var crypto=require(_0x08dd('0xd'));var jsforce=require(_0x08dd('0xe'));var deskjs=require(_0x08dd('0xf'));var toCsv=require(_0x08dd('0x10'));var querystring=require(_0x08dd('0x11'));var Papa=require('papaparse');var Redis=require(_0x08dd('0x12'));var authService=require(_0x08dd('0x13'));var qs=require(_0x08dd('0x14'));var as=require(_0x08dd('0x15'));var hardwareService=require(_0x08dd('0x16'));var logger=require(_0x08dd('0x17'))(_0x08dd('0x18'));var utils=require(_0x08dd('0x19'));var config=require(_0x08dd('0x1a'));var licenseUtil=require(_0x08dd('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2227bb,_0x29ea8d){_0x29ea8d=_0x29ea8d||0xcc;return function(_0x2b2e76){if(_0x2b2e76){return _0x2227bb[_0x08dd('0x1c')](_0x29ea8d);}return _0x2227bb[_0x08dd('0x1d')](_0x29ea8d)[_0x08dd('0x1e')]();};}function respondWithResult(_0x3526c6,_0xff09e){_0xff09e=_0xff09e||0xc8;return function(_0x1f3657){if(_0x1f3657){return _0x3526c6[_0x08dd('0x1d')](_0xff09e)[_0x08dd('0x1f')](_0x1f3657);}};}function respondWithFilteredResult(_0x330d20,_0x5a5352){return function(_0x42b5c6){if(_0x42b5c6){var _0x3e4e7d=typeof _0x5a5352[_0x08dd('0x20')]===_0x08dd('0x21')&&typeof _0x5a5352[_0x08dd('0x22')]==='undefined';var _0xf0bbd5=_0x42b5c6[_0x08dd('0x23')];var _0x1f4ee9=_0x3e4e7d?0x0:_0x5a5352['offset'];var _0x46a127=_0x3e4e7d?_0x42b5c6[_0x08dd('0x23')]:_0x5a5352[_0x08dd('0x20')]+_0x5a5352[_0x08dd('0x22')];var _0x344313;if(_0x46a127>=_0xf0bbd5){_0x46a127=_0xf0bbd5;_0x344313=0xc8;}else{_0x344313=0xce;}_0x330d20['status'](_0x344313);return _0x330d20[_0x08dd('0x24')]('Content-Range',_0x1f4ee9+'-'+_0x46a127+'/'+_0xf0bbd5)[_0x08dd('0x1f')](_0x42b5c6);}return null;};}function patchUpdates(_0x3bef06){return function(_0x5e13fc){try{jsonpatch['apply'](_0x5e13fc,_0x3bef06,!![]);}catch(_0x3b0d63){return BPromise['reject'](_0x3b0d63);}return _0x5e13fc['save']();};}function saveUpdates(_0x51524d,_0x22d36d){return function(_0x1029cd){if(_0x1029cd){return _0x1029cd[_0x08dd('0x25')](_0x51524d)['then'](function(_0x233461){return _0x233461;});}return null;};}function removeEntity(_0x4b9e28,_0x21301c){return function(_0x357b7f){if(_0x357b7f){return _0x357b7f[_0x08dd('0x26')]()[_0x08dd('0x27')](function(){_0x4b9e28['status'](0xcc)[_0x08dd('0x1e')]();});}};}function handleEntityNotFound(_0x20f0cf,_0x2f15bc){return function(_0x285e64){if(!_0x285e64){_0x20f0cf[_0x08dd('0x1c')](0x194);}return _0x285e64;};}function handleError(_0xa362bc,_0x248554){_0x248554=_0x248554||0x1f4;return function(_0x2b1c58){logger[_0x08dd('0x28')](_0x2b1c58['stack']);if(_0x2b1c58[_0x08dd('0x29')]){delete _0x2b1c58[_0x08dd('0x29')];}_0xa362bc[_0x08dd('0x1d')](_0x248554)[_0x08dd('0x2a')](_0x2b1c58);};}exports[_0x08dd('0x2b')]=function(_0x3ca377,_0x7882ab){var _0x5c3788={},_0x4ba756={},_0x5f05fc={'count':0x0,'rows':[]};var _0x1313cf=_[_0x08dd('0x2c')](db[_0x08dd('0x2d')][_0x08dd('0x2e')],function(_0x1aad1f){return{'name':_0x1aad1f[_0x08dd('0x2f')],'type':_0x1aad1f['type']['key']};});_0x4ba756[_0x08dd('0x30')]=_['map'](_0x1313cf,_0x08dd('0x29'));_0x4ba756[_0x08dd('0x31')]=_[_0x08dd('0x32')](_0x3ca377[_0x08dd('0x31')]);_0x4ba756[_0x08dd('0x33')]=_[_0x08dd('0x34')](_0x4ba756[_0x08dd('0x30')],_0x4ba756[_0x08dd('0x31')]);_0x5c3788[_0x08dd('0x35')]=_[_0x08dd('0x34')](_0x4ba756[_0x08dd('0x30')],qs[_0x08dd('0x36')](_0x3ca377[_0x08dd('0x31')]['fields']));_0x5c3788[_0x08dd('0x35')]=_0x5c3788[_0x08dd('0x35')][_0x08dd('0x37')]?_0x5c3788[_0x08dd('0x35')]:_0x4ba756['model'];if(!_0x3ca377[_0x08dd('0x31')][_0x08dd('0x38')](_0x08dd('0x39'))){_0x5c3788['limit']=qs[_0x08dd('0x22')](_0x3ca377[_0x08dd('0x31')][_0x08dd('0x22')]);_0x5c3788[_0x08dd('0x20')]=qs['offset'](_0x3ca377['query'][_0x08dd('0x20')]);}_0x5c3788[_0x08dd('0x3a')]=qs[_0x08dd('0x3b')](_0x3ca377['query'][_0x08dd('0x3b')]);_0x5c3788[_0x08dd('0x3c')]=qs[_0x08dd('0x33')](_[_0x08dd('0x3d')](_0x3ca377[_0x08dd('0x31')],_0x4ba756['filters']),_0x1313cf);if(_0x3ca377[_0x08dd('0x31')][_0x08dd('0x3e')]){_0x5c3788[_0x08dd('0x3c')]=_[_0x08dd('0x3f')](_0x5c3788[_0x08dd('0x3c')],{'$or':_[_0x08dd('0x2c')](_0x1313cf,function(_0xb71961){if(_0xb71961[_0x08dd('0x40')]!==_0x08dd('0x41')){var _0xc800f4={};_0xc800f4[_0xb71961['name']]={'$like':'%'+_0x3ca377[_0x08dd('0x31')][_0x08dd('0x3e')]+'%'};return _0xc800f4;}})});}_0x5c3788=_['merge']({},_0x5c3788,_0x3ca377['options']);var _0x1c02e7={'where':_0x5c3788['where']};return db[_0x08dd('0x2d')][_0x08dd('0x23')](_0x1c02e7)[_0x08dd('0x27')](function(_0x2ac440){_0x5f05fc[_0x08dd('0x23')]=_0x2ac440;if(_0x3ca377[_0x08dd('0x31')][_0x08dd('0x42')]){_0x5c3788[_0x08dd('0x43')]=[{'all':!![]}];}return db[_0x08dd('0x2d')][_0x08dd('0x44')](_0x5c3788);})[_0x08dd('0x27')](function(_0x401e4b){_0x5f05fc[_0x08dd('0x45')]=_0x401e4b;return _0x5f05fc;})[_0x08dd('0x27')](respondWithFilteredResult(_0x7882ab,_0x5c3788))[_0x08dd('0x46')](handleError(_0x7882ab,null));};exports[_0x08dd('0x47')]=function(_0x3b0acf,_0x137bbf){var _0x9fba89={'raw':!![],'where':{'id':_0x3b0acf[_0x08dd('0x48')]['id']}},_0x26f60f={};_0x26f60f[_0x08dd('0x30')]=_[_0x08dd('0x32')](db[_0x08dd('0x2d')]['rawAttributes']);_0x26f60f[_0x08dd('0x31')]=_[_0x08dd('0x32')](_0x3b0acf[_0x08dd('0x31')]);_0x26f60f[_0x08dd('0x33')]=_[_0x08dd('0x34')](_0x26f60f['model'],_0x26f60f[_0x08dd('0x31')]);_0x9fba89['attributes']=_[_0x08dd('0x34')](_0x26f60f['model'],qs[_0x08dd('0x36')](_0x3b0acf[_0x08dd('0x31')][_0x08dd('0x36')]));_0x9fba89['attributes']=_0x9fba89[_0x08dd('0x35')][_0x08dd('0x37')]?_0x9fba89['attributes']:_0x26f60f[_0x08dd('0x30')];if(_0x3b0acf[_0x08dd('0x31')]['includeAll']){_0x9fba89[_0x08dd('0x43')]=[{'all':!![]}];}_0x9fba89=_[_0x08dd('0x3f')]({},_0x9fba89,_0x3b0acf['options']);return db[_0x08dd('0x2d')]['find'](_0x9fba89)[_0x08dd('0x27')](handleEntityNotFound(_0x137bbf,null))[_0x08dd('0x27')](respondWithResult(_0x137bbf,null))[_0x08dd('0x46')](handleError(_0x137bbf,null));};exports['create']=function(_0x305ff6,_0x301e3c){return db[_0x08dd('0x2d')]['create'](_0x305ff6[_0x08dd('0x49')],{})['then'](respondWithResult(_0x301e3c,0xc9))[_0x08dd('0x46')](handleError(_0x301e3c,null));};exports['update']=function(_0x3922f3,_0x5a38d3){if(_0x3922f3['body']['id']){delete _0x3922f3[_0x08dd('0x49')]['id'];}return db['VoiceTransferReport'][_0x08dd('0x4a')]({'where':{'id':_0x3922f3[_0x08dd('0x48')]['id']}})[_0x08dd('0x27')](handleEntityNotFound(_0x5a38d3,null))['then'](saveUpdates(_0x3922f3[_0x08dd('0x49')],null))[_0x08dd('0x27')](respondWithResult(_0x5a38d3,null))['catch'](handleError(_0x5a38d3,null));};exports[_0x08dd('0x26')]=function(_0x24184b,_0x15c8e9){return db[_0x08dd('0x2d')][_0x08dd('0x4a')]({'where':{'id':_0x24184b['params']['id']}})['then'](handleEntityNotFound(_0x15c8e9,null))[_0x08dd('0x27')](removeEntity(_0x15c8e9,null))[_0x08dd('0x46')](handleError(_0x15c8e9,null));};exports['describe']=function(_0xecf668,_0x4a6f29){return db[_0x08dd('0x2d')][_0x08dd('0x4b')]()[_0x08dd('0x27')](respondWithResult(_0x4a6f29,null))['catch'](handleError(_0x4a6f29,null));}; \ No newline at end of file +var _0x55c3=['map','VoiceTransferReport','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','stack','name','send','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x55c3,0x1c5));var _0x355c=function(_0x566fb7,_0x3286bd){_0x566fb7=_0x566fb7-0x0;var _0x28fd20=_0x55c3[_0x566fb7];return _0x28fd20;};'use strict';var emlformat=require(_0x355c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x355c('0x1'));var jsonpatch=require(_0x355c('0x2'));var rp=require(_0x355c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x355c('0x4'));var util=require(_0x355c('0x5'));var path=require(_0x355c('0x6'));var sox=require(_0x355c('0x7'));var csv=require(_0x355c('0x8'));var ejs=require(_0x355c('0x9'));var fs=require('fs');var fs_extra=require(_0x355c('0xa'));var _=require(_0x355c('0xb'));var squel=require(_0x355c('0xc'));var crypto=require(_0x355c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x355c('0xe'));var toCsv=require(_0x355c('0x8'));var querystring=require('querystring');var Papa=require(_0x355c('0xf'));var Redis=require('ioredis');var authService=require(_0x355c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x355c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x355c('0x12'));var utils=require(_0x355c('0x13'));var config=require(_0x355c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdfb3,_0xd05816){_0xd05816=_0xd05816||0xcc;return function(_0x3067a9){if(_0x3067a9){return _0x3fdfb3[_0x355c('0x15')](_0xd05816);}return _0x3fdfb3[_0x355c('0x16')](_0xd05816)[_0x355c('0x17')]();};}function respondWithResult(_0x4b688c,_0x444c8c){_0x444c8c=_0x444c8c||0xc8;return function(_0x5ec1c1){if(_0x5ec1c1){return _0x4b688c[_0x355c('0x16')](_0x444c8c)['json'](_0x5ec1c1);}};}function respondWithFilteredResult(_0x20ca23,_0x483bed){return function(_0x1d2767){if(_0x1d2767){var _0xbc21bc=typeof _0x483bed[_0x355c('0x18')]===_0x355c('0x19')&&typeof _0x483bed[_0x355c('0x1a')]==='undefined';var _0xb05938=_0x1d2767[_0x355c('0x1b')];var _0x1897d0=_0xbc21bc?0x0:_0x483bed[_0x355c('0x18')];var _0x40dd1a=_0xbc21bc?_0x1d2767[_0x355c('0x1b')]:_0x483bed['offset']+_0x483bed[_0x355c('0x1a')];var _0x104749;if(_0x40dd1a>=_0xb05938){_0x40dd1a=_0xb05938;_0x104749=0xc8;}else{_0x104749=0xce;}_0x20ca23[_0x355c('0x16')](_0x104749);return _0x20ca23[_0x355c('0x1c')](_0x355c('0x1d'),_0x1897d0+'-'+_0x40dd1a+'/'+_0xb05938)['json'](_0x1d2767);}return null;};}function patchUpdates(_0x5b8ddc){return function(_0x3bec1c){try{jsonpatch[_0x355c('0x1e')](_0x3bec1c,_0x5b8ddc,!![]);}catch(_0xd93937){return BPromise['reject'](_0xd93937);}return _0x3bec1c[_0x355c('0x1f')]();};}function saveUpdates(_0x4f4c3e,_0x332128){return function(_0x3787b6){if(_0x3787b6){return _0x3787b6['update'](_0x4f4c3e)[_0x355c('0x20')](function(_0x57cf4d){return _0x57cf4d;});}return null;};}function removeEntity(_0x12de33,_0x598768){return function(_0x22b4ff){if(_0x22b4ff){return _0x22b4ff['destroy']()[_0x355c('0x20')](function(){_0x12de33[_0x355c('0x16')](0xcc)[_0x355c('0x17')]();});}};}function handleEntityNotFound(_0x19fb34,_0x1ea822){return function(_0x3b98f6){if(!_0x3b98f6){_0x19fb34[_0x355c('0x15')](0x194);}return _0x3b98f6;};}function handleError(_0x379f04,_0x4f464f){_0x4f464f=_0x4f464f||0x1f4;return function(_0x21c9ec){logger['error'](_0x21c9ec[_0x355c('0x21')]);if(_0x21c9ec['name']){delete _0x21c9ec[_0x355c('0x22')];}_0x379f04[_0x355c('0x16')](_0x4f464f)[_0x355c('0x23')](_0x21c9ec);};}exports[_0x355c('0x24')]=function(_0x3f3414,_0x2e8705){var _0x35769e={},_0x2fa8d9={},_0x6673b4={'count':0x0,'rows':[]};var _0x25491a=_[_0x355c('0x25')](db[_0x355c('0x26')]['rawAttributes'],function(_0x59ed37){return{'name':_0x59ed37[_0x355c('0x27')],'type':_0x59ed37[_0x355c('0x28')][_0x355c('0x29')]};});_0x2fa8d9['model']=_[_0x355c('0x25')](_0x25491a,_0x355c('0x22'));_0x2fa8d9[_0x355c('0x2a')]=_[_0x355c('0x2b')](_0x3f3414[_0x355c('0x2a')]);_0x2fa8d9[_0x355c('0x2c')]=_['intersection'](_0x2fa8d9[_0x355c('0x2d')],_0x2fa8d9[_0x355c('0x2a')]);_0x35769e['attributes']=_[_0x355c('0x2e')](_0x2fa8d9[_0x355c('0x2d')],qs[_0x355c('0x2f')](_0x3f3414['query'][_0x355c('0x2f')]));_0x35769e[_0x355c('0x30')]=_0x35769e[_0x355c('0x30')][_0x355c('0x31')]?_0x35769e[_0x355c('0x30')]:_0x2fa8d9[_0x355c('0x2d')];if(!_0x3f3414['query']['hasOwnProperty'](_0x355c('0x32'))){_0x35769e[_0x355c('0x1a')]=qs[_0x355c('0x1a')](_0x3f3414[_0x355c('0x2a')]['limit']);_0x35769e[_0x355c('0x18')]=qs[_0x355c('0x18')](_0x3f3414[_0x355c('0x2a')][_0x355c('0x18')]);}_0x35769e['order']=qs[_0x355c('0x33')](_0x3f3414[_0x355c('0x2a')][_0x355c('0x33')]);_0x35769e[_0x355c('0x34')]=qs['filters'](_[_0x355c('0x35')](_0x3f3414[_0x355c('0x2a')],_0x2fa8d9[_0x355c('0x2c')]),_0x25491a);if(_0x3f3414[_0x355c('0x2a')]['filter']){_0x35769e[_0x355c('0x34')]=_['merge'](_0x35769e[_0x355c('0x34')],{'$or':_['map'](_0x25491a,function(_0x2e8138){if(_0x2e8138[_0x355c('0x28')]!==_0x355c('0x36')){var _0x41fec7={};_0x41fec7[_0x2e8138['name']]={'$like':'%'+_0x3f3414[_0x355c('0x2a')][_0x355c('0x37')]+'%'};return _0x41fec7;}})});}_0x35769e=_[_0x355c('0x38')]({},_0x35769e,_0x3f3414[_0x355c('0x39')]);var _0x202b93={'where':_0x35769e[_0x355c('0x34')]};return db[_0x355c('0x26')][_0x355c('0x1b')](_0x202b93)[_0x355c('0x20')](function(_0x45ef94){_0x6673b4[_0x355c('0x1b')]=_0x45ef94;if(_0x3f3414[_0x355c('0x2a')][_0x355c('0x3a')]){_0x35769e['include']=[{'all':!![]}];}return db[_0x355c('0x26')][_0x355c('0x3b')](_0x35769e);})[_0x355c('0x20')](function(_0x342ba5){_0x6673b4[_0x355c('0x3c')]=_0x342ba5;return _0x6673b4;})[_0x355c('0x20')](respondWithFilteredResult(_0x2e8705,_0x35769e))[_0x355c('0x3d')](handleError(_0x2e8705,null));};exports['show']=function(_0x2b62ea,_0x42759f){var _0x454c88={'raw':!![],'where':{'id':_0x2b62ea[_0x355c('0x3e')]['id']}},_0xd19c32={};_0xd19c32[_0x355c('0x2d')]=_['keys'](db[_0x355c('0x26')][_0x355c('0x3f')]);_0xd19c32[_0x355c('0x2a')]=_[_0x355c('0x2b')](_0x2b62ea[_0x355c('0x2a')]);_0xd19c32['filters']=_[_0x355c('0x2e')](_0xd19c32[_0x355c('0x2d')],_0xd19c32['query']);_0x454c88[_0x355c('0x30')]=_[_0x355c('0x2e')](_0xd19c32[_0x355c('0x2d')],qs[_0x355c('0x2f')](_0x2b62ea[_0x355c('0x2a')][_0x355c('0x2f')]));_0x454c88[_0x355c('0x30')]=_0x454c88['attributes'][_0x355c('0x31')]?_0x454c88[_0x355c('0x30')]:_0xd19c32[_0x355c('0x2d')];if(_0x2b62ea[_0x355c('0x2a')]['includeAll']){_0x454c88[_0x355c('0x40')]=[{'all':!![]}];}_0x454c88=_['merge']({},_0x454c88,_0x2b62ea[_0x355c('0x39')]);return db[_0x355c('0x26')][_0x355c('0x41')](_0x454c88)[_0x355c('0x20')](handleEntityNotFound(_0x42759f,null))[_0x355c('0x20')](respondWithResult(_0x42759f,null))[_0x355c('0x3d')](handleError(_0x42759f,null));};exports[_0x355c('0x42')]=function(_0x20865d,_0x3c3016){return db[_0x355c('0x26')]['create'](_0x20865d[_0x355c('0x43')],{})[_0x355c('0x20')](respondWithResult(_0x3c3016,0xc9))[_0x355c('0x3d')](handleError(_0x3c3016,null));};exports['update']=function(_0x5217fd,_0x723319){if(_0x5217fd[_0x355c('0x43')]['id']){delete _0x5217fd[_0x355c('0x43')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x5217fd[_0x355c('0x3e')]['id']}})[_0x355c('0x20')](handleEntityNotFound(_0x723319,null))[_0x355c('0x20')](saveUpdates(_0x5217fd[_0x355c('0x43')],null))[_0x355c('0x20')](respondWithResult(_0x723319,null))['catch'](handleError(_0x723319,null));};exports[_0x355c('0x44')]=function(_0x2d009a,_0x5d0924){return db[_0x355c('0x26')][_0x355c('0x41')]({'where':{'id':_0x2d009a[_0x355c('0x3e')]['id']}})[_0x355c('0x20')](handleEntityNotFound(_0x5d0924,null))[_0x355c('0x20')](removeEntity(_0x5d0924,null))[_0x355c('0x3d')](handleError(_0x5d0924,null));};exports[_0x355c('0x45')]=function(_0xdb54fd,_0x5782d3){return db[_0x355c('0x26')][_0x355c('0x45')]()[_0x355c('0x20')](respondWithResult(_0x5782d3,null))[_0x355c('0x3d')](handleError(_0x5782d3,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 32670b2..2ec3295 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 _0x4a16=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x419300,_0x4d16fb){var _0x417d69=function(_0x3bd24b){while(--_0x3bd24b){_0x419300['push'](_0x419300['shift']());}};_0x417d69(++_0x4d16fb);}(_0x4a16,0x83));var _0x64a1=function(_0x5aecc8,_0x5cf8b8){_0x5aecc8=_0x5aecc8-0x0;var _0x502a7b=_0x4a16[_0x5aecc8];return _0x502a7b;};'use strict';var _=require(_0x64a1('0x0'));var util=require(_0x64a1('0x1'));var logger=require(_0x64a1('0x2'))(_0x64a1('0x3'));var moment=require(_0x64a1('0x4'));var BPromise=require(_0x64a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64a1('0x6'));var rimraf=require(_0x64a1('0x7'));var config=require(_0x64a1('0x8'));var attributes=require(_0x64a1('0x9'));module[_0x64a1('0xa')]=function(_0x33448c,_0x516f9e){return _0x33448c[_0x64a1('0xb')](_0x64a1('0xc'),attributes,{'tableName':_0x64a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd80e=['VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x1bca02,_0x4bce25){var _0x2fc8a1=function(_0x4a4ff8){while(--_0x4a4ff8){_0x1bca02['push'](_0x1bca02['shift']());}};_0x2fc8a1(++_0x4bce25);}(_0xd80e,0x1e2));var _0xed80=function(_0xda745f,_0x1413ac){_0xda745f=_0xda745f-0x0;var _0x232f11=_0xd80e[_0xda745f];return _0x232f11;};'use strict';var _=require(_0xed80('0x0'));var util=require(_0xed80('0x1'));var logger=require(_0xed80('0x2'))(_0xed80('0x3'));var moment=require(_0xed80('0x4'));var BPromise=require('bluebird');var rp=require(_0xed80('0x5'));var fs=require('fs');var path=require(_0xed80('0x6'));var rimraf=require(_0xed80('0x7'));var config=require(_0xed80('0x8'));var attributes=require(_0xed80('0x9'));module[_0xed80('0xa')]=function(_0x12a06c,_0x326e62){return _0x12a06c[_0xed80('0xb')](_0xed80('0xc'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 0e8a16a..1e16701 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 _0x1442=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1442,0xdd));var _0x2144=function(_0x42ad3f,_0x5a0e71){_0x42ad3f=_0x42ad3f-0x0;var _0x4db857=_0x1442[_0x42ad3f];return _0x4db857;};'use strict';var _=require(_0x2144('0x0'));var util=require(_0x2144('0x1'));var moment=require(_0x2144('0x2'));var BPromise=require('bluebird');var rs=require(_0x2144('0x3'));var fs=require('fs');var Redis=require(_0x2144('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2144('0x5'));var logger=require(_0x2144('0x6'))('rpc');var config=require(_0x2144('0x7'));var jayson=require(_0x2144('0x8'));var client=jayson[_0x2144('0x9')][_0x2144('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a981c,_0x1f9b90,_0xd5b994){return new BPromise(function(_0x15406b,_0x2d32e4){return client[_0x2144('0xb')](_0x3a981c,_0xd5b994)['then'](function(_0x15a7d6){logger[_0x2144('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x1f9b90,'request\x20sent');logger['debug'](_0x2144('0xd'),_0x1f9b90,'request\x20sent',JSON[_0x2144('0xe')](_0x15a7d6));if(_0x15a7d6[_0x2144('0xf')]){if(_0x15a7d6[_0x2144('0xf')][_0x2144('0x10')]===0x1f4){logger[_0x2144('0xf')](_0x2144('0x11'),_0x1f9b90,_0x15a7d6[_0x2144('0xf')][_0x2144('0x12')]);return _0x2d32e4(_0x15a7d6[_0x2144('0xf')][_0x2144('0x12')]);}logger[_0x2144('0xf')](_0x2144('0x11'),_0x1f9b90,_0x15a7d6['error'][_0x2144('0x12')]);return _0x15406b(_0x15a7d6[_0x2144('0xf')][_0x2144('0x12')]);}else{logger['info'](_0x2144('0x11'),_0x1f9b90,_0x2144('0x13'));_0x15406b(_0x15a7d6['result'][_0x2144('0x12')]);}})[_0x2144('0x14')](function(_0x45164b){logger[_0x2144('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x1f9b90,_0x45164b);_0x2d32e4(_0x45164b);});});}exports[_0x2144('0x15')]=function(_0x4e5a7f){var _0x1c2cac=this;return new Promise(function(_0x6ebc52,_0x417dc1){return db[_0x2144('0x16')]['create'](_0x4e5a7f['body'],{'raw':_0x4e5a7f[_0x2144('0x17')]?_0x4e5a7f[_0x2144('0x17')][_0x2144('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x424908){logger[_0x2144('0xc')]('CreateVoiceTransferReport',_0x4e5a7f);logger[_0x2144('0x19')]('CreateVoiceTransferReport',_0x4e5a7f,JSON[_0x2144('0xe')](_0x424908));_0x6ebc52(_0x424908);})[_0x2144('0x14')](function(_0x2d20c4){logger['error'](_0x2144('0x15'),_0x2d20c4['message'],_0x4e5a7f);_0x417dc1(_0x1c2cac[_0x2144('0xf')](0x1f4,_0x2d20c4[_0x2144('0x12')]));});});}; \ No newline at end of file +var _0xfa7b=['stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4366d9,_0xbcb43c){var _0xb32530=function(_0xd30b48){while(--_0xd30b48){_0x4366d9['push'](_0x4366d9['shift']());}};_0xb32530(++_0xbcb43c);}(_0xfa7b,0xa9));var _0xbfa7=function(_0x1357a3,_0x25e5ef){_0x1357a3=_0x1357a3-0x0;var _0xb1cf34=_0xfa7b[_0x1357a3];return _0xb1cf34;};'use strict';var _=require(_0xbfa7('0x0'));var util=require('util');var moment=require(_0xbfa7('0x1'));var BPromise=require(_0xbfa7('0x2'));var rs=require(_0xbfa7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfa7('0x4'))['db'];var utils=require(_0xbfa7('0x5'));var logger=require(_0xbfa7('0x6'))(_0xbfa7('0x7'));var config=require(_0xbfa7('0x8'));var jayson=require(_0xbfa7('0x9'));var client=jayson[_0xbfa7('0xa')][_0xbfa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x388741,_0x4e888e,_0x591b1d){return new BPromise(function(_0x334c08,_0x2d4ea5){return client[_0xbfa7('0xc')](_0x388741,_0x591b1d)['then'](function(_0x98c677){logger[_0xbfa7('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4e888e,_0xbfa7('0xe'));logger[_0xbfa7('0xf')](_0xbfa7('0x10'),_0x4e888e,'request\x20sent',JSON[_0xbfa7('0x11')](_0x98c677));if(_0x98c677[_0xbfa7('0x12')]){if(_0x98c677[_0xbfa7('0x12')][_0xbfa7('0x13')]===0x1f4){logger[_0xbfa7('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4e888e,_0x98c677[_0xbfa7('0x12')][_0xbfa7('0x14')]);return _0x2d4ea5(_0x98c677[_0xbfa7('0x12')][_0xbfa7('0x14')]);}logger[_0xbfa7('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4e888e,_0x98c677[_0xbfa7('0x12')]['message']);return _0x334c08(_0x98c677['error']['message']);}else{logger['info'](_0xbfa7('0x15'),_0x4e888e,'request\x20sent');_0x334c08(_0x98c677[_0xbfa7('0x16')][_0xbfa7('0x14')]);}})[_0xbfa7('0x17')](function(_0x2bdc2b){logger['error'](_0xbfa7('0x15'),_0x4e888e,_0x2bdc2b);_0x2d4ea5(_0x2bdc2b);});});}exports[_0xbfa7('0x18')]=function(_0x4484e9){var _0x3971d7=this;return new Promise(function(_0x34b4c7,_0x5ccf81){return db[_0xbfa7('0x19')][_0xbfa7('0x1a')](_0x4484e9[_0xbfa7('0x1b')],{'raw':_0x4484e9[_0xbfa7('0x1c')]?_0x4484e9[_0xbfa7('0x1c')][_0xbfa7('0x1d')]===undefined?!![]:![]:!![]})[_0xbfa7('0x1e')](function(_0x329ca9){logger[_0xbfa7('0xd')](_0xbfa7('0x18'),_0x4484e9);logger['debug'](_0xbfa7('0x18'),_0x4484e9,JSON[_0xbfa7('0x11')](_0x329ca9));_0x34b4c7(_0x329ca9);})[_0xbfa7('0x17')](function(_0x24a607){logger[_0xbfa7('0x12')]('CreateVoiceTransferReport',_0x24a607[_0xbfa7('0x14')],_0x4484e9);_0x5ccf81(_0x3971d7['error'](0x1f4,_0x24a607['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 4d73f42..54bc712 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 _0xb91f=['/originate','isAuthenticated','canUpdate','originate','/hangup','answer','/hold','hold','/unhold','/calls','calls','/transfer','transfer','exports','Router','../../components/auth/service','post'];(function(_0x5e8d8b,_0x3defdb){var _0xc38051=function(_0x12dca7){while(--_0x12dca7){_0x5e8d8b['push'](_0x5e8d8b['shift']());}};_0xc38051(++_0x3defdb);}(_0xb91f,0xb8));var _0xfb91=function(_0x28a27c,_0x1ed2a0){_0x28a27c=_0x28a27c-0x0;var _0x54c4b7=_0xb91f[_0x28a27c];return _0x54c4b7;};'use strict';var express=require('express');var router=express[_0xfb91('0x0')]();var auth=require(_0xfb91('0x1'));var controller=require('./webbar.controller');router[_0xfb91('0x2')](_0xfb91('0x3'),auth[_0xfb91('0x4')](),auth[_0xfb91('0x5')](),controller[_0xfb91('0x6')]);router['post'](_0xfb91('0x7'),auth[_0xfb91('0x4')](),auth['canUpdate'](),controller['hangup']);router[_0xfb91('0x2')]('/answer',auth[_0xfb91('0x4')](),auth[_0xfb91('0x5')](),controller[_0xfb91('0x8')]);router[_0xfb91('0x2')](_0xfb91('0x9'),auth[_0xfb91('0x4')](),auth[_0xfb91('0x5')](),controller[_0xfb91('0xa')]);router['post'](_0xfb91('0xb'),auth[_0xfb91('0x4')](),auth[_0xfb91('0x5')](),controller['unhold']);router[_0xfb91('0x2')](_0xfb91('0xc'),auth[_0xfb91('0x4')](),auth[_0xfb91('0x5')](),controller[_0xfb91('0xd')]);router['post'](_0xfb91('0xe'),auth['isAuthenticated'](),auth[_0xfb91('0x5')](),controller[_0xfb91('0xf')]);module[_0xfb91('0x10')]=router; \ No newline at end of file +var _0x4256=['/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','originate','/hangup','hangup','/answer','canUpdate','answer','/unhold','unhold','/calls'];(function(_0x493d0a,_0x2c470f){var _0x6dbca2=function(_0x2abd4b){while(--_0x2abd4b){_0x493d0a['push'](_0x493d0a['shift']());}};_0x6dbca2(++_0x2c470f);}(_0x4256,0x123));var _0x6425=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0x4256[_0x152449];return _0x5b58b2;};'use strict';var express=require(_0x6425('0x0'));var router=express[_0x6425('0x1')]();var auth=require(_0x6425('0x2'));var controller=require(_0x6425('0x3'));router[_0x6425('0x4')]('/originate',auth[_0x6425('0x5')](),auth['canUpdate'](),controller[_0x6425('0x6')]);router[_0x6425('0x4')](_0x6425('0x7'),auth[_0x6425('0x5')](),auth['canUpdate'](),controller[_0x6425('0x8')]);router[_0x6425('0x4')](_0x6425('0x9'),auth[_0x6425('0x5')](),auth[_0x6425('0xa')](),controller[_0x6425('0xb')]);router[_0x6425('0x4')]('/hold',auth[_0x6425('0x5')](),auth[_0x6425('0xa')](),controller['hold']);router[_0x6425('0x4')](_0x6425('0xc'),auth[_0x6425('0x5')](),auth[_0x6425('0xa')](),controller[_0x6425('0xd')]);router[_0x6425('0x4')](_0x6425('0xe'),auth[_0x6425('0x5')](),auth[_0x6425('0xa')](),controller['calls']);router['post'](_0x6425('0xf'),auth[_0x6425('0x5')](),auth[_0x6425('0xa')](),controller[_0x6425('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 25147c6..4461722 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 _0xee5b=['answer\x20executed!','hold','hold\x20fired:','sessionId','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','ioredis','redis','defaults','userId\x20is\x20required','string','callNumber\x20is\x20required','number','info','stringify','log','handleError:','error','stack','name','status','send','request','then','code','User','findOne','agent','VoiceChannels','filter','rows','UserId','length','\x20not\x20found!','body','validate','json','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','catch','hangup','userId','format','user:%s','webbar:hangup','hangup\x20executed!','answer\x20fired:'];(function(_0x3d3e6a,_0x1da665){var _0x239a80=function(_0x4c5388){while(--_0x4c5388){_0x3d3e6a['push'](_0x3d3e6a['shift']());}};_0x239a80(++_0x1da665);}(_0xee5b,0x1f4));var _0xbee5=function(_0x30b1b8,_0x811817){_0x30b1b8=_0x30b1b8-0x0;var _0x37064d=_0xee5b[_0x30b1b8];return _0x37064d;};'use strict';var path=require(_0xbee5('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xbee5('0x1'))['db'];var config=require(_0xbee5('0x2'));var util=require('util');var BPromise=require(_0xbee5('0x3'));var jayson=require(_0xbee5('0x4'));var amiClient=jayson[_0xbee5('0x5')][_0xbee5('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xbee5('0x7'));config[_0xbee5('0x8')]=_[_0xbee5('0x9')](config[_0xbee5('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbee5('0xa')]},'callNumber':{'type':_0xbee5('0xb'),'required':[!![],_0xbee5('0xc')]},'callerId':{'type':_0xbee5('0xb')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xbee5('0xd'),'required':[!![],_0xbee5('0xa')]},'sessionId':{'type':_0xbee5('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbee5('0xd'),'required':[!![],_0xbee5('0xa')]},'sessionId':{'type':_0xbee5('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xbee5('0xd'),'required':[!![],_0xbee5('0xa')]},'sessionId':{'type':_0xbee5('0xb'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xbee5('0xb'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xbee5('0xd'),'required':[!![],_0xbee5('0xa')]},'sessionId':{'type':_0xbee5('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xbee5('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbee5('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbee5('0xa')]}});function emit(_0x141878,_0xf676b1,_0x53b269){logger[_0xbee5('0xe')](_0x141878,_0xf676b1,JSON[_0xbee5('0xf')](_0x53b269));io['to'](_0x141878)['emit'](_0xf676b1,_0x53b269);}function handleError(_0x254dd3){return function(_0x538460){console[_0xbee5('0x10')](_0xbee5('0x11'),_0x538460,_0x538460 instanceof RangeError);logger[_0xbee5('0x12')](_0x538460[_0xbee5('0x13')]);if(_0x538460 instanceof RangeError){if(_0x538460[_0xbee5('0x14')]){delete _0x538460[_0xbee5('0x14')];}_0x254dd3[_0xbee5('0x15')](0x194)[_0xbee5('0x16')](_0x538460);}else{if(_0x538460[_0xbee5('0x14')]){delete _0x538460[_0xbee5('0x14')];}_0x254dd3[_0xbee5('0x15')](0x1f4)[_0xbee5('0x16')](_0x538460);}};}function checkError(){return function(_0x450824){if(!_0x450824){throw new RangeError('NotFound');}return _0x450824;};}function respondWithRpcPromise(_0x550325,_0x469a7a){return new BPromise(function(_0x48bfb5,_0x205491){var _0x117cb3=amiClient;return _0x117cb3[_0xbee5('0x17')](_0x550325,_0x469a7a)[_0xbee5('0x18')](function(_0x3f23c5){if(_0x3f23c5[_0xbee5('0x12')]){if(_0x3f23c5[_0xbee5('0x12')][_0xbee5('0x19')]===0x1f4){return _0x205491(_0x3f23c5[_0xbee5('0x12')]['message']);}return _0x48bfb5(_0x3f23c5['error']['message']);}else{_0x48bfb5(_0x3f23c5['result']);}})['catch'](function(_0x1af3de){_0x205491(_0x1af3de);});});}function getAgent(_0x18d7f4){return db[_0xbee5('0x1a')][_0xbee5('0x1b')]({'where':{'id':_0x18d7f4,'role':_0xbee5('0x1c')}})[_0xbee5('0x18')](checkError());}function getAgentCheckSession(_0x3c8643,_0x4e9a79){return new BPromise(function(_0x36b50f,_0x402bc4){var _0x179d14=respondWithRpcPromise(_0xbee5('0x1d'));var _0x1a8bcc=getAgent(_0x3c8643);Promise['all']([_0x179d14,_0x1a8bcc])[_0xbee5('0x18')](function(_0x15ffb1){var _0xb7a077=_0x15ffb1[0x0];var _0x136a00=_0x15ffb1[0x1];var _0xa57f85=_[_0xbee5('0x1e')](_0xb7a077[_0xbee5('0x1f')],function(_0x36e8bb){return _0x36e8bb[_0xbee5('0x20')]==_0x136a00['id']&&_0x36e8bb['sessionId']==_0x4e9a79;});if(_0xa57f85[_0xbee5('0x21')]==0x1){_0x36b50f(_0x136a00);}else{_0x402bc4(new RangeError('sessionId\x20'+_0x4e9a79+_0xbee5('0x22')));}});});}exports['originate']=function(_0x2d20cd,_0x52dad9){logger[_0xbee5('0xe')]('originate\x20fired:',_0x2d20cd[_0xbee5('0x23')]);var _0x135587=originateValidation[_0xbee5('0x24')](_0x2d20cd[_0xbee5('0x23')]);if(_0x135587['length']>0x0){return _0x52dad9[_0xbee5('0x15')](0x190)[_0xbee5('0x25')](_0x135587);}var _0x477a03=_0x2d20cd[_0xbee5('0x23')]['userId'];var _0x24aed0=_0x2d20cd[_0xbee5('0x23')][_0xbee5('0x26')];var _0x30a2fc=_0x2d20cd['body'][_0xbee5('0x27')];var _0xe61341=_0x2d20cd[_0xbee5('0x23')][_0xbee5('0x28')];return getAgent(_0x477a03)['then'](function(_0x3c8a87){logger['info'](_0xbee5('0x29'),_0x3c8a87['name']);emit(util['format']('user:%s',_0x3c8a87[_0xbee5('0x14')]),_0xbee5('0x2a'),{'callNumber':_0x24aed0,'callerId':_0x30a2fc,'callbackUrl':_0xe61341});return _0x52dad9[_0xbee5('0x15')](0xc8)[_0xbee5('0x25')]({'error':![],'message':_0xbee5('0x2b')});})[_0xbee5('0x2c')](handleError(_0x52dad9));};exports[_0xbee5('0x2d')]=function(_0x4040b3,_0x58452a){logger[_0xbee5('0xe')]('hangup\x20fired:',_0x4040b3[_0xbee5('0x23')]);var _0x16ea3e=hangupValidation[_0xbee5('0x24')](_0x4040b3[_0xbee5('0x23')]);if(_0x16ea3e['length']>0x0){return _0x58452a[_0xbee5('0x15')](0x190)['json'](_0x16ea3e);}var _0x565e9f=_0x4040b3[_0xbee5('0x23')][_0xbee5('0x2e')];var _0x2e2827=_0x4040b3[_0xbee5('0x23')]['sessionId'];return getAgent(_0x565e9f)[_0xbee5('0x18')](function(_0x2819e2){logger[_0xbee5('0xe')](_0xbee5('0x29'),_0x2819e2[_0xbee5('0x14')]);emit(util[_0xbee5('0x2f')](_0xbee5('0x30'),_0x2819e2[_0xbee5('0x14')]),_0xbee5('0x31'),{'sessionId':_0x2e2827});return _0x58452a[_0xbee5('0x15')](0xc8)['json']({'error':![],'message':_0xbee5('0x32')});})[_0xbee5('0x2c')](handleError(_0x58452a));};exports['answer']=function(_0x1e872d,_0xebbcc5){logger[_0xbee5('0xe')](_0xbee5('0x33'),_0x1e872d['body']);var _0x4cfe54=answerValidation['validate'](_0x1e872d[_0xbee5('0x23')]);if(_0x4cfe54[_0xbee5('0x21')]>0x0){return _0xebbcc5[_0xbee5('0x15')](0x190)[_0xbee5('0x25')](_0x4cfe54);}var _0x4012fd=_0x1e872d[_0xbee5('0x23')][_0xbee5('0x2e')];var _0x2c4464=_0x1e872d[_0xbee5('0x23')]['sessionId'];return getAgent(_0x4012fd)['then'](function(_0x38e9f5){logger['info'](_0xbee5('0x29'),_0x38e9f5[_0xbee5('0x14')]);emit(util['format'](_0xbee5('0x30'),_0x38e9f5[_0xbee5('0x14')]),'webbar:answer',{'sessionId':_0x2c4464});return _0xebbcc5['status'](0xc8)[_0xbee5('0x25')]({'error':![],'message':_0xbee5('0x34')});})['catch'](handleError(_0xebbcc5));};exports[_0xbee5('0x35')]=function(_0x2974f6,_0x4c88ee){logger[_0xbee5('0xe')](_0xbee5('0x36'),_0x2974f6[_0xbee5('0x23')]);var _0x2978db=holdValidation[_0xbee5('0x24')](_0x2974f6[_0xbee5('0x23')]);if(_0x2978db[_0xbee5('0x21')]>0x0){return _0x4c88ee['status'](0x190)[_0xbee5('0x25')](_0x2978db);}var _0x34f01d=_0x2974f6[_0xbee5('0x23')][_0xbee5('0x2e')];var _0x5ba5f1=_0x2974f6[_0xbee5('0x23')][_0xbee5('0x37')];return getAgent(_0x34f01d)[_0xbee5('0x18')](function(_0x4aa21a){logger[_0xbee5('0xe')](_0xbee5('0x29'),_0x4aa21a['name']);emit(util['format']('user:%s',_0x4aa21a[_0xbee5('0x14')]),'webbar:hold',{'sessionId':_0x5ba5f1});return _0x4c88ee[_0xbee5('0x15')](0xc8)[_0xbee5('0x25')]({'error':![],'message':_0xbee5('0x38')});})[_0xbee5('0x2c')](handleError(_0x4c88ee));};exports[_0xbee5('0x39')]=function(_0x296fc8,_0x55e654){logger[_0xbee5('0xe')](_0xbee5('0x3a'),_0x296fc8[_0xbee5('0x23')]);var _0x2479f6=unholdValidation['validate'](_0x296fc8[_0xbee5('0x23')]);if(_0x2479f6['length']>0x0){return _0x55e654[_0xbee5('0x15')](0x190)[_0xbee5('0x25')](_0x2479f6);}var _0xf48059=_0x296fc8[_0xbee5('0x23')][_0xbee5('0x2e')];var _0x1b02eb=_0x296fc8[_0xbee5('0x23')][_0xbee5('0x37')];return getAgent(_0xf48059)[_0xbee5('0x18')](function(_0x31abcd){logger[_0xbee5('0xe')](_0xbee5('0x29'),_0x31abcd[_0xbee5('0x14')]);emit(util[_0xbee5('0x2f')](_0xbee5('0x30'),_0x31abcd['name']),_0xbee5('0x3b'),{'sessionId':_0x1b02eb});return _0x55e654[_0xbee5('0x15')](0xc8)[_0xbee5('0x25')]({'error':![],'message':'unhold\x20executed!'});})[_0xbee5('0x2c')](handleError(_0x55e654));};exports[_0xbee5('0x3c')]=function(_0x21d9c6,_0x4e8864){logger[_0xbee5('0xe')]('calls\x20fired:',_0x4e8864[_0xbee5('0x23')]);var _0x4ee645=callsValidation[_0xbee5('0x24')](_0x21d9c6[_0xbee5('0x23')]);if(_0x4ee645[_0xbee5('0x21')]>0x0){return _0x4e8864['status'](0x190)['json'](_0x4ee645);}var _0x5528e8=_0x21d9c6[_0xbee5('0x23')][_0xbee5('0x2e')];var _0xbc3da7=respondWithRpcPromise('VoiceChannels');var _0x4d8c34=getAgent(_0x5528e8);return Promise['all']([_0xbc3da7,_0x4d8c34])[_0xbee5('0x18')](function(_0x33fbb8){var _0x32ec82=_0x33fbb8[0x0];var _0x5cc68d=_0x33fbb8[0x1];var _0x154d44=_[_0xbee5('0x1e')](_0x32ec82[_0xbee5('0x1f')],function(_0x3fa83b){return _0x3fa83b[_0xbee5('0x20')]==_0x5cc68d['id'];});return _0x4e8864[_0xbee5('0x15')](0xc8)[_0xbee5('0x25')]({'count':_0x154d44[_0xbee5('0x21')],'rows':_0x154d44});})[_0xbee5('0x2c')](handleError(_0x4e8864));};exports[_0xbee5('0x3d')]=function(_0x38100e,_0x245521){logger[_0xbee5('0xe')](_0xbee5('0x3e'),_0x38100e[_0xbee5('0x23')]);var _0x143fd9=conferenceValidation[_0xbee5('0x24')](_0x38100e['body']);if(_0x143fd9[_0xbee5('0x21')]>0x0){return _0x245521['status'](0x190)['json'](_0x143fd9);}var _0x43941c=_0x38100e[_0xbee5('0x23')]['userId'];return getAgent(_0x43941c)['then'](function(_0x9c0fbb){logger['info'](_0xbee5('0x29'),_0x9c0fbb[_0xbee5('0x14')]);emit(util['format'](_0xbee5('0x30'),_0x9c0fbb[_0xbee5('0x14')]),_0xbee5('0x3f'));return _0x245521[_0xbee5('0x15')](0xc8)['json']({'error':![],'message':_0xbee5('0x40')});})['catch'](handleError(_0x245521));};exports[_0xbee5('0x41')]=function(_0x465ec8,_0x5c4c2c){logger[_0xbee5('0xe')](_0xbee5('0x42'),_0x465ec8['body']);var _0xf006d4=transferValidation[_0xbee5('0x24')](_0x465ec8['body']);if(_0xf006d4[_0xbee5('0x21')]>0x0){return _0x5c4c2c['status'](0x190)[_0xbee5('0x25')](_0xf006d4);}var _0x4b5789=_0x465ec8[_0xbee5('0x23')]['userId'];var _0x541414=_0x465ec8[_0xbee5('0x23')][_0xbee5('0x37')];var _0x3b5eda=_0x465ec8[_0xbee5('0x23')][_0xbee5('0x43')];return getAgent(_0x4b5789)[_0xbee5('0x18')](function(_0x4c6a0b){logger[_0xbee5('0xe')](_0xbee5('0x29'),_0x4c6a0b[_0xbee5('0x14')]);emit(util[_0xbee5('0x2f')](_0xbee5('0x30'),_0x4c6a0b[_0xbee5('0x14')]),_0xbee5('0x44'),{'sessionId':_0x541414,'transferNumber':_0x3b5eda});return _0x5c4c2c[_0xbee5('0x15')](0xc8)[_0xbee5('0x25')]({'error':![],'message':'transfer\x20executed!'});})[_0xbee5('0x2c')](handleError(_0x5c4c2c));}; \ No newline at end of file +var _0xaa88=['callNumber','format','user:%s','catch','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','sessionId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','defaults','localhost','socket.io-emitter','redis','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','error','name','status','send','NotFound','then','code','message','User','findOne','agent','all','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId'];(function(_0x24ff2b,_0x1349c1){var _0xd9d3e7=function(_0x321cde){while(--_0x321cde){_0x24ff2b['push'](_0x24ff2b['shift']());}};_0xd9d3e7(++_0x1349c1);}(_0xaa88,0x137));var _0x8aa8=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0xaa88[_0x5be795];return _0x4e8a3b;};'use strict';var path=require(_0x8aa8('0x0'));var fs=require('fs');var _=require(_0x8aa8('0x1'));var db=require(_0x8aa8('0x2'))['db'];var config=require(_0x8aa8('0x3'));var util=require('util');var BPromise=require(_0x8aa8('0x4'));var jayson=require(_0x8aa8('0x5'));var amiClient=jayson[_0x8aa8('0x6')][_0x8aa8('0x7')]({'port':0x232a});var logger=require(_0x8aa8('0x8'))(_0x8aa8('0x9'));var Redis=require('ioredis');config['redis']=_[_0x8aa8('0xa')](config['redis'],{'host':_0x8aa8('0xb'),'port':0x18eb});var io=require(_0x8aa8('0xc'))(new Redis(config[_0x8aa8('0xd')]));var Schema=require(_0x8aa8('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8aa8('0xf')]},'callNumber':{'type':_0x8aa8('0x10'),'required':[!![],_0x8aa8('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8aa8('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x8aa8('0x12'),'required':[!![],_0x8aa8('0xf')]},'sessionId':{'type':_0x8aa8('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8aa8('0xf')]},'sessionId':{'type':_0x8aa8('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8aa8('0xf')]},'sessionId':{'type':_0x8aa8('0x10'),'required':[!![],_0x8aa8('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x8aa8('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x8aa8('0x12'),'required':[!![],_0x8aa8('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8aa8('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8aa8('0x12'),'required':[!![],_0x8aa8('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8aa8('0x12'),'required':[!![],_0x8aa8('0xf')]}});function emit(_0x42a6a4,_0x3778f4,_0x1bdd39){logger[_0x8aa8('0x15')](_0x42a6a4,_0x3778f4,JSON[_0x8aa8('0x16')](_0x1bdd39));io['to'](_0x42a6a4)['emit'](_0x3778f4,_0x1bdd39);}function handleError(_0x4843f5){return function(_0x2c1b9a){console['log']('handleError:',_0x2c1b9a,_0x2c1b9a instanceof RangeError);logger[_0x8aa8('0x17')](_0x2c1b9a['stack']);if(_0x2c1b9a instanceof RangeError){if(_0x2c1b9a[_0x8aa8('0x18')]){delete _0x2c1b9a[_0x8aa8('0x18')];}_0x4843f5[_0x8aa8('0x19')](0x194)[_0x8aa8('0x1a')](_0x2c1b9a);}else{if(_0x2c1b9a['name']){delete _0x2c1b9a[_0x8aa8('0x18')];}_0x4843f5[_0x8aa8('0x19')](0x1f4)[_0x8aa8('0x1a')](_0x2c1b9a);}};}function checkError(){return function(_0x10f11c){if(!_0x10f11c){throw new RangeError(_0x8aa8('0x1b'));}return _0x10f11c;};}function respondWithRpcPromise(_0x34f1b7,_0x5d9b62){return new BPromise(function(_0x26cf63,_0x4cc455){var _0x1fdadd=amiClient;return _0x1fdadd['request'](_0x34f1b7,_0x5d9b62)[_0x8aa8('0x1c')](function(_0x557e4e){if(_0x557e4e[_0x8aa8('0x17')]){if(_0x557e4e[_0x8aa8('0x17')][_0x8aa8('0x1d')]===0x1f4){return _0x4cc455(_0x557e4e['error'][_0x8aa8('0x1e')]);}return _0x26cf63(_0x557e4e[_0x8aa8('0x17')][_0x8aa8('0x1e')]);}else{_0x26cf63(_0x557e4e['result']);}})['catch'](function(_0x2d1508){_0x4cc455(_0x2d1508);});});}function getAgent(_0x44e2d8){return db[_0x8aa8('0x1f')][_0x8aa8('0x20')]({'where':{'id':_0x44e2d8,'role':_0x8aa8('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x2bc34a,_0x49d561){return new BPromise(function(_0x2a0ff2,_0xe7768){var _0x15ff33=respondWithRpcPromise('VoiceChannels');var _0x4c5c5c=getAgent(_0x2bc34a);Promise[_0x8aa8('0x22')]([_0x15ff33,_0x4c5c5c])['then'](function(_0x385208){var _0x14be8b=_0x385208[0x0];var _0x39e892=_0x385208[0x1];var _0x240203=_[_0x8aa8('0x23')](_0x14be8b['rows'],function(_0x267f4c){return _0x267f4c[_0x8aa8('0x24')]==_0x39e892['id']&&_0x267f4c['sessionId']==_0x49d561;});if(_0x240203[_0x8aa8('0x25')]==0x1){_0x2a0ff2(_0x39e892);}else{_0xe7768(new RangeError(_0x8aa8('0x26')+_0x49d561+_0x8aa8('0x27')));}});});}exports['originate']=function(_0x28182b,_0x3a0dce){logger[_0x8aa8('0x15')](_0x8aa8('0x28'),_0x28182b[_0x8aa8('0x29')]);var _0x356be7=originateValidation[_0x8aa8('0xe')](_0x28182b[_0x8aa8('0x29')]);if(_0x356be7[_0x8aa8('0x25')]>0x0){return _0x3a0dce[_0x8aa8('0x19')](0x190)[_0x8aa8('0x2a')](_0x356be7);}var _0x5bf1a7=_0x28182b['body'][_0x8aa8('0x2b')];var _0x1270ff=_0x28182b[_0x8aa8('0x29')][_0x8aa8('0x2c')];var _0xbe7639=_0x28182b[_0x8aa8('0x29')]['callerId'];var _0x4b8118=_0x28182b[_0x8aa8('0x29')]['callbackUrl'];return getAgent(_0x5bf1a7)[_0x8aa8('0x1c')](function(_0x2c5c84){logger[_0x8aa8('0x15')]('entityFound:',_0x2c5c84[_0x8aa8('0x18')]);emit(util[_0x8aa8('0x2d')](_0x8aa8('0x2e'),_0x2c5c84['name']),'webbar:originate',{'callNumber':_0x1270ff,'callerId':_0xbe7639,'callbackUrl':_0x4b8118});return _0x3a0dce[_0x8aa8('0x19')](0xc8)[_0x8aa8('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0x8aa8('0x2f')](handleError(_0x3a0dce));};exports[_0x8aa8('0x30')]=function(_0x5c65fe,_0x3bbdd5){logger['info']('hangup\x20fired:',_0x5c65fe[_0x8aa8('0x29')]);var _0x5537ff=hangupValidation[_0x8aa8('0xe')](_0x5c65fe[_0x8aa8('0x29')]);if(_0x5537ff[_0x8aa8('0x25')]>0x0){return _0x3bbdd5[_0x8aa8('0x19')](0x190)['json'](_0x5537ff);}var _0x14264d=_0x5c65fe[_0x8aa8('0x29')]['userId'];var _0x40867c=_0x5c65fe[_0x8aa8('0x29')]['sessionId'];return getAgent(_0x14264d)[_0x8aa8('0x1c')](function(_0x3c6115){logger[_0x8aa8('0x15')](_0x8aa8('0x31'),_0x3c6115[_0x8aa8('0x18')]);emit(util[_0x8aa8('0x2d')](_0x8aa8('0x2e'),_0x3c6115[_0x8aa8('0x18')]),_0x8aa8('0x32'),{'sessionId':_0x40867c});return _0x3bbdd5[_0x8aa8('0x19')](0xc8)[_0x8aa8('0x2a')]({'error':![],'message':_0x8aa8('0x33')});})[_0x8aa8('0x2f')](handleError(_0x3bbdd5));};exports[_0x8aa8('0x34')]=function(_0x335953,_0x21b0b6){logger['info'](_0x8aa8('0x35'),_0x335953['body']);var _0x4833c0=answerValidation['validate'](_0x335953[_0x8aa8('0x29')]);if(_0x4833c0['length']>0x0){return _0x21b0b6['status'](0x190)[_0x8aa8('0x2a')](_0x4833c0);}var _0x4da4d8=_0x335953[_0x8aa8('0x29')]['userId'];var _0x5a132a=_0x335953[_0x8aa8('0x29')][_0x8aa8('0x36')];return getAgent(_0x4da4d8)[_0x8aa8('0x1c')](function(_0x3762cd){logger[_0x8aa8('0x15')](_0x8aa8('0x31'),_0x3762cd[_0x8aa8('0x18')]);emit(util['format'](_0x8aa8('0x2e'),_0x3762cd['name']),_0x8aa8('0x37'),{'sessionId':_0x5a132a});return _0x21b0b6[_0x8aa8('0x19')](0xc8)[_0x8aa8('0x2a')]({'error':![],'message':_0x8aa8('0x38')});})[_0x8aa8('0x2f')](handleError(_0x21b0b6));};exports[_0x8aa8('0x39')]=function(_0x5adcda,_0x56e13f){logger[_0x8aa8('0x15')](_0x8aa8('0x3a'),_0x5adcda['body']);var _0x35eeea=holdValidation[_0x8aa8('0xe')](_0x5adcda[_0x8aa8('0x29')]);if(_0x35eeea['length']>0x0){return _0x56e13f['status'](0x190)['json'](_0x35eeea);}var _0x4e05e7=_0x5adcda[_0x8aa8('0x29')][_0x8aa8('0x2b')];var _0x4ebe29=_0x5adcda[_0x8aa8('0x29')][_0x8aa8('0x36')];return getAgent(_0x4e05e7)[_0x8aa8('0x1c')](function(_0x1aa1b6){logger[_0x8aa8('0x15')](_0x8aa8('0x31'),_0x1aa1b6['name']);emit(util['format'](_0x8aa8('0x2e'),_0x1aa1b6['name']),_0x8aa8('0x3b'),{'sessionId':_0x4ebe29});return _0x56e13f['status'](0xc8)[_0x8aa8('0x2a')]({'error':![],'message':_0x8aa8('0x3c')});})[_0x8aa8('0x2f')](handleError(_0x56e13f));};exports[_0x8aa8('0x3d')]=function(_0x36de37,_0x22b35d){logger[_0x8aa8('0x15')](_0x8aa8('0x3e'),_0x36de37[_0x8aa8('0x29')]);var _0x850854=unholdValidation[_0x8aa8('0xe')](_0x36de37[_0x8aa8('0x29')]);if(_0x850854['length']>0x0){return _0x22b35d[_0x8aa8('0x19')](0x190)['json'](_0x850854);}var _0x4d8865=_0x36de37['body'][_0x8aa8('0x2b')];var _0x490e6a=_0x36de37[_0x8aa8('0x29')][_0x8aa8('0x36')];return getAgent(_0x4d8865)[_0x8aa8('0x1c')](function(_0x4d4dc3){logger[_0x8aa8('0x15')](_0x8aa8('0x31'),_0x4d4dc3[_0x8aa8('0x18')]);emit(util[_0x8aa8('0x2d')]('user:%s',_0x4d4dc3['name']),_0x8aa8('0x3f'),{'sessionId':_0x490e6a});return _0x22b35d[_0x8aa8('0x19')](0xc8)[_0x8aa8('0x2a')]({'error':![],'message':_0x8aa8('0x40')});})['catch'](handleError(_0x22b35d));};exports['calls']=function(_0x396ac5,_0x1bd389){logger[_0x8aa8('0x15')]('calls\x20fired:',_0x1bd389[_0x8aa8('0x29')]);var _0x3a814f=callsValidation['validate'](_0x396ac5['body']);if(_0x3a814f['length']>0x0){return _0x1bd389['status'](0x190)[_0x8aa8('0x2a')](_0x3a814f);}var _0x4ab098=_0x396ac5[_0x8aa8('0x29')][_0x8aa8('0x2b')];var _0x57d247=respondWithRpcPromise('VoiceChannels');var _0x2725c5=getAgent(_0x4ab098);return Promise[_0x8aa8('0x22')]([_0x57d247,_0x2725c5])['then'](function(_0x58830e){var _0x4da935=_0x58830e[0x0];var _0x3d2076=_0x58830e[0x1];var _0x1050e9=_['filter'](_0x4da935['rows'],function(_0x20feaf){return _0x20feaf[_0x8aa8('0x24')]==_0x3d2076['id'];});return _0x1bd389['status'](0xc8)[_0x8aa8('0x2a')]({'count':_0x1050e9[_0x8aa8('0x25')],'rows':_0x1050e9});})['catch'](handleError(_0x1bd389));};exports[_0x8aa8('0x41')]=function(_0x5dddbb,_0x29dfb3){logger['info'](_0x8aa8('0x42'),_0x5dddbb[_0x8aa8('0x29')]);var _0x3e105e=conferenceValidation[_0x8aa8('0xe')](_0x5dddbb[_0x8aa8('0x29')]);if(_0x3e105e['length']>0x0){return _0x29dfb3[_0x8aa8('0x19')](0x190)[_0x8aa8('0x2a')](_0x3e105e);}var _0x3fc8ce=_0x5dddbb[_0x8aa8('0x29')]['userId'];return getAgent(_0x3fc8ce)[_0x8aa8('0x1c')](function(_0xfe073d){logger['info'](_0x8aa8('0x31'),_0xfe073d[_0x8aa8('0x18')]);emit(util[_0x8aa8('0x2d')](_0x8aa8('0x2e'),_0xfe073d[_0x8aa8('0x18')]),_0x8aa8('0x43'));return _0x29dfb3[_0x8aa8('0x19')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x29dfb3));};exports[_0x8aa8('0x44')]=function(_0x3396fe,_0x3b7b2f){logger[_0x8aa8('0x15')](_0x8aa8('0x45'),_0x3396fe[_0x8aa8('0x29')]);var _0xffab23=transferValidation[_0x8aa8('0xe')](_0x3396fe[_0x8aa8('0x29')]);if(_0xffab23[_0x8aa8('0x25')]>0x0){return _0x3b7b2f[_0x8aa8('0x19')](0x190)[_0x8aa8('0x2a')](_0xffab23);}var _0x1c62bf=_0x3396fe[_0x8aa8('0x29')][_0x8aa8('0x2b')];var _0x36523a=_0x3396fe[_0x8aa8('0x29')][_0x8aa8('0x36')];var _0x28cf8a=_0x3396fe['body'][_0x8aa8('0x46')];return getAgent(_0x1c62bf)[_0x8aa8('0x1c')](function(_0x1bf485){logger[_0x8aa8('0x15')](_0x8aa8('0x31'),_0x1bf485[_0x8aa8('0x18')]);emit(util[_0x8aa8('0x2d')](_0x8aa8('0x2e'),_0x1bf485[_0x8aa8('0x18')]),'webbar:transfer',{'sessionId':_0x36523a,'transferNumber':_0x28cf8a});return _0x3b7b2f[_0x8aa8('0x19')](0xc8)[_0x8aa8('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0x8aa8('0x2f')](handleError(_0x3b7b2f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3f9fb5d..bcecf10 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 _0xd943=['show','get','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','send','put','/:id','destroy','/:id/dispositions','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x1e713e,_0x113f8b){var _0x1d012c=function(_0x5cb75d){while(--_0x5cb75d){_0x1e713e['push'](_0x1e713e['shift']());}};_0x1d012c(++_0x113f8b);}(_0xd943,0x15d));var _0x3d94=function(_0x3b4efb,_0x1fe6d6){_0x3b4efb=_0x3b4efb-0x0;var _0x4ceee1=_0xd943[_0x3b4efb];return _0x4ceee1;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller['getDispositions']);router[_0x3d94('0xc')](_0x3d94('0xd'),auth['isAuthenticated'](),controller[_0x3d94('0xe')]);router[_0x3d94('0xc')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);router['get'](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x12')]);router['post']('/',auth[_0x3d94('0x9')](),controller[_0x3d94('0x13')]);router[_0x3d94('0x14')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller[_0x3d94('0x15')]);router[_0x3d94('0x14')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x16')]);router[_0x3d94('0x14')](_0x3d94('0xf'),auth['isAuthenticated'](),controller[_0x3d94('0x17')]);router[_0x3d94('0x14')](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x18')]);router[_0x3d94('0x14')](_0x3d94('0x19'),controller['notify']);router[_0x3d94('0x14')]('/:id/send',auth[_0x3d94('0x9')](),controller[_0x3d94('0x1a')]);router[_0x3d94('0x1b')](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller['update']);router['delete'](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1d')]);router['delete'](_0x3d94('0x1e'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1f')]);router[_0x3d94('0x20')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x21')]);router[_0x3d94('0x20')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x22')]);module[_0x3d94('0x23')]=router; \ No newline at end of file +var _0x1623=['destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','/:id/dispositions','addAgents','/:id/notify','notify','update'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0x1623,0xab));var _0x3162=function(_0x30230d,_0x254b4f){_0x30230d=_0x30230d-0x0;var _0x32af50=_0x1623[_0x30230d];return _0x32af50;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3162('0xe')]);router[_0x3162('0xb')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0xb')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);router['get'](_0x3162('0x13'),auth['isAuthenticated'](),controller[_0x3162('0x14')]);router[_0x3162('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0x15')](_0x3162('0x16'),auth[_0x3162('0x7')](),controller['addDisposition']);router[_0x3162('0x15')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller['addAnswer']);router[_0x3162('0x15')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x17')]);router[_0x3162('0x15')](_0x3162('0x13'),auth[_0x3162('0x7')](),controller['addApplications']);router[_0x3162('0x15')](_0x3162('0x18'),controller[_0x3162('0x19')]);router[_0x3162('0x15')]('/:id/send',auth[_0x3162('0x7')](),controller['send']);router['put'](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x1a')]);router['delete']('/:id',auth[_0x3162('0x7')](),controller[_0x3162('0x1b')]);router[_0x3162('0x1c')](_0x3162('0x16'),auth[_0x3162('0x7')](),controller[_0x3162('0x1d')]);router[_0x3162('0x1c')](_0x3162('0xf'),auth['isAuthenticated'](),controller[_0x3162('0x1e')]);router[_0x3162('0x1c')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x1f')]);module[_0x3162('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 78f57f2..3fe9828 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 _0x83bd=['STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x104504,_0x443c9b){var _0x2f3e8f=function(_0x31c8ca){while(--_0x31c8ca){_0x104504['push'](_0x104504['shift']());}};_0x2f3e8f(++_0x443c9b);}(_0x83bd,0x67));var _0xd83b=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x83bd[_0x5550b3];return _0x4b8fc4;};'use strict';var Sequelize=require(_0xd83b('0x0'));var rs=require(_0xd83b('0x1'));module['exports']={'name':{'type':Sequelize[_0xd83b('0x2')],'unique':_0xd83b('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd83b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xd83b('0x2')],'defaultValue':function(){return rs[_0xd83b('0x4')]();}},'phone':{'type':Sequelize[_0xd83b('0x2')]},'type':{'type':Sequelize[_0xd83b('0x5')](_0xd83b('0x6'))},'accountSid':{'type':Sequelize[_0xd83b('0x2')]},'authToken':{'type':Sequelize[_0xd83b('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd83b('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd83b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd83b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd83b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd83b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd83b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd83b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd83b('0x9')],'comment':_0xd83b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xd83b('0x8')],'defaultValue':![],'comment':_0xd83b('0xb'),'set':function(_0x109e13){if(!_0x109e13){this[_0xd83b('0xc')](_0xd83b('0xd'),null);}this[_0xd83b('0xc')](_0xd83b('0xe'),_0x109e13);}},'description':{'type':Sequelize[_0xd83b('0x2')]}}; \ No newline at end of file +var _0xffde=['generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x306aa3,_0xa7dd85){var _0x606d54=function(_0x14d6d4){while(--_0x14d6d4){_0x306aa3['push'](_0x306aa3['shift']());}};_0x606d54(++_0xa7dd85);}(_0xffde,0x1b6));var _0xeffd=function(_0x5cbce9,_0x46e05e){_0x5cbce9=_0x5cbce9-0x0;var _0xbb808b=_0xffde[_0x5cbce9];return _0xbb808b;};'use strict';var Sequelize=require(_0xeffd('0x0'));var rs=require(_0xeffd('0x1'));module[_0xeffd('0x2')]={'name':{'type':Sequelize[_0xeffd('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xeffd('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xeffd('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xeffd('0x3')],'defaultValue':function(){return rs[_0xeffd('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeffd('0x5')](_0xeffd('0x6'))},'accountSid':{'type':Sequelize[_0xeffd('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xeffd('0x7');}},'notificationSound':{'type':Sequelize[_0xeffd('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xeffd('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xeffd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xeffd('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeffd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeffd('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeffd('0x9')],'comment':_0xeffd('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x57c795){if(!_0x57c795){this[_0xeffd('0xb')]('mandatoryDispositionPauseId',null);}this[_0xeffd('0xb')](_0xeffd('0xc'),_0x57c795);}},'description':{'type':Sequelize[_0xeffd('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 990eee4..67bb07c 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 _0x6c46=['WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','order','removeAnswers','addAgents','ids','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','created','autoclose','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','client','http','then','info'];(function(_0x2e3942,_0x175d6a){var _0x2bfb83=function(_0x47286c){while(--_0x47286c){_0x2e3942['push'](_0x2e3942['shift']());}};_0x2bfb83(++_0x175d6a);}(_0x6c46,0x98));var _0x66c4=function(_0x33d848,_0x4f5b01){_0x33d848=_0x33d848-0x0;var _0x4735a6=_0x6c46[_0x33d848];return _0x4735a6;};'use strict';var emlformat=require(_0x66c4('0x0'));var rimraf=require(_0x66c4('0x1'));var zipdir=require(_0x66c4('0x2'));var jsonpatch=require(_0x66c4('0x3'));var rp=require(_0x66c4('0x4'));var moment=require(_0x66c4('0x5'));var BPromise=require(_0x66c4('0x6'));var Mustache=require(_0x66c4('0x7'));var util=require(_0x66c4('0x8'));var path=require(_0x66c4('0x9'));var sox=require(_0x66c4('0xa'));var csv=require(_0x66c4('0xb'));var ejs=require(_0x66c4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c4('0xd'));var squel=require(_0x66c4('0xe'));var crypto=require(_0x66c4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x66c4('0x10'));var toCsv=require(_0x66c4('0xb'));var querystring=require(_0x66c4('0x11'));var Papa=require(_0x66c4('0x12'));var Redis=require(_0x66c4('0x13'));var authService=require(_0x66c4('0x14'));var qs=require(_0x66c4('0x15'));var as=require(_0x66c4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66c4('0x17'))(_0x66c4('0x18'));var utils=require(_0x66c4('0x19'));var config=require(_0x66c4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x66c4('0x1b'))['db'];config['redis']=_['defaults'](config[_0x66c4('0x1c')],{'host':_0x66c4('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x66c4('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x66c4('0x1f')][_0x66c4('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4cc056,_0x42b606,_0x3ca1b8,_0x268615){return new BPromise(function(_0x19da1c,_0x23c1cb){var _0x3d3255=_0x268615||client;return _0x3d3255['request'](_0x4cc056,_0x3ca1b8)[_0x66c4('0x21')](function(_0x493abc){logger[_0x66c4('0x22')](_0x66c4('0x23'),_0x42b606,'request\x20sent');logger[_0x66c4('0x24')](_0x66c4('0x25'),_0x42b606,_0x66c4('0x26'),JSON['stringify'](_0x493abc));if(_0x493abc[_0x66c4('0x27')]){if(_0x493abc[_0x66c4('0x27')]['code']===0x1f4){logger[_0x66c4('0x27')](_0x66c4('0x23'),_0x42b606,_0x493abc['error'][_0x66c4('0x28')]);return _0x23c1cb(_0x493abc[_0x66c4('0x27')][_0x66c4('0x28')]);}logger[_0x66c4('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x42b606,_0x493abc[_0x66c4('0x27')]['message']);return _0x19da1c(_0x493abc[_0x66c4('0x27')]['message']);}else{logger['info'](_0x66c4('0x23'),_0x42b606,_0x66c4('0x26'));_0x19da1c(_0x493abc[_0x66c4('0x29')][_0x66c4('0x28')]);}})[_0x66c4('0x2a')](function(_0x46f80b){logger[_0x66c4('0x27')](_0x66c4('0x23'),_0x42b606,_0x46f80b);_0x23c1cb(_0x46f80b);});});}function respondWithStatusCode(_0x4b7a5a,_0x455385){_0x455385=_0x455385||0xcc;return function(_0x3f900f){if(_0x3f900f){return _0x4b7a5a['sendStatus'](_0x455385);}return _0x4b7a5a[_0x66c4('0x2b')](_0x455385)[_0x66c4('0x2c')]();};}function respondWithResult(_0x43d121,_0x5bccd7){_0x5bccd7=_0x5bccd7||0xc8;return function(_0x553818){if(_0x553818){return _0x43d121[_0x66c4('0x2b')](_0x5bccd7)[_0x66c4('0x2d')](_0x553818);}};}function respondWithFilteredResult(_0x318b36,_0x2e25a9){return function(_0x17307c){if(_0x17307c){var _0x3b94da=typeof _0x2e25a9[_0x66c4('0x2e')]===_0x66c4('0x2f')&&typeof _0x2e25a9[_0x66c4('0x30')]===_0x66c4('0x2f');var _0x1e0549=_0x17307c[_0x66c4('0x31')];var _0x494c1d=_0x3b94da?0x0:_0x2e25a9[_0x66c4('0x2e')];var _0x36a9a2=_0x3b94da?_0x17307c[_0x66c4('0x31')]:_0x2e25a9[_0x66c4('0x2e')]+_0x2e25a9[_0x66c4('0x30')];var _0x13735b;if(_0x36a9a2>=_0x1e0549){_0x36a9a2=_0x1e0549;_0x13735b=0xc8;}else{_0x13735b=0xce;}_0x318b36['status'](_0x13735b);return _0x318b36[_0x66c4('0x32')](_0x66c4('0x33'),_0x494c1d+'-'+_0x36a9a2+'/'+_0x1e0549)['json'](_0x17307c);}return null;};}function patchUpdates(_0x24f428){return function(_0x12bfbd){try{jsonpatch['apply'](_0x12bfbd,_0x24f428,!![]);}catch(_0x60bd58){return BPromise['reject'](_0x60bd58);}return _0x12bfbd['save']();};}function saveUpdates(_0x53d751,_0x53363e){return function(_0x5bca0a){if(_0x5bca0a){return _0x5bca0a[_0x66c4('0x34')](_0x53d751)['then'](function(_0x22b192){return _0x22b192;});}return null;};}function removeEntity(_0x34008a,_0x24f532){return function(_0x38d97d){if(_0x38d97d){return _0x38d97d[_0x66c4('0x35')]()[_0x66c4('0x21')](function(){var _0x1bfc38=_0x38d97d[_0x66c4('0x36')]({'plain':!![]});var _0x882c33=_0x66c4('0x37');return db[_0x66c4('0x38')][_0x66c4('0x35')]({'where':{'type':_0x882c33,'resourceId':_0x1bfc38['id']}})['then'](function(){return _0x38d97d;});})[_0x66c4('0x21')](function(){_0x34008a[_0x66c4('0x2b')](0xcc)[_0x66c4('0x2c')]();});}};}function handleEntityNotFound(_0x1e449a,_0x144a5c){return function(_0x3f6ba1){if(!_0x3f6ba1){_0x1e449a[_0x66c4('0x39')](0x194);}return _0x3f6ba1;};}function handleError(_0x283b71,_0xc1d532){_0xc1d532=_0xc1d532||0x1f4;return function(_0x2d7227){logger[_0x66c4('0x27')](_0x2d7227['stack']);if(_0x2d7227[_0x66c4('0x3a')]){delete _0x2d7227[_0x66c4('0x3a')];}_0x283b71[_0x66c4('0x2b')](_0xc1d532)[_0x66c4('0x3b')](_0x2d7227);};}exports['index']=function(_0x43f820,_0x3bcc14){var _0x31226c={'include':[{'model':db[_0x66c4('0x3c')],'as':_0x66c4('0x3d')}]},_0x34a51d={},_0x5e7a88={'count':0x0,'rows':[]};var _0x3ccdaa=_['map'](db[_0x66c4('0x3e')][_0x66c4('0x3f')],function(_0x3b8b91){return{'name':_0x3b8b91[_0x66c4('0x40')],'type':_0x3b8b91[_0x66c4('0x41')][_0x66c4('0x42')]};});_0x34a51d[_0x66c4('0x43')]=_['map'](_0x3ccdaa,'name');_0x34a51d[_0x66c4('0x44')]=_[_0x66c4('0x45')](_0x43f820[_0x66c4('0x44')]);_0x34a51d[_0x66c4('0x46')]=_[_0x66c4('0x47')](_0x34a51d[_0x66c4('0x43')],_0x34a51d[_0x66c4('0x44')]);_0x31226c[_0x66c4('0x48')]=_[_0x66c4('0x47')](_0x34a51d[_0x66c4('0x43')],qs[_0x66c4('0x49')](_0x43f820['query']['fields']));_0x31226c[_0x66c4('0x48')]=_0x31226c[_0x66c4('0x48')]['length']?_0x31226c['attributes']:_0x34a51d[_0x66c4('0x43')];if(!_0x43f820[_0x66c4('0x44')]['hasOwnProperty'](_0x66c4('0x4a'))){_0x31226c[_0x66c4('0x30')]=qs[_0x66c4('0x30')](_0x43f820[_0x66c4('0x44')]['limit']);_0x31226c['offset']=qs['offset'](_0x43f820['query'][_0x66c4('0x2e')]);}_0x31226c['order']=qs[_0x66c4('0x4b')](_0x43f820['query'][_0x66c4('0x4b')]);_0x31226c[_0x66c4('0x4c')]=qs[_0x66c4('0x46')](_[_0x66c4('0x4d')](_0x43f820['query'],_0x34a51d[_0x66c4('0x46')]),_0x3ccdaa);if(_0x43f820[_0x66c4('0x44')][_0x66c4('0x4e')]){_0x31226c[_0x66c4('0x4c')]=_[_0x66c4('0x4f')](_0x31226c['where'],{'$or':_[_0x66c4('0x50')](_0x3ccdaa,function(_0x1a5386){if(_0x1a5386[_0x66c4('0x41')]!==_0x66c4('0x51')){var _0x47f9ec={};_0x47f9ec[_0x1a5386['name']]={'$like':'%'+_0x43f820[_0x66c4('0x44')]['filter']+'%'};return _0x47f9ec;}})});}_0x31226c=_[_0x66c4('0x4f')]({},_0x31226c,_0x43f820[_0x66c4('0x52')]);var _0x49cb1c={'where':_0x31226c[_0x66c4('0x4c')]};return db['WhatsappAccount'][_0x66c4('0x31')](_0x49cb1c)[_0x66c4('0x21')](function(_0xf31cd0){_0x5e7a88[_0x66c4('0x31')]=_0xf31cd0;if(_0x43f820[_0x66c4('0x44')][_0x66c4('0x53')]){_0x31226c[_0x66c4('0x54')]=[{'all':!![]}];}return db[_0x66c4('0x3e')][_0x66c4('0x55')](_0x31226c);})[_0x66c4('0x21')](function(_0x537631){_0x5e7a88['rows']=_0x537631;return _0x5e7a88;})[_0x66c4('0x21')](respondWithFilteredResult(_0x3bcc14,_0x31226c))[_0x66c4('0x2a')](handleError(_0x3bcc14,null));};exports['show']=function(_0x4376d1,_0x410163){var _0x3b139c={'raw':![],'where':{'id':_0x4376d1[_0x66c4('0x56')]['id']},'include':[{'model':db[_0x66c4('0x3c')],'as':_0x66c4('0x3d')}]},_0x1ebad6={};_0x1ebad6[_0x66c4('0x43')]=_[_0x66c4('0x45')](db[_0x66c4('0x3e')][_0x66c4('0x3f')]);_0x1ebad6['query']=_['keys'](_0x4376d1[_0x66c4('0x44')]);_0x1ebad6['filters']=_['intersection'](_0x1ebad6[_0x66c4('0x43')],_0x1ebad6['query']);_0x3b139c['attributes']=_[_0x66c4('0x47')](_0x1ebad6[_0x66c4('0x43')],qs['fields'](_0x4376d1[_0x66c4('0x44')][_0x66c4('0x49')]));_0x3b139c[_0x66c4('0x48')]=_0x3b139c[_0x66c4('0x48')][_0x66c4('0x57')]?_0x3b139c[_0x66c4('0x48')]:_0x1ebad6['model'];if(_0x4376d1[_0x66c4('0x44')][_0x66c4('0x53')]){_0x3b139c[_0x66c4('0x54')]=[{'all':!![]}];}_0x3b139c=_['merge']({},_0x3b139c,_0x4376d1[_0x66c4('0x52')]);return db['WhatsappAccount']['find'](_0x3b139c)[_0x66c4('0x21')](handleEntityNotFound(_0x410163,null))[_0x66c4('0x21')](respondWithResult(_0x410163,null))[_0x66c4('0x2a')](handleError(_0x410163,null));};exports['create']=function(_0x4672cf,_0x21bf16){return db[_0x66c4('0x3e')][_0x66c4('0x58')](_0x4672cf['body'],{})[_0x66c4('0x21')](function(_0x537e2b){var _0xe67a0f=_0x4672cf[_0x66c4('0x59')]['get']({'plain':!![]});if(!_0xe67a0f)throw new Error(_0x66c4('0x5a'));if(_0xe67a0f[_0x66c4('0x5b')]===_0x66c4('0x59')){var _0x273ec6=_0x537e2b[_0x66c4('0x36')]({'plain':!![]});var _0x526939='WhatsappAccounts';return db[_0x66c4('0x5c')][_0x66c4('0x5d')]({'where':{'name':_0x526939,'userProfileId':_0xe67a0f['userProfileId']},'raw':!![]})[_0x66c4('0x21')](function(_0x1e0ce6){if(_0x1e0ce6&&_0x1e0ce6['autoAssociation']===0x0){return db[_0x66c4('0x38')][_0x66c4('0x58')]({'name':_0x273ec6['name'],'resourceId':_0x273ec6['id'],'type':_0x1e0ce6[_0x66c4('0x3a')],'sectionId':_0x1e0ce6['id']},{})['then'](function(){return _0x537e2b;});}else{return _0x537e2b;}})['catch'](function(_0x2e8ea8){logger['error'](_0x66c4('0x5e'),_0x2e8ea8);throw _0x2e8ea8;});}return _0x537e2b;})['then'](respondWithResult(_0x21bf16,0xc9))['catch'](handleError(_0x21bf16,null));};exports[_0x66c4('0x34')]=function(_0x222f09,_0x8268a4){if(_0x222f09[_0x66c4('0x5f')]['id']){delete _0x222f09[_0x66c4('0x5f')]['id'];}return db[_0x66c4('0x3e')][_0x66c4('0x5d')]({'where':{'id':_0x222f09[_0x66c4('0x56')]['id']},'include':[{'model':db[_0x66c4('0x3c')],'as':_0x66c4('0x3d')}]})['then'](handleEntityNotFound(_0x8268a4,null))[_0x66c4('0x21')](saveUpdates(_0x222f09[_0x66c4('0x5f')],null))['then'](respondWithResult(_0x8268a4,null))[_0x66c4('0x2a')](handleError(_0x8268a4,null));};exports[_0x66c4('0x35')]=function(_0x271dab,_0x1f3964){return db['WhatsappAccount'][_0x66c4('0x5d')]({'where':{'id':_0x271dab[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x1f3964,null))['then'](removeEntity(_0x1f3964,null))[_0x66c4('0x2a')](handleError(_0x1f3964,null));};exports[_0x66c4('0x60')]=function(_0x263947,_0xa9c05a){return db[_0x66c4('0x3e')][_0x66c4('0x60')]()[_0x66c4('0x21')](respondWithResult(_0xa9c05a,null))[_0x66c4('0x2a')](handleError(_0xa9c05a,null));};exports[_0x66c4('0x61')]=function(_0x389f88,_0x5ec317,_0xf173d8){if(_0x389f88[_0x66c4('0x5f')]['id']){delete _0x389f88['body']['id'];}return db[_0x66c4('0x3e')]['find']({'where':{'id':_0x389f88[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x5ec317,null))[_0x66c4('0x21')](function(_0x23bb82){if(_0x23bb82){_0x389f88[_0x66c4('0x5f')][_0x66c4('0x62')]=_0x23bb82['id'];return db[_0x66c4('0x63')][_0x66c4('0x58')](_0x389f88[_0x66c4('0x5f')]);}})['then'](respondWithResult(_0x5ec317,null))[_0x66c4('0x2a')](handleError(_0x5ec317,null));};exports[_0x66c4('0x64')]=function(_0x2cbb00,_0x1d6000,_0x3253da){var _0x4a5bac={'raw':![],'where':{}};var _0x4950ce={};var _0x3308b6={'count':0x0,'rows':[]};return db[_0x66c4('0x3e')]['findOne']({'where':{'id':_0x2cbb00[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x1d6000,null))[_0x66c4('0x21')](function(_0x2a7891){if(_0x2a7891){_0x4950ce[_0x66c4('0x43')]=_[_0x66c4('0x45')](db[_0x66c4('0x63')][_0x66c4('0x3f')]);_0x4950ce[_0x66c4('0x44')]=_[_0x66c4('0x45')](_0x2cbb00[_0x66c4('0x44')]);_0x4950ce[_0x66c4('0x46')]=_[_0x66c4('0x47')](_0x4950ce[_0x66c4('0x43')],_0x4950ce[_0x66c4('0x44')]);_0x4a5bac[_0x66c4('0x48')]=_[_0x66c4('0x47')](_0x4950ce['model'],qs['fields'](_0x2cbb00['query']['fields']));_0x4a5bac[_0x66c4('0x48')]=_0x4a5bac[_0x66c4('0x48')][_0x66c4('0x57')]?_0x4a5bac[_0x66c4('0x48')]:_0x4950ce[_0x66c4('0x43')];if(!_0x2cbb00[_0x66c4('0x44')][_0x66c4('0x65')]('nolimit')){_0x4a5bac[_0x66c4('0x30')]=qs['limit'](_0x2cbb00['query'][_0x66c4('0x30')]);_0x4a5bac[_0x66c4('0x2e')]=qs[_0x66c4('0x2e')](_0x2cbb00[_0x66c4('0x44')][_0x66c4('0x2e')]);}_0x4a5bac['order']=qs[_0x66c4('0x4b')](_0x2cbb00[_0x66c4('0x44')][_0x66c4('0x4b')]);_0x4a5bac[_0x66c4('0x4c')]=qs[_0x66c4('0x46')](_[_0x66c4('0x4d')](_0x2cbb00[_0x66c4('0x44')],_0x4950ce[_0x66c4('0x46')]));_0x4a5bac[_0x66c4('0x4c')][_0x66c4('0x62')]=_0x2a7891['id'];if(_0x2cbb00[_0x66c4('0x44')][_0x66c4('0x4e')]){_0x4a5bac[_0x66c4('0x4c')]=_[_0x66c4('0x4f')](_0x4a5bac[_0x66c4('0x4c')],{'$or':_[_0x66c4('0x50')](_0x4a5bac[_0x66c4('0x48')],function(_0x56bfe4){var _0x1c6c0c={};_0x1c6c0c[_0x56bfe4]={'$like':'%'+_0x2cbb00['query']['filter']+'%'};return _0x1c6c0c;})});}_0x4a5bac=_[_0x66c4('0x4f')]({},_0x4a5bac,_0x2cbb00[_0x66c4('0x52')]);return db['Disposition'][_0x66c4('0x31')]({'where':_0x4a5bac[_0x66c4('0x4c')]})[_0x66c4('0x21')](function(_0x11d951){_0x3308b6[_0x66c4('0x31')]=_0x11d951;if(_0x2cbb00[_0x66c4('0x44')][_0x66c4('0x53')]){_0x4a5bac[_0x66c4('0x54')]=[{'all':!![]}];}return db[_0x66c4('0x63')][_0x66c4('0x55')](_0x4a5bac);})['then'](function(_0x1921b6){_0x3308b6[_0x66c4('0x66')]=_0x1921b6;return _0x3308b6;});}})[_0x66c4('0x21')](respondWithFilteredResult(_0x1d6000,_0x4a5bac))[_0x66c4('0x2a')](handleError(_0x1d6000,null));};exports[_0x66c4('0x67')]=function(_0x3990e8,_0x5bac0f,_0x253c7b){return db['WhatsappAccount'][_0x66c4('0x5d')]({'where':{'id':_0x3990e8[_0x66c4('0x56')]['id']}})['then'](handleEntityNotFound(_0x5bac0f,null))[_0x66c4('0x21')](function(_0xa33008){if(_0xa33008){return _0xa33008[_0x66c4('0x67')](_0x3990e8[_0x66c4('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x5bac0f,null))[_0x66c4('0x2a')](handleError(_0x5bac0f,null));};exports[_0x66c4('0x68')]=function(_0x40d3d8,_0x659586,_0x134296){if(_0x40d3d8[_0x66c4('0x5f')]['id']){delete _0x40d3d8[_0x66c4('0x5f')]['id'];}return db[_0x66c4('0x3e')]['find']({'where':{'id':_0x40d3d8['params']['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x659586,null))[_0x66c4('0x21')](function(_0x12786c){if(_0x12786c){_0x40d3d8['body']['WhatsappAccountId']=_0x12786c['id'];return db[_0x66c4('0x69')]['create'](_0x40d3d8[_0x66c4('0x5f')]);}})['then'](respondWithResult(_0x659586,null))['catch'](handleError(_0x659586,null));};exports[_0x66c4('0x6a')]=function(_0x63e6a5,_0x48f1d2,_0x479a51){var _0x1292da={'raw':![],'where':{}};var _0x5d0d79={};var _0x55312f={'count':0x0,'rows':[]};return db[_0x66c4('0x3e')][_0x66c4('0x6b')]({'where':{'id':_0x63e6a5[_0x66c4('0x56')]['id']}})['then'](handleEntityNotFound(_0x48f1d2,null))[_0x66c4('0x21')](function(_0x23d11d){if(_0x23d11d){_0x5d0d79[_0x66c4('0x43')]=_[_0x66c4('0x45')](db['CannedAnswer'][_0x66c4('0x3f')]);_0x5d0d79['query']=_[_0x66c4('0x45')](_0x63e6a5[_0x66c4('0x44')]);_0x5d0d79[_0x66c4('0x46')]=_[_0x66c4('0x47')](_0x5d0d79[_0x66c4('0x43')],_0x5d0d79[_0x66c4('0x44')]);_0x1292da['attributes']=_[_0x66c4('0x47')](_0x5d0d79['model'],qs[_0x66c4('0x49')](_0x63e6a5['query'][_0x66c4('0x49')]));_0x1292da['attributes']=_0x1292da[_0x66c4('0x48')][_0x66c4('0x57')]?_0x1292da['attributes']:_0x5d0d79[_0x66c4('0x43')];if(!_0x63e6a5[_0x66c4('0x44')][_0x66c4('0x65')](_0x66c4('0x4a'))){_0x1292da[_0x66c4('0x30')]=qs[_0x66c4('0x30')](_0x63e6a5[_0x66c4('0x44')][_0x66c4('0x30')]);_0x1292da[_0x66c4('0x2e')]=qs[_0x66c4('0x2e')](_0x63e6a5[_0x66c4('0x44')][_0x66c4('0x2e')]);}_0x1292da[_0x66c4('0x6c')]=qs[_0x66c4('0x4b')](_0x63e6a5[_0x66c4('0x44')]['sort']);_0x1292da[_0x66c4('0x4c')]=qs[_0x66c4('0x46')](_[_0x66c4('0x4d')](_0x63e6a5[_0x66c4('0x44')],_0x5d0d79[_0x66c4('0x46')]));_0x1292da[_0x66c4('0x4c')][_0x66c4('0x62')]=_0x23d11d['id'];if(_0x63e6a5[_0x66c4('0x44')][_0x66c4('0x4e')]){_0x1292da['where']=_[_0x66c4('0x4f')](_0x1292da[_0x66c4('0x4c')],{'$or':_['map'](_0x1292da[_0x66c4('0x48')],function(_0xec4a8d){var _0x478d3f={};_0x478d3f[_0xec4a8d]={'$like':'%'+_0x63e6a5[_0x66c4('0x44')][_0x66c4('0x4e')]+'%'};return _0x478d3f;})});}_0x1292da=_[_0x66c4('0x4f')]({},_0x1292da,_0x63e6a5[_0x66c4('0x52')]);return db['CannedAnswer']['count']({'where':_0x1292da[_0x66c4('0x4c')]})['then'](function(_0x57a7a2){_0x55312f[_0x66c4('0x31')]=_0x57a7a2;if(_0x63e6a5[_0x66c4('0x44')][_0x66c4('0x53')]){_0x1292da[_0x66c4('0x54')]=[{'all':!![]}];}return db[_0x66c4('0x69')][_0x66c4('0x55')](_0x1292da);})[_0x66c4('0x21')](function(_0x57ba33){_0x55312f['rows']=_0x57ba33;return _0x55312f;});}})['then'](respondWithFilteredResult(_0x48f1d2,_0x1292da))['catch'](handleError(_0x48f1d2,null));};exports['removeAnswers']=function(_0x50ec98,_0x49141f,_0x45846c){return db['WhatsappAccount']['find']({'where':{'id':_0x50ec98['params']['id']}})['then'](handleEntityNotFound(_0x49141f,null))[_0x66c4('0x21')](function(_0x5c2aa6){if(_0x5c2aa6){return _0x5c2aa6[_0x66c4('0x6d')](_0x50ec98['query']['ids']);}})[_0x66c4('0x21')](respondWithStatusCode(_0x49141f,null))['catch'](handleError(_0x49141f,null));};exports[_0x66c4('0x6e')]=function(_0x53d009,_0x33b885,_0x425bc3){return db['WhatsappAccount'][_0x66c4('0x5d')]({'where':{'id':_0x53d009[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x33b885,null))[_0x66c4('0x21')](function(_0x8c6cdb){if(_0x8c6cdb){return _0x8c6cdb[_0x66c4('0x6e')](_0x53d009[_0x66c4('0x5f')]['ids'],_['omit'](_0x53d009['body'],[_0x66c4('0x6f'),'id'])||{})['spread'](function(_0x47e25b){for(var _0x41bca1=0x0;_0x41bca1<_0x53d009[_0x66c4('0x5f')][_0x66c4('0x6f')][_0x66c4('0x57')];_0x41bca1+=0x1){socket[_0x66c4('0x70')](_0x66c4('0x71'),{'UserId':Number(_0x53d009[_0x66c4('0x5f')][_0x66c4('0x6f')][_0x41bca1]),'WhatsappAccountId':Number(_0x53d009[_0x66c4('0x56')]['id'])});}return _0x47e25b;});}})[_0x66c4('0x21')](respondWithResult(_0x33b885,null))[_0x66c4('0x2a')](handleError(_0x33b885,null));};exports[_0x66c4('0x72')]=function(_0x405e93,_0x676062,_0x3c9221){return db[_0x66c4('0x3e')][_0x66c4('0x5d')]({'where':{'id':_0x405e93[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x676062,null))[_0x66c4('0x21')](function(_0x40d0e6){if(_0x40d0e6){return _0x40d0e6[_0x66c4('0x72')](_0x405e93[_0x66c4('0x44')][_0x66c4('0x6f')])[_0x66c4('0x21')](function(){if(_['isArray'](_0x405e93['query'][_0x66c4('0x6f')])){for(var _0x22225d=0x0;_0x22225d<_0x405e93['query'][_0x66c4('0x6f')]['length'];_0x22225d+=0x1){socket['emit'](_0x66c4('0x73'),{'UserId':Number(_0x405e93[_0x66c4('0x44')][_0x66c4('0x6f')][_0x22225d]),'WhatsappAccountId':Number(_0x405e93['params']['id'])});}}else{socket[_0x66c4('0x70')](_0x66c4('0x73'),{'UserId':Number(_0x405e93[_0x66c4('0x44')][_0x66c4('0x6f')]),'WhatsappAccountId':Number(_0x405e93[_0x66c4('0x56')]['id'])});}});}})[_0x66c4('0x21')](respondWithStatusCode(_0x676062,null))[_0x66c4('0x2a')](handleError(_0x676062,null));};exports[_0x66c4('0x74')]=function(_0x5145c3,_0x1f408c,_0x1b3929){var _0x5beb93={};var _0x5900d7={};var _0x24990e;var _0x45c7ca;return db[_0x66c4('0x3e')]['findOne']({'where':{'id':_0x5145c3[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x1f408c,null))[_0x66c4('0x21')](function(_0x5f3e8e){if(_0x5f3e8e){_0x24990e=_0x5f3e8e;_0x5900d7[_0x66c4('0x43')]=_[_0x66c4('0x45')](db[_0x66c4('0x75')]['rawAttributes']);_0x5900d7[_0x66c4('0x44')]=_[_0x66c4('0x45')](_0x5145c3[_0x66c4('0x44')]);_0x5900d7[_0x66c4('0x46')]=_[_0x66c4('0x47')](_0x5900d7['model'],_0x5900d7[_0x66c4('0x44')]);_0x5beb93[_0x66c4('0x48')]=_[_0x66c4('0x47')](_0x5900d7['model'],qs[_0x66c4('0x49')](_0x5145c3[_0x66c4('0x44')][_0x66c4('0x49')]));_0x5beb93[_0x66c4('0x48')]=_0x5beb93[_0x66c4('0x48')][_0x66c4('0x57')]?_0x5beb93[_0x66c4('0x48')]:_0x5900d7['model'];_0x5beb93[_0x66c4('0x6c')]=qs[_0x66c4('0x4b')](_0x5145c3['query'][_0x66c4('0x4b')]);_0x5beb93['where']=qs[_0x66c4('0x46')](_[_0x66c4('0x4d')](_0x5145c3[_0x66c4('0x44')],_0x5900d7[_0x66c4('0x46')]));if(_0x5145c3[_0x66c4('0x44')][_0x66c4('0x4e')]){_0x5beb93[_0x66c4('0x4c')]=_[_0x66c4('0x4f')](_0x5beb93[_0x66c4('0x4c')],{'$or':_[_0x66c4('0x50')](_0x5beb93[_0x66c4('0x48')],function(_0x343ce2){var _0x4c6ff9={};_0x4c6ff9[_0x343ce2]={'$like':'%'+_0x5145c3[_0x66c4('0x44')][_0x66c4('0x4e')]+'%'};return _0x4c6ff9;})});}_0x5beb93=_[_0x66c4('0x4f')]({},_0x5beb93,_0x5145c3[_0x66c4('0x52')]);return _0x24990e['getAgents'](_0x5beb93);}})[_0x66c4('0x21')](function(_0x2db0ac){if(_0x2db0ac){_0x45c7ca=_0x2db0ac[_0x66c4('0x57')];if(!_0x5145c3[_0x66c4('0x44')][_0x66c4('0x65')](_0x66c4('0x4a'))){_0x5beb93['limit']=qs['limit'](_0x5145c3[_0x66c4('0x44')][_0x66c4('0x30')]);_0x5beb93[_0x66c4('0x2e')]=qs['offset'](_0x5145c3[_0x66c4('0x44')][_0x66c4('0x2e')]);}return _0x24990e['getAgents'](_0x5beb93);}})[_0x66c4('0x21')](function(_0x2496c0){if(_0x2496c0){return _0x2496c0?{'count':_0x45c7ca,'rows':_0x2496c0}:null;}})[_0x66c4('0x21')](respondWithResult(_0x1f408c,null))[_0x66c4('0x2a')](handleError(_0x1f408c,null));};exports[_0x66c4('0x76')]=function(_0x2a215a,_0x5da638,_0x49479f){return db[_0x66c4('0x3e')][_0x66c4('0x6b')]({'where':{'id':_0x2a215a[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x5da638,null))[_0x66c4('0x21')](function(_0x527cca){if(_0x527cca){return db[_0x66c4('0x77')][_0x66c4('0x78')](function(_0x48ffbc){return db[_0x66c4('0x79')]['destroy']({'where':{'WhatsappAccountId':_0x2a215a['params']['id']},'transaction':_0x48ffbc})[_0x66c4('0x21')](function(_0x57c0a8){var _0x2b70d5=_[_0x66c4('0x50')](_0x2a215a[_0x66c4('0x5f')],function(_0x2d4c21){_0x2d4c21['WhatsappAccountId']=_0x2a215a[_0x66c4('0x56')]['id'];return _0x2d4c21;});return db[_0x66c4('0x79')][_0x66c4('0x7a')](_0x2b70d5,{'transaction':_0x48ffbc});});})[_0x66c4('0x21')](function(){return db[_0x66c4('0x79')][_0x66c4('0x7b')]({'where':{'WhatsappAccountId':_0x2a215a[_0x66c4('0x56')]['id']},'order':_0x66c4('0x7c')});});}})['then'](respondWithResult(_0x5da638,null))['catch'](handleError(_0x5da638,null));};exports[_0x66c4('0x7d')]=function(_0x5f3392,_0x46a028,_0x1ea6d3){var _0x19cf37={};var _0x1b975d={};var _0x1a3cc2;var _0x147c4f;return db[_0x66c4('0x3e')][_0x66c4('0x6b')]({'where':{'id':_0x5f3392[_0x66c4('0x56')]['id']}})[_0x66c4('0x21')](handleEntityNotFound(_0x46a028,null))['then'](function(_0x193624){if(_0x193624){_0x1a3cc2=_0x193624;_0x1b975d[_0x66c4('0x43')]=_[_0x66c4('0x45')](db[_0x66c4('0x79')]['rawAttributes']);_0x1b975d[_0x66c4('0x44')]=_[_0x66c4('0x45')](_0x5f3392[_0x66c4('0x44')]);_0x1b975d[_0x66c4('0x46')]=_[_0x66c4('0x47')](_0x1b975d[_0x66c4('0x43')],_0x1b975d['query']);_0x19cf37['attributes']=_[_0x66c4('0x47')](_0x1b975d[_0x66c4('0x43')],qs[_0x66c4('0x49')](_0x5f3392[_0x66c4('0x44')][_0x66c4('0x49')]));_0x19cf37['attributes']=_0x19cf37[_0x66c4('0x48')][_0x66c4('0x57')]?_0x19cf37['attributes']:_0x1b975d[_0x66c4('0x43')];_0x19cf37[_0x66c4('0x6c')]=qs[_0x66c4('0x4b')](_0x5f3392[_0x66c4('0x44')][_0x66c4('0x4b')]);_0x19cf37[_0x66c4('0x4c')]=qs[_0x66c4('0x46')](_[_0x66c4('0x4d')](_0x5f3392['query'],_0x1b975d['filters']));if(_0x5f3392[_0x66c4('0x44')]['filter']){_0x19cf37[_0x66c4('0x4c')]=_[_0x66c4('0x4f')](_0x19cf37[_0x66c4('0x4c')],{'$or':_[_0x66c4('0x50')](_0x19cf37[_0x66c4('0x48')],function(_0xcc5f9b){var _0x2dd87f={};_0x2dd87f[_0xcc5f9b]={'$like':'%'+_0x5f3392[_0x66c4('0x44')][_0x66c4('0x4e')]+'%'};return _0x2dd87f;})});}_0x19cf37=_[_0x66c4('0x4f')]({},_0x19cf37,_0x5f3392[_0x66c4('0x52')]);return _0x1a3cc2[_0x66c4('0x7d')](_0x19cf37);}})[_0x66c4('0x21')](function(_0x1ef2ce){if(_0x1ef2ce){_0x147c4f=_0x1ef2ce['length'];if(!_0x5f3392[_0x66c4('0x44')]['hasOwnProperty'](_0x66c4('0x4a'))){_0x19cf37[_0x66c4('0x30')]=qs[_0x66c4('0x30')](_0x5f3392[_0x66c4('0x44')][_0x66c4('0x30')]);_0x19cf37[_0x66c4('0x2e')]=qs[_0x66c4('0x2e')](_0x5f3392[_0x66c4('0x44')][_0x66c4('0x2e')]);}return _0x1a3cc2['getApplications'](_0x19cf37);}})[_0x66c4('0x21')](function(_0x154b0b){if(_0x154b0b){return _0x154b0b?{'count':_0x147c4f,'rows':_0x154b0b}:null;}})[_0x66c4('0x21')](respondWithResult(_0x46a028,null))[_0x66c4('0x2a')](handleError(_0x46a028,null));};exports[_0x66c4('0x7e')]=function(_0x2f83e8,_0x52af5f,_0x1b306e){var _0x4773fc={'channel':'whatsapp'};var _0x4e8609=[];var _0x3c029e=[];var _0x250669={};return db[_0x66c4('0x3e')][_0x66c4('0x5d')]({'where':{'id':_0x2f83e8[_0x66c4('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x66c4('0x7f')}]})[_0x66c4('0x21')](handleEntityNotFound(_0x52af5f,null))['then'](function(_0x3ede59){_0x4773fc['account']=_0x3ede59;_0x4773fc[_0x66c4('0x80')]=_[_0x66c4('0x81')](_0x3ede59[_0x66c4('0x7f')],[_0x66c4('0x7c')],[_0x66c4('0x82')]);if(_0x4773fc[_0x66c4('0x83')][_0x66c4('0x7f')]){delete _0x4773fc[_0x66c4('0x83')][_0x66c4('0x7f')];}return db[_0x66c4('0x84')]['describe']();})[_0x66c4('0x21')](function(_0x366d0d){if(!_0x366d0d){throw new db['Sequelize'][(_0x66c4('0x85'))](_0x66c4('0x86'));}_0x4e8609=_[_0x66c4('0x87')](_[_0x66c4('0x45')](_0x366d0d),[_0x66c4('0x88'),_0x66c4('0x89')]);_0x3c029e=_[_0x66c4('0x87')](_[_0x66c4('0x45')](_0x366d0d),[_0x66c4('0x88'),_0x66c4('0x89'),_0x66c4('0x8a'),_0x66c4('0x8b')]);_0x4773fc[_0x66c4('0x5f')]={'mapKey':_0x66c4('0x8c')};if(_0x4773fc['account'][_0x66c4('0x41')]&&_0x4773fc[_0x66c4('0x83')][_0x66c4('0x41')]==='twilio'){_0x4773fc['body'][_0x66c4('0x8d')]=_0x2f83e8[_0x66c4('0x5f')][_0x66c4('0x8e')][_0x66c4('0x8f')](_0x66c4('0x90'),'');_0x4773fc[_0x66c4('0x5f')]['body']=_0x2f83e8['body'][_0x66c4('0x91')];_0x4773fc['body'][_0x66c4('0x92')]=_0x2f83e8[_0x66c4('0x5f')]['MessageSid'];}if(_0x4773fc[_0x66c4('0x5f')]['id']){delete _0x4773fc[_0x66c4('0x5f')]['id'];}if(_[_0x66c4('0x93')](_0x4773fc[_0x66c4('0x5f')]['from'])){throw new db[(_0x66c4('0x94'))]['ValidationError'](_0x66c4('0x95'));}if(_[_0x66c4('0x93')](_0x4773fc['body']['body'])||_0x4773fc['body'][_0x66c4('0x5f')]===''){throw new db['Sequelize'][(_0x66c4('0x85'))](_0x66c4('0x96'));}if(_[_0x66c4('0x93')](_0x4773fc['body']['mapKey'])){throw new db[(_0x66c4('0x94'))][(_0x66c4('0x85'))](_0x66c4('0x97')+_0x3c029e);}if(!_[_0x66c4('0x98')](_0x3c029e,_0x4773fc[_0x66c4('0x5f')]['mapKey'])){throw new db[(_0x66c4('0x94'))]['ValidationError'](_0x66c4('0x99')+_0x3c029e);}_0x250669[_0x4773fc[_0x66c4('0x5f')]['mapKey']]=_0x4773fc[_0x66c4('0x5f')][_0x66c4('0x8d')];return db[_0x66c4('0x9a')][_0x66c4('0x5d')]({'where':{'id':_0x4773fc['account'][_0x66c4('0x8b')]},'include':[{'model':db[_0x66c4('0x84')],'as':'Contacts','where':_0x250669,'limit':0x1,'order':[[_0x66c4('0x89'),_0x66c4('0x9b')]]}]});})['then'](handleEntityNotFound(_0x52af5f,null))[_0x66c4('0x21')](function(_0x33b86c){if(_0x33b86c){_0x4773fc[_0x66c4('0x9c')]=_[_0x66c4('0x9d')](_0x33b86c,['Contacts']);if(_0x33b86c[_0x66c4('0x9e')][_0x66c4('0x57')]){return _0x33b86c[_0x66c4('0x9e')][0x0];}var _0x550f21=_[_0x66c4('0x9f')](_0x4773fc[_0x66c4('0x5f')],{'firstName':_0x4773fc['body']['from'],'ListId':_0x33b86c['id']});_0x550f21[_0x4773fc[_0x66c4('0x5f')]['mapKey']]=_0x4773fc[_0x66c4('0x5f')]['from'];return db[_0x66c4('0x84')]['create'](_0x550f21,{'fields':_0x4e8609,'raw':!![]});}})[_0x66c4('0x21')](handleEntityNotFound(_0x52af5f,null))[_0x66c4('0x21')](function(_0x316637){if(_0x316637){_0x4773fc[_0x66c4('0xa0')]=_0x316637;var _0x4c8d0b={'ContactId':_0x316637['id'],'phone':_0x4773fc[_0x66c4('0x5f')][_0x66c4('0x8d')],'WhatsappAccountId':_0x2f83e8[_0x66c4('0x56')]['id']};var _0x1f28ee={'ContactId':_0x316637['id'],'WhatsappAccountId':_0x2f83e8[_0x66c4('0x56')]['id'],'closed':![]};return db[_0x66c4('0xa1')]['find']({'where':_0x1f28ee})[_0x66c4('0x21')](function(_0x443ca2){if(_0x443ca2){return[_0x443ca2,![]];}return db[_0x66c4('0xa1')][_0x66c4('0x58')](_0x4c8d0b)[_0x66c4('0x21')](function(_0x1ec254){return[_0x1ec254,!![]];});});}})[_0x66c4('0xa2')](function(_0x469448,_0x128686){_0x4773fc[_0x66c4('0xa3')]=_0x469448[_0x66c4('0x36')]({'plain':!![]});_0x4773fc[_0x66c4('0xa3')][_0x66c4('0xa4')]=![];if(_0x128686){if(_0x4773fc[_0x66c4('0x83')][_0x66c4('0xa5')]){_0x4773fc[_0x66c4('0x80')]['push']({'id':0x0,'priority':_0x4773fc[_0x66c4('0x80')][_0x66c4('0x57')]+0x1,'app':'close','appdata':_0x66c4('0xa6'),'interval':_0x66c4('0xa7')});}_0x4773fc[_0x66c4('0xa3')]['created']=!![];}return db[_0x66c4('0xa8')][_0x66c4('0x58')]({'phone':_0x4773fc['body']['from'],'messageId':_0x4773fc[_0x66c4('0x5f')][_0x66c4('0x92')],'body':_0x4773fc[_0x66c4('0x5f')][_0x66c4('0x5f')],'WhatsappAccountId':_0x2f83e8[_0x66c4('0x56')]['id'],'WhatsappInteractionId':_0x469448['id'],'direction':'in','ContactId':_0x469448[_0x66c4('0xa9')],'AttachmentId':_0x4773fc['body'][_0x66c4('0xaa')]});})['then'](function(_0x80e1c0){_0x4773fc['message']=_0x80e1c0;if(_0x4773fc[_0x66c4('0xa3')]['UserId']){return db[_0x66c4('0x75')][_0x66c4('0x5d')]({'attributes':['id','name'],'where':{'id':_0x4773fc[_0x66c4('0xa3')][_0x66c4('0xab')]}})[_0x66c4('0x21')](function(_0x98c24f){if(_0x98c24f){_0x4773fc[_0x66c4('0x80')]['unshift']({'id':0x0,'priority':0x0,'app':_0x66c4('0xac'),'appdata':_0x98c24f['name']+','+(_0x4773fc[_0x66c4('0x83')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x66c4('0xad'),_0x66c4('0xae'),_0x4773fc);});}return respondWithRpcPromise('Start',_0x66c4('0xae'),_0x4773fc);})[_0x66c4('0x21')](function(_0x72f76c){if(_0x72f76c){var _0xfbeefe=0xc8;var _0x4e4a98=_0x66c4('0xaf');logger['info'](_0x66c4('0x25'),_0x4e4a98,_0xfbeefe,_0x66c4('0xb0'));logger[_0x66c4('0x24')](_0x66c4('0xb1'),_0x4e4a98,_0xfbeefe,_0x66c4('0xb0'),JSON[_0x66c4('0xb2')](_0x72f76c));if(_0x4773fc[_0x66c4('0x83')][_0x66c4('0x41')]===_0x66c4('0xb3')){return _0x52af5f[_0x66c4('0x2b')](_0xfbeefe)[_0x66c4('0x32')]('Content-Type',_0x66c4('0xb4'))['send'](_0x66c4('0xb5'));}else{return _0x52af5f['status'](_0xfbeefe)[_0x66c4('0x2d')](_0x72f76c);}}})[_0x66c4('0x2a')](handleError(_0x52af5f,null));};exports[_0x66c4('0x3b')]=function(_0xf3a99e,_0x25f91c,_0x101c17){var _0x8ea31e,_0x15260b,_0x2c1001;if(_[_0x66c4('0x93')](_0xf3a99e[_0x66c4('0x5f')][_0x66c4('0x5f')])||_0xf3a99e[_0x66c4('0x5f')][_0x66c4('0x5f')]===''){throw new db['Sequelize'][(_0x66c4('0x85'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xf3a99e[_0x66c4('0x5f')]['to'])){throw new db[(_0x66c4('0x94'))][(_0x66c4('0x85'))](_0x66c4('0xb6'));}_0x8ea31e=_0xf3a99e[_0x66c4('0x5f')]['to'];return db[_0x66c4('0x3e')][_0x66c4('0x5d')]({'where':{'id':_0xf3a99e[_0x66c4('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x66c4('0xb7'),'include':[{'model':db[_0x66c4('0x84')],'as':_0x66c4('0x9e'),'where':{'mobile':_0x8ea31e},'limit':0x1,'order':[['updatedAt',_0x66c4('0x9b')]]}]}]})[_0x66c4('0x21')](handleEntityNotFound(_0x25f91c,null))[_0x66c4('0x21')](function(_0x47725d){if(_0x47725d&&_0x47725d[_0x66c4('0xb7')]){_0x15260b=_0x47725d['get']({'plain':!![]});if(_0x15260b[_0x66c4('0xb7')]&&_0x15260b[_0x66c4('0xb7')]['Contacts'][_0x66c4('0x57')]){return _0x15260b[_0x66c4('0xb7')][_0x66c4('0x9e')][0x0];}return db[_0x66c4('0x84')][_0x66c4('0x58')](_[_0x66c4('0x9f')](_0xf3a99e['body'],{'firstName':_0x8ea31e,'mobile':_0x8ea31e,'phone':_0x8ea31e,'ListId':_0x15260b['ListId']}));}})[_0x66c4('0x21')](handleEntityNotFound(_0x25f91c,null))[_0x66c4('0x21')](function(_0x3ef2f4){if(_0x3ef2f4){_0x2c1001=_0x3ef2f4;return db[_0x66c4('0xa1')][_0x66c4('0x5d')]({'where':{'ContactId':_0x2c1001['id'],'closed':![],'WhatsappAccountId':_0x15260b['id']}})[_0x66c4('0x21')](function(_0x116d07){if(_0x116d07){return[_0x116d07,![]];}return db[_0x66c4('0xa1')][_0x66c4('0x58')]({'UserId':_0xf3a99e[_0x66c4('0x59')]['id'],'ContactId':_0x2c1001['id'],'WhatsappAccountId':_0x15260b['id'],'phone':_0x8ea31e,'firstMsgDirection':_0x66c4('0xb8'),'Messages':[_['merge'](_0xf3a99e[_0x66c4('0x5f')],{'read':![],'body':_0xf3a99e[_0x66c4('0x5f')][_0x66c4('0x5f')],'phone':_0x8ea31e,'WhatsappAccountId':_0x15260b['id'],'UserId':_0xf3a99e[_0x66c4('0x59')]['id'],'ContactId':_0x2c1001['id']})]},{'include':[{'model':db[_0x66c4('0xa8')],'as':_0x66c4('0xb9')}]})['then'](function(_0x41a51b){return[_0x41a51b,!![]];});});}})[_0x66c4('0xa2')](function(_0x190679,_0xcdd4d8){if(_0xcdd4d8){return _0x190679;}return db['WhatsappMessage'][_0x66c4('0x58')](_[_0x66c4('0x4f')](_0xf3a99e[_0x66c4('0x5f')],{'read':![],'body':_0xf3a99e['body']['body'],'phone':_0x8ea31e,'WhatsappAccountId':_0x15260b['id'],'WhatsappInteractionId':_0x190679['id'],'UserId':_0xf3a99e[_0x66c4('0x59')]['id'],'ContactId':_0x2c1001['id']}))[_0x66c4('0x21')](function(_0x15a043){_0x190679[_0x66c4('0xba')][_0x66c4('0xb9')]=[];_0x190679[_0x66c4('0xba')][_0x66c4('0xb9')]['push'](_0x15a043['dataValues']);return _0x190679;});})[_0x66c4('0x21')](respondWithResult(_0x25f91c,null))[_0x66c4('0x2a')](handleError(_0x25f91c,null));}; \ No newline at end of file +var _0x2fd3=['http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','WhatsappAccounts','status','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','WhatsappAccount','include','findAll','rows','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','merge','removeDispositions','CannedAnswer','order','options','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','bulkCreate','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','replace','Body','messageId','MessageSid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','debug','twilio','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','jayson/promise'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x2fd3,0x15d));var _0x32fd=function(_0x1eb164,_0x2c2088){_0x1eb164=_0x1eb164-0x0;var _0x515422=_0x2fd3[_0x1eb164];return _0x515422;};'use strict';var emlformat=require(_0x32fd('0x0'));var rimraf=require(_0x32fd('0x1'));var zipdir=require(_0x32fd('0x2'));var jsonpatch=require(_0x32fd('0x3'));var rp=require(_0x32fd('0x4'));var moment=require('moment');var BPromise=require(_0x32fd('0x5'));var Mustache=require(_0x32fd('0x6'));var util=require(_0x32fd('0x7'));var path=require(_0x32fd('0x8'));var sox=require('sox');var csv=require(_0x32fd('0x9'));var ejs=require(_0x32fd('0xa'));var fs=require('fs');var fs_extra=require(_0x32fd('0xb'));var _=require(_0x32fd('0xc'));var squel=require(_0x32fd('0xd'));var crypto=require(_0x32fd('0xe'));var jsforce=require(_0x32fd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x32fd('0x9'));var querystring=require(_0x32fd('0x10'));var Papa=require(_0x32fd('0x11'));var Redis=require(_0x32fd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x32fd('0x13'));var as=require(_0x32fd('0x14'));var hardwareService=require(_0x32fd('0x15'));var logger=require(_0x32fd('0x16'))(_0x32fd('0x17'));var utils=require(_0x32fd('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x32fd('0x19'))['db'];config[_0x32fd('0x1a')]=_['defaults'](config[_0x32fd('0x1a')],{'host':_0x32fd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32fd('0x1a')]));require(_0x32fd('0x1c'))[_0x32fd('0x1d')](socket);var jayson=require(_0x32fd('0x1e'));var client=jayson['client'][_0x32fd('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x294b7c,_0x59a591,_0x5023d7,_0x37cd18){return new BPromise(function(_0x40bcaf,_0x5a839e){var _0x1f7b89=_0x37cd18||client;return _0x1f7b89[_0x32fd('0x20')](_0x294b7c,_0x5023d7)[_0x32fd('0x21')](function(_0x316743){logger[_0x32fd('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x59a591,_0x32fd('0x23'));logger['debug'](_0x32fd('0x24'),_0x59a591,'request\x20sent',JSON[_0x32fd('0x25')](_0x316743));if(_0x316743[_0x32fd('0x26')]){if(_0x316743['error'][_0x32fd('0x27')]===0x1f4){logger[_0x32fd('0x26')](_0x32fd('0x28'),_0x59a591,_0x316743['error'][_0x32fd('0x29')]);return _0x5a839e(_0x316743[_0x32fd('0x26')]['message']);}logger[_0x32fd('0x26')](_0x32fd('0x28'),_0x59a591,_0x316743['error'][_0x32fd('0x29')]);return _0x40bcaf(_0x316743[_0x32fd('0x26')][_0x32fd('0x29')]);}else{logger[_0x32fd('0x22')](_0x32fd('0x28'),_0x59a591,'request\x20sent');_0x40bcaf(_0x316743[_0x32fd('0x2a')][_0x32fd('0x29')]);}})[_0x32fd('0x2b')](function(_0xb677c6){logger[_0x32fd('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x59a591,_0xb677c6);_0x5a839e(_0xb677c6);});});}function respondWithStatusCode(_0x4d2c96,_0x4aef20){_0x4aef20=_0x4aef20||0xcc;return function(_0x1b7be2){if(_0x1b7be2){return _0x4d2c96[_0x32fd('0x2c')](_0x4aef20);}return _0x4d2c96['status'](_0x4aef20)[_0x32fd('0x2d')]();};}function respondWithResult(_0x5d8c7c,_0x2301ab){_0x2301ab=_0x2301ab||0xc8;return function(_0x2ee4f0){if(_0x2ee4f0){return _0x5d8c7c['status'](_0x2301ab)[_0x32fd('0x2e')](_0x2ee4f0);}};}function respondWithFilteredResult(_0x236821,_0x1a836d){return function(_0x22a5d3){if(_0x22a5d3){var _0x147fe0=typeof _0x1a836d[_0x32fd('0x2f')]==='undefined'&&typeof _0x1a836d[_0x32fd('0x30')]===_0x32fd('0x31');var _0x59d772=_0x22a5d3[_0x32fd('0x32')];var _0x214a2f=_0x147fe0?0x0:_0x1a836d[_0x32fd('0x2f')];var _0x3685d6=_0x147fe0?_0x22a5d3['count']:_0x1a836d[_0x32fd('0x2f')]+_0x1a836d[_0x32fd('0x30')];var _0x5be7e2;if(_0x3685d6>=_0x59d772){_0x3685d6=_0x59d772;_0x5be7e2=0xc8;}else{_0x5be7e2=0xce;}_0x236821['status'](_0x5be7e2);return _0x236821[_0x32fd('0x33')](_0x32fd('0x34'),_0x214a2f+'-'+_0x3685d6+'/'+_0x59d772)[_0x32fd('0x2e')](_0x22a5d3);}return null;};}function patchUpdates(_0x2aec43){return function(_0x13a2c6){try{jsonpatch[_0x32fd('0x35')](_0x13a2c6,_0x2aec43,!![]);}catch(_0x563853){return BPromise[_0x32fd('0x36')](_0x563853);}return _0x13a2c6['save']();};}function saveUpdates(_0x4f729f,_0x53072f){return function(_0x3755e5){if(_0x3755e5){return _0x3755e5[_0x32fd('0x37')](_0x4f729f)[_0x32fd('0x21')](function(_0x1d6396){return _0x1d6396;});}return null;};}function removeEntity(_0x1f47f2,_0x1de9aa){return function(_0x487409){if(_0x487409){return _0x487409[_0x32fd('0x38')]()['then'](function(){var _0x8e7a9=_0x487409[_0x32fd('0x39')]({'plain':!![]});var _0x7fe879=_0x32fd('0x3a');return db['UserProfileResource'][_0x32fd('0x38')]({'where':{'type':_0x7fe879,'resourceId':_0x8e7a9['id']}})[_0x32fd('0x21')](function(){return _0x487409;});})[_0x32fd('0x21')](function(){_0x1f47f2[_0x32fd('0x3b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x521637,_0x133bbb){return function(_0x3f588a){if(!_0x3f588a){_0x521637[_0x32fd('0x2c')](0x194);}return _0x3f588a;};}function handleError(_0x220696,_0xb3a0b2){_0xb3a0b2=_0xb3a0b2||0x1f4;return function(_0x45611c){logger[_0x32fd('0x26')](_0x45611c[_0x32fd('0x3c')]);if(_0x45611c['name']){delete _0x45611c['name'];}_0x220696[_0x32fd('0x3b')](_0xb3a0b2)[_0x32fd('0x3d')](_0x45611c);};}exports[_0x32fd('0x3e')]=function(_0x552057,_0x4a8be1){var _0x54e0a3={'include':[{'model':db[_0x32fd('0x3f')],'as':_0x32fd('0x40')}]},_0x391f59={},_0x4fc409={'count':0x0,'rows':[]};var _0x4cf620=_[_0x32fd('0x41')](db['WhatsappAccount'][_0x32fd('0x42')],function(_0x227417){return{'name':_0x227417['fieldName'],'type':_0x227417[_0x32fd('0x43')][_0x32fd('0x44')]};});_0x391f59[_0x32fd('0x45')]=_[_0x32fd('0x41')](_0x4cf620,_0x32fd('0x46'));_0x391f59[_0x32fd('0x47')]=_[_0x32fd('0x48')](_0x552057[_0x32fd('0x47')]);_0x391f59['filters']=_[_0x32fd('0x49')](_0x391f59[_0x32fd('0x45')],_0x391f59[_0x32fd('0x47')]);_0x54e0a3[_0x32fd('0x4a')]=_[_0x32fd('0x49')](_0x391f59[_0x32fd('0x45')],qs[_0x32fd('0x4b')](_0x552057[_0x32fd('0x47')][_0x32fd('0x4b')]));_0x54e0a3[_0x32fd('0x4a')]=_0x54e0a3['attributes'][_0x32fd('0x4c')]?_0x54e0a3[_0x32fd('0x4a')]:_0x391f59[_0x32fd('0x45')];if(!_0x552057[_0x32fd('0x47')][_0x32fd('0x4d')](_0x32fd('0x4e'))){_0x54e0a3['limit']=qs[_0x32fd('0x30')](_0x552057['query'][_0x32fd('0x30')]);_0x54e0a3[_0x32fd('0x2f')]=qs[_0x32fd('0x2f')](_0x552057[_0x32fd('0x47')][_0x32fd('0x2f')]);}_0x54e0a3['order']=qs[_0x32fd('0x4f')](_0x552057[_0x32fd('0x47')][_0x32fd('0x4f')]);_0x54e0a3[_0x32fd('0x50')]=qs[_0x32fd('0x51')](_[_0x32fd('0x52')](_0x552057[_0x32fd('0x47')],_0x391f59['filters']),_0x4cf620);if(_0x552057['query'][_0x32fd('0x53')]){_0x54e0a3[_0x32fd('0x50')]=_['merge'](_0x54e0a3[_0x32fd('0x50')],{'$or':_[_0x32fd('0x41')](_0x4cf620,function(_0x158252){if(_0x158252[_0x32fd('0x43')]!==_0x32fd('0x54')){var _0x1435f2={};_0x1435f2[_0x158252[_0x32fd('0x46')]]={'$like':'%'+_0x552057['query']['filter']+'%'};return _0x1435f2;}})});}_0x54e0a3=_['merge']({},_0x54e0a3,_0x552057['options']);var _0x294b2e={'where':_0x54e0a3[_0x32fd('0x50')]};return db[_0x32fd('0x55')][_0x32fd('0x32')](_0x294b2e)[_0x32fd('0x21')](function(_0x2d5e14){_0x4fc409['count']=_0x2d5e14;if(_0x552057[_0x32fd('0x47')]['includeAll']){_0x54e0a3[_0x32fd('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x32fd('0x57')](_0x54e0a3);})[_0x32fd('0x21')](function(_0x8b3cf4){_0x4fc409[_0x32fd('0x58')]=_0x8b3cf4;return _0x4fc409;})[_0x32fd('0x21')](respondWithFilteredResult(_0x4a8be1,_0x54e0a3))[_0x32fd('0x2b')](handleError(_0x4a8be1,null));};exports[_0x32fd('0x59')]=function(_0x5c7db3,_0xb10dad){var _0x3a694b={'raw':![],'where':{'id':_0x5c7db3['params']['id']},'include':[{'model':db[_0x32fd('0x3f')],'as':'mandatoryDispositionPause'}]},_0x587370={};_0x587370[_0x32fd('0x45')]=_['keys'](db[_0x32fd('0x55')][_0x32fd('0x42')]);_0x587370[_0x32fd('0x47')]=_[_0x32fd('0x48')](_0x5c7db3[_0x32fd('0x47')]);_0x587370['filters']=_[_0x32fd('0x49')](_0x587370[_0x32fd('0x45')],_0x587370['query']);_0x3a694b[_0x32fd('0x4a')]=_['intersection'](_0x587370[_0x32fd('0x45')],qs[_0x32fd('0x4b')](_0x5c7db3['query'][_0x32fd('0x4b')]));_0x3a694b[_0x32fd('0x4a')]=_0x3a694b[_0x32fd('0x4a')][_0x32fd('0x4c')]?_0x3a694b['attributes']:_0x587370['model'];if(_0x5c7db3['query'][_0x32fd('0x5a')]){_0x3a694b[_0x32fd('0x56')]=[{'all':!![]}];}_0x3a694b=_['merge']({},_0x3a694b,_0x5c7db3['options']);return db[_0x32fd('0x55')]['find'](_0x3a694b)[_0x32fd('0x21')](handleEntityNotFound(_0xb10dad,null))[_0x32fd('0x21')](respondWithResult(_0xb10dad,null))[_0x32fd('0x2b')](handleError(_0xb10dad,null));};exports['create']=function(_0x38163c,_0x138310){return db[_0x32fd('0x55')][_0x32fd('0x5b')](_0x38163c[_0x32fd('0x5c')],{})[_0x32fd('0x21')](function(_0x48d289){var _0xf60e52=_0x38163c[_0x32fd('0x5d')][_0x32fd('0x39')]({'plain':!![]});if(!_0xf60e52)throw new Error(_0x32fd('0x5e'));if(_0xf60e52['role']===_0x32fd('0x5d')){var _0x5efba4=_0x48d289[_0x32fd('0x39')]({'plain':!![]});var _0x11f565=_0x32fd('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x11f565,'userProfileId':_0xf60e52[_0x32fd('0x5f')]},'raw':!![]})['then'](function(_0x4dcdee){if(_0x4dcdee&&_0x4dcdee[_0x32fd('0x60')]===0x0){return db['UserProfileResource'][_0x32fd('0x5b')]({'name':_0x5efba4['name'],'resourceId':_0x5efba4['id'],'type':_0x4dcdee[_0x32fd('0x46')],'sectionId':_0x4dcdee['id']},{})[_0x32fd('0x21')](function(){return _0x48d289;});}else{return _0x48d289;}})[_0x32fd('0x2b')](function(_0x104471){logger[_0x32fd('0x26')](_0x32fd('0x61'),_0x104471);throw _0x104471;});}return _0x48d289;})['then'](respondWithResult(_0x138310,0xc9))[_0x32fd('0x2b')](handleError(_0x138310,null));};exports[_0x32fd('0x37')]=function(_0x5442f3,_0xc80865){if(_0x5442f3['body']['id']){delete _0x5442f3[_0x32fd('0x5c')]['id'];}return db[_0x32fd('0x55')][_0x32fd('0x62')]({'where':{'id':_0x5442f3[_0x32fd('0x63')]['id']},'include':[{'model':db[_0x32fd('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xc80865,null))[_0x32fd('0x21')](saveUpdates(_0x5442f3[_0x32fd('0x5c')],null))[_0x32fd('0x21')](respondWithResult(_0xc80865,null))['catch'](handleError(_0xc80865,null));};exports[_0x32fd('0x38')]=function(_0x67bba7,_0x15a144){return db[_0x32fd('0x55')][_0x32fd('0x62')]({'where':{'id':_0x67bba7[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x15a144,null))[_0x32fd('0x21')](removeEntity(_0x15a144,null))[_0x32fd('0x2b')](handleError(_0x15a144,null));};exports[_0x32fd('0x64')]=function(_0xc9a2f2,_0x4849b1){return db[_0x32fd('0x55')][_0x32fd('0x64')]()[_0x32fd('0x21')](respondWithResult(_0x4849b1,null))[_0x32fd('0x2b')](handleError(_0x4849b1,null));};exports[_0x32fd('0x65')]=function(_0x5ca536,_0x25da65,_0x49330f){if(_0x5ca536[_0x32fd('0x5c')]['id']){delete _0x5ca536[_0x32fd('0x5c')]['id'];}return db['WhatsappAccount'][_0x32fd('0x62')]({'where':{'id':_0x5ca536[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x25da65,null))[_0x32fd('0x21')](function(_0x3b9929){if(_0x3b9929){_0x5ca536['body'][_0x32fd('0x66')]=_0x3b9929['id'];return db[_0x32fd('0x67')][_0x32fd('0x5b')](_0x5ca536[_0x32fd('0x5c')]);}})[_0x32fd('0x21')](respondWithResult(_0x25da65,null))[_0x32fd('0x2b')](handleError(_0x25da65,null));};exports[_0x32fd('0x68')]=function(_0x478604,_0x231f1c,_0x5241d1){var _0x4f44b2={'raw':![],'where':{}};var _0x555965={};var _0x35de8d={'count':0x0,'rows':[]};return db[_0x32fd('0x55')][_0x32fd('0x69')]({'where':{'id':_0x478604[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x231f1c,null))[_0x32fd('0x21')](function(_0x1110dd){if(_0x1110dd){_0x555965[_0x32fd('0x45')]=_[_0x32fd('0x48')](db['Disposition'][_0x32fd('0x42')]);_0x555965[_0x32fd('0x47')]=_['keys'](_0x478604[_0x32fd('0x47')]);_0x555965[_0x32fd('0x51')]=_['intersection'](_0x555965['model'],_0x555965[_0x32fd('0x47')]);_0x4f44b2[_0x32fd('0x4a')]=_[_0x32fd('0x49')](_0x555965['model'],qs['fields'](_0x478604[_0x32fd('0x47')][_0x32fd('0x4b')]));_0x4f44b2[_0x32fd('0x4a')]=_0x4f44b2['attributes']['length']?_0x4f44b2[_0x32fd('0x4a')]:_0x555965[_0x32fd('0x45')];if(!_0x478604[_0x32fd('0x47')][_0x32fd('0x4d')](_0x32fd('0x4e'))){_0x4f44b2[_0x32fd('0x30')]=qs[_0x32fd('0x30')](_0x478604[_0x32fd('0x47')]['limit']);_0x4f44b2[_0x32fd('0x2f')]=qs[_0x32fd('0x2f')](_0x478604[_0x32fd('0x47')]['offset']);}_0x4f44b2['order']=qs[_0x32fd('0x4f')](_0x478604[_0x32fd('0x47')]['sort']);_0x4f44b2['where']=qs[_0x32fd('0x51')](_['pick'](_0x478604[_0x32fd('0x47')],_0x555965[_0x32fd('0x51')]));_0x4f44b2[_0x32fd('0x50')]['WhatsappAccountId']=_0x1110dd['id'];if(_0x478604[_0x32fd('0x47')]['filter']){_0x4f44b2['where']=_[_0x32fd('0x6a')](_0x4f44b2['where'],{'$or':_[_0x32fd('0x41')](_0x4f44b2[_0x32fd('0x4a')],function(_0x220ca3){var _0x3344f6={};_0x3344f6[_0x220ca3]={'$like':'%'+_0x478604[_0x32fd('0x47')]['filter']+'%'};return _0x3344f6;})});}_0x4f44b2=_['merge']({},_0x4f44b2,_0x478604['options']);return db[_0x32fd('0x67')][_0x32fd('0x32')]({'where':_0x4f44b2[_0x32fd('0x50')]})[_0x32fd('0x21')](function(_0x35db6f){_0x35de8d[_0x32fd('0x32')]=_0x35db6f;if(_0x478604['query'][_0x32fd('0x5a')]){_0x4f44b2[_0x32fd('0x56')]=[{'all':!![]}];}return db[_0x32fd('0x67')][_0x32fd('0x57')](_0x4f44b2);})[_0x32fd('0x21')](function(_0x3a3540){_0x35de8d['rows']=_0x3a3540;return _0x35de8d;});}})[_0x32fd('0x21')](respondWithFilteredResult(_0x231f1c,_0x4f44b2))[_0x32fd('0x2b')](handleError(_0x231f1c,null));};exports[_0x32fd('0x6b')]=function(_0x47de62,_0x11cf22,_0x5c2d40){return db[_0x32fd('0x55')][_0x32fd('0x62')]({'where':{'id':_0x47de62['params']['id']}})['then'](handleEntityNotFound(_0x11cf22,null))[_0x32fd('0x21')](function(_0x3ea2a5){if(_0x3ea2a5){return _0x3ea2a5[_0x32fd('0x6b')](_0x47de62[_0x32fd('0x47')]['ids']);}})[_0x32fd('0x21')](respondWithStatusCode(_0x11cf22,null))['catch'](handleError(_0x11cf22,null));};exports['addAnswer']=function(_0x334a76,_0x482d1e,_0x3ab0be){if(_0x334a76[_0x32fd('0x5c')]['id']){delete _0x334a76[_0x32fd('0x5c')]['id'];}return db[_0x32fd('0x55')][_0x32fd('0x62')]({'where':{'id':_0x334a76[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x482d1e,null))[_0x32fd('0x21')](function(_0x5def98){if(_0x5def98){_0x334a76[_0x32fd('0x5c')][_0x32fd('0x66')]=_0x5def98['id'];return db[_0x32fd('0x6c')][_0x32fd('0x5b')](_0x334a76[_0x32fd('0x5c')]);}})[_0x32fd('0x21')](respondWithResult(_0x482d1e,null))[_0x32fd('0x2b')](handleError(_0x482d1e,null));};exports['getAnswers']=function(_0xaf5abd,_0x38da76,_0x43307b){var _0x236dc8={'raw':![],'where':{}};var _0x325d9d={};var _0x13567a={'count':0x0,'rows':[]};return db[_0x32fd('0x55')][_0x32fd('0x69')]({'where':{'id':_0xaf5abd[_0x32fd('0x63')]['id']}})['then'](handleEntityNotFound(_0x38da76,null))[_0x32fd('0x21')](function(_0x43b305){if(_0x43b305){_0x325d9d[_0x32fd('0x45')]=_[_0x32fd('0x48')](db[_0x32fd('0x6c')]['rawAttributes']);_0x325d9d[_0x32fd('0x47')]=_[_0x32fd('0x48')](_0xaf5abd['query']);_0x325d9d[_0x32fd('0x51')]=_[_0x32fd('0x49')](_0x325d9d['model'],_0x325d9d[_0x32fd('0x47')]);_0x236dc8[_0x32fd('0x4a')]=_[_0x32fd('0x49')](_0x325d9d[_0x32fd('0x45')],qs['fields'](_0xaf5abd['query'][_0x32fd('0x4b')]));_0x236dc8['attributes']=_0x236dc8[_0x32fd('0x4a')][_0x32fd('0x4c')]?_0x236dc8['attributes']:_0x325d9d[_0x32fd('0x45')];if(!_0xaf5abd[_0x32fd('0x47')][_0x32fd('0x4d')](_0x32fd('0x4e'))){_0x236dc8['limit']=qs[_0x32fd('0x30')](_0xaf5abd['query']['limit']);_0x236dc8[_0x32fd('0x2f')]=qs[_0x32fd('0x2f')](_0xaf5abd[_0x32fd('0x47')][_0x32fd('0x2f')]);}_0x236dc8[_0x32fd('0x6d')]=qs[_0x32fd('0x4f')](_0xaf5abd['query']['sort']);_0x236dc8[_0x32fd('0x50')]=qs[_0x32fd('0x51')](_[_0x32fd('0x52')](_0xaf5abd[_0x32fd('0x47')],_0x325d9d[_0x32fd('0x51')]));_0x236dc8[_0x32fd('0x50')][_0x32fd('0x66')]=_0x43b305['id'];if(_0xaf5abd[_0x32fd('0x47')][_0x32fd('0x53')]){_0x236dc8[_0x32fd('0x50')]=_[_0x32fd('0x6a')](_0x236dc8['where'],{'$or':_['map'](_0x236dc8[_0x32fd('0x4a')],function(_0x4361ee){var _0xd3227b={};_0xd3227b[_0x4361ee]={'$like':'%'+_0xaf5abd[_0x32fd('0x47')][_0x32fd('0x53')]+'%'};return _0xd3227b;})});}_0x236dc8=_[_0x32fd('0x6a')]({},_0x236dc8,_0xaf5abd[_0x32fd('0x6e')]);return db[_0x32fd('0x6c')][_0x32fd('0x32')]({'where':_0x236dc8[_0x32fd('0x50')]})[_0x32fd('0x21')](function(_0x45d549){_0x13567a[_0x32fd('0x32')]=_0x45d549;if(_0xaf5abd[_0x32fd('0x47')][_0x32fd('0x5a')]){_0x236dc8['include']=[{'all':!![]}];}return db[_0x32fd('0x6c')]['findAll'](_0x236dc8);})[_0x32fd('0x21')](function(_0x484a11){_0x13567a['rows']=_0x484a11;return _0x13567a;});}})['then'](respondWithFilteredResult(_0x38da76,_0x236dc8))[_0x32fd('0x2b')](handleError(_0x38da76,null));};exports[_0x32fd('0x6f')]=function(_0x38939a,_0x5e7f20,_0x5d6f5f){return db[_0x32fd('0x55')][_0x32fd('0x62')]({'where':{'id':_0x38939a[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x5e7f20,null))['then'](function(_0x3c8b20){if(_0x3c8b20){return _0x3c8b20[_0x32fd('0x6f')](_0x38939a[_0x32fd('0x47')][_0x32fd('0x70')]);}})['then'](respondWithStatusCode(_0x5e7f20,null))['catch'](handleError(_0x5e7f20,null));};exports['addAgents']=function(_0xe6ca8f,_0x33e1cd,_0x1ee9c6){return db[_0x32fd('0x55')][_0x32fd('0x62')]({'where':{'id':_0xe6ca8f[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x33e1cd,null))[_0x32fd('0x21')](function(_0x52c175){if(_0x52c175){return _0x52c175[_0x32fd('0x71')](_0xe6ca8f[_0x32fd('0x5c')][_0x32fd('0x70')],_[_0x32fd('0x72')](_0xe6ca8f['body'],[_0x32fd('0x70'),'id'])||{})[_0x32fd('0x73')](function(_0x287c3e){for(var _0x31cf9a=0x0;_0x31cf9a<_0xe6ca8f[_0x32fd('0x5c')][_0x32fd('0x70')][_0x32fd('0x4c')];_0x31cf9a+=0x1){socket[_0x32fd('0x74')](_0x32fd('0x75'),{'UserId':Number(_0xe6ca8f[_0x32fd('0x5c')]['ids'][_0x31cf9a]),'WhatsappAccountId':Number(_0xe6ca8f[_0x32fd('0x63')]['id'])});}return _0x287c3e;});}})[_0x32fd('0x21')](respondWithResult(_0x33e1cd,null))[_0x32fd('0x2b')](handleError(_0x33e1cd,null));};exports['removeAgents']=function(_0x444757,_0xf99b0c,_0x1e3311){return db[_0x32fd('0x55')]['find']({'where':{'id':_0x444757[_0x32fd('0x63')]['id']}})['then'](handleEntityNotFound(_0xf99b0c,null))[_0x32fd('0x21')](function(_0x5c7acd){if(_0x5c7acd){return _0x5c7acd[_0x32fd('0x76')](_0x444757[_0x32fd('0x47')]['ids'])[_0x32fd('0x21')](function(){if(_[_0x32fd('0x77')](_0x444757[_0x32fd('0x47')]['ids'])){for(var _0x12605e=0x0;_0x12605e<_0x444757[_0x32fd('0x47')][_0x32fd('0x70')][_0x32fd('0x4c')];_0x12605e+=0x1){socket['emit'](_0x32fd('0x78'),{'UserId':Number(_0x444757['query'][_0x32fd('0x70')][_0x12605e]),'WhatsappAccountId':Number(_0x444757[_0x32fd('0x63')]['id'])});}}else{socket[_0x32fd('0x74')](_0x32fd('0x78'),{'UserId':Number(_0x444757[_0x32fd('0x47')][_0x32fd('0x70')]),'WhatsappAccountId':Number(_0x444757[_0x32fd('0x63')]['id'])});}});}})[_0x32fd('0x21')](respondWithStatusCode(_0xf99b0c,null))['catch'](handleError(_0xf99b0c,null));};exports[_0x32fd('0x79')]=function(_0x841f3a,_0x437ec7,_0x1fffb8){var _0x459732={};var _0x5c3808={};var _0x272347;var _0x58110e;return db[_0x32fd('0x55')]['findOne']({'where':{'id':_0x841f3a[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x437ec7,null))[_0x32fd('0x21')](function(_0x52bf2c){if(_0x52bf2c){_0x272347=_0x52bf2c;_0x5c3808[_0x32fd('0x45')]=_[_0x32fd('0x48')](db[_0x32fd('0x7a')][_0x32fd('0x42')]);_0x5c3808[_0x32fd('0x47')]=_['keys'](_0x841f3a[_0x32fd('0x47')]);_0x5c3808[_0x32fd('0x51')]=_[_0x32fd('0x49')](_0x5c3808[_0x32fd('0x45')],_0x5c3808[_0x32fd('0x47')]);_0x459732[_0x32fd('0x4a')]=_[_0x32fd('0x49')](_0x5c3808['model'],qs[_0x32fd('0x4b')](_0x841f3a[_0x32fd('0x47')][_0x32fd('0x4b')]));_0x459732[_0x32fd('0x4a')]=_0x459732['attributes'][_0x32fd('0x4c')]?_0x459732[_0x32fd('0x4a')]:_0x5c3808[_0x32fd('0x45')];_0x459732[_0x32fd('0x6d')]=qs[_0x32fd('0x4f')](_0x841f3a[_0x32fd('0x47')][_0x32fd('0x4f')]);_0x459732[_0x32fd('0x50')]=qs[_0x32fd('0x51')](_['pick'](_0x841f3a[_0x32fd('0x47')],_0x5c3808[_0x32fd('0x51')]));if(_0x841f3a['query'][_0x32fd('0x53')]){_0x459732['where']=_[_0x32fd('0x6a')](_0x459732[_0x32fd('0x50')],{'$or':_['map'](_0x459732[_0x32fd('0x4a')],function(_0x44c339){var _0x1034c8={};_0x1034c8[_0x44c339]={'$like':'%'+_0x841f3a[_0x32fd('0x47')][_0x32fd('0x53')]+'%'};return _0x1034c8;})});}_0x459732=_['merge']({},_0x459732,_0x841f3a[_0x32fd('0x6e')]);return _0x272347[_0x32fd('0x79')](_0x459732);}})[_0x32fd('0x21')](function(_0x48c1b1){if(_0x48c1b1){_0x58110e=_0x48c1b1[_0x32fd('0x4c')];if(!_0x841f3a[_0x32fd('0x47')][_0x32fd('0x4d')](_0x32fd('0x4e'))){_0x459732['limit']=qs[_0x32fd('0x30')](_0x841f3a['query'][_0x32fd('0x30')]);_0x459732[_0x32fd('0x2f')]=qs[_0x32fd('0x2f')](_0x841f3a[_0x32fd('0x47')][_0x32fd('0x2f')]);}return _0x272347[_0x32fd('0x79')](_0x459732);}})['then'](function(_0x9a17cb){if(_0x9a17cb){return _0x9a17cb?{'count':_0x58110e,'rows':_0x9a17cb}:null;}})[_0x32fd('0x21')](respondWithResult(_0x437ec7,null))[_0x32fd('0x2b')](handleError(_0x437ec7,null));};exports[_0x32fd('0x7b')]=function(_0x596149,_0x1b0b9e,_0x5d7dff){return db[_0x32fd('0x55')][_0x32fd('0x69')]({'where':{'id':_0x596149[_0x32fd('0x63')]['id']}})['then'](handleEntityNotFound(_0x1b0b9e,null))[_0x32fd('0x21')](function(_0xe01d07){if(_0xe01d07){return db[_0x32fd('0x7c')][_0x32fd('0x7d')](function(_0x134ae0){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x596149['params']['id']},'transaction':_0x134ae0})[_0x32fd('0x21')](function(_0x5609be){var _0x43c263=_[_0x32fd('0x41')](_0x596149[_0x32fd('0x5c')],function(_0x2e0f4e){_0x2e0f4e['WhatsappAccountId']=_0x596149[_0x32fd('0x63')]['id'];return _0x2e0f4e;});return db['WhatsappApplication'][_0x32fd('0x7e')](_0x43c263,{'transaction':_0x134ae0});});})[_0x32fd('0x21')](function(){return db[_0x32fd('0x7f')][_0x32fd('0x80')]({'where':{'WhatsappAccountId':_0x596149['params']['id']},'order':_0x32fd('0x81')});});}})[_0x32fd('0x21')](respondWithResult(_0x1b0b9e,null))[_0x32fd('0x2b')](handleError(_0x1b0b9e,null));};exports[_0x32fd('0x82')]=function(_0x5202a2,_0x36e129,_0x462d7d){var _0x54eddd={};var _0x452313={};var _0x85dd18;var _0x3528e1;return db['WhatsappAccount'][_0x32fd('0x69')]({'where':{'id':_0x5202a2[_0x32fd('0x63')]['id']}})[_0x32fd('0x21')](handleEntityNotFound(_0x36e129,null))['then'](function(_0x201600){if(_0x201600){_0x85dd18=_0x201600;_0x452313[_0x32fd('0x45')]=_['keys'](db['WhatsappApplication'][_0x32fd('0x42')]);_0x452313[_0x32fd('0x47')]=_[_0x32fd('0x48')](_0x5202a2['query']);_0x452313[_0x32fd('0x51')]=_['intersection'](_0x452313[_0x32fd('0x45')],_0x452313['query']);_0x54eddd['attributes']=_[_0x32fd('0x49')](_0x452313['model'],qs[_0x32fd('0x4b')](_0x5202a2['query'][_0x32fd('0x4b')]));_0x54eddd[_0x32fd('0x4a')]=_0x54eddd[_0x32fd('0x4a')][_0x32fd('0x4c')]?_0x54eddd[_0x32fd('0x4a')]:_0x452313[_0x32fd('0x45')];_0x54eddd[_0x32fd('0x6d')]=qs['sort'](_0x5202a2[_0x32fd('0x47')][_0x32fd('0x4f')]);_0x54eddd[_0x32fd('0x50')]=qs[_0x32fd('0x51')](_['pick'](_0x5202a2[_0x32fd('0x47')],_0x452313['filters']));if(_0x5202a2[_0x32fd('0x47')][_0x32fd('0x53')]){_0x54eddd[_0x32fd('0x50')]=_[_0x32fd('0x6a')](_0x54eddd['where'],{'$or':_[_0x32fd('0x41')](_0x54eddd[_0x32fd('0x4a')],function(_0x2e4ef3){var _0x1aa2bc={};_0x1aa2bc[_0x2e4ef3]={'$like':'%'+_0x5202a2[_0x32fd('0x47')][_0x32fd('0x53')]+'%'};return _0x1aa2bc;})});}_0x54eddd=_[_0x32fd('0x6a')]({},_0x54eddd,_0x5202a2[_0x32fd('0x6e')]);return _0x85dd18[_0x32fd('0x82')](_0x54eddd);}})[_0x32fd('0x21')](function(_0x57bb2d){if(_0x57bb2d){_0x3528e1=_0x57bb2d[_0x32fd('0x4c')];if(!_0x5202a2[_0x32fd('0x47')][_0x32fd('0x4d')](_0x32fd('0x4e'))){_0x54eddd[_0x32fd('0x30')]=qs[_0x32fd('0x30')](_0x5202a2['query'][_0x32fd('0x30')]);_0x54eddd['offset']=qs['offset'](_0x5202a2[_0x32fd('0x47')][_0x32fd('0x2f')]);}return _0x85dd18[_0x32fd('0x82')](_0x54eddd);}})[_0x32fd('0x21')](function(_0x26ee04){if(_0x26ee04){return _0x26ee04?{'count':_0x3528e1,'rows':_0x26ee04}:null;}})[_0x32fd('0x21')](respondWithResult(_0x36e129,null))['catch'](handleError(_0x36e129,null));};exports[_0x32fd('0x83')]=function(_0x5e8843,_0x51b24b,_0x3baef1){var _0xbeb24={'channel':_0x32fd('0x84')};var _0x159e85=[];var _0x2c3e44=[];var _0x9e14dd={};return db[_0x32fd('0x55')][_0x32fd('0x62')]({'where':{'id':_0x5e8843[_0x32fd('0x63')]['id']},'include':[{'model':db[_0x32fd('0x7f')],'as':_0x32fd('0x85')}]})[_0x32fd('0x21')](handleEntityNotFound(_0x51b24b,null))[_0x32fd('0x21')](function(_0x118680){_0xbeb24[_0x32fd('0x86')]=_0x118680;_0xbeb24[_0x32fd('0x87')]=_[_0x32fd('0x88')](_0x118680[_0x32fd('0x85')],[_0x32fd('0x81')],[_0x32fd('0x89')]);if(_0xbeb24['account'][_0x32fd('0x85')]){delete _0xbeb24['account'][_0x32fd('0x85')];}return db[_0x32fd('0x8a')]['describe']();})['then'](function(_0x5e8c03){if(!_0x5e8c03){throw new db[(_0x32fd('0x8b'))][(_0x32fd('0x8c'))](_0x32fd('0x8d'));}_0x159e85=_[_0x32fd('0x8e')](_['keys'](_0x5e8c03),[_0x32fd('0x8f'),_0x32fd('0x90')]);_0x2c3e44=_[_0x32fd('0x8e')](_[_0x32fd('0x48')](_0x5e8c03),[_0x32fd('0x8f'),_0x32fd('0x90'),'CompanyId',_0x32fd('0x91')]);_0xbeb24[_0x32fd('0x5c')]={'mapKey':_0x32fd('0x92')};if(_0xbeb24['account'][_0x32fd('0x43')]&&_0xbeb24[_0x32fd('0x86')][_0x32fd('0x43')]==='twilio'){_0xbeb24['body'][_0x32fd('0x93')]=_0x5e8843['body'][_0x32fd('0x94')][_0x32fd('0x95')]('whatsapp:','');_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x5c')]=_0x5e8843[_0x32fd('0x5c')][_0x32fd('0x96')];_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x97')]=_0x5e8843[_0x32fd('0x5c')][_0x32fd('0x98')];}if(_0xbeb24[_0x32fd('0x5c')]['id']){delete _0xbeb24[_0x32fd('0x5c')]['id'];}if(_['isNil'](_0xbeb24[_0x32fd('0x5c')]['from'])){throw new db[(_0x32fd('0x8b'))][(_0x32fd('0x8c'))]('from\x20is\x20mandatory');}if(_[_0x32fd('0x99')](_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x5c')])||_0xbeb24[_0x32fd('0x5c')]['body']===''){throw new db[(_0x32fd('0x8b'))][(_0x32fd('0x8c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x32fd('0x99')](_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x9a')])){throw new db[(_0x32fd('0x8b'))][(_0x32fd('0x8c'))](_0x32fd('0x9b')+_0x2c3e44);}if(!_[_0x32fd('0x9c')](_0x2c3e44,_0xbeb24['body'][_0x32fd('0x9a')])){throw new db['Sequelize'][(_0x32fd('0x8c'))](_0x32fd('0x9d')+_0x2c3e44);}_0x9e14dd[_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x9a')]]=_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x93')];return db[_0x32fd('0x9e')]['find']({'where':{'id':_0xbeb24[_0x32fd('0x86')][_0x32fd('0x91')]},'include':[{'model':db['CmContact'],'as':_0x32fd('0x9f'),'where':_0x9e14dd,'limit':0x1,'order':[['updatedAt',_0x32fd('0xa0')]]}]});})['then'](handleEntityNotFound(_0x51b24b,null))[_0x32fd('0x21')](function(_0x1b1d77){if(_0x1b1d77){_0xbeb24[_0x32fd('0xa1')]=_['omit'](_0x1b1d77,['Contacts']);if(_0x1b1d77[_0x32fd('0x9f')][_0x32fd('0x4c')]){return _0x1b1d77[_0x32fd('0x9f')][0x0];}var _0x3d51d5=_[_0x32fd('0xa2')](_0xbeb24[_0x32fd('0x5c')],{'firstName':_0xbeb24[_0x32fd('0x5c')]['from'],'ListId':_0x1b1d77['id']});_0x3d51d5[_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x9a')]]=_0xbeb24['body'][_0x32fd('0x93')];return db[_0x32fd('0x8a')][_0x32fd('0x5b')](_0x3d51d5,{'fields':_0x159e85,'raw':!![]});}})[_0x32fd('0x21')](handleEntityNotFound(_0x51b24b,null))[_0x32fd('0x21')](function(_0x290b06){if(_0x290b06){_0xbeb24[_0x32fd('0xa3')]=_0x290b06;var _0x1d038d={'ContactId':_0x290b06['id'],'phone':_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x93')],'WhatsappAccountId':_0x5e8843[_0x32fd('0x63')]['id']};var _0x1f5600={'ContactId':_0x290b06['id'],'WhatsappAccountId':_0x5e8843['params']['id'],'closed':![]};return db[_0x32fd('0xa4')][_0x32fd('0x62')]({'where':_0x1f5600})['then'](function(_0x142d9a){if(_0x142d9a){return[_0x142d9a,![]];}return db['WhatsappInteraction'][_0x32fd('0x5b')](_0x1d038d)[_0x32fd('0x21')](function(_0xf07ffc){return[_0xf07ffc,!![]];});});}})[_0x32fd('0x73')](function(_0x12b9f5,_0x5e518e){_0xbeb24[_0x32fd('0xa5')]=_0x12b9f5[_0x32fd('0x39')]({'plain':!![]});_0xbeb24[_0x32fd('0xa5')]['created']=![];if(_0x5e518e){if(_0xbeb24[_0x32fd('0x86')][_0x32fd('0xa6')]){_0xbeb24[_0x32fd('0x87')][_0x32fd('0xa7')]({'id':0x0,'priority':_0xbeb24[_0x32fd('0x87')][_0x32fd('0x4c')]+0x1,'app':_0x32fd('0xa8'),'appdata':_0x32fd('0xa9'),'interval':_0x32fd('0xaa')});}_0xbeb24[_0x32fd('0xa5')][_0x32fd('0xab')]=!![];}return db[_0x32fd('0xac')][_0x32fd('0x5b')]({'phone':_0xbeb24[_0x32fd('0x5c')][_0x32fd('0x93')],'messageId':_0xbeb24['body'][_0x32fd('0x97')],'body':_0xbeb24['body'][_0x32fd('0x5c')],'WhatsappAccountId':_0x5e8843['params']['id'],'WhatsappInteractionId':_0x12b9f5['id'],'direction':'in','ContactId':_0x12b9f5[_0x32fd('0xad')],'AttachmentId':_0xbeb24[_0x32fd('0x5c')][_0x32fd('0xae')]});})['then'](function(_0xbf7e30){_0xbeb24[_0x32fd('0x29')]=_0xbf7e30;if(_0xbeb24[_0x32fd('0xa5')][_0x32fd('0xaf')]){return db['User'][_0x32fd('0x62')]({'attributes':['id',_0x32fd('0x46')],'where':{'id':_0xbeb24[_0x32fd('0xa5')][_0x32fd('0xaf')]}})[_0x32fd('0x21')](function(_0x1b26e8){if(_0x1b26e8){_0xbeb24['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x32fd('0xb0'),'appdata':_0x1b26e8[_0x32fd('0x46')]+','+(_0xbeb24[_0x32fd('0x86')][_0x32fd('0xb1')]||0xa),'interval':_0x32fd('0xaa')});}return respondWithRpcPromise('Start',_0x32fd('0xb2'),_0xbeb24);});}return respondWithRpcPromise('Start',_0x32fd('0xb2'),_0xbeb24);})['then'](function(_0x347c03){if(_0x347c03){var _0x587082=0xc8;var _0x1f87ab=_0x32fd('0xb3');logger['info'](_0x32fd('0x24'),_0x1f87ab,_0x587082,_0x32fd('0xb4'));logger[_0x32fd('0xb5')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1f87ab,_0x587082,_0x32fd('0xb4'),JSON[_0x32fd('0x25')](_0x347c03));if(_0xbeb24[_0x32fd('0x86')][_0x32fd('0x43')]===_0x32fd('0xb6')){return _0x51b24b[_0x32fd('0x3b')](_0x587082)[_0x32fd('0x33')]('Content-Type',_0x32fd('0xb7'))[_0x32fd('0x3d')]('\x0a');}else{return _0x51b24b[_0x32fd('0x3b')](_0x587082)[_0x32fd('0x2e')](_0x347c03);}}})[_0x32fd('0x2b')](handleError(_0x51b24b,null));};exports[_0x32fd('0x3d')]=function(_0x540164,_0x4ec5f3,_0x2f0894){var _0x54a485,_0x43ac46,_0x36341d;if(_[_0x32fd('0x99')](_0x540164[_0x32fd('0x5c')][_0x32fd('0x5c')])||_0x540164['body'][_0x32fd('0x5c')]===''){throw new db[(_0x32fd('0x8b'))][(_0x32fd('0x8c'))](_0x32fd('0xb8'));}if(_[_0x32fd('0x99')](_0x540164['body']['to'])){throw new db[(_0x32fd('0x8b'))][(_0x32fd('0x8c'))](_0x32fd('0xb9'));}_0x54a485=_0x540164[_0x32fd('0x5c')]['to'];return db['WhatsappAccount'][_0x32fd('0x62')]({'where':{'id':_0x540164[_0x32fd('0x63')]['id']},'include':[{'model':db[_0x32fd('0x9e')],'as':_0x32fd('0xba'),'include':[{'model':db['CmContact'],'as':_0x32fd('0x9f'),'where':{'mobile':_0x54a485},'limit':0x1,'order':[[_0x32fd('0x90'),_0x32fd('0xa0')]]}]}]})[_0x32fd('0x21')](handleEntityNotFound(_0x4ec5f3,null))[_0x32fd('0x21')](function(_0x9d56a6){if(_0x9d56a6&&_0x9d56a6[_0x32fd('0xba')]){_0x43ac46=_0x9d56a6[_0x32fd('0x39')]({'plain':!![]});if(_0x43ac46[_0x32fd('0xba')]&&_0x43ac46['List'][_0x32fd('0x9f')]['length']){return _0x43ac46[_0x32fd('0xba')]['Contacts'][0x0];}return db[_0x32fd('0x8a')][_0x32fd('0x5b')](_[_0x32fd('0xa2')](_0x540164['body'],{'firstName':_0x54a485,'mobile':_0x54a485,'phone':_0x54a485,'ListId':_0x43ac46[_0x32fd('0x91')]}));}})[_0x32fd('0x21')](handleEntityNotFound(_0x4ec5f3,null))[_0x32fd('0x21')](function(_0x4d38bd){if(_0x4d38bd){_0x36341d=_0x4d38bd;return db[_0x32fd('0xa4')][_0x32fd('0x62')]({'where':{'ContactId':_0x36341d['id'],'closed':![],'WhatsappAccountId':_0x43ac46['id']}})['then'](function(_0x1c70c6){if(_0x1c70c6){return[_0x1c70c6,![]];}return db['WhatsappInteraction'][_0x32fd('0x5b')]({'UserId':_0x540164[_0x32fd('0x5d')]['id'],'ContactId':_0x36341d['id'],'WhatsappAccountId':_0x43ac46['id'],'phone':_0x54a485,'firstMsgDirection':_0x32fd('0xbb'),'Messages':[_[_0x32fd('0x6a')](_0x540164[_0x32fd('0x5c')],{'read':![],'body':_0x540164['body'][_0x32fd('0x5c')],'phone':_0x54a485,'WhatsappAccountId':_0x43ac46['id'],'UserId':_0x540164['user']['id'],'ContactId':_0x36341d['id']})]},{'include':[{'model':db[_0x32fd('0xac')],'as':'Messages'}]})['then'](function(_0x2f7175){return[_0x2f7175,!![]];});});}})[_0x32fd('0x73')](function(_0xdeb82c,_0x60913){if(_0x60913){return _0xdeb82c;}return db['WhatsappMessage'][_0x32fd('0x5b')](_['merge'](_0x540164[_0x32fd('0x5c')],{'read':![],'body':_0x540164['body'][_0x32fd('0x5c')],'phone':_0x54a485,'WhatsappAccountId':_0x43ac46['id'],'WhatsappInteractionId':_0xdeb82c['id'],'UserId':_0x540164[_0x32fd('0x5d')]['id'],'ContactId':_0x36341d['id']}))[_0x32fd('0x21')](function(_0x19dbef){_0xdeb82c[_0x32fd('0xbc')][_0x32fd('0xbd')]=[];_0xdeb82c[_0x32fd('0xbc')][_0x32fd('0xbd')][_0x32fd('0xa7')](_0x19dbef['dataValues']);return _0xdeb82c;});})['then'](respondWithResult(_0x4ec5f3,null))[_0x32fd('0x2b')](handleError(_0x4ec5f3,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4e5a698..3b251a0 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 _0x69cd=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x12f974,_0x3e44d1){var _0x547a22=function(_0x11ae14){while(--_0x11ae14){_0x12f974['push'](_0x12f974['shift']());}};_0x547a22(++_0x3e44d1);}(_0x69cd,0xef));var _0xd69c=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x69cd[_0xbeb808];return _0x5d6909;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xd69c('0x0'))['db'][_0xd69c('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd69c('0x2')](0x0);var events={'afterCreate':_0xd69c('0x3'),'afterUpdate':_0xd69c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3ee8ce){return function(_0xa48dc8,_0x3cb854,_0x4114ec){WhatsappAccountEvents[_0xd69c('0x5')](_0x3ee8ce+':'+_0xa48dc8['id'],_0xa48dc8);WhatsappAccountEvents['emit'](_0x3ee8ce,_0xa48dc8);_0x4114ec(null);};}for(var e in events){if(events[_0xd69c('0x6')](e)){var event=events[e];WhatsappAccount[_0xd69c('0x7')](e,emitEvent(event));}}module[_0xd69c('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xcabb=['../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2c48bd,_0x474840){var _0x51f38a=function(_0x55f8e3){while(--_0x55f8e3){_0x2c48bd['push'](_0x2c48bd['shift']());}};_0x51f38a(++_0x474840);}(_0xcabb,0x120));var _0xbcab=function(_0x41d5c3,_0x522315){_0x41d5c3=_0x41d5c3-0x0;var _0x1840d5=_0xcabb[_0x41d5c3];return _0x1840d5;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xbcab('0x0'))['db'][_0xbcab('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcab('0x2'),'afterUpdate':_0xbcab('0x3'),'afterDestroy':_0xbcab('0x4')};function emitEvent(_0x1f1ff4){return function(_0x3369a4,_0x4ca00a,_0x4d5852){WhatsappAccountEvents[_0xbcab('0x5')](_0x1f1ff4+':'+_0x3369a4['id'],_0x3369a4);WhatsappAccountEvents['emit'](_0x1f1ff4,_0x3369a4);_0x4d5852(null);};}for(var e in events){if(events[_0xbcab('0x6')](e)){var event=events[e];WhatsappAccount[_0xbcab('0x7')](e,emitEvent(event));}}module[_0xbcab('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 6c906d2..cc91810 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 _0x536e=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x536e,0x18a));var _0xe536=function(_0xad08b3,_0x2a3003){_0xad08b3=_0xad08b3-0x0;var _0xb6c9b6=_0x536e[_0xad08b3];return _0xb6c9b6;};'use strict';var _=require(_0xe536('0x0'));var util=require(_0xe536('0x1'));var logger=require(_0xe536('0x2'))('api');var moment=require(_0xe536('0x3'));var BPromise=require(_0xe536('0x4'));var rp=require(_0xe536('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe536('0x6'));var config=require(_0xe536('0x7'));var attributes=require(_0xe536('0x8'));module[_0xe536('0x9')]=function(_0x5a8d3d,_0x5d16c4){return _0x5a8d3d[_0xe536('0xa')](_0xe536('0xb'),attributes,{'tableName':_0xe536('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa809=['define','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4a3088,_0x899ef4){var _0x53faf0=function(_0xe543c1){while(--_0xe543c1){_0x4a3088['push'](_0x4a3088['shift']());}};_0x53faf0(++_0x899ef4);}(_0xa809,0x138));var _0x9a80=function(_0x230ce7,_0x2f5a0a){_0x230ce7=_0x230ce7-0x0;var _0xe4dacc=_0xa809[_0x230ce7];return _0xe4dacc;};'use strict';var _=require(_0x9a80('0x0'));var util=require('util');var logger=require(_0x9a80('0x1'))(_0x9a80('0x2'));var moment=require(_0x9a80('0x3'));var BPromise=require(_0x9a80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a80('0x5'));var rimraf=require(_0x9a80('0x6'));var config=require(_0x9a80('0x7'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x27c129,_0xef02e6){return _0x27c129[_0x9a80('0x8')]('WhatsappAccount',attributes,{'tableName':_0x9a80('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 1e2cf0b..b12a8d1 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 _0x6bf1=['localhost','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','find','options','raw','attributes','map','include','model','ShowWhatsappAccount','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x345ec9,_0x3df768){var _0x1cdf3b=function(_0x710872){while(--_0x710872){_0x345ec9['push'](_0x345ec9['shift']());}};_0x1cdf3b(++_0x3df768);}(_0x6bf1,0x1d3));var _0x16bf=function(_0x51160c,_0x374b59){_0x51160c=_0x51160c-0x0;var _0x15a3fb=_0x6bf1[_0x51160c];return _0x15a3fb;};'use strict';var _=require(_0x16bf('0x0'));var util=require(_0x16bf('0x1'));var moment=require(_0x16bf('0x2'));var BPromise=require('bluebird');var rs=require(_0x16bf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16bf('0x4'))['db'];var utils=require(_0x16bf('0x5'));var logger=require(_0x16bf('0x6'))(_0x16bf('0x7'));var config=require(_0x16bf('0x8'));var jayson=require(_0x16bf('0x9'));var client=jayson[_0x16bf('0xa')][_0x16bf('0xb')]({'port':0x232a});config[_0x16bf('0xc')]=_[_0x16bf('0xd')](config['redis'],{'host':_0x16bf('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x16bf('0xc')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5d017f,_0xfea911,_0x1c7967){return new BPromise(function(_0x354f33,_0x12f9ec){return client[_0x16bf('0xf')](_0x5d017f,_0x1c7967)[_0x16bf('0x10')](function(_0xe8dbef){logger[_0x16bf('0x11')](_0x16bf('0x12'),_0xfea911,_0x16bf('0x13'));logger['debug'](_0x16bf('0x14'),_0xfea911,_0x16bf('0x13'),JSON[_0x16bf('0x15')](_0xe8dbef));if(_0xe8dbef['error']){if(_0xe8dbef[_0x16bf('0x16')][_0x16bf('0x17')]===0x1f4){logger[_0x16bf('0x16')](_0x16bf('0x12'),_0xfea911,_0xe8dbef[_0x16bf('0x16')]['message']);return _0x12f9ec(_0xe8dbef[_0x16bf('0x16')][_0x16bf('0x18')]);}logger['error'](_0x16bf('0x12'),_0xfea911,_0xe8dbef[_0x16bf('0x16')][_0x16bf('0x18')]);return _0x354f33(_0xe8dbef[_0x16bf('0x16')][_0x16bf('0x18')]);}else{logger['info'](_0x16bf('0x12'),_0xfea911,_0x16bf('0x13'));_0x354f33(_0xe8dbef[_0x16bf('0x19')][_0x16bf('0x18')]);}})[_0x16bf('0x1a')](function(_0x191a6d){logger['error'](_0x16bf('0x12'),_0xfea911,_0x191a6d);_0x12f9ec(_0x191a6d);});});}exports['ShowWhatsappAccount']=function(_0xf7f957){var _0x15ec6c=this;return new Promise(function(_0x250005,_0x6196ae){return db[_0x16bf('0x1b')][_0x16bf('0x1c')]({'raw':_0xf7f957[_0x16bf('0x1d')]?_0xf7f957['options'][_0x16bf('0x1e')]===undefined?!![]:![]:!![],'where':_0xf7f957[_0x16bf('0x1d')]?_0xf7f957[_0x16bf('0x1d')]['where']||null:null,'attributes':_0xf7f957[_0x16bf('0x1d')]?_0xf7f957[_0x16bf('0x1d')][_0x16bf('0x1f')]||null:null,'include':_0xf7f957[_0x16bf('0x1d')]?_0xf7f957[_0x16bf('0x1d')]['include']?_[_0x16bf('0x20')](_0xf7f957[_0x16bf('0x1d')]['include'],function(_0x38c9e8){return{'model':db[_0x38c9e8['model']],'as':_0x38c9e8['as'],'attributes':_0x38c9e8[_0x16bf('0x1f')],'include':_0x38c9e8['include']?_[_0x16bf('0x20')](_0x38c9e8[_0x16bf('0x21')],function(_0x2dad6b){return{'model':db[_0x2dad6b['model']],'as':_0x2dad6b['as'],'attributes':_0x2dad6b[_0x16bf('0x1f')],'include':_0x2dad6b[_0x16bf('0x21')]?_[_0x16bf('0x20')](_0x2dad6b['include'],function(_0x256dd0){return{'model':db[_0x256dd0[_0x16bf('0x22')]],'as':_0x256dd0['as'],'attributes':_0x256dd0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1840c6){logger['info'](_0x16bf('0x23'),_0xf7f957);logger[_0x16bf('0x24')](_0x16bf('0x23'),_0xf7f957,JSON[_0x16bf('0x15')](_0x1840c6));_0x250005(_0x1840c6);})['catch'](function(_0x5df775){logger[_0x16bf('0x16')]('ShowWhatsappAccount',_0x5df775['message'],_0xf7f957);_0x6196ae(_0x15ec6c['error'](0x1f4,_0x5df775[_0x16bf('0x18')]));});});}; \ No newline at end of file +var _0xad29=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','ShowWhatsappAccount','WhatsappAccount','options','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s'];(function(_0xf69e77,_0x27ac2f){var _0xb6e2f0=function(_0x650993){while(--_0x650993){_0xf69e77['push'](_0xf69e77['shift']());}};_0xb6e2f0(++_0x27ac2f);}(_0xad29,0x1b2));var _0x9ad2=function(_0x547fcb,_0x8fda67){_0x547fcb=_0x547fcb-0x0;var _0x275d17=_0xad29[_0x547fcb];return _0x275d17;};'use strict';var _=require(_0x9ad2('0x0'));var util=require(_0x9ad2('0x1'));var moment=require(_0x9ad2('0x2'));var BPromise=require(_0x9ad2('0x3'));var rs=require(_0x9ad2('0x4'));var fs=require('fs');var Redis=require(_0x9ad2('0x5'));var db=require(_0x9ad2('0x6'))['db'];var utils=require(_0x9ad2('0x7'));var logger=require(_0x9ad2('0x8'))(_0x9ad2('0x9'));var config=require(_0x9ad2('0xa'));var jayson=require(_0x9ad2('0xb'));var client=jayson[_0x9ad2('0xc')][_0x9ad2('0xd')]({'port':0x232a});config[_0x9ad2('0xe')]=_['defaults'](config[_0x9ad2('0xe')],{'host':_0x9ad2('0xf'),'port':0x18eb});var socket=require(_0x9ad2('0x10'))(new Redis(config[_0x9ad2('0xe')]));require('./whatsappAccount.socket')[_0x9ad2('0x11')](socket);function respondWithRpcPromise(_0x172650,_0x1286d7,_0xb43146){return new BPromise(function(_0x3d241d,_0x5beb92){return client['request'](_0x172650,_0xb43146)[_0x9ad2('0x12')](function(_0x2b38aa){logger[_0x9ad2('0x13')](_0x9ad2('0x14'),_0x1286d7,'request\x20sent');logger[_0x9ad2('0x15')](_0x9ad2('0x16'),_0x1286d7,_0x9ad2('0x17'),JSON[_0x9ad2('0x18')](_0x2b38aa));if(_0x2b38aa['error']){if(_0x2b38aa['error'][_0x9ad2('0x19')]===0x1f4){logger['error'](_0x9ad2('0x14'),_0x1286d7,_0x2b38aa[_0x9ad2('0x1a')][_0x9ad2('0x1b')]);return _0x5beb92(_0x2b38aa[_0x9ad2('0x1a')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1286d7,_0x2b38aa[_0x9ad2('0x1a')][_0x9ad2('0x1b')]);return _0x3d241d(_0x2b38aa[_0x9ad2('0x1a')]['message']);}else{logger['info'](_0x9ad2('0x14'),_0x1286d7,_0x9ad2('0x17'));_0x3d241d(_0x2b38aa['result'][_0x9ad2('0x1b')]);}})['catch'](function(_0x3fdc86){logger[_0x9ad2('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x1286d7,_0x3fdc86);_0x5beb92(_0x3fdc86);});});}exports[_0x9ad2('0x1c')]=function(_0x6ff3ee){var _0x4a8394=this;return new Promise(function(_0x4a1479,_0x1e934b){return db[_0x9ad2('0x1d')]['find']({'raw':_0x6ff3ee[_0x9ad2('0x1e')]?_0x6ff3ee[_0x9ad2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x6ff3ee[_0x9ad2('0x1e')]?_0x6ff3ee[_0x9ad2('0x1e')]['where']||null:null,'attributes':_0x6ff3ee[_0x9ad2('0x1e')]?_0x6ff3ee['options'][_0x9ad2('0x1f')]||null:null,'include':_0x6ff3ee[_0x9ad2('0x1e')]?_0x6ff3ee['options'][_0x9ad2('0x20')]?_['map'](_0x6ff3ee['options'][_0x9ad2('0x20')],function(_0x495b48){return{'model':db[_0x495b48[_0x9ad2('0x21')]],'as':_0x495b48['as'],'attributes':_0x495b48[_0x9ad2('0x1f')],'include':_0x495b48[_0x9ad2('0x20')]?_['map'](_0x495b48[_0x9ad2('0x20')],function(_0x4def7d){return{'model':db[_0x4def7d[_0x9ad2('0x21')]],'as':_0x4def7d['as'],'attributes':_0x4def7d['attributes'],'include':_0x4def7d[_0x9ad2('0x20')]?_[_0x9ad2('0x22')](_0x4def7d[_0x9ad2('0x20')],function(_0x1817dc){return{'model':db[_0x1817dc['model']],'as':_0x1817dc['as'],'attributes':_0x1817dc[_0x9ad2('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22a20c){logger['info'](_0x9ad2('0x1c'),_0x6ff3ee);logger['debug'](_0x9ad2('0x1c'),_0x6ff3ee,JSON[_0x9ad2('0x18')](_0x22a20c));_0x4a1479(_0x22a20c);})['catch'](function(_0x38c6e4){logger['error']('ShowWhatsappAccount',_0x38c6e4[_0x9ad2('0x1b')],_0x6ff3ee);_0x1e934b(_0x4a8394['error'](0x1f4,_0x38c6e4[_0x9ad2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 770101b..8671ea4 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 _0x074e=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x3abe3b,_0x598bf9){var _0x3e12ea=function(_0x271b23){while(--_0x271b23){_0x3abe3b['push'](_0x3abe3b['shift']());}};_0x3e12ea(++_0x598bf9);}(_0x074e,0xcc));var _0xe074=function(_0x4073ea,_0x56357c){_0x4073ea=_0x4073ea-0x0;var _0x44df4a=_0x074e[_0x4073ea];return _0x44df4a;};'use strict';var WhatsappAccountEvents=require(_0xe074('0x0'));var events=[_0xe074('0x1'),_0xe074('0x2'),_0xe074('0x3')];function createListener(_0x38d6d7,_0x296f03){return function(_0x38f25f){_0x296f03[_0xe074('0x4')](_0x38d6d7,_0x38f25f);};}function removeListener(_0x134e7e,_0x1c9dc0){return function(){WhatsappAccountEvents[_0xe074('0x5')](_0x134e7e,_0x1c9dc0);};}exports['register']=function(_0x2871b3){for(var _0x265a24=0x0,_0x60077c=events['length'];_0x265a24<_0x60077c;_0x265a24++){var _0x14e1d9=events[_0x265a24];var _0x171365=createListener(_0xe074('0x6')+_0x14e1d9,_0x2871b3);WhatsappAccountEvents['on'](_0x14e1d9,_0x171365);}}; \ No newline at end of file +var _0x1fee=['save','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x2c830f,_0x4e1ce2){var _0x13688a=function(_0x4dda16){while(--_0x4dda16){_0x2c830f['push'](_0x2c830f['shift']());}};_0x13688a(++_0x4e1ce2);}(_0x1fee,0x130));var _0xe1fe=function(_0x540aa6,_0x24d529){_0x540aa6=_0x540aa6-0x0;var _0x21a6b0=_0x1fee[_0x540aa6];return _0x21a6b0;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xe1fe('0x0'),_0xe1fe('0x1'),_0xe1fe('0x2')];function createListener(_0x564ada,_0x11973c){return function(_0x401bf8){_0x11973c[_0xe1fe('0x3')](_0x564ada,_0x401bf8);};}function removeListener(_0x321d12,_0x46376b){return function(){WhatsappAccountEvents[_0xe1fe('0x4')](_0x321d12,_0x46376b);};}exports[_0xe1fe('0x5')]=function(_0x274a35){for(var _0x270bf5=0x0,_0x499026=events[_0xe1fe('0x6')];_0x270bf5<_0x499026;_0x270bf5++){var _0x57b46a=events[_0x270bf5];var _0x2becbe=createListener(_0xe1fe('0x7')+_0x57b46a,_0x274a35);WhatsappAccountEvents['on'](_0x57b46a,_0x2becbe);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index fdb8afc..52dc51f 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 _0x7b8b=['create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x28a7bb,_0x25ffbf){var _0x85424a=function(_0x4f9734){while(--_0x4f9734){_0x28a7bb['push'](_0x28a7bb['shift']());}};_0x85424a(++_0x25ffbf);}(_0x7b8b,0x155));var _0xb7b8=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x7b8b[_0x2706da];return _0x3ba87e;};'use strict';var multer=require('multer');var util=require(_0xb7b8('0x0'));var path=require(_0xb7b8('0x1'));var timeout=require(_0xb7b8('0x2'));var express=require(_0xb7b8('0x3'));var router=express[_0xb7b8('0x4')]();var fs_extra=require(_0xb7b8('0x5'));var auth=require(_0xb7b8('0x6'));var interaction=require(_0xb7b8('0x7'));var config=require(_0xb7b8('0x8'));var controller=require(_0xb7b8('0x9'));router[_0xb7b8('0xa')]('/',auth[_0xb7b8('0xb')](),controller[_0xb7b8('0xc')]);router[_0xb7b8('0xa')](_0xb7b8('0xd'),auth['isAuthenticated'](),controller[_0xb7b8('0xe')]);router[_0xb7b8('0xf')]('/',auth['isAuthenticated'](),controller[_0xb7b8('0x10')]);router['put'](_0xb7b8('0xd'),auth['isAuthenticated'](),controller[_0xb7b8('0x11')]);router[_0xb7b8('0x12')](_0xb7b8('0xd'),auth[_0xb7b8('0xb')](),controller[_0xb7b8('0x13')]);module[_0xb7b8('0x14')]=router; \ No newline at end of file +var _0xc409=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util'];(function(_0x364048,_0x34dea3){var _0x591678=function(_0x239c0a){while(--_0x239c0a){_0x364048['push'](_0x364048['shift']());}};_0x591678(++_0x34dea3);}(_0xc409,0x1b6));var _0x9c40=function(_0x2d356b,_0x2fd34d){_0x2d356b=_0x2d356b-0x0;var _0x324c1f=_0xc409[_0x2d356b];return _0x324c1f;};'use strict';var multer=require(_0x9c40('0x0'));var util=require(_0x9c40('0x1'));var path=require(_0x9c40('0x2'));var timeout=require(_0x9c40('0x3'));var express=require(_0x9c40('0x4'));var router=express[_0x9c40('0x5')]();var fs_extra=require(_0x9c40('0x6'));var auth=require(_0x9c40('0x7'));var interaction=require(_0x9c40('0x8'));var config=require('../../config/environment');var controller=require(_0x9c40('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9c40('0xa')]);router[_0x9c40('0xb')](_0x9c40('0xc'),auth[_0x9c40('0xd')](),controller[_0x9c40('0xe')]);router[_0x9c40('0xf')]('/',auth[_0x9c40('0xd')](),controller[_0x9c40('0x10')]);router[_0x9c40('0x11')](_0x9c40('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9c40('0x12')](_0x9c40('0xc'),auth[_0x9c40('0xd')](),controller[_0x9c40('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7395429..62d588e 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 _0x56c0=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x11f68c,_0x38daee){var _0x3beb7a=function(_0x4fe011){while(--_0x4fe011){_0x11f68c['push'](_0x11f68c['shift']());}};_0x3beb7a(++_0x38daee);}(_0x56c0,0x72));var _0x056c=function(_0xd6c300,_0xef8607){_0xd6c300=_0xd6c300-0x0;var _0x5ef4e9=_0x56c0[_0xd6c300];return _0x5ef4e9;};'use strict';var Sequelize=require(_0x056c('0x0'));module[_0x056c('0x1')]={'priority':{'type':Sequelize[_0x056c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x056c('0x3')],'allowNull':![],'defaultValue':_0x056c('0x4')},'appdata':{'type':Sequelize[_0x056c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x056c('0x3')],'defaultValue':_0x056c('0x6')}}; \ No newline at end of file +var _0x5d33=['noop','STRING','sequelize','INTEGER'];(function(_0x28a4b3,_0x2792ef){var _0x3892e8=function(_0x39b3e3){while(--_0x39b3e3){_0x28a4b3['push'](_0x28a4b3['shift']());}};_0x3892e8(++_0x2792ef);}(_0x5d33,0x6a));var _0x35d3=function(_0x4462af,_0x164806){_0x4462af=_0x4462af-0x0;var _0x3aaabe=_0x5d33[_0x4462af];return _0x3aaabe;};'use strict';var Sequelize=require(_0x35d3('0x0'));module['exports']={'priority':{'type':Sequelize[_0x35d3('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35d3('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x35d3('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 10ddba8..174fb57 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 _0xcaf2=['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','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring'];(function(_0x5361dd,_0x56dfb2){var _0x4f4077=function(_0x15819f){while(--_0x15819f){_0x5361dd['push'](_0x5361dd['shift']());}};_0x4f4077(++_0x56dfb2);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1c5cd2,_0x277ceb){_0x1c5cd2=_0x1c5cd2-0x0;var _0x895e35=_0xcaf2[_0x1c5cd2];return _0x895e35;};'use strict';var emlformat=require(_0x2caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2caf('0x1'));var jsonpatch=require(_0x2caf('0x2'));var rp=require('request-promise');var moment=require(_0x2caf('0x3'));var BPromise=require(_0x2caf('0x4'));var Mustache=require('mustache');var util=require(_0x2caf('0x5'));var path=require('path');var sox=require(_0x2caf('0x6'));var csv=require(_0x2caf('0x7'));var ejs=require(_0x2caf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2caf('0x9'));var squel=require(_0x2caf('0xa'));var crypto=require(_0x2caf('0xb'));var jsforce=require(_0x2caf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2caf('0x7'));var querystring=require(_0x2caf('0xd'));var Papa=require(_0x2caf('0xe'));var Redis=require(_0x2caf('0xf'));var authService=require(_0x2caf('0x10'));var qs=require(_0x2caf('0x11'));var as=require(_0x2caf('0x12'));var hardwareService=require(_0x2caf('0x13'));var logger=require(_0x2caf('0x14'))('api');var utils=require(_0x2caf('0x15'));var config=require(_0x2caf('0x16'));var licenseUtil=require(_0x2caf('0x17'));var db=require(_0x2caf('0x18'))['db'];function respondWithStatusCode(_0x1dda08,_0x31c0e7){_0x31c0e7=_0x31c0e7||0xcc;return function(_0x252147){if(_0x252147){return _0x1dda08[_0x2caf('0x19')](_0x31c0e7);}return _0x1dda08['status'](_0x31c0e7)[_0x2caf('0x1a')]();};}function respondWithResult(_0xec8192,_0x502033){_0x502033=_0x502033||0xc8;return function(_0x4c47b8){if(_0x4c47b8){return _0xec8192['status'](_0x502033)[_0x2caf('0x1b')](_0x4c47b8);}};}function respondWithFilteredResult(_0x4da5ba,_0x388e05){return function(_0xa75896){if(_0xa75896){var _0x3b8b67=typeof _0x388e05[_0x2caf('0x1c')]==='undefined'&&typeof _0x388e05[_0x2caf('0x1d')]==='undefined';var _0x2d5b64=_0xa75896['count'];var _0x4a33fc=_0x3b8b67?0x0:_0x388e05[_0x2caf('0x1c')];var _0x58047b=_0x3b8b67?_0xa75896[_0x2caf('0x1e')]:_0x388e05[_0x2caf('0x1c')]+_0x388e05['limit'];var _0x12624b;if(_0x58047b>=_0x2d5b64){_0x58047b=_0x2d5b64;_0x12624b=0xc8;}else{_0x12624b=0xce;}_0x4da5ba[_0x2caf('0x1f')](_0x12624b);return _0x4da5ba[_0x2caf('0x20')](_0x2caf('0x21'),_0x4a33fc+'-'+_0x58047b+'/'+_0x2d5b64)[_0x2caf('0x1b')](_0xa75896);}return null;};}function patchUpdates(_0x595f2f){return function(_0xfa426f){try{jsonpatch[_0x2caf('0x22')](_0xfa426f,_0x595f2f,!![]);}catch(_0x2b4d16){return BPromise[_0x2caf('0x23')](_0x2b4d16);}return _0xfa426f[_0x2caf('0x24')]();};}function saveUpdates(_0x9d6bae,_0x4092ba){return function(_0x256cc4){if(_0x256cc4){return _0x256cc4[_0x2caf('0x25')](_0x9d6bae)[_0x2caf('0x26')](function(_0x6814bc){return _0x6814bc;});}return null;};}function removeEntity(_0x5231fc,_0x296305){return function(_0x14bfd2){if(_0x14bfd2){return _0x14bfd2[_0x2caf('0x27')]()[_0x2caf('0x26')](function(){_0x5231fc[_0x2caf('0x1f')](0xcc)[_0x2caf('0x1a')]();});}};}function handleEntityNotFound(_0x392196,_0x164da){return function(_0x2e0a75){if(!_0x2e0a75){_0x392196[_0x2caf('0x19')](0x194);}return _0x2e0a75;};}function handleError(_0x5ad211,_0x6a32ac){_0x6a32ac=_0x6a32ac||0x1f4;return function(_0x325eda){logger[_0x2caf('0x28')](_0x325eda[_0x2caf('0x29')]);if(_0x325eda[_0x2caf('0x2a')]){delete _0x325eda[_0x2caf('0x2a')];}_0x5ad211[_0x2caf('0x1f')](_0x6a32ac)[_0x2caf('0x2b')](_0x325eda);};}exports[_0x2caf('0x2c')]=function(_0x2304f1,_0x30da75){var _0x1f477={},_0x158d60={},_0x48b5f7={'count':0x0,'rows':[]};var _0xb944cc=_[_0x2caf('0x2d')](db[_0x2caf('0x2e')][_0x2caf('0x2f')],function(_0xa8523b){return{'name':_0xa8523b[_0x2caf('0x30')],'type':_0xa8523b[_0x2caf('0x31')]['key']};});_0x158d60[_0x2caf('0x32')]=_[_0x2caf('0x2d')](_0xb944cc,'name');_0x158d60[_0x2caf('0x33')]=_[_0x2caf('0x34')](_0x2304f1[_0x2caf('0x33')]);_0x158d60['filters']=_[_0x2caf('0x35')](_0x158d60['model'],_0x158d60['query']);_0x1f477[_0x2caf('0x36')]=_[_0x2caf('0x35')](_0x158d60[_0x2caf('0x32')],qs[_0x2caf('0x37')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1f477[_0x2caf('0x36')]=_0x1f477[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1f477['attributes']:_0x158d60[_0x2caf('0x32')];if(!_0x2304f1[_0x2caf('0x33')][_0x2caf('0x39')](_0x2caf('0x3a'))){_0x1f477[_0x2caf('0x1d')]=qs[_0x2caf('0x1d')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1d')]);_0x1f477[_0x2caf('0x1c')]=qs[_0x2caf('0x1c')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1c')]);}_0x1f477['order']=qs['sort'](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3b')]);_0x1f477[_0x2caf('0x3c')]=qs[_0x2caf('0x3d')](_['pick'](_0x2304f1[_0x2caf('0x33')],_0x158d60[_0x2caf('0x3d')]),_0xb944cc);if(_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]){_0x1f477[_0x2caf('0x3c')]=_[_0x2caf('0x3f')](_0x1f477[_0x2caf('0x3c')],{'$or':_[_0x2caf('0x2d')](_0xb944cc,function(_0x5c133c){if(_0x5c133c['type']!==_0x2caf('0x40')){var _0x863fca={};_0x863fca[_0x5c133c[_0x2caf('0x2a')]]={'$like':'%'+_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]+'%'};return _0x863fca;}})});}_0x1f477=_[_0x2caf('0x3f')]({},_0x1f477,_0x2304f1[_0x2caf('0x41')]);var _0xf93228={'where':_0x1f477[_0x2caf('0x3c')]};return db[_0x2caf('0x2e')][_0x2caf('0x1e')](_0xf93228)['then'](function(_0x35ad7f){_0x48b5f7[_0x2caf('0x1e')]=_0x35ad7f;if(_0x2304f1[_0x2caf('0x33')]['includeAll']){_0x1f477[_0x2caf('0x42')]=[{'all':!![]}];}return db[_0x2caf('0x2e')][_0x2caf('0x43')](_0x1f477);})['then'](function(_0x40cb18){_0x48b5f7[_0x2caf('0x44')]=_0x40cb18;return _0x48b5f7;})['then'](respondWithFilteredResult(_0x30da75,_0x1f477))[_0x2caf('0x45')](handleError(_0x30da75,null));};exports[_0x2caf('0x46')]=function(_0x4e57b0,_0xe5fcbf){var _0x1348d8={'raw':!![],'where':{'id':_0x4e57b0[_0x2caf('0x47')]['id']}},_0x2e4126={};_0x2e4126[_0x2caf('0x32')]=_[_0x2caf('0x34')](db[_0x2caf('0x2e')][_0x2caf('0x2f')]);_0x2e4126['query']=_[_0x2caf('0x34')](_0x4e57b0['query']);_0x2e4126[_0x2caf('0x3d')]=_[_0x2caf('0x35')](_0x2e4126[_0x2caf('0x32')],_0x2e4126['query']);_0x1348d8['attributes']=_[_0x2caf('0x35')](_0x2e4126['model'],qs[_0x2caf('0x37')](_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1348d8[_0x2caf('0x36')]=_0x1348d8[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1348d8[_0x2caf('0x36')]:_0x2e4126[_0x2caf('0x32')];if(_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x48')]){_0x1348d8[_0x2caf('0x42')]=[{'all':!![]}];}_0x1348d8=_[_0x2caf('0x3f')]({},_0x1348d8,_0x4e57b0[_0x2caf('0x41')]);return db[_0x2caf('0x2e')][_0x2caf('0x49')](_0x1348d8)[_0x2caf('0x26')](handleEntityNotFound(_0xe5fcbf,null))[_0x2caf('0x26')](respondWithResult(_0xe5fcbf,null))[_0x2caf('0x45')](handleError(_0xe5fcbf,null));};exports[_0x2caf('0x4a')]=function(_0x3a598b,_0x136dc9){return db['WhatsappApplication'][_0x2caf('0x4a')](_0x3a598b[_0x2caf('0x4b')],{})['then'](respondWithResult(_0x136dc9,0xc9))['catch'](handleError(_0x136dc9,null));};exports[_0x2caf('0x25')]=function(_0x6f0a2a,_0x5a822d){if(_0x6f0a2a[_0x2caf('0x4b')]['id']){delete _0x6f0a2a[_0x2caf('0x4b')]['id'];}return db[_0x2caf('0x2e')][_0x2caf('0x49')]({'where':{'id':_0x6f0a2a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x5a822d,null))[_0x2caf('0x26')](saveUpdates(_0x6f0a2a[_0x2caf('0x4b')],null))[_0x2caf('0x26')](respondWithResult(_0x5a822d,null))[_0x2caf('0x45')](handleError(_0x5a822d,null));};exports[_0x2caf('0x27')]=function(_0x2b318a,_0x41b7b2){return db['WhatsappApplication'][_0x2caf('0x49')]({'where':{'id':_0x2b318a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x41b7b2,null))['then'](removeEntity(_0x41b7b2,null))[_0x2caf('0x45')](handleError(_0x41b7b2,null));}; \ No newline at end of file +var _0x639a=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','error','name','send','index','map','WhatsappApplication','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','length','find','create','body','catch','destroy','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x490b71,_0x33a93d){var _0xaee885=function(_0x44275c){while(--_0x44275c){_0x490b71['push'](_0x490b71['shift']());}};_0xaee885(++_0x33a93d);}(_0x639a,0x1e8));var _0xa639=function(_0x54b788,_0x5f2672){_0x54b788=_0x54b788-0x0;var _0xead890=_0x639a[_0x54b788];return _0xead890;};'use strict';var emlformat=require(_0xa639('0x0'));var rimraf=require(_0xa639('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa639('0x2'));var moment=require(_0xa639('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa639('0x4'));var util=require(_0xa639('0x5'));var path=require(_0xa639('0x6'));var sox=require(_0xa639('0x7'));var csv=require('to-csv');var ejs=require(_0xa639('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa639('0x9'));var squel=require(_0xa639('0xa'));var crypto=require(_0xa639('0xb'));var jsforce=require(_0xa639('0xc'));var deskjs=require(_0xa639('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa639('0xe'));var Papa=require(_0xa639('0xf'));var Redis=require(_0xa639('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa639('0x11'));var as=require(_0xa639('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa639('0x13'))(_0xa639('0x14'));var utils=require('../../config/utils');var config=require(_0xa639('0x15'));var licenseUtil=require(_0xa639('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450aa7,_0x1a666e){_0x1a666e=_0x1a666e||0xcc;return function(_0x110488){if(_0x110488){return _0x450aa7[_0xa639('0x17')](_0x1a666e);}return _0x450aa7[_0xa639('0x18')](_0x1a666e)[_0xa639('0x19')]();};}function respondWithResult(_0x3dc4b5,_0x56fa87){_0x56fa87=_0x56fa87||0xc8;return function(_0x15605d){if(_0x15605d){return _0x3dc4b5[_0xa639('0x18')](_0x56fa87)[_0xa639('0x1a')](_0x15605d);}};}function respondWithFilteredResult(_0x28f05c,_0x19436b){return function(_0x7ec7ce){if(_0x7ec7ce){var _0x10c096=typeof _0x19436b[_0xa639('0x1b')]===_0xa639('0x1c')&&typeof _0x19436b['limit']===_0xa639('0x1c');var _0x1d4f47=_0x7ec7ce['count'];var _0x15002b=_0x10c096?0x0:_0x19436b[_0xa639('0x1b')];var _0x200a65=_0x10c096?_0x7ec7ce[_0xa639('0x1d')]:_0x19436b['offset']+_0x19436b[_0xa639('0x1e')];var _0x108005;if(_0x200a65>=_0x1d4f47){_0x200a65=_0x1d4f47;_0x108005=0xc8;}else{_0x108005=0xce;}_0x28f05c[_0xa639('0x18')](_0x108005);return _0x28f05c[_0xa639('0x1f')]('Content-Range',_0x15002b+'-'+_0x200a65+'/'+_0x1d4f47)[_0xa639('0x1a')](_0x7ec7ce);}return null;};}function patchUpdates(_0x4509df){return function(_0x32d216){try{jsonpatch[_0xa639('0x20')](_0x32d216,_0x4509df,!![]);}catch(_0x20c03d){return BPromise['reject'](_0x20c03d);}return _0x32d216[_0xa639('0x21')]();};}function saveUpdates(_0x1180f1,_0x107a5d){return function(_0x917ed4){if(_0x917ed4){return _0x917ed4['update'](_0x1180f1)[_0xa639('0x22')](function(_0x597397){return _0x597397;});}return null;};}function removeEntity(_0x40954e,_0x11299b){return function(_0x3442cd){if(_0x3442cd){return _0x3442cd['destroy']()[_0xa639('0x22')](function(){_0x40954e['status'](0xcc)[_0xa639('0x19')]();});}};}function handleEntityNotFound(_0x127fa9,_0x10ff2b){return function(_0x14a86d){if(!_0x14a86d){_0x127fa9['sendStatus'](0x194);}return _0x14a86d;};}function handleError(_0x3e4b0b,_0x176dcf){_0x176dcf=_0x176dcf||0x1f4;return function(_0x1414be){logger[_0xa639('0x23')](_0x1414be['stack']);if(_0x1414be[_0xa639('0x24')]){delete _0x1414be[_0xa639('0x24')];}_0x3e4b0b[_0xa639('0x18')](_0x176dcf)[_0xa639('0x25')](_0x1414be);};}exports[_0xa639('0x26')]=function(_0x343360,_0x4cf740){var _0x4cbf18={},_0x43c236={},_0x2cf80a={'count':0x0,'rows':[]};var _0x3a82b5=_[_0xa639('0x27')](db[_0xa639('0x28')]['rawAttributes'],function(_0x5151a1){return{'name':_0x5151a1[_0xa639('0x29')],'type':_0x5151a1['type'][_0xa639('0x2a')]};});_0x43c236['model']=_[_0xa639('0x27')](_0x3a82b5,_0xa639('0x24'));_0x43c236[_0xa639('0x2b')]=_[_0xa639('0x2c')](_0x343360[_0xa639('0x2b')]);_0x43c236[_0xa639('0x2d')]=_[_0xa639('0x2e')](_0x43c236[_0xa639('0x2f')],_0x43c236['query']);_0x4cbf18[_0xa639('0x30')]=_['intersection'](_0x43c236[_0xa639('0x2f')],qs[_0xa639('0x31')](_0x343360['query'][_0xa639('0x31')]));_0x4cbf18[_0xa639('0x30')]=_0x4cbf18['attributes']['length']?_0x4cbf18[_0xa639('0x30')]:_0x43c236[_0xa639('0x2f')];if(!_0x343360[_0xa639('0x2b')][_0xa639('0x32')](_0xa639('0x33'))){_0x4cbf18[_0xa639('0x1e')]=qs['limit'](_0x343360['query'][_0xa639('0x1e')]);_0x4cbf18[_0xa639('0x1b')]=qs['offset'](_0x343360[_0xa639('0x2b')][_0xa639('0x1b')]);}_0x4cbf18[_0xa639('0x34')]=qs[_0xa639('0x35')](_0x343360['query'][_0xa639('0x35')]);_0x4cbf18[_0xa639('0x36')]=qs[_0xa639('0x2d')](_[_0xa639('0x37')](_0x343360['query'],_0x43c236[_0xa639('0x2d')]),_0x3a82b5);if(_0x343360[_0xa639('0x2b')][_0xa639('0x38')]){_0x4cbf18[_0xa639('0x36')]=_[_0xa639('0x39')](_0x4cbf18[_0xa639('0x36')],{'$or':_[_0xa639('0x27')](_0x3a82b5,function(_0x78f94e){if(_0x78f94e[_0xa639('0x3a')]!==_0xa639('0x3b')){var _0x1256a1={};_0x1256a1[_0x78f94e[_0xa639('0x24')]]={'$like':'%'+_0x343360[_0xa639('0x2b')][_0xa639('0x38')]+'%'};return _0x1256a1;}})});}_0x4cbf18=_[_0xa639('0x39')]({},_0x4cbf18,_0x343360[_0xa639('0x3c')]);var _0x563c70={'where':_0x4cbf18[_0xa639('0x36')]};return db[_0xa639('0x28')][_0xa639('0x1d')](_0x563c70)['then'](function(_0x12dd1b){_0x2cf80a[_0xa639('0x1d')]=_0x12dd1b;if(_0x343360[_0xa639('0x2b')][_0xa639('0x3d')]){_0x4cbf18[_0xa639('0x3e')]=[{'all':!![]}];}return db[_0xa639('0x28')][_0xa639('0x3f')](_0x4cbf18);})['then'](function(_0x379143){_0x2cf80a[_0xa639('0x40')]=_0x379143;return _0x2cf80a;})[_0xa639('0x22')](respondWithFilteredResult(_0x4cf740,_0x4cbf18))['catch'](handleError(_0x4cf740,null));};exports['show']=function(_0x571963,_0x16e342){var _0x153aee={'raw':!![],'where':{'id':_0x571963['params']['id']}},_0x6c7dd7={};_0x6c7dd7['model']=_[_0xa639('0x2c')](db[_0xa639('0x28')]['rawAttributes']);_0x6c7dd7[_0xa639('0x2b')]=_['keys'](_0x571963['query']);_0x6c7dd7[_0xa639('0x2d')]=_[_0xa639('0x2e')](_0x6c7dd7['model'],_0x6c7dd7[_0xa639('0x2b')]);_0x153aee[_0xa639('0x30')]=_[_0xa639('0x2e')](_0x6c7dd7[_0xa639('0x2f')],qs[_0xa639('0x31')](_0x571963[_0xa639('0x2b')][_0xa639('0x31')]));_0x153aee[_0xa639('0x30')]=_0x153aee[_0xa639('0x30')][_0xa639('0x41')]?_0x153aee[_0xa639('0x30')]:_0x6c7dd7['model'];if(_0x571963[_0xa639('0x2b')]['includeAll']){_0x153aee[_0xa639('0x3e')]=[{'all':!![]}];}_0x153aee=_[_0xa639('0x39')]({},_0x153aee,_0x571963[_0xa639('0x3c')]);return db[_0xa639('0x28')][_0xa639('0x42')](_0x153aee)[_0xa639('0x22')](handleEntityNotFound(_0x16e342,null))[_0xa639('0x22')](respondWithResult(_0x16e342,null))['catch'](handleError(_0x16e342,null));};exports['create']=function(_0x4d0edd,_0x34dac5){return db[_0xa639('0x28')][_0xa639('0x43')](_0x4d0edd['body'],{})[_0xa639('0x22')](respondWithResult(_0x34dac5,0xc9))['catch'](handleError(_0x34dac5,null));};exports['update']=function(_0x267551,_0xb805cc){if(_0x267551[_0xa639('0x44')]['id']){delete _0x267551[_0xa639('0x44')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x267551['params']['id']}})[_0xa639('0x22')](handleEntityNotFound(_0xb805cc,null))['then'](saveUpdates(_0x267551[_0xa639('0x44')],null))[_0xa639('0x22')](respondWithResult(_0xb805cc,null))[_0xa639('0x45')](handleError(_0xb805cc,null));};exports[_0xa639('0x46')]=function(_0x303f5a,_0x381990){return db[_0xa639('0x28')][_0xa639('0x42')]({'where':{'id':_0x303f5a['params']['id']}})[_0xa639('0x22')](handleEntityNotFound(_0x381990,null))[_0xa639('0x22')](removeEntity(_0x381990,null))[_0xa639('0x45')](handleError(_0x381990,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 480e173..eddfb6c 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 _0x4c4e=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3f45b3,_0x2bfaad){var _0x21819b=function(_0x44151f){while(--_0x44151f){_0x3f45b3['push'](_0x3f45b3['shift']());}};_0x21819b(++_0x2bfaad);}(_0x4c4e,0x152));var _0xe4c4=function(_0x53b566,_0x96dbeb){_0x53b566=_0x53b566-0x0;var _0x3c40bb=_0x4c4e[_0x53b566];return _0x3c40bb;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var logger=require(_0xe4c4('0x1'))(_0xe4c4('0x2'));var moment=require(_0xe4c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4c4('0x4'));var fs=require('fs');var path=require(_0xe4c4('0x5'));var rimraf=require(_0xe4c4('0x6'));var config=require('../../config/environment');var attributes=require(_0xe4c4('0x7'));module['exports']=function(_0x177732,_0x1a12a6){return _0x177732[_0xe4c4('0x8')](_0xe4c4('0x9'),attributes,{'tableName':_0xe4c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4c4('0xb'),'collate':_0xe4c4('0xc')});}; \ No newline at end of file +var _0x19da=['exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x305666,_0x13d9bb){var _0x5139fc=function(_0x9f58ce){while(--_0x9f58ce){_0x305666['push'](_0x305666['shift']());}};_0x5139fc(++_0x13d9bb);}(_0x19da,0x9f));var _0xa19d=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x19da[_0x5be7aa];return _0x215408;};'use strict';var _=require('lodash');var util=require(_0xa19d('0x0'));var logger=require('../../config/logger')(_0xa19d('0x1'));var moment=require('moment');var BPromise=require(_0xa19d('0x2'));var rp=require(_0xa19d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa19d('0x4'));var config=require(_0xa19d('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0xa19d('0x6')]=function(_0x330adb,_0x1f6e10){return _0x330adb[_0xa19d('0x7')](_0xa19d('0x8'),attributes,{'tableName':_0xa19d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa19d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 6e49a3c..9d04181 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 _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x55e0,0xdc));var _0x055e=function(_0x18a941,_0x4cea02){_0x18a941=_0x18a941-0x0;var _0x1e3c2b=_0x55e0[_0x18a941];return _0x1e3c2b;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file +var _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x89ac51,_0x5ecae1){var _0x166509=function(_0x11f862){while(--_0x11f862){_0x89ac51['push'](_0x89ac51['shift']());}};_0x166509(++_0x5ecae1);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2c6c27,_0x583885){_0x2c6c27=_0x2c6c27-0x0;var _0x4bf010=_0x6f0d[_0x2c6c27];return _0x4bf010;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c9f3d28..0dd6a2a 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 _0x1751=['getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x22a34d,_0x141890){var _0x19f3db=function(_0x4cc304){while(--_0x4cc304){_0x22a34d['push'](_0x22a34d['shift']());}};_0x19f3db(++_0x141890);}(_0x1751,0x76));var _0x1175=function(_0x16da80,_0x2313bf){_0x16da80=_0x16da80-0x0;var _0x2ce577=_0x1751[_0x16da80];return _0x2ce577;};'use strict';var multer=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var path=require(_0x1175('0x2'));var timeout=require(_0x1175('0x3'));var express=require('express');var router=express[_0x1175('0x4')]();var fs_extra=require(_0x1175('0x5'));var auth=require(_0x1175('0x6'));var interaction=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var controller=require(_0x1175('0x9'));router[_0x1175('0xa')]('/',auth[_0x1175('0xb')](),controller[_0x1175('0xc')]);router[_0x1175('0xa')](_0x1175('0xd'),auth[_0x1175('0xb')](),controller[_0x1175('0xe')]);router[_0x1175('0xa')](_0x1175('0xf'),auth[_0x1175('0xb')](),controller[_0x1175('0x10')]);router[_0x1175('0xa')](_0x1175('0x11'),auth[_0x1175('0xb')](),controller[_0x1175('0x12')]);router[_0x1175('0xa')](_0x1175('0x13'),auth[_0x1175('0xb')](),controller[_0x1175('0x14')]);router[_0x1175('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1175('0x15')](_0x1175('0x11'),auth['isAuthenticated'](),controller[_0x1175('0x16')]);router[_0x1175('0x15')](_0x1175('0x17'),auth['isAuthenticated'](),interaction[_0x1175('0x18')](_0x1175('0x19'),_0x1175('0x1a')),controller['addTags']);router[_0x1175('0x1b')]('/:id',auth[_0x1175('0xb')](),interaction[_0x1175('0x18')](_0x1175('0x19'),_0x1175('0x1c')),controller['update']);router[_0x1175('0x1d')](_0x1175('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x1175('0x19'),_0x1175('0x1e')),controller[_0x1175('0x1f')]);router[_0x1175('0x1d')](_0x1175('0x17'),auth['isAuthenticated'](),controller[_0x1175('0x20')]);module[_0x1175('0x21')]=router; \ No newline at end of file +var _0x1db9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id/messages','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x1db9,0x176));var _0x91db=function(_0x4d3392,_0x5dc570){_0x4d3392=_0x4d3392-0x0;var _0x5c4cc7=_0x1db9[_0x4d3392];return _0x5c4cc7;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0x8')](_0x91db('0xc'),auth[_0x91db('0xa')](),controller['getMessages']);router[_0x91db('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x91db('0xd')]('/',auth[_0x91db('0xa')](),controller['create']);router['post'](_0x91db('0xc'),auth[_0x91db('0xa')](),controller[_0x91db('0xe')]);router[_0x91db('0xd')](_0x91db('0xf'),auth['isAuthenticated'](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x12')),controller[_0x91db('0x13')]);router[_0x91db('0x14')](_0x91db('0x15'),auth[_0x91db('0xa')](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x16')),controller[_0x91db('0x17')]);router[_0x91db('0x18')]('/:id',auth[_0x91db('0xa')](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x19')),controller[_0x91db('0x1a')]);router[_0x91db('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x91db('0x1b')]);module[_0x91db('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 46dc01c..72b57f5 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 _0x6a83=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x276cc9,_0x17774c){var _0x31ac6b=function(_0x3197da){while(--_0x3197da){_0x276cc9['push'](_0x276cc9['shift']());}};_0x31ac6b(++_0x17774c);}(_0x6a83,0xd2));var _0x36a8=function(_0x1e4590,_0x1fda44){_0x1e4590=_0x1e4590-0x0;var _0x1a790d=_0x6a83[_0x1e4590];return _0x1a790d;};'use strict';var Sequelize=require(_0x36a8('0x0'));var moment=require(_0x36a8('0x1'));module[_0x36a8('0x2')]={'closed':{'type':Sequelize[_0x36a8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x36a8('0x4')]},'disposition':{'type':Sequelize[_0x36a8('0x5')]},'secondDisposition':{'type':Sequelize[_0x36a8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x36a8('0x5')]},'note':{'type':Sequelize[_0x36a8('0x5')]},'phone':{'type':Sequelize[_0x36a8('0x5')]},'read1stAt':{'type':Sequelize[_0x36a8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x36a8('0x6')]('in',_0x36a8('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x36a8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x36a8('0x6')]('in',_0x36a8('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x36a8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1c9a=['STRING','ENUM','out','sequelize','moment','BOOLEAN','DATE'];(function(_0x13ae9c,_0x34982a){var _0x45303a=function(_0x1b4604){while(--_0x1b4604){_0x13ae9c['push'](_0x13ae9c['shift']());}};_0x45303a(++_0x34982a);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x5534be,_0x58f73c){_0x5534be=_0x5534be-0x0;var _0x468ed6=_0x1c9a[_0x5534be];return _0x468ed6;};'use strict';var Sequelize=require(_0xa1c9('0x0'));var moment=require(_0xa1c9('0x1'));module['exports']={'closed':{'type':Sequelize[_0xa1c9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa1c9('0x3')]},'disposition':{'type':Sequelize[_0xa1c9('0x4')]},'secondDisposition':{'type':Sequelize[_0xa1c9('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa1c9('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa1c9('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa1c9('0x5')]('in',_0xa1c9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa1c9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa1c9('0x5')]('in',_0xa1c9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa1c9('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9ad7d5f..3948418 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 _0x9099=['reject','save','update','then','destroy','end','error','stack','name','send','map','fullname','TagIds','split','Tags','push','catch','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','select','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','length','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','body','some','compact','isEmpty','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','merge','create','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','CmContact','firstName','lastName','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closed','Messages','existsSync','createReadStream','createWriteStream','basename','System','out','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x55a1dd,_0x922e97){var _0x58beeb=function(_0x3e8ce8){while(--_0x3e8ce8){_0x55a1dd['push'](_0x55a1dd['shift']());}};_0x58beeb(++_0x922e97);}(_0x9099,0x1ac));var _0x9909=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x9099[_0x61b3ab];return _0x57097f;};'use strict';var emlformat=require(_0x9909('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9909('0x1'));var jsonpatch=require(_0x9909('0x2'));var rp=require(_0x9909('0x3'));var moment=require(_0x9909('0x4'));var BPromise=require(_0x9909('0x5'));var Mustache=require(_0x9909('0x6'));var util=require(_0x9909('0x7'));var path=require(_0x9909('0x8'));var sox=require(_0x9909('0x9'));var csv=require(_0x9909('0xa'));var ejs=require(_0x9909('0xb'));var fs=require('fs');var fs_extra=require(_0x9909('0xc'));var _=require(_0x9909('0xd'));var squel=require(_0x9909('0xe'));var crypto=require('crypto');var jsforce=require(_0x9909('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9909('0x11'));var as=require(_0x9909('0x12'));var pdf=require(_0x9909('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9909('0x14'))('api');var utils=require(_0x9909('0x15'));var config=require(_0x9909('0x16'));var licenseUtil=require(_0x9909('0x17'));var db=require(_0x9909('0x18'))['db'];config[_0x9909('0x19')]=_[_0x9909('0x1a')](config[_0x9909('0x19')],{'host':_0x9909('0x1b'),'port':0x18eb});var socket=require(_0x9909('0x1c'))(new Redis(config[_0x9909('0x19')]));require(_0x9909('0x1d'))[_0x9909('0x1e')](socket);function respondWithStatusCode(_0x4618eb,_0x5699d8){_0x5699d8=_0x5699d8||0xcc;return function(_0x33a8e3){if(_0x33a8e3){return _0x4618eb['sendStatus'](_0x5699d8);}return _0x4618eb[_0x9909('0x1f')](_0x5699d8)['end']();};}function respondWithResult(_0x1a9c97,_0x1b56c7){_0x1b56c7=_0x1b56c7||0xc8;return function(_0x245f0d){if(_0x245f0d){return _0x1a9c97['status'](_0x1b56c7)[_0x9909('0x20')](_0x245f0d);}};}function respondWithFilteredResult(_0xb003b6,_0x180929){return function(_0x2e6c16){if(_0x2e6c16){var _0x1106e5=typeof _0x180929[_0x9909('0x21')]===_0x9909('0x22')&&typeof _0x180929['limit']===_0x9909('0x22');var _0x1ec2d6=_0x2e6c16['count'];var _0x131c0e=_0x1106e5?0x0:_0x180929[_0x9909('0x21')];var _0x20c236=_0x1106e5?_0x2e6c16[_0x9909('0x23')]:_0x180929[_0x9909('0x21')]+_0x180929[_0x9909('0x24')];var _0x262d69;if(_0x20c236>=_0x1ec2d6){_0x20c236=_0x1ec2d6;_0x262d69=0xc8;}else{_0x262d69=0xce;}_0xb003b6['status'](_0x262d69);return _0xb003b6[_0x9909('0x25')](_0x9909('0x26'),_0x131c0e+'-'+_0x20c236+'/'+_0x1ec2d6)['json'](_0x2e6c16);}return null;};}function patchUpdates(_0x4e3651){return function(_0x3a59dc){try{jsonpatch[_0x9909('0x27')](_0x3a59dc,_0x4e3651,!![]);}catch(_0xdd5088){return BPromise[_0x9909('0x28')](_0xdd5088);}return _0x3a59dc[_0x9909('0x29')]();};}function saveUpdates(_0x59c5c9,_0x5f3a5a){return function(_0x2d83a5){if(_0x2d83a5){return _0x2d83a5[_0x9909('0x2a')](_0x59c5c9)[_0x9909('0x2b')](function(_0x1c7ee5){return _0x1c7ee5;});}return null;};}function removeEntity(_0x52be17,_0x20a8ec){return function(_0x2886e2){if(_0x2886e2){return _0x2886e2[_0x9909('0x2c')]()[_0x9909('0x2b')](function(){_0x52be17['status'](0xcc)[_0x9909('0x2d')]();});}};}function handleEntityNotFound(_0x22ff12,_0x19c7e8){return function(_0x14ec4b){if(!_0x14ec4b){_0x22ff12['sendStatus'](0x194);}return _0x14ec4b;};}function handleError(_0xb0b66f,_0x175d52){_0x175d52=_0x175d52||0x1f4;return function(_0x277bec){logger[_0x9909('0x2e')](_0x277bec[_0x9909('0x2f')]);if(_0x277bec[_0x9909('0x30')]){delete _0x277bec[_0x9909('0x30')];}_0xb0b66f['status'](_0x175d52)[_0x9909('0x31')](_0x277bec);};}function getInteractionUsers(_0x3a3f4f,_0x87ac8a){return new BPromise(function(_0x42f1e5,_0x3e4e07){try{if(_0x87ac8a[_0x3a3f4f['id']]){_0x3a3f4f['Users']=_[_0x9909('0x32')](_0x87ac8a[_0x3a3f4f['id']],function(_0x28430b){return{'id':_0x28430b['id'],'fullname':_0x28430b[_0x9909('0x33')]};});}}catch(_0x3e599a){_0x3e4e07(_0x3e599a);}_0x42f1e5(_0x3a3f4f);});}function getInteractionTags(_0xc1bd06,_0x222dd1){return new BPromise(function(_0x3ce25e,_0x342049){try{if(_0xc1bd06['TagIds']){_0xc1bd06['Tags']=[];_0xc1bd06[_0x9909('0x34')][_0x9909('0x35')](',')['forEach'](function(_0x3f218f){_0xc1bd06[_0x9909('0x36')][_0x9909('0x37')](_0x222dd1[_0x3f218f]);});}delete _0xc1bd06[_0x9909('0x34')];}catch(_0x46affb){_0x342049(_0x46affb);}_0x3ce25e(_0xc1bd06);});}function updateWhatsappInteraction(_0x18ecd7,_0x627715,_0x51ed4e){return new BPromise(function(_0x17a7bd,_0x2686f3){return getInteractionUsers(_0x18ecd7,_0x51ed4e)[_0x9909('0x2b')](function(_0x2ed1b7){return getInteractionTags(_0x2ed1b7,_0x627715);})[_0x9909('0x2b')](function(_0x51d546){_0x17a7bd(_0x51d546);})[_0x9909('0x38')](function(_0x362851){_0x2686f3(_0x362851);});});}exports['index']=function(_0xba6bd7,_0x3df562){var _0x26121f={},_0x23035a={},_0x1e2fcc={'count':0x0,'rows':[]};var _0x12f896=_['map'](db[_0x9909('0x39')][_0x9909('0x3a')],function(_0x452b73){return{'name':_0x452b73[_0x9909('0x3b')],'type':_0x452b73[_0x9909('0x3c')][_0x9909('0x3d')]};});_0x23035a[_0x9909('0x3e')]=_[_0x9909('0x32')](_0x12f896,_0x9909('0x30'));_0x23035a[_0x9909('0x3f')]=_[_0x9909('0x40')](_0xba6bd7[_0x9909('0x3f')]);_0x23035a[_0x9909('0x41')]=_[_0x9909('0x42')](_0x23035a[_0x9909('0x3e')],_0x23035a[_0x9909('0x3f')]);_0x26121f[_0x9909('0x43')]=_[_0x9909('0x42')](_0x23035a[_0x9909('0x3e')],qs[_0x9909('0x44')](_0xba6bd7[_0x9909('0x3f')][_0x9909('0x44')]));_0x26121f[_0x9909('0x43')]=_0x26121f['attributes']['length']?_0x26121f[_0x9909('0x43')]:_0x23035a['model'];if(!_0xba6bd7['query'][_0x9909('0x45')](_0x9909('0x46'))){_0x26121f[_0x9909('0x24')]=qs[_0x9909('0x24')](_0xba6bd7['query'][_0x9909('0x24')]);_0x26121f[_0x9909('0x21')]=qs[_0x9909('0x21')](_0xba6bd7['query'][_0x9909('0x21')]);}_0x26121f[_0x9909('0x47')]=qs[_0x9909('0x48')](_0xba6bd7['query'][_0x9909('0x48')]);_0x26121f[_0x9909('0x49')]=qs[_0x9909('0x41')](_[_0x9909('0x4a')](_0xba6bd7[_0x9909('0x3f')],_0x23035a[_0x9909('0x41')]),_0x12f896);var _0xef5aa6=[];var _0x3b1844=squel['select']()[_0x9909('0x4b')]('id')[_0x9909('0x4b')]('name')[_0x9909('0x4b')](_0x9909('0x4c'))['from']('tools_tags');var _0x339a40=squel[_0x9909('0x4d')]()[_0x9909('0x4b')](_0x9909('0x4e'))[_0x9909('0x4b')](_0x9909('0x4f'))[_0x9909('0x4b')](_0x9909('0x50'))[_0x9909('0x51')](_0x9909('0x52'),'ui')['left_join'](_0x9909('0x53'),'u',_0x9909('0x54'));var _0x4234fd=squel[_0x9909('0x4d')]()['from']('whatsapp_interactions','i')[_0x9909('0x55')]('cm_contacts','c',_0x9909('0x56'))[_0x9909('0x55')](_0x9909('0x53'),'o','o.id\x20=\x20i.UserId')[_0x9909('0x55')](_0x9909('0x57'),'a',_0x9909('0x58'))['left_join'](_0x9909('0x59'),'me',_0x9909('0x5a'))[_0x9909('0x55')](_0x9909('0x5b'),'it',_0x9909('0x5c'))[_0x9909('0x55')](_0x9909('0x5d'),'t','t.id\x20=\x20it.TagId');var _0x3bae79=squel[_0x9909('0x5e')]();var _0x515a20=[];var _0x1a7818=squel[_0x9909('0x5e')]();var _0x3d105f;if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x5f')]){_0x3d105f=as['parseSearch'](_0xba6bd7[_0x9909('0x3f')]['search']);var _0xda6344=_0x3d105f[_0x9909('0x60')];for(var _0x3ced89=0x0;_0x3ced89<_0x3d105f[_0x9909('0x61')][_0x9909('0x62')];_0x3ced89++){var _0x3bab23=_0x3d105f[_0x9909('0x61')][_0x3ced89];var _0x109625='i';var _0x5eca81=_['find'](_0x12f896,[_0x9909('0x30'),_0x3bab23['field']]);if(!_0x5eca81){switch(_0x3bab23['field']){case _0x9909('0x63'):if(_0x3bab23[_0x9909('0x64')]==0x1){_0x4234fd['having']('`'+_0x3bab23[_0x9909('0x4b')]+_0x9909('0x65'));}else{_0x4234fd[_0x9909('0x66')]('`'+_0x3bab23[_0x9909('0x4b')]+_0x9909('0x67'));}break;case _0x9909('0x68'):if(_0x3bab23['operator']===_0x9909('0x69')){if(_0x3bab23[_0x9909('0x64')]['split']('\x20')['length']>0x1){_0x3bae79[_0xda6344](_0x9909('0x6a'),qs['getFullTextValue'](_0x3bab23[_0x9909('0x64')]),null);}else{var _0xcec05f='%'+_0x3bab23[_0x9909('0x64')]+'%';_0x3bae79[_0xda6344](_0x9909('0x6b'),_0xcec05f,_0xcec05f,_0xcec05f);}}else{_0x5eca81=_['find'](_0x12f896,['name','ContactId']);_0x3bab23[_0x9909('0x4b')]=_0x9909('0x6c');_0x2fa6d4=as['buildExpression'](_0x109625,_0x5eca81['type'],_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4[_0x9909('0x6d')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4['value'][_0x9909('0x2d')]);}break;case _0x9909('0x6f'):var _0x4826b7=_0x3bab23[_0x9909('0x64')][_0x9909('0x35')](',')[_0x9909('0x32')](function(_0x3055fb){return Number(_0x3055fb);});_0x4826b7['forEach'](function(_0x5210bb){_0x1a7818['or'](_0x9909('0x70'),'%,'+_0x5210bb+',%');});_0x515a20=_[_0x9909('0x71')](_0x515a20,_0x4826b7);break;case _0x9909('0x72'):if(_0x3bab23[_0x9909('0x73')]===_0x9909('0x69')){_0x3bae79[_0xda6344](_0x9909('0x74'),'%'+_0x3bab23[_0x9909('0x64')]+'%',null);}else{_0x5eca81=_[_0x9909('0x75')](_0x12f896,[_0x9909('0x30'),_0x9909('0x76')]);_0x3bab23['field']=_0x9909('0x76');_0x2fa6d4=as[_0x9909('0x77')](_0x109625,_0x5eca81[_0x9909('0x3c')],_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4[_0x9909('0x6d')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x2d')]);}break;case _0x9909('0x78'):_0x2fa6d4=as[_0x9909('0x77')]('me',null,_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4['text'],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x2d')]);break;}}else{var _0x2fa6d4=as['buildExpression'](_0x109625,_0x5eca81[_0x9909('0x3c')],_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4['text'],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x2d')]);}}}else{var _0x54d71c=_(_0xba6bd7[_0x9909('0x3f')])[_0x9909('0x40')]()['map'](function(_0x441efb){return _[_0x9909('0x79')](_0x12f896,[_0x9909('0x30'),_0x441efb])?_0x441efb:undefined;})[_0x9909('0x7a')]()[_0x9909('0x64')]();if(!_[_0x9909('0x7b')](_0x54d71c)){_0x54d71c[_0x9909('0x7c')](function(_0x2ed52e){if(_0x2ed52e===_0x9909('0x7d')){_0x4234fd['where'](_0x9909('0x7e'),[]['concat'](_0xba6bd7[_0x9909('0x3f')][_0x2ed52e]));}else if(_0x2ed52e===_0x9909('0x7f')){var _0x5a15eb=JSON[_0x9909('0x80')](_0xba6bd7[_0x9909('0x3f')][_0x2ed52e])[_0x9909('0x81')];var _0x213a4b=JSON[_0x9909('0x80')](_0xba6bd7['query'][_0x2ed52e])['$lte'];_0x4234fd[_0x9909('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a15eb,_0x213a4b);}else{if(_0xba6bd7[_0x9909('0x3f')][_0x2ed52e]===_0x9909('0x82')){_0x4234fd['where']('i.'+_0x2ed52e+_0x9909('0x83'));}else{_0x4234fd[_0x9909('0x49')]('i.'+_0x2ed52e+'\x20=\x20?',_0xba6bd7[_0x9909('0x3f')][_0x2ed52e]);}}});}if(_0xba6bd7['query']['read']){if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x84')]==0x1){_0x4234fd[_0x9909('0x66')]('`unreadMessages`\x20=\x200');}else{_0x4234fd[_0x9909('0x66')](_0x9909('0x85'));}}if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x86')]){_0x515a20=_[_0x9909('0x87')](_0xba6bd7[_0x9909('0x3f')][_0x9909('0x86')])?_0xba6bd7['query']['tag']:new Array(_0xba6bd7['query'][_0x9909('0x86')]);_0x515a20[_0x9909('0x7c')](function(_0x3764b9){_0x1a7818['or'](_0x9909('0x70'),'%,'+_0x3764b9+',%');});}if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x88')]){var _0x38cc08=_0xba6bd7[_0x9909('0x3f')][_0x9909('0x88')][_0x9909('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9909('0x8a')](_0x38cc08)){_0x3bae79['or'](_0x9909('0x8b'),_0x38cc08+'%')['or'](_0x9909('0x8c'),_0x38cc08+'%');}else{_0x3bae79['or'](_0x9909('0x8d'),qs['getFullTextValue'](_0x38cc08))['or'](_0x9909('0x8e'),_0x38cc08+'%');}}}_0x4234fd[_0x9909('0x49')](_0x3bae79);_0x4234fd['group'](_0x9909('0x8f'));var _0x86b352={'type':db['Sequelize'][_0x9909('0x90')][_0x9909('0x91')],'raw':!![]};var _0x509f45=_0x4234fd[_0x9909('0x92')]();_0x509f45[_0x9909('0x4b')](_0x9909('0x8f'));_0x509f45[_0x9909('0x4b')](_0x9909('0x93'),_0x9909('0x63'));if(_0x26121f['order']){_0x26121f['order'][_0x9909('0x7c')](function(_0x2c07c2){var _0x1b36b8=_0x2c07c2[0x0]===_0x9909('0x94')?_0x2c07c2[0x0]:'i.'+_0x2c07c2[0x0];_0x4234fd[_0x9909('0x47')](_0x1b36b8,_0x2c07c2[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9909('0x7b')](_0x515a20)){_0x4234fd[_0x9909('0x66')](_0x1a7818);_0x509f45[_0x9909('0x49')]('t.id\x20IN\x20?',_0x515a20);}BPromise[_0x9909('0x95')]()['then'](function(){if(!_0x3d105f){if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x7d')])return;_0x509f45[_0x9909('0x49')](_0x9909('0x96'));_0x4234fd[_0x9909('0x49')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xba6bd7[_0x9909('0x97')]['role']!==_0x9909('0x98'))return;return _0xba6bd7['user'][_0x9909('0x99')]({'attributes':['id'],'raw':!![]})[_0x9909('0x2b')](function(_0x592553){if(_[_0x9909('0x7b')](_0x592553)){_0x509f45[_0x9909('0x49')](_0x9909('0x9a'));_0x4234fd[_0x9909('0x49')](_0x9909('0x9a'));}else{_0x509f45[_0x9909('0x49')](_0x9909('0x7e'),_[_0x9909('0x32')](_0x592553,'id'));_0x4234fd['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x592553,'id'));}});})[_0x9909('0x2b')](function(){if(_0xba6bd7[_0x9909('0x97')][_0x9909('0x9b')]===_0x9909('0x98')&&!_0x3d105f&&!_0xba6bd7[_0x9909('0x3f')][_0x9909('0x7d')])return[];return db[_0x9909('0x9c')]['query'](_0x509f45[_0x9909('0x9d')](),_0x86b352);})['then'](function(_0x20692c){_0x1e2fcc[_0x9909('0x23')]=_0x20692c[_0x9909('0x62')];if(_0x1e2fcc[_0x9909('0x23')]===0x0)return[];return db['sequelize'][_0x9909('0x3f')](_0x3b1844['toString'](),_0x86b352)['then'](function(_0x26520d){_0xef5aa6=_['keyBy'](_0x26520d,'id');_0x86b352=_['merge'](_0x86b352,{'model':db[_0x9909('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x44')]){_0x26121f[_0x9909('0x43')][_0x9909('0x7c')](function(_0x143a48){_0x4234fd[_0x9909('0x4b')]('i.'+_0x143a48);});}else{_0x4234fd[_0x9909('0x4b')](_0x9909('0x93'),_0x9909('0x63'));_0x4234fd[_0x9909('0x4b')]('a.key','Account.key');_0x4234fd[_0x9909('0x4b')](_0x9909('0x9e'),_0x9909('0x9f'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xa0'),_0x9909('0x94'));_0x4234fd['field']('i.*');_0x4234fd[_0x9909('0x4b')](_0x9909('0xa1'),'Contact.firstName');_0x4234fd['field'](_0x9909('0xa2'),'Contact.lastName');_0x4234fd['field'](_0x9909('0xa3'),_0x9909('0xa4'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xa5'),'Contact.phone');_0x4234fd['field'](_0x9909('0xa6'),_0x9909('0xa7'));_0x4234fd['field'](_0x9909('0xa8'),_0x9909('0xa9'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xaa'),_0x9909('0xab'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xac'),_0x9909('0xad'));_0x4234fd[_0x9909('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9909('0x34'));}if(_0x26121f[_0x9909('0x24')])_0x4234fd[_0x9909('0x24')](_0x26121f[_0x9909('0x24')]);if(_0x26121f[_0x9909('0x21')])_0x4234fd[_0x9909('0x21')](_0x26121f[_0x9909('0x21')]);return db[_0x9909('0x9c')][_0x9909('0x3f')](_0x4234fd[_0x9909('0x9d')](),_0x86b352);})['then'](function(_0x287490){if(_0x287490[_0x9909('0x62')]>0x0)_0x339a40[_0x9909('0x49')](_0x9909('0xae'),_[_0x9909('0x32')](_0x287490,'id'));return db[_0x9909('0x9c')]['query'](_0x339a40['toString'](),_0x86b352)['then'](function(_0x45b5b8){var _0x422ae1=_[_0x9909('0xaf')](_0x45b5b8,'WhatsappInteractionId');var _0x254a9d=[];_0x287490['forEach'](function(_0x3a4663){_0x254a9d[_0x9909('0x37')](updateWhatsappInteraction(_0x3a4663,_0xef5aa6,_0x422ae1));});return BPromise[_0x9909('0xb0')](_0x254a9d);});});})[_0x9909('0x2b')](function(_0x33cdfd){_0x1e2fcc[_0x9909('0xb1')]=_0x33cdfd;return _0x1e2fcc;})[_0x9909('0x2b')](respondWithFilteredResult(_0x3df562,_0x26121f))[_0x9909('0x38')](handleError(_0x3df562,null));};exports[_0x9909('0xb2')]=function(_0x4dc982,_0x5c74a8){var _0x3c822a={'raw':![],'where':{'id':_0x4dc982[_0x9909('0xb3')]['id']}},_0x4ef9ef={};_0x4ef9ef[_0x9909('0x3e')]=_[_0x9909('0x40')](db['WhatsappInteraction'][_0x9909('0x3a')]);_0x4ef9ef[_0x9909('0x3f')]=_[_0x9909('0x40')](_0x4dc982[_0x9909('0x3f')]);_0x4ef9ef[_0x9909('0x41')]=_['intersection'](_0x4ef9ef['model'],_0x4ef9ef[_0x9909('0x3f')]);_0x3c822a['attributes']=_[_0x9909('0x42')](_0x4ef9ef[_0x9909('0x3e')],qs['fields'](_0x4dc982['query'][_0x9909('0x44')]));_0x3c822a['attributes']=_0x3c822a['attributes'][_0x9909('0x62')]?_0x3c822a[_0x9909('0x43')]:_0x4ef9ef[_0x9909('0x3e')];if(_0x4dc982[_0x9909('0x3f')][_0x9909('0xb4')]){_0x3c822a[_0x9909('0xb5')]=[{'all':!![]}];}_0x3c822a=_[_0x9909('0xb6')]({},_0x3c822a,_0x4dc982['options']);return db['WhatsappInteraction'][_0x9909('0x75')](_0x3c822a)[_0x9909('0x2b')](handleEntityNotFound(_0x5c74a8,null))[_0x9909('0x2b')](respondWithResult(_0x5c74a8,null))[_0x9909('0x38')](handleError(_0x5c74a8,null));};exports[_0x9909('0xb7')]=function(_0x54a088,_0x22d6de){return db['WhatsappInteraction'][_0x9909('0xb7')](_0x54a088[_0x9909('0x78')],{})[_0x9909('0x2b')](respondWithResult(_0x22d6de,0xc9))[_0x9909('0x38')](handleError(_0x22d6de,null));};exports['update']=function(_0x2a06ed,_0x500e3b){if(_0x2a06ed[_0x9909('0x78')]['id']){delete _0x2a06ed[_0x9909('0x78')]['id'];}return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x2a06ed[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x500e3b,null))['then'](saveUpdates(_0x2a06ed['body'],null))[_0x9909('0x2b')](respondWithResult(_0x500e3b,null))[_0x9909('0x38')](handleError(_0x500e3b,null));};exports[_0x9909('0x2c')]=function(_0x335271,_0x889f15){return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x335271[_0x9909('0xb3')]['id']}})['then'](handleEntityNotFound(_0x889f15,null))[_0x9909('0x2b')](removeEntity(_0x889f15,null))['catch'](handleError(_0x889f15,null));};exports[_0x9909('0xb8')]=function(_0x4f13ab,_0x379bd3){return db[_0x9909('0x39')]['describe']()['then'](respondWithResult(_0x379bd3,null))['catch'](handleError(_0x379bd3,null));};exports['addMessage']=function(_0x1ba368,_0x2db4be,_0x117c43){return db['WhatsappMessage']['find']({'where':{'id':_0x1ba368['params']['id']}})['then'](handleEntityNotFound(_0x2db4be,null))[_0x9909('0x2b')](function(_0x578700){if(_0x578700){return _0x578700[_0x9909('0xb9')](_0x1ba368[_0x9909('0x78')][_0x9909('0xba')],_[_0x9909('0xbb')](_0x1ba368[_0x9909('0x78')],[_0x9909('0xba'),'id'])||{});}})[_0x9909('0x2b')](respondWithResult(_0x2db4be,null))[_0x9909('0x38')](handleError(_0x2db4be,null));};exports[_0x9909('0xbc')]=function(_0x251274,_0x25bb8f,_0x50d944){var _0x1de908={'raw':![],'where':{}};var _0x207cae={};var _0x21c7ed={'count':0x0,'rows':[]};return db[_0x9909('0x39')][_0x9909('0xbd')]({'where':{'id':_0x251274[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x25bb8f,null))[_0x9909('0x2b')](function(_0x2c6625){if(_0x2c6625){_0x207cae['model']=_[_0x9909('0x40')](db[_0x9909('0xbe')][_0x9909('0x3a')]);_0x207cae[_0x9909('0x3f')]=_[_0x9909('0x40')](_0x251274['query']);_0x207cae[_0x9909('0x41')]=_[_0x9909('0x42')](_0x207cae[_0x9909('0x3e')],_0x207cae['query']);_0x1de908[_0x9909('0x43')]=_['intersection'](_0x207cae[_0x9909('0x3e')],qs['fields'](_0x251274['query'][_0x9909('0x44')]));_0x1de908[_0x9909('0x43')]=_0x1de908['attributes'][_0x9909('0x62')]?_0x1de908['attributes']:_0x207cae[_0x9909('0x3e')];if(!_0x251274[_0x9909('0x3f')][_0x9909('0x45')](_0x9909('0x46'))){_0x1de908[_0x9909('0x24')]=qs[_0x9909('0x24')](_0x251274[_0x9909('0x3f')][_0x9909('0x24')]);_0x1de908[_0x9909('0x21')]=qs[_0x9909('0x21')](_0x251274[_0x9909('0x3f')][_0x9909('0x21')]);}_0x1de908[_0x9909('0x47')]=qs['sort'](_0x251274[_0x9909('0x3f')][_0x9909('0x48')]);_0x1de908[_0x9909('0x49')]=qs[_0x9909('0x41')](_[_0x9909('0x4a')](_0x251274[_0x9909('0x3f')],_0x207cae[_0x9909('0x41')]));_0x1de908[_0x9909('0x49')]['WhatsappInteractionId']=_0x2c6625['id'];if(_0x251274[_0x9909('0x3f')][_0x9909('0x88')]){_0x1de908[_0x9909('0x49')]=_[_0x9909('0xb6')](_0x1de908[_0x9909('0x49')],{'$or':_[_0x9909('0x32')](_0x1de908[_0x9909('0x43')],function(_0x4fd410){var _0xdcba2c={};_0xdcba2c[_0x4fd410]={'$like':'%'+_0x251274[_0x9909('0x3f')]['filter']+'%'};return _0xdcba2c;})});}if(_0x251274[_0x9909('0x3f')]['$gte']){var _0x15728d=_0x251274[_0x9909('0x3f')][_0x9909('0x81')][_0x9909('0x35')](',');var _0x32a09d={};_0x32a09d[_0x15728d[0x0]]={'$gte':moment(_0x15728d[0x1])['format'](_0x9909('0xbf'))};_0x1de908[_0x9909('0x49')]=_[_0x9909('0xb6')](_0x1de908[_0x9909('0x49')],_0x32a09d);}_0x1de908=_[_0x9909('0xb6')]({},_0x1de908,_0x251274[_0x9909('0xc0')]);return db[_0x9909('0xbe')][_0x9909('0x23')]({'where':_0x1de908[_0x9909('0x49')]})[_0x9909('0x2b')](function(_0x36fcf8){_0x21c7ed[_0x9909('0x23')]=_0x36fcf8;if(_0x251274[_0x9909('0x3f')]['includeAll']){_0x1de908[_0x9909('0xb5')]=[{'all':!![]}];}return db[_0x9909('0xbe')][_0x9909('0xc1')](_0x1de908);})[_0x9909('0x2b')](function(_0x404c56){_0x21c7ed['rows']=_0x404c56;return _0x21c7ed;});}})[_0x9909('0x2b')](respondWithFilteredResult(_0x25bb8f,_0x1de908))[_0x9909('0x38')](handleError(_0x25bb8f,null));};exports[_0x9909('0xc2')]=function(_0x27bd6c,_0x20e40a,_0x143436){return db['WhatsappInteraction'][_0x9909('0x75')]({'where':{'id':_0x27bd6c[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x20e40a,null))[_0x9909('0x2b')](function(_0x468395){if(_0x468395){return _0x468395[_0x9909('0xc3')](_0x27bd6c['body']['ids'],_['omit'](_0x27bd6c[_0x9909('0x78')],[_0x9909('0xba'),'id'])||{})['spread'](function(){return db['Tag'][_0x9909('0xc1')]({'attributes':['id','name','color'],'where':{'id':_0x27bd6c[_0x9909('0x78')][_0x9909('0xba')]}});})['then'](function(_0x27c595){socket[_0x9909('0xc4')]('whatsappInteractionTags:save',{'id':Number(_0x27bd6c[_0x9909('0xb3')]['id']),'tags':_0x27c595||[]});return{'id':Number(_0x27bd6c[_0x9909('0xb3')]['id']),'tags':_0x27c595||[]};});}})['then'](respondWithResult(_0x20e40a,null))[_0x9909('0x38')](handleError(_0x20e40a,null));};exports[_0x9909('0xc5')]=function(_0x55ebd6,_0x4cf2ee,_0xd5b857){return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x55ebd6[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x4cf2ee,null))[_0x9909('0x2b')](function(_0x3ff0ca){if(_0x3ff0ca){return _0x3ff0ca[_0x9909('0xc5')](_0x55ebd6[_0x9909('0x3f')]['ids']);}})[_0x9909('0x2b')](respondWithStatusCode(_0x4cf2ee,null))[_0x9909('0x38')](handleError(_0x4cf2ee,null));};exports[_0x9909('0xc6')]=function(_0x3e2137,_0x1246f3){var _0x1ee511=moment()[_0x9909('0xc7')]()[_0x9909('0x9d')]();var _0x315a3c=path[_0x9909('0xc8')](config[_0x9909('0xc9')],_0x9909('0xca'),_0x9909('0xcb'),_0x9909('0xcc'));var _0x18506f=path['join'](config['root'],'server',_0x9909('0xcb'),_0x9909('0xcd'));var _0x57eda2=path[_0x9909('0xc8')](_0x315a3c,_0x1ee511);var _0x433f2e=util[_0x9909('0xce')]('transcript-%d-%s.zip',_0x3e2137[_0x9909('0xb3')]['id'],_0x1ee511);var _0x3cf227=path['join'](_0x315a3c,_0x433f2e);var _0x18d4e0=[];_0x18d4e0[_0x9909('0x37')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x18d4e0[_0x9909('0x37')]({'model':db[_0x9909('0xcf')],'as':'Contact','attributes':['id',_0x9909('0xd0'),_0x9909('0xd1')],'raw':!![]});if(_0x3e2137[_0x9909('0x3f')][_0x9909('0xcd')]){_0x18d4e0[_0x9909('0x37')]({'model':db[_0x9909('0xd2')],'as':_0x9909('0xd2'),'raw':!![]});}var _0xe69745=[{'model':db[_0x9909('0xbe')],'as':'Messages','attributes':['id',_0x9909('0x78'),_0x9909('0x7f'),_0x9909('0xd3'),_0x9909('0xd4'),_0x9909('0x84')],'include':_0x18d4e0}];_0xe69745[_0x9909('0x37')]({'model':db[_0x9909('0xd5')],'as':_0x9909('0xd6'),'attributes':['id',_0x9909('0x30')]});_0xe69745[_0x9909('0x37')]({'model':db[_0x9909('0x72')],'as':_0x9909('0xd7'),'attributes':['id',_0x9909('0x33')]});return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x3e2137[_0x9909('0xb3')]['id']},'include':_0xe69745})[_0x9909('0x2b')](handleEntityNotFound(_0x1246f3,null))[_0x9909('0x2b')](function(_0x1704cf){if(_0x1704cf){var _0xb64266=_0x1704cf[_0x9909('0xd8')]({'plain':!![]});fs[_0x9909('0xd9')](_0x57eda2);var _0x8c0b89={'channel':_0x9909('0xda'),'account':_0xb64266[_0x9909('0xd6')]['name'],'agent':_0xb64266['Owner']?_0xb64266[_0x9909('0xd7')]['fullname']:'N.A.','createdAt':moment(_0xb64266['createdAt'])[_0x9909('0xce')](_0x9909('0xbf'))[_0x9909('0x9d')](),'closedAt':_0xb64266[_0x9909('0xdb')]?moment(_0xb64266['closedAt'])[_0x9909('0xce')](_0x9909('0xbf'))[_0x9909('0x9d')]():'','disposition':_0xb64266['disposition'],'messages':_(_0xb64266[_0x9909('0xdc')])['filter']({'secret':![]})[_0x9909('0x32')](function(_0x55c326){if(_0x55c326['Attachment']){var _0x531bad=path[_0x9909('0xc8')](_0x18506f,_0x55c326[_0x9909('0xd2')]['basename']);if(fs[_0x9909('0xdd')](_0x531bad)){fs[_0x9909('0xde')](_0x531bad)['pipe'](fs[_0x9909('0xdf')](path['join'](_0x57eda2,_0x55c326[_0x9909('0xd2')][_0x9909('0xe0')])));}}return{'date':moment(_0x55c326[_0x9909('0x7f')])[_0x9909('0xce')](_0x9909('0xbf'))[_0x9909('0x9d')](),'sender':_0x55c326[_0x9909('0xd3')]==='out'?_0x55c326['User']?_0x55c326['User'][_0x9909('0x33')]:_0x9909('0xe1'):_0x55c326[_0x9909('0x68')]['firstName']+(_0x55c326[_0x9909('0x68')][_0x9909('0xd1')]?'\x20'+_0x55c326[_0x9909('0x68')][_0x9909('0xd1')]:''),'body':_0x55c326[_0x9909('0xd2')]?_0x55c326[_0x9909('0xd2')]['basename']:_0x55c326[_0x9909('0x78')],'direction':_0x55c326[_0x9909('0xd3')]===_0x9909('0xe2')?'A':'C','secret':_0x55c326[_0x9909('0xd4')],'read':_0x55c326['read'],'attachment':_0x55c326[_0x9909('0xd2')]};})[_0x9909('0x64')]()};return ejs[_0x9909('0xe3')](path['join'](config[_0x9909('0xc9')],_0x9909('0xca'),_0x9909('0xe4'),_0x9909('0xe5')),{'interaction':_0x8c0b89})['then'](function(_0x25b65a){var _0x229a9d=path[_0x9909('0xc8')](_0x57eda2,'transcript-'+_0xb64266['id']+'-'+_0x1ee511+_0x9909('0xe6'));var _0x3dd43c={'path':_0x229a9d,'channel':_0x9909('0xda'),'interactionId':_0xb64266['id']};return pdf[_0x9909('0xe7')](_0x25b65a,_0x3dd43c);})[_0x9909('0x2b')](function(){return new BPromise(function(_0x5bf403,_0xec5a91){zipdir(_0x57eda2,{'saveTo':_0x3cf227},function(_0x3dac68,_0x253994){if(_0x3dac68)return _0xec5a91(_0x3dac68);return _0x5bf403(_0x253994);});})[_0x9909('0x2b')](function(){return new BPromise(function(_0x275550,_0x3efe39){rimraf(_0x57eda2,function(_0x5845fc){if(_0x5845fc)_0x3efe39(_0x5845fc);return _0x275550();});});})[_0x9909('0x2b')](function(){return _0x1246f3[_0x9909('0xc6')](_0x3cf227,_0x433f2e,function(_0xd230ed){if(_0xd230ed){console[_0x9909('0xe8')]('err',_0xd230ed);}else{fs[_0x9909('0xe9')](_0x3cf227);}});});});}else{return _0x1246f3['sendStatus'](0xc8);}})[_0x9909('0x38')](handleError(_0x1246f3,null));}; \ No newline at end of file +var _0x46fc=['root','server','files','Contact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','fullname','mkdirSync','Whatsapp','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','renderFile','transcript-','.pdf','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','Users','map','TagIds','Tags','forEach','push','index','WhatsappInteraction','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','whatsapp_interactions','cm_contacts','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','contactName','DESC','isEmpty','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','show','params','rawAttributes','includeAll','include','catch','create','describe','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','pick','format','merge','findAll','rows','setTags','spread','whatsappInteractionTags:save','removeTags','download','unix','join'];(function(_0x12e3a6,_0x579511){var _0x4a3d41=function(_0x5c1ac0){while(--_0x5c1ac0){_0x12e3a6['push'](_0x12e3a6['shift']());}};_0x4a3d41(++_0x579511);}(_0x46fc,0x103));var _0xc46f=function(_0x2121d5,_0x2712cd){_0x2121d5=_0x2121d5-0x0;var _0x2df819=_0x46fc[_0x2121d5];return _0x2df819;};'use strict';var emlformat=require(_0xc46f('0x0'));var rimraf=require(_0xc46f('0x1'));var zipdir=require(_0xc46f('0x2'));var jsonpatch=require(_0xc46f('0x3'));var rp=require(_0xc46f('0x4'));var moment=require(_0xc46f('0x5'));var BPromise=require(_0xc46f('0x6'));var Mustache=require(_0xc46f('0x7'));var util=require(_0xc46f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc46f('0x9'));var ejs=require(_0xc46f('0xa'));var fs=require('fs');var fs_extra=require(_0xc46f('0xb'));var _=require(_0xc46f('0xc'));var squel=require(_0xc46f('0xd'));var crypto=require(_0xc46f('0xe'));var jsforce=require(_0xc46f('0xf'));var deskjs=require(_0xc46f('0x10'));var toCsv=require(_0xc46f('0x9'));var querystring=require(_0xc46f('0x11'));var Papa=require(_0xc46f('0x12'));var Redis=require(_0xc46f('0x13'));var authService=require(_0xc46f('0x14'));var qs=require(_0xc46f('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xc46f('0x16'));var hardwareService=require(_0xc46f('0x17'));var logger=require(_0xc46f('0x18'))(_0xc46f('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc46f('0x1a'))['db'];config[_0xc46f('0x1b')]=_['defaults'](config[_0xc46f('0x1b')],{'host':_0xc46f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc46f('0x1d'))[_0xc46f('0x1e')](socket);function respondWithStatusCode(_0x355729,_0x1c218b){_0x1c218b=_0x1c218b||0xcc;return function(_0x4a27e1){if(_0x4a27e1){return _0x355729['sendStatus'](_0x1c218b);}return _0x355729['status'](_0x1c218b)[_0xc46f('0x1f')]();};}function respondWithResult(_0x1e67bf,_0x39dabd){_0x39dabd=_0x39dabd||0xc8;return function(_0x516238){if(_0x516238){return _0x1e67bf[_0xc46f('0x20')](_0x39dabd)[_0xc46f('0x21')](_0x516238);}};}function respondWithFilteredResult(_0x5229c0,_0x4e94e8){return function(_0x4740b3){if(_0x4740b3){var _0x512e54=typeof _0x4e94e8[_0xc46f('0x22')]===_0xc46f('0x23')&&typeof _0x4e94e8[_0xc46f('0x24')]==='undefined';var _0x474af7=_0x4740b3[_0xc46f('0x25')];var _0x40a731=_0x512e54?0x0:_0x4e94e8[_0xc46f('0x22')];var _0x5758fc=_0x512e54?_0x4740b3['count']:_0x4e94e8['offset']+_0x4e94e8['limit'];var _0x4be9ed;if(_0x5758fc>=_0x474af7){_0x5758fc=_0x474af7;_0x4be9ed=0xc8;}else{_0x4be9ed=0xce;}_0x5229c0[_0xc46f('0x20')](_0x4be9ed);return _0x5229c0[_0xc46f('0x26')](_0xc46f('0x27'),_0x40a731+'-'+_0x5758fc+'/'+_0x474af7)[_0xc46f('0x21')](_0x4740b3);}return null;};}function patchUpdates(_0x48a52b){return function(_0xc95165){try{jsonpatch[_0xc46f('0x28')](_0xc95165,_0x48a52b,!![]);}catch(_0x751c14){return BPromise['reject'](_0x751c14);}return _0xc95165[_0xc46f('0x29')]();};}function saveUpdates(_0x286f37,_0x51790f){return function(_0x1094e8){if(_0x1094e8){return _0x1094e8[_0xc46f('0x2a')](_0x286f37)[_0xc46f('0x2b')](function(_0x5efd2c){return _0x5efd2c;});}return null;};}function removeEntity(_0x370a04,_0x54eab5){return function(_0xfe7910){if(_0xfe7910){return _0xfe7910[_0xc46f('0x2c')]()[_0xc46f('0x2b')](function(){_0x370a04[_0xc46f('0x20')](0xcc)[_0xc46f('0x1f')]();});}};}function handleEntityNotFound(_0x470926,_0x34e1ad){return function(_0x10a881){if(!_0x10a881){_0x470926['sendStatus'](0x194);}return _0x10a881;};}function handleError(_0x329add,_0x1a5f64){_0x1a5f64=_0x1a5f64||0x1f4;return function(_0x5ae7c8){logger[_0xc46f('0x2d')](_0x5ae7c8['stack']);if(_0x5ae7c8[_0xc46f('0x2e')]){delete _0x5ae7c8[_0xc46f('0x2e')];}_0x329add[_0xc46f('0x20')](_0x1a5f64)['send'](_0x5ae7c8);};}function getInteractionUsers(_0x1889b4,_0x23bfe9){return new BPromise(function(_0x474fa9,_0x26bc0c){try{if(_0x23bfe9[_0x1889b4['id']]){_0x1889b4[_0xc46f('0x2f')]=_[_0xc46f('0x30')](_0x23bfe9[_0x1889b4['id']],function(_0x475f28){return{'id':_0x475f28['id'],'fullname':_0x475f28['fullname']};});}}catch(_0x3efae2){_0x26bc0c(_0x3efae2);}_0x474fa9(_0x1889b4);});}function getInteractionTags(_0x372a42,_0xc4c5d6){return new BPromise(function(_0x3b157b,_0x5d4627){try{if(_0x372a42[_0xc46f('0x31')]){_0x372a42[_0xc46f('0x32')]=[];_0x372a42[_0xc46f('0x31')]['split'](',')[_0xc46f('0x33')](function(_0x19c3b5){_0x372a42[_0xc46f('0x32')][_0xc46f('0x34')](_0xc4c5d6[_0x19c3b5]);});}delete _0x372a42['TagIds'];}catch(_0x51d28f){_0x5d4627(_0x51d28f);}_0x3b157b(_0x372a42);});}function updateWhatsappInteraction(_0x3a6a9e,_0x252397,_0x2e6b3a){return new BPromise(function(_0x6eafe7,_0x9acbf3){return getInteractionUsers(_0x3a6a9e,_0x2e6b3a)[_0xc46f('0x2b')](function(_0x150634){return getInteractionTags(_0x150634,_0x252397);})[_0xc46f('0x2b')](function(_0x147055){_0x6eafe7(_0x147055);})['catch'](function(_0x473e05){_0x9acbf3(_0x473e05);});});}exports[_0xc46f('0x35')]=function(_0x5d2119,_0xa2ed40){var _0x1efb54={},_0x558ebe={},_0x2dd0ae={'count':0x0,'rows':[]};var _0x1dbe7f=_[_0xc46f('0x30')](db[_0xc46f('0x36')]['rawAttributes'],function(_0x498d89){return{'name':_0x498d89[_0xc46f('0x37')],'type':_0x498d89[_0xc46f('0x38')]['key']};});_0x558ebe['model']=_[_0xc46f('0x30')](_0x1dbe7f,'name');_0x558ebe['query']=_[_0xc46f('0x39')](_0x5d2119[_0xc46f('0x3a')]);_0x558ebe[_0xc46f('0x3b')]=_[_0xc46f('0x3c')](_0x558ebe['model'],_0x558ebe[_0xc46f('0x3a')]);_0x1efb54['attributes']=_[_0xc46f('0x3c')](_0x558ebe[_0xc46f('0x3d')],qs[_0xc46f('0x3e')](_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x3e')]));_0x1efb54[_0xc46f('0x3f')]=_0x1efb54[_0xc46f('0x3f')][_0xc46f('0x40')]?_0x1efb54['attributes']:_0x558ebe[_0xc46f('0x3d')];if(!_0x5d2119['query'][_0xc46f('0x41')]('nolimit')){_0x1efb54['limit']=qs['limit'](_0x5d2119['query'][_0xc46f('0x24')]);_0x1efb54['offset']=qs['offset'](_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x22')]);}_0x1efb54[_0xc46f('0x42')]=qs[_0xc46f('0x43')](_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x43')]);_0x1efb54[_0xc46f('0x44')]=qs[_0xc46f('0x3b')](_['pick'](_0x5d2119[_0xc46f('0x3a')],_0x558ebe[_0xc46f('0x3b')]),_0x1dbe7f);var _0x78a5b7=[];var _0x29d4d8=squel[_0xc46f('0x45')]()[_0xc46f('0x46')]('id')[_0xc46f('0x46')]('name')['field'](_0xc46f('0x47'))[_0xc46f('0x48')](_0xc46f('0x49'));var _0x5141bd=squel['select']()[_0xc46f('0x46')](_0xc46f('0x4a'))[_0xc46f('0x46')](_0xc46f('0x4b'))[_0xc46f('0x46')](_0xc46f('0x4c'))['from']('user_has_whatsapp_interactions','ui')[_0xc46f('0x4d')](_0xc46f('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x239caa=squel[_0xc46f('0x45')]()[_0xc46f('0x48')](_0xc46f('0x4f'),'i')['left_join'](_0xc46f('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc46f('0x4d')](_0xc46f('0x4e'),'o','o.id\x20=\x20i.UserId')[_0xc46f('0x4d')](_0xc46f('0x51'),'a',_0xc46f('0x52'))[_0xc46f('0x4d')](_0xc46f('0x53'),'me',_0xc46f('0x54'))[_0xc46f('0x4d')](_0xc46f('0x55'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xc46f('0x49'),'t','t.id\x20=\x20it.TagId');var _0x497642=squel['expr']();var _0x2f7ad2=[];var _0x455472=squel[_0xc46f('0x56')]();var _0x15317c;if(_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x57')]){_0x15317c=as[_0xc46f('0x58')](_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x57')]);var _0x41c60a=_0x15317c[_0xc46f('0x59')];for(var _0x54c5d7=0x0;_0x54c5d7<_0x15317c['conditions'][_0xc46f('0x40')];_0x54c5d7++){var _0x2e1a74=_0x15317c[_0xc46f('0x5a')][_0x54c5d7];var _0x2206e8='i';var _0x470ec8=_[_0xc46f('0x5b')](_0x1dbe7f,[_0xc46f('0x2e'),_0x2e1a74[_0xc46f('0x46')]]);if(!_0x470ec8){switch(_0x2e1a74[_0xc46f('0x46')]){case _0xc46f('0x5c'):if(_0x2e1a74[_0xc46f('0x5d')]==0x1){_0x239caa[_0xc46f('0x5e')]('`'+_0x2e1a74['field']+_0xc46f('0x5f'));}else{_0x239caa[_0xc46f('0x5e')]('`'+_0x2e1a74['field']+_0xc46f('0x60'));}break;case'Contact':if(_0x2e1a74['operator']===_0xc46f('0x61')){if(_0x2e1a74[_0xc46f('0x5d')][_0xc46f('0x62')]('\x20')['length']>0x1){_0x497642[_0x41c60a](_0xc46f('0x63'),qs['getFullTextValue'](_0x2e1a74[_0xc46f('0x5d')]),null);}else{var _0x498fc3='%'+_0x2e1a74[_0xc46f('0x5d')]+'%';_0x497642[_0x41c60a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x498fc3,_0x498fc3,_0x498fc3);}}else{_0x470ec8=_[_0xc46f('0x5b')](_0x1dbe7f,[_0xc46f('0x2e'),_0xc46f('0x64')]);_0x2e1a74[_0xc46f('0x46')]='ContactId';_0x28d4af=as[_0xc46f('0x65')](_0x2206e8,_0x470ec8[_0xc46f('0x38')],_0x2e1a74);_0x497642[_0x41c60a](_0x28d4af[_0xc46f('0x66')],_0x28d4af[_0xc46f('0x5d')][_0xc46f('0x67')],_0x28d4af[_0xc46f('0x5d')]['end']);}break;case _0xc46f('0x68'):var _0x1b8156=_0x2e1a74[_0xc46f('0x5d')][_0xc46f('0x62')](',')[_0xc46f('0x30')](function(_0x4716bf){return Number(_0x4716bf);});_0x1b8156['forEach'](function(_0x2a3569){_0x455472['or'](_0xc46f('0x69'),'%,'+_0x2a3569+',%');});_0x2f7ad2=_[_0xc46f('0x6a')](_0x2f7ad2,_0x1b8156);break;case _0xc46f('0x6b'):if(_0x2e1a74[_0xc46f('0x6c')]===_0xc46f('0x61')){_0x497642[_0x41c60a](_0xc46f('0x6d'),'%'+_0x2e1a74[_0xc46f('0x5d')]+'%',null);}else{_0x470ec8=_[_0xc46f('0x5b')](_0x1dbe7f,['name',_0xc46f('0x6e')]);_0x2e1a74[_0xc46f('0x46')]=_0xc46f('0x6e');_0x28d4af=as[_0xc46f('0x65')](_0x2206e8,_0x470ec8[_0xc46f('0x38')],_0x2e1a74);_0x497642[_0x41c60a](_0x28d4af[_0xc46f('0x66')],_0x28d4af[_0xc46f('0x5d')][_0xc46f('0x67')],_0x28d4af[_0xc46f('0x5d')][_0xc46f('0x1f')]);}break;case _0xc46f('0x6f'):_0x28d4af=as[_0xc46f('0x65')]('me',null,_0x2e1a74);_0x497642[_0x41c60a](_0x28d4af[_0xc46f('0x66')],_0x28d4af[_0xc46f('0x5d')][_0xc46f('0x67')],_0x28d4af[_0xc46f('0x5d')]['end']);break;}}else{var _0x28d4af=as[_0xc46f('0x65')](_0x2206e8,_0x470ec8[_0xc46f('0x38')],_0x2e1a74);_0x497642[_0x41c60a](_0x28d4af[_0xc46f('0x66')],_0x28d4af['value'][_0xc46f('0x67')],_0x28d4af['value'][_0xc46f('0x1f')]);}}}else{var _0x4742b9=_(_0x5d2119[_0xc46f('0x3a')])[_0xc46f('0x39')]()[_0xc46f('0x30')](function(_0x165702){return _[_0xc46f('0x70')](_0x1dbe7f,[_0xc46f('0x2e'),_0x165702])?_0x165702:undefined;})[_0xc46f('0x71')]()[_0xc46f('0x5d')]();if(!_['isEmpty'](_0x4742b9)){_0x4742b9['forEach'](function(_0xac2bae){if(_0xac2bae==='WhatsappAccountId'){_0x239caa['where'](_0xc46f('0x72'),[]['concat'](_0x5d2119[_0xc46f('0x3a')][_0xac2bae]));}else if(_0xac2bae===_0xc46f('0x73')){var _0x25ed15=JSON[_0xc46f('0x74')](_0x5d2119[_0xc46f('0x3a')][_0xac2bae])[_0xc46f('0x75')];var _0x4ab401=JSON[_0xc46f('0x74')](_0x5d2119[_0xc46f('0x3a')][_0xac2bae])['$lte'];_0x239caa[_0xc46f('0x44')](_0xc46f('0x76'),_0x25ed15,_0x4ab401);}else{if(_0x5d2119['query'][_0xac2bae]===_0xc46f('0x77')){_0x239caa['where']('i.'+_0xac2bae+_0xc46f('0x78'));}else{_0x239caa[_0xc46f('0x44')]('i.'+_0xac2bae+'\x20=\x20?',_0x5d2119['query'][_0xac2bae]);}}});}if(_0x5d2119['query'][_0xc46f('0x79')]){if(_0x5d2119[_0xc46f('0x3a')]['read']==0x1){_0x239caa[_0xc46f('0x5e')](_0xc46f('0x7a'));}else{_0x239caa[_0xc46f('0x5e')](_0xc46f('0x7b'));}}if(_0x5d2119['query'][_0xc46f('0x7c')]){_0x2f7ad2=_[_0xc46f('0x7d')](_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x7c')])?_0x5d2119['query'][_0xc46f('0x7c')]:new Array(_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x7c')]);_0x2f7ad2['forEach'](function(_0x4ace0b){_0x455472['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4ace0b+',%');});}if(_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x7e')]){var _0xe68f99=_0x5d2119[_0xc46f('0x3a')][_0xc46f('0x7e')][_0xc46f('0x7f')]('\x5c','\x5c\x5c')[_0xc46f('0x7f')](/'/g,'\x27\x27');if(qs[_0xc46f('0x80')](_0xe68f99)){_0x497642['or'](_0xc46f('0x81'),_0xe68f99+'%')['or']('i.phone\x20LIKE\x20?',_0xe68f99+'%');}else{_0x497642['or'](_0xc46f('0x82'),qs[_0xc46f('0x83')](_0xe68f99))['or'](_0xc46f('0x84'),_0xe68f99+'%');}}}_0x239caa[_0xc46f('0x44')](_0x497642);_0x239caa[_0xc46f('0x85')](_0xc46f('0x86'));var _0x267619={'type':db[_0xc46f('0x87')]['QueryTypes'][_0xc46f('0x88')],'raw':!![]};var _0x52cc8f=_0x239caa[_0xc46f('0x89')]();_0x52cc8f[_0xc46f('0x46')]('i.id');_0x52cc8f[_0xc46f('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc46f('0x5c'));if(_0x1efb54[_0xc46f('0x42')]){_0x1efb54[_0xc46f('0x42')][_0xc46f('0x33')](function(_0x4c9252){var _0x59c1ef=_0x4c9252[0x0]===_0xc46f('0x8a')?_0x4c9252[0x0]:'i.'+_0x4c9252[0x0];_0x239caa[_0xc46f('0x42')](_0x59c1ef,_0x4c9252[0x1]===_0xc46f('0x8b')?![]:!![]);});}if(!_[_0xc46f('0x8c')](_0x2f7ad2)){_0x239caa[_0xc46f('0x5e')](_0x455472);_0x52cc8f['where']('t.id\x20IN\x20?',_0x2f7ad2);}BPromise[_0xc46f('0x8d')]()[_0xc46f('0x2b')](function(){if(!_0x15317c){if(_0x5d2119[_0xc46f('0x3a')]['WhatsappAccountId'])return;_0x52cc8f[_0xc46f('0x44')](_0xc46f('0x8e'));_0x239caa[_0xc46f('0x44')](_0xc46f('0x8e'));return;}if(_0x5d2119['user']['role']!==_0xc46f('0x8f'))return;return _0x5d2119[_0xc46f('0x90')][_0xc46f('0x91')]({'attributes':['id'],'raw':!![]})[_0xc46f('0x2b')](function(_0x4a644d){if(_[_0xc46f('0x8c')](_0x4a644d)){_0x52cc8f[_0xc46f('0x44')](_0xc46f('0x92'));_0x239caa[_0xc46f('0x44')](_0xc46f('0x92'));}else{_0x52cc8f[_0xc46f('0x44')]('i.WhatsappAccountId\x20IN\x20?',_[_0xc46f('0x30')](_0x4a644d,'id'));_0x239caa[_0xc46f('0x44')](_0xc46f('0x72'),_[_0xc46f('0x30')](_0x4a644d,'id'));}});})[_0xc46f('0x2b')](function(){if(_0x5d2119[_0xc46f('0x90')]['role']===_0xc46f('0x8f')&&!_0x15317c&&!_0x5d2119[_0xc46f('0x3a')]['WhatsappAccountId'])return[];return db[_0xc46f('0x93')][_0xc46f('0x3a')](_0x52cc8f[_0xc46f('0x94')](),_0x267619);})['then'](function(_0x433bbe){_0x2dd0ae['count']=_0x433bbe[_0xc46f('0x40')];if(_0x2dd0ae[_0xc46f('0x25')]===0x0)return[];return db[_0xc46f('0x93')][_0xc46f('0x3a')](_0x29d4d8[_0xc46f('0x94')](),_0x267619)['then'](function(_0x42f0f1){_0x78a5b7=_['keyBy'](_0x42f0f1,'id');_0x267619=_['merge'](_0x267619,{'model':db[_0xc46f('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d2119['query']['fields']){_0x1efb54[_0xc46f('0x3f')][_0xc46f('0x33')](function(_0x1a940a){_0x239caa[_0xc46f('0x46')]('i.'+_0x1a940a);});}else{_0x239caa[_0xc46f('0x46')](_0xc46f('0x95'),_0xc46f('0x5c'));_0x239caa['field']('a.key',_0xc46f('0x96'));_0x239caa[_0xc46f('0x46')]('a.mandatoryDisposition',_0xc46f('0x97'));_0x239caa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x239caa['field'](_0xc46f('0x98'));_0x239caa['field'](_0xc46f('0x99'),_0xc46f('0x9a'));_0x239caa['field'](_0xc46f('0x9b'),_0xc46f('0x9c'));_0x239caa[_0xc46f('0x46')](_0xc46f('0x9d'),_0xc46f('0x9e'));_0x239caa[_0xc46f('0x46')](_0xc46f('0x9f'),_0xc46f('0xa0'));_0x239caa['field'](_0xc46f('0xa1'),'Contact.mobile');_0x239caa[_0xc46f('0x46')](_0xc46f('0xa2'),_0xc46f('0xa3'));_0x239caa[_0xc46f('0x46')](_0xc46f('0xa4'),'Owner.fullname');_0x239caa[_0xc46f('0x46')](_0xc46f('0xa5'),'Owner.internal');_0x239caa[_0xc46f('0x46')](_0xc46f('0xa6'),_0xc46f('0x31'));}if(_0x1efb54[_0xc46f('0x24')])_0x239caa[_0xc46f('0x24')](_0x1efb54[_0xc46f('0x24')]);if(_0x1efb54['offset'])_0x239caa[_0xc46f('0x22')](_0x1efb54[_0xc46f('0x22')]);return db[_0xc46f('0x93')][_0xc46f('0x3a')](_0x239caa[_0xc46f('0x94')](),_0x267619);})[_0xc46f('0x2b')](function(_0x3a7c12){if(_0x3a7c12[_0xc46f('0x40')]>0x0)_0x5141bd['where']('ui.WhatsappInteractionId\x20IN\x20?',_[_0xc46f('0x30')](_0x3a7c12,'id'));return db[_0xc46f('0x93')][_0xc46f('0x3a')](_0x5141bd[_0xc46f('0x94')](),_0x267619)[_0xc46f('0x2b')](function(_0x18b612){var _0xd59a8f=_[_0xc46f('0xa7')](_0x18b612,'WhatsappInteractionId');var _0x3e1dd4=[];_0x3a7c12[_0xc46f('0x33')](function(_0x1f908d){_0x3e1dd4[_0xc46f('0x34')](updateWhatsappInteraction(_0x1f908d,_0x78a5b7,_0xd59a8f));});return BPromise[_0xc46f('0xa8')](_0x3e1dd4);});});})[_0xc46f('0x2b')](function(_0x14e29c){_0x2dd0ae['rows']=_0x14e29c;return _0x2dd0ae;})[_0xc46f('0x2b')](respondWithFilteredResult(_0xa2ed40,_0x1efb54))['catch'](handleError(_0xa2ed40,null));};exports[_0xc46f('0xa9')]=function(_0x49307a,_0x3a519c){var _0x194088={'raw':![],'where':{'id':_0x49307a[_0xc46f('0xaa')]['id']}},_0x2e12e6={};_0x2e12e6[_0xc46f('0x3d')]=_[_0xc46f('0x39')](db[_0xc46f('0x36')][_0xc46f('0xab')]);_0x2e12e6[_0xc46f('0x3a')]=_[_0xc46f('0x39')](_0x49307a[_0xc46f('0x3a')]);_0x2e12e6[_0xc46f('0x3b')]=_[_0xc46f('0x3c')](_0x2e12e6[_0xc46f('0x3d')],_0x2e12e6[_0xc46f('0x3a')]);_0x194088[_0xc46f('0x3f')]=_['intersection'](_0x2e12e6[_0xc46f('0x3d')],qs[_0xc46f('0x3e')](_0x49307a['query'][_0xc46f('0x3e')]));_0x194088[_0xc46f('0x3f')]=_0x194088[_0xc46f('0x3f')][_0xc46f('0x40')]?_0x194088[_0xc46f('0x3f')]:_0x2e12e6[_0xc46f('0x3d')];if(_0x49307a[_0xc46f('0x3a')][_0xc46f('0xac')]){_0x194088[_0xc46f('0xad')]=[{'all':!![]}];}_0x194088=_['merge']({},_0x194088,_0x49307a['options']);return db[_0xc46f('0x36')][_0xc46f('0x5b')](_0x194088)[_0xc46f('0x2b')](handleEntityNotFound(_0x3a519c,null))[_0xc46f('0x2b')](respondWithResult(_0x3a519c,null))[_0xc46f('0xae')](handleError(_0x3a519c,null));};exports[_0xc46f('0xaf')]=function(_0x2477f7,_0xc14786){return db['WhatsappInteraction'][_0xc46f('0xaf')](_0x2477f7[_0xc46f('0x6f')],{})[_0xc46f('0x2b')](respondWithResult(_0xc14786,0xc9))[_0xc46f('0xae')](handleError(_0xc14786,null));};exports[_0xc46f('0x2a')]=function(_0x2cb7e7,_0x58a831){if(_0x2cb7e7[_0xc46f('0x6f')]['id']){delete _0x2cb7e7[_0xc46f('0x6f')]['id'];}return db['WhatsappInteraction'][_0xc46f('0x5b')]({'where':{'id':_0x2cb7e7[_0xc46f('0xaa')]['id']}})[_0xc46f('0x2b')](handleEntityNotFound(_0x58a831,null))[_0xc46f('0x2b')](saveUpdates(_0x2cb7e7['body'],null))[_0xc46f('0x2b')](respondWithResult(_0x58a831,null))[_0xc46f('0xae')](handleError(_0x58a831,null));};exports[_0xc46f('0x2c')]=function(_0x41c48b,_0x3b633d){return db[_0xc46f('0x36')][_0xc46f('0x5b')]({'where':{'id':_0x41c48b['params']['id']}})['then'](handleEntityNotFound(_0x3b633d,null))['then'](removeEntity(_0x3b633d,null))[_0xc46f('0xae')](handleError(_0x3b633d,null));};exports[_0xc46f('0xb0')]=function(_0x4edf2a,_0x229d16){return db[_0xc46f('0x36')][_0xc46f('0xb0')]()[_0xc46f('0x2b')](respondWithResult(_0x229d16,null))['catch'](handleError(_0x229d16,null));};exports['addMessage']=function(_0x29c5d9,_0x25d6ab,_0x441b8c){return db[_0xc46f('0xb1')]['find']({'where':{'id':_0x29c5d9[_0xc46f('0xaa')]['id']}})[_0xc46f('0x2b')](handleEntityNotFound(_0x25d6ab,null))[_0xc46f('0x2b')](function(_0x4ca960){if(_0x4ca960){return _0x4ca960['addMessage'](_0x29c5d9[_0xc46f('0x6f')][_0xc46f('0xb2')],_[_0xc46f('0xb3')](_0x29c5d9[_0xc46f('0x6f')],[_0xc46f('0xb2'),'id'])||{});}})[_0xc46f('0x2b')](respondWithResult(_0x25d6ab,null))[_0xc46f('0xae')](handleError(_0x25d6ab,null));};exports[_0xc46f('0xb4')]=function(_0x3dc834,_0x1a1a24,_0x41f95e){var _0x3b6c52={'raw':![],'where':{}};var _0x1af50c={};var _0x248600={'count':0x0,'rows':[]};return db[_0xc46f('0x36')][_0xc46f('0xb5')]({'where':{'id':_0x3dc834[_0xc46f('0xaa')]['id']}})[_0xc46f('0x2b')](handleEntityNotFound(_0x1a1a24,null))[_0xc46f('0x2b')](function(_0x4a0f7f){if(_0x4a0f7f){_0x1af50c[_0xc46f('0x3d')]=_[_0xc46f('0x39')](db[_0xc46f('0xb1')][_0xc46f('0xab')]);_0x1af50c[_0xc46f('0x3a')]=_[_0xc46f('0x39')](_0x3dc834['query']);_0x1af50c[_0xc46f('0x3b')]=_[_0xc46f('0x3c')](_0x1af50c['model'],_0x1af50c[_0xc46f('0x3a')]);_0x3b6c52[_0xc46f('0x3f')]=_[_0xc46f('0x3c')](_0x1af50c['model'],qs[_0xc46f('0x3e')](_0x3dc834[_0xc46f('0x3a')][_0xc46f('0x3e')]));_0x3b6c52[_0xc46f('0x3f')]=_0x3b6c52[_0xc46f('0x3f')]['length']?_0x3b6c52['attributes']:_0x1af50c['model'];if(!_0x3dc834[_0xc46f('0x3a')][_0xc46f('0x41')](_0xc46f('0xb6'))){_0x3b6c52['limit']=qs['limit'](_0x3dc834['query'][_0xc46f('0x24')]);_0x3b6c52[_0xc46f('0x22')]=qs[_0xc46f('0x22')](_0x3dc834[_0xc46f('0x3a')][_0xc46f('0x22')]);}_0x3b6c52['order']=qs[_0xc46f('0x43')](_0x3dc834[_0xc46f('0x3a')][_0xc46f('0x43')]);_0x3b6c52[_0xc46f('0x44')]=qs[_0xc46f('0x3b')](_[_0xc46f('0xb7')](_0x3dc834[_0xc46f('0x3a')],_0x1af50c[_0xc46f('0x3b')]));_0x3b6c52[_0xc46f('0x44')]['WhatsappInteractionId']=_0x4a0f7f['id'];if(_0x3dc834[_0xc46f('0x3a')][_0xc46f('0x7e')]){_0x3b6c52[_0xc46f('0x44')]=_['merge'](_0x3b6c52[_0xc46f('0x44')],{'$or':_[_0xc46f('0x30')](_0x3b6c52['attributes'],function(_0x2cf147){var _0x10781c={};_0x10781c[_0x2cf147]={'$like':'%'+_0x3dc834[_0xc46f('0x3a')]['filter']+'%'};return _0x10781c;})});}if(_0x3dc834['query'][_0xc46f('0x75')]){var _0x20d647=_0x3dc834['query'][_0xc46f('0x75')][_0xc46f('0x62')](',');var _0xaa9d94={};_0xaa9d94[_0x20d647[0x0]]={'$gte':moment(_0x20d647[0x1])[_0xc46f('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3b6c52[_0xc46f('0x44')]=_[_0xc46f('0xb9')](_0x3b6c52[_0xc46f('0x44')],_0xaa9d94);}_0x3b6c52=_[_0xc46f('0xb9')]({},_0x3b6c52,_0x3dc834['options']);return db[_0xc46f('0xb1')]['count']({'where':_0x3b6c52[_0xc46f('0x44')]})[_0xc46f('0x2b')](function(_0xa4642c){_0x248600[_0xc46f('0x25')]=_0xa4642c;if(_0x3dc834[_0xc46f('0x3a')][_0xc46f('0xac')]){_0x3b6c52[_0xc46f('0xad')]=[{'all':!![]}];}return db[_0xc46f('0xb1')][_0xc46f('0xba')](_0x3b6c52);})[_0xc46f('0x2b')](function(_0x5871a6){_0x248600[_0xc46f('0xbb')]=_0x5871a6;return _0x248600;});}})['then'](respondWithFilteredResult(_0x1a1a24,_0x3b6c52))[_0xc46f('0xae')](handleError(_0x1a1a24,null));};exports['addTags']=function(_0xcd7cf5,_0x37456d,_0x5a7d47){return db[_0xc46f('0x36')]['find']({'where':{'id':_0xcd7cf5[_0xc46f('0xaa')]['id']}})['then'](handleEntityNotFound(_0x37456d,null))[_0xc46f('0x2b')](function(_0x131846){if(_0x131846){return _0x131846[_0xc46f('0xbc')](_0xcd7cf5[_0xc46f('0x6f')]['ids'],_[_0xc46f('0xb3')](_0xcd7cf5[_0xc46f('0x6f')],['ids','id'])||{})[_0xc46f('0xbd')](function(){return db[_0xc46f('0x68')][_0xc46f('0xba')]({'attributes':['id',_0xc46f('0x2e'),'color'],'where':{'id':_0xcd7cf5[_0xc46f('0x6f')][_0xc46f('0xb2')]}});})[_0xc46f('0x2b')](function(_0x1b22d6){socket['emit'](_0xc46f('0xbe'),{'id':Number(_0xcd7cf5[_0xc46f('0xaa')]['id']),'tags':_0x1b22d6||[]});return{'id':Number(_0xcd7cf5[_0xc46f('0xaa')]['id']),'tags':_0x1b22d6||[]};});}})[_0xc46f('0x2b')](respondWithResult(_0x37456d,null))[_0xc46f('0xae')](handleError(_0x37456d,null));};exports[_0xc46f('0xbf')]=function(_0x1458c7,_0xf0af64,_0x1a8a82){return db[_0xc46f('0x36')][_0xc46f('0x5b')]({'where':{'id':_0x1458c7[_0xc46f('0xaa')]['id']}})[_0xc46f('0x2b')](handleEntityNotFound(_0xf0af64,null))[_0xc46f('0x2b')](function(_0x111353){if(_0x111353){return _0x111353[_0xc46f('0xbf')](_0x1458c7['query'][_0xc46f('0xb2')]);}})['then'](respondWithStatusCode(_0xf0af64,null))[_0xc46f('0xae')](handleError(_0xf0af64,null));};exports[_0xc46f('0xc0')]=function(_0x105e8e,_0x580a7e){var _0xd08f9a=moment()[_0xc46f('0xc1')]()[_0xc46f('0x94')]();var _0x54e6a6=path[_0xc46f('0xc2')](config[_0xc46f('0xc3')],_0xc46f('0xc4'),_0xc46f('0xc5'),'tmp');var _0x529699=path[_0xc46f('0xc2')](config[_0xc46f('0xc3')],'server','files','attachments');var _0xd11afd=path[_0xc46f('0xc2')](_0x54e6a6,_0xd08f9a);var _0x49e790=util[_0xc46f('0xb8')]('transcript-%d-%s.zip',_0x105e8e[_0xc46f('0xaa')]['id'],_0xd08f9a);var _0x26eff7=path[_0xc46f('0xc2')](_0x54e6a6,_0x49e790);var _0x52854f=[];_0x52854f[_0xc46f('0x34')]({'model':db[_0xc46f('0x6b')],'as':_0xc46f('0x6b'),'attributes':['id','fullname'],'raw':!![]});_0x52854f[_0xc46f('0x34')]({'model':db['CmContact'],'as':_0xc46f('0xc6'),'attributes':['id',_0xc46f('0xc7'),_0xc46f('0xc8')],'raw':!![]});if(_0x105e8e[_0xc46f('0x3a')]['attachments']){_0x52854f[_0xc46f('0x34')]({'model':db[_0xc46f('0xc9')],'as':'Attachment','raw':!![]});}var _0x31f396=[{'model':db[_0xc46f('0xb1')],'as':_0xc46f('0xca'),'attributes':['id',_0xc46f('0x6f'),_0xc46f('0x73'),_0xc46f('0xcb'),_0xc46f('0xcc'),_0xc46f('0x79')],'include':_0x52854f}];_0x31f396[_0xc46f('0x34')]({'model':db[_0xc46f('0xcd')],'as':_0xc46f('0xce'),'attributes':['id',_0xc46f('0x2e')]});_0x31f396['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xc46f('0xcf')]});return db[_0xc46f('0x36')][_0xc46f('0x5b')]({'where':{'id':_0x105e8e[_0xc46f('0xaa')]['id']},'include':_0x31f396})[_0xc46f('0x2b')](handleEntityNotFound(_0x580a7e,null))[_0xc46f('0x2b')](function(_0x46c2f4){if(_0x46c2f4){var _0x477bc2=_0x46c2f4['get']({'plain':!![]});fs[_0xc46f('0xd0')](_0xd11afd);var _0x31c00e={'channel':_0xc46f('0xd1'),'account':_0x477bc2[_0xc46f('0xce')]['name'],'agent':_0x477bc2[_0xc46f('0xd2')]?_0x477bc2['Owner'][_0xc46f('0xcf')]:_0xc46f('0xd3'),'createdAt':moment(_0x477bc2['createdAt'])[_0xc46f('0xb8')](_0xc46f('0xd4'))[_0xc46f('0x94')](),'closedAt':_0x477bc2[_0xc46f('0xd5')]?moment(_0x477bc2[_0xc46f('0xd6')])['format'](_0xc46f('0xd4'))[_0xc46f('0x94')]():'','disposition':_0x477bc2[_0xc46f('0xd7')],'messages':_(_0x477bc2[_0xc46f('0xca')])[_0xc46f('0x7e')]({'secret':![]})[_0xc46f('0x30')](function(_0x64eb93){if(_0x64eb93['Attachment']){var _0x1e29cc=path[_0xc46f('0xc2')](_0x529699,_0x64eb93[_0xc46f('0xc9')]['basename']);if(fs[_0xc46f('0xd8')](_0x1e29cc)){fs[_0xc46f('0xd9')](_0x1e29cc)[_0xc46f('0xda')](fs[_0xc46f('0xdb')](path[_0xc46f('0xc2')](_0xd11afd,_0x64eb93[_0xc46f('0xc9')][_0xc46f('0xdc')])));}}return{'date':moment(_0x64eb93[_0xc46f('0x73')])[_0xc46f('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc46f('0x94')](),'sender':_0x64eb93[_0xc46f('0xcb')]===_0xc46f('0xdd')?_0x64eb93['User']?_0x64eb93[_0xc46f('0x6b')][_0xc46f('0xcf')]:_0xc46f('0xde'):_0x64eb93[_0xc46f('0xc6')][_0xc46f('0xc7')]+(_0x64eb93[_0xc46f('0xc6')][_0xc46f('0xc8')]?'\x20'+_0x64eb93['Contact'][_0xc46f('0xc8')]:''),'body':_0x64eb93[_0xc46f('0xc9')]?_0x64eb93[_0xc46f('0xc9')]['basename']:_0x64eb93['body'],'direction':_0x64eb93[_0xc46f('0xcb')]===_0xc46f('0xdd')?'A':'C','secret':_0x64eb93[_0xc46f('0xcc')],'read':_0x64eb93['read'],'attachment':_0x64eb93[_0xc46f('0xc9')]};})[_0xc46f('0x5d')]()};return ejs[_0xc46f('0xdf')](path[_0xc46f('0xc2')](config['root'],_0xc46f('0xc4'),'views','downloadInteraction.ejs'),{'interaction':_0x31c00e})[_0xc46f('0x2b')](function(_0xc72581){var _0x553955=path[_0xc46f('0xc2')](_0xd11afd,_0xc46f('0xe0')+_0x477bc2['id']+'-'+_0xd08f9a+_0xc46f('0xe1'));var _0x949ba8={'path':_0x553955,'channel':_0xc46f('0xd1'),'interactionId':_0x477bc2['id']};return pdf['createPdfFromHTML'](_0xc72581,_0x949ba8);})[_0xc46f('0x2b')](function(){return new BPromise(function(_0x528864,_0x1498f7){zipdir(_0xd11afd,{'saveTo':_0x26eff7},function(_0x272aa1,_0x262e90){if(_0x272aa1)return _0x1498f7(_0x272aa1);return _0x528864(_0x262e90);});})[_0xc46f('0x2b')](function(){return new BPromise(function(_0x3021f8,_0x24dc49){rimraf(_0xd11afd,function(_0x5d56f2){if(_0x5d56f2)_0x24dc49(_0x5d56f2);return _0x3021f8();});});})[_0xc46f('0x2b')](function(){return _0x580a7e[_0xc46f('0xc0')](_0x26eff7,_0x49e790,function(_0x513e4e){if(_0x513e4e){console[_0xc46f('0xe2')]('err',_0x513e4e);}else{fs['unlinkSync'](_0x26eff7);}});});});}else{return _0x580a7e['sendStatus'](0xc8);}})[_0xc46f('0xae')](handleError(_0x580a7e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d408e25..ced9995 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 _0x1ab1=['length','emit','catch','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages'];(function(_0xbe0bad,_0x242e22){var _0x2a18cc=function(_0x17f8ff){while(--_0x17f8ff){_0xbe0bad['push'](_0xbe0bad['shift']());}};_0x2a18cc(++_0x242e22);}(_0x1ab1,0x83));var _0x11ab=function(_0xd88189,_0xacaede){_0xd88189=_0xd88189-0x0;var _0x5838e7=_0x1ab1[_0xd88189];return _0x5838e7;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x11ab('0x0'))['db'][_0x11ab('0x1')];var WhatsappMessage=require(_0x11ab('0x0'))['db'][_0x11ab('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x11ab('0x3')](0x0);var events={'afterCreate':_0x11ab('0x4'),'afterUpdate':_0x11ab('0x5'),'afterDestroy':'remove'};function emitEvent(_0xded89b){return function(_0x2689a2,_0x260c92,_0x173e17){_0x2689a2[_0x11ab('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe4281a){_0x2689a2[_0x11ab('0x7')](_0x11ab('0x8'),_0xe4281a[_0x11ab('0x9')](function(_0x495619){return{'id':_0x495619['id']};}));return WhatsappMessage[_0x11ab('0xa')]({'where':{'WhatsappInteractionId':_0x2689a2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x11ab('0xb')](function(_0xf74671){_0x2689a2[_0x11ab('0x7')](_0x11ab('0xc'),_0xf74671[_0x11ab('0xd')]);WhatsappInteractionEvents[_0x11ab('0xe')](_0xded89b+':'+_0x2689a2['id'],_0x2689a2);WhatsappInteractionEvents['emit'](_0xded89b,_0x2689a2);_0x173e17(null);})[_0x11ab('0xf')](_0x173e17(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x11ab('0x10')](e,emitEvent(event));}}module[_0x11ab('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4c71=['setDataValue','Users','map','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','getUsers'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x4c71,0x12b));var _0x14c7=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x4c71[_0xaa1b3e];return _0x454d7d;};'use strict';var EventEmitter=require(_0x14c7('0x0'));var WhatsappInteraction=require(_0x14c7('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x14c7('0x1'))['db'][_0x14c7('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x14c7('0x3')](0x0);var events={'afterCreate':_0x14c7('0x4'),'afterUpdate':_0x14c7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10a777){return function(_0xd22e73,_0x24fd35,_0x3c6929){_0xd22e73[_0x14c7('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3f1868){_0xd22e73[_0x14c7('0x7')](_0x14c7('0x8'),_0x3f1868[_0x14c7('0x9')](function(_0x2f19cc){return{'id':_0x2f19cc['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xd22e73['id'],'direction':'in','read':![]},'raw':!![]});})[_0x14c7('0xa')](function(_0x4f2d04){_0xd22e73[_0x14c7('0x7')](_0x14c7('0xb'),_0x4f2d04['length']);WhatsappInteractionEvents[_0x14c7('0xc')](_0x10a777+':'+_0xd22e73['id'],_0xd22e73);WhatsappInteractionEvents[_0x14c7('0xc')](_0x10a777,_0xd22e73);_0x3c6929(null);})[_0x14c7('0xd')](_0x3c6929(null));};}for(var e in events){if(events[_0x14c7('0xe')](e)){var event=events[e];WhatsappInteraction[_0x14c7('0xf')](e,emitEvent(event));}}module[_0x14c7('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 1b5c5de..1f45b74 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 _0x148c=['whatsapp_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x556af9,_0x14e668){var _0x3436e9=function(_0x2159cb){while(--_0x2159cb){_0x556af9['push'](_0x556af9['shift']());}};_0x3436e9(++_0x14e668);}(_0x148c,0x18f));var _0xc148=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x148c[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0xc148('0x0'));var util=require('util');var logger=require(_0xc148('0x1'))(_0xc148('0x2'));var moment=require(_0xc148('0x3'));var BPromise=require('bluebird');var rp=require(_0xc148('0x4'));var fs=require('fs');var path=require(_0xc148('0x5'));var rimraf=require(_0xc148('0x6'));var config=require(_0xc148('0x7'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x38b9d6,_0x1f5124){return _0x38b9d6['define']('WhatsappInteraction',attributes,{'tableName':_0xc148('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1df6f5,_0x255989,_0x4a2aae){if(_0x1df6f5['changed'](_0xc148('0x9'))){_0x1df6f5['closedAt']=moment()['format'](_0xc148('0xa'));}_0x4a2aae(null,_0x1df6f5);}}});}; \ No newline at end of file +var _0xdf65=['whatsapp_interactions','changed','closed','closedAt','format','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x225e24,_0x478574){var _0x526038=function(_0xfe2533){while(--_0xfe2533){_0x225e24['push'](_0x225e24['shift']());}};_0x526038(++_0x478574);}(_0xdf65,0x6e));var _0x5df6=function(_0x2529ce,_0x32822f){_0x2529ce=_0x2529ce-0x0;var _0x487133=_0xdf65[_0x2529ce];return _0x487133;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5df6('0x0'))(_0x5df6('0x1'));var moment=require('moment');var BPromise=require(_0x5df6('0x2'));var rp=require(_0x5df6('0x3'));var fs=require('fs');var path=require(_0x5df6('0x4'));var rimraf=require('rimraf');var config=require(_0x5df6('0x5'));var attributes=require(_0x5df6('0x6'));module[_0x5df6('0x7')]=function(_0x117d80,_0x31667e){return _0x117d80[_0x5df6('0x8')](_0x5df6('0x9'),attributes,{'tableName':_0x5df6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x205182,_0x4d5fff,_0x564a15){if(_0x205182[_0x5df6('0xb')](_0x5df6('0xc'))){_0x205182[_0x5df6('0xd')]=moment()[_0x5df6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x564a15(null,_0x205182);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e55ceba..b70cab6 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 _0xded5=['where','attributes','limit','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw'];(function(_0x16d219,_0x4a2a73){var _0x13430b=function(_0x11952d){while(--_0x11952d){_0x16d219['push'](_0x16d219['shift']());}};_0x13430b(++_0x4a2a73);}(_0xded5,0x1c0));var _0x5ded=function(_0x20a13e,_0x358d4b){_0x20a13e=_0x20a13e-0x0;var _0x136a55=_0xded5[_0x20a13e];return _0x136a55;};'use strict';var _=require(_0x5ded('0x0'));var util=require(_0x5ded('0x1'));var moment=require(_0x5ded('0x2'));var BPromise=require(_0x5ded('0x3'));var rs=require(_0x5ded('0x4'));var fs=require('fs');var Redis=require(_0x5ded('0x5'));var db=require(_0x5ded('0x6'))['db'];var utils=require(_0x5ded('0x7'));var logger=require(_0x5ded('0x8'))('rpc');var config=require(_0x5ded('0x9'));var jayson=require(_0x5ded('0xa'));var client=jayson[_0x5ded('0xb')][_0x5ded('0xc')]({'port':0x232a});config[_0x5ded('0xd')]=_[_0x5ded('0xe')](config[_0x5ded('0xd')],{'host':_0x5ded('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ded('0xd')]));require(_0x5ded('0x10'))[_0x5ded('0x11')](socket);function respondWithRpcPromise(_0xedc680,_0x43bbb3,_0x25b428){return new BPromise(function(_0x535a94,_0x222b2a){return client[_0x5ded('0x12')](_0xedc680,_0x25b428)[_0x5ded('0x13')](function(_0x589872){logger[_0x5ded('0x14')](_0x5ded('0x15'),_0x43bbb3,_0x5ded('0x16'));logger[_0x5ded('0x17')](_0x5ded('0x18'),_0x43bbb3,_0x5ded('0x16'),JSON[_0x5ded('0x19')](_0x589872));if(_0x589872[_0x5ded('0x1a')]){if(_0x589872[_0x5ded('0x1a')]['code']===0x1f4){logger[_0x5ded('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x43bbb3,_0x589872[_0x5ded('0x1a')][_0x5ded('0x1b')]);return _0x222b2a(_0x589872[_0x5ded('0x1a')]['message']);}logger[_0x5ded('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x43bbb3,_0x589872['error'][_0x5ded('0x1b')]);return _0x535a94(_0x589872[_0x5ded('0x1a')]['message']);}else{logger[_0x5ded('0x14')](_0x5ded('0x15'),_0x43bbb3,_0x5ded('0x16'));_0x535a94(_0x589872[_0x5ded('0x1c')][_0x5ded('0x1b')]);}})[_0x5ded('0x1d')](function(_0x7c2879){logger[_0x5ded('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x43bbb3,_0x7c2879);_0x222b2a(_0x7c2879);});});}exports[_0x5ded('0x1e')]=function(_0x3dc402){var _0x21bd0f=this;return new Promise(function(_0x24b97e,_0x44b11){return db[_0x5ded('0x1f')][_0x5ded('0x20')](_0x3dc402[_0x5ded('0x21')],{'raw':_0x3dc402[_0x5ded('0x22')]?_0x3dc402[_0x5ded('0x22')][_0x5ded('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dc402[_0x5ded('0x22')]?_0x3dc402[_0x5ded('0x22')][_0x5ded('0x24')]||null:null,'attributes':_0x3dc402['options']?_0x3dc402['options'][_0x5ded('0x25')]||null:null,'limit':_0x3dc402['options']?_0x3dc402['options'][_0x5ded('0x26')]||null:null})[_0x5ded('0x13')](function(_0x5c3a5f){logger[_0x5ded('0x14')](_0x5ded('0x1e'),_0x3dc402);logger['debug'](_0x5ded('0x1e'),_0x3dc402,JSON[_0x5ded('0x19')](_0x5c3a5f));_0x24b97e(_0x5c3a5f);})['catch'](function(_0x34d7f7){logger[_0x5ded('0x1a')]('UpdateWhatsappInteraction',_0x34d7f7[_0x5ded('0x1b')],_0x3dc402);_0x44b11(_0x21bd0f[_0x5ded('0x1a')](0x1f4,_0x34d7f7[_0x5ded('0x1b')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3209ff){return new Promise(function(_0x14836a,_0x3068c1){return db['WhatsappInteraction']['find']({'where':_0x3209ff['options']?_0x3209ff['options'][_0x5ded('0x24')]||null:null})[_0x5ded('0x13')](function(_0xc23af1){if(_0xc23af1){return _0xc23af1[_0x5ded('0x27')](_0x3209ff[_0x5ded('0x21')][_0x5ded('0x28')],_[_0x5ded('0x29')](_0x3209ff[_0x5ded('0x21')],[_0x5ded('0x28'),'id'])||{});}})[_0x5ded('0x2a')](function(_0x53e2e5){logger[_0x5ded('0x14')](_0x5ded('0x2b'),_0x3209ff);logger[_0x5ded('0x17')](_0x5ded('0x2b'),_0x3209ff,JSON[_0x5ded('0x19')](_0x53e2e5));_0x14836a(_0x53e2e5);})[_0x5ded('0x1d')](function(_0xfa4f4b){logger['error'](_0x5ded('0x2b'),_0xfa4f4b[_0x5ded('0x1b')],_0x3209ff);_0x3068c1(_this['error'](0x1f4,_0xfa4f4b['message']));});});}; \ No newline at end of file +var _0xfedb=['error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','limit','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2e0cee,_0x501154){var _0x30ea4c=function(_0xf9a545){while(--_0xf9a545){_0x2e0cee['push'](_0x2e0cee['shift']());}};_0x30ea4c(++_0x501154);}(_0xfedb,0x1a1));var _0xbfed=function(_0x53f662,_0xcabd4d){_0x53f662=_0x53f662-0x0;var _0x11c2b8=_0xfedb[_0x53f662];return _0x11c2b8;};'use strict';var _=require(_0xbfed('0x0'));var util=require(_0xbfed('0x1'));var moment=require(_0xbfed('0x2'));var BPromise=require(_0xbfed('0x3'));var rs=require(_0xbfed('0x4'));var fs=require('fs');var Redis=require(_0xbfed('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfed('0x6'))(_0xbfed('0x7'));var config=require('../../config/environment');var jayson=require(_0xbfed('0x8'));var client=jayson[_0xbfed('0x9')][_0xbfed('0xa')]({'port':0x232a});config[_0xbfed('0xb')]=_['defaults'](config['redis'],{'host':_0xbfed('0xc'),'port':0x18eb});var socket=require(_0xbfed('0xd'))(new Redis(config[_0xbfed('0xb')]));require(_0xbfed('0xe'))[_0xbfed('0xf')](socket);function respondWithRpcPromise(_0x2f651e,_0x5ad2d5,_0x141397){return new BPromise(function(_0x5b0311,_0x2ba5c4){return client[_0xbfed('0x10')](_0x2f651e,_0x141397)[_0xbfed('0x11')](function(_0x5a2866){logger[_0xbfed('0x12')](_0xbfed('0x13'),_0x5ad2d5,_0xbfed('0x14'));logger[_0xbfed('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5ad2d5,_0xbfed('0x14'),JSON[_0xbfed('0x16')](_0x5a2866));if(_0x5a2866[_0xbfed('0x17')]){if(_0x5a2866[_0xbfed('0x17')][_0xbfed('0x18')]===0x1f4){logger['error'](_0xbfed('0x13'),_0x5ad2d5,_0x5a2866[_0xbfed('0x17')][_0xbfed('0x19')]);return _0x2ba5c4(_0x5a2866[_0xbfed('0x17')][_0xbfed('0x19')]);}logger['error'](_0xbfed('0x13'),_0x5ad2d5,_0x5a2866[_0xbfed('0x17')][_0xbfed('0x19')]);return _0x5b0311(_0x5a2866[_0xbfed('0x17')]['message']);}else{logger[_0xbfed('0x12')](_0xbfed('0x13'),_0x5ad2d5,_0xbfed('0x14'));_0x5b0311(_0x5a2866[_0xbfed('0x1a')][_0xbfed('0x19')]);}})[_0xbfed('0x1b')](function(_0x324a2e){logger[_0xbfed('0x17')](_0xbfed('0x13'),_0x5ad2d5,_0x324a2e);_0x2ba5c4(_0x324a2e);});});}exports[_0xbfed('0x1c')]=function(_0x2a2aa2){var _0x49cf68=this;return new Promise(function(_0x40216a,_0x341635){return db[_0xbfed('0x1d')][_0xbfed('0x1e')](_0x2a2aa2[_0xbfed('0x1f')],{'raw':_0x2a2aa2[_0xbfed('0x20')]?_0x2a2aa2[_0xbfed('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2aa2[_0xbfed('0x20')]?_0x2a2aa2[_0xbfed('0x20')]['where']||null:null,'attributes':_0x2a2aa2[_0xbfed('0x20')]?_0x2a2aa2['options'][_0xbfed('0x21')]||null:null,'limit':_0x2a2aa2[_0xbfed('0x20')]?_0x2a2aa2[_0xbfed('0x20')][_0xbfed('0x22')]||null:null})[_0xbfed('0x11')](function(_0x4f244b){logger['info'](_0xbfed('0x1c'),_0x2a2aa2);logger['debug']('UpdateWhatsappInteraction',_0x2a2aa2,JSON['stringify'](_0x4f244b));_0x40216a(_0x4f244b);})[_0xbfed('0x1b')](function(_0x3dff96){logger[_0xbfed('0x17')]('UpdateWhatsappInteraction',_0x3dff96[_0xbfed('0x19')],_0x2a2aa2);_0x341635(_0x49cf68[_0xbfed('0x17')](0x1f4,_0x3dff96['message']));});});};exports[_0xbfed('0x23')]=function(_0x332e0d){return new Promise(function(_0x3b6593,_0x1af852){return db[_0xbfed('0x1d')][_0xbfed('0x24')]({'where':_0x332e0d[_0xbfed('0x20')]?_0x332e0d['options']['where']||null:null})[_0xbfed('0x11')](function(_0x15f52a){if(_0x15f52a){return _0x15f52a['addTags'](_0x332e0d['body'][_0xbfed('0x25')],_['omit'](_0x332e0d[_0xbfed('0x1f')],[_0xbfed('0x25'),'id'])||{});}})[_0xbfed('0x26')](function(_0x3b0fd7){logger[_0xbfed('0x12')](_0xbfed('0x27'),_0x332e0d);logger[_0xbfed('0x15')](_0xbfed('0x27'),_0x332e0d,JSON[_0xbfed('0x16')](_0x3b0fd7));_0x3b6593(_0x3b0fd7);})[_0xbfed('0x1b')](function(_0x3d5c69){logger['error'](_0xbfed('0x27'),_0x3d5c69[_0xbfed('0x19')],_0x332e0d);_0x1af852(_this[_0xbfed('0x17')](0x1f4,_0x3d5c69[_0xbfed('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a57f64a..d1dad27 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 _0xd79b=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x4004e5,_0x23c94e){var _0x4a9acd=function(_0x4a3879){while(--_0x4a3879){_0x4004e5['push'](_0x4004e5['shift']());}};_0x4a9acd(++_0x23c94e);}(_0xd79b,0xff));var _0xbd79=function(_0x404f06,_0x5a6b4e){_0x404f06=_0x404f06-0x0;var _0x1ca53c=_0xd79b[_0x404f06];return _0x1ca53c;};'use strict';var WhatsappInteractionEvents=require(_0xbd79('0x0'));var events=['save',_0xbd79('0x1'),_0xbd79('0x2')];function createListener(_0xb3b7b1,_0x499a49){return function(_0x25602b){_0x499a49['emit'](_0xb3b7b1,_0x25602b);};}function removeListener(_0x2fbc71,_0x29e475){return function(){WhatsappInteractionEvents[_0xbd79('0x3')](_0x2fbc71,_0x29e475);};}exports['register']=function(_0x39cfb7){for(var _0x2977ae=0x0,_0x29b163=events[_0xbd79('0x4')];_0x2977ae<_0x29b163;_0x2977ae++){var _0x310361=events[_0x2977ae];var _0x2f52fb=createListener(_0xbd79('0x5')+_0x310361,_0x39cfb7);WhatsappInteractionEvents['on'](_0x310361,_0x2f52fb);}}; \ No newline at end of file +var _0x5880=['./whatsappInteraction.events','save','remove','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x455b94,_0x6808a8){var _0x4a9b2e=function(_0x1d3e9e){while(--_0x1d3e9e){_0x455b94['push'](_0x455b94['shift']());}};_0x4a9b2e(++_0x6808a8);}(_0x5880,0x100));var _0x0588=function(_0xf8d01a,_0x2b713d){_0xf8d01a=_0xf8d01a-0x0;var _0x4d048d=_0x5880[_0xf8d01a];return _0x4d048d;};'use strict';var WhatsappInteractionEvents=require(_0x0588('0x0'));var events=[_0x0588('0x1'),_0x0588('0x2'),'update'];function createListener(_0xd1bad8,_0x170c0a){return function(_0x115cfd){_0x170c0a[_0x0588('0x3')](_0xd1bad8,_0x115cfd);};}function removeListener(_0x4e58d9,_0x345dac){return function(){WhatsappInteractionEvents[_0x0588('0x4')](_0x4e58d9,_0x345dac);};}exports[_0x0588('0x5')]=function(_0x538e5e){for(var _0x59567f=0x0,_0x3e21ca=events[_0x0588('0x6')];_0x59567f<_0x3e21ca;_0x59567f++){var _0x249155=events[_0x59567f];var _0xc1387e=createListener(_0x0588('0x7')+_0x249155,_0x538e5e);WhatsappInteractionEvents['on'](_0x249155,_0xc1387e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 413c59a..d962d92 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 _0x4f93=['describe','/:id','show','tracked','whatsappmessage:create','post','/:id/status','put','isAuthenticated','update','/:id/accept','accept','reject','destroy','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x4f93,0x139));var _0x34f9=function(_0x3cb356,_0x107668){_0x3cb356=_0x3cb356-0x0;var _0x1722f5=_0x4f93[_0x3cb356];return _0x1722f5;};'use strict';var multer=require(_0x34f9('0x0'));var util=require('util');var path=require(_0x34f9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x34f9('0x2')]();var fs_extra=require(_0x34f9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x34f9('0x4'));var config=require(_0x34f9('0x5'));var controller=require(_0x34f9('0x6'));router[_0x34f9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x34f9('0x8'),auth['isAuthenticated'](),controller[_0x34f9('0x9')]);router['get'](_0x34f9('0xa'),auth['isAuthenticated'](),controller[_0x34f9('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x34f9('0xc')]('whatsapp',_0x34f9('0xd')),controller['create']);router[_0x34f9('0xe')](_0x34f9('0xf'),controller['status']);router[_0x34f9('0x10')](_0x34f9('0xa'),auth[_0x34f9('0x11')](),controller[_0x34f9('0x12')]);router['put'](_0x34f9('0x13'),auth[_0x34f9('0x11')](),controller[_0x34f9('0x14')]);router[_0x34f9('0x10')]('/:id/reject',auth[_0x34f9('0x11')](),controller[_0x34f9('0x15')]);router['delete']('/:id',auth[_0x34f9('0x11')](),controller[_0x34f9('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe91b=['/describe','describe','/:id','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x41ff98,_0x65cac2){var _0x2631ea=function(_0x36efc8){while(--_0x36efc8){_0x41ff98['push'](_0x41ff98['shift']());}};_0x2631ea(++_0x65cac2);}(_0xe91b,0x177));var _0xbe91=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xe91b[_0x337748];return _0x3bb03f;};'use strict';var multer=require(_0xbe91('0x0'));var util=require(_0xbe91('0x1'));var path=require(_0xbe91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe91('0x3'));var auth=require(_0xbe91('0x4'));var interaction=require(_0xbe91('0x5'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xbe91('0x6')]('/',auth[_0xbe91('0x7')](),controller[_0xbe91('0x8')]);router[_0xbe91('0x6')](_0xbe91('0x9'),auth[_0xbe91('0x7')](),controller[_0xbe91('0xa')]);router[_0xbe91('0x6')](_0xbe91('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbe91('0x7')](),interaction[_0xbe91('0xc')](_0xbe91('0xd'),_0xbe91('0xe')),controller['create']);router['post'](_0xbe91('0xf'),controller[_0xbe91('0x10')]);router[_0xbe91('0x11')](_0xbe91('0xb'),auth[_0xbe91('0x7')](),controller['update']);router[_0xbe91('0x11')](_0xbe91('0x12'),auth[_0xbe91('0x7')](),controller[_0xbe91('0x13')]);router[_0xbe91('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0xbe91('0x14')]);router[_0xbe91('0x15')](_0xbe91('0xb'),auth['isAuthenticated'](),controller[_0xbe91('0x16')]);module[_0xbe91('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 21afee5..20cbe99 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 _0x31c2=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x54e333,_0x4ba478){var _0x47279e=function(_0x8e4f0b){while(--_0x8e4f0b){_0x54e333['push'](_0x54e333['shift']());}};_0x47279e(++_0x4ba478);}(_0x31c2,0x1e1));var _0x231c=function(_0x1e3475,_0x3c8e50){_0x1e3475=_0x1e3475-0x0;var _0xedd1f8=_0x31c2[_0x1e3475];return _0xedd1f8;};'use strict';var Sequelize=require(_0x231c('0x0'));module[_0x231c('0x1')]={'body':{'type':Sequelize[_0x231c('0x2')](_0x231c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x231c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x231c('0x5')]('in',_0x231c('0x6')),'defaultValue':_0x231c('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x231c('0x7')]},'secret':{'type':Sequelize[_0x231c('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x231c('0x8')]},'providerResponse':{'type':Sequelize[_0x231c('0x2')]}}; \ No newline at end of file +var _0xbbfa=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x543f00,_0x5a9d81){var _0x28f636=function(_0x54d470){while(--_0x54d470){_0x543f00['push'](_0x543f00['shift']());}};_0x28f636(++_0x5a9d81);}(_0xbbfa,0x175));var _0xabbf=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0xbbfa[_0x15cbce];return _0x257f29;};'use strict';var Sequelize=require(_0xabbf('0x0'));module[_0xabbf('0x1')]={'body':{'type':Sequelize[_0xabbf('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xabbf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xabbf('0x4')]('in',_0xabbf('0x5')),'defaultValue':_0xabbf('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xabbf('0x6')]},'secret':{'type':Sequelize[_0xabbf('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xabbf('0x7')]},'providerResponse':{'type':Sequelize[_0xabbf('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 3ae3a4c..98af1c6 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 _0xef79=['fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','WhatsappMessage','includeAll','findAll','rows','show','keys','include','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','manual','SIP/%s','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','User','interface','motionChannel','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x39eb5b,_0x4523ac){var _0x3eed6e=function(_0x5d2e47){while(--_0x5d2e47){_0x39eb5b['push'](_0x39eb5b['shift']());}};_0x3eed6e(++_0x4523ac);}(_0xef79,0x16f));var _0x9ef7=function(_0x51a885,_0x4b8536){_0x51a885=_0x51a885-0x0;var _0x44970a=_0xef79[_0x51a885];return _0x44970a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ef7('0x0'));var zipdir=require(_0x9ef7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ef7('0x2'));var moment=require(_0x9ef7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9ef7('0x4'));var util=require(_0x9ef7('0x5'));var path=require('path');var sox=require(_0x9ef7('0x6'));var csv=require(_0x9ef7('0x7'));var ejs=require(_0x9ef7('0x8'));var fs=require('fs');var fs_extra=require(_0x9ef7('0x9'));var _=require(_0x9ef7('0xa'));var squel=require(_0x9ef7('0xb'));var crypto=require(_0x9ef7('0xc'));var jsforce=require(_0x9ef7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ef7('0xe'));var Papa=require(_0x9ef7('0xf'));var Redis=require(_0x9ef7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9ef7('0x11'));var as=require(_0x9ef7('0x12'));var hardwareService=require(_0x9ef7('0x13'));var logger=require(_0x9ef7('0x14'))(_0x9ef7('0x15'));var utils=require(_0x9ef7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9ef7('0x17'));var db=require(_0x9ef7('0x18'))['db'];config[_0x9ef7('0x19')]=_['defaults'](config[_0x9ef7('0x19')],{'host':_0x9ef7('0x1a'),'port':0x18eb});var socket=require(_0x9ef7('0x1b'))(new Redis(config[_0x9ef7('0x19')]));require(_0x9ef7('0x1c'))['register'](socket);var jayson=require(_0x9ef7('0x1d'));var client=jayson[_0x9ef7('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9ef7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x537a8c,_0x40acd5,_0x3a1ff4,_0x5d60fd){return new BPromise(function(_0x359021,_0x57f83a){var _0x120b5f=_0x5d60fd||client;return _0x120b5f[_0x9ef7('0x20')](_0x537a8c,_0x3a1ff4)[_0x9ef7('0x21')](function(_0x5a91fb){logger[_0x9ef7('0x22')](_0x9ef7('0x23'),_0x40acd5,'request\x20sent');logger[_0x9ef7('0x24')](_0x9ef7('0x25'),_0x40acd5,_0x9ef7('0x26'),JSON[_0x9ef7('0x27')](_0x5a91fb));if(_0x5a91fb[_0x9ef7('0x28')]){if(_0x5a91fb[_0x9ef7('0x28')][_0x9ef7('0x29')]===0x1f4){logger[_0x9ef7('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x40acd5,_0x5a91fb[_0x9ef7('0x28')]['message']);return _0x57f83a(_0x5a91fb['error'][_0x9ef7('0x2a')]);}logger[_0x9ef7('0x28')](_0x9ef7('0x23'),_0x40acd5,_0x5a91fb[_0x9ef7('0x28')][_0x9ef7('0x2a')]);return _0x359021(_0x5a91fb[_0x9ef7('0x28')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x40acd5,'request\x20sent');_0x359021(_0x5a91fb[_0x9ef7('0x2b')]['message']);}})[_0x9ef7('0x2c')](function(_0xe85e80){logger[_0x9ef7('0x28')](_0x9ef7('0x23'),_0x40acd5,_0xe85e80);_0x57f83a(_0xe85e80);});});}function respondWithStatusCode(_0x241513,_0x17279d){_0x17279d=_0x17279d||0xcc;return function(_0x4bee0f){if(_0x4bee0f){return _0x241513[_0x9ef7('0x2d')](_0x17279d);}return _0x241513[_0x9ef7('0x2e')](_0x17279d)[_0x9ef7('0x2f')]();};}function respondWithResult(_0x2c2dbe,_0x255e3b){_0x255e3b=_0x255e3b||0xc8;return function(_0x1cf2c6){if(_0x1cf2c6){return _0x2c2dbe[_0x9ef7('0x2e')](_0x255e3b)[_0x9ef7('0x30')](_0x1cf2c6);}};}function respondWithFilteredResult(_0x15c410,_0x882b34){return function(_0x231581){if(_0x231581){var _0x141c47=typeof _0x882b34['offset']===_0x9ef7('0x31')&&typeof _0x882b34[_0x9ef7('0x32')]==='undefined';var _0x6cc653=_0x231581['count'];var _0x222747=_0x141c47?0x0:_0x882b34[_0x9ef7('0x33')];var _0x3ec542=_0x141c47?_0x231581[_0x9ef7('0x34')]:_0x882b34['offset']+_0x882b34[_0x9ef7('0x32')];var _0xc7089c;if(_0x3ec542>=_0x6cc653){_0x3ec542=_0x6cc653;_0xc7089c=0xc8;}else{_0xc7089c=0xce;}_0x15c410[_0x9ef7('0x2e')](_0xc7089c);return _0x15c410[_0x9ef7('0x35')]('Content-Range',_0x222747+'-'+_0x3ec542+'/'+_0x6cc653)[_0x9ef7('0x30')](_0x231581);}return null;};}function patchUpdates(_0x349099){return function(_0x2c9dad){try{jsonpatch[_0x9ef7('0x36')](_0x2c9dad,_0x349099,!![]);}catch(_0x37c5d2){return BPromise[_0x9ef7('0x37')](_0x37c5d2);}return _0x2c9dad[_0x9ef7('0x38')]();};}function saveUpdates(_0x1666be,_0x39a822){return function(_0x5dade8){if(_0x5dade8){return _0x5dade8[_0x9ef7('0x39')](_0x1666be)[_0x9ef7('0x21')](function(_0x1f524f){return _0x1f524f;});}return null;};}function removeEntity(_0x1fab78,_0x5e78a1){return function(_0x20adf7){if(_0x20adf7){return _0x20adf7[_0x9ef7('0x3a')]()[_0x9ef7('0x21')](function(){_0x1fab78[_0x9ef7('0x2e')](0xcc)[_0x9ef7('0x2f')]();});}};}function handleEntityNotFound(_0xf754bc,_0x42f962){return function(_0x293693){if(!_0x293693){_0xf754bc[_0x9ef7('0x2d')](0x194);}return _0x293693;};}function handleError(_0x3ac217,_0x41745c){_0x41745c=_0x41745c||0x1f4;return function(_0x349d53){logger[_0x9ef7('0x28')](_0x349d53[_0x9ef7('0x3b')]);if(_0x349d53[_0x9ef7('0x3c')]){delete _0x349d53[_0x9ef7('0x3c')];}_0x3ac217[_0x9ef7('0x2e')](_0x41745c)[_0x9ef7('0x3d')](_0x349d53);};}exports[_0x9ef7('0x3e')]=function(_0x1b3916,_0x2926d7){var _0x4220dd={},_0x34e9e3={},_0x3a5e9a={'count':0x0,'rows':[]};var _0x43f57b=_[_0x9ef7('0x3f')](db['WhatsappMessage'][_0x9ef7('0x40')],function(_0x23077f){return{'name':_0x23077f[_0x9ef7('0x41')],'type':_0x23077f[_0x9ef7('0x42')][_0x9ef7('0x43')]};});_0x34e9e3[_0x9ef7('0x44')]=_['map'](_0x43f57b,_0x9ef7('0x3c'));_0x34e9e3[_0x9ef7('0x45')]=_['keys'](_0x1b3916[_0x9ef7('0x45')]);_0x34e9e3[_0x9ef7('0x46')]=_['intersection'](_0x34e9e3['model'],_0x34e9e3['query']);_0x4220dd[_0x9ef7('0x47')]=_[_0x9ef7('0x48')](_0x34e9e3[_0x9ef7('0x44')],qs[_0x9ef7('0x49')](_0x1b3916[_0x9ef7('0x45')][_0x9ef7('0x49')]));_0x4220dd[_0x9ef7('0x47')]=_0x4220dd[_0x9ef7('0x47')][_0x9ef7('0x4a')]?_0x4220dd[_0x9ef7('0x47')]:_0x34e9e3[_0x9ef7('0x44')];if(!_0x1b3916[_0x9ef7('0x45')][_0x9ef7('0x4b')]('nolimit')){_0x4220dd['limit']=qs['limit'](_0x1b3916[_0x9ef7('0x45')]['limit']);_0x4220dd[_0x9ef7('0x33')]=qs[_0x9ef7('0x33')](_0x1b3916['query'][_0x9ef7('0x33')]);}_0x4220dd[_0x9ef7('0x4c')]=qs[_0x9ef7('0x4d')](_0x1b3916[_0x9ef7('0x45')][_0x9ef7('0x4d')]);_0x4220dd[_0x9ef7('0x4e')]=qs[_0x9ef7('0x46')](_[_0x9ef7('0x4f')](_0x1b3916['query'],_0x34e9e3[_0x9ef7('0x46')]),_0x43f57b);if(_0x1b3916[_0x9ef7('0x45')][_0x9ef7('0x50')]){_0x4220dd[_0x9ef7('0x4e')]=_[_0x9ef7('0x51')](_0x4220dd[_0x9ef7('0x4e')],{'$or':_[_0x9ef7('0x3f')](_0x43f57b,function(_0x1859e1){if(_0x1859e1[_0x9ef7('0x42')]!=='VIRTUAL'){var _0x5d73b7={};_0x5d73b7[_0x1859e1[_0x9ef7('0x3c')]]={'$like':'%'+_0x1b3916[_0x9ef7('0x45')]['filter']+'%'};return _0x5d73b7;}})});}_0x4220dd=_[_0x9ef7('0x51')]({},_0x4220dd,_0x1b3916[_0x9ef7('0x52')]);var _0x54a4b8={'where':_0x4220dd[_0x9ef7('0x4e')]};return db[_0x9ef7('0x53')][_0x9ef7('0x34')](_0x54a4b8)['then'](function(_0x50826c){_0x3a5e9a[_0x9ef7('0x34')]=_0x50826c;if(_0x1b3916[_0x9ef7('0x45')][_0x9ef7('0x54')]){_0x4220dd['include']=[{'all':!![]}];}return db[_0x9ef7('0x53')][_0x9ef7('0x55')](_0x4220dd);})['then'](function(_0x124287){_0x3a5e9a[_0x9ef7('0x56')]=_0x124287;return _0x3a5e9a;})[_0x9ef7('0x21')](respondWithFilteredResult(_0x2926d7,_0x4220dd))[_0x9ef7('0x2c')](handleError(_0x2926d7,null));};exports[_0x9ef7('0x57')]=function(_0x2465c9,_0x3b2cfe){var _0x17e846={'raw':!![],'where':{'id':_0x2465c9['params']['id']}},_0x394ee7={};_0x394ee7[_0x9ef7('0x44')]=_[_0x9ef7('0x58')](db[_0x9ef7('0x53')]['rawAttributes']);_0x394ee7['query']=_[_0x9ef7('0x58')](_0x2465c9[_0x9ef7('0x45')]);_0x394ee7[_0x9ef7('0x46')]=_[_0x9ef7('0x48')](_0x394ee7[_0x9ef7('0x44')],_0x394ee7[_0x9ef7('0x45')]);_0x17e846[_0x9ef7('0x47')]=_[_0x9ef7('0x48')](_0x394ee7[_0x9ef7('0x44')],qs[_0x9ef7('0x49')](_0x2465c9[_0x9ef7('0x45')]['fields']));_0x17e846[_0x9ef7('0x47')]=_0x17e846[_0x9ef7('0x47')][_0x9ef7('0x4a')]?_0x17e846[_0x9ef7('0x47')]:_0x394ee7['model'];if(_0x2465c9[_0x9ef7('0x45')][_0x9ef7('0x54')]){_0x17e846[_0x9ef7('0x59')]=[{'all':!![]}];}_0x17e846=_[_0x9ef7('0x51')]({},_0x17e846,_0x2465c9[_0x9ef7('0x52')]);return db['WhatsappMessage'][_0x9ef7('0x5a')](_0x17e846)['then'](handleEntityNotFound(_0x3b2cfe,null))[_0x9ef7('0x21')](respondWithResult(_0x3b2cfe,null))[_0x9ef7('0x2c')](handleError(_0x3b2cfe,null));};exports[_0x9ef7('0x5b')]=function(_0x28034c,_0x560d53){return db[_0x9ef7('0x53')]['create'](_0x28034c[_0x9ef7('0x5c')],{})[_0x9ef7('0x21')](respondWithResult(_0x560d53,0xc9))['catch'](handleError(_0x560d53,null));};exports[_0x9ef7('0x39')]=function(_0x28d501,_0x534282){if(_0x28d501['body']['id']){delete _0x28d501[_0x9ef7('0x5c')]['id'];}return db[_0x9ef7('0x53')][_0x9ef7('0x5a')]({'where':{'id':_0x28d501[_0x9ef7('0x5d')]['id']}})[_0x9ef7('0x21')](handleEntityNotFound(_0x534282,null))[_0x9ef7('0x21')](saveUpdates(_0x28d501[_0x9ef7('0x5c')],null))[_0x9ef7('0x21')](respondWithResult(_0x534282,null))[_0x9ef7('0x2c')](handleError(_0x534282,null));};exports[_0x9ef7('0x3a')]=function(_0x423d2f,_0x3fe129){return db[_0x9ef7('0x53')][_0x9ef7('0x5a')]({'where':{'id':_0x423d2f['params']['id']}})[_0x9ef7('0x21')](handleEntityNotFound(_0x3fe129,null))[_0x9ef7('0x21')](removeEntity(_0x3fe129,null))[_0x9ef7('0x2c')](handleError(_0x3fe129,null));};exports[_0x9ef7('0x5e')]=function(_0x254b27,_0x1f2b87){return db[_0x9ef7('0x53')][_0x9ef7('0x5e')]()[_0x9ef7('0x21')](respondWithResult(_0x1f2b87,null))[_0x9ef7('0x2c')](handleError(_0x1f2b87,null));};var interaction_log=require(_0x9ef7('0x14'))(_0x9ef7('0x5f'));exports[_0x9ef7('0x60')]=function(_0x4fbc52,_0x3a0605,_0xd40bf0){var _0x12bc13={'agent':{},'channel':_0x9ef7('0x61')};if(_0x4fbc52[_0x9ef7('0x5c')]['id']){delete _0x4fbc52[_0x9ef7('0x5c')]['id'];}_0x4fbc52[_0x9ef7('0x5c')]['read']=!![];_0x4fbc52['body']['readAt']=moment()[_0x9ef7('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4fbc52[_0x9ef7('0x5c')][_0x9ef7('0x63')]=_0x4fbc52[_0x9ef7('0x5c')][_0x9ef7('0x63')]||_0x4fbc52['user']['id'];_0x12bc13[_0x9ef7('0x64')]['id']=_0x4fbc52['body'][_0x9ef7('0x63')];return db[_0x9ef7('0x53')]['find']({'where':{'id':_0x4fbc52[_0x9ef7('0x5d')]['id'],'UserId':null}})[_0x9ef7('0x21')](handleEntityNotFound(_0x3a0605,null))[_0x9ef7('0x21')](saveUpdates(_0x4fbc52[_0x9ef7('0x5c')],null))[_0x9ef7('0x21')](function(_0x1f3294){if(_0x1f3294){_0x12bc13['message']=_0x1f3294[_0x9ef7('0x65')]({'plain':!![]});return db[_0x9ef7('0x66')]['find']({'where':{'id':_0x1f3294[_0x9ef7('0x67')]}});}return null;})[_0x9ef7('0x21')](handleEntityNotFound(_0x3a0605,null))[_0x9ef7('0x21')](function(_0x5f44c0){if(_0x5f44c0){return _0x5f44c0[_0x9ef7('0x39')]({'UserId':_0x4fbc52['body']['UserId'],'read1stAt':_[_0x9ef7('0x68')](_0x5f44c0[_0x9ef7('0x69')])?moment()[_0x9ef7('0x62')](_0x9ef7('0x6a')):undefined});}return null;})['then'](function(_0x3e53a4){if(_0x3e53a4){_0x12bc13['interaction']=_0x3e53a4[_0x9ef7('0x65')]({'plain':!![]});interaction_log[_0x9ef7('0x22')](_0x9ef7('0x6b'),_0x4fbc52[_0x9ef7('0x6c')]['id'],_0x4fbc52[_0x9ef7('0x6c')][_0x9ef7('0x3c')],_0x4fbc52['user'][_0x9ef7('0x6d')],_0x12bc13[_0x9ef7('0x6e')]['id'],_0x4fbc52[_0x9ef7('0x5c')]?JSON[_0x9ef7('0x27')](_0x4fbc52[_0x9ef7('0x5c')]):_0x9ef7('0x6f'));return respondWithRpcPromise(_0x9ef7('0x70'),_0x9ef7('0x71'),_0x12bc13);}return null;})[_0x9ef7('0x21')](function(_0x3a3324){var _0x58666a=_0x9ef7('0x72')+_0x3a3324[_0x9ef7('0x2a')][_0x9ef7('0x73')];return db[_0x9ef7('0x74')]['query'](_0x58666a,{'type':db[_0x9ef7('0x75')]['QueryTypes'][_0x9ef7('0x76')],'raw':!![]})['then'](function(_0x26c900){return _0x26c900;});})[_0x9ef7('0x21')](function(_0x56c5ad){if(_0x56c5ad){_0x12bc13['message'][_0x9ef7('0x77')]=_0x56c5ad[0x0];if(!_0x4fbc52[_0x9ef7('0x5c')][_0x9ef7('0x63')])return;return db['User'][_0x9ef7('0x5a')]({'where':{'id':_0x4fbc52[_0x9ef7('0x5c')][_0x9ef7('0x63')],'role':_0x9ef7('0x64')},'attributes':['id',_0x9ef7('0x3c'),_0x9ef7('0x78'),_0x9ef7('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x56904a){if(!_0x56904a)return null;_0x12bc13['message'][_0x9ef7('0x64')]=_0x56904a;return _0x12bc13;})[_0x9ef7('0x21')](function(_0x19dccb){if(_0x19dccb){if(_0x4fbc52['body'][_0x9ef7('0x7a')]){_0x12bc13[_0x9ef7('0x2a')]['interface']=util[_0x9ef7('0x62')](_0x9ef7('0x7b'),_0x4fbc52['user'][_0x9ef7('0x3c')]);_0x12bc13['message'][_0x9ef7('0x7c')]=_0x12bc13[_0x9ef7('0x7c')];_0x12bc13['message']['motionChannel']=_0x12bc13['channel'];_0x12bc13['message']['event']='accept';return respondWithRpcPromise(_0x9ef7('0x7d'),_0x9ef7('0x7d'),{'event':_0x9ef7('0x7e'),'message':_0x12bc13['message']},client9002)['then'](function(){return _0x12bc13;});}return _0x12bc13;}return null;})['then'](respondWithResult(_0x3a0605,null))[_0x9ef7('0x2c')](handleError(_0x3a0605,null));};var interaction_log=require(_0x9ef7('0x14'))(_0x9ef7('0x5f'));exports[_0x9ef7('0x37')]=function(_0x318f1e,_0x21cc10,_0x273715){var _0x481a4e={'agent':{},'channel':_0x9ef7('0x61')};if(_0x318f1e['body']['id']){delete _0x318f1e['body']['id'];}_0x318f1e[_0x9ef7('0x5c')][_0x9ef7('0x63')]=_0x318f1e[_0x9ef7('0x5c')][_0x9ef7('0x63')]||_0x318f1e[_0x9ef7('0x6c')]['id'];_0x481a4e[_0x9ef7('0x64')]['id']=_0x318f1e[_0x9ef7('0x5c')][_0x9ef7('0x63')];return db['WhatsappMessage']['find']({'where':{'id':_0x318f1e['params']['id'],'UserId':null}})[_0x9ef7('0x21')](handleEntityNotFound(_0x21cc10,null))[_0x9ef7('0x21')](function(_0x43eefa){if(_0x43eefa){_0x481a4e[_0x9ef7('0x2a')]=_0x43eefa[_0x9ef7('0x65')]({'plain':!![]});return db[_0x9ef7('0x66')][_0x9ef7('0x5a')]({'where':{'id':_0x43eefa['WhatsappInteractionId']}});}return null;})[_0x9ef7('0x21')](handleEntityNotFound(_0x21cc10,null))['then'](function(_0x1636fe){if(_0x1636fe){_0x481a4e[_0x9ef7('0x6e')]=_0x1636fe['get']({'plain':!![]});interaction_log[_0x9ef7('0x22')](_0x9ef7('0x7f'),_0x318f1e[_0x9ef7('0x6c')]['id'],_0x318f1e['user'][_0x9ef7('0x3c')],_0x318f1e[_0x9ef7('0x6c')]['role'],_0x481a4e['interaction']['id'],_0x318f1e[_0x9ef7('0x5c')]?JSON[_0x9ef7('0x27')](_0x318f1e[_0x9ef7('0x5c')]):_0x9ef7('0x6f'));return respondWithRpcPromise('RejectMessage',_0x9ef7('0x80'),_0x481a4e);}return null;})[_0x9ef7('0x21')](function(_0x515ef7){var _0xd01201='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x515ef7['message'][_0x9ef7('0x73')];return db[_0x9ef7('0x74')]['query'](_0xd01201,{'type':db[_0x9ef7('0x75')][_0x9ef7('0x81')][_0x9ef7('0x76')],'raw':!![]})[_0x9ef7('0x21')](function(_0x21e8ae){return _0x21e8ae;});})[_0x9ef7('0x21')](function(_0x40d156){if(_0x40d156){_0x481a4e['message']['contact']=_0x40d156[0x0];if(!_0x318f1e[_0x9ef7('0x5c')][_0x9ef7('0x63')])return;return db[_0x9ef7('0x82')][_0x9ef7('0x5a')]({'where':{'id':_0x318f1e['body']['UserId'],'role':_0x9ef7('0x64')},'attributes':['id','name','fullname',_0x9ef7('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x70685b){if(!_0x70685b)return null;_0x481a4e['message'][_0x9ef7('0x64')]=_0x70685b;return _0x481a4e;})[_0x9ef7('0x21')](function(_0x1efd00){if(_0x1efd00){_0x1efd00[_0x9ef7('0x2a')][_0x9ef7('0x83')]=util[_0x9ef7('0x62')]('SIP/%s',_0x318f1e[_0x9ef7('0x6c')][_0x9ef7('0x3c')]);_0x1efd00[_0x9ef7('0x2a')][_0x9ef7('0x7c')]=_0x481a4e[_0x9ef7('0x7c')];_0x1efd00[_0x9ef7('0x2a')][_0x9ef7('0x84')]=_0x481a4e[_0x9ef7('0x7c')];_0x1efd00[_0x9ef7('0x2a')][_0x9ef7('0x85')]=_0x9ef7('0x37');respondWithRpcPromise(_0x9ef7('0x7d'),_0x9ef7('0x7d'),{'event':_0x9ef7('0x86'),'message':_0x1efd00[_0x9ef7('0x2a')]},client9002);return _0x481a4e;}return null;})[_0x9ef7('0x21')](respondWithResult(_0x21cc10,null))['catch'](handleError(_0x21cc10,null));};exports[_0x9ef7('0x2e')]=function(_0x2e3562,_0x3f32e3,_0x3c46c3){if(_0x2e3562['body']['id']){delete _0x2e3562[_0x9ef7('0x5c')]['id'];}var _0x1ea444;return db['WhatsappMessage'][_0x9ef7('0x5a')]({'where':{'id':_0x2e3562[_0x9ef7('0x5d')]['id']}})[_0x9ef7('0x21')](handleEntityNotFound(_0x3f32e3,null))[_0x9ef7('0x21')](function(_0x2d9355){if(_0x2d9355){_0x1ea444=_0x2d9355;return db[_0x9ef7('0x87')][_0x9ef7('0x5a')]({'where':{'id':_0x2d9355['WhatsappAccountId']}});}})[_0x9ef7('0x21')](handleEntityNotFound(_0x3f32e3,null))[_0x9ef7('0x21')](function(_0x1053c5){if(_0x1053c5){logger['debug'](_0x9ef7('0x88'),_0x9ef7('0x2e'),'received\x20delivery\x20report\x20from',_0x1053c5[_0x9ef7('0x42')],util[_0x9ef7('0x89')](_0x2e3562[_0x9ef7('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1053c5['type']){case _0x9ef7('0x8a'):if(_0x2e3562['body']['MessageSid']&&_0x2e3562[_0x9ef7('0x5c')][_0x9ef7('0x8b')]===_0x1ea444[_0x9ef7('0x8c')]&&_0x2e3562[_0x9ef7('0x5c')][_0x9ef7('0x8d')]&&_0x2e3562['body'][_0x9ef7('0x8d')]===_0x9ef7('0x8e')){return _0x1ea444[_0x9ef7('0x39')]({'read':!![]});}else{logger[_0x9ef7('0x28')](_0x9ef7('0x8f'),_0x9ef7('0x2e'),'twilio',util[_0x9ef7('0x89')](_0x2e3562['body'],{'showHidden':![],'depth':null}));}break;}return _0x1ea444;}})['then'](respondWithResult(_0x3f32e3,null))[_0x9ef7('0x2c')](handleError(_0x3f32e3,null));}; \ No newline at end of file +var _0xcaaf=['where','VIRTUAL','filter','options','findAll','rows','show','includeAll','include','find','create','body','params','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','agent','manual','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','ContactId','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','end','stack','name','index','WhatsappMessage','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','filters','pick','merge'];(function(_0x1295f1,_0x3e8ae7){var _0x54a1c3=function(_0x5842ae){while(--_0x5842ae){_0x1295f1['push'](_0x1295f1['shift']());}};_0x54a1c3(++_0x3e8ae7);}(_0xcaaf,0xcb));var _0xfcaa=function(_0x3e278,_0x576762){_0x3e278=_0x3e278-0x0;var _0x59d8ae=_0xcaaf[_0x3e278];return _0x59d8ae;};'use strict';var emlformat=require(_0xfcaa('0x0'));var rimraf=require(_0xfcaa('0x1'));var zipdir=require(_0xfcaa('0x2'));var jsonpatch=require(_0xfcaa('0x3'));var rp=require(_0xfcaa('0x4'));var moment=require(_0xfcaa('0x5'));var BPromise=require(_0xfcaa('0x6'));var Mustache=require(_0xfcaa('0x7'));var util=require(_0xfcaa('0x8'));var path=require(_0xfcaa('0x9'));var sox=require(_0xfcaa('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcaa('0xb'));var _=require(_0xfcaa('0xc'));var squel=require(_0xfcaa('0xd'));var crypto=require(_0xfcaa('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfcaa('0xf'));var toCsv=require(_0xfcaa('0x10'));var querystring=require(_0xfcaa('0x11'));var Papa=require(_0xfcaa('0x12'));var Redis=require('ioredis');var authService=require(_0xfcaa('0x13'));var qs=require(_0xfcaa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcaa('0x15'));var logger=require(_0xfcaa('0x16'))(_0xfcaa('0x17'));var utils=require(_0xfcaa('0x18'));var config=require(_0xfcaa('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfcaa('0x1a')]=_[_0xfcaa('0x1b')](config[_0xfcaa('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcaa('0x1c'))(new Redis(config[_0xfcaa('0x1a')]));require(_0xfcaa('0x1d'))[_0xfcaa('0x1e')](socket);var jayson=require(_0xfcaa('0x1f'));var client=jayson[_0xfcaa('0x20')][_0xfcaa('0x21')]({'port':0x232c});var client9002=jayson[_0xfcaa('0x20')][_0xfcaa('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x523b60,_0x3c6d25,_0x286326,_0x9b8628){return new BPromise(function(_0x2ebde5,_0x52a93c){var _0x2b4509=_0x9b8628||client;return _0x2b4509[_0xfcaa('0x22')](_0x523b60,_0x286326)[_0xfcaa('0x23')](function(_0x24451c){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3c6d25,_0xfcaa('0x24'));logger[_0xfcaa('0x25')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3c6d25,_0xfcaa('0x24'),JSON['stringify'](_0x24451c));if(_0x24451c[_0xfcaa('0x26')]){if(_0x24451c[_0xfcaa('0x26')][_0xfcaa('0x27')]===0x1f4){logger[_0xfcaa('0x26')](_0xfcaa('0x28'),_0x3c6d25,_0x24451c[_0xfcaa('0x26')][_0xfcaa('0x29')]);return _0x52a93c(_0x24451c['error']['message']);}logger[_0xfcaa('0x26')](_0xfcaa('0x28'),_0x3c6d25,_0x24451c[_0xfcaa('0x26')]['message']);return _0x2ebde5(_0x24451c[_0xfcaa('0x26')]['message']);}else{logger[_0xfcaa('0x2a')](_0xfcaa('0x28'),_0x3c6d25,'request\x20sent');_0x2ebde5(_0x24451c[_0xfcaa('0x2b')]['message']);}})[_0xfcaa('0x2c')](function(_0x40a8e8){logger[_0xfcaa('0x26')](_0xfcaa('0x28'),_0x3c6d25,_0x40a8e8);_0x52a93c(_0x40a8e8);});});}function respondWithStatusCode(_0x7ac376,_0x593f22){_0x593f22=_0x593f22||0xcc;return function(_0x86c7ee){if(_0x86c7ee){return _0x7ac376[_0xfcaa('0x2d')](_0x593f22);}return _0x7ac376['status'](_0x593f22)['end']();};}function respondWithResult(_0x510a10,_0x1ce3c2){_0x1ce3c2=_0x1ce3c2||0xc8;return function(_0x3c2569){if(_0x3c2569){return _0x510a10[_0xfcaa('0x2e')](_0x1ce3c2)[_0xfcaa('0x2f')](_0x3c2569);}};}function respondWithFilteredResult(_0x3c2589,_0x341509){return function(_0x56ba72){if(_0x56ba72){var _0xe67de9=typeof _0x341509[_0xfcaa('0x30')]===_0xfcaa('0x31')&&typeof _0x341509[_0xfcaa('0x32')]===_0xfcaa('0x31');var _0x5117c2=_0x56ba72[_0xfcaa('0x33')];var _0x5e2497=_0xe67de9?0x0:_0x341509['offset'];var _0x444b60=_0xe67de9?_0x56ba72[_0xfcaa('0x33')]:_0x341509[_0xfcaa('0x30')]+_0x341509[_0xfcaa('0x32')];var _0x571764;if(_0x444b60>=_0x5117c2){_0x444b60=_0x5117c2;_0x571764=0xc8;}else{_0x571764=0xce;}_0x3c2589[_0xfcaa('0x2e')](_0x571764);return _0x3c2589[_0xfcaa('0x34')]('Content-Range',_0x5e2497+'-'+_0x444b60+'/'+_0x5117c2)[_0xfcaa('0x2f')](_0x56ba72);}return null;};}function patchUpdates(_0x2fff35){return function(_0x46978f){try{jsonpatch['apply'](_0x46978f,_0x2fff35,!![]);}catch(_0x29b89c){return BPromise[_0xfcaa('0x35')](_0x29b89c);}return _0x46978f['save']();};}function saveUpdates(_0x1b5830,_0x51edb1){return function(_0x47c374){if(_0x47c374){return _0x47c374[_0xfcaa('0x36')](_0x1b5830)[_0xfcaa('0x23')](function(_0x38d7b1){return _0x38d7b1;});}return null;};}function removeEntity(_0x4fee0c,_0xbdf0d9){return function(_0x369ece){if(_0x369ece){return _0x369ece['destroy']()[_0xfcaa('0x23')](function(){_0x4fee0c[_0xfcaa('0x2e')](0xcc)[_0xfcaa('0x37')]();});}};}function handleEntityNotFound(_0x524170,_0xe6d04c){return function(_0x5b3899){if(!_0x5b3899){_0x524170[_0xfcaa('0x2d')](0x194);}return _0x5b3899;};}function handleError(_0x4a57d2,_0x5c1280){_0x5c1280=_0x5c1280||0x1f4;return function(_0x57f2e7){logger['error'](_0x57f2e7[_0xfcaa('0x38')]);if(_0x57f2e7['name']){delete _0x57f2e7[_0xfcaa('0x39')];}_0x4a57d2[_0xfcaa('0x2e')](_0x5c1280)['send'](_0x57f2e7);};}exports[_0xfcaa('0x3a')]=function(_0x31a927,_0x136f5d){var _0xd523a2={},_0x3afd22={},_0x51309f={'count':0x0,'rows':[]};var _0x5f085d=_['map'](db[_0xfcaa('0x3b')][_0xfcaa('0x3c')],function(_0x129eb8){return{'name':_0x129eb8['fieldName'],'type':_0x129eb8[_0xfcaa('0x3d')][_0xfcaa('0x3e')]};});_0x3afd22['model']=_[_0xfcaa('0x3f')](_0x5f085d,_0xfcaa('0x39'));_0x3afd22[_0xfcaa('0x40')]=_[_0xfcaa('0x41')](_0x31a927['query']);_0x3afd22['filters']=_[_0xfcaa('0x42')](_0x3afd22[_0xfcaa('0x43')],_0x3afd22[_0xfcaa('0x40')]);_0xd523a2[_0xfcaa('0x44')]=_['intersection'](_0x3afd22[_0xfcaa('0x43')],qs[_0xfcaa('0x45')](_0x31a927[_0xfcaa('0x40')]['fields']));_0xd523a2[_0xfcaa('0x44')]=_0xd523a2['attributes'][_0xfcaa('0x46')]?_0xd523a2[_0xfcaa('0x44')]:_0x3afd22[_0xfcaa('0x43')];if(!_0x31a927[_0xfcaa('0x40')][_0xfcaa('0x47')]('nolimit')){_0xd523a2['limit']=qs['limit'](_0x31a927['query']['limit']);_0xd523a2['offset']=qs[_0xfcaa('0x30')](_0x31a927['query'][_0xfcaa('0x30')]);}_0xd523a2['order']=qs['sort'](_0x31a927[_0xfcaa('0x40')]['sort']);_0xd523a2['where']=qs[_0xfcaa('0x48')](_[_0xfcaa('0x49')](_0x31a927[_0xfcaa('0x40')],_0x3afd22[_0xfcaa('0x48')]),_0x5f085d);if(_0x31a927['query']['filter']){_0xd523a2['where']=_[_0xfcaa('0x4a')](_0xd523a2[_0xfcaa('0x4b')],{'$or':_['map'](_0x5f085d,function(_0xd5b21e){if(_0xd5b21e[_0xfcaa('0x3d')]!==_0xfcaa('0x4c')){var _0x46ced2={};_0x46ced2[_0xd5b21e[_0xfcaa('0x39')]]={'$like':'%'+_0x31a927['query'][_0xfcaa('0x4d')]+'%'};return _0x46ced2;}})});}_0xd523a2=_[_0xfcaa('0x4a')]({},_0xd523a2,_0x31a927[_0xfcaa('0x4e')]);var _0x3e0cf3={'where':_0xd523a2[_0xfcaa('0x4b')]};return db[_0xfcaa('0x3b')][_0xfcaa('0x33')](_0x3e0cf3)['then'](function(_0x563269){_0x51309f[_0xfcaa('0x33')]=_0x563269;if(_0x31a927[_0xfcaa('0x40')]['includeAll']){_0xd523a2['include']=[{'all':!![]}];}return db[_0xfcaa('0x3b')][_0xfcaa('0x4f')](_0xd523a2);})['then'](function(_0x252825){_0x51309f[_0xfcaa('0x50')]=_0x252825;return _0x51309f;})[_0xfcaa('0x23')](respondWithFilteredResult(_0x136f5d,_0xd523a2))[_0xfcaa('0x2c')](handleError(_0x136f5d,null));};exports[_0xfcaa('0x51')]=function(_0x3dd175,_0x23deef){var _0x593a3f={'raw':!![],'where':{'id':_0x3dd175['params']['id']}},_0x3267ab={};_0x3267ab[_0xfcaa('0x43')]=_['keys'](db[_0xfcaa('0x3b')][_0xfcaa('0x3c')]);_0x3267ab[_0xfcaa('0x40')]=_[_0xfcaa('0x41')](_0x3dd175['query']);_0x3267ab[_0xfcaa('0x48')]=_[_0xfcaa('0x42')](_0x3267ab[_0xfcaa('0x43')],_0x3267ab[_0xfcaa('0x40')]);_0x593a3f[_0xfcaa('0x44')]=_[_0xfcaa('0x42')](_0x3267ab[_0xfcaa('0x43')],qs['fields'](_0x3dd175[_0xfcaa('0x40')][_0xfcaa('0x45')]));_0x593a3f[_0xfcaa('0x44')]=_0x593a3f[_0xfcaa('0x44')][_0xfcaa('0x46')]?_0x593a3f[_0xfcaa('0x44')]:_0x3267ab[_0xfcaa('0x43')];if(_0x3dd175[_0xfcaa('0x40')][_0xfcaa('0x52')]){_0x593a3f[_0xfcaa('0x53')]=[{'all':!![]}];}_0x593a3f=_[_0xfcaa('0x4a')]({},_0x593a3f,_0x3dd175[_0xfcaa('0x4e')]);return db[_0xfcaa('0x3b')][_0xfcaa('0x54')](_0x593a3f)['then'](handleEntityNotFound(_0x23deef,null))[_0xfcaa('0x23')](respondWithResult(_0x23deef,null))[_0xfcaa('0x2c')](handleError(_0x23deef,null));};exports[_0xfcaa('0x55')]=function(_0x300ece,_0x9a0cf2){return db[_0xfcaa('0x3b')][_0xfcaa('0x55')](_0x300ece[_0xfcaa('0x56')],{})[_0xfcaa('0x23')](respondWithResult(_0x9a0cf2,0xc9))[_0xfcaa('0x2c')](handleError(_0x9a0cf2,null));};exports[_0xfcaa('0x36')]=function(_0x34e803,_0x2d6f7c){if(_0x34e803[_0xfcaa('0x56')]['id']){delete _0x34e803[_0xfcaa('0x56')]['id'];}return db[_0xfcaa('0x3b')]['find']({'where':{'id':_0x34e803[_0xfcaa('0x57')]['id']}})[_0xfcaa('0x23')](handleEntityNotFound(_0x2d6f7c,null))[_0xfcaa('0x23')](saveUpdates(_0x34e803[_0xfcaa('0x56')],null))[_0xfcaa('0x23')](respondWithResult(_0x2d6f7c,null))[_0xfcaa('0x2c')](handleError(_0x2d6f7c,null));};exports['destroy']=function(_0xe1d89a,_0x13ab15){return db[_0xfcaa('0x3b')][_0xfcaa('0x54')]({'where':{'id':_0xe1d89a[_0xfcaa('0x57')]['id']}})[_0xfcaa('0x23')](handleEntityNotFound(_0x13ab15,null))[_0xfcaa('0x23')](removeEntity(_0x13ab15,null))[_0xfcaa('0x2c')](handleError(_0x13ab15,null));};exports['describe']=function(_0x533156,_0x2ff107){return db['WhatsappMessage'][_0xfcaa('0x58')]()['then'](respondWithResult(_0x2ff107,null))[_0xfcaa('0x2c')](handleError(_0x2ff107,null));};var interaction_log=require('../../config/logger')(_0xfcaa('0x59'));exports['accept']=function(_0x36dbf3,_0x53916a,_0x165dee){var _0x5d8efd={'agent':{},'channel':_0xfcaa('0x5a')};if(_0x36dbf3[_0xfcaa('0x56')]['id']){delete _0x36dbf3['body']['id'];}_0x36dbf3['body'][_0xfcaa('0x5b')]=!![];_0x36dbf3['body'][_0xfcaa('0x5c')]=moment()[_0xfcaa('0x5d')](_0xfcaa('0x5e'));_0x36dbf3[_0xfcaa('0x56')][_0xfcaa('0x5f')]=_0x36dbf3[_0xfcaa('0x56')][_0xfcaa('0x5f')]||_0x36dbf3['user']['id'];_0x5d8efd['agent']['id']=_0x36dbf3['body'][_0xfcaa('0x5f')];return db[_0xfcaa('0x3b')][_0xfcaa('0x54')]({'where':{'id':_0x36dbf3[_0xfcaa('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x53916a,null))[_0xfcaa('0x23')](saveUpdates(_0x36dbf3[_0xfcaa('0x56')],null))[_0xfcaa('0x23')](function(_0x5efc66){if(_0x5efc66){_0x5d8efd[_0xfcaa('0x29')]=_0x5efc66[_0xfcaa('0x60')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x5efc66[_0xfcaa('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x53916a,null))[_0xfcaa('0x23')](function(_0x5704c4){if(_0x5704c4){return _0x5704c4[_0xfcaa('0x36')]({'UserId':_0x36dbf3['body'][_0xfcaa('0x5f')],'read1stAt':_[_0xfcaa('0x62')](_0x5704c4[_0xfcaa('0x63')])?moment()[_0xfcaa('0x5d')](_0xfcaa('0x5e')):undefined});}return null;})[_0xfcaa('0x23')](function(_0x5ab5f7){if(_0x5ab5f7){_0x5d8efd[_0xfcaa('0x64')]=_0x5ab5f7['get']({'plain':!![]});interaction_log['info'](_0xfcaa('0x65'),_0x36dbf3[_0xfcaa('0x66')]['id'],_0x36dbf3[_0xfcaa('0x66')][_0xfcaa('0x39')],_0x36dbf3[_0xfcaa('0x66')][_0xfcaa('0x67')],_0x5d8efd[_0xfcaa('0x64')]['id'],_0x36dbf3[_0xfcaa('0x56')]?JSON['stringify'](_0x36dbf3[_0xfcaa('0x56')]):_0xfcaa('0x68'));return respondWithRpcPromise(_0xfcaa('0x69'),_0xfcaa('0x6a'),_0x5d8efd);}return null;})['then'](function(_0x2fa859){var _0x28c2bc=_0xfcaa('0x6b')+_0x2fa859['message']['ContactId'];return db[_0xfcaa('0x6c')][_0xfcaa('0x40')](_0x28c2bc,{'type':db[_0xfcaa('0x6d')][_0xfcaa('0x6e')][_0xfcaa('0x6f')],'raw':!![]})[_0xfcaa('0x23')](function(_0x10c089){return _0x10c089;});})[_0xfcaa('0x23')](function(_0x40a571){if(_0x40a571){_0x5d8efd[_0xfcaa('0x29')][_0xfcaa('0x70')]=_0x40a571[0x0];if(!_0x36dbf3[_0xfcaa('0x56')][_0xfcaa('0x5f')])return;return db[_0xfcaa('0x71')][_0xfcaa('0x54')]({'where':{'id':_0x36dbf3['body'][_0xfcaa('0x5f')],'role':'agent'},'attributes':['id',_0xfcaa('0x39'),_0xfcaa('0x72'),'email',_0xfcaa('0x73')],'raw':!![]});}return null;})[_0xfcaa('0x23')](function(_0x2dfb24){if(!_0x2dfb24)return null;_0x5d8efd['message'][_0xfcaa('0x74')]=_0x2dfb24;return _0x5d8efd;})[_0xfcaa('0x23')](function(_0x1f23e4){if(_0x1f23e4){if(_0x36dbf3[_0xfcaa('0x56')][_0xfcaa('0x75')]){_0x5d8efd['message']['interface']=util[_0xfcaa('0x5d')](_0xfcaa('0x76'),_0x36dbf3['user'][_0xfcaa('0x39')]);_0x5d8efd[_0xfcaa('0x29')][_0xfcaa('0x77')]=_0x5d8efd['channel'];_0x5d8efd[_0xfcaa('0x29')][_0xfcaa('0x78')]=_0x5d8efd[_0xfcaa('0x77')];_0x5d8efd[_0xfcaa('0x29')][_0xfcaa('0x79')]='accept';return respondWithRpcPromise(_0xfcaa('0x7a'),_0xfcaa('0x7a'),{'event':'acceptmessage','message':_0x5d8efd[_0xfcaa('0x29')]},client9002)[_0xfcaa('0x23')](function(){return _0x5d8efd;});}return _0x5d8efd;}return null;})['then'](respondWithResult(_0x53916a,null))['catch'](handleError(_0x53916a,null));};var interaction_log=require(_0xfcaa('0x16'))(_0xfcaa('0x59'));exports[_0xfcaa('0x35')]=function(_0x5ec9a1,_0x3c9747,_0x56466b){var _0x1f919f={'agent':{},'channel':'whatsapp'};if(_0x5ec9a1[_0xfcaa('0x56')]['id']){delete _0x5ec9a1['body']['id'];}_0x5ec9a1['body'][_0xfcaa('0x5f')]=_0x5ec9a1[_0xfcaa('0x56')]['UserId']||_0x5ec9a1[_0xfcaa('0x66')]['id'];_0x1f919f[_0xfcaa('0x74')]['id']=_0x5ec9a1[_0xfcaa('0x56')]['UserId'];return db[_0xfcaa('0x3b')][_0xfcaa('0x54')]({'where':{'id':_0x5ec9a1[_0xfcaa('0x57')]['id'],'UserId':null}})[_0xfcaa('0x23')](handleEntityNotFound(_0x3c9747,null))['then'](function(_0x22aed4){if(_0x22aed4){_0x1f919f[_0xfcaa('0x29')]=_0x22aed4[_0xfcaa('0x60')]({'plain':!![]});return db[_0xfcaa('0x7b')][_0xfcaa('0x54')]({'where':{'id':_0x22aed4[_0xfcaa('0x61')]}});}return null;})[_0xfcaa('0x23')](handleEntityNotFound(_0x3c9747,null))[_0xfcaa('0x23')](function(_0x556974){if(_0x556974){_0x1f919f[_0xfcaa('0x64')]=_0x556974[_0xfcaa('0x60')]({'plain':!![]});interaction_log[_0xfcaa('0x2a')](_0xfcaa('0x7c'),_0x5ec9a1[_0xfcaa('0x66')]['id'],_0x5ec9a1[_0xfcaa('0x66')][_0xfcaa('0x39')],_0x5ec9a1[_0xfcaa('0x66')]['role'],_0x1f919f[_0xfcaa('0x64')]['id'],_0x5ec9a1[_0xfcaa('0x56')]?JSON[_0xfcaa('0x7d')](_0x5ec9a1[_0xfcaa('0x56')]):_0xfcaa('0x68'));return respondWithRpcPromise('RejectMessage',_0xfcaa('0x7e'),_0x1f919f);}return null;})['then'](function(_0x42f529){var _0x328dde='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x42f529[_0xfcaa('0x29')][_0xfcaa('0x7f')];return db['sequelize'][_0xfcaa('0x40')](_0x328dde,{'type':db[_0xfcaa('0x6d')][_0xfcaa('0x6e')][_0xfcaa('0x6f')],'raw':!![]})[_0xfcaa('0x23')](function(_0x3d5145){return _0x3d5145;});})['then'](function(_0x4ec943){if(_0x4ec943){_0x1f919f['message'][_0xfcaa('0x70')]=_0x4ec943[0x0];if(!_0x5ec9a1['body'][_0xfcaa('0x5f')])return;return db[_0xfcaa('0x71')][_0xfcaa('0x54')]({'where':{'id':_0x5ec9a1[_0xfcaa('0x56')][_0xfcaa('0x5f')],'role':'agent'},'attributes':['id',_0xfcaa('0x39'),_0xfcaa('0x72'),'email',_0xfcaa('0x73')],'raw':!![]});}return null;})[_0xfcaa('0x23')](function(_0x468709){if(!_0x468709)return null;_0x1f919f[_0xfcaa('0x29')][_0xfcaa('0x74')]=_0x468709;return _0x1f919f;})[_0xfcaa('0x23')](function(_0x220696){if(_0x220696){_0x220696['message'][_0xfcaa('0x80')]=util[_0xfcaa('0x5d')](_0xfcaa('0x76'),_0x5ec9a1[_0xfcaa('0x66')]['name']);_0x220696[_0xfcaa('0x29')][_0xfcaa('0x77')]=_0x1f919f[_0xfcaa('0x77')];_0x220696[_0xfcaa('0x29')][_0xfcaa('0x78')]=_0x1f919f[_0xfcaa('0x77')];_0x220696[_0xfcaa('0x29')][_0xfcaa('0x79')]=_0xfcaa('0x35');respondWithRpcPromise(_0xfcaa('0x7a'),_0xfcaa('0x7a'),{'event':_0xfcaa('0x81'),'message':_0x220696[_0xfcaa('0x29')]},client9002);return _0x1f919f;}return null;})[_0xfcaa('0x23')](respondWithResult(_0x3c9747,null))[_0xfcaa('0x2c')](handleError(_0x3c9747,null));};exports[_0xfcaa('0x2e')]=function(_0x85cf4,_0x10199e,_0x41ac05){if(_0x85cf4[_0xfcaa('0x56')]['id']){delete _0x85cf4[_0xfcaa('0x56')]['id'];}var _0x109a53;return db[_0xfcaa('0x3b')]['find']({'where':{'id':_0x85cf4[_0xfcaa('0x57')]['id']}})[_0xfcaa('0x23')](handleEntityNotFound(_0x10199e,null))[_0xfcaa('0x23')](function(_0x4804c3){if(_0x4804c3){_0x109a53=_0x4804c3;return db[_0xfcaa('0x82')][_0xfcaa('0x54')]({'where':{'id':_0x4804c3[_0xfcaa('0x83')]}});}})[_0xfcaa('0x23')](handleEntityNotFound(_0x10199e,null))[_0xfcaa('0x23')](function(_0x49f92b){if(_0x49f92b){logger[_0xfcaa('0x25')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xfcaa('0x2e'),_0xfcaa('0x84'),_0x49f92b[_0xfcaa('0x3d')],util[_0xfcaa('0x85')](_0x85cf4[_0xfcaa('0x56')],{'showHidden':![],'depth':null}));switch(_0x49f92b[_0xfcaa('0x3d')]){case _0xfcaa('0x86'):if(_0x85cf4[_0xfcaa('0x56')][_0xfcaa('0x87')]&&_0x85cf4[_0xfcaa('0x56')][_0xfcaa('0x87')]===_0x109a53[_0xfcaa('0x88')]&&_0x85cf4[_0xfcaa('0x56')][_0xfcaa('0x89')]&&_0x85cf4[_0xfcaa('0x56')]['MessageStatus']==='read'){return _0x109a53['update']({'read':!![]});}else{logger[_0xfcaa('0x26')](_0xfcaa('0x8a'),_0xfcaa('0x2e'),_0xfcaa('0x86'),util['inspect'](_0x85cf4['body'],{'showHidden':![],'depth':null}));}break;}return _0x109a53;}})[_0xfcaa('0x23')](respondWithResult(_0x10199e,null))[_0xfcaa('0x2c')](handleError(_0x10199e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a5b999c..6354cad 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 _0xa902=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xa902,0x8d));var _0x2a90=function(_0x3289e9,_0x48561c){_0x3289e9=_0x3289e9-0x0;var _0x28e683=_0xa902[_0x3289e9];return _0x28e683;};'use strict';var EventEmitter=require(_0x2a90('0x0'));var WhatsappMessage=require(_0x2a90('0x1'))['db'][_0x2a90('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2a90('0x3')](0x0);var events={'afterCreate':_0x2a90('0x4'),'afterUpdate':'update','afterDestroy':_0x2a90('0x5')};function emitEvent(_0x5b4a40){return function(_0x4961c2,_0x169808,_0x2b40c0){WhatsappMessageEvents[_0x2a90('0x6')](_0x5b4a40+':'+_0x4961c2['id'],_0x4961c2);WhatsappMessageEvents[_0x2a90('0x6')](_0x5b4a40,_0x4961c2);_0x2b40c0(null);};}for(var e in events){if(events[_0x2a90('0x7')](e)){var event=events[e];WhatsappMessage[_0x2a90('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xb248=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','WhatsappMessage'];(function(_0x16ce60,_0x29737e){var _0xe0d487=function(_0x1d951e){while(--_0x1d951e){_0x16ce60['push'](_0x16ce60['shift']());}};_0xe0d487(++_0x29737e);}(_0xb248,0xc6));var _0x8b24=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb248[_0x4f9b18];return _0x29f20c;};'use strict';var EventEmitter=require(_0x8b24('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x8b24('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8b24('0x2')](0x0);var events={'afterCreate':_0x8b24('0x3'),'afterUpdate':_0x8b24('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ea760){return function(_0x4438f7,_0x5d4103,_0x253441){WhatsappMessageEvents[_0x8b24('0x5')](_0x1ea760+':'+_0x4438f7['id'],_0x4438f7);WhatsappMessageEvents['emit'](_0x1ea760,_0x4438f7);_0x253441(null);};}for(var e in events){if(events[_0x8b24('0x6')](e)){var event=events[e];WhatsappMessage[_0x8b24('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0c4bd8d..8d05e1e 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 _0x0c24=['createdAt','catch','error','WhatsappAccount','WhatsappAccountId','twilio','accountSid','authToken','phone','create','whatsapp:','/api/whatsapp/messages/','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','findOne','WhatsappInteractionId'];(function(_0x2c551c,_0x38995e){var _0x109f39=function(_0x26d0d7){while(--_0x26d0d7){_0x2c551c['push'](_0x2c551c['shift']());}};_0x109f39(++_0x38995e);}(_0x0c24,0x13b));var _0x40c2=function(_0x47e3ef,_0x551b2c){_0x47e3ef=_0x47e3ef-0x0;var _0x502417=_0x0c24[_0x47e3ef];return _0x502417;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40c2('0x0'))(_0x40c2('0x1'));var moment=require('moment');var BPromise=require(_0x40c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40c2('0x3'));var config=require(_0x40c2('0x4'));var attributes=require(_0x40c2('0x5'));module['exports']=function(_0x146749,_0x3f204c){return _0x146749[_0x40c2('0x6')](_0x40c2('0x7'),attributes,{'tableName':_0x40c2('0x8'),'paranoid':![],'indexes':[{'name':_0x40c2('0x9'),'fields':['messageId']},{'name':_0x40c2('0xa'),'fields':[_0x40c2('0xb')],'type':_0x40c2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x423717,_0x34caf8,_0x3f219b){var _0x2f8d0d=_0x146749[_0x40c2('0xd')];var _0x1bc2b6=_0x423717[_0x40c2('0xe')]({'plain':!![]});if(_0x1bc2b6['direction'][_0x40c2('0xf')]()==='in'||_0x1bc2b6[_0x40c2('0x10')][_0x40c2('0xf')]()===_0x40c2('0x11')&&!_0x1bc2b6[_0x40c2('0x12')]&&!_['isNil'](_0x1bc2b6['UserId'])){_0x2f8d0d['WhatsappInteraction'][_0x40c2('0x13')]({'where':{'id':_0x1bc2b6[_0x40c2('0x14')]}})['then'](function(_0x527ce3){if(_0x527ce3){_0x527ce3['update']({'lastMsgAt':_0x1bc2b6[_0x40c2('0x15')],'lastMsgDirection':_0x1bc2b6['direction'][_0x40c2('0xf')]()});}})[_0x40c2('0x16')](function(_0x21c6e8){console[_0x40c2('0x17')](_0x21c6e8);});}if(_0x1bc2b6['direction']==='out'&&!_0x1bc2b6[_0x40c2('0x12')]){var _0x513b40;_0x2f8d0d[_0x40c2('0x18')]['find']({'where':{'id':_0x1bc2b6[_0x40c2('0x19')]},'raw':!![]})['then'](function(_0x447a7f){_0x513b40=_0x447a7f;if(_0x513b40&&_0x513b40['type']){switch(_0x513b40['type']){case _0x40c2('0x1a'):var _0x3eaab5=require('twilio');if(_0x513b40[_0x40c2('0x1b')]&&_0x513b40[_0x40c2('0x1c')]&&_0x513b40[_0x40c2('0x1d')]){var _0x131093=new _0x3eaab5(_0x513b40[_0x40c2('0x1b')],_0x513b40['authToken']);_0x131093['messages'][_0x40c2('0x1e')]({'body':_0x1bc2b6[_0x40c2('0xb')],'to':_0x40c2('0x1f')+_0x1bc2b6[_0x40c2('0x1d')],'from':_0x40c2('0x1f')+_0x513b40[_0x40c2('0x1d')],'statusCallback':_0x513b40['remote']+_0x40c2('0x20')+_0x1bc2b6['id']+'/status?token='+_0x513b40[_0x40c2('0x21')]})['then'](function(_0x5b68f3){if(_0x5b68f3[_0x40c2('0x22')]){return _0x423717[_0x40c2('0x23')]({'messageId':_0x5b68f3[_0x40c2('0x22')]});}})['catch'](function(_0x1c25f3){logger[_0x40c2('0x17')](_0x40c2('0x24'),_0x40c2('0x25'),_0x40c2('0x1a'),util['inspect'](_0x1c25f3,{'showHidden':![],'depth':null}));});}else{logger[_0x40c2('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x40c2('0x25'),_0x40c2('0x1a'),_0x40c2('0x26'));}break;}}})[_0x40c2('0x27')](function(){_0x3f219b();});}else{_0x3f219b();}}},'charset':_0x40c2('0x28'),'collate':_0x40c2('0x29')});}; \ No newline at end of file +var _0xca93=['findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId'];(function(_0x4cd8bf,_0x37da24){var _0x418b93=function(_0x51b5f5){while(--_0x51b5f5){_0x4cd8bf['push'](_0x4cd8bf['shift']());}};_0x418b93(++_0x37da24);}(_0xca93,0x1a4));var _0x3ca9=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xca93[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x3ca9('0x0'));var util=require(_0x3ca9('0x1'));var logger=require('../../config/logger')(_0x3ca9('0x2'));var moment=require(_0x3ca9('0x3'));var BPromise=require(_0x3ca9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ca9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3ca9('0x6'));module[_0x3ca9('0x7')]=function(_0x4a22e8,_0x282cd4){return _0x4a22e8[_0x3ca9('0x8')](_0x3ca9('0x9'),attributes,{'tableName':_0x3ca9('0xa'),'paranoid':![],'indexes':[{'name':_0x3ca9('0xb'),'fields':[_0x3ca9('0xb')]},{'name':_0x3ca9('0xc'),'fields':[_0x3ca9('0xd')],'type':_0x3ca9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e40b1,_0x2d8505,_0x267bc5){var _0x2cd3c1=_0x4a22e8['models'];var _0xff5659=_0x5e40b1[_0x3ca9('0xf')]({'plain':!![]});if(_0xff5659[_0x3ca9('0x10')][_0x3ca9('0x11')]()==='in'||_0xff5659[_0x3ca9('0x10')][_0x3ca9('0x11')]()==='out'&&!_0xff5659[_0x3ca9('0x12')]&&!_[_0x3ca9('0x13')](_0xff5659[_0x3ca9('0x14')])){_0x2cd3c1['WhatsappInteraction'][_0x3ca9('0x15')]({'where':{'id':_0xff5659[_0x3ca9('0x16')]}})[_0x3ca9('0x17')](function(_0x47a042){if(_0x47a042){_0x47a042['update']({'lastMsgAt':_0xff5659[_0x3ca9('0x18')],'lastMsgDirection':_0xff5659['direction'][_0x3ca9('0x11')]()});}})[_0x3ca9('0x19')](function(_0xf33f1f){console[_0x3ca9('0x1a')](_0xf33f1f);});}if(_0xff5659[_0x3ca9('0x10')]==='out'&&!_0xff5659[_0x3ca9('0x12')]){var _0x125b28;_0x2cd3c1[_0x3ca9('0x1b')][_0x3ca9('0x1c')]({'where':{'id':_0xff5659[_0x3ca9('0x1d')]},'raw':!![]})['then'](function(_0x11ac6e){_0x125b28=_0x11ac6e;if(_0x125b28&&_0x125b28[_0x3ca9('0x1e')]){switch(_0x125b28[_0x3ca9('0x1e')]){case _0x3ca9('0x1f'):var _0x392da7=require(_0x3ca9('0x1f'));if(_0x125b28[_0x3ca9('0x20')]&&_0x125b28['authToken']&&_0x125b28[_0x3ca9('0x21')]){var _0x500d6f=new _0x392da7(_0x125b28['accountSid'],_0x125b28['authToken']);_0x500d6f[_0x3ca9('0x22')][_0x3ca9('0x23')]({'body':_0xff5659['body'],'to':_0x3ca9('0x24')+_0xff5659[_0x3ca9('0x21')],'from':'whatsapp:'+_0x125b28[_0x3ca9('0x21')],'statusCallback':_0x125b28[_0x3ca9('0x25')]+_0x3ca9('0x26')+_0xff5659['id']+_0x3ca9('0x27')+_0x125b28[_0x3ca9('0x28')]})[_0x3ca9('0x17')](function(_0x40bbab){if(_0x40bbab[_0x3ca9('0x29')]){return _0x5e40b1[_0x3ca9('0x2a')]({'messageId':_0x40bbab[_0x3ca9('0x29')]});}})[_0x3ca9('0x19')](function(_0x412978){logger[_0x3ca9('0x1a')](_0x3ca9('0x2b'),_0x3ca9('0x2c'),_0x3ca9('0x1f'),util[_0x3ca9('0x2d')](_0x412978,{'showHidden':![],'depth':null}));});}else{logger[_0x3ca9('0x1a')](_0x3ca9('0x2b'),_0x3ca9('0x2c'),'twilio',_0x3ca9('0x2e'));}break;}}})['finally'](function(){_0x267bc5();});}else{_0x267bc5();}}},'charset':_0x3ca9('0x2f'),'collate':_0x3ca9('0x30')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 170263b..c542866 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 _0x7958=['error','message','result','catch','WhatsappMessage','create','body','options','CreateWhatsappMessage','stringify','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','redis','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x7958,0xbe));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require(_0x8795('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8795('0x3'));var db=require(_0x8795('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8795('0x5'));var config=require(_0x8795('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8795('0x7')]({'port':0x232a});config['redis']=_[_0x8795('0x8')](config[_0x8795('0x9')],{'host':_0x8795('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8795('0x9')]));require(_0x8795('0xb'))[_0x8795('0xc')](socket);function respondWithRpcPromise(_0x2a575a,_0x3fdd25,_0x10e65d){return new BPromise(function(_0x58061,_0x26fc3f){return client[_0x8795('0xd')](_0x2a575a,_0x10e65d)[_0x8795('0xe')](function(_0x3e4307){logger[_0x8795('0xf')](_0x8795('0x10'),_0x3fdd25,'request\x20sent');logger[_0x8795('0x11')](_0x8795('0x12'),_0x3fdd25,_0x8795('0x13'),JSON['stringify'](_0x3e4307));if(_0x3e4307[_0x8795('0x14')]){if(_0x3e4307[_0x8795('0x14')]['code']===0x1f4){logger[_0x8795('0x14')](_0x8795('0x10'),_0x3fdd25,_0x3e4307[_0x8795('0x14')][_0x8795('0x15')]);return _0x26fc3f(_0x3e4307[_0x8795('0x14')][_0x8795('0x15')]);}logger[_0x8795('0x14')](_0x8795('0x10'),_0x3fdd25,_0x3e4307[_0x8795('0x14')][_0x8795('0x15')]);return _0x58061(_0x3e4307[_0x8795('0x14')][_0x8795('0x15')]);}else{logger['info'](_0x8795('0x10'),_0x3fdd25,_0x8795('0x13'));_0x58061(_0x3e4307[_0x8795('0x16')]['message']);}})[_0x8795('0x17')](function(_0x54e0a5){logger[_0x8795('0x14')](_0x8795('0x10'),_0x3fdd25,_0x54e0a5);_0x26fc3f(_0x54e0a5);});});}exports['CreateWhatsappMessage']=function(_0x3ebba5){var _0x2897f2=this;return new Promise(function(_0xa6534,_0x41c45c){return db[_0x8795('0x18')][_0x8795('0x19')](_0x3ebba5[_0x8795('0x1a')],{'raw':_0x3ebba5[_0x8795('0x1b')]?_0x3ebba5['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x29d13f){logger[_0x8795('0xf')](_0x8795('0x1c'),_0x3ebba5);logger['debug']('CreateWhatsappMessage',_0x3ebba5,JSON[_0x8795('0x1d')](_0x29d13f));_0xa6534(_0x29d13f);})[_0x8795('0x17')](function(_0x5e8cf1){logger[_0x8795('0x14')](_0x8795('0x1c'),_0x5e8cf1[_0x8795('0x15')],_0x3ebba5);_0x41c45c(_0x2897f2['error'](0x1f4,_0x5e8cf1[_0x8795('0x15')]));});});}; \ No newline at end of file +var _0xb525=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb525,0xbe));var _0x5b52=function(_0x1c81cc,_0x64e920){_0x1c81cc=_0x1c81cc-0x0;var _0x30ea5a=_0xb525[_0x1c81cc];return _0x30ea5a;};'use strict';var _=require(_0x5b52('0x0'));var util=require(_0x5b52('0x1'));var moment=require(_0x5b52('0x2'));var BPromise=require(_0x5b52('0x3'));var rs=require(_0x5b52('0x4'));var fs=require('fs');var Redis=require(_0x5b52('0x5'));var db=require(_0x5b52('0x6'))['db'];var utils=require(_0x5b52('0x7'));var logger=require('../../config/logger')(_0x5b52('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b52('0x9'));var client=jayson[_0x5b52('0xa')][_0x5b52('0xb')]({'port':0x232a});config['redis']=_[_0x5b52('0xc')](config[_0x5b52('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b52('0xe'))(new Redis(config[_0x5b52('0xd')]));require('./whatsappMessage.socket')[_0x5b52('0xf')](socket);function respondWithRpcPromise(_0x12b42e,_0x59ab36,_0x5900f3){return new BPromise(function(_0xda5a2c,_0x38061e){return client[_0x5b52('0x10')](_0x12b42e,_0x5900f3)[_0x5b52('0x11')](function(_0x1e7967){logger[_0x5b52('0x12')](_0x5b52('0x13'),_0x59ab36,'request\x20sent');logger[_0x5b52('0x14')](_0x5b52('0x15'),_0x59ab36,_0x5b52('0x16'),JSON[_0x5b52('0x17')](_0x1e7967));if(_0x1e7967[_0x5b52('0x18')]){if(_0x1e7967['error'][_0x5b52('0x19')]===0x1f4){logger[_0x5b52('0x18')](_0x5b52('0x13'),_0x59ab36,_0x1e7967[_0x5b52('0x18')][_0x5b52('0x1a')]);return _0x38061e(_0x1e7967['error']['message']);}logger[_0x5b52('0x18')](_0x5b52('0x13'),_0x59ab36,_0x1e7967[_0x5b52('0x18')]['message']);return _0xda5a2c(_0x1e7967[_0x5b52('0x18')][_0x5b52('0x1a')]);}else{logger[_0x5b52('0x12')](_0x5b52('0x13'),_0x59ab36,_0x5b52('0x16'));_0xda5a2c(_0x1e7967[_0x5b52('0x1b')]['message']);}})[_0x5b52('0x1c')](function(_0x2afbd8){logger[_0x5b52('0x18')](_0x5b52('0x13'),_0x59ab36,_0x2afbd8);_0x38061e(_0x2afbd8);});});}exports['CreateWhatsappMessage']=function(_0x4dd5a1){var _0x48febc=this;return new Promise(function(_0x22cea0,_0x32a12f){return db[_0x5b52('0x1d')][_0x5b52('0x1e')](_0x4dd5a1[_0x5b52('0x1f')],{'raw':_0x4dd5a1[_0x5b52('0x20')]?_0x4dd5a1['options'][_0x5b52('0x21')]===undefined?!![]:![]:!![]})[_0x5b52('0x11')](function(_0x1abbaf){logger[_0x5b52('0x12')](_0x5b52('0x22'),_0x4dd5a1);logger[_0x5b52('0x14')](_0x5b52('0x22'),_0x4dd5a1,JSON[_0x5b52('0x17')](_0x1abbaf));_0x22cea0(_0x1abbaf);})['catch'](function(_0x4cf7a7){logger[_0x5b52('0x18')](_0x5b52('0x22'),_0x4cf7a7['message'],_0x4dd5a1);_0x32a12f(_0x48febc['error'](0x1f4,_0x4cf7a7[_0x5b52('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 01fba0b..6b7d437 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 _0x067d=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','register'];(function(_0x5d9914,_0xdd2615){var _0x29966c=function(_0x796f3e){while(--_0x796f3e){_0x5d9914['push'](_0x5d9914['shift']());}};_0x29966c(++_0xdd2615);}(_0x067d,0x7f));var _0xd067=function(_0x4f9c46,_0x361afe){_0x4f9c46=_0x4f9c46-0x0;var _0x155365=_0x067d[_0x4f9c46];return _0x155365;};'use strict';var WhatsappMessageEvents=require(_0xd067('0x0'));var events=[_0xd067('0x1'),_0xd067('0x2'),_0xd067('0x3')];function createListener(_0x42083f,_0x418293){return function(_0x1ede2c){_0x418293[_0xd067('0x4')](_0x42083f,_0x1ede2c);};}function removeListener(_0x101c03,_0x3c3db9){return function(){WhatsappMessageEvents['removeListener'](_0x101c03,_0x3c3db9);};}exports[_0xd067('0x5')]=function(_0x22d8d3){for(var _0x4b239f=0x0,_0x534a3a=events['length'];_0x4b239f<_0x534a3a;_0x4b239f++){var _0x277c36=events[_0x4b239f];var _0x573823=createListener(_0xd067('0x6')+_0x277c36,_0x22d8d3);WhatsappMessageEvents['on'](_0x277c36,_0x573823);}}; \ No newline at end of file +var _0x77be=['update','emit','removeListener','register','length','whatsappMessage:','remove'];(function(_0x1b1cc7,_0x5e2053){var _0x2b4254=function(_0x4548b0){while(--_0x4548b0){_0x1b1cc7['push'](_0x1b1cc7['shift']());}};_0x2b4254(++_0x5e2053);}(_0x77be,0x1aa));var _0xe77b=function(_0x5a9792,_0x12ef1b){_0x5a9792=_0x5a9792-0x0;var _0x55e9ee=_0x77be[_0x5a9792];return _0x55e9ee;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0xe77b('0x0'),_0xe77b('0x1')];function createListener(_0x1db0cd,_0xae92f0){return function(_0xd9c80d){_0xae92f0[_0xe77b('0x2')](_0x1db0cd,_0xd9c80d);};}function removeListener(_0x4e7be8,_0x33d561){return function(){WhatsappMessageEvents[_0xe77b('0x3')](_0x4e7be8,_0x33d561);};}exports[_0xe77b('0x4')]=function(_0x3a2b5a){for(var _0x50d517=0x0,_0x3bf896=events[_0xe77b('0x5')];_0x50d517<_0x3bf896;_0x50d517++){var _0x384ca2=events[_0x50d517];var _0x11d1c2=createListener(_0xe77b('0x6')+_0x384ca2,_0x3a2b5a);WhatsappMessageEvents['on'](_0x384ca2,_0x11d1c2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 0ee364d..0c27f34 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 _0x929e=['delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update'];(function(_0x523cc7,_0x34b3d0){var _0x268b8b=function(_0x26d073){while(--_0x26d073){_0x523cc7['push'](_0x523cc7['shift']());}};_0x268b8b(++_0x34b3d0);}(_0x929e,0xb2));var _0xe929=function(_0x491d7b,_0x38a3de){_0x491d7b=_0x491d7b-0x0;var _0x17ad08=_0x929e[_0x491d7b];return _0x17ad08;};'use strict';var multer=require(_0xe929('0x0'));var util=require(_0xe929('0x1'));var path=require(_0xe929('0x2'));var timeout=require(_0xe929('0x3'));var express=require(_0xe929('0x4'));var router=express[_0xe929('0x5')]();var fs_extra=require(_0xe929('0x6'));var auth=require(_0xe929('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe929('0x8'));var controller=require('./whatsappQueue.controller');router[_0xe929('0x9')]('/',auth['isAuthenticated'](),controller[_0xe929('0xa')]);router[_0xe929('0x9')](_0xe929('0xb'),auth[_0xe929('0xc')](),controller[_0xe929('0xd')]);router[_0xe929('0x9')](_0xe929('0xe'),auth['isAuthenticated'](),controller[_0xe929('0xf')]);router[_0xe929('0x9')](_0xe929('0x10'),auth[_0xe929('0xc')](),controller['getMembers']);router[_0xe929('0x9')](_0xe929('0x11'),auth[_0xe929('0xc')](),controller[_0xe929('0x12')]);router[_0xe929('0x9')](_0xe929('0x13'),auth[_0xe929('0xc')](),controller['getAgents']);router[_0xe929('0x14')]('/',auth[_0xe929('0xc')](),controller[_0xe929('0x15')]);router['post']('/:id/teams',auth[_0xe929('0xc')](),controller[_0xe929('0x16')]);router[_0xe929('0x14')]('/:id/users',auth[_0xe929('0xc')](),controller[_0xe929('0x17')]);router['put'](_0xe929('0xe'),auth[_0xe929('0xc')](),controller[_0xe929('0x18')]);router[_0xe929('0x19')](_0xe929('0xe'),auth[_0xe929('0xc')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xe929('0xc')](),controller[_0xe929('0x1a')]);router['delete'](_0xe929('0x13'),auth['isAuthenticated'](),controller[_0xe929('0x1b')]);module[_0xe929('0x1c')]=router; \ No newline at end of file +var _0x3e45=['index','/describe','describe','/:id','show','/:id/members','isAuthenticated','/:id/teams','getTeams','/:id/users','getAgents','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get'];(function(_0x239509,_0x1d71c2){var _0x16ba30=function(_0x9a0bbc){while(--_0x9a0bbc){_0x239509['push'](_0x239509['shift']());}};_0x16ba30(++_0x1d71c2);}(_0x3e45,0xf3));var _0x53e4=function(_0xb47a04,_0x466379){_0xb47a04=_0xb47a04-0x0;var _0x2bf5ac=_0x3e45[_0xb47a04];return _0x2bf5ac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x53e4('0x0'));var timeout=require(_0x53e4('0x1'));var express=require('express');var router=express[_0x53e4('0x2')]();var fs_extra=require(_0x53e4('0x3'));var auth=require(_0x53e4('0x4'));var interaction=require(_0x53e4('0x5'));var config=require(_0x53e4('0x6'));var controller=require(_0x53e4('0x7'));router[_0x53e4('0x8')]('/',auth['isAuthenticated'](),controller[_0x53e4('0x9')]);router[_0x53e4('0x8')](_0x53e4('0xa'),auth['isAuthenticated'](),controller[_0x53e4('0xb')]);router[_0x53e4('0x8')](_0x53e4('0xc'),auth['isAuthenticated'](),controller[_0x53e4('0xd')]);router[_0x53e4('0x8')](_0x53e4('0xe'),auth[_0x53e4('0xf')](),controller['getMembers']);router[_0x53e4('0x8')](_0x53e4('0x10'),auth['isAuthenticated'](),controller[_0x53e4('0x11')]);router['get'](_0x53e4('0x12'),auth[_0x53e4('0xf')](),controller[_0x53e4('0x13')]);router['post']('/',auth[_0x53e4('0xf')](),controller['create']);router['post'](_0x53e4('0x10'),auth[_0x53e4('0xf')](),controller['addTeams']);router['post'](_0x53e4('0x12'),auth[_0x53e4('0xf')](),controller[_0x53e4('0x14')]);router[_0x53e4('0x15')](_0x53e4('0xc'),auth[_0x53e4('0xf')](),controller[_0x53e4('0x16')]);router['delete'](_0x53e4('0xc'),auth[_0x53e4('0xf')](),controller[_0x53e4('0x17')]);router[_0x53e4('0x18')]('/:id/teams',auth[_0x53e4('0xf')](),controller[_0x53e4('0x19')]);router['delete'](_0x53e4('0x12'),auth[_0x53e4('0xf')](),controller[_0x53e4('0x1a')]);module[_0x53e4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6cd5df9..858b981 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 _0x983c=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x27489e,_0x105c8a){var _0x1e62e0=function(_0x2f2acc){while(--_0x2f2acc){_0x27489e['push'](_0x27489e['shift']());}};_0x1e62e0(++_0x105c8a);}(_0x983c,0xf3));var _0xc983=function(_0x4f96b4,_0x22cc57){_0x4f96b4=_0x4f96b4-0x0;var _0x67821b=_0x983c[_0x4f96b4];return _0x67821b;};'use strict';var Sequelize=require(_0xc983('0x0'));module[_0xc983('0x1')]={'name':{'type':Sequelize[_0xc983('0x2')],'unique':_0xc983('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc983('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc983('0x5'),_0xc983('0x6'),_0xc983('0x7'))},'description':{'type':Sequelize[_0xc983('0x2')]}}; \ No newline at end of file +var _0xc6d8=['STRING','INTEGER','rrmemory','sequelize'];(function(_0x3e2397,_0x385b67){var _0x26b99a=function(_0x4dc121){while(--_0x4dc121){_0x3e2397['push'](_0x3e2397['shift']());}};_0x26b99a(++_0x385b67);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x356dcc,_0x51f8f7){_0x356dcc=_0x356dcc-0x0;var _0xe6c019=_0xc6d8[_0x356dcc];return _0xe6c019;};'use strict';var Sequelize=require(_0x8c6d('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c6d('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8c6d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8c6d('0x3'),'beepall','roundrobin')},'description':{'type':Sequelize[_0x8c6d('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index dde1b04..c49ff6e 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 _0x3a27=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','params','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserWhatsappQueue','nolimit','pick','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','emit','userWhatsappQueue:remove','omit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','then','WhatsappQueues','UserProfileResource','destroy','error','name','send','index','WhatsappQueue','rawAttributes','key','model','map','query','keys','filters'];(function(_0xf6ad0,_0x44c790){var _0x25cb31=function(_0x2f2c87){while(--_0x2f2c87){_0xf6ad0['push'](_0xf6ad0['shift']());}};_0x25cb31(++_0x44c790);}(_0x3a27,0xe5));var _0x73a2=function(_0x3beddd,_0x1f8990){_0x3beddd=_0x3beddd-0x0;var _0x5e056f=_0x3a27[_0x3beddd];return _0x5e056f;};'use strict';var emlformat=require(_0x73a2('0x0'));var rimraf=require(_0x73a2('0x1'));var zipdir=require(_0x73a2('0x2'));var jsonpatch=require(_0x73a2('0x3'));var rp=require(_0x73a2('0x4'));var moment=require(_0x73a2('0x5'));var BPromise=require(_0x73a2('0x6'));var Mustache=require(_0x73a2('0x7'));var util=require(_0x73a2('0x8'));var path=require(_0x73a2('0x9'));var sox=require(_0x73a2('0xa'));var csv=require(_0x73a2('0xb'));var ejs=require(_0x73a2('0xc'));var fs=require('fs');var fs_extra=require(_0x73a2('0xd'));var _=require(_0x73a2('0xe'));var squel=require(_0x73a2('0xf'));var crypto=require(_0x73a2('0x10'));var jsforce=require(_0x73a2('0x11'));var deskjs=require(_0x73a2('0x12'));var toCsv=require('to-csv');var querystring=require(_0x73a2('0x13'));var Papa=require(_0x73a2('0x14'));var Redis=require(_0x73a2('0x15'));var authService=require(_0x73a2('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x73a2('0x17'));var hardwareService=require(_0x73a2('0x18'));var logger=require('../../config/logger')(_0x73a2('0x19'));var utils=require(_0x73a2('0x1a'));var config=require(_0x73a2('0x1b'));var licenseUtil=require(_0x73a2('0x1c'));var db=require(_0x73a2('0x1d'))['db'];config[_0x73a2('0x1e')]=_[_0x73a2('0x1f')](config[_0x73a2('0x1e')],{'host':_0x73a2('0x20'),'port':0x18eb});var socket=require(_0x73a2('0x21'))(new Redis(config[_0x73a2('0x1e')]));require(_0x73a2('0x22'))[_0x73a2('0x23')](socket);function respondWithStatusCode(_0x14c639,_0x12aff6){_0x12aff6=_0x12aff6||0xcc;return function(_0x548501){if(_0x548501){return _0x14c639[_0x73a2('0x24')](_0x12aff6);}return _0x14c639[_0x73a2('0x25')](_0x12aff6)[_0x73a2('0x26')]();};}function respondWithResult(_0x948d97,_0x5b6816){_0x5b6816=_0x5b6816||0xc8;return function(_0x3f1919){if(_0x3f1919){return _0x948d97[_0x73a2('0x25')](_0x5b6816)['json'](_0x3f1919);}};}function respondWithFilteredResult(_0x2e276a,_0xc1c5d){return function(_0xcc19b9){if(_0xcc19b9){var _0x11041d=typeof _0xc1c5d[_0x73a2('0x27')]===_0x73a2('0x28')&&typeof _0xc1c5d['limit']===_0x73a2('0x28');var _0x12e1fe=_0xcc19b9['count'];var _0x5989f2=_0x11041d?0x0:_0xc1c5d[_0x73a2('0x27')];var _0x4c1ba4=_0x11041d?_0xcc19b9['count']:_0xc1c5d['offset']+_0xc1c5d[_0x73a2('0x29')];var _0x265f6b;if(_0x4c1ba4>=_0x12e1fe){_0x4c1ba4=_0x12e1fe;_0x265f6b=0xc8;}else{_0x265f6b=0xce;}_0x2e276a[_0x73a2('0x25')](_0x265f6b);return _0x2e276a[_0x73a2('0x2a')](_0x73a2('0x2b'),_0x5989f2+'-'+_0x4c1ba4+'/'+_0x12e1fe)[_0x73a2('0x2c')](_0xcc19b9);}return null;};}function patchUpdates(_0x29e106){return function(_0x1c5927){try{jsonpatch[_0x73a2('0x2d')](_0x1c5927,_0x29e106,!![]);}catch(_0x19a32a){return BPromise['reject'](_0x19a32a);}return _0x1c5927[_0x73a2('0x2e')]();};}function saveUpdates(_0x31003a,_0x3f410a){return function(_0x4542e7){if(_0x4542e7){return _0x4542e7['update'](_0x31003a)[_0x73a2('0x2f')](function(_0x1f07db){return _0x1f07db;});}return null;};}function removeEntity(_0x30f02c,_0x33f219){return function(_0x50281d){if(_0x50281d){return _0x50281d['destroy']()[_0x73a2('0x2f')](function(){var _0x2e5fb0=_0x50281d['get']({'plain':!![]});var _0x3db9fb=_0x73a2('0x30');return db[_0x73a2('0x31')][_0x73a2('0x32')]({'where':{'type':_0x3db9fb,'resourceId':_0x2e5fb0['id']}})['then'](function(){return _0x50281d;});})['then'](function(){_0x30f02c[_0x73a2('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e4d2d,_0x2e15be){return function(_0x1f38b2){if(!_0x1f38b2){_0x1e4d2d[_0x73a2('0x24')](0x194);}return _0x1f38b2;};}function handleError(_0x5a5cde,_0xea3d23){_0xea3d23=_0xea3d23||0x1f4;return function(_0x4bbf89){logger[_0x73a2('0x33')](_0x4bbf89['stack']);if(_0x4bbf89[_0x73a2('0x34')]){delete _0x4bbf89[_0x73a2('0x34')];}_0x5a5cde['status'](_0xea3d23)[_0x73a2('0x35')](_0x4bbf89);};}exports[_0x73a2('0x36')]=function(_0x32c235,_0x165727){var _0x45259e={},_0x2cb90e={},_0x228e2b={'count':0x0,'rows':[]};var _0x5db0fc=_['map'](db[_0x73a2('0x37')][_0x73a2('0x38')],function(_0x31f3da){return{'name':_0x31f3da['fieldName'],'type':_0x31f3da['type'][_0x73a2('0x39')]};});_0x2cb90e[_0x73a2('0x3a')]=_[_0x73a2('0x3b')](_0x5db0fc,_0x73a2('0x34'));_0x2cb90e[_0x73a2('0x3c')]=_[_0x73a2('0x3d')](_0x32c235[_0x73a2('0x3c')]);_0x2cb90e[_0x73a2('0x3e')]=_[_0x73a2('0x3f')](_0x2cb90e['model'],_0x2cb90e[_0x73a2('0x3c')]);_0x45259e[_0x73a2('0x40')]=_['intersection'](_0x2cb90e['model'],qs[_0x73a2('0x41')](_0x32c235[_0x73a2('0x3c')][_0x73a2('0x41')]));_0x45259e['attributes']=_0x45259e[_0x73a2('0x40')][_0x73a2('0x42')]?_0x45259e['attributes']:_0x2cb90e[_0x73a2('0x3a')];if(!_0x32c235[_0x73a2('0x3c')][_0x73a2('0x43')]('nolimit')){_0x45259e[_0x73a2('0x29')]=qs[_0x73a2('0x29')](_0x32c235[_0x73a2('0x3c')][_0x73a2('0x29')]);_0x45259e['offset']=qs[_0x73a2('0x27')](_0x32c235['query'][_0x73a2('0x27')]);}_0x45259e[_0x73a2('0x44')]=qs[_0x73a2('0x45')](_0x32c235[_0x73a2('0x3c')]['sort']);_0x45259e[_0x73a2('0x46')]=qs[_0x73a2('0x3e')](_['pick'](_0x32c235[_0x73a2('0x3c')],_0x2cb90e['filters']),_0x5db0fc);if(_0x32c235['query'][_0x73a2('0x47')]){_0x45259e[_0x73a2('0x46')]=_[_0x73a2('0x48')](_0x45259e['where'],{'$or':_[_0x73a2('0x3b')](_0x5db0fc,function(_0x2aaa8a){if(_0x2aaa8a[_0x73a2('0x49')]!==_0x73a2('0x4a')){var _0x1b13ba={};_0x1b13ba[_0x2aaa8a['name']]={'$like':'%'+_0x32c235[_0x73a2('0x3c')][_0x73a2('0x47')]+'%'};return _0x1b13ba;}})});}_0x45259e=_[_0x73a2('0x48')]({},_0x45259e,_0x32c235[_0x73a2('0x4b')]);var _0x806b0c={'where':_0x45259e['where']};return db['WhatsappQueue'][_0x73a2('0x4c')](_0x806b0c)[_0x73a2('0x2f')](function(_0x3c94a5){_0x228e2b['count']=_0x3c94a5;if(_0x32c235['query'][_0x73a2('0x4d')]){_0x45259e[_0x73a2('0x4e')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x45259e);})[_0x73a2('0x2f')](function(_0x23e35a){_0x228e2b[_0x73a2('0x4f')]=_0x23e35a;return _0x228e2b;})['then'](respondWithFilteredResult(_0x165727,_0x45259e))['catch'](handleError(_0x165727,null));};exports['show']=function(_0x5108f7,_0x18fab9){var _0x202795={'raw':!![],'where':{'id':_0x5108f7[_0x73a2('0x50')]['id']}},_0xaf321={};_0xaf321['model']=_[_0x73a2('0x3d')](db['WhatsappQueue']['rawAttributes']);_0xaf321[_0x73a2('0x3c')]=_[_0x73a2('0x3d')](_0x5108f7[_0x73a2('0x3c')]);_0xaf321[_0x73a2('0x3e')]=_[_0x73a2('0x3f')](_0xaf321[_0x73a2('0x3a')],_0xaf321[_0x73a2('0x3c')]);_0x202795['attributes']=_[_0x73a2('0x3f')](_0xaf321[_0x73a2('0x3a')],qs[_0x73a2('0x41')](_0x5108f7[_0x73a2('0x3c')][_0x73a2('0x41')]));_0x202795[_0x73a2('0x40')]=_0x202795[_0x73a2('0x40')][_0x73a2('0x42')]?_0x202795[_0x73a2('0x40')]:_0xaf321['model'];if(_0x5108f7['query'][_0x73a2('0x4d')]){_0x202795['include']=[{'all':!![]}];}_0x202795=_[_0x73a2('0x48')]({},_0x202795,_0x5108f7[_0x73a2('0x4b')]);return db['WhatsappQueue'][_0x73a2('0x51')](_0x202795)[_0x73a2('0x2f')](handleEntityNotFound(_0x18fab9,null))[_0x73a2('0x2f')](respondWithResult(_0x18fab9,null))[_0x73a2('0x52')](handleError(_0x18fab9,null));};exports[_0x73a2('0x53')]=function(_0x55b7c0,_0x5147ff){return db['WhatsappQueue'][_0x73a2('0x53')](_0x55b7c0[_0x73a2('0x54')],{})[_0x73a2('0x2f')](function(_0x12192a){var _0xfd2ce4=_0x55b7c0[_0x73a2('0x55')][_0x73a2('0x56')]({'plain':!![]});if(!_0xfd2ce4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfd2ce4[_0x73a2('0x57')]===_0x73a2('0x55')){var _0x587f44=_0x12192a[_0x73a2('0x56')]({'plain':!![]});var _0x23f251=_0x73a2('0x30');return db[_0x73a2('0x58')]['find']({'where':{'name':_0x23f251,'userProfileId':_0xfd2ce4[_0x73a2('0x59')]},'raw':!![]})['then'](function(_0xfd9437){if(_0xfd9437&&_0xfd9437[_0x73a2('0x5a')]===0x0){return db[_0x73a2('0x31')][_0x73a2('0x53')]({'name':_0x587f44['name'],'resourceId':_0x587f44['id'],'type':_0xfd9437[_0x73a2('0x34')],'sectionId':_0xfd9437['id']},{})['then'](function(){return _0x12192a;});}else{return _0x12192a;}})['catch'](function(_0x15be8d){logger[_0x73a2('0x33')](_0x73a2('0x5b'),_0x15be8d);throw _0x15be8d;});}return _0x12192a;})['then'](respondWithResult(_0x5147ff,0xc9))[_0x73a2('0x52')](handleError(_0x5147ff,null));};exports['update']=function(_0x332a10,_0x55c596){if(_0x332a10['body']['id']){delete _0x332a10[_0x73a2('0x54')]['id'];}return db[_0x73a2('0x37')][_0x73a2('0x51')]({'where':{'id':_0x332a10[_0x73a2('0x50')]['id']}})[_0x73a2('0x2f')](handleEntityNotFound(_0x55c596,null))['then'](saveUpdates(_0x332a10[_0x73a2('0x54')],null))[_0x73a2('0x2f')](respondWithResult(_0x55c596,null))[_0x73a2('0x52')](handleError(_0x55c596,null));};exports[_0x73a2('0x32')]=function(_0x5bf1f6,_0x253f65){return db[_0x73a2('0x37')][_0x73a2('0x51')]({'where':{'id':_0x5bf1f6[_0x73a2('0x50')]['id']}})[_0x73a2('0x2f')](handleEntityNotFound(_0x253f65,null))['then'](removeEntity(_0x253f65,null))[_0x73a2('0x52')](handleError(_0x253f65,null));};exports['describe']=function(_0xb4569,_0x2f587c){return db['WhatsappQueue']['describe']()[_0x73a2('0x2f')](respondWithResult(_0x2f587c,null))[_0x73a2('0x52')](handleError(_0x2f587c,null));};exports[_0x73a2('0x5c')]=function(_0x5d9920,_0x17836f,_0x52c05e){var _0x46f624={'raw':!![],'where':{}},_0x29f17e={},_0x141178;return db[_0x73a2('0x37')][_0x73a2('0x5d')]({'where':{'id':_0x5d9920['params']['id']}})[_0x73a2('0x2f')](handleEntityNotFound(_0x17836f,null))[_0x73a2('0x2f')](function(_0x285d2e){if(_0x285d2e){_0x141178=_0x285d2e['get']({'plain':!![]});_0x29f17e['model']=_[_0x73a2('0x3d')](db[_0x73a2('0x5e')][_0x73a2('0x38')]);_0x29f17e[_0x73a2('0x3c')]=_[_0x73a2('0x3d')](_0x5d9920[_0x73a2('0x3c')]);_0x29f17e[_0x73a2('0x3e')]=_['intersection'](_0x29f17e[_0x73a2('0x3a')],_0x29f17e[_0x73a2('0x3c')]);_0x46f624[_0x73a2('0x40')]=_[_0x73a2('0x3f')](_0x29f17e[_0x73a2('0x3a')],qs[_0x73a2('0x41')](_0x5d9920[_0x73a2('0x3c')][_0x73a2('0x41')]));_0x46f624['attributes']=_0x46f624['attributes'][_0x73a2('0x42')]?_0x46f624[_0x73a2('0x40')]:_0x29f17e[_0x73a2('0x3a')];if(!_0x5d9920[_0x73a2('0x3c')]['hasOwnProperty'](_0x73a2('0x5f'))){_0x46f624['limit']=qs[_0x73a2('0x29')](_0x5d9920[_0x73a2('0x3c')][_0x73a2('0x29')]);_0x46f624['offset']=qs[_0x73a2('0x27')](_0x5d9920['query'][_0x73a2('0x27')]);}_0x46f624[_0x73a2('0x44')]=qs[_0x73a2('0x45')](_0x5d9920['query']['sort']);_0x46f624[_0x73a2('0x46')]=qs[_0x73a2('0x3e')](_[_0x73a2('0x60')](_0x5d9920[_0x73a2('0x3c')],_0x29f17e[_0x73a2('0x3e')]));_0x46f624[_0x73a2('0x46')][_0x73a2('0x61')]=_0x285d2e['id'];if(_0x5d9920['query'][_0x73a2('0x47')]){_0x46f624[_0x73a2('0x46')]=_[_0x73a2('0x48')](_0x46f624[_0x73a2('0x46')],{'$or':_[_0x73a2('0x3b')](_0x46f624[_0x73a2('0x40')],function(_0x6203c4){var _0x52b9ad={};_0x52b9ad[_0x6203c4]={'$like':'%'+_0x5d9920[_0x73a2('0x3c')][_0x73a2('0x47')]+'%'};return _0x52b9ad;})});}_0x46f624=_['merge']({},_0x46f624,_0x5d9920['options']);return db['UserWhatsappQueue'][_0x73a2('0x62')](_0x46f624);}})['then'](function(_0x5eabf2){if(_0x5eabf2){return db[_0x73a2('0x63')][_0x73a2('0x64')]({'where':{'id':_['map'](_0x5eabf2,_0x73a2('0x65')),'role':_0x73a2('0x66')},'attributes':['id',_0x73a2('0x34'),_0x73a2('0x67'),'updatedAt',_0x73a2('0x68')]});}})[_0x73a2('0x2f')](function(_0x2f142b){if(_0x2f142b){return{'count':_0x2f142b[_0x73a2('0x4c')],'rows':_[_0x73a2('0x3b')](_0x2f142b[_0x73a2('0x4f')],function(_0x405452){return{'membername':_0x405452['name'],'UserId':_0x405452['id'],'queue_name':_0x141178[_0x73a2('0x34')],'WhatsappQueueId':_0x141178['id'],'interface':util[_0x73a2('0x69')](_0x73a2('0x6a'),_0x73a2('0x6b'),_0x405452[_0x73a2('0x34')]),'penalty':0x0,'paused':_0x405452['whatsappPause'],'createdAt':_0x405452[_0x73a2('0x68')],'updatedAt':_0x405452['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x73a2('0x2f')](respondWithFilteredResult(_0x17836f,_0x46f624))[_0x73a2('0x52')](handleError(_0x17836f,null));};exports[_0x73a2('0x6c')]=function(_0xb9748a,_0x58eded,_0x5b5485){var _0x3c11cd={};var _0x5d6094={};var _0xb3e97f;var _0x58e0b5;return db[_0x73a2('0x37')][_0x73a2('0x5d')]({'where':{'id':_0xb9748a['params']['id']}})[_0x73a2('0x2f')](handleEntityNotFound(_0x58eded,null))['then'](function(_0x1d4de8){if(_0x1d4de8){_0xb3e97f=_0x1d4de8;_0x5d6094[_0x73a2('0x3a')]=_['keys'](db[_0x73a2('0x6d')][_0x73a2('0x38')]);_0x5d6094[_0x73a2('0x3c')]=_[_0x73a2('0x3d')](_0xb9748a[_0x73a2('0x3c')]);_0x5d6094[_0x73a2('0x3e')]=_[_0x73a2('0x3f')](_0x5d6094[_0x73a2('0x3a')],_0x5d6094['query']);_0x3c11cd['attributes']=_['intersection'](_0x5d6094['model'],qs['fields'](_0xb9748a[_0x73a2('0x3c')][_0x73a2('0x41')]));_0x3c11cd[_0x73a2('0x40')]=_0x3c11cd[_0x73a2('0x40')][_0x73a2('0x42')]?_0x3c11cd[_0x73a2('0x40')]:_0x5d6094[_0x73a2('0x3a')];_0x3c11cd[_0x73a2('0x44')]=qs['sort'](_0xb9748a['query'][_0x73a2('0x45')]);_0x3c11cd[_0x73a2('0x46')]=qs[_0x73a2('0x3e')](_[_0x73a2('0x60')](_0xb9748a[_0x73a2('0x3c')],_0x5d6094['filters']));if(_0xb9748a['query']['filter']){_0x3c11cd[_0x73a2('0x46')]=_['merge'](_0x3c11cd[_0x73a2('0x46')],{'$or':_[_0x73a2('0x3b')](_0x3c11cd['attributes'],function(_0x3dde3d){var _0x12d870={};_0x12d870[_0x3dde3d]={'$like':'%'+_0xb9748a[_0x73a2('0x3c')][_0x73a2('0x47')]+'%'};return _0x12d870;})});}_0x3c11cd=_[_0x73a2('0x48')]({},_0x3c11cd,_0xb9748a[_0x73a2('0x4b')]);return _0xb3e97f['getTeams'](_0x3c11cd);}})[_0x73a2('0x2f')](function(_0x29e419){if(_0x29e419){_0x58e0b5=_0x29e419[_0x73a2('0x42')];if(!_0xb9748a[_0x73a2('0x3c')][_0x73a2('0x43')](_0x73a2('0x5f'))){_0x3c11cd[_0x73a2('0x29')]=qs[_0x73a2('0x29')](_0xb9748a[_0x73a2('0x3c')][_0x73a2('0x29')]);_0x3c11cd[_0x73a2('0x27')]=qs[_0x73a2('0x27')](_0xb9748a[_0x73a2('0x3c')][_0x73a2('0x27')]);}return _0xb3e97f[_0x73a2('0x6c')](_0x3c11cd);}})[_0x73a2('0x2f')](function(_0x5db7dc){if(_0x5db7dc){return _0x5db7dc?{'count':_0x58e0b5,'rows':_0x5db7dc}:null;}})[_0x73a2('0x2f')](respondWithResult(_0x58eded,null))[_0x73a2('0x52')](handleError(_0x58eded,null));};exports[_0x73a2('0x6e')]=function(_0x598f5e,_0x4da5aa,_0x3a87bf){var _0x497545=_0x598f5e[_0x73a2('0x54')][_0x73a2('0x6f')];return db[_0x73a2('0x6d')][_0x73a2('0x62')]({'where':{'id':_0x497545},'attributes':['id'],'include':[{'model':db[_0x73a2('0x63')],'as':'Agents','attributes':['id',_0x73a2('0x34'),'online',_0x73a2('0x70'),_0x73a2('0x71')],'raw':!![]}]})[_0x73a2('0x2f')](function(_0x5dd89b){if(_0x5dd89b){var _0x70523c=_['flatMap'](_0x5dd89b,function(_0x45b3f7){var _0x4fd55a=_0x45b3f7[_0x73a2('0x56')]({'plain':!![]});return _0x4fd55a[_0x73a2('0x72')];});return db['WhatsappQueue'][_0x73a2('0x51')]({'where':{'id':_0x598f5e[_0x73a2('0x50')]['id']}})[_0x73a2('0x2f')](function(_0x46bc3a){return db[_0x73a2('0x73')][_0x73a2('0x74')](function(_0x2c078c){return _0x46bc3a['addTeams'](_0x497545,{'transaction':_0x2c078c})[_0x73a2('0x2f')](function(){return BPromise[_0x73a2('0x75')](_0x70523c,function(_0x2ad1a6){return db['UserWhatsappQueue'][_0x73a2('0x76')]({'where':{'UserId':_0x2ad1a6['id'],'WhatsappQueueId':_0x598f5e[_0x73a2('0x50')]['id']},'transaction':_0x2c078c});});})[_0x73a2('0x2f')](function(){_0x70523c[_0x73a2('0x77')](function(_0x59582d){socket['emit'](_0x73a2('0x78'),{'UserId':_0x59582d['id'],'WhatsappQueueId':_0x46bc3a['id']});});});});});}})[_0x73a2('0x2f')](respondWithStatusCode(_0x4da5aa,null))['catch'](handleError(_0x4da5aa,null));};exports[_0x73a2('0x79')]=function(_0x41c27c,_0x11b3af,_0x247fc4){return db[_0x73a2('0x6d')][_0x73a2('0x62')]({'where':{'id':_0x41c27c['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x73a2('0x2f')](handleEntityNotFound(_0x11b3af,null))[_0x73a2('0x2f')](function(_0x43458e){var _0x464155=_['map'](_0x43458e,'id');var _0x48715a=[];var _0x1e9181=[];var _0x1cdded=squel['select']();_0x1cdded[_0x73a2('0x7a')](_0x73a2('0x7b'))['from'](_0x73a2('0x7c'),'tq')['join'](_0x73a2('0x7d'),'ut',_0x73a2('0x7e'))[_0x73a2('0x46')](_0x73a2('0x7f'),_0x41c27c[_0x73a2('0x50')]['id']);for(var _0x44bc9f=0x0;_0x44bc9f<_0x43458e[_0x73a2('0x42')];_0x44bc9f+=0x1){let _0x33c9fe=_0x43458e[_0x44bc9f];for(var _0x742445=0x0;_0x742445<_0x33c9fe[_0x73a2('0x72')][_0x73a2('0x42')];_0x742445+=0x1){let _0x338145=_0x33c9fe['Agents'][_0x742445];var _0x532fb2=_0x1cdded[_0x73a2('0x80')]();_0x532fb2[_0x73a2('0x46')](_0x73a2('0x81'),_0x338145['id']);_0x1e9181[_0x73a2('0x82')](db[_0x73a2('0x73')][_0x73a2('0x3c')](_0x532fb2[_0x73a2('0x83')](),{'type':db[_0x73a2('0x73')][_0x73a2('0x84')][_0x73a2('0x85')]})[_0x73a2('0x2f')](function(_0x2049e7){if(_0x2049e7[_0x73a2('0x42')]===0x1){return _0x338145['id'];}else{var _0x421a5d=_[_0x73a2('0x86')](_[_0x73a2('0x3b')](_0x2049e7,'TeamId'),function(_0xb0fd41){return _[_0x73a2('0x87')](_0x464155,_0xb0fd41);});if(_0x421a5d){return _0x338145['id'];}}}));}}return BPromise[_0x73a2('0x88')](_0x1e9181)[_0x73a2('0x2f')](function(_0x3caeb4){_0x48715a=_(_0x48715a)['union'](_0x3caeb4)[_0x73a2('0x89')]()[_0x73a2('0x8a')]();return db[_0x73a2('0x37')][_0x73a2('0x51')]({'where':{'id':_0x41c27c[_0x73a2('0x50')]['id']}})[_0x73a2('0x2f')](function(_0x5449eb){return db[_0x73a2('0x73')][_0x73a2('0x74')](function(_0x3b681f){return _0x5449eb[_0x73a2('0x79')](_0x41c27c[_0x73a2('0x3c')][_0x73a2('0x6f')],{'transaction':_0x3b681f})[_0x73a2('0x2f')](function(){if(!_[_0x73a2('0x8b')](_0x48715a)){return _0x5449eb['removeAgents'](_0x48715a,{'transaction':_0x3b681f});}})[_0x73a2('0x2f')](function(){_0x48715a[_0x73a2('0x77')](function(_0x25f432){socket[_0x73a2('0x8c')](_0x73a2('0x8d'),{'UserId':_0x25f432,'WhatsappQueueId':_0x5449eb['id']});});});});});});})[_0x73a2('0x2f')](respondWithStatusCode(_0x11b3af,null))[_0x73a2('0x52')](handleError(_0x11b3af,null));};exports['addAgents']=function(_0x4446ee,_0x1cb9e3,_0x32e029){return db[_0x73a2('0x37')][_0x73a2('0x51')]({'where':{'id':_0x4446ee[_0x73a2('0x50')]['id']}})['then'](handleEntityNotFound(_0x1cb9e3,null))[_0x73a2('0x2f')](function(_0x5c0f6d){if(_0x5c0f6d){return _0x5c0f6d['addAgents'](_0x4446ee[_0x73a2('0x54')][_0x73a2('0x6f')],_[_0x73a2('0x8e')](_0x4446ee[_0x73a2('0x54')],[_0x73a2('0x6f'),'id'])||{})['spread'](function(_0x793f0b){for(var _0x2904ae=0x0;_0x2904ae<_0x4446ee['body'][_0x73a2('0x6f')][_0x73a2('0x42')];_0x2904ae+=0x1){socket['emit'](_0x73a2('0x78'),{'UserId':Number(_0x4446ee['body']['ids'][_0x2904ae]),'WhatsappQueueId':Number(_0x4446ee[_0x73a2('0x50')]['id'])});}return _0x793f0b;});}})[_0x73a2('0x2f')](respondWithResult(_0x1cb9e3,null))['catch'](handleError(_0x1cb9e3,null));};exports[_0x73a2('0x8f')]=function(_0x316b14,_0xdc9da8,_0x23812c){return db[_0x73a2('0x37')]['find']({'where':{'id':_0x316b14['params']['id']}})['then'](handleEntityNotFound(_0xdc9da8,null))['then'](function(_0x4394fb){if(_0x4394fb){return _0x4394fb[_0x73a2('0x8f')](_0x316b14[_0x73a2('0x3c')][_0x73a2('0x6f')])['then'](function(){if(_[_0x73a2('0x90')](_0x316b14[_0x73a2('0x3c')][_0x73a2('0x6f')])){for(var _0x290d19=0x0;_0x290d19<_0x316b14[_0x73a2('0x3c')][_0x73a2('0x6f')][_0x73a2('0x42')];_0x290d19+=0x1){socket['emit'](_0x73a2('0x8d'),{'UserId':Number(_0x316b14['query']['ids'][_0x290d19]),'WhatsappQueueId':Number(_0x316b14[_0x73a2('0x50')]['id'])});}}else{socket[_0x73a2('0x8c')](_0x73a2('0x8d'),{'UserId':Number(_0x316b14[_0x73a2('0x3c')][_0x73a2('0x6f')]),'WhatsappQueueId':Number(_0x316b14['params']['id'])});}});}})['then'](respondWithStatusCode(_0xdc9da8,null))[_0x73a2('0x52')](handleError(_0xdc9da8,null));};exports[_0x73a2('0x91')]=function(_0x263bd3,_0xaccd7b,_0x379235){var _0x16e699={};var _0x229e97={};var _0x259d18;var _0x564fe6;return db[_0x73a2('0x37')][_0x73a2('0x5d')]({'where':{'id':_0x263bd3['params']['id']}})[_0x73a2('0x2f')](handleEntityNotFound(_0xaccd7b,null))['then'](function(_0x39edc7){if(_0x39edc7){_0x259d18=_0x39edc7;_0x229e97[_0x73a2('0x3a')]=_['keys'](db['User'][_0x73a2('0x38')]);_0x229e97[_0x73a2('0x3c')]=_[_0x73a2('0x3d')](_0x263bd3[_0x73a2('0x3c')]);_0x229e97[_0x73a2('0x3e')]=_[_0x73a2('0x3f')](_0x229e97['model'],_0x229e97[_0x73a2('0x3c')]);_0x16e699['attributes']=_[_0x73a2('0x3f')](_0x229e97['model'],qs[_0x73a2('0x41')](_0x263bd3['query']['fields']));_0x16e699[_0x73a2('0x40')]=_0x16e699[_0x73a2('0x40')]['length']?_0x16e699[_0x73a2('0x40')]:_0x229e97[_0x73a2('0x3a')];_0x16e699[_0x73a2('0x44')]=qs[_0x73a2('0x45')](_0x263bd3['query'][_0x73a2('0x45')]);_0x16e699[_0x73a2('0x46')]=qs[_0x73a2('0x3e')](_[_0x73a2('0x60')](_0x263bd3[_0x73a2('0x3c')],_0x229e97[_0x73a2('0x3e')]));if(_0x263bd3[_0x73a2('0x3c')][_0x73a2('0x47')]){_0x16e699['where']=_['merge'](_0x16e699[_0x73a2('0x46')],{'$or':_[_0x73a2('0x3b')](_0x16e699[_0x73a2('0x40')],function(_0x5883bd){var _0x1bfb77={};_0x1bfb77[_0x5883bd]={'$like':'%'+_0x263bd3['query'][_0x73a2('0x47')]+'%'};return _0x1bfb77;})});}_0x16e699=_[_0x73a2('0x48')]({},_0x16e699,_0x263bd3['options']);return _0x259d18[_0x73a2('0x91')](_0x16e699);}})[_0x73a2('0x2f')](function(_0x4d17b9){if(_0x4d17b9){_0x564fe6=_0x4d17b9[_0x73a2('0x42')];if(!_0x263bd3[_0x73a2('0x3c')]['hasOwnProperty'](_0x73a2('0x5f'))){_0x16e699[_0x73a2('0x29')]=qs[_0x73a2('0x29')](_0x263bd3[_0x73a2('0x3c')]['limit']);_0x16e699[_0x73a2('0x27')]=qs['offset'](_0x263bd3['query']['offset']);}return _0x259d18[_0x73a2('0x91')](_0x16e699);}})[_0x73a2('0x2f')](function(_0x5d6b7f){if(_0x5d6b7f){return _0x5d6b7f?{'count':_0x564fe6,'rows':_0x5d6b7f}:null;}})[_0x73a2('0x2f')](respondWithResult(_0xaccd7b,null))[_0x73a2('0x52')](handleError(_0xaccd7b,null));}; \ No newline at end of file +var _0x8ddb=['removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','removeAgents','forEach','emit','addAgents','omit','spread','userWhatsappQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','userWhatsappQueue:save'];(function(_0xc4ae56,_0x3c69b4){var _0x133d66=function(_0x1403f9){while(--_0x1403f9){_0xc4ae56['push'](_0xc4ae56['shift']());}};_0x133d66(++_0x3c69b4);}(_0x8ddb,0x1c1));var _0xb8dd=function(_0x270f18,_0x8155e9){_0x270f18=_0x270f18-0x0;var _0x39d745=_0x8ddb[_0x270f18];return _0x39d745;};'use strict';var emlformat=require(_0xb8dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8dd('0x1'));var jsonpatch=require(_0xb8dd('0x2'));var rp=require('request-promise');var moment=require(_0xb8dd('0x3'));var BPromise=require(_0xb8dd('0x4'));var Mustache=require(_0xb8dd('0x5'));var util=require(_0xb8dd('0x6'));var path=require('path');var sox=require(_0xb8dd('0x7'));var csv=require('to-csv');var ejs=require(_0xb8dd('0x8'));var fs=require('fs');var fs_extra=require(_0xb8dd('0x9'));var _=require(_0xb8dd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8dd('0xb'));var toCsv=require(_0xb8dd('0xc'));var querystring=require('querystring');var Papa=require(_0xb8dd('0xd'));var Redis=require(_0xb8dd('0xe'));var authService=require(_0xb8dd('0xf'));var qs=require(_0xb8dd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8dd('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb8dd('0x12'));var licenseUtil=require(_0xb8dd('0x13'));var db=require('../../mysqldb')['db'];config[_0xb8dd('0x14')]=_['defaults'](config[_0xb8dd('0x14')],{'host':_0xb8dd('0x15'),'port':0x18eb});var socket=require(_0xb8dd('0x16'))(new Redis(config[_0xb8dd('0x14')]));require(_0xb8dd('0x17'))[_0xb8dd('0x18')](socket);function respondWithStatusCode(_0x1ce592,_0x25e1d6){_0x25e1d6=_0x25e1d6||0xcc;return function(_0x387f97){if(_0x387f97){return _0x1ce592[_0xb8dd('0x19')](_0x25e1d6);}return _0x1ce592[_0xb8dd('0x1a')](_0x25e1d6)[_0xb8dd('0x1b')]();};}function respondWithResult(_0x197867,_0x4d4be4){_0x4d4be4=_0x4d4be4||0xc8;return function(_0x3c1192){if(_0x3c1192){return _0x197867['status'](_0x4d4be4)[_0xb8dd('0x1c')](_0x3c1192);}};}function respondWithFilteredResult(_0x27770d,_0x567c27){return function(_0x5c66ac){if(_0x5c66ac){var _0x2b1eee=typeof _0x567c27['offset']===_0xb8dd('0x1d')&&typeof _0x567c27[_0xb8dd('0x1e')]===_0xb8dd('0x1d');var _0xaaaec3=_0x5c66ac[_0xb8dd('0x1f')];var _0x432814=_0x2b1eee?0x0:_0x567c27[_0xb8dd('0x20')];var _0x1092be=_0x2b1eee?_0x5c66ac[_0xb8dd('0x1f')]:_0x567c27[_0xb8dd('0x20')]+_0x567c27['limit'];var _0x37ba82;if(_0x1092be>=_0xaaaec3){_0x1092be=_0xaaaec3;_0x37ba82=0xc8;}else{_0x37ba82=0xce;}_0x27770d['status'](_0x37ba82);return _0x27770d[_0xb8dd('0x21')](_0xb8dd('0x22'),_0x432814+'-'+_0x1092be+'/'+_0xaaaec3)[_0xb8dd('0x1c')](_0x5c66ac);}return null;};}function patchUpdates(_0x587208){return function(_0x33ea89){try{jsonpatch[_0xb8dd('0x23')](_0x33ea89,_0x587208,!![]);}catch(_0x2fae85){return BPromise[_0xb8dd('0x24')](_0x2fae85);}return _0x33ea89[_0xb8dd('0x25')]();};}function saveUpdates(_0x3646b4,_0xe14da7){return function(_0xbaa6f0){if(_0xbaa6f0){return _0xbaa6f0[_0xb8dd('0x26')](_0x3646b4)['then'](function(_0x599237){return _0x599237;});}return null;};}function removeEntity(_0x3e1850,_0x43a457){return function(_0x20ae23){if(_0x20ae23){return _0x20ae23[_0xb8dd('0x27')]()[_0xb8dd('0x28')](function(){var _0x2698b8=_0x20ae23[_0xb8dd('0x29')]({'plain':!![]});var _0x5671b4='WhatsappQueues';return db[_0xb8dd('0x2a')][_0xb8dd('0x27')]({'where':{'type':_0x5671b4,'resourceId':_0x2698b8['id']}})[_0xb8dd('0x28')](function(){return _0x20ae23;});})[_0xb8dd('0x28')](function(){_0x3e1850[_0xb8dd('0x1a')](0xcc)[_0xb8dd('0x1b')]();});}};}function handleEntityNotFound(_0xd91992,_0x2ced27){return function(_0x1732d5){if(!_0x1732d5){_0xd91992[_0xb8dd('0x19')](0x194);}return _0x1732d5;};}function handleError(_0x3ee06d,_0x46843e){_0x46843e=_0x46843e||0x1f4;return function(_0x300c85){logger['error'](_0x300c85[_0xb8dd('0x2b')]);if(_0x300c85[_0xb8dd('0x2c')]){delete _0x300c85[_0xb8dd('0x2c')];}_0x3ee06d['status'](_0x46843e)[_0xb8dd('0x2d')](_0x300c85);};}exports[_0xb8dd('0x2e')]=function(_0x19c5a4,_0x455901){var _0x406b70={},_0x559c8d={},_0x450b9f={'count':0x0,'rows':[]};var _0xb0da36=_[_0xb8dd('0x2f')](db[_0xb8dd('0x30')][_0xb8dd('0x31')],function(_0x46b203){return{'name':_0x46b203['fieldName'],'type':_0x46b203[_0xb8dd('0x32')][_0xb8dd('0x33')]};});_0x559c8d[_0xb8dd('0x34')]=_[_0xb8dd('0x2f')](_0xb0da36,'name');_0x559c8d[_0xb8dd('0x35')]=_[_0xb8dd('0x36')](_0x19c5a4[_0xb8dd('0x35')]);_0x559c8d[_0xb8dd('0x37')]=_[_0xb8dd('0x38')](_0x559c8d[_0xb8dd('0x34')],_0x559c8d['query']);_0x406b70['attributes']=_[_0xb8dd('0x38')](_0x559c8d['model'],qs[_0xb8dd('0x39')](_0x19c5a4[_0xb8dd('0x35')]['fields']));_0x406b70[_0xb8dd('0x3a')]=_0x406b70[_0xb8dd('0x3a')][_0xb8dd('0x3b')]?_0x406b70[_0xb8dd('0x3a')]:_0x559c8d['model'];if(!_0x19c5a4[_0xb8dd('0x35')][_0xb8dd('0x3c')]('nolimit')){_0x406b70['limit']=qs['limit'](_0x19c5a4[_0xb8dd('0x35')][_0xb8dd('0x1e')]);_0x406b70[_0xb8dd('0x20')]=qs[_0xb8dd('0x20')](_0x19c5a4[_0xb8dd('0x35')][_0xb8dd('0x20')]);}_0x406b70[_0xb8dd('0x3d')]=qs['sort'](_0x19c5a4[_0xb8dd('0x35')][_0xb8dd('0x3e')]);_0x406b70[_0xb8dd('0x3f')]=qs[_0xb8dd('0x37')](_[_0xb8dd('0x40')](_0x19c5a4[_0xb8dd('0x35')],_0x559c8d[_0xb8dd('0x37')]),_0xb0da36);if(_0x19c5a4[_0xb8dd('0x35')][_0xb8dd('0x41')]){_0x406b70[_0xb8dd('0x3f')]=_[_0xb8dd('0x42')](_0x406b70[_0xb8dd('0x3f')],{'$or':_[_0xb8dd('0x2f')](_0xb0da36,function(_0x391935){if(_0x391935[_0xb8dd('0x32')]!==_0xb8dd('0x43')){var _0x5791df={};_0x5791df[_0x391935[_0xb8dd('0x2c')]]={'$like':'%'+_0x19c5a4['query'][_0xb8dd('0x41')]+'%'};return _0x5791df;}})});}_0x406b70=_[_0xb8dd('0x42')]({},_0x406b70,_0x19c5a4[_0xb8dd('0x44')]);var _0xa1cf1e={'where':_0x406b70['where']};return db[_0xb8dd('0x30')][_0xb8dd('0x1f')](_0xa1cf1e)[_0xb8dd('0x28')](function(_0x3ef66a){_0x450b9f[_0xb8dd('0x1f')]=_0x3ef66a;if(_0x19c5a4[_0xb8dd('0x35')][_0xb8dd('0x45')]){_0x406b70[_0xb8dd('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xb8dd('0x47')](_0x406b70);})[_0xb8dd('0x28')](function(_0xc66dd3){_0x450b9f[_0xb8dd('0x48')]=_0xc66dd3;return _0x450b9f;})[_0xb8dd('0x28')](respondWithFilteredResult(_0x455901,_0x406b70))[_0xb8dd('0x49')](handleError(_0x455901,null));};exports['show']=function(_0x325df8,_0x5b853e){var _0x4021d8={'raw':!![],'where':{'id':_0x325df8['params']['id']}},_0x48a279={};_0x48a279[_0xb8dd('0x34')]=_[_0xb8dd('0x36')](db[_0xb8dd('0x30')]['rawAttributes']);_0x48a279[_0xb8dd('0x35')]=_['keys'](_0x325df8['query']);_0x48a279['filters']=_['intersection'](_0x48a279[_0xb8dd('0x34')],_0x48a279[_0xb8dd('0x35')]);_0x4021d8[_0xb8dd('0x3a')]=_['intersection'](_0x48a279[_0xb8dd('0x34')],qs[_0xb8dd('0x39')](_0x325df8[_0xb8dd('0x35')]['fields']));_0x4021d8[_0xb8dd('0x3a')]=_0x4021d8[_0xb8dd('0x3a')][_0xb8dd('0x3b')]?_0x4021d8[_0xb8dd('0x3a')]:_0x48a279[_0xb8dd('0x34')];if(_0x325df8[_0xb8dd('0x35')][_0xb8dd('0x45')]){_0x4021d8['include']=[{'all':!![]}];}_0x4021d8=_['merge']({},_0x4021d8,_0x325df8[_0xb8dd('0x44')]);return db['WhatsappQueue'][_0xb8dd('0x4a')](_0x4021d8)['then'](handleEntityNotFound(_0x5b853e,null))[_0xb8dd('0x28')](respondWithResult(_0x5b853e,null))['catch'](handleError(_0x5b853e,null));};exports[_0xb8dd('0x4b')]=function(_0x2eee85,_0x58a9da){return db['WhatsappQueue']['create'](_0x2eee85['body'],{})[_0xb8dd('0x28')](function(_0x309b34){var _0xe70ee6=_0x2eee85[_0xb8dd('0x4c')]['get']({'plain':!![]});if(!_0xe70ee6)throw new Error(_0xb8dd('0x4d'));if(_0xe70ee6[_0xb8dd('0x4e')]===_0xb8dd('0x4c')){var _0x200e59=_0x309b34['get']({'plain':!![]});var _0x331824=_0xb8dd('0x4f');return db[_0xb8dd('0x50')][_0xb8dd('0x4a')]({'where':{'name':_0x331824,'userProfileId':_0xe70ee6['userProfileId']},'raw':!![]})[_0xb8dd('0x28')](function(_0x307d7f){if(_0x307d7f&&_0x307d7f[_0xb8dd('0x51')]===0x0){return db['UserProfileResource'][_0xb8dd('0x4b')]({'name':_0x200e59[_0xb8dd('0x2c')],'resourceId':_0x200e59['id'],'type':_0x307d7f[_0xb8dd('0x2c')],'sectionId':_0x307d7f['id']},{})[_0xb8dd('0x28')](function(){return _0x309b34;});}else{return _0x309b34;}})[_0xb8dd('0x49')](function(_0x3ec77f){logger['error'](_0xb8dd('0x52'),_0x3ec77f);throw _0x3ec77f;});}return _0x309b34;})[_0xb8dd('0x28')](respondWithResult(_0x58a9da,0xc9))[_0xb8dd('0x49')](handleError(_0x58a9da,null));};exports[_0xb8dd('0x26')]=function(_0x144f3f,_0x5e469c){if(_0x144f3f[_0xb8dd('0x53')]['id']){delete _0x144f3f[_0xb8dd('0x53')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x144f3f[_0xb8dd('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e469c,null))['then'](saveUpdates(_0x144f3f[_0xb8dd('0x53')],null))['then'](respondWithResult(_0x5e469c,null))[_0xb8dd('0x49')](handleError(_0x5e469c,null));};exports[_0xb8dd('0x27')]=function(_0x56b575,_0x162335){return db[_0xb8dd('0x30')][_0xb8dd('0x4a')]({'where':{'id':_0x56b575['params']['id']}})[_0xb8dd('0x28')](handleEntityNotFound(_0x162335,null))[_0xb8dd('0x28')](removeEntity(_0x162335,null))['catch'](handleError(_0x162335,null));};exports[_0xb8dd('0x55')]=function(_0x6a12b8,_0x5625f7){return db[_0xb8dd('0x30')]['describe']()['then'](respondWithResult(_0x5625f7,null))[_0xb8dd('0x49')](handleError(_0x5625f7,null));};exports['getMembers']=function(_0x392ee8,_0x1a7d72,_0x2420f8){var _0x1220ef={'raw':!![],'where':{}},_0x37eb41={},_0x8290db;return db[_0xb8dd('0x30')][_0xb8dd('0x56')]({'where':{'id':_0x392ee8['params']['id']}})[_0xb8dd('0x28')](handleEntityNotFound(_0x1a7d72,null))[_0xb8dd('0x28')](function(_0x34991c){if(_0x34991c){_0x8290db=_0x34991c[_0xb8dd('0x29')]({'plain':!![]});_0x37eb41[_0xb8dd('0x34')]=_[_0xb8dd('0x36')](db[_0xb8dd('0x57')][_0xb8dd('0x31')]);_0x37eb41[_0xb8dd('0x35')]=_['keys'](_0x392ee8['query']);_0x37eb41[_0xb8dd('0x37')]=_[_0xb8dd('0x38')](_0x37eb41[_0xb8dd('0x34')],_0x37eb41[_0xb8dd('0x35')]);_0x1220ef['attributes']=_[_0xb8dd('0x38')](_0x37eb41[_0xb8dd('0x34')],qs[_0xb8dd('0x39')](_0x392ee8[_0xb8dd('0x35')][_0xb8dd('0x39')]));_0x1220ef[_0xb8dd('0x3a')]=_0x1220ef[_0xb8dd('0x3a')][_0xb8dd('0x3b')]?_0x1220ef[_0xb8dd('0x3a')]:_0x37eb41[_0xb8dd('0x34')];if(!_0x392ee8['query']['hasOwnProperty'](_0xb8dd('0x58'))){_0x1220ef['limit']=qs[_0xb8dd('0x1e')](_0x392ee8[_0xb8dd('0x35')]['limit']);_0x1220ef[_0xb8dd('0x20')]=qs['offset'](_0x392ee8[_0xb8dd('0x35')]['offset']);}_0x1220ef[_0xb8dd('0x3d')]=qs[_0xb8dd('0x3e')](_0x392ee8[_0xb8dd('0x35')]['sort']);_0x1220ef[_0xb8dd('0x3f')]=qs[_0xb8dd('0x37')](_[_0xb8dd('0x40')](_0x392ee8[_0xb8dd('0x35')],_0x37eb41[_0xb8dd('0x37')]));_0x1220ef[_0xb8dd('0x3f')][_0xb8dd('0x59')]=_0x34991c['id'];if(_0x392ee8[_0xb8dd('0x35')][_0xb8dd('0x41')]){_0x1220ef[_0xb8dd('0x3f')]=_[_0xb8dd('0x42')](_0x1220ef[_0xb8dd('0x3f')],{'$or':_['map'](_0x1220ef['attributes'],function(_0x5eabae){var _0x44bec1={};_0x44bec1[_0x5eabae]={'$like':'%'+_0x392ee8[_0xb8dd('0x35')][_0xb8dd('0x41')]+'%'};return _0x44bec1;})});}_0x1220ef=_[_0xb8dd('0x42')]({},_0x1220ef,_0x392ee8['options']);return db[_0xb8dd('0x57')][_0xb8dd('0x47')](_0x1220ef);}})[_0xb8dd('0x28')](function(_0x150f12){if(_0x150f12){return db[_0xb8dd('0x5a')][_0xb8dd('0x5b')]({'where':{'id':_['map'](_0x150f12,'UserId'),'role':_0xb8dd('0x5c')},'attributes':['id',_0xb8dd('0x2c'),_0xb8dd('0x5d'),_0xb8dd('0x5e'),_0xb8dd('0x5f')]});}})['then'](function(_0xb8ccb2){if(_0xb8ccb2){return{'count':_0xb8ccb2['count'],'rows':_['map'](_0xb8ccb2[_0xb8dd('0x48')],function(_0xb60881){return{'membername':_0xb60881[_0xb8dd('0x2c')],'UserId':_0xb60881['id'],'queue_name':_0x8290db[_0xb8dd('0x2c')],'WhatsappQueueId':_0x8290db['id'],'interface':util[_0xb8dd('0x60')](_0xb8dd('0x61'),_0xb8dd('0x62'),_0xb60881[_0xb8dd('0x2c')]),'penalty':0x0,'paused':_0xb60881[_0xb8dd('0x5d')],'createdAt':_0xb60881[_0xb8dd('0x5f')],'updatedAt':_0xb60881[_0xb8dd('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb8dd('0x28')](respondWithFilteredResult(_0x1a7d72,_0x1220ef))[_0xb8dd('0x49')](handleError(_0x1a7d72,null));};exports[_0xb8dd('0x63')]=function(_0x1e2590,_0x42f27,_0x5b5507){var _0x1d2853={};var _0x4f6e33={};var _0x35bfc9;var _0x4bdf62;return db['WhatsappQueue'][_0xb8dd('0x56')]({'where':{'id':_0x1e2590['params']['id']}})[_0xb8dd('0x28')](handleEntityNotFound(_0x42f27,null))['then'](function(_0x2a49cc){if(_0x2a49cc){_0x35bfc9=_0x2a49cc;_0x4f6e33[_0xb8dd('0x34')]=_[_0xb8dd('0x36')](db[_0xb8dd('0x64')]['rawAttributes']);_0x4f6e33['query']=_['keys'](_0x1e2590[_0xb8dd('0x35')]);_0x4f6e33[_0xb8dd('0x37')]=_[_0xb8dd('0x38')](_0x4f6e33[_0xb8dd('0x34')],_0x4f6e33[_0xb8dd('0x35')]);_0x1d2853[_0xb8dd('0x3a')]=_['intersection'](_0x4f6e33[_0xb8dd('0x34')],qs['fields'](_0x1e2590[_0xb8dd('0x35')][_0xb8dd('0x39')]));_0x1d2853[_0xb8dd('0x3a')]=_0x1d2853[_0xb8dd('0x3a')][_0xb8dd('0x3b')]?_0x1d2853['attributes']:_0x4f6e33[_0xb8dd('0x34')];_0x1d2853['order']=qs[_0xb8dd('0x3e')](_0x1e2590[_0xb8dd('0x35')][_0xb8dd('0x3e')]);_0x1d2853['where']=qs[_0xb8dd('0x37')](_[_0xb8dd('0x40')](_0x1e2590[_0xb8dd('0x35')],_0x4f6e33[_0xb8dd('0x37')]));if(_0x1e2590[_0xb8dd('0x35')][_0xb8dd('0x41')]){_0x1d2853[_0xb8dd('0x3f')]=_[_0xb8dd('0x42')](_0x1d2853['where'],{'$or':_[_0xb8dd('0x2f')](_0x1d2853[_0xb8dd('0x3a')],function(_0x44aa8b){var _0x13feaa={};_0x13feaa[_0x44aa8b]={'$like':'%'+_0x1e2590[_0xb8dd('0x35')][_0xb8dd('0x41')]+'%'};return _0x13feaa;})});}_0x1d2853=_[_0xb8dd('0x42')]({},_0x1d2853,_0x1e2590[_0xb8dd('0x44')]);return _0x35bfc9[_0xb8dd('0x63')](_0x1d2853);}})['then'](function(_0x25d3c3){if(_0x25d3c3){_0x4bdf62=_0x25d3c3['length'];if(!_0x1e2590['query'][_0xb8dd('0x3c')](_0xb8dd('0x58'))){_0x1d2853['limit']=qs[_0xb8dd('0x1e')](_0x1e2590[_0xb8dd('0x35')][_0xb8dd('0x1e')]);_0x1d2853[_0xb8dd('0x20')]=qs[_0xb8dd('0x20')](_0x1e2590[_0xb8dd('0x35')][_0xb8dd('0x20')]);}return _0x35bfc9['getTeams'](_0x1d2853);}})[_0xb8dd('0x28')](function(_0x532a86){if(_0x532a86){return _0x532a86?{'count':_0x4bdf62,'rows':_0x532a86}:null;}})[_0xb8dd('0x28')](respondWithResult(_0x42f27,null))['catch'](handleError(_0x42f27,null));};exports[_0xb8dd('0x65')]=function(_0xaa7fe5,_0x4b5296,_0x4b5eae){var _0x5ab59b=_0xaa7fe5[_0xb8dd('0x53')][_0xb8dd('0x66')];return db[_0xb8dd('0x64')][_0xb8dd('0x47')]({'where':{'id':_0x5ab59b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb8dd('0x67'),'attributes':['id',_0xb8dd('0x2c'),_0xb8dd('0x68'),_0xb8dd('0x69'),'interface'],'raw':!![]}]})[_0xb8dd('0x28')](function(_0x5a336a){if(_0x5a336a){var _0x10497a=_[_0xb8dd('0x6a')](_0x5a336a,function(_0x182bca){var _0x389730=_0x182bca['get']({'plain':!![]});return _0x389730[_0xb8dd('0x67')];});return db['WhatsappQueue'][_0xb8dd('0x4a')]({'where':{'id':_0xaa7fe5[_0xb8dd('0x54')]['id']}})[_0xb8dd('0x28')](function(_0x4a8000){return db[_0xb8dd('0x6b')]['transaction'](function(_0x5555cc){return _0x4a8000[_0xb8dd('0x65')](_0x5ab59b,{'transaction':_0x5555cc})[_0xb8dd('0x28')](function(){return BPromise[_0xb8dd('0x6c')](_0x10497a,function(_0x4ae723){return db['UserWhatsappQueue'][_0xb8dd('0x6d')]({'where':{'UserId':_0x4ae723['id'],'WhatsappQueueId':_0xaa7fe5[_0xb8dd('0x54')]['id']},'transaction':_0x5555cc});});})[_0xb8dd('0x28')](function(){_0x10497a['forEach'](function(_0x3b1311){socket['emit'](_0xb8dd('0x6e'),{'UserId':_0x3b1311['id'],'WhatsappQueueId':_0x4a8000['id']});});});});});}})[_0xb8dd('0x28')](respondWithStatusCode(_0x4b5296,null))[_0xb8dd('0x49')](handleError(_0x4b5296,null));};exports[_0xb8dd('0x6f')]=function(_0x355c06,_0xb02dce,_0xe5c4c6){return db['Team']['findAll']({'where':{'id':_0x355c06[_0xb8dd('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb8dd('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb8dd('0x28')](handleEntityNotFound(_0xb02dce,null))['then'](function(_0x144bc6){var _0x314a0a=_[_0xb8dd('0x2f')](_0x144bc6,'id');var _0x34c868=[];var _0x14e6e2=[];var _0x1086ad=squel[_0xb8dd('0x70')]();_0x1086ad['field'](_0xb8dd('0x71'))[_0xb8dd('0x72')](_0xb8dd('0x73'),'tq')['join'](_0xb8dd('0x74'),'ut',_0xb8dd('0x75'))['where'](_0xb8dd('0x76'),_0x355c06[_0xb8dd('0x54')]['id']);for(var _0x2cbeee=0x0;_0x2cbeee<_0x144bc6[_0xb8dd('0x3b')];_0x2cbeee+=0x1){let _0x280909=_0x144bc6[_0x2cbeee];for(var _0x233137=0x0;_0x233137<_0x280909[_0xb8dd('0x67')][_0xb8dd('0x3b')];_0x233137+=0x1){let _0x5b44fa=_0x280909[_0xb8dd('0x67')][_0x233137];var _0x44b5ab=_0x1086ad[_0xb8dd('0x77')]();_0x44b5ab[_0xb8dd('0x3f')](_0xb8dd('0x78'),_0x5b44fa['id']);_0x14e6e2[_0xb8dd('0x79')](db[_0xb8dd('0x6b')][_0xb8dd('0x35')](_0x44b5ab[_0xb8dd('0x7a')](),{'type':db['sequelize'][_0xb8dd('0x7b')][_0xb8dd('0x7c')]})['then'](function(_0x65bcaa){if(_0x65bcaa[_0xb8dd('0x3b')]===0x1){return _0x5b44fa['id'];}else{var _0x5e0e35=_[_0xb8dd('0x7d')](_[_0xb8dd('0x2f')](_0x65bcaa,_0xb8dd('0x7e')),function(_0x3d202f){return _[_0xb8dd('0x7f')](_0x314a0a,_0x3d202f);});if(_0x5e0e35){return _0x5b44fa['id'];}}}));}}return BPromise[_0xb8dd('0x80')](_0x14e6e2)[_0xb8dd('0x28')](function(_0x3cccc6){_0x34c868=_(_0x34c868)['union'](_0x3cccc6)['compact']()[_0xb8dd('0x81')]();return db['WhatsappQueue'][_0xb8dd('0x4a')]({'where':{'id':_0x355c06['params']['id']}})[_0xb8dd('0x28')](function(_0x663024){return db[_0xb8dd('0x6b')][_0xb8dd('0x82')](function(_0x299a64){return _0x663024[_0xb8dd('0x6f')](_0x355c06[_0xb8dd('0x35')][_0xb8dd('0x66')],{'transaction':_0x299a64})['then'](function(){if(!_[_0xb8dd('0x83')](_0x34c868)){return _0x663024[_0xb8dd('0x84')](_0x34c868,{'transaction':_0x299a64});}})[_0xb8dd('0x28')](function(){_0x34c868[_0xb8dd('0x85')](function(_0x330a02){socket[_0xb8dd('0x86')]('userWhatsappQueue:remove',{'UserId':_0x330a02,'WhatsappQueueId':_0x663024['id']});});});});});});})['then'](respondWithStatusCode(_0xb02dce,null))[_0xb8dd('0x49')](handleError(_0xb02dce,null));};exports[_0xb8dd('0x87')]=function(_0xe0d788,_0x1bfadb,_0x4387d8){return db[_0xb8dd('0x30')][_0xb8dd('0x4a')]({'where':{'id':_0xe0d788[_0xb8dd('0x54')]['id']}})[_0xb8dd('0x28')](handleEntityNotFound(_0x1bfadb,null))[_0xb8dd('0x28')](function(_0x372534){if(_0x372534){return _0x372534['addAgents'](_0xe0d788['body']['ids'],_[_0xb8dd('0x88')](_0xe0d788['body'],[_0xb8dd('0x66'),'id'])||{})[_0xb8dd('0x89')](function(_0x452365){for(var _0x3183b1=0x0;_0x3183b1<_0xe0d788['body']['ids'][_0xb8dd('0x3b')];_0x3183b1+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0xe0d788['body'][_0xb8dd('0x66')][_0x3183b1]),'WhatsappQueueId':Number(_0xe0d788[_0xb8dd('0x54')]['id'])});}return _0x452365;});}})['then'](respondWithResult(_0x1bfadb,null))['catch'](handleError(_0x1bfadb,null));};exports[_0xb8dd('0x84')]=function(_0x890d67,_0x5bbdb9,_0xcb04d4){return db['WhatsappQueue'][_0xb8dd('0x4a')]({'where':{'id':_0x890d67[_0xb8dd('0x54')]['id']}})[_0xb8dd('0x28')](handleEntityNotFound(_0x5bbdb9,null))[_0xb8dd('0x28')](function(_0x1ae234){if(_0x1ae234){return _0x1ae234[_0xb8dd('0x84')](_0x890d67[_0xb8dd('0x35')][_0xb8dd('0x66')])[_0xb8dd('0x28')](function(){if(_['isArray'](_0x890d67[_0xb8dd('0x35')]['ids'])){for(var _0x11a6e3=0x0;_0x11a6e3<_0x890d67['query'][_0xb8dd('0x66')][_0xb8dd('0x3b')];_0x11a6e3+=0x1){socket['emit'](_0xb8dd('0x8a'),{'UserId':Number(_0x890d67[_0xb8dd('0x35')][_0xb8dd('0x66')][_0x11a6e3]),'WhatsappQueueId':Number(_0x890d67[_0xb8dd('0x54')]['id'])});}}else{socket['emit'](_0xb8dd('0x8a'),{'UserId':Number(_0x890d67[_0xb8dd('0x35')][_0xb8dd('0x66')]),'WhatsappQueueId':Number(_0x890d67[_0xb8dd('0x54')]['id'])});}});}})[_0xb8dd('0x28')](respondWithStatusCode(_0x5bbdb9,null))[_0xb8dd('0x49')](handleError(_0x5bbdb9,null));};exports[_0xb8dd('0x8b')]=function(_0x3253de,_0x3fd398,_0x4d47dc){var _0x2cfcda={};var _0x4cf783={};var _0x2ccb5d;var _0x297d41;return db[_0xb8dd('0x30')][_0xb8dd('0x56')]({'where':{'id':_0x3253de['params']['id']}})[_0xb8dd('0x28')](handleEntityNotFound(_0x3fd398,null))['then'](function(_0x497093){if(_0x497093){_0x2ccb5d=_0x497093;_0x4cf783[_0xb8dd('0x34')]=_[_0xb8dd('0x36')](db['User']['rawAttributes']);_0x4cf783[_0xb8dd('0x35')]=_['keys'](_0x3253de['query']);_0x4cf783['filters']=_[_0xb8dd('0x38')](_0x4cf783['model'],_0x4cf783[_0xb8dd('0x35')]);_0x2cfcda[_0xb8dd('0x3a')]=_['intersection'](_0x4cf783[_0xb8dd('0x34')],qs[_0xb8dd('0x39')](_0x3253de[_0xb8dd('0x35')][_0xb8dd('0x39')]));_0x2cfcda[_0xb8dd('0x3a')]=_0x2cfcda[_0xb8dd('0x3a')][_0xb8dd('0x3b')]?_0x2cfcda['attributes']:_0x4cf783[_0xb8dd('0x34')];_0x2cfcda[_0xb8dd('0x3d')]=qs[_0xb8dd('0x3e')](_0x3253de[_0xb8dd('0x35')]['sort']);_0x2cfcda[_0xb8dd('0x3f')]=qs[_0xb8dd('0x37')](_['pick'](_0x3253de[_0xb8dd('0x35')],_0x4cf783['filters']));if(_0x3253de[_0xb8dd('0x35')][_0xb8dd('0x41')]){_0x2cfcda[_0xb8dd('0x3f')]=_['merge'](_0x2cfcda[_0xb8dd('0x3f')],{'$or':_['map'](_0x2cfcda['attributes'],function(_0x33d2cb){var _0x41afa9={};_0x41afa9[_0x33d2cb]={'$like':'%'+_0x3253de['query'][_0xb8dd('0x41')]+'%'};return _0x41afa9;})});}_0x2cfcda=_[_0xb8dd('0x42')]({},_0x2cfcda,_0x3253de[_0xb8dd('0x44')]);return _0x2ccb5d[_0xb8dd('0x8b')](_0x2cfcda);}})[_0xb8dd('0x28')](function(_0x2f6c04){if(_0x2f6c04){_0x297d41=_0x2f6c04['length'];if(!_0x3253de[_0xb8dd('0x35')][_0xb8dd('0x3c')](_0xb8dd('0x58'))){_0x2cfcda[_0xb8dd('0x1e')]=qs[_0xb8dd('0x1e')](_0x3253de[_0xb8dd('0x35')][_0xb8dd('0x1e')]);_0x2cfcda[_0xb8dd('0x20')]=qs['offset'](_0x3253de['query']['offset']);}return _0x2ccb5d[_0xb8dd('0x8b')](_0x2cfcda);}})[_0xb8dd('0x28')](function(_0x5a1430){if(_0x5a1430){return _0x5a1430?{'count':_0x297d41,'rows':_0x5a1430}:null;}})[_0xb8dd('0x28')](respondWithResult(_0x3fd398,null))[_0xb8dd('0x49')](handleError(_0x3fd398,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b50d8f9..4a7e6b8 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 _0xcf4b=['exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x245f27,_0x3a26c4){var _0x2ff996=function(_0x36f8fb){while(--_0x36f8fb){_0x245f27['push'](_0x245f27['shift']());}};_0x2ff996(++_0x3a26c4);}(_0xcf4b,0x1a5));var _0xbcf4=function(_0x3459cf,_0x3481f8){_0x3459cf=_0x3459cf-0x0;var _0xaf695b=_0xcf4b[_0x3459cf];return _0xaf695b;};'use strict';var EventEmitter=require(_0xbcf4('0x0'));var WhatsappQueue=require(_0xbcf4('0x1'))['db'][_0xbcf4('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xbcf4('0x3')](0x0);var events={'afterCreate':_0xbcf4('0x4'),'afterUpdate':_0xbcf4('0x5'),'afterDestroy':_0xbcf4('0x6')};function emitEvent(_0x517f70){return function(_0x5dd697,_0x20d697,_0x57ba65){WhatsappQueueEvents['emit'](_0x517f70+':'+_0x5dd697['id'],_0x5dd697);WhatsappQueueEvents[_0xbcf4('0x7')](_0x517f70,_0x5dd697);_0x57ba65(null);};}for(var e in events){if(events[_0xbcf4('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xbcf4('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb66b=['setMaxListeners','save','remove','emit','hook','events','WhatsappQueue'];(function(_0xb7fe1a,_0x3aa228){var _0x31a9ab=function(_0x22e978){while(--_0x22e978){_0xb7fe1a['push'](_0xb7fe1a['shift']());}};_0x31a9ab(++_0x3aa228);}(_0xb66b,0x19b));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xbb66('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xbb66('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xbb66('0x2')](0x0);var events={'afterCreate':_0xbb66('0x3'),'afterUpdate':'update','afterDestroy':_0xbb66('0x4')};function emitEvent(_0x5b2c8c){return function(_0xf3a3b1,_0x832da1,_0x10c1f9){WhatsappQueueEvents[_0xbb66('0x5')](_0x5b2c8c+':'+_0xf3a3b1['id'],_0xf3a3b1);WhatsappQueueEvents[_0xbb66('0x5')](_0x5b2c8c,_0xf3a3b1);_0x10c1f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xbb66('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8f47818..3391d63 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 _0x90ea=['exports','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueue.attributes'];(function(_0x3fad5a,_0x2d3b02){var _0x4ca713=function(_0x2abe58){while(--_0x2abe58){_0x3fad5a['push'](_0x3fad5a['shift']());}};_0x4ca713(++_0x2d3b02);}(_0x90ea,0x7c));var _0xa90e=function(_0x5de5e7,_0x194091){_0x5de5e7=_0x5de5e7-0x0;var _0x3afaec=_0x90ea[_0x5de5e7];return _0x3afaec;};'use strict';var _=require(_0xa90e('0x0'));var util=require('util');var logger=require(_0xa90e('0x1'))(_0xa90e('0x2'));var moment=require(_0xa90e('0x3'));var BPromise=require(_0xa90e('0x4'));var rp=require(_0xa90e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa90e('0x6'));var config=require('../../config/environment');var attributes=require(_0xa90e('0x7'));module[_0xa90e('0x8')]=function(_0x37faa5,_0x45331e){return _0x37faa5['define'](_0xa90e('0x9'),attributes,{'tableName':_0xa90e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbda6=['bluebird','request-promise','../../config/environment','exports','define','whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x254cb2,_0x122da0){var _0x1b6247=function(_0xa4791){while(--_0xa4791){_0x254cb2['push'](_0x254cb2['shift']());}};_0x1b6247(++_0x122da0);}(_0xbda6,0x17c));var _0x6bda=function(_0x4f0b55,_0x5419a9){_0x4f0b55=_0x4f0b55-0x0;var _0x18c327=_0xbda6[_0x4f0b55];return _0x18c327;};'use strict';var _=require(_0x6bda('0x0'));var util=require(_0x6bda('0x1'));var logger=require(_0x6bda('0x2'))(_0x6bda('0x3'));var moment=require(_0x6bda('0x4'));var BPromise=require(_0x6bda('0x5'));var rp=require(_0x6bda('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6bda('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x6bda('0x8')]=function(_0x127df0,_0x27cf83){return _0x127df0[_0x6bda('0x9')]('WhatsappQueue',attributes,{'tableName':_0x6bda('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 1801577..79b5dbb 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 _0x38eb=['info','ShowWhatsappQueue','find','where','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','include','map','model','then'];(function(_0xed8b9d,_0x2234f9){var _0x2b9669=function(_0x180090){while(--_0x180090){_0xed8b9d['push'](_0xed8b9d['shift']());}};_0x2b9669(++_0x2234f9);}(_0x38eb,0x1d8));var _0xb38e=function(_0x47f9d1,_0x53116b){_0x47f9d1=_0x47f9d1-0x0;var _0x32de01=_0x38eb[_0x47f9d1];return _0x32de01;};'use strict';var _=require(_0xb38e('0x0'));var util=require(_0xb38e('0x1'));var moment=require(_0xb38e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb38e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb38e('0x4'));var logger=require(_0xb38e('0x5'))(_0xb38e('0x6'));var config=require(_0xb38e('0x7'));var jayson=require(_0xb38e('0x8'));var client=jayson[_0xb38e('0x9')]['http']({'port':0x232a});config[_0xb38e('0xa')]=_[_0xb38e('0xb')](config[_0xb38e('0xa')],{'host':_0xb38e('0xc'),'port':0x18eb});var socket=require(_0xb38e('0xd'))(new Redis(config[_0xb38e('0xa')]));require('./whatsappQueue.socket')[_0xb38e('0xe')](socket);function respondWithRpcPromise(_0x6687f3,_0x314e1c,_0x1a4bde){return new BPromise(function(_0x1d7540,_0x33067b){return client[_0xb38e('0xf')](_0x6687f3,_0x1a4bde)['then'](function(_0x51d98f){logger['info'](_0xb38e('0x10'),_0x314e1c,'request\x20sent');logger[_0xb38e('0x11')](_0xb38e('0x12'),_0x314e1c,_0xb38e('0x13'),JSON[_0xb38e('0x14')](_0x51d98f));if(_0x51d98f[_0xb38e('0x15')]){if(_0x51d98f['error'][_0xb38e('0x16')]===0x1f4){logger['error'](_0xb38e('0x10'),_0x314e1c,_0x51d98f[_0xb38e('0x15')][_0xb38e('0x17')]);return _0x33067b(_0x51d98f[_0xb38e('0x15')][_0xb38e('0x17')]);}logger[_0xb38e('0x15')](_0xb38e('0x10'),_0x314e1c,_0x51d98f[_0xb38e('0x15')][_0xb38e('0x17')]);return _0x1d7540(_0x51d98f[_0xb38e('0x15')][_0xb38e('0x17')]);}else{logger['info'](_0xb38e('0x10'),_0x314e1c,_0xb38e('0x13'));_0x1d7540(_0x51d98f['result'][_0xb38e('0x17')]);}})[_0xb38e('0x18')](function(_0x22944c){logger[_0xb38e('0x15')](_0xb38e('0x10'),_0x314e1c,_0x22944c);_0x33067b(_0x22944c);});});}exports[_0xb38e('0x19')]=function(_0x1ea773){var _0x2676ea=this;return new Promise(function(_0x4cc4a7,_0x579fbe){return db[_0xb38e('0x1a')][_0xb38e('0x1b')]({'raw':_0x1ea773[_0xb38e('0x1c')]?_0x1ea773[_0xb38e('0x1c')][_0xb38e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ea773[_0xb38e('0x1c')]?_0x1ea773[_0xb38e('0x1c')]['where']||null:null,'attributes':_0x1ea773[_0xb38e('0x1c')]?_0x1ea773[_0xb38e('0x1c')][_0xb38e('0x1e')]||null:null,'limit':_0x1ea773['options']?_0x1ea773[_0xb38e('0x1c')]['limit']||null:null,'include':_0x1ea773[_0xb38e('0x1c')]?_0x1ea773[_0xb38e('0x1c')][_0xb38e('0x1f')]?_[_0xb38e('0x20')](_0x1ea773['options'][_0xb38e('0x1f')],function(_0x1bba0a){return{'model':db[_0x1bba0a['model']],'as':_0x1bba0a['as'],'attributes':_0x1bba0a[_0xb38e('0x1e')],'include':_0x1bba0a[_0xb38e('0x1f')]?_[_0xb38e('0x20')](_0x1bba0a['include'],function(_0x375da4){return{'model':db[_0x375da4[_0xb38e('0x21')]],'as':_0x375da4['as'],'attributes':_0x375da4[_0xb38e('0x1e')],'include':_0x375da4['include']?_['map'](_0x375da4[_0xb38e('0x1f')],function(_0x1d3817){return{'model':db[_0x1d3817[_0xb38e('0x21')]],'as':_0x1d3817['as'],'attributes':_0x1d3817[_0xb38e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb38e('0x22')](function(_0x563c29){logger[_0xb38e('0x23')]('GetWhatsappQueue',_0x1ea773);logger[_0xb38e('0x11')](_0xb38e('0x19'),_0x1ea773,JSON['stringify'](_0x563c29));_0x4cc4a7(_0x563c29);})[_0xb38e('0x18')](function(_0x13e410){logger[_0xb38e('0x15')]('GetWhatsappQueue',_0x13e410['message'],_0x1ea773);_0x579fbe(_0x2676ea[_0xb38e('0x15')](0x1f4,_0x13e410['message']));});});};exports[_0xb38e('0x24')]=function(_0x59f68d){var _0x366805=this;return new Promise(function(_0xf57ced,_0x4e54e5){return db['WhatsappQueue'][_0xb38e('0x25')]({'raw':_0x59f68d[_0xb38e('0x1c')]?_0x59f68d[_0xb38e('0x1c')][_0xb38e('0x1d')]===undefined?!![]:![]:!![],'where':_0x59f68d[_0xb38e('0x1c')]?_0x59f68d[_0xb38e('0x1c')][_0xb38e('0x26')]||null:null,'attributes':_0x59f68d[_0xb38e('0x1c')]?_0x59f68d[_0xb38e('0x1c')][_0xb38e('0x1e')]||null:null,'include':_0x59f68d[_0xb38e('0x1c')]?_0x59f68d[_0xb38e('0x1c')][_0xb38e('0x1f')]?_[_0xb38e('0x20')](_0x59f68d['options'][_0xb38e('0x1f')],function(_0x15333e){return{'model':db[_0x15333e[_0xb38e('0x21')]],'as':_0x15333e['as'],'attributes':_0x15333e[_0xb38e('0x1e')],'include':_0x15333e[_0xb38e('0x1f')]?_['map'](_0x15333e[_0xb38e('0x1f')],function(_0x55e88c){return{'model':db[_0x55e88c[_0xb38e('0x21')]],'as':_0x55e88c['as'],'attributes':_0x55e88c[_0xb38e('0x1e')],'include':_0x55e88c[_0xb38e('0x1f')]?_[_0xb38e('0x20')](_0x55e88c[_0xb38e('0x1f')],function(_0x2b0bb4){return{'model':db[_0x2b0bb4['model']],'as':_0x2b0bb4['as'],'attributes':_0x2b0bb4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb38e('0x22')](function(_0x47959a){logger[_0xb38e('0x23')](_0xb38e('0x24'),_0x59f68d);logger[_0xb38e('0x11')](_0xb38e('0x24'),_0x59f68d,JSON[_0xb38e('0x14')](_0x47959a));_0xf57ced(_0x47959a);})['catch'](function(_0x12929e){logger['error'](_0xb38e('0x24'),_0x12929e['message'],_0x59f68d);_0x4e54e5(_0x366805[_0xb38e('0x15')](0x1f4,_0x12929e['message']));});});}; \ No newline at end of file +var _0x1e99=['findAll','options','raw','where','attributes','limit','map','include','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x286595,_0x29f350){var _0x3ea6b8=function(_0x157dc3){while(--_0x157dc3){_0x286595['push'](_0x286595['shift']());}};_0x3ea6b8(++_0x29f350);}(_0x1e99,0x1cf));var _0x91e9=function(_0x3886f8,_0x33d58){_0x3886f8=_0x3886f8-0x0;var _0x17a063=_0x1e99[_0x3886f8];return _0x17a063;};'use strict';var _=require(_0x91e9('0x0'));var util=require(_0x91e9('0x1'));var moment=require(_0x91e9('0x2'));var BPromise=require(_0x91e9('0x3'));var rs=require(_0x91e9('0x4'));var fs=require('fs');var Redis=require(_0x91e9('0x5'));var db=require(_0x91e9('0x6'))['db'];var utils=require(_0x91e9('0x7'));var logger=require(_0x91e9('0x8'))(_0x91e9('0x9'));var config=require(_0x91e9('0xa'));var jayson=require(_0x91e9('0xb'));var client=jayson[_0x91e9('0xc')][_0x91e9('0xd')]({'port':0x232a});config[_0x91e9('0xe')]=_[_0x91e9('0xf')](config[_0x91e9('0xe')],{'host':_0x91e9('0x10'),'port':0x18eb});var socket=require(_0x91e9('0x11'))(new Redis(config[_0x91e9('0xe')]));require(_0x91e9('0x12'))[_0x91e9('0x13')](socket);function respondWithRpcPromise(_0x52f804,_0x53f023,_0x389bee){return new BPromise(function(_0x2e5706,_0x13843e){return client[_0x91e9('0x14')](_0x52f804,_0x389bee)[_0x91e9('0x15')](function(_0x2c60bd){logger[_0x91e9('0x16')](_0x91e9('0x17'),_0x53f023,_0x91e9('0x18'));logger[_0x91e9('0x19')](_0x91e9('0x1a'),_0x53f023,'request\x20sent',JSON['stringify'](_0x2c60bd));if(_0x2c60bd[_0x91e9('0x1b')]){if(_0x2c60bd['error'][_0x91e9('0x1c')]===0x1f4){logger['error'](_0x91e9('0x17'),_0x53f023,_0x2c60bd[_0x91e9('0x1b')]['message']);return _0x13843e(_0x2c60bd[_0x91e9('0x1b')]['message']);}logger[_0x91e9('0x1b')](_0x91e9('0x17'),_0x53f023,_0x2c60bd[_0x91e9('0x1b')][_0x91e9('0x1d')]);return _0x2e5706(_0x2c60bd[_0x91e9('0x1b')][_0x91e9('0x1d')]);}else{logger[_0x91e9('0x16')](_0x91e9('0x17'),_0x53f023,_0x91e9('0x18'));_0x2e5706(_0x2c60bd[_0x91e9('0x1e')][_0x91e9('0x1d')]);}})[_0x91e9('0x1f')](function(_0x3549ef){logger[_0x91e9('0x1b')]('WhatsappQueue,\x20%s,\x20%s',_0x53f023,_0x3549ef);_0x13843e(_0x3549ef);});});}exports['GetWhatsappQueue']=function(_0x90654c){var _0xfda18f=this;return new Promise(function(_0x51c3a6,_0x369d9a){return db['WhatsappQueue'][_0x91e9('0x20')]({'raw':_0x90654c[_0x91e9('0x21')]?_0x90654c[_0x91e9('0x21')][_0x91e9('0x22')]===undefined?!![]:![]:!![],'where':_0x90654c[_0x91e9('0x21')]?_0x90654c[_0x91e9('0x21')][_0x91e9('0x23')]||null:null,'attributes':_0x90654c[_0x91e9('0x21')]?_0x90654c[_0x91e9('0x21')][_0x91e9('0x24')]||null:null,'limit':_0x90654c[_0x91e9('0x21')]?_0x90654c['options'][_0x91e9('0x25')]||null:null,'include':_0x90654c['options']?_0x90654c[_0x91e9('0x21')]['include']?_[_0x91e9('0x26')](_0x90654c[_0x91e9('0x21')][_0x91e9('0x27')],function(_0x33d0a8){return{'model':db[_0x33d0a8[_0x91e9('0x28')]],'as':_0x33d0a8['as'],'attributes':_0x33d0a8[_0x91e9('0x24')],'include':_0x33d0a8[_0x91e9('0x27')]?_[_0x91e9('0x26')](_0x33d0a8[_0x91e9('0x27')],function(_0x66f6b1){return{'model':db[_0x66f6b1['model']],'as':_0x66f6b1['as'],'attributes':_0x66f6b1['attributes'],'include':_0x66f6b1[_0x91e9('0x27')]?_[_0x91e9('0x26')](_0x66f6b1[_0x91e9('0x27')],function(_0x42fee5){return{'model':db[_0x42fee5[_0x91e9('0x28')]],'as':_0x42fee5['as'],'attributes':_0x42fee5[_0x91e9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x91e9('0x15')](function(_0x4c2374){logger[_0x91e9('0x16')](_0x91e9('0x29'),_0x90654c);logger['debug'](_0x91e9('0x29'),_0x90654c,JSON[_0x91e9('0x2a')](_0x4c2374));_0x51c3a6(_0x4c2374);})['catch'](function(_0x29076a){logger[_0x91e9('0x1b')](_0x91e9('0x29'),_0x29076a[_0x91e9('0x1d')],_0x90654c);_0x369d9a(_0xfda18f[_0x91e9('0x1b')](0x1f4,_0x29076a['message']));});});};exports[_0x91e9('0x2b')]=function(_0x479c3a){var _0x466bb4=this;return new Promise(function(_0x36a2ca,_0x13e690){return db['WhatsappQueue'][_0x91e9('0x2c')]({'raw':_0x479c3a['options']?_0x479c3a['options'][_0x91e9('0x22')]===undefined?!![]:![]:!![],'where':_0x479c3a[_0x91e9('0x21')]?_0x479c3a[_0x91e9('0x21')][_0x91e9('0x23')]||null:null,'attributes':_0x479c3a[_0x91e9('0x21')]?_0x479c3a[_0x91e9('0x21')][_0x91e9('0x24')]||null:null,'include':_0x479c3a[_0x91e9('0x21')]?_0x479c3a[_0x91e9('0x21')][_0x91e9('0x27')]?_[_0x91e9('0x26')](_0x479c3a[_0x91e9('0x21')][_0x91e9('0x27')],function(_0x4d83cb){return{'model':db[_0x4d83cb[_0x91e9('0x28')]],'as':_0x4d83cb['as'],'attributes':_0x4d83cb[_0x91e9('0x24')],'include':_0x4d83cb['include']?_['map'](_0x4d83cb[_0x91e9('0x27')],function(_0x298b86){return{'model':db[_0x298b86['model']],'as':_0x298b86['as'],'attributes':_0x298b86[_0x91e9('0x24')],'include':_0x298b86[_0x91e9('0x27')]?_[_0x91e9('0x26')](_0x298b86[_0x91e9('0x27')],function(_0x55a0c7){return{'model':db[_0x55a0c7['model']],'as':_0x55a0c7['as'],'attributes':_0x55a0c7[_0x91e9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x91e9('0x15')](function(_0x3f08a1){logger[_0x91e9('0x16')](_0x91e9('0x2b'),_0x479c3a);logger[_0x91e9('0x19')](_0x91e9('0x2b'),_0x479c3a,JSON['stringify'](_0x3f08a1));_0x36a2ca(_0x3f08a1);})['catch'](function(_0x4d0395){logger['error'](_0x91e9('0x2b'),_0x4d0395[_0x91e9('0x1d')],_0x479c3a);_0x13e690(_0x466bb4[_0x91e9('0x1b')](0x1f4,_0x4d0395[_0x91e9('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d0a6cec..085ee26 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 _0xc609=['update','emit','removeListener','register','length','./whatsappQueue.events','remove'];(function(_0x1ec7b0,_0x2eb52a){var _0x5aff54=function(_0x1af5e6){while(--_0x1af5e6){_0x1ec7b0['push'](_0x1ec7b0['shift']());}};_0x5aff54(++_0x2eb52a);}(_0xc609,0xf3));var _0x9c60=function(_0x19883a,_0x98963a){_0x19883a=_0x19883a-0x0;var _0x529e8a=_0xc609[_0x19883a];return _0x529e8a;};'use strict';var WhatsappQueueEvents=require(_0x9c60('0x0'));var events=['save',_0x9c60('0x1'),_0x9c60('0x2')];function createListener(_0x2d7bb0,_0x208988){return function(_0x2b009d){_0x208988[_0x9c60('0x3')](_0x2d7bb0,_0x2b009d);};}function removeListener(_0x3d05df,_0x59847c){return function(){WhatsappQueueEvents[_0x9c60('0x4')](_0x3d05df,_0x59847c);};}exports[_0x9c60('0x5')]=function(_0x1e985f){for(var _0x1121a1=0x0,_0x41950d=events[_0x9c60('0x6')];_0x1121a1<_0x41950d;_0x1121a1++){var _0x49ddb8=events[_0x1121a1];var _0xc3141=createListener('whatsappQueue:'+_0x49ddb8,_0x1e985f);WhatsappQueueEvents['on'](_0x49ddb8,_0xc3141);}}; \ No newline at end of file +var _0x47c1=['save','remove','update','removeListener','register','whatsappQueue:','./whatsappQueue.events'];(function(_0xad8c7a,_0x207efc){var _0x318f31=function(_0x77f2b4){while(--_0x77f2b4){_0xad8c7a['push'](_0xad8c7a['shift']());}};_0x318f31(++_0x207efc);}(_0x47c1,0x6f));var _0x147c=function(_0x54820c,_0xd5a2f6){_0x54820c=_0x54820c-0x0;var _0x5c60c1=_0x47c1[_0x54820c];return _0x5c60c1;};'use strict';var WhatsappQueueEvents=require(_0x147c('0x0'));var events=[_0x147c('0x1'),_0x147c('0x2'),_0x147c('0x3')];function createListener(_0x259adf,_0x5176ec){return function(_0x3ca2b1){_0x5176ec['emit'](_0x259adf,_0x3ca2b1);};}function removeListener(_0x712725,_0x4b7e01){return function(){WhatsappQueueEvents[_0x147c('0x4')](_0x712725,_0x4b7e01);};}exports[_0x147c('0x5')]=function(_0x48aa95){for(var _0x451a90=0x0,_0x22c810=events['length'];_0x451a90<_0x22c810;_0x451a90++){var _0x5a655b=events[_0x451a90];var _0x5749c5=createListener(_0x147c('0x6')+_0x5a655b,_0x48aa95);WhatsappQueueEvents['on'](_0x5a655b,_0x5749c5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d6fab30..6072d46 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 _0x3e73=['isAuthenticated','describe','/:id','show','post','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0x3e73,0x148));var _0x33e7=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x3e73[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0x33e7('0x0'));var util=require(_0x33e7('0x1'));var path=require('path');var timeout=require(_0x33e7('0x2'));var express=require(_0x33e7('0x3'));var router=express[_0x33e7('0x4')]();var fs_extra=require(_0x33e7('0x5'));var auth=require(_0x33e7('0x6'));var interaction=require(_0x33e7('0x7'));var config=require(_0x33e7('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x33e7('0x9')]('/',auth['isAuthenticated'](),controller[_0x33e7('0xa')]);router[_0x33e7('0x9')](_0x33e7('0xb'),auth[_0x33e7('0xc')](),controller[_0x33e7('0xd')]);router[_0x33e7('0x9')](_0x33e7('0xe'),auth[_0x33e7('0xc')](),controller[_0x33e7('0xf')]);router[_0x33e7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x33e7('0x11')]('/:id',auth[_0x33e7('0xc')](),controller[_0x33e7('0x12')]);router[_0x33e7('0x13')](_0x33e7('0xe'),auth[_0x33e7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6bb0=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bb0,0x10c));var _0x06bb=function(_0x4b4865,_0xb43449){_0x4b4865=_0x4b4865-0x0;var _0x190dc2=_0x6bb0[_0x4b4865];return _0x190dc2;};'use strict';var multer=require(_0x06bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x06bb('0x1'));var express=require(_0x06bb('0x2'));var router=express[_0x06bb('0x3')]();var fs_extra=require(_0x06bb('0x4'));var auth=require(_0x06bb('0x5'));var interaction=require(_0x06bb('0x6'));var config=require(_0x06bb('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x06bb('0x8')](),controller[_0x06bb('0x9')]);router[_0x06bb('0xa')](_0x06bb('0xb'),auth[_0x06bb('0x8')](),controller['describe']);router[_0x06bb('0xa')]('/:id',auth[_0x06bb('0x8')](),controller[_0x06bb('0xc')]);router[_0x06bb('0xd')]('/',auth['isAuthenticated'](),controller[_0x06bb('0xe')]);router[_0x06bb('0xf')](_0x06bb('0x10'),auth['isAuthenticated'](),controller[_0x06bb('0x11')]);router[_0x06bb('0x12')](_0x06bb('0x10'),auth[_0x06bb('0x8')](),controller[_0x06bb('0x13')]);module[_0x06bb('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e51b2c8..ecd98cf 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(_0x2971cc,_0x3efe43){var _0x597881=function(_0x3ca641){while(--_0x3ca641){_0x2971cc['push'](_0x2971cc['shift']());}};_0x597881(++_0x3efe43);}(_0x7a54,0x106));var _0x47a5=function(_0x37bc09,_0x10f227){_0x37bc09=_0x37bc09-0x0;var _0x31bb47=_0x7a54[_0x37bc09];return _0x31bb47;};'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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x35eb42,_0x1d6338){var _0x5e1a77=function(_0x2e0a67){while(--_0x2e0a67){_0x35eb42['push'](_0x35eb42['shift']());}};_0x5e1a77(++_0x1d6338);}(_0x7a54,0x106));var _0x47a5=function(_0x2f4864,_0x197562){_0x2f4864=_0x2f4864-0x0;var _0x2d85de=_0x7a54[_0x2f4864];return _0x2d85de;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 070819e..3f9b9cc 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 _0xeffd=['model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeffd,0x6b));var _0xdeff=function(_0x3f9f30,_0x3b8525){_0x3f9f30=_0x3f9f30-0x0;var _0x4850cd=_0xeffd[_0x3f9f30];return _0x4850cd;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461699,_0x116bf9){_0x116bf9=_0x116bf9||0xcc;return function(_0x4952f2){if(_0x4952f2){return _0x461699[_0xdeff('0x1d')](_0x116bf9);}return _0x461699['status'](_0x116bf9)['end']();};}function respondWithResult(_0x3e56a1,_0x47410f){_0x47410f=_0x47410f||0xc8;return function(_0x1585e8){if(_0x1585e8){return _0x3e56a1[_0xdeff('0x1e')](_0x47410f)['json'](_0x1585e8);}};}function respondWithFilteredResult(_0x826132,_0x314ded){return function(_0xea6c4){if(_0xea6c4){var _0x391633=typeof _0x314ded[_0xdeff('0x1f')]===_0xdeff('0x20')&&typeof _0x314ded['limit']==='undefined';var _0x7440af=_0xea6c4['count'];var _0x5c9837=_0x391633?0x0:_0x314ded[_0xdeff('0x1f')];var _0x369e13=_0x391633?_0xea6c4['count']:_0x314ded[_0xdeff('0x1f')]+_0x314ded[_0xdeff('0x21')];var _0x1ab1fa;if(_0x369e13>=_0x7440af){_0x369e13=_0x7440af;_0x1ab1fa=0xc8;}else{_0x1ab1fa=0xce;}_0x826132[_0xdeff('0x1e')](_0x1ab1fa);return _0x826132[_0xdeff('0x22')](_0xdeff('0x23'),_0x5c9837+'-'+_0x369e13+'/'+_0x7440af)[_0xdeff('0x24')](_0xea6c4);}return null;};}function patchUpdates(_0x919c93){return function(_0x488faa){try{jsonpatch['apply'](_0x488faa,_0x919c93,!![]);}catch(_0x56cb84){return BPromise[_0xdeff('0x25')](_0x56cb84);}return _0x488faa['save']();};}function saveUpdates(_0x189627,_0x91c0b4){return function(_0x543653){if(_0x543653){return _0x543653[_0xdeff('0x26')](_0x189627)[_0xdeff('0x27')](function(_0x4eb2a8){return _0x4eb2a8;});}return null;};}function removeEntity(_0x5dbe96,_0x3b2554){return function(_0x15c425){if(_0x15c425){return _0x15c425[_0xdeff('0x28')]()[_0xdeff('0x27')](function(){_0x5dbe96[_0xdeff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb08f19,_0x412db3){return function(_0x3741fb){if(!_0x3741fb){_0xb08f19[_0xdeff('0x1d')](0x194);}return _0x3741fb;};}function handleError(_0x16974b,_0x35823c){_0x35823c=_0x35823c||0x1f4;return function(_0x3d0111){logger['error'](_0x3d0111[_0xdeff('0x29')]);if(_0x3d0111[_0xdeff('0x2a')]){delete _0x3d0111['name'];}_0x16974b['status'](_0x35823c)[_0xdeff('0x2b')](_0x3d0111);};}exports[_0xdeff('0x2c')]=function(_0x16b2d0,_0xcb819c){var _0x533069={},_0xf9b278={},_0xbc75ee={'count':0x0,'rows':[]};var _0x4e0ff2=_[_0xdeff('0x2d')](db[_0xdeff('0x2e')][_0xdeff('0x2f')],function(_0x5045b8){return{'name':_0x5045b8['fieldName'],'type':_0x5045b8[_0xdeff('0x30')]['key']};});_0xf9b278[_0xdeff('0x31')]=_[_0xdeff('0x2d')](_0x4e0ff2,_0xdeff('0x2a'));_0xf9b278['query']=_[_0xdeff('0x32')](_0x16b2d0['query']);_0xf9b278['filters']=_[_0xdeff('0x33')](_0xf9b278[_0xdeff('0x31')],_0xf9b278[_0xdeff('0x34')]);_0x533069[_0xdeff('0x35')]=_['intersection'](_0xf9b278[_0xdeff('0x31')],qs[_0xdeff('0x36')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x36')]));_0x533069[_0xdeff('0x35')]=_0x533069[_0xdeff('0x35')][_0xdeff('0x37')]?_0x533069['attributes']:_0xf9b278[_0xdeff('0x31')];if(!_0x16b2d0['query'][_0xdeff('0x38')](_0xdeff('0x39'))){_0x533069[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x21')]);_0x533069['offset']=qs[_0xdeff('0x1f')](_0x16b2d0[_0xdeff('0x34')]['offset']);}_0x533069[_0xdeff('0x3a')]=qs[_0xdeff('0x3b')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x3b')]);_0x533069[_0xdeff('0x3c')]=qs[_0xdeff('0x3d')](_[_0xdeff('0x3e')](_0x16b2d0[_0xdeff('0x34')],_0xf9b278['filters']),_0x4e0ff2);if(_0x16b2d0[_0xdeff('0x34')]['filter']){_0x533069[_0xdeff('0x3c')]=_[_0xdeff('0x3f')](_0x533069[_0xdeff('0x3c')],{'$or':_['map'](_0x4e0ff2,function(_0x443550){if(_0x443550[_0xdeff('0x30')]!==_0xdeff('0x40')){var _0x467ce0={};_0x467ce0[_0x443550[_0xdeff('0x2a')]]={'$like':'%'+_0x16b2d0['query'][_0xdeff('0x41')]+'%'};return _0x467ce0;}})});}_0x533069=_['merge']({},_0x533069,_0x16b2d0[_0xdeff('0x42')]);var _0x14f1d0={'where':_0x533069['where']};return db[_0xdeff('0x2e')][_0xdeff('0x43')](_0x14f1d0)[_0xdeff('0x27')](function(_0x2e9dcd){_0xbc75ee[_0xdeff('0x43')]=_0x2e9dcd;if(_0x16b2d0['query'][_0xdeff('0x44')]){_0x533069[_0xdeff('0x45')]=[{'all':!![]}];}return db[_0xdeff('0x2e')][_0xdeff('0x46')](_0x533069);})[_0xdeff('0x27')](function(_0x5dfbb3){_0xbc75ee['rows']=_0x5dfbb3;return _0xbc75ee;})[_0xdeff('0x27')](respondWithFilteredResult(_0xcb819c,_0x533069))[_0xdeff('0x47')](handleError(_0xcb819c,null));};exports[_0xdeff('0x48')]=function(_0x318e77,_0x3c4fd2){var _0x289f70={'raw':!![],'where':{'id':_0x318e77['params']['id']}},_0x2cd68a={};_0x2cd68a[_0xdeff('0x31')]=_[_0xdeff('0x32')](db[_0xdeff('0x2e')]['rawAttributes']);_0x2cd68a[_0xdeff('0x34')]=_[_0xdeff('0x32')](_0x318e77[_0xdeff('0x34')]);_0x2cd68a[_0xdeff('0x3d')]=_['intersection'](_0x2cd68a[_0xdeff('0x31')],_0x2cd68a[_0xdeff('0x34')]);_0x289f70[_0xdeff('0x35')]=_[_0xdeff('0x33')](_0x2cd68a[_0xdeff('0x31')],qs[_0xdeff('0x36')](_0x318e77[_0xdeff('0x34')][_0xdeff('0x36')]));_0x289f70['attributes']=_0x289f70[_0xdeff('0x35')][_0xdeff('0x37')]?_0x289f70[_0xdeff('0x35')]:_0x2cd68a[_0xdeff('0x31')];if(_0x318e77[_0xdeff('0x34')]['includeAll']){_0x289f70[_0xdeff('0x45')]=[{'all':!![]}];}_0x289f70=_[_0xdeff('0x3f')]({},_0x289f70,_0x318e77[_0xdeff('0x42')]);return db[_0xdeff('0x2e')][_0xdeff('0x49')](_0x289f70)['then'](handleEntityNotFound(_0x3c4fd2,null))[_0xdeff('0x27')](respondWithResult(_0x3c4fd2,null))['catch'](handleError(_0x3c4fd2,null));};exports[_0xdeff('0x4a')]=function(_0x10e4ba,_0x1bf17c){return db[_0xdeff('0x2e')][_0xdeff('0x4a')](_0x10e4ba[_0xdeff('0x4b')],{})['then'](respondWithResult(_0x1bf17c,0xc9))['catch'](handleError(_0x1bf17c,null));};exports[_0xdeff('0x26')]=function(_0xf91a72,_0x3dc206){if(_0xf91a72['body']['id']){delete _0xf91a72['body']['id'];}return db[_0xdeff('0x2e')][_0xdeff('0x49')]({'where':{'id':_0xf91a72['params']['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x3dc206,null))[_0xdeff('0x27')](saveUpdates(_0xf91a72[_0xdeff('0x4b')],null))['then'](respondWithResult(_0x3dc206,null))[_0xdeff('0x47')](handleError(_0x3dc206,null));};exports[_0xdeff('0x28')]=function(_0x1ca376,_0x59ae32){return db[_0xdeff('0x2e')][_0xdeff('0x49')]({'where':{'id':_0x1ca376[_0xdeff('0x4c')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x59ae32,null))[_0xdeff('0x27')](removeEntity(_0x59ae32,null))[_0xdeff('0x47')](handleError(_0x59ae32,null));};exports[_0xdeff('0x4d')]=function(_0x578185,_0x4517d1){return db[_0xdeff('0x2e')]['describe']()[_0xdeff('0x27')](respondWithResult(_0x4517d1,null))[_0xdeff('0x47')](handleError(_0x4517d1,null));}; \ No newline at end of file +var _0x1eba=['name','send','WhatsappQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x1eba[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=typeof _0x44f37d[_0xa1eb('0x1c')]==='undefined'&&typeof _0x44f37d[_0xa1eb('0x1d')]==='undefined';var _0x1401ef=_0x1c858c[_0xa1eb('0x1e')];var _0x33c4e3=_0x45d6dd?0x0:_0x44f37d[_0xa1eb('0x1c')];var _0x49bfaa=_0x45d6dd?_0x1c858c[_0xa1eb('0x1e')]:_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')];var _0xcf45c1;if(_0x49bfaa>=_0x1401ef){_0x49bfaa=_0x1401ef;_0xcf45c1=0xc8;}else{_0xcf45c1=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xcf45c1);return _0x3cd675[_0xa1eb('0x1f')](_0xa1eb('0x20'),_0x33c4e3+'-'+_0x49bfaa+'/'+_0x1401ef)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x4fc14a){return function(_0x137e2c){try{jsonpatch['apply'](_0x137e2c,_0x4fc14a,!![]);}catch(_0x2258d1){return BPromise[_0xa1eb('0x21')](_0x2258d1);}return _0x137e2c[_0xa1eb('0x22')]();};}function saveUpdates(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x23')](_0x250f99)[_0xa1eb('0x24')](function(_0x5b0903){return _0x5b0903;});}return null;};}function removeEntity(_0x437b2a,_0x250728){return function(_0x258d3a){if(_0x258d3a){return _0x258d3a[_0xa1eb('0x25')]()[_0xa1eb('0x24')](function(){_0x437b2a[_0xa1eb('0x1a')](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x364b1c,_0xd7bb88){return function(_0x352796){if(!_0x352796){_0x364b1c[_0xa1eb('0x26')](0x194);}return _0x352796;};}function handleError(_0x208844,_0x57d089){_0x57d089=_0x57d089||0x1f4;return function(_0x7c617e){logger[_0xa1eb('0x27')](_0x7c617e['stack']);if(_0x7c617e[_0xa1eb('0x28')]){delete _0x7c617e['name'];}_0x208844[_0xa1eb('0x1a')](_0x57d089)[_0xa1eb('0x29')](_0x7c617e);};}exports['index']=function(_0x45ff0d,_0x1581ee){var _0x136835={},_0x4f64bb={},_0x12cf56={'count':0x0,'rows':[]};var _0x41b3ad=_['map'](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')],function(_0x401510){return{'name':_0x401510[_0xa1eb('0x2c')],'type':_0x401510[_0xa1eb('0x2d')]['key']};});_0x4f64bb[_0xa1eb('0x2e')]=_[_0xa1eb('0x2f')](_0x41b3ad,_0xa1eb('0x28'));_0x4f64bb[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x45ff0d[_0xa1eb('0x30')]);_0x4f64bb[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x4f64bb[_0xa1eb('0x2e')],_0x4f64bb[_0xa1eb('0x30')]);_0x136835[_0xa1eb('0x34')]=_['intersection'](_0x4f64bb['model'],qs[_0xa1eb('0x35')](_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x35')]));_0x136835[_0xa1eb('0x34')]=_0x136835[_0xa1eb('0x34')]['length']?_0x136835['attributes']:_0x4f64bb[_0xa1eb('0x2e')];if(!_0x45ff0d[_0xa1eb('0x30')]['hasOwnProperty']('nolimit')){_0x136835[_0xa1eb('0x1d')]=qs['limit'](_0x45ff0d[_0xa1eb('0x30')]['limit']);_0x136835[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x45ff0d[_0xa1eb('0x30')]['offset']);}_0x136835[_0xa1eb('0x36')]=qs[_0xa1eb('0x37')](_0x45ff0d[_0xa1eb('0x30')]['sort']);_0x136835[_0xa1eb('0x38')]=qs[_0xa1eb('0x32')](_[_0xa1eb('0x39')](_0x45ff0d[_0xa1eb('0x30')],_0x4f64bb[_0xa1eb('0x32')]),_0x41b3ad);if(_0x45ff0d['query'][_0xa1eb('0x3a')]){_0x136835[_0xa1eb('0x38')]=_[_0xa1eb('0x3b')](_0x136835[_0xa1eb('0x38')],{'$or':_[_0xa1eb('0x2f')](_0x41b3ad,function(_0x2af1d1){if(_0x2af1d1[_0xa1eb('0x2d')]!==_0xa1eb('0x3c')){var _0x53f251={};_0x53f251[_0x2af1d1[_0xa1eb('0x28')]]={'$like':'%'+_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3a')]+'%'};return _0x53f251;}})});}_0x136835=_[_0xa1eb('0x3b')]({},_0x136835,_0x45ff0d[_0xa1eb('0x3d')]);var _0x5bf994={'where':_0x136835[_0xa1eb('0x38')]};return db[_0xa1eb('0x2a')][_0xa1eb('0x1e')](_0x5bf994)['then'](function(_0x334849){_0x12cf56[_0xa1eb('0x1e')]=_0x334849;if(_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x136835[_0xa1eb('0x3f')]=[{'all':!![]}];}return db[_0xa1eb('0x2a')][_0xa1eb('0x40')](_0x136835);})['then'](function(_0x3c8713){_0x12cf56[_0xa1eb('0x41')]=_0x3c8713;return _0x12cf56;})['then'](respondWithFilteredResult(_0x1581ee,_0x136835))[_0xa1eb('0x42')](handleError(_0x1581ee,null));};exports['show']=function(_0x1744e4,_0x3a6f36){var _0x75f7f6={'raw':!![],'where':{'id':_0x1744e4[_0xa1eb('0x43')]['id']}},_0x361675={};_0x361675[_0xa1eb('0x2e')]=_[_0xa1eb('0x31')](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')]);_0x361675[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x1744e4[_0xa1eb('0x30')]);_0x361675[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x361675[_0xa1eb('0x2e')],_0x361675[_0xa1eb('0x30')]);_0x75f7f6['attributes']=_[_0xa1eb('0x33')](_0x361675['model'],qs[_0xa1eb('0x35')](_0x1744e4[_0xa1eb('0x30')]['fields']));_0x75f7f6['attributes']=_0x75f7f6[_0xa1eb('0x34')][_0xa1eb('0x44')]?_0x75f7f6[_0xa1eb('0x34')]:_0x361675['model'];if(_0x1744e4[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x75f7f6[_0xa1eb('0x3f')]=[{'all':!![]}];}_0x75f7f6=_[_0xa1eb('0x3b')]({},_0x75f7f6,_0x1744e4[_0xa1eb('0x3d')]);return db[_0xa1eb('0x2a')][_0xa1eb('0x45')](_0x75f7f6)[_0xa1eb('0x24')](handleEntityNotFound(_0x3a6f36,null))[_0xa1eb('0x24')](respondWithResult(_0x3a6f36,null))[_0xa1eb('0x42')](handleError(_0x3a6f36,null));};exports[_0xa1eb('0x46')]=function(_0x393f95,_0x39d3c6){return db[_0xa1eb('0x2a')]['create'](_0x393f95[_0xa1eb('0x47')],{})[_0xa1eb('0x24')](respondWithResult(_0x39d3c6,0xc9))[_0xa1eb('0x42')](handleError(_0x39d3c6,null));};exports[_0xa1eb('0x23')]=function(_0x2b0cbf,_0x12dfd4){if(_0x2b0cbf[_0xa1eb('0x47')]['id']){delete _0x2b0cbf['body']['id'];}return db[_0xa1eb('0x2a')][_0xa1eb('0x45')]({'where':{'id':_0x2b0cbf[_0xa1eb('0x43')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x12dfd4,null))[_0xa1eb('0x24')](saveUpdates(_0x2b0cbf[_0xa1eb('0x47')],null))[_0xa1eb('0x24')](respondWithResult(_0x12dfd4,null))[_0xa1eb('0x42')](handleError(_0x12dfd4,null));};exports[_0xa1eb('0x25')]=function(_0x4f7c05,_0x190370){return db['WhatsappQueueReport'][_0xa1eb('0x45')]({'where':{'id':_0x4f7c05['params']['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x190370,null))[_0xa1eb('0x24')](removeEntity(_0x190370,null))[_0xa1eb('0x42')](handleError(_0x190370,null));};exports['describe']=function(_0x3fbd6c,_0xbd9a42){return db['WhatsappQueueReport'][_0xa1eb('0x48')]()[_0xa1eb('0x24')](respondWithResult(_0xbd9a42,null))[_0xa1eb('0x42')](handleError(_0xbd9a42,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index f63c87a..885aa01 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 _0xc602=['bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xc602,0x19f));var _0x2c60=function(_0x2a20a6,_0x590beb){_0x2a20a6=_0x2a20a6-0x0;var _0x706e1b=_0xc602[_0x2a20a6];return _0x706e1b;};'use strict';var _=require(_0x2c60('0x0'));var util=require(_0x2c60('0x1'));var logger=require(_0x2c60('0x2'))(_0x2c60('0x3'));var moment=require(_0x2c60('0x4'));var BPromise=require(_0x2c60('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c60('0x6'));var rimraf=require(_0x2c60('0x7'));var config=require(_0x2c60('0x8'));var attributes=require(_0x2c60('0x9'));module[_0x2c60('0xa')]=function(_0x2a8b65,_0x2fc5ad){return _0x2a8b65[_0x2c60('0xb')](_0x2c60('0xc'),attributes,{'tableName':_0x2c60('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2c60('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x351b=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x50cee2,_0x56709e){var _0x3875c3=function(_0x2812af){while(--_0x2812af){_0x50cee2['push'](_0x50cee2['shift']());}};_0x3875c3(++_0x56709e);}(_0x351b,0x1be));var _0xb351=function(_0x153544,_0x36da9c){_0x153544=_0x153544-0x0;var _0x4035f3=_0x351b[_0x153544];return _0x4035f3;};'use strict';var _=require(_0xb351('0x0'));var util=require(_0xb351('0x1'));var logger=require(_0xb351('0x2'))(_0xb351('0x3'));var moment=require(_0xb351('0x4'));var BPromise=require(_0xb351('0x5'));var rp=require(_0xb351('0x6'));var fs=require('fs');var path=require(_0xb351('0x7'));var rimraf=require('rimraf');var config=require(_0xb351('0x8'));var attributes=require(_0xb351('0x9'));module['exports']=function(_0x2c8758,_0x10666b){return _0x2c8758[_0xb351('0xa')](_0xb351('0xb'),attributes,{'tableName':_0xb351('0xc'),'paranoid':![],'indexes':[{'name':_0xb351('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 043a061..f2aed37 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 _0x6e2d=['where','limit','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','UpdateWhatsappQueueReport','update','raw'];(function(_0x571b51,_0x2bf50d){var _0x198808=function(_0x128ec8){while(--_0x128ec8){_0x571b51['push'](_0x571b51['shift']());}};_0x198808(++_0x2bf50d);}(_0x6e2d,0xea));var _0xd6e2=function(_0x14d269,_0x6517c2){_0x14d269=_0x14d269-0x0;var _0xd0b684=_0x6e2d[_0x14d269];return _0xd0b684;};'use strict';var _=require(_0xd6e2('0x0'));var util=require(_0xd6e2('0x1'));var moment=require(_0xd6e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6e2('0x3'));var fs=require('fs');var Redis=require(_0xd6e2('0x4'));var db=require(_0xd6e2('0x5'))['db'];var utils=require(_0xd6e2('0x6'));var logger=require(_0xd6e2('0x7'))(_0xd6e2('0x8'));var config=require(_0xd6e2('0x9'));var jayson=require(_0xd6e2('0xa'));var client=jayson[_0xd6e2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481f63,_0xd8a4bd,_0x43403f){return new BPromise(function(_0x58affb,_0x5da4e8){return client['request'](_0x481f63,_0x43403f)[_0xd6e2('0xc')](function(_0x2ab4dd){logger[_0xd6e2('0xd')](_0xd6e2('0xe'),_0xd8a4bd,_0xd6e2('0xf'));logger[_0xd6e2('0x10')](_0xd6e2('0x11'),_0xd8a4bd,_0xd6e2('0xf'),JSON[_0xd6e2('0x12')](_0x2ab4dd));if(_0x2ab4dd[_0xd6e2('0x13')]){if(_0x2ab4dd[_0xd6e2('0x13')][_0xd6e2('0x14')]===0x1f4){logger[_0xd6e2('0x13')](_0xd6e2('0xe'),_0xd8a4bd,_0x2ab4dd[_0xd6e2('0x13')][_0xd6e2('0x15')]);return _0x5da4e8(_0x2ab4dd[_0xd6e2('0x13')][_0xd6e2('0x15')]);}logger[_0xd6e2('0x13')](_0xd6e2('0xe'),_0xd8a4bd,_0x2ab4dd[_0xd6e2('0x13')][_0xd6e2('0x15')]);return _0x58affb(_0x2ab4dd[_0xd6e2('0x13')][_0xd6e2('0x15')]);}else{logger[_0xd6e2('0xd')](_0xd6e2('0xe'),_0xd8a4bd,'request\x20sent');_0x58affb(_0x2ab4dd[_0xd6e2('0x16')][_0xd6e2('0x15')]);}})['catch'](function(_0x36dab3){logger['error'](_0xd6e2('0xe'),_0xd8a4bd,_0x36dab3);_0x5da4e8(_0x36dab3);});});}exports[_0xd6e2('0x17')]=function(_0x2f6a17){var _0x4866c9=this;return new Promise(function(_0x17984d,_0x2daa6d){return db[_0xd6e2('0x18')]['create'](_0x2f6a17[_0xd6e2('0x19')],{'raw':_0x2f6a17[_0xd6e2('0x1a')]?_0x2f6a17[_0xd6e2('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5819fc){logger[_0xd6e2('0xd')]('CreateWhatsappQueueReport',_0x2f6a17);logger[_0xd6e2('0x10')](_0xd6e2('0x17'),_0x2f6a17,JSON[_0xd6e2('0x12')](_0x5819fc));_0x17984d(_0x5819fc);})['catch'](function(_0x594eab){logger[_0xd6e2('0x13')](_0xd6e2('0x17'),_0x594eab[_0xd6e2('0x15')],_0x2f6a17);_0x2daa6d(_0x4866c9[_0xd6e2('0x13')](0x1f4,_0x594eab[_0xd6e2('0x15')]));});});};exports[_0xd6e2('0x1b')]=function(_0x5cce69){var _0x30d465=this;return new Promise(function(_0x43fc30,_0x14ae89){return db['WhatsappQueueReport'][_0xd6e2('0x1c')](_0x5cce69[_0xd6e2('0x19')],{'raw':_0x5cce69[_0xd6e2('0x1a')]?_0x5cce69[_0xd6e2('0x1a')][_0xd6e2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cce69[_0xd6e2('0x1a')]?_0x5cce69['options'][_0xd6e2('0x1e')]||null:null,'attributes':_0x5cce69[_0xd6e2('0x1a')]?_0x5cce69[_0xd6e2('0x1a')]['attributes']||null:null,'limit':_0x5cce69[_0xd6e2('0x1a')]?_0x5cce69[_0xd6e2('0x1a')][_0xd6e2('0x1f')]||null:null})['then'](function(_0x49204e){logger[_0xd6e2('0xd')]('UpdateWhatsappQueueReport',_0x5cce69);logger[_0xd6e2('0x10')](_0xd6e2('0x1b'),_0x5cce69,JSON['stringify'](_0x49204e));_0x43fc30(_0x49204e);})[_0xd6e2('0x20')](function(_0x2feb60){logger[_0xd6e2('0x13')](_0xd6e2('0x1b'),_0x2feb60['message'],_0x5cce69);_0x14ae89(_0x30d465['error'](0x1f4,_0x2feb60[_0xd6e2('0x15')]));});});}; \ No newline at end of file +var _0xc32d=['WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappQueueReport'];(function(_0x1a2c29,_0x9fa481){var _0x5de009=function(_0x5a49a5){while(--_0x5a49a5){_0x1a2c29['push'](_0x1a2c29['shift']());}};_0x5de009(++_0x9fa481);}(_0xc32d,0x188));var _0xdc32=function(_0x243c7e,_0x3beae2){_0x243c7e=_0x243c7e-0x0;var _0x226d05=_0xc32d[_0x243c7e];return _0x226d05;};'use strict';var _=require(_0xdc32('0x0'));var util=require(_0xdc32('0x1'));var moment=require(_0xdc32('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc32('0x3'));var fs=require('fs');var Redis=require(_0xdc32('0x4'));var db=require(_0xdc32('0x5'))['db'];var utils=require(_0xdc32('0x6'));var logger=require('../../config/logger')(_0xdc32('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc32('0x8'));var client=jayson[_0xdc32('0x9')][_0xdc32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x599067,_0x142704,_0x589584){return new BPromise(function(_0x4245f9,_0x9270a9){return client[_0xdc32('0xb')](_0x599067,_0x589584)['then'](function(_0x20b865){logger['info'](_0xdc32('0xc'),_0x142704,_0xdc32('0xd'));logger[_0xdc32('0xe')](_0xdc32('0xf'),_0x142704,_0xdc32('0xd'),JSON[_0xdc32('0x10')](_0x20b865));if(_0x20b865[_0xdc32('0x11')]){if(_0x20b865[_0xdc32('0x11')][_0xdc32('0x12')]===0x1f4){logger['error'](_0xdc32('0xc'),_0x142704,_0x20b865[_0xdc32('0x11')][_0xdc32('0x13')]);return _0x9270a9(_0x20b865['error']['message']);}logger[_0xdc32('0x11')](_0xdc32('0xc'),_0x142704,_0x20b865['error']['message']);return _0x4245f9(_0x20b865[_0xdc32('0x11')]['message']);}else{logger[_0xdc32('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x142704,_0xdc32('0xd'));_0x4245f9(_0x20b865[_0xdc32('0x15')][_0xdc32('0x13')]);}})[_0xdc32('0x16')](function(_0x503610){logger[_0xdc32('0x11')](_0xdc32('0xc'),_0x142704,_0x503610);_0x9270a9(_0x503610);});});}exports[_0xdc32('0x17')]=function(_0x568c3e){var _0x12c9c4=this;return new Promise(function(_0x436d75,_0x168f26){return db[_0xdc32('0x18')][_0xdc32('0x19')](_0x568c3e[_0xdc32('0x1a')],{'raw':_0x568c3e[_0xdc32('0x1b')]?_0x568c3e['options'][_0xdc32('0x1c')]===undefined?!![]:![]:!![]})[_0xdc32('0x1d')](function(_0x3b2228){logger['info'](_0xdc32('0x17'),_0x568c3e);logger[_0xdc32('0xe')](_0xdc32('0x17'),_0x568c3e,JSON[_0xdc32('0x10')](_0x3b2228));_0x436d75(_0x3b2228);})[_0xdc32('0x16')](function(_0x3f71db){logger[_0xdc32('0x11')]('CreateWhatsappQueueReport',_0x3f71db[_0xdc32('0x13')],_0x568c3e);_0x168f26(_0x12c9c4[_0xdc32('0x11')](0x1f4,_0x3f71db[_0xdc32('0x13')]));});});};exports[_0xdc32('0x1e')]=function(_0x55c112){var _0x4e4cd9=this;return new Promise(function(_0x1294e2,_0x3a6a50){return db[_0xdc32('0x18')]['update'](_0x55c112[_0xdc32('0x1a')],{'raw':_0x55c112[_0xdc32('0x1b')]?_0x55c112['options'][_0xdc32('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55c112['options']?_0x55c112[_0xdc32('0x1b')][_0xdc32('0x1f')]||null:null,'attributes':_0x55c112['options']?_0x55c112['options']['attributes']||null:null,'limit':_0x55c112[_0xdc32('0x1b')]?_0x55c112[_0xdc32('0x1b')]['limit']||null:null})[_0xdc32('0x1d')](function(_0x36aa63){logger[_0xdc32('0x14')]('UpdateWhatsappQueueReport',_0x55c112);logger[_0xdc32('0xe')](_0xdc32('0x1e'),_0x55c112,JSON['stringify'](_0x36aa63));_0x1294e2(_0x36aa63);})[_0xdc32('0x16')](function(_0x53d743){logger[_0xdc32('0x11')]('UpdateWhatsappQueueReport',_0x53d743['message'],_0x55c112);_0x3a6a50(_0x4e4cd9['error'](0x1f4,_0x53d743[_0xdc32('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 68dc09d..784022d 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 _0xb7e5=['get','index','/describe','describe','isAuthenticated','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x1d86c4,_0x3fcc20){var _0x59ebd2=function(_0x36541c){while(--_0x36541c){_0x1d86c4['push'](_0x1d86c4['shift']());}};_0x59ebd2(++_0x3fcc20);}(_0xb7e5,0x186));var _0x5b7e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb7e5[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5b7e('0x0'));var util=require(_0x5b7e('0x1'));var path=require(_0x5b7e('0x2'));var timeout=require(_0x5b7e('0x3'));var express=require(_0x5b7e('0x4'));var router=express[_0x5b7e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b7e('0x6'));var interaction=require(_0x5b7e('0x7'));var config=require(_0x5b7e('0x8'));var controller=require(_0x5b7e('0x9'));router[_0x5b7e('0xa')]('/',auth['isAuthenticated'](),controller[_0x5b7e('0xb')]);router['get'](_0x5b7e('0xc'),auth['isAuthenticated'](),controller[_0x5b7e('0xd')]);router[_0x5b7e('0xa')]('/:id',auth[_0x5b7e('0xe')](),controller['show']);router['post']('/',auth[_0x5b7e('0xe')](),controller['create']);router['put'](_0x5b7e('0xf'),auth['isAuthenticated'](),controller[_0x5b7e('0x10')]);router[_0x5b7e('0x11')](_0x5b7e('0xf'),auth['isAuthenticated'](),controller[_0x5b7e('0x12')]);module[_0x5b7e('0x13')]=router; \ No newline at end of file +var _0xd745=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','update','delete','/:id'];(function(_0x3bb657,_0x10ec39){var _0xf6fd9e=function(_0x313ec3){while(--_0x313ec3){_0x3bb657['push'](_0x3bb657['shift']());}};_0xf6fd9e(++_0x10ec39);}(_0xd745,0x17c));var _0x5d74=function(_0x130ee6,_0x38c13f){_0x130ee6=_0x130ee6-0x0;var _0x1e387b=_0xd745[_0x130ee6];return _0x1e387b;};'use strict';var multer=require(_0x5d74('0x0'));var util=require('util');var path=require(_0x5d74('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d74('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5d74('0x3'));var interaction=require(_0x5d74('0x4'));var config=require(_0x5d74('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0x5d74('0x6')]('/',auth[_0x5d74('0x7')](),controller[_0x5d74('0x8')]);router[_0x5d74('0x6')](_0x5d74('0x9'),auth[_0x5d74('0x7')](),controller[_0x5d74('0xa')]);router[_0x5d74('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5d74('0xb')]('/',auth[_0x5d74('0x7')](),controller[_0x5d74('0xc')]);router['put']('/:id',auth[_0x5d74('0x7')](),controller[_0x5d74('0xd')]);router[_0x5d74('0xe')](_0x5d74('0xf'),auth[_0x5d74('0x7')](),controller[_0x5d74('0x10')]);module[_0x5d74('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 997a955..1d5e047 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 _0xc15c=['account','queue','STRING','ENUM'];(function(_0x30571b,_0x26b627){var _0x3f8372=function(_0x4a9f2c){while(--_0x4a9f2c){_0x30571b['push'](_0x30571b['shift']());}};_0x3f8372(++_0x26b627);}(_0xc15c,0xae));var _0xcc15=function(_0x3db379,_0x44a726){_0x3db379=_0x3db379-0x0;var _0x541f1e=_0xc15c[_0x3db379];return _0x541f1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcc15('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xcc15('0x1')](_0xcc15('0x2'),'agent',_0xcc15('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x3176=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x5cd612,_0x208d8c){var _0x54a0f9=function(_0x9c9f6b){while(--_0x9c9f6b){_0x5cd612['push'](_0x5cd612['shift']());}};_0x54a0f9(++_0x208d8c);}(_0x3176,0x1d8));var _0x6317=function(_0x7f56c3,_0x1defc4){_0x7f56c3=_0x7f56c3-0x0;var _0x1b3f35=_0x3176[_0x7f56c3];return _0x1b3f35;};'use strict';var Sequelize=require(_0x6317('0x0'));module[_0x6317('0x1')]={'uniqueid':{'type':Sequelize[_0x6317('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6317('0x3')](_0x6317('0x4'),_0x6317('0x5'),_0x6317('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6317('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8b69fd7..a86a504 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 _0x4654=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','keys','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','fieldName','type'];(function(_0x17cf06,_0x3b5f0f){var _0x196326=function(_0x25bbc1){while(--_0x25bbc1){_0x17cf06['push'](_0x17cf06['shift']());}};_0x196326(++_0x3b5f0f);}(_0x4654,0x64));var _0x4465=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4654[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4465('0x0'));var zipdir=require(_0x4465('0x1'));var jsonpatch=require(_0x4465('0x2'));var rp=require(_0x4465('0x3'));var moment=require(_0x4465('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4465('0x5'));var util=require(_0x4465('0x6'));var path=require('path');var sox=require(_0x4465('0x7'));var csv=require(_0x4465('0x8'));var ejs=require(_0x4465('0x9'));var fs=require('fs');var fs_extra=require(_0x4465('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4465('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4465('0xc'));var toCsv=require(_0x4465('0x8'));var querystring=require(_0x4465('0xd'));var Papa=require('papaparse');var Redis=require(_0x4465('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4465('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4465('0x10'));var logger=require(_0x4465('0x11'))(_0x4465('0x12'));var utils=require(_0x4465('0x13'));var config=require(_0x4465('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4465('0x15'))['db'];function respondWithStatusCode(_0x112668,_0x4f40ad){_0x4f40ad=_0x4f40ad||0xcc;return function(_0x302646){if(_0x302646){return _0x112668[_0x4465('0x16')](_0x4f40ad);}return _0x112668[_0x4465('0x17')](_0x4f40ad)[_0x4465('0x18')]();};}function respondWithResult(_0x37c216,_0x600203){_0x600203=_0x600203||0xc8;return function(_0x3e619b){if(_0x3e619b){return _0x37c216[_0x4465('0x17')](_0x600203)[_0x4465('0x19')](_0x3e619b);}};}function respondWithFilteredResult(_0x48934c,_0xe861df){return function(_0x125c64){if(_0x125c64){var _0x5414ba=typeof _0xe861df['offset']===_0x4465('0x1a')&&typeof _0xe861df[_0x4465('0x1b')]===_0x4465('0x1a');var _0x3215cf=_0x125c64[_0x4465('0x1c')];var _0x318f26=_0x5414ba?0x0:_0xe861df[_0x4465('0x1d')];var _0x2287ae=_0x5414ba?_0x125c64[_0x4465('0x1c')]:_0xe861df['offset']+_0xe861df['limit'];var _0x45ad42;if(_0x2287ae>=_0x3215cf){_0x2287ae=_0x3215cf;_0x45ad42=0xc8;}else{_0x45ad42=0xce;}_0x48934c[_0x4465('0x17')](_0x45ad42);return _0x48934c[_0x4465('0x1e')](_0x4465('0x1f'),_0x318f26+'-'+_0x2287ae+'/'+_0x3215cf)['json'](_0x125c64);}return null;};}function patchUpdates(_0x499aa8){return function(_0x37c711){try{jsonpatch[_0x4465('0x20')](_0x37c711,_0x499aa8,!![]);}catch(_0x387181){return BPromise[_0x4465('0x21')](_0x387181);}return _0x37c711[_0x4465('0x22')]();};}function saveUpdates(_0x431c71,_0x458920){return function(_0x3cb76b){if(_0x3cb76b){return _0x3cb76b[_0x4465('0x23')](_0x431c71)[_0x4465('0x24')](function(_0x5429a1){return _0x5429a1;});}return null;};}function removeEntity(_0x18d8e3,_0x8ac041){return function(_0x28f98f){if(_0x28f98f){return _0x28f98f[_0x4465('0x25')]()['then'](function(){_0x18d8e3[_0x4465('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a90b4,_0x2d85f5){return function(_0x22393c){if(!_0x22393c){_0x2a90b4['sendStatus'](0x194);}return _0x22393c;};}function handleError(_0x3a50bd,_0x115366){_0x115366=_0x115366||0x1f4;return function(_0x15a5b0){logger[_0x4465('0x26')](_0x15a5b0[_0x4465('0x27')]);if(_0x15a5b0[_0x4465('0x28')]){delete _0x15a5b0['name'];}_0x3a50bd[_0x4465('0x17')](_0x115366)[_0x4465('0x29')](_0x15a5b0);};}exports['index']=function(_0x5d4914,_0x266bd4){var _0x5a6f81={},_0x47b8c5={},_0x5ed4f7={'count':0x0,'rows':[]};var _0x5017d2=_[_0x4465('0x2a')](db[_0x4465('0x2b')]['rawAttributes'],function(_0x7987b9){return{'name':_0x7987b9[_0x4465('0x2c')],'type':_0x7987b9[_0x4465('0x2d')]['key']};});_0x47b8c5[_0x4465('0x2e')]=_['map'](_0x5017d2,_0x4465('0x28'));_0x47b8c5['query']=_['keys'](_0x5d4914[_0x4465('0x2f')]);_0x47b8c5[_0x4465('0x30')]=_[_0x4465('0x31')](_0x47b8c5[_0x4465('0x2e')],_0x47b8c5['query']);_0x5a6f81[_0x4465('0x32')]=_[_0x4465('0x31')](_0x47b8c5['model'],qs[_0x4465('0x33')](_0x5d4914[_0x4465('0x2f')][_0x4465('0x33')]));_0x5a6f81[_0x4465('0x32')]=_0x5a6f81[_0x4465('0x32')][_0x4465('0x34')]?_0x5a6f81[_0x4465('0x32')]:_0x47b8c5[_0x4465('0x2e')];if(!_0x5d4914[_0x4465('0x2f')][_0x4465('0x35')](_0x4465('0x36'))){_0x5a6f81['limit']=qs['limit'](_0x5d4914['query'][_0x4465('0x1b')]);_0x5a6f81[_0x4465('0x1d')]=qs[_0x4465('0x1d')](_0x5d4914[_0x4465('0x2f')][_0x4465('0x1d')]);}_0x5a6f81[_0x4465('0x37')]=qs['sort'](_0x5d4914[_0x4465('0x2f')][_0x4465('0x38')]);_0x5a6f81[_0x4465('0x39')]=qs[_0x4465('0x30')](_[_0x4465('0x3a')](_0x5d4914[_0x4465('0x2f')],_0x47b8c5['filters']),_0x5017d2);if(_0x5d4914[_0x4465('0x2f')]['filter']){_0x5a6f81[_0x4465('0x39')]=_[_0x4465('0x3b')](_0x5a6f81[_0x4465('0x39')],{'$or':_[_0x4465('0x2a')](_0x5017d2,function(_0x3037a3){if(_0x3037a3[_0x4465('0x2d')]!=='VIRTUAL'){var _0x6062dd={};_0x6062dd[_0x3037a3[_0x4465('0x28')]]={'$like':'%'+_0x5d4914[_0x4465('0x2f')][_0x4465('0x3c')]+'%'};return _0x6062dd;}})});}_0x5a6f81=_[_0x4465('0x3b')]({},_0x5a6f81,_0x5d4914[_0x4465('0x3d')]);var _0x502f43={'where':_0x5a6f81[_0x4465('0x39')]};return db['WhatsappTransferReport'][_0x4465('0x1c')](_0x502f43)['then'](function(_0x9f0615){_0x5ed4f7[_0x4465('0x1c')]=_0x9f0615;if(_0x5d4914[_0x4465('0x2f')][_0x4465('0x3e')]){_0x5a6f81[_0x4465('0x3f')]=[{'all':!![]}];}return db[_0x4465('0x2b')]['findAll'](_0x5a6f81);})[_0x4465('0x24')](function(_0xc666da){_0x5ed4f7[_0x4465('0x40')]=_0xc666da;return _0x5ed4f7;})[_0x4465('0x24')](respondWithFilteredResult(_0x266bd4,_0x5a6f81))['catch'](handleError(_0x266bd4,null));};exports[_0x4465('0x41')]=function(_0x4b3e63,_0x196cfa){var _0x3a0db9={'raw':!![],'where':{'id':_0x4b3e63['params']['id']}},_0x358295={};_0x358295[_0x4465('0x2e')]=_[_0x4465('0x42')](db[_0x4465('0x2b')]['rawAttributes']);_0x358295['query']=_[_0x4465('0x42')](_0x4b3e63[_0x4465('0x2f')]);_0x358295['filters']=_[_0x4465('0x31')](_0x358295['model'],_0x358295[_0x4465('0x2f')]);_0x3a0db9['attributes']=_[_0x4465('0x31')](_0x358295[_0x4465('0x2e')],qs[_0x4465('0x33')](_0x4b3e63['query'][_0x4465('0x33')]));_0x3a0db9[_0x4465('0x32')]=_0x3a0db9[_0x4465('0x32')][_0x4465('0x34')]?_0x3a0db9[_0x4465('0x32')]:_0x358295[_0x4465('0x2e')];if(_0x4b3e63[_0x4465('0x2f')]['includeAll']){_0x3a0db9[_0x4465('0x3f')]=[{'all':!![]}];}_0x3a0db9=_[_0x4465('0x3b')]({},_0x3a0db9,_0x4b3e63[_0x4465('0x3d')]);return db['WhatsappTransferReport'][_0x4465('0x43')](_0x3a0db9)[_0x4465('0x24')](handleEntityNotFound(_0x196cfa,null))[_0x4465('0x24')](respondWithResult(_0x196cfa,null))[_0x4465('0x44')](handleError(_0x196cfa,null));};exports[_0x4465('0x45')]=function(_0x34e56,_0x101989){return db[_0x4465('0x2b')][_0x4465('0x45')](_0x34e56[_0x4465('0x46')],{})[_0x4465('0x24')](respondWithResult(_0x101989,0xc9))[_0x4465('0x44')](handleError(_0x101989,null));};exports['update']=function(_0x1b9a3e,_0x1cac8b){if(_0x1b9a3e[_0x4465('0x46')]['id']){delete _0x1b9a3e[_0x4465('0x46')]['id'];}return db[_0x4465('0x2b')][_0x4465('0x43')]({'where':{'id':_0x1b9a3e[_0x4465('0x47')]['id']}})[_0x4465('0x24')](handleEntityNotFound(_0x1cac8b,null))[_0x4465('0x24')](saveUpdates(_0x1b9a3e['body'],null))[_0x4465('0x24')](respondWithResult(_0x1cac8b,null))[_0x4465('0x44')](handleError(_0x1cac8b,null));};exports['destroy']=function(_0x46f8d1,_0x3506ba){return db[_0x4465('0x2b')][_0x4465('0x43')]({'where':{'id':_0x46f8d1['params']['id']}})['then'](handleEntityNotFound(_0x3506ba,null))[_0x4465('0x24')](removeEntity(_0x3506ba,null))[_0x4465('0x44')](handleError(_0x3506ba,null));};exports[_0x4465('0x48')]=function(_0x1ff62e,_0x272f6d){return db[_0x4465('0x2b')][_0x4465('0x48')]()['then'](respondWithResult(_0x272f6d,null))['catch'](handleError(_0x272f6d,null));}; \ No newline at end of file +var _0x41ca=['squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','json','reject','save','update','destroy','then','end','error','name','index','map','WhatsappTransferReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x411b14,_0x3f9e36){var _0x402736=function(_0x2be12e){while(--_0x2be12e){_0x411b14['push'](_0x411b14['shift']());}};_0x402736(++_0x3f9e36);}(_0x41ca,0x1de));var _0xa41c=function(_0x18b17d,_0x6a0cc){_0x18b17d=_0x18b17d-0x0;var _0x2ff0a4=_0x41ca[_0x18b17d];return _0x2ff0a4;};'use strict';var emlformat=require(_0xa41c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa41c('0x1'));var jsonpatch=require(_0xa41c('0x2'));var rp=require(_0xa41c('0x3'));var moment=require(_0xa41c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa41c('0x5'));var util=require(_0xa41c('0x6'));var path=require('path');var sox=require(_0xa41c('0x7'));var csv=require(_0xa41c('0x8'));var ejs=require(_0xa41c('0x9'));var fs=require('fs');var fs_extra=require(_0xa41c('0xa'));var _=require(_0xa41c('0xb'));var squel=require(_0xa41c('0xc'));var crypto=require(_0xa41c('0xd'));var jsforce=require(_0xa41c('0xe'));var deskjs=require(_0xa41c('0xf'));var toCsv=require(_0xa41c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa41c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa41c('0x11'));var hardwareService=require(_0xa41c('0x12'));var logger=require(_0xa41c('0x13'))(_0xa41c('0x14'));var utils=require(_0xa41c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa41c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x444279,_0xcf60d0){_0xcf60d0=_0xcf60d0||0xcc;return function(_0x2b82a9){if(_0x2b82a9){return _0x444279[_0xa41c('0x17')](_0xcf60d0);}return _0x444279['status'](_0xcf60d0)['end']();};}function respondWithResult(_0x1e8a4c,_0x5c3435){_0x5c3435=_0x5c3435||0xc8;return function(_0x166fb7){if(_0x166fb7){return _0x1e8a4c[_0xa41c('0x18')](_0x5c3435)['json'](_0x166fb7);}};}function respondWithFilteredResult(_0x278f5d,_0x5f43cc){return function(_0x5156b7){if(_0x5156b7){var _0x6e9a70=typeof _0x5f43cc[_0xa41c('0x19')]===_0xa41c('0x1a')&&typeof _0x5f43cc[_0xa41c('0x1b')]===_0xa41c('0x1a');var _0x4b6dc5=_0x5156b7[_0xa41c('0x1c')];var _0x464422=_0x6e9a70?0x0:_0x5f43cc['offset'];var _0x38370e=_0x6e9a70?_0x5156b7['count']:_0x5f43cc[_0xa41c('0x19')]+_0x5f43cc[_0xa41c('0x1b')];var _0x52436a;if(_0x38370e>=_0x4b6dc5){_0x38370e=_0x4b6dc5;_0x52436a=0xc8;}else{_0x52436a=0xce;}_0x278f5d[_0xa41c('0x18')](_0x52436a);return _0x278f5d['set']('Content-Range',_0x464422+'-'+_0x38370e+'/'+_0x4b6dc5)[_0xa41c('0x1d')](_0x5156b7);}return null;};}function patchUpdates(_0x5a6947){return function(_0x25b3bd){try{jsonpatch['apply'](_0x25b3bd,_0x5a6947,!![]);}catch(_0x279188){return BPromise[_0xa41c('0x1e')](_0x279188);}return _0x25b3bd[_0xa41c('0x1f')]();};}function saveUpdates(_0x5caf69,_0x4e2ecc){return function(_0x2628cf){if(_0x2628cf){return _0x2628cf[_0xa41c('0x20')](_0x5caf69)['then'](function(_0x15a04c){return _0x15a04c;});}return null;};}function removeEntity(_0x2408ef,_0x5e5c79){return function(_0x3a9b2c){if(_0x3a9b2c){return _0x3a9b2c[_0xa41c('0x21')]()[_0xa41c('0x22')](function(){_0x2408ef[_0xa41c('0x18')](0xcc)[_0xa41c('0x23')]();});}};}function handleEntityNotFound(_0x492483,_0x2a637d){return function(_0x4d6b72){if(!_0x4d6b72){_0x492483['sendStatus'](0x194);}return _0x4d6b72;};}function handleError(_0x438d7e,_0x4bb531){_0x4bb531=_0x4bb531||0x1f4;return function(_0x17bfa0){logger[_0xa41c('0x24')](_0x17bfa0['stack']);if(_0x17bfa0[_0xa41c('0x25')]){delete _0x17bfa0[_0xa41c('0x25')];}_0x438d7e['status'](_0x4bb531)['send'](_0x17bfa0);};}exports[_0xa41c('0x26')]=function(_0x41fbec,_0x5b4d9f){var _0x3f4f61={},_0x5cd277={},_0x2a6e4e={'count':0x0,'rows':[]};var _0x454b5=_[_0xa41c('0x27')](db[_0xa41c('0x28')][_0xa41c('0x29')],function(_0x5a63d7){return{'name':_0x5a63d7['fieldName'],'type':_0x5a63d7['type']['key']};});_0x5cd277[_0xa41c('0x2a')]=_[_0xa41c('0x27')](_0x454b5,_0xa41c('0x25'));_0x5cd277[_0xa41c('0x2b')]=_[_0xa41c('0x2c')](_0x41fbec[_0xa41c('0x2b')]);_0x5cd277[_0xa41c('0x2d')]=_[_0xa41c('0x2e')](_0x5cd277['model'],_0x5cd277['query']);_0x3f4f61[_0xa41c('0x2f')]=_['intersection'](_0x5cd277[_0xa41c('0x2a')],qs[_0xa41c('0x30')](_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x30')]));_0x3f4f61['attributes']=_0x3f4f61[_0xa41c('0x2f')][_0xa41c('0x31')]?_0x3f4f61['attributes']:_0x5cd277['model'];if(!_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x32')](_0xa41c('0x33'))){_0x3f4f61[_0xa41c('0x1b')]=qs[_0xa41c('0x1b')](_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x1b')]);_0x3f4f61[_0xa41c('0x19')]=qs[_0xa41c('0x19')](_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x19')]);}_0x3f4f61[_0xa41c('0x34')]=qs[_0xa41c('0x35')](_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x35')]);_0x3f4f61[_0xa41c('0x36')]=qs[_0xa41c('0x2d')](_['pick'](_0x41fbec['query'],_0x5cd277[_0xa41c('0x2d')]),_0x454b5);if(_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x37')]){_0x3f4f61[_0xa41c('0x36')]=_[_0xa41c('0x38')](_0x3f4f61[_0xa41c('0x36')],{'$or':_[_0xa41c('0x27')](_0x454b5,function(_0x32f18f){if(_0x32f18f[_0xa41c('0x39')]!==_0xa41c('0x3a')){var _0x294b65={};_0x294b65[_0x32f18f[_0xa41c('0x25')]]={'$like':'%'+_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x37')]+'%'};return _0x294b65;}})});}_0x3f4f61=_[_0xa41c('0x38')]({},_0x3f4f61,_0x41fbec[_0xa41c('0x3b')]);var _0x560ea7={'where':_0x3f4f61[_0xa41c('0x36')]};return db[_0xa41c('0x28')][_0xa41c('0x1c')](_0x560ea7)[_0xa41c('0x22')](function(_0x44733e){_0x2a6e4e[_0xa41c('0x1c')]=_0x44733e;if(_0x41fbec[_0xa41c('0x2b')][_0xa41c('0x3c')]){_0x3f4f61[_0xa41c('0x3d')]=[{'all':!![]}];}return db[_0xa41c('0x28')][_0xa41c('0x3e')](_0x3f4f61);})[_0xa41c('0x22')](function(_0x14b6c7){_0x2a6e4e['rows']=_0x14b6c7;return _0x2a6e4e;})['then'](respondWithFilteredResult(_0x5b4d9f,_0x3f4f61))[_0xa41c('0x3f')](handleError(_0x5b4d9f,null));};exports[_0xa41c('0x40')]=function(_0x4e2277,_0x295f01){var _0x5161e6={'raw':!![],'where':{'id':_0x4e2277[_0xa41c('0x41')]['id']}},_0x310d49={};_0x310d49[_0xa41c('0x2a')]=_['keys'](db[_0xa41c('0x28')][_0xa41c('0x29')]);_0x310d49[_0xa41c('0x2b')]=_[_0xa41c('0x2c')](_0x4e2277[_0xa41c('0x2b')]);_0x310d49['filters']=_[_0xa41c('0x2e')](_0x310d49[_0xa41c('0x2a')],_0x310d49['query']);_0x5161e6[_0xa41c('0x2f')]=_[_0xa41c('0x2e')](_0x310d49['model'],qs['fields'](_0x4e2277[_0xa41c('0x2b')][_0xa41c('0x30')]));_0x5161e6[_0xa41c('0x2f')]=_0x5161e6[_0xa41c('0x2f')][_0xa41c('0x31')]?_0x5161e6[_0xa41c('0x2f')]:_0x310d49[_0xa41c('0x2a')];if(_0x4e2277[_0xa41c('0x2b')][_0xa41c('0x3c')]){_0x5161e6[_0xa41c('0x3d')]=[{'all':!![]}];}_0x5161e6=_[_0xa41c('0x38')]({},_0x5161e6,_0x4e2277[_0xa41c('0x3b')]);return db[_0xa41c('0x28')]['find'](_0x5161e6)[_0xa41c('0x22')](handleEntityNotFound(_0x295f01,null))[_0xa41c('0x22')](respondWithResult(_0x295f01,null))['catch'](handleError(_0x295f01,null));};exports['create']=function(_0x8b3208,_0x272144){return db[_0xa41c('0x28')][_0xa41c('0x42')](_0x8b3208['body'],{})[_0xa41c('0x22')](respondWithResult(_0x272144,0xc9))['catch'](handleError(_0x272144,null));};exports[_0xa41c('0x20')]=function(_0x595111,_0x4ed50d){if(_0x595111['body']['id']){delete _0x595111['body']['id'];}return db[_0xa41c('0x28')][_0xa41c('0x43')]({'where':{'id':_0x595111[_0xa41c('0x41')]['id']}})[_0xa41c('0x22')](handleEntityNotFound(_0x4ed50d,null))[_0xa41c('0x22')](saveUpdates(_0x595111[_0xa41c('0x44')],null))['then'](respondWithResult(_0x4ed50d,null))[_0xa41c('0x3f')](handleError(_0x4ed50d,null));};exports[_0xa41c('0x21')]=function(_0x528223,_0x342c23){return db[_0xa41c('0x28')][_0xa41c('0x43')]({'where':{'id':_0x528223['params']['id']}})[_0xa41c('0x22')](handleEntityNotFound(_0x342c23,null))[_0xa41c('0x22')](removeEntity(_0x342c23,null))[_0xa41c('0x3f')](handleError(_0x342c23,null));};exports['describe']=function(_0x17a8ee,_0x584bdd){return db[_0xa41c('0x28')][_0xa41c('0x45')]()[_0xa41c('0x22')](respondWithResult(_0x584bdd,null))[_0xa41c('0x3f')](handleError(_0x584bdd,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 06630cb..471a9ca 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 _0x29a3=['moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid','util','../../config/logger','api'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x29a3,0xd5));var _0x329a=function(_0x26b412,_0x204e1b){_0x26b412=_0x26b412-0x0;var _0x575ed0=_0x29a3[_0x26b412];return _0x575ed0;};'use strict';var _=require('lodash');var util=require(_0x329a('0x0'));var logger=require(_0x329a('0x1'))(_0x329a('0x2'));var moment=require(_0x329a('0x3'));var BPromise=require('bluebird');var rp=require(_0x329a('0x4'));var fs=require('fs');var path=require(_0x329a('0x5'));var rimraf=require(_0x329a('0x6'));var config=require(_0x329a('0x7'));var attributes=require(_0x329a('0x8'));module[_0x329a('0x9')]=function(_0x28500f,_0x1b7f11){return _0x28500f['define']('WhatsappTransferReport',attributes,{'tableName':_0x329a('0xa'),'paranoid':![],'indexes':[{'name':_0x329a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0b0=['report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappTransferReport.attributes','WhatsappTransferReport'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0xb0b0,0x141));var _0x0b0b=function(_0x3e4d06,_0x4726ce){_0x3e4d06=_0x3e4d06-0x0;var _0x2cda3f=_0xb0b0[_0x3e4d06];return _0x2cda3f;};'use strict';var _=require('lodash');var util=require(_0x0b0b('0x0'));var logger=require(_0x0b0b('0x1'))(_0x0b0b('0x2'));var moment=require(_0x0b0b('0x3'));var BPromise=require(_0x0b0b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b0b('0x5'));var rimraf=require(_0x0b0b('0x6'));var config=require('../../config/environment');var attributes=require(_0x0b0b('0x7'));module['exports']=function(_0xa2462c,_0x107072){return _0xa2462c['define'](_0x0b0b('0x8'),attributes,{'tableName':_0x0b0b('0x9'),'paranoid':![],'indexes':[{'name':_0x0b0b('0xa'),'fields':[_0x0b0b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 28a2f31..34243ee 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 _0x0405=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x1efabf,_0x15d65a){var _0x1ee965=function(_0x11f411){while(--_0x11f411){_0x1efabf['push'](_0x1efabf['shift']());}};_0x1ee965(++_0x15d65a);}(_0x0405,0x75));var _0x5040=function(_0x3098b2,_0x57013d){_0x3098b2=_0x3098b2-0x0;var _0x2e95f5=_0x0405[_0x3098b2];return _0x2e95f5;};'use strict';var _=require(_0x5040('0x0'));var util=require('util');var moment=require(_0x5040('0x1'));var BPromise=require(_0x5040('0x2'));var rs=require(_0x5040('0x3'));var fs=require('fs');var Redis=require(_0x5040('0x4'));var db=require(_0x5040('0x5'))['db'];var utils=require(_0x5040('0x6'));var logger=require(_0x5040('0x7'))(_0x5040('0x8'));var config=require(_0x5040('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5040('0xa')][_0x5040('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4803ee,_0x463ed3,_0x3b2fb1){return new BPromise(function(_0x26f630,_0x5ed8e5){return client[_0x5040('0xc')](_0x4803ee,_0x3b2fb1)[_0x5040('0xd')](function(_0x3f5306){logger[_0x5040('0xe')](_0x5040('0xf'),_0x463ed3,_0x5040('0x10'));logger[_0x5040('0x11')](_0x5040('0x12'),_0x463ed3,_0x5040('0x10'),JSON[_0x5040('0x13')](_0x3f5306));if(_0x3f5306[_0x5040('0x14')]){if(_0x3f5306[_0x5040('0x14')]['code']===0x1f4){logger[_0x5040('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x463ed3,_0x3f5306['error'][_0x5040('0x15')]);return _0x5ed8e5(_0x3f5306[_0x5040('0x14')][_0x5040('0x15')]);}logger[_0x5040('0x14')](_0x5040('0xf'),_0x463ed3,_0x3f5306[_0x5040('0x14')]['message']);return _0x26f630(_0x3f5306[_0x5040('0x14')][_0x5040('0x15')]);}else{logger[_0x5040('0xe')](_0x5040('0xf'),_0x463ed3,'request\x20sent');_0x26f630(_0x3f5306[_0x5040('0x16')][_0x5040('0x15')]);}})[_0x5040('0x17')](function(_0x21813e){logger[_0x5040('0x14')](_0x5040('0xf'),_0x463ed3,_0x21813e);_0x5ed8e5(_0x21813e);});});} \ No newline at end of file +var _0x7790=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x7790,0x190));var _0x0779=function(_0xeb11fc,_0x368107){_0xeb11fc=_0xeb11fc-0x0;var _0x3d09d4=_0x7790[_0xeb11fc];return _0x3d09d4;};'use strict';var _=require(_0x0779('0x0'));var util=require(_0x0779('0x1'));var moment=require(_0x0779('0x2'));var BPromise=require('bluebird');var rs=require(_0x0779('0x3'));var fs=require('fs');var Redis=require(_0x0779('0x4'));var db=require(_0x0779('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0779('0x6'))(_0x0779('0x7'));var config=require(_0x0779('0x8'));var jayson=require(_0x0779('0x9'));var client=jayson[_0x0779('0xa')][_0x0779('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50a7bc,_0x28afe0,_0x551e95){return new BPromise(function(_0xdad8c,_0x32056b){return client[_0x0779('0xc')](_0x50a7bc,_0x551e95)[_0x0779('0xd')](function(_0x55efa3){logger[_0x0779('0xe')](_0x0779('0xf'),_0x28afe0,_0x0779('0x10'));logger['debug'](_0x0779('0x11'),_0x28afe0,'request\x20sent',JSON[_0x0779('0x12')](_0x55efa3));if(_0x55efa3['error']){if(_0x55efa3['error'][_0x0779('0x13')]===0x1f4){logger[_0x0779('0x14')](_0x0779('0xf'),_0x28afe0,_0x55efa3[_0x0779('0x14')][_0x0779('0x15')]);return _0x32056b(_0x55efa3[_0x0779('0x14')][_0x0779('0x15')]);}logger[_0x0779('0x14')](_0x0779('0xf'),_0x28afe0,_0x55efa3[_0x0779('0x14')][_0x0779('0x15')]);return _0xdad8c(_0x55efa3['error'][_0x0779('0x15')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x28afe0,_0x0779('0x10'));_0xdad8c(_0x55efa3[_0x0779('0x16')]['message']);}})[_0x0779('0x17')](function(_0x243525){logger[_0x0779('0x14')](_0x0779('0xf'),_0x28afe0,_0x243525);_0x32056b(_0x243525);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e506b8c..e618eb2 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['status','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','info','start','Online\x20apps:','map','filter','online','name','join'];(function(_0x29a5f4,_0x19fa25){var _0x307190=function(_0x1ee1ca){while(--_0x1ee1ca){_0x29a5f4['push'](_0x29a5f4['shift']());}};_0x307190(++_0x19fa25);}(_0xd8fb,0x13f));var _0xbd8f=function(_0x153877,_0x50653f){_0x153877=_0x153877-0x0;var _0x23b89c=_0xd8fb[_0x153877];return _0x23b89c;};'use strict';var _=require(_0xbd8f('0x0'));var mysqldb=require(_0xbd8f('0x1'));var rpc=require(_0xbd8f('0x2'));var config=require(_0xbd8f('0x3'));var logger=require(_0xbd8f('0x4'))('app');var pm2=require(_0xbd8f('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xbd8f('0x6'));var whatsapp=require(_0xbd8f('0x7'));var transcribe=require(_0xbd8f('0x8'));function main(){return mysqldb['db']['sequelize'][_0xbd8f('0x9')]()[_0xbd8f('0xa')](function(){return rpc['listen']();})[_0xbd8f('0xa')](function(_0x47234b){logger[_0xbd8f('0xb')](_0x47234b);return chat[_0xbd8f('0xc')]();})[_0xbd8f('0xa')](function(){return whatsapp['start']();})[_0xbd8f('0xa')](function(){return schedule[_0xbd8f('0xc')]();})['then'](function(){return transcribe[_0xbd8f('0xc')]();})[_0xbd8f('0xa')](function(_0x1ba1c5){logger[_0xbd8f('0xb')](_0x1ba1c5);return pm2[_0xbd8f('0xc')](pm2Config);})[_0xbd8f('0xa')](function(_0x3097d0){logger[_0xbd8f('0xb')](_0xbd8f('0xd'),_[_0xbd8f('0xe')](_[_0xbd8f('0xf')](_0x3097d0,{'status':_0xbd8f('0x10')}),_0xbd8f('0x11'))[_0xbd8f('0x12')]());logger[_0xbd8f('0xb')]('Offline\x20apps:',_[_0xbd8f('0xe')](_[_0xbd8f('0xf')](_0x3097d0,function(_0x1ef491){return _0x1ef491[_0xbd8f('0x13')]!==_0xbd8f('0x10');}),'name')[_0xbd8f('0x12')]()||'None');config[_0xbd8f('0x14')]&&require(_0xbd8f('0x15'))[_0xbd8f('0x16')]();require(_0xbd8f('0x17'))[_0xbd8f('0x16')]();})['catch'](function(_0x19cc53){logger['error'](_0xbd8f('0x18'),_0x19cc53);process[_0xbd8f('0x19')](0x1);});}main(); \ No newline at end of file +var _0x27b5=['Offline\x20apps:','map','status','online','None','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./rpc','./config/logger','./config/schedule','./config/schedule/whatsapp','then','listen','start','info','Online\x20apps:','name'];(function(_0x2b6893,_0x5dfdce){var _0x249363=function(_0x19d8a0){while(--_0x19d8a0){_0x2b6893['push'](_0x2b6893['shift']());}};_0x249363(++_0x5dfdce);}(_0x27b5,0x7a));var _0x527b=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x27b5[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x527b('0x0'));var config=require('./config/environment');var logger=require(_0x527b('0x1'))('app');var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x527b('0x2'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x527b('0x3'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize']['sync']()[_0x527b('0x4')](function(){return rpc[_0x527b('0x5')]();})[_0x527b('0x4')](function(_0x1ee901){logger['info'](_0x1ee901);return chat[_0x527b('0x6')]();})[_0x527b('0x4')](function(){return whatsapp[_0x527b('0x6')]();})[_0x527b('0x4')](function(){return schedule[_0x527b('0x6')]();})[_0x527b('0x4')](function(){return transcribe[_0x527b('0x6')]();})[_0x527b('0x4')](function(_0x5e2eeb){logger[_0x527b('0x7')](_0x5e2eeb);return pm2[_0x527b('0x6')](pm2Config);})[_0x527b('0x4')](function(_0x4649a4){logger[_0x527b('0x7')](_0x527b('0x8'),_['map'](_['filter'](_0x4649a4,{'status':'online'}),_0x527b('0x9'))['join']());logger['info'](_0x527b('0xa'),_[_0x527b('0xb')](_['filter'](_0x4649a4,function(_0x3e9280){return _0x3e9280[_0x527b('0xc')]!==_0x527b('0xd');}),_0x527b('0x9'))['join']()||_0x527b('0xe'));config[_0x527b('0xf')]&&require(_0x527b('0x10'))[_0x527b('0x11')]();require(_0x527b('0x12'))[_0x527b('0x11')]();})['catch'](function(_0x2793b6){logger[_0x527b('0x13')](_0x527b('0x14'),_0x2793b6);process[_0x527b('0x15')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 30c1dc6..354175c 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 _0x84aa=['crypto','util','moment','secrets','session','role','fullname','name','internal','userpic','permissions','chatPause','mailPause','faxPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','then','status','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','find','authenticate','Wrong\x20credentials.','user','Bearer','json','Unknown\x20authorization\x20format','apikey','getUuid','query','User','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','options','verify','randomBytes','toString','hex','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','composable-middleware','basic-auth'];(function(_0xef07f1,_0x34dc3d){var _0x158468=function(_0x386d72){while(--_0x386d72){_0xef07f1['push'](_0xef07f1['shift']());}};_0x158468(++_0x34dc3d);}(_0x84aa,0x16f));var _0xa84a=function(_0x3933c5,_0x34a17d){_0x3933c5=_0x3933c5-0x0;var _0x3d8ef1=_0x84aa[_0x3933c5];return _0x3d8ef1;};'use strict';var db=require(_0xa84a('0x0'))['db'];var config=require(_0xa84a('0x1'));var hardwareConf=require(_0xa84a('0x2'));var licenseUtil=require(_0xa84a('0x3'));var encryptor=require(_0xa84a('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xa84a('0x5'));var compose=require(_0xa84a('0x6'));var basicAuth=require(_0xa84a('0x7'));var crypto=require(_0xa84a('0x8'));var BPromise=require('bluebird');var util=require(_0xa84a('0x9'));var moment=require(_0xa84a('0xa'));var validateJwt=expressJwt({'secret':config[_0xa84a('0xb')][_0xa84a('0xc')]});var userAttributes=['id',_0xa84a('0xd'),_0xa84a('0xe'),_0xa84a('0xf'),_0xa84a('0x10'),'email',_0xa84a('0x11'),_0xa84a('0x12'),'md5secret','voicePause',_0xa84a('0x13'),_0xa84a('0x14'),_0xa84a('0x15'),'smsPause','openchannelPause','pauseType',_0xa84a('0x16'),_0xa84a('0x17'),_0xa84a('0x18'),_0xa84a('0x19'),'allowmessenger',_0xa84a('0x1a'),_0xa84a('0x1b'),_0xa84a('0x1c'),_0xa84a('0x1d'),_0xa84a('0x1e'),_0xa84a('0x1f'),_0xa84a('0x20'),_0xa84a('0x21'),_0xa84a('0x22'),_0xa84a('0x23'),_0xa84a('0x24'),_0xa84a('0x25'),_0xa84a('0x26'),_0xa84a('0x27'),_0xa84a('0x28'),_0xa84a('0x29'),_0xa84a('0x2a'),'wssPort',_0xa84a('0x2b'),_0xa84a('0x2c'),_0xa84a('0x2d')];exports[_0xa84a('0x2e')]=function(){return this[_0xa84a('0x2f')](!![])[_0xa84a('0x30')](function(_0x3c0380,_0x51159d,_0x199ac0){if(_0x3c0380['user']){_0x199ac0();}else{return db[_0xa84a('0x31')][_0xa84a('0x32')]({'where':{'id':_0x3c0380[_0xa84a('0x33')]['id']},'attributes':['id',_0xa84a('0x34'),'disposition'],'raw':!![]})[_0xa84a('0x35')](function(_0x52f9f2){if(_0x52f9f2&&_0x52f9f2[_0xa84a('0x34')]){return _0x51159d[_0xa84a('0x36')](_0x52f9f2['disposition']===_0xa84a('0x37')?0x195:0x193)['json']({'message':_0x52f9f2['disposition']===_0xa84a('0x37')?_0xa84a('0x38'):_0xa84a('0x39')});}else{_0x199ac0();}})[_0xa84a('0x3a')](function(_0x2197b2){_0x199ac0(_0x2197b2);});}});};exports['isAuthenticated']=function isAuthenticated(_0x640cfc){return compose()['use'](function(_0x37f930,_0x214b73,_0xb64e12){var _0x3d28d8;if(_0x37f930['headers'][_0xa84a('0x3b')]){if(_[_0xa84a('0x3c')](_0x37f930[_0xa84a('0x3d')][_0xa84a('0x3b')],'Basic')){var _0x228808=basicAuth(_0x37f930);db['User'][_0xa84a('0x3e')]({'where':{'name':_0x228808[_0xa84a('0xf')]}})[_0xa84a('0x35')](function(_0x489672){if(!_0x489672||!_0x489672[_0xa84a('0x3f')](_0x228808['pass'])){return _0x214b73[_0xa84a('0x36')](0x191)['json']({'message':_0xa84a('0x40')});}_0x37f930[_0xa84a('0x41')]={'id':_0x489672['id']};_0xb64e12();})[_0xa84a('0x3a')](function(_0x1a1d50){_0xb64e12(_0x1a1d50);});}else if(_[_0xa84a('0x3c')](_0x37f930[_0xa84a('0x3d')]['authorization'],_0xa84a('0x42'))){validateJwt(_0x37f930,_0x214b73,_0xb64e12);}else{if(_0x640cfc){_0xb64e12();}else{return _0x214b73[_0xa84a('0x36')](0x193)[_0xa84a('0x43')]({'message':_0xa84a('0x44')});}}}else if(_0x37f930['query'][_0xa84a('0x45')]){try{var _0xecfdc1={'audience':hardwareConf[_0xa84a('0x46')](),'issuer':hardwareConf[_0xa84a('0x46')]()};verifyJwt(_0x37f930[_0xa84a('0x47')][_0xa84a('0x45')],_0xecfdc1)['then'](function(_0x2119f4){return db[_0xa84a('0x48')][_0xa84a('0x3e')]({'where':{'id':_0x2119f4['sub']}})[_0xa84a('0x35')](function(_0x1fa2a4){_0x3d28d8=_0x1fa2a4;return db[_0xa84a('0x49')][_0xa84a('0x32')]({'where':{'id':0x1},'attributes':[_0xa84a('0x4a'),_0xa84a('0x4b')],'raw':!![]});})[_0xa84a('0x35')](function(_0x403373){if(!_0x3d28d8||!_[_0xa84a('0x4c')](_0x3d28d8[_0xa84a('0x4d')],_0x2119f4[_0xa84a('0x4e')])){return _0x214b73[_0xa84a('0x36')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3d28d8[_0xa84a('0x4f')]){return _0x214b73[_0xa84a('0x36')](0x191)[_0xa84a('0x43')]({'message':_0xa84a('0x50')});}if(_0x3d28d8['blocked']){if(_0x403373[_0xa84a('0x4b')]>0x0){if(moment(_0x3d28d8['blockedAt'])[_0xa84a('0x51')](_0x403373['blockDuration'],_0xa84a('0x52'))>moment()){return _0x214b73[_0xa84a('0x36')](0x191)[_0xa84a('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x214b73[_0xa84a('0x36')](0x191)[_0xa84a('0x43')]({'message':_0xa84a('0x50')});}}_0x37f930[_0xa84a('0x41')]={'id':_0x3d28d8['id']};_0xb64e12();});})[_0xa84a('0x3a')](function(){return _0x214b73[_0xa84a('0x36')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xdacf7){_0xb64e12(_0xdacf7);}}else if(_0x640cfc){_0xb64e12();}else{return _0x214b73[_0xa84a('0x36')](0x193)[_0xa84a('0x43')]({'message':_0xa84a('0x44')});}})[_0xa84a('0x30')](function(_0x1150e6,_0x247a7d,_0x3573f3){if(_0x1150e6['user']){db[_0xa84a('0x48')][_0xa84a('0x3e')]({'where':{'id':_0x1150e6[_0xa84a('0x41')]['id']},'attributes':userAttributes})['then'](function(_0x503ef7){if(!_0x503ef7){return _0x247a7d['status'](0x194)['json']({'message':_0xa84a('0x53')});}_0x1150e6[_0xa84a('0x41')]=_0x503ef7;_0x3573f3();})[_0xa84a('0x3a')](function(_0x1f223b){_0x3573f3(_0x1f223b);});}else if(_0x640cfc){_0x3573f3();}else{return _0x247a7d['status'](0x194)[_0xa84a('0x43')]({'message':_0xa84a('0x54')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x2a7982,_0x20f028,_0x4acf63){return licenseUtil[_0xa84a('0x55')]()[_0xa84a('0x35')](function(_0x1da73e){if(_0x1da73e['update']){_0x4acf63();}else{return _0x20f028[_0xa84a('0x36')](0x193)[_0xa84a('0x43')]({'message':_0xa84a('0x56')});}})[_0xa84a('0x3a')](function(_0x871fb3){_0x4acf63(_0x871fb3);});});};exports[_0xa84a('0x57')]=function(_0x30c6d4,_0x17f9b2,_0x46d13c){_0x30c6d4[_0xa84a('0x57')]=!![];return _0x46d13c();};exports[_0xa84a('0x58')]=function signToken(_0x457bf0){return signJwt(_0x457bf0);};exports['setTokenCookie']=function(_0x35d466,_0xe11941){if(!_0x35d466[_0xa84a('0x41')]){return _0xe11941[_0xa84a('0x36')](0x194)[_0xa84a('0x43')]({'message':_0xa84a('0x59')});}var _0x386a28={'payload':{'id':_0x35d466[_0xa84a('0x41')]['id'],'role':_0x35d466[_0xa84a('0x41')][_0xa84a('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x386a28)[_0xa84a('0x35')](function(_0x2888b3){_0xe11941[_0xa84a('0x5a')](_0xa84a('0x5b'),_0x2888b3);_0xe11941['redirect']('/dashboards/general');})[_0xa84a('0x3a')](function(_0x5a65c4){return _0xe11941[_0xa84a('0x36')](0x1f4)[_0xa84a('0x5c')](_0x5a65c4);});};exports[_0xa84a('0x5d')]=function(_0x2758cf){if(_[_0xa84a('0x5e')](_0x2758cf[_0xa84a('0x4d')])||_[_0xa84a('0x5e')](_0x2758cf[_0xa84a('0x5f')])){return null;}else{return createJwt(_0x2758cf);}};exports[_0xa84a('0x60')]=function(_0x1fb9af){_0x1fb9af['apiKeyNonce']=generateNonce();_0x1fb9af[_0xa84a('0x5f')]=generateIssuedAt();return createJwt(_0x1fb9af);};exports[_0xa84a('0x61')]=function(_0x4196b9,_0x5f4dd0){var _0x4a695f=_0x4196b9[_0xa84a('0x47')]['apikey'];if(_0x4a695f){var _0x53a816={'nonce':_0x5f4dd0[_0xa84a('0x4d')],'iat':_0x5f4dd0['apiKeyIat'],'audience':hardwareConf[_0xa84a('0x46')](),'issuer':hardwareConf[_0xa84a('0x46')]()};return verifyJwt(_0x4a695f,_0x53a816)[_0xa84a('0x35')](function(){return generateApiKey(_0x5f4dd0);});}else{throw{'message':_0xa84a('0x62')};}};exports[_0xa84a('0x63')]=function(_0x9beeff){var _0x3b7b86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3b7b86[_0xa84a('0x64')](_0x9beeff))throw new db[(_0xa84a('0x65'))][(_0xa84a('0x66'))](_0xa84a('0x67'));return;};exports[_0xa84a('0x68')]=function(_0x13ebc9,_0x18792b,_0x55c3fd){var _0x489bca=encryptor[_0xa84a('0x69')](_0x18792b)[_0xa84a('0x6a')](',');for(var _0xa459a=0x0;_0xa459a<_0x55c3fd;_0xa459a++){if(!_0x489bca[_0xa459a])break;if(_0x13ebc9[_0xa84a('0x6b')]()===_0x489bca[_0xa459a][_0xa84a('0x6b')]()){var _0x17d247=util[_0xa84a('0x6c')](_0xa84a('0x6d'),_0x55c3fd);if(_0x55c3fd===0x1){_0x17d247=_0xa84a('0x6e');}throw new db[(_0xa84a('0x65'))]['ValidationError'](_0x17d247);}}return;};exports[_0xa84a('0x6f')]=function(_0xa14b54,_0x7757d){var _0x4f5607=_0x7757d?encryptor[_0xa84a('0x69')](_0x7757d)[_0xa84a('0x6a')](','):[];if(_0x4f5607[_0xa84a('0x70')]===0x5){_0x4f5607[_0xa84a('0x71')](-0x1,0x1);}_0x4f5607[_0xa84a('0x72')](_0xa14b54);return encryptor[_0xa84a('0x73')](_0x4f5607[_0xa84a('0x74')](','));};function signJwt(_0x19315b){var _0x4ef9d1=BPromise[_0xa84a('0x75')](jwt[_0xa84a('0x76')],{'context':jwt});var _0x18e539=_0x19315b['secret']||config['secrets'][_0xa84a('0xc')];return new BPromise(function(_0x154f84,_0x6fec92){_0x4ef9d1(_0x19315b['payload'],_0x18e539,_0x19315b[_0xa84a('0x77')])[_0xa84a('0x35')](function(_0x37779a){_0x154f84(_0x37779a);})[_0xa84a('0x3a')](function(_0x1e6517){_0x6fec92(_0x1e6517);});});}function verifyJwt(_0x344146,_0xd94932,_0xd8bd80){var _0x2239db=BPromise['promisify'](jwt[_0xa84a('0x78')],{'context':jwt});var _0x6d88e9=_0xd8bd80||config[_0xa84a('0xb')][_0xa84a('0xc')];return new BPromise(function(_0x49dcc8,_0x3ece37){_0x2239db(_0x344146,_0x6d88e9,_0xd94932)[_0xa84a('0x35')](function(_0x55a872){_0x49dcc8(_0x55a872);})['catch'](function(_0x5344ad){_0x3ece37(_0x5344ad);});});}function generateNonce(){return crypto[_0xa84a('0x79')](0x10)[_0xa84a('0x7a')](_0xa84a('0x7b'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)['toString']();}function createJwt(_0x16b900){var _0x238132={'payload':{'iat':_0x16b900['apiKeyIat'],'nonce':_0x16b900[_0xa84a('0x4d')]},'options':{'algorithm':_0xa84a('0x7c'),'subject':_0x16b900['id'][_0xa84a('0x7a')](),'issuer':hardwareConf[_0xa84a('0x46')](),'audience':hardwareConf[_0xa84a('0x46')]()}};return signJwt(_0x238132)[_0xa84a('0x35')](function(_0x53cf7a){return{'iat':_0x16b900[_0xa84a('0x5f')],'nonce':_0x16b900[_0xa84a('0x4d')],'token':_0x53cf7a};});} \ No newline at end of file +var _0xe950=['apikey','getUuid','query','sub','Setting','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockDuration','blockedAt','minutes','User','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','/dashboards/general','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','length','splice','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','closed','status','json','Unmanaged.','catch','headers','authorization','Basic','find','authenticate','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format'];(function(_0x5e9f28,_0xf1d64){var _0x4e8a14=function(_0x23cb5a){while(--_0x23cb5a){_0x5e9f28['push'](_0x5e9f28['shift']());}};_0x4e8a14(++_0xf1d64);}(_0xe950,0x1a3));var _0x0e95=function(_0x3798c7,_0x172fc1){_0x3798c7=_0x3798c7-0x0;var _0x3dc2dd=_0xe950[_0x3798c7];return _0x3dc2dd;};'use strict';var db=require(_0x0e95('0x0'))['db'];var config=require(_0x0e95('0x1'));var hardwareConf=require(_0x0e95('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x0e95('0x3'));var _=require(_0x0e95('0x4'));var jwt=require(_0x0e95('0x5'));var expressJwt=require(_0x0e95('0x6'));var compose=require(_0x0e95('0x7'));var basicAuth=require(_0x0e95('0x8'));var crypto=require('crypto');var BPromise=require(_0x0e95('0x9'));var util=require('util');var moment=require(_0x0e95('0xa'));var validateJwt=expressJwt({'secret':config[_0x0e95('0xb')][_0x0e95('0xc')]});var userAttributes=['id',_0x0e95('0xd'),_0x0e95('0xe'),_0x0e95('0xf'),_0x0e95('0x10'),_0x0e95('0x11'),_0x0e95('0x12'),_0x0e95('0x13'),'md5secret','voicePause',_0x0e95('0x14'),_0x0e95('0x15'),_0x0e95('0x16'),'smsPause',_0x0e95('0x17'),_0x0e95('0x18'),'showWebBar',_0x0e95('0x19'),_0x0e95('0x1a'),_0x0e95('0x1b'),'allowmessenger','passwordResetAt',_0x0e95('0x1c'),_0x0e95('0x1d'),_0x0e95('0x1e'),_0x0e95('0x1f'),_0x0e95('0x20'),'phoneBarEnableDtmfTone',_0x0e95('0x21'),_0x0e95('0x22'),_0x0e95('0x23'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x0e95('0x24'),_0x0e95('0x25'),_0x0e95('0x26'),_0x0e95('0x27'),'settingsEnabled',_0x0e95('0x28'),_0x0e95('0x29'),_0x0e95('0x2a'),'downloadAttachments'];exports['isChatInteractionAuthorized']=function(){return this[_0x0e95('0x2b')](!![])[_0x0e95('0x2c')](function(_0x2b5e73,_0x9ef03c,_0x5b91b1){if(_0x2b5e73[_0x0e95('0x2d')]){_0x5b91b1();}else{return db[_0x0e95('0x2e')][_0x0e95('0x2f')]({'where':{'id':_0x2b5e73[_0x0e95('0x30')]['id']},'attributes':['id','closed',_0x0e95('0x31')],'raw':!![]})[_0x0e95('0x32')](function(_0x59115c){if(_0x59115c&&_0x59115c[_0x0e95('0x33')]){return _0x9ef03c[_0x0e95('0x34')](_0x59115c[_0x0e95('0x31')]==='unmanaged'?0x195:0x193)[_0x0e95('0x35')]({'message':_0x59115c[_0x0e95('0x31')]==='unmanaged'?_0x0e95('0x36'):'Forbidden.'});}else{_0x5b91b1();}})[_0x0e95('0x37')](function(_0x27c3f7){_0x5b91b1(_0x27c3f7);});}});};exports[_0x0e95('0x2b')]=function isAuthenticated(_0x547196){return compose()[_0x0e95('0x2c')](function(_0x40ae9c,_0x4a1560,_0x59d638){var _0x45553b;if(_0x40ae9c[_0x0e95('0x38')]['authorization']){if(_['startsWith'](_0x40ae9c[_0x0e95('0x38')][_0x0e95('0x39')],_0x0e95('0x3a'))){var _0x139b6f=basicAuth(_0x40ae9c);db['User'][_0x0e95('0x3b')]({'where':{'name':_0x139b6f[_0x0e95('0xf')]}})[_0x0e95('0x32')](function(_0x2365ad){if(!_0x2365ad||!_0x2365ad[_0x0e95('0x3c')](_0x139b6f['pass'])){return _0x4a1560[_0x0e95('0x34')](0x191)[_0x0e95('0x35')]({'message':_0x0e95('0x3d')});}_0x40ae9c[_0x0e95('0x2d')]={'id':_0x2365ad['id']};_0x59d638();})[_0x0e95('0x37')](function(_0x3683c3){_0x59d638(_0x3683c3);});}else if(_[_0x0e95('0x3e')](_0x40ae9c['headers'][_0x0e95('0x39')],_0x0e95('0x3f'))){validateJwt(_0x40ae9c,_0x4a1560,_0x59d638);}else{if(_0x547196){_0x59d638();}else{return _0x4a1560[_0x0e95('0x34')](0x193)[_0x0e95('0x35')]({'message':_0x0e95('0x40')});}}}else if(_0x40ae9c['query'][_0x0e95('0x41')]){try{var _0x42344c={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0e95('0x42')]()};verifyJwt(_0x40ae9c[_0x0e95('0x43')][_0x0e95('0x41')],_0x42344c)[_0x0e95('0x32')](function(_0x35873f){return db['User'][_0x0e95('0x3b')]({'where':{'id':_0x35873f[_0x0e95('0x44')]}})[_0x0e95('0x32')](function(_0x1cb801){_0x45553b=_0x1cb801;return db[_0x0e95('0x45')][_0x0e95('0x2f')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x0e95('0x32')](function(_0x390a8f){if(!_0x45553b||!_[_0x0e95('0x46')](_0x45553b['apiKeyNonce'],_0x35873f[_0x0e95('0x47')])){return _0x4a1560[_0x0e95('0x34')](0x191)[_0x0e95('0x35')]({'message':_0x0e95('0x48')});}if(_0x45553b[_0x0e95('0x49')]){return _0x4a1560[_0x0e95('0x34')](0x191)[_0x0e95('0x35')]({'message':_0x0e95('0x4a')});}if(_0x45553b['blocked']){if(_0x390a8f[_0x0e95('0x4b')]>0x0){if(moment(_0x45553b[_0x0e95('0x4c')])['add'](_0x390a8f['blockDuration'],_0x0e95('0x4d'))>moment()){return _0x4a1560[_0x0e95('0x34')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4a1560[_0x0e95('0x34')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x40ae9c['user']={'id':_0x45553b['id']};_0x59d638();});})[_0x0e95('0x37')](function(){return _0x4a1560[_0x0e95('0x34')](0x191)[_0x0e95('0x35')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x230cf5){_0x59d638(_0x230cf5);}}else if(_0x547196){_0x59d638();}else{return _0x4a1560[_0x0e95('0x34')](0x193)['json']({'message':_0x0e95('0x40')});}})['use'](function(_0x1b9754,_0x2b2182,_0x581f60){if(_0x1b9754[_0x0e95('0x2d')]){db[_0x0e95('0x4e')][_0x0e95('0x3b')]({'where':{'id':_0x1b9754[_0x0e95('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0x48bcbc){if(!_0x48bcbc){return _0x2b2182[_0x0e95('0x34')](0x194)[_0x0e95('0x35')]({'message':'User\x20not\x20found.'});}_0x1b9754[_0x0e95('0x2d')]=_0x48bcbc;_0x581f60();})[_0x0e95('0x37')](function(_0x50eddc){_0x581f60(_0x50eddc);});}else if(_0x547196){_0x581f60();}else{return _0x2b2182['status'](0x194)['json']({'message':_0x0e95('0x4f')});}});};exports[_0x0e95('0x50')]=function canUpdate(){return compose()['use'](function(_0x19a6fe,_0x34bb32,_0x582fcc){return licenseUtil[_0x0e95('0x51')]()[_0x0e95('0x32')](function(_0x463565){if(_0x463565[_0x0e95('0x52')]){_0x582fcc();}else{return _0x34bb32[_0x0e95('0x34')](0x193)[_0x0e95('0x35')]({'message':_0x0e95('0x53')});}})[_0x0e95('0x37')](function(_0x267d02){_0x582fcc(_0x267d02);});});};exports[_0x0e95('0x54')]=function(_0x20ece3,_0x2e89e9,_0x34ca40){_0x20ece3[_0x0e95('0x54')]=!![];return _0x34ca40();};exports[_0x0e95('0x55')]=function signToken(_0x3ce13e){return signJwt(_0x3ce13e);};exports[_0x0e95('0x56')]=function(_0x4b9525,_0x9ff264){if(!_0x4b9525[_0x0e95('0x2d')]){return _0x9ff264[_0x0e95('0x34')](0x194)[_0x0e95('0x35')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3e1710={'payload':{'id':_0x4b9525['user']['id'],'role':_0x4b9525['user'][_0x0e95('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3e1710)['then'](function(_0x409b85){_0x9ff264[_0x0e95('0x57')](_0x0e95('0x58'),_0x409b85);_0x9ff264['redirect'](_0x0e95('0x59'));})[_0x0e95('0x37')](function(_0x3dc416){return _0x9ff264[_0x0e95('0x34')](0x1f4)['send'](_0x3dc416);});};exports[_0x0e95('0x5a')]=function(_0x4c4c44){if(_['isNil'](_0x4c4c44[_0x0e95('0x5b')])||_[_0x0e95('0x5c')](_0x4c4c44[_0x0e95('0x5d')])){return null;}else{return createJwt(_0x4c4c44);}};exports['generateApiKey']=function(_0x24c6d6){_0x24c6d6[_0x0e95('0x5b')]=generateNonce();_0x24c6d6[_0x0e95('0x5d')]=generateIssuedAt();return createJwt(_0x24c6d6);};exports[_0x0e95('0x5e')]=function(_0x45e210,_0x2b35cb){var _0xa963f=_0x45e210[_0x0e95('0x43')][_0x0e95('0x41')];if(_0xa963f){var _0x3a6f92={'nonce':_0x2b35cb[_0x0e95('0x5b')],'iat':_0x2b35cb[_0x0e95('0x5d')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0e95('0x42')]()};return verifyJwt(_0xa963f,_0x3a6f92)[_0x0e95('0x32')](function(){return generateApiKey(_0x2b35cb);});}else{throw{'message':_0x0e95('0x5f')};}};exports['validatePasswordPattern']=function(_0x4258b4){var _0x57fdf6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x57fdf6[_0x0e95('0x60')](_0x4258b4))throw new db[(_0x0e95('0x61'))]['ValidationError'](_0x0e95('0x62'));return;};exports[_0x0e95('0x63')]=function(_0xf0e33d,_0x2df207,_0x4fd975){var _0x283b94=encryptor['decryptString'](_0x2df207)[_0x0e95('0x64')](',');for(var _0x28e9be=0x0;_0x28e9be<_0x4fd975;_0x28e9be++){if(!_0x283b94[_0x28e9be])break;if(_0xf0e33d[_0x0e95('0x65')]()===_0x283b94[_0x28e9be][_0x0e95('0x65')]()){var _0x279950=util[_0x0e95('0x66')](_0x0e95('0x67'),_0x4fd975);if(_0x4fd975===0x1){_0x279950=_0x0e95('0x68');}throw new db[(_0x0e95('0x61'))][(_0x0e95('0x69'))](_0x279950);}}return;};exports['updatePasswordsHistory']=function(_0x22dcf1,_0x57a668){var _0x2d74a5=_0x57a668?encryptor['decryptString'](_0x57a668)['split'](','):[];if(_0x2d74a5[_0x0e95('0x6a')]===0x5){_0x2d74a5[_0x0e95('0x6b')](-0x1,0x1);}_0x2d74a5['unshift'](_0x22dcf1);return encryptor[_0x0e95('0x6c')](_0x2d74a5[_0x0e95('0x6d')](','));};function signJwt(_0x5ecefc){var _0x43853e=BPromise[_0x0e95('0x6e')](jwt[_0x0e95('0x6f')],{'context':jwt});var _0x11d982=_0x5ecefc[_0x0e95('0x70')]||config[_0x0e95('0xb')][_0x0e95('0xc')];return new BPromise(function(_0x3dd81a,_0x55840b){_0x43853e(_0x5ecefc[_0x0e95('0x71')],_0x11d982,_0x5ecefc[_0x0e95('0x72')])[_0x0e95('0x32')](function(_0x5969d8){_0x3dd81a(_0x5969d8);})[_0x0e95('0x37')](function(_0x5c15a5){_0x55840b(_0x5c15a5);});});}function verifyJwt(_0x419e02,_0x4bd649,_0x16fa8a){var _0x3c986a=BPromise[_0x0e95('0x6e')](jwt[_0x0e95('0x73')],{'context':jwt});var _0x47f0ea=_0x16fa8a||config['secrets'][_0x0e95('0xc')];return new BPromise(function(_0x5b79df,_0x40d583){_0x3c986a(_0x419e02,_0x47f0ea,_0x4bd649)[_0x0e95('0x32')](function(_0x96226a){_0x5b79df(_0x96226a);})[_0x0e95('0x37')](function(_0x4cb956){_0x40d583(_0x4cb956);});});}function generateNonce(){return crypto[_0x0e95('0x74')](0x10)[_0x0e95('0x75')]('hex');}function generateIssuedAt(){return Math[_0x0e95('0x76')](Date[_0x0e95('0x77')]()/0x3e8)[_0x0e95('0x75')]();}function createJwt(_0x44b848){var _0x1bc325={'payload':{'iat':_0x44b848[_0x0e95('0x5d')],'nonce':_0x44b848['apiKeyNonce']},'options':{'algorithm':_0x0e95('0x78'),'subject':_0x44b848['id']['toString'](),'issuer':hardwareConf[_0x0e95('0x42')](),'audience':hardwareConf[_0x0e95('0x42')]()}};return signJwt(_0x1bc325)['then'](function(_0x5f497e){return{'iat':_0x44b848['apiKeyIat'],'nonce':_0x44b848[_0x0e95('0x5b')],'token':_0x5f497e};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c034f48..73f2474 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 _0x2758=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','binary','final','write','end','close','unlink','createDecipher','encryptString','secret','createCipher','utf8','base64','decryptString','bluebird','lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','algorithm','encrypt','join'];(function(_0x4e0e28,_0x25d82b){var _0x2a7b9e=function(_0xf86da9){while(--_0xf86da9){_0x4e0e28['push'](_0x4e0e28['shift']());}};_0x2a7b9e(++_0x25d82b);}(_0x2758,0x1d6));var _0x8275=function(_0x43164d,_0x57917a){_0x43164d=_0x43164d-0x0;var _0x59aa1f=_0x2758[_0x43164d];return _0x59aa1f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x8275('0x0'));var _=require(_0x8275('0x1'));var config=require(_0x8275('0x2'));var logger=require('../../config/logger')(_0x8275('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8275('0x4')]['session'],'algorithm':_0x8275('0x5')};const fileOptions={'algorithm':_0x8275('0x6')};if(config['encrypt']&&config['encrypt'][_0x8275('0x7')]){var isSupported=isAlgorithmSupported(config[_0x8275('0x8')]['algorithm']);if(isSupported){fileOptions[_0x8275('0x7')]=config[_0x8275('0x8')][_0x8275('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8275('0x9')](',\x20');logger['error'](config[_0x8275('0x8')][_0x8275('0x7')],_0x8275('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x5ac203){return AES_SUPPORTED_RX['test'](_0x5ac203);}function getSupportedCiphers(){return crypto[_0x8275('0xb')]()[_0x8275('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x777f7){return getSupportedCiphers()[_0x8275('0xd')](_0x777f7)>-0x1;}function combineOptions(_0x30afa5){var _0x4ab985={};for(var _0x232ded in fileOptions){if(fileOptions[_0x8275('0xe')](_0x232ded)){_0x4ab985[_0x232ded]=fileOptions[_0x232ded];}}if(_0x30afa5){for(var _0x580940 in _0x30afa5){if(_0x30afa5[_0x8275('0xe')](_0x580940)){_0x4ab985[_0x580940]=_0x30afa5[_0x580940];}}}return _0x4ab985;}exports['encryptFile']=function(_0x234773,_0x5c411a,_0x17bd24,_0xf33470){return new BPromise(function(_0x23ed30,_0x27c314){_0xf33470=combineOptions(_0xf33470);var _0x5413c7=new Buffer(_0x17bd24);var _0x20d255=fs[_0x8275('0xf')](_0x234773);var _0x20d5a7=fs[_0x8275('0x10')](_0x5c411a);var _0x179bc2=crypto['createCipher'](_0xf33470['algorithm'],_0x5413c7);_0x20d255['on'](_0x8275('0x11'),function(_0x50d47d){var _0x4811c7=new Buffer(_0x179bc2[_0x8275('0x12')](_0x50d47d),_0x8275('0x13'));_0x20d5a7['write'](_0x4811c7);});_0x20d255['on']('end',function(){try{var _0x423637=new Buffer(_0x179bc2[_0x8275('0x14')](_0x8275('0x13')),_0x8275('0x13'));_0x20d5a7[_0x8275('0x15')](_0x423637);_0x20d5a7[_0x8275('0x16')]();_0x20d5a7['on'](_0x8275('0x17'),function(){return _0x23ed30(_0x5c411a);});}catch(_0x1254f8){fs[_0x8275('0x18')](_0x5c411a);return _0x27c314(_0x1254f8);}});});};exports['decryptFile']=function(_0x246a07,_0x468536,_0xb39c67,_0x4922d7){return new BPromise(function(_0x2d13c0,_0x42d83a){_0x4922d7=combineOptions(_0x4922d7);var _0x3e2457=new Buffer(_0xb39c67);var _0x457dba=fs[_0x8275('0xf')](_0x246a07);var _0x22be1b=fs[_0x8275('0x10')](_0x468536);var _0x3829c4=crypto[_0x8275('0x19')](_0x4922d7[_0x8275('0x7')],_0x3e2457);_0x457dba['on']('data',function(_0x53683b){var _0x543e6d=new Buffer(_0x3829c4['update'](_0x53683b),_0x8275('0x13'));_0x22be1b[_0x8275('0x15')](_0x543e6d);});_0x457dba['on'](_0x8275('0x16'),function(){try{var _0x8d10cb=new Buffer(_0x3829c4['final'](_0x8275('0x13')),_0x8275('0x13'));_0x22be1b[_0x8275('0x15')](_0x8d10cb);_0x22be1b[_0x8275('0x16')]();_0x22be1b['on'](_0x8275('0x17'),function(){return _0x2d13c0(_0x468536);});}catch(_0xb69038){fs[_0x8275('0x18')](_0x468536);return _0x42d83a(_0xb69038);}});});};exports[_0x8275('0x1a')]=function(_0xda9a09,_0x593db8,_0x473104){var _0x259bc2=_0x473104||stringOptions[_0x8275('0x7')];var _0x4f0296=_0x593db8||stringOptions[_0x8275('0x1b')];var _0x14fe73=crypto[_0x8275('0x1c')](_0x259bc2,_0x4f0296);var _0x471a3f=_0x14fe73[_0x8275('0x12')](_0xda9a09,_0x8275('0x1d'),_0x8275('0x1e'));_0x471a3f+=_0x14fe73[_0x8275('0x14')]('base64');return _0x471a3f;};exports[_0x8275('0x1f')]=function(_0x4861ca,_0x4f1ed7,_0x4383a2){var _0x3e6e5f=_0x4383a2||stringOptions[_0x8275('0x7')];var _0x5d332e=_0x4f1ed7||stringOptions['secret'];var _0x27b327=crypto[_0x8275('0x19')](_0x3e6e5f,_0x5d332e);var _0x336613=_0x27b327['update'](_0x4861ca,_0x8275('0x1e'),'utf8');_0x336613+=_0x27b327[_0x8275('0x14')]('utf8');return _0x336613;}; \ No newline at end of file +var _0xed77=['crypto','bluebird','lodash','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','test','filter','hasOwnProperty','createReadStream','createCipher','data','binary','write','end','final','close','unlink','createWriteStream','createDecipher','update','encryptString','secret','utf8','base64','decryptString'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xed77,0x14a));var _0x7ed7=function(_0x406f05,_0xd78ba1){_0x406f05=_0x406f05-0x0;var _0x11a26c=_0xed77[_0x406f05];return _0x11a26c;};'use strict';var crypto=require(_0x7ed7('0x0'));var fs=require('fs');var BPromise=require(_0x7ed7('0x1'));var _=require(_0x7ed7('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7ed7('0x3')][_0x7ed7('0x4')],'algorithm':_0x7ed7('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0x7ed7('0x6')]&&config[_0x7ed7('0x6')][_0x7ed7('0x7')]){var isSupported=isAlgorithmSupported(config[_0x7ed7('0x6')][_0x7ed7('0x7')]);if(isSupported){fileOptions[_0x7ed7('0x7')]=config[_0x7ed7('0x6')][_0x7ed7('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7ed7('0x8')](',\x20');logger[_0x7ed7('0x9')](config['encrypt']['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x49afec){return AES_SUPPORTED_RX[_0x7ed7('0xa')](_0x49afec);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x7ed7('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3e9c96){return getSupportedCiphers()['indexOf'](_0x3e9c96)>-0x1;}function combineOptions(_0xab0764){var _0xfb1109={};for(var _0x253b6b in fileOptions){if(fileOptions[_0x7ed7('0xc')](_0x253b6b)){_0xfb1109[_0x253b6b]=fileOptions[_0x253b6b];}}if(_0xab0764){for(var _0x42054a in _0xab0764){if(_0xab0764[_0x7ed7('0xc')](_0x42054a)){_0xfb1109[_0x42054a]=_0xab0764[_0x42054a];}}}return _0xfb1109;}exports['encryptFile']=function(_0x2e4207,_0x3d4b6b,_0x301f2e,_0x3f4ac9){return new BPromise(function(_0x462ed5,_0x140a74){_0x3f4ac9=combineOptions(_0x3f4ac9);var _0x2e0dc7=new Buffer(_0x301f2e);var _0x4612a0=fs[_0x7ed7('0xd')](_0x2e4207);var _0x5b2463=fs['createWriteStream'](_0x3d4b6b);var _0x47c518=crypto[_0x7ed7('0xe')](_0x3f4ac9[_0x7ed7('0x7')],_0x2e0dc7);_0x4612a0['on'](_0x7ed7('0xf'),function(_0x390e1d){var _0x406781=new Buffer(_0x47c518['update'](_0x390e1d),_0x7ed7('0x10'));_0x5b2463[_0x7ed7('0x11')](_0x406781);});_0x4612a0['on'](_0x7ed7('0x12'),function(){try{var _0x59c389=new Buffer(_0x47c518[_0x7ed7('0x13')](_0x7ed7('0x10')),_0x7ed7('0x10'));_0x5b2463[_0x7ed7('0x11')](_0x59c389);_0x5b2463['end']();_0x5b2463['on'](_0x7ed7('0x14'),function(){return _0x462ed5(_0x3d4b6b);});}catch(_0x2bf4fd){fs[_0x7ed7('0x15')](_0x3d4b6b);return _0x140a74(_0x2bf4fd);}});});};exports['decryptFile']=function(_0x1836a9,_0x45effe,_0x117888,_0x29ff0f){return new BPromise(function(_0x33da64,_0x306d01){_0x29ff0f=combineOptions(_0x29ff0f);var _0x136e3c=new Buffer(_0x117888);var _0x28822f=fs['createReadStream'](_0x1836a9);var _0x3cb548=fs[_0x7ed7('0x16')](_0x45effe);var _0x306004=crypto[_0x7ed7('0x17')](_0x29ff0f[_0x7ed7('0x7')],_0x136e3c);_0x28822f['on'](_0x7ed7('0xf'),function(_0x565c79){var _0x425e4d=new Buffer(_0x306004[_0x7ed7('0x18')](_0x565c79),_0x7ed7('0x10'));_0x3cb548[_0x7ed7('0x11')](_0x425e4d);});_0x28822f['on'](_0x7ed7('0x12'),function(){try{var _0x564da2=new Buffer(_0x306004[_0x7ed7('0x13')](_0x7ed7('0x10')),_0x7ed7('0x10'));_0x3cb548['write'](_0x564da2);_0x3cb548[_0x7ed7('0x12')]();_0x3cb548['on'](_0x7ed7('0x14'),function(){return _0x33da64(_0x45effe);});}catch(_0x414617){fs['unlink'](_0x45effe);return _0x306d01(_0x414617);}});});};exports[_0x7ed7('0x19')]=function(_0x518758,_0x47023d,_0x392af8){var _0x14e11c=_0x392af8||stringOptions['algorithm'];var _0x564412=_0x47023d||stringOptions[_0x7ed7('0x1a')];var _0x1c33e4=crypto[_0x7ed7('0xe')](_0x14e11c,_0x564412);var _0x5271f4=_0x1c33e4['update'](_0x518758,_0x7ed7('0x1b'),_0x7ed7('0x1c'));_0x5271f4+=_0x1c33e4[_0x7ed7('0x13')]('base64');return _0x5271f4;};exports[_0x7ed7('0x1d')]=function(_0x10140d,_0x175a0b,_0x546a69){var _0x53a887=_0x546a69||stringOptions[_0x7ed7('0x7')];var _0x2b7212=_0x175a0b||stringOptions[_0x7ed7('0x1a')];var _0x559687=crypto[_0x7ed7('0x17')](_0x53a887,_0x2b7212);var _0x5798ae=_0x559687[_0x7ed7('0x18')](_0x10140d,_0x7ed7('0x1c'),_0x7ed7('0x1b'));_0x5798ae+=_0x559687[_0x7ed7('0x13')](_0x7ed7('0x1b'));return _0x5798ae;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 219e5ae..79b4555 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 _0xfcc0=['each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','split','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync'];(function(_0x12cbd8,_0x8ef0ce){var _0x2fb1ab=function(_0x57242c){while(--_0x57242c){_0x12cbd8['push'](_0x12cbd8['shift']());}};_0x2fb1ab(++_0x8ef0ce);}(_0xfcc0,0x10b));var _0x0fcc=function(_0x3550b4,_0x59b309){_0x3550b4=_0x3550b4-0x0;var _0x237bca=_0xfcc0[_0x3550b4];return _0x237bca;};'use strict';var util=require(_0x0fcc('0x0'));var path=require(_0x0fcc('0x1'));var _=require('lodash');var csv=require(_0x0fcc('0x2'));var fs=require('fs');var BPromise=require(_0x0fcc('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x0fcc('0x4'));var db=require(_0x0fcc('0x5'))['db'];var dbH=require(_0x0fcc('0x5'))[_0x0fcc('0x6')];var logger=require(_0x0fcc('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0fcc('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0fcc('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x20b5a6,_0xd45d3a){var _0x53caf0={'status':_0x20b5a6};var _0xfee349={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xd45d3a){_0x53caf0[_0x0fcc('0x9')]=_0xd45d3a;}return db[_0x0fcc('0xa')][_0x0fcc('0xb')](_0x53caf0,_0xfee349);}function main(){var _0x226b58=0x1388;var _0x342b2a;logger[_0x0fcc('0xc')](util[_0x0fcc('0xd')](_0x0fcc('0xe'),EXTRACTED_REPORT_ID,_0x0fcc('0xf')));return db[_0x0fcc('0x10')][_0x0fcc('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0fcc('0x12')]})['then'](function(_0x5b6afc){if(_0x5b6afc){_0x342b2a=_0x5b6afc;_0x226b58=_0x342b2a[_0x0fcc('0x12')]||0x1388;}})[_0x0fcc('0x13')](function(){return dbH[_0x0fcc('0x14')][_0x0fcc('0x15')](util[_0x0fcc('0xd')](_0x0fcc('0x16'),QUERY),{'type':dbH[_0x0fcc('0x14')][_0x0fcc('0x17')][_0x0fcc('0x18')]});})[_0x0fcc('0x13')](function(_0x27fefd){if(!_0x27fefd[0x0]['num']){return analyticExtractedReport(_0x0fcc('0x19'));}var _0x402194=[];var _0x577cff=0x0;if(_0x342b2a[_0x0fcc('0x1a')]){if(_0x27fefd&&_0x27fefd[_0x0fcc('0x1b')]){var _0x25d049=_[_0x0fcc('0x1c')](_0x27fefd[0x0][_0x0fcc('0x1d')]/_0x226b58);var _0x276db1=Number[_0x0fcc('0x1e')](_0x27fefd[0x0][_0x0fcc('0x1d')]/_0x226b58)?_0x27fefd[0x0][_0x0fcc('0x1d')]%_0x226b58:0x0;_0x25d049[_0x0fcc('0x1f')](function(_0x518269){if(_0x518269>0x0){_0x577cff+=_0x226b58;}_0x402194[_0x0fcc('0x20')](dbH[_0x0fcc('0x14')]['query'](util[_0x0fcc('0xd')](_0x0fcc('0x21'),QUERY,_0x226b58,_0x577cff),{'type':dbH['sequelize'][_0x0fcc('0x17')]['SELECT']}));});if(_0x276db1>0x0){_0x577cff+=_0x226b58;_0x402194[_0x0fcc('0x20')](dbH[_0x0fcc('0x14')][_0x0fcc('0x15')](util[_0x0fcc('0xd')](_0x0fcc('0x21'),QUERY,_0x276db1,_0x577cff),{'type':dbH[_0x0fcc('0x14')]['QueryTypes'][_0x0fcc('0x18')]}));}}}else{_0x402194[_0x0fcc('0x20')](dbH[_0x0fcc('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0x0fcc('0x17')][_0x0fcc('0x18')]}));}var _0x22c7de=path[_0x0fcc('0x22')](PATH);var _0xad6622=path[_0x0fcc('0x23')](PATH,_0x0fcc('0x24'));var _0x1e6116=_0x342b2a[_0x0fcc('0x1a')]&&_0x402194[_0x0fcc('0x1b')]>0x1;var _0x23fa68=[];if(!fs['existsSync'](path[_0x0fcc('0x25')](_0x22c7de,_0xad6622))&&_0x1e6116){fs[_0x0fcc('0x26')](path[_0x0fcc('0x25')](_0x22c7de,_0xad6622));}return BPromise[_0x0fcc('0x27')](_0x402194,function(_0x3fa954){_0x23fa68[_0x0fcc('0x20')](_0x3fa954);})[_0x0fcc('0x13')](function(){for(var _0x2c0889=0x0;_0x2c0889<_0x23fa68[_0x0fcc('0x1b')];_0x2c0889+=0x1){var _0x1ec9bd;var _0x447a2c=_0x23fa68[_0x2c0889];if(_0x1e6116){_0x1ec9bd=path[_0x0fcc('0x25')](_0x22c7de,_0xad6622,util[_0x0fcc('0xd')]('%s%d.%s',_0xad6622,_0x2c0889,_0x0fcc('0x28')));}else{_0x1ec9bd=path['join'](_0x22c7de,util[_0x0fcc('0xd')](_0x0fcc('0x29'),_0xad6622,_0x0fcc('0x28')));}fs[_0x0fcc('0x2a')](_0x1ec9bd,csv(_0x447a2c));}})['then'](function(){if(_0x1e6116){return new Promise(function(_0x2c5f7c){zipdir(path[_0x0fcc('0x25')](_0x22c7de,_0xad6622),{'saveTo':path['join'](_0x22c7de,util[_0x0fcc('0xd')](_0x0fcc('0x29'),_0xad6622,_0x0fcc('0x2b')))},function(_0x1f826c,_0x4b2075){rimraf(path['join'](_0x22c7de,_0xad6622),function(){});_0x2c5f7c('zip\x20finished');});});}})[_0x0fcc('0x13')](function(){logger[_0x0fcc('0xc')](util[_0x0fcc('0xd')](_0x0fcc('0x2c'),EXTRACTED_REPORT_ID,_0x0fcc('0xf')));return analyticExtractedReport(_0x0fcc('0x2d'),_0x1e6116?util['format'](_0x0fcc('0x29'),_0xad6622,_0x1e6116?_0x0fcc('0x2b'):_0x0fcc('0x28')):null);});})[_0x0fcc('0x2e')](function(_0x47deeb){logger[_0x0fcc('0xc')](util[_0x0fcc('0xd')](_0x0fcc('0x2f'),EXTRACTED_REPORT_ID,_0x0fcc('0xf')),util[_0x0fcc('0x30')](_0x47deeb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0fcc('0x31'));})[_0x0fcc('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd81b=['%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','csv'];(function(_0x5803a4,_0x1ea2b7){var _0x196edc=function(_0x568326){while(--_0x568326){_0x5803a4['push'](_0x5803a4['shift']());}};_0x196edc(++_0x1ea2b7);}(_0xd81b,0x1c5));var _0xbd81=function(_0x58a7b2,_0xa6b1c4){_0x58a7b2=_0x58a7b2-0x0;var _0x424d50=_0xd81b[_0x58a7b2];return _0x424d50;};'use strict';var util=require('util');var path=require(_0xbd81('0x0'));var _=require(_0xbd81('0x1'));var csv=require(_0xbd81('0x2'));var fs=require('fs');var BPromise=require(_0xbd81('0x3'));var zipdir=require(_0xbd81('0x4'));var rimraf=require(_0xbd81('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xbd81('0x6'))(_0xbd81('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xbd81('0x8')][0x2]);var QUERY=process[_0xbd81('0x8')][0x3];var PATH=process[_0xbd81('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3ef89f,_0x4e92ae){var _0x2d37bd={'status':_0x3ef89f};var _0x367d52={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e92ae){_0x2d37bd['savename']=_0x4e92ae;}return db[_0xbd81('0x9')][_0xbd81('0xa')](_0x2d37bd,_0x367d52);}function main(){var _0x39b06d=0x1388;var _0x3a100a;logger[_0xbd81('0xb')](util['format'](_0xbd81('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xbd81('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbd81('0xe'),'splitSizeCsv']})['then'](function(_0x2fab21){if(_0x2fab21){_0x3a100a=_0x2fab21;_0x39b06d=_0x3a100a[_0xbd81('0xf')]||0x1388;}})[_0xbd81('0x10')](function(){return dbH[_0xbd81('0x11')]['query'](util[_0xbd81('0x12')](_0xbd81('0x13'),QUERY),{'type':dbH[_0xbd81('0x11')][_0xbd81('0x14')][_0xbd81('0x15')]});})[_0xbd81('0x10')](function(_0x351ddf){if(!_0x351ddf[0x0]['num']){return analyticExtractedReport('Empty');}var _0x2fecbb=[];var _0x27b620=0x0;if(_0x3a100a['split']){if(_0x351ddf&&_0x351ddf[_0xbd81('0x16')]){var _0x3d8081=_[_0xbd81('0x17')](_0x351ddf[0x0][_0xbd81('0x18')]/_0x39b06d);var _0x4b535f=Number[_0xbd81('0x19')](_0x351ddf[0x0]['num']/_0x39b06d)?_0x351ddf[0x0][_0xbd81('0x18')]%_0x39b06d:0x0;_0x3d8081[_0xbd81('0x1a')](function(_0x515754){if(_0x515754>0x0){_0x27b620+=_0x39b06d;}_0x2fecbb[_0xbd81('0x1b')](dbH[_0xbd81('0x11')][_0xbd81('0x1c')](util[_0xbd81('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x39b06d,_0x27b620),{'type':dbH[_0xbd81('0x11')][_0xbd81('0x14')][_0xbd81('0x15')]}));});if(_0x4b535f>0x0){_0x27b620+=_0x39b06d;_0x2fecbb[_0xbd81('0x1b')](dbH['sequelize'][_0xbd81('0x1c')](util[_0xbd81('0x12')](_0xbd81('0x1d'),QUERY,_0x4b535f,_0x27b620),{'type':dbH[_0xbd81('0x11')][_0xbd81('0x14')][_0xbd81('0x15')]}));}}}else{_0x2fecbb[_0xbd81('0x1b')](dbH[_0xbd81('0x11')][_0xbd81('0x1c')](QUERY,{'type':dbH[_0xbd81('0x11')][_0xbd81('0x14')][_0xbd81('0x15')]}));}var _0x3c5cd3=path['dirname'](PATH);var _0x821752=path[_0xbd81('0x1e')](PATH,_0xbd81('0x1f'));var _0x58e9cb=_0x3a100a[_0xbd81('0xe')]&&_0x2fecbb['length']>0x1;var _0x357850=[];if(!fs[_0xbd81('0x20')](path[_0xbd81('0x21')](_0x3c5cd3,_0x821752))&&_0x58e9cb){fs[_0xbd81('0x22')](path['join'](_0x3c5cd3,_0x821752));}return BPromise[_0xbd81('0x23')](_0x2fecbb,function(_0x4ffad0){_0x357850[_0xbd81('0x1b')](_0x4ffad0);})['then'](function(){for(var _0x54dd1f=0x0;_0x54dd1f<_0x357850[_0xbd81('0x16')];_0x54dd1f+=0x1){var _0x526bf9;var _0xea4727=_0x357850[_0x54dd1f];if(_0x58e9cb){_0x526bf9=path['join'](_0x3c5cd3,_0x821752,util['format']('%s%d.%s',_0x821752,_0x54dd1f,_0xbd81('0x24')));}else{_0x526bf9=path[_0xbd81('0x21')](_0x3c5cd3,util[_0xbd81('0x12')](_0xbd81('0x25'),_0x821752,_0xbd81('0x24')));}fs[_0xbd81('0x26')](_0x526bf9,csv(_0xea4727));}})[_0xbd81('0x10')](function(){if(_0x58e9cb){return new Promise(function(_0x16e2b0){zipdir(path[_0xbd81('0x21')](_0x3c5cd3,_0x821752),{'saveTo':path['join'](_0x3c5cd3,util['format'](_0xbd81('0x25'),_0x821752,_0xbd81('0x27')))},function(_0x5a1031,_0x3892b5){rimraf(path[_0xbd81('0x21')](_0x3c5cd3,_0x821752),function(){});_0x16e2b0(_0xbd81('0x28'));});});}})['then'](function(){logger[_0xbd81('0xb')](util[_0xbd81('0x12')](_0xbd81('0x29'),EXTRACTED_REPORT_ID,_0xbd81('0x2a')));return analyticExtractedReport('Completed',_0x58e9cb?util[_0xbd81('0x12')]('%s.%s',_0x821752,_0x58e9cb?_0xbd81('0x27'):_0xbd81('0x24')):null);});})[_0xbd81('0x2b')](function(_0x3a9417){logger[_0xbd81('0xb')](util[_0xbd81('0x12')](_0xbd81('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util[_0xbd81('0x2d')](_0x3a9417,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbd81('0x2e'));})[_0xbd81('0x2f')](function(){process[_0xbd81('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d57d4d1..d462be8 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 _0x43bf=['mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','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','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','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','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','auto','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','Empty','Setting','find','split','splitSizePdf','then','length','range','isInteger','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','.pdf','existsSync','join'];(function(_0x4f7438,_0x2cba14){var _0x5d5104=function(_0x17bbbd){while(--_0x17bbbd){_0x4f7438['push'](_0x4f7438['shift']());}};_0x5d5104(++_0x2cba14);}(_0x43bf,0x84));var _0xf43b=function(_0x40e0d6,_0xb1e94b){_0x40e0d6=_0x40e0d6-0x0;var _0x32cfe8=_0x43bf[_0x40e0d6];return _0x32cfe8;};'use strict';var _=require(_0xf43b('0x0'));var fs=require('fs');var util=require(_0xf43b('0x1'));var path=require(_0xf43b('0x2'));var moment=require(_0xf43b('0x3'));var htmlToPdfmake=require(_0xf43b('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xf43b('0x5'));var rimraf=require(_0xf43b('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xf43b('0x7')];var BPromise=require(_0xf43b('0x8'));var db=require(_0xf43b('0x9'))['db'];var dbH=require(_0xf43b('0x9'))[_0xf43b('0xa')];var logger=require('../../config/logger')(_0xf43b('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xf43b('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf43b('0xc')][0x4];var NAME=process[_0xf43b('0xc')][0x5];var FORMAT=_0xf43b('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3c521f,_0x149078){var _0x126d10={'status':_0x3c521f};var _0xac0f84={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x149078){_0x126d10[_0xf43b('0xe')]=_0x149078;}return db[_0xf43b('0xf')][_0xf43b('0x10')](_0x126d10,_0xac0f84);}function getHeaders(_0x14861e){return _[_0xf43b('0x11')](_0x14861e,function(_0x3769e8){return{'text':_0x3769e8,'style':'tableHeader'};});}function getRows(_0x4b74a9,_0x40bdd1){return _[_0xf43b('0x11')](_0x40bdd1,function(_0xb0b7fb){return _(_0xb0b7fb)[_0xf43b('0x12')](_0x4b74a9)[_0xf43b('0x11')](function(_0x40ffed){return _0x40ffed?_[_0xf43b('0x13')](_0x40ffed):'';})[_0xf43b('0x14')]();});}function createTable(_0xb42969,_0x12696b){var _0x1d23fd={'widths':_[_0xf43b('0x15')](Array(_0xb42969['length']),0x91),'heights':function(_0x15f8d4){return _0x15f8d4===0x0?_0xf43b('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x35f8d5=getHeaders(_0xb42969);_0x1d23fd[_0xf43b('0x17')]['push'](_0x35f8d5);var _0x56e9bd=getRows(_0xb42969,_0x12696b);_0x1d23fd[_0xf43b('0x17')]=_0x1d23fd['body'][_0xf43b('0x18')](_0x56e9bd);return _0x1d23fd;}function createTables(_0x1c2fb6){var _0x40288a=[];var _0x18c48e=_[_0xf43b('0x19')](Object[_0xf43b('0x1a')](_0x1c2fb6[0x0]),0x5);_0x18c48e['forEach'](function(_0x318c85){_0x40288a[_0xf43b('0x1b')](createTable(_0x318c85,_0x1c2fb6));});return _0x40288a;}function getPDFDocDefinition(_0x30f71e){var _0x44fac7=util[_0xf43b('0x1c')](_0xf43b('0x1d'),NAME,EXTRACTED_REPORT[_0xf43b('0x1e')],moment(EXTRACTED_REPORT[_0xf43b('0x1f')])[_0xf43b('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xf43b('0x20')])[_0xf43b('0x1c')](FORMAT));var _0x5c623f=[];for(var _0x311931=0x0;_0x311931<_0x30f71e['length'];_0x311931++){var _0x18b0f9=[];if(_0x311931===0x0){_0x18b0f9[_0xf43b('0x1b')]({'text':_0x44fac7,'style':'header'});}var _0x1960c9={'table':_0x30f71e[_0x311931]};if(_0x311931>0x0){_0x1960c9[_0xf43b('0x21')]=_0xf43b('0x22');_0x1960c9[_0xf43b('0x23')]=[0x0,0x46,0x0,0x0];}_0x18b0f9[_0xf43b('0x1b')](_0x1960c9);_0x5c623f[_0xf43b('0x1b')](_0x18b0f9);}return{'pageSize':'A4','pageOrientation':_0xf43b('0x24'),'content':_0x5c623f,'footer':function(_0x329cdd,_0x50a413){return{'text':_0x329cdd['toString']()+_0xf43b('0x25')+_0x50a413,'style':_0xf43b('0x26')};},'defaultStyle':{'font':_0xf43b('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf43b('0x28')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1023df){var _0x4d61a=0x1388;var _0x597aa7;if(!_0x1023df[0x0]['num']){return analyticExtractedReport(_0xf43b('0x29'));}return db[_0xf43b('0x2a')][_0xf43b('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf43b('0x2c'),_0xf43b('0x2d')]})[_0xf43b('0x2e')](function(_0x410342){if(_0x410342){_0x597aa7=_0x410342;_0x4d61a=_0x597aa7[_0xf43b('0x2d')]||0x3e8;}})[_0xf43b('0x2e')](function(){var _0x369acc=[];var _0x570c5b=0x0;if(_0x597aa7['split']){if(_0x1023df&&_0x1023df[_0xf43b('0x2f')]){var _0x57bcda=_[_0xf43b('0x30')](_0x1023df[0x0]['num']/_0x4d61a);var _0x5a7f26=Number[_0xf43b('0x31')](_0x1023df[0x0][_0xf43b('0x32')]/_0x4d61a)?_0x1023df[0x0][_0xf43b('0x32')]%_0x4d61a:0x0;_0x57bcda['forEach'](function(_0x446729){if(_0x446729>0x0){_0x570c5b+=_0x4d61a;}_0x369acc[_0xf43b('0x1b')](dbH['sequelize'][_0xf43b('0x33')](util[_0xf43b('0x1c')](_0xf43b('0x34'),QUERY,_0x4d61a,_0x570c5b),{'type':dbH['sequelize'][_0xf43b('0x35')][_0xf43b('0x36')]}));});if(_0x5a7f26>0x0){_0x570c5b+=_0x4d61a;_0x369acc[_0xf43b('0x1b')](dbH[_0xf43b('0x37')]['query'](util[_0xf43b('0x1c')](_0xf43b('0x34'),QUERY,_0x5a7f26,_0x570c5b),{'type':dbH[_0xf43b('0x37')]['QueryTypes']['SELECT']}));}}}else{_0x369acc[_0xf43b('0x1b')](dbH['sequelize'][_0xf43b('0x33')](QUERY,{'type':dbH[_0xf43b('0x37')][_0xf43b('0x35')][_0xf43b('0x36')]}));}var _0x1e961a=path[_0xf43b('0x38')](PATH);var _0x1f1cc8=path['basename'](PATH,_0xf43b('0x39'));var _0x44f7d5=_0x597aa7[_0xf43b('0x2c')]&&_0x369acc[_0xf43b('0x2f')]>0x1;var _0x4cc809=[];if(!fs[_0xf43b('0x3a')](path[_0xf43b('0x3b')](_0x1e961a,_0x1f1cc8))&&_0x44f7d5){fs[_0xf43b('0x3c')](path[_0xf43b('0x3b')](_0x1e961a,_0x1f1cc8));}return BPromise[_0xf43b('0x3d')](_0x369acc,function(_0x27b82c){_0x4cc809[_0xf43b('0x1b')](_0x27b82c);})[_0xf43b('0x2e')](function(){var _0x2b7619=[];for(var _0x33f9d5=0x0;_0x33f9d5<_0x4cc809[_0xf43b('0x2f')];_0x33f9d5+=0x1){var _0x21fc09=_0x4cc809[_0x33f9d5];var _0x3c6c99=createTables(_[_0xf43b('0x3e')](_0x21fc09));var _0x29b558;var _0x4f99bd=getPDFDocDefinition(_0x3c6c99);var _0x12537f=getPDFPrinter();var _0x19aa63=_0x12537f[_0xf43b('0x3f')](_0x4f99bd);if(_0x44f7d5){_0x29b558=path[_0xf43b('0x3b')](_0x1e961a,_0x1f1cc8,util[_0xf43b('0x1c')](_0xf43b('0x40'),_0x1f1cc8,_0x33f9d5,_0xf43b('0x41')));}else{_0x29b558=path[_0xf43b('0x3b')](_0x1e961a,util[_0xf43b('0x1c')](_0xf43b('0x42'),_0x1f1cc8,_0xf43b('0x41')));}_0x2b7619[_0xf43b('0x1b')](writePDFDocument(_0x19aa63,_0x29b558));}return Promise[_0xf43b('0x43')](_0x2b7619);})['then'](function(){if(_0x44f7d5){return new Promise(function(_0x4b748d){zipdir(path['join'](_0x1e961a,_0x1f1cc8),{'saveTo':path['join'](_0x1e961a,util[_0xf43b('0x1c')](_0xf43b('0x42'),_0x1f1cc8,_0xf43b('0x44')))},function(){rimraf(path[_0xf43b('0x3b')](_0x1e961a,_0x1f1cc8),function(){});_0x4b748d(_0xf43b('0x45'));});});}})[_0xf43b('0x2e')](function(){if(!_0x44f7d5)return;rimraf(path[_0xf43b('0x3b')](_0x1e961a,_0x1f1cc8),function(){});})[_0xf43b('0x2e')](function(){logger[_0xf43b('0x46')](util[_0xf43b('0x1c')](_0xf43b('0x47'),EXTRACTED_REPORT_ID,_0xf43b('0x48')));return analyticExtractedReport(_0xf43b('0x49'),_0x44f7d5?util[_0xf43b('0x1c')](_0xf43b('0x42'),_0x1f1cc8,_0x44f7d5?_0xf43b('0x44'):_0xf43b('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf43b('0x46')](util['format'](_0xf43b('0x4a'),EXTRACTED_REPORT_ID,_0xf43b('0x48')));return db[_0xf43b('0xf')][_0xf43b('0x4b')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x431e87){EXTRACTED_REPORT=_0x431e87;return dbH[_0xf43b('0x37')][_0xf43b('0x33')](util[_0xf43b('0x1c')](_0xf43b('0x4c'),QUERY),{'type':dbH['sequelize'][_0xf43b('0x35')]['SELECT']});})[_0xf43b('0x2e')](extractReport)[_0xf43b('0x4d')](function(_0x4efc82){logger[_0xf43b('0x46')](util[_0xf43b('0x1c')](_0xf43b('0x4e'),EXTRACTED_REPORT_ID,_0xf43b('0x48')),util['inspect'](_0x4efc82,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf43b('0x4f'));})[_0xf43b('0x50')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x46d31c=new PdfPrinter({'Arial':{'normal':__dirname+_0xf43b('0x51'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xf43b('0x52'),'bolditalics':__dirname+_0xf43b('0x53')}});return _0x46d31c;}function getPDFDocDefinitionFromHTML(_0x169f4c,_0x43ab40){var _0x5a0d88=util['format']('%s\x20#%d',_0x43ab40['channel'],_0x43ab40[_0xf43b('0x54')]);var _0x26b26a=moment()[_0xf43b('0x1c')](_0xf43b('0x55'))[_0xf43b('0x13')]();var _0xd964da=htmlToPdfmake(_0x169f4c,{'window':window,'tableAutoSize':!![]});return{'content':[_0xd964da],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf43b('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf43b('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf43b('0x56')}},'header':function(){return[{'text':_0xf43b('0x57'),'style':_0xf43b('0x58')}];},'footer':function(_0x57c189,_0x405c3a){return[{'text':util[_0xf43b('0x1c')](_0xf43b('0x59'),_0x5a0d88,_0x57c189,_0x405c3a,_0x26b26a),'style':_0xf43b('0x26')}];}};}function writePDFDocument(_0x2ec880,_0x4e9970){return new Promise(function(_0x22b7cb,_0x37f7eb){var _0x12f304=_0x2ec880[_0xf43b('0x5a')](fs[_0xf43b('0x5b')](_0x4e9970));_0x12f304['on'](_0xf43b('0x5c'),function(){_0x22b7cb(_0xf43b('0x5c'));});_0x12f304['on'](_0xf43b('0x5d'),function(_0x2e2c68){_0x37f7eb(_0x2e2c68);});_0x2ec880[_0xf43b('0x5e')]();});}exports[_0xf43b('0x5f')]=function(_0x5afbf5,_0x37e59c){var _0x23f2f8=getPDFPrinter();var _0x30e2a1=getPDFDocDefinitionFromHTML(_0x5afbf5,_0x37e59c);var _0x5c3e61=_0x23f2f8['createPdfKitDocument'](_0x30e2a1);return writePDFDocument(_0x5c3e61,_0x37e59c['path'])[_0xf43b('0x4d')](function(_0x449e96){throw _0x449e96;});}; \ No newline at end of file +var _0x711d=['../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','toString','value','fill','auto','body','push','concat','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','pageBreak','before','landscape','Arial','black','num','Empty','Setting','find','split','splitSizePdf','length','range','isInteger','forEach','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','dirname','existsSync','join','each','then','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','util','path','moment','pdfmake/src/printer','rimraf','bluebird','../../mysqldb','dbH'];(function(_0xb7932c,_0x3ff87a){var _0x5e14c1=function(_0x25f5ac){while(--_0x25f5ac){_0xb7932c['push'](_0xb7932c['shift']());}};_0x5e14c1(++_0x3ff87a);}(_0x711d,0x19c));var _0xd711=function(_0x50b691,_0x5a07d0){_0x50b691=_0x50b691-0x0;var _0x489bbb=_0x711d[_0x50b691];return _0x489bbb;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xd711('0x0'));var path=require(_0xd711('0x1'));var moment=require(_0xd711('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xd711('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd711('0x4'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0xd711('0x5'));var db=require(_0xd711('0x6'))['db'];var dbH=require(_0xd711('0x6'))[_0xd711('0x7')];var logger=require(_0xd711('0x8'))(_0xd711('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xd711('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd711('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xd711('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5bffd4,_0x46e1e7){var _0x61bd0d={'status':_0x5bffd4};var _0x401e9d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x46e1e7){_0x61bd0d[_0xd711('0xc')]=_0x46e1e7;}return db[_0xd711('0xd')]['update'](_0x61bd0d,_0x401e9d);}function getHeaders(_0x50bfd8){return _[_0xd711('0xe')](_0x50bfd8,function(_0x17b64a){return{'text':_0x17b64a,'style':_0xd711('0xf')};});}function getRows(_0x534d47,_0x3e5d38){return _[_0xd711('0xe')](_0x3e5d38,function(_0xe4b650){return _(_0xe4b650)['pick'](_0x534d47)[_0xd711('0xe')](function(_0x2a4750){return _0x2a4750?_[_0xd711('0x10')](_0x2a4750):'';})[_0xd711('0x11')]();});}function createTable(_0x3f2616,_0x5f499b){var _0xb86e72={'widths':_[_0xd711('0x12')](Array(_0x3f2616['length']),0x91),'heights':function(_0xa23fcd){return _0xa23fcd===0x0?_0xd711('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2e5c75=getHeaders(_0x3f2616);_0xb86e72[_0xd711('0x14')][_0xd711('0x15')](_0x2e5c75);var _0x1869e9=getRows(_0x3f2616,_0x5f499b);_0xb86e72['body']=_0xb86e72[_0xd711('0x14')][_0xd711('0x16')](_0x1869e9);return _0xb86e72;}function createTables(_0x323c8b){var _0x41405b=[];var _0x443542=_['chunk'](Object[_0xd711('0x17')](_0x323c8b[0x0]),0x5);_0x443542['forEach'](function(_0xbeaeb5){_0x41405b[_0xd711('0x15')](createTable(_0xbeaeb5,_0x323c8b));});return _0x41405b;}function getPDFDocDefinition(_0x2467ee){var _0x3247f0=util[_0xd711('0x18')](_0xd711('0x19'),NAME,EXTRACTED_REPORT[_0xd711('0x1a')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x5098b2=[];for(var _0x2e70f2=0x0;_0x2e70f2<_0x2467ee['length'];_0x2e70f2++){var _0x316aeb=[];if(_0x2e70f2===0x0){_0x316aeb['push']({'text':_0x3247f0,'style':'header'});}var _0x292c5f={'table':_0x2467ee[_0x2e70f2]};if(_0x2e70f2>0x0){_0x292c5f[_0xd711('0x1b')]=_0xd711('0x1c');_0x292c5f['margin']=[0x0,0x46,0x0,0x0];}_0x316aeb[_0xd711('0x15')](_0x292c5f);_0x5098b2[_0xd711('0x15')](_0x316aeb);}return{'pageSize':'A4','pageOrientation':_0xd711('0x1d'),'content':_0x5098b2,'footer':function(_0x5f4956,_0x49a8c0){return{'text':_0x5f4956[_0xd711('0x10')]()+'\x20/\x20'+_0x49a8c0,'style':'footer'};},'defaultStyle':{'font':_0xd711('0x1e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd711('0x1f')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x17d99c){var _0x5ac237=0x1388;var _0x7cbf2;if(!_0x17d99c[0x0][_0xd711('0x20')]){return analyticExtractedReport(_0xd711('0x21'));}return db[_0xd711('0x22')][_0xd711('0x23')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd711('0x24'),'splitSizePdf']})['then'](function(_0x1340ef){if(_0x1340ef){_0x7cbf2=_0x1340ef;_0x5ac237=_0x7cbf2[_0xd711('0x25')]||0x3e8;}})['then'](function(){var _0x1c7386=[];var _0x4cdb7f=0x0;if(_0x7cbf2[_0xd711('0x24')]){if(_0x17d99c&&_0x17d99c[_0xd711('0x26')]){var _0x4c09d4=_[_0xd711('0x27')](_0x17d99c[0x0][_0xd711('0x20')]/_0x5ac237);var _0x1bf1a0=Number[_0xd711('0x28')](_0x17d99c[0x0]['num']/_0x5ac237)?_0x17d99c[0x0][_0xd711('0x20')]%_0x5ac237:0x0;_0x4c09d4[_0xd711('0x29')](function(_0x52cd7c){if(_0x52cd7c>0x0){_0x4cdb7f+=_0x5ac237;}_0x1c7386[_0xd711('0x15')](dbH['sequelize'][_0xd711('0x2a')](util[_0xd711('0x18')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5ac237,_0x4cdb7f),{'type':dbH['sequelize']['QueryTypes'][_0xd711('0x2b')]}));});if(_0x1bf1a0>0x0){_0x4cdb7f+=_0x5ac237;_0x1c7386[_0xd711('0x15')](dbH['sequelize'][_0xd711('0x2a')](util[_0xd711('0x18')](_0xd711('0x2c'),QUERY,_0x1bf1a0,_0x4cdb7f),{'type':dbH[_0xd711('0x2d')][_0xd711('0x2e')][_0xd711('0x2b')]}));}}}else{_0x1c7386[_0xd711('0x15')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xd711('0x2d')][_0xd711('0x2e')][_0xd711('0x2b')]}));}var _0x4e5087=path[_0xd711('0x2f')](PATH);var _0x5a17a4=path['basename'](PATH,'.pdf');var _0x15656f=_0x7cbf2[_0xd711('0x24')]&&_0x1c7386[_0xd711('0x26')]>0x1;var _0xe33e5c=[];if(!fs[_0xd711('0x30')](path[_0xd711('0x31')](_0x4e5087,_0x5a17a4))&&_0x15656f){fs['mkdirSync'](path[_0xd711('0x31')](_0x4e5087,_0x5a17a4));}return BPromise[_0xd711('0x32')](_0x1c7386,function(_0x4094fe){_0xe33e5c['push'](_0x4094fe);})[_0xd711('0x33')](function(){var _0x2b1a93=[];for(var _0x2783a2=0x0;_0x2783a2<_0xe33e5c[_0xd711('0x26')];_0x2783a2+=0x1){var _0x13a011=_0xe33e5c[_0x2783a2];var _0x5ae561=createTables(_[_0xd711('0x34')](_0x13a011));var _0x1c60fa;var _0x4dc9f3=getPDFDocDefinition(_0x5ae561);var _0x45c8cc=getPDFPrinter();var _0x17904c=_0x45c8cc[_0xd711('0x35')](_0x4dc9f3);if(_0x15656f){_0x1c60fa=path[_0xd711('0x31')](_0x4e5087,_0x5a17a4,util[_0xd711('0x18')](_0xd711('0x36'),_0x5a17a4,_0x2783a2,_0xd711('0x37')));}else{_0x1c60fa=path[_0xd711('0x31')](_0x4e5087,util[_0xd711('0x18')](_0xd711('0x38'),_0x5a17a4,_0xd711('0x37')));}_0x2b1a93[_0xd711('0x15')](writePDFDocument(_0x17904c,_0x1c60fa));}return Promise[_0xd711('0x39')](_0x2b1a93);})['then'](function(){if(_0x15656f){return new Promise(function(_0x382212){zipdir(path[_0xd711('0x31')](_0x4e5087,_0x5a17a4),{'saveTo':path['join'](_0x4e5087,util[_0xd711('0x18')](_0xd711('0x38'),_0x5a17a4,_0xd711('0x3a')))},function(){rimraf(path[_0xd711('0x31')](_0x4e5087,_0x5a17a4),function(){});_0x382212(_0xd711('0x3b'));});});}})[_0xd711('0x33')](function(){if(!_0x15656f)return;rimraf(path['join'](_0x4e5087,_0x5a17a4),function(){});})['then'](function(){logger[_0xd711('0x3c')](util[_0xd711('0x18')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd711('0x3d')));return analyticExtractedReport('Completed',_0x15656f?util[_0xd711('0x18')](_0xd711('0x38'),_0x5a17a4,_0x15656f?_0xd711('0x3a'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0xd711('0x3e'),EXTRACTED_REPORT_ID,_0xd711('0x3d')));return db['AnalyticExtractedReport'][_0xd711('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x209809){EXTRACTED_REPORT=_0x209809;return dbH[_0xd711('0x2d')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd711('0x2d')][_0xd711('0x2e')][_0xd711('0x2b')]});})['then'](extractReport)[_0xd711('0x40')](function(_0x1ff175){logger[_0xd711('0x3c')](util[_0xd711('0x18')](_0xd711('0x41'),EXTRACTED_REPORT_ID,_0xd711('0x3d')),util['inspect'](_0x1ff175,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd711('0x42'));})[_0xd711('0x43')](function(){process[_0xd711('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2e1158=new PdfPrinter({'Arial':{'normal':__dirname+_0xd711('0x45'),'bold':__dirname+_0xd711('0x46'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xd711('0x47')}});return _0x2e1158;}function getPDFDocDefinitionFromHTML(_0x62e61d,_0x2c1072){var _0x4ba251=util[_0xd711('0x18')](_0xd711('0x48'),_0x2c1072[_0xd711('0x49')],_0x2c1072[_0xd711('0x4a')]);var _0x5e6bd2=moment()[_0xd711('0x18')]('YYYY-MM-DD')[_0xd711('0x10')]();var _0x5a93f1=htmlToPdfmake(_0x62e61d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5a93f1],'defaultStyle':{'font':_0xd711('0x1e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd711('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xd711('0x4c'),'style':_0xd711('0x4d')}];},'footer':function(_0x244f9c,_0x401626){return[{'text':util[_0xd711('0x18')](_0xd711('0x4e'),_0x4ba251,_0x244f9c,_0x401626,_0x5e6bd2),'style':_0xd711('0x4f')}];}};}function writePDFDocument(_0x133fcb,_0x52a533){return new Promise(function(_0x5e97a6,_0x34ce63){var _0x4e6cb6=_0x133fcb['pipe'](fs[_0xd711('0x50')](_0x52a533));_0x4e6cb6['on']('finish',function(){_0x5e97a6(_0xd711('0x51'));});_0x4e6cb6['on'](_0xd711('0x52'),function(_0x2aa1c4){_0x34ce63(_0x2aa1c4);});_0x133fcb[_0xd711('0x53')]();});}exports['createPdfFromHTML']=function(_0xd2e971,_0x33e6ad){var _0x26aa5f=getPDFPrinter();var _0x5adc46=getPDFDocDefinitionFromHTML(_0xd2e971,_0x33e6ad);var _0x5a6e79=_0x26aa5f['createPdfKitDocument'](_0x5adc46);return writePDFDocument(_0x5a6e79,_0x33e6ad['path'])[_0xd711('0x40')](function(_0x25c133){throw _0x25c133;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2f75bdf..d62a1c0 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 _0xfcbb=['push','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','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','finally','exit','util','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x1ae4a3,_0x1148f5){var _0x4360a1=function(_0x7befce){while(--_0x7befce){_0x1ae4a3['push'](_0x1ae4a3['shift']());}};_0x4360a1(++_0x1148f5);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x44b341,_0x391b2f){_0x44b341=_0x44b341-0x0;var _0x2cc21d=_0xfcbb[_0x44b341];return _0x2cc21d;};'use strict';var util=require(_0xbfcb('0x0'));var path=require(_0xbfcb('0x1'));var _=require(_0xbfcb('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xbfcb('0x3'));var rimraf=require(_0xbfcb('0x4'));var db=require(_0xbfcb('0x5'))['db'];var dbH=require(_0xbfcb('0x5'))[_0xbfcb('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbfcb('0x7')][0x2]);var QUERY=process[_0xbfcb('0x7')][0x3];var PATH=process[_0xbfcb('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2df839,_0x288ee5){var _0x2f875c={'status':_0x2df839};var _0x49717b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x288ee5){_0x2f875c['savename']=_0x288ee5;}return db[_0xbfcb('0x8')][_0xbfcb('0x9')](_0x2f875c,_0x49717b);}function main(){var _0x346685=0x1388;var _0x52b2f8;logger[_0xbfcb('0xa')](util[_0xbfcb('0xb')](_0xbfcb('0xc'),EXTRACTED_REPORT_ID,_0xbfcb('0xd')));return db[_0xbfcb('0xe')][_0xbfcb('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xbfcb('0x10')]})[_0xbfcb('0x11')](function(_0xb2f601){if(_0xb2f601){_0x52b2f8=_0xb2f601;_0x346685=_0x52b2f8[_0xbfcb('0x10')]||0x1388;}})['then'](function(){return dbH[_0xbfcb('0x12')]['query'](util[_0xbfcb('0xb')](_0xbfcb('0x13'),QUERY),{'type':dbH[_0xbfcb('0x12')][_0xbfcb('0x14')][_0xbfcb('0x15')]});})[_0xbfcb('0x11')](function(_0x71304e){if(!_0x71304e[0x0][_0xbfcb('0x16')]){return analyticExtractedReport(_0xbfcb('0x17'));}var _0x339347=[];var _0x2c4a85=0x0;if(_0x52b2f8[_0xbfcb('0x18')]){if(_0x71304e&&_0x71304e[_0xbfcb('0x19')]){var _0x41dc15=_[_0xbfcb('0x1a')](_0x71304e[0x0][_0xbfcb('0x16')]/_0x346685);var _0xba1d6=Number[_0xbfcb('0x1b')](_0x71304e[0x0][_0xbfcb('0x16')]/_0x346685)?_0x71304e[0x0][_0xbfcb('0x16')]%_0x346685:0x0;_0x41dc15[_0xbfcb('0x1c')](function(_0x25afa3){if(_0x25afa3>0x0){_0x2c4a85+=_0x346685;}_0x339347['push'](dbH[_0xbfcb('0x12')][_0xbfcb('0x1d')](util['format'](_0xbfcb('0x1e'),QUERY,_0x346685,_0x2c4a85),{'type':dbH[_0xbfcb('0x12')]['QueryTypes']['SELECT']}));});if(_0xba1d6>0x0){_0x2c4a85+=_0x346685;_0x339347[_0xbfcb('0x1f')](dbH[_0xbfcb('0x12')][_0xbfcb('0x1d')](util[_0xbfcb('0xb')](_0xbfcb('0x1e'),QUERY,_0xba1d6,_0x2c4a85),{'type':dbH['sequelize'][_0xbfcb('0x14')][_0xbfcb('0x15')]}));}}}else{_0x339347[_0xbfcb('0x1f')](dbH[_0xbfcb('0x12')][_0xbfcb('0x1d')](QUERY,{'type':dbH[_0xbfcb('0x12')][_0xbfcb('0x14')][_0xbfcb('0x15')]}));}var _0x11f6f7=path[_0xbfcb('0x20')](PATH);var _0x1ca8c3=path[_0xbfcb('0x21')](PATH,_0xbfcb('0x22'));var _0x121a90=_0x52b2f8[_0xbfcb('0x18')]&&_0x339347[_0xbfcb('0x19')]>0x1;var _0x5cd703=[];if(!fs[_0xbfcb('0x23')](path[_0xbfcb('0x24')](_0x11f6f7,_0x1ca8c3))&&_0x121a90){fs['mkdirSync'](path[_0xbfcb('0x24')](_0x11f6f7,_0x1ca8c3));}return BPromise[_0xbfcb('0x25')](_0x339347,function(_0x781773){_0x5cd703[_0xbfcb('0x1f')](_0x781773);})[_0xbfcb('0x11')](function(){for(var _0x3542e9=0x0;_0x3542e9<_0x5cd703[_0xbfcb('0x19')];_0x3542e9+=0x1){var _0x1a5db2;var _0x434764=_0x5cd703[_0x3542e9];if(_0x121a90){_0x1a5db2=path[_0xbfcb('0x24')](_0x11f6f7,_0x1ca8c3,util['format'](_0xbfcb('0x26'),_0x1ca8c3,_0x3542e9,_0xbfcb('0x27')));}else{_0x1a5db2=path[_0xbfcb('0x24')](_0x11f6f7,util[_0xbfcb('0xb')](_0xbfcb('0x28'),_0x1ca8c3,_0xbfcb('0x27')));}fs[_0xbfcb('0x29')](_0x1a5db2,json2xls(_0x434764),_0xbfcb('0x2a'));}})[_0xbfcb('0x11')](function(){if(_0x121a90){return new Promise(function(_0x5be764){zipdir(path[_0xbfcb('0x24')](_0x11f6f7,_0x1ca8c3),{'saveTo':path[_0xbfcb('0x24')](_0x11f6f7,util[_0xbfcb('0xb')](_0xbfcb('0x28'),_0x1ca8c3,'zip'))},function(_0x5aa2dd,_0x30cf97){rimraf(path[_0xbfcb('0x24')](_0x11f6f7,_0x1ca8c3),function(){});_0x5be764(_0xbfcb('0x2b'));});});}})[_0xbfcb('0x11')](function(){logger[_0xbfcb('0xa')](util[_0xbfcb('0xb')](_0xbfcb('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x121a90?util['format'](_0xbfcb('0x28'),_0x1ca8c3,_0x121a90?'zip':_0xbfcb('0x27')):null);});})[_0xbfcb('0x2d')](function(_0x505b0d){logger['info'](util[_0xbfcb('0xb')](_0xbfcb('0x2e'),EXTRACTED_REPORT_ID,_0xbfcb('0xd')),util[_0xbfcb('0x2f')](_0x505b0d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xbfcb('0x30')](function(){process[_0xbfcb('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6582=['Empty','split','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num'];(function(_0xba02ee,_0x5a97e7){var _0x15ea10=function(_0x5d6530){while(--_0x5d6530){_0xba02ee['push'](_0xba02ee['shift']());}};_0x15ea10(++_0x5a97e7);}(_0x6582,0x108));var _0x2658=function(_0x4bf27a,_0x435cc2){_0x4bf27a=_0x4bf27a-0x0;var _0x22a0ba=_0x6582[_0x4bf27a];return _0x22a0ba;};'use strict';var util=require(_0x2658('0x0'));var path=require(_0x2658('0x1'));var _=require(_0x2658('0x2'));var fs=require('fs');var json2xls=require(_0x2658('0x3'));var BPromise=require(_0x2658('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x2658('0x5'));var db=require(_0x2658('0x6'))['db'];var dbH=require(_0x2658('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2658('0x7')][0x2]);var QUERY=process[_0x2658('0x7')][0x3];var PATH=process[_0x2658('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f53e7,_0x443df){var _0x412a9f={'status':_0x3f53e7};var _0x52ef38={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x443df){_0x412a9f[_0x2658('0x8')]=_0x443df;}return db[_0x2658('0x9')][_0x2658('0xa')](_0x412a9f,_0x52ef38);}function main(){var _0x99b9db=0x1388;var _0x455ff9;logger[_0x2658('0xb')](util[_0x2658('0xc')](_0x2658('0xd'),EXTRACTED_REPORT_ID,_0x2658('0xe')));return db['Setting'][_0x2658('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2658('0x10')]})[_0x2658('0x11')](function(_0x263852){if(_0x263852){_0x455ff9=_0x263852;_0x99b9db=_0x455ff9[_0x2658('0x10')]||0x1388;}})[_0x2658('0x11')](function(){return dbH[_0x2658('0x12')][_0x2658('0x13')](util['format'](_0x2658('0x14'),QUERY),{'type':dbH[_0x2658('0x12')][_0x2658('0x15')][_0x2658('0x16')]});})[_0x2658('0x11')](function(_0x59013b){if(!_0x59013b[0x0][_0x2658('0x17')]){return analyticExtractedReport(_0x2658('0x18'));}var _0x15bd54=[];var _0x496524=0x0;if(_0x455ff9[_0x2658('0x19')]){if(_0x59013b&&_0x59013b[_0x2658('0x1a')]){var _0x3ebf10=_[_0x2658('0x1b')](_0x59013b[0x0]['num']/_0x99b9db);var _0x4eb90d=Number['isInteger'](_0x59013b[0x0][_0x2658('0x17')]/_0x99b9db)?_0x59013b[0x0][_0x2658('0x17')]%_0x99b9db:0x0;_0x3ebf10[_0x2658('0x1c')](function(_0x2cab3b){if(_0x2cab3b>0x0){_0x496524+=_0x99b9db;}_0x15bd54['push'](dbH[_0x2658('0x12')][_0x2658('0x13')](util[_0x2658('0xc')](_0x2658('0x1d'),QUERY,_0x99b9db,_0x496524),{'type':dbH[_0x2658('0x12')][_0x2658('0x15')]['SELECT']}));});if(_0x4eb90d>0x0){_0x496524+=_0x99b9db;_0x15bd54[_0x2658('0x1e')](dbH['sequelize']['query'](util[_0x2658('0xc')](_0x2658('0x1d'),QUERY,_0x4eb90d,_0x496524),{'type':dbH['sequelize'][_0x2658('0x15')]['SELECT']}));}}}else{_0x15bd54[_0x2658('0x1e')](dbH[_0x2658('0x12')][_0x2658('0x13')](QUERY,{'type':dbH[_0x2658('0x12')][_0x2658('0x15')][_0x2658('0x16')]}));}var _0xe9f81=path[_0x2658('0x1f')](PATH);var _0x2496bf=path[_0x2658('0x20')](PATH,'.xlsx');var _0x2062ef=_0x455ff9[_0x2658('0x19')]&&_0x15bd54[_0x2658('0x1a')]>0x1;var _0x3d251e=[];if(!fs[_0x2658('0x21')](path[_0x2658('0x22')](_0xe9f81,_0x2496bf))&&_0x2062ef){fs['mkdirSync'](path[_0x2658('0x22')](_0xe9f81,_0x2496bf));}return BPromise[_0x2658('0x23')](_0x15bd54,function(_0x2a3141){_0x3d251e[_0x2658('0x1e')](_0x2a3141);})[_0x2658('0x11')](function(){for(var _0x1492cb=0x0;_0x1492cb<_0x3d251e[_0x2658('0x1a')];_0x1492cb+=0x1){var _0xb8d245;var _0xd891fe=_0x3d251e[_0x1492cb];if(_0x2062ef){_0xb8d245=path[_0x2658('0x22')](_0xe9f81,_0x2496bf,util[_0x2658('0xc')](_0x2658('0x24'),_0x2496bf,_0x1492cb,_0x2658('0x25')));}else{_0xb8d245=path[_0x2658('0x22')](_0xe9f81,util[_0x2658('0xc')](_0x2658('0x26'),_0x2496bf,_0x2658('0x25')));}fs[_0x2658('0x27')](_0xb8d245,json2xls(_0xd891fe),'binary');}})[_0x2658('0x11')](function(){if(_0x2062ef){return new Promise(function(_0x556dca){zipdir(path[_0x2658('0x22')](_0xe9f81,_0x2496bf),{'saveTo':path['join'](_0xe9f81,util[_0x2658('0xc')](_0x2658('0x26'),_0x2496bf,_0x2658('0x28')))},function(_0x5e9e6f,_0x25ca0f){rimraf(path[_0x2658('0x22')](_0xe9f81,_0x2496bf),function(){});_0x556dca(_0x2658('0x29'));});});}})[_0x2658('0x11')](function(){logger[_0x2658('0xb')](util[_0x2658('0xc')](_0x2658('0x2a'),EXTRACTED_REPORT_ID,_0x2658('0xe')));return analyticExtractedReport(_0x2658('0x2b'),_0x2062ef?util['format'](_0x2658('0x26'),_0x2496bf,_0x2062ef?_0x2658('0x28'):_0x2658('0x25')):null);});})['catch'](function(_0x5d94b6){logger['info'](util[_0x2658('0xc')](_0x2658('0x2c'),EXTRACTED_REPORT_ID,_0x2658('0xe')),util[_0x2658('0x2d')](_0x5d94b6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2658('0x2e'));})[_0x2658('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7e4b9fa..3a4db99 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 _0x4657=['last','concat','Hangup','transaction','destroy','error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','find','push','type','Set','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','${EXTEN:','cutdigits','context','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},'];(function(_0x355235,_0x58565a){var _0x4cf1b2=function(_0x339e73){while(--_0x339e73){_0x355235['push'](_0x355235['shift']());}};_0x4cf1b2(++_0x58565a);}(_0x4657,0x99));var _0x7465=function(_0x2d4310,_0x2c4294){_0x2d4310=_0x2d4310-0x0;var _0x52099f=_0x4657[_0x2d4310];return _0x52099f;};'use strict';var _=require(_0x7465('0x0'));var util=require('util');function rewrite(_0x539444,_0x339988){var _0xb53561=this;return _0x539444[_0x7465('0x1')][_0x7465('0x2')][_0x7465('0x3')]({'raw':!![]})[_0x7465('0x4')](function(_0x1968ed){_0xb53561[_0x7465('0x5')]=_0x1968ed;return _0x539444[_0x7465('0x1')][_0x7465('0x6')][_0x7465('0x3')]({'where':{'IntervalId':_0x339988['IntervalId']},'raw':!![]});})[_0x7465('0x4')](function(_0x171182){return _0x539444[_0x7465('0x1')]['VoiceExtension'][_0x7465('0x3')]({'where':{'exten':{'$in':_[_0x7465('0x7')](_['map'](_0x171182,_0x7465('0x8')))}},'order':[{'raw':_0x7465('0x9')}],'raw':!![]});})['then'](function(_0x43e89f){var _0x5e1295=_[_0x7465('0xa')](_0x43e89f,{'priority':'1'});var _0x7f3bd9=_[_0x7465('0xa')](_0x43e89f,{'isApp':0x1});var _0x319dd2=_[_0x7465('0xb')](_0x7f3bd9,_0x7465('0x8'));var _0x4d0ae1=[_0x7465('0xc'),_0x7465('0xd')];var _0x17e2f9=[];var _0x39834a=[];for(var _0x4fcf31 in _0x319dd2){if(_0x319dd2['hasOwnProperty'](_0x4fcf31)){_0xb53561[_0x7465('0xe')]=0x2;_0xb53561[_0x7465('0xf')]=[];_0xb53561['extension']=_[_0x7465('0x10')](_0x5e1295,{'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')]});_0xb53561['extensions'][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':_0x7465('0x13'),'appdata':util['format'](_0x7465('0x14'),_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')]),'context':_0x319dd2[_0x4fcf31][0x0]['context'],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});if(_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')]===_0x7465('0x16')){_0xb53561[_0x7465('0xf')][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0]['type'],'app':_0x7465('0x13'),'appdata':_0x7465('0x17')+_0x319dd2[_0x4fcf31][0x0]['VoiceExtensionId'],'context':_0x319dd2[_0x4fcf31][0x0]['context'],'exten':_0x319dd2[_0x4fcf31][0x0]['exten'],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0]['VoiceExtensionId']});}else if(_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')]===_0x7465('0x18')){if(_0xb53561[_0x7465('0x19')]){_0xb53561['extensions']['push']({'type':_0x319dd2[_0x4fcf31][0x0]['type'],'app':'Set','appdata':_0x7465('0x1a')+(_0xb53561[_0x7465('0x19')]['cutdigits']?_0x7465('0x1b')+_0xb53561['extension'][_0x7465('0x1c')]+'}':'${EXTEN}'),'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0]['exten'],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});}_0xb53561[_0x7465('0xf')][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':'Set','appdata':_0x7465('0x17')+_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')],'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0xb53561['priority']++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});var _0x1f3214=_0xb53561['priority']++;_0xb53561[_0x7465('0xf')][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':'ExecIf','appdata':_0x7465('0x1e')+(_0x1f3214+0x2)+_0x7465('0x1f')+(_0x1f3214+0x1)+')','context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0x1f3214,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});if(_0xb53561['extension']){_0xb53561[_0x7465('0xf')][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0]['type'],'app':_0x7465('0x13'),'appdata':_0xb53561[_0x7465('0x19')][_0x7465('0x1c')]?_0x7465('0x20')+_0xb53561['extension']['cutdigits']+'}':_0x7465('0x21'),'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});}_0xb53561['extensions'][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':_0x7465('0x13'),'appdata':_0x7465('0x22')+_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')],'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});if(_0xb53561[_0x7465('0x19')]&&_0xb53561[_0x7465('0x19')][_0x7465('0x23')](_0x7465('0x24'))&&_0xb53561[_0x7465('0x19')][_0x7465('0x24')]!==_0x7465('0x25')){_0xb53561['extensions'][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':_0x7465('0x13'),'appdata':_0x7465('0x26'),'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0]['exten'],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});_0xb53561[_0x7465('0xf')]['push']({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':_0x7465('0x13'),'appdata':_0x7465('0x27')+_0xb53561[_0x7465('0x19')][_0x7465('0x24')]||_0x7465('0x28'),'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0xb53561['priority']++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});}}_0xb53561[_0x7465('0xf')][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':'Set','appdata':_0x7465('0x29'),'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0]['exten'],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0]['VoiceExtensionId']});_0xb53561[_0x7465('0xf')][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x319dd2[_0x4fcf31][0x0]['context'],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});_0xb53561['extensions']['push']({'type':_0x319dd2[_0x4fcf31][0x0]['type'],'app':_0x7465('0x13'),'appdata':_0x7465('0x2a'),'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'priority':_0xb53561[_0x7465('0xe')]++,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});for(var _0x2bb122=0x0,_0xe5b0d8=0x0;_0x2bb122<_0x319dd2[_0x4fcf31][_0x7465('0x2b')];_0x2bb122+=0x1,_0xe5b0d8=0x0){var _0x3954fa=_0x319dd2[_0x4fcf31][_0x2bb122];if(_0x3954fa[_0x7465('0x12')]){_0x3954fa[_0x7465('0x12')]=_0x3954fa[_0x7465('0x12')]['toLowerCase']();}var _0x340201=[];var _0x1791df=[];delete _0x3954fa['id'];delete _0x3954fa[_0x7465('0x2c')];delete _0x3954fa[_0x7465('0x2d')];var _0x5524d3=_0x3954fa[_0x7465('0x2e')]!==_0x7465('0x2f')?[_0x3954fa[_0x7465('0x2e')]]:_0x3954fa[_0x7465('0x30')]?_[_0x7465('0x31')](_['filter'](_0xb53561[_0x7465('0x5')],{'IntervalId':_0x3954fa['IntervalId']}),_0x7465('0x2e')):[];if(_0x3954fa[_0x7465('0x23')](_0x7465('0x32'))){if(_0x3954fa[_0x7465('0x32')]&&_0x3954fa[_0x7465('0x32')]!=='--'){_0x340201[_0x7465('0x11')]({'type':_0x3954fa['type'],'app':_0x7465('0x13'),'appdata':_0x7465('0x33')+_0x3954fa[_0x7465('0x32')],'context':_0x3954fa['context'],'exten':_0x3954fa[_0x7465('0x8')],'priority':_0x5524d3[_0x7465('0x2b')]+_0xb53561[_0x7465('0xe')]+_0xe5b0d8++,'VoiceExtensionId':_0x3954fa['VoiceExtensionId']});}}if(_0x3954fa[_0x7465('0x12')]==='outbound'&&_0x3954fa['hasOwnProperty'](_0x7465('0x34'))){if(_0x3954fa['callerID']){_0x340201[_0x7465('0x11')]({'type':_0x3954fa[_0x7465('0x12')],'app':'ExecIf','appdata':_0x7465('0x35')+_0x3954fa['callerID']+')','context':_0x3954fa[_0x7465('0x1d')],'exten':_0x3954fa[_0x7465('0x8')],'priority':_0x5524d3[_0x7465('0x2b')]+_0xb53561[_0x7465('0xe')]+_0xe5b0d8++,'VoiceExtensionId':_0x3954fa[_0x7465('0x15')]});}else{_0x340201[_0x7465('0x11')]({'type':_0x3954fa[_0x7465('0x12')],'app':_0x7465('0x36'),'appdata':_0x7465('0x37'),'context':_0x3954fa[_0x7465('0x1d')],'exten':_0x3954fa['exten'],'priority':_0x5524d3[_0x7465('0x2b')]+_0xb53561[_0x7465('0xe')]+_0xe5b0d8++,'VoiceExtensionId':_0x3954fa['VoiceExtensionId']});}}if(_0x3954fa[_0x7465('0x23')](_0x7465('0x38'))){if(_0x4d0ae1[_0x7465('0x39')](_0x3954fa['app']['toLowerCase']())>=0x0&&_0x3954fa[_0x7465('0x3a')]!==_0x7465('0x3b')){if(_0x3954fa[_0x7465('0x38')]){_0x340201[_0x7465('0x11')]({'type':_0x3954fa[_0x7465('0x12')],'app':_0x7465('0x36'),'appdata':_0x7465('0x3c'),'context':_0x3954fa[_0x7465('0x1d')],'exten':_0x3954fa[_0x7465('0x8')],'priority':_0x5524d3[_0x7465('0x2b')]+_0xb53561[_0x7465('0xe')]+_0xe5b0d8++,'VoiceExtensionId':_0x3954fa['VoiceExtensionId']});_0x340201[_0x7465('0x11')]({'type':_0x3954fa['type'],'app':_0x7465('0x13'),'appdata':_0x7465('0x3d'),'context':_0x3954fa[_0x7465('0x1d')],'exten':_0x3954fa[_0x7465('0x8')],'priority':_0x5524d3[_0x7465('0x2b')]+_0xb53561['priority']+_0xe5b0d8++,'VoiceExtensionId':_0x3954fa[_0x7465('0x15')]});}else{_0x340201[_0x7465('0x11')]({'type':_0x3954fa[_0x7465('0x12')],'app':_0x7465('0x36'),'appdata':_0x7465('0x3e'),'context':_0x3954fa[_0x7465('0x1d')],'exten':_0x3954fa['exten'],'priority':_0x5524d3[_0x7465('0x2b')]+_0xb53561[_0x7465('0xe')]+_0xe5b0d8++,'VoiceExtensionId':_0x3954fa[_0x7465('0x15')]});_0x340201[_0x7465('0x11')]({'type':_0x3954fa['type'],'app':_0x7465('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3954fa[_0x7465('0x1d')],'exten':_0x3954fa[_0x7465('0x8')],'priority':_0x5524d3[_0x7465('0x2b')]+_0xb53561['priority']+_0xe5b0d8++,'VoiceExtensionId':_0x3954fa['VoiceExtensionId']});}}}for(var _0x140d98=0x0;_0x140d98<_0x5524d3[_0x7465('0x2b')];_0x140d98+=0x1){var _0x7ac6eb=_0xb53561[_0x7465('0xe')]+_0x5524d3['length'];var _0x3a33e8=_0x140d98===_0x5524d3[_0x7465('0x2b')]-0x1?_0xb53561['priority']+_0x340201[_0x7465('0x2b')]+_0x1791df[_0x7465('0x2b')]+0x2:_0xb53561[_0x7465('0xe')]+_0x140d98+0x1;_0x340201[_0x7465('0x3f')](_0x140d98,0x0,{'type':_0x3954fa[_0x7465('0x12')],'app':_0x7465('0x40'),'appdata':_0x5524d3[_0x140d98]+'?'+_0x3954fa[_0x7465('0x1d')]+_0x7465('0x41')+_0x7ac6eb+':'+_0x3954fa[_0x7465('0x1d')]+_0x7465('0x41')+_0x3a33e8,'exten':_0x3954fa[_0x7465('0x8')],'context':_0x3954fa['context'],'priority':_0xb53561[_0x7465('0xe')]+_0x140d98,'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0]['VoiceExtensionId']});}_0x3954fa['priority']=_0x340201[_0x7465('0x2b')]?_[_0x7465('0x42')](_0x340201)[_0x7465('0xe')]+0x1:_0xb53561[_0x7465('0xe')];_0xb53561['priority']=(_0x1791df[_0x7465('0x2b')]?_[_0x7465('0x42')](_0x1791df)[_0x7465('0xe')]:_0x3954fa[_0x7465('0xe')])+0x1;_0xb53561[_0x7465('0xf')]=_[_0x7465('0x43')](_0xb53561[_0x7465('0xf')],_0x340201,[_0x3954fa],_0x1791df);}_0xb53561[_0x7465('0xf')][_0x7465('0x11')]({'type':_0x319dd2[_0x4fcf31][0x0]['type'],'app':_0x7465('0x44'),'exten':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x8')],'context':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x1d')],'priority':_0xb53561[_0x7465('0xe')],'VoiceExtensionId':_0x319dd2[_0x4fcf31][0x0][_0x7465('0x15')]});_0x17e2f9[_0x7465('0x11')](_0x319dd2[_0x4fcf31][0x0]['VoiceExtensionId']);_0x39834a=_[_0x7465('0x43')](_0x39834a,_0xb53561['extensions']);}}return _0x539444[_0x7465('0x45')](function(_0x3c3411){return _0x539444[_0x7465('0x1')][_0x7465('0x6')][_0x7465('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x17e2f9}},'transaction':_0x3c3411})['then'](function(_0x174096){return _0x539444['models'][_0x7465('0x6')]['bulkCreate'](_['sortBy'](_0x39834a,_0x7465('0xe')),{'transaction':_0x3c3411});});});})['catch'](function(_0x4f337e){console[_0x7465('0x47')](_0x4f337e);});}exports[_0x7465('0x48')]=rewrite; \ No newline at end of file +var _0xf00e=['last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','IntervalId','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xf00e,0x11d));var _0xef00=function(_0xdae558,_0x1ff237){_0xdae558=_0xdae558-0x0;var _0x2a5842=_0xf00e[_0xdae558];return _0x2a5842;};'use strict';var _=require(_0xef00('0x0'));var util=require('util');function rewrite(_0x590ed8,_0x103f02){var _0x5dc76d=this;return _0x590ed8[_0xef00('0x1')][_0xef00('0x2')][_0xef00('0x3')]({'raw':!![]})[_0xef00('0x4')](function(_0x45f357){_0x5dc76d[_0xef00('0x5')]=_0x45f357;return _0x590ed8['models'][_0xef00('0x6')][_0xef00('0x3')]({'where':{'IntervalId':_0x103f02['IntervalId']},'raw':!![]});})[_0xef00('0x4')](function(_0x15a3f4){return _0x590ed8[_0xef00('0x1')]['VoiceExtension'][_0xef00('0x3')]({'where':{'exten':{'$in':_[_0xef00('0x7')](_['map'](_0x15a3f4,_0xef00('0x8')))}},'order':[{'raw':_0xef00('0x9')}],'raw':!![]});})[_0xef00('0x4')](function(_0x5cb316){var _0x1ec645=_['filter'](_0x5cb316,{'priority':'1'});var _0x1c431f=_[_0xef00('0xa')](_0x5cb316,{'isApp':0x1});var _0x39d35e=_[_0xef00('0xb')](_0x1c431f,_0xef00('0x8'));var _0x46a41d=[_0xef00('0xc'),_0xef00('0xd')];var _0x4f35f8=[];var _0x5db1bd=[];for(var _0x2b2e61 in _0x39d35e){if(_0x39d35e[_0xef00('0xe')](_0x2b2e61)){_0x5dc76d[_0xef00('0xf')]=0x2;_0x5dc76d[_0xef00('0x10')]=[];_0x5dc76d[_0xef00('0x11')]=_[_0xef00('0x12')](_0x1ec645,{'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')]});_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':util[_0xef00('0x16')]('CDR(type)=%s',_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')]),'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});if(_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')]===_0xef00('0x19')){_0x5dc76d[_0xef00('0x10')]['push']({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':_0xef00('0x1a')+_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')],'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0]['exten'],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});}else if(_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')]===_0xef00('0x1b')){if(_0x5dc76d[_0xef00('0x11')]){_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':_0xef00('0x1c')+(_0x5dc76d[_0xef00('0x11')][_0xef00('0x1d')]?'${EXTEN:'+_0x5dc76d[_0xef00('0x11')][_0xef00('0x1d')]+'}':'${EXTEN}'),'context':_0x39d35e[_0x2b2e61][0x0]['context'],'exten':_0x39d35e[_0x2b2e61][0x0]['exten'],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0]['VoiceExtensionId']});}_0x5dc76d['extensions'][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':_0xef00('0x1a')+_0x39d35e[_0x2b2e61][0x0]['VoiceExtensionId'],'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0]['exten'],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});var _0x55b381=_0x5dc76d['priority']++;_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':'ExecIf','appdata':_0xef00('0x1e')+(_0x55b381+0x2)+_0xef00('0x1f')+(_0x55b381+0x1)+')','context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0]['exten'],'priority':_0x55b381,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});if(_0x5dc76d['extension']){_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0]['type'],'app':_0xef00('0x15'),'appdata':_0x5dc76d[_0xef00('0x11')][_0xef00('0x1d')]?_0xef00('0x20')+_0x5dc76d[_0xef00('0x11')][_0xef00('0x1d')]+'}':_0xef00('0x21'),'context':_0x39d35e[_0x2b2e61][0x0]['context'],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});}_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':'Set','appdata':'outboundrouteid='+_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')],'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0]['VoiceExtensionId']});if(_0x5dc76d[_0xef00('0x11')]&&_0x5dc76d[_0xef00('0x11')][_0xef00('0xe')](_0xef00('0x22'))&&_0x5dc76d[_0xef00('0x11')]['recordingFormat']!=='none'){_0x5dc76d[_0xef00('0x10')]['push']({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':'Set','appdata':_0xef00('0x23'),'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0]['VoiceExtensionId']});_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':_0xef00('0x24')+_0x5dc76d[_0xef00('0x11')]['recordingFormat']||'wav','context':_0x39d35e[_0x2b2e61][0x0]['context'],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d['priority']++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});}}_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});_0x5dc76d[_0xef00('0x10')][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':_0xef00('0x25'),'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});_0x5dc76d['extensions']['push']({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':_0xef00('0x26'),'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'priority':_0x5dc76d[_0xef00('0xf')]++,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]});for(var _0x5006aa=0x0,_0x15a1f1=0x0;_0x5006aa<_0x39d35e[_0x2b2e61][_0xef00('0x27')];_0x5006aa+=0x1,_0x15a1f1=0x0){var _0xd5ab0=_0x39d35e[_0x2b2e61][_0x5006aa];if(_0xd5ab0[_0xef00('0x14')]){_0xd5ab0['type']=_0xd5ab0[_0xef00('0x14')][_0xef00('0x28')]();}var _0x18f2b1=[];var _0x37e900=[];delete _0xd5ab0['id'];delete _0xd5ab0[_0xef00('0x29')];delete _0xd5ab0[_0xef00('0x2a')];var _0x3e0ca3=_0xd5ab0[_0xef00('0x2b')]!==_0xef00('0x2c')?[_0xd5ab0[_0xef00('0x2b')]]:_0xd5ab0['IntervalId']?_[_0xef00('0x2d')](_[_0xef00('0xa')](_0x5dc76d[_0xef00('0x5')],{'IntervalId':_0xd5ab0[_0xef00('0x2e')]}),_0xef00('0x2b')):[];if(_0xd5ab0['hasOwnProperty']('tag')){if(_0xd5ab0['tag']&&_0xd5ab0[_0xef00('0x2f')]!=='--'){_0x18f2b1['push']({'type':_0xd5ab0[_0xef00('0x14')],'app':'Set','appdata':_0xef00('0x30')+_0xd5ab0[_0xef00('0x2f')],'context':_0xd5ab0['context'],'exten':_0xd5ab0[_0xef00('0x8')],'priority':_0x3e0ca3[_0xef00('0x27')]+_0x5dc76d[_0xef00('0xf')]+_0x15a1f1++,'VoiceExtensionId':_0xd5ab0['VoiceExtensionId']});}}if(_0xd5ab0[_0xef00('0x14')]===_0xef00('0x1b')&&_0xd5ab0[_0xef00('0xe')](_0xef00('0x31'))){if(_0xd5ab0[_0xef00('0x31')]){_0x18f2b1[_0xef00('0x13')]({'type':_0xd5ab0[_0xef00('0x14')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0xd5ab0[_0xef00('0x31')]+')','context':_0xd5ab0['context'],'exten':_0xd5ab0[_0xef00('0x8')],'priority':_0x3e0ca3[_0xef00('0x27')]+_0x5dc76d[_0xef00('0xf')]+_0x15a1f1++,'VoiceExtensionId':_0xd5ab0['VoiceExtensionId']});}else{_0x18f2b1[_0xef00('0x13')]({'type':_0xd5ab0[_0xef00('0x14')],'app':_0xef00('0x32'),'appdata':_0xef00('0x33'),'context':_0xd5ab0[_0xef00('0x17')],'exten':_0xd5ab0[_0xef00('0x8')],'priority':_0x3e0ca3[_0xef00('0x27')]+_0x5dc76d[_0xef00('0xf')]+_0x15a1f1++,'VoiceExtensionId':_0xd5ab0[_0xef00('0x18')]});}}if(_0xd5ab0[_0xef00('0xe')](_0xef00('0x34'))){if(_0x46a41d[_0xef00('0x35')](_0xd5ab0[_0xef00('0x36')]['toLowerCase']())>=0x0&&_0xd5ab0[_0xef00('0x37')]!=='custom'){if(_0xd5ab0[_0xef00('0x34')]){_0x18f2b1[_0xef00('0x13')]({'type':_0xd5ab0[_0xef00('0x14')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xd5ab0[_0xef00('0x17')],'exten':_0xd5ab0[_0xef00('0x8')],'priority':_0x3e0ca3['length']+_0x5dc76d[_0xef00('0xf')]+_0x15a1f1++,'VoiceExtensionId':_0xd5ab0[_0xef00('0x18')]});_0x18f2b1[_0xef00('0x13')]({'type':_0xd5ab0[_0xef00('0x14')],'app':'Set','appdata':_0xef00('0x38'),'context':_0xd5ab0[_0xef00('0x17')],'exten':_0xd5ab0['exten'],'priority':_0x3e0ca3['length']+_0x5dc76d['priority']+_0x15a1f1++,'VoiceExtensionId':_0xd5ab0[_0xef00('0x18')]});}else{_0x18f2b1[_0xef00('0x13')]({'type':_0xd5ab0[_0xef00('0x14')],'app':_0xef00('0x32'),'appdata':_0xef00('0x39'),'context':_0xd5ab0['context'],'exten':_0xd5ab0[_0xef00('0x8')],'priority':_0x3e0ca3['length']+_0x5dc76d[_0xef00('0xf')]+_0x15a1f1++,'VoiceExtensionId':_0xd5ab0['VoiceExtensionId']});_0x18f2b1[_0xef00('0x13')]({'type':_0xd5ab0[_0xef00('0x14')],'app':_0xef00('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xd5ab0['context'],'exten':_0xd5ab0[_0xef00('0x8')],'priority':_0x3e0ca3[_0xef00('0x27')]+_0x5dc76d[_0xef00('0xf')]+_0x15a1f1++,'VoiceExtensionId':_0xd5ab0[_0xef00('0x18')]});}}}for(var _0x35daf3=0x0;_0x35daf3<_0x3e0ca3[_0xef00('0x27')];_0x35daf3+=0x1){var _0x49b5f7=_0x5dc76d[_0xef00('0xf')]+_0x3e0ca3[_0xef00('0x27')];var _0x22e03e=_0x35daf3===_0x3e0ca3['length']-0x1?_0x5dc76d[_0xef00('0xf')]+_0x18f2b1[_0xef00('0x27')]+_0x37e900[_0xef00('0x27')]+0x2:_0x5dc76d[_0xef00('0xf')]+_0x35daf3+0x1;_0x18f2b1['splice'](_0x35daf3,0x0,{'type':_0xd5ab0[_0xef00('0x14')],'app':_0xef00('0x3a'),'appdata':_0x3e0ca3[_0x35daf3]+'?'+_0xd5ab0[_0xef00('0x17')]+_0xef00('0x3b')+_0x49b5f7+':'+_0xd5ab0['context']+_0xef00('0x3b')+_0x22e03e,'exten':_0xd5ab0[_0xef00('0x8')],'context':_0xd5ab0['context'],'priority':_0x5dc76d['priority']+_0x35daf3,'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0]['VoiceExtensionId']});}_0xd5ab0['priority']=_0x18f2b1[_0xef00('0x27')]?_[_0xef00('0x3c')](_0x18f2b1)['priority']+0x1:_0x5dc76d['priority'];_0x5dc76d[_0xef00('0xf')]=(_0x37e900[_0xef00('0x27')]?_['last'](_0x37e900)['priority']:_0xd5ab0[_0xef00('0xf')])+0x1;_0x5dc76d[_0xef00('0x10')]=_[_0xef00('0x3d')](_0x5dc76d[_0xef00('0x10')],_0x18f2b1,[_0xd5ab0],_0x37e900);}_0x5dc76d['extensions'][_0xef00('0x13')]({'type':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x14')],'app':_0xef00('0x3e'),'exten':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x8')],'context':_0x39d35e[_0x2b2e61][0x0][_0xef00('0x17')],'priority':_0x5dc76d[_0xef00('0xf')],'VoiceExtensionId':_0x39d35e[_0x2b2e61][0x0]['VoiceExtensionId']});_0x4f35f8[_0xef00('0x13')](_0x39d35e[_0x2b2e61][0x0][_0xef00('0x18')]);_0x5db1bd=_['concat'](_0x5db1bd,_0x5dc76d[_0xef00('0x10')]);}}return _0x590ed8['transaction'](function(_0x4dcb44){return _0x590ed8[_0xef00('0x1')][_0xef00('0x6')][_0xef00('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x4f35f8}},'transaction':_0x4dcb44})[_0xef00('0x4')](function(_0x724c3f){return _0x590ed8[_0xef00('0x1')][_0xef00('0x6')][_0xef00('0x40')](_[_0xef00('0x41')](_0x5db1bd,'priority'),{'transaction':_0x4dcb44});});});})[_0xef00('0x42')](function(_0x2f31f2){console[_0xef00('0x43')](_0x2f31f2);});}exports[_0xef00('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 dcffdb9..90c4615 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 _0x5f70=['resume','resolve','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','papaparse','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','error','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','cm_hopper','createdAt','select','field','NOW()','ContactId','toString','updatedAt','cm_contacts','ListId\x20=\x20?','where','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','into','scheduledAt','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','fromQuery','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','get','sequelize','query','VoiceQueueId','findAll','CmList','all','always','CampaignId','onlyIfOpen','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x5f70,0x15c));var _0x05f7=function(_0x222b5d,_0x157f77){_0x222b5d=_0x222b5d-0x0;var _0x5e95e5=_0x5f70[_0x222b5d];return _0x5e95e5;};'use strict';var BPromise=require(_0x05f7('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x05f7('0x1'));var Redis=require('ioredis');var db=require(_0x05f7('0x2'))['db'];var config=require(_0x05f7('0x3'));var logger=require('../../../config/logger')(_0x05f7('0x4'));config[_0x05f7('0x5')]=_[_0x05f7('0x6')](config[_0x05f7('0x5')],{'host':_0x05f7('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05f7('0x5')]));require(_0x05f7('0x8'))[_0x05f7('0x9')](socket);try{if(!process[_0x05f7('0xa')][0x2]||process[_0x05f7('0xa')][0x2]===_0x05f7('0xb')||process[_0x05f7('0xa')][0x2]===_0x05f7('0xc')){throw new Error(_0x05f7('0xd'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]==='null'||!process[_0x05f7('0xa')][0x4]||process[_0x05f7('0xa')][0x4]==='undefined'||process[_0x05f7('0xa')][0x4]===_0x05f7('0xc')){throw new Error(_0x05f7('0xe'));}var FIELDS=_[_0x05f7('0xf')](process[_0x05f7('0xa')][0x3]['split'](','),process[_0x05f7('0xa')][0x4][_0x05f7('0x10')](','));if(!process[_0x05f7('0xa')][0x5]||process[_0x05f7('0xa')][0x5]==='undefined'||process[_0x05f7('0xa')][0x5]===_0x05f7('0xc')){throw new Error(_0x05f7('0x11'));}var LISTID=process[_0x05f7('0xa')][0x5];var COMPANYID=process[_0x05f7('0xa')][0x6]&&process[_0x05f7('0xa')][0x6]!=='undefined'&&process[_0x05f7('0xa')][0x6]!=='null'?process[_0x05f7('0xa')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x05f7('0xa')][0x7]!=='undefined'&&process[_0x05f7('0xa')][0x7]!==_0x05f7('0xc')?process[_0x05f7('0xa')][0x7]:null;if(!process['argv'][0x8]||process[_0x05f7('0xa')][0x8]===_0x05f7('0xb')||process[_0x05f7('0xa')][0x8]==='null'){throw new Error(_0x05f7('0x12'));}var SOCKET_TIMESTAMP=process[_0x05f7('0xa')][0x8];}catch(_0x1840fd){logger['error'](_0x1840fd);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(_0x4c6d06,_0x929c46,_0x36ac68,_0x56999b){var _0x4d0ad1={'message':_0x929c46};_0x4d0ad1[_0x4c6d06]=!![];if(_0x36ac68){_0x4d0ad1[_0x05f7('0x13')]=_0x36ac68;}if(_0x56999b){_0x4d0ad1['index']=_0x56999b;}return _0x4d0ad1;}function isEmail(_0x2902ba){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))*$/[_0x05f7('0x14')](_0x2902ba);}function checkRow(_0x2d5575,_0x4db642,_0x10b66b){return new BPromise(function(_0x220b3e,_0x55b569){if(_[_0x05f7('0x15')](_0x2d5575)){return _0x55b569(handleCheckRowError('error',_0x05f7('0x16'),null,_0x10b66b));}if(_0x2d5575[_0x05f7('0x17')]&&_0x2d5575[_0x05f7('0x17')][_0x05f7('0x18')]){var _0x30c57b=_[_0x05f7('0x19')](_0x2d5575[_0x05f7('0x17')],_0x05f7('0x1a'))[_0x05f7('0x1b')](';');return _0x55b569(handleCheckRowError('error',_0x30c57b,null,_0x10b66b));}var _0x45bd03={};for(var _0x15dfed in FIELDS){if(FIELDS['hasOwnProperty'](_0x15dfed)&&FIELDS[_0x15dfed]){_0x45bd03[_0x15dfed]=_0x2d5575['data'][0x0][FIELDS[_0x15dfed]]||_0x2d5575[_0x05f7('0x1c')][0x0]['\ufeff'+FIELDS[_0x15dfed]];}}if(!_0x45bd03[_0x05f7('0x1d')]){return _0x55b569(handleCheckRowError(_0x05f7('0x1e'),_0x05f7('0x1f'),null,_0x10b66b));}if(!_0x45bd03[_0x05f7('0x20')]){return _0x55b569(handleCheckRowError(_0x05f7('0x1e'),_0x05f7('0x21'),null,_0x10b66b));}if(_0x45bd03['birthDate']){var _0x5eda25=moment(_0x45bd03[_0x05f7('0x22')],_0x05f7('0x23'));if(!_0x5eda25['isValid']()){return _0x55b569(handleCheckRowError('error',_0x05f7('0x24'),null,_0x10b66b));}}if(_0x45bd03['email']){if(!isEmail(_0x45bd03[_0x05f7('0x25')])){return _0x55b569(handleCheckRowError(_0x05f7('0x1e'),_0x05f7('0x26'),null,_0x10b66b));}}_0x45bd03[_0x05f7('0x27')]=LISTID;_0x45bd03[_0x05f7('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4db642){var _0x5bce2d={};for(var _0x45855f=0x0,_0x38c36e=DUPLICATES[_0x05f7('0x18')];_0x45855f<_0x38c36e;_0x45855f+=0x1){_0x5bce2d[DUPLICATES[_0x45855f]]=_0x45bd03[DUPLICATES[_0x45855f]];}var _0x3d7bf9=_['find'](_0x4db642,_0x5bce2d);if(_0x3d7bf9){return _0x55b569(handleCheckRowError(_0x05f7('0x29'),_0x05f7('0x2a'),_0x3d7bf9,_0x10b66b));}}return db['CmContact'][_0x05f7('0x2b')](_0x45bd03,{'raw':!![],'hooks':![],'fields':_[_0x05f7('0x2c')](_0x45bd03)})[_0x05f7('0x2d')](function(_0x30620e){if(DUPLICATES&&DUPLICATES[_0x05f7('0x18')]&&_0x4db642){_0x4db642[_0x05f7('0x2e')](_[_0x05f7('0x2f')](_0x45bd03,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x30620e['id'];return _0x220b3e();})[_0x05f7('0x30')](function(_0x12ff5e){return _0x55b569(handleCheckRowError('error',_0x05f7('0x31')+(_0x12ff5e[_0x05f7('0x1a')]||JSON['stringify'](_0x12ff5e)),null,_0x10b66b));});});}function checkHopper(){function _0x3296cb(){return function(_0x45d9ac){logger['error'](_0x05f7('0x32'),_0x05f7('0x33'),util[_0x05f7('0x34')](_0x45d9ac,{'showHidden':![],'depth':null}));};}var _0x14a274=function(_0x1628e0,_0x3c317a){var _0x322b6e=squel[_0x05f7('0x35')]()['into'](_0x05f7('0x36'))['fromQuery']([_0x05f7('0x20'),'scheduledAt','ContactId',_0x05f7('0x27'),_0x3c317a,_0x05f7('0x37'),'updatedAt'],squel[_0x05f7('0x38')]()[_0x05f7('0x39')](_0x05f7('0x20'),_0x05f7('0x20'))[_0x05f7('0x39')](_0x05f7('0x3a'),'scheduledAt')['field']('id',_0x05f7('0x3b'))['field'](LISTID[_0x05f7('0x3c')](),_0x05f7('0x27'))[_0x05f7('0x39')](_0x1628e0['id'][_0x05f7('0x3c')](),_0x3c317a)[_0x05f7('0x39')](_0x05f7('0x3a'),'createdAt')['field'](_0x05f7('0x3a'),_0x05f7('0x3d'))['from'](_0x05f7('0x3e'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x05f7('0x3f'),LISTID[_0x05f7('0x3c')]())[_0x05f7('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x05f7('0x40')](_0x05f7('0x41'),squel['select']()['field']('phone')[_0x05f7('0x42')](_0x05f7('0x36'))[_0x05f7('0x40')](_0x3c317a+_0x05f7('0x43'),_0x1628e0['id'][_0x05f7('0x3c')]())))[_0x05f7('0x3c')]();return _0x322b6e;};var _0x540cbf=function(_0x3c0195,_0x41d9c8){var _0x2d8d54=squel['insert']()[_0x05f7('0x44')]('cm_hopper')['fromQuery']([_0x05f7('0x20'),_0x05f7('0x45'),_0x05f7('0x3b'),'ListId',_0x41d9c8,_0x05f7('0x37'),'updatedAt'],squel['select']()['field'](_0x05f7('0x20'),'phone')['field']('NOW()',_0x05f7('0x45'))[_0x05f7('0x39')]('id',_0x05f7('0x3b'))[_0x05f7('0x39')](LISTID[_0x05f7('0x3c')](),'ListId')[_0x05f7('0x39')](_0x3c0195['id']['toString'](),_0x41d9c8)[_0x05f7('0x39')](_0x05f7('0x3a'),_0x05f7('0x37'))[_0x05f7('0x39')](_0x05f7('0x3a'),'updatedAt')[_0x05f7('0x42')](_0x05f7('0x3e'))[_0x05f7('0x40')]('deletedAt\x20IS\x20NULL')[_0x05f7('0x40')](_0x05f7('0x3f'),LISTID[_0x05f7('0x3c')]())[_0x05f7('0x40')](_0x05f7('0x46'),squel[_0x05f7('0x47')](hopperContacts))[_0x05f7('0x40')](_0x05f7('0x48'))[_0x05f7('0x40')](_0x05f7('0x41'),squel[_0x05f7('0x38')]()['field'](_0x05f7('0x49'))[_0x05f7('0x42')](_0x05f7('0x4a'))[_0x05f7('0x40')](_0x41d9c8+_0x05f7('0x43'),_0x3c0195['id'][_0x05f7('0x3c')]()))[_0x05f7('0x40')](_0x05f7('0x41'),squel[_0x05f7('0x38')]()['field'](_0x05f7('0x20'))[_0x05f7('0x42')]('cm_hopper')[_0x05f7('0x40')](_0x41d9c8+_0x05f7('0x43'),_0x3c0195['id'][_0x05f7('0x3c')]())))[_0x05f7('0x3c')]();return _0x2d8d54;};function _0x506daf(_0x57d0ea,_0x47946e){var _0x411766=squel[_0x05f7('0x35')]()[_0x05f7('0x44')]('cm_hopper')[_0x05f7('0x4b')]([_0x05f7('0x20'),_0x05f7('0x45'),_0x05f7('0x3b'),_0x05f7('0x27'),_0x47946e,_0x05f7('0x37'),'updatedAt'],squel[_0x05f7('0x38')]()['field'](_0x05f7('0x20'),_0x05f7('0x20'))['field'](_0x05f7('0x3a'),_0x05f7('0x45'))[_0x05f7('0x39')]('id',_0x05f7('0x3b'))['field'](LISTID['toString'](),_0x05f7('0x27'))[_0x05f7('0x39')](_0x57d0ea['id']['toString'](),_0x47946e)[_0x05f7('0x39')](_0x05f7('0x3a'),'createdAt')['field'](_0x05f7('0x3a'),_0x05f7('0x3d'))[_0x05f7('0x42')](_0x05f7('0x3e'))[_0x05f7('0x40')](_0x05f7('0x4c'))['where'](_0x05f7('0x3f'),LISTID['toString']())['where'](_0x05f7('0x46'),squel[_0x05f7('0x47')](hopperContacts))[_0x05f7('0x40')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x411766;}function _0x645dd5(_0x115820,_0x83073){var _0x289358=squel[_0x05f7('0x35')]()[_0x05f7('0x44')](_0x05f7('0x4d'))[_0x05f7('0x4b')]([_0x05f7('0x20'),'ContactId',_0x05f7('0x27'),_0x83073,_0x05f7('0x37'),_0x05f7('0x3d')],squel['select']()[_0x05f7('0x39')](_0x05f7('0x20'),_0x05f7('0x20'))[_0x05f7('0x39')]('id','ContactId')[_0x05f7('0x39')](LISTID[_0x05f7('0x3c')](),_0x05f7('0x27'))[_0x05f7('0x39')](_0x115820['id'][_0x05f7('0x3c')](),_0x83073)[_0x05f7('0x39')](_0x05f7('0x3a'),_0x05f7('0x37'))[_0x05f7('0x39')]('NOW()',_0x05f7('0x3d'))[_0x05f7('0x42')](_0x05f7('0x3e'))['where'](_0x05f7('0x4c'))[_0x05f7('0x40')](_0x05f7('0x3f'),LISTID[_0x05f7('0x3c')]())[_0x05f7('0x40')]('id\x20IN\x20?',squel[_0x05f7('0x47')](hopperContacts))['where'](_0x05f7('0x48')))[_0x05f7('0x3c')]();return _0x289358;}return db[_0x05f7('0x4e')]['findAll']({'where':{'type':_0x05f7('0x4f')},'attributes':['id',_0x05f7('0x50')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x05f7('0x2d')](function(_0x4963bd){var _0x303c70=[];if(_0x4963bd){var _0x5e19d2;for(var _0x11f2cb=0x0,_0x27d218;_0x11f2cb<_0x4963bd[_0x05f7('0x18')];_0x11f2cb+=0x1){_0x27d218=_0x4963bd[_0x11f2cb][_0x05f7('0x51')]({'plain':!![]});switch(_0x27d218[_0x05f7('0x50')]){case'always':_0x303c70[_0x05f7('0x2e')](db[_0x05f7('0x52')][_0x05f7('0x53')](_0x540cbf(_0x27d218,_0x05f7('0x54')))[_0x05f7('0x2d')](function(){})[_0x05f7('0x30')](_0x3296cb()));break;case'onlyIfOpen':_0x303c70[_0x05f7('0x2e')](db[_0x05f7('0x52')][_0x05f7('0x53')](_0x14a274(_0x27d218,'VoiceQueueId'))['then'](function(){})['catch'](_0x3296cb()));break;default:_0x303c70['push'](db['sequelize'][_0x05f7('0x53')](_0x506daf(_0x27d218,_0x05f7('0x54')))[_0x05f7('0x2d')](function(){})['catch'](_0x3296cb()));}}}return _0x303c70;})['all']()[_0x05f7('0x2d')](function(){return db[_0x05f7('0x4e')][_0x05f7('0x55')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x05f7('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x05f7('0x2d')](function(_0x43858c){var _0x385914=[];if(_0x43858c){var _0xa5a57e;for(var _0x5f2b27=0x0,_0x163a45;_0x5f2b27<_0x43858c[_0x05f7('0x18')];_0x5f2b27+=0x1){_0x163a45=_0x43858c[_0x5f2b27][_0x05f7('0x51')]({'plain':!![]});_0x385914['push'](db[_0x05f7('0x52')][_0x05f7('0x53')](_0x645dd5(_0x163a45,_0x05f7('0x54')))[_0x05f7('0x2d')](function(){})['catch'](_0x3296cb()));}}return _0x385914;})[_0x05f7('0x57')]();})[_0x05f7('0x2d')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x05f7('0x50')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x05f7('0x2d')](function(_0x1c0e06){var _0x18fe2b=[];if(_0x1c0e06){for(var _0x54be00=0x0,_0x51068d;_0x54be00<_0x1c0e06[_0x05f7('0x18')];_0x54be00+=0x1){_0x51068d=_0x1c0e06[_0x54be00][_0x05f7('0x51')]({'plain':!![]});switch(_0x51068d[_0x05f7('0x50')]){case _0x05f7('0x58'):_0x18fe2b[_0x05f7('0x2e')](db[_0x05f7('0x52')]['query'](_0x540cbf(_0x51068d,_0x05f7('0x59')))['then'](function(){})['catch'](_0x3296cb()));break;case _0x05f7('0x5a'):_0x18fe2b[_0x05f7('0x2e')](db[_0x05f7('0x52')]['query'](_0x14a274(_0x51068d,_0x05f7('0x59')))[_0x05f7('0x2d')](function(){})['catch'](_0x3296cb()));break;default:_0x18fe2b[_0x05f7('0x2e')](db[_0x05f7('0x52')][_0x05f7('0x53')](_0x506daf(_0x51068d,'CampaignId'))[_0x05f7('0x2d')](function(){})[_0x05f7('0x30')](_0x3296cb()));}}}return _0x18fe2b;})['all']();})[_0x05f7('0x2d')](function(){return db[_0x05f7('0x5b')][_0x05f7('0x55')]({'attributes':['id'],'include':[{'model':db[_0x05f7('0x56')],'as':_0x05f7('0x5c'),'where':{'id':LISTID}}]})[_0x05f7('0x2d')](function(_0x3518ce){var _0x328c8d=[];if(_0x3518ce){for(var _0xce55bd=0x0,_0x2a3c52;_0xce55bd<_0x3518ce[_0x05f7('0x18')];_0xce55bd+=0x1){_0x2a3c52=_0x3518ce[_0xce55bd]['get']({'plain':!![]});_0x328c8d['push'](db[_0x05f7('0x52')][_0x05f7('0x53')](_0x645dd5(_0x2a3c52,_0x05f7('0x59')))[_0x05f7('0x2d')](function(){})[_0x05f7('0x30')](_0x3296cb()));}}return _0x328c8d;})[_0x05f7('0x57')]();})[_0x05f7('0x30')](function(_0x2699b1){logger['error'](_0x05f7('0x5d'),_0x05f7('0x5e'),_0x2699b1[_0x05f7('0x1a')]);});}var processPromises=function(_0x2b1d2a){return BPromise[_0x05f7('0x57')](promises)[_0x05f7('0x2d')](function(_0x1d1ea1){})[_0x05f7('0x30')](function(_0x3c6e57){logger[_0x05f7('0x1e')](_0x05f7('0x5f'),JSON[_0x05f7('0x60')](_0x3c6e57));})[_0x05f7('0x61')](function(){socket[_0x05f7('0x62')](_0x05f7('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2b1d2a){return _0x2b1d2a[_0x05f7('0x64')]();}});};var endCsv=function(){return BPromise[_0x05f7('0x65')]()[_0x05f7('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x05f7('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x05f7('0x66')](FILEPATH);}catch(_0xa5e397){logger[_0x05f7('0x1e')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0xa5e397));}finally{process[_0x05f7('0x67')](0x0);}});};process['on']('SIGINT',function(){logger[_0x05f7('0x68')](_0x05f7('0x69'));endCsv();});function main(){return BPromise['resolve']()[_0x05f7('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x05f7('0x10')](',');return db[_0x05f7('0x6a')][_0x05f7('0x55')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x05f7('0x2d')](function(_0x400072){var _0x25eaf7=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x05f7('0x6b')](_0x25eaf7,{'header':!![],'skipEmptyLines':!![],'step':function(_0xd6f236,_0x106289){total+=0x1;var _0x2bfd14=total;promises[_0x05f7('0x2e')](checkRow(_0xd6f236,_0x400072,_0x2bfd14)[_0x05f7('0x2d')](function(){success+=0x1;})['catch'](function(_0x1faaba){if(_0x1faaba['error']){errors+=0x1;delete _0x1faaba['error'];}else if(_0x1faaba[_0x05f7('0x29')]){duplicates+=0x1;delete _0x1faaba[_0x05f7('0x29')];}rows[_0x05f7('0x2e')](_0x1faaba);}));if(total%0xc8===0x0){_0x106289[_0x05f7('0x6c')]();return processPromises(_0x106289);}},'complete':function(){return processPromises()[_0x05f7('0x2d')](function(){logger[_0x05f7('0x68')](_0x05f7('0x6d'));endCsv();});},'error':function(_0x289bb9,_0x120106){logger[_0x05f7('0x68')](_0x05f7('0x6e'),JSON['stringify'](_0x289bb9));endCsv();}});})[_0x05f7('0x30')](function(_0x2143fa){logger[_0x05f7('0x1e')](_0x05f7('0x6f'),JSON[_0x05f7('0x60')](_0x2143fa));});}main(); \ No newline at end of file +var _0x3b50=['cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','str','VoiceQueue','findAll','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','CmList','BlackLists','Campaign','CampaignId'];(function(_0x90aec5,_0x522cb2){var _0x5e3af2=function(_0x3314b6){while(--_0x3314b6){_0x90aec5['push'](_0x90aec5['shift']());}};_0x5e3af2(++_0x522cb2);}(_0x3b50,0x7d));var _0x03b5=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x3b50[_0x2f3794];return _0x1c9fbe;};'use strict';var BPromise=require(_0x03b5('0x0'));var util=require(_0x03b5('0x1'));var _=require(_0x03b5('0x2'));var fs=require('fs');var squel=require(_0x03b5('0x3'));var Papa=require(_0x03b5('0x4'));var Redis=require(_0x03b5('0x5'));var db=require(_0x03b5('0x6'))['db'];var config=require(_0x03b5('0x7'));var logger=require('../../../config/logger')(_0x03b5('0x8'));config['redis']=_[_0x03b5('0x9')](config[_0x03b5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x03b5('0xb'))(new Redis(config[_0x03b5('0xa')]));require(_0x03b5('0xc'))[_0x03b5('0xd')](socket);try{if(!process[_0x03b5('0xe')][0x2]||process[_0x03b5('0xe')][0x2]===_0x03b5('0xf')||process[_0x03b5('0xe')][0x2]===_0x03b5('0x10')){throw new Error(_0x03b5('0x11'));}var FILEPATH=process[_0x03b5('0xe')][0x2];if(!process[_0x03b5('0xe')][0x3]||process['argv'][0x3]===_0x03b5('0xf')||process[_0x03b5('0xe')][0x3]===_0x03b5('0x10')||!process[_0x03b5('0xe')][0x4]||process[_0x03b5('0xe')][0x4]===_0x03b5('0xf')||process[_0x03b5('0xe')][0x4]==='null'){throw new Error(_0x03b5('0x12'));}var FIELDS=_[_0x03b5('0x13')](process[_0x03b5('0xe')][0x3][_0x03b5('0x14')](','),process[_0x03b5('0xe')][0x4][_0x03b5('0x14')](','));if(!process['argv'][0x5]||process[_0x03b5('0xe')][0x5]==='undefined'||process[_0x03b5('0xe')][0x5]===_0x03b5('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x03b5('0xe')][0x6]!==_0x03b5('0xf')&&process[_0x03b5('0xe')][0x6]!==_0x03b5('0x10')?process[_0x03b5('0xe')][0x6]:null;var DUPLICATES=process[_0x03b5('0xe')][0x7]&&process[_0x03b5('0xe')][0x7]!==_0x03b5('0xf')&&process[_0x03b5('0xe')][0x7]!=='null'?process[_0x03b5('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0x03b5('0xe')][0x8]===_0x03b5('0xf')||process[_0x03b5('0xe')][0x8]==='null'){throw new Error(_0x03b5('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3125f6){logger[_0x03b5('0x16')](_0x3125f6);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(_0x160f01,_0x204946,_0x394c22,_0x46cfe5){var _0x5aa12c={'message':_0x204946};_0x5aa12c[_0x160f01]=!![];if(_0x394c22){_0x5aa12c[_0x03b5('0x17')]=_0x394c22;}if(_0x46cfe5){_0x5aa12c['index']=_0x46cfe5;}return _0x5aa12c;}function isEmail(_0x51acf3){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))*$/[_0x03b5('0x18')](_0x51acf3);}function checkRow(_0x13877f,_0x2c4efd,_0xbfb550){return new BPromise(function(_0x206e0d,_0x1e61e0){if(_[_0x03b5('0x19')](_0x13877f)){return _0x1e61e0(handleCheckRowError(_0x03b5('0x16'),_0x03b5('0x1a'),null,_0xbfb550));}if(_0x13877f[_0x03b5('0x1b')]&&_0x13877f[_0x03b5('0x1b')][_0x03b5('0x1c')]){var _0x35b6a6=_[_0x03b5('0x1d')](_0x13877f[_0x03b5('0x1b')],_0x03b5('0x1e'))[_0x03b5('0x1f')](';');return _0x1e61e0(handleCheckRowError(_0x03b5('0x16'),_0x35b6a6,null,_0xbfb550));}var _0x569ff3={};for(var _0xc1619b in FIELDS){if(FIELDS[_0x03b5('0x20')](_0xc1619b)&&FIELDS[_0xc1619b]){_0x569ff3[_0xc1619b]=_0x13877f[_0x03b5('0x21')][0x0][FIELDS[_0xc1619b]]||_0x13877f['data'][0x0]['\ufeff'+FIELDS[_0xc1619b]];}}if(!_0x569ff3[_0x03b5('0x22')]){return _0x1e61e0(handleCheckRowError(_0x03b5('0x16'),_0x03b5('0x23'),null,_0xbfb550));}if(!_0x569ff3[_0x03b5('0x24')]){return _0x1e61e0(handleCheckRowError(_0x03b5('0x16'),_0x03b5('0x25'),null,_0xbfb550));}if(_0x569ff3[_0x03b5('0x26')]){var _0x2f91dd=moment(_0x569ff3[_0x03b5('0x26')],_0x03b5('0x27'));if(!_0x2f91dd[_0x03b5('0x28')]()){return _0x1e61e0(handleCheckRowError(_0x03b5('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0xbfb550));}}if(_0x569ff3[_0x03b5('0x29')]){if(!isEmail(_0x569ff3[_0x03b5('0x29')])){return _0x1e61e0(handleCheckRowError('error',_0x03b5('0x2a'),null,_0xbfb550));}}_0x569ff3[_0x03b5('0x2b')]=LISTID;_0x569ff3['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x03b5('0x1c')]&&_0x2c4efd){var _0x2f04f7={};for(var _0x342d53=0x0,_0x41b738=DUPLICATES['length'];_0x342d53<_0x41b738;_0x342d53+=0x1){_0x2f04f7[DUPLICATES[_0x342d53]]=_0x569ff3[DUPLICATES[_0x342d53]];}var _0x41029b=_[_0x03b5('0x2c')](_0x2c4efd,_0x2f04f7);if(_0x41029b){return _0x1e61e0(handleCheckRowError(_0x03b5('0x2d'),'Duplicate\x20Contact',_0x41029b,_0xbfb550));}}return db[_0x03b5('0x2e')][_0x03b5('0x2f')](_0x569ff3,{'raw':!![],'hooks':![],'fields':_[_0x03b5('0x30')](_0x569ff3)})[_0x03b5('0x31')](function(_0x25265a){if(DUPLICATES&&DUPLICATES['length']&&_0x2c4efd){_0x2c4efd[_0x03b5('0x32')](_[_0x03b5('0x33')](_0x569ff3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x25265a['id'];return _0x206e0d();})[_0x03b5('0x34')](function(_0x59de31){return _0x1e61e0(handleCheckRowError(_0x03b5('0x16'),_0x03b5('0x35')+(_0x59de31[_0x03b5('0x1e')]||JSON[_0x03b5('0x36')](_0x59de31)),null,_0xbfb550));});});}function checkHopper(){function _0x270a2c(){return function(_0x190db6){logger[_0x03b5('0x16')](_0x03b5('0x37'),_0x03b5('0x38'),util[_0x03b5('0x39')](_0x190db6,{'showHidden':![],'depth':null}));};}var _0x4f5573=function(_0x8e6cac,_0x538270){var _0x3c1d4d=squel[_0x03b5('0x3a')]()[_0x03b5('0x3b')](_0x03b5('0x3c'))[_0x03b5('0x3d')]([_0x03b5('0x24'),_0x03b5('0x3e'),_0x03b5('0x3f'),_0x03b5('0x2b'),_0x538270,_0x03b5('0x40'),_0x03b5('0x41')],squel[_0x03b5('0x42')]()['field'](_0x03b5('0x24'),_0x03b5('0x24'))[_0x03b5('0x43')](_0x03b5('0x44'),_0x03b5('0x3e'))[_0x03b5('0x43')]('id',_0x03b5('0x3f'))[_0x03b5('0x43')](LISTID[_0x03b5('0x45')](),_0x03b5('0x2b'))[_0x03b5('0x43')](_0x8e6cac['id'][_0x03b5('0x45')](),_0x538270)[_0x03b5('0x43')](_0x03b5('0x44'),_0x03b5('0x40'))['field'](_0x03b5('0x44'),_0x03b5('0x41'))[_0x03b5('0x46')](_0x03b5('0x47'))[_0x03b5('0x48')](_0x03b5('0x49'))[_0x03b5('0x48')](_0x03b5('0x4a'),LISTID[_0x03b5('0x45')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x03b5('0x48')](_0x03b5('0x4b'),squel[_0x03b5('0x42')]()['field'](_0x03b5('0x24'))[_0x03b5('0x46')](_0x03b5('0x3c'))['where'](_0x538270+_0x03b5('0x4c'),_0x8e6cac['id'][_0x03b5('0x45')]())))[_0x03b5('0x45')]();return _0x3c1d4d;};var _0x575dbc=function(_0x4ff23b,_0x3b6db6){var _0xa526a6=squel[_0x03b5('0x3a')]()['into'](_0x03b5('0x3c'))[_0x03b5('0x3d')]([_0x03b5('0x24'),_0x03b5('0x3e'),_0x03b5('0x3f'),_0x03b5('0x2b'),_0x3b6db6,'createdAt',_0x03b5('0x41')],squel[_0x03b5('0x42')]()[_0x03b5('0x43')](_0x03b5('0x24'),_0x03b5('0x24'))[_0x03b5('0x43')]('NOW()',_0x03b5('0x3e'))['field']('id',_0x03b5('0x3f'))[_0x03b5('0x43')](LISTID[_0x03b5('0x45')](),_0x03b5('0x2b'))[_0x03b5('0x43')](_0x4ff23b['id'][_0x03b5('0x45')](),_0x3b6db6)[_0x03b5('0x43')](_0x03b5('0x44'),'createdAt')[_0x03b5('0x43')](_0x03b5('0x44'),_0x03b5('0x41'))[_0x03b5('0x46')](_0x03b5('0x47'))[_0x03b5('0x48')]('deletedAt\x20IS\x20NULL')[_0x03b5('0x48')](_0x03b5('0x4a'),LISTID[_0x03b5('0x45')]())['where'](_0x03b5('0x4d'),squel['str'](hopperContacts))[_0x03b5('0x48')](_0x03b5('0x4e'))['where'](_0x03b5('0x4b'),squel[_0x03b5('0x42')]()[_0x03b5('0x43')](_0x03b5('0x4f'))[_0x03b5('0x46')](_0x03b5('0x50'))[_0x03b5('0x48')](_0x3b6db6+_0x03b5('0x4c'),_0x4ff23b['id'][_0x03b5('0x45')]()))['where'](_0x03b5('0x4b'),squel['select']()['field']('phone')['from'](_0x03b5('0x3c'))[_0x03b5('0x48')](_0x3b6db6+_0x03b5('0x4c'),_0x4ff23b['id']['toString']())))[_0x03b5('0x45')]();return _0xa526a6;};function _0x21f1a6(_0x385f0b,_0x5e3deb){var _0x4b3ac0=squel[_0x03b5('0x3a')]()[_0x03b5('0x3b')](_0x03b5('0x3c'))['fromQuery'](['phone','scheduledAt',_0x03b5('0x3f'),'ListId',_0x5e3deb,_0x03b5('0x40'),_0x03b5('0x41')],squel[_0x03b5('0x42')]()[_0x03b5('0x43')](_0x03b5('0x24'),_0x03b5('0x24'))[_0x03b5('0x43')]('NOW()',_0x03b5('0x3e'))[_0x03b5('0x43')]('id',_0x03b5('0x3f'))['field'](LISTID[_0x03b5('0x45')](),'ListId')['field'](_0x385f0b['id']['toString'](),_0x5e3deb)[_0x03b5('0x43')]('NOW()',_0x03b5('0x40'))[_0x03b5('0x43')](_0x03b5('0x44'),_0x03b5('0x41'))[_0x03b5('0x46')](_0x03b5('0x47'))['where'](_0x03b5('0x49'))[_0x03b5('0x48')]('ListId\x20=\x20?',LISTID[_0x03b5('0x45')]())[_0x03b5('0x48')](_0x03b5('0x4d'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x03b5('0x45')]();return _0x4b3ac0;}function _0x18198d(_0xa2aa56,_0x4a4e1f){var _0x25c51a=squel['insert']()['into'](_0x03b5('0x51'))[_0x03b5('0x3d')]([_0x03b5('0x24'),'ContactId',_0x03b5('0x2b'),_0x4a4e1f,'createdAt',_0x03b5('0x41')],squel[_0x03b5('0x42')]()['field'](_0x03b5('0x24'),_0x03b5('0x24'))[_0x03b5('0x43')]('id',_0x03b5('0x3f'))['field'](LISTID[_0x03b5('0x45')](),_0x03b5('0x2b'))[_0x03b5('0x43')](_0xa2aa56['id']['toString'](),_0x4a4e1f)[_0x03b5('0x43')](_0x03b5('0x44'),_0x03b5('0x40'))['field']('NOW()','updatedAt')[_0x03b5('0x46')]('cm_contacts')[_0x03b5('0x48')](_0x03b5('0x49'))['where'](_0x03b5('0x4a'),LISTID[_0x03b5('0x45')]())[_0x03b5('0x48')](_0x03b5('0x4d'),squel[_0x03b5('0x52')](hopperContacts))[_0x03b5('0x48')](_0x03b5('0x4e')))['toString']();return _0x25c51a;}return db[_0x03b5('0x53')][_0x03b5('0x54')]({'where':{'type':_0x03b5('0x55')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x03b5('0x56'),'where':{'id':LISTID}}]})[_0x03b5('0x31')](function(_0x193307){var _0x1b3048=[];if(_0x193307){var _0x4a7215;for(var _0x4c1ea3=0x0,_0x1d17bd;_0x4c1ea3<_0x193307[_0x03b5('0x1c')];_0x4c1ea3+=0x1){_0x1d17bd=_0x193307[_0x4c1ea3][_0x03b5('0x57')]({'plain':!![]});switch(_0x1d17bd[_0x03b5('0x58')]){case _0x03b5('0x59'):_0x1b3048['push'](db[_0x03b5('0x5a')][_0x03b5('0x5b')](_0x575dbc(_0x1d17bd,_0x03b5('0x5c')))[_0x03b5('0x31')](function(){})[_0x03b5('0x34')](_0x270a2c()));break;case _0x03b5('0x5d'):_0x1b3048[_0x03b5('0x32')](db[_0x03b5('0x5a')][_0x03b5('0x5b')](_0x4f5573(_0x1d17bd,'VoiceQueueId'))[_0x03b5('0x31')](function(){})[_0x03b5('0x34')](_0x270a2c()));break;default:_0x1b3048[_0x03b5('0x32')](db[_0x03b5('0x5a')][_0x03b5('0x5b')](_0x21f1a6(_0x1d17bd,'VoiceQueueId'))[_0x03b5('0x31')](function(){})[_0x03b5('0x34')](_0x270a2c()));}}}return _0x1b3048;})[_0x03b5('0x5e')]()[_0x03b5('0x31')](function(){return db['VoiceQueue'][_0x03b5('0x54')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x03b5('0x5f')],'as':_0x03b5('0x60'),'where':{'id':LISTID}}]})['then'](function(_0x452d12){var _0x5b4863=[];if(_0x452d12){var _0x27427d;for(var _0x4e0243=0x0,_0x465e25;_0x4e0243<_0x452d12[_0x03b5('0x1c')];_0x4e0243+=0x1){_0x465e25=_0x452d12[_0x4e0243][_0x03b5('0x57')]({'plain':!![]});_0x5b4863[_0x03b5('0x32')](db[_0x03b5('0x5a')][_0x03b5('0x5b')](_0x18198d(_0x465e25,_0x03b5('0x5c')))[_0x03b5('0x31')](function(){})[_0x03b5('0x34')](_0x270a2c()));}}return _0x5b4863;})[_0x03b5('0x5e')]();})[_0x03b5('0x31')](function(){return db[_0x03b5('0x61')][_0x03b5('0x54')]({'attributes':['id',_0x03b5('0x58')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x03b5('0x31')](function(_0x3d8c28){var _0x5ac839=[];if(_0x3d8c28){for(var _0xd963d8=0x0,_0x5b2f1a;_0xd963d8<_0x3d8c28['length'];_0xd963d8+=0x1){_0x5b2f1a=_0x3d8c28[_0xd963d8]['get']({'plain':!![]});switch(_0x5b2f1a[_0x03b5('0x58')]){case'always':_0x5ac839['push'](db['sequelize']['query'](_0x575dbc(_0x5b2f1a,_0x03b5('0x62')))[_0x03b5('0x31')](function(){})['catch'](_0x270a2c()));break;case _0x03b5('0x5d'):_0x5ac839[_0x03b5('0x32')](db[_0x03b5('0x5a')][_0x03b5('0x5b')](_0x4f5573(_0x5b2f1a,_0x03b5('0x62')))['then'](function(){})[_0x03b5('0x34')](_0x270a2c()));break;default:_0x5ac839['push'](db[_0x03b5('0x5a')][_0x03b5('0x5b')](_0x21f1a6(_0x5b2f1a,'CampaignId'))[_0x03b5('0x31')](function(){})[_0x03b5('0x34')](_0x270a2c()));}}}return _0x5ac839;})[_0x03b5('0x5e')]();})[_0x03b5('0x31')](function(){return db['Campaign'][_0x03b5('0x54')]({'attributes':['id'],'include':[{'model':db[_0x03b5('0x5f')],'as':_0x03b5('0x60'),'where':{'id':LISTID}}]})[_0x03b5('0x31')](function(_0xfe431b){var _0x20cc4a=[];if(_0xfe431b){for(var _0x317ff4=0x0,_0x5bed25;_0x317ff4<_0xfe431b[_0x03b5('0x1c')];_0x317ff4+=0x1){_0x5bed25=_0xfe431b[_0x317ff4]['get']({'plain':!![]});_0x20cc4a[_0x03b5('0x32')](db[_0x03b5('0x5a')][_0x03b5('0x5b')](_0x18198d(_0x5bed25,_0x03b5('0x62')))[_0x03b5('0x31')](function(){})['catch'](_0x270a2c()));}}return _0x20cc4a;})['all']();})[_0x03b5('0x34')](function(_0x533ed3){logger[_0x03b5('0x16')](_0x03b5('0x63'),_0x03b5('0x64'),_0x533ed3[_0x03b5('0x1e')]);});}var processPromises=function(_0xbcbfdf){return BPromise[_0x03b5('0x5e')](promises)[_0x03b5('0x31')](function(_0x19a3be){})['catch'](function(_0x5ac4eb){logger[_0x03b5('0x16')](_0x03b5('0x65'),JSON[_0x03b5('0x36')](_0x5ac4eb));})[_0x03b5('0x66')](function(){socket[_0x03b5('0x67')](_0x03b5('0x68')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xbcbfdf){return _0xbcbfdf['resume']();}});};var endCsv=function(){return BPromise[_0x03b5('0x69')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x03b5('0x31')](function(){socket[_0x03b5('0x67')](_0x03b5('0x68')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x27dd7e){logger[_0x03b5('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x03b5('0x36')](_0x27dd7e));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x03b5('0x6a')](_0x03b5('0x6b'));endCsv();});function main(){return BPromise[_0x03b5('0x69')]()[_0x03b5('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x03b5('0x14')](',');return db[_0x03b5('0x2e')][_0x03b5('0x54')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x03b5('0x31')](function(_0xfe54b7){var _0x490a11=fs[_0x03b5('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x490a11,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4a2908,_0x5c4e28){total+=0x1;var _0x429328=total;promises[_0x03b5('0x32')](checkRow(_0x4a2908,_0xfe54b7,_0x429328)[_0x03b5('0x31')](function(){success+=0x1;})[_0x03b5('0x34')](function(_0x1dd60d){if(_0x1dd60d[_0x03b5('0x16')]){errors+=0x1;delete _0x1dd60d[_0x03b5('0x16')];}else if(_0x1dd60d[_0x03b5('0x2d')]){duplicates+=0x1;delete _0x1dd60d[_0x03b5('0x2d')];}rows[_0x03b5('0x32')](_0x1dd60d);}));if(total%0xc8===0x0){_0x5c4e28[_0x03b5('0x6d')]();return processPromises(_0x5c4e28);}},'complete':function(){return processPromises()[_0x03b5('0x31')](function(){logger[_0x03b5('0x6a')](_0x03b5('0x6e'));endCsv();});},'error':function(_0x90dd4a,_0x5d2b1c){logger[_0x03b5('0x6a')](_0x03b5('0x6f'),JSON[_0x03b5('0x36')](_0x90dd4a));endCsv();}});})[_0x03b5('0x34')](function(_0xa5f3e3){logger[_0x03b5('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x03b5('0x36')](_0xa5f3e3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9e4592e..55b3575 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 _0xad09=['argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','uncaughtException','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','test','select','field','phone','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','from','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','fields','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','push','sequelize','query','catch','info','main','stringify','send','start','binding','server/files/tmp','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink'];(function(_0x3df7fc,_0x21b217){var _0x35c745=function(_0x2d9a86){while(--_0x2d9a86){_0x3df7fc['push'](_0x3df7fc['shift']());}};_0x35c745(++_0x21b217);}(_0xad09,0x8c));var _0x9ad0=function(_0x1151fa,_0x2784a7){_0x1151fa=_0x1151fa-0x0;var _0x49da2b=_0xad09[_0x1151fa];return _0x49da2b;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x9ad0('0x0'));var Papa=require(_0x9ad0('0x1'));var util=require(_0x9ad0('0x2'));var BPromise=require('bluebird');var moment=require(_0x9ad0('0x3'));var squel=require(_0x9ad0('0x4'));var Redis=require(_0x9ad0('0x5'));var db=require(_0x9ad0('0x6'))['db'];var config=require(_0x9ad0('0x7'));var logger=require(_0x9ad0('0x8'))(_0x9ad0('0x9'));config[_0x9ad0('0xa')]=_['defaults'](config[_0x9ad0('0xa')],{'host':_0x9ad0('0xb'),'port':0x18eb});var socket=require(_0x9ad0('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x9ad0('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x444548){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))*$/[_0x9ad0('0xe')](_0x444548);}function selectNotIn(_0xc929f4,_0x16ff00,_0x3a1fd0,_0x45f8d4,_0x229610){return squel[_0x9ad0('0xf')]()[_0x9ad0('0x10')](_0x9ad0('0x11'))['from'](_0x45f8d4)['join'](_0x16ff00,null,_0x16ff00+'.id\x20=\x20'+_0x45f8d4+'.'+_0x3a1fd0)[_0x9ad0('0x12')](_0x45f8d4+'.'+_0x3a1fd0+_0x9ad0('0x13')+_0xc929f4+'.'+_0x3a1fd0)['where'](_0x16ff00+_0x9ad0('0x14')+_0x229610['join']()+')');}function insertCmHopper(_0x3cd7cb,_0x15b179,_0x4c291f,_0x31f735,_0x5e7c1c){var _0x483c40=[_0x9ad0('0x15'),_0x9ad0('0x16'),_0x9ad0('0x17'),_0x9ad0('0x18'),_0x15b179+'.'+_0x31f735,'cm_contacts.createdAt',_0x9ad0('0x19'),_0x9ad0('0x1a'),_0x9ad0('0x1b'),'\x22'+_0x5e7c1c+'\x22'];return squel['insert']()[_0x9ad0('0x1c')]('cm_hopper')[_0x9ad0('0x1d')](['phone',_0x9ad0('0x1e'),_0x9ad0('0x1f'),_0x9ad0('0x20'),_0x31f735,_0x9ad0('0x21'),_0x9ad0('0x22'),_0x9ad0('0x23'),_0x9ad0('0x24'),_0x9ad0('0x25')],squel[_0x9ad0('0xf')]()['fields'](_0x483c40)[_0x9ad0('0x26')](_0x15b179)[_0x9ad0('0x27')](_0x9ad0('0x28'),null,_0x9ad0('0x29')+_0x15b179+_0x9ad0('0x2a'))[_0x9ad0('0x27')](_0x4c291f,null,_0x4c291f+'.id\x20=\x20'+_0x15b179+'.'+_0x31f735)['where'](_0x15b179+_0x9ad0('0x2b'),_0x3cd7cb)['where'](_0x9ad0('0x2c'),NOW)[_0x9ad0('0x12')](_0x9ad0('0x2d'),selectNotIn(_0x15b179,_0x4c291f,_0x31f735,_0x9ad0('0x2e'),[_0x9ad0('0x2f'),_0x9ad0('0x30')]))[_0x9ad0('0x12')](_0x9ad0('0x2d'),selectNotIn(_0x15b179,_0x4c291f,_0x31f735,_0x9ad0('0x2e'),[_0x9ad0('0x2f')])))[_0x9ad0('0x31')]();}function insertCmHopperBlack(_0x53c1b4,_0x172145,_0xcb9d9b,_0x4a901d){var _0x3c9434=[_0x9ad0('0x15'),_0x9ad0('0x17'),'cm_contacts.ListId',_0x172145+'.'+_0x4a901d,'cm_contacts.createdAt',_0x9ad0('0x19')];return squel[_0x9ad0('0x32')]()[_0x9ad0('0x1c')](_0x9ad0('0x33'))['fromQuery']([_0x9ad0('0x11'),_0x9ad0('0x1f'),'ListId',_0x4a901d,_0x9ad0('0x21'),_0x9ad0('0x22')],squel[_0x9ad0('0xf')]()[_0x9ad0('0x34')](_0x3c9434)[_0x9ad0('0x26')](_0x172145)[_0x9ad0('0x27')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x172145+'.CmListId')[_0x9ad0('0x27')](_0xcb9d9b,null,_0xcb9d9b+'.id\x20=\x20'+_0x172145+'.'+_0x4a901d)[_0x9ad0('0x12')](_0x172145+_0x9ad0('0x2b'),_0x53c1b4)[_0x9ad0('0x12')](_0x9ad0('0x2c'),NOW)[_0x9ad0('0x12')](_0x9ad0('0x2d'),squel['select']()[_0x9ad0('0x10')](_0x9ad0('0x11'))[_0x9ad0('0x26')]('cm_hopper_black')[_0x9ad0('0x12')]('ListId\x20=\x20?',_0x53c1b4)[_0x9ad0('0x12')](_0x4a901d+'\x20=\x20?',_0x172145+'.'+_0x4a901d)))['toString']();}function insertCmContact(_0x54cac2,_0xfa6dd3,_0x5817f5,_0x131b70){var _0x1d4dc7=_['concat'](_[_0x9ad0('0x35')](_0x131b70),[_0x9ad0('0x20'),_0x9ad0('0x36'),_0x9ad0('0x21'),_0x9ad0('0x22')]);return squel['insert']()['into'](_0x9ad0('0x28'))[_0x9ad0('0x1d')](_0x1d4dc7,squel['select']()[_0x9ad0('0x34')](_0x1d4dc7)['from'](_0xfa6dd3)[_0x9ad0('0x12')]('('+_0x5817f5['join'](',')+_0x9ad0('0x37'),squel[_0x9ad0('0xf')]()['fields'](_0x5817f5)['from']('cm_contacts')['where'](_0x9ad0('0x38'),_0x54cac2)[_0x9ad0('0x12')]('deletedAt\x20IS\x20NULL'))[_0x9ad0('0x12')](_0x9ad0('0x39'),squel[_0x9ad0('0xf')]()['field'](_0x9ad0('0x3a'),_0x9ad0('0x3b'))[_0x9ad0('0x26')](_0xfa6dd3)[_0x9ad0('0x3c')](_0x5817f5[_0x9ad0('0x27')](','))))[_0x9ad0('0x31')]();}function handleStop(){logger['info'](_0x9ad0('0x3d'));stopped=!![];}function handleUncaughtException(_0x3a8bae){logger[_0x9ad0('0x3e')](_0x3a8bae[_0x9ad0('0x3f')]);process[_0x9ad0('0x40')](0x1);}function handleError(_0x71ca3e,_0x1fab6e){stats[_0x9ad0('0x41')][_0x9ad0('0x42')]({'name':_0x1fab6e['code'],'message':_0x1fab6e[_0x9ad0('0x3f')],'row':_0x71ca3e});}function handleQuery(_0x4fbf3e){logger['info'](_0x4fbf3e);return db[_0x9ad0('0x43')][_0x9ad0('0x44')](_0x4fbf3e)['spread'](function(_0x3d2835){results['push'](_0x3d2835);})[_0x9ad0('0x45')](function(_0x479eda){logger[_0x9ad0('0x3e')](_0x479eda[_0x9ad0('0x3f')]);});}function main(_0x5d74a7,_0x685e9a,_0x2a976e,_0x498772){logger[_0x9ad0('0x46')](_0x9ad0('0x47'),_0x5d74a7,JSON[_0x9ad0('0x48')](_0x685e9a));process[_0x9ad0('0x49')](_0x9ad0('0x4a'));var _0x466ef2=_0x685e9a[_0x9ad0('0x4b')];var _0x36c441=_0x685e9a['socket_timestamp'];var _0x35e1f4=path[_0x9ad0('0x27')](config['root'],_0x9ad0('0x4c'),_0x36c441+'.csv');var _0x39166f=_[_0x9ad0('0x35')](_0x466ef2)[_0x9ad0('0x27')]();logger['info']('header',_0x39166f);fs[_0x9ad0('0x4d')](_0x35e1f4,_0x39166f+'\x0a');Papa[_0x9ad0('0x4e')](fs[_0x9ad0('0x4f')](_0x5d74a7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a862e,_0xb8304d){try{for(var _0x28701e=0x0,_0x516c20=[];_0x28701e<_0x3a862e[_0x9ad0('0x50')][_0x9ad0('0x51')];_0x28701e++){stats[_0x9ad0('0x52')]+=0x1;if(_0x3a862e[_0x9ad0('0x41')][_0x28701e]){handleError(_0x3a862e[_0x9ad0('0x50')][_0x28701e],_0x3a862e[_0x9ad0('0x41')][_0x28701e]);}else{var _0xca4fb0=[];for(var _0x5e002a in _0x466ef2){if(_0x466ef2[_0x9ad0('0x53')](_0x5e002a)){if(_0x3a862e[_0x9ad0('0x50')][_0x28701e][_0x466ef2[_0x5e002a]]){var _0x1be6aa=_[_0x9ad0('0x54')](_0x3a862e[_0x9ad0('0x50')][_0x28701e][_0x466ef2[_0x5e002a]][_0x9ad0('0x55')](/"/g,'\x27'));switch(_0x5e002a){case _0x9ad0('0x1e'):var _0x4d6e23=moment(_0x1be6aa,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4d6e23[_0x9ad0('0x56')]()){_0x516c20['push']('\x22'+_0x1be6aa+'\x22');}else{_0xca4fb0[_0x9ad0('0x42')](_0x9ad0('0x57'));}break;case _0x9ad0('0x23'):var _0x155218=parseInt(_0x1be6aa);_0x1be6aa=_[_0x9ad0('0x58')](_0x155218)||_0x155218<0x0||_0x155218>0x4?_0x498772?0x3:0x2:_0x155218;_0x516c20['push']('\x22'+_0x1be6aa+'\x22');break;case _0x9ad0('0x24'):var _0x2e0a0d=parseInt(_0x1be6aa);if(_[_0x9ad0('0x59')](_0x2e0a0d)&&_[_0x9ad0('0x5a')](_0x2a976e,_0x2e0a0d)){_0x516c20[_0x9ad0('0x42')]('\x22'+_0x2e0a0d+'\x22');}else{_0xca4fb0[_0x9ad0('0x42')](_0x9ad0('0x5b'));}break;case'email':if(isEmail(_0x1be6aa)){_0x516c20[_0x9ad0('0x42')]('\x22'+_0x1be6aa+'\x22');}else{_0xca4fb0[_0x9ad0('0x42')](_0x9ad0('0x5c'));}break;case'dateOfBirth':var _0xf0afb9=moment(_0x1be6aa,_0x9ad0('0x5d'),!![]);if(_0xf0afb9['isValid']()){_0x516c20[_0x9ad0('0x42')]('\x22'+_0x1be6aa+'\x22');}else{_0xca4fb0[_0x9ad0('0x42')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x516c20['push']('\x22'+_0x1be6aa+'\x22');}}else{switch(_0x5e002a){case _0x9ad0('0x5e'):case'phone':_0xca4fb0[_0x9ad0('0x42')](_0x5e002a+_0x9ad0('0x5f'));break;default:_0x516c20[_0x9ad0('0x42')]('\x22\x22');}}}}if(_0xca4fb0[_0x9ad0('0x51')]){handleError(_0x3a862e[_0x9ad0('0x50')][_0x28701e],{'code':_0x9ad0('0x60'),'message':_0xca4fb0[_0x9ad0('0x27')]()});}else{fs[_0x9ad0('0x61')](_0x35e1f4,_0x516c20['join']()+'\x0a');}_0x516c20=[];}if(!(stats[_0x9ad0('0x52')]%0xc8)){socket[_0x9ad0('0x62')](_0x9ad0('0x63')+_0x36c441,stats);stats['errors']=[];}}if(stopped){logger['info']('Abort\x20parser');_0xb8304d[_0x9ad0('0x64')]();}}catch(_0x4ac093){handleError(_0x3a862e[_0x9ad0('0x50')][_0x28701e],{'code':_0x9ad0('0x65'),'message':_0x4ac093[_0x9ad0('0x3f')]});logger[_0x9ad0('0x3e')](_0x9ad0('0x66'),_0x4ac093[_0x9ad0('0x3f')]);}},'complete':function(){try{var _0x13b711=[];var _0x4f7668=_0x9ad0('0x28');if(_0x685e9a[_0x9ad0('0x67')]&&_0x685e9a[_0x9ad0('0x67')][_0x9ad0('0x51')]){_0x4f7668='cm_contacts_'+_0x36c441;_0x13b711['push']('CREATE\x20TABLE\x20'+_0x4f7668+_0x9ad0('0x68'));}var _0x4407f7=util[_0x9ad0('0xd')](_0x9ad0('0x69'),_0x35e1f4,_0x4f7668,_0x39166f,_0x685e9a[_0x9ad0('0x20')],_0x685e9a['CompanyId']||null,NOW,NOW);if(_[_0x9ad0('0x6a')](_0x466ef2[_0x9ad0('0x1e')])){_0x4407f7+=',\x20scheduledAt\x20=\x20NOW()';}_0x13b711[_0x9ad0('0x42')](_0x4407f7);if(_0x685e9a[_0x9ad0('0x67')]&&_0x685e9a[_0x9ad0('0x67')][_0x9ad0('0x51')]){_0x13b711[_0x9ad0('0x42')](insertCmContact(_0x685e9a[_0x9ad0('0x20')],_0x4f7668,_0x685e9a[_0x9ad0('0x67')],_0x466ef2));_0x13b711[_0x9ad0('0x42')](_0x9ad0('0x6b')+_0x4f7668+';');}_0x13b711[_0x9ad0('0x42')](insertCmHopper(_0x685e9a[_0x9ad0('0x20')],_0x9ad0('0x6c'),_0x9ad0('0x6d'),_0x9ad0('0x6e'),_0x498772));_0x13b711['push'](insertCmHopperBlack(_0x685e9a[_0x9ad0('0x20')],_0x9ad0('0x6f'),_0x9ad0('0x6d'),_0x9ad0('0x6e')));_0x13b711[_0x9ad0('0x42')](insertCmHopper(_0x685e9a[_0x9ad0('0x20')],_0x9ad0('0x70'),_0x9ad0('0x71'),_0x9ad0('0x72'),_0x498772));_0x13b711[_0x9ad0('0x42')](insertCmHopperBlack(_0x685e9a[_0x9ad0('0x20')],'campaigns_has_cm_blacklists',_0x9ad0('0x71'),_0x9ad0('0x72')));BPromise[_0x9ad0('0x73')](_0x13b711,handleQuery)[_0x9ad0('0x74')](function(_0x401ca3){stats[_0x9ad0('0x75')]=!![];stats[_0x9ad0('0x76')]=_0x685e9a[_0x9ad0('0x67')]&&_0x685e9a['duplicates'][_0x9ad0('0x51')]?results[0x2][_0x9ad0('0x76')]:results[0x0][_0x9ad0('0x76')];socket[_0x9ad0('0x62')](_0x9ad0('0x63')+_0x36c441,stats);fs[_0x9ad0('0x77')](_0x5d74a7);fs['unlink'](_0x35e1f4);process[_0x9ad0('0x40')](0x0);})[_0x9ad0('0x45')](function(_0x471a0e){logger[_0x9ad0('0x3e')](_0x471a0e[_0x9ad0('0x3f')]);process[_0x9ad0('0x40')](0x1);});}catch(_0x265f02){logger['error']('complete',_0x265f02['message']);process[_0x9ad0('0x40')](0x1);}},'error':function(_0x3b1b20,_0x15a570,_0x253b89,_0x2f4ead){throw new Error(_0x2f4ead);}});}function validate(){if(process[_0x9ad0('0x78')]&&process['argv'][_0x9ad0('0x51')]<0x4){throw new Error(_0x9ad0('0x79'));}var _0x3122cd=path[_0x9ad0('0x27')](config['root'],'server/files/tmp',process[_0x9ad0('0x78')][0x2]);if(!fs[_0x9ad0('0x7a')](_0x3122cd)){throw new Error(_0x9ad0('0x7b'));}var _0xe0183f={};try{_0xe0183f=JSON[_0x9ad0('0x4e')](process[_0x9ad0('0x78')][0x3]);if(!_0xe0183f[_0x9ad0('0x4b')]){throw new Error(_0x9ad0('0x7c'));}if(!_0xe0183f[_0x9ad0('0x4b')]['phone']){throw new Error(_0x9ad0('0x7d'));}if(!_0xe0183f[_0x9ad0('0x4b')]['firstName']){throw new Error(_0x9ad0('0x7e'));}var _0x2afdce=0x0;if(_0xe0183f[_0x9ad0('0x4b')][_0x9ad0('0x24')]){_0x2afdce=0x1;}if(!_0xe0183f[_0x9ad0('0x20')]){throw new Error(_0x9ad0('0x7f'));}}catch(_0x4df8e0){throw new Error(_0x9ad0('0x80'));}var _0x3e3b21=[];try{_0x3e3b21=_['map'](JSON['parse'](process[_0x9ad0('0x78')][0x4]),'id');}catch(_0x349d58){logger[_0x9ad0('0x46')]('No\x20agent\x20available');}main(_0x3122cd,_0xe0183f,_0x3e3b21,_0x2afdce);}validate();process['on']('SIGINT',handleStop);process['on'](_0x9ad0('0x81'),handleUncaughtException); \ No newline at end of file +var _0xf37e=['ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','../../../mysqldb','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','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','updatedAt','priority','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','cm_contacts.updatedAt','createdAt','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','push','code','query','catch','stringify','send','start','socket_timestamp','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil','scheduledat','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory'];(function(_0x4d8134,_0x57e5ac){var _0x2f85e2=function(_0x22c065){while(--_0x22c065){_0x4d8134['push'](_0x4d8134['shift']());}};_0x2f85e2(++_0x57e5ac);}(_0xf37e,0x1a6));var _0xef37=function(_0x6d5698,_0x5d08c4){_0x6d5698=_0x6d5698-0x0;var _0x15d91a=_0xf37e[_0x6d5698];return _0x15d91a;};'use strict';var fs=require('fs');var path=require(_0xef37('0x0'));var _=require('lodash');var Papa=require(_0xef37('0x1'));var util=require(_0xef37('0x2'));var BPromise=require(_0xef37('0x3'));var moment=require(_0xef37('0x4'));var squel=require(_0xef37('0x5'));var Redis=require('ioredis');var db=require(_0xef37('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xef37('0x7'));config[_0xef37('0x8')]=_[_0xef37('0x9')](config[_0xef37('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xef37('0xa'))(new Redis(config[_0xef37('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xef37('0xb')](_0xef37('0xc'));function isEmail(_0x10c281){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))*$/[_0xef37('0xd')](_0x10c281);}function selectNotIn(_0x547924,_0x35e0aa,_0x19a258,_0x3a3292,_0x4090b4){return squel[_0xef37('0xe')]()[_0xef37('0xf')](_0xef37('0x10'))[_0xef37('0x11')](_0x3a3292)[_0xef37('0x12')](_0x35e0aa,null,_0x35e0aa+_0xef37('0x13')+_0x3a3292+'.'+_0x19a258)[_0xef37('0x14')](_0x3a3292+'.'+_0x19a258+_0xef37('0x15')+_0x547924+'.'+_0x19a258)[_0xef37('0x14')](_0x35e0aa+_0xef37('0x16')+_0x4090b4['join']()+')');}function insertCmHopper(_0x469b23,_0x34ac05,_0x1717fe,_0x1e3dc0,_0x25dc4e){var _0x4bcb98=[_0xef37('0x17'),'cm_contacts.scheduledat',_0xef37('0x18'),_0xef37('0x19'),_0x34ac05+'.'+_0x1e3dc0,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xef37('0x1a'),_0xef37('0x1b'),'\x22'+_0x25dc4e+'\x22'];return squel[_0xef37('0x1c')]()[_0xef37('0x1d')]('cm_hopper')[_0xef37('0x1e')]([_0xef37('0x10'),'scheduledat',_0xef37('0x1f'),_0xef37('0x20'),_0x1e3dc0,'createdAt',_0xef37('0x21'),_0xef37('0x22'),'UserId','recallme'],squel['select']()[_0xef37('0x23')](_0x4bcb98)[_0xef37('0x11')](_0x34ac05)[_0xef37('0x12')](_0xef37('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x34ac05+_0xef37('0x25'))[_0xef37('0x12')](_0x1717fe,null,_0x1717fe+_0xef37('0x13')+_0x34ac05+'.'+_0x1e3dc0)[_0xef37('0x14')](_0x34ac05+_0xef37('0x26'),_0x469b23)[_0xef37('0x14')](_0xef37('0x27'),NOW)[_0xef37('0x14')](_0xef37('0x28'),selectNotIn(_0x34ac05,_0x1717fe,_0x1e3dc0,_0xef37('0x29'),[_0xef37('0x2a'),_0xef37('0x2b')]))[_0xef37('0x14')](_0xef37('0x28'),selectNotIn(_0x34ac05,_0x1717fe,_0x1e3dc0,'cm_hopper',[_0xef37('0x2a')])))['toString']();}function insertCmHopperBlack(_0x4417fa,_0x505bcf,_0xecd48,_0x3e8240){var _0x31302e=['cm_contacts.phone',_0xef37('0x18'),_0xef37('0x19'),_0x505bcf+'.'+_0x3e8240,_0xef37('0x2c'),_0xef37('0x2d')];return squel[_0xef37('0x1c')]()[_0xef37('0x1d')]('cm_hopper_black')[_0xef37('0x1e')](['phone',_0xef37('0x1f'),_0xef37('0x20'),_0x3e8240,_0xef37('0x2e'),'updatedAt'],squel['select']()[_0xef37('0x23')](_0x31302e)[_0xef37('0x11')](_0x505bcf)['join']('cm_contacts',null,_0xef37('0x2f')+_0x505bcf+_0xef37('0x25'))['join'](_0xecd48,null,_0xecd48+'.id\x20=\x20'+_0x505bcf+'.'+_0x3e8240)[_0xef37('0x14')](_0x505bcf+_0xef37('0x26'),_0x4417fa)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xef37('0x14')](_0xef37('0x28'),squel[_0xef37('0xe')]()[_0xef37('0xf')]('phone')['from'](_0xef37('0x30'))[_0xef37('0x14')](_0xef37('0x31'),_0x4417fa)[_0xef37('0x14')](_0x3e8240+_0xef37('0x32'),_0x505bcf+'.'+_0x3e8240)))[_0xef37('0x33')]();}function insertCmContact(_0x473fbc,_0x36970c,_0x391cd0,_0x512076){var _0x17ad46=_['concat'](_[_0xef37('0x34')](_0x512076),[_0xef37('0x20'),'CompanyId',_0xef37('0x2e'),_0xef37('0x21')]);return squel[_0xef37('0x1c')]()[_0xef37('0x1d')](_0xef37('0x24'))[_0xef37('0x1e')](_0x17ad46,squel[_0xef37('0xe')]()[_0xef37('0x23')](_0x17ad46)['from'](_0x36970c)['where']('('+_0x391cd0[_0xef37('0x12')](',')+_0xef37('0x35'),squel[_0xef37('0xe')]()[_0xef37('0x23')](_0x391cd0)['from'](_0xef37('0x24'))['where']('ListId\x20=\x20?',_0x473fbc)[_0xef37('0x14')](_0xef37('0x36')))[_0xef37('0x14')](_0xef37('0x37'),squel[_0xef37('0xe')]()[_0xef37('0xf')](_0xef37('0x38'),_0xef37('0x39'))[_0xef37('0x11')](_0x36970c)['group'](_0x391cd0[_0xef37('0x12')](','))))[_0xef37('0x33')]();}function handleStop(){logger[_0xef37('0x3a')](_0xef37('0x3b'));stopped=!![];}function handleUncaughtException(_0x325e8b){logger[_0xef37('0x3c')](_0x325e8b[_0xef37('0x3d')]);process[_0xef37('0x3e')](0x1);}function handleError(_0x5aa57f,_0x4fda5b){stats['errors'][_0xef37('0x3f')]({'name':_0x4fda5b[_0xef37('0x40')],'message':_0x4fda5b[_0xef37('0x3d')],'row':_0x5aa57f});}function handleQuery(_0x3788ca){logger[_0xef37('0x3a')](_0x3788ca);return db['sequelize'][_0xef37('0x41')](_0x3788ca)['spread'](function(_0x8ecf82){results[_0xef37('0x3f')](_0x8ecf82);})[_0xef37('0x42')](function(_0x3f8d24){logger[_0xef37('0x3c')](_0x3f8d24['message']);});}function main(_0x2d449a,_0x3aa9c8,_0x24a406,_0x361a55){logger[_0xef37('0x3a')]('main',_0x2d449a,JSON[_0xef37('0x43')](_0x3aa9c8));process[_0xef37('0x44')](_0xef37('0x45'));var _0x4f0ce2=_0x3aa9c8['binding'];var _0x5d8ef5=_0x3aa9c8[_0xef37('0x46')];var _0x25bb8d=path[_0xef37('0x12')](config['root'],_0xef37('0x47'),_0x5d8ef5+_0xef37('0x48'));var _0x39fcef=_[_0xef37('0x34')](_0x4f0ce2)['join']();logger['info'](_0xef37('0x49'),_0x39fcef);fs[_0xef37('0x4a')](_0x25bb8d,_0x39fcef+'\x0a');Papa[_0xef37('0x4b')](fs[_0xef37('0x4c')](_0x2d449a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x387b1a,_0x5013d2){try{for(var _0x441fab=0x0,_0x2b57b9=[];_0x441fab<_0x387b1a[_0xef37('0x4d')][_0xef37('0x4e')];_0x441fab++){stats[_0xef37('0x4f')]+=0x1;if(_0x387b1a[_0xef37('0x50')][_0x441fab]){handleError(_0x387b1a[_0xef37('0x4d')][_0x441fab],_0x387b1a['errors'][_0x441fab]);}else{var _0x3310ec=[];for(var _0x52d8a4 in _0x4f0ce2){if(_0x4f0ce2[_0xef37('0x51')](_0x52d8a4)){if(_0x387b1a[_0xef37('0x4d')][_0x441fab][_0x4f0ce2[_0x52d8a4]]){var _0x53a260=_[_0xef37('0x52')](_0x387b1a[_0xef37('0x4d')][_0x441fab][_0x4f0ce2[_0x52d8a4]][_0xef37('0x53')](/"/g,'\x27'));switch(_0x52d8a4){case'scheduledat':var _0x5a9d19=moment(_0x53a260,_0xef37('0xc'),!![]);if(_0x5a9d19[_0xef37('0x54')]()){_0x2b57b9[_0xef37('0x3f')]('\x22'+_0x53a260+'\x22');}else{_0x3310ec[_0xef37('0x3f')](_0xef37('0x55'));}break;case _0xef37('0x22'):var _0x22e570=parseInt(_0x53a260);_0x53a260=_[_0xef37('0x56')](_0x22e570)||_0x22e570<0x0||_0x22e570>0x4?_0x361a55?0x3:0x2:_0x22e570;_0x2b57b9[_0xef37('0x3f')]('\x22'+_0x53a260+'\x22');break;case _0xef37('0x57'):var _0x2e6724=parseInt(_0x53a260);if(_[_0xef37('0x58')](_0x2e6724)&&_[_0xef37('0x59')](_0x24a406,_0x2e6724)){_0x2b57b9['push']('\x22'+_0x2e6724+'\x22');}else{_0x3310ec[_0xef37('0x3f')](_0xef37('0x5a'));}break;case _0xef37('0x5b'):if(isEmail(_0x53a260)){_0x2b57b9['push']('\x22'+_0x53a260+'\x22');}else{_0x3310ec['push'](_0xef37('0x5c'));}break;case _0xef37('0x5d'):var _0x44c4c=moment(_0x53a260,'YYYY-MM-DD',!![]);if(_0x44c4c[_0xef37('0x54')]()){_0x2b57b9['push']('\x22'+_0x53a260+'\x22');}else{_0x3310ec['push'](_0xef37('0x5e'));}break;default:_0x2b57b9['push']('\x22'+_0x53a260+'\x22');}}else{switch(_0x52d8a4){case _0xef37('0x5f'):case'phone':_0x3310ec[_0xef37('0x3f')](_0x52d8a4+'\x20not\x20specified');break;default:_0x2b57b9[_0xef37('0x3f')]('\x22\x22');}}}}if(_0x3310ec[_0xef37('0x4e')]){handleError(_0x387b1a['data'][_0x441fab],{'code':_0xef37('0x60'),'message':_0x3310ec['join']()});}else{fs[_0xef37('0x61')](_0x25bb8d,_0x2b57b9[_0xef37('0x12')]()+'\x0a');}_0x2b57b9=[];}if(!(stats[_0xef37('0x4f')]%0xc8)){socket[_0xef37('0x62')]('contact:import:'+_0x5d8ef5,stats);stats[_0xef37('0x50')]=[];}}if(stopped){logger[_0xef37('0x3a')](_0xef37('0x63'));_0x5013d2[_0xef37('0x64')]();}}catch(_0x5a0780){handleError(_0x387b1a[_0xef37('0x4d')][_0x441fab],{'code':_0xef37('0x65'),'message':_0x5a0780[_0xef37('0x3d')]});logger[_0xef37('0x3c')](_0xef37('0x66'),_0x5a0780[_0xef37('0x3d')]);}},'complete':function(){try{var _0x502732=[];var _0x5a7231=_0xef37('0x24');if(_0x3aa9c8[_0xef37('0x67')]&&_0x3aa9c8[_0xef37('0x67')][_0xef37('0x4e')]){_0x5a7231=_0xef37('0x68')+_0x5d8ef5;_0x502732[_0xef37('0x3f')](_0xef37('0x69')+_0x5a7231+_0xef37('0x6a'));}var _0xd85e36=util[_0xef37('0xb')](_0xef37('0x6b'),_0x25bb8d,_0x5a7231,_0x39fcef,_0x3aa9c8[_0xef37('0x20')],_0x3aa9c8[_0xef37('0x6c')]||null,NOW,NOW);if(_[_0xef37('0x6d')](_0x4f0ce2[_0xef37('0x6e')])){_0xd85e36+=',\x20scheduledAt\x20=\x20NOW()';}_0x502732['push'](_0xd85e36);if(_0x3aa9c8[_0xef37('0x67')]&&_0x3aa9c8[_0xef37('0x67')][_0xef37('0x4e')]){_0x502732[_0xef37('0x3f')](insertCmContact(_0x3aa9c8['ListId'],_0x5a7231,_0x3aa9c8['duplicates'],_0x4f0ce2));_0x502732[_0xef37('0x3f')](_0xef37('0x6f')+_0x5a7231+';');}_0x502732[_0xef37('0x3f')](insertCmHopper(_0x3aa9c8[_0xef37('0x20')],_0xef37('0x70'),_0xef37('0x71'),_0xef37('0x72'),_0x361a55));_0x502732[_0xef37('0x3f')](insertCmHopperBlack(_0x3aa9c8[_0xef37('0x20')],_0xef37('0x73'),'voice_queues',_0xef37('0x72')));_0x502732[_0xef37('0x3f')](insertCmHopper(_0x3aa9c8[_0xef37('0x20')],_0xef37('0x74'),_0xef37('0x75'),'CampaignId',_0x361a55));_0x502732[_0xef37('0x3f')](insertCmHopperBlack(_0x3aa9c8[_0xef37('0x20')],_0xef37('0x76'),_0xef37('0x75'),_0xef37('0x77')));BPromise[_0xef37('0x78')](_0x502732,handleQuery)[_0xef37('0x79')](function(_0x410879){stats[_0xef37('0x7a')]=!![];stats[_0xef37('0x7b')]=_0x3aa9c8[_0xef37('0x67')]&&_0x3aa9c8['duplicates']['length']?results[0x2][_0xef37('0x7b')]:results[0x0][_0xef37('0x7b')];socket[_0xef37('0x62')](_0xef37('0x7c')+_0x5d8ef5,stats);fs['unlink'](_0x2d449a);fs[_0xef37('0x7d')](_0x25bb8d);process[_0xef37('0x3e')](0x0);})[_0xef37('0x42')](function(_0x466449){logger[_0xef37('0x3c')](_0x466449[_0xef37('0x3d')]);process[_0xef37('0x3e')](0x1);});}catch(_0x4e32d4){logger['error'](_0xef37('0x7e'),_0x4e32d4[_0xef37('0x3d')]);process[_0xef37('0x3e')](0x1);}},'error':function(_0x3b190c,_0x382dae,_0x5e6a2b,_0x4a1006){throw new Error(_0x4a1006);}});}function validate(){if(process[_0xef37('0x7f')]&&process['argv']['length']<0x4){throw new Error(_0xef37('0x80'));}var _0x2306b0=path[_0xef37('0x12')](config[_0xef37('0x81')],_0xef37('0x47'),process[_0xef37('0x7f')][0x2]);if(!fs['existsSync'](_0x2306b0)){throw new Error(_0xef37('0x82'));}var _0xbc912b={};try{_0xbc912b=JSON[_0xef37('0x4b')](process[_0xef37('0x7f')][0x3]);if(!_0xbc912b[_0xef37('0x83')]){throw new Error(_0xef37('0x84'));}if(!_0xbc912b[_0xef37('0x83')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0xbc912b[_0xef37('0x83')][_0xef37('0x5f')]){throw new Error(_0xef37('0x85'));}var _0xf02fc5=0x0;if(_0xbc912b[_0xef37('0x83')]['UserId']){_0xf02fc5=0x1;}if(!_0xbc912b[_0xef37('0x20')]){throw new Error(_0xef37('0x86'));}}catch(_0x4fe8ba){throw new Error(_0xef37('0x87'));}var _0xe2033e=[];try{_0xe2033e=_[_0xef37('0x88')](JSON[_0xef37('0x4b')](process['argv'][0x4]),'id');}catch(_0x13ce08){logger[_0xef37('0x3a')]('No\x20agent\x20available');}main(_0x2306b0,_0xbc912b,_0xe2033e,_0xf02fc5);}validate();process['on'](_0xef37('0x89'),handleStop);process['on'](_0xef37('0x8a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index da43a7c..889cd2d 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7385=['Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x7385,0x185));var _0x5738=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7385[_0x2dafbe];return _0x58a45a;};'use strict';exports[_0x5738('0x0')]=function(_0x1fae67,_0x19d293){var _0x4a56e8=[{'type':_0x5738('0x1'),'content':_0x5738('0x2'),'variableName':null}];switch(_0x1fae67[_0x5738('0x3')]()){case _0x5738('0x4'):switch(_0x19d293[_0x5738('0x3')]()){case _0x5738('0x5'):_0x4a56e8[_0x5738('0x6')]({'type':_0x5738('0x7'),'content':'','variableName':_0x5738('0x8')});_0x4a56e8[_0x5738('0x6')]({'type':'variable','content':'','variableName':_0x5738('0x9')});break;case _0x5738('0xa'):_0x4a56e8['push']({'type':_0x5738('0x1'),'content':_0x5738('0xb'),'variableName':null});_0x4a56e8[_0x5738('0x6')]({'type':'variable','content':'','variableName':_0x5738('0xc')});break;}}return _0x4a56e8;};exports[_0x5738('0xd')]=function(_0x1606b9,_0x1816fc){var _0x5da78f=[];switch(_0x1606b9[_0x5738('0x3')]()){case _0x5738('0x4'):switch(_0x1816fc[_0x5738('0x3')]()){case'inbound':_0x5da78f=[{'type':'string','content':_0x5738('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x5738('0xf'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x5738('0x9')},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x10'),'keyType':'variable','variableName':_0x5738('0x11')},{'type':'keyValue','content':'','key':_0x5738('0x12'),'keyType':_0x5738('0x7'),'variableName':_0x5738('0x13')},{'type':'keyValue','content':'','key':_0x5738('0x14'),'keyType':'variable','variableName':_0x5738('0x8')},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x15'),'keyType':_0x5738('0x7'),'variableName':_0x5738('0x16')},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x17'),'keyType':_0x5738('0x7'),'variableName':_0x5738('0x18')},{'type':_0x5738('0x1'),'content':_0x5738('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x1a'),'keyType':'variable','variableName':_0x5738('0x1b')},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x1c'),'keyType':'variable','variableName':_0x5738('0xc')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x1d'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x5738('0xf'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x5738('0x1e')},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x1f'),'keyType':'variable','variableName':_0x5738('0x20')},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x21'),'keyType':_0x5738('0x7'),'variableName':_0x5738('0x22')},{'type':'keyValue','content':'','key':_0x5738('0x23'),'keyType':'variable','variableName':'talktime'}];break;case _0x5738('0xa'):_0x5da78f=[{'type':_0x5738('0x1'),'content':_0x5738('0xe'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x5738('0xc')},{'type':_0x5738('0xf'),'content':'','key':'Member\x20Name','keyType':_0x5738('0x7'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0x5738('0x15'),'keyType':_0x5738('0x7'),'keyContent':'','variableName':_0x5738('0x16')},{'type':'keyValue','content':'','key':'Date','keyType':_0x5738('0x7'),'keyContent':'','variableName':_0x5738('0x24')},{'type':'string','content':_0x5738('0x25')},{'type':_0x5738('0xf'),'content':'','key':_0x5738('0x26'),'keyType':_0x5738('0x7'),'keyContent':'','variableName':_0x5738('0x27')},{'type':'keyValue','content':'','key':_0x5738('0x28'),'keyType':_0x5738('0x7'),'keyContent':'','variableName':_0x5738('0x29')},{'type':'keyValue','content':'','key':_0x5738('0x2a'),'keyType':_0x5738('0x7'),'keyContent':'','variableName':_0x5738('0x2b')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x5738('0x7'),'keyContent':'','variableName':_0x5738('0x2c')}];break;}}return _0x5da78f;}; \ No newline at end of file +var _0x07c0=['getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','UniqueId','Date','agentcalledAt','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','uniqueid','Answer\x20Time','Complete\x20Time','duration','Billable\x20Time','string','toLowerCase','voice','variable','calleridnum','outbound','Outbound\x20Call','push'];(function(_0x520946,_0x42baad){var _0x1cab2a=function(_0x195862){while(--_0x195862){_0x520946['push'](_0x520946['shift']());}};_0x1cab2a(++_0x42baad);}(_0x07c0,0xb1));var _0x007c=function(_0x254bbe,_0x44612d){_0x254bbe=_0x254bbe-0x0;var _0x42aae4=_0x07c0[_0x254bbe];return _0x42aae4;};'use strict';exports['getSubjects']=function(_0x59d436,_0x44fdda){var _0x5bc332=[{'type':_0x007c('0x0'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x59d436[_0x007c('0x1')]()){case _0x007c('0x2'):switch(_0x44fdda['toLowerCase']()){case'inbound':_0x5bc332['push']({'type':'variable','content':'','variableName':'queue'});_0x5bc332['push']({'type':_0x007c('0x3'),'content':'','variableName':_0x007c('0x4')});break;case _0x007c('0x5'):_0x5bc332['push']({'type':_0x007c('0x0'),'content':_0x007c('0x6'),'variableName':null});_0x5bc332[_0x007c('0x7')]({'type':_0x007c('0x3'),'content':'','variableName':'destcalleridnum'});break;}}return _0x5bc332;};exports[_0x007c('0x8')]=function(_0x23c49b,_0xbd58e8){var _0x461e7c=[];switch(_0x23c49b[_0x007c('0x1')]()){case _0x007c('0x2'):switch(_0xbd58e8[_0x007c('0x1')]()){case _0x007c('0x9'):_0x461e7c=[{'type':_0x007c('0x0'),'content':_0x007c('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0xc'),'keyType':_0x007c('0x3'),'variableName':'calleridnum'},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0xd'),'keyType':_0x007c('0x3'),'variableName':_0x007c('0xe')},{'type':'keyValue','content':'','key':_0x007c('0xf'),'keyType':_0x007c('0x3'),'variableName':'destexten'},{'type':_0x007c('0xb'),'content':'','key':'Queue','keyType':_0x007c('0x3'),'variableName':'queue'},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x10'),'keyType':'variable','variableName':'uniqueid'},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x11'),'keyType':_0x007c('0x3'),'variableName':_0x007c('0x12')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x007c('0xb'),'content':'','key':'Agent\x20Name','keyType':_0x007c('0x3'),'variableName':_0x007c('0x13')},{'type':'keyValue','content':'','key':_0x007c('0x14'),'keyType':_0x007c('0x3'),'variableName':_0x007c('0x15')},{'type':_0x007c('0x0'),'content':_0x007c('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x17'),'keyType':'variable','variableName':_0x007c('0x12')},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x18'),'keyType':_0x007c('0x3'),'variableName':_0x007c('0x19')},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x1a'),'keyType':_0x007c('0x3'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x007c('0x1b'),'keyType':_0x007c('0x3'),'variableName':_0x007c('0x1c')},{'type':_0x007c('0xb'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x007c('0x1d')}];break;case _0x007c('0x5'):_0x461e7c=[{'type':'string','content':_0x007c('0xa'),'variableName':null},{'type':'keyValue','content':'','key':_0x007c('0x1e'),'keyType':_0x007c('0x3'),'keyContent':'','variableName':_0x007c('0x15')},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x1f'),'keyType':_0x007c('0x3'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x007c('0x3'),'keyContent':'','variableName':_0x007c('0x20')},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x11'),'keyType':_0x007c('0x3'),'keyContent':'','variableName':'starttime'},{'type':_0x007c('0x0'),'content':_0x007c('0x16')},{'type':'keyValue','content':'','key':_0x007c('0x21'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x22'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x007c('0xb'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0x007c('0x23')},{'type':_0x007c('0xb'),'content':'','key':_0x007c('0x24'),'keyType':_0x007c('0x3'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x461e7c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 7bd3da8..3ef8670 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28cf=['fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','Interaction','findOne','then','info','error','tracked','query','body','omit','html','phone','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x4b9750,_0x538cbf){var _0x4470b0=function(_0x204609){while(--_0x204609){_0x4b9750['push'](_0x4b9750['shift']());}};_0x4470b0(++_0x538cbf);}(_0x28cf,0x14e));var _0xf28c=function(_0x5ea0c5,_0x3dfaf8){_0x5ea0c5=_0x5ea0c5-0x0;var _0x4cace7=_0x28cf[_0x5ea0c5];return _0x4cace7;};'use strict';var _=require(_0xf28c('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xf28c('0x1'))(_0xf28c('0x2')),'mail':require(_0xf28c('0x1'))(_0xf28c('0x3')),'fax':require(_0xf28c('0x1'))(_0xf28c('0x4')),'sms':require(_0xf28c('0x1'))(_0xf28c('0x5')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0xf28c('0x1'))(_0xf28c('0x6'))};function getInteractionId(_0x4ec823,_0x140c89,_0x266626){if(_0x4ec823&&_0x4ec823[_[_0xf28c('0x7')](_0x266626)+_0xf28c('0x8')]){return _0x4ec823[_['upperFirst'](_0x266626)+_0xf28c('0x8')];}else if(_0x4ec823&&_0x4ec823['id']){return _0x4ec823['id'];}else if(_0x140c89&&_0x140c89['id']){return _0x140c89['id'];}else{return'unknown';}}function log(_0x187bbf,_0x5a673e,_0x14e314,_0x28e904,_0x386f43,_0x1a3f64){loggers[_0x386f43[_0xf28c('0x9')]()][_0x187bbf](_0xf28c('0xa'),_0x1a3f64[_0xf28c('0xb')](),_0x5a673e?_0x5a673e['id']:null,_0x5a673e?_0x5a673e['name']:null,_0x5a673e?_0x5a673e[_0xf28c('0xc')]:null,getInteractionId(_0x14e314,_0x28e904,_0x386f43),_0x14e314?JSON['stringify'](_0x14e314):_0xf28c('0xd'));}function updateUser(_0x441df1,_0x2e0ea9,_0x400292,_0x586f88,_0x2385d4){db[_[_0xf28c('0x7')](_0x586f88)+_0xf28c('0xe')][_0xf28c('0xf')]({'where':{'id':getInteractionId(_0x2e0ea9,_0x400292,_0x586f88)}})[_0xf28c('0x10')](function(_0x236174){if(_0x236174){return _0x236174['update']({'UserId':_0x441df1?_0x441df1['id']:null});}})['then'](function(_0x146f95){if(_0x146f95){log(_0xf28c('0x11'),_0x441df1,_0x2e0ea9,_0x400292,_0x586f88,_0x2385d4);}})['catch'](function(){log(_0xf28c('0x12'),_0x441df1,_0x2e0ea9,_0x400292,_0x586f88,_0x2385d4);});}exports[_0xf28c('0x13')]=function(_0xef1994,_0xa6169a){return function(_0x5839ee,_0x415763,_0x2c2e34){var _0x22f0a0=_0x5839ee['user'];var _0x1f62f1={};var _0x558be7=_0x5839ee[_0xf28c('0x14')];if(_0x1f62f1){_0x1f62f1=_['clone'](_0x5839ee[_0xf28c('0x15')]);_0x1f62f1=_[_0xf28c('0x16')](_0x1f62f1,[_0xf28c('0x15'),_0xf28c('0x17'),_0xf28c('0x18'),'fax',_0xf28c('0x19')]);}updateUser(_0x22f0a0,_0x1f62f1,_0x558be7,_0xef1994,_0xa6169a);_0x2c2e34(null);};}; \ No newline at end of file +var _0xbb9e=['update','then','info','catch','user','query','clone','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','toUpperCase','name','stringify','null','Interaction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbb9e,0x194));var _0xebb9=function(_0x2e8e50,_0x5a37df){_0x2e8e50=_0x2e8e50-0x0;var _0x37a457=_0xbb9e[_0x2e8e50];return _0x37a457;};'use strict';var _=require(_0xebb9('0x0'));var db=require(_0xebb9('0x1'))['db'];var loggers={'openchannel':require(_0xebb9('0x2'))(_0xebb9('0x3')),'mail':require(_0xebb9('0x2'))(_0xebb9('0x4')),'fax':require(_0xebb9('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0xebb9('0x5')),'chat':require(_0xebb9('0x2'))(_0xebb9('0x6')),'whatsapp':require(_0xebb9('0x2'))(_0xebb9('0x7'))};function getInteractionId(_0x1c8017,_0x193b03,_0xe96896){if(_0x1c8017&&_0x1c8017[_[_0xebb9('0x8')](_0xe96896)+_0xebb9('0x9')]){return _0x1c8017[_[_0xebb9('0x8')](_0xe96896)+_0xebb9('0x9')];}else if(_0x1c8017&&_0x1c8017['id']){return _0x1c8017['id'];}else if(_0x193b03&&_0x193b03['id']){return _0x193b03['id'];}else{return'unknown';}}function log(_0x5ea983,_0x54ae0c,_0x17ef06,_0x311540,_0x30fa18,_0x256eb8){loggers[_0x30fa18[_0xebb9('0xa')]()][_0x5ea983]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x256eb8[_0xebb9('0xb')](),_0x54ae0c?_0x54ae0c['id']:null,_0x54ae0c?_0x54ae0c[_0xebb9('0xc')]:null,_0x54ae0c?_0x54ae0c['role']:null,getInteractionId(_0x17ef06,_0x311540,_0x30fa18),_0x17ef06?JSON[_0xebb9('0xd')](_0x17ef06):_0xebb9('0xe'));}function updateUser(_0x4fa4aa,_0x5cea74,_0x1a44d3,_0x129d7c,_0x427e8b){db[_[_0xebb9('0x8')](_0x129d7c)+_0xebb9('0xf')]['findOne']({'where':{'id':getInteractionId(_0x5cea74,_0x1a44d3,_0x129d7c)}})['then'](function(_0x91a6d5){if(_0x91a6d5){return _0x91a6d5[_0xebb9('0x10')]({'UserId':_0x4fa4aa?_0x4fa4aa['id']:null});}})[_0xebb9('0x11')](function(_0x2ad130){if(_0x2ad130){log(_0xebb9('0x12'),_0x4fa4aa,_0x5cea74,_0x1a44d3,_0x129d7c,_0x427e8b);}})[_0xebb9('0x13')](function(){log('error',_0x4fa4aa,_0x5cea74,_0x1a44d3,_0x129d7c,_0x427e8b);});}exports['tracked']=function(_0x5b7a0c,_0x18e0e1){return function(_0x266c37,_0x9ea5fa,_0x546a7f){var _0x24d462=_0x266c37[_0xebb9('0x14')];var _0x394d40={};var _0x4878b2=_0x266c37[_0xebb9('0x15')];if(_0x394d40){_0x394d40=_[_0xebb9('0x16')](_0x266c37['body']);_0x394d40=_['omit'](_0x394d40,[_0xebb9('0x17'),_0xebb9('0x18'),_0xebb9('0x19'),_0xebb9('0x1a'),_0xebb9('0x1b')]);}updateUser(_0x24d462,_0x394d40,_0x4878b2,_0x5b7a0c,_0x18e0e1);_0x546a7f(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 424d5db..90d5c34 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 _0xe2cc=['findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','util','composable-middleware','../../config/environment','data1','license','split','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License'];(function(_0x5f265e,_0x5f29c3){var _0x197592=function(_0x2b02d3){while(--_0x2b02d3){_0x5f265e['push'](_0x5f265e['shift']());}};_0x197592(++_0x5f29c3);}(_0xe2cc,0x189));var _0xce2c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xe2cc[_0xefd519];return _0x4bb882;};'use strict';var crypto=require('crypto');var util=require(_0xce2c('0x0'));var compose=require(_0xce2c('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xce2c('0x2'));function getValueFromLicense(_0x39644f,_0x30bb52){if(_0x39644f&&_0x30bb52){if(_0x30bb52[_0xce2c('0x3')]&&_0x30bb52[_0xce2c('0x4')]){var _0x3ad919=_0x30bb52[_0xce2c('0x3')];var _0x12516d=_0x30bb52['license'];var _0x113cc6=_0x3ad919[_0xce2c('0x5')]('-')[0x4];var _0x373832=_0x3ad919[_0xce2c('0x5')]('-')[0x0];var _0x162fd8=crypto['createDecipher']('aes-256-ctr',util[_0xce2c('0x6')](_0xce2c('0x7'),_0x113cc6,_0x3ad919,_0x373832));var _0x704603=_0x162fd8[_0xce2c('0x8')](_0x12516d,_0xce2c('0x9'),_0xce2c('0xa'));_0x704603+=_0x162fd8[_0xce2c('0xb')]('utf8');var _0x3c5707=JSON[_0xce2c('0xc')](_0x704603);return _0x3c5707[_0xce2c('0xd')](_0x39644f)?_0x3c5707[_0x39644f]:null;}}return null;}function isLimit(_0x52a5ef,_0x407150,_0x1d1fea,_0x5f215b){var _0x5f232b=_0x407150;return compose()['use'](function(_0x536c86,_0x3424de,_0x3c73bf){return db[_0xce2c('0xe')][_0xce2c('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xce2c('0x10')](function(_0x44dbcc){var _0x58bf23=getValueFromLicense(_0x52a5ef,_0x44dbcc);return _0x58bf23?_0x58bf23:_0x5f232b;})[_0xce2c('0x10')](function(_0x3bf0de){_0x5f232b=_0x3bf0de;return _0x1d1fea[_0xce2c('0x11')](_0x5f215b);})[_0xce2c('0x10')](function(_0x2266a6){if(_0x2266a6>=_0x5f232b){return _0x3424de['status'](0x193)['json']({'message':util[_0xce2c('0x6')](_0xce2c('0x12'),_0x52a5ef)});}_0x3c73bf();})[_0xce2c('0x13')](function(_0x45097e){_0x3c73bf(_0x45097e);});});}function isUserLimit(){return isLimit(_0xce2c('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0xce2c('0x15')},{'role':_0xce2c('0x16')}]}});}exports[_0xce2c('0x17')]=isUserLimit; \ No newline at end of file +var _0x9754=['parse','use','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','crypto','util','composable-middleware','data1','license','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8'];(function(_0x2a3d41,_0x5da053){var _0x2856a0=function(_0x566c00){while(--_0x566c00){_0x2a3d41['push'](_0x2a3d41['shift']());}};_0x2856a0(++_0x5da053);}(_0x9754,0x19a));var _0x4975=function(_0x27bfa7,_0x57b847){_0x27bfa7=_0x27bfa7-0x0;var _0xc507f4=_0x9754[_0x27bfa7];return _0xc507f4;};'use strict';var crypto=require(_0x4975('0x0'));var util=require(_0x4975('0x1'));var compose=require(_0x4975('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3ca387,_0x1ac3d7){if(_0x3ca387&&_0x1ac3d7){if(_0x1ac3d7[_0x4975('0x3')]&&_0x1ac3d7['license']){var _0xda0176=_0x1ac3d7[_0x4975('0x3')];var _0x34d6be=_0x1ac3d7[_0x4975('0x4')];var _0x96108=_0xda0176['split']('-')[0x4];var _0x2039a6=_0xda0176['split']('-')[0x0];var _0x450979=crypto[_0x4975('0x5')](_0x4975('0x6'),util[_0x4975('0x7')](_0x4975('0x8'),_0x96108,_0xda0176,_0x2039a6));var _0x25aff1=_0x450979['update'](_0x34d6be,'base64',_0x4975('0x9'));_0x25aff1+=_0x450979['final'](_0x4975('0x9'));var _0x58dc83=JSON[_0x4975('0xa')](_0x25aff1);return _0x58dc83['hasOwnProperty'](_0x3ca387)?_0x58dc83[_0x3ca387]:null;}}return null;}function isLimit(_0x743ff7,_0xe2587e,_0xf2cd40,_0xcfe1cb){var _0xb72fb5=_0xe2587e;return compose()[_0x4975('0xb')](function(_0x55ad72,_0x375b0b,_0x175be0){return db['License'][_0x4975('0xc')]({'where':{'id':0x1},'raw':!![]})[_0x4975('0xd')](function(_0x1607eb){var _0x1f1d8c=getValueFromLicense(_0x743ff7,_0x1607eb);return _0x1f1d8c?_0x1f1d8c:_0xb72fb5;})[_0x4975('0xd')](function(_0x1e8d44){_0xb72fb5=_0x1e8d44;return _0xf2cd40[_0x4975('0xe')](_0xcfe1cb);})[_0x4975('0xd')](function(_0x300fc5){if(_0x300fc5>=_0xb72fb5){return _0x375b0b[_0x4975('0xf')](0x193)['json']({'message':util[_0x4975('0x7')](_0x4975('0x10'),_0x743ff7)});}_0x175be0();})[_0x4975('0x11')](function(_0xbc888f){_0x175be0(_0xbc888f);});});}function isUserLimit(){return isLimit(_0x4975('0x12'),0x1,db[_0x4975('0x13')],{'where':{'$or':[{'role':_0x4975('0x14')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f84f1f7..4e7c475 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 _0xbfaf=['sqlOperator','and','replace','[$and]','[$or]','slice','split','shift','match','filter','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$endsWith','pop','utcOffset','hours','lodash','moment'];(function(_0xe4fd84,_0x41593e){var _0x4bc419=function(_0x4c8b1d){while(--_0x4c8b1d){_0xe4fd84['push'](_0xe4fd84['shift']());}};_0x4bc419(++_0x41593e);}(_0xbfaf,0x178));var _0xfbfa=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0xbfaf[_0x87506e];return _0x5496a4;};'use strict';var _=require(_0xfbfa('0x0'));var moment=require(_0xfbfa('0x1'));exports['parseSearch']=function(_0x34b26a){var _0xb7651d={'conditions':[]};_0xb7651d[_0xfbfa('0x2')]=_['startsWith'](_0x34b26a,'[$or]')?'or':_0xfbfa('0x3');var _0x3f9b42=_0x34b26a[_0xfbfa('0x4')](_0xfbfa('0x5'),'')[_0xfbfa('0x4')](_0xfbfa('0x6'),'')['split']('||');for(var _0x2a5d28=0x0;_0x2a5d28<_0x3f9b42['length'];_0x2a5d28++){var _0x519b84=_0x3f9b42[_0x2a5d28]['split'](':=');var _0xea55db=_0x519b84[0x0];var _0x272de8=_0x519b84[_0xfbfa('0x7')](0x1);_0x272de8['forEach'](function(_0x347467){var _0xf50d96=_0x347467[_0xfbfa('0x8')]('[')[_0xfbfa('0x9')]();var _0x545d1b=_0x347467[_0xfbfa('0xa')](/\[(.*?)\]/g);_0x545d1b['forEach'](function(_0x22ce2b){var _0x18cd8f=_0x22ce2b[_0xfbfa('0x8')]('[')[_0xfbfa('0xb')](function(_0xce2a45){return _0xce2a45['indexOf'](']')>-0x1;})['map'](function(_0x5b29e2){return _0x5b29e2[_0xfbfa('0x8')](']')[0x0];})[0x0];_0xb7651d['conditions'][_0xfbfa('0xc')]({'field':_0xea55db,'operator':_0xf50d96,'value':_0x18cd8f});});});}return _0xb7651d;};exports[_0xfbfa('0xd')]=function(_0x2d1287,_0x1109af,_0x37d3f0){var _0x3e7aa4={};if(_0x1109af===_0xfbfa('0xe')){if(_0x37d3f0[_0xfbfa('0xf')]===_0xfbfa('0x10')){_0x37d3f0['operator']=_0xfbfa('0x11');_0x37d3f0[_0xfbfa('0x12')]+=','+_0x37d3f0[_0xfbfa('0x12')];}else if(_[_0xfbfa('0x13')]([_0xfbfa('0x14'),_0xfbfa('0x15')],_0x37d3f0[_0xfbfa('0xf')])){_0x37d3f0[_0xfbfa('0x12')]=moment(_0x37d3f0[_0xfbfa('0x12')])[_0xfbfa('0x16')](0x1,_0xfbfa('0x17'))[_0xfbfa('0x18')](_0xfbfa('0x19'));}}if(_0x37d3f0[_0xfbfa('0x1a')]){_0x1109af=_0x37d3f0['castTo'];_0x3e7aa4[_0xfbfa('0x1b')]=_0xfbfa('0x1c')+_0x2d1287+'.'+_0x37d3f0[_0xfbfa('0x1d')]+_0xfbfa('0x1e')+_0x37d3f0['castTo']+')\x20'+parseOperator(_0x37d3f0['operator']);}else{_0x3e7aa4[_0xfbfa('0x1b')]=_0x2d1287+'.'+_0x37d3f0[_0xfbfa('0x1d')]+'\x20'+parseOperator(_0x37d3f0['operator']);}if(_['includes']([_0xfbfa('0x1f'),_0xfbfa('0x20')],_0x37d3f0['operator']))_0x3e7aa4['text']='('+_0x3e7aa4[_0xfbfa('0x1b')]+_0xfbfa('0x21')+_0x2d1287+'.'+_0x37d3f0[_0xfbfa('0x1d')]+_0xfbfa('0x22');_0x3e7aa4[_0xfbfa('0x12')]=parseValue(_0x1109af,_0x37d3f0[_0xfbfa('0xf')],_0x37d3f0[_0xfbfa('0x12')]);return _0x3e7aa4;};function parseOperator(_0x2de2c7){var _0x44bc07;switch(_0x2de2c7){case'$in':_0x44bc07=_0xfbfa('0x23');break;case _0xfbfa('0x20'):_0x44bc07=_0xfbfa('0x24');break;case'$eq':_0x44bc07=_0xfbfa('0x25');break;case _0xfbfa('0x1f'):_0x44bc07=_0xfbfa('0x26');break;case _0xfbfa('0x27'):case _0xfbfa('0x28'):case'$endsWith':_0x44bc07=_0xfbfa('0x29');break;case _0xfbfa('0x2a'):_0x44bc07=_0xfbfa('0x2b');break;case _0xfbfa('0x14'):_0x44bc07='>\x20?';break;case _0xfbfa('0x15'):_0x44bc07=_0xfbfa('0x2c');break;case _0xfbfa('0x2d'):_0x44bc07=_0xfbfa('0x2e');break;case _0xfbfa('0x11'):_0x44bc07=_0xfbfa('0x2f');break;}return _0x44bc07;}function parseValue(_0x434e79,_0x11b0c0,_0x19d4df){var _0x18e43c={'start':undefined,'end':undefined};switch(_0x11b0c0){case _0xfbfa('0x30'):case _0xfbfa('0x20'):_0x18e43c['start']=_0x19d4df[_0xfbfa('0x8')](',');break;case _0xfbfa('0x27'):_0x18e43c[_0xfbfa('0x31')]='%'+_0x19d4df+'%';break;case'$startsWith':_0x18e43c[_0xfbfa('0x31')]=_0x19d4df+'%';break;case _0xfbfa('0x32'):_0x18e43c[_0xfbfa('0x31')]='%'+_0x19d4df;break;case'$between':var _0x57eaa4=_0x19d4df[_0xfbfa('0x8')](',');var _0x19d4df=_0x57eaa4[_0xfbfa('0x9')]();var _0xb2c2e3=_0x57eaa4[_0xfbfa('0x33')]();if(_0x434e79===_0xfbfa('0xe')){_0x19d4df=moment(_0x19d4df)['utcOffset'](0x0,!![])[_0xfbfa('0x18')]();_0xb2c2e3=moment(_0xb2c2e3)[_0xfbfa('0x34')](0x0,!![])['add'](0x17,_0xfbfa('0x35'))[_0xfbfa('0x16')](0x3b,'minutes')[_0xfbfa('0x16')](0x3b,'seconds')[_0xfbfa('0x18')]();}_0x18e43c={'start':_0x19d4df,'end':_0xb2c2e3};break;default:_0x18e43c[_0xfbfa('0x31')]=_0x19d4df;break;}return _0x18e43c;} \ No newline at end of file +var _0x027b=['and','[$and]','replace','split','length','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','$between','value','$gt','$lte','operator','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','<>\x20?','$startsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$substring','$endsWith','shift','pop','seconds','moment','parseSearch','startsWith','[$or]'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0x027b,0x16f));var _0xb027=function(_0x21672b,_0x43cdbd){_0x21672b=_0x21672b-0x0;var _0x428aa9=_0x027b[_0x21672b];return _0x428aa9;};'use strict';var _=require('lodash');var moment=require(_0xb027('0x0'));exports[_0xb027('0x1')]=function(_0x21d4b3){var _0x253e4e={'conditions':[]};_0x253e4e['sqlOperator']=_[_0xb027('0x2')](_0x21d4b3,_0xb027('0x3'))?'or':_0xb027('0x4');var _0x5c4466=_0x21d4b3['replace'](_0xb027('0x5'),'')[_0xb027('0x6')](_0xb027('0x3'),'')[_0xb027('0x7')]('||');for(var _0x49c0ef=0x0;_0x49c0ef<_0x5c4466[_0xb027('0x8')];_0x49c0ef++){var _0x55e6b7=_0x5c4466[_0x49c0ef][_0xb027('0x7')](':=');var _0x5d0d6b=_0x55e6b7[0x0];var _0x4c0896=_0x55e6b7['slice'](0x1);_0x4c0896[_0xb027('0x9')](function(_0x50cc3e){var _0x42dc85=_0x50cc3e[_0xb027('0x7')]('[')['shift']();var _0x2240b1=_0x50cc3e[_0xb027('0xa')](/\[(.*?)\]/g);_0x2240b1[_0xb027('0x9')](function(_0x15134b){var _0x5b10b2=_0x15134b[_0xb027('0x7')]('[')[_0xb027('0xb')](function(_0x2e4b70){return _0x2e4b70[_0xb027('0xc')](']')>-0x1;})['map'](function(_0x328b39){return _0x328b39[_0xb027('0x7')](']')[0x0];})[0x0];_0x253e4e[_0xb027('0xd')][_0xb027('0xe')]({'field':_0x5d0d6b,'operator':_0x42dc85,'value':_0x5b10b2});});});}return _0x253e4e;};exports[_0xb027('0xf')]=function(_0x5e83d2,_0x18f8ef,_0x22c802){var _0x1d6b97={};if(_0x18f8ef===_0xb027('0x10')){if(_0x22c802['operator']==='$eq'){_0x22c802['operator']=_0xb027('0x11');_0x22c802['value']+=','+_0x22c802[_0xb027('0x12')];}else if(_['includes']([_0xb027('0x13'),_0xb027('0x14')],_0x22c802[_0xb027('0x15')])){_0x22c802['value']=moment(_0x22c802[_0xb027('0x12')])[_0xb027('0x16')](0x1,_0xb027('0x17'))[_0xb027('0x18')](_0xb027('0x19'));}}if(_0x22c802[_0xb027('0x1a')]){_0x18f8ef=_0x22c802['castTo'];_0x1d6b97[_0xb027('0x1b')]=_0xb027('0x1c')+_0x5e83d2+'.'+_0x22c802[_0xb027('0x1d')]+_0xb027('0x1e')+_0x22c802[_0xb027('0x1a')]+')\x20'+parseOperator(_0x22c802[_0xb027('0x15')]);}else{_0x1d6b97[_0xb027('0x1b')]=_0x5e83d2+'.'+_0x22c802[_0xb027('0x1d')]+'\x20'+parseOperator(_0x22c802[_0xb027('0x15')]);}if(_[_0xb027('0x1f')]([_0xb027('0x20'),'$notIn'],_0x22c802['operator']))_0x1d6b97[_0xb027('0x1b')]='('+_0x1d6b97[_0xb027('0x1b')]+_0xb027('0x21')+_0x5e83d2+'.'+_0x22c802[_0xb027('0x1d')]+'\x20IS\x20NULL)';_0x1d6b97['value']=parseValue(_0x18f8ef,_0x22c802[_0xb027('0x15')],_0x22c802['value']);return _0x1d6b97;};function parseOperator(_0x3eb29e){var _0x57408e;switch(_0x3eb29e){case _0xb027('0x22'):_0x57408e=_0xb027('0x23');break;case _0xb027('0x24'):_0x57408e=_0xb027('0x25');break;case _0xb027('0x26'):_0x57408e='=\x20?';break;case _0xb027('0x20'):_0x57408e=_0xb027('0x27');break;case'$substring':case _0xb027('0x28'):case'$endsWith':_0x57408e='LIKE\x20?';break;case _0xb027('0x29'):_0x57408e=_0xb027('0x2a');break;case'$gt':_0x57408e=_0xb027('0x2b');break;case _0xb027('0x14'):_0x57408e=_0xb027('0x2c');break;case _0xb027('0x2d'):_0x57408e=_0xb027('0x2e');break;case _0xb027('0x11'):_0x57408e='BETWEEN\x20?\x20AND\x20?';break;}return _0x57408e;}function parseValue(_0x3c2692,_0x517827,_0x3ef7dc){var _0xb9b9ea={'start':undefined,'end':undefined};switch(_0x517827){case _0xb027('0x22'):case _0xb027('0x24'):_0xb9b9ea[_0xb027('0x2f')]=_0x3ef7dc['split'](',');break;case _0xb027('0x30'):_0xb9b9ea[_0xb027('0x2f')]='%'+_0x3ef7dc+'%';break;case _0xb027('0x28'):_0xb9b9ea[_0xb027('0x2f')]=_0x3ef7dc+'%';break;case _0xb027('0x31'):_0xb9b9ea[_0xb027('0x2f')]='%'+_0x3ef7dc;break;case _0xb027('0x11'):var _0x16b05f=_0x3ef7dc['split'](',');var _0x3ef7dc=_0x16b05f[_0xb027('0x32')]();var _0x4ed1e2=_0x16b05f[_0xb027('0x33')]();if(_0x3c2692===_0xb027('0x10')){_0x3ef7dc=moment(_0x3ef7dc)['utcOffset'](0x0,!![])[_0xb027('0x18')]();_0x4ed1e2=moment(_0x4ed1e2)['utcOffset'](0x0,!![])[_0xb027('0x16')](0x17,'hours')[_0xb027('0x16')](0x3b,'minutes')[_0xb027('0x16')](0x3b,_0xb027('0x34'))[_0xb027('0x18')]();}_0xb9b9ea={'start':_0x3ef7dc,'end':_0x4ed1e2};break;default:_0xb9b9ea[_0xb027('0x2f')]=_0x3ef7dc;break;}return _0xb9b9ea;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4af6e2e..dc1fd3e 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 _0x9e53=['uniqueid','isArray','limit','offset','sort','map','priority','cast','col','unsigned','substr','ASC','length','omit','isObject','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','includes','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','pick','filter','where','VIRTUAL','lower','merge','options','lodash','sequelize','moment','keys','parse','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','subtract','name'];(function(_0xd78037,_0x4aea71){var _0x489709=function(_0x39e348){while(--_0x39e348){_0xd78037['push'](_0xd78037['shift']());}};_0x489709(++_0x4aea71);}(_0x9e53,0x68));var _0x39e5=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0x9e53[_0x578275];return _0xf78041;};'use strict';var _=require(_0x39e5('0x0'));var sequelize=require(_0x39e5('0x1'));var moment=require(_0x39e5('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5b7b3f){var _0xcee74=['ne'];try{var _0xfd639=JSON['parse'](_0x5b7b3f);var _0x388825=Object[_0x39e5('0x3')](_0xfd639)[0x0];return _0xcee74['includes'](_0x388825);}catch(_0x2ea38e){return![];}}function getOperatorValue(_0x1cd785){var _0x5a93ea=JSON[_0x39e5('0x4')](_0x1cd785);var _0x2c4ad3=Object[_0x39e5('0x3')](_0x5a93ea)[0x0];var _0x271027=_0x5a93ea[_0x2c4ad3];return{['$'+_0x2c4ad3]:_0x271027};}exports[_0x39e5('0x5')]=function(_0x1a316e){var _0x1471de=null;if(_0x1a316e){_0x1471de=_0x1a316e[_0x39e5('0x6')](',');}return _0x1471de;};exports[_0x39e5('0x7')]=function(_0x20c2c0,_0x3d662a){var _0x57ba5b={};if(!_[_0x39e5('0x8')](_0x20c2c0)){_[_0x39e5('0x9')](_0x20c2c0,function(_0x393e61,_0xec78cb){try{if(_0x3d662a){var _0x5703b5=_[_0x39e5('0xa')](_0x3d662a,{'name':_0xec78cb})||{};if(hasSequelizeOperator(_0x393e61)){_0x57ba5b[_0xec78cb]=getOperatorValue(_0x393e61);}else if(_0x5703b5[_0x39e5('0xb')]===_0x39e5('0xc')&&_[_0x39e5('0xd')](_0x393e61)){var _0x5234a4=JSON[_0x39e5('0x4')](_0x393e61);var _0x51f27e={'$gte':moment(moment(_0x5234a4[_0x39e5('0xe')])[_0x39e5('0xf')](_0x39e5('0x10')))['utc']()[_0x39e5('0xf')](),'$lte':moment(moment(_0x5234a4[_0x39e5('0x11')])[_0x39e5('0xf')]('YYYY-MM-DD'))['utc']()[_0x39e5('0x12')](0x1,'s')[_0x39e5('0xf')]()};_0x57ba5b[_0xec78cb]=_0x51f27e;}else if(_0x5703b5[_0x39e5('0x13')]===_0x39e5('0x14')){_0x57ba5b[_0xec78cb]=_0x393e61;}else{_0x57ba5b[_0xec78cb]=_['isArray'](_0x393e61)?_0x393e61:JSON[_0x39e5('0x4')](_0x393e61);}}else{_0x57ba5b[_0xec78cb]=_[_0x39e5('0x15')](_0x393e61)?_0x393e61:JSON[_0x39e5('0x4')](_0x393e61);}}catch(_0x11bdf3){_0x57ba5b[_0xec78cb]=_0x393e61[_0x39e5('0x6')](',');}});}return _0x57ba5b;};exports[_0x39e5('0x16')]=function(_0x1bad1a){_0x1bad1a=parseInt(_0x1bad1a,0xa);if(!_0x1bad1a||_0x1bad1a<0x0){_0x1bad1a=LIMIT_VALUE;}return _0x1bad1a;};exports[_0x39e5('0x17')]=function(_0x1fc330){_0x1fc330=parseInt(_0x1fc330,0xa);if(!_0x1fc330||_0x1fc330<0x0){_0x1fc330=0x0;}return _0x1fc330;};exports[_0x39e5('0x18')]=function(_0x246757){var _0x55f31a,_0x4b649b=null;if(_0x246757){_0x55f31a=_0x246757['split'](',');_0x4b649b=_[_0x39e5('0x19')](_0x55f31a,function(_0x382e96){if(_0x382e96['indexOf']('-')===0x0){return[_0x382e96===_0x39e5('0x1a')?sequelize[_0x39e5('0x1b')](sequelize[_0x39e5('0x1c')](_0x39e5('0x1a')),_0x39e5('0x1d')):_0x382e96[_0x39e5('0x1e')](0x1),'DESC'];}else{return[_0x382e96===_0x39e5('0x1a')?sequelize[_0x39e5('0x1b')](sequelize[_0x39e5('0x1c')](_0x39e5('0x1a')),_0x39e5('0x1d')):_0x382e96,_0x39e5('0x1f')];}});}return _0x4b649b;};exports['omit']=function(_0x26bc4f,_0x50811e){if(_[_0x39e5('0x8')](_0x26bc4f)){return _0x26bc4f;}if(_[_0x39e5('0x15')](_0x26bc4f)){for(var _0xcec98=0x0;_0xcec98<_0x26bc4f[_0x39e5('0x20')];_0xcec98+=0x1){_0x26bc4f[_0xcec98]=this[_0x39e5('0x21')](_0x26bc4f[_0xcec98],_0x50811e);}return _0x26bc4f;}if(!_[_0x39e5('0x22')](_0x26bc4f)){return _0x26bc4f;}if(_['isString'](_0x50811e)){_0x50811e=[_0x50811e];}if(!_[_0x39e5('0x15')](_0x50811e)){return _0x26bc4f;}for(var _0x16064d=0x0;_0x16064d<_0x50811e['length'];_0x16064d+=0x1){_[_0x39e5('0x23')](_0x26bc4f,_0x50811e[_0x16064d]);}for(var _0x333c1 in _0x26bc4f){if(_0x26bc4f[_0x39e5('0x24')](_0x333c1)){_0x26bc4f[_0x333c1]=this[_0x39e5('0x21')](_0x26bc4f[_0x333c1],_0x50811e);}}return _0x26bc4f;};exports[_0x39e5('0x25')]=function(_0x20677a){return _0x20677a['match'](RegExp(_0x39e5('0x26')))?!![]:![];};exports[_0x39e5('0x27')]=function(_0x31246a){return _0x31246a[_0x39e5('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x39e5('0x29')]=function(_0x144c7e){var _0x46a85c=[];_0x144c7e[_0x39e5('0x6')](/[ ,]+/)[_0x39e5('0x2a')](function(_0x10b8f5){_0x10b8f5=_0x10b8f5[_0x39e5('0x2b')](/([^:]")"+/g,'$1');_0x10b8f5='+'+_0x10b8f5+'*';if(_0x10b8f5[_0x39e5('0x2c')]('@'))_0x10b8f5='\x22'+_0x10b8f5+'\x22';_0x46a85c[_0x39e5('0x2d')](_0x10b8f5);});return _0x46a85c[_0x39e5('0x2e')]('\x20');};exports[_0x39e5('0x2f')]=function(_0x2123ef,_0x50906c,_0xf4cc1f){var _0x2d539c={},_0x5578dd={};if(_0x50906c[_0x39e5('0x30')]['$id']){_0x50906c[_0x39e5('0x30')]['id']=_0x50906c[_0x39e5('0x30')]['$id'];delete _0x50906c[_0x39e5('0x30')][_0x39e5('0x31')];}_0x2d539c[_0x39e5('0x32')]=_[_0x39e5('0x19')](_0x2123ef,_0x39e5('0x13'));_0x2d539c[_0x39e5('0x30')]=_[_0x39e5('0x3')](_0x50906c[_0x39e5('0x30')]);_0x2d539c[_0x39e5('0x7')]=_[_0x39e5('0x33')](_0x2d539c[_0x39e5('0x32')],_0x2d539c['query']);_0x5578dd[_0x39e5('0x34')]=_[_0x39e5('0x33')](_0x2d539c[_0x39e5('0x32')],this[_0x39e5('0x5')](_0x50906c[_0x39e5('0x30')]['fields']));_0x5578dd[_0x39e5('0x34')]=_0x5578dd[_0x39e5('0x34')]['length']?_0x5578dd[_0x39e5('0x34')]:_0x2d539c[_0x39e5('0x32')];if(!_0x50906c[_0x39e5('0x30')]['hasOwnProperty'](_0x39e5('0x35'))){_0x5578dd[_0x39e5('0x16')]=this[_0x39e5('0x16')](_0x50906c[_0x39e5('0x30')][_0x39e5('0x16')]);_0x5578dd[_0x39e5('0x17')]=this['offset'](_0x50906c['query']['offset']);}_0x5578dd[_0x39e5('0x36')]=this[_0x39e5('0x18')](_0x50906c[_0x39e5('0x30')]['sort']);_0x5578dd['where']=this[_0x39e5('0x7')](_[_0x39e5('0x37')](_0x50906c['query'],_0x2d539c[_0x39e5('0x7')]),_0x2123ef);if(_0x50906c[_0x39e5('0x30')][_0x39e5('0x38')]){_0x5578dd[_0x39e5('0x39')]=_['merge'](_0x5578dd['where'],{'$or':_['map'](_0x2123ef,function(_0x49cda0){if(_0x49cda0[_0x39e5('0xb')]!==_0x39e5('0x3a')){if(_0xf4cc1f){return sequelize['where'](sequelize['fn'](_0x39e5('0x3b'),sequelize[_0x39e5('0x1c')](_0x49cda0[_0x39e5('0x13')])),{'$like':sequelize['fn'](_0x39e5('0x3b'),'%'+_0x50906c[_0x39e5('0x30')][_0x39e5('0x38')]+'%')});}else{var _0x12ca2e={};_0x12ca2e[_0x49cda0[_0x39e5('0x13')]]={'$like':'%'+_0x50906c[_0x39e5('0x30')][_0x39e5('0x38')]+'%'};return _0x12ca2e;}}})});}_0x5578dd=_[_0x39e5('0x3c')]({},_0x5578dd,_0x50906c[_0x39e5('0x3d')]);return _0x5578dd;}; \ No newline at end of file +var _0x6b4f=['hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','query','$id','model','intersection','attributes','nolimit','offset','order','where','filter','VIRTUAL','lower','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','utc','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','sort','map','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isString','unset'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6b4f,0x87));var _0xf6b4=function(_0x1d389f,_0x3e22ab){_0x1d389f=_0x1d389f-0x0;var _0x5b3f88=_0x6b4f[_0x1d389f];return _0x5b3f88;};'use strict';var _=require('lodash');var sequelize=require(_0xf6b4('0x0'));var moment=require(_0xf6b4('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2a9ab9){var _0x16c3a4=['ne'];try{var _0x40eae5=JSON[_0xf6b4('0x2')](_0x2a9ab9);var _0x385533=Object[_0xf6b4('0x3')](_0x40eae5)[0x0];return _0x16c3a4[_0xf6b4('0x4')](_0x385533);}catch(_0x57bd8e){return![];}}function getOperatorValue(_0x4e59d3){var _0x579cc8=JSON[_0xf6b4('0x2')](_0x4e59d3);var _0x27f5da=Object[_0xf6b4('0x3')](_0x579cc8)[0x0];var _0x183128=_0x579cc8[_0x27f5da];return{['$'+_0x27f5da]:_0x183128};}exports[_0xf6b4('0x5')]=function(_0x5b4825){var _0x17939a=null;if(_0x5b4825){_0x17939a=_0x5b4825[_0xf6b4('0x6')](',');}return _0x17939a;};exports[_0xf6b4('0x7')]=function(_0x40125e,_0x2b6e57){var _0x2a2469={};if(!_[_0xf6b4('0x8')](_0x40125e)){_[_0xf6b4('0x9')](_0x40125e,function(_0x12b6e9,_0xcbe0f4){try{if(_0x2b6e57){var _0x52c9b6=_[_0xf6b4('0xa')](_0x2b6e57,{'name':_0xcbe0f4})||{};if(hasSequelizeOperator(_0x12b6e9)){_0x2a2469[_0xcbe0f4]=getOperatorValue(_0x12b6e9);}else if(_0x52c9b6[_0xf6b4('0xb')]===_0xf6b4('0xc')&&_[_0xf6b4('0xd')](_0x12b6e9)){var _0x442b08=JSON[_0xf6b4('0x2')](_0x12b6e9);var _0x467632={'$gte':moment(moment(_0x442b08[_0xf6b4('0xe')])[_0xf6b4('0xf')]('YYYY-MM-DD'))[_0xf6b4('0x10')]()[_0xf6b4('0xf')](),'$lte':moment(moment(_0x442b08['$lte'])[_0xf6b4('0xf')](_0xf6b4('0x11')))[_0xf6b4('0x10')]()[_0xf6b4('0x12')](0x1,'s')['format']()};_0x2a2469[_0xcbe0f4]=_0x467632;}else if(_0x52c9b6[_0xf6b4('0x13')]===_0xf6b4('0x14')){_0x2a2469[_0xcbe0f4]=_0x12b6e9;}else{_0x2a2469[_0xcbe0f4]=_[_0xf6b4('0x15')](_0x12b6e9)?_0x12b6e9:JSON[_0xf6b4('0x2')](_0x12b6e9);}}else{_0x2a2469[_0xcbe0f4]=_[_0xf6b4('0x15')](_0x12b6e9)?_0x12b6e9:JSON[_0xf6b4('0x2')](_0x12b6e9);}}catch(_0x116f93){_0x2a2469[_0xcbe0f4]=_0x12b6e9[_0xf6b4('0x6')](',');}});}return _0x2a2469;};exports[_0xf6b4('0x16')]=function(_0x94dac8){_0x94dac8=parseInt(_0x94dac8,0xa);if(!_0x94dac8||_0x94dac8<0x0){_0x94dac8=LIMIT_VALUE;}return _0x94dac8;};exports['offset']=function(_0x4df9f9){_0x4df9f9=parseInt(_0x4df9f9,0xa);if(!_0x4df9f9||_0x4df9f9<0x0){_0x4df9f9=0x0;}return _0x4df9f9;};exports[_0xf6b4('0x17')]=function(_0x338ee5){var _0xe2a810,_0x3ddfdd=null;if(_0x338ee5){_0xe2a810=_0x338ee5['split'](',');_0x3ddfdd=_[_0xf6b4('0x18')](_0xe2a810,function(_0xcaeac5){if(_0xcaeac5['indexOf']('-')===0x0){return[_0xcaeac5===_0xf6b4('0x19')?sequelize[_0xf6b4('0x1a')](sequelize[_0xf6b4('0x1b')](_0xf6b4('0x19')),_0xf6b4('0x1c')):_0xcaeac5[_0xf6b4('0x1d')](0x1),_0xf6b4('0x1e')];}else{return[_0xcaeac5==='priority'?sequelize[_0xf6b4('0x1a')](sequelize['col']('priority'),_0xf6b4('0x1c')):_0xcaeac5,_0xf6b4('0x1f')];}});}return _0x3ddfdd;};exports[_0xf6b4('0x20')]=function(_0x4ad2da,_0x3689e7){if(_[_0xf6b4('0x8')](_0x4ad2da)){return _0x4ad2da;}if(_['isArray'](_0x4ad2da)){for(var _0x20e76a=0x0;_0x20e76a<_0x4ad2da[_0xf6b4('0x21')];_0x20e76a+=0x1){_0x4ad2da[_0x20e76a]=this[_0xf6b4('0x20')](_0x4ad2da[_0x20e76a],_0x3689e7);}return _0x4ad2da;}if(!_['isObject'](_0x4ad2da)){return _0x4ad2da;}if(_[_0xf6b4('0x22')](_0x3689e7)){_0x3689e7=[_0x3689e7];}if(!_[_0xf6b4('0x15')](_0x3689e7)){return _0x4ad2da;}for(var _0x3a14a5=0x0;_0x3a14a5<_0x3689e7[_0xf6b4('0x21')];_0x3a14a5+=0x1){_[_0xf6b4('0x23')](_0x4ad2da,_0x3689e7[_0x3a14a5]);}for(var _0x4dbe25 in _0x4ad2da){if(_0x4ad2da[_0xf6b4('0x24')](_0x4dbe25)){_0x4ad2da[_0x4dbe25]=this[_0xf6b4('0x20')](_0x4ad2da[_0x4dbe25],_0x3689e7);}}return _0x4ad2da;};exports[_0xf6b4('0x25')]=function(_0xceae7b){return _0xceae7b[_0xf6b4('0x26')](RegExp(_0xf6b4('0x27')))?!![]:![];};exports[_0xf6b4('0x28')]=function(_0x124b78){return _0x124b78['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf6b4('0x29')]=function(_0x1847b3){var _0x4335c5=[];_0x1847b3['split'](/[ ,]+/)[_0xf6b4('0x2a')](function(_0x34a62b){_0x34a62b=_0x34a62b['replace'](/([^:]")"+/g,'$1');_0x34a62b='+'+_0x34a62b+'*';if(_0x34a62b[_0xf6b4('0x4')]('@'))_0x34a62b='\x22'+_0x34a62b+'\x22';_0x4335c5[_0xf6b4('0x2b')](_0x34a62b);});return _0x4335c5[_0xf6b4('0x2c')]('\x20');};exports['getOptions']=function(_0x57137f,_0x20ffe1,_0x41e8fe){var _0x24bf49={},_0xad10={};if(_0x20ffe1[_0xf6b4('0x2d')][_0xf6b4('0x2e')]){_0x20ffe1['query']['id']=_0x20ffe1['query']['$id'];delete _0x20ffe1[_0xf6b4('0x2d')][_0xf6b4('0x2e')];}_0x24bf49[_0xf6b4('0x2f')]=_[_0xf6b4('0x18')](_0x57137f,'name');_0x24bf49[_0xf6b4('0x2d')]=_[_0xf6b4('0x3')](_0x20ffe1[_0xf6b4('0x2d')]);_0x24bf49[_0xf6b4('0x7')]=_[_0xf6b4('0x30')](_0x24bf49[_0xf6b4('0x2f')],_0x24bf49[_0xf6b4('0x2d')]);_0xad10['attributes']=_[_0xf6b4('0x30')](_0x24bf49[_0xf6b4('0x2f')],this[_0xf6b4('0x5')](_0x20ffe1[_0xf6b4('0x2d')][_0xf6b4('0x5')]));_0xad10['attributes']=_0xad10[_0xf6b4('0x31')][_0xf6b4('0x21')]?_0xad10[_0xf6b4('0x31')]:_0x24bf49[_0xf6b4('0x2f')];if(!_0x20ffe1[_0xf6b4('0x2d')][_0xf6b4('0x24')](_0xf6b4('0x32'))){_0xad10['limit']=this['limit'](_0x20ffe1['query']['limit']);_0xad10[_0xf6b4('0x33')]=this[_0xf6b4('0x33')](_0x20ffe1['query'][_0xf6b4('0x33')]);}_0xad10[_0xf6b4('0x34')]=this[_0xf6b4('0x17')](_0x20ffe1[_0xf6b4('0x2d')][_0xf6b4('0x17')]);_0xad10[_0xf6b4('0x35')]=this[_0xf6b4('0x7')](_['pick'](_0x20ffe1['query'],_0x24bf49[_0xf6b4('0x7')]),_0x57137f);if(_0x20ffe1[_0xf6b4('0x2d')][_0xf6b4('0x36')]){_0xad10[_0xf6b4('0x35')]=_['merge'](_0xad10[_0xf6b4('0x35')],{'$or':_['map'](_0x57137f,function(_0x20bb81){if(_0x20bb81[_0xf6b4('0xb')]!==_0xf6b4('0x37')){if(_0x41e8fe){return sequelize[_0xf6b4('0x35')](sequelize['fn'](_0xf6b4('0x38'),sequelize[_0xf6b4('0x1b')](_0x20bb81[_0xf6b4('0x13')])),{'$like':sequelize['fn']('lower','%'+_0x20ffe1[_0xf6b4('0x2d')][_0xf6b4('0x36')]+'%')});}else{var _0x45bfe2={};_0x45bfe2[_0x20bb81[_0xf6b4('0x13')]]={'$like':'%'+_0x20ffe1['query'][_0xf6b4('0x36')]+'%'};return _0x45bfe2;}}})});}_0xad10=_['merge']({},_0xad10,_0x20ffe1['options']);return _0xad10;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 358928e..07117e8 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96a6=['moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','development','test','split','use','static','views','engine','ejs','renderFile','view\x20engine','html','urlencoded','50mb','initialize','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x96a6,0x14c));var _0x696a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x96a6[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x696a('0x0'));var favicon=require(_0x696a('0x1'));var bodyParser=require(_0x696a('0x2'));var methodOverride=require(_0x696a('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x696a('0x4'));var path=require(_0x696a('0x5'));var passport=require(_0x696a('0x6'));var cors=require(_0x696a('0x7'));var moment=require(_0x696a('0x8'));var config=require(_0x696a('0x9'));var db=require(_0x696a('0xa'))['db'];exports[_0x696a('0xb')]=function(_0x5b21ae){var _0x46449f=_0x5b21ae[_0x696a('0xc')](_0x696a('0xd'));if(_0x46449f===_0x696a('0xe')){_0x5b21ae[_0x696a('0xf')](_0x696a('0x10'),path[_0x696a('0x11')](config[_0x696a('0x12')],_0x696a('0x13')));}if(_0x46449f===_0x696a('0x14')||_0x46449f===_0x696a('0x15')){_0x5b21ae[_0x696a('0xf')]('appPath',path[_0x696a('0x11')](config[_0x696a('0x12')],'client'));_0x5b21ae['use'](errorHandler());}_0x5b21ae[_0x696a('0xf')]('json\x20replacer',function(_0x4c3ca3,_0x2c3961){if(this[_0x4c3ca3]instanceof Date){_0x2c3961=this[_0x4c3ca3]['toISOString']()[_0x696a('0x16')]('.')[0x0]+'Z';}return _0x2c3961;});_0x5b21ae[_0x696a('0x17')](express[_0x696a('0x18')](_0x5b21ae[_0x696a('0xc')](_0x696a('0x10'))));_0x5b21ae[_0x696a('0xf')](_0x696a('0x19'),config['root']+'/server/views');_0x5b21ae[_0x696a('0x1a')]('html',require(_0x696a('0x1b'))[_0x696a('0x1c')]);_0x5b21ae[_0x696a('0xf')](_0x696a('0x1d'),_0x696a('0x1e'));_0x5b21ae[_0x696a('0x17')](bodyParser[_0x696a('0x1f')]({'limit':_0x696a('0x20'),'extended':!![]}));_0x5b21ae['use'](bodyParser['json']({'limit':_0x696a('0x20')}));_0x5b21ae[_0x696a('0x17')](cors());_0x5b21ae[_0x696a('0x17')](methodOverride());_0x5b21ae[_0x696a('0x17')](cookieParser());_0x5b21ae[_0x696a('0x17')](passport[_0x696a('0x21')]());}; \ No newline at end of file +var _0xc6ee=['method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','env','join','root','public','development','test','appPath','client','set','json\x20replacer','toISOString','split','use','static','/server/views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize','body-parser'];(function(_0x5c1932,_0x5b1a24){var _0x2e8728=function(_0x495742){while(--_0x495742){_0x5c1932['push'](_0x5c1932['shift']());}};_0x2e8728(++_0x5b1a24);}(_0xc6ee,0x1cd));var _0xec6e=function(_0x123db1,_0x4faec1){_0x123db1=_0x123db1-0x0;var _0x1d50b3=_0xc6ee[_0x123db1];return _0x1d50b3;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0xec6e('0x0'));var methodOverride=require(_0xec6e('0x1'));var cookieParser=require(_0xec6e('0x2'));var errorHandler=require(_0xec6e('0x3'));var path=require(_0xec6e('0x4'));var passport=require(_0xec6e('0x5'));var cors=require(_0xec6e('0x6'));var moment=require(_0xec6e('0x7'));var config=require('./environment');var db=require(_0xec6e('0x8'))['db'];exports[_0xec6e('0x9')]=function(_0x3debd7){var _0x36b6e1=_0x3debd7[_0xec6e('0xa')](_0xec6e('0xb'));if(_0x36b6e1==='production'){_0x3debd7['set']('appPath',path[_0xec6e('0xc')](config[_0xec6e('0xd')],_0xec6e('0xe')));}if(_0x36b6e1===_0xec6e('0xf')||_0x36b6e1===_0xec6e('0x10')){_0x3debd7['set'](_0xec6e('0x11'),path[_0xec6e('0xc')](config['root'],_0xec6e('0x12')));_0x3debd7['use'](errorHandler());}_0x3debd7[_0xec6e('0x13')](_0xec6e('0x14'),function(_0xc4ac2a,_0x29248){if(this[_0xc4ac2a]instanceof Date){_0x29248=this[_0xc4ac2a][_0xec6e('0x15')]()[_0xec6e('0x16')]('.')[0x0]+'Z';}return _0x29248;});_0x3debd7[_0xec6e('0x17')](express[_0xec6e('0x18')](_0x3debd7['get'](_0xec6e('0x11'))));_0x3debd7[_0xec6e('0x13')]('views',config[_0xec6e('0xd')]+_0xec6e('0x19'));_0x3debd7['engine'](_0xec6e('0x1a'),require(_0xec6e('0x1b'))[_0xec6e('0x1c')]);_0x3debd7[_0xec6e('0x13')](_0xec6e('0x1d'),'html');_0x3debd7['use'](bodyParser[_0xec6e('0x1e')]({'limit':_0xec6e('0x1f'),'extended':!![]}));_0x3debd7[_0xec6e('0x17')](bodyParser['json']({'limit':'50mb'}));_0x3debd7['use'](cors());_0x3debd7[_0xec6e('0x17')](methodOverride());_0x3debd7[_0xec6e('0x17')](cookieParser());_0x3debd7[_0xec6e('0x17')](passport[_0xec6e('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 39801ec..c4936c4 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 _0xa92e=['win32','utf8','replace','hostname','ipAddress','substring','lodash','crypto','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','getUuid','platform','licenseToken','test'];(function(_0x101424,_0x146dbf){var _0x4f4f04=function(_0x378b88){while(--_0x378b88){_0x101424['push'](_0x101424['shift']());}};_0x4f4f04(++_0x146dbf);}(_0xa92e,0x192));var _0xea92=function(_0x11c1a4,_0x2238b1){_0x11c1a4=_0x11c1a4-0x0;var _0x137ac5=_0xa92e[_0x11c1a4];return _0x137ac5;};'use strict';var _=require(_0xea92('0x0'));var os=require('os');var crypto=require(_0xea92('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xea92('0x2'))['execSync'];var config=require(_0xea92('0x3'));function getInterfaces(){var _0x5661c9=[];var _0x45a317=os[_0xea92('0x4')]();var _0x52da90=_[_0xea92('0x5')](_[_0xea92('0x6')](_0x45a317));for(var _0x44986f=0x0;_0x44986f<_0x52da90[_0xea92('0x7')];_0x44986f++){var _0x282733=_0x45a317[_0x52da90[_0x44986f]][_0xea92('0x8')](function(_0xf804b9){return _0xf804b9[_0xea92('0x9')]===_0xea92('0xa')&&_0xf804b9[_0xea92('0xb')]===![];});_0x5661c9=_0x5661c9[_0xea92('0xc')](_0x282733);}return _0x5661c9;}function getFirstInterface(){var _0x5d7724=_[_0xea92('0xd')](getInterfaces());return{'macAddress':_0x5d7724&&_0x5d7724[_0xea92('0xe')]?_0x5d7724[_0xea92('0xe')]:_0xea92('0xf'),'ipAddress':_0x5d7724&&_0x5d7724[_0xea92('0x10')]?_0x5d7724['address']:_0xea92('0x11')};}exports[_0xea92('0x12')]=getFirstInterface;function getCPUhash(){var _0x23fbc4=_['orderBy'](os[_0xea92('0x13')]()[_0xea92('0x14')](function(_0x24648d){return _0x24648d[_0xea92('0x15')];}))['join'](':');return crypto[_0xea92('0x16')](_0xea92('0x17'))[_0xea92('0x18')](_0x23fbc4)[_0xea92('0x19')]('hex');}exports[_0xea92('0x1a')]=function(){var _0x57637b=os[_0xea92('0x1b')]();var _0x5b8d84=/[0-9a-f-]{36}/;if(config[_0xea92('0x1c')]&&_0x5b8d84[_0xea92('0x1d')](config[_0xea92('0x1c')])){return config[_0xea92('0x1c')];}else if(_0x57637b===_0xea92('0x1e')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xea92('0x1f')})[_0xea92('0x20')]('\x0d\x0a','');}else{var _0x37252d=getFirstInterface();var _0x514be1=getCPUhash();var _0x23d9bb=_0x514be1+'|'+os[_0xea92('0x21')]()+'|'+_0x37252d['macAddress']+'|'+_0x37252d[_0xea92('0x22')];var _0x2e59c6=crypto['createHash'](_0xea92('0x17'))[_0xea92('0x18')](_0x23d9bb)[_0xea92('0x19')]('hex');return _0x2e59c6['substring'](0x0,0x8)+'-'+_0x2e59c6[_0xea92('0x23')](0x8,0xc)+'-'+_0x2e59c6[_0xea92('0x23')](0xc,0x10)+'-'+_0x2e59c6[_0xea92('0x23')](0x10,0x14)+'-'+_0x2e59c6[_0xea92('0x23')](0x14);}}; \ No newline at end of file +var _0x6fc6=['address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','hex','platform','licenseToken','win32','replace','hostname','ipAddress','md5','update','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','keys','length','filter','family','IPv4','concat','mac'];(function(_0x4360c4,_0x2f8209){var _0x3168c8=function(_0x309523){while(--_0x309523){_0x4360c4['push'](_0x4360c4['shift']());}};_0x3168c8(++_0x2f8209);}(_0x6fc6,0x8e));var _0x66fc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6fc6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x66fc('0x0'));var os=require('os');var crypto=require(_0x66fc('0x1'));var machine=require(_0x66fc('0x2'));var exec=require(_0x66fc('0x3'))['execSync'];var config=require(_0x66fc('0x4'));function getInterfaces(){var _0x54cadd=[];var _0x3493a0=os[_0x66fc('0x5')]();var _0x3930b4=_['orderBy'](_[_0x66fc('0x6')](_0x3493a0));for(var _0x7d9aae=0x0;_0x7d9aae<_0x3930b4[_0x66fc('0x7')];_0x7d9aae++){var _0x2de789=_0x3493a0[_0x3930b4[_0x7d9aae]][_0x66fc('0x8')](function(_0x581e06){return _0x581e06[_0x66fc('0x9')]===_0x66fc('0xa')&&_0x581e06['internal']===![];});_0x54cadd=_0x54cadd[_0x66fc('0xb')](_0x2de789);}return _0x54cadd;}function getFirstInterface(){var _0x285348=_['head'](getInterfaces());return{'macAddress':_0x285348&&_0x285348[_0x66fc('0xc')]?_0x285348['mac']:'00:00:00:00:00:00','ipAddress':_0x285348&&_0x285348[_0x66fc('0xd')]?_0x285348[_0x66fc('0xd')]:_0x66fc('0xe')};}exports[_0x66fc('0xf')]=getFirstInterface;function getCPUhash(){var _0xe9d488=_['orderBy'](os[_0x66fc('0x10')]()[_0x66fc('0x11')](function(_0x6661ff){return _0x6661ff[_0x66fc('0x12')];}))['join'](':');return crypto[_0x66fc('0x13')]('md5')['update'](_0xe9d488)['digest'](_0x66fc('0x14'));}exports['getUuid']=function(){var _0x454c79=os[_0x66fc('0x15')]();var _0xe3162=/[0-9a-f-]{36}/;if(config[_0x66fc('0x16')]&&_0xe3162['test'](config[_0x66fc('0x16')])){return config['licenseToken'];}else if(_0x454c79===_0x66fc('0x17')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x66fc('0x18')]('\x0d\x0a','');}else{var _0x5c70f9=getFirstInterface();var _0x4599f7=getCPUhash();var _0x23ed4c=_0x4599f7+'|'+os[_0x66fc('0x19')]()+'|'+_0x5c70f9['macAddress']+'|'+_0x5c70f9[_0x66fc('0x1a')];var _0x262e7e=crypto[_0x66fc('0x13')](_0x66fc('0x1b'))[_0x66fc('0x1c')](_0x23ed4c)[_0x66fc('0x1d')](_0x66fc('0x14'));return _0x262e7e[_0x66fc('0x1e')](0x0,0x8)+'-'+_0x262e7e[_0x66fc('0x1e')](0x8,0xc)+'-'+_0x262e7e[_0x66fc('0x1e')](0xc,0x10)+'-'+_0x262e7e[_0x66fc('0x1e')](0x10,0x14)+'-'+_0x262e7e['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 4c84658..8275612 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 _0xf6d1=['update','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xf6d1,0x16b));var _0x1f6d=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf6d1[_0x5783f4];return _0x28e380;};'use strict';var util=require(_0x1f6d('0x0'));var moment=require(_0x1f6d('0x1'));var rp=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var pkginfo=require(_0x1f6d('0x4'))(module,_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x1f6d('0x7'))(_0x1f6d('0x8'));var HOST=_0x1f6d('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5cdf17){return new BPromise(function(_0x171339,_0x22a2a1){var _0x503207=util[_0x1f6d('0xa')](_0x1f6d('0xb'),HOST,_0x5cdf17,module[_0x1f6d('0xc')][_0x1f6d('0x5')]);if(oldToken){_0x503207=util[_0x1f6d('0xa')](_0x1f6d('0xd'),HOST,_0x5cdf17,module[_0x1f6d('0xc')][_0x1f6d('0x5')],oldToken);}var _0x5edd66={'uri':_0x503207,'method':_0x1f6d('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x5edd66)[_0x1f6d('0xf')](function(_0x4dbc4){_0x171339(_0x4dbc4);})[_0x1f6d('0x10')](function(_0x1e0ce7){_0x22a2a1(_0x1e0ce7);});});}function manageLicense(_0x3f3e0e,_0xdb01bf){var _0x417ebf=_0xdb01bf[_0x1f6d('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x417ebf[_0x1f6d('0x12')]!==_0x3f3e0e&&!_0x417ebf[_0x1f6d('0x13')]){oldToken=_0x417ebf[_0x1f6d('0x12')];}httpRequest(_0x3f3e0e)[_0x1f6d('0xf')](function(_0x40490d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x40490d[_0x1f6d('0x14')]){isOldTokenSent=![];if(!_0x417ebf[_0x1f6d('0x8')]&&_0x417ebf['license']!=_0x40490d[_0x1f6d('0x8')]||_0x417ebf[_0x1f6d('0x8')]&&_0x417ebf[_0x1f6d('0x13')]){logger['info'](_0x1f6d('0x15'));}if(_0x417ebf[_0x1f6d('0x8')]&&!_0x417ebf[_0x1f6d('0x13')]&&_0x417ebf[_0x1f6d('0x8')]!=_0x40490d[_0x1f6d('0x8')]){logger[_0x1f6d('0x16')](_0x1f6d('0x17'));}if(_0x417ebf['license']&&!_0x417ebf[_0x1f6d('0x13')]&&_0x417ebf[_0x1f6d('0x8')]==_0x40490d['license']){return _0xdb01bf;}return _0xdb01bf[_0x1f6d('0x18')]({'data1':_0x3f3e0e,'data2':null,'license':_0x40490d['license']});}else{if(_0x40490d[_0x1f6d('0x8')]||_0x417ebf[_0x1f6d('0x8')]){if(!_0x417ebf['data2']){if(_0x417ebf[_0x1f6d('0x12')]==_0x3f3e0e){GRAY_PERIOD_REASON=_0x1f6d('0x19');logger[_0x1f6d('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x1f6d('0x16')](_0x1f6d('0x1a'),_0x417ebf[_0x1f6d('0x12')],_0x3f3e0e);}logger[_0x1f6d('0x16')](_0x1f6d('0x1b'),GRAY_PERIOD_REASON[_0x1f6d('0x1c')](),moment()[_0x1f6d('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0xdb01bf[_0x1f6d('0x18')]({'data2':encryptor[_0x1f6d('0x1d')](moment()[_0x1f6d('0xa')](_0x1f6d('0x1e')))});}else{if(moment()[_0x1f6d('0x1f')](encryptor[_0x1f6d('0x20')](_0x417ebf[_0x1f6d('0x13')]),_0x1f6d('0x21'))>DAYS){logger[_0x1f6d('0x16')](_0x1f6d('0x22'),moment()[_0x1f6d('0xa')](_0x1f6d('0x1e')));isOldTokenSent=![];return _0xdb01bf[_0x1f6d('0x18')]({'data1':_0x3f3e0e,'data2':null,'license':null});}}}else{if(_0x417ebf[_0x1f6d('0x12')]!=_0x3f3e0e){logger[_0x1f6d('0x16')](_0x1f6d('0x1a'),_0x417ebf[_0x1f6d('0x12')],_0x3f3e0e);return _0xdb01bf['update']({'data1':_0x3f3e0e,'data2':null,'license':null});}}}return _0xdb01bf;})[_0x1f6d('0xf')](function(_0x3932a8){_0xdb01bf=_0x3932a8;})['catch'](function(_0x5ec31e){logger[_0x1f6d('0x23')](_0x5ec31e[_0x1f6d('0x24')]);})[_0x1f6d('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x1f6d('0x26')](),_0xdb01bf);},TIME);});}function defaultLicense(){var _0x3afb20=hardware[_0x1f6d('0x26')]();if(_0x3afb20){return db[_0x1f6d('0x27')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3afb20}})[_0x1f6d('0x28')](function(_0x5179d0,_0x27b910){logger['info'](_0x1f6d('0x29'),_0x3afb20);manageLicense(_0x3afb20,_0x5179d0);})[_0x1f6d('0x10')](function(_0x58fffb){logger['error'](_0x58fffb['message']);});}}exports[_0x1f6d('0x2a')]=defaultLicense; \ No newline at end of file +var _0x3963=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','decryptString','days','error','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED'];(function(_0xface47,_0x24551c){var _0x52d326=function(_0xbf1f1b){while(--_0xbf1f1b){_0xface47['push'](_0xface47['shift']());}};_0x52d326(++_0x24551c);}(_0x3963,0xce));var _0x3396=function(_0x375126,_0x514a8e){_0x375126=_0x375126-0x0;var _0x1f76bb=_0x3963[_0x375126];return _0x1f76bb;};'use strict';var util=require(_0x3396('0x0'));var moment=require(_0x3396('0x1'));var rp=require(_0x3396('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x3396('0x3'))(module,_0x3396('0x4'));var db=require(_0x3396('0x5'))['db'];var encryptor=require(_0x3396('0x6'));var hardware=require(_0x3396('0x7'));var logger=require(_0x3396('0x8'))(_0x3396('0x9'));var HOST=_0x3396('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2a7c9f){return new BPromise(function(_0x5a3a04,_0x18279a){var _0x347846=util[_0x3396('0xb')](_0x3396('0xc'),HOST,_0x2a7c9f,module[_0x3396('0xd')]['version']);if(oldToken){_0x347846=util[_0x3396('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2a7c9f,module[_0x3396('0xd')][_0x3396('0x4')],oldToken);}var _0x1ede01={'uri':_0x347846,'method':_0x3396('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1ede01)[_0x3396('0xf')](function(_0x3fe995){_0x5a3a04(_0x3fe995);})[_0x3396('0x10')](function(_0x2d257e){_0x18279a(_0x2d257e);});});}function manageLicense(_0x4a9791,_0x2142e1){var _0x225b73=_0x2142e1['get']({'plain':!![]});if(!isOldTokenSent&&_0x225b73[_0x3396('0x11')]!==_0x4a9791&&!_0x225b73['data2']){oldToken=_0x225b73['data1'];}httpRequest(_0x4a9791)[_0x3396('0xf')](function(_0x5ace69){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5ace69[_0x3396('0x12')]){isOldTokenSent=![];if(!_0x225b73[_0x3396('0x9')]&&_0x225b73[_0x3396('0x9')]!=_0x5ace69['license']||_0x225b73[_0x3396('0x9')]&&_0x225b73[_0x3396('0x13')]){logger[_0x3396('0x14')](_0x3396('0x15'));}if(_0x225b73[_0x3396('0x9')]&&!_0x225b73[_0x3396('0x13')]&&_0x225b73['license']!=_0x5ace69[_0x3396('0x9')]){logger['info'](_0x3396('0x16'));}if(_0x225b73[_0x3396('0x9')]&&!_0x225b73[_0x3396('0x13')]&&_0x225b73['license']==_0x5ace69[_0x3396('0x9')]){return _0x2142e1;}return _0x2142e1[_0x3396('0x17')]({'data1':_0x4a9791,'data2':null,'license':_0x5ace69[_0x3396('0x9')]});}else{if(_0x5ace69[_0x3396('0x9')]||_0x225b73[_0x3396('0x9')]){if(!_0x225b73[_0x3396('0x13')]){if(_0x225b73[_0x3396('0x11')]==_0x4a9791){GRAY_PERIOD_REASON=_0x3396('0x18');logger['info'](_0x3396('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x3396('0x14')](_0x3396('0x1a'),_0x225b73[_0x3396('0x11')],_0x4a9791);}logger['info'](_0x3396('0x1b'),GRAY_PERIOD_REASON[_0x3396('0x1c')](),moment()['format'](_0x3396('0x1d')));return _0x2142e1['update']({'data2':encryptor['encryptString'](moment()[_0x3396('0xb')](_0x3396('0x1d')))});}else{if(moment()['diff'](encryptor[_0x3396('0x1e')](_0x225b73[_0x3396('0x13')]),_0x3396('0x1f'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x3396('0xb')](_0x3396('0x1d')));isOldTokenSent=![];return _0x2142e1[_0x3396('0x17')]({'data1':_0x4a9791,'data2':null,'license':null});}}}else{if(_0x225b73[_0x3396('0x11')]!=_0x4a9791){logger[_0x3396('0x14')](_0x3396('0x1a'),_0x225b73[_0x3396('0x11')],_0x4a9791);return _0x2142e1[_0x3396('0x17')]({'data1':_0x4a9791,'data2':null,'license':null});}}}return _0x2142e1;})['then'](function(_0x2b2f41){_0x2142e1=_0x2b2f41;})['catch'](function(_0x5dd074){logger[_0x3396('0x20')](_0x5dd074[_0x3396('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x3396('0x22')](),_0x2142e1);},TIME);});}function defaultLicense(){var _0x49d45b=hardware[_0x3396('0x22')]();if(_0x49d45b){return db[_0x3396('0x23')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x49d45b}})[_0x3396('0x24')](function(_0x23ae6c,_0x43ba4f){logger[_0x3396('0x14')](_0x3396('0x25'),_0x49d45b);manageLicense(_0x49d45b,_0x23ae6c);})[_0x3396('0x10')](function(_0x25adae){logger[_0x3396('0x20')](_0x25adae[_0x3396('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e44e256..f5cc855 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 _0x525c=['users','telephones','forEach','admin','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','add','days','format','grayReason','changed','disabled','message','User','findAll','sequelize','col','count','role','user'];(function(_0x5568a2,_0x5ce728){var _0x19e06c=function(_0x533d6f){while(--_0x533d6f){_0x5568a2['push'](_0x5568a2['shift']());}};_0x19e06c(++_0x5ce728);}(_0x525c,0xf3));var _0xc525=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x525c[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var _=require(_0xc525('0x0'));var moment=require(_0xc525('0x1'));var BPromise=require(_0xc525('0x2'));var hardware=require(_0xc525('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xc525('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc525('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc525('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5c813a){return new BPromise(function(_0x50b6f1,_0x50e4b8){return db[_0xc525('0x7')][_0xc525('0x8')](_[_0xc525('0x9')](_0x5c813a,{'raw':!![],'where':{'id':0x1}}))[_0xc525('0xa')](function(_0x41c9a5){return checkLicense(_0x41c9a5,null);})[_0xc525('0xa')](function(_0x1bc850){_0x50b6f1(_0x1bc850);return;})[_0xc525('0xb')](function(_0x3f5fb7){_0x50e4b8(_0x3f5fb7);});});}function checkLicense(_0x3a4158,_0x224f42){if(!_0x3a4158){demoLicense[_0xc525('0xc')]=_0x3a4158[_0xc525('0xd')];return demoLicense;}try{var _0x512713=_0x224f42||_0x3a4158[_0xc525('0xe')];if(_[_0xc525('0xf')](_0x512713)){throw new Error(_0xc525('0x10'));}var _0x29d5dc=_0x3a4158[_0xc525('0xd')];var _0x2102bf=_0x3a4158[_0xc525('0x11')];var _0x30b71a=_0x29d5dc[_0xc525('0x12')]('-')[0x4];var _0x42ba30=_0x29d5dc[_0xc525('0x12')]('-')[0x0];var _0x5e6a3f=encryptor['decryptString'](_0x512713,util['format'](_0xc525('0x13'),_0x30b71a,_0x29d5dc,_0x42ba30));var _0x3d6646=JSON[_0xc525('0x14')](_0x5e6a3f);_0x3d6646[_0xc525('0x15')]=![];_0x3d6646[_0xc525('0xc')]=_0x29d5dc;_0x3d6646[_0xc525('0x16')]=hardware['getUuid']();if(_0x2102bf){var _0x4df56f=encryptor[_0xc525('0x17')](_0x2102bf);_0x3d6646[_0xc525('0x18')]=_0x4df56f;_0x3d6646['deadline']=moment(_0x4df56f)[_0xc525('0x19')](0x7,_0xc525('0x1a'))[_0xc525('0x1b')]();_0x3d6646[_0xc525('0x1c')]=_0x3d6646[_0xc525('0xc')]!=_0x3d6646[_0xc525('0x16')]?_0xc525('0x1d'):_0xc525('0x1e');}return _0x3d6646;}catch(_0x3f3725){breakingLicense[_0xc525('0xc')]=_0x3a4158[_0xc525('0xd')];breakingLicense[_0xc525('0x1f')]=_0x3f3725[_0xc525('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x389ba1,_0x5312f0){getLicense()[_0xc525('0xa')](function(_0x53879f){return db[_0xc525('0x20')][_0xc525('0x21')]({'attributes':['role',[db[_0xc525('0x22')]['fn']('COUNT',db[_0xc525('0x22')][_0xc525('0x23')]('role')),_0xc525('0x24')]],'group':_0xc525('0x25'),'where':{'role':{'$or':['admin',_0xc525('0x26'),'telephone']}},'raw':!![]})[_0xc525('0xa')](function(_0x8407df){var _0x3073e9={'user':_0x53879f[_0xc525('0x27')]||0x0,'telephone':_0x53879f[_0xc525('0x28')]||0x0};_0x8407df[_0xc525('0x29')](function(_0x319830){var _0x5cf9c0=_0x319830[_0xc525('0x25')]===_0xc525('0x2a')?'user':_0x319830[_0xc525('0x25')];_0x3073e9[_0x5cf9c0]-=_0x319830[_0xc525('0x24')];if(_0x3073e9[_0x5cf9c0]<0x0)_0x3073e9[_0x5cf9c0]=0x0;});_0x389ba1(_0x3073e9);return;});})['catch'](function(_0x302fba){_0x5312f0(_0x302fba);});});}function checkUserLimits(_0x505c06){return new BPromise(function(_0x44a600,_0x2802f7){getLimits()[_0xc525('0xa')](function(_0x4116d4){var _0x3eaf30=_['pick'](_[_0xc525('0x2b')](_0x505c06,_0xc525('0x25')),['admin',_0xc525('0x26'),_0xc525('0x2c')]);var _0x50f8df=(_0x3eaf30['admin']||0x0)+(_0x3eaf30[_0xc525('0x26')]||0x0);var _0xbd891c=_0x3eaf30['telephone']||0x0;if(_0x50f8df>_0x4116d4[_0xc525('0x26')])return _0x2802f7(_0xc525('0x2d'));if(_0xbd891c>_0x4116d4[_0xc525('0x2c')])return _0x2802f7(_0xc525('0x2e'));return _0x44a600();})[_0xc525('0xb')](function(_0x56500d){_0x2802f7(_0x56500d);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5211=['grayReason','machineUuid','changed','disabled','message','User','findAll','COUNT','sequelize','col','role','count','admin','telephone','users','telephones','forEach','user','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','parse','demo','deadline','add','days','format'];(function(_0x53ed52,_0x277a6c){var _0x1c079d=function(_0x4c6e96){while(--_0x4c6e96){_0x53ed52['push'](_0x53ed52['shift']());}};_0x1c079d(++_0x277a6c);}(_0x5211,0x174));var _0x1521=function(_0x197a1c,_0x5770f4){_0x197a1c=_0x197a1c-0x0;var _0x182f9a=_0x5211[_0x197a1c];return _0x182f9a;};'use strict';var util=require(_0x1521('0x0'));var _=require(_0x1521('0x1'));var moment=require(_0x1521('0x2'));var BPromise=require(_0x1521('0x3'));var hardware=require(_0x1521('0x4'));var encryptor=require(_0x1521('0x5'));var db=require(_0x1521('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1521('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1521('0x8'),'machineUuid':hardware[_0x1521('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1521('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x1521('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x50987d){return new BPromise(function(_0x19e30f,_0x1c9583){return db[_0x1521('0xa')][_0x1521('0xb')](_[_0x1521('0xc')](_0x50987d,{'raw':!![],'where':{'id':0x1}}))[_0x1521('0xd')](function(_0x42a42e){return checkLicense(_0x42a42e,null);})['then'](function(_0x236098){_0x19e30f(_0x236098);return;})[_0x1521('0xe')](function(_0x5b6315){_0x1c9583(_0x5b6315);});});}function checkLicense(_0x2f0d38,_0x2760f1){if(!_0x2f0d38){demoLicense[_0x1521('0xf')]=_0x2f0d38['data1'];return demoLicense;}try{var _0x49880c=_0x2760f1||_0x2f0d38[_0x1521('0x10')];if(_[_0x1521('0x11')](_0x49880c)){throw new Error(_0x1521('0x12'));}var _0x5341fa=_0x2f0d38['data1'];var _0x272846=_0x2f0d38[_0x1521('0x13')];var _0xf35d4a=_0x5341fa[_0x1521('0x14')]('-')[0x4];var _0x36110e=_0x5341fa[_0x1521('0x14')]('-')[0x0];var _0x1086a7=encryptor[_0x1521('0x15')](_0x49880c,util['format']('%s:%s:%s',_0xf35d4a,_0x5341fa,_0x36110e));var _0x4f13a6=JSON[_0x1521('0x16')](_0x1086a7);_0x4f13a6[_0x1521('0x17')]=![];_0x4f13a6[_0x1521('0xf')]=_0x5341fa;_0x4f13a6['machineUuid']=hardware[_0x1521('0x9')]();if(_0x272846){var _0x46256f=encryptor[_0x1521('0x15')](_0x272846);_0x4f13a6['gray']=_0x46256f;_0x4f13a6[_0x1521('0x18')]=moment(_0x46256f)[_0x1521('0x19')](0x7,_0x1521('0x1a'))[_0x1521('0x1b')]();_0x4f13a6[_0x1521('0x1c')]=_0x4f13a6[_0x1521('0xf')]!=_0x4f13a6[_0x1521('0x1d')]?_0x1521('0x1e'):_0x1521('0x1f');}return _0x4f13a6;}catch(_0x5d8d9a){breakingLicense['uuid']=_0x2f0d38['data1'];breakingLicense[_0x1521('0x20')]=_0x5d8d9a['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x121dc2,_0x389afe){getLicense()[_0x1521('0xd')](function(_0x4db68f){return db[_0x1521('0x21')][_0x1521('0x22')]({'attributes':['role',[db['sequelize']['fn'](_0x1521('0x23'),db[_0x1521('0x24')][_0x1521('0x25')](_0x1521('0x26'))),_0x1521('0x27')]],'group':_0x1521('0x26'),'where':{'role':{'$or':[_0x1521('0x28'),'user',_0x1521('0x29')]}},'raw':!![]})[_0x1521('0xd')](function(_0x324f98){var _0x4a9c91={'user':_0x4db68f[_0x1521('0x2a')]||0x0,'telephone':_0x4db68f[_0x1521('0x2b')]||0x0};_0x324f98[_0x1521('0x2c')](function(_0xfad126){var _0x158d46=_0xfad126[_0x1521('0x26')]===_0x1521('0x28')?_0x1521('0x2d'):_0xfad126[_0x1521('0x26')];_0x4a9c91[_0x158d46]-=_0xfad126[_0x1521('0x27')];if(_0x4a9c91[_0x158d46]<0x0)_0x4a9c91[_0x158d46]=0x0;});_0x121dc2(_0x4a9c91);return;});})[_0x1521('0xe')](function(_0x3112c1){_0x389afe(_0x3112c1);});});}function checkUserLimits(_0x4e5a27){return new BPromise(function(_0x15e4e3,_0x22c8c8){getLimits()['then'](function(_0x3331ea){var _0x5ccdb3=_[_0x1521('0x2e')](_['countBy'](_0x4e5a27,_0x1521('0x26')),['admin','user',_0x1521('0x29')]);var _0x46a637=(_0x5ccdb3['admin']||0x0)+(_0x5ccdb3[_0x1521('0x2d')]||0x0);var _0x4c94e3=_0x5ccdb3[_0x1521('0x29')]||0x0;if(_0x46a637>_0x3331ea[_0x1521('0x2d')])return _0x22c8c8(_0x1521('0x2f'));if(_0x4c94e3>_0x3331ea[_0x1521('0x29')])return _0x22c8c8(_0x1521('0x30'));return _0x15e4e3();})['catch'](function(_0x721ff1){_0x22c8c8(_0x721ff1);});});}module[_0x1521('0x31')]={'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 2011033..25c2a70 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 _0x8952=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8952,0x17e));var _0x2895=function(_0x198cd3,_0x3a883a){_0x198cd3=_0x198cd3-0x0;var _0x4edfa3=_0x8952[_0x198cd3];return _0x4edfa3;};'use strict';module['exports']={'DOMAIN':_0x2895('0x0'),'SESSION_SECRET':_0x2895('0x1'),'GOOGLE_ID':_0x2895('0x2'),'GOOGLE_SECRET':_0x2895('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x28f2=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x28f2,0x193));var _0x228f=function(_0x11a70,_0x446370){_0x11a70=_0x11a70-0x0;var _0x2bfc9d=_0x28f2[_0x11a70];return _0x2bfc9d;};'use strict';module[_0x228f('0x0')]={'DOMAIN':_0x228f('0x1'),'SESSION_SECRET':_0x228f('0x2'),'GOOGLE_ID':_0x228f('0x3'),'GOOGLE_SECRET':_0x228f('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 4c80271..d118969 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b61=['info','env','debugLevel','moment','winston','util','path','INFO','log','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error'];(function(_0x477143,_0x2b494c){var _0x391e1f=function(_0x3ef2d9){while(--_0x3ef2d9){_0x477143['push'](_0x477143['shift']());}};_0x391e1f(++_0x2b494c);}(_0x1b61,0xf3));var _0x11b6=function(_0x185104,_0x52a2e4){_0x185104=_0x185104-0x0;var _0xd07500=_0x1b61[_0x185104];return _0xd07500;};'use strict';var moment=require(_0x11b6('0x0'));var winston=require(_0x11b6('0x1'));var util=require(_0x11b6('0x2'));var path=require(_0x11b6('0x3'));var debugLevel=_0x11b6('0x4');function filename(_0x598769,_0x30021e){return path['join']('/var',_0x11b6('0x5'),'xcally',util[_0x11b6('0x6')](_0x11b6('0x7'),_0x598769,_0x30021e));}function formatter(_0x36345b,_0x2bd6c0){_0x2bd6c0[_0x11b6('0x8')]=_0x2bd6c0[_0x11b6('0x8')][_0x11b6('0x9')](/@@{/g,_0x11b6('0xa'))[_0x11b6('0x9')](/}@@/g,_0x11b6('0xb'))[_0x11b6('0x9')](/@{/g,'{{')[_0x11b6('0x9')](/}@/g,'}}');return util['format'](_0x11b6('0xc'),moment()[_0x11b6('0x6')](_0x11b6('0xd')),_0x2bd6c0['level'][_0x11b6('0xe')](),_0x36345b,_0x2bd6c0['message']);}module[_0x11b6('0xf')]=function(_0x1733d9){return new winston[(_0x11b6('0x10'))]({'transports':[new winston[(_0x11b6('0x11'))][(_0x11b6('0x12'))]({'name':util[_0x11b6('0x6')](_0x11b6('0x13'),_0x1733d9,'error'),'filename':filename(_0x1733d9,_0x11b6('0x14')),'level':_0x11b6('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3c5c1f){return formatter(_0x1733d9,_0x3c5c1f);}}),new winston['transports'][(_0x11b6('0x12'))]({'name':util[_0x11b6('0x6')]('%s-%s',_0x1733d9,'info'),'filename':filename(_0x1733d9,_0x11b6('0x15')),'level':_0x11b6('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x45a4d5){return formatter(_0x1733d9,_0x45a4d5);}}),new winston[(_0x11b6('0x11'))]['Console']({'level':process[_0x11b6('0x16')][_0x11b6('0x17')]||debugLevel,'json':![],'formatter':function(_0x917bce){return formatter(_0x1733d9,_0x917bce);}})]});}; \ No newline at end of file +var _0xbb47=['format','level','exports','Logger','%s-%s','error','transports','File','info','Console','debugLevel','moment','winston','util','path','INFO','join','/var','log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x13d0fc,_0x391eba){var _0x124453=function(_0x956eba){while(--_0x956eba){_0x13d0fc['push'](_0x13d0fc['shift']());}};_0x124453(++_0x391eba);}(_0xbb47,0x1d7));var _0x7bb4=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0xbb47[_0x5ad771];return _0x5b5dce;};'use strict';var moment=require(_0x7bb4('0x0'));var winston=require(_0x7bb4('0x1'));var util=require(_0x7bb4('0x2'));var path=require(_0x7bb4('0x3'));var debugLevel=_0x7bb4('0x4');function filename(_0x527e9f,_0x196856){return path[_0x7bb4('0x5')](_0x7bb4('0x6'),_0x7bb4('0x7'),'xcally',util['format']('%s-%s.log',_0x527e9f,_0x196856));}function formatter(_0x3c3967,_0x24cb8e){_0x24cb8e[_0x7bb4('0x8')]=_0x24cb8e[_0x7bb4('0x8')][_0x7bb4('0x9')](/@@{/g,_0x7bb4('0xa'))['replace'](/}@@/g,'}}}')[_0x7bb4('0x9')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x7bb4('0xb'),moment()[_0x7bb4('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),_0x24cb8e[_0x7bb4('0xd')]['toUpperCase'](),_0x3c3967,_0x24cb8e[_0x7bb4('0x8')]);}module[_0x7bb4('0xe')]=function(_0x173f15){return new winston[(_0x7bb4('0xf'))]({'transports':[new winston['transports']['File']({'name':util[_0x7bb4('0xc')](_0x7bb4('0x10'),_0x173f15,_0x7bb4('0x11')),'filename':filename(_0x173f15,_0x7bb4('0x11')),'level':_0x7bb4('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1a5ed6){return formatter(_0x173f15,_0x1a5ed6);}}),new winston[(_0x7bb4('0x12'))][(_0x7bb4('0x13'))]({'name':util[_0x7bb4('0xc')](_0x7bb4('0x10'),_0x173f15,_0x7bb4('0x14')),'filename':filename(_0x173f15,_0x7bb4('0x14')),'level':_0x7bb4('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x10b4da){return formatter(_0x173f15,_0x10b4da);}}),new winston[(_0x7bb4('0x12'))][(_0x7bb4('0x15'))]({'level':process['env'][_0x7bb4('0x16')]||debugLevel,'json':![],'formatter':function(_0x36d22d){return formatter(_0x173f15,_0x36d22d);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 4fb6d73..e2b5ea5 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 _0xef46=['../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef46,0x191));var _0x6ef4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xef46[_0x279d37];return _0x530173;};'use strict';var path=require(_0x6ef4('0x0'));var os=require('os');var config={'apps':[{'name':_0x6ef4('0x1'),'script':path[_0x6ef4('0x2')](__dirname,_0x6ef4('0x3'))},{'name':_0x6ef4('0x4'),'script':path['join'](__dirname,_0x6ef4('0x5'))},{'name':_0x6ef4('0x6'),'script':path[_0x6ef4('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x6ef4('0x7'),'script':path[_0x6ef4('0x2')](__dirname,_0x6ef4('0x8'))},{'name':_0x6ef4('0x9'),'script':path[_0x6ef4('0x2')](__dirname,_0x6ef4('0xa'))},{'name':_0x6ef4('0xb'),'script':path[_0x6ef4('0x2')](__dirname,_0x6ef4('0xc'))}]};module[_0x6ef4('0xd')]=config; \ No newline at end of file +var _0xb485=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x134299,_0x42bd37){var _0xfc4c8c=function(_0xf76372){while(--_0xf76372){_0x134299['push'](_0x134299['shift']());}};_0xfc4c8c(++_0x42bd37);}(_0xb485,0x158));var _0x5b48=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0xb485[_0x4907de];return _0x482054;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x5b48('0x0'),'script':path[_0x5b48('0x1')](__dirname,_0x5b48('0x2'))},{'name':_0x5b48('0x3'),'script':path[_0x5b48('0x1')](__dirname,_0x5b48('0x4'))},{'name':_0x5b48('0x5'),'script':path[_0x5b48('0x1')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x5b48('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x5b48('0x6'),'script':path[_0x5b48('0x1')](__dirname,_0x5b48('0x7'))},{'name':_0x5b48('0x8'),'script':path[_0x5b48('0x1')](__dirname,_0x5b48('0x9'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 08ec300..c92e333 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 _0x97be=['pm2','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x44878d,_0x48db95){var _0x37ec37=function(_0x111e9c){while(--_0x111e9c){_0x44878d['push'](_0x44878d['shift']());}};_0x37ec37(++_0x48db95);}(_0x97be,0x1ee));var _0xe97b=function(_0x2c5474,_0x1d8e3d){_0x2c5474=_0x2c5474-0x0;var _0x1ea6c5=_0x97be[_0x2c5474];return _0x1ea6c5;};'use strict';var pm2=require(_0xe97b('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x496419,_0x3d23d9){return pm2[_0xe97b('0x1')](function(_0x54cc12){if(_0x54cc12){return _0x3d23d9(_0x54cc12);}return _0x496419(_0xe97b('0x2'));});});};exports[_0xe97b('0x3')]=function(_0x2a0c6c){return connect()[_0xe97b('0x4')](function(){return new BPromise(function(_0x322262,_0x22a94a){return pm2[_0xe97b('0x3')](_0x2a0c6c,function(_0x260c15,_0x3aa46c){if(_0x260c15){return _0x22a94a(_0x260c15);}pm2[_0xe97b('0x5')]();return _0x322262(_0x3aa46c);});});});};exports[_0xe97b('0x6')]=function(_0x326d6e){return connect()[_0xe97b('0x4')](function(){return new BPromise(function(_0x2a21e8,_0x441ace){return pm2[_0xe97b('0x6')](_0x326d6e,function(_0xeafcc8,_0x1f150f){if(_0xeafcc8){return _0x441ace(_0xeafcc8);}pm2[_0xe97b('0x5')]();return _0x2a21e8(_0x1f150f);});});});};exports[_0xe97b('0x7')]=function(_0x46f67e){return connect()[_0xe97b('0x4')](function(){return new BPromise(function(_0x714fcd,_0x3d9766){return pm2[_0xe97b('0x7')](_0x46f67e,function(_0x425a12,_0x2b6fca){if(_0x425a12){return _0x3d9766(_0x425a12);}pm2[_0xe97b('0x5')]();return _0x714fcd(_0x2b6fca);});});});};exports['list']=function(){return connect()[_0xe97b('0x4')](function(){return new BPromise(function(_0x290f9,_0x2908d1){return pm2[_0xe97b('0x8')](function(_0x1dc357,_0x5337d1){if(_0x1dc357){return _0x2908d1(_0x1dc357);}pm2[_0xe97b('0x5')]();return _0x290f9(_0x5337d1);});});});};exports[_0xe97b('0x9')]=function(_0x69b49){return connect()['then'](function(){return new BPromise(function(_0x2c6d02,_0x54aeb6){return pm2[_0xe97b('0x9')](_0x69b49,function(_0x531727,_0x3b7e95){if(_0x531727){return _0x54aeb6(_0x531727);}pm2[_0xe97b('0x5')]();return _0x2c6d02(_0x3b7e95);});});});};exports[_0xe97b('0xa')]=function(_0x383e2e){return connect()[_0xe97b('0x4')](function(){return new BPromise(function(_0x221413,_0x28ea54){return pm2[_0xe97b('0xa')](_0x383e2e,function(_0x1e05c2,_0x4caca6){if(_0x1e05c2){return _0x28ea54(_0x1e05c2);}pm2[_0xe97b('0x5')]();return _0x221413(_0x4caca6);});});});};exports[_0xe97b('0xb')]=function(){return connect()[_0xe97b('0x4')](function(){return new BPromise(function(_0x1fe2dd,_0x180407){return pm2[_0xe97b('0xb')](function(_0x31fd78){if(_0x31fd78){return _0x180407(_0x31fd78);}return _0x1fe2dd(_0xe97b('0xc'));});});});}; \ No newline at end of file +var _0xc466=['saved','pm2','bluebird','./config','connect','connected','start','then','stop','restart','disconnect','list','describe','delete','dump'];(function(_0x5de697,_0x1b538b){var _0xf15be8=function(_0x225ccb){while(--_0x225ccb){_0x5de697['push'](_0x5de697['shift']());}};_0xf15be8(++_0x1b538b);}(_0xc466,0xa6));var _0x6c46=function(_0x3fc851,_0x3ae145){_0x3fc851=_0x3fc851-0x0;var _0x4be48a=_0xc466[_0x3fc851];return _0x4be48a;};'use strict';var pm2=require(_0x6c46('0x0'));var BPromise=require(_0x6c46('0x1'));var config=require(_0x6c46('0x2'));function connect(){return new BPromise(function(_0xa6fde6,_0x519d6d){return pm2[_0x6c46('0x3')](function(_0x52300e){if(_0x52300e){return _0x519d6d(_0x52300e);}return _0xa6fde6(_0x6c46('0x4'));});});};exports[_0x6c46('0x5')]=function(_0x178055){return connect()[_0x6c46('0x6')](function(){return new BPromise(function(_0x2c9dfa,_0x4ff30d){return pm2[_0x6c46('0x5')](_0x178055,function(_0x2238c6,_0x5bcae7){if(_0x2238c6){return _0x4ff30d(_0x2238c6);}pm2['disconnect']();return _0x2c9dfa(_0x5bcae7);});});});};exports[_0x6c46('0x7')]=function(_0x286130){return connect()['then'](function(){return new BPromise(function(_0x10f6f7,_0x449d7e){return pm2[_0x6c46('0x7')](_0x286130,function(_0x9cd130,_0x119627){if(_0x9cd130){return _0x449d7e(_0x9cd130);}pm2['disconnect']();return _0x10f6f7(_0x119627);});});});};exports[_0x6c46('0x8')]=function(_0x570d5a){return connect()[_0x6c46('0x6')](function(){return new BPromise(function(_0x10a8d0,_0x1938c7){return pm2[_0x6c46('0x8')](_0x570d5a,function(_0x4522ee,_0xf0783d){if(_0x4522ee){return _0x1938c7(_0x4522ee);}pm2[_0x6c46('0x9')]();return _0x10a8d0(_0xf0783d);});});});};exports['list']=function(){return connect()[_0x6c46('0x6')](function(){return new BPromise(function(_0x11d350,_0x582ff2){return pm2[_0x6c46('0xa')](function(_0x4e29af,_0x6400e0){if(_0x4e29af){return _0x582ff2(_0x4e29af);}pm2[_0x6c46('0x9')]();return _0x11d350(_0x6400e0);});});});};exports[_0x6c46('0xb')]=function(_0x499dc2){return connect()[_0x6c46('0x6')](function(){return new BPromise(function(_0x37f66c,_0x5baa32){return pm2[_0x6c46('0xb')](_0x499dc2,function(_0x31f41e,_0x2f911f){if(_0x31f41e){return _0x5baa32(_0x31f41e);}pm2[_0x6c46('0x9')]();return _0x37f66c(_0x2f911f);});});});};exports[_0x6c46('0xc')]=function(_0x3ca558){return connect()[_0x6c46('0x6')](function(){return new BPromise(function(_0x4463c0,_0xe87dd2){return pm2[_0x6c46('0xc')](_0x3ca558,function(_0x3fbae5,_0x276b1c){if(_0x3fbae5){return _0xe87dd2(_0x3fbae5);}pm2[_0x6c46('0x9')]();return _0x4463c0(_0x276b1c);});});});};exports['dump']=function(){return connect()[_0x6c46('0x6')](function(){return new BPromise(function(_0x4b2085,_0x59a518){return pm2[_0x6c46('0xd')](function(_0x1d3444){if(_0x1d3444){return _0x59a518(_0x1d3444);}return _0x4b2085(_0x6c46('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e51c196..0413738 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 _0xc4f8=['ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc4f8,0x12e));var _0x8c4f=function(_0x4d690a,_0x4120ff){_0x4d690a=_0x4d690a-0x0;var _0x28496a=_0xc4f8[_0x4d690a];return _0x28496a;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x8c4f('0x0'));var util=require(_0x8c4f('0x1'));var config=require(_0x8c4f('0x2'));var db=require(_0x8c4f('0x3'))['db'];var logger=require(_0x8c4f('0x4'))(_0x8c4f('0x5'));config[_0x8c4f('0x6')]=_[_0x8c4f('0x7')](config[_0x8c4f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x8c4f('0x8'))(new Redis(config[_0x8c4f('0x6')]));function closeInteractions(){var _0x691f87=0x0;var _0x5e4777=[];return db[_0x8c4f('0x9')][_0x8c4f('0xa')]({'raw':!![],'attributes':['id',_0x8c4f('0xb')],'where':{'id':0x1}})[_0x8c4f('0xc')](function(_0xca42fb){_0x691f87=_0xca42fb[_0x8c4f('0xb')];if(_0x691f87){return db[_0x8c4f('0xd')][_0x8c4f('0xe')]({'raw':!![],'attributes':['id',_0x8c4f('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8c4f('0x10')](_0xca42fb[_0x8c4f('0xb')],_0x8c4f('0x11'))}}});}else{return[];}})[_0x8c4f('0xc')](function(_0x51617a){if(_0x51617a&&_0x51617a['length']){_0x5e4777=_[_0x8c4f('0x12')](_0x51617a||[],'id');logger[_0x8c4f('0x13')](_0x8c4f('0x14'),_0x5e4777[_0x8c4f('0x15')]());return db[_0x8c4f('0xd')][_0x8c4f('0x16')]({'closeReason':_0x8c4f('0x17'),'disposition':_0x8c4f('0x18'),'closed':!![],'closedAt':moment()[_0x8c4f('0x19')](_0x8c4f('0x1a'))},{'where':{'id':_0x5e4777}});}})['then'](function(){if(_0x5e4777&&_0x5e4777[_0x8c4f('0x1b')]){logger[_0x8c4f('0x13')](_0x8c4f('0x1c'),_0x5e4777[_0x8c4f('0x15')]());for(var _0x1f5946=0x0;_0x1f5946<_0x5e4777['length'];_0x1f5946++){io['emit'](_0x8c4f('0x1d'),{'id':_0x5e4777[_0x1f5946],'closed':!![]});}}})[_0x8c4f('0x1e')](function(_0x1c57e8){logger[_0x8c4f('0x1f')](_0x8c4f('0x20'),_0x1c57e8?util[_0x8c4f('0x21')](_0x1c57e8,{'showHidden':![],'depth':null}):'');});}exports[_0x8c4f('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3cf9=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','start','moment','../../config/environment','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','join','ChatInteraction','update'];(function(_0xeb3333,_0x360d8f){var _0x141b1b=function(_0x5a5123){while(--_0x5a5123){_0xeb3333['push'](_0xeb3333['shift']());}};_0x141b1b(++_0x360d8f);}(_0x3cf9,0x177));var _0x93cf=function(_0x58212f,_0x4f8092){_0x58212f=_0x58212f-0x0;var _0x5b20d0=_0x3cf9[_0x58212f];return _0x5b20d0;};'use strict';var _=require('lodash');var moment=require(_0x93cf('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0x93cf('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x93cf('0x2'))(_0x93cf('0x3'));config['redis']=_[_0x93cf('0x4')](config[_0x93cf('0x5')],{'host':_0x93cf('0x6'),'port':0x18eb});var io=require(_0x93cf('0x7'))(new Redis(config[_0x93cf('0x5')]));function closeInteractions(){var _0x3c5eb0=0x0;var _0x5d9bfa=[];return db[_0x93cf('0x8')][_0x93cf('0x9')]({'raw':!![],'attributes':['id',_0x93cf('0xa')],'where':{'id':0x1}})[_0x93cf('0xb')](function(_0x47a254){_0x3c5eb0=_0x47a254['chatTimeout'];if(_0x3c5eb0){return db['ChatInteraction'][_0x93cf('0xc')]({'raw':!![],'attributes':['id',_0x93cf('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x93cf('0xe')](_0x47a254[_0x93cf('0xa')],_0x93cf('0xf'))}}});}else{return[];}})[_0x93cf('0xb')](function(_0x1ac25d){if(_0x1ac25d&&_0x1ac25d[_0x93cf('0x10')]){_0x5d9bfa=_[_0x93cf('0x11')](_0x1ac25d||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x5d9bfa[_0x93cf('0x12')]());return db[_0x93cf('0x13')][_0x93cf('0x14')]({'closeReason':_0x93cf('0x15'),'disposition':_0x93cf('0x16'),'closed':!![],'closedAt':moment()[_0x93cf('0x17')](_0x93cf('0x18'))},{'where':{'id':_0x5d9bfa}});}})[_0x93cf('0xb')](function(){if(_0x5d9bfa&&_0x5d9bfa[_0x93cf('0x10')]){logger[_0x93cf('0x19')](_0x93cf('0x1a'),_0x5d9bfa[_0x93cf('0x12')]());for(var _0x28e9a8=0x0;_0x28e9a8<_0x5d9bfa[_0x93cf('0x10')];_0x28e9a8++){io[_0x93cf('0x1b')](_0x93cf('0x1c'),{'id':_0x5d9bfa[_0x28e9a8],'closed':!![]});}}})[_0x93cf('0x1d')](function(_0x4fd87c){logger[_0x93cf('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4fd87c?util[_0x93cf('0x1f')](_0x4fd87c,{'showHidden':![],'depth':null}):'');});}exports[_0x93cf('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 78adbad..8ccfd91 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 _0xf949=['jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','basename','extname','zip','status','Sent','attachments','text','stringify','existsSync','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','toString','difference','intersection','exists','deleteJob','length','index','resolve','run\x20job','cron','active','isBetween','startAt','add\x20cron','stop\x20cron','endAt','update','update\x20cron','stop','start','util','path','moment'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0xf949,0xff));var _0x9f94=function(_0x216112,_0x3a57f4){_0x216112=_0x216112-0x0;var _0x578c6f=_0xf949[_0x216112];return _0x578c6f;};'use strict';var fs=require('fs');var util=require(_0x9f94('0x0'));var path=require(_0x9f94('0x1'));var _=require('lodash');var moment=require(_0x9f94('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x9f94('0x3'));var BPromise=require(_0x9f94('0x4'));var logger=require('../logger')(_0x9f94('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x9f94('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x9f94('0x7')][_0x9f94('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x359e04,_0x411c76){return function(){logger[_0x9f94('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x359e04[_0x9f94('0xa')]);var _0xaed221=!![];var _0x58300c={'tls':{'rejectUnauthorized':![]}};if(_0x359e04[_0x9f94('0xb')]['Smtp'][_0x9f94('0xc')]){_0x58300c['service']=_0x359e04[_0x9f94('0xb')][_0x9f94('0xd')][_0x9f94('0xc')];}else{_0x58300c[_0x9f94('0xe')]=_0x359e04[_0x9f94('0xb')][_0x9f94('0xd')][_0x9f94('0xe')];_0x58300c[_0x9f94('0xf')]=_0x359e04['MailAccount'][_0x9f94('0xd')][_0x9f94('0xf')];_0x58300c[_0x9f94('0x10')]=_0x359e04[_0x9f94('0xb')][_0x9f94('0xd')][_0x9f94('0x10')];}if(_0x359e04[_0x9f94('0xb')][_0x9f94('0xd')][_0x9f94('0x11')]){_0x58300c[_0x9f94('0x12')]={'user':_0x359e04['MailAccount'][_0x9f94('0xd')][_0x9f94('0x13')],'pass':_0x359e04['MailAccount']['Smtp'][_0x9f94('0x14')]};}var _0x19004c={'account':_0x58300c,'message':{'from':util[_0x9f94('0x15')](_0x9f94('0x16'),_0x359e04[_0x9f94('0xb')][_0x9f94('0x17')],_0x359e04[_0x9f94('0xb')][_0x9f94('0xa')]||_0x359e04[_0x9f94('0xb')][_0x9f94('0xd')][_0x9f94('0x13')]),'to':_0x359e04[_0x9f94('0xa')],'cc':_0x359e04['cc'],'bcc':_0x359e04[_0x9f94('0x18')],'subject':util[_0x9f94('0x15')](_0x9f94('0x19'),_0x411c76[_0x9f94('0x17')],_0x359e04[_0x9f94('0x1a')],_0x359e04['subtractUnit'])}};var _0x5187d4=path[_0x9f94('0x1b')](__dirname,_0x9f94('0x1c'));var _0x455f86=_0x411c76[_0x9f94('0x1d')];var _0x3f212b=util[_0x9f94('0x15')]('%s.%s',path[_0x9f94('0x1e')](_0x411c76[_0x9f94('0x1d')],path[_0x9f94('0x1f')](_0x411c76[_0x9f94('0x1d')])),_0x9f94('0x20'));var _0x4f40b0=path['join'](_0x5187d4,_0x455f86);var _0x100af1=path['join'](_0x5187d4,_0x3f212b);if(fs['existsSync'](_0x4f40b0)){_0x411c76[_0x9f94('0x21')]=_0x9f94('0x22');_0x19004c['message'][_0x9f94('0x23')]=[{'filename':_0x455f86,'path':_0x4f40b0}];_0x19004c['message'][_0x9f94('0x24')]=util[_0x9f94('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x9f94('0x25')](_0x411c76,null,0x2));}else if(fs[_0x9f94('0x26')](_0x100af1)){_0x411c76[_0x9f94('0x21')]=_0x9f94('0x22');_0x19004c['message'][_0x9f94('0x23')]=[{'filename':_0x3f212b,'path':_0x100af1}];}else{_0x19004c[_0x9f94('0x27')][_0x9f94('0x24')]=_0x9f94('0x28');if(!_0x359e04[_0x9f94('0x29')]){_0xaed221=![];logger[_0x9f94('0x9')](_0x9f94('0x2a'));}}if(_0xaed221){return client['request'](_0x9f94('0x2b'),_0x19004c)[_0x9f94('0x2c')](function(_0x38b9d8){if(_0x38b9d8[_0x9f94('0x2d')]){return logger[_0x9f94('0x2d')]('error\x20mail',JSON[_0x9f94('0x25')](_0x38b9d8));}return logger[_0x9f94('0x9')](_0x9f94('0x2e'));})[_0x9f94('0x2f')](function(_0x50b197){return logger[_0x9f94('0x2d')](_0x9f94('0x30'),JSON[_0x9f94('0x25')](_0x50b197));});}};}function handleError(){return function(_0x3388f8){return logger['error'](JSON['stringify'](_0x3388f8));};}function handleResult(_0x5c6382){return function(_0x5da73d){logger['info'](_0x9f94('0x31'),JSON[_0x9f94('0x25')](_0x5da73d));if(_0x5c6382[_0x9f94('0xb')]&&_0x5c6382[_0x9f94('0xb')][_0x9f94('0xd')]&&!_[_0x9f94('0x32')](_0x5c6382[_0x9f94('0xa')])){setTimeout(handleSendEmail(_0x5c6382,_0x5da73d),0x3c*0x3e8);}};}function handleJob(_0x1cba61){return function(){try{if(_[_0x9f94('0x32')](_0x1cba61[_0x9f94('0x1a')])){return logger[_0x9f94('0x9')](_0x9f94('0x33'));}if(_[_0x9f94('0x32')](_0x1cba61[_0x9f94('0x34')])){return logger[_0x9f94('0x9')](_0x9f94('0x35'));}var _0x24869e={'startDate':moment()[_0x9f94('0x36')](_0x1cba61[_0x9f94('0x1a')],_0x1cba61['subtractUnit'])[_0x9f94('0x15')](_0x9f94('0x37')),'endDate':moment()[_0x9f94('0x15')](_0x9f94('0x37')),'type':'scheduled','output':_0x1cba61[_0x9f94('0x38')],'name':_0x1cba61[_0x9f94('0x17')]};if(!_[_0x9f94('0x32')](_0x1cba61[_0x9f94('0x39')])){logger[_0x9f94('0x9')](_0x9f94('0x3a'),_0x1cba61['DefaultReportId']);return analyticDefaultReportController[_0x9f94('0x3b')]({'id':_0x1cba61[_0x9f94('0x39')]},_0x24869e)['then'](handleResult(_0x1cba61))[_0x9f94('0x2f')](handleError());}if(!_[_0x9f94('0x32')](_0x1cba61[_0x9f94('0x3c')])){logger[_0x9f94('0x9')]('exec\x20custom\x20report\x20id:%s',_0x1cba61[_0x9f94('0x3c')]);return analyticCustomReportController[_0x9f94('0x3b')]({'id':_0x1cba61[_0x9f94('0x3c')]},_0x24869e)['then'](handleResult(_0x1cba61))[_0x9f94('0x2f')](handleError());}}catch(_0x1a034b){logger[_0x9f94('0x2d')](JSON[_0x9f94('0x25')](_0x1a034b));}return logger[_0x9f94('0x9')](_0x9f94('0x3d'));};}function getJobs(_0x578603){var _0x16b117={};if(_0x578603){_0x16b117['id']=_0x578603;}return db[_0x9f94('0x3e')]['findAll']({'where':_0x16b117,'include':[{'model':db['MailAccount'],'attributes':['id',_0x9f94('0x17'),_0x9f94('0xa')],'include':[{'model':db[_0x9f94('0x3f')],'as':_0x9f94('0xd')}]}]})[_0x9f94('0x2c')](function(_0x9d6ddb){var _0xb0a68c=_[_0x9f94('0x40')](manager[_0x9f94('0x41')]);var _0x34a5f0=_['map'](_0x9d6ddb,function(_0x1f0483){return _0x1f0483['id'][_0x9f94('0x42')]();});var _0x188975=_['keyBy'](_0x9d6ddb,function(_0x15a850){return _0x15a850['id'][_0x9f94('0x42')]();});var _0x30f5cd=_0x578603?_0x34a5f0:_[_0x9f94('0x43')](_0x34a5f0,_0xb0a68c);var _0x57baf2=_[_0x9f94('0x44')](_0x34a5f0,_0xb0a68c);var _0x327fb0=_['difference'](_0xb0a68c,_0x34a5f0);var _0x4ef8a7;var _0xdfd2a5;for(_0x4ef8a7=0x0;_0x4ef8a7<_0x327fb0['length']&&!_0x578603;_0x4ef8a7+=0x1){_0xdfd2a5=_0x327fb0[_0x4ef8a7][_0x9f94('0x42')]();if(manager[_0x9f94('0x45')](_0xdfd2a5)){manager['stop'](_0xdfd2a5);manager[_0x9f94('0x46')](_0xdfd2a5);logger[_0x9f94('0x9')]('delete\x20cron',_0xdfd2a5);}}logger['info']('toRun',JSON['stringify'](_0x30f5cd));for(_0x4ef8a7=0x0;_0x4ef8a7<_0x30f5cd[_0x9f94('0x47')];_0x4ef8a7+=0x1){_0xdfd2a5=_0x30f5cd[_0x4ef8a7]['toString']();logger[_0x9f94('0x9')](_0x9f94('0x48'),_0xdfd2a5);if(_0x578603){logger[_0x9f94('0x9')]('my\x20id',_0x578603);logger['info'](JSON[_0x9f94('0x25')](_0x188975[_0xdfd2a5]));BPromise[_0x9f94('0x49')]()[_0x9f94('0x2c')](handleJob(_0x188975[_0xdfd2a5]));logger['info'](_0x9f94('0x4a'),_0x188975[_0xdfd2a5][_0x9f94('0x17')],_0x188975[_0xdfd2a5][_0x9f94('0x4b')]);}else if(_0x188975[_0xdfd2a5][_0x9f94('0x4b')]&&_0x188975[_0xdfd2a5][_0x9f94('0x4c')]&&moment()[_0x9f94('0x4d')](_0x188975[_0xdfd2a5][_0x9f94('0x4e')],_0x188975[_0xdfd2a5]['endAt'])){manager['add'](_0xdfd2a5,_0x188975[_0xdfd2a5]['cron'],handleJob(_0x188975[_0xdfd2a5]));manager['start'](_0xdfd2a5);logger[_0x9f94('0x9')](_0x9f94('0x4f'),_0x188975[_0xdfd2a5][_0x9f94('0x17')],_0x188975[_0xdfd2a5][_0x9f94('0x4b')]);}else if(manager[_0x9f94('0x45')](_0xdfd2a5)){manager['stop'](_0xdfd2a5);manager['deleteJob'](_0xdfd2a5);logger[_0x9f94('0x9')](_0x9f94('0x50'),_0x188975[_0xdfd2a5][_0x9f94('0x17')],_0x188975[_0xdfd2a5]['cron']);}}for(_0x4ef8a7=0x0,_0xdfd2a5;_0x4ef8a7<_0x57baf2['length']&&!_0x578603;_0x4ef8a7+=0x1){_0xdfd2a5=_0x57baf2[_0x4ef8a7][_0x9f94('0x42')]();if(manager[_0x9f94('0x45')](_0xdfd2a5)){if(_0x188975[_0xdfd2a5][_0x9f94('0x4b')]&&_0x188975[_0xdfd2a5][_0x9f94('0x4c')]&&moment()['isBetween'](_0x188975[_0xdfd2a5][_0x9f94('0x4e')],_0x188975[_0xdfd2a5][_0x9f94('0x51')])){manager[_0x9f94('0x52')](_0xdfd2a5,_0x188975[_0xdfd2a5]['cron'],handleJob(_0x188975[_0xdfd2a5]));logger['info'](_0x9f94('0x53'),_0x188975[_0xdfd2a5][_0x9f94('0x17')],_0x188975[_0xdfd2a5][_0x9f94('0x4b')]);}else{manager[_0x9f94('0x54')](_0xdfd2a5);manager[_0x9f94('0x46')](_0xdfd2a5);logger[_0x9f94('0x9')](_0x9f94('0x50'),_0x188975[_0xdfd2a5]['name'],_0x188975[_0xdfd2a5][_0x9f94('0x4b')]);}}}})[_0x9f94('0x2f')](function(_0x21d476){logger['error'](JSON[_0x9f94('0x25')](_0x21d476));});}exports['run']=function(_0x497bb2){return getJobs(_0x497bb2);};exports[_0x9f94('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2559=['Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','startAt','add','add\x20cron','stop\x20cron','endAt','update','update\x20cron','catch','run','start','util','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','secure','authentication','user','format','name','email','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x2559,0xe8));var _0x9255=function(_0x3506f9,_0x326d80){_0x3506f9=_0x3506f9-0x0;var _0x5ed964=_0x2559[_0x3506f9];return _0x5ed964;};'use strict';var fs=require('fs');var util=require(_0x9255('0x0'));var path=require('path');var _=require(_0x9255('0x1'));var moment=require('moment');var CronJobManager=require(_0x9255('0x2'));var jayson=require(_0x9255('0x3'));var BPromise=require(_0x9255('0x4'));var logger=require(_0x9255('0x5'))(_0x9255('0x6'));var db=require(_0x9255('0x7'))['db'];var analyticCustomReportController=require(_0x9255('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x9255('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x24c68c,_0x28120e){return function(){logger[_0x9255('0xa')](_0x9255('0xb'),_0x24c68c['email']);var _0x1fb792=!![];var _0x4ad574={'tls':{'rejectUnauthorized':![]}};if(_0x24c68c[_0x9255('0xc')][_0x9255('0xd')]['service']){_0x4ad574['service']=_0x24c68c[_0x9255('0xc')][_0x9255('0xd')][_0x9255('0xe')];}else{_0x4ad574['host']=_0x24c68c[_0x9255('0xc')][_0x9255('0xd')]['host'];_0x4ad574['port']=_0x24c68c[_0x9255('0xc')]['Smtp']['port'];_0x4ad574[_0x9255('0xf')]=_0x24c68c[_0x9255('0xc')][_0x9255('0xd')]['secure'];}if(_0x24c68c[_0x9255('0xc')][_0x9255('0xd')][_0x9255('0x10')]){_0x4ad574['auth']={'user':_0x24c68c[_0x9255('0xc')][_0x9255('0xd')][_0x9255('0x11')],'pass':_0x24c68c[_0x9255('0xc')][_0x9255('0xd')]['pass']};}var _0x37cd4f={'account':_0x4ad574,'message':{'from':util[_0x9255('0x12')]('\x22%s\x22\x20<%s>',_0x24c68c[_0x9255('0xc')][_0x9255('0x13')],_0x24c68c[_0x9255('0xc')]['email']||_0x24c68c[_0x9255('0xc')][_0x9255('0xd')]['user']),'to':_0x24c68c[_0x9255('0x14')],'cc':_0x24c68c['cc'],'bcc':_0x24c68c['bcc'],'subject':util[_0x9255('0x12')](_0x9255('0x15'),_0x28120e['name'],_0x24c68c[_0x9255('0x16')],_0x24c68c['subtractUnit'])}};var _0x4ae74c=path[_0x9255('0x17')](__dirname,_0x9255('0x18'));var _0x43c87e=_0x28120e[_0x9255('0x19')];var _0x2c1655=util[_0x9255('0x12')](_0x9255('0x1a'),path[_0x9255('0x1b')](_0x28120e['savename'],path[_0x9255('0x1c')](_0x28120e[_0x9255('0x19')])),_0x9255('0x1d'));var _0x1fba57=path[_0x9255('0x17')](_0x4ae74c,_0x43c87e);var _0x5e331c=path[_0x9255('0x17')](_0x4ae74c,_0x2c1655);if(fs[_0x9255('0x1e')](_0x1fba57)){_0x28120e[_0x9255('0x1f')]=_0x9255('0x20');_0x37cd4f[_0x9255('0x21')][_0x9255('0x22')]=[{'filename':_0x43c87e,'path':_0x1fba57}];_0x37cd4f[_0x9255('0x21')][_0x9255('0x23')]=util[_0x9255('0x12')](_0x9255('0x24'),JSON[_0x9255('0x25')](_0x28120e,null,0x2));}else if(fs[_0x9255('0x1e')](_0x5e331c)){_0x28120e['status']=_0x9255('0x20');_0x37cd4f[_0x9255('0x21')][_0x9255('0x22')]=[{'filename':_0x2c1655,'path':_0x5e331c}];}else{_0x37cd4f[_0x9255('0x21')]['text']=_0x9255('0x26');if(!_0x24c68c['sendIfEmpty']){_0x1fb792=![];logger[_0x9255('0xa')](_0x9255('0x27'));}}if(_0x1fb792){return client[_0x9255('0x28')](_0x9255('0x29'),_0x37cd4f)[_0x9255('0x2a')](function(_0x1ccecd){if(_0x1ccecd[_0x9255('0x2b')]){return logger['error'](_0x9255('0x2c'),JSON[_0x9255('0x25')](_0x1ccecd));}return logger[_0x9255('0xa')]('email\x20sent');})['catch'](function(_0x15e7b5){return logger[_0x9255('0x2b')](_0x9255('0x2c'),JSON[_0x9255('0x25')](_0x15e7b5));});}};}function handleError(){return function(_0x293a8f){return logger['error'](JSON['stringify'](_0x293a8f));};}function handleResult(_0x1a35f9){return function(_0x2ef494){logger[_0x9255('0xa')](_0x9255('0x2d'),JSON[_0x9255('0x25')](_0x2ef494));if(_0x1a35f9['MailAccount']&&_0x1a35f9[_0x9255('0xc')][_0x9255('0xd')]&&!_[_0x9255('0x2e')](_0x1a35f9['email'])){setTimeout(handleSendEmail(_0x1a35f9,_0x2ef494),0x3c*0x3e8);}};}function handleJob(_0x5084a4){return function(){try{if(_[_0x9255('0x2e')](_0x5084a4['subtractNumber'])){return logger[_0x9255('0xa')](_0x9255('0x2f'));}if(_[_0x9255('0x2e')](_0x5084a4[_0x9255('0x30')])){return logger[_0x9255('0xa')](_0x9255('0x31'));}var _0x2fc358={'startDate':moment()['subtract'](_0x5084a4[_0x9255('0x16')],_0x5084a4['subtractUnit'])[_0x9255('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x9255('0x12')](_0x9255('0x32')),'type':'scheduled','output':_0x5084a4[_0x9255('0x33')],'name':_0x5084a4['name']};if(!_[_0x9255('0x2e')](_0x5084a4[_0x9255('0x34')])){logger[_0x9255('0xa')](_0x9255('0x35'),_0x5084a4['DefaultReportId']);return analyticDefaultReportController[_0x9255('0x36')]({'id':_0x5084a4[_0x9255('0x34')]},_0x2fc358)[_0x9255('0x2a')](handleResult(_0x5084a4))['catch'](handleError());}if(!_[_0x9255('0x2e')](_0x5084a4[_0x9255('0x37')])){logger[_0x9255('0xa')](_0x9255('0x38'),_0x5084a4[_0x9255('0x37')]);return analyticCustomReportController['runReport']({'id':_0x5084a4[_0x9255('0x37')]},_0x2fc358)[_0x9255('0x2a')](handleResult(_0x5084a4))['catch'](handleError());}}catch(_0x211dc3){logger[_0x9255('0x2b')](JSON[_0x9255('0x25')](_0x211dc3));}return logger['info'](_0x9255('0x39'));};}function getJobs(_0x172cc1){var _0x52c40b={};if(_0x172cc1){_0x52c40b['id']=_0x172cc1;}return db[_0x9255('0x3a')][_0x9255('0x3b')]({'where':_0x52c40b,'include':[{'model':db[_0x9255('0xc')],'attributes':['id',_0x9255('0x13'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x9255('0xd')}]}]})[_0x9255('0x2a')](function(_0x870217){var _0x5673e7=_[_0x9255('0x3c')](manager[_0x9255('0x3d')]);var _0x21ea0c=_[_0x9255('0x3e')](_0x870217,function(_0x555cbc){return _0x555cbc['id']['toString']();});var _0x3ec063=_[_0x9255('0x3f')](_0x870217,function(_0x155cce){return _0x155cce['id'][_0x9255('0x40')]();});var _0x541fd6=_0x172cc1?_0x21ea0c:_[_0x9255('0x41')](_0x21ea0c,_0x5673e7);var _0xeb8e00=_[_0x9255('0x42')](_0x21ea0c,_0x5673e7);var _0x15072c=_[_0x9255('0x41')](_0x5673e7,_0x21ea0c);var _0x4838e8;var _0x276dcd;for(_0x4838e8=0x0;_0x4838e8<_0x15072c[_0x9255('0x43')]&&!_0x172cc1;_0x4838e8+=0x1){_0x276dcd=_0x15072c[_0x4838e8][_0x9255('0x40')]();if(manager[_0x9255('0x44')](_0x276dcd)){manager[_0x9255('0x45')](_0x276dcd);manager[_0x9255('0x46')](_0x276dcd);logger['info'](_0x9255('0x47'),_0x276dcd);}}logger[_0x9255('0xa')](_0x9255('0x48'),JSON[_0x9255('0x25')](_0x541fd6));for(_0x4838e8=0x0;_0x4838e8<_0x541fd6[_0x9255('0x43')];_0x4838e8+=0x1){_0x276dcd=_0x541fd6[_0x4838e8][_0x9255('0x40')]();logger[_0x9255('0xa')](_0x9255('0x49'),_0x276dcd);if(_0x172cc1){logger[_0x9255('0xa')](_0x9255('0x4a'),_0x172cc1);logger[_0x9255('0xa')](JSON['stringify'](_0x3ec063[_0x276dcd]));BPromise[_0x9255('0x4b')]()['then'](handleJob(_0x3ec063[_0x276dcd]));logger['info']('run\x20job',_0x3ec063[_0x276dcd][_0x9255('0x13')],_0x3ec063[_0x276dcd][_0x9255('0x4c')]);}else if(_0x3ec063[_0x276dcd][_0x9255('0x4c')]&&_0x3ec063[_0x276dcd][_0x9255('0x4d')]&&moment()['isBetween'](_0x3ec063[_0x276dcd][_0x9255('0x4e')],_0x3ec063[_0x276dcd]['endAt'])){manager[_0x9255('0x4f')](_0x276dcd,_0x3ec063[_0x276dcd][_0x9255('0x4c')],handleJob(_0x3ec063[_0x276dcd]));manager['start'](_0x276dcd);logger[_0x9255('0xa')](_0x9255('0x50'),_0x3ec063[_0x276dcd][_0x9255('0x13')],_0x3ec063[_0x276dcd][_0x9255('0x4c')]);}else if(manager[_0x9255('0x44')](_0x276dcd)){manager[_0x9255('0x45')](_0x276dcd);manager[_0x9255('0x46')](_0x276dcd);logger[_0x9255('0xa')](_0x9255('0x51'),_0x3ec063[_0x276dcd]['name'],_0x3ec063[_0x276dcd][_0x9255('0x4c')]);}}for(_0x4838e8=0x0,_0x276dcd;_0x4838e8<_0xeb8e00[_0x9255('0x43')]&&!_0x172cc1;_0x4838e8+=0x1){_0x276dcd=_0xeb8e00[_0x4838e8]['toString']();if(manager[_0x9255('0x44')](_0x276dcd)){if(_0x3ec063[_0x276dcd][_0x9255('0x4c')]&&_0x3ec063[_0x276dcd][_0x9255('0x4d')]&&moment()['isBetween'](_0x3ec063[_0x276dcd][_0x9255('0x4e')],_0x3ec063[_0x276dcd][_0x9255('0x52')])){manager[_0x9255('0x53')](_0x276dcd,_0x3ec063[_0x276dcd][_0x9255('0x4c')],handleJob(_0x3ec063[_0x276dcd]));logger[_0x9255('0xa')](_0x9255('0x54'),_0x3ec063[_0x276dcd][_0x9255('0x13')],_0x3ec063[_0x276dcd]['cron']);}else{manager[_0x9255('0x45')](_0x276dcd);manager[_0x9255('0x46')](_0x276dcd);logger[_0x9255('0xa')](_0x9255('0x51'),_0x3ec063[_0x276dcd][_0x9255('0x13')],_0x3ec063[_0x276dcd][_0x9255('0x4c')]);}}}})[_0x9255('0x55')](function(_0x67410f){logger[_0x9255('0x2b')](JSON['stringify'](_0x67410f));});}exports[_0x9255('0x56')]=function(_0x3589de){return getJobs(_0x3589de);};exports[_0x9255('0x57')]=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 8879447..8df37cc 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 _0x84a0=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data2','transcribeRegion','then','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured'];(function(_0x18e797,_0x1edbd6){var _0x226a47=function(_0x40ae53){while(--_0x40ae53){_0x18e797['push'](_0x18e797['shift']());}};_0x226a47(++_0x1edbd6);}(_0x84a0,0x66));var _0x084a=function(_0x2b7891,_0xedce2b){_0x2b7891=_0x2b7891-0x0;var _0x1e3218=_0x84a0[_0x2b7891];return _0x1e3218;};var _=require(_0x084a('0x0'));var AWS=require(_0x084a('0x1'));var rp=require(_0x084a('0x2'));var util=require(_0x084a('0x3'));var BPromise=require('bluebird');var db=require(_0x084a('0x4'))['db'];var logger=require(_0x084a('0x5'))('transcribe');function getTranscriptionJob(_0x58a814,_0x52d04c,_0x1c0292,_0x5617b5){return new Promise(function(_0x16f8a7,_0x4325ce){var _0x2e6810=new AWS[(_0x084a('0x6'))]({'accessKeyId':_0x52d04c,'secretAccessKey':_0x58a814,'region':_0x1c0292});_0x2e6810[_0x084a('0x7')]({'TranscriptionJobName':_0x5617b5},function(_0x58d419,_0x1051a9){if(_0x58d419){return _0x4325ce(_0x58d419);}else{return _0x16f8a7(_0x1051a9);}});});}function sentiment(_0x13415d,_0x8198ad,_0x2888e3,_0x142127,_0x4c1e29){return new Promise(function(_0x4dd423,_0x3d9dc6){var _0x853df=new AWS[(_0x084a('0x8'))]({'accessKeyId':_0x8198ad,'secretAccessKey':_0x13415d,'region':_0x2888e3});_0x853df[_0x084a('0x9')]({'Text':_0x142127,'LanguageCode':_0x4c1e29[_0x084a('0xa')](0x0,0x2)},function(_0x57c405,_0x4ef41f){if(_0x57c405){return _0x3d9dc6(_0x57c405);}else{return _0x4dd423(_0x4ef41f);}});});}function checkTranscribeJob(_0xc451b1,_0x3ca72f,_0xec90a5){var _0x9245b1;return new BPromise(function(_0x1bdfb8,_0x414b05){logger[_0x084a('0xb')](util[_0x084a('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xc451b1['id'],_0xc451b1[_0x084a('0xd')]));return getTranscriptionJob(_0xec90a5['data1'],_0xec90a5[_0x084a('0xe')],_0x3ca72f[_0x084a('0xf')],_0xc451b1[_0x084a('0xd')])[_0x084a('0x10')](function(_0xd20527){logger['info'](util[_0x084a('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xc451b1['id'],_0xc451b1[_0x084a('0xd')],_0xd20527[_0x084a('0x11')]['TranscriptionJobStatus']));if(!_0xc451b1[_0x084a('0x12')]){switch(_0xd20527[_0x084a('0x11')][_0x084a('0x13')]){case _0x084a('0x14'):var _0x33d3a6={'transcribeStatus':_0xd20527[_0x084a('0x11')][_0x084a('0x13')],'fileUri':_0xd20527[_0x084a('0x11')][_0x084a('0x15')][_0x084a('0x16')]};logger[_0x084a('0xb')](util[_0x084a('0xc')](_0x084a('0x17'),_0xc451b1['id']));return rp({'uri':_0xd20527[_0x084a('0x11')][_0x084a('0x15')]['TranscriptFileUri'],'json':!![]})[_0x084a('0x10')](function(_0x1ad257){logger[_0x084a('0xb')](util[_0x084a('0xc')](_0x084a('0x18'),_0xc451b1['id']));if(_0x1ad257&&_0x1ad257['results']&&_0x1ad257[_0x084a('0x19')][_0x084a('0x1a')]&&_0x1ad257[_0x084a('0x19')][_0x084a('0x1a')][_0x084a('0x1b')]){_0x33d3a6[_0x084a('0x12')]='';for(var _0x5be167=0x0;_0x5be167<_0x1ad257[_0x084a('0x19')][_0x084a('0x1a')][_0x084a('0x1b')];_0x5be167++){_0x33d3a6['fileText']+=_0x1ad257[_0x084a('0x19')][_0x084a('0x1a')][_0x5be167][_0x084a('0x1c')]+'';}}return _0xc451b1['update'](_0x33d3a6);})['then'](function(){logger['info'](util['format'](_0x084a('0x1d'),_0xc451b1['id']));if(!_0xc451b1['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x084a('0x1e'));}if(!_0x3ca72f[_0x084a('0x1f')]||!_0x3ca72f[_0x084a('0x20')]||!_0x3ca72f[_0x084a('0x21')]||!_0x3ca72f[_0x084a('0x22')]||!_0x3ca72f[_0x084a('0x23')]){throw new db[(_0x084a('0x24'))][(_0x084a('0x25'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x33d3a6[_0x084a('0x12')]){throw new Error(_0x084a('0x26'));}if(_0x3ca72f['sentimentAccountId']===_0xec90a5['id']){return _0xec90a5;}else{return db[_0x084a('0x27')][_0x084a('0x28')]({'where':{'id':_settings[_0x084a('0x20')]}});}})[_0x084a('0x10')](function(_0x448ae9){if(!_0x448ae9){throw new db[(_0x084a('0x24'))][(_0x084a('0x25'))](_0x084a('0x29'));}if(!_0x448ae9[_0x084a('0x2a')]||!_0x448ae9[_0x084a('0xe')]){throw new db[(_0x084a('0x24'))][(_0x084a('0x25'))](_0x084a('0x2b'));}_0x9245b1=_0x448ae9;logger['info'](util['format'](_0x084a('0x2c'),_0xc451b1['id']));return sentiment(_0x9245b1[_0x084a('0x2a')],_0x9245b1[_0x084a('0xe')],_0x3ca72f[_0x084a('0x21')],_0x33d3a6[_0x084a('0x12')],_0x3ca72f['language']);})[_0x084a('0x10')](function(_0x1b56ad){logger[_0x084a('0xb')](util['format'](_0x084a('0x2d'),_0xc451b1['id']));return _0xc451b1[_0x084a('0x2e')]({'sentiment':_0x1b56ad[_0x084a('0x2f')],'sPositive':_0x1b56ad['SentimentScore']['Positive'],'sNegative':_0x1b56ad['SentimentScore'][_0x084a('0x30')],'sMixed':_0x1b56ad[_0x084a('0x31')][_0x084a('0x32')],'sNeutral':_0x1b56ad['SentimentScore'][_0x084a('0x33')]});})[_0x084a('0x10')](function(){logger[_0x084a('0xb')](util[_0x084a('0xc')](_0x084a('0x1d'),_0xc451b1['id']));_0x1bdfb8();});case _0x084a('0x34'):return _0xc451b1[_0x084a('0x2e')]({'transcribeStatus':_0x084a('0x34'),'failureReason':_0xd20527[_0x084a('0x11')][_0x084a('0x35')]})[_0x084a('0x10')](function(){logger[_0x084a('0xb')](util[_0x084a('0xc')](_0x084a('0x1d'),_0xc451b1['id']));_0x1bdfb8();});default:logger[_0x084a('0xb')](util['format'](_0x084a('0x36'),_0xc451b1['id']));break;}}else{return BPromise[_0x084a('0x37')]()[_0x084a('0x10')](function(){if(!_0xc451b1[_0x084a('0x38')]){throw new db[(_0x084a('0x24'))][(_0x084a('0x25'))](_0x084a('0x1e'));}if(!_0x3ca72f[_0x084a('0x1f')]||!_0x3ca72f[_0x084a('0x20')]||!_0x3ca72f['sentimentRegion']||!_0x3ca72f[_0x084a('0x22')]||!_0x3ca72f[_0x084a('0x23')]){throw new db[(_0x084a('0x24'))][(_0x084a('0x25'))](_0x084a('0x39'));}if(!_0xc451b1[_0x084a('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x3ca72f[_0x084a('0x20')]===_0xec90a5['id']){return _0xec90a5;}else{return db[_0x084a('0x27')]['findOne']({'where':{'id':_settings[_0x084a('0x20')]}});}})[_0x084a('0x10')](function(_0x68e0d6){if(!_0x68e0d6){throw new db['Sequelize'][(_0x084a('0x25'))](_0x084a('0x29'));}if(!_0x68e0d6['data1']||!_0x68e0d6[_0x084a('0xe')]){throw new db[(_0x084a('0x24'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x9245b1=_0x68e0d6;logger[_0x084a('0xb')](util[_0x084a('0xc')](_0x084a('0x2c'),_0xc451b1['id']));return sentiment(_0x9245b1[_0x084a('0x2a')],_0x9245b1[_0x084a('0xe')],_0x3ca72f[_0x084a('0x21')],_0xc451b1[_0x084a('0x12')],_0x3ca72f[_0x084a('0x22')]);})[_0x084a('0x10')](function(_0x8b61f5){logger[_0x084a('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xc451b1['id']));return _0xc451b1[_0x084a('0x2e')]({'sentiment':_0x8b61f5[_0x084a('0x2f')],'sPositive':_0x8b61f5[_0x084a('0x31')]['Positive'],'sNegative':_0x8b61f5[_0x084a('0x31')][_0x084a('0x30')],'sMixed':_0x8b61f5[_0x084a('0x31')][_0x084a('0x32')],'sNeutral':_0x8b61f5[_0x084a('0x31')]['Neutral'],'transcribeStatus':_0x084a('0x14')});})['then'](function(){logger[_0x084a('0xb')](util[_0x084a('0xc')](_0x084a('0x1d'),_0xc451b1['id']));_0x1bdfb8();});}})['catch'](function(_0x54463b){if(_0x54463b){if(!_0x54463b[_0x084a('0x3a')]||_0x54463b[_0x084a('0x3a')]!=='SequelizeValidationError'){logger[_0x084a('0x3b')](util[_0x084a('0xc')](_0x084a('0x3c'),_0xc451b1['id']),util[_0x084a('0x3d')](_0x54463b,{'showHidden':![],'depth':null}));}}_0x1bdfb8();});});}function checkTranscribe(){var _0x5cdb2a;var _0x343bfa;var _0x865368;return db[_0x084a('0x3e')][_0x084a('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x084a('0x10')](function(_0x36dd70){if(!_0x36dd70||!_0x36dd70[_0x084a('0x1b')]){throw new db[(_0x084a('0x24'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x5cdb2a=_0x36dd70;return db[_0x084a('0x40')][_0x084a('0x28')]({'where':{'id':0x1}});})[_0x084a('0x10')](function(_0x264f09){if(!_0x264f09){throw new db[(_0x084a('0x24'))][(_0x084a('0x25'))](_0x084a('0x41'));}_0x343bfa=_0x264f09;if(!_0x343bfa[_0x084a('0x42')]||!_0x343bfa[_0x084a('0x43')]||!_0x343bfa[_0x084a('0xf')]||!_0x343bfa[_0x084a('0x22')]||!_0x343bfa[_0x084a('0x23')]){throw new db['Sequelize'][(_0x084a('0x25'))](_0x084a('0x44'));}return db[_0x084a('0x27')][_0x084a('0x28')]({'where':{'id':_0x343bfa[_0x084a('0x43')]}});})[_0x084a('0x10')](function(_0xa5362){if(!_0xa5362){throw new db['Sequelize'][(_0x084a('0x25'))](_0x084a('0x29'));}if(!_0xa5362[_0x084a('0x2a')]||!_0xa5362['data2']){throw new db['Sequelize'][(_0x084a('0x25'))]('Cloud\x20Provider\x20not\x20configured');}_0x865368=_0xa5362;var _0x3a4b12=[];_0x5cdb2a[_0x084a('0x45')](function(_0x490ad9){_0x3a4b12[_0x084a('0x46')](checkTranscribeJob(_0x490ad9,_0x343bfa,_0x865368));});return BPromise['all'](_0x3a4b12);})['catch'](function(_0x420aba){if(_0x420aba){if(!_0x420aba[_0x084a('0x3a')]||_0x420aba[_0x084a('0x3a')]!==_0x084a('0x47')){logger[_0x084a('0x3b')](util[_0x084a('0x3d')](_0x420aba,{'showHidden':![],'depth':null}));}}});}exports[_0x084a('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x85de=['aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','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','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Sentiment','Positive','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','all','error','start','lodash'];(function(_0x57834a,_0xfac574){var _0x5788d9=function(_0x290392){while(--_0x290392){_0x57834a['push'](_0x57834a['shift']());}};_0x5788d9(++_0xfac574);}(_0x85de,0x1f0));var _0xe85d=function(_0x12b6e1,_0x438de5){_0x12b6e1=_0x12b6e1-0x0;var _0x298022=_0x85de[_0x12b6e1];return _0x298022;};var _=require(_0xe85d('0x0'));var AWS=require(_0xe85d('0x1'));var rp=require(_0xe85d('0x2'));var util=require(_0xe85d('0x3'));var BPromise=require(_0xe85d('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xe85d('0x5'))('transcribe');function getTranscriptionJob(_0x4d2fcf,_0x46f08a,_0x2a28a9,_0x514fc9){return new Promise(function(_0x1e9dea,_0xb70e1d){var _0x220e10=new AWS[(_0xe85d('0x6'))]({'accessKeyId':_0x46f08a,'secretAccessKey':_0x4d2fcf,'region':_0x2a28a9});_0x220e10[_0xe85d('0x7')]({'TranscriptionJobName':_0x514fc9},function(_0x888738,_0xc86467){if(_0x888738){return _0xb70e1d(_0x888738);}else{return _0x1e9dea(_0xc86467);}});});}function sentiment(_0x1cd2db,_0x4b6cfb,_0x4128d5,_0x1e4093,_0x4562be){return new Promise(function(_0x6a51f6,_0x1a769e){var _0x574d34=new AWS[(_0xe85d('0x8'))]({'accessKeyId':_0x4b6cfb,'secretAccessKey':_0x1cd2db,'region':_0x4128d5});_0x574d34['detectSentiment']({'Text':_0x1e4093,'LanguageCode':_0x4562be[_0xe85d('0x9')](0x0,0x2)},function(_0x47fb6d,_0x399e91){if(_0x47fb6d){return _0x1a769e(_0x47fb6d);}else{return _0x6a51f6(_0x399e91);}});});}function checkTranscribeJob(_0x548209,_0x3ec59a,_0x1fc972){var _0x10dd73;return new BPromise(function(_0x3544e9,_0x324972){logger[_0xe85d('0xa')](util[_0xe85d('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x548209['id'],_0x548209[_0xe85d('0xc')]));return getTranscriptionJob(_0x1fc972[_0xe85d('0xd')],_0x1fc972['data2'],_0x3ec59a[_0xe85d('0xe')],_0x548209[_0xe85d('0xc')])[_0xe85d('0xf')](function(_0x1e56c5){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x10'),_0x548209['id'],_0x548209[_0xe85d('0xc')],_0x1e56c5[_0xe85d('0x11')]['TranscriptionJobStatus']));if(!_0x548209[_0xe85d('0x12')]){switch(_0x1e56c5['TranscriptionJob'][_0xe85d('0x13')]){case'COMPLETED':var _0x511b92={'transcribeStatus':_0x1e56c5['TranscriptionJob'][_0xe85d('0x13')],'fileUri':_0x1e56c5[_0xe85d('0x11')][_0xe85d('0x14')]['TranscriptFileUri']};logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x15'),_0x548209['id']));return rp({'uri':_0x1e56c5[_0xe85d('0x11')][_0xe85d('0x14')][_0xe85d('0x16')],'json':!![]})[_0xe85d('0xf')](function(_0x2f77d8){logger['info'](util[_0xe85d('0xb')](_0xe85d('0x17'),_0x548209['id']));if(_0x2f77d8&&_0x2f77d8[_0xe85d('0x18')]&&_0x2f77d8[_0xe85d('0x18')][_0xe85d('0x19')]&&_0x2f77d8['results'][_0xe85d('0x19')][_0xe85d('0x1a')]){_0x511b92['fileText']='';for(var _0x44a48c=0x0;_0x44a48c<_0x2f77d8[_0xe85d('0x18')][_0xe85d('0x19')][_0xe85d('0x1a')];_0x44a48c++){_0x511b92[_0xe85d('0x12')]+=_0x2f77d8[_0xe85d('0x18')][_0xe85d('0x19')][_0x44a48c][_0xe85d('0x1b')]+'';}}return _0x548209['update'](_0x511b92);})[_0xe85d('0xf')](function(){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));if(!_0x548209[_0xe85d('0x1d')]){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x20'));}if(!_0x3ec59a['sentiment']||!_0x3ec59a[_0xe85d('0x21')]||!_0x3ec59a[_0xe85d('0x22')]||!_0x3ec59a[_0xe85d('0x23')]||!_0x3ec59a[_0xe85d('0x24')]){throw new db['Sequelize'][(_0xe85d('0x1f'))](_0xe85d('0x25'));}if(!_0x511b92[_0xe85d('0x12')]){throw new Error(_0xe85d('0x26'));}if(_0x3ec59a[_0xe85d('0x21')]===_0x1fc972['id']){return _0x1fc972;}else{return db[_0xe85d('0x27')][_0xe85d('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3d2ffb){if(!_0x3d2ffb){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x29'));}if(!_0x3d2ffb[_0xe85d('0xd')]||!_0x3d2ffb['data2']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x2a'));}_0x10dd73=_0x3d2ffb;logger[_0xe85d('0xa')](util['format'](_0xe85d('0x2b'),_0x548209['id']));return sentiment(_0x10dd73[_0xe85d('0xd')],_0x10dd73[_0xe85d('0x2c')],_0x3ec59a['sentimentRegion'],_0x511b92[_0xe85d('0x12')],_0x3ec59a['language']);})[_0xe85d('0xf')](function(_0x268b19){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x2d'),_0x548209['id']));return _0x548209[_0xe85d('0x2e')]({'sentiment':_0x268b19['Sentiment'],'sPositive':_0x268b19[_0xe85d('0x2f')]['Positive'],'sNegative':_0x268b19[_0xe85d('0x2f')][_0xe85d('0x30')],'sMixed':_0x268b19[_0xe85d('0x2f')]['Mixed'],'sNeutral':_0x268b19[_0xe85d('0x2f')][_0xe85d('0x31')]});})['then'](function(){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));_0x3544e9();});case _0xe85d('0x32'):return _0x548209[_0xe85d('0x2e')]({'transcribeStatus':_0xe85d('0x32'),'failureReason':_0x1e56c5['TranscriptionJob']['FailureReason']})[_0xe85d('0xf')](function(){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));_0x3544e9();});default:logger[_0xe85d('0xa')](util['format'](_0xe85d('0x33'),_0x548209['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x548209['tempSentiment']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3ec59a[_0xe85d('0x34')]||!_0x3ec59a[_0xe85d('0x21')]||!_0x3ec59a[_0xe85d('0x22')]||!_0x3ec59a[_0xe85d('0x23')]||!_0x3ec59a[_0xe85d('0x24')]){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x25'));}if(!_0x548209[_0xe85d('0x12')]){throw new Error(_0xe85d('0x26'));}if(_0x3ec59a['sentimentAccountId']===_0x1fc972['id']){return _0x1fc972;}else{return db[_0xe85d('0x27')][_0xe85d('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xe85d('0xf')](function(_0x2086f8){if(!_0x2086f8){throw new db[(_0xe85d('0x1e'))]['ValidationError'](_0xe85d('0x29'));}if(!_0x2086f8['data1']||!_0x2086f8[_0xe85d('0x2c')]){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x10dd73=_0x2086f8;logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x2b'),_0x548209['id']));return sentiment(_0x10dd73['data1'],_0x10dd73[_0xe85d('0x2c')],_0x3ec59a[_0xe85d('0x22')],_0x548209[_0xe85d('0x12')],_0x3ec59a[_0xe85d('0x23')]);})['then'](function(_0x26400b){logger[_0xe85d('0xa')](util['format'](_0xe85d('0x2d'),_0x548209['id']));return _0x548209['update']({'sentiment':_0x26400b[_0xe85d('0x35')],'sPositive':_0x26400b[_0xe85d('0x2f')][_0xe85d('0x36')],'sNegative':_0x26400b[_0xe85d('0x2f')][_0xe85d('0x30')],'sMixed':_0x26400b[_0xe85d('0x2f')]['Mixed'],'sNeutral':_0x26400b[_0xe85d('0x2f')][_0xe85d('0x31')],'transcribeStatus':'COMPLETED'});})[_0xe85d('0xf')](function(){logger['info'](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));_0x3544e9();});}})[_0xe85d('0x37')](function(_0x2b20a3){if(_0x2b20a3){if(!_0x2b20a3['name']||_0x2b20a3[_0xe85d('0x38')]!==_0xe85d('0x39')){logger['error'](util[_0xe85d('0xb')](_0xe85d('0x3a'),_0x548209['id']),util[_0xe85d('0x3b')](_0x2b20a3,{'showHidden':![],'depth':null}));}}_0x3544e9();});});}function checkTranscribe(){var _0x5a0489;var _0x2637ce;var _0x5e9641;return db[_0xe85d('0x3c')][_0xe85d('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xe85d('0xf')](function(_0x3c9d14){if(!_0x3c9d14||!_0x3c9d14['length']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x5a0489=_0x3c9d14;return db[_0xe85d('0x3e')][_0xe85d('0x28')]({'where':{'id':0x1}});})['then'](function(_0x340790){if(!_0x340790){throw new db[(_0xe85d('0x1e'))]['ValidationError'](_0xe85d('0x3f'));}_0x2637ce=_0x340790;if(!_0x2637ce[_0xe85d('0x40')]||!_0x2637ce[_0xe85d('0x41')]||!_0x2637ce[_0xe85d('0xe')]||!_0x2637ce['language']||!_0x2637ce[_0xe85d('0x24')]){throw new db['Sequelize'][(_0xe85d('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0xe85d('0x27')][_0xe85d('0x28')]({'where':{'id':_0x2637ce[_0xe85d('0x41')]}});})[_0xe85d('0xf')](function(_0x43ead1){if(!_0x43ead1){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x29'));}if(!_0x43ead1[_0xe85d('0xd')]||!_0x43ead1['data2']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x2a'));}_0x5e9641=_0x43ead1;var _0x22e667=[];_0x5a0489[_0xe85d('0x42')](function(_0x4336b7){_0x22e667[_0xe85d('0x43')](checkTranscribeJob(_0x4336b7,_0x2637ce,_0x5e9641));});return BPromise[_0xe85d('0x44')](_0x22e667);})['catch'](function(_0xcfc5b){if(_0xcfc5b){if(!_0xcfc5b['name']||_0xcfc5b[_0xe85d('0x38')]!==_0xe85d('0x39')){logger[_0xe85d('0x45')](util['inspect'](_0xcfc5b,{'showHidden':![],'depth':null}));}}});}exports[_0xe85d('0x46')]=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 e873da4..5d42a87 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 _0x3b64=['catch','error','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b64,0x1bd));var _0x43b6=function(_0x1e4fdf,_0x1982ef){_0x1e4fdf=_0x1e4fdf-0x0;var _0x4e4f8a=_0x3b64[_0x1e4fdf];return _0x4e4f8a;};'use strict';var _=require(_0x43b6('0x0'));var moment=require(_0x43b6('0x1'));var Redis=require(_0x43b6('0x2'));var util=require(_0x43b6('0x3'));var config=require(_0x43b6('0x4'));var db=require(_0x43b6('0x5'))['db'];var logger=require(_0x43b6('0x6'))('schedule');config[_0x43b6('0x7')]=_['defaults'](config[_0x43b6('0x7')],{'host':_0x43b6('0x8'),'port':0x18eb});var io=require(_0x43b6('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1cb041=[];return db['WhatsappInteraction'][_0x43b6('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x43b6('0xb')](0x18,_0x43b6('0xc'))}}})[_0x43b6('0xd')](function(_0x5168cc){if(_0x5168cc&&_0x5168cc[_0x43b6('0xe')]){_0x1cb041=_[_0x43b6('0xf')](_0x5168cc||[],'id');logger[_0x43b6('0x10')](_0x43b6('0x11'),_0x1cb041['join']());return db[_0x43b6('0x12')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x43b6('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1cb041}});}})['then'](function(){if(_0x1cb041&&_0x1cb041[_0x43b6('0xe')]){logger[_0x43b6('0x10')](_0x43b6('0x14'),_0x1cb041[_0x43b6('0x15')]());for(var _0x4a355c=0x0;_0x4a355c<_0x1cb041[_0x43b6('0xe')];_0x4a355c++){io['emit'](_0x43b6('0x16'),{'id':_0x1cb041[_0x4a355c],'closed':!![]});}}})[_0x43b6('0x17')](function(_0x331284){logger[_0x43b6('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x331284?util['inspect'](_0x331284,{'showHidden':![],'depth':null}):'');});}exports[_0x43b6('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x856f=['emit','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../logger','schedule','defaults','localhost','socket.io-emitter','redis','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join'];(function(_0x5c9cfd,_0x3f1807){var _0x3376e6=function(_0x1b47cc){while(--_0x1b47cc){_0x5c9cfd['push'](_0x5c9cfd['shift']());}};_0x3376e6(++_0x3f1807);}(_0x856f,0x1b7));var _0xf856=function(_0x3cf203,_0x404d39){_0x3cf203=_0x3cf203-0x0;var _0x1e5f86=_0x856f[_0x3cf203];return _0x1e5f86;};'use strict';var _=require(_0xf856('0x0'));var moment=require(_0xf856('0x1'));var Redis=require(_0xf856('0x2'));var util=require(_0xf856('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xf856('0x4'))(_0xf856('0x5'));config['redis']=_[_0xf856('0x6')](config['redis'],{'host':_0xf856('0x7'),'port':0x18eb});var io=require(_0xf856('0x8'))(new Redis(config[_0xf856('0x9')]));function closeInteractions(){var _0x1bf4c9=[];return db[_0xf856('0xa')][_0xf856('0xb')]({'raw':!![],'attributes':['id',_0xf856('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf856('0xd')](0x18,_0xf856('0xe'))}}})[_0xf856('0xf')](function(_0x1f143f){if(_0x1f143f&&_0x1f143f[_0xf856('0x10')]){_0x1bf4c9=_['map'](_0x1f143f||[],'id');logger[_0xf856('0x11')](_0xf856('0x12'),_0x1bf4c9['join']());return db[_0xf856('0xa')][_0xf856('0x13')]({'closeReason':_0xf856('0x14'),'disposition':_0xf856('0x15'),'closed':!![],'closedAt':moment()[_0xf856('0x16')](_0xf856('0x17'))},{'where':{'id':_0x1bf4c9}});}})[_0xf856('0xf')](function(){if(_0x1bf4c9&&_0x1bf4c9['length']){logger[_0xf856('0x11')](_0xf856('0x18'),_0x1bf4c9[_0xf856('0x19')]());for(var _0x1c5820=0x0;_0x1c5820<_0x1bf4c9[_0xf856('0x10')];_0x1c5820++){io[_0xf856('0x1a')]('whatsappInteraction:update',{'id':_0x1bf4c9[_0x1c5820],'closed':!![]});}}})['catch'](function(_0xe285fb){logger[_0xf856('0x1b')](_0xf856('0x1c'),_0xe285fb?util[_0xf856('0x1d')](_0xe285fb,{'showHidden':![],'depth':null}):'');});}exports[_0xf856('0x1e')]=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 052607c..dc6f2cf 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94ce=['bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','now','innocenzo.biondo','@xcally.com','CmContact','destroy','then'];(function(_0x2c30c6,_0x163ee4){var _0x3bd18b=function(_0x4f0ae8){while(--_0x4f0ae8){_0x2c30c6['push'](_0x2c30c6['shift']());}};_0x3bd18b(++_0x163ee4);}(_0x94ce,0x1b0));var _0xe94c=function(_0x105ac9,_0x1be596){_0x105ac9=_0x105ac9-0x0;var _0x1104b5=_0x94ce[_0x105ac9];return _0x1104b5;};'use strict';var util=require('util');var db=require(_0xe94c('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe94c('0x1')]({'id':i,'firstName':_0xe94c('0x2')+i,'lastName':_0xe94c('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe94c('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe94c('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe94c('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe94c('0x5')+i+_0xe94c('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe94c('0x4')](),'updatedAt':Date[_0xe94c('0x4')]()});}db[_0xe94c('0x7')][_0xe94c('0x8')]({'where':{}})[_0xe94c('0x9')](function(){return db['CmContact'][_0xe94c('0xa')](contacts);})[_0xe94c('0x9')](function(){console[_0xe94c('0xb')](_0xe94c('0xc'),'contacts1');return db[_0xe94c('0xd')][_0xe94c('0x8')]({'where':{}});})[_0xe94c('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xe94c('0x9')](function(){console[_0xe94c('0xb')](_0xe94c('0xc'),_0xe94c('0xe'));return db[_0xe94c('0x7')][_0xe94c('0xa')](contacts2);})[_0xe94c('0x9')](function(){console['log'](_0xe94c('0xc'),_0xe94c('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})[_0xe94c('0x9')](function(){console[_0xe94c('0xb')](_0xe94c('0xc'),'hopper2');})[_0xe94c('0x10')](function(_0x2d24db){console['log'](_0x2d24db);}); \ No newline at end of file +var _0xf313=['innocenzo.biondo','@xcally.com','now','Innocenzo','then','CmContact','bulkCreate','log','contacts1','CmHopper','hopper1','finished\x20populating','contacts2','hopper2','util','push','Biondo'];(function(_0x386d5d,_0x3deb32){var _0x4be602=function(_0x405599){while(--_0x405599){_0x386d5d['push'](_0x386d5d['shift']());}};_0x4be602(++_0x3deb32);}(_0xf313,0x12f));var _0x3f31=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf313[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x3f31('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3f31('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3f31('0x2')+i,'phone':0xf879fb460+i,'email':_0x3f31('0x3')+i+_0x3f31('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3f31('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3f31('0x5')](),'updatedAt':Date[_0x3f31('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3f31('0x1')]({'id':i,'firstName':_0x3f31('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3f31('0x3')+i+_0x3f31('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x3f31('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x3f31('0x5')]()});}db['CmContact']['destroy']({'where':{}})[_0x3f31('0x7')](function(){return db[_0x3f31('0x8')][_0x3f31('0x9')](contacts);})[_0x3f31('0x7')](function(){console[_0x3f31('0xa')]('finished\x20populating',_0x3f31('0xb'));return db[_0x3f31('0xc')]['destroy']({'where':{}});})[_0x3f31('0x7')](function(){return db['CmHopper'][_0x3f31('0x9')](hopper);})[_0x3f31('0x7')](function(){console[_0x3f31('0xa')]('finished\x20populating',_0x3f31('0xd'));return db[_0x3f31('0x8')][_0x3f31('0x9')](contacts2);})[_0x3f31('0x7')](function(){console[_0x3f31('0xa')](_0x3f31('0xe'),_0x3f31('0xf'));return db[_0x3f31('0xc')]['bulkCreate'](hopper2);})[_0x3f31('0x7')](function(){console[_0x3f31('0xa')]('finished\x20populating',_0x3f31('0x10'));})['catch'](function(_0x296713){console[_0x3f31('0xa')](_0x296713);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index aec3a54..fdd0998 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc417=['%s%s@xcally.com','password','friend','udp','wss','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','add\x20user','catch','log','util','push','format','agent','%s%s'];(function(_0x342b8e,_0xc04e1a){var _0x20d029=function(_0x564d06){while(--_0x564d06){_0x342b8e['push'](_0x342b8e['shift']());}};_0x20d029(++_0xc04e1a);}(_0xc417,0x151));var _0x7c41=function(_0x4eeafb,_0x5d5d61){_0x4eeafb=_0x4eeafb-0x0;var _0x228578=_0xc417[_0x4eeafb];return _0x228578;};'use strict';var util=require(_0x7c41('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7c41('0x1')]({'name':util[_0x7c41('0x2')]('%s%s',_0x7c41('0x3'),i),'fullname':util[_0x7c41('0x2')](_0x7c41('0x4'),_0x7c41('0x3'),i),'email':util['format'](_0x7c41('0x5'),'agent',i),'role':_0x7c41('0x3'),'password':_0x7c41('0x6'),'internal':0xfa0+i,'type':_0x7c41('0x7'),'transport':[_0x7c41('0x8'),'ws',_0x7c41('0x9')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x7c41('0x2')](_0x7c41('0x4'),'agent',i),'encryption':_0x7c41('0xa'),'avpf':_0x7c41('0xa'),'force_avp':_0x7c41('0xa'),'icesupport':_0x7c41('0xa'),'dtlsenable':_0x7c41('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x7c41('0xb'),'dtlssetup':'actpass','callerid':util['format'](_0x7c41('0xc'),util[_0x7c41('0x2')]('%s%s',_0x7c41('0x3'),i),0xfa0+i)});}db['User'][_0x7c41('0xd')](users)[_0x7c41('0xe')](function(){console['log'](_0x7c41('0xf'));})[_0x7c41('0x10')](function(_0xaa7566){console[_0x7c41('0x11')](_0xaa7566);}); \ No newline at end of file +var _0xca77=['%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','format'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xca77,0xe4));var _0x7ca7=function(_0x5a2441,_0x3ccefa){_0x5a2441=_0x5a2441-0x0;var _0x25baf8=_0xca77[_0x5a2441];return _0x25baf8;};'use strict';var util=require(_0x7ca7('0x0'));var db=require(_0x7ca7('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x7ca7('0x2')]('%s%s','agent',i),'fullname':util['format'](_0x7ca7('0x3'),_0x7ca7('0x4'),i),'email':util[_0x7ca7('0x2')](_0x7ca7('0x5'),'agent',i),'role':'agent','password':_0x7ca7('0x6'),'internal':0xfa0+i,'type':_0x7ca7('0x7'),'transport':[_0x7ca7('0x8'),'ws','wss'],'disallow':[_0x7ca7('0x9')],'allow':[_0x7ca7('0xa')],'defaultuser':util['format'](_0x7ca7('0x3'),_0x7ca7('0x4'),i),'encryption':_0x7ca7('0xb'),'avpf':_0x7ca7('0xb'),'force_avp':_0x7ca7('0xb'),'icesupport':'yes','dtlsenable':_0x7ca7('0xb'),'dtlsverify':'no','dtlscertfile':_0x7ca7('0xc'),'dtlsprivatekey':_0x7ca7('0xd'),'dtlssetup':_0x7ca7('0xe'),'callerid':util[_0x7ca7('0x2')](_0x7ca7('0xf'),util[_0x7ca7('0x2')](_0x7ca7('0x3'),_0x7ca7('0x4'),i),0xfa0+i)});}db[_0x7ca7('0x10')][_0x7ca7('0x11')](users)['then'](function(){console[_0x7ca7('0x12')](_0x7ca7('0x13'));})[_0x7ca7('0x14')](function(_0x1696a6){console[_0x7ca7('0x12')](_0x1696a6);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 94bf4ab..37ed2fe 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ef7=['length','user:%s','handshake','query','find','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','hasOwnProperty','include','push','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','VoiceQueues','userProfileId','VoiceQueue','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','mail','telephone:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','map','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','role','agent','type','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','User','telephone','Campaign','where','format','%s:queue:%s'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x3ef7,0xa2));var _0x73ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var BPromise=require(_0x73ef('0x1'));var db=require(_0x73ef('0x2'))['db'];var config=require(_0x73ef('0x3'));var queryQueues={'attributes':['id',_0x73ef('0x4')],'include':[{'as':_0x73ef('0x5'),'model':db['User'],'attributes':['id',_0x73ef('0x4'),_0x73ef('0x6')],'raw':!![],'where':{'role':_0x73ef('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x73ef('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x73ef('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x73ef('0x4')],'where':{'role':_0x73ef('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x73ef('0x4'),_0x73ef('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2b60fd,_0x8ee23,_0x50098a){return db[_0x73ef('0x9')][_0x73ef('0xa')]({'where':{'name':_0x2b60fd,'userProfileId':_0x8ee23},'raw':!![]})[_0x73ef('0xb')](function(_0x3bd4c9){if(_0x3bd4c9){if(_0x3bd4c9[_0x73ef('0xc')]){switch(_0x2b60fd){case'VoiceQueues':case _0x73ef('0xd'):case _0x73ef('0xe'):case _0x73ef('0xf'):case _0x73ef('0x10'):case _0x73ef('0x11'):case _0x73ef('0x12'):return db[_0x50098a][_0x73ef('0x13')](queryQueues);case _0x73ef('0x14'):return db[_0x50098a][_0x73ef('0x13')](queryTelephones);case _0x73ef('0x15'):return db[_0x50098a][_0x73ef('0x13')](queryTrunks);case _0x73ef('0x16'):return db[_0x50098a][_0x73ef('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0x73ef('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x3bd4c9['id']},'raw':!![]})[_0x73ef('0xb')](function(_0x2faa63){if(_0x2faa63){var _0x3c0c3b={'where':{'id':_['map'](_0x2faa63,_0x73ef('0x17'))},'raw':!![]};switch(_0x50098a){case _0x73ef('0x18'):_0x3c0c3b['where'][_0x73ef('0x6')]=_0x73ef('0x19');break;case _0x73ef('0x1a'):_0x3c0c3b[_0x73ef('0x1b')][_0x73ef('0x8')]='ivr';break;}return db[_0x50098a][_0x73ef('0x13')](_0x3c0c3b);}else{return[];}});}}else{return[];}})['then'](function(_0x8d6fe5){return _0x8d6fe5;});}function joinOrLeaveQueues(_0x4d1a9a,_0x1ba9cb,_0x2168ec,_0x36d02f){_0x4d1a9a[_0x1ba9cb](util[_0x73ef('0x1c')](_0x73ef('0x1d'),_0x2168ec,_0x36d02f[_0x73ef('0x4')]));if(_0x36d02f[_0x73ef('0x5')]){for(var _0x1d5e1f=0x0;_0x1d5e1f<_0x36d02f['Agents'][_0x73ef('0x1e')];_0x1d5e1f+=0x1){_0x4d1a9a[_0x1ba9cb](util[_0x73ef('0x1c')](_0x73ef('0x1f'),_0x36d02f[_0x73ef('0x5')][_0x1d5e1f]['name']));}}}function joinOrLeave(_0xc3ba9d,_0x28406c,_0x40907a){var _0x1519f9;if(_0xc3ba9d[_0x73ef('0x20')][_0x73ef('0x21')]['id']){db[_0x73ef('0x18')][_0x73ef('0x22')]({'attributes':['id',_0x73ef('0x4'),_0x73ef('0x6'),'userProfileId'],'where':{'id':_0xc3ba9d[_0x73ef('0x20')][_0x73ef('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x73ef('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x73ef('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x73ef('0x25')],'as':_0x73ef('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x73ef('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x73ef('0x28')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x73ef('0xb')](function(_0x517e70){if(_0x517e70){_0x1519f9=_0x517e70;_0xc3ba9d[_0x28406c](util[_0x73ef('0x1c')](_0x73ef('0x1f'),_0x517e70[_0x73ef('0x4')]));var _0xa3f75b=[];switch(_0x517e70[_0x73ef('0x6')]){case _0x73ef('0x29'):_0xc3ba9d[_0x28406c](_0x73ef('0x2a'));_0xc3ba9d[_0x28406c]('voice:outbound');if(queryQueues[_0x73ef('0x2b')](_0x73ef('0x2c'))){delete queryQueues[_0x73ef('0x2c')];}_0xa3f75b['push'](db['VoiceQueue'][_0x73ef('0x13')](queryQueues));_0xa3f75b[_0x73ef('0x2d')](db['ChatQueue'][_0x73ef('0x13')](queryQueues));_0xa3f75b['push'](db[_0x73ef('0x2e')][_0x73ef('0x13')](queryQueues));_0xa3f75b[_0x73ef('0x2d')](db['SmsQueue'][_0x73ef('0x13')](queryQueues));_0xa3f75b[_0x73ef('0x2d')](db['MailQueue'][_0x73ef('0x13')](queryQueues));_0xa3f75b[_0x73ef('0x2d')](db[_0x73ef('0x2f')]['findAll'](queryQueues));_0xa3f75b[_0x73ef('0x2d')](db[_0x73ef('0x30')][_0x73ef('0x13')](queryQueues));_0xa3f75b['push'](db[_0x73ef('0x18')][_0x73ef('0x13')](queryTelephones));_0xa3f75b[_0x73ef('0x2d')](db[_0x73ef('0x31')][_0x73ef('0x13')](queryTrunks));_0xa3f75b[_0x73ef('0x2d')](db[_0x73ef('0x1a')][_0x73ef('0x13')](queryCampaigns));_0xa3f75b[_0x73ef('0x2d')](db[_0x73ef('0x18')]['findAll'](queryAgents));break;case _0x73ef('0x32'):_0xc3ba9d[_0x28406c](_0x73ef('0x2a'));_0xc3ba9d[_0x28406c](_0x73ef('0x33'));_0xa3f75b['push'](getAssociatedResources(_0x73ef('0x34'),_0x517e70[_0x73ef('0x35')],_0x73ef('0x36')));_0xa3f75b[_0x73ef('0x2d')](getAssociatedResources(_0x73ef('0xd'),_0x517e70['userProfileId'],'ChatQueue'));_0xa3f75b['push'](getAssociatedResources(_0x73ef('0xe'),_0x517e70[_0x73ef('0x35')],'FaxQueue'));_0xa3f75b[_0x73ef('0x2d')](getAssociatedResources(_0x73ef('0xf'),_0x517e70[_0x73ef('0x35')],'SmsQueue'));_0xa3f75b[_0x73ef('0x2d')](getAssociatedResources(_0x73ef('0x10'),_0x517e70[_0x73ef('0x35')],_0x73ef('0x37')));_0xa3f75b['push'](getAssociatedResources(_0x73ef('0x11'),_0x517e70[_0x73ef('0x35')],_0x73ef('0x2f')));_0xa3f75b[_0x73ef('0x2d')](getAssociatedResources(_0x73ef('0x12'),_0x517e70[_0x73ef('0x35')],_0x73ef('0x30')));_0xa3f75b[_0x73ef('0x2d')](getAssociatedResources(_0x73ef('0x14'),_0x517e70['userProfileId'],'User'));_0xa3f75b[_0x73ef('0x2d')](getAssociatedResources(_0x73ef('0x15'),_0x517e70['userProfileId'],'Trunk'));_0xa3f75b[_0x73ef('0x2d')](getAssociatedResources(_0x73ef('0x16'),_0x517e70['userProfileId'],'Campaign'));_0xa3f75b['push'](db['User'][_0x73ef('0x13')](queryAgents));break;case _0x73ef('0x7'):_0xc3ba9d[_0x28406c](_0x73ef('0x2a'));_0xc3ba9d[_0x28406c](_0x73ef('0x33'));_0xa3f75b[_0x73ef('0x2d')](_0x517e70[_0x73ef('0x38')]({'attributes':['id',_0x73ef('0x4')]}));_0xa3f75b['push'](_0x517e70[_0x73ef('0x39')]({'attributes':['id',_0x73ef('0x4')]}));_0xa3f75b['push'](_0x517e70[_0x73ef('0x3a')]({'attributes':['id','name']}));_0xa3f75b[_0x73ef('0x2d')](_0x517e70['getSmsQueues']({'attributes':['id','name']}));_0xa3f75b[_0x73ef('0x2d')](_0x517e70[_0x73ef('0x3b')]({'attributes':['id','name']}));_0xa3f75b[_0x73ef('0x2d')](_0x517e70[_0x73ef('0x3c')]({'attributes':['id',_0x73ef('0x4')]}));_0xa3f75b['push'](_0x517e70[_0x73ef('0x3d')]({'attributes':['id',_0x73ef('0x4')]}));break;}return BPromise['all'](_0xa3f75b);}})[_0x73ef('0xb')](function(_0x55219d){if(_0x55219d&&_0x55219d[_0x73ef('0x1e')]){for(var _0x3c1334=0x0;_0x3c1334<_0x55219d[_0x73ef('0x1e')];_0x3c1334+=0x1){for(var _0x3006b7=0x0;_0x3006b7<_0x55219d[_0x3c1334][_0x73ef('0x1e')];_0x3006b7+=0x1){switch(_0x3c1334){case 0x0:joinOrLeaveQueues(_0xc3ba9d,_0x28406c,_0x73ef('0x3e'),_0x55219d[_0x3c1334][_0x3006b7]);break;case 0x1:joinOrLeaveQueues(_0xc3ba9d,_0x28406c,'chat',_0x55219d[_0x3c1334][_0x3006b7]);break;case 0x2:joinOrLeaveQueues(_0xc3ba9d,_0x28406c,'fax',_0x55219d[_0x3c1334][_0x3006b7]);break;case 0x3:joinOrLeaveQueues(_0xc3ba9d,_0x28406c,'sms',_0x55219d[_0x3c1334][_0x3006b7]);break;case 0x4:joinOrLeaveQueues(_0xc3ba9d,_0x28406c,_0x73ef('0x3f'),_0x55219d[_0x3c1334][_0x3006b7]);break;case 0x5:joinOrLeaveQueues(_0xc3ba9d,_0x28406c,'openchannel',_0x55219d[_0x3c1334][_0x3006b7]);break;case 0x6:joinOrLeaveQueues(_0xc3ba9d,_0x28406c,'whatsapp',_0x55219d[_0x3c1334][_0x3006b7]);break;case 0x7:if(_0x1519f9[_0x73ef('0x6')]!==_0x73ef('0x7'))_0xc3ba9d[_0x28406c](util[_0x73ef('0x1c')](_0x73ef('0x40'),_0x55219d[_0x3c1334][_0x3006b7]['name']));break;case 0x8:if(_0x1519f9[_0x73ef('0x6')]!==_0x73ef('0x7'))_0xc3ba9d[_0x28406c](util[_0x73ef('0x1c')]('trunk:%s',_0x55219d[_0x3c1334][_0x3006b7][_0x73ef('0x4')]));break;case 0x9:if(_0x1519f9[_0x73ef('0x6')]!==_0x73ef('0x7'))_0xc3ba9d[_0x28406c](util['format'](_0x73ef('0x41'),_0x55219d[_0x3c1334][_0x3006b7][_0x73ef('0x8')],_0x55219d[_0x3c1334][_0x3006b7][_0x73ef('0x4')]));break;case 0xa:_0xc3ba9d[_0x28406c](util['format'](_0x73ef('0x1f'),_0x55219d[_0x3c1334][_0x3006b7][_0x73ef('0x4')]));break;}}}}})['then'](function(){if(_0x28406c===_0x73ef('0x42')){var _0x2ff899=_['map'](_0x1519f9[_0x73ef('0x43')],'id');return _0x1519f9[_0x73ef('0x44')](_0x2ff899)['then'](function(){for(var _0x31a65e=0x0;_0x31a65e<_0x2ff899['length'];_0x31a65e+=0x1){_0x40907a[_0x73ef('0x45')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2ff899[_0x31a65e]),'UserId':Number(_0x1519f9['id'])});}});}})[_0x73ef('0xb')](function(){if(_0x28406c==='leave'){var _0x261fcc=_[_0x73ef('0x46')](_0x1519f9[_0x73ef('0x47')],'id');return _0x1519f9['removeMailInteractions'](_0x261fcc)[_0x73ef('0xb')](function(){for(var _0x37365e=0x0;_0x37365e<_0x261fcc[_0x73ef('0x1e')];_0x37365e+=0x1){_0x40907a[_0x73ef('0x45')](_0x73ef('0x48'),{'MailInteractionId':Number(_0x261fcc[_0x37365e]),'UserId':Number(_0x1519f9['id'])});}});}})[_0x73ef('0xb')](function(){if(_0x28406c==='leave'){var _0x155abe=_['map'](_0x1519f9[_0x73ef('0x24')],'id');return _0x1519f9[_0x73ef('0x49')](_0x155abe)['then'](function(){for(var _0x533702=0x0;_0x533702<_0x155abe['length'];_0x533702+=0x1){_0x40907a[_0x73ef('0x45')](_0x73ef('0x4a'),{'FaxInteractionId':Number(_0x155abe[_0x533702]),'UserId':Number(_0x1519f9['id'])});}});}})[_0x73ef('0xb')](function(){if(_0x28406c===_0x73ef('0x42')){var _0x38aaa7=_[_0x73ef('0x46')](_0x1519f9[_0x73ef('0x26')],'id');return _0x1519f9[_0x73ef('0x4b')](_0x38aaa7)[_0x73ef('0xb')](function(){for(var _0x3d5968=0x0;_0x3d5968<_0x38aaa7[_0x73ef('0x1e')];_0x3d5968+=0x1){_0x40907a[_0x73ef('0x45')](_0x73ef('0x4c'),{'SmsInteractionId':Number(_0x38aaa7[_0x3d5968]),'UserId':Number(_0x1519f9['id'])});}});}})[_0x73ef('0xb')](function(){if(_0x28406c===_0x73ef('0x42')){var _0x190044=_['map'](_0x1519f9['OpenchannelInteractions'],'id');return _0x1519f9[_0x73ef('0x4d')](_0x190044)[_0x73ef('0xb')](function(){for(var _0x41298e=0x0;_0x41298e<_0x190044['length'];_0x41298e+=0x1){_0x40907a[_0x73ef('0x45')](_0x73ef('0x4e'),{'OpenchannelInteractionId':Number(_0x190044[_0x41298e]),'UserId':Number(_0x1519f9['id'])});}});}})['then'](function(){if(_0x28406c===_0x73ef('0x42')){var _0x5dddd5=_[_0x73ef('0x46')](_0x1519f9[_0x73ef('0x4f')],'id');return _0x1519f9[_0x73ef('0x50')](_0x5dddd5)[_0x73ef('0xb')](function(){for(var _0x92497e=0x0;_0x92497e<_0x5dddd5[_0x73ef('0x1e')];_0x92497e+=0x1){_0x40907a[_0x73ef('0x45')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x5dddd5[_0x92497e]),'UserId':Number(_0x1519f9['id'])});}});}})[_0x73ef('0x51')](function(_0x3c61d3){_0xc3ba9d[_0x73ef('0x52')](_0x3c61d3);});}}function onDisconnect(_0x33dca3,_0x239a56){joinOrLeave(_0x33dca3,_0x73ef('0x42'),_0x239a56);}function onConnect(_0xf5f512){joinOrLeave(_0xf5f512,_0x73ef('0x53'));}exports[_0x73ef('0x54')]=function(_0x237073){_0x237073['on'](_0x73ef('0x55'),function(_0x316743){_0x316743['setMaxListeners'](0x0);_0x316743[_0x73ef('0x56')]=_0x316743[_0x73ef('0x57')][_0x73ef('0x55')][_0x73ef('0x58')]+':'+_0x316743['request']['connection'][_0x73ef('0x59')];_0x316743[_0x73ef('0x5a')]=new Date();_0x316743['log']=function(_0x20c182){console['log'](_0x73ef('0x5b')+_0x316743[_0x73ef('0x5c')][_0x73ef('0x4')]+'['+_0x316743[_0x73ef('0x56')]+']',_0x20c182);};_0x316743['on'](_0x73ef('0x5d'),function(){onDisconnect(_0x316743,_0x237073);_0x316743[_0x73ef('0x52')](_0x73ef('0x5e'));});onConnect(_0x316743);_0x316743['log'](_0x73ef('0x5f'));});}; \ No newline at end of file +var _0x014c=['find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','VoiceQueue','ChatQueue','push','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:outbound','VoiceQueues','FaxQueues','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','name','role','agent','telephone','type','findOne','then','autoAssociation','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','ivr','format','%s:queue:%s','Agents','length','user:%s','handshake','query','User'];(function(_0xd52a72,_0x4825cf){var _0x5706cb=function(_0x4a323c){while(--_0x4a323c){_0xd52a72['push'](_0xd52a72['shift']());}};_0x5706cb(++_0x4825cf);}(_0x014c,0x17b));var _0xc014=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x014c[_0x3dc538];return _0x72c2fd;};'use strict';var _=require('lodash');var util=require(_0xc014('0x0'));var BPromise=require('bluebird');var db=require(_0xc014('0x1'))['db'];var config=require(_0xc014('0x2'));var queryQueues={'attributes':['id',_0xc014('0x3')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xc014('0x3'),_0xc014('0x4')],'raw':!![],'where':{'role':_0xc014('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc014('0x3')],'where':{'role':_0xc014('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xc014('0x3')],'where':{'role':_0xc014('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xc014('0x7')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3b2fe9,_0x392707,_0x5701db){return db['UserProfileSection'][_0xc014('0x8')]({'where':{'name':_0x3b2fe9,'userProfileId':_0x392707},'raw':!![]})[_0xc014('0x9')](function(_0x88e8ea){if(_0x88e8ea){if(_0x88e8ea[_0xc014('0xa')]){switch(_0x3b2fe9){case'VoiceQueues':case _0xc014('0xb'):case'FaxQueues':case _0xc014('0xc'):case'MailQueues':case _0xc014('0xd'):case _0xc014('0xe'):return db[_0x5701db][_0xc014('0xf')](queryQueues);case _0xc014('0x10'):return db[_0x5701db]['findAll'](queryTelephones);case _0xc014('0x11'):return db[_0x5701db][_0xc014('0xf')](queryTrunks);case _0xc014('0x12'):return db[_0x5701db]['findAll'](queryCampaigns);}}else{return db[_0xc014('0x13')]['findAll']({'attributes':[_0xc014('0x14')],'where':{'sectionId':_0x88e8ea['id']},'raw':!![]})[_0xc014('0x9')](function(_0x25fdf6){if(_0x25fdf6){var _0x26f264={'where':{'id':_[_0xc014('0x15')](_0x25fdf6,_0xc014('0x14'))},'raw':!![]};switch(_0x5701db){case'User':_0x26f264[_0xc014('0x16')][_0xc014('0x4')]=_0xc014('0x6');break;case _0xc014('0x17'):_0x26f264['where']['type']=_0xc014('0x18');break;}return db[_0x5701db]['findAll'](_0x26f264);}else{return[];}});}}else{return[];}})['then'](function(_0x2261b0){return _0x2261b0;});}function joinOrLeaveQueues(_0x4287fe,_0x4a3823,_0x9442cc,_0x3954a6){_0x4287fe[_0x4a3823](util[_0xc014('0x19')](_0xc014('0x1a'),_0x9442cc,_0x3954a6[_0xc014('0x3')]));if(_0x3954a6['Agents']){for(var _0xc8b0fb=0x0;_0xc8b0fb<_0x3954a6[_0xc014('0x1b')][_0xc014('0x1c')];_0xc8b0fb+=0x1){_0x4287fe[_0x4a3823](util[_0xc014('0x19')](_0xc014('0x1d'),_0x3954a6[_0xc014('0x1b')][_0xc8b0fb][_0xc014('0x3')]));}}}function joinOrLeave(_0x478ee1,_0x1089c6,_0x1b905d){var _0x16d8f9;if(_0x478ee1[_0xc014('0x1e')][_0xc014('0x1f')]['id']){db[_0xc014('0x20')][_0xc014('0x21')]({'attributes':['id',_0xc014('0x3'),_0xc014('0x4'),_0xc014('0x22')],'where':{'id':_0x478ee1['handshake'][_0xc014('0x1f')]['id']},'include':[{'model':db[_0xc014('0x23')],'as':_0xc014('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xc014('0x25')],'as':_0xc014('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xc014('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xc014('0x28')],'as':_0xc014('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xc014('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc014('0x2b')],'as':_0xc014('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xc014('0x9')](function(_0x30e97a){if(_0x30e97a){_0x16d8f9=_0x30e97a;_0x478ee1[_0x1089c6](util[_0xc014('0x19')](_0xc014('0x1d'),_0x30e97a[_0xc014('0x3')]));var _0x6d69b=[];switch(_0x30e97a[_0xc014('0x4')]){case _0xc014('0x2d'):_0x478ee1[_0x1089c6](_0xc014('0x2e'));_0x478ee1[_0x1089c6]('voice:outbound');if(queryQueues[_0xc014('0x2f')]('include')){delete queryQueues['include'];}_0x6d69b['push'](db[_0xc014('0x30')][_0xc014('0xf')](queryQueues));_0x6d69b['push'](db[_0xc014('0x31')][_0xc014('0xf')](queryQueues));_0x6d69b[_0xc014('0x32')](db[_0xc014('0x33')][_0xc014('0xf')](queryQueues));_0x6d69b[_0xc014('0x32')](db[_0xc014('0x34')][_0xc014('0xf')](queryQueues));_0x6d69b[_0xc014('0x32')](db[_0xc014('0x35')][_0xc014('0xf')](queryQueues));_0x6d69b[_0xc014('0x32')](db['OpenchannelQueue'][_0xc014('0xf')](queryQueues));_0x6d69b['push'](db[_0xc014('0x36')][_0xc014('0xf')](queryQueues));_0x6d69b[_0xc014('0x32')](db[_0xc014('0x20')][_0xc014('0xf')](queryTelephones));_0x6d69b[_0xc014('0x32')](db[_0xc014('0x37')]['findAll'](queryTrunks));_0x6d69b[_0xc014('0x32')](db['Campaign'][_0xc014('0xf')](queryCampaigns));_0x6d69b[_0xc014('0x32')](db[_0xc014('0x20')][_0xc014('0xf')](queryAgents));break;case _0xc014('0x38'):_0x478ee1[_0x1089c6](_0xc014('0x2e'));_0x478ee1[_0x1089c6](_0xc014('0x39'));_0x6d69b['push'](getAssociatedResources(_0xc014('0x3a'),_0x30e97a[_0xc014('0x22')],_0xc014('0x30')));_0x6d69b['push'](getAssociatedResources(_0xc014('0xb'),_0x30e97a[_0xc014('0x22')],_0xc014('0x31')));_0x6d69b['push'](getAssociatedResources(_0xc014('0x3b'),_0x30e97a['userProfileId'],_0xc014('0x33')));_0x6d69b[_0xc014('0x32')](getAssociatedResources(_0xc014('0xc'),_0x30e97a[_0xc014('0x22')],_0xc014('0x34')));_0x6d69b[_0xc014('0x32')](getAssociatedResources(_0xc014('0x3c'),_0x30e97a[_0xc014('0x22')],_0xc014('0x35')));_0x6d69b[_0xc014('0x32')](getAssociatedResources(_0xc014('0xd'),_0x30e97a[_0xc014('0x22')],'OpenchannelQueue'));_0x6d69b[_0xc014('0x32')](getAssociatedResources(_0xc014('0xe'),_0x30e97a[_0xc014('0x22')],_0xc014('0x36')));_0x6d69b['push'](getAssociatedResources(_0xc014('0x10'),_0x30e97a['userProfileId'],_0xc014('0x20')));_0x6d69b[_0xc014('0x32')](getAssociatedResources(_0xc014('0x11'),_0x30e97a[_0xc014('0x22')],_0xc014('0x37')));_0x6d69b[_0xc014('0x32')](getAssociatedResources(_0xc014('0x12'),_0x30e97a[_0xc014('0x22')],_0xc014('0x17')));_0x6d69b[_0xc014('0x32')](db[_0xc014('0x20')]['findAll'](queryAgents));break;case _0xc014('0x5'):_0x478ee1[_0x1089c6]('voice:inbound');_0x478ee1[_0x1089c6]('voice:outbound');_0x6d69b[_0xc014('0x32')](_0x30e97a[_0xc014('0x3d')]({'attributes':['id',_0xc014('0x3')]}));_0x6d69b[_0xc014('0x32')](_0x30e97a[_0xc014('0x3e')]({'attributes':['id','name']}));_0x6d69b[_0xc014('0x32')](_0x30e97a[_0xc014('0x3f')]({'attributes':['id','name']}));_0x6d69b[_0xc014('0x32')](_0x30e97a[_0xc014('0x40')]({'attributes':['id',_0xc014('0x3')]}));_0x6d69b[_0xc014('0x32')](_0x30e97a[_0xc014('0x41')]({'attributes':['id',_0xc014('0x3')]}));_0x6d69b[_0xc014('0x32')](_0x30e97a[_0xc014('0x42')]({'attributes':['id',_0xc014('0x3')]}));_0x6d69b['push'](_0x30e97a[_0xc014('0x43')]({'attributes':['id',_0xc014('0x3')]}));break;}return BPromise[_0xc014('0x44')](_0x6d69b);}})[_0xc014('0x9')](function(_0x2c96b7){if(_0x2c96b7&&_0x2c96b7[_0xc014('0x1c')]){for(var _0x1e29e9=0x0;_0x1e29e9<_0x2c96b7[_0xc014('0x1c')];_0x1e29e9+=0x1){for(var _0x1b1e4c=0x0;_0x1b1e4c<_0x2c96b7[_0x1e29e9]['length'];_0x1b1e4c+=0x1){switch(_0x1e29e9){case 0x0:joinOrLeaveQueues(_0x478ee1,_0x1089c6,_0xc014('0x45'),_0x2c96b7[_0x1e29e9][_0x1b1e4c]);break;case 0x1:joinOrLeaveQueues(_0x478ee1,_0x1089c6,'chat',_0x2c96b7[_0x1e29e9][_0x1b1e4c]);break;case 0x2:joinOrLeaveQueues(_0x478ee1,_0x1089c6,'fax',_0x2c96b7[_0x1e29e9][_0x1b1e4c]);break;case 0x3:joinOrLeaveQueues(_0x478ee1,_0x1089c6,_0xc014('0x46'),_0x2c96b7[_0x1e29e9][_0x1b1e4c]);break;case 0x4:joinOrLeaveQueues(_0x478ee1,_0x1089c6,'mail',_0x2c96b7[_0x1e29e9][_0x1b1e4c]);break;case 0x5:joinOrLeaveQueues(_0x478ee1,_0x1089c6,_0xc014('0x47'),_0x2c96b7[_0x1e29e9][_0x1b1e4c]);break;case 0x6:joinOrLeaveQueues(_0x478ee1,_0x1089c6,_0xc014('0x48'),_0x2c96b7[_0x1e29e9][_0x1b1e4c]);break;case 0x7:if(_0x16d8f9['role']!==_0xc014('0x5'))_0x478ee1[_0x1089c6](util[_0xc014('0x19')](_0xc014('0x49'),_0x2c96b7[_0x1e29e9][_0x1b1e4c][_0xc014('0x3')]));break;case 0x8:if(_0x16d8f9[_0xc014('0x4')]!==_0xc014('0x5'))_0x478ee1[_0x1089c6](util['format'](_0xc014('0x4a'),_0x2c96b7[_0x1e29e9][_0x1b1e4c][_0xc014('0x3')]));break;case 0x9:if(_0x16d8f9[_0xc014('0x4')]!==_0xc014('0x5'))_0x478ee1[_0x1089c6](util[_0xc014('0x19')](_0xc014('0x4b'),_0x2c96b7[_0x1e29e9][_0x1b1e4c][_0xc014('0x7')],_0x2c96b7[_0x1e29e9][_0x1b1e4c][_0xc014('0x3')]));break;case 0xa:_0x478ee1[_0x1089c6](util[_0xc014('0x19')](_0xc014('0x1d'),_0x2c96b7[_0x1e29e9][_0x1b1e4c]['name']));break;}}}}})[_0xc014('0x9')](function(){if(_0x1089c6===_0xc014('0x4c')){var _0x2b60f8=_[_0xc014('0x15')](_0x16d8f9['ChatInteractions'],'id');return _0x16d8f9[_0xc014('0x4d')](_0x2b60f8)[_0xc014('0x9')](function(){for(var _0x32a107=0x0;_0x32a107<_0x2b60f8[_0xc014('0x1c')];_0x32a107+=0x1){_0x1b905d[_0xc014('0x4e')](_0xc014('0x4f'),{'ChatInteractionId':Number(_0x2b60f8[_0x32a107]),'UserId':Number(_0x16d8f9['id'])});}});}})[_0xc014('0x9')](function(){if(_0x1089c6===_0xc014('0x4c')){var _0x21ca85=_[_0xc014('0x15')](_0x16d8f9[_0xc014('0x26')],'id');return _0x16d8f9[_0xc014('0x50')](_0x21ca85)[_0xc014('0x9')](function(){for(var _0xc58284=0x0;_0xc58284<_0x21ca85[_0xc014('0x1c')];_0xc58284+=0x1){_0x1b905d[_0xc014('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x21ca85[_0xc58284]),'UserId':Number(_0x16d8f9['id'])});}});}})[_0xc014('0x9')](function(){if(_0x1089c6==='leave'){var _0x1a97a4=_[_0xc014('0x15')](_0x16d8f9['FaxInteractions'],'id');return _0x16d8f9[_0xc014('0x51')](_0x1a97a4)[_0xc014('0x9')](function(){for(var _0x4a3cd8=0x0;_0x4a3cd8<_0x1a97a4['length'];_0x4a3cd8+=0x1){_0x1b905d[_0xc014('0x4e')](_0xc014('0x52'),{'FaxInteractionId':Number(_0x1a97a4[_0x4a3cd8]),'UserId':Number(_0x16d8f9['id'])});}});}})['then'](function(){if(_0x1089c6===_0xc014('0x4c')){var _0x531d2c=_[_0xc014('0x15')](_0x16d8f9[_0xc014('0x29')],'id');return _0x16d8f9[_0xc014('0x53')](_0x531d2c)['then'](function(){for(var _0x3293d1=0x0;_0x3293d1<_0x531d2c['length'];_0x3293d1+=0x1){_0x1b905d[_0xc014('0x4e')](_0xc014('0x54'),{'SmsInteractionId':Number(_0x531d2c[_0x3293d1]),'UserId':Number(_0x16d8f9['id'])});}});}})['then'](function(){if(_0x1089c6==='leave'){var _0x3dbfb=_[_0xc014('0x15')](_0x16d8f9['OpenchannelInteractions'],'id');return _0x16d8f9[_0xc014('0x55')](_0x3dbfb)['then'](function(){for(var _0x51e481=0x0;_0x51e481<_0x3dbfb[_0xc014('0x1c')];_0x51e481+=0x1){_0x1b905d[_0xc014('0x4e')](_0xc014('0x56'),{'OpenchannelInteractionId':Number(_0x3dbfb[_0x51e481]),'UserId':Number(_0x16d8f9['id'])});}});}})[_0xc014('0x9')](function(){if(_0x1089c6==='leave'){var _0x47fe6d=_[_0xc014('0x15')](_0x16d8f9[_0xc014('0x2c')],'id');return _0x16d8f9[_0xc014('0x57')](_0x47fe6d)[_0xc014('0x9')](function(){for(var _0x277a63=0x0;_0x277a63<_0x47fe6d[_0xc014('0x1c')];_0x277a63+=0x1){_0x1b905d[_0xc014('0x4e')](_0xc014('0x58'),{'WhatsappInteractionId':Number(_0x47fe6d[_0x277a63]),'UserId':Number(_0x16d8f9['id'])});}});}})[_0xc014('0x59')](function(_0x33ccec){_0x478ee1[_0xc014('0x5a')](_0x33ccec);});}}function onDisconnect(_0x39917b,_0x2709b2){joinOrLeave(_0x39917b,'leave',_0x2709b2);}function onConnect(_0x208c7a){joinOrLeave(_0x208c7a,'join');}exports[_0xc014('0x5b')]=function(_0x45975f){_0x45975f['on'](_0xc014('0x5c'),function(_0x1044b0){_0x1044b0[_0xc014('0x5d')](0x0);_0x1044b0[_0xc014('0x5e')]=_0x1044b0[_0xc014('0x5f')]['connection'][_0xc014('0x60')]+':'+_0x1044b0[_0xc014('0x5f')][_0xc014('0x5c')]['remotePort'];_0x1044b0[_0xc014('0x61')]=new Date();_0x1044b0[_0xc014('0x5a')]=function(_0x19f5c1){console[_0xc014('0x5a')](_0xc014('0x62')+_0x1044b0[_0xc014('0x63')][_0xc014('0x3')]+'['+_0x1044b0[_0xc014('0x5e')]+']',_0x19f5c1);};_0x1044b0['on'](_0xc014('0x64'),function(){onDisconnect(_0x1044b0,_0x45975f);_0x1044b0['log'](_0xc014('0x65'));});onConnect(_0x1044b0);_0x1044b0[_0xc014('0x5a')](_0xc014('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 88a1fbb..d6db056 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 _0xa3c3=['closed','substatus','User','fullname','format','SIP/%s','agent','default','length','hasOwnProperty','condition','../../mysqldb','jayson/promise','../logger','triggers','lodash','client','http','Chat','afterCreate','newinteraction','ChatInteraction','closedinteraction','Sms','SmsInteraction','afterUpdate','newmessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','channel','motionChannel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','find','name','email','internal','interface','incomingmessage','outgoingmessage','get','opened','ContactId','changed'];(function(_0x43fd50,_0x242550){var _0x341138=function(_0xeb90d5){while(--_0xeb90d5){_0x43fd50['push'](_0x43fd50['shift']());}};_0x341138(++_0x242550);}(_0xa3c3,0xd7));var _0x3a3c=function(_0x815c1c,_0x1dfd02){_0x815c1c=_0x815c1c-0x0;var _0x54487a=_0xa3c3[_0x815c1c];return _0x54487a;};'use strict';var util=require('util');var db=require(_0x3a3c('0x0'))['db'];var jayson=require(_0x3a3c('0x1'));var logger=require(_0x3a3c('0x2'))(_0x3a3c('0x3'));var _=require(_0x3a3c('0x4'));var client=jayson[_0x3a3c('0x5')][_0x3a3c('0x6')]({'port':0x232a});var triggers=[{'channel':_0x3a3c('0x7'),'model':'ChatInteraction','event':_0x3a3c('0x8'),'condition':_0x3a3c('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0x3a3c('0xa'),'event':'afterUpdate','condition':_0x3a3c('0xb'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x3a3c('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3a3c('0xc'),'model':_0x3a3c('0xd'),'event':_0x3a3c('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x3a3c('0xd'),'event':_0x3a3c('0xe'),'condition':_0x3a3c('0xb'),'callback':afterUpdate},{'channel':_0x3a3c('0xc'),'model':'SmsMessage','event':_0x3a3c('0x8'),'condition':_0x3a3c('0xf'),'callback':afterCreateMessage},{'channel':_0x3a3c('0x10'),'model':_0x3a3c('0x11'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x3a3c('0x11'),'event':'afterUpdate','condition':_0x3a3c('0xb'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':'afterCreate','condition':_0x3a3c('0xf'),'callback':afterCreateMessage},{'channel':_0x3a3c('0x12'),'model':_0x3a3c('0x13'),'event':_0x3a3c('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3a3c('0x12'),'model':_0x3a3c('0x13'),'event':'afterUpdate','condition':_0x3a3c('0xb'),'callback':afterUpdate},{'channel':_0x3a3c('0x12'),'model':_0x3a3c('0x14'),'event':_0x3a3c('0x8'),'condition':_0x3a3c('0xf'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x3a3c('0x15'),'event':_0x3a3c('0x8'),'condition':_0x3a3c('0x9'),'callback':afterCreate},{'channel':_0x3a3c('0x16'),'model':_0x3a3c('0x15'),'event':_0x3a3c('0xe'),'condition':_0x3a3c('0xb'),'callback':afterUpdate},{'channel':'Mail','model':_0x3a3c('0x17'),'event':_0x3a3c('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3a3c('0x18'),'model':_0x3a3c('0x19'),'event':_0x3a3c('0x8'),'condition':_0x3a3c('0x9'),'callback':afterCreate},{'channel':_0x3a3c('0x18'),'model':_0x3a3c('0x19'),'event':_0x3a3c('0xe'),'condition':_0x3a3c('0xb'),'callback':afterUpdate},{'channel':_0x3a3c('0x18'),'model':_0x3a3c('0x1a'),'event':_0x3a3c('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x5bda26){return client[_0x3a3c('0x1b')](_0x3a3c('0x1c'),_0x5bda26)[_0x3a3c('0x1d')](function(_0x1dd6e1){logger['info'](_0x3a3c('0x1e'),'EventManager',_0x1dd6e1);if(_0x1dd6e1['error']){if(_0x1dd6e1[_0x3a3c('0x1f')][_0x3a3c('0x20')]===0x1f4){logger[_0x3a3c('0x1f')](_0x3a3c('0x1e'),_0x3a3c('0x1c'),_0x1dd6e1[_0x3a3c('0x1f')]);}}})[_0x3a3c('0x21')](function(_0x6d6d9d){logger[_0x3a3c('0x1f')](_0x3a3c('0x1e'),'EventManager',_0x6d6d9d);});}function afterCreateMessage(_0x3b105c,_0x5a7cbc){return function(_0x32f0a9,_0x44fdd8){_0x32f0a9=_0x32f0a9['get']({'plain':!![]});_0x32f0a9[_0x3a3c('0x22')]=_0x3b105c;_0x32f0a9[_0x3a3c('0x23')]=_0x3b105c;_0x32f0a9[_0x3a3c('0x24')]=_0x32f0a9[_0x3a3c('0x25')];var _0x23017e=_0x3a3c('0x26')+_0x32f0a9['ContactId'];return db[_0x3a3c('0x27')][_0x3a3c('0x28')](_0x23017e,{'type':db[_0x3a3c('0x29')][_0x3a3c('0x2a')][_0x3a3c('0x2b')],'raw':!![]})[_0x3a3c('0x1d')](function(_0xfe02b5){return _0xfe02b5;})['then'](function(_0x4b511a){if(_0x4b511a){_0x32f0a9[_0x3a3c('0x2c')]=_0x4b511a[0x0];}if(_0x32f0a9[_0x3a3c('0x2d')]){return db['User'][_0x3a3c('0x2e')]({'where':{'id':_0x32f0a9[_0x3a3c('0x2d')]},'attributes':['id',_0x3a3c('0x2f'),'fullname',_0x3a3c('0x30'),_0x3a3c('0x31')],'raw':!![]})['then'](function(_0x4a3f1e){_0x32f0a9[_0x3a3c('0x32')]=util['format']('SIP/%s',_0x4a3f1e['name']);_0x32f0a9[_0x3a3c('0x22')]=_0x3b105c;_0x32f0a9['agent']=_0x4a3f1e;return request({'event':_0x3a3c('0x33'),'message':_0x32f0a9});})[_0x3a3c('0x21')](function(_0x4c908b){console[_0x3a3c('0x1f')](_0x4c908b);});}else{return request({'event':_0x3a3c('0x34'),'message':_0x32f0a9});}});};}function afterCreate(_0x227997,_0x4a9c31){return function(_0x4e276f,_0x47fcbd){_0x4e276f=_0x4e276f[_0x3a3c('0x35')]({'plain':!![]});_0x4e276f['channel']=_0x227997;_0x4e276f[_0x3a3c('0x23')]=_0x227997;_0x4e276f[_0x3a3c('0x24')]=_0x3a3c('0x36');var _0x5a6fb6=_0x3a3c('0x26')+_0x4e276f[_0x3a3c('0x37')];return db[_0x3a3c('0x27')][_0x3a3c('0x28')](_0x5a6fb6,{'type':db['Sequelize'][_0x3a3c('0x2a')][_0x3a3c('0x2b')],'raw':!![]})[_0x3a3c('0x1d')](function(_0x16460d){return _0x16460d;})[_0x3a3c('0x1d')](function(_0x173024){if(_0x173024){_0x4e276f[_0x3a3c('0x2c')]=_0x173024[0x0];}return request({'event':_0x4a9c31,'message':_0x4e276f});});};}function afterUpdate(_0x595c14){return function(_0x48db0c){var _0x5c40a6=_0x48db0c[_0x3a3c('0x38')](_0x3a3c('0x39'))&&_0x48db0c['closed'];var _0x26ef36=_0x48db0c[_0x3a3c('0x38')](_0x3a3c('0x3a'));if(_0x5c40a6||_0x26ef36){var _0x3df502=_0x5c40a6?'closedinteraction':_0x3a3c('0x3a');var _0x95b317=_0x48db0c[_0x3a3c('0x35')]({'plain':!![]});_0x95b317['channel']=_0x595c14;_0x95b317[_0x3a3c('0x23')]=_0x595c14;_0x95b317[_0x3a3c('0x24')]=_0x5c40a6?'closed':_0x3a3c('0x3a');var _0x4206d6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x95b317[_0x3a3c('0x37')];return db[_0x3a3c('0x27')][_0x3a3c('0x28')](_0x4206d6,{'type':db[_0x3a3c('0x29')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3a3c('0x1d')](function(_0x1de1e0){if(_0x1de1e0){_0x95b317[_0x3a3c('0x2c')]=_0x1de1e0[0x0];}if(_0x95b317[_0x3a3c('0x2d')]){return db[_0x3a3c('0x3b')][_0x3a3c('0x2e')]({'where':{'id':_0x95b317[_0x3a3c('0x2d')]},'attributes':['id',_0x3a3c('0x2f'),_0x3a3c('0x3c'),'email',_0x3a3c('0x31')],'raw':!![]})['then'](function(_0x4991dd){_0x95b317[_0x3a3c('0x32')]=util[_0x3a3c('0x3d')](_0x3a3c('0x3e'),_0x4991dd[_0x3a3c('0x2f')]);_0x95b317[_0x3a3c('0x3f')]=_0x4991dd;return request({'event':_0x3df502,'message':_0x95b317});})[_0x3a3c('0x21')](function(_0xbc651){console[_0x3a3c('0x1f')](_0xbc651);});}else{return request({'event':_0x3df502,'message':_0x95b317});}});}};}exports[_0x3a3c('0x40')]=function(){for(var _0x3ca581=0x0;_0x3ca581=_0x2c6d4a[_0x7e51('0x13')]){throw Error(_0x7e51('0x14'));}_0x5edbe7(_0x317769);})[_0x7e51('0x15')](function(_0x38cdef){_0x4d7869(_0x38cdef);});});}; \ No newline at end of file +var _0xc33b=['agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','updateAttributes','getLicense','role','User','count'];(function(_0x1c1579,_0x3de9c1){var _0x302674=function(_0x549406){while(--_0x549406){_0x1c1579['push'](_0x1c1579['shift']());}};_0x302674(++_0x3de9c1);}(_0xc33b,0x82));var _0xbc33=function(_0x20a377,_0xaca93b){_0x20a377=_0x20a377-0x0;var _0x26fc4b=_0xc33b[_0x20a377];return _0x26fc4b;};'use strict';var _=require('lodash');var BPromise=require(_0xbc33('0x0'));var db=require('../mysqldb')['db'];var util=require(_0xbc33('0x1'));var channels=[_0xbc33('0x2'),_0xbc33('0x3'),_0xbc33('0x4'),'fax',_0xbc33('0x5'),_0xbc33('0x6'),_0xbc33('0x7')];exports[_0xbc33('0x8')]=function(){return channels;};exports[_0xbc33('0x9')]=function(_0x285a2c){_0x285a2c=_0x285a2c[_0xbc33('0xa')]();return _['includes'](channels,_0x285a2c);};exports[_0xbc33('0xb')]=function(_0x281065,_0x52d665,_0x429022,_0x32a7f9){var _0x3dd3dd={'loginAttempts':_0x52d665,'blocked':_0x429022};if(!_['isUndefined'](_0x32a7f9)){_0x3dd3dd['blockedAt']=_0x32a7f9;}return _0x281065[_0xbc33('0xc')](_0x3dd3dd);};exports[_0xbc33('0xd')]=function(_0x4dea6c){return new BPromise(function(_0x3206bd,_0x22bcd9){var _0x39bc14=0x0;if(_0x4dea6c[_0xbc33('0xe')]!=='agent'){_0x3206bd(_0x4dea6c);}db[_0xbc33('0xf')][_0xbc33('0x10')]({'where':{'role':_0xbc33('0x11'),'online':!![],'id':{'$ne':_0x4dea6c['id']}}})[_0xbc33('0x12')](function(_0x36179b){_0x39bc14=_0x36179b;return util[_0xbc33('0xd')]();})['then'](function(_0x568076){if(_0x568076&&_0x568076['agents']&&_0x39bc14>=_0x568076[_0xbc33('0x13')]){throw Error(_0xbc33('0x14'));}_0x3206bd(_0x4dea6c);})['catch'](function(_0x4a2652){_0x22bcd9(_0x4a2652);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 4b68a40..90f7b02 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cae=['status','render','send','exports','404'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x2cae,0x16b));var _0xe2ca=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x2cae[_0x354164];return _0x5db9a8;};'use strict';module[_0xe2ca('0x0')][0x194]=function pageNotFound(_0x1987fc,_0x5d4b71){var _0x5c7fcc=_0xe2ca('0x1');var _0x1eb9a8=0x194;var _0x482b27={'status':_0x1eb9a8};_0x5d4b71[_0xe2ca('0x2')](_0x482b27[_0xe2ca('0x2')]);_0x5d4b71[_0xe2ca('0x3')](_0x5c7fcc,{},function(_0x1d3499,_0x4dc701){if(_0x1d3499){return _0x5d4b71[_0xe2ca('0x2')](_0x482b27[_0xe2ca('0x2')])['json'](_0x482b27);}_0x5d4b71[_0xe2ca('0x4')](_0x4dc701);});}; \ No newline at end of file +var _0x54a7=['send','exports','404','status','render','json'];(function(_0xb260f8,_0xc008c5){var _0x63096d=function(_0x27fb13){while(--_0x27fb13){_0xb260f8['push'](_0xb260f8['shift']());}};_0x63096d(++_0xc008c5);}(_0x54a7,0x1c3));var _0x754a=function(_0x4f9502,_0x14cf4c){_0x4f9502=_0x4f9502-0x0;var _0x48d23a=_0x54a7[_0x4f9502];return _0x48d23a;};'use strict';module[_0x754a('0x0')][0x194]=function pageNotFound(_0x17b921,_0x4fe27b){var _0xb72aeb=_0x754a('0x1');var _0x3fcec2=0x194;var _0x509831={'status':_0x3fcec2};_0x4fe27b[_0x754a('0x2')](_0x509831['status']);_0x4fe27b[_0x754a('0x3')](_0xb72aeb,{},function(_0xd24e83,_0x24fe17){if(_0xd24e83){return _0x4fe27b['status'](_0x509831[_0x754a('0x2')])[_0x754a('0x4')](_0x509831);}_0x4fe27b[_0x754a('0x5')](_0x24fe17);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 39e5c7d..20c0477 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','Hoppers','HopperFinals','VoiceQueueId','CmHopperHistory','TrunkId','belongsTo','TrunkBackup','Interval','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Disposition','Dispositions','CannedAnswer','Answers','Interactions','MailApplication','List','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ListId','Dashboard','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','Owner','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','mandatoryDispositionPause','OpenchannelQueue','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','Website','CmCompany','CompanyId','JscriptySessions','Company','cm_contact_has_tags','Agent','OwnerId','CampaignId','All','Any','AutomationId','Extensions','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllCondition','TriggerAllId','TriggerId','Fields','AnalyticMetric','MetricId','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','Field','Variable','Configurations','DeskField','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','VtigerConfiguration','VtigerAccount','ServicenowAccount','Dynamics365Field','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','user_has_teams','TeamVoiceQueue','VoiceQueues','team_has_chat_queues','WhatsappQueues','HopperHistories','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToAgent','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','CmCustomField','Queues','UserProfileSections','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','team_has_whatsapp_queues','exports','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network'];(function(_0x24194f,_0x4bdeae){var _0x376b83=function(_0xf6dbf2){while(--_0xf6dbf2){_0x24194f['push'](_0x24194f['shift']());}};_0x376b83(++_0x4bdeae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['Trigger']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['Variable']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/variable/variable.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/integrationReport/integrationReport.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['AnalyticExtractedReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticMetric']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['SalesforceField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['DeskField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['ZohoAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['VtigerAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['ServicenowAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['Dynamics365Field']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x8c'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db['JscriptyAnswerReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['SquareReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['SquareProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareMessage']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/team/team.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Migration']=db['sequelize'][_0x0a9e('0x12')]('../api/migration/migration.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/attachment/attachment.model');db['Plugin']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/plugin/plugin.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['OpenchannelTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['UserProfileSection']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userNotification/userNotification.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/whatsappApplication/whatsappApplication.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['TeamVoiceQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x11')][_0x0a9e('0x105')](db['VoiceMail'],{'as':_0x0a9e('0x106'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x108')});db['User'][_0x0a9e('0x109')](db[_0x0a9e('0x10a')],{'as':_0x0a9e('0x10b'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x10c'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db[_0x0a9e('0x16')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0x0a9e('0x109')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db['CmHopperHistory'],{'as':_0x0a9e('0x10d'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x10e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x10f'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')]['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x110'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')]['hasMany'](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db[_0x0a9e('0x113')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db['WhatsappInteraction'],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x11')][_0x0a9e('0x109')](db[_0x0a9e('0xf2')],{'as':_0x0a9e('0x116'),'foreignKey':_0x0a9e('0x117')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xee')],{'as':_0x0a9e('0xee'),'foreignKey':_0x0a9e('0x118')});db['User'][_0x0a9e('0x119')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x11a'),'through':_0x0a9e('0x11b')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x11e')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x11f'),'through':_0x0a9e('0x120')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0xdc')],{'through':'user_has_teams'});db[_0x0a9e('0x11')]['belongsToMany'](db['MailInteraction'],{'as':'MailInteractions','through':_0x0a9e('0x121')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x64')],{'as':'ChatInteractions','through':_0x0a9e('0x122')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'through':'user_has_fax_interactions'});db['User'][_0x0a9e('0x119')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x110'),'through':'user_has_sms_interactions'});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','through':_0x0a9e('0x123')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db['WhatsappInteraction'],{'as':_0x0a9e('0x115'),'through':_0x0a9e('0x124')});db[_0x0a9e('0x11')]['belongsToMany'](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0xec')],{'as':'VoicePrefixes','through':_0x0a9e('0x103'),'required':![]});db['User'][_0x0a9e('0x119')](db[_0x0a9e('0x3c')],{'as':_0x0a9e('0x125'),'through':'UserMailQueue','required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x67')],{'as':'ChatQueues','through':_0x0a9e('0x126'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x119')](db['FaxQueue'],{'as':_0x0a9e('0x127'),'through':'UserFaxQueue','required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x128'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db['OpenchannelQueue'],{'as':_0x0a9e('0x129'),'through':_0x0a9e('0x35'),'required':![]});db['User'][_0x0a9e('0x119')](db[_0x0a9e('0xfd')],{'as':'WhatsappQueues','through':_0x0a9e('0x37'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db['CmList'],{'through':_0x0a9e('0x120')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x12a'),'through':_0x0a9e('0x12b')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x12c'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x12d'),'through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0x59')],{'as':'OpenchannelAccounts','through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db['SmsAccount'],{'as':_0x0a9e('0x130'),'through':_0x0a9e('0x131')});db[_0x0a9e('0x11')][_0x0a9e('0x119')](db[_0x0a9e('0xf3')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x133')});db['User'][_0x0a9e('0x119')](db[_0x0a9e('0x134')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x136')});db[_0x0a9e('0x13')][_0x0a9e('0x109')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x0a9e('0x137')});db[_0x0a9e('0x138')][_0x0a9e('0x109')](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x16')][_0x0a9e('0x109')](db['VoiceExtension'],{'as':_0x0a9e('0x139'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x18')][_0x0a9e('0x119')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db['VoiceQueue'][_0x0a9e('0x109')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x13c'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')][_0x0a9e('0x109')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x13d'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')][_0x0a9e('0x109')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x13e'),'foreignKey':_0x0a9e('0x13f')});db[_0x0a9e('0x1a')][_0x0a9e('0x109')](db[_0x0a9e('0x140')],{'as':'HopperHistories','foreignKey':_0x0a9e('0x13f')});db[_0x0a9e('0x1a')][_0x0a9e('0x109')](db[_0x0a9e('0x73')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')][_0x0a9e('0x109')](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':_0x0a9e('0x13f')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0xcc')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x13f')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x0a9e('0x28'),'foreignKey':_0x0a9e('0x141')});db[_0x0a9e('0x1a')][_0x0a9e('0x142')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x143'),'foreignKey':'TrunkBackupId'});db[_0x0a9e('0x1a')][_0x0a9e('0x142')](db[_0x0a9e('0x144')],{'as':_0x0a9e('0x144'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x1a')][_0x0a9e('0x142')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x146')});db['VoiceQueue'][_0x0a9e('0x119')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x11f'),'through':_0x0a9e('0x147')});db[_0x0a9e('0x1a')][_0x0a9e('0x119')](db['User'],{'as':_0x0a9e('0x148'),'through':'UserVoiceQueue'});db['VoiceQueue'][_0x0a9e('0x119')](db['Team'],{'as':_0x0a9e('0x149'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0x0a9e('0x119')](db['CmList'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x14b')});db[_0x0a9e('0x10a')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x108')});db['ScreenRecording']['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x106')][_0x0a9e('0x109')](db[_0x0a9e('0x1f')],{'as':_0x0a9e('0x14c'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x14d'),'sourceKey':_0x0a9e('0x14e')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0x0a9e('0x14d'),'targetKey':_0x0a9e('0x14e')});db[_0x0a9e('0x14f')][_0x0a9e('0x109')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x150'),'foreignKey':_0x0a9e('0x151'),'constraints':![]});db[_0x0a9e('0x14f')]['hasMany'](db['VoiceAgentReport'],{'as':_0x0a9e('0x152'),'foreignKey':_0x0a9e('0x151'),'constraints':![]});db['VoiceCallReport'][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x14f')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x39')][_0x0a9e('0x142')](db[_0x0a9e('0x3b')],{'as':'MailAccount','foreignKey':_0x0a9e('0x155')});db[_0x0a9e('0x156')][_0x0a9e('0x142')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x155')});db[_0x0a9e('0x3b')][_0x0a9e('0x105')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x157'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x3b')]['hasOne'](db['MailServerOut'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x3b')][_0x0a9e('0x109')](db[_0x0a9e('0x159')],{'as':_0x0a9e('0x15a'),'foreignKey':_0x0a9e('0x155'),'onDelete':'cascade'});db[_0x0a9e('0x3b')]['hasMany'](db[_0x0a9e('0x15b')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x155')});db[_0x0a9e('0x3b')][_0x0a9e('0x109')](db[_0x0a9e('0x3e')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x155')});db[_0x0a9e('0x3b')][_0x0a9e('0x109')](db[_0x0a9e('0x113')],{'as':_0x0a9e('0x15d')});db[_0x0a9e('0x3b')][_0x0a9e('0x109')](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x139')});db['MailAccount']['belongsTo'](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':'ListId'});db['MailAccount'][_0x0a9e('0x142')](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x88'),'foreignKey':'TemplateId'});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x146')});db['MailAccount'][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':'user_has_mail_accounts'});db[_0x0a9e('0x3c')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x119')](db[_0x0a9e('0xdc')],{'through':_0x0a9e('0x160'),'as':_0x0a9e('0x149')});db[_0x0a9e('0x113')][_0x0a9e('0x109')](db[_0x0a9e('0x3e')],{'as':_0x0a9e('0x14c'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x113')][_0x0a9e('0x142')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x155')});db[_0x0a9e('0x113')]['belongsTo'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x113')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x108')});db['MailInteraction'][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x163'),'as':_0x0a9e('0x164')});db[_0x0a9e('0x113')][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x163'),'as':_0x0a9e('0x165')});db[_0x0a9e('0x113')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x121'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x3e')][_0x0a9e('0x109')](db[_0x0a9e('0xe1')],{'as':'Attachments','onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x3e')]['belongsTo'](db['User'],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x3e')][_0x0a9e('0x142')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x0a9e('0x3e')][_0x0a9e('0x142')](db[_0x0a9e('0x113')],{'as':_0x0a9e('0x166'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')][_0x0a9e('0x142')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x155')});db[_0x0a9e('0x3e')][_0x0a9e('0x142')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x60'),'foreignKey':_0x0a9e('0x167')});db[_0x0a9e('0x3e')][_0x0a9e('0x142')](db[_0x0a9e('0x66')],{'as':'ChatOfflineMessage','foreignKey':_0x0a9e('0x168')});db[_0x0a9e('0x15e')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x15e')]['belongsTo'](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x15e')][_0x0a9e('0x142')](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x15e')][_0x0a9e('0x142')](db[_0x0a9e('0x144')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x0a9e('0x15e')][_0x0a9e('0x142')](db['Tag'],{'onDelete':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x16a')});db['MailQueueReport'][_0x0a9e('0x142')](db['MailAccount'],{});db[_0x0a9e('0x16b')][_0x0a9e('0x142')](db['CmList'],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db['MailQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':'Contact','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x16b')][_0x0a9e('0x142')](db[_0x0a9e('0x113')],{});db[_0x0a9e('0x16b')][_0x0a9e('0x142')](db['MailMessage'],{});db[_0x0a9e('0x16b')][_0x0a9e('0x142')](db['User'],{});db[_0x0a9e('0x16b')][_0x0a9e('0x142')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x16d')][_0x0a9e('0x109')](db[_0x0a9e('0x43')],{'as':_0x0a9e('0x16e'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x0a9e('0x16f'),'onDelete':_0x0a9e('0x107')});db['FaxAccount']['hasMany'](db[_0x0a9e('0x15b')],{'as':'Answers','foreignKey':_0x0a9e('0x16f')});db[_0x0a9e('0x45')][_0x0a9e('0x109')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x15d')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x139')});db['FaxAccount'][_0x0a9e('0x109')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x170'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x45')][_0x0a9e('0x109')](db[_0x0a9e('0x4a')],{'as':'Messages'});db[_0x0a9e('0x45')]['belongsTo'](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x28')});db['FaxAccount'][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':'List','foreignKey':_0x0a9e('0x16c')});db['FaxAccount'][_0x0a9e('0x142')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x146')});db['FaxAccount'][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x171')});db[_0x0a9e('0x47')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x142')](db[_0x0a9e('0x4c')],{'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':'restrict'});db['FaxApplication'][_0x0a9e('0x142')](db['Tag'],{'onDelete':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x16a')});db['FaxInteraction'][_0x0a9e('0x109')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x14c'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x111')][_0x0a9e('0x142')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x162'),'foreignKey':'FaxAccountId'});db[_0x0a9e('0x111')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':'ContactId'});db[_0x0a9e('0x111')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'as':'Owner','foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x111')][_0x0a9e('0x119')](db['Tag'],{'through':_0x0a9e('0x173'),'as':'Tags'});db[_0x0a9e('0x111')][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x165')});db[_0x0a9e('0x111')][_0x0a9e('0x119')](db['User'],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x175'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x4a')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x11')});db[_0x0a9e('0x4a')][_0x0a9e('0x142')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x166'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x4a')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x153')});db[_0x0a9e('0x4a')][_0x0a9e('0x142')](db[_0x0a9e('0xe1')],{'as':_0x0a9e('0xe1'),'foreignKey':_0x0a9e('0x176')});db['FaxMessage'][_0x0a9e('0x142')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x162'),'foreignKey':'FaxAccountId'});db[_0x0a9e('0x4c')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x119')](db[_0x0a9e('0xdc')],{'through':_0x0a9e('0x177'),'as':_0x0a9e('0x149')});db['FaxQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0x45')],{});db['FaxQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':'ListId'});db[_0x0a9e('0x4e')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':'ContactId'});db[_0x0a9e('0x4e')][_0x0a9e('0x142')](db[_0x0a9e('0x111')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x142')](db['FaxMessage'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x142')](db['User'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x142')](db[_0x0a9e('0x4c')],{});db['SmsAccount']['hasMany'](db[_0x0a9e('0x159')],{'as':_0x0a9e('0x15a'),'foreignKey':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x50')][_0x0a9e('0x109')](db[_0x0a9e('0x15b')],{'as':_0x0a9e('0x15c'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x0a9e('0x109')](db['SmsMessage'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x178')});db[_0x0a9e('0x50')][_0x0a9e('0x109')](db['SmsInteraction'],{'as':_0x0a9e('0x15d')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x52')],{'as':'Applications'});db[_0x0a9e('0x50')][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db[_0x0a9e('0x50')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x146')});db[_0x0a9e('0x50')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x131')});db[_0x0a9e('0x52')]['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x52')][_0x0a9e('0x142')](db[_0x0a9e('0x57')],{'onDelete':'restrict'});db[_0x0a9e('0x52')][_0x0a9e('0x142')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x0a9e('0x52')][_0x0a9e('0x142')](db[_0x0a9e('0x144')],{'onDelete':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x52')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x16a')});db['SmsInteraction'][_0x0a9e('0x109')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x14c'),'onDelete':_0x0a9e('0x107'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x0a9e('0x142')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x178')});db[_0x0a9e('0x53')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':'ContactId'});db[_0x0a9e('0x53')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x108')});db['SmsInteraction']['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x164')});db['SmsInteraction']['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x17a'),'as':_0x0a9e('0x165')});db[_0x0a9e('0x53')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x17c')});db[_0x0a9e('0x55')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db['SmsMessage']['belongsTo'](db[_0x0a9e('0x11c')],{'onDelete':'cascade','as':_0x0a9e('0x153')});db[_0x0a9e('0x55')][_0x0a9e('0x142')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x166'),'foreignKey':_0x0a9e('0x17c')});db[_0x0a9e('0x55')][_0x0a9e('0x142')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x178')});db['SmsQueue'][_0x0a9e('0x119')](db['User'],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x34'),'foreignKey':'SmsQueueId'});db[_0x0a9e('0x57')][_0x0a9e('0x119')](db[_0x0a9e('0xdc')],{'through':_0x0a9e('0x17d'),'as':_0x0a9e('0x149')});db[_0x0a9e('0x59')]['hasMany'](db[_0x0a9e('0x159')],{'as':_0x0a9e('0x15a'),'foreignKey':_0x0a9e('0x17e'),'onDelete':'cascade'});db[_0x0a9e('0x59')][_0x0a9e('0x109')](db[_0x0a9e('0x15b')],{'as':'Answers','foreignKey':_0x0a9e('0x17e')});db[_0x0a9e('0x59')][_0x0a9e('0x109')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x15d'),'foreignKey':_0x0a9e('0x17e')});db['OpenchannelAccount']['hasMany'](db[_0x0a9e('0x5e')],{'as':_0x0a9e('0x14c'),'foreignKey':'OpenchannelAccountId'});db[_0x0a9e('0x59')][_0x0a9e('0x109')](db[_0x0a9e('0x5b')],{'as':_0x0a9e('0x139'),'foreignKey':_0x0a9e('0x17e')});db[_0x0a9e('0x59')]['belongsTo'](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db['OpenchannelAccount'][_0x0a9e('0x142')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x17f'),'foreignKey':_0x0a9e('0x146')});db['OpenchannelAccount']['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x12f')});db['OpenchannelApplication'][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x5b')][_0x0a9e('0x142')](db[_0x0a9e('0x180')],{'onDelete':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x181')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x0a9e('0x5b')]['belongsTo'](db[_0x0a9e('0x144')],{'onDelete':_0x0a9e('0x169'),'foreignKey':'IntervalId'});db[_0x0a9e('0x5b')][_0x0a9e('0x142')](db['Tag'],{'onDelete':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x16a')});db[_0x0a9e('0x5d')][_0x0a9e('0x109')](db[_0x0a9e('0x5e')],{'as':_0x0a9e('0x14c'),'onDelete':_0x0a9e('0x107'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5d')][_0x0a9e('0x142')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x17e')});db[_0x0a9e('0x5d')][_0x0a9e('0x142')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x5d')][_0x0a9e('0x142')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x108')});db['OpenchannelInteraction'][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x182'),'as':_0x0a9e('0x164')});db[_0x0a9e('0x5d')][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x182'),'as':_0x0a9e('0x165')});db['OpenchannelInteraction']['belongsToMany'](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x123'),'foreignKey':_0x0a9e('0x183')});db[_0x0a9e('0x5e')][_0x0a9e('0x142')](db['User'],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x11')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x11c')],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x153')});db['OpenchannelMessage'][_0x0a9e('0x142')](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x166'),'foreignKey':_0x0a9e('0x183')});db[_0x0a9e('0x5e')]['belongsTo'](db['Attachment'],{'as':_0x0a9e('0xe1'),'foreignKey':_0x0a9e('0x176')});db[_0x0a9e('0x5e')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x17e')});db[_0x0a9e('0x180')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x180')][_0x0a9e('0x119')](db['Team'],{'through':_0x0a9e('0x184'),'as':'Teams'});db[_0x0a9e('0x60')][_0x0a9e('0x109')](db['Disposition'],{'as':_0x0a9e('0x15a'),'foreignKey':'ChatWebsiteId','onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x60')][_0x0a9e('0x109')](db[_0x0a9e('0x15b')],{'as':_0x0a9e('0x15c'),'foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x60')][_0x0a9e('0x109')](db[_0x0a9e('0x185')],{'as':'ProactiveActions'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x15d')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x139')});db[_0x0a9e('0x60')][_0x0a9e('0x109')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x14c')});db['ChatWebsite'][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db[_0x0a9e('0x60')][_0x0a9e('0x142')](db[_0x0a9e('0x144')],{'as':_0x0a9e('0x144'),'foreignKey':'IntervalId'});db[_0x0a9e('0x60')][_0x0a9e('0x142')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x60')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x17f'),'foreignKey':_0x0a9e('0x146')});db['ChatWebsite'][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x12b')});db['OpenchannelQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0x59')],{});db[_0x0a9e('0x62')][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db['OpenchannelQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154')});db['OpenchannelQueueReport'][_0x0a9e('0x142')](db['OpenchannelInteraction'],{});db[_0x0a9e('0x62')][_0x0a9e('0x142')](db[_0x0a9e('0x5e')],{});db[_0x0a9e('0x62')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')]['belongsTo'](db[_0x0a9e('0x180')],{});db['ChatApplication'][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'as':'Agent','foreignKey':_0x0a9e('0x108'),'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x63')][_0x0a9e('0x142')](db['ChatQueue'],{'as':_0x0a9e('0x186'),'foreignKey':_0x0a9e('0x187'),'onDelete':'restrict'});db[_0x0a9e('0x63')]['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x0a9e('0x167'),'onDelete':_0x0a9e('0x169')});db['ChatApplication'][_0x0a9e('0x142')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x16a')});db[_0x0a9e('0x64')][_0x0a9e('0x109')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x14c'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x188')});db['ChatInteraction'][_0x0a9e('0x142')](db['ChatWebsite'],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x167')});db[_0x0a9e('0x64')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':'ContactId'});db[_0x0a9e('0x64')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'as':'Owner','foreignKey':_0x0a9e('0x108')});db[_0x0a9e('0x64')][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x189'),'as':_0x0a9e('0x164')});db[_0x0a9e('0x64')][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x189'),'as':_0x0a9e('0x165')});db[_0x0a9e('0x64')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x122'),'foreignKey':'ChatInteractionId'});db[_0x0a9e('0x65')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'onDelete':'cascade','as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x65')][_0x0a9e('0x142')](db['ChatInteraction'],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x166'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x65')]['belongsTo'](db['Attachment'],{'as':_0x0a9e('0xe1'),'foreignKey':_0x0a9e('0x176')});db[_0x0a9e('0x65')][_0x0a9e('0x142')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x167')});db[_0x0a9e('0x66')][_0x0a9e('0x109')](db[_0x0a9e('0xe1')],{'as':_0x0a9e('0x18a'),'foreignKey':_0x0a9e('0x168'),'onDelete':_0x0a9e('0x107'),'hooks':!![]});db[_0x0a9e('0x66')]['belongsTo'](db[_0x0a9e('0x11c')],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x153'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x0a9e('0x142')](db['ChatWebsite'],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x167')});db[_0x0a9e('0x67')][_0x0a9e('0x119')](db['User'],{'as':'Agents','through':_0x0a9e('0x126'),'hooks':!![]});db[_0x0a9e('0x67')][_0x0a9e('0x119')](db[_0x0a9e('0xdc')],{'through':'team_has_chat_queues','as':_0x0a9e('0x149')});db[_0x0a9e('0x68')][_0x0a9e('0x109')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x14c'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x0a9e('0x68')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x13c'),'through':_0x0a9e('0x11b')});db[_0x0a9e('0x185')][_0x0a9e('0x142')](db['ChatWebsite'],{'as':_0x0a9e('0x18b'),'foreignKey':_0x0a9e('0x167')});db[_0x0a9e('0x18c')]['hasMany'](db['CmContact'],{'as':'Contacts','foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x13d'),'foreignKey':_0x0a9e('0x154')});db['CmContact']['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x13e'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x140')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x154')});db['CmContact'][_0x0a9e('0x109')](db[_0x0a9e('0xcc')],{'as':_0x0a9e('0x18e'),'foreignKey':'ContactId'});db['CmContact'][_0x0a9e('0x109')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x154'),'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x11c')]['hasMany'](db['ChatInteraction'],{'as':_0x0a9e('0x10f'),'foreignKey':_0x0a9e('0x154'),'onDelete':'restrict'});db['CmContact']['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x169')});db['CmContact'][_0x0a9e('0x109')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x154'),'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x11c')][_0x0a9e('0x109')](db['MailInteraction'],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x154'),'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x11c')][_0x0a9e('0x142')](db[_0x0a9e('0x18c')],{'as':_0x0a9e('0x18f'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x11c')][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':'List','foreignKey':_0x0a9e('0x16c'),'onDelete':_0x0a9e('0x107')});db['CmContact'][_0x0a9e('0x119')](db['User'],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x11e')});db['CmContact']['belongsToMany'](db[_0x0a9e('0x86')],{'as':'Tags','through':_0x0a9e('0x190')});db[_0x0a9e('0x11c')][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x190'),'as':'ThroughTags'});db[_0x0a9e('0x6d')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x6d')][_0x0a9e('0x142')](db['CmList'],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x6d')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x191'),'foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x142')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x186'),'foreignKey':'VoiceQueueId','onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x6d')][_0x0a9e('0x142')](db[_0x0a9e('0xdf')],{'as':_0x0a9e('0xdf'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x6d')]['belongsTo'](db[_0x0a9e('0x11')],{'as':'Owner','foreignKey':_0x0a9e('0x192')});db[_0x0a9e('0x6f')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x6f')][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x6f')][_0x0a9e('0x142')](db['VoiceQueue'],{'as':_0x0a9e('0x186'),'foreignKey':_0x0a9e('0x13f'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x6f')][_0x0a9e('0x142')](db[_0x0a9e('0xdf')],{'as':_0x0a9e('0xdf'),'foreignKey':_0x0a9e('0x193'),'onDelete':'cascade'});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':_0x0a9e('0x194'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')][_0x0a9e('0x109')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x195'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x107'),'hooks':!![]});db[_0x0a9e('0x76')][_0x0a9e('0x109')](db[_0x0a9e('0x74')],{'as':'Actions','foreignKey':_0x0a9e('0x196'),'onDelete':_0x0a9e('0x107'),'hooks':!![]});db[_0x0a9e('0x159')][_0x0a9e('0x109')](db[_0x0a9e('0x159')],{'as':_0x0a9e('0x15a'),'foreignKey':'ParentId','onDelete':_0x0a9e('0x107')});db['Interval']['hasMany'](db[_0x0a9e('0x144')],{'as':'Intervals','foreignKey':_0x0a9e('0x145'),'onDelete':_0x0a9e('0x107'),'hooks':!![],'required':![]});db[_0x0a9e('0x144')][_0x0a9e('0x109')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x197'),'foreignKey':_0x0a9e('0x145'),'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x144')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x198'),'foreignKey':'IntervalId'});db[_0x0a9e('0x144')][_0x0a9e('0x109')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x199'),'foreignKey':'IntervalId'});db[_0x0a9e('0x144')][_0x0a9e('0x109')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x19a'),'foreignKey':_0x0a9e('0x145')});db['Interval']['hasMany'](db[_0x0a9e('0x52')],{'as':'SmsApplications','foreignKey':_0x0a9e('0x145')});db['Schedule'][_0x0a9e('0x142')](db['MailAccount'],{});db[_0x0a9e('0x82')]['belongsTo'](db[_0x0a9e('0x90')],{'foreignKey':_0x0a9e('0x19b')});db[_0x0a9e('0x82')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x19c')});db['Sound'][_0x0a9e('0x119')](db['VoiceMusicOnHold'],{'as':_0x0a9e('0x19d'),'through':'moh_has_sounds','onDelete':_0x0a9e('0x169')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x11c')],{'through':_0x0a9e('0x190')});db[_0x0a9e('0x86')][_0x0a9e('0x119')](db[_0x0a9e('0x64')],{'through':_0x0a9e('0x189')});db[_0x0a9e('0x86')][_0x0a9e('0x119')](db[_0x0a9e('0x113')],{'through':'mail_interaction_has_tags'});db[_0x0a9e('0x86')][_0x0a9e('0x119')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x17a')});db[_0x0a9e('0x86')]['belongsToMany'](db['FaxInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x119')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x182')});db[_0x0a9e('0x86')][_0x0a9e('0x119')](db[_0x0a9e('0xf5')],{'through':_0x0a9e('0x19e')});db[_0x0a9e('0x19f')][_0x0a9e('0x109')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x0a9e('0x1a0')},'foreignKey':_0x0a9e('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x19f')][_0x0a9e('0x109')](db[_0x0a9e('0x7a')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x0a9e('0x107'),'hooks':!![]});db[_0x0a9e('0x19f')][_0x0a9e('0x109')](db[_0x0a9e('0x74')],{'as':'Actions','foreignKey':_0x0a9e('0x1a2'),'onDelete':_0x0a9e('0x107'),'hooks':!![]});db[_0x0a9e('0x8e')]['hasMany'](db[_0x0a9e('0x94')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x0a9e('0x19c'),'hooks':!![]});db[_0x0a9e('0x90')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x0a9e('0x1a3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x19b')});db['AnalyticMetric'][_0x0a9e('0x109')](db[_0x0a9e('0x94')],{'as':_0x0a9e('0x1a3'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x0a9e('0x94')][_0x0a9e('0x142')](db[_0x0a9e('0x1a4')],{'foreignKey':_0x0a9e('0x1a5')});db['SalesforceAccount'][_0x0a9e('0x109')](db[_0x0a9e('0x99')],{'as':'Configurations','onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0x99')]['hasMany'](db[_0x0a9e('0x1a7')],{'as':_0x0a9e('0x1a8'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a9')});db[_0x0a9e('0x99')][_0x0a9e('0x109')](db[_0x0a9e('0x1a7')],{'as':_0x0a9e('0x1aa'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0x99')][_0x0a9e('0x109')](db[_0x0a9e('0x1a7')],{'as':_0x0a9e('0x1a3'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0x99')][_0x0a9e('0x142')](db[_0x0a9e('0x98')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0x1a7')]['hasMany'](db[_0x0a9e('0x1a7')],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x1a9')});db['SalesforceField'][_0x0a9e('0x109')](db[_0x0a9e('0x1a7')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x1ab')});db['SalesforceField'][_0x0a9e('0x109')](db[_0x0a9e('0x1a7')],{'as':'Field','foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0x1a7')][_0x0a9e('0x142')](db['Variable'],{'as':'Variable','foreignKey':_0x0a9e('0x1af')});db[_0x0a9e('0x9c')][_0x0a9e('0x109')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0x9e')][_0x0a9e('0x109')](db['SugarcrmField'],{'as':_0x0a9e('0x1a8'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')][_0x0a9e('0x109')](db[_0x0a9e('0xa0')],{'as':'Descriptions','onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0x9e')]['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1a3'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ac')});db['SugarcrmConfiguration']['belongsTo'](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':'AccountId'});db['SugarcrmField'][_0x0a9e('0x109')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ad'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa0')][_0x0a9e('0x109')](db['SugarcrmField'],{'as':_0x0a9e('0x1ae'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xa0')][_0x0a9e('0x109')](db['SugarcrmField'],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0xa0')]['belongsTo'](db[_0x0a9e('0x1b1')],{'as':_0x0a9e('0x1b1'),'foreignKey':_0x0a9e('0x1af')});db['DeskAccount'][_0x0a9e('0x109')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1b2'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0xa2')][_0x0a9e('0x109')](db[_0x0a9e('0x1b3')],{'as':_0x0a9e('0x1a8'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a9')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1b3')],{'as':_0x0a9e('0x1aa'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ab')});db['DeskConfiguration'][_0x0a9e('0x109')](db[_0x0a9e('0x1b3')],{'as':'Fields','onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0xa2')][_0x0a9e('0x142')](db[_0x0a9e('0xa1')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0xa2')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db[_0x0a9e('0x1b3')][_0x0a9e('0x109')](db['DeskField'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x1a9')});db['DeskField'][_0x0a9e('0x109')](db[_0x0a9e('0x1b3')],{'as':'Description','foreignKey':_0x0a9e('0x1ab')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x1ac')});db['DeskField'][_0x0a9e('0x142')](db[_0x0a9e('0x1b1')],{'as':'Variable','foreignKey':_0x0a9e('0x1af')});db[_0x0a9e('0x1b4')]['hasMany'](db[_0x0a9e('0xa6')],{'as':_0x0a9e('0x1b2'),'onDelete':_0x0a9e('0x107'),'foreignKey':'AccountId'});db[_0x0a9e('0xa6')][_0x0a9e('0x109')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1a8'),'onDelete':_0x0a9e('0x107'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1aa'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0xa6')][_0x0a9e('0x109')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1a3'),'onDelete':_0x0a9e('0x107'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x142')](db[_0x0a9e('0x1b4')],{'as':'Account','foreignKey':'AccountId'});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x0a9e('0x1ad'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x109')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0xa8')]['hasMany'](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':'FieldId'});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x1b1')],{'as':'Variable','foreignKey':_0x0a9e('0x1af')});db[_0x0a9e('0xaa')][_0x0a9e('0x109')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1b2'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0xac')]['hasMany'](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1a8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xac')][_0x0a9e('0x109')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1aa'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0xac')][_0x0a9e('0x109')](db['ZendeskField'],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0xac')][_0x0a9e('0x142')](db['ZendeskAccount'],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0xac')][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0xae')][_0x0a9e('0x109')](db['ZendeskField'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x1a9')});db[_0x0a9e('0xae')]['hasMany'](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0xae')][_0x0a9e('0x109')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0xae')][_0x0a9e('0x142')](db['Variable'],{'as':_0x0a9e('0x1b1'),'foreignKey':_0x0a9e('0x1af')});db[_0x0a9e('0xaf')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x0a9e('0x1b2'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0x1b6')][_0x0a9e('0x109')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1a8'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a9')});db['FreshdeskConfiguration'][_0x0a9e('0x109')](db[_0x0a9e('0xb2')],{'as':'Descriptions','onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ab')});db['FreshdeskConfiguration']['hasMany'](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1a3'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0xaf')],{'as':'Account','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x0a9e('0x119')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x0a9e('0x109')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x1a9')});db['FreshdeskField'][_0x0a9e('0x109')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0xb2')][_0x0a9e('0x109')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0x0a9e('0xb2')][_0x0a9e('0x142')](db[_0x0a9e('0x1b1')],{'as':_0x0a9e('0x1b1'),'foreignKey':_0x0a9e('0x1af')});db['VtigerAccount'][_0x0a9e('0x109')](db[_0x0a9e('0x1b7')],{'as':_0x0a9e('0x1b2'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0x1b7')]['hasMany'](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1a8'),'foreignKey':_0x0a9e('0x1a9')});db[_0x0a9e('0x1b7')][_0x0a9e('0x109')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1aa'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0x1b7')][_0x0a9e('0x109')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0x1b7')][_0x0a9e('0x142')](db[_0x0a9e('0x1b8')],{'as':_0x0a9e('0x162'),'foreignKey':_0x0a9e('0x1a6')});db['VtigerField'][_0x0a9e('0x109')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':'SubjectId'});db['VtigerField'][_0x0a9e('0x109')](db[_0x0a9e('0xb5')],{'as':'Description','foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0xb5')]['hasMany'](db[_0x0a9e('0xb5')],{'as':'Field','foreignKey':_0x0a9e('0x1ac')});db['VtigerField'][_0x0a9e('0x142')](db[_0x0a9e('0x1b1')],{'as':_0x0a9e('0x1b1'),'foreignKey':_0x0a9e('0x1af')});db['ServicenowAccount'][_0x0a9e('0x109')](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1b2'),'onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1a8'),'foreignKey':_0x0a9e('0x1a9')});db[_0x0a9e('0xb8')][_0x0a9e('0x109')](db['ServicenowField'],{'as':_0x0a9e('0x1aa'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0xb8')][_0x0a9e('0x109')](db['ServicenowField'],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0xb8')][_0x0a9e('0x142')](db[_0x0a9e('0x1b9')],{'as':'Account','foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0xb9')][_0x0a9e('0x109')](db['ServicenowField'],{'as':_0x0a9e('0x1ad'),'foreignKey':'SubjectId'});db[_0x0a9e('0xb9')][_0x0a9e('0x109')](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x1ab')});db['ServicenowField'][_0x0a9e('0x109')](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0xb9')]['belongsTo'](db[_0x0a9e('0x1b1')],{'as':_0x0a9e('0x1b1'),'foreignKey':_0x0a9e('0x1af')});db['Dynamics365Account'][_0x0a9e('0x109')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x0a9e('0x107'),'foreignKey':'AccountId'});db[_0x0a9e('0xbc')][_0x0a9e('0x109')](db[_0x0a9e('0x1ba')],{'as':'Subjects','onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a9')});db[_0x0a9e('0xbc')][_0x0a9e('0x109')](db[_0x0a9e('0x1ba')],{'as':_0x0a9e('0x1aa'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ab')});db['Dynamics365Configuration'][_0x0a9e('0x109')](db[_0x0a9e('0x1ba')],{'as':_0x0a9e('0x1a3'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1ac')});db['Dynamics365Configuration']['belongsTo'](db[_0x0a9e('0xba')],{'as':'Account','foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0x1ba')]['hasMany'](db[_0x0a9e('0x1ba')],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x1a9')});db['Dynamics365Field'][_0x0a9e('0x109')](db[_0x0a9e('0x1ba')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x1ab')});db[_0x0a9e('0x1ba')][_0x0a9e('0x109')](db[_0x0a9e('0x1ba')],{'as':_0x0a9e('0x1b0'),'foreignKey':'FieldId'});db[_0x0a9e('0x1ba')][_0x0a9e('0x142')](db[_0x0a9e('0x1b1')],{'as':_0x0a9e('0x1b1'),'foreignKey':_0x0a9e('0x1af')});db['FreshsalesAccount'][_0x0a9e('0x109')](db['FreshsalesConfiguration'],{'as':_0x0a9e('0x1b2'),'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1a6')});db['FreshsalesConfiguration'][_0x0a9e('0x109')](db['FreshsalesField'],{'as':_0x0a9e('0x1a8'),'foreignKey':_0x0a9e('0x1a9')});db[_0x0a9e('0xbf')][_0x0a9e('0x109')](db['FreshsalesField'],{'as':_0x0a9e('0x1aa'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xbf')][_0x0a9e('0x109')](db['FreshsalesField'],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1ac')});db[_0x0a9e('0xbf')]['belongsTo'](db[_0x0a9e('0xbe')],{'as':'Account','foreignKey':_0x0a9e('0x1a6')});db[_0x0a9e('0xc1')]['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xc1')][_0x0a9e('0x109')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ae'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc1')]['hasMany'](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1b0'),'foreignKey':'FieldId'});db[_0x0a9e('0xc1')][_0x0a9e('0x142')](db[_0x0a9e('0x1b1')],{'as':_0x0a9e('0x1b1'),'foreignKey':_0x0a9e('0x1af')});db[_0x0a9e('0xc5')][_0x0a9e('0x142')](db['ChatWebsite'],{});db[_0x0a9e('0xc5')][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db[_0x0a9e('0xc5')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0x64')],{});db[_0x0a9e('0xc5')][_0x0a9e('0x142')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xc5')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0x67')],{});db[_0x0a9e('0xc7')]['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1bb')});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x107'),'foreignKey':_0x0a9e('0x1bc')});db[_0x0a9e('0xcc')][_0x0a9e('0x109')](db['JscriptyQuestionReport'],{'foreignKey':_0x0a9e('0x1bd'),'onDelete':'cascade'});db[_0x0a9e('0xcc')][_0x0a9e('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0x0a9e('0x1bd'),'onDelete':'cascade'});db[_0x0a9e('0xcd')][_0x0a9e('0x142')](db['SmsAccount'],{});db[_0x0a9e('0xcd')][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':'List','foreignKey':_0x0a9e('0x16c')});db[_0x0a9e('0xcd')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154')});db['SmsQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xcd')][_0x0a9e('0x142')](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xcd')]['belongsTo'](db['SmsQueue'],{});db[_0x0a9e('0xd2')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x0a9e('0x1be')});db[_0x0a9e('0xd2')]['hasMany'](db[_0x0a9e('0xca')],{'foreignKey':_0x0a9e('0x1be')});db[_0x0a9e('0xd2')][_0x0a9e('0x109')](db[_0x0a9e('0x1bf')],{'foreignKey':'ProjectId'});db[_0x0a9e('0x134')][_0x0a9e('0x119')](db['User'],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x136')});db[_0x0a9e('0xdc')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x1c0')});db[_0x0a9e('0xdc')]['belongsToMany'](db['VoiceQueue'],{'through':_0x0a9e('0x1c1'),'as':_0x0a9e('0x1c2')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x160'),'as':_0x0a9e('0x125')});db[_0x0a9e('0xdc')][_0x0a9e('0x119')](db['ChatQueue'],{'through':_0x0a9e('0x1c3'),'as':'ChatQueues'});db['Team'][_0x0a9e('0x119')](db['FaxQueue'],{'through':_0x0a9e('0x177'),'as':'FaxQueues'});db[_0x0a9e('0xdc')]['belongsToMany'](db['SmsQueue'],{'through':_0x0a9e('0x17d'),'as':_0x0a9e('0x128')});db[_0x0a9e('0xdc')]['belongsToMany'](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x0a9e('0x129')});db[_0x0a9e('0xdc')]['belongsToMany'](db[_0x0a9e('0xfd')],{'through':'team_has_whatsapp_queues','as':_0x0a9e('0x1c4')});db['Team'][_0x0a9e('0x119')](db[_0x0a9e('0xec')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db['Campaign'][_0x0a9e('0x109')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x13d'),'foreignKey':_0x0a9e('0x193')});db[_0x0a9e('0xdf')][_0x0a9e('0x109')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x13e'),'foreignKey':_0x0a9e('0x193')});db[_0x0a9e('0xdf')][_0x0a9e('0x109')](db[_0x0a9e('0x140')],{'as':_0x0a9e('0x1c5'),'foreignKey':_0x0a9e('0x193')});db[_0x0a9e('0xdf')]['hasMany'](db['CmHopperBlack'],{'as':_0x0a9e('0x1c6'),'foreignKey':_0x0a9e('0x193')});db[_0x0a9e('0xdf')][_0x0a9e('0x142')](db['Trunk'],{'as':_0x0a9e('0x28'),'foreignKey':'TrunkId'});db[_0x0a9e('0xdf')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x0a9e('0xdf')][_0x0a9e('0x142')](db[_0x0a9e('0x144')],{'as':_0x0a9e('0x144'),'foreignKey':'IntervalId'});db['Campaign'][_0x0a9e('0x142')](db['SquareProject'],{'as':_0x0a9e('0x134'),'foreignKey':_0x0a9e('0x1c7')});db['Campaign'][_0x0a9e('0x119')](db['CmList'],{'as':_0x0a9e('0x11f'),'through':_0x0a9e('0x1c8')});db[_0x0a9e('0xdf')][_0x0a9e('0x119')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x1c9')});db[_0x0a9e('0xe1')][_0x0a9e('0x142')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x168')});db[_0x0a9e('0xe2')][_0x0a9e('0x142')](db[_0x0a9e('0x3e')],{});db[_0x0a9e('0xe2')]['belongsTo'](db[_0x0a9e('0x113')],{});db[_0x0a9e('0xe2')][_0x0a9e('0x142')](db['MailAccount'],{'foreignKey':_0x0a9e('0x1ca'),'as':_0x0a9e('0x1cb')});db[_0x0a9e('0xe2')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1cc'),'as':_0x0a9e('0x1cd')});db[_0x0a9e('0xe2')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ce'),'as':'ToAgent'});db[_0x0a9e('0xe2')][_0x0a9e('0x142')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':_0x0a9e('0x1cf')});db['MailTransferReport']['belongsTo'](db[_0x0a9e('0x3b')],{'foreignKey':'ToMailAccountId','as':_0x0a9e('0x1d0')});db['ChatTransferReport'][_0x0a9e('0x142')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe4')]['belongsTo'](db[_0x0a9e('0x64')],{});db['ChatTransferReport']['belongsTo'](db[_0x0a9e('0x60')],{'foreignKey':_0x0a9e('0x1d1'),'as':_0x0a9e('0x1cb')});db[_0x0a9e('0xe4')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1cd')});db[_0x0a9e('0xe4')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ce'),'as':'ToAgent'});db[_0x0a9e('0xe4')][_0x0a9e('0x142')](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1d2'),'as':_0x0a9e('0x1cf')});db[_0x0a9e('0xe4')][_0x0a9e('0x142')](db[_0x0a9e('0x60')],{'foreignKey':_0x0a9e('0x1d3'),'as':_0x0a9e('0x1d0')});db[_0x0a9e('0xe6')][_0x0a9e('0x142')](db[_0x0a9e('0x4a')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x111')],{});db[_0x0a9e('0xe6')]['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1d4'),'as':_0x0a9e('0x1cb')});db[_0x0a9e('0xe6')][_0x0a9e('0x142')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x0a9e('0xe6')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ce'),'as':_0x0a9e('0x1d5')});db[_0x0a9e('0xe6')][_0x0a9e('0x142')](db[_0x0a9e('0x4c')],{'foreignKey':_0x0a9e('0x1d6'),'as':'ToQueue'});db['FaxTransferReport'][_0x0a9e('0x142')](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1d7'),'as':_0x0a9e('0x1d0')});db[_0x0a9e('0x1d8')][_0x0a9e('0x142')](db[_0x0a9e('0x5e')],{});db[_0x0a9e('0x1d8')][_0x0a9e('0x142')](db[_0x0a9e('0x5d')],{});db['OpenchannelTransferReport'][_0x0a9e('0x142')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1cb')});db[_0x0a9e('0x1d8')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1cc'),'as':_0x0a9e('0x1cd')});db[_0x0a9e('0x1d8')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1d5')});db[_0x0a9e('0x1d8')][_0x0a9e('0x142')](db['OpenchannelQueue'],{'foreignKey':_0x0a9e('0x1d9'),'as':_0x0a9e('0x1cf')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x0a9e('0x1d0')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x55')],{});db['SmsTransferReport'][_0x0a9e('0x142')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xe8')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x0a9e('0x1da'),'as':_0x0a9e('0x1cb')});db[_0x0a9e('0xe8')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1cc'),'as':_0x0a9e('0x1cd')});db[_0x0a9e('0xe8')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ce'),'as':'ToAgent'});db[_0x0a9e('0xe8')][_0x0a9e('0x142')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1cf')});db[_0x0a9e('0xe8')][_0x0a9e('0x142')](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1db'),'as':'ToAccount'});db[_0x0a9e('0xea')][_0x0a9e('0x109')](db['Disposition'],{'as':_0x0a9e('0x15a'),'foreignKey':'ListId','onDelete':'cascade'});db['CmList'][_0x0a9e('0x109')](db[_0x0a9e('0x1dc')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x0a9e('0xea')][_0x0a9e('0x109')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16c')});db[_0x0a9e('0xea')][_0x0a9e('0x109')](db['CmHopperFinal'],{'as':_0x0a9e('0x13e'),'foreignKey':_0x0a9e('0x16c')});db[_0x0a9e('0xea')][_0x0a9e('0x109')](db[_0x0a9e('0x140')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x0a9e('0xea')][_0x0a9e('0x109')](db[_0x0a9e('0x73')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db['CmList']['belongsToMany'](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x1dd'),'through':_0x0a9e('0x147')});db[_0x0a9e('0xea')][_0x0a9e('0x119')](db['User'],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x120')});db[_0x0a9e('0xec')][_0x0a9e('0x109')](db[_0x0a9e('0x16')],{'as':'Extensions','onDelete':_0x0a9e('0x107')});db[_0x0a9e('0xec')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':'UserVoicePrefix'});db[_0x0a9e('0xec')][_0x0a9e('0x119')](db['Team'],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x0a9e('0xee')][_0x0a9e('0x109')](db['User'],{'as':_0x0a9e('0x174'),'foreignKey':'userProfileId'});db['UserProfile']['hasMany'](db['UserProfileSection'],{'as':_0x0a9e('0x1de'),'foreignKey':_0x0a9e('0x118'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0x1df')][_0x0a9e('0x109')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x1e0'),'foreignKey':_0x0a9e('0x1e1'),'onDelete':_0x0a9e('0x107')});db[_0x0a9e('0xf3')][_0x0a9e('0x109')](db['Disposition'],{'as':_0x0a9e('0x15a'),'foreignKey':'WhatsappAccountId','onDelete':_0x0a9e('0x107')});db[_0x0a9e('0xf3')][_0x0a9e('0x109')](db[_0x0a9e('0x15b')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x1e2')});db[_0x0a9e('0xf3')][_0x0a9e('0x109')](db[_0x0a9e('0xf7')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x0a9e('0x109')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x15d')});db['WhatsappAccount'][_0x0a9e('0x109')](db[_0x0a9e('0xf4')],{'as':_0x0a9e('0x139')});db['WhatsappAccount'][_0x0a9e('0x142')](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db['WhatsappAccount'][_0x0a9e('0x142')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x17f'),'foreignKey':_0x0a9e('0x146')});db[_0x0a9e('0xf3')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x133')});db[_0x0a9e('0xf4')]['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0xf4')]['belongsTo'](db[_0x0a9e('0xfd')],{'onDelete':_0x0a9e('0x169')});db[_0x0a9e('0xf4')][_0x0a9e('0x142')](db[_0x0a9e('0xf3')],{'onDelete':_0x0a9e('0x169')});db['WhatsappApplication'][_0x0a9e('0x142')](db['Interval'],{'onDelete':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0xf4')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x16a')});db[_0x0a9e('0xf5')][_0x0a9e('0x109')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x14c'),'onDelete':_0x0a9e('0x107'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xf5')][_0x0a9e('0x142')](db[_0x0a9e('0xf3')],{'as':_0x0a9e('0x162'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf5')][_0x0a9e('0x142')](db['CmContact'],{'as':_0x0a9e('0x153'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf5')]['belongsTo'](db[_0x0a9e('0x11')],{'as':'Owner','foreignKey':_0x0a9e('0x108')});db['WhatsappInteraction'][_0x0a9e('0x119')](db[_0x0a9e('0x86')],{'through':'whatsapp_interaction_has_tags','as':_0x0a9e('0x164')});db[_0x0a9e('0xf5')][_0x0a9e('0x119')](db['Tag'],{'through':_0x0a9e('0x19e'),'as':'ThroughTags'});db[_0x0a9e('0xf5')][_0x0a9e('0x119')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x124'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xf7')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xf7')][_0x0a9e('0x142')](db[_0x0a9e('0x11c')],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x153')});db[_0x0a9e('0xf7')][_0x0a9e('0x142')](db[_0x0a9e('0xf5')],{'onDelete':_0x0a9e('0x107'),'as':_0x0a9e('0x166'),'foreignKey':_0x0a9e('0x1e3')});db[_0x0a9e('0xf7')]['belongsTo'](db[_0x0a9e('0xf3')],{'as':'Account','foreignKey':_0x0a9e('0x1e2')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0xf3')],{});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0xea')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x16c')});db['WhatsappQueueReport'][_0x0a9e('0x142')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x0a9e('0xf9')][_0x0a9e('0x142')](db[_0x0a9e('0xf5')],{});db[_0x0a9e('0xf9')][_0x0a9e('0x142')](db[_0x0a9e('0xfd')],{});db[_0x0a9e('0xf9')][_0x0a9e('0x142')](db[_0x0a9e('0xf7')],{});db[_0x0a9e('0xf9')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xfb')][_0x0a9e('0x142')](db[_0x0a9e('0xf7')],{});db[_0x0a9e('0xfb')][_0x0a9e('0x142')](db[_0x0a9e('0xf5')],{});db[_0x0a9e('0xfb')][_0x0a9e('0x142')](db[_0x0a9e('0xf3')],{'foreignKey':'FromWhatsappAccountId','as':_0x0a9e('0x1cb')});db['WhatsappTransferReport'][_0x0a9e('0x142')](db[_0x0a9e('0xf3')],{'foreignKey':_0x0a9e('0x1e4'),'as':'ToAccount'});db[_0x0a9e('0xfb')][_0x0a9e('0x142')](db[_0x0a9e('0xfd')],{'foreignKey':'ToQueueId','as':_0x0a9e('0x1cf')});db[_0x0a9e('0xfb')][_0x0a9e('0x142')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1cc'),'as':_0x0a9e('0x1cd')});db[_0x0a9e('0xfb')]['belongsTo'](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ce'),'as':_0x0a9e('0x1d5')});db['WhatsappQueue']['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0xfd')][_0x0a9e('0x119')](db[_0x0a9e('0xdc')],{'through':_0x0a9e('0x1e5'),'as':_0x0a9e('0x149')});module[_0x0a9e('0x1e6')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x4522=['SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/interval/interval.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','VoiceRecording','VoiceQueuesRt','HopperHistory','OpenchannelInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','UserProfile','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_sms_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueue','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','CmList','ChatWebsite','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Disposition','Dispositions','Interactions','TemplateId','Agents','MailQueue','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','user_has_mail_interactions','MailInteractionId','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','TagId','MailQueueReport','List','ListId','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','Interaction','team_has_sms_queues','OpenchannelAccountId','Answers','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelMessage','OpenchannelQueueId','ProactiveActions','ChatInteraction','user_has_chat_websites','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','CmHopperFinal','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','Extensions','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Action','Actions','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmField','Field','int_desk_configuration_has_tags','FreshdeskAccount','FreshdeskField','VtigerConfiguration','ServicenowAccount','ServicenowField','FreshsalesAccount','ToId','JscriptyAnswerReport','SessionId','ProjectId','FaxQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAgent','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model'];(function(_0x56727c,_0x3a4af4){var _0x1de7ba=function(_0x35a853){while(--_0x35a853){_0x56727c['push'](_0x56727c['shift']());}};_0x1de7ba(++_0x3a4af4);}(_0x4522,0x1a0));var _0x2452=function(_0x2e8e71,_0x2ced06){_0x2e8e71=_0x2e8e71-0x0;var _0x558afd=_0x4522[_0x2e8e71];return _0x558afd;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x2452('0x0'));var jstz=require(_0x2452('0x1'));var timezone=jstz[_0x2452('0x2')]();config['sequelize']=_[_0x2452('0x3')](config[_0x2452('0x4')],{'database':_0x2452('0x5'),'username':_0x2452('0x6'),'password':_0x2452('0x7'),'options':{'host':_0x2452('0x8'),'port':0xcea,'dialect':_0x2452('0x9'),'dialectOptions':{'charset':_0x2452('0xa')},'logging':![],'timezone':timezone[_0x2452('0xb')](),'define':{'charset':_0x2452('0xc'),'collate':_0x2452('0xd')}}});config[_0x2452('0xe')]=_[_0x2452('0x3')](config[_0x2452('0xe')],{'database':_0x2452('0x5'),'username':_0x2452('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2452('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x2452('0xc'),'collate':_0x2452('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2452('0x4')][_0x2452('0xf')],config[_0x2452('0x4')][_0x2452('0x10')],config[_0x2452('0x4')][_0x2452('0x11')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x2452('0xf')],config['sequelizeHistory'][_0x2452('0x10')],config['sequelizeHistory'][_0x2452('0x11')],config[_0x2452('0xe')]['options'])};db[_0x2452('0x12')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x14'));db[_0x2452('0x15')]=db[_0x2452('0x4')]['import'](_0x2452('0x16'));db[_0x2452('0x17')]=db['sequelize']['import'](_0x2452('0x18'));db[_0x2452('0x19')]=db[_0x2452('0x4')]['import'](_0x2452('0x1a'));db[_0x2452('0x1b')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x1c'));db[_0x2452('0x1d')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x2452('0x4')][_0x2452('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x2452('0x1e')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x1f'));db[_0x2452('0x20')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/voiceMail/voiceMail.model');db[_0x2452('0x21')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x22'));db[_0x2452('0x23')]=db['sequelize']['import'](_0x2452('0x24'));db[_0x2452('0x25')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x26'));db['VoiceAgentReport']=db[_0x2452('0x4')][_0x2452('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x27'));db[_0x2452('0x28')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x29'));db['VoiceTransferReport']=db[_0x2452('0x4')][_0x2452('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x2452('0x2a')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x2b'));db[_0x2452('0x2c')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x2d'));db[_0x2452('0x2e')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x2f'));db[_0x2452('0x30')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x31'));db['UserFaxQueue']=db[_0x2452('0x4')]['import'](_0x2452('0x32'));db[_0x2452('0x33')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x34'));db[_0x2452('0x35')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x36'));db['UserWhatsappQueue']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x37'));db[_0x2452('0x38')]=db[_0x2452('0x4')]['import']('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x39'));db[_0x2452('0x3a')]=db[_0x2452('0x4')]['import'](_0x2452('0x3b'));db['MailQueue']=db['sequelize'][_0x2452('0x13')]('../api/mailQueue/mailQueue.model');db[_0x2452('0x3c')]=db[_0x2452('0x4')]['import'](_0x2452('0x3d'));db[_0x2452('0x3e')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x3f'));db[_0x2452('0x40')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/mailMessage/mailMessage.model');db[_0x2452('0x41')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x42'));db['MailQueueReport']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x43'));db[_0x2452('0x44')]=db[_0x2452('0x4')]['import'](_0x2452('0x45'));db[_0x2452('0x46')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x47'));db[_0x2452('0x48')]=db[_0x2452('0x4')]['import'](_0x2452('0x49'));db[_0x2452('0x4a')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x4b'));db[_0x2452('0x4c')]=db['sequelize'][_0x2452('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x2452('0x4d')]=db[_0x2452('0x4')]['import']('../api/faxMessage/faxMessage.model');db['FaxQueue']=db['sequelize'][_0x2452('0x13')]('../api/faxQueue/faxQueue.model');db[_0x2452('0x4e')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x4f'));db['SmsAccount']=db['sequelize'][_0x2452('0x13')]('../api/smsAccount/smsAccount.model');db[_0x2452('0x50')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x51'));db['SmsInteraction']=db['sequelize'][_0x2452('0x13')](_0x2452('0x52'));db[_0x2452('0x53')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/smsMessage/smsMessage.model');db[_0x2452('0x54')]=db['sequelize'][_0x2452('0x13')]('../api/smsQueue/smsQueue.model');db[_0x2452('0x55')]=db[_0x2452('0x4')]['import'](_0x2452('0x56'));db['OpenchannelApplication']=db[_0x2452('0x4')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x57'));db['OpenchannelMessage']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x58'));db[_0x2452('0x59')]=db[_0x2452('0x4')]['import'](_0x2452('0x5a'));db['ChatWebsite']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x5b'));db[_0x2452('0x5c')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x5d'));db[_0x2452('0x5e')]=db[_0x2452('0x4')]['import'](_0x2452('0x5f'));db['ChatInteraction']=db[_0x2452('0x4')]['import'](_0x2452('0x60'));db[_0x2452('0x61')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x62'));db[_0x2452('0x63')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x64'));db[_0x2452('0x65')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x66'));db[_0x2452('0x67')]=db['sequelize'][_0x2452('0x13')]('../api/chatGroup/chatGroup.model');db[_0x2452('0x68')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x69'));db[_0x2452('0x6a')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x6b'));db[_0x2452('0x6c')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x6d'));db[_0x2452('0x6e')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x6f'));db[_0x2452('0x70')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x71'));db['CmHopperFinal']=db[_0x2452('0x4')][_0x2452('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x2452('0x72')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x73'));db[_0x2452('0x74')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x75'));db[_0x2452('0x76')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x2452('0x4')]['import'](_0x2452('0x77'));db[_0x2452('0x78')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x79'));db[_0x2452('0x7a')]=db['sequelize']['import'](_0x2452('0x7b'));db['Disposition']=db[_0x2452('0x4')]['import'](_0x2452('0x7c'));db[_0x2452('0x7d')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/condition/condition.model');db['Interval']=db['sequelize'][_0x2452('0x13')](_0x2452('0x7e'));db['Pause']=db['sequelize']['import']('../api/pause/pause.model');db['Cdr']=db[_0x2452('0x4')]['import']('../api/cdr/cdr.model');db[_0x2452('0x7f')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x80'));db[_0x2452('0x81')]=db[_0x2452('0x4')]['import'](_0x2452('0x82'));db[_0x2452('0x83')]=db[_0x2452('0x4')]['import']('../api/sound/sound.model');db[_0x2452('0x84')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x85'));db[_0x2452('0x86')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x87'));db['Trigger']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x88'));db[_0x2452('0x89')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x8a'));db['Integration']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x8b'));db[_0x2452('0x8c')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x8d'));db[_0x2452('0x8e')]=db['sequelize']['import'](_0x2452('0x8f'));db[_0x2452('0x90')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x2452('0x91')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x92'));db['AnalyticMetric']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x93'));db[_0x2452('0x94')]=db['sequelize']['import'](_0x2452('0x95'));db[_0x2452('0x96')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x97'));db[_0x2452('0x98')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x99'));db[_0x2452('0x9a')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x9b'));db[_0x2452('0x9c')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x9d'));db[_0x2452('0x9e')]=db[_0x2452('0x4')]['import'](_0x2452('0x9f'));db[_0x2452('0xa0')]=db[_0x2452('0x4')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xa1'));db[_0x2452('0xa2')]=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x2452('0xa3')]=db['sequelize'][_0x2452('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x2452('0xa4')]=db['sequelize'][_0x2452('0x13')]('../api/intDeskField/intDeskField.model');db[_0x2452('0xa5')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xa6'));db[_0x2452('0xa7')]=db['sequelize'][_0x2452('0x13')](_0x2452('0xa8'));db[_0x2452('0xa9')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xaa'));db[_0x2452('0xab')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xac'));db[_0x2452('0xad')]=db['sequelize'][_0x2452('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x2452('0xae')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db['sequelize']['import'](_0x2452('0xaf'));db[_0x2452('0xb0')]=db[_0x2452('0x4')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xb1'));db[_0x2452('0xb2')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xb3'));db['VtigerConfiguration']=db[_0x2452('0x4')][_0x2452('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x2452('0xb4')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xb5'));db['ServicenowAccount']=db[_0x2452('0x4')]['import'](_0x2452('0xb6'));db[_0x2452('0xb7')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xb8'));db['ServicenowField']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xb9'));db[_0x2452('0xba')]=db['sequelize'][_0x2452('0x13')](_0x2452('0xbb'));db[_0x2452('0xbc')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xbd'));db[_0x2452('0xbe')]=db['sequelize'][_0x2452('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db['sequelize'][_0x2452('0x13')](_0x2452('0xbf'));db[_0x2452('0xc0')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xc1'));db[_0x2452('0xc2')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db['sequelize'][_0x2452('0x13')]('../api/integration/integration.model');db['Network']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xc3'));db[_0x2452('0xc4')]=db[_0x2452('0x4')]['import'](_0x2452('0xc5'));db[_0x2452('0xc6')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xc7'));db['JscriptyAnswerReport']=db[_0x2452('0x4')]['import'](_0x2452('0xc8'));db[_0x2452('0xc9')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xca'));db[_0x2452('0xcb')]=db['sequelize']['import'](_0x2452('0xcc'));db[_0x2452('0xcd')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xce'));db[_0x2452('0xcf')]=db['sequelize'][_0x2452('0x13')](_0x2452('0xd0'));db[_0x2452('0xd1')]=db[_0x2452('0x4')]['import'](_0x2452('0xd2'));db[_0x2452('0xd3')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xd4'));db['SquareOdbc']=db[_0x2452('0x4')][_0x2452('0x13')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize'][_0x2452('0x13')](_0x2452('0xd5'));db[_0x2452('0xd6')]=db['sequelize'][_0x2452('0x13')](_0x2452('0xd7'));db[_0x2452('0xd8')]=db['sequelize']['import'](_0x2452('0xd9'));db['Team']=db[_0x2452('0x4')][_0x2452('0x13')]('../api/team/team.model');db[_0x2452('0xda')]=db[_0x2452('0x4')][_0x2452('0x13')]('../api/license/license.model');db[_0x2452('0xdb')]=db[_0x2452('0x4')]['import'](_0x2452('0xdc'));db[_0x2452('0xdd')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xde'));db[_0x2452('0xdf')]=db[_0x2452('0x4')]['import'](_0x2452('0xe0'));db[_0x2452('0xe1')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xe2'));db[_0x2452('0xe3')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xe4'));db['ChatTransferReport']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xe5'));db[_0x2452('0xe6')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xe7'));db[_0x2452('0xe8')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xe9'));db['SmsTransferReport']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xea'));db['CmList']=db['sequelize'][_0x2452('0x13')]('../api/cmList/cmList.model');db[_0x2452('0xeb')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xec'));db['UserProfile']=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xed'));db[_0x2452('0xee')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xef'));db[_0x2452('0xf0')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xf1'));db['UserNotification']=db['sequelize']['import'](_0x2452('0xf2'));db[_0x2452('0xf3')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xf4'));db[_0x2452('0xf5')]=db['sequelize']['import'](_0x2452('0xf6'));db[_0x2452('0xf7')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xf8'));db[_0x2452('0xf9')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xfa'));db[_0x2452('0xfb')]=db['sequelize'][_0x2452('0x13')](_0x2452('0xfc'));db[_0x2452('0xfd')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0xfe'));db[_0x2452('0xff')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x100'));db[_0x2452('0x101')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x102'));db[_0x2452('0x103')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x104'));db[_0x2452('0x105')]=db['sequelize'][_0x2452('0x13')](_0x2452('0x106'));db[_0x2452('0x107')]=db[_0x2452('0x4')][_0x2452('0x13')](_0x2452('0x108'));db[_0x2452('0x12')][_0x2452('0x109')](db['VoiceMail'],{'as':_0x2452('0x20'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x10b')});db[_0x2452('0x12')][_0x2452('0x10c')](db[_0x2452('0x10d')],{'as':'Recordings','foreignKey':'UserId'});db['User'][_0x2452('0x10c')](db[_0x2452('0x2a')],{'as':_0x2452('0x10e'),'foreignKey':_0x2452('0x10b')});db[_0x2452('0x12')]['hasMany'](db[_0x2452('0x19')],{'as':'Extensions','onDelete':_0x2452('0x10a'),'hooks':!![]});db[_0x2452('0x12')][_0x2452('0x10c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2452('0x10b')});db['User'][_0x2452('0x10c')](db[_0x2452('0x72')],{'as':_0x2452('0x10f'),'foreignKey':_0x2452('0x10b')});db[_0x2452('0x12')][_0x2452('0x10c')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0x2452('0x10c')](db[_0x2452('0x110')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0x2452('0x12')][_0x2452('0x10c')](db['ChatInteraction'],{'as':_0x2452('0x111'),'foreignKey':_0x2452('0x10b')});db[_0x2452('0x12')][_0x2452('0x10c')](db[_0x2452('0x112')],{'as':_0x2452('0x113'),'foreignKey':'UserId'});db[_0x2452('0x12')][_0x2452('0x10c')](db[_0x2452('0x4c')],{'as':_0x2452('0x114'),'foreignKey':_0x2452('0x10b')});db['User'][_0x2452('0x10c')](db[_0x2452('0x3e')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x2452('0x12')][_0x2452('0x10c')](db[_0x2452('0xf7')],{'as':_0x2452('0x115'),'foreignKey':'UserId'});db[_0x2452('0x12')][_0x2452('0x10c')](db[_0x2452('0x116')],{'as':_0x2452('0x117'),'foreignKey':_0x2452('0x118')});db[_0x2452('0x12')][_0x2452('0x119')](db[_0x2452('0x11a')],{'as':_0x2452('0x11a'),'foreignKey':'userProfileId'});db[_0x2452('0x12')]['belongsToMany'](db['ChatGroup'],{'as':_0x2452('0x11b'),'through':_0x2452('0x11c')});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x6c')],{'as':'Contacts','through':_0x2452('0x11e')});db['User']['belongsToMany'](db['CmList'],{'as':_0x2452('0x11f'),'through':_0x2452('0x120')});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x121')],{'through':_0x2452('0x122')});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x3e')],{'as':_0x2452('0x123'),'through':'user_has_mail_interactions'});db[_0x2452('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0x2452('0x111'),'through':'user_has_chat_interactions'});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x4c')],{'as':_0x2452('0x114'),'through':'user_has_fax_interactions'});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x112')],{'as':_0x2452('0x113'),'through':_0x2452('0x124')});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x110')],{'as':_0x2452('0x125'),'through':'user_has_openchannel_interactions'});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0xf7')],{'as':'WhatsappInteractions','through':_0x2452('0x126')});db['User'][_0x2452('0x11d')](db[_0x2452('0x1d')],{'as':_0x2452('0x127'),'through':_0x2452('0x2c'),'required':![]});db[_0x2452('0x12')]['belongsToMany'](db[_0x2452('0xeb')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db['User'][_0x2452('0x11d')](db['MailQueue'],{'as':_0x2452('0x128'),'through':'UserMailQueue','required':![]});db[_0x2452('0x12')]['belongsToMany'](db[_0x2452('0x65')],{'as':_0x2452('0x129'),'through':_0x2452('0x2e'),'required':![],'hooks':!![]});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x12a')],{'as':'FaxQueues','through':_0x2452('0x12b'),'required':![]});db['User'][_0x2452('0x11d')](db[_0x2452('0x54')],{'as':_0x2452('0x12c'),'through':_0x2452('0x33'),'required':![]});db['User']['belongsToMany'](db[_0x2452('0x59')],{'as':_0x2452('0x12d'),'through':_0x2452('0x35'),'required':![]});db[_0x2452('0x12')]['belongsToMany'](db[_0x2452('0xff')],{'as':_0x2452('0x12e'),'through':'UserWhatsappQueue','required':![]});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x12f')],{'through':_0x2452('0x120')});db['User'][_0x2452('0x11d')](db[_0x2452('0x130')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0x2452('0x11d')](db[_0x2452('0x48')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x3a')],{'as':_0x2452('0x131'),'through':_0x2452('0x132')});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x55')],{'as':_0x2452('0x133'),'through':_0x2452('0x134')});db[_0x2452('0x12')]['belongsToMany'](db[_0x2452('0x135')],{'as':'SmsAccounts','through':_0x2452('0x136')});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0xf3')],{'as':'WhatsappAccounts','through':_0x2452('0x137')});db[_0x2452('0x12')][_0x2452('0x11d')](db[_0x2452('0x138')],{'as':_0x2452('0x139'),'through':_0x2452('0x13a')});db[_0x2452('0x15')][_0x2452('0x10c')](db[_0x2452('0x19')],{'as':_0x2452('0x13b'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x2452('0x17')]['hasMany'](db[_0x2452('0x19')],{'onDelete':'cascade'});db[_0x2452('0x19')][_0x2452('0x10c')](db[_0x2452('0x19')],{'as':_0x2452('0x13c'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x1b')][_0x2452('0x11d')](db[_0x2452('0x83')],{'as':_0x2452('0x13d'),'through':_0x2452('0x13e')});db['VoiceQueue']['hasMany'](db[_0x2452('0x2a')],{'as':_0x2452('0x13f'),'foreignKey':_0x2452('0x140')});db[_0x2452('0x1d')][_0x2452('0x10c')](db[_0x2452('0x6e')],{'as':_0x2452('0x141'),'foreignKey':'VoiceQueueId'});db[_0x2452('0x1d')]['hasMany'](db['CmHopperFinal'],{'as':_0x2452('0x142'),'foreignKey':'VoiceQueueId'});db[_0x2452('0x1d')]['hasMany'](db[_0x2452('0x72')],{'as':_0x2452('0x143'),'foreignKey':_0x2452('0x140')});db[_0x2452('0x1d')][_0x2452('0x10c')](db[_0x2452('0x74')],{'as':_0x2452('0x74'),'foreignKey':_0x2452('0x140')});db[_0x2452('0x1d')][_0x2452('0x10c')](db['CmHopperBlack'],{'as':_0x2452('0x144'),'foreignKey':_0x2452('0x140')});db[_0x2452('0x1d')][_0x2452('0x10c')](db[_0x2452('0xcb')],{'as':_0x2452('0x145'),'foreignKey':'VoiceQueueId'});db[_0x2452('0x1d')][_0x2452('0x119')](db[_0x2452('0x146')],{'as':_0x2452('0x146'),'foreignKey':_0x2452('0x147')});db[_0x2452('0x1d')]['belongsTo'](db[_0x2452('0x146')],{'as':_0x2452('0x148'),'foreignKey':_0x2452('0x149')});db[_0x2452('0x1d')]['belongsTo'](db[_0x2452('0x14a')],{'as':_0x2452('0x14a'),'foreignKey':'IntervalId'});db[_0x2452('0x1d')][_0x2452('0x119')](db[_0x2452('0x14b')],{'as':_0x2452('0x14c'),'foreignKey':_0x2452('0x14d')});db[_0x2452('0x1d')]['belongsToMany'](db[_0x2452('0x12f')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x2452('0x1d')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x2452('0x1d')][_0x2452('0x11d')](db[_0x2452('0x121')],{'as':_0x2452('0x14e'),'through':_0x2452('0x103')});db[_0x2452('0x1d')][_0x2452('0x11d')](db[_0x2452('0x12f')],{'as':_0x2452('0x14f'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x2452('0x119')](db[_0x2452('0x12')],{'as':_0x2452('0x12'),'foreignKey':_0x2452('0x10b')});db[_0x2452('0x1e')]['belongsTo'](db[_0x2452('0x12')],{'as':_0x2452('0x12'),'foreignKey':'UserId'});db[_0x2452('0x20')]['hasMany'](db['VoiceMailMessage'],{'as':_0x2452('0x150'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x151'),'sourceKey':_0x2452('0x152')});db[_0x2452('0x21')]['belongsTo'](db[_0x2452('0x20')],{'foreignKey':_0x2452('0x151'),'targetKey':'mailbox'});db[_0x2452('0x23')]['hasMany'](db['VoiceQueueReport'],{'as':_0x2452('0x153'),'foreignKey':_0x2452('0x154'),'constraints':![]});db[_0x2452('0x23')][_0x2452('0x10c')](db['VoiceAgentReport'],{'as':_0x2452('0x155'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x2452('0x12')],{'as':'User','foreignKey':_0x2452('0x10b')});db[_0x2452('0x23')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db[_0x2452('0x38')][_0x2452('0x119')](db[_0x2452('0x3a')],{'as':'MailAccount','foreignKey':_0x2452('0x158')});db[_0x2452('0x159')][_0x2452('0x119')](db[_0x2452('0x3a')],{'as':_0x2452('0x3a'),'foreignKey':_0x2452('0x158')});db['MailAccount'][_0x2452('0x109')](db[_0x2452('0x38')],{'as':_0x2452('0x15a'),'onDelete':'cascade'});db['MailAccount'][_0x2452('0x109')](db['MailServerOut'],{'as':_0x2452('0x15b'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x3a')][_0x2452('0x10c')](db[_0x2452('0x15c')],{'as':_0x2452('0x15d'),'foreignKey':_0x2452('0x158'),'onDelete':'cascade'});db['MailAccount'][_0x2452('0x10c')](db[_0x2452('0x7a')],{'as':'Answers','foreignKey':_0x2452('0x158')});db[_0x2452('0x3a')]['hasMany'](db[_0x2452('0x40')],{'as':_0x2452('0x150'),'foreignKey':_0x2452('0x158')});db[_0x2452('0x3a')]['hasMany'](db[_0x2452('0x3e')],{'as':_0x2452('0x15e')});db[_0x2452('0x3a')][_0x2452('0x10c')](db[_0x2452('0x41')],{'as':'Applications'});db[_0x2452('0x3a')]['belongsTo'](db[_0x2452('0x12f')],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0x2452('0x119')](db[_0x2452('0x86')],{'as':_0x2452('0x86'),'foreignKey':_0x2452('0x15f')});db[_0x2452('0x3a')][_0x2452('0x119')](db[_0x2452('0x14b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0x2452('0x132')});db['MailQueue'][_0x2452('0x11d')](db['User'],{'as':_0x2452('0x160'),'through':_0x2452('0x30')});db[_0x2452('0x161')]['belongsToMany'](db[_0x2452('0x121')],{'through':_0x2452('0x162'),'as':_0x2452('0x14e')});db[_0x2452('0x3e')][_0x2452('0x10c')](db[_0x2452('0x40')],{'as':_0x2452('0x150'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x2452('0x3e')][_0x2452('0x119')](db[_0x2452('0x3a')],{'as':_0x2452('0x163'),'foreignKey':'MailAccountId'});db[_0x2452('0x3e')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':'Contact','foreignKey':_0x2452('0x157')});db[_0x2452('0x3e')][_0x2452('0x119')](db['User'],{'as':_0x2452('0x164'),'foreignKey':_0x2452('0x10b')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0x2452('0x165'),'as':_0x2452('0x166')});db[_0x2452('0x3e')]['belongsToMany'](db[_0x2452('0x84')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x2452('0x3e')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':'Users','through':_0x2452('0x167'),'foreignKey':_0x2452('0x168')});db[_0x2452('0x40')][_0x2452('0x10c')](db[_0x2452('0xdf')],{'as':_0x2452('0x169'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x40')][_0x2452('0x119')](db[_0x2452('0x12')],{'as':_0x2452('0x12')});db[_0x2452('0x40')]['belongsTo'](db[_0x2452('0x6c')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x156')});db['MailMessage'][_0x2452('0x119')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x2452('0x168')});db[_0x2452('0x40')]['belongsTo'](db[_0x2452('0x3a')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x2452('0x40')]['belongsTo'](db[_0x2452('0x130')],{'as':_0x2452('0x130'),'foreignKey':_0x2452('0x16a')});db[_0x2452('0x40')][_0x2452('0x119')](db[_0x2452('0x63')],{'as':_0x2452('0x63'),'foreignKey':_0x2452('0x16b')});db[_0x2452('0x41')][_0x2452('0x119')](db[_0x2452('0x12')],{'onDelete':_0x2452('0x16c')});db[_0x2452('0x41')][_0x2452('0x119')](db[_0x2452('0x161')],{'onDelete':'restrict'});db[_0x2452('0x41')][_0x2452('0x119')](db['MailAccount'],{'onDelete':_0x2452('0x16c')});db[_0x2452('0x41')][_0x2452('0x119')](db[_0x2452('0x14a')],{'onDelete':_0x2452('0x16c'),'foreignKey':_0x2452('0x16d')});db['MailApplication'][_0x2452('0x119')](db[_0x2452('0x84')],{'onDelete':_0x2452('0x16c'),'foreignKey':_0x2452('0x16e')});db[_0x2452('0x16f')][_0x2452('0x119')](db[_0x2452('0x3a')],{});db[_0x2452('0x16f')][_0x2452('0x119')](db['CmList'],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171')});db['MailQueueReport']['belongsTo'](db[_0x2452('0x6c')],{'as':'Contact','foreignKey':_0x2452('0x157')});db['MailQueueReport']['belongsTo'](db[_0x2452('0x3e')],{});db[_0x2452('0x16f')][_0x2452('0x119')](db[_0x2452('0x40')],{});db['MailQueueReport'][_0x2452('0x119')](db[_0x2452('0x12')],{});db[_0x2452('0x16f')]['belongsTo'](db['MailQueue'],{});db[_0x2452('0x44')][_0x2452('0x10c')](db[_0x2452('0x46')],{'as':'Items','onDelete':'cascade'});db[_0x2452('0x48')][_0x2452('0x10c')](db['Disposition'],{'as':_0x2452('0x15d'),'foreignKey':_0x2452('0x172'),'onDelete':'cascade'});db[_0x2452('0x48')][_0x2452('0x10c')](db[_0x2452('0x7a')],{'as':'Answers','foreignKey':_0x2452('0x172')});db['FaxAccount'][_0x2452('0x10c')](db[_0x2452('0x4c')],{'as':_0x2452('0x15e')});db[_0x2452('0x48')][_0x2452('0x10c')](db[_0x2452('0x4a')],{'as':_0x2452('0x13c')});db[_0x2452('0x48')][_0x2452('0x10c')](db[_0x2452('0x19')],{'as':_0x2452('0x173'),'onDelete':_0x2452('0x10a')});db['FaxAccount'][_0x2452('0x10c')](db[_0x2452('0x4d')],{'as':'Messages'});db[_0x2452('0x48')][_0x2452('0x119')](db[_0x2452('0x146')],{'as':_0x2452('0x146')});db[_0x2452('0x48')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171')});db['FaxAccount'][_0x2452('0x119')](db[_0x2452('0x14b')],{'as':'mandatoryDispositionPause','foreignKey':_0x2452('0x14d')});db[_0x2452('0x48')][_0x2452('0x11d')](db['User'],{'as':'Agents','through':_0x2452('0x174')});db[_0x2452('0x4a')][_0x2452('0x119')](db[_0x2452('0x12')],{'onDelete':'restrict'});db[_0x2452('0x4a')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x2452('0x16c')});db[_0x2452('0x4a')][_0x2452('0x119')](db[_0x2452('0x48')],{'onDelete':_0x2452('0x16c')});db['FaxApplication']['belongsTo'](db[_0x2452('0x84')],{'onDelete':_0x2452('0x16c'),'foreignKey':_0x2452('0x16e')});db['FaxInteraction'][_0x2452('0x10c')](db[_0x2452('0x4d')],{'as':_0x2452('0x150'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x175')});db[_0x2452('0x4c')][_0x2452('0x119')](db[_0x2452('0x48')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x2452('0x4c')][_0x2452('0x119')](db['CmContact'],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db[_0x2452('0x4c')][_0x2452('0x119')](db[_0x2452('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x2452('0x4c')][_0x2452('0x11d')](db['Tag'],{'through':_0x2452('0x176'),'as':'Tags'});db[_0x2452('0x4c')][_0x2452('0x11d')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x2452('0x177')});db['FaxInteraction'][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x178'),'through':_0x2452('0x179'),'foreignKey':_0x2452('0x175')});db['FaxMessage'][_0x2452('0x119')](db[_0x2452('0x12')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x12')});db[_0x2452('0x4d')][_0x2452('0x119')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x2452('0x175')});db[_0x2452('0x4d')][_0x2452('0x119')](db[_0x2452('0x6c')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x156')});db[_0x2452('0x4d')][_0x2452('0x119')](db[_0x2452('0xdf')],{'as':'Attachment','foreignKey':_0x2452('0x17a')});db[_0x2452('0x4d')][_0x2452('0x119')](db['FaxAccount'],{'as':_0x2452('0x163'),'foreignKey':'FaxAccountId'});db[_0x2452('0x12a')]['belongsToMany'](db[_0x2452('0x12')],{'as':'Agents','through':'UserFaxQueue'});db[_0x2452('0x12a')][_0x2452('0x11d')](db['Team'],{'through':_0x2452('0x17b'),'as':_0x2452('0x14e')});db[_0x2452('0x4e')][_0x2452('0x119')](db[_0x2452('0x48')],{});db[_0x2452('0x4e')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':'ListId'});db[_0x2452('0x4e')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db[_0x2452('0x4e')][_0x2452('0x119')](db[_0x2452('0x4c')],{});db[_0x2452('0x4e')][_0x2452('0x119')](db[_0x2452('0x4d')],{});db[_0x2452('0x4e')][_0x2452('0x119')](db[_0x2452('0x12')],{});db[_0x2452('0x4e')]['belongsTo'](db[_0x2452('0x12a')],{});db[_0x2452('0x135')][_0x2452('0x10c')](db['Disposition'],{'as':_0x2452('0x15d'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x2452('0x135')][_0x2452('0x10c')](db[_0x2452('0x7a')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x2452('0x135')][_0x2452('0x10c')](db['SmsMessage'],{'as':_0x2452('0x150'),'foreignKey':_0x2452('0x17c')});db['SmsAccount'][_0x2452('0x10c')](db[_0x2452('0x112')],{'as':_0x2452('0x15e')});db[_0x2452('0x135')][_0x2452('0x10c')](db[_0x2452('0x50')],{'as':'Applications'});db[_0x2452('0x135')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171')});db[_0x2452('0x135')][_0x2452('0x119')](db[_0x2452('0x14b')],{'as':_0x2452('0x14c'),'foreignKey':_0x2452('0x14d')});db['SmsAccount']['belongsToMany'](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x136')});db[_0x2452('0x50')]['belongsTo'](db[_0x2452('0x12')],{'onDelete':'restrict'});db['SmsApplication'][_0x2452('0x119')](db[_0x2452('0x54')],{'onDelete':_0x2452('0x16c')});db[_0x2452('0x50')][_0x2452('0x119')](db[_0x2452('0x135')],{'onDelete':_0x2452('0x16c')});db[_0x2452('0x50')][_0x2452('0x119')](db[_0x2452('0x14a')],{'onDelete':_0x2452('0x16c'),'foreignKey':'IntervalId'});db[_0x2452('0x50')]['belongsTo'](db['Tag'],{'onDelete':_0x2452('0x16c'),'foreignKey':_0x2452('0x16e')});db['SmsInteraction'][_0x2452('0x10c')](db['SmsMessage'],{'as':_0x2452('0x150'),'onDelete':_0x2452('0x10a'),'foreignKey':'SmsInteractionId'});db[_0x2452('0x112')][_0x2452('0x119')](db[_0x2452('0x135')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x17c')});db[_0x2452('0x112')][_0x2452('0x119')](db['CmContact'],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db['SmsInteraction'][_0x2452('0x119')](db[_0x2452('0x12')],{'as':'Owner','foreignKey':_0x2452('0x10b')});db[_0x2452('0x112')][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':_0x2452('0x17d'),'as':_0x2452('0x166')});db['SmsInteraction'][_0x2452('0x11d')](db['Tag'],{'through':_0x2452('0x17d'),'as':'ThroughTags'});db[_0x2452('0x112')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0x2452('0x17e')});db[_0x2452('0x53')][_0x2452('0x119')](db['User'],{'as':_0x2452('0x12')});db[_0x2452('0x53')][_0x2452('0x119')](db[_0x2452('0x6c')],{'onDelete':'cascade','as':_0x2452('0x156')});db['SmsMessage'][_0x2452('0x119')](db[_0x2452('0x112')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x17f'),'foreignKey':'SmsInteractionId'});db[_0x2452('0x53')][_0x2452('0x119')](db[_0x2452('0x135')],{'as':_0x2452('0x163'),'foreignKey':'SmsAccountId'});db[_0x2452('0x54')]['belongsToMany'](db['User'],{'as':_0x2452('0x160'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x2452('0x54')][_0x2452('0x11d')](db[_0x2452('0x121')],{'through':_0x2452('0x180'),'as':_0x2452('0x14e')});db[_0x2452('0x55')][_0x2452('0x10c')](db[_0x2452('0x15c')],{'as':'Dispositions','foreignKey':_0x2452('0x181'),'onDelete':'cascade'});db[_0x2452('0x55')][_0x2452('0x10c')](db['CannedAnswer'],{'as':_0x2452('0x182'),'foreignKey':'OpenchannelAccountId'});db[_0x2452('0x55')][_0x2452('0x10c')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0x2452('0x181')});db[_0x2452('0x55')]['hasMany'](db['OpenchannelMessage'],{'as':_0x2452('0x150'),'foreignKey':_0x2452('0x181')});db[_0x2452('0x55')][_0x2452('0x10c')](db[_0x2452('0x183')],{'as':_0x2452('0x13c'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':'ListId'});db[_0x2452('0x55')]['belongsTo'](db['Pause'],{'as':_0x2452('0x14c'),'foreignKey':_0x2452('0x14d')});db[_0x2452('0x55')]['belongsToMany'](db[_0x2452('0x12')],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x2452('0x119')](db[_0x2452('0x12')],{'onDelete':_0x2452('0x16c')});db[_0x2452('0x183')][_0x2452('0x119')](db[_0x2452('0x59')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x2452('0x183')]['belongsTo'](db[_0x2452('0x55')],{'onDelete':_0x2452('0x16c'),'foreignKey':_0x2452('0x181')});db[_0x2452('0x183')][_0x2452('0x119')](db[_0x2452('0x14a')],{'onDelete':_0x2452('0x16c'),'foreignKey':'IntervalId'});db[_0x2452('0x183')][_0x2452('0x119')](db[_0x2452('0x84')],{'onDelete':'restrict','foreignKey':_0x2452('0x16e')});db['OpenchannelInteraction'][_0x2452('0x10c')](db['OpenchannelMessage'],{'as':_0x2452('0x150'),'onDelete':_0x2452('0x10a'),'foreignKey':'OpenchannelInteractionId'});db[_0x2452('0x110')][_0x2452('0x119')](db[_0x2452('0x55')],{'as':_0x2452('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x2452('0x110')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db['OpenchannelInteraction'][_0x2452('0x119')](db[_0x2452('0x12')],{'as':_0x2452('0x164'),'foreignKey':'UserId'});db[_0x2452('0x110')][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':_0x2452('0x184'),'as':_0x2452('0x166')});db[_0x2452('0x110')][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':_0x2452('0x184'),'as':_0x2452('0x177')});db[_0x2452('0x110')]['belongsToMany'](db['User'],{'as':_0x2452('0x178'),'through':'user_has_openchannel_interactions','foreignKey':_0x2452('0x185')});db[_0x2452('0x186')]['belongsTo'](db[_0x2452('0x12')],{'onDelete':'cascade','as':'User'});db[_0x2452('0x186')]['belongsTo'](db['CmContact'],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x156')});db['OpenchannelMessage'][_0x2452('0x119')](db[_0x2452('0x110')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x17f'),'foreignKey':_0x2452('0x185')});db[_0x2452('0x186')][_0x2452('0x119')](db[_0x2452('0xdf')],{'as':'Attachment','foreignKey':_0x2452('0x17a')});db[_0x2452('0x186')][_0x2452('0x119')](db[_0x2452('0x55')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x181')});db[_0x2452('0x59')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x35'),'foreignKey':_0x2452('0x187')});db[_0x2452('0x59')][_0x2452('0x11d')](db[_0x2452('0x121')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x2452('0x130')][_0x2452('0x10c')](db[_0x2452('0x15c')],{'as':'Dispositions','foreignKey':_0x2452('0x16a'),'onDelete':'cascade'});db[_0x2452('0x130')][_0x2452('0x10c')](db[_0x2452('0x7a')],{'as':_0x2452('0x182'),'foreignKey':_0x2452('0x16a')});db[_0x2452('0x130')][_0x2452('0x10c')](db[_0x2452('0x68')],{'as':_0x2452('0x188')});db[_0x2452('0x130')]['hasMany'](db[_0x2452('0x189')],{'as':_0x2452('0x15e')});db[_0x2452('0x130')][_0x2452('0x10c')](db[_0x2452('0x5e')],{'as':'Applications'});db[_0x2452('0x130')][_0x2452('0x10c')](db[_0x2452('0x61')],{'as':'Messages'});db[_0x2452('0x130')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':'ListId'});db['ChatWebsite']['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0x2452('0x16d')});db['ChatWebsite'][_0x2452('0x119')](db[_0x2452('0x3a')],{'as':'MailAccount','foreignKey':_0x2452('0x158')});db[_0x2452('0x130')]['belongsTo'](db[_0x2452('0x14b')],{'as':_0x2452('0x14c'),'foreignKey':_0x2452('0x14d')});db[_0x2452('0x130')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x18a')});db['OpenchannelQueueReport'][_0x2452('0x119')](db[_0x2452('0x55')],{});db[_0x2452('0x5c')]['belongsTo'](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171')});db[_0x2452('0x5c')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x2452('0x5c')]['belongsTo'](db[_0x2452('0x186')],{});db[_0x2452('0x5c')]['belongsTo'](db['User'],{});db[_0x2452('0x5c')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x2452('0x5e')][_0x2452('0x119')](db['User'],{'as':_0x2452('0x18b'),'foreignKey':_0x2452('0x10b'),'onDelete':_0x2452('0x16c')});db['ChatApplication'][_0x2452('0x119')](db[_0x2452('0x65')],{'as':'Queue','foreignKey':_0x2452('0x18c'),'onDelete':_0x2452('0x16c')});db['ChatApplication'][_0x2452('0x119')](db[_0x2452('0x130')],{'as':_0x2452('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':_0x2452('0x16c')});db['ChatApplication'][_0x2452('0x119')](db[_0x2452('0x84')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x2452('0x189')][_0x2452('0x10c')](db[_0x2452('0x61')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2452('0x18e')});db[_0x2452('0x189')][_0x2452('0x119')](db[_0x2452('0x130')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x16a')});db[_0x2452('0x189')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db[_0x2452('0x189')][_0x2452('0x119')](db[_0x2452('0x12')],{'as':_0x2452('0x164'),'foreignKey':'UserId'});db[_0x2452('0x189')][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':_0x2452('0x18f'),'as':'Tags'});db['ChatInteraction'][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':_0x2452('0x18f'),'as':_0x2452('0x177')});db['ChatInteraction'][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x178'),'through':_0x2452('0x190'),'foreignKey':_0x2452('0x18e')});db[_0x2452('0x61')][_0x2452('0x119')](db['User'],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x12')});db[_0x2452('0x61')][_0x2452('0x119')](db[_0x2452('0x6c')],{'onDelete':_0x2452('0x10a'),'as':'Contact','foreignKey':_0x2452('0x157')});db['ChatMessage'][_0x2452('0x119')](db[_0x2452('0x189')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x17f'),'foreignKey':_0x2452('0x18e')});db[_0x2452('0x61')]['belongsTo'](db['Attachment'],{'as':_0x2452('0xdf'),'foreignKey':_0x2452('0x17a')});db[_0x2452('0x61')]['belongsTo'](db[_0x2452('0x130')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x16a')});db[_0x2452('0x63')][_0x2452('0x10c')](db[_0x2452('0xdf')],{'as':_0x2452('0x169'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x2452('0x10a'),'hooks':!![]});db[_0x2452('0x63')]['belongsTo'](db[_0x2452('0x6c')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x156'),'foreignKey':'ContactId'});db[_0x2452('0x63')][_0x2452('0x119')](db[_0x2452('0x130')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x16a')});db[_0x2452('0x65')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x2e'),'hooks':!![]});db[_0x2452('0x65')]['belongsToMany'](db['Team'],{'through':_0x2452('0x191'),'as':_0x2452('0x14e')});db['ChatGroup'][_0x2452('0x10c')](db[_0x2452('0xc6')],{'as':_0x2452('0x150'),'foreignKey':_0x2452('0x192'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x67')]['belongsToMany'](db[_0x2452('0x12')],{'as':_0x2452('0x13f'),'through':_0x2452('0x11c')});db[_0x2452('0x68')][_0x2452('0x119')](db['ChatWebsite'],{'as':_0x2452('0x18d'),'foreignKey':_0x2452('0x16a')});db[_0x2452('0x6a')][_0x2452('0x10c')](db[_0x2452('0x6c')],{'as':_0x2452('0x193'),'foreignKey':_0x2452('0x194')});db[_0x2452('0x6c')][_0x2452('0x10c')](db[_0x2452('0x6e')],{'as':'Hoppers','foreignKey':_0x2452('0x157')});db['CmContact'][_0x2452('0x10c')](db[_0x2452('0x195')],{'as':_0x2452('0x142'),'foreignKey':'ContactId'});db[_0x2452('0x6c')]['hasMany'](db[_0x2452('0x72')],{'as':_0x2452('0x143'),'foreignKey':_0x2452('0x157')});db['CmContact'][_0x2452('0x10c')](db[_0x2452('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x2452('0x157')});db[_0x2452('0x6c')]['hasMany'](db[_0x2452('0xcb')],{'as':_0x2452('0x145'),'foreignKey':_0x2452('0x157')});db[_0x2452('0x6c')][_0x2452('0x10c')](db[_0x2452('0x110')],{'as':_0x2452('0x125'),'foreignKey':_0x2452('0x157'),'onDelete':'restrict'});db[_0x2452('0x6c')][_0x2452('0x10c')](db[_0x2452('0x189')],{'as':'ChatInteractions','foreignKey':_0x2452('0x157'),'onDelete':_0x2452('0x16c')});db['CmContact']['hasMany'](db[_0x2452('0x112')],{'as':_0x2452('0x113'),'foreignKey':_0x2452('0x157'),'onDelete':_0x2452('0x16c')});db[_0x2452('0x6c')][_0x2452('0x10c')](db['FaxInteraction'],{'as':_0x2452('0x114'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x2452('0x6c')]['hasMany'](db[_0x2452('0x3e')],{'as':'MailInteractions','foreignKey':_0x2452('0x157'),'onDelete':'restrict'});db[_0x2452('0x6c')][_0x2452('0x119')](db[_0x2452('0x6a')],{'as':_0x2452('0x196'),'foreignKey':_0x2452('0x194')});db[_0x2452('0x6c')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171'),'onDelete':_0x2452('0x10a')});db['CmContact'][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x178'),'through':_0x2452('0x11e')});db[_0x2452('0x6c')][_0x2452('0x11d')](db[_0x2452('0x84')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x2452('0x6c')][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':_0x2452('0x197'),'as':_0x2452('0x177')});db['CmHopper'][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x6e')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':'ListId','onDelete':_0x2452('0x10a')});db[_0x2452('0x6e')][_0x2452('0x119')](db['User'],{'as':_0x2452('0x18b'),'foreignKey':_0x2452('0x10b')});db['CmHopper']['belongsTo'](db[_0x2452('0x1d')],{'as':_0x2452('0x198'),'foreignKey':_0x2452('0x140'),'onDelete':_0x2452('0x10a')});db['CmHopper'][_0x2452('0x119')](db[_0x2452('0xdb')],{'as':_0x2452('0xdb'),'foreignKey':_0x2452('0x199'),'onDelete':_0x2452('0x10a')});db['CmHopper'][_0x2452('0x119')](db[_0x2452('0x12')],{'as':_0x2452('0x164'),'foreignKey':_0x2452('0x19a')});db[_0x2452('0x70')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':'Contact','foreignKey':_0x2452('0x157'),'onDelete':_0x2452('0x10a')});db['CmHopperBlack'][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x70')]['belongsTo'](db[_0x2452('0x1d')],{'as':'Queue','foreignKey':_0x2452('0x140'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x70')][_0x2452('0x119')](db['Campaign'],{'as':'Campaign','foreignKey':_0x2452('0x199'),'onDelete':_0x2452('0x10a')});db['Automation'][_0x2452('0x10c')](db['Condition'],{'as':{'plural':_0x2452('0x19b'),'singular':_0x2452('0x19c')},'foreignKey':_0x2452('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0x2452('0x78')]['hasMany'](db['Condition'],{'as':{'plural':_0x2452('0x19e'),'singular':_0x2452('0x19f')},'foreignKey':_0x2452('0x1a0'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x2452('0x10c')](db['Action'],{'as':'Actions','foreignKey':_0x2452('0x1a1'),'onDelete':_0x2452('0x10a'),'hooks':!![]});db[_0x2452('0x15c')][_0x2452('0x10c')](db[_0x2452('0x15c')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x2452('0x10a')});db[_0x2452('0x14a')]['hasMany'](db[_0x2452('0x14a')],{'as':_0x2452('0x1a2'),'foreignKey':_0x2452('0x16d'),'onDelete':_0x2452('0x10a'),'hooks':!![],'required':![]});db['Interval'][_0x2452('0x10c')](db[_0x2452('0x19')],{'as':_0x2452('0x1a3'),'foreignKey':_0x2452('0x16d'),'onDelete':_0x2452('0x16c')});db[_0x2452('0x14a')][_0x2452('0x10c')](db[_0x2452('0x41')],{'as':'MailApplications','foreignKey':_0x2452('0x16d')});db['Interval'][_0x2452('0x10c')](db['ChatApplication'],{'as':_0x2452('0x1a4'),'foreignKey':_0x2452('0x16d')});db[_0x2452('0x14a')][_0x2452('0x10c')](db[_0x2452('0x4a')],{'as':_0x2452('0x1a5'),'foreignKey':_0x2452('0x16d')});db['Interval'][_0x2452('0x10c')](db['SmsApplication'],{'as':_0x2452('0x1a6'),'foreignKey':_0x2452('0x16d')});db[_0x2452('0x81')][_0x2452('0x119')](db['MailAccount'],{});db[_0x2452('0x81')][_0x2452('0x119')](db['AnalyticDefaultReport'],{'foreignKey':_0x2452('0x1a7')});db[_0x2452('0x81')][_0x2452('0x119')](db[_0x2452('0x8e')],{'foreignKey':_0x2452('0x1a8')});db[_0x2452('0x83')][_0x2452('0x11d')](db[_0x2452('0x1b')],{'as':_0x2452('0x1a9'),'through':_0x2452('0x13e'),'onDelete':'restrict'});db['Tag']['belongsToMany'](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x2452('0x84')]['belongsToMany'](db[_0x2452('0x189')],{'through':_0x2452('0x18f')});db[_0x2452('0x84')][_0x2452('0x11d')](db[_0x2452('0x3e')],{'through':'mail_interaction_has_tags'});db[_0x2452('0x84')][_0x2452('0x11d')](db[_0x2452('0x112')],{'through':_0x2452('0x17d')});db['Tag'][_0x2452('0x11d')](db[_0x2452('0x4c')],{'through':_0x2452('0x176')});db[_0x2452('0x84')][_0x2452('0x11d')](db[_0x2452('0x110')],{'through':_0x2452('0x184')});db[_0x2452('0x84')][_0x2452('0x11d')](db[_0x2452('0xf7')],{'through':_0x2452('0x1aa')});db[_0x2452('0x1ab')][_0x2452('0x10c')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x2452('0x1ac')},'foreignKey':_0x2452('0x1ad'),'onDelete':_0x2452('0x10a'),'hooks':!![]});db[_0x2452('0x1ab')][_0x2452('0x10c')](db[_0x2452('0x7d')],{'as':{'plural':_0x2452('0x1ae'),'singular':_0x2452('0x1af')},'foreignKey':'TriggerAnyId','onDelete':_0x2452('0x10a'),'hooks':!![]});db[_0x2452('0x1ab')][_0x2452('0x10c')](db[_0x2452('0x1b0')],{'as':_0x2452('0x1b1'),'foreignKey':'TriggerId','onDelete':_0x2452('0x10a'),'hooks':!![]});db[_0x2452('0x8e')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x2452('0x1b2'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1a8'),'hooks':!![]});db[_0x2452('0x90')][_0x2452('0x10c')](db[_0x2452('0x94')],{'as':'Fields','onDelete':_0x2452('0x10a'),'foreignKey':'DefaultReportId'});db[_0x2452('0x1b3')][_0x2452('0x10c')](db['AnalyticFieldReport'],{'as':_0x2452('0x1b2'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1b4')});db[_0x2452('0x94')][_0x2452('0x119')](db['AnalyticMetric'],{'foreignKey':_0x2452('0x1b4')});db[_0x2452('0x98')]['hasMany'](db[_0x2452('0x9a')],{'as':_0x2452('0x1b5'),'onDelete':'cascade','foreignKey':_0x2452('0x1b6')});db['SalesforceConfiguration'][_0x2452('0x10c')](db[_0x2452('0x9c')],{'as':_0x2452('0x1b7'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0x9a')]['hasMany'](db[_0x2452('0x9c')],{'as':_0x2452('0x1b9'),'onDelete':'cascade','foreignKey':_0x2452('0x1ba')});db[_0x2452('0x9a')][_0x2452('0x10c')](db['SalesforceField'],{'as':'Fields','onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0x9a')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x2452('0x9c')][_0x2452('0x10c')](db[_0x2452('0x9c')],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0x9c')][_0x2452('0x10c')](db[_0x2452('0x9c')],{'as':_0x2452('0x1bd'),'foreignKey':_0x2452('0x1ba')});db['SalesforceField'][_0x2452('0x10c')](db['SalesforceField'],{'as':'Field','foreignKey':_0x2452('0x1bb')});db[_0x2452('0x9c')][_0x2452('0x119')](db[_0x2452('0x89')],{'as':_0x2452('0x89'),'foreignKey':_0x2452('0x1be')});db[_0x2452('0x9e')][_0x2452('0x10c')](db[_0x2452('0xa0')],{'as':_0x2452('0x1b5'),'onDelete':'cascade','foreignKey':_0x2452('0x1b6')});db[_0x2452('0xa0')][_0x2452('0x10c')](db[_0x2452('0x1bf')],{'as':_0x2452('0x1b7'),'onDelete':_0x2452('0x10a'),'foreignKey':'SubjectId'});db[_0x2452('0xa0')]['hasMany'](db[_0x2452('0x1bf')],{'as':_0x2452('0x1b9'),'onDelete':_0x2452('0x10a'),'foreignKey':'DescriptionId'});db[_0x2452('0xa0')][_0x2452('0x10c')](db[_0x2452('0x1bf')],{'as':_0x2452('0x1b2'),'onDelete':'cascade','foreignKey':_0x2452('0x1bb')});db[_0x2452('0xa0')]['belongsTo'](db[_0x2452('0x9e')],{'as':'Account','foreignKey':_0x2452('0x1b6')});db[_0x2452('0x1bf')][_0x2452('0x10c')](db[_0x2452('0x1bf')],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0x1bf')][_0x2452('0x10c')](db[_0x2452('0x1bf')],{'as':_0x2452('0x1bd'),'foreignKey':_0x2452('0x1ba')});db['SugarcrmField'][_0x2452('0x10c')](db[_0x2452('0x1bf')],{'as':_0x2452('0x1c0'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0x1bf')][_0x2452('0x119')](db['Variable'],{'as':'Variable','foreignKey':_0x2452('0x1be')});db[_0x2452('0xa2')]['hasMany'](db[_0x2452('0xa3')],{'as':_0x2452('0x1b5'),'onDelete':_0x2452('0x10a'),'foreignKey':'AccountId'});db[_0x2452('0xa3')][_0x2452('0x10c')](db[_0x2452('0xa4')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x2452('0xa3')][_0x2452('0x10c')](db[_0x2452('0xa4')],{'as':_0x2452('0x1b9'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1ba')});db[_0x2452('0xa3')]['hasMany'](db[_0x2452('0xa4')],{'as':'Fields','onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0xa3')]['belongsTo'](db[_0x2452('0xa2')],{'as':'Account','foreignKey':_0x2452('0x1b6')});db[_0x2452('0xa3')][_0x2452('0x11d')](db['Tag'],{'through':_0x2452('0x1c1')});db[_0x2452('0xa4')][_0x2452('0x10c')](db['DeskField'],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0xa4')][_0x2452('0x10c')](db[_0x2452('0xa4')],{'as':_0x2452('0x1bd'),'foreignKey':_0x2452('0x1ba')});db['DeskField']['hasMany'](db[_0x2452('0xa4')],{'as':_0x2452('0x1c0'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0xa4')][_0x2452('0x119')](db['Variable'],{'as':_0x2452('0x89'),'foreignKey':_0x2452('0x1be')});db[_0x2452('0xa5')]['hasMany'](db[_0x2452('0xa7')],{'as':_0x2452('0x1b5'),'onDelete':_0x2452('0x10a'),'foreignKey':'AccountId'});db[_0x2452('0xa7')][_0x2452('0x10c')](db[_0x2452('0xa9')],{'as':_0x2452('0x1b7'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x2452('0xa7')][_0x2452('0x10c')](db[_0x2452('0xa9')],{'as':_0x2452('0x1b9'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x2452('0xa7')][_0x2452('0x10c')](db[_0x2452('0xa9')],{'as':_0x2452('0x1b2'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1bb')});db['ZohoConfiguration'][_0x2452('0x119')](db[_0x2452('0xa5')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1b6')});db['ZohoField'][_0x2452('0x10c')](db[_0x2452('0xa9')],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0xa9')]['hasMany'](db[_0x2452('0xa9')],{'as':_0x2452('0x1bd'),'foreignKey':_0x2452('0x1ba')});db['ZohoField'][_0x2452('0x10c')](db[_0x2452('0xa9')],{'as':'Field','foreignKey':_0x2452('0x1bb')});db['ZohoField']['belongsTo'](db['Variable'],{'as':_0x2452('0x89'),'foreignKey':'VariableId'});db[_0x2452('0xab')]['hasMany'](db[_0x2452('0xad')],{'as':_0x2452('0x1b5'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0xad')][_0x2452('0x10c')](db[_0x2452('0xae')],{'as':_0x2452('0x1b7'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0xad')]['hasMany'](db[_0x2452('0xae')],{'as':_0x2452('0x1b9'),'foreignKey':_0x2452('0x1ba')});db['ZendeskConfiguration'][_0x2452('0x10c')](db['ZendeskField'],{'as':_0x2452('0x1b2'),'foreignKey':_0x2452('0x1bb')});db['ZendeskConfiguration']['belongsTo'](db[_0x2452('0xab')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0xad')]['belongsToMany'](db[_0x2452('0x84')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x2452('0x10c')](db[_0x2452('0xae')],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db['ZendeskField'][_0x2452('0x10c')](db[_0x2452('0xae')],{'as':'Description','foreignKey':_0x2452('0x1ba')});db[_0x2452('0xae')][_0x2452('0x10c')](db[_0x2452('0xae')],{'as':'Field','foreignKey':'FieldId'});db[_0x2452('0xae')][_0x2452('0x119')](db[_0x2452('0x89')],{'as':_0x2452('0x89'),'foreignKey':_0x2452('0x1be')});db[_0x2452('0x1c2')]['hasMany'](db[_0x2452('0xb0')],{'as':_0x2452('0x1b5'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1b6')});db['FreshdeskConfiguration'][_0x2452('0x10c')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x2452('0x10a'),'foreignKey':'SubjectId'});db[_0x2452('0xb0')]['hasMany'](db['FreshdeskField'],{'as':_0x2452('0x1b9'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1ba')});db[_0x2452('0xb0')][_0x2452('0x10c')](db[_0x2452('0x1c3')],{'as':_0x2452('0x1b2'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0xb0')][_0x2452('0x119')](db[_0x2452('0x1c2')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0xb0')][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x2452('0x10c')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0x2452('0x1b8')});db[_0x2452('0x1c3')][_0x2452('0x10c')](db['FreshdeskField'],{'as':_0x2452('0x1bd'),'foreignKey':'DescriptionId'});db[_0x2452('0x1c3')][_0x2452('0x10c')](db['FreshdeskField'],{'as':_0x2452('0x1c0'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0x1c3')]['belongsTo'](db[_0x2452('0x89')],{'as':_0x2452('0x89'),'foreignKey':'VariableId'});db[_0x2452('0xb2')][_0x2452('0x10c')](db[_0x2452('0x1c4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x2452('0x1b6')});db['VtigerConfiguration']['hasMany'](db[_0x2452('0xb4')],{'as':_0x2452('0x1b7'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0x1c4')][_0x2452('0x10c')](db['VtigerField'],{'as':_0x2452('0x1b9'),'foreignKey':_0x2452('0x1ba')});db['VtigerConfiguration'][_0x2452('0x10c')](db[_0x2452('0xb4')],{'as':_0x2452('0x1b2'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0x1c4')][_0x2452('0x119')](db[_0x2452('0xb2')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0xb4')][_0x2452('0x10c')](db[_0x2452('0xb4')],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2452('0xb4')][_0x2452('0x10c')](db[_0x2452('0xb4')],{'as':_0x2452('0x1c0'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0xb4')]['belongsTo'](db[_0x2452('0x89')],{'as':'Variable','foreignKey':_0x2452('0x1be')});db[_0x2452('0x1c5')]['hasMany'](db[_0x2452('0xb7')],{'as':_0x2452('0x1b5'),'onDelete':'cascade','foreignKey':_0x2452('0x1b6')});db[_0x2452('0xb7')][_0x2452('0x10c')](db[_0x2452('0x1c6')],{'as':_0x2452('0x1b7'),'foreignKey':_0x2452('0x1b8')});db['ServicenowConfiguration'][_0x2452('0x10c')](db[_0x2452('0x1c6')],{'as':'Descriptions','foreignKey':_0x2452('0x1ba')});db[_0x2452('0xb7')][_0x2452('0x10c')](db[_0x2452('0x1c6')],{'as':'Fields','foreignKey':_0x2452('0x1bb')});db['ServicenowConfiguration'][_0x2452('0x119')](db[_0x2452('0x1c5')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0x1c6')][_0x2452('0x10c')](db['ServicenowField'],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x2452('0x1bd'),'foreignKey':_0x2452('0x1ba')});db[_0x2452('0x1c6')][_0x2452('0x10c')](db[_0x2452('0x1c6')],{'as':_0x2452('0x1c0'),'foreignKey':'FieldId'});db['ServicenowField'][_0x2452('0x119')](db[_0x2452('0x89')],{'as':_0x2452('0x89'),'foreignKey':_0x2452('0x1be')});db[_0x2452('0xba')][_0x2452('0x10c')](db['Dynamics365Configuration'],{'as':_0x2452('0x1b5'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0xbc')][_0x2452('0x10c')](db[_0x2452('0xbe')],{'as':_0x2452('0x1b7'),'onDelete':'cascade','foreignKey':_0x2452('0x1b8')});db[_0x2452('0xbc')][_0x2452('0x10c')](db[_0x2452('0xbe')],{'as':_0x2452('0x1b9'),'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1ba')});db[_0x2452('0xbc')][_0x2452('0x10c')](db[_0x2452('0xbe')],{'as':_0x2452('0x1b2'),'onDelete':_0x2452('0x10a'),'foreignKey':'FieldId'});db[_0x2452('0xbc')][_0x2452('0x119')](db['Dynamics365Account'],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0xbe')]['hasMany'](db['Dynamics365Field'],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db['Dynamics365Field'][_0x2452('0x10c')](db[_0x2452('0xbe')],{'as':_0x2452('0x1bd'),'foreignKey':_0x2452('0x1ba')});db['Dynamics365Field'][_0x2452('0x10c')](db[_0x2452('0xbe')],{'as':_0x2452('0x1c0'),'foreignKey':'FieldId'});db[_0x2452('0xbe')][_0x2452('0x119')](db[_0x2452('0x89')],{'as':'Variable','foreignKey':_0x2452('0x1be')});db[_0x2452('0x1c7')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x2452('0x1b5'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db[_0x2452('0xc2')],{'as':_0x2452('0x1b7'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0xc0')][_0x2452('0x10c')](db[_0x2452('0xc2')],{'as':_0x2452('0x1b9'),'foreignKey':'DescriptionId'});db[_0x2452('0xc0')][_0x2452('0x10c')](db[_0x2452('0xc2')],{'as':_0x2452('0x1b2'),'foreignKey':_0x2452('0x1bb')});db[_0x2452('0xc0')][_0x2452('0x119')](db[_0x2452('0x1c7')],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1b6')});db[_0x2452('0xc2')][_0x2452('0x10c')](db[_0x2452('0xc2')],{'as':_0x2452('0x1bc'),'foreignKey':_0x2452('0x1b8')});db[_0x2452('0xc2')][_0x2452('0x10c')](db[_0x2452('0xc2')],{'as':_0x2452('0x1bd'),'foreignKey':_0x2452('0x1ba')});db[_0x2452('0xc2')][_0x2452('0x10c')](db[_0x2452('0xc2')],{'as':'Field','foreignKey':'FieldId'});db['FreshsalesField'][_0x2452('0x119')](db['Variable'],{'as':_0x2452('0x89'),'foreignKey':_0x2452('0x1be')});db[_0x2452('0xc4')][_0x2452('0x119')](db[_0x2452('0x130')],{});db[_0x2452('0xc4')]['belongsTo'](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171')});db['ChatQueueReport']['belongsTo'](db[_0x2452('0x6c')],{'as':'Contact','foreignKey':_0x2452('0x157')});db[_0x2452('0xc4')][_0x2452('0x119')](db[_0x2452('0x189')],{});db[_0x2452('0xc4')][_0x2452('0x119')](db[_0x2452('0x61')],{});db[_0x2452('0xc4')][_0x2452('0x119')](db[_0x2452('0x12')],{});db['ChatQueueReport']['belongsTo'](db[_0x2452('0x65')],{});db[_0x2452('0xc6')]['belongsTo'](db[_0x2452('0x12')],{'onDelete':_0x2452('0x10a'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x2452('0x119')](db[_0x2452('0x12')],{'onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x1c8')});db[_0x2452('0xcb')][_0x2452('0x10c')](db[_0x2452('0xc9')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x2452('0xcb')]['hasMany'](db[_0x2452('0x1c9')],{'foreignKey':_0x2452('0x1ca'),'onDelete':_0x2452('0x10a')});db[_0x2452('0xcd')][_0x2452('0x119')](db[_0x2452('0x135')],{});db['SmsQueueReport'][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':_0x2452('0x171')});db['SmsQueueReport']['belongsTo'](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db[_0x2452('0xcd')][_0x2452('0x119')](db[_0x2452('0x112')],{});db['SmsQueueReport'][_0x2452('0x119')](db[_0x2452('0x53')],{});db[_0x2452('0xcd')][_0x2452('0x119')](db[_0x2452('0x12')],{});db[_0x2452('0xcd')][_0x2452('0x119')](db[_0x2452('0x54')],{});db['JscriptyProject']['hasMany'](db[_0x2452('0xcb')],{'foreignKey':_0x2452('0x1cb')});db[_0x2452('0xd3')]['hasMany'](db[_0x2452('0xc9')],{'foreignKey':_0x2452('0x1cb')});db['JscriptyProject'][_0x2452('0x10c')](db[_0x2452('0x1c9')],{'foreignKey':_0x2452('0x1cb')});db[_0x2452('0x138')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x178'),'through':_0x2452('0x13a')});db[_0x2452('0x121')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x122')});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0x2452('0x103'),'as':_0x2452('0x127')});db[_0x2452('0x121')]['belongsToMany'](db[_0x2452('0x161')],{'through':'team_has_mail_queues','as':_0x2452('0x128')});db[_0x2452('0x121')][_0x2452('0x11d')](db[_0x2452('0x65')],{'through':_0x2452('0x191'),'as':'ChatQueues'});db[_0x2452('0x121')][_0x2452('0x11d')](db[_0x2452('0x12a')],{'through':'team_has_fax_queues','as':_0x2452('0x1cc')});db[_0x2452('0x121')][_0x2452('0x11d')](db['SmsQueue'],{'through':_0x2452('0x180'),'as':'SmsQueues'});db[_0x2452('0x121')][_0x2452('0x11d')](db[_0x2452('0x59')],{'through':'team_has_openchannel_queues','as':_0x2452('0x12d')});db[_0x2452('0x121')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x2452('0x1cd'),'as':_0x2452('0x12e')});db['Team']['belongsToMany'](db[_0x2452('0xeb')],{'through':_0x2452('0x105'),'as':'VoicePrefixes'});db[_0x2452('0xdb')][_0x2452('0x10c')](db[_0x2452('0x6e')],{'as':'Hoppers','foreignKey':_0x2452('0x199')});db[_0x2452('0xdb')][_0x2452('0x10c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2452('0x199')});db[_0x2452('0xdb')][_0x2452('0x10c')](db['CmHopperHistory'],{'as':_0x2452('0x143'),'foreignKey':_0x2452('0x199')});db['Campaign'][_0x2452('0x10c')](db['CmHopperBlack'],{'as':_0x2452('0x144'),'foreignKey':_0x2452('0x199')});db[_0x2452('0xdb')][_0x2452('0x119')](db[_0x2452('0x146')],{'as':_0x2452('0x146'),'foreignKey':_0x2452('0x147')});db[_0x2452('0xdb')][_0x2452('0x119')](db[_0x2452('0x146')],{'as':_0x2452('0x148'),'foreignKey':_0x2452('0x149')});db[_0x2452('0xdb')][_0x2452('0x119')](db[_0x2452('0x14a')],{'as':_0x2452('0x14a'),'foreignKey':_0x2452('0x16d')});db[_0x2452('0xdb')][_0x2452('0x119')](db[_0x2452('0x138')],{'as':_0x2452('0x138'),'foreignKey':_0x2452('0x1ce')});db['Campaign'][_0x2452('0x11d')](db['CmList'],{'as':_0x2452('0x11f'),'through':_0x2452('0x1cf')});db[_0x2452('0xdb')]['belongsToMany'](db[_0x2452('0x12f')],{'as':_0x2452('0x14f'),'through':_0x2452('0x1d0')});db['Attachment'][_0x2452('0x119')](db[_0x2452('0x63')],{'as':'ChatOfflineMessage','foreignKey':_0x2452('0x16b')});db[_0x2452('0xe3')][_0x2452('0x119')](db[_0x2452('0x40')],{});db[_0x2452('0xe3')][_0x2452('0x119')](db['MailInteraction'],{});db[_0x2452('0xe3')]['belongsTo'](db[_0x2452('0x3a')],{'foreignKey':_0x2452('0x1d1'),'as':_0x2452('0x1d2')});db[_0x2452('0xe3')][_0x2452('0x119')](db['User'],{'foreignKey':_0x2452('0x1d3'),'as':'FromAgent'});db['MailTransferReport'][_0x2452('0x119')](db['User'],{'foreignKey':_0x2452('0x1d4'),'as':_0x2452('0x1d5')});db[_0x2452('0xe3')][_0x2452('0x119')](db['MailQueue'],{'foreignKey':_0x2452('0x1d6'),'as':_0x2452('0x1d7')});db[_0x2452('0xe3')]['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x2452('0x1d8')});db[_0x2452('0x1d9')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db[_0x2452('0x189')],{});db['ChatTransferReport'][_0x2452('0x119')](db[_0x2452('0x130')],{'foreignKey':_0x2452('0x1da'),'as':_0x2452('0x1d2')});db[_0x2452('0x1d9')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':_0x2452('0x1d3'),'as':_0x2452('0x1db')});db[_0x2452('0x1d9')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':_0x2452('0x1d4'),'as':_0x2452('0x1d5')});db[_0x2452('0x1d9')][_0x2452('0x119')](db[_0x2452('0x65')],{'foreignKey':'ToChatQueueId','as':_0x2452('0x1d7')});db[_0x2452('0x1d9')][_0x2452('0x119')](db[_0x2452('0x130')],{'foreignKey':'ToChatWebsiteId','as':_0x2452('0x1d8')});db[_0x2452('0xe6')][_0x2452('0x119')](db[_0x2452('0x4d')],{});db['FaxTransferReport']['belongsTo'](db[_0x2452('0x4c')],{});db[_0x2452('0xe6')][_0x2452('0x119')](db[_0x2452('0x48')],{'foreignKey':_0x2452('0x1dc'),'as':_0x2452('0x1d2')});db[_0x2452('0xe6')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2452('0xe6')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':'ToUserId','as':_0x2452('0x1d5')});db['FaxTransferReport']['belongsTo'](db[_0x2452('0x12a')],{'foreignKey':'ToFaxQueueId','as':_0x2452('0x1d7')});db[_0x2452('0xe6')][_0x2452('0x119')](db['FaxAccount'],{'foreignKey':_0x2452('0x1dd'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0x2452('0x119')](db[_0x2452('0x186')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x2452('0x110')],{});db[_0x2452('0xe8')][_0x2452('0x119')](db[_0x2452('0x55')],{'foreignKey':_0x2452('0x1de'),'as':'FromAccount'});db[_0x2452('0xe8')][_0x2452('0x119')](db['User'],{'foreignKey':'FromUserId','as':_0x2452('0x1db')});db[_0x2452('0xe8')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':'ToUserId','as':_0x2452('0x1d5')});db[_0x2452('0xe8')][_0x2452('0x119')](db['OpenchannelQueue'],{'foreignKey':_0x2452('0x1df'),'as':_0x2452('0x1d7')});db[_0x2452('0xe8')][_0x2452('0x119')](db[_0x2452('0x55')],{'foreignKey':_0x2452('0x1e0'),'as':'ToAccount'});db[_0x2452('0x1e1')]['belongsTo'](db[_0x2452('0x53')],{});db['SmsTransferReport'][_0x2452('0x119')](db['SmsInteraction'],{});db[_0x2452('0x1e1')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x2452('0x1e2'),'as':_0x2452('0x1d2')});db[_0x2452('0x1e1')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2452('0x1e1')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':'ToUserId','as':_0x2452('0x1d5')});db[_0x2452('0x1e1')][_0x2452('0x119')](db[_0x2452('0x54')],{'foreignKey':_0x2452('0x1e3'),'as':_0x2452('0x1d7')});db[_0x2452('0x1e1')][_0x2452('0x119')](db[_0x2452('0x135')],{'foreignKey':'ToSmsAccountId','as':_0x2452('0x1d8')});db[_0x2452('0x12f')]['hasMany'](db[_0x2452('0x15c')],{'as':'Dispositions','foreignKey':_0x2452('0x171'),'onDelete':_0x2452('0x10a')});db[_0x2452('0x12f')]['hasMany'](db[_0x2452('0x76')],{'as':_0x2452('0x1e4'),'foreignKey':_0x2452('0x171')});db[_0x2452('0x12f')]['hasMany'](db[_0x2452('0x6c')],{'as':'Contacts','onDelete':_0x2452('0x10a'),'foreignKey':_0x2452('0x171')});db[_0x2452('0x12f')][_0x2452('0x10c')](db['CmHopperFinal'],{'as':_0x2452('0x142'),'foreignKey':_0x2452('0x171')});db[_0x2452('0x12f')]['hasMany'](db[_0x2452('0x72')],{'as':_0x2452('0x10f'),'foreignKey':_0x2452('0x171')});db[_0x2452('0x12f')][_0x2452('0x10c')](db[_0x2452('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x2452('0x171')});db[_0x2452('0x12f')]['belongsToMany'](db[_0x2452('0x1d')],{'as':'Queues','through':_0x2452('0x1e5')});db[_0x2452('0x12f')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':'cm_user_has_lists'});db[_0x2452('0xeb')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x2452('0xeb')]['belongsToMany'](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x107')});db['VoicePrefix'][_0x2452('0x11d')](db[_0x2452('0x121')],{'through':_0x2452('0x105'),'as':_0x2452('0x14e')});db[_0x2452('0x11a')][_0x2452('0x10c')](db[_0x2452('0x12')],{'as':_0x2452('0x178'),'foreignKey':_0x2452('0x1e6')});db[_0x2452('0x11a')][_0x2452('0x10c')](db[_0x2452('0xee')],{'as':_0x2452('0x1e7'),'foreignKey':_0x2452('0x1e6'),'onDelete':_0x2452('0x10a')});db['UserProfileSection']['hasMany'](db[_0x2452('0xf0')],{'as':'Resources','foreignKey':_0x2452('0x1e8'),'onDelete':_0x2452('0x10a')});db[_0x2452('0xf3')]['hasMany'](db[_0x2452('0x15c')],{'as':_0x2452('0x15d'),'foreignKey':_0x2452('0x1e9'),'onDelete':_0x2452('0x10a')});db['WhatsappAccount'][_0x2452('0x10c')](db[_0x2452('0x7a')],{'as':_0x2452('0x182'),'foreignKey':_0x2452('0x1e9')});db['WhatsappAccount'][_0x2452('0x10c')](db[_0x2452('0xf9')],{'as':_0x2452('0x150'),'foreignKey':_0x2452('0x1e9')});db['WhatsappAccount'][_0x2452('0x10c')](db[_0x2452('0xf7')],{'as':_0x2452('0x15e')});db['WhatsappAccount']['hasMany'](db[_0x2452('0xf5')],{'as':'Applications'});db[_0x2452('0xf3')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':'ListId'});db[_0x2452('0xf3')]['belongsTo'](db['Pause'],{'as':_0x2452('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2452('0xf3')][_0x2452('0x11d')](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x137')});db[_0x2452('0xf5')][_0x2452('0x119')](db[_0x2452('0x12')],{'onDelete':_0x2452('0x16c')});db[_0x2452('0xf5')][_0x2452('0x119')](db['WhatsappQueue'],{'onDelete':_0x2452('0x16c')});db['WhatsappApplication']['belongsTo'](db[_0x2452('0xf3')],{'onDelete':_0x2452('0x16c')});db[_0x2452('0xf5')]['belongsTo'](db[_0x2452('0x14a')],{'onDelete':'restrict','foreignKey':_0x2452('0x16d')});db[_0x2452('0xf5')]['belongsTo'](db[_0x2452('0x84')],{'onDelete':'restrict','foreignKey':_0x2452('0x16e')});db[_0x2452('0xf7')][_0x2452('0x10c')](db[_0x2452('0xf9')],{'as':'Messages','onDelete':_0x2452('0x10a'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x2452('0x119')](db['WhatsappAccount'],{'as':_0x2452('0x163'),'foreignKey':_0x2452('0x1e9')});db['WhatsappInteraction']['belongsTo'](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':'ContactId'});db[_0x2452('0xf7')][_0x2452('0x119')](db[_0x2452('0x12')],{'as':_0x2452('0x164'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':'whatsapp_interaction_has_tags','as':_0x2452('0x166')});db['WhatsappInteraction'][_0x2452('0x11d')](db[_0x2452('0x84')],{'through':_0x2452('0x1aa'),'as':_0x2452('0x177')});db['WhatsappInteraction'][_0x2452('0x11d')](db['User'],{'as':_0x2452('0x178'),'through':_0x2452('0x126'),'foreignKey':_0x2452('0x1ea')});db['WhatsappMessage']['belongsTo'](db[_0x2452('0x12')],{'as':_0x2452('0x12')});db[_0x2452('0xf9')][_0x2452('0x119')](db['CmContact'],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x156')});db[_0x2452('0xf9')]['belongsTo'](db[_0x2452('0xf7')],{'onDelete':_0x2452('0x10a'),'as':_0x2452('0x17f'),'foreignKey':_0x2452('0x1ea')});db['WhatsappMessage'][_0x2452('0x119')](db[_0x2452('0xf3')],{'as':_0x2452('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x2452('0xfb')][_0x2452('0x119')](db['WhatsappAccount'],{});db[_0x2452('0xfb')][_0x2452('0x119')](db[_0x2452('0x12f')],{'as':_0x2452('0x170'),'foreignKey':'ListId'});db[_0x2452('0xfb')][_0x2452('0x119')](db[_0x2452('0x6c')],{'as':_0x2452('0x156'),'foreignKey':_0x2452('0x157')});db[_0x2452('0xfb')][_0x2452('0x119')](db['WhatsappInteraction'],{});db[_0x2452('0xfb')][_0x2452('0x119')](db[_0x2452('0xff')],{});db['WhatsappQueueReport'][_0x2452('0x119')](db['WhatsappMessage'],{});db[_0x2452('0xfb')]['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0x2452('0x119')](db[_0x2452('0xf9')],{});db[_0x2452('0xfd')][_0x2452('0x119')](db[_0x2452('0xf7')],{});db[_0x2452('0xfd')][_0x2452('0x119')](db[_0x2452('0xf3')],{'foreignKey':'FromWhatsappAccountId','as':_0x2452('0x1d2')});db[_0x2452('0xfd')][_0x2452('0x119')](db['WhatsappAccount'],{'foreignKey':_0x2452('0x1eb'),'as':'ToAccount'});db[_0x2452('0xfd')][_0x2452('0x119')](db[_0x2452('0xff')],{'foreignKey':_0x2452('0x1ec'),'as':'ToQueue'});db[_0x2452('0xfd')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x2452('0x1db')});db[_0x2452('0xfd')][_0x2452('0x119')](db[_0x2452('0x12')],{'foreignKey':'ToUserId','as':_0x2452('0x1d5')});db[_0x2452('0xff')]['belongsToMany'](db[_0x2452('0x12')],{'as':_0x2452('0x160'),'through':_0x2452('0x1ed'),'foreignKey':_0x2452('0x1ee')});db[_0x2452('0xff')][_0x2452('0x11d')](db[_0x2452('0x121')],{'through':_0x2452('0x1cd'),'as':'Teams'});module[_0x2452('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 610917d..184b521 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a5d=['./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/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/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','username','newPassword','apiKey','lastName','street','phone','mobile','fax','clientId','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','pass','accountSid','localstationid','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','connection','role','other','agent_id','agent_name','test','./api/user','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/fax/accounts','/api/fax/applications','/api/fax/interactions'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x2a5d,0xfa));var _0xd2a5=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x2a5d[_0x211632];return _0x5a1da1;};'use strict';var _=require(_0xd2a5('0x0'));var path=require(_0xd2a5('0x1'));var express=require(_0xd2a5('0x2'));var ewinston=require(_0xd2a5('0x3'));var util=require(_0xd2a5('0x4'));var errors=require(_0xd2a5('0x5'));var config=require('./config/environment');var logger=require(_0xd2a5('0x6'))(_0xd2a5('0x7'));var authLogger=require(_0xd2a5('0x6'))(_0xd2a5('0x8'));exports[_0xd2a5('0x9')]=function(_0x3ae670){_0x3ae670[_0xd2a5('0xa')](ewinston[_0xd2a5('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x544c60,_0x47429a){var _0x473b86=_0xd2a5('0xc');if(!_[_0xd2a5('0xd')](_0x544c60[_0xd2a5('0xe')])){_0x473b86+='\x20body=%s';var _0x335525=_0x544c60[_0xd2a5('0xe')];maskSensitiveData(_0x335525);}return util['format'](_0x473b86,_0x544c60[_0xd2a5('0xf')],_0x544c60[_0xd2a5('0x10')][_0xd2a5('0x11')]?_0x544c60[_0xd2a5('0x10')]['x-forwarded-for']:_0x544c60['connection'][_0xd2a5('0x12')]||_0x544c60['ip'],_0x544c60[_0xd2a5('0x13')],_0x47429a[_0xd2a5('0x14')],_0x47429a[_0xd2a5('0x15')],_0x544c60[_0xd2a5('0x16')]?_0x544c60[_0xd2a5('0x16')]['id']:null,_0x544c60[_0xd2a5('0x16')]?_0x544c60['user'][_0xd2a5('0x17')]:null,_0x544c60[_0xd2a5('0x16')]?_0x544c60[_0xd2a5('0x16')]['role']:null,_0x335525?util[_0xd2a5('0x18')](_0x335525,![],null):'');}}));_0x3ae670[_0xd2a5('0xa')](ewinston[_0xd2a5('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x308c61,_0x29f7af){var _0x10bbe9=_0xd2a5('0x19');if(_0x308c61[_0xd2a5('0xe')]&&_0x308c61[_0xd2a5('0xe')][_0xd2a5('0x1a')]&&_0x308c61[_0xd2a5('0xe')]['agent_id']){_0x10bbe9=_0xd2a5('0x1b');}return util[_0xd2a5('0x1c')](_0x10bbe9,_0x308c61[_0xd2a5('0xf')],_0x308c61[_0xd2a5('0x10')]['x-forwarded-for']?_0x308c61[_0xd2a5('0x10')]['x-forwarded-for']:_0x308c61[_0xd2a5('0x1d')]['remoteAddress']||_0x308c61['ip'],_0x308c61[_0xd2a5('0x13')],_0x29f7af[_0xd2a5('0x14')],_0x29f7af[_0xd2a5('0x15')],_0x308c61[_0xd2a5('0x16')]?_0x308c61['user']['id']:null,_0x308c61[_0xd2a5('0x16')]?_0x308c61[_0xd2a5('0x16')]['name']:null,_0x308c61[_0xd2a5('0x16')]?_0x308c61[_0xd2a5('0x16')][_0xd2a5('0x1e')]:null,_0x308c61[_0xd2a5('0xe')]&&_0x308c61[_0xd2a5('0xe')][_0xd2a5('0x1a')]?_0x308c61['body'][_0xd2a5('0x1a')]:_0xd2a5('0x1f'),_0x308c61[_0xd2a5('0xe')]&&_0x308c61['body']['agent_id']?_0x308c61[_0xd2a5('0xe')][_0xd2a5('0x20')]:'',_0x308c61[_0xd2a5('0xe')]&&_0x308c61[_0xd2a5('0xe')][_0xd2a5('0x21')]?_0x308c61[_0xd2a5('0xe')]['agent_name']:'');},'ignoreRoute':function(_0x4e118d){var _0x137b06=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x137b06[_0xd2a5('0x22')](_0x4e118d[_0xd2a5('0x13')]);}}));_0x3ae670[_0xd2a5('0xa')]('/api/users',require(_0xd2a5('0x23')));_0x3ae670[_0xd2a5('0xa')]('/api/voice/chanspy',require(_0xd2a5('0x24')));_0x3ae670[_0xd2a5('0xa')]('/api/voice/contexts',require('./api/voiceContext'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x25'),require(_0xd2a5('0x26')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x27'),require(_0xd2a5('0x28')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x29'),require(_0xd2a5('0x2a')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x2b'),require(_0xd2a5('0x2c')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x2d'),require(_0xd2a5('0x2e')));_0x3ae670[_0xd2a5('0xa')]('/api/voice/mails',require(_0xd2a5('0x2f')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x30'),require('./api/voiceMailMessage'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x31'),require(_0xd2a5('0x32')));_0x3ae670['use'](_0xd2a5('0x33'),require(_0xd2a5('0x34')));_0x3ae670['use'](_0xd2a5('0x35'),require(_0xd2a5('0x36')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x37'),require(_0xd2a5('0x38')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x39'),require(_0xd2a5('0x3a')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x3b'),require('./api/trunk'));_0x3ae670['use'](_0xd2a5('0x3c'),require(_0xd2a5('0x3d')));_0x3ae670['use'](_0xd2a5('0x3e'),require(_0xd2a5('0x3f')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x40'),require(_0xd2a5('0x41')));_0x3ae670[_0xd2a5('0xa')]('/api/mail/queues',require('./api/mailQueue'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x42'),require(_0xd2a5('0x43')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x44'),require('./api/mailInteraction'));_0x3ae670[_0xd2a5('0xa')]('/api/mail/messages',require(_0xd2a5('0x45')));_0x3ae670['use'](_0xd2a5('0x46'),require(_0xd2a5('0x47')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x48'),require(_0xd2a5('0x49')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x4a'),require('./api/dashboard'));_0x3ae670['use']('/api/dashboards/items',require('./api/dashboardItem'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x4b'),require('./api/faxAccount'));_0x3ae670['use'](_0xd2a5('0x4c'),require('./api/faxApplication'));_0x3ae670['use'](_0xd2a5('0x4d'),require(_0xd2a5('0x4e')));_0x3ae670['use'](_0xd2a5('0x4f'),require('./api/faxMessage'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x50'),require('./api/faxQueue'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x51'),require(_0xd2a5('0x52')));_0x3ae670['use'](_0xd2a5('0x53'),require('./api/smsAccount'));_0x3ae670['use'](_0xd2a5('0x54'),require('./api/smsApplication'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x55'),require('./api/smsInteraction'));_0x3ae670[_0xd2a5('0xa')]('/api/sms/messages',require(_0xd2a5('0x56')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x57'),require(_0xd2a5('0x58')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x59'),require('./api/openchannelAccount'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x5a'),require(_0xd2a5('0x5b')));_0x3ae670['use'](_0xd2a5('0x5c'),require('./api/openchannelInteraction'));_0x3ae670[_0xd2a5('0xa')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x3ae670['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x5d'),require(_0xd2a5('0x5e')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x5f'),require(_0xd2a5('0x60')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x61'),require(_0xd2a5('0x62')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x63'),require('./api/chatInteraction'));_0x3ae670['use'](_0xd2a5('0x64'),require('./api/chatMessage'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x65'),require(_0xd2a5('0x66')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x67'),require(_0xd2a5('0x68')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x69'),require(_0xd2a5('0x6a')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x6b'),require(_0xd2a5('0x6c')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x6d'),require(_0xd2a5('0x6e')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x6f'),require(_0xd2a5('0x70')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x71'),require(_0xd2a5('0x72')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x73'),require(_0xd2a5('0x74')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x75'),require(_0xd2a5('0x76')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x77'),require(_0xd2a5('0x78')));_0x3ae670[_0xd2a5('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x79'),require('./api/action'));_0x3ae670['use']('/api/automations',require(_0xd2a5('0x7a')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x7b'),require(_0xd2a5('0x7c')));_0x3ae670[_0xd2a5('0xa')]('/api/dispositions',require('./api/disposition'));_0x3ae670['use'](_0xd2a5('0x7d'),require(_0xd2a5('0x7e')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x7f'),require(_0xd2a5('0x80')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x81'),require('./api/pause'));_0x3ae670['use']('/api/cdr',require(_0xd2a5('0x82')));_0x3ae670['use'](_0xd2a5('0x83'),require(_0xd2a5('0x84')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x85'),require(_0xd2a5('0x86')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x87'),require(_0xd2a5('0x88')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x89'),require(_0xd2a5('0x8a')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x8b'),require('./api/template'));_0x3ae670[_0xd2a5('0xa')]('/api/triggers',require('./api/trigger'));_0x3ae670['use'](_0xd2a5('0x8c'),require(_0xd2a5('0x8d')));_0x3ae670['use'](_0xd2a5('0x8e'),require(_0xd2a5('0x8f')));_0x3ae670['use'](_0xd2a5('0x90'),require(_0xd2a5('0x91')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x92'),require(_0xd2a5('0x93')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x94'),require(_0xd2a5('0x95')));_0x3ae670[_0xd2a5('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x3ae670[_0xd2a5('0xa')]('/api/analytics/metrics',require(_0xd2a5('0x96')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x97'),require(_0xd2a5('0x98')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x99'),require(_0xd2a5('0x9a')));_0x3ae670['use'](_0xd2a5('0x9b'),require('./api/intSalesforceAccount'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x9c'),require(_0xd2a5('0x9d')));_0x3ae670['use']('/api/integrations/salesforce/fields',require(_0xd2a5('0x9e')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x9f'),require('./api/intSugarcrmAccount'));_0x3ae670[_0xd2a5('0xa')]('/api/integrations/sugarcrm/configurations',require(_0xd2a5('0xa0')));_0x3ae670['use'](_0xd2a5('0xa1'),require(_0xd2a5('0xa2')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xa3'),require('./api/intDeskAccount'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xa4'),require(_0xd2a5('0xa5')));_0x3ae670['use']('/api/integrations/desk/fields',require(_0xd2a5('0xa6')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xa7'),require(_0xd2a5('0xa8')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xa9'),require(_0xd2a5('0xaa')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xab'),require(_0xd2a5('0xac')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xad'),require(_0xd2a5('0xae')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xaf'),require(_0xd2a5('0xb0')));_0x3ae670['use'](_0xd2a5('0xb1'),require('./api/intZendeskField'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xb2'),require('./api/intFreshdeskAccount'));_0x3ae670[_0xd2a5('0xa')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x3ae670[_0xd2a5('0xa')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x3ae670['use'](_0xd2a5('0xb3'),require('./api/intVtigerAccount'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xb4'),require(_0xd2a5('0xb5')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xb6'),require(_0xd2a5('0xb7')));_0x3ae670[_0xd2a5('0xa')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x3ae670[_0xd2a5('0xa')]('/api/integrations/servicenow/configurations',require(_0xd2a5('0xb8')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xb9'),require(_0xd2a5('0xba')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xbb'),require('./api/intDynamics365Account'));_0x3ae670['use'](_0xd2a5('0xbc'),require('./api/intDynamics365Configuration'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xbd'),require(_0xd2a5('0xbe')));_0x3ae670[_0xd2a5('0xa')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x3ae670['use'](_0xd2a5('0xbf'),require(_0xd2a5('0xc0')));_0x3ae670['use'](_0xd2a5('0xc1'),require('./api/intFreshsalesField'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xc2'),require(_0xd2a5('0xc3')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xc4'),require('./api/chatQueueReport'));_0x3ae670['use'](_0xd2a5('0xc5'),require(_0xd2a5('0xc6')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xc7'),require(_0xd2a5('0xc8')));_0x3ae670['use'](_0xd2a5('0xc9'),require(_0xd2a5('0xca')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xcb'),require('./api/jscriptySessionReport'));_0x3ae670[_0xd2a5('0xa')]('/api/sms/reports/queue',require(_0xd2a5('0xcc')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xcd'),require(_0xd2a5('0xce')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xcf'),require('./api/squareReportDetail'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xd0'),require(_0xd2a5('0xd1')));_0x3ae670['use'](_0xd2a5('0xd2'),require(_0xd2a5('0xd3')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xd4'),require(_0xd2a5('0xd5')));_0x3ae670['use']('/api/square/projects',require('./api/squareProject'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xd6'),require(_0xd2a5('0xd7')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xd8'),require(_0xd2a5('0xd9')));_0x3ae670[_0xd2a5('0xa')]('/api/teams',require(_0xd2a5('0xda')));_0x3ae670['use']('/api/license',require(_0xd2a5('0xdb')));_0x3ae670[_0xd2a5('0xa')]('/api/campaigns',require('./api/campaign'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xdc'),require(_0xd2a5('0xdd')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xde'),require(_0xd2a5('0xdf')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xe0'),require('./api/plugin'));_0x3ae670[_0xd2a5('0xa')]('/api/mail/reports/transfer',require(_0xd2a5('0xe1')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xe2'),require(_0xd2a5('0xe3')));_0x3ae670['use'](_0xd2a5('0xe4'),require('./api/faxTransferReport'));_0x3ae670['use'](_0xd2a5('0xe5'),require(_0xd2a5('0xe6')));_0x3ae670[_0xd2a5('0xa')]('/api/sms/reports/transfer',require(_0xd2a5('0xe7')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xe8'),require(_0xd2a5('0xe9')));_0x3ae670['use'](_0xd2a5('0xea'),require(_0xd2a5('0xeb')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xec'),require(_0xd2a5('0xed')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xee'),require('./api/userProfileSection'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xef'),require('./api/userProfileResource'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xf0'),require(_0xd2a5('0xf1')));_0x3ae670['use'](_0xd2a5('0xf2'),require(_0xd2a5('0xf3')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xf4'),require(_0xd2a5('0xf5')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xf6'),require(_0xd2a5('0xf7')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xf8'),require(_0xd2a5('0xf9')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xfa'),require('./api/whatsappQueueReport'));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xfb'),require(_0xd2a5('0xfc')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0xfd'),require(_0xd2a5('0xfe')));_0x3ae670['use']('/api/cloudProviders',require(_0xd2a5('0xff')));_0x3ae670['use'](_0xd2a5('0x100'),require(_0xd2a5('0x101')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x102'),require(_0xd2a5('0x103')));_0x3ae670['use'](_0xd2a5('0x104'),require(_0xd2a5('0x105')));_0x3ae670['use']('/api/jira',require(_0xd2a5('0x106')));_0x3ae670['use'](_0xd2a5('0x107'),require(_0xd2a5('0x108')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x109'),require(_0xd2a5('0x10a')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x10b'),require(_0xd2a5('0x10c')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x10d'),require(_0xd2a5('0x10e')));_0x3ae670['use'](_0xd2a5('0x10f'),require(_0xd2a5('0x110')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x111'),express[_0xd2a5('0x112')](path[_0xd2a5('0x113')](config[_0xd2a5('0x114')],_0xd2a5('0x111'))));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x115'),express[_0xd2a5('0x112')](path[_0xd2a5('0x113')](config[_0xd2a5('0x114')],_0xd2a5('0x115'))));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x116'),express[_0xd2a5('0x112')](path[_0xd2a5('0x113')](config[_0xd2a5('0x114')],_0xd2a5('0x116'))));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x117'),express[_0xd2a5('0x112')](path[_0xd2a5('0x113')](config[_0xd2a5('0x114')],_0xd2a5('0x118'),'3.0.0')));_0x3ae670[_0xd2a5('0xa')](_0xd2a5('0x119'),express[_0xd2a5('0x112')](path[_0xd2a5('0x113')](config['root'],_0xd2a5('0x11a'))));_0x3ae670[_0xd2a5('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xd2a5('0x11c')](errors[0x194]);_0x3ae670[_0xd2a5('0x11b')]('/*')['get'](function(_0x5420ea,_0x44cc7a){_0x44cc7a[_0xd2a5('0x11d')](path[_0xd2a5('0x11e')](_0x3ae670[_0xd2a5('0x11c')]('appPath')+_0xd2a5('0x11f')));});};var sensitiveFields=[_0xd2a5('0x120'),'password',_0xd2a5('0x121'),_0xd2a5('0x122'),'firstName',_0xd2a5('0x123'),_0xd2a5('0x124'),_0xd2a5('0x125'),_0xd2a5('0x126'),_0xd2a5('0x127'),'email',_0xd2a5('0x128'),'clientSecret',_0xd2a5('0x129'),_0xd2a5('0x12a'),_0xd2a5('0x12b'),_0xd2a5('0x12c'),_0xd2a5('0x12d'),_0xd2a5('0x12e'),_0xd2a5('0x12f'),_0xd2a5('0x130'),_0xd2a5('0x131'),_0xd2a5('0x132'),_0xd2a5('0x133'),_0xd2a5('0x134'),_0xd2a5('0x135'),_0xd2a5('0x136'),_0xd2a5('0x137'),_0xd2a5('0x138'),'clientEmail',_0xd2a5('0x139'),'accesskeyid',_0xd2a5('0x13a'),'key',_0xd2a5('0x16'),_0xd2a5('0x13b'),_0xd2a5('0x13c'),_0xd2a5('0x13d'),'dsn',_0xd2a5('0x13e'),_0xd2a5('0x13f'),'oldPassword'];function maskSensitiveData(_0x3cbdbc){var _0xefabbd=/(?!^)[\s\S](?!$)/g;if(!_[_0xd2a5('0x140')](_0x3cbdbc))return;for(var _0x4d9966 in _0x3cbdbc){if(_[_0xd2a5('0x141')](_0x3cbdbc[_0x4d9966])){for(var _0x5b0ffe=0x0;_0x5b0ffe<_0x3cbdbc[_0x4d9966][_0xd2a5('0x142')];_0x5b0ffe++){maskSensitiveData(_0x3cbdbc[_0x4d9966][_0x5b0ffe]);}}else if(_[_0xd2a5('0x140')](_0x3cbdbc[_0x4d9966])){maskSensitiveData(_0x3cbdbc[_0x4d9966]);}else if(_[_0xd2a5('0x143')](_0x3cbdbc[_0x4d9966])){_0x3cbdbc[_0x4d9966]=_0x3cbdbc[_0x4d9966][_0xd2a5('0x144')](/{{{/g,_0xd2a5('0x145'))['replace'](/}}}/g,_0xd2a5('0x146'))['replace'](/{{/g,'@{')[_0xd2a5('0x144')](/}}/g,'}@');if(_[_0xd2a5('0x147')](sensitiveFields,_0x4d9966)){_0x3cbdbc[_0x4d9966]=_0x3cbdbc[_0x4d9966][_0xd2a5('0x144')](_0xefabbd,'*');}}}} \ No newline at end of file +var _0x2149=['./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authGoogle','/api/jira','./api/jira','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','join','/www','/demo','/snippet','/plugins','/server/files/plugins','get','route','resolve','/index.html','username','password','apiKey','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','method','remoteAddress','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailMessage','/api/mail/applications','./api/mailApplication','/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/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskField','/api/integrations/freshdesk/accounts','/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/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x2149,0x1cf));var _0x9214=function(_0x1212b9,_0x44d00e){_0x1212b9=_0x1212b9-0x0;var _0xd744d0=_0x2149[_0x1212b9];return _0xd744d0;};'use strict';var _=require('lodash');var path=require(_0x9214('0x0'));var express=require(_0x9214('0x1'));var ewinston=require(_0x9214('0x2'));var util=require(_0x9214('0x3'));var errors=require(_0x9214('0x4'));var config=require(_0x9214('0x5'));var logger=require(_0x9214('0x6'))(_0x9214('0x7'));var authLogger=require(_0x9214('0x6'))(_0x9214('0x8'));exports[_0x9214('0x9')]=function(_0x21939b){_0x21939b['use'](ewinston[_0x9214('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x14f522,_0x4bb8ce){var _0x217021=_0x9214('0xb');if(!_[_0x9214('0xc')](_0x14f522[_0x9214('0xd')])){_0x217021+=_0x9214('0xe');var _0x1f223b=_0x14f522[_0x9214('0xd')];maskSensitiveData(_0x1f223b);}return util['format'](_0x217021,_0x14f522['method'],_0x14f522[_0x9214('0xf')][_0x9214('0x10')]?_0x14f522[_0x9214('0xf')][_0x9214('0x10')]:_0x14f522[_0x9214('0x11')]['remoteAddress']||_0x14f522['ip'],_0x14f522[_0x9214('0x12')],_0x4bb8ce[_0x9214('0x13')],_0x4bb8ce[_0x9214('0x14')],_0x14f522[_0x9214('0x15')]?_0x14f522[_0x9214('0x15')]['id']:null,_0x14f522[_0x9214('0x15')]?_0x14f522[_0x9214('0x15')][_0x9214('0x16')]:null,_0x14f522['user']?_0x14f522[_0x9214('0x15')][_0x9214('0x17')]:null,_0x1f223b?util[_0x9214('0x18')](_0x1f223b,![],null):'');}}));_0x21939b[_0x9214('0x19')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4a172a,_0x7540ae){var _0x3dff78=_0x9214('0x1a');if(_0x4a172a[_0x9214('0xd')]&&_0x4a172a[_0x9214('0xd')][_0x9214('0x1b')]&&_0x4a172a[_0x9214('0xd')][_0x9214('0x1c')]){_0x3dff78='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x9214('0x1d')](_0x3dff78,_0x4a172a[_0x9214('0x1e')],_0x4a172a['headers'][_0x9214('0x10')]?_0x4a172a['headers'][_0x9214('0x10')]:_0x4a172a['connection'][_0x9214('0x1f')]||_0x4a172a['ip'],_0x4a172a[_0x9214('0x12')],_0x7540ae[_0x9214('0x13')],_0x7540ae['responseTime'],_0x4a172a[_0x9214('0x15')]?_0x4a172a[_0x9214('0x15')]['id']:null,_0x4a172a['user']?_0x4a172a['user'][_0x9214('0x16')]:null,_0x4a172a['user']?_0x4a172a['user']['role']:null,_0x4a172a[_0x9214('0xd')]&&_0x4a172a[_0x9214('0xd')]['device']?_0x4a172a[_0x9214('0xd')]['device']:'other',_0x4a172a[_0x9214('0xd')]&&_0x4a172a[_0x9214('0xd')][_0x9214('0x1c')]?_0x4a172a[_0x9214('0xd')][_0x9214('0x1c')]:'',_0x4a172a[_0x9214('0xd')]&&_0x4a172a[_0x9214('0xd')][_0x9214('0x20')]?_0x4a172a[_0x9214('0xd')][_0x9214('0x20')]:'');},'ignoreRoute':function(_0x209ccf){var _0x3485b5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3485b5['test'](_0x209ccf[_0x9214('0x12')]);}}));_0x21939b[_0x9214('0x19')](_0x9214('0x21'),require(_0x9214('0x22')));_0x21939b[_0x9214('0x19')](_0x9214('0x23'),require('./api/voiceChanSpy'));_0x21939b[_0x9214('0x19')](_0x9214('0x24'),require('./api/voiceContext'));_0x21939b[_0x9214('0x19')](_0x9214('0x25'),require('./api/voiceExtension'));_0x21939b[_0x9214('0x19')](_0x9214('0x26'),require('./api/voiceMusicOnHold'));_0x21939b['use']('/api/voice/queues',require(_0x9214('0x27')));_0x21939b[_0x9214('0x19')](_0x9214('0x28'),require(_0x9214('0x29')));_0x21939b[_0x9214('0x19')](_0x9214('0x2a'),require('./api/screenRecording'));_0x21939b[_0x9214('0x19')](_0x9214('0x2b'),require('./api/voiceMail'));_0x21939b[_0x9214('0x19')](_0x9214('0x2c'),require(_0x9214('0x2d')));_0x21939b[_0x9214('0x19')](_0x9214('0x2e'),require(_0x9214('0x2f')));_0x21939b['use'](_0x9214('0x30'),require(_0x9214('0x31')));_0x21939b[_0x9214('0x19')](_0x9214('0x32'),require(_0x9214('0x33')));_0x21939b[_0x9214('0x19')](_0x9214('0x34'),require(_0x9214('0x35')));_0x21939b['use']('/api/members/reports',require('./api/memberReport'));_0x21939b[_0x9214('0x19')](_0x9214('0x36'),require(_0x9214('0x37')));_0x21939b[_0x9214('0x19')](_0x9214('0x38'),require(_0x9214('0x39')));_0x21939b['use']('/api/mail/out_servers',require(_0x9214('0x3a')));_0x21939b[_0x9214('0x19')](_0x9214('0x3b'),require('./api/mailAccount'));_0x21939b[_0x9214('0x19')](_0x9214('0x3c'),require(_0x9214('0x3d')));_0x21939b[_0x9214('0x19')]('/api/mail/substatuses',require(_0x9214('0x3e')));_0x21939b['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x21939b['use']('/api/mail/messages',require(_0x9214('0x3f')));_0x21939b['use'](_0x9214('0x40'),require(_0x9214('0x41')));_0x21939b['use'](_0x9214('0x42'),require(_0x9214('0x43')));_0x21939b['use'](_0x9214('0x44'),require(_0x9214('0x45')));_0x21939b[_0x9214('0x19')]('/api/dashboards/items',require(_0x9214('0x46')));_0x21939b['use'](_0x9214('0x47'),require(_0x9214('0x48')));_0x21939b[_0x9214('0x19')](_0x9214('0x49'),require(_0x9214('0x4a')));_0x21939b['use'](_0x9214('0x4b'),require(_0x9214('0x4c')));_0x21939b['use'](_0x9214('0x4d'),require(_0x9214('0x4e')));_0x21939b[_0x9214('0x19')](_0x9214('0x4f'),require(_0x9214('0x50')));_0x21939b[_0x9214('0x19')](_0x9214('0x51'),require(_0x9214('0x52')));_0x21939b[_0x9214('0x19')](_0x9214('0x53'),require(_0x9214('0x54')));_0x21939b[_0x9214('0x19')](_0x9214('0x55'),require(_0x9214('0x56')));_0x21939b['use'](_0x9214('0x57'),require(_0x9214('0x58')));_0x21939b[_0x9214('0x19')]('/api/sms/messages',require(_0x9214('0x59')));_0x21939b[_0x9214('0x19')]('/api/sms/queues',require(_0x9214('0x5a')));_0x21939b[_0x9214('0x19')](_0x9214('0x5b'),require(_0x9214('0x5c')));_0x21939b[_0x9214('0x19')](_0x9214('0x5d'),require(_0x9214('0x5e')));_0x21939b[_0x9214('0x19')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x21939b['use'](_0x9214('0x5f'),require(_0x9214('0x60')));_0x21939b[_0x9214('0x19')](_0x9214('0x61'),require(_0x9214('0x62')));_0x21939b[_0x9214('0x19')](_0x9214('0x63'),require(_0x9214('0x64')));_0x21939b[_0x9214('0x19')](_0x9214('0x65'),require('./api/openchannelQueueReport'));_0x21939b['use'](_0x9214('0x66'),require(_0x9214('0x67')));_0x21939b[_0x9214('0x19')](_0x9214('0x68'),require(_0x9214('0x69')));_0x21939b[_0x9214('0x19')](_0x9214('0x6a'),require(_0x9214('0x6b')));_0x21939b['use'](_0x9214('0x6c'),require(_0x9214('0x6d')));_0x21939b[_0x9214('0x19')](_0x9214('0x6e'),require('./api/chatQueue'));_0x21939b[_0x9214('0x19')](_0x9214('0x6f'),require(_0x9214('0x70')));_0x21939b[_0x9214('0x19')](_0x9214('0x71'),require(_0x9214('0x72')));_0x21939b[_0x9214('0x19')]('/api/cm/companies',require(_0x9214('0x73')));_0x21939b['use'](_0x9214('0x74'),require(_0x9214('0x75')));_0x21939b[_0x9214('0x19')](_0x9214('0x76'),require(_0x9214('0x77')));_0x21939b[_0x9214('0x19')](_0x9214('0x78'),require(_0x9214('0x79')));_0x21939b[_0x9214('0x19')](_0x9214('0x7a'),require('./api/cmHopperFinal'));_0x21939b[_0x9214('0x19')](_0x9214('0x7b'),require(_0x9214('0x7c')));_0x21939b[_0x9214('0x19')](_0x9214('0x7d'),require(_0x9214('0x7e')));_0x21939b[_0x9214('0x19')](_0x9214('0x7f'),require('./api/action'));_0x21939b[_0x9214('0x19')](_0x9214('0x80'),require(_0x9214('0x81')));_0x21939b[_0x9214('0x19')](_0x9214('0x82'),require(_0x9214('0x83')));_0x21939b[_0x9214('0x19')](_0x9214('0x84'),require('./api/disposition'));_0x21939b[_0x9214('0x19')](_0x9214('0x85'),require(_0x9214('0x86')));_0x21939b['use'](_0x9214('0x87'),require(_0x9214('0x88')));_0x21939b[_0x9214('0x19')]('/api/pauses',require('./api/pause'));_0x21939b[_0x9214('0x19')](_0x9214('0x89'),require(_0x9214('0x8a')));_0x21939b['use'](_0x9214('0x8b'),require(_0x9214('0x8c')));_0x21939b[_0x9214('0x19')]('/api/schedules',require('./api/schedule'));_0x21939b[_0x9214('0x19')](_0x9214('0x8d'),require('./api/sound'));_0x21939b[_0x9214('0x19')](_0x9214('0x8e'),require(_0x9214('0x8f')));_0x21939b[_0x9214('0x19')](_0x9214('0x90'),require(_0x9214('0x91')));_0x21939b['use']('/api/triggers',require(_0x9214('0x92')));_0x21939b[_0x9214('0x19')](_0x9214('0x93'),require(_0x9214('0x94')));_0x21939b['use'](_0x9214('0x95'),require(_0x9214('0x96')));_0x21939b[_0x9214('0x19')](_0x9214('0x97'),require(_0x9214('0x98')));_0x21939b['use'](_0x9214('0x99'),require(_0x9214('0x9a')));_0x21939b['use'](_0x9214('0x9b'),require(_0x9214('0x9c')));_0x21939b['use'](_0x9214('0x9d'),require(_0x9214('0x9e')));_0x21939b[_0x9214('0x19')](_0x9214('0x9f'),require(_0x9214('0xa0')));_0x21939b[_0x9214('0x19')](_0x9214('0xa1'),require(_0x9214('0xa2')));_0x21939b[_0x9214('0x19')](_0x9214('0xa3'),require(_0x9214('0xa4')));_0x21939b[_0x9214('0x19')](_0x9214('0xa5'),require(_0x9214('0xa6')));_0x21939b['use'](_0x9214('0xa7'),require(_0x9214('0xa8')));_0x21939b[_0x9214('0x19')](_0x9214('0xa9'),require('./api/intSalesforceField'));_0x21939b[_0x9214('0x19')](_0x9214('0xaa'),require(_0x9214('0xab')));_0x21939b[_0x9214('0x19')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x21939b[_0x9214('0x19')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x21939b[_0x9214('0x19')]('/api/integrations/desk/accounts',require(_0x9214('0xac')));_0x21939b[_0x9214('0x19')](_0x9214('0xad'),require(_0x9214('0xae')));_0x21939b[_0x9214('0x19')](_0x9214('0xaf'),require(_0x9214('0xb0')));_0x21939b[_0x9214('0x19')]('/api/integrations/zoho/accounts',require(_0x9214('0xb1')));_0x21939b[_0x9214('0x19')](_0x9214('0xb2'),require(_0x9214('0xb3')));_0x21939b[_0x9214('0x19')](_0x9214('0xb4'),require(_0x9214('0xb5')));_0x21939b['use'](_0x9214('0xb6'),require(_0x9214('0xb7')));_0x21939b[_0x9214('0x19')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x21939b[_0x9214('0x19')]('/api/integrations/zendesk/fields',require(_0x9214('0xb8')));_0x21939b[_0x9214('0x19')](_0x9214('0xb9'),require('./api/intFreshdeskAccount'));_0x21939b[_0x9214('0x19')](_0x9214('0xba'),require('./api/intFreshdeskConfiguration'));_0x21939b[_0x9214('0x19')](_0x9214('0xbb'),require(_0x9214('0xbc')));_0x21939b['use'](_0x9214('0xbd'),require(_0x9214('0xbe')));_0x21939b[_0x9214('0x19')](_0x9214('0xbf'),require(_0x9214('0xc0')));_0x21939b[_0x9214('0x19')](_0x9214('0xc1'),require('./api/intVtigerField'));_0x21939b[_0x9214('0x19')](_0x9214('0xc2'),require(_0x9214('0xc3')));_0x21939b[_0x9214('0x19')]('/api/integrations/servicenow/configurations',require(_0x9214('0xc4')));_0x21939b['use'](_0x9214('0xc5'),require(_0x9214('0xc6')));_0x21939b['use'](_0x9214('0xc7'),require(_0x9214('0xc8')));_0x21939b['use'](_0x9214('0xc9'),require(_0x9214('0xca')));_0x21939b['use'](_0x9214('0xcb'),require('./api/intDynamics365Field'));_0x21939b[_0x9214('0x19')](_0x9214('0xcc'),require(_0x9214('0xcd')));_0x21939b[_0x9214('0x19')](_0x9214('0xce'),require('./api/intFreshsalesConfiguration'));_0x21939b['use'](_0x9214('0xcf'),require(_0x9214('0xd0')));_0x21939b[_0x9214('0x19')](_0x9214('0xd1'),require(_0x9214('0xd2')));_0x21939b[_0x9214('0x19')](_0x9214('0xd3'),require(_0x9214('0xd4')));_0x21939b[_0x9214('0x19')]('/api/chat/internal/messages',require(_0x9214('0xd5')));_0x21939b[_0x9214('0x19')](_0x9214('0xd6'),require('./api/jscriptyAnswerReport'));_0x21939b[_0x9214('0x19')]('/api/jscripty/questions/reports',require(_0x9214('0xd7')));_0x21939b[_0x9214('0x19')]('/api/jscripty/sessions/reports',require(_0x9214('0xd8')));_0x21939b[_0x9214('0x19')](_0x9214('0xd9'),require(_0x9214('0xda')));_0x21939b[_0x9214('0x19')](_0x9214('0xdb'),require(_0x9214('0xdc')));_0x21939b[_0x9214('0x19')]('/api/square/details/reports',require(_0x9214('0xdd')));_0x21939b[_0x9214('0x19')](_0x9214('0xde'),require('./api/jscriptyProject'));_0x21939b[_0x9214('0x19')](_0x9214('0xdf'),require('./api/setting'));_0x21939b['use'](_0x9214('0xe0'),require(_0x9214('0xe1')));_0x21939b['use']('/api/square/projects',require(_0x9214('0xe2')));_0x21939b[_0x9214('0x19')](_0x9214('0xe3'),require('./api/squareRecording'));_0x21939b['use'](_0x9214('0xe4'),require('./api/squareMessage'));_0x21939b[_0x9214('0x19')](_0x9214('0xe5'),require(_0x9214('0xe6')));_0x21939b[_0x9214('0x19')]('/api/license',require('./api/license'));_0x21939b['use'](_0x9214('0xe7'),require(_0x9214('0xe8')));_0x21939b[_0x9214('0x19')](_0x9214('0xe9'),require(_0x9214('0xea')));_0x21939b[_0x9214('0x19')](_0x9214('0xeb'),require(_0x9214('0xec')));_0x21939b[_0x9214('0x19')]('/api/plugins',require(_0x9214('0xed')));_0x21939b[_0x9214('0x19')](_0x9214('0xee'),require(_0x9214('0xef')));_0x21939b[_0x9214('0x19')](_0x9214('0xf0'),require(_0x9214('0xf1')));_0x21939b['use'](_0x9214('0xf2'),require('./api/faxTransferReport'));_0x21939b['use'](_0x9214('0xf3'),require('./api/openchannelTransferReport'));_0x21939b[_0x9214('0x19')](_0x9214('0xf4'),require('./api/smsTransferReport'));_0x21939b[_0x9214('0x19')](_0x9214('0xf5'),require(_0x9214('0xf6')));_0x21939b['use'](_0x9214('0xf7'),require(_0x9214('0xf8')));_0x21939b['use']('/api/userProfiles',require(_0x9214('0xf9')));_0x21939b[_0x9214('0x19')]('/api/userProfile/sections',require(_0x9214('0xfa')));_0x21939b[_0x9214('0x19')]('/api/userProfile/resources',require(_0x9214('0xfb')));_0x21939b[_0x9214('0x19')](_0x9214('0xfc'),require(_0x9214('0xfd')));_0x21939b['use'](_0x9214('0xfe'),require('./api/whatsappAccount'));_0x21939b[_0x9214('0x19')]('/api/whatsapp/applications',require(_0x9214('0xff')));_0x21939b[_0x9214('0x19')](_0x9214('0x100'),require(_0x9214('0x101')));_0x21939b['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x21939b[_0x9214('0x19')](_0x9214('0x102'),require(_0x9214('0x103')));_0x21939b[_0x9214('0x19')](_0x9214('0x104'),require('./api/whatsappTransferReport'));_0x21939b[_0x9214('0x19')](_0x9214('0x105'),require(_0x9214('0x106')));_0x21939b[_0x9214('0x19')]('/api/cloudProviders',require(_0x9214('0x107')));_0x21939b[_0x9214('0x19')](_0x9214('0x108'),require(_0x9214('0x109')));_0x21939b['use'](_0x9214('0x10a'),require('./api/authLocal'));_0x21939b[_0x9214('0x19')]('/api/auth/google',require(_0x9214('0x10b')));_0x21939b[_0x9214('0x19')](_0x9214('0x10c'),require(_0x9214('0x10d')));_0x21939b[_0x9214('0x19')]('/api/rpc',require('./api/rpc'));_0x21939b[_0x9214('0x19')](_0x9214('0x10e'),require(_0x9214('0x10f')));_0x21939b[_0x9214('0x19')]('/api/system',require(_0x9214('0x110')));_0x21939b[_0x9214('0x19')](_0x9214('0x111'),require(_0x9214('0x112')));_0x21939b[_0x9214('0x19')](_0x9214('0x113'),require(_0x9214('0x114')));_0x21939b['use']('/apidoc',express[_0x9214('0x115')](path['join'](config[_0x9214('0x116')],_0x9214('0x117'))));_0x21939b[_0x9214('0x19')]('/www',express['static'](path[_0x9214('0x118')](config[_0x9214('0x116')],_0x9214('0x119'))));_0x21939b[_0x9214('0x19')](_0x9214('0x11a'),express[_0x9214('0x115')](path[_0x9214('0x118')](config[_0x9214('0x116')],_0x9214('0x11a'))));_0x21939b[_0x9214('0x19')](_0x9214('0x11b'),express[_0x9214('0x115')](path['join'](config[_0x9214('0x116')],'snippet','3.0.0')));_0x21939b['use'](_0x9214('0x11c'),express[_0x9214('0x115')](path[_0x9214('0x118')](config[_0x9214('0x116')],_0x9214('0x11d'))));_0x21939b['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x9214('0x11e')](errors[0x194]);_0x21939b[_0x9214('0x11f')]('/*')[_0x9214('0x11e')](function(_0x342d52,_0x1d7000){_0x1d7000['sendFile'](path[_0x9214('0x120')](_0x21939b['get']('appPath')+_0x9214('0x121')));});};var sensitiveFields=[_0x9214('0x122'),_0x9214('0x123'),'newPassword',_0x9214('0x124'),'firstName',_0x9214('0x125'),_0x9214('0x126'),_0x9214('0x127'),_0x9214('0x128'),_0x9214('0x129'),_0x9214('0x12a'),_0x9214('0x12b'),_0x9214('0x12c'),_0x9214('0x12d'),_0x9214('0x12e'),_0x9214('0x12f'),_0x9214('0x130'),'token',_0x9214('0x131'),'accessToken',_0x9214('0x132'),_0x9214('0x133'),_0x9214('0x134'),_0x9214('0x135'),_0x9214('0x136'),_0x9214('0x137'),_0x9214('0x138'),_0x9214('0x139'),'vidaooApiKey',_0x9214('0x13a'),_0x9214('0x13b'),_0x9214('0x13c'),_0x9214('0x13d'),_0x9214('0x13e'),_0x9214('0x15'),_0x9214('0x13f'),_0x9214('0x140'),_0x9214('0x141'),_0x9214('0x142'),_0x9214('0x143'),_0x9214('0x144'),_0x9214('0x145')];function maskSensitiveData(_0x42da26){var _0x838127=/(?!^)[\s\S](?!$)/g;if(!_[_0x9214('0x146')](_0x42da26))return;for(var _0x31e137 in _0x42da26){if(_[_0x9214('0x147')](_0x42da26[_0x31e137])){for(var _0x2d520a=0x0;_0x2d520a<_0x42da26[_0x31e137][_0x9214('0x148')];_0x2d520a++){maskSensitiveData(_0x42da26[_0x31e137][_0x2d520a]);}}else if(_[_0x9214('0x146')](_0x42da26[_0x31e137])){maskSensitiveData(_0x42da26[_0x31e137]);}else if(_[_0x9214('0x149')](_0x42da26[_0x31e137])){_0x42da26[_0x31e137]=_0x42da26[_0x31e137][_0x9214('0x14a')](/{{{/g,_0x9214('0x14b'))[_0x9214('0x14a')](/}}}/g,_0x9214('0x14c'))['replace'](/{{/g,'@{')[_0x9214('0x14a')](/}}/g,'}@');if(_[_0x9214('0x14d')](sensitiveFields,_0x31e137)){_0x42da26[_0x31e137]=_0x42da26[_0x31e137][_0x9214('0x14a')](_0x838127,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 15dc9c4..6cd9f0f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1a3=['../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.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'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0xf1a3,0x118));var _0x3f1a=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0xf1a3[_0x7b484];return _0x2ae1cf;};'use strict';var jayson=require(_0x3f1a('0x0'));var BPromise=require(_0x3f1a('0x1'));var _=require(_0x3f1a('0x2'));var config=require(_0x3f1a('0x3'));exports[_0x3f1a('0x4')]=function(){return new BPromise(function(_0x23a0e0,_0x1c4a92){var _0x332bde={};_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/user/user.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x6')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x7')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x8')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x9')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0xa')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0xb')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0xc')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0xd')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/trunk/trunk.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0xe')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0xf')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x10')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x11')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x12')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x13')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x14')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x15')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x16')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/faxApplication/faxApplication.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/faxInteraction/faxInteraction.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x17')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/faxQueue/faxQueue.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x18')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x19')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x1a')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x1b')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x1c')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x1d')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x1e')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x1f')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x20')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x21')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x22')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x23')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x24')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x25')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x26')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x27')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x28')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x29')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x2a')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x2b')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x2c')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x2d')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x2e')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x2f')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/variable/variable.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x30')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x31')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x32')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x33')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x34')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x35')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x36')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x37')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x38')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x39')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x3a')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x3b')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x3c')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x3d')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x3e')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/squareProject/squareProject.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x3f')));_0x332bde=_['merge'](_0x332bde,require(_0x3f1a('0x40')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x41')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x42')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x43')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x44')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x332bde=_['merge'](_0x332bde,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x45')));_0x332bde=_[_0x3f1a('0x5')](_0x332bde,require(_0x3f1a('0x46')));var _0x21ebca=jayson[_0x3f1a('0x47')](_0x332bde)[_0x3f1a('0x48')]();var _0x206fbb=config[_0x3f1a('0x49')][_0x3f1a('0x4a')]||config['port']+0x1;var _0x4686b2=config[_0x3f1a('0x49')]['ip']||'localhost';_0x21ebca['on']('error',function(_0x36872a){return _0x1c4a92(_0x36872a);});_0x21ebca[_0x3f1a('0x4')](_0x206fbb,_0x4686b2,function(){console[_0x3f1a('0x4b')](_0x3f1a('0x4c'),_0x4686b2,_0x206fbb);require(_0x3f1a('0x4d'))[_0x3f1a('0x4e')]();return _0x23a0e0(_0x3f1a('0x4f')+_0x4686b2+':'+_0x206fbb);});});}; \ No newline at end of file +var _0x8e7a=['../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc'];(function(_0x1c5988,_0x15fa51){var _0x414fd0=function(_0x243c8f){while(--_0x243c8f){_0x1c5988['push'](_0x1c5988['shift']());}};_0x414fd0(++_0x15fa51);}(_0x8e7a,0xb2));var _0xa8e7=function(_0x52c72b,_0x192995){_0x52c72b=_0x52c72b-0x0;var _0x4b4ca0=_0x8e7a[_0x52c72b];return _0x4b4ca0;};'use strict';var jayson=require(_0xa8e7('0x0'));var BPromise=require(_0xa8e7('0x1'));var _=require(_0xa8e7('0x2'));var config=require(_0xa8e7('0x3'));exports[_0xa8e7('0x4')]=function(){return new BPromise(function(_0x2f3b5c,_0x9c1ffb){var _0x24db1c={};_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x6')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x7')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x8')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x9')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0xa')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0xb')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0xc')));_0x24db1c=_['merge'](_0x24db1c,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0xd')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0xe')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0xf')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x10')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x11')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/mailInteraction/mailInteraction.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/mailMessage/mailMessage.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x12')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x13')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x14')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x15')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x16')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x17')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x18')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x19')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x1a')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x1b')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x1c')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x1d')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x1e')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x1f')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x20')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x21')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x22')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x23')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/cmContact/cmContact.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x24')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x25')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x26')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x27')));_0x24db1c=_['merge'](_0x24db1c,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/interval/interval.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x28')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x29')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x2a')));_0x24db1c=_['merge'](_0x24db1c,require('../api/trigger/trigger.rpc'));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x2b')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x2c')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x2d')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x2e')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x2f')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x30')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x31')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x32')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x33')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x34')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x35')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x36')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x37')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x38')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x39')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x3a')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x3b')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x3c')));_0x24db1c=_['merge'](_0x24db1c,require('../api/plugin/plugin.rpc'));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x3d')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x3e')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x3f')));_0x24db1c=_[_0xa8e7('0x5')](_0x24db1c,require(_0xa8e7('0x40')));_0x24db1c=_['merge'](_0x24db1c,require(_0xa8e7('0x41')));var _0x419231=jayson[_0xa8e7('0x42')](_0x24db1c)[_0xa8e7('0x43')]();var _0x505fed=config[_0xa8e7('0x44')][_0xa8e7('0x45')]||config['port']+0x1;var _0x5e289e=config[_0xa8e7('0x44')]['ip']||_0xa8e7('0x46');_0x419231['on']('error',function(_0x15dc69){return _0x9c1ffb(_0x15dc69);});_0x419231[_0xa8e7('0x4')](_0x505fed,_0x5e289e,function(){console[_0xa8e7('0x47')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5e289e,_0x505fed);require(_0xa8e7('0x48'))['default']();return _0x2f3b5c(_0xa8e7('0x49')+_0x5e289e+':'+_0x505fed);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4ed5ea7..bd6635c 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 _0x8fee=['search','520\x20End\x20of\x20proper','function','substring','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','streamFile','agi','AGI','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid'];(function(_0x252b13,_0x3d5514){var _0x1ece93=function(_0x2c9742){while(--_0x2c9742){_0x252b13['push'](_0x252b13['shift']());}};_0x1ece93(++_0x3d5514);}(_0x8fee,0x195));var _0xe8fe=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8fee[_0x3e5086];return _0xfeb102;};'use strict';var util=require(_0xe8fe('0x0'));var _=require(_0xe8fe('0x1'));var EventEmitter=require('events')[_0xe8fe('0x2')];var AGIReply=require(_0xe8fe('0x3'));var AGIError=require(_0xe8fe('0x4'));function AGIChannel(_0x5932da){var _0x4d3ba0=this,_0x3c9a4d=new AGIReply(),_0xc593fd=![],_0x1c247f={};EventEmitter[_0xe8fe('0x5')](_0x4d3ba0);_0x5932da[_0xe8fe('0x6')]('utf8');_0x5932da[_0xe8fe('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3c9a4d[_0xe8fe('0x6')]('utf8');_0x3c9a4d['on'](_0xe8fe('0x8'),function(_0x201ca5){for(var _0x3570a1 in _0x201ca5){_0x4d3ba0[_0x3570a1]=_0x201ca5[_0x3570a1];}_0x4d3ba0[_0xe8fe('0x9')](_0xe8fe('0xa'));});_0x3c9a4d['on'](_0xe8fe('0xb'),function(_0x3231e8){if(_0x3231e8[_0xe8fe('0xc')]()==_0xe8fe('0xd')){_0x4d3ba0[_0xe8fe('0x9')](_0xe8fe('0xd'));return;}if(_0x3231e8['substring'](0x0,0xb)==_0xe8fe('0xe')){_0xc593fd=!![];}if(_0xc593fd){_0x1c247f['rx']+=_0x3231e8+'\x0a';if(_0x3231e8[_0xe8fe('0xf')](_0xe8fe('0x10'))!=-0x1){_0xc593fd=![];}}else{_0x1c247f['rx']=_0x3231e8;}if(_0xc593fd){return;}if(typeof _0x1c247f['cb']==_0xe8fe('0x11')){var _0x200aef=_0x1c247f['rx'][_0xe8fe('0x12')](0x0,0x3),_0x22e390=null,_0x1ffaee=null;_0x200aef=parseInt(_0x200aef);if(isNaN(_0x200aef)){_0x1c247f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x200aef!=0xc8){_0x1c247f['cb'](null,{'code':_0x200aef,'result':-0x1,'extra':'KO'});return;}_0x22e390=_0x1c247f['rx'][_0xe8fe('0x12')](0x4)['replace'](_0xe8fe('0x13'),'');if(_0x22e390[_0xe8fe('0x14')]('\x20')!=-0x1){_0x22e390=_0x22e390[_0xe8fe('0x15')](0x0,_0x22e390['indexOf']('\x20'));}if(_[_0xe8fe('0x16')](_0x22e390,'-1')){_0x22e390=parseInt(_0x22e390);}_0x1ffaee=_0x1c247f['rx'][_0xe8fe('0x17')]('\x20');if(_0x1ffaee['length']==0x3){_0x1ffaee=_0x1ffaee[0x2]['substring'](0x1,_0x1ffaee[0x2][_0xe8fe('0x18')]-0x1);}else if(_0x1ffaee[_0xe8fe('0x18')]>0x3){var _0x1196a2=/\((.+)\)/;var _0x8c9acf=_0x1c247f['rx'][_0xe8fe('0x19')](_0x1196a2);if(_0x8c9acf){_0x1ffaee=_0x8c9acf[0x1];}else{_0x1ffaee=null;}}else{_0x1ffaee=null;}_0x1c247f['cb'](null,{'code':_0x200aef,'result':_0x22e390,'extra':_0x1ffaee});}});_0x5932da['on'](_0xe8fe('0x1a'),function(_0x34747d){_0x4d3ba0[_0xe8fe('0x9')]('error',new AGIError(_0xe8fe('0x1b'),_0x34747d[_0xe8fe('0x1c')]));});_0x5932da['on'](_0xe8fe('0x1d'),function(){_0x4d3ba0[_0xe8fe('0x9')]('close',new AGIError(_0xe8fe('0x1e')));});_0x5932da['on'](_0xe8fe('0x1f'),function(){_0x4d3ba0['emit'](_0xe8fe('0x1f'),new AGIError(_0xe8fe('0x20')));_0x5932da[_0xe8fe('0x21')]();});_0x5932da[_0xe8fe('0x22')](_0x3c9a4d);this[_0xe8fe('0x23')]=function(_0x146448,_0x3da5c8){var _0x146448=_0x146448||'',_0x3da5c8=typeof _0x3da5c8==_0xe8fe('0x11')?_0x3da5c8:new Function();_0x1c247f={'tx':_0x146448,'rx':'','cb':_0x3da5c8};_0x5932da[_0xe8fe('0x24')](_0x146448+'\x0a');},this['close']=function(){_0x5932da[_0xe8fe('0x21')]();};}util[_0xe8fe('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xe8fe('0x26')]=function(_0x46cae7){return this['command'][_0xe8fe('0x27')](this,_0x46cae7);};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x29')]=function(){return this[_0xe8fe('0x26')](_0xe8fe('0x2a'));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x2b')]=function(_0x18af5e,_0x2849a4,_0x5d2e02){_0x18af5e=_0x18af5e===undefined?_0xe8fe('0x2c'):_0x18af5e;_0x2849a4=_0x2849a4===undefined?'5':_0x2849a4;_0x5d2e02=_0x5d2e02===undefined?'1':_0x5d2e02;return this['sendRequest'](util[_0xe8fe('0x2d')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x18af5e,_0x2849a4*0x3e8,_0x5d2e02));};AGIChannel['prototype'][_0xe8fe('0x2e')]=function(_0x5d9518){_0x5d9518=_0x5d9518||_0xe8fe('0x2f');return this[_0xe8fe('0x26')](util[_0xe8fe('0x2d')](_0xe8fe('0x30'),_0x5d9518));};AGIChannel[_0xe8fe('0x28')]['exec']=function(_0x280f8e,_0x1f2bc8){if(_['isArray'](_0x1f2bc8)){return this['sendRequest'](util[_0xe8fe('0x2d')](_0xe8fe('0x31'),_0x280f8e,_0x1f2bc8[_0xe8fe('0x32')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x280f8e,_0x1f2bc8));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x33')]=function(_0x593bf2){return this[_0xe8fe('0x26')](util[_0xe8fe('0x2d')](_0xe8fe('0x34'),_0x593bf2));};AGIChannel['prototype'][_0xe8fe('0x35')]=function(_0x4e70fa){return this[_0xe8fe('0x26')](util['format'](_0xe8fe('0x36'),_0x4e70fa));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x37')]=function(_0x40a4e5){return this[_0xe8fe('0x26')](util[_0xe8fe('0x2d')](_0xe8fe('0x38'),_0x40a4e5));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0xd')]=function(){return this[_0xe8fe('0x26')](_0xe8fe('0x39'));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x3a')]=function(_0x229488,_0x17d69d){var _0x5cb8a6=_['isBoolean'](_0x17d69d)||_['isNumber'](_0x17d69d)?_0x17d69d['toString']():_0x17d69d;return this['sendRequest'](util['format'](_0xe8fe('0x3b'),_0x229488,_0x5cb8a6?_0x5cb8a6[_0xe8fe('0x3c')]()[_0xe8fe('0x3d')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x3e')]=function(_0x32c62e,_0x2acce0){return this[_0xe8fe('0x26')](util[_0xe8fe('0x2d')](_0xe8fe('0x3f'),_0x32c62e,_0x2acce0));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x40')]=function(_0x5c4784,_0x4fed6e){return this['sendRequest'](util[_0xe8fe('0x2d')](_0xe8fe('0x41'),_0x5c4784,_0x4fed6e));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x42')]=function(_0x28eb4d,_0x2653bf){return this[_0xe8fe('0x26')](util[_0xe8fe('0x2d')](_0xe8fe('0x43'),_0x28eb4d,_0x2653bf));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x44')]=function(_0x8772ae,_0xb0394d,_0x394437){_0xb0394d=_0xb0394d||this[_0xe8fe('0x45')];_0x394437=_0x394437||0x1;this[_0xe8fe('0x33')](_0x8772ae);this['setExtension'](_0xb0394d);this[_0xe8fe('0x37')](_0x394437);return this[_0xe8fe('0x2e')](util[_0xe8fe('0x2d')](_0xe8fe('0x46'),_0x8772ae,_0xb0394d,_0x394437));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x47')]=function(_0x55776a){return this['sendRequest'](util[_0xe8fe('0x2d')]('GET\x20VARIABLE\x20\x22%s\x22',_0x55776a));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x48')]=function(_0x2b750e,_0x1969b6,_0x43bb3d,_0x434aed,_0x42023b,_0x3136af){_0x1969b6=_0x1969b6||_0xe8fe('0x49');_0x43bb3d=_0x43bb3d||'';_0x434aed=_0x434aed===undefined?-0x1:_0x434aed==='-1'?-0x1:_0x434aed*0x3e8;_0x42023b=_0x42023b===undefined?'':'s='+_0x42023b;_0x3136af=_0x3136af?_0xe8fe('0x4a'):'';return this['sendRequest'](util[_0xe8fe('0x2d')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2b750e,_0x1969b6,_0x43bb3d,_0x434aed,_0x3136af,_0x42023b));};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x4b')]=function(_0x46c171,_0x3a9a23){_0x3a9a23=_0x3a9a23||'';return this['sendRequest'](util[_0xe8fe('0x2d')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x46c171,_0x3a9a23));};AGIChannel['prototype'][_0xe8fe('0x4c')]=function(_0x5bd990){return this['exec'](_0xe8fe('0x4d'),_0x5bd990);};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x4e')]=function(_0x36788f){return this[_0xe8fe('0x4f')](_0xe8fe('0x50'),_0x36788f);};AGIChannel[_0xe8fe('0x28')][_0xe8fe('0x1a')]=function(_0x2fcdb6,_0x37d427){this[_0xe8fe('0x2e')](util[_0xe8fe('0x2d')](_0xe8fe('0x51'),_0x2fcdb6['id'],_0x2fcdb6[_0xe8fe('0x52')],_0x37d427));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe8fe('0x53')]=AGIChannel; \ No newline at end of file +var _0x5f88=['command','write','destroy','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','pipe'];(function(_0x2b4b0a,_0x5e6566){var _0x3448e7=function(_0x24de44){while(--_0x24de44){_0x2b4b0a['push'](_0x2b4b0a['shift']());}};_0x3448e7(++_0x5e6566);}(_0x5f88,0x1bb));var _0x85f8=function(_0x175773,_0x40e1f6){_0x175773=_0x175773-0x0;var _0x653e69=_0x5f88[_0x175773];return _0x653e69;};'use strict';var util=require(_0x85f8('0x0'));var _=require('lodash');var EventEmitter=require(_0x85f8('0x1'))[_0x85f8('0x2')];var AGIReply=require(_0x85f8('0x3'));var AGIError=require(_0x85f8('0x4'));function AGIChannel(_0x3a9e91){var _0xc962f4=this,_0x4bd644=new AGIReply(),_0x212060=![],_0x25f3f5={};EventEmitter[_0x85f8('0x5')](_0xc962f4);_0x3a9e91[_0x85f8('0x6')](_0x85f8('0x7'));_0x3a9e91[_0x85f8('0x8')](0x8*0x3c*0x3c*0x3e8);_0x4bd644[_0x85f8('0x6')]('utf8');_0x4bd644['on'](_0x85f8('0x9'),function(_0x530f16){for(var _0x46d6eb in _0x530f16){_0xc962f4[_0x46d6eb]=_0x530f16[_0x46d6eb];}_0xc962f4['emit'](_0x85f8('0xa'));});_0x4bd644['on'](_0x85f8('0xb'),function(_0x2d9f79){if(_0x2d9f79[_0x85f8('0xc')]()==_0x85f8('0xd')){_0xc962f4[_0x85f8('0xe')](_0x85f8('0xd'));return;}if(_0x2d9f79[_0x85f8('0xf')](0x0,0xb)==_0x85f8('0x10')){_0x212060=!![];}if(_0x212060){_0x25f3f5['rx']+=_0x2d9f79+'\x0a';if(_0x2d9f79[_0x85f8('0x11')](_0x85f8('0x12'))!=-0x1){_0x212060=![];}}else{_0x25f3f5['rx']=_0x2d9f79;}if(_0x212060){return;}if(typeof _0x25f3f5['cb']==_0x85f8('0x13')){var _0x31c633=_0x25f3f5['rx'][_0x85f8('0xf')](0x0,0x3),_0x49132f=null,_0x22be91=null;_0x31c633=parseInt(_0x31c633);if(isNaN(_0x31c633)){_0x25f3f5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x31c633!=0xc8){_0x25f3f5['cb'](null,{'code':_0x31c633,'result':-0x1,'extra':'KO'});return;}_0x49132f=_0x25f3f5['rx'][_0x85f8('0xf')](0x4)['replace'](_0x85f8('0x14'),'');if(_0x49132f[_0x85f8('0x15')]('\x20')!=-0x1){_0x49132f=_0x49132f[_0x85f8('0x16')](0x0,_0x49132f['indexOf']('\x20'));}if(_[_0x85f8('0x17')](_0x49132f,'-1')){_0x49132f=parseInt(_0x49132f);}_0x22be91=_0x25f3f5['rx']['split']('\x20');if(_0x22be91[_0x85f8('0x18')]==0x3){_0x22be91=_0x22be91[0x2][_0x85f8('0xf')](0x1,_0x22be91[0x2]['length']-0x1);}else if(_0x22be91['length']>0x3){var _0x3445a3=/\((.+)\)/;var _0x144920=_0x25f3f5['rx'][_0x85f8('0x19')](_0x3445a3);if(_0x144920){_0x22be91=_0x144920[0x1];}else{_0x22be91=null;}}else{_0x22be91=null;}_0x25f3f5['cb'](null,{'code':_0x31c633,'result':_0x49132f,'extra':_0x22be91});}});_0x3a9e91['on'](_0x85f8('0x1a'),function(_0x34e651){_0xc962f4['emit']('error',new AGIError(_0x85f8('0x1b'),_0x34e651['code']));});_0x3a9e91['on'](_0x85f8('0x1c'),function(){_0xc962f4[_0x85f8('0xe')](_0x85f8('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3a9e91['on']('timeout',function(){_0xc962f4[_0x85f8('0xe')](_0x85f8('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3a9e91['destroy']();});_0x3a9e91[_0x85f8('0x1e')](_0x4bd644);this[_0x85f8('0x1f')]=function(_0x39fae0,_0x1c014b){var _0x39fae0=_0x39fae0||'',_0x1c014b=typeof _0x1c014b==_0x85f8('0x13')?_0x1c014b:new Function();_0x25f3f5={'tx':_0x39fae0,'rx':'','cb':_0x1c014b};_0x3a9e91[_0x85f8('0x20')](_0x39fae0+'\x0a');},this['close']=function(){_0x3a9e91[_0x85f8('0x21')]();};}util[_0x85f8('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x85f8('0x23')][_0x85f8('0x24')]=function(_0x1fe1c2){return this[_0x85f8('0x1f')][_0x85f8('0x25')](this,_0x1fe1c2);};AGIChannel[_0x85f8('0x23')][_0x85f8('0x26')]=function(){return this[_0x85f8('0x24')](_0x85f8('0x27'));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x28')]=function(_0x19d1f8,_0x11d056,_0x50ec4d){_0x19d1f8=_0x19d1f8===undefined?'beep':_0x19d1f8;_0x11d056=_0x11d056===undefined?'5':_0x11d056;_0x50ec4d=_0x50ec4d===undefined?'1':_0x50ec4d;return this[_0x85f8('0x24')](util[_0x85f8('0x29')](_0x85f8('0x2a'),_0x19d1f8,_0x11d056*0x3e8,_0x50ec4d));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x2b')]=function(_0x4d2b2f){_0x4d2b2f=_0x4d2b2f||_0x85f8('0x2c');return this[_0x85f8('0x24')](util[_0x85f8('0x29')](_0x85f8('0x2d'),_0x4d2b2f));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x2e')]=function(_0x39b821,_0x4efcd7){if(_[_0x85f8('0x2f')](_0x4efcd7)){return this[_0x85f8('0x24')](util[_0x85f8('0x29')]('EXEC\x20%s\x20%s',_0x39b821,_0x4efcd7['join'](',')));}return this[_0x85f8('0x24')](util[_0x85f8('0x29')]('EXEC\x20%s\x20%s',_0x39b821,_0x4efcd7));};AGIChannel['prototype'][_0x85f8('0x30')]=function(_0xa56238){return this[_0x85f8('0x24')](util[_0x85f8('0x29')](_0x85f8('0x31'),_0xa56238));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x32')]=function(_0x17c179){return this['sendRequest'](util[_0x85f8('0x29')](_0x85f8('0x33'),_0x17c179));};AGIChannel[_0x85f8('0x23')]['setPriority']=function(_0x43f718){return this[_0x85f8('0x24')](util[_0x85f8('0x29')](_0x85f8('0x34'),_0x43f718));};AGIChannel[_0x85f8('0x23')][_0x85f8('0xd')]=function(){return this['sendRequest'](_0x85f8('0x35'));};AGIChannel['prototype'][_0x85f8('0x36')]=function(_0x508485,_0x4d8a54){var _0x44c6c4=_[_0x85f8('0x37')](_0x4d8a54)||_['isNumber'](_0x4d8a54)?_0x4d8a54['toString']():_0x4d8a54;return this[_0x85f8('0x24')](util[_0x85f8('0x29')](_0x85f8('0x38'),_0x508485,_0x44c6c4?_0x44c6c4['toString']()[_0x85f8('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x50f2d4,_0x2f0aa3){return this['sendRequest'](util[_0x85f8('0x29')](_0x85f8('0x3a'),_0x50f2d4,_0x2f0aa3));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x3b')]=function(_0x2b10c0,_0x11f3ab){return this[_0x85f8('0x24')](util[_0x85f8('0x29')](_0x85f8('0x3c'),_0x2b10c0,_0x11f3ab));};AGIChannel[_0x85f8('0x23')]['sayPhonetic']=function(_0x1757c1,_0x1a9dbd){return this[_0x85f8('0x24')](util['format'](_0x85f8('0x3d'),_0x1757c1,_0x1a9dbd));};AGIChannel[_0x85f8('0x23')]['continueAt']=function(_0x4d442e,_0x183739,_0xcd0b39){_0x183739=_0x183739||this[_0x85f8('0x3e')];_0xcd0b39=_0xcd0b39||0x1;this[_0x85f8('0x30')](_0x4d442e);this['setExtension'](_0x183739);this[_0x85f8('0x3f')](_0xcd0b39);return this[_0x85f8('0x2b')](util[_0x85f8('0x29')](_0x85f8('0x40'),_0x4d442e,_0x183739,_0xcd0b39));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x41')]=function(_0x5fd4a4){return this[_0x85f8('0x24')](util['format'](_0x85f8('0x42'),_0x5fd4a4));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x43')]=function(_0x69110c,_0x218395,_0x432d73,_0xfb29c0,_0x33a268,_0x7013e2){_0x218395=_0x218395||_0x85f8('0x44');_0x432d73=_0x432d73||'';_0xfb29c0=_0xfb29c0===undefined?-0x1:_0xfb29c0==='-1'?-0x1:_0xfb29c0*0x3e8;_0x33a268=_0x33a268===undefined?'':'s='+_0x33a268;_0x7013e2=_0x7013e2?_0x85f8('0x45'):'';return this[_0x85f8('0x24')](util[_0x85f8('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x69110c,_0x218395,_0x432d73,_0xfb29c0,_0x7013e2,_0x33a268));};AGIChannel['prototype'][_0x85f8('0x46')]=function(_0x29f6a1,_0x247d6b){_0x247d6b=_0x247d6b||'';return this[_0x85f8('0x24')](util[_0x85f8('0x29')](_0x85f8('0x47'),_0x29f6a1,_0x247d6b));};AGIChannel[_0x85f8('0x23')][_0x85f8('0x48')]=function(_0x5cb29b){return this[_0x85f8('0x2e')](_0x85f8('0x49'),_0x5cb29b);};AGIChannel[_0x85f8('0x23')][_0x85f8('0x4a')]=function(_0x49fe86){return this[_0x85f8('0x2e')](_0x85f8('0x4b'),_0x49fe86);};AGIChannel[_0x85f8('0x23')][_0x85f8('0x1a')]=function(_0x3e2eb0,_0x42ece6){this['noop'](util['format'](_0x85f8('0x4c'),_0x3e2eb0['id'],_0x3e2eb0[_0x85f8('0x4d')],_0x42ece6));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x85f8('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 14d1f64..806b605 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 _0xdf7a=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x1e4303,_0x278c0f){var _0x34b8fa=function(_0x580b65){while(--_0x580b65){_0x1e4303['push'](_0x1e4303['shift']());}};_0x34b8fa(++_0x278c0f);}(_0xdf7a,0x79));var _0xadf7=function(_0x8a912d,_0x53c52b){_0x8a912d=_0x8a912d-0x0;var _0x4fb44b=_0xdf7a[_0x8a912d];return _0x4fb44b;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xadf7('0x0'),'E_AGI_ARGUMENT_PORT':_0xadf7('0x1'),'E_AGI_SERVER_ERROR':_0xadf7('0x2'),'E_AGI_SERVER_CLOSE':_0xadf7('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xadf7('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xadf7('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xadf7('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xadf7('0x7')};function AGIError(_0x5d12cd){var _0x5d12cd=_0x5d12cd||null,_0x7f4536=_0x7f4536||[],_0x44faf5=0x1,_0x27e0a4='';if(!error[_0x5d12cd]){_0x5d12cd=_0xadf7('0x8');}_0x7f4536[_0xadf7('0x9')](error[_0x5d12cd]);while(arguments[_0x44faf5]){_0x7f4536[_0xadf7('0x9')](arguments[_0x44faf5]);_0x44faf5++;}_0x27e0a4=util[_0xadf7('0xa')][_0xadf7('0xb')](util,_0x7f4536);this[_0xadf7('0xc')]=_0x27e0a4;this[_0xadf7('0xd')]=_0x5d12cd;}module['exports']=AGIError; \ No newline at end of file +var _0x8a93=['format','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x8a93,0x1b5));var _0x38a9=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x8a93[_0x15a634];return _0xf4f7a0;};'use strict';var util=require(_0x38a9('0x0'));var error={'E_AGI_UNDEFINED':_0x38a9('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x38a9('0x2'),'E_AGI_SERVER_CLOSE':_0x38a9('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x38a9('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x38a9('0x5'),'E_AGI_SOCKET_ERROR':_0x38a9('0x6'),'E_AGI_SOCKET_CLOSE':_0x38a9('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x38a9('0x8'),'E_AGI_IVR_ENTRY':_0x38a9('0x9')};function AGIError(_0x52b302){var _0x52b302=_0x52b302||null,_0x41d233=_0x41d233||[],_0x502ade=0x1,_0x5754d2='';if(!error[_0x52b302]){_0x52b302='E_AGI_UNDEFINED';}_0x41d233[_0x38a9('0xa')](error[_0x52b302]);while(arguments[_0x502ade]){_0x41d233['push'](arguments[_0x502ade]);_0x502ade++;}_0x5754d2=util[_0x38a9('0xb')][_0x38a9('0xc')](util,_0x41d233);this[_0x38a9('0xd')]=_0x5754d2;this[_0x38a9('0xe')]=_0x52b302;}module[_0x38a9('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6a0ee36..f521e52 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 _0xe140=['default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','relations','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','default','target','invalid','traverseBFS','vswitch'];(function(_0x179a0c,_0x2ca073){var _0x1c8b9a=function(_0xfa6124){while(--_0xfa6124){_0x179a0c['push'](_0x179a0c['shift']());}};_0x1c8b9a(++_0x2ca073);}(_0xe140,0x9f));var _0x0e14=function(_0xe06a8e,_0x197e62){_0xe06a8e=_0xe06a8e-0x0;var _0x3dc1d0=_0xe140[_0xe06a8e];return _0x3dc1d0;};'use strict';var _=require(_0x0e14('0x0'));var logger=require(_0x0e14('0x1'))(_0x0e14('0x2'));var verticesWithRetry=[_0x0e14('0x3'),'getdigits',_0x0e14('0x4')];var Graph=function(){this[_0x0e14('0x5')]={};this[_0x0e14('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0x0e14('0x7')][_0x0e14('0x8')]=function(_0x1e4f30){this[_0x0e14('0x5')][_0x1e4f30['id']]=_0x1e4f30;this['edges'][_0x1e4f30['id']]=[];};Graph['prototype'][_0x0e14('0x9')]=function(_0x4649eb,_0x5b8872,_0x1e9694){this[_0x0e14('0x6')][_0x4649eb][_0x0e14('0xa')]({'target':_0x5b8872,'condition':_0x1e9694});this[_0x0e14('0xb')]+=0x1;};Graph[_0x0e14('0x7')][_0x0e14('0xc')]=function(){return _[_0x0e14('0xc')](this[_0x0e14('0x5')]);};Graph[_0x0e14('0x7')][_0x0e14('0xd')]=function(){return this[_0x0e14('0xb')];};Graph[_0x0e14('0x7')]['getVertex']=function(_0x4f49f9){return this[_0x0e14('0x5')][_0x4f49f9];};Graph[_0x0e14('0x7')]['traverseBFS']=function(_0x31ae49,_0x2fe5f2){if(!this[_0x0e14('0x5')][_0x31ae49]){return logger[_0x0e14('0xe')](_0x0e14('0xf'));}var _0x25c1d5=_0x2fe5f2(this[_0x0e14('0x5')][_0x31ae49]);if(!_0x25c1d5){return logger[_0x0e14('0xe')](_0x0e14('0x10'));}if(this['edges'][_0x31ae49][_0x0e14('0x11')]===0x0){return logger[_0x0e14('0xe')](_0x0e14('0x12'));}for(var _0x55f059=0x0,_0x39f13d=[],_0x3ca9d8=![];_0x55f059\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','catch','createSquareReport','then','substring','inspect','debug','stringify','timeout','hangup','sync','production','start','root','joinAt','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','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','extension','priority','code','result','toString','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','context','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','127.0.0.1','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x1979f0,_0x2e481d){var _0x17794e=function(_0x10f841){while(--_0x10f841){_0x1979f0['push'](_0x1979f0['shift']());}};_0x17794e(++_0x2e481d);}(_0xc20a,0xa9));var _0xac20=function(_0x513a48,_0x3b00d6){_0x513a48=_0x513a48-0x0;var _0x5eb34f=_0xc20a[_0x513a48];return _0x5eb34f;};'use strict';var parser=require(_0xac20('0x0'));var _=require(_0xac20('0x1'));var syncho=require(_0xac20('0x2'));var util=require(_0xac20('0x3'));var moment=require(_0xac20('0x4'));var config=require(_0xac20('0x5'));var logger=require(_0xac20('0x6'))(_0xac20('0x7'));var utilLicense=require(_0xac20('0x8'));var rpc=require(_0xac20('0x9'));var mailRpc=require(_0xac20('0xa'));var Graph=require(_0xac20('0xb'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xac20('0x7')]=_[_0xac20('0xc')](config['agi'],{'ip':_0xac20('0xd'),'port':0x11dd});function connectionHandler(_0x6113a2){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x6113a2);agiHandler(_0x6113a2);}catch(_0x1fc85f){logger['error'](_0x1fc85f[_0xac20('0xe')]);}});});}function listeningHandler(){console[_0xac20('0xf')](_0xac20('0x10'),config[_0xac20('0x7')][_0xac20('0x11')]);logger[_0xac20('0x12')](util[_0xac20('0x13')](_0xac20('0x14'),config[_0xac20('0x7')]['ip'],config[_0xac20('0x7')]['port']));}function errorHandler(_0x1d746f){if(_0x1d746f&&_0x1d746f[_0xac20('0x15')]&&_0x1d746f[_0xac20('0x16')]){logger['error'](util['format'](_0xac20('0x17'),_0x1d746f[_0xac20('0x15')],_0x1d746f[_0xac20('0x16')]));}else{logger[_0xac20('0x18')](util[_0xac20('0x13')](_0xac20('0x19'),_0x1d746f['stack']));}}function closeHandler(){logger[_0xac20('0x12')](util[_0xac20('0x13')](_0xac20('0x1a'),this[_0xac20('0x1b')],this[_0xac20('0x1c')],this[_0xac20('0x1d')],this['dnid'],this[_0xac20('0x1e')]));try{createSquareReport(this);}catch(_0x41319c){logger[_0xac20('0x18')](_0x41319c[_0xac20('0xe')]);}}function timeoutHandler(){logger[_0xac20('0x12')](util[_0xac20('0x13')](_0xac20('0x1f'),this[_0xac20('0x1b')],this[_0xac20('0x1c')],this[_0xac20('0x1d')],this['dnid'],this[_0xac20('0x1e')]));}function hangupHandler(){logger[_0xac20('0x12')](util[_0xac20('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xac20('0x1b')],this[_0xac20('0x1c')],this[_0xac20('0x1d')],this[_0xac20('0x20')],this[_0xac20('0x1e')]));this[_0xac20('0x21')]=!![];}function getRoot(_0x4c1836){return parser[_0xac20('0x22')](_0x4c1836,{'object':!![]})[_0xac20('0x23')]['root'];}function addVertex(_0x57b535,_0x29446e,_0x38b57e){_0x29446e[_0xac20('0x24')]=_0x38b57e;if(_0x29446e[_0xac20('0x25')](_0xac20('0x26'))){_0x29446e['maxRetry']=parseInt(_0x29446e[_0xac20('0x26')],0xa);}_0x57b535[_0xac20('0x27')](_[_0xac20('0x28')](_0x29446e,_0xac20('0x29')));}function initGraph(_0x1027f1,_0xbd7616){var _0x52f5a5=new Graph();for(var _0x3f56ea in _0x1027f1){if(_0x1027f1[_0xac20('0x25')](_0x3f56ea)){if(_[_0xac20('0x2a')](_0x1027f1[_0x3f56ea])){for(var _0x533fde=0x0;_0x533fde<_0x1027f1[_0x3f56ea][_0xac20('0x2b')];_0x533fde+=0x1){addVertex(_0x52f5a5,_0x1027f1[_0x3f56ea][_0x533fde],_0x3f56ea);}}else{addVertex(_0x52f5a5,_0x1027f1[_0x3f56ea],_0x3f56ea);}}}for(var _0x209551=0x0;_0x209551<_0xbd7616['length'];_0x209551+=0x1){if(_0xbd7616[_0x209551][_0xac20('0x2c')]&&_0xbd7616[_0x209551][_0xac20('0x2d')]){_0x52f5a5[_0xac20('0x2e')](_0xbd7616[_0x209551][_0xac20('0x2c')],_0xbd7616[_0x209551][_0xac20('0x2d')],_0xbd7616[_0x209551][_0xac20('0x2f')]);}}return _0x52f5a5;}function getSquareProject(_0x4b3e16,_0x488a0e){rpc['getSquareProject'](_0x4b3e16)['then'](function(_0x23dc95){_0x488a0e(null,_0x23dc95);})[_0xac20('0x30')](function(_0x139f45){_0x488a0e(null,_0x139f45);});}function createSquareReport(_0x5ef2c4,_0x5223d1){rpc[_0xac20('0x31')](_0x5ef2c4)[_0xac20('0x32')](function(_0x356408){if(_0x5223d1){_0x5223d1(null,_0x356408);}})['catch'](function(_0xa63bac){if(_0x5223d1){_0x5223d1(null,_0xa63bac);}});}function setChannelVariables(_0x1955b8){for(var _0x4199a3 in _0x1955b8){if(_0x1955b8[_0xac20('0x25')](_0x4199a3)){if(_0x4199a3['indexOf']('agi_')===0x0){_0x1955b8[_0x4199a3[_0xac20('0x33')](0x4)]=_0x1955b8[_0x4199a3];delete _0x1955b8[_0x4199a3];}}}}function getLogFromObject(_0x1ef9ba){return util[_0xac20('0x34')](_0x1ef9ba,{'showHidden':![],'depth':null});}function agiHandler(_0x4e2c07){var _0x16a484,_0x26c5e5,_0x3afeaf,_0x4e2ece,_0x9a7fd1;logger[_0xac20('0x35')]('variables',JSON[_0xac20('0x36')](_0x4e2c07,null,0x2));logger[_0xac20('0x12')](util[_0xac20('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4e2c07['arg_1'],_0x4e2c07[_0xac20('0x1c')],_0x4e2c07['callerid'],_0x4e2c07[_0xac20('0x20')],_0x4e2c07[_0xac20('0x1e')]));_0x4e2c07['on']('error',errorHandler);_0x4e2c07['on']('close',closeHandler);_0x4e2c07['on'](_0xac20('0x37'),timeoutHandler);_0x4e2c07[_0xac20('0x21')]=![];_0x4e2c07['on'](_0xac20('0x38'),hangupHandler);var _0x37a908=getSquareProject[_0xac20('0x39')](null,_0x4e2c07[_0xac20('0x1b')]);if(_0x37a908){if(_0x37a908[_0xac20('0x3a')]){_0x16a484=getRoot(_0x37a908['production']);if(_0x16a484&&_0x16a484[_0xac20('0x3b')]){logger['debug'](_0xac20('0x3c'),JSON[_0xac20('0x36')](_0x16a484,null,0x2));_0x4e2c07[_0xac20('0x3d')]=moment()[_0xac20('0x13')](_0xac20('0x3e'));_0x26c5e5=initGraph(_[_0xac20('0x28')](_0x16a484,_0xac20('0x29')),_0x16a484['mxCell']);_0x3afeaf=new Vertices(_0x4e2c07,rpc,mailRpc);logger['info'](util[_0xac20('0x13')](_0xac20('0x3f'),_0x4e2c07[_0xac20('0x1b')],_0x4e2c07[_0xac20('0x1c')],_0x4e2c07[_0xac20('0x1d')],_0x4e2c07['dnid'],_0x4e2c07[_0xac20('0x1e')]));_0x26c5e5[_0xac20('0x40')](_0x16a484[_0xac20('0x3b')]['id'],function(_0x458cf5){try{_0x458cf5=_0x3afeaf[_0xac20('0x41')](_0x458cf5);logger[_0xac20('0x35')](_0xac20('0x42'),JSON[_0xac20('0x36')](_0x458cf5,null,0x2));if(_0x458cf5['agicommand']===_0xac20('0x43')){logger['info'](_0xac20('0x44'));_0x4e2c07['context']=_0x458cf5['context']||_0x4e2c07['context'];_0x4e2c07[_0xac20('0x45')]=_0x458cf5['extension'];_0x4e2c07['priority']=_0x458cf5[_0xac20('0x46')]?_0x458cf5[_0xac20('0x46')]-0x1:0x1;return null;}else if(_0x458cf5&&_0x3afeaf[_0x458cf5[_0xac20('0x24')]]){_0x9a7fd1=_0x3afeaf[_0x458cf5[_0xac20('0x24')]](_0x458cf5);logger[_0xac20('0x12')]('response',JSON['stringify'](_0x9a7fd1,null,0x2));if(_0x9a7fd1&&_0x9a7fd1[_0xac20('0x47')]===AGI_CODE_SUCCESS&&_0x9a7fd1[_0xac20('0x48')]!==AGI_RESULT_ERROR&&!_0x4e2c07[_0xac20('0x21')]){logger[_0xac20('0x35')]('response',getLogFromObject(_0x9a7fd1));return _['isUndefined'](_0x9a7fd1[_0xac20('0x48')])?null:_0x9a7fd1[_0xac20('0x48')][_0xac20('0x49')]();}else{logger['error'](_0xac20('0x4a'),getLogFromObject(_0x9a7fd1));return null;}}else{logger[_0xac20('0x18')](_0xac20('0x4b'));return null;}}catch(_0x47e04c){logger[_0xac20('0x18')](_0x47e04c[_0xac20('0xe')]);return null;}});if(_0x16a484[_0xac20('0x4c')]){logger[_0xac20('0x12')](util[_0xac20('0x13')](_0xac20('0x4d'),_0x4e2c07[_0xac20('0x1b')],_0x4e2c07[_0xac20('0x1c')],_0x4e2c07[_0xac20('0x1d')],_0x4e2c07[_0xac20('0x20')],_0x4e2c07[_0xac20('0x1e')]));_0x26c5e5[_0xac20('0x40')](_0x16a484['finally']['id'],function(_0x5e2154){try{_0x5e2154=_0x3afeaf['clear'](_0x5e2154);logger['debug']('vertex',JSON['stringify'](_0x5e2154,null,0x2));if(_0x5e2154&&_0x3afeaf[_0x5e2154[_0xac20('0x24')]]){_0x9a7fd1=_0x3afeaf[_0x5e2154[_0xac20('0x24')]](_0x5e2154);if(_0x9a7fd1){logger[_0xac20('0x35')](_0xac20('0x4a'),getLogFromObject(_0x9a7fd1));return _[_0xac20('0x4e')](_0x9a7fd1[_0xac20('0x48')])?null:_0x9a7fd1[_0xac20('0x48')]['toString']();}else{logger[_0xac20('0x18')](_0xac20('0x4a'),getLogFromObject(_0x9a7fd1));return null;}}else{logger[_0xac20('0x18')](_0xac20('0x4b'));return null;}}catch(_0x222483){logger[_0xac20('0x18')](_0x222483[_0xac20('0xe')]);return null;}});}logger['info'](util[_0xac20('0x13')](_0xac20('0x4f'),_0x4e2c07[_0xac20('0x1b')],_0x4e2c07[_0xac20('0x1c')],_0x4e2c07[_0xac20('0x1d')],_0x4e2c07[_0xac20('0x20')],_0x4e2c07[_0xac20('0x1e')]));logger['info'](util[_0xac20('0x13')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4e2c07['context'],_0x4e2c07[_0xac20('0x45')],parseInt(_0x4e2c07[_0xac20('0x46')],0xa)+0x1));_0x4e2c07[_0xac20('0x50')](_0x4e2c07[_0xac20('0x51')],_0x4e2c07[_0xac20('0x45')],parseInt(_0x4e2c07['priority'],0xa)+0x1);_0x4e2c07[_0xac20('0x52')]();}}else{logger[_0xac20('0x18')](util[_0xac20('0x13')](_0xac20('0x53'),_0x4e2c07['arg_1']));_0x4e2c07[_0xac20('0x50')](_0x4e2c07['context'],_0x4e2c07[_0xac20('0x45')],parseInt(_0x4e2c07[_0xac20('0x46')],0xa)+0x1);_0x4e2c07[_0xac20('0x52')]();}}else{logger[_0xac20('0x18')](util[_0xac20('0x13')](_0xac20('0x54'),_0x4e2c07[_0xac20('0x1b')]));_0x4e2c07[_0xac20('0x50')](_0x4e2c07[_0xac20('0x51')],_0x4e2c07['extension'],parseInt(_0x4e2c07[_0xac20('0x46')],0xa)+0x1);_0x4e2c07[_0xac20('0x52')]();}}function main(){var _0x1e3f68;return utilLicense['getLicense']()[_0xac20('0x32')](function(_0x11277e){if(_0x11277e){if(_0x11277e[_0xac20('0x55')]){if(_0x11277e[_0xac20('0x56')]&&_0x11277e['callysquare']>0x0){logger[_0xac20('0x12')](util['format'](_0xac20('0x57'),_0x11277e[_0xac20('0x56')]));_0x1e3f68=_0x11277e[_0xac20('0x56')];}else{logger[_0xac20('0x12')](_0xac20('0x58'));}}else{logger[_0xac20('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1e3f68=-0x1;}}})['catch'](function(_0x21d909){logger[_0xac20('0x18')](_0xac20('0x59'),_0x21d909[_0xac20('0xe')]);})[_0xac20('0x4c')](function(){var _0x774d86=require(_0xac20('0x5a'))(config['agi'][_0xac20('0x11')],config[_0xac20('0x7')]['ip'],_0x1e3f68);_0x774d86['on'](_0xac20('0x18'),errorHandler);_0x774d86['on'](_0xac20('0x5b'),listeningHandler);_0x774d86['on'](_0xac20('0x5c'),connectionHandler);_0x774d86['on'](_0xac20('0x52'),closeHandler);});}main(); \ No newline at end of file +var _0x8d2a=['[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','name','message','[%s]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','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','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','result','response','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s'];(function(_0x31cd50,_0x49d205){var _0x4b4bf2=function(_0x1fbf15){while(--_0x1fbf15){_0x31cd50['push'](_0x31cd50['shift']());}};_0x4b4bf2(++_0x49d205);}(_0x8d2a,0x11e));var _0xa8d2=function(_0x178244,_0x5795dc){_0x178244=_0x178244-0x0;var _0x5bc39c=_0x8d2a[_0x178244];return _0x5bc39c;};'use strict';var parser=require(_0xa8d2('0x0'));var _=require(_0xa8d2('0x1'));var syncho=require(_0xa8d2('0x2'));var util=require('util');var moment=require(_0xa8d2('0x3'));var config=require(_0xa8d2('0x4'));var logger=require(_0xa8d2('0x5'))(_0xa8d2('0x6'));var utilLicense=require(_0xa8d2('0x7'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xa8d2('0x8'));var Vertices=require(_0xa8d2('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xa8d2('0xa')](config[_0xa8d2('0x6')],{'ip':_0xa8d2('0xb'),'port':0x11dd});function connectionHandler(_0x459108){process[_0xa8d2('0xc')](function(){syncho(function(){try{setChannelVariables(_0x459108);agiHandler(_0x459108);}catch(_0x3e5309){logger[_0xa8d2('0xd')](_0x3e5309[_0xa8d2('0xe')]);}});});}function listeningHandler(){console[_0xa8d2('0xf')](_0xa8d2('0x10'),config[_0xa8d2('0x6')][_0xa8d2('0x11')]);logger['info'](util[_0xa8d2('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xa8d2('0x6')]['ip'],config[_0xa8d2('0x6')][_0xa8d2('0x11')]));}function errorHandler(_0x321389){if(_0x321389&&_0x321389[_0xa8d2('0x13')]&&_0x321389[_0xa8d2('0x14')]){logger[_0xa8d2('0xd')](util[_0xa8d2('0x12')](_0xa8d2('0x15'),_0x321389[_0xa8d2('0x13')],_0x321389[_0xa8d2('0x14')]));}else{logger[_0xa8d2('0xd')](util[_0xa8d2('0x12')]('[ERROR]\x20%s',_0x321389['stack']));}}function closeHandler(){logger[_0xa8d2('0x16')](util[_0xa8d2('0x12')](_0xa8d2('0x17'),this[_0xa8d2('0x18')],this[_0xa8d2('0x19')],this[_0xa8d2('0x1a')],this[_0xa8d2('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5cdf6b){logger[_0xa8d2('0xd')](_0x5cdf6b[_0xa8d2('0xe')]);}}function timeoutHandler(){logger[_0xa8d2('0x16')](util['format'](_0xa8d2('0x1c'),this['arg_1'],this[_0xa8d2('0x19')],this[_0xa8d2('0x1a')],this[_0xa8d2('0x1b')],this[_0xa8d2('0x1d')]));}function hangupHandler(){logger['info'](util['format'](_0xa8d2('0x1e'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xa8d2('0x1b')],this['uniqueid']));this[_0xa8d2('0x1f')]=!![];}function getRoot(_0x42f74b){return parser['toJson'](_0x42f74b,{'object':!![]})[_0xa8d2('0x20')][_0xa8d2('0x21')];}function addVertex(_0x5cef25,_0x298d9b,_0x5d8e70){_0x298d9b['agicommand']=_0x5d8e70;if(_0x298d9b['hasOwnProperty'](_0xa8d2('0x22'))){_0x298d9b[_0xa8d2('0x23')]=parseInt(_0x298d9b[_0xa8d2('0x22')],0xa);}_0x5cef25[_0xa8d2('0x24')](_[_0xa8d2('0x25')](_0x298d9b,_0xa8d2('0x26')));}function initGraph(_0x4fe367,_0x3a45f9){var _0x300612=new Graph();for(var _0x2d9f5c in _0x4fe367){if(_0x4fe367[_0xa8d2('0x27')](_0x2d9f5c)){if(_[_0xa8d2('0x28')](_0x4fe367[_0x2d9f5c])){for(var _0x362a49=0x0;_0x362a49<_0x4fe367[_0x2d9f5c][_0xa8d2('0x29')];_0x362a49+=0x1){addVertex(_0x300612,_0x4fe367[_0x2d9f5c][_0x362a49],_0x2d9f5c);}}else{addVertex(_0x300612,_0x4fe367[_0x2d9f5c],_0x2d9f5c);}}}for(var _0x261737=0x0;_0x261737<_0x3a45f9[_0xa8d2('0x29')];_0x261737+=0x1){if(_0x3a45f9[_0x261737][_0xa8d2('0x2a')]&&_0x3a45f9[_0x261737][_0xa8d2('0x2b')]){_0x300612[_0xa8d2('0x2c')](_0x3a45f9[_0x261737]['source'],_0x3a45f9[_0x261737][_0xa8d2('0x2b')],_0x3a45f9[_0x261737][_0xa8d2('0x2d')]);}}return _0x300612;}function getSquareProject(_0x4d196b,_0x1c02fe){rpc[_0xa8d2('0x2e')](_0x4d196b)[_0xa8d2('0x2f')](function(_0xfaf071){_0x1c02fe(null,_0xfaf071);})[_0xa8d2('0x30')](function(_0x3e291f){_0x1c02fe(null,_0x3e291f);});}function createSquareReport(_0x55ef72,_0x2dd4fc){rpc['createSquareReport'](_0x55ef72)['then'](function(_0x23a478){if(_0x2dd4fc){_0x2dd4fc(null,_0x23a478);}})[_0xa8d2('0x30')](function(_0x177fef){if(_0x2dd4fc){_0x2dd4fc(null,_0x177fef);}});}function setChannelVariables(_0x435f69){for(var _0x10f60a in _0x435f69){if(_0x435f69[_0xa8d2('0x27')](_0x10f60a)){if(_0x10f60a[_0xa8d2('0x31')](_0xa8d2('0x32'))===0x0){_0x435f69[_0x10f60a[_0xa8d2('0x33')](0x4)]=_0x435f69[_0x10f60a];delete _0x435f69[_0x10f60a];}}}}function getLogFromObject(_0x50e14e){return util[_0xa8d2('0x34')](_0x50e14e,{'showHidden':![],'depth':null});}function agiHandler(_0xe63f9e){var _0x1e42e2,_0x1ff62e,_0x42e53b,_0x57b496,_0x1f379a;logger[_0xa8d2('0x35')]('variables',JSON[_0xa8d2('0x36')](_0xe63f9e,null,0x2));logger[_0xa8d2('0x16')](util[_0xa8d2('0x12')](_0xa8d2('0x37'),_0xe63f9e[_0xa8d2('0x18')],_0xe63f9e[_0xa8d2('0x19')],_0xe63f9e[_0xa8d2('0x1a')],_0xe63f9e['dnid'],_0xe63f9e[_0xa8d2('0x1d')]));_0xe63f9e['on'](_0xa8d2('0xd'),errorHandler);_0xe63f9e['on'](_0xa8d2('0x38'),closeHandler);_0xe63f9e['on'](_0xa8d2('0x39'),timeoutHandler);_0xe63f9e['evtHangup']=![];_0xe63f9e['on'](_0xa8d2('0x3a'),hangupHandler);var _0x4cb72c=getSquareProject[_0xa8d2('0x3b')](null,_0xe63f9e['arg_1']);if(_0x4cb72c){if(_0x4cb72c[_0xa8d2('0x3c')]){_0x1e42e2=getRoot(_0x4cb72c[_0xa8d2('0x3c')]);if(_0x1e42e2&&_0x1e42e2[_0xa8d2('0x3d')]){logger['debug'](_0xa8d2('0x21'),JSON[_0xa8d2('0x36')](_0x1e42e2,null,0x2));_0xe63f9e[_0xa8d2('0x3e')]=moment()[_0xa8d2('0x12')](_0xa8d2('0x3f'));_0x1ff62e=initGraph(_[_0xa8d2('0x25')](_0x1e42e2,'mxCell'),_0x1e42e2[_0xa8d2('0x26')]);_0x42e53b=new Vertices(_0xe63f9e,rpc,mailRpc);logger[_0xa8d2('0x16')](util[_0xa8d2('0x12')](_0xa8d2('0x40'),_0xe63f9e[_0xa8d2('0x18')],_0xe63f9e['calleridname'],_0xe63f9e['callerid'],_0xe63f9e[_0xa8d2('0x1b')],_0xe63f9e['uniqueid']));_0x1ff62e['traverseBFS'](_0x1e42e2[_0xa8d2('0x3d')]['id'],function(_0x5da3f8){try{_0x5da3f8=_0x42e53b[_0xa8d2('0x41')](_0x5da3f8);logger[_0xa8d2('0x35')](_0xa8d2('0x42'),JSON[_0xa8d2('0x36')](_0x5da3f8,null,0x2));if(_0x5da3f8[_0xa8d2('0x43')]===_0xa8d2('0x44')){logger[_0xa8d2('0x16')](_0xa8d2('0x45'));_0xe63f9e[_0xa8d2('0x46')]=_0x5da3f8['context']||_0xe63f9e[_0xa8d2('0x46')];_0xe63f9e['extension']=_0x5da3f8['extension'];_0xe63f9e[_0xa8d2('0x47')]=_0x5da3f8[_0xa8d2('0x47')]?_0x5da3f8[_0xa8d2('0x47')]-0x1:0x1;return null;}else if(_0x5da3f8&&_0x42e53b[_0x5da3f8['agicommand']]){_0x1f379a=_0x42e53b[_0x5da3f8[_0xa8d2('0x43')]](_0x5da3f8);logger['info']('response',JSON[_0xa8d2('0x36')](_0x1f379a,null,0x2));if(_0x1f379a&&_0x1f379a['code']===AGI_CODE_SUCCESS&&_0x1f379a[_0xa8d2('0x48')]!==AGI_RESULT_ERROR&&!_0xe63f9e[_0xa8d2('0x1f')]){logger[_0xa8d2('0x35')](_0xa8d2('0x49'),getLogFromObject(_0x1f379a));return _[_0xa8d2('0x4a')](_0x1f379a[_0xa8d2('0x48')])?null:_0x1f379a[_0xa8d2('0x48')][_0xa8d2('0x4b')]();}else{logger[_0xa8d2('0xd')]('response',getLogFromObject(_0x1f379a));return null;}}else{logger[_0xa8d2('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x49075d){logger[_0xa8d2('0xd')](_0x49075d[_0xa8d2('0xe')]);return null;}});if(_0x1e42e2[_0xa8d2('0x4c')]){logger[_0xa8d2('0x16')](util[_0xa8d2('0x12')](_0xa8d2('0x4d'),_0xe63f9e[_0xa8d2('0x18')],_0xe63f9e[_0xa8d2('0x19')],_0xe63f9e[_0xa8d2('0x1a')],_0xe63f9e[_0xa8d2('0x1b')],_0xe63f9e['uniqueid']));_0x1ff62e[_0xa8d2('0x4e')](_0x1e42e2[_0xa8d2('0x4c')]['id'],function(_0x50bc89){try{_0x50bc89=_0x42e53b[_0xa8d2('0x41')](_0x50bc89);logger['debug'](_0xa8d2('0x42'),JSON[_0xa8d2('0x36')](_0x50bc89,null,0x2));if(_0x50bc89&&_0x42e53b[_0x50bc89[_0xa8d2('0x43')]]){_0x1f379a=_0x42e53b[_0x50bc89['agicommand']](_0x50bc89);if(_0x1f379a){logger[_0xa8d2('0x35')](_0xa8d2('0x49'),getLogFromObject(_0x1f379a));return _[_0xa8d2('0x4a')](_0x1f379a['result'])?null:_0x1f379a[_0xa8d2('0x48')][_0xa8d2('0x4b')]();}else{logger[_0xa8d2('0xd')](_0xa8d2('0x49'),getLogFromObject(_0x1f379a));return null;}}else{logger[_0xa8d2('0xd')](_0xa8d2('0x4f'));return null;}}catch(_0x257769){logger[_0xa8d2('0xd')](_0x257769['stack']);return null;}});}logger[_0xa8d2('0x16')](util[_0xa8d2('0x12')](_0xa8d2('0x50'),_0xe63f9e['arg_1'],_0xe63f9e[_0xa8d2('0x19')],_0xe63f9e[_0xa8d2('0x1a')],_0xe63f9e[_0xa8d2('0x1b')],_0xe63f9e[_0xa8d2('0x1d')]));logger['info'](util[_0xa8d2('0x12')](_0xa8d2('0x51'),_0xe63f9e['context'],_0xe63f9e[_0xa8d2('0x52')],parseInt(_0xe63f9e[_0xa8d2('0x47')],0xa)+0x1));_0xe63f9e[_0xa8d2('0x53')](_0xe63f9e['context'],_0xe63f9e[_0xa8d2('0x52')],parseInt(_0xe63f9e['priority'],0xa)+0x1);_0xe63f9e['close']();}}else{logger[_0xa8d2('0xd')](util[_0xa8d2('0x12')](_0xa8d2('0x54'),_0xe63f9e[_0xa8d2('0x18')]));_0xe63f9e[_0xa8d2('0x53')](_0xe63f9e['context'],_0xe63f9e[_0xa8d2('0x52')],parseInt(_0xe63f9e[_0xa8d2('0x47')],0xa)+0x1);_0xe63f9e[_0xa8d2('0x38')]();}}else{logger[_0xa8d2('0xd')](util[_0xa8d2('0x12')](_0xa8d2('0x55'),_0xe63f9e[_0xa8d2('0x18')]));_0xe63f9e['continueAt'](_0xe63f9e[_0xa8d2('0x46')],_0xe63f9e[_0xa8d2('0x52')],parseInt(_0xe63f9e[_0xa8d2('0x47')],0xa)+0x1);_0xe63f9e[_0xa8d2('0x38')]();}}function main(){var _0x32c973;return utilLicense[_0xa8d2('0x56')]()[_0xa8d2('0x2f')](function(_0xe513fd){if(_0xe513fd){if(_0xe513fd[_0xa8d2('0x57')]){if(_0xe513fd[_0xa8d2('0x58')]&&_0xe513fd[_0xa8d2('0x58')]>0x0){logger[_0xa8d2('0x16')](util[_0xa8d2('0x12')](_0xa8d2('0x59'),_0xe513fd[_0xa8d2('0x58')]));_0x32c973=_0xe513fd[_0xa8d2('0x58')];}else{logger[_0xa8d2('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xa8d2('0x16')](_0xa8d2('0x5a'));_0x32c973=-0x1;}}})[_0xa8d2('0x30')](function(_0x2aeb72){logger['error'](_0xa8d2('0x5b'),_0x2aeb72[_0xa8d2('0xe')]);})['finally'](function(){var _0x5dbd29=require(_0xa8d2('0x5c'))(config[_0xa8d2('0x6')]['port'],config['agi']['ip'],_0x32c973);_0x5dbd29['on'](_0xa8d2('0xd'),errorHandler);_0x5dbd29['on']('listening',listeningHandler);_0x5dbd29['on'](_0xa8d2('0x5d'),connectionHandler);_0x5dbd29['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 0bf9f2d..2f0234f 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 _0x52f1=['catch','sendMailMessage','SendMail','jayson/promise','http','request','then','error','message','result'];(function(_0x3495e7,_0x2f6a1f){var _0x5cbb6f=function(_0x247f30){while(--_0x247f30){_0x3495e7['push'](_0x3495e7['shift']());}};_0x5cbb6f(++_0x2f6a1f);}(_0x52f1,0x157));var _0x152f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x52f1[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x152f('0x0'));var client=jayson['client'][_0x152f('0x1')]({'port':0x232b});function request(_0x4cd11c,_0x4711db){return new BPromise(function(_0x2609ac,_0x5cacb5){return client[_0x152f('0x2')](_0x4cd11c,_0x4711db)[_0x152f('0x3')](function(_0x31f253){if(_0x31f253[_0x152f('0x4')]){return _0x5cacb5(_0x31f253[_0x152f('0x4')][_0x152f('0x5')]);}else{return _0x2609ac(_0x31f253[_0x152f('0x6')]);}})[_0x152f('0x7')](function(_0x12ea1f){return _0x5cacb5(_0x12ea1f);});});}exports[_0x152f('0x8')]=function(_0x5ed8a6,_0x2a1b09){return request(_0x152f('0x9'),{'account':_0x5ed8a6,'message':_0x2a1b09});}; \ No newline at end of file +var _0xddce=['client','request','then','error','result','catch','sendMailMessage','SendMail','jayson/promise'];(function(_0xc0c3a2,_0x5ea990){var _0x51c409=function(_0x2b03e1){while(--_0x2b03e1){_0xc0c3a2['push'](_0xc0c3a2['shift']());}};_0x51c409(++_0x5ea990);}(_0xddce,0x18b));var _0xeddc=function(_0x108a93,_0x12b6e0){_0x108a93=_0x108a93-0x0;var _0x150466=_0xddce[_0x108a93];return _0x150466;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xeddc('0x0'));var client=jayson[_0xeddc('0x1')]['http']({'port':0x232b});function request(_0xe675c8,_0xb77df){return new BPromise(function(_0x201739,_0x35c089){return client[_0xeddc('0x2')](_0xe675c8,_0xb77df)[_0xeddc('0x3')](function(_0x3c9c34){if(_0x3c9c34[_0xeddc('0x4')]){return _0x35c089(_0x3c9c34['error']['message']);}else{return _0x201739(_0x3c9c34[_0xeddc('0x5')]);}})[_0xeddc('0x6')](function(_0x4a5712){return _0x35c089(_0x4a5712);});});}exports[_0xeddc('0x7')]=function(_0x8624cb,_0x19db30){return request(_0xeddc('0x8'),{'account':_0x8624cb,'message':_0x19db30});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9a18707..13f8d85 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 _0x8f83=['slice','trim','length','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','inherits','\x0d\x0a\x0d\x0a','_inBody','indexOf','substring'];(function(_0x231567,_0x3617fc){var _0x37e4ee=function(_0x243249){while(--_0x243249){_0x231567['push'](_0x231567['shift']());}};_0x37e4ee(++_0x3617fc);}(_0x8f83,0x6d));var _0x38f8=function(_0x3cb887,_0x32e3b6){_0x3cb887=_0x3cb887-0x0;var _0x53b340=_0x8f83[_0x3cb887];return _0x53b340;};'use strict';var util=require(_0x38f8('0x0'));var Transform=require(_0x38f8('0x1'))[_0x38f8('0x2')];function AGIReply(_0x1ed3ab){Transform[_0x38f8('0x3')](this,_0x1ed3ab);this[_0x38f8('0x4')]='';this['_inBody']=![];}util[_0x38f8('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x4338c4,_0x53ed61,_0x261e58){var _0x371c92='\x0a',_0x13bce2=['\x0a\x0a',_0x38f8('0x6')],_0x28fdba=-0x1,_0x301a70=-0x1,_0x16e717='',_0x4909af=0x0,_0x47b798='',_0x2bb695='';this[_0x38f8('0x4')]+=_0x4338c4['toString']();_0x47b798=this[_0x38f8('0x4')];if(!this[_0x38f8('0x7')]){_0x4909af=0x0;while(_0x13bce2[_0x4909af]){while((_0x301a70=_0x47b798[_0x38f8('0x8')](_0x13bce2[_0x4909af]))!=-0x1){_0x16e717=_0x13bce2[_0x4909af];_0x2bb695=_0x47b798[_0x38f8('0x9')](0x0,_0x301a70);_0x47b798=_0x47b798[_0x38f8('0x9')](_0x301a70+_0x16e717['length']);var _0x157ab3=_0x2bb695['split'](_0x371c92),_0x5aba16=0x0,_0x12fc0a={},_0x151ab1='',_0x1ae8e0='',_0x436400=-0x1;while(_0x157ab3[_0x5aba16]){_0x436400=_0x157ab3[_0x5aba16]['indexOf'](':');if(_0x436400!=-0x1){_0x151ab1=_0x157ab3[_0x5aba16][_0x38f8('0xa')](0x0,_0x436400)[_0x38f8('0xb')]();_0x1ae8e0=_0x157ab3[_0x5aba16][_0x38f8('0xa')](_0x436400+0x1)['trim']();if(_0x151ab1[_0x38f8('0xc')]>0x0){_0x12fc0a[_0x151ab1]=_0x1ae8e0;}}else{}_0x5aba16++;}this[_0x38f8('0xd')](_0x38f8('0xe'),_0x12fc0a);this['_inBody']=!![];}_0x4909af++;}this['_localBuffer']=_0x47b798;}else{while((_0x28fdba=_0x47b798[_0x38f8('0x8')](_0x371c92))!=-0x1){_0x2bb695=_0x47b798[_0x38f8('0x9')](0x0,_0x28fdba);this[_0x38f8('0xd')](_0x38f8('0xf'),_0x2bb695);_0x47b798=_0x47b798[_0x38f8('0x9')](_0x28fdba+_0x371c92[_0x38f8('0xc')]);}this[_0x38f8('0x4')]=_0x47b798;}_0x261e58();};module[_0x38f8('0x10')]=AGIReply; \ No newline at end of file +var _0x94cd=['trim','slice','indexOf','emit','line','exports','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x94cd,0xb0));var _0xd94c=function(_0x1a6f22,_0x20f1c4){_0x1a6f22=_0x1a6f22-0x0;var _0x2d7482=_0x94cd[_0x1a6f22];return _0x2d7482;};'use strict';var util=require('util');var Transform=require(_0xd94c('0x0'))[_0xd94c('0x1')];function AGIReply(_0x41613e){Transform[_0xd94c('0x2')](this,_0x41613e);this[_0xd94c('0x3')]='';this[_0xd94c('0x4')]=![];}util[_0xd94c('0x5')](AGIReply,Transform);AGIReply[_0xd94c('0x6')][_0xd94c('0x7')]=function(_0x524633,_0x43ddad,_0x6508ef){var _0x1215b8='\x0a',_0x178c96=['\x0a\x0a',_0xd94c('0x8')],_0x95e7e2=-0x1,_0x3454a7=-0x1,_0x5568e5='',_0x131e73=0x0,_0x2c747c='',_0x402e69='';this[_0xd94c('0x3')]+=_0x524633['toString']();_0x2c747c=this[_0xd94c('0x3')];if(!this[_0xd94c('0x4')]){_0x131e73=0x0;while(_0x178c96[_0x131e73]){while((_0x3454a7=_0x2c747c['indexOf'](_0x178c96[_0x131e73]))!=-0x1){_0x5568e5=_0x178c96[_0x131e73];_0x402e69=_0x2c747c[_0xd94c('0x9')](0x0,_0x3454a7);_0x2c747c=_0x2c747c[_0xd94c('0x9')](_0x3454a7+_0x5568e5[_0xd94c('0xa')]);var _0x44badf=_0x402e69['split'](_0x1215b8),_0x1bbeae=0x0,_0x3c0816={},_0x552d5f='',_0xec0936='',_0x37585b=-0x1;while(_0x44badf[_0x1bbeae]){_0x37585b=_0x44badf[_0x1bbeae]['indexOf'](':');if(_0x37585b!=-0x1){_0x552d5f=_0x44badf[_0x1bbeae]['slice'](0x0,_0x37585b)[_0xd94c('0xb')]();_0xec0936=_0x44badf[_0x1bbeae][_0xd94c('0xc')](_0x37585b+0x1)['trim']();if(_0x552d5f[_0xd94c('0xa')]>0x0){_0x3c0816[_0x552d5f]=_0xec0936;}}else{}_0x1bbeae++;}this['emit']('headers',_0x3c0816);this[_0xd94c('0x4')]=!![];}_0x131e73++;}this[_0xd94c('0x3')]=_0x2c747c;}else{while((_0x95e7e2=_0x2c747c[_0xd94c('0xd')](_0x1215b8))!=-0x1){_0x402e69=_0x2c747c[_0xd94c('0x9')](0x0,_0x95e7e2);this[_0xd94c('0xe')](_0xd94c('0xf'),_0x402e69);_0x2c747c=_0x2c747c[_0xd94c('0x9')](_0x95e7e2+_0x1215b8['length']);}this[_0xd94c('0x3')]=_0x2c747c;}_0x6508ef();};module[_0xd94c('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 eb39642..95b4bb6 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 _0x63bb=['name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','getSquareOdbcById','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','request','then','error','result','catch','getSquareProject','production','getMailAccountById','MailServerOut','Smtp'];(function(_0x473b78,_0xf81681){var _0x45b7ce=function(_0x56e2b6){while(--_0x56e2b6){_0x473b78['push'](_0x473b78['shift']());}};_0x45b7ce(++_0xf81681);}(_0x63bb,0x65));var _0xb63b=function(_0x4604ad,_0x2c516e){_0x4604ad=_0x4604ad-0x0;var _0x3ed8ef=_0x63bb[_0x4604ad];return _0x3ed8ef;};'use strict';var BPromise=require(_0xb63b('0x0'));var moment=require(_0xb63b('0x1'));var _=require(_0xb63b('0x2'));var util=require('util');var jayson=require(_0xb63b('0x3'));var client=jayson[_0xb63b('0x4')]['http']({'port':0x2329});function request(_0x499309,_0xcb601e){return new BPromise(function(_0x5eafcb,_0x43b0fe){return client[_0xb63b('0x5')](_0x499309,_0xcb601e)[_0xb63b('0x6')](function(_0x249230){if(_0x249230[_0xb63b('0x7')]){return _0x43b0fe(_0x249230[_0xb63b('0x7')]['message']);}else{return _0x5eafcb(_0x249230[_0xb63b('0x8')]);}})[_0xb63b('0x9')](function(_0x2cc4cf){return _0x43b0fe(_0x2cc4cf);});});}exports[_0xb63b('0xa')]=function(_0x468116){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x468116},'attributes':[_0xb63b('0xb')]}});};exports[_0xb63b('0xc')]=function(_0x335142){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x335142},'include':[{'model':_0xb63b('0xd'),'as':_0xb63b('0xe')}],'attributes':['id',_0xb63b('0xf'),_0xb63b('0x10')]}});};exports[_0xb63b('0x11')]=function(_0x1f322c){return request(_0xb63b('0x12'),{'options':{'where':{'id':_0x1f322c},'attributes':[_0xb63b('0xf')]}});};exports[_0xb63b('0x13')]=function(_0x2c5381){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2c5381},'attributes':[_0xb63b('0xf')]}});};exports[_0xb63b('0x14')]=function(_0x56f66b){return request('ShowVariable',{'options':{'where':{'id':_0x56f66b},'attributes':['name']}});};exports[_0xb63b('0x15')]=function(_0xe23c5c){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xe23c5c},'attributes':[_0xb63b('0x16')]}});};exports[_0xb63b('0x17')]=function(_0x39f17e){return request('ShowUser',{'options':{'where':{'id':_0x39f17e},'attributes':[_0xb63b('0xf')]}});};exports['getTrunkById']=function(_0x5ef8d8){return request(_0xb63b('0x18'),{'options':{'where':{'id':_0x5ef8d8},'attributes':['name']}});};exports[_0xb63b('0x19')]=function(_0x4454c9){return request(_0xb63b('0x1a'),{'options':{'where':{'id':_0x4454c9},'attributes':[_0xb63b('0x1b')]}});};exports[_0xb63b('0x1c')]=function(_0x129345){return request(_0xb63b('0x1d'),{'options':{'raw':![],'where':{'id':_0x129345},'include':[{'model':_0xb63b('0x1e'),'as':'Intervals'}]}});};exports[_0xb63b('0x1f')]=function(_0x58805f){return request(_0xb63b('0x20'),{'options':{'where':{'id':_0x58805f},'attributes':['id',_0xb63b('0xf')]}});};exports[_0xb63b('0x21')]=function(_0x4f8cb0){return request(_0xb63b('0x22'),{'body':_0x4f8cb0});};exports[_0xb63b('0x23')]=function(_0x34ff00){return request('CreateSquareDetailsReport',{'body':_0x34ff00});};exports[_0xb63b('0x24')]=function(_0x19335e){return request('CreateSquareReport',{'body':_[_0xb63b('0x25')](_0x19335e,{'project_name':_0x19335e['arg_1'],'prev_project_name':_0x19335e[_0xb63b('0x26')]||'','is_subproject':_0x19335e[_0xb63b('0x26')]?!![]:![],'leaveAt':moment()[_0xb63b('0x27')](_0xb63b('0x28'))})});};exports[_0xb63b('0x29')]=function(_0x5469d5){return request(_0xb63b('0x2a'),{'body':_0x5469d5});};exports[_0xb63b('0x2b')]=function(_0x24c269){return request(_0xb63b('0x2c'),{'body':_0x24c269});};exports['createCmContact']=function(_0x2ed7cd){return request(_0xb63b('0x2d'),{'options':{'raw':![],'where':{'phone':_0x2ed7cd[_0xb63b('0x2e')],'ListId':_0x2ed7cd['ListId']}}})[_0xb63b('0x6')](function(_0x163f6f){if(_0x163f6f){return _0x163f6f;}return request(_0xb63b('0x2f'),{'body':_0x2ed7cd});});};exports[_0xb63b('0x30')]=function(_0x9baee7){return request(_0xb63b('0x31'),{'options':{'where':{'id':_0x9baee7},'attributes':[_0xb63b('0xf')]}});};exports[_0xb63b('0x32')]=function(_0x118136,_0x401496){return request(_0xb63b('0x33'),{'body':{'interface':_0x401496},'options':{'where':_0x118136}});};exports[_0xb63b('0x34')]=function(_0x39a4e1,_0x30cc06,_0x9eed32){return request(_0xb63b('0x35'),{'body':{'type':_0x30cc06,'uniqueid':_0x9eed32},'options':{'where':_0x39a4e1}});};exports[_0xb63b('0x36')]=function(_0x297190){return request(_0xb63b('0x37'),{'body':{},'options':{'where':_0x297190}});};exports[_0xb63b('0x38')]=function(_0x35e1c2){return request(_0xb63b('0x39'),{'body':{},'options':{'where':_0x35e1c2}});}; \ No newline at end of file +var _0x5553=['agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5553,0x80));var _0x3555=function(_0x447b6d,_0x1783d4){_0x447b6d=_0x447b6d-0x0;var _0x57f021=_0x5553[_0x447b6d];return _0x57f021;};'use strict';var BPromise=require(_0x3555('0x0'));var moment=require(_0x3555('0x1'));var _=require(_0x3555('0x2'));var util=require(_0x3555('0x3'));var jayson=require(_0x3555('0x4'));var client=jayson[_0x3555('0x5')][_0x3555('0x6')]({'port':0x2329});function request(_0x446f09,_0x49ebe6){return new BPromise(function(_0x3eb6b7,_0x4413df){return client[_0x3555('0x7')](_0x446f09,_0x49ebe6)[_0x3555('0x8')](function(_0x296192){if(_0x296192['error']){return _0x4413df(_0x296192[_0x3555('0x9')][_0x3555('0xa')]);}else{return _0x3eb6b7(_0x296192[_0x3555('0xb')]);}})[_0x3555('0xc')](function(_0x4bdcef){return _0x4413df(_0x4bdcef);});});}exports['getSquareProject']=function(_0x211ef1){return request(_0x3555('0xd'),{'options':{'raw':![],'where':{'name':_0x211ef1},'attributes':[_0x3555('0xe')]}});};exports[_0x3555('0xf')]=function(_0x3359f2){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3359f2},'include':[{'model':'MailServerOut','as':_0x3555('0x10')}],'attributes':['id',_0x3555('0x11'),_0x3555('0x12')]}});};exports['getSquareProjectById']=function(_0x328b0d){return request(_0x3555('0xd'),{'options':{'where':{'id':_0x328b0d},'attributes':['name']}});};exports[_0x3555('0x13')]=function(_0x234e05){return request(_0x3555('0x14'),{'options':{'where':{'id':_0x234e05},'attributes':[_0x3555('0x11')]}});};exports[_0x3555('0x15')]=function(_0x3b4338){return request('ShowVariable',{'options':{'where':{'id':_0x3b4338},'attributes':[_0x3555('0x11')]}});};exports['getSquareOdbcById']=function(_0x8916f3){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x8916f3},'attributes':[_0x3555('0x16')]}});};exports[_0x3555('0x17')]=function(_0x527711){return request(_0x3555('0x18'),{'options':{'where':{'id':_0x527711},'attributes':[_0x3555('0x11')]}});};exports[_0x3555('0x19')]=function(_0x4372e6){return request(_0x3555('0x1a'),{'options':{'where':{'id':_0x4372e6},'attributes':[_0x3555('0x11')]}});};exports[_0x3555('0x1b')]=function(_0x5ed8e6){return request(_0x3555('0x1c'),{'options':{'where':{'id':_0x5ed8e6},'attributes':[_0x3555('0x1d')]}});};exports[_0x3555('0x1e')]=function(_0x408492){return request(_0x3555('0x1f'),{'options':{'raw':![],'where':{'id':_0x408492},'include':[{'model':_0x3555('0x20'),'as':_0x3555('0x21')}]}});};exports[_0x3555('0x22')]=function(_0x583d1c){return request(_0x3555('0x23'),{'options':{'where':{'id':_0x583d1c},'attributes':['id','name']}});};exports[_0x3555('0x24')]=function(_0xca447e){return request(_0x3555('0x25'),{'body':_0xca447e});};exports[_0x3555('0x26')]=function(_0x3a63a1){return request('CreateSquareDetailsReport',{'body':_0x3a63a1});};exports[_0x3555('0x27')]=function(_0x15a48a){return request('CreateSquareReport',{'body':_['merge'](_0x15a48a,{'project_name':_0x15a48a[_0x3555('0x28')],'prev_project_name':_0x15a48a[_0x3555('0x29')]||'','is_subproject':_0x15a48a[_0x3555('0x29')]?!![]:![],'leaveAt':moment()[_0x3555('0x2a')](_0x3555('0x2b'))})});};exports[_0x3555('0x2c')]=function(_0x42f8f0){return request('CreateSquareRecording',{'body':_0x42f8f0});};exports[_0x3555('0x2d')]=function(_0x186f92){return request(_0x3555('0x2e'),{'body':_0x186f92});};exports['createCmContact']=function(_0x5dffb5){return request(_0x3555('0x2f'),{'options':{'raw':![],'where':{'phone':_0x5dffb5[_0x3555('0x30')],'ListId':_0x5dffb5[_0x3555('0x31')]}}})[_0x3555('0x8')](function(_0x2cacfd){if(_0x2cacfd){return _0x2cacfd;}return request(_0x3555('0x32'),{'body':_0x5dffb5});});};exports[_0x3555('0x33')]=function(_0x345804){return request('ShowPause',{'options':{'where':{'id':_0x345804},'attributes':[_0x3555('0x11')]}});};exports[_0x3555('0x34')]=function(_0x205a6e,_0x408d1c){return request(_0x3555('0x35'),{'body':{'interface':_0x408d1c},'options':{'where':_0x205a6e}});};exports[_0x3555('0x36')]=function(_0x16493e,_0x29ff7a,_0x4ba3be){return request(_0x3555('0x37'),{'body':{'type':_0x29ff7a,'uniqueid':_0x4ba3be},'options':{'where':_0x16493e}});};exports[_0x3555('0x38')]=function(_0x44fba6){return request(_0x3555('0x39'),{'body':{},'options':{'where':_0x44fba6}});};exports[_0x3555('0x3a')]=function(_0x577ee1){return request(_0x3555('0x3b'),{'body':{},'options':{'where':_0x577ee1}});}; \ 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 ca6a02f..6521b5a 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 _0x8506=['./lex'];(function(_0x44e60d,_0x5e1b3f){var _0x46080a=function(_0x27a82f){while(--_0x27a82f){_0x44e60d['push'](_0x44e60d['shift']());}};_0x46080a(++_0x5e1b3f);}(_0x8506,0xe8));var _0x6850=function(_0x3a72b5,_0x442c51){_0x3a72b5=_0x3a72b5-0x0;var _0xae621d=_0x8506[_0x3a72b5];return _0xae621d;};var polly=require('./polly');var lex=require(_0x6850('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc1fc=['exports','./lex'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc1fc,0x93));var _0xcc1f=function(_0x28a037,_0x16e5b9){_0x28a037=_0x28a037-0x0;var _0x268534=_0xc1fc[_0x28a037];return _0x268534;};var polly=require('./polly');var lex=require(_0xcc1f('0x0'));module[_0xcc1f('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 95cb872..41845ce 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(_0x130ba8,_0xa3cb31){var _0x4d9e3d=function(_0x144709){while(--_0x144709){_0x130ba8['push'](_0x130ba8['shift']());}};_0x4d9e3d(++_0xa3cb31);}(_0x41bb,0xc5));var _0xb41b=function(_0x449bf8,_0x2bc097){_0x449bf8=_0x449bf8-0x0;var _0x466ecf=_0x41bb[_0x449bf8];return _0x466ecf;};'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 _0x6f0d=['exports'];(function(_0x2cdeaa,_0x5656cd){var _0x31cebe=function(_0x57abae){while(--_0x57abae){_0x2cdeaa['push'](_0x2cdeaa['shift']());}};_0x31cebe(++_0x5656cd);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x46a6ce,_0x4811a0){_0x46a6ce=_0x46a6ce-0x0;var _0x344d27=_0x6f0d[_0x46a6ce];return _0x344d27;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ 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 83ca87c..18d278c 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(_0x397f0e,_0x37e1e2){var _0x37b5a5=function(_0x5ecfb4){while(--_0x5ecfb4){_0x397f0e['push'](_0x397f0e['shift']());}};_0x37b5a5(++_0x37e1e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x106f6f,_0x207628){var _0x3961a1=function(_0x38f8a1){while(--_0x38f8a1){_0x106f6f['push'](_0x106f6f['shift']());}};_0x3961a1(++_0x207628);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 c6ca3ed..0cc828e 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 _0xb3f4=['exports'];(function(_0x134058,_0x423995){var _0x14a1a9=function(_0x47a2c9){while(--_0x47a2c9){_0x134058['push'](_0x134058['shift']());}};_0x14a1a9(++_0x423995);}(_0xb3f4,0x1ba));var _0x4b3f=function(_0x3a7a03,_0x1cccff){_0x3a7a03=_0x3a7a03-0x0;var _0x475033=_0xb3f4[_0x3a7a03];return _0x475033;};'use strict';var polly=require('./lib/api');module[_0x4b3f('0x0')]=function(_0xba23e9,_0x4c7e30,_0x1cb2e1,_0x8f087b,_0x93acfe,_0x32d501,_0x1468b4){return polly(_0xba23e9,_0x4c7e30,_0x1cb2e1,_0x8f087b,_0x93acfe,_0x32d501,_0x1468b4);}; \ No newline at end of file +var _0x78ba=['exports'];(function(_0x262220,_0x20299c){var _0x18d906=function(_0x3c68b5){while(--_0x3c68b5){_0x262220['push'](_0x262220['shift']());}};_0x18d906(++_0x20299c);}(_0x78ba,0x142));var _0xa78b=function(_0x1c93c1,_0x15ee8f){_0x1c93c1=_0x1c93c1-0x0;var _0x471d36=_0x78ba[_0x1c93c1];return _0x471d36;};'use strict';var polly=require('./lib/api');module[_0xa78b('0x0')]=function(_0x15feed,_0x43668f,_0xcbd4ad,_0x320ac1,_0x2456ed,_0x523eae,_0x3c5820){return polly(_0x15feed,_0x43668f,_0xcbd4ad,_0x320ac1,_0x2456ed,_0x523eae,_0x3c5820);}; \ 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 a66d2ab..d0c94af 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 _0xf228=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','path','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf228,0x182));var _0x8f22=function(_0x5f1d19,_0x54109c){_0x5f1d19=_0x5f1d19-0x0;var _0x50e0cb=_0xf228[_0x5f1d19];return _0x50e0cb;};'use strict';var fs=require('fs');var path=require(_0x8f22('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x8f22('0x1'));function pollyResult(_0x50d729,_0x532652,_0x5a3352){return new BPromise(function(_0x599504,_0x370538){_0x50d729[_0x8f22('0x2')](_0x532652,function(_0x1a7574,_0x2fd842){if(_0x1a7574){_0x370538(_0x1a7574);}else if(_0x2fd842){if(_0x2fd842[_0x8f22('0x3')]instanceof Buffer){fs[_0x8f22('0x4')](_0x5a3352,_0x2fd842[_0x8f22('0x3')],function(_0x2bb518){if(_0x2bb518){_0x370538(_0x2bb518);}else{_0x599504();}});}else{_0x370538(new Error(_0x8f22('0x5')));}}else{_0x370538(new Error(_0x8f22('0x6')));}});});}module[_0x8f22('0x7')]=function(_0x395adf,_0x4a85bc,_0x47c0fa,_0x5edfa2,_0x3e3f06,_0x15a970,_0x39d803){var _0x111824=new AWS['Polly']({'accessKeyId':_0x395adf,'secretAccessKey':_0x4a85bc,'region':_0x47c0fa});var _0xec64b1={'Text':_0x3e3f06,'TextType':_0x15a970||'text','OutputFormat':'mp3','VoiceId':_0x5edfa2};return pollyResult(_0x111824,_0xec64b1,_0x39d803);}; \ No newline at end of file +var _0xe847=['synthesizeSpeech','AudioStream','writeFile','exports','Polly','mp3','path','bluebird','randomstring'];(function(_0x51c0b2,_0x3485b8){var _0x19aa65=function(_0x36f670){while(--_0x36f670){_0x51c0b2['push'](_0x51c0b2['shift']());}};_0x19aa65(++_0x3485b8);}(_0xe847,0x1b6));var _0x7e84=function(_0x5bef28,_0x291a58){_0x5bef28=_0x5bef28-0x0;var _0xf5359=_0xe847[_0x5bef28];return _0xf5359;};'use strict';var fs=require('fs');var path=require(_0x7e84('0x0'));var BPromise=require(_0x7e84('0x1'));var rs=require(_0x7e84('0x2'));var AWS=require('aws-sdk');function pollyResult(_0xeb0c13,_0x326f1d,_0x3a7049){return new BPromise(function(_0x2a8d80,_0x4f877e){_0xeb0c13[_0x7e84('0x3')](_0x326f1d,function(_0x202370,_0x4feec4){if(_0x202370){_0x4f877e(_0x202370);}else if(_0x4feec4){if(_0x4feec4[_0x7e84('0x4')]instanceof Buffer){fs[_0x7e84('0x5')](_0x3a7049,_0x4feec4['AudioStream'],function(_0x547fc2){if(_0x547fc2){_0x4f877e(_0x547fc2);}else{_0x2a8d80();}});}else{_0x4f877e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4f877e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x7e84('0x6')]=function(_0x4a38ce,_0xb32591,_0x2bbd21,_0x37e2ec,_0x5609a6,_0x16c842,_0x55a34a){var _0x191da7=new AWS[(_0x7e84('0x7'))]({'accessKeyId':_0x4a38ce,'secretAccessKey':_0xb32591,'region':_0x2bbd21});var _0x8c77a4={'Text':_0x5609a6,'TextType':_0x16c842||'text','OutputFormat':_0x7e84('0x8'),'VoiceId':_0x37e2ec};return pollyResult(_0x191da7,_0x8c77a4,_0x55a34a);}; \ 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 4afceab..73f3362 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 _0x7fb3=['exports'];(function(_0x439956,_0x542fdc){var _0x5da071=function(_0x3a72c9){while(--_0x3a72c9){_0x439956['push'](_0x439956['shift']());}};_0x5da071(++_0x542fdc);}(_0x7fb3,0x14c));var _0x37fb=function(_0x1a5eb0,_0x1f8fbb){_0x1a5eb0=_0x1a5eb0-0x0;var _0x30f9ba=_0x7fb3[_0x1a5eb0];return _0x30f9ba;};'use strict';var asr=require('./lib/api');module[_0x37fb('0x0')]=function(_0x33f4f2,_0x3867b0,_0x2717ea,_0x2f47e8){return asr(_0x33f4f2,_0x3867b0,_0x2717ea);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x38729f,_0x3a0ea8,_0x18fff8,_0xe4be5d){return asr(_0x38729f,_0x3a0ea8,_0x18fff8);}; \ 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 e0be714..c625115 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 _0x98d3=['filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','length'];(function(_0x3650eb,_0x1a6e22){var _0x425c8a=function(_0x43e9bb){while(--_0x43e9bb){_0x3650eb['push'](_0x3650eb['shift']());}};_0x425c8a(++_0x1a6e22);}(_0x98d3,0x173));var _0x398d=function(_0x3d2486,_0x178ad0){_0x3d2486=_0x3d2486-0x0;var _0x2cb79b=_0x98d3[_0x3d2486];return _0x2cb79b;};'use strict';var url=require(_0x398d('0x0'));var BPromise=require(_0x398d('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x398d('0x2')]=function(_0x4f5ff0,_0x18da44,_0x48fcf0){return new BPromise(function(_0x465d4a,_0x41f57c){var _0x4f7a58;if(typeof _0x4f5ff0!=='string'||_0x4f5ff0[_0x398d('0x3')]===0x0){return _0x41f57c(_0x398d('0x4'));}if(typeof _0x18da44!==_0x398d('0x5')||_0x18da44['length']===0x0){return _0x41f57c(_0x398d('0x6'));}if(typeof _0x48fcf0!==_0x398d('0x7')&&(typeof _0x48fcf0!==_0x398d('0x5')||_0x48fcf0[_0x398d('0x3')]===0x0)){return _0x41f57c(_0x398d('0x8'));}try{_0x4f7a58=fs['readFileSync'](_0x4f5ff0)[_0x398d('0x9')](_0x398d('0xa'));}catch(_0x45d5e3){return _0x41f57c(_0x45d5e3);}return _0x465d4a({'method':_0x398d('0xb'),'uri':host+_0x398d('0xc')+_0x18da44,'body':{'config':{'encoding':_0x398d('0xd'),'sampleRateHertz':_0x398d('0xe'),'languageCode':_0x48fcf0},'audio':{'content':_0x4f7a58}},'json':!![]});});}; \ No newline at end of file +var _0x00b3=['LINEAR16','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key='];(function(_0x3b2bf5,_0xf607d1){var _0x53cc6a=function(_0x143386){while(--_0x143386){_0x3b2bf5['push'](_0x3b2bf5['shift']());}};_0x53cc6a(++_0xf607d1);}(_0x00b3,0x17a));var _0x300b=function(_0x1b2470,_0x182d1e){_0x1b2470=_0x1b2470-0x0;var _0x23d03d=_0x00b3[_0x1b2470];return _0x23d03d;};'use strict';var url=require('url');var BPromise=require(_0x300b('0x0'));var fs=require('fs');var host=_0x300b('0x1');module[_0x300b('0x2')]=function(_0x2562dd,_0x59cc42,_0x2fbccc){return new BPromise(function(_0x534310,_0x245c32){var _0x524b8d;if(typeof _0x2562dd!==_0x300b('0x3')||_0x2562dd[_0x300b('0x4')]===0x0){return _0x245c32(_0x300b('0x5'));}if(typeof _0x59cc42!==_0x300b('0x3')||_0x59cc42['length']===0x0){return _0x245c32('key\x20should\x20be\x20a\x20string');}if(typeof _0x2fbccc!==_0x300b('0x6')&&(typeof _0x2fbccc!=='string'||_0x2fbccc['length']===0x0)){return _0x245c32(_0x300b('0x7'));}try{_0x524b8d=fs[_0x300b('0x8')](_0x2562dd)[_0x300b('0x9')]('base64');}catch(_0x42e5a5){return _0x245c32(_0x42e5a5);}return _0x534310({'method':_0x300b('0xa'),'uri':host+_0x300b('0xb')+_0x59cc42,'body':{'config':{'encoding':_0x300b('0xc'),'sampleRateHertz':'8000','languageCode':_0x2fbccc},'audio':{'content':_0x524b8d}},'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 5f51f30..fda161f 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 _0x4cbe=['exports'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x4cbe,0x178));var _0xe4cb=function(_0x42eb51,_0xafa7f2){_0x42eb51=_0x42eb51-0x0;var _0x403569=_0x4cbe[_0x42eb51];return _0x403569;};var asr=require('./asr');module[_0xe4cb('0x0')]={'asr':asr}; \ No newline at end of file +var _0x7c96=['exports'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7c96,0x1b7));var _0x67c9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7c96[_0x13d07a];return _0x5ee0ee;};var asr=require('./asr');module[_0x67c9('0x0')]={'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 31e5804..18c596d 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 _0x8e42=['bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish','info','close','error','unlink','pipe','end','host','\x20failed,\x20status\x20code\x20=\x20','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','toString','https://texttospeech.googleapis.com/v1/','?key=','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','777','googleCloudTTS\x20path','googleTTS','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','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','status','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','queryText','responseId','intentDetectionConfidence','tildeASR','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise'];(function(_0x46604f,_0x2de47a){var _0x1ef466=function(_0x3c20e6){while(--_0x3c20e6){_0x46604f['push'](_0x46604f['shift']());}};_0x1ef466(++_0x2de47a);}(_0x8e42,0x197));var _0x28e4=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0x8e42[_0x529a0f];return _0x187a88;};'use strict';var apiai=require(_0x28e4('0x0'));var BPromise=require(_0x28e4('0x1'));var dialogflow=require(_0x28e4('0x2'));var fs=require('fs');var http=require(_0x28e4('0x3'));var https=require(_0x28e4('0x4'));var md5=require(_0x28e4('0x5'));var path=require(_0x28e4('0x6'));var querystring=require('querystring');var rp=require(_0x28e4('0x7'));var rs=require(_0x28e4('0x8'));var sox=require(_0x28e4('0x9'));var tts=require(_0x28e4('0xa'));var urlParse=require(_0x28e4('0xb'))[_0x28e4('0xc')];var util=require(_0x28e4('0xd'));var aws=require(_0x28e4('0xe'));var google=require('./google');var sestek=require(_0x28e4('0xf'));var tilde=require(_0x28e4('0x10'));var logger=require(_0x28e4('0x11'))(_0x28e4('0x12'));var ISPEECH_API=_0x28e4('0x13');function downloadFile(_0x5141d1,_0x4aa829){return new BPromise(function(_0x13e33d,_0x38f103){var _0x585251=urlParse(_0x5141d1);var _0x34fa29=_0x585251[_0x28e4('0x14')]===_0x28e4('0x15')?https:http;var _0x5e8c84={'host':_0x585251['host'],'path':_0x585251[_0x28e4('0x6')],'headers':{'user-agent':_0x28e4('0x16')}};_0x34fa29[_0x28e4('0x17')](_0x5e8c84,function(_0x205b42){if(_0x205b42[_0x28e4('0x18')]!==0xc8){logger['error']('request\x20to\x20'+_0x5141d1+'\x20failed,\x20status\x20code\x20=\x20'+_0x205b42[_0x28e4('0x18')]+'\x20('+_0x205b42[_0x28e4('0x19')]+')');_0x38f103(new Error(_0x28e4('0x1a')+_0x5141d1+'\x20failed,\x20status\x20code\x20=\x20'+_0x205b42[_0x28e4('0x18')]+'\x20('+_0x205b42[_0x28e4('0x19')]+')'));return;}var _0x12ae3b=fs[_0x28e4('0x1b')](_0x4aa829);_0x12ae3b['on'](_0x28e4('0x1c'),function(){logger[_0x28e4('0x1d')]('finish\x20download\x20file');_0x12ae3b[_0x28e4('0x1e')](_0x13e33d);});_0x12ae3b['on'](_0x28e4('0x1f'),function(_0xf0d4cd){fs[_0x28e4('0x20')](_0x4aa829);logger['error']('download\x20error',_0xf0d4cd);_0x38f103(_0xf0d4cd);});_0x205b42[_0x28e4('0x21')](_0x12ae3b);})['on'](_0x28e4('0x1f'),function(_0x4bf245){logger['error'](_0x4bf245);_0x38f103(_0x4bf245);})[_0x28e4('0x22')]();});}function uploadFile(_0x5d4ff5){return new BPromise(function(_0x2de3b7,_0x553bd3){var _0x4aaadb=urlParse(_0x5d4ff5);var _0xb94d72=_0x4aaadb[_0x28e4('0x14')]===_0x28e4('0x15')?https:http;var _0x40d869={'host':_0x4aaadb[_0x28e4('0x23')],'path':_0x4aaadb[_0x28e4('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0xb94d72[_0x28e4('0x17')](_0x40d869,function(_0x485e56){if(_0x485e56['statusCode']!==0xc8){_0x553bd3(new Error(_0x28e4('0x1a')+_0x5d4ff5+_0x28e4('0x24')+_0x485e56[_0x28e4('0x18')]+'\x20('+_0x485e56[_0x28e4('0x19')]+')'));return;}var _0x55bf4a='';_0x485e56['on'](_0x28e4('0x25'),function(_0x2aae1b){_0x55bf4a+=_0x2aae1b;});_0x485e56['on'](_0x28e4('0x22'),function(){_0x2de3b7(_0x55bf4a);});})['on'](_0x28e4('0x1f'),function(_0x1df232){_0x553bd3(_0x1df232);})[_0x28e4('0x22')]();});}function convertFile(_0x47e6d6,_0x57e724){return new BPromise(function(_0x50ffd8,_0x5a96cc){var _0x21423d=sox[_0x28e4('0x26')](_0x47e6d6,_0x57e724,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21423d['on'](_0x28e4('0x1f'),function(_0x5d1b9c){logger[_0x28e4('0x1f')](_0x28e4('0x27'),_0x5d1b9c);_0x5a96cc(_0x5d1b9c);});_0x21423d['on']('end',function(){logger[_0x28e4('0x1d')](_0x28e4('0x28'));_0x50ffd8();});_0x21423d[_0x28e4('0x29')]();});}function base64Decode(_0x7514da,_0x364e7e){var _0x43fb23=path[_0x28e4('0x2a')](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+_0x28e4('0x2d'));fs[_0x28e4('0x2e')](_0x43fb23,_0x7514da,_0x28e4('0x2f'));return convertFile(_0x43fb23,_0x364e7e)[_0x28e4('0x30')](function(){try{fs[_0x28e4('0x20')](_0x43fb23);fs[_0x28e4('0x31')](_0x364e7e,'777');}catch(_0x119ea9){logger['error'](_0x119ea9);}return _0x364e7e[_0x28e4('0x32')]('.')[0x0];});}function base64Encode(_0x548ea4){var _0x22751c=fs['readFileSync'](_0x548ea4);return new Buffer(_0x22751c)[_0x28e4('0x33')]('base64');}exports['googleCloudTTS']=function(_0xd74f93,_0x44db67,_0x5b97e0,_0x14ebeb,_0x25f980,_0x5b9849){var _0xfd51b4,_0x317c89;var _0x2eecd0=_0x28e4('0x34');var _0x160e48=_0x28e4('0x35')+_0xd74f93;var _0x1d8335={};if(_0x44db67==='ssml'){_0x1d8335['input']={'ssml':_0x5b97e0};}else{_0x1d8335['input']={'text':_0x5b97e0};};_0x1d8335[_0x28e4('0x36')]={'languageCode':_0x14ebeb,'ssmlGender':_0x25f980};_0x1d8335[_0x28e4('0x37')]={'audioEncoding':_0x28e4('0x38'),'sampleRateHertz':0x1f40};var _0x28436b={'url':_0x2eecd0+_0x28e4('0x39')+_0x160e48,'method':_0x28e4('0x3a'),'json':!![],'body':_0x1d8335};return rp(_0x28436b)[_0x28e4('0x30')](function(_0x2affa7){return new BPromise(function(_0x19fcf3,_0x563b94){_0xfd51b4=path[_0x28e4('0x2a')](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+_0x28e4('0x3b'));var _0xd70c9a=Buffer[_0x28e4('0x3c')](_0x2affa7[_0x28e4('0x3d')],_0x28e4('0x2f'));return fs['writeFile'](_0xfd51b4,_0xd70c9a,function(_0x1ab2b8){_0x563b94(_0x1ab2b8);},function(_0x5e86d7){fs['chmodSync'](_0xfd51b4,_0x28e4('0x3e'));_0x19fcf3(_0x5e86d7);});});})['then'](function(_0xb95a01){_0x317c89=path[_0x28e4('0x2a')](__dirname,'tmp',rs[_0x28e4('0x2c')](0x4)+_0x28e4('0x2d'));return convertFile(_0xfd51b4,_0x317c89);})[_0x28e4('0x30')](function(){try{fs[_0x28e4('0x20')](_0xfd51b4);fs['chmodSync'](_0x317c89,_0x28e4('0x3e'));}catch(_0x265474){logger[_0x28e4('0x1f')](_0x265474);}logger['info'](_0x28e4('0x3f'),_0x317c89[_0x28e4('0x32')]('.')[0x0]);return _0x317c89[_0x28e4('0x32')]('.')[0x0];});};exports[_0x28e4('0x40')]=function(_0x3b62b8,_0x4e0fcf){var _0x2bb25a=_0x28e4('0x41');var _0x37704b,_0xc8bc81;var _0x33bc73;var _0x25ba0c={'encoding':_0x28e4('0x42'),'method':_0x28e4('0x3a'),'timeout':0x2710,'url':_0x2bb25a,'headers':{'Content-Type':_0x28e4('0x43')},'body':_0x28e4('0x44')+encodeURIComponent(JSON[_0x28e4('0x45')]([[[_0x28e4('0x46'),JSON[_0x28e4('0x45')]([_0x3b62b8,_0x4e0fcf||'en',![],_0x28e4('0x47')]),null,_0x28e4('0x48')]]]))};return rp(_0x25ba0c)[_0x28e4('0x30')](function(_0x3cf277){try{_0x33bc73=eval(_0x3cf277[_0x28e4('0x49')](0x5))[0x0][0x2];}catch(_0x57a780){throw new Error(_0x28e4('0x4a')+_0x3cf277[_0x28e4('0x25')]);}if(!_0x33bc73){if(_0x3b62b8['length']>0xc8){throw new Error(_0x28e4('0x4b'));}else{throw new Error(_0x28e4('0x4c')+_0x4e0fcf+_0x28e4('0x4d'));}}try{_0x33bc73=eval(_0x33bc73)[0x0];}catch(_0x4d2710){throw new Error(_0x28e4('0x4a')+res[_0x28e4('0x25')]);}const _0x1ca926=_0x33bc73;_0x37704b=path[_0x28e4('0x2a')](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+_0x28e4('0x3b'));fs[_0x28e4('0x2e')](_0x37704b,_0x33bc73,{'encoding':'base64'});_0xc8bc81=path[_0x28e4('0x2a')](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+'.wav');return convertFile(_0x37704b,_0xc8bc81);})[_0x28e4('0x30')](function(){try{fs[_0x28e4('0x20')](_0x37704b);fs[_0x28e4('0x31')](_0xc8bc81,_0x28e4('0x3e'));}catch(_0x88197f){logger['error'](_0x88197f);}logger[_0x28e4('0x1d')]('goggleTTS\x20path',_0xc8bc81[_0x28e4('0x32')]('.')[0x0]);return _0xc8bc81[_0x28e4('0x32')]('.')[0x0];});};exports[_0x28e4('0x4e')]=function(_0x53e201,_0x5d6d08,_0x44e7f0){return google[_0x28e4('0x4f')](_0x53e201,_0x5d6d08,_0x44e7f0)[_0x28e4('0x30')](function(_0x1ce4a6){logger['info'](_0x1ce4a6[_0x28e4('0x50')]);return rp(_0x1ce4a6);})[_0x28e4('0x30')](function(_0x48c400){var _0x5e5942='';var _0x43f873=0x0;try{fs[_0x28e4('0x20')](_0x53e201);}catch(_0x1f430f){logger[_0x28e4('0x1f')](_0x1f430f);}if(_0x48c400&&_0x48c400[_0x28e4('0x51')]){_0x5e5942=_0x48c400['results'][_0x28e4('0x52')](function(_0x5bd048){return _0x5bd048&&_0x5bd048['alternatives'][0x0]&&_0x5bd048[_0x28e4('0x53')][0x0][_0x28e4('0x54')]?_0x5bd048[_0x28e4('0x53')][0x0][_0x28e4('0x54')]:'';})[_0x28e4('0x55')]('\x0a');_0x43f873=_0x48c400[_0x28e4('0x51')][_0x28e4('0x52')](function(_0x1de03e){return _0x1de03e&&_0x1de03e['alternatives'][0x0]&&_0x1de03e[_0x28e4('0x53')][0x0][_0x28e4('0x56')]?_0x1de03e[_0x28e4('0x53')][0x0]['confidence']:0x0;})['join']('\x0a');}logger['info'](_0x28e4('0x57'),_0x5e5942);logger[_0x28e4('0x1d')](_0x28e4('0x58'),_0x43f873);return{'transcript':_0x5e5942,'confidence':_0x43f873};})[_0x28e4('0x59')](function(_0x3bdca7){logger[_0x28e4('0x1f')]('[%s]\x20%s:%s',_0x3bdca7[_0x28e4('0x18')],_0x3bdca7['name'],_0x3bdca7[_0x28e4('0x5a')]);});};exports[_0x28e4('0x5b')]=function(_0xc513cd,_0x4c9e6c,_0x3c5b16,_0x1152d1){var _0xa7280e=apiai(_0x4c9e6c,{'language':_0x1152d1||'en'});return _0xa7280e[_0x28e4('0x5c')](_0x3c5b16,{'sessionId':md5(_0xc513cd)})['then'](function(_0x1a37f0){logger[_0x28e4('0x1d')](JSON['stringify'](_0x1a37f0));return{'source':_0x1a37f0[_0x28e4('0x5d')]['source'],'resolvedQuery':_0x1a37f0[_0x28e4('0x5d')][_0x28e4('0x5e')],'action':_0x1a37f0[_0x28e4('0x5d')][_0x28e4('0x5f')],'actionIncomplete':_0x1a37f0[_0x28e4('0x5d')][_0x28e4('0x60')],'speech':_0x1a37f0[_0x28e4('0x5d')][_0x28e4('0x61')]['speech'],'score':_0x1a37f0['result']['score'],'statusCode':_0x1a37f0[_0x28e4('0x62')]['code'],'endConversation':_0x1a37f0['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x1a37f0['result'][_0x28e4('0x63')][_0x28e4('0x64')]};});};exports[_0x28e4('0x65')]=function(_0x5651da,_0x5d7ee7,_0x5ffe08,_0x1eda21,_0x2ca66b,_0x344a41){var _0x787b62=_0x1eda21[_0x28e4('0x66')](/\\n/g,'\x0a');var _0x2b3fa0={'credentials':{'private_key':_0x787b62,'client_email':_0x5ffe08}};var _0x2ea434=new dialogflow[(_0x28e4('0x67'))](_0x2b3fa0);var _0x6a2f73=_0x2ea434[_0x28e4('0x68')](_0x5d7ee7,md5(_0x5651da));var _0x271eb4={'session':_0x6a2f73,'queryInput':{'text':{'text':_0x2ca66b,'languageCode':_0x344a41}}};return _0x2ea434['detectIntent'](_0x271eb4)[_0x28e4('0x30')](function(_0x4ce859){if(_0x4ce859&&_0x4ce859['length']){logger[_0x28e4('0x1d')](_0x28e4('0x69'),JSON[_0x28e4('0x45')](_0x4ce859));var _0x495bd3=_0x4ce859[0x0];if(_0x495bd3){var _0x405f81={'action':_0x495bd3[_0x28e4('0x6a')][_0x28e4('0x5f')],'allRequiredParamsPresent':_0x495bd3['queryResult'][_0x28e4('0x6b')],'endConversation':_0x495bd3[_0x28e4('0x6a')][_0x28e4('0x6c')]&&_0x495bd3[_0x28e4('0x6a')]['diagnosticInfo'][_0x28e4('0x6d')]?_0x495bd3[_0x28e4('0x6a')]['diagnosticInfo'][_0x28e4('0x6d')][_0x28e4('0x6e')][_0x28e4('0x6f')]:![],'fulfillmentText':_0x495bd3[_0x28e4('0x6a')][_0x28e4('0x70')],'intentName':_0x495bd3['queryResult'][_0x28e4('0x71')][_0x28e4('0x72')],'intentDisplayName':_0x495bd3[_0x28e4('0x6a')][_0x28e4('0x71')][_0x28e4('0x73')],'isFallbackIntent':_0x495bd3[_0x28e4('0x6a')]['intent']['isFallback'],'languageCode':_0x495bd3[_0x28e4('0x6a')]['languageCode'],'queryText':_0x495bd3[_0x28e4('0x6a')][_0x28e4('0x74')],'responseId':_0x495bd3[_0x28e4('0x75')],'score':_0x495bd3[_0x28e4('0x6a')][_0x28e4('0x76')],'speech':_0x495bd3[_0x28e4('0x6a')][_0x28e4('0x70')],'providerResponse':JSON[_0x28e4('0x45')](_0x4ce859)};return _0x405f81;}}});};exports[_0x28e4('0x77')]=function(_0x586730,_0x438465,_0x3fc27f,_0x445293){return tilde[_0x28e4('0x4f')](_0x586730,_0x438465,_0x3fc27f,_0x445293)['then'](function(_0x5f588b){try{fs[_0x28e4('0x20')](_0x586730);}catch(_0x17f87b){logger[_0x28e4('0x1f')](_0x17f87b);}logger['info']('Tilde\x20ASR\x20transcription',_0x5f588b[_0x28e4('0x54')]);logger[_0x28e4('0x1d')]('Tilde\x20ASR\x20confidence',_0x5f588b[_0x28e4('0x56')]);return _0x5f588b;});};exports['awsPolly']=function(_0x4bf073,_0x18378d,_0x571e7f,_0x318e3d,_0x4b7d87,_0x1bd5b2){var _0x566a34=path[_0x28e4('0x2a')](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+'.mp3');var _0x2fbfe8;return aws['polly'](_0x4bf073,_0x18378d,_0x571e7f,_0x318e3d,_0x4b7d87,_0x1bd5b2,_0x566a34)[_0x28e4('0x30')](function(){_0x2fbfe8=path['resolve'](__dirname,_0x28e4('0x2b'),rs['generate'](0x4)+_0x28e4('0x2d'));return convertFile(_0x566a34,_0x2fbfe8);})[_0x28e4('0x30')](function(){try{fs[_0x28e4('0x20')](_0x566a34);fs['chmodSync'](_0x2fbfe8,_0x28e4('0x3e'));}catch(_0x3d4f32){logger[_0x28e4('0x1f')](_0x3d4f32);}return _0x2fbfe8[_0x28e4('0x32')]('.')[0x0];});};exports[_0x28e4('0x78')]=function(_0x591898,_0x950fda,_0x495410,_0x29254b,_0x34f8cc,_0x10aedb){return aws[_0x28e4('0x79')](_0x591898,_0x950fda,_0x495410,_0x29254b,_0x34f8cc,_0x10aedb)['then'](function(_0x1d92b5){logger['info'](JSON[_0x28e4('0x45')](_0x1d92b5));return _0x1d92b5;});};exports['ispeechTTS']=function(_0x4c1ef1,_0xf5537a,_0x1acfa0,_0x539306){var _0x5719b5=util[_0x28e4('0x7a')](_0x28e4('0x7b'),ISPEECH_API,_0x4c1ef1,encodeURIComponent(_0xf5537a),_0x1acfa0,_0x539306);var _0x2bb843=path['resolve'](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+'.mp3');var _0x44af91;return downloadFile(_0x5719b5,_0x2bb843)[_0x28e4('0x30')](function(){_0x44af91=path[_0x28e4('0x2a')](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+_0x28e4('0x2d'));return convertFile(_0x2bb843,_0x44af91);})[_0x28e4('0x30')](function(){try{fs[_0x28e4('0x20')](_0x2bb843);fs[_0x28e4('0x31')](_0x44af91,_0x28e4('0x3e'));}catch(_0x1e1d02){logger[_0x28e4('0x1f')](_0x1e1d02);}return _0x44af91[_0x28e4('0x32')]('.')[0x0];});};exports[_0x28e4('0x7c')]=function(_0x43d0ca,_0x244539,_0x1d4e6f,_0x5e366f){var _0x5b1456=util[_0x28e4('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x244539,_0x1d4e6f,base64Encode(_0x43d0ca),_0x5e366f?util[_0x28e4('0x7a')](_0x28e4('0x7d'),encodeURIComponent(_0x5e366f)):_0x28e4('0x7e'));return uploadFile(_0x5b1456)[_0x28e4('0x30')](function(_0x379628){return querystring[_0x28e4('0xc')](_0x379628);});};exports[_0x28e4('0x7f')]=function(_0x2421c6,_0x5a851b){return sestek['nda'](_0x2421c6,_0x5a851b)[_0x28e4('0x30')](function(_0x5d7b34){logger[_0x28e4('0x1d')](JSON['stringify'](_0x5d7b34));var _0x20a64d={'speech':_0x5d7b34[_0x28e4('0x80')],'action':_0x5d7b34['channelData']?_0x5d7b34[_0x28e4('0x81')][_0x28e4('0x82')]:undefined,'actiondata':_0x5d7b34[_0x28e4('0x81')]?_0x5d7b34[_0x28e4('0x81')][_0x28e4('0x83')]:undefined};if(_0x5d7b34[_0x28e4('0x81')]&&_0x5d7b34[_0x28e4('0x81')][_0x28e4('0x84')]){return base64Decode(_0x5d7b34[_0x28e4('0x81')][_0x28e4('0x84')][_0x28e4('0x85')],path[_0x28e4('0x2a')](__dirname,_0x28e4('0x2b'),rs[_0x28e4('0x2c')](0x4)+'.wav'))[_0x28e4('0x30')](function(_0x45c05e){_0x20a64d[_0x28e4('0x86')]=_0x45c05e;return _0x20a64d;});}return _0x20a64d;});};exports[_0x28e4('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0xb2dc=['split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','text:synthesize','POST','then','.mp3','from','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','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','boolValue','fulfillmentText','displayName','intent','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb2dc,0x17d));var _0xcb2d=function(_0x5d93a4,_0x10fca8){_0x5d93a4=_0x5d93a4-0x0;var _0x17b491=_0xb2dc[_0x5d93a4];return _0x17b491;};'use strict';var apiai=require(_0xcb2d('0x0'));var BPromise=require(_0xcb2d('0x1'));var dialogflow=require(_0xcb2d('0x2'));var fs=require('fs');var http=require(_0xcb2d('0x3'));var https=require(_0xcb2d('0x4'));var md5=require(_0xcb2d('0x5'));var path=require(_0xcb2d('0x6'));var querystring=require(_0xcb2d('0x7'));var rp=require(_0xcb2d('0x8'));var rs=require(_0xcb2d('0x9'));var sox=require(_0xcb2d('0xa'));var tts=require(_0xcb2d('0xb'));var urlParse=require('url')[_0xcb2d('0xc')];var util=require(_0xcb2d('0xd'));var aws=require(_0xcb2d('0xe'));var google=require(_0xcb2d('0xf'));var sestek=require(_0xcb2d('0x10'));var tilde=require('./tilde');var logger=require(_0xcb2d('0x11'))(_0xcb2d('0x12'));var ISPEECH_API=_0xcb2d('0x13');function downloadFile(_0x4de71b,_0x239898){return new BPromise(function(_0x1517af,_0x2b1c6b){var _0x5e7c4a=urlParse(_0x4de71b);var _0x35507a=_0x5e7c4a[_0xcb2d('0x14')]==='https:'?https:http;var _0x147610={'host':_0x5e7c4a[_0xcb2d('0x15')],'path':_0x5e7c4a[_0xcb2d('0x6')],'headers':{'user-agent':_0xcb2d('0x16')}};_0x35507a[_0xcb2d('0x17')](_0x147610,function(_0x33d34c){if(_0x33d34c[_0xcb2d('0x18')]!==0xc8){logger[_0xcb2d('0x19')](_0xcb2d('0x1a')+_0x4de71b+'\x20failed,\x20status\x20code\x20=\x20'+_0x33d34c[_0xcb2d('0x18')]+'\x20('+_0x33d34c['statusMessage']+')');_0x2b1c6b(new Error('request\x20to\x20'+_0x4de71b+_0xcb2d('0x1b')+_0x33d34c[_0xcb2d('0x18')]+'\x20('+_0x33d34c[_0xcb2d('0x1c')]+')'));return;}var _0x1c6ed1=fs['createWriteStream'](_0x239898);_0x1c6ed1['on'](_0xcb2d('0x1d'),function(){logger[_0xcb2d('0x1e')](_0xcb2d('0x1f'));_0x1c6ed1[_0xcb2d('0x20')](_0x1517af);});_0x1c6ed1['on'](_0xcb2d('0x19'),function(_0x4bce3b){fs[_0xcb2d('0x21')](_0x239898);logger['error'](_0xcb2d('0x22'),_0x4bce3b);_0x2b1c6b(_0x4bce3b);});_0x33d34c[_0xcb2d('0x23')](_0x1c6ed1);})['on']('error',function(_0x2b3dc8){logger[_0xcb2d('0x19')](_0x2b3dc8);_0x2b1c6b(_0x2b3dc8);})[_0xcb2d('0x24')]();});}function uploadFile(_0x43d42f){return new BPromise(function(_0x244e52,_0x486f0c){var _0x103e2e=urlParse(_0x43d42f);var _0x5e616b=_0x103e2e[_0xcb2d('0x14')]==='https:'?https:http;var _0x60d31e={'host':_0x103e2e[_0xcb2d('0x15')],'path':_0x103e2e[_0xcb2d('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x5e616b['get'](_0x60d31e,function(_0xcb05dc){if(_0xcb05dc[_0xcb2d('0x18')]!==0xc8){_0x486f0c(new Error('request\x20to\x20'+_0x43d42f+_0xcb2d('0x1b')+_0xcb05dc['statusCode']+'\x20('+_0xcb05dc[_0xcb2d('0x1c')]+')'));return;}var _0x2f6f5c='';_0xcb05dc['on'](_0xcb2d('0x25'),function(_0x57774d){_0x2f6f5c+=_0x57774d;});_0xcb05dc['on']('end',function(){_0x244e52(_0x2f6f5c);});})['on'](_0xcb2d('0x19'),function(_0x54a70b){_0x486f0c(_0x54a70b);})[_0xcb2d('0x24')]();});}function convertFile(_0x49eec0,_0x1738e7){return new BPromise(function(_0x4cd8b4,_0x2c7e29){var _0x2bdab6=sox[_0xcb2d('0x26')](_0x49eec0,_0x1738e7,{'sampleRate':0x1f40,'format':_0xcb2d('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2bdab6['on'](_0xcb2d('0x19'),function(_0x3a29c5){logger[_0xcb2d('0x19')](_0xcb2d('0x28'),_0x3a29c5);_0x2c7e29(_0x3a29c5);});_0x2bdab6['on'](_0xcb2d('0x24'),function(){logger[_0xcb2d('0x1e')](_0xcb2d('0x29'));_0x4cd8b4();});_0x2bdab6[_0xcb2d('0x2a')]();});}function base64Decode(_0x2ac753,_0x29e043){var _0x3b453d=path[_0xcb2d('0x2b')](__dirname,_0xcb2d('0x2c'),rs[_0xcb2d('0x2d')](0x4)+_0xcb2d('0x2e'));fs[_0xcb2d('0x2f')](_0x3b453d,_0x2ac753,_0xcb2d('0x30'));return convertFile(_0x3b453d,_0x29e043)['then'](function(){try{fs[_0xcb2d('0x21')](_0x3b453d);fs[_0xcb2d('0x31')](_0x29e043,_0xcb2d('0x32'));}catch(_0x3a2303){logger['error'](_0x3a2303);}return _0x29e043[_0xcb2d('0x33')]('.')[0x0];});}function base64Encode(_0x143a4e){var _0x5b412c=fs[_0xcb2d('0x34')](_0x143a4e);return new Buffer(_0x5b412c)[_0xcb2d('0x35')](_0xcb2d('0x30'));}exports[_0xcb2d('0x36')]=function(_0x5a4d7f,_0x4a2a5b,_0x1980eb,_0x4490f0,_0x159146,_0x23fcbb){var _0x528908,_0x2dff76;var _0x399399=_0xcb2d('0x37');var _0x1d6d94='?key='+_0x5a4d7f;var _0x487f71={};if(_0x4a2a5b===_0xcb2d('0x38')){_0x487f71[_0xcb2d('0x39')]={'ssml':_0x1980eb};}else{_0x487f71[_0xcb2d('0x39')]={'text':_0x1980eb};};_0x487f71['voice']={'languageCode':_0x4490f0,'ssmlGender':_0x159146};_0x487f71[_0xcb2d('0x3a')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2bca2d={'url':_0x399399+_0xcb2d('0x3b')+_0x1d6d94,'method':_0xcb2d('0x3c'),'json':!![],'body':_0x487f71};return rp(_0x2bca2d)[_0xcb2d('0x3d')](function(_0x22bbbf){return new BPromise(function(_0x3123d9,_0x384880){_0x528908=path['resolve'](__dirname,'tmp',rs[_0xcb2d('0x2d')](0x4)+_0xcb2d('0x3e'));var _0x18ca72=Buffer[_0xcb2d('0x3f')](_0x22bbbf['audioContent'],'base64');return fs[_0xcb2d('0x40')](_0x528908,_0x18ca72,function(_0x2ba783){_0x384880(_0x2ba783);},function(_0x406401){fs[_0xcb2d('0x31')](_0x528908,_0xcb2d('0x32'));_0x3123d9(_0x406401);});});})[_0xcb2d('0x3d')](function(_0x593310){_0x2dff76=path[_0xcb2d('0x2b')](__dirname,'tmp',rs[_0xcb2d('0x2d')](0x4)+'.wav');return convertFile(_0x528908,_0x2dff76);})[_0xcb2d('0x3d')](function(){try{fs[_0xcb2d('0x21')](_0x528908);fs[_0xcb2d('0x31')](_0x2dff76,_0xcb2d('0x32'));}catch(_0x7517b1){logger[_0xcb2d('0x19')](_0x7517b1);}logger['info'](_0xcb2d('0x41'),_0x2dff76['split']('.')[0x0]);return _0x2dff76[_0xcb2d('0x33')]('.')[0x0];});};exports['googleTTS']=function(_0x1865db,_0x1df963){var _0x39dbfd=_0xcb2d('0x42');var _0x39d58d,_0x515451;var _0x58fbae;var _0x388b71={'encoding':_0xcb2d('0x43'),'method':'POST','timeout':0x2710,'url':_0x39dbfd,'headers':{'Content-Type':_0xcb2d('0x44')},'body':_0xcb2d('0x45')+encodeURIComponent(JSON[_0xcb2d('0x46')]([[[_0xcb2d('0x47'),JSON[_0xcb2d('0x46')]([_0x1865db,_0x1df963||'en',![],_0xcb2d('0x48')]),null,_0xcb2d('0x49')]]]))};return rp(_0x388b71)[_0xcb2d('0x3d')](function(_0x49a213){try{_0x58fbae=eval(_0x49a213[_0xcb2d('0x4a')](0x5))[0x0][0x2];}catch(_0x27f80d){throw new Error(_0xcb2d('0x4b')+_0x49a213[_0xcb2d('0x25')]);}if(!_0x58fbae){if(_0x1865db['length']>0xc8){throw new Error(_0xcb2d('0x4c'));}else{throw new Error('lang\x20\x22'+_0x1df963+_0xcb2d('0x4d'));}}try{_0x58fbae=eval(_0x58fbae)[0x0];}catch(_0x54963b){throw new Error(_0xcb2d('0x4b')+res[_0xcb2d('0x25')]);}const _0x430a13=_0x58fbae;_0x39d58d=path['resolve'](__dirname,_0xcb2d('0x2c'),rs['generate'](0x4)+_0xcb2d('0x3e'));fs[_0xcb2d('0x2f')](_0x39d58d,_0x58fbae,{'encoding':'base64'});_0x515451=path[_0xcb2d('0x2b')](__dirname,_0xcb2d('0x2c'),rs[_0xcb2d('0x2d')](0x4)+_0xcb2d('0x2e'));return convertFile(_0x39d58d,_0x515451);})[_0xcb2d('0x3d')](function(){try{fs[_0xcb2d('0x21')](_0x39d58d);fs[_0xcb2d('0x31')](_0x515451,'777');}catch(_0x38045b){logger[_0xcb2d('0x19')](_0x38045b);}logger[_0xcb2d('0x1e')](_0xcb2d('0x4e'),_0x515451[_0xcb2d('0x33')]('.')[0x0]);return _0x515451['split']('.')[0x0];});};exports[_0xcb2d('0x4f')]=function(_0x3ef34f,_0x393db7,_0x313a30){return google[_0xcb2d('0x50')](_0x3ef34f,_0x393db7,_0x313a30)[_0xcb2d('0x3d')](function(_0x4ed1cc){logger[_0xcb2d('0x1e')](_0x4ed1cc['uri']);return rp(_0x4ed1cc);})[_0xcb2d('0x3d')](function(_0x4c4254){var _0x13eb05='';var _0x38f6b5=0x0;try{fs[_0xcb2d('0x21')](_0x3ef34f);}catch(_0x3d522b){logger[_0xcb2d('0x19')](_0x3d522b);}if(_0x4c4254&&_0x4c4254[_0xcb2d('0x51')]){_0x13eb05=_0x4c4254[_0xcb2d('0x51')]['map'](function(_0x5c4bb9){return _0x5c4bb9&&_0x5c4bb9[_0xcb2d('0x52')][0x0]&&_0x5c4bb9[_0xcb2d('0x52')][0x0][_0xcb2d('0x53')]?_0x5c4bb9[_0xcb2d('0x52')][0x0][_0xcb2d('0x53')]:'';})[_0xcb2d('0x54')]('\x0a');_0x38f6b5=_0x4c4254[_0xcb2d('0x51')][_0xcb2d('0x55')](function(_0x516c19){return _0x516c19&&_0x516c19['alternatives'][0x0]&&_0x516c19[_0xcb2d('0x52')][0x0][_0xcb2d('0x56')]?_0x516c19[_0xcb2d('0x52')][0x0]['confidence']:0x0;})[_0xcb2d('0x54')]('\x0a');}logger[_0xcb2d('0x1e')](_0xcb2d('0x57'),_0x13eb05);logger[_0xcb2d('0x1e')](_0xcb2d('0x58'),_0x38f6b5);return{'transcript':_0x13eb05,'confidence':_0x38f6b5};})[_0xcb2d('0x59')](function(_0x12d301){logger[_0xcb2d('0x19')](_0xcb2d('0x5a'),_0x12d301[_0xcb2d('0x18')],_0x12d301[_0xcb2d('0x5b')],_0x12d301['message']);});};exports[_0xcb2d('0x5c')]=function(_0x5a36f4,_0x2c4c15,_0xf53130,_0x2377ab){var _0x28f646=apiai(_0x2c4c15,{'language':_0x2377ab||'en'});return _0x28f646[_0xcb2d('0x5d')](_0xf53130,{'sessionId':md5(_0x5a36f4)})['then'](function(_0x28ddca){logger[_0xcb2d('0x1e')](JSON[_0xcb2d('0x46')](_0x28ddca));return{'source':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x5f')],'resolvedQuery':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x60')],'action':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x61')],'actionIncomplete':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x62')],'speech':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x63')][_0xcb2d('0x64')],'score':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x65')],'statusCode':_0x28ddca[_0xcb2d('0x66')][_0xcb2d('0x67')],'endConversation':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x68')][_0xcb2d('0x69')]||![],'isFallbackIntent':_0x28ddca[_0xcb2d('0x5e')][_0xcb2d('0x68')][_0xcb2d('0x6a')]};});};exports['googleDialogflowV2']=function(_0x53d94d,_0x3a399f,_0x10faa9,_0x26cc71,_0x3df49b,_0x4f42e1){var _0x338aaa=_0x26cc71['replace'](/\\n/g,'\x0a');var _0x153150={'credentials':{'private_key':_0x338aaa,'client_email':_0x10faa9}};var _0xc26f8e=new dialogflow[(_0xcb2d('0x6b'))](_0x153150);var _0x4c26f0=_0xc26f8e['sessionPath'](_0x3a399f,md5(_0x53d94d));var _0x1b6bce={'session':_0x4c26f0,'queryInput':{'text':{'text':_0x3df49b,'languageCode':_0x4f42e1}}};return _0xc26f8e[_0xcb2d('0x6c')](_0x1b6bce)['then'](function(_0x1d7e66){if(_0x1d7e66&&_0x1d7e66[_0xcb2d('0x6d')]){logger['info'](_0xcb2d('0x6e'),JSON[_0xcb2d('0x46')](_0x1d7e66));var _0x39e271=_0x1d7e66[0x0];if(_0x39e271){var _0x14d5fc={'action':_0x39e271['queryResult'][_0xcb2d('0x61')],'allRequiredParamsPresent':_0x39e271[_0xcb2d('0x6f')][_0xcb2d('0x70')],'endConversation':_0x39e271['queryResult']['diagnosticInfo']&&_0x39e271[_0xcb2d('0x6f')]['diagnosticInfo'][_0xcb2d('0x71')]?_0x39e271[_0xcb2d('0x6f')][_0xcb2d('0x72')][_0xcb2d('0x71')]['end_conversation'][_0xcb2d('0x73')]:![],'fulfillmentText':_0x39e271[_0xcb2d('0x6f')][_0xcb2d('0x74')],'intentName':_0x39e271['queryResult']['intent'][_0xcb2d('0x5b')],'intentDisplayName':_0x39e271[_0xcb2d('0x6f')]['intent'][_0xcb2d('0x75')],'isFallbackIntent':_0x39e271[_0xcb2d('0x6f')][_0xcb2d('0x76')][_0xcb2d('0x77')],'languageCode':_0x39e271[_0xcb2d('0x6f')][_0xcb2d('0x78')],'queryText':_0x39e271[_0xcb2d('0x6f')]['queryText'],'responseId':_0x39e271[_0xcb2d('0x79')],'score':_0x39e271['queryResult'][_0xcb2d('0x7a')],'speech':_0x39e271['queryResult'][_0xcb2d('0x74')],'providerResponse':JSON[_0xcb2d('0x46')](_0x1d7e66)};return _0x14d5fc;}}});};exports[_0xcb2d('0x7b')]=function(_0x257351,_0x2ad2fe,_0x320c4f,_0x48bbe9){return tilde[_0xcb2d('0x50')](_0x257351,_0x2ad2fe,_0x320c4f,_0x48bbe9)[_0xcb2d('0x3d')](function(_0x211acc){try{fs[_0xcb2d('0x21')](_0x257351);}catch(_0x3ffa7f){logger['error'](_0x3ffa7f);}logger[_0xcb2d('0x1e')]('Tilde\x20ASR\x20transcription',_0x211acc['transcript']);logger[_0xcb2d('0x1e')]('Tilde\x20ASR\x20confidence',_0x211acc['confidence']);return _0x211acc;});};exports[_0xcb2d('0x7c')]=function(_0x696d78,_0x218d4e,_0x2160d2,_0x4b4b19,_0x344cfb,_0x42c417){var _0x314e66=path['resolve'](__dirname,'tmp',rs[_0xcb2d('0x2d')](0x4)+_0xcb2d('0x3e'));var _0x11a93d;return aws[_0xcb2d('0x7d')](_0x696d78,_0x218d4e,_0x2160d2,_0x4b4b19,_0x344cfb,_0x42c417,_0x314e66)[_0xcb2d('0x3d')](function(){_0x11a93d=path[_0xcb2d('0x2b')](__dirname,_0xcb2d('0x2c'),rs[_0xcb2d('0x2d')](0x4)+_0xcb2d('0x2e'));return convertFile(_0x314e66,_0x11a93d);})[_0xcb2d('0x3d')](function(){try{fs[_0xcb2d('0x21')](_0x314e66);fs[_0xcb2d('0x31')](_0x11a93d,_0xcb2d('0x32'));}catch(_0x537f47){logger['error'](_0x537f47);}return _0x11a93d[_0xcb2d('0x33')]('.')[0x0];});};exports[_0xcb2d('0x7e')]=function(_0x2bbcae,_0x470558,_0x2270e2,_0x4a5282,_0x4ee3ba,_0x116588){return aws[_0xcb2d('0x7f')](_0x2bbcae,_0x470558,_0x2270e2,_0x4a5282,_0x4ee3ba,_0x116588)[_0xcb2d('0x3d')](function(_0x21397b){logger[_0xcb2d('0x1e')](JSON[_0xcb2d('0x46')](_0x21397b));return _0x21397b;});};exports[_0xcb2d('0x80')]=function(_0xa134b,_0x5b29c7,_0x545b0b,_0x5b84ae){var _0x463b19=util[_0xcb2d('0x81')](_0xcb2d('0x82'),ISPEECH_API,_0xa134b,encodeURIComponent(_0x5b29c7),_0x545b0b,_0x5b84ae);var _0x1dd3d3=path[_0xcb2d('0x2b')](__dirname,_0xcb2d('0x2c'),rs['generate'](0x4)+'.mp3');var _0x13bee9;return downloadFile(_0x463b19,_0x1dd3d3)[_0xcb2d('0x3d')](function(){_0x13bee9=path[_0xcb2d('0x2b')](__dirname,_0xcb2d('0x2c'),rs[_0xcb2d('0x2d')](0x4)+_0xcb2d('0x2e'));return convertFile(_0x1dd3d3,_0x13bee9);})['then'](function(){try{fs[_0xcb2d('0x21')](_0x1dd3d3);fs[_0xcb2d('0x31')](_0x13bee9,_0xcb2d('0x32'));}catch(_0x4d3df0){logger[_0xcb2d('0x19')](_0x4d3df0);}return _0x13bee9[_0xcb2d('0x33')]('.')[0x0];});};exports[_0xcb2d('0x83')]=function(_0xe9d48e,_0x366285,_0x5af2da,_0x30c9f6){var _0x1dbfae=util[_0xcb2d('0x81')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x366285,_0x5af2da,base64Encode(_0xe9d48e),_0x30c9f6?util[_0xcb2d('0x81')](_0xcb2d('0x84'),encodeURIComponent(_0x30c9f6)):_0xcb2d('0x85'));return uploadFile(_0x1dbfae)[_0xcb2d('0x3d')](function(_0x33f1ce){return querystring[_0xcb2d('0xc')](_0x33f1ce);});};exports[_0xcb2d('0x86')]=function(_0x257eff,_0x2aef39){return sestek[_0xcb2d('0x87')](_0x257eff,_0x2aef39)['then'](function(_0x24c747){logger[_0xcb2d('0x1e')](JSON[_0xcb2d('0x46')](_0x24c747));var _0x50c934={'speech':_0x24c747[_0xcb2d('0x88')],'action':_0x24c747['channelData']?_0x24c747[_0xcb2d('0x89')][_0xcb2d('0x8a')]:undefined,'actiondata':_0x24c747['channelData']?_0x24c747[_0xcb2d('0x89')][_0xcb2d('0x8b')]:undefined};if(_0x24c747[_0xcb2d('0x89')]&&_0x24c747['channelData'][_0xcb2d('0x8c')]){return base64Decode(_0x24c747[_0xcb2d('0x89')][_0xcb2d('0x8c')][_0xcb2d('0x8d')],path[_0xcb2d('0x2b')](__dirname,'tmp',rs['generate'](0x4)+'.wav'))[_0xcb2d('0x3d')](function(_0x431775){_0x50c934[_0xcb2d('0x8e')]=_0x431775;return _0x50c934;});}return _0x50c934;});};exports[_0xcb2d('0x8f')]=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 3e3b45a..8a23152 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 _0xd0f2=['exports','./nda'];(function(_0x5b7b22,_0x5bc479){var _0x53dc9d=function(_0x5108c0){while(--_0x5108c0){_0x5b7b22['push'](_0x5b7b22['shift']());}};_0x53dc9d(++_0x5bc479);}(_0xd0f2,0xfd));var _0x2d0f=function(_0x2c042c,_0xabcc49){_0x2c042c=_0x2c042c-0x0;var _0x1b9db4=_0xd0f2[_0x2c042c];return _0x1b9db4;};var nda=require(_0x2d0f('0x0'));module[_0x2d0f('0x1')]={'nda':nda}; \ No newline at end of file +var _0x84ad=['exports','./nda'];(function(_0xa606ab,_0x7df430){var _0x3c9310=function(_0x1d7a74){while(--_0x1d7a74){_0xa606ab['push'](_0xa606ab['shift']());}};_0x3c9310(++_0x7df430);}(_0x84ad,0x13f));var _0xd84a=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x84ad[_0x4b12ae];return _0x16957b;};var nda=require(_0xd84a('0x0'));module[_0xd84a('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 2c7d171..93d8d65 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 _0x3f8c=['CustomAction','custom_action_data','info','stringify','../../../../../config/logger','agi','exports','/token','password','username','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action'];(function(_0x5a425f,_0x439447){var _0x1ab39e=function(_0x36829a){while(--_0x36829a){_0x5a425f['push'](_0x5a425f['shift']());}};_0x1ab39e(++_0x439447);}(_0x3f8c,0x104));var _0xc3f8=function(_0x239a75,_0x21c1d0){_0x239a75=_0x239a75-0x0;var _0x36b5bd=_0x3f8c[_0x239a75];return _0x36b5bd;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));module[_0xc3f8('0x2')]=function(_0xab5f83,_0x4de1c7){var _0x5bd5e7={'method':'POST','uri':url['resolve'](_0x4de1c7['ndauth_url'],_0xc3f8('0x3')),'form':{'grant_type':_0xc3f8('0x4'),'username':_0x4de1c7[_0xc3f8('0x5')],'password':_0x4de1c7[_0xc3f8('0x4')]},'json':!![]};return rp(_0x5bd5e7)[_0xc3f8('0x6')](function(_0x15512a){var _0x51093a={'method':_0xc3f8('0x7'),'uri':url[_0xc3f8('0x8')](_0x4de1c7[_0xc3f8('0x9')],_0xc3f8('0xa')),'body':{'type':_0x4de1c7[_0xc3f8('0xb')]||_0xc3f8('0xc'),'channelId':_0xc3f8('0xd'),'conversation':{'id':_0xab5f83['uniqueid']},'from':{'id':_0xab5f83[_0xc3f8('0xe')],'name':_0xab5f83[_0xc3f8('0xf')]},'recipient':{'id':_0xab5f83[_0xc3f8('0x10')],'name':_0xab5f83[_0xc3f8('0x11')]},'text':_0x4de1c7['text'],'channelData':{}},'headers':{'Authorization':_0xc3f8('0x12')+_0x15512a[_0xc3f8('0x13')]},'json':!![]};if(_0x4de1c7[_0xc3f8('0x14')]){_0x51093a[_0xc3f8('0x15')]['channelData'][_0xc3f8('0x16')]=_0x4de1c7[_0xc3f8('0x14')];}if(_0x4de1c7[_0xc3f8('0x17')]=='1'){_0x51093a[_0xc3f8('0x15')][_0xc3f8('0x18')][_0xc3f8('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc3f8('0x1a')};}if(_0x4de1c7[_0xc3f8('0x1b')]){_0x51093a[_0xc3f8('0x15')][_0xc3f8('0x18')][_0xc3f8('0x1c')]=_0x4de1c7[_0xc3f8('0x1b')];if(_0x4de1c7[_0xc3f8('0x1d')]){_0x51093a['body'][_0xc3f8('0x18')]['CustomActionData']=_0x4de1c7['custom_action_data'];}}logger[_0xc3f8('0x1e')](JSON[_0xc3f8('0x1f')](_0x51093a));return rp(_0x51093a);});}; \ No newline at end of file +var _0x45c8=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','../../../../../config/logger','agi','exports','ndauth_url','/token','password','POST','resolve'];(function(_0x1a51db,_0x2eecdc){var _0xea0473=function(_0x54b391){while(--_0x54b391){_0x1a51db['push'](_0x1a51db['shift']());}};_0xea0473(++_0x2eecdc);}(_0x45c8,0xef));var _0x845c=function(_0x6afe67,_0x80a160){_0x6afe67=_0x6afe67-0x0;var _0x173aca=_0x45c8[_0x6afe67];return _0x173aca;};'use strict';var rp=require(_0x845c('0x0'));var url=require('url');var logger=require(_0x845c('0x1'))(_0x845c('0x2'));module[_0x845c('0x3')]=function(_0x343dc5,_0x49dc68){var _0x4ecb22={'method':'POST','uri':url['resolve'](_0x49dc68[_0x845c('0x4')],_0x845c('0x5')),'form':{'grant_type':_0x845c('0x6'),'username':_0x49dc68['username'],'password':_0x49dc68[_0x845c('0x6')]},'json':!![]};return rp(_0x4ecb22)['then'](function(_0x42b569){var _0x4648e1={'method':_0x845c('0x7'),'uri':url[_0x845c('0x8')](_0x49dc68[_0x845c('0x9')],_0x845c('0xa')),'body':{'type':_0x49dc68[_0x845c('0xb')]||_0x845c('0xc'),'channelId':_0x845c('0xd'),'conversation':{'id':_0x343dc5[_0x845c('0xe')]},'from':{'id':_0x343dc5['callerid'],'name':_0x343dc5['calleridname']},'recipient':{'id':_0x343dc5[_0x845c('0xf')],'name':_0x343dc5[_0x845c('0x10')]},'text':_0x49dc68['text'],'channelData':{}},'headers':{'Authorization':_0x845c('0x11')+_0x42b569[_0x845c('0x12')]},'json':!![]};if(_0x49dc68[_0x845c('0x13')]){_0x4648e1[_0x845c('0x14')][_0x845c('0x15')][_0x845c('0x16')]=_0x49dc68['project'];}if(_0x49dc68[_0x845c('0x17')]=='1'){_0x4648e1[_0x845c('0x14')]['channelData'][_0x845c('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x845c('0x19')};}if(_0x49dc68[_0x845c('0x1a')]){_0x4648e1[_0x845c('0x14')][_0x845c('0x15')][_0x845c('0x1b')]=_0x49dc68[_0x845c('0x1a')];if(_0x49dc68['custom_action_data']){_0x4648e1['body'][_0x845c('0x15')][_0x845c('0x1c')]=_0x49dc68[_0x845c('0x1d')];}}logger['info'](JSON[_0x845c('0x1e')](_0x4648e1));return rp(_0x4648e1);});}; \ 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 f3afadb..ad16912 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 _0x9312=['exports','./lib/api'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x9312,0x18f));var _0x2931=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x9312[_0x3c04ef];return _0x6a3a69;};'use strict';var asr=require(_0x2931('0x0'));module[_0x2931('0x1')]=function(_0x4ceaee,_0x93799e,_0x2fa129,_0x101216){return asr(_0x4ceaee,_0x93799e,_0x2fa129,_0x101216);}; \ No newline at end of file +var _0x0145=['exports','./lib/api'];(function(_0x4a09f2,_0x22c066){var _0x2ee392=function(_0x49482b){while(--_0x49482b){_0x4a09f2['push'](_0x4a09f2['shift']());}};_0x2ee392(++_0x22c066);}(_0x0145,0x199));var _0x5014=function(_0x2cf44b,_0x2f7fc3){_0x2cf44b=_0x2cf44b-0x0;var _0x1f3a6c=_0x0145[_0x2cf44b];return _0x1f3a6c;};'use strict';var asr=require(_0x5014('0x0'));module[_0x5014('0x1')]=function(_0x50cde9,_0x4e6095,_0x4c46cb,_0x52872f){return asr(_0x50cde9,_0x4e6095,_0x4c46cb,_0x52872f);}; \ 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 5dd2828..64a88c1 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 _0x6323=['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','error','isNil','open','message','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x390b4b,_0x5454dd){var _0x50d44e=function(_0x3a2fd9){while(--_0x3a2fd9){_0x390b4b['push'](_0x390b4b['shift']());}};_0x50d44e(++_0x5454dd);}(_0x6323,0xce));var _0x3632=function(_0x2578d1,_0x310481){_0x2578d1=_0x2578d1-0x0;var _0x249fc1=_0x6323[_0x2578d1];return _0x249fc1;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3632('0x0'));var logger=require(_0x3632('0x1'))('agi');module['exports']=function(_0x5159c0,_0x22ec28,_0x4f725a,_0x567f55){return new BPromise(function(_0x5f3534,_0x5ee58a){logger[_0x3632('0x2')](_0x3632('0x3'),_0x567f55||_0x3632('0x4'));var _0x24fb81=new WebSocket(_0x567f55||_0x3632('0x4'),{'perMessageDeflate':![]});var _0x381c79='';var _0x5aaefd='0';var _0x84927='1';var _0x400837=_0x3632('0x5');function _0x134ed0(_0x38f534){var _0x5becbd=crypto[_0x3632('0x6')]('sha1');_0x5becbd['update'](_0x38f534);return _0x5becbd[_0x3632('0x7')]('hex');}function _0x34198c(){try{logger['info'](_0x3632('0x8'));var _0x288add=moment()[_0x3632('0x9')]();var _0x83e09c=_0x134ed0(_0x288add+_0x22ec28+_0x4f725a);_0x24fb81[_0x3632('0xa')](JSON[_0x3632('0xb')]({'appID':_0x22ec28,'timestamp':_0x288add,'appKey':_0x83e09c}));var _0x5c1220=fs['createReadStream'](_0x5159c0);_0x5c1220['on'](_0x3632('0xc'),function(_0x180197){_0x24fb81[_0x3632('0xa')](_0x180197);});_0x5c1220['on'](_0x3632('0xd'),function(){_0x24fb81[_0x3632('0xa')](_0x3632('0xe'));});}catch(_0x6aecd8){logger['error'](_0x3632('0xf'),JSON[_0x3632('0xb')](_0x6aecd8));_0x24fb81[_0x3632('0x10')]();}}function _0x5b6ceb(_0x46239f){try{if(_0x46239f){var _0x33858e=JSON[_0x3632('0x11')](_0x46239f);switch(_0x33858e[_0x3632('0x12')]){case 0x0:if(_0x33858e['result']){if(_0x33858e[_0x3632('0x13')]['final']){logger['info'](_0x3632('0x14'),JSON[_0x3632('0xb')](_0x33858e[_0x3632('0x13')][_0x3632('0x15')]));_0x381c79=_0x33858e[_0x3632('0x13')][_0x3632('0x15')][0x0][_0x3632('0x16')];_0x5aaefd=_0x33858e[_0x3632('0x13')][_0x3632('0x15')][0x0]['likelihood'];_0x84927='0';_0x400837=_0x3632('0x17');_0x24fb81[_0x3632('0x10')]();}}break;case 0x1:logger['info'](_0x3632('0x5'));_0x84927='1';_0x400837=_0x3632('0x5');break;case 0x2:logger[_0x3632('0x2')](_0x3632('0x18'));_0x84927='2';_0x400837=_0x3632('0x18');break;case 0x9:logger[_0x3632('0x2')](_0x3632('0x19'));_0x84927='9';_0x400837=_0x3632('0x19');break;case 0xa:logger[_0x3632('0x2')](_0x3632('0x1a'));_0x84927='10';_0x400837=_0x3632('0x1a');break;case 0xb:logger[_0x3632('0x2')](_0x3632('0x1b'));_0x84927='11';_0x400837=_0x3632('0x1b');}}}catch(_0x3a74b1){logger['error'](_0x3632('0x1c'),JSON[_0x3632('0xb')](_0x3a74b1));_0x24fb81[_0x3632('0x10')]();}}function _0x5f07a6(){logger[_0x3632('0x2')]('Close\x20Tilde\x20ASR\x20socket');_0x5f3534({'transcript':_0x381c79,'confidence':_0x5aaefd,'status':_0x84927,'status_message':_0x400837});}function _0xc7bf6c(_0x3987c0){logger[_0x3632('0x1d')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x3632('0x1e')](_0x3987c0)){logger['error'](_['isObject'](_0x3987c0)?JSON['stringify'](_0x3987c0):_0x3987c0);}}_0x24fb81['on'](_0x3632('0x1f'),_0x34198c);_0x24fb81['on'](_0x3632('0x20'),_0x5b6ceb);_0x24fb81['on'](_0x3632('0xd'),_0x5f07a6);_0x24fb81['on'](_0x3632('0x1d'),_0xc7bf6c);});}; \ No newline at end of file +var _0xc055=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','close','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','hex','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','status','result','hypotheses','transcript','likelihood','Success.','terminate'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc055,0x1a9));var _0x5c05=function(_0x16f55d,_0x43c7fe){_0x16f55d=_0x16f55d-0x0;var _0x3f3706=_0xc055[_0x16f55d];return _0x3f3706;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5c05('0x0'));var logger=require('../../../../../../config/logger')(_0x5c05('0x1'));module[_0x5c05('0x2')]=function(_0x248080,_0xb667c7,_0x3073df,_0xeaba6f){return new BPromise(function(_0x2133eb,_0x3316cb){logger[_0x5c05('0x3')](_0x5c05('0x4'),_0xeaba6f||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x320677=new WebSocket(_0xeaba6f||_0x5c05('0x5'),{'perMessageDeflate':![]});var _0x778e07='';var _0x4cbed7='0';var _0x20d8bd='1';var _0x23f169=_0x5c05('0x6');function _0xcb818f(_0x264e85){var _0x35cb48=crypto['createHash'](_0x5c05('0x7'));_0x35cb48['update'](_0x264e85);return _0x35cb48['digest'](_0x5c05('0x8'));}function _0x5d368a(){try{logger[_0x5c05('0x3')]('Open\x20Tilde\x20ASR\x20socket');var _0x5205b7=moment()['unix']();var _0x1fa0c7=_0xcb818f(_0x5205b7+_0xb667c7+_0x3073df);_0x320677[_0x5c05('0x9')](JSON[_0x5c05('0xa')]({'appID':_0xb667c7,'timestamp':_0x5205b7,'appKey':_0x1fa0c7}));var _0x61f80f=fs[_0x5c05('0xb')](_0x248080);_0x61f80f['on'](_0x5c05('0xc'),function(_0xa1edb4){_0x320677[_0x5c05('0x9')](_0xa1edb4);});_0x61f80f['on']('close',function(){_0x320677['send'](_0x5c05('0xd'));});}catch(_0x335044){logger[_0x5c05('0xe')](_0x5c05('0xf'),JSON[_0x5c05('0xa')](_0x335044));_0x320677['terminate']();}}function _0x3a201c(_0x541a90){try{if(_0x541a90){var _0x1411f0=JSON['parse'](_0x541a90);switch(_0x1411f0[_0x5c05('0x10')]){case 0x0:if(_0x1411f0[_0x5c05('0x11')]){if(_0x1411f0[_0x5c05('0x11')]['final']){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x5c05('0xa')](_0x1411f0[_0x5c05('0x11')]['hypotheses']));_0x778e07=_0x1411f0[_0x5c05('0x11')][_0x5c05('0x12')][0x0][_0x5c05('0x13')];_0x4cbed7=_0x1411f0['result'][_0x5c05('0x12')][0x0][_0x5c05('0x14')];_0x20d8bd='0';_0x23f169=_0x5c05('0x15');_0x320677[_0x5c05('0x16')]();}}break;case 0x1:logger[_0x5c05('0x3')](_0x5c05('0x6'));_0x20d8bd='1';_0x23f169=_0x5c05('0x6');break;case 0x2:logger[_0x5c05('0x3')](_0x5c05('0x17'));_0x20d8bd='2';_0x23f169=_0x5c05('0x17');break;case 0x9:logger[_0x5c05('0x3')](_0x5c05('0x18'));_0x20d8bd='9';_0x23f169=_0x5c05('0x18');break;case 0xa:logger['info'](_0x5c05('0x19'));_0x20d8bd='10';_0x23f169='Authentication\x20failed.';break;case 0xb:logger[_0x5c05('0x3')](_0x5c05('0x1a'));_0x20d8bd='11';_0x23f169='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x25884c){logger[_0x5c05('0xe')](_0x5c05('0x1b'),JSON[_0x5c05('0xa')](_0x25884c));_0x320677[_0x5c05('0x16')]();}}function _0x2908df(){logger['info'](_0x5c05('0x1c'));_0x2133eb({'transcript':_0x778e07,'confidence':_0x4cbed7,'status':_0x20d8bd,'status_message':_0x23f169});}function _0x442b76(_0x48a0c2){logger[_0x5c05('0xe')](_0x5c05('0x1d'));if(!_['isNil'](_0x48a0c2)){logger[_0x5c05('0xe')](_[_0x5c05('0x1e')](_0x48a0c2)?JSON[_0x5c05('0xa')](_0x48a0c2):_0x48a0c2);}}_0x320677['on']('open',_0x5d368a);_0x320677['on']('message',_0x3a201c);_0x320677['on'](_0x5c05('0x1f'),_0x2908df);_0x320677['on'](_0x5c05('0xe'),_0x442b76);});}; \ 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 04c0639..10cb4be 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 _0x22e7=['./asr','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22e7,0x1bc));var _0x722e=function(_0x5c230f,_0x4269e8){_0x5c230f=_0x5c230f-0x0;var _0xaabc29=_0x22e7[_0x5c230f];return _0xaabc29;};var asr=require(_0x722e('0x0'));module[_0x722e('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c5ab502..285ccdf 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 _0x7b07=['code','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b07,0x72));var _0x77b0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7b07[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0x77b0('0x0'));var net=require(_0x77b0('0x1'));var EventEmitter=require(_0x77b0('0x2'))['EventEmitter'];var AGIError=require(_0x77b0('0x3'));var AGIChannel=require(_0x77b0('0x4'));var AGIServer=function(_0x362649,_0x367148,_0x5c69de){var _0x2893ee=this,_0x362649=_0x362649||0x11dd,_0x367148=_0x367148||_0x77b0('0x5'),_0x4566ef=null,_0x1e677f=0x0;EventEmitter['call'](_0x2893ee);function _0x1fd5cb(){if(!_0x362649){_0x2893ee[_0x77b0('0x6')](_0x77b0('0x7'),new AGIError(_0x77b0('0x8')));return![];}_0x4566ef=net[_0x77b0('0x9')]();_0x4566ef[_0x77b0('0xa')](_0x362649,_0x367148);_0x4566ef['on'](_0x77b0('0xb'),function(){_0x2893ee[_0x77b0('0x6')]('listening');});_0x4566ef['on']('connection',function(_0x2d4f96){_0x4566ef[_0x77b0('0xc')](function(_0x3de4e7,_0x162fab){if(_0x3de4e7){_0x2893ee[_0x77b0('0x6')](_0x77b0('0x7'),new AGIError(_0x77b0('0xd'),_0x3de4e7));}else if(_0x5c69de&&_0x5c69de<0x0){_0x2893ee[_0x77b0('0x6')](_0x77b0('0x7'),new AGIError(_0x77b0('0xe')));_0x2d4f96[_0x77b0('0xf')]();}else if(_0x5c69de&&_0x5c69de>0x0&&_0x5c69de<_0x162fab){_0x1e677f+=0x1;_0x2893ee[_0x77b0('0x6')](_0x77b0('0x7'),new AGIError(_0x77b0('0x10'),_0x1e677f));_0x2d4f96['destroy']();}else{var _0xe9933a=new AGIChannel(_0x2d4f96);_0xe9933a['on']('ready',function(){_0x2893ee[_0x77b0('0x6')](_0x77b0('0x11'),_0xe9933a);});}});});_0x4566ef['on'](_0x77b0('0x7'),function(_0x5d9653){_0x2893ee[_0x77b0('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5d9653[_0x77b0('0x12')]));});_0x4566ef['on']('close',function(){_0x2893ee[_0x77b0('0x6')](_0x77b0('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x77b0('0x14')](function(){_0x1fd5cb();});};util['inherits'](AGIServer,EventEmitter);module[_0x77b0('0x15')]=function(_0x4a8117,_0x1c84b,_0x165dc4){return new AGIServer(_0x4a8117,_0x1c84b,_0x165dc4);}; \ No newline at end of file +var _0x3675=['E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','util','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','error','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3675,0x100));var _0x5367=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x3675[_0x51e79c];return _0x2467be;};'use strict';var util=require(_0x5367('0x0'));var net=require('net');var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x5367('0x1'));var AGIServer=function(_0x1d3925,_0x47b91f,_0xf06eab){var _0x2c226e=this,_0x1d3925=_0x1d3925||0x11dd,_0x47b91f=_0x47b91f||_0x5367('0x2'),_0x422d2a=null,_0xa1a372=0x0;EventEmitter[_0x5367('0x3')](_0x2c226e);function _0x227056(){if(!_0x1d3925){_0x2c226e[_0x5367('0x4')]('error',new AGIError(_0x5367('0x5')));return![];}_0x422d2a=net['createServer']();_0x422d2a['listen'](_0x1d3925,_0x47b91f);_0x422d2a['on'](_0x5367('0x6'),function(){_0x2c226e[_0x5367('0x4')](_0x5367('0x6'));});_0x422d2a['on'](_0x5367('0x7'),function(_0x53688a){_0x422d2a[_0x5367('0x8')](function(_0x583c3b,_0x17d3e2){if(_0x583c3b){_0x2c226e[_0x5367('0x4')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x583c3b));}else if(_0xf06eab&&_0xf06eab<0x0){_0x2c226e[_0x5367('0x4')]('error',new AGIError(_0x5367('0x9')));_0x53688a[_0x5367('0xa')]();}else if(_0xf06eab&&_0xf06eab>0x0&&_0xf06eab<_0x17d3e2){_0xa1a372+=0x1;_0x2c226e[_0x5367('0x4')](_0x5367('0xb'),new AGIError(_0x5367('0xc'),_0xa1a372));_0x53688a[_0x5367('0xa')]();}else{var _0x4a616=new AGIChannel(_0x53688a);_0x4a616['on'](_0x5367('0xd'),function(){_0x2c226e[_0x5367('0x4')](_0x5367('0x7'),_0x4a616);});}});});_0x422d2a['on'](_0x5367('0xb'),function(_0xb30980){_0x2c226e[_0x5367('0x4')](_0x5367('0xb'),new AGIError(_0x5367('0xe'),_0xb30980['code']));});_0x422d2a['on'](_0x5367('0xf'),function(){_0x2c226e[_0x5367('0x4')](_0x5367('0xf'),new AGIError(_0x5367('0x10')));});}process['nextTick'](function(){_0x227056();});};util[_0x5367('0x11')](AGIServer,EventEmitter);module['exports']=function(_0x3420d5,_0x101bb2,_0x5f5991){return new AGIServer(_0x3420d5,_0x101bb2,_0x5f5991);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4e24756..c1e00ce 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 _0x6d4b=['mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','intKey','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','odbc','randomstring','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','answer','Wait\x20%s\x20seconds\x20before\x20answer','list_id','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test'];(function(_0x495054,_0x304104){var _0x146d2e=function(_0x350426){while(--_0x350426){_0x495054['push'](_0x495054['shift']());}};_0x146d2e(++_0x304104);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x1bc632,_0x24cd36){_0x1bc632=_0x1bc632-0x0;var _0x27bf16=_0x6d4b[_0x1bc632];return _0x27bf16;};'use strict';var fs=require('fs');var path=require(_0xb6d4('0x0'));var util=require(_0xb6d4('0x1'));var _=require(_0xb6d4('0x2'));var sh=require('shelljs');var odbc=require(_0xb6d4('0x3'))();var rs=require(_0xb6d4('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xb6d4('0x5'));var logger=require(_0xb6d4('0x6'))(_0xb6d4('0x7'));var config=require(_0xb6d4('0x8'));var scripts=require(_0xb6d4('0x9'));var FILES_PATH=_0xb6d4('0xa');var recursiveMapAttributes=[_0xb6d4('0xb'),_0xb6d4('0xc')];var verticesWithRetry=['menu',_0xb6d4('0xd'),_0xb6d4('0xe')];var AGIVertices=function(_0x3907c5,_0x3e07cc,_0x2effac){this[_0xb6d4('0xf')]=_0x3907c5;this[_0xb6d4('0x10')]=_0x3e07cc;this[_0xb6d4('0x11')]=_0x2effac;};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x13')]=function(_0x56bdae,_0x4c8bb2){this['rpc']['getVariableById'](_0x56bdae)[_0xb6d4('0x14')](function(_0x5c6f06){_0x4c8bb2(null,_0x5c6f06?_0x5c6f06[_0xb6d4('0x15')]:![]);})[_0xb6d4('0x16')](function(_0x13cbfc){_0x4c8bb2(_0x13cbfc);});};AGIVertices[_0xb6d4('0x12')]['getVoiceQueue']=function(_0xe8d726,_0x2c3af8){this['rpc'][_0xb6d4('0x17')](_0xe8d726)['then'](function(_0x4585ee){_0x2c3af8(null,_0x4585ee?_0x4585ee[_0xb6d4('0x15')]:![]);})[_0xb6d4('0x16')](function(_0x1b0dab){_0x2c3af8(_0x1b0dab);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x18')]=function(_0x77fba0,_0x5e3b0f){this[_0xb6d4('0x10')][_0xb6d4('0x19')](_0x77fba0)[_0xb6d4('0x14')](function(_0x431af2){_0x5e3b0f(null,_0x431af2?_0x431af2[_0xb6d4('0x15')]:![]);})[_0xb6d4('0x16')](function(_0x28bce9){_0x5e3b0f(_0x28bce9);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1a')]=function(_0x5221e7,_0x5e1e0b){this[_0xb6d4('0x10')][_0xb6d4('0x1b')](_0x5221e7)[_0xb6d4('0x14')](function(_0x3d3cd6){_0x5e1e0b(null,_0x3d3cd6?_0x3d3cd6[_0xb6d4('0x1c')]:![]);})['catch'](function(_0x145157){_0x5e1e0b(_0x145157);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1d')]=function(_0x5b9fb1,_0x3ee5c4){this['rpc']['getUserById'](_0x5b9fb1)[_0xb6d4('0x14')](function(_0x9e402a){_0x3ee5c4(null,_0x9e402a?_0x9e402a['name']:![]);})['catch'](function(_0x3a86ac){_0x3ee5c4(_0x3a86ac);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1e')]=function(_0x26248b,_0xa5afb9){this[_0xb6d4('0x10')][_0xb6d4('0x1f')](_0x26248b)[_0xb6d4('0x14')](function(_0x93c3b1){_0xa5afb9(null,_0x93c3b1?_0x93c3b1[_0xb6d4('0x15')]:![]);})[_0xb6d4('0x16')](function(_0x18db34){_0xa5afb9(_0x18db34);});};AGIVertices['prototype'][_0xb6d4('0x20')]=function(_0xac7c48,_0x54ddeb){var _0x242a44=this;this['rpc'][_0xb6d4('0x21')](_0xac7c48)[_0xb6d4('0x14')](function(_0x346d4d){_0x54ddeb(null,_0x346d4d?_0x242a44[_0xb6d4('0x22')](_0x346d4d[_0xb6d4('0x23')]):![]);})[_0xb6d4('0x16')](function(_0x41847c){_0x54ddeb(_0x41847c);});};AGIVertices[_0xb6d4('0x12')]['getMailAccount']=function(_0x2aea11,_0x1fea09){this[_0xb6d4('0x10')]['getMailAccountById'](_0x2aea11)[_0xb6d4('0x14')](function(_0x5bacec){_0x1fea09(null,_0x5bacec?_0x5bacec:![]);})['catch'](function(_0x38a7f8){_0x1fea09(_0x38a7f8);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x24')]=function(_0x51971c,_0x4d8dc5,_0x4ac8f1){this[_0xb6d4('0x11')][_0xb6d4('0x24')](_0x51971c,_0x4d8dc5)[_0xb6d4('0x14')](function(){_0x4ac8f1(null);})[_0xb6d4('0x16')](function(_0x1a5a65){_0x4ac8f1(_0x1a5a65);});};AGIVertices[_0xb6d4('0x12')]['getIntervals']=function(_0x59e433,_0x43436f){this['rpc']['getIntervalById'](_0x59e433)['then'](function(_0x5b7771){if(_0x5b7771){if(_0x5b7771[_0xb6d4('0x25')]){_0x43436f(null,[_0x5b7771[_0xb6d4('0x26')]]);}else{_0x43436f(null,_['map'](_0x5b7771[_0xb6d4('0x27')],'interval'));}}else{_0x43436f(null,![]);}})[_0xb6d4('0x16')](function(_0x879877){_0x43436f(_0x879877);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x22')]=function(_0x274ebd){return util[_0xb6d4('0x28')](_0xb6d4('0x29'),FILES_PATH,_0x274ebd);};AGIVertices['prototype'][_0xb6d4('0x2a')]=function(_0x1c78a5,_0x2ed1c7,_0x577a92){odbc['open'](_0x1c78a5,function(_0x16b558){if(_0x16b558){logger[_0xb6d4('0x2b')](_0xb6d4('0x2c'),_0x16b558);_0x577a92(_0x16b558);}else{logger[_0xb6d4('0x2d')](_0xb6d4('0x2e'));odbc['query'](_0x2ed1c7,function(_0x4167bf,_0x54639e){if(_0x4167bf){logger[_0xb6d4('0x2d')](_0xb6d4('0x2f'),_0x2ed1c7);_0x577a92(_0x4167bf);}else{logger[_0xb6d4('0x2d')]('Query\x20executed\x20correctly\x20%s',_0x2ed1c7);odbc[_0xb6d4('0x30')](function(_0x54917a){if(_0x54917a){logger['error'](_0xb6d4('0x31'),_0x54917a);}_0x577a92(null,_0x54639e);});}});}});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x32')]=function(_0x106fc0,_0x5ece40){this[_0xb6d4('0x10')]['getSmsAccountById'](_0x106fc0)[_0xb6d4('0x14')](function(_0x4b2b00){_0x5ece40(null,_0x4b2b00?_0x4b2b00:![]);})[_0xb6d4('0x16')](function(_0x4d0783){_0x5ece40(_0x4d0783);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x33')]=function(_0x7e9a87,_0x2bc4eb){this[_0xb6d4('0x10')]['createSmsMessage'](_0x7e9a87)[_0xb6d4('0x14')](function(_0x532484){_0x2bc4eb(null,_0x532484);})[_0xb6d4('0x16')](function(_0x2c92c9){_0x2bc4eb(_0x2c92c9);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x34')]=function(_0x314bfb,_0x313aee,_0x5c4f3a){this[_0xb6d4('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0xb6d4('0xf')][_0xb6d4('0x35')],'node':_0x314bfb[_0xb6d4('0x36')],'application':_0x314bfb[_0xb6d4('0x37')],'data':_0x313aee||null,'project_name':this[_0xb6d4('0xf')][_0xb6d4('0x38')],'callerid':this['channel']['callerid']})[_0xb6d4('0x14')](function(_0x52b9e6){if(_0x5c4f3a){_0x5c4f3a(null,_0x52b9e6);}})['catch'](function(_0x33354f){if(_0x5c4f3a){_0x5c4f3a(_0x33354f);}});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x39')]=function(_0x4f6c98,_0x56fef3,_0x29cc38,_0x2c1253){this[_0xb6d4('0x10')][_0xb6d4('0x39')]({'uniqueid':this[_0xb6d4('0xf')]['uniqueid'],'callerid':this[_0xb6d4('0xf')][_0xb6d4('0x3a')],'calleridname':this[_0xb6d4('0xf')][_0xb6d4('0x3b')],'context':this[_0xb6d4('0xf')][_0xb6d4('0x3c')],'extension':this['channel']['extension'],'priority':this[_0xb6d4('0xf')]['priority'],'accountcode':this['channel'][_0xb6d4('0x3d')],'dnid':this[_0xb6d4('0xf')][_0xb6d4('0x3e')],'projectName':this[_0xb6d4('0xf')][_0xb6d4('0x38')],'saveName':_0x56fef3,'filename':_0x4f6c98[_0xb6d4('0x3f')]||_0x56fef3,'savePath':_0x29cc38})[_0xb6d4('0x14')](function(_0x56adb8){_0x2c1253(null,_0x56adb8);})[_0xb6d4('0x16')](function(_0x760f25){_0x2c1253(_0x760f25);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x40')]=function(_0x58d927,_0x59c32f,_0x59bbdf,_0x496e0a,_0x39a718){this['rpc'][_0xb6d4('0x40')]({'uniqueid':this[_0xb6d4('0xf')][_0xb6d4('0x35')],'body':_0x58d927,'direction':_0x59c32f,'providerName':_0x59bbdf,'providerResponse':_0x496e0a})[_0xb6d4('0x14')](function(_0x3e3271){if(_0x39a718){_0x39a718(null,_0x3e3271);}})[_0xb6d4('0x16')](function(_0x5d19c6){if(_0x39a718){_0x39a718(_0x5d19c6);}});};AGIVertices['prototype'][_0xb6d4('0x41')]=function(_0x2d08a6,_0x5da1d5){this[_0xb6d4('0x10')][_0xb6d4('0x41')]({'firstName':_[_0xb6d4('0x42')](_0x2d08a6[_0xb6d4('0x15')])||_[_0xb6d4('0x43')](_0x2d08a6['name'])?'callback_'+Math['random']():_0x2d08a6[_0xb6d4('0x15')],'lastName':_[_0xb6d4('0x42')](_0x2d08a6[_0xb6d4('0x44')])||_[_0xb6d4('0x43')](_0x2d08a6[_0xb6d4('0x44')])?null:_0x2d08a6['lastName'],'phone':_0x2d08a6[_0xb6d4('0x45')],'ListId':_0x2d08a6['list_id'],'scheduledat':_0x2d08a6[_0xb6d4('0x46')],'callbackUniqueid':this[_0xb6d4('0xf')][_0xb6d4('0x35')],'tags':'callback','description':_0xb6d4('0x47')+_0x2d08a6[_0xb6d4('0x46')]['toString'](),'priority':_0x2d08a6['callback_priority']})['then'](function(_0x496060){_0x5da1d5(null,_0x496060);})[_0xb6d4('0x16')](function(_0x547413){_0x5da1d5(_0x547413);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x48')]=function(_0x505c69,_0x3efa2e){this['rpc'][_0xb6d4('0x49')](_0x505c69)[_0xb6d4('0x14')](function(_0x3e8fff){_0x3efa2e(null,_0x3e8fff?_0x3e8fff[_0xb6d4('0x15')]:![]);})[_0xb6d4('0x16')](function(_0x5ead9c){_0x3efa2e(_0x5ead9c);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x4a')]=function(_0x2124c2,_0x51f950,_0x36a584){var _0x50495e={'role':_0xb6d4('0x4b')};_0x50495e[_0x2124c2]=this[_0xb6d4('0xf')]['callerid'];this[_0xb6d4('0x10')][_0xb6d4('0x4a')](_0x50495e,_0x51f950,this[_0xb6d4('0xf')][_0xb6d4('0x35')])['then'](function(_0x580dbd){_0x36a584(null,_[_0xb6d4('0x43')](_0x580dbd)?![]:!![]);})[_0xb6d4('0x16')](function(_0x4bd896){logger['error'](_0x4bd896);_0x36a584(null,![]);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x4c')]=function(_0x397165,_0x57466e){var _0x58628a={'role':_0xb6d4('0x4b')};_0x58628a[_0x397165]=this[_0xb6d4('0xf')]['callerid'];this[_0xb6d4('0x10')][_0xb6d4('0x4c')](_0x58628a)[_0xb6d4('0x14')](function(_0x43e357){_0x57466e(null,_[_0xb6d4('0x43')](_0x43e357)?![]:!![]);})[_0xb6d4('0x16')](function(_0x757290){logger[_0xb6d4('0x2b')](_0x757290);_0x57466e(null,![]);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x4d')]=function(_0x1a8481,_0x5b675a){var _0x95200f={'role':_0xb6d4('0x4b')};_0x95200f[_0x1a8481]=this[_0xb6d4('0xf')][_0xb6d4('0x3a')];this[_0xb6d4('0x10')][_0xb6d4('0x4d')](_0x95200f)[_0xb6d4('0x14')](function(_0x48c7f7){_0x5b675a(null,_[_0xb6d4('0x43')](_0x48c7f7)?![]:!![]);})[_0xb6d4('0x16')](function(_0x1461c6){logger[_0xb6d4('0x2b')](_0x1461c6);_0x5b675a(null,![]);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x4e')]=function(_0x3f86bd,_0x3fc998){var _0x125ee5={'role':'agent'};_0x125ee5[_0x3f86bd]=this[_0xb6d4('0xf')][_0xb6d4('0x3a')];var _0xb3c905=_0x3f86bd!=_0xb6d4('0x4f')?util['format'](_0xb6d4('0x50'),'LOCAL',this[_0xb6d4('0xf')]['callerid']):undefined;this['rpc'][_0xb6d4('0x4e')](_0x125ee5,_0xb3c905)[_0xb6d4('0x14')](function(_0x265233){_0x3fc998(null,_[_0xb6d4('0x43')](_0x265233)?![]:!![]);})['catch'](function(_0x378ecc){logger[_0xb6d4('0x2b')](_0x378ecc);_0x3fc998(null,![]);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x51')]=function(_0x2d7c47,_0x29dbd8){sh['exec'](_['trim'](_0x2d7c47),function(_0x169285,_0x39eb24){var _0x48e28d=_0x39eb24['replace'](/(\r\n|\n|\r)/gm,'');_0x29dbd8(null,_0x48e28d);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x52')]=function(_0x2c8ad2,_0x2aff74){scripts[_0xb6d4('0x52')](_0x2c8ad2[_0xb6d4('0x53')],_0x2c8ad2[_0xb6d4('0x54')]||_0xb6d4('0x55'),_0x2c8ad2['text'],_0x2c8ad2[_0xb6d4('0x56')]||_0xb6d4('0x57'),_0x2c8ad2['ssmlGender']||_0xb6d4('0x58'),_0x2c8ad2[_0xb6d4('0x59')]||'MP3')[_0xb6d4('0x14')](function(_0x30f45f){_0x2aff74(null,_0x30f45f);})[_0xb6d4('0x16')](function(_0x137aa3){_0x2aff74(_0x137aa3);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x5a')]=function(_0x13784b,_0x1dbb85){scripts[_0xb6d4('0x5a')](_0x13784b[_0xb6d4('0x55')],_0x13784b[_0xb6d4('0x5b')]||'en',0x1)[_0xb6d4('0x14')](function(_0x2a17ba){_0x1dbb85(null,_0x2a17ba);})[_0xb6d4('0x16')](function(_0x43249a){_0x1dbb85(_0x43249a);});};AGIVertices[_0xb6d4('0x12')]['restAPI']=function(_0x5bf819,_0x5b0a3b){var _0x375ed3={'uri':_0x5bf819[_0xb6d4('0x5c')],'method':_0x5bf819[_0xb6d4('0x5d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5bf819[_0xb6d4('0x5e')])===_0xb6d4('0x5f')&&parseInt(_0x5bf819[_0xb6d4('0x5e')])>=0x1?parseInt(_0x5bf819[_0xb6d4('0x5e')])*0x3e8:0x5*0x3e8};if(_[_0xb6d4('0x60')]([_0xb6d4('0x61'),'PUT'],_0x375ed3['method']['toUpperCase']())){try{_0x375ed3[_0xb6d4('0x62')]=_0x5bf819[_0xb6d4('0xc')]?JSON[_0xb6d4('0x63')](_0x5bf819[_0xb6d4('0xc')]):{};}catch(_0x4778d4){logger[_0xb6d4('0x2b')](_0xb6d4('0x64'),_0x4778d4);}}try{_0x375ed3['headers']=_0x5bf819[_0xb6d4('0xb')]?JSON[_0xb6d4('0x63')](_0x5bf819['rawHeaders']):{};}catch(_0x5ccd92){logger[_0xb6d4('0x2b')](_0xb6d4('0x65'),_0x5ccd92);}if(_0x5bf819[_0xb6d4('0x66')]){try{var _0x44de4f=require(_0x5bf819['computedVariables'])[_0xb6d4('0x67')](this,_0x375ed3);_0x375ed3[_0xb6d4('0x68')]=Mustache[_0xb6d4('0x69')](_0x5bf819[_0xb6d4('0x5c')],_0x44de4f,{},['$$','$$']);if(_0x375ed3[_0xb6d4('0x6a')]){_0x375ed3[_0xb6d4('0x6a')]=JSON[_0xb6d4('0x63')](Mustache['render'](JSON['stringify'](_0x375ed3[_0xb6d4('0x6a')]),_0x44de4f,{},['$$','$$']));}if(_0x375ed3[_0xb6d4('0x62')]){_0x375ed3[_0xb6d4('0x62')]=JSON[_0xb6d4('0x63')](Mustache[_0xb6d4('0x69')](JSON[_0xb6d4('0x6b')](_0x375ed3[_0xb6d4('0x62')]),_0x44de4f,{},['$$','$$']));}}catch(_0x3b2ded){logger[_0xb6d4('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3b2ded);}}rp(_0x375ed3)['then'](function(_0x5e3b94){var _0xc52c83={'statusCode':_0x5e3b94[_0xb6d4('0x6c')]||0xc8,'statusMessage':_0x5e3b94[_0xb6d4('0x6d')]||'OK','headers':_0x5e3b94[_0xb6d4('0x6a')]||{},'body':_0x5e3b94['body']||{}};_0x5b0a3b(null,_0xc52c83);})[_0xb6d4('0x16')](function(_0x1dd693){var _0x2f270b={'statusCode':_0x1dd693[_0xb6d4('0x6c')]||0x1f4,'statusMessage':_0x1dd693[_0xb6d4('0x6e')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1dd693['options'][_0xb6d4('0x6a')]||{},'body':_0x1dd693[_0xb6d4('0x6f')][_0xb6d4('0x62')]||{}};_0x5b0a3b(null,_0x2f270b);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x70')]=function(_0x5d79ee,_0x537fac){scripts[_0xb6d4('0x70')](this[_0xb6d4('0xf')][_0xb6d4('0x35')],_0x5d79ee[_0xb6d4('0x71')],_0x5d79ee[_0xb6d4('0x55')],_0x5d79ee[_0xb6d4('0x72')]||'en')[_0xb6d4('0x14')](function(_0x3f655e){_0x537fac(null,_0x3f655e);})[_0xb6d4('0x16')](function(_0x4d1fea){_0x537fac(_0x4d1fea);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x73')]=function(_0x170fc3,_0x5d81e8){scripts[_0xb6d4('0x73')](this[_0xb6d4('0xf')][_0xb6d4('0x35')],_0x170fc3[_0xb6d4('0x74')],_0x170fc3[_0xb6d4('0x75')],_0x170fc3[_0xb6d4('0x76')],_0x170fc3[_0xb6d4('0x55')],_0x170fc3['dialogflowV2_language']||'en')[_0xb6d4('0x14')](function(_0x4e328d){_0x5d81e8(null,_0x4e328d);})[_0xb6d4('0x16')](function(_0x17a01f){_0x5d81e8(_0x17a01f);});};AGIVertices['prototype']['sestekNDA']=function(_0x53b82b,_0xe6cad){scripts[_0xb6d4('0x77')](this['channel'],_0x53b82b)[_0xb6d4('0x14')](function(_0x111e10){_0xe6cad(null,_0x111e10);})[_0xb6d4('0x16')](function(_0x5c2f26){_0xe6cad(_0x5c2f26);});};AGIVertices['prototype'][_0xb6d4('0x78')]=function(_0x3ae3b3,_0x32f055){scripts[_0xb6d4('0x78')](_0x3ae3b3[_0xb6d4('0x71')],_0x3ae3b3[_0xb6d4('0x55')],_0x3ae3b3[_0xb6d4('0x79')]||_0xb6d4('0x57'),_0x3ae3b3[_0xb6d4('0x7a')])[_0xb6d4('0x14')](function(_0x4a0e13){_0x32f055(null,_0x4a0e13);})[_0xb6d4('0x16')](function(_0x167e89){_0x32f055(_0x167e89);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x7b')]=function(_0x5d93fa,_0x3f985a,_0x5d9025){scripts[_0xb6d4('0x7b')](_0x3f985a,_0x5d93fa[_0xb6d4('0x71')],_0x5d93fa['ispeech_asr_language']||_0xb6d4('0x57'),this['isConfigured'](_0x5d93fa[_0xb6d4('0x7c')])?_0x5d93fa[_0xb6d4('0x7c')]:undefined)[_0xb6d4('0x14')](function(_0x53f127){_0x5d9025(null,_0x53f127);})[_0xb6d4('0x16')](function(_0x2eaddf){_0x5d9025(_0x2eaddf);});};AGIVertices['prototype'][_0xb6d4('0x7d')]=function(_0x32ec42,_0xa6390){scripts['awsPolly'](_0x32ec42[_0xb6d4('0x7e')],_0x32ec42[_0xb6d4('0x7f')],_0x32ec42[_0xb6d4('0x80')],_0x32ec42['aws_polly_voice']||_0xb6d4('0x81'),_0x32ec42[_0xb6d4('0x55')],_0x32ec42[_0xb6d4('0x82')]||_0xb6d4('0x55'))[_0xb6d4('0x14')](function(_0x1f1701){_0xa6390(null,_0x1f1701);})[_0xb6d4('0x16')](function(_0x5822b3){_0xa6390(_0x5822b3);});};AGIVertices['prototype'][_0xb6d4('0x83')]=function(_0x54bd1b,_0x5ad67c){scripts['awsLex'](this[_0xb6d4('0xf')][_0xb6d4('0x35')],_0x54bd1b[_0xb6d4('0x7e')],_0x54bd1b[_0xb6d4('0x7f')],_0x54bd1b[_0xb6d4('0x84')],_0x54bd1b[_0xb6d4('0x55')],_0x54bd1b[_0xb6d4('0x85')])[_0xb6d4('0x14')](function(_0x5e3339){_0x5ad67c(null,_0x5e3339);})[_0xb6d4('0x16')](function(_0xb8ece1){_0x5ad67c(_0xb8ece1);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x86')]=function(_0x12a49e,_0x2fed04,_0x5d6275){scripts[_0xb6d4('0x86')](_0x2fed04,_0x12a49e[_0xb6d4('0x71')],_0x12a49e['google_asr_language']||_0xb6d4('0x57'))[_0xb6d4('0x14')](function(_0x557df3){_0x5d6275(null,_0x557df3);})['catch'](function(_0x9b163f){_0x5d6275(_0x9b163f);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x87')]=function(_0xcb63d4,_0x358a10,_0x45089f){scripts['tildeASR'](_0x358a10,_0xcb63d4[_0xb6d4('0x88')],_0xcb63d4['appsecret'],_0xcb63d4[_0xb6d4('0x68')])[_0xb6d4('0x14')](function(_0xa014ca){_0x45089f(null,_0xa014ca);})[_0xb6d4('0x16')](function(_0x2052ff){_0x45089f(_0x2052ff);});};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x89')]=function(_0x33a8a6){var _0x1249f0=_[_0xb6d4('0x60')](verticesWithRetry,_0x33a8a6[_0xb6d4('0x37')])?_0x33a8a6:_['clone'](_0x33a8a6);for(var _0x260809 in _0x1249f0){if(_0x1249f0[_0xb6d4('0x8a')](_0x260809)){if(_0x1249f0[_0x260809]&&_[_0xb6d4('0x8b')](_0x1249f0[_0x260809])){if(_['includes'](recursiveMapAttributes,_0x260809)){_0x1249f0[_0x260809]=this['replaceObjectAllVariables'](_0x1249f0[_0x260809]);}else{_0x1249f0[_0x260809]=this['replaceAllVariables'](_0x1249f0[_0x260809]);}}}}return _0x1249f0;};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x8c')]=function(_0x2fe8a2){for(var _0x5d7d61 in _0x2fe8a2){if(_0x2fe8a2[_0xb6d4('0x8a')](_0x5d7d61)){if(_[_0xb6d4('0x8d')](_0x2fe8a2[_0x5d7d61])){this['recursiveNodeIndex'](_0x2fe8a2[_0x5d7d61]);}else if(_[_0xb6d4('0x8e')](_0x2fe8a2[_0x5d7d61])){for(var _0x359f2e=0x0;_0x359f2e<_0x2fe8a2[_0x5d7d61][_0xb6d4('0x8f')];_0x359f2e++){this[_0xb6d4('0x8c')](_0x2fe8a2[_0x5d7d61][_0x359f2e]);}}else if(_[_0xb6d4('0x8b')](_0x2fe8a2[_0x5d7d61])){_0x2fe8a2[_0x5d7d61]=this['replaceAllVariables'](_0x2fe8a2[_0x5d7d61]);}}}};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x90')]=function(_0x3c066b,_0x513d22){for(var _0xae3bc0 in _0x3c066b){if(_0x3c066b[_0xb6d4('0x8a')](_0xae3bc0)){if(_[_0xb6d4('0x8d')](_0x3c066b[_0xae3bc0])){if(!_[_0xb6d4('0x42')](_0x3c066b[_0xae3bc0])){this[_0xb6d4('0x90')](_0x3c066b[_0xae3bc0],util[_0xb6d4('0x28')](_0xb6d4('0x91'),_0x513d22,_0xae3bc0));}}else if(_[_0xb6d4('0x8e')](_0x3c066b[_0xae3bc0])){for(var _0x1d207c=0x0;_0x1d207c<_0x3c066b[_0xae3bc0]['length'];_0x1d207c++){this[_0xb6d4('0x90')](_0x3c066b[_0xae3bc0][_0x1d207c],util[_0xb6d4('0x28')](_0xb6d4('0x91'),_0x513d22,_0xae3bc0+'['+_0x1d207c+']'));}}else{if(!_[_0xb6d4('0x43')](_0x3c066b[_0xae3bc0])){this[_0xb6d4('0xf')][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0x91'),_0x513d22,_0xae3bc0),_0x3c066b[_0xae3bc0]);}}}}};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x93')]=function(_0xaa1d6a){try{var _0x15ef73=JSON[_0xb6d4('0x63')](_0xaa1d6a);this[_0xb6d4('0x8c')](_0x15ef73);return JSON[_0xb6d4('0x6b')](_0x15ef73);}catch(_0x5f5647){return this[_0xb6d4('0x94')](_0xaa1d6a);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x106965){var _0x3e562f=_0x106965[_0xb6d4('0x95')]('{');for(var _0x52d28c=0x1;_0x52d28c<_0x3e562f[_0xb6d4('0x8f')];_0x52d28c+=0x1){var _0x124cee=_0x3e562f[_0x52d28c][_0xb6d4('0x95')]('}');if(_0x124cee[_0xb6d4('0x8f')]>0x1){_0x106965=_0x106965[_0xb6d4('0x96')]('{'+_0x124cee[0x0]+'}',this['channel'][_0xb6d4('0x13')](_0x124cee[0x0])[_0xb6d4('0x97')]||_0x124cee[0x0]);}}if(_0x3e562f[_0xb6d4('0x8f')]===0x1){return _0x106965[_0xb6d4('0x98')]();}return this[_0xb6d4('0x94')](_0x106965);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x99')]=function(_0x34c625,_0x3b8594){var _0x4ec583=this[_0xb6d4('0xf')][_0xb6d4('0x13')](_0x34c625);if(_0x4ec583[_0xb6d4('0x9a')]===-0x1){return _0x4ec583;}logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x9b'),_0x3b8594,_0x4ec583[_0xb6d4('0x97')]));return this[_0xb6d4('0xf')][_0xb6d4('0x92')](_0x3b8594,_0x4ec583[_0xb6d4('0x97')]);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x9c')]=function(_0x284f16){return _0x284f16&&_0x284f16!=='0'&&_0x284f16!=='-1'&&_0x284f16!=='';};AGIVertices[_0xb6d4('0x12')]['maxRetry']=function(_0x432239){this[_0xb6d4('0x34')]['sync'](this,_0x432239,'-');_0x432239[_0xb6d4('0x9d')]=_0x432239[_0xb6d4('0x9e')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x9f')]=function(_0x262dfe){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0xa0'),_0x262dfe[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x262dfe[_0xb6d4('0x55')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}var _0x435c13='\x22'+_0x262dfe[_0xb6d4('0x55')]+'\x22';if(this[_0xb6d4('0x9c')](_0x262dfe['options'])){_0x435c13+=','+_0x262dfe[_0xb6d4('0x6f')];}var _0x5e455d=this[_0xb6d4('0xf')][_0xb6d4('0xa3')](_0xb6d4('0xa4'),_0x435c13);if(_0x5e455d[_0xb6d4('0x9a')]===-0x1){return _0x5e455d;}return this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0xa5'),_0x435c13));};AGIVertices['prototype'][_0xb6d4('0xa6')]=function(_0x2ac134){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2ac134[_0xb6d4('0x36')]));if(!this['isConfigured'](_0x2ac134['grammar'])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa7'));}var _0x2a612e=_0x2ac134[_0xb6d4('0xa8')];if(this[_0xb6d4('0x9c')](_0x2ac134[_0xb6d4('0x6f')])){_0x2a612e+=','+_0x2ac134[_0xb6d4('0x6f')];}var _0x519582=this[_0xb6d4('0xf')]['exec'](_0xb6d4('0xa9'),_0x2a612e);if(_0x519582['result']===-0x1){return _0x519582;}var _0x2c9b09=this[_0xb6d4('0x99')](_0xb6d4('0xaa'),_0xb6d4('0xab'));if(_0x2c9b09['result']===-0x1){return _0x2c9b09;}var _0x38f843=this['getAndSetVariable']('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x38f843[_0xb6d4('0x9a')]===-0x1){return _0x38f843;}var _0x1cc6d7=this['getAndSetVariable'](_0xb6d4('0xac'),_0xb6d4('0xad'));if(_0x1cc6d7[_0xb6d4('0x9a')]===-0x1){return _0x1cc6d7;}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2a612e));};AGIVertices['prototype'][_0xb6d4('0x7')]=function(_0xc36eb5){logger['info'](util[_0xb6d4('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0xc36eb5['label']));return this[_0xb6d4('0xf')][_0xb6d4('0x7')]([_0xc36eb5['command'],_0xc36eb5['args']]);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xae')]=function(_0x5b6ff6){logger[_0xb6d4('0x2d')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5b6ff6[_0xb6d4('0x36')]));if(this[_0xb6d4('0x9c')](_0x5b6ff6[_0xb6d4('0x5e')])){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0xaf'),_0x5b6ff6[_0xb6d4('0x5e')]));var _0xe13037=this[_0xb6d4('0xf')]['wait'](_0x5b6ff6[_0xb6d4('0x5e')]);if(_0xe13037[_0xb6d4('0x9a')]===-0x1){return _0xe13037;}}return this[_0xb6d4('0xf')]['answer']();};AGIVertices['prototype']['callback']=function(_0x36e330){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x36e330[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x36e330[_0xb6d4('0xb0')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x36e330,_0xb6d4('0xb1'));}_0x36e330['scheduledAt']=moment();if(this['isConfigured'](_0x36e330[_0xb6d4('0xb2')])){_0x36e330['scheduledAt']=moment()[_0xb6d4('0xb3')](_0x36e330[_0xb6d4('0xb2')],_0xb6d4('0xb4'));}if(!this[_0xb6d4('0x9c')](_0x36e330[_0xb6d4('0xb5')])){_0x36e330[_0xb6d4('0xb5')]=0x2;}this[_0xb6d4('0x41')][_0xb6d4('0x67')](this,_0x36e330);return this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0xb6'),_0x36e330[_0xb6d4('0x45')],_0x36e330[_0xb6d4('0xb0')],_0x36e330[_0xb6d4('0x46')]));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xb7')]=function(_0x3a8157){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0xb8'),_0x3a8157[_0xb6d4('0x36')]));var _0x476d74=this['channel'][_0xb6d4('0xa3')](_0x3a8157[_0xb6d4('0xb9')],_0x3a8157[_0xb6d4('0x6f')]);if(_0x476d74[_0xb6d4('0x9a')]===-0x1){return _0x476d74;}return this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')]('Executed\x20command\x20%s\x20%s',_0x3a8157[_0xb6d4('0xb9')],_0x3a8157[_0xb6d4('0x6f')]));};AGIVertices[_0xb6d4('0x12')]['lumenvoxtts']=function(_0x489ca6){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0xba'),_0x489ca6[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x489ca6[_0xb6d4('0x55')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}var _0x4187d0='\x22'+_0x489ca6['text']+'\x22';if(this[_0xb6d4('0x9c')](_0x489ca6[_0xb6d4('0x6f')])){_0x4187d0+=','+_0x489ca6[_0xb6d4('0x6f')];}var _0x343be6=this[_0xb6d4('0xf')][_0xb6d4('0xa3')]('MRCPSynth',_0x4187d0);if(_0x343be6[_0xb6d4('0x9a')]===-0x1){return _0x343be6;}return this['channel'][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0xa5'),_0x4187d0));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xbb')]=function(_0x25c0df){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0xbc'),_0x25c0df[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x25c0df['text'])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}var _0x102639='\x22'+_0x25c0df[_0xb6d4('0x55')]+'\x22';if(this[_0xb6d4('0x9c')](_0x25c0df[_0xb6d4('0x6f')])){_0x102639+=','+_0x25c0df[_0xb6d4('0x6f')];}var _0x658f6a=this['channel']['exec'](_0xb6d4('0xa4'),_0x102639);if(_0x658f6a[_0xb6d4('0x9a')]===-0x1){return _0x658f6a;}return this['channel']['noop'](util[_0xb6d4('0x28')](_0xb6d4('0xa5'),_0x102639));};AGIVertices['prototype'][_0xb6d4('0xbd')]=function(_0x4efdd4){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0xbe'),_0x4efdd4['label']));if(!this[_0xb6d4('0x9c')](_0x4efdd4['grammar'])){return this['channel'][_0xb6d4('0xa1')](_0xb6d4('0xa7'));}var _0x2a5b11=_0x4efdd4[_0xb6d4('0xa8')];if(this['isConfigured'](_0x4efdd4['options'])){_0x2a5b11+=','+_0x4efdd4[_0xb6d4('0x6f')];}var _0x784b21=this[_0xb6d4('0xf')][_0xb6d4('0xa3')]('MRCPRecog',_0x2a5b11);if(_0x784b21[_0xb6d4('0x9a')]===-0x1){return _0x784b21;}var _0x4260a9=this[_0xb6d4('0x99')](_0xb6d4('0xaa'),'LUMENVOX_ASR_CONFIDENCE');if(_0x4260a9['result']===-0x1){return _0x4260a9;}var _0x32abcb=this['getAndSetVariable'](_0xb6d4('0xbf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x32abcb['result']===-0x1){return _0x32abcb;}var _0x405958=this[_0xb6d4('0x99')](_0xb6d4('0xac'),_0xb6d4('0xc0'));if(_0x405958[_0xb6d4('0x9a')]===-0x1){return _0x405958;}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0xc1'),_0x2a5b11));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xc2')]=function(_0x1988ba){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0xc3'),_0x1988ba[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x1988ba[_0xb6d4('0xa8')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')]('no\x20grammar\x20configured');}var _0x4844e9=_0x1988ba['grammar'];if(this[_0xb6d4('0x9c')](_0x1988ba[_0xb6d4('0x6f')])){_0x4844e9+=','+_0x1988ba[_0xb6d4('0x6f')];}var _0x3cb7e6=this[_0xb6d4('0xf')]['exec'](_0xb6d4('0xa9'),_0x4844e9);if(_0x3cb7e6[_0xb6d4('0x9a')]===-0x1){return _0x3cb7e6;}var _0x31c172=this['getAndSetVariable'](_0xb6d4('0xaa'),'SESTEK_ASR_CONFIDENCE');if(_0x31c172['result']===-0x1){return _0x31c172;}var _0x58cefe=this[_0xb6d4('0x99')](_0xb6d4('0xbf'),_0xb6d4('0xc4'));if(_0x58cefe[_0xb6d4('0x9a')]===-0x1){return _0x58cefe;}var _0xbe0de0=this['getAndSetVariable'](_0xb6d4('0xac'),_0xb6d4('0xc5'));if(_0xbe0de0[_0xb6d4('0x9a')]===-0x1){return _0xbe0de0;}return this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0xc1'),_0x4844e9));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xc6')]=function(_0x372590){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0xc7'),_0x372590['label']));if(!this[_0xb6d4('0x9c')](_0x372590[_0xb6d4('0xc8')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x372590,_0xb6d4('0xc9'));}var _0x7d9f04=this['getSquareOdbc'][_0xb6d4('0x67')](this,_0x372590['odbc_id']);if(!_0x7d9f04){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x372590,'no\x20odbc\x20database\x20found');}if(!this[_0xb6d4('0x9c')](_0x372590[_0xb6d4('0xca')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x372590,_0xb6d4('0xcb'));}var _0x339c88=_0x372590[_0xb6d4('0xca')][_0xb6d4('0xcc')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0xcd'),_0x339c88));var _0x4efd76=this['getQueryOdbc'][_0xb6d4('0x67')](this,_0x7d9f04,_0x339c88);this[_0xb6d4('0x34')][_0xb6d4('0x67')](this,_0x372590,_0x339c88);if(!this['isConfigured'](_0x372590[_0xb6d4('0xce')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xeb1c5c=this['getVariable'][_0xb6d4('0x67')](this,_0x372590[_0xb6d4('0xce')]);if(!_0xeb1c5c){return this['channel'][_0xb6d4('0x2b')](_0x372590,_0xb6d4('0xcf'));}var _0x31beb3=this;_0x4efd76[_0xb6d4('0xd0')](function(_0x5cb75f,_0x1ea962){Object[_0xb6d4('0xd1')](_0x5cb75f)['forEach'](function(_0x1c9c82){_0x31beb3[_0xb6d4('0xf')][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0xd2'),_0xeb1c5c,_0x1ea962,_0x1c9c82),_0x5cb75f[_0x1c9c82]);});});this[_0xb6d4('0xf')]['setVariable'](util['format']('%s_ROWS_COUNT',_0xeb1c5c),_0x4efd76[_0xb6d4('0x8f')]);return this['channel'][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('variable\x20%s\x20set',_0xeb1c5c));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xd3')]=function(_0x38fcd4){logger[_0xb6d4('0xd4')](util[_0xb6d4('0x28')](_0xb6d4('0xd5'),_0x38fcd4[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x38fcd4[_0xb6d4('0xd6')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x38fcd4,_0xb6d4('0xd7'));}var _0xc6b6d5=this['getUser'][_0xb6d4('0x67')](this,_0x38fcd4['sip_id']);if(!_0xc6b6d5){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x38fcd4,'no\x20user\x20found');}var _0x1ac157=this[_0xb6d4('0xf')]['exec'](_0xb6d4('0xd8'),[util[_0xb6d4('0x28')](_0xb6d4('0xd9'),_0xc6b6d5),_0x38fcd4['timeout'],_0x38fcd4[_0xb6d4('0xda')],_0x38fcd4[_0xb6d4('0x5c')]]);if(_0x1ac157[_0xb6d4('0x9a')]===-0x1){return _0x1ac157;}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xdb')]=function(_0x1f1124){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0xdc'),_0x1f1124['label']));if(!this[_0xb6d4('0x9c')](_0x1f1124[_0xb6d4('0x71')])){return this['channel'][_0xb6d4('0xa1')](_0xb6d4('0xdd'));}if(!this['isConfigured'](_0x1f1124[_0xb6d4('0x55')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')]('no\x20text\x20configured');}this['channel'][_0xb6d4('0xde')]=!![];this[_0xb6d4('0x34')](_0x1f1124);this[_0xb6d4('0x40')](_0x1f1124['text'],'in','','');this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0xdf'),_0x1f1124[_0xb6d4('0x55')]));var _0x239f0b=this[_0xb6d4('0x70')][_0xb6d4('0x67')](this,_0x1f1124);if(_0x239f0b){for(var _0x16cee6 in _0x239f0b){if(_0x239f0b[_0xb6d4('0x8a')](_0x16cee6)){this[_0xb6d4('0xf')][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0xe0'),_0x16cee6[_0xb6d4('0xe1')]()),_0x239f0b[_0x16cee6]);}}this['createSquareMessage'](_0x239f0b[_0xb6d4('0xe2')],_0xb6d4('0xe3'),_0xb6d4('0xdb'),'');return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('Dialogflow\x20Result\x20%s',_0x239f0b[_0xb6d4('0xe2')]));}return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x1f1124,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xe4')]=function(_0x3e7674){logger['info'](util['format'](_0xb6d4('0xe5'),_0x3e7674[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x3e7674['dialogflowV2_project_id'])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xe6'));}if(!this[_0xb6d4('0x9c')](_0x3e7674[_0xb6d4('0x75')])){return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0xe7'));}if(!this[_0xb6d4('0x9c')](_0x3e7674[_0xb6d4('0x76')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xe8'));}if(!this[_0xb6d4('0x9c')](_0x3e7674[_0xb6d4('0xe9')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xea'));}if(!this[_0xb6d4('0x9c')](_0x3e7674[_0xb6d4('0x55')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}this[_0xb6d4('0xf')]['bot']=!![];this[_0xb6d4('0x34')](_0x3e7674);this[_0xb6d4('0x40')](_0x3e7674[_0xb6d4('0x55')],'in','','');this['channel'][_0xb6d4('0xa1')](util['format'](_0xb6d4('0xeb'),_0x3e7674['text']));var _0x47dab5=this['googleDialogflowV2'][_0xb6d4('0x67')](this,_0x3e7674);if(_0x47dab5){for(var _0x56f6c2 in _0x47dab5){if(_0x47dab5[_0xb6d4('0x8a')](_0x56f6c2)){if(_0x56f6c2!==_0xb6d4('0xec')){this[_0xb6d4('0xf')]['setVariable'](util[_0xb6d4('0x28')](_0xb6d4('0xe0'),_0x56f6c2[_0xb6d4('0xe1')]()),_0x47dab5[_0x56f6c2]);}}}this[_0xb6d4('0x40')](_0x47dab5[_0xb6d4('0xe2')],_0xb6d4('0xe3'),_0xb6d4('0xe4'),_0x47dab5[_0xb6d4('0xec')]);return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0xed'),_0x47dab5['speech']));}return this[_0xb6d4('0xf')]['error'](_0x3e7674,_0xb6d4('0xee'));};AGIVertices['prototype'][_0xb6d4('0xef')]=function(_0x55b2f0){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x55b2f0[_0xb6d4('0x36')]));if(!this['isConfigured'](_0x55b2f0[_0xb6d4('0xf0')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xf1'));}if(!this[_0xb6d4('0x9c')](_0x55b2f0['username'])){return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0xf2'));}if(!this['isConfigured'](_0x55b2f0[_0xb6d4('0xf3')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xf4'));}if(!this['isConfigured'](_0x55b2f0['ndassistant_url'])){return this['channel'][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}this[_0xb6d4('0xf')][_0xb6d4('0xde')]=!![];this['createSquareDetailsReport'](_0x55b2f0);this[_0xb6d4('0x40')](_0x55b2f0[_0xb6d4('0x55')],'in','','');this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0xf5'),_0x55b2f0['text']));var _0x515fe2=this[_0xb6d4('0x77')][_0xb6d4('0x67')](this,_0x55b2f0);if(_0x515fe2){for(var _0x5e70a5 in _0x515fe2){if(_0x515fe2[_0xb6d4('0x8a')](_0x5e70a5)){this['channel'][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0xf6'),_0x5e70a5['toUpperCase']()),_0x515fe2[_0x5e70a5]);}}this['createSquareMessage'](_0x515fe2['speech'],_0xb6d4('0xe3'),_0xb6d4('0xef'),'');if(_0x515fe2['audiofile']){this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0xf7'),_0x515fe2[_0xb6d4('0xf8')]));var _0x396f57=this[_0xb6d4('0xf')][_0xb6d4('0xf9')](_0x515fe2['audiofile']);try{fs[_0xb6d4('0xfa')](_0x515fe2[_0xb6d4('0xf8')]+_0xb6d4('0xfb'));}catch(_0x5746e7){logger[_0xb6d4('0x2b')](_0x5746e7);}return _0x396f57;}else{return this['channel']['noop'](util[_0xb6d4('0x28')](_0xb6d4('0xfc'),_0x515fe2['speech']));}}return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x55b2f0,_0xb6d4('0xfd'));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xfe')]=function(_0x1e30c9){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0xff'),_0x1e30c9[_0xb6d4('0x36')]));return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xfe'));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x100')]=function(_0x103d7d){logger[_0xb6d4('0x2d')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x103d7d[_0xb6d4('0x36')]));var _0x1c7468='';if(_0x103d7d[_0xb6d4('0x101')]){if(!this[_0xb6d4('0x9c')](_0x103d7d[_0xb6d4('0x101')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x103d7d,'no\x20trunk\x20selected');}else{var _0x57d73e=parseInt(_0x103d7d['trunk_id'],0xa);if(isNaN(_0x57d73e)){_0x1c7468=_0x103d7d['trunk_id'];}else{_0x1c7468=this[_0xb6d4('0x1e')][_0xb6d4('0x67')](this,_0x103d7d[_0xb6d4('0x101')]);if(!_0x1c7468){return this[_0xb6d4('0xf')]['error'](_0x103d7d,_0xb6d4('0x102'));}}}}else if(_0x103d7d['trunk_name']){_0x1c7468=_0x103d7d[_0xb6d4('0x103')];}else{return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x103d7d,_0xb6d4('0x104'));}var _0x21ebf9=this[_0xb6d4('0xf')][_0xb6d4('0xa3')]('DIAL',[util[_0xb6d4('0x28')](_0xb6d4('0x105'),_0x1c7468,_0x103d7d['phone']),_0x103d7d[_0xb6d4('0x5e')],_0x103d7d['opts'],_0x103d7d[_0xb6d4('0x5c')]]);if(_0x21ebf9[_0xb6d4('0x9a')]===-0x1){return _0x21ebf9;}return this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0x106'),_0xb6d4('0xd8')));};AGIVertices['prototype']['finally']=function(_0x55013b){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x107'),_0x55013b['label']));return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0x108'));};AGIVertices[_0xb6d4('0x12')]['getdigits']=function(_0x2647d3){logger['info'](util['format'](_0xb6d4('0x109'),_0x2647d3[_0xb6d4('0x36')]));if(_0x2647d3[_0xb6d4('0x9d')]===0x0){return this[_0xb6d4('0x9e')](_0x2647d3);}_0x2647d3[_0xb6d4('0x9d')]-=0x1;if(!this[_0xb6d4('0x9c')](_0x2647d3[_0xb6d4('0x10a')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x2647d3,'no\x20file\x20audio\x20selected');}var _0x2da671=this[_0xb6d4('0x20')][_0xb6d4('0x67')](this,_0x2647d3[_0xb6d4('0x10a')]);if(!_0x2da671){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x2647d3,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x2647d3['variable_id'])){return this['channel'][_0xb6d4('0x2b')](_0xb6d4('0x10b'));}var _0x45fe51=this[_0xb6d4('0xf')][_0xb6d4('0x10c')](_0x2da671,_0x2647d3[_0xb6d4('0x10d')],_0x2647d3[_0xb6d4('0x10e')]);var _0x1ad653=_0x45fe51[_0xb6d4('0x9a')]?_0x45fe51['result'][_0xb6d4('0x98')]():'';logger['info'](_0xb6d4('0x10f'),JSON[_0xb6d4('0x6b')](_0x45fe51));if(_0x45fe51[_0xb6d4('0x9a')]===-0x1){this[_0xb6d4('0x34')][_0xb6d4('0x67')](this,_0x2647d3,_0x1ad653);return _0x45fe51;}else if(_0x45fe51[_0xb6d4('0x97')]===_0xb6d4('0x5e')){_0x45fe51[_0xb6d4('0x9a')]=_0x1ad653[_0xb6d4('0x8f')]>=parseInt(_0x2647d3[_0xb6d4('0x110')])?'x':'i';}else{_0x45fe51[_0xb6d4('0x9a')]=_0x1ad653['length']>=parseInt(_0x2647d3['mindigit'])&&_0x1ad653['length']<=parseInt(_0x2647d3[_0xb6d4('0x10e')])?'x':'i';}var _0x573851=this[_0xb6d4('0x13')][_0xb6d4('0x67')](this,_0x2647d3[_0xb6d4('0xce')]);if(!_0x573851){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x2647d3,_0xb6d4('0xcf'));}this[_0xb6d4('0xf')][_0xb6d4('0x92')](_0x573851,_0x1ad653);if(this[_0xb6d4('0x9c')](_0x2647d3[_0xb6d4('0x111')])){var _0x28b0e1=parseInt(_0x2647d3[_0xb6d4('0x111')],0xa);var _0x1f5f3b=rs['generate']({'charset':'*','length':_0x28b0e1});var _0x387d67=_0x1ad653[_0xb6d4('0x8f')];if(_0x387d67>0x0){if(_0x387d67>_0x28b0e1){this[_0xb6d4('0x34')]['sync'](this,_0x2647d3,_0x2647d3[_0xb6d4('0x112')]===_0xb6d4('0x113')?_0x1f5f3b+_0x1ad653[_0xb6d4('0x114')](_0x28b0e1):_0x1ad653['substr'](0x0,_0x387d67-_0x28b0e1)+_0x1f5f3b);}else{this[_0xb6d4('0x34')][_0xb6d4('0x67')](this,_0x2647d3,rs[_0xb6d4('0x115')]({'charset':'*','length':_0x387d67}));}}else{this['createSquareDetailsReport'][_0xb6d4('0x67')](this,_0x2647d3,'');}}else{this['createSquareDetailsReport'][_0xb6d4('0x67')](this,_0x2647d3,_0x1ad653);}return _0x45fe51;};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0xe')]=function(_0x3d1489){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x116'),_0x3d1489[_0xb6d4('0x36')]));return this[_0xb6d4('0xd')](_0x3d1489);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x117')]=function(_0x43d9c9){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x118'),_0x43d9c9[_0xb6d4('0x36')]));this['createSquareDetailsReport'][_0xb6d4('0x67')](this,_0x43d9c9,_0x43d9c9[_0xb6d4('0x119')]);return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x11a'),_0x43d9c9['goalname']));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x11b')]=function(_0x20d783){logger[_0xb6d4('0x2d')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x20d783['label']));if(!this[_0xb6d4('0x9c')](_0x20d783[_0xb6d4('0x7e')])||!this[_0xb6d4('0x9c')](_0x20d783[_0xb6d4('0x7f')])){return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0x11c'));}if(!this[_0xb6d4('0x9c')](_0x20d783['text'])){return this[_0xb6d4('0xf')]['noop']('no\x20text\x20configured');}this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util['format'](_0xb6d4('0x11d'),_0x20d783[_0xb6d4('0x55')]));var _0x3f2061=this[_0xb6d4('0x7d')][_0xb6d4('0x67')](this,_0x20d783);if(_0x3f2061){this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x3f2061));var _0x53a26d=this[_0xb6d4('0xf')]['streamFile'](_0x3f2061);try{fs[_0xb6d4('0xfa')](_0x3f2061+_0xb6d4('0xfb'));}catch(_0x347b7a){logger[_0xb6d4('0x2b')](_0x347b7a);}return _0x53a26d;}return this['channel'][_0xb6d4('0x2b')](_0x20d783,_0xb6d4('0x11e'));};AGIVertices['prototype'][_0xb6d4('0x11f')]=function(_0x568ef0){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x120'),_0x568ef0[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x568ef0['aws_access_key_id'])||!this[_0xb6d4('0x9c')](_0x568ef0[_0xb6d4('0x7f')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xb6d4('0x9c')](_0x568ef0[_0xb6d4('0x85')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0x121'));}if(!this['isConfigured'](_0x568ef0['text'])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}this[_0xb6d4('0xf')][_0xb6d4('0xde')]=!![];this['createSquareDetailsReport'](_0x568ef0);this[_0xb6d4('0x40')](_0x568ef0['text'],'in','','');this['channel'][_0xb6d4('0xa1')](util['format'](_0xb6d4('0x122'),_0x568ef0[_0xb6d4('0x55')]));var _0x4ffde0=this[_0xb6d4('0x83')][_0xb6d4('0x67')](this,_0x568ef0);if(_0x4ffde0){for(var _0x3938c2 in _0x4ffde0){if(_0x4ffde0[_0xb6d4('0x8a')](_0x3938c2)&&_[_0xb6d4('0x8b')](_0x4ffde0[_0x3938c2])){this[_0xb6d4('0xf')][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0x123'),_0x3938c2['toUpperCase']()),_0x4ffde0[_0x3938c2]);}}if(_[_0xb6d4('0x43')](_0x4ffde0[_0xb6d4('0x6e')])){return this['channel'][_0xb6d4('0xa1')](_0xb6d4('0x124'));}else{this['createSquareMessage'](_0x4ffde0[_0xb6d4('0x6e')],_0xb6d4('0xe3'),_0xb6d4('0x125'),'');return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x126'),_0x4ffde0[_0xb6d4('0x6e')]));}}return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x568ef0,_0xb6d4('0x127'));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x128')]=function(_0x1bb79e){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x129'),_0x1bb79e[_0xb6d4('0x36')],_0x1bb79e[_0xb6d4('0x5e')]));if(!this[_0xb6d4('0x9c')](_0x1bb79e[_0xb6d4('0x71')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xdd'));}var _0x2e810a=_0xb6d4('0x12a');var _0x577fd3=util[_0xb6d4('0x28')](_0xb6d4('0x12b'),FILES_PATH,rs[_0xb6d4('0x115')](0x4));var _0x49ffa9=util[_0xb6d4('0x28')](_0xb6d4('0x91'),_0x577fd3,_0x2e810a);var _0x477233=!![];if(_0x1bb79e['beep']===_0xb6d4('0x12c')){_0x477233=![];}var _0x568c62=this[_0xb6d4('0xf')][_0xb6d4('0x12d')](_0x577fd3,_0x2e810a,_0x1bb79e['intKey'],_0x1bb79e[_0xb6d4('0x5e')],undefined,_0x477233);if(_0x568c62[_0xb6d4('0x9a')]!==-0x1){this[_0xb6d4('0xf')]['noop'](util['format'](_0xb6d4('0x12e'),_0x49ffa9));var _0x466011=this[_0xb6d4('0x86')][_0xb6d4('0x67')](this,_0x1bb79e,_0x49ffa9);if(_0x466011){for(var _0xf87272 in _0x466011){if(_0x466011[_0xb6d4('0x8a')](_0xf87272)){this[_0xb6d4('0xf')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0xf87272[_0xb6d4('0xe1')]()),_0x466011[_0xf87272]);}}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x12f'),JSON[_0xb6d4('0x6b')](_0x466011)));}}return _0x568c62;};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x130')]=function(_0x2f3502){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x131'),_0x2f3502[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x2f3502['appid'])){return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0x132'));}if(!this['isConfigured'](_0x2f3502[_0xb6d4('0x133')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0x134'));}var _0x210853=_0xb6d4('0x12a');var _0xc9c381=util[_0xb6d4('0x28')](_0xb6d4('0x12b'),FILES_PATH,rs[_0xb6d4('0x115')](0x4));var _0x4096a1=util[_0xb6d4('0x28')]('%s.%s',_0xc9c381,_0x210853);var _0x18739e=!![];if(_0x2f3502[_0xb6d4('0x135')]===_0xb6d4('0x12c')){_0x18739e=![];}var _0xa03368=this[_0xb6d4('0xf')]['recordFile'](_0xc9c381,_0x210853,_0x2f3502['intKey'],_0x2f3502[_0xb6d4('0x5e')],undefined,_0x18739e);if(_0xa03368[_0xb6d4('0x9a')]!==-0x1){this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x136'),_0x4096a1));var _0x18e8ad=this[_0xb6d4('0x87')]['sync'](this,_0x2f3502,_0x4096a1);if(_0x18e8ad){for(var _0x560f0 in _0x18e8ad){if(_0x18e8ad[_0xb6d4('0x8a')](_0x560f0)){this[_0xb6d4('0xf')][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0x137'),_0x560f0[_0xb6d4('0xe1')]()),_0x18e8ad[_0x560f0]);}}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('TildeASR\x20Result\x20%s',JSON[_0xb6d4('0x6b')](_0x18e8ad)));}}return _0xa03368;};AGIVertices[_0xb6d4('0x12')]['gotoc']=function(_0x15fc29){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x138'),_0x15fc29[_0xb6d4('0x36')]));return this[_0xb6d4('0xf')][_0xb6d4('0x139')](_0x15fc29['context'],_0x15fc29[_0xb6d4('0x13a')],_0x15fc29[_0xb6d4('0x13b')]);};AGIVertices['prototype'][_0xb6d4('0x13c')]=function(_0x5ad239){logger[_0xb6d4('0x2d')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5ad239[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x5ad239[_0xb6d4('0x13d')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x5ad239,_0xb6d4('0x13e'));}try{var _0x5e5ff7=eval(_0x5ad239['condition'])?'true':_0xb6d4('0x13f');this['channel'][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x140'),_0x5ad239[_0xb6d4('0x13d')],_0x5e5ff7));return{'code':0xc8,'result':_0x5e5ff7};}catch(_0x31add1){return{'code':0xc8,'result':_0xb6d4('0x13f')};}};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x141')]=function(_0x119baf){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x142'),_0x119baf['label']));if(!this['isConfigured'](_0x119baf[_0xb6d4('0x143')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x119baf,_0xb6d4('0x144'));}var _0x2161bb=this['getIntervals'][_0xb6d4('0x67')](this,_0x119baf[_0xb6d4('0x143')]);if(!_0x2161bb){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x119baf,_0xb6d4('0x145'));}for(var _0x2f8376=0x0;_0x2f8376<_0x2161bb[_0xb6d4('0x8f')];_0x2f8376+=0x1){var _0x39cb1d=this['channel']['getVariable'](util[_0xb6d4('0x28')](_0xb6d4('0x146'),_0x2161bb[_0x2f8376]));if(_0x39cb1d[_0xb6d4('0x9a')]===-0x1){return _0x39cb1d;}logger[_0xb6d4('0x2d')](util['format']('IFTIME\x20%s\x20%s',_0x2161bb[_0x2f8376],_0x39cb1d[_0xb6d4('0x97')]));if(_0x39cb1d['extra']===_0xb6d4('0x147')){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x148'),_0x2161bb[_0x2f8376],'true'));this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util['format']('IFTIME\x20%s\x20%s',_0x2161bb[_0x2f8376],'true'));return{'code':0xc8,'result':_0xb6d4('0x147')};}else{logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('IFTIME\x20%s\x20%s',_0x2161bb[_0x2f8376],_0xb6d4('0x13f')));this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x148'),_0x2161bb[_0x2f8376],_0xb6d4('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xb6d4('0x149')]=function(_0x25dc04){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x14a'),_0x25dc04[_0xb6d4('0x36')]));return this['channel'][_0xb6d4('0x149')]();};AGIVertices[_0xb6d4('0x12')]['ispeechasr']=function(_0x150fe1){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x150fe1[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x150fe1['key'])){return this['channel'][_0xb6d4('0xa1')](_0xb6d4('0xdd'));}var _0x57d626=_0xb6d4('0x12a');var _0x39a011=util['format'](_0xb6d4('0x12b'),FILES_PATH,rs[_0xb6d4('0x115')](0x4));var _0x83fcad=util[_0xb6d4('0x28')](_0xb6d4('0x91'),_0x39a011,_0x57d626);var _0x14bdfe=!![];if(_0x150fe1[_0xb6d4('0x135')]===_0xb6d4('0x12c')){_0x14bdfe=![];}var _0x2a6118=this[_0xb6d4('0xf')][_0xb6d4('0x12d')](_0x39a011,_0x57d626,_0x150fe1['intKey'],_0x150fe1[_0xb6d4('0x5e')],undefined,_0x14bdfe);if(_0x2a6118[_0xb6d4('0x9a')]!==-0x1){this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x14b'),_0x83fcad));var _0x3f5ce5=this[_0xb6d4('0x7b')][_0xb6d4('0x67')](this,_0x150fe1,_0x83fcad);if(_0x3f5ce5){for(var _0x574386 in _0x3f5ce5){if(_0x3f5ce5[_0xb6d4('0x8a')](_0x574386)){this[_0xb6d4('0xf')][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0x14c'),_0x574386[_0xb6d4('0xe1')]()),_0x3f5ce5[_0x574386]);}}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util['format'](_0xb6d4('0x14d'),JSON[_0xb6d4('0x6b')](_0x3f5ce5)));}}return _0x2a6118;};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x14e')]=function(_0x1a4109){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1a4109['label']));if(!this[_0xb6d4('0x9c')](_0x1a4109['key'])){return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0xdd'));}if(!this['isConfigured'](_0x1a4109[_0xb6d4('0x55')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}this['channel'][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x14f'),_0x1a4109[_0xb6d4('0x55')]));var _0x309ad4=this[_0xb6d4('0x78')]['sync'](this,_0x1a4109);if(_0x309ad4){this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x14b'),_0x309ad4));var _0x38abdd=this[_0xb6d4('0xf')][_0xb6d4('0xf9')](_0x309ad4,_0x1a4109[_0xb6d4('0x150')]);try{fs['unlink'](_0x309ad4+_0xb6d4('0xfb'));}catch(_0x34e84e){logger[_0xb6d4('0x2b')](_0x34e84e);}return _0x38abdd;}return this['channel'][_0xb6d4('0x2b')](_0x1a4109,_0xb6d4('0x151'));};AGIVertices['prototype']['login']=function(_0x5957a9){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x152'),_0x5957a9[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x5957a9['findBy'])){return this[_0xb6d4('0xf')]['error'](_0x5957a9,_0xb6d4('0x153'));}logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x154'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x5957a9[_0xb6d4('0x155')]));var _0x21d47a=this[_0xb6d4('0x4e')]['sync'](this,_0x5957a9[_0xb6d4('0x155')]);if(_0x21d47a){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x156'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x5957a9[_0xb6d4('0x155')]));this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util['format'](_0xb6d4('0x156'),this['channel'][_0xb6d4('0x3a')],_0x5957a9[_0xb6d4('0x155')]));return{'code':0xc8,'result':_0xb6d4('0x157')};}else{logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x158'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x5957a9['findBy']));this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x158'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x5957a9['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x159')]=function(_0x13efd1){logger[_0xb6d4('0x2d')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x13efd1[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x13efd1[_0xb6d4('0x155')])){return this['channel'][_0xb6d4('0x2b')](_0x13efd1,_0xb6d4('0x153'));}logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x13efd1[_0xb6d4('0x155')]));var _0x4530c3=this[_0xb6d4('0x4d')][_0xb6d4('0x67')](this,_0x13efd1[_0xb6d4('0x155')]);if(_0x4530c3){logger['info'](util['format'](_0xb6d4('0x156'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x13efd1[_0xb6d4('0x155')]));this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0x156'),this[_0xb6d4('0xf')]['callerid'],_0x13efd1[_0xb6d4('0x155')]));return{'code':0xc8,'result':_0xb6d4('0x157')};}else{logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x158'),this[_0xb6d4('0xf')]['callerid'],_0x13efd1[_0xb6d4('0x155')]));this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0x158'),this['channel'][_0xb6d4('0x3a')],_0x13efd1['findBy']));return{'code':0xc8,'result':_0xb6d4('0x15a')};}};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x15b')]=function(_0xfa4304){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x15c'),_0xfa4304['label']));if(!this[_0xb6d4('0x9c')](_0xfa4304[_0xb6d4('0x15d')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0xfa4304,'no\x20operation\x20configured');}this['channel'][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x15e'),_0xfa4304[_0xb6d4('0x15d')]));var _0xc3439=eval(_0xfa4304['operation']);if(!this[_0xb6d4('0x9c')](_0xfa4304[_0xb6d4('0xce')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1b7d1e=this[_0xb6d4('0x13')][_0xb6d4('0x67')](this,_0xfa4304[_0xb6d4('0xce')]);if(!_0x1b7d1e){return this['channel'][_0xb6d4('0x2b')](_0xfa4304,_0xb6d4('0xcf'));}if(_[_0xb6d4('0x8e')](_0xc3439)){var _0x410632=this;_0xc3439[_0xb6d4('0xd0')](function(_0x355352,_0x218a0f){_0x410632['channel'][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0x15f'),_0x1b7d1e,_0x218a0f),_0x355352);});return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x160'),_0x1b7d1e));}else{return this[_0xb6d4('0xf')]['setVariable'](_0x1b7d1e,_0xc3439);}};AGIVertices[_0xb6d4('0x12')]['menu']=function(_0x5b0af8){logger[_0xb6d4('0x2d')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5b0af8[_0xb6d4('0x36')]));if(_0x5b0af8[_0xb6d4('0x9d')]===0x0){return this[_0xb6d4('0x9e')](_0x5b0af8);}_0x5b0af8['retry']-=0x1;if(!this[_0xb6d4('0x9c')](_0x5b0af8[_0xb6d4('0x10a')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x5b0af8,_0xb6d4('0x161'));}var _0x20adae=this[_0xb6d4('0x20')]['sync'](this,_0x5b0af8[_0xb6d4('0x10a')]);if(!_0x20adae){return this[_0xb6d4('0xf')]['error'](_0x5b0af8,_0xb6d4('0x162'));}var _0x5f2ce=this['channel']['getData'](_0x20adae,_0x5b0af8[_0xb6d4('0x10d')],_0x5b0af8[_0xb6d4('0x163')]);var _0x23b51e=_0x5f2ce[_0xb6d4('0x9a')];if(_0x5f2ce[_0xb6d4('0x9a')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x5b0af8,'-1');return _0x5f2ce;}else if(_0x5f2ce[_0xb6d4('0x97')]==='timeout'){_0x5f2ce[_0xb6d4('0x9a')]=_0x5f2ce[_0xb6d4('0x9a')][_0xb6d4('0x8f')]>0x0?_0x5f2ce[_0xb6d4('0x9a')]:'t';}else if(_[_0xb6d4('0x42')](_0x5f2ce[_0xb6d4('0x9a')])){_0x5f2ce['result']='#';_0x23b51e='#';}if(!this[_0xb6d4('0x9c')](_0x5b0af8[_0xb6d4('0xce')])){this[_0xb6d4('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x54a144=this['getVariable'][_0xb6d4('0x67')](this,_0x5b0af8['variable_id']);if(!_0x54a144){return this[_0xb6d4('0xf')]['error'](_0x5b0af8,_0xb6d4('0xcf'));}this[_0xb6d4('0xf')]['setVariable'](_0x54a144,_0x23b51e);}this['createSquareDetailsReport'][_0xb6d4('0x67')](this,_0x5b0af8,_0x23b51e);return _0x5f2ce;};AGIVertices[_0xb6d4('0x12')]['noop']=function(_0x3d2de7){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x164'),_0x3d2de7[_0xb6d4('0x36')]));return this[_0xb6d4('0xf')]['noop'](_0x3d2de7[_0xb6d4('0x165')]||_0x3d2de7[_0xb6d4('0x36')]);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x166')]=function(_0xc55eab){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xc55eab[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0xc55eab['findBy'])){return this['channel'][_0xb6d4('0x2b')](_0xc55eab,_0xb6d4('0x153'));}logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0xc55eab[_0xb6d4('0x155')]));var _0x154ae3=this[_0xb6d4('0x48')][_0xb6d4('0x67')](this,_0xc55eab[_0xb6d4('0x167')]);var _0x31c986=this[_0xb6d4('0x4a')][_0xb6d4('0x67')](this,_0xc55eab[_0xb6d4('0x155')],_0x154ae3);if(_0x31c986){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x156'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0xc55eab[_0xb6d4('0x155')]));this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0xc55eab[_0xb6d4('0x155')]));return{'code':0xc8,'result':_0xb6d4('0x157')};}else{logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x158'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0xc55eab[_0xb6d4('0x155')]));this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x156'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0xc55eab[_0xb6d4('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x168')]=function(_0x1358be){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x169'),_0x1358be[_0xb6d4('0x36')]));if(!this['isConfigured'](_0x1358be[_0xb6d4('0x10a')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x1358be,'no\x20file\x20audio\x20selected');}var _0x2b0bea=this[_0xb6d4('0x20')]['sync'](this,_0x1358be[_0xb6d4('0x10a')]);if(!_0x2b0bea){return this[_0xb6d4('0xf')]['error'](_0x1358be,'no\x20file\x20audio\x20found');}var _0x9bab09=this[_0xb6d4('0xf')][_0xb6d4('0xa3')]('PLAYBACK',[_0x2b0bea,_0x1358be['opts']]);if(_0x9bab09['result']===-0x1){return _0x9bab09;}return this['channel'][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('Executed\x20command\x20%s\x20%s',_0xb6d4('0x16a'),_0x2b0bea));};AGIVertices[_0xb6d4('0x12')]['queue']=function(_0x347727){logger[_0xb6d4('0x2d')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x347727[_0xb6d4('0x36')]));if(!this['isConfigured'](_0x347727[_0xb6d4('0x16b')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x347727,_0xb6d4('0x16c'));}var _0x697818='';var _0x5d76fe=parseInt(_0x347727[_0xb6d4('0x16b')],0xa);if(isNaN(_0x5d76fe)){_0x697818=_0x347727['queue_id'];}else{_0x697818=this[_0xb6d4('0x16d')][_0xb6d4('0x67')](this,_0x347727['queue_id']);if(!_0x697818){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x347727,_0xb6d4('0x16e'));}}var _0x2fba8e='';if(this['isConfigured'](_0x347727[_0xb6d4('0x10a')])){var _0x4c2a0f=this[_0xb6d4('0x20')]['sync'](this,_0x347727['file_id']);if(_0x4c2a0f){_0x2fba8e=_0x4c2a0f;}}this[_0xb6d4('0x34')][_0xb6d4('0x67')](this,_0x347727,_0x697818);if(_0x347727['opts']['indexOf']('x')<0x0){_0x347727[_0xb6d4('0xda')]+='x';}if(_0x347727[_0xb6d4('0xda')][_0xb6d4('0x16f')]('X')<0x0){_0x347727['opts']+='X';}this['channel'][_0xb6d4('0x92')]('XMCS-QUEUE',_0x697818?_0x697818['toLowerCase']():'');var _0x297b83=this[_0xb6d4('0xf')][_0xb6d4('0xa3')](_0xb6d4('0x170'),[_0x697818,_0x347727[_0xb6d4('0xda')],_0x347727[_0xb6d4('0x5c')],_0x2fba8e,_0x347727[_0xb6d4('0x5e')],_0x347727['agi'],_0x347727[_0xb6d4('0x171')],_0x347727[_0xb6d4('0x172')],'',_0x347727[_0xb6d4('0x173')]]);if(_0x297b83[_0xb6d4('0x9a')]===-0x1){return _0x297b83;}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x174'),_0xb6d4('0x170'),_0x697818));};AGIVertices['prototype']['record']=function(_0x5dd6c2){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x5dd6c2[_0xb6d4('0x36')]));var _0x5d0d7e=_0x5dd6c2[_0xb6d4('0x175')]||_0xb6d4('0x12a');var _0x3aa2fa=util['format'](_0xb6d4('0x176'),this[_0xb6d4('0xf')][_0xb6d4('0x35')],rs[_0xb6d4('0x115')](0x5));var _0x4c5a77=util[_0xb6d4('0x28')](_0xb6d4('0x177'),FILES_PATH,_0x3aa2fa,_0x5d0d7e);var _0x20e063=util[_0xb6d4('0x28')](_0xb6d4('0x12b'),FILES_PATH,_0x3aa2fa);this[_0xb6d4('0x39')][_0xb6d4('0x67')](this,_0x5dd6c2,_0x3aa2fa,_0x4c5a77);this[_0xb6d4('0xf')][_0xb6d4('0x92')](_0xb6d4('0x178'),_0x3aa2fa);logger[_0xb6d4('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x20e063,_0x5d0d7e,_0x5dd6c2[_0xb6d4('0x179')],_0x5dd6c2[_0xb6d4('0x5e')]);return this[_0xb6d4('0xf')][_0xb6d4('0x12d')](_0x20e063,_0x5d0d7e,_0x5dd6c2[_0xb6d4('0x179')],_0x5dd6c2[_0xb6d4('0x5e')],undefined,!![]);};AGIVertices[_0xb6d4('0x12')]['restapi']=function(_0x23741a){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x17a'),_0x23741a['label']));if(!this[_0xb6d4('0x9c')](_0x23741a[_0xb6d4('0x5c')])){return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0x17b'));}var _0x11b31=this[_0xb6d4('0x17c')]['sync'](this,_0x23741a);logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x17d'),util[_0xb6d4('0x17e')](_0x11b31,{'showHidden':![],'depth':null})));if(!this[_0xb6d4('0x9c')](_0x23741a[_0xb6d4('0xce')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0x17f'));}var _0x4937d7=this[_0xb6d4('0x13')]['sync'](this,_0x23741a[_0xb6d4('0xce')]);if(!_0x4937d7){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x23741a,_0xb6d4('0xcf'));}this['channel'][_0xb6d4('0x92')](util[_0xb6d4('0x28')](_0xb6d4('0x180'),_0x4937d7),_0x11b31[_0xb6d4('0x6c')]?_0x11b31[_0xb6d4('0x6c')]:_0xb6d4('0x181'));this[_0xb6d4('0xf')][_0xb6d4('0x92')](util[_0xb6d4('0x28')]('%s_STATUS_MESSAGE',_0x4937d7),_0x11b31[_0xb6d4('0x6d')]?_0x11b31[_0xb6d4('0x6d')]:'OK');if(_0x11b31[_0xb6d4('0x62')]){try{this[_0xb6d4('0x90')](_0x11b31['body'],_0x4937d7);}catch(_0x1d7cf9){logger['error'](util[_0xb6d4('0x28')](_0xb6d4('0x182'),_0x4937d7));}}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('variable\x20%s\x20set',_0x4937d7));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x183')]=function(_0x471a21){logger['info'](util[_0xb6d4('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x471a21['label']));return this[_0xb6d4('0xf')][_0xb6d4('0x184')](_0x471a21['digits']['replace'](/\s+/g,''),_0x471a21[_0xb6d4('0x179')]);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x185')]=function(_0x1828c8){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x186'),_0x1828c8[_0xb6d4('0x36')]));return this['channel'][_0xb6d4('0x187')](_0x1828c8[_0xb6d4('0x5f')]['replace'](/\s+/g,''),_0x1828c8['escape_digits']);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x188')]=function(_0x439940){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x189'),_0x439940[_0xb6d4('0x36')]));return this[_0xb6d4('0xf')][_0xb6d4('0x18a')](_0x439940[_0xb6d4('0x55')],_0x439940[_0xb6d4('0x179')]);};AGIVertices['prototype'][_0xb6d4('0x18b')]=function(_0x53f967){logger['info'](util['format'](_0xb6d4('0x18c'),_0x53f967[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x53f967['account_id'])){return this['channel'][_0xb6d4('0xa1')](_0xb6d4('0x18d'));}var _0x3e42c0=this[_0xb6d4('0x18e')][_0xb6d4('0x67')](this,_0x53f967[_0xb6d4('0x18f')]);if(!_0x3e42c0||!_0x3e42c0[_0xb6d4('0x190')]){return this[_0xb6d4('0xf')]['error'](_0x53f967,_0xb6d4('0x191'));}var _0x2a56a3={'from':util[_0xb6d4('0x28')](_0xb6d4('0x192'),_0x3e42c0[_0xb6d4('0x15')],_0x3e42c0[_0xb6d4('0x193')]||_0x3e42c0[_0xb6d4('0x190')]['user']),'to':_0x53f967['to']||'','cc':_0x53f967['cc']||'','bcc':_0x53f967[_0xb6d4('0x194')]||'','subject':_0x53f967[_0xb6d4('0x195')],'html':_0x53f967[_0xb6d4('0x55')],'text':_0x53f967[_0xb6d4('0x55')]};var _0xe1d457={'tls':{'rejectUnauthorized':![]}};if(_0x3e42c0[_0xb6d4('0x190')][_0xb6d4('0x196')]){_0xe1d457[_0xb6d4('0x196')]=_0x3e42c0[_0xb6d4('0x190')][_0xb6d4('0x196')];}else{_0xe1d457[_0xb6d4('0x197')]=_0x3e42c0[_0xb6d4('0x190')][_0xb6d4('0x197')];_0xe1d457['port']=_0x3e42c0[_0xb6d4('0x190')][_0xb6d4('0x198')];_0xe1d457[_0xb6d4('0x199')]=_0x3e42c0[_0xb6d4('0x190')][_0xb6d4('0x199')];}if(_0x3e42c0[_0xb6d4('0x190')][_0xb6d4('0x19a')]){_0xe1d457[_0xb6d4('0x19b')]={'user':_0x3e42c0[_0xb6d4('0x190')][_0xb6d4('0x19c')],'pass':_0x3e42c0['Smtp'][_0xb6d4('0x19d')]};}if(this[_0xb6d4('0x9c')](_0x53f967[_0xb6d4('0x19e')])){}logger['debug'](_0xb6d4('0x19f'),JSON['stringify'](_0x2a56a3));this[_0xb6d4('0x34')][_0xb6d4('0x67')](this,_0x53f967,_0x53f967['account_id']);this['channel'][_0xb6d4('0xa1')](util['format'](_0xb6d4('0x1a0'),_0x3e42c0[_0xb6d4('0x15')]));this[_0xb6d4('0x24')][_0xb6d4('0x67')](this,_0xe1d457,_0x2a56a3);return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0x1a1'));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1a2')]=function(_0x4a669d){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x1a3'),_0x4a669d[_0xb6d4('0x36')]));return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0x1a4'));};AGIVertices[_0xb6d4('0x12')]['sendSMS']=function(_0x3bdc39){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x1a5'),_0x3bdc39[_0xb6d4('0x36')]));if(!this['isConfigured'](_0x3bdc39['sms_account_id'])){return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0x1a6'));}var _0x114f59=this['getSmsAccount'][_0xb6d4('0x67')](this,_0x3bdc39['sms_account_id']);if(!_0x114f59){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x3bdc39,_0xb6d4('0x1a7'));}var _0x55eb8c={'body':_0x3bdc39[_0xb6d4('0x1a8')],'phone':_0x3bdc39['to']||'','SmsAccountId':_0x114f59['id']};logger[_0xb6d4('0xd4')](_0xb6d4('0x1a9'),JSON['stringify'](_0x55eb8c));this[_0xb6d4('0x34')]['sync'](this,_0x3bdc39,_0x3bdc39[_0xb6d4('0x1aa')]);this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x1ab'),_0x114f59[_0xb6d4('0x15')]));this[_0xb6d4('0x33')][_0xb6d4('0x67')](this,_0x55eb8c);return this[_0xb6d4('0xf')]['noop'](_0xb6d4('0x1ac'));};AGIVertices['prototype'][_0xb6d4('0x1ad')]=function(_0x2949db){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x1ae'),_0x2949db[_0xb6d4('0x36')]));if(!this['isConfigured'](_0x2949db['variable_id'])){return this['channel'][_0xb6d4('0x2b')](_0x2949db,'no\x20variable\x20selected');}var _0x5e4bde=this[_0xb6d4('0x13')][_0xb6d4('0x67')](this,_0x2949db[_0xb6d4('0xce')]);if(!_0x5e4bde){return this[_0xb6d4('0xf')]['error'](_0x2949db,'no\x20variable\x20found');}return this[_0xb6d4('0xf')][_0xb6d4('0x92')](_0x5e4bde,_0x2949db[_0xb6d4('0x1af')]);};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1b0')]=function(_0x5b716f){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x1b1'),_0x5b716f[_0xb6d4('0x36')]));this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0x1b2'));if(_0x5b716f[_0xb6d4('0xae')]===_0xb6d4('0x1b3')){this['channel']['noop'](_0xb6d4('0x1b4'));return this[_0xb6d4('0xf')][_0xb6d4('0xae')]();}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')]('Skipped\x20Answer');};AGIVertices[_0xb6d4('0x12')]['subproject']=function(_0x3292ad){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x1b5'),_0x3292ad['label']));if(!this[_0xb6d4('0x9c')](_0x3292ad[_0xb6d4('0x1b6')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x3292ad,'no\x20subproject\x20selected');}var _0x57450d=this[_0xb6d4('0x18')][_0xb6d4('0x67')](this,_0x3292ad['project_id']);if(!this['isConfigured'](_0x57450d)){return this['channel'][_0xb6d4('0x2b')](_0x3292ad,util[_0xb6d4('0x28')](_0xb6d4('0x1b7'),_0x3292ad[_0xb6d4('0x1b6')]));}if(_0x57450d===this['channel']['arg_1']){return this['channel'][_0xb6d4('0x2b')](_0x3292ad,_0xb6d4('0x1b8'));}this[_0xb6d4('0x34')][_0xb6d4('0x67')](this,_0x3292ad,_0x57450d);var _0x59bd1b=this[_0xb6d4('0xf')][_0xb6d4('0xa3')]('AGI',util[_0xb6d4('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xb6d4('0x7')]['host']||_0xb6d4('0x1b9'),_0x57450d,this[_0xb6d4('0xf')][_0xb6d4('0x38')]));if(_0x59bd1b[_0xb6d4('0x9a')]===-0x1){return _0x59bd1b;}return this['channel']['noop'](util[_0xb6d4('0x28')](_0xb6d4('0x174'),_0xb6d4('0x1ba'),_0x57450d));};AGIVertices[_0xb6d4('0x12')]['system']=function(_0x797ac8){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x1bb'),_0x797ac8[_0xb6d4('0x36')]));var _0x34a71d=this[_0xb6d4('0x51')]['sync'](this,_0x797ac8[_0xb6d4('0x1bc')]);this[_0xb6d4('0x34')][_0xb6d4('0x67')](this,_0x797ac8,_0x797ac8['command']);if(this[_0xb6d4('0x9c')](_0x797ac8[_0xb6d4('0xce')])){var _0x5b3f77=this[_0xb6d4('0x13')][_0xb6d4('0x67')](this,_0x797ac8[_0xb6d4('0xce')]);if(_0x5b3f77){this['channel'][_0xb6d4('0x92')](_0x5b3f77,_0x34a71d);return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x1bd'),_0x797ac8[_0xb6d4('0x1bc')],_0x5b3f77));}}return this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x797ac8['command']));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1be')]=function(_0x3806fd){logger['info'](util['format'](_0xb6d4('0x1bf'),_0x3806fd['label']));_0x3806fd[_0xb6d4('0x55')]=_0x3806fd[_0xb6d4('0x55')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3806fd['apiKey'])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0x1c0'));}if(!this[_0xb6d4('0x9c')](_0x3806fd['text'])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](_0xb6d4('0xa2'));}this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x1c1'),_0x3806fd[_0xb6d4('0x55')]));var _0x52dcf5=this[_0xb6d4('0x52')][_0xb6d4('0x67')](this,_0x3806fd);if(_0x52dcf5){this['channel'][_0xb6d4('0xa1')](util['format'](_0xb6d4('0x1c2'),_0x52dcf5));var _0x54bd84=this[_0xb6d4('0xf')]['streamFile'](_0x52dcf5);try{fs[_0xb6d4('0xfa')](_0x52dcf5+_0xb6d4('0xfb'));}catch(_0x474cea){logger[_0xb6d4('0x2b')](_0x474cea);}return _0x54bd84;}return this[_0xb6d4('0xf')]['error'](_0x3806fd,_0xb6d4('0x1c3'));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1c4')]=function(_0x3ec347){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3ec347['label']));_0x3ec347[_0xb6d4('0x55')]=_0x3ec347['text'][_0xb6d4('0xcc')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3ec347[_0xb6d4('0x55')])){return this[_0xb6d4('0xf')][_0xb6d4('0xa1')]('no\x20text\x20configured');}this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x3ec347[_0xb6d4('0x55')]));var _0x2070a8=this[_0xb6d4('0x5a')][_0xb6d4('0x67')](this,_0x3ec347);if(_0x2070a8){this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x1c5'),_0x2070a8));var _0x46797e=this[_0xb6d4('0xf')][_0xb6d4('0xf9')](_0x2070a8);try{fs[_0xb6d4('0xfa')](_0x2070a8+_0xb6d4('0xfb'));}catch(_0x233ba8){logger['error'](_0x233ba8);}return _0x46797e;}return this['channel']['error'](_0x3ec347,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1c6')]=function(_0x4b04bc){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x1c7'),_0x4b04bc['label']));if(!this[_0xb6d4('0x9c')](_0x4b04bc[_0xb6d4('0x155')])){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x4b04bc,_0xb6d4('0x153'));}logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x154'),this['channel'][_0xb6d4('0x3a')],_0x4b04bc['findBy']));var _0x58ebd3=this['agentUnpause']['sync'](this,_0x4b04bc[_0xb6d4('0x155')]);if(_0x58ebd3){logger['info'](util[_0xb6d4('0x28')](_0xb6d4('0x156'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x4b04bc[_0xb6d4('0x155')]));this[_0xb6d4('0xf')]['noop'](util[_0xb6d4('0x28')](_0xb6d4('0x156'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x4b04bc[_0xb6d4('0x155')]));return{'code':0xc8,'result':_0xb6d4('0x157')};}else{logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x158'),this[_0xb6d4('0xf')][_0xb6d4('0x3a')],_0x4b04bc[_0xb6d4('0x155')]));this['channel'][_0xb6d4('0xa1')](util[_0xb6d4('0x28')](_0xb6d4('0x158'),this['channel'][_0xb6d4('0x3a')],_0x4b04bc[_0xb6d4('0x155')]));return{'code':0xc8,'result':_0xb6d4('0x15a')};}};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1c8')]=function(_0x147621){logger[_0xb6d4('0x2d')](util[_0xb6d4('0x28')](_0xb6d4('0x1c9'),_0x147621[_0xb6d4('0x36')]));var _0x4a8502=this['channel'][_0xb6d4('0xa3')]('VOICEMAIL',[_0x147621[_0xb6d4('0x1ca')],_0x147621['options']]);if(_0x4a8502[_0xb6d4('0x9a')]===-0x1){return _0x4a8502;}return this[_0xb6d4('0xf')][_0xb6d4('0xa1')](util[_0xb6d4('0x28')]('Executed\x20command\x20%s\x20%s',_0xb6d4('0x1cb'),_0x147621[_0xb6d4('0x1ca')]));};AGIVertices[_0xb6d4('0x12')][_0xb6d4('0x1cc')]=function(_0x515167){logger[_0xb6d4('0x2d')](util['format'](_0xb6d4('0x1cd'),_0x515167[_0xb6d4('0x36')]));if(!this[_0xb6d4('0x9c')](_0x515167['variable_id'])){return this['channel'][_0xb6d4('0x2b')](_0x515167,'no\x20variable\x20selected');}var _0x186fab=this[_0xb6d4('0x13')][_0xb6d4('0x67')](this,_0x515167['variable_id']);if(!_0x186fab){return this[_0xb6d4('0xf')][_0xb6d4('0x2b')](_0x515167,_0xb6d4('0xcf'));}var _0x36a543=this[_0xb6d4('0xf')][_0xb6d4('0x13')](_0x186fab);return{'code':0xc8,'result':_0x36a543[_0xb6d4('0x97')]?_0x36a543[_0xb6d4('0x97')]:'-'};};String[_0xb6d4('0x12')][_0xb6d4('0x96')]=function(_0x2bd5e1,_0x363bf5){return this['split'](_0x2bd5e1)['join'](_0x363bf5);};module[_0xb6d4('0x1ce')]=AGIVertices; \ No newline at end of file +var _0xda5b=['grammar','noop','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20found','forEach','keys','setVariable','%s[%s][%s]','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','test','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','no\x20file\x20audio\x20selected','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','debug','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','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','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','path','util','lodash','shelljs','randomstring','mustache','request-promise','../../config/logger','agi','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','close','getSmsAccount','createSmsMessage','channel','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','appid','appsecret','agicommand','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','hasOwnProperty','%s.%s','split','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','createSquareDetailsReport','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block'];(function(_0x334aaf,_0x4d6d21){var _0x14c838=function(_0x3c8e0a){while(--_0x3c8e0a){_0x334aaf['push'](_0x334aaf['shift']());}};_0x14c838(++_0x4d6d21);}(_0xda5b,0x12d));var _0xbda5=function(_0x2dcc9f,_0x25c5ff){_0x2dcc9f=_0x2dcc9f-0x0;var _0x168b82=_0xda5b[_0x2dcc9f];return _0x168b82;};'use strict';var fs=require('fs');var path=require(_0xbda5('0x0'));var util=require(_0xbda5('0x1'));var _=require(_0xbda5('0x2'));var sh=require(_0xbda5('0x3'));var odbc=require('odbc')();var rs=require(_0xbda5('0x4'));var moment=require('moment');var Mustache=require(_0xbda5('0x5'));var rp=require(_0xbda5('0x6'));var logger=require(_0xbda5('0x7'))(_0xbda5('0x8'));var config=require('../../config/environment');var scripts=require(_0xbda5('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xbda5('0xa'),_0xbda5('0xb')];var verticesWithRetry=[_0xbda5('0xc'),_0xbda5('0xd'),_0xbda5('0xe')];var AGIVertices=function(_0x2a1503,_0x1c835a,_0x5d69e2){this['channel']=_0x2a1503;this[_0xbda5('0xf')]=_0x1c835a;this[_0xbda5('0x10')]=_0x5d69e2;};AGIVertices[_0xbda5('0x11')][_0xbda5('0x12')]=function(_0x3ef2b1,_0x5a6672){this[_0xbda5('0xf')][_0xbda5('0x13')](_0x3ef2b1)[_0xbda5('0x14')](function(_0x20faf3){_0x5a6672(null,_0x20faf3?_0x20faf3[_0xbda5('0x15')]:![]);})[_0xbda5('0x16')](function(_0xf44c4c){_0x5a6672(_0xf44c4c);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x17')]=function(_0x3cdf00,_0x3e60e7){this[_0xbda5('0xf')][_0xbda5('0x18')](_0x3cdf00)['then'](function(_0x308027){_0x3e60e7(null,_0x308027?_0x308027[_0xbda5('0x15')]:![]);})[_0xbda5('0x16')](function(_0x31118c){_0x3e60e7(_0x31118c);});};AGIVertices['prototype'][_0xbda5('0x19')]=function(_0xaf9b13,_0x38258){this[_0xbda5('0xf')][_0xbda5('0x1a')](_0xaf9b13)[_0xbda5('0x14')](function(_0x7a8e8f){_0x38258(null,_0x7a8e8f?_0x7a8e8f[_0xbda5('0x15')]:![]);})['catch'](function(_0x3bb470){_0x38258(_0x3bb470);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1b')]=function(_0x36b555,_0x3569c4){this['rpc'][_0xbda5('0x1c')](_0x36b555)[_0xbda5('0x14')](function(_0x1a8d0e){_0x3569c4(null,_0x1a8d0e?_0x1a8d0e['dsn']:![]);})[_0xbda5('0x16')](function(_0x1f7e18){_0x3569c4(_0x1f7e18);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1d')]=function(_0x3ec10a,_0x15da79){this[_0xbda5('0xf')][_0xbda5('0x1e')](_0x3ec10a)[_0xbda5('0x14')](function(_0x242c53){_0x15da79(null,_0x242c53?_0x242c53[_0xbda5('0x15')]:![]);})[_0xbda5('0x16')](function(_0xd78696){_0x15da79(_0xd78696);});};AGIVertices[_0xbda5('0x11')]['getTrunk']=function(_0x416fe9,_0xe8307){this[_0xbda5('0xf')][_0xbda5('0x1f')](_0x416fe9)[_0xbda5('0x14')](function(_0x11ec4c){_0xe8307(null,_0x11ec4c?_0x11ec4c['name']:![]);})[_0xbda5('0x16')](function(_0x382778){_0xe8307(_0x382778);});};AGIVertices['prototype'][_0xbda5('0x20')]=function(_0x1f3547,_0x3c9a5f){var _0x3b934c=this;this[_0xbda5('0xf')]['getSoundById'](_0x1f3547)['then'](function(_0x2795a4){_0x3c9a5f(null,_0x2795a4?_0x3b934c[_0xbda5('0x21')](_0x2795a4[_0xbda5('0x22')]):![]);})[_0xbda5('0x16')](function(_0x27aa5f){_0x3c9a5f(_0x27aa5f);});};AGIVertices[_0xbda5('0x11')]['getMailAccount']=function(_0xd7723f,_0x46710d){this['rpc'][_0xbda5('0x23')](_0xd7723f)[_0xbda5('0x14')](function(_0x51bf2d){_0x46710d(null,_0x51bf2d?_0x51bf2d:![]);})[_0xbda5('0x16')](function(_0x260f0a){_0x46710d(_0x260f0a);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x24')]=function(_0x1d2aa9,_0x44fb6c,_0x51ec4f){this['mailRpc'][_0xbda5('0x24')](_0x1d2aa9,_0x44fb6c)[_0xbda5('0x14')](function(){_0x51ec4f(null);})[_0xbda5('0x16')](function(_0x547572){_0x51ec4f(_0x547572);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x25')]=function(_0x2f14ad,_0x5d272c){this['rpc'][_0xbda5('0x26')](_0x2f14ad)[_0xbda5('0x14')](function(_0x343e3a){if(_0x343e3a){if(_0x343e3a[_0xbda5('0x27')]){_0x5d272c(null,[_0x343e3a['interval']]);}else{_0x5d272c(null,_[_0xbda5('0x28')](_0x343e3a[_0xbda5('0x29')],_0xbda5('0x2a')));}}else{_0x5d272c(null,![]);}})['catch'](function(_0x208611){_0x5d272c(_0x208611);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x21')]=function(_0x3c2c4d){return util['format'](_0xbda5('0x2b'),FILES_PATH,_0x3c2c4d);};AGIVertices[_0xbda5('0x11')][_0xbda5('0x2c')]=function(_0x47f187,_0x17419c,_0x56ff1b){odbc[_0xbda5('0x2d')](_0x47f187,function(_0x222a25){if(_0x222a25){logger[_0xbda5('0x2e')](_0xbda5('0x2f'),_0x222a25);_0x56ff1b(_0x222a25);}else{logger['info'](_0xbda5('0x30'));odbc[_0xbda5('0x31')](_0x17419c,function(_0x15b443,_0x1e90ca){if(_0x15b443){logger[_0xbda5('0x32')](_0xbda5('0x33'),_0x17419c);_0x56ff1b(_0x15b443);}else{logger[_0xbda5('0x32')]('Query\x20executed\x20correctly\x20%s',_0x17419c);odbc[_0xbda5('0x34')](function(_0x1c0761){if(_0x1c0761){logger[_0xbda5('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1c0761);}_0x56ff1b(null,_0x1e90ca);});}});}});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x35')]=function(_0x476bc5,_0x2c8711){this['rpc']['getSmsAccountById'](_0x476bc5)[_0xbda5('0x14')](function(_0x4b3dda){_0x2c8711(null,_0x4b3dda?_0x4b3dda:![]);})[_0xbda5('0x16')](function(_0x2ad34a){_0x2c8711(_0x2ad34a);});};AGIVertices[_0xbda5('0x11')]['createSmsMessage']=function(_0x112935,_0x5185e0){this['rpc'][_0xbda5('0x36')](_0x112935)[_0xbda5('0x14')](function(_0x1cb527){_0x5185e0(null,_0x1cb527);})['catch'](function(_0x31dbc4){_0x5185e0(_0x31dbc4);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0xf699ab,_0x1b4129,_0x2d9f9e){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xbda5('0x37')][_0xbda5('0x38')],'node':_0xf699ab[_0xbda5('0x39')],'application':_0xf699ab['agicommand'],'data':_0x1b4129||null,'project_name':this[_0xbda5('0x37')][_0xbda5('0x3a')],'callerid':this['channel']['callerid']})['then'](function(_0x5736ad){if(_0x2d9f9e){_0x2d9f9e(null,_0x5736ad);}})[_0xbda5('0x16')](function(_0x515137){if(_0x2d9f9e){_0x2d9f9e(_0x515137);}});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x3b')]=function(_0x2846eb,_0x3d7de6,_0x5e5de7,_0x1b4ebd){this[_0xbda5('0xf')][_0xbda5('0x3b')]({'uniqueid':this[_0xbda5('0x37')][_0xbda5('0x38')],'callerid':this[_0xbda5('0x37')][_0xbda5('0x3c')],'calleridname':this[_0xbda5('0x37')][_0xbda5('0x3d')],'context':this['channel']['context'],'extension':this[_0xbda5('0x37')][_0xbda5('0x3e')],'priority':this['channel'][_0xbda5('0x3f')],'accountcode':this[_0xbda5('0x37')][_0xbda5('0x40')],'dnid':this[_0xbda5('0x37')][_0xbda5('0x41')],'projectName':this['channel'][_0xbda5('0x3a')],'saveName':_0x3d7de6,'filename':_0x2846eb[_0xbda5('0x42')]||_0x3d7de6,'savePath':_0x5e5de7})[_0xbda5('0x14')](function(_0x58ed3b){_0x1b4ebd(null,_0x58ed3b);})[_0xbda5('0x16')](function(_0x37bc6b){_0x1b4ebd(_0x37bc6b);});};AGIVertices['prototype'][_0xbda5('0x43')]=function(_0x47e923,_0x2770c3,_0xd6ac53,_0x4e1ff8,_0x47bca0){this[_0xbda5('0xf')][_0xbda5('0x43')]({'uniqueid':this[_0xbda5('0x37')][_0xbda5('0x38')],'body':_0x47e923,'direction':_0x2770c3,'providerName':_0xd6ac53,'providerResponse':_0x4e1ff8})[_0xbda5('0x14')](function(_0x4a6436){if(_0x47bca0){_0x47bca0(null,_0x4a6436);}})['catch'](function(_0x32fda0){if(_0x47bca0){_0x47bca0(_0x32fda0);}});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x44')]=function(_0x392da7,_0x868b90){this['rpc']['createCmContact']({'firstName':_[_0xbda5('0x45')](_0x392da7[_0xbda5('0x15')])||_[_0xbda5('0x46')](_0x392da7['name'])?'callback_'+Math[_0xbda5('0x47')]():_0x392da7[_0xbda5('0x15')],'lastName':_['isEmpty'](_0x392da7[_0xbda5('0x48')])||_[_0xbda5('0x46')](_0x392da7[_0xbda5('0x48')])?null:_0x392da7['lastName'],'phone':_0x392da7[_0xbda5('0x49')],'ListId':_0x392da7[_0xbda5('0x4a')],'scheduledat':_0x392da7[_0xbda5('0x4b')],'callbackUniqueid':this[_0xbda5('0x37')][_0xbda5('0x38')],'tags':_0xbda5('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x392da7[_0xbda5('0x4b')][_0xbda5('0x4d')](),'priority':_0x392da7[_0xbda5('0x4e')]})['then'](function(_0x2ba62e){_0x868b90(null,_0x2ba62e);})[_0xbda5('0x16')](function(_0x3a9cce){_0x868b90(_0x3a9cce);});};AGIVertices[_0xbda5('0x11')]['getPause']=function(_0x4c78dd,_0x5ee30b){this[_0xbda5('0xf')][_0xbda5('0x4f')](_0x4c78dd)[_0xbda5('0x14')](function(_0x52508f){_0x5ee30b(null,_0x52508f?_0x52508f[_0xbda5('0x15')]:![]);})[_0xbda5('0x16')](function(_0x25daca){_0x5ee30b(_0x25daca);});};AGIVertices[_0xbda5('0x11')]['agentPause']=function(_0x1c650d,_0x156750,_0x8ff8a5){var _0x5c43cd={'role':_0xbda5('0x50')};_0x5c43cd[_0x1c650d]=this[_0xbda5('0x37')][_0xbda5('0x3c')];this['rpc'][_0xbda5('0x51')](_0x5c43cd,_0x156750,this[_0xbda5('0x37')][_0xbda5('0x38')])['then'](function(_0x1ac0d8){_0x8ff8a5(null,_['isNil'](_0x1ac0d8)?![]:!![]);})[_0xbda5('0x16')](function(_0x1484ca){logger['error'](_0x1484ca);_0x8ff8a5(null,![]);});};AGIVertices['prototype'][_0xbda5('0x52')]=function(_0x5dfdd2,_0x173a7e){var _0x37b158={'role':_0xbda5('0x50')};_0x37b158[_0x5dfdd2]=this[_0xbda5('0x37')][_0xbda5('0x3c')];this[_0xbda5('0xf')]['agentUnpause'](_0x37b158)[_0xbda5('0x14')](function(_0x3f14cf){_0x173a7e(null,_[_0xbda5('0x46')](_0x3f14cf)?![]:!![]);})[_0xbda5('0x16')](function(_0x5a7416){logger[_0xbda5('0x2e')](_0x5a7416);_0x173a7e(null,![]);});};AGIVertices[_0xbda5('0x11')]['agentLogout']=function(_0x41fa3c,_0x4ce7e7){var _0x5b4a9a={'role':'agent'};_0x5b4a9a[_0x41fa3c]=this[_0xbda5('0x37')]['callerid'];this[_0xbda5('0xf')][_0xbda5('0x53')](_0x5b4a9a)[_0xbda5('0x14')](function(_0x252155){_0x4ce7e7(null,_['isNil'](_0x252155)?![]:!![]);})['catch'](function(_0x14695e){logger[_0xbda5('0x2e')](_0x14695e);_0x4ce7e7(null,![]);});};AGIVertices['prototype'][_0xbda5('0x54')]=function(_0x58d328,_0x36b4fc){var _0x17f552={'role':'agent'};_0x17f552[_0x58d328]=this[_0xbda5('0x37')]['callerid'];var _0x3832fa=_0x58d328!='internal'?util[_0xbda5('0x55')](_0xbda5('0x56'),_0xbda5('0x57'),this[_0xbda5('0x37')][_0xbda5('0x3c')]):undefined;this[_0xbda5('0xf')]['agentLogin'](_0x17f552,_0x3832fa)[_0xbda5('0x14')](function(_0x419828){_0x36b4fc(null,_[_0xbda5('0x46')](_0x419828)?![]:!![]);})[_0xbda5('0x16')](function(_0x12871e){logger[_0xbda5('0x2e')](_0x12871e);_0x36b4fc(null,![]);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x58')]=function(_0x575667,_0x1aaf91){sh[_0xbda5('0x59')](_['trim'](_0x575667),function(_0x2db13f,_0x5800a4){var _0x49329e=_0x5800a4[_0xbda5('0x5a')](/(\r\n|\n|\r)/gm,'');_0x1aaf91(null,_0x49329e);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x5b')]=function(_0x3a8464,_0x41ff5d){scripts[_0xbda5('0x5b')](_0x3a8464[_0xbda5('0x5c')],_0x3a8464['google_cloud_tts_text_type']||'text',_0x3a8464[_0xbda5('0x5d')],_0x3a8464[_0xbda5('0x5e')]||_0xbda5('0x5f'),_0x3a8464[_0xbda5('0x60')]||_0xbda5('0x61'),_0x3a8464[_0xbda5('0x62')]||_0xbda5('0x63'))[_0xbda5('0x14')](function(_0x56dc9c){_0x41ff5d(null,_0x56dc9c);})['catch'](function(_0xc60115){_0x41ff5d(_0xc60115);});};AGIVertices['prototype']['googleTTS']=function(_0x3b548a,_0x44849d){scripts[_0xbda5('0x64')](_0x3b548a['text'],_0x3b548a[_0xbda5('0x65')]||'en',0x1)[_0xbda5('0x14')](function(_0x52229b){_0x44849d(null,_0x52229b);})[_0xbda5('0x16')](function(_0x56ff43){_0x44849d(_0x56ff43);});};AGIVertices['prototype'][_0xbda5('0x66')]=function(_0x57b2ae,_0x486012){var _0x220881={'uri':_0x57b2ae[_0xbda5('0x67')],'method':_0x57b2ae[_0xbda5('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x57b2ae[_0xbda5('0x69')])==='number'&&parseInt(_0x57b2ae[_0xbda5('0x69')])>=0x1?parseInt(_0x57b2ae[_0xbda5('0x69')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xbda5('0x6a'),_0xbda5('0x6b')],_0x220881[_0xbda5('0x68')]['toUpperCase']())){try{_0x220881[_0xbda5('0x6c')]=_0x57b2ae['rawBody']?JSON[_0xbda5('0x6d')](_0x57b2ae[_0xbda5('0xb')]):{};}catch(_0x596491){logger[_0xbda5('0x2e')](_0xbda5('0x6e'),_0x596491);}}try{_0x220881['headers']=_0x57b2ae[_0xbda5('0xa')]?JSON[_0xbda5('0x6d')](_0x57b2ae[_0xbda5('0xa')]):{};}catch(_0x517f3a){logger[_0xbda5('0x2e')](_0xbda5('0x6f'),_0x517f3a);}if(_0x57b2ae[_0xbda5('0x70')]){try{var _0x6ca586=require(_0x57b2ae[_0xbda5('0x70')])['sync'](this,_0x220881);_0x220881[_0xbda5('0x71')]=Mustache[_0xbda5('0x72')](_0x57b2ae['url'],_0x6ca586,{},['$$','$$']);if(_0x220881[_0xbda5('0x73')]){_0x220881[_0xbda5('0x73')]=JSON[_0xbda5('0x6d')](Mustache[_0xbda5('0x72')](JSON['stringify'](_0x220881[_0xbda5('0x73')]),_0x6ca586,{},['$$','$$']));}if(_0x220881['body']){_0x220881[_0xbda5('0x6c')]=JSON[_0xbda5('0x6d')](Mustache[_0xbda5('0x72')](JSON[_0xbda5('0x74')](_0x220881['body']),_0x6ca586,{},['$$','$$']));}}catch(_0x341ce1){logger['error'](_0xbda5('0x75'),_0x341ce1);}}rp(_0x220881)[_0xbda5('0x14')](function(_0x5613a1){var _0x597d6d={'statusCode':_0x5613a1[_0xbda5('0x76')]||0xc8,'statusMessage':_0x5613a1['statusMessage']||'OK','headers':_0x5613a1[_0xbda5('0x73')]||{},'body':_0x5613a1['body']||{}};_0x486012(null,_0x597d6d);})[_0xbda5('0x16')](function(_0x5a396e){var _0x3f72d7={'statusCode':_0x5a396e['statusCode']||0x1f4,'statusMessage':_0x5a396e[_0xbda5('0x77')]||_0xbda5('0x78'),'headers':_0x5a396e[_0xbda5('0x79')][_0xbda5('0x73')]||{},'body':_0x5a396e[_0xbda5('0x79')]['body']||{}};_0x486012(null,_0x3f72d7);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x7a')]=function(_0x72bf19,_0xfcbc8e){scripts[_0xbda5('0x7a')](this['channel'][_0xbda5('0x38')],_0x72bf19['key'],_0x72bf19[_0xbda5('0x5d')],_0x72bf19['dialogflow_language']||'en')[_0xbda5('0x14')](function(_0x103f16){_0xfcbc8e(null,_0x103f16);})[_0xbda5('0x16')](function(_0x440641){_0xfcbc8e(_0x440641);});};AGIVertices[_0xbda5('0x11')]['googleDialogflowV2']=function(_0x531790,_0x237dce){scripts['googleDialogflowV2'](this['channel'][_0xbda5('0x38')],_0x531790[_0xbda5('0x7b')],_0x531790[_0xbda5('0x7c')],_0x531790[_0xbda5('0x7d')],_0x531790[_0xbda5('0x5d')],_0x531790[_0xbda5('0x7e')]||'en')[_0xbda5('0x14')](function(_0x9f1bb){_0x237dce(null,_0x9f1bb);})['catch'](function(_0x4aa205){_0x237dce(_0x4aa205);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x7f')]=function(_0x283f06,_0x4dd6d5){scripts[_0xbda5('0x7f')](this[_0xbda5('0x37')],_0x283f06)[_0xbda5('0x14')](function(_0x532129){_0x4dd6d5(null,_0x532129);})[_0xbda5('0x16')](function(_0x2e56a6){_0x4dd6d5(_0x2e56a6);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x80')]=function(_0x3cd9d9,_0x437e6e){scripts[_0xbda5('0x80')](_0x3cd9d9[_0xbda5('0x81')],_0x3cd9d9[_0xbda5('0x5d')],_0x3cd9d9[_0xbda5('0x82')]||_0xbda5('0x5f'),_0x3cd9d9['speed'])[_0xbda5('0x14')](function(_0x1e969f){_0x437e6e(null,_0x1e969f);})[_0xbda5('0x16')](function(_0x4391da){_0x437e6e(_0x4391da);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x83')]=function(_0x3c401c,_0x1cf850,_0x29489a){scripts[_0xbda5('0x83')](_0x1cf850,_0x3c401c[_0xbda5('0x81')],_0x3c401c['ispeech_asr_language']||_0xbda5('0x5f'),this['isConfigured'](_0x3c401c[_0xbda5('0x84')])?_0x3c401c[_0xbda5('0x84')]:undefined)[_0xbda5('0x14')](function(_0x2d536a){_0x29489a(null,_0x2d536a);})[_0xbda5('0x16')](function(_0x54be35){_0x29489a(_0x54be35);});};AGIVertices['prototype'][_0xbda5('0x85')]=function(_0x23d40b,_0xc364bf){scripts[_0xbda5('0x85')](_0x23d40b[_0xbda5('0x86')],_0x23d40b[_0xbda5('0x87')],_0x23d40b['aws_polly_region'],_0x23d40b[_0xbda5('0x88')]||_0xbda5('0x89'),_0x23d40b[_0xbda5('0x5d')],_0x23d40b[_0xbda5('0x8a')]||_0xbda5('0x5d'))[_0xbda5('0x14')](function(_0x4965ed){_0xc364bf(null,_0x4965ed);})[_0xbda5('0x16')](function(_0x1599b1){_0xc364bf(_0x1599b1);});};AGIVertices[_0xbda5('0x11')][_0xbda5('0x8b')]=function(_0x6ec40e,_0x1b34f6){scripts[_0xbda5('0x8b')](this['channel'][_0xbda5('0x38')],_0x6ec40e[_0xbda5('0x86')],_0x6ec40e[_0xbda5('0x87')],_0x6ec40e[_0xbda5('0x8c')],_0x6ec40e[_0xbda5('0x5d')],_0x6ec40e[_0xbda5('0x8d')])[_0xbda5('0x14')](function(_0x48d1ca){_0x1b34f6(null,_0x48d1ca);})['catch'](function(_0x55edc4){_0x1b34f6(_0x55edc4);});};AGIVertices['prototype']['googleASR']=function(_0x24f9a1,_0x1039c6,_0x2db980){scripts[_0xbda5('0x8e')](_0x1039c6,_0x24f9a1[_0xbda5('0x81')],_0x24f9a1['google_asr_language']||'en-US')[_0xbda5('0x14')](function(_0x26270f){_0x2db980(null,_0x26270f);})[_0xbda5('0x16')](function(_0x379b49){_0x2db980(_0x379b49);});};AGIVertices[_0xbda5('0x11')]['tildeASR']=function(_0x5bfd05,_0x17c9cb,_0x416df3){scripts['tildeASR'](_0x17c9cb,_0x5bfd05[_0xbda5('0x8f')],_0x5bfd05[_0xbda5('0x90')],_0x5bfd05[_0xbda5('0x71')])[_0xbda5('0x14')](function(_0x41cdbd){_0x416df3(null,_0x41cdbd);})[_0xbda5('0x16')](function(_0x4a1551){_0x416df3(_0x4a1551);});};AGIVertices[_0xbda5('0x11')]['clear']=function(_0x3c52c8){var _0x165fe7=_['includes'](verticesWithRetry,_0x3c52c8[_0xbda5('0x91')])?_0x3c52c8:_[_0xbda5('0x92')](_0x3c52c8);for(var _0x5e5c75 in _0x165fe7){if(_0x165fe7['hasOwnProperty'](_0x5e5c75)){if(_0x165fe7[_0x5e5c75]&&_[_0xbda5('0x93')](_0x165fe7[_0x5e5c75])){if(_['includes'](recursiveMapAttributes,_0x5e5c75)){_0x165fe7[_0x5e5c75]=this[_0xbda5('0x94')](_0x165fe7[_0x5e5c75]);}else{_0x165fe7[_0x5e5c75]=this['replaceAllVariables'](_0x165fe7[_0x5e5c75]);}}}}return _0x165fe7;};AGIVertices['prototype'][_0xbda5('0x95')]=function(_0xf6e808){for(var _0x1b1b2e in _0xf6e808){if(_0xf6e808['hasOwnProperty'](_0x1b1b2e)){if(_[_0xbda5('0x96')](_0xf6e808[_0x1b1b2e])){this[_0xbda5('0x95')](_0xf6e808[_0x1b1b2e]);}else if(_[_0xbda5('0x97')](_0xf6e808[_0x1b1b2e])){for(var _0x5511d8=0x0;_0x5511d8<_0xf6e808[_0x1b1b2e][_0xbda5('0x98')];_0x5511d8++){this[_0xbda5('0x95')](_0xf6e808[_0x1b1b2e][_0x5511d8]);}}else if(_[_0xbda5('0x93')](_0xf6e808[_0x1b1b2e])){_0xf6e808[_0x1b1b2e]=this[_0xbda5('0x99')](_0xf6e808[_0x1b1b2e]);}}}};AGIVertices[_0xbda5('0x11')][_0xbda5('0x9a')]=function(_0x5d0464,_0x50a613){for(var _0x1b4665 in _0x5d0464){if(_0x5d0464[_0xbda5('0x9b')](_0x1b4665)){if(_[_0xbda5('0x96')](_0x5d0464[_0x1b4665])){if(!_['isEmpty'](_0x5d0464[_0x1b4665])){this['saveRestApiResult'](_0x5d0464[_0x1b4665],util[_0xbda5('0x55')]('%s.%s',_0x50a613,_0x1b4665));}}else if(_[_0xbda5('0x97')](_0x5d0464[_0x1b4665])){for(var _0x4ba2e9=0x0;_0x4ba2e9<_0x5d0464[_0x1b4665]['length'];_0x4ba2e9++){this[_0xbda5('0x9a')](_0x5d0464[_0x1b4665][_0x4ba2e9],util[_0xbda5('0x55')](_0xbda5('0x9c'),_0x50a613,_0x1b4665+'['+_0x4ba2e9+']'));}}else{if(!_[_0xbda5('0x46')](_0x5d0464[_0x1b4665])){this['channel']['setVariable'](util[_0xbda5('0x55')](_0xbda5('0x9c'),_0x50a613,_0x1b4665),_0x5d0464[_0x1b4665]);}}}}};AGIVertices[_0xbda5('0x11')][_0xbda5('0x94')]=function(_0x4e8c98){try{var _0x448284=JSON['parse'](_0x4e8c98);this[_0xbda5('0x95')](_0x448284);return JSON['stringify'](_0x448284);}catch(_0x1a8a69){return this[_0xbda5('0x99')](_0x4e8c98);}};AGIVertices[_0xbda5('0x11')]['replaceAllVariables']=function(_0x53a5a0){var _0x21c692=_0x53a5a0[_0xbda5('0x9d')]('{');for(var _0x4137db=0x1;_0x4137db<_0x21c692[_0xbda5('0x98')];_0x4137db+=0x1){var _0x16a23a=_0x21c692[_0x4137db][_0xbda5('0x9d')]('}');if(_0x16a23a[_0xbda5('0x98')]>0x1){_0x53a5a0=_0x53a5a0['replaceAll']('{'+_0x16a23a[0x0]+'}',this['channel'][_0xbda5('0x12')](_0x16a23a[0x0])['extra']||_0x16a23a[0x0]);}}if(_0x21c692[_0xbda5('0x98')]===0x1){return _0x53a5a0['toString']();}return this['replaceAllVariables'](_0x53a5a0);};AGIVertices['prototype'][_0xbda5('0x9e')]=function(_0xf72e00,_0x33247e){var _0x1cc81e=this[_0xbda5('0x37')]['getVariable'](_0xf72e00);if(_0x1cc81e['result']===-0x1){return _0x1cc81e;}logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x9f'),_0x33247e,_0x1cc81e['extra']));return this[_0xbda5('0x37')]['setVariable'](_0x33247e,_0x1cc81e[_0xbda5('0xa0')]);};AGIVertices['prototype'][_0xbda5('0xa1')]=function(_0x4655ad){return _0x4655ad&&_0x4655ad!=='0'&&_0x4655ad!=='-1'&&_0x4655ad!=='';};AGIVertices['prototype'][_0xbda5('0xa2')]=function(_0x1048a5){this[_0xbda5('0xa3')][_0xbda5('0xa4')](this,_0x1048a5,'-');_0x1048a5['retry']=_0x1048a5[_0xbda5('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbda5('0x11')][_0xbda5('0xa5')]=function(_0x2e5654){logger['info'](util[_0xbda5('0x55')](_0xbda5('0xa6'),_0x2e5654[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x2e5654[_0xbda5('0x5d')])){return this[_0xbda5('0x37')]['noop']('no\x20text\x20configured');}var _0xce25c5='\x22'+_0x2e5654[_0xbda5('0x5d')]+'\x22';if(this[_0xbda5('0xa1')](_0x2e5654[_0xbda5('0x79')])){_0xce25c5+=','+_0x2e5654[_0xbda5('0x79')];}var _0x3bf673=this[_0xbda5('0x37')]['exec'](_0xbda5('0xa7'),_0xce25c5);if(_0x3bf673[_0xbda5('0xa8')]===-0x1){return _0x3bf673;}return this['channel']['noop'](util[_0xbda5('0x55')](_0xbda5('0xa9'),_0xce25c5));};AGIVertices[_0xbda5('0x11')][_0xbda5('0xaa')]=function(_0x13a49a){logger[_0xbda5('0x32')](util['format'](_0xbda5('0xab'),_0x13a49a[_0xbda5('0x39')]));if(!this['isConfigured'](_0x13a49a[_0xbda5('0xac')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xae'));}var _0x29ff60=_0x13a49a[_0xbda5('0xac')];if(this[_0xbda5('0xa1')](_0x13a49a[_0xbda5('0x79')])){_0x29ff60+=','+_0x13a49a['options'];}var _0x42e325=this[_0xbda5('0x37')]['exec'](_0xbda5('0xaf'),_0x29ff60);if(_0x42e325['result']===-0x1){return _0x42e325;}var _0x380784=this['getAndSetVariable'](_0xbda5('0xb0'),_0xbda5('0xb1'));if(_0x380784['result']===-0x1){return _0x380784;}var _0x171f0a=this['getAndSetVariable']('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x171f0a[_0xbda5('0xa8')]===-0x1){return _0x171f0a;}var _0x1323bd=this[_0xbda5('0x9e')]('RECOG_INSTANCE()',_0xbda5('0xb2'));if(_0x1323bd[_0xbda5('0xa8')]===-0x1){return _0x1323bd;}return this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0xb3'),_0x29ff60));};AGIVertices['prototype'][_0xbda5('0x8')]=function(_0x302ca4){logger[_0xbda5('0x32')](util['format'](_0xbda5('0xb4'),_0x302ca4[_0xbda5('0x39')]));return this[_0xbda5('0x37')]['agi']([_0x302ca4['command'],_0x302ca4[_0xbda5('0xb5')]]);};AGIVertices[_0xbda5('0x11')][_0xbda5('0xb6')]=function(_0x5a5435){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0xb7'),_0x5a5435['label']));if(this[_0xbda5('0xa1')](_0x5a5435[_0xbda5('0x69')])){logger[_0xbda5('0x32')](util[_0xbda5('0x55')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x5a5435[_0xbda5('0x69')]));var _0x26c6d2=this[_0xbda5('0x37')][_0xbda5('0xb8')](_0x5a5435['timeout']);if(_0x26c6d2[_0xbda5('0xa8')]===-0x1){return _0x26c6d2;}}return this[_0xbda5('0x37')][_0xbda5('0xb6')]();};AGIVertices[_0xbda5('0x11')]['callback']=function(_0x2b8d5f){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0xb9'),_0x2b8d5f['label']));if(!this['isConfigured'](_0x2b8d5f[_0xbda5('0x4a')])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x2b8d5f,_0xbda5('0xba'));}_0x2b8d5f['scheduledAt']=moment();if(this[_0xbda5('0xa1')](_0x2b8d5f[_0xbda5('0xbb')])){_0x2b8d5f[_0xbda5('0x4b')]=moment()[_0xbda5('0xbc')](_0x2b8d5f[_0xbda5('0xbb')],_0xbda5('0xbd'));}if(!this['isConfigured'](_0x2b8d5f['callback_priority'])){_0x2b8d5f['callback_priority']=0x2;}this[_0xbda5('0x44')][_0xbda5('0xa4')](this,_0x2b8d5f);return this[_0xbda5('0x37')][_0xbda5('0xad')](util['format'](_0xbda5('0xbe'),_0x2b8d5f[_0xbda5('0x49')],_0x2b8d5f[_0xbda5('0x4a')],_0x2b8d5f[_0xbda5('0x4b')]));};AGIVertices[_0xbda5('0x11')]['custom_app']=function(_0x1d8ada){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0xbf'),_0x1d8ada['label']));var _0x444869=this['channel'][_0xbda5('0x59')](_0x1d8ada['application'],_0x1d8ada['options']);if(_0x444869['result']===-0x1){return _0x444869;}return this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0xc0'),_0x1d8ada['application'],_0x1d8ada[_0xbda5('0x79')]));};AGIVertices[_0xbda5('0x11')][_0xbda5('0xc1')]=function(_0x5cd311){logger['info'](util[_0xbda5('0x55')](_0xbda5('0xc2'),_0x5cd311[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x5cd311[_0xbda5('0x5d')])){return this['channel'][_0xbda5('0xad')]('no\x20text\x20configured');}var _0x49726e='\x22'+_0x5cd311['text']+'\x22';if(this[_0xbda5('0xa1')](_0x5cd311[_0xbda5('0x79')])){_0x49726e+=','+_0x5cd311['options'];}var _0x1e03f2=this[_0xbda5('0x37')][_0xbda5('0x59')](_0xbda5('0xa7'),_0x49726e);if(_0x1e03f2[_0xbda5('0xa8')]===-0x1){return _0x1e03f2;}return this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')](_0xbda5('0xa9'),_0x49726e));};AGIVertices[_0xbda5('0x11')][_0xbda5('0xc3')]=function(_0x598350){logger['info'](util[_0xbda5('0x55')](_0xbda5('0xc4'),_0x598350[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x598350[_0xbda5('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x55f71c='\x22'+_0x598350[_0xbda5('0x5d')]+'\x22';if(this[_0xbda5('0xa1')](_0x598350['options'])){_0x55f71c+=','+_0x598350[_0xbda5('0x79')];}var _0x3e106b=this['channel']['exec']('MRCPSynth',_0x55f71c);if(_0x3e106b['result']===-0x1){return _0x3e106b;}return this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')]('Executed\x20command\x20MRCPSynth\x20%s',_0x55f71c));};AGIVertices[_0xbda5('0x11')]['lumenvoxasr']=function(_0x211038){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0xc5'),_0x211038[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x211038[_0xbda5('0xac')])){return this[_0xbda5('0x37')]['noop'](_0xbda5('0xae'));}var _0x49d2de=_0x211038['grammar'];if(this[_0xbda5('0xa1')](_0x211038[_0xbda5('0x79')])){_0x49d2de+=','+_0x211038[_0xbda5('0x79')];}var _0x56cb67=this['channel']['exec']('MRCPRecog',_0x49d2de);if(_0x56cb67[_0xbda5('0xa8')]===-0x1){return _0x56cb67;}var _0xad1dca=this[_0xbda5('0x9e')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0xad1dca['result']===-0x1){return _0xad1dca;}var _0x2183e2=this[_0xbda5('0x9e')](_0xbda5('0xc6'),_0xbda5('0xc7'));if(_0x2183e2[_0xbda5('0xa8')]===-0x1){return _0x2183e2;}var _0x59628f=this[_0xbda5('0x9e')](_0xbda5('0xc8'),'LUMENVOX_ASR_INSTANCE');if(_0x59628f['result']===-0x1){return _0x59628f;}return this[_0xbda5('0x37')][_0xbda5('0xad')](util['format'](_0xbda5('0xb3'),_0x49d2de));};AGIVertices[_0xbda5('0x11')][_0xbda5('0xc9')]=function(_0x2f1ea8){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0xca'),_0x2f1ea8[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x2f1ea8[_0xbda5('0xac')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xae'));}var _0x40971d=_0x2f1ea8[_0xbda5('0xac')];if(this[_0xbda5('0xa1')](_0x2f1ea8[_0xbda5('0x79')])){_0x40971d+=','+_0x2f1ea8['options'];}var _0x3645bf=this['channel'][_0xbda5('0x59')]('MRCPRecog',_0x40971d);if(_0x3645bf[_0xbda5('0xa8')]===-0x1){return _0x3645bf;}var _0x1b9f02=this[_0xbda5('0x9e')](_0xbda5('0xb0'),_0xbda5('0xcb'));if(_0x1b9f02[_0xbda5('0xa8')]===-0x1){return _0x1b9f02;}var _0x587be4=this[_0xbda5('0x9e')](_0xbda5('0xc6'),'SESTEK_ASR_TRANSCRIPT');if(_0x587be4[_0xbda5('0xa8')]===-0x1){return _0x587be4;}var _0x900090=this[_0xbda5('0x9e')](_0xbda5('0xc8'),_0xbda5('0xcc'));if(_0x900090['result']===-0x1){return _0x900090;}return this[_0xbda5('0x37')]['noop'](util['format'](_0xbda5('0xb3'),_0x40971d));};AGIVertices[_0xbda5('0x11')][_0xbda5('0xcd')]=function(_0x5a7ae5){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0xce'),_0x5a7ae5[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x5a7ae5['odbc_id'])){return this[_0xbda5('0x37')]['error'](_0x5a7ae5,_0xbda5('0xcf'));}var _0x4589a4=this[_0xbda5('0x1b')][_0xbda5('0xa4')](this,_0x5a7ae5[_0xbda5('0xd0')]);if(!_0x4589a4){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x5a7ae5,_0xbda5('0xd1'));}if(!this['isConfigured'](_0x5a7ae5[_0xbda5('0x31')])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x5a7ae5,'no\x20query\x20configured');}var _0x17bbb1=_0x5a7ae5[_0xbda5('0x31')][_0xbda5('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xbda5('0x37')][_0xbda5('0xad')](util['format']('query:\x20%s',_0x17bbb1));var _0xf51116=this['getQueryOdbc'][_0xbda5('0xa4')](this,_0x4589a4,_0x17bbb1);this[_0xbda5('0xa3')][_0xbda5('0xa4')](this,_0x5a7ae5,_0x17bbb1);if(!this['isConfigured'](_0x5a7ae5[_0xbda5('0xd2')])){return this[_0xbda5('0x37')][_0xbda5('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x18882a=this[_0xbda5('0x12')][_0xbda5('0xa4')](this,_0x5a7ae5[_0xbda5('0xd2')]);if(!_0x18882a){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x5a7ae5,_0xbda5('0xd3'));}var _0x69150a=this;_0xf51116[_0xbda5('0xd4')](function(_0xe517f8,_0x38011f){Object[_0xbda5('0xd5')](_0xe517f8)[_0xbda5('0xd4')](function(_0x17c6c2){_0x69150a['channel'][_0xbda5('0xd6')](util[_0xbda5('0x55')](_0xbda5('0xd7'),_0x18882a,_0x38011f,_0x17c6c2),_0xe517f8[_0x17c6c2]);});});this[_0xbda5('0x37')][_0xbda5('0xd6')](util['format']('%s_ROWS_COUNT',_0x18882a),_0xf51116[_0xbda5('0x98')]);return this[_0xbda5('0x37')][_0xbda5('0xad')](util['format']('variable\x20%s\x20set',_0x18882a));};AGIVertices[_0xbda5('0x11')]['dial']=function(_0x2d20bf){logger['debug'](util['format'](_0xbda5('0xd8'),_0x2d20bf[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x2d20bf[_0xbda5('0xd9')])){return this['channel'][_0xbda5('0x2e')](_0x2d20bf,_0xbda5('0xda'));}var _0x3848b3=this['getUser'][_0xbda5('0xa4')](this,_0x2d20bf[_0xbda5('0xd9')]);if(!_0x3848b3){return this['channel'][_0xbda5('0x2e')](_0x2d20bf,_0xbda5('0xdb'));}var _0x5a4261=this[_0xbda5('0x37')][_0xbda5('0x59')](_0xbda5('0xdc'),[util[_0xbda5('0x55')]('SIP/%s',_0x3848b3),_0x2d20bf['timeout'],_0x2d20bf['opts'],_0x2d20bf[_0xbda5('0x67')]]);if(_0x5a4261[_0xbda5('0xa8')]===-0x1){return _0x5a4261;}return this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')](_0xbda5('0xdd'),_0xbda5('0xdc')));};AGIVertices[_0xbda5('0x11')][_0xbda5('0xde')]=function(_0x20a1ab){logger['info'](util[_0xbda5('0x55')](_0xbda5('0xdf'),_0x20a1ab[_0xbda5('0x39')]));if(!this['isConfigured'](_0x20a1ab[_0xbda5('0x81')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xe0'));}if(!this[_0xbda5('0xa1')](_0x20a1ab[_0xbda5('0x5d')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xe1'));}this[_0xbda5('0x37')]['bot']=!![];this[_0xbda5('0xa3')](_0x20a1ab);this[_0xbda5('0x43')](_0x20a1ab[_0xbda5('0x5d')],'in','','');this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0xe2'),_0x20a1ab[_0xbda5('0x5d')]));var _0x337711=this[_0xbda5('0x7a')][_0xbda5('0xa4')](this,_0x20a1ab);if(_0x337711){for(var _0x372223 in _0x337711){if(_0x337711[_0xbda5('0x9b')](_0x372223)){this[_0xbda5('0x37')][_0xbda5('0xd6')](util[_0xbda5('0x55')](_0xbda5('0xe3'),_0x372223[_0xbda5('0xe4')]()),_0x337711[_0x372223]);}}this[_0xbda5('0x43')](_0x337711[_0xbda5('0xe5')],'out',_0xbda5('0xde'),'');return this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0xe6'),_0x337711[_0xbda5('0xe5')]));}return this[_0xbda5('0x37')]['error'](_0x20a1ab,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xbda5('0xe7')]=function(_0x2fad61){logger['info'](util[_0xbda5('0x55')](_0xbda5('0xe8'),_0x2fad61[_0xbda5('0x39')]));if(!this['isConfigured'](_0x2fad61[_0xbda5('0x7b')])){return this['channel'][_0xbda5('0xad')](_0xbda5('0xe9'));}if(!this['isConfigured'](_0x2fad61[_0xbda5('0x7c')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xea'));}if(!this[_0xbda5('0xa1')](_0x2fad61[_0xbda5('0x7d')])){return this['channel'][_0xbda5('0xad')](_0xbda5('0xeb'));}if(!this[_0xbda5('0xa1')](_0x2fad61[_0xbda5('0x7e')])){return this[_0xbda5('0x37')]['noop'](_0xbda5('0xec'));}if(!this[_0xbda5('0xa1')](_0x2fad61[_0xbda5('0x5d')])){return this['channel'][_0xbda5('0xad')]('no\x20text\x20configured');}this[_0xbda5('0x37')][_0xbda5('0xed')]=!![];this[_0xbda5('0xa3')](_0x2fad61);this['createSquareMessage'](_0x2fad61[_0xbda5('0x5d')],'in','','');this['channel']['noop'](util[_0xbda5('0x55')](_0xbda5('0xee'),_0x2fad61['text']));var _0x220c86=this[_0xbda5('0xef')][_0xbda5('0xa4')](this,_0x2fad61);if(_0x220c86){for(var _0x31ad4a in _0x220c86){if(_0x220c86[_0xbda5('0x9b')](_0x31ad4a)){if(_0x31ad4a!=='providerResponse'){this[_0xbda5('0x37')][_0xbda5('0xd6')](util[_0xbda5('0x55')](_0xbda5('0xe3'),_0x31ad4a[_0xbda5('0xe4')]()),_0x220c86[_0x31ad4a]);}}}this[_0xbda5('0x43')](_0x220c86['speech'],'out','dialogflowV2',_0x220c86[_0xbda5('0xf0')]);return this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0xf1'),_0x220c86['speech']));}return this[_0xbda5('0x37')]['error'](_0x2fad61,_0xbda5('0xf2'));};AGIVertices[_0xbda5('0x11')][_0xbda5('0xf3')]=function(_0x4482ff){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0xf4'),_0x4482ff[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x4482ff[_0xbda5('0xf5')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xf6'));}if(!this[_0xbda5('0xa1')](_0x4482ff[_0xbda5('0xf7')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xf8'));}if(!this[_0xbda5('0xa1')](_0x4482ff['password'])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0xbda5('0xa1')](_0x4482ff['ndassistant_url'])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xe1'));}this['channel'][_0xbda5('0xed')]=!![];this[_0xbda5('0xa3')](_0x4482ff);this[_0xbda5('0x43')](_0x4482ff[_0xbda5('0x5d')],'in','','');this[_0xbda5('0x37')]['noop'](util['format'](_0xbda5('0xf9'),_0x4482ff[_0xbda5('0x5d')]));var _0x4f6c73=this[_0xbda5('0x7f')][_0xbda5('0xa4')](this,_0x4482ff);if(_0x4f6c73){for(var _0xd133bc in _0x4f6c73){if(_0x4f6c73[_0xbda5('0x9b')](_0xd133bc)){this[_0xbda5('0x37')][_0xbda5('0xd6')](util[_0xbda5('0x55')](_0xbda5('0xfa'),_0xd133bc[_0xbda5('0xe4')]()),_0x4f6c73[_0xd133bc]);}}this['createSquareMessage'](_0x4f6c73[_0xbda5('0xe5')],_0xbda5('0xfb'),_0xbda5('0xf3'),'');if(_0x4f6c73[_0xbda5('0xfc')]){this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x4f6c73[_0xbda5('0xfc')]));var _0x169f0b=this[_0xbda5('0x37')][_0xbda5('0xfd')](_0x4f6c73[_0xbda5('0xfc')]);try{fs[_0xbda5('0xfe')](_0x4f6c73[_0xbda5('0xfc')]+_0xbda5('0xff'));}catch(_0x35f202){logger[_0xbda5('0x2e')](_0x35f202);}return _0x169f0b;}else{return this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x100'),_0x4f6c73[_0xbda5('0xe5')]));}}return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x4482ff,_0xbda5('0x101'));};AGIVertices['prototype'][_0xbda5('0x102')]=function(_0x21079d){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x103'),_0x21079d['label']));return this['channel'][_0xbda5('0xad')](_0xbda5('0x102'));};AGIVertices[_0xbda5('0x11')]['ext_dial']=function(_0x252d50){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x104'),_0x252d50[_0xbda5('0x39')]));var _0x27d0f0='';if(_0x252d50[_0xbda5('0x105')]){if(!this[_0xbda5('0xa1')](_0x252d50[_0xbda5('0x105')])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x252d50,_0xbda5('0x106'));}else{var _0x1629a2=parseInt(_0x252d50[_0xbda5('0x105')],0xa);if(isNaN(_0x1629a2)){_0x27d0f0=_0x252d50['trunk_id'];}else{_0x27d0f0=this[_0xbda5('0x107')][_0xbda5('0xa4')](this,_0x252d50[_0xbda5('0x105')]);if(!_0x27d0f0){return this['channel'][_0xbda5('0x2e')](_0x252d50,_0xbda5('0x108'));}}}}else if(_0x252d50[_0xbda5('0x109')]){_0x27d0f0=_0x252d50[_0xbda5('0x109')];}else{return this['channel']['error'](_0x252d50,_0xbda5('0x106'));}var _0x7958a7=this[_0xbda5('0x37')][_0xbda5('0x59')](_0xbda5('0xdc'),[util[_0xbda5('0x55')]('SIP/%s/%s',_0x27d0f0,_0x252d50[_0xbda5('0x49')]),_0x252d50[_0xbda5('0x69')],_0x252d50['opts'],_0x252d50[_0xbda5('0x67')]]);if(_0x7958a7[_0xbda5('0xa8')]===-0x1){return _0x7958a7;}return this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x10a')]=function(_0x3f79b1){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x10b'),_0x3f79b1[_0xbda5('0x39')]));return this[_0xbda5('0x37')][_0xbda5('0xad')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x1864b5){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x10c'),_0x1864b5[_0xbda5('0x39')]));if(_0x1864b5[_0xbda5('0x10d')]===0x0){return this[_0xbda5('0xa2')](_0x1864b5);}_0x1864b5['retry']-=0x1;if(!this[_0xbda5('0xa1')](_0x1864b5[_0xbda5('0x10e')])){return this['channel']['error'](_0x1864b5,'no\x20file\x20audio\x20selected');}var _0x504ec2=this[_0xbda5('0x20')]['sync'](this,_0x1864b5['file_id']);if(!_0x504ec2){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x1864b5,_0xbda5('0x10f'));}if(!this[_0xbda5('0xa1')](_0x1864b5[_0xbda5('0xd2')])){return this['channel'][_0xbda5('0x2e')](_0xbda5('0x110'));}var _0x2fa518=this['channel'][_0xbda5('0x111')](_0x504ec2,_0x1864b5[_0xbda5('0x112')],_0x1864b5['maxdigit']);var _0x39458d=_0x2fa518[_0xbda5('0xa8')]?_0x2fa518[_0xbda5('0xa8')][_0xbda5('0x4d')]():'';logger['info'](_0xbda5('0x113'),JSON[_0xbda5('0x74')](_0x2fa518));if(_0x2fa518['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x1864b5,_0x39458d);return _0x2fa518;}else if(_0x2fa518['extra']===_0xbda5('0x69')){_0x2fa518[_0xbda5('0xa8')]=_0x39458d[_0xbda5('0x98')]>=parseInt(_0x1864b5[_0xbda5('0x114')])?'x':'i';}else{_0x2fa518[_0xbda5('0xa8')]=_0x39458d[_0xbda5('0x98')]>=parseInt(_0x1864b5[_0xbda5('0x114')])&&_0x39458d[_0xbda5('0x98')]<=parseInt(_0x1864b5[_0xbda5('0x115')])?'x':'i';}var _0x3de0c6=this[_0xbda5('0x12')]['sync'](this,_0x1864b5['variable_id']);if(!_0x3de0c6){return this['channel'][_0xbda5('0x2e')](_0x1864b5,'no\x20variable\x20found');}this[_0xbda5('0x37')]['setVariable'](_0x3de0c6,_0x39458d);if(this[_0xbda5('0xa1')](_0x1864b5[_0xbda5('0x116')])){var _0x3814b3=parseInt(_0x1864b5[_0xbda5('0x116')],0xa);var _0x315221=rs['generate']({'charset':'*','length':_0x3814b3});var _0x468467=_0x39458d[_0xbda5('0x98')];if(_0x468467>0x0){if(_0x468467>_0x3814b3){this[_0xbda5('0xa3')][_0xbda5('0xa4')](this,_0x1864b5,_0x1864b5[_0xbda5('0x117')]==='first'?_0x315221+_0x39458d['substr'](_0x3814b3):_0x39458d[_0xbda5('0x118')](0x0,_0x468467-_0x3814b3)+_0x315221);}else{this[_0xbda5('0xa3')][_0xbda5('0xa4')](this,_0x1864b5,rs[_0xbda5('0x119')]({'charset':'*','length':_0x468467}));}}else{this['createSquareDetailsReport'][_0xbda5('0xa4')](this,_0x1864b5,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x1864b5,_0x39458d);}return _0x2fa518;};AGIVertices[_0xbda5('0x11')][_0xbda5('0xe')]=function(_0x1ad0a2){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x11a'),_0x1ad0a2[_0xbda5('0x39')]));return this[_0xbda5('0xd')](_0x1ad0a2);};AGIVertices['prototype']['goal']=function(_0x3598ac){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x11b'),_0x3598ac[_0xbda5('0x39')]));this['createSquareDetailsReport'][_0xbda5('0xa4')](this,_0x3598ac,_0x3598ac[_0xbda5('0x11c')]);return this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x11d'),_0x3598ac['goalname']));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x11e')]=function(_0x537871){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x11f'),_0x537871[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x537871[_0xbda5('0x86')])||!this[_0xbda5('0xa1')](_0x537871[_0xbda5('0x87')])){return this[_0xbda5('0x37')][_0xbda5('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xbda5('0xa1')](_0x537871['text'])){return this[_0xbda5('0x37')]['noop'](_0xbda5('0xe1'));}this['channel']['noop'](util[_0xbda5('0x55')](_0xbda5('0x120'),_0x537871[_0xbda5('0x5d')]));var _0x2d614a=this[_0xbda5('0x85')][_0xbda5('0xa4')](this,_0x537871);if(_0x2d614a){this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x121'),_0x2d614a));var _0xb53b77=this[_0xbda5('0x37')][_0xbda5('0xfd')](_0x2d614a);try{fs[_0xbda5('0xfe')](_0x2d614a+_0xbda5('0xff'));}catch(_0x23330f){logger['error'](_0x23330f);}return _0xb53b77;}return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x537871,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x44267f){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x122'),_0x44267f[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x44267f[_0xbda5('0x86')])||!this[_0xbda5('0xa1')](_0x44267f['aws_secret_access_key'])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x123'));}if(!this['isConfigured'](_0x44267f[_0xbda5('0x8d')])){return this['channel']['noop'](_0xbda5('0x124'));}if(!this[_0xbda5('0xa1')](_0x44267f[_0xbda5('0x5d')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0xe1'));}this[_0xbda5('0x37')][_0xbda5('0xed')]=!![];this[_0xbda5('0xa3')](_0x44267f);this[_0xbda5('0x43')](_0x44267f[_0xbda5('0x5d')],'in','','');this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')]('Trying\x20Amazon\x20Lex:\x20%s',_0x44267f[_0xbda5('0x5d')]));var _0x5cf22c=this[_0xbda5('0x8b')][_0xbda5('0xa4')](this,_0x44267f);if(_0x5cf22c){for(var _0x1aabb6 in _0x5cf22c){if(_0x5cf22c[_0xbda5('0x9b')](_0x1aabb6)&&_[_0xbda5('0x93')](_0x5cf22c[_0x1aabb6])){this['channel'][_0xbda5('0xd6')](util[_0xbda5('0x55')](_0xbda5('0x125'),_0x1aabb6[_0xbda5('0xe4')]()),_0x5cf22c[_0x1aabb6]);}}if(_[_0xbda5('0x46')](_0x5cf22c[_0xbda5('0x77')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x126'));}else{this[_0xbda5('0x43')](_0x5cf22c[_0xbda5('0x77')],_0xbda5('0xfb'),_0xbda5('0x127'),'');return this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x128'),_0x5cf22c[_0xbda5('0x77')]));}}return this['channel'][_0xbda5('0x2e')](_0x44267f,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xbda5('0x11')]['googleasr']=function(_0x2cec2c){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x129'),_0x2cec2c[_0xbda5('0x39')],_0x2cec2c[_0xbda5('0x69')]));if(!this[_0xbda5('0xa1')](_0x2cec2c[_0xbda5('0x81')])){return this[_0xbda5('0x37')]['noop'](_0xbda5('0xe0'));}var _0xa0cfff=_0xbda5('0x12a');var _0x3c4e95=util[_0xbda5('0x55')](_0xbda5('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x336277=util[_0xbda5('0x55')]('%s.%s',_0x3c4e95,_0xa0cfff);var _0x3e20a4=!![];if(_0x2cec2c[_0xbda5('0x12c')]===_0xbda5('0x12d')){_0x3e20a4=![];}var _0x3fd353=this[_0xbda5('0x37')]['recordFile'](_0x3c4e95,_0xa0cfff,_0x2cec2c[_0xbda5('0x12e')],_0x2cec2c[_0xbda5('0x69')],undefined,_0x3e20a4);if(_0x3fd353[_0xbda5('0xa8')]!==-0x1){this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x12f'),_0x336277));var _0x19a89f=this[_0xbda5('0x8e')][_0xbda5('0xa4')](this,_0x2cec2c,_0x336277);if(_0x19a89f){for(var _0x355ddf in _0x19a89f){if(_0x19a89f[_0xbda5('0x9b')](_0x355ddf)){this[_0xbda5('0x37')][_0xbda5('0xd6')](util[_0xbda5('0x55')](_0xbda5('0x130'),_0x355ddf['toUpperCase']()),_0x19a89f[_0x355ddf]);}}return this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x131'),JSON['stringify'](_0x19a89f)));}}return _0x3fd353;};AGIVertices[_0xbda5('0x11')][_0xbda5('0x132')]=function(_0x45f730){logger['info'](util[_0xbda5('0x55')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x45f730[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x45f730[_0xbda5('0x8f')])){return this['channel']['noop'](_0xbda5('0x133'));}if(!this['isConfigured'](_0x45f730[_0xbda5('0x90')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x134'));}var _0xd823c7=_0xbda5('0x12a');var _0x3a2394=util[_0xbda5('0x55')](_0xbda5('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x37f8ab=util[_0xbda5('0x55')](_0xbda5('0x9c'),_0x3a2394,_0xd823c7);var _0x45482f=!![];if(_0x45f730[_0xbda5('0x12c')]===_0xbda5('0x12d')){_0x45482f=![];}var _0x1f919b=this[_0xbda5('0x37')]['recordFile'](_0x3a2394,_0xd823c7,_0x45f730[_0xbda5('0x12e')],_0x45f730['timeout'],undefined,_0x45482f);if(_0x1f919b[_0xbda5('0xa8')]!==-0x1){this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')]('tilde\x20%s\x20file\x20created',_0x37f8ab));var _0x4e2d5f=this[_0xbda5('0x135')][_0xbda5('0xa4')](this,_0x45f730,_0x37f8ab);if(_0x4e2d5f){for(var _0xb7ab0e in _0x4e2d5f){if(_0x4e2d5f[_0xbda5('0x9b')](_0xb7ab0e)){this[_0xbda5('0x37')]['setVariable'](util[_0xbda5('0x55')](_0xbda5('0x136'),_0xb7ab0e[_0xbda5('0xe4')]()),_0x4e2d5f[_0xb7ab0e]);}}return this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x137'),JSON[_0xbda5('0x74')](_0x4e2d5f)));}}return _0x1f919b;};AGIVertices[_0xbda5('0x11')]['gotoc']=function(_0x30577e){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x138'),_0x30577e[_0xbda5('0x39')]));return this['channel'][_0xbda5('0x139')](_0x30577e[_0xbda5('0x13a')],_0x30577e['extension'],_0x30577e[_0xbda5('0x3f')]);};AGIVertices['prototype'][_0xbda5('0x13b')]=function(_0x133b30){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x13c'),_0x133b30[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x133b30['condition'])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x133b30,_0xbda5('0x13d'));}try{var _0x1c04a0=eval(_0x133b30[_0xbda5('0x13e')])?_0xbda5('0x13f'):_0xbda5('0x140');this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x141'),_0x133b30[_0xbda5('0x13e')],_0x1c04a0));return{'code':0xc8,'result':_0x1c04a0};}catch(_0xc1fe19){return{'code':0xc8,'result':_0xbda5('0x140')};}};AGIVertices[_0xbda5('0x11')][_0xbda5('0x142')]=function(_0x1fcc5a){logger[_0xbda5('0x32')](util[_0xbda5('0x55')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1fcc5a['label']));if(!this[_0xbda5('0xa1')](_0x1fcc5a[_0xbda5('0x143')])){return this[_0xbda5('0x37')]['error'](_0x1fcc5a,_0xbda5('0x144'));}var _0x395276=this[_0xbda5('0x25')][_0xbda5('0xa4')](this,_0x1fcc5a[_0xbda5('0x143')]);if(!_0x395276){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x1fcc5a,_0xbda5('0x145'));}for(var _0x3da125=0x0;_0x3da125<_0x395276[_0xbda5('0x98')];_0x3da125+=0x1){var _0x1d87a0=this[_0xbda5('0x37')][_0xbda5('0x12')](util[_0xbda5('0x55')]('IFTIME(%s?true:false)',_0x395276[_0x3da125]));if(_0x1d87a0[_0xbda5('0xa8')]===-0x1){return _0x1d87a0;}logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x146'),_0x395276[_0x3da125],_0x1d87a0['extra']));if(_0x1d87a0[_0xbda5('0xa0')]==='true'){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x146'),_0x395276[_0x3da125],'true'));this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x146'),_0x395276[_0x3da125],_0xbda5('0x13f')));return{'code':0xc8,'result':_0xbda5('0x13f')};}else{logger[_0xbda5('0x32')](util['format']('IFTIME\x20%s\x20%s',_0x395276[_0x3da125],_0xbda5('0x140')));this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x146'),_0x395276[_0x3da125],_0xbda5('0x140')));}}return{'code':0xc8,'result':_0xbda5('0x140')};};AGIVertices[_0xbda5('0x11')][_0xbda5('0x147')]=function(_0x345b67){logger['info'](util[_0xbda5('0x55')](_0xbda5('0x148'),_0x345b67[_0xbda5('0x39')]));return this['channel']['hangup']();};AGIVertices[_0xbda5('0x11')]['ispeechasr']=function(_0x5a0c1f){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x149'),_0x5a0c1f[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x5a0c1f['key'])){return this[_0xbda5('0x37')]['noop']('no\x20key\x20configured');}var _0x468d32=_0xbda5('0x12a');var _0x2f28d0=util[_0xbda5('0x55')](_0xbda5('0x12b'),FILES_PATH,rs[_0xbda5('0x119')](0x4));var _0x4167ec=util[_0xbda5('0x55')](_0xbda5('0x9c'),_0x2f28d0,_0x468d32);var _0x240e43=!![];if(_0x5a0c1f[_0xbda5('0x12c')]==='NOBEEP'){_0x240e43=![];}var _0x2b7957=this[_0xbda5('0x37')][_0xbda5('0x14a')](_0x2f28d0,_0x468d32,_0x5a0c1f[_0xbda5('0x12e')],_0x5a0c1f['timeout'],undefined,_0x240e43);if(_0x2b7957['result']!==-0x1){this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x14b'),_0x4167ec));var _0x5b020e=this['ispeechASR'][_0xbda5('0xa4')](this,_0x5a0c1f,_0x4167ec);if(_0x5b020e){for(var _0x5f0a17 in _0x5b020e){if(_0x5b020e[_0xbda5('0x9b')](_0x5f0a17)){this[_0xbda5('0x37')][_0xbda5('0xd6')](util['format'](_0xbda5('0x14c'),_0x5f0a17[_0xbda5('0xe4')]()),_0x5b020e[_0x5f0a17]);}}return this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')](_0xbda5('0x14d'),JSON[_0xbda5('0x74')](_0x5b020e)));}}return _0x2b7957;};AGIVertices['prototype'][_0xbda5('0x14e')]=function(_0x4184b4){logger['info'](util[_0xbda5('0x55')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4184b4[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x4184b4[_0xbda5('0x81')])){return this[_0xbda5('0x37')]['noop'](_0xbda5('0xe0'));}if(!this[_0xbda5('0xa1')](_0x4184b4[_0xbda5('0x5d')])){return this[_0xbda5('0x37')]['noop']('no\x20text\x20configured');}this[_0xbda5('0x37')][_0xbda5('0xad')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x4184b4[_0xbda5('0x5d')]));var _0x31ad08=this[_0xbda5('0x80')][_0xbda5('0xa4')](this,_0x4184b4);if(_0x31ad08){this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x14b'),_0x31ad08));var _0x29c022=this[_0xbda5('0x37')][_0xbda5('0xfd')](_0x31ad08,_0x4184b4[_0xbda5('0x12e')]);try{fs[_0xbda5('0xfe')](_0x31ad08+'.wav');}catch(_0x3a3e66){logger[_0xbda5('0x2e')](_0x3a3e66);}return _0x29c022;}return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x4184b4,_0xbda5('0x14f'));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x150')]=function(_0x2091da){logger[_0xbda5('0x32')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2091da[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x2091da[_0xbda5('0x151')])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x2091da,_0xbda5('0x152'));}logger['info'](util[_0xbda5('0x55')](_0xbda5('0x153'),this['channel'][_0xbda5('0x3c')],_0x2091da['findBy']));var _0x56a1aa=this[_0xbda5('0x54')]['sync'](this,_0x2091da[_0xbda5('0x151')]);if(_0x56a1aa){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xbda5('0x3c')],_0x2091da[_0xbda5('0x151')]));this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x154'),this[_0xbda5('0x37')]['callerid'],_0x2091da[_0xbda5('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x155'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x2091da[_0xbda5('0x151')]));this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x155'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x2091da[_0xbda5('0x151')]));return{'code':0xc8,'result':_0xbda5('0x156')};}};AGIVertices[_0xbda5('0x11')]['logout']=function(_0x4bd506){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x157'),_0x4bd506[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x4bd506[_0xbda5('0x151')])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x4bd506,'no\x20find\x20by\x20configured');}logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x153'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x4bd506['findBy']));var _0x42cc3f=this[_0xbda5('0x53')][_0xbda5('0xa4')](this,_0x4bd506[_0xbda5('0x151')]);if(_0x42cc3f){logger[_0xbda5('0x32')](util[_0xbda5('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x4bd506[_0xbda5('0x151')]));this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')](_0xbda5('0x154'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x4bd506[_0xbda5('0x151')]));return{'code':0xc8,'result':_0xbda5('0x158')};}else{logger[_0xbda5('0x32')](util[_0xbda5('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x4bd506[_0xbda5('0x151')]));this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x4bd506['findBy']));return{'code':0xc8,'result':_0xbda5('0x156')};}};AGIVertices['prototype'][_0xbda5('0x159')]=function(_0x37bfa1){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x15a'),_0x37bfa1['label']));if(!this['isConfigured'](_0x37bfa1['operation'])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x37bfa1,_0xbda5('0x15b'));}this[_0xbda5('0x37')]['noop'](util['format'](_0xbda5('0x15c'),_0x37bfa1[_0xbda5('0x15d')]));var _0x131438=eval(_0x37bfa1['operation']);if(!this['isConfigured'](_0x37bfa1[_0xbda5('0xd2')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x110'));}var _0x3d08fd=this[_0xbda5('0x12')][_0xbda5('0xa4')](this,_0x37bfa1[_0xbda5('0xd2')]);if(!_0x3d08fd){return this['channel'][_0xbda5('0x2e')](_0x37bfa1,'no\x20variable\x20found');}if(_[_0xbda5('0x97')](_0x131438)){var _0x5ee637=this;_0x131438['forEach'](function(_0x4de116,_0x5409b2){_0x5ee637[_0xbda5('0x37')]['setVariable'](util[_0xbda5('0x55')](_0xbda5('0x15e'),_0x3d08fd,_0x5409b2),_0x4de116);});return this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x15f'),_0x3d08fd));}else{return this['channel'][_0xbda5('0xd6')](_0x3d08fd,_0x131438);}};AGIVertices[_0xbda5('0x11')][_0xbda5('0xc')]=function(_0x4e918e){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x160'),_0x4e918e[_0xbda5('0x39')]));if(_0x4e918e[_0xbda5('0x10d')]===0x0){return this[_0xbda5('0xa2')](_0x4e918e);}_0x4e918e['retry']-=0x1;if(!this[_0xbda5('0xa1')](_0x4e918e[_0xbda5('0x10e')])){return this['channel'][_0xbda5('0x2e')](_0x4e918e,'no\x20file\x20audio\x20selected');}var _0x2c0cb1=this['getSound'][_0xbda5('0xa4')](this,_0x4e918e[_0xbda5('0x10e')]);if(!_0x2c0cb1){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x4e918e,_0xbda5('0x10f'));}var _0x297c9a=this[_0xbda5('0x37')]['getData'](_0x2c0cb1,_0x4e918e[_0xbda5('0x112')],_0x4e918e['digit']);var _0x241946=_0x297c9a[_0xbda5('0xa8')];if(_0x297c9a[_0xbda5('0xa8')]===-0x1){this[_0xbda5('0xa3')]['sync'](this,_0x4e918e,'-1');return _0x297c9a;}else if(_0x297c9a[_0xbda5('0xa0')]==='timeout'){_0x297c9a[_0xbda5('0xa8')]=_0x297c9a[_0xbda5('0xa8')][_0xbda5('0x98')]>0x0?_0x297c9a[_0xbda5('0xa8')]:'t';}else if(_['isEmpty'](_0x297c9a['result'])){_0x297c9a[_0xbda5('0xa8')]='#';_0x241946='#';}if(!this[_0xbda5('0xa1')](_0x4e918e[_0xbda5('0xd2')])){this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x110'));}else{var _0x10a4cb=this['getVariable'][_0xbda5('0xa4')](this,_0x4e918e[_0xbda5('0xd2')]);if(!_0x10a4cb){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x4e918e,_0xbda5('0xd3'));}this['channel'][_0xbda5('0xd6')](_0x10a4cb,_0x241946);}this[_0xbda5('0xa3')]['sync'](this,_0x4e918e,_0x241946);return _0x297c9a;};AGIVertices[_0xbda5('0x11')][_0xbda5('0xad')]=function(_0x10ce36){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x161'),_0x10ce36['label']));return this[_0xbda5('0x37')][_0xbda5('0xad')](_0x10ce36[_0xbda5('0x162')]||_0x10ce36[_0xbda5('0x39')]);};AGIVertices['prototype'][_0xbda5('0x163')]=function(_0x1216ac){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x164'),_0x1216ac[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x1216ac[_0xbda5('0x151')])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x1216ac,_0xbda5('0x152'));}logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x153'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x1216ac[_0xbda5('0x151')]));var _0x368e08=this[_0xbda5('0x165')][_0xbda5('0xa4')](this,_0x1216ac['pause_id']);var _0x105fe0=this[_0xbda5('0x51')][_0xbda5('0xa4')](this,_0x1216ac[_0xbda5('0x151')],_0x368e08);if(_0x105fe0){logger[_0xbda5('0x32')](util[_0xbda5('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x1216ac['findBy']));this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x1216ac[_0xbda5('0x151')]));return{'code':0xc8,'result':_0xbda5('0x158')};}else{logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x155'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x1216ac['findBy']));this[_0xbda5('0x37')][_0xbda5('0xad')](util['format'](_0xbda5('0x154'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0x1216ac['findBy']));return{'code':0xc8,'result':_0xbda5('0x156')};}};AGIVertices['prototype'][_0xbda5('0x166')]=function(_0x16a661){logger[_0xbda5('0x32')](util[_0xbda5('0x55')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x16a661[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x16a661[_0xbda5('0x10e')])){return this['channel']['error'](_0x16a661,_0xbda5('0x167'));}var _0x3aabd0=this[_0xbda5('0x20')][_0xbda5('0xa4')](this,_0x16a661[_0xbda5('0x10e')]);if(!_0x3aabd0){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x16a661,'no\x20file\x20audio\x20found');}var _0x17036b=this[_0xbda5('0x37')][_0xbda5('0x59')](_0xbda5('0x168'),[_0x3aabd0,_0x16a661[_0xbda5('0x169')]]);if(_0x17036b[_0xbda5('0xa8')]===-0x1){return _0x17036b;}return this['channel'][_0xbda5('0xad')](util['format'](_0xbda5('0xc0'),_0xbda5('0x168'),_0x3aabd0));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x16a')]=function(_0x5dbc0f){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x16b'),_0x5dbc0f[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x5dbc0f['queue_id'])){return this['channel'][_0xbda5('0x2e')](_0x5dbc0f,_0xbda5('0x16c'));}var _0x59275e='';var _0x10e989=parseInt(_0x5dbc0f['queue_id'],0xa);if(isNaN(_0x10e989)){_0x59275e=_0x5dbc0f[_0xbda5('0x16d')];}else{_0x59275e=this['getVoiceQueue']['sync'](this,_0x5dbc0f['queue_id']);if(!_0x59275e){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x5dbc0f,_0xbda5('0x16e'));}}var _0xb246f1='';if(this[_0xbda5('0xa1')](_0x5dbc0f['file_id'])){var _0x36bdf1=this[_0xbda5('0x20')]['sync'](this,_0x5dbc0f[_0xbda5('0x10e')]);if(_0x36bdf1){_0xb246f1=_0x36bdf1;}}this[_0xbda5('0xa3')][_0xbda5('0xa4')](this,_0x5dbc0f,_0x59275e);if(_0x5dbc0f[_0xbda5('0x169')][_0xbda5('0x16f')]('x')<0x0){_0x5dbc0f[_0xbda5('0x169')]+='x';}if(_0x5dbc0f[_0xbda5('0x169')][_0xbda5('0x16f')]('X')<0x0){_0x5dbc0f[_0xbda5('0x169')]+='X';}this[_0xbda5('0x37')][_0xbda5('0xd6')](_0xbda5('0x170'),_0x59275e?_0x59275e[_0xbda5('0x171')]():'');var _0x383676=this[_0xbda5('0x37')][_0xbda5('0x59')](_0xbda5('0x172'),[_0x59275e,_0x5dbc0f[_0xbda5('0x169')],_0x5dbc0f[_0xbda5('0x67')],_0xb246f1,_0x5dbc0f[_0xbda5('0x69')],_0x5dbc0f[_0xbda5('0x8')],_0x5dbc0f['macro'],_0x5dbc0f[_0xbda5('0x173')],'',_0x5dbc0f['position']]);if(_0x383676[_0xbda5('0xa8')]===-0x1){return _0x383676;}return this[_0xbda5('0x37')][_0xbda5('0xad')](util['format'](_0xbda5('0xc0'),_0xbda5('0x172'),_0x59275e));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x174')]=function(_0x20c102){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x175'),_0x20c102[_0xbda5('0x39')]));var _0x6ceb37=_0x20c102[_0xbda5('0x176')]||'wav';var _0x53083c=util[_0xbda5('0x55')](_0xbda5('0x177'),this['channel'][_0xbda5('0x38')],rs['generate'](0x5));var _0x30dfdf=util[_0xbda5('0x55')](_0xbda5('0x178'),FILES_PATH,_0x53083c,_0x6ceb37);var _0x513089=util[_0xbda5('0x55')]('%s/recordings/%s',FILES_PATH,_0x53083c);this[_0xbda5('0x3b')][_0xbda5('0xa4')](this,_0x20c102,_0x53083c,_0x30dfdf);this[_0xbda5('0x37')]['setVariable'](_0xbda5('0x179'),_0x53083c);logger[_0xbda5('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x513089,_0x6ceb37,_0x20c102[_0xbda5('0x17a')],_0x20c102[_0xbda5('0x69')]);return this[_0xbda5('0x37')][_0xbda5('0x14a')](_0x513089,_0x6ceb37,_0x20c102[_0xbda5('0x17a')],_0x20c102['timeout'],undefined,!![]);};AGIVertices[_0xbda5('0x11')][_0xbda5('0x17b')]=function(_0x1ae35a){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x17c'),_0x1ae35a[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x1ae35a[_0xbda5('0x67')])){return this[_0xbda5('0x37')][_0xbda5('0xad')]('no\x20url\x20configured');}var _0x464dee=this[_0xbda5('0x66')]['sync'](this,_0x1ae35a);logger['info'](util['format'](_0xbda5('0x17d'),util[_0xbda5('0x17e')](_0x464dee,{'showHidden':![],'depth':null})));if(!this[_0xbda5('0xa1')](_0x1ae35a['variable_id'])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x17f'));}var _0x54e603=this[_0xbda5('0x12')][_0xbda5('0xa4')](this,_0x1ae35a[_0xbda5('0xd2')]);if(!_0x54e603){return this[_0xbda5('0x37')]['error'](_0x1ae35a,_0xbda5('0xd3'));}this[_0xbda5('0x37')][_0xbda5('0xd6')](util['format'](_0xbda5('0x180'),_0x54e603),_0x464dee[_0xbda5('0x76')]?_0x464dee['statusCode']:_0xbda5('0x181'));this[_0xbda5('0x37')][_0xbda5('0xd6')](util['format'](_0xbda5('0x182'),_0x54e603),_0x464dee[_0xbda5('0x183')]?_0x464dee['statusMessage']:'OK');if(_0x464dee['body']){try{this[_0xbda5('0x9a')](_0x464dee[_0xbda5('0x6c')],_0x54e603);}catch(_0x265654){logger[_0xbda5('0x2e')](util[_0xbda5('0x55')](_0xbda5('0x184'),_0x54e603));}}return this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x185'),_0x54e603));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x186')]=function(_0x24b8f9){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x187'),_0x24b8f9['label']));return this[_0xbda5('0x37')]['sayDigits'](_0x24b8f9[_0xbda5('0x188')][_0xbda5('0x5a')](/\s+/g,''),_0x24b8f9[_0xbda5('0x17a')]);};AGIVertices['prototype'][_0xbda5('0x189')]=function(_0x2d108e){logger['info'](util['format'](_0xbda5('0x18a'),_0x2d108e['label']));return this[_0xbda5('0x37')][_0xbda5('0x18b')](_0x2d108e[_0xbda5('0x18c')][_0xbda5('0x5a')](/\s+/g,''),_0x2d108e[_0xbda5('0x17a')]);};AGIVertices[_0xbda5('0x11')]['sayphonetic']=function(_0x15ae8f){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x18d'),_0x15ae8f[_0xbda5('0x39')]));return this[_0xbda5('0x37')][_0xbda5('0x18e')](_0x15ae8f['text'],_0x15ae8f['escape_digits']);};AGIVertices['prototype'][_0xbda5('0x18f')]=function(_0x5a0835){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x190'),_0x5a0835[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x5a0835[_0xbda5('0x191')])){return this['channel'][_0xbda5('0xad')](_0xbda5('0x192'));}var _0x59031f=this['getMailAccount']['sync'](this,_0x5a0835[_0xbda5('0x191')]);if(!_0x59031f||!_0x59031f[_0xbda5('0x193')]){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x5a0835,_0xbda5('0x194'));}var _0x3e109d={'from':util[_0xbda5('0x55')]('\x22%s\x22\x20<%s>',_0x59031f[_0xbda5('0x15')],_0x59031f[_0xbda5('0x195')]||_0x59031f[_0xbda5('0x193')][_0xbda5('0x196')]),'to':_0x5a0835['to']||'','cc':_0x5a0835['cc']||'','bcc':_0x5a0835[_0xbda5('0x197')]||'','subject':_0x5a0835[_0xbda5('0x198')],'html':_0x5a0835[_0xbda5('0x5d')],'text':_0x5a0835['text']};var _0x13f343={'tls':{'rejectUnauthorized':![]}};if(_0x59031f['Smtp']['service']){_0x13f343[_0xbda5('0x199')]=_0x59031f[_0xbda5('0x193')][_0xbda5('0x199')];}else{_0x13f343[_0xbda5('0x19a')]=_0x59031f[_0xbda5('0x193')]['host'];_0x13f343[_0xbda5('0x19b')]=_0x59031f[_0xbda5('0x193')]['port'];_0x13f343[_0xbda5('0x19c')]=_0x59031f[_0xbda5('0x193')][_0xbda5('0x19c')];}if(_0x59031f['Smtp'][_0xbda5('0x19d')]){_0x13f343[_0xbda5('0x19e')]={'user':_0x59031f[_0xbda5('0x193')][_0xbda5('0x196')],'pass':_0x59031f[_0xbda5('0x193')][_0xbda5('0x19f')]};}if(this['isConfigured'](_0x5a0835[_0xbda5('0x1a0')])){}logger['debug'](_0xbda5('0x1a1'),JSON[_0xbda5('0x74')](_0x3e109d));this[_0xbda5('0xa3')][_0xbda5('0xa4')](this,_0x5a0835,_0x5a0835['account_id']);this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x1a2'),_0x59031f[_0xbda5('0x15')]));this[_0xbda5('0x24')][_0xbda5('0xa4')](this,_0x13f343,_0x3e109d);return this[_0xbda5('0x37')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xbda5('0x11')]['sendFax']=function(_0x357a53){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x1a3'),_0x357a53['label']));return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x1a4'));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1a5')]=function(_0x1753b9){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x1a6'),_0x1753b9[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x1753b9['sms_account_id'])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x1a7'));}var _0x3af5d8=this[_0xbda5('0x35')]['sync'](this,_0x1753b9['sms_account_id']);if(!_0x3af5d8){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x1753b9,_0xbda5('0x1a8'));}var _0x53ab75={'body':_0x1753b9[_0xbda5('0x1a9')],'phone':_0x1753b9['to']||'','SmsAccountId':_0x3af5d8['id']};logger[_0xbda5('0x1aa')](_0xbda5('0x1ab'),JSON[_0xbda5('0x74')](_0x53ab75));this['createSquareDetailsReport'][_0xbda5('0xa4')](this,_0x1753b9,_0x1753b9[_0xbda5('0x1ac')]);this[_0xbda5('0x37')]['noop'](util[_0xbda5('0x55')](_0xbda5('0x1ad'),_0x3af5d8[_0xbda5('0x15')]));this['createSmsMessage']['sync'](this,_0x53ab75);return this['channel'][_0xbda5('0xad')](_0xbda5('0x1ae'));};AGIVertices['prototype'][_0xbda5('0x1af')]=function(_0x32fd6a){logger['info'](util[_0xbda5('0x55')](_0xbda5('0x1b0'),_0x32fd6a[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0x32fd6a['variable_id'])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x32fd6a,_0xbda5('0x1b1'));}var _0x43734a=this[_0xbda5('0x12')][_0xbda5('0xa4')](this,_0x32fd6a[_0xbda5('0xd2')]);if(!_0x43734a){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0x32fd6a,_0xbda5('0xd3'));}return this[_0xbda5('0x37')][_0xbda5('0xd6')](_0x43734a,_0x32fd6a[_0xbda5('0x1b2')]);};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1b3')]=function(_0x55db1b){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x1b4'),_0x55db1b[_0xbda5('0x39')]));this[_0xbda5('0x37')]['noop'](_0xbda5('0x1b5'));if(_0x55db1b['answer']===_0xbda5('0x1b6')){this['channel'][_0xbda5('0xad')](_0xbda5('0x1b7'));return this[_0xbda5('0x37')][_0xbda5('0xb6')]();}return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x1b8'));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1b9')]=function(_0x12f43f){logger['info'](util['format'](_0xbda5('0x1ba'),_0x12f43f['label']));if(!this[_0xbda5('0xa1')](_0x12f43f[_0xbda5('0x1bb')])){return this['channel'][_0xbda5('0x2e')](_0x12f43f,_0xbda5('0x1bc'));}var _0x409ec9=this[_0xbda5('0x19')][_0xbda5('0xa4')](this,_0x12f43f[_0xbda5('0x1bb')]);if(!this[_0xbda5('0xa1')](_0x409ec9)){return this['channel'][_0xbda5('0x2e')](_0x12f43f,util[_0xbda5('0x55')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x12f43f[_0xbda5('0x1bb')]));}if(_0x409ec9===this[_0xbda5('0x37')][_0xbda5('0x3a')]){return this[_0xbda5('0x37')]['error'](_0x12f43f,_0xbda5('0x1bd'));}this[_0xbda5('0xa3')]['sync'](this,_0x12f43f,_0x409ec9);var _0x4c686d=this[_0xbda5('0x37')][_0xbda5('0x59')](_0xbda5('0x1be'),util['format'](_0xbda5('0x1bf'),config[_0xbda5('0x8')]['host']||_0xbda5('0x1c0'),_0x409ec9,this[_0xbda5('0x37')][_0xbda5('0x3a')]));if(_0x4c686d[_0xbda5('0xa8')]===-0x1){return _0x4c686d;}return this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0xc0'),_0xbda5('0x1be'),_0x409ec9));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1c1')]=function(_0x9ba36e){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x1c2'),_0x9ba36e[_0xbda5('0x39')]));var _0x3c02e2=this['shellCommand'][_0xbda5('0xa4')](this,_0x9ba36e[_0xbda5('0x1c3')]);this[_0xbda5('0xa3')][_0xbda5('0xa4')](this,_0x9ba36e,_0x9ba36e[_0xbda5('0x1c3')]);if(this[_0xbda5('0xa1')](_0x9ba36e[_0xbda5('0xd2')])){var _0x4d61cd=this['getVariable'][_0xbda5('0xa4')](this,_0x9ba36e[_0xbda5('0xd2')]);if(_0x4d61cd){this[_0xbda5('0x37')]['setVariable'](_0x4d61cd,_0x3c02e2);return this['channel'][_0xbda5('0xad')](util['format'](_0xbda5('0x1c4'),_0x9ba36e[_0xbda5('0x1c3')],_0x4d61cd));}}return this['channel'][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x1c5'),_0x9ba36e[_0xbda5('0x1c3')]));};AGIVertices['prototype'][_0xbda5('0x1c6')]=function(_0x38cd8b){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x1c7'),_0x38cd8b[_0xbda5('0x39')]));_0x38cd8b[_0xbda5('0x5d')]=_0x38cd8b['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x38cd8b[_0xbda5('0x5c')])){return this[_0xbda5('0x37')][_0xbda5('0xad')](_0xbda5('0x1c8'));}if(!this[_0xbda5('0xa1')](_0x38cd8b['text'])){return this[_0xbda5('0x37')]['noop'](_0xbda5('0xe1'));}this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x1c9'),_0x38cd8b[_0xbda5('0x5d')]));var _0x59094b=this['googleCloudTTS'][_0xbda5('0xa4')](this,_0x38cd8b);if(_0x59094b){this[_0xbda5('0x37')][_0xbda5('0xad')](util['format'](_0xbda5('0x1ca'),_0x59094b));var _0x3f12ae=this[_0xbda5('0x37')][_0xbda5('0xfd')](_0x59094b);try{fs[_0xbda5('0xfe')](_0x59094b+_0xbda5('0xff'));}catch(_0x373cee){logger[_0xbda5('0x2e')](_0x373cee);}return _0x3f12ae;}return this[_0xbda5('0x37')]['error'](_0x38cd8b,_0xbda5('0x1cb'));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1cc')]=function(_0x3cbfce){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x1cd'),_0x3cbfce['label']));_0x3cbfce[_0xbda5('0x5d')]=_0x3cbfce['text'][_0xbda5('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3cbfce['text'])){return this[_0xbda5('0x37')][_0xbda5('0xad')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xbda5('0x55')](_0xbda5('0x1ce'),_0x3cbfce[_0xbda5('0x5d')]));var _0x2e442d=this['googleTTS'][_0xbda5('0xa4')](this,_0x3cbfce);if(_0x2e442d){this[_0xbda5('0x37')][_0xbda5('0xad')](util[_0xbda5('0x55')](_0xbda5('0x1cf'),_0x2e442d));var _0x4c6331=this[_0xbda5('0x37')][_0xbda5('0xfd')](_0x2e442d);try{fs[_0xbda5('0xfe')](_0x2e442d+_0xbda5('0xff'));}catch(_0x19308c){logger['error'](_0x19308c);}return _0x4c6331;}return this['channel'][_0xbda5('0x2e')](_0x3cbfce,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbda5('0x11')]['unpause']=function(_0xd4d7c9){logger[_0xbda5('0x32')](util['format'](_0xbda5('0x1d0'),_0xd4d7c9[_0xbda5('0x39')]));if(!this[_0xbda5('0xa1')](_0xd4d7c9[_0xbda5('0x151')])){return this[_0xbda5('0x37')][_0xbda5('0x2e')](_0xd4d7c9,'no\x20find\x20by\x20configured');}logger['info'](util[_0xbda5('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0xd4d7c9['findBy']));var _0x40098d=this[_0xbda5('0x52')]['sync'](this,_0xd4d7c9[_0xbda5('0x151')]);if(_0x40098d){logger['info'](util[_0xbda5('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0xd4d7c9[_0xbda5('0x151')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbda5('0x37')][_0xbda5('0x3c')],_0xd4d7c9[_0xbda5('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x155'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0xd4d7c9[_0xbda5('0x151')]));this[_0xbda5('0x37')][_0xbda5('0xad')](util['format'](_0xbda5('0x155'),this[_0xbda5('0x37')][_0xbda5('0x3c')],_0xd4d7c9['findBy']));return{'code':0xc8,'result':_0xbda5('0x156')};}};AGIVertices['prototype'][_0xbda5('0x1d1')]=function(_0x4eb5f4){logger['info'](util[_0xbda5('0x55')](_0xbda5('0x1d2'),_0x4eb5f4[_0xbda5('0x39')]));var _0x3164eb=this[_0xbda5('0x37')][_0xbda5('0x59')](_0xbda5('0x1d3'),[_0x4eb5f4['mailbox'],_0x4eb5f4[_0xbda5('0x79')]]);if(_0x3164eb[_0xbda5('0xa8')]===-0x1){return _0x3164eb;}return this['channel'][_0xbda5('0xad')](util['format'](_0xbda5('0xc0'),'VOICEMAIL',_0x4eb5f4[_0xbda5('0x1d4')]));};AGIVertices[_0xbda5('0x11')][_0xbda5('0x1d5')]=function(_0x4d64eb){logger[_0xbda5('0x32')](util[_0xbda5('0x55')](_0xbda5('0x1d6'),_0x4d64eb['label']));if(!this[_0xbda5('0xa1')](_0x4d64eb[_0xbda5('0xd2')])){return this[_0xbda5('0x37')]['error'](_0x4d64eb,_0xbda5('0x1b1'));}var _0x3e655b=this[_0xbda5('0x12')][_0xbda5('0xa4')](this,_0x4d64eb[_0xbda5('0xd2')]);if(!_0x3e655b){return this['channel'][_0xbda5('0x2e')](_0x4d64eb,_0xbda5('0xd3'));}var _0x38507a=this['channel'][_0xbda5('0x12')](_0x3e655b);return{'code':0xc8,'result':_0x38507a[_0xbda5('0xa0')]?_0x38507a[_0xbda5('0xa0')]:'-'};};String[_0xbda5('0x11')][_0xbda5('0x1d7')]=function(_0x181432,_0xea8aab){return this['split'](_0x181432)[_0xbda5('0x1d8')](_0xea8aab);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 85aaad1..b53aadc 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 _0x1f2c=['milliseconds','diff','seconds','prototype','interface','ACW','name','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1f2c,0x1a2));var _0xc1f2=function(_0x57549d,_0x35b057){_0x57549d=_0x57549d-0x0;var _0x1de4cc=_0x1f2c[_0x57549d];return _0x1de4cc;};'use strict';var util=require('util');var _=require(_0xc1f2('0x0'));var moment=require('moment');var ami=require(_0xc1f2('0x1'));var logger=require(_0xc1f2('0x2'))(_0xc1f2('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xc1f2('0x4'));function Acw(_0x1eb880){this[_0xc1f2('0x5')]=_0x1eb880['voiceQueues'];this[_0xc1f2('0x6')]=_0x1eb880[_0xc1f2('0x6')];this[_0xc1f2('0x7')]=_0x1eb880[_0xc1f2('0x7')];this[_0xc1f2('0x8')]={};ami['on'](_0xc1f2('0x9'),this[_0xc1f2('0xa')][_0xc1f2('0xb')](this));ami['on'](_0xc1f2('0xc'),this[_0xc1f2('0xd')][_0xc1f2('0xb')](this));ami['on'](_0xc1f2('0xe'),this[_0xc1f2('0xf')][_0xc1f2('0xb')](this));ami['on'](_0xc1f2('0x10'),this[_0xc1f2('0x11')][_0xc1f2('0xb')](this));ami['on']('attendedtransfer',this[_0xc1f2('0x12')][_0xc1f2('0xb')](this));ami['on'](_0xc1f2('0x13'),this[_0xc1f2('0x14')][_0xc1f2('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0xc1f2('0x15')][_0xc1f2('0xb')](this));}function getDiff(_0x5f465f){var _0xec4872=moment()[_0xc1f2('0x16')](0x0);var _0x45d3b9=moment(_0x5f465f)[_0xc1f2('0x16')](0x0);return _0xec4872[_0xc1f2('0x17')](_0x45d3b9,_0xc1f2('0x18'));}Acw[_0xc1f2('0x19')]['startAcw']=function(_0x700cbf){try{var _0x43176d=this;var _0x2b3869=this[_0xc1f2('0x8')][_0x700cbf][_0xc1f2('0x1a')];var _0x5de8a9=this[_0xc1f2('0x8')][_0x700cbf]['queue'];var _0x494b25=this[_0xc1f2('0x5')][_0x5de8a9];var _0xba1da8=![];var _0x21ed49=_0xc1f2('0x1b');if(_0x494b25['mandatoryDisposition']){if(_0x494b25['mandatoryDispositionPause'][_0xc1f2('0x1c')]){_0xba1da8=!![];_0x21ed49=_0x494b25['mandatoryDispositionPause'][_0xc1f2('0x1c')];}}ami['Action']({'action':_0xc1f2('0x1d'),'interface':_0x2b3869,'paused':!![],'reason':_0x21ed49})['then'](function(_0x34aeaf){if(_0x43176d['agents'][_0x2b3869]){return RpcUser[_0xc1f2('0x1e')](_0x43176d[_0xc1f2('0x6')][_0x2b3869]['id'])[_0xc1f2('0x1f')](function(_0x227321){if(_0x227321&&!_0x227321[_0xc1f2('0x20')]){logger[_0xc1f2('0x21')](_0xc1f2('0x22'),_0x700cbf,_0x2b3869,_0x5de8a9);var _0x4b698e=_0x43176d[_0xc1f2('0x8')][_0x700cbf][_0xc1f2('0x23')]&&_0x43176d[_0xc1f2('0x8')][_0x700cbf][_0xc1f2('0x24')]?_0x43176d['channels'][_0x700cbf][_0xc1f2('0x24')]:_0x700cbf;return RpcUser[_0xc1f2('0x25')](_0x43176d['agents'][_0x2b3869],_0x21ed49,_0x4b698e)['then'](function(_0xd7a84e){if(!_0xba1da8){_0x43176d[_0xc1f2('0x7')][_0x2b3869]={};logger[_0xc1f2('0x21')](_0xc1f2('0x26'),_0x700cbf,_0x43176d[_0xc1f2('0x5')][_0x5de8a9][_0xc1f2('0x27')],_0x2b3869,_0x5de8a9);_0x43176d['timers'][_0x2b3869][_0xc1f2('0x28')]=setTimeout(_0x43176d[_0xc1f2('0x29')][_0xc1f2('0xb')](_0x43176d,_0x2b3869),_0x43176d[_0xc1f2('0x5')][_0x5de8a9][_0xc1f2('0x27')]*0x3e8);_0x43176d['timers'][_0x2b3869]['lastPauseAt']=moment()[_0xc1f2('0x2a')](_0xc1f2('0x2b'));_0x43176d[_0xc1f2('0x7')][_0x2b3869][_0xc1f2('0x2c')]=_0x700cbf;_0x43176d[_0xc1f2('0x7')][_0x2b3869][_0xc1f2('0x2d')]=_0x5de8a9;_0x43176d[_0xc1f2('0x7')][_0x2b3869]['updateAcw']=function(){var _0x998eff=getDiff(_0x43176d[_0xc1f2('0x7')][_0x2b3869]['lastPauseAt']);clearTimeout(_0x43176d[_0xc1f2('0x7')][_0x2b3869][_0xc1f2('0x28')]);_0x43176d[_0xc1f2('0x7')][_0x2b3869][_0xc1f2('0x28')]=![];RpcVoiceAgentReport[_0xc1f2('0x2e')]({'acwtime':_0x998eff},_0x43176d[_0xc1f2('0x7')][_0x2b3869][_0xc1f2('0x2c')],_0x2b3869)[_0xc1f2('0x1f')](function(_0x42e665){logger['info'](_0xc1f2('0x2f'),_0x700cbf,_0x998eff,_0x42e665);})['catch'](function(_0x22079e){logger[_0xc1f2('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x700cbf,_0x22079e);});delete _0x43176d[_0xc1f2('0x7')][_0x2b3869];};}});}else{logger[_0xc1f2('0x21')](_0xc1f2('0x31'),_0x700cbf,_0x2b3869,_0x5de8a9);}});}})[_0xc1f2('0x32')](function(_0x40c439){logger[_0xc1f2('0x30')](_0xc1f2('0x26'),_0x700cbf,_0x43176d[_0xc1f2('0x5')][_0x5de8a9]['acwTimeout'],_0x2b3869,_0x5de8a9);})[_0xc1f2('0x33')](function(){delete _0x43176d['channels'][_0x700cbf];});}catch(_0x6a8e94){logger[_0xc1f2('0x30')](_0xc1f2('0x34'),_0x6a8e94['message']);}};Acw[_0xc1f2('0x19')][_0xc1f2('0x29')]=function(_0xb607d0){try{var _0x410787=this;if(_0x410787[_0xc1f2('0x7')][_0xb607d0]){_0x410787['timers'][_0xb607d0][_0xc1f2('0x28')]=![];var _0x41f4b9=_0x410787[_0xc1f2('0x7')][_0xb607d0][_0xc1f2('0x2c')];var _0x23ca81=_0x410787['timers'][_0xb607d0][_0xc1f2('0x2d')];var _0xe86d40=_0x410787[_0xc1f2('0x5')][_0x23ca81][_0xc1f2('0x27')];logger[_0xc1f2('0x21')](_0xc1f2('0x35'),_0x41f4b9,_0xb607d0);RpcUser[_0xc1f2('0x36')](this[_0xc1f2('0x6')][_0xb607d0]);RpcVoiceAgentReport['update']({'acwtime':_0xe86d40,'agentacw':!![]},_0x41f4b9,_0xb607d0)[_0xc1f2('0x1f')](function(_0x43944d){logger[_0xc1f2('0x21')](_0xc1f2('0x2f'),_0x41f4b9,_0xe86d40,_0x43944d);})['catch'](function(_0x3da179){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x41f4b9,_0x3da179);});}else{logger['error'](_0xc1f2('0x37'),_0xb607d0);if(_0x410787[_0xc1f2('0x7')]){logger[_0xc1f2('0x21')](_0xc1f2('0x38'),JSON[_0xc1f2('0x39')](_0x410787[_0xc1f2('0x7')]));}}}catch(_0x43cd39){logger[_0xc1f2('0x30')](_0xc1f2('0x3a'),_0x43cd39[_0xc1f2('0x3b')]);}};Acw[_0xc1f2('0x19')][_0xc1f2('0xa')]=function(_0x201b0c){try{if(this['voiceQueues'][_0x201b0c['queue']]&&(this[_0xc1f2('0x5')][_0x201b0c[_0xc1f2('0x2d')]]['acw']||this['voiceQueues'][_0x201b0c[_0xc1f2('0x2d')]][_0xc1f2('0x3c')])){if(this[_0xc1f2('0x6')][_0x201b0c[_0xc1f2('0x1a')]]){this['channels'][_0x201b0c[_0xc1f2('0x2c')]]={'queue':_0x201b0c[_0xc1f2('0x2d')],'interface':_0x201b0c[_0xc1f2('0x1a')],'destlinkedid':_0x201b0c['destlinkedid']};}}}catch(_0x1a918e){logger[_0xc1f2('0x30')](_0xc1f2('0x3d'),_0x1a918e[_0xc1f2('0x3b')]);}};Acw[_0xc1f2('0x19')][_0xc1f2('0x15')]=function(_0xf60fc5){try{if(this[_0xc1f2('0x5')][_0xf60fc5[_0xc1f2('0x2d')]]&&(this[_0xc1f2('0x5')][_0xf60fc5[_0xc1f2('0x2d')]][_0xc1f2('0x3')]||this[_0xc1f2('0x5')][_0xf60fc5['queue']][_0xc1f2('0x3c')])){if(this[_0xc1f2('0x6')][_0xf60fc5[_0xc1f2('0x1a')]]){this[_0xc1f2('0x8')][_0xf60fc5[_0xc1f2('0x2c')]]={'queue':_0xf60fc5['queue'],'interface':_0xf60fc5['interface']};}}}catch(_0xa15ab2){logger['error'](_0xc1f2('0x3e'),_0xa15ab2[_0xc1f2('0x3b')]);}};Acw[_0xc1f2('0x19')][_0xc1f2('0xd')]=function(_0x12ca0e){try{if(this[_0xc1f2('0x8')][_0x12ca0e[_0xc1f2('0x2c')]]&&_[_0xc1f2('0x3f')](this[_0xc1f2('0x8')][_0x12ca0e[_0xc1f2('0x2c')]][_0xc1f2('0x23')])){logger[_0xc1f2('0x21')](_0xc1f2('0x40'),_0x12ca0e[_0xc1f2('0x2c')]);this[_0xc1f2('0x41')](_0x12ca0e['uniqueid']);}else if(this['channels'][_0x12ca0e[_0xc1f2('0x42')]]&&_[_0xc1f2('0x3f')](this['channels'][_0x12ca0e['linkedid']][_0xc1f2('0x23')])){logger[_0xc1f2('0x21')](_0xc1f2('0x43'),_0x12ca0e[_0xc1f2('0x42')]);this[_0xc1f2('0x41')](_0x12ca0e[_0xc1f2('0x42')]);}}catch(_0x351034){logger[_0xc1f2('0x30')](_0xc1f2('0x44'),_0x351034['message']);}};Acw[_0xc1f2('0x19')]['syncHangup']=function(_0x516f93){try{if(this[_0xc1f2('0x8')][_0x516f93['uniqueid']]&&this[_0xc1f2('0x8')][_0x516f93[_0xc1f2('0x2c')]][_0xc1f2('0x23')]){logger[_0xc1f2('0x21')](_0xc1f2('0x45'),_0x516f93[_0xc1f2('0x2c')]);this[_0xc1f2('0x41')](_0x516f93[_0xc1f2('0x2c')]);}else if(this['channels'][_0x516f93[_0xc1f2('0x42')]]&&this[_0xc1f2('0x8')][_0x516f93[_0xc1f2('0x42')]][_0xc1f2('0x23')]){logger['info'](_0xc1f2('0x46'),_0x516f93[_0xc1f2('0x42')]);this[_0xc1f2('0x41')](_0x516f93[_0xc1f2('0x42')]);}}catch(_0x30ae8b){logger[_0xc1f2('0x30')](_0xc1f2('0x47'),_0x30ae8b[_0xc1f2('0x3b')]);}};Acw[_0xc1f2('0x19')][_0xc1f2('0x12')]=function(_0x170ab3){try{if(!_[_0xc1f2('0x48')](this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x49')]])){this[_0xc1f2('0x41')](_0x170ab3[_0xc1f2('0x49')]);if(this[_0xc1f2('0x8')][_0x170ab3['secondtransfereruniqueid']]){this[_0xc1f2('0x8')][_0x170ab3['secondtransfereruniqueid']][_0xc1f2('0x23')]=!![];this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x4a')]]=this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x4b')]];delete this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x4b')]];}}else if(!_[_0xc1f2('0x48')](this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x4a')]])){this[_0xc1f2('0x41')](_0x170ab3[_0xc1f2('0x4a')]);if(this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x4c')]]){this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x4c')]]['attended']=!![];this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x49')]]=this[_0xc1f2('0x8')][_0x170ab3[_0xc1f2('0x4c')]];delete this['channels'][_0x170ab3[_0xc1f2('0x4c')]];}}}catch(_0x3e9de4){logger[_0xc1f2('0x30')](_0xc1f2('0x4d'),_0x3e9de4[_0xc1f2('0x3b')]);}};Acw['prototype'][_0xc1f2('0x14')]=function(_0x445c7d){try{if(this[_0xc1f2('0x8')][_0x445c7d[_0xc1f2('0x4e')]]){logger[_0xc1f2('0x21')](_0xc1f2('0x4f'),JSON[_0xc1f2('0x39')](_0x445c7d[_0xc1f2('0x4e')]));this['startAcw'](_0x445c7d[_0xc1f2('0x4e')]);}else if(this[_0xc1f2('0x8')][_0x445c7d[_0xc1f2('0x50')]]){logger[_0xc1f2('0x21')](_0xc1f2('0x51'),JSON['stringify'](_0x445c7d[_0xc1f2('0x50')]));this['startAcw'](_0x445c7d[_0xc1f2('0x50')]);}}catch(_0x1db0d1){logger[_0xc1f2('0x30')](_0xc1f2('0x52'),_0x1db0d1[_0xc1f2('0x3b')]);}};Acw['prototype'][_0xc1f2('0x11')]=function(_0x578b88){try{if(this[_0xc1f2('0x5')][_0x578b88[_0xc1f2('0x2d')]]&&this['voiceQueues'][_0x578b88[_0xc1f2('0x2d')]]['autopause']===_0xc1f2('0x53')){if(this[_0xc1f2('0x6')][_0x578b88[_0xc1f2('0x1a')]]){logger['info'](_0xc1f2('0x54'),_0x578b88['uniqueid'],_0x578b88['interface'],_0x578b88['queue']);return RpcUser[_0xc1f2('0x25')](this[_0xc1f2('0x6')][_0x578b88[_0xc1f2('0x1a')]],_0xc1f2('0x55'),_0x578b88[_0xc1f2('0x2c')]);}}}catch(_0x221113){logger[_0xc1f2('0x30')](_0xc1f2('0x56'),_0x221113['message']);}};module[_0xc1f2('0x57')]=Acw; \ No newline at end of file +var _0x0e26=['voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','startAcw','interface','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then'];(function(_0x458b5a,_0x5b0e18){var _0x202d59=function(_0x59f72d){while(--_0x59f72d){_0x458b5a['push'](_0x458b5a['shift']());}};_0x202d59(++_0x5b0e18);}(_0x0e26,0x90));var _0x60e2=function(_0x30e247,_0x320e76){_0x30e247=_0x30e247-0x0;var _0x1dbe5d=_0x0e26[_0x30e247];return _0x1dbe5d;};'use strict';var util=require(_0x60e2('0x0'));var _=require(_0x60e2('0x1'));var moment=require(_0x60e2('0x2'));var ami=require(_0x60e2('0x3'));var logger=require(_0x60e2('0x4'))(_0x60e2('0x5'));var RpcUser=require(_0x60e2('0x6'));var RpcVoiceAgentReport=require(_0x60e2('0x7'));function Acw(_0x2afee8){this['voiceQueues']=_0x2afee8['voiceQueues'];this[_0x60e2('0x8')]=_0x2afee8['agents'];this[_0x60e2('0x9')]=_0x2afee8[_0x60e2('0x9')];this[_0x60e2('0xa')]={};ami['on'](_0x60e2('0xb'),this[_0x60e2('0xc')]['bind'](this));ami['on']('hanguprequest',this[_0x60e2('0xd')]['bind'](this));ami['on']('hangup',this[_0x60e2('0xe')][_0x60e2('0xf')](this));ami['on'](_0x60e2('0x10'),this[_0x60e2('0x11')][_0x60e2('0xf')](this));ami['on'](_0x60e2('0x12'),this[_0x60e2('0x13')][_0x60e2('0xf')](this));ami['on'](_0x60e2('0x14'),this['syncBlindTransfer'][_0x60e2('0xf')](this));ami['on'](_0x60e2('0x15'),this['syncAgentConnectPreview'][_0x60e2('0xf')](this));}function getDiff(_0x26abce){var _0x4c3216=moment()[_0x60e2('0x16')](0x0);var _0x3badc0=moment(_0x26abce)[_0x60e2('0x16')](0x0);return _0x4c3216[_0x60e2('0x17')](_0x3badc0,'seconds');}Acw['prototype'][_0x60e2('0x18')]=function(_0x47bb2d){try{var _0x3302ce=this;var _0x5c4ce0=this[_0x60e2('0xa')][_0x47bb2d][_0x60e2('0x19')];var _0x391b00=this[_0x60e2('0xa')][_0x47bb2d][_0x60e2('0x1a')];var _0x1efc6f=this[_0x60e2('0x1b')][_0x391b00];var _0x514160=![];var _0xb66ab5=_0x60e2('0x1c');if(_0x1efc6f[_0x60e2('0x1d')]){if(_0x1efc6f[_0x60e2('0x1e')][_0x60e2('0x1f')]){_0x514160=!![];_0xb66ab5=_0x1efc6f[_0x60e2('0x1e')][_0x60e2('0x1f')];}}ami[_0x60e2('0x20')]({'action':_0x60e2('0x21'),'interface':_0x5c4ce0,'paused':!![],'reason':_0xb66ab5})['then'](function(_0x38e13b){if(_0x3302ce['agents'][_0x5c4ce0]){return RpcUser[_0x60e2('0x22')](_0x3302ce[_0x60e2('0x8')][_0x5c4ce0]['id'])[_0x60e2('0x23')](function(_0x2bf8f3){if(_0x2bf8f3&&!_0x2bf8f3[_0x60e2('0x24')]){logger[_0x60e2('0x25')](_0x60e2('0x26'),_0x47bb2d,_0x5c4ce0,_0x391b00);var _0x229acc=_0x3302ce[_0x60e2('0xa')][_0x47bb2d][_0x60e2('0x27')]&&_0x3302ce[_0x60e2('0xa')][_0x47bb2d][_0x60e2('0x28')]?_0x3302ce[_0x60e2('0xa')][_0x47bb2d][_0x60e2('0x28')]:_0x47bb2d;return RpcUser['savePause'](_0x3302ce[_0x60e2('0x8')][_0x5c4ce0],_0xb66ab5,_0x229acc)['then'](function(_0xf19a36){if(!_0x514160){_0x3302ce[_0x60e2('0x9')][_0x5c4ce0]={};logger[_0x60e2('0x25')](_0x60e2('0x29'),_0x47bb2d,_0x3302ce['voiceQueues'][_0x391b00][_0x60e2('0x2a')],_0x5c4ce0,_0x391b00);_0x3302ce[_0x60e2('0x9')][_0x5c4ce0]['timer']=setTimeout(_0x3302ce[_0x60e2('0x2b')][_0x60e2('0xf')](_0x3302ce,_0x5c4ce0),_0x3302ce[_0x60e2('0x1b')][_0x391b00][_0x60e2('0x2a')]*0x3e8);_0x3302ce[_0x60e2('0x9')][_0x5c4ce0][_0x60e2('0x2c')]=moment()[_0x60e2('0x2d')](_0x60e2('0x2e'));_0x3302ce[_0x60e2('0x9')][_0x5c4ce0][_0x60e2('0x2f')]=_0x47bb2d;_0x3302ce['timers'][_0x5c4ce0][_0x60e2('0x1a')]=_0x391b00;_0x3302ce[_0x60e2('0x9')][_0x5c4ce0]['updateAcw']=function(){var _0x1c6a89=getDiff(_0x3302ce['timers'][_0x5c4ce0][_0x60e2('0x2c')]);clearTimeout(_0x3302ce[_0x60e2('0x9')][_0x5c4ce0]['timer']);_0x3302ce['timers'][_0x5c4ce0][_0x60e2('0x30')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x1c6a89},_0x3302ce[_0x60e2('0x9')][_0x5c4ce0][_0x60e2('0x2f')],_0x5c4ce0)[_0x60e2('0x23')](function(_0x386f15){logger[_0x60e2('0x25')](_0x60e2('0x31'),_0x47bb2d,_0x1c6a89,_0x386f15);})[_0x60e2('0x32')](function(_0x362dbf){logger[_0x60e2('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x47bb2d,_0x362dbf);});delete _0x3302ce['timers'][_0x5c4ce0];};}});}else{logger['info'](_0x60e2('0x34'),_0x47bb2d,_0x5c4ce0,_0x391b00);}});}})[_0x60e2('0x32')](function(_0x14f1e4){logger[_0x60e2('0x33')](_0x60e2('0x29'),_0x47bb2d,_0x3302ce[_0x60e2('0x1b')][_0x391b00][_0x60e2('0x2a')],_0x5c4ce0,_0x391b00);})[_0x60e2('0x35')](function(){delete _0x3302ce['channels'][_0x47bb2d];});}catch(_0x38b474){logger[_0x60e2('0x33')](_0x60e2('0x36'),_0x38b474['message']);}};Acw[_0x60e2('0x37')][_0x60e2('0x2b')]=function(_0x1a218a){try{var _0x566268=this;if(_0x566268[_0x60e2('0x9')][_0x1a218a]){_0x566268[_0x60e2('0x9')][_0x1a218a]['timer']=![];var _0x289913=_0x566268[_0x60e2('0x9')][_0x1a218a][_0x60e2('0x2f')];var _0xec27ea=_0x566268[_0x60e2('0x9')][_0x1a218a][_0x60e2('0x1a')];var _0x48a72b=_0x566268[_0x60e2('0x1b')][_0xec27ea][_0x60e2('0x2a')];logger[_0x60e2('0x25')](_0x60e2('0x38'),_0x289913,_0x1a218a);RpcUser[_0x60e2('0x39')](this[_0x60e2('0x8')][_0x1a218a]);RpcVoiceAgentReport[_0x60e2('0x3a')]({'acwtime':_0x48a72b,'agentacw':!![]},_0x289913,_0x1a218a)[_0x60e2('0x23')](function(_0x26eb68){logger[_0x60e2('0x25')](_0x60e2('0x31'),_0x289913,_0x48a72b,_0x26eb68);})['catch'](function(_0x3a6ddc){logger[_0x60e2('0x33')](_0x60e2('0x3b'),_0x289913,_0x3a6ddc);});}else{logger['error'](_0x60e2('0x3c'),_0x1a218a);if(_0x566268[_0x60e2('0x9')]){logger[_0x60e2('0x25')](_0x60e2('0x3d'),JSON[_0x60e2('0x3e')](_0x566268[_0x60e2('0x9')]));}}}catch(_0x3bb9ab){logger[_0x60e2('0x33')]('[ACW][STOP]\x20%s',_0x3bb9ab[_0x60e2('0x3f')]);}};Acw[_0x60e2('0x37')]['syncAgentConnect']=function(_0x5aaec1){try{if(this['voiceQueues'][_0x5aaec1['queue']]&&(this[_0x60e2('0x1b')][_0x5aaec1[_0x60e2('0x1a')]][_0x60e2('0x5')]||this[_0x60e2('0x1b')][_0x5aaec1['queue']][_0x60e2('0x1d')])){if(this[_0x60e2('0x8')][_0x5aaec1[_0x60e2('0x19')]]){this['channels'][_0x5aaec1[_0x60e2('0x2f')]]={'queue':_0x5aaec1[_0x60e2('0x1a')],'interface':_0x5aaec1[_0x60e2('0x19')],'destlinkedid':_0x5aaec1[_0x60e2('0x28')]};}}}catch(_0x334cf4){logger[_0x60e2('0x33')](_0x60e2('0x40'),_0x334cf4[_0x60e2('0x3f')]);}};Acw['prototype'][_0x60e2('0x41')]=function(_0x1c730b){try{if(this['voiceQueues'][_0x1c730b[_0x60e2('0x1a')]]&&(this[_0x60e2('0x1b')][_0x1c730b['queue']][_0x60e2('0x5')]||this[_0x60e2('0x1b')][_0x1c730b['queue']][_0x60e2('0x1d')])){if(this[_0x60e2('0x8')][_0x1c730b[_0x60e2('0x19')]]){this[_0x60e2('0xa')][_0x1c730b['uniqueid']]={'queue':_0x1c730b[_0x60e2('0x1a')],'interface':_0x1c730b['interface']};}}}catch(_0x50aa1e){logger[_0x60e2('0x33')](_0x60e2('0x42'),_0x50aa1e['message']);}};Acw[_0x60e2('0x37')][_0x60e2('0xd')]=function(_0x51037e){try{if(this['channels'][_0x51037e['uniqueid']]&&_[_0x60e2('0x43')](this[_0x60e2('0xa')][_0x51037e['uniqueid']][_0x60e2('0x27')])){logger[_0x60e2('0x25')](_0x60e2('0x44'),_0x51037e['uniqueid']);this[_0x60e2('0x18')](_0x51037e[_0x60e2('0x2f')]);}else if(this['channels'][_0x51037e[_0x60e2('0x45')]]&&_[_0x60e2('0x43')](this[_0x60e2('0xa')][_0x51037e['linkedid']][_0x60e2('0x27')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x51037e['linkedid']);this['startAcw'](_0x51037e[_0x60e2('0x45')]);}}catch(_0xd3be4c){logger[_0x60e2('0x33')](_0x60e2('0x46'),_0xd3be4c[_0x60e2('0x3f')]);}};Acw[_0x60e2('0x37')][_0x60e2('0xe')]=function(_0x55496b){try{if(this[_0x60e2('0xa')][_0x55496b[_0x60e2('0x2f')]]&&this['channels'][_0x55496b[_0x60e2('0x2f')]]['attended']){logger[_0x60e2('0x25')](_0x60e2('0x47'),_0x55496b[_0x60e2('0x2f')]);this['startAcw'](_0x55496b[_0x60e2('0x2f')]);}else if(this[_0x60e2('0xa')][_0x55496b['linkedid']]&&this[_0x60e2('0xa')][_0x55496b['linkedid']]['attended']){logger[_0x60e2('0x25')](_0x60e2('0x48'),_0x55496b[_0x60e2('0x45')]);this[_0x60e2('0x18')](_0x55496b['linkedid']);}}catch(_0xe72671){logger[_0x60e2('0x33')](_0x60e2('0x49'),_0xe72671['message']);}};Acw[_0x60e2('0x37')]['syncAttendedTransfer']=function(_0x234cde){try{if(!_[_0x60e2('0x4a')](this['channels'][_0x234cde[_0x60e2('0x4b')]])){this[_0x60e2('0x18')](_0x234cde['transfereeuniqueid']);if(this[_0x60e2('0xa')][_0x234cde['secondtransfereruniqueid']]){this['channels'][_0x234cde['secondtransfereruniqueid']][_0x60e2('0x27')]=!![];this[_0x60e2('0xa')][_0x234cde['transfertargetuniqueid']]=this[_0x60e2('0xa')][_0x234cde['secondtransfereruniqueid']];delete this[_0x60e2('0xa')][_0x234cde[_0x60e2('0x4c')]];}}else if(!_[_0x60e2('0x4a')](this['channels'][_0x234cde[_0x60e2('0x4d')]])){this[_0x60e2('0x18')](_0x234cde[_0x60e2('0x4d')]);if(this[_0x60e2('0xa')][_0x234cde[_0x60e2('0x4e')]]){this[_0x60e2('0xa')][_0x234cde[_0x60e2('0x4e')]][_0x60e2('0x27')]=!![];this[_0x60e2('0xa')][_0x234cde[_0x60e2('0x4b')]]=this[_0x60e2('0xa')][_0x234cde['origtransfereruniqueid']];delete this['channels'][_0x234cde[_0x60e2('0x4e')]];}}}catch(_0x40eac3){logger[_0x60e2('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0x40eac3[_0x60e2('0x3f')]);}};Acw[_0x60e2('0x37')][_0x60e2('0x4f')]=function(_0x3f895b){try{if(this['channels'][_0x3f895b[_0x60e2('0x50')]]){logger[_0x60e2('0x25')](_0x60e2('0x51'),JSON[_0x60e2('0x3e')](_0x3f895b['transfereruniqueid']));this['startAcw'](_0x3f895b[_0x60e2('0x50')]);}else if(this[_0x60e2('0xa')][_0x3f895b[_0x60e2('0x52')]]){logger[_0x60e2('0x25')](_0x60e2('0x53'),JSON[_0x60e2('0x3e')](_0x3f895b[_0x60e2('0x52')]));this[_0x60e2('0x18')](_0x3f895b['transfererlinkedid']);}}catch(_0xde2af9){logger['error'](_0x60e2('0x54'),_0xde2af9[_0x60e2('0x3f')]);}};Acw[_0x60e2('0x37')][_0x60e2('0x11')]=function(_0x3bf62c){try{if(this['voiceQueues'][_0x3bf62c[_0x60e2('0x1a')]]&&this['voiceQueues'][_0x3bf62c['queue']]['autopause']===_0x60e2('0x55')){if(this['agents'][_0x3bf62c[_0x60e2('0x19')]]){logger[_0x60e2('0x25')](_0x60e2('0x56'),_0x3bf62c[_0x60e2('0x2f')],_0x3bf62c[_0x60e2('0x19')],_0x3bf62c[_0x60e2('0x1a')]);return RpcUser[_0x60e2('0x57')](this[_0x60e2('0x8')][_0x3bf62c[_0x60e2('0x19')]],_0x60e2('0x58'),_0x3bf62c[_0x60e2('0x2f')]);}}}catch(_0x5e48aa){logger[_0x60e2('0x33')](_0x60e2('0x59'),_0x5e48aa[_0x60e2('0x3f')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 70edd82..75f1dac 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 _0x4feb=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','log','close','asterisk-manager','moment','../../config/logger','../../config/environment','asterisk','port','username','keepConnected','action','error'];(function(_0x3d8daa,_0x3e1dc4){var _0x52fddb=function(_0x94e066){while(--_0x94e066){_0x3d8daa['push'](_0x3d8daa['shift']());}};_0x52fddb(++_0x3e1dc4);}(_0x4feb,0x1a6));var _0xb4fe=function(_0x15362c,_0x92bcd7){_0x15362c=_0x15362c-0x0;var _0x4a65ab=_0x4feb[_0x15362c];return _0x4a65ab;};'use strict';var Manager=require(_0xb4fe('0x0'));var BPromise=require('bluebird');var moment=require(_0xb4fe('0x1'));var util=require('util');var _=require('lodash');var logger=require(_0xb4fe('0x2'))('ami');var config=require(_0xb4fe('0x3'));var ami=new Manager(config[_0xb4fe('0x4')][_0xb4fe('0x5')],config[_0xb4fe('0x4')]['ip'],config[_0xb4fe('0x4')][_0xb4fe('0x6')],config[_0xb4fe('0x4')]['password'],!![]);ami[_0xb4fe('0x7')]();ami['Action']=BPromise['promisify'](ami[_0xb4fe('0x8')]);function error(_0x45acfc){logger[_0xb4fe('0x9')](util['format'](_0xb4fe('0xa'),config['asterisk'][_0xb4fe('0x6')],config[_0xb4fe('0x4')]['ip'],config[_0xb4fe('0x4')][_0xb4fe('0x5')],util[_0xb4fe('0xb')](_0x45acfc,![],null)));}function close(){logger[_0xb4fe('0x9')](util[_0xb4fe('0xc')](_0xb4fe('0xd'),config[_0xb4fe('0x4')][_0xb4fe('0x6')],config[_0xb4fe('0x4')]['ip'],config[_0xb4fe('0x4')][_0xb4fe('0x5')]));}ami[_0xb4fe('0xe')]=function(){return function(){return ami[_0xb4fe('0xf')]({'action':_0xb4fe('0x10')});};};ami[_0xb4fe('0x11')]=function(){return function(){return ami[_0xb4fe('0xf')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xb4fe('0xf')]({'action':_0xb4fe('0x12')});};};ami[_0xb4fe('0x13')]=function(){return function(){return ami[_0xb4fe('0xf')]({'action':_0xb4fe('0x14')});};};ami[_0xb4fe('0x15')]=function(){return function(){return ami[_0xb4fe('0xf')]({'action':'coreshowchannels'});};};function connect(_0x234415){logger['info'](util[_0xb4fe('0xc')](_0xb4fe('0x16'),config[_0xb4fe('0x4')]['username'],config[_0xb4fe('0x4')]['ip'],config[_0xb4fe('0x4')][_0xb4fe('0x5')]));ami['once'](_0xb4fe('0x9'),error);ami[_0xb4fe('0x17')]('close',close);}ami['on'](_0xb4fe('0x18'),connect);ami['on'](_0xb4fe('0x19'),function(_0x568f96){logger[_0xb4fe('0x1a')](util[_0xb4fe('0xc')](_0xb4fe('0x1b'),config[_0xb4fe('0x4')][_0xb4fe('0x6')],config[_0xb4fe('0x4')]['ip'],config[_0xb4fe('0x4')][_0xb4fe('0x5')],util[_0xb4fe('0xb')](_0x568f96,![],null)));});ami['on'](_0xb4fe('0x1c'),function(_0x56332c){logger[_0xb4fe('0x1a')](util[_0xb4fe('0xc')](_0xb4fe('0x1d'),config[_0xb4fe('0x4')][_0xb4fe('0x6')],config[_0xb4fe('0x4')]['ip'],config['asterisk'][_0xb4fe('0x5')]));return BPromise[_0xb4fe('0x1e')]()[_0xb4fe('0x1f')](ami[_0xb4fe('0xe')]())['then'](ami['actionDeviceStateList']())[_0xb4fe('0x1f')](ami[_0xb4fe('0x20')]())[_0xb4fe('0x1f')](ami[_0xb4fe('0x13')]())[_0xb4fe('0x1f')](ami['actionCoreShowChannels']())[_0xb4fe('0x21')](function(_0x2dfa99){console[_0xb4fe('0x22')](_0x2dfa99);});});ami[_0xb4fe('0x17')](_0xb4fe('0x9'),error);ami[_0xb4fe('0x17')](_0xb4fe('0x23'),close);module['exports']=ami; \ No newline at end of file +var _0xde8c=['username','password','keepConnected','promisify','action','format','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','util','lodash','../../config/logger','ami','asterisk','port'];(function(_0x10854e,_0x2b0de2){var _0x3d5ab0=function(_0x2c4d06){while(--_0x2c4d06){_0x10854e['push'](_0x10854e['shift']());}};_0x3d5ab0(++_0x2b0de2);}(_0xde8c,0x6f));var _0xcde8=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xde8c[_0xb1cf84];return _0x4bad2e;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xcde8('0x0'));var _=require(_0xcde8('0x1'));var logger=require(_0xcde8('0x2'))(_0xcde8('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0xcde8('0x4')][_0xcde8('0x5')],config['asterisk']['ip'],config[_0xcde8('0x4')][_0xcde8('0x6')],config[_0xcde8('0x4')][_0xcde8('0x7')],!![]);ami[_0xcde8('0x8')]();ami['Action']=BPromise[_0xcde8('0x9')](ami[_0xcde8('0xa')]);function error(_0x23a129){logger['error'](util[_0xcde8('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xcde8('0x4')]['username'],config[_0xcde8('0x4')]['ip'],config[_0xcde8('0x4')][_0xcde8('0x5')],util[_0xcde8('0xc')](_0x23a129,![],null)));}function close(){logger[_0xcde8('0xd')](util[_0xcde8('0xb')](_0xcde8('0xe'),config[_0xcde8('0x4')]['username'],config[_0xcde8('0x4')]['ip'],config[_0xcde8('0x4')][_0xcde8('0x5')]));}ami[_0xcde8('0xf')]=function(){return function(){return ami[_0xcde8('0x10')]({'action':_0xcde8('0x11')});};};ami[_0xcde8('0x12')]=function(){return function(){return ami[_0xcde8('0x10')]({'action':_0xcde8('0x13')});};};ami[_0xcde8('0x14')]=function(){return function(){return ami[_0xcde8('0x10')]({'action':_0xcde8('0x15')});};};ami[_0xcde8('0x16')]=function(){return function(){return ami[_0xcde8('0x10')]({'action':_0xcde8('0x17')});};};ami[_0xcde8('0x18')]=function(){return function(){return ami[_0xcde8('0x10')]({'action':'coreshowchannels'});};};function connect(_0x5ca5e4){logger[_0xcde8('0x19')](util[_0xcde8('0xb')](_0xcde8('0x1a'),config[_0xcde8('0x4')][_0xcde8('0x6')],config[_0xcde8('0x4')]['ip'],config[_0xcde8('0x4')][_0xcde8('0x5')]));ami[_0xcde8('0x1b')](_0xcde8('0xd'),error);ami['once'](_0xcde8('0x1c'),close);}ami['on'](_0xcde8('0x1d'),connect);ami['on'](_0xcde8('0x1e'),function(_0x24f296){logger[_0xcde8('0x19')](util[_0xcde8('0xb')](_0xcde8('0x1f'),config['asterisk']['username'],config[_0xcde8('0x4')]['ip'],config[_0xcde8('0x4')][_0xcde8('0x5')],util[_0xcde8('0xc')](_0x24f296,![],null)));});ami['on'](_0xcde8('0x20'),function(_0x22e370){logger['info'](util[_0xcde8('0xb')](_0xcde8('0x21'),config['asterisk']['username'],config[_0xcde8('0x4')]['ip'],config[_0xcde8('0x4')][_0xcde8('0x5')]));return BPromise[_0xcde8('0x22')]()['then'](ami[_0xcde8('0xf')]())[_0xcde8('0x23')](ami[_0xcde8('0x12')]())[_0xcde8('0x23')](ami[_0xcde8('0x14')]())[_0xcde8('0x23')](ami[_0xcde8('0x16')]())['then'](ami[_0xcde8('0x18')]())[_0xcde8('0x24')](function(_0x41a5a3){console[_0xcde8('0x25')](_0x41a5a3);});});ami[_0xcde8('0x1b')](_0xcde8('0xd'),error);ami[_0xcde8('0x1b')](_0xcde8('0x1c'),close);module[_0xcde8('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 09cb62d..7c2ee8c 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xda3f,0xec));var _0xfda3=function(_0x550ec8,_0xbcfc32){_0x550ec8=_0x550ec8-0x0;var _0x14ff23=_0xda3f[_0x550ec8];return _0x14ff23;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x5ab2b4,_0x288fab){var _0x326806=function(_0x3ad9d5){while(--_0x3ad9d5){_0x5ab2b4['push'](_0x5ab2b4['shift']());}};_0x326806(++_0x288fab);}(_0xb43b,0x1b2));var _0xbb43=function(_0x36ff93,_0x108671){_0x36ff93=_0x36ff93-0x0;var _0x116bb5=_0xb43b[_0x36ff93];return _0x116bb5;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index dee2dd6..b643533 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2e8=['recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','isNil','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat'];(function(_0x3ff56c,_0x2c43d6){var _0xa7e82b=function(_0x27239b){while(--_0x27239b){_0x3ff56c['push'](_0x3ff56c['shift']());}};_0xa7e82b(++_0x2c43d6);}(_0xe2e8,0x13e));var _0x8e2e=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xe2e8[_0x581af1];return _0x54c22e;};'use strict';var util=require(_0x8e2e('0x0'));var _=require(_0x8e2e('0x1'));var moment=require(_0x8e2e('0x2'));function checkNameSurname(_0x212def,_0x50e686,_0x2fa780){var _0x43a6c0='';if(!_['isNil'](_0x50e686)&&_0x8e2e('0x3')===typeof _0x50e686){_0x43a6c0+=_0x50e686;}if(!_[_0x8e2e('0x4')](_0x2fa780)&&_0x8e2e('0x3')===typeof _0x2fa780){_0x43a6c0+='\x20'+_0x2fa780;}if(_0x43a6c0!==''){return _0x43a6c0;}return _0x212def;}function Action(_0x299eb2,_0x403478,_0x860b6e){this['voiceQueue']=_0x299eb2;this[_0x8e2e('0x5')]=_0x860b6e||undefined;this[_0x8e2e('0x6')]=checkNameSurname(_0x403478[_0x8e2e('0x7')][_0x8e2e('0x8')],_0x403478['Contact'][_0x8e2e('0x9')],_0x403478[_0x8e2e('0x7')][_0x8e2e('0xa')]);this[_0x8e2e('0xb')]=_0x403478['Contact'][_0x8e2e('0x8')];this[_0x8e2e('0xc')]=_0x299eb2[_0x8e2e('0x6')];this['active']=_0x403478[_0x8e2e('0xd')]||![];this['type']=_0x299eb2['type'];this[_0x8e2e('0xe')]=_0x299eb2[_0x8e2e('0xe')]||0x3;this[_0x8e2e('0xf')]=_0x403478[_0x8e2e('0xf')];this['countbusyretry']=_0x403478[_0x8e2e('0x10')];this[_0x8e2e('0x11')]=_0x403478[_0x8e2e('0x11')];this[_0x8e2e('0x12')]=_0x403478[_0x8e2e('0x12')];this['countnosuchnumberretry']=_0x403478[_0x8e2e('0x13')];this[_0x8e2e('0x14')]=_0x403478[_0x8e2e('0x14')];this[_0x8e2e('0x15')]=_0x403478[_0x8e2e('0x15')];this[_0x8e2e('0x16')]=_0x403478[_0x8e2e('0x16')];this[_0x8e2e('0x17')]=_0x403478['countagentrejectretry'];this[_0x8e2e('0x18')]=_0x403478['ContactId'];this['ListId']=_0x403478['ListId'];this['UserId']=_0x403478['UserId'];this[_0x8e2e('0x19')]=_0x403478[_0x8e2e('0x19')];this[_0x8e2e('0x1a')]=_0x403478['CampaignId'];this[_0x8e2e('0x1b')]=_0x403478['id'];this[_0x8e2e('0x1c')]=_0x403478[_0x8e2e('0x7')][_0x8e2e('0x9')]||'';this['starttime']=moment()[_0x8e2e('0x1d')](_0x8e2e('0x1e'));this[_0x8e2e('0x1f')]=_0x403478[_0x8e2e('0x1f')];this[_0x8e2e('0x20')]=_0x403478[_0x8e2e('0x20')];this[_0x8e2e('0x21')]=_0x403478[_0x8e2e('0x21')];this[_0x8e2e('0x22')]=_0x403478['recallme'];this[_0x8e2e('0x23')]='';this[_0x8e2e('0x24')]='';}Action[_0x8e2e('0x25')][_0x8e2e('0x26')]=function(){return util[_0x8e2e('0x1d')]('\x22%s\x22\x20<%s>',this[_0x8e2e('0x6')],this[_0x8e2e('0x27')][_0x8e2e('0x28')]>0x0?this[_0x8e2e('0xb')][_0x8e2e('0x29')](this[_0x8e2e('0x27')][_0x8e2e('0x28')]):this[_0x8e2e('0xb')]);};Action[_0x8e2e('0x25')][_0x8e2e('0x2a')]=function(){return this[_0x8e2e('0xc')];};module[_0x8e2e('0x2b')]=Action; \ No newline at end of file +var _0x800b=['countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','substring','prototype','getQueue','exports','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x800b,0x191));var _0xb800=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x800b[_0x1f36bb];return _0xaf97fa;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb800('0x0'));function checkNameSurname(_0x136ee6,_0x168663,_0x3ebcad){var _0x441ab1='';if(!_['isNil'](_0x168663)&&'string'===typeof _0x168663){_0x441ab1+=_0x168663;}if(!_[_0xb800('0x1')](_0x3ebcad)&&_0xb800('0x2')===typeof _0x3ebcad){_0x441ab1+='\x20'+_0x3ebcad;}if(_0x441ab1!==''){return _0x441ab1;}return _0x136ee6;}function Action(_0x139223,_0x453f52,_0x122d50){this[_0xb800('0x3')]=_0x139223;this[_0xb800('0x4')]=_0x122d50||undefined;this[_0xb800('0x5')]=checkNameSurname(_0x453f52[_0xb800('0x6')][_0xb800('0x7')],_0x453f52[_0xb800('0x6')]['firstName'],_0x453f52[_0xb800('0x6')]['lastName']);this[_0xb800('0x8')]=_0x453f52['Contact'][_0xb800('0x7')];this[_0xb800('0x9')]=_0x139223['name'];this[_0xb800('0xa')]=_0x453f52[_0xb800('0xa')]||![];this['type']=_0x139223[_0xb800('0xb')];this[_0xb800('0xc')]=_0x139223[_0xb800('0xc')]||0x3;this[_0xb800('0xd')]=_0x453f52[_0xb800('0xd')];this[_0xb800('0xe')]=_0x453f52[_0xb800('0xe')];this[_0xb800('0xf')]=_0x453f52[_0xb800('0xf')];this[_0xb800('0x10')]=_0x453f52[_0xb800('0x10')];this[_0xb800('0x11')]=_0x453f52[_0xb800('0x11')];this['countdropretry']=_0x453f52['countdropretry'];this['countabandonedretry']=_0x453f52[_0xb800('0x12')];this[_0xb800('0x13')]=_0x453f52['countmachineretry'];this['countagentrejectretry']=_0x453f52[_0xb800('0x14')];this['ContactId']=_0x453f52[_0xb800('0x15')];this['ListId']=_0x453f52[_0xb800('0x16')];this[_0xb800('0x17')]=_0x453f52['UserId'];this[_0xb800('0x18')]=_0x453f52[_0xb800('0x18')];this[_0xb800('0x19')]=_0x453f52['CampaignId'];this[_0xb800('0x1a')]=_0x453f52['id'];this[_0xb800('0x1b')]=_0x453f52[_0xb800('0x6')][_0xb800('0x1c')]||'';this[_0xb800('0x1d')]=moment()[_0xb800('0x1e')](_0xb800('0x1f'));this['callback']=_0x453f52['callback'];this[_0xb800('0x20')]=_0x453f52[_0xb800('0x20')];this[_0xb800('0x21')]=_0x453f52['callbackat'];this['recallme']=_0x453f52[_0xb800('0x22')];this[_0xb800('0x23')]='';this[_0xb800('0x24')]='';}Action['prototype']['getCaller']=function(){return util['format'](_0xb800('0x25'),this['name'],this[_0xb800('0x3')]['dialCutDigit']>0x0?this[_0xb800('0x8')][_0xb800('0x26')](this[_0xb800('0x3')]['dialCutDigit']):this[_0xb800('0x8')]);};Action[_0xb800('0x27')][_0xb800('0x28')]=function(){return this[_0xb800('0x9')];};module[_0xb800('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 700ab45..0a24880 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf58b=['statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','responsetime','answertime','format','ringtime','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state'];(function(_0x17bab9,_0xb7f42e){var _0x81f1fd=function(_0x56d4b1){while(--_0x56d4b1){_0x17bab9['push'](_0x17bab9['shift']());}};_0x81f1fd(++_0xb7f42e);}(_0xf58b,0x12d));var _0xbf58=function(_0x1e4177,_0x26a73a){_0x1e4177=_0x1e4177-0x0;var _0xa6e76c=_0xf58b[_0x1e4177];return _0xa6e76c;};'use strict';var util=require(_0xbf58('0x0'));var _=require(_0xbf58('0x1'));var moment=require(_0xbf58('0x2'));function getSeconds(_0x2ac070,_0x49ca2a){var _0x18a737=moment(_0x2ac070)[_0xbf58('0x3')](0x0);var _0x62a6f1=moment(_0x49ca2a)['milliseconds'](0x0);return _0x18a737[_0xbf58('0x4')](_0x62a6f1,_0xbf58('0x5'));}function AgentComplete(_0x572cc7,_0x541767){this[_0xbf58('0x6')]=0x4;this[_0xbf58('0x7')]=_0xbf58('0x8');this['scheduledat']=_0x572cc7['scheduledat'];this[_0xbf58('0x9')]=_0x572cc7[_0xbf58('0x9')];this[_0xbf58('0xa')]=_0x572cc7[_0xbf58('0x9')]===_0xbf58('0xb')?_0xbf58('0xc'):_0x572cc7[_0xbf58('0x9')];this[_0xbf58('0xd')]=_0x572cc7[_0xbf58('0xd')];this[_0xbf58('0xe')]=_0x572cc7[_0xbf58('0xe')];this[_0xbf58('0xf')]=_0x572cc7[_0xbf58('0xf')];this[_0xbf58('0x10')]=_0x572cc7[_0xbf58('0xd')]+_0x572cc7['countcongestionretry']+_0x572cc7[_0xbf58('0xf')]+_0x572cc7[_0xbf58('0x11')]+_0x572cc7['countdropretry']+_0x572cc7[_0xbf58('0x12')]+_0x572cc7[_0xbf58('0x13')]+_0x572cc7[_0xbf58('0x14')];this[_0xbf58('0x11')]=_0x572cc7[_0xbf58('0x11')];this[_0xbf58('0x15')]=_0x572cc7['countdropretry'];this['countabandonedretry']=_0x572cc7[_0xbf58('0x12')];this['countmachineretry']=_0x572cc7[_0xbf58('0x13')];this[_0xbf58('0x14')]=_0x572cc7[_0xbf58('0x14')];this['uniqueid']=_0x541767[_0xbf58('0x16')];this['calleridname']=_0x572cc7[_0xbf58('0x17')];this[_0xbf58('0x18')]=_0x572cc7['number'];this['starttime']=_0x572cc7['starttime'];this[_0xbf58('0x19')]=_0x572cc7[_0xbf58('0x19')];this[_0xbf58('0x1a')]=_0x572cc7['answertime'];this['endtime']=moment()[_0xbf58('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbf58('0x1c')]=getSeconds(_0x572cc7[_0xbf58('0x19')],_0x572cc7[_0xbf58('0x1d')]);this[_0xbf58('0x1e')]=getSeconds(_0x572cc7[_0xbf58('0x1a')],_0x572cc7[_0xbf58('0x19')]);this[_0xbf58('0x1f')]=getSeconds(this['endtime'],_0x572cc7[_0xbf58('0x1a')]);this[_0xbf58('0xc')]=_0x541767[_0xbf58('0xc')];this['membername']=_0x541767[_0xbf58('0x20')];this[_0xbf58('0x21')]=_0x541767[_0xbf58('0x21')];this[_0xbf58('0x22')]=_0x572cc7[_0xbf58('0x22')];this[_0xbf58('0x23')]=_0x572cc7[_0xbf58('0x23')];this[_0xbf58('0x24')]=_0x572cc7['callbackat'];this['recallme']=_0x572cc7['recallme'];this[_0xbf58('0x25')]=_0x572cc7[_0xbf58('0x25')];this[_0xbf58('0x26')]=_0x572cc7['ListId'];this[_0xbf58('0x27')]=_0x572cc7[_0xbf58('0x27')];this[_0xbf58('0x28')]=_0x572cc7[_0xbf58('0x28')];this[_0xbf58('0x29')]=_0x572cc7[_0xbf58('0x29')];this[_0xbf58('0x2a')]=_0x572cc7['originatecalleridnum']||'';this[_0xbf58('0x2b')]=_0x572cc7[_0xbf58('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x87d7=['calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x87d7,0x154));var _0x787d=function(_0x382ff2,_0x45ac63){_0x382ff2=_0x382ff2-0x0;var _0x40f8d8=_0x87d7[_0x382ff2];return _0x40f8d8;};'use strict';var util=require('util');var _=require(_0x787d('0x0'));var moment=require(_0x787d('0x1'));function getSeconds(_0x3ecce6,_0x1a2fb4){var _0x55550b=moment(_0x3ecce6)['milliseconds'](0x0);var _0x23a155=moment(_0x1a2fb4)[_0x787d('0x2')](0x0);return _0x55550b[_0x787d('0x3')](_0x23a155,_0x787d('0x4'));}function AgentComplete(_0x2c64fe,_0x31209e){this['state']=0x4;this[_0x787d('0x5')]=_0x787d('0x6');this['scheduledat']=_0x2c64fe[_0x787d('0x7')];this[_0x787d('0x8')]=_0x2c64fe['type'];this[_0x787d('0x9')]=_0x2c64fe[_0x787d('0x8')]==='outbound'?'queue':_0x2c64fe['type'];this[_0x787d('0xa')]=_0x2c64fe[_0x787d('0xa')];this['countcongestionretry']=_0x2c64fe[_0x787d('0xb')];this[_0x787d('0xc')]=_0x2c64fe[_0x787d('0xc')];this[_0x787d('0xd')]=_0x2c64fe[_0x787d('0xa')]+_0x2c64fe[_0x787d('0xb')]+_0x2c64fe[_0x787d('0xc')]+_0x2c64fe[_0x787d('0xe')]+_0x2c64fe[_0x787d('0xf')]+_0x2c64fe[_0x787d('0x10')]+_0x2c64fe[_0x787d('0x11')]+_0x2c64fe['countagentrejectretry'];this[_0x787d('0xe')]=_0x2c64fe['countnosuchnumberretry'];this[_0x787d('0xf')]=_0x2c64fe[_0x787d('0xf')];this[_0x787d('0x10')]=_0x2c64fe['countabandonedretry'];this['countmachineretry']=_0x2c64fe[_0x787d('0x11')];this[_0x787d('0x12')]=_0x2c64fe[_0x787d('0x12')];this[_0x787d('0x13')]=_0x31209e[_0x787d('0x13')];this[_0x787d('0x14')]=_0x2c64fe['name'];this[_0x787d('0x15')]=_0x2c64fe[_0x787d('0x16')];this[_0x787d('0x17')]=_0x2c64fe[_0x787d('0x17')];this['responsetime']=_0x2c64fe[_0x787d('0x18')];this['answertime']=_0x2c64fe[_0x787d('0x19')];this[_0x787d('0x1a')]=moment()[_0x787d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x787d('0x1c')]=getSeconds(_0x2c64fe[_0x787d('0x18')],_0x2c64fe['starttime']);this[_0x787d('0x1d')]=getSeconds(_0x2c64fe[_0x787d('0x19')],_0x2c64fe[_0x787d('0x18')]);this[_0x787d('0x1e')]=getSeconds(this[_0x787d('0x1a')],_0x2c64fe[_0x787d('0x19')]);this[_0x787d('0x1f')]=_0x31209e[_0x787d('0x1f')];this[_0x787d('0x20')]=_0x31209e[_0x787d('0x20')];this[_0x787d('0x21')]=_0x31209e[_0x787d('0x21')];this[_0x787d('0x22')]=_0x2c64fe['callback'];this[_0x787d('0x23')]=_0x2c64fe[_0x787d('0x23')];this[_0x787d('0x24')]=_0x2c64fe[_0x787d('0x24')];this[_0x787d('0x25')]=_0x2c64fe[_0x787d('0x25')];this[_0x787d('0x26')]=_0x2c64fe[_0x787d('0x26')];this['ListId']=_0x2c64fe[_0x787d('0x27')];this[_0x787d('0x28')]=_0x2c64fe[_0x787d('0x28')];this[_0x787d('0x29')]=_0x2c64fe[_0x787d('0x29')];this[_0x787d('0x2a')]=_0x2c64fe[_0x787d('0x2a')];this['originatecalleridnum']=_0x2c64fe['originatecalleridnum']||'';this[_0x787d('0x2b')]=_0x2c64fe[_0x787d('0x2b')]||'';}module[_0x787d('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index f4952fc..601a9e8 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x39573e,_0x59f3b2){var _0x5ce0b9=function(_0x565e2f){while(--_0x565e2f){_0x39573e['push'](_0x39573e['shift']());}};_0x5ce0b9(++_0x59f3b2);}(_0xa630,0xbe));var _0x0a63=function(_0x5f29da,_0x50c817){_0x5f29da=_0x5f29da-0x0;var _0x1f0f0e=_0xa630[_0x5f29da];return _0x1f0f0e;};'use strict';var util=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));var moment=require('moment');function getSeconds(_0x52ad93,_0x1a9586){var _0x4f6b34=moment(_0x52ad93)[_0x0a63('0x2')](0x0);var _0x506b55=moment(_0x1a9586)[_0x0a63('0x2')](0x0);return _0x4f6b34[_0x0a63('0x3')](_0x506b55,_0x0a63('0x4'));}function Final(_0x2380f8){this[_0x0a63('0x5')]=_0x2380f8['uniqueid'];this[_0x0a63('0x6')]=_0x2380f8[_0x0a63('0x6')];this[_0x0a63('0x7')]=_0x2380f8[_0x0a63('0x7')];this[_0x0a63('0x8')]=_0x2380f8[_0x0a63('0x7')]==='outbound'?_0x0a63('0x9'):_0x2380f8[_0x0a63('0x7')];this[_0x0a63('0xa')]=_0x2380f8[_0x0a63('0xa')];this[_0x0a63('0xb')]=_0x2380f8[_0x0a63('0xb')];this[_0x0a63('0xc')]=_0x2380f8[_0x0a63('0xc')];this[_0x0a63('0xd')]=_0x2380f8[_0x0a63('0xa')]+_0x2380f8['countcongestionretry']+_0x2380f8[_0x0a63('0xc')]+_0x2380f8[_0x0a63('0xe')]+_0x2380f8[_0x0a63('0xf')]+_0x2380f8[_0x0a63('0x10')]+_0x2380f8['countmachineretry']+_0x2380f8[_0x0a63('0x11')];this['countnosuchnumberretry']=_0x2380f8[_0x0a63('0xe')];this[_0x0a63('0xf')]=_0x2380f8[_0x0a63('0xf')];this[_0x0a63('0x10')]=_0x2380f8[_0x0a63('0x10')];this[_0x0a63('0x12')]=_0x2380f8[_0x0a63('0x12')];this[_0x0a63('0x11')]=_0x2380f8['countagentrejectretry'];this[_0x0a63('0x9')]=_0x2380f8['queue'];this[_0x0a63('0x13')]=_0x2380f8[_0x0a63('0x13')];this[_0x0a63('0x14')]=_0x2380f8[_0x0a63('0x14')];this[_0x0a63('0x15')]=_0x2380f8[_0x0a63('0x15')];this[_0x0a63('0x16')]=_0x2380f8[_0x0a63('0x16')];this[_0x0a63('0x17')]=_0x2380f8[_0x0a63('0x16')];this[_0x0a63('0x18')]=_0x2380f8['ringtime']||0x0;this['holdtime']=_0x2380f8[_0x0a63('0x19')]||0x0;this['talktime']=_0x2380f8[_0x0a63('0x1a')]||0x0;this['callback']=_0x2380f8[_0x0a63('0x1b')];this[_0x0a63('0x1c')]=_0x2380f8[_0x0a63('0x1c')];this[_0x0a63('0x1d')]=_0x2380f8['callbackat'];this[_0x0a63('0x1e')]=_0x2380f8['recallme'];this[_0x0a63('0x1f')]=_0x2380f8[_0x0a63('0x1f')];this[_0x0a63('0x20')]=_0x2380f8[_0x0a63('0x20')];this[_0x0a63('0x21')]=_0x2380f8[_0x0a63('0x21')];this[_0x0a63('0x22')]=_0x2380f8[_0x0a63('0x22')];this['CampaignId']=_0x2380f8['CampaignId'];this['originatecalleridnum']=_0x2380f8['originatecalleridnum']||'';this[_0x0a63('0x23')]=_0x2380f8['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file +var _0x3435=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3435,0xfa));var _0x5343=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x3435[_0x32b542];return _0x554d54;};'use strict';var util=require(_0x5343('0x0'));var _=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));function getSeconds(_0x9ab4a3,_0x14c416){var _0x2a91fe=moment(_0x9ab4a3)['milliseconds'](0x0);var _0x3f1d67=moment(_0x14c416)[_0x5343('0x3')](0x0);return _0x2a91fe['diff'](_0x3f1d67,'seconds');}function Final(_0x1f0046){this[_0x5343('0x4')]=_0x1f0046['uniqueid'];this['scheduledat']=_0x1f0046[_0x5343('0x5')];this[_0x5343('0x6')]=_0x1f0046[_0x5343('0x6')];this[_0x5343('0x7')]=_0x1f0046[_0x5343('0x6')]==='outbound'?_0x5343('0x8'):_0x1f0046['type'];this[_0x5343('0x9')]=_0x1f0046[_0x5343('0x9')];this[_0x5343('0xa')]=_0x1f0046[_0x5343('0xa')];this[_0x5343('0xb')]=_0x1f0046['countnoanswerretry'];this[_0x5343('0xc')]=_0x1f0046[_0x5343('0x9')]+_0x1f0046[_0x5343('0xa')]+_0x1f0046['countnoanswerretry']+_0x1f0046[_0x5343('0xd')]+_0x1f0046['countdropretry']+_0x1f0046[_0x5343('0xe')]+_0x1f0046[_0x5343('0xf')]+_0x1f0046['countagentrejectretry'];this[_0x5343('0xd')]=_0x1f0046['countnosuchnumberretry'];this[_0x5343('0x10')]=_0x1f0046[_0x5343('0x10')];this[_0x5343('0xe')]=_0x1f0046[_0x5343('0xe')];this['countmachineretry']=_0x1f0046[_0x5343('0xf')];this[_0x5343('0x11')]=_0x1f0046[_0x5343('0x11')];this[_0x5343('0x8')]=_0x1f0046[_0x5343('0x8')];this[_0x5343('0x12')]=_0x1f0046[_0x5343('0x12')];this[_0x5343('0x13')]=_0x1f0046['calleridnum'];this[_0x5343('0x14')]=_0x1f0046[_0x5343('0x14')];this[_0x5343('0x15')]=_0x1f0046['responsetime'];this[_0x5343('0x16')]=_0x1f0046[_0x5343('0x15')];this[_0x5343('0x17')]=_0x1f0046[_0x5343('0x17')]||0x0;this[_0x5343('0x18')]=_0x1f0046[_0x5343('0x18')]||0x0;this[_0x5343('0x19')]=_0x1f0046[_0x5343('0x19')]||0x0;this[_0x5343('0x1a')]=_0x1f0046['callback'];this[_0x5343('0x1b')]=_0x1f0046[_0x5343('0x1b')];this[_0x5343('0x1c')]=_0x1f0046[_0x5343('0x1c')];this[_0x5343('0x1d')]=_0x1f0046['recallme'];this[_0x5343('0x1e')]=_0x1f0046[_0x5343('0x1e')];this[_0x5343('0x1f')]=_0x1f0046[_0x5343('0x1f')];this[_0x5343('0x20')]=_0x1f0046['UserId'];this[_0x5343('0x21')]=_0x1f0046[_0x5343('0x21')];this['CampaignId']=_0x1f0046[_0x5343('0x22')];this[_0x5343('0x23')]=_0x1f0046[_0x5343('0x23')]||'';this['originatecalleridname']=_0x1f0046['originatecalleridname']||'';}module[_0x5343('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 614e66c..22bef59 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb986=['state','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xb986,0x191));var _0x6b98=function(_0x5a1b7f,_0x11aa62){_0x5a1b7f=_0x5a1b7f-0x0;var _0x4f0333=_0xb986[_0x5a1b7f];return _0x4f0333;};'use strict';var util=require('util');var _=require(_0x6b98('0x0'));var moment=require(_0x6b98('0x1'));function getSeconds(_0x312766,_0x4f5498){var _0x4721ce=moment(_0x312766)[_0x6b98('0x2')](0x0);var _0x2dcecd=moment(_0x4f5498)['milliseconds'](0x0);return _0x4721ce[_0x6b98('0x3')](_0x2dcecd,'seconds');}function Hangup(_0x1f02b2,_0x45a5c0){this[_0x6b98('0x4')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x1f02b2[_0x6b98('0x5')];this[_0x6b98('0x6')]=_0x1f02b2[_0x6b98('0x6')];this['campaigntype']=_0x1f02b2[_0x6b98('0x6')]===_0x6b98('0x7')?_0x6b98('0x8'):_0x1f02b2[_0x6b98('0x6')];this['countbusyretry']=_0x1f02b2['countbusyretry'];this['countcongestionretry']=_0x1f02b2[_0x6b98('0x9')];this['countnoanswerretry']=_0x1f02b2[_0x6b98('0xa')];this[_0x6b98('0xb')]=_0x1f02b2[_0x6b98('0xc')]+_0x1f02b2['countcongestionretry']+_0x1f02b2[_0x6b98('0xa')]+_0x1f02b2['countnosuchnumberretry']+_0x1f02b2[_0x6b98('0xd')]+_0x1f02b2[_0x6b98('0xe')]+_0x1f02b2[_0x6b98('0xf')]+_0x1f02b2['countagentrejectretry'];this[_0x6b98('0x10')]=_0x1f02b2[_0x6b98('0x10')];this['countdropretry']=_0x1f02b2[_0x6b98('0xd')];this[_0x6b98('0xe')]=_0x1f02b2[_0x6b98('0xe')];this['countmachineretry']=_0x1f02b2[_0x6b98('0xf')];this[_0x6b98('0x11')]=_0x1f02b2['countagentrejectretry'];this[_0x6b98('0x12')]=_0x45a5c0[_0x6b98('0x12')];this[_0x6b98('0x13')]=_0x1f02b2[_0x6b98('0x14')];this[_0x6b98('0x15')]=_0x1f02b2[_0x6b98('0x16')];this[_0x6b98('0x17')]=_0x1f02b2[_0x6b98('0x17')];this[_0x6b98('0x18')]=_0x1f02b2['responsetime'];this[_0x6b98('0x19')]=moment()[_0x6b98('0x1a')](_0x6b98('0x1b'));this[_0x6b98('0x1c')]=getSeconds(_0x1f02b2[_0x6b98('0x18')],_0x1f02b2[_0x6b98('0x17')]);this[_0x6b98('0x1d')]=0x0;this[_0x6b98('0x1e')]=getSeconds(this[_0x6b98('0x19')],_0x1f02b2[_0x6b98('0x18')]);this[_0x6b98('0x8')]=_0x1f02b2['queue'];this[_0x6b98('0x1f')]=_0x6b98('0x20');this[_0x6b98('0x21')]=_0x45a5c0[_0x6b98('0x22')];this[_0x6b98('0x23')]=_0x1f02b2[_0x6b98('0x23')];this[_0x6b98('0x24')]=_0x1f02b2[_0x6b98('0x24')];this['callbackat']=_0x1f02b2[_0x6b98('0x25')];this['recallme']=_0x1f02b2[_0x6b98('0x26')];this[_0x6b98('0x27')]=_0x1f02b2[_0x6b98('0x27')];this[_0x6b98('0x28')]=_0x1f02b2[_0x6b98('0x28')];this[_0x6b98('0x29')]=_0x1f02b2[_0x6b98('0x29')];this[_0x6b98('0x2a')]=_0x1f02b2['VoiceQueueId'];this[_0x6b98('0x2b')]=_0x1f02b2[_0x6b98('0x2b')];}module[_0x6b98('0x2c')]=Hangup; \ No newline at end of file +var _0x0c4a=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme'];(function(_0x50fb34,_0x56b847){var _0x478797=function(_0x2a45df){while(--_0x2a45df){_0x50fb34['push'](_0x50fb34['shift']());}};_0x478797(++_0x56b847);}(_0x0c4a,0x191));var _0xa0c4=function(_0x374d5a,_0x501857){_0x374d5a=_0x374d5a-0x0;var _0x3b4a6b=_0x0c4a[_0x374d5a];return _0x3b4a6b;};'use strict';var util=require(_0xa0c4('0x0'));var _=require('lodash');var moment=require(_0xa0c4('0x1'));function getSeconds(_0x36a696,_0x33a1c6){var _0x1d1290=moment(_0x36a696)[_0xa0c4('0x2')](0x0);var _0xb0382=moment(_0x33a1c6)['milliseconds'](0x0);return _0x1d1290[_0xa0c4('0x3')](_0xb0382,_0xa0c4('0x4'));}function Hangup(_0x31648a,_0x1252a3){this['state']=0x4;this[_0xa0c4('0x5')]=_0xa0c4('0x6');this['scheduledat']=_0x31648a['scheduledat'];this[_0xa0c4('0x7')]=_0x31648a[_0xa0c4('0x7')];this[_0xa0c4('0x8')]=_0x31648a['type']===_0xa0c4('0x9')?_0xa0c4('0xa'):_0x31648a[_0xa0c4('0x7')];this['countbusyretry']=_0x31648a[_0xa0c4('0xb')];this[_0xa0c4('0xc')]=_0x31648a[_0xa0c4('0xc')];this[_0xa0c4('0xd')]=_0x31648a[_0xa0c4('0xd')];this[_0xa0c4('0xe')]=_0x31648a[_0xa0c4('0xb')]+_0x31648a[_0xa0c4('0xc')]+_0x31648a['countnoanswerretry']+_0x31648a['countnosuchnumberretry']+_0x31648a[_0xa0c4('0xf')]+_0x31648a[_0xa0c4('0x10')]+_0x31648a[_0xa0c4('0x11')]+_0x31648a['countagentrejectretry'];this[_0xa0c4('0x12')]=_0x31648a[_0xa0c4('0x12')];this[_0xa0c4('0xf')]=_0x31648a[_0xa0c4('0xf')];this[_0xa0c4('0x10')]=_0x31648a[_0xa0c4('0x10')];this[_0xa0c4('0x11')]=_0x31648a[_0xa0c4('0x11')];this[_0xa0c4('0x13')]=_0x31648a[_0xa0c4('0x13')];this[_0xa0c4('0x14')]=_0x1252a3[_0xa0c4('0x14')];this[_0xa0c4('0x15')]=_0x31648a[_0xa0c4('0x16')];this[_0xa0c4('0x17')]=_0x31648a[_0xa0c4('0x18')];this['starttime']=_0x31648a[_0xa0c4('0x19')];this['responsetime']=_0x31648a['responsetime'];this[_0xa0c4('0x1a')]=moment()[_0xa0c4('0x1b')](_0xa0c4('0x1c'));this[_0xa0c4('0x1d')]=getSeconds(_0x31648a[_0xa0c4('0x1e')],_0x31648a[_0xa0c4('0x19')]);this['holdtime']=0x0;this[_0xa0c4('0x1f')]=getSeconds(this['endtime'],_0x31648a['responsetime']);this[_0xa0c4('0xa')]=_0x31648a['queue'];this[_0xa0c4('0x20')]='IVR';this[_0xa0c4('0x21')]=_0x1252a3[_0xa0c4('0x22')];this[_0xa0c4('0x23')]=_0x31648a[_0xa0c4('0x23')];this[_0xa0c4('0x24')]=_0x31648a[_0xa0c4('0x24')];this[_0xa0c4('0x25')]=_0x31648a[_0xa0c4('0x25')];this[_0xa0c4('0x26')]=_0x31648a[_0xa0c4('0x26')];this['ContactId']=_0x31648a[_0xa0c4('0x27')];this[_0xa0c4('0x28')]=_0x31648a[_0xa0c4('0x28')];this[_0xa0c4('0x29')]=_0x31648a[_0xa0c4('0x29')];this['VoiceQueueId']=_0x31648a[_0xa0c4('0x2a')];this['CampaignId']=_0x31648a[_0xa0c4('0x2b')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 1222967..253327e 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb04=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcb04,0x9f));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x4cb0('0x0'));var _=require(_0x4cb0('0x1'));var moment=require(_0x4cb0('0x2'));function getSeconds(_0x3f2673,_0x14f492){var _0x198a24=moment(_0x3f2673)[_0x4cb0('0x3')](0x0);var _0x3292db=moment(_0x14f492)[_0x4cb0('0x3')](0x0);return _0x198a24[_0x4cb0('0x4')](_0x3292db,_0x4cb0('0x5'));}function History(_0xccf5e9){this[_0x4cb0('0x6')]=_0xccf5e9[_0x4cb0('0x6')];this['scheduledat']=_0xccf5e9[_0x4cb0('0x7')]||undefined;this[_0x4cb0('0x8')]=_0xccf5e9['type'];this[_0x4cb0('0x9')]=_0xccf5e9[_0x4cb0('0x8')]===_0x4cb0('0xa')?_0x4cb0('0xb'):_0xccf5e9[_0x4cb0('0x8')];this[_0x4cb0('0xc')]=_0xccf5e9[_0x4cb0('0xc')];this['countcongestionretry']=_0xccf5e9['countcongestionretry'];this[_0x4cb0('0xd')]=_0xccf5e9[_0x4cb0('0xd')];this['countglobal']=_0xccf5e9[_0x4cb0('0xc')]+_0xccf5e9[_0x4cb0('0xe')]+_0xccf5e9['countnoanswerretry']+_0xccf5e9['countnosuchnumberretry']+_0xccf5e9[_0x4cb0('0xf')]+_0xccf5e9[_0x4cb0('0x10')]+_0xccf5e9[_0x4cb0('0x11')]+_0xccf5e9[_0x4cb0('0x12')];this[_0x4cb0('0x13')]=_0xccf5e9[_0x4cb0('0x13')];this['countdropretry']=_0xccf5e9[_0x4cb0('0xf')];this[_0x4cb0('0x10')]=_0xccf5e9[_0x4cb0('0x10')];this[_0x4cb0('0x11')]=_0xccf5e9[_0x4cb0('0x11')];this['countagentrejectretry']=_0xccf5e9[_0x4cb0('0x12')];this[_0x4cb0('0xb')]=_0xccf5e9[_0x4cb0('0xb')];this[_0x4cb0('0x14')]=_0xccf5e9['name'];this[_0x4cb0('0x15')]=_0xccf5e9[_0x4cb0('0x16')];this['starttime']=_0xccf5e9[_0x4cb0('0x17')];this[_0x4cb0('0x18')]=_0xccf5e9['responsetime'];this['endtime']=_0xccf5e9['responsetime'];this['ringtime']=getSeconds(_0xccf5e9[_0x4cb0('0x18')],_0xccf5e9['starttime']);this[_0x4cb0('0x19')]=0x0;this[_0x4cb0('0x1a')]=0x0;this[_0x4cb0('0x1b')]=_0xccf5e9[_0x4cb0('0x1b')];this[_0x4cb0('0x1c')]=_0xccf5e9[_0x4cb0('0x1c')];this['callbackat']=_0xccf5e9['callbackat'];this[_0x4cb0('0x1d')]=_0xccf5e9[_0x4cb0('0x1d')];this['ContactId']=_0xccf5e9[_0x4cb0('0x1e')];this[_0x4cb0('0x1f')]=_0xccf5e9[_0x4cb0('0x1f')];this[_0x4cb0('0x20')]=_0xccf5e9[_0x4cb0('0x20')];this['VoiceQueueId']=_0xccf5e9[_0x4cb0('0x21')];this[_0x4cb0('0x22')]=_0xccf5e9[_0x4cb0('0x22')];this[_0x4cb0('0x23')]=_0xccf5e9['originatecalleridnum']||'';this[_0x4cb0('0x24')]=_0xccf5e9[_0x4cb0('0x24')]||'';}module[_0x4cb0('0x25')]=History; \ No newline at end of file +var _0x11ee=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','name','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x7326b,_0x2cc16a){var _0x42b36c=function(_0x208593){while(--_0x208593){_0x7326b['push'](_0x7326b['shift']());}};_0x42b36c(++_0x2cc16a);}(_0x11ee,0x14f));var _0xe11e=function(_0xe59cff,_0x1a7dbe){_0xe59cff=_0xe59cff-0x0;var _0x26e8c1=_0x11ee[_0xe59cff];return _0x26e8c1;};'use strict';var util=require(_0xe11e('0x0'));var _=require(_0xe11e('0x1'));var moment=require(_0xe11e('0x2'));function getSeconds(_0x2c4401,_0x5a19da){var _0x71a373=moment(_0x2c4401)[_0xe11e('0x3')](0x0);var _0x45c4aa=moment(_0x5a19da)[_0xe11e('0x3')](0x0);return _0x71a373[_0xe11e('0x4')](_0x45c4aa,_0xe11e('0x5'));}function History(_0x4338f2){this['uniqueid']=_0x4338f2[_0xe11e('0x6')];this[_0xe11e('0x7')]=_0x4338f2[_0xe11e('0x7')]||undefined;this['type']=_0x4338f2[_0xe11e('0x8')];this[_0xe11e('0x9')]=_0x4338f2[_0xe11e('0x8')]===_0xe11e('0xa')?_0xe11e('0xb'):_0x4338f2[_0xe11e('0x8')];this[_0xe11e('0xc')]=_0x4338f2[_0xe11e('0xc')];this['countcongestionretry']=_0x4338f2[_0xe11e('0xd')];this[_0xe11e('0xe')]=_0x4338f2['countnoanswerretry'];this['countglobal']=_0x4338f2[_0xe11e('0xc')]+_0x4338f2[_0xe11e('0xd')]+_0x4338f2[_0xe11e('0xe')]+_0x4338f2[_0xe11e('0xf')]+_0x4338f2['countdropretry']+_0x4338f2[_0xe11e('0x10')]+_0x4338f2[_0xe11e('0x11')]+_0x4338f2['countagentrejectretry'];this['countnosuchnumberretry']=_0x4338f2[_0xe11e('0xf')];this[_0xe11e('0x12')]=_0x4338f2['countdropretry'];this[_0xe11e('0x10')]=_0x4338f2['countabandonedretry'];this[_0xe11e('0x11')]=_0x4338f2[_0xe11e('0x11')];this[_0xe11e('0x13')]=_0x4338f2[_0xe11e('0x13')];this[_0xe11e('0xb')]=_0x4338f2[_0xe11e('0xb')];this['calleridname']=_0x4338f2[_0xe11e('0x14')];this['calleridnum']=_0x4338f2['number'];this['starttime']=_0x4338f2[_0xe11e('0x15')];this[_0xe11e('0x16')]=_0x4338f2[_0xe11e('0x16')];this[_0xe11e('0x17')]=_0x4338f2[_0xe11e('0x16')];this[_0xe11e('0x18')]=getSeconds(_0x4338f2[_0xe11e('0x16')],_0x4338f2[_0xe11e('0x15')]);this['holdtime']=0x0;this[_0xe11e('0x19')]=0x0;this['callback']=_0x4338f2[_0xe11e('0x1a')];this[_0xe11e('0x1b')]=_0x4338f2[_0xe11e('0x1b')];this[_0xe11e('0x1c')]=_0x4338f2[_0xe11e('0x1c')];this['recallme']=_0x4338f2['recallme'];this['ContactId']=_0x4338f2[_0xe11e('0x1d')];this[_0xe11e('0x1e')]=_0x4338f2[_0xe11e('0x1e')];this[_0xe11e('0x1f')]=_0x4338f2[_0xe11e('0x1f')];this['VoiceQueueId']=_0x4338f2[_0xe11e('0x20')];this[_0xe11e('0x21')]=_0x4338f2[_0xe11e('0x21')];this[_0xe11e('0x22')]=_0x4338f2[_0xe11e('0x22')]||'';this[_0xe11e('0x23')]=_0x4338f2[_0xe11e('0x23')]||'';}module[_0xe11e('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 1094e5e..05a7114 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 _0x222f=['erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','md5','format','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','loopClearZombieChannels','uniqueId','clearZombieChannels','[actions]','undefined','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','status','reachable','uniqueid','variable','exten','xcally-motion-dialer','value','HANGUP','statedesc','HangupInAMD','membername','AMD','amd','MACHINE','Machine','countmachineretry','countglobal','custom:amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','dialAMDActive','[syncHangupInAMDIvr]','countcongestionretry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','TIMEOUT','dialDropMaxRetry','add','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','roundrobin','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','timezones','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','handleIvr','checkIfTime','dialTimezone','[syncQueueSummary]','dialGlobalInterval','launchHandleIvr','\x5cw{0,','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialCutDigit','SIP/%s/%s%s','trim','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','booked','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','dialLimitQueue','dialOrderByScheduledAt','[actionOriginate]\x20','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','lodash','bluebird','uuid','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','milliseconds','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumHoldTime','total','unmanaged','abandoned','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','originated','erlangCalls'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x222f,0x1a4));var _0xf222=function(_0x1a8396,_0x280126){_0x1a8396=_0x1a8396-0x0;var _0x29ce3=_0x222f[_0x1a8396];return _0x29ce3;};'use strict';var util=require(_0xf222('0x0'));var _=require(_0xf222('0x1'));var BPromise=require(_0xf222('0x2'));var uuid=require(_0xf222('0x3'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0xf222('0x4'));var ut=require(_0xf222('0x5'));var config=require(_0xf222('0x6'));var logger=require(_0xf222('0x7'))('dialer');var loggerBooked=require(_0xf222('0x7'))('booked');var loggerPredictive=require(_0xf222('0x7'))(_0xf222('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf222('0x9'));var loggerSyncQueueSummary=require(_0xf222('0x7'))('syncQueueSummary');var ami=require(_0xf222('0xa'));config[_0xf222('0xb')]=_[_0xf222('0xc')](config[_0xf222('0xb')],{'host':_0xf222('0xd'),'port':0x18eb});var io=require(_0xf222('0xe'))(new Redis(config['redis']));var cmHopper=require(_0xf222('0xf'));var cmHopperHistory=require(_0xf222('0x10'));var cmHopperBlack=require(_0xf222('0x11'));var voiceQueueRt=require(_0xf222('0x12'));var Action=require('./action');var History=require(_0xf222('0x13'));var Final=require(_0xf222('0x14'));var AgentComplete=require(_0xf222('0x15'));var QueueCallerAbandon=require(_0xf222('0x16'));var Hangup=require(_0xf222('0x17'));var ipAgi=process[_0xf222('0x18')][_0xf222('0x19')]||_0xf222('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xf222('0x1b')][_0xf222('0x1c')]=function(_0x4c2314){this[_0xf222('0x1d')]=this[_0xf222('0x1d')]?this[_0xf222('0x1d')][_0xf222('0x1e')](_0x4c2314):_0x4c2314();};function Dialer(_0x464060,_0x25e1c2){this[_0xf222('0x1f')]=new Sequence();this['preview']=_0x25e1c2;this[_0xf222('0x20')]=_0x464060[_0xf222('0x20')];this[_0xf222('0x21')]=_0x464060[_0xf222('0x21')];this[_0xf222('0x22')]=_0x464060[_0xf222('0x22')];this[_0xf222('0x23')]=_0x464060['trunks'];this[_0xf222('0x24')]=config[_0xf222('0x24')]||0x2;this[_0xf222('0x25')]={};this[_0xf222('0x26')]={};this['contactsId']={};this['uniqueId']={};this[_0xf222('0x27')]={};this[_0xf222('0x28')]={};this[_0xf222('0x29')]={};this[_0xf222('0x2a')]={};this[_0xf222('0x2b')]={};this[_0xf222('0x2c')]={};ami['on']('agentconnect',this[_0xf222('0x2d')][_0xf222('0x2e')](this));ami['on'](_0xf222('0x2f'),this[_0xf222('0x30')][_0xf222('0x2e')](this));ami['on'](_0xf222('0x31'),this[_0xf222('0x32')][_0xf222('0x2e')](this));ami['on']('agentcomplete',this[_0xf222('0x33')][_0xf222('0x2e')](this));ami['on'](_0xf222('0x34'),this[_0xf222('0x35')][_0xf222('0x2e')](this));ami['on'](_0xf222('0x36'),this[_0xf222('0x37')][_0xf222('0x2e')](this));ami['on'](_0xf222('0x38'),this[_0xf222('0x39')][_0xf222('0x2e')](this));ami['on']('varset',this[_0xf222('0x3a')][_0xf222('0x2e')](this));ami['on'](_0xf222('0x3b'),this[_0xf222('0x3c')][_0xf222('0x2e')](this));ami['on'](_0xf222('0x3d'),this[_0xf222('0x3e')][_0xf222('0x2e')](this));this[_0xf222('0x3f')]();this['loopClearZombieChannels']();}function isNotNull(_0x3bdf98){return _0x3bdf98!==null&&!_[_0xf222('0x40')](_0x3bdf98);}function checkIsLoggedIn(_0x3ffc30,_0x53a382){return function(){if(_0x53a382<=0x0){_0x3ffc30[_0xf222('0x41')]='AGENTS_NOT_LOGGED';throw _0x3ffc30[_0xf222('0x42')]+_0xf222('0x43');}};}function isActive(_0x434e7b){return _0x434e7b;}function checkIsActive(_0x272e0c,_0x37b4f7){return function(){if(!isActive(_0x37b4f7)){_0x272e0c[_0xf222('0x41')]=_0xf222('0x44');throw _0x272e0c['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x439c2f){return function(){if(!isNotNull(_0x439c2f[_0xf222('0x45')])){_0x439c2f[_0xf222('0x41')]=_0xf222('0x46');throw _0x439c2f[_0xf222('0x42')]+_0xf222('0x47');}if(!isNotNull(_0x439c2f['Interval'][_0xf222('0x48')])){_0x439c2f[_0xf222('0x41')]=_0xf222('0x46');throw _0x439c2f['name']+_0xf222('0x47');}if(!isNotNull(_[_0xf222('0x49')](_0x439c2f[_0xf222('0x45')]['Intervals']))){_0x439c2f[_0xf222('0x41')]=_0xf222('0x46');throw _0x439c2f[_0xf222('0x42')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x3acea1,_0x23ed1d,_0x1345eb){return{'action':_0x3acea1,'response':_0x23ed1d,'message':_0x1345eb,'stack':_0x1345eb};}function myreject(_0x2b838c){return function(_0x2e9b27){return _0x2b838c(msgResponse('[ifTime][Action]',_0xf222('0x4a'),JSON['stringify'](_0x2e9b27)));};}function getSeconds(_0x220214,_0x38db1b){var _0x29d6ff=moment(_0x220214)['milliseconds'](0x0);var _0x39784b=moment(_0x38db1b)[_0xf222('0x4b')](0x0);return _0x29d6ff['diff'](_0x39784b,_0xf222('0x4c'));}function emit(_0x4b7b15,_0x3a766b,_0x1b2f78){io['to'](_0x4b7b15)[_0xf222('0x4d')](_0x3a766b,_0x1b2f78);}function emitVoiceQueueSummary(_0x5c8b04){if(_0x5c8b04[_0xf222('0x4e')]===_0xf222('0x4f')){var _0x2c1e49={'id':_0x5c8b04['id'],'name':_0x5c8b04[_0xf222('0x42')],'strategy':_0x5c8b04[_0xf222('0x50')],'answered':_0x5c8b04[_0xf222('0x51')],'available':_0x5c8b04['available'],'loggedIn':_0x5c8b04[_0xf222('0x52')],'pTalking':_0x5c8b04[_0xf222('0x53')],'sumBillable':_0x5c8b04['sumBillable'],'sumDuration':_0x5c8b04['sumDuration'],'sumHoldTime':_0x5c8b04[_0xf222('0x54')]||0x0,'talking':_0x5c8b04['talking'],'total':_0x5c8b04[_0xf222('0x55')],'type':_0x5c8b04[_0xf222('0x4e')],'unmanaged':_0x5c8b04[_0xf222('0x56')],'abandoned':_0x5c8b04[_0xf222('0x57')],'waiting':_0x5c8b04['waiting'],'loggedInDb':_0x5c8b04['loggedInDb'],'dialActive':_0x5c8b04[_0xf222('0x58')],'dialMethod':_0x5c8b04['dialMethod'],'dialOriginateCallerIdName':_0x5c8b04['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5c8b04[_0xf222('0x59')],'dialOriginateTimeout':_0x5c8b04[_0xf222('0x5a')],'dialPrefix':_0x5c8b04[_0xf222('0x5b')],'outboundAnswerAgiCallsDay':_0x5c8b04[_0xf222('0x5c')],'outboundAnswerCallsDay':_0x5c8b04[_0xf222('0x5d')],'outboundBlacklistCallsDay':_0x5c8b04[_0xf222('0x5e')],'outboundBusyCallsDay':_0x5c8b04['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5c8b04[_0xf222('0x5f')],'outboundDropCallsDayACS':_0x5c8b04[_0xf222('0x60')],'outboundDropCallsDayCallersExit':_0x5c8b04['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5c8b04[_0xf222('0x61')],'outboundNoAnswerCallsDay':_0x5c8b04[_0xf222('0x62')],'outboundNoSuchCallsDay':_0x5c8b04['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5c8b04[_0xf222('0x63')],'outboundReCallsDay':_0x5c8b04['outboundReCallsDay'],'outboundRejectCallsDay':_0x5c8b04[_0xf222('0x64')],'outboundUnknownCallsDay':_0x5c8b04[_0xf222('0x65')],'predictiveIntervalAnsweredCalls':_0x5c8b04[_0xf222('0x66')],'predictiveIntervalAvgHoldtime':_0x5c8b04[_0xf222('0x67')],'predictiveIntervalAvgTalktime':_0x5c8b04[_0xf222('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x5c8b04[_0xf222('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x5c8b04[_0xf222('0x6a')],'predictiveIntervalErlangCalls':_0x5c8b04[_0xf222('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x5c8b04[_0xf222('0x6c')],'predictiveIntervalHitRate':_0x5c8b04[_0xf222('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x5c8b04[_0xf222('0x6e')],'predictiveIntervalPauses':_0x5c8b04['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5c8b04['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5c8b04['predictiveIntervalTotalCalls'],'message':_0x5c8b04[_0xf222('0x41')],'originated':_0x5c8b04[_0xf222('0x6f')],'erlangCalls':_0x5c8b04[_0xf222('0x70')],'erlangCallToSecond':_0x5c8b04[_0xf222('0x71')],'erlangAbandonmentRate':_0x5c8b04['erlangAbandonmentRate'],'erlangBusyFactor':_0x5c8b04[_0xf222('0x72')],'startPredictive':_0x5c8b04[_0xf222('0x28')],'startProgressive':_0x5c8b04[_0xf222('0x29')]};if(_0x5c8b04[_0xf222('0x73')]){_0x2c1e49['Trunk']={'id':_0x5c8b04[_0xf222('0x73')]['id'],'name':_0x5c8b04[_0xf222('0x73')][_0xf222('0x42')],'active':_0x5c8b04[_0xf222('0x73')][_0xf222('0x74')],'callerid':_0x5c8b04[_0xf222('0x73')][_0xf222('0x75')]};}if(_0x5c8b04[_0xf222('0x45')]){_0x2c1e49[_0xf222('0x45')]={'id':_0x5c8b04[_0xf222('0x45')]['id'],'name':_0x5c8b04['Interval']['name']};}var _0x193762=md5(JSON['stringify'](_0x2c1e49));if(_0x5c8b04[_0xf222('0x76')]!==_0x193762){_0x5c8b04['md5']=_0x193762;emit(util[_0xf222('0x77')]('voice:queue:%s',_0x2c1e49[_0xf222('0x42')]),_0xf222('0x78'),_0x2c1e49);}}}function emitCampaignSummary(_0xbf30a0){if(_0xbf30a0[_0xf222('0x4e')]==='ivr'){emit(util[_0xf222('0x77')](_0xf222('0x79'),_0xbf30a0[_0xf222('0x42')]),_0xf222('0x7a'),_0xbf30a0);}}function checkGetDataPredictive(_0x14458b){if(isNotNull(_0x14458b)&&!_[_0xf222('0x49')](_0x14458b)){loggerPredictive[_0xf222('0x7b')](_0xf222('0x7c'));loggerPredictive[_0xf222('0x7b')](_0xf222('0x7d'),_0x14458b[_0xf222('0x7e')]);loggerPredictive[_0xf222('0x7b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14458b['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xf222('0x7b')](_0xf222('0x7f'),_0x14458b[_0xf222('0x6a')]);loggerPredictive[_0xf222('0x7b')](_0xf222('0x80'),_0x14458b[_0xf222('0x69')]);loggerPredictive[_0xf222('0x7b')](_0xf222('0x81'),_0x14458b[_0xf222('0x67')]);loggerPredictive[_0xf222('0x7b')](_0xf222('0x82'),_0x14458b['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xf222('0x83'));if(_0x14458b[_0xf222('0x7e')]>0x0){if(!_[_0xf222('0x40')](_0x14458b[_0xf222('0x68')])&&_0x14458b[_0xf222('0x68')]>0x0){return!![];}loggerPredictive[_0xf222('0x7b')](_0xf222('0x84'));if(!_[_0xf222('0x40')](_0x14458b[_0xf222('0x67')])&&_0x14458b[_0xf222('0x67')]>0x0){return!![];}loggerPredictive[_0xf222('0x7b')](_0xf222('0x85'));}else{loggerPredictive[_0xf222('0x7b')](_0xf222('0x86'));}}else{loggerPredictive['info'](_0xf222('0x87'));}return![];}function mergeDataErlangB(_0x5ee917){return function(_0x20fd3d){loggerPredictive[_0xf222('0x7b')](_0xf222('0x88'));loggerPredictive[_0xf222('0x7b')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20fd3d['erlangCalls']);loggerPredictive[_0xf222('0x7b')](_0xf222('0x89'),_0x20fd3d[_0xf222('0x71')]);loggerPredictive[_0xf222('0x7b')](_0xf222('0x8a'),_0x20fd3d['erlangAbandonmentRate']);loggerPredictive[_0xf222('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20fd3d[_0xf222('0x72')]);loggerPredictive[_0xf222('0x7b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20fd3d[_0xf222('0x8b')]);loggerPredictive['info'](_0xf222('0x83'));_[_0xf222('0x8c')](_0x5ee917,_0x20fd3d);};}function getDiff(_0x41469e){var _0x5c69be=moment()[_0xf222('0x4b')](0x0);var _0x15f5f5=moment(_0x41469e)[_0xf222('0x4b')](0x0);return _0x5c69be[_0xf222('0x8d')](_0x15f5f5,_0xf222('0x4c'));}function ifInterval(_0x28b64b,_0x262bf7){if(_['isUndefined'](_0x262bf7)){return![];}return getDiff(_0x262bf7)<_0x28b64b*0x3c;}function freeVariablesPredictive(_0x286355){if(isNotNull(_0x286355)){if(!_[_0xf222('0x40')](_0x286355['startProgressive'])){_0x286355['startProgressive']=undefined;loggerPredictive['info'](_0x286355[_0xf222('0x42')],_0xf222('0x8e'));}if(!_[_0xf222('0x40')](_0x286355[_0xf222('0x28')])){_0x286355['startPredictive']=undefined;loggerPredictive[_0xf222('0x7b')](_0x286355['name'],_0xf222('0x8f'));}if(!_[_0xf222('0x40')](_0x286355[_0xf222('0x90')])){clearInterval(_0x286355[_0xf222('0x90')]);_0x286355[_0xf222('0x90')]=undefined;loggerPredictive[_0xf222('0x7b')](_0x286355[_0xf222('0x42')],_0xf222('0x91'));}}}function erlangb(_0x3d45c0,_0x4e8209){if(_0x4e8209===0x0){return 0x0;}var _0x4e7d09=0x1;for(var _0x215896=0x1;_0x215896<=_0x4e8209;_0x215896+=0x1){_0x4e7d09=0x1+_0x4e7d09*_0x215896/_0x3d45c0;}return 0x1/_0x4e7d09;}function isVoiceQueueOutbound(_0x4905da){return _0x4905da===_0xf222('0x4f');}function isNotPreview(_0x3f9695){return _0x3f9695!==_0xf222('0x92');}function isCampaignIvr(_0x5e14f1){return _0x5e14f1===_0xf222('0x93');}function getCallerId(_0x54d24e,_0x3dbda2,_0x3acb8c){if(!_[_0xf222('0x40')](_0x3acb8c)&&typeof _0x3acb8c===_0xf222('0x94')&&!_['isEmpty'](_0x3acb8c)){if(!_[_0xf222('0x40')](_0x3dbda2)&&typeof _0x3dbda2===_0xf222('0x94')&&!_[_0xf222('0x49')](_0x3dbda2)){return util[_0xf222('0x77')](_0xf222('0x95'),_0x3dbda2,_0x3acb8c);}return util[_0xf222('0x77')](_0xf222('0x95'),_0x3acb8c,_0x3acb8c);}if(!_[_0xf222('0x40')](_0x54d24e)&&typeof _0x54d24e===_0xf222('0x94')&&!_[_0xf222('0x49')](_0x54d24e)){return _0x54d24e;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x756ca2,_0xafa840){return function(_0x11fb37){freeVariablesPredictive(_0xafa840);emitVoiceQueueSummary(_0xafa840);emitCampaignSummary(_0xafa840);loggerSyncQueueSummary[_0xf222('0x96')](_0x756ca2,util[_0xf222('0x97')](_0x11fb37,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x242317,_0x564fea){return function(_0x1ae19d){loggerPredictive['error'](_0x564fea[_0xf222('0x42')],_0x242317);loggerPredictive[_0xf222('0x96')](_0x1ae19d[_0xf222('0x98')]);freeVariablesPredictive(_0x564fea);};}function loggerCatch(_0x1a6fdc){return function(_0x3443d5){logger['error'](_0x1a6fdc,util[_0xf222('0x97')](_0x3443d5,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x194a4c){return _0x194a4c&&!_[_0xf222('0x40')](_0x194a4c)&&_0x194a4c[_0xf222('0x99')]>0x0;}function decremetOriginate(_0x43f5e3){if(!_[_0xf222('0x40')](_0x43f5e3)&&_0x43f5e3!==null){if(typeof _0x43f5e3[_0xf222('0x6f')]!=='undefined'){if(_0x43f5e3[_0xf222('0x6f')]>0x0){_0x43f5e3[_0xf222('0x6f')]-=0x1;}else{logger[_0xf222('0x96')](_0xf222('0x9a'));}}}else{logger[_0xf222('0x96')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x13178f,_0x1c627b,_0x5ed65f){if(_0x1c627b>_0x5ed65f){for(var _0x2ae29f=0x0;_0x2ae29f<_0x1c627b-_0x5ed65f;_0x2ae29f+=0x1){decremetOriginate(_0x13178f);}}}function loggerGetContactDialer(_0x25b6cf,_0x5b856a,_0x1c4e1a){return function(_0xb0a75e){checkContactLowerLimitOriginate(_0x5b856a,_0x1c4e1a,0x0);logger['error'](_0x25b6cf,util[_0xf222('0x97')](_0xb0a75e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5aca3e){return function(_0x3204dd){if(isNotNull(_0x3204dd)&&isNotNull(_0x3204dd[0x0])){if(_0x3204dd[0x0]['contactsRescheduled']>0x0){_0x5aca3e[_0xf222('0x41')]='RESCHEDULED_CONTACTS';logger['info'](_0xf222('0x9b')+_0x5aca3e[_0xf222('0x42')],_0x3204dd[0x0][_0xf222('0x9c')],_0xf222('0x9d'));}else{_0x5aca3e[_0xf222('0x41')]=_0xf222('0x9e');logger[_0xf222('0x7b')](_0xf222('0x9f')+_0x5aca3e[_0xf222('0x42')]);}}};}function notSendMessagesQueue(_0x3269b6){if(_0x3269b6[_0xf222('0xa0')]){freeVariablesPredictive(_0x3269b6);if(_0x3269b6[_0xf222('0x6f')]===0x0&&_0x3269b6[_0xf222('0xa1')]===0x0&&_0x3269b6['waiting']===0x0&&(_0x3269b6['pTalking']||0x0)===0x0){_0x3269b6['sendMessageOneNotActive']=![];_0x3269b6[_0xf222('0xa2')]=0x0;_0x3269b6[_0xf222('0x41')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf222('0x96')](_0xf222('0xa3'),_0x3269b6[_0xf222('0x42')],_0xf222('0xa4'));}else{_0x3269b6['message']=_0xf222('0xa5');loggerSyncQueueSummary[_0xf222('0x96')](_0xf222('0xa3'),_0x3269b6[_0xf222('0x42')],_0xf222('0xa6'));}emitVoiceQueueSummary(_0x3269b6);}}function notSendMessagesCampaign(_0x7a1d35){if(_0x7a1d35[_0xf222('0xa0')]){if(_0x7a1d35[_0xf222('0x6f')]===0x0){_0x7a1d35['sendMessageOneNotActive']=![];_0x7a1d35[_0xf222('0x41')]=_0xf222('0x44');loggerSyncQueueSummary[_0xf222('0x96')](_0xf222('0xa7'),_0x7a1d35[_0xf222('0x42')],_0xf222('0xa4'));}else{_0x7a1d35[_0xf222('0x41')]=_0xf222('0xa5');loggerSyncQueueSummary[_0xf222('0x96')](_0xf222('0xa7'),_0x7a1d35[_0xf222('0x42')],_0xf222('0xa6'));}emitCampaignSummary(_0x7a1d35);}}function createObjHistory(_0x4787b5,_0x234bcb,_0x30a155,_0x3cf9ea,_0x408bec){_0x4787b5[_0xf222('0x41')]=_0x30a155;var _0x1c71f3=new Action(_0x4787b5,_0x234bcb);var _0x83269e=new History(_0x1c71f3);_0x83269e[_0xf222('0xa8')]=_0x3cf9ea;_0x83269e['statedesc']=_0x408bec;_0x83269e[_0xf222('0xa9')]=_0x1c71f3['starttime'];return _0x83269e;}Dialer['prototype'][_0xf222('0xaa')]=function(){var _0x429de1=this;setInterval(function(){_0x429de1['clearZombieChannels'](_0x429de1[_0xf222('0xab')],'[uniqueid]');_0x429de1[_0xf222('0xac')](_0x429de1['actions'],_0xf222('0xad'));},0x32c8);};Dialer[_0xf222('0x1b')][_0xf222('0xac')]=function(_0x3e0f66,_0x158be7){var _0x1f792d=this;for(var _0x529a3e in _0x3e0f66){if(typeof _0x3e0f66[_0x529a3e]!==_0xf222('0xae')){this[_0xf222('0x1f')]['enqueue'](function(){if(!_[_0xf222('0xaf')](_0x3e0f66[_0x529a3e])){return ami[_0xf222('0xb0')]({'action':'status','channel':_0x3e0f66[_0x529a3e][_0xf222('0xb1')]})[_0xf222('0xb2')](function(_0x5f0565){if(_0x5f0565[_0xf222('0x41')]===_0xf222('0xb3')){setTimeout(function(){if(_0x3e0f66[_0x529a3e]&&_0x3e0f66[_0x529a3e][_0xf222('0x4e')]!==_0xf222('0x93')){_0x1f792d[_0xf222('0xb4')](_0x1f792d[_0xf222('0x20')][_0x3e0f66[_0x529a3e][_0xf222('0xb5')]]);logger['error'](_0xf222('0xb6'),_0x158be7,_0x529a3e,_0x3e0f66[_0x529a3e][_0xf222('0xb5')]);delete _0x3e0f66[_0x529a3e];}if(_0x3e0f66[_0x529a3e]&&_0x3e0f66[_0x529a3e]['type']===_0xf222('0x93')){_0x1f792d[_0xf222('0xb4')](_0x1f792d[_0xf222('0x21')][_0x3e0f66[_0x529a3e][_0xf222('0xb5')]]);logger[_0xf222('0x96')](_0xf222('0xb7'),_0x158be7,_0x529a3e,_0x3e0f66[_0x529a3e][_0xf222('0xb5')]);delete _0x3e0f66[_0x529a3e];}},0x2328);}});}});}}};Dialer[_0xf222('0x1b')]['countReScheduled']=function(_0x189b1a){return BPromise[_0xf222('0xb8')]()[_0xf222('0xb9')](cmHopper[_0xf222('0xba')](_0x189b1a))['catch'](loggerCatch(_0xf222('0xbb')));};Dialer[_0xf222('0x1b')][_0xf222('0xbc')]=function(_0x38c526){return BPromise[_0xf222('0xb8')]()['then'](cmHopperBlack[_0xf222('0xbc')](_0x38c526))[_0xf222('0xb2')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xf222('0x1b')][_0xf222('0xbd')]=function(_0x4704f3){return BPromise[_0xf222('0xb8')]()['then'](cmHopperBlack[_0xf222('0xbd')](_0x4704f3))[_0xf222('0xb2')](loggerCatch(_0xf222('0xbe')));};Dialer[_0xf222('0x1b')]['averageHandleTime']=function(_0x23a3da){return BPromise[_0xf222('0xb8')]()['then'](cmHopperHistory['avgHandleTime'](_0x23a3da))[_0xf222('0xb2')](loggerCatch(_0xf222('0xbf')));};Dialer[_0xf222('0x1b')][_0xf222('0xc0')]=function(_0xfd831c){return BPromise[_0xf222('0xb8')]()[_0xf222('0xb9')](cmHopper[_0xf222('0xc0')](_0xfd831c))[_0xf222('0xb2')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xf222('0x1b')][_0xf222('0xc1')]=function(_0x1530f6,_0x32697c,_0x8f0dfb){return BPromise['resolve']()[_0xf222('0xb9')](cmHopper[_0xf222('0xc1')](_0x1530f6,_0x32697c,_0x8f0dfb))[_0xf222('0xb2')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xf222('0x1b')][_0xf222('0xc2')]=function(_0x47d604,_0x5d8c0c,_0x2f5ff4,_0x4805bd,_0x41e8bd){return BPromise['resolve']()[_0xf222('0xb9')](cmHopper[_0xf222('0xc2')](_0x47d604,_0x5d8c0c,_0x2f5ff4,_0x4805bd))['catch'](function(_0x26285a){_0x41e8bd[_0xf222('0xc3')]-=_0x2f5ff4;_0x41e8bd[_0xf222('0xc3')]=_0x41e8bd[_0xf222('0xc3')]>0x0?_0x41e8bd[_0xf222('0xc3')]:0x0;loggerCatch(_0xf222('0xc4'))(_0x26285a);});};Dialer[_0xf222('0x1b')][_0xf222('0xc5')]=function(_0x26df5b,_0x4c89da,_0x280e5a,_0x103762){return BPromise[_0xf222('0xb8')]()[_0xf222('0xb9')](cmHopper['getContactDialerIvr'](_0x26df5b,_0x4c89da,_0x280e5a))[_0xf222('0xb2')](function(_0x39cef2){_0x103762['temp']-=_0x4c89da;_0x103762[_0xf222('0xc3')]=_0x103762[_0xf222('0xc3')]>0x0?_0x103762[_0xf222('0xc3')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x39cef2);});};Dialer['prototype'][_0xf222('0xc6')]=function(_0x5aa7de){return BPromise['resolve']()[_0xf222('0xb9')](voiceQueueRt[_0xf222('0xc6')](_0x5aa7de))[_0xf222('0xb2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xf222('0x1b')]['moveContactManagedDialer']=function(_0x6af8dc){return BPromise[_0xf222('0xb8')]()[_0xf222('0xb9')](cmHopper[_0xf222('0xc7')](_0x6af8dc))[_0xf222('0xb2')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xf222('0x1b')][_0xf222('0xc8')]=function(_0x5443b1){return BPromise[_0xf222('0xb8')]()[_0xf222('0xb9')](cmHopperHistory[_0xf222('0xc8')](_0x5443b1))[_0xf222('0xb2')](loggerCatch('[createHistory]\x20'));};Dialer['prototype']['updateOriginated']=function(_0x477a01){if(!_[_0xf222('0x40')](_0x477a01)&&_0x477a01!==null){if(typeof _0x477a01['originated']!=='undefined'){if(_0x477a01[_0xf222('0x6f')]>0x0){_0x477a01['originated']-=0x1;}else{logger[_0xf222('0x96')](_0xf222('0xc9'));}}}else{logger[_0xf222('0x96')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xf222('0x1b')]['loggerHandler']=function(_0x122e4,_0x3649a7){var _0x3c17f8=this;return function(_0x97fd65){_0x3c17f8[_0xf222('0xb4')](_0x3649a7);logger[_0xf222('0x96')](_0x122e4,util['inspect'](_0x97fd65,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xf222('0xca')]=function(_0x38c2ff,_0x54da23,_0x1e26ed){var _0x270b8d={'state':0x19,'statedesc':_0xf222('0xcb')};this[_0xf222('0xb4')](_0x54da23);this[_0xf222('0xcc')](_['merge'](_0x270b8d,_[_0xf222('0xcd')](_0x1e26ed,[_0xf222('0xce'),_0xf222('0xcf'),_0xf222('0xd0'),'VoiceQueueId',_0xf222('0xd1')])),_0xf222('0xd2'),_0xf222('0xd3'));logger[_0xf222('0x96')](_0x38c2ff);};Dialer[_0xf222('0x1b')]['isSuccess']=function(_0x35347e){return _0x35347e===_0xf222('0xd4');};Dialer['prototype'][_0xf222('0xd5')]=function(_0x224440){return!_['isUndefined'](_0x224440)&&_0x224440&&!_[_0xf222('0x40')](_0x224440[_0xf222('0x42')])&&!_['isUndefined'](_0x224440[_0xf222('0x74')])&&_0x224440['active']&&(this[_0xf222('0x23')][util['format'](_0xf222('0xd6'),_0x224440[_0xf222('0x42')])][_0xf222('0xd7')]===_0xf222('0xd8')||this[_0xf222('0x23')][util['format']('SIP/%s',_0x224440[_0xf222('0x42')])][_0xf222('0xd7')]==='unmonitored');};Dialer[_0xf222('0x1b')][_0xf222('0xcc')]=function(_0x4ed910,_0x1834ce,_0x2d5af0){this[_0xf222('0xc8')](_0x4ed910)[_0xf222('0xb2')](loggerCatch(_0x1834ce));this[_0xf222('0xc7')](_0x4ed910)[_0xf222('0xb2')](loggerCatch(_0x2d5af0));};Dialer['prototype'][_0xf222('0x3a')]=function(_0x39e6fe){var _0x245813=this['uniqueId'][_0x39e6fe[_0xf222('0xd9')]];var _0x1a8202;if(!_[_0xf222('0xaf')](_0x39e6fe)&&!_['isNil'](_0x39e6fe[_0xf222('0xda')])&&!_[_0xf222('0xaf')](_0x39e6fe['variable']['amdstatus'])&&_0x39e6fe[_0xf222('0xdb')]===_0xf222('0xdc')&&_0x245813){if(_0x245813[_0xf222('0x4e')]!=='ivr'&&this[_0xf222('0x20')][_0x245813[_0xf222('0xb5')]]['dialAMDActive']&&_0x39e6fe[_0xf222('0xdd')]===_0xf222('0xde')){delete this[_0xf222('0xab')][_0x39e6fe[_0xf222('0xd9')]];this[_0xf222('0xb4')](this[_0xf222('0x20')][_0x245813['queue']]);this[_0xf222('0x20')][_0x245813[_0xf222('0xb5')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x245813[_0xf222('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;_0x1a8202=new Hangup(_0x245813,_0x39e6fe);_0x1a8202[_0xf222('0xa8')]=0x12;_0x1a8202[_0xf222('0xdf')]=_0xf222('0xe0');_0x1a8202[_0xf222('0xe1')]=_0xf222('0xe2');ami[_0xf222('0x4d')]('custom:amd',ut['buildObj'](_0x1a8202,_0xf222('0xe3')));this[_0xf222('0xcc')](_0x1a8202,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x245813[_0xf222('0x4e')]!==_0xf222('0x93')&&this[_0xf222('0x20')][_0x245813[_0xf222('0xb5')]]['dialAMDActive']&&_0x39e6fe[_0xf222('0xdd')]===_0xf222('0xe4')){var _0x394bc7=this;return new BPromise(function(_0x483034,_0x50781c){delete _0x394bc7['uniqueId'][_0x39e6fe['uniqueid']];_0x394bc7[_0xf222('0xb4')](_0x394bc7[_0xf222('0x20')][_0x245813[_0xf222('0xb5')]]);_0x394bc7[_0xf222('0x20')][_0x245813['queue']][_0xf222('0x5d')]+=0x1;_0x394bc7[_0xf222('0x20')][_0x245813[_0xf222('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4fd243=_0x394bc7[_0xf222('0x20')][_0x245813[_0xf222('0xb5')]];var _0xa67116=new Hangup(_0x245813,_0x39e6fe);_0xa67116[_0xf222('0xa8')]=0x13;_0xa67116[_0xf222('0xdf')]=_0xf222('0xe5');_0xa67116[_0xf222('0xe1')]=_0xf222('0xe2');_0xa67116[_0xf222('0xe6')]+=0x1;_0xa67116[_0xf222('0xe7')]+=0x1;_0xa67116['amd']=!![];ami[_0xf222('0x4d')](_0xf222('0xe8'),ut[_0xf222('0xe9')](_0xa67116,_0xf222('0xe3')));_0x394bc7['createHistory'](_0xa67116)['catch'](loggerCatch(_0xf222('0xea')));if(_0xa67116[_0xf222('0xeb')]+_0xa67116['countcongestionretry']+_0xa67116[_0xf222('0xec')]+_0xa67116[_0xf222('0xed')]+_0xa67116[_0xf222('0xee')]+_0xa67116[_0xf222('0xef')]+_0xa67116[_0xf222('0xe6')]+_0xa67116[_0xf222('0xf0')]>=_0x4fd243[_0xf222('0xf1')]){_0x394bc7[_0xf222('0xf2')](_0xa67116,_0x483034,_0x50781c,_0xf222('0xf3'));}else{if(_0xa67116[_0xf222('0xe6')]>=_0x4fd243[_0xf222('0xf4')]){_0x394bc7[_0xf222('0xf5')](_0xa67116,_0x483034,_0x50781c,_0xf222('0xf6'));}else{_0x394bc7[_0xf222('0xc0')]({'active':![],'countmachineretry':_0xa67116['countmachineretry'],'scheduledat':moment()['add'](_0x4fd243[_0xf222('0xf7')],_0xf222('0xf8'))[_0xf222('0x77')](_0xf222('0xf9')),'ContactId':_0xa67116[_0xf222('0xce')],'ListId':_0xa67116[_0xf222('0xcf')],'VoiceQueueId':_0xa67116[_0xf222('0xfa')]||undefined,'CampaignId':_0xa67116['CampaignId']||undefined})['catch'](loggerCatch(_0xf222('0xfb')));_0x483034({'reschedule':0x1});}}});}if(_0x245813['type']===_0xf222('0x93')&&this['campaigns'][_0x245813[_0xf222('0xb5')]][_0xf222('0xfc')]&&_0x39e6fe[_0xf222('0xdd')]===_0xf222('0xde')){delete this[_0xf222('0xab')][_0x39e6fe[_0xf222('0xd9')]];this[_0xf222('0xb4')](this[_0xf222('0x21')][_0x245813['queue']]);_0x1a8202=new Hangup(_0x245813,_0x39e6fe);_0x1a8202['state']=0x12;_0x1a8202['statedesc']='HangupInAMD';_0x1a8202['membername']='AMD';ami[_0xf222('0x4d')](_0xf222('0xe8'),ut[_0xf222('0xe9')](_0x1a8202,_0xf222('0xe3')));this['saveInDb'](_0x1a8202,'[syncHangupInAMDIvr][createHistory]',_0xf222('0xfd'));}if(_0x245813['type']===_0xf222('0x93')&&this['campaigns'][_0x245813[_0xf222('0xb5')]][_0xf222('0xfc')]&&_0x39e6fe[_0xf222('0xdd')]===_0xf222('0xe4')){var _0x394bc7=this;return new BPromise(function(_0x373380,_0x5482b6){delete _0x394bc7[_0xf222('0xab')][_0x39e6fe[_0xf222('0xd9')]];_0x394bc7[_0xf222('0xb4')](_0x394bc7[_0xf222('0x21')][_0x245813[_0xf222('0xb5')]]);_0x394bc7[_0xf222('0x21')][_0x245813[_0xf222('0xb5')]][_0xf222('0x5d')]+=0x1;_0x394bc7[_0xf222('0x21')][_0x245813[_0xf222('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5d6bd3=_0x394bc7['campaigns'][_0x245813['queue']];var _0x4ad4dd=new Hangup(_0x245813,_0x39e6fe);_0x4ad4dd[_0xf222('0xa8')]=0x13;_0x4ad4dd[_0xf222('0xdf')]=_0xf222('0xe5');_0x4ad4dd[_0xf222('0xe1')]='AMD';_0x4ad4dd[_0xf222('0xe6')]+=0x1;_0x4ad4dd[_0xf222('0xe7')]+=0x1;_0x4ad4dd[_0xf222('0xe3')]=!![];ami['emit']('custom:amd',ut[_0xf222('0xe9')](_0x4ad4dd,'amd'));_0x394bc7[_0xf222('0xc8')](_0x4ad4dd)[_0xf222('0xb2')](loggerCatch(_0xf222('0xea')));if(_0x4ad4dd[_0xf222('0xeb')]+_0x4ad4dd[_0xf222('0xfe')]+_0x4ad4dd[_0xf222('0xec')]+_0x4ad4dd['countnosuchnumberretry']+_0x4ad4dd['countdropretry']+_0x4ad4dd[_0xf222('0xef')]+_0x4ad4dd[_0xf222('0xe6')]+_0x4ad4dd['countagentrejectretry']>=_0x5d6bd3[_0xf222('0xf1')]){_0x394bc7[_0xf222('0xf2')](_0x4ad4dd,_0x373380,_0x5482b6,'reason19\x20machine....');}else{if(_0x4ad4dd[_0xf222('0xe6')]>=_0x5d6bd3[_0xf222('0xf4')]){_0x394bc7[_0xf222('0xf5')](_0x4ad4dd,_0x373380,_0x5482b6,_0xf222('0xf6'));}else{_0x394bc7[_0xf222('0xc0')]({'active':![],'countmachineretry':_0x4ad4dd[_0xf222('0xe6')],'scheduledat':moment()['add'](_0x5d6bd3['dialMachineRetryFrequency'],_0xf222('0xf8'))['format'](_0xf222('0xf9')),'ContactId':_0x4ad4dd[_0xf222('0xce')],'ListId':_0x4ad4dd[_0xf222('0xcf')],'VoiceQueueId':_0x4ad4dd[_0xf222('0xfa')]||undefined,'CampaignId':_0x4ad4dd[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0xfb')));_0x373380({'reschedule':0x1});}}});}}};Dialer[_0xf222('0x1b')][_0xf222('0x37')]=function(_0x216559){var _0x231110=this[_0xf222('0xab')][_0x216559[_0xf222('0xd9')]];var _0x3da26f=this;var _0x34c058;if(_0x231110&&_0x231110['type']===_0xf222('0x93')){delete this[_0xf222('0xab')][_0x216559[_0xf222('0xd9')]];this['updateOriginated'](this[_0xf222('0x21')][_0x231110[_0xf222('0xb5')]]);this[_0xf222('0x21')][_0x231110[_0xf222('0xb5')]]['ivrAnswerCallsDay']+=0x1;_0x34c058=new Hangup(_0x231110,_0x216559);this[_0xf222('0xc8')](_0x34c058)['catch'](loggerCatch(_0xf222('0xff')));this[_0xf222('0xc7')](_0x34c058)[_0xf222('0xb2')](loggerCatch(_0xf222('0x100')));}if(_0x231110&&_0x231110[_0xf222('0x4e')]!==_0xf222('0x93')&&isNotNull(this['voiceQueues'][_0x231110[_0xf222('0xb5')]][_0xf222('0x101')])){delete this['uniqueId'][_0x216559['uniqueid']];this[_0xf222('0xb4')](this[_0xf222('0x20')][_0x231110[_0xf222('0xb5')]]);this[_0xf222('0x20')][_0x231110['queue']][_0xf222('0x5d')]+=0x1;this['voiceQueues'][_0x231110[_0xf222('0xb5')]][_0xf222('0x5c')]+=0x1;_0x34c058=new Hangup(_0x231110,_0x216559);_0x34c058[_0xf222('0xa8')]=0x10;_0x34c058[_0xf222('0xdf')]='AnswerAGI';_0x34c058[_0xf222('0xe1')]=_0xf222('0x102');this['createHistory'](_0x34c058)['catch'](loggerCatch(_0xf222('0xff')));this[_0xf222('0xc7')](_0x34c058)[_0xf222('0xb2')](loggerCatch('[syncHangupIvr]'));}if(_0x231110&&_0x231110[_0xf222('0x4e')]!==_0xf222('0x93')&&!isNotNull(this['voiceQueues'][_0x231110[_0xf222('0xb5')]][_0xf222('0x101')])){delete this[_0xf222('0xab')][_0x216559[_0xf222('0xd9')]];this[_0xf222('0xb4')](this[_0xf222('0x20')][_0x231110[_0xf222('0xb5')]]);this['voiceQueues'][_0x231110[_0xf222('0xb5')]]['outboundUnknownCallsDay']+=0x1;_0x34c058=new Hangup(_0x231110,_0x216559);_0x34c058['state']=0xc;_0x34c058[_0xf222('0xdf')]=_0x216559[_0xf222('0x103')];_0x34c058[_0xf222('0xe1')]=_0xf222('0x104');this[_0xf222('0xc8')](_0x34c058)[_0xf222('0xb2')](loggerCatch(_0xf222('0xff')));this['moveContactManagedDialer'](_0x34c058)[_0xf222('0xb2')](loggerCatch(_0xf222('0x100')));}};Dialer[_0xf222('0x1b')][_0xf222('0x33')]=function(_0x12837b){var _0x442599=this[_0xf222('0xab')][_0x12837b[_0xf222('0xd9')]];var _0x12dd4f=this;if(this[_0xf222('0x20')][_0x12837b[_0xf222('0xb5')]]){if(_0x442599&&_0x442599[_0xf222('0x4e')]!==_0xf222('0x93')){delete this[_0xf222('0xab')][_0x12837b[_0xf222('0xd9')]];this['voiceQueues'][_0x12837b[_0xf222('0xb5')]][_0xf222('0x5d')]+=0x1;var _0x449a97=new AgentComplete(_0x442599,_0x12837b);if(_0x12837b[_0xf222('0x105')]===_0xf222('0x106')){_0x449a97[_0xf222('0x107')]=this['voiceQueues'][_0x12837b[_0xf222('0xb5')]][_0xf222('0x108')]&&this[_0xf222('0x20')][_0x12837b[_0xf222('0xb5')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xf222('0xf9')):undefined;}this['createHistory'](_0x449a97)['catch'](loggerCatch(_0xf222('0x109')));this['moveContactManagedDialer'](_0x449a97)[_0xf222('0xb2')](loggerCatch(_0xf222('0x10a')));}}};Dialer['prototype'][_0xf222('0x2d')]=function(_0xe61fe){if(this[_0xf222('0x20')][_0xe61fe[_0xf222('0xb5')]]){if(this[_0xf222('0xab')][_0xe61fe[_0xf222('0xd9')]]&&this[_0xf222('0xab')][_0xe61fe[_0xf222('0xd9')]][_0xf222('0x4e')]!==_0xf222('0x93')){this[_0xf222('0xb4')](this['voiceQueues'][_0xe61fe[_0xf222('0xb5')]]);this['uniqueId'][_0xe61fe[_0xf222('0xd9')]][_0xf222('0x10b')]=moment()[_0xf222('0x77')](_0xf222('0xf9'));}}};Dialer[_0xf222('0x1b')]['queueCallerAbandonCreateState']=function(_0x494275){this[_0xf222('0xc8')](_0x494275)[_0xf222('0xb2')](loggerCatch(_0xf222('0x109')));this[_0xf222('0xc7')](_0x494275)['catch'](loggerCatch(_0xf222('0x10c')));};Dialer['prototype'][_0xf222('0x30')]=function(_0x103c4c){var _0x2ef34b=this[_0xf222('0xab')][_0x103c4c['uniqueid']];var _0x20d032=this;if(this[_0xf222('0x20')][_0x103c4c[_0xf222('0xb5')]]){if(_0x2ef34b&&_0x2ef34b[_0xf222('0x4e')]!=='ivr'){delete this['uniqueId'][_0x103c4c[_0xf222('0xd9')]];this[_0xf222('0xb4')](this['voiceQueues'][_0x103c4c[_0xf222('0xb5')]]);_0x2ef34b['droptime']=moment()[_0xf222('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x15a008=new QueueCallerAbandon(_0x2ef34b,_0x103c4c);if(getSeconds(_0x2ef34b[_0xf222('0x10d')],_0x2ef34b[_0xf222('0x10e')])>=_0x2ef34b['dialQueueTimeout']){this['voiceQueues'][_0x103c4c[_0xf222('0xb5')]][_0xf222('0x6a')]+=0x1;this[_0xf222('0x20')][_0x103c4c[_0xf222('0xb5')]][_0xf222('0x61')]+=0x1;this[_0xf222('0x20')][_0x103c4c['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x15a008[_0xf222('0xa8')]=0xa;_0x15a008[_0xf222('0xdf')]=_0xf222('0x10f');_0x15a008['dropreason']=_0xf222('0x110');_0x15a008['agiafterat']=this[_0xf222('0x20')][_0x103c4c['queue']]['dialQueueProject2']?moment()[_0xf222('0x77')](_0xf222('0xf9')):undefined;_0x15a008[_0xf222('0xee')]+=0x1;_0x15a008['countglobal']+=0x1;if(_0x15a008[_0xf222('0xee')]>=this['voiceQueues'][_0x103c4c['queue']][_0xf222('0x111')]){this['queueCallerAbandonCreateState'](_0x15a008);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x15a008[_0xf222('0xee')],'scheduledat':moment()[_0xf222('0x112')](this[_0xf222('0x20')][_0x103c4c[_0xf222('0xb5')]]['dialDropRetryFrequency'],_0xf222('0xf8'))['format'](_0xf222('0xf9')),'ContactId':_0x2ef34b['ContactId'],'ListId':_0x2ef34b[_0xf222('0xcf')],'VoiceQueueId':_0x2ef34b['VoiceQueueId']||undefined,'CampaignId':_0x2ef34b[_0xf222('0xd1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3bc98a=new History(_0x15a008);_0x3bc98a[_0xf222('0xa8')]=0xa;_0x3bc98a['statedesc']=_0xf222('0x10f');_0x3bc98a[_0xf222('0x113')]=moment()[_0xf222('0x77')](_0xf222('0xf9'));_0x3bc98a[_0xf222('0xa9')]=_0x3bc98a[_0xf222('0x113')];_0x3bc98a[_0xf222('0x114')]=_0x15a008[_0xf222('0x114')];_0x3bc98a[_0xf222('0x115')]=_0x15a008[_0xf222('0x115')];this[_0xf222('0xc8')](_0x3bc98a)[_0xf222('0xb2')](loggerCatch(_0xf222('0x116')));}}else{this[_0xf222('0x20')][_0x103c4c[_0xf222('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf222('0x20')][_0x103c4c[_0xf222('0xb5')]][_0xf222('0x117')]+=0x1;_0x15a008[_0xf222('0xa8')]=0xb;_0x15a008[_0xf222('0xdf')]=_0xf222('0x118');_0x15a008['dropreason']=_0xf222('0x119');_0x15a008[_0xf222('0xef')]+=0x1;_0x15a008[_0xf222('0xe7')]+=0x1;if(_0x15a008[_0xf222('0xef')]>=this[_0xf222('0x20')][_0x103c4c[_0xf222('0xb5')]]['dialAbandonedMaxRetry']){this[_0xf222('0x11a')](_0x15a008);}else{this[_0xf222('0xc0')]({'active':![],'countabandonedretry':_0x15a008[_0xf222('0xef')],'scheduledat':moment()[_0xf222('0x112')](this[_0xf222('0x20')][_0x103c4c[_0xf222('0xb5')]][_0xf222('0x11b')],'minutes')[_0xf222('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2ef34b['ContactId'],'ListId':_0x2ef34b[_0xf222('0xcf')],'VoiceQueueId':_0x2ef34b['VoiceQueueId']||undefined,'CampaignId':_0x2ef34b[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3bc98a=new History(_0x15a008);_0x3bc98a[_0xf222('0xa8')]=0xb;_0x3bc98a[_0xf222('0xdf')]=_0xf222('0x118');_0x3bc98a[_0xf222('0x113')]=moment()[_0xf222('0x77')](_0xf222('0xf9'));_0x3bc98a[_0xf222('0xa9')]=_0x3bc98a[_0xf222('0x113')];_0x3bc98a[_0xf222('0x114')]=_0x15a008['calleridname'];_0x3bc98a[_0xf222('0x115')]=_0x15a008[_0xf222('0x115')];this[_0xf222('0xc8')](_0x3bc98a)[_0xf222('0xb2')](loggerCatch(_0xf222('0x11c')));}}}}};Dialer[_0xf222('0x1b')][_0xf222('0x39')]=function(_0x31ef64){if(this['actions'][_0x31ef64[_0xf222('0xd9')]]){this['actions'][_0x31ef64['uniqueid']][_0xf222('0xb1')]=_0x31ef64[_0xf222('0xb1')];}if(this[_0xf222('0xab')][_0x31ef64['uniqueid']]){this[_0xf222('0xab')][_0x31ef64[_0xf222('0xd9')]][_0xf222('0xb1')]=_0x31ef64['channel'];}};Dialer[_0xf222('0x1b')][_0xf222('0x3c')]=function(_0x509419){if(strategy[this[_0xf222('0x20')][this[_0xf222('0x26')][_0x509419['actionid']][_0xf222('0xb5')]][_0xf222('0x50')]]===_0xf222('0x11d')){if(this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]]&&_[_0xf222('0xaf')](this[_0xf222('0x26')][_0x509419['actionid']][_0xf222('0x11f')])&&_0x509419[_0xf222('0xd7')]==='1'&&_0x509419[_0xf222('0x120')]==='0'){if(this[_0xf222('0x22')][_0x509419['stateinterface']]){if(!this[_0xf222('0x22')][_0x509419[_0xf222('0x121')]][_0xf222('0x11f')]){this[_0xf222('0x22')][_0x509419[_0xf222('0x121')]]['locked']=!![];this[_0xf222('0x26')][_0x509419['actionid']]['locked']=!![];this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]][_0xf222('0x121')]=_0x509419['stateinterface'];}}}}else if((strategy[this[_0xf222('0x20')][this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]][_0xf222('0xb5')]]['strategy']]||'rrmemory')===_0xf222('0x122')){if(this['actions'][_0x509419[_0xf222('0x11e')]]){if(this['agents'][_0x509419[_0xf222('0x121')]]){this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]][_0xf222('0x121')]=_0x509419[_0xf222('0x121')];if(_[_0xf222('0xaf')](this[_0xf222('0x2b')][this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]][_0xf222('0xb5')]])){this[_0xf222('0x2b')][this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]][_0xf222('0xb5')]]=[];}this[_0xf222('0x2b')][this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]]['queue']][_0xf222('0x123')](_['merge'](_[_0xf222('0xcd')](this[_0xf222('0x26')][_0x509419[_0xf222('0x11e')]],[_0xf222('0x124'),'stateinterface']),{'status':_0x509419[_0xf222('0xd7')],'paused':_0x509419[_0xf222('0x120')]}));}}}};function unlockQueueStatus(_0x2ae79b,_0x5e8568){setTimeout(function(){if(_[_0xf222('0x40')](_0x2ae79b[_0xf222('0x125')])){loggerBooked[_0xf222('0x96')](_0xf222('0x126'),_0x5e8568);}_0x2ae79b['queueStatusComplete']=!![];loggerBooked[_0xf222('0x7b')](_0xf222('0x127'),_0x5e8568,JSON[_0xf222('0x128')](_[_0xf222('0xcd')](_0x2ae79b,[_0xf222('0x42'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xf222('0x1b')][_0xf222('0x3e')]=function(_0x500528){var _0x5192e4=this;var _0x1962f4=_0x5192e4[_0xf222('0x20')][_0x5192e4[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]];if(strategy[this[_0xf222('0x20')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]]['queue']][_0xf222('0x50')]]===_0xf222('0x11d')){if(this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]]&&this['actions'][_0x500528['actionid']][_0xf222('0x121')]){this[_0xf222('0x92')][_0xf222('0x129')](this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0x124')],this['actions'][_0x500528[_0xf222('0x11e')]]['stateinterface'])[_0xf222('0xb2')](function(_0x20288b){logger[_0xf222('0x96')](_0xf222('0x12a'),util['inspect'](_0x20288b,{'showHidden':![],'depth':null}));})[_0xf222('0x1e')](function(){_0x5192e4['updateOriginated'](_0x5192e4['voiceQueues'][_0x5192e4[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]]['queue']]);_0x5192e4['agents'][_0x5192e4[_0xf222('0x26')][_0x500528['actionid']][_0xf222('0x121')]][_0xf222('0x11f')]=![];delete _0x5192e4[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]];unlockQueueStatus(_0x1962f4);});}else{this[_0xf222('0xb4')](this[_0xf222('0x20')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x500528[_0xf222('0x11e')]][_0xf222('0xce')],'ListId':this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]]['ListId'],'VoiceQueueId':this['actions'][_0x500528[_0xf222('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xf222('0x26')][_0x500528['actionid']]['CampaignId']||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x12b')));delete this['actions'][_0x500528[_0xf222('0x11e')]];unlockQueueStatus(_0x1962f4);}}else if((strategy[this['voiceQueues'][this[_0xf222('0x26')][_0x500528['actionid']][_0xf222('0xb5')]][_0xf222('0x50')]]||_0xf222('0x122'))==='rrmemory'){var _0xa0971b;if(this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]]&&!_[_0xf222('0x49')](this[_0xf222('0x2b')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]]['queue']])){if(this['queueBookedRR'][_0x5192e4[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]]){this[_0xf222('0x2c')][_0x5192e4['actions'][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]]=this[_0xf222('0x2c')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]]['queue']]?this[_0xf222('0x2c')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]]:this[_0xf222('0x2b')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]]?this[_0xf222('0x2b')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]][_0xf222('0x12c')]||0x0:0x0;}this[_0xf222('0x2b')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]][_0xf222('0x12c')]=this[_0xf222('0x2c')][this[_0xf222('0x26')][_0x500528[_0xf222('0x11e')]][_0xf222('0xb5')]];for(var _0x3dcd8b=0x0;_0x3dcd8b=0x0;})['catch'](myreject(_0x125ec2)));}}else{_0x51cdd0[_0xf222('0x123')](ami[_0xf222('0xb0')]({'action':_0xf222('0x13f'),'command':util[_0xf222('0x77')](_0xf222('0x140'),_0x55d9e5,!_['isUndefined'](config[_0xf222('0x145')][_0x605e0f])?_0x605e0f:'')})[_0xf222('0xb9')](function(_0x513fa7){return _0x513fa7[_0xf222('0x142')][_0xf222('0x143')](_0xf222('0x144'))>=0x0;})[_0xf222('0xb2')](myreject(_0x125ec2)));}BPromise[_0xf222('0x146')](_0x51cdd0)[_0xf222('0xb9')](function(_0x56b874){var _0x13d5e5=_[_0xf222('0x147')](_0x56b874);if(_0x13d5e5){return _0x5198ed(_0x13d5e5);}else{_0x56715b[_0xf222('0x41')]=_0x235258?_0xf222('0x148'):_0xf222('0x149');return _0x125ec2(msgResponse('[ifTime][promiseAll]','Failure',_0xf222('0x14a')+_0x235258+'\x20'+_0x5c7404+_0xf222('0x14b')+util[_0xf222('0x97')](_0x55d9e5,{'showHidden':![],'depth':null})+_0xf222('0x14c')+_0x605e0f));}})[_0xf222('0xb2')](function(_0x393cd0){return _0x125ec2(msgResponse(_0xf222('0x138'),'Failure',JSON[_0xf222('0x128')](_0x393cd0)));});});};Dialer[_0xf222('0x1b')][_0xf222('0x14d')]=function(_0x5d9983){var _0x147ede=this;return function(){switch(_0x5d9983[_0xf222('0x14e')]){case _0xf222('0x14f'):freeVariablesPredictive(_0x5d9983);_0x147ede[_0xf222('0x150')](_0x5d9983,0x1);break;case'power':freeVariablesPredictive(_0x5d9983);_0x147ede['handlePower'](_0x5d9983,_0x5d9983['dialPowerLevel']);break;case _0xf222('0x8'):_0x147ede[_0xf222('0x8')](_0x5d9983);break;case'booked':freeVariablesPredictive(_0x5d9983);_0x147ede[_0xf222('0x150')](_0x5d9983,0x1);break;default:freeVariablesPredictive(_0x5d9983);logger[_0xf222('0x96')](_0xf222('0x151'),_0x5d9983[_0xf222('0x42')],_0xf222('0x152'));}};};Dialer[_0xf222('0x1b')]['launchHandleIvr']=function(_0x473a4d){var _0x3abc92=this;return function(){_0x3abc92[_0xf222('0x153')](_0x473a4d);};};Dialer['prototype'][_0xf222('0x35')]=function(_0x358a04){var _0x22adbc=this;if(isNotPreview(_0x358a04[_0xf222('0x14e')])){if(isVoiceQueueOutbound(_0x358a04['type'])&&isActive(_0x358a04[_0xf222('0x58')])){_0x358a04[_0xf222('0xa0')]=!![];BPromise[_0xf222('0xb8')]()[_0xf222('0xb9')](checkIsLoggedIn(_0x358a04,_0x358a04['loggedIn']))[_0xf222('0xb9')](checkIsActive(_0x358a04,_0x358a04[_0xf222('0x58')]))[_0xf222('0xb9')](checkInterval(_0x358a04))[_0xf222('0xb9')](_0x22adbc[_0xf222('0x136')](_0x358a04))[_0xf222('0xb9')](_0x22adbc[_0xf222('0x154')](_0x358a04['dialGlobalInterval'],_0x358a04[_0xf222('0x155')],_0x358a04[_0xf222('0x42')],_0x358a04))[_0xf222('0xb9')](_0x22adbc[_0xf222('0x139')](_0x358a04['Interval'],_0x358a04[_0xf222('0x155')],_0x358a04[_0xf222('0x42')],_0x358a04))[_0xf222('0xb9')](_0x22adbc['checkDialMethod'](_0x358a04))[_0xf222('0xb2')](loggerCatchQueueSummary(_0xf222('0x156'),_0x358a04));}else{notSendMessagesQueue(_0x358a04);}}else{freeVariablesPredictive(_0x358a04);}};Dialer[_0xf222('0x1b')]['syncCampaigns']=function(){var _0x406582=this;var _0x513c19;for(var _0xd5a8ad in this[_0xf222('0x21')]){if(typeof this[_0xf222('0x21')][_0xd5a8ad]!==_0xf222('0xae')){_0x513c19=this[_0xf222('0x21')][_0xd5a8ad];if(isCampaignIvr(_0x513c19[_0xf222('0x4e')])&&isActive(_0x513c19['active'])){_0x513c19['sendMessageOneNotActive']=!![];BPromise[_0xf222('0xb8')]()[_0xf222('0xb9')](checkIsActive(_0x513c19,_0x513c19['active']))[_0xf222('0xb9')](checkInterval(_0x513c19))['then'](_0x406582[_0xf222('0x136')](_0x513c19))[_0xf222('0xb9')](_0x406582['checkIfTime'](_0x513c19[_0xf222('0x157')],_0x513c19[_0xf222('0x155')],_0x513c19[_0xf222('0x42')],_0x513c19))[_0xf222('0xb9')](_0x406582[_0xf222('0x139')](_0x513c19['Interval'],_0x513c19[_0xf222('0x155')],_0x513c19[_0xf222('0x42')],_0x513c19))[_0xf222('0xb9')](_0x406582[_0xf222('0x158')](_0x513c19))[_0xf222('0xb2')](loggerCatchQueueSummary('[syncCampaigns]',_0x513c19));}else{notSendMessagesCampaign(_0x513c19);}}}};function getCallerIdRandom(_0x2833c6,_0x10e169){var _0x5464e5;var _0x1e0df1;var _0x301ab0;if(_0x10e169<=0x0){_0x10e169=0x1;}_0x5464e5=new RegExp(_0xf222('0x159')+_0x10e169+'}$');_0x1e0df1=Math['pow'](0xa,_0x10e169-0x1);_0x301ab0=Math['pow'](0xa,_0x10e169)-0x1;return util[_0xf222('0x77')]('%s',_[_0xf222('0x15a')](_0x2833c6,_0x5464e5,_[_0xf222('0x15b')](_0x1e0df1,_0x301ab0)));}function extractCalleridName(_0x1f8a91){var _0x5c8796=_0x1f8a91[_0xf222('0x15c')](/"(.*?)"/);return _0x5c8796?_0x5c8796[0x1]:_0x1f8a91;}function extractCalleridNumber(_0x58aa61){var _0x3ace73=_0x58aa61[_0xf222('0x15c')](/<(.*?)>/);return _0x3ace73?_0x3ace73[0x1]:_0x58aa61;}Dialer[_0xf222('0x1b')][_0xf222('0x15d')]=function(_0x1aca70,_0x5a96e7){var _0x2f048e=this;var _0xec1866=uuid['v4']();this[_0xf222('0x26')][_0xec1866]=new Action(_0x1aca70,_0x5a96e7,_0xec1866);return new BPromise(function(_0x3f8d3a,_0x318dfe){if(_[_0xf222('0x40')](_0x1aca70)&&typeof _0x1aca70!==_0xf222('0x15e')){return _0x318dfe(msgResponse(_0xf222('0x15f'),_0xf222('0x13a'),_0xf222('0x160')));}if(_[_0xf222('0x40')](_0x5a96e7[_0xf222('0x161')]['phone'])||_0x5a96e7[_0xf222('0x161')][_0xf222('0x162')]===null){return _0x318dfe(msgResponse(_0xf222('0x15f'),_0xf222('0x13a'),_0xf222('0x163')));}var _0x5413a9={'XMD-CALLERID':_0x2f048e[_0xf222('0x26')][_0xec1866][_0xf222('0x164')](),'XMD-AGI':_0x1aca70[_0xf222('0x101')]?util['format'](_0xf222('0x165'),ipAgi,_0x1aca70['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x1aca70['dialQueueProject2']?util['format'](_0xf222('0x165'),ipAgi,_0x1aca70['dialQueueProject2']):_0xf222('0x166'),'XMD-QUEUE':_0x1aca70['type']===_0xf222('0x4f')?util[_0xf222('0x77')](_0xf222('0x167'),_0x1aca70['name'],_0x1aca70[_0xf222('0x168')]||'',_0x1aca70[_0xf222('0x169')]?'c':'',_0x1aca70[_0xf222('0x16a')]||0x3):_0xf222('0x166'),'XMD-CONTACTID':_0x5a96e7[_0xf222('0xce')],'XMD-CDRTYPE':_0xf222('0x16b'),'CALLERID(all)':_0x2f048e['actions'][_0xec1866]['getCaller'](),'XMD-AMD':_0x1aca70['dialAMDActive']?_0xf222('0x16c'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x1aca70[_0xf222('0xfc')]){_0x5413a9[_0xf222('0x16d')]=_0x1aca70[_0xf222('0x16e')]||0x9c4;_0x5413a9[_0xf222('0x16f')]=_0x1aca70[_0xf222('0x170')]||0x5dc;_0x5413a9[_0xf222('0x171')]=_0x1aca70[_0xf222('0x172')]||0x320;_0x5413a9[_0xf222('0x173')]=_0x1aca70[_0xf222('0x174')]||0x1388;_0x5413a9[_0xf222('0x175')]=_0x1aca70[_0xf222('0x176')]||0x64;_0x5413a9[_0xf222('0x177')]=_0x1aca70['dialAMDBetweenWordsSilence']||0x32;_0x5413a9[_0xf222('0x178')]=_0x1aca70[_0xf222('0x179')]||0x3;_0x5413a9[_0xf222('0x17a')]=_0x1aca70['dialAMDSilenceThreshold']||0x100;_0x5413a9[_0xf222('0x17b')]=_0x1aca70[_0xf222('0x17c')]||0x1388;}if(_0x1aca70[_0xf222('0x4e')]===_0xf222('0x4f')){_0x5413a9[_0xf222('0x17d')]=_0x5a96e7[_0xf222('0xfa')];}else{_0x5413a9[_0xf222('0x17e')]=_0x5a96e7[_0xf222('0xd1')];}for(var _0x5a8b4e in _0x5a96e7[_0xf222('0x161')]){if(typeof _0x5a96e7[_0xf222('0x161')][_0x5a8b4e]!==_0xf222('0xae')){if(isNotNull(_0x5a96e7[_0xf222('0x161')][_0x5a8b4e])&&_0x5a8b4e!=='id'&&_0x5a8b4e!=='tags'&&_0x5a8b4e!=='createdAt'&&_0x5a8b4e!=='updatedAt'){_0x5413a9[util[_0xf222('0x77')](_0xf222('0x17f'),'XMD-',_[_0xf222('0x180')](_0x5a8b4e))]=_0x5a96e7[_0xf222('0x161')][_0x5a8b4e];}}}var _0x59de1e=_0x2f048e['isTrunkReachable'](_0x1aca70[_0xf222('0x73')])?getCallerId(_0x1aca70[_0xf222('0x73')][_0xf222('0x75')],_0x1aca70[_0xf222('0x181')],_0x1aca70[_0xf222('0x182')]>0x0?getCallerIdRandom(_0x1aca70[_0xf222('0x59')],_0x1aca70[_0xf222('0x182')]):_0x1aca70['dialOriginateCallerIdNumber']):getCallerId(_[_0xf222('0xaf')](_0x1aca70[_0xf222('0x137')])?_0x1aca70[_0xf222('0x73')][_0xf222('0x75')]:_0x1aca70['TrunkBackup'][_0xf222('0x75')],_0x1aca70[_0xf222('0x181')],_0x1aca70[_0xf222('0x182')]>0x0?getCallerIdRandom(_0x1aca70[_0xf222('0x59')],_0x1aca70[_0xf222('0x182')]):_0x1aca70['dialOriginateCallerIdNumber']);if(_0x59de1e){_0x5413a9['XMD-ORIGINATECALLERIDNAME']=_0x2f048e[_0xf222('0x26')][_0xec1866][_0xf222('0x183')]=extractCalleridName(_0x59de1e);_0x5413a9[_0xf222('0x184')]=_0x2f048e['actions'][_0xec1866]['originatecalleridnum']=extractCalleridNumber(_0x59de1e);}return ami[_0xf222('0xb0')]({'actionid':_0xec1866,'action':_0xf222('0x15f'),'channel':_0x2f048e[_0xf222('0xd5')](_0x1aca70[_0xf222('0x73')])?util[_0xf222('0x77')]('SIP/%s/%s%s',_0x1aca70[_0xf222('0x73')][_0xf222('0x42')],isNotNull(_0x1aca70[_0xf222('0x5b')])?_0x1aca70[_0xf222('0x5b')]['trim']()||'':'',_0x1aca70[_0xf222('0x185')]>0x0?_0x5a96e7[_0xf222('0x161')][_0xf222('0x162')]['substring'](_0x1aca70['dialCutDigit']):_0x5a96e7[_0xf222('0x161')][_0xf222('0x162')]):util['format'](_0xf222('0x186'),_['isNil'](_0x1aca70[_0xf222('0x137')])?_0x1aca70['Trunk'][_0xf222('0x42')]:_0x1aca70[_0xf222('0x137')]['name'],isNotNull(_0x1aca70['dialPrefix'])?_0x1aca70[_0xf222('0x5b')][_0xf222('0x187')]()||'':'',_0x1aca70[_0xf222('0x185')]>0x0?_0x5a96e7[_0xf222('0x161')][_0xf222('0x162')][_0xf222('0x188')](_0x1aca70[_0xf222('0x185')]):_0x5a96e7[_0xf222('0x161')][_0xf222('0x162')]),'callerid':_0x59de1e,'Exten':_0xf222('0xdc'),'Context':_0xf222('0x189'),'Priority':'1','variable':_0x5413a9,'timeout':(_0x1aca70[_0xf222('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0xec1866})[_0xf222('0xb9')](function(_0x185bff){return _0x3f8d3a(_0x185bff);})[_0xf222('0xb2')](function(_0x52163a){_0x1aca70[_0xf222('0x63')]+=0x1;var _0x3771dd=new History(_0x2f048e[_0xf222('0x26')][_0xec1866]);logger[_0xf222('0x96')](util[_0xf222('0x77')](_0xf222('0x18a'),JSON[_0xf222('0x128')](_0x52163a)));_0x3771dd[_0xf222('0xa8')]=0xe;_0x3771dd[_0xf222('0xdf')]=_0xf222('0x18b');_0x3771dd[_0xf222('0x113')]=moment()['format'](_0xf222('0xf9'));_0x3771dd[_0xf222('0xa9')]=_0x3771dd[_0xf222('0x113')];_0x2f048e['createHistory'](_0x3771dd)[_0xf222('0xb2')](loggerCatch(_0xf222('0x18c')));_0x2f048e[_0xf222('0xc7')](_0x3771dd)[_0xf222('0xb2')](loggerCatch(_0xf222('0x18c')))[_0xf222('0x1e')](function(){delete _0x2f048e[_0xf222('0x26')][_0xec1866];return _0x318dfe(msgResponse(_0xf222('0x15f'),_0xf222('0x4a'),_0xf222('0x18d')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x5207d3){var _0x2a4b0e=this[_0xf222('0x26')][_0x5207d3[_0xf222('0x11e')]];if(_0x2a4b0e){delete this[_0xf222('0x26')][_0x5207d3[_0xf222('0x11e')]];_0x2a4b0e[_0xf222('0x10e')]=moment()[_0xf222('0x77')](_0xf222('0xf9'));var _0x45d6ae=_0x2a4b0e[_0xf222('0x4e')]===_0xf222('0x93')?this[_0xf222('0x21')][_0x2a4b0e['queue']]:this[_0xf222('0x20')][_0x2a4b0e[_0xf222('0x18e')]()];if(!this[_0xf222('0x18f')](_0x5207d3[_0xf222('0x190')])){this[_0xf222('0xb4')](_0x45d6ae);return this['callProgressDetecting'](_0x2a4b0e,_0x45d6ae,_0x5207d3)[_0xf222('0xb2')](loggerCatch(_0xf222('0x191')));}this[_0xf222('0xab')][_0x5207d3[_0xf222('0xd9')]]=_0x2a4b0e;}};Dialer[_0xf222('0x1b')]['checkRetriveMax']=function(_0x2be22e,_0x57bffe,_0xc68398){var _0x93ea67=new History(_0x57bffe);if(_0x93ea67[_0xf222('0xeb')]+_0x93ea67['countcongestionretry']+_0x93ea67[_0xf222('0xec')]+_0x93ea67[_0xf222('0xed')]+_0x93ea67[_0xf222('0xee')]+_0x93ea67[_0xf222('0xef')]+_0x93ea67[_0xf222('0xe6')]+_0x93ea67[_0xf222('0xf0')]>=_0xc68398[_0xf222('0xf1')]-0x1){return!![];}switch(_0x2be22e){case 0x3:if(_0x93ea67[_0xf222('0xec')]>=_0xc68398['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x93ea67[_0xf222('0xec')]+=0x1,'scheduledat':moment()[_0xf222('0x112')](_0xc68398[_0xf222('0x192')],_0xf222('0xf8'))[_0xf222('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x93ea67[_0xf222('0xce')],'ListId':_0x93ea67['ListId'],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x193')));break;case 0x5:if(_0x93ea67[_0xf222('0xeb')]>=_0xc68398[_0xf222('0x194')]-0x1){return!![];}this[_0xf222('0xc0')]({'active':![],'countbusyretry':_0x93ea67[_0xf222('0xeb')]+=0x1,'scheduledat':moment()['add'](_0xc68398[_0xf222('0x195')],_0xf222('0xf8'))[_0xf222('0x77')](_0xf222('0xf9')),'ContactId':_0x93ea67[_0xf222('0xce')],'ListId':_0x93ea67[_0xf222('0xcf')],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x196')));break;case 0x8:if(_0x93ea67[_0xf222('0xfe')]>=_0xc68398[_0xf222('0x197')]-0x1){return!![];}this[_0xf222('0xc0')]({'active':![],'countcongestionretry':_0x93ea67[_0xf222('0xfe')]+=0x1,'scheduledat':moment()[_0xf222('0x112')](_0xc68398[_0xf222('0x198')],_0xf222('0xf8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x93ea67[_0xf222('0xce')],'ListId':_0x93ea67[_0xf222('0xcf')],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x199')));break;case 0x0:if(_0x93ea67[_0xf222('0xed')]>=_0xc68398['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xf222('0xc0')]({'active':![],'countnosuchnumberretry':_0x93ea67[_0xf222('0xed')]+=0x1,'scheduledat':moment()[_0xf222('0x112')](_0xc68398[_0xf222('0x19a')],_0xf222('0xf8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x93ea67[_0xf222('0xce')],'ListId':_0x93ea67[_0xf222('0xcf')],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x19b')));}break;case 0xa:if(_0x93ea67[_0xf222('0xee')]>=_0xc68398[_0xf222('0x111')]-0x1){return!![];}this[_0xf222('0xc0')]({'active':![],'countdropretry':_0x93ea67['countdropretry']+=0x1,'scheduledat':moment()[_0xf222('0x112')](_0xc68398[_0xf222('0x19c')],_0xf222('0xf8'))[_0xf222('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x93ea67[_0xf222('0xce')],'ListId':_0x93ea67[_0xf222('0xcf')],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67[_0xf222('0xd1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x93ea67['countabandonedretry']>=_0xc68398[_0xf222('0x19d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x93ea67[_0xf222('0xef')]+=0x1,'scheduledat':moment()[_0xf222('0x112')](_0xc68398[_0xf222('0x11b')],_0xf222('0xf8'))[_0xf222('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x93ea67[_0xf222('0xce')],'ListId':_0x93ea67[_0xf222('0xcf')],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67[_0xf222('0xd1')]||undefined})['catch'](loggerCatch(_0xf222('0x19e')));break;case 0x13:if(_0x93ea67['countmachineretry']>=_0xc68398['dialMachineMaxRetry']-0x1){return!![];}this[_0xf222('0xc0')]({'active':![],'countmachineretry':_0x93ea67[_0xf222('0xe6')]+=0x1,'scheduledat':moment()['add'](_0xc68398[_0xf222('0xf7')],_0xf222('0xf8'))[_0xf222('0x77')](_0xf222('0xf9')),'ContactId':_0x93ea67['ContactId'],'ListId':_0x93ea67[_0xf222('0xcf')],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67['CampaignId']||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0xfb')));break;case 0x14:if(_0x93ea67[_0xf222('0xf0')]>=_0xc68398['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xf222('0xc0')]({'active':![],'countagentrejectretry':_0x93ea67[_0xf222('0xf0')]+=0x1,'scheduledat':moment()[_0xf222('0x112')](_0xc68398[_0xf222('0x19f')],_0xf222('0xf8'))[_0xf222('0x77')](_0xf222('0xf9')),'ContactId':_0x93ea67[_0xf222('0xce')],'ListId':_0x93ea67[_0xf222('0xcf')],'VoiceQueueId':_0x93ea67[_0xf222('0xfa')]||undefined,'CampaignId':_0x93ea67[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x1a0')));break;default:return!![];}};Dialer[_0xf222('0x1b')][_0xf222('0x1a1')]=function(_0x515c2b,_0x456300,_0x2dfbba){var _0x254678=this;var _0x4fcc6c=new History(_0x515c2b);return new BPromise(function(_0x48034b,_0x1d0989){if(_[_0xf222('0x40')](_0x456300)&&typeof _0x456300!=='object'){return _0x1d0989(msgResponse(_0xf222('0x1a2'),'Failure',_0xf222('0x1a3')));}if(_[_0xf222('0x40')](_0x2dfbba)&&typeof _0x2dfbba!==_0xf222('0x15e')){return _0x1d0989(msgResponse(_0xf222('0x1a2'),'Failure',_0xf222('0x1a4')));}switch(_0x2dfbba[_0xf222('0x105')]){case'0':_0x456300[_0xf222('0x1a5')]+=0x1;_0x4fcc6c[_0xf222('0xa8')]=0x0;_0x4fcc6c[_0xf222('0xdf')]=_0xf222('0x1a6');_0x4fcc6c[_0xf222('0xed')]+=0x1;_0x4fcc6c[_0xf222('0xe7')]+=0x1;ami[_0xf222('0x4d')](_0xf222('0x1a7'),ut[_0xf222('0xe9')](_0x515c2b,_0xf222('0x1a8')));_0x254678[_0xf222('0xc8')](_0x4fcc6c)[_0xf222('0xb2')](loggerCatch(_0xf222('0xea')));if(_0x254678[_0xf222('0x1a9')](0x0,_0x515c2b,_0x456300)){if(_0x4fcc6c[_0xf222('0xed')]>=_0x456300[_0xf222('0x1aa')]){_0x254678[_0xf222('0xf5')](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1ab'));}else{_0x254678['stateGlobal'](_0x4fcc6c,_0x48034b,_0x1d0989,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x456300[_0xf222('0x62')]+=0x1;_0x4fcc6c[_0xf222('0xa8')]=0x3;_0x4fcc6c[_0xf222('0xdf')]=_0xf222('0x1ac');_0x4fcc6c[_0xf222('0xec')]+=0x1;_0x4fcc6c[_0xf222('0xe7')]+=0x1;ami['emit'](_0xf222('0x1ad'),ut[_0xf222('0xe9')](_0x515c2b,_0xf222('0x1ae')));_0x254678['createHistory'](_0x4fcc6c)[_0xf222('0xb2')](loggerCatch(_0xf222('0x1af')));if(_0x254678['checkRetriveMax'](0x3,_0x515c2b,_0x456300)){if(_0x4fcc6c['countnoanswerretry']>=_0x456300[_0xf222('0x1b0')]){_0x254678['createStateFinal'](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1b1'));}else{_0x254678[_0xf222('0xf2')](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1b1'));}}break;case'5':_0x456300[_0xf222('0x1b2')]+=0x1;_0x4fcc6c['state']=0x5;_0x4fcc6c[_0xf222('0xdf')]=_0xf222('0x1b3');_0x4fcc6c[_0xf222('0xeb')]+=0x1;_0x4fcc6c['countglobal']+=0x1;ami['emit'](_0xf222('0x1b4'),ut[_0xf222('0xe9')](_0x515c2b,_0xf222('0x1b5')));_0x254678[_0xf222('0xc8')](_0x4fcc6c)['catch'](loggerCatch(_0xf222('0x1b6')));if(_0x254678[_0xf222('0x1a9')](0x5,_0x515c2b,_0x456300)){if(_0x4fcc6c[_0xf222('0xeb')]>=_0x456300[_0xf222('0x194')]){_0x254678[_0xf222('0xf5')](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1b7'));}else{_0x254678[_0xf222('0xf2')](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1b7'));}}break;case'8':_0x456300[_0xf222('0x5f')]+=0x1;_0x4fcc6c[_0xf222('0xa8')]=0x8;_0x4fcc6c[_0xf222('0xdf')]='Congestion';_0x4fcc6c[_0xf222('0xfe')]+=0x1;_0x4fcc6c[_0xf222('0xe7')]+=0x1;ami['emit'](_0xf222('0x1b8'),ut[_0xf222('0xe9')](_0x515c2b,_0xf222('0x1b9')));_0x254678['createHistory'](_0x4fcc6c)[_0xf222('0xb2')](loggerCatch(_0xf222('0x1ba')));if(_0x254678['checkRetriveMax'](0x8,_0x515c2b,_0x456300)){if(_0x4fcc6c['countcongestionretry']>=_0x456300[_0xf222('0x197')]){_0x254678[_0xf222('0xf5')](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1bb'));}else{_0x254678[_0xf222('0xf2')](_0x4fcc6c,_0x48034b,_0x1d0989,'reason\x208\x20congestion');}}break;case'11':_0x456300['outboundAbandonedCallsDay']+=0x1;_0x4fcc6c[_0xf222('0xa8')]=0xb;_0x4fcc6c[_0xf222('0xdf')]=_0xf222('0x118');_0x4fcc6c[_0xf222('0xef')]+=0x1;_0x4fcc6c[_0xf222('0xe7')]+=0x1;_0x254678[_0xf222('0xc8')](_0x4fcc6c)[_0xf222('0xb2')](loggerCatch(_0xf222('0x11c')));if(_0x254678[_0xf222('0x1a9')](0xb,_0x515c2b,_0x456300)){if(_0x4fcc6c['countabandonedretry']>=_0x456300['dialAbandonedMaxRetry']){_0x254678[_0xf222('0xf5')](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1bc'));}else{_0x254678['stateGlobal'](_0x4fcc6c,_0x48034b,_0x1d0989,'reason\x2011\x20abandoned');}}break;case'20':_0x456300['outboundRejectCallsDay']+=0x1;_0x4fcc6c[_0xf222('0xa8')]=0x14;_0x4fcc6c[_0xf222('0xdf')]='AgentReject';_0x4fcc6c[_0xf222('0xf0')]+=0x1;_0x4fcc6c['countglobal']+=0x1;ami['emit'](_0xf222('0x1bd'),ut['buildObj'](_0x515c2b,'agentreject'));_0x254678[_0xf222('0xc8')](_0x4fcc6c)[_0xf222('0xb2')](loggerCatch(_0xf222('0x1be')));if(_0x254678['checkRetriveMax'](0x14,_0x515c2b,_0x456300)){if(_0x4fcc6c[_0xf222('0xf0')]>=_0x456300[_0xf222('0x1bf')]){_0x254678['createStateFinal'](_0x4fcc6c,_0x48034b,_0x1d0989,'reason\x2020\x20agentreject');}else{_0x254678[_0xf222('0xf2')](_0x4fcc6c,_0x48034b,_0x1d0989,_0xf222('0x1c0'));}}break;default:_0x456300[_0xf222('0x65')]+=0x1;_0x4fcc6c[_0xf222('0xa8')]=0xc;_0x4fcc6c[_0xf222('0xdf')]=_0x2dfbba[_0xf222('0x105')];_0x254678['createHistory'](_0x4fcc6c)['catch'](loggerCatch(_0xf222('0x1c1')));if(_0x254678[_0xf222('0x1a9')](_0x2dfbba[_0xf222('0x105')],_0x515c2b,_0x456300)){if(_0x4fcc6c['countbusyretry']+_0x4fcc6c[_0xf222('0xfe')]+_0x4fcc6c['countnoanswerretry']+_0x4fcc6c[_0xf222('0xed')]+_0x4fcc6c['countdropretry']+_0x4fcc6c[_0xf222('0xef')]+_0x4fcc6c[_0xf222('0xe6')]+_0x4fcc6c['countagentrejectretry']>=_0x456300[_0xf222('0xf1')]){_0x254678['stateGlobal'](_0x4fcc6c,_0x48034b,_0x1d0989,_0x2dfbba[_0xf222('0x105')]);}else{_0x254678[_0xf222('0xf5')](_0x4fcc6c,_0x48034b,_0x1d0989,_0x2dfbba[_0xf222('0x105')]);}}}});};Dialer[_0xf222('0x1b')][_0xf222('0xf2')]=function(_0x25f6c1,_0xb46e4e,_0x3c5cd0,_0x13073c){var _0x1c1b79=new Final(_0x25f6c1);_0x1c1b79['state']=0xf;_0x1c1b79['statedesc']=_0xf222('0x1c2');this[_0xf222('0xf5')](_0x1c1b79,_0xb46e4e,_0x3c5cd0,_0x13073c);};Dialer[_0xf222('0x1b')][_0xf222('0xf5')]=function(_0x252a02,_0xd0f11c,_0x3c7646,_0x538f15){this[_0xf222('0xc7')](_0x252a02)['then'](function(){return _0xd0f11c(msgResponse('[callProgressDetecting]',_0xf222('0xd4'),_0x538f15));})['catch'](function(){return _0x3c7646(msgResponse(_0xf222('0x1c3'),'Failure','contact\x20not\x20moved'));});};Dialer[_0xf222('0x1b')][_0xf222('0x8')]=function(_0x5b2c4a){var _0x40d7d1=_0x5b2c4a[_0xf222('0x1c4')]/0x64;var _0x54cf3c=_0x5b2c4a[_0xf222('0x61')]/(_0x5b2c4a[_0xf222('0x61')]+_0x5b2c4a[_0xf222('0x5d')]);var _0x22578d=Math[_0xf222('0x1c5')](_0x5b2c4a[_0xf222('0x1c6')]*(_0x5b2c4a[_0xf222('0x1c7')]/0x64));var _0x353e70=Math[_0xf222('0x1c5')](_0x5b2c4a[_0xf222('0x1c6')]*(_0x5b2c4a['predictiveIntervalMinThreshold']/0x64));var _0xbc9141=_0x5b2c4a[_0xf222('0xa2')]+_0x5b2c4a[_0xf222('0xa1')];var _0x52af8a=Math[_0xf222('0x1c8')](_0x5b2c4a[_0xf222('0x70')]*_0x5b2c4a[_0xf222('0x8b')]*_0x5b2c4a[_0xf222('0x6d')]*_0x5b2c4a[_0xf222('0x6e')]);if(_[_0xf222('0x40')](_0x5b2c4a[_0xf222('0x29')])){if(!_[_0xf222('0x40')](_0x5b2c4a['startPredictive'])){_0x5b2c4a[_0xf222('0x28')]=undefined;loggerPredictive[_0xf222('0x96')](_0xf222('0x1c9'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x5b2c4a['handlePredictive'])){loggerPredictive[_0xf222('0x96')](_0xf222('0x1c9'),_0xf222('0x1ca'));clearInterval(_0x5b2c4a[_0xf222('0x90')]);_0x5b2c4a[_0xf222('0x90')]=undefined;}_0x5b2c4a[_0xf222('0x29')]=moment()[_0xf222('0x77')](_0xf222('0xf9'));loggerPredictive[_0xf222('0x7b')](_0x5b2c4a[_0xf222('0x42')],_0xf222('0x1cb'),_0x5b2c4a[_0xf222('0x29')]);this[_0xf222('0x150')](_0x5b2c4a,0x1);}else if(ifInterval(_0x5b2c4a['dialPredictiveInterval'],_0x5b2c4a[_0xf222('0x29')])){this[_0xf222('0x150')](_0x5b2c4a,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x5b2c4a[_0xf222('0x29')],_0x5b2c4a[_0xf222('0x42')]);_0x5b2c4a[_0xf222('0x70')]=0x0;_0x5b2c4a[_0xf222('0x6c')]=0x0;}else if(_0x40d7d1<_0x54cf3c&&_0x5b2c4a[_0xf222('0x1cc')]===_0xf222('0x1cd')){freeVariablesPredictive(_0x5b2c4a);loggerPredictive[_0xf222('0x7b')](_0xf222('0x1ce'),_0xf222('0x1cf'),_0x54cf3c,_0xf222('0x29'),_0x5b2c4a[_0xf222('0x42')]);}else if(_0x52af8a<_0x5b2c4a[_0xf222('0x6c')]&&_0x5b2c4a[_0xf222('0x1cc')]===_0xf222('0x1cd')){freeVariablesPredictive(_0x5b2c4a);loggerPredictive[_0xf222('0x7b')](_0xf222('0x1d0'),'Max\x20Drop\x20',_0x52af8a,'Drop\x20in\x20this\x20interval',_0x5b2c4a[_0xf222('0x6c')],'startProgressive',_0x5b2c4a['name']);}else if(!ifInterval(_0x5b2c4a[_0xf222('0x1d1')],_0x5b2c4a[_0xf222('0x29')])&&_[_0xf222('0x40')](_0x5b2c4a[_0xf222('0x28')])&&!_[_0xf222('0x40')](_0x5b2c4a[_0xf222('0x29')])){_0x5b2c4a[_0xf222('0x28')]=moment()['format'](_0xf222('0xf9'));loggerPredictive['info'](_0x5b2c4a[_0xf222('0x42')],_0xf222('0x1d2'),_0x5b2c4a[_0xf222('0x28')]);this[_0xf222('0x1d3')](_0x5b2c4a[_0xf222('0x1d1')])[_0xf222('0xb9')](this[_0xf222('0x1d4')](_0x5b2c4a))['then'](mergeDataErlangB(_0x5b2c4a))['then'](this['startMethodPredictive'](_0x5b2c4a))[_0xf222('0xb2')](loggerCatchPredictive(_0xf222('0x1d5'),_0x5b2c4a));}else if(!ifInterval(_0x5b2c4a[_0xf222('0x1d1')],_0x5b2c4a[_0xf222('0x28')])){_0x5b2c4a['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5b2c4a[_0xf222('0x28')]=moment()[_0xf222('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5b2c4a['name'],_0xf222('0x1d6'),_0x5b2c4a['startPredictive']);clearInterval(_0x5b2c4a[_0xf222('0x90')]);_0x5b2c4a[_0xf222('0x90')]=undefined;this[_0xf222('0x1d3')](_0x5b2c4a[_0xf222('0x1d1')])[_0xf222('0xb9')](this[_0xf222('0x1d4')](_0x5b2c4a))['then'](mergeDataErlangB(_0x5b2c4a))[_0xf222('0xb9')](this[_0xf222('0x1d7')](_0x5b2c4a))[_0xf222('0xb2')](loggerCatchPredictive(_0xf222('0x1d8'),_0x5b2c4a));}else if(_0x5b2c4a[_0xf222('0x1c6')]&&_0xbc9141<_0x5b2c4a['predictiveIntervalAvailable']-_0x353e70){freeVariablesPredictive(_0x5b2c4a);loggerPredictive[_0xf222('0x7b')](_0x5b2c4a[_0xf222('0x42')],_0xf222('0x1d9'),_0xbc9141,_0xf222('0x1da'),_0x5b2c4a[_0xf222('0x1c6')],'-',_0x353e70,'=',_0x5b2c4a[_0xf222('0x1c6')]-_0x353e70,')');}else if(_0x5b2c4a[_0xf222('0x1c6')]&&_0xbc9141>_0x5b2c4a['predictiveIntervalAvailable']+_0x22578d){freeVariablesPredictive(_0x5b2c4a);loggerPredictive[_0xf222('0x7b')](_0x5b2c4a['name'],_0xf222('0x1d9'),_0xbc9141,_0xf222('0x1db'),_0x5b2c4a['predictiveIntervalAvailable'],'+',_0x22578d,'=',_0x5b2c4a[_0xf222('0x1c6')]+_0x22578d,')');}};Dialer[_0xf222('0x1b')][_0xf222('0x1d4')]=function(_0x31b774){var _0x473cc1=this;return function(_0x299f26){return new BPromise(function(_0x39fea9,_0x250b26){_['merge'](_0x31b774,_0x299f26[0x0]);if(checkGetDataPredictive(_0x299f26[0x0])){var _0x4b950a=_0x31b774[_0xf222('0x1c6')]=_0x31b774[_0xf222('0xa1')]+_0x31b774['available'];var _0x450f29=_0x31b774['dialPredictiveInterval']*0x3c;var _0x1ee36b=_0x299f26[0x0][_0xf222('0x68')]+_0x299f26[0x0][_0xf222('0x67')];var _0x5c80ff=(_0x299f26[0x0][_0xf222('0x66')]+_0x299f26[0x0][_0xf222('0x6a')]+_0x299f26[0x0][_0xf222('0x69')])/_0x299f26[0x0][_0xf222('0x7e')];_0x31b774[_0xf222('0x6d')]=_0x5c80ff>0x0?_0x5c80ff:0x1;switch(_0x31b774[_0xf222('0x1cc')]){case _0xf222('0x1cd'):var _0x17db7c=_0x31b774[_0xf222('0x1c4')]/0x64;return _0x473cc1[_0xf222('0x1dc')](_0x4b950a,_0x450f29,_0x1ee36b,_0x5c80ff,_0x17db7c)[_0xf222('0xb9')](function(_0x351f86){return _0x39fea9(_0x351f86);});case _0xf222('0x1dd'):var _0x1d6454=_0x31b774[_0xf222('0x1c4')]/0x64;return _0x473cc1[_0xf222('0x1de')](_0x4b950a,_0x450f29,_0x1ee36b,_0x5c80ff,_0x1d6454)[_0xf222('0xb9')](function(_0x9a768b){return _0x39fea9(_0x9a768b);});default:return _0x250b26(msgResponse('[getDataPredictive]',_0xf222('0x13a'),_0xf222('0x1df')));}}else{return _0x250b26(msgResponse(_0xf222('0x1e0'),'Failure',_0xf222('0x1e1')));}});};};Dialer[_0xf222('0x1b')][_0xf222('0x1e2')]=function(_0x398c61){var _0x56c792=this;return function(_0x41f225){return new BPromise(function(_0xb72881,_0x5dd912){_[_0xf222('0x8c')](_0x398c61,_0x41f225[0x0]);if(checkGetDataPredictive(_0x41f225[0x0])){loggerPredictive[_0xf222('0x7b')](JSON[_0xf222('0x128')](_0x41f225[0x0]));if(_0x398c61[_0xf222('0x1cc')]===_0xf222('0x1cd')){return _0x56c792['getVoiceQueueRtPauses'](_0x398c61['id'])[_0xf222('0xb9')](function(_0x2f39bd){var _0x210d77=_0x398c61[_0xf222('0x52')]-_0x2f39bd[0x0][_0xf222('0x1e3')];var _0x4a2f3c=_0x398c61[_0xf222('0x1d1')]*0x3c;var _0x23b13a=_0x41f225[0x0][_0xf222('0x68')]+_0x41f225[0x0][_0xf222('0x67')];var _0x4e3ed7=(_0x41f225[0x0][_0xf222('0x66')]+_0x41f225[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x41f225[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x41f225[0x0][_0xf222('0x7e')];var _0x15fba9=_0x398c61[_0xf222('0x1c4')]/0x64;_0x398c61[_0xf222('0x1e4')]=_0x2f39bd[0x0][_0xf222('0x1e3')]||0x0;_0x398c61[_0xf222('0x6d')]=_0x4e3ed7>0x0?_0x4e3ed7:0x1;return _0x56c792['abandonmentRate'](_0x210d77,_0x4a2f3c,_0x23b13a,_0x4e3ed7,_0x15fba9);})[_0xf222('0xb9')](function(_0xbb5ca1){return _0xb72881(_0xbb5ca1);})[_0xf222('0xb2')](function(_0x106da2){return _0x5dd912(msgResponse('[CatchErlangB]',_0xf222('0x13a'),JSON[_0xf222('0x128')](_0x106da2)));});}if(_0x398c61[_0xf222('0x1cc')]===_0xf222('0x1dd')){return _0x56c792[_0xf222('0xc6')](_0x398c61['id'])['then'](function(_0x434c10){var _0x4fa80c=_0x398c61[_0xf222('0x52')]-_0x434c10[0x0][_0xf222('0x1e3')];var _0x13eae7=_0x398c61[_0xf222('0x1d1')]*0x3c;var _0x13d17c=_0x41f225[0x0][_0xf222('0x68')]+_0x41f225[0x0][_0xf222('0x67')];var _0x590572=(_0x41f225[0x0][_0xf222('0x66')]+_0x41f225[0x0][_0xf222('0x6a')]+_0x41f225[0x0][_0xf222('0x69')])/_0x41f225[0x0][_0xf222('0x7e')];var _0x51ead5=_0x398c61[_0xf222('0x1c4')]/0x64;_0x398c61[_0xf222('0x1e4')]=_0x434c10[0x0][_0xf222('0x1e3')]||0x0;_0x398c61['predictiveIntervalHitRate']=_0x590572>0x0?_0x590572:0x1;return _0x56c792[_0xf222('0x1de')](_0x4fa80c,_0x13eae7,_0x13d17c,_0x590572,_0x51ead5);})[_0xf222('0xb9')](function(_0x3079f8){return _0xb72881(_0x3079f8);})[_0xf222('0xb2')](function(_0x35e6dc){return _0x5dd912(msgResponse(_0xf222('0x1e5'),_0xf222('0x13a'),JSON[_0xf222('0x128')](_0x35e6dc)));});}}else{return _0x5dd912(msgResponse('[getDataPredictive]',_0xf222('0x13a'),'check\x20failure'));}});};};Dialer[_0xf222('0x1b')][_0xf222('0x1d7')]=function(_0x2d68ec){var _0x1a1c64=this;return function(){var _0x58a570=0x0;var _0x186d32=Math['floor'](_0x2d68ec['erlangCallToSecond']*0x3e8);if(_0x186d32>0x0){_0x186d32=_0x186d32<0x64?0x64:_0x186d32;loggerPredictive[_0xf222('0x7b')](_0x2d68ec[_0xf222('0x42')],_0xf222('0x1e6'),_0x186d32,'milliseconds');_0x2d68ec[_0xf222('0x90')]=setInterval(function(){_0x1a1c64['handlePredictive'](_0x2d68ec);loggerPredictiveCalls[_0xf222('0x7b')]('[handlePredictive]',_0x58a570+=0x1);},_0x186d32);}else{loggerPredictive[_0xf222('0x7b')](_0x2d68ec[_0xf222('0x42')],_0xf222('0x1e7'));}};};Dialer[_0xf222('0x1b')][_0xf222('0x1e8')]=function(_0x2e918e,_0x2a9fff){var _0x582ab=this;return function(_0x5a7800){if(_[_0xf222('0x49')](_0x5a7800)){if(_['isNil'](_0x2a9fff['UserId'])||!_0x2a9fff['recallme']){if(_0x2e918e[_0xf222('0x14e')]===_0xf222('0x1e9')){_0x2e918e[_0xf222('0x125')]=_[_0xf222('0x40')](_0x2e918e['queueStatusComplete'])?!![]:_0x2e918e[_0xf222('0x125')];var _0x3aa32f=uuid['v4']();_0x582ab[_0xf222('0x26')][_0x3aa32f]=new Action(_0x2e918e,_0x2a9fff,_0x3aa32f);loggerBooked['info'](_0xf222('0x1ea'),_0x3aa32f,'queueStatusComplete:\x20',JSON[_0xf222('0x128')](_0x2e918e[_0xf222('0x125')]),_0xf222('0x1eb'),_0x2e918e[_0xf222('0x42')]);if(_0x2e918e['queueStatusComplete']){_0x2e918e[_0xf222('0x125')]=![];_0x582ab[_0xf222('0x2b')][_0x582ab[_0xf222('0x26')][_0x3aa32f][_0xf222('0xb5')]]=[];ami[_0xf222('0xb0')]({'actionid':_0x3aa32f,'action':_0xf222('0x1ec'),'queue':_0x2e918e[_0xf222('0x42')]})['catch'](function(){_0x582ab[_0xf222('0xb4')](_0x2e918e);_0x582ab['rescheduleContact']({'active':![],'ContactId':_0x582ab[_0xf222('0x26')][_0x3aa32f]['ContactId'],'ListId':_0x582ab[_0xf222('0x26')][_0x3aa32f][_0xf222('0xcf')],'VoiceQueueId':_0x582ab[_0xf222('0x26')][_0x3aa32f][_0xf222('0xfa')]||undefined,'CampaignId':_0x582ab[_0xf222('0x26')][_0x3aa32f]['CampaignId']||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x1ed')));delete _0x582ab[_0xf222('0x26')][_0x3aa32f];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON['stringify'](_0x2e918e['queueStatusComplete']),_0xf222('0x1eb'),_0x2e918e['name']);_0x582ab[_0xf222('0xb4')](_0x2e918e);_0x582ab['rescheduleContact']({'active':![],'ContactId':_0x582ab[_0xf222('0x26')][_0x3aa32f][_0xf222('0xce')],'ListId':_0x582ab[_0xf222('0x26')][_0x3aa32f][_0xf222('0xcf')],'VoiceQueueId':_0x582ab[_0xf222('0x26')][_0x3aa32f][_0xf222('0xfa')]||undefined,'CampaignId':_0x582ab['actions'][_0x3aa32f]['CampaignId']||undefined})[_0xf222('0xb2')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x582ab[_0xf222('0x26')][_0x3aa32f];}}else{return _0x582ab[_0xf222('0x15d')](_0x2e918e,_0x2a9fff);}}else{if(getDiff(_0x2a9fff['scheduledat'])<_0x2e918e[_0xf222('0x1ee')]*0x3c){if(_0x2a9fff[_0xf222('0x1ef')]&&!_0x2a9fff['Agent'][_0xf222('0x1f0')]){_0x582ab['preview'][_0xf222('0x129')](_0x2a9fff['id'])[_0xf222('0x1e')](function(){_0x582ab[_0xf222('0xb4')](_0x2e918e);});}else{_0x582ab[_0xf222('0xc1')]({'active':![]},_0x2a9fff['id'],0x1)[_0xf222('0x1e')](function(){_0x582ab[_0xf222('0xb4')](_0x2e918e);});}}else{_0x2e918e[_0xf222('0x1f1')]+=0x1;_0x582ab[_0xf222('0xb4')](_0x2e918e);if(_0x2e918e['dialRecallInQueue']){_0x582ab['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a9fff[_0xf222('0xce')],'ListId':_0x2a9fff[_0xf222('0xcf')],'VoiceQueueId':_0x2a9fff['VoiceQueueId']||undefined,'CampaignId':_0x2a9fff[_0xf222('0xd1')]||undefined})[_0xf222('0xb2')](loggerCatch(_0xf222('0x1f2')));_0x582ab[_0xf222('0xc8')](createObjHistory(_0x2e918e,_0x2a9fff,_0xf222('0x1f3'),0x17,_0xf222('0x1f4')))[_0xf222('0xb2')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x582ab[_0xf222('0xcc')](createObjHistory(_0x2e918e,_0x2a9fff,_0xf222('0x1f5'),0x16,_0xf222('0x1f6')),'[Originate][HistoryRecallClose][historyCatch]',_0xf222('0x1f7'));}}}}else{_0x2e918e[_0xf222('0x5e')]+=0x1;_0x582ab['saveInDb'](createObjHistory(_0x2e918e,_0x2a9fff,'BLACKLIST',0xd,_0xf222('0x1f8')),_0xf222('0x1f9'),'[Originate][MoveBlacklist]');throw _0xf222('0x1fa');}};};Dialer[_0xf222('0x1b')][_0xf222('0x153')]=function(_0x4d5f8a){var _0x3823d4=this;var _0x2e764e=_0x4d5f8a['limitCalls']-_0x4d5f8a[_0xf222('0x6f')]-_0x4d5f8a[_0xf222('0xc3')];emitCampaignSummary(_0x4d5f8a);if(_0x2e764e>0x0){if(_0x2e764e>this['maxNumberOriginate']){_0x2e764e=this[_0xf222('0x24')];}_0x4d5f8a[_0xf222('0xc3')]+=_0x2e764e;this['getContactDialerIvr'](_0x4d5f8a['id'],_0x2e764e,_0x4d5f8a['dialOrderByScheduledAt'],_0x4d5f8a)[_0xf222('0xb9')](function(_0x32669f){_0x4d5f8a[_0xf222('0xc3')]-=_0x2e764e;_0x4d5f8a[_0xf222('0xc3')]=_0x4d5f8a[_0xf222('0xc3')]>0x0?_0x4d5f8a['temp']:0x0;if(!checkContactEmpty(_0x32669f)){_0x4d5f8a[_0xf222('0x41')]=_0xf222('0x9e');logger[_0xf222('0x7b')](_0xf222('0x1fb')+_0x4d5f8a[_0xf222('0x42')]);}else{_0x4d5f8a['originated']+=_0x32669f['length'];_0x4d5f8a['message']=_0xf222('0x1fc');for(var _0x4fdcae=0x0;_0x4fdcae<_0x32669f[_0xf222('0x99')];_0x4fdcae+=0x1){_0x4d5f8a[_0xf222('0x1fd')]+=0x1;if(_[_0xf222('0xaf')](_0x32669f[_0x4fdcae])||_[_0xf222('0xaf')](_0x32669f[_0x4fdcae][_0xf222('0x161')])||_[_0xf222('0xaf')](_0x32669f[_0x4fdcae][_0xf222('0x161')][_0xf222('0x162')])){_0x3823d4[_0xf222('0xca')]('[actionOriginate]\x20',_0x4d5f8a,_0x32669f[_0x4fdcae]);}else{_0x3823d4['checkIsBlackListIvr'](_[_0xf222('0xcd')](_0x32669f[_0x4fdcae],[_0xf222('0xd1'),_0xf222('0x1fe')]))[_0xf222('0xb9')](_0x3823d4[_0xf222('0x1e8')](_0x4d5f8a,_0x32669f[_0x4fdcae]))[_0xf222('0xb2')](_0x3823d4['loggerHandler']('[actionOriginateIvr]\x20',_0x4d5f8a));}}}})[_0xf222('0xb2')](loggerGetContactDialer('[getContactCampaign2]',_0x4d5f8a,_0x2e764e));}};Dialer[_0xf222('0x1b')][_0xf222('0x150')]=function(_0x5cd67b,_0x35cabe){var _0x1ad532=this;var _0x186231=[];var _0x386a97=_0x35cabe>=0x1?_0x35cabe:0x1;if(_0x5cd67b[_0xf222('0x14e')]===_0xf222('0x1e9')){_0x386a97=0x1;}var _0x473c58=Math[_0xf222('0x1c8')](_0x5cd67b['available']*_0x386a97)-_0x5cd67b[_0xf222('0x6f')]-_0x5cd67b[_0xf222('0xc3')];emitVoiceQueueSummary(_0x5cd67b);if(_0x5cd67b['dialLimitQueue']>0x0){var _0x4b0f0e=_0x5cd67b[_0xf222('0x1ff')]-_0x5cd67b[_0xf222('0x6f')]-_0x5cd67b[_0xf222('0xa1')]-_0x5cd67b[_0xf222('0xc3')]-_0x5cd67b[_0xf222('0x53')];if(_0x473c58>_0x4b0f0e){_0x473c58=_0x4b0f0e;}}if(_0x473c58>0x0){if(_0x5cd67b[_0xf222('0x14e')]===_0xf222('0x1e9')){_0x473c58=0x1;}if(_0x473c58>this[_0xf222('0x24')]){_0x473c58=this['maxNumberOriginate'];}_0x5cd67b[_0xf222('0xc3')]+=_0x473c58;for(var _0x23b38c in this[_0xf222('0x22')]){if(typeof this[_0xf222('0x22')][_0x23b38c]!=='undefined'){if(this[_0xf222('0x22')][_0x23b38c][_0xf222('0xa8')]==='not_inuse'&&this[_0xf222('0x22')][_0x23b38c][_0xf222('0xd7')]==='reachable'){_0x186231[_0xf222('0x123')](this[_0xf222('0x22')][_0x23b38c]['id']);}}}this[_0xf222('0xc2')](_0x5cd67b['id'],_0x186231,_0x473c58,_0x5cd67b[_0xf222('0x200')],_0x5cd67b)[_0xf222('0xb9')](function(_0x1bdee1){_0x5cd67b['temp']-=_0x473c58;_0x5cd67b[_0xf222('0xc3')]=_0x5cd67b['temp']>0x0?_0x5cd67b[_0xf222('0xc3')]:0x0;if(!checkContactEmpty(_0x1bdee1)){_0x1ad532[_0xf222('0xba')](_0x5cd67b)[_0xf222('0xb9')](sendMessageReschedule(_0x5cd67b))[_0xf222('0xb2')](loggerCatch(_0xf222('0xbb')));}else{_0x5cd67b[_0xf222('0x6f')]+=_0x1bdee1[_0xf222('0x99')];_0x5cd67b[_0xf222('0x41')]=_0x5cd67b['dialMethod']===_0xf222('0x1e9')?'ACTIVE':_0xf222('0x1fc');for(var _0x227bb1=0x0;_0x227bb1<_0x1bdee1[_0xf222('0x99')];_0x227bb1+=0x1){if(_['isNil'](_0x1bdee1[_0x227bb1])||_['isNil'](_0x1bdee1[_0x227bb1][_0xf222('0x161')])||_['isNil'](_0x1bdee1[_0x227bb1][_0xf222('0x161')][_0xf222('0x162')])){_0x1ad532['emptyContact'](_0xf222('0x201'),_0x5cd67b,_0x1bdee1[_0x227bb1]);}else{_0x1ad532['checkIsBlackList'](_['pick'](_0x1bdee1[_0x227bb1],[_0xf222('0xfa'),_0xf222('0x1fe')]))[_0xf222('0xb9')](_0x1ad532[_0xf222('0x1e8')](_0x5cd67b,_0x1bdee1[_0x227bb1]))[_0xf222('0xb2')](_0x1ad532[_0xf222('0x202')](_0xf222('0x201'),_0x5cd67b));}}}})[_0xf222('0xb2')](loggerGetContactDialer(_0xf222('0x203'),_0x5cd67b,_0x473c58));}};Dialer[_0xf222('0x1b')][_0xf222('0x90')]=function(_0x2273cb){if(_0x2273cb[_0xf222('0x1ff')]>0x0){var _0x40bf6a=_0x2273cb[_0xf222('0x1ff')]-_0x2273cb['originated']-_0x2273cb[_0xf222('0xa1')];if(_0x40bf6a>0x0){this[_0xf222('0x204')](_0x2273cb);}else{loggerPredictiveCalls['info'](_0xf222('0x205'));}}else{this['tryOriginatePredictive'](_0x2273cb);}};Dialer['prototype'][_0xf222('0x204')]=function(_0x2ec73a){var _0x41411b=this;var _0x39b3f7=[];_0x2ec73a[_0xf222('0x6f')]+=0x1;for(var _0x3ded75 in this['agents']){if(typeof this['agents'][_0x3ded75]!==_0xf222('0xae')){if(this['agents'][_0x3ded75][_0xf222('0xa8')]===_0xf222('0x206')&&this[_0xf222('0x22')][_0x3ded75][_0xf222('0xd7')]===_0xf222('0xd8')){_0x39b3f7[_0xf222('0x123')](this['agents'][_0x3ded75]['id']);}}}this['getContactDialer'](_0x2ec73a['id'],_0x39b3f7,0x1,_0x2ec73a[_0xf222('0x200')],_0x2ec73a)[_0xf222('0xb9')](function(_0x3038e9){if(!checkContactEmpty(_0x3038e9)){checkContactLowerLimitOriginate(_0x2ec73a,0x1,0x0);_0x41411b[_0xf222('0xba')](_0x2ec73a)[_0xf222('0xb9')](sendMessageReschedule(_0x2ec73a))[_0xf222('0xb2')](loggerCatch(_0xf222('0xbb')));}else{_0x2ec73a[_0xf222('0x41')]='RUNNING';if(_[_0xf222('0xaf')](_0x3038e9[0x0])||_[_0xf222('0xaf')](_0x3038e9[0x0][_0xf222('0x161')])||_['isNil'](_0x3038e9[0x0][_0xf222('0x161')][_0xf222('0x162')])){_0x41411b[_0xf222('0xca')](_0xf222('0x201'),_0x2ec73a,_0x3038e9[0x0]);}else{_0x41411b[_0xf222('0xbc')](_[_0xf222('0xcd')](_0x3038e9[0x0],[_0xf222('0xfa'),_0xf222('0x1fe')]))[_0xf222('0xb9')](_0x41411b['checkContactBlack'](_0x2ec73a,_0x3038e9[0x0]))[_0xf222('0xb2')](_0x41411b[_0xf222('0x202')]('[actionOriginatePredictive]\x20',_0x2ec73a));}}})[_0xf222('0xb2')](loggerGetContactDialer(_0xf222('0x207'),_0x2ec73a,0x1));emitVoiceQueueSummary(_0x2ec73a);};Dialer[_0xf222('0x1b')]['abandonmentRate']=function(_0xecffac,_0x4b6820,_0x3760e8,_0x11d20f,_0x5734b0,_0x1936b7){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xf222('0x7b')]('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',_0xecffac);loggerPredictive[_0xf222('0x7b')](_0xf222('0x208'),_0x4b6820);loggerPredictive[_0xf222('0x7b')]('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',_0x3760e8);loggerPredictive[_0xf222('0x7b')](_0xf222('0x209'),_0x11d20f);loggerPredictive[_0xf222('0x7b')](_0xf222('0x20a'),_0x5734b0);loggerPredictive[_0xf222('0x7b')]('---------------------------');return new BPromise(function(_0x12b1bd,_0x261496){if(_0xecffac<=0x0||isNaN(_0xecffac)){return _0x261496(msgResponse(_0xf222('0x20b'),_0xf222('0x4a'),_0xf222('0x20c')+_0xecffac));}if(_0x3760e8<=0x0||isNaN(_0x3760e8)){return _0x261496(msgResponse(_0xf222('0x20b'),'Error',_0xf222('0x20d')+_0x3760e8));}if(_0x11d20f<=0x0||isNaN(_0x11d20f)){return _0x261496(msgResponse(_0xf222('0x20b'),'Error',_0xf222('0x20e')+_0x11d20f));}if(_0x4b6820<=0x0||isNaN(_0x4b6820)){return _0x261496(msgResponse(_0xf222('0x20b'),'Error','interval\x20=\x20'+_0x4b6820));}if(_0x5734b0<=0x0||isNaN(_0x5734b0)){return _0x261496(msgResponse(_0xf222('0x20b'),_0xf222('0x4a'),_0xf222('0x20f')+_0x5734b0));}_0x1936b7=_0x1936b7||0x0;var _0x2a055b=0x1/_0x3760e8;var _0xe4c4e0=0x0;var _0x1adc68=0x0;var _0x128cd1=0x0;var _0x5a9ac3=0x0;for(var _0x5d340f=0x0;_0x128cd1<_0x5734b0;_0x5d340f+=0x1){_0x1adc68=_0x5d340f/_0x4b6820;_0xe4c4e0=(_0x11d20f*_0x1adc68+_0x1936b7)/_0x2a055b;_0x128cd1=erlangb(_0xe4c4e0,_0xecffac);_0x5a9ac3=_0xe4c4e0/_0xecffac*(0x1-erlangb(_0xe4c4e0,_0xecffac));}return _0x12b1bd({'erlangCalls':_0x5d340f,'erlangCallToSecond':_0x4b6820/_0x5d340f,'erlangAbandonmentRate':_0x128cd1,'erlangBusyFactor':_0x5a9ac3});});};Dialer[_0xf222('0x1b')][_0xf222('0x1de')]=function(_0x2dc985,_0x145ac7,_0x4f51d3,_0x360bc6,_0x33088f,_0x6c0104){loggerPredictive[_0xf222('0x7b')](_0xf222('0x210'));loggerPredictive[_0xf222('0x7b')]('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',_0x2dc985);loggerPredictive[_0xf222('0x7b')](_0xf222('0x208'),_0x145ac7);loggerPredictive[_0xf222('0x7b')]('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',_0x4f51d3);loggerPredictive[_0xf222('0x7b')](_0xf222('0x209'),_0x360bc6);loggerPredictive[_0xf222('0x7b')](_0xf222('0x211'),_0x33088f);loggerPredictive[_0xf222('0x7b')](_0xf222('0x83'));return new BPromise(function(_0x446c51,_0x38dd3d){if(_0x2dc985<=0x0||isNaN(_0x2dc985)){return _0x38dd3d(msgResponse(_0xf222('0x212'),_0xf222('0x4a'),'m\x20=\x20'+_0x2dc985));}if(_0x4f51d3<=0x0||isNaN(_0x4f51d3)){return _0x38dd3d(msgResponse(_0xf222('0x212'),_0xf222('0x4a'),_0xf222('0x20d')+_0x4f51d3));}if(_0x360bc6<=0x0||isNaN(_0x360bc6)){return _0x38dd3d(msgResponse(_0xf222('0x212'),_0xf222('0x4a'),'p\x20=\x20'+_0x360bc6));}if(_0x145ac7<=0x0||isNaN(_0x145ac7)){return _0x38dd3d(msgResponse('[busyFactor]',_0xf222('0x4a'),_0xf222('0x213')+_0x145ac7));}if(_0x33088f<=0x0||isNaN(_0x33088f)){return _0x38dd3d(msgResponse(_0xf222('0x212'),_0xf222('0x4a'),'Umin\x20=\x20'+_0x33088f));}_0x6c0104=_0x6c0104||0x0;var _0x404eee=0x1/_0x4f51d3;var _0x24ebea=0x0;var _0x2ae8e8=0x0;var _0x3eca4f=0x0;var _0xec8be2=0x0;for(var _0xbbc3d6=0x0;_0xec8be2<_0x33088f;_0xbbc3d6+=0x1){_0x2ae8e8=_0xbbc3d6/_0x145ac7;_0x24ebea=(_0x360bc6*_0x2ae8e8+_0x6c0104)/_0x404eee;_0x3eca4f=erlangb(_0x24ebea,_0x2dc985);_0xec8be2=_0x24ebea/_0x2dc985*(0x1-erlangb(_0x24ebea,_0x2dc985));}return _0x446c51({'erlangCalls':_0xbbc3d6,'erlangCallToSecond':_0x145ac7/_0xbbc3d6,'erlangAbandonmentRate':_0x3eca4f,'erlangBusyFactor':_0xec8be2});});};module[_0xf222('0x214')]=Dialer; \ No newline at end of file +var _0xa25c=['VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','emit','amd','[syncHangupInAMD][createHistory]','MACHINE','AMD','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','Machine','countglobal','custom:amd','stateGlobal','add','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','[booked][RR]','contactAgent-idHopper:\x20','unlockRR','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','true','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialTimezone','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','dialPrefix','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','entity\x20is\x20undefine','[callProgressDetecting]','NoSuchNumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','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','reason','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','./action','./history','./final','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','type','ivr','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','actions','[actions]','isNil','Action','status','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId'];(function(_0x1b1cb1,_0x3f5dc5){var _0x1bec98=function(_0x57c0e7){while(--_0x57c0e7){_0x1b1cb1['push'](_0x1b1cb1['shift']());}};_0x1bec98(++_0x3f5dc5);}(_0xa25c,0x13f));var _0xca25=function(_0x9077a4,_0x41748c){_0x9077a4=_0x9077a4-0x0;var _0x204bdc=_0xa25c[_0x9077a4];return _0x204bdc;};'use strict';var util=require('util');var _=require(_0xca25('0x0'));var BPromise=require(_0xca25('0x1'));var uuid=require(_0xca25('0x2'));var moment=require(_0xca25('0x3'));var rr=require('rr');var md5=require(_0xca25('0x4'));var Redis=require(_0xca25('0x5'));var ut=require(_0xca25('0x6'));var config=require(_0xca25('0x7'));var logger=require('../../../config/logger')(_0xca25('0x8'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0xca25('0x9'))('predictive');var loggerPredictiveCalls=require(_0xca25('0x9'))(_0xca25('0xa'));var loggerSyncQueueSummary=require(_0xca25('0x9'))(_0xca25('0xb'));var ami=require(_0xca25('0xc'));config['redis']=_['defaults'](config[_0xca25('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xca25('0xe'))(new Redis(config[_0xca25('0xd')]));var cmHopper=require(_0xca25('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xca25('0x10'));var History=require(_0xca25('0x11'));var Final=require(_0xca25('0x12'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xca25('0x13'));var ipAgi=process['env'][_0xca25('0x14')]||_0xca25('0x15');var strategy={'rrmemory':_0xca25('0x16'),'roundrobin':_0xca25('0x17')};var Sequence=function(){};Sequence[_0xca25('0x18')][_0xca25('0x19')]=function(_0x241b80){this[_0xca25('0x1a')]=this[_0xca25('0x1a')]?this[_0xca25('0x1a')][_0xca25('0x1b')](_0x241b80):_0x241b80();};function Dialer(_0x587403,_0x3616c3){this[_0xca25('0x1c')]=new Sequence();this['preview']=_0x3616c3;this[_0xca25('0x1d')]=_0x587403[_0xca25('0x1d')];this[_0xca25('0x1e')]=_0x587403[_0xca25('0x1e')];this[_0xca25('0x1f')]=_0x587403['agents'];this[_0xca25('0x20')]=_0x587403[_0xca25('0x20')];this[_0xca25('0x21')]=config[_0xca25('0x21')]||0x2;this[_0xca25('0x22')]={};this['actions']={};this[_0xca25('0x23')]={};this[_0xca25('0x24')]={};this[_0xca25('0x25')]={};this[_0xca25('0x26')]={};this[_0xca25('0x27')]={};this[_0xca25('0x28')]={};this[_0xca25('0x29')]={};this['queueBookedRR']={};ami['on'](_0xca25('0x2a'),this[_0xca25('0x2b')][_0xca25('0x2c')](this));ami['on'](_0xca25('0x2d'),this[_0xca25('0x2e')][_0xca25('0x2c')](this));ami['on'](_0xca25('0x2f'),this[_0xca25('0x30')][_0xca25('0x2c')](this));ami['on'](_0xca25('0x31'),this[_0xca25('0x32')][_0xca25('0x2c')](this));ami['on'](_0xca25('0x33'),this['syncQueueSummary'][_0xca25('0x2c')](this));ami['on'](_0xca25('0x34'),this[_0xca25('0x35')][_0xca25('0x2c')](this));ami['on'](_0xca25('0x36'),this['syncNewExten'][_0xca25('0x2c')](this));ami['on'](_0xca25('0x37'),this[_0xca25('0x38')][_0xca25('0x2c')](this));ami['on'](_0xca25('0x39'),this[_0xca25('0x3a')][_0xca25('0x2c')](this));ami['on'](_0xca25('0x3b'),this[_0xca25('0x3c')][_0xca25('0x2c')](this));this[_0xca25('0x3d')]();this[_0xca25('0x3e')]();}function isNotNull(_0x5078e4){return _0x5078e4!==null&&!_[_0xca25('0x3f')](_0x5078e4);}function checkIsLoggedIn(_0x455df1,_0x2433bb){return function(){if(_0x2433bb<=0x0){_0x455df1[_0xca25('0x40')]=_0xca25('0x41');throw _0x455df1['name']+_0xca25('0x42');}};}function isActive(_0x2135ee){return _0x2135ee;}function checkIsActive(_0x26208e,_0x566090){return function(){if(!isActive(_0x566090)){_0x26208e[_0xca25('0x40')]=_0xca25('0x43');throw _0x26208e[_0xca25('0x44')]+_0xca25('0x45');}};}function checkInterval(_0x2c863b){return function(){if(!isNotNull(_0x2c863b[_0xca25('0x46')])){_0x2c863b['message']=_0xca25('0x47');throw _0x2c863b['name']+_0xca25('0x48');}if(!isNotNull(_0x2c863b[_0xca25('0x46')][_0xca25('0x49')])){_0x2c863b['message']=_0xca25('0x47');throw _0x2c863b[_0xca25('0x44')]+_0xca25('0x48');}if(!isNotNull(_[_0xca25('0x4a')](_0x2c863b[_0xca25('0x46')]['Intervals']))){_0x2c863b[_0xca25('0x40')]=_0xca25('0x47');throw _0x2c863b[_0xca25('0x44')]+_0xca25('0x48');}};}function msgResponse(_0x29d1a0,_0x10874c,_0x3c055d){return{'action':_0x29d1a0,'response':_0x10874c,'message':_0x3c055d,'stack':_0x3c055d};}function myreject(_0x5e2d38){return function(_0x5190d0){return _0x5e2d38(msgResponse(_0xca25('0x4b'),_0xca25('0x4c'),JSON['stringify'](_0x5190d0)));};}function getSeconds(_0x57c462,_0x7d57bd){var _0x3c51a3=moment(_0x57c462)[_0xca25('0x4d')](0x0);var _0x5f44cb=moment(_0x7d57bd)[_0xca25('0x4d')](0x0);return _0x3c51a3[_0xca25('0x4e')](_0x5f44cb,_0xca25('0x4f'));}function emit(_0x1dc9ca,_0xf2ae8d,_0xd1d480){io['to'](_0x1dc9ca)['emit'](_0xf2ae8d,_0xd1d480);}function emitVoiceQueueSummary(_0x290537){if(_0x290537['type']===_0xca25('0x50')){var _0x25880f={'id':_0x290537['id'],'name':_0x290537[_0xca25('0x44')],'strategy':_0x290537[_0xca25('0x51')],'answered':_0x290537[_0xca25('0x52')],'available':_0x290537[_0xca25('0x53')],'loggedIn':_0x290537[_0xca25('0x54')],'pTalking':_0x290537[_0xca25('0x55')],'sumBillable':_0x290537[_0xca25('0x56')],'sumDuration':_0x290537['sumDuration'],'sumHoldTime':_0x290537[_0xca25('0x57')]||0x0,'talking':_0x290537['talking'],'total':_0x290537[_0xca25('0x58')],'type':_0x290537['type'],'unmanaged':_0x290537[_0xca25('0x59')],'abandoned':_0x290537[_0xca25('0x5a')],'waiting':_0x290537[_0xca25('0x5b')],'loggedInDb':_0x290537[_0xca25('0x5c')],'dialActive':_0x290537['dialActive'],'dialMethod':_0x290537[_0xca25('0x5d')],'dialOriginateCallerIdName':_0x290537['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x290537[_0xca25('0x5e')],'dialOriginateTimeout':_0x290537[_0xca25('0x5f')],'dialPrefix':_0x290537['dialPrefix'],'outboundAnswerAgiCallsDay':_0x290537[_0xca25('0x60')],'outboundAnswerCallsDay':_0x290537[_0xca25('0x61')],'outboundBlacklistCallsDay':_0x290537[_0xca25('0x62')],'outboundBusyCallsDay':_0x290537[_0xca25('0x63')],'outboundCongestionCallsDay':_0x290537[_0xca25('0x64')],'outboundDropCallsDayACS':_0x290537[_0xca25('0x65')],'outboundDropCallsDayCallersExit':_0x290537[_0xca25('0x66')],'outboundDropCallsDayTimeout':_0x290537['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x290537[_0xca25('0x67')],'outboundNoSuchCallsDay':_0x290537[_0xca25('0x68')],'outboundOriginateFailureCallsDay':_0x290537['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x290537['outboundReCallsDay'],'outboundRejectCallsDay':_0x290537['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x290537['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x290537[_0xca25('0x69')],'predictiveIntervalAvgHoldtime':_0x290537[_0xca25('0x6a')],'predictiveIntervalAvgTalktime':_0x290537[_0xca25('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x290537[_0xca25('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x290537['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x290537[_0xca25('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x290537[_0xca25('0x6e')],'predictiveIntervalHitRate':_0x290537[_0xca25('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x290537[_0xca25('0x70')],'predictiveIntervalPauses':_0x290537['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x290537[_0xca25('0x71')],'predictiveIntervalTotalCalls':_0x290537['predictiveIntervalTotalCalls'],'message':_0x290537[_0xca25('0x40')],'originated':_0x290537[_0xca25('0x72')],'erlangCalls':_0x290537[_0xca25('0x73')],'erlangCallToSecond':_0x290537[_0xca25('0x74')],'erlangAbandonmentRate':_0x290537[_0xca25('0x75')],'erlangBusyFactor':_0x290537[_0xca25('0x76')],'startPredictive':_0x290537['startPredictive'],'startProgressive':_0x290537[_0xca25('0x27')]};if(_0x290537[_0xca25('0x77')]){_0x25880f[_0xca25('0x77')]={'id':_0x290537[_0xca25('0x77')]['id'],'name':_0x290537[_0xca25('0x77')][_0xca25('0x44')],'active':_0x290537[_0xca25('0x77')][_0xca25('0x78')],'callerid':_0x290537[_0xca25('0x77')][_0xca25('0x79')]};}if(_0x290537[_0xca25('0x46')]){_0x25880f[_0xca25('0x46')]={'id':_0x290537[_0xca25('0x46')]['id'],'name':_0x290537[_0xca25('0x46')][_0xca25('0x44')]};}var _0x1fba32=md5(JSON[_0xca25('0x7a')](_0x25880f));if(_0x290537[_0xca25('0x4')]!==_0x1fba32){_0x290537['md5']=_0x1fba32;emit(util[_0xca25('0x7b')](_0xca25('0x7c'),_0x25880f[_0xca25('0x44')]),_0xca25('0x7d'),_0x25880f);}}}function emitCampaignSummary(_0x5088c5){if(_0x5088c5[_0xca25('0x7e')]===_0xca25('0x7f')){emit(util['format'](_0xca25('0x80'),_0x5088c5[_0xca25('0x44')]),_0xca25('0x81'),_0x5088c5);}}function checkGetDataPredictive(_0x137d2a){if(isNotNull(_0x137d2a)&&!_['isEmpty'](_0x137d2a)){loggerPredictive[_0xca25('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xca25('0x82')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x137d2a['predictiveIntervalTotalCalls']);loggerPredictive[_0xca25('0x82')](_0xca25('0x83'),_0x137d2a[_0xca25('0x69')]);loggerPredictive[_0xca25('0x82')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x137d2a['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xca25('0x82')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x137d2a[_0xca25('0x6c')]);loggerPredictive[_0xca25('0x82')](_0xca25('0x84'),_0x137d2a[_0xca25('0x6a')]);loggerPredictive[_0xca25('0x82')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x137d2a['predictiveIntervalAvgTalktime']);loggerPredictive[_0xca25('0x82')](_0xca25('0x85'));if(_0x137d2a[_0xca25('0x86')]>0x0){if(!_[_0xca25('0x3f')](_0x137d2a[_0xca25('0x6b')])&&_0x137d2a[_0xca25('0x6b')]>0x0){return!![];}loggerPredictive['info'](_0xca25('0x87'));if(!_[_0xca25('0x3f')](_0x137d2a[_0xca25('0x6a')])&&_0x137d2a[_0xca25('0x6a')]>0x0){return!![];}loggerPredictive[_0xca25('0x82')](_0xca25('0x88'));}else{loggerPredictive[_0xca25('0x82')](_0xca25('0x89'));}}else{loggerPredictive[_0xca25('0x82')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x25c761){return function(_0x3f4177){loggerPredictive[_0xca25('0x82')](_0xca25('0x8a'));loggerPredictive[_0xca25('0x82')](_0xca25('0x8b'),_0x3f4177[_0xca25('0x73')]);loggerPredictive[_0xca25('0x82')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f4177[_0xca25('0x74')]);loggerPredictive['info'](_0xca25('0x8c'),_0x3f4177[_0xca25('0x75')]);loggerPredictive[_0xca25('0x82')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f4177['erlangBusyFactor']);loggerPredictive['info'](_0xca25('0x8c'),_0x3f4177[_0xca25('0x75')]);loggerPredictive[_0xca25('0x82')](_0xca25('0x85'));_[_0xca25('0x8d')](_0x25c761,_0x3f4177);};}function getDiff(_0x3d1bed){var _0x2f3025=moment()[_0xca25('0x4d')](0x0);var _0x5ced12=moment(_0x3d1bed)[_0xca25('0x4d')](0x0);return _0x2f3025['diff'](_0x5ced12,'seconds');}function ifInterval(_0x59629d,_0x1dce0b){if(_[_0xca25('0x3f')](_0x1dce0b)){return![];}return getDiff(_0x1dce0b)<_0x59629d*0x3c;}function freeVariablesPredictive(_0x42e898){if(isNotNull(_0x42e898)){if(!_[_0xca25('0x3f')](_0x42e898[_0xca25('0x27')])){_0x42e898[_0xca25('0x27')]=undefined;loggerPredictive['info'](_0x42e898[_0xca25('0x44')],_0xca25('0x8e'));}if(!_['isUndefined'](_0x42e898[_0xca25('0x26')])){_0x42e898['startPredictive']=undefined;loggerPredictive[_0xca25('0x82')](_0x42e898['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xca25('0x3f')](_0x42e898[_0xca25('0x8f')])){clearInterval(_0x42e898['handlePredictive']);_0x42e898['handlePredictive']=undefined;loggerPredictive['info'](_0x42e898['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x27e4b3,_0xe28b0){if(_0xe28b0===0x0){return 0x0;}var _0x4b3af2=0x1;for(var _0x52f3b5=0x1;_0x52f3b5<=_0xe28b0;_0x52f3b5+=0x1){_0x4b3af2=0x1+_0x4b3af2*_0x52f3b5/_0x27e4b3;}return 0x1/_0x4b3af2;}function isVoiceQueueOutbound(_0x58cc83){return _0x58cc83==='outbound';}function isNotPreview(_0x3ffe5b){return _0x3ffe5b!=='preview';}function isCampaignIvr(_0x4cc0b3){return _0x4cc0b3===_0xca25('0x7f');}function getCallerId(_0x383941,_0x29f7c3,_0x32e3f5){if(!_['isUndefined'](_0x32e3f5)&&typeof _0x32e3f5==='string'&&!_[_0xca25('0x4a')](_0x32e3f5)){if(!_['isUndefined'](_0x29f7c3)&&typeof _0x29f7c3===_0xca25('0x90')&&!_[_0xca25('0x4a')](_0x29f7c3)){return util['format'](_0xca25('0x91'),_0x29f7c3,_0x32e3f5);}return util[_0xca25('0x7b')](_0xca25('0x91'),_0x32e3f5,_0x32e3f5);}if(!_[_0xca25('0x3f')](_0x383941)&&typeof _0x383941===_0xca25('0x90')&&!_[_0xca25('0x4a')](_0x383941)){return _0x383941;}return _0xca25('0x92');}function loggerCatchQueueSummary(_0x3dfbd8,_0x30dcd2){return function(_0x592bce){freeVariablesPredictive(_0x30dcd2);emitVoiceQueueSummary(_0x30dcd2);emitCampaignSummary(_0x30dcd2);loggerSyncQueueSummary[_0xca25('0x93')](_0x3dfbd8,util[_0xca25('0x94')](_0x592bce,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x49d4bc,_0x318083){return function(_0x31ae9b){loggerPredictive[_0xca25('0x93')](_0x318083[_0xca25('0x44')],_0x49d4bc);loggerPredictive[_0xca25('0x93')](_0x31ae9b[_0xca25('0x95')]);freeVariablesPredictive(_0x318083);};}function loggerCatch(_0x2ffeb0){return function(_0x270fea){logger['error'](_0x2ffeb0,util[_0xca25('0x94')](_0x270fea,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x531233){return _0x531233&&!_[_0xca25('0x3f')](_0x531233)&&_0x531233[_0xca25('0x96')]>0x0;}function decremetOriginate(_0x2f087a){if(!_[_0xca25('0x3f')](_0x2f087a)&&_0x2f087a!==null){if(typeof _0x2f087a[_0xca25('0x72')]!==_0xca25('0x97')){if(_0x2f087a['originated']>0x0){_0x2f087a[_0xca25('0x72')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xca25('0x93')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x44f460,_0x4c7e91,_0x23d12c){if(_0x4c7e91>_0x23d12c){for(var _0x398838=0x0;_0x398838<_0x4c7e91-_0x23d12c;_0x398838+=0x1){decremetOriginate(_0x44f460);}}}function loggerGetContactDialer(_0x334431,_0x2a8f1a,_0x2e5ff5){return function(_0x554f5b){checkContactLowerLimitOriginate(_0x2a8f1a,_0x2e5ff5,0x0);logger[_0xca25('0x93')](_0x334431,util[_0xca25('0x94')](_0x554f5b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4057af){return function(_0x842511){if(isNotNull(_0x842511)&&isNotNull(_0x842511[0x0])){if(_0x842511[0x0]['contactsRescheduled']>0x0){_0x4057af[_0xca25('0x40')]=_0xca25('0x98');logger[_0xca25('0x82')](_0xca25('0x99')+_0x4057af[_0xca25('0x44')],_0x842511[0x0][_0xca25('0x9a')],_0xca25('0x9b'));}else{_0x4057af[_0xca25('0x40')]=_0xca25('0x9c');logger[_0xca25('0x82')](_0xca25('0x9d')+_0x4057af[_0xca25('0x44')]);}}};}function notSendMessagesQueue(_0x525aec){if(_0x525aec[_0xca25('0x9e')]){freeVariablesPredictive(_0x525aec);if(_0x525aec[_0xca25('0x72')]===0x0&&_0x525aec[_0xca25('0x9f')]===0x0&&_0x525aec[_0xca25('0x5b')]===0x0&&(_0x525aec[_0xca25('0x55')]||0x0)===0x0){_0x525aec['sendMessageOneNotActive']=![];_0x525aec[_0xca25('0x53')]=0x0;_0x525aec[_0xca25('0x40')]=_0xca25('0x43');loggerSyncQueueSummary['error'](_0xca25('0xa0'),_0x525aec['name'],_0xca25('0xa1'));}else{_0x525aec[_0xca25('0x40')]=_0xca25('0xa2');loggerSyncQueueSummary['error'](_0xca25('0xa0'),_0x525aec['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x525aec);}}function notSendMessagesCampaign(_0x291856){if(_0x291856[_0xca25('0x9e')]){if(_0x291856[_0xca25('0x72')]===0x0){_0x291856[_0xca25('0x9e')]=![];_0x291856[_0xca25('0x40')]=_0xca25('0x43');loggerSyncQueueSummary[_0xca25('0x93')](_0xca25('0xa3'),_0x291856[_0xca25('0x44')],_0xca25('0xa1'));}else{_0x291856['message']=_0xca25('0xa2');loggerSyncQueueSummary[_0xca25('0x93')](_0xca25('0xa3'),_0x291856[_0xca25('0x44')],_0xca25('0xa4'));}emitCampaignSummary(_0x291856);}}function createObjHistory(_0x9f0069,_0xc39d8c,_0xf608a6,_0xc440d2,_0xeeb22){_0x9f0069['message']=_0xf608a6;var _0x38ecc2=new Action(_0x9f0069,_0xc39d8c);var _0x1204a0=new History(_0x38ecc2);_0x1204a0[_0xca25('0xa5')]=_0xc440d2;_0x1204a0[_0xca25('0xa6')]=_0xeeb22;_0x1204a0[_0xca25('0xa7')]=_0x38ecc2[_0xca25('0xa8')];return _0x1204a0;}Dialer[_0xca25('0x18')][_0xca25('0x3e')]=function(){var _0x2da377=this;setInterval(function(){_0x2da377['clearZombieChannels'](_0x2da377['uniqueId'],'[uniqueid]');_0x2da377[_0xca25('0xa9')](_0x2da377[_0xca25('0xaa')],_0xca25('0xab'));},0x32c8);};Dialer[_0xca25('0x18')][_0xca25('0xa9')]=function(_0x4adda1,_0x16770f){var _0x2346a3=this;for(var _0x1ea779 in _0x4adda1){if(typeof _0x4adda1[_0x1ea779]!==_0xca25('0x97')){this[_0xca25('0x1c')][_0xca25('0x19')](function(){if(!_[_0xca25('0xac')](_0x4adda1[_0x1ea779])){return ami[_0xca25('0xad')]({'action':_0xca25('0xae'),'channel':_0x4adda1[_0x1ea779]['channel']})['catch'](function(_0x2606ae){if(_0x2606ae[_0xca25('0x40')]===_0xca25('0xaf')){setTimeout(function(){if(_0x4adda1[_0x1ea779]&&_0x4adda1[_0x1ea779]['type']!==_0xca25('0x7f')){_0x2346a3[_0xca25('0xb0')](_0x2346a3[_0xca25('0x1d')][_0x4adda1[_0x1ea779]['queue']]);logger[_0xca25('0x93')](_0xca25('0xb1'),_0x16770f,_0x1ea779,_0x4adda1[_0x1ea779][_0xca25('0xb2')]);delete _0x4adda1[_0x1ea779];}if(_0x4adda1[_0x1ea779]&&_0x4adda1[_0x1ea779][_0xca25('0x7e')]===_0xca25('0x7f')){_0x2346a3[_0xca25('0xb0')](_0x2346a3['campaigns'][_0x4adda1[_0x1ea779][_0xca25('0xb2')]]);logger[_0xca25('0x93')](_0xca25('0xb3'),_0x16770f,_0x1ea779,_0x4adda1[_0x1ea779][_0xca25('0xb2')]);delete _0x4adda1[_0x1ea779];}},0x2328);}});}});}}};Dialer[_0xca25('0x18')][_0xca25('0xb4')]=function(_0x38b901){return BPromise[_0xca25('0xb5')]()[_0xca25('0xb6')](cmHopper[_0xca25('0xb4')](_0x38b901))[_0xca25('0xb7')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xca25('0x18')][_0xca25('0xb8')]=function(_0x153ac8){return BPromise['resolve']()[_0xca25('0xb6')](cmHopperBlack[_0xca25('0xb8')](_0x153ac8))[_0xca25('0xb7')](loggerCatch(_0xca25('0xb9')));};Dialer[_0xca25('0x18')][_0xca25('0xba')]=function(_0x4894b2){return BPromise[_0xca25('0xb5')]()[_0xca25('0xb6')](cmHopperBlack[_0xca25('0xba')](_0x4894b2))['catch'](loggerCatch(_0xca25('0xbb')));};Dialer[_0xca25('0x18')][_0xca25('0xbc')]=function(_0x1593d9){return BPromise[_0xca25('0xb5')]()[_0xca25('0xb6')](cmHopperHistory['avgHandleTime'](_0x1593d9))[_0xca25('0xb7')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xca25('0x18')]['rescheduleContact']=function(_0x4f6206){return BPromise[_0xca25('0xb5')]()['then'](cmHopper[_0xca25('0xbd')](_0x4f6206))[_0xca25('0xb7')](loggerCatch(_0xca25('0xbe')));};Dialer[_0xca25('0x18')][_0xca25('0xbf')]=function(_0xb1e7f6,_0x1ebd2e,_0x316022){return BPromise['resolve']()[_0xca25('0xb6')](cmHopper[_0xca25('0xbf')](_0xb1e7f6,_0x1ebd2e,_0x316022))[_0xca25('0xb7')](loggerCatch(_0xca25('0xc0')));};Dialer[_0xca25('0x18')]['getContactDialer']=function(_0x515bb2,_0x5cae7f,_0x15b47a,_0x504cb5,_0xf302aa){return BPromise[_0xca25('0xb5')]()['then'](cmHopper[_0xca25('0xc1')](_0x515bb2,_0x5cae7f,_0x15b47a,_0x504cb5))['catch'](function(_0x30811c){_0xf302aa[_0xca25('0xc2')]-=_0x15b47a;_0xf302aa['temp']=_0xf302aa[_0xca25('0xc2')]>0x0?_0xf302aa[_0xca25('0xc2')]:0x0;loggerCatch(_0xca25('0xc3'))(_0x30811c);});};Dialer[_0xca25('0x18')][_0xca25('0xc4')]=function(_0x1235ea,_0x1e3d5f,_0x1a9197,_0x570060){return BPromise[_0xca25('0xb5')]()[_0xca25('0xb6')](cmHopper['getContactDialerIvr'](_0x1235ea,_0x1e3d5f,_0x1a9197))[_0xca25('0xb7')](function(_0x4b388a){_0x570060['temp']-=_0x1e3d5f;_0x570060[_0xca25('0xc2')]=_0x570060[_0xca25('0xc2')]>0x0?_0x570060[_0xca25('0xc2')]:0x0;loggerCatch(_0xca25('0xc5'))(_0x4b388a);});};Dialer['prototype'][_0xca25('0xc6')]=function(_0xfe531e){return BPromise[_0xca25('0xb5')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0xfe531e))[_0xca25('0xb7')](loggerCatch(_0xca25('0xc7')));};Dialer[_0xca25('0x18')]['moveContactManagedDialer']=function(_0xca1350){return BPromise['resolve']()[_0xca25('0xb6')](cmHopper[_0xca25('0xc8')](_0xca1350))['catch'](loggerCatch(_0xca25('0xc9')));};Dialer['prototype'][_0xca25('0xca')]=function(_0x9c5467){return BPromise[_0xca25('0xb5')]()[_0xca25('0xb6')](cmHopperHistory[_0xca25('0xca')](_0x9c5467))[_0xca25('0xb7')](loggerCatch(_0xca25('0xcb')));};Dialer[_0xca25('0x18')][_0xca25('0xb0')]=function(_0x2e4593){if(!_['isUndefined'](_0x2e4593)&&_0x2e4593!==null){if(typeof _0x2e4593['originated']!==_0xca25('0x97')){if(_0x2e4593['originated']>0x0){_0x2e4593[_0xca25('0x72')]-=0x1;}else{logger[_0xca25('0x93')](_0xca25('0xcc'));}}}else{logger[_0xca25('0x93')](_0xca25('0xcd'));}};Dialer[_0xca25('0x18')][_0xca25('0xce')]=function(_0x21e70c,_0x234a89){var _0x1f52c3=this;return function(_0x4ba4ff){_0x1f52c3[_0xca25('0xb0')](_0x234a89);logger['error'](_0x21e70c,util[_0xca25('0x94')](_0x4ba4ff,{'showHidden':![],'depth':null}));};};Dialer[_0xca25('0x18')][_0xca25('0xcf')]=function(_0x3e7435,_0x1117b6,_0x49d2b9){var _0x3adb5c={'state':0x19,'statedesc':_0xca25('0xd0')};this['updateOriginated'](_0x1117b6);this[_0xca25('0xd1')](_[_0xca25('0x8d')](_0x3adb5c,_[_0xca25('0xd2')](_0x49d2b9,[_0xca25('0xd3'),_0xca25('0xd4'),_0xca25('0xd5'),_0xca25('0xd6'),_0xca25('0xd7')])),_0xca25('0xd8'),_0xca25('0xd9'));logger[_0xca25('0x93')](_0x3e7435);};Dialer['prototype'][_0xca25('0xda')]=function(_0x2df298){return _0x2df298===_0xca25('0xdb');};Dialer['prototype'][_0xca25('0xdc')]=function(_0x4e0825){return!_[_0xca25('0x3f')](_0x4e0825)&&_0x4e0825&&!_[_0xca25('0x3f')](_0x4e0825[_0xca25('0x44')])&&!_[_0xca25('0x3f')](_0x4e0825[_0xca25('0x78')])&&_0x4e0825[_0xca25('0x78')]&&(this['trunks'][util['format']('SIP/%s',_0x4e0825[_0xca25('0x44')])]['status']==='reachable'||this[_0xca25('0x20')][util['format']('SIP/%s',_0x4e0825[_0xca25('0x44')])]['status']==='unmonitored');};Dialer[_0xca25('0x18')][_0xca25('0xd1')]=function(_0x3a3784,_0x3f6289,_0x597414){this[_0xca25('0xca')](_0x3a3784)[_0xca25('0xb7')](loggerCatch(_0x3f6289));this['moveContactManagedDialer'](_0x3a3784)['catch'](loggerCatch(_0x597414));};Dialer[_0xca25('0x18')][_0xca25('0x38')]=function(_0x555a4a){var _0x2172cb=this[_0xca25('0x24')][_0x555a4a['uniqueid']];var _0x7aacc;if(!_[_0xca25('0xac')](_0x555a4a)&&!_['isNil'](_0x555a4a[_0xca25('0xdd')])&&!_[_0xca25('0xac')](_0x555a4a[_0xca25('0xdd')][_0xca25('0xde')])&&_0x555a4a['exten']===_0xca25('0xdf')&&_0x2172cb){if(_0x2172cb[_0xca25('0x7e')]!=='ivr'&&this[_0xca25('0x1d')][_0x2172cb['queue']][_0xca25('0xe0')]&&_0x555a4a[_0xca25('0xe1')]===_0xca25('0xe2')){delete this[_0xca25('0x24')][_0x555a4a[_0xca25('0xe3')]];this[_0xca25('0xb0')](this[_0xca25('0x1d')][_0x2172cb[_0xca25('0xb2')]]);this[_0xca25('0x1d')][_0x2172cb['queue']][_0xca25('0x61')]+=0x1;this[_0xca25('0x1d')][_0x2172cb[_0xca25('0xb2')]][_0xca25('0x60')]+=0x1;_0x7aacc=new Hangup(_0x2172cb,_0x555a4a);_0x7aacc[_0xca25('0xa5')]=0x12;_0x7aacc[_0xca25('0xa6')]=_0xca25('0xe4');_0x7aacc[_0xca25('0xe5')]='AMD';ami[_0xca25('0xe6')]('custom:amd',ut['buildObj'](_0x7aacc,_0xca25('0xe7')));this[_0xca25('0xd1')](_0x7aacc,_0xca25('0xe8'),'[syncHangupInAMD]');}if(_0x2172cb[_0xca25('0x7e')]!==_0xca25('0x7f')&&this[_0xca25('0x1d')][_0x2172cb[_0xca25('0xb2')]][_0xca25('0xe0')]&&_0x555a4a[_0xca25('0xe1')]===_0xca25('0xe9')){var _0x50bfc6=this;return new BPromise(function(_0x5ee1ae,_0x5eb61a){delete _0x50bfc6[_0xca25('0x24')][_0x555a4a[_0xca25('0xe3')]];_0x50bfc6[_0xca25('0xb0')](_0x50bfc6[_0xca25('0x1d')][_0x2172cb[_0xca25('0xb2')]]);_0x50bfc6['voiceQueues'][_0x2172cb[_0xca25('0xb2')]][_0xca25('0x61')]+=0x1;_0x50bfc6['voiceQueues'][_0x2172cb[_0xca25('0xb2')]][_0xca25('0x60')]+=0x1;var _0xeaa7ca=_0x50bfc6[_0xca25('0x1d')][_0x2172cb[_0xca25('0xb2')]];var _0x151a0c=new Hangup(_0x2172cb,_0x555a4a);_0x151a0c['state']=0x13;_0x151a0c[_0xca25('0xa6')]='Machine';_0x151a0c[_0xca25('0xe5')]=_0xca25('0xea');_0x151a0c[_0xca25('0xeb')]+=0x1;_0x151a0c['countglobal']+=0x1;_0x151a0c['amd']=!![];ami[_0xca25('0xe6')]('custom:amd',ut[_0xca25('0xec')](_0x151a0c,_0xca25('0xe7')));_0x50bfc6[_0xca25('0xca')](_0x151a0c)[_0xca25('0xb7')](loggerCatch(_0xca25('0xed')));if(_0x151a0c[_0xca25('0xee')]+_0x151a0c[_0xca25('0xef')]+_0x151a0c[_0xca25('0xf0')]+_0x151a0c[_0xca25('0xf1')]+_0x151a0c[_0xca25('0xf2')]+_0x151a0c[_0xca25('0xf3')]+_0x151a0c[_0xca25('0xeb')]+_0x151a0c['countagentrejectretry']>=_0xeaa7ca[_0xca25('0xf4')]){_0x50bfc6['stateGlobal'](_0x151a0c,_0x5ee1ae,_0x5eb61a,_0xca25('0xf5'));}else{if(_0x151a0c[_0xca25('0xeb')]>=_0xeaa7ca[_0xca25('0xf6')]){_0x50bfc6[_0xca25('0xf7')](_0x151a0c,_0x5ee1ae,_0x5eb61a,_0xca25('0xf8'));}else{_0x50bfc6['rescheduleContact']({'active':![],'countmachineretry':_0x151a0c[_0xca25('0xeb')],'scheduledat':moment()['add'](_0xeaa7ca[_0xca25('0xf9')],_0xca25('0xfa'))[_0xca25('0x7b')](_0xca25('0xfb')),'ContactId':_0x151a0c['ContactId'],'ListId':_0x151a0c['ListId'],'VoiceQueueId':_0x151a0c[_0xca25('0xd6')]||undefined,'CampaignId':_0x151a0c[_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0xfc')));_0x5ee1ae({'reschedule':0x1});}}});}if(_0x2172cb[_0xca25('0x7e')]===_0xca25('0x7f')&&this[_0xca25('0x1e')][_0x2172cb[_0xca25('0xb2')]][_0xca25('0xe0')]&&_0x555a4a['value']==='HANGUP'){delete this[_0xca25('0x24')][_0x555a4a['uniqueid']];this[_0xca25('0xb0')](this[_0xca25('0x1e')][_0x2172cb[_0xca25('0xb2')]]);_0x7aacc=new Hangup(_0x2172cb,_0x555a4a);_0x7aacc['state']=0x12;_0x7aacc['statedesc']=_0xca25('0xe4');_0x7aacc[_0xca25('0xe5')]='AMD';ami[_0xca25('0xe6')]('custom:amd',ut[_0xca25('0xec')](_0x7aacc,'amd'));this[_0xca25('0xd1')](_0x7aacc,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x2172cb[_0xca25('0x7e')]===_0xca25('0x7f')&&this[_0xca25('0x1e')][_0x2172cb[_0xca25('0xb2')]][_0xca25('0xe0')]&&_0x555a4a[_0xca25('0xe1')]===_0xca25('0xe9')){var _0x50bfc6=this;return new BPromise(function(_0x2302ed,_0x478f22){delete _0x50bfc6['uniqueId'][_0x555a4a[_0xca25('0xe3')]];_0x50bfc6[_0xca25('0xb0')](_0x50bfc6[_0xca25('0x1e')][_0x2172cb[_0xca25('0xb2')]]);_0x50bfc6['campaigns'][_0x2172cb[_0xca25('0xb2')]][_0xca25('0x61')]+=0x1;_0x50bfc6['campaigns'][_0x2172cb[_0xca25('0xb2')]][_0xca25('0x60')]+=0x1;var _0x54ff0d=_0x50bfc6[_0xca25('0x1e')][_0x2172cb['queue']];var _0x1800f6=new Hangup(_0x2172cb,_0x555a4a);_0x1800f6[_0xca25('0xa5')]=0x13;_0x1800f6[_0xca25('0xa6')]=_0xca25('0xfd');_0x1800f6[_0xca25('0xe5')]=_0xca25('0xea');_0x1800f6['countmachineretry']+=0x1;_0x1800f6[_0xca25('0xfe')]+=0x1;_0x1800f6[_0xca25('0xe7')]=!![];ami[_0xca25('0xe6')](_0xca25('0xff'),ut[_0xca25('0xec')](_0x1800f6,'amd'));_0x50bfc6[_0xca25('0xca')](_0x1800f6)[_0xca25('0xb7')](loggerCatch(_0xca25('0xed')));if(_0x1800f6[_0xca25('0xee')]+_0x1800f6[_0xca25('0xef')]+_0x1800f6[_0xca25('0xf0')]+_0x1800f6[_0xca25('0xf1')]+_0x1800f6[_0xca25('0xf2')]+_0x1800f6[_0xca25('0xf3')]+_0x1800f6[_0xca25('0xeb')]+_0x1800f6['countagentrejectretry']>=_0x54ff0d[_0xca25('0xf4')]){_0x50bfc6[_0xca25('0x100')](_0x1800f6,_0x2302ed,_0x478f22,_0xca25('0xf5'));}else{if(_0x1800f6[_0xca25('0xeb')]>=_0x54ff0d[_0xca25('0xf6')]){_0x50bfc6['createStateFinal'](_0x1800f6,_0x2302ed,_0x478f22,_0xca25('0xf8'));}else{_0x50bfc6[_0xca25('0xbd')]({'active':![],'countmachineretry':_0x1800f6[_0xca25('0xeb')],'scheduledat':moment()[_0xca25('0x101')](_0x54ff0d['dialMachineRetryFrequency'],_0xca25('0xfa'))[_0xca25('0x7b')](_0xca25('0xfb')),'ContactId':_0x1800f6['ContactId'],'ListId':_0x1800f6[_0xca25('0xd4')],'VoiceQueueId':_0x1800f6[_0xca25('0xd6')]||undefined,'CampaignId':_0x1800f6[_0xca25('0xd7')]||undefined})['catch'](loggerCatch(_0xca25('0xfc')));_0x2302ed({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xca25('0x35')]=function(_0x5845da){var _0x285dc8=this['uniqueId'][_0x5845da['uniqueid']];var _0x32ed7e=this;var _0x22bd8e;if(_0x285dc8&&_0x285dc8[_0xca25('0x7e')]===_0xca25('0x7f')){delete this[_0xca25('0x24')][_0x5845da[_0xca25('0xe3')]];this[_0xca25('0xb0')](this[_0xca25('0x1e')][_0x285dc8[_0xca25('0xb2')]]);this[_0xca25('0x1e')][_0x285dc8[_0xca25('0xb2')]][_0xca25('0x102')]+=0x1;_0x22bd8e=new Hangup(_0x285dc8,_0x5845da);this[_0xca25('0xca')](_0x22bd8e)[_0xca25('0xb7')](loggerCatch(_0xca25('0x103')));this[_0xca25('0xc8')](_0x22bd8e)[_0xca25('0xb7')](loggerCatch(_0xca25('0x104')));}if(_0x285dc8&&_0x285dc8[_0xca25('0x7e')]!=='ivr'&&isNotNull(this[_0xca25('0x1d')][_0x285dc8[_0xca25('0xb2')]][_0xca25('0x105')])){delete this[_0xca25('0x24')][_0x5845da[_0xca25('0xe3')]];this['updateOriginated'](this['voiceQueues'][_0x285dc8['queue']]);this[_0xca25('0x1d')][_0x285dc8[_0xca25('0xb2')]][_0xca25('0x61')]+=0x1;this[_0xca25('0x1d')][_0x285dc8[_0xca25('0xb2')]][_0xca25('0x60')]+=0x1;_0x22bd8e=new Hangup(_0x285dc8,_0x5845da);_0x22bd8e[_0xca25('0xa5')]=0x10;_0x22bd8e[_0xca25('0xa6')]=_0xca25('0x106');_0x22bd8e[_0xca25('0xe5')]=_0xca25('0x107');this[_0xca25('0xca')](_0x22bd8e)[_0xca25('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xca25('0xc8')](_0x22bd8e)[_0xca25('0xb7')](loggerCatch(_0xca25('0x104')));}if(_0x285dc8&&_0x285dc8[_0xca25('0x7e')]!==_0xca25('0x7f')&&!isNotNull(this[_0xca25('0x1d')][_0x285dc8[_0xca25('0xb2')]]['dialQueueProject'])){delete this[_0xca25('0x24')][_0x5845da['uniqueid']];this[_0xca25('0xb0')](this[_0xca25('0x1d')][_0x285dc8[_0xca25('0xb2')]]);this[_0xca25('0x1d')][_0x285dc8[_0xca25('0xb2')]][_0xca25('0x108')]+=0x1;_0x22bd8e=new Hangup(_0x285dc8,_0x5845da);_0x22bd8e['state']=0xc;_0x22bd8e[_0xca25('0xa6')]=_0x5845da[_0xca25('0x109')];_0x22bd8e[_0xca25('0xe5')]='Unknow';this['createHistory'](_0x22bd8e)[_0xca25('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xca25('0xc8')](_0x22bd8e)[_0xca25('0xb7')](loggerCatch(_0xca25('0x104')));}};Dialer[_0xca25('0x18')][_0xca25('0x32')]=function(_0x2ef51a){var _0x136905=this[_0xca25('0x24')][_0x2ef51a['uniqueid']];var _0x584a05=this;if(this['voiceQueues'][_0x2ef51a[_0xca25('0xb2')]]){if(_0x136905&&_0x136905[_0xca25('0x7e')]!==_0xca25('0x7f')){delete this[_0xca25('0x24')][_0x2ef51a[_0xca25('0xe3')]];this[_0xca25('0x1d')][_0x2ef51a[_0xca25('0xb2')]][_0xca25('0x61')]+=0x1;var _0x26fef7=new AgentComplete(_0x136905,_0x2ef51a);if(_0x2ef51a['reason']===_0xca25('0x10a')){_0x26fef7['agiafterat']=this[_0xca25('0x1d')][_0x2ef51a[_0xca25('0xb2')]][_0xca25('0x10b')]&&this['voiceQueues'][_0x2ef51a[_0xca25('0xb2')]][_0xca25('0x10c')]?moment()[_0xca25('0x7b')](_0xca25('0xfb')):undefined;}this[_0xca25('0xca')](_0x26fef7)[_0xca25('0xb7')](loggerCatch(_0xca25('0x10d')));this[_0xca25('0xc8')](_0x26fef7)[_0xca25('0xb7')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xca25('0x18')][_0xca25('0x2b')]=function(_0x3dffe6){if(this[_0xca25('0x1d')][_0x3dffe6['queue']]){if(this[_0xca25('0x24')][_0x3dffe6[_0xca25('0xe3')]]&&this[_0xca25('0x24')][_0x3dffe6[_0xca25('0xe3')]][_0xca25('0x7e')]!=='ivr'){this[_0xca25('0xb0')](this[_0xca25('0x1d')][_0x3dffe6[_0xca25('0xb2')]]);this[_0xca25('0x24')][_0x3dffe6['uniqueid']][_0xca25('0x10e')]=moment()[_0xca25('0x7b')](_0xca25('0xfb'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x36b629){this[_0xca25('0xca')](_0x36b629)[_0xca25('0xb7')](loggerCatch(_0xca25('0x10d')));this['moveContactManagedDialer'](_0x36b629)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xca25('0x18')][_0xca25('0x2e')]=function(_0x552b40){var _0x20584c=this['uniqueId'][_0x552b40['uniqueid']];var _0x2ae226=this;if(this['voiceQueues'][_0x552b40[_0xca25('0xb2')]]){if(_0x20584c&&_0x20584c[_0xca25('0x7e')]!==_0xca25('0x7f')){delete this[_0xca25('0x24')][_0x552b40['uniqueid']];this['updateOriginated'](this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]]);_0x20584c['droptime']=moment()['format'](_0xca25('0xfb'));var _0x3965df=new QueueCallerAbandon(_0x20584c,_0x552b40);if(getSeconds(_0x20584c[_0xca25('0x10f')],_0x20584c[_0xca25('0x110')])>=_0x20584c['dialQueueTimeout']){this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]][_0xca25('0x111')]+=0x1;this[_0xca25('0x1d')][_0x552b40['queue']][_0xca25('0x112')]+=0x1;this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]][_0xca25('0x6e')]+=0x1;_0x3965df[_0xca25('0xa5')]=0xa;_0x3965df[_0xca25('0xa6')]=_0xca25('0x113');_0x3965df[_0xca25('0x114')]=_0xca25('0x115');_0x3965df[_0xca25('0x116')]=this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]][_0xca25('0x10b')]?moment()[_0xca25('0x7b')](_0xca25('0xfb')):undefined;_0x3965df[_0xca25('0xf2')]+=0x1;_0x3965df[_0xca25('0xfe')]+=0x1;if(_0x3965df[_0xca25('0xf2')]>=this['voiceQueues'][_0x552b40[_0xca25('0xb2')]]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x3965df);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3965df[_0xca25('0xf2')],'scheduledat':moment()[_0xca25('0x101')](this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]][_0xca25('0x117')],_0xca25('0xfa'))[_0xca25('0x7b')](_0xca25('0xfb')),'ContactId':_0x20584c['ContactId'],'ListId':_0x20584c[_0xca25('0xd4')],'VoiceQueueId':_0x20584c['VoiceQueueId']||undefined,'CampaignId':_0x20584c[_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0x118')));var _0x246ffa=new History(_0x3965df);_0x246ffa[_0xca25('0xa5')]=0xa;_0x246ffa[_0xca25('0xa6')]=_0xca25('0x113');_0x246ffa[_0xca25('0xa8')]=moment()[_0xca25('0x7b')](_0xca25('0xfb'));_0x246ffa[_0xca25('0xa7')]=_0x246ffa[_0xca25('0xa8')];_0x246ffa[_0xca25('0x119')]=_0x3965df[_0xca25('0x119')];_0x246ffa[_0xca25('0x11a')]=_0x3965df['calleridnum'];this[_0xca25('0xca')](_0x246ffa)[_0xca25('0xb7')](loggerCatch(_0xca25('0x11b')));}}else{this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]][_0xca25('0x6c')]+=0x1;this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3965df[_0xca25('0xa5')]=0xb;_0x3965df['statedesc']=_0xca25('0x11c');_0x3965df[_0xca25('0x114')]='CALLEREXIT';_0x3965df[_0xca25('0xf3')]+=0x1;_0x3965df['countglobal']+=0x1;if(_0x3965df[_0xca25('0xf3')]>=this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]]['dialAbandonedMaxRetry']){this[_0xca25('0x11d')](_0x3965df);}else{this[_0xca25('0xbd')]({'active':![],'countabandonedretry':_0x3965df['countabandonedretry'],'scheduledat':moment()[_0xca25('0x101')](this[_0xca25('0x1d')][_0x552b40[_0xca25('0xb2')]]['dialAbandonedRetryFrequency'],'minutes')[_0xca25('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20584c[_0xca25('0xd3')],'ListId':_0x20584c[_0xca25('0xd4')],'VoiceQueueId':_0x20584c[_0xca25('0xd6')]||undefined,'CampaignId':_0x20584c[_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0x11e')));var _0x246ffa=new History(_0x3965df);_0x246ffa[_0xca25('0xa5')]=0xb;_0x246ffa[_0xca25('0xa6')]=_0xca25('0x11c');_0x246ffa[_0xca25('0xa8')]=moment()[_0xca25('0x7b')](_0xca25('0xfb'));_0x246ffa[_0xca25('0xa7')]=_0x246ffa['starttime'];_0x246ffa['calleridname']=_0x3965df['calleridname'];_0x246ffa[_0xca25('0x11a')]=_0x3965df[_0xca25('0x11a')];this[_0xca25('0xca')](_0x246ffa)['catch'](loggerCatch(_0xca25('0x11f')));}}}}};Dialer['prototype'][_0xca25('0x120')]=function(_0x40716e){if(this[_0xca25('0xaa')][_0x40716e['uniqueid']]){this[_0xca25('0xaa')][_0x40716e[_0xca25('0xe3')]]['channel']=_0x40716e[_0xca25('0x121')];}if(this['uniqueId'][_0x40716e['uniqueid']]){this[_0xca25('0x24')][_0x40716e[_0xca25('0xe3')]][_0xca25('0x121')]=_0x40716e['channel'];}};Dialer['prototype'][_0xca25('0x3a')]=function(_0x10328f){if(strategy[this[_0xca25('0x1d')][this[_0xca25('0xaa')][_0x10328f[_0xca25('0x122')]][_0xca25('0xb2')]][_0xca25('0x51')]]===_0xca25('0x17')){if(this[_0xca25('0xaa')][_0x10328f['actionid']]&&_[_0xca25('0xac')](this[_0xca25('0xaa')][_0x10328f['actionid']][_0xca25('0x123')])&&_0x10328f[_0xca25('0xae')]==='1'&&_0x10328f[_0xca25('0x124')]==='0'){if(this[_0xca25('0x1f')][_0x10328f[_0xca25('0x125')]]){if(!this[_0xca25('0x1f')][_0x10328f[_0xca25('0x125')]][_0xca25('0x123')]){this[_0xca25('0x1f')][_0x10328f['stateinterface']][_0xca25('0x123')]=!![];this['actions'][_0x10328f[_0xca25('0x122')]][_0xca25('0x123')]=!![];this[_0xca25('0xaa')][_0x10328f[_0xca25('0x122')]][_0xca25('0x125')]=_0x10328f[_0xca25('0x125')];}}}}else if((strategy[this[_0xca25('0x1d')][this[_0xca25('0xaa')][_0x10328f[_0xca25('0x122')]]['queue']][_0xca25('0x51')]]||'rrmemory')===_0xca25('0x16')){if(this[_0xca25('0xaa')][_0x10328f[_0xca25('0x122')]]){if(this[_0xca25('0x1f')][_0x10328f[_0xca25('0x125')]]){this[_0xca25('0xaa')][_0x10328f[_0xca25('0x122')]][_0xca25('0x125')]=_0x10328f['stateinterface'];if(_['isNil'](this['queueBooked'][this[_0xca25('0xaa')][_0x10328f[_0xca25('0x122')]]['queue']])){this[_0xca25('0x29')][this['actions'][_0x10328f[_0xca25('0x122')]]['queue']]=[];}this['queueBooked'][this[_0xca25('0xaa')][_0x10328f[_0xca25('0x122')]][_0xca25('0xb2')]][_0xca25('0x126')](_[_0xca25('0x8d')](_[_0xca25('0xd2')](this['actions'][_0x10328f[_0xca25('0x122')]],[_0xca25('0x127'),_0xca25('0x125')]),{'status':_0x10328f[_0xca25('0xae')],'paused':_0x10328f[_0xca25('0x124')]}));}}}};function unlockQueueStatus(_0x14a121,_0x2ae2ff){setTimeout(function(){if(_['isUndefined'](_0x14a121['queueStatusComplete'])){loggerBooked['error'](_0xca25('0x128'),_0x2ae2ff);}_0x14a121[_0xca25('0x129')]=!![];loggerBooked[_0xca25('0x82')]('[booked][unlockQueueStatus]',_0x2ae2ff,JSON[_0xca25('0x7a')](_[_0xca25('0xd2')](_0x14a121,['name',_0xca25('0x129')])));},0x1f3);}Dialer[_0xca25('0x18')][_0xca25('0x3c')]=function(_0x111d1b){var _0x32d752=this;var _0x2f54a8=_0x32d752['voiceQueues'][_0x32d752[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]];if(strategy[this['voiceQueues'][this[_0xca25('0xaa')][_0x111d1b['actionid']][_0xca25('0xb2')]][_0xca25('0x51')]]==='roundrobin'){if(this['actions'][_0x111d1b[_0xca25('0x122')]]&&this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0x125')]){this[_0xca25('0x12a')][_0xca25('0x12b')](this[_0xca25('0xaa')][_0x111d1b['actionid']][_0xca25('0x127')],this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0x125')])[_0xca25('0xb7')](function(_0x232391){logger[_0xca25('0x93')](_0xca25('0x12c'),util[_0xca25('0x94')](_0x232391,{'showHidden':![],'depth':null}));})[_0xca25('0x1b')](function(){_0x32d752[_0xca25('0xb0')](_0x32d752[_0xca25('0x1d')][_0x32d752[_0xca25('0xaa')][_0x111d1b['actionid']][_0xca25('0xb2')]]);_0x32d752['agents'][_0x32d752[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]]['stateinterface']][_0xca25('0x123')]=![];delete _0x32d752[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]];unlockQueueStatus(_0x2f54a8);});}else{this[_0xca25('0xb0')](this[_0xca25('0x1d')][this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]]['queue']]);this[_0xca25('0xbd')]({'active':![],'ContactId':this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]]['ContactId'],'ListId':this['actions'][_0x111d1b[_0xca25('0x122')]]['ListId'],'VoiceQueueId':this[_0xca25('0xaa')][_0x111d1b['actionid']][_0xca25('0xd6')]||undefined,'CampaignId':this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0x12d')));delete this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]];unlockQueueStatus(_0x2f54a8);}}else if((strategy[this[_0xca25('0x1d')][this['actions'][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]][_0xca25('0x51')]]||_0xca25('0x16'))==='rrmemory'){var _0x102900;if(this[_0xca25('0xaa')][_0x111d1b['actionid']]&&!_[_0xca25('0x4a')](this['queueBooked'][this[_0xca25('0xaa')][_0x111d1b['actionid']][_0xca25('0xb2')]])){if(this[_0xca25('0x12e')][_0x32d752[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]]){this[_0xca25('0x12e')][_0x32d752[_0xca25('0xaa')][_0x111d1b['actionid']][_0xca25('0xb2')]]=this[_0xca25('0x12e')][this['actions'][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]]?this[_0xca25('0x12e')][this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]]:this[_0xca25('0x29')][this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]]?this[_0xca25('0x29')][this['actions'][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]][_0xca25('0x12f')]||0x0:0x0;}this[_0xca25('0x29')][this['actions'][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]][_0xca25('0x12f')]=this[_0xca25('0x12e')][this[_0xca25('0xaa')][_0x111d1b[_0xca25('0x122')]][_0xca25('0xb2')]];for(var _0x5858d7=0x0;_0x5858d7=0x0;})[_0xca25('0xb7')](myreject(_0x3a9382)));}}else{_0xfc9b18[_0xca25('0x126')](ami[_0xca25('0xad')]({'action':_0xca25('0x142'),'command':util[_0xca25('0x7b')](_0xca25('0x143'),_0x56e460,!_['isUndefined'](config[_0xca25('0x13f')][_0x36a826])?_0x36a826:'')})[_0xca25('0xb6')](function(_0x1fb58e){return _0x1fb58e['content']['indexOf']('true')>=0x0;})[_0xca25('0xb7')](myreject(_0x3a9382)));}BPromise['all'](_0xfc9b18)[_0xca25('0xb6')](function(_0x2fb828){var _0x1c9789=_[_0xca25('0x147')](_0x2fb828);if(_0x1c9789){return _0x39efda(_0x1c9789);}else{_0x4a12d0[_0xca25('0x40')]=_0x539aab?'GLOBAL_INTERVAL_IS_OVERTIME':_0xca25('0x148');return _0x3a9382(msgResponse(_0xca25('0x149'),'Failure',_0xca25('0x14a')+_0x539aab+'\x20'+_0x407b46+_0xca25('0x14b')+util['inspect'](_0x56e460,{'showHidden':![],'depth':null})+_0xca25('0x14c')+_0x36a826));}})[_0xca25('0xb7')](function(_0x42db2a){return _0x3a9382(msgResponse(_0xca25('0x139'),'Failure',JSON[_0xca25('0x7a')](_0x42db2a)));});});};Dialer['prototype'][_0xca25('0x14d')]=function(_0x730447){var _0x407666=this;return function(){switch(_0x730447[_0xca25('0x5d')]){case _0xca25('0x14e'):freeVariablesPredictive(_0x730447);_0x407666[_0xca25('0x14f')](_0x730447,0x1);break;case'power':freeVariablesPredictive(_0x730447);_0x407666[_0xca25('0x14f')](_0x730447,_0x730447[_0xca25('0x150')]);break;case _0xca25('0x151'):_0x407666[_0xca25('0x151')](_0x730447);break;case'booked':freeVariablesPredictive(_0x730447);_0x407666[_0xca25('0x14f')](_0x730447,0x1);break;default:freeVariablesPredictive(_0x730447);logger[_0xca25('0x93')](_0xca25('0x152'),_0x730447[_0xca25('0x44')],_0xca25('0x153'));}};};Dialer[_0xca25('0x18')][_0xca25('0x154')]=function(_0x162e07){var _0x3e7fe9=this;return function(){_0x3e7fe9[_0xca25('0x155')](_0x162e07);};};Dialer[_0xca25('0x18')]['syncQueueSummary']=function(_0x36d256){var _0xd53405=this;if(isNotPreview(_0x36d256[_0xca25('0x5d')])){if(isVoiceQueueOutbound(_0x36d256[_0xca25('0x7e')])&&isActive(_0x36d256[_0xca25('0x156')])){_0x36d256[_0xca25('0x9e')]=!![];BPromise[_0xca25('0xb5')]()[_0xca25('0xb6')](checkIsLoggedIn(_0x36d256,_0x36d256['loggedIn']))[_0xca25('0xb6')](checkIsActive(_0x36d256,_0x36d256['dialActive']))[_0xca25('0xb6')](checkInterval(_0x36d256))[_0xca25('0xb6')](_0xd53405[_0xca25('0x136')](_0x36d256))['then'](_0xd53405[_0xca25('0x138')](_0x36d256['dialGlobalInterval'],_0x36d256[_0xca25('0x157')],_0x36d256[_0xca25('0x44')],_0x36d256))[_0xca25('0xb6')](_0xd53405['checkIfTimeIntervals'](_0x36d256['Interval'],_0x36d256[_0xca25('0x157')],_0x36d256['name'],_0x36d256))[_0xca25('0xb6')](_0xd53405[_0xca25('0x14d')](_0x36d256))[_0xca25('0xb7')](loggerCatchQueueSummary(_0xca25('0x158'),_0x36d256));}else{notSendMessagesQueue(_0x36d256);}}else{freeVariablesPredictive(_0x36d256);}};Dialer[_0xca25('0x18')]['syncCampaigns']=function(){var _0x4489e7=this;var _0x3afb0c;for(var _0xe4d81b in this['campaigns']){if(typeof this[_0xca25('0x1e')][_0xe4d81b]!==_0xca25('0x97')){_0x3afb0c=this['campaigns'][_0xe4d81b];if(isCampaignIvr(_0x3afb0c[_0xca25('0x7e')])&&isActive(_0x3afb0c[_0xca25('0x78')])){_0x3afb0c['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xca25('0xb6')](checkIsActive(_0x3afb0c,_0x3afb0c[_0xca25('0x78')]))[_0xca25('0xb6')](checkInterval(_0x3afb0c))[_0xca25('0xb6')](_0x4489e7['checkIsTrunkReachable'](_0x3afb0c))['then'](_0x4489e7[_0xca25('0x138')](_0x3afb0c[_0xca25('0x159')],_0x3afb0c[_0xca25('0x157')],_0x3afb0c['name'],_0x3afb0c))[_0xca25('0xb6')](_0x4489e7['checkIfTimeIntervals'](_0x3afb0c[_0xca25('0x46')],_0x3afb0c['dialTimezone'],_0x3afb0c[_0xca25('0x44')],_0x3afb0c))[_0xca25('0xb6')](_0x4489e7[_0xca25('0x154')](_0x3afb0c))[_0xca25('0xb7')](loggerCatchQueueSummary(_0xca25('0x15a'),_0x3afb0c));}else{notSendMessagesCampaign(_0x3afb0c);}}}};function getCallerIdRandom(_0x15686f,_0x10c0cb){var _0x2a0fe0;var _0x411b4a;var _0x375dd3;if(_0x10c0cb<=0x0){_0x10c0cb=0x1;}_0x2a0fe0=new RegExp('\x5cw{0,'+_0x10c0cb+'}$');_0x411b4a=Math[_0xca25('0x15b')](0xa,_0x10c0cb-0x1);_0x375dd3=Math[_0xca25('0x15b')](0xa,_0x10c0cb)-0x1;return util[_0xca25('0x7b')]('%s',_[_0xca25('0x15c')](_0x15686f,_0x2a0fe0,_[_0xca25('0x15d')](_0x411b4a,_0x375dd3)));}function extractCalleridName(_0x4aa73c){var _0x370c4d=_0x4aa73c[_0xca25('0x15e')](/"(.*?)"/);return _0x370c4d?_0x370c4d[0x1]:_0x4aa73c;}function extractCalleridNumber(_0x44e51d){var _0x51a5b0=_0x44e51d['match'](/<(.*?)>/);return _0x51a5b0?_0x51a5b0[0x1]:_0x44e51d;}Dialer[_0xca25('0x18')][_0xca25('0x15f')]=function(_0x179253,_0x1889bb){var _0x566819=this;var _0x10bba9=uuid['v4']();this['actions'][_0x10bba9]=new Action(_0x179253,_0x1889bb,_0x10bba9);return new BPromise(function(_0x1c258b,_0x220dc4){if(_['isUndefined'](_0x179253)&&typeof _0x179253!=='object'){return _0x220dc4(msgResponse(_0xca25('0x160'),'Failure',_0xca25('0x161')));}if(_['isUndefined'](_0x1889bb[_0xca25('0x162')][_0xca25('0x163')])||_0x1889bb['Contact'][_0xca25('0x163')]===null){return _0x220dc4(msgResponse('originate',_0xca25('0x13d'),_0xca25('0x164')));}var _0x2d42c4={'XMD-CALLERID':_0x566819[_0xca25('0xaa')][_0x10bba9]['getCaller'](),'XMD-AGI':_0x179253['dialQueueProject']?util[_0xca25('0x7b')](_0xca25('0x165'),ipAgi,_0x179253['dialQueueProject']):_0xca25('0x166'),'XMD-AGIAFTER':_0x179253[_0xca25('0x10b')]?util[_0xca25('0x7b')](_0xca25('0x165'),ipAgi,_0x179253['dialQueueProject2']):_0xca25('0x166'),'XMD-QUEUE':_0x179253['type']===_0xca25('0x50')?util[_0xca25('0x7b')](_0xca25('0x167'),_0x179253[_0xca25('0x44')],_0x179253[_0xca25('0x168')]||'',_0x179253[_0xca25('0x10c')]?'c':'',_0x179253[_0xca25('0x169')]||0x3):'NONE','XMD-CONTACTID':_0x1889bb[_0xca25('0xd3')],'XMD-CDRTYPE':_0xca25('0x8'),'CALLERID(all)':_0x566819[_0xca25('0xaa')][_0x10bba9]['getCaller'](),'XMD-AMD':_0x179253[_0xca25('0xe0')]?_0xca25('0x16a'):_0xca25('0x166'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x179253['dialAMDActive']){_0x2d42c4[_0xca25('0x16b')]=_0x179253['dialAMDInitialSilence']||0x9c4;_0x2d42c4[_0xca25('0x16c')]=_0x179253[_0xca25('0x16d')]||0x5dc;_0x2d42c4['XMD-AMDAFTERGREETINGSILENCE']=_0x179253[_0xca25('0x16e')]||0x320;_0x2d42c4['XMD-AMDTOTALANALYSISTIME']=_0x179253[_0xca25('0x16f')]||0x1388;_0x2d42c4[_0xca25('0x170')]=_0x179253[_0xca25('0x171')]||0x64;_0x2d42c4[_0xca25('0x172')]=_0x179253[_0xca25('0x173')]||0x32;_0x2d42c4[_0xca25('0x174')]=_0x179253[_0xca25('0x175')]||0x3;_0x2d42c4[_0xca25('0x176')]=_0x179253['dialAMDSilenceThreshold']||0x100;_0x2d42c4['XMD-AMDMAXIMUMWORDLENGTH']=_0x179253[_0xca25('0x177')]||0x1388;}if(_0x179253[_0xca25('0x7e')]===_0xca25('0x50')){_0x2d42c4[_0xca25('0x178')]=_0x1889bb['VoiceQueueId'];}else{_0x2d42c4[_0xca25('0x179')]=_0x1889bb[_0xca25('0xd7')];}for(var _0x74b7 in _0x1889bb['Contact']){if(typeof _0x1889bb[_0xca25('0x162')][_0x74b7]!==_0xca25('0x97')){if(isNotNull(_0x1889bb[_0xca25('0x162')][_0x74b7])&&_0x74b7!=='id'&&_0x74b7!==_0xca25('0x17a')&&_0x74b7!==_0xca25('0x17b')&&_0x74b7!==_0xca25('0x17c')){_0x2d42c4[util[_0xca25('0x7b')](_0xca25('0x17d'),'XMD-',_[_0xca25('0x17e')](_0x74b7))]=_0x1889bb[_0xca25('0x162')][_0x74b7];}}}var _0x3e5efd=_0x566819[_0xca25('0xdc')](_0x179253[_0xca25('0x77')])?getCallerId(_0x179253[_0xca25('0x77')][_0xca25('0x79')],_0x179253[_0xca25('0x17f')],_0x179253[_0xca25('0x180')]>0x0?getCallerIdRandom(_0x179253[_0xca25('0x5e')],_0x179253[_0xca25('0x180')]):_0x179253['dialOriginateCallerIdNumber']):getCallerId(_[_0xca25('0xac')](_0x179253['TrunkBackup'])?_0x179253[_0xca25('0x77')]['callerid']:_0x179253[_0xca25('0x181')][_0xca25('0x79')],_0x179253[_0xca25('0x17f')],_0x179253[_0xca25('0x180')]>0x0?getCallerIdRandom(_0x179253[_0xca25('0x5e')],_0x179253[_0xca25('0x180')]):_0x179253[_0xca25('0x5e')]);if(_0x3e5efd){_0x2d42c4[_0xca25('0x182')]=_0x566819[_0xca25('0xaa')][_0x10bba9]['originatecalleridname']=extractCalleridName(_0x3e5efd);_0x2d42c4[_0xca25('0x183')]=_0x566819['actions'][_0x10bba9]['originatecalleridnum']=extractCalleridNumber(_0x3e5efd);}return ami[_0xca25('0xad')]({'actionid':_0x10bba9,'action':_0xca25('0x160'),'channel':_0x566819[_0xca25('0xdc')](_0x179253['Trunk'])?util[_0xca25('0x7b')]('SIP/%s/%s%s',_0x179253[_0xca25('0x77')][_0xca25('0x44')],isNotNull(_0x179253['dialPrefix'])?_0x179253['dialPrefix'][_0xca25('0x184')]()||'':'',_0x179253[_0xca25('0x185')]>0x0?_0x1889bb['Contact'][_0xca25('0x163')][_0xca25('0x186')](_0x179253[_0xca25('0x185')]):_0x1889bb['Contact'][_0xca25('0x163')]):util['format']('SIP/%s/%s%s',_[_0xca25('0xac')](_0x179253[_0xca25('0x181')])?_0x179253[_0xca25('0x77')][_0xca25('0x44')]:_0x179253['TrunkBackup']['name'],isNotNull(_0x179253[_0xca25('0x187')])?_0x179253[_0xca25('0x187')][_0xca25('0x184')]()||'':'',_0x179253[_0xca25('0x185')]>0x0?_0x1889bb[_0xca25('0x162')][_0xca25('0x163')][_0xca25('0x186')](_0x179253[_0xca25('0x185')]):_0x1889bb[_0xca25('0x162')][_0xca25('0x163')]),'callerid':_0x3e5efd,'Exten':_0xca25('0xdf'),'Context':'from-sip','Priority':'1','variable':_0x2d42c4,'timeout':(_0x179253[_0xca25('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x10bba9})[_0xca25('0xb6')](function(_0x3bff76){return _0x1c258b(_0x3bff76);})[_0xca25('0xb7')](function(_0x4da055){_0x179253[_0xca25('0x188')]+=0x1;var _0x56b811=new History(_0x566819[_0xca25('0xaa')][_0x10bba9]);logger['error'](util[_0xca25('0x7b')](_0xca25('0x189'),JSON[_0xca25('0x7a')](_0x4da055)));_0x56b811[_0xca25('0xa5')]=0xe;_0x56b811[_0xca25('0xa6')]='OriginateError';_0x56b811[_0xca25('0xa8')]=moment()['format'](_0xca25('0xfb'));_0x56b811['endtime']=_0x56b811[_0xca25('0xa8')];_0x566819['createHistory'](_0x56b811)[_0xca25('0xb7')](loggerCatch(_0xca25('0x18a')));_0x566819['moveContactManagedDialer'](_0x56b811)['catch'](loggerCatch('[originate][error]'))[_0xca25('0x1b')](function(){delete _0x566819[_0xca25('0xaa')][_0x10bba9];return _0x220dc4(msgResponse(_0xca25('0x160'),_0xca25('0x4c'),_0xca25('0x18b')));});});});};Dialer[_0xca25('0x18')][_0xca25('0x30')]=function(_0x5f375b){var _0x23760c=this[_0xca25('0xaa')][_0x5f375b[_0xca25('0x122')]];if(_0x23760c){delete this[_0xca25('0xaa')][_0x5f375b['actionid']];_0x23760c[_0xca25('0x110')]=moment()[_0xca25('0x7b')](_0xca25('0xfb'));var _0x2e45ec=_0x23760c[_0xca25('0x7e')]===_0xca25('0x7f')?this[_0xca25('0x1e')][_0x23760c[_0xca25('0xb2')]]:this['voiceQueues'][_0x23760c[_0xca25('0x18c')]()];if(!this['isSuccess'](_0x5f375b['response'])){this[_0xca25('0xb0')](_0x2e45ec);return this[_0xca25('0x18d')](_0x23760c,_0x2e45ec,_0x5f375b)[_0xca25('0xb7')](loggerCatch(_0xca25('0x18e')));}this[_0xca25('0x24')][_0x5f375b[_0xca25('0xe3')]]=_0x23760c;}};Dialer[_0xca25('0x18')][_0xca25('0x18f')]=function(_0x477da4,_0xb387d8,_0x5bfaa0){var _0x2aa2ad=new History(_0xb387d8);if(_0x2aa2ad[_0xca25('0xee')]+_0x2aa2ad['countcongestionretry']+_0x2aa2ad['countnoanswerretry']+_0x2aa2ad[_0xca25('0xf1')]+_0x2aa2ad['countdropretry']+_0x2aa2ad[_0xca25('0xf3')]+_0x2aa2ad['countmachineretry']+_0x2aa2ad[_0xca25('0x190')]>=_0x5bfaa0['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x477da4){case 0x3:if(_0x2aa2ad['countnoanswerretry']>=_0x5bfaa0[_0xca25('0x191')]-0x1){return!![];}this[_0xca25('0xbd')]({'active':![],'countnoanswerretry':_0x2aa2ad['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x5bfaa0[_0xca25('0x192')],_0xca25('0xfa'))[_0xca25('0x7b')](_0xca25('0xfb')),'ContactId':_0x2aa2ad[_0xca25('0xd3')],'ListId':_0x2aa2ad[_0xca25('0xd4')],'VoiceQueueId':_0x2aa2ad[_0xca25('0xd6')]||undefined,'CampaignId':_0x2aa2ad[_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0x193')));break;case 0x5:if(_0x2aa2ad[_0xca25('0xee')]>=_0x5bfaa0[_0xca25('0x194')]-0x1){return!![];}this[_0xca25('0xbd')]({'active':![],'countbusyretry':_0x2aa2ad['countbusyretry']+=0x1,'scheduledat':moment()[_0xca25('0x101')](_0x5bfaa0[_0xca25('0x195')],_0xca25('0xfa'))[_0xca25('0x7b')](_0xca25('0xfb')),'ContactId':_0x2aa2ad[_0xca25('0xd3')],'ListId':_0x2aa2ad[_0xca25('0xd4')],'VoiceQueueId':_0x2aa2ad[_0xca25('0xd6')]||undefined,'CampaignId':_0x2aa2ad[_0xca25('0xd7')]||undefined})['catch'](loggerCatch(_0xca25('0x196')));break;case 0x8:if(_0x2aa2ad[_0xca25('0xef')]>=_0x5bfaa0[_0xca25('0x197')]-0x1){return!![];}this[_0xca25('0xbd')]({'active':![],'countcongestionretry':_0x2aa2ad[_0xca25('0xef')]+=0x1,'scheduledat':moment()[_0xca25('0x101')](_0x5bfaa0[_0xca25('0x198')],_0xca25('0xfa'))[_0xca25('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2aa2ad['ContactId'],'ListId':_0x2aa2ad['ListId'],'VoiceQueueId':_0x2aa2ad['VoiceQueueId']||undefined,'CampaignId':_0x2aa2ad[_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0x199')));break;case 0x0:if(_0x2aa2ad['countnosuchnumberretry']>=_0x5bfaa0[_0xca25('0x19a')]-0x1){return!![];}else{this[_0xca25('0xbd')]({'active':![],'countnosuchnumberretry':_0x2aa2ad['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xca25('0x101')](_0x5bfaa0[_0xca25('0x19b')],'minutes')[_0xca25('0x7b')](_0xca25('0xfb')),'ContactId':_0x2aa2ad[_0xca25('0xd3')],'ListId':_0x2aa2ad['ListId'],'VoiceQueueId':_0x2aa2ad[_0xca25('0xd6')]||undefined,'CampaignId':_0x2aa2ad[_0xca25('0xd7')]||undefined})['catch'](loggerCatch(_0xca25('0x19c')));}break;case 0xa:if(_0x2aa2ad[_0xca25('0xf2')]>=_0x5bfaa0['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x2aa2ad['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x5bfaa0[_0xca25('0x117')],'minutes')[_0xca25('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2aa2ad[_0xca25('0xd3')],'ListId':_0x2aa2ad['ListId'],'VoiceQueueId':_0x2aa2ad[_0xca25('0xd6')]||undefined,'CampaignId':_0x2aa2ad[_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2aa2ad[_0xca25('0xf3')]>=_0x5bfaa0['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2aa2ad['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x5bfaa0['dialAbandonedRetryFrequency'],_0xca25('0xfa'))[_0xca25('0x7b')](_0xca25('0xfb')),'ContactId':_0x2aa2ad['ContactId'],'ListId':_0x2aa2ad[_0xca25('0xd4')],'VoiceQueueId':_0x2aa2ad['VoiceQueueId']||undefined,'CampaignId':_0x2aa2ad[_0xca25('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2aa2ad[_0xca25('0xeb')]>=_0x5bfaa0[_0xca25('0xf6')]-0x1){return!![];}this[_0xca25('0xbd')]({'active':![],'countmachineretry':_0x2aa2ad[_0xca25('0xeb')]+=0x1,'scheduledat':moment()[_0xca25('0x101')](_0x5bfaa0[_0xca25('0xf9')],_0xca25('0xfa'))[_0xca25('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2aa2ad['ContactId'],'ListId':_0x2aa2ad[_0xca25('0xd4')],'VoiceQueueId':_0x2aa2ad[_0xca25('0xd6')]||undefined,'CampaignId':_0x2aa2ad['CampaignId']||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0xfc')));break;case 0x14:if(_0x2aa2ad[_0xca25('0x190')]>=_0x5bfaa0[_0xca25('0x19d')]-0x1){return!![];}this[_0xca25('0xbd')]({'active':![],'countagentrejectretry':_0x2aa2ad[_0xca25('0x190')]+=0x1,'scheduledat':moment()[_0xca25('0x101')](_0x5bfaa0[_0xca25('0x19e')],_0xca25('0xfa'))['format'](_0xca25('0xfb')),'ContactId':_0x2aa2ad[_0xca25('0xd3')],'ListId':_0x2aa2ad[_0xca25('0xd4')],'VoiceQueueId':_0x2aa2ad[_0xca25('0xd6')]||undefined,'CampaignId':_0x2aa2ad[_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xca25('0x18')]['callProgressDetecting']=function(_0x23957b,_0x198c18,_0x5bd969){var _0x15bc20=this;var _0x3b2bc4=new History(_0x23957b);return new BPromise(function(_0x21bdb9,_0x264eb3){if(_[_0xca25('0x3f')](_0x198c18)&&typeof _0x198c18!==_0xca25('0x19f')){return _0x264eb3(msgResponse('[callProgressDetecting]',_0xca25('0x13d'),_0xca25('0x1a0')));}if(_[_0xca25('0x3f')](_0x5bd969)&&typeof _0x5bd969!=='object'){return _0x264eb3(msgResponse(_0xca25('0x1a1'),_0xca25('0x13d'),'evt\x20is\x20undefine'));}switch(_0x5bd969['reason']){case'0':_0x198c18['outboundNoSuchCallsDay']+=0x1;_0x3b2bc4['state']=0x0;_0x3b2bc4[_0xca25('0xa6')]=_0xca25('0x1a2');_0x3b2bc4['countnosuchnumberretry']+=0x1;_0x3b2bc4[_0xca25('0xfe')]+=0x1;ami[_0xca25('0xe6')]('custom:agentnosuchnumber',ut[_0xca25('0xec')](_0x23957b,'nosuchnumber'));_0x15bc20[_0xca25('0xca')](_0x3b2bc4)[_0xca25('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x15bc20['checkRetriveMax'](0x0,_0x23957b,_0x198c18)){if(_0x3b2bc4['countnosuchnumberretry']>=_0x198c18[_0xca25('0x19a')]){_0x15bc20[_0xca25('0xf7')](_0x3b2bc4,_0x21bdb9,_0x264eb3,'reason\x200\x20no\x20such\x20number....');}else{_0x15bc20[_0xca25('0x100')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1a3'));}}break;case'3':_0x198c18[_0xca25('0x67')]+=0x1;_0x3b2bc4[_0xca25('0xa5')]=0x3;_0x3b2bc4[_0xca25('0xa6')]=_0xca25('0x1a4');_0x3b2bc4[_0xca25('0xf0')]+=0x1;_0x3b2bc4[_0xca25('0xfe')]+=0x1;ami[_0xca25('0xe6')](_0xca25('0x1a5'),ut[_0xca25('0xec')](_0x23957b,'noanswer'));_0x15bc20['createHistory'](_0x3b2bc4)['catch'](loggerCatch(_0xca25('0x1a6')));if(_0x15bc20[_0xca25('0x18f')](0x3,_0x23957b,_0x198c18)){if(_0x3b2bc4[_0xca25('0xf0')]>=_0x198c18[_0xca25('0x191')]){_0x15bc20[_0xca25('0xf7')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1a7'));}else{_0x15bc20[_0xca25('0x100')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1a7'));}}break;case'5':_0x198c18['outboundBusyCallsDay']+=0x1;_0x3b2bc4['state']=0x5;_0x3b2bc4[_0xca25('0xa6')]=_0xca25('0x1a8');_0x3b2bc4['countbusyretry']+=0x1;_0x3b2bc4[_0xca25('0xfe')]+=0x1;ami[_0xca25('0xe6')]('custom:agentbusy',ut[_0xca25('0xec')](_0x23957b,_0xca25('0x1a9')));_0x15bc20[_0xca25('0xca')](_0x3b2bc4)[_0xca25('0xb7')](loggerCatch(_0xca25('0x1aa')));if(_0x15bc20['checkRetriveMax'](0x5,_0x23957b,_0x198c18)){if(_0x3b2bc4[_0xca25('0xee')]>=_0x198c18['dialBusyMaxRetry']){_0x15bc20[_0xca25('0xf7')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1ab'));}else{_0x15bc20[_0xca25('0x100')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1ab'));}}break;case'8':_0x198c18['outboundCongestionCallsDay']+=0x1;_0x3b2bc4[_0xca25('0xa5')]=0x8;_0x3b2bc4[_0xca25('0xa6')]=_0xca25('0x1ac');_0x3b2bc4[_0xca25('0xef')]+=0x1;_0x3b2bc4[_0xca25('0xfe')]+=0x1;ami['emit'](_0xca25('0x1ad'),ut[_0xca25('0xec')](_0x23957b,_0xca25('0x1ae')));_0x15bc20[_0xca25('0xca')](_0x3b2bc4)[_0xca25('0xb7')](loggerCatch(_0xca25('0x1af')));if(_0x15bc20['checkRetriveMax'](0x8,_0x23957b,_0x198c18)){if(_0x3b2bc4[_0xca25('0xef')]>=_0x198c18[_0xca25('0x197')]){_0x15bc20[_0xca25('0xf7')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1b0'));}else{_0x15bc20['stateGlobal'](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1b0'));}}break;case'11':_0x198c18[_0xca25('0x1b1')]+=0x1;_0x3b2bc4[_0xca25('0xa5')]=0xb;_0x3b2bc4[_0xca25('0xa6')]='Abandoned';_0x3b2bc4['countabandonedretry']+=0x1;_0x3b2bc4[_0xca25('0xfe')]+=0x1;_0x15bc20[_0xca25('0xca')](_0x3b2bc4)[_0xca25('0xb7')](loggerCatch(_0xca25('0x11f')));if(_0x15bc20[_0xca25('0x18f')](0xb,_0x23957b,_0x198c18)){if(_0x3b2bc4[_0xca25('0xf3')]>=_0x198c18['dialAbandonedMaxRetry']){_0x15bc20['createStateFinal'](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1b2'));}else{_0x15bc20[_0xca25('0x100')](_0x3b2bc4,_0x21bdb9,_0x264eb3,'reason\x2011\x20abandoned');}}break;case'20':_0x198c18[_0xca25('0x1b3')]+=0x1;_0x3b2bc4[_0xca25('0xa5')]=0x14;_0x3b2bc4[_0xca25('0xa6')]=_0xca25('0x1b4');_0x3b2bc4[_0xca25('0x190')]+=0x1;_0x3b2bc4[_0xca25('0xfe')]+=0x1;ami['emit'](_0xca25('0x1b5'),ut[_0xca25('0xec')](_0x23957b,_0xca25('0x1b6')));_0x15bc20[_0xca25('0xca')](_0x3b2bc4)[_0xca25('0xb7')](loggerCatch(_0xca25('0x1b7')));if(_0x15bc20[_0xca25('0x18f')](0x14,_0x23957b,_0x198c18)){if(_0x3b2bc4[_0xca25('0x190')]>=_0x198c18[_0xca25('0x19d')]){_0x15bc20[_0xca25('0xf7')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0xca25('0x1b8'));}else{_0x15bc20[_0xca25('0x100')](_0x3b2bc4,_0x21bdb9,_0x264eb3,'reason\x2020\x20agentreject');}}break;default:_0x198c18[_0xca25('0x108')]+=0x1;_0x3b2bc4['state']=0xc;_0x3b2bc4[_0xca25('0xa6')]=_0x5bd969[_0xca25('0x1b9')];_0x15bc20[_0xca25('0xca')](_0x3b2bc4)[_0xca25('0xb7')](loggerCatch(_0xca25('0x1ba')));if(_0x15bc20[_0xca25('0x18f')](_0x5bd969[_0xca25('0x1b9')],_0x23957b,_0x198c18)){if(_0x3b2bc4[_0xca25('0xee')]+_0x3b2bc4['countcongestionretry']+_0x3b2bc4[_0xca25('0xf0')]+_0x3b2bc4[_0xca25('0xf1')]+_0x3b2bc4[_0xca25('0xf2')]+_0x3b2bc4['countabandonedretry']+_0x3b2bc4[_0xca25('0xeb')]+_0x3b2bc4[_0xca25('0x190')]>=_0x198c18[_0xca25('0xf4')]){_0x15bc20[_0xca25('0x100')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0x5bd969[_0xca25('0x1b9')]);}else{_0x15bc20[_0xca25('0xf7')](_0x3b2bc4,_0x21bdb9,_0x264eb3,_0x5bd969[_0xca25('0x1b9')]);}}}});};Dialer['prototype'][_0xca25('0x100')]=function(_0xa7dbb9,_0x292128,_0x93595c,_0x391f71){var _0x3ffd10=new Final(_0xa7dbb9);_0x3ffd10[_0xca25('0xa5')]=0xf;_0x3ffd10[_0xca25('0xa6')]='Global';this[_0xca25('0xf7')](_0x3ffd10,_0x292128,_0x93595c,_0x391f71);};Dialer[_0xca25('0x18')][_0xca25('0xf7')]=function(_0x894204,_0x3b5869,_0x2b0028,_0x444524){this[_0xca25('0xc8')](_0x894204)['then'](function(){return _0x3b5869(msgResponse(_0xca25('0x1a1'),_0xca25('0xdb'),_0x444524));})[_0xca25('0xb7')](function(){return _0x2b0028(msgResponse(_0xca25('0x1bb'),_0xca25('0x13d'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xca25('0x151')]=function(_0x2cdef4){var _0x2eabbd=_0x2cdef4[_0xca25('0x1bc')]/0x64;var _0x57ddff=_0x2cdef4[_0xca25('0x112')]/(_0x2cdef4[_0xca25('0x112')]+_0x2cdef4[_0xca25('0x61')]);var _0x46deea=Math['round'](_0x2cdef4[_0xca25('0x71')]*(_0x2cdef4['predictiveIntervalMaxThreshold']/0x64));var _0x4687b3=Math[_0xca25('0x1bd')](_0x2cdef4[_0xca25('0x71')]*(_0x2cdef4[_0xca25('0x1be')]/0x64));var _0x3fcf41=_0x2cdef4[_0xca25('0x53')]+_0x2cdef4['talking'];var _0x21a841=Math['floor'](_0x2cdef4[_0xca25('0x73')]*_0x2cdef4[_0xca25('0x75')]*_0x2cdef4[_0xca25('0x6f')]*_0x2cdef4[_0xca25('0x70')]);if(_[_0xca25('0x3f')](_0x2cdef4['startProgressive'])){if(!_[_0xca25('0x3f')](_0x2cdef4[_0xca25('0x26')])){_0x2cdef4[_0xca25('0x26')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xca25('0x1bf'));}if(!_[_0xca25('0x3f')](_0x2cdef4[_0xca25('0x8f')])){loggerPredictive[_0xca25('0x93')]('[startMethodPredictive][StartProgressive]',_0xca25('0x1c0'));clearInterval(_0x2cdef4[_0xca25('0x8f')]);_0x2cdef4['handlePredictive']=undefined;}_0x2cdef4[_0xca25('0x27')]=moment()[_0xca25('0x7b')](_0xca25('0xfb'));loggerPredictive['info'](_0x2cdef4[_0xca25('0x44')],_0xca25('0x1c1'),_0x2cdef4[_0xca25('0x27')]);this[_0xca25('0x14f')](_0x2cdef4,0x1);}else if(ifInterval(_0x2cdef4[_0xca25('0x1c2')],_0x2cdef4['startProgressive'])){this[_0xca25('0x14f')](_0x2cdef4,0x1);loggerPredictiveCalls[_0xca25('0x82')](_0xca25('0x1c3'),_0x2cdef4[_0xca25('0x27')],_0x2cdef4['name']);_0x2cdef4[_0xca25('0x73')]=0x0;_0x2cdef4['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2eabbd<_0x57ddff&&_0x2cdef4['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x2cdef4);loggerPredictive[_0xca25('0x82')](_0xca25('0x1c4'),_0xca25('0x1c5'),_0x57ddff,'startProgressive',_0x2cdef4['name']);}else if(_0x21a841<_0x2cdef4[_0xca25('0x6e')]&&_0x2cdef4[_0xca25('0x1c6')]===_0xca25('0x1c7')){freeVariablesPredictive(_0x2cdef4);loggerPredictive[_0xca25('0x82')](_0xca25('0x1c8'),_0xca25('0x1c9'),_0x21a841,'Drop\x20in\x20this\x20interval',_0x2cdef4[_0xca25('0x6e')],_0xca25('0x27'),_0x2cdef4['name']);}else if(!ifInterval(_0x2cdef4[_0xca25('0x1c2')],_0x2cdef4['startProgressive'])&&_[_0xca25('0x3f')](_0x2cdef4[_0xca25('0x26')])&&!_[_0xca25('0x3f')](_0x2cdef4[_0xca25('0x27')])){_0x2cdef4[_0xca25('0x26')]=moment()[_0xca25('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xca25('0x82')](_0x2cdef4[_0xca25('0x44')],_0xca25('0x1ca'),_0x2cdef4[_0xca25('0x26')]);this[_0xca25('0xbc')](_0x2cdef4[_0xca25('0x1c2')])['then'](this['getDataPredictive'](_0x2cdef4))[_0xca25('0xb6')](mergeDataErlangB(_0x2cdef4))[_0xca25('0xb6')](this[_0xca25('0x1cb')](_0x2cdef4))['catch'](loggerCatchPredictive(_0xca25('0x1cc'),_0x2cdef4));}else if(!ifInterval(_0x2cdef4[_0xca25('0x1c2')],_0x2cdef4[_0xca25('0x26')])){_0x2cdef4[_0xca25('0x6e')]=0x0;_0x2cdef4[_0xca25('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xca25('0x82')](_0x2cdef4[_0xca25('0x44')],'recalculate\x20predictive\x20at',_0x2cdef4['startPredictive']);clearInterval(_0x2cdef4[_0xca25('0x8f')]);_0x2cdef4[_0xca25('0x8f')]=undefined;this[_0xca25('0xbc')](_0x2cdef4[_0xca25('0x1c2')])['then'](this[_0xca25('0x1cd')](_0x2cdef4))[_0xca25('0xb6')](mergeDataErlangB(_0x2cdef4))[_0xca25('0xb6')](this[_0xca25('0x1cb')](_0x2cdef4))['catch'](loggerCatchPredictive(_0xca25('0x1ce'),_0x2cdef4));}else if(_0x2cdef4[_0xca25('0x71')]&&_0x3fcf41<_0x2cdef4[_0xca25('0x71')]-_0x4687b3){freeVariablesPredictive(_0x2cdef4);loggerPredictive['info'](_0x2cdef4[_0xca25('0x44')],_0xca25('0x1cf'),_0x3fcf41,_0xca25('0x1d0'),_0x2cdef4[_0xca25('0x71')],'-',_0x4687b3,'=',_0x2cdef4[_0xca25('0x71')]-_0x4687b3,')');}else if(_0x2cdef4['predictiveIntervalAvailable']&&_0x3fcf41>_0x2cdef4[_0xca25('0x71')]+_0x46deea){freeVariablesPredictive(_0x2cdef4);loggerPredictive[_0xca25('0x82')](_0x2cdef4[_0xca25('0x44')],_0xca25('0x1cf'),_0x3fcf41,_0xca25('0x1d1'),_0x2cdef4['predictiveIntervalAvailable'],'+',_0x46deea,'=',_0x2cdef4['predictiveIntervalAvailable']+_0x46deea,')');}};Dialer[_0xca25('0x18')][_0xca25('0x1cd')]=function(_0x59728f){var _0x1db07f=this;return function(_0x1c4ecf){return new BPromise(function(_0x5033d1,_0x1d9f71){_[_0xca25('0x8d')](_0x59728f,_0x1c4ecf[0x0]);if(checkGetDataPredictive(_0x1c4ecf[0x0])){var _0x21773a=_0x59728f['predictiveIntervalAvailable']=_0x59728f[_0xca25('0x9f')]+_0x59728f[_0xca25('0x53')];var _0x36a211=_0x59728f['dialPredictiveInterval']*0x3c;var _0x738d20=_0x1c4ecf[0x0][_0xca25('0x6b')]+_0x1c4ecf[0x0]['predictiveIntervalAvgHoldtime'];var _0x44e577=(_0x1c4ecf[0x0][_0xca25('0x69')]+_0x1c4ecf[0x0][_0xca25('0x111')]+_0x1c4ecf[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1c4ecf[0x0][_0xca25('0x86')];_0x59728f[_0xca25('0x6f')]=_0x44e577>0x0?_0x44e577:0x1;switch(_0x59728f[_0xca25('0x1c6')]){case _0xca25('0x1c7'):var _0x23f14e=_0x59728f['dialPredictiveOptimizationPercentage']/0x64;return _0x1db07f[_0xca25('0x1d2')](_0x21773a,_0x36a211,_0x738d20,_0x44e577,_0x23f14e)[_0xca25('0xb6')](function(_0x3f80a2){return _0x5033d1(_0x3f80a2);});case _0xca25('0x1d3'):var _0x3e1426=_0x59728f[_0xca25('0x1bc')]/0x64;return _0x1db07f[_0xca25('0x1d4')](_0x21773a,_0x36a211,_0x738d20,_0x44e577,_0x3e1426)[_0xca25('0xb6')](function(_0x55778f){return _0x5033d1(_0x55778f);});default:return _0x1d9f71(msgResponse(_0xca25('0x1d5'),_0xca25('0x13d'),_0xca25('0x1d6')));}}else{return _0x1d9f71(msgResponse('[getDataPredictive]',_0xca25('0x13d'),'check\x20failure'));}});};};Dialer[_0xca25('0x18')]['getDataPredictiveOld']=function(_0x59ed67){var _0x5c155a=this;return function(_0x2c57c3){return new BPromise(function(_0x4e4168,_0x1ce10d){_[_0xca25('0x8d')](_0x59ed67,_0x2c57c3[0x0]);if(checkGetDataPredictive(_0x2c57c3[0x0])){loggerPredictive[_0xca25('0x82')](JSON[_0xca25('0x7a')](_0x2c57c3[0x0]));if(_0x59ed67[_0xca25('0x1c6')]===_0xca25('0x1c7')){return _0x5c155a['getVoiceQueueRtPauses'](_0x59ed67['id'])[_0xca25('0xb6')](function(_0x96e834){var _0x53474b=_0x59ed67[_0xca25('0x54')]-_0x96e834[0x0][_0xca25('0x1d7')];var _0x33d52b=_0x59ed67[_0xca25('0x1c2')]*0x3c;var _0x46f05b=_0x2c57c3[0x0]['predictiveIntervalAvgTalktime']+_0x2c57c3[0x0][_0xca25('0x6a')];var _0x49173d=(_0x2c57c3[0x0][_0xca25('0x69')]+_0x2c57c3[0x0][_0xca25('0x111')]+_0x2c57c3[0x0][_0xca25('0x6c')])/_0x2c57c3[0x0][_0xca25('0x86')];var _0x1445b8=_0x59ed67[_0xca25('0x1bc')]/0x64;_0x59ed67[_0xca25('0x1d8')]=_0x96e834[0x0][_0xca25('0x1d7')]||0x0;_0x59ed67['predictiveIntervalHitRate']=_0x49173d>0x0?_0x49173d:0x1;return _0x5c155a[_0xca25('0x1d2')](_0x53474b,_0x33d52b,_0x46f05b,_0x49173d,_0x1445b8);})[_0xca25('0xb6')](function(_0x443518){return _0x4e4168(_0x443518);})[_0xca25('0xb7')](function(_0x1fd469){return _0x1ce10d(msgResponse(_0xca25('0x1d9'),_0xca25('0x13d'),JSON['stringify'](_0x1fd469)));});}if(_0x59ed67[_0xca25('0x1c6')]==='agentBusyFactor'){return _0x5c155a[_0xca25('0xc6')](_0x59ed67['id'])[_0xca25('0xb6')](function(_0x3c2cb5){var _0x4347c5=_0x59ed67['loggedIn']-_0x3c2cb5[0x0]['outboundQueuePauses'];var _0x223bcb=_0x59ed67[_0xca25('0x1c2')]*0x3c;var _0x81f74f=_0x2c57c3[0x0][_0xca25('0x6b')]+_0x2c57c3[0x0]['predictiveIntervalAvgHoldtime'];var _0x5a6566=(_0x2c57c3[0x0]['predictiveIntervalAnsweredCalls']+_0x2c57c3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2c57c3[0x0][_0xca25('0x6c')])/_0x2c57c3[0x0][_0xca25('0x86')];var _0x4ca0c6=_0x59ed67[_0xca25('0x1bc')]/0x64;_0x59ed67[_0xca25('0x1d8')]=_0x3c2cb5[0x0][_0xca25('0x1d7')]||0x0;_0x59ed67['predictiveIntervalHitRate']=_0x5a6566>0x0?_0x5a6566:0x1;return _0x5c155a[_0xca25('0x1d4')](_0x4347c5,_0x223bcb,_0x81f74f,_0x5a6566,_0x4ca0c6);})[_0xca25('0xb6')](function(_0x3ce19d){return _0x4e4168(_0x3ce19d);})[_0xca25('0xb7')](function(_0x1601cf){return _0x1ce10d(msgResponse(_0xca25('0x1d9'),_0xca25('0x13d'),JSON['stringify'](_0x1601cf)));});}}else{return _0x1ce10d(msgResponse(_0xca25('0x1d5'),_0xca25('0x13d'),_0xca25('0x1da')));}});};};Dialer[_0xca25('0x18')][_0xca25('0x1cb')]=function(_0x38fd62){var _0x14ee13=this;return function(){var _0x29f2ba=0x0;var _0x1ddce6=Math[_0xca25('0x1db')](_0x38fd62[_0xca25('0x74')]*0x3e8);if(_0x1ddce6>0x0){_0x1ddce6=_0x1ddce6<0x64?0x64:_0x1ddce6;loggerPredictive[_0xca25('0x82')](_0x38fd62[_0xca25('0x44')],_0xca25('0x1dc'),_0x1ddce6,_0xca25('0x4d'));_0x38fd62[_0xca25('0x8f')]=setInterval(function(){_0x14ee13['handlePredictive'](_0x38fd62);loggerPredictiveCalls[_0xca25('0x82')](_0xca25('0x1dd'),_0x29f2ba+=0x1);},_0x1ddce6);}else{loggerPredictive['info'](_0x38fd62[_0xca25('0x44')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0xca25('0x1de')]=function(_0x6bf8ae,_0x428f7f){var _0x42615f=this;return function(_0x62cc70){if(_[_0xca25('0x4a')](_0x62cc70)){if(_['isNil'](_0x428f7f[_0xca25('0xd5')])||!_0x428f7f[_0xca25('0x1df')]){if(_0x6bf8ae[_0xca25('0x5d')]===_0xca25('0x1e0')){_0x6bf8ae[_0xca25('0x129')]=_['isUndefined'](_0x6bf8ae[_0xca25('0x129')])?!![]:_0x6bf8ae[_0xca25('0x129')];var _0x59f7a0=uuid['v4']();_0x42615f[_0xca25('0xaa')][_0x59f7a0]=new Action(_0x6bf8ae,_0x428f7f,_0x59f7a0);loggerBooked[_0xca25('0x82')](_0xca25('0x1e1'),_0x59f7a0,_0xca25('0x1e2'),JSON[_0xca25('0x7a')](_0x6bf8ae['queueStatusComplete']),_0xca25('0x1e3'),_0x6bf8ae[_0xca25('0x44')]);if(_0x6bf8ae[_0xca25('0x129')]){_0x6bf8ae[_0xca25('0x129')]=![];_0x42615f[_0xca25('0x29')][_0x42615f[_0xca25('0xaa')][_0x59f7a0][_0xca25('0xb2')]]=[];ami['Action']({'actionid':_0x59f7a0,'action':_0xca25('0x1e4'),'queue':_0x6bf8ae['name']})[_0xca25('0xb7')](function(){_0x42615f['updateOriginated'](_0x6bf8ae);_0x42615f[_0xca25('0xbd')]({'active':![],'ContactId':_0x42615f[_0xca25('0xaa')][_0x59f7a0][_0xca25('0xd3')],'ListId':_0x42615f['actions'][_0x59f7a0]['ListId'],'VoiceQueueId':_0x42615f[_0xca25('0xaa')][_0x59f7a0]['VoiceQueueId']||undefined,'CampaignId':_0x42615f['actions'][_0x59f7a0][_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0x1e5')));delete _0x42615f[_0xca25('0xaa')][_0x59f7a0];});}else{loggerBooked[_0xca25('0x82')](_0xca25('0x1e6'),JSON[_0xca25('0x7a')](_0x6bf8ae['queueStatusComplete']),_0xca25('0x1e3'),_0x6bf8ae[_0xca25('0x44')]);_0x42615f[_0xca25('0xb0')](_0x6bf8ae);_0x42615f[_0xca25('0xbd')]({'active':![],'ContactId':_0x42615f['actions'][_0x59f7a0][_0xca25('0xd3')],'ListId':_0x42615f[_0xca25('0xaa')][_0x59f7a0]['ListId'],'VoiceQueueId':_0x42615f[_0xca25('0xaa')][_0x59f7a0]['VoiceQueueId']||undefined,'CampaignId':_0x42615f['actions'][_0x59f7a0][_0xca25('0xd7')]||undefined})[_0xca25('0xb7')](loggerCatch(_0xca25('0x1e5')));delete _0x42615f[_0xca25('0xaa')][_0x59f7a0];}}else{return _0x42615f['actionOriginate'](_0x6bf8ae,_0x428f7f);}}else{if(getDiff(_0x428f7f[_0xca25('0x1e7')])<_0x6bf8ae[_0xca25('0x1e8')]*0x3c){if(_0x428f7f[_0xca25('0x1e9')]&&!_0x428f7f[_0xca25('0x1e9')]['voicePause']){_0x42615f[_0xca25('0x12a')][_0xca25('0x12b')](_0x428f7f['id'])[_0xca25('0x1b')](function(){_0x42615f[_0xca25('0xb0')](_0x6bf8ae);});}else{_0x42615f[_0xca25('0xbf')]({'active':![]},_0x428f7f['id'],0x1)[_0xca25('0x1b')](function(){_0x42615f['updateOriginated'](_0x6bf8ae);});}}else{_0x6bf8ae['outboundReCallsDay']+=0x1;_0x42615f[_0xca25('0xb0')](_0x6bf8ae);if(_0x6bf8ae[_0xca25('0x1ea')]){_0x42615f[_0xca25('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x428f7f[_0xca25('0xd3')],'ListId':_0x428f7f[_0xca25('0xd4')],'VoiceQueueId':_0x428f7f['VoiceQueueId']||undefined,'CampaignId':_0x428f7f[_0xca25('0xd7')]||undefined})['catch'](loggerCatch(_0xca25('0x1eb')));_0x42615f[_0xca25('0xca')](createObjHistory(_0x6bf8ae,_0x428f7f,_0xca25('0x1ec'),0x17,'RecallInQueue'))[_0xca25('0xb7')](loggerCatch(_0xca25('0x1ed')));}else{_0x42615f[_0xca25('0xd1')](createObjHistory(_0x6bf8ae,_0x428f7f,_0xca25('0x1ee'),0x16,_0xca25('0x1ef')),_0xca25('0x1f0'),'[Originate][HistoryRecallClose]');}}}}else{_0x6bf8ae[_0xca25('0x62')]+=0x1;_0x42615f[_0xca25('0xd1')](createObjHistory(_0x6bf8ae,_0x428f7f,_0xca25('0x1f1'),0xd,_0xca25('0x1f2')),_0xca25('0x1f3'),'[Originate][MoveBlacklist]');throw _0xca25('0x1f4');}};};Dialer['prototype'][_0xca25('0x155')]=function(_0x3a4b9e){var _0x4533d5=this;var _0x3bd77d=_0x3a4b9e['limitCalls']-_0x3a4b9e[_0xca25('0x72')]-_0x3a4b9e[_0xca25('0xc2')];emitCampaignSummary(_0x3a4b9e);if(_0x3bd77d>0x0){if(_0x3bd77d>this[_0xca25('0x21')]){_0x3bd77d=this[_0xca25('0x21')];}_0x3a4b9e[_0xca25('0xc2')]+=_0x3bd77d;this[_0xca25('0xc4')](_0x3a4b9e['id'],_0x3bd77d,_0x3a4b9e[_0xca25('0x1f5')],_0x3a4b9e)['then'](function(_0x492cb2){_0x3a4b9e[_0xca25('0xc2')]-=_0x3bd77d;_0x3a4b9e[_0xca25('0xc2')]=_0x3a4b9e[_0xca25('0xc2')]>0x0?_0x3a4b9e['temp']:0x0;if(!checkContactEmpty(_0x492cb2)){_0x3a4b9e[_0xca25('0x40')]=_0xca25('0x9c');logger[_0xca25('0x82')](_0xca25('0x1f6')+_0x3a4b9e['name']);}else{_0x3a4b9e[_0xca25('0x72')]+=_0x492cb2['length'];_0x3a4b9e['message']=_0xca25('0x1f7');for(var _0x5ae42c=0x0;_0x5ae42c<_0x492cb2[_0xca25('0x96')];_0x5ae42c+=0x1){_0x3a4b9e[_0xca25('0x1f8')]+=0x1;if(_[_0xca25('0xac')](_0x492cb2[_0x5ae42c])||_[_0xca25('0xac')](_0x492cb2[_0x5ae42c][_0xca25('0x162')])||_['isNil'](_0x492cb2[_0x5ae42c][_0xca25('0x162')]['phone'])){_0x4533d5[_0xca25('0xcf')](_0xca25('0x1f9'),_0x3a4b9e,_0x492cb2[_0x5ae42c]);}else{_0x4533d5[_0xca25('0xba')](_[_0xca25('0xd2')](_0x492cb2[_0x5ae42c],['CampaignId',_0xca25('0x1fa')]))['then'](_0x4533d5[_0xca25('0x1de')](_0x3a4b9e,_0x492cb2[_0x5ae42c]))[_0xca25('0xb7')](_0x4533d5['loggerHandler'](_0xca25('0x1fb'),_0x3a4b9e));}}}})['catch'](loggerGetContactDialer(_0xca25('0x1fc'),_0x3a4b9e,_0x3bd77d));}};Dialer[_0xca25('0x18')][_0xca25('0x14f')]=function(_0x344610,_0x2cb75a){var _0x2420ed=this;var _0x2269c6=[];var _0x1d9779=_0x2cb75a>=0x1?_0x2cb75a:0x1;if(_0x344610[_0xca25('0x5d')]===_0xca25('0x1e0')){_0x1d9779=0x1;}var _0x1f459c=Math[_0xca25('0x1db')](_0x344610[_0xca25('0x53')]*_0x1d9779)-_0x344610[_0xca25('0x72')]-_0x344610[_0xca25('0xc2')];emitVoiceQueueSummary(_0x344610);if(_0x344610[_0xca25('0x1fd')]>0x0){var _0x5e8410=_0x344610[_0xca25('0x1fd')]-_0x344610[_0xca25('0x72')]-_0x344610['talking']-_0x344610['temp']-_0x344610['pTalking'];if(_0x1f459c>_0x5e8410){_0x1f459c=_0x5e8410;}}if(_0x1f459c>0x0){if(_0x344610['dialMethod']===_0xca25('0x1e0')){_0x1f459c=0x1;}if(_0x1f459c>this[_0xca25('0x21')]){_0x1f459c=this[_0xca25('0x21')];}_0x344610[_0xca25('0xc2')]+=_0x1f459c;for(var _0xb803f1 in this[_0xca25('0x1f')]){if(typeof this[_0xca25('0x1f')][_0xb803f1]!=='undefined'){if(this[_0xca25('0x1f')][_0xb803f1][_0xca25('0xa5')]===_0xca25('0x1fe')&&this[_0xca25('0x1f')][_0xb803f1][_0xca25('0xae')]===_0xca25('0x1ff')){_0x2269c6[_0xca25('0x126')](this[_0xca25('0x1f')][_0xb803f1]['id']);}}}this['getContactDialer'](_0x344610['id'],_0x2269c6,_0x1f459c,_0x344610[_0xca25('0x1f5')],_0x344610)[_0xca25('0xb6')](function(_0xbf7cc5){_0x344610[_0xca25('0xc2')]-=_0x1f459c;_0x344610[_0xca25('0xc2')]=_0x344610[_0xca25('0xc2')]>0x0?_0x344610[_0xca25('0xc2')]:0x0;if(!checkContactEmpty(_0xbf7cc5)){_0x2420ed[_0xca25('0xb4')](_0x344610)[_0xca25('0xb6')](sendMessageReschedule(_0x344610))[_0xca25('0xb7')](loggerCatch(_0xca25('0x200')));}else{_0x344610[_0xca25('0x72')]+=_0xbf7cc5['length'];_0x344610[_0xca25('0x40')]=_0x344610[_0xca25('0x5d')]===_0xca25('0x1e0')?_0xca25('0x16a'):'RUNNING';for(var _0x3be775=0x0;_0x3be775<_0xbf7cc5[_0xca25('0x96')];_0x3be775+=0x1){if(_[_0xca25('0xac')](_0xbf7cc5[_0x3be775])||_[_0xca25('0xac')](_0xbf7cc5[_0x3be775][_0xca25('0x162')])||_[_0xca25('0xac')](_0xbf7cc5[_0x3be775][_0xca25('0x162')]['phone'])){_0x2420ed[_0xca25('0xcf')](_0xca25('0x1f9'),_0x344610,_0xbf7cc5[_0x3be775]);}else{_0x2420ed['checkIsBlackList'](_[_0xca25('0xd2')](_0xbf7cc5[_0x3be775],[_0xca25('0xd6'),_0xca25('0x1fa')]))[_0xca25('0xb6')](_0x2420ed[_0xca25('0x1de')](_0x344610,_0xbf7cc5[_0x3be775]))[_0xca25('0xb7')](_0x2420ed['loggerHandler'](_0xca25('0x1f9'),_0x344610));}}}})[_0xca25('0xb7')](loggerGetContactDialer(_0xca25('0x201'),_0x344610,_0x1f459c));}};Dialer[_0xca25('0x18')][_0xca25('0x8f')]=function(_0x552e66){if(_0x552e66[_0xca25('0x1fd')]>0x0){var _0x19d284=_0x552e66[_0xca25('0x1fd')]-_0x552e66[_0xca25('0x72')]-_0x552e66[_0xca25('0x9f')];if(_0x19d284>0x0){this[_0xca25('0x202')](_0x552e66);}else{loggerPredictiveCalls['info'](_0xca25('0x203'));}}else{this[_0xca25('0x202')](_0x552e66);}};Dialer['prototype'][_0xca25('0x202')]=function(_0x190862){var _0x3f0cb0=this;var _0x4b3b9d=[];_0x190862[_0xca25('0x72')]+=0x1;for(var _0x1ed3e2 in this[_0xca25('0x1f')]){if(typeof this[_0xca25('0x1f')][_0x1ed3e2]!==_0xca25('0x97')){if(this[_0xca25('0x1f')][_0x1ed3e2]['state']==='not_inuse'&&this[_0xca25('0x1f')][_0x1ed3e2]['status']===_0xca25('0x1ff')){_0x4b3b9d[_0xca25('0x126')](this[_0xca25('0x1f')][_0x1ed3e2]['id']);}}}this[_0xca25('0xc1')](_0x190862['id'],_0x4b3b9d,0x1,_0x190862[_0xca25('0x1f5')],_0x190862)[_0xca25('0xb6')](function(_0x153b5a){if(!checkContactEmpty(_0x153b5a)){checkContactLowerLimitOriginate(_0x190862,0x1,0x0);_0x3f0cb0[_0xca25('0xb4')](_0x190862)[_0xca25('0xb6')](sendMessageReschedule(_0x190862))[_0xca25('0xb7')](loggerCatch(_0xca25('0x200')));}else{_0x190862['message']='RUNNING';if(_[_0xca25('0xac')](_0x153b5a[0x0])||_['isNil'](_0x153b5a[0x0][_0xca25('0x162')])||_['isNil'](_0x153b5a[0x0][_0xca25('0x162')][_0xca25('0x163')])){_0x3f0cb0['emptyContact'](_0xca25('0x1f9'),_0x190862,_0x153b5a[0x0]);}else{_0x3f0cb0[_0xca25('0xb8')](_[_0xca25('0xd2')](_0x153b5a[0x0],['VoiceQueueId',_0xca25('0x1fa')]))['then'](_0x3f0cb0[_0xca25('0x1de')](_0x190862,_0x153b5a[0x0]))[_0xca25('0xb7')](_0x3f0cb0[_0xca25('0xce')](_0xca25('0x204'),_0x190862));}}})[_0xca25('0xb7')](loggerGetContactDialer(_0xca25('0x205'),_0x190862,0x1));emitVoiceQueueSummary(_0x190862);};Dialer['prototype']['abandonmentRate']=function(_0x5c161f,_0x664af1,_0x3365a7,_0x490df2,_0x155733,_0xe65ff6){loggerPredictive[_0xca25('0x82')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xca25('0x82')](_0xca25('0x206'),_0x5c161f);loggerPredictive[_0xca25('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x664af1);loggerPredictive[_0xca25('0x82')](_0xca25('0x207'),_0x3365a7);loggerPredictive[_0xca25('0x82')](_0xca25('0x208'),_0x490df2);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x155733);loggerPredictive[_0xca25('0x82')](_0xca25('0x85'));return new BPromise(function(_0x1e3175,_0x54e93c){if(_0x5c161f<=0x0||isNaN(_0x5c161f)){return _0x54e93c(msgResponse('[abandonmentRate]',_0xca25('0x4c'),_0xca25('0x209')+_0x5c161f));}if(_0x3365a7<=0x0||isNaN(_0x3365a7)){return _0x54e93c(msgResponse(_0xca25('0x20a'),_0xca25('0x4c'),_0xca25('0x20b')+_0x3365a7));}if(_0x490df2<=0x0||isNaN(_0x490df2)){return _0x54e93c(msgResponse(_0xca25('0x20a'),_0xca25('0x4c'),_0xca25('0x20c')+_0x490df2));}if(_0x664af1<=0x0||isNaN(_0x664af1)){return _0x54e93c(msgResponse(_0xca25('0x20a'),_0xca25('0x4c'),_0xca25('0x20d')+_0x664af1));}if(_0x155733<=0x0||isNaN(_0x155733)){return _0x54e93c(msgResponse(_0xca25('0x20a'),'Error',_0xca25('0x20e')+_0x155733));}_0xe65ff6=_0xe65ff6||0x0;var _0x2e0f36=0x1/_0x3365a7;var _0x1b3275=0x0;var _0x41c791=0x0;var _0x2ac6e8=0x0;var _0x6550c2=0x0;for(var _0x2c0cb7=0x0;_0x2ac6e8<_0x155733;_0x2c0cb7+=0x1){_0x41c791=_0x2c0cb7/_0x664af1;_0x1b3275=(_0x490df2*_0x41c791+_0xe65ff6)/_0x2e0f36;_0x2ac6e8=erlangb(_0x1b3275,_0x5c161f);_0x6550c2=_0x1b3275/_0x5c161f*(0x1-erlangb(_0x1b3275,_0x5c161f));}return _0x1e3175({'erlangCalls':_0x2c0cb7,'erlangCallToSecond':_0x664af1/_0x2c0cb7,'erlangAbandonmentRate':_0x2ac6e8,'erlangBusyFactor':_0x6550c2});});};Dialer[_0xca25('0x18')][_0xca25('0x1d4')]=function(_0x26206e,_0x576986,_0x49a5a1,_0x5dd15c,_0x5ccc57,_0x5c4359){loggerPredictive[_0xca25('0x82')](_0xca25('0x20f'));loggerPredictive[_0xca25('0x82')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26206e);loggerPredictive['info'](_0xca25('0x210'),_0x576986);loggerPredictive[_0xca25('0x82')](_0xca25('0x207'),_0x49a5a1);loggerPredictive[_0xca25('0x82')]('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',_0x5dd15c);loggerPredictive[_0xca25('0x82')](_0xca25('0x211'),_0x5ccc57);loggerPredictive[_0xca25('0x82')](_0xca25('0x85'));return new BPromise(function(_0x26c909,_0x1356be){if(_0x26206e<=0x0||isNaN(_0x26206e)){return _0x1356be(msgResponse(_0xca25('0x212'),_0xca25('0x4c'),_0xca25('0x209')+_0x26206e));}if(_0x49a5a1<=0x0||isNaN(_0x49a5a1)){return _0x1356be(msgResponse(_0xca25('0x212'),_0xca25('0x4c'),_0xca25('0x20b')+_0x49a5a1));}if(_0x5dd15c<=0x0||isNaN(_0x5dd15c)){return _0x1356be(msgResponse(_0xca25('0x212'),'Error',_0xca25('0x20c')+_0x5dd15c));}if(_0x576986<=0x0||isNaN(_0x576986)){return _0x1356be(msgResponse(_0xca25('0x212'),_0xca25('0x4c'),'interval\x20=\x20'+_0x576986));}if(_0x5ccc57<=0x0||isNaN(_0x5ccc57)){return _0x1356be(msgResponse(_0xca25('0x212'),_0xca25('0x4c'),_0xca25('0x213')+_0x5ccc57));}_0x5c4359=_0x5c4359||0x0;var _0x4bf379=0x1/_0x49a5a1;var _0x3aefa1=0x0;var _0xfc878a=0x0;var _0x458344=0x0;var _0x281333=0x0;for(var _0x5a6d0c=0x0;_0x281333<_0x5ccc57;_0x5a6d0c+=0x1){_0xfc878a=_0x5a6d0c/_0x576986;_0x3aefa1=(_0x5dd15c*_0xfc878a+_0x5c4359)/_0x4bf379;_0x458344=erlangb(_0x3aefa1,_0x26206e);_0x281333=_0x3aefa1/_0x26206e*(0x1-erlangb(_0x3aefa1,_0x26206e));}return _0x26c909({'erlangCalls':_0x5a6d0c,'erlangCallToSecond':_0x576986/_0x5a6d0c,'erlangAbandonmentRate':_0x458344,'erlangBusyFactor':_0x281333});});};module[_0xca25('0x214')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 354ad1d..eff8b9b 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc03c=['talktime','queue','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime'];(function(_0x3f1739,_0x19c68c){var _0x1a3b68=function(_0x142b92){while(--_0x142b92){_0x3f1739['push'](_0x3f1739['shift']());}};_0x1a3b68(++_0x19c68c);}(_0xc03c,0xae));var _0xcc03=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0xc03c[_0x5f25b3];return _0x4ab9bf;};'use strict';var util=require(_0xcc03('0x0'));var _=require('lodash');var moment=require(_0xcc03('0x1'));function getSeconds(_0x320f16,_0x363251){var _0x4f9d7c=moment(_0x320f16)[_0xcc03('0x2')](0x0);var _0x56b115=moment(_0x363251)[_0xcc03('0x2')](0x0);return _0x4f9d7c[_0xcc03('0x3')](_0x56b115,_0xcc03('0x4'));}function QueueCallerAbandon(_0x107e6a,_0x210499){this[_0xcc03('0x5')]=_0x107e6a['scheduledat'];this['type']=_0x107e6a[_0xcc03('0x6')];this[_0xcc03('0x7')]=_0x107e6a[_0xcc03('0x6')]===_0xcc03('0x8')?'queue':_0x107e6a[_0xcc03('0x6')];this[_0xcc03('0x9')]=_0x107e6a[_0xcc03('0x9')];this['countcongestionretry']=_0x107e6a[_0xcc03('0xa')];this['countnoanswerretry']=_0x107e6a[_0xcc03('0xb')];this[_0xcc03('0xc')]=_0x107e6a[_0xcc03('0x9')]+_0x107e6a[_0xcc03('0xa')]+_0x107e6a[_0xcc03('0xb')]+_0x107e6a[_0xcc03('0xd')]+_0x107e6a[_0xcc03('0xe')]+_0x107e6a[_0xcc03('0xf')]+_0x107e6a['countmachineretry']+_0x107e6a[_0xcc03('0x10')];this['countnosuchnumberretry']=_0x107e6a[_0xcc03('0xd')];this['countdropretry']=_0x107e6a[_0xcc03('0xe')];this['countabandonedretry']=_0x107e6a[_0xcc03('0xf')];this[_0xcc03('0x11')]=_0x107e6a[_0xcc03('0x11')];this[_0xcc03('0x10')]=_0x107e6a[_0xcc03('0x10')];this[_0xcc03('0x12')]=_0x210499[_0xcc03('0x12')];this[_0xcc03('0x13')]=_0x107e6a['name'];this[_0xcc03('0x14')]=_0x107e6a[_0xcc03('0x15')];this[_0xcc03('0x16')]=_0x107e6a[_0xcc03('0x16')];this[_0xcc03('0x17')]=_0x107e6a[_0xcc03('0x17')];this[_0xcc03('0x18')]=_0x107e6a[_0xcc03('0x18')];this['endtime']=this[_0xcc03('0x18')];this[_0xcc03('0x19')]=getSeconds(_0x107e6a['responsetime'],_0x107e6a[_0xcc03('0x16')]);this['holdtime']=getSeconds(this['droptime'],_0x107e6a[_0xcc03('0x17')]);this[_0xcc03('0x1a')]=0x0;this[_0xcc03('0x1b')]=_0x210499['queue'];this['membername']=_0x210499['connectedlinename'];this[_0xcc03('0x1c')]=_0x210499[_0xcc03('0x1c')];this[_0xcc03('0x1d')]=_0x107e6a[_0xcc03('0x1d')];this[_0xcc03('0x1e')]=_0x107e6a[_0xcc03('0x1e')];this[_0xcc03('0x1f')]=_0x107e6a['callbackat'];this[_0xcc03('0x20')]=_0x107e6a[_0xcc03('0x20')];this['ContactId']=_0x107e6a[_0xcc03('0x21')];this[_0xcc03('0x22')]=_0x107e6a[_0xcc03('0x22')];this[_0xcc03('0x23')]=_0x107e6a[_0xcc03('0x23')];this['VoiceQueueId']=_0x107e6a[_0xcc03('0x24')];this['CampaignId']=_0x107e6a['CampaignId'];this[_0xcc03('0x25')]=_0x107e6a['originatecalleridnum']||'';this[_0xcc03('0x26')]=_0x107e6a[_0xcc03('0x26')]||'';}module[_0xcc03('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xd9d0=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xd9d0,0xe5));var _0x0d9d=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xd9d0[_0x25a42a];return _0x1129b1;};'use strict';var util=require(_0x0d9d('0x0'));var _=require(_0x0d9d('0x1'));var moment=require(_0x0d9d('0x2'));function getSeconds(_0x43f32e,_0x501739){var _0x33551d=moment(_0x43f32e)['milliseconds'](0x0);var _0x3fd7e9=moment(_0x501739)[_0x0d9d('0x3')](0x0);return _0x33551d['diff'](_0x3fd7e9,_0x0d9d('0x4'));}function QueueCallerAbandon(_0x1d6f2a,_0x50f184){this[_0x0d9d('0x5')]=_0x1d6f2a[_0x0d9d('0x5')];this[_0x0d9d('0x6')]=_0x1d6f2a[_0x0d9d('0x6')];this[_0x0d9d('0x7')]=_0x1d6f2a[_0x0d9d('0x6')]===_0x0d9d('0x8')?'queue':_0x1d6f2a[_0x0d9d('0x6')];this[_0x0d9d('0x9')]=_0x1d6f2a[_0x0d9d('0x9')];this[_0x0d9d('0xa')]=_0x1d6f2a[_0x0d9d('0xa')];this['countnoanswerretry']=_0x1d6f2a[_0x0d9d('0xb')];this[_0x0d9d('0xc')]=_0x1d6f2a[_0x0d9d('0x9')]+_0x1d6f2a[_0x0d9d('0xa')]+_0x1d6f2a[_0x0d9d('0xb')]+_0x1d6f2a[_0x0d9d('0xd')]+_0x1d6f2a[_0x0d9d('0xe')]+_0x1d6f2a[_0x0d9d('0xf')]+_0x1d6f2a[_0x0d9d('0x10')]+_0x1d6f2a[_0x0d9d('0x11')];this[_0x0d9d('0xd')]=_0x1d6f2a['countnosuchnumberretry'];this[_0x0d9d('0xe')]=_0x1d6f2a[_0x0d9d('0xe')];this[_0x0d9d('0xf')]=_0x1d6f2a[_0x0d9d('0xf')];this['countmachineretry']=_0x1d6f2a[_0x0d9d('0x10')];this[_0x0d9d('0x11')]=_0x1d6f2a['countagentrejectretry'];this[_0x0d9d('0x12')]=_0x50f184[_0x0d9d('0x12')];this['calleridname']=_0x1d6f2a[_0x0d9d('0x13')];this[_0x0d9d('0x14')]=_0x1d6f2a[_0x0d9d('0x15')];this[_0x0d9d('0x16')]=_0x1d6f2a['starttime'];this['responsetime']=_0x1d6f2a[_0x0d9d('0x17')];this[_0x0d9d('0x18')]=_0x1d6f2a['droptime'];this[_0x0d9d('0x19')]=this[_0x0d9d('0x18')];this[_0x0d9d('0x1a')]=getSeconds(_0x1d6f2a[_0x0d9d('0x17')],_0x1d6f2a[_0x0d9d('0x16')]);this[_0x0d9d('0x1b')]=getSeconds(this['droptime'],_0x1d6f2a['responsetime']);this[_0x0d9d('0x1c')]=0x0;this[_0x0d9d('0x1d')]=_0x50f184[_0x0d9d('0x1d')];this[_0x0d9d('0x1e')]=_0x50f184[_0x0d9d('0x1f')];this[_0x0d9d('0x20')]=_0x50f184[_0x0d9d('0x20')];this[_0x0d9d('0x21')]=_0x1d6f2a['callback'];this['callbackuniqueid']=_0x1d6f2a[_0x0d9d('0x22')];this[_0x0d9d('0x23')]=_0x1d6f2a[_0x0d9d('0x23')];this[_0x0d9d('0x24')]=_0x1d6f2a[_0x0d9d('0x24')];this[_0x0d9d('0x25')]=_0x1d6f2a[_0x0d9d('0x25')];this[_0x0d9d('0x26')]=_0x1d6f2a[_0x0d9d('0x26')];this['UserId']=_0x1d6f2a[_0x0d9d('0x27')];this['VoiceQueueId']=_0x1d6f2a[_0x0d9d('0x28')];this['CampaignId']=_0x1d6f2a[_0x0d9d('0x29')];this[_0x0d9d('0x2a')]=_0x1d6f2a['originatecalleridnum']||'';this['originatecalleridname']=_0x1d6f2a[_0x0d9d('0x2b')]||'';}module[_0x0d9d('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5c88e6a..16f7346 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(_0xfc9103,_0x26c723){var _0x678ea4=function(_0x26d76c){while(--_0x26d76c){_0xfc9103['push'](_0xfc9103['shift']());}};_0x678ea4(++_0x26c723);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x5a565f,_0x992ea2){var _0x2616b2=function(_0x2f4fe8){while(--_0x2f4fe8){_0x5a565f['push'](_0x5a565f['shift']());}};_0x2616b2(++_0x992ea2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 2eb43c1..e285eb2 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 _0xa286=['syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','prototype','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../ami','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','newstate'];(function(_0x44a101,_0x3729bc){var _0x351900=function(_0x27008b){while(--_0x27008b){_0x44a101['push'](_0x44a101['shift']());}};_0x351900(++_0x3729bc);}(_0xa286,0xd7));var _0x6a28=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xa286[_0x1b2ff7];return _0x31656a;};'use strict';var util=require(_0x6a28('0x0'));var _=require(_0x6a28('0x1'));var BPromise=require(_0x6a28('0x2'));var uuid=require(_0x6a28('0x3'));var moment=require(_0x6a28('0x4'));var path=require(_0x6a28('0x5'));var tiff2pdf=require(_0x6a28('0x6'));var gs=require('./util/gs');var logger=require('../../../config/logger')('fax');var ami=require(_0x6a28('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x6a28('0x8'));var ut=require(_0x6a28('0x9'));var Action=require(_0x6a28('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x6a28('0xb'));var faxMessage=require(_0x6a28('0xc'));function Fax(_0x5e1520){this[_0x6a28('0xd')]={};this[_0x6a28('0xe')]=_0x5e1520[_0x6a28('0xe')];this[_0x6a28('0xf')]=_0x5e1520[_0x6a28('0xf')];this[_0x6a28('0x10')]={};ami['on']('newchannel',this[_0x6a28('0x11')][_0x6a28('0x12')](this));ami['on'](_0x6a28('0x13'),this['syncVarSet'][_0x6a28('0x12')](this));ami['on'](_0x6a28('0x14'),this[_0x6a28('0x15')][_0x6a28('0x12')](this));ami['on'](_0x6a28('0x16'),this[_0x6a28('0x17')]['bind'](this));ami['on'](_0x6a28('0x18'),this[_0x6a28('0x19')][_0x6a28('0x12')](this));ami['on'](_0x6a28('0x1a'),this[_0x6a28('0x1b')][_0x6a28('0x12')](this));ami['on'](_0x6a28('0x1c'),this[_0x6a28('0x1d')][_0x6a28('0x12')](this));ami['on'](_0x6a28('0x1e'),this['syncOriginateResponse'][_0x6a28('0x12')](this));}Fax['prototype']['syncNewchannel']=function(_0x4a6499){if(_0x4a6499[_0x6a28('0x1f')]==='from-voip-provider'){for(var _0x2156ca in this[_0x6a28('0xe')]){if(this[_0x6a28('0xe')][_0x6a28('0x20')](_0x2156ca)){if(_0x4a6499[_0x6a28('0x21')]===this['faxAccounts'][_0x2156ca][_0x6a28('0x22')]){this[_0x6a28('0xd')][_0x4a6499[_0x6a28('0x23')]]={};this[_0x6a28('0xd')][_0x4a6499['uniqueid']][_0x6a28('0x24')]=_0x4a6499[_0x6a28('0x24')];this[_0x6a28('0xd')][_0x4a6499['uniqueid']]['id']=this[_0x6a28('0xe')][_0x2156ca]['id'];this[_0x6a28('0xd')][_0x4a6499[_0x6a28('0x23')]][_0x6a28('0x25')]=this[_0x6a28('0xe')][_0x2156ca]['name'];logger[_0x6a28('0x26')](_0x4a6499['uniqueid'],_0x6a28('0x27'));}}}}if(this[_0x6a28('0x10')][_0x4a6499[_0x6a28('0x23')]]){this['channels'][_0x4a6499[_0x6a28('0x23')]]={};this[_0x6a28('0xd')][_0x4a6499[_0x6a28('0x23')]][_0x6a28('0x24')]=_0x4a6499['channel'];logger[_0x6a28('0x26')](_0x4a6499['uniqueid'],_0x6a28('0x27'));}};Fax['prototype']['syncVarSet']=function(_0x39be72){if(this[_0x6a28('0xd')][_0x39be72['uniqueid']]){for(var _0x3d3a3a in _0x39be72[_0x6a28('0x28')]){if(_0x39be72[_0x6a28('0x28')]['hasOwnProperty'](_0x3d3a3a)){this[_0x6a28('0xd')][_0x39be72[_0x6a28('0x23')]][_0x3d3a3a]=_0x39be72[_0x6a28('0x29')];}}}};Fax[_0x6a28('0x2a')][_0x6a28('0x15')]=function(_0x41905d){if(this['channels'][_0x41905d[_0x6a28('0x23')]]){this['channels'][_0x41905d[_0x6a28('0x23')]][_0x6a28('0x2b')]=_0x41905d['channelstate'];this[_0x6a28('0xd')][_0x41905d[_0x6a28('0x23')]][_0x6a28('0x2c')]=_0x41905d['channelstatedesc'];}};Fax[_0x6a28('0x2a')][_0x6a28('0x17')]=function(_0x181b7b){if(this[_0x6a28('0xd')][_0x181b7b[_0x6a28('0x23')]]){for(var _0x2a69e0 in _0x181b7b[_0x6a28('0x28')]){if(_0x181b7b[_0x6a28('0x28')][_0x6a28('0x20')](_0x2a69e0)){this[_0x6a28('0xd')][_0x181b7b['uniqueid']][_0x2a69e0]=_0x181b7b[_0x6a28('0x29')];}}}};Fax[_0x6a28('0x2a')][_0x6a28('0x19')]=function(_0x6d49b1){if(this[_0x6a28('0xd')][_0x6d49b1[_0x6a28('0x23')]]){this[_0x6a28('0xd')][_0x6d49b1[_0x6a28('0x23')]][_0x6a28('0x2d')]=_0x6d49b1[_0x6a28('0x2d')];this[_0x6a28('0xd')][_0x6d49b1[_0x6a28('0x23')]]['status']=_0x6d49b1[_0x6a28('0x2e')];this[_0x6a28('0xd')][_0x6d49b1[_0x6a28('0x23')]]['localstationid']=_0x6d49b1[_0x6a28('0x22')];this[_0x6a28('0xd')][_0x6d49b1[_0x6a28('0x23')]]['filename']=_0x6d49b1['filename'];logger[_0x6a28('0x26')](_0x6d49b1[_0x6a28('0x23')],_0x6a28('0x2f'));}};Fax[_0x6a28('0x2a')]['syncReceiveFax']=function(_0x82a7b3){var _0x5a73f=this;if(this[_0x6a28('0xd')][_0x82a7b3[_0x6a28('0x23')]]){var _0x3e985d=this['channels'][_0x82a7b3[_0x6a28('0x23')]]['id'];this[_0x6a28('0xd')][_0x82a7b3[_0x6a28('0x23')]][_0x6a28('0x30')]=_0x82a7b3[_0x6a28('0x30')];this['channels'][_0x82a7b3[_0x6a28('0x23')]][_0x6a28('0x31')]=_0x82a7b3[_0x6a28('0x31')];this['channels'][_0x82a7b3['uniqueid']][_0x6a28('0x22')]=_0x82a7b3[_0x6a28('0x22')];this[_0x6a28('0xd')][_0x82a7b3[_0x6a28('0x23')]][_0x6a28('0x32')]=_0x82a7b3[_0x6a28('0x32')];this[_0x6a28('0xd')][_0x82a7b3['uniqueid']][_0x6a28('0x33')]=_0x82a7b3[_0x6a28('0x33')];this['channels'][_0x82a7b3['uniqueid']][_0x6a28('0x34')]=_0x82a7b3[_0x6a28('0x34')];this['channels'][_0x82a7b3[_0x6a28('0x23')]][_0x6a28('0x35')]=_0x82a7b3['calleridnum'];if(this[_0x6a28('0xd')][_0x82a7b3['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x82a7b3[_0x6a28('0x34')],_0x6a28('0x36'),function(_0xa491ac){logger[_0x6a28('0x26')](_0x82a7b3[_0x6a28('0x23')],_0x6a28('0x37'),_0xa491ac['message']);attachment[_0x6a28('0x38')]({'name':path[_0x6a28('0x39')](_0x82a7b3[_0x6a28('0x34')])['name'],'basename':path[_0x6a28('0x39')](_0x82a7b3[_0x6a28('0x34')])[_0x6a28('0x25')]+_0x6a28('0x3a'),'type':_0x6a28('0x3b')})[_0x6a28('0x3c')](function(_0x2c39d4){faxAccount['notify'](_0x3e985d,{'from':_0x82a7b3['calleridnum'],'mapKey':_0x6a28('0x3d'),'body':path['parse'](_0x82a7b3['filename'])[_0x6a28('0x25')]+'.pdf','AttachmentId':_0x2c39d4['id']})[_0x6a28('0x3e')](function(_0x5f001b){logger[_0x6a28('0x3f')](_0x82a7b3['uniqueid'],_0x6a28('0x40'),JSON[_0x6a28('0x41')](_0x5f001b));});})[_0x6a28('0x3e')](function(_0x1e66b6){logger['error'](_0x82a7b3[_0x6a28('0x23')],_0x6a28('0x42'),JSON['stringify'](_0x1e66b6));});});}logger['info'](_0x82a7b3[_0x6a28('0x23')],_0x6a28('0x42'));}};Fax[_0x6a28('0x2a')][_0x6a28('0x43')]=function(_0x4acf17){if(this[_0x6a28('0x10')][_0x4acf17[_0x6a28('0x23')]]){_[_0x6a28('0x44')](this['channels'][_0x4acf17[_0x6a28('0x23')]],_[_0x6a28('0x45')](_0x4acf17,[_0x6a28('0x46'),_0x6a28('0x47')]));}};function updateStatus(_0x15858c){if(_0x15858c[_0x6a28('0x48')]){faxMessage[_0x6a28('0x49')](_0x15858c['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x6a28('0x3c')](function(_0x6ad342){ut[_0x6a28('0x4a')]('[Fax][Message][Error][Updated]',_0x6ad342);})[_0x6a28('0x3e')](function(_0x318391){ut[_0x6a28('0x4a')](_0x6a28('0x4b'),_0x318391);});}else{ut['logger'](_0x6a28('0x4c'));}}Fax[_0x6a28('0x2a')][_0x6a28('0x4d')]=function(_0x3ad96f,_0x3e65c1,_0x1af6ca){var _0x4cc212=this;var _0x9c5516={};if(_0x3e65c1){_0x9c5516={'read':_0x3e65c1};}else{_0x9c5516={'failMessage':_0x1af6ca};}if(this[_0x6a28('0x10')][_0x3ad96f][_0x6a28('0x48')]){faxMessage[_0x6a28('0x49')](this[_0x6a28('0x10')][_0x3ad96f]['AttachmentId'],_0x9c5516)[_0x6a28('0x3c')](function(_0x52824f){ut[_0x6a28('0x4a')](_0x6a28('0x4e'),_0x52824f);})[_0x6a28('0x3e')](function(_0x12336e){ut[_0x6a28('0x4a')]('[Fax][Message][NoUpdate1]',_0x12336e);})['finally'](function(){delete _0x4cc212['channels'][_0x3ad96f];delete _0x4cc212[_0x6a28('0x10')][_0x3ad96f];});}else{ut['logger'](_0x6a28('0x4f'));delete this[_0x6a28('0xd')][_0x3ad96f];delete this[_0x6a28('0x10')][_0x3ad96f];}};Fax['prototype'][_0x6a28('0x1d')]=function(_0xbcbbac){var _0x2529ea=this;if(this[_0x6a28('0xd')][_0xbcbbac[_0x6a28('0x23')]]){if(this[_0x6a28('0x10')][_0xbcbbac[_0x6a28('0x23')]]){this['channels'][_0xbcbbac[_0x6a28('0x23')]]['id']=this[_0x6a28('0x10')][_0xbcbbac[_0x6a28('0x23')]]['id'];this['channels'][_0xbcbbac[_0x6a28('0x23')]]['name']=this[_0x6a28('0x10')][_0xbcbbac[_0x6a28('0x23')]][_0x6a28('0x25')];}logger['info'](_0xbcbbac[_0x6a28('0x23')],this[_0x6a28('0x10')][_0xbcbbac[_0x6a28('0x23')]]?_0x6a28('0x50'):'\x20hangup\x20faxRiceive\x20',JSON[_0x6a28('0x41')](this['channels'][_0xbcbbac[_0x6a28('0x23')]]));if(this[_0x6a28('0x10')][_0xbcbbac[_0x6a28('0x23')]]){if(this[_0x6a28('0xd')][_0xbcbbac[_0x6a28('0x23')]]['faxpages']>0x0&&this[_0x6a28('0xd')][_0xbcbbac[_0x6a28('0x23')]]['faxstatus']===_0x6a28('0x51')){this[_0x6a28('0x4d')](_0xbcbbac['uniqueid'],!![]);}else{this[_0x6a28('0x4d')](_0xbcbbac[_0x6a28('0x23')],![],this[_0x6a28('0xd')][_0xbcbbac[_0x6a28('0x23')]][_0x6a28('0x52')]?_0x6a28('0x53')+this['channels'][_0xbcbbac['uniqueid']][_0x6a28('0x52')]:_0x6a28('0x54'));}}}};Fax[_0x6a28('0x2a')][_0x6a28('0x55')]=function(_0x4c4ee6){var _0x53016e=this;return new BPromise(function(_0x33bcb4,_0x321c3e){_0x53016e[_0x6a28('0x56')](_0x4c4ee6,_0x53016e[_0x6a28('0xe')][_0x4c4ee6[_0x6a28('0x57')]])['then'](function(_0x107963){ut[_0x6a28('0x4a')](_0x6a28('0x58'),_0x107963);_0x33bcb4(ut[_0x6a28('0x59')]('Fax\x20received'));})[_0x6a28('0x3e')](function(_0x5aeccb){ut[_0x6a28('0x4a')](_0x6a28('0x5a'),_0x5aeccb);updateStatus(_0x4c4ee6);_0x321c3e(ut[_0x6a28('0x59')]('Fax\x20failed'));});});};Fax['prototype'][_0x6a28('0x5b')]=function(_0x2afb34){var _0x5e35d0=this;return new BPromise(function(_0x40aa0e,_0x59c8ac){var _0x4157be=_0x5e35d0['checkTrunk'](_0x5e35d0[_0x6a28('0xe')][_0x2afb34[_0x6a28('0x57')]][_0x6a28('0x5c')],_0x2afb34);if(_0x4157be[_0x6a28('0x5d')]){_0x40aa0e(ut[_0x6a28('0x59')](_0x6a28('0x5e')));}else{_0x59c8ac(ut[_0x6a28('0x59')](_0x4157be[_0x6a28('0x59')]));}});};function originate(_0x1a2061,_0x3d2e0c,_0x778170){return new BPromise(function(_0x3ab097,_0x3a2340){if(_0x778170){var _0x54d008=util[_0x6a28('0x5f')](_0x6a28('0x60'),path[_0x6a28('0x39')](_0x1a2061[_0x6a28('0x5')])[_0x6a28('0x25')],_0x1a2061[_0x6a28('0x5')]);gs[_0x6a28('0x61')](_0x54d008)['then'](function(){_0x1a2061[_0x6a28('0x5')]=util['format'](_0x6a28('0x62'),path['parse'](_0x1a2061[_0x6a28('0x5')])[_0x6a28('0x63')],path[_0x6a28('0x39')](_0x1a2061[_0x6a28('0x5')])[_0x6a28('0x25')]);_0x3d2e0c[_0x6a28('0x64')]=_0x1a2061[_0x6a28('0x5')];ut[_0x6a28('0x4a')](_0x6a28('0x65'),'');ami[_0x6a28('0x66')](ut[_0x6a28('0x67')](_0x1a2061,_0x3d2e0c))[_0x6a28('0x3c')](function(_0x4b702c){_0x3ab097(_0x4b702c);})[_0x6a28('0x3e')](function(_0x4ece38){_0x3a2340(_0x4ece38);});})['catch'](function(_0x22f8dd){_0x3a2340(_0x22f8dd);});}else{ami[_0x6a28('0x66')](ut[_0x6a28('0x67')](_0x1a2061,_0x3d2e0c))[_0x6a28('0x3c')](function(_0xf37ae6){_0x3ab097(_0xf37ae6);})[_0x6a28('0x3e')](function(_0x2eec36){_0x3a2340(_0x2eec36);});}});}Fax[_0x6a28('0x2a')][_0x6a28('0x56')]=function(_0x30fa4c,_0x584799){var _0x5c1f49=this;return new BPromise(function(_0x4acecd,_0x270e3d){var _0x2c44a8=uuid['v4']();var _0x2abbfa=ut[_0x6a28('0x68')](_0x30fa4c,_0x584799);_0x5c1f49[_0x6a28('0x10')][_0x2c44a8]=new Action(_0x2c44a8,_0x584799,_0x30fa4c);var _0xc65a9f=_0x5c1f49[_0x6a28('0x10')][_0x2c44a8];if(path[_0x6a28('0x39')](_0x30fa4c[_0x6a28('0x5')])['ext']===_0x6a28('0x3a')){originate(_0xc65a9f,_0x2abbfa,!![])[_0x6a28('0x3c')](function(_0x40df7a){_0x4acecd(_0x40df7a);})[_0x6a28('0x3e')](function(_0xb71a98){_0x270e3d(_0xb71a98);});}else{originate(_0xc65a9f,_0x2abbfa,![])[_0x6a28('0x3c')](function(_0x37a024){_0x4acecd(_0x37a024);})[_0x6a28('0x3e')](function(_0xfcb3a1){_0x270e3d(_0xfcb3a1);});}});};Fax[_0x6a28('0x2a')]['isTrunkReachable']=function(_0x4d3bb0){return!_['isNil'](_0x4d3bb0)&&!_[_0x6a28('0x69')](_0x4d3bb0[_0x6a28('0x25')])&&!_[_0x6a28('0x69')](_0x4d3bb0[_0x6a28('0x6a')])&&_0x4d3bb0[_0x6a28('0x6a')]&&!_[_0x6a28('0x69')](this[_0x6a28('0xf')][util[_0x6a28('0x5f')](_0x6a28('0x6b'),_0x4d3bb0[_0x6a28('0x25')])])&&!_[_0x6a28('0x69')](this[_0x6a28('0xf')][util['format'](_0x6a28('0x6b'),_0x4d3bb0['name'])][_0x6a28('0x2e')])&&(this[_0x6a28('0xf')][util[_0x6a28('0x5f')](_0x6a28('0x6b'),_0x4d3bb0[_0x6a28('0x25')])]['status']===_0x6a28('0x6c')||this[_0x6a28('0xf')][util['format'](_0x6a28('0x6b'),_0x4d3bb0[_0x6a28('0x25')])][_0x6a28('0x2e')]===_0x6a28('0x6d'));};Fax[_0x6a28('0x2a')][_0x6a28('0x6e')]=function(_0x3e545d,_0x4b6593){if(!this['isTrunkReachable'](_0x3e545d)){ut['logger'](_0x6a28('0x6f'),_[_0x6a28('0x69')](_0x3e545d)?'':_0x3e545d['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6a28('0x70')};}if(_[_0x6a28('0x69')](_0x4b6593['fax'])){ut[_0x6a28('0x4a')](_0x6a28('0x71'),JSON[_0x6a28('0x41')](_0x4b6593));return{'isValid':![],'message':_0x6a28('0x72')};}if(_['isNil'](_0x4b6593[_0x6a28('0x5')])){ut[_0x6a28('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x4b6593));return{'isValid':![],'message':_0x6a28('0x73')};}return{'isValid':!![],'message':_0x6a28('0x74')};};module[_0x6a28('0x75')]=Fax; \ No newline at end of file +var _0x5ffb=['varset','syncVarSet','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','Fax\x20failed','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind'];(function(_0x1a6401,_0x5c4b2e){var _0x4d6f0d=function(_0x115f15){while(--_0x115f15){_0x1a6401['push'](_0x1a6401['shift']());}};_0x4d6f0d(++_0x5c4b2e);}(_0x5ffb,0x1d3));var _0xb5ff=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5ffb[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0xb5ff('0x0'));var _=require(_0xb5ff('0x1'));var BPromise=require(_0xb5ff('0x2'));var uuid=require(_0xb5ff('0x3'));var moment=require(_0xb5ff('0x4'));var path=require(_0xb5ff('0x5'));var tiff2pdf=require(_0xb5ff('0x6'));var gs=require(_0xb5ff('0x7'));var logger=require(_0xb5ff('0x8'))(_0xb5ff('0x9'));var ami=require(_0xb5ff('0xa'));var rpcDb=require(_0xb5ff('0xb'));var Channel=require(_0xb5ff('0xc'));var ut=require(_0xb5ff('0xd'));var Action=require(_0xb5ff('0xe'));var faxAccount=require(_0xb5ff('0xf'));var attachment=require(_0xb5ff('0x10'));var faxMessage=require(_0xb5ff('0x11'));function Fax(_0x5ee8bf){this[_0xb5ff('0x12')]={};this[_0xb5ff('0x13')]=_0x5ee8bf['faxAccounts'];this[_0xb5ff('0x14')]=_0x5ee8bf['trunks'];this[_0xb5ff('0x15')]={};ami['on'](_0xb5ff('0x16'),this[_0xb5ff('0x17')][_0xb5ff('0x18')](this));ami['on'](_0xb5ff('0x19'),this[_0xb5ff('0x1a')][_0xb5ff('0x18')](this));ami['on']('newstate',this[_0xb5ff('0x1b')][_0xb5ff('0x18')](this));ami['on'](_0xb5ff('0x1c'),this['syncNewExten'][_0xb5ff('0x18')](this));ami['on']('faxstatus',this[_0xb5ff('0x1d')][_0xb5ff('0x18')](this));ami['on'](_0xb5ff('0x1e'),this[_0xb5ff('0x1f')][_0xb5ff('0x18')](this));ami['on'](_0xb5ff('0x20'),this[_0xb5ff('0x21')][_0xb5ff('0x18')](this));ami['on'](_0xb5ff('0x22'),this[_0xb5ff('0x23')][_0xb5ff('0x18')](this));}Fax[_0xb5ff('0x24')][_0xb5ff('0x17')]=function(_0x3fc230){if(_0x3fc230[_0xb5ff('0x25')]===_0xb5ff('0x26')){for(var _0x32be7e in this['faxAccounts']){if(this[_0xb5ff('0x13')][_0xb5ff('0x27')](_0x32be7e)){if(_0x3fc230[_0xb5ff('0x28')]===this[_0xb5ff('0x13')][_0x32be7e][_0xb5ff('0x29')]){this['channels'][_0x3fc230[_0xb5ff('0x2a')]]={};this[_0xb5ff('0x12')][_0x3fc230['uniqueid']][_0xb5ff('0x2b')]=_0x3fc230[_0xb5ff('0x2b')];this[_0xb5ff('0x12')][_0x3fc230[_0xb5ff('0x2a')]]['id']=this[_0xb5ff('0x13')][_0x32be7e]['id'];this[_0xb5ff('0x12')][_0x3fc230['uniqueid']][_0xb5ff('0x2c')]=this[_0xb5ff('0x13')][_0x32be7e]['name'];logger['info'](_0x3fc230[_0xb5ff('0x2a')],_0xb5ff('0x2d'));}}}}if(this[_0xb5ff('0x15')][_0x3fc230[_0xb5ff('0x2a')]]){this[_0xb5ff('0x12')][_0x3fc230['uniqueid']]={};this[_0xb5ff('0x12')][_0x3fc230['uniqueid']][_0xb5ff('0x2b')]=_0x3fc230['channel'];logger[_0xb5ff('0x2e')](_0x3fc230[_0xb5ff('0x2a')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0xb5ff('0x1a')]=function(_0x26f0cd){if(this[_0xb5ff('0x12')][_0x26f0cd['uniqueid']]){for(var _0x6bfa09 in _0x26f0cd[_0xb5ff('0x2f')]){if(_0x26f0cd['variable'][_0xb5ff('0x27')](_0x6bfa09)){this[_0xb5ff('0x12')][_0x26f0cd[_0xb5ff('0x2a')]][_0x6bfa09]=_0x26f0cd[_0xb5ff('0x30')];}}}};Fax[_0xb5ff('0x24')][_0xb5ff('0x1b')]=function(_0x4767c9){if(this[_0xb5ff('0x12')][_0x4767c9[_0xb5ff('0x2a')]]){this['channels'][_0x4767c9[_0xb5ff('0x2a')]]['channelstate']=_0x4767c9['channelstate'];this[_0xb5ff('0x12')][_0x4767c9[_0xb5ff('0x2a')]][_0xb5ff('0x31')]=_0x4767c9[_0xb5ff('0x31')];}};Fax['prototype'][_0xb5ff('0x32')]=function(_0x250fa0){if(this[_0xb5ff('0x12')][_0x250fa0[_0xb5ff('0x2a')]]){for(var _0x39005e in _0x250fa0[_0xb5ff('0x2f')]){if(_0x250fa0[_0xb5ff('0x2f')]['hasOwnProperty'](_0x39005e)){this['channels'][_0x250fa0['uniqueid']][_0x39005e]=_0x250fa0[_0xb5ff('0x30')];}}}};Fax[_0xb5ff('0x24')]['syncFaxStatus']=function(_0x585e74){if(this[_0xb5ff('0x12')][_0x585e74[_0xb5ff('0x2a')]]){this['channels'][_0x585e74[_0xb5ff('0x2a')]][_0xb5ff('0x33')]=_0x585e74['operation'];this[_0xb5ff('0x12')][_0x585e74[_0xb5ff('0x2a')]]['status']=_0x585e74[_0xb5ff('0x34')];this[_0xb5ff('0x12')][_0x585e74[_0xb5ff('0x2a')]][_0xb5ff('0x29')]=_0x585e74['localstationid'];this[_0xb5ff('0x12')][_0x585e74[_0xb5ff('0x2a')]][_0xb5ff('0x35')]=_0x585e74[_0xb5ff('0x35')];logger[_0xb5ff('0x2e')](_0x585e74[_0xb5ff('0x2a')],_0xb5ff('0x36'));}};Fax[_0xb5ff('0x24')][_0xb5ff('0x1f')]=function(_0x23b9ee){var _0x494bd5=this;if(this[_0xb5ff('0x12')][_0x23b9ee[_0xb5ff('0x2a')]]){var _0x2c1fc7=this[_0xb5ff('0x12')][_0x23b9ee[_0xb5ff('0x2a')]]['id'];this[_0xb5ff('0x12')][_0x23b9ee[_0xb5ff('0x2a')]][_0xb5ff('0x37')]=_0x23b9ee[_0xb5ff('0x37')];this['channels'][_0x23b9ee['uniqueid']][_0xb5ff('0x38')]=_0x23b9ee[_0xb5ff('0x38')];this[_0xb5ff('0x12')][_0x23b9ee[_0xb5ff('0x2a')]]['localstationid']=_0x23b9ee['localstationid'];this[_0xb5ff('0x12')][_0x23b9ee[_0xb5ff('0x2a')]][_0xb5ff('0x39')]=_0x23b9ee[_0xb5ff('0x39')];this[_0xb5ff('0x12')][_0x23b9ee[_0xb5ff('0x2a')]][_0xb5ff('0x3a')]=_0x23b9ee[_0xb5ff('0x3a')];this[_0xb5ff('0x12')][_0x23b9ee['uniqueid']][_0xb5ff('0x35')]=_0x23b9ee['filename'];this['channels'][_0x23b9ee['uniqueid']][_0xb5ff('0x3b')]=_0x23b9ee[_0xb5ff('0x3b')];if(this['channels'][_0x23b9ee['uniqueid']][_0xb5ff('0x38')]>0x0){tiff2pdf(_0x23b9ee[_0xb5ff('0x35')],_0xb5ff('0x3c'),function(_0x6c1852){logger['info'](_0x23b9ee[_0xb5ff('0x2a')],'\x20result\x20conversion\x20file\x20',_0x6c1852['message']);attachment[_0xb5ff('0x3d')]({'name':path['parse'](_0x23b9ee['filename'])[_0xb5ff('0x2c')],'basename':path[_0xb5ff('0x3e')](_0x23b9ee[_0xb5ff('0x35')])[_0xb5ff('0x2c')]+_0xb5ff('0x3f'),'type':'application/pdf'})[_0xb5ff('0x40')](function(_0x388057){faxAccount[_0xb5ff('0x41')](_0x2c1fc7,{'from':_0x23b9ee[_0xb5ff('0x3b')],'mapKey':_0xb5ff('0x9'),'body':path[_0xb5ff('0x3e')](_0x23b9ee[_0xb5ff('0x35')])[_0xb5ff('0x2c')]+'.pdf','AttachmentId':_0x388057['id']})[_0xb5ff('0x42')](function(_0x1a59cc){logger[_0xb5ff('0x43')](_0x23b9ee[_0xb5ff('0x2a')],_0xb5ff('0x44'),JSON[_0xb5ff('0x45')](_0x1a59cc));});})[_0xb5ff('0x42')](function(_0x3e6ace){logger[_0xb5ff('0x43')](_0x23b9ee[_0xb5ff('0x2a')],_0xb5ff('0x46'),JSON[_0xb5ff('0x45')](_0x3e6ace));});});}logger[_0xb5ff('0x2e')](_0x23b9ee[_0xb5ff('0x2a')],_0xb5ff('0x46'));}};Fax['prototype']['syncOriginateResponse']=function(_0xbdf73){if(this['actions'][_0xbdf73[_0xb5ff('0x2a')]]){_[_0xb5ff('0x47')](this[_0xb5ff('0x12')][_0xbdf73[_0xb5ff('0x2a')]],_[_0xb5ff('0x48')](_0xbdf73,['response',_0xb5ff('0x49')]));}};function updateStatus(_0x3bfd0b){if(_0x3bfd0b['AttachmentId']){faxMessage[_0xb5ff('0x4a')](_0x3bfd0b[_0xb5ff('0x4b')],{'failMessage':_0xb5ff('0x4c')})[_0xb5ff('0x40')](function(_0x31a9e7){ut['logger']('[Fax][Message][Error][Updated]',_0x31a9e7);})[_0xb5ff('0x42')](function(_0x3cb1f4){ut['logger'](_0xb5ff('0x4d'),_0x3cb1f4);});}else{ut[_0xb5ff('0x4e')](_0xb5ff('0x4f'));}}Fax[_0xb5ff('0x24')][_0xb5ff('0x50')]=function(_0x34ceef,_0x2184c2,_0xda55f4){var _0x28f178=this;var _0x3faf89={};if(_0x2184c2){_0x3faf89={'read':_0x2184c2};}else{_0x3faf89={'failMessage':_0xda55f4};}if(this[_0xb5ff('0x15')][_0x34ceef]['AttachmentId']){faxMessage[_0xb5ff('0x4a')](this[_0xb5ff('0x15')][_0x34ceef][_0xb5ff('0x4b')],_0x3faf89)[_0xb5ff('0x40')](function(_0x54966e){ut[_0xb5ff('0x4e')](_0xb5ff('0x51'),_0x54966e);})[_0xb5ff('0x42')](function(_0x1da19b){ut[_0xb5ff('0x4e')](_0xb5ff('0x52'),_0x1da19b);})[_0xb5ff('0x53')](function(){delete _0x28f178[_0xb5ff('0x12')][_0x34ceef];delete _0x28f178[_0xb5ff('0x15')][_0x34ceef];});}else{ut[_0xb5ff('0x4e')](_0xb5ff('0x54'));delete this[_0xb5ff('0x12')][_0x34ceef];delete this[_0xb5ff('0x15')][_0x34ceef];}};Fax[_0xb5ff('0x24')][_0xb5ff('0x21')]=function(_0x1a58b0){var _0x4391c4=this;if(this[_0xb5ff('0x12')][_0x1a58b0['uniqueid']]){if(this['actions'][_0x1a58b0[_0xb5ff('0x2a')]]){this[_0xb5ff('0x12')][_0x1a58b0[_0xb5ff('0x2a')]]['id']=this[_0xb5ff('0x15')][_0x1a58b0[_0xb5ff('0x2a')]]['id'];this['channels'][_0x1a58b0['uniqueid']][_0xb5ff('0x2c')]=this['actions'][_0x1a58b0[_0xb5ff('0x2a')]]['name'];}logger['info'](_0x1a58b0['uniqueid'],this[_0xb5ff('0x15')][_0x1a58b0[_0xb5ff('0x2a')]]?_0xb5ff('0x55'):_0xb5ff('0x56'),JSON[_0xb5ff('0x45')](this[_0xb5ff('0x12')][_0x1a58b0[_0xb5ff('0x2a')]]));if(this[_0xb5ff('0x15')][_0x1a58b0[_0xb5ff('0x2a')]]){if(this['channels'][_0x1a58b0['uniqueid']][_0xb5ff('0x57')]>0x0&&this[_0xb5ff('0x12')][_0x1a58b0[_0xb5ff('0x2a')]][_0xb5ff('0x58')]===_0xb5ff('0x59')){this[_0xb5ff('0x50')](_0x1a58b0[_0xb5ff('0x2a')],!![]);}else{this[_0xb5ff('0x50')](_0x1a58b0['uniqueid'],![],this[_0xb5ff('0x12')][_0x1a58b0[_0xb5ff('0x2a')]][_0xb5ff('0x5a')]?'SENDING\x20FAILED:\x20'+this[_0xb5ff('0x12')][_0x1a58b0[_0xb5ff('0x2a')]]['faxstatusstring']:_0xb5ff('0x5b'));}}}};Fax[_0xb5ff('0x24')][_0xb5ff('0x5c')]=function(_0x4f5195){var _0x2d91a=this;return new BPromise(function(_0x185cd9,_0x5c91d3){_0x2d91a[_0xb5ff('0x5d')](_0x4f5195,_0x2d91a['faxAccounts'][_0x4f5195[_0xb5ff('0x5e')]])[_0xb5ff('0x40')](function(_0x37e2ac){ut[_0xb5ff('0x4e')](_0xb5ff('0x5f'),_0x37e2ac);_0x185cd9(ut['message'](_0xb5ff('0x60')));})['catch'](function(_0xda7ea5){ut[_0xb5ff('0x4e')](_0xb5ff('0x61'),_0xda7ea5);updateStatus(_0x4f5195);_0x5c91d3(ut[_0xb5ff('0x62')](_0xb5ff('0x63')));});});};Fax['prototype']['checkAfterSend']=function(_0x5718f3){var _0x305cbe=this;return new BPromise(function(_0x5a5176,_0x3f8624){var _0x2edfec=_0x305cbe['checkTrunk'](_0x305cbe[_0xb5ff('0x13')][_0x5718f3['FaxAccountId']][_0xb5ff('0x64')],_0x5718f3);if(_0x2edfec[_0xb5ff('0x65')]){_0x5a5176(ut[_0xb5ff('0x62')](_0xb5ff('0x66')));}else{_0x3f8624(ut[_0xb5ff('0x62')](_0x2edfec[_0xb5ff('0x62')]));}});};function originate(_0x80b67d,_0x55566a,_0x1ef2e1){return new BPromise(function(_0x26d6a1,_0x48bfbd){if(_0x1ef2e1){var _0x3e8e86=util[_0xb5ff('0x67')](_0xb5ff('0x68'),path[_0xb5ff('0x3e')](_0x80b67d[_0xb5ff('0x5')])[_0xb5ff('0x2c')],_0x80b67d['path']);gs[_0xb5ff('0x69')](_0x3e8e86)['then'](function(){_0x80b67d[_0xb5ff('0x5')]=util[_0xb5ff('0x67')](_0xb5ff('0x6a'),path[_0xb5ff('0x3e')](_0x80b67d[_0xb5ff('0x5')])[_0xb5ff('0x6b')],path[_0xb5ff('0x3e')](_0x80b67d[_0xb5ff('0x5')])[_0xb5ff('0x2c')]);_0x55566a['XMF-PATH']=_0x80b67d[_0xb5ff('0x5')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0xb5ff('0x6c')](ut[_0xb5ff('0x6d')](_0x80b67d,_0x55566a))[_0xb5ff('0x40')](function(_0x47a1bc){_0x26d6a1(_0x47a1bc);})[_0xb5ff('0x42')](function(_0x4af108){_0x48bfbd(_0x4af108);});})['catch'](function(_0x1d0795){_0x48bfbd(_0x1d0795);});}else{ami['Action'](ut[_0xb5ff('0x6d')](_0x80b67d,_0x55566a))['then'](function(_0x5f017d){_0x26d6a1(_0x5f017d);})[_0xb5ff('0x42')](function(_0x3895c7){_0x48bfbd(_0x3895c7);});}});}Fax['prototype'][_0xb5ff('0x5d')]=function(_0x33447d,_0x117399){var _0x44281b=this;return new BPromise(function(_0x18dfee,_0xd7a944){var _0x51237a=uuid['v4']();var _0x5bd22e=ut[_0xb5ff('0x6e')](_0x33447d,_0x117399);_0x44281b[_0xb5ff('0x15')][_0x51237a]=new Action(_0x51237a,_0x117399,_0x33447d);var _0x2f301c=_0x44281b[_0xb5ff('0x15')][_0x51237a];if(path[_0xb5ff('0x3e')](_0x33447d[_0xb5ff('0x5')])['ext']==='.pdf'){originate(_0x2f301c,_0x5bd22e,!![])[_0xb5ff('0x40')](function(_0xaa1c9d){_0x18dfee(_0xaa1c9d);})[_0xb5ff('0x42')](function(_0xa7fe02){_0xd7a944(_0xa7fe02);});}else{originate(_0x2f301c,_0x5bd22e,![])[_0xb5ff('0x40')](function(_0x80fb60){_0x18dfee(_0x80fb60);})['catch'](function(_0x29978c){_0xd7a944(_0x29978c);});}});};Fax[_0xb5ff('0x24')][_0xb5ff('0x6f')]=function(_0x364ea1){return!_[_0xb5ff('0x70')](_0x364ea1)&&!_[_0xb5ff('0x70')](_0x364ea1['name'])&&!_[_0xb5ff('0x70')](_0x364ea1[_0xb5ff('0x71')])&&_0x364ea1['active']&&!_[_0xb5ff('0x70')](this[_0xb5ff('0x14')][util[_0xb5ff('0x67')](_0xb5ff('0x72'),_0x364ea1[_0xb5ff('0x2c')])])&&!_[_0xb5ff('0x70')](this[_0xb5ff('0x14')][util['format'](_0xb5ff('0x72'),_0x364ea1['name'])][_0xb5ff('0x34')])&&(this[_0xb5ff('0x14')][util[_0xb5ff('0x67')](_0xb5ff('0x72'),_0x364ea1[_0xb5ff('0x2c')])][_0xb5ff('0x34')]===_0xb5ff('0x73')||this[_0xb5ff('0x14')][util[_0xb5ff('0x67')](_0xb5ff('0x72'),_0x364ea1[_0xb5ff('0x2c')])][_0xb5ff('0x34')]==='unmonitored');};Fax[_0xb5ff('0x24')][_0xb5ff('0x74')]=function(_0x445309,_0x36b054){if(!this[_0xb5ff('0x6f')](_0x445309)){ut['logger'](_0xb5ff('0x75'),_[_0xb5ff('0x70')](_0x445309)?'':_0x445309[_0xb5ff('0x2c')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xb5ff('0x76')};}if(_[_0xb5ff('0x70')](_0x36b054[_0xb5ff('0x9')])){ut[_0xb5ff('0x4e')](_0xb5ff('0x77'),JSON[_0xb5ff('0x45')](_0x36b054));return{'isValid':![],'message':_0xb5ff('0x78')};}if(_[_0xb5ff('0x70')](_0x36b054[_0xb5ff('0x5')])){ut[_0xb5ff('0x4e')](_0xb5ff('0x79'),JSON[_0xb5ff('0x45')](_0x36b054));return{'isValid':![],'message':_0xb5ff('0x7a')};}return{'isValid':!![],'message':'Is\x20Valid'};};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 8bf3467..3d81b02 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 _0x3f5e=['[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x3f5e,0x15d));var _0xe3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe3f5('0x0'));var BPromise=require('bluebird');var logger=require(_0xe3f5('0x1'))(_0xe3f5('0x2'));var _=require(_0xe3f5('0x3'));var faxAccount=require(_0xe3f5('0x4'));function loggerCatch(_0x5c584d){return function(_0x3d4486){logger[_0xe3f5('0x5')](_0x5c584d,util[_0xe3f5('0x6')](_0x3d4486,{'showHidden':![],'depth':null}));};}exports[_0xe3f5('0x7')]=function(_0x446ec3,_0x47c5b0){return BPromise[_0xe3f5('0x8')]()[_0xe3f5('0x9')](faxAccount['notify'](_0x446ec3,_0x47c5b0))[_0xe3f5('0xa')](loggerCatch(_0xe3f5('0xb')));}; \ No newline at end of file +var _0xaac6=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','resolve','then','notify','catch','util'];(function(_0x120b2a,_0x762f27){var _0x14718e=function(_0x256eae){while(--_0x256eae){_0x120b2a['push'](_0x120b2a['shift']());}};_0x14718e(++_0x762f27);}(_0xaac6,0x1b7));var _0x6aac=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0xaac6[_0x235482];return _0x5f5bea;};'use strict';var util=require(_0x6aac('0x0'));var BPromise=require(_0x6aac('0x1'));var logger=require(_0x6aac('0x2'))(_0x6aac('0x3'));var _=require(_0x6aac('0x4'));var faxAccount=require(_0x6aac('0x5'));function loggerCatch(_0x54cbbd){return function(_0x39484c){logger['error'](_0x54cbbd,util['inspect'](_0x39484c,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1c4c67,_0x59d249){return BPromise[_0x6aac('0x6')]()[_0x6aac('0x7')](faxAccount[_0x6aac('0x8')](_0x1c4c67,_0x59d249))[_0x6aac('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index a65d439..465fbd1 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 _0xdcbe=['child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','util','../../../../config/logger','fax','bluebird'];(function(_0x16db6f,_0x13b097){var _0x4609f6=function(_0x18a0d6){while(--_0x18a0d6){_0x16db6f['push'](_0x16db6f['shift']());}};_0x4609f6(++_0x13b097);}(_0xdcbe,0x1f0));var _0xedcb=function(_0x1f8726,_0x193bd5){_0x1f8726=_0x1f8726-0x0;var _0x463a5c=_0xdcbe[_0x1f8726];return _0x463a5c;};'use strict';var util=require(_0xedcb('0x0'));var logger=require(_0xedcb('0x1'))(_0xedcb('0x2'));var BPromise=require(_0xedcb('0x3'));var exec=require(_0xedcb('0x4'))[_0xedcb('0x5')];exports[_0xedcb('0x6')]=function(_0x2049cd){return new BPromise(function(_0x3fedea,_0x2cb33c){exec(_0x2049cd,function(_0x13f6b9,_0x1cb016,_0x2caf8c){logger['info'](_0xedcb('0x7'),_0x1cb016);if(_0x13f6b9){logger[_0xedcb('0x8')](_0xedcb('0x7'),_0xedcb('0x9'),util['inspect'](_0x13f6b9,{'showHidden':![],'depth':null}),_0x1cb016,_0x2caf8c);_0x2cb33c(_0x13f6b9);}_0x3fedea(_0x1cb016);});});}; \ No newline at end of file +var _0xcc7b=['../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcc7b,0xc6));var _0xbcc7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcc7b[_0x3ab51d];return _0x29a04e;};'use strict';var util=require('util');var logger=require(_0xbcc7('0x0'))(_0xbcc7('0x1'));var BPromise=require('bluebird');var exec=require(_0xbcc7('0x2'))[_0xbcc7('0x3')];exports[_0xbcc7('0x4')]=function(_0x2f2876){return new BPromise(function(_0x382e47,_0x19937f){exec(_0x2f2876,function(_0x4eb771,_0x888910,_0x1f6bc3){logger['info']('Exec\x20gs',_0x888910);if(_0x4eb771){logger[_0xbcc7('0x5')](_0xbcc7('0x6'),_0xbcc7('0x7'),util[_0xbcc7('0x8')](_0x4eb771,{'showHidden':![],'depth':null}),_0x888910,_0x1f6bc3);_0x19937f(_0x4eb771);}_0x382e47(_0x888910);});});}; \ 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 f3bf0fd..2b4f0dc 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 _0x4c50=['originate','channel','xcally-motion-fax','from-sip','util','lodash','moment','fax','message','logger','info','addVariables','ecm','headerinfo','maxrate','format','faxdetect','t38timeout','uniqueid'];(function(_0x127de1,_0x19cb5c){var _0x2d3a04=function(_0x52113a){while(--_0x52113a){_0x127de1['push'](_0x127de1['shift']());}};_0x2d3a04(++_0x19cb5c);}(_0x4c50,0x9c));var _0x04c5=function(_0x37b54d,_0x14a5f1){_0x37b54d=_0x37b54d-0x0;var _0x38215f=_0x4c50[_0x37b54d];return _0x38215f;};'use strict';var util=require(_0x04c5('0x0'));var _=require(_0x04c5('0x1'));var moment=require(_0x04c5('0x2'));var logger=require('../../../../config/logger')(_0x04c5('0x3'));exports[_0x04c5('0x4')]=function(_0xdb4cc7){return{'message':_0xdb4cc7};};exports[_0x04c5('0x5')]=function(_0x104a0d,_0x4d0305){logger[_0x04c5('0x6')](_0x104a0d,util['inspect'](_0x4d0305,{'showHidden':![],'depth':null}));};exports[_0x04c5('0x7')]=function(_0x30a390,_0x4ed448){var _0x2b43b8={'XMF-ECM':_0x4ed448[_0x04c5('0x8')],'XMF-HEADERINFO':_0x4ed448[_0x04c5('0x9')],'XMF-MINRATE':_0x4ed448['minrate'],'XMF-MAXRATE':_0x4ed448[_0x04c5('0xa')],'XMF-MODEM':util[_0x04c5('0xb')]('\x22%s\x22',_0x4ed448['modem']),'XMF-GATEWAY':_0x4ed448['gateway'],'XMF-FAXDETECT':_0x4ed448[_0x04c5('0xc')],'XMF-T38TIMEOUT':_0x4ed448[_0x04c5('0xd')],'XMF-LOCALSTATIONID':_0x4ed448['localstationid'],'XMF-PATH':_0x30a390['path']};return _0x2b43b8;};exports['variablesAction']=function(_0x254773,_0x4cf88f){return{'actionid':_0x254773[_0x04c5('0xe')],'action':_0x04c5('0xf'),'channel':_0x254773[_0x04c5('0x10')],'Exten':_0x04c5('0x11'),'Context':_0x04c5('0x12'),'Priority':'1','callerid':util[_0x04c5('0xb')]('\x22%s\x22\x20<%s>',_0x254773[_0x04c5('0x9')]?_0x254773[_0x04c5('0x9')]:'',_0x254773['localstationid']),'variable':_0x4cf88f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x254773[_0x04c5('0xe')]};}; \ No newline at end of file +var _0x8abd=['maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','originate','format','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','fax','message','logger','info','inspect','headerinfo','minrate'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8abd,0x140));var _0xd8ab=function(_0x221ebf,_0x497869){_0x221ebf=_0x221ebf-0x0;var _0x13bdd6=_0x8abd[_0x221ebf];return _0x13bdd6;};'use strict';var util=require(_0xd8ab('0x0'));var _=require(_0xd8ab('0x1'));var moment=require(_0xd8ab('0x2'));var logger=require('../../../../config/logger')(_0xd8ab('0x3'));exports[_0xd8ab('0x4')]=function(_0x5c6897){return{'message':_0x5c6897};};exports[_0xd8ab('0x5')]=function(_0x1a2d69,_0x496e02){logger[_0xd8ab('0x6')](_0x1a2d69,util[_0xd8ab('0x7')](_0x496e02,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2397b6,_0x3981d3){var _0x16bfa6={'XMF-ECM':_0x3981d3['ecm'],'XMF-HEADERINFO':_0x3981d3[_0xd8ab('0x8')],'XMF-MINRATE':_0x3981d3[_0xd8ab('0x9')],'XMF-MAXRATE':_0x3981d3[_0xd8ab('0xa')],'XMF-MODEM':util['format'](_0xd8ab('0xb'),_0x3981d3[_0xd8ab('0xc')]),'XMF-GATEWAY':_0x3981d3[_0xd8ab('0xd')],'XMF-FAXDETECT':_0x3981d3[_0xd8ab('0xe')],'XMF-T38TIMEOUT':_0x3981d3[_0xd8ab('0xf')],'XMF-LOCALSTATIONID':_0x3981d3['localstationid'],'XMF-PATH':_0x2397b6[_0xd8ab('0x10')]};return _0x16bfa6;};exports[_0xd8ab('0x11')]=function(_0x4a9a30,_0x494385){return{'actionid':_0x4a9a30['uniqueid'],'action':_0xd8ab('0x12'),'channel':_0x4a9a30['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0xd8ab('0x13')](_0xd8ab('0x14'),_0x4a9a30['headerinfo']?_0x4a9a30[_0xd8ab('0x8')]:'',_0x4a9a30[_0xd8ab('0x15')]),'variable':_0x494385,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4a9a30['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3ba402e..8b27b07 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 _0xc7a4=['getAgents','initAgents','getTelephones','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','listen','bluebird','util','moment','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','resolve','then'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0xc7a4,0xa5));var _0x4c7a=function(_0x33ff84,_0x922d3){_0x33ff84=_0x33ff84-0x0;var _0x53d108=_0xc7a4[_0x33ff84];return _0x53d108;};'use strict';var BPromise=require(_0x4c7a('0x0'));var util=require(_0x4c7a('0x1'));var moment=require(_0x4c7a('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x4c7a('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x4c7a('0x4'));var Preview=require(_0x4c7a('0x5'));var Fax=require(_0x4c7a('0x6'));var user=require(_0x4c7a('0x7'));var voiceQueue=require(_0x4c7a('0x8'));var voiceQueueReport=require(_0x4c7a('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x4c7a('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x4c7a('0xb'));var cmHopperHistory=require(_0x4c7a('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x4c7a('0xd'));var faxAccount=require(_0x4c7a('0xe'));var zendesk=require(_0x4c7a('0xf'));var salesforce=require(_0x4c7a('0x10'));var sugarcrm=require(_0x4c7a('0x11'));var freshdesk=require(_0x4c7a('0x12'));var desk=require(_0x4c7a('0x13'));var zoho=require(_0x4c7a('0x14'));var vtiger=require(_0x4c7a('0x15'));var freshsales=require(_0x4c7a('0x16'));var servicenow=require(_0x4c7a('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4c7a('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4c7a('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4c7a('0x19')]()[_0x4c7a('0x1a')](user[_0x4c7a('0x1b')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x1c')]())['then'](user[_0x4c7a('0x1d')]())[_0x4c7a('0x1a')](realtime['initTelephones']())['then'](trunk['getTrunks']())['then'](realtime[_0x4c7a('0x1e')]())[_0x4c7a('0x1a')](voiceQueue[_0x4c7a('0x1f')]())['then'](realtime['initVoiceQueues']())['then'](trigger[_0x4c7a('0x20')]())['then'](realtime['initTriggers']())['then'](template[_0x4c7a('0x21')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x22')]())[_0x4c7a('0x1a')](zendesk[_0x4c7a('0x23')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x24')]())[_0x4c7a('0x1a')](salesforce[_0x4c7a('0x25')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x26')]())[_0x4c7a('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x27')]())[_0x4c7a('0x1a')](freshdesk[_0x4c7a('0x28')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x29')]())['then'](desk[_0x4c7a('0x2a')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x2b')]())[_0x4c7a('0x1a')](zoho[_0x4c7a('0x2c')]())[_0x4c7a('0x1a')](realtime['initZohoAccounts']())[_0x4c7a('0x1a')](vtiger['getVtigerAccounts']())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x2d')]())['then'](freshsales[_0x4c7a('0x2e')]())['then'](realtime[_0x4c7a('0x2f')]())[_0x4c7a('0x1a')](servicenow[_0x4c7a('0x30')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x31')]())[_0x4c7a('0x1a')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x4c7a('0x32')]())[_0x4c7a('0x1a')](campaign[_0x4c7a('0x33')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x34')]())['then'](voiceExtension[_0x4c7a('0x35')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x36')]())[_0x4c7a('0x1a')](faxAccount[_0x4c7a('0x37')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x4c7a('0x19')]()[_0x4c7a('0x1a')](voiceQueueReport[_0x4c7a('0x38')]())['then'](realtime['initVoiceQueueReports']())[_0x4c7a('0x1a')](cmHopperHistory[_0x4c7a('0x39')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x3a')]())[_0x4c7a('0x1a')](cmHopperHistory[_0x4c7a('0x3b')]())[_0x4c7a('0x1a')](realtime[_0x4c7a('0x3c')]())[_0x4c7a('0x1a')](voiceCallReport['getVoiceCallReports']())[_0x4c7a('0x1a')](realtime['initVoiceCallReports']())[_0x4c7a('0x1a')](function(_0x3ba370){})[_0x4c7a('0x3d')](function(_0x21b645){console[_0x4c7a('0x3e')](_0x21b645);});}function main(){return server[_0x4c7a('0x3f')](realtime,preview,fax)[_0x4c7a('0x1a')](function(_0x9645b6){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x4c7a('0x3d')](function(_0x152490){console['log'](_0x152490);});}main(); \ No newline at end of file +var _0x4015=['getDeskAccounts','initDeskAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','./realtime','./report','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0x4015,0x1d9));var _0x5401=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x4015[_0x10dfdf];return _0x4d857d;};'use strict';var BPromise=require(_0x5401('0x0'));var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require(_0x5401('0x1'));var Report=require(_0x5401('0x2'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x5401('0x3'));var Preview=require('./preview');var Fax=require(_0x5401('0x4'));var user=require(_0x5401('0x5'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x5401('0x6'));var voiceCallReport=require(_0x5401('0x7'));var trunk=require(_0x5401('0x8'));var trigger=require(_0x5401('0x9'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x5401('0xa'));var voiceExtension=require(_0x5401('0xb'));var faxAccount=require(_0x5401('0xc'));var zendesk=require(_0x5401('0xd'));var salesforce=require(_0x5401('0xe'));var sugarcrm=require(_0x5401('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x5401('0x10'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x5401('0x11'));var freshsales=require(_0x5401('0x12'));var servicenow=require(_0x5401('0x13'));var dynamics365=require(_0x5401('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5401('0x15')](_0x5401('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5401('0x15')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x5401('0x17')](user[_0x5401('0x18')]())[_0x5401('0x17')](realtime[_0x5401('0x19')]())['then'](user[_0x5401('0x1a')]())['then'](realtime[_0x5401('0x1b')]())['then'](trunk['getTrunks']())['then'](realtime[_0x5401('0x1c')]())['then'](voiceQueue[_0x5401('0x1d')]())[_0x5401('0x17')](realtime[_0x5401('0x1e')]())[_0x5401('0x17')](trigger[_0x5401('0x1f')]())[_0x5401('0x17')](realtime[_0x5401('0x20')]())['then'](template['getTemplates']())[_0x5401('0x17')](realtime[_0x5401('0x21')]())[_0x5401('0x17')](zendesk[_0x5401('0x22')]())['then'](realtime[_0x5401('0x23')]())[_0x5401('0x17')](salesforce[_0x5401('0x24')]())[_0x5401('0x17')](realtime[_0x5401('0x25')]())['then'](sugarcrm[_0x5401('0x26')]())['then'](realtime['initSugarcrmAccounts']())[_0x5401('0x17')](freshdesk['getFreshdeskAccounts']())[_0x5401('0x17')](realtime['initFreshdeskAccounts']())['then'](desk[_0x5401('0x27')]())['then'](realtime[_0x5401('0x28')]())[_0x5401('0x17')](zoho['getZohoAccounts']())[_0x5401('0x17')](realtime[_0x5401('0x29')]())[_0x5401('0x17')](vtiger['getVtigerAccounts']())[_0x5401('0x17')](realtime['initVtigerAccounts']())[_0x5401('0x17')](freshsales[_0x5401('0x2a')]())['then'](realtime[_0x5401('0x2b')]())['then'](servicenow[_0x5401('0x2c')]())['then'](realtime[_0x5401('0x2d')]())[_0x5401('0x17')](dynamics365[_0x5401('0x2e')]())[_0x5401('0x17')](realtime[_0x5401('0x2f')]())[_0x5401('0x17')](campaign[_0x5401('0x30')]())[_0x5401('0x17')](realtime[_0x5401('0x31')]())[_0x5401('0x17')](voiceExtension[_0x5401('0x32')]())[_0x5401('0x17')](realtime[_0x5401('0x33')]())[_0x5401('0x17')](faxAccount['getFaxAccounts']())[_0x5401('0x17')](realtime[_0x5401('0x34')]())[_0x5401('0x17')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x5401('0x17')](voiceQueueReport[_0x5401('0x35')]())[_0x5401('0x17')](realtime[_0x5401('0x36')]())[_0x5401('0x17')](cmHopperHistory[_0x5401('0x37')]())[_0x5401('0x17')](realtime[_0x5401('0x38')]())['then'](cmHopperHistory[_0x5401('0x39')]())[_0x5401('0x17')](realtime['initCampaignHopperHistory']())[_0x5401('0x17')](voiceCallReport[_0x5401('0x3a')]())[_0x5401('0x17')](realtime[_0x5401('0x3b')]())[_0x5401('0x17')](function(_0x5e31d0){})[_0x5401('0x3c')](function(_0xc67bec){console[_0x5401('0x3d')](_0xc67bec);});}function main(){return server[_0x5401('0x3e')](realtime,preview,fax)['then'](function(_0x15d045){return initRealtime();})[_0x5401('0x17')](function(){return initParams();})[_0x5401('0x17')](function(){report[_0x5401('0x3f')]();setInterval(initRealtime,0x1388);})[_0x5401('0x3c')](function(_0x36ccbe){console[_0x5401('0x3d')](_0x36ccbe);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 7aee473..5792cd4 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 _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x1686a1,_0x1c7e37){var _0x3975f0=function(_0x33e70f){while(--_0x33e70f){_0x1686a1['push'](_0x1686a1['shift']());}};_0x3975f0(++_0x1c7e37);}(_0x34e8,0x12c));var _0x834e=function(_0xdf3f44,_0x2657ad){_0xdf3f44=_0xdf3f44-0x0;var _0x4e0af8=_0x34e8[_0xdf3f44];return _0x4e0af8;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x30806e,_0x41bb0d){var _0x2777c6=function(_0x2557b6){while(--_0x2557b6){_0x30806e['push'](_0x30806e['shift']());}};_0x2777c6(++_0x41bb0d);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8aa76e3..9580ffc 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 _0x28b6=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x5c93e3,_0x5dc18e){var _0x3e7672=function(_0x37e0c4){while(--_0x37e0c4){_0x5c93e3['push'](_0x5c93e3['shift']());}};_0x3e7672(++_0x5dc18e);}(_0x28b6,0x180));var _0x628b=function(_0x1d648c,_0x2b8890){_0x1d648c=_0x1d648c-0x0;var _0x2c0591=_0x28b6[_0x1d648c];return _0x2c0591;};'use strict';function Campaign(_0xf71739){this['id']=_0xf71739['id']||0x0;this['name']=_0xf71739[_0x628b('0x0')]||'';this[_0x628b('0x1')]=_0xf71739[_0x628b('0x1')]||_0x628b('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x628b('0x3')]=0x0;this[_0x628b('0x4')]=0x0;this[_0x628b('0x5')]='';this[_0x628b('0x6')]=!![];this[_0x628b('0x7')]=_0xf71739['active'];this[_0x628b('0x8')]=_0xf71739['limitCalls'];this['dialTimezone']=_0xf71739[_0x628b('0x9')]||null;this['dialGlobalInterval']=_0xf71739[_0x628b('0xa')]?_0xf71739[_0x628b('0xa')]:null;this[_0x628b('0xb')]=_0xf71739[_0x628b('0xb')];this[_0x628b('0xc')]=_0xf71739[_0x628b('0xc')];this['dialOriginateTimeout']=_0xf71739['dialOriginateTimeout']||0x1e;this[_0x628b('0xd')]=_0xf71739[_0x628b('0xd')];this[_0x628b('0xe')]=_0xf71739[_0x628b('0xe')];this[_0x628b('0xf')]=_0xf71739[_0x628b('0xf')];this['dialBusyRetryFrequency']=_0xf71739[_0x628b('0x10')];this['dialNoAnswerMaxRetry']=_0xf71739[_0x628b('0x11')];this[_0x628b('0x12')]=_0xf71739[_0x628b('0x12')];this[_0x628b('0x13')]=_0xf71739[_0x628b('0x13')];this[_0x628b('0x14')]=_0xf71739[_0x628b('0x14')]||0x3;this[_0x628b('0x15')]=_0xf71739['dialNoSuchNumberRetryFrequency']||0x96;this[_0x628b('0x16')]=_0xf71739['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0xf71739[_0x628b('0x17')]||0x96;this[_0x628b('0x18')]=_0xf71739['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0xf71739[_0x628b('0x19')]||0x96;this[_0x628b('0x1a')]=_0xf71739[_0x628b('0x1a')]||0x3;this[_0x628b('0x1b')]=_0xf71739['dialMachineRetryFrequency']||0x96;this[_0x628b('0x1c')]=_0xf71739[_0x628b('0x1c')]||0x3;this[_0x628b('0x1d')]=_0xf71739['dialAgentRejectRetryFrequency']||0x96;this[_0x628b('0x1e')]=_0xf71739[_0x628b('0x1e')]||_0x628b('0x1f');this[_0x628b('0x20')]=_0xf71739[_0x628b('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xf71739[_0x628b('0x21')]||undefined;this[_0x628b('0x22')]=_0xf71739[_0x628b('0x22')]||undefined;this[_0x628b('0x23')]=_0xf71739[_0x628b('0x23')]?_0xf71739['TrunkBackup']:undefined;this[_0x628b('0x24')]=_0xf71739[_0x628b('0x24')]?_0xf71739['Trunk']:undefined;this[_0x628b('0x25')]=_0xf71739[_0x628b('0x25')]?_0xf71739[_0x628b('0x25')]:undefined;this[_0x628b('0x26')]=_0xf71739['SquareProject']?_0xf71739[_0x628b('0x26')]:undefined;this['dialQueueProject']=_0xf71739[_0x628b('0x26')]?_0xf71739[_0x628b('0x26')]['name']:undefined;this[_0x628b('0x27')]=_0xf71739[_0x628b('0x27')]||![];this['dialAMDInitialSilence']=_0xf71739[_0x628b('0x28')];this[_0x628b('0x29')]=_0xf71739[_0x628b('0x29')];this['dialAMDAfterGreetingSilence']=_0xf71739[_0x628b('0x2a')];this[_0x628b('0x2b')]=_0xf71739[_0x628b('0x2b')];this[_0x628b('0x2c')]=_0xf71739['dialAMDMinWordLength'];this[_0x628b('0x2d')]=_0xf71739[_0x628b('0x2d')];this[_0x628b('0x2e')]=_0xf71739[_0x628b('0x2e')];this[_0x628b('0x2f')]=_0xf71739[_0x628b('0x2f')];this[_0x628b('0x30')]=_0xf71739[_0x628b('0x30')];}module[_0x628b('0x31')]=Campaign; \ No newline at end of file +var _0x268e=['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','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x268e,0xc8));var _0xe268=function(_0x4f814b,_0x5a6b12){_0x4f814b=_0x4f814b-0x0;var _0x457e57=_0x268e[_0x4f814b];return _0x457e57;};'use strict';function Campaign(_0x271f24){this['id']=_0x271f24['id']||0x0;this[_0xe268('0x0')]=_0x271f24['name']||'';this[_0xe268('0x1')]=_0x271f24[_0xe268('0x1')]||'campaign';this[_0xe268('0x2')]=0x0;this[_0xe268('0x3')]=0x0;this[_0xe268('0x4')]=0x0;this[_0xe268('0x5')]=0x0;this[_0xe268('0x6')]='';this[_0xe268('0x7')]=!![];this[_0xe268('0x8')]=_0x271f24['active'];this[_0xe268('0x9')]=_0x271f24[_0xe268('0x9')];this[_0xe268('0xa')]=_0x271f24['dialTimezone']||null;this[_0xe268('0xb')]=_0x271f24[_0xe268('0xb')]?_0x271f24['dialGlobalInterval']:null;this[_0xe268('0xc')]=_0x271f24[_0xe268('0xc')];this[_0xe268('0xd')]=_0x271f24['dialOriginateCallerIdNumber'];this[_0xe268('0xe')]=_0x271f24[_0xe268('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x271f24[_0xe268('0xf')];this[_0xe268('0x10')]=_0x271f24['dialCongestionRetryFrequency'];this[_0xe268('0x11')]=_0x271f24[_0xe268('0x11')];this[_0xe268('0x12')]=_0x271f24['dialBusyRetryFrequency'];this[_0xe268('0x13')]=_0x271f24['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x271f24[_0xe268('0x14')];this[_0xe268('0x15')]=_0x271f24[_0xe268('0x15')];this[_0xe268('0x16')]=_0x271f24[_0xe268('0x16')]||0x3;this[_0xe268('0x17')]=_0x271f24[_0xe268('0x17')]||0x96;this[_0xe268('0x18')]=_0x271f24[_0xe268('0x18')]||0x3;this[_0xe268('0x19')]=_0x271f24[_0xe268('0x19')]||0x96;this[_0xe268('0x1a')]=_0x271f24[_0xe268('0x1a')]||0x3;this[_0xe268('0x1b')]=_0x271f24[_0xe268('0x1b')]||0x96;this[_0xe268('0x1c')]=_0x271f24[_0xe268('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x271f24[_0xe268('0x1d')]||0x96;this[_0xe268('0x1e')]=_0x271f24[_0xe268('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x271f24[_0xe268('0x1f')]||0x96;this[_0xe268('0x20')]=_0x271f24[_0xe268('0x20')]||_0xe268('0x21');this[_0xe268('0x22')]=_0x271f24[_0xe268('0x22')]||undefined;this[_0xe268('0x23')]=_0x271f24[_0xe268('0x23')]||undefined;this[_0xe268('0x24')]=_0x271f24[_0xe268('0x24')]||undefined;this['TrunkBackup']=_0x271f24[_0xe268('0x25')]?_0x271f24[_0xe268('0x25')]:undefined;this['Trunk']=_0x271f24[_0xe268('0x26')]?_0x271f24['Trunk']:undefined;this[_0xe268('0x27')]=_0x271f24['Interval']?_0x271f24['Interval']:undefined;this[_0xe268('0x28')]=_0x271f24['SquareProject']?_0x271f24[_0xe268('0x28')]:undefined;this[_0xe268('0x29')]=_0x271f24['SquareProject']?_0x271f24[_0xe268('0x28')]['name']:undefined;this['dialAMDActive']=_0x271f24[_0xe268('0x2a')]||![];this[_0xe268('0x2b')]=_0x271f24['dialAMDInitialSilence'];this[_0xe268('0x2c')]=_0x271f24[_0xe268('0x2c')];this[_0xe268('0x2d')]=_0x271f24['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x271f24[_0xe268('0x2e')];this[_0xe268('0x2f')]=_0x271f24[_0xe268('0x2f')];this[_0xe268('0x30')]=_0x271f24['dialAMDBetweenWordsSilence'];this[_0xe268('0x31')]=_0x271f24[_0xe268('0x31')];this[_0xe268('0x32')]=_0x271f24['dialAMDSilenceThreshold'];this[_0xe268('0x33')]=_0x271f24[_0xe268('0x33')];}module[_0xe268('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6a149e2..fc896d6 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 _0x8e4f=['exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8e4f,0xa9));var _0xf8e4=function(_0xcc9e86,_0x4417fe){_0xcc9e86=_0xcc9e86-0x0;var _0x1ba436=_0x8e4f[_0xcc9e86];return _0x1ba436;};'use strict';function Channel(){this[_0xf8e4('0x0')]=null;this[_0xf8e4('0x1')]='';this[_0xf8e4('0x2')]='';this['calleridnum']=0x0;this[_0xf8e4('0x3')]='';this[_0xf8e4('0x4')]=undefined;this[_0xf8e4('0x5')]=undefined;this[_0xf8e4('0x6')]=0x0;this['context']='';this[_0xf8e4('0x7')]=0x0;this[_0xf8e4('0x8')]=0x0;this[_0xf8e4('0x9')]=0x0;this[_0xf8e4('0xa')]=![];this[_0xf8e4('0xb')]=null;this[_0xf8e4('0xc')]=null;this[_0xf8e4('0xd')]=![];this[_0xf8e4('0xe')]=![];this['lastapplication']='';this[_0xf8e4('0xf')]='';this[_0xf8e4('0x10')]=0x0;this[_0xf8e4('0x11')]=0x0;this[_0xf8e4('0x12')]=0x0;this['type']=null;this[_0xf8e4('0x13')]=null;this[_0xf8e4('0x14')]=null;this[_0xf8e4('0x15')]=![];this[_0xf8e4('0x16')]=null;this[_0xf8e4('0x17')]=null;this[_0xf8e4('0x18')]=[];this['transfercalleridnum']=undefined;this[_0xf8e4('0x19')]=undefined;this[_0xf8e4('0x1a')]=undefined;this['mohtime']=0x0;}module[_0xf8e4('0x1b')]=Channel; \ No newline at end of file +var _0x605b=['holdtime','type','tag','disposition','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','context','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x175d0b,_0x8d66ce){var _0x138694=function(_0x55aa4e){while(--_0x55aa4e){_0x175d0b['push'](_0x175d0b['shift']());}};_0x138694(++_0x8d66ce);}(_0x605b,0xf4));var _0xb605=function(_0x345425,_0x1d8102){_0x345425=_0x345425-0x0;var _0x2dd02d=_0x605b[_0x345425];return _0x2dd02d;};'use strict';function Channel(){this[_0xb605('0x0')]=null;this[_0xb605('0x1')]='';this[_0xb605('0x2')]='';this[_0xb605('0x3')]=0x0;this['calleridname']='';this[_0xb605('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0xb605('0x5')]='';this['uniqueid']=0x0;this[_0xb605('0x6')]=0x0;this[_0xb605('0x7')]=0x0;this[_0xb605('0x8')]=![];this['answertime']=null;this[_0xb605('0x9')]=null;this[_0xb605('0xa')]=![];this[_0xb605('0xb')]=![];this[_0xb605('0xc')]='';this[_0xb605('0xd')]='';this[_0xb605('0xe')]=0x0;this[_0xb605('0xf')]=0x0;this[_0xb605('0x10')]=0x0;this[_0xb605('0x11')]=null;this[_0xb605('0x12')]=null;this[_0xb605('0x13')]=null;this['monitor']=![];this[_0xb605('0x14')]=null;this[_0xb605('0x15')]=null;this['monitors']=[];this[_0xb605('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xb605('0x17')]=undefined;this[_0xb605('0x18')]=0x0;}module[_0xb605('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 17f49f4..027b12f 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 _0x659d=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x2fb3c8,_0x57fae){var _0x4123e8=function(_0x5e3b61){while(--_0x5e3b61){_0x2fb3c8['push'](_0x2fb3c8['shift']());}};_0x4123e8(++_0x57fae);}(_0x659d,0x136));var _0xd659=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x659d[_0x44b3bd];return _0x1efc4a;};'use strict';function DeskAccount(_0x285d7d){this['id']=_0x285d7d['id']||0x0;this[_0xd659('0x0')]=_0x285d7d[_0xd659('0x0')]||'';this[_0xd659('0x1')]=_0x285d7d[_0xd659('0x1')]||'';this[_0xd659('0x2')]=_0x285d7d[_0xd659('0x2')]||'';this['authType']=_0x285d7d[_0xd659('0x3')]||'';this[_0xd659('0x4')]=_0x285d7d['password']||'';this[_0xd659('0x5')]=_0x285d7d['consumerKey']||'';this[_0xd659('0x6')]=_0x285d7d[_0xd659('0x6')]||'';this['token']=_0x285d7d[_0xd659('0x7')]||'';this[_0xd659('0x8')]=_0x285d7d[_0xd659('0x8')]||'';this[_0xd659('0x9')]=_0x285d7d[_0xd659('0x9')]||'';this[_0xd659('0xa')]=_0x285d7d[_0xd659('0xa')]||'';this[_0xd659('0xb')]=_0x285d7d[_0xd659('0xb')]||{};}module[_0xd659('0xc')]=DeskAccount; \ No newline at end of file +var _0x52af=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x52af,0x19e));var _0xf52a=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x52af[_0x25e7cb];return _0x375d92;};'use strict';function DeskAccount(_0x1ea4bb){this['id']=_0x1ea4bb['id']||0x0;this['name']=_0x1ea4bb[_0xf52a('0x0')]||'';this[_0xf52a('0x1')]=_0x1ea4bb[_0xf52a('0x1')]||'';this[_0xf52a('0x2')]=_0x1ea4bb[_0xf52a('0x2')]||'';this['authType']=_0x1ea4bb[_0xf52a('0x3')]||'';this['password']=_0x1ea4bb[_0xf52a('0x4')]||'';this['consumerKey']=_0x1ea4bb['consumerKey']||'';this[_0xf52a('0x5')]=_0x1ea4bb[_0xf52a('0x5')]||'';this[_0xf52a('0x6')]=_0x1ea4bb[_0xf52a('0x6')]||'';this[_0xf52a('0x7')]=_0x1ea4bb[_0xf52a('0x7')]||'';this['type']=_0x1ea4bb[_0xf52a('0x8')]||'';this[_0xf52a('0x9')]=_0x1ea4bb['serverUrl']||'';this[_0xf52a('0xa')]=_0x1ea4bb[_0xf52a('0xa')]||{};}module[_0xf52a('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0248231..899947a 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 _0x1339=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x303da0,_0x2da127){var _0x2c210a=function(_0x35bfae){while(--_0x35bfae){_0x303da0['push'](_0x303da0['shift']());}};_0x2c210a(++_0x2da127);}(_0x1339,0x1ed));var _0x9133=function(_0x3fd930,_0x101cf3){_0x3fd930=_0x3fd930-0x0;var _0x5f518f=_0x1339[_0x3fd930];return _0x5f518f;};'use strict';function Dynamics365Account(_0x421620){this['id']=_0x421620['id']||0x0;this['name']=_0x421620[_0x9133('0x0')]||'';this[_0x9133('0x1')]=_0x421620[_0x9133('0x1')]||'';this[_0x9133('0x2')]=_0x421620[_0x9133('0x2')]||'';this[_0x9133('0x3')]=_0x421620[_0x9133('0x3')]||'';this[_0x9133('0x4')]=_0x421620['tenantId']||'';this[_0x9133('0x5')]=_0x421620[_0x9133('0x5')]||'';this[_0x9133('0x6')]=_0x421620['clientSecret']||{};this[_0x9133('0x7')]=_0x421620[_0x9133('0x7')]||'';this[_0x9133('0x8')]=_0x421620[_0x9133('0x8')]||{};}module[_0x9133('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xda3f=['clientId','serverUrl','Configurations','exports','name','password','remoteUri','tenantId'];(function(_0x41532e,_0x53b20a){var _0xd8ff23=function(_0x5218bb){while(--_0x5218bb){_0x41532e['push'](_0x41532e['shift']());}};_0xd8ff23(++_0x53b20a);}(_0xda3f,0xec));var _0xfda3=function(_0x42fae5,_0x3f8e02){_0x42fae5=_0x42fae5-0x0;var _0x275512=_0xda3f[_0x42fae5];return _0x275512;};'use strict';function Dynamics365Account(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['username']=_0x33f0ce['username']||'';this['password']=_0x33f0ce[_0xfda3('0x1')]||'';this['remoteUri']=_0x33f0ce[_0xfda3('0x2')]||'';this[_0xfda3('0x3')]=_0x33f0ce['tenantId']||'';this[_0xfda3('0x4')]=_0x33f0ce[_0xfda3('0x4')]||'';this['clientSecret']=_0x33f0ce['clientSecret']||{};this[_0xfda3('0x5')]=_0x33f0ce[_0xfda3('0x5')]||'';this[_0xfda3('0x6')]=_0x33f0ce[_0xfda3('0x6')]||{};}module[_0xfda3('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 77cec6d..fecdaab 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 _0x0a80=['modem','v17,v27,v29','gateway','t38timeout','tech','SIP','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x362072,_0x35276c){var _0x3e37b7=function(_0x456e4c){while(--_0x456e4c){_0x362072['push'](_0x362072['shift']());}};_0x3e37b7(++_0x35276c);}(_0x0a80,0x1e8));var _0x00a8=function(_0x2e94a8,_0x1cfb4a){_0x2e94a8=_0x2e94a8-0x0;var _0x28ab4c=_0x0a80[_0x2e94a8];return _0x28ab4c;};'use strict';function FaxAccount(_0x497c0f){this['id']=_0x497c0f['id']||0x0;this[_0x00a8('0x0')]=_0x497c0f[_0x00a8('0x0')]||'';this[_0x00a8('0x1')]=_0x497c0f[_0x00a8('0x1')];this[_0x00a8('0x2')]=_0x497c0f['ecm'];this[_0x00a8('0x3')]=_0x497c0f[_0x00a8('0x3')];this[_0x00a8('0x4')]=_0x497c0f[_0x00a8('0x4')];this[_0x00a8('0x5')]=_0x497c0f[_0x00a8('0x5')]||0x960;this[_0x00a8('0x6')]=_0x497c0f[_0x00a8('0x6')]||0x3840;this[_0x00a8('0x7')]=_0x497c0f['modem']||_0x00a8('0x8');this[_0x00a8('0x9')]=_0x497c0f[_0x00a8('0x9')]||'no';this['faxdetect']=_0x497c0f['faxdetect']||'no';this[_0x00a8('0xa')]=_0x497c0f[_0x00a8('0xa')]||0x1388;this[_0x00a8('0xb')]=_0x497c0f[_0x00a8('0xb')]||_0x00a8('0xc');this['Trunk']=_0x497c0f['Trunk']?_0x497c0f['Trunk']:undefined;this[_0x00a8('0xd')]=_0x497c0f['ListId'];this['key']=_0x497c0f[_0x00a8('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x22d7=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x22d7,0x121));var _0x722d=function(_0x35e6ca,_0x54939f){_0x35e6ca=_0x35e6ca-0x0;var _0x239e43=_0x22d7[_0x35e6ca];return _0x239e43;};'use strict';function FaxAccount(_0x43ff2e){this['id']=_0x43ff2e['id']||0x0;this['name']=_0x43ff2e[_0x722d('0x0')]||'';this['description']=_0x43ff2e[_0x722d('0x1')];this[_0x722d('0x2')]=_0x43ff2e[_0x722d('0x2')];this[_0x722d('0x3')]=_0x43ff2e['headerinfo'];this[_0x722d('0x4')]=_0x43ff2e[_0x722d('0x4')];this['minrate']=_0x43ff2e[_0x722d('0x5')]||0x960;this[_0x722d('0x6')]=_0x43ff2e['maxrate']||0x3840;this[_0x722d('0x7')]=_0x43ff2e[_0x722d('0x7')]||_0x722d('0x8');this[_0x722d('0x9')]=_0x43ff2e[_0x722d('0x9')]||'no';this[_0x722d('0xa')]=_0x43ff2e['faxdetect']||'no';this[_0x722d('0xb')]=_0x43ff2e[_0x722d('0xb')]||0x1388;this[_0x722d('0xc')]=_0x43ff2e['tech']||_0x722d('0xd');this[_0x722d('0xe')]=_0x43ff2e['Trunk']?_0x43ff2e[_0x722d('0xe')]:undefined;this['ListId']=_0x43ff2e[_0x722d('0xf')];this[_0x722d('0x10')]=_0x43ff2e[_0x722d('0x10')];}module[_0x722d('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ae43bae..7819003 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 _0x6183=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x450be5,_0x411ef2){var _0x11d66e=function(_0x6a5861){while(--_0x6a5861){_0x450be5['push'](_0x450be5['shift']());}};_0x11d66e(++_0x411ef2);}(_0x6183,0xdb));var _0x3618=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6183[_0x57b54c];return _0x59cc19;};'use strict';function FreshdeskAccount(_0xf8e4b0){this['id']=_0xf8e4b0['id']||0x0;this[_0x3618('0x0')]=_0xf8e4b0[_0x3618('0x0')]||'';this[_0x3618('0x1')]=_0xf8e4b0[_0x3618('0x1')]||'';this['apiKey']=_0xf8e4b0['token']||'';this[_0x3618('0x2')]=_0xf8e4b0[_0x3618('0x2')]||'';this['serverUrl']=_0xf8e4b0[_0x3618('0x3')]||'';this[_0x3618('0x4')]=_0xf8e4b0[_0x3618('0x4')]||{};}module[_0x3618('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x1b8f=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x29c9eb,_0x3d680b){var _0x438352=function(_0x1e5198){while(--_0x1e5198){_0x29c9eb['push'](_0x29c9eb['shift']());}};_0x438352(++_0x3d680b);}(_0x1b8f,0xee));var _0xf1b8=function(_0x5dff44,_0x2e2a74){_0x5dff44=_0x5dff44-0x0;var _0x1742cb=_0x1b8f[_0x5dff44];return _0x1742cb;};'use strict';function FreshdeskAccount(_0x25dae1){this['id']=_0x25dae1['id']||0x0;this[_0xf1b8('0x0')]=_0x25dae1['name']||'';this['username']=_0x25dae1[_0xf1b8('0x1')]||'';this[_0xf1b8('0x2')]=_0x25dae1[_0xf1b8('0x3')]||'';this[_0xf1b8('0x4')]=_0x25dae1[_0xf1b8('0x4')]||'';this['serverUrl']=_0x25dae1[_0xf1b8('0x5')]||'';this[_0xf1b8('0x6')]=_0x25dae1['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index dac6b1d..0dd4e0c 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 _0xd0c9=['token','remoteUri','serverUrl','Configurations','name','apiKey'];(function(_0x3acb8c,_0x21ebc9){var _0x5930b8=function(_0x2135cb){while(--_0x2135cb){_0x3acb8c['push'](_0x3acb8c['shift']());}};_0x5930b8(++_0x21ebc9);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xd0c9[_0x4fbfd9];return _0x31dc94;};'use strict';function FreshsalesAccount(_0x176579){this['id']=_0x176579['id']||0x0;this[_0x9d0c('0x0')]=_0x176579['name']||'';this['username']=_0x176579['username']||'';this[_0x9d0c('0x1')]=_0x176579[_0x9d0c('0x2')]||'';this[_0x9d0c('0x3')]=_0x176579['remoteUri']||'';this[_0x9d0c('0x4')]=_0x176579['serverUrl']||'';this['Configurations']=_0x176579[_0x9d0c('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x5bd7=['apiKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x2d0f1d,_0x34ea6f){var _0x42866f=function(_0x4055f4){while(--_0x4055f4){_0x2d0f1d['push'](_0x2d0f1d['shift']());}};_0x42866f(++_0x34ea6f);}(_0x5bd7,0x12a));var _0x75bd=function(_0x15bffd,_0x3f5d61){_0x15bffd=_0x15bffd-0x0;var _0xd4cfb3=_0x5bd7[_0x15bffd];return _0xd4cfb3;};'use strict';function FreshsalesAccount(_0x8ef36f){this['id']=_0x8ef36f['id']||0x0;this[_0x75bd('0x0')]=_0x8ef36f[_0x75bd('0x0')]||'';this[_0x75bd('0x1')]=_0x8ef36f['username']||'';this[_0x75bd('0x2')]=_0x8ef36f['token']||'';this[_0x75bd('0x3')]=_0x8ef36f[_0x75bd('0x3')]||'';this['serverUrl']=_0x8ef36f[_0x75bd('0x4')]||'';this[_0x75bd('0x5')]=_0x8ef36f[_0x75bd('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c798dd4..5da8b1d 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 _0x6791=['motionChannel','voice','mohtime','type','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','holdtime','assigned','lastAssignedTo'];(function(_0x3cd198,_0x3be472){var _0x15b607=function(_0x31adca){while(--_0x31adca){_0x3cd198['push'](_0x3cd198['shift']());}};_0x15b607(++_0x3be472);}(_0x6791,0x168));var _0x1679=function(_0x116202,_0x3e70da){_0x116202=_0x116202-0x0;var _0x20897c=_0x6791[_0x116202];return _0x20897c;};'use strict';function QueueReport(){this[_0x1679('0x0')]='inbound';this[_0x1679('0x1')]='';this['calleridnum']='';this[_0x1679('0x2')]='';this[_0x1679('0x3')]='';this[_0x1679('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x1679('0x5')]=0x1;this[_0x1679('0x6')]=0x1;this[_0x1679('0x7')]=![];this[_0x1679('0x8')]=null;this['queuecallercomplete']=![];this[_0x1679('0x9')]=null;this['queuecallerexit']=![];this[_0x1679('0xa')]=null;this['originalposition']=0x1;this[_0x1679('0xb')]='';this[_0x1679('0xc')]='';this[_0x1679('0xd')]='';this[_0x1679('0xe')]='';this['context']='';this['exten']='';this['priority']='';this[_0x1679('0xf')]=0x0;this[_0x1679('0x10')]=![];this[_0x1679('0x11')]='';this[_0x1679('0x12')]=_0x1679('0x13');this[_0x1679('0x14')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x08a0=['queuecallerjoinAt','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','motionChannel','voice','variables','exports','type','inbound','uniqueid','calleridnum','queue'];(function(_0x160a41,_0x219b47){var _0x13f6fc=function(_0x373cc9){while(--_0x373cc9){_0x160a41['push'](_0x160a41['shift']());}};_0x13f6fc(++_0x219b47);}(_0x08a0,0xc1));var _0x008a=function(_0x7ad661,_0x1e4efa){_0x7ad661=_0x7ad661-0x0;var _0x363e14=_0x08a0[_0x7ad661];return _0x363e14;};'use strict';function QueueReport(){this[_0x008a('0x0')]=_0x008a('0x1');this[_0x008a('0x2')]='';this[_0x008a('0x3')]='';this['calleridname']='';this[_0x008a('0x4')]='';this[_0x008a('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x008a('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x008a('0x7')]=null;this[_0x008a('0x8')]=![];this[_0x008a('0x9')]=null;this[_0x008a('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x008a('0xb')]='';this[_0x008a('0xc')]='';this[_0x008a('0xd')]='';this[_0x008a('0xe')]='';this[_0x008a('0xf')]='';this[_0x008a('0x10')]='';this[_0x008a('0x11')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x008a('0x12')]=_0x008a('0x13');this['mohtime']=0x0;this[_0x008a('0x14')]={};}module[_0x008a('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1ac68a2..969301b 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 _0x77b0=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x527042,_0xa94f9c){var _0x523411=function(_0x1f1911){while(--_0x1f1911){_0x527042['push'](_0x527042['shift']());}};_0x523411(++_0xa94f9c);}(_0x77b0,0xd4));var _0x077b=function(_0x2416d7,_0x3807e2){_0x2416d7=_0x2416d7-0x0;var _0x2e6ddd=_0x77b0[_0x2416d7];return _0x2e6ddd;};'use strict';function SalesforceAccount(_0x145060){this['id']=_0x145060['id']||0x0;this[_0x077b('0x0')]=_0x145060[_0x077b('0x0')]||'';this['username']=_0x145060[_0x077b('0x1')]||'';this[_0x077b('0x2')]=_0x145060[_0x077b('0x2')]||'';this[_0x077b('0x3')]=_0x145060[_0x077b('0x3')]||'';this['clientId']=_0x145060[_0x077b('0x4')]||'';this[_0x077b('0x5')]=_0x145060[_0x077b('0x5')]||'';this[_0x077b('0x6')]=_0x145060[_0x077b('0x6')]||'';this[_0x077b('0x7')]=_0x145060['type']||'integrationTab';this[_0x077b('0x8')]=_0x145060['serverUrl']||'';this[_0x077b('0x9')]=_0x145060[_0x077b('0x9')]||{};}module[_0x077b('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x14a0=['remoteUri','password','clientId','clientSecret','type','integrationTab','Configurations','name','username'];(function(_0x17223b,_0x34e094){var _0x9c36f9=function(_0x540b36){while(--_0x540b36){_0x17223b['push'](_0x17223b['shift']());}};_0x9c36f9(++_0x34e094);}(_0x14a0,0x8e));var _0x014a=function(_0x12fcdb,_0x3582c5){_0x12fcdb=_0x12fcdb-0x0;var _0x3fcef4=_0x14a0[_0x12fcdb];return _0x3fcef4;};'use strict';function SalesforceAccount(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||'';this[_0x014a('0x2')]=_0x1ee939[_0x014a('0x2')]||'';this[_0x014a('0x3')]=_0x1ee939['password']||'';this['clientId']=_0x1ee939[_0x014a('0x4')]||'';this[_0x014a('0x5')]=_0x1ee939[_0x014a('0x5')]||'';this['securityToken']=_0x1ee939['securityToken']||'';this[_0x014a('0x6')]=_0x1ee939[_0x014a('0x6')]||_0x014a('0x7');this['serverUrl']=_0x1ee939['serverUrl']||'';this[_0x014a('0x8')]=_0x1ee939['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index dc92eb3..3017839 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 _0xce12=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xce12,0xba));var _0x2ce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce12[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x4e1b51){this['id']=_0x4e1b51['id']||0x0;this[_0x2ce1('0x0')]=_0x4e1b51[_0x2ce1('0x0')]||'';this['username']=_0x4e1b51[_0x2ce1('0x1')]||'';this[_0x2ce1('0x2')]=_0x4e1b51[_0x2ce1('0x2')]||'';this[_0x2ce1('0x3')]=_0x4e1b51[_0x2ce1('0x3')]||'';this['serverUrl']=_0x4e1b51[_0x2ce1('0x4')]||'';this[_0x2ce1('0x5')]=_0x4e1b51[_0x2ce1('0x5')]||{};}module[_0x2ce1('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xfc6c=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x36ae06,_0x57da2d){var _0x25ffc7=function(_0x38be3a){while(--_0x38be3a){_0x36ae06['push'](_0x36ae06['shift']());}};_0x25ffc7(++_0x57da2d);}(_0xfc6c,0x69));var _0xcfc6=function(_0x4c7929,_0x2eb33d){_0x4c7929=_0x4c7929-0x0;var _0x2cfc8f=_0xfc6c[_0x4c7929];return _0x2cfc8f;};'use strict';function ServicenowAccount(_0xa936a2){this['id']=_0xa936a2['id']||0x0;this[_0xcfc6('0x0')]=_0xa936a2[_0xcfc6('0x0')]||'';this['username']=_0xa936a2[_0xcfc6('0x1')]||'';this['password']=_0xa936a2['password']||'';this[_0xcfc6('0x2')]=_0xa936a2[_0xcfc6('0x2')]||'';this[_0xcfc6('0x3')]=_0xa936a2['serverUrl']||'';this[_0xcfc6('0x4')]=_0xa936a2[_0xcfc6('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d7eca4a..f5d4790 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 _0xf6b9=['name','remoteUri','serverUrl','Configurations','exports'];(function(_0x554c0e,_0x2396bd){var _0x5c2afe=function(_0xd6606b){while(--_0xd6606b){_0x554c0e['push'](_0x554c0e['shift']());}};_0x5c2afe(++_0x2396bd);}(_0xf6b9,0x1d1));var _0x9f6b=function(_0x2c47b8,_0x28d0cd){_0x2c47b8=_0x2c47b8-0x0;var _0x555cd6=_0xf6b9[_0x2c47b8];return _0x555cd6;};'use strict';function SugarcrmAccount(_0x5b25e6){this['id']=_0x5b25e6['id']||0x0;this['name']=_0x5b25e6[_0x9f6b('0x0')]||'';this['username']=_0x5b25e6['username']||'';this['password']=_0x5b25e6['password']||'';this[_0x9f6b('0x1')]=_0x5b25e6['remoteUri']||'';this[_0x9f6b('0x2')]=_0x5b25e6[_0x9f6b('0x2')]||'';this[_0x9f6b('0x3')]=_0x5b25e6[_0x9f6b('0x3')]||{};}module[_0x9f6b('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x3393=['exports','name','username','password','remoteUri','serverUrl'];(function(_0x17a6b2,_0x302f8d){var _0x514157=function(_0x3fc6fd){while(--_0x3fc6fd){_0x17a6b2['push'](_0x17a6b2['shift']());}};_0x514157(++_0x302f8d);}(_0x3393,0xbb));var _0x3339=function(_0x191d8b,_0x31f7f0){_0x191d8b=_0x191d8b-0x0;var _0x51499b=_0x3393[_0x191d8b];return _0x51499b;};'use strict';function SugarcrmAccount(_0x2dd774){this['id']=_0x2dd774['id']||0x0;this['name']=_0x2dd774[_0x3339('0x0')]||'';this[_0x3339('0x1')]=_0x2dd774[_0x3339('0x1')]||'';this['password']=_0x2dd774[_0x3339('0x2')]||'';this[_0x3339('0x3')]=_0x2dd774[_0x3339('0x3')]||'';this[_0x3339('0x4')]=_0x2dd774[_0x3339('0x4')]||'';this['Configurations']=_0x2dd774['Configurations']||{};}module[_0x3339('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 18e6533..a178909 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 _0xad6b=['address','exports','name','accountcode','state','stateTime','unknown'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xad6b,0x159));var _0xbad6=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xad6b[_0x2dadb9];return _0x2f0097;};'use strict';function Telephone(_0x11b539){this['id']=_0x11b539['id']||0x0;this[_0xbad6('0x0')]=_0x11b539['name']||'';this[_0xbad6('0x1')]=_0x11b539[_0xbad6('0x1')]||'';this[_0xbad6('0x2')]='unknown';this[_0xbad6('0x3')]=0x0;this['status']=_0xbad6('0x4');this[_0xbad6('0x5')]='';}module[_0xbad6('0x6')]=Telephone; \ No newline at end of file +var _0x074a=['status','exports','name','accountcode','state','unknown','stateTime'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0x074a,0xe2));var _0xa074=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x074a[_0xa464c9];return _0x3d73c4;};'use strict';function Telephone(_0x3202d8){this['id']=_0x3202d8['id']||0x0;this[_0xa074('0x0')]=_0x3202d8[_0xa074('0x0')]||'';this['accountcode']=_0x3202d8[_0xa074('0x1')]||'';this[_0xa074('0x2')]=_0xa074('0x3');this[_0xa074('0x4')]=0x0;this[_0xa074('0x5')]=_0xa074('0x3');this['address']='';}module[_0xa074('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 65609a1..2ad7a14 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x50bba5,_0x3217f4){var _0x9e75c7=function(_0x52de14){while(--_0x52de14){_0x50bba5['push'](_0x50bba5['shift']());}};_0x9e75c7(++_0x3217f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x3ae293,_0xcf2a38){var _0xc03d9b=function(_0x2304f2){while(--_0x2304f2){_0x3ae293['push'](_0x3ae293['shift']());}};_0xc03d9b(++_0xcf2a38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d8ba8bf..64aa0f1 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x2fea54,_0x5d45fd){var _0x4bc7fb=function(_0xf791a0){while(--_0xf791a0){_0x2fea54['push'](_0x2fea54['shift']());}};_0x4bc7fb(++_0x5d45fd);}(_0x8603,0x190));var _0x3860=function(_0xc79747,_0x474512){_0xc79747=_0xc79747-0x0;var _0x2e5512=_0x8603[_0xc79747];return _0x2e5512;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('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 c224caf..1cc78d2 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 _0xc288=['domain','domainport','refresh','registrationtime','defaultuser','exports','name','state','stateTime','status','unknown','registry','indexOf','split','host','port'];(function(_0x33dda7,_0xd20f08){var _0x2467b6=function(_0x113b4b){while(--_0x113b4b){_0x33dda7['push'](_0x33dda7['shift']());}};_0x2467b6(++_0xd20f08);}(_0xc288,0xb6));var _0x8c28=function(_0x14e4ce,_0x5e59c0){_0x14e4ce=_0x14e4ce-0x0;var _0x1c77c7=_0xc288[_0x14e4ce];return _0x1c77c7;};'use strict';function Trunk(_0x20dd41){this['id']=_0x20dd41['id']||0x0;this['active']=_0x20dd41['active']||![];this[_0x8c28('0x0')]=_0x20dd41['name']||'';this[_0x8c28('0x1')]='unknown';this[_0x8c28('0x2')]=0x0;this[_0x8c28('0x3')]=_0x8c28('0x4');this['registry']=_0x20dd41[_0x8c28('0x5')]&&_0x20dd41[_0x8c28('0x5')][_0x8c28('0x6')](':')?_0x20dd41[_0x8c28('0x5')][_0x8c28('0x7')](':')[0x0]:'';this[_0x8c28('0x8')]='';this[_0x8c28('0x9')]='';this[_0x8c28('0xa')]='';this[_0x8c28('0xb')]='';this[_0x8c28('0xc')]='';this['stateRegistry']='unknown';this[_0x8c28('0xd')]='';this['address']='';this[_0x8c28('0xe')]=_0x20dd41[_0x8c28('0xe')]||'';}module[_0x8c28('0xf')]=Trunk; \ No newline at end of file +var _0xd018=['address','defaultuser','active','name','state','unknown','stateTime','status','registry','split','port','domain','domainport','refresh','stateRegistry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd018,0x179));var _0x8d01=function(_0x4eb0ad,_0x5bfdd4){_0x4eb0ad=_0x4eb0ad-0x0;var _0x2c72fd=_0xd018[_0x4eb0ad];return _0x2c72fd;};'use strict';function Trunk(_0x442099){this['id']=_0x442099['id']||0x0;this[_0x8d01('0x0')]=_0x442099[_0x8d01('0x0')]||![];this[_0x8d01('0x1')]=_0x442099[_0x8d01('0x1')]||'';this[_0x8d01('0x2')]=_0x8d01('0x3');this[_0x8d01('0x4')]=0x0;this[_0x8d01('0x5')]='unknown';this[_0x8d01('0x6')]=_0x442099[_0x8d01('0x6')]&&_0x442099[_0x8d01('0x6')]['indexOf'](':')?_0x442099[_0x8d01('0x6')][_0x8d01('0x7')](':')[0x0]:'';this['host']='';this[_0x8d01('0x8')]='';this[_0x8d01('0x9')]='';this[_0x8d01('0xa')]='';this[_0x8d01('0xb')]='';this[_0x8d01('0xc')]=_0x8d01('0x3');this['registrationtime']='';this[_0x8d01('0xd')]='';this[_0x8d01('0xe')]=_0x442099[_0x8d01('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0cb5196..0dc0b73 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 _0x7716=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1bcba9,_0x7d9fb){var _0x2d593c=function(_0xfc7cff){while(--_0xfc7cff){_0x1bcba9['push'](_0x1bcba9['shift']());}};_0x2d593c(++_0x7d9fb);}(_0x7716,0xa4));var _0x6771=function(_0x3fc59a,_0x5c0c1d){_0x3fc59a=_0x3fc59a-0x0;var _0x2af724=_0x7716[_0x3fc59a];return _0x2af724;};'use strict';function voiceExtension(_0x49832b){this['id']=_0x49832b['id']||0x0;this['exten']=_0x49832b[_0x6771('0x0')]||'';this['recordingFormat']=_0x49832b[_0x6771('0x1')]||_0x6771('0x2');this['mandatoryDisposition']=_0x49832b[_0x6771('0x3')]||![];}module[_0x6771('0x4')]=voiceExtension; \ No newline at end of file +var _0xa5c8=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa5c8,0x192));var _0x8a5c=function(_0x5064d9,_0x46d457){_0x5064d9=_0x5064d9-0x0;var _0x45090d=_0xa5c8[_0x5064d9];return _0x45090d;};'use strict';function voiceExtension(_0x481a2d){this['id']=_0x481a2d['id']||0x0;this[_0x8a5c('0x0')]=_0x481a2d[_0x8a5c('0x0')]||'';this[_0x8a5c('0x1')]=_0x481a2d[_0x8a5c('0x1')]||'none';this['mandatoryDisposition']=_0x481a2d[_0x8a5c('0x2')]||![];}module[_0x8a5c('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 7643e5e..d42fe16 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 _0xbd87=['predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls'];(function(_0x4bdc8c,_0x1f57d2){var _0x4565e2=function(_0x321eeb){while(--_0x321eeb){_0x4bdc8c['push'](_0x4bdc8c['shift']());}};_0x4565e2(++_0x1f57d2);}(_0xbd87,0x84));var _0x7bd8=function(_0x445510,_0x171042){_0x445510=_0x445510-0x0;var _0x5043a3=_0xbd87[_0x445510];return _0x5043a3;};'use strict';var statusDesc=['unknown',_0x7bd8('0x0'),_0x7bd8('0x1'),_0x7bd8('0x2'),_0x7bd8('0x3'),_0x7bd8('0x4'),_0x7bd8('0x5'),_0x7bd8('0x6'),_0x7bd8('0x7')];var monitorFormat={'wav':_0x7bd8('0x8'),'wav49':_0x7bd8('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x7bd8('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x1441d8){this['id']=_0x1441d8['id']||0x0;this[_0x7bd8('0xb')]=_0x1441d8['name']||'';this[_0x7bd8('0xc')]=_0x1441d8[_0x7bd8('0xc')]||'';this[_0x7bd8('0xd')]=_0x1441d8['type']||_0x7bd8('0xe');this[_0x7bd8('0xf')]=0x0;this[_0x7bd8('0x10')]=0x0;this[_0x7bd8('0x11')]=0x0;this[_0x7bd8('0x12')]=0x0;this[_0x7bd8('0x13')]=0x0;this[_0x7bd8('0x14')]=0x0;this[_0x7bd8('0x15')]=0x0;this[_0x7bd8('0x16')]=0x0;this[_0x7bd8('0x17')]=0x0;this['loggedIn']=0x0;this[_0x7bd8('0x18')]=0x0;this['acw']=_0x1441d8['acw']||![];this[_0x7bd8('0x19')]=_0x1441d8[_0x7bd8('0x19')]||0xa;this[_0x7bd8('0x1a')]=_0x1441d8[_0x7bd8('0x1a')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x7bd8('0x1b')]=0x0;this[_0x7bd8('0x1c')]=0x0;this[_0x7bd8('0x1d')]=_0x1441d8['dialTimezone']||null;this['dialGlobalInterval']=_0x1441d8[_0x7bd8('0x1e')]?_0x1441d8[_0x7bd8('0x1e')]:null;this[_0x7bd8('0x1f')]=_0x1441d8[_0x7bd8('0x1f')];this['dialMethod']=_0x1441d8[_0x7bd8('0x20')]||_0x7bd8('0x21');this[_0x7bd8('0x22')]=_0x1441d8[_0x7bd8('0x22')]||0x0;this[_0x7bd8('0x23')]=_0x1441d8[_0x7bd8('0x23')]||0x0;this['dialPowerLevel']=_0x1441d8[_0x7bd8('0x24')]||0x1;this[_0x7bd8('0x25')]=_0x1441d8['dialPredictiveOptimization']||_0x7bd8('0x26');this['dialPredictiveOptimizationPercentage']=_0x1441d8[_0x7bd8('0x27')]||0.03;this[_0x7bd8('0x28')]=_0x1441d8[_0x7bd8('0x28')]||0x258;this['dialOriginateCallerIdName']=_0x1441d8[_0x7bd8('0x29')]||_0x7bd8('0x2a');this[_0x7bd8('0x2b')]=_0x1441d8[_0x7bd8('0x2b')]||'anonymous';this[_0x7bd8('0x2c')]=_0x1441d8['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x1441d8[_0x7bd8('0x2d')]||_0x7bd8('0x2e');this[_0x7bd8('0x2f')]=_0x1441d8[_0x7bd8('0x2f')]||0x3;this[_0x7bd8('0x30')]=_0x1441d8[_0x7bd8('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x1441d8[_0x7bd8('0x31')]||0x3;this[_0x7bd8('0x32')]=_0x1441d8['dialCongestionRetryFrequency']||0x96;this[_0x7bd8('0x33')]=_0x1441d8[_0x7bd8('0x33')]||0x3;this[_0x7bd8('0x34')]=_0x1441d8['dialBusyRetryFrequency']||0x96;this[_0x7bd8('0x35')]=_0x1441d8[_0x7bd8('0x35')]||0x3;this[_0x7bd8('0x36')]=_0x1441d8['dialNoAnswerRetryFrequency']||0x96;this[_0x7bd8('0x37')]=_0x1441d8[_0x7bd8('0x37')]||0x3;this[_0x7bd8('0x38')]=_0x1441d8[_0x7bd8('0x38')]||0x96;this['dialDropMaxRetry']=_0x1441d8['dialDropMaxRetry']||0x3;this[_0x7bd8('0x39')]=_0x1441d8[_0x7bd8('0x39')]||0x96;this[_0x7bd8('0x3a')]=_0x1441d8[_0x7bd8('0x3a')]||0x3;this[_0x7bd8('0x3b')]=_0x1441d8[_0x7bd8('0x3b')]||0x96;this[_0x7bd8('0x3c')]=_0x1441d8[_0x7bd8('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x1441d8[_0x7bd8('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x1441d8[_0x7bd8('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1441d8['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x1441d8[_0x7bd8('0x3f')]||0x4;this[_0x7bd8('0x40')]=_0x1441d8[_0x7bd8('0x40')]?_0x1441d8[_0x7bd8('0x40')]:undefined;this[_0x7bd8('0x41')]=_0x1441d8[_0x7bd8('0x41')]?_0x1441d8['TrunkBackup']:undefined;this[_0x7bd8('0x42')]=_0x1441d8['dialPrefix']||undefined;this[_0x7bd8('0x43')]=_0x1441d8[_0x7bd8('0x43')]?_0x1441d8[_0x7bd8('0x43')]:undefined;this[_0x7bd8('0x44')]=_0x1441d8[_0x7bd8('0x44')]||_0x7bd8('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x1441d8[_0x7bd8('0x46')]||undefined;this[_0x7bd8('0x47')]=_0x1441d8['dialCutDigit']||undefined;this[_0x7bd8('0x48')]=strategy[_0x1441d8[_0x7bd8('0x48')]]||_0x7bd8('0xa');this[_0x7bd8('0x49')]=!![];this[_0x7bd8('0x4a')]=_0x1441d8[_0x7bd8('0x4a')]||![];this[_0x7bd8('0x4b')]=_0x1441d8[_0x7bd8('0x4b')];this[_0x7bd8('0x4c')]=_0x1441d8[_0x7bd8('0x4c')];this[_0x7bd8('0x4d')]=_0x1441d8[_0x7bd8('0x4d')];this[_0x7bd8('0x4e')]=_0x1441d8['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x1441d8[_0x7bd8('0x4f')];this[_0x7bd8('0x50')]=_0x1441d8[_0x7bd8('0x50')];this['dialAMDMaximumNumberOfWords']=_0x1441d8[_0x7bd8('0x51')];this[_0x7bd8('0x52')]=_0x1441d8[_0x7bd8('0x52')];this['dialAMDMaximumWordLength']=_0x1441d8['dialAMDMaximumWordLength'];this[_0x7bd8('0x53')]=0x0;this['pTalking']=0x0;this[_0x7bd8('0x54')]=_0x1441d8['timeout'];this[_0x7bd8('0x55')]=0x0;this[_0x7bd8('0x56')]=0x0;this[_0x7bd8('0x57')]=0x0;this[_0x7bd8('0x58')]=0x0;this[_0x7bd8('0x59')]=0x0;this[_0x7bd8('0x5a')]=0x0;this[_0x7bd8('0x5b')]=0x0;this[_0x7bd8('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x7bd8('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x7bd8('0x5e')]=0x0;this[_0x7bd8('0x5f')]=undefined;this[_0x7bd8('0x60')]=undefined;this[_0x7bd8('0x61')]=undefined;this[_0x7bd8('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x7bd8('0x63')]=0x0;this[_0x7bd8('0x64')]=0x0;this[_0x7bd8('0x65')]=0x0;this[_0x7bd8('0x66')]=0x0;this[_0x7bd8('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x7bd8('0x68')]=_0x1441d8[_0x7bd8('0x69')]||0x14;this[_0x7bd8('0x6a')]=_0x1441d8[_0x7bd8('0x69')]||0xa;this[_0x7bd8('0x6b')]=0x0;this[_0x7bd8('0x6c')]=0x0;this[_0x7bd8('0x6d')]=0x1;this[_0x7bd8('0x6e')]=0x0;this[_0x7bd8('0x6f')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x7bd8('0x70')]=_0x1441d8['dialRecallMeTimeout']||0x1e;this[_0x7bd8('0x71')]=_0x1441d8['dialRecallInQueue']||![];this['dialQueueProject2']=_0x1441d8[_0x7bd8('0x72')]||undefined;this['dialAgiAfterHangupClient']=_0x1441d8[_0x7bd8('0x73')]||![];this[_0x7bd8('0x74')]=_0x1441d8['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1441d8[_0x7bd8('0xc')]]?monitorFormat[_0x1441d8[_0x7bd8('0xc')]]:undefined;this[_0x7bd8('0x75')]=_0x1441d8[_0x7bd8('0x75')]||![];this[_0x7bd8('0x76')]=_0x1441d8['mandatoryDispositionPause']?_0x1441d8[_0x7bd8('0x76')]:undefined;}module[_0x7bd8('0x77')]=VoiceQueue; \ No newline at end of file +var _0x5fb4=['erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x5fb4,0x183));var _0x45fb=function(_0x4d79a4,_0x31ad70){_0x4d79a4=_0x4d79a4-0x0;var _0x562c00=_0x5fb4[_0x4d79a4];return _0x562c00;};'use strict';var statusDesc=[_0x45fb('0x0'),_0x45fb('0x1'),_0x45fb('0x2'),_0x45fb('0x3'),_0x45fb('0x4'),_0x45fb('0x5'),_0x45fb('0x6'),_0x45fb('0x7'),_0x45fb('0x8')];var monitorFormat={'wav':_0x45fb('0x9'),'wav49':'wav49','gsm':_0x45fb('0xa')};var strategy={'rrmemory':_0x45fb('0xb'),'roundrobin':_0x45fb('0xc')};function VoiceQueue(_0x6a7cc0){this['id']=_0x6a7cc0['id']||0x0;this[_0x45fb('0xd')]=_0x6a7cc0['name']||'';this['monitor_format']=_0x6a7cc0[_0x45fb('0xe')]||'';this[_0x45fb('0xf')]=_0x6a7cc0[_0x45fb('0xf')]||'inbound';this[_0x45fb('0x10')]=0x0;this[_0x45fb('0x11')]=0x0;this[_0x45fb('0x12')]=0x0;this[_0x45fb('0x13')]=0x0;this[_0x45fb('0x14')]=0x0;this[_0x45fb('0x15')]=0x0;this[_0x45fb('0x16')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x45fb('0x17')]=0x0;this[_0x45fb('0x18')]=0x0;this[_0x45fb('0x19')]=_0x6a7cc0[_0x45fb('0x19')]||![];this['acwTimeout']=_0x6a7cc0[_0x45fb('0x1a')]||0xa;this[_0x45fb('0x1b')]=_0x6a7cc0[_0x45fb('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this[_0x45fb('0x1c')]='';this[_0x45fb('0x1d')]=0x0;this['temp']=0x0;this[_0x45fb('0x1e')]=_0x6a7cc0['dialTimezone']||null;this[_0x45fb('0x1f')]=_0x6a7cc0[_0x45fb('0x1f')]?_0x6a7cc0[_0x45fb('0x1f')]:null;this[_0x45fb('0x20')]=_0x6a7cc0[_0x45fb('0x20')];this[_0x45fb('0x21')]=_0x6a7cc0[_0x45fb('0x21')]||_0x45fb('0x22');this[_0x45fb('0x23')]=_0x6a7cc0[_0x45fb('0x23')]||0x0;this[_0x45fb('0x24')]=_0x6a7cc0[_0x45fb('0x24')]||0x0;this[_0x45fb('0x25')]=_0x6a7cc0[_0x45fb('0x25')]||0x1;this[_0x45fb('0x26')]=_0x6a7cc0[_0x45fb('0x26')]||'dropRate';this[_0x45fb('0x27')]=_0x6a7cc0['dialPredictiveOptimizationPercentage']||0.03;this[_0x45fb('0x28')]=_0x6a7cc0[_0x45fb('0x28')]||0x258;this[_0x45fb('0x29')]=_0x6a7cc0[_0x45fb('0x29')]||_0x45fb('0x2a');this[_0x45fb('0x2b')]=_0x6a7cc0[_0x45fb('0x2b')]||_0x45fb('0x2a');this[_0x45fb('0x2c')]=_0x6a7cc0[_0x45fb('0x2c')]||0x1e;this[_0x45fb('0x2d')]=_0x6a7cc0[_0x45fb('0x2d')]||_0x45fb('0x2e');this[_0x45fb('0x2f')]=_0x6a7cc0[_0x45fb('0x2f')]||0x3;this['dialQueueProject']=_0x6a7cc0[_0x45fb('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x6a7cc0[_0x45fb('0x31')]||0x3;this[_0x45fb('0x32')]=_0x6a7cc0['dialCongestionRetryFrequency']||0x96;this[_0x45fb('0x33')]=_0x6a7cc0['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x6a7cc0[_0x45fb('0x34')]||0x96;this['dialNoAnswerMaxRetry']=_0x6a7cc0[_0x45fb('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0x6a7cc0[_0x45fb('0x36')]||0x96;this[_0x45fb('0x37')]=_0x6a7cc0[_0x45fb('0x37')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x6a7cc0[_0x45fb('0x38')]||0x96;this[_0x45fb('0x39')]=_0x6a7cc0['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x6a7cc0[_0x45fb('0x3a')]||0x96;this[_0x45fb('0x3b')]=_0x6a7cc0['dialAbandonedMaxRetry']||0x3;this[_0x45fb('0x3c')]=_0x6a7cc0[_0x45fb('0x3c')]||0x96;this[_0x45fb('0x3d')]=_0x6a7cc0[_0x45fb('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x6a7cc0['dialMachineRetryFrequency']||0x96;this[_0x45fb('0x3e')]=_0x6a7cc0['dialAgentRejectMaxRetry']||0x3;this[_0x45fb('0x3f')]=_0x6a7cc0['dialAgentRejectRetryFrequency']||0x96;this[_0x45fb('0x40')]=_0x6a7cc0[_0x45fb('0x40')]||0x4;this[_0x45fb('0x41')]=_0x6a7cc0[_0x45fb('0x41')]?_0x6a7cc0[_0x45fb('0x41')]:undefined;this[_0x45fb('0x42')]=_0x6a7cc0[_0x45fb('0x42')]?_0x6a7cc0['TrunkBackup']:undefined;this[_0x45fb('0x43')]=_0x6a7cc0[_0x45fb('0x43')]||undefined;this[_0x45fb('0x44')]=_0x6a7cc0[_0x45fb('0x44')]?_0x6a7cc0['Interval']:undefined;this[_0x45fb('0x45')]=_0x6a7cc0[_0x45fb('0x45')]||'DESC';this[_0x45fb('0x46')]=_0x6a7cc0['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x6a7cc0[_0x45fb('0x47')]||undefined;this[_0x45fb('0x48')]=strategy[_0x6a7cc0['strategy']]||_0x45fb('0xb');this[_0x45fb('0x49')]=!![];this[_0x45fb('0x4a')]=_0x6a7cc0['dialAMDActive']||![];this[_0x45fb('0x4b')]=_0x6a7cc0[_0x45fb('0x4b')];this[_0x45fb('0x4c')]=_0x6a7cc0[_0x45fb('0x4c')];this[_0x45fb('0x4d')]=_0x6a7cc0[_0x45fb('0x4d')];this[_0x45fb('0x4e')]=_0x6a7cc0[_0x45fb('0x4e')];this['dialAMDMinWordLength']=_0x6a7cc0['dialAMDMinWordLength'];this[_0x45fb('0x4f')]=_0x6a7cc0['dialAMDBetweenWordsSilence'];this[_0x45fb('0x50')]=_0x6a7cc0[_0x45fb('0x50')];this[_0x45fb('0x51')]=_0x6a7cc0[_0x45fb('0x51')];this[_0x45fb('0x52')]=_0x6a7cc0[_0x45fb('0x52')];this[_0x45fb('0x53')]=0x0;this[_0x45fb('0x54')]=0x0;this[_0x45fb('0x55')]=_0x6a7cc0[_0x45fb('0x55')];this[_0x45fb('0x56')]=0x0;this[_0x45fb('0x57')]=0x0;this[_0x45fb('0x58')]=0x0;this[_0x45fb('0x59')]=0x0;this[_0x45fb('0x5a')]=0x0;this[_0x45fb('0x5b')]=0x0;this[_0x45fb('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x45fb('0x5d')]=0x0;this[_0x45fb('0x5e')]=0x0;this[_0x45fb('0x5f')]=0x0;this[_0x45fb('0x60')]=0x0;this[_0x45fb('0x61')]=0x0;this[_0x45fb('0x62')]=0x0;this[_0x45fb('0x63')]=undefined;this['startPredictive']=undefined;this[_0x45fb('0x64')]=undefined;this[_0x45fb('0x65')]=1.05;this[_0x45fb('0x66')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x45fb('0x67')]=0x0;this[_0x45fb('0x68')]=0x0;this[_0x45fb('0x69')]=0x0;this[_0x45fb('0x6a')]=0x0;this[_0x45fb('0x6b')]=0x0;this[_0x45fb('0x6c')]=0x0;this[_0x45fb('0x6d')]=_0x6a7cc0[_0x45fb('0x6e')]||0x14;this[_0x45fb('0x6f')]=_0x6a7cc0['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x45fb('0x70')]=0x0;this[_0x45fb('0x71')]=0x0;this[_0x45fb('0x72')]=0x1;this['erlangCalls']=0x0;this[_0x45fb('0x73')]=0x0;this[_0x45fb('0x74')]=0x0;this[_0x45fb('0x75')]=0x0;this[_0x45fb('0x76')]=_0x6a7cc0[_0x45fb('0x76')]||0x1e;this[_0x45fb('0x77')]=_0x6a7cc0[_0x45fb('0x77')]||![];this[_0x45fb('0x78')]=_0x6a7cc0[_0x45fb('0x78')]||undefined;this[_0x45fb('0x79')]=_0x6a7cc0[_0x45fb('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x6a7cc0[_0x45fb('0x7a')]||![];this[_0x45fb('0xe')]=monitorFormat[_0x6a7cc0[_0x45fb('0xe')]]?monitorFormat[_0x6a7cc0[_0x45fb('0xe')]]:undefined;this[_0x45fb('0x7b')]=_0x6a7cc0[_0x45fb('0x7b')]||![];this[_0x45fb('0x7c')]=_0x6a7cc0['mandatoryDispositionPause']?_0x6a7cc0[_0x45fb('0x7c')]:undefined;}module[_0x45fb('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 6328f81..1b42804 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 _0xb899=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2483cd,_0x4a816d){var _0x40b805=function(_0x3aa983){while(--_0x3aa983){_0x2483cd['push'](_0x2483cd['shift']());}};_0x40b805(++_0x4a816d);}(_0xb899,0x8b));var _0x9b89=function(_0x406346,_0x4c64b7){_0x406346=_0x406346-0x0;var _0x5b8801=_0xb899[_0x406346];return _0x5b8801;};'use strict';function VtigerAccount(_0x59fcd8){this['id']=_0x59fcd8['id']||0x0;this[_0x9b89('0x0')]=_0x59fcd8[_0x9b89('0x0')]||'';this['username']=_0x59fcd8[_0x9b89('0x1')]||'';this[_0x9b89('0x2')]=_0x59fcd8[_0x9b89('0x2')]||'';this[_0x9b89('0x3')]=_0x59fcd8[_0x9b89('0x3')]||'';this[_0x9b89('0x4')]=_0x59fcd8[_0x9b89('0x4')]||'';this[_0x9b89('0x5')]=_0x59fcd8['Configurations']||{};}module[_0x9b89('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb72f=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x1e7d59,_0x5772f5){var _0x3fbf03=function(_0x3540c7){while(--_0x3540c7){_0x1e7d59['push'](_0x1e7d59['shift']());}};_0x3fbf03(++_0x5772f5);}(_0xb72f,0x1d8));var _0xfb72=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xb72f[_0x319e2e];return _0x302524;};'use strict';function VtigerAccount(_0x2b2a73){this['id']=_0x2b2a73['id']||0x0;this[_0xfb72('0x0')]=_0x2b2a73[_0xfb72('0x0')]||'';this['username']=_0x2b2a73[_0xfb72('0x1')]||'';this[_0xfb72('0x2')]=_0x2b2a73[_0xfb72('0x2')]||'';this[_0xfb72('0x3')]=_0x2b2a73[_0xfb72('0x3')]||'';this['serverUrl']=_0x2b2a73[_0xfb72('0x4')]||'';this[_0xfb72('0x5')]=_0x2b2a73[_0xfb72('0x5')]||{};}module[_0xfb72('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 2fe5e33..b10e482 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 _0x8b4a=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x426b42,_0x2b4502){var _0x570059=function(_0x120b3e){while(--_0x120b3e){_0x426b42['push'](_0x426b42['shift']());}};_0x570059(++_0x2b4502);}(_0x8b4a,0x118));var _0xa8b4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8b4a[_0x432682];return _0x463d05;};'use strict';function ZendeskAccount(_0x4e5956){this['id']=_0x4e5956['id']||0x0;this[_0xa8b4('0x0')]=_0x4e5956[_0xa8b4('0x0')]||'';this[_0xa8b4('0x1')]=_0x4e5956[_0xa8b4('0x1')]||'';this[_0xa8b4('0x2')]=_0x4e5956[_0xa8b4('0x2')]||'';this[_0xa8b4('0x3')]=_0x4e5956[_0xa8b4('0x3')]||'';this[_0xa8b4('0x4')]=_0x4e5956[_0xa8b4('0x4')]||'';this[_0xa8b4('0x5')]=_0x4e5956[_0xa8b4('0x5')]||'';this[_0xa8b4('0x6')]=_0x4e5956[_0xa8b4('0x6')]||_0xa8b4('0x7');this[_0xa8b4('0x8')]=_0x4e5956[_0xa8b4('0x8')]||'';this[_0xa8b4('0x9')]=_0x4e5956[_0xa8b4('0x9')]||{};}module[_0xa8b4('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x18f8=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x393bdc,_0x4fec04){var _0x2db012=function(_0xa2460d){while(--_0xa2460d){_0x393bdc['push'](_0x393bdc['shift']());}};_0x2db012(++_0x4fec04);}(_0x18f8,0xda));var _0x818f=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x18f8[_0x1f36bb];return _0xaf97fa;};'use strict';function ZendeskAccount(_0x5e040a){this['id']=_0x5e040a['id']||0x0;this[_0x818f('0x0')]=_0x5e040a['name']||'';this[_0x818f('0x1')]=_0x5e040a[_0x818f('0x1')]||'';this[_0x818f('0x2')]=_0x5e040a[_0x818f('0x2')]||'';this[_0x818f('0x3')]=_0x5e040a[_0x818f('0x3')]||'';this['remoteUri']=_0x5e040a[_0x818f('0x4')]||'';this[_0x818f('0x5')]=_0x5e040a[_0x818f('0x5')]||'';this[_0x818f('0x6')]=_0x5e040a[_0x818f('0x6')]||_0x818f('0x7');this[_0x818f('0x8')]=_0x5e040a[_0x818f('0x8')]||'';this[_0x818f('0x9')]=_0x5e040a[_0x818f('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index da3bd36..715b825 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 _0x09ce=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x265d9e,_0x3a55e4){var _0x53fe2f=function(_0xedda51){while(--_0xedda51){_0x265d9e['push'](_0x265d9e['shift']());}};_0x53fe2f(++_0x3a55e4);}(_0x09ce,0x1c1));var _0xe09c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x09ce[_0x321bb2];return _0x9c12ed;};'use strict';function ZohoAccount(_0x3685c8){this['id']=_0x3685c8['id']||0x0;this[_0xe09c('0x0')]=_0x3685c8[_0xe09c('0x0')]||'';this[_0xe09c('0x1')]=_0x3685c8[_0xe09c('0x1')]||'';this['host']=_0x3685c8[_0xe09c('0x2')]||'';this[_0xe09c('0x3')]=_0x3685c8[_0xe09c('0x3')]||'';this[_0xe09c('0x4')]=_0x3685c8['clientId']||'';this[_0xe09c('0x5')]=_0x3685c8[_0xe09c('0x5')]||'';this[_0xe09c('0x6')]=_0x3685c8[_0xe09c('0x6')]||'';this[_0xe09c('0x7')]=_0x3685c8['code']||'';this[_0xe09c('0x8')]=_0x3685c8['refreshToken']||'';this[_0xe09c('0x9')]=_0x3685c8[_0xe09c('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x267a=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x18ce82,_0x5d4b06){var _0x32cf13=function(_0x3f9757){while(--_0x3f9757){_0x18ce82['push'](_0x18ce82['shift']());}};_0x32cf13(++_0x5d4b06);}(_0x267a,0x13e));var _0xa267=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x267a[_0x2b1551];return _0x2fc2a1;};'use strict';function ZohoAccount(_0x11bd1a){this['id']=_0x11bd1a['id']||0x0;this[_0xa267('0x0')]=_0x11bd1a[_0xa267('0x0')]||'';this[_0xa267('0x1')]=_0x11bd1a[_0xa267('0x1')]||'';this[_0xa267('0x2')]=_0x11bd1a[_0xa267('0x2')]||'';this[_0xa267('0x3')]=_0x11bd1a[_0xa267('0x3')]||'';this['clientId']=_0x11bd1a[_0xa267('0x4')]||'';this['clientSecret']=_0x11bd1a[_0xa267('0x5')]||'';this[_0xa267('0x6')]=_0x11bd1a[_0xa267('0x6')]||'';this[_0xa267('0x7')]=_0x11bd1a[_0xa267('0x7')]||'';this[_0xa267('0x8')]=_0x11bd1a[_0xa267('0x8')]||'';this[_0xa267('0x9')]=_0x11bd1a[_0xa267('0x9')]||{};}module[_0xa267('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 336753d..b343f8a 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 _0x5a67=['name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue'];(function(_0x55cb9e,_0x5ba062){var _0x100025=function(_0x31b49c){while(--_0x31b49c){_0x55cb9e['push'](_0x55cb9e['shift']());}};_0x100025(++_0x5ba062);}(_0x5a67,0x1c7));var _0x75a6=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x5a67[_0x3598bb];return _0x13c837;};'use strict';var util=require(_0x75a6('0x0'));var _=require(_0x75a6('0x1'));var moment=require(_0x75a6('0x2'));function checkNameSurname(_0x5b6fb4,_0x2a1a57,_0x21f0d1){var _0x3e2463='';if(!_[_0x75a6('0x3')](_0x2a1a57)&&_0x75a6('0x4')===typeof _0x2a1a57){_0x3e2463+=_0x2a1a57;}if(!_[_0x75a6('0x3')](_0x21f0d1)&&_0x75a6('0x4')===typeof _0x21f0d1){_0x3e2463+='\x20'+_0x21f0d1;}if(_0x3e2463!==''){return _0x3e2463;}return _0x5b6fb4;}function Action(_0xc3c552,_0x3c24c4,_0x502a5b,_0x16dd36,_0x33a72b){this[_0x75a6('0x5')]=_0x502a5b||undefined;this['idContact']=_0xc3c552['id'];this[_0x75a6('0x6')]=_0x3c24c4[_0x75a6('0x7')];this[_0x75a6('0x8')]=_0x3c24c4[_0x75a6('0x8')];this[_0x75a6('0x9')]='queue';this[_0x75a6('0xa')]=![];this[_0x75a6('0xb')]=_['isNil'](_0xc3c552[_0x75a6('0xc')])?undefined:_0xc3c552[_0x75a6('0xc')][_0x75a6('0x7')];this[_0x75a6('0xd')]=this[_0x75a6('0xb')]?util['format'](_0x75a6('0xe'),this[_0x75a6('0xb')]):_0x16dd36||undefined;this[_0x75a6('0xf')]=checkNameSurname(_0xc3c552[_0x75a6('0x10')][_0x75a6('0x11')],_0xc3c552[_0x75a6('0x10')][_0x75a6('0x12')],_0xc3c552['Contact'][_0x75a6('0x13')]);this[_0x75a6('0x14')]=_0xc3c552[_0x75a6('0x14')]||![];this['calleridnum']=_0xc3c552[_0x75a6('0x10')]['phone'];this['scheduledat']=_0xc3c552['scheduledat'];this['countbusyretry']=_0xc3c552[_0x75a6('0x15')]||0x0;this[_0x75a6('0x16')]=_0xc3c552[_0x75a6('0x16')]||0x0;this[_0x75a6('0x17')]=_0xc3c552[_0x75a6('0x17')]||0x0;this['countglobal']=(_0xc3c552['countbusyretry']||0x0)+(_0xc3c552['countcongestionretry']||0x0)+(_0xc3c552[_0x75a6('0x17')]||0x0)+(_0xc3c552[_0x75a6('0x18')]||0x0)+(_0xc3c552[_0x75a6('0x19')]||0x0)+(_0xc3c552[_0x75a6('0x1a')]||0x0)+(_0xc3c552[_0x75a6('0x1b')]||0x0)+(_0xc3c552['countagentrejectretry']||0x0);this[_0x75a6('0x18')]=_0xc3c552[_0x75a6('0x18')]||0x0;this[_0x75a6('0x19')]=_0xc3c552[_0x75a6('0x19')]||0x0;this['countabandonedretry']=_0xc3c552[_0x75a6('0x1a')]||0x0;this[_0x75a6('0x1b')]=_0xc3c552[_0x75a6('0x1b')]||0x0;this[_0x75a6('0x1c')]=_0xc3c552['countagentrejectretry']||0x0;this[_0x75a6('0x1d')]=_0xc3c552['callback'];this[_0x75a6('0x1e')]=_0xc3c552[_0x75a6('0x1e')];this[_0x75a6('0x1f')]=_0xc3c552[_0x75a6('0x1f')];this[_0x75a6('0x20')]=_0xc3c552['recallme'];this[_0x75a6('0x21')]=_0xc3c552['ContactId'];this['ListId']=_0xc3c552['ListId'];this[_0x75a6('0x22')]=_[_0x75a6('0x3')](_0xc3c552[_0x75a6('0xc')])?_0xc3c552['UserId']:_0xc3c552[_0x75a6('0xc')]['id'];this['VoiceQueueId']=_0xc3c552[_0x75a6('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x75a6('0x24')][_0x75a6('0x25')]=function(){return util[_0x75a6('0x26')](_0x75a6('0x27'),this[_0x75a6('0xf')],this[_0x75a6('0x28')]);};module[_0x75a6('0x29')]=Action; \ No newline at end of file +var _0xb58a=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum'];(function(_0xdc5e38,_0x3ec324){var _0x27db97=function(_0x146d16){while(--_0x146d16){_0xdc5e38['push'](_0xdc5e38['shift']());}};_0x27db97(++_0x3ec324);}(_0xb58a,0x1e3));var _0xab58=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0xb58a[_0x2ecb67];return _0x168079;};'use strict';var util=require(_0xab58('0x0'));var _=require(_0xab58('0x1'));var moment=require(_0xab58('0x2'));function checkNameSurname(_0x3da930,_0x1a417f,_0x28f8fb){var _0x57987f='';if(!_['isNil'](_0x1a417f)&&_0xab58('0x3')===typeof _0x1a417f){_0x57987f+=_0x1a417f;}if(!_[_0xab58('0x4')](_0x28f8fb)&&_0xab58('0x3')===typeof _0x28f8fb){_0x57987f+='\x20'+_0x28f8fb;}if(_0x57987f!==''){return _0x57987f;}return _0x3da930;}function Action(_0x3e459f,_0x3a0d72,_0xc1e2b1,_0x58b8b6,_0x1685be){this[_0xab58('0x5')]=_0xc1e2b1||undefined;this[_0xab58('0x6')]=_0x3e459f['id'];this[_0xab58('0x7')]=_0x3a0d72[_0xab58('0x8')];this[_0xab58('0x9')]=_0x3a0d72[_0xab58('0x9')];this['campaigntype']=_0xab58('0x7');this[_0xab58('0xa')]=![];this[_0xab58('0xb')]=_[_0xab58('0x4')](_0x3e459f[_0xab58('0xc')])?undefined:_0x3e459f[_0xab58('0xc')][_0xab58('0x8')];this['channelAgent']=this[_0xab58('0xb')]?util[_0xab58('0xd')](_0xab58('0xe'),this['membername']):_0x58b8b6||undefined;this[_0xab58('0xf')]=checkNameSurname(_0x3e459f[_0xab58('0x10')][_0xab58('0x11')],_0x3e459f[_0xab58('0x10')]['firstName'],_0x3e459f[_0xab58('0x10')][_0xab58('0x12')]);this[_0xab58('0x13')]=_0x3e459f[_0xab58('0x13')]||![];this[_0xab58('0x14')]=_0x3e459f[_0xab58('0x10')][_0xab58('0x11')];this[_0xab58('0x15')]=_0x3e459f[_0xab58('0x15')];this[_0xab58('0x16')]=_0x3e459f[_0xab58('0x16')]||0x0;this['countcongestionretry']=_0x3e459f[_0xab58('0x17')]||0x0;this['countnoanswerretry']=_0x3e459f[_0xab58('0x18')]||0x0;this['countglobal']=(_0x3e459f[_0xab58('0x16')]||0x0)+(_0x3e459f[_0xab58('0x17')]||0x0)+(_0x3e459f[_0xab58('0x18')]||0x0)+(_0x3e459f[_0xab58('0x19')]||0x0)+(_0x3e459f['countdropretry']||0x0)+(_0x3e459f[_0xab58('0x1a')]||0x0)+(_0x3e459f[_0xab58('0x1b')]||0x0)+(_0x3e459f[_0xab58('0x1c')]||0x0);this[_0xab58('0x19')]=_0x3e459f[_0xab58('0x19')]||0x0;this['countdropretry']=_0x3e459f[_0xab58('0x1d')]||0x0;this['countabandonedretry']=_0x3e459f['countabandonedretry']||0x0;this['countmachineretry']=_0x3e459f[_0xab58('0x1b')]||0x0;this['countagentrejectretry']=_0x3e459f[_0xab58('0x1c')]||0x0;this[_0xab58('0x1e')]=_0x3e459f[_0xab58('0x1e')];this[_0xab58('0x1f')]=_0x3e459f[_0xab58('0x1f')];this[_0xab58('0x20')]=_0x3e459f[_0xab58('0x20')];this['recallme']=_0x3e459f[_0xab58('0x21')];this[_0xab58('0x22')]=_0x3e459f['ContactId'];this[_0xab58('0x23')]=_0x3e459f[_0xab58('0x23')];this[_0xab58('0x24')]=_[_0xab58('0x4')](_0x3e459f[_0xab58('0xc')])?_0x3e459f[_0xab58('0x24')]:_0x3e459f['Agent']['id'];this[_0xab58('0x25')]=_0x3e459f[_0xab58('0x25')];this[_0xab58('0x26')]='';this['originatecalleridname']='';}Action['prototype'][_0xab58('0x27')]=function(){return util[_0xab58('0xd')](_0xab58('0x28'),this[_0xab58('0xf')],this['number']);};module[_0xab58('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index fa45cb5..04d4d91 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 _0x8451=['[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','linkedid','YYYY-MM-DD\x20HH:mm:ss','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','pTalking:\x20','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','isUndefined','object','reason','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','\x20IdHopper:\x20','custom:agentcalled','called','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','status','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','dialCutDigit','phone','SIP/%s/%s%s','trim','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','starttime','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','outbound','name','strategy','answered','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','active','Interval','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','NOT_ACTIVE','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','stringify','dialAnswer','pick','contactId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','dialNoSuchNumberMaxRetry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8451,0xaa));var _0x1845=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8451[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0x1845('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x1845('0x1'));var moment=require(_0x1845('0x2'));var md5=require(_0x1845('0x3'));var Redis=require(_0x1845('0x4'));var config=require('../../../config/environment');var logger=require(_0x1845('0x5'))(_0x1845('0x6'));var loggerAction=require('../../../config/logger')(_0x1845('0x7'));var ami=require(_0x1845('0x8'));var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require('./util/util');config[_0x1845('0x9')]=_[_0x1845('0xa')](config['redis'],{'host':_0x1845('0xb'),'port':0x18eb});var io=require(_0x1845('0xc'))(new Redis(config[_0x1845('0x9')]));var Sequence=function(){};Sequence[_0x1845('0xd')][_0x1845('0xe')]=function(_0x22879f){this[_0x1845('0xf')]=this[_0x1845('0xf')]?this[_0x1845('0xf')][_0x1845('0x10')](_0x22879f):_0x22879f();};function Preview(_0x3380c1){this[_0x1845('0x11')]=new Sequence();this[_0x1845('0x12')]=_0x3380c1[_0x1845('0x13')];this[_0x1845('0x14')]=_0x3380c1[_0x1845('0x14')];this[_0x1845('0x15')]={};this[_0x1845('0x16')]=_0x3380c1[_0x1845('0x16')];this[_0x1845('0x17')]=0x0;ami['on'](_0x1845('0x18'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x1845('0x19'),this[_0x1845('0x1a')][_0x1845('0x1b')](this));ami['on'](_0x1845('0x1c'),this[_0x1845('0x1d')][_0x1845('0x1b')](this));ami['on'](_0x1845('0x1e'),this['syncDialEnd'][_0x1845('0x1b')](this));ami['on'](_0x1845('0x1f'),this['syncNewExten'][_0x1845('0x1b')](this));ami['on']('varset',this[_0x1845('0x20')][_0x1845('0x1b')](this));ami['on'](_0x1845('0x21'),this[_0x1845('0x22')]['bind'](this));ami['on'](_0x1845('0x23'),this['syncBlindTransfer']['bind'](this));this[_0x1845('0x24')](this[_0x1845('0x12')]);}function emit(_0x910642,_0x2f965f,_0x15f413){io['to'](_0x910642)[_0x1845('0x25')](_0x2f965f,_0x15f413);}function emitCampaignPreview(_0x1cada3){if(_0x1cada3['type']===_0x1845('0x26')){var _0x56eb62={'id':_0x1cada3['id'],'name':_0x1cada3[_0x1845('0x27')],'strategy':_0x1cada3[_0x1845('0x28')],'answered':_0x1cada3[_0x1845('0x29')],'available':_0x1cada3['available'],'loggedIn':_0x1cada3['loggedIn'],'pTalking':_0x1cada3[_0x1845('0x2a')],'sumBillable':_0x1cada3[_0x1845('0x2b')],'sumDuration':_0x1cada3[_0x1845('0x2c')],'sumHoldTime':_0x1cada3[_0x1845('0x2d')]||0x0,'talking':_0x1cada3['talking'],'total':_0x1cada3[_0x1845('0x2e')],'type':_0x1cada3[_0x1845('0x2f')],'unmanaged':_0x1cada3['unmanaged'],'abandoned':_0x1cada3[_0x1845('0x30')],'waiting':_0x1cada3[_0x1845('0x31')],'loggedInDb':_0x1cada3[_0x1845('0x32')],'dialActive':_0x1cada3[_0x1845('0x33')],'dialMethod':_0x1cada3[_0x1845('0x34')],'dialOriginateCallerIdName':_0x1cada3['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1cada3[_0x1845('0x35')],'dialOriginateTimeout':_0x1cada3[_0x1845('0x36')],'dialPrefix':_0x1cada3[_0x1845('0x37')],'outboundAnswerAgiCallsDay':_0x1cada3[_0x1845('0x38')],'outboundAnswerCallsDay':_0x1cada3['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1cada3['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1cada3['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1cada3[_0x1845('0x39')],'outboundDropCallsDayACS':_0x1cada3[_0x1845('0x3a')],'outboundDropCallsDayCallersExit':_0x1cada3[_0x1845('0x3b')],'outboundDropCallsDayTimeout':_0x1cada3[_0x1845('0x3c')],'outboundNoAnswerCallsDay':_0x1cada3[_0x1845('0x3d')],'outboundNoSuchCallsDay':_0x1cada3[_0x1845('0x3e')],'outboundOriginateFailureCallsDay':_0x1cada3[_0x1845('0x3f')],'outboundReCallsDay':_0x1cada3[_0x1845('0x40')],'outboundRejectCallsDay':_0x1cada3[_0x1845('0x41')],'outboundUnknownCallsDay':_0x1cada3[_0x1845('0x42')],'outboundAbandonedCallsDay':_0x1cada3[_0x1845('0x43')],'predictiveIntervalAnsweredCalls':_0x1cada3[_0x1845('0x44')],'predictiveIntervalAvgHoldtime':_0x1cada3[_0x1845('0x45')],'predictiveIntervalAvgTalktime':_0x1cada3[_0x1845('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x1cada3[_0x1845('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x1cada3['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1cada3[_0x1845('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x1cada3[_0x1845('0x49')],'predictiveIntervalHitRate':_0x1cada3[_0x1845('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x1cada3[_0x1845('0x4b')],'predictiveIntervalPauses':_0x1cada3['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1cada3[_0x1845('0x4c')],'predictiveIntervalTotalCalls':_0x1cada3[_0x1845('0x4d')],'message':_0x1cada3[_0x1845('0x4e')],'originated':_0x1cada3['originated'],'erlangCalls':_0x1cada3[_0x1845('0x4f')],'erlangCallToSecond':_0x1cada3[_0x1845('0x50')],'erlangAbandonmentRate':_0x1cada3[_0x1845('0x51')],'erlangBusyFactor':_0x1cada3['erlangBusyFactor'],'startPredictive':_0x1cada3['startPredictive'],'startProgressive':_0x1cada3[_0x1845('0x52')]};if(_0x1cada3[_0x1845('0x53')]){_0x56eb62[_0x1845('0x53')]={'id':_0x1cada3['Trunk']['id'],'name':_0x1cada3[_0x1845('0x53')][_0x1845('0x27')],'active':_0x1cada3[_0x1845('0x53')][_0x1845('0x54')],'callerid':_0x1cada3[_0x1845('0x53')]['callerid']};}if(_0x1cada3[_0x1845('0x55')]){_0x56eb62['Interval']={'id':_0x1cada3[_0x1845('0x55')]['id'],'name':_0x1cada3[_0x1845('0x55')][_0x1845('0x27')]};}var _0x150866=md5(JSON['stringify'](_0x56eb62));if(_0x1cada3['md5']!==_0x150866){_0x1cada3['md5']=_0x150866;emit(util[_0x1845('0x56')](_0x1845('0x57'),_0x56eb62['name']),_0x1845('0x58'),_0x56eb62);}}}function emitVoiceQueueChannelRemove(_0x4403bf){logger[_0x1845('0x59')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x4403bf));emit(util['format'](_0x1845('0x57'),_0x4403bf[_0x1845('0x27')]),_0x1845('0x5a'),_0x4403bf);io[_0x1845('0x25')](_0x1845('0x5b'),_0x4403bf);}function notSendMessagesQueue(_0x5f51f1){if(_0x5f51f1[_0x1845('0x5c')]){if(_0x5f51f1[_0x1845('0x5d')]===0x0&&_0x5f51f1[_0x1845('0x2a')]===0x0){_0x5f51f1[_0x1845('0x5c')]=![];_0x5f51f1[_0x1845('0x5e')]=0x0;_0x5f51f1[_0x1845('0x5f')]=0x0;_0x5f51f1[_0x1845('0x4e')]=_0x1845('0x60');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5f51f1[_0x1845('0x27')]+_0x1845('0x61'));}else{_0x5f51f1['message']=_0x1845('0x62');ut[_0x1845('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5f51f1[_0x1845('0x27')]+_0x1845('0x64'));}emitCampaignPreview(_0x5f51f1);}}Preview[_0x1845('0xd')][_0x1845('0x24')]=function(){var _0x3ae75f=this;setInterval(function(){_0x3ae75f[_0x1845('0x65')]();},0x7cf);};Preview[_0x1845('0xd')][_0x1845('0x65')]=function(){var _0x43d883=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x1e285d in _0x43d883){if(_0x43d883[_0x1845('0x66')](_0x1e285d)&&(_0x43d883[_0x1e285d][_0x1845('0x34')]===_0x1845('0x6')||_0x43d883[_0x1e285d][_0x1845('0x34')]==='booked')&&_0x43d883[_0x1e285d][_0x1845('0x2f')]===_0x1845('0x26')){if(this[_0x1845('0x17')]>0x7){this[_0x1845('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x43d883[_0x1845('0x66')](_0x1e285d)&&_0x43d883[_0x1e285d][_0x1845('0x34')]===_0x1845('0x6')&&_0x43d883[_0x1e285d][_0x1845('0x2f')]==='outbound'){if(_0x43d883[_0x1e285d][_0x1845('0x33')]){this[_0x1845('0x67')](_0x43d883[_0x1e285d]);this[_0x1845('0x68')](_0x43d883[_0x1e285d]);}else{notSendMessagesQueue(_0x43d883[_0x1e285d]);}}}};Preview[_0x1845('0xd')][_0x1845('0x69')]=function(_0x5696c0){var _0x41bf51=this;this[_0x1845('0x11')][_0x1845('0xe')](function(){if(!_[_0x1845('0x6a')](_0x41bf51['actions'][_0x5696c0])){loggerAction[_0x1845('0x59')](_0x1845('0x6b'),_0x5696c0,_0x1845('0x6c'),_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6d')],'originated:\x20',JSON[_0x1845('0x6e')](_0x41bf51[_0x1845('0x12')][_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6d')]][_0x1845('0x5d')]),'pTalking:\x20',JSON[_0x1845('0x6e')](_0x41bf51[_0x1845('0x12')][_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6d')]][_0x1845('0x2a')]),JSON[_0x1845('0x6e')](_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6f')]),JSON[_0x1845('0x6e')](_[_0x1845('0x70')](_0x41bf51['actions'][_0x5696c0],[_0x1845('0x71'),'UserId','VoiceQueueId',_0x1845('0x72')])));return ami[_0x1845('0x73')]({'action':'status','channel':_0x41bf51['actions'][_0x5696c0][_0x1845('0x74')]})[_0x1845('0x75')](function(_0x145361){if(_0x145361[_0x1845('0x4e')]===_0x1845('0x76')){setTimeout(function(){if(_0x41bf51[_0x1845('0x15')][_0x5696c0]){ut[_0x1845('0x77')](_0x41bf51['campaignsPreview'][_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6d')]],_0x1845('0x78'));if(_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6f')]===!![]){ut[_0x1845('0x79')](_0x41bf51[_0x1845('0x12')][_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6d')]],_0x1845('0x78'));ut[_0x1845('0x7a')](_0x1845('0x7b')+_0x5696c0,_0x41bf51[_0x1845('0x15')][_0x5696c0]['queue']);}ut[_0x1845('0x7a')](_0x1845('0x7c')+_0x5696c0,_0x41bf51[_0x1845('0x15')][_0x5696c0][_0x1845('0x6d')]);delete _0x41bf51[_0x1845('0x15')][_0x5696c0];}},0x2328);}});}});};Preview[_0x1845('0xd')][_0x1845('0x7d')]=function(){var _0x4e03f6=this;loggerAction[_0x1845('0x59')](_0x1845('0x7e'),_[_0x1845('0x7f')](this[_0x1845('0x15')]));for(var _0x1b1ccb in this[_0x1845('0x15')]){if(_0x4e03f6[_0x1845('0x15')]['hasOwnProperty'](_0x1b1ccb)){_0x4e03f6[_0x1845('0x69')](_0x1b1ccb);}}};Preview['prototype']['recallMe']=function(_0x25b6a5){var _0x2d169d=this;rpcDb[_0x1845('0x80')](_0x25b6a5['id'],ut[_0x1845('0x81')](this['agents']))[_0x1845('0x82')](function(_0x4358b9){if(!_[_0x1845('0x6a')](_0x4358b9)){for(var _0x202000=0x0;_0x202000<_0x4358b9[_0x1845('0x83')];_0x202000+=0x1){if(ut['getDiff'](_0x4358b9[_0x202000][_0x1845('0x84')])<_0x25b6a5[_0x1845('0x85')]*0x3c){if(_0x4358b9[_0x202000]['Agent']&&!_0x4358b9[_0x202000][_0x1845('0x86')][_0x1845('0x87')]){_0x2d169d['run'](_0x4358b9[_0x202000]['id'])['then'](ut[_0x1845('0x88')](_0x1845('0x89')))[_0x1845('0x75')](ut[_0x1845('0x88')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x4358b9[_0x202000]['id']);}}else{var _0x281e09=new Action(_0x4358b9[_0x202000],_0x25b6a5);_0x281e09['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25b6a5[_0x1845('0x40')]+=0x1;ut[_0x1845('0x8a')](_0x281e09,0x17,'RecallInQueue');if(_0x25b6a5[_0x1845('0x8b')]){rpcDb[_0x1845('0x8c')](ut[_0x1845('0x8d')](_0x4358b9[_0x202000]));rpcDb['createCustomerHistory'](_0x281e09,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x281e09,0x16,_0x1845('0x8e'));rpcDb['createCustomerHistory'](_0x281e09,_0x1845('0x8f'));rpcDb[_0x1845('0x90')](_0x281e09,_0x1845('0x8f'));}}}}})[_0x1845('0x75')](ut[_0x1845('0x88')](_0x1845('0x91')));};Preview[_0x1845('0xd')][_0x1845('0x67')]=function(_0x3f8ad4){_0x3f8ad4[_0x1845('0x5c')]=!![];if(ut[_0x1845('0x92')](_0x3f8ad4[_0x1845('0x93')])){_0x3f8ad4[_0x1845('0x4e')]=_0x1845('0x94');}else if(!ut[_0x1845('0x95')](_0x3f8ad4[_0x1845('0x33')])){_0x3f8ad4['message']=_0x1845('0x60');}else if(!this[_0x1845('0x96')](_0x3f8ad4[_0x1845('0x53')])){if(!this[_0x1845('0x96')](_0x3f8ad4['TrunkBackup'])){_0x3f8ad4[_0x1845('0x4e')]=_0x1845('0x97');}else{_0x3f8ad4[_0x1845('0x4e')]=_0x1845('0x98');}}else{_0x3f8ad4[_0x1845('0x4e')]=_0x1845('0x98');}emitCampaignPreview(_0x3f8ad4);};Preview[_0x1845('0xd')][_0x1845('0x99')]=function(_0x3e9416,_0x4cbf43,_0x22627b){var _0x47bcf9=this;var _0x1ad2ea=this[_0x1845('0x15')][_0x4cbf43];var _0x190313=this[_0x1845('0x12')][_0x1ad2ea[_0x1845('0x6d')]];var _0x24f54b;if(_0x190313){switch(_0x22627b){case'1':_0x190313['outboundNoSuchCallsDay']+=0x1;_0x1ad2ea['countnosuchnumberretry']+=0x1;_0x1ad2ea[_0x1845('0x9a')]=ut[_0x1845('0x9b')](_0x1ad2ea);ut[_0x1845('0x8a')](_0x1ad2ea,0x0,_0x1845('0x9c'));ami[_0x1845('0x25')](_0x1845('0x9d'),ut[_0x1845('0x9e')](_0x1ad2ea,_0x1845('0x9f')));rpcDb[_0x1845('0xa0')](_0x1ad2ea,_0x1845('0xa1'));if(ut[_0x1845('0x9b')](_0x1ad2ea)>=_0x190313['dialGlobalMaxRetry']){_0x24f54b=ut[_0x1845('0xa2')](_0x1ad2ea,0xf,_0x1845('0xa3'));rpcDb[_0x1845('0x90')](_0x24f54b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x1ad2ea['countnosuchnumberretry']>=_0x190313[_0x1845('0xa4')]){rpcDb[_0x1845('0x90')](_0x1ad2ea,_0x1845('0xa5'));}else{rpcDb['rescheduleContact'](ut[_0x1845('0xa6')](_0x1ad2ea,'countnosuchnumberretry',_0x190313['dialNoSuchNumberRetryFrequency']),_0x1ad2ea[_0x1845('0xa7')],_0x1ad2ea['activeContact']);}}delete this['actions'][_0x3e9416[_0x1845('0xa8')]];break;case'ANSWER':var _0x55a947=moment()[_0x1845('0x56')](_0x1845('0xa9'));_0x1ad2ea['responsetime']=_0x55a947;_0x1ad2ea['answertime']=_0x55a947;_0x1ad2ea[_0x1845('0x6f')]=!![];_0x190313[_0x1845('0x2a')]+=0x1;logger['info'](_0x1845('0xaa'),_0x1ad2ea[_0x1845('0xab')],_0x1845('0xac'),_0x190313['name'],'pTalking:\x20',_0x190313[_0x1845('0x2a')]);ami[_0x1845('0x25')](_0x1845('0xad'),ut[_0x1845('0x9e')](_0x1ad2ea,_0x1845('0xae'),this[_0x1845('0x12')][_0x1ad2ea['queue']]));if(_0x190313[_0x1845('0xaf')]){ami[_0x1845('0x25')]('custom:agentConnectPreview',ut[_0x1845('0xb0')](_0x1ad2ea));}break;case'16':ami[_0x1845('0x25')](_0x1845('0xb1'),ut['buildObj'](_0x1ad2ea,_0x1845('0xb2'),this[_0x1845('0x12')][_0x1ad2ea['queue']]));emitVoiceQueueChannelRemove(ut[_0x1845('0x9e')](_0x1ad2ea,_0x1845('0xb2')));_0x190313['outboundAnswerCallsDay']+=0x1;_0x190313[_0x1845('0x2e')]+=0x1;_0x190313[_0x1845('0x29')]+=0x1;ut[_0x1845('0x79')](_0x190313,_0x1845('0xb3'));_0x1ad2ea[_0x1845('0x9a')]=ut['totalGlobal'](_0x1ad2ea);ut[_0x1845('0x8a')](_0x1ad2ea,0x4,_0x1845('0xb4'));rpcDb['createCustomerHistory'](_0x1ad2ea,_0x1845('0xb5'));rpcDb['createCustomerFinal'](_0x1ad2ea,_0x1845('0xb6'));rpcDb[_0x1845('0xb7')](_0x1ad2ea);_0x190313['sumDuration']+=_0x1ad2ea[_0x1845('0xb8')];_0x190313[_0x1845('0x2b')]+=_0x1ad2ea['talktime'];logger['info'](_0x1845('0xb9'),_0x1ad2ea[_0x1845('0xab')],_0x1845('0xac'),_0x190313[_0x1845('0x27')],_0x1845('0xba'),_0x190313[_0x1845('0x2a')]);delete this[_0x1845('0x15')][_0x3e9416[_0x1845('0xa8')]];break;case'BUSY':_0x190313['outboundBusyCallsDay']+=0x1;_0x1ad2ea[_0x1845('0xbb')]+=0x1;_0x1ad2ea[_0x1845('0x9a')]=ut[_0x1845('0x9b')](_0x1ad2ea);ut[_0x1845('0x8a')](_0x1ad2ea,0x5,_0x1845('0xbc'));ami[_0x1845('0x25')](_0x1845('0xbd'),ut['buildObj'](_0x1ad2ea,'busy'));rpcDb[_0x1845('0xa0')](_0x1ad2ea,_0x1845('0xbe'));if(ut['totalGlobal'](_0x1ad2ea)>=_0x190313[_0x1845('0xbf')]){_0x24f54b=ut['cloneAction'](_0x1ad2ea,0xf,_0x1845('0xa3'));rpcDb[_0x1845('0x90')](_0x24f54b,_0x1845('0xc0'));}else{if(_0x1ad2ea[_0x1845('0xbb')]>=_0x190313['dialBusyMaxRetry']){rpcDb[_0x1845('0x90')](_0x1ad2ea,_0x1845('0xbe'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1ad2ea,'countbusyretry',_0x190313[_0x1845('0xc1')]),_0x1ad2ea[_0x1845('0xa7')],_0x1ad2ea[_0x1845('0xc2')]);}}break;case _0x1845('0xc3'):_0x190313[_0x1845('0x3d')]+=0x1;_0x1ad2ea[_0x1845('0xc4')]+=0x1;_0x1ad2ea[_0x1845('0x9a')]=ut[_0x1845('0x9b')](_0x1ad2ea);ut[_0x1845('0x8a')](_0x1ad2ea,0x3,_0x1845('0xc5'));ami[_0x1845('0x25')]('custom:agentnoanswer',ut['buildObj'](_0x1ad2ea,_0x1845('0xc6')));rpcDb[_0x1845('0xa0')](_0x1ad2ea,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x1ad2ea)>=_0x190313[_0x1845('0xbf')]){_0x24f54b=ut[_0x1845('0xa2')](_0x1ad2ea,0xf,_0x1845('0xa3'));rpcDb['createCustomerFinal'](_0x24f54b,_0x1845('0xc7'));}else{if(_0x1ad2ea['countnoanswerretry']>=_0x190313[_0x1845('0xc8')]){rpcDb[_0x1845('0x90')](_0x1ad2ea,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x1845('0xc9')](ut[_0x1845('0xa6')](_0x1ad2ea,_0x1845('0xc4'),_0x190313['dialNoAnswerRetryFrequency']),_0x1ad2ea['unlockAgent'],_0x1ad2ea[_0x1845('0xc2')]);}}break;case'CONGESTION':_0x190313['outboundCongestionCallsDay']+=0x1;_0x1ad2ea['countcongestionretry']+=0x1;_0x1ad2ea['countglobal']=ut[_0x1845('0x9b')](_0x1ad2ea);ut['logCustomer'](_0x1ad2ea,0x8,_0x1845('0xca'));ami[_0x1845('0x25')]('custom:agentcongestion',ut['buildObj'](_0x1ad2ea,_0x1845('0xcb')));rpcDb[_0x1845('0xa0')](_0x1ad2ea,_0x1845('0xcc'));if(ut[_0x1845('0x9b')](_0x1ad2ea)>=_0x190313[_0x1845('0xbf')]){_0x24f54b=ut[_0x1845('0xa2')](_0x1ad2ea,0xf,_0x1845('0xa3'));rpcDb[_0x1845('0x90')](_0x24f54b,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1ad2ea[_0x1845('0xcd')]>=_0x190313[_0x1845('0xce')]){rpcDb[_0x1845('0x90')](_0x1ad2ea,_0x1845('0xcc'));}else{rpcDb[_0x1845('0xc9')](ut['scheduledAt'](_0x1ad2ea,_0x1845('0xcd'),_0x190313[_0x1845('0xc1')]),_0x1ad2ea[_0x1845('0xa7')],_0x1ad2ea[_0x1845('0xc2')]);}}break;case'CANCEL':_0x190313[_0x1845('0x41')]+=0x1;_0x1ad2ea[_0x1845('0xcf')]+=0x1;_0x1ad2ea[_0x1845('0x9a')]=ut[_0x1845('0x9b')](_0x1ad2ea);ut[_0x1845('0x8a')](_0x1ad2ea,0x14,_0x1845('0xd0'));ami[_0x1845('0x25')]('custom:agentreject',ut[_0x1845('0x9e')](_0x1ad2ea,'agentreject'));rpcDb['createCustomerHistory'](_0x1ad2ea,'[syncHangupRequest][logAgentReject]');if(ut[_0x1845('0x9b')](_0x1ad2ea)>=_0x190313[_0x1845('0xbf')]){_0x24f54b=ut[_0x1845('0xa2')](_0x1ad2ea,0x14,_0x1845('0xd0'));rpcDb[_0x1845('0x90')](_0x24f54b,_0x1845('0xd1'));}else{if(_0x1ad2ea['countagentrejectretry']>=_0x190313[_0x1845('0xd2')]){rpcDb['createCustomerFinal'](_0x1ad2ea,_0x1845('0xd1'));}else{rpcDb[_0x1845('0xc9')](ut['scheduledAt'](_0x1ad2ea,'countagentrejectretry',_0x190313[_0x1845('0xd3')]),_0x1ad2ea['unlockAgent'],_0x1ad2ea[_0x1845('0xc2')]);}}break;case _0x1845('0xd4'):_0x190313['outboundAbandonedCallsDay']+=0x1;_0x1ad2ea['countabandonedretry']+=0x1;_0x1ad2ea[_0x1845('0x9a')]=ut[_0x1845('0x9b')](_0x1ad2ea);ut[_0x1845('0x8a')](_0x1ad2ea,0xb,'Abandoned');rpcDb[_0x1845('0xa0')](_0x1ad2ea,_0x1845('0xd5'));if(ut[_0x1845('0x9b')](_0x1ad2ea)>=_0x190313[_0x1845('0xbf')]){_0x24f54b=ut['cloneAction'](_0x1ad2ea,0xf,'Global');rpcDb[_0x1845('0x90')](_0x24f54b,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1ad2ea[_0x1845('0xd6')]>=_0x190313[_0x1845('0xd7')]){rpcDb[_0x1845('0x90')](_0x1ad2ea,_0x1845('0xd5'));}else{rpcDb[_0x1845('0xc9')](ut['scheduledAt'](_0x1ad2ea,_0x1845('0xd8'),_0x190313['dialAbandonedRetryFrequency']),_0x1ad2ea[_0x1845('0xa7')],_0x1ad2ea[_0x1845('0xc2')]);}}break;case'18':_0x190313[_0x1845('0x42')]+=0x1;_0x1ad2ea['countmachineretry']+=0x1;_0x1ad2ea[_0x1845('0x9a')]=ut[_0x1845('0x9b')](_0x1ad2ea);ut['logCustomer'](_0x1ad2ea,0x12,_0x3e9416[_0x1845('0xd9')]||_0x3e9416['dialstatus']);ami[_0x1845('0x25')](_0x1845('0xda'),ut[_0x1845('0x9e')](_0x1ad2ea,'amd'));rpcDb['createCustomerHistory'](_0x1ad2ea,_0x1845('0xdb'));if(ut[_0x1845('0x9b')](_0x1ad2ea)>=_0x190313[_0x1845('0xbf')]){_0x24f54b=ut[_0x1845('0xa2')](_0x1ad2ea,0xf,'Global');rpcDb['createCustomerFinal'](_0x24f54b,_0x1845('0xdb'));}else{rpcDb[_0x1845('0x90')](_0x1ad2ea,_0x1845('0xdb'));}delete this[_0x1845('0x15')][_0x3e9416[_0x1845('0xa8')]];break;case'19':_0x190313[_0x1845('0x42')]+=0x1;_0x1ad2ea['countglobal']=ut['totalGlobal'](_0x1ad2ea);ut[_0x1845('0x8a')](_0x1ad2ea,0x13,_0x3e9416['cause-txt']||_0x3e9416[_0x1845('0xdc')]);ami[_0x1845('0x25')](_0x1845('0xda'),ut['buildObj'](_0x1ad2ea,_0x1845('0xdd')));rpcDb[_0x1845('0xa0')](_0x1ad2ea,_0x1845('0xde'));if(ut[_0x1845('0x9b')](_0x1ad2ea)>=_0x190313['dialGlobalMaxRetry']){_0x24f54b=ut[_0x1845('0xa2')](_0x1ad2ea,0xf,_0x1845('0xa3'));rpcDb[_0x1845('0x90')](_0x24f54b,_0x1845('0xde'));}else{rpcDb['createCustomerFinal'](_0x1ad2ea,_0x1845('0xde'));}delete this[_0x1845('0x15')][_0x3e9416[_0x1845('0xa8')]];break;default:if(_0x1ad2ea[_0x1845('0x6f')]){ut[_0x1845('0x79')](_0x190313,_0x1845('0xdf'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x190313[_0x1845('0x27')],_0x3e9416);}_0x190313[_0x1845('0x42')]+=0x1;_0x1ad2ea[_0x1845('0x9a')]=ut[_0x1845('0x9b')](_0x1ad2ea);ut['logCustomer'](_0x1ad2ea,0xc,_0x3e9416[_0x1845('0xd9')]||_0x3e9416[_0x1845('0xdc')]);rpcDb[_0x1845('0xa0')](_0x1ad2ea,_0x1845('0xe0'));if(ut['totalGlobal'](_0x1ad2ea)>=_0x190313[_0x1845('0xbf')]){_0x24f54b=ut[_0x1845('0xa2')](_0x1ad2ea,0xf,'Global');rpcDb[_0x1845('0x90')](_0x24f54b,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x1845('0x90')](_0x1ad2ea,_0x1845('0xe1'));}delete this[_0x1845('0x15')][_0x3e9416[_0x1845('0xa8')]];}if(!(_0x1ad2ea[_0x1845('0x6f')]&&_0x22627b==='16')){ut[_0x1845('0x77')](_0x190313,_0x1845('0xe2'));logger[_0x1845('0x59')](_0x1845('0xe3'),_0x1ad2ea[_0x1845('0xab')],_0x1845('0xac'),_0x190313[_0x1845('0x27')],_0x1845('0xe4'),_0x190313[_0x1845('0x5d')]);}if(_0x22627b!==_0x1845('0xe5')){delete this[_0x1845('0x15')][_0x3e9416[_0x1845('0xa8')]];delete this[_0x1845('0x15')][_0x3e9416['destlinkedid']];}}};Preview[_0x1845('0xd')]['callProgressDetectingAgent']=function(_0x3f8877,_0x54f6f7,_0x138c48){if(_[_0x1845('0xe6')](_0x54f6f7)&&_0x1845('0xe7')!==typeof _0x54f6f7){return;}if(_['isUndefined'](_0x138c48)&&'object'!==typeof _0x138c48){return;}switch(_0x138c48[_0x1845('0xe8')]){case'0':ut['logAgent'](_0x3f8877,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x3f8877,_0x1845('0xe9'));break;case'3':ut['logAgent'](_0x3f8877,0x3,_0x1845('0xc5'));rpcDb['createAgentHistory'](_0x3f8877,_0x1845('0xea'));break;case'5':ut[_0x1845('0xeb')](_0x3f8877,0x5,_0x1845('0xbc'));rpcDb[_0x1845('0xec')](_0x3f8877,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x1845('0xeb')](_0x3f8877,0x8,'Congestion');rpcDb[_0x1845('0xec')](_0x3f8877,_0x1845('0xed'));break;case'22':ut[_0x1845('0xeb')](_0x3f8877,0x16,_0x1845('0xee'));rpcDb[_0x1845('0xec')](_0x3f8877,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x1845('0xeb')](_0x3f8877,0xc,_0x138c48['reason']);rpcDb[_0x1845('0xec')](_0x3f8877,_0x1845('0xed'));}ut[_0x1845('0x77')](_0x54f6f7,'[callProgressDetectingAgent]');logger[_0x1845('0x59')](_0x1845('0xef'),_0x3f8877[_0x1845('0xab')],_0x1845('0xac'),_0x54f6f7[_0x1845('0x27')],_0x1845('0xe4'),_0x54f6f7[_0x1845('0x5d')]);delete this[_0x1845('0x15')][_0x3f8877[_0x1845('0xab')]];};Preview[_0x1845('0xd')][_0x1845('0xf0')]=function(_0x5e8868,_0x4c7698,_0x41c210,_0x5c281e,_0x26c4b1){var _0x3e894a=this;return new BPromise(function(_0x1eff24,_0x343c54){if(_[_0x1845('0x6a')](_0x4c7698)||_[_0x1845('0x6a')](_0x4c7698[_0x1845('0xf1')])||_[_0x1845('0x6a')](_0x4c7698[_0x1845('0xf1')]['phone'])||_['isNil'](_0x4c7698[_0x1845('0xf2')])){_0x343c54(ut[_0x1845('0x4e')](_0x1845('0xf3'),_0x5c281e,_0x26c4b1));return;}var _0x34fd30=uuid['v4']();var _0xdf1696=_0x3e894a[_0x1845('0x12')][_0x4c7698[_0x1845('0x6c')][_0x1845('0x27')]];var _0x31dba1=_0x41c210?_0x3e894a['agents'][_0x41c210]['id']:undefined;_0x3e894a[_0x1845('0x15')][_0x34fd30]=new Action(_0x4c7698,_0xdf1696,_0x34fd30,_0x41c210,_0x31dba1);var _0x52a5b1=_0x3e894a[_0x1845('0x15')][_0x34fd30];_0x52a5b1['unlockAgent']=_0x5c281e;_0x52a5b1[_0x1845('0xc2')]=_0x26c4b1;_0x52a5b1[_0x1845('0xf4')]=_0x41c210;if(_[_0x1845('0xf5')](_0x5e8868)){_0x3e894a[_0x1845('0xf6')](_0x52a5b1,_0xdf1696,_0x4c7698,_0x41c210)[_0x1845('0x82')](function(_0x4988e7){logger[_0x1845('0x59')]('[Preview][execCall][success]','Queue:\x20'+_0x52a5b1['queue']+_0x1845('0xf7')+_0x52a5b1['idContact'],JSON[_0x1845('0x6e')](_0x4988e7));ami[_0x1845('0x25')](_0x1845('0xf8'),ut[_0x1845('0x9e')](_0x52a5b1,_0x1845('0xf9'),_0x3e894a[_0x1845('0x12')][_0x52a5b1[_0x1845('0x6d')]]));_0x1eff24(ut[_0x1845('0x4e')]('Calling'));})[_0x1845('0x75')](function(_0x281e7d){ut[_0x1845('0x63')]('[Preview][execCall][failure]',_0x281e7d);_0x343c54(ut[_0x1845('0x4e')](_0x1845('0xfa'),_0x5c281e,_0x26c4b1));});}else{_0xdf1696[_0x1845('0xfb')]+=0x1;ut[_0x1845('0xfc')](_0x52a5b1);rpcDb[_0x1845('0xfd')](_0x52a5b1,_0x1845('0xfe'));delete _0x3e894a[_0x1845('0x15')][_0x34fd30];_0x343c54(ut[_0x1845('0x4e')]('Contact\x20in\x20black\x20List',_0x5c281e,_0x26c4b1));}});};Preview[_0x1845('0xd')][_0x1845('0x96')]=function(_0x397660){return!_[_0x1845('0x6a')](_0x397660)&&!_[_0x1845('0x6a')](_0x397660[_0x1845('0x27')])&&!_['isNil'](_0x397660[_0x1845('0x54')])&&_0x397660[_0x1845('0x54')]&&!_[_0x1845('0x6a')](this['trunks'][util[_0x1845('0x56')]('SIP/%s',_0x397660[_0x1845('0x27')])])&&!_['isNil'](this[_0x1845('0x14')][util[_0x1845('0x56')](_0x1845('0xff'),_0x397660['name'])][_0x1845('0x100')])&&(this[_0x1845('0x14')][util[_0x1845('0x56')](_0x1845('0xff'),_0x397660[_0x1845('0x27')])]['status']==='reachable'||this[_0x1845('0x14')][util[_0x1845('0x56')]('SIP/%s',_0x397660[_0x1845('0x27')])][_0x1845('0x100')]==='unmonitored');};Preview[_0x1845('0xd')]['run']=function(_0x3019da,_0x17e10e){var _0x4c6490=this;return new BPromise(function(_0x1b0c90,_0x4d847d){_0x4c6490[_0x1845('0x101')](_0x3019da,_0x17e10e)['then'](function(_0x3e4fb9){_0x1b0c90(_[_0x1845('0x70')](_0x3e4fb9,[_0x1845('0x4e')]));})[_0x1845('0x75')](function(_0x1bfe18){if(_0x1bfe18[_0x1845('0x102')]){rpcDb[_0x1845('0x103')](_0x3019da);}if(_0x1bfe18[_0x1845('0x54')]){rpcDb[_0x1845('0x104')](_0x3019da);}_0x4d847d(_['pick'](_0x1bfe18,[_0x1845('0x4e')]));});});};Preview[_0x1845('0xd')]['execRun']=function(_0xde9d93,_0x239cdb){var _0x52d1a1=this;return new BPromise(function(_0x2a6801,_0x1cf7cc){var _0x1bf498,_0x47ec05;rpcDb[_0x1845('0x105')](_0xde9d93)[_0x1845('0x82')](function(_0x33d2c1){if(!_[_0x1845('0x6a')](_0x33d2c1[0x0])){_0x47ec05=_0x33d2c1[0x0]['recallme']?![]:!![];_0x1bf498=_0x33d2c1[0x0][_0x1845('0x106')]?!![]:![];_0x1bf498=_0x239cdb?!![]:_0x1bf498;}var _0x3b04ac=_0x52d1a1[_0x1845('0x107')](_0x33d2c1);if(_0x3b04ac[_0x1845('0x108')]){rpcDb[_0x1845('0x109')](_['pick'](_0x33d2c1[0x0],[_0x1845('0xf2'),_0x1845('0x10a')]))[_0x1845('0x82')](function(_0x42c378){_0x52d1a1['checkInBlack'](_0x42c378,_0x33d2c1[0x0],_0x239cdb,_0x47ec05,_0x1bf498)[_0x1845('0x82')](function(_0xb298fb){_0x2a6801(_0xb298fb);})['catch'](function(_0x126e39){_0x1cf7cc(_0x126e39);});})[_0x1845('0x75')](function(_0x175d5a){ut[_0x1845('0x63')](_0x1845('0x10b'),_0x175d5a);_0x1cf7cc(ut[_0x1845('0x4e')](_0x1845('0x10c'),_0x47ec05,_0x1bf498));});}else{_0x1cf7cc(ut['message'](_0x3b04ac[_0x1845('0x4e')],_0x47ec05,_0x1bf498));}})['catch'](function(_0x16897e){ut[_0x1845('0x63')](_0x1845('0x10d'),_0x16897e);_0x1cf7cc(ut[_0x1845('0x4e')](_0x1845('0x10c'),![],!![]));});});};Preview[_0x1845('0xd')][_0x1845('0x107')]=function(_0x40a7b1){if(_['isNil'](_0x40a7b1)||_[_0x1845('0xf5')](_0x40a7b1)||!_[_0x1845('0x6a')](_0x40a7b1[0x0][_0x1845('0x86')])&&_[_0x1845('0x6a')](_0x40a7b1[0x0][_0x1845('0x86')]['name'])){ut['logger'](_0x1845('0x10e'),_0x40a7b1);return{'isValid':![],'message':_0x1845('0x10f')};}var _0x41bb3d=this[_0x1845('0x12')][_0x40a7b1[0x0][_0x1845('0x6c')]['name']];_0x41bb3d[_0x1845('0x4e')]=_0x1845('0x98');if(_[_0x1845('0x6a')](_0x41bb3d)){ut[_0x1845('0x63')](_0x1845('0x110'),_0x41bb3d);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x41bb3d[_0x1845('0x53')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x1845('0x111')+_0x41bb3d['name']+_0x1845('0x112'));if(!this[_0x1845('0x96')](_0x41bb3d[_0x1845('0x113')])){ut[_0x1845('0x63')](_0x1845('0x114'),_0x41bb3d[_0x1845('0x27')]+_0x1845('0x115'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x41bb3d[_0x1845('0x33')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x41bb3d[_0x1845('0x27')]+_0x1845('0x116'));return{'isValid':![],'message':_0x1845('0x111')+_0x41bb3d[_0x1845('0x27')]+_0x1845('0x116')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x1845('0xd')][_0x1845('0xf6')]=function(_0x59eefa,_0x9bab1,_0x684830,_0x1fd6c8){var _0x3551cc=this;return new BPromise(function(_0x43dc51,_0x556083){var _0x20f476=_0x59eefa[_0x1845('0xab')];var _0x5ea56f=_0x3551cc[_0x1845('0x96')](_0x9bab1[_0x1845('0x53')])?util[_0x1845('0x56')]('SIP/%s/%s%s',_0x9bab1[_0x1845('0x53')][_0x1845('0x27')],_[_0x1845('0x6a')](_0x9bab1[_0x1845('0x37')])?'':_0x9bab1[_0x1845('0x37')]['trim']()||'',_0x9bab1[_0x1845('0x117')]>0x0?_0x684830[_0x1845('0xf1')][_0x1845('0x118')]['substring'](_0x9bab1[_0x1845('0x117')]):_0x684830['Contact']['phone']):util['format'](_0x1845('0x119'),_[_0x1845('0x6a')](_0x9bab1[_0x1845('0x113')])?_0x9bab1[_0x1845('0x53')][_0x1845('0x27')]:_0x9bab1[_0x1845('0x113')][_0x1845('0x27')],_['isNil'](_0x9bab1[_0x1845('0x37')])?'':_0x9bab1['dialPrefix'][_0x1845('0x11a')]()||'',_0x9bab1[_0x1845('0x117')]>0x0?_0x684830[_0x1845('0xf1')][_0x1845('0x118')][_0x1845('0x11b')](_0x9bab1[_0x1845('0x117')]):_0x684830[_0x1845('0xf1')]['phone']);var _0x495912=_0x3551cc['isTrunkReachable'](_0x9bab1['Trunk'])?ut[_0x1845('0x11c')](_0x9bab1['Trunk'][_0x1845('0x11d')],_0x9bab1['dialOriginateCallerIdName'],_0x9bab1[_0x1845('0x11e')]>0x0?ut[_0x1845('0x11f')](_0x9bab1['dialOriginateCallerIdNumber'],_0x9bab1[_0x1845('0x11e')]):_0x9bab1['dialOriginateCallerIdNumber']):ut[_0x1845('0x11c')](_[_0x1845('0x6a')](_0x9bab1[_0x1845('0x113')])?_0x9bab1['Trunk'][_0x1845('0x11d')]:_0x9bab1['TrunkBackup'][_0x1845('0x11d')],_0x9bab1['dialOriginateCallerIdName'],_0x9bab1['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x9bab1['dialOriginateCallerIdNumber'],_0x9bab1[_0x1845('0x11e')]):_0x9bab1[_0x1845('0x35')]);if(_0x495912){_0x59eefa[_0x1845('0x120')]=ut[_0x1845('0x121')](_0x495912);_0x59eefa[_0x1845('0x122')]=ut[_0x1845('0x123')](_0x495912);}var _0x57474f=ut['addVariables'](_0x9bab1,_0x684830,_0x5ea56f,_0x495912,_0x20f476,_0x59eefa);_[_0x1845('0x124')](_0x59eefa,ut['toLowerVariables'](_0x57474f));_0x59eefa[_0x1845('0x125')]=moment()['format'](_0x1845('0xa9'));ami[_0x1845('0x73')](ut['variablesAction'](_0x59eefa,_0x9bab1,_0x57474f,_0x59eefa['activeContact'],_0x1fd6c8))['then'](function(_0xb913f2){var _0x4773a0=_0x59eefa[_0x1845('0x126')];if(!_[_0x1845('0x6a')](_0x4773a0)){if(!_[_0x1845('0x6a')](_0x3551cc[_0x1845('0x16')][_0x4773a0])){_0x3551cc[_0x1845('0x16')][_0x4773a0][_0x1845('0x127')]=_0x59eefa[_0x1845('0x128')];emit(util[_0x1845('0x56')](_0x1845('0x129'),_0x3551cc[_0x1845('0x16')][_0x4773a0]['name']),_0x1845('0x12a'),{'destaccountcode':_0x3551cc['agents'][_0x4773a0]['accountcode'],'destconnectedlinenum':_0x59eefa[_0x1845('0x128')]});}}_0x9bab1[_0x1845('0x5d')]+=0x1;logger[_0x1845('0x59')](_0x1845('0x12b'),_0x20f476,_0x1845('0xac'),_0x9bab1[_0x1845('0x27')],_0x1845('0xe4'),_0x9bab1[_0x1845('0x5d')]);_0x43dc51(_0xb913f2);})[_0x1845('0x75')](function(_0x40ac3a){ut['logAgent'](_0x59eefa,0xe,'OriginateError');rpcDb[_0x1845('0xec')](_0x59eefa,_0x1845('0x12c'));_0x556083(_0x40ac3a);});});};Preview[_0x1845('0xd')][_0x1845('0x12d')]=function(_0x3d3d18){if(this[_0x1845('0x15')][_0x3d3d18['linkedid']]){this[_0x1845('0x15')][_0x3d3d18[_0x1845('0xa8')]][_0x1845('0x74')]=_0x3d3d18['channel'];}};Preview[_0x1845('0xd')]['syncOriginateResponse']=function(_0x4e3035){var _0x5c084d=this;var _0xeef143=this[_0x1845('0x15')][_0x4e3035['actionid']];if(_0xeef143){if(_0xeef143['lookAgent']&&this['agents'][_0xeef143[_0x1845('0xf4')]]){ut[_0x1845('0x12e')](_0xeef143,this['agents'][_0xeef143[_0x1845('0xf4')]][_0x1845('0x27')],this[_0x1845('0x16')][_0xeef143[_0x1845('0xf4')]]['id']);}var _0x3f77b7=_[_0x1845('0x12f')](_0xeef143);_0x3f77b7['responsetime']=moment()[_0x1845('0x56')](_0x1845('0xa9'));var _0x1a034b=_0x5c084d[_0x1845('0x12')][_0xeef143[_0x1845('0x6d')]];if(ut[_0x1845('0x130')](_0x4e3035[_0x1845('0x131')])){if(_0xeef143[_0x1845('0xa7')]){rpcDb['unlockContact'](_0xeef143[_0x1845('0x132')]);}if(_0xeef143[_0x1845('0xc2')]){rpcDb['disableContact'](_0xeef143[_0x1845('0x132')]);}ami['emit'](_0x1845('0x133'),ut[_0x1845('0x9e')](_0xeef143,_0x1845('0x134'),this[_0x1845('0x12')][_0xeef143['queue']]));this['callProgressDetectingAgent'](_0x3f77b7,_0x1a034b,_0x4e3035);}else{_0xeef143[_0x1845('0x125')]=moment()['format'](_0x1845('0xa9'));ut['logAgent'](_0x3f77b7,0x4,_0x1845('0xb4'));rpcDb['createAgentHistory'](_0x3f77b7,_0x1845('0x135'));}}};Preview['prototype']['syncHangup']=function(_0x45e293){var _0x3a28fa=this;var _0x55abb1=this[_0x1845('0x15')][_0x45e293[_0x1845('0xa8')]];var _0x310be9;if(_0x55abb1){_0x310be9=this[_0x1845('0x12')][_0x55abb1['queue']];logger[_0x1845('0x59')](_0x1845('0x136'),_0x45e293['linkedid'],_0x1845('0xac'),_0x310be9[_0x1845('0x27')],_0x1845('0xba'),_0x310be9[_0x1845('0x2a')]);}if(this['actions'][_0x45e293[_0x1845('0xa8')]]&&_0x45e293[_0x1845('0xa8')]!==_0x45e293[_0x1845('0xab')]){if(_0x45e293[_0x1845('0x137')]==='16'&&this['actions'][_0x45e293[_0x1845('0xa8')]][_0x1845('0x6f')]){this['callProgressDetectingCustomer'](_0x45e293,_0x45e293[_0x1845('0xa8')],_0x45e293[_0x1845('0x137')]);}else if(this[_0x1845('0x15')][_0x45e293[_0x1845('0xa8')]][_0x1845('0x6f')]){logger[_0x1845('0x59')](_0x1845('0x138'),_0x45e293[_0x1845('0xa8')],_0x45e293['cause'],_0x1845('0xac'),_0x310be9[_0x1845('0x27')],'pTalking:\x20',_0x310be9['pTalking']);this[_0x1845('0x99')](_0x45e293,_0x45e293[_0x1845('0xa8')],_0x45e293[_0x1845('0x137')]);}}else if(_0x55abb1&&_[_0x1845('0x6a')](_0x55abb1[_0x1845('0x139')])&&_0x310be9[_0x1845('0x13a')]&&_0x45e293[_0x1845('0xa8')]===_0x45e293[_0x1845('0xab')]&&_[_0x1845('0x6a')](_0x45e293['reason'])&&_0x45e293['cause']==='16'&&_0x45e293[_0x1845('0x13b')]==='6'&&_[_0x1845('0xe6')](_0x55abb1[_0x1845('0x13c')])){if(_0x55abb1[_0x1845('0xa7')]){rpcDb['unlockContact'](_0x55abb1[_0x1845('0x132')]);}if(_0x55abb1[_0x1845('0xc2')]){rpcDb[_0x1845('0x104')](_0x55abb1[_0x1845('0x132')]);}_0x45e293[_0x1845('0xe8')]='22';this[_0x1845('0x13d')](_0x55abb1,_0x310be9,_0x45e293);}else if(_0x55abb1&&_0x55abb1[_0x1845('0x13c')]){if(_0x45e293['cause']==='16'&&this[_0x1845('0x15')][_0x45e293[_0x1845('0xa8')]][_0x1845('0x6f')]){logger[_0x1845('0x59')](_0x1845('0x13e'),_0x45e293[_0x1845('0xa8')],_0x45e293['cause'],'\x20Queue',_0x310be9[_0x1845('0x27')],_0x1845('0xba'),_0x310be9[_0x1845('0x2a')]);this['callProgressDetectingCustomer'](_0x45e293,_0x45e293[_0x1845('0xa8')],_0x45e293[_0x1845('0x137')]);}else if(this[_0x1845('0x15')][_0x45e293[_0x1845('0xa8')]][_0x1845('0x6f')]){logger['info']('[syncHangup][talking][cause]',_0x45e293[_0x1845('0xa8')],_0x45e293['cause'],'\x20Queue',_0x310be9[_0x1845('0x27')],_0x1845('0xba'),_0x310be9[_0x1845('0x2a')]);this['callProgressDetectingCustomer'](_0x45e293,_0x45e293['linkedid'],_0x45e293[_0x1845('0x137')]);}}};Preview[_0x1845('0xd')][_0x1845('0x13f')]=function(_0x26cb98){if(this[_0x1845('0x15')][_0x26cb98[_0x1845('0x140')]]&&_0x26cb98[_0x1845('0x140')]!==_0x26cb98[_0x1845('0x141')]){this[_0x1845('0x99')](_0x26cb98,_0x26cb98[_0x1845('0x140')],_0x26cb98['dialstatus']);}};Preview[_0x1845('0xd')][_0x1845('0x1d')]=function(_0x4e49e9){if(this[_0x1845('0x15')][_0x4e49e9[_0x1845('0xa8')]]&&_0x4e49e9[_0x1845('0xa8')]!==_0x4e49e9[_0x1845('0xab')]&&!this[_0x1845('0x15')][_0x4e49e9[_0x1845('0xa8')]][_0x1845('0x6f')]){if(_0x4e49e9['cause']==='1'){this[_0x1845('0x99')](_0x4e49e9,_0x4e49e9[_0x1845('0xa8')],_0x4e49e9['cause']);}}};Preview[_0x1845('0xd')][_0x1845('0x142')]=function(_0x4a4e2f,_0x52cf1d,_0xa9c0d){if(this[_0x1845('0x15')][_0x4a4e2f]){if(_['isNil'](this[_0x1845('0x15')][_0x4a4e2f][_0x1845('0x143')])){this[_0x1845('0x15')][_0x4a4e2f][_0x1845('0x143')]={};}this[_0x1845('0x15')][_0x4a4e2f][_0x1845('0x143')][_0x52cf1d]=_0xa9c0d;}};Preview[_0x1845('0xd')][_0x1845('0x20')]=function(_0x4fb6fc){try{if(!_[_0x1845('0x6a')](_0x4fb6fc)){if(ut[_0x1845('0x144')](_[_0x1845('0x145')](_0x4fb6fc[_0x1845('0x146')])[0x0])){this['addVariable'](_0x4fb6fc[_0x1845('0xab')],_['keys'](_0x4fb6fc[_0x1845('0x146')])[0x0],_0x4fb6fc[_0x1845('0x147')]);}}}catch(_0x4786aa){logger[_0x1845('0x148')](_0x1845('0x149'),util[_0x1845('0x14a')](_0x4786aa,{'showHidden':![],'depth':null}));}};Preview[_0x1845('0xd')]['syncAttendedTransfer']=function(_0x1eb979){if(_0x1eb979){if(this['actions'][_0x1eb979[_0x1845('0x14b')]]){this[_0x1845('0x15')][_0x1eb979['transfertargetlinkedid']][_0x1845('0x13c')]=!![];}}};Preview[_0x1845('0xd')][_0x1845('0x14c')]=function(_0x4fef6d){if(_0x4fef6d){if(this['actions'][_0x4fef6d[_0x1845('0x14d')]]){this[_0x1845('0x15')][_0x4fef6d[_0x1845('0x14d')]][_0x1845('0x13c')]=!![];}}};module[_0x1845('0x14e')]=Preview; \ No newline at end of file +var _0x7636=['isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','responsetime','answertime','uniqueid','custom:agentconnect','connect','acw','custom:agentcomplete','complete','[16]','Answer','crateCustomerReportQueue','talktime','sumBillable','\x20Queue','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','originated:\x20','Contact','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','then','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','phone','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','addVariables','merge','toLowerVariables','channelAgent','destconnectedlinenum','user:%s','user:agentconnect','accountcode','calleridnum','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','cause','pTalking:\x20','statedesc','transfer','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','moment','ioredis','../../../config/logger','preview','./rpcDb','./action','./util/util','redis','defaults','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','setMessage','recallMe','enqueue','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','[action]','hasOwnProperty','clearZombieChannel','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED'];(function(_0x1e31d5,_0x43bef9){var _0x5e4212=function(_0x21677a){while(--_0x21677a){_0x1e31d5['push'](_0x1e31d5['shift']());}};_0x5e4212(++_0x43bef9);}(_0x7636,0xc1));var _0x6763=function(_0x5ab340,_0x3bf3e4){_0x5ab340=_0x5ab340-0x0;var _0x2ed5b7=_0x7636[_0x5ab340];return _0x2ed5b7;};'use strict';var util=require('util');var _=require(_0x6763('0x0'));var BPromise=require(_0x6763('0x1'));var uuid=require('uuid');var moment=require(_0x6763('0x2'));var md5=require('md5');var Redis=require(_0x6763('0x3'));var config=require('../../../config/environment');var logger=require(_0x6763('0x4'))(_0x6763('0x5'));var loggerAction=require(_0x6763('0x4'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0x6763('0x6'));var Action=require(_0x6763('0x7'));var ut=require(_0x6763('0x8'));config[_0x6763('0x9')]=_[_0x6763('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x6763('0xb')]['enqueue']=function(_0x219e83){this[_0x6763('0xc')]=this[_0x6763('0xc')]?this[_0x6763('0xc')][_0x6763('0xd')](_0x219e83):_0x219e83();};function Preview(_0x2ebbca){this[_0x6763('0xe')]=new Sequence();this[_0x6763('0xf')]=_0x2ebbca[_0x6763('0x10')];this[_0x6763('0x11')]=_0x2ebbca[_0x6763('0x11')];this[_0x6763('0x12')]={};this[_0x6763('0x13')]=_0x2ebbca['agents'];this[_0x6763('0x14')]=0x0;ami['on'](_0x6763('0x15'),this[_0x6763('0x16')][_0x6763('0x17')](this));ami['on']('hangup',this[_0x6763('0x18')]['bind'](this));ami['on'](_0x6763('0x19'),this[_0x6763('0x1a')][_0x6763('0x17')](this));ami['on'](_0x6763('0x1b'),this[_0x6763('0x1c')][_0x6763('0x17')](this));ami['on'](_0x6763('0x1d'),this['syncNewExten']['bind'](this));ami['on'](_0x6763('0x1e'),this['syncVarSet']['bind'](this));ami['on'](_0x6763('0x1f'),this[_0x6763('0x20')]['bind'](this));ami['on'](_0x6763('0x21'),this[_0x6763('0x22')][_0x6763('0x17')](this));this[_0x6763('0x23')](this['campaignsPreview']);}function emit(_0x151100,_0x1707ea,_0x28cc67){io['to'](_0x151100)[_0x6763('0x24')](_0x1707ea,_0x28cc67);}function emitCampaignPreview(_0x828c86){if(_0x828c86[_0x6763('0x25')]===_0x6763('0x26')){var _0x5ee34f={'id':_0x828c86['id'],'name':_0x828c86[_0x6763('0x27')],'strategy':_0x828c86[_0x6763('0x28')],'answered':_0x828c86[_0x6763('0x29')],'available':_0x828c86[_0x6763('0x2a')],'loggedIn':_0x828c86[_0x6763('0x2b')],'pTalking':_0x828c86[_0x6763('0x2c')],'sumBillable':_0x828c86['sumBillable'],'sumDuration':_0x828c86[_0x6763('0x2d')],'sumHoldTime':_0x828c86[_0x6763('0x2e')]||0x0,'talking':_0x828c86[_0x6763('0x2f')],'total':_0x828c86[_0x6763('0x30')],'type':_0x828c86[_0x6763('0x25')],'unmanaged':_0x828c86[_0x6763('0x31')],'abandoned':_0x828c86[_0x6763('0x32')],'waiting':_0x828c86['waiting'],'loggedInDb':_0x828c86[_0x6763('0x33')],'dialActive':_0x828c86[_0x6763('0x34')],'dialMethod':_0x828c86[_0x6763('0x35')],'dialOriginateCallerIdName':_0x828c86[_0x6763('0x36')],'dialOriginateCallerIdNumber':_0x828c86['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x828c86[_0x6763('0x37')],'dialPrefix':_0x828c86[_0x6763('0x38')],'outboundAnswerAgiCallsDay':_0x828c86[_0x6763('0x39')],'outboundAnswerCallsDay':_0x828c86[_0x6763('0x3a')],'outboundBlacklistCallsDay':_0x828c86[_0x6763('0x3b')],'outboundBusyCallsDay':_0x828c86[_0x6763('0x3c')],'outboundCongestionCallsDay':_0x828c86[_0x6763('0x3d')],'outboundDropCallsDayACS':_0x828c86['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x828c86[_0x6763('0x3e')],'outboundDropCallsDayTimeout':_0x828c86[_0x6763('0x3f')],'outboundNoAnswerCallsDay':_0x828c86[_0x6763('0x40')],'outboundNoSuchCallsDay':_0x828c86[_0x6763('0x41')],'outboundOriginateFailureCallsDay':_0x828c86['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x828c86['outboundReCallsDay'],'outboundRejectCallsDay':_0x828c86[_0x6763('0x42')],'outboundUnknownCallsDay':_0x828c86[_0x6763('0x43')],'outboundAbandonedCallsDay':_0x828c86[_0x6763('0x44')],'predictiveIntervalAnsweredCalls':_0x828c86[_0x6763('0x45')],'predictiveIntervalAvgHoldtime':_0x828c86[_0x6763('0x46')],'predictiveIntervalAvgTalktime':_0x828c86['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x828c86[_0x6763('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x828c86[_0x6763('0x48')],'predictiveIntervalErlangCalls':_0x828c86[_0x6763('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x828c86['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x828c86[_0x6763('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x828c86[_0x6763('0x4b')],'predictiveIntervalPauses':_0x828c86[_0x6763('0x4c')],'predictiveIntervalAvailable':_0x828c86['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x828c86[_0x6763('0x4d')],'message':_0x828c86[_0x6763('0x4e')],'originated':_0x828c86['originated'],'erlangCalls':_0x828c86[_0x6763('0x4f')],'erlangCallToSecond':_0x828c86[_0x6763('0x50')],'erlangAbandonmentRate':_0x828c86[_0x6763('0x51')],'erlangBusyFactor':_0x828c86[_0x6763('0x52')],'startPredictive':_0x828c86['startPredictive'],'startProgressive':_0x828c86[_0x6763('0x53')]};if(_0x828c86[_0x6763('0x54')]){_0x5ee34f[_0x6763('0x54')]={'id':_0x828c86[_0x6763('0x54')]['id'],'name':_0x828c86[_0x6763('0x54')]['name'],'active':_0x828c86[_0x6763('0x54')][_0x6763('0x55')],'callerid':_0x828c86[_0x6763('0x54')][_0x6763('0x56')]};}if(_0x828c86[_0x6763('0x57')]){_0x5ee34f[_0x6763('0x57')]={'id':_0x828c86[_0x6763('0x57')]['id'],'name':_0x828c86['Interval']['name']};}var _0x4ebb91=md5(JSON[_0x6763('0x58')](_0x5ee34f));if(_0x828c86['md5']!==_0x4ebb91){_0x828c86[_0x6763('0x59')]=_0x4ebb91;emit(util[_0x6763('0x5a')](_0x6763('0x5b'),_0x5ee34f['name']),_0x6763('0x5c'),_0x5ee34f);}}}function emitVoiceQueueChannelRemove(_0x1a68b3){logger[_0x6763('0x5d')](_0x6763('0x5e'),JSON[_0x6763('0x58')](_0x1a68b3));emit(util[_0x6763('0x5a')](_0x6763('0x5b'),_0x1a68b3[_0x6763('0x27')]),_0x6763('0x5f'),_0x1a68b3);io['emit'](_0x6763('0x60'),_0x1a68b3);}function notSendMessagesQueue(_0x3bf048){if(_0x3bf048['sendMessageOneNotActive']){if(_0x3bf048[_0x6763('0x61')]===0x0&&_0x3bf048['pTalking']===0x0){_0x3bf048['sendMessageOneNotActive']=![];_0x3bf048[_0x6763('0x2a')]=0x0;_0x3bf048[_0x6763('0x62')]=0x0;_0x3bf048['message']=_0x6763('0x63');ut[_0x6763('0x64')](_0x6763('0x65'),_0x3bf048[_0x6763('0x27')]+_0x6763('0x66'));}else{_0x3bf048[_0x6763('0x4e')]=_0x6763('0x67');ut[_0x6763('0x64')](_0x6763('0x65'),_0x3bf048[_0x6763('0x27')]+_0x6763('0x68'));}emitCampaignPreview(_0x3bf048);}}Preview[_0x6763('0xb')][_0x6763('0x23')]=function(){var _0x1d3f87=this;setInterval(function(){_0x1d3f87[_0x6763('0x69')]();},0x7cf);};Preview[_0x6763('0xb')]['syncCampaigns']=function(){var _0x34e988=this[_0x6763('0xf')];this[_0x6763('0x14')]+=0x1;for(var _0x4206eb in _0x34e988){if(_0x34e988['hasOwnProperty'](_0x4206eb)&&(_0x34e988[_0x4206eb][_0x6763('0x35')]==='preview'||_0x34e988[_0x4206eb][_0x6763('0x35')]===_0x6763('0x6a'))&&_0x34e988[_0x4206eb]['type']===_0x6763('0x26')){if(this[_0x6763('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x34e988['hasOwnProperty'](_0x4206eb)&&_0x34e988[_0x4206eb][_0x6763('0x35')]==='preview'&&_0x34e988[_0x4206eb][_0x6763('0x25')]===_0x6763('0x26')){if(_0x34e988[_0x4206eb][_0x6763('0x34')]){this[_0x6763('0x6b')](_0x34e988[_0x4206eb]);this[_0x6763('0x6c')](_0x34e988[_0x4206eb]);}else{notSendMessagesQueue(_0x34e988[_0x4206eb]);}}}};Preview[_0x6763('0xb')]['clearZombieChannel']=function(_0x8482e0){var _0x19a696=this;this[_0x6763('0xe')][_0x6763('0x6d')](function(){if(!_['isNil'](_0x19a696[_0x6763('0x12')][_0x8482e0])){loggerAction[_0x6763('0x5d')](_0x6763('0x6e'),_0x8482e0,_0x6763('0x6f'),_0x19a696[_0x6763('0x12')][_0x8482e0][_0x6763('0x70')],'originated:\x20',JSON['stringify'](_0x19a696['campaignsPreview'][_0x19a696['actions'][_0x8482e0][_0x6763('0x70')]]['originated']),'pTalking:\x20',JSON['stringify'](_0x19a696[_0x6763('0xf')][_0x19a696[_0x6763('0x12')][_0x8482e0][_0x6763('0x70')]][_0x6763('0x2c')]),JSON[_0x6763('0x58')](_0x19a696[_0x6763('0x12')][_0x8482e0][_0x6763('0x71')]),JSON[_0x6763('0x58')](_[_0x6763('0x72')](_0x19a696['actions'][_0x8482e0],['contactId',_0x6763('0x73'),_0x6763('0x74'),_0x6763('0x75')])));return ami[_0x6763('0x76')]({'action':_0x6763('0x77'),'channel':_0x19a696['actions'][_0x8482e0]['channel']})[_0x6763('0x78')](function(_0x5d8771){if(_0x5d8771['message']===_0x6763('0x79')){setTimeout(function(){if(_0x19a696[_0x6763('0x12')][_0x8482e0]){ut[_0x6763('0x7a')](_0x19a696[_0x6763('0xf')][_0x19a696[_0x6763('0x12')][_0x8482e0]['queue']],_0x6763('0x7b'));if(_0x19a696['actions'][_0x8482e0][_0x6763('0x71')]===!![]){ut[_0x6763('0x7c')](_0x19a696[_0x6763('0xf')][_0x19a696[_0x6763('0x12')][_0x8482e0][_0x6763('0x70')]],_0x6763('0x7b'));ut[_0x6763('0x7d')](_0x6763('0x7e')+_0x8482e0,_0x19a696[_0x6763('0x12')][_0x8482e0][_0x6763('0x70')]);}ut[_0x6763('0x7d')]('[Dialer][checkChannel][Preview]'+_0x8482e0,_0x19a696['actions'][_0x8482e0][_0x6763('0x70')]);delete _0x19a696[_0x6763('0x12')][_0x8482e0];}},0x2328);}});}});};Preview['prototype'][_0x6763('0x7f')]=function(){var _0x357d92=this;loggerAction['info'](_0x6763('0x80'),_['size'](this['actions']));for(var _0x26db8e in this[_0x6763('0x12')]){if(_0x357d92[_0x6763('0x12')][_0x6763('0x81')](_0x26db8e)){_0x357d92[_0x6763('0x82')](_0x26db8e);}}};Preview['prototype']['recallMe']=function(_0xab91a8){var _0x53af71=this;rpcDb[_0x6763('0x83')](_0xab91a8['id'],ut[_0x6763('0x84')](this[_0x6763('0x13')]))['then'](function(_0x21518d){if(!_[_0x6763('0x85')](_0x21518d)){for(var _0x703078=0x0;_0x703078<_0x21518d[_0x6763('0x86')];_0x703078+=0x1){if(ut[_0x6763('0x87')](_0x21518d[_0x703078][_0x6763('0x88')])<_0xab91a8['dialRecallMeTimeout']*0x3c){if(_0x21518d[_0x703078][_0x6763('0x89')]&&!_0x21518d[_0x703078]['Agent']['voicePause']){_0x53af71[_0x6763('0x8a')](_0x21518d[_0x703078]['id'])['then'](ut[_0x6763('0x8b')](_0x6763('0x8c')))['catch'](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x6763('0x8d')](_0x21518d[_0x703078]['id']);}}else{var _0x54aafb=new Action(_0x21518d[_0x703078],_0xab91a8);_0x54aafb['starttime']=moment()[_0x6763('0x5a')](_0x6763('0x8e'));_0xab91a8[_0x6763('0x8f')]+=0x1;ut[_0x6763('0x90')](_0x54aafb,0x17,_0x6763('0x91'));if(_0xab91a8['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x6763('0x92')](_0x21518d[_0x703078]));rpcDb[_0x6763('0x93')](_0x54aafb,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x54aafb,0x16,_0x6763('0x94'));rpcDb['createCustomerHistory'](_0x54aafb,_0x6763('0x95'));rpcDb[_0x6763('0x96')](_0x54aafb,'[HistoryRecallClose]');}}}}})[_0x6763('0x78')](ut[_0x6763('0x8b')](_0x6763('0x97')));};Preview[_0x6763('0xb')][_0x6763('0x6b')]=function(_0x999d9d){_0x999d9d['sendMessageOneNotActive']=!![];if(ut[_0x6763('0x98')](_0x999d9d[_0x6763('0x2b')])){_0x999d9d[_0x6763('0x4e')]=_0x6763('0x99');}else if(!ut[_0x6763('0x9a')](_0x999d9d[_0x6763('0x34')])){_0x999d9d[_0x6763('0x4e')]=_0x6763('0x63');}else if(!this[_0x6763('0x9b')](_0x999d9d[_0x6763('0x54')])){if(!this[_0x6763('0x9b')](_0x999d9d[_0x6763('0x9c')])){_0x999d9d[_0x6763('0x4e')]=_0x6763('0x9d');}else{_0x999d9d['message']='ACTIVE';}}else{_0x999d9d[_0x6763('0x4e')]='ACTIVE';}emitCampaignPreview(_0x999d9d);};Preview[_0x6763('0xb')][_0x6763('0x9e')]=function(_0x5d6eae,_0x392443,_0x296abd){var _0x3d08e2=this;var _0xf9f3f9=this['actions'][_0x392443];var _0x1df90a=this[_0x6763('0xf')][_0xf9f3f9[_0x6763('0x70')]];var _0x3e481b;if(_0x1df90a){switch(_0x296abd){case'1':_0x1df90a[_0x6763('0x41')]+=0x1;_0xf9f3f9[_0x6763('0x9f')]+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut[_0x6763('0xa1')](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0x0,_0x6763('0xa2'));ami[_0x6763('0x24')](_0x6763('0xa3'),ut[_0x6763('0xa4')](_0xf9f3f9,_0x6763('0xa5')));rpcDb[_0x6763('0x93')](_0xf9f3f9,_0x6763('0xa6'));if(ut['totalGlobal'](_0xf9f3f9)>=_0x1df90a[_0x6763('0xa7')]){_0x3e481b=ut[_0x6763('0xa8')](_0xf9f3f9,0xf,'Global');rpcDb[_0x6763('0x96')](_0x3e481b,_0x6763('0xa9'));}else{if(_0xf9f3f9['countnosuchnumberretry']>=_0x1df90a[_0x6763('0xaa')]){rpcDb[_0x6763('0x96')](_0xf9f3f9,_0x6763('0xa9'));}else{rpcDb[_0x6763('0xab')](ut[_0x6763('0xac')](_0xf9f3f9,_0x6763('0x9f'),_0x1df90a['dialNoSuchNumberRetryFrequency']),_0xf9f3f9[_0x6763('0xad')],_0xf9f3f9[_0x6763('0xae')]);}}delete this[_0x6763('0x12')][_0x5d6eae['linkedid']];break;case'ANSWER':var _0x3ce4f8=moment()[_0x6763('0x5a')](_0x6763('0x8e'));_0xf9f3f9[_0x6763('0xaf')]=_0x3ce4f8;_0xf9f3f9[_0x6763('0xb0')]=_0x3ce4f8;_0xf9f3f9[_0x6763('0x71')]=!![];_0x1df90a[_0x6763('0x2c')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0xf9f3f9[_0x6763('0xb1')],'\x20Queue',_0x1df90a[_0x6763('0x27')],'pTalking:\x20',_0x1df90a[_0x6763('0x2c')]);ami[_0x6763('0x24')](_0x6763('0xb2'),ut[_0x6763('0xa4')](_0xf9f3f9,_0x6763('0xb3'),this[_0x6763('0xf')][_0xf9f3f9[_0x6763('0x70')]]));if(_0x1df90a[_0x6763('0xb4')]){ami[_0x6763('0x24')]('custom:agentConnectPreview',ut['buildAcw'](_0xf9f3f9));}break;case'16':ami[_0x6763('0x24')](_0x6763('0xb5'),ut[_0x6763('0xa4')](_0xf9f3f9,_0x6763('0xb6'),this[_0x6763('0xf')][_0xf9f3f9['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0xf9f3f9,'complete'));_0x1df90a[_0x6763('0x3a')]+=0x1;_0x1df90a[_0x6763('0x30')]+=0x1;_0x1df90a[_0x6763('0x29')]+=0x1;ut[_0x6763('0x7c')](_0x1df90a,_0x6763('0xb7'));_0xf9f3f9[_0x6763('0xa0')]=ut['totalGlobal'](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0x4,_0x6763('0xb8'));rpcDb[_0x6763('0x93')](_0xf9f3f9,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x6763('0x96')](_0xf9f3f9,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x6763('0xb9')](_0xf9f3f9);_0x1df90a['sumDuration']+=_0xf9f3f9[_0x6763('0xba')];_0x1df90a[_0x6763('0xbb')]+=_0xf9f3f9[_0x6763('0xba')];logger[_0x6763('0x5d')]('[syncHangup][talking][decrement]',_0xf9f3f9[_0x6763('0xb1')],_0x6763('0xbc'),_0x1df90a['name'],'pTalking:\x20',_0x1df90a[_0x6763('0x2c')]);delete this[_0x6763('0x12')][_0x5d6eae[_0x6763('0xbd')]];break;case _0x6763('0xbe'):_0x1df90a['outboundBusyCallsDay']+=0x1;_0xf9f3f9[_0x6763('0xbf')]+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut[_0x6763('0xa1')](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0x5,_0x6763('0xc0'));ami[_0x6763('0x24')](_0x6763('0xc1'),ut['buildObj'](_0xf9f3f9,_0x6763('0xc2')));rpcDb[_0x6763('0x93')](_0xf9f3f9,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a[_0x6763('0xa7')]){_0x3e481b=ut[_0x6763('0xa8')](_0xf9f3f9,0xf,_0x6763('0xc3'));rpcDb[_0x6763('0x96')](_0x3e481b,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0xf9f3f9['countbusyretry']>=_0x1df90a[_0x6763('0xc4')]){rpcDb[_0x6763('0x96')](_0xf9f3f9,_0x6763('0xc5'));}else{rpcDb['rescheduleContact'](ut[_0x6763('0xac')](_0xf9f3f9,_0x6763('0xbf'),_0x1df90a[_0x6763('0xc6')]),_0xf9f3f9[_0x6763('0xad')],_0xf9f3f9[_0x6763('0xae')]);}}break;case _0x6763('0xc7'):_0x1df90a[_0x6763('0x40')]+=0x1;_0xf9f3f9['countnoanswerretry']+=0x1;_0xf9f3f9['countglobal']=ut[_0x6763('0xa1')](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0x3,_0x6763('0xc8'));ami['emit'](_0x6763('0xc9'),ut['buildObj'](_0xf9f3f9,_0x6763('0xca')));rpcDb[_0x6763('0x93')](_0xf9f3f9,_0x6763('0xcb'));if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a['dialGlobalMaxRetry']){_0x3e481b=ut[_0x6763('0xa8')](_0xf9f3f9,0xf,_0x6763('0xc3'));rpcDb[_0x6763('0x96')](_0x3e481b,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xf9f3f9[_0x6763('0xcc')]>=_0x1df90a[_0x6763('0xcd')]){rpcDb['createCustomerFinal'](_0xf9f3f9,_0x6763('0xcb'));}else{rpcDb[_0x6763('0xab')](ut[_0x6763('0xac')](_0xf9f3f9,'countnoanswerretry',_0x1df90a[_0x6763('0xce')]),_0xf9f3f9[_0x6763('0xad')],_0xf9f3f9['activeContact']);}}break;case _0x6763('0xcf'):_0x1df90a['outboundCongestionCallsDay']+=0x1;_0xf9f3f9[_0x6763('0xd0')]+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut[_0x6763('0xa1')](_0xf9f3f9);ut['logCustomer'](_0xf9f3f9,0x8,'Congestion');ami[_0x6763('0x24')](_0x6763('0xd1'),ut[_0x6763('0xa4')](_0xf9f3f9,_0x6763('0xd2')));rpcDb[_0x6763('0x93')](_0xf9f3f9,_0x6763('0xd3'));if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a[_0x6763('0xa7')]){_0x3e481b=ut['cloneAction'](_0xf9f3f9,0xf,_0x6763('0xc3'));rpcDb['createCustomerFinal'](_0x3e481b,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xf9f3f9[_0x6763('0xd0')]>=_0x1df90a[_0x6763('0xd4')]){rpcDb[_0x6763('0x96')](_0xf9f3f9,_0x6763('0xd3'));}else{rpcDb[_0x6763('0xab')](ut[_0x6763('0xac')](_0xf9f3f9,'countcongestionretry',_0x1df90a['dialBusyRetryFrequency']),_0xf9f3f9[_0x6763('0xad')],_0xf9f3f9[_0x6763('0xae')]);}}break;case _0x6763('0xd5'):_0x1df90a[_0x6763('0x42')]+=0x1;_0xf9f3f9['countagentrejectretry']+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut[_0x6763('0xa1')](_0xf9f3f9);ut['logCustomer'](_0xf9f3f9,0x14,_0x6763('0xd6'));ami[_0x6763('0x24')](_0x6763('0xd7'),ut['buildObj'](_0xf9f3f9,_0x6763('0xd8')));rpcDb[_0x6763('0x93')](_0xf9f3f9,_0x6763('0xd9'));if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a[_0x6763('0xa7')]){_0x3e481b=ut[_0x6763('0xa8')](_0xf9f3f9,0x14,'AgentReject');rpcDb[_0x6763('0x96')](_0x3e481b,_0x6763('0xda'));}else{if(_0xf9f3f9[_0x6763('0xdb')]>=_0x1df90a['dialAgentRejectMaxRetry']){rpcDb[_0x6763('0x96')](_0xf9f3f9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x6763('0xab')](ut[_0x6763('0xac')](_0xf9f3f9,_0x6763('0xdb'),_0x1df90a[_0x6763('0xdc')]),_0xf9f3f9[_0x6763('0xad')],_0xf9f3f9[_0x6763('0xae')]);}}break;case _0x6763('0xdd'):_0x1df90a['outboundAbandonedCallsDay']+=0x1;_0xf9f3f9['countabandonedretry']+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut[_0x6763('0xa1')](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0xb,_0x6763('0xde'));rpcDb['createCustomerHistory'](_0xf9f3f9,_0x6763('0xdf'));if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a['dialGlobalMaxRetry']){_0x3e481b=ut[_0x6763('0xa8')](_0xf9f3f9,0xf,_0x6763('0xc3'));rpcDb[_0x6763('0x96')](_0x3e481b,_0x6763('0xdf'));}else{if(_0xf9f3f9[_0x6763('0xe0')]>=_0x1df90a['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0xf9f3f9,_0x6763('0xdf'));}else{rpcDb[_0x6763('0xab')](ut[_0x6763('0xac')](_0xf9f3f9,'countabandonedretry',_0x1df90a[_0x6763('0xe1')]),_0xf9f3f9[_0x6763('0xad')],_0xf9f3f9[_0x6763('0xae')]);}}break;case'18':_0x1df90a[_0x6763('0x43')]+=0x1;_0xf9f3f9['countmachineretry']+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut[_0x6763('0xa1')](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0x12,_0x5d6eae[_0x6763('0xe2')]||_0x5d6eae[_0x6763('0xe3')]);ami['emit'](_0x6763('0xe4'),ut[_0x6763('0xa4')](_0xf9f3f9,_0x6763('0xe5')));rpcDb[_0x6763('0x93')](_0xf9f3f9,_0x6763('0xe6'));if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a[_0x6763('0xa7')]){_0x3e481b=ut['cloneAction'](_0xf9f3f9,0xf,_0x6763('0xc3'));rpcDb[_0x6763('0x96')](_0x3e481b,_0x6763('0xe6'));}else{rpcDb[_0x6763('0x96')](_0xf9f3f9,_0x6763('0xe6'));}delete this[_0x6763('0x12')][_0x5d6eae[_0x6763('0xbd')]];break;case'19':_0x1df90a[_0x6763('0x43')]+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut['totalGlobal'](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0x13,_0x5d6eae[_0x6763('0xe2')]||_0x5d6eae[_0x6763('0xe3')]);ami[_0x6763('0x24')]('custom:amd',ut['buildObj'](_0xf9f3f9,_0x6763('0xe5')));rpcDb[_0x6763('0x93')](_0xf9f3f9,'[callProgressDetectingCustomer][machine]');if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a[_0x6763('0xa7')]){_0x3e481b=ut[_0x6763('0xa8')](_0xf9f3f9,0xf,_0x6763('0xc3'));rpcDb[_0x6763('0x96')](_0x3e481b,_0x6763('0xe7'));}else{rpcDb['createCustomerFinal'](_0xf9f3f9,_0x6763('0xe7'));}delete this[_0x6763('0x12')][_0x5d6eae['linkedid']];break;default:if(_0xf9f3f9[_0x6763('0x71')]){ut[_0x6763('0x7c')](_0x1df90a,_0x6763('0xe8'));ut[_0x6763('0x7d')](_0x6763('0xe9')+_0x1df90a['name'],_0x5d6eae);}_0x1df90a[_0x6763('0x43')]+=0x1;_0xf9f3f9[_0x6763('0xa0')]=ut['totalGlobal'](_0xf9f3f9);ut[_0x6763('0x90')](_0xf9f3f9,0xc,_0x5d6eae['cause-txt']||_0x5d6eae[_0x6763('0xe3')]);rpcDb['createCustomerHistory'](_0xf9f3f9,_0x6763('0xea'));if(ut[_0x6763('0xa1')](_0xf9f3f9)>=_0x1df90a['dialGlobalMaxRetry']){_0x3e481b=ut[_0x6763('0xa8')](_0xf9f3f9,0xf,_0x6763('0xc3'));rpcDb['createCustomerFinal'](_0x3e481b,_0x6763('0xeb'));}else{rpcDb[_0x6763('0x96')](_0xf9f3f9,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x5d6eae[_0x6763('0xbd')]];}if(!(_0xf9f3f9[_0x6763('0x71')]&&_0x296abd==='16')){ut[_0x6763('0x7a')](_0x1df90a,_0x6763('0xec'));logger[_0x6763('0x5d')](_0x6763('0xed'),_0xf9f3f9['uniqueid'],'\x20Queue',_0x1df90a[_0x6763('0x27')],'originated:\x20',_0x1df90a[_0x6763('0x61')]);}if(_0x296abd!==_0x6763('0xee')){delete this[_0x6763('0x12')][_0x5d6eae[_0x6763('0xbd')]];delete this['actions'][_0x5d6eae[_0x6763('0xef')]];}}};Preview[_0x6763('0xb')][_0x6763('0xf0')]=function(_0x3f8189,_0x2a6027,_0x47e956){if(_['isUndefined'](_0x2a6027)&&_0x6763('0xf1')!==typeof _0x2a6027){return;}if(_[_0x6763('0xf2')](_0x47e956)&&_0x6763('0xf1')!==typeof _0x47e956){return;}switch(_0x47e956[_0x6763('0xf3')]){case'0':ut[_0x6763('0xf4')](_0x3f8189,0x0,_0x6763('0xa2'));rpcDb[_0x6763('0xf5')](_0x3f8189,_0x6763('0xf6'));break;case'3':ut[_0x6763('0xf4')](_0x3f8189,0x3,_0x6763('0xc8'));rpcDb[_0x6763('0xf5')](_0x3f8189,_0x6763('0xf7'));break;case'5':ut[_0x6763('0xf4')](_0x3f8189,0x5,_0x6763('0xc0'));rpcDb[_0x6763('0xf5')](_0x3f8189,_0x6763('0xf8'));break;case'8':ut['logAgent'](_0x3f8189,0x8,_0x6763('0xf9'));rpcDb[_0x6763('0xf5')](_0x3f8189,_0x6763('0xfa'));break;case'22':ut[_0x6763('0xf4')](_0x3f8189,0x16,_0x6763('0xfb'));rpcDb[_0x6763('0xf5')](_0x3f8189,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x6763('0xf4')](_0x3f8189,0xc,_0x47e956[_0x6763('0xf3')]);rpcDb[_0x6763('0xf5')](_0x3f8189,_0x6763('0xfa'));}ut[_0x6763('0x7a')](_0x2a6027,_0x6763('0xfc'));logger[_0x6763('0x5d')]('[originated][decrement][callProgressDetectingAgent]',_0x3f8189[_0x6763('0xb1')],_0x6763('0xbc'),_0x2a6027[_0x6763('0x27')],_0x6763('0xfd'),_0x2a6027[_0x6763('0x61')]);delete this[_0x6763('0x12')][_0x3f8189[_0x6763('0xb1')]];};Preview[_0x6763('0xb')]['checkInBlack']=function(_0x2aa77b,_0x41c13a,_0x596700,_0x2a6993,_0x3e944b){var _0x591a99=this;return new BPromise(function(_0xf6c607,_0x39830e){if(_['isNil'](_0x41c13a)||_['isNil'](_0x41c13a[_0x6763('0xfe')])||_[_0x6763('0x85')](_0x41c13a[_0x6763('0xfe')]['phone'])||_[_0x6763('0x85')](_0x41c13a[_0x6763('0x74')])){_0x39830e(ut[_0x6763('0x4e')]('Contact\x20is\x20undefined',_0x2a6993,_0x3e944b));return;}var _0x34c7d1=uuid['v4']();var _0x3602d6=_0x591a99[_0x6763('0xf')][_0x41c13a[_0x6763('0x6f')][_0x6763('0x27')]];var _0x3c89e9=_0x596700?_0x591a99[_0x6763('0x13')][_0x596700]['id']:undefined;_0x591a99[_0x6763('0x12')][_0x34c7d1]=new Action(_0x41c13a,_0x3602d6,_0x34c7d1,_0x596700,_0x3c89e9);var _0x2b1bc5=_0x591a99[_0x6763('0x12')][_0x34c7d1];_0x2b1bc5[_0x6763('0xad')]=_0x2a6993;_0x2b1bc5['activeContact']=_0x3e944b;_0x2b1bc5['lookAgent']=_0x596700;if(_['isEmpty'](_0x2aa77b)){_0x591a99[_0x6763('0xff')](_0x2b1bc5,_0x3602d6,_0x41c13a,_0x596700)['then'](function(_0x512687){logger[_0x6763('0x5d')](_0x6763('0x100'),_0x6763('0x101')+_0x2b1bc5[_0x6763('0x70')]+_0x6763('0x102')+_0x2b1bc5[_0x6763('0x103')],JSON['stringify'](_0x512687));ami['emit'](_0x6763('0x104'),ut[_0x6763('0xa4')](_0x2b1bc5,_0x6763('0x105'),_0x591a99[_0x6763('0xf')][_0x2b1bc5[_0x6763('0x70')]]));_0xf6c607(ut[_0x6763('0x4e')](_0x6763('0x106')));})[_0x6763('0x78')](function(_0x562ba8){ut['logger'](_0x6763('0x107'),_0x562ba8);_0x39830e(ut['message']('Call\x20failed',_0x2a6993,_0x3e944b));});}else{_0x3602d6[_0x6763('0x3b')]+=0x1;ut[_0x6763('0x108')](_0x2b1bc5);rpcDb[_0x6763('0x109')](_0x2b1bc5,_0x6763('0x10a'));delete _0x591a99['actions'][_0x34c7d1];_0x39830e(ut[_0x6763('0x4e')](_0x6763('0x10b'),_0x2a6993,_0x3e944b));}});};Preview[_0x6763('0xb')][_0x6763('0x9b')]=function(_0x230c87){return!_['isNil'](_0x230c87)&&!_[_0x6763('0x85')](_0x230c87['name'])&&!_[_0x6763('0x85')](_0x230c87[_0x6763('0x55')])&&_0x230c87['active']&&!_[_0x6763('0x85')](this[_0x6763('0x11')][util[_0x6763('0x5a')]('SIP/%s',_0x230c87[_0x6763('0x27')])])&&!_[_0x6763('0x85')](this['trunks'][util['format']('SIP/%s',_0x230c87[_0x6763('0x27')])][_0x6763('0x77')])&&(this[_0x6763('0x11')][util[_0x6763('0x5a')](_0x6763('0x10c'),_0x230c87['name'])][_0x6763('0x77')]===_0x6763('0x10d')||this[_0x6763('0x11')][util['format'](_0x6763('0x10c'),_0x230c87[_0x6763('0x27')])]['status']===_0x6763('0x10e'));};Preview[_0x6763('0xb')][_0x6763('0x8a')]=function(_0x473202,_0x2a31a9){var _0x4b5c43=this;return new BPromise(function(_0x4d5a3d,_0x5c4a57){_0x4b5c43[_0x6763('0x10f')](_0x473202,_0x2a31a9)['then'](function(_0xb7998a){_0x4d5a3d(_['pick'](_0xb7998a,[_0x6763('0x4e')]));})[_0x6763('0x78')](function(_0x4070ac){if(_0x4070ac[_0x6763('0x110')]){rpcDb[_0x6763('0x111')](_0x473202);}if(_0x4070ac[_0x6763('0x55')]){rpcDb[_0x6763('0x8d')](_0x473202);}_0x5c4a57(_[_0x6763('0x72')](_0x4070ac,[_0x6763('0x4e')]));});});};Preview['prototype'][_0x6763('0x10f')]=function(_0x293404,_0x31e6b1){var _0x1639cd=this;return new BPromise(function(_0x3eb01e,_0x2753aa){var _0x179754,_0xe0b2e6;rpcDb[_0x6763('0x112')](_0x293404)[_0x6763('0x113')](function(_0x4cc1d0){if(!_[_0x6763('0x85')](_0x4cc1d0[0x0])){_0xe0b2e6=_0x4cc1d0[0x0][_0x6763('0x114')]?![]:!![];_0x179754=_0x4cc1d0[0x0][_0x6763('0x114')]?!![]:![];_0x179754=_0x31e6b1?!![]:_0x179754;}var _0x258c9d=_0x1639cd[_0x6763('0x115')](_0x4cc1d0);if(_0x258c9d[_0x6763('0x116')]){rpcDb[_0x6763('0x117')](_['pick'](_0x4cc1d0[0x0],[_0x6763('0x74'),_0x6763('0x118')]))['then'](function(_0x3b8a13){_0x1639cd[_0x6763('0x119')](_0x3b8a13,_0x4cc1d0[0x0],_0x31e6b1,_0xe0b2e6,_0x179754)['then'](function(_0x14d4fd){_0x3eb01e(_0x14d4fd);})[_0x6763('0x78')](function(_0x14e098){_0x2753aa(_0x14e098);});})[_0x6763('0x78')](function(_0x5f284b){ut['logger'](_0x6763('0x11a'),_0x5f284b);_0x2753aa(ut['message'](_0x6763('0x11b'),_0xe0b2e6,_0x179754));});}else{_0x2753aa(ut[_0x6763('0x4e')](_0x258c9d[_0x6763('0x4e')],_0xe0b2e6,_0x179754));}})[_0x6763('0x78')](function(_0x408165){ut[_0x6763('0x64')](_0x6763('0x11c'),_0x408165);_0x2753aa(ut['message'](_0x6763('0x11b'),![],!![]));});});};Preview[_0x6763('0xb')][_0x6763('0x115')]=function(_0x2e3709){if(_[_0x6763('0x85')](_0x2e3709)||_[_0x6763('0x11d')](_0x2e3709)||!_[_0x6763('0x85')](_0x2e3709[0x0][_0x6763('0x89')])&&_[_0x6763('0x85')](_0x2e3709[0x0][_0x6763('0x89')][_0x6763('0x27')])){ut[_0x6763('0x64')](_0x6763('0x11e'),_0x2e3709);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x348aa8=this[_0x6763('0xf')][_0x2e3709[0x0][_0x6763('0x6f')]['name']];_0x348aa8[_0x6763('0x4e')]=_0x6763('0x11f');if(_[_0x6763('0x85')](_0x348aa8)){ut[_0x6763('0x64')](_0x6763('0x120'),_0x348aa8);return{'isValid':![],'message':_0x6763('0x121')};}if(!this[_0x6763('0x9b')](_0x348aa8[_0x6763('0x54')])){ut[_0x6763('0x64')](_0x6763('0x122'),_0x6763('0x123')+_0x348aa8[_0x6763('0x27')]+_0x6763('0x124'));if(!this[_0x6763('0x9b')](_0x348aa8['TrunkBackup'])){ut[_0x6763('0x64')](_0x6763('0x122'),_0x348aa8[_0x6763('0x27')]+_0x6763('0x125'));return{'isValid':![],'message':_0x6763('0x126')};}}if(!ut[_0x6763('0x9a')](_0x348aa8['dialActive'])){ut[_0x6763('0x64')](_0x6763('0x127'),_0x348aa8[_0x6763('0x27')]+_0x6763('0x128'));return{'isValid':![],'message':_0x6763('0x123')+_0x348aa8[_0x6763('0x27')]+_0x6763('0x128')};}return{'isValid':!![],'message':_0x6763('0x129')};};Preview[_0x6763('0xb')][_0x6763('0xff')]=function(_0xcc85cb,_0x21c46e,_0x293c44,_0x2f0dee){var _0x125240=this;return new BPromise(function(_0x5bb0c4,_0x25dce3){var _0x487927=_0xcc85cb['uniqueid'];var _0x2dc208=_0x125240['isTrunkReachable'](_0x21c46e[_0x6763('0x54')])?util['format'](_0x6763('0x12a'),_0x21c46e[_0x6763('0x54')][_0x6763('0x27')],_[_0x6763('0x85')](_0x21c46e['dialPrefix'])?'':_0x21c46e[_0x6763('0x38')][_0x6763('0x12b')]()||'',_0x21c46e['dialCutDigit']>0x0?_0x293c44[_0x6763('0xfe')]['phone'][_0x6763('0x12c')](_0x21c46e['dialCutDigit']):_0x293c44[_0x6763('0xfe')][_0x6763('0x12d')]):util[_0x6763('0x5a')]('SIP/%s/%s%s',_[_0x6763('0x85')](_0x21c46e['TrunkBackup'])?_0x21c46e['Trunk'][_0x6763('0x27')]:_0x21c46e[_0x6763('0x9c')][_0x6763('0x27')],_[_0x6763('0x85')](_0x21c46e[_0x6763('0x38')])?'':_0x21c46e[_0x6763('0x38')]['trim']()||'',_0x21c46e[_0x6763('0x12e')]>0x0?_0x293c44[_0x6763('0xfe')][_0x6763('0x12d')]['substring'](_0x21c46e[_0x6763('0x12e')]):_0x293c44['Contact'][_0x6763('0x12d')]);var _0xe65018=_0x125240[_0x6763('0x9b')](_0x21c46e[_0x6763('0x54')])?ut[_0x6763('0x12f')](_0x21c46e[_0x6763('0x54')][_0x6763('0x56')],_0x21c46e['dialOriginateCallerIdName'],_0x21c46e[_0x6763('0x130')]>0x0?ut[_0x6763('0x131')](_0x21c46e[_0x6763('0x132')],_0x21c46e[_0x6763('0x130')]):_0x21c46e[_0x6763('0x132')]):ut['getCallerId'](_[_0x6763('0x85')](_0x21c46e[_0x6763('0x9c')])?_0x21c46e[_0x6763('0x54')][_0x6763('0x56')]:_0x21c46e[_0x6763('0x9c')][_0x6763('0x56')],_0x21c46e[_0x6763('0x36')],_0x21c46e[_0x6763('0x130')]>0x0?ut['getCallerIdRandom'](_0x21c46e[_0x6763('0x132')],_0x21c46e['dialRandomLastDigitCallerIdNumber']):_0x21c46e['dialOriginateCallerIdNumber']);if(_0xe65018){_0xcc85cb[_0x6763('0x133')]=ut[_0x6763('0x134')](_0xe65018);_0xcc85cb['originatecalleridnum']=ut['extractCalleridNumber'](_0xe65018);}var _0x47a055=ut[_0x6763('0x135')](_0x21c46e,_0x293c44,_0x2dc208,_0xe65018,_0x487927,_0xcc85cb);_[_0x6763('0x136')](_0xcc85cb,ut[_0x6763('0x137')](_0x47a055));_0xcc85cb['starttime']=moment()[_0x6763('0x5a')](_0x6763('0x8e'));ami[_0x6763('0x76')](ut['variablesAction'](_0xcc85cb,_0x21c46e,_0x47a055,_0xcc85cb[_0x6763('0xae')],_0x2f0dee))[_0x6763('0x113')](function(_0x2dfc96){var _0x47c009=_0xcc85cb[_0x6763('0x138')];if(!_[_0x6763('0x85')](_0x47c009)){if(!_[_0x6763('0x85')](_0x125240['agents'][_0x47c009])){_0x125240[_0x6763('0x13')][_0x47c009][_0x6763('0x139')]=_0xcc85cb['calleridnum'];emit(util[_0x6763('0x5a')](_0x6763('0x13a'),_0x125240[_0x6763('0x13')][_0x47c009][_0x6763('0x27')]),_0x6763('0x13b'),{'destaccountcode':_0x125240[_0x6763('0x13')][_0x47c009][_0x6763('0x13c')],'destconnectedlinenum':_0xcc85cb[_0x6763('0x13d')]});}}_0x21c46e['originated']+=0x1;logger[_0x6763('0x5d')]('[originated][increment]',_0x487927,'\x20Queue',_0x21c46e[_0x6763('0x27')],_0x6763('0xfd'),_0x21c46e[_0x6763('0x61')]);_0x5bb0c4(_0x2dfc96);})[_0x6763('0x78')](function(_0x267556){ut[_0x6763('0xf4')](_0xcc85cb,0xe,_0x6763('0x13e'));rpcDb[_0x6763('0xf5')](_0xcc85cb,_0x6763('0x13f'));_0x25dce3(_0x267556);});});};Preview[_0x6763('0xb')][_0x6763('0x140')]=function(_0x43b085){if(this['actions'][_0x43b085[_0x6763('0xbd')]]){this[_0x6763('0x12')][_0x43b085[_0x6763('0xbd')]][_0x6763('0x141')]=_0x43b085[_0x6763('0x141')];}};Preview[_0x6763('0xb')]['syncOriginateResponse']=function(_0x3ba795){var _0x30e615=this;var _0x38dce0=this[_0x6763('0x12')][_0x3ba795[_0x6763('0x142')]];if(_0x38dce0){if(_0x38dce0['lookAgent']&&this[_0x6763('0x13')][_0x38dce0['lookAgent']]){ut['logLookAgent'](_0x38dce0,this[_0x6763('0x13')][_0x38dce0[_0x6763('0x143')]][_0x6763('0x27')],this[_0x6763('0x13')][_0x38dce0[_0x6763('0x143')]]['id']);}var _0x3ed53a=_[_0x6763('0x144')](_0x38dce0);_0x3ed53a[_0x6763('0xaf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x462764=_0x30e615[_0x6763('0xf')][_0x38dce0[_0x6763('0x70')]];if(ut[_0x6763('0x145')](_0x3ba795[_0x6763('0x146')])){if(_0x38dce0[_0x6763('0xad')]){rpcDb[_0x6763('0x111')](_0x38dce0[_0x6763('0x103')]);}if(_0x38dce0[_0x6763('0xae')]){rpcDb[_0x6763('0x8d')](_0x38dce0['idContact']);}ami[_0x6763('0x24')](_0x6763('0x147'),ut['buildObj'](_0x38dce0,_0x6763('0x148'),this['campaignsPreview'][_0x38dce0[_0x6763('0x70')]]));this[_0x6763('0xf0')](_0x3ed53a,_0x462764,_0x3ba795);}else{_0x38dce0[_0x6763('0x149')]=moment()[_0x6763('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x6763('0xf4')](_0x3ed53a,0x4,_0x6763('0xb8'));rpcDb[_0x6763('0xf5')](_0x3ed53a,_0x6763('0x14a'));}}};Preview['prototype']['syncHangup']=function(_0xcbbf9c){var _0x123f86=this;var _0x2a479a=this[_0x6763('0x12')][_0xcbbf9c['linkedid']];var _0x28288f;if(_0x2a479a){_0x28288f=this[_0x6763('0xf')][_0x2a479a[_0x6763('0x70')]];logger[_0x6763('0x5d')]('[syncHangup][talking]',_0xcbbf9c[_0x6763('0xbd')],_0x6763('0xbc'),_0x28288f[_0x6763('0x27')],'pTalking:\x20',_0x28288f[_0x6763('0x2c')]);}if(this[_0x6763('0x12')][_0xcbbf9c['linkedid']]&&_0xcbbf9c[_0x6763('0xbd')]!==_0xcbbf9c[_0x6763('0xb1')]){if(_0xcbbf9c[_0x6763('0x14b')]==='16'&&this[_0x6763('0x12')][_0xcbbf9c[_0x6763('0xbd')]][_0x6763('0x71')]){this[_0x6763('0x9e')](_0xcbbf9c,_0xcbbf9c['linkedid'],_0xcbbf9c['cause']);}else if(this[_0x6763('0x12')][_0xcbbf9c[_0x6763('0xbd')]][_0x6763('0x71')]){logger[_0x6763('0x5d')]('[syncHangup][talking][cause]',_0xcbbf9c[_0x6763('0xbd')],_0xcbbf9c[_0x6763('0x14b')],_0x6763('0xbc'),_0x28288f[_0x6763('0x27')],_0x6763('0x14c'),_0x28288f[_0x6763('0x2c')]);this['callProgressDetectingCustomer'](_0xcbbf9c,_0xcbbf9c[_0x6763('0xbd')],_0xcbbf9c[_0x6763('0x14b')]);}}else if(_0x2a479a&&_['isNil'](_0x2a479a[_0x6763('0x14d')])&&_0x28288f['dialQueueProject']&&_0xcbbf9c['linkedid']===_0xcbbf9c[_0x6763('0xb1')]&&_[_0x6763('0x85')](_0xcbbf9c[_0x6763('0xf3')])&&_0xcbbf9c[_0x6763('0x14b')]==='16'&&_0xcbbf9c['channelstate']==='6'&&_[_0x6763('0xf2')](_0x2a479a[_0x6763('0x14e')])){if(_0x2a479a[_0x6763('0xad')]){rpcDb[_0x6763('0x111')](_0x2a479a[_0x6763('0x103')]);}if(_0x2a479a['activeContact']){rpcDb[_0x6763('0x8d')](_0x2a479a[_0x6763('0x103')]);}_0xcbbf9c[_0x6763('0xf3')]='22';this[_0x6763('0xf0')](_0x2a479a,_0x28288f,_0xcbbf9c);}else if(_0x2a479a&&_0x2a479a[_0x6763('0x14e')]){if(_0xcbbf9c['cause']==='16'&&this['actions'][_0xcbbf9c[_0x6763('0xbd')]]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0xcbbf9c[_0x6763('0xbd')],_0xcbbf9c[_0x6763('0x14b')],_0x6763('0xbc'),_0x28288f[_0x6763('0x27')],_0x6763('0x14c'),_0x28288f['pTalking']);this[_0x6763('0x9e')](_0xcbbf9c,_0xcbbf9c[_0x6763('0xbd')],_0xcbbf9c[_0x6763('0x14b')]);}else if(this[_0x6763('0x12')][_0xcbbf9c[_0x6763('0xbd')]]['dialAnswer']){logger[_0x6763('0x5d')]('[syncHangup][talking][cause]',_0xcbbf9c['linkedid'],_0xcbbf9c[_0x6763('0x14b')],_0x6763('0xbc'),_0x28288f[_0x6763('0x27')],_0x6763('0x14c'),_0x28288f['pTalking']);this[_0x6763('0x9e')](_0xcbbf9c,_0xcbbf9c[_0x6763('0xbd')],_0xcbbf9c['cause']);}}};Preview[_0x6763('0xb')]['syncDialEnd']=function(_0x33610f){if(this['actions'][_0x33610f['destlinkedid']]&&_0x33610f[_0x6763('0xef')]!==_0x33610f[_0x6763('0x14f')]){this[_0x6763('0x9e')](_0x33610f,_0x33610f[_0x6763('0xef')],_0x33610f[_0x6763('0xe3')]);}};Preview[_0x6763('0xb')][_0x6763('0x1a')]=function(_0x406f9f){if(this['actions'][_0x406f9f[_0x6763('0xbd')]]&&_0x406f9f[_0x6763('0xbd')]!==_0x406f9f[_0x6763('0xb1')]&&!this['actions'][_0x406f9f['linkedid']][_0x6763('0x71')]){if(_0x406f9f[_0x6763('0x14b')]==='1'){this[_0x6763('0x9e')](_0x406f9f,_0x406f9f[_0x6763('0xbd')],_0x406f9f['cause']);}}};Preview[_0x6763('0xb')][_0x6763('0x150')]=function(_0x2272d7,_0x175450,_0x39ce0a){if(this['actions'][_0x2272d7]){if(_[_0x6763('0x85')](this[_0x6763('0x12')][_0x2272d7][_0x6763('0x151')])){this[_0x6763('0x12')][_0x2272d7]['variables']={};}this[_0x6763('0x12')][_0x2272d7][_0x6763('0x151')][_0x175450]=_0x39ce0a;}};Preview[_0x6763('0xb')][_0x6763('0x152')]=function(_0x2dfaca){try{if(!_[_0x6763('0x85')](_0x2dfaca)){if(ut[_0x6763('0x153')](_[_0x6763('0x154')](_0x2dfaca[_0x6763('0x155')])[0x0])){this[_0x6763('0x150')](_0x2dfaca['uniqueid'],_[_0x6763('0x154')](_0x2dfaca[_0x6763('0x155')])[0x0],_0x2dfaca[_0x6763('0x156')]);}}}catch(_0x1fcfc5){logger[_0x6763('0x157')]('[syncVarSet][Preview]',util['inspect'](_0x1fcfc5,{'showHidden':![],'depth':null}));}};Preview[_0x6763('0xb')]['syncAttendedTransfer']=function(_0x328324){if(_0x328324){if(this[_0x6763('0x12')][_0x328324['transfertargetlinkedid']]){this[_0x6763('0x12')][_0x328324[_0x6763('0x158')]][_0x6763('0x14e')]=!![];}}};Preview[_0x6763('0xb')][_0x6763('0x22')]=function(_0x23da59){if(_0x23da59){if(this['actions'][_0x23da59[_0x6763('0x159')]]){this[_0x6763('0x12')][_0x23da59[_0x6763('0x159')]][_0x6763('0x14e')]=!![];}}};module[_0x6763('0x15a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 63e5051..aa79a39 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 _0x96ce=['lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','exten','xcally-motion-preview','holdtime','assigned'];(function(_0x1ea379,_0x489de8){var _0x107709=function(_0x286fc6){while(--_0x286fc6){_0x1ea379['push'](_0x1ea379['shift']());}};_0x107709(++_0x489de8);}(_0x96ce,0x1be));var _0xe96c=function(_0x374785,_0x4f71b8){_0x374785=_0x374785-0x0;var _0x572c40=_0x96ce[_0x374785];return _0x572c40;};'use strict';var util=require(_0xe96c('0x0'));var BPromise=require(_0xe96c('0x1'));var logger=require(_0xe96c('0x2'))(_0xe96c('0x3'));var _=require(_0xe96c('0x4'));var cmHopper=require(_0xe96c('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xe96c('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xe96c('0x7'));var agentReportPreview=require(_0xe96c('0x8'));var voiceQueueReport=require(_0xe96c('0x9'));function loggerCatch(_0x1d1f51){return function(_0x407e1b){logger[_0xe96c('0xa')](_0x1d1f51,util[_0xe96c('0xb')](_0x407e1b,{'showHidden':![],'depth':null}));};}function create(_0x1e8f5f){return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](cmHopperHistory[_0xe96c('0xe')](_0x1e8f5f))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x10')));}function createAgent(_0x5da15d){return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](agentReportPreview[_0xe96c('0xe')](_0x5da15d))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x10')));}function moveContact(_0x31d977){return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](cmHopper[_0xe96c('0x11')](_0x31d977,!![]))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x12')));}exports[_0xe96c('0x13')]=function(_0x32f07d){return BPromise[_0xe96c('0xc')]()['then'](cmHopperBlack[_0xe96c('0x13')](_0x32f07d))['catch'](loggerCatch(_0xe96c('0x14')));};exports[_0xe96c('0x15')]=function(_0x4c5ac7){return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](cmHopper[_0xe96c('0x15')](_0x4c5ac7))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x16')));};exports['createHistory']=function(_0x1801e7,_0x3e1702){create(_0x1801e7)[_0xe96c('0xf')](loggerCatch(_0x3e1702));moveContact(_0x1801e7)['catch'](loggerCatch(_0x3e1702));};exports[_0xe96c('0x17')]=function(_0xdd45fb,_0x3dee91){createAgent(_0xdd45fb)[_0xe96c('0xf')](loggerCatch(_0x3dee91));};exports['createCustomerHistory']=function(_0x58c95a,_0x15f91f){create(_0x58c95a)[_0xe96c('0xf')](loggerCatch(_0x15f91f));};exports[_0xe96c('0x18')]=function(_0x3cf605,_0x544378){moveContact(_0x3cf605)[_0xe96c('0xf')](loggerCatch(_0x544378));};exports[_0xe96c('0x19')]=function(_0x309e70,_0x1da4c3,_0x596078){if(_0x1da4c3){_0x309e70[_0xe96c('0x1a')]=null;}if(_0x596078){_0x309e70[_0xe96c('0x1b')]=![];}return BPromise['resolve']()[_0xe96c('0xd')](cmHopper[_0xe96c('0x19')](_0x309e70))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x1c')));};exports[_0xe96c('0x1d')]=function(_0x58a2d4){return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](cmHopper['countReScheduled'](_0x58a2d4))[_0xe96c('0xf')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x3e77a8){return BPromise['resolve']()[_0xe96c('0xd')](cmHopper[_0xe96c('0x1e')]({'UserId':null},_0x3e77a8,0x1))['catch'](loggerCatch(_0xe96c('0x1f')));};exports['disableContact']=function(_0x1a6a69){return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](cmHopper[_0xe96c('0x1e')]({'active':![]},_0x1a6a69,0x1))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x20')));};exports[_0xe96c('0x21')]=function(_0x4f9b00){var _0x2834cd={};_0x2834cd[_0xe96c('0x22')]=_0x4f9b00[_0xe96c('0x22')];_0x2834cd['uniqueid']=_0x4f9b00[_0xe96c('0x23')];_0x2834cd[_0xe96c('0x24')]=_0x4f9b00[_0xe96c('0x24')];_0x2834cd[_0xe96c('0x25')]=_0x4f9b00['calleridname'];_0x2834cd['queue']=_0x4f9b00['queue'];_0x2834cd[_0xe96c('0x26')]=_0x4f9b00[_0xe96c('0x27')];_0x2834cd[_0xe96c('0x28')]=_0x4f9b00[_0xe96c('0x27')];_0x2834cd['queuecallercomplete']=0x1;_0x2834cd[_0xe96c('0x29')]=_0x4f9b00[_0xe96c('0x2a')];_0x2834cd[_0xe96c('0x2b')]=_0x4f9b00[_0xe96c('0x2c')];_0x2834cd['context']='from-sip';_0x2834cd[_0xe96c('0x2d')]=_0xe96c('0x2e');_0x2834cd[_0xe96c('0x2f')]=0x0;_0x2834cd[_0xe96c('0x30')]=0x1;_0x2834cd[_0xe96c('0x31')]=_0x4f9b00['membername'];_0x2834cd[_0xe96c('0x32')]=_0xe96c('0x33');return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](voiceQueueReport['create'](_0x2834cd))[_0xe96c('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xe96c('0x34')]=function(_0x4a69af,_0x1d70c5){return BPromise[_0xe96c('0xc')]()[_0xe96c('0xd')](cmHopper[_0xe96c('0x34')](_0x4a69af,_0x1d70c5))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x35')));};exports['rescheduleContactInQueue']=function(_0x4d1ebb){return BPromise['resolve']()[_0xe96c('0xd')](cmHopper[_0xe96c('0x19')](_0x4d1ebb,!![],!![]))[_0xe96c('0xf')](loggerCatch(_0xe96c('0x36')));}; \ No newline at end of file +var _0x3c81=['../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','UserId','active','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper'];(function(_0x1b31da,_0x3957fa){var _0x523953=function(_0x3a4d3a){while(--_0x3a4d3a){_0x1b31da['push'](_0x1b31da['shift']());}};_0x523953(++_0x3957fa);}(_0x3c81,0xf6));var _0x13c8=function(_0x260fa7,_0x33982f){_0x260fa7=_0x260fa7-0x0;var _0x148c81=_0x3c81[_0x260fa7];return _0x148c81;};'use strict';var util=require(_0x13c8('0x0'));var BPromise=require(_0x13c8('0x1'));var logger=require(_0x13c8('0x2'))('preview');var _=require('lodash');var cmHopper=require(_0x13c8('0x3'));var cmHopperFinal=require(_0x13c8('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x13c8('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x13c8('0x6'));function loggerCatch(_0x37542a){return function(_0x1ab51e){logger[_0x13c8('0x7')](_0x37542a,util[_0x13c8('0x8')](_0x1ab51e,{'showHidden':![],'depth':null}));};}function create(_0x4e9e8d){return BPromise[_0x13c8('0x9')]()[_0x13c8('0xa')](cmHopperHistory['createHistory'](_0x4e9e8d))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x16f864){return BPromise[_0x13c8('0x9')]()[_0x13c8('0xa')](agentReportPreview[_0x13c8('0xb')](_0x16f864))['catch'](loggerCatch(_0x13c8('0xc')));}function moveContact(_0x5eab80){return BPromise[_0x13c8('0x9')]()['then'](cmHopper['moveContactManagedDialer'](_0x5eab80,!![]))['catch'](loggerCatch(_0x13c8('0xd')));}exports[_0x13c8('0xe')]=function(_0x429000){return BPromise[_0x13c8('0x9')]()[_0x13c8('0xa')](cmHopperBlack['checkIsBlackList'](_0x429000))[_0x13c8('0xf')](loggerCatch(_0x13c8('0x10')));};exports[_0x13c8('0x11')]=function(_0x13a3f2){return BPromise[_0x13c8('0x9')]()['then'](cmHopper['getContactPreview'](_0x13a3f2))[_0x13c8('0xf')](loggerCatch(_0x13c8('0x12')));};exports[_0x13c8('0xb')]=function(_0x291932,_0x109cd4){create(_0x291932)[_0x13c8('0xf')](loggerCatch(_0x109cd4));moveContact(_0x291932)['catch'](loggerCatch(_0x109cd4));};exports['createAgentHistory']=function(_0x20d3cc,_0x32f4be){createAgent(_0x20d3cc)[_0x13c8('0xf')](loggerCatch(_0x32f4be));};exports['createCustomerHistory']=function(_0x2ee60a,_0x560de5){create(_0x2ee60a)[_0x13c8('0xf')](loggerCatch(_0x560de5));};exports['createCustomerFinal']=function(_0x514562,_0x56dd78){moveContact(_0x514562)[_0x13c8('0xf')](loggerCatch(_0x56dd78));};exports['rescheduleContact']=function(_0xca082c,_0x12acdf,_0x4bcd96){if(_0x12acdf){_0xca082c[_0x13c8('0x13')]=null;}if(_0x4bcd96){_0xca082c[_0x13c8('0x14')]=![];}return BPromise['resolve']()[_0x13c8('0xa')](cmHopper[_0x13c8('0x15')](_0xca082c))[_0x13c8('0xf')](loggerCatch(_0x13c8('0x16')));};exports['countReScheduled']=function(_0x234590){return BPromise[_0x13c8('0x9')]()[_0x13c8('0xa')](cmHopper['countReScheduled'](_0x234590))[_0x13c8('0xf')](loggerCatch(_0x13c8('0x17')));};exports[_0x13c8('0x18')]=function(_0x3e8803){return BPromise['resolve']()[_0x13c8('0xa')](cmHopper['unlockContact']({'UserId':null},_0x3e8803,0x1))['catch'](loggerCatch(_0x13c8('0x19')));};exports['disableContact']=function(_0x4d5fd1){return BPromise[_0x13c8('0x9')]()[_0x13c8('0xa')](cmHopper['unlockContact']({'active':![]},_0x4d5fd1,0x1))[_0x13c8('0xf')](loggerCatch(_0x13c8('0x1a')));};exports[_0x13c8('0x1b')]=function(_0x439c1e){var _0x23774d={};_0x23774d[_0x13c8('0x1c')]=_0x439c1e[_0x13c8('0x1c')];_0x23774d[_0x13c8('0x1d')]=_0x439c1e['uniqueid'];_0x23774d[_0x13c8('0x1e')]=_0x439c1e[_0x13c8('0x1e')];_0x23774d['calleridname']=_0x439c1e[_0x13c8('0x1f')];_0x23774d[_0x13c8('0x20')]=_0x439c1e[_0x13c8('0x20')];_0x23774d['queuecallerjoinAt']=_0x439c1e[_0x13c8('0x21')];_0x23774d['queuecallerleaveAt']=_0x439c1e[_0x13c8('0x21')];_0x23774d[_0x13c8('0x22')]=0x1;_0x23774d[_0x13c8('0x23')]=_0x439c1e['endtime'];_0x23774d[_0x13c8('0x24')]=_0x439c1e[_0x13c8('0x25')];_0x23774d[_0x13c8('0x26')]=_0x13c8('0x27');_0x23774d[_0x13c8('0x28')]=_0x13c8('0x29');_0x23774d[_0x13c8('0x2a')]=0x0;_0x23774d[_0x13c8('0x2b')]=0x1;_0x23774d[_0x13c8('0x2c')]=_0x439c1e['membername'];_0x23774d['queuecallerexitreason']=_0x13c8('0x2d');return BPromise[_0x13c8('0x9')]()[_0x13c8('0xa')](voiceQueueReport['create'](_0x23774d))[_0x13c8('0xf')](loggerCatch(_0x13c8('0x2e')));};exports[_0x13c8('0x2f')]=function(_0x4ab58b,_0x133fbb){return BPromise[_0x13c8('0x9')]()[_0x13c8('0xa')](cmHopper[_0x13c8('0x2f')](_0x4ab58b,_0x133fbb))[_0x13c8('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x13c8('0x30')]=function(_0x2213d2){return BPromise[_0x13c8('0x9')]()['then'](cmHopper[_0x13c8('0x15')](_0x2213d2,!![],!![]))['catch'](loggerCatch(_0x13c8('0x31')));}; \ 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 b7bfae9..92b9b39 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 _0x52ab=['xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','match','util','lodash','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','isUndefined','\x22\x22\x20<>','isActive','Queue','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject2','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','updatedAt','%s%s','XMD-','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','logAgent','responsetime','ringtime','starttime','logLookAgent','membername','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','xcally-motion-preview','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','name','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','dialAnswer','countglobal','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype'];(function(_0x382831,_0x2eabbe){var _0x568f30=function(_0x32a898){while(--_0x32a898){_0x382831['push'](_0x382831['shift']());}};_0x568f30(++_0x2eabbe);}(_0x52ab,0x123));var _0xb52a=function(_0x270b31,_0x234254){_0x270b31=_0x270b31-0x0;var _0x396380=_0x52ab[_0x270b31];return _0x396380;};'use strict';var util=require(_0xb52a('0x0'));var _=require(_0xb52a('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xb52a('0x2'));var ipAgi=process[_0xb52a('0x3')][_0xb52a('0x4')]||'127.0.0.1';function getSeconds(_0x448530,_0xb9ee6f){var _0x35e361=moment(_0x448530)[_0xb52a('0x5')](0x0);var _0x52f19d=moment(_0xb9ee6f)[_0xb52a('0x5')](0x0);return _0x35e361[_0xb52a('0x6')](_0x52f19d,_0xb52a('0x7'));}exports[_0xb52a('0x8')]=function(_0x5a5463){return function(_0x4c188b){logger[_0xb52a('0x9')](_0x5a5463,util[_0xb52a('0xa')](_0x4c188b,{'showHidden':![],'depth':null}));};};exports[_0xb52a('0xb')]=function(_0x5b0263,_0x1f26f9){logger[_0xb52a('0xc')](_0x5b0263,util[_0xb52a('0xa')](_0x1f26f9,{'showHidden':![],'depth':null}));};exports[_0xb52a('0xd')]=function(_0x4f23ab,_0xd69b88){logger['error'](_0x4f23ab,util['inspect'](_0xd69b88,{'showHidden':![],'depth':null}));};exports[_0xb52a('0xe')]=function(_0x5bb5f1){return function(_0x133a4c){logger[_0xb52a('0xc')](_0x5bb5f1,util['inspect'](_0x133a4c,{'showHidden':![],'depth':null}));};};exports[_0xb52a('0xf')]=function(_0x54883a,_0x5ea1da,_0x2e50e7){return{'message':_0x54883a,'unlock':_0x5ea1da,'active':_0x2e50e7};};exports[_0xb52a('0x10')]=function(_0x7ad2b8,_0x1ea181,_0x23c3e7){if(!_['isUndefined'](_0x23c3e7)&&_0xb52a('0x11')===typeof _0x23c3e7&&!_[_0xb52a('0x12')](_0x23c3e7)){if(!_['isUndefined'](_0x1ea181)&&_0xb52a('0x11')===typeof _0x1ea181&&!_['isEmpty'](_0x1ea181)){return util['format'](_0xb52a('0x13'),_0x1ea181,_0x23c3e7);}return util[_0xb52a('0x14')](_0xb52a('0x13'),_0x23c3e7,_0x23c3e7);}if(!_[_0xb52a('0x15')](_0x7ad2b8)&&_0xb52a('0x11')===typeof _0x7ad2b8&&!_[_0xb52a('0x12')](_0x7ad2b8)){return _0x7ad2b8;}return _0xb52a('0x16');};exports[_0xb52a('0x17')]=function(_0x534791){if(_['isNil'](_0x534791)){return![];}return _0x534791;};exports['addVariables']=function(_0x273ea1,_0x2ed620,_0x76e4d4,_0x46385f,_0x48bf78,_0x39e2e1){var _0x29e604={'XMD-QUEUE':_0x2ed620[_0xb52a('0x18')]?_0x2ed620[_0xb52a('0x18')]['name']:'','XMD-CALLERID':_0x46385f,'XMD-CALLERID-PREVIEW':_0x39e2e1?util[_0xb52a('0x14')](_0xb52a('0x13'),_0x39e2e1[_0xb52a('0x19')],_0x39e2e1[_0xb52a('0x1a')]):_0x46385f,'XMD-DIALID':_0x48bf78,'XMD-CONTACTID':_0x2ed620['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x46385f,'XMD-VOICEQUEUEID':_0x2ed620[_0xb52a('0x1b')],'XMD-DIALCHANNEL':_0x76e4d4,'XMD-DIALTIMEOUT':_0x273ea1[_0xb52a('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xb52a('0x14')]('\x22rtTxX%s%s\x22',_0x273ea1['dialQueueProject2']?'g':'',_[_0xb52a('0x12')](_0x273ea1[_0xb52a('0x1d')])?'':_0xb52a('0x1e')),'XMD-DIALURL':_0x273ea1[_0xb52a('0x1f')]||'','XMD-AGI':_0x273ea1['dialQueueProject']?util[_0xb52a('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x273ea1['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x273ea1[_0xb52a('0x20')]?util[_0xb52a('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x273ea1[_0xb52a('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x39e2e1?_0x39e2e1[_0xb52a('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x39e2e1?_0x39e2e1[_0xb52a('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xb52a('0x12')](_0x273ea1[_0xb52a('0x1d')])){_0x29e604[util[_0xb52a('0x14')]('%s',_0xb52a('0x23'))]=_0x273ea1[_0xb52a('0x1d')];_0x29e604[util['format']('%s',_0xb52a('0x24'))]=_0x48bf78;}if(_0x2ed620&&_0x2ed620['Contact']){for(var _0x30dfba in _0x2ed620[_0xb52a('0x25')]){if(_0x2ed620['Contact'][_0xb52a('0x26')](_0x30dfba)){if(!_[_0xb52a('0x27')](_0x2ed620[_0xb52a('0x25')][_0x30dfba])&&_0x30dfba!=='id'&&_0x30dfba!==_0xb52a('0x28')&&_0x30dfba!=='createdAt'&&_0x30dfba!==_0xb52a('0x29')){_0x29e604[util['format'](_0xb52a('0x2a'),_0xb52a('0x2b'),_['toUpper'](_0x30dfba))]=_0x2ed620[_0xb52a('0x25')][_0x30dfba];}}}}return _0x29e604;};exports['toLowerVariables']=function(_0x6b0f23){var _0x3d466f={};for(var _0x3601fe in _0x6b0f23){if(_0x6b0f23[_0xb52a('0x26')](_0x3601fe)){_0x3d466f[util[_0xb52a('0x14')]('%s',_['toLower'](_0x3601fe))]=_0x6b0f23[_0x3601fe];}}return{'variables':_0x3d466f};};exports['updateOriginated']=function(_0x3055f1,_0x184fe5){if(!_['isNil'](_0x3055f1)){if(_0x3055f1[_0xb52a('0x26')](_0xb52a('0x2c'))){if(_0x3055f1[_0xb52a('0x2c')]>0x0){_0x3055f1[_0xb52a('0x2c')]-=0x1;}else{logger[_0xb52a('0x9')](_0xb52a('0x2d'),_0x184fe5);}}}else{logger[_0xb52a('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x184fe5);}};exports[_0xb52a('0x2e')]=function(_0x1b5801){var _0x267fd8=moment()[_0xb52a('0x14')](_0xb52a('0x2f'));_0x1b5801[_0xb52a('0x30')]=0xd;_0x1b5801[_0xb52a('0x31')]='Blacklist';_0x1b5801['starttime']=_0x267fd8;_0x1b5801['responsetime']=_0x267fd8;_0x1b5801[_0xb52a('0x32')]=_0x267fd8;};exports[_0xb52a('0x33')]=function(_0x2021ac,_0xceb31a,_0x319147){var _0x329c2e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2021ac[_0xb52a('0x30')]=_0xceb31a;_0x2021ac[_0xb52a('0x31')]=_0x319147;_0x2021ac[_0xb52a('0x34')]=_0x329c2e;_0x2021ac[_0xb52a('0x35')]=getSeconds(_0x2021ac['responsetime'],_0x2021ac[_0xb52a('0x36')]);};exports[_0xb52a('0x37')]=function(_0xacdc63,_0x4aeed9,_0x36f133){_0xacdc63[_0xb52a('0x38')]=_0x4aeed9;_0xacdc63['UserId']=_0x36f133;};exports[_0xb52a('0x39')]=function(_0x48266e,_0x34eb1d,_0x198b8b){var _0x131b99=moment()[_0xb52a('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x48266e[_0xb52a('0x30')]=_0x34eb1d;_0x48266e[_0xb52a('0x31')]=_0x198b8b;_0x48266e[_0xb52a('0x34')]=_0x48266e[_0xb52a('0x34')]?_0x48266e[_0xb52a('0x34')]:_0x131b99;_0x48266e[_0xb52a('0x32')]=_0x48266e[_0xb52a('0x32')]?_0x48266e[_0xb52a('0x32')]:_0x131b99;_0x48266e[_0xb52a('0x35')]=getSeconds(_0x48266e[_0xb52a('0x34')]||0x0,_0x48266e[_0xb52a('0x36')]||0x0);_0x48266e['talktime']=_0x48266e[_0xb52a('0x3a')]?getSeconds(_0x48266e[_0xb52a('0x32')],_0x48266e[_0xb52a('0x3a')]):0x0;};exports[_0xb52a('0x3b')]=function(_0x2263b8){return _0x2263b8===_0xb52a('0x3c');};exports[_0xb52a('0x3d')]=function(_0x1a1ed2,_0x3d89fb,_0x2323b0,_0x42f6a6,_0xa0d8b9){var _0x5daa0a=_0x42f6a6?_0xb52a('0x3e'):_0x1a1ed2[_0xb52a('0x19')];_0x5daa0a=_0xa0d8b9?_0xb52a('0x3f'):_0x5daa0a;return{'actionid':_0x1a1ed2[_0xb52a('0x40')],'action':_0xb52a('0x41'),'channel':_0x1a1ed2['channelAgent'],'callerid':util[_0xb52a('0x14')](_0xb52a('0x13'),_0x5daa0a,_0x1a1ed2[_0xb52a('0x1a')]),'Exten':_0xb52a('0x42'),'Context':'from-sip','Priority':'1','variable':_0x2323b0,'timeout':(_0x3d89fb[_0xb52a('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a1ed2[_0xb52a('0x40')]};};exports[_0xb52a('0x44')]=function(_0x27466a){return _0x27466a[_0xb52a('0x45')]+_0x27466a['countcongestionretry']+_0x27466a[_0xb52a('0x46')]+_0x27466a[_0xb52a('0x47')]+_0x27466a[_0xb52a('0x48')];};exports['cloneAction']=function(_0x138dd8){var _0x49264e=_['clone'](_0x138dd8);_0x49264e[_0xb52a('0x30')]=0xf;_0x49264e[_0xb52a('0x31')]=_0xb52a('0x49');return _0x49264e;};exports[_0xb52a('0x4a')]=function(_0x200bd7,_0x2b936a,_0x58a28c){var _0x2e4d0c={};_0x2e4d0c[_0x2b936a]=_0x200bd7[_0x2b936a];_0x2e4d0c[_0xb52a('0x4b')]=![];_0x2e4d0c[_0xb52a('0x4c')]=moment()[_0xb52a('0x4d')](_0x58a28c,'minutes')[_0xb52a('0x14')](_0xb52a('0x2f'));_0x2e4d0c['ContactId']=_0x200bd7[_0xb52a('0x4e')];_0x2e4d0c['ListId']=_0x200bd7[_0xb52a('0x4f')];_0x2e4d0c[_0xb52a('0x1b')]=_0x200bd7[_0xb52a('0x1b')]||undefined;return _0x2e4d0c;};exports[_0xb52a('0x50')]=function(_0x4d2956,_0x3d9a9b){if(!_['isNil'](_0x4d2956)){if(_0x4d2956[_0xb52a('0x51')]>0x0){_0x4d2956['pTalking']-=0x1;}else{logger[_0xb52a('0x9')](_0x3d9a9b,_0xb52a('0x52'));}}else{logger[_0xb52a('0x9')](_0x3d9a9b,_0xb52a('0x53'));}};exports[_0xb52a('0x54')]=function(_0x26aa78){if(_0x26aa78<=0x0){return!![];}return![];};exports[_0xb52a('0x55')]=function(_0x455edf,_0x5752b0,_0x189c03){_0x455edf['lastevent']=_0x5752b0;_0x455edf[_0xb52a('0x56')]=_0x455edf[_0xb52a('0x57')];_0x455edf[_0xb52a('0x58')]=_0x455edf[_0xb52a('0x59')];_0x455edf[_0xb52a('0x5a')]=_0xb52a('0x5b');if(_0x189c03){_0x455edf[_0xb52a('0x5c')]=_0x189c03[_0xb52a('0x5c')];}return _0x455edf;};exports[_0xb52a('0x5d')]=function(_0x2effd1){var _0x1b61fa={};_0x1b61fa['queue']=_0x2effd1[_0xb52a('0x57')];_0x1b61fa[_0xb52a('0x58')]=_0x2effd1[_0xb52a('0x59')];_0x1b61fa[_0xb52a('0x40')]=_0x2effd1[_0xb52a('0x40')];return _0x1b61fa;};exports[_0xb52a('0x5e')]=function(_0x2eaaa9){var _0x49f862=[];for(var _0x3a3f72 in _0x2eaaa9){if(_0x2eaaa9[_0xb52a('0x26')](_0x3a3f72)){if(!_['isNil'](_0x2eaaa9[_0x3a3f72])&&_0x2eaaa9[_0x3a3f72][_0xb52a('0x30')]===_0xb52a('0x5f')&&_0x2eaaa9[_0x3a3f72][_0xb52a('0x60')]===_0xb52a('0x61')){_0x49f862[_0xb52a('0x62')](_0x2eaaa9[_0x3a3f72]['id']);}}}return _0x49f862;};exports[_0xb52a('0x63')]=function(_0x3aa2df){var _0x4ed3e7=moment()[_0xb52a('0x5')](0x0);var _0x7b41c2=moment(_0x3aa2df)[_0xb52a('0x5')](0x0);return _0x4ed3e7[_0xb52a('0x6')](_0x7b41c2,_0xb52a('0x7'));};exports[_0xb52a('0x64')]=function(_0x253cc1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x253cc1[_0xb52a('0x4e')],'ListId':_0x253cc1[_0xb52a('0x4f')],'VoiceQueueId':_0x253cc1['VoiceQueueId']||undefined,'CampaignId':_0x253cc1[_0xb52a('0x65')]||undefined};};exports['filterKey']=function(_0x4f5a0a){if(_0x4f5a0a===_0xb52a('0x40')||_0x4f5a0a===_0xb52a('0x66')||_0x4f5a0a===_0xb52a('0x57')||_0x4f5a0a===_0xb52a('0x67')||_0x4f5a0a==='campaigntype'||_0x4f5a0a===_0xb52a('0x68')||_0x4f5a0a===_0xb52a('0x38')||_0x4f5a0a===_0xb52a('0x59')||_0x4f5a0a===_0xb52a('0x19')||_0x4f5a0a===_0xb52a('0x4b')||_0x4f5a0a===_0xb52a('0x1a')||_0x4f5a0a===_0xb52a('0x4c')||_0x4f5a0a===_0xb52a('0x45')||_0x4f5a0a==='countcongestionretry'||_0x4f5a0a===_0xb52a('0x46')||_0x4f5a0a===_0xb52a('0x69')||_0x4f5a0a==='callback'||_0x4f5a0a===_0xb52a('0x6a')||_0x4f5a0a===_0xb52a('0x6b')||_0x4f5a0a===_0xb52a('0x6c')||_0x4f5a0a===_0xb52a('0x4e')||_0x4f5a0a==='ListId'||_0x4f5a0a===_0xb52a('0x6d')||_0x4f5a0a==='VoiceQueueId'||_0x4f5a0a===_0xb52a('0x6e')||_0x4f5a0a===_0xb52a('0x6f')||_0x4f5a0a===_0xb52a('0x70')||_0x4f5a0a==='xmd-phone'||_0x4f5a0a==='xmd-listid'||_0x4f5a0a===_0xb52a('0x71')||_0x4f5a0a===_0xb52a('0x72')||_0x4f5a0a===_0xb52a('0x73')||_0x4f5a0a===_0xb52a('0x74')||_0x4f5a0a===_0xb52a('0x75')||_0x4f5a0a===_0xb52a('0x76')||_0x4f5a0a===_0xb52a('0x77')||_0x4f5a0a===_0xb52a('0x78')||_0x4f5a0a===_0xb52a('0x79')||_0x4f5a0a===_0xb52a('0x7a')||_0x4f5a0a===_0xb52a('0x7b')||_0x4f5a0a===_0xb52a('0x7c')||_0x4f5a0a===_0xb52a('0x7d')||_0x4f5a0a===_0xb52a('0x7e')||_0x4f5a0a==='rtpaudioqosloss'||_0x4f5a0a===_0xb52a('0x7f')||_0x4f5a0a===_0xb52a('0x80')||_0x4f5a0a===_0xb52a('0x81')||_0x4f5a0a==='rtpaudioqos'||_0x4f5a0a===_0xb52a('0x7c')||_0x4f5a0a===_0xb52a('0x7d')||_0x4f5a0a===_0xb52a('0x7e')||_0x4f5a0a===_0xb52a('0x82')||_0x4f5a0a===_0xb52a('0x7f')||_0x4f5a0a==='rtpaudioqosrtt'||_0x4f5a0a===_0xb52a('0x81')||_0x4f5a0a==='bridgepeer'||_0x4f5a0a===_0xb52a('0x83')||_0x4f5a0a==='state'||_0x4f5a0a==='statedesc'){return![];}return!![];};exports[_0xb52a('0x84')]=function(_0x1ee4d0,_0xa39bc4){var _0x57b885,_0x51f9fb,_0x4ed00b;if(_0xa39bc4<=0x0){_0xa39bc4=0x1;}_0x57b885=new RegExp(_0xb52a('0x85')+_0xa39bc4+'}$');_0x51f9fb=Math[_0xb52a('0x86')](0xa,_0xa39bc4-0x1);_0x4ed00b=Math[_0xb52a('0x86')](0xa,_0xa39bc4)-0x1;return util[_0xb52a('0x14')]('%s',_['replace'](_0x1ee4d0,_0x57b885,_[_0xb52a('0x87')](_0x51f9fb,_0x4ed00b)));};exports['extractCalleridName']=function(_0x4ae8ac){var _0x203f5b=_0x4ae8ac[_0xb52a('0x88')](/"(.*?)"/);return _0x203f5b?_0x203f5b[0x1]:_0x4ae8ac;};exports['extractCalleridNumber']=function(_0x4d9741){var _0x20c6c6=_0x4d9741[_0xb52a('0x88')](/<(.*?)>/);return _0x20c6c6?_0x20c6c6[0x1]:_0x4d9741;}; \ No newline at end of file +var _0xc402=['interface','motionChannel','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countbusyretry','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','starttime','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue'];(function(_0xb786a3,_0xeff0be){var _0x19f0e0=function(_0x580af7){while(--_0x580af7){_0xb786a3['push'](_0xb786a3['shift']());}};_0x19f0e0(++_0xeff0be);}(_0xc402,0xc5));var _0x2c40=function(_0x55d061,_0x5ab6ed){_0x55d061=_0x55d061-0x0;var _0x5728cd=_0xc402[_0x55d061];return _0x5728cd;};'use strict';var util=require(_0x2c40('0x0'));var _=require(_0x2c40('0x1'));var moment=require('moment');var logger=require(_0x2c40('0x2'))(_0x2c40('0x3'));var ipAgi=process[_0x2c40('0x4')][_0x2c40('0x5')]||_0x2c40('0x6');function getSeconds(_0x38e6ea,_0x592da7){var _0x21b7a6=moment(_0x38e6ea)[_0x2c40('0x7')](0x0);var _0x3e081c=moment(_0x592da7)[_0x2c40('0x7')](0x0);return _0x21b7a6[_0x2c40('0x8')](_0x3e081c,'seconds');}exports[_0x2c40('0x9')]=function(_0x2ed345){return function(_0x32cccb){logger[_0x2c40('0xa')](_0x2ed345,util[_0x2c40('0xb')](_0x32cccb,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2ecefc,_0x7c2a94){logger[_0x2c40('0xc')](_0x2ecefc,util[_0x2c40('0xb')](_0x7c2a94,{'showHidden':![],'depth':null}));};exports[_0x2c40('0xd')]=function(_0x215063,_0xb9b4fd){logger[_0x2c40('0xa')](_0x215063,util[_0x2c40('0xb')](_0xb9b4fd,{'showHidden':![],'depth':null}));};exports[_0x2c40('0xe')]=function(_0x401b31){return function(_0x1d8159){logger[_0x2c40('0xc')](_0x401b31,util[_0x2c40('0xb')](_0x1d8159,{'showHidden':![],'depth':null}));};};exports[_0x2c40('0xf')]=function(_0x3c782b,_0x5a0714,_0x1f657d){return{'message':_0x3c782b,'unlock':_0x5a0714,'active':_0x1f657d};};exports[_0x2c40('0x10')]=function(_0x1060dc,_0x55844d,_0x3412a6){if(!_[_0x2c40('0x11')](_0x3412a6)&&_0x2c40('0x12')===typeof _0x3412a6&&!_[_0x2c40('0x13')](_0x3412a6)){if(!_['isUndefined'](_0x55844d)&&_0x2c40('0x12')===typeof _0x55844d&&!_[_0x2c40('0x13')](_0x55844d)){return util[_0x2c40('0x14')](_0x2c40('0x15'),_0x55844d,_0x3412a6);}return util['format'](_0x2c40('0x15'),_0x3412a6,_0x3412a6);}if(!_['isUndefined'](_0x1060dc)&&_0x2c40('0x12')===typeof _0x1060dc&&!_[_0x2c40('0x13')](_0x1060dc)){return _0x1060dc;}return _0x2c40('0x16');};exports['isActive']=function(_0x5823f0){if(_[_0x2c40('0x17')](_0x5823f0)){return![];}return _0x5823f0;};exports['addVariables']=function(_0x5bb09f,_0x512dab,_0xe9242f,_0x184e99,_0x52c2ed,_0x5cc859){var _0x81454d={'XMD-QUEUE':_0x512dab[_0x2c40('0x18')]?_0x512dab['Queue'][_0x2c40('0x19')]:'','XMD-CALLERID':_0x184e99,'XMD-CALLERID-PREVIEW':_0x5cc859?util[_0x2c40('0x14')]('\x22%s\x22\x20<%s>',_0x5cc859[_0x2c40('0x1a')],_0x5cc859[_0x2c40('0x1b')]):_0x184e99,'XMD-DIALID':_0x52c2ed,'XMD-CONTACTID':_0x512dab[_0x2c40('0x1c')],'XMD-CDRTYPE':_0x2c40('0x1d'),'CALLERID(all)':_0x184e99,'XMD-VOICEQUEUEID':_0x512dab[_0x2c40('0x1e')],'XMD-DIALCHANNEL':_0xe9242f,'XMD-DIALTIMEOUT':_0x5bb09f[_0x2c40('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x2c40('0x14')](_0x2c40('0x20'),_0x5bb09f[_0x2c40('0x21')]?'g':'',_[_0x2c40('0x13')](_0x5bb09f['monitor_format'])?'':_0x2c40('0x22')),'XMD-DIALURL':_0x5bb09f[_0x2c40('0x23')]||'','XMD-AGI':_0x5bb09f[_0x2c40('0x24')]?util[_0x2c40('0x14')](_0x2c40('0x25'),ipAgi,_0x5bb09f[_0x2c40('0x24')]):'NONE','XMD-AGIAFTER':_0x5bb09f[_0x2c40('0x21')]?util[_0x2c40('0x14')](_0x2c40('0x25'),ipAgi,_0x5bb09f[_0x2c40('0x21')]):_0x2c40('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x5cc859?_0x5cc859['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5cc859?_0x5cc859[_0x2c40('0x27')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x5bb09f[_0x2c40('0x28')])){_0x81454d[util[_0x2c40('0x14')]('%s',_0x2c40('0x29'))]=_0x5bb09f[_0x2c40('0x28')];_0x81454d[util[_0x2c40('0x14')]('%s',_0x2c40('0x2a'))]=_0x52c2ed;}if(_0x512dab&&_0x512dab[_0x2c40('0x2b')]){for(var _0x2268a3 in _0x512dab[_0x2c40('0x2b')]){if(_0x512dab[_0x2c40('0x2b')][_0x2c40('0x2c')](_0x2268a3)){if(!_[_0x2c40('0x17')](_0x512dab[_0x2c40('0x2b')][_0x2268a3])&&_0x2268a3!=='id'&&_0x2268a3!==_0x2c40('0x2d')&&_0x2268a3!==_0x2c40('0x2e')&&_0x2268a3!==_0x2c40('0x2f')){_0x81454d[util[_0x2c40('0x14')](_0x2c40('0x30'),'XMD-',_[_0x2c40('0x31')](_0x2268a3))]=_0x512dab[_0x2c40('0x2b')][_0x2268a3];}}}}return _0x81454d;};exports[_0x2c40('0x32')]=function(_0xe82aa7){var _0xad8b0f={};for(var _0x4ca17e in _0xe82aa7){if(_0xe82aa7[_0x2c40('0x2c')](_0x4ca17e)){_0xad8b0f[util['format']('%s',_[_0x2c40('0x33')](_0x4ca17e))]=_0xe82aa7[_0x4ca17e];}}return{'variables':_0xad8b0f};};exports[_0x2c40('0x34')]=function(_0x5907e4,_0x4fb0c9){if(!_[_0x2c40('0x17')](_0x5907e4)){if(_0x5907e4[_0x2c40('0x2c')](_0x2c40('0x35'))){if(_0x5907e4[_0x2c40('0x35')]>0x0){_0x5907e4[_0x2c40('0x35')]-=0x1;}else{logger[_0x2c40('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x4fb0c9);}}}else{logger[_0x2c40('0xa')](_0x2c40('0x36'),_0x4fb0c9);}};exports[_0x2c40('0x37')]=function(_0x1f0bd4){var _0x43dfed=moment()[_0x2c40('0x14')](_0x2c40('0x38'));_0x1f0bd4[_0x2c40('0x39')]=0xd;_0x1f0bd4['statedesc']='Blacklist';_0x1f0bd4['starttime']=_0x43dfed;_0x1f0bd4[_0x2c40('0x3a')]=_0x43dfed;_0x1f0bd4[_0x2c40('0x3b')]=_0x43dfed;};exports[_0x2c40('0x3c')]=function(_0x2b5ef2,_0xb23a44,_0x4a78f8){var _0x3d3649=moment()[_0x2c40('0x14')](_0x2c40('0x38'));_0x2b5ef2[_0x2c40('0x39')]=_0xb23a44;_0x2b5ef2[_0x2c40('0x3d')]=_0x4a78f8;_0x2b5ef2[_0x2c40('0x3a')]=_0x3d3649;_0x2b5ef2[_0x2c40('0x3e')]=getSeconds(_0x2b5ef2[_0x2c40('0x3a')],_0x2b5ef2['starttime']);};exports[_0x2c40('0x3f')]=function(_0x2eb03f,_0x1c3e57,_0x46a169){_0x2eb03f[_0x2c40('0x40')]=_0x1c3e57;_0x2eb03f[_0x2c40('0x41')]=_0x46a169;};exports[_0x2c40('0x42')]=function(_0x3eba99,_0x1916dc,_0x40a323){var _0x20ae5f=moment()[_0x2c40('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x3eba99[_0x2c40('0x39')]=_0x1916dc;_0x3eba99[_0x2c40('0x3d')]=_0x40a323;_0x3eba99[_0x2c40('0x3a')]=_0x3eba99['responsetime']?_0x3eba99[_0x2c40('0x3a')]:_0x20ae5f;_0x3eba99[_0x2c40('0x3b')]=_0x3eba99[_0x2c40('0x3b')]?_0x3eba99[_0x2c40('0x3b')]:_0x20ae5f;_0x3eba99['ringtime']=getSeconds(_0x3eba99['responsetime']||0x0,_0x3eba99[_0x2c40('0x43')]||0x0);_0x3eba99[_0x2c40('0x44')]=_0x3eba99['answertime']?getSeconds(_0x3eba99[_0x2c40('0x3b')],_0x3eba99[_0x2c40('0x45')]):0x0;};exports[_0x2c40('0x46')]=function(_0x4a3568){return _0x4a3568==='Failure';};exports['variablesAction']=function(_0x469fe0,_0xaa84fc,_0x4615a4,_0x45ffde,_0x553df8){var _0x5995e0=_0x45ffde?_0x2c40('0x47'):_0x469fe0[_0x2c40('0x1a')];_0x5995e0=_0x553df8?_0x2c40('0x48'):_0x5995e0;return{'actionid':_0x469fe0[_0x2c40('0x49')],'action':_0x2c40('0x4a'),'channel':_0x469fe0[_0x2c40('0x4b')],'callerid':util[_0x2c40('0x14')](_0x2c40('0x15'),_0x5995e0,_0x469fe0[_0x2c40('0x1b')]),'Exten':_0x2c40('0x4c'),'Context':_0x2c40('0x4d'),'Priority':'1','variable':_0x4615a4,'timeout':(_0xaa84fc[_0x2c40('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x469fe0[_0x2c40('0x49')]};};exports[_0x2c40('0x4f')]=function(_0x54ff86){return _0x54ff86['countbusyretry']+_0x54ff86[_0x2c40('0x50')]+_0x54ff86[_0x2c40('0x51')]+_0x54ff86['countagentrejectretry']+_0x54ff86[_0x2c40('0x52')];};exports['cloneAction']=function(_0x22ce98){var _0x550492=_[_0x2c40('0x53')](_0x22ce98);_0x550492['state']=0xf;_0x550492['statedesc']=_0x2c40('0x54');return _0x550492;};exports[_0x2c40('0x55')]=function(_0x115fd2,_0x4e81c2,_0x4a2521){var _0x25a097={};_0x25a097[_0x4e81c2]=_0x115fd2[_0x4e81c2];_0x25a097[_0x2c40('0x56')]=![];_0x25a097[_0x2c40('0x57')]=moment()[_0x2c40('0x58')](_0x4a2521,_0x2c40('0x59'))[_0x2c40('0x14')](_0x2c40('0x38'));_0x25a097[_0x2c40('0x1c')]=_0x115fd2[_0x2c40('0x1c')];_0x25a097[_0x2c40('0x5a')]=_0x115fd2[_0x2c40('0x5a')];_0x25a097[_0x2c40('0x1e')]=_0x115fd2[_0x2c40('0x1e')]||undefined;return _0x25a097;};exports[_0x2c40('0x5b')]=function(_0xe07484,_0x1da867){if(!_[_0x2c40('0x17')](_0xe07484)){if(_0xe07484[_0x2c40('0x5c')]>0x0){_0xe07484[_0x2c40('0x5c')]-=0x1;}else{logger[_0x2c40('0xa')](_0x1da867,_0x2c40('0x5d'));}}else{logger['error'](_0x1da867,_0x2c40('0x5e'));}};exports[_0x2c40('0x5f')]=function(_0x2f3efe){if(_0x2f3efe<=0x0){return!![];}return![];};exports['buildObj']=function(_0x557b01,_0x4c4ac2,_0x59744d){_0x557b01['lastevent']=_0x4c4ac2;_0x557b01[_0x2c40('0x19')]=_0x557b01[_0x2c40('0x60')];_0x557b01[_0x2c40('0x61')]=_0x557b01[_0x2c40('0x4b')];_0x557b01[_0x2c40('0x62')]='voice';if(_0x59744d){_0x557b01[_0x2c40('0x63')]=_0x59744d[_0x2c40('0x63')];}return _0x557b01;};exports[_0x2c40('0x64')]=function(_0x7189e0){var _0x4e8584={};_0x4e8584[_0x2c40('0x60')]=_0x7189e0['queue'];_0x4e8584[_0x2c40('0x61')]=_0x7189e0[_0x2c40('0x4b')];_0x4e8584['uniqueid']=_0x7189e0['uniqueid'];return _0x4e8584;};exports[_0x2c40('0x65')]=function(_0x216db3){var _0x236e9f=[];for(var _0x193212 in _0x216db3){if(_0x216db3['hasOwnProperty'](_0x193212)){if(!_[_0x2c40('0x17')](_0x216db3[_0x193212])&&_0x216db3[_0x193212][_0x2c40('0x39')]===_0x2c40('0x66')&&_0x216db3[_0x193212][_0x2c40('0x67')]===_0x2c40('0x68')){_0x236e9f[_0x2c40('0x69')](_0x216db3[_0x193212]['id']);}}}return _0x236e9f;};exports[_0x2c40('0x6a')]=function(_0x525c0c){var _0x2ebbaf=moment()[_0x2c40('0x7')](0x0);var _0x2ff50b=moment(_0x525c0c)[_0x2c40('0x7')](0x0);return _0x2ebbaf[_0x2c40('0x8')](_0x2ff50b,_0x2c40('0x6b'));};exports['createBody']=function(_0x2e4235){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e4235[_0x2c40('0x1c')],'ListId':_0x2e4235[_0x2c40('0x5a')],'VoiceQueueId':_0x2e4235[_0x2c40('0x1e')]||undefined,'CampaignId':_0x2e4235[_0x2c40('0x6c')]||undefined};};exports[_0x2c40('0x6d')]=function(_0x300ea1){if(_0x300ea1===_0x2c40('0x49')||_0x300ea1===_0x2c40('0x6e')||_0x300ea1===_0x2c40('0x60')||_0x300ea1===_0x2c40('0x6f')||_0x300ea1===_0x2c40('0x70')||_0x300ea1===_0x2c40('0x71')||_0x300ea1===_0x2c40('0x40')||_0x300ea1===_0x2c40('0x4b')||_0x300ea1==='calleridname'||_0x300ea1===_0x2c40('0x56')||_0x300ea1===_0x2c40('0x1b')||_0x300ea1==='scheduledat'||_0x300ea1===_0x2c40('0x72')||_0x300ea1===_0x2c40('0x50')||_0x300ea1===_0x2c40('0x51')||_0x300ea1===_0x2c40('0x73')||_0x300ea1==='callback'||_0x300ea1===_0x2c40('0x74')||_0x300ea1===_0x2c40('0x75')||_0x300ea1===_0x2c40('0x76')||_0x300ea1===_0x2c40('0x1c')||_0x300ea1===_0x2c40('0x5a')||_0x300ea1===_0x2c40('0x41')||_0x300ea1===_0x2c40('0x1e')||_0x300ea1===_0x2c40('0x77')||_0x300ea1===_0x2c40('0x78')||_0x300ea1===_0x2c40('0x79')||_0x300ea1===_0x2c40('0x7a')||_0x300ea1===_0x2c40('0x7b')||_0x300ea1===_0x2c40('0x7c')||_0x300ea1==='xmd-dialtimeout'||_0x300ea1===_0x2c40('0x7d')||_0x300ea1===_0x2c40('0x7e')||_0x300ea1==='xmd-dialchannel'||_0x300ea1===_0x2c40('0x7f')||_0x300ea1===_0x2c40('0x80')||_0x300ea1===_0x2c40('0x81')||_0x300ea1===_0x2c40('0x82')||_0x300ea1===_0x2c40('0x83')||_0x300ea1===_0x2c40('0x84')||_0x300ea1===_0x2c40('0x85')||_0x300ea1==='rtpaudioqosjitter'||_0x300ea1===_0x2c40('0x86')||_0x300ea1===_0x2c40('0x87')||_0x300ea1===_0x2c40('0x88')||_0x300ea1===_0x2c40('0x89')||_0x300ea1===_0x2c40('0x8a')||_0x300ea1==='rtpaudioqos'||_0x300ea1===_0x2c40('0x85')||_0x300ea1===_0x2c40('0x8b')||_0x300ea1===_0x2c40('0x86')||_0x300ea1===_0x2c40('0x87')||_0x300ea1==='rtpaudioqoslossbridged'||_0x300ea1===_0x2c40('0x89')||_0x300ea1===_0x2c40('0x8a')||_0x300ea1==='bridgepeer'||_0x300ea1==='bridgepvtcallid'||_0x300ea1===_0x2c40('0x39')||_0x300ea1===_0x2c40('0x3d')){return![];}return!![];};exports[_0x2c40('0x8c')]=function(_0x45e984,_0xecf2b5){var _0x57b279,_0x40154d,_0x3ca85f;if(_0xecf2b5<=0x0){_0xecf2b5=0x1;}_0x57b279=new RegExp(_0x2c40('0x8d')+_0xecf2b5+'}$');_0x40154d=Math[_0x2c40('0x8e')](0xa,_0xecf2b5-0x1);_0x3ca85f=Math[_0x2c40('0x8e')](0xa,_0xecf2b5)-0x1;return util['format']('%s',_[_0x2c40('0x8f')](_0x45e984,_0x57b279,_[_0x2c40('0x90')](_0x40154d,_0x3ca85f)));};exports['extractCalleridName']=function(_0x510bb3){var _0x481266=_0x510bb3['match'](/"(.*?)"/);return _0x481266?_0x481266[0x1]:_0x510bb3;};exports[_0x2c40('0x91')]=function(_0x4d8616){var _0x441826=_0x4d8616[_0x2c40('0x92')](/<(.*?)>/);return _0x441826?_0x441826[0x1]:_0x4d8616;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2f79d33..29ebf8a 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 _0x081a=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','queuepause','boolean','reload'];(function(_0x41273b,_0x39eaf0){var _0x18c192=function(_0x33c021){while(--_0x33c021){_0x41273b['push'](_0x41273b['shift']());}};_0x18c192(++_0x39eaf0);}(_0x081a,0xeb));var _0xa081=function(_0x4f6ea8,_0x191395){_0x4f6ea8=_0x4f6ea8-0x0;var _0x39f538=_0x081a[_0x4f6ea8];return _0x39f538;};'use strict';exports[_0xa081('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xa081('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xa081('0x1'),'required':!![]}};exports[_0xa081('0x2')]={'interface':{'type':_0xa081('0x1'),'required':!![]},'paused':{'type':_0xa081('0x3')},'reason':{'type':_0xa081('0x1'),'required':![]}};exports[_0xa081('0x4')]={'module':{'type':_0xa081('0x1'),'required':![]}};exports[_0xa081('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa081('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xa081('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xa081('0x1')}};exports[_0xa081('0x7')]={'uniqueid':{'type':_0xa081('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xa081('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xa081('0x1')}}; \ No newline at end of file +var _0x1b21=['number','boolean','queueremove','reload','voicequeuechannel','voicequeuechannelredirect','queueadd','string'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x1b21,0x14e));var _0x11b2=function(_0x45f21d,_0x3e259a){_0x45f21d=_0x45f21d-0x0;var _0x28c45d=_0x1b21[_0x45f21d];return _0x28c45d;};'use strict';exports[_0x11b2('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x11b2('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x11b2('0x2'),'required':![]},'paused':{'type':_0x11b2('0x3'),'required':![]}};exports[_0x11b2('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x11b2('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x11b2('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x11b2('0x1'),'required':![]}};exports[_0x11b2('0x5')]={'module':{'type':_0x11b2('0x1'),'required':![]}};exports[_0x11b2('0x6')]={'uniqueid':{'type':_0x11b2('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x11b2('0x1'),'required':!![]},'filename':{'type':_0x11b2('0x1')},'format':{'type':_0x11b2('0x1')},'mixmonitorid':{'type':_0x11b2('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x11b2('0x1'),'required':!![]}};exports[_0x11b2('0x7')]={'uniqueid':{'type':_0x11b2('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 4770f68..89228be 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 _0x4775=['queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','disposition','duration','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','lodash','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','trunks','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','settings','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','telephones','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueReports','groupBy','uniqueid'];(function(_0x5c1c74,_0x39ea0b){var _0x5667f7=function(_0x3a58eb){while(--_0x3a58eb){_0x5c1c74['push'](_0x5c1c74['shift']());}};_0x5667f7(++_0x39ea0b);}(_0x4775,0x1a2));var _0x5477=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x4775[_0x2fd0f0];return _0x57f71a;};'use strict';var BPromise=require(_0x5477('0x0'));var util=require('util');var _=require(_0x5477('0x1'));var moment=require('moment');var Agent=require(_0x5477('0x2'));var Telephone=require(_0x5477('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x5477('0x4'));var Trigger=require(_0x5477('0x5'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x5477('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x5477('0x7'));var SugarcrmAccount=require(_0x5477('0x8'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x5477('0x9'));var VtigerAccount=require(_0x5477('0xa'));var ServicenowAccount=require(_0x5477('0xb'));var Dynamics365Account=require(_0x5477('0xc'));var FreshsalesAccount=require(_0x5477('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x5477('0xe')]={};this['telephones']={};this[_0x5477('0xf')]={};this[_0x5477('0x10')]={};this['triggers']={};this[_0x5477('0x11')]={};this['templates']={};this[_0x5477('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5477('0x13')]={};this[_0x5477('0x14')]={};this[_0x5477('0x15')]={};this['outboundChannels']={};this['timers']={};this[_0x5477('0x16')]={};this['zendeskAccounts']={};this[_0x5477('0x17')]={};this['sugarcrmAccounts']={};this[_0x5477('0x18')]={};this[_0x5477('0x19')]={};this[_0x5477('0x1a')]={};this[_0x5477('0x1b')]={};this[_0x5477('0x1c')]={};this['dynamics365Accounts']={};this[_0x5477('0x1d')]={};this[_0x5477('0x1e')]={};};function freeIsNotKey(_0x4cee61,_0x4aac08,_0x228f5a){var _0x595fe9=_[_0x5477('0x1f')](_0x4cee61,function(_0x36a9b0,_0xa94ee4){return _0x36a9b0[_0x228f5a];});for(var _0x4b299b in _0x4aac08){if(_0x4aac08[_0x5477('0x20')](_0x4b299b)){if(!_0x595fe9[_0x4b299b]){delete _0x4aac08[_0x4b299b];}}}}function freeIsNotKeySip(_0x5efa3f,_0x141d06){var _0xdc4f02=_['mapKeys'](_0x5efa3f,function(_0x24f36b,_0x34a55){return util[_0x5477('0x21')](_0x5477('0x22'),_0x24f36b[_0x5477('0x23')]);});for(var _0x3bc9e1 in _0x141d06){if(_0x141d06['hasOwnProperty'](_0x3bc9e1)){if(!_0xdc4f02[_0x3bc9e1]){delete _0x141d06[_0x3bc9e1];}}}}function freeIsNotKeyAgent(_0x19938c,_0x9a89ab){var _0x49c07e=_[_0x5477('0x1f')](_0x19938c,function(_0x30b9a3,_0x4ef888){var _0x180a09=_['isNil'](_0x30b9a3['interface'])?util[_0x5477('0x21')]('SIP/%s',_0x30b9a3[_0x5477('0x23')]):_0x30b9a3[_0x5477('0x24')];return _0x180a09;});for(var _0x1d2913 in _0x9a89ab){if(_0x9a89ab[_0x5477('0x20')](_0x1d2913)){if(!_0x49c07e[_0x1d2913]){delete _0x9a89ab[_0x1d2913];}}}}function clearVoiceCallReports(_0x31ce52){_0x31ce52[_0x5477('0x25')]=0x0;_0x31ce52[_0x5477('0x26')]=0x0;_0x31ce52['sumHoldTime']=0x0;_0x31ce52[_0x5477('0x27')]=0x0;_0x31ce52[_0x5477('0x28')]=0x0;}function clearCampaigns(_0x5b1608){if(!_['isEmpty'](_0x5b1608)){for(var _0x2966ee in _0x5b1608){if(_0x5b1608['hasOwnProperty'](_0x2966ee)){_0x5b1608[_0x2966ee][_0x5477('0x29')]=0x0;_0x5b1608[_0x2966ee][_0x5477('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x2994bc){if(!_['isEmpty'](_0x2994bc)){for(var _0x121e70 in _0x2994bc){if(_0x2994bc['hasOwnProperty'](_0x121e70)){_0x2994bc[_0x121e70][_0x5477('0x25')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x26')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x2b')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x2c')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x2d')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x27')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x28')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x2e')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x2f')]=0x0;_0x2994bc[_0x121e70]['outboundBusyCallsDay']=0x0;_0x2994bc[_0x121e70]['outboundCongestionCallsDay']=0x0;_0x2994bc[_0x121e70][_0x5477('0x30')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x31')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x32')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x33')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x34')]=0x0;_0x2994bc[_0x121e70]['outboundOriginateFailureCallsDay']=0x0;_0x2994bc[_0x121e70]['outboundRejectCallsDay']=0x0;_0x2994bc[_0x121e70][_0x5477('0x35')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x2e')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x36')]=0x0;_0x2994bc[_0x121e70][_0x5477('0x37')]=!![];}}}}Realtime[_0x5477('0x38')]['mergeFromDatabase']=function(_0xd2599c,_0x419134){for(var _0x44a22e in _0x419134){if(_0xd2599c[_0x5477('0x20')](_0x44a22e)){_0xd2599c[_0x44a22e]=_0x419134[_0x44a22e];}}};Realtime[_0x5477('0x38')][_0x5477('0x39')]=function(){var _0x13695e=this;return function(_0x4c9001){if(_0x4c9001){freeIsNotKeyAgent(_0x4c9001,_0x13695e[_0x5477('0xe')]);for(var _0x4bb3c3=0x0,_0x3f7ef8={},_0x10816f={};_0x4bb3c3<_0x4c9001[_0x5477('0x3a')];_0x4bb3c3+=0x1){_0x3f7ef8=_0x4c9001[_0x4bb3c3];var _0x4692a1=_['isNil'](_0x3f7ef8[_0x5477('0x24')])?util[_0x5477('0x21')]('SIP/%s',_0x3f7ef8['name']):_0x3f7ef8[_0x5477('0x24')];if(_[_0x5477('0x3b')](_0x13695e[_0x5477('0xe')][_0x4692a1])){_0x13695e[_0x5477('0xe')][_0x4692a1]=new Agent(_0x3f7ef8);}else{_0x13695e[_0x5477('0x3c')](_0x13695e['agents'][_0x4692a1],_0x3f7ef8);}}}return _0x13695e['agents'];};};Realtime[_0x5477('0x38')][_0x5477('0x3d')]=function(){var _0x3d9d9b=this;return function(_0x5425ab){if(_0x5425ab){freeIsNotKeySip(_0x5425ab,_0x3d9d9b[_0x5477('0x3e')]);for(var _0x27852=0x0,_0x263f2a={},_0x139ade={};_0x27852<_0x5425ab[_0x5477('0x3a')];_0x27852+=0x1){_0x263f2a=_0x5425ab[_0x27852];if(_['isUndefined'](_0x3d9d9b['telephones'][util[_0x5477('0x21')](_0x5477('0x22'),_0x263f2a[_0x5477('0x23')])])){_0x3d9d9b[_0x5477('0x3e')][util[_0x5477('0x21')](_0x5477('0x22'),_0x263f2a['name'])]=new Telephone(_0x263f2a);}else{_0x3d9d9b[_0x5477('0x3c')](_0x3d9d9b['telephones'][util[_0x5477('0x21')]('SIP/%s',_0x263f2a[_0x5477('0x23')])],_0x263f2a);}}}return _0x3d9d9b[_0x5477('0x3e')];};};Realtime[_0x5477('0x38')]['initTrunks']=function(){var _0x474d1e=this;return function(_0xce2a24){if(_0xce2a24){freeIsNotKeySip(_0xce2a24,_0x474d1e[_0x5477('0xf')]);for(var _0x4f04e6=0x0,_0x1cc9a5={},_0x378a01={};_0x4f04e6<_0xce2a24[_0x5477('0x3a')];_0x4f04e6+=0x1){_0x1cc9a5=_0xce2a24[_0x4f04e6];if(_[_0x5477('0x3b')](_0x474d1e['trunks'][util[_0x5477('0x21')](_0x5477('0x22'),_0x1cc9a5[_0x5477('0x23')])])){_0x474d1e[_0x5477('0xf')][util[_0x5477('0x21')](_0x5477('0x22'),_0x1cc9a5[_0x5477('0x23')])]=new Trunk(_0x1cc9a5);}else{_0x474d1e[_0x5477('0x3c')](_0x474d1e[_0x5477('0xf')][util[_0x5477('0x21')](_0x5477('0x22'),_0x1cc9a5[_0x5477('0x23')])],_0x1cc9a5);}}}return _0x474d1e[_0x5477('0xf')];};};Realtime[_0x5477('0x38')][_0x5477('0x3f')]=function(){var _0x6c19f1=this;return function(_0x38e4dd){if(_0x38e4dd){freeIsNotKey(_0x38e4dd,_0x6c19f1[_0x5477('0x10')],_0x5477('0x23'));for(var _0x1423a5=0x0,_0x433491={},_0x132dc1={};_0x1423a5<_0x38e4dd[_0x5477('0x3a')];_0x1423a5+=0x1){_0x433491=_0x38e4dd[_0x1423a5];if(_[_0x5477('0x3b')](_0x6c19f1['voiceQueues'][_0x433491[_0x5477('0x23')]])){_0x6c19f1[_0x5477('0x10')][_0x433491['name']]=new VoiceQueue(_0x433491);}else{_0x6c19f1[_0x5477('0x3c')](_0x6c19f1[_0x5477('0x10')][_0x433491[_0x5477('0x23')]],_0x433491);}}}return _0x6c19f1[_0x5477('0x10')];};};Realtime['prototype'][_0x5477('0x40')]=function(){var _0x4de2f4=this;return function(_0x4d1084){if(_0x4d1084){freeIsNotKey(_0x4d1084,_0x4de2f4[_0x5477('0x41')],'id');for(var _0x1afc2b=0x0,_0x40d0c8={},_0x57f0fd={};_0x1afc2b<_0x4d1084[_0x5477('0x3a')];_0x1afc2b+=0x1){_0x40d0c8=_0x4d1084[_0x1afc2b];if(_[_0x5477('0x3b')](_0x4de2f4[_0x5477('0x41')][_0x40d0c8['id']])){_0x4de2f4[_0x5477('0x41')][_0x40d0c8['id']]=new Trigger(_0x40d0c8);}else{_0x4de2f4[_0x5477('0x3c')](_0x4de2f4['triggers'][_0x40d0c8['id']],_0x40d0c8);}}}return _0x4de2f4['triggers'];};};Realtime[_0x5477('0x38')][_0x5477('0x42')]=function(){var _0x2bdedc=this;return function(_0xb61d2f){if(_0xb61d2f){freeIsNotKey(_0xb61d2f,_0x2bdedc[_0x5477('0x43')],'id');for(var _0x287c7b=0x0,_0x4617e2={},_0x319c8e={};_0x287c7b<_0xb61d2f[_0x5477('0x3a')];_0x287c7b+=0x1){_0x4617e2=_0xb61d2f[_0x287c7b];if(_[_0x5477('0x3b')](_0x2bdedc[_0x5477('0x43')][_0x4617e2['id']])){_0x2bdedc['templates'][_0x4617e2['id']]=new Template(_0x4617e2);}else{_0x2bdedc[_0x5477('0x3c')](_0x2bdedc[_0x5477('0x43')][_0x4617e2['id']],_0x4617e2);}}}return _0x2bdedc[_0x5477('0x43')];};};Realtime['prototype'][_0x5477('0x44')]=function(){var _0x3d57ea=this;return function(_0x17f7f8){if(_0x17f7f8){freeIsNotKey(_0x17f7f8,_0x3d57ea[_0x5477('0x45')],'id');for(var _0x37dec1=0x0,_0x534106={},_0x59de6e={};_0x37dec1<_0x17f7f8[_0x5477('0x3a')];_0x37dec1+=0x1){_0x534106=_0x17f7f8[_0x37dec1];if(_[_0x5477('0x3b')](_0x3d57ea['zendeskAccounts'][_0x534106['id']])){_0x3d57ea[_0x5477('0x45')][_0x534106['id']]=new ZendeskAccount(_0x534106);}else{_0x3d57ea['mergeFromDatabase'](_0x3d57ea[_0x5477('0x45')][_0x534106['id']],_0x534106);}}}return _0x3d57ea[_0x5477('0x45')];};};Realtime[_0x5477('0x38')]['initSalesforceAccounts']=function(){var _0x399f18=this;return function(_0x56ddde){if(_0x56ddde){freeIsNotKey(_0x56ddde,_0x399f18['salesforceAccounts'],'id');for(var _0x4062d5=0x0,_0xc220fb={},_0x5cd3b2={};_0x4062d5<_0x56ddde[_0x5477('0x3a')];_0x4062d5+=0x1){_0xc220fb=_0x56ddde[_0x4062d5];if(_[_0x5477('0x3b')](_0x399f18['salesforceAccounts'][_0xc220fb['id']])){_0x399f18[_0x5477('0x17')][_0xc220fb['id']]=new SalesforceAccount(_0xc220fb);}else{_0x399f18[_0x5477('0x3c')](_0x399f18['salesforceAccounts'][_0xc220fb['id']],_0xc220fb);}}}return _0x399f18[_0x5477('0x17')];};};Realtime[_0x5477('0x38')][_0x5477('0x46')]=function(){var _0x44f088=this;return function(_0x418e1c){if(_0x418e1c){freeIsNotKey(_0x418e1c,_0x44f088[_0x5477('0x18')],'id');for(var _0xe37114=0x0,_0x476ad2={},_0x308c32={};_0xe37114<_0x418e1c['length'];_0xe37114+=0x1){_0x476ad2=_0x418e1c[_0xe37114];if(_['isUndefined'](_0x44f088['freshdeskAccounts'][_0x476ad2['id']])){_0x44f088[_0x5477('0x18')][_0x476ad2['id']]=new FreshdeskAccount(_0x476ad2);}else{_0x44f088['mergeFromDatabase'](_0x44f088[_0x5477('0x18')][_0x476ad2['id']],_0x476ad2);}}}return _0x44f088['freshdeskAccounts'];};};Realtime[_0x5477('0x38')]['initZohoAccounts']=function(){var _0x2e0441=this;return function(_0x35dade){if(_0x35dade){freeIsNotKey(_0x35dade,_0x2e0441[_0x5477('0x19')],'id');for(var _0x5c4eed=0x0,_0x56a9ca={},_0xc3e8ee={};_0x5c4eed<_0x35dade['length'];_0x5c4eed+=0x1){_0x56a9ca=_0x35dade[_0x5c4eed];if(_[_0x5477('0x3b')](_0x2e0441[_0x5477('0x19')][_0x56a9ca['id']])){_0x2e0441[_0x5477('0x19')][_0x56a9ca['id']]=new ZohoAccount(_0x56a9ca);}else{_0x2e0441[_0x5477('0x3c')](_0x2e0441[_0x5477('0x19')][_0x56a9ca['id']],_0x56a9ca);}}}return _0x2e0441['zohoAccounts'];};};Realtime[_0x5477('0x38')][_0x5477('0x47')]=function(){var _0x2bf254=this;return function(_0x522bdd){if(_0x522bdd){freeIsNotKey(_0x522bdd,_0x2bf254[_0x5477('0x1a')],'id');for(var _0x491775=0x0,_0x339324={},_0x3506c0={};_0x491775<_0x522bdd['length'];_0x491775+=0x1){_0x339324=_0x522bdd[_0x491775];if(_[_0x5477('0x3b')](_0x2bf254[_0x5477('0x1a')][_0x339324['id']])){_0x2bf254[_0x5477('0x1a')][_0x339324['id']]=new DeskAccount(_0x339324);}else{_0x2bf254[_0x5477('0x3c')](_0x2bf254[_0x5477('0x1a')][_0x339324['id']],_0x339324);}}}return _0x2bf254[_0x5477('0x1a')];};};Realtime[_0x5477('0x38')][_0x5477('0x48')]=function(){var _0x298870=this;return function(_0x4b77c3){if(_0x4b77c3){freeIsNotKey(_0x4b77c3,_0x298870[_0x5477('0x49')],'id');for(var _0x6972bd=0x0,_0x363411={},_0x1dbae4={};_0x6972bd<_0x4b77c3[_0x5477('0x3a')];_0x6972bd+=0x1){_0x363411=_0x4b77c3[_0x6972bd];if(_['isUndefined'](_0x298870[_0x5477('0x49')][_0x363411['id']])){_0x298870['sugarcrmAccounts'][_0x363411['id']]=new SugarcrmAccount(_0x363411);}else{_0x298870[_0x5477('0x3c')](_0x298870['sugarcrmAccounts'][_0x363411['id']],_0x363411);}}}return _0x298870[_0x5477('0x49')];};};Realtime[_0x5477('0x38')][_0x5477('0x4a')]=function(){var _0x446d2d=this;return function(_0x557dcc){if(_0x557dcc){freeIsNotKey(_0x557dcc,_0x446d2d[_0x5477('0x1b')],'id');for(var _0x4567f2=0x0,_0x4b503b={},_0x454105={};_0x4567f2<_0x557dcc['length'];_0x4567f2+=0x1){_0x4b503b=_0x557dcc[_0x4567f2];if(_[_0x5477('0x3b')](_0x446d2d['vtigerAccounts'][_0x4b503b['id']])){_0x446d2d[_0x5477('0x1b')][_0x4b503b['id']]=new VtigerAccount(_0x4b503b);}else{_0x446d2d['mergeFromDatabase'](_0x446d2d[_0x5477('0x1b')][_0x4b503b['id']],_0x4b503b);}}}return _0x446d2d[_0x5477('0x1b')];};};Realtime['prototype'][_0x5477('0x4b')]=function(){var _0x27583b=this;return function(_0x1d467d){if(_0x1d467d){freeIsNotKey(_0x1d467d,_0x27583b[_0x5477('0x1c')],'id');for(var _0x2951ef=0x0,_0x1d12ec={},_0x102c8a={};_0x2951ef<_0x1d467d[_0x5477('0x3a')];_0x2951ef+=0x1){_0x1d12ec=_0x1d467d[_0x2951ef];if(_[_0x5477('0x3b')](_0x27583b[_0x5477('0x1c')][_0x1d12ec['id']])){_0x27583b['servicenowAccounts'][_0x1d12ec['id']]=new ServicenowAccount(_0x1d12ec);}else{_0x27583b[_0x5477('0x3c')](_0x27583b[_0x5477('0x1c')][_0x1d12ec['id']],_0x1d12ec);}}}return _0x27583b['servicenowAccounts'];};};Realtime[_0x5477('0x38')][_0x5477('0x4c')]=function(){var _0x1a105a=this;return function(_0xd91343){if(_0xd91343){freeIsNotKey(_0xd91343,_0x1a105a[_0x5477('0x4d')],'id');for(var _0x3e762a=0x0,_0x437d94={},_0x1a5c1d={};_0x3e762a<_0xd91343['length'];_0x3e762a+=0x1){_0x437d94=_0xd91343[_0x3e762a];if(_[_0x5477('0x3b')](_0x1a105a[_0x5477('0x4d')][_0x437d94['id']])){_0x1a105a[_0x5477('0x4d')][_0x437d94['id']]=new Dynamics365Account(_0x437d94);}else{_0x1a105a['mergeFromDatabase'](_0x1a105a[_0x5477('0x4d')][_0x437d94['id']],_0x437d94);}}}return _0x1a105a[_0x5477('0x4d')];};};Realtime[_0x5477('0x38')][_0x5477('0x4e')]=function(){var _0x586dfe=this;return function(_0x5db241){if(_0x5db241){freeIsNotKey(_0x5db241,_0x586dfe[_0x5477('0x1d')],'id');for(var _0x577ea2=0x0,_0x390346={},_0x23a8e9={};_0x577ea2<_0x5db241[_0x5477('0x3a')];_0x577ea2+=0x1){_0x390346=_0x5db241[_0x577ea2];if(_[_0x5477('0x3b')](_0x586dfe[_0x5477('0x1d')][_0x390346['id']])){_0x586dfe[_0x5477('0x1d')][_0x390346['id']]=new FreshsalesAccount(_0x390346);}else{_0x586dfe[_0x5477('0x3c')](_0x586dfe['freshsalesAccounts'][_0x390346['id']],_0x390346);}}}return _0x586dfe[_0x5477('0x1d')];};};Realtime[_0x5477('0x38')]['initVoiceQueueHopperHistory']=function(){var _0x584fe7=this;return function(_0x1719ab){for(var _0x872c5d=0x0;_0x872c5d<_0x1719ab['length'];_0x872c5d+=0x1){_['merge'](_0x584fe7[_0x5477('0x10')][_0x1719ab[_0x872c5d][_0x5477('0x23')]],_0x1719ab[_0x872c5d]);}return _0x584fe7['voiceQueues'];};};Realtime['prototype'][_0x5477('0x4f')]=function(){var _0x37550a=this;return function(_0x2d8620){clearVoiceQueues(_0x37550a[_0x5477('0x10')]);if(_0x2d8620){_0x2d8620=_[_0x5477('0x50')](_0x2d8620,_0x5477('0x51'));for(var _0x5e18e4 in _0x2d8620){if(_0x2d8620['hasOwnProperty'](_0x5e18e4)){var _0x16907d={};for(var _0x4826e0=0x0;_0x4826e0<_0x2d8620[_0x5e18e4]['length'];_0x4826e0+=0x1){var _0x3e6c0f=_0x2d8620[_0x5e18e4][_0x4826e0]['queue'];if(_0x37550a[_0x5477('0x10')][_0x3e6c0f]){if(_0x2d8620[_0x5e18e4][_0x4826e0][_0x5477('0x52')]){_0x37550a[_0x5477('0x10')][_0x3e6c0f]['unmanaged']+=0x1;}if(_0x2d8620[_0x5e18e4][_0x4826e0][_0x5477('0x53')]){_0x37550a['voiceQueues'][_0x3e6c0f]['abandoned']+=0x1;}_0x37550a[_0x5477('0x10')][_0x3e6c0f]['sumHoldTime']+=moment(_0x2d8620[_0x5e18e4][_0x4826e0]['queuecallerleaveAt'])[_0x5477('0x54')](moment(_0x2d8620[_0x5e18e4][_0x4826e0][_0x5477('0x55')]),_0x5477('0x56'))||0x0;if(_0x4826e0===_0x2d8620[_0x5e18e4]['length']-0x1){_0x37550a[_0x5477('0x10')][_0x3e6c0f][_0x5477('0x27')]+=moment(_0x2d8620[_0x5e18e4][_0x4826e0]['queuecallercompleteAt']||_0x2d8620[_0x5e18e4][_0x4826e0]['queuecallerabandonAt']||_0x2d8620[_0x5e18e4][_0x4826e0][_0x5477('0x57')])[_0x5477('0x54')](moment(_0x2d8620[_0x5e18e4][_0x4826e0]['queuecallerjoinAt']),_0x5477('0x56'))||0x0;_0x37550a[_0x5477('0x10')][_0x3e6c0f][_0x5477('0x25')]+=0x1;if(_0x2d8620[_0x5e18e4][_0x4826e0][_0x5477('0x58')]){_0x37550a[_0x5477('0x10')][_0x3e6c0f][_0x5477('0x26')]+=0x1;_0x37550a[_0x5477('0x10')][_0x3e6c0f][_0x5477('0x28')]+=moment(_0x2d8620[_0x5e18e4][_0x4826e0]['queuecallercompleteAt'])[_0x5477('0x54')](moment(_0x2d8620[_0x5e18e4][_0x4826e0][_0x5477('0x59')]),_0x5477('0x56'))||0x0;}}else{_0x37550a[_0x5477('0x10')][_0x3e6c0f][_0x5477('0x27')]+=_0x37550a['voiceQueues'][_0x3e6c0f][_0x5477('0x2d')]||0x0;}}}}}}return _0x37550a[_0x5477('0x10')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x5a01d0=this;return function(_0x314348){clearVoiceCallReports(_0x5a01d0[_0x5477('0x12')]);if(_0x314348){for(var _0x2012fb=0x0;_0x2012fb<_0x314348['length'];_0x2012fb+=0x1){_0x5a01d0[_0x5477('0x12')][_0x5477('0x25')]+=0x1;_0x5a01d0[_0x5477('0x12')][_0x5477('0x27')]+=_0x314348[_0x2012fb]['duration'];if(_0x314348[_0x2012fb][_0x5477('0x5a')]==='ANSWERED'){_0x5a01d0[_0x5477('0x12')]['answered']+=0x1;_0x5a01d0[_0x5477('0x12')]['sumHoldTime']+=_0x314348[_0x2012fb][_0x5477('0x5b')]-_0x314348[_0x2012fb][_0x5477('0x5c')]||0x0;_0x5a01d0[_0x5477('0x12')][_0x5477('0x28')]+=_0x314348[_0x2012fb][_0x5477('0x5c')];}}}return _0x5a01d0[_0x5477('0x12')];};};Realtime[_0x5477('0x38')][_0x5477('0x5d')]=function(){var _0x4fabee=this;return function(_0x891e6b){if(_0x891e6b){freeIsNotKey(_0x891e6b,_0x4fabee[_0x5477('0x11')],_0x5477('0x23'));for(var _0xd590ba=0x0,_0x4ea226={};_0xd590ba<_0x891e6b['length'];_0xd590ba+=0x1){_0x4ea226=_0x891e6b[_0xd590ba];if(_[_0x5477('0x3b')](_0x4fabee[_0x5477('0x11')][_0x4ea226[_0x5477('0x23')]])){_0x4fabee['campaigns'][_0x4ea226[_0x5477('0x23')]]=new Campaign(_0x4ea226);}else{_0x4fabee[_0x5477('0x3c')](_0x4fabee[_0x5477('0x11')][_0x4ea226[_0x5477('0x23')]],_0x4ea226);_0x4fabee[_0x5477('0x11')][_0x4ea226[_0x5477('0x23')]]['dialQueueProject']=_0x4ea226[_0x5477('0x5e')]?_0x4ea226['SquareProject'][_0x5477('0x23')]:undefined;}}}return _0x4fabee[_0x5477('0x11')];};};Realtime['prototype'][_0x5477('0x5f')]=function(){var _0x28f8e4=this;return function(_0x20df9d){if(_0x20df9d){freeIsNotKey(_0x20df9d,_0x28f8e4[_0x5477('0x13')],'id');for(var _0x569c61=0x0,_0x1e79f4={};_0x569c61<_0x20df9d[_0x5477('0x3a')];_0x569c61+=0x1){_0x1e79f4=_0x20df9d[_0x569c61];if(_[_0x5477('0x3b')](_0x28f8e4[_0x5477('0x13')][_0x1e79f4['id']])){_0x28f8e4['voiceExtensions'][_0x1e79f4['id']]=new VoiceExtension(_0x1e79f4);}else{_0x28f8e4[_0x5477('0x3c')](_0x28f8e4[_0x5477('0x13')][_0x1e79f4['id']],_0x1e79f4);}}}return _0x28f8e4['voiceExtensions'];};};Realtime[_0x5477('0x38')][_0x5477('0x60')]=function(){var _0x29913a=this;return function(_0x2cbfec){clearCampaigns(_0x29913a[_0x5477('0x11')]);for(var _0x5b40a8=0x0;_0x5b40a8<_0x2cbfec[_0x5477('0x3a')];_0x5b40a8+=0x1){_[_0x5477('0x61')](_0x29913a[_0x5477('0x11')][_0x2cbfec[_0x5b40a8][_0x5477('0x23')]],_0x2cbfec[_0x5b40a8]);}return _0x29913a[_0x5477('0x11')];};};Realtime[_0x5477('0x38')][_0x5477('0x62')]=function(){var _0x317413=this;return function(_0x460f7a){if(_0x460f7a){freeIsNotKey(_0x460f7a,_0x317413[_0x5477('0x1e')],'id');for(var _0x37fa48=0x0,_0x5a730e={},_0x57d498={};_0x37fa48<_0x460f7a['length'];_0x37fa48+=0x1){_0x5a730e=_0x460f7a[_0x37fa48];if(_[_0x5477('0x3b')](_0x317413[_0x5477('0x1e')][_0x5a730e['id']])){_0x317413[_0x5477('0x1e')][_0x5a730e['id']]=new FaxAccount(_0x5a730e);}else{_0x317413[_0x5477('0x3c')](_0x317413[_0x5477('0x1e')][_0x5a730e['id']],_0x5a730e);}}}return _0x317413[_0x5477('0x1e')];};};module[_0x5477('0x63')]=Realtime; \ No newline at end of file +var _0xba5d=['dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumBillable','ivrAnswerCallsDay','abandoned','sumHoldTime','sumDuration','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','agents','length','isUndefined','mergeFromDatabase','initTelephones','trunks','voiceQueues','initTriggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/faxAccount','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x519eb8,_0x1148f9){var _0x138ad2=function(_0x278c90){while(--_0x278c90){_0x519eb8['push'](_0x519eb8['shift']());}};_0x138ad2(++_0x1148f9);}(_0xba5d,0x127));var _0xdba5=function(_0x2eaff4,_0x4852b7){_0x2eaff4=_0x2eaff4-0x0;var _0x278c7a=_0xba5d[_0x2eaff4];return _0x278c7a;};'use strict';var BPromise=require(_0xdba5('0x0'));var util=require(_0xdba5('0x1'));var _=require(_0xdba5('0x2'));var moment=require(_0xdba5('0x3'));var Agent=require(_0xdba5('0x4'));var Telephone=require(_0xdba5('0x5'));var Trunk=require(_0xdba5('0x6'));var VoiceQueue=require(_0xdba5('0x7'));var Trigger=require(_0xdba5('0x8'));var Template=require('../model/template');var Campaign=require(_0xdba5('0x9'));var VoiceExtension=require(_0xdba5('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xdba5('0xb'));var FreshdeskAccount=require(_0xdba5('0xc'));var SugarcrmAccount=require(_0xdba5('0xd'));var ZohoAccount=require(_0xdba5('0xe'));var DeskAccount=require(_0xdba5('0xf'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xdba5('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xdba5('0x11'));var Realtime=function(){this['agents']={};this[_0xdba5('0x12')]={};this['trunks']={};this['voiceQueues']={};this[_0xdba5('0x13')]={};this[_0xdba5('0x14')]={};this[_0xdba5('0x15')]={};this[_0xdba5('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdba5('0x17')]={};this[_0xdba5('0x18')]={};this[_0xdba5('0x19')]={};this['outboundChannels']={};this[_0xdba5('0x1a')]={};this[_0xdba5('0x1b')]={};this[_0xdba5('0x1c')]={};this[_0xdba5('0x1d')]={};this[_0xdba5('0x1e')]={};this[_0xdba5('0x1f')]={};this[_0xdba5('0x20')]={};this[_0xdba5('0x21')]={};this[_0xdba5('0x22')]={};this['servicenowAccounts']={};this[_0xdba5('0x23')]={};this[_0xdba5('0x24')]={};this['faxAccounts']={};};function freeIsNotKey(_0x119b73,_0x3c2fb7,_0x69fe93){var _0x43d0b4=_[_0xdba5('0x25')](_0x119b73,function(_0x6fc27f,_0x53a912){return _0x6fc27f[_0x69fe93];});for(var _0x485a1d in _0x3c2fb7){if(_0x3c2fb7[_0xdba5('0x26')](_0x485a1d)){if(!_0x43d0b4[_0x485a1d]){delete _0x3c2fb7[_0x485a1d];}}}}function freeIsNotKeySip(_0x703061,_0x59b6d8){var _0x20fe86=_[_0xdba5('0x25')](_0x703061,function(_0x4af272,_0x5a620b){return util[_0xdba5('0x27')](_0xdba5('0x28'),_0x4af272[_0xdba5('0x29')]);});for(var _0x186178 in _0x59b6d8){if(_0x59b6d8['hasOwnProperty'](_0x186178)){if(!_0x20fe86[_0x186178]){delete _0x59b6d8[_0x186178];}}}}function freeIsNotKeyAgent(_0x4ee3ad,_0x3d0562){var _0x34d6b6=_['mapKeys'](_0x4ee3ad,function(_0x3e9b1a,_0x10bbaf){var _0x31fb1f=_[_0xdba5('0x2a')](_0x3e9b1a['interface'])?util[_0xdba5('0x27')](_0xdba5('0x28'),_0x3e9b1a['name']):_0x3e9b1a[_0xdba5('0x2b')];return _0x31fb1f;});for(var _0x469437 in _0x3d0562){if(_0x3d0562[_0xdba5('0x26')](_0x469437)){if(!_0x34d6b6[_0x469437]){delete _0x3d0562[_0x469437];}}}}function clearVoiceCallReports(_0x2617a1){_0x2617a1[_0xdba5('0x2c')]=0x0;_0x2617a1[_0xdba5('0x2d')]=0x0;_0x2617a1['sumHoldTime']=0x0;_0x2617a1['sumDuration']=0x0;_0x2617a1[_0xdba5('0x2e')]=0x0;}function clearCampaigns(_0x288c27){if(!_['isEmpty'](_0x288c27)){for(var _0x240a29 in _0x288c27){if(_0x288c27[_0xdba5('0x26')](_0x240a29)){_0x288c27[_0x240a29]['ivrTotalCallsDays']=0x0;_0x288c27[_0x240a29][_0xdba5('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x4cf88d){if(!_['isEmpty'](_0x4cf88d)){for(var _0x16a064 in _0x4cf88d){if(_0x4cf88d[_0xdba5('0x26')](_0x16a064)){_0x4cf88d[_0x16a064][_0xdba5('0x2c')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x2d')]=0x0;_0x4cf88d[_0x16a064]['unmanaged']=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x30')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x31')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x32')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x2e')]=0x0;_0x4cf88d[_0x16a064]['outboundAnswerAgiCallsDay']=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x33')]=0x0;_0x4cf88d[_0x16a064]['outboundBusyCallsDay']=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x34')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x35')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x36')]=0x0;_0x4cf88d[_0x16a064]['outboundDropCallsDayTimeout']=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x37')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x38')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x39')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x3a')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x3b')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x3c')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x3d')]=0x0;_0x4cf88d[_0x16a064][_0xdba5('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0xc801e2,_0x336dff){for(var _0x498a01 in _0x336dff){if(_0xc801e2['hasOwnProperty'](_0x498a01)){_0xc801e2[_0x498a01]=_0x336dff[_0x498a01];}}};Realtime[_0xdba5('0x3f')]['initAgents']=function(){var _0x40f529=this;return function(_0xb04b67){if(_0xb04b67){freeIsNotKeyAgent(_0xb04b67,_0x40f529[_0xdba5('0x40')]);for(var _0x295def=0x0,_0x367512={},_0x4a21d8={};_0x295def<_0xb04b67[_0xdba5('0x41')];_0x295def+=0x1){_0x367512=_0xb04b67[_0x295def];var _0x1b7096=_['isNil'](_0x367512['interface'])?util['format']('SIP/%s',_0x367512[_0xdba5('0x29')]):_0x367512[_0xdba5('0x2b')];if(_[_0xdba5('0x42')](_0x40f529['agents'][_0x1b7096])){_0x40f529[_0xdba5('0x40')][_0x1b7096]=new Agent(_0x367512);}else{_0x40f529[_0xdba5('0x43')](_0x40f529[_0xdba5('0x40')][_0x1b7096],_0x367512);}}}return _0x40f529[_0xdba5('0x40')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x44')]=function(){var _0x586e3d=this;return function(_0x30e94c){if(_0x30e94c){freeIsNotKeySip(_0x30e94c,_0x586e3d[_0xdba5('0x12')]);for(var _0x5a8589=0x0,_0x59ddfb={},_0x53c321={};_0x5a8589<_0x30e94c['length'];_0x5a8589+=0x1){_0x59ddfb=_0x30e94c[_0x5a8589];if(_[_0xdba5('0x42')](_0x586e3d[_0xdba5('0x12')][util[_0xdba5('0x27')]('SIP/%s',_0x59ddfb[_0xdba5('0x29')])])){_0x586e3d[_0xdba5('0x12')][util[_0xdba5('0x27')](_0xdba5('0x28'),_0x59ddfb['name'])]=new Telephone(_0x59ddfb);}else{_0x586e3d['mergeFromDatabase'](_0x586e3d[_0xdba5('0x12')][util[_0xdba5('0x27')](_0xdba5('0x28'),_0x59ddfb[_0xdba5('0x29')])],_0x59ddfb);}}}return _0x586e3d[_0xdba5('0x12')];};};Realtime[_0xdba5('0x3f')]['initTrunks']=function(){var _0x91b7be=this;return function(_0x1d6502){if(_0x1d6502){freeIsNotKeySip(_0x1d6502,_0x91b7be[_0xdba5('0x45')]);for(var _0x4306d6=0x0,_0x5c8d57={},_0x39383e={};_0x4306d6<_0x1d6502['length'];_0x4306d6+=0x1){_0x5c8d57=_0x1d6502[_0x4306d6];if(_[_0xdba5('0x42')](_0x91b7be[_0xdba5('0x45')][util[_0xdba5('0x27')]('SIP/%s',_0x5c8d57[_0xdba5('0x29')])])){_0x91b7be[_0xdba5('0x45')][util[_0xdba5('0x27')]('SIP/%s',_0x5c8d57[_0xdba5('0x29')])]=new Trunk(_0x5c8d57);}else{_0x91b7be[_0xdba5('0x43')](_0x91b7be[_0xdba5('0x45')][util['format'](_0xdba5('0x28'),_0x5c8d57[_0xdba5('0x29')])],_0x5c8d57);}}}return _0x91b7be['trunks'];};};Realtime[_0xdba5('0x3f')]['initVoiceQueues']=function(){var _0xa57a4=this;return function(_0x58b6ac){if(_0x58b6ac){freeIsNotKey(_0x58b6ac,_0xa57a4[_0xdba5('0x46')],'name');for(var _0xedaaa5=0x0,_0x126007={},_0x182b53={};_0xedaaa5<_0x58b6ac[_0xdba5('0x41')];_0xedaaa5+=0x1){_0x126007=_0x58b6ac[_0xedaaa5];if(_['isUndefined'](_0xa57a4['voiceQueues'][_0x126007['name']])){_0xa57a4['voiceQueues'][_0x126007[_0xdba5('0x29')]]=new VoiceQueue(_0x126007);}else{_0xa57a4[_0xdba5('0x43')](_0xa57a4['voiceQueues'][_0x126007['name']],_0x126007);}}}return _0xa57a4[_0xdba5('0x46')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x47')]=function(){var _0x44e2b7=this;return function(_0x2664f6){if(_0x2664f6){freeIsNotKey(_0x2664f6,_0x44e2b7[_0xdba5('0x13')],'id');for(var _0x4a54eb=0x0,_0x382493={},_0x5c459e={};_0x4a54eb<_0x2664f6['length'];_0x4a54eb+=0x1){_0x382493=_0x2664f6[_0x4a54eb];if(_[_0xdba5('0x42')](_0x44e2b7[_0xdba5('0x13')][_0x382493['id']])){_0x44e2b7[_0xdba5('0x13')][_0x382493['id']]=new Trigger(_0x382493);}else{_0x44e2b7[_0xdba5('0x43')](_0x44e2b7[_0xdba5('0x13')][_0x382493['id']],_0x382493);}}}return _0x44e2b7[_0xdba5('0x13')];};};Realtime[_0xdba5('0x3f')]['initTemplates']=function(){var _0x2e2a62=this;return function(_0x327cff){if(_0x327cff){freeIsNotKey(_0x327cff,_0x2e2a62[_0xdba5('0x15')],'id');for(var _0x499dc9=0x0,_0x55c9cc={},_0x34dd22={};_0x499dc9<_0x327cff[_0xdba5('0x41')];_0x499dc9+=0x1){_0x55c9cc=_0x327cff[_0x499dc9];if(_[_0xdba5('0x42')](_0x2e2a62[_0xdba5('0x15')][_0x55c9cc['id']])){_0x2e2a62[_0xdba5('0x15')][_0x55c9cc['id']]=new Template(_0x55c9cc);}else{_0x2e2a62[_0xdba5('0x43')](_0x2e2a62[_0xdba5('0x15')][_0x55c9cc['id']],_0x55c9cc);}}}return _0x2e2a62[_0xdba5('0x15')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x48')]=function(){var _0x562aa1=this;return function(_0x3ff8d5){if(_0x3ff8d5){freeIsNotKey(_0x3ff8d5,_0x562aa1[_0xdba5('0x1c')],'id');for(var _0x143cce=0x0,_0x1be409={},_0x5b8be9={};_0x143cce<_0x3ff8d5[_0xdba5('0x41')];_0x143cce+=0x1){_0x1be409=_0x3ff8d5[_0x143cce];if(_[_0xdba5('0x42')](_0x562aa1['zendeskAccounts'][_0x1be409['id']])){_0x562aa1[_0xdba5('0x1c')][_0x1be409['id']]=new ZendeskAccount(_0x1be409);}else{_0x562aa1[_0xdba5('0x43')](_0x562aa1[_0xdba5('0x1c')][_0x1be409['id']],_0x1be409);}}}return _0x562aa1[_0xdba5('0x1c')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x49')]=function(){var _0x3c868a=this;return function(_0xd5cc83){if(_0xd5cc83){freeIsNotKey(_0xd5cc83,_0x3c868a['salesforceAccounts'],'id');for(var _0x53975c=0x0,_0x26afbe={},_0x3acca2={};_0x53975c<_0xd5cc83[_0xdba5('0x41')];_0x53975c+=0x1){_0x26afbe=_0xd5cc83[_0x53975c];if(_[_0xdba5('0x42')](_0x3c868a[_0xdba5('0x1d')][_0x26afbe['id']])){_0x3c868a[_0xdba5('0x1d')][_0x26afbe['id']]=new SalesforceAccount(_0x26afbe);}else{_0x3c868a['mergeFromDatabase'](_0x3c868a[_0xdba5('0x1d')][_0x26afbe['id']],_0x26afbe);}}}return _0x3c868a[_0xdba5('0x1d')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x4a')]=function(){var _0xa4655a=this;return function(_0x13264a){if(_0x13264a){freeIsNotKey(_0x13264a,_0xa4655a['freshdeskAccounts'],'id');for(var _0x2026d4=0x0,_0x501365={},_0x36b5e2={};_0x2026d4<_0x13264a[_0xdba5('0x41')];_0x2026d4+=0x1){_0x501365=_0x13264a[_0x2026d4];if(_[_0xdba5('0x42')](_0xa4655a[_0xdba5('0x1f')][_0x501365['id']])){_0xa4655a[_0xdba5('0x1f')][_0x501365['id']]=new FreshdeskAccount(_0x501365);}else{_0xa4655a[_0xdba5('0x43')](_0xa4655a[_0xdba5('0x1f')][_0x501365['id']],_0x501365);}}}return _0xa4655a[_0xdba5('0x1f')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x4b')]=function(){var _0x236af9=this;return function(_0x125689){if(_0x125689){freeIsNotKey(_0x125689,_0x236af9[_0xdba5('0x20')],'id');for(var _0x1da790=0x0,_0x31ebff={},_0x3bbf0d={};_0x1da790<_0x125689['length'];_0x1da790+=0x1){_0x31ebff=_0x125689[_0x1da790];if(_['isUndefined'](_0x236af9[_0xdba5('0x20')][_0x31ebff['id']])){_0x236af9[_0xdba5('0x20')][_0x31ebff['id']]=new ZohoAccount(_0x31ebff);}else{_0x236af9[_0xdba5('0x43')](_0x236af9[_0xdba5('0x20')][_0x31ebff['id']],_0x31ebff);}}}return _0x236af9['zohoAccounts'];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x4c')]=function(){var _0x20970e=this;return function(_0x4a6ec3){if(_0x4a6ec3){freeIsNotKey(_0x4a6ec3,_0x20970e[_0xdba5('0x21')],'id');for(var _0x18358c=0x0,_0x3873ec={},_0x4970b5={};_0x18358c<_0x4a6ec3[_0xdba5('0x41')];_0x18358c+=0x1){_0x3873ec=_0x4a6ec3[_0x18358c];if(_['isUndefined'](_0x20970e[_0xdba5('0x21')][_0x3873ec['id']])){_0x20970e['deskAccounts'][_0x3873ec['id']]=new DeskAccount(_0x3873ec);}else{_0x20970e[_0xdba5('0x43')](_0x20970e[_0xdba5('0x21')][_0x3873ec['id']],_0x3873ec);}}}return _0x20970e[_0xdba5('0x21')];};};Realtime[_0xdba5('0x3f')]['initSugarcrmAccounts']=function(){var _0x50f270=this;return function(_0x2b29c8){if(_0x2b29c8){freeIsNotKey(_0x2b29c8,_0x50f270['sugarcrmAccounts'],'id');for(var _0x4d2a0a=0x0,_0x541c76={},_0x5cfc22={};_0x4d2a0a<_0x2b29c8[_0xdba5('0x41')];_0x4d2a0a+=0x1){_0x541c76=_0x2b29c8[_0x4d2a0a];if(_[_0xdba5('0x42')](_0x50f270['sugarcrmAccounts'][_0x541c76['id']])){_0x50f270[_0xdba5('0x1e')][_0x541c76['id']]=new SugarcrmAccount(_0x541c76);}else{_0x50f270[_0xdba5('0x43')](_0x50f270[_0xdba5('0x1e')][_0x541c76['id']],_0x541c76);}}}return _0x50f270[_0xdba5('0x1e')];};};Realtime['prototype'][_0xdba5('0x4d')]=function(){var _0x512c76=this;return function(_0x4d02b6){if(_0x4d02b6){freeIsNotKey(_0x4d02b6,_0x512c76[_0xdba5('0x22')],'id');for(var _0x4ade4f=0x0,_0x2cbbc3={},_0x62aeee={};_0x4ade4f<_0x4d02b6[_0xdba5('0x41')];_0x4ade4f+=0x1){_0x2cbbc3=_0x4d02b6[_0x4ade4f];if(_[_0xdba5('0x42')](_0x512c76['vtigerAccounts'][_0x2cbbc3['id']])){_0x512c76[_0xdba5('0x22')][_0x2cbbc3['id']]=new VtigerAccount(_0x2cbbc3);}else{_0x512c76['mergeFromDatabase'](_0x512c76[_0xdba5('0x22')][_0x2cbbc3['id']],_0x2cbbc3);}}}return _0x512c76[_0xdba5('0x22')];};};Realtime['prototype'][_0xdba5('0x4e')]=function(){var _0x478d62=this;return function(_0x4373b8){if(_0x4373b8){freeIsNotKey(_0x4373b8,_0x478d62['servicenowAccounts'],'id');for(var _0x5e2bab=0x0,_0x1dcedb={},_0x1c85fc={};_0x5e2bab<_0x4373b8['length'];_0x5e2bab+=0x1){_0x1dcedb=_0x4373b8[_0x5e2bab];if(_['isUndefined'](_0x478d62[_0xdba5('0x4f')][_0x1dcedb['id']])){_0x478d62[_0xdba5('0x4f')][_0x1dcedb['id']]=new ServicenowAccount(_0x1dcedb);}else{_0x478d62[_0xdba5('0x43')](_0x478d62[_0xdba5('0x4f')][_0x1dcedb['id']],_0x1dcedb);}}}return _0x478d62[_0xdba5('0x4f')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x50')]=function(){var _0x4fb251=this;return function(_0x53ddea){if(_0x53ddea){freeIsNotKey(_0x53ddea,_0x4fb251['dynamics365Accounts'],'id');for(var _0x5f377d=0x0,_0x533e37={},_0xf28819={};_0x5f377d<_0x53ddea['length'];_0x5f377d+=0x1){_0x533e37=_0x53ddea[_0x5f377d];if(_['isUndefined'](_0x4fb251[_0xdba5('0x23')][_0x533e37['id']])){_0x4fb251['dynamics365Accounts'][_0x533e37['id']]=new Dynamics365Account(_0x533e37);}else{_0x4fb251[_0xdba5('0x43')](_0x4fb251[_0xdba5('0x23')][_0x533e37['id']],_0x533e37);}}}return _0x4fb251[_0xdba5('0x23')];};};Realtime['prototype'][_0xdba5('0x51')]=function(){var _0x22d321=this;return function(_0xf97286){if(_0xf97286){freeIsNotKey(_0xf97286,_0x22d321[_0xdba5('0x24')],'id');for(var _0x37c0af=0x0,_0x3f2f79={},_0x102a55={};_0x37c0af<_0xf97286[_0xdba5('0x41')];_0x37c0af+=0x1){_0x3f2f79=_0xf97286[_0x37c0af];if(_[_0xdba5('0x42')](_0x22d321[_0xdba5('0x24')][_0x3f2f79['id']])){_0x22d321[_0xdba5('0x24')][_0x3f2f79['id']]=new FreshsalesAccount(_0x3f2f79);}else{_0x22d321[_0xdba5('0x43')](_0x22d321[_0xdba5('0x24')][_0x3f2f79['id']],_0x3f2f79);}}}return _0x22d321[_0xdba5('0x24')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x52')]=function(){var _0x5103e8=this;return function(_0xbb2f98){for(var _0x32b4a4=0x0;_0x32b4a4<_0xbb2f98[_0xdba5('0x41')];_0x32b4a4+=0x1){_[_0xdba5('0x53')](_0x5103e8[_0xdba5('0x46')][_0xbb2f98[_0x32b4a4][_0xdba5('0x29')]],_0xbb2f98[_0x32b4a4]);}return _0x5103e8[_0xdba5('0x46')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x54')]=function(){var _0x518abb=this;return function(_0x201b80){clearVoiceQueues(_0x518abb[_0xdba5('0x46')]);if(_0x201b80){_0x201b80=_[_0xdba5('0x55')](_0x201b80,_0xdba5('0x56'));for(var _0x513b0e in _0x201b80){if(_0x201b80['hasOwnProperty'](_0x513b0e)){var _0x4fec46={};for(var _0x4e6d10=0x0;_0x4e6d10<_0x201b80[_0x513b0e][_0xdba5('0x41')];_0x4e6d10+=0x1){var _0x127900=_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x57')];if(_0x518abb[_0xdba5('0x46')][_0x127900]){if(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x58')]){_0x518abb[_0xdba5('0x46')][_0x127900][_0xdba5('0x59')]+=0x1;}if(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x5a')]){_0x518abb['voiceQueues'][_0x127900][_0xdba5('0x30')]+=0x1;}_0x518abb[_0xdba5('0x46')][_0x127900][_0xdba5('0x31')]+=moment(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x5b')])[_0xdba5('0x5c')](moment(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x5d')]),_0xdba5('0x5e'))||0x0;if(_0x4e6d10===_0x201b80[_0x513b0e][_0xdba5('0x41')]-0x1){_0x518abb['voiceQueues'][_0x127900][_0xdba5('0x32')]+=moment(_0x201b80[_0x513b0e][_0x4e6d10]['queuecallercompleteAt']||_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x5f')]||_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x60')])[_0xdba5('0x5c')](moment(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x5d')]),_0xdba5('0x5e'))||0x0;_0x518abb[_0xdba5('0x46')][_0x127900][_0xdba5('0x2c')]+=0x1;if(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x61')]){_0x518abb[_0xdba5('0x46')][_0x127900][_0xdba5('0x2d')]+=0x1;_0x518abb[_0xdba5('0x46')][_0x127900][_0xdba5('0x2e')]+=moment(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x62')])['diff'](moment(_0x201b80[_0x513b0e][_0x4e6d10][_0xdba5('0x5b')]),'seconds')||0x0;}}else{_0x518abb[_0xdba5('0x46')][_0x127900][_0xdba5('0x32')]+=_0x518abb[_0xdba5('0x46')][_0x127900][_0xdba5('0x31')]||0x0;}}}}}}return _0x518abb['voiceQueues'];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x63')]=function(){var _0x149cc7=this;return function(_0xaf6f97){clearVoiceCallReports(_0x149cc7['outbound']);if(_0xaf6f97){for(var _0x784f4b=0x0;_0x784f4b<_0xaf6f97['length'];_0x784f4b+=0x1){_0x149cc7[_0xdba5('0x16')][_0xdba5('0x2c')]+=0x1;_0x149cc7['outbound'][_0xdba5('0x32')]+=_0xaf6f97[_0x784f4b]['duration'];if(_0xaf6f97[_0x784f4b][_0xdba5('0x64')]===_0xdba5('0x65')){_0x149cc7[_0xdba5('0x16')][_0xdba5('0x2d')]+=0x1;_0x149cc7[_0xdba5('0x16')][_0xdba5('0x31')]+=_0xaf6f97[_0x784f4b]['duration']-_0xaf6f97[_0x784f4b][_0xdba5('0x66')]||0x0;_0x149cc7[_0xdba5('0x16')][_0xdba5('0x2e')]+=_0xaf6f97[_0x784f4b][_0xdba5('0x66')];}}}return _0x149cc7[_0xdba5('0x16')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x67')]=function(){var _0x3c9eae=this;return function(_0x118d0c){if(_0x118d0c){freeIsNotKey(_0x118d0c,_0x3c9eae[_0xdba5('0x14')],_0xdba5('0x29'));for(var _0x5efbde=0x0,_0x10068c={};_0x5efbde<_0x118d0c[_0xdba5('0x41')];_0x5efbde+=0x1){_0x10068c=_0x118d0c[_0x5efbde];if(_[_0xdba5('0x42')](_0x3c9eae[_0xdba5('0x14')][_0x10068c['name']])){_0x3c9eae[_0xdba5('0x14')][_0x10068c[_0xdba5('0x29')]]=new Campaign(_0x10068c);}else{_0x3c9eae[_0xdba5('0x43')](_0x3c9eae[_0xdba5('0x14')][_0x10068c['name']],_0x10068c);_0x3c9eae[_0xdba5('0x14')][_0x10068c['name']][_0xdba5('0x68')]=_0x10068c[_0xdba5('0x69')]?_0x10068c[_0xdba5('0x69')][_0xdba5('0x29')]:undefined;}}}return _0x3c9eae[_0xdba5('0x14')];};};Realtime['prototype'][_0xdba5('0x6a')]=function(){var _0x551ed6=this;return function(_0x39e14e){if(_0x39e14e){freeIsNotKey(_0x39e14e,_0x551ed6[_0xdba5('0x17')],'id');for(var _0x7b25ea=0x0,_0x2bdfcf={};_0x7b25ea<_0x39e14e[_0xdba5('0x41')];_0x7b25ea+=0x1){_0x2bdfcf=_0x39e14e[_0x7b25ea];if(_[_0xdba5('0x42')](_0x551ed6[_0xdba5('0x17')][_0x2bdfcf['id']])){_0x551ed6[_0xdba5('0x17')][_0x2bdfcf['id']]=new VoiceExtension(_0x2bdfcf);}else{_0x551ed6[_0xdba5('0x43')](_0x551ed6[_0xdba5('0x17')][_0x2bdfcf['id']],_0x2bdfcf);}}}return _0x551ed6[_0xdba5('0x17')];};};Realtime[_0xdba5('0x3f')][_0xdba5('0x6b')]=function(){var _0x261c90=this;return function(_0x576d75){clearCampaigns(_0x261c90['campaigns']);for(var _0x266e55=0x0;_0x266e55<_0x576d75[_0xdba5('0x41')];_0x266e55+=0x1){_[_0xdba5('0x53')](_0x261c90['campaigns'][_0x576d75[_0x266e55]['name']],_0x576d75[_0x266e55]);}return _0x261c90[_0xdba5('0x14')];};};Realtime[_0xdba5('0x3f')]['initFaxAccounts']=function(){var _0x2e648f=this;return function(_0x46cfe9){if(_0x46cfe9){freeIsNotKey(_0x46cfe9,_0x2e648f['faxAccounts'],'id');for(var _0x12fbfe=0x0,_0x4c0412={},_0x3a798f={};_0x12fbfe<_0x46cfe9[_0xdba5('0x41')];_0x12fbfe+=0x1){_0x4c0412=_0x46cfe9[_0x12fbfe];if(_[_0xdba5('0x42')](_0x2e648f['faxAccounts'][_0x4c0412['id']])){_0x2e648f[_0xdba5('0x6c')][_0x4c0412['id']]=new FaxAccount(_0x4c0412);}else{_0x2e648f['mergeFromDatabase'](_0x2e648f[_0xdba5('0x6c')][_0x4c0412['id']],_0x4c0412);}}}return _0x2e648f[_0xdba5('0x6c')];};};module[_0xdba5('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c568e20..e95a994 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 _0x3ea0=['util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','accountcode','name','isNil','find','interface','format','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','monitor','monitorFilename','monitors','filename','createdAt','exten','connectedlinename','membername','originatecalleridnum','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','phone','lastIndexOf','transfererlinkedid'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x3ea0,0x154));var _0x03ea=function(_0x2e39e8,_0xd7987e){_0x2e39e8=_0x2e39e8-0x0;var _0x2e1a83=_0x3ea0[_0x2e39e8];return _0x2e1a83;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x03ea('0x0'));var config=require(_0x03ea('0x1'));var ami=require(_0x03ea('0x2'));var RpcVoiceAgentReport=require(_0x03ea('0x3'));var RpcVoiceCallReport=require(_0x03ea('0x4'));var RpcVoiceDialReport=require(_0x03ea('0x5'));var RpcMemberReport=require(_0x03ea('0x6'));var RpcVoiceQueueReport=require(_0x03ea('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x03ea('0x8'));var VoiceAgentReport=require(_0x03ea('0x9'));var VoiceDialReport=require(_0x03ea('0xa'));var UserReport=require(_0x03ea('0xb'));function Report(_0xcdd4b0){this[_0x03ea('0xc')]=_0xcdd4b0;this[_0x03ea('0xd')]=_0xcdd4b0['agents'];this[_0x03ea('0xe')]=_0xcdd4b0['telephones'];}Report[_0x03ea('0xf')][_0x03ea('0x10')]=function(_0x47c7b1){var _0x53ff79=new VoiceQueueReport(this[_0x03ea('0xc')]);var _0x3494a5=new VoiceAgentReport(this['realtime']);var _0x513482=new VoiceDialReport(this[_0x03ea('0xc')]);var _0x5abc91=new VoiceCallReport(this[_0x03ea('0xc')]);var _0x2855bc=new UserReport(this[_0x03ea('0xc')]);if(config['xdr']&&config[_0x03ea('0x11')][_0x03ea('0x12')]){ami['on'](_0x03ea('0x13'),this[_0x03ea('0x14')][_0x03ea('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x03ea('0x16')][_0x03ea('0x15')](this));ami['on'](_0x03ea('0x17'),this[_0x03ea('0x18')][_0x03ea('0x15')](this));ami['on'](_0x03ea('0x19'),this[_0x03ea('0x1a')][_0x03ea('0x15')](this));ami['on']('blindtransfer',this[_0x03ea('0x1b')][_0x03ea('0x15')](this));ami['on'](_0x03ea('0x1c'),this[_0x03ea('0x1d')][_0x03ea('0x15')](this));}};Report['prototype']['findAgent']=function(_0x30be28){var _0x2ceb04;_0x2ceb04=_['find'](this[_0x03ea('0xd')],function(_0x7e66d8){return _0x7e66d8[_0x03ea('0x1e')]==_0x30be28||_0x7e66d8[_0x03ea('0x1f')]==_0x30be28;});if(_[_0x03ea('0x20')](_0x2ceb04)){var _0x16ccae=_[_0x03ea('0x21')](this['telephones'],function(_0x27fa15){return _0x27fa15[_0x03ea('0x1e')]==_0x30be28||_0x27fa15['name']==_0x30be28;});if(_0x16ccae){_0x2ceb04=_[_0x03ea('0x21')](this[_0x03ea('0xd')],function(_0x1de399){return _0x1de399[_0x03ea('0x22')]==util[_0x03ea('0x23')](_0x03ea('0x24'),_0x16ccae[_0x03ea('0x1f')]);});}}return _0x2ceb04;};Report[_0x03ea('0xf')]['voiceQueueReport']=function(_0x1548a3){for(var _0x3ed9f6=0x0;_0x3ed9f6<_0x1548a3[_0x03ea('0x25')];_0x3ed9f6+=0x1){var _0x4d5aad=this[_0x03ea('0x26')](_0x1548a3[_0x3ed9f6][_0x03ea('0x27')]);if(_0x4d5aad){_0x1548a3[_0x3ed9f6]['accountcode']=_0x4d5aad['accountcode'];_0x1548a3[_0x3ed9f6][_0x03ea('0x28')]=!![];_0x1548a3[_0x3ed9f6][_0x03ea('0x29')]=_0x4d5aad[_0x03ea('0x1f')];_0x1548a3[_0x3ed9f6][_0x03ea('0x22')]=_['isNil'](_0x4d5aad['interface'])?util['format'](_0x03ea('0x24'),_0x4d5aad[_0x03ea('0x1f')]):_0x4d5aad['interface'];if(_0x1548a3[_0x3ed9f6][_0x03ea('0x2a')]){_0x1548a3[_0x3ed9f6][_0x03ea('0x2b')]=moment()['format'](_0x03ea('0x2c'));}if(_0x1548a3[_0x3ed9f6][_0x03ea('0x2d')]){_0x1548a3[_0x3ed9f6][_0x03ea('0x2e')]=moment()[_0x03ea('0x23')](_0x03ea('0x2c'));}RpcMemberReport[_0x03ea('0x14')](_0x1548a3[_0x3ed9f6]);}RpcVoiceQueueReport[_0x03ea('0x2f')](_0x1548a3[_0x3ed9f6]);}};function extractCalleridNumber(_0x3d5822){var _0x41b9dd=_0x3d5822[_0x03ea('0x30')](/<(.*?)>/);return _0x41b9dd?_0x41b9dd[0x1]:_0x3d5822;}Report[_0x03ea('0xf')][_0x03ea('0x16')]=function(_0x4aeefc){_0x4aeefc[_0x03ea('0x31')]=_0x4aeefc[_0x03ea('0x31')]||_0x4aeefc['exten'];if(_0x4aeefc[_0x03ea('0x32')]==_0x03ea('0x33')){_0x4aeefc[_0x03ea('0x34')]='queue';_0x4aeefc['lastdata']=_0x4aeefc[_0x03ea('0x35')];if(_0x4aeefc[_0x03ea('0x36')]==_0x03ea('0x37')){_0x4aeefc[_0x03ea('0x1e')]='';_0x4aeefc['destination']=extractCalleridNumber(_0x4aeefc[_0x03ea('0x38')]);}else if(_0x4aeefc[_0x03ea('0x36')]==_0x03ea('0x39')){if(_0x4aeefc[_0x03ea('0x31')]==_0x03ea('0x3a')){_0x4aeefc['destination']=extractCalleridNumber(_0x4aeefc[_0x03ea('0x3b')]);_0x4aeefc[_0x03ea('0x3c')]=_0x4aeefc['originatecalleridnum'];_0x4aeefc['destinationchannel']=[_0x4aeefc[_0x03ea('0x3d')],_0x4aeefc[_0x03ea('0x3d')]=_0x4aeefc[_0x03ea('0x3e')]][0x0];_0x4aeefc['callerid']=_0x4aeefc[_0x03ea('0x3b')];}else{_0x4aeefc[_0x03ea('0x31')]=_0x4aeefc[_0x03ea('0x3c')];_0x4aeefc[_0x03ea('0x3c')]=_0x4aeefc['originatecalleridnum'];if(_0x4aeefc['disposition']=='ANSWERED'){_0x4aeefc[_0x03ea('0x1e')]=_0x4aeefc[_0x03ea('0x27')];}else{_0x4aeefc[_0x03ea('0x1e')]='';}}}}else{_0x4aeefc[_0x03ea('0x38')]=util[_0x03ea('0x23')](_0x03ea('0x3f'),_0x4aeefc[_0x03ea('0x40')],_0x4aeefc['calleridnum']);}if(RpcVoiceTransferReport[_0x03ea('0x41')][_0x4aeefc['linkedid']]){var _0x2c7844=RpcVoiceTransferReport[_0x03ea('0x41')][_0x4aeefc[_0x03ea('0x42')]];_0x2c7844['transfereelinkedid']=_0x4aeefc['uniqueid'];RpcVoiceTransferReport[_0x03ea('0x1b')](_0x2c7844);delete RpcVoiceTransferReport[_0x03ea('0x41')][_0x4aeefc['linkedid']];}RpcVoiceCallReport[_0x03ea('0x2f')](_0x4aeefc);if(_0x4aeefc[_0x03ea('0x43')]){for(var _0x25f6af=0x0;_0x25f6af<_0x4aeefc['monitors'][_0x03ea('0x25')];_0x25f6af+=0x1){_0x4aeefc[_0x03ea('0x44')]=_0x4aeefc[_0x03ea('0x45')][_0x25f6af][_0x03ea('0x46')];_0x4aeefc[_0x03ea('0x47')]=_0x4aeefc[_0x03ea('0x45')][_0x25f6af]['createdAt'];if(_0x4aeefc[_0x03ea('0x48')]==_0x03ea('0x3a')){_0x4aeefc[_0x03ea('0x3c')]=_0x4aeefc[_0x03ea('0x27')];_0x4aeefc[_0x03ea('0x40')]=_0x4aeefc['connectedlinename'];_0x4aeefc[_0x03ea('0x27')]=_0x4aeefc[_0x03ea('0x1e')];_0x4aeefc[_0x03ea('0x49')]=_0x4aeefc[_0x03ea('0x4a')];_0x4aeefc[_0x03ea('0x48')]=_0x4aeefc[_0x03ea('0x4b')];}else if(_0x4aeefc[_0x03ea('0x48')]==_0x03ea('0x4c')){_0x4aeefc[_0x03ea('0x3c')]=_0x4aeefc['destination'];_0x4aeefc[_0x03ea('0x48')]=_0x4aeefc[_0x03ea('0x4b')];}RpcVoiceRecording[_0x03ea('0x2f')](_0x4aeefc);}}};Report[_0x03ea('0xf')][_0x03ea('0x18')]=function(_0xc9de8e){if(_[_0x03ea('0x4d')](_0xc9de8e)){_0xc9de8e[_0x03ea('0x4e')](function(_0x4164d7){RpcVoiceAgentReport[_0x03ea('0x2f')](_0x4164d7);});}else{RpcVoiceAgentReport[_0x03ea('0x2f')](_0xc9de8e);}};Report['prototype']['voiceDialReport']=function(_0x473bed){RpcVoiceDialReport[_0x03ea('0x2f')](_0x473bed);var _0x19c9bb;var _0x3b7274;var _0x272b86=_0x473bed['channel'];if(_[_0x03ea('0x4f')](_0x272b86,'Local')){_0x3b7274=_0x272b86[_0x03ea('0x50')](_0x272b86[_0x03ea('0x51')]('/')+0x1,_0x272b86[_0x03ea('0x51')]('@'));_0x19c9bb=_[_0x03ea('0x21')](this[_0x03ea('0xd')],function(_0x4eedd2){return _0x4eedd2['mobile']==_0x3b7274||_0x4eedd2[_0x03ea('0x52')]==_0x3b7274||_0x4eedd2[_0x03ea('0x1e')]==_0x3b7274;});}else{_0x3b7274=_0x272b86['substring'](_0x272b86['indexOf']('/')+0x1,_0x272b86[_0x03ea('0x53')]('-'));_0x19c9bb=this[_0x03ea('0x26')](_0x3b7274);}if(_0x19c9bb){_0x473bed[_0x03ea('0x22')]=_[_0x03ea('0x20')](_0x19c9bb[_0x03ea('0x22')])?util[_0x03ea('0x23')](_0x03ea('0x24'),_0x19c9bb[_0x03ea('0x1f')]):_0x19c9bb['interface'];_0x473bed[_0x03ea('0x4a')]=_0x19c9bb[_0x03ea('0x1f')];_0x473bed[_0x03ea('0x1e')]=_0x19c9bb[_0x03ea('0x1e')];RpcMemberReport[_0x03ea('0x1a')](_0x473bed);}};Report['prototype']['blindTransfer']=function(_0x4a5f66){RpcVoiceTransferReport['transfers'][_0x4a5f66[_0x03ea('0x54')]]=_0x4a5f66;};Report[_0x03ea('0xf')]['attendedTransfer']=function(_0x483a51){RpcVoiceTransferReport[_0x03ea('0x1d')](_0x483a51);};module['exports']=Report; \ No newline at end of file +var _0x052c=['voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','type','dialer','lastapplication','queue','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','callerid','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','exten','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x052c,0xe6));var _0xc052=function(_0x1caa28,_0x2d6a41){_0x1caa28=_0x1caa28-0x0;var _0x4f4a7a=_0x052c[_0x1caa28];return _0x4f4a7a;};'use strict';var _=require(_0xc052('0x0'));var moment=require(_0xc052('0x1'));var util=require(_0xc052('0x2'));var config=require(_0xc052('0x3'));var ami=require(_0xc052('0x4'));var RpcVoiceAgentReport=require(_0xc052('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xc052('0x6'));var RpcVoiceQueueReport=require(_0xc052('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xc052('0x8'));var VoiceQueueReport=require(_0xc052('0x9'));var VoiceCallReport=require(_0xc052('0xa'));var VoiceAgentReport=require(_0xc052('0xb'));var VoiceDialReport=require(_0xc052('0xc'));var UserReport=require(_0xc052('0xd'));function Report(_0x7211ff){this[_0xc052('0xe')]=_0x7211ff;this[_0xc052('0xf')]=_0x7211ff[_0xc052('0xf')];this[_0xc052('0x10')]=_0x7211ff[_0xc052('0x10')];}Report[_0xc052('0x11')][_0xc052('0x12')]=function(_0x27a0d8){var _0x531956=new VoiceQueueReport(this[_0xc052('0xe')]);var _0x6a1294=new VoiceAgentReport(this[_0xc052('0xe')]);var _0x3ae89f=new VoiceDialReport(this['realtime']);var _0x4a8492=new VoiceCallReport(this[_0xc052('0xe')]);var _0x16e4ef=new UserReport(this[_0xc052('0xe')]);if(config['xdr']&&config[_0xc052('0x13')]['disabled']){ami['on'](_0xc052('0x14'),this[_0xc052('0x15')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0xc052('0x16')][_0xc052('0x17')](this));ami['on'](_0xc052('0x18'),this['voiceAgentReport'][_0xc052('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xc052('0x19')][_0xc052('0x17')](this));ami['on'](_0xc052('0x1a'),this['blindTransfer'][_0xc052('0x17')](this));ami['on'](_0xc052('0x1b'),this[_0xc052('0x1c')][_0xc052('0x17')](this));}};Report['prototype'][_0xc052('0x1d')]=function(_0x4aa784){var _0x3695f7;_0x3695f7=_[_0xc052('0x1e')](this[_0xc052('0xf')],function(_0x52d6d6){return _0x52d6d6[_0xc052('0x1f')]==_0x4aa784||_0x52d6d6[_0xc052('0x20')]==_0x4aa784;});if(_[_0xc052('0x21')](_0x3695f7)){var _0x400bae=_[_0xc052('0x1e')](this['telephones'],function(_0x2e1e3f){return _0x2e1e3f[_0xc052('0x1f')]==_0x4aa784||_0x2e1e3f['name']==_0x4aa784;});if(_0x400bae){_0x3695f7=_[_0xc052('0x1e')](this[_0xc052('0xf')],function(_0x4d320b){return _0x4d320b[_0xc052('0x22')]==util[_0xc052('0x23')](_0xc052('0x24'),_0x400bae[_0xc052('0x20')]);});}}return _0x3695f7;};Report['prototype'][_0xc052('0x15')]=function(_0x4d52ed){for(var _0x492573=0x0;_0x492573<_0x4d52ed[_0xc052('0x25')];_0x492573+=0x1){var _0x14629a=this['findAgent'](_0x4d52ed[_0x492573][_0xc052('0x26')]);if(_0x14629a){_0x4d52ed[_0x492573][_0xc052('0x1f')]=_0x14629a['accountcode'];_0x4d52ed[_0x492573][_0xc052('0x27')]=!![];_0x4d52ed[_0x492573][_0xc052('0x28')]=_0x14629a[_0xc052('0x20')];_0x4d52ed[_0x492573][_0xc052('0x22')]=_['isNil'](_0x14629a[_0xc052('0x22')])?util[_0xc052('0x23')](_0xc052('0x24'),_0x14629a[_0xc052('0x20')]):_0x14629a[_0xc052('0x22')];if(_0x4d52ed[_0x492573][_0xc052('0x29')]){_0x4d52ed[_0x492573][_0xc052('0x2a')]=moment()[_0xc052('0x23')](_0xc052('0x2b'));}if(_0x4d52ed[_0x492573][_0xc052('0x2c')]){_0x4d52ed[_0x492573][_0xc052('0x2d')]=moment()[_0xc052('0x23')](_0xc052('0x2b'));}RpcMemberReport[_0xc052('0x15')](_0x4d52ed[_0x492573]);}RpcVoiceQueueReport[_0xc052('0x2e')](_0x4d52ed[_0x492573]);}};function extractCalleridNumber(_0x283f23){var _0x371cdb=_0x283f23['match'](/<(.*?)>/);return _0x371cdb?_0x371cdb[0x1]:_0x283f23;}Report['prototype'][_0xc052('0x16')]=function(_0x2da708){_0x2da708[_0xc052('0x2f')]=_0x2da708[_0xc052('0x2f')]||_0x2da708['exten'];if(_0x2da708[_0xc052('0x30')]==_0xc052('0x31')){_0x2da708[_0xc052('0x32')]=_0xc052('0x33');_0x2da708['lastdata']=_0x2da708['queue'];if(_0x2da708['context']=='from-voip-provider'){_0x2da708[_0xc052('0x1f')]='';_0x2da708['destination']=extractCalleridNumber(_0x2da708['callerid']);}else if(_0x2da708['context']=='from-sip'){if(_0x2da708[_0xc052('0x2f')]==_0xc052('0x34')){_0x2da708[_0xc052('0x2f')]=extractCalleridNumber(_0x2da708['calleridpreview']);_0x2da708[_0xc052('0x35')]=_0x2da708[_0xc052('0x36')];_0x2da708[_0xc052('0x37')]=[_0x2da708[_0xc052('0x38')],_0x2da708[_0xc052('0x38')]=_0x2da708[_0xc052('0x37')]][0x0];_0x2da708['callerid']=_0x2da708[_0xc052('0x39')];}else{_0x2da708[_0xc052('0x2f')]=_0x2da708['calleridnum'];_0x2da708[_0xc052('0x35')]=_0x2da708['originatecalleridnum'];if(_0x2da708[_0xc052('0x3a')]==_0xc052('0x3b')){_0x2da708['accountcode']=_0x2da708[_0xc052('0x26')];}else{_0x2da708[_0xc052('0x1f')]='';}}}}else{_0x2da708[_0xc052('0x3c')]=util[_0xc052('0x23')](_0xc052('0x3d'),_0x2da708[_0xc052('0x3e')],_0x2da708['calleridnum']);}if(RpcVoiceTransferReport[_0xc052('0x3f')][_0x2da708['linkedid']]){var _0x14594a=RpcVoiceTransferReport[_0xc052('0x3f')][_0x2da708[_0xc052('0x40')]];_0x14594a['transfereelinkedid']=_0x2da708[_0xc052('0x41')];RpcVoiceTransferReport['blindTransfer'](_0x14594a);delete RpcVoiceTransferReport['transfers'][_0x2da708[_0xc052('0x40')]];}RpcVoiceCallReport[_0xc052('0x2e')](_0x2da708);if(_0x2da708[_0xc052('0x42')]){for(var _0xee9c99=0x0;_0xee9c99<_0x2da708[_0xc052('0x43')][_0xc052('0x25')];_0xee9c99+=0x1){_0x2da708[_0xc052('0x44')]=_0x2da708[_0xc052('0x43')][_0xee9c99][_0xc052('0x45')];_0x2da708['createdAt']=_0x2da708['monitors'][_0xee9c99][_0xc052('0x46')];if(_0x2da708['exten']==_0xc052('0x34')){_0x2da708[_0xc052('0x35')]=_0x2da708['connectedlinenum'];_0x2da708[_0xc052('0x3e')]=_0x2da708[_0xc052('0x47')];_0x2da708[_0xc052('0x26')]=_0x2da708[_0xc052('0x1f')];_0x2da708[_0xc052('0x47')]=_0x2da708[_0xc052('0x48')];_0x2da708[_0xc052('0x49')]=_0x2da708[_0xc052('0x36')];}else if(_0x2da708[_0xc052('0x49')]==_0xc052('0x4a')){_0x2da708[_0xc052('0x35')]=_0x2da708[_0xc052('0x2f')];_0x2da708[_0xc052('0x49')]=_0x2da708[_0xc052('0x36')];}RpcVoiceRecording['create'](_0x2da708);}}};Report[_0xc052('0x11')][_0xc052('0x4b')]=function(_0x3e1d57){if(_[_0xc052('0x4c')](_0x3e1d57)){_0x3e1d57[_0xc052('0x4d')](function(_0x2a2aff){RpcVoiceAgentReport[_0xc052('0x2e')](_0x2a2aff);});}else{RpcVoiceAgentReport[_0xc052('0x2e')](_0x3e1d57);}};Report['prototype'][_0xc052('0x19')]=function(_0x3d5bc9){RpcVoiceDialReport['create'](_0x3d5bc9);var _0x9d52ae;var _0x315894;var _0xdd4b5b=_0x3d5bc9[_0xc052('0x38')];if(_[_0xc052('0x4e')](_0xdd4b5b,_0xc052('0x4f'))){_0x315894=_0xdd4b5b[_0xc052('0x50')](_0xdd4b5b[_0xc052('0x51')]('/')+0x1,_0xdd4b5b[_0xc052('0x51')]('@'));_0x9d52ae=_['find'](this[_0xc052('0xf')],function(_0x469c8a){return _0x469c8a[_0xc052('0x52')]==_0x315894||_0x469c8a[_0xc052('0x53')]==_0x315894||_0x469c8a[_0xc052('0x1f')]==_0x315894;});}else{_0x315894=_0xdd4b5b['substring'](_0xdd4b5b['indexOf']('/')+0x1,_0xdd4b5b['lastIndexOf']('-'));_0x9d52ae=this[_0xc052('0x1d')](_0x315894);}if(_0x9d52ae){_0x3d5bc9[_0xc052('0x22')]=_[_0xc052('0x21')](_0x9d52ae[_0xc052('0x22')])?util['format'](_0xc052('0x24'),_0x9d52ae['name']):_0x9d52ae[_0xc052('0x22')];_0x3d5bc9[_0xc052('0x48')]=_0x9d52ae[_0xc052('0x20')];_0x3d5bc9[_0xc052('0x1f')]=_0x9d52ae[_0xc052('0x1f')];RpcMemberReport['voiceDialReport'](_0x3d5bc9);}};Report[_0xc052('0x11')]['blindTransfer']=function(_0x2ee4b1){RpcVoiceTransferReport[_0xc052('0x3f')][_0x2ee4b1[_0xc052('0x54')]]=_0x2ee4b1;};Report['prototype'][_0xc052('0x1c')]=function(_0x304641){RpcVoiceTransferReport[_0xc052('0x1c')](_0x304641);};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 726fefb..e4f1805 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 _0x152f=['event','actionid','username','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','format','updateStatusRealtime','toNumber','telephone:%s','telephone:save','Local','substring','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','redis','socket.io-emitter','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','inspect','catch','[userReport][devicestatelist]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','trunks','stateRegistry','merge','omit'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x152f,0x144));var _0xf152=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x152f[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0xf152('0x0'));var moment=require(_0xf152('0x1'));var util=require(_0xf152('0x2'));var Redis=require(_0xf152('0x3'));var BPromise=require(_0xf152('0x4'));var config=require('../../../config/environment');var logger=require(_0xf152('0x5'))(_0xf152('0x6'));var ami=require(_0xf152('0x7'));config[_0xf152('0x8')]=_['defaults'](config[_0xf152('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf152('0x9'))(new Redis(config['redis']));function UserReport(_0x36498a){this['trunks']=_0x36498a['trunks'];this[_0xf152('0xa')]=_0x36498a[_0xf152('0xa')];this['telephones']=_0x36498a[_0xf152('0xb')];ami['on'](_0xf152('0xc'),this['syncRegistry'][_0xf152('0xd')](this));ami['on'](_0xf152('0xe'),this[_0xf152('0xf')][_0xf152('0xd')](this));ami['on'](_0xf152('0x10'),this[_0xf152('0x11')][_0xf152('0xd')](this));ami['on'](_0xf152('0x12'),this[_0xf152('0x13')][_0xf152('0xd')](this));return this[_0xf152('0x14')]();}function showSipRegistrations(){Promise[_0xf152('0x15')]()[_0xf152('0x16')](ami[_0xf152('0x17')]())['catch'](function(_0x321ef1){logger[_0xf152('0x18')]('[userReport][sipshowregistry]',util[_0xf152('0x19')](_0x321ef1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xf152('0x15')]()[_0xf152('0x16')](ami['actionDeviceStateList']())[_0xf152('0x1a')](function(_0x286f0a){logger['error'](_0xf152('0x1b'),util[_0xf152('0x19')](_0x286f0a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xf152('0x15')]()[_0xf152('0x16')](ami['actionSipPeerStatus']())[_0xf152('0x1a')](function(_0x5872d9){logger[_0xf152('0x18')]('[userReport][sippeerstatus]',util[_0xf152('0x19')](_0x5872d9,{'showHidden':![],'depth':null}));});}UserReport[_0xf152('0x1c')][_0xf152('0x14')]=function(){setInterval(function(){BPromise[_0xf152('0x15')]()[_0xf152('0x16')](showSipRegistrations())[_0xf152('0x16')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xf152('0x1c')][_0xf152('0x1d')]=function(_0x2c0433){return _0x2c0433!==null&&!_['isUndefined'](_0x2c0433);};UserReport[_0xf152('0x1c')][_0xf152('0x1e')]=function(_0x2cb87f,_0x35442a,_0xc65d65){io['to'](_0x2cb87f)[_0xf152('0x1e')](_0x35442a,_0xc65d65);};UserReport['prototype']['syncRegistry']=function(_0x39d904){try{if(this[_0xf152('0x1d')](_0x39d904)){logger[_0xf152('0x1f')](_0xf152('0x20'),_0x39d904['username'],_0x39d904[_0xf152('0x21')]);logger[_0xf152('0x22')](_0xf152('0x23'),util['inspect'](_0x39d904,{'showHidden':![],'depth':null}));var _0xea6589=_[_0xf152('0x24')](this[_0xf152('0x25')],{'defaultuser':_0x39d904['username']});if(_0xea6589){_0x39d904[_0xf152('0x26')]=_0x39d904[_0xf152('0x21')];_[_0xf152('0x27')](_0xea6589,_[_0xf152('0x28')](_0x39d904,[_0xf152('0x29'),_0xf152('0x2a'),_0xf152('0x2b'),_0xf152('0x21')]));logger['debug'](_0xf152('0x2c'),util['inspect'](_0xea6589,{'showHidden':![],'depth':null}));this[_0xf152('0x1e')](util['format'](_0xf152('0x2d'),_0xea6589[_0xf152('0x2e')]),_0xf152('0x2f'),_0xea6589);}}}catch(_0x2bdf10){logger[_0xf152('0x18')](_0xf152('0x23'),util[_0xf152('0x19')](_0x2bdf10,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xf152('0x11')]=function(_0x502eb5){try{if(this['isNotNull'](_0x502eb5)){logger[_0xf152('0x1f')](_0xf152('0x30'),_0x502eb5[_0xf152('0x31')],_0x502eb5[_0xf152('0x21')]);logger[_0xf152('0x22')](_0xf152('0x32'),util[_0xf152('0x19')](_0x502eb5,{'showHidden':![],'depth':null}));if(this['agents'][_0x502eb5['device']]){if(!this[_0xf152('0xa')][_0x502eb5[_0xf152('0x31')]][_0xf152('0x33')]||_0x502eb5[_0xf152('0x21')][_0xf152('0x34')]()==_0xf152('0x35')){this[_0xf152('0xa')][_0x502eb5['device']][_0xf152('0x33')]=![];if(this[_0xf152('0xa')][_0x502eb5['device']][_0xf152('0x21')]!==_0x502eb5[_0xf152('0x21')][_0xf152('0x34')]()){this['agents'][_0x502eb5[_0xf152('0x31')]][_0xf152('0x36')]=_['toNumber'](moment()[_0xf152('0x37')]('x'));}this['agents'][_0x502eb5['device']][_0xf152('0x21')]=_0x502eb5[_0xf152('0x21')]['toLowerCase']();this[_0xf152('0xa')][_0x502eb5[_0xf152('0x31')]][_0xf152('0x38')](_0x502eb5);}}else if(this[_0xf152('0xb')][_0x502eb5['device']]){if(this[_0xf152('0xb')][_0x502eb5[_0xf152('0x31')]][_0xf152('0x21')]!==_0x502eb5[_0xf152('0x21')][_0xf152('0x34')]()){this['telephones'][_0x502eb5[_0xf152('0x31')]]['stateTime']=_[_0xf152('0x39')](moment()['format']('x'));}this[_0xf152('0xb')][_0x502eb5[_0xf152('0x31')]][_0xf152('0x21')]=_0x502eb5[_0xf152('0x21')][_0xf152('0x34')]();logger[_0xf152('0x22')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x502eb5['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xf152('0x37')](_0xf152('0x3a'),this[_0xf152('0xb')][_0x502eb5['device']][_0xf152('0x2e')]),_0xf152('0x3b'),this[_0xf152('0xb')][_0x502eb5[_0xf152('0x31')]]);}else if(this['trunks'][_0x502eb5[_0xf152('0x31')]]){if(this[_0xf152('0x25')][_0x502eb5[_0xf152('0x31')]][_0xf152('0x21')]!==_0x502eb5[_0xf152('0x21')][_0xf152('0x34')]()){this[_0xf152('0x25')][_0x502eb5['device']]['stateTime']=_[_0xf152('0x39')](moment()[_0xf152('0x37')]('x'));}this['trunks'][_0x502eb5[_0xf152('0x31')]][_0xf152('0x21')]=_0x502eb5['state'][_0xf152('0x34')]();logger[_0xf152('0x22')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xf152('0x19')](this['trunks'][_0x502eb5[_0xf152('0x31')]],{'showHidden':![],'depth':null}));this[_0xf152('0x1e')](util['format'](_0xf152('0x2d'),this[_0xf152('0x25')][_0x502eb5[_0xf152('0x31')]]['name']),'trunk:save',this[_0xf152('0x25')][_0x502eb5[_0xf152('0x31')]]);}else if(_['startsWith'](_0x502eb5[_0xf152('0x31')],_0xf152('0x3c'))){var _0x575ba1=_0x502eb5[_0xf152('0x31')];var _0x19f8a9=_0x575ba1[_0xf152('0x3d')](_0x575ba1['indexOf']('/')+0x1,_0x575ba1['indexOf']('@'));var _0x15fcd5=_['find'](this['agents'],function(_0x4590e6){return _0x4590e6[_0xf152('0x3e')]==_0x19f8a9||_0x4590e6[_0xf152('0x3f')]==_0x19f8a9||_0x4590e6['accountcode']==_0x19f8a9;});if(_0x15fcd5){if(_0x15fcd5[_0xf152('0x21')]!==_0x502eb5[_0xf152('0x21')][_0xf152('0x34')]()){_0x15fcd5['stateTime']=_[_0xf152('0x39')](moment()[_0xf152('0x37')]('x'));}_0x15fcd5[_0xf152('0x21')]=_0x502eb5[_0xf152('0x21')][_0xf152('0x34')]();_0x15fcd5['local']=!![];_0x15fcd5[_0xf152('0x38')](_0x502eb5);}}}}catch(_0x1e8df5){logger[_0xf152('0x18')](_0xf152('0x32'),util['inspect'](_0x1e8df5,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xf152('0x13')]=function(_0x284d32){try{if(this[_0xf152('0x1d')](_0x284d32)&&this[_0xf152('0x1d')](_0x284d32['peerstatus'])){logger[_0xf152('0x1f')](_0xf152('0x40'),_0x284d32[_0xf152('0x41')],_0x284d32[_0xf152('0x42')],_0x284d32[_0xf152('0x12')]);logger[_0xf152('0x22')](_0xf152('0x43'),util[_0xf152('0x19')](_0x284d32,{'showHidden':![],'depth':null}));if(this[_0xf152('0xa')][_0x284d32['peer']]){if(!this['agents'][_0x284d32[_0xf152('0x41')]]['local']||_0x284d32[_0xf152('0x12')][_0xf152('0x34')]()==_0xf152('0x44')){this[_0xf152('0xa')][_0x284d32['peer']][_0xf152('0x33')]=![];this[_0xf152('0xa')][_0x284d32['peer']][_0xf152('0x45')]=_0x284d32['peerstatus']['toLowerCase']();this[_0xf152('0xa')][_0x284d32['peer']][_0xf152('0x42')]=_0x284d32[_0xf152('0x42')];this['agents'][_0x284d32[_0xf152('0x41')]][_0xf152('0x38')](_0x284d32);}}else if(this[_0xf152('0xb')][_0x284d32[_0xf152('0x41')]]){this[_0xf152('0xb')][_0x284d32[_0xf152('0x41')]][_0xf152('0x45')]=_0x284d32[_0xf152('0x12')]['toLowerCase']();this['telephones'][_0x284d32['peer']][_0xf152('0x42')]=_0x284d32[_0xf152('0x42')];logger[_0xf152('0x22')](_0xf152('0x46'),util[_0xf152('0x19')](this[_0xf152('0xb')][_0x284d32['peer']],{'showHidden':![],'depth':null}));this[_0xf152('0x1e')](util[_0xf152('0x37')](_0xf152('0x3a'),this[_0xf152('0xb')][_0x284d32[_0xf152('0x41')]][_0xf152('0x2e')]),_0xf152('0x3b'),this[_0xf152('0xb')][_0x284d32[_0xf152('0x41')]]);}else if(this[_0xf152('0x25')][_0x284d32[_0xf152('0x41')]]){this[_0xf152('0x25')][_0x284d32[_0xf152('0x41')]]['status']=_0x284d32[_0xf152('0x12')]['toLowerCase']();this[_0xf152('0x25')][_0x284d32[_0xf152('0x41')]]['address']=_0x284d32['address'];logger['debug'](_0xf152('0x47'),util[_0xf152('0x19')](this[_0xf152('0x25')][_0x284d32['peer']],{'showHidden':![],'depth':null}));this[_0xf152('0x1e')](util[_0xf152('0x37')](_0xf152('0x2d'),this[_0xf152('0x25')][_0x284d32['peer']]['name']),'trunk:save',this[_0xf152('0x25')][_0x284d32['peer']]);}}}catch(_0x2994e4){logger[_0xf152('0x18')](_0xf152('0x43'),util[_0xf152('0x19')](_0x2994e4,{'showHidden':![],'depth':null}));}};module[_0xf152('0x48')]=UserReport; \ No newline at end of file +var _0x5199=['defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','format','trunk:%s','name','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','info','peer','address','[userReport][peerstatus]','registered','status','trunk:save','lodash','moment','bluebird','../../../config/environment','../../../config/logger','ami','redis'];(function(_0x436320,_0x29f054){var _0xd256c9=function(_0x31839c){while(--_0x31839c){_0x436320['push'](_0x436320['shift']());}};_0xd256c9(++_0x29f054);}(_0x5199,0xd7));var _0x9519=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5199[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x9519('0x0'));var moment=require(_0x9519('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x9519('0x2'));var config=require(_0x9519('0x3'));var logger=require(_0x9519('0x4'))(_0x9519('0x5'));var ami=require('../ami');config[_0x9519('0x6')]=_[_0x9519('0x7')](config[_0x9519('0x6')],{'host':_0x9519('0x8'),'port':0x18eb});var io=require(_0x9519('0x9'))(new Redis(config[_0x9519('0x6')]));function UserReport(_0x16d4dc){this[_0x9519('0xa')]=_0x16d4dc[_0x9519('0xa')];this['agents']=_0x16d4dc[_0x9519('0xb')];this[_0x9519('0xc')]=_0x16d4dc[_0x9519('0xc')];ami['on'](_0x9519('0xd'),this['syncRegistry'][_0x9519('0xe')](this));ami['on'](_0x9519('0xf'),this[_0x9519('0x10')][_0x9519('0xe')](this));ami['on']('devicestatechange',this[_0x9519('0x11')]['bind'](this));ami['on'](_0x9519('0x12'),this[_0x9519('0x13')]['bind'](this));return this[_0x9519('0x14')]();}function showSipRegistrations(){Promise[_0x9519('0x15')]()[_0x9519('0x16')](ami[_0x9519('0x17')]())[_0x9519('0x18')](function(_0x13b4a1){logger[_0x9519('0x19')](_0x9519('0x1a'),util[_0x9519('0x1b')](_0x13b4a1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x9519('0x16')](ami['actionDeviceStateList']())[_0x9519('0x18')](function(_0x35ce01){logger[_0x9519('0x19')](_0x9519('0x1c'),util['inspect'](_0x35ce01,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9519('0x15')]()[_0x9519('0x16')](ami[_0x9519('0x1d')]())[_0x9519('0x18')](function(_0x1ec1c6){logger[_0x9519('0x19')](_0x9519('0x1e'),util[_0x9519('0x1b')](_0x1ec1c6,{'showHidden':![],'depth':null}));});}UserReport[_0x9519('0x1f')][_0x9519('0x14')]=function(){setInterval(function(){BPromise[_0x9519('0x15')]()[_0x9519('0x16')](showSipRegistrations())[_0x9519('0x16')](listDeviceStates())[_0x9519('0x16')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x9519('0x20')]=function(_0x4f72c8){return _0x4f72c8!==null&&!_[_0x9519('0x21')](_0x4f72c8);};UserReport[_0x9519('0x1f')][_0x9519('0x22')]=function(_0x422c05,_0x315937,_0x470398){io['to'](_0x422c05)[_0x9519('0x22')](_0x315937,_0x470398);};UserReport[_0x9519('0x1f')]['syncRegistry']=function(_0x17c85a){try{if(this['isNotNull'](_0x17c85a)){logger['info'](_0x9519('0x23'),_0x17c85a[_0x9519('0x24')],_0x17c85a[_0x9519('0x25')]);logger[_0x9519('0x26')](_0x9519('0x27'),util['inspect'](_0x17c85a,{'showHidden':![],'depth':null}));var _0x472f25=_[_0x9519('0x28')](this['trunks'],{'defaultuser':_0x17c85a['username']});if(_0x472f25){_0x17c85a[_0x9519('0x29')]=_0x17c85a[_0x9519('0x25')];_[_0x9519('0x2a')](_0x472f25,_[_0x9519('0x2b')](_0x17c85a,[_0x9519('0x2c'),_0x9519('0x2d'),_0x9519('0x24'),_0x9519('0x25')]));logger[_0x9519('0x26')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x472f25,{'showHidden':![],'depth':null}));this[_0x9519('0x22')](util[_0x9519('0x2e')](_0x9519('0x2f'),_0x472f25[_0x9519('0x30')]),'trunk:save',_0x472f25);}}}catch(_0x1cb2bb){logger['error'](_0x9519('0x27'),util[_0x9519('0x1b')](_0x1cb2bb,{'showHidden':![],'depth':null}));}};UserReport[_0x9519('0x1f')][_0x9519('0x11')]=function(_0x5f5848){try{if(this[_0x9519('0x20')](_0x5f5848)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x5f5848[_0x9519('0x31')],_0x5f5848[_0x9519('0x25')]);logger['debug'](_0x9519('0x32'),util['inspect'](_0x5f5848,{'showHidden':![],'depth':null}));if(this[_0x9519('0xb')][_0x5f5848[_0x9519('0x31')]]){if(!this['agents'][_0x5f5848[_0x9519('0x31')]]['local']||_0x5f5848[_0x9519('0x25')][_0x9519('0x33')]()==_0x9519('0x34')){this[_0x9519('0xb')][_0x5f5848[_0x9519('0x31')]][_0x9519('0x35')]=![];if(this[_0x9519('0xb')][_0x5f5848[_0x9519('0x31')]][_0x9519('0x25')]!==_0x5f5848['state'][_0x9519('0x33')]()){this[_0x9519('0xb')][_0x5f5848['device']][_0x9519('0x36')]=_[_0x9519('0x37')](moment()[_0x9519('0x2e')]('x'));}this[_0x9519('0xb')][_0x5f5848[_0x9519('0x31')]][_0x9519('0x25')]=_0x5f5848[_0x9519('0x25')][_0x9519('0x33')]();this[_0x9519('0xb')][_0x5f5848[_0x9519('0x31')]]['updateStatusRealtime'](_0x5f5848);}}else if(this[_0x9519('0xc')][_0x5f5848[_0x9519('0x31')]]){if(this[_0x9519('0xc')][_0x5f5848['device']]['state']!==_0x5f5848[_0x9519('0x25')][_0x9519('0x33')]()){this[_0x9519('0xc')][_0x5f5848[_0x9519('0x31')]][_0x9519('0x36')]=_[_0x9519('0x37')](moment()[_0x9519('0x2e')]('x'));}this[_0x9519('0xc')][_0x5f5848[_0x9519('0x31')]][_0x9519('0x25')]=_0x5f5848['state']['toLowerCase']();logger['debug'](_0x9519('0x38'),util[_0x9519('0x1b')](this[_0x9519('0xc')][_0x5f5848['device']],{'showHidden':![],'depth':null}));this[_0x9519('0x22')](util[_0x9519('0x2e')](_0x9519('0x39'),this['telephones'][_0x5f5848[_0x9519('0x31')]][_0x9519('0x30')]),_0x9519('0x3a'),this[_0x9519('0xc')][_0x5f5848[_0x9519('0x31')]]);}else if(this[_0x9519('0xa')][_0x5f5848[_0x9519('0x31')]]){if(this[_0x9519('0xa')][_0x5f5848[_0x9519('0x31')]]['state']!==_0x5f5848['state'][_0x9519('0x33')]()){this['trunks'][_0x5f5848[_0x9519('0x31')]][_0x9519('0x36')]=_[_0x9519('0x37')](moment()[_0x9519('0x2e')]('x'));}this[_0x9519('0xa')][_0x5f5848[_0x9519('0x31')]]['state']=_0x5f5848[_0x9519('0x25')]['toLowerCase']();logger[_0x9519('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x9519('0x1b')](this[_0x9519('0xa')][_0x5f5848[_0x9519('0x31')]],{'showHidden':![],'depth':null}));this[_0x9519('0x22')](util[_0x9519('0x2e')](_0x9519('0x2f'),this['trunks'][_0x5f5848[_0x9519('0x31')]][_0x9519('0x30')]),'trunk:save',this[_0x9519('0xa')][_0x5f5848[_0x9519('0x31')]]);}else if(_[_0x9519('0x3b')](_0x5f5848[_0x9519('0x31')],_0x9519('0x3c'))){var _0x115c2f=_0x5f5848[_0x9519('0x31')];var _0x2482bc=_0x115c2f[_0x9519('0x3d')](_0x115c2f[_0x9519('0x3e')]('/')+0x1,_0x115c2f['indexOf']('@'));var _0x374739=_[_0x9519('0x28')](this[_0x9519('0xb')],function(_0x467af5){return _0x467af5[_0x9519('0x3f')]==_0x2482bc||_0x467af5[_0x9519('0x40')]==_0x2482bc||_0x467af5[_0x9519('0x41')]==_0x2482bc;});if(_0x374739){if(_0x374739[_0x9519('0x25')]!==_0x5f5848[_0x9519('0x25')][_0x9519('0x33')]()){_0x374739['stateTime']=_[_0x9519('0x37')](moment()[_0x9519('0x2e')]('x'));}_0x374739[_0x9519('0x25')]=_0x5f5848['state'][_0x9519('0x33')]();_0x374739['local']=!![];_0x374739[_0x9519('0x42')](_0x5f5848);}}}}catch(_0xe771b0){logger['error'](_0x9519('0x32'),util['inspect'](_0xe771b0,{'showHidden':![],'depth':null}));}};UserReport[_0x9519('0x1f')][_0x9519('0x13')]=function(_0x501892){try{if(this[_0x9519('0x20')](_0x501892)&&this['isNotNull'](_0x501892[_0x9519('0x12')])){logger[_0x9519('0x43')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x501892[_0x9519('0x44')],_0x501892[_0x9519('0x45')],_0x501892[_0x9519('0x12')]);logger['debug'](_0x9519('0x46'),util[_0x9519('0x1b')](_0x501892,{'showHidden':![],'depth':null}));if(this[_0x9519('0xb')][_0x501892['peer']]){if(!this[_0x9519('0xb')][_0x501892[_0x9519('0x44')]][_0x9519('0x35')]||_0x501892[_0x9519('0x12')]['toLowerCase']()==_0x9519('0x47')){this[_0x9519('0xb')][_0x501892[_0x9519('0x44')]][_0x9519('0x35')]=![];this[_0x9519('0xb')][_0x501892[_0x9519('0x44')]][_0x9519('0x48')]=_0x501892[_0x9519('0x12')][_0x9519('0x33')]();this[_0x9519('0xb')][_0x501892[_0x9519('0x44')]]['address']=_0x501892[_0x9519('0x45')];this[_0x9519('0xb')][_0x501892[_0x9519('0x44')]][_0x9519('0x42')](_0x501892);}}else if(this[_0x9519('0xc')][_0x501892[_0x9519('0x44')]]){this['telephones'][_0x501892[_0x9519('0x44')]][_0x9519('0x48')]=_0x501892[_0x9519('0x12')][_0x9519('0x33')]();this['telephones'][_0x501892[_0x9519('0x44')]][_0x9519('0x45')]=_0x501892[_0x9519('0x45')];logger[_0x9519('0x26')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x9519('0x1b')](this[_0x9519('0xc')][_0x501892[_0x9519('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x9519('0x39'),this['telephones'][_0x501892[_0x9519('0x44')]][_0x9519('0x30')]),_0x9519('0x3a'),this['telephones'][_0x501892[_0x9519('0x44')]]);}else if(this['trunks'][_0x501892[_0x9519('0x44')]]){this[_0x9519('0xa')][_0x501892[_0x9519('0x44')]]['status']=_0x501892['peerstatus'][_0x9519('0x33')]();this[_0x9519('0xa')][_0x501892[_0x9519('0x44')]][_0x9519('0x45')]=_0x501892[_0x9519('0x45')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0x9519('0xa')][_0x501892[_0x9519('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9519('0x2e')](_0x9519('0x2f'),this[_0x9519('0xa')][_0x501892[_0x9519('0x44')]]['name']),_0x9519('0x49'),this[_0x9519('0xa')][_0x501892['peer']]);}}}catch(_0x5a94f6){logger['error'](_0x9519('0x46'),util[_0x9519('0x1b')](_0x5a94f6,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 696fda1..484da81 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 _0xcc24=['emit','isNotNull','isUndefined','info','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','membername','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','merge','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','interface','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceChannels','voiceQueues','agents','variables','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype'];(function(_0x44db83,_0x256156){var _0x14166e=function(_0x14af7d){while(--_0x14af7d){_0x44db83['push'](_0x44db83['shift']());}};_0x14166e(++_0x256156);}(_0xcc24,0x1bb));var _0x4cc2=function(_0x16a780,_0x88007){_0x16a780=_0x16a780-0x0;var _0x1cfb33=_0xcc24[_0x16a780];return _0x1cfb33;};'use strict';var _=require(_0x4cc2('0x0'));var moment=require('moment');var util=require(_0x4cc2('0x1'));var Redis=require(_0x4cc2('0x2'));var config=require(_0x4cc2('0x3'));var logger=require('../../../config/logger')(_0x4cc2('0x4'));var ami=require(_0x4cc2('0x5'));config[_0x4cc2('0x6')]=_[_0x4cc2('0x7')](config[_0x4cc2('0x6')],{'host':_0x4cc2('0x8'),'port':0x18eb});var io=require(_0x4cc2('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x2e0dfc){this['channels']={};this[_0x4cc2('0xa')]=_0x2e0dfc['channels'];this['voiceQueues']=_0x2e0dfc[_0x4cc2('0xb')];this[_0x4cc2('0xc')]=_0x2e0dfc[_0x4cc2('0xc')];this[_0x4cc2('0xd')]={};ami['on']('agentcalled',this['syncAgentCalled']['bind'](this));ami['on']('agentconnect',this[_0x4cc2('0xe')][_0x4cc2('0xf')](this));ami['on'](_0x4cc2('0x10'),this[_0x4cc2('0x11')]['bind'](this));ami['on'](_0x4cc2('0x12'),this[_0x4cc2('0x13')][_0x4cc2('0xf')](this));ami['on'](_0x4cc2('0x14'),this['syncAgentComplete'][_0x4cc2('0xf')](this));ami['on']('varset',this[_0x4cc2('0x15')][_0x4cc2('0xf')](this));ami['on'](_0x4cc2('0x16'),this[_0x4cc2('0x17')][_0x4cc2('0xf')](this));ami['on']('musiconholdstart',this[_0x4cc2('0x18')][_0x4cc2('0xf')](this));ami['on'](_0x4cc2('0x19'),this[_0x4cc2('0x1a')][_0x4cc2('0xf')](this));ami['on'](_0x4cc2('0x1b'),this['syncAttendedTransfer'][_0x4cc2('0xf')](this));ami['on'](_0x4cc2('0x1c'),this[_0x4cc2('0x1d')]['bind'](this));}VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x1f')]=function(_0x105174,_0x44881e,_0xe9a663){io['to'](_0x105174)[_0x4cc2('0x1f')](_0x44881e,_0xe9a663);};VoiceAgentReport['prototype'][_0x4cc2('0x20')]=function(_0x5c4e72){return _0x5c4e72!==null&&!_[_0x4cc2('0x21')](_0x5c4e72);};VoiceAgentReport[_0x4cc2('0x1e')]['syncAgentCalled']=function(_0x39fe04){try{if(this[_0x4cc2('0x20')](_0x39fe04)){logger[_0x4cc2('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x39fe04[_0x4cc2('0x23')],_0x39fe04['membername'],_0x39fe04[_0x4cc2('0x24')]);logger[_0x4cc2('0x25')](_0x4cc2('0x26'),_0x39fe04[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x39fe04,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x39fe04[_0x4cc2('0x23')]])){this[_0x4cc2('0x28')][_0x39fe04[_0x4cc2('0x23')]]={};}if(_[_0x4cc2('0x21')](this['channels'][_0x39fe04['uniqueid']][_0x39fe04[_0x4cc2('0x24')]])){this[_0x4cc2('0x28')][_0x39fe04[_0x4cc2('0x23')]][_0x39fe04['destuniqueid']]={'agentcalledAt':moment()['format'](_0x4cc2('0x29')),'lastevent':_0x4cc2('0x2a'),'mandatoryDisposition':this[_0x4cc2('0xb')][_0x39fe04[_0x4cc2('0x2b')]]?this[_0x4cc2('0xb')][_0x39fe04[_0x4cc2('0x2b')]][_0x4cc2('0x2c')]||![]:![],'type':this[_0x4cc2('0xb')][_0x39fe04[_0x4cc2('0x2b')]]?this[_0x4cc2('0xb')][_0x39fe04[_0x4cc2('0x2b')]][_0x4cc2('0x2d')]||_0x4cc2('0x2e'):_0x4cc2('0x2e'),'variables':this[_0x4cc2('0xd')][_0x39fe04[_0x4cc2('0x23')]],'motionChannel':'voice'};}_['merge'](this[_0x4cc2('0x28')][_0x39fe04[_0x4cc2('0x23')]][_0x39fe04[_0x4cc2('0x24')]],_['omit'](_0x39fe04,[_0x4cc2('0x2f'),_0x4cc2('0x30')]));logger[_0x4cc2('0x25')](_0x4cc2('0x31'),_0x39fe04[_0x4cc2('0x23')],util[_0x4cc2('0x27')](this[_0x4cc2('0x28')][_0x39fe04['uniqueid']][_0x39fe04[_0x4cc2('0x24')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4cc2('0x32'),this['channels'][_0x39fe04[_0x4cc2('0x23')]][_0x39fe04[_0x4cc2('0x24')]]);logger[_0x4cc2('0x25')](_0x4cc2('0x33'),_0x39fe04[_0x4cc2('0x23')],util['inspect'](this['channels'][_0x39fe04['uniqueid']][_0x39fe04['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x4cc2('0x1f')](util[_0x4cc2('0x34')](_0x4cc2('0x35'),_0x39fe04['membername']),_0x4cc2('0x36'),this[_0x4cc2('0x28')][_0x39fe04[_0x4cc2('0x23')]][_0x39fe04[_0x4cc2('0x24')]]);}}catch(_0x4bd2de){logger[_0x4cc2('0x37')](_0x4cc2('0x38'),_0x39fe04[_0x4cc2('0x23')],util['inspect'](_0x4bd2de,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')]['syncAgentConnect']=function(_0x31a8f2){try{if(this[_0x4cc2('0x20')](_0x31a8f2)){if(this[_0x4cc2('0x28')][_0x31a8f2['uniqueid']]){logger[_0x4cc2('0x25')](_0x4cc2('0x39'),_0x31a8f2['uniqueid'],util[_0x4cc2('0x27')](_0x31a8f2,{'showHidden':![],'depth':null}));for(var _0x2d6698 in this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]]){if(this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x4cc2('0x3a')](_0x2d6698)){if(_0x31a8f2[_0x4cc2('0x24')]===_0x2d6698){logger[_0x4cc2('0x22')](_0x4cc2('0x3b'),_0x31a8f2[_0x4cc2('0x23')],_0x31a8f2[_0x4cc2('0x3c')],_0x31a8f2[_0x4cc2('0x24')]);this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x3d')]=moment()['format'](_0x4cc2('0x29'));this['channels'][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x3e')]=_0x31a8f2[_0x4cc2('0x3e')];this['channels'][_0x31a8f2['uniqueid']][_0x2d6698][_0x4cc2('0x3f')]=_0x31a8f2[_0x4cc2('0x3f')];this['channels'][_0x31a8f2['uniqueid']][_0x2d6698][_0x4cc2('0x40')]=_0x31a8f2[_0x4cc2('0x40')];this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698]['destchannelstatedesc']=_0x31a8f2[_0x4cc2('0x41')];this[_0x4cc2('0x28')][_0x31a8f2['uniqueid']][_0x2d6698][_0x4cc2('0x42')]=_0x31a8f2[_0x4cc2('0x42')];this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x43')]='connect';if(this[_0x4cc2('0xa')][this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x23')]]){var _0x18602a=this[_0x4cc2('0xa')][this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x23')]]['routealias'];this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x44')]=_0x18602a;_0x31a8f2['routealias']=_0x18602a;}_[_0x4cc2('0x45')](this[_0x4cc2('0xc')][_0x31a8f2['interface']],_['pick'](_0x31a8f2,[_0x4cc2('0x2b'),'destconnectedlinenum',_0x4cc2('0x44')]));logger[_0x4cc2('0x25')](_0x4cc2('0x46'),_0x31a8f2['uniqueid'],util[_0x4cc2('0x27')](this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x31a8f2[_0x4cc2('0x24')]],{'showHidden':![],'depth':null}));ami[_0x4cc2('0x1f')](_0x4cc2('0x47'),this[_0x4cc2('0x28')][_0x31a8f2['uniqueid']][_0x31a8f2[_0x4cc2('0x24')]]);logger[_0x4cc2('0x25')](_0x4cc2('0x48'),_0x31a8f2[_0x4cc2('0x23')],util[_0x4cc2('0x27')](this[_0x4cc2('0x28')][_0x31a8f2['uniqueid']][_0x31a8f2[_0x4cc2('0x24')]],{'showHidden':![],'depth':null}));this[_0x4cc2('0x1f')](util[_0x4cc2('0x34')](_0x4cc2('0x35'),_0x31a8f2[_0x4cc2('0x3c')]),'user:agentconnect',this['channels'][_0x31a8f2[_0x4cc2('0x23')]][_0x31a8f2[_0x4cc2('0x24')]]);}else if(!this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x10')]&&!this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698]['agentcomplete']){logger[_0x4cc2('0x22')](_0x4cc2('0x49'),_0x31a8f2[_0x4cc2('0x23')],this['channels'][_0x31a8f2['uniqueid']][_0x2d6698]['membername'],_0x2d6698);this[_0x4cc2('0x28')][_0x31a8f2['uniqueid']][_0x2d6698][_0x4cc2('0x10')]=!![];this['channels'][_0x31a8f2['uniqueid']][_0x2d6698][_0x4cc2('0x4a')]=moment()[_0x4cc2('0x34')](_0x4cc2('0x29'));this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x4b')]=_0x31a8f2[_0x4cc2('0x24')];this['channels'][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698]['answeredelsewheremembername']=_0x31a8f2['membername'];this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698][_0x4cc2('0x43')]=_0x4cc2('0x4c');this[_0x4cc2('0x28')][_0x31a8f2['uniqueid']][_0x2d6698][_0x4cc2('0x4d')]=_0x4cc2('0x4c');logger[_0x4cc2('0x25')](_0x4cc2('0x4e'),_0x31a8f2['uniqueid'],util['inspect'](this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698],{'showHidden':![],'depth':null}));ami[_0x4cc2('0x1f')](_0x4cc2('0x4f'),this[_0x4cc2('0x28')][_0x31a8f2[_0x4cc2('0x23')]][_0x2d6698]);}}}}}}catch(_0x19fcce){logger[_0x4cc2('0x37')](_0x4cc2('0x50'),_0x31a8f2[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x19fcce,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4cc2('0x11')]=function(_0x3a0ad9){try{if(this[_0x4cc2('0x20')](_0x3a0ad9)){logger['debug'](_0x4cc2('0x51'),_0x3a0ad9[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x3a0ad9,{'showHidden':![],'depth':null}));if(this[_0x4cc2('0x28')][_0x3a0ad9['uniqueid']]&&this[_0x4cc2('0x28')][_0x3a0ad9[_0x4cc2('0x23')]][_0x3a0ad9['destuniqueid']]){logger[_0x4cc2('0x22')](_0x4cc2('0x52'),_0x3a0ad9['uniqueid'],_0x3a0ad9['membername'],_0x3a0ad9['destuniqueid']);this['channels'][_0x3a0ad9[_0x4cc2('0x23')]][_0x3a0ad9[_0x4cc2('0x24')]][_0x4cc2('0x10')]=!![];this['channels'][_0x3a0ad9[_0x4cc2('0x23')]][_0x3a0ad9['destuniqueid']][_0x4cc2('0x4a')]=moment()[_0x4cc2('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4cc2('0x28')][_0x3a0ad9[_0x4cc2('0x23')]][_0x3a0ad9[_0x4cc2('0x24')]][_0x4cc2('0x43')]=_0x4cc2('0x53');this[_0x4cc2('0x28')][_0x3a0ad9[_0x4cc2('0x23')]][_0x3a0ad9[_0x4cc2('0x24')]][_0x4cc2('0x4d')]=_0x4cc2('0x53');logger[_0x4cc2('0x25')](_0x4cc2('0x54'),_0x3a0ad9['uniqueid'],util[_0x4cc2('0x27')](this[_0x4cc2('0x28')][_0x3a0ad9['uniqueid']][_0x3a0ad9[_0x4cc2('0x24')]],{'showHidden':![],'depth':null}));ami[_0x4cc2('0x1f')](_0x4cc2('0x55'),this[_0x4cc2('0x28')][_0x3a0ad9[_0x4cc2('0x23')]][_0x3a0ad9[_0x4cc2('0x24')]]);}}}catch(_0x77b167){logger[_0x4cc2('0x37')]('[%s][voiceAgentReport][agentringnoanswer]',_0x3a0ad9['uniqueid'],util[_0x4cc2('0x27')](_0x77b167,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x13')]=function(_0x4d4918){try{if(this[_0x4cc2('0x20')](_0x4d4918)){logger[_0x4cc2('0x25')](_0x4cc2('0x56'),_0x4d4918['uniqueid'],util[_0x4cc2('0x27')](_0x4d4918,{'showHidden':![],'depth':null}));if(this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]]){for(var _0x173618 in this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]]){if(this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]][_0x4cc2('0x3a')](_0x173618)&&!this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]][_0x173618][_0x4cc2('0x10')]&&!this['channels'][_0x4d4918['uniqueid']][_0x173618][_0x4cc2('0x14')]){logger[_0x4cc2('0x22')](_0x4cc2('0x57'),_0x4d4918[_0x4cc2('0x23')],this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]][_0x173618][_0x4cc2('0x3c')],_0x173618);this[_0x4cc2('0x28')][_0x4d4918['uniqueid']][_0x173618][_0x4cc2('0x10')]=!![];this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]][_0x173618][_0x4cc2('0x4a')]=moment()[_0x4cc2('0x34')](_0x4cc2('0x29'));this[_0x4cc2('0x28')][_0x4d4918['uniqueid']][_0x173618][_0x4cc2('0x43')]=_0x4cc2('0x58');this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]][_0x173618][_0x4cc2('0x4d')]=_0x4cc2('0x58');logger[_0x4cc2('0x25')](_0x4cc2('0x59'),_0x4d4918[_0x4cc2('0x23')],util[_0x4cc2('0x27')](this['channels'][_0x4d4918[_0x4cc2('0x23')]][_0x173618],{'showHidden':![],'depth':null}));ami['emit'](_0x4cc2('0x5a'),this[_0x4cc2('0x28')][_0x4d4918[_0x4cc2('0x23')]][_0x173618]);}}}}}catch(_0x35b683){logger[_0x4cc2('0x37')](_0x4cc2('0x5b'),_0x4d4918[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x35b683,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x5c')]=function(_0x341cdc){try{if(this[_0x4cc2('0x20')](_0x341cdc)){logger[_0x4cc2('0x25')](_0x4cc2('0x5d'),_0x341cdc['uniqueid'],util[_0x4cc2('0x27')](_0x341cdc,{'showHidden':![],'depth':null}));if(this[_0x4cc2('0x28')][_0x341cdc['uniqueid']]){for(var _0x1a141a in this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]]){if(this[_0x4cc2('0x28')][_0x341cdc['uniqueid']][_0x4cc2('0x3a')](_0x1a141a)){if(this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a][_0x4cc2('0x3d')]&&!this[_0x4cc2('0x28')][_0x341cdc['uniqueid']][_0x1a141a][_0x4cc2('0x14')]){logger[_0x4cc2('0x22')](_0x4cc2('0x5e'),_0x341cdc[_0x4cc2('0x23')],this['channels'][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a][_0x4cc2('0x3c')],_0x1a141a);this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a]['agentcomplete']=!![];this['channels'][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a][_0x4cc2('0x5f')]=moment()[_0x4cc2('0x34')](_0x4cc2('0x29'));this['channels'][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a][_0x4cc2('0x43')]=_0x4cc2('0x60');this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a][_0x4cc2('0x4d')]=_0x341cdc[_0x4cc2('0x4d')]==_0x4cc2('0x61')?'agent':_0x341cdc[_0x4cc2('0x4d')];this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a][_0x4cc2('0x62')]=_0x341cdc[_0x4cc2('0x62')];if(this[_0x4cc2('0xb')][_0x341cdc['queue']]&&this[_0x4cc2('0xb')][_0x341cdc[_0x4cc2('0x2b')]][_0x4cc2('0x63')]){this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a][_0x4cc2('0x64')]=this[_0x4cc2('0xb')][_0x341cdc[_0x4cc2('0x2b')]][_0x4cc2('0x65')];this['channels'][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a]['agentacw']=!![];}this[_0x4cc2('0xc')][_0x341cdc[_0x4cc2('0x66')]]=_['omit'](this[_0x4cc2('0xc')][_0x341cdc[_0x4cc2('0x66')]],[_0x4cc2('0x2b'),_0x4cc2('0x67')]);logger[_0x4cc2('0x25')](_0x4cc2('0x68'),_0x341cdc[_0x4cc2('0x23')],util[_0x4cc2('0x27')](this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a],{'showHidden':![],'depth':null}));ami['emit'](_0x4cc2('0x69'),this[_0x4cc2('0x28')][_0x341cdc['uniqueid']][_0x1a141a]);logger[_0x4cc2('0x25')](_0x4cc2('0x6a'),_0x341cdc[_0x4cc2('0x23')],util[_0x4cc2('0x27')](this[_0x4cc2('0x28')][_0x341cdc[_0x4cc2('0x23')]][_0x1a141a],{'showHidden':![],'depth':null}));this[_0x4cc2('0x1f')](util[_0x4cc2('0x34')]('user:%s',_0x341cdc[_0x4cc2('0x3c')]),_0x4cc2('0x6b'),this[_0x4cc2('0x28')][_0x341cdc['uniqueid']][_0x1a141a]);}}}}}}catch(_0xdc7a82){logger[_0x4cc2('0x37')](_0x4cc2('0x6c'),_0x341cdc['uniqueid'],util['inspect'](_0xdc7a82,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x15')]=function(_0x57efd8){try{if(this[_0x4cc2('0x20')](_0x57efd8)){logger[_0x4cc2('0x25')](_0x4cc2('0x6d'),_0x57efd8[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x57efd8,{'showHidden':![],'depth':null}));this[_0x4cc2('0x6e')](_0x57efd8[_0x4cc2('0x23')],_[_0x4cc2('0x6f')](_0x57efd8[_0x4cc2('0x70')])[0x0],_0x57efd8[_0x4cc2('0x71')]);if(this[_0x4cc2('0x28')][_0x57efd8[_0x4cc2('0x23')]]){for(var _0x226e3e in this[_0x4cc2('0x28')][_0x57efd8[_0x4cc2('0x23')]]){if(this[_0x4cc2('0x28')][_0x57efd8[_0x4cc2('0x23')]][_0x4cc2('0x3a')](_0x226e3e)){logger[_0x4cc2('0x22')](_0x4cc2('0x72'),_0x57efd8[_0x4cc2('0x23')],_0x226e3e,_['keys'](_0x57efd8[_0x4cc2('0x70')])[0x0],_0x57efd8[_0x4cc2('0x71')]);if(_[_0x4cc2('0x21')](this[_0x4cc2('0x28')][_0x57efd8['uniqueid']][_0x226e3e]['variables'])){this[_0x4cc2('0x28')][_0x57efd8[_0x4cc2('0x23')]][_0x226e3e][_0x4cc2('0xd')]={};}this[_0x4cc2('0x28')][_0x57efd8['uniqueid']][_0x226e3e]['variables']=this['variables'][_0x57efd8[_0x4cc2('0x23')]];}}}}}catch(_0x5b3bf6){logger['error'](_0x4cc2('0x73'),_0x57efd8['uniqueid'],util[_0x4cc2('0x27')](_0x5b3bf6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x6e')]=function(_0x3f5588,_0x577b05,_0x38ff0b){var _0x10c5b9=[_0x4cc2('0x74'),_0x4cc2('0x75'),_0x4cc2('0x76'),_0x4cc2('0x77'),_0x4cc2('0x78'),_0x4cc2('0x79'),_0x4cc2('0x7a'),_0x4cc2('0x7b'),_0x4cc2('0x7c'),_0x4cc2('0x7d'),_0x4cc2('0x7e'),'bridgepvtcallid',_0x4cc2('0x7f'),_0x4cc2('0x80'),_0x4cc2('0x81'),'memberlastcall',_0x4cc2('0x3c'),_0x4cc2('0x82'),_0x4cc2('0x83')];if(!_[_0x4cc2('0x84')](_0x577b05)&&!_[_0x4cc2('0x85')](_0x10c5b9,_0x577b05)){if(_[_0x4cc2('0x21')](this[_0x4cc2('0xd')][_0x3f5588])){this['variables'][_0x3f5588]={};}this[_0x4cc2('0xd')][_0x3f5588][_0x577b05]=_0x38ff0b;}};VoiceAgentReport['prototype'][_0x4cc2('0x17')]=function(_0x611908){try{if(this[_0x4cc2('0x20')](_0x611908)){logger[_0x4cc2('0x25')](_0x4cc2('0x86'),_0x611908[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x611908,{'showHidden':![],'depth':null}));if(this['channels'][_0x611908[_0x4cc2('0x23')]]){for(var _0x36d281 in this[_0x4cc2('0x28')][_0x611908[_0x4cc2('0x23')]]){if(this[_0x4cc2('0x28')][_0x611908[_0x4cc2('0x23')]][_0x4cc2('0x3a')](_0x36d281)){if(this[_0x4cc2('0x28')][_0x611908[_0x4cc2('0x23')]][_0x36d281][_0x4cc2('0x4d')]==_0x4cc2('0x61')&&this[_0x4cc2('0x28')][_0x611908['uniqueid']][_0x36d281][_0x4cc2('0x14')]){logger['info'](_0x4cc2('0x87'),_0x611908[_0x4cc2('0x23')],_0x36d281);this[_0x4cc2('0x28')][_0x611908[_0x4cc2('0x23')]][_0x36d281][_0x4cc2('0x5f')]=moment()[_0x4cc2('0x34')](_0x4cc2('0x29'));}}}logger[_0x4cc2('0x25')](_0x4cc2('0x88'),_0x611908[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_['values'](this[_0x4cc2('0x28')][_0x611908[_0x4cc2('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x4cc2('0x1f')](_0x4cc2('0x89'),_['values'](this[_0x4cc2('0x28')][_0x611908[_0x4cc2('0x23')]]));delete this[_0x4cc2('0x28')][_0x611908[_0x4cc2('0x23')]];}if(this['variables'][_0x611908[_0x4cc2('0x23')]]){delete this[_0x4cc2('0xd')][_0x611908[_0x4cc2('0x23')]];}}}catch(_0x373069){logger[_0x4cc2('0x37')](_0x4cc2('0x8a'),_0x611908['uniqueid'],util[_0x4cc2('0x27')](_0x373069,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x14bbcb){try{if(this[_0x4cc2('0x20')](_0x14bbcb)){logger[_0x4cc2('0x25')](_0x4cc2('0x8b'),_0x14bbcb['uniqueid'],util[_0x4cc2('0x27')](_0x14bbcb,{'showHidden':![],'depth':null}));if(this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]]){for(var _0x4e4510 in this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]]){if(this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]][_0x4cc2('0x3a')](_0x4e4510)){if(_0x14bbcb[_0x4cc2('0x8d')]===_0x4e4510){logger[_0x4cc2('0x22')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x14bbcb[_0x4cc2('0x23')],this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]][_0x4e4510][_0x4cc2('0x3c')],_0x4e4510);var _0x1fe0ac=moment();this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]][_0x4e4510][_0x4cc2('0x14')]=!![];this['channels'][_0x14bbcb['transfereeuniqueid']][_0x4e4510][_0x4cc2('0x5f')]=moment()[_0x4cc2('0x34')](_0x4cc2('0x29'));this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]][_0x4e4510][_0x4cc2('0x43')]=_0x4cc2('0x60');this['channels'][_0x14bbcb[_0x4cc2('0x8c')]][_0x4e4510][_0x4cc2('0x4d')]=_0x4cc2('0x61');this['channels'][_0x14bbcb[_0x4cc2('0x8c')]][_0x4e4510][_0x4cc2('0x62')]=_0x1fe0ac[_0x4cc2('0x8e')](this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]][_0x4e4510][_0x4cc2('0x3d')],_0x4cc2('0x8f'));}}}}if(this['channels'][_0x14bbcb[_0x4cc2('0x90')]]){var _0x4df6ee=this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x90')]];this[_0x4cc2('0x28')][_0x14bbcb['secondtransfereruniqueid']]=this[_0x4cc2('0x28')][_0x14bbcb['transfereeuniqueid']];this[_0x4cc2('0x28')][_0x14bbcb[_0x4cc2('0x8c')]]=_0x4df6ee;}}}catch(_0x19ae54){logger[_0x4cc2('0x37')](_0x4cc2('0x91'),_0x14bbcb['uniqueid'],util[_0x4cc2('0x27')](_0x19ae54,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x1d')]=function(_0x4b7bc9){try{if(this['isNotNull'](_0x4b7bc9)){logger[_0x4cc2('0x25')](_0x4cc2('0x92'),_0x4b7bc9[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x4b7bc9,{'showHidden':![],'depth':null}));if(this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]]){for(var _0x440857 in this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]]){if(this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]][_0x4cc2('0x3a')](_0x440857)){if(_0x4b7bc9[_0x4cc2('0x93')]===_0x440857){logger[_0x4cc2('0x22')](_0x4cc2('0x94'),_0x4b7bc9[_0x4cc2('0x23')],this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]][_0x440857][_0x4cc2('0x3c')],_0x440857);var _0x49e1d6=moment();this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]][_0x440857][_0x4cc2('0x14')]=!![];this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]][_0x440857]['agentcompleteAt']=_0x49e1d6;this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]][_0x440857]['lastevent']=_0x4cc2('0x60');this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]][_0x440857]['reason']=_0x4cc2('0x61');this[_0x4cc2('0x28')][_0x4b7bc9[_0x4cc2('0x8c')]][_0x440857][_0x4cc2('0x62')]=_0x49e1d6[_0x4cc2('0x8e')](this[_0x4cc2('0x28')][_0x4b7bc9['transfereeuniqueid']][_0x440857]['agentconnectAt'],'seconds');}}}}}}catch(_0x3c1436){logger[_0x4cc2('0x37')]('[%s][voiceAgentReport][blindtransfer]',_0x4b7bc9['uniqueid'],util[_0x4cc2('0x27')](_0x3c1436,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x18')]=function(_0x5cbd9c){var _0x50ee4='';try{if(this[_0x4cc2('0x20')](_0x5cbd9c)){logger[_0x4cc2('0x25')](_0x4cc2('0x95'),_0x5cbd9c[_0x4cc2('0x23')],util['inspect'](_0x5cbd9c,{'showHidden':![],'depth':null}));if(_0x5cbd9c[_0x4cc2('0x96')]){_0x50ee4=_0x5cbd9c[_0x4cc2('0x96')][_0x4cc2('0x97')](0x0,_0x5cbd9c['channel']['lastIndexOf']('-'));if(this['agents'][_0x50ee4]){logger[_0x4cc2('0x22')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x5cbd9c[_0x4cc2('0x23')],_0x50ee4);this[_0x4cc2('0xc')][_0x50ee4][_0x4cc2('0x98')]=!![];}}}}catch(_0x48b4e1){logger[_0x4cc2('0x37')](_0x4cc2('0x99'),_0x5cbd9c[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x48b4e1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4cc2('0x1e')][_0x4cc2('0x1a')]=function(_0x38db92){var _0x78f6a7='';try{if(this[_0x4cc2('0x20')](_0x38db92)){logger[_0x4cc2('0x25')](_0x4cc2('0x9a'),_0x38db92[_0x4cc2('0x23')],util[_0x4cc2('0x27')](_0x38db92,{'showHidden':![],'depth':null}));if(_0x38db92[_0x4cc2('0x96')]){_0x78f6a7=_0x38db92[_0x4cc2('0x96')][_0x4cc2('0x97')](0x0,_0x38db92['channel'][_0x4cc2('0x9b')]('-'));if(this[_0x4cc2('0xc')][_0x78f6a7]){logger[_0x4cc2('0x22')](_0x4cc2('0x9c'),_0x38db92[_0x4cc2('0x23')],_0x78f6a7);this['agents'][_0x78f6a7]['onhold']=![];}}}}catch(_0x26aa02){logger[_0x4cc2('0x37')](_0x4cc2('0x9d'),_0x38db92['uniqueid'],util[_0x4cc2('0x27')](_0x26aa02,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xc5c8=['../ami','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agentcalled','syncAgentCalled','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','syncVarSet','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','variables','voice','omit','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','inspect','user:%s','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','connect','routealias','merge','agents','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','agentcompleteAt','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','complete','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','[%s][voiceAgentReport][blindtransfer]','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','lodash','moment','util','../../../config/environment'];(function(_0x5326c3,_0x4a172f){var _0x139bc8=function(_0x3f981e){while(--_0x3f981e){_0x5326c3['push'](_0x5326c3['shift']());}};_0x139bc8(++_0x4a172f);}(_0xc5c8,0x118));var _0x8c5c=function(_0x2c2bcb,_0x1c576b){_0x2c2bcb=_0x2c2bcb-0x0;var _0x28cfa9=_0xc5c8[_0x2c2bcb];return _0x28cfa9;};'use strict';var _=require(_0x8c5c('0x0'));var moment=require(_0x8c5c('0x1'));var util=require(_0x8c5c('0x2'));var Redis=require('ioredis');var config=require(_0x8c5c('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x8c5c('0x4'));config[_0x8c5c('0x5')]=_['defaults'](config[_0x8c5c('0x5')],{'host':_0x8c5c('0x6'),'port':0x18eb});var io=require(_0x8c5c('0x7'))(new Redis(config[_0x8c5c('0x5')]));function VoiceAgentReport(_0x1ae0a1){this[_0x8c5c('0x8')]={};this[_0x8c5c('0x9')]=_0x1ae0a1[_0x8c5c('0x8')];this[_0x8c5c('0xa')]=_0x1ae0a1[_0x8c5c('0xa')];this['agents']=_0x1ae0a1['agents'];this['variables']={};ami['on'](_0x8c5c('0xb'),this[_0x8c5c('0xc')]['bind'](this));ami['on']('agentconnect',this[_0x8c5c('0xd')][_0x8c5c('0xe')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x8c5c('0xe')](this));ami['on'](_0x8c5c('0xf'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x8c5c('0x10'),this[_0x8c5c('0x11')][_0x8c5c('0xe')](this));ami['on']('varset',this[_0x8c5c('0x12')][_0x8c5c('0xe')](this));ami['on']('hangup',this['syncHangup'][_0x8c5c('0xe')](this));ami['on']('musiconholdstart',this[_0x8c5c('0x13')][_0x8c5c('0xe')](this));ami['on'](_0x8c5c('0x14'),this[_0x8c5c('0x15')][_0x8c5c('0xe')](this));ami['on'](_0x8c5c('0x16'),this[_0x8c5c('0x17')][_0x8c5c('0xe')](this));ami['on'](_0x8c5c('0x18'),this[_0x8c5c('0x19')]['bind'](this));}VoiceAgentReport['prototype']['emit']=function(_0x56a434,_0x57d68c,_0x53c6ad){io['to'](_0x56a434)[_0x8c5c('0x1a')](_0x57d68c,_0x53c6ad);};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0x1c')]=function(_0x24d15c){return _0x24d15c!==null&&!_[_0x8c5c('0x1d')](_0x24d15c);};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0xc')]=function(_0xac22f9){try{if(this[_0x8c5c('0x1c')](_0xac22f9)){logger[_0x8c5c('0x1e')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xac22f9[_0x8c5c('0x1f')],_0xac22f9[_0x8c5c('0x20')],_0xac22f9[_0x8c5c('0x21')]);logger['debug'](_0x8c5c('0x22'),_0xac22f9['uniqueid'],util['inspect'](_0xac22f9,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x8c5c('0x8')][_0xac22f9[_0x8c5c('0x1f')]])){this[_0x8c5c('0x8')][_0xac22f9[_0x8c5c('0x1f')]]={};}if(_[_0x8c5c('0x1d')](this['channels'][_0xac22f9['uniqueid']][_0xac22f9['destuniqueid']])){this[_0x8c5c('0x8')][_0xac22f9[_0x8c5c('0x1f')]][_0xac22f9[_0x8c5c('0x21')]]={'agentcalledAt':moment()[_0x8c5c('0x23')](_0x8c5c('0x24')),'lastevent':_0x8c5c('0x25'),'mandatoryDisposition':this[_0x8c5c('0xa')][_0xac22f9[_0x8c5c('0x26')]]?this[_0x8c5c('0xa')][_0xac22f9[_0x8c5c('0x26')]][_0x8c5c('0x27')]||![]:![],'type':this[_0x8c5c('0xa')][_0xac22f9[_0x8c5c('0x26')]]?this['voiceQueues'][_0xac22f9[_0x8c5c('0x26')]]['type']||_0x8c5c('0x28'):_0x8c5c('0x28'),'variables':this[_0x8c5c('0x29')][_0xac22f9[_0x8c5c('0x1f')]],'motionChannel':_0x8c5c('0x2a')};}_['merge'](this['channels'][_0xac22f9[_0x8c5c('0x1f')]][_0xac22f9[_0x8c5c('0x21')]],_[_0x8c5c('0x2b')](_0xac22f9,[_0x8c5c('0x2c'),'privilege']));logger[_0x8c5c('0x2d')](_0x8c5c('0x2e'),_0xac22f9[_0x8c5c('0x1f')],util['inspect'](this['channels'][_0xac22f9[_0x8c5c('0x1f')]][_0xac22f9[_0x8c5c('0x21')]],{'showHidden':![],'depth':null}));ami[_0x8c5c('0x1a')](_0x8c5c('0x2f'),this['channels'][_0xac22f9[_0x8c5c('0x1f')]][_0xac22f9[_0x8c5c('0x21')]]);logger[_0x8c5c('0x2d')](_0x8c5c('0x30'),_0xac22f9[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](this['channels'][_0xac22f9[_0x8c5c('0x1f')]][_0xac22f9[_0x8c5c('0x21')]],{'showHidden':![],'depth':null}));this[_0x8c5c('0x1a')](util[_0x8c5c('0x23')](_0x8c5c('0x32'),_0xac22f9[_0x8c5c('0x20')]),'user:called',this[_0x8c5c('0x8')][_0xac22f9[_0x8c5c('0x1f')]][_0xac22f9[_0x8c5c('0x21')]]);}}catch(_0x5db249){logger[_0x8c5c('0x33')](_0x8c5c('0x34'),_0xac22f9[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0x5db249,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0xd')]=function(_0x2d9273){try{if(this[_0x8c5c('0x1c')](_0x2d9273)){if(this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]]){logger['debug'](_0x8c5c('0x35'),_0x2d9273[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0x2d9273,{'showHidden':![],'depth':null}));for(var _0x1fc438 in this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]]){if(this['channels'][_0x2d9273[_0x8c5c('0x1f')]][_0x8c5c('0x36')](_0x1fc438)){if(_0x2d9273['destuniqueid']===_0x1fc438){logger[_0x8c5c('0x1e')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2d9273['uniqueid'],_0x2d9273[_0x8c5c('0x20')],_0x2d9273[_0x8c5c('0x21')]);this['channels'][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x37')]=moment()['format'](_0x8c5c('0x24'));this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x38')]=_0x2d9273[_0x8c5c('0x38')];this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438]['connectedlinenum']=_0x2d9273[_0x8c5c('0x39')];this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438]['destchannelstate']=_0x2d9273['destchannelstate'];this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x3a')]=_0x2d9273['destchannelstatedesc'];this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x3b')]=_0x2d9273['holdtime'];this[_0x8c5c('0x8')][_0x2d9273['uniqueid']][_0x1fc438]['lastevent']=_0x8c5c('0x3c');if(this['voiceChannels'][this[_0x8c5c('0x8')][_0x2d9273['uniqueid']][_0x1fc438][_0x8c5c('0x1f')]]){var _0x1e00ba=this[_0x8c5c('0x9')][this[_0x8c5c('0x8')][_0x2d9273['uniqueid']][_0x1fc438][_0x8c5c('0x1f')]]['routealias'];this['channels'][_0x2d9273['uniqueid']][_0x1fc438][_0x8c5c('0x3d')]=_0x1e00ba;_0x2d9273[_0x8c5c('0x3d')]=_0x1e00ba;}_[_0x8c5c('0x3e')](this[_0x8c5c('0x3f')][_0x2d9273[_0x8c5c('0x40')]],_[_0x8c5c('0x41')](_0x2d9273,['queue',_0x8c5c('0x42'),'routealias']));logger[_0x8c5c('0x2d')](_0x8c5c('0x43'),_0x2d9273[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](this[_0x8c5c('0x8')][_0x2d9273['uniqueid']][_0x2d9273[_0x8c5c('0x21')]],{'showHidden':![],'depth':null}));ami[_0x8c5c('0x1a')](_0x8c5c('0x44'),this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x2d9273[_0x8c5c('0x21')]]);logger[_0x8c5c('0x2d')](_0x8c5c('0x45'),_0x2d9273['uniqueid'],util['inspect'](this['channels'][_0x2d9273[_0x8c5c('0x1f')]][_0x2d9273[_0x8c5c('0x21')]],{'showHidden':![],'depth':null}));this[_0x8c5c('0x1a')](util['format'](_0x8c5c('0x32'),_0x2d9273[_0x8c5c('0x20')]),'user:agentconnect',this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x2d9273[_0x8c5c('0x21')]]);}else if(!this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438]['agentringnoanswer']&&!this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x10')]){logger[_0x8c5c('0x1e')](_0x8c5c('0x46'),_0x2d9273[_0x8c5c('0x1f')],this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x20')],_0x1fc438);this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x47')]=!![];this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x48')]=moment()['format'](_0x8c5c('0x24'));this['channels'][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x49')]=_0x2d9273['destuniqueid'];this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x4a')]=_0x2d9273[_0x8c5c('0x20')];this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438][_0x8c5c('0x4b')]=_0x8c5c('0x4c');this['channels'][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438]['reason']=_0x8c5c('0x4c');logger[_0x8c5c('0x2d')](_0x8c5c('0x4d'),_0x2d9273[_0x8c5c('0x1f')],util['inspect'](this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438],{'showHidden':![],'depth':null}));ami[_0x8c5c('0x1a')](_0x8c5c('0x4e'),this[_0x8c5c('0x8')][_0x2d9273[_0x8c5c('0x1f')]][_0x1fc438]);}}}}}}catch(_0x4c531e){logger[_0x8c5c('0x33')]('[%s][voiceAgentReport][agentconnect]',_0x2d9273['uniqueid'],util[_0x8c5c('0x31')](_0x4c531e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0x4f')]=function(_0x1544a6){try{if(this[_0x8c5c('0x1c')](_0x1544a6)){logger[_0x8c5c('0x2d')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x1544a6[_0x8c5c('0x1f')],util['inspect'](_0x1544a6,{'showHidden':![],'depth':null}));if(this[_0x8c5c('0x8')][_0x1544a6[_0x8c5c('0x1f')]]&&this[_0x8c5c('0x8')][_0x1544a6[_0x8c5c('0x1f')]][_0x1544a6[_0x8c5c('0x21')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x1544a6[_0x8c5c('0x1f')],_0x1544a6[_0x8c5c('0x20')],_0x1544a6[_0x8c5c('0x21')]);this['channels'][_0x1544a6['uniqueid']][_0x1544a6[_0x8c5c('0x21')]][_0x8c5c('0x47')]=!![];this['channels'][_0x1544a6['uniqueid']][_0x1544a6['destuniqueid']][_0x8c5c('0x48')]=moment()[_0x8c5c('0x23')](_0x8c5c('0x24'));this[_0x8c5c('0x8')][_0x1544a6['uniqueid']][_0x1544a6['destuniqueid']][_0x8c5c('0x4b')]=_0x8c5c('0x50');this['channels'][_0x1544a6[_0x8c5c('0x1f')]][_0x1544a6[_0x8c5c('0x21')]][_0x8c5c('0x51')]=_0x8c5c('0x50');logger[_0x8c5c('0x2d')](_0x8c5c('0x52'),_0x1544a6[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](this[_0x8c5c('0x8')][_0x1544a6[_0x8c5c('0x1f')]][_0x1544a6[_0x8c5c('0x21')]],{'showHidden':![],'depth':null}));ami[_0x8c5c('0x1a')](_0x8c5c('0x53'),this[_0x8c5c('0x8')][_0x1544a6['uniqueid']][_0x1544a6['destuniqueid']]);}}}catch(_0xde09ed){logger[_0x8c5c('0x33')](_0x8c5c('0x54'),_0x1544a6[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0xde09ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c5c('0x1b')]['syncQueueCallerAbandon']=function(_0x2803be){try{if(this[_0x8c5c('0x1c')](_0x2803be)){logger[_0x8c5c('0x2d')](_0x8c5c('0x55'),_0x2803be['uniqueid'],util[_0x8c5c('0x31')](_0x2803be,{'showHidden':![],'depth':null}));if(this[_0x8c5c('0x8')][_0x2803be[_0x8c5c('0x1f')]]){for(var _0x574248 in this['channels'][_0x2803be[_0x8c5c('0x1f')]]){if(this[_0x8c5c('0x8')][_0x2803be['uniqueid']][_0x8c5c('0x36')](_0x574248)&&!this[_0x8c5c('0x8')][_0x2803be[_0x8c5c('0x1f')]][_0x574248]['agentringnoanswer']&&!this[_0x8c5c('0x8')][_0x2803be['uniqueid']][_0x574248]['agentcomplete']){logger[_0x8c5c('0x1e')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2803be[_0x8c5c('0x1f')],this[_0x8c5c('0x8')][_0x2803be[_0x8c5c('0x1f')]][_0x574248][_0x8c5c('0x20')],_0x574248);this[_0x8c5c('0x8')][_0x2803be[_0x8c5c('0x1f')]][_0x574248][_0x8c5c('0x47')]=!![];this[_0x8c5c('0x8')][_0x2803be[_0x8c5c('0x1f')]][_0x574248]['agentringnoanswerAt']=moment()[_0x8c5c('0x23')](_0x8c5c('0x24'));this[_0x8c5c('0x8')][_0x2803be[_0x8c5c('0x1f')]][_0x574248]['lastevent']='abandoned';this[_0x8c5c('0x8')][_0x2803be[_0x8c5c('0x1f')]][_0x574248]['reason']=_0x8c5c('0x56');logger[_0x8c5c('0x2d')](_0x8c5c('0x57'),_0x2803be['uniqueid'],util['inspect'](this['channels'][_0x2803be[_0x8c5c('0x1f')]][_0x574248],{'showHidden':![],'depth':null}));ami[_0x8c5c('0x1a')](_0x8c5c('0x58'),this['channels'][_0x2803be['uniqueid']][_0x574248]);}}}}}catch(_0xc0129a){logger[_0x8c5c('0x33')](_0x8c5c('0x59'),_0x2803be['uniqueid'],util[_0x8c5c('0x31')](_0xc0129a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c5c('0x1b')]['syncAgentComplete']=function(_0x193c42){try{if(this[_0x8c5c('0x1c')](_0x193c42)){logger[_0x8c5c('0x2d')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x193c42[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0x193c42,{'showHidden':![],'depth':null}));if(this['channels'][_0x193c42[_0x8c5c('0x1f')]]){for(var _0x410b8a in this[_0x8c5c('0x8')][_0x193c42['uniqueid']]){if(this['channels'][_0x193c42['uniqueid']][_0x8c5c('0x36')](_0x410b8a)){if(this['channels'][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a]['agentconnectAt']&&!this[_0x8c5c('0x8')][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a][_0x8c5c('0x10')]){logger[_0x8c5c('0x1e')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x193c42[_0x8c5c('0x1f')],this['channels'][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a]['membername'],_0x410b8a);this['channels'][_0x193c42['uniqueid']][_0x410b8a][_0x8c5c('0x10')]=!![];this[_0x8c5c('0x8')][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a][_0x8c5c('0x5a')]=moment()[_0x8c5c('0x23')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8c5c('0x8')][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a][_0x8c5c('0x4b')]='complete';this[_0x8c5c('0x8')][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a][_0x8c5c('0x51')]=_0x193c42[_0x8c5c('0x51')]==_0x8c5c('0x5b')?_0x8c5c('0x5c'):_0x193c42[_0x8c5c('0x51')];this[_0x8c5c('0x8')][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a][_0x8c5c('0x5d')]=_0x193c42['talktime'];if(this[_0x8c5c('0xa')][_0x193c42[_0x8c5c('0x26')]]&&this[_0x8c5c('0xa')][_0x193c42['queue']][_0x8c5c('0x5e')]){this[_0x8c5c('0x8')][_0x193c42['uniqueid']][_0x410b8a][_0x8c5c('0x5f')]=this[_0x8c5c('0xa')][_0x193c42['queue']][_0x8c5c('0x60')];this[_0x8c5c('0x8')][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a][_0x8c5c('0x61')]=!![];}this[_0x8c5c('0x3f')][_0x193c42['interface']]=_[_0x8c5c('0x2b')](this[_0x8c5c('0x3f')][_0x193c42[_0x8c5c('0x40')]],[_0x8c5c('0x26'),_0x8c5c('0x42')]);logger[_0x8c5c('0x2d')](_0x8c5c('0x62'),_0x193c42[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](this[_0x8c5c('0x8')][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a],{'showHidden':![],'depth':null}));ami['emit'](_0x8c5c('0x63'),this[_0x8c5c('0x8')][_0x193c42['uniqueid']][_0x410b8a]);logger[_0x8c5c('0x2d')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x193c42[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](this[_0x8c5c('0x8')][_0x193c42['uniqueid']][_0x410b8a],{'showHidden':![],'depth':null}));this[_0x8c5c('0x1a')](util['format'](_0x8c5c('0x32'),_0x193c42['membername']),'user:agentcomplete',this['channels'][_0x193c42[_0x8c5c('0x1f')]][_0x410b8a]);}}}}}}catch(_0x32e2ed){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x193c42['uniqueid'],util[_0x8c5c('0x31')](_0x32e2ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x1bbd9d){try{if(this[_0x8c5c('0x1c')](_0x1bbd9d)){logger[_0x8c5c('0x2d')](_0x8c5c('0x64'),_0x1bbd9d[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0x1bbd9d,{'showHidden':![],'depth':null}));this[_0x8c5c('0x65')](_0x1bbd9d[_0x8c5c('0x1f')],_[_0x8c5c('0x66')](_0x1bbd9d[_0x8c5c('0x67')])[0x0],_0x1bbd9d['value']);if(this[_0x8c5c('0x8')][_0x1bbd9d[_0x8c5c('0x1f')]]){for(var _0x401dfb in this['channels'][_0x1bbd9d[_0x8c5c('0x1f')]]){if(this[_0x8c5c('0x8')][_0x1bbd9d[_0x8c5c('0x1f')]][_0x8c5c('0x36')](_0x401dfb)){logger['info'](_0x8c5c('0x68'),_0x1bbd9d[_0x8c5c('0x1f')],_0x401dfb,_[_0x8c5c('0x66')](_0x1bbd9d[_0x8c5c('0x67')])[0x0],_0x1bbd9d['value']);if(_[_0x8c5c('0x1d')](this[_0x8c5c('0x8')][_0x1bbd9d[_0x8c5c('0x1f')]][_0x401dfb][_0x8c5c('0x29')])){this[_0x8c5c('0x8')][_0x1bbd9d[_0x8c5c('0x1f')]][_0x401dfb]['variables']={};}this[_0x8c5c('0x8')][_0x1bbd9d[_0x8c5c('0x1f')]][_0x401dfb]['variables']=this[_0x8c5c('0x29')][_0x1bbd9d['uniqueid']];}}}}}catch(_0x199489){logger[_0x8c5c('0x33')]('[%s][voiceAgentReport][varset]',_0x1bbd9d[_0x8c5c('0x1f')],util['inspect'](_0x199489,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0x65')]=function(_0x51b063,_0x59486f,_0x5dcd64){var _0x3669c5=[_0x8c5c('0x69'),_0x8c5c('0x6a'),_0x8c5c('0x6b'),_0x8c5c('0x6c'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x8c5c('0x6d'),'rtpaudioqosrttbridged',_0x8c5c('0x6e'),_0x8c5c('0x6f'),_0x8c5c('0x70'),_0x8c5c('0x71'),_0x8c5c('0x72'),'memberdynamic',_0x8c5c('0x73'),_0x8c5c('0x74'),_0x8c5c('0x20'),'memberpenalty','memberrealtime'];if(!_[_0x8c5c('0x75')](_0x59486f)&&!_[_0x8c5c('0x76')](_0x3669c5,_0x59486f)){if(_[_0x8c5c('0x1d')](this['variables'][_0x51b063])){this[_0x8c5c('0x29')][_0x51b063]={};}this['variables'][_0x51b063][_0x59486f]=_0x5dcd64;}};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0x77')]=function(_0x198556){try{if(this['isNotNull'](_0x198556)){logger[_0x8c5c('0x2d')](_0x8c5c('0x78'),_0x198556['uniqueid'],util[_0x8c5c('0x31')](_0x198556,{'showHidden':![],'depth':null}));if(this['channels'][_0x198556[_0x8c5c('0x1f')]]){for(var _0x3f5abb in this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]]){if(this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]][_0x8c5c('0x36')](_0x3f5abb)){if(this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]][_0x3f5abb]['reason']==_0x8c5c('0x5b')&&this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]][_0x3f5abb]['agentcomplete']){logger[_0x8c5c('0x1e')](_0x8c5c('0x79'),_0x198556['uniqueid'],_0x3f5abb);this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]][_0x3f5abb][_0x8c5c('0x5a')]=moment()[_0x8c5c('0x23')](_0x8c5c('0x24'));}}}logger['debug'](_0x8c5c('0x7a'),_0x198556[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_['values'](this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]]),{'showHidden':![],'depth':null}));ami[_0x8c5c('0x1a')](_0x8c5c('0x7b'),_['values'](this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]]));delete this[_0x8c5c('0x8')][_0x198556[_0x8c5c('0x1f')]];}if(this[_0x8c5c('0x29')][_0x198556['uniqueid']]){delete this[_0x8c5c('0x29')][_0x198556[_0x8c5c('0x1f')]];}}}catch(_0x4306eb){logger[_0x8c5c('0x33')](_0x8c5c('0x7c'),_0x198556['uniqueid'],util[_0x8c5c('0x31')](_0x4306eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8c5c('0x17')]=function(_0x36e18d){try{if(this[_0x8c5c('0x1c')](_0x36e18d)){logger[_0x8c5c('0x2d')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x36e18d['uniqueid'],util[_0x8c5c('0x31')](_0x36e18d,{'showHidden':![],'depth':null}));if(this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x7d')]]){for(var _0x569948 in this[_0x8c5c('0x8')][_0x36e18d['transfereeuniqueid']]){if(this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x7d')]][_0x8c5c('0x36')](_0x569948)){if(_0x36e18d[_0x8c5c('0x7e')]===_0x569948){logger[_0x8c5c('0x1e')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x36e18d[_0x8c5c('0x1f')],this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x7d')]][_0x569948]['membername'],_0x569948);var _0x47ab8d=moment();this['channels'][_0x36e18d[_0x8c5c('0x7d')]][_0x569948]['agentcomplete']=!![];this['channels'][_0x36e18d[_0x8c5c('0x7d')]][_0x569948]['agentcompleteAt']=moment()[_0x8c5c('0x23')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8c5c('0x8')][_0x36e18d['transfereeuniqueid']][_0x569948]['lastevent']=_0x8c5c('0x7f');this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x7d')]][_0x569948]['reason']=_0x8c5c('0x5b');this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x7d')]][_0x569948][_0x8c5c('0x5d')]=_0x47ab8d['diff'](this[_0x8c5c('0x8')][_0x36e18d['transfereeuniqueid']][_0x569948]['agentconnectAt'],'seconds');}}}}if(this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x80')]]){var _0x2f91ea=this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x80')]];this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x80')]]=this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x7d')]];this[_0x8c5c('0x8')][_0x36e18d[_0x8c5c('0x7d')]]=_0x2f91ea;}}}catch(_0x44fb00){logger[_0x8c5c('0x33')](_0x8c5c('0x81'),_0x36e18d[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0x44fb00,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8c5c('0x19')]=function(_0x4aacd1){try{if(this[_0x8c5c('0x1c')](_0x4aacd1)){logger['debug'](_0x8c5c('0x82'),_0x4aacd1['uniqueid'],util[_0x8c5c('0x31')](_0x4aacd1,{'showHidden':![],'depth':null}));if(this[_0x8c5c('0x8')][_0x4aacd1[_0x8c5c('0x7d')]]){for(var _0x336772 in this[_0x8c5c('0x8')][_0x4aacd1['transfereeuniqueid']]){if(this[_0x8c5c('0x8')][_0x4aacd1[_0x8c5c('0x7d')]][_0x8c5c('0x36')](_0x336772)){if(_0x4aacd1['transfereruniqueid']===_0x336772){logger[_0x8c5c('0x1e')](_0x8c5c('0x83'),_0x4aacd1['uniqueid'],this[_0x8c5c('0x8')][_0x4aacd1[_0x8c5c('0x7d')]][_0x336772][_0x8c5c('0x20')],_0x336772);var _0x4cf183=moment();this[_0x8c5c('0x8')][_0x4aacd1[_0x8c5c('0x7d')]][_0x336772][_0x8c5c('0x10')]=!![];this['channels'][_0x4aacd1[_0x8c5c('0x7d')]][_0x336772][_0x8c5c('0x5a')]=_0x4cf183;this['channels'][_0x4aacd1['transfereeuniqueid']][_0x336772][_0x8c5c('0x4b')]=_0x8c5c('0x7f');this[_0x8c5c('0x8')][_0x4aacd1[_0x8c5c('0x7d')]][_0x336772][_0x8c5c('0x51')]='transfer';this[_0x8c5c('0x8')][_0x4aacd1[_0x8c5c('0x7d')]][_0x336772]['talktime']=_0x4cf183[_0x8c5c('0x84')](this[_0x8c5c('0x8')][_0x4aacd1[_0x8c5c('0x7d')]][_0x336772][_0x8c5c('0x37')],_0x8c5c('0x85'));}}}}}}catch(_0xec3f4c){logger[_0x8c5c('0x33')](_0x8c5c('0x86'),_0x4aacd1['uniqueid'],util['inspect'](_0xec3f4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0x13')]=function(_0x26f864){var _0x5db759='';try{if(this[_0x8c5c('0x1c')](_0x26f864)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x26f864[_0x8c5c('0x1f')],util['inspect'](_0x26f864,{'showHidden':![],'depth':null}));if(_0x26f864[_0x8c5c('0x87')]){_0x5db759=_0x26f864[_0x8c5c('0x87')]['substring'](0x0,_0x26f864[_0x8c5c('0x87')]['lastIndexOf']('-'));if(this[_0x8c5c('0x3f')][_0x5db759]){logger[_0x8c5c('0x1e')](_0x8c5c('0x88'),_0x26f864[_0x8c5c('0x1f')],_0x5db759);this[_0x8c5c('0x3f')][_0x5db759]['onhold']=!![];}}}}catch(_0x1c95c4){logger[_0x8c5c('0x33')](_0x8c5c('0x89'),_0x26f864[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0x1c95c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c5c('0x1b')][_0x8c5c('0x15')]=function(_0x249740){var _0x483b6b='';try{if(this[_0x8c5c('0x1c')](_0x249740)){logger[_0x8c5c('0x2d')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x249740[_0x8c5c('0x1f')],util[_0x8c5c('0x31')](_0x249740,{'showHidden':![],'depth':null}));if(_0x249740[_0x8c5c('0x87')]){_0x483b6b=_0x249740['channel']['substring'](0x0,_0x249740['channel'][_0x8c5c('0x8a')]('-'));if(this[_0x8c5c('0x3f')][_0x483b6b]){logger[_0x8c5c('0x1e')](_0x8c5c('0x8b'),_0x249740['uniqueid'],_0x483b6b);this[_0x8c5c('0x3f')][_0x483b6b][_0x8c5c('0x8c')]=![];}}}}catch(_0xb35af7){logger[_0x8c5c('0x33')]('[%s][voiceAgentReport][musiconholdstop]',_0x249740['uniqueid'],util['inspect'](_0xb35af7,{'showHidden':![],'depth':null}));}};module[_0x8c5c('0x8d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 9034095..66b1859 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 _0xb8d3=['[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','xmd-cdrtype','type','xmd-queue','xmd-destination','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','isEmpty','monitors','getSettings','then','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','set','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','merge','pick','keys','context','from-sip','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','linkedid','OutgoingSpoolFailed','exten','starttime','disposition','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','startsWith','CDR(routeAlias)','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','match','queue','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','toNumber','membername','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','.WAV','find','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8d3,0x1d4));var _0x3b8d=function(_0x4d3329,_0x53e55b){_0x4d3329=_0x4d3329-0x0;var _0x3abb35=_0xb8d3[_0x4d3329];return _0x3abb35;};'use strict';var BPromise=require(_0x3b8d('0x0'));var _=require('lodash');var moment=require('moment');var util=require(_0x3b8d('0x1'));var path=require(_0x3b8d('0x2'));var Redis=require(_0x3b8d('0x3'));var config=require('../../../config/environment');var logger=require(_0x3b8d('0x4'))(_0x3b8d('0x5'));var ami=require(_0x3b8d('0x6'));var Channel=require(_0x3b8d('0x7'));var RpcSetting=require(_0x3b8d('0x8'));var statusDesc=[_0x3b8d('0x9'),_0x3b8d('0xa'),'inuse',_0x3b8d('0xb'),_0x3b8d('0xc'),_0x3b8d('0xd'),_0x3b8d('0xe'),_0x3b8d('0xf'),'onhold'];var applications=[_0x3b8d('0x10'),'queue','agi',_0x3b8d('0x11'),_0x3b8d('0x12'),_0x3b8d('0x13')];var dispositions=[_0x3b8d('0x14'),_0x3b8d('0x15'),_0x3b8d('0x15'),_0x3b8d('0x14'),_0x3b8d('0x14'),_0x3b8d('0x14'),_0x3b8d('0x16'),_0x3b8d('0x17'),_0x3b8d('0x15'),_0x3b8d('0x15'),'FAILED'];var actions={};config[_0x3b8d('0x18')]=_['defaults'](config[_0x3b8d('0x18')],{'host':_0x3b8d('0x19'),'port':0x18eb});var io=require(_0x3b8d('0x1a'))(new Redis(config[_0x3b8d('0x18')]));function VoiceCallReport(_0x20138f){this[_0x3b8d('0x1b')]=_0x20138f[_0x3b8d('0x1b')];this[_0x3b8d('0x1c')]=_0x20138f[_0x3b8d('0x1c')];this['blindTransfers']={};ami['on'](_0x3b8d('0x1d'),this[_0x3b8d('0x1e')][_0x3b8d('0x1f')](this));ami['on'](_0x3b8d('0x20'),this['syncNewExten'][_0x3b8d('0x1f')](this));ami['on']('newchannel',this[_0x3b8d('0x21')]['bind'](this));ami['on'](_0x3b8d('0x22'),this[_0x3b8d('0x23')][_0x3b8d('0x1f')](this));ami['on'](_0x3b8d('0x24'),this[_0x3b8d('0x25')][_0x3b8d('0x1f')](this));ami['on'](_0x3b8d('0x26'),this[_0x3b8d('0x27')][_0x3b8d('0x1f')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x3b8d('0x1f')](this));ami['on'](_0x3b8d('0x28'),this[_0x3b8d('0x29')][_0x3b8d('0x1f')](this));ami['on'](_0x3b8d('0x2a'),this[_0x3b8d('0x2b')][_0x3b8d('0x1f')](this));ami['on'](_0x3b8d('0x2c'),this['syncMusicOnHoldStart'][_0x3b8d('0x1f')](this));ami['on'](_0x3b8d('0x2d'),this[_0x3b8d('0x2e')][_0x3b8d('0x1f')](this));try{logger[_0x3b8d('0x2f')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x3b8d('0x30')]();}catch(_0x3cfcad){logger[_0x3b8d('0x31')](_0x3b8d('0x32'),util[_0x3b8d('0x33')](_0x3cfcad,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3b8d('0x34')]['isNotNull']=function(_0x28ff3a){return _0x28ff3a!==null&&!_[_0x3b8d('0x35')](_0x28ff3a);};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0x36')]=function(_0x54c240,_0x32fa48,_0x1b1fa5){io['to'](_0x54c240)['emit'](_0x32fa48,_0x1b1fa5);};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0x37')]=function(_0x3eb40d){try{if(this['isNotNull'](_0x3eb40d)){logger['info'](_0x3b8d('0x38'),_0x3eb40d['uniqueid'],_0x3eb40d[_0x3b8d('0x39')],_0x3eb40d[_0x3b8d('0x3a')]);logger[_0x3b8d('0x3b')](_0x3b8d('0x3c'),_0x3eb40d[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x3eb40d,{'showHidden':![],'depth':null}));if(_0x3eb40d[_0x3b8d('0x3d')]===_0x3eb40d['linkedid']){if(!_[_0x3b8d('0x35')](this[_0x3b8d('0x1b')][_0x3eb40d[_0x3b8d('0x3d')]])){_[_0x3b8d('0x3e')](this['channels'][_0x3eb40d[_0x3b8d('0x3d')]],_[_0x3b8d('0x3f')](_0x3eb40d,_[_0x3b8d('0x40')](this['channels'][_0x3eb40d[_0x3b8d('0x3d')]])));}}if(_0x3eb40d[_0x3b8d('0x41')]===_0x3b8d('0x42')){if(this[_0x3b8d('0x1c')][_0x3eb40d[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]){if(_0x3eb40d['exten']==_0x3b8d('0x45')){this[_0x3b8d('0x1c')][_0x3eb40d['channel'][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x46')]=_0x3eb40d[_0x3b8d('0x47')];this['emit'](util[_0x3b8d('0x48')](_0x3b8d('0x49'),this[_0x3b8d('0x1c')][_0x3eb40d['channel']['split']('-')[0x0]][_0x3b8d('0x4a')]),_0x3b8d('0x4b'),{'destaccountcode':this[_0x3b8d('0x1c')][_0x3eb40d['channel'][_0x3b8d('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3eb40d[_0x3b8d('0x47')]});}}}}}catch(_0x3390a9){logger[_0x3b8d('0x31')](_0x3b8d('0x4c'),_0x3eb40d[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x3390a9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x32c305){try{if(this[_0x3b8d('0x4d')](_0x32c305)){logger[_0x3b8d('0x3b')](_0x3b8d('0x4e'),_0x32c305[_0x3b8d('0x3d')],util['inspect'](_0x32c305,{'showHidden':![],'depth':null}));if(_0x32c305[_0x3b8d('0x3d')]===_0x32c305[_0x3b8d('0x4f')]&&_0x32c305[_0x3b8d('0x43')]!=_0x3b8d('0x50')){if(_[_0x3b8d('0x35')](this[_0x3b8d('0x1b')][_0x32c305['uniqueid']])){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x32c305[_0x3b8d('0x3d')],_0x32c305[_0x3b8d('0x41')],_0x32c305[_0x3b8d('0x51')]);this['channels'][_0x32c305[_0x3b8d('0x3d')]]=new Channel();this['channels'][_0x32c305[_0x3b8d('0x3d')]][_0x3b8d('0x52')]=moment()[_0x3b8d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x32c305[_0x3b8d('0x3d')]][_0x3b8d('0x53')]=dispositions[_['toNumber'](_0x32c305[_0x3b8d('0x54')])];_['merge'](this['channels'][_0x32c305[_0x3b8d('0x3d')]],_[_0x3b8d('0x3f')](_0x32c305,_[_0x3b8d('0x40')](this[_0x3b8d('0x1b')][_0x32c305[_0x3b8d('0x3d')]])));if(_0x32c305[_0x3b8d('0x41')]===_0x3b8d('0x42')){if(this[_0x3b8d('0x1c')][_0x32c305[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]){if(_[_0x3b8d('0x35')](this[_0x3b8d('0x1c')][_0x32c305[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x46')])){this[_0x3b8d('0x1c')][_0x32c305[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x46')]=_0x32c305['exten'];logger[_0x3b8d('0x3b')](_0x3b8d('0x55'),_0x32c305['uniqueid'],util[_0x3b8d('0x33')]({'destaccountcode':this['agents'][_0x32c305[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x56')],'destconnectedlinenum':_0x32c305[_0x3b8d('0x51')]},{'showHidden':![],'depth':null}));this[_0x3b8d('0x36')](util[_0x3b8d('0x48')](_0x3b8d('0x49'),this[_0x3b8d('0x1c')][_0x32c305['channel']['split']('-')[0x0]][_0x3b8d('0x4a')]),_0x3b8d('0x4b'),{'destaccountcode':this[_0x3b8d('0x1c')][_0x32c305[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x56')],'destconnectedlinenum':_0x32c305[_0x3b8d('0x51')]});}}}}}}}catch(_0x452a3d){logger[_0x3b8d('0x31')](_0x3b8d('0x57'),_0x32c305[_0x3b8d('0x3d')],util['inspect'](_0x452a3d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0x1e')]=function(_0x1c4421){try{if(this[_0x3b8d('0x4d')](_0x1c4421)){logger[_0x3b8d('0x3b')](_0x3b8d('0x58'),_0x1c4421['uniqueid'],util['inspect'](_0x1c4421,{'showHidden':![],'depth':null}));if(_0x1c4421[_0x3b8d('0x3d')]===_0x1c4421[_0x3b8d('0x4f')]&&_0x1c4421[_0x3b8d('0x51')]!='h'&&_0x1c4421[_0x3b8d('0x43')]!='OutgoingSpoolFailed'){_0x1c4421[_0x3b8d('0x59')]=_0x1c4421['application'][_0x3b8d('0x5a')]();_0x1c4421[_0x3b8d('0x5b')]=_0x1c4421['appdata']&&_0x1c4421['appdata'][_0x3b8d('0x5c')](_0x3b8d('0x5d'))?_0x1c4421[_0x3b8d('0x5e')]:(_0x1c4421[_0x3b8d('0x5e')]||_0x1c4421['applicationdata'])[_0x3b8d('0x5a')]();logger['info'](_0x3b8d('0x5f'),_0x1c4421[_0x3b8d('0x3d')],_0x1c4421[_0x3b8d('0x59')],_0x1c4421['applicationdata']);if(_[_0x3b8d('0x35')](this[_0x3b8d('0x1b')][_0x1c4421[_0x3b8d('0x3d')]])){this[_0x3b8d('0x1b')][_0x1c4421[_0x3b8d('0x3d')]]=new Channel();this[_0x3b8d('0x1b')][_0x1c4421['uniqueid']][_0x3b8d('0x52')]=_0x1c4421['duration']?moment()[_0x3b8d('0x60')](moment['duration'](_0x1c4421[_0x3b8d('0x61')])[_0x3b8d('0x62')](),_0x3b8d('0x62'))[_0x3b8d('0x48')](_0x3b8d('0x63')):moment()['format'](_0x3b8d('0x63'));this['channels'][_0x1c4421['uniqueid']]['disposition']=_0x3b8d('0x14');}_['merge'](this[_0x3b8d('0x1b')][_0x1c4421['uniqueid']],_[_0x3b8d('0x3f')](_0x1c4421,_[_0x3b8d('0x40')](this[_0x3b8d('0x1b')][_0x1c4421['uniqueid']])));if(_['includes'](applications,_0x1c4421[_0x3b8d('0x59')])){this['channels'][_0x1c4421[_0x3b8d('0x3d')]][_0x3b8d('0x64')]=_0x1c4421[_0x3b8d('0x59')];this[_0x3b8d('0x1b')][_0x1c4421[_0x3b8d('0x3d')]]['lastdata']=_0x1c4421['applicationdata'];if(_0x1c4421['application']===_0x3b8d('0x10')&&_['startsWith'](_0x1c4421[_0x3b8d('0x5b')][_0x3b8d('0x5a')](),'cdr(')){var _0x57a50e=_0x1c4421[_0x3b8d('0x5b')]['split']('=');var _0x4a067d=_0x57a50e[0x0][_0x3b8d('0x5a')]()[_0x3b8d('0x65')](/cdr\((.*)\)/);if(_0x4a067d){this[_0x3b8d('0x1b')][_0x1c4421[_0x3b8d('0x3d')]][_0x4a067d[0x1]]=_0x57a50e[0x1];}}else if(_0x1c4421[_0x3b8d('0x59')]===_0x3b8d('0x66')){this[_0x3b8d('0x1b')][_0x1c4421[_0x3b8d('0x3d')]][_0x3b8d('0x66')]=_0x1c4421['applicationdata'][_0x3b8d('0x44')](',')[0x0];}}}}}catch(_0x58bb28){logger[_0x3b8d('0x31')]('[%s][voiceCallReport][newexten]',_0x1c4421[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x58bb28,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3b8d('0x23')]=function(_0x31b547){try{if(this[_0x3b8d('0x4d')](_0x31b547)){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x31b547[_0x3b8d('0x3d')],_0x31b547[_0x3b8d('0x4f')],_0x31b547[_0x3b8d('0x39')],_0x31b547['calleridnum']);logger[_0x3b8d('0x3b')]('[%s][voiceCallReport][newstate]\x20event:',_0x31b547[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x31b547,{'showHidden':![],'depth':null}));if(_0x31b547[_0x3b8d('0x3d')]!==_0x31b547[_0x3b8d('0x4f')]){if(this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]]){if(_0x31b547[_0x3b8d('0x54')]==='6'){if(!this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]]['answered']){var _0x387edb=moment();this['channels'][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x67')]=!![];this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x68')]=_0x387edb[_0x3b8d('0x48')](_0x3b8d('0x63'));if(this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x52')]){this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x69')]=_0x387edb[_0x3b8d('0x6a')](this['channels'][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x52')],_0x3b8d('0x62'));}}this[_0x3b8d('0x1b')][_0x31b547['linkedid']][_0x3b8d('0x4f')]=_0x31b547[_0x3b8d('0x3d')];if(_0x31b547[_0x3b8d('0x3a')]!=='xcally-motion-preview'){this[_0x3b8d('0x1b')][_0x31b547['linkedid']]['connectedlinenum']=_0x31b547['calleridnum'];}this[_0x3b8d('0x1b')][_0x31b547['linkedid']][_0x3b8d('0x6b')]=_0x31b547[_0x3b8d('0x39')];this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x6c')]=_0x31b547[_0x3b8d('0x43')];this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x53')]=dispositions[_[_0x3b8d('0x6d')](_0x31b547['channelstate'])];if(this[_0x3b8d('0x1c')][_0x31b547[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]){this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]]['UserId']=this[_0x3b8d('0x1c')][_0x31b547[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]['id'];this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]][_0x3b8d('0x6e')]=this[_0x3b8d('0x1c')][_0x31b547['channel']['split']('-')[0x0]][_0x3b8d('0x4a')];}}}}else{if(this['channels'][_0x31b547['uniqueid']]){if(_0x31b547[_0x3b8d('0x54')]==='6'){if(this[_0x3b8d('0x1c')][_0x31b547[_0x3b8d('0x43')]['split']('-')[0x0]]){this['channels'][_0x31b547[_0x3b8d('0x3d')]][_0x3b8d('0x6f')]=this[_0x3b8d('0x1c')][_0x31b547[_0x3b8d('0x43')]['split']('-')[0x0]]['id'];this[_0x3b8d('0x1b')][_0x31b547['uniqueid']][_0x3b8d('0x6e')]=this['agents'][_0x31b547['channel'][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x4a')];}}}}if(_0x31b547[_0x3b8d('0x54')]==='6'&&_0x31b547[_0x3b8d('0x41')]===_0x3b8d('0x42')){if(this['agents'][_0x31b547[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]){this[_0x3b8d('0x1c')][_0x31b547['channel'][_0x3b8d('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x31b547['exten'];var _0x2de8a2;if(this['channels'][_0x31b547[_0x3b8d('0x3d')]])_0x2de8a2=this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x3d')]]['routealias'];else if(this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]])_0x2de8a2=this[_0x3b8d('0x1b')][_0x31b547[_0x3b8d('0x4f')]]['routealias'];logger[_0x3b8d('0x3b')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x31b547[_0x3b8d('0x3d')],util[_0x3b8d('0x33')]({'destaccountcode':this[_0x3b8d('0x1c')][_0x31b547['channel'][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x56')],'destconnectedlinenum':_0x31b547[_0x3b8d('0x51')],'routealias':_0x2de8a2},{'showHidden':![],'depth':null}));this['emit'](util[_0x3b8d('0x48')](_0x3b8d('0x49'),this[_0x3b8d('0x1c')][_0x31b547[_0x3b8d('0x43')]['split']('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x3b8d('0x1c')][_0x31b547[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x31b547[_0x3b8d('0x51')],'routealias':_0x2de8a2});}}}}catch(_0x339fdb){logger[_0x3b8d('0x31')](_0x3b8d('0x70'),_0x31b547['uniqueid'],util[_0x3b8d('0x33')](_0x339fdb,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3b8d('0x71')]=function(_0x5c5eeb,_0x3d8704){try{if(this[_0x3b8d('0x1b')][_0x5c5eeb]){logger['info'](_0x3b8d('0x72'),_0x5c5eeb,_0x3d8704);this['channels'][_0x5c5eeb][_0x3b8d('0x73')]=!![];if(_['endsWith'](_0x3d8704,_0x3b8d('0x74'))){_0x3d8704=_0x3d8704['replace']('.wav49',_0x3b8d('0x75'));}this[_0x3b8d('0x1b')][_0x5c5eeb]['monitorFilename']=_0x3d8704;var _0x2664b1=_[_0x3b8d('0x76')](this[_0x3b8d('0x1b')][_0x5c5eeb]['monitors'],{'filename':_0x3d8704});if(_[_0x3b8d('0x77')](_0x2664b1)){this['channels'][_0x5c5eeb]['monitors'][_0x3b8d('0x78')]({'filename':_0x3d8704,'createdAt':moment()[_0x3b8d('0x48')](_0x3b8d('0x63')),'mixmonitorid':'','status':_0x3b8d('0x79')});}}}catch(_0x3138cc){logger['error'](_0x3b8d('0x7a'),_0x5c5eeb,util[_0x3b8d('0x33')](_0x3138cc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0x25')]=function(_0x1215c3){try{if(this[_0x3b8d('0x4d')](_0x1215c3)){logger['debug'](_0x3b8d('0x7b'),_0x1215c3[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x1215c3,{'showHidden':![],'depth':null}));if(this[_0x3b8d('0x1b')][_0x1215c3['uniqueid']]&&_0x1215c3[_0x3b8d('0x43')]!=_0x3b8d('0x50')){if(this[_0x3b8d('0x4d')](_0x1215c3['variable'])){if(this['isNotNull'](_0x1215c3[_0x3b8d('0x7c')][_0x3b8d('0x7d')])){logger[_0x3b8d('0x2f')](_0x3b8d('0x7e'),_0x1215c3[_0x3b8d('0x3d')],_0x1215c3[_0x3b8d('0x7f')]);this[_0x3b8d('0x71')](_0x1215c3[_0x3b8d('0x3d')],_0x1215c3[_0x3b8d('0x7f')]);}else if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')]['xmd-phone'])){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x1215c3[_0x3b8d('0x3d')],_0x1215c3['value']);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]][_0x3b8d('0x3a')]=_0x1215c3[_0x3b8d('0x7f')];}else if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')][_0x3b8d('0x80')])){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x1215c3[_0x3b8d('0x3d')],_0x1215c3['value']);this['channels'][_0x1215c3[_0x3b8d('0x3d')]]['callerid']=_0x1215c3[_0x3b8d('0x7f')];}else if(this[_0x3b8d('0x4d')](_0x1215c3['variable'][_0x3b8d('0x81')])){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1215c3[_0x3b8d('0x3d')],_0x1215c3['value']);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]][_0x3b8d('0x82')]=_0x1215c3[_0x3b8d('0x7f')];}else if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')][_0x3b8d('0x83')])){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x1215c3['uniqueid'],_0x1215c3[_0x3b8d('0x7f')]['split'](',')[0x0]);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]][_0x3b8d('0x66')]=_0x1215c3[_0x3b8d('0x7f')][_0x3b8d('0x44')](',')[0x0];}else if(this['isNotNull'](_0x1215c3['variable']['xmd-originatecalleridnum'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1215c3['uniqueid'],_0x1215c3['value']);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]]['originatecalleridnum']=_0x1215c3['value'];}else if(this['isNotNull'](_0x1215c3['variable'][_0x3b8d('0x84')])){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x1215c3['uniqueid'],_0x1215c3[_0x3b8d('0x7f')]);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]][_0x3b8d('0x85')]=_0x1215c3[_0x3b8d('0x7f')];}else if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')]['xmd-callerid-preview'])){logger[_0x3b8d('0x2f')](_0x3b8d('0x86'),_0x1215c3['uniqueid'],_0x1215c3[_0x3b8d('0x7f')]);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]]['calleridpreview']=_0x1215c3[_0x3b8d('0x7f')];}else if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')][_0x3b8d('0x87')])){logger['info'](_0x3b8d('0x88'),_0x1215c3[_0x3b8d('0x3d')],_0x1215c3[_0x3b8d('0x7f')]);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]]['queue']=_0x1215c3['value'];}else if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')][_0x3b8d('0x89')])){logger[_0x3b8d('0x2f')](_0x3b8d('0x8a'),_0x1215c3[_0x3b8d('0x3d')],_0x1215c3[_0x3b8d('0x7f')]);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x3d')]][_0x3b8d('0x8b')]=_0x1215c3[_0x3b8d('0x7f')];}}}else if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')]['mixmonitor_filename'])){if(_0x1215c3['value']){var _0x247910=path['parse'](_0x1215c3[_0x3b8d('0x7f')])[_0x3b8d('0x4a')];logger[_0x3b8d('0x2f')](_0x3b8d('0x7e'),_0x247910,_0x1215c3[_0x3b8d('0x7f')]);this['syncMixMonitorFilename'](_0x247910,_0x1215c3[_0x3b8d('0x7f')]);}}else if(this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x4f')]]){if(this['isNotNull'](_0x1215c3['variable'])){if(this[_0x3b8d('0x4d')](_0x1215c3[_0x3b8d('0x7c')]['sipcallid'])){logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1215c3[_0x3b8d('0x4f')],_0x1215c3[_0x3b8d('0x7f')]);this[_0x3b8d('0x1b')][_0x1215c3[_0x3b8d('0x4f')]][_0x3b8d('0x8c')]=_0x1215c3[_0x3b8d('0x7f')];}}}}}catch(_0xe67fc2){logger[_0x3b8d('0x31')](_0x3b8d('0x8d'),_0x1215c3[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0xe67fc2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0x27')]=function(_0x1c6cb7){try{if(this['isNotNull'](_0x1c6cb7)){logger[_0x3b8d('0x3b')](_0x3b8d('0x8e'),_0x1c6cb7[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x1c6cb7,{'showHidden':![],'depth':null}));if(this[_0x3b8d('0x1b')][_0x1c6cb7['uniqueid']]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x1c6cb7['uniqueid'],_0x1c6cb7[_0x3b8d('0x8f')]);var _0x59312b=moment();this[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]][_0x3b8d('0x90')]=_0x59312b[_0x3b8d('0x48')](_0x3b8d('0x63'));this[_0x3b8d('0x1b')][_0x1c6cb7['uniqueid']][_0x3b8d('0x61')]=_0x59312b['diff'](this[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]][_0x3b8d('0x52')],_0x3b8d('0x62'));if(this[_0x3b8d('0x1b')][_0x1c6cb7['uniqueid']][_0x3b8d('0x67')]){this[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]][_0x3b8d('0x91')]=_0x59312b[_0x3b8d('0x6a')](this[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]]['answertime'],_0x3b8d('0x62'));this[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]][_0x3b8d('0x69')]=this[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]][_0x3b8d('0x61')]-this[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]][_0x3b8d('0x91')];}if(_0x1c6cb7[_0x3b8d('0x41')]===_0x3b8d('0x42')){if(this['agents'][_0x1c6cb7['channel'][_0x3b8d('0x44')]('-')[0x0]]){this[_0x3b8d('0x1c')][_0x1c6cb7[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]=_[_0x3b8d('0x92')](this[_0x3b8d('0x1c')][_0x1c6cb7[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]],[_0x3b8d('0x46')]);logger[_0x3b8d('0x3b')](_0x3b8d('0x93'),_0x1c6cb7[_0x3b8d('0x3d')],util[_0x3b8d('0x33')]({'id':this['agents'][_0x1c6cb7['channel'][_0x3b8d('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x3b8d('0x1c')][_0x1c6cb7[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x3b8d('0x49'),this['agents'][_0x1c6cb7[_0x3b8d('0x43')]['split']('-')[0x0]][_0x3b8d('0x4a')]),_0x3b8d('0x94'),{'id':this[_0x3b8d('0x1c')][_0x1c6cb7[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x3b8d('0x1c')][_0x1c6cb7[_0x3b8d('0x43')][_0x3b8d('0x44')]('-')[0x0]][_0x3b8d('0x56')]});}}var _0x45fd6a=this;Promise[_0x3b8d('0x95')]()['then'](function(){var _0x999229=_0x45fd6a[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]];if(typeof _0x999229[_0x3b8d('0x96')]==='undefined')return;if(_[_0x3b8d('0x97')](_0x999229[_0x3b8d('0x98')]))return;return RpcSetting[_0x3b8d('0x99')]()[_0x3b8d('0x9a')](function(_0x16cd4e){if(!_0x16cd4e['stopRecordingOnTransfer'])return;return Promise[_0x3b8d('0x95')]()['then'](function(){return ami[_0x3b8d('0x9b')]({'action':_0x3b8d('0x9c'),'channel':_0x999229[_0x3b8d('0x43')]})['catch'](function(){});})[_0x3b8d('0x9a')](function(){return ami[_0x3b8d('0x9b')]({'action':_0x3b8d('0x9c'),'channel':_0x999229[_0x3b8d('0x6c')]})[_0x3b8d('0x9d')](function(){})[_0x3b8d('0x9e')](function(){var _0x57177b=_0x45fd6a[_0x3b8d('0x1c')][_0x999229[_0x3b8d('0x6c')][_0x3b8d('0x44')]('-')[0x0]];if(!_0x57177b)return;io[_0x3b8d('0x36')](_0x3b8d('0x9f'),{'agentId':_0x57177b['id'],'uniqueid':_0x999229['uniqueid']});});});});})[_0x3b8d('0x9a')](function(){if(_0x1c6cb7[_0x3b8d('0xa0')]===_0x3b8d('0xa1')){_0x45fd6a[_0x3b8d('0xa2')][_0x1c6cb7['uniqueid']]=_0x45fd6a['channels'][_0x1c6cb7['uniqueid']];}else{if(_0x45fd6a[_0x3b8d('0x1b')][_0x1c6cb7['uniqueid']][_0x3b8d('0x82')]===_0x3b8d('0xa3')&&_0x45fd6a[_0x3b8d('0xa2')][_0x1c6cb7['uniqueid']]){_0x45fd6a['channels'][_0x1c6cb7['uniqueid']][_0x3b8d('0x3d')]=[_0x45fd6a[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]][_0x3b8d('0x4f')],_0x45fd6a[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]]['linkedid']=_0x45fd6a['channels'][_0x1c6cb7['uniqueid']][_0x3b8d('0x3d')]][0x0];delete _0x45fd6a['blindTransfers'][_0x1c6cb7[_0x3b8d('0x3d')]];}}logger[_0x3b8d('0x3b')](_0x3b8d('0xa4'),_0x1c6cb7[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x45fd6a[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3b8d('0xa5'),_0x45fd6a[_0x3b8d('0x1b')][_0x1c6cb7[_0x3b8d('0x3d')]]);delete _0x45fd6a['channels'][_0x1c6cb7['uniqueid']];});}}}catch(_0xf41493){logger['error'](_0x3b8d('0xa6'),_0x1c6cb7[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0xf41493,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0x29')]=function(_0x38da9c){try{if(this[_0x3b8d('0x4d')](_0x38da9c)){logger[_0x3b8d('0x2f')](_0x3b8d('0xa7'),_0x38da9c['uniqueid'],_0x38da9c[_0x3b8d('0xa8')],_0x38da9c[_0x3b8d('0xa9')]);logger['debug'](_0x3b8d('0xaa'),_0x38da9c[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x38da9c,{'showHidden':![],'depth':null}));if(this['channels'][_0x38da9c[_0x3b8d('0xab')]]){this[_0x3b8d('0x1b')][_0x38da9c['transfereeuniqueid']][_0x3b8d('0xac')]=_0x38da9c[_0x3b8d('0xa8')];this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xab')]][_0x3b8d('0xad')]=_0x38da9c[_0x3b8d('0xa9')];if(this[_0x3b8d('0x1b')][_0x38da9c['secondtransfereruniqueid']]){var _0x16a940=this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xae')]];this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xae')]]=this['channels'][_0x38da9c[_0x3b8d('0xab')]];this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xab')]]=_0x16a940;}}else if(this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xaf')]]){this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xaf')]][_0x3b8d('0xac')]=_0x38da9c[_0x3b8d('0xa8')];this['channels'][_0x38da9c[_0x3b8d('0xaf')]][_0x3b8d('0xad')]=_0x38da9c[_0x3b8d('0xa9')];if(this['channels'][_0x38da9c['origtransfereruniqueid']]){var _0x16a940=this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xb0')]];this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xb0')]]=this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xaf')]];this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xaf')]]=_0x16a940;}}if((this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xb0')]]||this['channels'][_0x38da9c['origtransfererlinkedid']])&&this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xae')]]){var _0x331b13=_[_0x3b8d('0xb1')]([this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xb0')]],this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xb2')]],this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xae')]]],function(_0x47eab8){return _0x47eab8&&_0x47eab8[_0x3b8d('0x82')]===_0x3b8d('0xa3')&&_0x47eab8['routeid'];});if(_0x331b13){if(this['channels'][_0x38da9c[_0x3b8d('0xb0')]])this['channels'][_0x38da9c[_0x3b8d('0xb0')]][_0x3b8d('0x96')]=_0x3b8d('0xb3');if(this['channels'][_0x38da9c['origtransfererlinkedid']])this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xb2')]][_0x3b8d('0x96')]=_0x3b8d('0xb3');this[_0x3b8d('0x1b')][_0x38da9c[_0x3b8d('0xae')]][_0x3b8d('0x96')]='ATTENDED';}}}}catch(_0xe59418){logger[_0x3b8d('0x31')](_0x3b8d('0xb4'),_0x38da9c['uniqueid'],util[_0x3b8d('0x33')](_0xe59418,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0x2b')]=function(_0x3b70a1){try{if(this['isNotNull'](_0x3b70a1)){logger[_0x3b8d('0x2f')](_0x3b8d('0xb5'),_0x3b70a1[_0x3b8d('0x3d')],_0x3b70a1[_0x3b8d('0xb6')],_0x3b70a1[_0x3b8d('0xb7')]);logger[_0x3b8d('0x3b')](_0x3b8d('0xb8'),_0x3b70a1[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x3b70a1,{'showHidden':![],'depth':null}));if(this[_0x3b8d('0x1b')][_0x3b70a1[_0x3b8d('0xab')]]){this[_0x3b8d('0x1b')][_0x3b70a1['transfereeuniqueid']][_0x3b8d('0xac')]=_0x3b70a1[_0x3b8d('0xb6')];this['channels'][_0x3b70a1[_0x3b8d('0xab')]][_0x3b8d('0xad')]=_0x3b70a1['extension'];this['channels'][_0x3b70a1[_0x3b8d('0xab')]][_0x3b8d('0x96')]=_0x3b8d('0xb9');this[_0x3b8d('0x27')]({'event':_0x3b8d('0xa1'),'uniqueid':_0x3b70a1[_0x3b8d('0xab')],'context':_0x3b70a1[_0x3b8d('0x41')],'channel':_0x3b70a1[_0x3b8d('0xba')]});}else{this[_0x3b8d('0x1b')][_0x3b70a1[_0x3b8d('0xbb')]]['transferType']=_0x3b8d('0xb9');}}}catch(_0x44a844){logger[_0x3b8d('0x31')](_0x3b8d('0xbc'),_0x3b70a1[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x44a844,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3b8d('0x34')][_0x3b8d('0xbd')]=function(_0x4f7f37){try{if(this[_0x3b8d('0x4d')](_0x4f7f37)){logger['debug']('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x4f7f37[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x4f7f37,{'showHidden':![],'depth':null}));if(this[_0x3b8d('0x1b')][_0x4f7f37['uniqueid']]){if(!_[_0x3b8d('0x77')](this[_0x3b8d('0x1b')][_0x4f7f37[_0x3b8d('0x3d')]]['answertime'])){this['channels'][_0x4f7f37[_0x3b8d('0x3d')]]['mohstarttime']=moment()['format'](_0x3b8d('0x63'));logger[_0x3b8d('0x2f')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x4f7f37[_0x3b8d('0x3d')],this[_0x3b8d('0x1b')][_0x4f7f37[_0x3b8d('0x3d')]]['mohstarttime']);}}}}catch(_0x4dd267){logger[_0x3b8d('0x31')](_0x3b8d('0xbe'),_0x4f7f37[_0x3b8d('0x3d')],util['inspect'](_0x4dd267,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3b8d('0x2e')]=function(_0x5b5e35){try{if(this[_0x3b8d('0x4d')](_0x5b5e35)){logger[_0x3b8d('0x3b')](_0x3b8d('0xbf'),_0x5b5e35[_0x3b8d('0x3d')],util[_0x3b8d('0x33')](_0x5b5e35,{'showHidden':![],'depth':null}));if(this['channels'][_0x5b5e35[_0x3b8d('0x3d')]]){if(!_[_0x3b8d('0x77')](this['channels'][_0x5b5e35[_0x3b8d('0x3d')]]['mohstarttime'])){this[_0x3b8d('0x1b')][_0x5b5e35[_0x3b8d('0x3d')]][_0x3b8d('0xc0')]+=moment()[_0x3b8d('0xc1')](0x0)[_0x3b8d('0x6a')](this[_0x3b8d('0x1b')][_0x5b5e35[_0x3b8d('0x3d')]][_0x3b8d('0xc2')],_0x3b8d('0x62'));logger[_0x3b8d('0x2f')](_0x3b8d('0xc3'),_0x5b5e35[_0x3b8d('0x3d')],this[_0x3b8d('0x1b')][_0x5b5e35[_0x3b8d('0x3d')]][_0x3b8d('0xc0')]);delete this[_0x3b8d('0x1b')][_0x5b5e35[_0x3b8d('0x3d')]]['mohstarttime'];}}}}catch(_0x323228){logger[_0x3b8d('0x31')](_0x3b8d('0xc4'),_0x5b5e35[_0x3b8d('0x3d')],util['inspect'](_0x323228,{'showHidden':![],'depth':null}));}};module[_0x3b8d('0xc5')]=VoiceCallReport; \ No newline at end of file +var _0x2204=['transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','path','ioredis','../../../config/environment','ami','../rpc/setting','unknown','not_inuse','inuse','busy','ringinuse','set','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','format','user:%s','name','user:agentconnect','accountcode','connectedlinenum','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','disposition','channelstate','merge','destconnectedlinenum','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','undefined','getSettings','Action','StopMixMonitor','catch','finally','event','BlindTransfer','blindTransfers','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','ATTENDED','transferType','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s'];(function(_0xbf374a,_0x4a08e2){var _0x11d1b9=function(_0x5ce3c0){while(--_0x5ce3c0){_0xbf374a['push'](_0xbf374a['shift']());}};_0x11d1b9(++_0x4a08e2);}(_0x2204,0xd1));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var _=require(_0x4220('0x0'));var moment=require(_0x4220('0x1'));var util=require(_0x4220('0x2'));var path=require(_0x4220('0x3'));var Redis=require(_0x4220('0x4'));var config=require(_0x4220('0x5'));var logger=require('../../../config/logger')(_0x4220('0x6'));var ami=require('../ami');var Channel=require('../model/channel');var RpcSetting=require(_0x4220('0x7'));var statusDesc=[_0x4220('0x8'),_0x4220('0x9'),_0x4220('0xa'),_0x4220('0xb'),'invalid','unavailable','ringing',_0x4220('0xc'),'onhold'];var applications=[_0x4220('0xd'),_0x4220('0xe'),_0x4220('0xf'),_0x4220('0x10'),'playback',_0x4220('0x11')];var dispositions=['NO\x20ANSWER',_0x4220('0x12'),_0x4220('0x12'),'NO\x20ANSWER','NO\x20ANSWER',_0x4220('0x13'),_0x4220('0x14'),'BUSY',_0x4220('0x12'),'FAILED',_0x4220('0x12')];var actions={};config['redis']=_['defaults'](config[_0x4220('0x15')],{'host':_0x4220('0x16'),'port':0x18eb});var io=require(_0x4220('0x17'))(new Redis(config[_0x4220('0x15')]));function VoiceCallReport(_0x3ea29b){this[_0x4220('0x18')]=_0x3ea29b[_0x4220('0x18')];this['agents']=_0x3ea29b[_0x4220('0x19')];this['blindTransfers']={};ami['on'](_0x4220('0x1a'),this[_0x4220('0x1b')][_0x4220('0x1c')](this));ami['on']('newexten',this[_0x4220('0x1b')][_0x4220('0x1c')](this));ami['on']('newchannel',this[_0x4220('0x1d')][_0x4220('0x1c')](this));ami['on'](_0x4220('0x1e'),this['syncNewState'][_0x4220('0x1c')](this));ami['on']('varset',this['syncVarSet'][_0x4220('0x1c')](this));ami['on']('hangup',this['syncHangup'][_0x4220('0x1c')](this));ami['on'](_0x4220('0x1f'),this[_0x4220('0x20')][_0x4220('0x1c')](this));ami['on'](_0x4220('0x21'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x4220('0x22'),this[_0x4220('0x23')]['bind'](this));ami['on']('musiconholdstart',this[_0x4220('0x24')][_0x4220('0x1c')](this));ami['on']('musiconholdstop',this[_0x4220('0x25')][_0x4220('0x1c')](this));try{logger[_0x4220('0x26')](_0x4220('0x27'));ami['actionCoreShowChannels']();}catch(_0x5c491a){logger[_0x4220('0x28')](_0x4220('0x29'),util[_0x4220('0x2a')](_0x5c491a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x4220('0x2b')][_0x4220('0x2c')]=function(_0x4e678c){return _0x4e678c!==null&&!_['isUndefined'](_0x4e678c);};VoiceCallReport['prototype'][_0x4220('0x2d')]=function(_0x235a7e,_0x5f424d,_0x4f4a1e){io['to'](_0x235a7e)[_0x4220('0x2d')](_0x5f424d,_0x4f4a1e);};VoiceCallReport[_0x4220('0x2b')][_0x4220('0x20')]=function(_0x5a6d59){try{if(this[_0x4220('0x2c')](_0x5a6d59)){logger[_0x4220('0x26')](_0x4220('0x2e'),_0x5a6d59[_0x4220('0x2f')],_0x5a6d59[_0x4220('0x30')],_0x5a6d59[_0x4220('0x31')]);logger['debug'](_0x4220('0x32'),_0x5a6d59[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x5a6d59,{'showHidden':![],'depth':null}));if(_0x5a6d59[_0x4220('0x2f')]===_0x5a6d59[_0x4220('0x33')]){if(!_[_0x4220('0x34')](this['channels'][_0x5a6d59['uniqueid']])){_['merge'](this[_0x4220('0x18')][_0x5a6d59[_0x4220('0x2f')]],_[_0x4220('0x35')](_0x5a6d59,_[_0x4220('0x36')](this['channels'][_0x5a6d59[_0x4220('0x2f')]])));}}if(_0x5a6d59[_0x4220('0x37')]===_0x4220('0x38')){if(this[_0x4220('0x19')][_0x5a6d59[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]){if(_0x5a6d59[_0x4220('0x3b')]==_0x4220('0x3c')){this['agents'][_0x5a6d59[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]['destconnectedlinenum']=_0x5a6d59['connectedlinenum'];this[_0x4220('0x2d')](util[_0x4220('0x3d')](_0x4220('0x3e'),this[_0x4220('0x19')][_0x5a6d59[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x3f')]),_0x4220('0x40'),{'destaccountcode':this['agents'][_0x5a6d59['channel'][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x41')],'destconnectedlinenum':_0x5a6d59[_0x4220('0x42')]});}}}}}catch(_0x33b109){logger[_0x4220('0x28')](_0x4220('0x43'),_0x5a6d59[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x33b109,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4220('0x2b')][_0x4220('0x1d')]=function(_0x51d65d){try{if(this[_0x4220('0x2c')](_0x51d65d)){logger[_0x4220('0x44')](_0x4220('0x45'),_0x51d65d['uniqueid'],util[_0x4220('0x2a')](_0x51d65d,{'showHidden':![],'depth':null}));if(_0x51d65d[_0x4220('0x2f')]===_0x51d65d[_0x4220('0x33')]&&_0x51d65d[_0x4220('0x39')]!=_0x4220('0x46')){if(_['isUndefined'](this[_0x4220('0x18')][_0x51d65d[_0x4220('0x2f')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x51d65d[_0x4220('0x2f')],_0x51d65d[_0x4220('0x37')],_0x51d65d[_0x4220('0x3b')]);this[_0x4220('0x18')][_0x51d65d['uniqueid']]=new Channel();this['channels'][_0x51d65d[_0x4220('0x2f')]]['starttime']=moment()[_0x4220('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x51d65d['uniqueid']][_0x4220('0x47')]=dispositions[_['toNumber'](_0x51d65d[_0x4220('0x48')])];_[_0x4220('0x49')](this['channels'][_0x51d65d['uniqueid']],_[_0x4220('0x35')](_0x51d65d,_[_0x4220('0x36')](this[_0x4220('0x18')][_0x51d65d['uniqueid']])));if(_0x51d65d[_0x4220('0x37')]===_0x4220('0x38')){if(this[_0x4220('0x19')][_0x51d65d['channel'][_0x4220('0x3a')]('-')[0x0]]){if(_[_0x4220('0x34')](this['agents'][_0x51d65d[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x4a')])){this[_0x4220('0x19')][_0x51d65d[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]['destconnectedlinenum']=_0x51d65d[_0x4220('0x3b')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x51d65d['uniqueid'],util['inspect']({'destaccountcode':this[_0x4220('0x19')][_0x51d65d[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x41')],'destconnectedlinenum':_0x51d65d[_0x4220('0x3b')]},{'showHidden':![],'depth':null}));this[_0x4220('0x2d')](util[_0x4220('0x3d')](_0x4220('0x3e'),this[_0x4220('0x19')][_0x51d65d['channel']['split']('-')[0x0]][_0x4220('0x3f')]),'user:agentconnect',{'destaccountcode':this[_0x4220('0x19')][_0x51d65d[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x51d65d[_0x4220('0x3b')]});}}}}}}}catch(_0x18436a){logger[_0x4220('0x28')](_0x4220('0x4b'),_0x51d65d['uniqueid'],util['inspect'](_0x18436a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4220('0x1b')]=function(_0x13653b){try{if(this[_0x4220('0x2c')](_0x13653b)){logger[_0x4220('0x44')](_0x4220('0x4c'),_0x13653b[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x13653b,{'showHidden':![],'depth':null}));if(_0x13653b['uniqueid']===_0x13653b[_0x4220('0x33')]&&_0x13653b[_0x4220('0x3b')]!='h'&&_0x13653b[_0x4220('0x39')]!=_0x4220('0x46')){_0x13653b[_0x4220('0x4d')]=_0x13653b['application'][_0x4220('0x4e')]();_0x13653b[_0x4220('0x4f')]=_0x13653b[_0x4220('0x50')]&&_0x13653b['appdata'][_0x4220('0x51')](_0x4220('0x52'))?_0x13653b[_0x4220('0x50')]:(_0x13653b[_0x4220('0x50')]||_0x13653b[_0x4220('0x4f')])['toLowerCase']();logger[_0x4220('0x26')](_0x4220('0x53'),_0x13653b[_0x4220('0x2f')],_0x13653b['application'],_0x13653b[_0x4220('0x4f')]);if(_[_0x4220('0x34')](this[_0x4220('0x18')][_0x13653b['uniqueid']])){this[_0x4220('0x18')][_0x13653b[_0x4220('0x2f')]]=new Channel();this[_0x4220('0x18')][_0x13653b[_0x4220('0x2f')]][_0x4220('0x54')]=_0x13653b[_0x4220('0x55')]?moment()[_0x4220('0x56')](moment['duration'](_0x13653b[_0x4220('0x55')])[_0x4220('0x57')](),_0x4220('0x57'))[_0x4220('0x3d')](_0x4220('0x58')):moment()[_0x4220('0x3d')](_0x4220('0x58'));this['channels'][_0x13653b['uniqueid']]['disposition']=_0x4220('0x13');}_[_0x4220('0x49')](this[_0x4220('0x18')][_0x13653b[_0x4220('0x2f')]],_[_0x4220('0x35')](_0x13653b,_[_0x4220('0x36')](this[_0x4220('0x18')][_0x13653b[_0x4220('0x2f')]])));if(_[_0x4220('0x59')](applications,_0x13653b['application'])){this[_0x4220('0x18')][_0x13653b[_0x4220('0x2f')]][_0x4220('0x5a')]=_0x13653b[_0x4220('0x4d')];this[_0x4220('0x18')][_0x13653b[_0x4220('0x2f')]][_0x4220('0x5b')]=_0x13653b['applicationdata'];if(_0x13653b[_0x4220('0x4d')]===_0x4220('0xd')&&_[_0x4220('0x51')](_0x13653b[_0x4220('0x4f')][_0x4220('0x4e')](),_0x4220('0x5c'))){var _0x31e10d=_0x13653b['applicationdata'][_0x4220('0x3a')]('=');var _0x5d4ebb=_0x31e10d[0x0][_0x4220('0x4e')]()[_0x4220('0x5d')](/cdr\((.*)\)/);if(_0x5d4ebb){this[_0x4220('0x18')][_0x13653b[_0x4220('0x2f')]][_0x5d4ebb[0x1]]=_0x31e10d[0x1];}}else if(_0x13653b[_0x4220('0x4d')]===_0x4220('0xe')){this[_0x4220('0x18')][_0x13653b['uniqueid']]['queue']=_0x13653b['applicationdata']['split'](',')[0x0];}}}}}catch(_0xa05e72){logger[_0x4220('0x28')](_0x4220('0x5e'),_0x13653b[_0x4220('0x2f')],util[_0x4220('0x2a')](_0xa05e72,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4220('0x2b')][_0x4220('0x5f')]=function(_0x1b7634){try{if(this[_0x4220('0x2c')](_0x1b7634)){logger[_0x4220('0x26')](_0x4220('0x60'),_0x1b7634['uniqueid'],_0x1b7634[_0x4220('0x33')],_0x1b7634[_0x4220('0x30')],_0x1b7634[_0x4220('0x31')]);logger[_0x4220('0x44')](_0x4220('0x61'),_0x1b7634[_0x4220('0x2f')],util['inspect'](_0x1b7634,{'showHidden':![],'depth':null}));if(_0x1b7634[_0x4220('0x2f')]!==_0x1b7634['linkedid']){if(this['channels'][_0x1b7634[_0x4220('0x33')]]){if(_0x1b7634[_0x4220('0x48')]==='6'){if(!this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]][_0x4220('0x62')]){var _0x591a4a=moment();this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]][_0x4220('0x62')]=!![];this[_0x4220('0x18')][_0x1b7634['linkedid']][_0x4220('0x63')]=_0x591a4a['format']('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x1b7634[_0x4220('0x33')]][_0x4220('0x54')]){this['channels'][_0x1b7634['linkedid']][_0x4220('0x64')]=_0x591a4a[_0x4220('0x65')](this[_0x4220('0x18')][_0x1b7634['linkedid']][_0x4220('0x54')],_0x4220('0x57'));}}this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]][_0x4220('0x33')]=_0x1b7634[_0x4220('0x2f')];if(_0x1b7634[_0x4220('0x31')]!==_0x4220('0x3c')){this['channels'][_0x1b7634[_0x4220('0x33')]][_0x4220('0x42')]=_0x1b7634['calleridnum'];}this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]][_0x4220('0x66')]=_0x1b7634[_0x4220('0x30')];this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]][_0x4220('0x67')]=_0x1b7634['channel'];this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]][_0x4220('0x47')]=dispositions[_['toNumber'](_0x1b7634['channelstate'])];if(this['agents'][_0x1b7634[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]){this['channels'][_0x1b7634[_0x4220('0x33')]][_0x4220('0x68')]=this['agents'][_0x1b7634[_0x4220('0x39')]['split']('-')[0x0]]['id'];this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]][_0x4220('0x69')]=this[_0x4220('0x19')][_0x1b7634[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x3f')];}}}}else{if(this[_0x4220('0x18')][_0x1b7634[_0x4220('0x2f')]]){if(_0x1b7634[_0x4220('0x48')]==='6'){if(this[_0x4220('0x19')][_0x1b7634[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]){this[_0x4220('0x18')][_0x1b7634[_0x4220('0x2f')]][_0x4220('0x68')]=this[_0x4220('0x19')][_0x1b7634[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]['id'];this[_0x4220('0x18')][_0x1b7634[_0x4220('0x2f')]]['membername']=this['agents'][_0x1b7634[_0x4220('0x39')]['split']('-')[0x0]]['name'];}}}}if(_0x1b7634[_0x4220('0x48')]==='6'&&_0x1b7634['context']==='from-sip'){if(this['agents'][_0x1b7634[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]){this['agents'][_0x1b7634['channel'][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x4a')]=_0x1b7634[_0x4220('0x3b')];var _0x5418aa;if(this[_0x4220('0x18')][_0x1b7634[_0x4220('0x2f')]])_0x5418aa=this['channels'][_0x1b7634[_0x4220('0x2f')]][_0x4220('0x6a')];else if(this['channels'][_0x1b7634[_0x4220('0x33')]])_0x5418aa=this[_0x4220('0x18')][_0x1b7634[_0x4220('0x33')]]['routealias'];logger[_0x4220('0x44')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x1b7634['uniqueid'],util['inspect']({'destaccountcode':this['agents'][_0x1b7634[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x41')],'destconnectedlinenum':_0x1b7634[_0x4220('0x3b')],'routealias':_0x5418aa},{'showHidden':![],'depth':null}));this[_0x4220('0x2d')](util[_0x4220('0x3d')](_0x4220('0x3e'),this['agents'][_0x1b7634[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]['name']),_0x4220('0x40'),{'destaccountcode':this[_0x4220('0x19')][_0x1b7634['channel'][_0x4220('0x3a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1b7634[_0x4220('0x3b')],'routealias':_0x5418aa});}}}}catch(_0x5744d7){logger[_0x4220('0x28')](_0x4220('0x6b'),_0x1b7634[_0x4220('0x2f')],util['inspect'](_0x5744d7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4220('0x2b')][_0x4220('0x6c')]=function(_0x41488d,_0x5d2f64){try{if(this[_0x4220('0x18')][_0x41488d]){logger[_0x4220('0x26')](_0x4220('0x6d'),_0x41488d,_0x5d2f64);this[_0x4220('0x18')][_0x41488d][_0x4220('0x6e')]=!![];if(_[_0x4220('0x6f')](_0x5d2f64,_0x4220('0x70'))){_0x5d2f64=_0x5d2f64[_0x4220('0x71')]('.wav49',_0x4220('0x72'));}this['channels'][_0x41488d][_0x4220('0x73')]=_0x5d2f64;var _0x1cce96=_[_0x4220('0x74')](this[_0x4220('0x18')][_0x41488d][_0x4220('0x75')],{'filename':_0x5d2f64});if(_[_0x4220('0x76')](_0x1cce96)){this[_0x4220('0x18')][_0x41488d][_0x4220('0x75')][_0x4220('0x77')]({'filename':_0x5d2f64,'createdAt':moment()[_0x4220('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x4220('0x78')});}}}catch(_0x3742c8){logger[_0x4220('0x28')]('[%s][voiceCallReport][mixMonitorFilename]',_0x41488d,util['inspect'](_0x3742c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4220('0x2b')][_0x4220('0x79')]=function(_0x1f7dc9){try{if(this[_0x4220('0x2c')](_0x1f7dc9)){logger[_0x4220('0x44')](_0x4220('0x7a'),_0x1f7dc9[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x1f7dc9,{'showHidden':![],'depth':null}));if(this[_0x4220('0x18')][_0x1f7dc9['uniqueid']]&&_0x1f7dc9[_0x4220('0x39')]!=_0x4220('0x46')){if(this[_0x4220('0x2c')](_0x1f7dc9[_0x4220('0x7b')])){if(this['isNotNull'](_0x1f7dc9['variable'][_0x4220('0x7c')])){logger[_0x4220('0x26')](_0x4220('0x7d'),_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);this['syncMixMonitorFilename'](_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);}else if(this['isNotNull'](_0x1f7dc9['variable']['xmd-phone'])){logger[_0x4220('0x26')](_0x4220('0x7f'),_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x2f')]][_0x4220('0x31')]=_0x1f7dc9['value'];}else if(this[_0x4220('0x2c')](_0x1f7dc9[_0x4220('0x7b')][_0x4220('0x80')])){logger[_0x4220('0x26')](_0x4220('0x81'),_0x1f7dc9['uniqueid'],_0x1f7dc9['value']);this['channels'][_0x1f7dc9['uniqueid']][_0x4220('0x82')]=_0x1f7dc9[_0x4220('0x7e')];}else if(this[_0x4220('0x2c')](_0x1f7dc9[_0x4220('0x7b')]['xmd-cdrtype'])){logger[_0x4220('0x26')](_0x4220('0x83'),_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x18')][_0x1f7dc9['uniqueid']]['type']=_0x1f7dc9['value'];}else if(this['isNotNull'](_0x1f7dc9['variable'][_0x4220('0x84')])){logger[_0x4220('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]['split'](',')[0x0]);this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x2f')]][_0x4220('0xe')]=_0x1f7dc9[_0x4220('0x7e')]['split'](',')[0x0];}else if(this[_0x4220('0x2c')](_0x1f7dc9[_0x4220('0x7b')][_0x4220('0x85')])){logger[_0x4220('0x26')](_0x4220('0x86'),_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x2f')]][_0x4220('0x87')]=_0x1f7dc9[_0x4220('0x7e')];}else if(this['isNotNull'](_0x1f7dc9['variable'][_0x4220('0x88')])){logger[_0x4220('0x26')](_0x4220('0x89'),_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x2f')]][_0x4220('0x8a')]=_0x1f7dc9[_0x4220('0x7e')];}else if(this['isNotNull'](_0x1f7dc9['variable'][_0x4220('0x8b')])){logger[_0x4220('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1f7dc9['uniqueid'],_0x1f7dc9[_0x4220('0x7e')]);this['channels'][_0x1f7dc9[_0x4220('0x2f')]][_0x4220('0x8c')]=_0x1f7dc9['value'];}else if(this['isNotNull'](_0x1f7dc9[_0x4220('0x7b')][_0x4220('0x8d')])){logger[_0x4220('0x26')](_0x4220('0x8e'),_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x2f')]][_0x4220('0xe')]=_0x1f7dc9['value'];}else if(this['isNotNull'](_0x1f7dc9['variable'][_0x4220('0x8f')])){logger[_0x4220('0x26')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1f7dc9[_0x4220('0x2f')],_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x2f')]][_0x4220('0x90')]=_0x1f7dc9[_0x4220('0x7e')];}}}else if(this[_0x4220('0x2c')](_0x1f7dc9[_0x4220('0x7b')]['mixmonitor_filename'])){if(_0x1f7dc9[_0x4220('0x7e')]){var _0x345f72=path[_0x4220('0x91')](_0x1f7dc9['value'])[_0x4220('0x3f')];logger[_0x4220('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x345f72,_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x6c')](_0x345f72,_0x1f7dc9[_0x4220('0x7e')]);}}else if(this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x33')]]){if(this[_0x4220('0x2c')](_0x1f7dc9['variable'])){if(this['isNotNull'](_0x1f7dc9['variable'][_0x4220('0x8f')])){logger[_0x4220('0x26')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1f7dc9[_0x4220('0x33')],_0x1f7dc9[_0x4220('0x7e')]);this[_0x4220('0x18')][_0x1f7dc9[_0x4220('0x33')]][_0x4220('0x92')]=_0x1f7dc9['value'];}}}}}catch(_0x1ab8ee){logger[_0x4220('0x28')](_0x4220('0x93'),_0x1f7dc9[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x1ab8ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4220('0x2b')][_0x4220('0x94')]=function(_0x4acacf){try{if(this['isNotNull'](_0x4acacf)){logger[_0x4220('0x44')](_0x4220('0x95'),_0x4acacf[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x4acacf,{'showHidden':![],'depth':null}));if(this['channels'][_0x4acacf['uniqueid']]){logger[_0x4220('0x26')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x4acacf['uniqueid'],_0x4acacf[_0x4220('0x96')]);var _0x283322=moment();this[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]]['endtime']=_0x283322[_0x4220('0x3d')](_0x4220('0x58'));this['channels'][_0x4acacf[_0x4220('0x2f')]][_0x4220('0x55')]=_0x283322[_0x4220('0x65')](this['channels'][_0x4acacf['uniqueid']]['starttime'],'seconds');if(this['channels'][_0x4acacf['uniqueid']][_0x4220('0x62')]){this[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]][_0x4220('0x97')]=_0x283322[_0x4220('0x65')](this[_0x4220('0x18')][_0x4acacf['uniqueid']][_0x4220('0x63')],'seconds');this[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]][_0x4220('0x64')]=this['channels'][_0x4acacf[_0x4220('0x2f')]]['duration']-this[_0x4220('0x18')][_0x4acacf['uniqueid']][_0x4220('0x97')];}if(_0x4acacf[_0x4220('0x37')]==='from-sip'){if(this[_0x4220('0x19')][_0x4acacf[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]){this[_0x4220('0x19')][_0x4acacf['channel'][_0x4220('0x3a')]('-')[0x0]]=_[_0x4220('0x98')](this[_0x4220('0x19')][_0x4acacf[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]],[_0x4220('0x4a')]);logger[_0x4220('0x44')](_0x4220('0x99'),_0x4acacf[_0x4220('0x2f')],util['inspect']({'id':this[_0x4220('0x19')][_0x4acacf[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x4220('0x19')][_0x4acacf[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x41')]},{'showHidden':![],'depth':null}));this[_0x4220('0x2d')](util[_0x4220('0x3d')](_0x4220('0x3e'),this[_0x4220('0x19')][_0x4acacf[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]][_0x4220('0x3f')]),_0x4220('0x9a'),{'id':this[_0x4220('0x19')][_0x4acacf[_0x4220('0x39')][_0x4220('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x4220('0x19')][_0x4acacf[_0x4220('0x39')]['split']('-')[0x0]][_0x4220('0x41')]});}}var _0x32fa29=this;Promise[_0x4220('0x9b')]()[_0x4220('0x9c')](function(){var _0x368eb1=_0x32fa29['channels'][_0x4acacf[_0x4220('0x2f')]];if(typeof _0x368eb1['transferType']===_0x4220('0x9d'))return;if(_['isEmpty'](_0x368eb1[_0x4220('0x75')]))return;return RpcSetting[_0x4220('0x9e')]()[_0x4220('0x9c')](function(_0x254547){if(!_0x254547['stopRecordingOnTransfer'])return;return Promise['resolve']()[_0x4220('0x9c')](function(){return ami[_0x4220('0x9f')]({'action':_0x4220('0xa0'),'channel':_0x368eb1[_0x4220('0x39')]})['catch'](function(){});})[_0x4220('0x9c')](function(){return ami[_0x4220('0x9f')]({'action':_0x4220('0xa0'),'channel':_0x368eb1['destinationchannel']})[_0x4220('0xa1')](function(){})[_0x4220('0xa2')](function(){var _0x2134b6=_0x32fa29['agents'][_0x368eb1[_0x4220('0x67')][_0x4220('0x3a')]('-')[0x0]];if(!_0x2134b6)return;io[_0x4220('0x2d')]('webbar:stopmonitors',{'agentId':_0x2134b6['id'],'uniqueid':_0x368eb1[_0x4220('0x2f')]});});});});})['then'](function(){if(_0x4acacf[_0x4220('0xa3')]===_0x4220('0xa4')){_0x32fa29[_0x4220('0xa5')][_0x4acacf['uniqueid']]=_0x32fa29[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]];}else{if(_0x32fa29[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]][_0x4220('0xa6')]==='outbound'&&_0x32fa29[_0x4220('0xa5')][_0x4acacf[_0x4220('0x2f')]]){_0x32fa29[_0x4220('0x18')][_0x4acacf['uniqueid']][_0x4220('0x2f')]=[_0x32fa29[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]]['linkedid'],_0x32fa29[_0x4220('0x18')][_0x4acacf['uniqueid']][_0x4220('0x33')]=_0x32fa29[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]][_0x4220('0x2f')]][0x0];delete _0x32fa29[_0x4220('0xa5')][_0x4acacf[_0x4220('0x2f')]];}}logger[_0x4220('0x44')](_0x4220('0xa7'),_0x4acacf['uniqueid'],util[_0x4220('0x2a')](_0x32fa29[_0x4220('0x18')][_0x4acacf[_0x4220('0x2f')]],{'showHidden':![],'depth':null}));ami[_0x4220('0x2d')](_0x4220('0xa8'),_0x32fa29[_0x4220('0x18')][_0x4acacf['uniqueid']]);delete _0x32fa29['channels'][_0x4acacf[_0x4220('0x2f')]];});}}}catch(_0x2ab6a6){logger['error'](_0x4220('0xa9'),_0x4acacf[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x2ab6a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4220('0x2b')]['syncAttendedTransfer']=function(_0x1984b0){try{if(this['isNotNull'](_0x1984b0)){logger[_0x4220('0x26')](_0x4220('0xaa'),_0x1984b0['uniqueid'],_0x1984b0['origtransferercalleridnum'],_0x1984b0[_0x4220('0xab')]);logger[_0x4220('0x44')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x1984b0[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x1984b0,{'showHidden':![],'depth':null}));if(this['channels'][_0x1984b0[_0x4220('0xac')]]){this['channels'][_0x1984b0[_0x4220('0xac')]][_0x4220('0xad')]=_0x1984b0[_0x4220('0xae')];this[_0x4220('0x18')][_0x1984b0['transfereeuniqueid']][_0x4220('0xaf')]=_0x1984b0[_0x4220('0xab')];if(this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb0')]]){var _0x57e70b=this[_0x4220('0x18')][_0x1984b0['secondtransfereruniqueid']];this['channels'][_0x1984b0[_0x4220('0xb0')]]=this[_0x4220('0x18')][_0x1984b0[_0x4220('0xac')]];this[_0x4220('0x18')][_0x1984b0[_0x4220('0xac')]]=_0x57e70b;}}else if(this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb1')]]){this['channels'][_0x1984b0[_0x4220('0xb1')]][_0x4220('0xad')]=_0x1984b0[_0x4220('0xae')];this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb1')]][_0x4220('0xaf')]=_0x1984b0['transfertargetcalleridnum'];if(this[_0x4220('0x18')][_0x1984b0['origtransfereruniqueid']]){var _0x57e70b=this[_0x4220('0x18')][_0x1984b0['origtransfereruniqueid']];this[_0x4220('0x18')][_0x1984b0['origtransfereruniqueid']]=this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb1')]];this['channels'][_0x1984b0[_0x4220('0xb1')]]=_0x57e70b;}}if((this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb2')]]||this['channels'][_0x1984b0[_0x4220('0xb3')]])&&this['channels'][_0x1984b0['secondtransfereruniqueid']]){var _0x53d232=_['some']([this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb2')]],this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb3')]],this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb0')]]],function(_0x5a465e){return _0x5a465e&&_0x5a465e[_0x4220('0xa6')]===_0x4220('0xb4')&&_0x5a465e[_0x4220('0xb5')];});if(_0x53d232){if(this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb2')]])this['channels'][_0x1984b0[_0x4220('0xb2')]]['transferType']=_0x4220('0xb6');if(this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb3')]])this[_0x4220('0x18')][_0x1984b0[_0x4220('0xb3')]][_0x4220('0xb7')]='ATTENDED';this['channels'][_0x1984b0[_0x4220('0xb0')]][_0x4220('0xb7')]='ATTENDED';}}}}catch(_0x3a2a28){logger[_0x4220('0x28')]('[%s][voiceCallReport][attendedtransfer]',_0x1984b0[_0x4220('0x2f')],util['inspect'](_0x3a2a28,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4220('0x23')]=function(_0x7ef7fb){try{if(this[_0x4220('0x2c')](_0x7ef7fb)){logger['info'](_0x4220('0xb8'),_0x7ef7fb[_0x4220('0x2f')],_0x7ef7fb[_0x4220('0xb9')],_0x7ef7fb[_0x4220('0xba')]);logger['debug'](_0x4220('0xbb'),_0x7ef7fb[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x7ef7fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x7ef7fb[_0x4220('0xac')]]){this['channels'][_0x7ef7fb[_0x4220('0xac')]][_0x4220('0xad')]=_0x7ef7fb['transfereecalleridnum'];this[_0x4220('0x18')][_0x7ef7fb[_0x4220('0xac')]][_0x4220('0xaf')]=_0x7ef7fb[_0x4220('0xba')];this[_0x4220('0x18')][_0x7ef7fb['transfereeuniqueid']][_0x4220('0xb7')]=_0x4220('0xbc');this[_0x4220('0x94')]({'event':_0x4220('0xa4'),'uniqueid':_0x7ef7fb[_0x4220('0xac')],'context':_0x7ef7fb['context'],'channel':_0x7ef7fb[_0x4220('0xbd')]});}else{this[_0x4220('0x18')][_0x7ef7fb[_0x4220('0xbe')]][_0x4220('0xb7')]=_0x4220('0xbc');}}}catch(_0x11e3dc){logger[_0x4220('0x28')](_0x4220('0xbf'),_0x7ef7fb['uniqueid'],util['inspect'](_0x11e3dc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4220('0x2b')]['syncMusicOnHoldStart']=function(_0x5454e2){try{if(this[_0x4220('0x2c')](_0x5454e2)){logger[_0x4220('0x44')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x5454e2[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x5454e2,{'showHidden':![],'depth':null}));if(this[_0x4220('0x18')][_0x5454e2[_0x4220('0x2f')]]){if(!_['isNil'](this[_0x4220('0x18')][_0x5454e2[_0x4220('0x2f')]][_0x4220('0x63')])){this['channels'][_0x5454e2[_0x4220('0x2f')]]['mohstarttime']=moment()[_0x4220('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x4220('0x26')](_0x4220('0xc0'),_0x5454e2['uniqueid'],this[_0x4220('0x18')][_0x5454e2[_0x4220('0x2f')]][_0x4220('0xc1')]);}}}}catch(_0x434f3b){logger[_0x4220('0x28')]('[%s][voiceCallReport][musiconholdstart]',_0x5454e2[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x434f3b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x3b7469){try{if(this[_0x4220('0x2c')](_0x3b7469)){logger[_0x4220('0x44')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x3b7469[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x3b7469,{'showHidden':![],'depth':null}));if(this[_0x4220('0x18')][_0x3b7469[_0x4220('0x2f')]]){if(!_[_0x4220('0x76')](this[_0x4220('0x18')][_0x3b7469[_0x4220('0x2f')]][_0x4220('0xc1')])){this[_0x4220('0x18')][_0x3b7469[_0x4220('0x2f')]]['mohtime']+=moment()['milliseconds'](0x0)['diff'](this[_0x4220('0x18')][_0x3b7469['uniqueid']][_0x4220('0xc1')],_0x4220('0x57'));logger[_0x4220('0x26')](_0x4220('0xc2'),_0x3b7469[_0x4220('0x2f')],this[_0x4220('0x18')][_0x3b7469['uniqueid']][_0x4220('0xc3')]);delete this[_0x4220('0x18')][_0x3b7469[_0x4220('0x2f')]]['mohstarttime'];}}}}catch(_0x529329){logger[_0x4220('0x28')](_0x4220('0xc4'),_0x3b7469[_0x4220('0x2f')],util[_0x4220('0x2a')](_0x529329,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index d84cab3..e43c961 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 _0xfe02=['rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','complete','outbound','total','answered','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','custom:voiceDialReport','custom:dialend','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceDialReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','channels','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','newexten','syncNewExten','hangup','syncHangup','prototype','emit','debug','inspect','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','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_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','value','variable','outboundrouteid','isUndefined','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0x4294af,_0x3056ab){var _0x208d14=function(_0x21cb95){while(--_0x21cb95){_0x4294af['push'](_0x4294af['shift']());}};_0x208d14(++_0x3056ab);}(_0xfe02,0xa6));var _0x2fe0=function(_0xfab345,_0x43fc6e){_0xfab345=_0xfab345-0x0;var _0x1a60fd=_0xfe02[_0xfab345];return _0x1a60fd;};'use strict';var _=require(_0x2fe0('0x0'));var moment=require('moment');var util=require(_0x2fe0('0x1'));var Redis=require(_0x2fe0('0x2'));var config=require(_0x2fe0('0x3'));var logger=require(_0x2fe0('0x4'))('ami');var ami=require(_0x2fe0('0x5'));config[_0x2fe0('0x6')]=_[_0x2fe0('0x7')](config[_0x2fe0('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2fe0('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0x1b411b){this[_0x2fe0('0x9')]=_0x1b411b['outboundChannels'];this['outbound']=_0x1b411b['outbound'];this[_0x2fe0('0xa')]={};this['variables']={};ami['on'](_0x2fe0('0xb'),this[_0x2fe0('0xc')][_0x2fe0('0xd')](this));ami['on'](_0x2fe0('0xe'),this[_0x2fe0('0xf')][_0x2fe0('0xd')](this));ami['on']('varset',this['syncVarSet'][_0x2fe0('0xd')](this));ami['on'](_0x2fe0('0x10'),this[_0x2fe0('0x11')][_0x2fe0('0xd')](this));ami['on'](_0x2fe0('0x12'),this[_0x2fe0('0x13')][_0x2fe0('0xd')](this));}VoiceDialReport[_0x2fe0('0x14')]['isNotNull']=function(_0x32e54e){return _0x32e54e!==null&&!_['isUndefined'](_0x32e54e);};VoiceDialReport['prototype'][_0x2fe0('0x15')]=function(_0x56c7a5,_0x292613,_0x452bdf){io['to'](_0x56c7a5)['emit'](_0x292613,_0x452bdf);};VoiceDialReport[_0x2fe0('0x14')][_0x2fe0('0xc')]=function(_0x201bab){try{if(this['isNotNull'](_0x201bab)){logger[_0x2fe0('0x16')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x201bab['uniqueid'],util[_0x2fe0('0x17')](_0x201bab,{'showHidden':![],'depth':null}));if(this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]]){_[_0x2fe0('0x19')](this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]],{'starttime':moment()[_0x2fe0('0x1a')](_0x2fe0('0x1b')),'lastevent':_0x2fe0('0x1c'),'interface':_0x201bab[_0x2fe0('0x1d')][_0x2fe0('0x1e')](0x0,_0x201bab[_0x2fe0('0x1d')][_0x2fe0('0x1f')]('-')),'membername':_0x201bab[_0x2fe0('0x1d')][_0x2fe0('0x1e')](_0x201bab['channel']['lastIndexOf']('/')+0x1,_0x201bab[_0x2fe0('0x1d')][_0x2fe0('0x1f')]('-'))},_['omit'](_0x201bab,[_0x2fe0('0x20'),_0x2fe0('0x21')]));logger[_0x2fe0('0x22')](_0x2fe0('0x23'),_0x201bab[_0x2fe0('0x18')],this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]][_0x2fe0('0x24')],this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]][_0x2fe0('0x25')]);logger['debug'](_0x2fe0('0x26'),_0x201bab[_0x2fe0('0x18')],util[_0x2fe0('0x17')](this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));if(this[_0x2fe0('0xa')][_0x201bab['uniqueid']])_[_0x2fe0('0x19')](this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]],this['applications'][_0x201bab[_0x2fe0('0x18')]]);this[_0x2fe0('0x15')]('voice:outbound',_0x2fe0('0x27'),this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]]);logger[_0x2fe0('0x16')](_0x2fe0('0x28'),_0x201bab[_0x2fe0('0x18')],util[_0x2fe0('0x17')](this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));ami[_0x2fe0('0x15')](_0x2fe0('0x29'),this[_0x2fe0('0x9')][_0x201bab[_0x2fe0('0x18')]]);}}}catch(_0x3d87eb){logger[_0x2fe0('0x2a')](_0x2fe0('0x2b'),_0x201bab[_0x2fe0('0x18')],util[_0x2fe0('0x17')](_0x3d87eb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2fe0('0x14')]['syncDialEnd']=function(_0xe5f445){try{if(this[_0x2fe0('0x2c')](_0xe5f445)){logger[_0x2fe0('0x16')](_0x2fe0('0x2d'),_0xe5f445[_0x2fe0('0x18')],util[_0x2fe0('0x17')](_0xe5f445,{'showHidden':![],'depth':null}));if(this[_0x2fe0('0x9')][_0xe5f445[_0x2fe0('0x18')]]){this[_0x2fe0('0x9')][_0xe5f445[_0x2fe0('0x18')]][_0x2fe0('0x2e')]=_0xe5f445['dialstatus'];if(_0xe5f445['dialstatus']===_0x2fe0('0x2f')){this['channels'][_0xe5f445[_0x2fe0('0x18')]][_0x2fe0('0x30')]=_0xe5f445[_0x2fe0('0x30')];this[_0x2fe0('0x9')][_0xe5f445[_0x2fe0('0x18')]][_0x2fe0('0x31')]=_0xe5f445[_0x2fe0('0x31')];this[_0x2fe0('0x9')][_0xe5f445[_0x2fe0('0x18')]][_0x2fe0('0x32')]=moment()[_0x2fe0('0x1a')](_0x2fe0('0x1b'));this['channels'][_0xe5f445[_0x2fe0('0x18')]][_0x2fe0('0x33')]=_0x2fe0('0x34');logger[_0x2fe0('0x22')](_0x2fe0('0x35'),_0xe5f445[_0x2fe0('0x18')],_0xe5f445[_0x2fe0('0x1d')][_0x2fe0('0x1e')](_0xe5f445[_0x2fe0('0x1d')][_0x2fe0('0x1f')]('/')+0x1,_0xe5f445['channel']['lastIndexOf']('-')));logger[_0x2fe0('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0xe5f445[_0x2fe0('0x18')],util[_0x2fe0('0x17')](this['channels'][_0xe5f445[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2fe0('0x36'),this[_0x2fe0('0x9')][_0xe5f445[_0x2fe0('0x18')]]);}logger['debug'](_0x2fe0('0x37'),_0xe5f445[_0x2fe0('0x18')],util[_0x2fe0('0x17')](this[_0x2fe0('0x9')][_0xe5f445[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));this[_0x2fe0('0x15')](_0x2fe0('0x38'),_0x2fe0('0x27'),this['channels'][_0xe5f445[_0x2fe0('0x18')]]);}}}catch(_0x2f9f0b){logger['error'](_0x2fe0('0x39'),_0xe5f445[_0x2fe0('0x18')],util[_0x2fe0('0x17')](_0x2f9f0b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x2fe0('0x3a')]=function(_0x1e01a5){try{if(this['isNotNull'](_0x1e01a5)){logger[_0x2fe0('0x16')](_0x2fe0('0x3b'),_0x1e01a5[_0x2fe0('0x18')],util['inspect'](_0x1e01a5,{'showHidden':![],'depth':null}));this[_0x2fe0('0x3c')](_0x1e01a5['uniqueid'],_['keys'](_0x1e01a5['variable'])[0x0],_0x1e01a5[_0x2fe0('0x3d')]);if(this[_0x2fe0('0x2c')](_0x1e01a5[_0x2fe0('0x3e')])&&this['isNotNull'](_0x1e01a5[_0x2fe0('0x3e')][_0x2fe0('0x3f')])){if(_[_0x2fe0('0x40')](this[_0x2fe0('0x9')][_0x1e01a5[_0x2fe0('0x18')]])){this['channels'][_0x1e01a5[_0x2fe0('0x18')]]={'routeId':_0x1e01a5[_0x2fe0('0x3d')],'variables':this[_0x2fe0('0x41')][_0x1e01a5[_0x2fe0('0x18')]],'motionChannel':'voice'};logger[_0x2fe0('0x22')](_0x2fe0('0x42'),_0x1e01a5[_0x2fe0('0x18')],_0x1e01a5['variable']['outboundrouteid'],_[_0x2fe0('0x43')](_0x1e01a5['variable'])[0x0],_0x1e01a5[_0x2fe0('0x3d')]);logger['debug'](_0x2fe0('0x44'),_0x1e01a5['uniqueid'],util[_0x2fe0('0x17')](this[_0x2fe0('0x9')][_0x1e01a5[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x2fe0('0x38'),'voice_outbound_channel:save',this['channels'][_0x1e01a5['uniqueid']]);}}}}catch(_0x3bdafe){logger[_0x2fe0('0x2a')](_0x2fe0('0x45'),_0x1e01a5['uniqueid'],util[_0x2fe0('0x17')](_0x3bdafe,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2fe0('0x14')][_0x2fe0('0x3c')]=function(_0x5cd1b5,_0x2998ce,_0x16a18d){var _0x175154=[_0x2fe0('0x46'),_0x2fe0('0x47'),_0x2fe0('0x48'),_0x2fe0('0x49'),_0x2fe0('0x4a'),_0x2fe0('0x4b'),_0x2fe0('0x4c'),_0x2fe0('0x4d'),'sipcallid',_0x2fe0('0x4e'),_0x2fe0('0x4f'),'bridgepvtcallid',_0x2fe0('0x50'),_0x2fe0('0x51'),_0x2fe0('0x52'),'memberlastcall',_0x2fe0('0x24'),_0x2fe0('0x53'),_0x2fe0('0x54')];if(!_[_0x2fe0('0x55')](_0x2998ce)&&!_['includes'](_0x175154,_0x2998ce)){if(_[_0x2fe0('0x40')](this[_0x2fe0('0x41')][_0x5cd1b5])){this['variables'][_0x5cd1b5]={};}this[_0x2fe0('0x41')][_0x5cd1b5][_0x2998ce]=_0x16a18d;}};VoiceDialReport[_0x2fe0('0x14')][_0x2fe0('0x13')]=function(_0x43a60d){try{if(this[_0x2fe0('0x2c')](_0x43a60d)){logger[_0x2fe0('0x16')](_0x2fe0('0x56'),_0x43a60d[_0x2fe0('0x18')],util[_0x2fe0('0x17')](_0x43a60d,{'showHidden':![],'depth':null}));if(this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]]){logger[_0x2fe0('0x22')](_0x2fe0('0x57'),_0x43a60d[_0x2fe0('0x18')],_0x43a60d[_0x2fe0('0x58')]);this[_0x2fe0('0x9')][_0x43a60d['uniqueid']][_0x2fe0('0x59')]=moment()[_0x2fe0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x43a60d['uniqueid']][_0x2fe0('0x5a')]=moment(this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]][_0x2fe0('0x59')])[_0x2fe0('0x5b')](this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]]['starttime'],_0x2fe0('0x5c'));this['channels'][_0x43a60d[_0x2fe0('0x18')]]['lastevent']=_0x2fe0('0x5d');this[_0x2fe0('0x5e')][_0x2fe0('0x5f')]+=0x1;if(this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]][_0x2fe0('0x32')]){this[_0x2fe0('0x5e')][_0x2fe0('0x60')]+=0x1;this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]]['holdtime']=moment(this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]][_0x2fe0('0x32')])[_0x2fe0('0x5b')](this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]][_0x2fe0('0x61')],_0x2fe0('0x5c'));this['channels'][_0x43a60d[_0x2fe0('0x18')]][_0x2fe0('0x62')]=moment(this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]]['endtime'])[_0x2fe0('0x5b')](this['channels'][_0x43a60d[_0x2fe0('0x18')]][_0x2fe0('0x32')],'seconds');this[_0x2fe0('0x5e')][_0x2fe0('0x63')]+=this[_0x2fe0('0x9')][_0x43a60d['uniqueid']][_0x2fe0('0x64')]||0x0;this[_0x2fe0('0x5e')][_0x2fe0('0x65')]+=this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]][_0x2fe0('0x62')];}this[_0x2fe0('0x5e')]['sumDuration']+=this['channels'][_0x43a60d[_0x2fe0('0x18')]]['duration'];logger[_0x2fe0('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x43a60d[_0x2fe0('0x18')],util[_0x2fe0('0x17')](this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2fe0('0x66'),this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]]);logger[_0x2fe0('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x43a60d[_0x2fe0('0x18')],util[_0x2fe0('0x17')](this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));ami[_0x2fe0('0x15')](_0x2fe0('0x67'),this['channels'][_0x43a60d['uniqueid']]);logger[_0x2fe0('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x43a60d[_0x2fe0('0x18')],util['inspect'](this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]],{'showHidden':![],'depth':null}));this[_0x2fe0('0x15')](_0x2fe0('0x38'),'voice_outbound:save',this['outbound']);logger[_0x2fe0('0x22')](_0x2fe0('0x68'),JSON[_0x2fe0('0x69')](this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x18')]]));logger[_0x2fe0('0x16')](_0x2fe0('0x6a'),_0x43a60d[_0x2fe0('0x18')],util[_0x2fe0('0x17')](this[_0x2fe0('0x9')][_0x43a60d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x2fe0('0x15')](_0x2fe0('0x38'),_0x2fe0('0x6b'),this['channels'][_0x43a60d[_0x2fe0('0x18')]]);delete this[_0x2fe0('0x9')][_0x43a60d['uniqueid']];}else if(this[_0x2fe0('0x9')][_0x43a60d['linkedid']]){this[_0x2fe0('0x9')][_0x43a60d[_0x2fe0('0x6c')]][_0x2fe0('0x18')]=this[_0x2fe0('0x9')][_0x43a60d['linkedid']][_0x2fe0('0x6d')];}if(this['variables'][_0x43a60d[_0x2fe0('0x18')]]){delete this[_0x2fe0('0x41')][_0x43a60d[_0x2fe0('0x18')]];}}}catch(_0x19aaee){logger[_0x2fe0('0x2a')](_0x2fe0('0x6e'),_0x43a60d['uniqueid'],util[_0x2fe0('0x17')](_0x19aaee,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x58835c){try{if(this[_0x2fe0('0x2c')](_0x58835c)){logger[_0x2fe0('0x16')](_0x2fe0('0x6f'),_0x58835c[_0x2fe0('0x18')],util[_0x2fe0('0x17')](_0x58835c,{'showHidden':![],'depth':null}));if(_0x58835c['application'][_0x2fe0('0x70')]()===_0x2fe0('0x71')){_0x58835c[_0x2fe0('0x72')]=(_0x58835c['appdata']||_0x58835c[_0x2fe0('0x72')])[_0x2fe0('0x70')]();if(_['startsWith'](_0x58835c[_0x2fe0('0x72')],'cdr(')){if(_[_0x2fe0('0x40')](this[_0x2fe0('0xa')][_0x58835c[_0x2fe0('0x18')]]))this['applications'][_0x58835c['uniqueid']]={};logger[_0x2fe0('0x22')](_0x2fe0('0x73'),_0x58835c[_0x2fe0('0x18')],_0x58835c[_0x2fe0('0x74')],_0x58835c[_0x2fe0('0x72')]);var _0x2dd952=_0x58835c[_0x2fe0('0x72')][_0x2fe0('0x75')]('=');var _0x1e9d00=_0x2dd952[0x0][_0x2fe0('0x76')](/cdr\((.*)\)/);if(_0x1e9d00)this[_0x2fe0('0xa')][_0x58835c[_0x2fe0('0x18')]][_0x1e9d00[0x1]]=_0x2dd952[0x1];}}}}catch(_0x39cb33){logger[_0x2fe0('0x2a')](_0x2fe0('0x77'),_0x58835c[_0x2fe0('0x18')],util[_0x2fe0('0x17')](_0x39cb33,{'showHidden':![],'depth':null}));}};module[_0x2fe0('0x78')]=VoiceDialReport; \ No newline at end of file +var _0xa43d=['merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','event','privilege','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','isUndefined','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','complete','total','answered','holdtime','diff','billableseconds','sumHoldTime','sumBillable','[%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','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','outboundChannels','outbound','applications','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncNewExten','hangup','syncHangup','prototype','isNotNull','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','channels'];(function(_0x431e9e,_0x1ed135){var _0x15f60b=function(_0x469b0f){while(--_0x469b0f){_0x431e9e['push'](_0x431e9e['shift']());}};_0x15f60b(++_0x1ed135);}(_0xa43d,0x1c0));var _0xda43=function(_0x3bf3f1,_0x5b8238){_0x3bf3f1=_0x3bf3f1-0x0;var _0x5a0c0c=_0xa43d[_0x3bf3f1];return _0x5a0c0c;};'use strict';var _=require(_0xda43('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xda43('0x1'));var config=require('../../../config/environment');var logger=require(_0xda43('0x2'))(_0xda43('0x3'));var ami=require(_0xda43('0x4'));config[_0xda43('0x5')]=_[_0xda43('0x6')](config[_0xda43('0x5')],{'host':_0xda43('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda43('0x5')]));function VoiceDialReport(_0x556726){this['channels']=_0x556726[_0xda43('0x8')];this['outbound']=_0x556726[_0xda43('0x9')];this[_0xda43('0xa')]={};this[_0xda43('0xb')]={};ami['on'](_0xda43('0xc'),this['syncDialBegin'][_0xda43('0xd')](this));ami['on'](_0xda43('0xe'),this[_0xda43('0xf')]['bind'](this));ami['on'](_0xda43('0x10'),this[_0xda43('0x11')][_0xda43('0xd')](this));ami['on']('newexten',this[_0xda43('0x12')][_0xda43('0xd')](this));ami['on'](_0xda43('0x13'),this[_0xda43('0x14')][_0xda43('0xd')](this));}VoiceDialReport[_0xda43('0x15')][_0xda43('0x16')]=function(_0x25cbcf){return _0x25cbcf!==null&&!_['isUndefined'](_0x25cbcf);};VoiceDialReport['prototype'][_0xda43('0x17')]=function(_0x361082,_0x1ecec9,_0x140da2){io['to'](_0x361082)['emit'](_0x1ecec9,_0x140da2);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x3e36d6){try{if(this[_0xda43('0x16')](_0x3e36d6)){logger[_0xda43('0x18')](_0xda43('0x19'),_0x3e36d6[_0xda43('0x1a')],util['inspect'](_0x3e36d6,{'showHidden':![],'depth':null}));if(this[_0xda43('0x1b')][_0x3e36d6['uniqueid']]){_[_0xda43('0x1c')](this[_0xda43('0x1b')][_0x3e36d6[_0xda43('0x1a')]],{'starttime':moment()[_0xda43('0x1d')](_0xda43('0x1e')),'lastevent':_0xda43('0x1f'),'interface':_0x3e36d6[_0xda43('0x20')]['substring'](0x0,_0x3e36d6[_0xda43('0x20')][_0xda43('0x21')]('-')),'membername':_0x3e36d6[_0xda43('0x20')]['substring'](_0x3e36d6[_0xda43('0x20')]['lastIndexOf']('/')+0x1,_0x3e36d6[_0xda43('0x20')][_0xda43('0x21')]('-'))},_['omit'](_0x3e36d6,[_0xda43('0x22'),_0xda43('0x23')]));logger[_0xda43('0x24')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x3e36d6[_0xda43('0x1a')],this[_0xda43('0x1b')][_0x3e36d6[_0xda43('0x1a')]][_0xda43('0x25')],this[_0xda43('0x1b')][_0x3e36d6[_0xda43('0x1a')]][_0xda43('0x26')]);logger['debug'](_0xda43('0x27'),_0x3e36d6['uniqueid'],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x3e36d6[_0xda43('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x3e36d6[_0xda43('0x1a')]])_[_0xda43('0x1c')](this[_0xda43('0x1b')][_0x3e36d6[_0xda43('0x1a')]],this[_0xda43('0xa')][_0x3e36d6[_0xda43('0x1a')]]);this[_0xda43('0x17')](_0xda43('0x29'),'voice_outbound_channel:save',this[_0xda43('0x1b')][_0x3e36d6['uniqueid']]);logger[_0xda43('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x3e36d6[_0xda43('0x1a')],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x3e36d6[_0xda43('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xda43('0x17')](_0xda43('0x2a'),this[_0xda43('0x1b')][_0x3e36d6[_0xda43('0x1a')]]);}}}catch(_0x559d2b){logger[_0xda43('0x2b')](_0xda43('0x2c'),_0x3e36d6[_0xda43('0x1a')],util[_0xda43('0x28')](_0x559d2b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xda43('0x15')][_0xda43('0xf')]=function(_0x143bbc){try{if(this['isNotNull'](_0x143bbc)){logger['debug'](_0xda43('0x2d'),_0x143bbc[_0xda43('0x1a')],util['inspect'](_0x143bbc,{'showHidden':![],'depth':null}));if(this[_0xda43('0x1b')][_0x143bbc[_0xda43('0x1a')]]){this[_0xda43('0x1b')][_0x143bbc['uniqueid']][_0xda43('0x2e')]=_0x143bbc[_0xda43('0x2e')];if(_0x143bbc[_0xda43('0x2e')]===_0xda43('0x2f')){this[_0xda43('0x1b')][_0x143bbc[_0xda43('0x1a')]][_0xda43('0x30')]=_0x143bbc[_0xda43('0x30')];this['channels'][_0x143bbc[_0xda43('0x1a')]][_0xda43('0x31')]=_0x143bbc[_0xda43('0x31')];this[_0xda43('0x1b')][_0x143bbc['uniqueid']][_0xda43('0x32')]=moment()[_0xda43('0x1d')](_0xda43('0x1e'));this[_0xda43('0x1b')][_0x143bbc[_0xda43('0x1a')]][_0xda43('0x33')]=_0xda43('0x34');logger[_0xda43('0x24')](_0xda43('0x35'),_0x143bbc[_0xda43('0x1a')],_0x143bbc[_0xda43('0x20')]['substring'](_0x143bbc['channel'][_0xda43('0x21')]('/')+0x1,_0x143bbc['channel']['lastIndexOf']('-')));logger[_0xda43('0x18')](_0xda43('0x36'),_0x143bbc[_0xda43('0x1a')],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x143bbc['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xda43('0x17')]('custom:dialconnect',this[_0xda43('0x1b')][_0x143bbc['uniqueid']]);}logger[_0xda43('0x18')](_0xda43('0x37'),_0x143bbc[_0xda43('0x1a')],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x143bbc['uniqueid']],{'showHidden':![],'depth':null}));this[_0xda43('0x17')](_0xda43('0x29'),_0xda43('0x38'),this[_0xda43('0x1b')][_0x143bbc['uniqueid']]);}}}catch(_0x3dc851){logger[_0xda43('0x2b')](_0xda43('0x39'),_0x143bbc[_0xda43('0x1a')],util[_0xda43('0x28')](_0x3dc851,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x62aedc){try{if(this['isNotNull'](_0x62aedc)){logger[_0xda43('0x18')](_0xda43('0x3a'),_0x62aedc[_0xda43('0x1a')],util['inspect'](_0x62aedc,{'showHidden':![],'depth':null}));this[_0xda43('0x3b')](_0x62aedc['uniqueid'],_[_0xda43('0x3c')](_0x62aedc[_0xda43('0x3d')])[0x0],_0x62aedc[_0xda43('0x3e')]);if(this[_0xda43('0x16')](_0x62aedc[_0xda43('0x3d')])&&this[_0xda43('0x16')](_0x62aedc['variable'][_0xda43('0x3f')])){if(_['isUndefined'](this[_0xda43('0x1b')][_0x62aedc[_0xda43('0x1a')]])){this[_0xda43('0x1b')][_0x62aedc[_0xda43('0x1a')]]={'routeId':_0x62aedc[_0xda43('0x3e')],'variables':this[_0xda43('0xb')][_0x62aedc[_0xda43('0x1a')]],'motionChannel':_0xda43('0x40')};logger[_0xda43('0x24')](_0xda43('0x41'),_0x62aedc[_0xda43('0x1a')],_0x62aedc[_0xda43('0x3d')]['outboundrouteid'],_[_0xda43('0x3c')](_0x62aedc[_0xda43('0x3d')])[0x0],_0x62aedc[_0xda43('0x3e')]);logger[_0xda43('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x62aedc[_0xda43('0x1a')],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x62aedc['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xda43('0x29'),'voice_outbound_channel:save',this[_0xda43('0x1b')][_0x62aedc[_0xda43('0x1a')]]);}}}}catch(_0x4e966d){logger[_0xda43('0x2b')]('[%s][voiceDialReport][varset]',_0x62aedc[_0xda43('0x1a')],util[_0xda43('0x28')](_0x4e966d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xda43('0x15')]['addVariable']=function(_0x124500,_0x2d9650,_0x5f24f8){var _0xe1c262=[_0xda43('0x42'),_0xda43('0x43'),_0xda43('0x44'),_0xda43('0x45'),_0xda43('0x46'),'rtpaudioqoslossbridged',_0xda43('0x47'),_0xda43('0x48'),_0xda43('0x49'),'sipuri',_0xda43('0x4a'),_0xda43('0x4b'),_0xda43('0x4c'),_0xda43('0x4d'),_0xda43('0x4e'),_0xda43('0x4f'),'membername',_0xda43('0x50'),'memberrealtime'];if(!_[_0xda43('0x51')](_0x2d9650)&&!_[_0xda43('0x52')](_0xe1c262,_0x2d9650)){if(_[_0xda43('0x53')](this[_0xda43('0xb')][_0x124500])){this[_0xda43('0xb')][_0x124500]={};}this[_0xda43('0xb')][_0x124500][_0x2d9650]=_0x5f24f8;}};VoiceDialReport['prototype'][_0xda43('0x14')]=function(_0x26b023){try{if(this[_0xda43('0x16')](_0x26b023)){logger[_0xda43('0x18')](_0xda43('0x54'),_0x26b023['uniqueid'],util[_0xda43('0x28')](_0x26b023,{'showHidden':![],'depth':null}));if(this[_0xda43('0x1b')][_0x26b023['uniqueid']]){logger['info'](_0xda43('0x55'),_0x26b023[_0xda43('0x1a')],_0x26b023[_0xda43('0x56')]);this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]][_0xda43('0x57')]=moment()[_0xda43('0x1d')](_0xda43('0x1e'));this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]][_0xda43('0x58')]=moment(this[_0xda43('0x1b')][_0x26b023['uniqueid']]['endtime'])['diff'](this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]][_0xda43('0x59')],_0xda43('0x5a'));this['channels'][_0x26b023['uniqueid']]['lastevent']=_0xda43('0x5b');this['outbound'][_0xda43('0x5c')]+=0x1;if(this[_0xda43('0x1b')][_0x26b023['uniqueid']][_0xda43('0x32')]){this[_0xda43('0x9')][_0xda43('0x5d')]+=0x1;this[_0xda43('0x1b')][_0x26b023['uniqueid']][_0xda43('0x5e')]=moment(this['channels'][_0x26b023['uniqueid']]['answertime'])[_0xda43('0x5f')](this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]][_0xda43('0x59')],'seconds');this[_0xda43('0x1b')][_0x26b023['uniqueid']][_0xda43('0x60')]=moment(this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]][_0xda43('0x57')])['diff'](this[_0xda43('0x1b')][_0x26b023['uniqueid']][_0xda43('0x32')],_0xda43('0x5a'));this[_0xda43('0x9')][_0xda43('0x61')]+=this['channels'][_0x26b023[_0xda43('0x1a')]][_0xda43('0x5e')]||0x0;this[_0xda43('0x9')][_0xda43('0x62')]+=this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]]['billableseconds'];}this[_0xda43('0x9')]['sumDuration']+=this['channels'][_0x26b023[_0xda43('0x1a')]][_0xda43('0x58')];logger[_0xda43('0x18')](_0xda43('0x63'),_0x26b023[_0xda43('0x1a')],util['inspect'](this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xda43('0x17')](_0xda43('0x64'),this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]]);logger[_0xda43('0x18')](_0xda43('0x65'),_0x26b023[_0xda43('0x1a')],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xda43('0x17')](_0xda43('0x66'),this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]]);logger[_0xda43('0x18')](_0xda43('0x67'),_0x26b023[_0xda43('0x1a')],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]],{'showHidden':![],'depth':null}));this[_0xda43('0x17')]('voice:outbound',_0xda43('0x68'),this[_0xda43('0x9')]);logger['info'](_0xda43('0x69'),JSON[_0xda43('0x6a')](this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]]));logger[_0xda43('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x26b023[_0xda43('0x1a')],util[_0xda43('0x28')](this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]],{'showHidden':![],'depth':null}));this[_0xda43('0x17')](_0xda43('0x29'),'voice_outbound_channel:remove',this[_0xda43('0x1b')][_0x26b023[_0xda43('0x1a')]]);delete this[_0xda43('0x1b')][_0x26b023['uniqueid']];}else if(this[_0xda43('0x1b')][_0x26b023[_0xda43('0x6b')]]){this['channels'][_0x26b023[_0xda43('0x6b')]][_0xda43('0x1a')]=this[_0xda43('0x1b')][_0x26b023[_0xda43('0x6b')]][_0xda43('0x6c')];}if(this[_0xda43('0xb')][_0x26b023[_0xda43('0x1a')]]){delete this[_0xda43('0xb')][_0x26b023['uniqueid']];}}}catch(_0x3b08e3){logger[_0xda43('0x2b')](_0xda43('0x6d'),_0x26b023[_0xda43('0x1a')],util[_0xda43('0x28')](_0x3b08e3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xda43('0x15')][_0xda43('0x12')]=function(_0x309a78){try{if(this[_0xda43('0x16')](_0x309a78)){logger['debug'](_0xda43('0x6e'),_0x309a78[_0xda43('0x1a')],util[_0xda43('0x28')](_0x309a78,{'showHidden':![],'depth':null}));if(_0x309a78[_0xda43('0x6f')]['toLowerCase']()===_0xda43('0x70')){_0x309a78[_0xda43('0x71')]=(_0x309a78['appdata']||_0x309a78[_0xda43('0x71')])['toLowerCase']();if(_['startsWith'](_0x309a78[_0xda43('0x71')],_0xda43('0x72'))){if(_['isUndefined'](this[_0xda43('0xa')][_0x309a78[_0xda43('0x1a')]]))this[_0xda43('0xa')][_0x309a78[_0xda43('0x1a')]]={};logger[_0xda43('0x24')](_0xda43('0x73'),_0x309a78[_0xda43('0x1a')],_0x309a78[_0xda43('0x6f')],_0x309a78[_0xda43('0x71')]);var _0x19c46c=_0x309a78[_0xda43('0x71')]['split']('=');var _0x1b4a5f=_0x19c46c[0x0][_0xda43('0x74')](/cdr\((.*)\)/);if(_0x1b4a5f)this[_0xda43('0xa')][_0x309a78[_0xda43('0x1a')]][_0x1b4a5f[0x1]]=_0x19c46c[0x1];}}}}catch(_0x1e4563){logger[_0xda43('0x2b')](_0xda43('0x75'),_0x309a78[_0xda43('0x1a')],util['inspect'](_0x1e4563,{'showHidden':![],'depth':null}));}};module[_0xda43('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index c883b7d..6f1778a 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 _0xbc4a=['appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','lodash','moment','util','../ami','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueShow','hasOwnProperty','isEmpty','talking','pTalking','waiting','queueStatusComplete','clearZombieChannels','switch','isNil','status','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','name','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice:queue:%s','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','total','abandoned','Trunk','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','Action','catch','[voiceQueueReport][queues]','loopQueueSummary','then','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','callers','loggedIn','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','emitVoiceQueueChannelSave','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','queuecallerexitreason','FORWARDTRANSFER','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','value','variable','queuestatus','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','includes','[%s][voiceQueueReport][hangup]','length','unmanaged','diff','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transfertype','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','BlindTransfer','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','milliseconds','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata'];(function(_0x285284,_0x263b69){var _0x4302b6=function(_0x3c42b4){while(--_0x3c42b4){_0x285284['push'](_0x285284['shift']());}};_0x4302b6(++_0x263b69);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x38d02e,_0x25e501){_0x38d02e=_0x38d02e-0x0;var _0x52209e=_0xbc4a[_0x38d02e];return _0x52209e;};'use strict';var _=require(_0xabc4('0x0'));var moment=require(_0xabc4('0x1'));var util=require(_0xabc4('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0xabc4('0x3'));var QueueReport=require('../model/queueReport');config[_0xabc4('0x4')]=_[_0xabc4('0x5')](config[_0xabc4('0x4')],{'host':_0xabc4('0x6'),'port':0x18eb});var io=require(_0xabc4('0x7'))(new Redis(config[_0xabc4('0x4')]));var Sequence=function(){};Sequence[_0xabc4('0x8')][_0xabc4('0x9')]=function(_0x159741){this[_0xabc4('0xa')]=this[_0xabc4('0xa')]?this[_0xabc4('0xa')][_0xabc4('0xb')](_0x159741):_0x159741();};function VoiceQueueReport(_0x38965f){this[_0xabc4('0xc')]=new Sequence();this[_0xabc4('0xd')]={};this[_0xabc4('0xe')]=_0x38965f[_0xabc4('0xe')];this[_0xabc4('0xf')]=_0x38965f[_0xabc4('0x10')];this[_0xabc4('0x11')]=_0x38965f[_0xabc4('0x11')];this[_0xabc4('0x12')]=!![];this[_0xabc4('0x13')]=_0x38965f[_0xabc4('0x13')];this[_0xabc4('0x14')]={};ami['on'](_0xabc4('0x15'),this['syncQueueSummary'][_0xabc4('0x16')](this));ami['on'](_0xabc4('0x17'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xabc4('0x18'),this[_0xabc4('0x19')][_0xabc4('0x16')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xabc4('0x1a'),this[_0xabc4('0x1b')][_0xabc4('0x16')](this));ami['on'](_0xabc4('0x1c'),this[_0xabc4('0x1d')][_0xabc4('0x16')](this));ami['on'](_0xabc4('0x1e'),this[_0xabc4('0x1f')]['bind'](this));ami['on']('varset',this[_0xabc4('0x20')][_0xabc4('0x16')](this));ami['on'](_0xabc4('0x21'),this[_0xabc4('0x22')]['bind'](this));ami['on'](_0xabc4('0x23'),this[_0xabc4('0x24')][_0xabc4('0x16')](this));ami['on']('newexten',this['syncNewExten'][_0xabc4('0x16')](this));ami['on'](_0xabc4('0x25'),this[_0xabc4('0x26')][_0xabc4('0x16')](this));ami['on'](_0xabc4('0x27'),this['syncMusicOnHoldStop'][_0xabc4('0x16')](this));ami['on'](_0xabc4('0x28'),this[_0xabc4('0x29')][_0xabc4('0x16')](this));ami['on']('blindtransfer',this[_0xabc4('0x2a')][_0xabc4('0x16')](this));this['loopQueueSummary']();this[_0xabc4('0x2b')]();}function clearChannels(_0x37eabd){if(!_['isEmpty'](_0x37eabd)){for(var _0x138189 in _0x37eabd){if(_0x37eabd[_0xabc4('0x2c')](_0x138189)){delete _0x37eabd[_0x138189];}}}}function clearCampaigns(_0x146c2f){if(!_[_0xabc4('0x2d')](_0x146c2f)){for(var _0x310ea7 in _0x146c2f){if(_0x146c2f[_0xabc4('0x2c')](_0x310ea7)){_0x146c2f[_0x310ea7]['originated']=0x0;}}}}function clearVoiceQueues(_0x567f15){if(!_[_0xabc4('0x2d')](_0x567f15)){for(var _0x43ff41 in _0x567f15){if(_0x567f15[_0xabc4('0x2c')](_0x43ff41)){_0x567f15[_0x43ff41]['originated']=0x0;_0x567f15[_0x43ff41][_0xabc4('0x2e')]=0x0;_0x567f15[_0x43ff41][_0xabc4('0x2f')]=0x0;_0x567f15[_0x43ff41][_0xabc4('0x30')]=0x0;_0x567f15[_0x43ff41][_0xabc4('0x31')]=!![];}}}}function clearAgentBooked(_0x4db1f9){if(!_[_0xabc4('0x2d')](_0x4db1f9)){for(var _0x5d6e9b in _0x4db1f9){if(_0x4db1f9[_0xabc4('0x2c')](_0x5d6e9b)){_0x4db1f9[_0x5d6e9b]['unlockRR']=!![];}}}}VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x32')]=function(){var _0x3a8b76=this;for(var _0x363c2f in this['channels']){if(this[_0xabc4('0xf')]['hasOwnProperty'](_0x363c2f)&&!this[_0xabc4('0xf')][_0x363c2f][_0xabc4('0x33')]){this[_0xabc4('0xc')][_0xabc4('0x9')](function(){if(!_[_0xabc4('0x34')](_0x3a8b76['channels'][_0x363c2f])){return ami['Action']({'action':_0xabc4('0x35'),'channel':_0x3a8b76[_0xabc4('0xf')][_0x363c2f]['channel']})['catch'](function(_0x5add58){if(_0x5add58[_0xabc4('0x36')]===_0xabc4('0x37')){setTimeout(function(){if(_0x3a8b76[_0xabc4('0xf')][_0x363c2f]){delete _0x3a8b76[_0xabc4('0xf')][_0x363c2f];logger[_0xabc4('0x38')](_0xabc4('0x39'),_0x363c2f,util[_0xabc4('0x3a')](_0x5add58,{'showHidden':![],'depth':null}));}if(_0x3a8b76[_0xabc4('0xd')][_0x363c2f]){delete _0x3a8b76['queueReports'][_0x363c2f];logger[_0xabc4('0x38')](_0xabc4('0x3b'),_0x363c2f,util[_0xabc4('0x3a')](_0x5add58,{'showHidden':![],'depth':null}));}if(_0x3a8b76[_0xabc4('0x14')][_0x363c2f]){delete _0x3a8b76[_0xabc4('0x14')][_0x363c2f];logger[_0xabc4('0x38')](_0xabc4('0x3c'),_0x363c2f,util[_0xabc4('0x3a')](_0x5add58,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xabc4('0x8')]['syncFullyBooted']=function(){logger['error'](_0xabc4('0x3d'));clearChannels(this[_0xabc4('0xf')]);this[_0xabc4('0x3e')](this[_0xabc4('0xd')]);clearAgentBooked(this['agents']);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xabc4('0x13')]);};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x3e')]=function(_0x1fe1c5){var _0x18e781=this;if(!_[_0xabc4('0x2d')](_0x1fe1c5)){for(var _0x9cb543 in _0x1fe1c5){if(_0x1fe1c5[_0xabc4('0x2c')](_0x9cb543)){_0x18e781[_0xabc4('0x3f')](_0x1fe1c5[_0x9cb543],_0xabc4('0x40'));delete _0x1fe1c5[_0x9cb543];}}}};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x41')]=function(_0x5291fb,_0x11eb8b,_0x424069){io['to'](_0x5291fb)[_0xabc4('0x41')](_0x11eb8b,_0x424069);};VoiceQueueReport[_0xabc4('0x8')]['emitVoiceQueueChannelSave']=function(_0x2e8bdb,_0x584c7a){logger[_0xabc4('0x42')](_0xabc4('0x43')+_0x584c7a+_0xabc4('0x44'),_0x2e8bdb['uniqueid'],util['inspect'](_0x2e8bdb,{'showHidden':![],'depth':null}));this[_0xabc4('0x41')](util[_0xabc4('0x45')]('voice:queue:%s',_0x2e8bdb[_0xabc4('0x46')]),_0xabc4('0x47'),_0x2e8bdb);io['emit'](_0xabc4('0x48'),_0x2e8bdb);};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x3f')]=function(_0x1d68cf,_0x1c2bf7){logger[_0xabc4('0x42')](_0xabc4('0x43')+_0x1c2bf7+_0xabc4('0x49'),_0x1d68cf[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x1d68cf,{'showHidden':![],'depth':null}));this[_0xabc4('0x41')](util[_0xabc4('0x45')](_0xabc4('0x4b'),_0x1d68cf[_0xabc4('0x46')]),'voice_queue_channel:remove',_0x1d68cf);io[_0xabc4('0x41')](_0xabc4('0x4c'),_0x1d68cf);};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x4d')]=function(_0x4654fb,_0x5f4c69){if(_0x4654fb[_0xabc4('0x4e')]===_0xabc4('0x4f')){var _0x8c3729={'id':_0x4654fb['id'],'name':_0x4654fb[_0xabc4('0x46')],'strategy':_0x4654fb[_0xabc4('0x50')],'answered':_0x4654fb[_0xabc4('0x51')],'available':_0x4654fb[_0xabc4('0x52')],'loggedIn':_0x4654fb['loggedIn'],'pTalking':_0x4654fb[_0xabc4('0x2f')],'sumBillable':_0x4654fb[_0xabc4('0x53')],'sumDuration':_0x4654fb[_0xabc4('0x54')],'sumHoldTime':_0x4654fb[_0xabc4('0x55')]||0x0,'talking':_0x4654fb['talking'],'total':_0x4654fb[_0xabc4('0x56')],'type':_0x4654fb[_0xabc4('0x4e')],'unmanaged':_0x4654fb['unmanaged'],'abandoned':_0x4654fb[_0xabc4('0x57')],'waiting':_0x4654fb[_0xabc4('0x30')]};if(_0x4654fb[_0xabc4('0x58')]){_0x8c3729[_0xabc4('0x58')]={'id':_0x4654fb['Trunk']['id'],'name':_0x4654fb[_0xabc4('0x58')][_0xabc4('0x46')],'active':_0x4654fb[_0xabc4('0x58')]['active'],'callerid':_0x4654fb[_0xabc4('0x58')]['callerid']};}if(_0x4654fb['Interval']){_0x8c3729['Interval']={'id':_0x4654fb['Interval']['id'],'name':_0x4654fb[_0xabc4('0x59')][_0xabc4('0x46')]};}var _0x325f22=md5(JSON[_0xabc4('0x5a')](_0x8c3729));if(_0x4654fb[_0xabc4('0x5b')]!==_0x325f22){_0x4654fb['md5']=_0x325f22;logger['debug'](_0xabc4('0x5c')+_0x5f4c69+_0xabc4('0x5d'),util[_0xabc4('0x3a')](_0x8c3729,{'showHidden':![],'depth':null}));this[_0xabc4('0x41')](util['format']('voice:queue:%s',_0x8c3729[_0xabc4('0x46')]),_0xabc4('0x5e'),_0x8c3729);}}};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x5f')]=function(_0x380e81){return _0x380e81!==null&&!_[_0xabc4('0x60')](_0x380e81);};VoiceQueueReport[_0xabc4('0x8')]['loopQueueShow']=function(){var _0x45821f=this;setInterval(function(){_0x45821f[_0xabc4('0x32')]();ami[_0xabc4('0x61')]({'action':'queues'})[_0xabc4('0x62')](function(_0x580e64){logger[_0xabc4('0x38')](_0xabc4('0x63'),util['inspect'](_0x580e64,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x64')]=function(){var _0x5357ed=this;setInterval(function(){if(_0x5357ed['flagQueueSummary']){return ami[_0xabc4('0x61')]({'action':_0xabc4('0x15')})[_0xabc4('0x65')](function(_0x4046b5){_0x5357ed[_0xabc4('0x12')]=![];})['catch'](function(_0x5f1bf4){logger[_0xabc4('0x38')](_0xabc4('0x66'),util[_0xabc4('0x3a')](_0x5f1bf4,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xabc4('0x67')]=function(_0x431a3f){try{if(this[_0xabc4('0x5f')](_0x431a3f)&&this[_0xabc4('0x5f')](_0x431a3f[_0xabc4('0x68')])){logger['debug'](_0xabc4('0x69'),util[_0xabc4('0x3a')](_0x431a3f,{'showHidden':![],'depth':null}));if(this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]]){logger['info'](_0xabc4('0x6a'),_0x431a3f['queue']);var _0x55a6d5=_['countBy'](this[_0xabc4('0xf')],_0xabc4('0x68'))[_0x431a3f[_0xabc4('0x68')]]||0x0;var _0x134f3f=_0x55a6d5-_0x431a3f[_0xabc4('0x6b')];if(this['voiceQueues'][_0x431a3f['queue']]['waiting']!==_['toNumber'](_0x431a3f[_0xabc4('0x6b')])||this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]][_0xabc4('0x6c')]!==_[_0xabc4('0x6d')](_0x431a3f[_0xabc4('0x6e')])||this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]]['available']!==_[_0xabc4('0x6d')](_0x431a3f[_0xabc4('0x52')])||this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]][_0xabc4('0x2e')]!==_0x134f3f){this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]][_0xabc4('0x30')]=_[_0xabc4('0x6d')](_0x431a3f[_0xabc4('0x6b')]);this[_0xabc4('0x11')][_0x431a3f['queue']][_0xabc4('0x6c')]=_[_0xabc4('0x6d')](_0x431a3f['loggedin']);this[_0xabc4('0x11')][_0x431a3f['queue']][_0xabc4('0x52')]=_[_0xabc4('0x6d')](_0x431a3f[_0xabc4('0x52')]);this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]][_0xabc4('0x2e')]=_0x134f3f>0x0?_0x134f3f:0x0;this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]][_0xabc4('0x2e')]=this['voiceQueues'][_0x431a3f['queue']][_0xabc4('0x2e')]>_['toNumber'](_0x431a3f['loggedin'])?_['toNumber'](_0x431a3f[_0xabc4('0x6e')]):this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]][_0xabc4('0x2e')];this['emitVoiceQueueSummary'](this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]],_0xabc4('0x15'));}logger[_0xabc4('0x42')](_0xabc4('0x6f'),util['inspect'](this[_0xabc4('0x11')][_0x431a3f['queue']],{'showHidden':![],'depth':null}));ami[_0xabc4('0x41')](_0xabc4('0x70'),this[_0xabc4('0x11')][_0x431a3f[_0xabc4('0x68')]]);}}}catch(_0x318a43){logger[_0xabc4('0x38')]('[voiceQueueReport][queuesummary]',util[_0xabc4('0x3a')](_0x318a43,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xabc4('0x71')]=function(_0x221859){logger[_0xabc4('0x42')](_0xabc4('0x72'),util['inspect'](_0x221859,{'showHidden':![],'depth':null}));this[_0xabc4('0x12')]=!![];};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x19')]=function(_0x167013){try{if(this[_0xabc4('0x5f')](_0x167013)){logger[_0xabc4('0x42')](_0xabc4('0x73'),_0x167013[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x167013,{'showHidden':![],'depth':null}));if(_[_0xabc4('0x60')](this['queueReports'][_0x167013[_0xabc4('0x4a')]]))this[_0xabc4('0xd')][_0x167013[_0xabc4('0x4a')]]=[];if(_[_0xabc4('0x60')](this[_0xabc4('0xf')][_0x167013[_0xabc4('0x4a')]]))this[_0xabc4('0xf')][_0x167013[_0xabc4('0x4a')]]={};var _0x197d10=new QueueReport();_0x197d10[_0xabc4('0x46')]=_0x167013[_0xabc4('0x68')];_0x197d10[_0xabc4('0x4e')]=this[_0xabc4('0x11')][_0x197d10[_0xabc4('0x46')]]&&this['voiceQueues'][_0x197d10['name']]['type']?this[_0xabc4('0x11')][_0x197d10[_0xabc4('0x46')]][_0xabc4('0x4e')]||'inbound':'inbound';_0x197d10[_0xabc4('0x68')]=_0x167013[_0xabc4('0x68')];_0x197d10[_0xabc4('0x74')]=moment()[_0xabc4('0x45')](_0xabc4('0x75'));_0x197d10[_0xabc4('0x76')]=_0x167013['position'];_0x197d10['count']=_0x167013[_0xabc4('0x77')];_0x197d10[_0xabc4('0x4a')]=_0x167013[_0xabc4('0x4a')];_0x197d10[_0xabc4('0x78')]=this[_0xabc4('0xf')][_0x167013[_0xabc4('0x4a')]][_0xabc4('0x78')];logger[_0xabc4('0x79')](_0xabc4('0x7a'),_0x197d10[_0xabc4('0x46')],_0x197d10[_0xabc4('0x4e')]);_['merge'](_0x197d10,_[_0xabc4('0x7b')](_0x167013,_[_0xabc4('0x7c')](_0x197d10)));this[_0xabc4('0xd')][_0x167013['uniqueid']][_0xabc4('0x7d')](_0x197d10);this['channels'][_0x167013['uniqueid']]=_0x197d10;this[_0xabc4('0x7e')](_0x197d10,_0xabc4('0x18'));}}catch(_0x486c8b){logger[_0xabc4('0x38')](_0xabc4('0x73'),_0x167013[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x486c8b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x149292){try{if(this[_0xabc4('0x5f')](_0x149292)){logger[_0xabc4('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x149292[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x149292,{'showHidden':![],'depth':null}));if(this[_0xabc4('0xd')][_0x149292[_0xabc4('0x4a')]]){var _0x11aa4e=_['last'](this['queueReports'][_0x149292[_0xabc4('0x4a')]]);_0x11aa4e[_0xabc4('0x7f')]=![];_0x11aa4e[_0xabc4('0x80')]=null;_0x11aa4e['holdtime']=_0x149292[_0xabc4('0x81')];_0x11aa4e['originalposition']=_0x149292[_0xabc4('0x82')];_0x11aa4e[_0xabc4('0x83')]=!![];_0x11aa4e['queuecallerabandonAt']=moment()[_0xabc4('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x11aa4e['queuecallerexitreason']='ABANDONED';_0x11aa4e['lastAssignedTo']=null;logger[_0xabc4('0x79')](_0xabc4('0x84'),_0x11aa4e['name'],_0x11aa4e[_0xabc4('0x4e')]);this[_0xabc4('0xf')][_0x149292[_0xabc4('0x4a')]]=_0x11aa4e;this[_0xabc4('0x3f')](_0x11aa4e,'queuecallerabandon');}}}catch(_0x21f36c){logger['error'](_0xabc4('0x85'),_0x149292[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x21f36c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x4e6b99){try{if(this[_0xabc4('0x5f')](_0x4e6b99)){logger[_0xabc4('0x42')](_0xabc4('0x86'),_0x4e6b99['uniqueid'],util['inspect'](_0x4e6b99,{'showHidden':![],'depth':null}));if(this[_0xabc4('0xd')][_0x4e6b99[_0xabc4('0x4a')]]){var _0x4d6179=_[_0xabc4('0x87')](this[_0xabc4('0xd')][_0x4e6b99[_0xabc4('0x4a')]]);_0x4d6179[_0xabc4('0x88')]=moment()[_0xabc4('0x45')](_0xabc4('0x75'));_0x4d6179['connectedlinenum']=_0x4e6b99['connectedlinenum'];_0x4d6179[_0xabc4('0x89')]=_0x4e6b99[_0xabc4('0x89')];logger[_0xabc4('0x79')](_0xabc4('0x8a'),_0x4d6179[_0xabc4('0x46')],_0x4d6179[_0xabc4('0x4e')],_0x4e6b99[_0xabc4('0x8b')],_0x4e6b99[_0xabc4('0x89')]);this[_0xabc4('0xf')][_0x4e6b99[_0xabc4('0x4a')]]=_0x4d6179;this[_0xabc4('0x7e')](_0x4d6179,_0xabc4('0x1a'));}}}catch(_0x327b3b){logger[_0xabc4('0x38')](_0xabc4('0x86'),_0x4e6b99['uniqueid'],util[_0xabc4('0x3a')](_0x327b3b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x1f')]=function(_0x19e252){try{if(this[_0xabc4('0x5f')](_0x19e252)){logger[_0xabc4('0x42')](_0xabc4('0x8c'),_0x19e252['uniqueid'],util[_0xabc4('0x3a')](_0x19e252,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x19e252[_0xabc4('0x4a')]]){var _0x127723=_[_0xabc4('0x87')](this['queueReports'][_0x19e252[_0xabc4('0x4a')]]);_0x127723[_0xabc4('0x7f')]=!![];_0x127723['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xabc4('0x79')](_0xabc4('0x8d'),_0x127723[_0xabc4('0x46')],_0x127723['type']);}}}catch(_0x177206){logger[_0xabc4('0x38')](_0xabc4('0x8c'),_0x19e252[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x177206,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabc4('0x8')]['syncAgentComplete']=function(_0xceda61){try{if(this[_0xabc4('0x5f')](_0xceda61)){logger[_0xabc4('0x42')](_0xabc4('0x8e'),_0xceda61[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0xceda61,{'showHidden':![],'depth':null}));if(this[_0xabc4('0xd')][_0xceda61[_0xabc4('0x4a')]]){var _0x4b61b2=_[_0xabc4('0x87')](this[_0xabc4('0xd')][_0xceda61['uniqueid']]);_0x4b61b2[_0xabc4('0x83')]=![];_0x4b61b2[_0xabc4('0x8f')]=null;_0x4b61b2[_0xabc4('0x90')]=!![];_0x4b61b2[_0xabc4('0x91')]=_0xceda61[_0xabc4('0x92')];_0x4b61b2[_0xabc4('0x81')]=_0xceda61[_0xabc4('0x81')];_0x4b61b2[_0xabc4('0x7f')]=!![];_0x4b61b2[_0xabc4('0x93')]=![];_0x4b61b2[_0xabc4('0x94')]=null;if(!_0x4b61b2[_0xabc4('0x95')]){if(_0xceda61[_0xabc4('0x96')]==_0xabc4('0x95')){_0x4b61b2['queuecallerexitreason']=_0xabc4('0x97');logger[_0xabc4('0x79')](_0xabc4('0x98'),_0x4b61b2['name'],_0x4b61b2['type']);}else{if(_[_0xabc4('0x99')](_0xceda61['channel'][_0xabc4('0x9a')](),_0xabc4('0x9b'))){if(this[_0xabc4('0xd')][_0xceda61[_0xabc4('0x9c')]]){var _0x48cf60=_['last'](this[_0xabc4('0xd')][_0xceda61['linkedid']]);_0x48cf60[_0xabc4('0x7f')]=![];_0x48cf60[_0xabc4('0x93')]=!![];_0x48cf60[_0xabc4('0x94')]=moment(_0x4b61b2[_0xabc4('0x74')])[_0xabc4('0x9d')](_0xceda61[_0xabc4('0x81')],_0xabc4('0x9e'))['format'](_0xabc4('0x75'));_0x48cf60[_0xabc4('0x9f')]=_0xabc4('0xa0');_0x48cf60[_0xabc4('0x95')]=!![];_0x48cf60['transfertype']=_0xabc4('0xa1');_0x48cf60[_0xabc4('0xa2')]=_0xceda61['destexten'];_0x48cf60[_0xabc4('0xa3')]=_0xceda61[_0xabc4('0x4a')];logger[_0xabc4('0x79')](_0xabc4('0xa4'),_0x48cf60[_0xabc4('0x46')],_0x48cf60[_0xabc4('0x4e')]);var _0x4f42a6=this[_0xabc4('0xd')][_0xceda61[_0xabc4('0x9c')]];this[_0xabc4('0xd')][_0xceda61['linkedid']]=this[_0xabc4('0xd')][_0xceda61['uniqueid']];this[_0xabc4('0xd')][_0xceda61[_0xabc4('0x4a')]]=_0x4f42a6;}}else{_0x4b61b2[_0xabc4('0x9f')]=_0xabc4('0xa5')+_0xceda61[_0xabc4('0x96')][_0xabc4('0xa6')]();logger['info'](_0xabc4('0xa7'),_0x4b61b2['name'],_0x4b61b2[_0xabc4('0x4e')],_0x4b61b2[_0xabc4('0x9f')]);}}}this[_0xabc4('0xf')][_0xceda61[_0xabc4('0x4a')]]=_0x4b61b2;this[_0xabc4('0x3f')](_0x4b61b2,_0xabc4('0x1c'));}}}catch(_0x5eb21a){logger[_0xabc4('0x38')]('[%s][voiceQueueReport][agentcomplete]',_0xceda61[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x5eb21a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabc4('0x8')][_0xabc4('0x20')]=function(_0x256d7f){try{if(this[_0xabc4('0x5f')](_0x256d7f)){logger[_0xabc4('0x42')](_0xabc4('0xa8'),_0x256d7f[_0xabc4('0x4a')],util['inspect'](_0x256d7f,{'showHidden':![],'depth':null}));this[_0xabc4('0xa9')](_0x256d7f['uniqueid'],_[_0xabc4('0x7c')](_0x256d7f['variable'])[0x0],_0x256d7f[_0xabc4('0xaa')]);if(this[_0xabc4('0xd')][_0x256d7f[_0xabc4('0x4a')]]){var _0x203904=_[_0xabc4('0x87')](this[_0xabc4('0xd')][_0x256d7f[_0xabc4('0x4a')]]);if(_0x203904){if(this[_0xabc4('0x5f')](_0x256d7f[_0xabc4('0xab')])&&this[_0xabc4('0x5f')](_0x256d7f[_0xabc4('0xab')][_0xabc4('0xac')])){switch(_0x256d7f[_0xabc4('0xaa')]){case'CONTINUE':_0x203904[_0xabc4('0x93')]=![];_0x203904[_0xabc4('0x94')]=null;break;case _0xabc4('0xad'):_0x203904[_0xabc4('0xae')]=_0xabc4('0xaf');_0x203904['queuecallerexit']=!![];_0x203904[_0xabc4('0x94')]=moment()[_0xabc4('0x45')](_0xabc4('0x75'));_0x203904[_0xabc4('0x88')]=moment()[_0xabc4('0x45')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xabc4('0x42')](_0xabc4('0xb0'),_0x256d7f[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x203904,{'showHidden':![],'depth':null}));ami[_0xabc4('0x41')]('custom:timeout',_0x203904);break;default:_0x203904['queuecallerexit']=!![];_0x203904['queuecallerexitAt']=moment()[_0xabc4('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x203904[_0xabc4('0x88')]=moment()[_0xabc4('0x45')]('YYYY-MM-DD\x20HH:mm:ss');}_0x203904[_0xabc4('0x83')]=![];_0x203904[_0xabc4('0x8f')]=null;_0x203904[_0xabc4('0x9f')]=_0x256d7f['value'];this[_0xabc4('0xf')][_0x256d7f[_0xabc4('0x4a')]]=_0x203904;this[_0xabc4('0x3f')](_0x203904,'varset');}else if(this['isNotNull'](_0x256d7f['variable'])&&this[_0xabc4('0x5f')](_0x256d7f[_0xabc4('0xab')][_0xabc4('0xb1')])){if(!_0x203904['queuecallerabandon']){_0x203904['queuecallerexit']=!![];_0x203904[_0xabc4('0x94')]=moment()['format'](_0xabc4('0x75'));_0x203904[_0xabc4('0x9f')]='EXITWITHKEY';_0x203904[_0xabc4('0x88')]=moment()[_0xabc4('0x45')](_0xabc4('0x75'));this['channels'][_0x256d7f[_0xabc4('0x4a')]]=_0x203904;}}logger[_0xabc4('0x79')](_0xabc4('0xb2'),_0x256d7f[_0xabc4('0x4a')],_0x203904['name'],_0x203904[_0xabc4('0x4e')],_['keys'](_0x256d7f['variable'])[0x0],_0x256d7f[_0xabc4('0xaa')]);_0x203904[_0xabc4('0x14')]=this['variables'][_0x256d7f[_0xabc4('0x4a')]];}}}}catch(_0x8ea60f){logger['error'](_0xabc4('0xa8'),_0x256d7f[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x8ea60f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x2a76b6,_0x462d14,_0x4da93c){var _0x2601f9=[_0xabc4('0xb3'),'rtpaudioqosbridged',_0xabc4('0xb4'),'rtpaudioqosjitterbridged',_0xabc4('0xb5'),_0xabc4('0xb6'),'rtpaudioqosrtt',_0xabc4('0xb7'),'sipcallid',_0xabc4('0xb8'),_0xabc4('0xb9'),_0xabc4('0xba'),_0xabc4('0xbb'),_0xabc4('0xbc'),'memberinterface',_0xabc4('0xbd'),'membername',_0xabc4('0xbe'),'memberrealtime'];if(!_[_0xabc4('0x34')](_0x462d14)&&!_[_0xabc4('0xbf')](_0x2601f9,_0x462d14)){if(_[_0xabc4('0x60')](this[_0xabc4('0x14')][_0x2a76b6])){this[_0xabc4('0x14')][_0x2a76b6]={};}this[_0xabc4('0x14')][_0x2a76b6][_0x462d14]=_0x4da93c;}};VoiceQueueReport[_0xabc4('0x8')]['syncHangup']=function(_0x8d5d0a){try{if(this[_0xabc4('0x5f')](_0x8d5d0a)){logger['debug'](_0xabc4('0xc0'),_0x8d5d0a[_0xabc4('0x4a')],util[_0xabc4('0x3a')](_0x8d5d0a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x8d5d0a[_0xabc4('0x4a')]]){for(var _0x1a8068=0x0,_0x49372f={};_0x1a80680x0?_0x3b705d:0x0;this[_0x1d69('0x11')][_0xfc58ef[_0x1d69('0x6b')]][_0x1d69('0x32')]=this[_0x1d69('0x11')][_0xfc58ef[_0x1d69('0x6b')]]['talking']>_[_0x1d69('0x70')](_0xfc58ef[_0x1d69('0x71')])?_[_0x1d69('0x70')](_0xfc58ef['loggedin']):this[_0x1d69('0x11')][_0xfc58ef[_0x1d69('0x6b')]][_0x1d69('0x32')];this['emitVoiceQueueSummary'](this[_0x1d69('0x11')][_0xfc58ef[_0x1d69('0x6b')]],'queuesummary');}logger[_0x1d69('0x49')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0x1d69('0x11')][_0xfc58ef['queue']],{'showHidden':![],'depth':null}));ami[_0x1d69('0x48')]('custom:queuesummary',this[_0x1d69('0x11')][_0xfc58ef[_0x1d69('0x6b')]]);}}}catch(_0x550c3d){logger[_0x1d69('0x3f')](_0x1d69('0x6a'),util[_0x1d69('0x41')](_0x550c3d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1d69('0x19')]=function(_0x4f2fa6){logger[_0x1d69('0x49')](_0x1d69('0x72'),util[_0x1d69('0x41')](_0x4f2fa6,{'showHidden':![],'depth':null}));this[_0x1d69('0x12')]=!![];};VoiceQueueReport[_0x1d69('0xc')][_0x1d69('0x73')]=function(_0x9c50c9){try{if(this[_0x1d69('0x66')](_0x9c50c9)){logger['debug'](_0x1d69('0x74'),_0x9c50c9[_0x1d69('0x4c')],util[_0x1d69('0x41')](_0x9c50c9,{'showHidden':![],'depth':null}));if(_[_0x1d69('0x67')](this[_0x1d69('0xf')][_0x9c50c9['uniqueid']]))this[_0x1d69('0xf')][_0x9c50c9[_0x1d69('0x4c')]]=[];if(_[_0x1d69('0x67')](this[_0x1d69('0x37')][_0x9c50c9[_0x1d69('0x4c')]]))this[_0x1d69('0x37')][_0x9c50c9[_0x1d69('0x4c')]]={};var _0x5f03f9=new QueueReport();_0x5f03f9[_0x1d69('0x52')]=_0x9c50c9[_0x1d69('0x6b')];_0x5f03f9['type']=this[_0x1d69('0x11')][_0x5f03f9[_0x1d69('0x52')]]&&this[_0x1d69('0x11')][_0x5f03f9['name']]['type']?this[_0x1d69('0x11')][_0x5f03f9['name']][_0x1d69('0x54')]||_0x1d69('0x55'):'inbound';_0x5f03f9[_0x1d69('0x6b')]=_0x9c50c9[_0x1d69('0x6b')];_0x5f03f9['queuecallerjoinAt']=moment()[_0x1d69('0x4d')](_0x1d69('0x75'));_0x5f03f9['position']=_0x9c50c9[_0x1d69('0x76')];_0x5f03f9['count']=_0x9c50c9[_0x1d69('0x77')];_0x5f03f9['uniqueid']=_0x9c50c9[_0x1d69('0x4c')];_0x5f03f9['routealias']=this['channels'][_0x9c50c9[_0x1d69('0x4c')]][_0x1d69('0x78')];logger['info'](_0x1d69('0x79'),_0x5f03f9[_0x1d69('0x52')],_0x5f03f9['type']);_[_0x1d69('0x7a')](_0x5f03f9,_['pick'](_0x9c50c9,_[_0x1d69('0x7b')](_0x5f03f9)));this[_0x1d69('0xf')][_0x9c50c9['uniqueid']][_0x1d69('0x7c')](_0x5f03f9);this[_0x1d69('0x37')][_0x9c50c9[_0x1d69('0x4c')]]=_0x5f03f9;this[_0x1d69('0x7d')](_0x5f03f9,_0x1d69('0x1a'));}}catch(_0xc38b46){logger[_0x1d69('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x9c50c9[_0x1d69('0x4c')],util['inspect'](_0xc38b46,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d69('0xc')]['syncQueueCallerAbandon']=function(_0x473e67){try{if(this[_0x1d69('0x66')](_0x473e67)){logger[_0x1d69('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x473e67[_0x1d69('0x4c')],util[_0x1d69('0x41')](_0x473e67,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x473e67[_0x1d69('0x4c')]]){var _0x563481=_[_0x1d69('0x7e')](this[_0x1d69('0xf')][_0x473e67[_0x1d69('0x4c')]]);_0x563481[_0x1d69('0x7f')]=![];_0x563481[_0x1d69('0x80')]=null;_0x563481[_0x1d69('0x81')]=_0x473e67[_0x1d69('0x81')];_0x563481[_0x1d69('0x82')]=_0x473e67[_0x1d69('0x82')];_0x563481[_0x1d69('0x1b')]=!![];_0x563481[_0x1d69('0x83')]=moment()[_0x1d69('0x4d')](_0x1d69('0x75'));_0x563481[_0x1d69('0x84')]=_0x1d69('0x85');_0x563481[_0x1d69('0x86')]=null;logger['info'](_0x1d69('0x87'),_0x563481['name'],_0x563481[_0x1d69('0x54')]);this[_0x1d69('0x37')][_0x473e67[_0x1d69('0x4c')]]=_0x563481;this[_0x1d69('0x46')](_0x563481,_0x1d69('0x1b'));}}}catch(_0x25c568){logger[_0x1d69('0x3f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x473e67[_0x1d69('0x4c')],util['inspect'](_0x25c568,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d69('0xc')][_0x1d69('0x1e')]=function(_0x1fb525){try{if(this[_0x1d69('0x66')](_0x1fb525)){logger[_0x1d69('0x49')]('[%s][voiceQueueReport][queuecallerleave]',_0x1fb525[_0x1d69('0x4c')],util[_0x1d69('0x41')](_0x1fb525,{'showHidden':![],'depth':null}));if(this[_0x1d69('0xf')][_0x1fb525['uniqueid']]){var _0x59e66d=_[_0x1d69('0x7e')](this[_0x1d69('0xf')][_0x1fb525[_0x1d69('0x4c')]]);_0x59e66d[_0x1d69('0x88')]=moment()[_0x1d69('0x4d')](_0x1d69('0x75'));_0x59e66d[_0x1d69('0x89')]=_0x1fb525[_0x1d69('0x89')];_0x59e66d[_0x1d69('0x8a')]=_0x1fb525['connectedlinename'];logger[_0x1d69('0x8b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x59e66d[_0x1d69('0x52')],_0x59e66d['type'],_0x1fb525[_0x1d69('0x89')],_0x1fb525[_0x1d69('0x8a')]);this[_0x1d69('0x37')][_0x1fb525[_0x1d69('0x4c')]]=_0x59e66d;this['emitVoiceQueueChannelSave'](_0x59e66d,_0x1d69('0x1d'));}}}catch(_0x3574de){logger[_0x1d69('0x3f')](_0x1d69('0x8c'),_0x1fb525[_0x1d69('0x4c')],util[_0x1d69('0x41')](_0x3574de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d69('0xc')][_0x1d69('0x8d')]=function(_0x78f5ca){try{if(this[_0x1d69('0x66')](_0x78f5ca)){logger[_0x1d69('0x49')](_0x1d69('0x8e'),_0x78f5ca[_0x1d69('0x4c')],util[_0x1d69('0x41')](_0x78f5ca,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x78f5ca[_0x1d69('0x4c')]]){var _0x2ce132=_[_0x1d69('0x7e')](this[_0x1d69('0xf')][_0x78f5ca[_0x1d69('0x4c')]]);_0x2ce132[_0x1d69('0x7f')]=!![];_0x2ce132[_0x1d69('0x84')]='COMPLETEDBYAGENT';logger[_0x1d69('0x8b')](_0x1d69('0x8f'),_0x2ce132[_0x1d69('0x52')],_0x2ce132[_0x1d69('0x54')]);}}}catch(_0x29b220){logger[_0x1d69('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0x78f5ca['uniqueid'],util[_0x1d69('0x41')](_0x29b220,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d69('0xc')][_0x1d69('0x1f')]=function(_0x1a68a1){try{if(this[_0x1d69('0x66')](_0x1a68a1)){logger[_0x1d69('0x49')]('[%s][voiceQueueReport][agentcomplete]',_0x1a68a1[_0x1d69('0x4c')],util[_0x1d69('0x41')](_0x1a68a1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1a68a1[_0x1d69('0x4c')]]){var _0x5b0061=_['last'](this[_0x1d69('0xf')][_0x1a68a1[_0x1d69('0x4c')]]);_0x5b0061[_0x1d69('0x1b')]=![];_0x5b0061[_0x1d69('0x83')]=null;_0x5b0061[_0x1d69('0x90')]=!![];_0x5b0061[_0x1d69('0x86')]=_0x1a68a1[_0x1d69('0x91')];_0x5b0061['holdtime']=_0x1a68a1['holdtime'];_0x5b0061[_0x1d69('0x7f')]=!![];_0x5b0061[_0x1d69('0x92')]=![];_0x5b0061[_0x1d69('0x93')]=null;if(!_0x5b0061[_0x1d69('0x94')]){if(_0x1a68a1[_0x1d69('0x95')]==_0x1d69('0x94')){_0x5b0061[_0x1d69('0x84')]='COMPLETED';logger[_0x1d69('0x8b')](_0x1d69('0x96'),_0x5b0061[_0x1d69('0x52')],_0x5b0061['type']);}else{if(_[_0x1d69('0x97')](_0x1a68a1[_0x1d69('0x3b')][_0x1d69('0x98')](),_0x1d69('0x99'))){if(this[_0x1d69('0xf')][_0x1a68a1[_0x1d69('0x9a')]]){var _0x5736e1=_[_0x1d69('0x7e')](this[_0x1d69('0xf')][_0x1a68a1[_0x1d69('0x9a')]]);_0x5736e1[_0x1d69('0x7f')]=![];_0x5736e1[_0x1d69('0x92')]=!![];_0x5736e1[_0x1d69('0x93')]=moment(_0x5b0061[_0x1d69('0x9b')])['add'](_0x1a68a1[_0x1d69('0x81')],_0x1d69('0x9c'))['format'](_0x1d69('0x75'));_0x5736e1[_0x1d69('0x84')]=_0x1d69('0x9d');_0x5736e1[_0x1d69('0x94')]=!![];_0x5736e1[_0x1d69('0x9e')]='FORWARD';_0x5736e1[_0x1d69('0x9f')]=_0x1a68a1[_0x1d69('0xa0')];_0x5736e1[_0x1d69('0xa1')]=_0x1a68a1['uniqueid'];logger[_0x1d69('0x8b')](_0x1d69('0xa2'),_0x5736e1[_0x1d69('0x52')],_0x5736e1[_0x1d69('0x54')]);var _0x12726f=this['queueReports'][_0x1a68a1[_0x1d69('0x9a')]];this[_0x1d69('0xf')][_0x1a68a1[_0x1d69('0x9a')]]=this['queueReports'][_0x1a68a1[_0x1d69('0x4c')]];this[_0x1d69('0xf')][_0x1a68a1[_0x1d69('0x4c')]]=_0x12726f;}}else{_0x5b0061[_0x1d69('0x84')]=_0x1d69('0xa3')+_0x1a68a1[_0x1d69('0x95')][_0x1d69('0xa4')]();logger['info'](_0x1d69('0xa5'),_0x5b0061[_0x1d69('0x52')],_0x5b0061[_0x1d69('0x54')],_0x5b0061[_0x1d69('0x84')]);}}}this[_0x1d69('0x37')][_0x1a68a1['uniqueid']]=_0x5b0061;this[_0x1d69('0x46')](_0x5b0061,_0x1d69('0xa6'));}}}catch(_0x54d83a){logger['error'](_0x1d69('0xa7'),_0x1a68a1['uniqueid'],util['inspect'](_0x54d83a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d69('0xc')][_0x1d69('0x22')]=function(_0x25c5a5){try{if(this['isNotNull'](_0x25c5a5)){logger[_0x1d69('0x49')](_0x1d69('0xa8'),_0x25c5a5['uniqueid'],util[_0x1d69('0x41')](_0x25c5a5,{'showHidden':![],'depth':null}));this[_0x1d69('0xa9')](_0x25c5a5[_0x1d69('0x4c')],_[_0x1d69('0x7b')](_0x25c5a5[_0x1d69('0xaa')])[0x0],_0x25c5a5[_0x1d69('0xab')]);if(this[_0x1d69('0xf')][_0x25c5a5['uniqueid']]){var _0x18f002=_['last'](this[_0x1d69('0xf')][_0x25c5a5[_0x1d69('0x4c')]]);if(_0x18f002){if(this['isNotNull'](_0x25c5a5[_0x1d69('0xaa')])&&this[_0x1d69('0x66')](_0x25c5a5['variable'][_0x1d69('0xac')])){switch(_0x25c5a5[_0x1d69('0xab')]){case _0x1d69('0xad'):_0x18f002[_0x1d69('0x92')]=![];_0x18f002[_0x1d69('0x93')]=null;break;case _0x1d69('0xae'):_0x18f002[_0x1d69('0xaf')]=_0x1d69('0xb0');_0x18f002['queuecallerexit']=!![];_0x18f002[_0x1d69('0x93')]=moment()['format'](_0x1d69('0x75'));_0x18f002['queuecallerleaveAt']=moment()[_0x1d69('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x1d69('0xb1'),_0x25c5a5[_0x1d69('0x4c')],util['inspect'](_0x18f002,{'showHidden':![],'depth':null}));ami[_0x1d69('0x48')](_0x1d69('0xb2'),_0x18f002);break;default:_0x18f002[_0x1d69('0x92')]=!![];_0x18f002['queuecallerexitAt']=moment()[_0x1d69('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x18f002[_0x1d69('0x88')]=moment()['format'](_0x1d69('0x75'));}_0x18f002[_0x1d69('0x1b')]=![];_0x18f002[_0x1d69('0x83')]=null;_0x18f002[_0x1d69('0x84')]=_0x25c5a5[_0x1d69('0xab')];this['channels'][_0x25c5a5[_0x1d69('0x4c')]]=_0x18f002;this[_0x1d69('0x46')](_0x18f002,_0x1d69('0x21'));}else if(this[_0x1d69('0x66')](_0x25c5a5[_0x1d69('0xaa')])&&this[_0x1d69('0x66')](_0x25c5a5[_0x1d69('0xaa')][_0x1d69('0xb3')])){if(!_0x18f002['queuecallerabandon']){_0x18f002[_0x1d69('0x92')]=!![];_0x18f002[_0x1d69('0x93')]=moment()[_0x1d69('0x4d')](_0x1d69('0x75'));_0x18f002[_0x1d69('0x84')]='EXITWITHKEY';_0x18f002[_0x1d69('0x88')]=moment()[_0x1d69('0x4d')](_0x1d69('0x75'));this[_0x1d69('0x37')][_0x25c5a5[_0x1d69('0x4c')]]=_0x18f002;}}logger[_0x1d69('0x8b')](_0x1d69('0xb4'),_0x25c5a5[_0x1d69('0x4c')],_0x18f002['name'],_0x18f002[_0x1d69('0x54')],_[_0x1d69('0x7b')](_0x25c5a5[_0x1d69('0xaa')])[0x0],_0x25c5a5[_0x1d69('0xab')]);_0x18f002[_0x1d69('0x14')]=this[_0x1d69('0x14')][_0x25c5a5['uniqueid']];}}}}catch(_0x1504cb){logger[_0x1d69('0x3f')](_0x1d69('0xa8'),_0x25c5a5['uniqueid'],util[_0x1d69('0x41')](_0x1504cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d69('0xc')][_0x1d69('0xa9')]=function(_0x4d25db,_0x4b905e,_0x1316ba){var _0x481272=[_0x1d69('0xb5'),_0x1d69('0xb6'),'rtpaudioqosjitter',_0x1d69('0xb7'),_0x1d69('0xb8'),'rtpaudioqoslossbridged',_0x1d69('0xb9'),'rtpaudioqosrttbridged','sipcallid',_0x1d69('0xba'),_0x1d69('0xbb'),_0x1d69('0xbc'),_0x1d69('0xbd'),_0x1d69('0xbe'),_0x1d69('0xbf'),'memberlastcall',_0x1d69('0x91'),_0x1d69('0xc0'),_0x1d69('0xc1')];if(!_[_0x1d69('0xc2')](_0x4b905e)&&!_[_0x1d69('0xc3')](_0x481272,_0x4b905e)){if(_['isUndefined'](this[_0x1d69('0x14')][_0x4d25db])){this[_0x1d69('0x14')][_0x4d25db]={};}this[_0x1d69('0x14')][_0x4d25db][_0x4b905e]=_0x1316ba;}};VoiceQueueReport[_0x1d69('0xc')]['syncHangup']=function(_0x488db8){try{if(this[_0x1d69('0x66')](_0x488db8)){logger[_0x1d69('0x49')](_0x1d69('0xc4'),_0x488db8['uniqueid'],util['inspect'](_0x488db8,{'showHidden':![],'depth':null}));if(this[_0x1d69('0xf')][_0x488db8[_0x1d69('0x4c')]]){for(var _0x40a740=0x0,_0x573f07={};_0x40a740=0x0?moment(_0x778b64[_0x7ff8('0x15')])[_0x7ff8('0x16')](_0x778b64['starttime'],_0x7ff8('0x17')):null,'data1':_0x7ff8('0x18'),'data2':_0x778b64['accountcode'],'data3':_0x778b64[_0x7ff8('0xf')],'data4':_0x778b64['dialstring']||null,'role':_0x7ff8('0x19'),'internal':_0x778b64[_0x7ff8('0x10')]?_[_0x7ff8('0x11')](_0x778b64[_0x7ff8('0x10')]):undefined,'uniqueid':_0x778b64[_0x7ff8('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x6a51=['agent','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','accountcode','toNumber','membername','starttime','endtime','dialstring'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x6a51,0x92));var _0x16a5=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x6a51[_0x590b63];return _0x3c9380;};'use strict';var moment=require(_0x16a5('0x0'));var _=require(_0x16a5('0x1'));var util=require(_0x16a5('0x2'));var client=require(_0x16a5('0x3'));exports[_0x16a5('0x4')]=function(_0x408b41){var _0x5a0c38=_0x408b41[_0x16a5('0x5')]||_0x408b41[_0x16a5('0x6')];return client[_0x16a5('0x7')](_0x16a5('0x8'),{'body':{'channel':_0x16a5('0x9'),'membername':_0x408b41['lastAssignedTo'],'interface':_[_0x16a5('0xa')](_0x408b41[_0x16a5('0xb')])?util[_0x16a5('0xc')](_0x16a5('0xd'),_0x408b41[_0x16a5('0xe')]):_0x408b41[_0x16a5('0xb')],'type':_0x16a5('0xf'),'enterAt':_0x408b41[_0x16a5('0x10')],'exitAt':_0x5a0c38,'duration':moment(_0x5a0c38)[_0x16a5('0x11')](_0x408b41[_0x16a5('0x10')],_0x16a5('0x12')),'data1':'inbound','data2':_0x408b41[_0x16a5('0x13')],'data3':_0x408b41[_0x16a5('0x14')],'data4':null,'data5':_0x408b41[_0x16a5('0x15')],'role':'agent','internal':_0x408b41[_0x16a5('0x16')]?_[_0x16a5('0x17')](_0x408b41[_0x16a5('0x16')]):undefined,'uniqueid':_0x408b41['uniqueid']},'log':_0x16a5('0x8')});};exports['voiceDialReport']=function(_0x4dd222){return client[_0x16a5('0x7')](_0x16a5('0x8'),{'body':{'channel':'voice','membername':_0x4dd222[_0x16a5('0x18')],'interface':_0x4dd222[_0x16a5('0xb')],'type':_0x16a5('0xf'),'enterAt':_0x4dd222[_0x16a5('0x19')],'exitAt':_0x4dd222['endtime'],'duration':moment(_0x4dd222[_0x16a5('0x1a')])[_0x16a5('0x11')](_0x4dd222[_0x16a5('0x19')],_0x16a5('0x12'))>=0x0?moment(_0x4dd222[_0x16a5('0x1a')])[_0x16a5('0x11')](_0x4dd222[_0x16a5('0x19')],'seconds'):null,'data1':'outbound','data2':_0x4dd222['accountcode'],'data3':_0x4dd222[_0x16a5('0x14')],'data4':_0x4dd222[_0x16a5('0x1b')]||null,'role':_0x16a5('0x1c'),'internal':_0x4dd222['accountcode']?_['toNumber'](_0x4dd222[_0x16a5('0x16')]):undefined,'uniqueid':_0x4dd222['uniqueid']},'log':_0x16a5('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index af868a1..311e6da 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 _0xfaf3=['stopRecordingOnTransfer','GetSettings','../client','Request','ShowSetting'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xfaf3,0x93));var _0x3faf=function(_0x45a0ce,_0xdbbf0f){_0x45a0ce=_0x45a0ce-0x0;var _0x31a098=_0xfaf3[_0x45a0ce];return _0x31a098;};'use strict';var client=require(_0x3faf('0x0'));exports['getSettings']=function(){return client[_0x3faf('0x1')](_0x3faf('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3faf('0x3')]},'log':_0x3faf('0x4')});}; \ No newline at end of file +var _0x86fd=['ShowSetting','GetSettings','../client','getSettings','Request'];(function(_0x184260,_0x22b6ae){var _0x41c9c8=function(_0x5e7b0f){while(--_0x5e7b0f){_0x184260['push'](_0x184260['shift']());}};_0x41c9c8(++_0x22b6ae);}(_0x86fd,0xa7));var _0xd86f=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x86fd[_0x26efac];return _0x8482e4;};'use strict';var client=require(_0xd86f('0x0'));exports[_0xd86f('0x1')]=function(){return client[_0xd86f('0x2')](_0xd86f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0xd86f('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index c78ad9e..991ed02 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 _0x94e7=['getTemplates','GetTemplate','name','html'];(function(_0x11f158,_0x2fc76f){var _0x350437=function(_0x42e072){while(--_0x42e072){_0x11f158['push'](_0x11f158['shift']());}};_0x350437(++_0x2fc76f);}(_0x94e7,0x7c));var _0x794e=function(_0x441b1a,_0x1a470e){_0x441b1a=_0x441b1a-0x0;var _0x13a718=_0x94e7[_0x441b1a];return _0x13a718;};'use strict';var client=require('../client');exports[_0x794e('0x0')]=function(_0x11a613){return function(_0x54becd){return client['Request'](_0x794e('0x1'),{'options':{'raw':!![],'attributes':['id',_0x794e('0x2'),_0x794e('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xb068=['name','getTemplates','Request','GetTemplate'];(function(_0x50da99,_0x25c8a1){var _0x8931ff=function(_0x26933f){while(--_0x26933f){_0x50da99['push'](_0x50da99['shift']());}};_0x8931ff(++_0x25c8a1);}(_0xb068,0x119));var _0x8b06=function(_0x45e8ad,_0x373b7b){_0x45e8ad=_0x45e8ad-0x0;var _0x5589e9=_0xb068[_0x45e8ad];return _0x5589e9;};'use strict';var client=require('../client');exports[_0x8b06('0x0')]=function(_0x582e4d){return function(_0x34b325){return client[_0x8b06('0x1')](_0x8b06('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8b06('0x3'),'html']},'log':_0x8b06('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 38def11..4197522 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 _0x8126=['action','data3','data5','data6','data7','GetTrigger','Request','channel','status','AllConditions','operator','value','Condition','AnyConditions'];(function(_0x176bde,_0x5c4b8c){var _0x153cb1=function(_0x51b292){while(--_0x51b292){_0x176bde['push'](_0x176bde['shift']());}};_0x153cb1(++_0x5c4b8c);}(_0x8126,0xf4));var _0x6812=function(_0x2f88bf,_0x761a0e){_0x2f88bf=_0x2f88bf-0x0;var _0x1b451e=_0x8126[_0x2f88bf];return _0x1b451e;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x46acec){return function(_0x4bba14){return client[_0x6812('0x0')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x6812('0x1'),_0x6812('0x2')],'include':[{'model':'Condition','as':_0x6812('0x3'),'attributes':['id','field',_0x6812('0x4'),_0x6812('0x5')]},{'model':_0x6812('0x6'),'as':_0x6812('0x7'),'attributes':['id','field',_0x6812('0x4'),_0x6812('0x5')]},{'model':'Action','as':'Actions','attributes':['id',_0x6812('0x8'),'data1','data2',_0x6812('0x9'),'data4',_0x6812('0xa'),_0x6812('0xb'),_0x6812('0xc')]}]},'log':_0x6812('0xd')});};}; \ No newline at end of file +var _0xe4fe=['data4','data5','data6','../client','getTriggers','GetTrigger','name','channel','AllConditions','value','AnyConditions','operator','Action','action','data1','data2','data3'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe4fe,0x9c));var _0xee4f=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0xe4fe[_0x3ee1fe];return _0x1ae57a;};'use strict';var client=require(_0xee4f('0x0'));exports[_0xee4f('0x1')]=function(_0x488f07){return function(_0x34d199){return client['Request'](_0xee4f('0x2'),{'options':{'raw':![],'attributes':['id',_0xee4f('0x3'),_0xee4f('0x4'),'status'],'include':[{'model':'Condition','as':_0xee4f('0x5'),'attributes':['id','field','operator',_0xee4f('0x6')]},{'model':'Condition','as':_0xee4f('0x7'),'attributes':['id','field',_0xee4f('0x8'),'value']},{'model':_0xee4f('0x9'),'as':'Actions','attributes':['id',_0xee4f('0xa'),_0xee4f('0xb'),_0xee4f('0xc'),_0xee4f('0xd'),_0xee4f('0xe'),_0xee4f('0xf'),_0xee4f('0x10'),'data7']}]},'log':_0xee4f('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d3d5396..8222f8e 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 _0x008c=['../client','getTrunks','Request','name','registry','defaultuser','GetTrunk'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x008c,0x188));var _0xc008=function(_0x2bfa06,_0x351e03){_0x2bfa06=_0x2bfa06-0x0;var _0x58811b=_0x008c[_0x2bfa06];return _0x58811b;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return function(_0xae17af){return client[_0xc008('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc008('0x3'),_0xc008('0x4'),_0xc008('0x5')]},'log':_0xc008('0x6')});};}; \ No newline at end of file +var _0xd71d=['registry','defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x548a59,_0x9ab69f){var _0x9f7c8=function(_0x33cdbb){while(--_0x33cdbb){_0x548a59['push'](_0x548a59['shift']());}};_0x9f7c8(++_0x9ab69f);}(_0xd71d,0xbf));var _0xdd71=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xd71d[_0x21cb7f];return _0x5a079a;};'use strict';var client=require(_0xdd71('0x0'));exports[_0xdd71('0x1')]=function(_0x5b0b9c){return function(_0x525400){return client[_0xdd71('0x2')](_0xdd71('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xdd71('0x4'),_0xdd71('0x5'),_0xdd71('0x6')]},'log':_0xdd71('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4e16baa..a2cb672 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x1fda13,_0x4b4db5){var _0x363231=function(_0x529f76){while(--_0x529f76){_0x1fda13['push'](_0x1fda13['shift']());}};_0x363231(++_0x4b4db5);}(_0x34e8,0x12c));var _0x834e=function(_0x53402c,_0x429a7f){_0x53402c=_0x53402c-0x0;var _0x30afc2=_0x34e8[_0x53402c];return _0x30afc2;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index e36e92a..e34e7e8 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 _0x99a3=['update','UpdateVoiceAgentReport','create','CreateVoiceAgentReport'];(function(_0x290462,_0xd914f9){var _0x406105=function(_0x54fd53){while(--_0x54fd53){_0x290462['push'](_0x290462['shift']());}};_0x406105(++_0xd914f9);}(_0x99a3,0x82));var _0x399a=function(_0x5d43f5,_0x8c9030){_0x5d43f5=_0x5d43f5-0x0;var _0x453144=_0x99a3[_0x5d43f5];return _0x453144;};'use strict';var client=require('../client');exports[_0x399a('0x0')]=function(_0x59919c){return client['Request'](_0x399a('0x1'),{'body':_0x59919c,'log':_0x399a('0x1')});};exports[_0x399a('0x2')]=function(_0x270b2a,_0x3850fd,_0x4a609e){return client['Request']('UpdateVoiceAgentReport',{'body':_0x270b2a,'options':{'where':{'uniqueid':_0x3850fd,'interface':_0x4a609e,'agentcomplete':!![]}},'log':_0x399a('0x3')});}; \ No newline at end of file +var _0xe68f=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0xd07790,_0x3db009){var _0x32f10e=function(_0x1f4911){while(--_0x1f4911){_0xd07790['push'](_0xd07790['shift']());}};_0x32f10e(++_0x3db009);}(_0xe68f,0x127));var _0xfe68=function(_0x10fcd9,_0x22878b){_0x10fcd9=_0x10fcd9-0x0;var _0x3ee43c=_0xe68f[_0x10fcd9];return _0x3ee43c;};'use strict';var client=require('../client');exports[_0xfe68('0x0')]=function(_0xb44840){return client[_0xfe68('0x1')](_0xfe68('0x2'),{'body':_0xb44840,'log':_0xfe68('0x2')});};exports[_0xfe68('0x3')]=function(_0x47f9fc,_0x35dfdf,_0x4cc47f){return client[_0xfe68('0x1')](_0xfe68('0x4'),{'body':_0x47f9fc,'options':{'where':{'uniqueid':_0x35dfdf,'interface':_0x4cc47f,'agentcomplete':!![]}},'log':_0xfe68('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 02278e2..f3148db 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 _0x5731=['DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','endOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','../client','create','Request','context','callerid'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x5731,0x1e0));var _0x1573=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5731[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0x1573('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x1573('0x1'));exports[_0x1573('0x2')]=function(_0x32b852){return client[_0x1573('0x3')]('CreateVoiceCallReport',{'body':_['merge'](_0x32b852,{'source':_0x32b852['calleridnum'],'destinationcontext':_0x32b852[_0x1573('0x4')],'callerid':_0x32b852[_0x1573('0x5')],'amaflags':_0x1573('0x6')}),'log':_0x1573('0x7')});};exports[_0x1573('0x8')]=function(){return function(){return client['Request'](_0x1573('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1573('0xa')](_0x1573('0xb'))[_0x1573('0xc')](_0x1573('0xd'))]}},'attributes':[_0x1573('0xe'),_0x1573('0xf'),_0x1573('0x10'),_0x1573('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xb892=['context','callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','startOf','day','format','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','CreateVoiceCallReport','merge'];(function(_0x367b08,_0x403c86){var _0x1b8f2c=function(_0x56c457){while(--_0x56c457){_0x367b08['push'](_0x367b08['shift']());}};_0x1b8f2c(++_0x403c86);}(_0xb892,0x13f));var _0x2b89=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xb892[_0x50a0c2];return _0x5ebadd;};'use strict';var moment=require('moment');var util=require(_0x2b89('0x0'));var _=require(_0x2b89('0x1'));var client=require('../client');exports['create']=function(_0x3957aa){return client['Request'](_0x2b89('0x2'),{'body':_[_0x2b89('0x3')](_0x3957aa,{'source':_0x3957aa['calleridnum'],'destinationcontext':_0x3957aa[_0x2b89('0x4')],'callerid':_0x3957aa[_0x2b89('0x5')],'amaflags':_0x2b89('0x6')}),'log':_0x2b89('0x2')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x2b89('0x7')](_0x2b89('0x8'),{'options':{'where':{'type':[_0x2b89('0x9')],'createdAt':{'$between':[moment()[_0x2b89('0xa')](_0x2b89('0xb'))[_0x2b89('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x2b89('0xb'))[_0x2b89('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x2b89('0xd'),_0x2b89('0xe'),_0x2b89('0xf')]},'log':_0x2b89('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b7213be..d55b76c 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 _0xc84b=['../client','Request','CreateVoiceDialReport'];(function(_0x7ec0ec,_0x529dd4){var _0x4c0883=function(_0x121114){while(--_0x121114){_0x7ec0ec['push'](_0x7ec0ec['shift']());}};_0x4c0883(++_0x529dd4);}(_0xc84b,0x132));var _0xbc84=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xc84b[_0x1b6186];return _0x186121;};'use strict';var client=require(_0xbc84('0x0'));exports['create']=function(_0x16b216){return client[_0xbc84('0x1')](_0xbc84('0x2'),{'body':_0x16b216,'log':_0xbc84('0x2')});}; \ No newline at end of file +var _0xef61=['create','Request','CreateVoiceDialReport','../client'];(function(_0x9bc94,_0x5d6bf6){var _0xe38c04=function(_0x2d37b0){while(--_0x2d37b0){_0x9bc94['push'](_0x9bc94['shift']());}};_0xe38c04(++_0x5d6bf6);}(_0xef61,0x1c7));var _0x1ef6=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xef61[_0x3cc9d9];return _0x1a425d;};'use strict';var client=require(_0x1ef6('0x0'));exports[_0x1ef6('0x1')]=function(_0x52b3bc){return client[_0x1ef6('0x2')]('CreateVoiceDialReport',{'body':_0x52b3bc,'log':_0x1ef6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 3cb90d2..8db47d1 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 _0x1752=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x4db7c1,_0x40baeb){var _0x41fa35=function(_0x363797){while(--_0x363797){_0x4db7c1['push'](_0x4db7c1['shift']());}};_0x41fa35(++_0x40baeb);}(_0x1752,0xa5));var _0x2175=function(_0x5da6db,_0x5e3189){_0x5da6db=_0x5da6db-0x0;var _0x16d076=_0x1752[_0x5da6db];return _0x16d076;};'use strict';var client=require('../client');exports[_0x2175('0x0')]=function(){return function(){return client[_0x2175('0x1')](_0x2175('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2175('0x3'),_0x2175('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x2175('0x0')});};}; \ No newline at end of file +var _0xb6b1=['Request','exten','recordingFormat','../client'];(function(_0x4dda69,_0x2a0fe4){var _0x9014a9=function(_0x3d2b40){while(--_0x3d2b40){_0x4dda69['push'](_0x4dda69['shift']());}};_0x9014a9(++_0x2a0fe4);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0xb6b1[_0x13992d];return _0x3d15bf;};'use strict';var client=require(_0x1b6b('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x1b6b('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x1b6b('0x2'),_0x1b6b('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ef574c7..f62a41c 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 _0x5573=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Intervals','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords'];(function(_0x233966,_0x5b6367){var _0x4489eb=function(_0x2fa049){while(--_0x2fa049){_0x233966['push'](_0x233966['shift']());}};_0x4489eb(++_0x5b6367);}(_0x5573,0x1c8));var _0x3557=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x5573[_0x55fa03];return _0x2cd7cd;};'use strict';var client=require(_0x3557('0x0'));exports[_0x3557('0x1')]=function(){return function(){return client[_0x3557('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x3557('0x3'),_0x3557('0x4'),_0x3557('0x5'),'monitor_format',_0x3557('0x6'),_0x3557('0x7'),_0x3557('0x8'),_0x3557('0x9'),'dialLimitQueue',_0x3557('0xa'),_0x3557('0xb'),_0x3557('0xc'),_0x3557('0xd'),_0x3557('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x3557('0xf'),_0x3557('0x10'),_0x3557('0x11'),_0x3557('0x12'),_0x3557('0x13'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x3557('0x14'),'dialNoAnswerRetryFrequency',_0x3557('0x15'),_0x3557('0x16'),_0x3557('0x17'),_0x3557('0x18'),_0x3557('0x19'),_0x3557('0x1a'),_0x3557('0x1b'),'dialAMDGreeting',_0x3557('0x1c'),_0x3557('0x1d'),_0x3557('0x1e'),'dialAMDBetweenWordsSilence',_0x3557('0x1f'),_0x3557('0x20'),_0x3557('0x21'),'timeout',_0x3557('0x22'),_0x3557('0x23'),'dialOrderByScheduledAt',_0x3557('0x24'),_0x3557('0x25'),_0x3557('0x26'),_0x3557('0x27'),_0x3557('0x28'),_0x3557('0x29'),_0x3557('0x2a'),_0x3557('0x2b'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x3557('0x2c'),'dialAbandonedMaxRetry',_0x3557('0x2d'),_0x3557('0x2e'),_0x3557('0x2f'),_0x3557('0x30'),_0x3557('0x31'),_0x3557('0x32'),_0x3557('0x33'),_0x3557('0x34')],'include':[{'model':_0x3557('0x35'),'as':'Trunk','attributes':['id',_0x3557('0x36'),_0x3557('0x37'),_0x3557('0x38')]},{'model':_0x3557('0x39'),'as':_0x3557('0x3a'),'attributes':['id',_0x3557('0x36')]},{'model':_0x3557('0x35'),'as':_0x3557('0x3b'),'attributes':['id',_0x3557('0x36'),_0x3557('0x37'),_0x3557('0x38')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':_0x3557('0x3c'),'attributes':['id',_0x3557('0x36'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x974d=['dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','active','Pause','mandatoryDispositionPause','name','Trunk','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0x974d,0x149));var _0xd974=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x974d[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0xd974('0x0')]=function(){return function(){return client['Request'](_0xd974('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xd974('0x2'),_0xd974('0x3'),'autopause',_0xd974('0x4'),'type',_0xd974('0x5'),_0xd974('0x6'),'dialLimitChannel',_0xd974('0x7'),_0xd974('0x8'),_0xd974('0x9'),_0xd974('0xa'),_0xd974('0xb'),_0xd974('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xd974('0xd'),_0xd974('0xe'),_0xd974('0xf'),_0xd974('0x10'),'dialCongestionRetryFrequency',_0xd974('0x11'),_0xd974('0x12'),_0xd974('0x13'),_0xd974('0x14'),'dialGlobalMaxRetry',_0xd974('0x15'),_0xd974('0x16'),_0xd974('0x17'),_0xd974('0x18'),'dialAMDActive',_0xd974('0x19'),'dialAMDGreeting',_0xd974('0x1a'),_0xd974('0x1b'),_0xd974('0x1c'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xd974('0x1d'),_0xd974('0x1e'),_0xd974('0x1f'),_0xd974('0x20'),_0xd974('0x21'),'dialOrderByScheduledAt',_0xd974('0x22'),_0xd974('0x23'),_0xd974('0x24'),_0xd974('0x4'),_0xd974('0x25'),_0xd974('0x26'),_0xd974('0x27'),_0xd974('0x28'),_0xd974('0x29'),_0xd974('0x2a'),_0xd974('0x2b'),_0xd974('0x2c'),_0xd974('0x2d'),_0xd974('0x2e'),_0xd974('0x2f'),'dialAgentRejectMaxRetry',_0xd974('0x30'),'mandatoryDisposition',_0xd974('0x31'),_0xd974('0x32')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id','name','callerid',_0xd974('0x33')]},{'model':_0xd974('0x34'),'as':_0xd974('0x35'),'attributes':['id',_0xd974('0x36')]},{'model':_0xd974('0x37'),'as':'TrunkBackup','attributes':['id',_0xd974('0x36'),'callerid','active']},{'model':_0xd974('0x38'),'as':_0xd974('0x38'),'attributes':['id',_0xd974('0x36')],'include':[{'model':_0xd974('0x38'),'as':_0xd974('0x39'),'attributes':['id',_0xd974('0x36'),_0xd974('0x3a')]}]}]},'log':_0xd974('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e9eebf0..2221d60 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(_0x185180,_0x22d105){var _0x216eb2=function(_0x128622){while(--_0x128622){_0x185180['push'](_0x185180['shift']());}};_0x216eb2(++_0x22d105);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0xc13e3d,_0x73d982){var _0x102e25=function(_0x23c8f5){while(--_0x23c8f5){_0xc13e3d['push'](_0xc13e3d['shift']());}};_0x102e25(++_0x73d982);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 ca280ac..d168308 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 _0xf841=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x6f9e6c,_0x5ef730){var _0x20a1a0=function(_0x231ec0){while(--_0x231ec0){_0x6f9e6c['push'](_0x6f9e6c['shift']());}};_0x20a1a0(++_0x5ef730);}(_0xf841,0x1ad));var _0x1f84=function(_0x43d31b,_0x670376){_0x43d31b=_0x43d31b-0x0;var _0x5541c8=_0xf841[_0x43d31b];return _0x5541c8;};'use strict';var client=require(_0x1f84('0x0'));exports[_0x1f84('0x1')]=function(_0x916de3){return function(){return client['Request'](_0x1f84('0x2'),{'options':{'where':{'VoiceQueueId':_0x916de3,'paused':!![]},'raw':!![]},'log':_0x1f84('0x1')});};}; \ No newline at end of file +var _0x1cb8=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x214a03,_0x2e4061){var _0xda476a=function(_0x1c46b2){while(--_0x1c46b2){_0x214a03['push'](_0x214a03['shift']());}};_0xda476a(++_0x2e4061);}(_0x1cb8,0xa6));var _0x81cb=function(_0x480ec5,_0x5763af){_0x480ec5=_0x480ec5-0x0;var _0x14ab6e=_0x1cb8[_0x480ec5];return _0x14ab6e;};'use strict';var client=require(_0x81cb('0x0'));exports[_0x81cb('0x1')]=function(_0x578541){return function(){return client[_0x81cb('0x2')](_0x81cb('0x3'),{'options':{'where':{'VoiceQueueId':_0x578541,'paused':!![]},'raw':!![]},'log':_0x81cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a885c53..a5e1fc9 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(_0x524b71,_0x47d237){var _0x3086e9=function(_0x7db5b5){while(--_0x7db5b5){_0x524b71['push'](_0x524b71['shift']());}};_0x3086e9(++_0x47d237);}(_0x7a54,0x106));var _0x47a5=function(_0x43a359,_0x5b7278){_0x43a359=_0x43a359-0x0;var _0x1b873f=_0x7a54[_0x43a359];return _0x1b873f;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x50f097,_0x4cf44d){var _0x2caa0f=function(_0x5031cf){while(--_0x5031cf){_0x50f097['push'](_0x50f097['shift']());}};_0x2caa0f(++_0x4cf44d);}(_0x7a54,0x106));var _0x47a5=function(_0x473e73,_0x4ee335){_0x473e73=_0x473e73-0x0;var _0x5c0080=_0x7a54[_0x473e73];return _0x5c0080;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1692b63..dd4441e 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 _0x8ba2=['context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten'];(function(_0x176802,_0x21aad7){var _0x1b66ff=function(_0x52ae0f){while(--_0x52ae0f){_0x176802['push'](_0x176802['shift']());}};_0x1b66ff(++_0x21aad7);}(_0x8ba2,0x185));var _0x28ba=function(_0x104753,_0x16dc10){_0x104753=_0x104753-0x0;var _0x38435e=_0x8ba2[_0x104753];return _0x38435e;};'use strict';var client=require(_0x28ba('0x0'));exports['transfers']={};exports[_0x28ba('0x1')]=function(_0x36a352){return client[_0x28ba('0x2')](_0x28ba('0x3'),{'body':{'result':_0x36a352[_0x28ba('0x4')],'transfererchannel':_0x36a352['transfererchannel'],'transferercalleridnum':_0x36a352[_0x28ba('0x5')],'transferercalleridname':_0x36a352[_0x28ba('0x6')],'transfererconnectedlinenum':_0x36a352[_0x28ba('0x7')],'transfererconnectedlinename':_0x36a352['transfererconnectedlinename'],'transfereraccountcode':_0x36a352[_0x28ba('0x8')],'transferercontext':_0x36a352[_0x28ba('0x9')],'transfererexten':_0x36a352[_0x28ba('0xa')],'transfererlinkedid':_0x36a352[_0x28ba('0xb')],'transfereechannel':_0x36a352[_0x28ba('0xc')],'transfereecalleridnum':_0x36a352[_0x28ba('0xd')],'transfereecalleridname':_0x36a352[_0x28ba('0xe')],'transfereeconnectedlinenum':_0x36a352['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x36a352['transfereeconnectedlinename'],'transfereeaccountcode':_0x36a352[_0x28ba('0xf')],'transfereecontext':_0x36a352[_0x28ba('0x10')],'transfereeexten':_0x36a352[_0x28ba('0x11')],'transfereelinkedid':_0x36a352['transfereelinkedid'],'isexternal':_0x36a352['isexternal'],'context':_0x36a352[_0x28ba('0x12')],'extension':_0x36a352[_0x28ba('0x13')],'type':_0x28ba('0x14')},'log':_0x28ba('0x3')});};exports['attendedTransfer']=function(_0x550b9e){return client[_0x28ba('0x2')](_0x28ba('0x3'),{'body':{'result':_0x550b9e['result'],'transfererchannel':_0x550b9e[_0x28ba('0x15')],'transferercalleridnum':_0x550b9e[_0x28ba('0x16')],'transferercalleridname':_0x550b9e[_0x28ba('0x17')],'transfererconnectedlinenum':_0x550b9e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x550b9e[_0x28ba('0x18')],'transfereraccountcode':_0x550b9e[_0x28ba('0x19')],'transferercontext':_0x550b9e['secondtransferercontext'],'transfererexten':_0x550b9e[_0x28ba('0x1a')],'transfererlinkedid':_0x550b9e[_0x28ba('0x1b')],'transfereechannel':_0x550b9e[_0x28ba('0x1c')],'transfereecalleridnum':_0x550b9e['transfertargetcalleridnum'],'transfereecalleridname':_0x550b9e[_0x28ba('0x1d')],'transfereeconnectedlinenum':_0x550b9e[_0x28ba('0x1e')],'transfereeconnectedlinename':_0x550b9e[_0x28ba('0x1f')],'transfereeaccountcode':_0x550b9e[_0x28ba('0x20')],'transfereecontext':_0x550b9e['transfertargetcontext'],'transfereeexten':_0x550b9e[_0x28ba('0x21')],'transfereelinkedid':_0x550b9e[_0x28ba('0x22')],'isexternal':_0x550b9e['isexternal'],'context':_0x550b9e[_0x28ba('0x23')],'extension':_0x550b9e['origtransfererexten'],'type':_0x28ba('0x24')},'log':_0x28ba('0x3')});}; \ No newline at end of file +var _0xc4b8=['transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','result','transfererchannel'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0xc4b8,0x105));var _0x8c4b=function(_0x50647f,_0x3b575d){_0x50647f=_0x50647f-0x0;var _0x15dacc=_0xc4b8[_0x50647f];return _0x15dacc;};'use strict';var client=require(_0x8c4b('0x0'));exports[_0x8c4b('0x1')]={};exports['blindTransfer']=function(_0x3f7f8d){return client[_0x8c4b('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3f7f8d[_0x8c4b('0x3')],'transfererchannel':_0x3f7f8d[_0x8c4b('0x4')],'transferercalleridnum':_0x3f7f8d['transferercalleridnum'],'transferercalleridname':_0x3f7f8d[_0x8c4b('0x5')],'transfererconnectedlinenum':_0x3f7f8d[_0x8c4b('0x6')],'transfererconnectedlinename':_0x3f7f8d['transfererconnectedlinename'],'transfereraccountcode':_0x3f7f8d[_0x8c4b('0x7')],'transferercontext':_0x3f7f8d[_0x8c4b('0x8')],'transfererexten':_0x3f7f8d['transfererexten'],'transfererlinkedid':_0x3f7f8d[_0x8c4b('0x9')],'transfereechannel':_0x3f7f8d[_0x8c4b('0xa')],'transfereecalleridnum':_0x3f7f8d[_0x8c4b('0xb')],'transfereecalleridname':_0x3f7f8d['transfereecalleridname'],'transfereeconnectedlinenum':_0x3f7f8d[_0x8c4b('0xc')],'transfereeconnectedlinename':_0x3f7f8d[_0x8c4b('0xd')],'transfereeaccountcode':_0x3f7f8d[_0x8c4b('0xe')],'transfereecontext':_0x3f7f8d[_0x8c4b('0xf')],'transfereeexten':_0x3f7f8d[_0x8c4b('0x10')],'transfereelinkedid':_0x3f7f8d[_0x8c4b('0x11')],'isexternal':_0x3f7f8d[_0x8c4b('0x12')],'context':_0x3f7f8d[_0x8c4b('0x13')],'extension':_0x3f7f8d['extension'],'type':_0x8c4b('0x14')},'log':'CreateVoiceTransferReport'});};exports[_0x8c4b('0x15')]=function(_0x226989){return client[_0x8c4b('0x2')](_0x8c4b('0x16'),{'body':{'result':_0x226989[_0x8c4b('0x3')],'transfererchannel':_0x226989[_0x8c4b('0x17')],'transferercalleridnum':_0x226989['origtransferercalleridnum'],'transferercalleridname':_0x226989[_0x8c4b('0x18')],'transfererconnectedlinenum':_0x226989['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x226989['secondtransfererconnectedlinename'],'transfereraccountcode':_0x226989[_0x8c4b('0x19')],'transferercontext':_0x226989[_0x8c4b('0x1a')],'transfererexten':_0x226989[_0x8c4b('0x1b')],'transfererlinkedid':_0x226989[_0x8c4b('0x1c')],'transfereechannel':_0x226989[_0x8c4b('0x1d')],'transfereecalleridnum':_0x226989[_0x8c4b('0x1e')],'transfereecalleridname':_0x226989['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x226989['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x226989[_0x8c4b('0x1f')],'transfereeaccountcode':_0x226989[_0x8c4b('0x20')],'transfereecontext':_0x226989[_0x8c4b('0x21')],'transfereeexten':_0x226989[_0x8c4b('0x22')],'transfereelinkedid':_0x226989['transfertargetlinkedid'],'isexternal':_0x226989['isexternal'],'context':_0x226989[_0x8c4b('0x23')],'extension':_0x226989[_0x8c4b('0x24')],'type':_0x8c4b('0x25')},'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 e881d62..e8a9a38 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 _0x9a5a=['emit','custom:','faxAccounts','checkAfterSend','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','action','Reload','Action','username','command','catch','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','sumBillable','sumHoldTime','talking','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','omit','undefined','channels','length','voicechannel','map','find','uniqueid','filename','format','wav','MixMonitor','channel','ai(mixmonitorid)','then','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','values','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x9a5a,0x194));var _0xa9a5=function(_0x3bb4a4,_0x5c0a87){_0x3bb4a4=_0x3bb4a4-0x0;var _0xbf9937=_0x9a5a[_0x3bb4a4];return _0xbf9937;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var jayson=require(_0xa9a5('0x2'));var schema=require(_0xa9a5('0x3'));var BPromise=require(_0xa9a5('0x4'));var moment=require('moment');var config=require(_0xa9a5('0x5'));var properties=require(_0xa9a5('0x6'));var ami=require(_0xa9a5('0x7'));exports[_0xa9a5('0x8')]=function(_0x31e823,_0x1ae623,_0x4a73f4){return new BPromise(function(_0xb0ccd9,_0x37e93b){var _0x20bbe8={'QueuePause':function(_0x1eafa6){return new Promise(function(_0x24e1bd,_0x5f2e83){var _0x483b1e=util['format'](_0xa9a5('0x9'),_0xa9a5('0xa'),_0x1eafa6[_0xa9a5('0xb')]);if(_0x31e823[_0xa9a5('0xc')]&&_0x31e823[_0xa9a5('0xc')][_0x483b1e]&&_0x31e823[_0xa9a5('0xc')][_0x483b1e][_0xa9a5('0xd')]){_0x31e823['timers'][_0x483b1e]['updateAcw']();}if(_0x31e823['agents'][_0x483b1e]){_0x31e823[_0xa9a5('0xe')][_0x483b1e][_0xa9a5('0xf')]({'statePause':_0x1eafa6[_0xa9a5('0x10')]?!![]:![]});}_0x24e1bd({'code':0xc8,'message':_0xa9a5('0x11')});});},'Reload':function(_0x135279){var _0x49c9aa=this;return new Promise(function(_0xe6a34b,_0x3e7ebe){if(ami[_0xa9a5('0x12')]()==![]){return _0x3e7ebe(_0x49c9aa[_0xa9a5('0x13')](0x1f4,[config[_0xa9a5('0x14')]['ip'],config[_0xa9a5('0x14')]['username'],_0xa9a5('0x15')][_0xa9a5('0x16')]('\x20')));}_0x135279=_[_0xa9a5('0x17')](_0x135279,_[_0xa9a5('0x18')](properties['module']));_0x135279[_0xa9a5('0x19')]=_0xa9a5('0x1a');return ami[_0xa9a5('0x1b')](_0x135279)['then'](function(_0x3c505b){_0xe6a34b({'code':0xc8,'message':_0x3c505b['message']});})['catch'](function(_0x2fb6bc){_0x3e7ebe(_0x49c9aa[_0xa9a5('0x13')](0x1f5,_0x2fb6bc['message']));});});},'Command':function(_0x3cbd4c){var _0x5d05d5=this;return new Promise(function(_0x89c4b9,_0x9f0363){if(ami[_0xa9a5('0x12')]()==![]){return _0x9f0363(_0x5d05d5[_0xa9a5('0x13')](0x1f4,[config[_0xa9a5('0x14')]['ip'],config[_0xa9a5('0x14')][_0xa9a5('0x1c')],_0xa9a5('0x15')][_0xa9a5('0x16')]('\x20')));}_0x3cbd4c=_[_0xa9a5('0x17')](_0x3cbd4c,_0xa9a5('0x1d'));_0x3cbd4c[_0xa9a5('0x19')]='Command';return ami['Action'](_0x3cbd4c)['then'](function(_0x43017d){_0x89c4b9({'code':0xc8,'message':_0x43017d['content']});})[_0xa9a5('0x1e')](function(_0x198821){_0x9f0363(_0x5d05d5[_0xa9a5('0x13')](0x1f5,_0x198821['message']));});});},'VoiceQueues':function(_0x1e5d79){return new Promise(function(_0xb37bcb,_0x341723){var _0x4f1076=[];for(var _0x5dd641 in _0x31e823[_0xa9a5('0x1f')]){if(_0x31e823[_0xa9a5('0x1f')][_0xa9a5('0x20')](_0x5dd641)){var _0x58c94c=_0x31e823[_0xa9a5('0x1f')][_0x5dd641];var _0x45afca={'id':_0x58c94c['id'],'name':_0x58c94c['name'],'strategy':_0x58c94c[_0xa9a5('0x21')],'answered':_0x58c94c[_0xa9a5('0x22')],'available':_0x58c94c['available'],'loggedIn':_0x58c94c[_0xa9a5('0x23')],'pTalking':_0x58c94c['pTalking'],'sumBillable':_0x58c94c[_0xa9a5('0x24')],'sumDuration':_0x58c94c['sumDuration'],'sumHoldTime':_0x58c94c[_0xa9a5('0x25')]||0x0,'talking':_0x58c94c[_0xa9a5('0x26')],'total':_0x58c94c['total'],'type':_0x58c94c['type'],'unmanaged':_0x58c94c[_0xa9a5('0x27')],'abandoned':_0x58c94c['abandoned'],'waiting':_0x58c94c[_0xa9a5('0x28')],'loggedInDb':_0x58c94c[_0xa9a5('0x29')]};if(_0x58c94c['type']===_0xa9a5('0x2a')){_0x45afca[_0xa9a5('0x2b')]=_0x58c94c['dialActive'];_0x45afca[_0xa9a5('0x2c')]=_0x58c94c[_0xa9a5('0x2c')];_0x45afca['dialOriginateCallerIdName']=_0x58c94c['dialOriginateCallerIdName'];_0x45afca['dialOriginateCallerIdNumber']=_0x58c94c['dialOriginateCallerIdNumber'];_0x45afca[_0xa9a5('0x2d')]=_0x58c94c['dialOriginateTimeout'];_0x45afca[_0xa9a5('0x2e')]=_0x58c94c[_0xa9a5('0x2e')];_0x45afca['temp']=_0x58c94c[_0xa9a5('0x2f')];_0x45afca[_0xa9a5('0x30')]=_0x58c94c[_0xa9a5('0x30')];_0x45afca['outboundAnswerCallsDay']=_0x58c94c['outboundAnswerCallsDay'];_0x45afca[_0xa9a5('0x31')]=_0x58c94c[_0xa9a5('0x31')];_0x45afca['outboundBusyCallsDay']=_0x58c94c[_0xa9a5('0x32')];_0x45afca[_0xa9a5('0x33')]=_0x58c94c[_0xa9a5('0x33')];_0x45afca[_0xa9a5('0x34')]=_0x58c94c[_0xa9a5('0x34')];_0x45afca[_0xa9a5('0x35')]=_0x58c94c[_0xa9a5('0x35')];_0x45afca['outboundDropCallsDayTimeout']=_0x58c94c['outboundDropCallsDayTimeout'];_0x45afca[_0xa9a5('0x36')]=_0x58c94c[_0xa9a5('0x36')];_0x45afca[_0xa9a5('0x37')]=_0x58c94c[_0xa9a5('0x37')];_0x45afca[_0xa9a5('0x38')]=_0x58c94c[_0xa9a5('0x38')];_0x45afca[_0xa9a5('0x39')]=_0x58c94c[_0xa9a5('0x39')];_0x45afca[_0xa9a5('0x3a')]=_0x58c94c['outboundRejectCallsDay'];_0x45afca[_0xa9a5('0x3b')]=_0x58c94c['outboundUnknownCallsDay'];_0x45afca[_0xa9a5('0x3c')]=_0x58c94c['predictiveIntervalAnsweredCalls'];_0x45afca['predictiveIntervalAvgHoldtime']=_0x58c94c[_0xa9a5('0x3d')];_0x45afca[_0xa9a5('0x3e')]=_0x58c94c[_0xa9a5('0x3e')];_0x45afca[_0xa9a5('0x3f')]=_0x58c94c['predictiveIntervalDroppedCallsCallersExit'];_0x45afca[_0xa9a5('0x40')]=_0x58c94c[_0xa9a5('0x40')];_0x45afca[_0xa9a5('0x41')]=_0x58c94c[_0xa9a5('0x41')];_0x45afca[_0xa9a5('0x42')]=_0x58c94c[_0xa9a5('0x42')];_0x45afca[_0xa9a5('0x43')]=_0x58c94c[_0xa9a5('0x43')];_0x45afca[_0xa9a5('0x44')]=_0x58c94c[_0xa9a5('0x44')];_0x45afca[_0xa9a5('0x45')]=_0x58c94c['predictiveIntervalPauses'];_0x45afca[_0xa9a5('0x46')]=_0x58c94c['predictiveIntervalAvailable'];_0x45afca[_0xa9a5('0x47')]=_0x58c94c[_0xa9a5('0x47')];_0x45afca[_0xa9a5('0x48')]=_0x58c94c[_0xa9a5('0x48')];_0x45afca['originated']=_0x58c94c[_0xa9a5('0x49')];_0x45afca[_0xa9a5('0x4a')]=_0x58c94c[_0xa9a5('0x4a')];_0x45afca['erlangCallToSecond']=_0x58c94c['erlangCallToSecond'];_0x45afca[_0xa9a5('0x4b')]=_0x58c94c['erlangAbandonmentRate'];_0x45afca[_0xa9a5('0x4c')]=_0x58c94c[_0xa9a5('0x4c')];_0x45afca[_0xa9a5('0x4d')]=_0x58c94c['startPredictive'];_0x45afca[_0xa9a5('0x4e')]=_0x58c94c[_0xa9a5('0x4e')];}if(_0x58c94c[_0xa9a5('0x4f')]){_0x45afca['Trunk']={'id':_0x58c94c[_0xa9a5('0x4f')]['id'],'name':_0x58c94c['Trunk'][_0xa9a5('0xb')],'active':_0x58c94c[_0xa9a5('0x4f')]['active'],'callerid':_0x58c94c[_0xa9a5('0x4f')]['callerid']};}if(_0x58c94c[_0xa9a5('0x50')]){_0x45afca[_0xa9a5('0x50')]={'id':_0x58c94c['Interval']['id'],'name':_0x58c94c['Interval'][_0xa9a5('0xb')]};}_0x4f1076[_0xa9a5('0x51')](_0x45afca);}}_0xb37bcb({'count':_0x4f1076['length'],'rows':_0x4f1076});});},'UpdateVoiceQueue':function(_0x160a6a){return new Promise(function(_0x1a4703,_0x331734){var _0x4e8ece=_['find'](_0x31e823['voiceQueues'],{'id':parseInt(_0x160a6a['id'])});var _0x2196c1=_[_0xa9a5('0x52')](_0x160a6a,['id']);if(_0x4e8ece){for(var _0x5f21de in _0x2196c1){if(typeof _0x2196c1[_0x5f21de]!==_0xa9a5('0x53')&&typeof _0x4e8ece[_0x5f21de]!=='undefined'){_0x4e8ece[_0x5f21de]=_0x2196c1[_0x5f21de];}}_0x1a4703(_0x4e8ece);}else{_0x331734();}});},'VoiceChannels':function(_0x29cc10){return new Promise(function(_0x33a352,_0x6d15a){var _0x3a9900=_['values'](_0x31e823[_0xa9a5('0x54')]);_0x33a352({'count':_0x3a9900[_0xa9a5('0x55')],'rows':_0x3a9900});});},'VoiceChannelMixMonitor':function(_0x109672){var _0x57363c=this;return new Promise(function(_0x5d0bee,_0x4deec1){if(ami[_0xa9a5('0x12')]()==![]){return _0x4deec1(_0x57363c[_0xa9a5('0x13')](0x1f4,[config[_0xa9a5('0x14')]['ip'],config['asterisk']['username'],_0xa9a5('0x15')][_0xa9a5('0x16')]('\x20')));}var _0x496f3d=schema(properties[_0xa9a5('0x56')])[_0xa9a5('0x3')](_0x109672);if(_0x496f3d[_0xa9a5('0x55')]>0x0){return _0x4deec1(_0x57363c[_0xa9a5('0x13')](0x1f4,_[_0xa9a5('0x57')](_0x496f3d,_0xa9a5('0x48'))[_0xa9a5('0x16')](',\x20')));}var _0x17e331=_[_0xa9a5('0x58')](_0x31e823[_0xa9a5('0x54')],{'uniqueid':_0x109672[_0xa9a5('0x59')]});if(_0x17e331&&_0x17e331['channel']){var _0x2766f9=util['format']('%s.%s',_0x109672[_0xa9a5('0x5a')]||_0x109672['uniqueid'],_0x109672[_0xa9a5('0x5b')]||_0xa9a5('0x5c'));return ami['Action']({'action':_0xa9a5('0x5d'),'channel':_0x17e331[_0xa9a5('0x5e')],'file':_0x2766f9,'options':_0xa9a5('0x5f')})[_0xa9a5('0x60')](function(_0x3be6ce){var _0x453bcd=_['find'](_0x17e331[_0xa9a5('0x61')],{'filename':_0xa9a5('0x62')+_0x2766f9['toLowerCase']()});if(_['isNil'](_0x453bcd)){_0x17e331[_0xa9a5('0x61')][_0xa9a5('0x51')]({'filename':_0xa9a5('0x62')+_0x2766f9[_0xa9a5('0x63')](),'createdAt':moment()[_0xa9a5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3be6ce[_0xa9a5('0x64')],'status':_0xa9a5('0x65')});}else{_0x453bcd[_0xa9a5('0x64')]=_0x3be6ce[_0xa9a5('0x64')];_0x453bcd[_0xa9a5('0x66')]=_0xa9a5('0x65');}_0x5d0bee({'code':0xc8,'message':[_0x109672[_0xa9a5('0x59')],_0xa9a5('0x67'),_0x3be6ce[_0xa9a5('0x64')]][_0xa9a5('0x16')]('\x20'),'mixmonitorid':_0x3be6ce[_0xa9a5('0x64')]});})[_0xa9a5('0x1e')](function(_0x34849c){_0x4deec1(_0x57363c[_0xa9a5('0x13')](0x1f5,[_0x109672[_0xa9a5('0x59')],_0x34849c[_0xa9a5('0x48')][_0xa9a5('0x63')]()][_0xa9a5('0x16')]('\x20')));});}else{return _0x4deec1(_0x57363c[_0xa9a5('0x13')](0x1f5,_0xa9a5('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x36f1ac){var _0x39d29d=this;return new Promise(function(_0x594187,_0x2d5f5e){if(ami[_0xa9a5('0x12')]()==![]){return _0x2d5f5e(_0x39d29d[_0xa9a5('0x13')](0x1f4,[config[_0xa9a5('0x14')]['ip'],config[_0xa9a5('0x14')][_0xa9a5('0x1c')],'ami\x20disconnected'][_0xa9a5('0x16')]('\x20')));}var _0x2c54fa=schema(properties[_0xa9a5('0x56')])['validate'](_0x36f1ac);if(_0x2c54fa[_0xa9a5('0x55')]>0x0){return _0x2d5f5e(_0x39d29d['error'](0x1f4,_[_0xa9a5('0x57')](_0x2c54fa,_0xa9a5('0x48'))[_0xa9a5('0x16')](',\x20')));}var _0x34c0fb=_[_0xa9a5('0x58')](_0x31e823[_0xa9a5('0x54')],{'uniqueid':_0x36f1ac[_0xa9a5('0x59')]});if(_0x34c0fb){return BPromise[_0xa9a5('0x69')]()['then'](function(){if(_0x34c0fb[_0xa9a5('0x5e')]){return ami[_0xa9a5('0x1b')]({'action':_0xa9a5('0x6a'),'channel':_0x34c0fb[_0xa9a5('0x5e')],'mixmonitorid':_0x36f1ac[_0xa9a5('0x64')]})[_0xa9a5('0x1e')](function(_0x7f5c52){});}})[_0xa9a5('0x60')](function(){if(_0x34c0fb[_0xa9a5('0x6b')]){return ami[_0xa9a5('0x1b')]({'action':_0xa9a5('0x6a'),'channel':_0x34c0fb[_0xa9a5('0x6b')],'mixmonitorid':_0x36f1ac[_0xa9a5('0x64')]})[_0xa9a5('0x1e')](function(_0x364fe9){});}})[_0xa9a5('0x60')](function(_0xf2f8f3){var _0x3f4459=_[_0xa9a5('0x58')](_0x34c0fb[_0xa9a5('0x61')],{'mixmonitorid':_0x36f1ac[_0xa9a5('0x64')]});if(_0x3f4459){_0x3f4459[_0xa9a5('0x66')]='stop';}})['then'](function(){var _0xd49d8c=util[_0xa9a5('0x5b')]('%s.%s',_0x36f1ac['filename']||_0x36f1ac[_0xa9a5('0x59')],_0x36f1ac[_0xa9a5('0x5b')]||_0xa9a5('0x5c'));var _0x248932=_['find'](_0x34c0fb[_0xa9a5('0x61')],{'filename':_0xa9a5('0x62')+_0xd49d8c['toLowerCase']()});if(_0x248932){_0x248932[_0xa9a5('0x66')]=_0xa9a5('0x6c');}})[_0xa9a5('0x60')](function(){_0x594187({'code':0xc8,'message':[_0x36f1ac[_0xa9a5('0x59')],_0xa9a5('0x6d')]['join']('\x20')});})[_0xa9a5('0x1e')](function(_0x1054ac){_0x2d5f5e(_0x39d29d['error'](0x1f5,[_0x36f1ac['uniqueid'],_0x1054ac[_0xa9a5('0x48')][_0xa9a5('0x63')]()][_0xa9a5('0x16')]('\x20')));});}else{return _0x2d5f5e(_0x39d29d[_0xa9a5('0x13')](0x1f5,_0xa9a5('0x68')));}});},'VoiceQueuesChannels':function(_0x3d6171){return new Promise(function(_0x125a9b,_0x52d0d8){var _0x5f0d3f=_['values'](_0x31e823[_0xa9a5('0x6e')]);_0x125a9b({'count':_0x5f0d3f[_0xa9a5('0x55')],'rows':_0x5f0d3f});});},'VoiceQueuesChannel':function(_0x9e59a4){var _0x4269c4=this;return new Promise(function(_0x113e98,_0x58fc6c){var _0x1a63e6=schema(properties[_0xa9a5('0x6f')])[_0xa9a5('0x3')](_0x9e59a4);if(_0x1a63e6[_0xa9a5('0x55')]>0x0){return _0x58fc6c(_0x4269c4[_0xa9a5('0x13')](0x1f4,_[_0xa9a5('0x57')](_0x1a63e6,_0xa9a5('0x48'))[_0xa9a5('0x16')](',\x20')));}var _0x36eca9=_[_0xa9a5('0x58')](_0x31e823[_0xa9a5('0x6e')],{'uniqueid':_0x9e59a4[_0xa9a5('0x59')]});if(_0x36eca9){_0x113e98(_0x36eca9);}else{return _0x58fc6c(_0x4269c4['error'](0x1f5,_0xa9a5('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x5bf9aa){var _0x8962c5=this;return new Promise(function(_0x1ffd8f,_0x3e7f17){if(ami[_0xa9a5('0x12')]()==![]){return _0x3e7f17(_0x8962c5[_0xa9a5('0x13')](0x1f4,[config[_0xa9a5('0x14')]['ip'],config[_0xa9a5('0x14')][_0xa9a5('0x1c')],_0xa9a5('0x15')]['join']('\x20')));}var _0x35c4f4=schema(properties[_0xa9a5('0x70')])[_0xa9a5('0x3')](_0x5bf9aa);if(_0x35c4f4[_0xa9a5('0x55')]>0x0){return _0x3e7f17(_0x8962c5['error'](0x1f4,_[_0xa9a5('0x57')](_0x35c4f4,_0xa9a5('0x48'))[_0xa9a5('0x16')](',\x20')));}var _0x7d9119=_['find'](_0x31e823[_0xa9a5('0x6e')],{'uniqueid':_0x5bf9aa['uniqueid']});if(_0x7d9119&&_0x7d9119[_0xa9a5('0x5e')]){return ami[_0xa9a5('0x1b')]({'action':_0xa9a5('0x71'),'channel':_0x7d9119[_0xa9a5('0x5e')]})['then'](function(_0x1fef98){_0x1ffd8f({'code':0xc8,'message':[_0x5bf9aa[_0xa9a5('0x59')],_0x1fef98[_0xa9a5('0x48')][_0xa9a5('0x63')]()][_0xa9a5('0x16')]('\x20')});})['catch'](function(_0x16ad36){_0x3e7f17(_0x8962c5[_0xa9a5('0x13')](0x1f5,[_0x5bf9aa[_0xa9a5('0x59')],_0x16ad36[_0xa9a5('0x48')][_0xa9a5('0x63')]()]['join']('\x20')));});}else{return _0x3e7f17(_0x8962c5[_0xa9a5('0x13')](0x1f5,_0xa9a5('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x3b1329){var _0x3b311b=this;return new Promise(function(_0x505513,_0x2cf5e3){if(ami[_0xa9a5('0x12')]()==![]){return _0x2cf5e3(_0x3b311b[_0xa9a5('0x13')](0x1f4,[config[_0xa9a5('0x14')]['ip'],config['asterisk'][_0xa9a5('0x1c')],'ami\x20disconnected'][_0xa9a5('0x16')]('\x20')));}var _0x3980dd=schema(properties['voicequeuechannelredirect'])['validate'](_0x3b1329);if(_0x3980dd['length']>0x0){return _0x2cf5e3(_0x3b311b[_0xa9a5('0x13')](0x1f4,_[_0xa9a5('0x57')](_0x3980dd,_0xa9a5('0x48'))[_0xa9a5('0x16')](',\x20')));}var _0x334974=_[_0xa9a5('0x58')](_0x31e823[_0xa9a5('0x6e')],{'uniqueid':_0x3b1329[_0xa9a5('0x59')]});if(_0x334974&&_0x334974[_0xa9a5('0x5e')]){return ami[_0xa9a5('0x1b')]({'action':_0xa9a5('0x72'),'channel':_0x334974[_0xa9a5('0x5e')],'exten':_0x3b1329[_0xa9a5('0x73')],'context':_0x3b1329[_0xa9a5('0x74')]||_0x334974['context'],'priority':0x1})[_0xa9a5('0x60')](function(_0x1afa16){_0x505513({'code':0xc8,'message':[_0x3b1329[_0xa9a5('0x59')],_0x1afa16[_0xa9a5('0x48')][_0xa9a5('0x63')]()][_0xa9a5('0x16')]('\x20')});})[_0xa9a5('0x1e')](function(_0x5562f9){_0x2cf5e3(_0x3b311b['error'](0x1f5,[_0x3b1329[_0xa9a5('0x59')],_0x5562f9[_0xa9a5('0x48')][_0xa9a5('0x63')]()]['join']('\x20')));});}else{return _0x2cf5e3(_0x3b311b[_0xa9a5('0x13')](0x1f5,_0xa9a5('0x68')));}});},'Agents':function(_0xe5c124){return new Promise(function(_0x1308d8,_0x432f51){var _0x3d2411=_['values'](_0x31e823['agents']);_0x1308d8({'count':_0x3d2411[_0xa9a5('0x55')],'rows':_0x3d2411});});},'Telephones':function(_0x361b8f){return new Promise(function(_0x29f5e8,_0x3766d0){var _0x5df423=_[_0xa9a5('0x75')](_0x31e823[_0xa9a5('0x76')]);_0x29f5e8({'count':_0x5df423[_0xa9a5('0x55')],'rows':_0x5df423});});},'Trunks':function(_0x482722){return new Promise(function(_0x230b26,_0x1fda8e){var _0x33296c=_[_0xa9a5('0x75')](_0x31e823[_0xa9a5('0x77')]);_0x230b26({'count':_0x33296c['length'],'rows':_0x33296c});});},'OutboundChannels':function(_0x38ac6f){return new Promise(function(_0x274ba2,_0x5b5dba){var _0xd6a1c3=_[_0xa9a5('0x75')](_0x31e823[_0xa9a5('0x78')]);_0x274ba2({'count':_0xd6a1c3[_0xa9a5('0x55')],'rows':_0xd6a1c3});});},'Outbound':function(_0x3577af){return new Promise(function(_0x29b55f,_0x59eae1){_0x29b55f(_0x31e823[_0xa9a5('0x2a')]);});},'Campaigns':function(_0x26f9d5){return new Promise(function(_0x5c8f94,_0x3de021){var _0x7e9182=_[_0xa9a5('0x75')](_0x31e823[_0xa9a5('0x79')]);_0x5c8f94({'count':_0x7e9182[_0xa9a5('0x55')],'rows':_0x7e9182});});},'VoiceQueuesPreview':function(_0x26f608){var _0x3126a1=this;return new Promise(function(_0x30f1bd,_0x3ac406){_0x1ae623['run'](_0x26f608['id'])[_0xa9a5('0x60')](function(_0x1e916c){_0x30f1bd({'code':0xc8,'message':_0x1e916c[_0xa9a5('0x48')]});})[_0xa9a5('0x1e')](function(_0xad2ce4){_0x3ac406(_0x3126a1[_0xa9a5('0x13')](0x1f4,_0xad2ce4[_0xa9a5('0x48')]));});});},'EventManager':function(_0x47fe68){var _0x592196=this;return new Promise(function(_0x320e91,_0x591980){if(!_0x47fe68[_0xa9a5('0x7a')]){return _0x591980(_0x592196[_0xa9a5('0x13')](0x1f4,_0xa9a5('0x7b')));}ami[_0xa9a5('0x7c')](_0xa9a5('0x7d')+_0x47fe68[_0xa9a5('0x7a')],_0x47fe68[_0xa9a5('0x48')]);_0x320e91({'code':0xc8,'message':_0x47fe68});});},'FaxAccounts':function(_0xaa10d0){return new Promise(function(_0x48a453,_0xfefd96){var _0x3047e0=_['values'](_0x31e823[_0xa9a5('0x7e')]);_0x48a453({'count':_0x3047e0[_0xa9a5('0x55')],'rows':_0x3047e0});});},'SendFax':function(_0x237e71){var _0x5c3b51=this;return new Promise(function(_0x10f5f5,_0x216565){_0x4a73f4['send'](_0x237e71)[_0xa9a5('0x60')](function(_0x1a3d58){_0x10f5f5({'code':0xc8,'message':_0x1a3d58[_0xa9a5('0x48')]});})[_0xa9a5('0x1e')](function(_0x5b2996){_0x216565(_0x5c3b51[_0xa9a5('0x13')](0x1f4,_0x5b2996['message']));});});},'CheckAfterSend':function(_0xf42ff1){var _0x2cfbd5=this;return new Promise(function(_0x2d796b,_0x263599){_0x4a73f4[_0xa9a5('0x7f')](_0xf42ff1)[_0xa9a5('0x60')](function(_0x543ed9){_0x2d796b({'code':0xc8,'message':_0x543ed9[_0xa9a5('0x48')]});})[_0xa9a5('0x1e')](function(_0x30cc0a){_0x263599(_0x2cfbd5[_0xa9a5('0x13')](0x1f4,_0x30cc0a['message']));});});}};var _0x3a84ff=jayson[_0xa9a5('0x80')](_0x20bbe8)['http']();_0x3a84ff['on'](_0xa9a5('0x13'),function(_0x57f5d9){return _0x37e93b(_0x57f5d9);});_0x3a84ff[_0xa9a5('0x8')](0x232a,_0xa9a5('0x81'),function(){console[_0xa9a5('0x82')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0xb0ccd9(_0xa9a5('0x83')+0x232a);});});}; \ No newline at end of file +var _0x2aa3=['../ami','listen','format','SIP','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','catch','command','Command','content','voiceQueues','hasOwnProperty','name','strategy','available','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','omit','undefined','values','channels','voicechannel','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','find','toLowerCase','/var/spool/asterisk/monitor/','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','monitors','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','Redirect','exten','context','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x2aa3,0x83));var _0x32aa=function(_0x186b0f,_0x39f3ff){_0x186b0f=_0x186b0f-0x0;var _0x11de1e=_0x2aa3[_0x186b0f];return _0x11de1e;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var jayson=require(_0x32aa('0x2'));var schema=require(_0x32aa('0x3'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x32aa('0x4'));var properties=require(_0x32aa('0x5'));var ami=require(_0x32aa('0x6'));exports[_0x32aa('0x7')]=function(_0x22e989,_0x3d7c94,_0x53ab98){return new BPromise(function(_0x17346a,_0x112396){var _0x3ee18a={'QueuePause':function(_0x20efbe){return new Promise(function(_0x18ded0,_0x40c96a){var _0x2fe991=util[_0x32aa('0x8')]('%s/%s',_0x32aa('0x9'),_0x20efbe['name']);if(_0x22e989[_0x32aa('0xa')]&&_0x22e989[_0x32aa('0xa')][_0x2fe991]&&_0x22e989[_0x32aa('0xa')][_0x2fe991][_0x32aa('0xb')]){_0x22e989['timers'][_0x2fe991][_0x32aa('0xc')]();}if(_0x22e989[_0x32aa('0xd')][_0x2fe991]){_0x22e989[_0x32aa('0xd')][_0x2fe991]['updateStatusRealtime']({'statePause':_0x20efbe[_0x32aa('0xe')]?!![]:![]});}_0x18ded0({'code':0xc8,'message':_0x32aa('0xf')});});},'Reload':function(_0x3640f9){var _0x22c07a=this;return new Promise(function(_0x2329c3,_0x6f6888){if(ami[_0x32aa('0x10')]()==![]){return _0x6f6888(_0x22c07a[_0x32aa('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x32aa('0x12')][_0x32aa('0x13')],_0x32aa('0x14')][_0x32aa('0x15')]('\x20')));}_0x3640f9=_[_0x32aa('0x16')](_0x3640f9,_['keys'](properties[_0x32aa('0x17')]));_0x3640f9[_0x32aa('0x18')]=_0x32aa('0x19');return ami[_0x32aa('0x1a')](_0x3640f9)[_0x32aa('0x1b')](function(_0x4f2a1a){_0x2329c3({'code':0xc8,'message':_0x4f2a1a['message']});})[_0x32aa('0x1c')](function(_0x34dcaf){_0x6f6888(_0x22c07a[_0x32aa('0x11')](0x1f5,_0x34dcaf['message']));});});},'Command':function(_0x5b48ee){var _0x1a0262=this;return new Promise(function(_0x148255,_0x1d7490){if(ami[_0x32aa('0x10')]()==![]){return _0x1d7490(_0x1a0262[_0x32aa('0x11')](0x1f4,[config[_0x32aa('0x12')]['ip'],config['asterisk'][_0x32aa('0x13')],_0x32aa('0x14')][_0x32aa('0x15')]('\x20')));}_0x5b48ee=_[_0x32aa('0x16')](_0x5b48ee,_0x32aa('0x1d'));_0x5b48ee[_0x32aa('0x18')]=_0x32aa('0x1e');return ami[_0x32aa('0x1a')](_0x5b48ee)[_0x32aa('0x1b')](function(_0x53c65a){_0x148255({'code':0xc8,'message':_0x53c65a[_0x32aa('0x1f')]});})['catch'](function(_0x6766da){_0x1d7490(_0x1a0262[_0x32aa('0x11')](0x1f5,_0x6766da['message']));});});},'VoiceQueues':function(_0x5870c4){return new Promise(function(_0x166f75,_0x313930){var _0x3ba6b2=[];for(var _0x13d610 in _0x22e989[_0x32aa('0x20')]){if(_0x22e989[_0x32aa('0x20')][_0x32aa('0x21')](_0x13d610)){var _0x405b03=_0x22e989[_0x32aa('0x20')][_0x13d610];var _0x5750e2={'id':_0x405b03['id'],'name':_0x405b03[_0x32aa('0x22')],'strategy':_0x405b03[_0x32aa('0x23')],'answered':_0x405b03['answered'],'available':_0x405b03[_0x32aa('0x24')],'loggedIn':_0x405b03['loggedIn'],'pTalking':_0x405b03['pTalking'],'sumBillable':_0x405b03[_0x32aa('0x25')],'sumDuration':_0x405b03[_0x32aa('0x26')],'sumHoldTime':_0x405b03[_0x32aa('0x27')]||0x0,'talking':_0x405b03[_0x32aa('0x28')],'total':_0x405b03['total'],'type':_0x405b03[_0x32aa('0x29')],'unmanaged':_0x405b03[_0x32aa('0x2a')],'abandoned':_0x405b03[_0x32aa('0x2b')],'waiting':_0x405b03[_0x32aa('0x2c')],'loggedInDb':_0x405b03[_0x32aa('0x2d')]};if(_0x405b03[_0x32aa('0x29')]==='outbound'){_0x5750e2['dialActive']=_0x405b03[_0x32aa('0x2e')];_0x5750e2[_0x32aa('0x2f')]=_0x405b03[_0x32aa('0x2f')];_0x5750e2[_0x32aa('0x30')]=_0x405b03['dialOriginateCallerIdName'];_0x5750e2['dialOriginateCallerIdNumber']=_0x405b03[_0x32aa('0x31')];_0x5750e2['dialOriginateTimeout']=_0x405b03[_0x32aa('0x32')];_0x5750e2[_0x32aa('0x33')]=_0x405b03['dialPrefix'];_0x5750e2[_0x32aa('0x34')]=_0x405b03[_0x32aa('0x34')];_0x5750e2['outboundAnswerAgiCallsDay']=_0x405b03[_0x32aa('0x35')];_0x5750e2[_0x32aa('0x36')]=_0x405b03[_0x32aa('0x36')];_0x5750e2[_0x32aa('0x37')]=_0x405b03[_0x32aa('0x37')];_0x5750e2[_0x32aa('0x38')]=_0x405b03[_0x32aa('0x38')];_0x5750e2[_0x32aa('0x39')]=_0x405b03[_0x32aa('0x39')];_0x5750e2[_0x32aa('0x3a')]=_0x405b03[_0x32aa('0x3a')];_0x5750e2[_0x32aa('0x3b')]=_0x405b03[_0x32aa('0x3b')];_0x5750e2[_0x32aa('0x3c')]=_0x405b03['outboundDropCallsDayTimeout'];_0x5750e2[_0x32aa('0x3d')]=_0x405b03[_0x32aa('0x3d')];_0x5750e2[_0x32aa('0x3e')]=_0x405b03[_0x32aa('0x3e')];_0x5750e2[_0x32aa('0x3f')]=_0x405b03['outboundOriginateFailureCallsDay'];_0x5750e2[_0x32aa('0x40')]=_0x405b03[_0x32aa('0x40')];_0x5750e2[_0x32aa('0x41')]=_0x405b03[_0x32aa('0x41')];_0x5750e2[_0x32aa('0x42')]=_0x405b03[_0x32aa('0x42')];_0x5750e2[_0x32aa('0x43')]=_0x405b03[_0x32aa('0x43')];_0x5750e2[_0x32aa('0x44')]=_0x405b03[_0x32aa('0x44')];_0x5750e2[_0x32aa('0x45')]=_0x405b03['predictiveIntervalAvgTalktime'];_0x5750e2['predictiveIntervalDroppedCallsCallersExit']=_0x405b03[_0x32aa('0x46')];_0x5750e2[_0x32aa('0x47')]=_0x405b03[_0x32aa('0x47')];_0x5750e2[_0x32aa('0x48')]=_0x405b03[_0x32aa('0x48')];_0x5750e2[_0x32aa('0x49')]=_0x405b03[_0x32aa('0x49')];_0x5750e2['predictiveIntervalHitRate']=_0x405b03[_0x32aa('0x4a')];_0x5750e2[_0x32aa('0x4b')]=_0x405b03[_0x32aa('0x4b')];_0x5750e2[_0x32aa('0x4c')]=_0x405b03['predictiveIntervalPauses'];_0x5750e2[_0x32aa('0x4d')]=_0x405b03['predictiveIntervalAvailable'];_0x5750e2[_0x32aa('0x4e')]=_0x405b03[_0x32aa('0x4e')];_0x5750e2[_0x32aa('0x4f')]=_0x405b03[_0x32aa('0x4f')];_0x5750e2[_0x32aa('0x50')]=_0x405b03['originated'];_0x5750e2[_0x32aa('0x51')]=_0x405b03[_0x32aa('0x51')];_0x5750e2[_0x32aa('0x52')]=_0x405b03[_0x32aa('0x52')];_0x5750e2['erlangAbandonmentRate']=_0x405b03[_0x32aa('0x53')];_0x5750e2['erlangBusyFactor']=_0x405b03[_0x32aa('0x54')];_0x5750e2[_0x32aa('0x55')]=_0x405b03['startPredictive'];_0x5750e2[_0x32aa('0x56')]=_0x405b03[_0x32aa('0x56')];}if(_0x405b03[_0x32aa('0x57')]){_0x5750e2[_0x32aa('0x57')]={'id':_0x405b03[_0x32aa('0x57')]['id'],'name':_0x405b03[_0x32aa('0x57')][_0x32aa('0x22')],'active':_0x405b03[_0x32aa('0x57')]['active'],'callerid':_0x405b03['Trunk'][_0x32aa('0x58')]};}if(_0x405b03[_0x32aa('0x59')]){_0x5750e2[_0x32aa('0x59')]={'id':_0x405b03[_0x32aa('0x59')]['id'],'name':_0x405b03[_0x32aa('0x59')]['name']};}_0x3ba6b2[_0x32aa('0x5a')](_0x5750e2);}}_0x166f75({'count':_0x3ba6b2[_0x32aa('0x5b')],'rows':_0x3ba6b2});});},'UpdateVoiceQueue':function(_0x2a09f8){return new Promise(function(_0x530b16,_0x2d6217){var _0x52c41b=_['find'](_0x22e989[_0x32aa('0x20')],{'id':parseInt(_0x2a09f8['id'])});var _0x3907fe=_[_0x32aa('0x5c')](_0x2a09f8,['id']);if(_0x52c41b){for(var _0x52accc in _0x3907fe){if(typeof _0x3907fe[_0x52accc]!=='undefined'&&typeof _0x52c41b[_0x52accc]!==_0x32aa('0x5d')){_0x52c41b[_0x52accc]=_0x3907fe[_0x52accc];}}_0x530b16(_0x52c41b);}else{_0x2d6217();}});},'VoiceChannels':function(_0x247ad5){return new Promise(function(_0x548ae1,_0x40b1fe){var _0x10078d=_[_0x32aa('0x5e')](_0x22e989[_0x32aa('0x5f')]);_0x548ae1({'count':_0x10078d[_0x32aa('0x5b')],'rows':_0x10078d});});},'VoiceChannelMixMonitor':function(_0x3076af){var _0x43c997=this;return new Promise(function(_0x20b399,_0x1fa155){if(ami[_0x32aa('0x10')]()==![]){return _0x1fa155(_0x43c997[_0x32aa('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x32aa('0x13')],_0x32aa('0x14')][_0x32aa('0x15')]('\x20')));}var _0x3b4bf8=schema(properties[_0x32aa('0x60')])[_0x32aa('0x3')](_0x3076af);if(_0x3b4bf8[_0x32aa('0x5b')]>0x0){return _0x1fa155(_0x43c997[_0x32aa('0x11')](0x1f4,_['map'](_0x3b4bf8,'message')[_0x32aa('0x15')](',\x20')));}var _0x4cb9ef=_['find'](_0x22e989[_0x32aa('0x5f')],{'uniqueid':_0x3076af[_0x32aa('0x61')]});if(_0x4cb9ef&&_0x4cb9ef[_0x32aa('0x62')]){var _0x2109aa=util[_0x32aa('0x8')](_0x32aa('0x63'),_0x3076af['filename']||_0x3076af[_0x32aa('0x61')],_0x3076af['format']||_0x32aa('0x64'));return ami[_0x32aa('0x1a')]({'action':_0x32aa('0x65'),'channel':_0x4cb9ef[_0x32aa('0x62')],'file':_0x2109aa,'options':_0x32aa('0x66')})[_0x32aa('0x1b')](function(_0x28b7f5){var _0x5b9932=_[_0x32aa('0x67')](_0x4cb9ef['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x2109aa[_0x32aa('0x68')]()});if(_['isNil'](_0x5b9932)){_0x4cb9ef['monitors'][_0x32aa('0x5a')]({'filename':_0x32aa('0x69')+_0x2109aa[_0x32aa('0x68')](),'createdAt':moment()[_0x32aa('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x28b7f5['mixmonitorid'],'status':'rec'});}else{_0x5b9932[_0x32aa('0x6a')]=_0x28b7f5[_0x32aa('0x6a')];_0x5b9932['status']=_0x32aa('0x6b');}_0x20b399({'code':0xc8,'message':[_0x3076af[_0x32aa('0x61')],_0x32aa('0x6c'),_0x28b7f5[_0x32aa('0x6a')]][_0x32aa('0x15')]('\x20'),'mixmonitorid':_0x28b7f5[_0x32aa('0x6a')]});})[_0x32aa('0x1c')](function(_0x26555a){_0x1fa155(_0x43c997[_0x32aa('0x11')](0x1f5,[_0x3076af['uniqueid'],_0x26555a[_0x32aa('0x4f')]['toLowerCase']()][_0x32aa('0x15')]('\x20')));});}else{return _0x1fa155(_0x43c997['error'](0x1f5,_0x32aa('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x5408ff){var _0x191bf5=this;return new Promise(function(_0x3e3277,_0x174436){if(ami[_0x32aa('0x10')]()==![]){return _0x174436(_0x191bf5[_0x32aa('0x11')](0x1f4,[config[_0x32aa('0x12')]['ip'],config['asterisk'][_0x32aa('0x13')],_0x32aa('0x14')][_0x32aa('0x15')]('\x20')));}var _0x1c175a=schema(properties['voicechannel'])['validate'](_0x5408ff);if(_0x1c175a[_0x32aa('0x5b')]>0x0){return _0x174436(_0x191bf5['error'](0x1f4,_[_0x32aa('0x6e')](_0x1c175a,_0x32aa('0x4f'))[_0x32aa('0x15')](',\x20')));}var _0x34615a=_[_0x32aa('0x67')](_0x22e989[_0x32aa('0x5f')],{'uniqueid':_0x5408ff[_0x32aa('0x61')]});if(_0x34615a){return BPromise[_0x32aa('0x6f')]()[_0x32aa('0x1b')](function(){if(_0x34615a['channel']){return ami[_0x32aa('0x1a')]({'action':_0x32aa('0x70'),'channel':_0x34615a[_0x32aa('0x62')],'mixmonitorid':_0x5408ff[_0x32aa('0x6a')]})[_0x32aa('0x1c')](function(_0x4aeeae){});}})[_0x32aa('0x1b')](function(){if(_0x34615a['destinationchannel']){return ami[_0x32aa('0x1a')]({'action':'StopMixMonitor','channel':_0x34615a['destinationchannel'],'mixmonitorid':_0x5408ff[_0x32aa('0x6a')]})[_0x32aa('0x1c')](function(_0x2228b3){});}})[_0x32aa('0x1b')](function(_0x382d99){var _0x2b3d4b=_[_0x32aa('0x67')](_0x34615a[_0x32aa('0x71')],{'mixmonitorid':_0x5408ff[_0x32aa('0x6a')]});if(_0x2b3d4b){_0x2b3d4b['status']='stop';}})[_0x32aa('0x1b')](function(){var _0x7b673f=util[_0x32aa('0x8')]('%s.%s',_0x5408ff['filename']||_0x5408ff[_0x32aa('0x61')],_0x5408ff[_0x32aa('0x8')]||_0x32aa('0x64'));var _0x288ab0=_[_0x32aa('0x67')](_0x34615a[_0x32aa('0x71')],{'filename':'/var/spool/asterisk/monitor/'+_0x7b673f[_0x32aa('0x68')]()});if(_0x288ab0){_0x288ab0[_0x32aa('0x72')]=_0x32aa('0x73');}})[_0x32aa('0x1b')](function(){_0x3e3277({'code':0xc8,'message':[_0x5408ff[_0x32aa('0x61')],_0x32aa('0x74')][_0x32aa('0x15')]('\x20')});})[_0x32aa('0x1c')](function(_0x262b35){_0x174436(_0x191bf5[_0x32aa('0x11')](0x1f5,[_0x5408ff[_0x32aa('0x61')],_0x262b35[_0x32aa('0x4f')][_0x32aa('0x68')]()][_0x32aa('0x15')]('\x20')));});}else{return _0x174436(_0x191bf5[_0x32aa('0x11')](0x1f5,_0x32aa('0x6d')));}});},'VoiceQueuesChannels':function(_0x2eff17){return new Promise(function(_0x42a24e,_0x31b072){var _0x412255=_[_0x32aa('0x5e')](_0x22e989[_0x32aa('0x75')]);_0x42a24e({'count':_0x412255[_0x32aa('0x5b')],'rows':_0x412255});});},'VoiceQueuesChannel':function(_0x193952){var _0x3c4156=this;return new Promise(function(_0x30569d,_0x3225fb){var _0x5230cc=schema(properties[_0x32aa('0x76')])[_0x32aa('0x3')](_0x193952);if(_0x5230cc['length']>0x0){return _0x3225fb(_0x3c4156[_0x32aa('0x11')](0x1f4,_[_0x32aa('0x6e')](_0x5230cc,_0x32aa('0x4f'))['join'](',\x20')));}var _0x4ccab1=_[_0x32aa('0x67')](_0x22e989[_0x32aa('0x75')],{'uniqueid':_0x193952[_0x32aa('0x61')]});if(_0x4ccab1){_0x30569d(_0x4ccab1);}else{return _0x3225fb(_0x3c4156[_0x32aa('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4435bc){var _0x45b9ec=this;return new Promise(function(_0x27f942,_0x1fa53f){if(ami[_0x32aa('0x10')]()==![]){return _0x1fa53f(_0x45b9ec[_0x32aa('0x11')](0x1f4,[config[_0x32aa('0x12')]['ip'],config[_0x32aa('0x12')][_0x32aa('0x13')],_0x32aa('0x14')]['join']('\x20')));}var _0x5561f1=schema(properties['voicequeuechannelhangup'])['validate'](_0x4435bc);if(_0x5561f1[_0x32aa('0x5b')]>0x0){return _0x1fa53f(_0x45b9ec[_0x32aa('0x11')](0x1f4,_[_0x32aa('0x6e')](_0x5561f1,'message')[_0x32aa('0x15')](',\x20')));}var _0xf4d83=_[_0x32aa('0x67')](_0x22e989[_0x32aa('0x75')],{'uniqueid':_0x4435bc[_0x32aa('0x61')]});if(_0xf4d83&&_0xf4d83[_0x32aa('0x62')]){return ami[_0x32aa('0x1a')]({'action':_0x32aa('0x77'),'channel':_0xf4d83[_0x32aa('0x62')]})[_0x32aa('0x1b')](function(_0x46b1a3){_0x27f942({'code':0xc8,'message':[_0x4435bc[_0x32aa('0x61')],_0x46b1a3[_0x32aa('0x4f')]['toLowerCase']()][_0x32aa('0x15')]('\x20')});})[_0x32aa('0x1c')](function(_0x1da86b){_0x1fa53f(_0x45b9ec[_0x32aa('0x11')](0x1f5,[_0x4435bc[_0x32aa('0x61')],_0x1da86b[_0x32aa('0x4f')][_0x32aa('0x68')]()]['join']('\x20')));});}else{return _0x1fa53f(_0x45b9ec[_0x32aa('0x11')](0x1f5,_0x32aa('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x56200){var _0x28ba7d=this;return new Promise(function(_0x5d498b,_0xfbac6e){if(ami[_0x32aa('0x10')]()==![]){return _0xfbac6e(_0x28ba7d[_0x32aa('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x32aa('0x12')]['username'],_0x32aa('0x14')][_0x32aa('0x15')]('\x20')));}var _0x55cc49=schema(properties['voicequeuechannelredirect'])[_0x32aa('0x3')](_0x56200);if(_0x55cc49['length']>0x0){return _0xfbac6e(_0x28ba7d[_0x32aa('0x11')](0x1f4,_['map'](_0x55cc49,_0x32aa('0x4f'))[_0x32aa('0x15')](',\x20')));}var _0x5de9c2=_[_0x32aa('0x67')](_0x22e989[_0x32aa('0x75')],{'uniqueid':_0x56200[_0x32aa('0x61')]});if(_0x5de9c2&&_0x5de9c2['channel']){return ami['Action']({'action':_0x32aa('0x78'),'channel':_0x5de9c2[_0x32aa('0x62')],'exten':_0x56200[_0x32aa('0x79')],'context':_0x56200['context']||_0x5de9c2[_0x32aa('0x7a')],'priority':0x1})[_0x32aa('0x1b')](function(_0xf1ebc4){_0x5d498b({'code':0xc8,'message':[_0x56200[_0x32aa('0x61')],_0xf1ebc4['message'][_0x32aa('0x68')]()]['join']('\x20')});})['catch'](function(_0x293ce2){_0xfbac6e(_0x28ba7d['error'](0x1f5,[_0x56200['uniqueid'],_0x293ce2[_0x32aa('0x4f')][_0x32aa('0x68')]()][_0x32aa('0x15')]('\x20')));});}else{return _0xfbac6e(_0x28ba7d[_0x32aa('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x25e24b){return new Promise(function(_0x479e3c,_0x2c0494){var _0x524e9d=_[_0x32aa('0x5e')](_0x22e989[_0x32aa('0xd')]);_0x479e3c({'count':_0x524e9d[_0x32aa('0x5b')],'rows':_0x524e9d});});},'Telephones':function(_0x1612b1){return new Promise(function(_0x313599,_0x304718){var _0x19a8de=_[_0x32aa('0x5e')](_0x22e989['telephones']);_0x313599({'count':_0x19a8de[_0x32aa('0x5b')],'rows':_0x19a8de});});},'Trunks':function(_0x4a6904){return new Promise(function(_0x42fc81,_0x2c03f3){var _0x59d6b7=_[_0x32aa('0x5e')](_0x22e989[_0x32aa('0x7b')]);_0x42fc81({'count':_0x59d6b7['length'],'rows':_0x59d6b7});});},'OutboundChannels':function(_0x920c75){return new Promise(function(_0x29ffe4,_0x546016){var _0x4a989b=_[_0x32aa('0x5e')](_0x22e989[_0x32aa('0x7c')]);_0x29ffe4({'count':_0x4a989b['length'],'rows':_0x4a989b});});},'Outbound':function(_0xc026c7){return new Promise(function(_0x3dba66,_0xbeed03){_0x3dba66(_0x22e989[_0x32aa('0x7d')]);});},'Campaigns':function(_0x170050){return new Promise(function(_0x254dc2,_0x582c57){var _0x1047d0=_[_0x32aa('0x5e')](_0x22e989[_0x32aa('0x7e')]);_0x254dc2({'count':_0x1047d0[_0x32aa('0x5b')],'rows':_0x1047d0});});},'VoiceQueuesPreview':function(_0x6f437a){var _0x2ba3e4=this;return new Promise(function(_0x11f77b,_0xe5cf5e){_0x3d7c94[_0x32aa('0x7f')](_0x6f437a['id'])[_0x32aa('0x1b')](function(_0x1cb1e1){_0x11f77b({'code':0xc8,'message':_0x1cb1e1[_0x32aa('0x4f')]});})['catch'](function(_0x68cd11){_0xe5cf5e(_0x2ba3e4[_0x32aa('0x11')](0x1f4,_0x68cd11['message']));});});},'EventManager':function(_0xd5ec93){var _0xededbd=this;return new Promise(function(_0x555602,_0x2e9f83){if(!_0xd5ec93[_0x32aa('0x80')]){return _0x2e9f83(_0xededbd[_0x32aa('0x11')](0x1f4,_0x32aa('0x81')));}ami[_0x32aa('0x82')]('custom:'+_0xd5ec93[_0x32aa('0x80')],_0xd5ec93[_0x32aa('0x4f')]);_0x555602({'code':0xc8,'message':_0xd5ec93});});},'FaxAccounts':function(_0x3f2dd3){return new Promise(function(_0x50df7c,_0x375352){var _0x5a47a9=_[_0x32aa('0x5e')](_0x22e989[_0x32aa('0x83')]);_0x50df7c({'count':_0x5a47a9['length'],'rows':_0x5a47a9});});},'SendFax':function(_0xe813d6){var _0x52c824=this;return new Promise(function(_0x1e04c9,_0x50e35a){_0x53ab98[_0x32aa('0x84')](_0xe813d6)[_0x32aa('0x1b')](function(_0xaaaba3){_0x1e04c9({'code':0xc8,'message':_0xaaaba3['message']});})['catch'](function(_0x4b295e){_0x50e35a(_0x52c824[_0x32aa('0x11')](0x1f4,_0x4b295e[_0x32aa('0x4f')]));});});},'CheckAfterSend':function(_0x3af169){var _0x5c5af0=this;return new Promise(function(_0x32b15e,_0xe73568){_0x53ab98['checkAfterSend'](_0x3af169)[_0x32aa('0x1b')](function(_0x210155){_0x32b15e({'code':0xc8,'message':_0x210155[_0x32aa('0x4f')]});})[_0x32aa('0x1c')](function(_0x44265b){_0xe73568(_0x5c5af0[_0x32aa('0x11')](0x1f4,_0x44265b['message']));});});}};var _0x567d51=jayson[_0x32aa('0x85')](_0x3ee18a)['http']();_0x567d51['on'](_0x32aa('0x11'),function(_0xb5772d){return _0x112396(_0xb5772d);});_0x567d51[_0x32aa('0x7')](0x232a,_0x32aa('0x86'),function(){console[_0x32aa('0x87')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x17346a(_0x32aa('0x88')+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 f534afb..b52d157 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 _0x4c4e=['getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','scheduledAt','updatedAt','union','resolve','then'];(function(_0x303947,_0x3bf10b){var _0x3f5fc3=function(_0x4a3aab){while(--_0x4a3aab){_0x303947['push'](_0x303947['shift']());}};_0x3f5fc3(++_0x3bf10b);}(_0x4c4e,0x152));var _0xe4c4=function(_0x57cca5,_0x2efbc5){_0x57cca5=_0x57cca5-0x0;var _0x39904f=_0x4c4e[_0x57cca5];return _0x39904f;};'use strict';var _=require(_0xe4c4('0x0'));var BPromise=require('bluebird');var Redis=require(_0xe4c4('0x1'));var util=require(_0xe4c4('0x2'));var config=require(_0xe4c4('0x3'));var logger=require('../../../../config/logger')(_0xe4c4('0x4'));var cmContactRpc=require(_0xe4c4('0x5'));config[_0xe4c4('0x6')]=_['defaults'](config[_0xe4c4('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xe4c4('0x7'))(new Redis(config[_0xe4c4('0x6')]));function emit(_0x262b64,_0xad105,_0x22085a,_0x329d29,_0x28a42e){logger[_0xe4c4('0x8')]('[CM][%s][%s]',_0x262b64,_0xad105['id'],_0x22085a,_0x329d29,JSON['stringify'](_0x28a42e));io['to'](_0x22085a)[_0xe4c4('0x9')](_0x329d29,_0x28a42e);}exports[_0xe4c4('0xa')]=function(_0x27ad42,_0x1bc786,_0x333c08,_0x2f4d5f){var _0x50264f,_0x303d89;var _0x293282={};var _0x3805c5=Number(_0x333c08[_0xe4c4('0xb')]);var _0x50bfab=_0x333c08[_0xe4c4('0xc')]?Boolean(Number(_0x333c08[_0xe4c4('0xc')])):![];var _0x515056;var _0xe485ca=![];if(!_[_0xe4c4('0xd')](_0x333c08['data5'])){if(_0x333c08[_0xe4c4('0xe')]=='1')_0xe485ca=!![];}if(!_0xe485ca){if(_0x2f4d5f[_0xe4c4('0xf')]){_0x293282['id']=_0x2f4d5f['xmd-contactid'];}}if(!_0x293282['id']){_0x293282[_0xe4c4('0x10')]=_0x3805c5;_0x515056=_0x333c08[_0xe4c4('0x11')]&&_0x333c08[_0xe4c4('0x11')]!=='0'?_0x333c08[_0xe4c4('0x11')][_0xe4c4('0x12')](','):[_0xe4c4('0x13')];_0x293282[_0xe4c4('0x14')]=_[_0xe4c4('0x15')](_0x515056,function(_0x34ecbe){var _0x36b10c={};_0x36b10c[_0x34ecbe]=_0x2f4d5f[_0xe4c4('0x16')]?_0x2f4d5f[_0xe4c4('0x17')]:_0x2f4d5f[_0xe4c4('0x18')];return _0x36b10c;});}var _0x43a9ce=['id',_0xe4c4('0x19'),'lastName',_0xe4c4('0x13'),_0xe4c4('0x1a'),_0xe4c4('0x1b'),_0xe4c4('0x10'),'createdAt',_0xe4c4('0x1c'),_0xe4c4('0x1d')];var _0x1727eb=_[_0xe4c4('0x1e')](_0x43a9ce,_0x515056);BPromise[_0xe4c4('0x1f')]()[_0xe4c4('0x20')](cmContactRpc[_0xe4c4('0x21')]({'attributes':_0x1727eb,'where':_0x293282}))[_0xe4c4('0x20')](function(_0x21bbb1){_0x303d89=_0x21bbb1;if(!_[_0xe4c4('0x22')](_0x303d89)){if(_0x303d89[_0xe4c4('0x23')]===0x1){_0x50264f=_0x303d89[0x0];logger[_0xe4c4('0x8')](_0xe4c4('0x24'),_0x2f4d5f[_0xe4c4('0x25')],_0x1bc786['id'],_0x50264f['id']);}else{logger[_0xe4c4('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2f4d5f['uniqueid'],_0x1bc786['id'],_[_0xe4c4('0x15')](_0x303d89,'id')['join'](','));}return;}else{logger[_0xe4c4('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2f4d5f[_0xe4c4('0x25')],_0x1bc786['id']);var _0x5efc4c={'ListId':_0x3805c5};var _0x34d667=_0x333c08['data4']&&_0x333c08[_0xe4c4('0x26')]!=='0'?_0x333c08['data4']:'phone';if(_0x50bfab){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2f4d5f[_0xe4c4('0x25')],_0x1bc786['id']);_0x5efc4c[_0x34d667]=_['isNil'](_0x2f4d5f['routeId'])?_0x2f4d5f[_0xe4c4('0x18')]:_0x2f4d5f[_0xe4c4('0x17')];if(_['isNil'](_0x2f4d5f['routeId'])){_0x5efc4c[_0xe4c4('0x19')]=_0x2f4d5f[_0xe4c4('0x27')]&&_0x2f4d5f['calleridname']!==_0xe4c4('0x28')?_0x2f4d5f[_0xe4c4('0x27')]:_0xe4c4('0x29');}else{_0x5efc4c['firstName']=_0x2f4d5f['destcalleridname']&&_0x2f4d5f[_0xe4c4('0x2a')]!==_0xe4c4('0x28')?_0x2f4d5f[_0xe4c4('0x2a')]:_0xe4c4('0x29');}return BPromise['resolve']()['then'](cmContactRpc[_0xe4c4('0x2b')](_0x5efc4c))[_0xe4c4('0x20')](function(_0x5d0ba5){_0x50264f=_0x5d0ba5;_0x303d89[_0xe4c4('0x2c')](_0x5d0ba5);if(_0x50264f){logger[_0xe4c4('0x8')](_0xe4c4('0x2d'),_0x2f4d5f['uniqueid'],_0x1bc786['id'],_0x50264f['id']);}return;});}else{logger[_0xe4c4('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2f4d5f[_0xe4c4('0x25')],_0x1bc786['id']);_0x5efc4c[_0x34d667]=_[_0xe4c4('0xd')](_0x2f4d5f[_0xe4c4('0x16')])?_0x2f4d5f[_0xe4c4('0x18')]:_0x2f4d5f[_0xe4c4('0x17')];if(_[_0xe4c4('0xd')](_0x2f4d5f[_0xe4c4('0x16')])){_0x5efc4c[_0xe4c4('0x19')]=_0x2f4d5f[_0xe4c4('0x27')]&&_0x2f4d5f[_0xe4c4('0x27')]!==_0xe4c4('0x28')?_0x2f4d5f[_0xe4c4('0x27')]:'Unknown';}else{_0x5efc4c[_0xe4c4('0x19')]=_0x2f4d5f[_0xe4c4('0x2a')]&&_0x2f4d5f[_0xe4c4('0x2a')]!==''?_0x2f4d5f[_0xe4c4('0x2a')]:_0xe4c4('0x29');}_0x50264f=_0x5efc4c;_0x303d89[_0xe4c4('0x2c')](_0x5efc4c);return;}}})['then'](function(){if(_0x27ad42){emit(_0x2f4d5f[_0xe4c4('0x25')],_0x1bc786,util[_0xe4c4('0x2e')](_0xe4c4('0x2f'),_0x27ad42[_0xe4c4('0x30')]),util[_0xe4c4('0x2e')](_0xe4c4('0x31'),_0x333c08[_0xe4c4('0x32')][_0xe4c4('0x33')]()),{'evt':_[_0xe4c4('0x34')](_0x2f4d5f,{'autoCreate':_0x50bfab}),'contact':_0x50264f===undefined?{}:_0x50264f,'contacts':_0x303d89[_0xe4c4('0x23')]===0x0?undefined:_0x303d89});}});}; \ No newline at end of file +var _0xa8a8=['resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','routeId','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','updatedAt','union'];(function(_0x28348f,_0x28ddfc){var _0x4ecf2e=function(_0x20e98c){while(--_0x20e98c){_0x28348f['push'](_0x28348f['shift']());}};_0x4ecf2e(++_0x28ddfc);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4e1639,_0x211f46){_0x4e1639=_0x4e1639-0x0;var _0x37bd72=_0xa8a8[_0x4e1639];return _0x37bd72;};'use strict';var _=require(_0x8a8a('0x0'));var BPromise=require(_0x8a8a('0x1'));var Redis=require(_0x8a8a('0x2'));var util=require(_0x8a8a('0x3'));var config=require('../../../../config/environment');var logger=require(_0x8a8a('0x4'))(_0x8a8a('0x5'));var cmContactRpc=require(_0x8a8a('0x6'));config[_0x8a8a('0x7')]=_[_0x8a8a('0x8')](config[_0x8a8a('0x7')],{'host':_0x8a8a('0x9'),'port':0x18eb});var io=require(_0x8a8a('0xa'))(new Redis(config[_0x8a8a('0x7')]));function emit(_0x315fe9,_0x1d7121,_0x8e7aa0,_0x4225b9,_0xecaa6f){logger[_0x8a8a('0xb')]('[CM][%s][%s]',_0x315fe9,_0x1d7121['id'],_0x8e7aa0,_0x4225b9,JSON['stringify'](_0xecaa6f));io['to'](_0x8e7aa0)[_0x8a8a('0xc')](_0x4225b9,_0xecaa6f);}exports['exec']=function(_0x11788d,_0x3d3a00,_0x532621,_0x118380){var _0x76b586,_0xb13fca;var _0x5e448d={};var _0x679da2=Number(_0x532621[_0x8a8a('0xd')]);var _0x330796=_0x532621[_0x8a8a('0xe')]?Boolean(Number(_0x532621['data2'])):![];var _0x23febf;var _0x4e5d74=![];if(!_[_0x8a8a('0xf')](_0x532621[_0x8a8a('0x10')])){if(_0x532621[_0x8a8a('0x10')]=='1')_0x4e5d74=!![];}if(!_0x4e5d74){if(_0x118380[_0x8a8a('0x11')]){_0x5e448d['id']=_0x118380[_0x8a8a('0x11')];}}if(!_0x5e448d['id']){_0x5e448d[_0x8a8a('0x12')]=_0x679da2;_0x23febf=_0x532621[_0x8a8a('0x13')]&&_0x532621['data3']!=='0'?_0x532621[_0x8a8a('0x13')]['split'](','):[_0x8a8a('0x14')];_0x5e448d[_0x8a8a('0x15')]=_[_0x8a8a('0x16')](_0x23febf,function(_0x4291e9){var _0x42e8b6={};_0x42e8b6[_0x4291e9]=_0x118380['routeId']?_0x118380[_0x8a8a('0x17')]:_0x118380[_0x8a8a('0x18')];return _0x42e8b6;});}var _0x262ca9=['id',_0x8a8a('0x19'),_0x8a8a('0x1a'),_0x8a8a('0x14'),'mobile','fax','ListId','createdAt','scheduledAt',_0x8a8a('0x1b')];var _0x45095b=_[_0x8a8a('0x1c')](_0x262ca9,_0x23febf);BPromise[_0x8a8a('0x1d')]()[_0x8a8a('0x1e')](cmContactRpc[_0x8a8a('0x1f')]({'attributes':_0x45095b,'where':_0x5e448d}))[_0x8a8a('0x1e')](function(_0xe0321c){_0xb13fca=_0xe0321c;if(!_[_0x8a8a('0x20')](_0xb13fca)){if(_0xb13fca[_0x8a8a('0x21')]===0x1){_0x76b586=_0xb13fca[0x0];logger[_0x8a8a('0xb')](_0x8a8a('0x22'),_0x118380[_0x8a8a('0x23')],_0x3d3a00['id'],_0x76b586['id']);}else{logger[_0x8a8a('0xb')](_0x8a8a('0x24'),_0x118380['uniqueid'],_0x3d3a00['id'],_[_0x8a8a('0x16')](_0xb13fca,'id')[_0x8a8a('0x25')](','));}return;}else{logger[_0x8a8a('0xb')](_0x8a8a('0x26'),_0x118380[_0x8a8a('0x23')],_0x3d3a00['id']);var _0x251315={'ListId':_0x679da2};var _0x3aa46d=_0x532621['data4']&&_0x532621[_0x8a8a('0x27')]!=='0'?_0x532621[_0x8a8a('0x27')]:_0x8a8a('0x14');if(_0x330796){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x118380[_0x8a8a('0x23')],_0x3d3a00['id']);_0x251315[_0x3aa46d]=_[_0x8a8a('0xf')](_0x118380['routeId'])?_0x118380['calleridnum']:_0x118380['destcalleridnum'];if(_[_0x8a8a('0xf')](_0x118380['routeId'])){_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x28')]&&_0x118380['calleridname']!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x28')]:_0x8a8a('0x2a');}else{_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x2b')]&&_0x118380[_0x8a8a('0x2b')]!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x2b')]:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x8a8a('0x2c')](_0x251315))[_0x8a8a('0x1e')](function(_0x5f301e){_0x76b586=_0x5f301e;_0xb13fca[_0x8a8a('0x2d')](_0x5f301e);if(_0x76b586){logger[_0x8a8a('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x118380[_0x8a8a('0x23')],_0x3d3a00['id'],_0x76b586['id']);}return;});}else{logger[_0x8a8a('0xb')](_0x8a8a('0x2e'),_0x118380['uniqueid'],_0x3d3a00['id']);_0x251315[_0x3aa46d]=_['isNil'](_0x118380[_0x8a8a('0x2f')])?_0x118380['calleridnum']:_0x118380[_0x8a8a('0x17')];if(_[_0x8a8a('0xf')](_0x118380[_0x8a8a('0x2f')])){_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x28')]&&_0x118380[_0x8a8a('0x28')]!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x28')]:_0x8a8a('0x2a');}else{_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x2b')]&&_0x118380[_0x8a8a('0x2b')]!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x2b')]:_0x8a8a('0x2a');}_0x76b586=_0x251315;_0xb13fca[_0x8a8a('0x2d')](_0x251315);return;}}})[_0x8a8a('0x1e')](function(){if(_0x11788d){emit(_0x118380[_0x8a8a('0x23')],_0x3d3a00,util['format']('user:%s',_0x11788d['name']),util[_0x8a8a('0x30')](_0x8a8a('0x31'),_0x532621[_0x8a8a('0x32')][_0x8a8a('0x33')]()),{'evt':_[_0x8a8a('0x34')](_0x118380,{'autoCreate':_0x330796}),'contact':_0x76b586===undefined?{}:_0x76b586,'contacts':_0xb13fca['length']===0x0?undefined:_0xb13fca});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2dc5831..896e32f 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 _0x04cc=['custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','emit','clone','motionChannel','checkTriggers','triggers','hasOwnProperty','status','checkTrigger','merge','Actions','length','interface','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','windowWidth','800','data5','data6','600','winApplication','winArguments','user:%s','name','format','trigger:%s','exec','integration','queue','routeId','urlforward','script','query','replace','channel','AllConditions','every','checkConditions','some','AnyConditions','account','chat','ChatWebsiteId','value','operator','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind'];(function(_0xaf6916,_0x49447e){var _0x8eaa9b=function(_0x506000){while(--_0x506000){_0xaf6916['push'](_0xaf6916['shift']());}};_0x8eaa9b(++_0x49447e);}(_0x04cc,0x1bf));var _0xc04c=function(_0x187842,_0x58331c){_0x187842=_0x187842-0x0;var _0x5dbcf3=_0x04cc[_0x187842];return _0x5dbcf3;};'use strict';var util=require(_0xc04c('0x0'));var _=require(_0xc04c('0x1'));var url=require(_0xc04c('0x2'));var Mustache=require(_0xc04c('0x3'));var Redis=require(_0xc04c('0x4'));var urlforward=require('./urlforward');var integration=require(_0xc04c('0x5'));var cmContact=require(_0xc04c('0x6'));var script=require(_0xc04c('0x7'));var config=require(_0xc04c('0x8'));var logger=require(_0xc04c('0x9'))(_0xc04c('0xa'));var ami=require(_0xc04c('0xb'));config[_0xc04c('0xc')]=_[_0xc04c('0xd')](config[_0xc04c('0xc')],{'host':_0xc04c('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc04c('0xc')]));var operators={'equals':function(_0x2f942d,_0x2279e8){return _0x2f942d==_0x2279e8;},'not_equals':function(_0x18154d,_0x106e62){return _0x18154d!=_0x106e62;}};var barAndWebActions=['popup',_0xc04c('0x2'),_0xc04c('0xf')];function Trigger(_0x1570d6){this['triggers']=_0x1570d6['triggers'];this[_0xc04c('0x10')]=_0x1570d6[_0xc04c('0x10')];this['voiceQueues']=_0x1570d6[_0xc04c('0x11')];this[_0xc04c('0x12')]=_0x1570d6[_0xc04c('0x12')];this[_0xc04c('0x13')]=_0x1570d6['voiceExtensions'];this[_0xc04c('0x14')]=_0x1570d6[_0xc04c('0x14')];this[_0xc04c('0x15')]=_0x1570d6[_0xc04c('0x15')];this[_0xc04c('0x16')]=_0x1570d6[_0xc04c('0x16')];this[_0xc04c('0x17')]=_0x1570d6[_0xc04c('0x17')];this[_0xc04c('0x18')]=_0x1570d6[_0xc04c('0x18')];this[_0xc04c('0x19')]=_0x1570d6['deskAccounts'];this[_0xc04c('0x1a')]=_0x1570d6['vtigerAccounts'];this['servicenowAccounts']=_0x1570d6[_0xc04c('0x1b')];this[_0xc04c('0x1c')]=_0x1570d6[_0xc04c('0x1c')];this[_0xc04c('0x1d')]=_0x1570d6[_0xc04c('0x1d')];this['accounts']={'zendesk':this[_0xc04c('0x14')],'salesforce':this[_0xc04c('0x16')],'freshdesk':this[_0xc04c('0x15')],'sugarcrm':this[_0xc04c('0x17')],'zoho':this[_0xc04c('0x18')],'desk':this[_0xc04c('0x19')],'vtiger':this[_0xc04c('0x1a')],'dynamics365':this[_0xc04c('0x1c')],'freshsales':this[_0xc04c('0x1d')],'servicenow':this[_0xc04c('0x1b')]};ami['on'](_0xc04c('0x1e'),this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x21'),this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x22'),this['syncCustomEvent'][_0xc04c('0x20')](this));ami['on']('custom:agentcomplete',this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x23'),this['syncCustomEvent'][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x24'),this[_0xc04c('0x1f')]['bind'](this));ami['on'](_0xc04c('0x25'),this[_0xc04c('0x1f')]['bind'](this));ami['on'](_0xc04c('0x26'),this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x27'),this[_0xc04c('0x1f')]['bind'](this));ami['on']('custom:amd',this['syncCustomEvent']['bind'](this));ami['on'](_0xc04c('0x28'),this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x29'),this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x2a'),this[_0xc04c('0x2b')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x2c'),this[_0xc04c('0x2b')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x2d'),this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x2e'),this[_0xc04c('0x1f')]['bind'](this));ami['on'](_0xc04c('0x2f'),this[_0xc04c('0x1f')]['bind'](this));ami['on'](_0xc04c('0x30'),this[_0xc04c('0x1f')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0xc04c('0x1f')][_0xc04c('0x20')](this));ami['on'](_0xc04c('0x31'),this[_0xc04c('0x1f')]['bind'](this));ami['on'](_0xc04c('0x32'),this['syncCustomEvent'][_0xc04c('0x20')](this));}Trigger[_0xc04c('0x33')]['emit']=function(_0x228431,_0x219d42,_0x3f5072){logger[_0xc04c('0x34')](_0x228431,_0x219d42,JSON['stringify'](_0x3f5072));io['to'](_0x228431)[_0xc04c('0x35')](_0x219d42,_0x3f5072);};Trigger[_0xc04c('0x33')][_0xc04c('0x1f')]=function(_0x1eb190){var _0x5652fb=_[_0xc04c('0x36')](_0x1eb190);if(typeof _0x5652fb[_0xc04c('0x37')]==='undefined'){_0x5652fb[_0xc04c('0x37')]='voice';}this['checkTriggers'](_0x5652fb);};Trigger[_0xc04c('0x33')][_0xc04c('0x2b')]=function(_0x2db904){if(this['agents'][_0x2db904['interface']]){this['syncCustomEvent'](_0x2db904);}};Trigger[_0xc04c('0x33')][_0xc04c('0x38')]=function(_0xeeecc7){var _0x3be08e;for(var _0x516214 in this[_0xc04c('0x39')]){if(this[_0xc04c('0x39')][_0xc04c('0x3a')](_0x516214)){if(this['triggers'][_0x516214][_0xc04c('0x3b')]){_0x3be08e=this[_0xc04c('0x3c')](this[_0xc04c('0x39')][_0x516214],_0xeeecc7);if(_0x3be08e){_[_0xc04c('0x3d')](_0xeeecc7,_0xeeecc7['variables']);for(var _0xaf9d41=0x0,_0x5a4c2a,_0x4acc49,_0x9c57b1;_0xaf9d410x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x5113ec,_0x185ce0){var _0x37020a=function(_0x29f8e0){while(--_0x29f8e0){_0x5113ec['push'](_0x5113ec['shift']());}};_0x37020a(++_0x185ce0);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index a4661dc..312b877 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 _0xc998=['content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','/systemusers(','callDirection','queue','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','contacts','headers','substring','lastIndexOf','enduserId','destcalleridnum','calleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','indexOf'];(function(_0x3f7cb0,_0x5d9756){var _0x4b4b6f=function(_0x45c10c){while(--_0x45c10c){_0x3f7cb0['push'](_0x3f7cb0['shift']());}};_0x4b4b6f(++_0x5d9756);}(_0xc998,0x1b7));var _0x8c99=function(_0x5772c0,_0xb66295){_0x5772c0=_0x5772c0-0x0;var _0x42abd7=_0xc998[_0x5772c0];return _0x42abd7;};'use strict';var _=require(_0x8c99('0x0'));var BPromise=require(_0x8c99('0x1'));var rp=require(_0x8c99('0x2'));var util=require(_0x8c99('0x3'));var intUtil=require(_0x8c99('0x4'));var md5=require('md5');var Redis=require(_0x8c99('0x5'));var logger=require('../../../../config/logger')(_0x8c99('0x6'));var config=require('../../../../config/environment');config[_0x8c99('0x7')]=_[_0x8c99('0x8')](config[_0x8c99('0x7')],{'host':_0x8c99('0x9'),'port':0x18eb});var io=require(_0x8c99('0xa'))(new Redis(config[_0x8c99('0x7')]));function getAuthToken(_0x308f3b,_0x590a90,_0xb89f29){var _0x5bbd91={'method':_0x8c99('0xb'),'uri':_0x590a90,'form':{'client_id':_0x308f3b[_0x8c99('0xc')],'resource':_0x308f3b[_0x8c99('0xd')],'username':_0x308f3b[_0x8c99('0xe')],'password':_0x308f3b[_0x8c99('0xf')],'grant_type':_0x8c99('0xf'),'client_secret':_0x308f3b[_0x8c99('0x10')]},'json':!![]};return rp(_0x5bbd91)[_0x8c99('0x11')](function(_0x524d55){return _0x524d55['access_token'];})[_0x8c99('0x12')](function(_0x689434){logger['error']('['+[_0xb89f29[_0x8c99('0x13')]()]+_0x8c99('0x14'));return _0x689434[_0x8c99('0x15')];});}function getUser(_0x2b8af8,_0x27d690,_0x52e996,_0x5d4a0e,_0x4b07f5,_0x2fcb46){return new BPromise(function(_0x591585,_0xd8190){return getAuthToken(_0x27d690,_0x5d4a0e,_0x2fcb46)[_0x8c99('0x11')](function(_0xa6bf38){var _0x1e719a={'method':_0x8c99('0x16'),'uri':_0x4b07f5+_0x8c99('0x17'),'headers':{'Authorization':_0x8c99('0x18')+_0xa6bf38,'OData-Version':_0x8c99('0x19')},'json':!![]};return rp(_0x1e719a);})[_0x8c99('0x11')](function(_0x41f979){var _0x172764=_0x41f979[_0x8c99('0x1a')];var _0x269e07=![];var _0x255107=null;if(!_[_0x8c99('0x1b')](_0x52e996)){if(intUtil[_0x8c99('0x1c')](_0x52e996[_0x8c99('0x1d')])){_0x2b8af8[_0x8c99('0x1e')]=_0x52e996[_0x8c99('0x1d')];for(_0x255107=0x0;_0x255107<_0x172764[_0x8c99('0x1f')];_0x255107++){if(_0x172764[_0x255107][_0x8c99('0x20')]===_0x52e996[_0x8c99('0x1d')]&&!_0x172764[_0x255107][_0x8c99('0x21')]){_0x269e07=!![];logger[_0x8c99('0x22')]('['+[_0x2fcb46['toUpperCase']()]+_0x8c99('0x23')+_0x172764[_0x255107][_0x8c99('0x24')]+'!');_0x2b8af8[_0x8c99('0x25')]=_0x172764[_0x255107][_0x8c99('0x24')];}}}}if(!_0x269e07){logger['info']('['+[_0x2fcb46[_0x8c99('0x13')]()]+_0x8c99('0x26'));_0x2b8af8[_0x8c99('0x1e')]=_0x27d690['username'];for(_0x255107=0x0;_0x255107<_0x172764[_0x8c99('0x1f')];_0x255107++){if(_0x172764[_0x255107][_0x8c99('0x20')]===_0x27d690[_0x8c99('0xe')]){_0x2b8af8[_0x8c99('0x25')]=_0x172764[_0x255107][_0x8c99('0x24')];}}}_0x591585(_0x2b8af8);})[_0x8c99('0x12')](function(_0x37d9ac){_0xd8190(_0x37d9ac['message']);});});}function createEndUser(_0x2e26c7,_0x3c4be9,_0x3b186c,_0x31871e,_0x4e72f7,_0x39b566){return new BPromise(function(_0x394896,_0x2fbacb){return getAuthToken(_0x3c4be9,_0x3b186c,_0x39b566)['then'](function(_0x5ef65e){var _0x5c1114=_0x39b566[_0x8c99('0x27')]()===_0x8c99('0x28')?_0x4e72f7['destcalleridnum']:_0x4e72f7['calleridnum'];var _0x23aafb={'method':_0x8c99('0xb'),'uri':_0x31871e+_0x8c99('0x29'),'body':{'telephone1':_0x5c1114,'fullname':_0x5c1114,'firstname':_0x5c1114,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2e26c7[_0x8c99('0x25')]+')'},'headers':{'Authorization':_0x8c99('0x18')+_0x5ef65e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x23aafb);})[_0x8c99('0x11')](function(_0x1a5b70){var _0x332da9=_0x1a5b70[_0x8c99('0x2a')]['odata-entityid'];var _0x4f4ac8=_0x332da9[_0x8c99('0x2b')](_0x332da9['lastIndexOf']('(')+0x1,_0x332da9[_0x8c99('0x2c')](')'));_0x2e26c7[_0x8c99('0x2d')]=_0x4f4ac8;_0x394896(_0x2e26c7);})[_0x8c99('0x12')](function(_0x49a0a4){_0x2fbacb(_0x49a0a4[_0x8c99('0x15')]);});});}function getEndUser(_0x32a0d1,_0x381e82,_0x57ea42,_0x2b92dc,_0x4964e5,_0x3d72cf){return new BPromise(function(_0x4a8c1a,_0x3c5a45){var _0x416d89=_0x3d72cf[_0x8c99('0x27')]()==='outbound'?_0x4964e5[_0x8c99('0x2e')]:_0x4964e5[_0x8c99('0x2f')];return getAuthToken(_0x381e82,_0x57ea42,_0x3d72cf)[_0x8c99('0x11')](function(_0x4c14d2){var _0x525da9={'method':'GET','uri':_0x2b92dc+_0x8c99('0x30')+_0x416d89[_0x8c99('0x31')]('+',_0x8c99('0x32'))+'\x27','headers':{'Authorization':_0x8c99('0x18')+_0x4c14d2,'If-None-Match':null,'OData-Version':_0x8c99('0x19')},'json':!![]};return rp(_0x525da9);})[_0x8c99('0x11')](function(_0x378a0a){var _0x772c44=null;if(_0x378a0a){var _0x557dba=_0x378a0a[_0x8c99('0x1a')];var _0x464f63=![];for(_0x772c44=0x0;_0x772c44<_0x557dba[_0x8c99('0x1f')];_0x772c44++){if(_0x557dba[_0x772c44][_0x8c99('0x33')]===_0x416d89){_0x464f63=!![];_0x32a0d1[_0x8c99('0x2d')]=_0x557dba[_0x772c44]['contactid'];}}if(_0x464f63){_0x4a8c1a(_0x32a0d1);}else{return createEndUser(_0x32a0d1,_0x381e82,_0x57ea42,_0x2b92dc,_0x4964e5,_0x3d72cf)[_0x8c99('0x11')](function(_0x283f88){logger[_0x8c99('0x22')]('['+[_0x3d72cf[_0x8c99('0x13')]()]+_0x8c99('0x34'),_0x283f88[_0x8c99('0x2d')]);_0x4a8c1a(_0x283f88);});}}else{return createEndUser(_0x32a0d1,_0x381e82,_0x57ea42,_0x2b92dc,_0x4964e5,_0x3d72cf)[_0x8c99('0x11')](function(_0x2bf577){logger[_0x8c99('0x22')]('['+[_0x3d72cf[_0x8c99('0x13')]()]+']\x20Enduser\x20Created!',_0x2bf577['enduserId']);_0x4a8c1a(_0x2bf577);});}});});}function getCustomFields(_0x5e3f5c,_0x3bfa20,_0x579ff1){var _0x2b4672={};if(_0x5e3f5c[_0x8c99('0x1f')]>0x0){_[_0x8c99('0x35')](_0x5e3f5c,function(_0x242eff){if(_['includes']([_0x8c99('0x36'),_0x8c99('0x37')],_0x242eff[_0x8c99('0x38')])&&_0x242eff[_0x8c99('0x39')]&&!_0x242eff[_0x8c99('0x3a')]){var _0x5ed593=_0x242eff[_0x8c99('0x3b')][_0x8c99('0x27')]();var _0x4407fc=_0x5ed593['substring'](0x0,_0x5ed593[_0x8c99('0x3c')]('_'));var _0xbe6cc4=_0x5ed593[_0x8c99('0x2b')](_0x5ed593[_0x8c99('0x3c')]('_')+0x1);if(_0x4407fc===_0x579ff1){_0x2b4672[_0xbe6cc4]=_0x242eff[_0x8c99('0x3d')];}}});}return _0x2b4672;}function getTicket(_0x5a2858,_0x159ab4,_0x55f1ce,_0x592b1f,_0x302c8f,_0x4f7209,_0x376f76){return new BPromise(function(_0x39e858,_0x299ddf){var _0x55da96;return getAuthToken(_0x159ab4,_0x55f1ce,_0x376f76)[_0x8c99('0x11')](function(_0x46d853){if(_0x4f7209[_0x8c99('0x3e')]===_0x8c99('0x3f')){_0x55da96={'method':'POST','uri':_0x592b1f+_0x8c99('0x40'),'body':Object[_0x8c99('0x41')]({},{'title':intUtil[_0x8c99('0x42')](_0x4f7209['Subjects'],_0x302c8f,'\x20'),'description':intUtil['getString'](_0x4f7209[_0x8c99('0x43')],_0x302c8f,'\x0a'),'customerid_contact@odata.bind':_0x8c99('0x44')+_0x5a2858[_0x8c99('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x5a2858[_0x8c99('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x4f7209[_0x8c99('0x45')],_0x302c8f,_0x4f7209[_0x8c99('0x3e')])),'headers':{'Authorization':_0x8c99('0x18')+_0x46d853,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4f7209['ticketType']===_0x8c99('0x46')){_0x55da96={'method':_0x8c99('0xb'),'uri':_0x592b1f+_0x8c99('0x47'),'body':Object[_0x8c99('0x41')]({},{'subject':intUtil[_0x8c99('0x42')](_0x4f7209['Subjects'],_0x302c8f,'\x20'),'phonenumber':String(_0x302c8f[_0x8c99('0x2f')]),'description':intUtil['getString'](_0x4f7209[_0x8c99('0x43')],_0x302c8f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8c99('0x44')+_0x5a2858[_0x8c99('0x2d')]+')','ownerid@odata.bind':_0x8c99('0x48')+_0x5a2858['userId']+')','directioncode':_0x5a2858[_0x8c99('0x49')]===_0x8c99('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8c99('0x48')+_0x5a2858[_0x8c99('0x25')]+')','participationtypemask':_0x5a2858[_0x8c99('0x49')]===_0x8c99('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5a2858[_0x8c99('0x2d')]+')','participationtypemask':_0x5a2858[_0x8c99('0x49')]===_0x8c99('0x4a')?0x1:0x2}]},getCustomFields(_0x4f7209[_0x8c99('0x45')],_0x302c8f,_0x4f7209[_0x8c99('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x46d853,'OData-Version':_0x8c99('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x55da96);})[_0x8c99('0x11')](function(_0x23db8a){var _0x2f5ab4=_0x23db8a[_0x8c99('0x2a')][_0x8c99('0x4b')];var _0x1f6321=_0x2f5ab4[_0x8c99('0x2b')](_0x2f5ab4[_0x8c99('0x2c')]('(')+0x1,_0x2f5ab4[_0x8c99('0x2c')](')'));_0x5a2858[_0x8c99('0x4c')]=_0x1f6321;_0x39e858(_0x5a2858);})[_0x8c99('0x12')](function(_0x1e7cf0){_0x299ddf(_0x1e7cf0['message']);});});}function emit(_0x2998d1,_0x2c7a78,_0x34b9ff,_0x3f71d6){var _0x1d0bf0={'uri':util[_0x8c99('0x4d')](_0x8c99('0x4e'),_0x2998d1,_0x34b9ff,_0x3f71d6)};io['to'](util[_0x8c99('0x4d')](_0x8c99('0x4f'),_0x2c7a78))[_0x8c99('0x50')]('trigger:browser:url',_0x1d0bf0);}exports['cs']=function(_0x591409,_0x2fa2f3,_0x462ec5,_0x2d6bec,_0x1e9089,_0x11de6d,_0x346d68,_0x4d8185){var _0x646fbd={};_0x11de6d[_0x8c99('0xd')]=intUtil[_0x8c99('0x51')](_0x11de6d['remoteUri']);_0x11de6d[_0x8c99('0x52')]=intUtil[_0x8c99('0x51')](_0x11de6d['serverUrl']);_0x646fbd[_0x8c99('0x49')]=_0x4d8185===_0x8c99('0x4a')||_0x4d8185===_0x8c99('0x53')?_0x8c99('0x4a'):_0x8c99('0x28');var _0x68cc9f=util[_0x8c99('0x4d')](_0x8c99('0x54'),_0x11de6d['remoteUri']);var _0x4882bb=util[_0x8c99('0x4d')](_0x8c99('0x55'),_0x11de6d[_0x8c99('0x56')]);var _0x54f18b=util[_0x8c99('0x4d')](_0x8c99('0x57'),_0x11de6d[_0x8c99('0x52')],_0x2fa2f3[_0x8c99('0x58')],md5(_0x2fa2f3[_0x8c99('0x58')]));if(_0x1e9089&&_0x1e9089['monitor_format']){logger['info']('[QUEUE]',_0x8c99('0x59'));_0x2fa2f3[_0x8c99('0x5a')]=_0x54f18b;}else if(_0x346d68&&_0x346d68[_0x8c99('0x5b')]&&_0x346d68['recordingFormat']!==_0x8c99('0x5c')){logger['info']('[OUTBOUND]',_0x8c99('0x59'));_0x2fa2f3[_0x8c99('0x5a')]=_0x54f18b;}else{_0x2fa2f3[_0x8c99('0x5a')]='';}return getUser(_0x646fbd,_0x11de6d,_0x2d6bec,_0x4882bb,_0x68cc9f,_0x4d8185)[_0x8c99('0x11')](function(_0x138a85){logger[_0x8c99('0x22')]('['+_0x4d8185[_0x8c99('0x13')]()+_0x8c99('0x5d'),_0x138a85[_0x8c99('0x25')]);logger[_0x8c99('0x22')]('['+_0x4d8185[_0x8c99('0x13')]()+']\x20The\x20User\x20email\x20is:',_0x138a85[_0x8c99('0x1e')]);return getEndUser(_0x138a85,_0x11de6d,_0x4882bb,_0x68cc9f,_0x2fa2f3,_0x4d8185);})[_0x8c99('0x11')](function(_0x493408){logger['info']('['+_0x4d8185[_0x8c99('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x493408[_0x8c99('0x2d')]);logger['info']('['+_0x4d8185['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x2fa2f3[_0x8c99('0x2f')]);return getTicket(_0x493408,_0x11de6d,_0x4882bb,_0x68cc9f,_0x2fa2f3,_0x462ec5,_0x4d8185);})[_0x8c99('0x11')](function(_0x3ee8d6){logger[_0x8c99('0x22')](util['format']('['+_0x4d8185[_0x8c99('0x13')]()+_0x8c99('0x5e'),_0x462ec5[_0x8c99('0x3e')],_0x3ee8d6['ticketId']));logger[_0x8c99('0x22')](util[_0x8c99('0x4d')]('['+_0x4d8185[_0x8c99('0x13')]()+_0x8c99('0x5f'),_0x4d8185));if(_0x4d8185!==_0x8c99('0x53')){logger[_0x8c99('0x22')]('['+_0x4d8185[_0x8c99('0x13')]()+']',_0x8c99('0x60'));emit(_0x11de6d['remoteUri'],_0x2d6bec['name'],_0x462ec5[_0x8c99('0x3e')],_0x3ee8d6['ticketId']);}})[_0x8c99('0x12')](function(_0x50ed4a){logger[_0x8c99('0x61')]('['+_0x4d8185[_0x8c99('0x13')]()+_0x8c99('0x62'),util[_0x8c99('0x63')](_0x50ed4a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2fb2=['contacts','/systemusers(','lastIndexOf','enduserId','message','toLowerCase','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','customField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','queue','callDirection','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','./util','md5','dynamics365','../../../../config/environment','redis','localhost','POST','clientId','remoteUri','username','password','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','calleridnum'];(function(_0x1685dc,_0x2de11c){var _0x2081ae=function(_0x363717){while(--_0x363717){_0x1685dc['push'](_0x1685dc['shift']());}};_0x2081ae(++_0x2de11c);}(_0x2fb2,0x1b6));var _0x22fb=function(_0x12f43a,_0x4d1e76){_0x12f43a=_0x12f43a-0x0;var _0x407434=_0x2fb2[_0x12f43a];return _0x407434;};'use strict';var _=require(_0x22fb('0x0'));var BPromise=require(_0x22fb('0x1'));var rp=require('request-promise');var util=require(_0x22fb('0x2'));var intUtil=require(_0x22fb('0x3'));var md5=require(_0x22fb('0x4'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x22fb('0x5'));var config=require(_0x22fb('0x6'));config[_0x22fb('0x7')]=_['defaults'](config[_0x22fb('0x7')],{'host':_0x22fb('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x22fb('0x7')]));function getAuthToken(_0x2e80a0,_0x2c5361,_0x610ec1){var _0x300a7e={'method':_0x22fb('0x9'),'uri':_0x2c5361,'form':{'client_id':_0x2e80a0[_0x22fb('0xa')],'resource':_0x2e80a0[_0x22fb('0xb')],'username':_0x2e80a0[_0x22fb('0xc')],'password':_0x2e80a0[_0x22fb('0xd')],'grant_type':'password','client_secret':_0x2e80a0['clientSecret']},'json':!![]};return rp(_0x300a7e)[_0x22fb('0xe')](function(_0x364711){return _0x364711[_0x22fb('0xf')];})[_0x22fb('0x10')](function(_0x3e8571){logger['error']('['+[_0x610ec1[_0x22fb('0x11')]()]+_0x22fb('0x12'));return _0x3e8571['message'];});}function getUser(_0x14ea1e,_0x24b860,_0x5f1da8,_0x2fd896,_0x28944f,_0x729905){return new BPromise(function(_0x53948a,_0x355d70){return getAuthToken(_0x24b860,_0x2fd896,_0x729905)[_0x22fb('0xe')](function(_0x2f69ec){var _0x401678={'method':_0x22fb('0x13'),'uri':_0x28944f+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x22fb('0x14')+_0x2f69ec,'OData-Version':_0x22fb('0x15')},'json':!![]};return rp(_0x401678);})[_0x22fb('0xe')](function(_0x3cf120){var _0x486360=_0x3cf120['value'];var _0x2d1bd9=![];var _0xae9e29=null;if(!_['isNil'](_0x5f1da8)){if(intUtil[_0x22fb('0x16')](_0x5f1da8[_0x22fb('0x17')])){_0x14ea1e[_0x22fb('0x18')]=_0x5f1da8[_0x22fb('0x17')];for(_0xae9e29=0x0;_0xae9e29<_0x486360[_0x22fb('0x19')];_0xae9e29++){if(_0x486360[_0xae9e29]['internalemailaddress']===_0x5f1da8[_0x22fb('0x17')]&&!_0x486360[_0xae9e29][_0x22fb('0x1a')]){_0x2d1bd9=!![];logger[_0x22fb('0x1b')]('['+[_0x729905[_0x22fb('0x11')]()]+_0x22fb('0x1c')+_0x486360[_0xae9e29][_0x22fb('0x1d')]+'!');_0x14ea1e[_0x22fb('0x1e')]=_0x486360[_0xae9e29][_0x22fb('0x1d')];}}}}if(!_0x2d1bd9){logger[_0x22fb('0x1b')]('['+[_0x729905[_0x22fb('0x11')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x14ea1e['userEmail']=_0x24b860[_0x22fb('0xc')];for(_0xae9e29=0x0;_0xae9e29<_0x486360['length'];_0xae9e29++){if(_0x486360[_0xae9e29]['internalemailaddress']===_0x24b860[_0x22fb('0xc')]){_0x14ea1e[_0x22fb('0x1e')]=_0x486360[_0xae9e29][_0x22fb('0x1d')];}}}_0x53948a(_0x14ea1e);})[_0x22fb('0x10')](function(_0x2c538b){_0x355d70(_0x2c538b['message']);});});}function createEndUser(_0x81a59,_0x296415,_0x33fea6,_0x20e234,_0x507f6d,_0x3d6685){return new BPromise(function(_0x4a41a6,_0x420390){return getAuthToken(_0x296415,_0x33fea6,_0x3d6685)[_0x22fb('0xe')](function(_0x2deb25){var _0x5dbf54=_0x3d6685['toLowerCase']()==='outbound'?_0x507f6d['destcalleridnum']:_0x507f6d[_0x22fb('0x1f')];var _0x1ca295={'method':_0x22fb('0x9'),'uri':_0x20e234+_0x22fb('0x20'),'body':{'telephone1':_0x5dbf54,'fullname':_0x5dbf54,'firstname':_0x5dbf54,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x22fb('0x21')+_0x81a59['userId']+')'},'headers':{'Authorization':_0x22fb('0x14')+_0x2deb25,'OData-Version':_0x22fb('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1ca295);})[_0x22fb('0xe')](function(_0x487ba8){var _0x4c29ac=_0x487ba8['headers']['odata-entityid'];var _0x12b8d2=_0x4c29ac['substring'](_0x4c29ac[_0x22fb('0x22')]('(')+0x1,_0x4c29ac['lastIndexOf'](')'));_0x81a59[_0x22fb('0x23')]=_0x12b8d2;_0x4a41a6(_0x81a59);})[_0x22fb('0x10')](function(_0x1930b0){_0x420390(_0x1930b0[_0x22fb('0x24')]);});});}function getEndUser(_0x1ac73c,_0x5e6786,_0x5ac29e,_0x33c3f8,_0x152ca4,_0x11c178){return new BPromise(function(_0x528b77,_0xbf2686){var _0x200088=_0x11c178[_0x22fb('0x25')]()==='outbound'?_0x152ca4[_0x22fb('0x26')]:_0x152ca4['calleridnum'];return getAuthToken(_0x5e6786,_0x5ac29e,_0x11c178)['then'](function(_0x4f97eb){var _0x159496={'method':_0x22fb('0x13'),'uri':_0x33c3f8+_0x22fb('0x27')+_0x200088[_0x22fb('0x28')]('+',_0x22fb('0x29'))+'\x27','headers':{'Authorization':_0x22fb('0x14')+_0x4f97eb,'If-None-Match':null,'OData-Version':_0x22fb('0x15')},'json':!![]};return rp(_0x159496);})[_0x22fb('0xe')](function(_0x5f85d8){var _0x5b3db5=null;if(_0x5f85d8){var _0x58d5f2=_0x5f85d8[_0x22fb('0x2a')];var _0x96df92=![];for(_0x5b3db5=0x0;_0x5b3db5<_0x58d5f2[_0x22fb('0x19')];_0x5b3db5++){if(_0x58d5f2[_0x5b3db5][_0x22fb('0x2b')]===_0x200088){_0x96df92=!![];_0x1ac73c['enduserId']=_0x58d5f2[_0x5b3db5][_0x22fb('0x2c')];}}if(_0x96df92){_0x528b77(_0x1ac73c);}else{return createEndUser(_0x1ac73c,_0x5e6786,_0x5ac29e,_0x33c3f8,_0x152ca4,_0x11c178)[_0x22fb('0xe')](function(_0x194aa9){logger[_0x22fb('0x1b')]('['+[_0x11c178['toUpperCase']()]+_0x22fb('0x2d'),_0x194aa9[_0x22fb('0x23')]);_0x528b77(_0x194aa9);});}}else{return createEndUser(_0x1ac73c,_0x5e6786,_0x5ac29e,_0x33c3f8,_0x152ca4,_0x11c178)[_0x22fb('0xe')](function(_0x4ff98e){logger[_0x22fb('0x1b')]('['+[_0x11c178['toUpperCase']()]+']\x20Enduser\x20Created!',_0x4ff98e[_0x22fb('0x23')]);_0x528b77(_0x4ff98e);});}});});}function getCustomFields(_0x338db6,_0x4301cd,_0x10c4dd){var _0x157697={};if(_0x338db6[_0x22fb('0x19')]>0x0){_[_0x22fb('0x2e')](_0x338db6,function(_0x1596bc){if(_[_0x22fb('0x2f')]([_0x22fb('0x30'),_0x22fb('0x31')],_0x1596bc['type'])&&_0x1596bc['nameField']&&!_0x1596bc[_0x22fb('0x32')]){var _0x9c34ca=_0x1596bc[_0x22fb('0x33')][_0x22fb('0x25')]();var _0x2b1ee4=_0x9c34ca[_0x22fb('0x34')](0x0,_0x9c34ca[_0x22fb('0x35')]('_'));var _0x4bd1e2=_0x9c34ca['substring'](_0x9c34ca['indexOf']('_')+0x1);if(_0x2b1ee4===_0x10c4dd){_0x157697[_0x4bd1e2]=_0x1596bc[_0x22fb('0x36')];}}});}return _0x157697;}function getTicket(_0x504051,_0x535bd0,_0x36d307,_0x443e4c,_0x4bfd40,_0xd6caf9,_0x34dc13){return new BPromise(function(_0x581b35,_0x3d9f0e){var _0x42f07c;return getAuthToken(_0x535bd0,_0x36d307,_0x34dc13)[_0x22fb('0xe')](function(_0x2e4744){if(_0xd6caf9[_0x22fb('0x37')]===_0x22fb('0x38')){_0x42f07c={'method':'POST','uri':_0x443e4c+_0x22fb('0x39'),'body':Object[_0x22fb('0x3a')]({},{'title':intUtil[_0x22fb('0x3b')](_0xd6caf9['Subjects'],_0x4bfd40,'\x20'),'description':intUtil['getString'](_0xd6caf9[_0x22fb('0x3c')],_0x4bfd40,'\x0a'),'customerid_contact@odata.bind':_0x22fb('0x3d')+_0x504051[_0x22fb('0x23')]+')','ownerid@odata.bind':_0x22fb('0x21')+_0x504051[_0x22fb('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0xd6caf9[_0x22fb('0x3e')],_0x4bfd40,_0xd6caf9['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x2e4744,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd6caf9[_0x22fb('0x37')]===_0x22fb('0x3f')){_0x42f07c={'method':_0x22fb('0x9'),'uri':_0x443e4c+_0x22fb('0x40'),'body':Object[_0x22fb('0x3a')]({},{'subject':intUtil[_0x22fb('0x3b')](_0xd6caf9['Subjects'],_0x4bfd40,'\x20'),'phonenumber':String(_0x4bfd40['calleridnum']),'description':intUtil[_0x22fb('0x3b')](_0xd6caf9[_0x22fb('0x3c')],_0x4bfd40,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x504051[_0x22fb('0x23')]+')','ownerid@odata.bind':_0x22fb('0x21')+_0x504051[_0x22fb('0x1e')]+')','directioncode':_0x504051['callDirection']===_0x22fb('0x41')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x504051[_0x22fb('0x1e')]+')','participationtypemask':_0x504051[_0x22fb('0x42')]===_0x22fb('0x41')?0x2:0x1},{'partyid_contact@odata.bind':_0x22fb('0x3d')+_0x504051['enduserId']+')','participationtypemask':_0x504051[_0x22fb('0x42')]===_0x22fb('0x41')?0x1:0x2}]},getCustomFields(_0xd6caf9[_0x22fb('0x3e')],_0x4bfd40,_0xd6caf9['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x2e4744,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x42f07c);})[_0x22fb('0xe')](function(_0x19ad25){var _0x2f23af=_0x19ad25['headers'][_0x22fb('0x43')];var _0xb7b665=_0x2f23af[_0x22fb('0x34')](_0x2f23af[_0x22fb('0x22')]('(')+0x1,_0x2f23af[_0x22fb('0x22')](')'));_0x504051['ticketId']=_0xb7b665;_0x581b35(_0x504051);})[_0x22fb('0x10')](function(_0x201ec4){_0x3d9f0e(_0x201ec4['message']);});});}function emit(_0x563d68,_0x123af2,_0x5a3560,_0x50f6ad){var _0x57d7be={'uri':util[_0x22fb('0x44')](_0x22fb('0x45'),_0x563d68,_0x5a3560,_0x50f6ad)};io['to'](util[_0x22fb('0x44')](_0x22fb('0x46'),_0x123af2))[_0x22fb('0x47')]('trigger:browser:url',_0x57d7be);}exports['cs']=function(_0x4d6421,_0x40f57c,_0x2eb7c0,_0x27cf8e,_0x25673e,_0x4f7cf6,_0x12e467,_0x4bcd1e){var _0x254997={};_0x4f7cf6[_0x22fb('0xb')]=intUtil['stripTrailingSlash'](_0x4f7cf6['remoteUri']);_0x4f7cf6['serverUrl']=intUtil[_0x22fb('0x48')](_0x4f7cf6[_0x22fb('0x49')]);_0x254997[_0x22fb('0x42')]=_0x4bcd1e===_0x22fb('0x41')||_0x4bcd1e==='unmanaged'?_0x22fb('0x41'):_0x22fb('0x4a');var _0x5ba148=util[_0x22fb('0x44')](_0x22fb('0x4b'),_0x4f7cf6[_0x22fb('0xb')]);var _0x547859=util[_0x22fb('0x44')](_0x22fb('0x4c'),_0x4f7cf6[_0x22fb('0x4d')]);var _0x28b574=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f7cf6[_0x22fb('0x49')],_0x40f57c[_0x22fb('0x4e')],md5(_0x40f57c[_0x22fb('0x4e')]));if(_0x25673e&&_0x25673e['monitor_format']){logger[_0x22fb('0x1b')](_0x22fb('0x4f'),_0x22fb('0x50'));_0x40f57c['recordingURL']=_0x28b574;}else if(_0x12e467&&_0x12e467['recordingFormat']&&_0x12e467[_0x22fb('0x51')]!=='none'){logger[_0x22fb('0x1b')](_0x22fb('0x52'),_0x22fb('0x50'));_0x40f57c['recordingURL']=_0x28b574;}else{_0x40f57c['recordingURL']='';}return getUser(_0x254997,_0x4f7cf6,_0x27cf8e,_0x547859,_0x5ba148,_0x4bcd1e)[_0x22fb('0xe')](function(_0x395ea6){logger[_0x22fb('0x1b')]('['+_0x4bcd1e[_0x22fb('0x11')]()+']\x20The\x20User\x20ID\x20is:',_0x395ea6[_0x22fb('0x1e')]);logger[_0x22fb('0x1b')]('['+_0x4bcd1e[_0x22fb('0x11')]()+_0x22fb('0x53'),_0x395ea6['userEmail']);return getEndUser(_0x395ea6,_0x4f7cf6,_0x547859,_0x5ba148,_0x40f57c,_0x4bcd1e);})[_0x22fb('0xe')](function(_0x4cc117){logger['info']('['+_0x4bcd1e[_0x22fb('0x11')]()+_0x22fb('0x54'),_0x4cc117[_0x22fb('0x23')]);logger[_0x22fb('0x1b')]('['+_0x4bcd1e[_0x22fb('0x11')]()+_0x22fb('0x55'),_0x40f57c[_0x22fb('0x1f')]);return getTicket(_0x4cc117,_0x4f7cf6,_0x547859,_0x5ba148,_0x40f57c,_0x2eb7c0,_0x4bcd1e);})[_0x22fb('0xe')](function(_0x563db8){logger[_0x22fb('0x1b')](util[_0x22fb('0x44')]('['+_0x4bcd1e['toUpperCase']()+_0x22fb('0x56'),_0x2eb7c0['ticketType'],_0x563db8['ticketId']));logger[_0x22fb('0x1b')](util[_0x22fb('0x44')]('['+_0x4bcd1e['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x4bcd1e));if(_0x4bcd1e!==_0x22fb('0x57')){logger[_0x22fb('0x1b')]('['+_0x4bcd1e[_0x22fb('0x11')]()+']',_0x22fb('0x58'));emit(_0x4f7cf6[_0x22fb('0xb')],_0x27cf8e[_0x22fb('0x59')],_0x2eb7c0[_0x22fb('0x37')],_0x563db8[_0x22fb('0x5a')]);}})[_0x22fb('0x10')](function(_0x192114){logger[_0x22fb('0x5b')]('['+_0x4bcd1e[_0x22fb('0x11')]()+_0x22fb('0x5c'),util[_0x22fb('0x5d')](_0x192114,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 2ec5325..22f369f 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 _0x5b12=['trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','catch','unmanaged','lastevent','toUpperCase','recordingURL','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','toString','[HTTP]','stringify','GET','forEach','includes','string','picklist','nameField','content','idField','customField','type','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%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'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x5b12,0x69));var _0x25b1=function(_0x2e9a62,_0x3638b){_0x2e9a62=_0x2e9a62-0x0;var _0x2d5efb=_0x5b12[_0x2e9a62];return _0x2d5efb;};'use strict';var _=require(_0x25b1('0x0'));var rp=require(_0x25b1('0x1'));var md5=require(_0x25b1('0x2'));var util=require('util');var Redis=require(_0x25b1('0x3'));var intUtil=require(_0x25b1('0x4'));var config=require(_0x25b1('0x5'));var logger=require('../../../../config/logger')(_0x25b1('0x6'));config[_0x25b1('0x7')]=_[_0x25b1('0x8')](config[_0x25b1('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x25b1('0x9'))(new Redis(config[_0x25b1('0x7')]));var headers={'Content-Type':_0x25b1('0xa'),'Accept':_0x25b1('0xa')};function emit(_0x572f9d,_0x216732,_0xfa1e28){io['to'](_0x572f9d)[_0x25b1('0xb')](_0x216732,_0xfa1e28);}function getTicket(_0x423af9,_0x1fed0d,_0x540344,_0x25b597,_0x155d0b){logger[_0x25b1('0xc')](_0x25b1('0xd'));var _0x115a63=_[_0x25b1('0xe')]({'responder_id':_0x1fed0d['id'],'requester_id':_0x540344['id'],'name':util[_0x25b1('0xf')](_0x25b1('0x10'),_0x155d0b[_0x25b1('0x11')]),'phone':_0x155d0b[_0x25b1('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x25b1('0x13')](_0x25b597[_0x25b1('0x14')],_0x155d0b,'\x20'),'description':intUtil['getString'](_0x25b597['Descriptions'],_0x155d0b,_0x25b1('0x15')),'tags':getTags(_0x25b597['Tags'],_0x25b1('0x16'))},getCustomFields(_0x25b597[_0x25b1('0x17')],_0x155d0b));_0x115a63[_0x25b1('0x18')]=_[_0x25b1('0x19')](_[_0x25b1('0x1a')](_0x115a63[_0x25b1('0x18')],'id'),_0x25b1('0x1b'));return request({'uri':util[_0x25b1('0xf')](_0x25b1('0x1c'),_0x423af9[_0x25b1('0x1d')]),'method':'POST','body':_0x115a63})['then'](function(_0x577a46){logger[_0x25b1('0xc')](_0x25b1('0x1e'));return _0x577a46;});}function getUser(_0x37da53,_0x3e6f23){if(intUtil[_0x25b1('0x1f')](_0x3e6f23)){return request({'uri':util[_0x25b1('0xf')](_0x25b1('0x20'),_0x37da53[_0x25b1('0x1d')]),'qs':{'email':_0x3e6f23}})[_0x25b1('0x21')](function(_0x2c0837){if(_0x2c0837[_0x25b1('0x22')]){logger[_0x25b1('0xc')](_0x25b1('0x23'));return _[_0x25b1('0x24')](_0x2c0837,function(_0x2dbd4a){return _0x2dbd4a['contact'][_0x25b1('0x25')]===_0x3e6f23;});}else{logger[_0x25b1('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x25b1('0x26'),_0x37da53[_0x25b1('0x1d')])})[_0x25b1('0x21')](function(_0x288bb8){logger[_0x25b1('0xc')](_0x25b1('0x27'));return _0x288bb8;});}});}else{logger['info'](_0x25b1('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x37da53['remoteUri'])})[_0x25b1('0x21')](function(_0x39d670){logger[_0x25b1('0xc')](_0x25b1('0x27'));return _0x39d670;});}}function getEndUser(_0x5a9c22,_0xa512c6,_0x5ce98c){logger['info'](_0x25b1('0x29'),_0x5ce98c);return request({'uri':util[_0x25b1('0xf')](_0x25b1('0x2a'),_0x5a9c22[_0x25b1('0x1d')]),'qs':{'phone':_0x5ce98c}})[_0x25b1('0x21')](function(_0x1b80ed){if(_0x1b80ed[_0x25b1('0x22')]){logger[_0x25b1('0xc')](_0x25b1('0x2b'));return _['find'](_0x1b80ed,{'phone':_0x5ce98c});}else{logger[_0x25b1('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x25b1('0xf')](_0x25b1('0x2a'),_0x5a9c22[_0x25b1('0x1d')]),'method':_0x25b1('0x2c'),'body':{'name':_0xa512c6,'phone':_0x5ce98c}})[_0x25b1('0x21')](function(_0x4cc532){logger[_0x25b1('0xc')](_0x25b1('0x2d'));return _0x4cc532;});}});}function getAuth(_0x368f2b){return util[_0x25b1('0xf')](_0x25b1('0x2e'),new Buffer(_0x368f2b['apiKey']+':X')[_0x25b1('0x2f')]('base64'));}function request(_0x2c1bb9){logger['debug'](_0x25b1('0x30'),JSON[_0x25b1('0x31')](_0x2c1bb9));return rp(_[_0x25b1('0x8')](_0x2c1bb9,{'method':_0x25b1('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x2cddc2,_0x1a55e1){var _0x24e16a=[];if(_0x2cddc2&&_0x2cddc2['length']>0x0){_0x24e16a=_['map'](_0x2cddc2,_0x1a55e1);}return _0x24e16a;}function getCustomFields(_0x29d9c7,_0x2821da){var _0x2827ab=[];var _0x2b5921={'custom_fields':[]};if(_0x29d9c7[_0x25b1('0x22')]>0x0){_[_0x25b1('0x33')](_0x29d9c7,function(_0x5ecbdb){if(_[_0x25b1('0x34')]([_0x25b1('0x35'),_0x25b1('0x36')],_0x5ecbdb['type'])&&_0x5ecbdb['nameField']&&!_0x5ecbdb['customField']){_0x2b5921[_0x5ecbdb[_0x25b1('0x37')]['toLowerCase']()]=_0x5ecbdb[_0x25b1('0x38')][_0x25b1('0x2f')]();}else if(_[_0x25b1('0x34')](['string',_0x25b1('0x36')],_0x5ecbdb['type'])&&_0x5ecbdb[_0x25b1('0x39')]&&_0x5ecbdb[_0x25b1('0x3a')]){_0x2b5921[_0x25b1('0x18')]['push']({'id':_0x5ecbdb[_0x25b1('0x39')],'value':_0x5ecbdb[_0x25b1('0x38')][_0x25b1('0x2f')]()});}else if(_0x5ecbdb[_0x25b1('0x3b')]==='variable'&&_0x5ecbdb[_0x25b1('0x3c')]&&_0x5ecbdb[_0x25b1('0x39')]&&_0x5ecbdb[_0x25b1('0x3a')]){_0x2821da[_0x5ecbdb['variableName']]&&_0x2b5921[_0x25b1('0x18')][_0x25b1('0x3d')]({'id':_0x5ecbdb[_0x25b1('0x39')],'value':_0x2821da[_0x5ecbdb['variableName']][_0x25b1('0x2f')]()});}else if(_0x5ecbdb['type']===_0x25b1('0x3e')&&_0x5ecbdb[_0x25b1('0x3f')]&&_0x5ecbdb[_0x25b1('0x3f')]['name']&&_0x5ecbdb[_0x25b1('0x39')]&&_0x5ecbdb[_0x25b1('0x3a')]){_0x2821da[_0x5ecbdb[_0x25b1('0x3f')]['name'][_0x25b1('0x40')]()]&&_0x2b5921[_0x25b1('0x18')][_0x25b1('0x3d')]({'id':_0x5ecbdb[_0x25b1('0x39')],'value':_0x2821da[_0x5ecbdb[_0x25b1('0x3f')][_0x25b1('0x16')]['toLowerCase']()][_0x25b1('0x2f')]()});}});}return _0x2b5921;}exports[_0x25b1('0x41')]=function(_0x30f3fb,_0x5a0887,_0x3b7af9,_0x50250a,_0x1259ab,_0x31bc5c){var _0x3890ea,_0xb5d37e;_0x31bc5c[_0x25b1('0x1d')]=intUtil[_0x25b1('0x42')](_0x31bc5c[_0x25b1('0x1d')]);_0x31bc5c[_0x25b1('0x43')]=intUtil[_0x25b1('0x42')](_0x31bc5c[_0x25b1('0x43')]);if(_0x1259ab&&_0x1259ab[_0x25b1('0x44')]){logger[_0x25b1('0xc')](_0x25b1('0x45'),_0x25b1('0x46'));_0x5a0887['recordingURL']=util[_0x25b1('0xf')](_0x25b1('0x47'),_0x31bc5c[_0x25b1('0x43')],_0x5a0887[_0x25b1('0x48')],md5(_0x5a0887[_0x25b1('0x48')]));}else{_0x5a0887['recordingURL']='';}headers[_0x25b1('0x49')]=getAuth(_0x31bc5c);return getUser(_0x31bc5c,_0x50250a[_0x25b1('0x25')])[_0x25b1('0x21')](function(_0x33da1f){_0x3890ea=_0x33da1f;logger[_0x25b1('0xc')](_0x25b1('0x4a'),_0x3890ea['id']);return getEndUser(_0x31bc5c,_0x5a0887[_0x25b1('0x11')],_0x5a0887[_0x25b1('0x12')]);})['then'](function(_0x3ebb38){_0xb5d37e=_0x3ebb38;logger[_0x25b1('0xc')](_0x25b1('0x4b'),_0xb5d37e['id']);return getTicket(_0x31bc5c,_0x3890ea,_0xb5d37e,_0x3b7af9,_0x5a0887);})[_0x25b1('0x21')](function(_0x5a0d25){if(_0x5a0d25&&_0x5a0d25['id']){logger['info'](_0x25b1('0x1e'));logger[_0x25b1('0xc')](_0x25b1('0x4c'),_0x5a0d25['id']);logger[_0x25b1('0xc')](_0x25b1('0x45'),_0x25b1('0x4d'));emit(util[_0x25b1('0xf')](_0x25b1('0x4e'),_0x50250a[_0x25b1('0x16')]),_0x25b1('0x4f'),{'uri':util[_0x25b1('0xf')](_0x25b1('0x50'),_0x31bc5c['remoteUri'],_0x5a0d25['id'])});}})['catch'](function(_0x59ebac){logger[_0x25b1('0x51')](_0x25b1('0x45'),JSON['stringify'](_0x59ebac));});};exports[_0x25b1('0x52')]=function(_0x4a2e3f,_0x424080,_0xa4a43b,_0x404a30,_0x5894e7,_0x38c27c,_0x5bc6e9){var _0x2e742f,_0x48b0d1;_0x38c27c[_0x25b1('0x1d')]=intUtil[_0x25b1('0x42')](_0x38c27c['remoteUri']);_0x38c27c[_0x25b1('0x43')]=intUtil[_0x25b1('0x42')](_0x38c27c[_0x25b1('0x43')]);if(_0x5bc6e9&&_0x5bc6e9[_0x25b1('0x53')]&&_0x5bc6e9[_0x25b1('0x53')]!=='none'){logger[_0x25b1('0xc')](_0x25b1('0x54'),_0x25b1('0x46'));_0x424080['recordingURL']=util['format'](_0x25b1('0x47'),_0x38c27c[_0x25b1('0x43')],_0x424080['uniqueid'],md5(_0x424080[_0x25b1('0x48')]));}headers[_0x25b1('0x49')]=getAuth(_0x38c27c);return getUser(_0x38c27c,_0x404a30['email'])[_0x25b1('0x21')](function(_0x445854){_0x2e742f=_0x445854;logger['info'](_0x25b1('0x4a'),_0x2e742f['id']);return getEndUser(_0x38c27c,_0x424080[_0x25b1('0x55')],_0x424080[_0x25b1('0x56')]);})[_0x25b1('0x21')](function(_0x99e78){_0x48b0d1=_0x99e78;logger[_0x25b1('0xc')]('The\x20Enduser\x20ID\x20is:',_0x48b0d1['id']);return getTicket(_0x38c27c,_0x2e742f,_0x48b0d1,_0xa4a43b,_0x424080);})[_0x25b1('0x21')](function(_0xffb546){if(_0xffb546&&_0xffb546['id']){logger[_0x25b1('0xc')](_0x25b1('0x1e'));logger[_0x25b1('0xc')](_0x25b1('0x4c'),_0xffb546['id']);logger['info'](_0x25b1('0x54'),_0x25b1('0x4d'));emit(util[_0x25b1('0xf')](_0x25b1('0x4e'),_0x404a30['name']),_0x25b1('0x4f'),{'uri':util[_0x25b1('0xf')](_0x25b1('0x50'),_0x38c27c[_0x25b1('0x1d')],_0xffb546['id'])});}})[_0x25b1('0x57')](function(_0xd1b634){logger[_0x25b1('0x51')](_0x25b1('0x54'),JSON[_0x25b1('0x31')](_0xd1b634));});};exports[_0x25b1('0x58')]=function(_0xc58650,_0x44fb1e,_0x2924c6,_0x1cc3f0,_0x4daea9,_0x561d36){var _0x5086bd,_0x505edc;_0x561d36[_0x25b1('0x1d')]=intUtil[_0x25b1('0x42')](_0x561d36[_0x25b1('0x1d')]);_0x561d36[_0x25b1('0x43')]=intUtil[_0x25b1('0x42')](_0x561d36[_0x25b1('0x43')]);if(_0x4daea9&&_0x4daea9[_0x25b1('0x44')]){logger[_0x25b1('0xc')]('['+_0x44fb1e[_0x25b1('0x59')][_0x25b1('0x5a')]()+']','Recording\x20is\x20enabled!');_0x44fb1e[_0x25b1('0x5b')]=util[_0x25b1('0xf')](_0x25b1('0x47'),_0x561d36[_0x25b1('0x43')],_0x44fb1e[_0x25b1('0x48')],md5(_0x44fb1e[_0x25b1('0x48')]));}else{_0x44fb1e[_0x25b1('0x5b')]='';}headers['Authorization']=getAuth(_0x561d36);return getUser(_0x561d36,'')['then'](function(_0x5549ac){_0x5086bd=_0x5549ac;logger[_0x25b1('0xc')]('The\x20User\x20ID\x20is:',_0x5086bd['id']);return getEndUser(_0x561d36,_0x44fb1e[_0x25b1('0x11')],_0x44fb1e[_0x25b1('0x12')]);})[_0x25b1('0x21')](function(_0x32b857){_0x505edc=_0x32b857;logger['info']('The\x20Enduser\x20ID\x20is:',_0x505edc['id']);return getTicket(_0x561d36,_0x5086bd,_0x505edc,_0x2924c6,_0x44fb1e);})[_0x25b1('0x21')](function(_0x327859){if(_0x327859){logger['info'](_0x25b1('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x327859['id']);}})['catch'](function(_0x3d2f88){logger[_0x25b1('0x51')]('['+_0x44fb1e[_0x25b1('0x59')]['toUpperCase']()+']',JSON[_0x25b1('0x31')](_0x3d2f88));});}; \ No newline at end of file +var _0xb9de=['string','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','lastevent','toUpperCase','md5','util','ioredis','./util','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','type','nameField','customField','toLowerCase','content'];(function(_0x75b0d9,_0x40dd78){var _0x324713=function(_0x5e1d6b){while(--_0x5e1d6b){_0x75b0d9['push'](_0x75b0d9['shift']());}};_0x324713(++_0x40dd78);}(_0xb9de,0xde));var _0xeb9d=function(_0x57a23e,_0x39a74f){_0x57a23e=_0x57a23e-0x0;var _0x222f4b=_0xb9de[_0x57a23e];return _0x222f4b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xeb9d('0x0'));var util=require(_0xeb9d('0x1'));var Redis=require(_0xeb9d('0x2'));var intUtil=require(_0xeb9d('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xeb9d('0x4'));config[_0xeb9d('0x5')]=_[_0xeb9d('0x6')](config[_0xeb9d('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xeb9d('0x7'))(new Redis(config[_0xeb9d('0x5')]));var headers={'Content-Type':_0xeb9d('0x8'),'Accept':_0xeb9d('0x8')};function emit(_0x21f821,_0x40334b,_0x27988c){io['to'](_0x21f821)[_0xeb9d('0x9')](_0x40334b,_0x27988c);}function getTicket(_0x29cd32,_0x43def7,_0x201077,_0x44850e,_0x1e1fc0){logger[_0xeb9d('0xa')](_0xeb9d('0xb'));var _0x50b3eb=_['merge']({'responder_id':_0x43def7['id'],'requester_id':_0x201077['id'],'name':util[_0xeb9d('0xc')](_0xeb9d('0xd'),_0x1e1fc0[_0xeb9d('0xe')]),'phone':_0x1e1fc0[_0xeb9d('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xeb9d('0x10')](_0x44850e[_0xeb9d('0x11')],_0x1e1fc0,'\x20'),'description':intUtil[_0xeb9d('0x10')](_0x44850e[_0xeb9d('0x12')],_0x1e1fc0,_0xeb9d('0x13')),'tags':getTags(_0x44850e[_0xeb9d('0x14')],_0xeb9d('0x15'))},getCustomFields(_0x44850e[_0xeb9d('0x16')],_0x1e1fc0));_0x50b3eb['custom_fields']=_[_0xeb9d('0x17')](_[_0xeb9d('0x18')](_0x50b3eb[_0xeb9d('0x19')],'id'),_0xeb9d('0x1a'));return request({'uri':util[_0xeb9d('0xc')](_0xeb9d('0x1b'),_0x29cd32[_0xeb9d('0x1c')]),'method':_0xeb9d('0x1d'),'body':_0x50b3eb})[_0xeb9d('0x1e')](function(_0x3da98c){logger[_0xeb9d('0xa')](_0xeb9d('0x1f'));return _0x3da98c;});}function getUser(_0x2730f4,_0x250fa6){if(intUtil['validateEmail'](_0x250fa6)){return request({'uri':util[_0xeb9d('0xc')](_0xeb9d('0x20'),_0x2730f4[_0xeb9d('0x1c')]),'qs':{'email':_0x250fa6}})[_0xeb9d('0x1e')](function(_0x3a401e){if(_0x3a401e[_0xeb9d('0x21')]){logger[_0xeb9d('0xa')](_0xeb9d('0x22'));return _[_0xeb9d('0x23')](_0x3a401e,function(_0x3f2276){return _0x3f2276[_0xeb9d('0x24')]['email']===_0x250fa6;});}else{logger[_0xeb9d('0xa')](_0xeb9d('0x25'));return request({'uri':util[_0xeb9d('0xc')](_0xeb9d('0x26'),_0x2730f4[_0xeb9d('0x1c')])})[_0xeb9d('0x1e')](function(_0x45dd47){logger[_0xeb9d('0xa')](_0xeb9d('0x27'));return _0x45dd47;});}});}else{logger[_0xeb9d('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xeb9d('0xc')](_0xeb9d('0x26'),_0x2730f4[_0xeb9d('0x1c')])})['then'](function(_0xb9fead){logger[_0xeb9d('0xa')](_0xeb9d('0x27'));return _0xb9fead;});}}function getEndUser(_0x3acadd,_0x5debf1,_0x6508e3){logger[_0xeb9d('0xa')](_0xeb9d('0x28'),_0x6508e3);return request({'uri':util[_0xeb9d('0xc')](_0xeb9d('0x29'),_0x3acadd['remoteUri']),'qs':{'phone':_0x6508e3}})['then'](function(_0x29cd4d){if(_0x29cd4d[_0xeb9d('0x21')]){logger[_0xeb9d('0xa')](_0xeb9d('0x2a'));return _[_0xeb9d('0x23')](_0x29cd4d,{'phone':_0x6508e3});}else{logger[_0xeb9d('0xa')](_0xeb9d('0x2b'));return request({'uri':util[_0xeb9d('0xc')]('%s/api/v2/contacts',_0x3acadd[_0xeb9d('0x1c')]),'method':_0xeb9d('0x1d'),'body':{'name':_0x5debf1,'phone':_0x6508e3}})['then'](function(_0x5882cd){logger[_0xeb9d('0xa')](_0xeb9d('0x2c'));return _0x5882cd;});}});}function getAuth(_0x9bc089){return util[_0xeb9d('0xc')](_0xeb9d('0x2d'),new Buffer(_0x9bc089[_0xeb9d('0x2e')]+':X')[_0xeb9d('0x2f')](_0xeb9d('0x30')));}function request(_0x3c6eeb){logger['debug'](_0xeb9d('0x31'),JSON[_0xeb9d('0x32')](_0x3c6eeb));return rp(_[_0xeb9d('0x6')](_0x3c6eeb,{'method':_0xeb9d('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x1a236d,_0x59a542){var _0x2b703b=[];if(_0x1a236d&&_0x1a236d[_0xeb9d('0x21')]>0x0){_0x2b703b=_[_0xeb9d('0x34')](_0x1a236d,_0x59a542);}return _0x2b703b;}function getCustomFields(_0x2d277c,_0x4776cc){var _0x405782=[];var _0x47aabd={'custom_fields':[]};if(_0x2d277c[_0xeb9d('0x21')]>0x0){_[_0xeb9d('0x35')](_0x2d277c,function(_0x5105af){if(_[_0xeb9d('0x36')](['string','picklist'],_0x5105af[_0xeb9d('0x37')])&&_0x5105af[_0xeb9d('0x38')]&&!_0x5105af[_0xeb9d('0x39')]){_0x47aabd[_0x5105af[_0xeb9d('0x38')][_0xeb9d('0x3a')]()]=_0x5105af[_0xeb9d('0x3b')]['toString']();}else if(_[_0xeb9d('0x36')]([_0xeb9d('0x3c'),'picklist'],_0x5105af[_0xeb9d('0x37')])&&_0x5105af[_0xeb9d('0x3d')]&&_0x5105af[_0xeb9d('0x39')]){_0x47aabd[_0xeb9d('0x19')]['push']({'id':_0x5105af['idField'],'value':_0x5105af[_0xeb9d('0x3b')][_0xeb9d('0x2f')]()});}else if(_0x5105af[_0xeb9d('0x37')]===_0xeb9d('0x3e')&&_0x5105af[_0xeb9d('0x3f')]&&_0x5105af['idField']&&_0x5105af[_0xeb9d('0x39')]){_0x4776cc[_0x5105af[_0xeb9d('0x3f')]]&&_0x47aabd[_0xeb9d('0x19')][_0xeb9d('0x40')]({'id':_0x5105af[_0xeb9d('0x3d')],'value':_0x4776cc[_0x5105af[_0xeb9d('0x3f')]]['toString']()});}else if(_0x5105af['type']===_0xeb9d('0x41')&&_0x5105af[_0xeb9d('0x42')]&&_0x5105af[_0xeb9d('0x42')][_0xeb9d('0x15')]&&_0x5105af[_0xeb9d('0x3d')]&&_0x5105af[_0xeb9d('0x39')]){_0x4776cc[_0x5105af['Variable'][_0xeb9d('0x15')][_0xeb9d('0x3a')]()]&&_0x47aabd['custom_fields'][_0xeb9d('0x40')]({'id':_0x5105af[_0xeb9d('0x3d')],'value':_0x4776cc[_0x5105af[_0xeb9d('0x42')][_0xeb9d('0x15')][_0xeb9d('0x3a')]()][_0xeb9d('0x2f')]()});}});}return _0x47aabd;}exports[_0xeb9d('0x43')]=function(_0x3a120b,_0x4e6b65,_0x3dbb9b,_0x5cac25,_0x483dae,_0x52bc22){var _0x552cc9,_0x5a164e;_0x52bc22[_0xeb9d('0x1c')]=intUtil[_0xeb9d('0x44')](_0x52bc22[_0xeb9d('0x1c')]);_0x52bc22[_0xeb9d('0x45')]=intUtil['stripTrailingSlash'](_0x52bc22[_0xeb9d('0x45')]);if(_0x483dae&&_0x483dae['monitor_format']){logger['info'](_0xeb9d('0x46'),'Recording\x20is\x20enabled!');_0x4e6b65['recordingURL']=util[_0xeb9d('0xc')](_0xeb9d('0x47'),_0x52bc22[_0xeb9d('0x45')],_0x4e6b65[_0xeb9d('0x48')],md5(_0x4e6b65[_0xeb9d('0x48')]));}else{_0x4e6b65[_0xeb9d('0x49')]='';}headers['Authorization']=getAuth(_0x52bc22);return getUser(_0x52bc22,_0x5cac25[_0xeb9d('0x4a')])[_0xeb9d('0x1e')](function(_0x55c5bc){_0x552cc9=_0x55c5bc;logger[_0xeb9d('0xa')](_0xeb9d('0x4b'),_0x552cc9['id']);return getEndUser(_0x52bc22,_0x4e6b65['calleridname'],_0x4e6b65[_0xeb9d('0xf')]);})[_0xeb9d('0x1e')](function(_0xb478f5){_0x5a164e=_0xb478f5;logger[_0xeb9d('0xa')](_0xeb9d('0x4c'),_0x5a164e['id']);return getTicket(_0x52bc22,_0x552cc9,_0x5a164e,_0x3dbb9b,_0x4e6b65);})[_0xeb9d('0x1e')](function(_0x26c555){if(_0x26c555&&_0x26c555['id']){logger[_0xeb9d('0xa')](_0xeb9d('0x1f'));logger[_0xeb9d('0xa')](_0xeb9d('0x4d'),_0x26c555['id']);logger['info'](_0xeb9d('0x46'),_0xeb9d('0x4e'));emit(util[_0xeb9d('0xc')]('user:%s',_0x5cac25[_0xeb9d('0x15')]),_0xeb9d('0x4f'),{'uri':util[_0xeb9d('0xc')](_0xeb9d('0x50'),_0x52bc22[_0xeb9d('0x1c')],_0x26c555['id'])});}})[_0xeb9d('0x51')](function(_0x526021){logger[_0xeb9d('0x52')]('[QUEUE]',JSON[_0xeb9d('0x32')](_0x526021));});};exports[_0xeb9d('0x53')]=function(_0x50c136,_0x2293c2,_0x4e49c7,_0x463116,_0x532682,_0x1b4a84,_0x27d2a9){var _0xd89707,_0x536f66;_0x1b4a84[_0xeb9d('0x1c')]=intUtil['stripTrailingSlash'](_0x1b4a84[_0xeb9d('0x1c')]);_0x1b4a84[_0xeb9d('0x45')]=intUtil[_0xeb9d('0x44')](_0x1b4a84[_0xeb9d('0x45')]);if(_0x27d2a9&&_0x27d2a9[_0xeb9d('0x54')]&&_0x27d2a9[_0xeb9d('0x54')]!==_0xeb9d('0x55')){logger[_0xeb9d('0xa')]('[OUTBOUND]',_0xeb9d('0x56'));_0x2293c2[_0xeb9d('0x49')]=util[_0xeb9d('0xc')](_0xeb9d('0x47'),_0x1b4a84[_0xeb9d('0x45')],_0x2293c2['uniqueid'],md5(_0x2293c2[_0xeb9d('0x48')]));}headers[_0xeb9d('0x57')]=getAuth(_0x1b4a84);return getUser(_0x1b4a84,_0x463116[_0xeb9d('0x4a')])[_0xeb9d('0x1e')](function(_0x3501ca){_0xd89707=_0x3501ca;logger[_0xeb9d('0xa')](_0xeb9d('0x4b'),_0xd89707['id']);return getEndUser(_0x1b4a84,_0x2293c2[_0xeb9d('0x58')],_0x2293c2[_0xeb9d('0x59')]);})[_0xeb9d('0x1e')](function(_0x1912af){_0x536f66=_0x1912af;logger[_0xeb9d('0xa')](_0xeb9d('0x4c'),_0x536f66['id']);return getTicket(_0x1b4a84,_0xd89707,_0x536f66,_0x4e49c7,_0x2293c2);})[_0xeb9d('0x1e')](function(_0xcdee7){if(_0xcdee7&&_0xcdee7['id']){logger[_0xeb9d('0xa')](_0xeb9d('0x1f'));logger[_0xeb9d('0xa')]('The\x20Ticket\x20ID\x20is:',_0xcdee7['id']);logger[_0xeb9d('0xa')](_0xeb9d('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xeb9d('0x5b'),_0x463116['name']),_0xeb9d('0x4f'),{'uri':util[_0xeb9d('0xc')](_0xeb9d('0x50'),_0x1b4a84['remoteUri'],_0xcdee7['id'])});}})[_0xeb9d('0x51')](function(_0x2ff021){logger[_0xeb9d('0x52')](_0xeb9d('0x5a'),JSON[_0xeb9d('0x32')](_0x2ff021));});};exports['unmanaged']=function(_0x21abb9,_0x5af33c,_0x3249ec,_0x445a7d,_0x33662d,_0x572325){var _0x17445c,_0x573dad;_0x572325[_0xeb9d('0x1c')]=intUtil[_0xeb9d('0x44')](_0x572325[_0xeb9d('0x1c')]);_0x572325[_0xeb9d('0x45')]=intUtil[_0xeb9d('0x44')](_0x572325[_0xeb9d('0x45')]);if(_0x33662d&&_0x33662d['monitor_format']){logger[_0xeb9d('0xa')]('['+_0x5af33c[_0xeb9d('0x5c')][_0xeb9d('0x5d')]()+']','Recording\x20is\x20enabled!');_0x5af33c[_0xeb9d('0x49')]=util[_0xeb9d('0xc')](_0xeb9d('0x47'),_0x572325[_0xeb9d('0x45')],_0x5af33c[_0xeb9d('0x48')],md5(_0x5af33c[_0xeb9d('0x48')]));}else{_0x5af33c['recordingURL']='';}headers[_0xeb9d('0x57')]=getAuth(_0x572325);return getUser(_0x572325,'')[_0xeb9d('0x1e')](function(_0x5102eb){_0x17445c=_0x5102eb;logger[_0xeb9d('0xa')](_0xeb9d('0x4b'),_0x17445c['id']);return getEndUser(_0x572325,_0x5af33c[_0xeb9d('0xe')],_0x5af33c['calleridnum']);})['then'](function(_0x2f9f57){_0x573dad=_0x2f9f57;logger[_0xeb9d('0xa')](_0xeb9d('0x4c'),_0x573dad['id']);return getTicket(_0x572325,_0x17445c,_0x573dad,_0x3249ec,_0x5af33c);})[_0xeb9d('0x1e')](function(_0x3c4bcc){if(_0x3c4bcc){logger[_0xeb9d('0xa')]('Ticket\x20created!');logger[_0xeb9d('0xa')](_0xeb9d('0x4d'),_0x3c4bcc['id']);}})[_0xeb9d('0x51')](function(_0x340846){logger[_0xeb9d('0x52')]('['+_0x5af33c[_0xeb9d('0x5c')][_0xeb9d('0x5d')]()+']',JSON[_0xeb9d('0x32')](_0x340846));});}; \ 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 0b7f630..f9839a0 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 _0x5a73=['name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','length','email','info','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','adminEmail','toUpperCase','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','getString','Subjects','Descriptions','add','ticketId','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...'];(function(_0x31f9ac,_0x571b2b){var _0x5adec9=function(_0x4322ba){while(--_0x4322ba){_0x31f9ac['push'](_0x31f9ac['shift']());}};_0x5adec9(++_0x571b2b);}(_0x5a73,0x1cb));var _0x35a7=function(_0x3bb8ce,_0x7bf3b2){_0x3bb8ce=_0x3bb8ce-0x0;var _0x5c8172=_0x5a73[_0x3bb8ce];return _0x5c8172;};'use strict';var _=require('lodash');var rp=require(_0x35a7('0x0'));var md5=require(_0x35a7('0x1'));var util=require(_0x35a7('0x2'));var moment=require(_0x35a7('0x3'));var Promise=require('bluebird');var Redis=require(_0x35a7('0x4'));var intUtil=require(_0x35a7('0x5'));var config=require(_0x35a7('0x6'));var logger=require(_0x35a7('0x7'))(_0x35a7('0x8'));config[_0x35a7('0x9')]=_[_0x35a7('0xa')](config['redis'],{'host':_0x35a7('0xb'),'port':0x18eb});var io=require(_0x35a7('0xc'))(new Redis(config[_0x35a7('0x9')]));function getAdminId(_0x4be13e,_0x1c5414,_0x530bcc,_0x48b8fb){return new Promise(function(_0x46604a,_0x263291){var _0xea04ab=![];var _0x2151ca={'method':_0x35a7('0xd'),'uri':_0x48b8fb+_0x35a7('0xe'),'json':!![]};_0x2151ca[_0x35a7('0xf')]=_0x530bcc;logger['info'](_0x35a7('0x10'));return rp(_0x2151ca)['then'](function(_0xe30bf2){if(_0xe30bf2){var _0x346658=_0xe30bf2['users'];var _0x5a1756=null;for(_0x5a1756=0x0;_0x5a1756<_0x346658[_0x35a7('0x11')];_0x5a1756++){if(_0x346658[_0x5a1756][_0x35a7('0x12')]===_0x4be13e['adminEmail']){_0x4be13e['adminId']=_0x346658[_0x5a1756]['id'];_0xea04ab=!![];}}if(_0xea04ab){logger[_0x35a7('0x13')]('Admin\x20found:',_0x4be13e[_0x35a7('0x14')]);_0x46604a(_0x4be13e);}else{_0x263291({'statusCode':0x194,'message':_0x35a7('0x15')});}}else{_0x263291({'statusCode':0x194,'message':_0x35a7('0x15')});}})[_0x35a7('0x16')](function(_0x1e0ddf){logger[_0x35a7('0x17')]('['+[_0x1c5414['toUpperCase']()]+']',_0x1e0ddf[_0x35a7('0x18')]);_0x263291(_0x1e0ddf);});});}function getUser(_0x4e19e9,_0x4f3b2b,_0x51b783){return function(_0x541ca7){return new Promise(function(_0x56d959,_0x4302eb){var _0x1b4e2f={'method':'GET','uri':_0x51b783+_0x35a7('0xe'),'json':!![]};_0x1b4e2f[_0x35a7('0xf')]=_0x4f3b2b;logger[_0x35a7('0x13')]('Getting\x20user\x20list');return rp(_0x1b4e2f)[_0x35a7('0x19')](function(_0x985935){if(_0x985935){var _0x2f425f=_0x985935['users'];var _0x4ea248=![];var _0x218124=null;if(_0x541ca7[_0x35a7('0x1a')]!==null){logger[_0x35a7('0x13')](_0x35a7('0x1b'),_0x541ca7[_0x35a7('0x1a')]);_0x541ca7[_0x35a7('0x1c')]=_0x541ca7['agentEmail'];for(_0x218124=0x0;_0x218124<_0x2f425f[_0x35a7('0x11')];_0x218124++){if(_0x2f425f[_0x218124][_0x35a7('0x12')]===_0x541ca7[_0x35a7('0x1a')]){_0x4ea248=!![];_0x541ca7[_0x35a7('0x1d')]=_0x2f425f[_0x218124]['id'];logger[_0x35a7('0x13')]('User\x20found:',_0x541ca7[_0x35a7('0x1d')]);}}}if(!_0x4ea248){logger[_0x35a7('0x13')]('Admin\x20selected');_0x541ca7[_0x35a7('0x1c')]=_0x541ca7[_0x35a7('0x1e')];_0x541ca7[_0x35a7('0x1d')]=_0x541ca7['adminId'];_0x4ea248=!![];}if(_0x4ea248){_0x56d959(_0x541ca7);}else{_0x4302eb({'statusCode':0x194,'message':_0x35a7('0x15')});}}else{_0x4302eb({'statusCode':0x194,'message':_0x35a7('0x15')});}})[_0x35a7('0x16')](function(_0x3d2b7f){logger[_0x35a7('0x17')]('['+[_0x4e19e9[_0x35a7('0x1f')]()]+']',_0x3d2b7f[_0x35a7('0x18')]);_0x4302eb(_0x3d2b7f);});});};}function searchContact(_0x5bb7d5,_0x5ad75c,_0x3b2446,_0x141e32){return new Promise(function(_0x5cab21,_0x144ce5){var _0x249d38={'method':_0x35a7('0xd'),'headers':_0x5ad75c,'uri':_0x5bb7d5+_0x35a7('0x20')+_0x141e32+_0x35a7('0x21')+_0x3b2446+'&entities=contact','json':!![]};rp(_0x249d38)[_0x35a7('0x19')](function(_0x1b17e5){var _0x52d494=_[_0x35a7('0x22')](_0x1b17e5[_0x35a7('0x23')][_0x35a7('0x23')],[_0x3b2446,_0x141e32]);_0x5cab21(_0x52d494);})[_0x35a7('0x16')](function(_0x397f71){_0x144ce5(_0x397f71);});});}function getEndUser(_0x3f9c12,_0xd94699,_0x5bfb38){return function(_0x1ce893){return new Promise(function(_0x141295,_0x2beddc){logger[_0x35a7('0x13')](util[_0x35a7('0x24')](_0x35a7('0x25'),_0x1ce893['contactNumber']));searchContact(_0x5bfb38,_0xd94699,_0x35a7('0x26'),_0x1ce893[_0x35a7('0x27')])[_0x35a7('0x19')](function(_0x422ccf){if(_0x422ccf){_0x1ce893[_0x35a7('0x28')]=_0x422ccf['id'];logger[_0x35a7('0x13')]('Contact\x20found\x20mobile_number:',_0x1ce893[_0x35a7('0x28')]);return _0x141295(_0x1ce893);}searchContact(_0x5bfb38,_0xd94699,_0x35a7('0x29'),_0x1ce893['contactNumber'])[_0x35a7('0x19')](function(_0x277d9f){if(_0x277d9f){_0x1ce893[_0x35a7('0x28')]=_0x277d9f['id'];logger[_0x35a7('0x13')]('Contact\x20found\x20work_number:',_0x1ce893[_0x35a7('0x28')]);return _0x141295(_0x1ce893);}createEndUser(_0x1ce893,_0x3f9c12,_0xd94699,_0x5bfb38)[_0x35a7('0x19')](function(_0x27e786){logger[_0x35a7('0x13')]('Contact\x20created:',_0x27e786[_0x35a7('0x28')]);return _0x141295(_0x27e786);});});})['catch'](function(_0x3155f5){_0x2beddc(_0x3155f5);});});};}function createEndUser(_0x53879a,_0x1982ac,_0x3af299,_0x24eb64){return new Promise(function(_0x54c2da,_0x5b91e0){var _0x249256=moment();var _0x53dd85={'method':_0x35a7('0x2a'),'uri':_0x24eb64+_0x35a7('0x2b'),'body':{'contact':{'last_name':_0x53879a['contactNumber'],'work_number':_0x53879a[_0x35a7('0x27')],'mobile_number':_0x53879a[_0x35a7('0x27')],'owner_id':_0x53879a[_0x35a7('0x1d')],'created_at':_0x249256[_0x35a7('0x24')](_0x35a7('0x2c'))}},'json':!![]};_0x53dd85[_0x35a7('0xf')]=_0x3af299;logger['info'](_0x35a7('0x2d'));return rp(_0x53dd85)['then'](function(_0x1b63fe){_0x53879a[_0x35a7('0x28')]=_0x1b63fe['contact']['id'];_0x54c2da(_0x53879a);})[_0x35a7('0x16')](function(_0x1b89a8){logger[_0x35a7('0x17')]('['+[_0x1982ac['toUpperCase']()]+']',_0x1b89a8[_0x35a7('0x18')]);_0x5b91e0(_0x1b89a8[_0x35a7('0x18')]);});});}function getTicket(_0x514e4b,_0x49d5ba,_0x4ae157,_0x53fc94,_0x1ccb65){return function(_0x3695dc){logger[_0x35a7('0x13')](_0x35a7('0x2e'));return new Promise(function(_0x43478d,_0x1a8d2a){var _0x5efc7a=moment();var _0x2f878b={'method':_0x35a7('0x2a'),'uri':_0x4ae157+'/api/tasks','body':{'title':intUtil[_0x35a7('0x2f')](_0x53fc94[_0x35a7('0x30')],_0x1ccb65,'\x20'),'description':intUtil[_0x35a7('0x2f')](_0x53fc94[_0x35a7('0x31')],_0x1ccb65,'\x0a'),'owner_id':_0x3695dc['userId'],'creater_id':_0x3695dc[_0x35a7('0x14')],'targetable_id':_0x3695dc[_0x35a7('0x28')],'targetable_type':'Contact','created_at':_0x5efc7a[_0x35a7('0x24')](_0x35a7('0x2c')),'due_date':_0x5efc7a[_0x35a7('0x32')](0x1e,'m')[_0x35a7('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x2f878b[_0x35a7('0xf')]=_0x49d5ba;return rp(_0x2f878b)[_0x35a7('0x19')](function(_0x1ea006){_0x3695dc['ticketId']=_0x1ea006['task']['id'];logger[_0x35a7('0x13')]('Task\x20created:',_0x3695dc[_0x35a7('0x33')]);_0x43478d(_0x3695dc);})[_0x35a7('0x16')](function(_0x6cc517){logger[_0x35a7('0x17')]('['+[_0x514e4b['toUpperCase']()]+']',_0x6cc517[_0x35a7('0x18')]);_0x1a8d2a(_0x6cc517[_0x35a7('0x18')]);});});};}function emit(_0x53df36,_0x539aef,_0x417d89){var _0x3b4ef8={'uri':_0x53df36+'/contacts/'+_0x417d89};io['to'](util['format']('user:%s',_0x539aef))['emit'](_0x35a7('0x34'),_0x3b4ef8);}exports['cs']=function(_0xecbed0,_0xd1976b,_0x42862c,_0xeae08a,_0xb046a2,_0x40fdec,_0x2e4e2f,_0x3957d3){var _0x159666={};var _0x1e3fd0={'Authorization':_0x35a7('0x35')+_0x40fdec[_0x35a7('0x36')]};_0x40fdec[_0x35a7('0x37')]=intUtil['stripTrailingSlash'](_0x40fdec[_0x35a7('0x37')]);_0x40fdec['serverUrl']=intUtil[_0x35a7('0x38')](_0x40fdec[_0x35a7('0x39')]);var _0x130e1e=_0x40fdec[_0x35a7('0x37')];_0x159666[_0x35a7('0x1e')]=_0x40fdec[_0x35a7('0x3a')];_0x159666['contactNumber']=_0x3957d3['toLowerCase']()==='outbound'?_0xd1976b[_0x35a7('0x3b')]:_0xd1976b[_0x35a7('0x3c')];_0x159666[_0x35a7('0x3d')]=_0x3957d3===_0x35a7('0x3e')||_0x3957d3===_0x35a7('0x3f')?_0x35a7('0x3e'):_0x35a7('0x40');if(_0xeae08a){_0x159666[_0x35a7('0x1a')]=_0xeae08a[_0x35a7('0x12')];}var _0x53d4a9=util[_0x35a7('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x40fdec[_0x35a7('0x39')],_0xd1976b['uniqueid'],md5(_0xd1976b[_0x35a7('0x41')]));if(_0xb046a2&&_0xb046a2[_0x35a7('0x42')]){logger[_0x35a7('0x13')]('[QUEUE]',_0x35a7('0x43'));_0xd1976b[_0x35a7('0x44')]=_0x53d4a9;}else if(_0x2e4e2f&&_0x2e4e2f[_0x35a7('0x45')]&&_0x2e4e2f[_0x35a7('0x45')]!=='none'){logger['info'](_0x35a7('0x46'),_0x35a7('0x43'));_0xd1976b['recordingURL']=_0x53d4a9;}else{_0xd1976b[_0x35a7('0x44')]='';}return getAdminId(_0x159666,_0x3957d3,_0x1e3fd0,_0x130e1e)[_0x35a7('0x19')](getUser(_0x3957d3,_0x1e3fd0,_0x130e1e))[_0x35a7('0x19')](getEndUser(_0x3957d3,_0x1e3fd0,_0x130e1e))[_0x35a7('0x19')](getTicket(_0x3957d3,_0x1e3fd0,_0x130e1e,_0x42862c,_0xd1976b))[_0x35a7('0x19')](function(_0x41a30e){logger[_0x35a7('0x13')](util['format'](_0x35a7('0x47'),_0x41a30e[_0x35a7('0x33')]));if(_0x3957d3!==_0x35a7('0x3f')){logger[_0x35a7('0x13')]('['+[_0x3957d3[_0x35a7('0x1f')]()]+']',_0x35a7('0x48'));emit(_0x130e1e,_0xeae08a[_0x35a7('0x49')],_0x41a30e[_0x35a7('0x28')]);}})[_0x35a7('0x16')](function(_0x4f7da5){logger[_0x35a7('0x17')]('['+[_0x3957d3[_0x35a7('0x1f')]()]+_0x35a7('0x4a'),util[_0x35a7('0x4b')](_0x4f7da5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4dfd=['/contacts/','user:%s','emit','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','./util','../../../../config/environment','../../../../config/logger','redis','/api/selector/owners','headers','Getting\x20admin\x20information','users','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','GET','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f=','find','contacts','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','Subjects','getString','Contact','add','format','ticketId','Task\x20created:'];(function(_0x18da22,_0x77b602){var _0x33bdaa=function(_0x3417e0){while(--_0x3417e0){_0x18da22['push'](_0x18da22['shift']());}};_0x33bdaa(++_0x77b602);}(_0x4dfd,0x15b));var _0xd4df=function(_0x5b4b7e,_0x113df8){_0x5b4b7e=_0x5b4b7e-0x0;var _0x1832a1=_0x4dfd[_0x5b4b7e];return _0x1832a1;};'use strict';var _=require(_0xd4df('0x0'));var rp=require(_0xd4df('0x1'));var md5=require(_0xd4df('0x2'));var util=require(_0xd4df('0x3'));var moment=require(_0xd4df('0x4'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xd4df('0x5'));var config=require(_0xd4df('0x6'));var logger=require(_0xd4df('0x7'))('freshsales');config[_0xd4df('0x8')]=_['defaults'](config[_0xd4df('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4df('0x8')]));function getAdminId(_0x3bd5db,_0x1b57f5,_0x547600,_0x48cef0){return new Promise(function(_0x5ca5c7,_0x19a45e){var _0x221b68=![];var _0x2dafcb={'method':'GET','uri':_0x48cef0+_0xd4df('0x9'),'json':!![]};_0x2dafcb[_0xd4df('0xa')]=_0x547600;logger['info'](_0xd4df('0xb'));return rp(_0x2dafcb)['then'](function(_0x551a3b){if(_0x551a3b){var _0x1c5c7a=_0x551a3b[_0xd4df('0xc')];var _0xd2a29d=null;for(_0xd2a29d=0x0;_0xd2a29d<_0x1c5c7a['length'];_0xd2a29d++){if(_0x1c5c7a[_0xd2a29d][_0xd4df('0xd')]===_0x3bd5db[_0xd4df('0xe')]){_0x3bd5db[_0xd4df('0xf')]=_0x1c5c7a[_0xd2a29d]['id'];_0x221b68=!![];}}if(_0x221b68){logger[_0xd4df('0x10')]('Admin\x20found:',_0x3bd5db['adminId']);_0x5ca5c7(_0x3bd5db);}else{_0x19a45e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x19a45e({'statusCode':0x194,'message':_0xd4df('0x11')});}})[_0xd4df('0x12')](function(_0x320a52){logger['error']('['+[_0x1b57f5[_0xd4df('0x13')]()]+']',_0x320a52[_0xd4df('0x14')]);_0x19a45e(_0x320a52);});});}function getUser(_0x18a615,_0x4fab4e,_0x16601c){return function(_0x332224){return new Promise(function(_0x212c07,_0x1f86eb){var _0x2fe599={'method':_0xd4df('0x15'),'uri':_0x16601c+_0xd4df('0x9'),'json':!![]};_0x2fe599[_0xd4df('0xa')]=_0x4fab4e;logger[_0xd4df('0x10')](_0xd4df('0x16'));return rp(_0x2fe599)[_0xd4df('0x17')](function(_0x568098){if(_0x568098){var _0x121937=_0x568098[_0xd4df('0xc')];var _0x1760df=![];var _0x11c1ef=null;if(_0x332224[_0xd4df('0x18')]!==null){logger[_0xd4df('0x10')](_0xd4df('0x19'),_0x332224[_0xd4df('0x18')]);_0x332224['userEmail']=_0x332224[_0xd4df('0x18')];for(_0x11c1ef=0x0;_0x11c1ef<_0x121937[_0xd4df('0x1a')];_0x11c1ef++){if(_0x121937[_0x11c1ef]['email']===_0x332224[_0xd4df('0x18')]){_0x1760df=!![];_0x332224[_0xd4df('0x1b')]=_0x121937[_0x11c1ef]['id'];logger[_0xd4df('0x10')](_0xd4df('0x1c'),_0x332224[_0xd4df('0x1b')]);}}}if(!_0x1760df){logger['info'](_0xd4df('0x1d'));_0x332224['userEmail']=_0x332224[_0xd4df('0xe')];_0x332224[_0xd4df('0x1b')]=_0x332224[_0xd4df('0xf')];_0x1760df=!![];}if(_0x1760df){_0x212c07(_0x332224);}else{_0x1f86eb({'statusCode':0x194,'message':_0xd4df('0x11')});}}else{_0x1f86eb({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x529f2c){logger[_0xd4df('0x1e')]('['+[_0x18a615[_0xd4df('0x13')]()]+']',_0x529f2c['message']);_0x1f86eb(_0x529f2c);});});};}function searchContact(_0x562959,_0x2a374a,_0x2172e2,_0x2e689b){return new Promise(function(_0x18c3bf,_0x362165){var _0x4aae13={'method':'GET','headers':_0x2a374a,'uri':_0x562959+_0xd4df('0x1f')+_0x2e689b+_0xd4df('0x20')+_0x2172e2+'&entities=contact','json':!![]};rp(_0x4aae13)['then'](function(_0x4a7652){var _0x13ae9a=_[_0xd4df('0x21')](_0x4a7652[_0xd4df('0x22')][_0xd4df('0x22')],[_0x2172e2,_0x2e689b]);_0x18c3bf(_0x13ae9a);})[_0xd4df('0x12')](function(_0x196155){_0x362165(_0x196155);});});}function getEndUser(_0x521079,_0x5cb29c,_0x49f094){return function(_0x5603bc){return new Promise(function(_0xebe51c,_0x36f13c){logger[_0xd4df('0x10')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x5603bc['contactNumber']));searchContact(_0x49f094,_0x5cb29c,_0xd4df('0x23'),_0x5603bc[_0xd4df('0x24')])[_0xd4df('0x17')](function(_0x491100){if(_0x491100){_0x5603bc[_0xd4df('0x25')]=_0x491100['id'];logger[_0xd4df('0x10')](_0xd4df('0x26'),_0x5603bc[_0xd4df('0x25')]);return _0xebe51c(_0x5603bc);}searchContact(_0x49f094,_0x5cb29c,'work_number',_0x5603bc[_0xd4df('0x24')])[_0xd4df('0x17')](function(_0x14b4c3){if(_0x14b4c3){_0x5603bc[_0xd4df('0x25')]=_0x14b4c3['id'];logger[_0xd4df('0x10')](_0xd4df('0x27'),_0x5603bc[_0xd4df('0x25')]);return _0xebe51c(_0x5603bc);}createEndUser(_0x5603bc,_0x521079,_0x5cb29c,_0x49f094)[_0xd4df('0x17')](function(_0x39abfb){logger[_0xd4df('0x10')](_0xd4df('0x28'),_0x39abfb[_0xd4df('0x25')]);return _0xebe51c(_0x39abfb);});});})[_0xd4df('0x12')](function(_0x1f4dc4){_0x36f13c(_0x1f4dc4);});});};}function createEndUser(_0xfb9deb,_0x50e98c,_0x145397,_0x2f5c4d){return new Promise(function(_0x32d26e,_0x522eb0){var _0x59fb7f=moment();var _0x54150e={'method':_0xd4df('0x29'),'uri':_0x2f5c4d+_0xd4df('0x2a'),'body':{'contact':{'last_name':_0xfb9deb[_0xd4df('0x24')],'work_number':_0xfb9deb[_0xd4df('0x24')],'mobile_number':_0xfb9deb[_0xd4df('0x24')],'owner_id':_0xfb9deb[_0xd4df('0x1b')],'created_at':_0x59fb7f['format'](_0xd4df('0x2b'))}},'json':!![]};_0x54150e[_0xd4df('0xa')]=_0x145397;logger[_0xd4df('0x10')](_0xd4df('0x2c'));return rp(_0x54150e)['then'](function(_0x4a6134){_0xfb9deb[_0xd4df('0x25')]=_0x4a6134['contact']['id'];_0x32d26e(_0xfb9deb);})[_0xd4df('0x12')](function(_0x4041fb){logger['error']('['+[_0x50e98c[_0xd4df('0x13')]()]+']',_0x4041fb['message']);_0x522eb0(_0x4041fb[_0xd4df('0x14')]);});});}function getTicket(_0x4caaf6,_0x2e0cba,_0x529e35,_0x54e54d,_0x29eeea){return function(_0x463201){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x39ad17,_0xe3c454){var _0x3ebae3=moment();var _0x24aa14={'method':_0xd4df('0x29'),'uri':_0x529e35+_0xd4df('0x2d'),'body':{'title':intUtil['getString'](_0x54e54d[_0xd4df('0x2e')],_0x29eeea,'\x20'),'description':intUtil[_0xd4df('0x2f')](_0x54e54d['Descriptions'],_0x29eeea,'\x0a'),'owner_id':_0x463201[_0xd4df('0x1b')],'creater_id':_0x463201[_0xd4df('0xf')],'targetable_id':_0x463201[_0xd4df('0x25')],'targetable_type':_0xd4df('0x30'),'created_at':_0x3ebae3['format'](_0xd4df('0x2b')),'due_date':_0x3ebae3[_0xd4df('0x31')](0x1e,'m')[_0xd4df('0x32')](_0xd4df('0x2b'))},'json':!![]};_0x24aa14[_0xd4df('0xa')]=_0x2e0cba;return rp(_0x24aa14)[_0xd4df('0x17')](function(_0x2a20cf){_0x463201[_0xd4df('0x33')]=_0x2a20cf['task']['id'];logger[_0xd4df('0x10')](_0xd4df('0x34'),_0x463201['ticketId']);_0x39ad17(_0x463201);})[_0xd4df('0x12')](function(_0xbd6979){logger[_0xd4df('0x1e')]('['+[_0x4caaf6[_0xd4df('0x13')]()]+']',_0xbd6979['message']);_0xe3c454(_0xbd6979[_0xd4df('0x14')]);});});};}function emit(_0x56712f,_0x282ce0,_0x3be9b5){var _0x339ccd={'uri':_0x56712f+_0xd4df('0x35')+_0x3be9b5};io['to'](util[_0xd4df('0x32')](_0xd4df('0x36'),_0x282ce0))[_0xd4df('0x37')]('trigger:browser:url',_0x339ccd);}exports['cs']=function(_0x45fb84,_0x14876e,_0x465b1d,_0x100b5d,_0x359c77,_0x48b2d9,_0x38e252,_0x3f43a0){var _0x539645={};var _0x350a79={'Authorization':_0xd4df('0x38')+_0x48b2d9[_0xd4df('0x39')]};_0x48b2d9['remoteUri']=intUtil[_0xd4df('0x3a')](_0x48b2d9[_0xd4df('0x3b')]);_0x48b2d9[_0xd4df('0x3c')]=intUtil[_0xd4df('0x3a')](_0x48b2d9[_0xd4df('0x3c')]);var _0x19255e=_0x48b2d9['remoteUri'];_0x539645['adminEmail']=_0x48b2d9[_0xd4df('0x3d')];_0x539645[_0xd4df('0x24')]=_0x3f43a0[_0xd4df('0x3e')]()==='outbound'?_0x14876e[_0xd4df('0x3f')]:_0x14876e[_0xd4df('0x40')];_0x539645[_0xd4df('0x41')]=_0x3f43a0===_0xd4df('0x42')||_0x3f43a0===_0xd4df('0x43')?_0xd4df('0x42'):_0xd4df('0x44');if(_0x100b5d){_0x539645[_0xd4df('0x18')]=_0x100b5d[_0xd4df('0xd')];}var _0x42f3f0=util[_0xd4df('0x32')](_0xd4df('0x45'),_0x48b2d9[_0xd4df('0x3c')],_0x14876e[_0xd4df('0x46')],md5(_0x14876e[_0xd4df('0x46')]));if(_0x359c77&&_0x359c77[_0xd4df('0x47')]){logger[_0xd4df('0x10')](_0xd4df('0x48'),'Recording\x20is\x20enabled!');_0x14876e[_0xd4df('0x49')]=_0x42f3f0;}else if(_0x38e252&&_0x38e252[_0xd4df('0x4a')]&&_0x38e252[_0xd4df('0x4a')]!=='none'){logger['info'](_0xd4df('0x4b'),_0xd4df('0x4c'));_0x14876e[_0xd4df('0x49')]=_0x42f3f0;}else{_0x14876e['recordingURL']='';}return getAdminId(_0x539645,_0x3f43a0,_0x350a79,_0x19255e)['then'](getUser(_0x3f43a0,_0x350a79,_0x19255e))[_0xd4df('0x17')](getEndUser(_0x3f43a0,_0x350a79,_0x19255e))[_0xd4df('0x17')](getTicket(_0x3f43a0,_0x350a79,_0x19255e,_0x465b1d,_0x14876e))['then'](function(_0x52f596){logger[_0xd4df('0x10')](util[_0xd4df('0x32')]('The\x20ticket\x20ID\x20is:\x20%s',_0x52f596[_0xd4df('0x33')]));if(_0x3f43a0!==_0xd4df('0x43')){logger[_0xd4df('0x10')]('['+[_0x3f43a0[_0xd4df('0x13')]()]+']',_0xd4df('0x4d'));emit(_0x19255e,_0x100b5d[_0xd4df('0x4e')],_0x52f596['endUserId']);}})[_0xd4df('0x12')](function(_0x3891fc){logger[_0xd4df('0x1e')]('['+[_0x3f43a0[_0xd4df('0x13')]()]+_0xd4df('0x4f'),util['inspect'](_0x3891fc,{'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 00204fa..f0ada5e 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 _0xaa93=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./servicenow','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','salesforce','zoho','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xaa93,0xd9));var _0x3aa9=function(_0x35b454,_0x4342ef){_0x35b454=_0x35b454-0x0;var _0x1c48be=_0xaa93[_0x35b454];return _0x1c48be;};'use strict';var _=require(_0x3aa9('0x0'));var util=require(_0x3aa9('0x1'));var zendesk=require(_0x3aa9('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x3aa9('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x3aa9('0x4'));var desk=require(_0x3aa9('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x3aa9('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x3aa9('0x7'),'salesforce',_0x3aa9('0x8'),_0x3aa9('0x9'),'zoho',_0x3aa9('0xa'),_0x3aa9('0xb'),_0x3aa9('0xc'),_0x3aa9('0xd'),_0x3aa9('0xe')];exports[_0x3aa9('0xf')]=function(_0x52cf3d,_0x49f972,_0x2732d3,_0x71db4,_0x341c4c,_0x2b2e9e){if(_0x2732d3){if(_[_0x3aa9('0x10')](integrations,_0x52cf3d[_0x3aa9('0x11')][_0x3aa9('0x12')]())){try{var _0xf8ed45=null;var _0x3316ec='';var _0x225c31=_0x2732d3[_0x52cf3d['data1'][_0x3aa9('0x12')]()];if(_0x225c31){var _0x591d64=_0x225c31[_0x52cf3d[_0x3aa9('0x13')]];if(_0x591d64){var _0x644ffe=_[_0x3aa9('0x14')](_0x591d64[_0x3aa9('0x15')],{'id':parseInt(_0x52cf3d[_0x3aa9('0x16')],0xa)});if(_0x644ffe){if(_0x71db4){if(_0x341c4c&&_0x49f972[_0x3aa9('0x17')]){_0x3316ec=_0x3aa9('0x17');}else if(_0x49f972[_0x3aa9('0x18')]){_0x3316ec=_0x3aa9('0x19');}else{console['log']('EVENT\x20UNKNOWN',_0x49f972);}}else{_0x3316ec='unmanaged';}switch(_0x52cf3d[_0x3aa9('0x11')]['toLowerCase']()){case _0x3aa9('0x7'):zendesk[_0x3316ec](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e);break;case _0x3aa9('0x1a'):salesforce[_0x3316ec](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e);break;case'sugarcrm':sugarcrm[_0x3316ec](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e);break;case _0x3aa9('0x9'):freshdesk[_0x3316ec](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e);break;case _0x3aa9('0x1b'):zoho[_0x3316ec](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e);break;case _0x3aa9('0xa'):desk[_0x3316ec](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e);break;case _0x3aa9('0xb'):vtiger[_0x3316ec](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e);break;case _0x3aa9('0xd'):freshsales['cs'](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e,_0x3316ec);break;case _0x3aa9('0xe'):servicenow['cs'](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e,_0x3316ec);break;case _0x3aa9('0xc'):dynamics365['cs'](_0x52cf3d,_0x49f972,_0x644ffe,_0x71db4,_0x341c4c,_0x591d64,_0x2b2e9e,_0x3316ec);break;default:console[_0x3aa9('0x1c')](_0x3aa9('0x1d'));}}else{_0xf8ed45=require(_0x3aa9('0x1e'))(_0x52cf3d['data1']['toLowerCase']());_0xf8ed45[_0x3aa9('0x1f')](_0x3aa9('0x20'),util[_0x3aa9('0x21')](_0x3aa9('0x22'),_0x52cf3d[_0x3aa9('0x11')][_0x3aa9('0x12')](),_0x52cf3d[_0x3aa9('0x16')]));}}else{_0xf8ed45=require('../../../../config/logger')(_0x52cf3d[_0x3aa9('0x11')][_0x3aa9('0x12')]());_0xf8ed45[_0x3aa9('0x1f')](_0x3aa9('0x20'),util[_0x3aa9('0x21')](_0x3aa9('0x23'),_0x52cf3d['data1']['toLowerCase'](),_0x52cf3d[_0x3aa9('0x13')]));}}else{}}catch(_0x372396){console[_0x3aa9('0x1f')](_0x372396);}}}}; \ No newline at end of file +var _0x19a5=['freshsales','servicenow','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','zoho','dynamics365','../../../../config/logger','[EXEC]','error','format','data2','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','desk','vtiger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x19a5,0xa6));var _0x519a=function(_0x1c8bbb,_0x22d3fe){_0x1c8bbb=_0x1c8bbb-0x0;var _0x115a6f=_0x19a5[_0x1c8bbb];return _0x115a6f;};'use strict';var _=require(_0x519a('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x519a('0x1'));var sugarcrm=require(_0x519a('0x2'));var freshdesk=require(_0x519a('0x3'));var zoho=require(_0x519a('0x4'));var desk=require(_0x519a('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x519a('0x6'));var dynamics365=require(_0x519a('0x7'));var freshsales=require(_0x519a('0x8'));var integrations=['zendesk',_0x519a('0x9'),_0x519a('0xa'),_0x519a('0xb'),'zoho',_0x519a('0xc'),_0x519a('0xd'),'dynamics365',_0x519a('0xe'),_0x519a('0xf')];exports[_0x519a('0x10')]=function(_0x5b84bf,_0x3a4954,_0x5e80f6,_0x485017,_0x4fb7cd,_0x430275){if(_0x5e80f6){if(_[_0x519a('0x11')](integrations,_0x5b84bf[_0x519a('0x12')][_0x519a('0x13')]())){try{var _0x29f9fb=null;var _0x5a0341='';var _0x3c6406=_0x5e80f6[_0x5b84bf['data1'][_0x519a('0x13')]()];if(_0x3c6406){var _0xb2b5e2=_0x3c6406[_0x5b84bf['data2']];if(_0xb2b5e2){var _0x1c997e=_[_0x519a('0x14')](_0xb2b5e2['Configurations'],{'id':parseInt(_0x5b84bf[_0x519a('0x15')],0xa)});if(_0x1c997e){if(_0x485017){if(_0x4fb7cd&&_0x3a4954[_0x519a('0x16')]){_0x5a0341=_0x519a('0x16');}else if(_0x3a4954[_0x519a('0x17')]){_0x5a0341=_0x519a('0x18');}else{console[_0x519a('0x19')](_0x519a('0x1a'),_0x3a4954);}}else{_0x5a0341=_0x519a('0x1b');}switch(_0x5b84bf[_0x519a('0x12')]['toLowerCase']()){case _0x519a('0x1c'):zendesk[_0x5a0341](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275);break;case _0x519a('0x9'):salesforce[_0x5a0341](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275);break;case'sugarcrm':sugarcrm[_0x5a0341](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275);break;case _0x519a('0xb'):freshdesk[_0x5a0341](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275);break;case _0x519a('0x1d'):zoho[_0x5a0341](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275);break;case _0x519a('0xc'):desk[_0x5a0341](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275);break;case _0x519a('0xd'):vtiger[_0x5a0341](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275);break;case _0x519a('0xe'):freshsales['cs'](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275,_0x5a0341);break;case'servicenow':servicenow['cs'](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275,_0x5a0341);break;case _0x519a('0x1e'):dynamics365['cs'](_0x5b84bf,_0x3a4954,_0x1c997e,_0x485017,_0x4fb7cd,_0xb2b5e2,_0x430275,_0x5a0341);break;default:console[_0x519a('0x19')]('unknown\x20integration');}}else{_0x29f9fb=require(_0x519a('0x1f'))(_0x5b84bf['data1'][_0x519a('0x13')]());_0x29f9fb['error'](_0x519a('0x20'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x5b84bf[_0x519a('0x12')][_0x519a('0x13')](),_0x5b84bf[_0x519a('0x15')]));}}else{_0x29f9fb=require(_0x519a('0x1f'))(_0x5b84bf[_0x519a('0x12')][_0x519a('0x13')]());_0x29f9fb[_0x519a('0x21')](_0x519a('0x20'),util[_0x519a('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x5b84bf[_0x519a('0x12')][_0x519a('0x13')](),_0x5b84bf[_0x519a('0x23')]));}}else{}}catch(_0xae0ab0){console['error'](_0xae0ab0);}}}}; \ 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 8cb42d7..0b2e396 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 _0x8fe3=['IsReminderSet','endUserType','contact','lead','WhoId','WhatId','ContactId','account','AccountId','leadId','info','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','Company','No\x20Company','','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','remoteUri','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','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','toUpperCase','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','getString','Subjects','ticketType','Task','ActivityDate'];(function(_0x4c2591,_0x542313){var _0x378228=function(_0x3ea6e9){while(--_0x3ea6e9){_0x4c2591['push'](_0x4c2591['shift']());}};_0x378228(++_0x542313);}(_0x8fe3,0xe7));var _0x38fe=function(_0x34600a,_0x2d2d86){_0x34600a=_0x34600a-0x0;var _0x1af9af=_0x8fe3[_0x34600a];return _0x1af9af;};'use strict';var _=require(_0x38fe('0x0'));var rp=require(_0x38fe('0x1'));var moment=require(_0x38fe('0x2'));var BPromise=require(_0x38fe('0x3'));var md5=require(_0x38fe('0x4'));var jsforce=require(_0x38fe('0x5'));var util=require('util');var Redis=require(_0x38fe('0x6'));var intUtil=require(_0x38fe('0x7'));var config=require(_0x38fe('0x8'));var logger=require(_0x38fe('0x9'))('salesforce');config[_0x38fe('0xa')]=_[_0x38fe('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x38fe('0xa')]));function emit(_0x597f6b,_0x54730f,_0x11f990){io['to'](_0x597f6b)['emit'](_0x54730f,_0x11f990);}function getTicket(_0x433072,_0x52e633,_0x425b09,_0x4c8fdf,_0x11b351,_0x3bbb70,_0x3420a3,_0x461bbf){var _0x110c54=Object['assign']({},{'OwnerId':_0x52e633['id'],'Subject':intUtil[_0x38fe('0xc')](_0x4c8fdf[_0x38fe('0xd')],_0x11b351,'\x20'),'Description':intUtil[_0x38fe('0xc')](_0x4c8fdf['Descriptions'],_0x11b351,'\x0a')},getCustomFields(_0x3bbb70,_0x11b351));if(_0x425b09){if(_0x4c8fdf[_0x38fe('0xe')]===_0x38fe('0xf')){_0x110c54[_0x38fe('0x10')]=moment['utc']();_0x110c54[_0x38fe('0x11')]=![];_0x110c54['IsRecurrence']=![];if(_0x425b09[_0x38fe('0x12')]===_0x38fe('0x13')||_0x425b09[_0x38fe('0x12')]===_0x38fe('0x14')){_0x110c54[_0x38fe('0x15')]=_0x425b09['id'];}else if(_0x425b09[_0x38fe('0x12')]==='account'){_0x110c54[_0x38fe('0x16')]=_0x425b09['id'];}}else if(_0x4c8fdf[_0x38fe('0xe')]==='Case'){if(_0x425b09[_0x38fe('0x12')]==='contact'){_0x110c54[_0x38fe('0x17')]=_0x425b09['id'];}else if(_0x425b09[_0x38fe('0x12')]===_0x38fe('0x18')){_0x110c54[_0x38fe('0x19')]=_0x425b09['id'];}else if(_0x425b09[_0x38fe('0x12')]==='lead'&&_0x4c8fdf[_0x38fe('0x1a')]){_0x110c54[_0x4c8fdf['leadId']]=_0x425b09['id'];}else{logger[_0x38fe('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3420a3[_0x38fe('0x1c')](_0x4c8fdf[_0x38fe('0xe')])[_0x38fe('0x1d')](_0x110c54);}function getUser(_0x3b124f,_0x4fb921,_0x42a865){if(!_[_0x38fe('0x1e')](_0x4fb921)&&intUtil[_0x38fe('0x1f')](_0x4fb921)){var _0x252344={'Email':_0x4fb921};var _0x24b521={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x42a865['sobject'](_0x38fe('0x20'))[_0x38fe('0x21')](_0x252344,_0x24b521)['execute']()[_0x38fe('0x22')](function(_0x1370b0){if(_0x1370b0[_0x38fe('0x23')]){var _0x103945=_[_0x38fe('0x21')](_0x1370b0,function(_0x23146e){return _0x23146e[_0x38fe('0x24')]===_0x4fb921;});if(_0x103945){logger[_0x38fe('0x1b')]('Agent\x20%s\x20found.',_0x4fb921);return BPromise['resolve']({'id':_0x103945['Id'],'name':_0x103945['Name']});}}else{logger[_0x38fe('0x1b')](_0x38fe('0x25'),_0x4fb921);return _0x42a865[_0x38fe('0x26')]()[_0x38fe('0x22')](function(_0x224c03){return BPromise[_0x38fe('0x27')]({'id':_0x224c03[_0x38fe('0x28')],'name':_0x224c03[_0x38fe('0x29')]});});}});}else{logger['info'](_0x38fe('0x25'),_0x4fb921);return _0x42a865[_0x38fe('0x26')]()[_0x38fe('0x22')](function(_0x1c7429){return BPromise[_0x38fe('0x27')]({'id':_0x1c7429[_0x38fe('0x28')],'name':_0x1c7429[_0x38fe('0x29')]});});}}function getEndUser(_0x10420f,_0x183434,_0x25d553,_0x23a2a7,_0x5860bb){var _0x1726f3={'$or':{'Phone':_0x23a2a7}};var _0x5477f5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x38fe('0x27')]()[_0x38fe('0x22')](function(){logger[_0x38fe('0x1b')](_0x38fe('0x2a'),_0x23a2a7,_0x183434[_0x38fe('0x2b')]);switch(_0x183434[_0x38fe('0x2b')]){case _0x38fe('0x2c'):var _0x222383=_[_0x38fe('0x2d')](_0x1726f3);if(_0x183434[_0x38fe('0x2e')]){var _0x24ee90={};_0x24ee90[_0x183434['additionalSearchContact']]=_0x23a2a7;_[_0x38fe('0x2f')](_0x222383[_0x38fe('0x30')],_0x24ee90);}return _0x5860bb['sobject'](_0x38fe('0x31'))['find'](_0x222383,_0x5477f5)[_0x38fe('0x32')]()['then'](function(_0x38a79b){if(_0x38a79b&&_0x38a79b[_0x38fe('0x23')]){return _0x38a79b;}else{var _0x4767d2=_[_0x38fe('0x2d')](_0x1726f3);if(_0x183434[_0x38fe('0x33')]){var _0x40c447={};_0x40c447[_0x183434['additionalSearchLead']]=_0x23a2a7;_['merge'](_0x4767d2[_0x38fe('0x30')],_0x40c447);}return _0x5860bb[_0x38fe('0x1c')](_0x38fe('0x34'))[_0x38fe('0x21')](_0x4767d2,_0x5477f5);}});case _0x38fe('0x35'):var _0x397c1f=_[_0x38fe('0x2d')](_0x1726f3);if(_0x183434['additionalSearchAccount']){var _0x24ee90={};_0x24ee90[_0x183434[_0x38fe('0x36')]]=_0x23a2a7;_[_0x38fe('0x2f')](_0x397c1f[_0x38fe('0x30')],_0x24ee90);}return _0x5860bb['sobject'](_0x38fe('0x37'))[_0x38fe('0x21')](_0x397c1f,_0x5477f5)['execute']()['then'](function(_0xff6f7f){if(_0xff6f7f&&_0xff6f7f[_0x38fe('0x23')]){return _0xff6f7f;}else{var _0x5e414d=_[_0x38fe('0x2d')](_0x1726f3);if(_0x183434['additionalSearchContact']){var _0x169519={};_0x169519[_0x183434['additionalSearchContact']]=_0x23a2a7;_[_0x38fe('0x2f')](_0x5e414d[_0x38fe('0x30')],_0x169519);}return _0x5860bb[_0x38fe('0x1c')](_0x38fe('0x31'))[_0x38fe('0x21')](_0x5e414d,_0x5477f5)[_0x38fe('0x22')](function(_0x6fb02e){if(_0x6fb02e&&_0x6fb02e['length']){return _0x6fb02e;}else{var _0x4e3148=_[_0x38fe('0x2d')](_0x1726f3);if(_0x183434[_0x38fe('0x33')]){var _0x29fe28={};_0x29fe28[_0x183434[_0x38fe('0x33')]]=_0x23a2a7;_[_0x38fe('0x2f')](_0x4e3148['$or'],_0x29fe28);}return _0x5860bb[_0x38fe('0x1c')](_0x38fe('0x34'))[_0x38fe('0x21')](_0x4e3148,_0x5477f5);}});}});case'contact':var _0x222383=_['cloneDeep'](_0x1726f3);if(_0x183434[_0x38fe('0x2e')]){var _0x24ee90={};_0x24ee90[_0x183434['additionalSearchContact']]=_0x23a2a7;_['merge'](_0x222383[_0x38fe('0x30')],_0x24ee90);}return _0x5860bb[_0x38fe('0x1c')](_0x38fe('0x31'))['find'](_0x222383,_0x5477f5)[_0x38fe('0x32')]();case _0x38fe('0x14'):var _0x227fee=_['cloneDeep'](_0x1726f3);if(_0x183434[_0x38fe('0x33')]){var _0x24ee90={};_0x24ee90[_0x183434[_0x38fe('0x33')]]=_0x23a2a7;_[_0x38fe('0x2f')](_0x227fee['$or'],_0x24ee90);}return _0x5860bb[_0x38fe('0x1c')](_0x38fe('0x34'))[_0x38fe('0x21')](_0x227fee,_0x5477f5);case _0x38fe('0x18'):var _0x397c1f=_['cloneDeep'](_0x1726f3);if(_0x183434[_0x38fe('0x36')]){var _0x24ee90={};_0x24ee90[_0x183434['additionalSearchAccount']]=_0x23a2a7;_[_0x38fe('0x2f')](_0x397c1f[_0x38fe('0x30')],_0x24ee90);}return _0x5860bb['sobject'](_0x38fe('0x37'))[_0x38fe('0x21')](_0x397c1f,_0x5477f5);default:return null;}})['then'](function(_0x848b6c){if(_0x848b6c&&_0x848b6c[_0x38fe('0x23')]){var _0x2f6c13=_[_0x38fe('0x38')](_0x848b6c);if(_0x2f6c13){return BPromise['resolve']({'id':_0x2f6c13['Id'],'name':_0x2f6c13[_0x38fe('0x39')],'phone':_0x2f6c13['Phone'],'endUserType':_0x2f6c13[_0x38fe('0x3a')][_0x38fe('0x3b')][_0x38fe('0x3c')]()});}}})[_0x38fe('0x22')](function(_0x4a270b){if(_0x4a270b){logger[_0x38fe('0x1b')](_0x38fe('0x3d'),_0x4a270b[_0x38fe('0x12')],_0x23a2a7);return BPromise['resolve'](_0x4a270b);}else{logger[_0x38fe('0x1b')](_0x38fe('0x3e'),_0x23a2a7);var _0x5aa6ac={'Phone':_0x23a2a7};if(_0x183434[_0x38fe('0x3f')]){if(_0x183434[_0x38fe('0x3f')]===_0x38fe('0x13')){logger[_0x38fe('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x23a2a7,_0x183434[_0x38fe('0x3f')]);_0x5aa6ac[_0x38fe('0x40')]=_0x25d553!==''?_0x25d553:util[_0x38fe('0x41')]('Caller\x20-\x20%s',_0x23a2a7);}else if(_0x183434[_0x38fe('0x3f')]===_0x38fe('0x14')){logger['info'](_0x38fe('0x42'),_0x23a2a7,_0x183434[_0x38fe('0x3f')]);_0x5aa6ac[_0x38fe('0x40')]=_0x25d553!==''?_0x25d553:util[_0x38fe('0x41')](_0x38fe('0x43'),_0x23a2a7);_0x5aa6ac[_0x38fe('0x44')]=_0x38fe('0x45');}else if(_0x183434['moduleCreate']===_0x38fe('0x18')){logger[_0x38fe('0x1b')](_0x38fe('0x42'),_0x23a2a7,_0x183434['moduleCreate']);_0x5aa6ac['Name']=_0x25d553!==_0x38fe('0x46')?_0x25d553:util[_0x38fe('0x41')](_0x38fe('0x43'),_0x23a2a7);}else{return null;}}return _0x5860bb[_0x38fe('0x1c')](_[_0x38fe('0x47')](_0x183434[_0x38fe('0x3f')]))['create'](_0x5aa6ac)[_0x38fe('0x22')](function(_0x32c7f6){return BPromise[_0x38fe('0x27')]({'id':_0x32c7f6['id'],'endUserType':_0x183434['moduleCreate']});});}});}function getCustomFields(_0x3f4dc2,_0x3800ad){var _0x1eec19={};if(_0x3f4dc2[_0x38fe('0x23')]>0x0){_[_0x38fe('0x48')](_0x3f4dc2,function(_0x107c89){if(_[_0x38fe('0x49')]([_0x38fe('0x4a'),'picklist'],_0x107c89['type'])&&_0x107c89[_0x38fe('0x4b')]){_0x1eec19[_0x107c89[_0x38fe('0x4b')]]=_0x107c89[_0x38fe('0x4c')][_0x38fe('0x4d')]();}else if(_0x107c89[_0x38fe('0x3b')]===_0x38fe('0x4e')&&_0x107c89[_0x38fe('0x4f')]&&_0x107c89[_0x38fe('0x4b')]){_0x3800ad[_0x107c89[_0x38fe('0x4f')]]&&(_0x1eec19[_0x107c89[_0x38fe('0x4b')]]=_0x3800ad[_0x107c89[_0x38fe('0x4f')]][_0x38fe('0x4d')]());}else if(_0x107c89['type']==='customVariable'&&_0x107c89['Variable']&&_0x107c89[_0x38fe('0x50')][_0x38fe('0x51')]&&_0x107c89[_0x38fe('0x4b')]){_0x3800ad[_0x107c89[_0x38fe('0x50')][_0x38fe('0x51')][_0x38fe('0x3c')]()]&&(_0x1eec19[_0x107c89[_0x38fe('0x4b')]]=_0x3800ad[_0x107c89[_0x38fe('0x50')][_0x38fe('0x51')][_0x38fe('0x3c')]()][_0x38fe('0x4d')]());}});}return _0x1eec19;}function getConnection(_0x208c2e){var _0x1af833=_0x208c2e['password'][_0x38fe('0x52')](_0x208c2e[_0x38fe('0x53')]);var _0x5467fe=new jsforce['Connection']({'oauth2':{'loginUrl':_0x208c2e[_0x38fe('0x54')]||'https://login.salesforce.com','clientId':_0x208c2e[_0x38fe('0x55')],'clientSecret':_0x208c2e[_0x38fe('0x56')]}});return _0x5467fe['login'](_0x208c2e['username'],_0x1af833)[_0x38fe('0x22')](function(){logger[_0x38fe('0x1b')](_0x38fe('0x57'));return _0x5467fe;});}exports[_0x38fe('0x58')]=function(_0x2d26fe,_0x54a243,_0x709dae,_0x5ec9c4,_0x28b555,_0x5f4aa5){var _0x8ab8ba,_0x55d209,_0xbe0d10,_0x53c11f;_0x5f4aa5[_0x38fe('0x59')]=intUtil[_0x38fe('0x5a')](_0x5f4aa5[_0x38fe('0x59')]);_0x5f4aa5[_0x38fe('0x54')]=intUtil['stripTrailingSlash'](_0x5f4aa5[_0x38fe('0x54')]);if(_0x28b555&&_0x28b555[_0x38fe('0x5b')]){logger[_0x38fe('0x1b')]('[QUEUE]',_0x38fe('0x5c'));_0x54a243['recordingURL']=util[_0x38fe('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f4aa5['serverUrl'],_0x54a243['uniqueid'],md5(_0x54a243[_0x38fe('0x5d')]));}else{_0x54a243[_0x38fe('0x5e')]='';}return getConnection(_0x5f4aa5)[_0x38fe('0x22')](function(_0x29efbb){_0x53c11f=_0x29efbb;return getUser(_0x5f4aa5,_0x5ec9c4['email'],_0x53c11f);})[_0x38fe('0x22')](function(_0x5d2b06){_0x8ab8ba=_0x5d2b06;return getEndUser(_0x5f4aa5,_0x709dae,_0x54a243['calleridname'],_0x54a243[_0x38fe('0x5f')],_0x53c11f);})[_0x38fe('0x22')](function(_0x1c3624){_0x55d209=_0x1c3624;return getTicket(_0x5f4aa5,_0x8ab8ba,_0x55d209,_0x709dae,_0x54a243,_0x709dae[_0x38fe('0x60')],_0x53c11f,_0x38fe('0x58'));})[_0x38fe('0x22')](function(_0xbfd1b2){_0xbe0d10=_0xbfd1b2;logger[_0x38fe('0x1b')](_0x38fe('0x61'),_0xbe0d10['id']);logger[_0x38fe('0x1b')](_0x38fe('0x62'),_0xbe0d10['id'],_0x5ec9c4[_0x38fe('0x51')],_0x5f4aa5['type']);switch(_0x5f4aa5[_0x38fe('0x3b')]){case _0x38fe('0x63'):emit(util[_0x38fe('0x41')](_0x38fe('0x64'),_0x5ec9c4['name']),_0x38fe('0x65'),{'recordId':_0xbe0d10['id']});break;case _0x38fe('0x66'):emit(util['format'](_0x38fe('0x64'),_0x5ec9c4['name']),_0x38fe('0x67'),{'uri':util[_0x38fe('0x41')](_0x38fe('0x68'),_0x53c11f[_0x38fe('0x69')],_0xbe0d10['id'])});break;default:logger[_0x38fe('0x6a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x38fe('0x6b')](function(_0x4d59cb){logger['error'](_0x38fe('0x6c'),_0x4d59cb);});};exports[_0x38fe('0x6d')]=function(_0x19e2ae,_0x4d1d92,_0x1b9ead,_0x462554,_0x4bae51,_0x3033b6,_0x572b89){var _0x59afd6,_0x4c3133,_0x35a146,_0x72d333;_0x3033b6['serverUrl']=intUtil[_0x38fe('0x5a')](_0x3033b6[_0x38fe('0x59')]);_0x3033b6['remoteUri']=intUtil[_0x38fe('0x5a')](_0x3033b6['remoteUri']);if(_0x572b89&&_0x572b89[_0x38fe('0x6e')]&&_0x572b89[_0x38fe('0x6e')]!=='none'){logger[_0x38fe('0x1b')](_0x38fe('0x6f'),_0x38fe('0x5c'));_0x4d1d92[_0x38fe('0x5e')]=util['format'](_0x38fe('0x70'),_0x3033b6[_0x38fe('0x59')],_0x4d1d92[_0x38fe('0x5d')],md5(_0x4d1d92['uniqueid']));}return getConnection(_0x3033b6)[_0x38fe('0x22')](function(_0x500c26){_0x72d333=_0x500c26;return getUser(_0x3033b6,_0x462554[_0x38fe('0x71')],_0x72d333);})['then'](function(_0x4584e6){_0x59afd6=_0x4584e6;return getEndUser(_0x3033b6,_0x1b9ead,_0x4d1d92[_0x38fe('0x72')],_0x4d1d92[_0x38fe('0x73')],_0x72d333);})['then'](function(_0x5c0dd8){_0x4c3133=_0x5c0dd8;return getTicket(_0x3033b6,_0x59afd6,_0x4c3133,_0x1b9ead,_0x4d1d92,_0x1b9ead[_0x38fe('0x60')],_0x72d333,'outbound');})['then'](function(_0x29e000){_0x35a146=_0x29e000;logger[_0x38fe('0x1b')](_0x38fe('0x74'),_0x35a146['id']);logger[_0x38fe('0x1b')](_0x38fe('0x75'),_0x35a146['id'],_0x462554[_0x38fe('0x51')],_0x3033b6[_0x38fe('0x3b')]);switch(_0x3033b6[_0x38fe('0x3b')]){case _0x38fe('0x63'):emit(util[_0x38fe('0x41')]('user:%s',_0x462554['name']),_0x38fe('0x65'),{'recordId':_0x35a146['id']});break;case _0x38fe('0x66'):emit(util['format'](_0x38fe('0x64'),_0x462554[_0x38fe('0x51')]),'trigger:browser:url',{'uri':util[_0x38fe('0x41')](_0x38fe('0x68'),_0x72d333[_0x38fe('0x69')],_0x35a146['id'])});break;default:logger[_0x38fe('0x6a')]('[OUTBOUND]',_0x38fe('0x76'));}})[_0x38fe('0x6b')](function(_0x2bf10a){logger[_0x38fe('0x6a')](_0x38fe('0x6f'),_0x2bf10a);});};exports['unmanaged']=function(_0x140cda,_0x12b696,_0x87d6b3,_0x17bf73,_0x5a8f46,_0x31a6b7){var _0x329e53,_0x3ea684,_0x3451e5,_0x4fa6c5;_0x31a6b7[_0x38fe('0x59')]=intUtil[_0x38fe('0x5a')](_0x31a6b7[_0x38fe('0x59')]);_0x31a6b7[_0x38fe('0x54')]=intUtil[_0x38fe('0x5a')](_0x31a6b7['remoteUri']);if(_0x5a8f46&&_0x5a8f46[_0x38fe('0x5b')]){logger[_0x38fe('0x1b')]('['+_0x12b696['lastevent'][_0x38fe('0x77')]()+']',_0x38fe('0x5c'));_0x12b696[_0x38fe('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31a6b7[_0x38fe('0x59')],_0x12b696[_0x38fe('0x5d')],md5(_0x12b696[_0x38fe('0x5d')]));}else{_0x12b696[_0x38fe('0x5e')]='';}return getConnection(_0x31a6b7)[_0x38fe('0x22')](function(_0x50634d){_0x4fa6c5=_0x50634d;if(!_[_0x38fe('0x1e')](_0x17bf73)){return getUser(_0x31a6b7,_0x17bf73[_0x38fe('0x51')],_0x4fa6c5);}else{return getUser(_0x31a6b7,null,_0x4fa6c5);}})['then'](function(_0x225a10){_0x329e53=_0x225a10;return getEndUser(_0x31a6b7,_0x87d6b3,_0x12b696[_0x38fe('0x78')],_0x12b696[_0x38fe('0x5f')],_0x4fa6c5);})[_0x38fe('0x22')](function(_0x627dfb){_0x3ea684=_0x627dfb;return getTicket(_0x31a6b7,_0x329e53,_0x3ea684,_0x87d6b3,_0x12b696,_0x87d6b3[_0x38fe('0x60')],_0x4fa6c5);})['then'](function(_0x348911){_0x3451e5=_0x348911;logger[_0x38fe('0x1b')]('['+_0x12b696[_0x38fe('0x79')]['toUpperCase']()+_0x38fe('0x7a'),_0x3451e5['id']);logger[_0x38fe('0x1b')]('['+_0x12b696['lastevent'][_0x38fe('0x77')]()+_0x38fe('0x7b'),_0x31a6b7[_0x38fe('0x3b')]);})[_0x38fe('0x6b')](function(_0x32564f){logger[_0x38fe('0x6a')]('['+_0x12b696[_0x38fe('0x79')][_0x38fe('0x77')]()+']',_0x32564f);});}; \ No newline at end of file +var _0x8fae=['destcalleridname','Fields','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridname',']\x20Ticket\x20%s\x20created.','toUpperCase','moment','bluebird','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','account','WhatId','Case','AccountId','leadId','sobject','create','isNil','find','execute','info','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','then','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','account_contact_lead','additionalSearchAccount','additionalSearchLead','Lead','contact','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','LastName','format','Company','No\x20Company','Caller\x20-\x20%s','upperFirst','forEach','picklist','idField','content','toString','variable','variableName','Variable','name','password','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8fae,0x165));var _0xe8fa=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x8fae[_0x360739];return _0x3e23a1;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xe8fa('0x0'));var BPromise=require(_0xe8fa('0x1'));var md5=require('md5');var jsforce=require(_0xe8fa('0x2'));var util=require(_0xe8fa('0x3'));var Redis=require(_0xe8fa('0x4'));var intUtil=require('./util');var config=require(_0xe8fa('0x5'));var logger=require('../../../../config/logger')(_0xe8fa('0x6'));config[_0xe8fa('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe8fa('0x8'))(new Redis(config[_0xe8fa('0x7')]));function emit(_0x476282,_0x33a238,_0x393b7f){io['to'](_0x476282)[_0xe8fa('0x9')](_0x33a238,_0x393b7f);}function getTicket(_0x11279e,_0xbe7e,_0x306e77,_0x44d980,_0x4a8cab,_0x59f462,_0x2e4f69,_0x37ab43){var _0x2e6814=Object[_0xe8fa('0xa')]({},{'OwnerId':_0xbe7e['id'],'Subject':intUtil[_0xe8fa('0xb')](_0x44d980[_0xe8fa('0xc')],_0x4a8cab,'\x20'),'Description':intUtil[_0xe8fa('0xb')](_0x44d980[_0xe8fa('0xd')],_0x4a8cab,'\x0a')},getCustomFields(_0x59f462,_0x4a8cab));if(_0x306e77){if(_0x44d980[_0xe8fa('0xe')]===_0xe8fa('0xf')){_0x2e6814[_0xe8fa('0x10')]=moment[_0xe8fa('0x11')]();_0x2e6814['IsReminderSet']=![];_0x2e6814[_0xe8fa('0x12')]=![];if(_0x306e77[_0xe8fa('0x13')]==='contact'||_0x306e77[_0xe8fa('0x13')]===_0xe8fa('0x14')){_0x2e6814['WhoId']=_0x306e77['id'];}else if(_0x306e77[_0xe8fa('0x13')]===_0xe8fa('0x15')){_0x2e6814[_0xe8fa('0x16')]=_0x306e77['id'];}}else if(_0x44d980[_0xe8fa('0xe')]===_0xe8fa('0x17')){if(_0x306e77['endUserType']==='contact'){_0x2e6814['ContactId']=_0x306e77['id'];}else if(_0x306e77[_0xe8fa('0x13')]===_0xe8fa('0x15')){_0x2e6814[_0xe8fa('0x18')]=_0x306e77['id'];}else if(_0x306e77['endUserType']===_0xe8fa('0x14')&&_0x44d980[_0xe8fa('0x19')]){_0x2e6814[_0x44d980[_0xe8fa('0x19')]]=_0x306e77['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2e4f69[_0xe8fa('0x1a')](_0x44d980[_0xe8fa('0xe')])[_0xe8fa('0x1b')](_0x2e6814);}function getUser(_0x358200,_0xcaf39a,_0x4ce590){if(!_[_0xe8fa('0x1c')](_0xcaf39a)&&intUtil['validateEmail'](_0xcaf39a)){var _0x1c9987={'Email':_0xcaf39a};var _0x3faca0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ce590[_0xe8fa('0x1a')]('User')[_0xe8fa('0x1d')](_0x1c9987,_0x3faca0)[_0xe8fa('0x1e')]()['then'](function(_0x49b065){if(_0x49b065['length']){var _0x3c26e9=_[_0xe8fa('0x1d')](_0x49b065,function(_0x4547b){return _0x4547b['Email']===_0xcaf39a;});if(_0x3c26e9){logger[_0xe8fa('0x1f')]('Agent\x20%s\x20found.',_0xcaf39a);return BPromise[_0xe8fa('0x20')]({'id':_0x3c26e9['Id'],'name':_0x3c26e9['Name']});}}else{logger[_0xe8fa('0x1f')](_0xe8fa('0x21'),_0xcaf39a);return _0x4ce590[_0xe8fa('0x22')]()['then'](function(_0x2d755a){return BPromise['resolve']({'id':_0x2d755a[_0xe8fa('0x23')],'name':_0x2d755a['display_name']});});}});}else{logger[_0xe8fa('0x1f')](_0xe8fa('0x21'),_0xcaf39a);return _0x4ce590[_0xe8fa('0x22')]()[_0xe8fa('0x24')](function(_0x1ed801){return BPromise[_0xe8fa('0x20')]({'id':_0x1ed801[_0xe8fa('0x23')],'name':_0x1ed801[_0xe8fa('0x25')]});});}}function getEndUser(_0x312949,_0x1d6d51,_0x3f493b,_0x22660a,_0x441172){var _0x3bb779={'$or':{'Phone':_0x22660a}};var _0x311c10={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe8fa('0x20')]()['then'](function(){logger[_0xe8fa('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x22660a,_0x1d6d51[_0xe8fa('0x26')]);switch(_0x1d6d51[_0xe8fa('0x26')]){case _0xe8fa('0x27'):var _0x466b81=_[_0xe8fa('0x28')](_0x3bb779);if(_0x1d6d51[_0xe8fa('0x29')]){var _0x108ff2={};_0x108ff2[_0x1d6d51['additionalSearchContact']]=_0x22660a;_[_0xe8fa('0x2a')](_0x466b81[_0xe8fa('0x2b')],_0x108ff2);}return _0x441172[_0xe8fa('0x1a')](_0xe8fa('0x2c'))['find'](_0x466b81,_0x311c10)['execute']()['then'](function(_0x98bf86){if(_0x98bf86&&_0x98bf86[_0xe8fa('0x2d')]){return _0x98bf86;}else{var _0x5e4899=_[_0xe8fa('0x28')](_0x3bb779);if(_0x1d6d51['additionalSearchLead']){var _0x3e511c={};_0x3e511c[_0x1d6d51['additionalSearchLead']]=_0x22660a;_[_0xe8fa('0x2a')](_0x5e4899[_0xe8fa('0x2b')],_0x3e511c);}return _0x441172[_0xe8fa('0x1a')]('Lead')[_0xe8fa('0x1d')](_0x5e4899,_0x311c10);}});case _0xe8fa('0x2e'):var _0x51ccac=_[_0xe8fa('0x28')](_0x3bb779);if(_0x1d6d51[_0xe8fa('0x2f')]){var _0x108ff2={};_0x108ff2[_0x1d6d51[_0xe8fa('0x2f')]]=_0x22660a;_[_0xe8fa('0x2a')](_0x51ccac[_0xe8fa('0x2b')],_0x108ff2);}return _0x441172[_0xe8fa('0x1a')]('Account')[_0xe8fa('0x1d')](_0x51ccac,_0x311c10)[_0xe8fa('0x1e')]()[_0xe8fa('0x24')](function(_0x5ef74f){if(_0x5ef74f&&_0x5ef74f['length']){return _0x5ef74f;}else{var _0x543216=_['cloneDeep'](_0x3bb779);if(_0x1d6d51[_0xe8fa('0x29')]){var _0x54a5f1={};_0x54a5f1[_0x1d6d51['additionalSearchContact']]=_0x22660a;_['merge'](_0x543216[_0xe8fa('0x2b')],_0x54a5f1);}return _0x441172['sobject'](_0xe8fa('0x2c'))[_0xe8fa('0x1d')](_0x543216,_0x311c10)[_0xe8fa('0x24')](function(_0x4713aa){if(_0x4713aa&&_0x4713aa[_0xe8fa('0x2d')]){return _0x4713aa;}else{var _0x4c86ae=_[_0xe8fa('0x28')](_0x3bb779);if(_0x1d6d51[_0xe8fa('0x30')]){var _0x344d15={};_0x344d15[_0x1d6d51[_0xe8fa('0x30')]]=_0x22660a;_[_0xe8fa('0x2a')](_0x4c86ae[_0xe8fa('0x2b')],_0x344d15);}return _0x441172[_0xe8fa('0x1a')](_0xe8fa('0x31'))['find'](_0x4c86ae,_0x311c10);}});}});case _0xe8fa('0x32'):var _0x466b81=_[_0xe8fa('0x28')](_0x3bb779);if(_0x1d6d51[_0xe8fa('0x29')]){var _0x108ff2={};_0x108ff2[_0x1d6d51['additionalSearchContact']]=_0x22660a;_[_0xe8fa('0x2a')](_0x466b81['$or'],_0x108ff2);}return _0x441172[_0xe8fa('0x1a')](_0xe8fa('0x2c'))[_0xe8fa('0x1d')](_0x466b81,_0x311c10)[_0xe8fa('0x1e')]();case _0xe8fa('0x14'):var _0x24d3b9=_[_0xe8fa('0x28')](_0x3bb779);if(_0x1d6d51['additionalSearchLead']){var _0x108ff2={};_0x108ff2[_0x1d6d51[_0xe8fa('0x30')]]=_0x22660a;_['merge'](_0x24d3b9[_0xe8fa('0x2b')],_0x108ff2);}return _0x441172[_0xe8fa('0x1a')]('Lead')[_0xe8fa('0x1d')](_0x24d3b9,_0x311c10);case _0xe8fa('0x15'):var _0x51ccac=_['cloneDeep'](_0x3bb779);if(_0x1d6d51['additionalSearchAccount']){var _0x108ff2={};_0x108ff2[_0x1d6d51['additionalSearchAccount']]=_0x22660a;_['merge'](_0x51ccac[_0xe8fa('0x2b')],_0x108ff2);}return _0x441172[_0xe8fa('0x1a')](_0xe8fa('0x33'))[_0xe8fa('0x1d')](_0x51ccac,_0x311c10);default:return null;}})[_0xe8fa('0x24')](function(_0x20b293){if(_0x20b293&&_0x20b293[_0xe8fa('0x2d')]){var _0x407826=_[_0xe8fa('0x34')](_0x20b293);if(_0x407826){return BPromise[_0xe8fa('0x20')]({'id':_0x407826['Id'],'name':_0x407826[_0xe8fa('0x35')],'phone':_0x407826[_0xe8fa('0x36')],'endUserType':_0x407826[_0xe8fa('0x37')][_0xe8fa('0x38')][_0xe8fa('0x39')]()});}}})[_0xe8fa('0x24')](function(_0x1a26c2){if(_0x1a26c2){logger[_0xe8fa('0x1f')](_0xe8fa('0x3a'),_0x1a26c2[_0xe8fa('0x13')],_0x22660a);return BPromise['resolve'](_0x1a26c2);}else{logger[_0xe8fa('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x22660a);var _0x33dfd7={'Phone':_0x22660a};if(_0x1d6d51[_0xe8fa('0x3b')]){if(_0x1d6d51['moduleCreate']===_0xe8fa('0x32')){logger[_0xe8fa('0x1f')](_0xe8fa('0x3c'),_0x22660a,_0x1d6d51[_0xe8fa('0x3b')]);_0x33dfd7['LastName']=_0x3f493b!==_0xe8fa('0x3d')?_0x3f493b:util['format']('Caller\x20-\x20%s',_0x22660a);}else if(_0x1d6d51[_0xe8fa('0x3b')]==='lead'){logger[_0xe8fa('0x1f')](_0xe8fa('0x3c'),_0x22660a,_0x1d6d51[_0xe8fa('0x3b')]);_0x33dfd7[_0xe8fa('0x3e')]=_0x3f493b!==_0xe8fa('0x3d')?_0x3f493b:util[_0xe8fa('0x3f')]('Caller\x20-\x20%s',_0x22660a);_0x33dfd7[_0xe8fa('0x40')]=_0xe8fa('0x41');}else if(_0x1d6d51[_0xe8fa('0x3b')]==='account'){logger[_0xe8fa('0x1f')](_0xe8fa('0x3c'),_0x22660a,_0x1d6d51[_0xe8fa('0x3b')]);_0x33dfd7[_0xe8fa('0x35')]=_0x3f493b!==_0xe8fa('0x3d')?_0x3f493b:util[_0xe8fa('0x3f')](_0xe8fa('0x42'),_0x22660a);}else{return null;}}return _0x441172[_0xe8fa('0x1a')](_[_0xe8fa('0x43')](_0x1d6d51[_0xe8fa('0x3b')]))[_0xe8fa('0x1b')](_0x33dfd7)['then'](function(_0x5a03be){return BPromise[_0xe8fa('0x20')]({'id':_0x5a03be['id'],'endUserType':_0x1d6d51['moduleCreate']});});}});}function getCustomFields(_0x55b3e7,_0xdef844){var _0x461a37={};if(_0x55b3e7['length']>0x0){_[_0xe8fa('0x44')](_0x55b3e7,function(_0x95ab84){if(_['includes'](['string',_0xe8fa('0x45')],_0x95ab84[_0xe8fa('0x38')])&&_0x95ab84[_0xe8fa('0x46')]){_0x461a37[_0x95ab84[_0xe8fa('0x46')]]=_0x95ab84[_0xe8fa('0x47')][_0xe8fa('0x48')]();}else if(_0x95ab84[_0xe8fa('0x38')]===_0xe8fa('0x49')&&_0x95ab84[_0xe8fa('0x4a')]&&_0x95ab84[_0xe8fa('0x46')]){_0xdef844[_0x95ab84[_0xe8fa('0x4a')]]&&(_0x461a37[_0x95ab84['idField']]=_0xdef844[_0x95ab84['variableName']][_0xe8fa('0x48')]());}else if(_0x95ab84['type']==='customVariable'&&_0x95ab84[_0xe8fa('0x4b')]&&_0x95ab84[_0xe8fa('0x4b')][_0xe8fa('0x4c')]&&_0x95ab84[_0xe8fa('0x46')]){_0xdef844[_0x95ab84[_0xe8fa('0x4b')][_0xe8fa('0x4c')]['toLowerCase']()]&&(_0x461a37[_0x95ab84[_0xe8fa('0x46')]]=_0xdef844[_0x95ab84[_0xe8fa('0x4b')][_0xe8fa('0x4c')]['toLowerCase']()]['toString']());}});}return _0x461a37;}function getConnection(_0x470cd2){var _0x10e9fc=_0x470cd2[_0xe8fa('0x4d')]['concat'](_0x470cd2['securityToken']);var _0x39c647=new jsforce['Connection']({'oauth2':{'loginUrl':_0x470cd2[_0xe8fa('0x4e')]||_0xe8fa('0x4f'),'clientId':_0x470cd2[_0xe8fa('0x50')],'clientSecret':_0x470cd2[_0xe8fa('0x51')]}});return _0x39c647[_0xe8fa('0x52')](_0x470cd2[_0xe8fa('0x53')],_0x10e9fc)[_0xe8fa('0x24')](function(){logger[_0xe8fa('0x1f')](_0xe8fa('0x54'));return _0x39c647;});}exports['queue']=function(_0x38e4fc,_0x473a88,_0x53f005,_0x1a597d,_0x307268,_0x4ec99d){var _0x122bcd,_0x5e47da,_0x29441f,_0xd5a49d;_0x4ec99d[_0xe8fa('0x55')]=intUtil[_0xe8fa('0x56')](_0x4ec99d[_0xe8fa('0x55')]);_0x4ec99d['remoteUri']=intUtil[_0xe8fa('0x56')](_0x4ec99d[_0xe8fa('0x4e')]);if(_0x307268&&_0x307268['monitor_format']){logger[_0xe8fa('0x1f')](_0xe8fa('0x57'),'Recording\x20is\x20enabled!');_0x473a88[_0xe8fa('0x58')]=util[_0xe8fa('0x3f')](_0xe8fa('0x59'),_0x4ec99d[_0xe8fa('0x55')],_0x473a88['uniqueid'],md5(_0x473a88[_0xe8fa('0x5a')]));}else{_0x473a88['recordingURL']='';}return getConnection(_0x4ec99d)[_0xe8fa('0x24')](function(_0x59cc42){_0xd5a49d=_0x59cc42;return getUser(_0x4ec99d,_0x1a597d['email'],_0xd5a49d);})[_0xe8fa('0x24')](function(_0x406ff7){_0x122bcd=_0x406ff7;return getEndUser(_0x4ec99d,_0x53f005,_0x473a88['calleridname'],_0x473a88[_0xe8fa('0x5b')],_0xd5a49d);})[_0xe8fa('0x24')](function(_0x4b3dff){_0x5e47da=_0x4b3dff;return getTicket(_0x4ec99d,_0x122bcd,_0x5e47da,_0x53f005,_0x473a88,_0x53f005['Fields'],_0xd5a49d,_0xe8fa('0x5c'));})[_0xe8fa('0x24')](function(_0x4e07a4){_0x29441f=_0x4e07a4;logger[_0xe8fa('0x1f')](_0xe8fa('0x5d'),_0x29441f['id']);logger[_0xe8fa('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x29441f['id'],_0x1a597d['name'],_0x4ec99d[_0xe8fa('0x38')]);switch(_0x4ec99d['type']){case _0xe8fa('0x5e'):emit(util[_0xe8fa('0x3f')](_0xe8fa('0x5f'),_0x1a597d[_0xe8fa('0x4c')]),_0xe8fa('0x60'),{'recordId':_0x29441f['id']});break;case _0xe8fa('0x61'):emit(util[_0xe8fa('0x3f')](_0xe8fa('0x5f'),_0x1a597d[_0xe8fa('0x4c')]),_0xe8fa('0x62'),{'uri':util[_0xe8fa('0x3f')](_0xe8fa('0x63'),_0xd5a49d[_0xe8fa('0x64')],_0x29441f['id'])});break;default:logger[_0xe8fa('0x65')](_0xe8fa('0x66'));}})[_0xe8fa('0x67')](function(_0x46f8c8){logger[_0xe8fa('0x65')]('[QUEUE]',_0x46f8c8);});};exports[_0xe8fa('0x68')]=function(_0x572503,_0x3d0173,_0x5eb1d7,_0x55e5e3,_0x1efc7d,_0x3a27e8,_0x3d4aed){var _0x131478,_0x54221,_0x72007e,_0x1540e5;_0x3a27e8[_0xe8fa('0x55')]=intUtil[_0xe8fa('0x56')](_0x3a27e8['serverUrl']);_0x3a27e8[_0xe8fa('0x4e')]=intUtil[_0xe8fa('0x56')](_0x3a27e8[_0xe8fa('0x4e')]);if(_0x3d4aed&&_0x3d4aed['recordingFormat']&&_0x3d4aed[_0xe8fa('0x69')]!==_0xe8fa('0x6a')){logger[_0xe8fa('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3d0173[_0xe8fa('0x58')]=util['format'](_0xe8fa('0x59'),_0x3a27e8[_0xe8fa('0x55')],_0x3d0173[_0xe8fa('0x5a')],md5(_0x3d0173['uniqueid']));}return getConnection(_0x3a27e8)[_0xe8fa('0x24')](function(_0x59f47a){_0x1540e5=_0x59f47a;return getUser(_0x3a27e8,_0x55e5e3['email'],_0x1540e5);})['then'](function(_0x39f65a){_0x131478=_0x39f65a;return getEndUser(_0x3a27e8,_0x5eb1d7,_0x3d0173[_0xe8fa('0x6b')],_0x3d0173['destcalleridnum'],_0x1540e5);})[_0xe8fa('0x24')](function(_0x52231d){_0x54221=_0x52231d;return getTicket(_0x3a27e8,_0x131478,_0x54221,_0x5eb1d7,_0x3d0173,_0x5eb1d7[_0xe8fa('0x6c')],_0x1540e5,_0xe8fa('0x68'));})[_0xe8fa('0x24')](function(_0x33070f){_0x72007e=_0x33070f;logger[_0xe8fa('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x72007e['id']);logger[_0xe8fa('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x72007e['id'],_0x55e5e3[_0xe8fa('0x4c')],_0x3a27e8[_0xe8fa('0x38')]);switch(_0x3a27e8[_0xe8fa('0x38')]){case'integrationTab':emit(util[_0xe8fa('0x3f')]('user:%s',_0x55e5e3['name']),_0xe8fa('0x60'),{'recordId':_0x72007e['id']});break;case'newTab':emit(util[_0xe8fa('0x3f')](_0xe8fa('0x5f'),_0x55e5e3[_0xe8fa('0x4c')]),_0xe8fa('0x62'),{'uri':util[_0xe8fa('0x3f')](_0xe8fa('0x63'),_0x1540e5[_0xe8fa('0x64')],_0x72007e['id'])});break;default:logger[_0xe8fa('0x65')](_0xe8fa('0x6d'),_0xe8fa('0x6e'));}})[_0xe8fa('0x67')](function(_0x508d14){logger['error'](_0xe8fa('0x6d'),_0x508d14);});};exports[_0xe8fa('0x6f')]=function(_0xef0520,_0x1993bb,_0x10b9ad,_0x2010b9,_0x9986f6,_0x4f1983){var _0x5e693d,_0x15c7bb,_0x26934b,_0x3a8077;_0x4f1983[_0xe8fa('0x55')]=intUtil['stripTrailingSlash'](_0x4f1983[_0xe8fa('0x55')]);_0x4f1983[_0xe8fa('0x4e')]=intUtil[_0xe8fa('0x56')](_0x4f1983[_0xe8fa('0x4e')]);if(_0x9986f6&&_0x9986f6['monitor_format']){logger[_0xe8fa('0x1f')]('['+_0x1993bb[_0xe8fa('0x70')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1993bb[_0xe8fa('0x58')]=util['format'](_0xe8fa('0x59'),_0x4f1983['serverUrl'],_0x1993bb[_0xe8fa('0x5a')],md5(_0x1993bb[_0xe8fa('0x5a')]));}else{_0x1993bb[_0xe8fa('0x58')]='';}return getConnection(_0x4f1983)[_0xe8fa('0x24')](function(_0x3a165d){_0x3a8077=_0x3a165d;if(!_[_0xe8fa('0x1c')](_0x2010b9)){return getUser(_0x4f1983,_0x2010b9[_0xe8fa('0x4c')],_0x3a8077);}else{return getUser(_0x4f1983,null,_0x3a8077);}})[_0xe8fa('0x24')](function(_0x1dcdd7){_0x5e693d=_0x1dcdd7;return getEndUser(_0x4f1983,_0x10b9ad,_0x1993bb[_0xe8fa('0x71')],_0x1993bb[_0xe8fa('0x5b')],_0x3a8077);})['then'](function(_0x316147){_0x15c7bb=_0x316147;return getTicket(_0x4f1983,_0x5e693d,_0x15c7bb,_0x10b9ad,_0x1993bb,_0x10b9ad[_0xe8fa('0x6c')],_0x3a8077);})['then'](function(_0x4cf3d3){_0x26934b=_0x4cf3d3;logger[_0xe8fa('0x1f')]('['+_0x1993bb[_0xe8fa('0x70')]['toUpperCase']()+_0xe8fa('0x72'),_0x26934b['id']);logger['info']('['+_0x1993bb[_0xe8fa('0x70')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x4f1983['type']);})[_0xe8fa('0x67')](function(_0x51357b){logger[_0xe8fa('0x65')]('['+_0x1993bb['lastevent'][_0xe8fa('0x73')]()+']',_0x51357b);});}; \ 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 249be0c..ae4adfb 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 _0x864a=['%s/api/now/table/','isNil','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','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','customField','nameField','toLowerCase','content','toString','idField','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x1fd675,_0x587658){var _0x521d1c=function(_0x2d16e0){while(--_0x2d16e0){_0x1fd675['push'](_0x1fd675['shift']());}};_0x521d1c(++_0x587658);}(_0x864a,0x172));var _0xa864=function(_0x5acb42,_0x1f64df){_0x5acb42=_0x5acb42-0x0;var _0x5eaa75=_0x864a[_0x5acb42];return _0x5eaa75;};'use strict';var _=require(_0xa864('0x0'));var Promise=require('bluebird');var rp=require(_0xa864('0x1'));var util=require(_0xa864('0x2'));var md5=require(_0xa864('0x3'));var Redis=require(_0xa864('0x4'));var intUtil=require(_0xa864('0x5'));var config=require(_0xa864('0x6'));var logger=require(_0xa864('0x7'))(_0xa864('0x8'));config[_0xa864('0x9')]=_[_0xa864('0xa')](config[_0xa864('0x9')],{'host':_0xa864('0xb'),'port':0x18eb});var io=require(_0xa864('0xc'))(new Redis(config[_0xa864('0x9')]));function getAdminUser(_0x433de4,_0xa31f4,_0x320912,_0xa99a25,_0x3b603e,_0x4600c9){return new Promise(function(_0x5360ff,_0x2abee1){var _0x4a2578={'method':_0xa864('0xd'),'uri':_0xa99a25+_0xa864('0xe')+'&'+_0x3b603e+'&'+_0x4600c9,'auth':_0xa31f4,'json':!![]};return rp(_0x4a2578)['then'](function(_0x2ed8f8){if(_0x2ed8f8['result'][_0xa864('0xf')]>0x0){_0x320912[_0xa864('0x10')]=_0x2ed8f8[_0xa864('0x11')][0x0][_0xa864('0x12')];}logger[_0xa864('0x13')]('['+[_0x433de4['toUpperCase']()]+_0xa864('0x14'),_0x320912);_0x5360ff(_0x320912);})[_0xa864('0x15')](function(_0x502de9){logger[_0xa864('0x16')]('['+[_0x433de4[_0xa864('0x17')]()]+']',_0x502de9[_0xa864('0x18')]);_0x2abee1(_0x502de9['message']);});});}function getUser(_0x4cd99b,_0x58e5b4,_0x1496f7,_0x456e0c,_0x2feb1f){return function(_0x3873db){logger[_0xa864('0x13')]('['+[_0x4cd99b[_0xa864('0x17')]()]+_0xa864('0x19'),_0x3873db);return new Promise(function(_0x55d6e9,_0x37c638){if(intUtil[_0xa864('0x1a')](_0x3873db[_0xa864('0x1b')])){var _0x5d7aeb={'method':_0xa864('0xd'),'uri':_0x1496f7+_0xa864('0x1c')+_0x3873db[_0xa864('0x1b')]+'&'+_0x456e0c+'&'+_0x2feb1f,'auth':_0x58e5b4,'json':!![]};logger[_0xa864('0x13')]('['+[_0x4cd99b[_0xa864('0x17')]()]+_0xa864('0x1d'),_0x5d7aeb);return rp(_0x5d7aeb)[_0xa864('0x1e')](function(_0x2d93e8){logger['info']('['+[_0x4cd99b[_0xa864('0x17')]()]+_0xa864('0x1f'),_0x2d93e8);if(_0x2d93e8['result'][_0xa864('0xf')]>0x0&&String(_0x2d93e8[_0xa864('0x11')][0x0]['active'])===_0xa864('0x20')){_0x3873db[_0xa864('0x21')]=_0x2d93e8[_0xa864('0x11')][0x0]['sys_id'];}else{_0x3873db[_0xa864('0x21')]=_0x3873db[_0xa864('0x10')];_0x3873db[_0xa864('0x1b')]=_0x3873db['adminEmail'];}logger[_0xa864('0x13')]('['+[_0x4cd99b[_0xa864('0x17')]()]+'],\x20getUser\x20crm',_0x3873db);_0x55d6e9(_0x3873db);})[_0xa864('0x15')](function(_0x1c052c){logger[_0xa864('0x16')]('['+[_0x4cd99b[_0xa864('0x17')]()]+']',_0x1c052c[_0xa864('0x18')]);_0x37c638(_0x1c052c[_0xa864('0x18')]);});}else{logger['info']('['+[_0x4cd99b['toUpperCase']()]+_0xa864('0x22'));_0x3873db[_0xa864('0x21')]=_0x3873db['adminId'];_0x3873db['userEmail']=_0x3873db[_0xa864('0x23')];_0x55d6e9(_0x3873db);}});};}function createEndUser(_0x459aaf,_0xf4a8d4,_0x335380,_0x1cef39,_0x3cf51a){logger[_0xa864('0x13')]('['+[_0x459aaf[_0xa864('0x17')]()]+_0xa864('0x24'),_0x335380);return new Promise(function(_0x29e033,_0x2a47a2){var _0x53e3e2={'method':_0xa864('0x25'),'uri':_0x1cef39+_0xa864('0x26')+_0x3cf51a,'body':{'user_name':_0x335380['endUserNumber'],'roles':_0xa864('0x27'),'first_name':_0x335380[_0xa864('0x28')],'active':_0xa864('0x20'),'date_format':'System','phone':_0x335380[_0xa864('0x28')]},'auth':_0xf4a8d4,'json':!![]};return rp(_0x53e3e2)[_0xa864('0x1e')](function(_0xf8e9db){logger[_0xa864('0x13')]('['+[_0x459aaf[_0xa864('0x17')]()]+_0xa864('0x29'),_0xf8e9db[_0xa864('0x11')]);_0x335380[_0xa864('0x2a')]=_0xf8e9db[_0xa864('0x11')][_0xa864('0x12')];_0x29e033(_0x335380);})['catch'](function(_0x4b72ff){logger[_0xa864('0x16')]('['+[_0x459aaf[_0xa864('0x17')]()]+']',_0x4b72ff['message']);_0x2a47a2(_0x4b72ff[_0xa864('0x18')]);});});}function getEndUser(_0x56f52d,_0x150851,_0x5a1906,_0x5f2a0c,_0x3d410c){return function(_0x46eb46){logger[_0xa864('0x13')]('['+[_0x56f52d[_0xa864('0x17')]()]+_0xa864('0x2b'),_0x46eb46);return new Promise(function(_0x26f77b,_0x81f616){var _0x105246={'method':_0xa864('0xd'),'uri':_0x5a1906+_0xa864('0x2c')+_0x46eb46[_0xa864('0x28')]+'&'+_0x5f2a0c+'&'+_0x3d410c,'auth':_0x150851,'json':!![]};return rp(_0x105246)[_0xa864('0x1e')](function(_0x200296){if(_0x200296[_0xa864('0x11')][_0xa864('0xf')]>0x0){_0x46eb46['endUserId']=_0x200296[_0xa864('0x11')][0x0]['sys_id'];logger[_0xa864('0x13')]('['+[_0x56f52d['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x46eb46);_0x26f77b(_0x46eb46);}else{return createEndUser(_0x56f52d,_0x150851,_0x46eb46,_0x5a1906,_0x5f2a0c)[_0xa864('0x1e')](function(_0x35df0f){logger[_0xa864('0x13')]('['+[_0x56f52d[_0xa864('0x17')]()]+_0xa864('0x2d'),_0x35df0f);_0x26f77b(_0x35df0f);});}})[_0xa864('0x15')](function(_0x11ae23){logger['error']('['+[_0x56f52d[_0xa864('0x17')]()]+']',_0x11ae23['message']);_0x81f616(_0x11ae23['message']);});});};}function getCustomFields(_0x4f6d32,_0x2ff80d){var _0xe0fa04={};if(_0x4f6d32[_0xa864('0xf')]>0x0){_[_0xa864('0x2e')](_0x4f6d32,function(_0x23c81e){if(_[_0xa864('0x2f')]([_0xa864('0x30'),'picklist'],_0x23c81e['type'])&&_0x23c81e['nameField']&&!_0x23c81e[_0xa864('0x31')]){_0xe0fa04[_0x23c81e[_0xa864('0x32')][_0xa864('0x33')]()]=_0x23c81e[_0xa864('0x34')][_0xa864('0x35')]();}else if(_[_0xa864('0x2f')]([_0xa864('0x30'),'picklist'],_0x23c81e['type'])&&_0x23c81e[_0xa864('0x36')]&&_0x23c81e[_0xa864('0x31')]){_0xe0fa04[_0x23c81e[_0xa864('0x36')]['toLowerCase']()]=_0x23c81e['content'][_0xa864('0x35')]();}else if(_0x23c81e[_0xa864('0x37')]===_0xa864('0x38')&&_0x23c81e[_0xa864('0x39')]&&_0x23c81e['idField']&&_0x23c81e[_0xa864('0x31')]){_0xe0fa04[_0x23c81e[_0xa864('0x36')]['toLowerCase']()]=_0x2ff80d[_0x23c81e[_0xa864('0x39')]][_0xa864('0x35')]();}else if(_0x23c81e[_0xa864('0x37')]===_0xa864('0x3a')&&_0x23c81e['Variable']&&_0x23c81e[_0xa864('0x3b')][_0xa864('0x3c')]&&_0x23c81e['idField']&&_0x23c81e[_0xa864('0x31')]){_0xe0fa04[_0x23c81e[_0xa864('0x36')][_0xa864('0x33')]()]=_0x2ff80d[_0x23c81e[_0xa864('0x3b')][_0xa864('0x3c')]['toLowerCase']()][_0xa864('0x35')]();}});}return _0xe0fa04;}function getTicket(_0x951226,_0x3e971a,_0x198772,_0x4fba8f,_0x5a02c7,_0x51bbf0){return function(_0x18bc3d){logger['info']('['+[_0x951226[_0xa864('0x17')]()]+_0xa864('0x3d'),_0x18bc3d);return new Promise(function(_0x45cfc2,_0xef7aa9){var _0x463294=_0x951226[_0xa864('0x33')]()===_0xa864('0x3e')?_0x18bc3d[_0xa864('0x21')]:_0x18bc3d['endUserId'];var _0xb3853b={'method':_0xa864('0x25'),'uri':_0x198772+_0xa864('0x3f')+'?'+_0x51bbf0,'body':Object[_0xa864('0x40')]({},{'active':_0xa864('0x20'),'caller_id':_0x463294,'assigned_to':_0x18bc3d[_0xa864('0x21')],'short_description':intUtil['getString'](_0x4fba8f[_0xa864('0x41')],_0x5a02c7,'\x20'),'description':intUtil[_0xa864('0x42')](_0x4fba8f['Descriptions'],_0x5a02c7,'\x0a')},getCustomFields(_0x4fba8f[_0xa864('0x43')],_0x5a02c7)),'auth':_0x3e971a,'json':!![]};return rp(_0xb3853b)[_0xa864('0x1e')](function(_0x11abfc){logger[_0xa864('0x13')]('['+[_0x951226[_0xa864('0x17')]()]+_0xa864('0x44'),_0x11abfc[_0xa864('0x11')]);_0x18bc3d[_0xa864('0x45')]=_0x11abfc[_0xa864('0x11')][_0xa864('0x12')];_0x18bc3d[_0xa864('0x46')]=_0x11abfc['result']['number'];logger[_0xa864('0x13')]('['+[_0x951226['toUpperCase']()]+_0xa864('0x47'),_0x18bc3d);_0x45cfc2(_0x18bc3d);})[_0xa864('0x15')](function(_0x205373){logger[_0xa864('0x16')]('['+[_0x951226['toUpperCase']()]+']',_0x205373[_0xa864('0x18')]);_0xef7aa9(_0x205373['message']);});});};}function createRemoteTag(_0x1eccc4,_0x1214fe,_0xf2ce0b,_0x540d56){return new Promise(function(_0x32740a,_0x54a4a3){var _0x1d5c16={'method':'POST','uri':_0xf2ce0b+'label'+'?'+_0x540d56,'body':{'short_description':_0x1eccc4,'global':!![],'active':!![],'name':_0x1eccc4},'auth':_0x1214fe,'json':!![]};return rp(_0x1d5c16)['then'](function(_0x2b2911){var _0x1362a4=_0x2b2911[_0xa864('0x11')][_0xa864('0x12')];_0x32740a(_0x1362a4);});});}function getRemoteTag(_0x5dc2e4,_0x5bfd19,_0x1f4383,_0x3f143c,_0xcef8fc){return new Promise(function(_0x41e7b0,_0x3a1b2){var _0x481946={'method':'GET','uri':_0x1f4383+_0xa864('0x48')+_0xa864('0x49')+_0x5dc2e4+'&'+_0x3f143c,'auth':_0x5bfd19,'json':!![]};return rp(_0x481946)['then'](function(_0x4b0cf8){if(_0x4b0cf8[_0xa864('0x11')][_0xa864('0xf')]>0x0){var _0x22dcb0=_0x4b0cf8[_0xa864('0x11')][0x0]['sys_id'];_0x41e7b0(_0x22dcb0);}else{return createRemoteTag(_0x5dc2e4,_0x5bfd19,_0x1f4383,_0x3f143c)[_0xa864('0x1e')](function(_0x354d93){_0x41e7b0(_0x354d93);});}});});}function assignTagToIncident(_0x432269,_0x1b9ce5,_0x4750d6,_0x4ebd30,_0x2666ab){return new Promise(function(_0xfcc5ea,_0x2f5d4e){var _0x3ddb90={'method':_0xa864('0x25'),'uri':_0x4750d6+_0xa864('0x4a')+'?'+_0x2666ab,'body':{'label':_0x432269,'table':'incident','id_type':'Incident','table_key':_0x4ebd30[_0xa864('0x45')],'title':_0xa864('0x4b')+_0x4ebd30[_0xa864('0x46')],'id_display':_0x4ebd30[_0xa864('0x46')]},'auth':_0x1b9ce5,'json':!![]};return rp(_0x3ddb90)[_0xa864('0x1e')](function(_0x1dff92){_0xfcc5ea();})[_0xa864('0x15')](function(){_0xfcc5ea();});});}function manageTags(_0x3c2cdf,_0xf97083,_0x53b5a5,_0x35769a,_0x27cd03,_0xed96bb,_0x17e8e5){return new Promise(function(_0x12e0b5,_0xce956f){var _0x12d262=[];_0xf97083[_0xa864('0x2e')](function(_0x370f53){_0x12d262['push'](getRemoteTag(_0x370f53,_0x53b5a5,_0x35769a,_0xed96bb,_0x17e8e5));});return Promise[_0xa864('0x4c')](_0x12d262)[_0xa864('0x1e')](function(_0x11e0b4){if(_0x11e0b4[_0xa864('0xf')]){logger[_0xa864('0x13')]('['+[_0x3c2cdf['toUpperCase']()]+_0xa864('0x4d'),_0x11e0b4);var _0x2da8f5=[];_0x11e0b4[_0xa864('0x2e')](function(_0x1de54b){_0x2da8f5['push'](assignTagToIncident(_0x1de54b,_0x53b5a5,_0x35769a,_0x27cd03,_0xed96bb));});return Promise[_0xa864('0x4c')](_0x2da8f5)['then'](function(){_0x12e0b5();})[_0xa864('0x15')](function(){_0x12e0b5();});}else{_0x12e0b5();}});});}function getTags(_0xbc0365,_0x5c3feb,_0x59aea0,_0x5d3f6f,_0x47c6f0,_0x588f51){return function(_0x2f2e22){return new Promise(function(_0x22bf56,_0xf2bf7a){var _0x38d6a8=[];var _0x5a7b27=_0x5d3f6f[_0xa864('0x4e')];if(_0x5a7b27&&_0x5a7b27[_0xa864('0xf')]>0x0){_0x38d6a8=_[_0xa864('0x4f')](_0x5a7b27,_0xa864('0x3c'));}if(_0x38d6a8['length']>0x0){return manageTags(_0xbc0365,_0x38d6a8,_0x5c3feb,_0x59aea0,_0x2f2e22,_0x47c6f0,_0x588f51)[_0xa864('0x1e')](function(){_0x22bf56(_0x2f2e22);});}else{_0x22bf56(_0x2f2e22);}});};}function emit(_0x27bd8e,_0x5df1a9,_0x3a00d9){var _0x516862=_0xa864('0x50')+_0xa864('0x51')+_0xa864('0x52')+_0xa864('0x53');var _0x2e27fa={'uri':_0x27bd8e+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3a00d9+_0x516862};io['to'](util[_0xa864('0x54')]('user:%s',_0x5df1a9))[_0xa864('0x55')](_0xa864('0x56'),_0x2e27fa);}exports['cs']=function(_0x2b6d74,_0x32602f,_0x4d8fd0,_0x22f8c0,_0x14c2e8,_0x48c4b9,_0xb50c65,_0x1e6717){var _0x138225={};var _0x1b8f18={'user':_0x48c4b9[_0xa864('0x57')],'pass':_0x48c4b9[_0xa864('0x58')]};var _0x11c099=_0xa864('0x59');var _0x4b98b3=_0xa864('0x5a');_0x48c4b9[_0xa864('0x5b')]=intUtil[_0xa864('0x5c')](_0x48c4b9[_0xa864('0x5b')]);_0x48c4b9[_0xa864('0x5d')]=intUtil[_0xa864('0x5c')](_0x48c4b9[_0xa864('0x5d')]);var _0x1ae3c7=util['format'](_0xa864('0x5e'),_0x48c4b9['remoteUri']);_0x138225[_0xa864('0x1b')]=!_[_0xa864('0x5f')](_0x22f8c0)?_0x22f8c0[_0xa864('0x60')]:null;_0x138225['adminEmail']=_0x48c4b9['email'];_0x138225['endUserNumber']=_0x1e6717['toLowerCase']()===_0xa864('0x3e')?_0x32602f[_0xa864('0x61')]:_0x32602f[_0xa864('0x62')];_0x138225[_0xa864('0x63')]=_0x1e6717===_0xa864('0x64')||_0x1e6717==='unmanaged'?_0xa864('0x64'):_0xa864('0x3e');var _0x5e63a9=util[_0xa864('0x54')](_0xa864('0x65'),_0x48c4b9[_0xa864('0x5d')],_0x32602f[_0xa864('0x66')],md5(_0x32602f[_0xa864('0x66')]));if(_0x14c2e8&&_0x14c2e8[_0xa864('0x67')]){logger[_0xa864('0x13')](_0xa864('0x68'),_0xa864('0x69'));_0x32602f[_0xa864('0x6a')]=_0x5e63a9;}else if(_0xb50c65&&_0xb50c65[_0xa864('0x6b')]&&_0xb50c65[_0xa864('0x6b')]!==_0xa864('0x6c')){logger[_0xa864('0x13')](_0xa864('0x6d'),_0xa864('0x69'));_0x32602f[_0xa864('0x6a')]=_0x5e63a9;}else{_0x32602f['recordingURL']='';}return getAdminUser(_0x1e6717,_0x1b8f18,_0x138225,_0x1ae3c7,_0x4b98b3,_0x11c099)['then'](getUser(_0x1e6717,_0x1b8f18,_0x1ae3c7,_0x4b98b3,_0x11c099))['then'](getEndUser(_0x1e6717,_0x1b8f18,_0x1ae3c7,_0x4b98b3,_0x11c099))[_0xa864('0x1e')](getTicket(_0x1e6717,_0x1b8f18,_0x1ae3c7,_0x4d8fd0,_0x32602f,_0x4b98b3))[_0xa864('0x1e')](function(_0x3bbc70){logger[_0xa864('0x13')](util[_0xa864('0x54')](_0xa864('0x6e'),_0x3bbc70[_0xa864('0x45')]));logger[_0xa864('0x13')](util[_0xa864('0x54')](_0xa864('0x6f'),_0x1e6717));if(_0x1e6717!==_0xa864('0x70')){logger[_0xa864('0x13')]('['+[_0x1e6717['toUpperCase']()]+']',_0xa864('0x71'));emit(_0x48c4b9[_0xa864('0x5b')],_0x22f8c0[_0xa864('0x3c')],_0x3bbc70[_0xa864('0x45')]);}})['catch'](function(_0x34d669){logger[_0xa864('0x16')]('['+[_0x1e6717['toUpperCase']()]+_0xa864('0x72'),util[_0xa864('0x73')](_0x34d669,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2838=['recordingFormat','[OUTBOUND]','format','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','POST','user','endUserNumber','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','content','toString','includes','customField','idField','variableName','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL'];(function(_0xe6c19f,_0x5d3910){var _0x5abe41=function(_0x12ae06){while(--_0x12ae06){_0xe6c19f['push'](_0xe6c19f['shift']());}};_0x5abe41(++_0x5d3910);}(_0x2838,0x15e));var _0x8283=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x2838[_0x52121d];return _0x448627;};'use strict';var _=require(_0x8283('0x0'));var Promise=require(_0x8283('0x1'));var rp=require(_0x8283('0x2'));var util=require('util');var md5=require(_0x8283('0x3'));var Redis=require(_0x8283('0x4'));var intUtil=require(_0x8283('0x5'));var config=require(_0x8283('0x6'));var logger=require(_0x8283('0x7'))(_0x8283('0x8'));config['redis']=_['defaults'](config[_0x8283('0x9')],{'host':_0x8283('0xa'),'port':0x18eb});var io=require(_0x8283('0xb'))(new Redis(config[_0x8283('0x9')]));function getAdminUser(_0x385642,_0xf28ddb,_0x15241e,_0x31b84f,_0x439517,_0x7bf23c){return new Promise(function(_0x4da2dd,_0x42c19c){var _0x366a23={'method':_0x8283('0xc'),'uri':_0x31b84f+_0x8283('0xd')+'&'+_0x439517+'&'+_0x7bf23c,'auth':_0xf28ddb,'json':!![]};return rp(_0x366a23)[_0x8283('0xe')](function(_0x81125d){if(_0x81125d[_0x8283('0xf')]['length']>0x0){_0x15241e[_0x8283('0x10')]=_0x81125d[_0x8283('0xf')][0x0][_0x8283('0x11')];}logger[_0x8283('0x12')]('['+[_0x385642[_0x8283('0x13')]()]+_0x8283('0x14'),_0x15241e);_0x4da2dd(_0x15241e);})[_0x8283('0x15')](function(_0x5cd5c4){logger['error']('['+[_0x385642[_0x8283('0x13')]()]+']',_0x5cd5c4[_0x8283('0x16')]);_0x42c19c(_0x5cd5c4['message']);});});}function getUser(_0x407550,_0x3c3ccf,_0x568cfe,_0x36795e,_0x53c36d){return function(_0x5dad54){logger[_0x8283('0x12')]('['+[_0x407550['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x5dad54);return new Promise(function(_0x249d50,_0x857e81){if(intUtil[_0x8283('0x17')](_0x5dad54[_0x8283('0x18')])){var _0x5f2d16={'method':_0x8283('0xc'),'uri':_0x568cfe+_0x8283('0x19')+_0x5dad54['userEmail']+'&'+_0x36795e+'&'+_0x53c36d,'auth':_0x3c3ccf,'json':!![]};logger['info']('['+[_0x407550['toUpperCase']()]+_0x8283('0x1a'),_0x5f2d16);return rp(_0x5f2d16)[_0x8283('0xe')](function(_0x1f7973){logger[_0x8283('0x12')]('['+[_0x407550[_0x8283('0x13')]()]+'],\x20getUser\x20entity',_0x1f7973);if(_0x1f7973[_0x8283('0xf')][_0x8283('0x1b')]>0x0&&String(_0x1f7973[_0x8283('0xf')][0x0][_0x8283('0x1c')])===_0x8283('0x1d')){_0x5dad54[_0x8283('0x1e')]=_0x1f7973[_0x8283('0xf')][0x0]['sys_id'];}else{_0x5dad54[_0x8283('0x1e')]=_0x5dad54[_0x8283('0x10')];_0x5dad54[_0x8283('0x18')]=_0x5dad54[_0x8283('0x1f')];}logger['info']('['+[_0x407550[_0x8283('0x13')]()]+_0x8283('0x20'),_0x5dad54);_0x249d50(_0x5dad54);})[_0x8283('0x15')](function(_0x562daf){logger[_0x8283('0x21')]('['+[_0x407550[_0x8283('0x13')]()]+']',_0x562daf[_0x8283('0x16')]);_0x857e81(_0x562daf[_0x8283('0x16')]);});}else{logger[_0x8283('0x12')]('['+[_0x407550[_0x8283('0x13')]()]+_0x8283('0x22'));_0x5dad54[_0x8283('0x1e')]=_0x5dad54['adminId'];_0x5dad54['userEmail']=_0x5dad54[_0x8283('0x1f')];_0x249d50(_0x5dad54);}});};}function createEndUser(_0x2bc441,_0x1e9e13,_0x32f82b,_0x27ab6f,_0x5b07cd){logger[_0x8283('0x12')]('['+[_0x2bc441[_0x8283('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x32f82b);return new Promise(function(_0x3d6763,_0x430a8f){var _0x130e28={'method':_0x8283('0x23'),'uri':_0x27ab6f+'sys_user?'+_0x5b07cd,'body':{'user_name':_0x32f82b['endUserNumber'],'roles':_0x8283('0x24'),'first_name':_0x32f82b[_0x8283('0x25')],'active':_0x8283('0x1d'),'date_format':_0x8283('0x26'),'phone':_0x32f82b[_0x8283('0x25')]},'auth':_0x1e9e13,'json':!![]};return rp(_0x130e28)[_0x8283('0xe')](function(_0x2db356){logger[_0x8283('0x12')]('['+[_0x2bc441[_0x8283('0x13')]()]+'],\x20EndUser\x20schema',_0x2db356['result']);_0x32f82b['endUserId']=_0x2db356[_0x8283('0xf')][_0x8283('0x11')];_0x3d6763(_0x32f82b);})[_0x8283('0x15')](function(_0x54f0aa){logger['error']('['+[_0x2bc441['toUpperCase']()]+']',_0x54f0aa[_0x8283('0x16')]);_0x430a8f(_0x54f0aa[_0x8283('0x16')]);});});}function getEndUser(_0x5eb4ce,_0x8513e7,_0xa44d28,_0x33afcb,_0x5481ca){return function(_0x55a0ed){logger['info']('['+[_0x5eb4ce['toUpperCase']()]+_0x8283('0x27'),_0x55a0ed);return new Promise(function(_0x5301fc,_0x265521){var _0x276267={'method':_0x8283('0xc'),'uri':_0xa44d28+_0x8283('0x28')+_0x55a0ed[_0x8283('0x25')]+'&'+_0x33afcb+'&'+_0x5481ca,'auth':_0x8513e7,'json':!![]};return rp(_0x276267)[_0x8283('0xe')](function(_0x36fbb3){if(_0x36fbb3[_0x8283('0xf')]['length']>0x0){_0x55a0ed[_0x8283('0x29')]=_0x36fbb3[_0x8283('0xf')][0x0][_0x8283('0x11')];logger['info']('['+[_0x5eb4ce['toUpperCase']()]+_0x8283('0x2a'),_0x55a0ed);_0x5301fc(_0x55a0ed);}else{return createEndUser(_0x5eb4ce,_0x8513e7,_0x55a0ed,_0xa44d28,_0x33afcb)[_0x8283('0xe')](function(_0x4e841b){logger[_0x8283('0x12')]('['+[_0x5eb4ce[_0x8283('0x13')]()]+_0x8283('0x2b'),_0x4e841b);_0x5301fc(_0x4e841b);});}})['catch'](function(_0x3475d1){logger[_0x8283('0x21')]('['+[_0x5eb4ce[_0x8283('0x13')]()]+']',_0x3475d1['message']);_0x265521(_0x3475d1[_0x8283('0x16')]);});});};}function getCustomFields(_0x3be48e,_0xedc6c2){var _0x151554={};if(_0x3be48e['length']>0x0){_[_0x8283('0x2c')](_0x3be48e,function(_0x329e48){if(_['includes']([_0x8283('0x2d'),_0x8283('0x2e')],_0x329e48[_0x8283('0x2f')])&&_0x329e48['nameField']&&!_0x329e48['customField']){_0x151554[_0x329e48[_0x8283('0x30')][_0x8283('0x31')]()]=_0x329e48[_0x8283('0x32')][_0x8283('0x33')]();}else if(_[_0x8283('0x34')]([_0x8283('0x2d'),_0x8283('0x2e')],_0x329e48['type'])&&_0x329e48['idField']&&_0x329e48[_0x8283('0x35')]){_0x151554[_0x329e48[_0x8283('0x36')][_0x8283('0x31')]()]=_0x329e48[_0x8283('0x32')][_0x8283('0x33')]();}else if(_0x329e48[_0x8283('0x2f')]==='variable'&&_0x329e48[_0x8283('0x37')]&&_0x329e48[_0x8283('0x36')]&&_0x329e48[_0x8283('0x35')]){_0x151554[_0x329e48[_0x8283('0x36')][_0x8283('0x31')]()]=_0xedc6c2[_0x329e48[_0x8283('0x37')]][_0x8283('0x33')]();}else if(_0x329e48[_0x8283('0x2f')]==='customVariable'&&_0x329e48[_0x8283('0x38')]&&_0x329e48['Variable'][_0x8283('0x39')]&&_0x329e48['idField']&&_0x329e48[_0x8283('0x35')]){_0x151554[_0x329e48['idField'][_0x8283('0x31')]()]=_0xedc6c2[_0x329e48[_0x8283('0x38')]['name'][_0x8283('0x31')]()][_0x8283('0x33')]();}});}return _0x151554;}function getTicket(_0x1b6c69,_0x2445d7,_0x5aed7a,_0x202af3,_0x28f6bd,_0x253509){return function(_0xc5a735){logger[_0x8283('0x12')]('['+[_0x1b6c69[_0x8283('0x13')]()]+']\x20getTicket\x20input\x20crm',_0xc5a735);return new Promise(function(_0x5839b2,_0x568a51){var _0x4d77f7=_0x1b6c69['toLowerCase']()===_0x8283('0x3a')?_0xc5a735[_0x8283('0x1e')]:_0xc5a735['endUserId'];var _0x52f47f={'method':_0x8283('0x23'),'uri':_0x5aed7a+_0x8283('0x3b')+'?'+_0x253509,'body':Object[_0x8283('0x3c')]({},{'active':_0x8283('0x1d'),'caller_id':_0x4d77f7,'assigned_to':_0xc5a735['userId'],'short_description':intUtil[_0x8283('0x3d')](_0x202af3[_0x8283('0x3e')],_0x28f6bd,'\x20'),'description':intUtil[_0x8283('0x3d')](_0x202af3[_0x8283('0x3f')],_0x28f6bd,'\x0a')},getCustomFields(_0x202af3[_0x8283('0x40')],_0x28f6bd)),'auth':_0x2445d7,'json':!![]};return rp(_0x52f47f)[_0x8283('0xe')](function(_0x483204){logger['info']('['+[_0x1b6c69['toUpperCase']()]+_0x8283('0x41'),_0x483204[_0x8283('0xf')]);_0xc5a735[_0x8283('0x42')]=_0x483204['result'][_0x8283('0x11')];_0xc5a735[_0x8283('0x43')]=_0x483204['result'][_0x8283('0x44')];logger[_0x8283('0x12')]('['+[_0x1b6c69['toUpperCase']()]+_0x8283('0x45'),_0xc5a735);_0x5839b2(_0xc5a735);})[_0x8283('0x15')](function(_0x4fed8d){logger[_0x8283('0x21')]('['+[_0x1b6c69[_0x8283('0x13')]()]+']',_0x4fed8d[_0x8283('0x16')]);_0x568a51(_0x4fed8d['message']);});});};}function createRemoteTag(_0xd90eec,_0xa7d33a,_0x17bb84,_0x158ab3){return new Promise(function(_0x47522e,_0x1100e2){var _0x541365={'method':'POST','uri':_0x17bb84+_0x8283('0x46')+'?'+_0x158ab3,'body':{'short_description':_0xd90eec,'global':!![],'active':!![],'name':_0xd90eec},'auth':_0xa7d33a,'json':!![]};return rp(_0x541365)[_0x8283('0xe')](function(_0x1366f6){var _0x402e7b=_0x1366f6[_0x8283('0xf')][_0x8283('0x11')];_0x47522e(_0x402e7b);});});}function getRemoteTag(_0x3fad4c,_0x588917,_0xb1d3d4,_0x751c72,_0x538896){return new Promise(function(_0x4c3c2d,_0x33d67a){var _0x527041={'method':_0x8283('0xc'),'uri':_0xb1d3d4+_0x8283('0x46')+_0x8283('0x47')+_0x3fad4c+'&'+_0x751c72,'auth':_0x588917,'json':!![]};return rp(_0x527041)[_0x8283('0xe')](function(_0x47119c){if(_0x47119c[_0x8283('0xf')][_0x8283('0x1b')]>0x0){var _0x21cb30=_0x47119c[_0x8283('0xf')][0x0][_0x8283('0x11')];_0x4c3c2d(_0x21cb30);}else{return createRemoteTag(_0x3fad4c,_0x588917,_0xb1d3d4,_0x751c72)[_0x8283('0xe')](function(_0x2088d8){_0x4c3c2d(_0x2088d8);});}});});}function assignTagToIncident(_0x46cc50,_0x5dd5d5,_0x9460fa,_0x5e2828,_0x620415){return new Promise(function(_0x57ce11,_0x5befec){var _0x5b0af1={'method':_0x8283('0x23'),'uri':_0x9460fa+_0x8283('0x48')+'?'+_0x620415,'body':{'label':_0x46cc50,'table':_0x8283('0x3b'),'id_type':'Incident','table_key':_0x5e2828[_0x8283('0x42')],'title':_0x8283('0x49')+_0x5e2828[_0x8283('0x43')],'id_display':_0x5e2828['ticketNumber']},'auth':_0x5dd5d5,'json':!![]};return rp(_0x5b0af1)[_0x8283('0xe')](function(_0x424c6c){_0x57ce11();})['catch'](function(){_0x57ce11();});});}function manageTags(_0x56be5c,_0x500849,_0x446514,_0xea4c0a,_0x32d05b,_0x51e0a9,_0x496f42){return new Promise(function(_0x1351f0,_0x3a6639){var _0x2cda22=[];_0x500849[_0x8283('0x2c')](function(_0x3301a5){_0x2cda22[_0x8283('0x4a')](getRemoteTag(_0x3301a5,_0x446514,_0xea4c0a,_0x51e0a9,_0x496f42));});return Promise[_0x8283('0x4b')](_0x2cda22)[_0x8283('0xe')](function(_0x22d43a){if(_0x22d43a[_0x8283('0x1b')]){logger['info']('['+[_0x56be5c[_0x8283('0x13')]()]+_0x8283('0x4c'),_0x22d43a);var _0x15a8d9=[];_0x22d43a[_0x8283('0x2c')](function(_0x50e063){_0x15a8d9[_0x8283('0x4a')](assignTagToIncident(_0x50e063,_0x446514,_0xea4c0a,_0x32d05b,_0x51e0a9));});return Promise[_0x8283('0x4b')](_0x15a8d9)['then'](function(){_0x1351f0();})['catch'](function(){_0x1351f0();});}else{_0x1351f0();}});});}function getTags(_0x4c7a0d,_0x7da1d1,_0x45c0fa,_0x4b66c0,_0x5b4191,_0x11bbb8){return function(_0x7253e0){return new Promise(function(_0x22a557,_0x3b0f7d){var _0x4b6a16=[];var _0x85470c=_0x4b66c0[_0x8283('0x4d')];if(_0x85470c&&_0x85470c['length']>0x0){_0x4b6a16=_[_0x8283('0x4e')](_0x85470c,_0x8283('0x39'));}if(_0x4b6a16[_0x8283('0x1b')]>0x0){return manageTags(_0x4c7a0d,_0x4b6a16,_0x7da1d1,_0x45c0fa,_0x7253e0,_0x5b4191,_0x11bbb8)[_0x8283('0xe')](function(){_0x22a557(_0x7253e0);});}else{_0x22a557(_0x7253e0);}});};}function emit(_0x50f365,_0x5d845a,_0x307dc5){var _0x2a0bfd=_0x8283('0x4f')+_0x8283('0x50')+_0x8283('0x51')+_0x8283('0x52');var _0x1dc4fe={'uri':_0x50f365+_0x8283('0x53')+_0x307dc5+_0x2a0bfd};io['to'](util['format'](_0x8283('0x54'),_0x5d845a))[_0x8283('0x55')](_0x8283('0x56'),_0x1dc4fe);}exports['cs']=function(_0x316963,_0x219edb,_0x1d1a77,_0x4ac20d,_0x4daa05,_0x4fda44,_0x1aec39,_0x3d1c8b){var _0x4bbb2e={};var _0x3cd55e={'user':_0x4fda44[_0x8283('0x57')],'pass':_0x4fda44[_0x8283('0x58')]};var _0x2e0947=_0x8283('0x59');var _0x4f0217=_0x8283('0x5a');_0x4fda44[_0x8283('0x5b')]=intUtil[_0x8283('0x5c')](_0x4fda44[_0x8283('0x5b')]);_0x4fda44[_0x8283('0x5d')]=intUtil['stripTrailingSlash'](_0x4fda44[_0x8283('0x5d')]);var _0x582d7a=util['format']('%s/api/now/table/',_0x4fda44[_0x8283('0x5b')]);_0x4bbb2e[_0x8283('0x18')]=!_[_0x8283('0x5e')](_0x4ac20d)?_0x4ac20d[_0x8283('0x5f')]:null;_0x4bbb2e[_0x8283('0x1f')]=_0x4fda44[_0x8283('0x5f')];_0x4bbb2e['endUserNumber']=_0x3d1c8b[_0x8283('0x31')]()===_0x8283('0x3a')?_0x219edb[_0x8283('0x60')]:_0x219edb[_0x8283('0x61')];_0x4bbb2e[_0x8283('0x62')]=_0x3d1c8b===_0x8283('0x63')||_0x3d1c8b===_0x8283('0x64')?'queue':_0x8283('0x3a');var _0x25acaa=util['format'](_0x8283('0x65'),_0x4fda44['serverUrl'],_0x219edb[_0x8283('0x66')],md5(_0x219edb[_0x8283('0x66')]));if(_0x4daa05&&_0x4daa05[_0x8283('0x67')]){logger['info']('[QUEUE]',_0x8283('0x68'));_0x219edb[_0x8283('0x69')]=_0x25acaa;}else if(_0x1aec39&&_0x1aec39[_0x8283('0x6a')]&&_0x1aec39[_0x8283('0x6a')]!=='none'){logger[_0x8283('0x12')](_0x8283('0x6b'),_0x8283('0x68'));_0x219edb[_0x8283('0x69')]=_0x25acaa;}else{_0x219edb[_0x8283('0x69')]='';}return getAdminUser(_0x3d1c8b,_0x3cd55e,_0x4bbb2e,_0x582d7a,_0x4f0217,_0x2e0947)[_0x8283('0xe')](getUser(_0x3d1c8b,_0x3cd55e,_0x582d7a,_0x4f0217,_0x2e0947))[_0x8283('0xe')](getEndUser(_0x3d1c8b,_0x3cd55e,_0x582d7a,_0x4f0217,_0x2e0947))[_0x8283('0xe')](getTicket(_0x3d1c8b,_0x3cd55e,_0x582d7a,_0x1d1a77,_0x219edb,_0x4f0217))[_0x8283('0xe')](function(_0x3493cd){logger['info'](util[_0x8283('0x6c')](_0x8283('0x6d'),_0x3493cd[_0x8283('0x42')]));logger['info'](util[_0x8283('0x6c')](_0x8283('0x6e'),_0x3d1c8b));if(_0x3d1c8b!==_0x8283('0x64')){logger[_0x8283('0x12')]('['+[_0x3d1c8b[_0x8283('0x13')]()]+']',_0x8283('0x6f'));emit(_0x4fda44[_0x8283('0x5b')],_0x4ac20d[_0x8283('0x39')],_0x3493cd['ticketId']);}})[_0x8283('0x15')](function(_0x5c0dd6){logger[_0x8283('0x21')]('['+[_0x3d1c8b['toUpperCase']()]+_0x8283('0x70'),util[_0x8283('0x71')](_0x5c0dd6,{'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 abd0f45..161324f 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 _0x18ba=['get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','nameField','toLowerCase','content','string','idField','customField','custom_fields','variable','customVariable','Variable','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','error','monitor_format','The\x20Enduser\x20ID\x20is:','users','lastevent','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','getString','Descriptions','toISOString','slice','replace','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','push','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64'];(function(_0x4e07bd,_0x21ef48){var _0x2dda03=function(_0x5cc1bb){while(--_0x5cc1bb){_0x4e07bd['push'](_0x4e07bd['shift']());}};_0x2dda03(++_0x21ef48);}(_0x18ba,0xcd));var _0xa18b=function(_0x2515bb,_0x20ef8f){_0x2515bb=_0x2515bb-0x0;var _0x201e3b=_0x18ba[_0x2515bb];return _0x201e3b;};'use strict';var _=require(_0xa18b('0x0'));var rp=require(_0xa18b('0x1'));var BPromise=require(_0xa18b('0x2'));var md5=require('md5');var util=require(_0xa18b('0x3'));var Redis=require(_0xa18b('0x4'));var intUtil=require(_0xa18b('0x5'));var config=require(_0xa18b('0x6'));var logger=require(_0xa18b('0x7'))(_0xa18b('0x8'));config[_0xa18b('0x9')]=_[_0xa18b('0xa')](config['redis'],{'host':_0xa18b('0xb'),'port':0x18eb});var io=require(_0xa18b('0xc'))(new Redis(config[_0xa18b('0x9')]));var def={'method':_0xa18b('0xd'),'json':!![]};function emit(_0x4bc9e6,_0x458a31,_0x45e205){io['to'](_0x4bc9e6)['emit'](_0x458a31,_0x45e205);}function getTicket(_0x24e3d6,_0x51fdce,_0x5def84,_0x3cc776,_0x369ad8,_0x1980ea,_0x53940e,_0x288847){logger[_0xa18b('0xe')](_0xa18b('0xf'));var _0x5bd8df=new Date();var _0x10346e=[{'name':_0xa18b('0x10'),'value':intUtil['getString'](_0x3cc776[_0xa18b('0x11')],_0x369ad8,'\x20')},{'name':'assigned_user_id','value':_0x51fdce['id']},{'name':'created_by','value':_0x51fdce['id']},{'name':'description','value':intUtil[_0xa18b('0x12')](_0x3cc776[_0xa18b('0x13')],_0x369ad8,'\x0a')},{'name':'date_start','value':_0x5bd8df[_0xa18b('0x14')]()[_0xa18b('0x15')](0x0,0x13)[_0xa18b('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xa18b('0x17'),'value':'15'},{'name':_0xa18b('0x18'),'value':_0x5def84['id']},{'name':_0xa18b('0x19'),'value':'Contacts'},{'name':_0xa18b('0x1a'),'value':_0x5def84[_0xa18b('0x10')]},{'name':_0xa18b('0x1b'),'value':_0x288847}];if(_0x1980ea[_0xa18b('0x1c')]){_[_0xa18b('0x1d')](_0x1980ea,function(_0x297718){if(_0x369ad8[_0x297718['variableName']]){_0x10346e[_0xa18b('0x1e')]({'name':_0x297718['idField'],'value':_0x369ad8[_0x297718[_0xa18b('0x1f')]]});}});}return request({'form':{'method':_0xa18b('0x20'),'input_type':_0xa18b('0x21'),'response_type':'JSON','rest_data':JSON[_0xa18b('0x22')]({'session':_0x53940e['id'],'module_name':_0xa18b('0x23'),'name_value_list':_0x10346e})}});}function getAuth(_0xc364db){return util[_0xa18b('0x24')](_0xa18b('0x25'),new Buffer(_0xc364db[_0xa18b('0x26')]+':X')[_0xa18b('0x27')](_0xa18b('0x28')));}function getServerInfo(_0x27f447){return request({'form':{'method':_0xa18b('0x29'),'input_type':'JSON','response_type':_0xa18b('0x21'),'rest_data':JSON[_0xa18b('0x22')]({'session':_0x27f447['id']})}});}function getUser(_0x4bf906,_0x31f1e3,_0x293a2a){if(!_[_0xa18b('0x2a')](_0x31f1e3)){logger[_0xa18b('0xe')](_0xa18b('0x2b'),_0x31f1e3);return request({'form':{'method':_0xa18b('0x2c'),'input_type':_0xa18b('0x21'),'response_type':_0xa18b('0x21'),'rest_data':JSON['stringify']({'session':_0x293a2a['id'],'module_name':'Employees','query':util[_0xa18b('0x24')](_0xa18b('0x2d'),_0x31f1e3),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa18b('0x2e')](function(_0x15a5fe){if(_0x15a5fe[_0xa18b('0x2f')][_0xa18b('0x1c')]){var _0x37b634=_[_0xa18b('0x30')](_0x15a5fe['entry_list'],function(_0x584151){return _0x584151['name_value_list'][_0xa18b('0x31')][_0xa18b('0x32')]===_0x31f1e3;});if(_0x37b634){logger['info'](_0xa18b('0x33'));return BPromise[_0xa18b('0x34')]({'id':_0x37b634[_0xa18b('0x35')]['id']['value'],'name':_0x37b634[_0xa18b('0x35')][_0xa18b('0x10')][_0xa18b('0x32')]});}}logger[_0xa18b('0xe')](_0xa18b('0x36'));return BPromise['resolve']({'id':_0x293a2a[_0xa18b('0x35')][_0xa18b('0x37')][_0xa18b('0x32')],'name':_0x293a2a[_0xa18b('0x35')][_0xa18b('0x31')]['value']});});}else{logger['info'](_0xa18b('0x38'));return BPromise[_0xa18b('0x34')]({'id':_0x293a2a['name_value_list'][_0xa18b('0x37')]['value'],'name':_0x293a2a[_0xa18b('0x35')][_0xa18b('0x31')][_0xa18b('0x32')]});}}function getEndUser(_0x594e5d,_0x2623d8,_0x5381fa,_0x66bb92){logger[_0xa18b('0xe')](_0xa18b('0x39'),_0x5381fa);return request({'form':{'method':_0xa18b('0x2c'),'input_type':_0xa18b('0x21'),'response_type':_0xa18b('0x21'),'rest_data':JSON[_0xa18b('0x22')]({'session':_0x66bb92['id'],'module_name':_0xa18b('0x3a'),'query':util[_0xa18b('0x24')](_0xa18b('0x3b'),_0x5381fa),'order_by':'','offset':'0','select_fields':['id',_0xa18b('0x10'),_0xa18b('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x22cb91){if(_0x22cb91['entry_list'][_0xa18b('0x1c')]){var _0x2b862c=_[_0xa18b('0x30')](_0x22cb91[_0xa18b('0x2f')],function(_0xab2d3d){return _0xab2d3d['name_value_list'][_0xa18b('0x3c')][_0xa18b('0x32')]===_0x5381fa;});if(_0x2b862c){logger['info'](_0xa18b('0x3d'));return BPromise['resolve']({'id':_0x2b862c[_0xa18b('0x35')]['id'][_0xa18b('0x32')],'name':_0x2b862c[_0xa18b('0x35')]['name'][_0xa18b('0x32')],'phone':_0x2b862c['name_value_list'][_0xa18b('0x3c')][_0xa18b('0x32')]});}}else{logger[_0xa18b('0xe')](_0xa18b('0x3e'));return request({'form':{'method':_0xa18b('0x20'),'input_type':'JSON','response_type':_0xa18b('0x21'),'rest_data':JSON['stringify']({'session':_0x66bb92['id'],'module_name':_0xa18b('0x3a'),'name_value_list':[{'name':_0xa18b('0x3f'),'value':_0x2623d8!==_0xa18b('0x40')?_0x2623d8:util[_0xa18b('0x24')](_0xa18b('0x41'),_0x5381fa)},{'name':'phone_home','value':_0x5381fa}]})}})[_0xa18b('0x2e')](function(_0x1841ac){logger[_0xa18b('0xe')](_0xa18b('0x42'));return BPromise['resolve']({'id':_0x1841ac['id'],'name':_0x1841ac[_0xa18b('0x2f')][_0xa18b('0x3f')][_0xa18b('0x32')],'phone':_0x1841ac[_0xa18b('0x2f')][_0xa18b('0x3c')]['value']});});}});}function request(_0x2eb833){logger['debug'](_0xa18b('0x43'),JSON[_0xa18b('0x22')](_0x2eb833));return rp(_[_0xa18b('0x44')](def,_0x2eb833));}function getTags(_0x5b5dfe,_0x520573){var _0x38685d=[];if(_0x5b5dfe&&_0x5b5dfe['length']>0x0){_0x38685d=_[_0xa18b('0x45')](_0x5b5dfe,_0x520573);}return _0x38685d;}function getCustomFields(_0x4ac739,_0x345681){var _0x1714ce=[];var _0x5be8ee={'custom_fields':[]};if(_0x4ac739[_0xa18b('0x1c')]>0x0){_['forEach'](_0x4ac739,function(_0x55fc5a){if(_0x55fc5a[_0xa18b('0x46')]==='string'&&_0x55fc5a[_0xa18b('0x47')]&&!_0x55fc5a['customField']){_0x5be8ee[_0x55fc5a[_0xa18b('0x47')][_0xa18b('0x48')]()]=_0x55fc5a[_0xa18b('0x49')]['toString']();}else if(_0x55fc5a[_0xa18b('0x46')]===_0xa18b('0x4a')&&_0x55fc5a[_0xa18b('0x4b')]&&_0x55fc5a[_0xa18b('0x4c')]){_0x5be8ee[_0xa18b('0x4d')][_0xa18b('0x1e')]({'id':_0x55fc5a[_0xa18b('0x4b')],'value':_0x55fc5a['content'][_0xa18b('0x27')]()});}else if(_0x55fc5a[_0xa18b('0x46')]===_0xa18b('0x4e')&&_0x55fc5a[_0xa18b('0x1f')]&&_0x55fc5a[_0xa18b('0x4b')]&&_0x55fc5a[_0xa18b('0x4c')]){_0x345681[_0x55fc5a[_0xa18b('0x1f')]]&&_0x5be8ee[_0xa18b('0x4d')][_0xa18b('0x1e')]({'id':_0x55fc5a[_0xa18b('0x4b')],'value':_0x345681[_0x55fc5a[_0xa18b('0x1f')]][_0xa18b('0x27')]()});}else if(_0x55fc5a[_0xa18b('0x46')]===_0xa18b('0x4f')&&_0x55fc5a['Variable']&&_0x55fc5a[_0xa18b('0x50')][_0xa18b('0x10')]&&_0x55fc5a[_0xa18b('0x4b')]&&_0x55fc5a['customField']){_0x345681[_0x55fc5a['Variable'][_0xa18b('0x10')][_0xa18b('0x48')]()]&&_0x5be8ee[_0xa18b('0x4d')][_0xa18b('0x1e')]({'id':_0x55fc5a[_0xa18b('0x4b')],'value':_0x345681[_0x55fc5a[_0xa18b('0x50')]['name'][_0xa18b('0x48')]()][_0xa18b('0x27')]()});}});}return _0x5be8ee;}function getConnection(_0x127ada){return request({'method':_0xa18b('0xd'),'form':{'method':'login','input_type':_0xa18b('0x21'),'response_type':'JSON','rest_data':JSON[_0xa18b('0x22')]({'user_auth':{'user_name':_0x127ada['username'],'password':_0x127ada[_0xa18b('0x51')],'encryption':_0xa18b('0x52')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xa18b('0x2e')](function(_0x4a7f39){var _0x13cb24=_0x4a7f39;if(_0x13cb24['id']){def[_0xa18b('0x53')]=_0x13cb24['id'];return BPromise['resolve'](_0x13cb24);}else{throw new Error(util[_0xa18b('0x24')](_0xa18b('0x54'),_0x127ada['id']));}});}function setRelationship(_0x1704dc,_0x5c9c75,_0xa737f7,_0x4b3e48){return request({'form':{'method':_0xa18b('0x55'),'input_type':_0xa18b('0x21'),'response_type':_0xa18b('0x21'),'rest_data':JSON[_0xa18b('0x22')]({'session':_0x1704dc['id'],'module_name':_0xa18b('0x23'),'module_id':_0xa737f7['id'],'link_field_name':_0x4b3e48,'related_ids':[_0x5c9c75['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa18b('0x56')]=function(_0x4d4054,_0x5f391d,_0x6079f7,_0x13dc07,_0xaa9476,_0x2318d7){var _0xee06ee,_0x521918,_0x2e7a26,_0x1c7db8;_0x2318d7[_0xa18b('0x57')]=intUtil['stripTrailingSlash'](_0x2318d7[_0xa18b('0x57')]);_0x2318d7[_0xa18b('0x58')]=intUtil[_0xa18b('0x59')](_0x2318d7['serverUrl']);def[_0xa18b('0x5a')]=util[_0xa18b('0x24')](_0xa18b('0x5b'),_0x2318d7['remoteUri']);if(_0xaa9476&&_0xaa9476['monitor_format']){logger[_0xa18b('0xe')](_0xa18b('0x5c'),_0xa18b('0x5d'));_0x5f391d[_0xa18b('0x5e')]=util[_0xa18b('0x24')](_0xa18b('0x5f'),_0x2318d7['serverUrl'],_0x5f391d[_0xa18b('0x60')],md5(_0x5f391d[_0xa18b('0x60')]));}else{_0x5f391d[_0xa18b('0x5e')]='';}return getConnection(_0x2318d7)[_0xa18b('0x2e')](function(_0x3b86fe){_0x1c7db8=_0x3b86fe;return getUser(_0x2318d7,_0x13dc07['name'],_0x1c7db8);})[_0xa18b('0x2e')](function(_0x34e4b9){_0xee06ee=_0x34e4b9;logger[_0xa18b('0xe')](_0xa18b('0x61'),_0xee06ee['id']);return getEndUser(_0x2318d7,_0x5f391d[_0xa18b('0x62')],_0x5f391d['calleridnum'],_0x1c7db8);})[_0xa18b('0x2e')](function(_0x1122bd){_0x521918=_0x1122bd;logger['info']('The\x20Enduser\x20ID\x20is:',_0x521918['id']);return getTicket(_0x2318d7,_0xee06ee,_0x521918,_0x6079f7,_0x5f391d,_0x6079f7[_0xa18b('0x63')],_0x1c7db8,_0xa18b('0x64'));})[_0xa18b('0x2e')](function(_0x4c5048){_0x2e7a26=_0x4c5048;logger[_0xa18b('0xe')]('Ticket\x20created!');logger['info'](_0xa18b('0x65'),_0x2e7a26['id']);return setRelationship(_0x1c7db8,_0xee06ee,_0x2e7a26,'users');})[_0xa18b('0x2e')](function(){return setRelationship(_0x1c7db8,_0x521918,_0x2e7a26,_0xa18b('0x66'));})[_0xa18b('0x2e')](function(){return getServerInfo(_0x1c7db8);})[_0xa18b('0x2e')](function(_0x2756b2){var _0x46f2be=parseInt(_0x2756b2[_0xa18b('0x67')][_0xa18b('0x68')](0x0));var _0x102211=util['format'](_0xa18b('0x69'),_0x2318d7[_0xa18b('0x57')],_0x2e7a26['id']);if(_0x46f2be>0x6){_0x102211=util[_0xa18b('0x24')](_0xa18b('0x6a'),_0x2318d7[_0xa18b('0x57')],_0x2e7a26['id']);}logger[_0xa18b('0xe')](_0xa18b('0x5c'),_0xa18b('0x6b'));emit(util[_0xa18b('0x24')]('user:%s',_0x13dc07[_0xa18b('0x10')]),_0xa18b('0x6c'),{'uri':_0x102211});})[_0xa18b('0x6d')](function(_0x58008a){logger['error']('[QUEUE]',JSON[_0xa18b('0x22')](_0x58008a));});};exports[_0xa18b('0x6e')]=function(_0x18aa05,_0x3cde9f,_0x22325f,_0x59ac6e,_0x542c2c,_0x21e8cf,_0x10e32c){var _0x4178be,_0x4ce1e5,_0x20511b,_0x4cc243;_0x21e8cf['remoteUri']=intUtil[_0xa18b('0x59')](_0x21e8cf['remoteUri']);_0x21e8cf[_0xa18b('0x58')]=intUtil['stripTrailingSlash'](_0x21e8cf['serverUrl']);def[_0xa18b('0x5a')]=util[_0xa18b('0x24')](_0xa18b('0x5b'),_0x21e8cf[_0xa18b('0x57')]);if(_0x10e32c&&_0x10e32c[_0xa18b('0x6f')]&&_0x10e32c[_0xa18b('0x6f')]!==_0xa18b('0x70')){logger[_0xa18b('0xe')](_0xa18b('0x71'),'Recording\x20is\x20enabled!');_0x3cde9f[_0xa18b('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21e8cf['serverUrl'],_0x3cde9f[_0xa18b('0x60')],md5(_0x3cde9f[_0xa18b('0x60')]));}return getConnection(_0x21e8cf)['then'](function(_0x56fcd7){_0x4cc243=_0x56fcd7;return getUser(_0x21e8cf,_0x59ac6e[_0xa18b('0x10')],_0x4cc243);})[_0xa18b('0x2e')](function(_0x515671){_0x4178be=_0x515671;logger['info'](_0xa18b('0x61'),_0x4178be['id']);return getEndUser(_0x21e8cf,_0x3cde9f[_0xa18b('0x72')],_0x3cde9f[_0xa18b('0x73')],_0x4cc243);})['then'](function(_0x7706c1){_0x4ce1e5=_0x7706c1;logger[_0xa18b('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4ce1e5['id']);return getTicket(_0x21e8cf,_0x4178be,_0x4ce1e5,_0x22325f,_0x3cde9f,_0x22325f[_0xa18b('0x63')],_0x4cc243,_0xa18b('0x74'));})[_0xa18b('0x2e')](function(_0x54a74a){_0x20511b=_0x54a74a;logger[_0xa18b('0xe')](_0xa18b('0x75'));logger['info'](_0xa18b('0x65'),_0x20511b['id']);return setRelationship(_0x4cc243,_0x4178be,_0x20511b,'users');})[_0xa18b('0x2e')](function(){return setRelationship(_0x4cc243,_0x4ce1e5,_0x20511b,_0xa18b('0x66'));})[_0xa18b('0x2e')](function(){return getServerInfo(_0x4cc243);})[_0xa18b('0x2e')](function(_0x19ba55){var _0x1abda4=parseInt(_0x19ba55['version'][_0xa18b('0x68')](0x0));var _0x28e677=util[_0xa18b('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x21e8cf['remoteUri'],_0x20511b['id']);if(_0x1abda4>0x6){_0x28e677=util[_0xa18b('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x21e8cf[_0xa18b('0x57')],_0x20511b['id']);}logger[_0xa18b('0xe')](_0xa18b('0x71'),_0xa18b('0x6b'));emit(util[_0xa18b('0x24')]('user:%s',_0x59ac6e[_0xa18b('0x10')]),_0xa18b('0x6c'),{'uri':_0x28e677});})[_0xa18b('0x6d')](function(_0x3c001c){logger[_0xa18b('0x76')](_0xa18b('0x71'),JSON[_0xa18b('0x22')](_0x3c001c));});};exports['unmanaged']=function(_0x250190,_0x52cc82,_0x36272a,_0x3b3152,_0x56b660,_0x55f93a){var _0x4415aa,_0x54ca19,_0x56cf27,_0x12ef79;_0x55f93a[_0xa18b('0x57')]=intUtil[_0xa18b('0x59')](_0x55f93a[_0xa18b('0x57')]);_0x55f93a[_0xa18b('0x58')]=intUtil['stripTrailingSlash'](_0x55f93a[_0xa18b('0x58')]);def['uri']=util[_0xa18b('0x24')](_0xa18b('0x5b'),_0x55f93a['remoteUri']);if(_0x56b660&&_0x56b660[_0xa18b('0x77')]){logger['info']('['+_0x52cc82['lastevent']['toUpperCase']()+']',_0xa18b('0x5d'));_0x52cc82[_0xa18b('0x5e')]=util[_0xa18b('0x24')](_0xa18b('0x5f'),_0x55f93a[_0xa18b('0x58')],_0x52cc82[_0xa18b('0x60')],md5(_0x52cc82[_0xa18b('0x60')]));}else{_0x52cc82[_0xa18b('0x5e')]='';}return getConnection(_0x55f93a)['then'](function(_0x4cecb1){_0x12ef79=_0x4cecb1;if(!_[_0xa18b('0x2a')](_0x3b3152)){return getUser(_0x55f93a,_0x3b3152[_0xa18b('0x10')],_0x12ef79);}else{return getUser(_0x55f93a,null,_0x12ef79);}})[_0xa18b('0x2e')](function(_0x354032){_0x4415aa=_0x354032;logger[_0xa18b('0xe')](_0xa18b('0x61'),_0x4415aa['id']);return getEndUser(_0x55f93a,_0x52cc82[_0xa18b('0x62')],_0x52cc82['calleridnum'],_0x12ef79);})[_0xa18b('0x2e')](function(_0x16d132){_0x54ca19=_0x16d132;logger[_0xa18b('0xe')](_0xa18b('0x78'),_0x54ca19['id']);return getTicket(_0x55f93a,_0x4415aa,_0x54ca19,_0x36272a,_0x52cc82,_0x36272a[_0xa18b('0x63')],_0x12ef79,_0xa18b('0x64'));})[_0xa18b('0x2e')](function(_0x5d21ef){_0x56cf27=_0x5d21ef;logger[_0xa18b('0xe')](_0xa18b('0x75'));logger[_0xa18b('0xe')](_0xa18b('0x65'),_0x56cf27['id']);return setRelationship(_0x12ef79,_0x4415aa,_0x56cf27,_0xa18b('0x79'));})['then'](function(){return setRelationship(_0x12ef79,_0x54ca19,_0x56cf27,_0xa18b('0x66'));})[_0xa18b('0x2e')](function(){return getServerInfo(_0x12ef79);})['catch'](function(_0x49dfdc){logger['error']('['+_0x52cc82[_0xa18b('0x7a')]['toUpperCase']()+']',JSON[_0xa18b('0x22')](_0x49dfdc));});}; \ No newline at end of file +var _0x70d8=['description','Descriptions','date_start','duration_hours','duration_minutes','Contacts','parent_name','length','forEach','push','idField','variableName','JSON','stringify','format','apiKey','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','type','string','nameField','toLowerCase','content','toString','customField','variable','custom_fields','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by'];(function(_0x157430,_0x5b2637){var _0x57e755=function(_0x13a2a8){while(--_0x13a2a8){_0x157430['push'](_0x157430['shift']());}};_0x57e755(++_0x5b2637);}(_0x70d8,0x1b3));var _0x870d=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x70d8[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x870d('0x0'));var rp=require('request-promise');var BPromise=require(_0x870d('0x1'));var md5=require(_0x870d('0x2'));var util=require(_0x870d('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x870d('0x4'));var logger=require(_0x870d('0x5'))(_0x870d('0x6'));config[_0x870d('0x7')]=_['defaults'](config['redis'],{'host':_0x870d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x870d('0x7')]));var def={'method':_0x870d('0x9'),'json':!![]};function emit(_0x29d3a3,_0x2b9fa4,_0x1f99fb){io['to'](_0x29d3a3)[_0x870d('0xa')](_0x2b9fa4,_0x1f99fb);}function getTicket(_0x485756,_0x39b32b,_0x1655a6,_0x14f394,_0x1a9cd6,_0x59583c,_0x40331a,_0x59f245){logger[_0x870d('0xb')](_0x870d('0xc'));var _0x509874=new Date();var _0x49890d=[{'name':_0x870d('0xd'),'value':intUtil['getString'](_0x14f394[_0x870d('0xe')],_0x1a9cd6,'\x20')},{'name':_0x870d('0xf'),'value':_0x39b32b['id']},{'name':_0x870d('0x10'),'value':_0x39b32b['id']},{'name':_0x870d('0x11'),'value':intUtil['getString'](_0x14f394[_0x870d('0x12')],_0x1a9cd6,'\x0a')},{'name':_0x870d('0x13'),'value':_0x509874['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x870d('0x14'),'value':'0'},{'name':_0x870d('0x15'),'value':'15'},{'name':'parent_id','value':_0x1655a6['id']},{'name':'parent_type','value':_0x870d('0x16')},{'name':_0x870d('0x17'),'value':_0x1655a6[_0x870d('0xd')]},{'name':'direction','value':_0x59f245}];if(_0x59583c[_0x870d('0x18')]){_[_0x870d('0x19')](_0x59583c,function(_0x72b70a){if(_0x1a9cd6[_0x72b70a['variableName']]){_0x49890d[_0x870d('0x1a')]({'name':_0x72b70a[_0x870d('0x1b')],'value':_0x1a9cd6[_0x72b70a[_0x870d('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x870d('0x1d'),'response_type':_0x870d('0x1d'),'rest_data':JSON[_0x870d('0x1e')]({'session':_0x40331a['id'],'module_name':'Calls','name_value_list':_0x49890d})}});}function getAuth(_0x22bb33){return util[_0x870d('0x1f')]('Basic\x20%s',new Buffer(_0x22bb33[_0x870d('0x20')]+':X')['toString']('base64'));}function getServerInfo(_0x2d3020){return request({'form':{'method':_0x870d('0x21'),'input_type':_0x870d('0x1d'),'response_type':'JSON','rest_data':JSON[_0x870d('0x1e')]({'session':_0x2d3020['id']})}});}function getUser(_0x2592fb,_0x325abe,_0x2dcd7b){if(!_[_0x870d('0x22')](_0x325abe)){logger['info'](_0x870d('0x23'),_0x325abe);return request({'form':{'method':_0x870d('0x24'),'input_type':_0x870d('0x1d'),'response_type':_0x870d('0x1d'),'rest_data':JSON[_0x870d('0x1e')]({'session':_0x2dcd7b['id'],'module_name':'Employees','query':util[_0x870d('0x1f')](_0x870d('0x25'),_0x325abe),'order_by':'','offset':'0','select_fields':['id',_0x870d('0xd'),_0x870d('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x870d('0x27')](function(_0x4ebb1e){if(_0x4ebb1e[_0x870d('0x28')][_0x870d('0x18')]){var _0x1ffb57=_[_0x870d('0x29')](_0x4ebb1e['entry_list'],function(_0x52035c){return _0x52035c['name_value_list'][_0x870d('0x26')]['value']===_0x325abe;});if(_0x1ffb57){logger[_0x870d('0xb')]('Agent\x20found!');return BPromise[_0x870d('0x2a')]({'id':_0x1ffb57[_0x870d('0x2b')]['id']['value'],'name':_0x1ffb57[_0x870d('0x2b')][_0x870d('0xd')]['value']});}}logger['info'](_0x870d('0x2c'));return BPromise['resolve']({'id':_0x2dcd7b['name_value_list'][_0x870d('0x2d')][_0x870d('0x2e')],'name':_0x2dcd7b['name_value_list'][_0x870d('0x26')]['value']});});}else{logger[_0x870d('0xb')](_0x870d('0x2f'));return BPromise[_0x870d('0x2a')]({'id':_0x2dcd7b[_0x870d('0x2b')][_0x870d('0x2d')][_0x870d('0x2e')],'name':_0x2dcd7b[_0x870d('0x2b')][_0x870d('0x26')]['value']});}}function getEndUser(_0x5bb1f1,_0x2d98a9,_0xdc76d8,_0x4c0da9){logger[_0x870d('0xb')](_0x870d('0x30'),_0xdc76d8);return request({'form':{'method':_0x870d('0x24'),'input_type':_0x870d('0x1d'),'response_type':_0x870d('0x1d'),'rest_data':JSON[_0x870d('0x1e')]({'session':_0x4c0da9['id'],'module_name':_0x870d('0x16'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0xdc76d8),'order_by':'','offset':'0','select_fields':['id',_0x870d('0xd'),_0x870d('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x870d('0x27')](function(_0x23a2ec){if(_0x23a2ec['entry_list'][_0x870d('0x18')]){var _0x1f789d=_['find'](_0x23a2ec[_0x870d('0x28')],function(_0xaf120){return _0xaf120[_0x870d('0x2b')][_0x870d('0x31')]['value']===_0xdc76d8;});if(_0x1f789d){logger[_0x870d('0xb')]('Enduser\x20found!');return BPromise[_0x870d('0x2a')]({'id':_0x1f789d['name_value_list']['id'][_0x870d('0x2e')],'name':_0x1f789d[_0x870d('0x2b')][_0x870d('0xd')][_0x870d('0x2e')],'phone':_0x1f789d[_0x870d('0x2b')][_0x870d('0x31')][_0x870d('0x2e')]});}}else{logger[_0x870d('0xb')](_0x870d('0x32'));return request({'form':{'method':_0x870d('0x33'),'input_type':_0x870d('0x1d'),'response_type':_0x870d('0x1d'),'rest_data':JSON[_0x870d('0x1e')]({'session':_0x4c0da9['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x2d98a9!==''?_0x2d98a9:util[_0x870d('0x1f')](_0x870d('0x34'),_0xdc76d8)},{'name':_0x870d('0x31'),'value':_0xdc76d8}]})}})[_0x870d('0x27')](function(_0x5c7a47){logger[_0x870d('0xb')](_0x870d('0x35'));return BPromise[_0x870d('0x2a')]({'id':_0x5c7a47['id'],'name':_0x5c7a47['entry_list'][_0x870d('0x36')][_0x870d('0x2e')],'phone':_0x5c7a47[_0x870d('0x28')][_0x870d('0x31')]['value']});});}});}function request(_0x4fdaea){logger[_0x870d('0x37')](_0x870d('0x38'),JSON[_0x870d('0x1e')](_0x4fdaea));return rp(_[_0x870d('0x39')](def,_0x4fdaea));}function getTags(_0x1c9f06,_0x6c868e){var _0x22abd3=[];if(_0x1c9f06&&_0x1c9f06[_0x870d('0x18')]>0x0){_0x22abd3=_['map'](_0x1c9f06,_0x6c868e);}return _0x22abd3;}function getCustomFields(_0x47b5ce,_0x43314f){var _0x1ff3a8=[];var _0x3284e3={'custom_fields':[]};if(_0x47b5ce[_0x870d('0x18')]>0x0){_[_0x870d('0x19')](_0x47b5ce,function(_0x594396){if(_0x594396[_0x870d('0x3a')]===_0x870d('0x3b')&&_0x594396[_0x870d('0x3c')]&&!_0x594396['customField']){_0x3284e3[_0x594396[_0x870d('0x3c')][_0x870d('0x3d')]()]=_0x594396[_0x870d('0x3e')][_0x870d('0x3f')]();}else if(_0x594396[_0x870d('0x3a')]===_0x870d('0x3b')&&_0x594396[_0x870d('0x1b')]&&_0x594396[_0x870d('0x40')]){_0x3284e3['custom_fields'][_0x870d('0x1a')]({'id':_0x594396['idField'],'value':_0x594396[_0x870d('0x3e')]['toString']()});}else if(_0x594396['type']===_0x870d('0x41')&&_0x594396['variableName']&&_0x594396[_0x870d('0x1b')]&&_0x594396[_0x870d('0x40')]){_0x43314f[_0x594396['variableName']]&&_0x3284e3[_0x870d('0x42')][_0x870d('0x1a')]({'id':_0x594396['idField'],'value':_0x43314f[_0x594396[_0x870d('0x1c')]][_0x870d('0x3f')]()});}else if(_0x594396[_0x870d('0x3a')]===_0x870d('0x43')&&_0x594396[_0x870d('0x44')]&&_0x594396[_0x870d('0x44')][_0x870d('0xd')]&&_0x594396[_0x870d('0x1b')]&&_0x594396[_0x870d('0x40')]){_0x43314f[_0x594396[_0x870d('0x44')][_0x870d('0xd')][_0x870d('0x3d')]()]&&_0x3284e3['custom_fields'][_0x870d('0x1a')]({'id':_0x594396[_0x870d('0x1b')],'value':_0x43314f[_0x594396['Variable']['name'][_0x870d('0x3d')]()]['toString']()});}});}return _0x3284e3;}function getConnection(_0xc8acb0){return request({'method':'POST','form':{'method':_0x870d('0x45'),'input_type':'JSON','response_type':_0x870d('0x1d'),'rest_data':JSON[_0x870d('0x1e')]({'user_auth':{'user_name':_0xc8acb0[_0x870d('0x46')],'password':_0xc8acb0[_0x870d('0x47')],'encryption':'PLAIN'},'application':_0x870d('0x48')})}})[_0x870d('0x27')](function(_0x268d97){var _0x28e68b=_0x268d97;if(_0x28e68b['id']){def[_0x870d('0x49')]=_0x28e68b['id'];return BPromise[_0x870d('0x2a')](_0x28e68b);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0xc8acb0['id']));}});}function setRelationship(_0x4dbb05,_0x220e8b,_0x198aba,_0x261727){return request({'form':{'method':'set_relationship','input_type':_0x870d('0x1d'),'response_type':'JSON','rest_data':JSON[_0x870d('0x1e')]({'session':_0x4dbb05['id'],'module_name':'Calls','module_id':_0x198aba['id'],'link_field_name':_0x261727,'related_ids':[_0x220e8b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x870d('0x4a')]=function(_0x2b1bfc,_0xebff84,_0x2e596e,_0x13aa66,_0x2f85ad,_0xb68f9f){var _0x228a57,_0x545eb3,_0x487a24,_0x236cb9;_0xb68f9f[_0x870d('0x4b')]=intUtil[_0x870d('0x4c')](_0xb68f9f[_0x870d('0x4b')]);_0xb68f9f[_0x870d('0x4d')]=intUtil['stripTrailingSlash'](_0xb68f9f[_0x870d('0x4d')]);def[_0x870d('0x4e')]=util['format'](_0x870d('0x4f'),_0xb68f9f[_0x870d('0x4b')]);if(_0x2f85ad&&_0x2f85ad[_0x870d('0x50')]){logger[_0x870d('0xb')]('[QUEUE]',_0x870d('0x51'));_0xebff84['recordingURL']=util[_0x870d('0x1f')](_0x870d('0x52'),_0xb68f9f[_0x870d('0x4d')],_0xebff84['uniqueid'],md5(_0xebff84[_0x870d('0x53')]));}else{_0xebff84[_0x870d('0x54')]='';}return getConnection(_0xb68f9f)[_0x870d('0x27')](function(_0x175eb1){_0x236cb9=_0x175eb1;return getUser(_0xb68f9f,_0x13aa66[_0x870d('0xd')],_0x236cb9);})[_0x870d('0x27')](function(_0x3fcd0f){_0x228a57=_0x3fcd0f;logger['info']('The\x20User\x20ID\x20is:',_0x228a57['id']);return getEndUser(_0xb68f9f,_0xebff84[_0x870d('0x55')],_0xebff84[_0x870d('0x56')],_0x236cb9);})[_0x870d('0x27')](function(_0x527ddd){_0x545eb3=_0x527ddd;logger['info'](_0x870d('0x57'),_0x545eb3['id']);return getTicket(_0xb68f9f,_0x228a57,_0x545eb3,_0x2e596e,_0xebff84,_0x2e596e[_0x870d('0x58')],_0x236cb9,_0x870d('0x59'));})[_0x870d('0x27')](function(_0x3a7254){_0x487a24=_0x3a7254;logger[_0x870d('0xb')](_0x870d('0x5a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x487a24['id']);return setRelationship(_0x236cb9,_0x228a57,_0x487a24,_0x870d('0x5b'));})[_0x870d('0x27')](function(){return setRelationship(_0x236cb9,_0x545eb3,_0x487a24,_0x870d('0x5c'));})[_0x870d('0x27')](function(){return getServerInfo(_0x236cb9);})[_0x870d('0x27')](function(_0x599a27){var _0x2ac439=parseInt(_0x599a27[_0x870d('0x5d')][_0x870d('0x5e')](0x0));var _0xccb52e=util[_0x870d('0x1f')](_0x870d('0x5f'),_0xb68f9f['remoteUri'],_0x487a24['id']);if(_0x2ac439>0x6){_0xccb52e=util[_0x870d('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xb68f9f['remoteUri'],_0x487a24['id']);}logger[_0x870d('0xb')](_0x870d('0x60'),_0x870d('0x61'));emit(util['format'](_0x870d('0x62'),_0x13aa66['name']),_0x870d('0x63'),{'uri':_0xccb52e});})[_0x870d('0x64')](function(_0x4a5291){logger[_0x870d('0x65')](_0x870d('0x60'),JSON[_0x870d('0x1e')](_0x4a5291));});};exports['outbound']=function(_0x1d3368,_0x4020d6,_0x30fdb2,_0x124a5b,_0x30c3ac,_0x6c3087,_0x375ebe){var _0x152231,_0x481e4b,_0x1fbb46,_0x53d53f;_0x6c3087[_0x870d('0x4b')]=intUtil['stripTrailingSlash'](_0x6c3087[_0x870d('0x4b')]);_0x6c3087['serverUrl']=intUtil['stripTrailingSlash'](_0x6c3087[_0x870d('0x4d')]);def[_0x870d('0x4e')]=util[_0x870d('0x1f')](_0x870d('0x4f'),_0x6c3087[_0x870d('0x4b')]);if(_0x375ebe&&_0x375ebe['recordingFormat']&&_0x375ebe[_0x870d('0x66')]!==_0x870d('0x67')){logger[_0x870d('0xb')](_0x870d('0x68'),_0x870d('0x51'));_0x4020d6[_0x870d('0x54')]=util['format'](_0x870d('0x52'),_0x6c3087[_0x870d('0x4d')],_0x4020d6[_0x870d('0x53')],md5(_0x4020d6[_0x870d('0x53')]));}return getConnection(_0x6c3087)[_0x870d('0x27')](function(_0x14a99a){_0x53d53f=_0x14a99a;return getUser(_0x6c3087,_0x124a5b['name'],_0x53d53f);})[_0x870d('0x27')](function(_0x2fc6f8){_0x152231=_0x2fc6f8;logger[_0x870d('0xb')](_0x870d('0x69'),_0x152231['id']);return getEndUser(_0x6c3087,_0x4020d6[_0x870d('0x6a')],_0x4020d6[_0x870d('0x6b')],_0x53d53f);})[_0x870d('0x27')](function(_0x1dc1b1){_0x481e4b=_0x1dc1b1;logger['info'](_0x870d('0x57'),_0x481e4b['id']);return getTicket(_0x6c3087,_0x152231,_0x481e4b,_0x30fdb2,_0x4020d6,_0x30fdb2[_0x870d('0x58')],_0x53d53f,_0x870d('0x6c'));})[_0x870d('0x27')](function(_0x7f8741){_0x1fbb46=_0x7f8741;logger[_0x870d('0xb')](_0x870d('0x5a'));logger['info'](_0x870d('0x6d'),_0x1fbb46['id']);return setRelationship(_0x53d53f,_0x152231,_0x1fbb46,_0x870d('0x5b'));})['then'](function(){return setRelationship(_0x53d53f,_0x481e4b,_0x1fbb46,_0x870d('0x5c'));})[_0x870d('0x27')](function(){return getServerInfo(_0x53d53f);})[_0x870d('0x27')](function(_0x1f1a4d){var _0xc11b0e=parseInt(_0x1f1a4d[_0x870d('0x5d')]['charAt'](0x0));var _0x437205=util['format'](_0x870d('0x5f'),_0x6c3087[_0x870d('0x4b')],_0x1fbb46['id']);if(_0xc11b0e>0x6){_0x437205=util[_0x870d('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x6c3087['remoteUri'],_0x1fbb46['id']);}logger['info'](_0x870d('0x68'),_0x870d('0x61'));emit(util[_0x870d('0x1f')](_0x870d('0x62'),_0x124a5b['name']),_0x870d('0x63'),{'uri':_0x437205});})[_0x870d('0x64')](function(_0x503181){logger[_0x870d('0x65')](_0x870d('0x68'),JSON[_0x870d('0x1e')](_0x503181));});};exports[_0x870d('0x6e')]=function(_0x140350,_0xe2e722,_0x300dd1,_0x115364,_0x39620b,_0x854964){var _0x391e16,_0x1f8f22,_0x2f2bd8,_0x25ad1d;_0x854964[_0x870d('0x4b')]=intUtil[_0x870d('0x4c')](_0x854964[_0x870d('0x4b')]);_0x854964['serverUrl']=intUtil[_0x870d('0x4c')](_0x854964[_0x870d('0x4d')]);def[_0x870d('0x4e')]=util[_0x870d('0x1f')](_0x870d('0x4f'),_0x854964[_0x870d('0x4b')]);if(_0x39620b&&_0x39620b[_0x870d('0x50')]){logger['info']('['+_0xe2e722[_0x870d('0x6f')][_0x870d('0x70')]()+']','Recording\x20is\x20enabled!');_0xe2e722[_0x870d('0x54')]=util[_0x870d('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x854964['serverUrl'],_0xe2e722[_0x870d('0x53')],md5(_0xe2e722['uniqueid']));}else{_0xe2e722[_0x870d('0x54')]='';}return getConnection(_0x854964)[_0x870d('0x27')](function(_0x9663ed){_0x25ad1d=_0x9663ed;if(!_[_0x870d('0x22')](_0x115364)){return getUser(_0x854964,_0x115364[_0x870d('0xd')],_0x25ad1d);}else{return getUser(_0x854964,null,_0x25ad1d);}})[_0x870d('0x27')](function(_0x4f9f2){_0x391e16=_0x4f9f2;logger[_0x870d('0xb')](_0x870d('0x69'),_0x391e16['id']);return getEndUser(_0x854964,_0xe2e722['calleridname'],_0xe2e722[_0x870d('0x56')],_0x25ad1d);})[_0x870d('0x27')](function(_0x1553b5){_0x1f8f22=_0x1553b5;logger[_0x870d('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1f8f22['id']);return getTicket(_0x854964,_0x391e16,_0x1f8f22,_0x300dd1,_0xe2e722,_0x300dd1[_0x870d('0x58')],_0x25ad1d,_0x870d('0x59'));})['then'](function(_0x1ba7f1){_0x2f2bd8=_0x1ba7f1;logger[_0x870d('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x2f2bd8['id']);return setRelationship(_0x25ad1d,_0x391e16,_0x2f2bd8,_0x870d('0x5b'));})[_0x870d('0x27')](function(){return setRelationship(_0x25ad1d,_0x1f8f22,_0x2f2bd8,_0x870d('0x5c'));})[_0x870d('0x27')](function(){return getServerInfo(_0x25ad1d);})[_0x870d('0x64')](function(_0x180706){logger[_0x870d('0x65')]('['+_0xe2e722[_0x870d('0x6f')][_0x870d('0x70')]()+']',JSON['stringify'](_0x180706));});}; \ 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 7702fac..895b51b 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 _0x8cdc=['util','getString','sortBy','length','type','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','slice','substring','lastIndexOf','validateEmail','test','lodash'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x8cdc,0xa7));var _0xc8cd=function(_0x55d17b,_0x9aabe8){_0x55d17b=_0x55d17b-0x0;var _0xf6a458=_0x8cdc[_0x55d17b];return _0xf6a458;};'use strict';var _=require(_0xc8cd('0x0'));var util=require(_0xc8cd('0x1'));exports[_0xc8cd('0x2')]=function(_0x5bc653,_0x3209b1,_0xa3cdb){var _0x44e6cc=[];if(_0x5bc653['length']>0x0){var _0x232d2a=_[_0xc8cd('0x3')](_0x5bc653,['id']);for(var _0x404033=0x0;_0x404033<_0x232d2a[_0xc8cd('0x4')];_0x404033++){var _0x198cec=_0x232d2a[_0x404033];if(_0x198cec[_0xc8cd('0x5')]==='string'){_0x44e6cc['push'](_0x198cec['content']);}else if(_0x198cec[_0xc8cd('0x5')]===_0xc8cd('0x6')&&_0x198cec[_0xc8cd('0x7')]){_0x3209b1[_0x198cec[_0xc8cd('0x7')]]&&_0x44e6cc[_0xc8cd('0x8')](_0x3209b1[_0x198cec['variableName']][_0xc8cd('0x9')]());}else if(_0x198cec[_0xc8cd('0x5')]==='customVariable'&&_0x198cec[_0xc8cd('0xa')]&&_0x198cec['Variable'][_0xc8cd('0xb')]){_0x3209b1[_0x198cec['Variable'][_0xc8cd('0xb')][_0xc8cd('0xc')]()]&&_0x44e6cc[_0xc8cd('0x8')](_0x3209b1[_0x198cec[_0xc8cd('0xa')][_0xc8cd('0xb')][_0xc8cd('0xc')]()][_0xc8cd('0x9')]());}else if(_0x198cec[_0xc8cd('0x5')]===_0xc8cd('0xd')){if(_0x198cec[_0xc8cd('0xe')]==='string'&&_0x198cec[_0xc8cd('0xf')]){_0x44e6cc[_0xc8cd('0x8')](util['format']('%s:\x20%s',_0x198cec[_0xc8cd('0xf')],_0x198cec[_0xc8cd('0x10')]));}else if(_0x198cec[_0xc8cd('0xe')]==='variable'&&_0x198cec[_0xc8cd('0x7')]&&_0x198cec[_0xc8cd('0xf')]){_0x3209b1[_0x198cec['variableName']]&&_0x44e6cc[_0xc8cd('0x8')](util[_0xc8cd('0x11')](_0xc8cd('0x12'),_0x198cec['key'],_0x3209b1[_0x198cec[_0xc8cd('0x7')]]));}else if(_0x198cec['keyType']==='customVariable'&&_0x198cec[_0xc8cd('0xa')]&&_0x198cec[_0xc8cd('0xa')]['name']&&_0x198cec[_0xc8cd('0xf')]){_0x3209b1[_0x198cec['Variable'][_0xc8cd('0xb')][_0xc8cd('0xc')]()]&&_0x44e6cc[_0xc8cd('0x8')](util['format']('%s:\x20%s',_0x198cec[_0xc8cd('0xf')],_0x3209b1[_0x198cec[_0xc8cd('0xa')][_0xc8cd('0xb')][_0xc8cd('0xc')]()]));}}}}return _0x44e6cc['join'](_0xa3cdb);};exports['stripTrailingSlash']=function(_0x3c3eea){var _0x31c074=_0x3c3eea[_0xc8cd('0x13')](-0x1);if(_0x31c074==='/'){_0x3c3eea=_0x3c3eea[_0xc8cd('0x14')](0x0,_0x3c3eea[_0xc8cd('0x15')](_0x31c074));}return _0x3c3eea;};exports[_0xc8cd('0x16')]=function(_0x2744ca){if(!_['isNil'](_0x2744ca)&&_0x2744ca!==''){var _0xa8ee26=/^(([^<>()\[\]\\.,;:\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 _0xa8ee26[_0xc8cd('0x17')](String(_0x2744ca)[_0xc8cd('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xf0fe=['validateEmail','test','lodash','util','sortBy','type','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','lastIndexOf'];(function(_0x2410ef,_0x90d86c){var _0x2978fe=function(_0x436975){while(--_0x436975){_0x2410ef['push'](_0x2410ef['shift']());}};_0x2978fe(++_0x90d86c);}(_0xf0fe,0x9e));var _0xef0f=function(_0x1c523b,_0x477243){_0x1c523b=_0x1c523b-0x0;var _0x3d8d40=_0xf0fe[_0x1c523b];return _0x3d8d40;};'use strict';var _=require(_0xef0f('0x0'));var util=require(_0xef0f('0x1'));exports['getString']=function(_0x468845,_0xb996fa,_0x4129f1){var _0x435769=[];if(_0x468845['length']>0x0){var _0x26a4d7=_[_0xef0f('0x2')](_0x468845,['id']);for(var _0x18bda6=0x0;_0x18bda6<_0x26a4d7['length'];_0x18bda6++){var _0x3cceca=_0x26a4d7[_0x18bda6];if(_0x3cceca[_0xef0f('0x3')]==='string'){_0x435769[_0xef0f('0x4')](_0x3cceca[_0xef0f('0x5')]);}else if(_0x3cceca[_0xef0f('0x3')]===_0xef0f('0x6')&&_0x3cceca[_0xef0f('0x7')]){_0xb996fa[_0x3cceca['variableName']]&&_0x435769[_0xef0f('0x4')](_0xb996fa[_0x3cceca[_0xef0f('0x7')]]['toString']());}else if(_0x3cceca['type']===_0xef0f('0x8')&&_0x3cceca[_0xef0f('0x9')]&&_0x3cceca[_0xef0f('0x9')][_0xef0f('0xa')]){_0xb996fa[_0x3cceca[_0xef0f('0x9')][_0xef0f('0xa')][_0xef0f('0xb')]()]&&_0x435769[_0xef0f('0x4')](_0xb996fa[_0x3cceca[_0xef0f('0x9')]['name']['toLowerCase']()][_0xef0f('0xc')]());}else if(_0x3cceca[_0xef0f('0x3')]===_0xef0f('0xd')){if(_0x3cceca[_0xef0f('0xe')]===_0xef0f('0xf')&&_0x3cceca[_0xef0f('0x10')]){_0x435769[_0xef0f('0x4')](util[_0xef0f('0x11')](_0xef0f('0x12'),_0x3cceca[_0xef0f('0x10')],_0x3cceca[_0xef0f('0x13')]));}else if(_0x3cceca['keyType']==='variable'&&_0x3cceca[_0xef0f('0x7')]&&_0x3cceca[_0xef0f('0x10')]){_0xb996fa[_0x3cceca[_0xef0f('0x7')]]&&_0x435769[_0xef0f('0x4')](util['format'](_0xef0f('0x12'),_0x3cceca[_0xef0f('0x10')],_0xb996fa[_0x3cceca['variableName']]));}else if(_0x3cceca[_0xef0f('0xe')]===_0xef0f('0x8')&&_0x3cceca[_0xef0f('0x9')]&&_0x3cceca['Variable'][_0xef0f('0xa')]&&_0x3cceca[_0xef0f('0x10')]){_0xb996fa[_0x3cceca[_0xef0f('0x9')][_0xef0f('0xa')][_0xef0f('0xb')]()]&&_0x435769[_0xef0f('0x4')](util[_0xef0f('0x11')](_0xef0f('0x12'),_0x3cceca[_0xef0f('0x10')],_0xb996fa[_0x3cceca[_0xef0f('0x9')][_0xef0f('0xa')]['toLowerCase']()]));}}}}return _0x435769[_0xef0f('0x14')](_0x4129f1);};exports[_0xef0f('0x15')]=function(_0x2bfd45){var _0x14218b=_0x2bfd45['slice'](-0x1);if(_0x14218b==='/'){_0x2bfd45=_0x2bfd45[_0xef0f('0x16')](0x0,_0x2bfd45[_0xef0f('0x17')](_0x14218b));}return _0x2bfd45;};exports[_0xef0f('0x18')]=function(_0x25111f){if(!_['isNil'](_0x25111f)&&_0x25111f!==''){var _0x3b5212=/^(([^<>()\[\]\\.,;:\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 _0x3b5212[_0xef0f('0x19')](String(_0x25111f)[_0xef0f('0xb')]());}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 6d4ed74..ee03b43 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2d85a5,_0x26861c){var _0x27d75b=function(_0x46c938){while(--_0x46c938){_0x2d85a5['push'](_0x2d85a5['shift']());}};_0x27d75b(++_0x26861c);}(_0xe706,0xa3));var _0x6e70=function(_0x24f66d,_0x261e88){_0x24f66d=_0x24f66d-0x0;var _0x147cdb=_0xe706[_0x24f66d];return _0x147cdb;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index d5548ae..e7a7858 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 _0x152b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','first','Enduser\x20found!','%s/users.json','end-user','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','type','nameField','customField','toLowerCase','content','string','picklist','custom_fields','idField','variable','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x5f1ecb,_0x13c45a){var _0x38d653=function(_0x51a13b){while(--_0x51a13b){_0x5f1ecb['push'](_0x5f1ecb['shift']());}};_0x38d653(++_0x13c45a);}(_0x152b,0x16b));var _0xb152=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x152b[_0x1deee5];return _0x1d6c3a;};'use strict';var _=require(_0xb152('0x0'));var rp=require(_0xb152('0x1'));var md5=require(_0xb152('0x2'));var util=require(_0xb152('0x3'));var Redis=require(_0xb152('0x4'));var intUtil=require(_0xb152('0x5'));var config=require(_0xb152('0x6'));var logger=require(_0xb152('0x7'))(_0xb152('0x8'));config['redis']=_[_0xb152('0x9')](config[_0xb152('0xa')],{'host':_0xb152('0xb'),'port':0x18eb});var io=require(_0xb152('0xc'))(new Redis(config[_0xb152('0xa')]));function emit(_0x23e18f,_0x27f3b8,_0x48e8f0){io['to'](_0x23e18f)[_0xb152('0xd')](_0x27f3b8,_0x48e8f0);}var headers={'Content-Type':_0xb152('0xe'),'Accept':_0xb152('0xe')};function getTicket(_0x9959ea,_0x37f519,_0x1c0d0d,_0x2964ff,_0x39ed9b){logger[_0xb152('0xf')](_0xb152('0x10'));return request({'uri':util[_0xb152('0x11')](_0xb152('0x12'),_0x9959ea['remoteUri']),'method':_0xb152('0x13'),'body':{'ticket':_[_0xb152('0x14')]({'requester_id':_0x1c0d0d['id'],'submitter_id':_0x37f519?_0x37f519['id']:undefined,'assignee_id':_0x37f519?_0x37f519['id']:undefined,'tags':getTags(_0x2964ff['Tags'],_0xb152('0x15')),'subject':intUtil[_0xb152('0x16')](_0x2964ff[_0xb152('0x17')],_0x39ed9b,'\x20'),'description':intUtil['getString'](_0x2964ff[_0xb152('0x18')],_0x39ed9b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb152('0x16')](_0x2964ff[_0xb152('0x18')],_0x39ed9b,'\x0a')}},getCustomFields(_0x2964ff[_0xb152('0x19')],_0x39ed9b))}})[_0xb152('0x1a')](function(_0x2fce6d){logger[_0xb152('0xf')]('Ticket\x20created!');return _0x2fce6d[_0xb152('0x1b')];});}function getUser(_0x281bd6,_0xb7311d){if(intUtil[_0xb152('0x1c')](_0xb7311d)){logger[_0xb152('0xf')](_0xb152('0x1d'),_0xb7311d);return request({'uri':util[_0xb152('0x11')](_0xb152('0x1e'),_0x281bd6[_0xb152('0x1f')]),'qs':{'query':util[_0xb152('0x11')](_0xb152('0x20'),_0xb7311d)}})[_0xb152('0x1a')](function(_0x56b9df){if(_0x56b9df['count']){logger[_0xb152('0xf')](_0xb152('0x21'));return _[_0xb152('0x22')](_0x56b9df[_0xb152('0x23')],{'email':_0xb7311d,'role':'agent'});}else{logger['info'](_0xb152('0x24'));return request({'uri':util['format']('%s/users/me.json',_0x281bd6[_0xb152('0x1f')])})[_0xb152('0x1a')](function(_0x74f818){logger[_0xb152('0xf')](_0xb152('0x25'));return _0x74f818[_0xb152('0x26')];});}});}else{logger[_0xb152('0xf')](_0xb152('0x24'));return request({'uri':util[_0xb152('0x11')](_0xb152('0x27'),_0x281bd6[_0xb152('0x1f')])})[_0xb152('0x1a')](function(_0x370cf6){logger[_0xb152('0xf')](_0xb152('0x25'));return _0x370cf6['user'];});}}function getEndUser(_0x557eb5,_0x4b4d0b,_0x231a1f){logger['info'](_0xb152('0x28'),_0x231a1f);return request({'uri':util['format'](_0xb152('0x1e'),_0x557eb5['remoteUri']),'qs':{'query':util[_0xb152('0x11')]('type:user\x20role:end-user\x20phone:%s',_0x231a1f)}})['then'](function(_0x58b473){var _0x4faa7d;if(_0x58b473[_0xb152('0x23')][_0xb152('0x29')]){_0x58b473['results']=_['filter'](_0x58b473[_0xb152('0x23')],{'suspended':![],'role':'end-user'});if(_0x58b473['results'][_0xb152('0x29')]){_0x4faa7d=_[_0xb152('0x2a')](_0x58b473[_0xb152('0x23')]);}}if(_0x4faa7d){logger[_0xb152('0xf')](_0xb152('0x2b'));return _0x4faa7d;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb152('0x11')](_0xb152('0x2c'),_0x557eb5[_0xb152('0x1f')]),'method':_0xb152('0x13'),'body':{'user':{'role':_0xb152('0x2d'),'name':util['format']('Caller\x20-\x20%s',_0x4b4d0b||_0x231a1f),'phone':_0x231a1f}}})[_0xb152('0x1a')](function(_0x34a746){logger[_0xb152('0xf')]('Enduser\x20created.');return _0x34a746[_0xb152('0x26')];});}});}function getAuth(_0x40c0b6){var _0x331903;if(_0x40c0b6['authType']==='password'){_0x331903=util[_0xb152('0x11')](_0xb152('0x2e'),_0x40c0b6[_0xb152('0x2f')],_0x40c0b6['password']);}else if(_0x40c0b6[_0xb152('0x30')]===_0xb152('0x31')){_0x331903=util[_0xb152('0x11')](_0xb152('0x32'),_0x40c0b6[_0xb152('0x2f')],_0x40c0b6[_0xb152('0x31')]);}return util[_0xb152('0x11')](_0xb152('0x33'),new Buffer(_0x331903)[_0xb152('0x34')](_0xb152('0x35')));}function request(_0x32b1bf){logger[_0xb152('0x36')](_0xb152('0x37'),JSON[_0xb152('0x38')](_0x32b1bf));return rp(_[_0xb152('0x9')](_0x32b1bf,{'method':_0xb152('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x307693,_0x512b03){var _0x5d45f1=[];if(_0x307693&&_0x307693['length']>0x0){_0x5d45f1=_['map'](_0x307693,_0x512b03);}return _0x5d45f1;}function getCustomFields(_0x878fb0,_0x144df5){var _0xd759a7=[];var _0xe38d21={'custom_fields':[]};if(_0x878fb0[_0xb152('0x29')]>0x0){_[_0xb152('0x3a')](_0x878fb0,function(_0x61253a){if(_[_0xb152('0x3b')](['string','picklist'],_0x61253a[_0xb152('0x3c')])&&_0x61253a[_0xb152('0x3d')]&&!_0x61253a[_0xb152('0x3e')]){_0xe38d21[_0x61253a['nameField'][_0xb152('0x3f')]()]=_0x61253a[_0xb152('0x40')][_0xb152('0x34')]();}else if(_[_0xb152('0x3b')]([_0xb152('0x41'),_0xb152('0x42')],_0x61253a[_0xb152('0x3c')])&&_0x61253a['idField']&&_0x61253a[_0xb152('0x3e')]){_0xe38d21[_0xb152('0x43')]['push']({'id':_0x61253a[_0xb152('0x44')],'value':_0x61253a['content'][_0xb152('0x34')]()});}else if(_0x61253a['type']===_0xb152('0x45')&&_0x61253a['variableName']&&_0x61253a[_0xb152('0x44')]&&_0x61253a['customField']){_0x144df5[_0x61253a['variableName']]&&_0xe38d21[_0xb152('0x43')]['push']({'id':_0x61253a[_0xb152('0x44')],'value':_0x144df5[_0x61253a[_0xb152('0x46')]][_0xb152('0x34')]()});}else if(_0x61253a[_0xb152('0x3c')]===_0xb152('0x47')&&_0x61253a[_0xb152('0x48')]&&_0x61253a['Variable']['name']&&_0x61253a[_0xb152('0x44')]&&_0x61253a[_0xb152('0x3e')]){_0x144df5[_0x61253a['Variable']['name'][_0xb152('0x3f')]()]&&_0xe38d21[_0xb152('0x43')][_0xb152('0x49')]({'id':_0x61253a[_0xb152('0x44')],'value':_0x144df5[_0x61253a[_0xb152('0x48')]['name'][_0xb152('0x3f')]()][_0xb152('0x34')]()});}});}return _0xe38d21;}exports[_0xb152('0x4a')]=function(_0x1e0f49,_0xb00764,_0x327957,_0x45d5fe,_0x5d97ff,_0x49ce85){var _0x2b7413,_0x5c8755;_0x49ce85['remoteUri']=intUtil[_0xb152('0x4b')](_0x49ce85[_0xb152('0x1f')]);_0x49ce85[_0xb152('0x4c')]=intUtil['stripTrailingSlash'](_0x49ce85[_0xb152('0x4c')]);if(_0x5d97ff&&_0x5d97ff[_0xb152('0x4d')]){logger[_0xb152('0xf')](_0xb152('0x4e'),_0xb152('0x4f'));_0xb00764[_0xb152('0x50')]=util['format'](_0xb152('0x51'),_0x49ce85[_0xb152('0x4c')],_0xb00764[_0xb152('0x52')],md5(_0xb00764[_0xb152('0x52')]));}else{_0xb00764['recordingURL']='';}headers[_0xb152('0x53')]=getAuth(_0x49ce85);return getUser(_0x49ce85,_0x45d5fe[_0xb152('0x54')])[_0xb152('0x1a')](function(_0x2460f2){_0x2b7413=_0x2460f2;logger[_0xb152('0xf')]('The\x20User\x20ID\x20is:',_0x2b7413['id']);return getEndUser(_0x49ce85,_0xb00764[_0xb152('0x55')],_0xb00764['calleridnum']);})[_0xb152('0x1a')](function(_0x1f7efd){_0x5c8755=_0x1f7efd;logger[_0xb152('0xf')](_0xb152('0x56'),_0x5c8755['id']);return getTicket(_0x49ce85,_0x2b7413,_0x5c8755,_0x327957,_0xb00764);})[_0xb152('0x1a')](function(_0x411af1){if(_0x411af1){logger['info'](_0xb152('0x57'),_0x411af1['id']);switch(_0x49ce85[_0xb152('0x3c')]){case _0xb152('0x58'):logger[_0xb152('0xf')]('[QUEUE]',_0xb152('0x59'));return request({'uri':util[_0xb152('0x11')](_0xb152('0x5a'),_0x49ce85[_0xb152('0x1f')],_0x2b7413['id'],_0x411af1['id']),'method':_0xb152('0x13')});case'newTab':logger[_0xb152('0xf')](_0xb152('0x4e'),_0xb152('0x5b'));emit(util[_0xb152('0x11')](_0xb152('0x5c'),_0x45d5fe['name']),_0xb152('0x5d'),{'uri':util['format'](_0xb152('0x5e'),_0x49ce85[_0xb152('0x1f')][_0xb152('0x5f')](_0xb152('0x60'),''),_0x411af1['id'])});break;default:logger[_0xb152('0x61')]('[QUEUE]',_0xb152('0x62'));}}})[_0xb152('0x63')](function(_0x153a1a){logger[_0xb152('0x61')](_0xb152('0x64'),util[_0xb152('0x65')](_0x153a1a,{'showHidden':!![],'depth':null}));});};exports[_0xb152('0x66')]=function(_0x2ca80c,_0x310e35,_0xdc25d2,_0x26f21b,_0x4961ad,_0x427b56,_0x10a0fb){var _0x263514,_0x4db552;_0x427b56[_0xb152('0x1f')]=intUtil[_0xb152('0x4b')](_0x427b56[_0xb152('0x1f')]);_0x427b56['serverUrl']=intUtil[_0xb152('0x4b')](_0x427b56[_0xb152('0x4c')]);if(_0x10a0fb&&_0x10a0fb[_0xb152('0x67')]&&_0x10a0fb[_0xb152('0x67')]!=='none'){logger[_0xb152('0xf')](_0xb152('0x68'),_0xb152('0x4f'));_0x310e35[_0xb152('0x50')]=util[_0xb152('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x427b56[_0xb152('0x4c')],_0x310e35[_0xb152('0x52')],md5(_0x310e35[_0xb152('0x52')]));}headers[_0xb152('0x53')]=getAuth(_0x427b56);return getUser(_0x427b56,_0x26f21b[_0xb152('0x54')])[_0xb152('0x1a')](function(_0x3fd6b6){_0x263514=_0x3fd6b6;logger[_0xb152('0xf')](_0xb152('0x69'),_0x263514['id']);return getEndUser(_0x427b56,_0x310e35['destcalleridname'],_0x310e35['destcalleridnum']);})[_0xb152('0x1a')](function(_0x1bf409){_0x4db552=_0x1bf409;logger[_0xb152('0xf')]('The\x20Enduser\x20ID\x20is:',_0x4db552['id']);return getTicket(_0x427b56,_0x263514,_0x4db552,_0xdc25d2,_0x310e35);})[_0xb152('0x1a')](function(_0x57c541){if(_0x57c541){logger[_0xb152('0xf')](_0xb152('0x57'),_0x57c541['id']);switch(_0x427b56['type']){case'integrationTab':logger['info'](_0xb152('0x68'),_0xb152('0x59'));return request({'uri':util['format'](_0xb152('0x5a'),_0x427b56[_0xb152('0x1f')],_0x263514['id'],_0x57c541['id']),'method':_0xb152('0x13')});case'newTab':logger[_0xb152('0xf')](_0xb152('0x68'),_0xb152('0x5b'));emit(util[_0xb152('0x11')](_0xb152('0x5c'),_0x26f21b[_0xb152('0x15')]),_0xb152('0x5d'),{'uri':util[_0xb152('0x11')]('%s/agent/tickets/%s',_0x427b56[_0xb152('0x1f')][_0xb152('0x5f')](_0xb152('0x60'),''),_0x57c541['id'])});break;default:logger[_0xb152('0x61')](_0xb152('0x68'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb152('0x63')](function(_0x5119af){logger[_0xb152('0x61')](_0xb152('0x6a'),util[_0xb152('0x65')](_0x5119af,{'showHidden':!![],'depth':null}));});};exports[_0xb152('0x6b')]=function(_0x51e494,_0x2ac424,_0x2fda46,_0x115508,_0x778103,_0xc2d052){var _0x2cfc78,_0x590530;_0xc2d052['remoteUri']=intUtil[_0xb152('0x4b')](_0xc2d052[_0xb152('0x1f')]);_0xc2d052[_0xb152('0x4c')]=intUtil['stripTrailingSlash'](_0xc2d052['serverUrl']);if(_0x778103&&_0x778103[_0xb152('0x4d')]){logger['info']('['+_0x2ac424[_0xb152('0x6c')][_0xb152('0x6d')]()+']',_0xb152('0x4f'));_0x2ac424[_0xb152('0x50')]=util[_0xb152('0x11')](_0xb152('0x51'),_0xc2d052[_0xb152('0x4c')],_0x2ac424['uniqueid'],md5(_0x2ac424[_0xb152('0x52')]));}else{_0x2ac424[_0xb152('0x50')]='';}headers[_0xb152('0x53')]=getAuth(_0xc2d052);return getUser(_0xc2d052)[_0xb152('0x1a')](function(_0x330ce8){_0x2cfc78=_0x330ce8;logger[_0xb152('0xf')](_0xb152('0x69'),_0x2cfc78['id']);return getEndUser(_0xc2d052,_0x2ac424[_0xb152('0x55')],_0x2ac424[_0xb152('0x6e')]);})['then'](function(_0x4fe6e5){_0x590530=_0x4fe6e5;logger[_0xb152('0xf')](_0xb152('0x56'),_0x590530['id']);return getTicket(_0xc2d052,_0x2cfc78,_0x590530,_0x2fda46,_0x2ac424);})['then'](function(_0xf54a0d){if(_0xf54a0d){logger[_0xb152('0xf')](_0xb152('0x57'),_0xf54a0d['id']);}})[_0xb152('0x63')](function(_0x50ce46){logger[_0xb152('0x61')]('['+_0x2ac424[_0xb152('0x6c')][_0xb152('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xb152('0x65')](_0x50ce46,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7f40=['picklist','type','nameField','customField','content','toString','idField','push','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','info','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','[HTTP]','stringify','forEach','includes','string'];(function(_0x4d355c,_0x2ae984){var _0x228ca3=function(_0x33b641){while(--_0x33b641){_0x4d355c['push'](_0x4d355c['shift']());}};_0x228ca3(++_0x2ae984);}(_0x7f40,0x9b));var _0x07f4=function(_0x17601f,_0x79897){_0x17601f=_0x17601f-0x0;var _0x5350a5=_0x7f40[_0x17601f];return _0x5350a5;};'use strict';var _=require(_0x07f4('0x0'));var rp=require(_0x07f4('0x1'));var md5=require(_0x07f4('0x2'));var util=require(_0x07f4('0x3'));var Redis=require(_0x07f4('0x4'));var intUtil=require('./util');var config=require(_0x07f4('0x5'));var logger=require(_0x07f4('0x6'))(_0x07f4('0x7'));config['redis']=_[_0x07f4('0x8')](config[_0x07f4('0x9')],{'host':_0x07f4('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x07f4('0x9')]));function emit(_0x515dc6,_0x1117ef,_0x2ac388){io['to'](_0x515dc6)[_0x07f4('0xb')](_0x1117ef,_0x2ac388);}var headers={'Content-Type':_0x07f4('0xc'),'Accept':_0x07f4('0xc')};function getTicket(_0xe2f884,_0x1ffd50,_0x1adcc5,_0x8b1836,_0x1c09d1){logger[_0x07f4('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x07f4('0xe')]('%s/tickets.json',_0xe2f884[_0x07f4('0xf')]),'method':_0x07f4('0x10'),'body':{'ticket':_[_0x07f4('0x11')]({'requester_id':_0x1adcc5['id'],'submitter_id':_0x1ffd50?_0x1ffd50['id']:undefined,'assignee_id':_0x1ffd50?_0x1ffd50['id']:undefined,'tags':getTags(_0x8b1836[_0x07f4('0x12')],_0x07f4('0x13')),'subject':intUtil[_0x07f4('0x14')](_0x8b1836[_0x07f4('0x15')],_0x1c09d1,'\x20'),'description':intUtil[_0x07f4('0x14')](_0x8b1836[_0x07f4('0x16')],_0x1c09d1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x07f4('0x14')](_0x8b1836[_0x07f4('0x16')],_0x1c09d1,'\x0a')}},getCustomFields(_0x8b1836[_0x07f4('0x17')],_0x1c09d1))}})[_0x07f4('0x18')](function(_0x4ea2f9){logger[_0x07f4('0xd')]('Ticket\x20created!');return _0x4ea2f9[_0x07f4('0x19')];});}function getUser(_0x4f230f,_0x17d372){if(intUtil[_0x07f4('0x1a')](_0x17d372)){logger['info'](_0x07f4('0x1b'),_0x17d372);return request({'uri':util[_0x07f4('0xe')](_0x07f4('0x1c'),_0x4f230f[_0x07f4('0xf')]),'qs':{'query':util[_0x07f4('0xe')]('type:user\x20role:agent\x20email:%s',_0x17d372)}})['then'](function(_0x43d60b){if(_0x43d60b[_0x07f4('0x1d')]){logger[_0x07f4('0xd')](_0x07f4('0x1e'));return _[_0x07f4('0x1f')](_0x43d60b[_0x07f4('0x20')],{'email':_0x17d372,'role':'agent'});}else{logger[_0x07f4('0xd')](_0x07f4('0x21'));return request({'uri':util[_0x07f4('0xe')]('%s/users/me.json',_0x4f230f['remoteUri'])})[_0x07f4('0x18')](function(_0x1f85be){logger[_0x07f4('0xd')](_0x07f4('0x22'));return _0x1f85be[_0x07f4('0x23')];});}});}else{logger[_0x07f4('0xd')](_0x07f4('0x21'));return request({'uri':util[_0x07f4('0xe')](_0x07f4('0x24'),_0x4f230f[_0x07f4('0xf')])})[_0x07f4('0x18')](function(_0x1750bd){logger['info']('Admin\x20account\x20selected.');return _0x1750bd[_0x07f4('0x23')];});}}function getEndUser(_0x1b9f91,_0x482483,_0x3a539f){logger[_0x07f4('0xd')](_0x07f4('0x25'),_0x3a539f);return request({'uri':util['format'](_0x07f4('0x1c'),_0x1b9f91['remoteUri']),'qs':{'query':util[_0x07f4('0xe')](_0x07f4('0x26'),_0x3a539f)}})['then'](function(_0x11c501){var _0x25aab5;if(_0x11c501[_0x07f4('0x20')][_0x07f4('0x27')]){_0x11c501[_0x07f4('0x20')]=_[_0x07f4('0x28')](_0x11c501[_0x07f4('0x20')],{'suspended':![],'role':_0x07f4('0x29')});if(_0x11c501[_0x07f4('0x20')]['length']){_0x25aab5=_[_0x07f4('0x2a')](_0x11c501[_0x07f4('0x20')]);}}if(_0x25aab5){logger[_0x07f4('0xd')](_0x07f4('0x2b'));return _0x25aab5;}else{logger[_0x07f4('0xd')](_0x07f4('0x2c'));return request({'uri':util[_0x07f4('0xe')](_0x07f4('0x2d'),_0x1b9f91[_0x07f4('0xf')]),'method':_0x07f4('0x10'),'body':{'user':{'role':_0x07f4('0x29'),'name':util[_0x07f4('0xe')](_0x07f4('0x2e'),_0x482483||_0x3a539f),'phone':_0x3a539f}}})[_0x07f4('0x18')](function(_0x4ec9c0){logger['info'](_0x07f4('0x2f'));return _0x4ec9c0['user'];});}});}function getAuth(_0x10af8d){var _0x1bd012;if(_0x10af8d[_0x07f4('0x30')]===_0x07f4('0x31')){_0x1bd012=util[_0x07f4('0xe')]('%s:%s',_0x10af8d['username'],_0x10af8d[_0x07f4('0x31')]);}else if(_0x10af8d[_0x07f4('0x30')]==='token'){_0x1bd012=util[_0x07f4('0xe')]('%s/token:%s',_0x10af8d[_0x07f4('0x32')],_0x10af8d[_0x07f4('0x33')]);}return util[_0x07f4('0xe')]('Basic\x20%s',new Buffer(_0x1bd012)['toString']('base64'));}function request(_0x79764d){logger['debug'](_0x07f4('0x34'),JSON[_0x07f4('0x35')](_0x79764d));return rp(_[_0x07f4('0x8')](_0x79764d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x450409,_0x47f1f6){var _0x457819=[];if(_0x450409&&_0x450409['length']>0x0){_0x457819=_['map'](_0x450409,_0x47f1f6);}return _0x457819;}function getCustomFields(_0x4fe28c,_0x36a039){var _0x10dfa6=[];var _0x2426ae={'custom_fields':[]};if(_0x4fe28c[_0x07f4('0x27')]>0x0){_[_0x07f4('0x36')](_0x4fe28c,function(_0x34d390){if(_[_0x07f4('0x37')]([_0x07f4('0x38'),_0x07f4('0x39')],_0x34d390[_0x07f4('0x3a')])&&_0x34d390[_0x07f4('0x3b')]&&!_0x34d390[_0x07f4('0x3c')]){_0x2426ae[_0x34d390[_0x07f4('0x3b')]['toLowerCase']()]=_0x34d390[_0x07f4('0x3d')][_0x07f4('0x3e')]();}else if(_[_0x07f4('0x37')]([_0x07f4('0x38'),_0x07f4('0x39')],_0x34d390[_0x07f4('0x3a')])&&_0x34d390[_0x07f4('0x3f')]&&_0x34d390[_0x07f4('0x3c')]){_0x2426ae['custom_fields'][_0x07f4('0x40')]({'id':_0x34d390[_0x07f4('0x3f')],'value':_0x34d390[_0x07f4('0x3d')][_0x07f4('0x3e')]()});}else if(_0x34d390[_0x07f4('0x3a')]===_0x07f4('0x41')&&_0x34d390[_0x07f4('0x42')]&&_0x34d390[_0x07f4('0x3f')]&&_0x34d390[_0x07f4('0x3c')]){_0x36a039[_0x34d390[_0x07f4('0x42')]]&&_0x2426ae[_0x07f4('0x43')][_0x07f4('0x40')]({'id':_0x34d390['idField'],'value':_0x36a039[_0x34d390[_0x07f4('0x42')]][_0x07f4('0x3e')]()});}else if(_0x34d390['type']===_0x07f4('0x44')&&_0x34d390[_0x07f4('0x45')]&&_0x34d390[_0x07f4('0x45')][_0x07f4('0x13')]&&_0x34d390['idField']&&_0x34d390[_0x07f4('0x3c')]){_0x36a039[_0x34d390[_0x07f4('0x45')][_0x07f4('0x13')][_0x07f4('0x46')]()]&&_0x2426ae[_0x07f4('0x43')][_0x07f4('0x40')]({'id':_0x34d390[_0x07f4('0x3f')],'value':_0x36a039[_0x34d390[_0x07f4('0x45')][_0x07f4('0x13')][_0x07f4('0x46')]()]['toString']()});}});}return _0x2426ae;}exports['queue']=function(_0x1fcc52,_0x35ebe2,_0x2dd7d5,_0x53e2d8,_0x213e28,_0x3f5cb6){var _0x4a9ecb,_0x1fd554;_0x3f5cb6['remoteUri']=intUtil[_0x07f4('0x47')](_0x3f5cb6[_0x07f4('0xf')]);_0x3f5cb6[_0x07f4('0x48')]=intUtil['stripTrailingSlash'](_0x3f5cb6[_0x07f4('0x48')]);if(_0x213e28&&_0x213e28[_0x07f4('0x49')]){logger['info'](_0x07f4('0x4a'),_0x07f4('0x4b'));_0x35ebe2[_0x07f4('0x4c')]=util[_0x07f4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f5cb6[_0x07f4('0x48')],_0x35ebe2[_0x07f4('0x4d')],md5(_0x35ebe2[_0x07f4('0x4d')]));}else{_0x35ebe2['recordingURL']='';}headers[_0x07f4('0x4e')]=getAuth(_0x3f5cb6);return getUser(_0x3f5cb6,_0x53e2d8['email'])['then'](function(_0x460423){_0x4a9ecb=_0x460423;logger[_0x07f4('0xd')](_0x07f4('0x4f'),_0x4a9ecb['id']);return getEndUser(_0x3f5cb6,_0x35ebe2[_0x07f4('0x50')],_0x35ebe2[_0x07f4('0x51')]);})[_0x07f4('0x18')](function(_0x58759b){_0x1fd554=_0x58759b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1fd554['id']);return getTicket(_0x3f5cb6,_0x4a9ecb,_0x1fd554,_0x2dd7d5,_0x35ebe2);})['then'](function(_0x4571e2){if(_0x4571e2){logger[_0x07f4('0xd')](_0x07f4('0x52'),_0x4571e2['id']);switch(_0x3f5cb6['type']){case _0x07f4('0x53'):logger[_0x07f4('0xd')](_0x07f4('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x07f4('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3f5cb6[_0x07f4('0xf')],_0x4a9ecb['id'],_0x4571e2['id']),'method':_0x07f4('0x10')});case'newTab':logger[_0x07f4('0xd')](_0x07f4('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x07f4('0xe')](_0x07f4('0x54'),_0x53e2d8[_0x07f4('0x13')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x3f5cb6[_0x07f4('0xf')]['replace'](_0x07f4('0x55'),''),_0x4571e2['id'])});break;default:logger[_0x07f4('0x56')]('[QUEUE]',_0x07f4('0x57'));}}})[_0x07f4('0x58')](function(_0xe55fd1){logger['error'](_0x07f4('0x59'),util[_0x07f4('0x5a')](_0xe55fd1,{'showHidden':!![],'depth':null}));});};exports[_0x07f4('0x5b')]=function(_0x834a5d,_0x288c39,_0x306944,_0x413fec,_0x41b3a6,_0x37621b,_0x32af3b){var _0x16ee3d,_0x3d42ca;_0x37621b['remoteUri']=intUtil['stripTrailingSlash'](_0x37621b[_0x07f4('0xf')]);_0x37621b['serverUrl']=intUtil[_0x07f4('0x47')](_0x37621b['serverUrl']);if(_0x32af3b&&_0x32af3b[_0x07f4('0x5c')]&&_0x32af3b[_0x07f4('0x5c')]!=='none'){logger['info']('[OUTBOUND]',_0x07f4('0x4b'));_0x288c39[_0x07f4('0x4c')]=util[_0x07f4('0xe')](_0x07f4('0x5d'),_0x37621b[_0x07f4('0x48')],_0x288c39[_0x07f4('0x4d')],md5(_0x288c39['uniqueid']));}headers[_0x07f4('0x4e')]=getAuth(_0x37621b);return getUser(_0x37621b,_0x413fec[_0x07f4('0x5e')])[_0x07f4('0x18')](function(_0x31e7a0){_0x16ee3d=_0x31e7a0;logger[_0x07f4('0xd')](_0x07f4('0x4f'),_0x16ee3d['id']);return getEndUser(_0x37621b,_0x288c39[_0x07f4('0x5f')],_0x288c39[_0x07f4('0x60')]);})[_0x07f4('0x18')](function(_0x3a95b0){_0x3d42ca=_0x3a95b0;logger[_0x07f4('0xd')](_0x07f4('0x61'),_0x3d42ca['id']);return getTicket(_0x37621b,_0x16ee3d,_0x3d42ca,_0x306944,_0x288c39);})['then'](function(_0x1f6d20){if(_0x1f6d20){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1f6d20['id']);switch(_0x37621b['type']){case _0x07f4('0x53'):logger[_0x07f4('0xd')](_0x07f4('0x62'),_0x07f4('0x63'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x37621b[_0x07f4('0xf')],_0x16ee3d['id'],_0x1f6d20['id']),'method':'POST'});case _0x07f4('0x64'):logger['info'](_0x07f4('0x62'),_0x07f4('0x65'));emit(util[_0x07f4('0xe')](_0x07f4('0x54'),_0x413fec[_0x07f4('0x13')]),'trigger:browser:url',{'uri':util[_0x07f4('0xe')]('%s/agent/tickets/%s',_0x37621b[_0x07f4('0xf')]['replace'](_0x07f4('0x55'),''),_0x1f6d20['id'])});break;default:logger[_0x07f4('0x56')](_0x07f4('0x62'),_0x07f4('0x57'));}}})['catch'](function(_0x5e2a72){logger[_0x07f4('0x56')](_0x07f4('0x66'),util[_0x07f4('0x5a')](_0x5e2a72,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x318d2c,_0x23ca7c,_0x157f22,_0x599660,_0x253009,_0x21e90f){var _0x1f71ab,_0x1c4aa0;_0x21e90f['remoteUri']=intUtil[_0x07f4('0x47')](_0x21e90f[_0x07f4('0xf')]);_0x21e90f[_0x07f4('0x48')]=intUtil[_0x07f4('0x47')](_0x21e90f[_0x07f4('0x48')]);if(_0x253009&&_0x253009[_0x07f4('0x49')]){logger[_0x07f4('0xd')]('['+_0x23ca7c['lastevent'][_0x07f4('0x67')]()+']',_0x07f4('0x4b'));_0x23ca7c[_0x07f4('0x4c')]=util[_0x07f4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21e90f['serverUrl'],_0x23ca7c[_0x07f4('0x4d')],md5(_0x23ca7c[_0x07f4('0x4d')]));}else{_0x23ca7c[_0x07f4('0x4c')]='';}headers['Authorization']=getAuth(_0x21e90f);return getUser(_0x21e90f)['then'](function(_0x4bdf00){_0x1f71ab=_0x4bdf00;logger[_0x07f4('0xd')](_0x07f4('0x4f'),_0x1f71ab['id']);return getEndUser(_0x21e90f,_0x23ca7c[_0x07f4('0x50')],_0x23ca7c[_0x07f4('0x51')]);})['then'](function(_0x1e65f2){_0x1c4aa0=_0x1e65f2;logger[_0x07f4('0xd')](_0x07f4('0x61'),_0x1c4aa0['id']);return getTicket(_0x21e90f,_0x1f71ab,_0x1c4aa0,_0x157f22,_0x23ca7c);})['then'](function(_0x3dbc64){if(_0x3dbc64){logger['info'](_0x07f4('0x52'),_0x3dbc64['id']);}})['catch'](function(_0x452d4b){logger[_0x07f4('0x56')]('['+_0x23ca7c[_0x07f4('0x68')][_0x07f4('0x67')]()+']'+_0x07f4('0x69'),util[_0x07f4('0x5a')](_0x452d4b,{'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 dc489b0..420ba76 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 _0x0d47=['socket.io-emitter','emit','debug','[HTTP]','stringify','includes','string','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','nothing','contact','uri','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','code','Call\x20created!','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','/api/voice/recordings/','calleridnum','md5','util','./util','bluebird','../../../../config/environment','redis'];(function(_0x46ce32,_0x4f13fb){var _0x30e2e8=function(_0x480e75){while(--_0x480e75){_0x46ce32['push'](_0x46ce32['shift']());}};_0x30e2e8(++_0x4f13fb);}(_0x0d47,0x1b9));var _0x70d4=function(_0x345b0a,_0x19eef4){_0x345b0a=_0x345b0a-0x0;var _0x56b2ed=_0x0d47[_0x345b0a];return _0x56b2ed;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x70d4('0x0'));var util=require(_0x70d4('0x1'));var intUtil=require(_0x70d4('0x2'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x70d4('0x3'));var config=require(_0x70d4('0x4'));var logger=require('../../../../config/logger')('zoho');config[_0x70d4('0x5')]=_['defaults'](config[_0x70d4('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x70d4('0x6'))(new Redis(config[_0x70d4('0x5')]));function emit(_0x21afa1,_0x5dd129,_0x4f394f){io['to'](_0x21afa1)[_0x70d4('0x7')](_0x5dd129,_0x4f394f);}function request(_0x1f8abf){logger[_0x70d4('0x8')](_0x70d4('0x9'),JSON[_0x70d4('0xa')](_0x1f8abf));return rp(_0x1f8abf);}function getCustomFields(_0x43ef99,_0x4cba13){var _0x55e9fe={};if(_0x43ef99['length']>0x0){_['forEach'](_0x43ef99,function(_0x2138d9){if(_[_0x70d4('0xb')]([_0x70d4('0xc'),_0x70d4('0xd')],_0x2138d9[_0x70d4('0xe')])&&_0x2138d9[_0x70d4('0xf')]){_0x55e9fe[_0x2138d9[_0x70d4('0xf')]]=_0x2138d9[_0x70d4('0x10')][_0x70d4('0x11')]();}else if(_0x2138d9[_0x70d4('0xe')]==='variable'&&_0x2138d9[_0x70d4('0x12')]&&_0x2138d9['idField']&&_0x4cba13[_0x2138d9[_0x70d4('0x12')]]){_0x55e9fe[_0x2138d9[_0x70d4('0xf')]]=_0x4cba13[_0x2138d9[_0x70d4('0x12')]]['toString']();}else if(_0x2138d9[_0x70d4('0xe')]==='customVariable'&&_0x2138d9[_0x70d4('0x13')]&&_0x2138d9[_0x70d4('0x13')][_0x70d4('0x14')]&&_0x2138d9[_0x70d4('0xf')]&&_0x4cba13[_0x2138d9[_0x70d4('0x13')][_0x70d4('0x14')][_0x70d4('0x15')]()]){_0x55e9fe[_0x2138d9[_0x70d4('0xf')]]=_0x4cba13[_0x2138d9['Variable']['name'][_0x70d4('0x15')]()][_0x70d4('0x11')]();}});}return _0x55e9fe;}function getName(_0x3e37aa){if(_0x3e37aa['indexOf']('\x20')>0x0){var _0x46aded=_0x3e37aa[_0x70d4('0x16')](/ (.+)/);if(_0x46aded[0x1]){return _0x46aded;}}return[_0x3e37aa,_0x3e37aa];}var accountsTokens={};function getAccessToken(_0x3b37dc){return new Promise(function(_0x303c3e,_0x4e9db8){if(!_['isNil'](accountsTokens[_0x3b37dc['id']])&&!_[_0x70d4('0x17')](accountsTokens[_0x3b37dc['id']][_0x70d4('0x18')])){if(moment()[_0x70d4('0x19')](accountsTokens[_0x3b37dc['id']][_0x70d4('0x1a')])){_0x303c3e(accountsTokens[_0x3b37dc['id']][_0x70d4('0x18')]);}}var _0x29b79d;switch(_0x3b37dc[_0x70d4('0x1b')]){case'US':_0x29b79d=_0x70d4('0x1c');break;case'AU':_0x29b79d='https://accounts.zoho.com.au';break;case'EU':_0x29b79d='https://accounts.zoho.eu';break;case'IN':_0x29b79d=_0x70d4('0x1d');break;case'CN':_0x29b79d=_0x70d4('0x1e');break;default:_0x29b79d=_0x70d4('0x1f');break;}var _0x2da15e={'method':_0x70d4('0x20'),'uri':_0x29b79d+'/oauth/v2/token','qs':{'refresh_token':_0x3b37dc[_0x70d4('0x21')],'client_id':_0x3b37dc[_0x70d4('0x22')],'client_secret':_0x3b37dc[_0x70d4('0x23')],'grant_type':_0x70d4('0x24')},'json':!![]};return rp(_0x2da15e)[_0x70d4('0x25')](function(_0x5e4363){accountsTokens[_0x3b37dc['id']]={'access_token':_0x5e4363[_0x70d4('0x18')],'expires_in':moment()[_0x70d4('0x26')](_0x5e4363[_0x70d4('0x1a')],_0x70d4('0x27'))};_0x303c3e(_0x5e4363[_0x70d4('0x18')]);})[_0x70d4('0x28')](function(_0x421e31){logger[_0x70d4('0x29')](_0x70d4('0x2a'),_0x421e31['stack']);_0x4e9db8(_0x421e31);});});}function getUser(_0x1e734f,_0xd37362,_0x40ffa3,_0x54b97a){logger[_0x70d4('0x2b')]('Search\x20user');return request({'method':_0x70d4('0x2c'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0xd37362),'qs':{'type':_0x70d4('0x2d')},'headers':{'Authorization':_0x70d4('0x2e')+_0x1e734f},'json':!![]})['then'](function(_0x16ef28){if(_0x16ef28[_0x70d4('0x2f')]){var _0xb02923=-0x1;if(_[_0x70d4('0x30')](_0x16ef28[_0x70d4('0x2f')])){if(!_[_0x70d4('0x17')](_0x54b97a)){_0xb02923=_[_0x70d4('0x31')](_0x16ef28[_0x70d4('0x2f')],function(_0x226bec){return _0x226bec[_0x70d4('0x32')]===_0x54b97a;});}if(_0xb02923>=0x0){logger[_0x70d4('0x2b')](_0x70d4('0x33'));}else{logger[_0x70d4('0x2b')](_0x70d4('0x34'));_0xb02923=_[_0x70d4('0x31')](_0x16ef28[_0x70d4('0x2f')],function(_0x21d384){return _0x21d384['profile'][_0x70d4('0x14')]==='Administrator';});}return _0x16ef28[_0x70d4('0x2f')][_0xb02923];}else{if(_0x16ef28[_0x70d4('0x35')][_0x70d4('0x36')][_0x70d4('0x14')]==='Administrator'){logger[_0x70d4('0x2b')](_0x70d4('0x34'));user=_0x16ef28[_0x70d4('0x35')];return user;}else{logger[_0x70d4('0x29')](_0x70d4('0x37'),JSON['stringify'](_0x16ef28));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x70d4('0xa')](_0x16ef28));}}}else{logger[_0x70d4('0x29')]('The\x20failing\x20result\x20is',JSON[_0x70d4('0xa')](_0x16ef28));throw new Error(_0x70d4('0x38')+JSON[_0x70d4('0xa')](_0x16ef28));}})['catch'](function(_0x58a98b){console[_0x70d4('0x29')](_0x58a98b);});}function getZohoUser(_0x19ede5,_0xfb0043){return new BPromise(function(_0x371441,_0x317679){request(_0x19ede5)[_0x70d4('0x25')](function(_0x1ad040){var _0x26b752=null;if(_0x1ad040){_0x26b752=_0x1ad040[_0x70d4('0x39')][0x0];_0x26b752[_0x70d4('0x3a')]=_0xfb0043;}_0x371441(_0x26b752);})[_0x70d4('0x28')](function(_0x5545df){_0x317679(_0x5545df);});});}function createEndUser(_0x1a560d,_0x2fc010,_0x3d80f1,_0x478d52,_0x288aab,_0x1b91de){var _0x3d80f1=getName(_0x3d80f1);return request({'method':_0x70d4('0x20'),'uri':_0x70d4('0x3b')+_0x2fc010+_0x70d4('0x3c')+_[_0x70d4('0x3d')](_0x1b91de[_0x70d4('0x3e')])+'s','body':{'data':[{'Last_Name':_0x3d80f1[0x1],'First_Name':_0x3d80f1[0x0],'Phone':_0x478d52,'Owner':{'name':!_[_0x70d4('0x17')](_0x288aab[_0x70d4('0x3f')][_0x70d4('0x14')])?_0x288aab['role'][_0x70d4('0x14')]:!_[_0x70d4('0x17')](_0x288aab[_0x70d4('0x40')])?_0x288aab[_0x70d4('0x40')]+'\x20'+_0x288aab[_0x70d4('0x41')]:_0x288aab[_0x70d4('0x41')],'id':_0x288aab['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1a560d},'json':!![]})[_0x70d4('0x25')](function(_0x2f1d48){if(_0x2f1d48&&_0x2f1d48[_0x70d4('0x39')][0x0]['code']===_0x70d4('0x42')){var _0x3db54d=_0x2f1d48['data'][0x0][_0x70d4('0x43')];_0x3db54d[_0x70d4('0x3a')]=_['startCase'](_0x1b91de['moduleCreate'])+'s';return _0x3db54d;}logger[_0x70d4('0x29')](_0x70d4('0x37'),JSON[_0x70d4('0xa')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x70d4('0x28')](function(_0x3a1349){console[_0x70d4('0x44')](_0x70d4('0x45'),_0x3a1349);});}function getEndUser(_0x499302,_0x378ba1,_0x1c0708,_0x39d2ce,_0x1a2018,_0x4d7eca,_0x33d3d8){var _0x36f919={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x499302},'json':!![]};switch(_0x33d3d8[_0x70d4('0x46')]){case _0x70d4('0x47'):_0x36f919['uri']=_0x70d4('0x3b')+_0x378ba1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1a2018+'))';return getZohoUser(_0x36f919,'Contacts')[_0x70d4('0x25')](function(_0x5eb136){if(_0x5eb136)return _0x5eb136;_0x36f919['uri']='https://www.zohoapis.'+_0x378ba1+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1a2018+'))';return getZohoUser(_0x36f919,'Leads')['then'](function(_0x4f7c52){if(_0x4f7c52)return _0x4f7c52;if(_0x33d3d8[_0x70d4('0x3e')]!=_0x70d4('0x48')){return createEndUser(_0x499302,_0x378ba1,_0x39d2ce,_0x1a2018,_0x4d7eca,_0x33d3d8);}else{return{};}});});break;case _0x70d4('0x49'):_0x36f919[_0x70d4('0x4a')]=_0x70d4('0x3b')+_0x378ba1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1a2018+'))';return getZohoUser(_0x36f919,'Contacts')[_0x70d4('0x25')](function(_0x4ca746){if(_0x4ca746)return _0x4ca746;if(_0x33d3d8[_0x70d4('0x3e')]!='nothing'){return createEndUser(_0x499302,_0x378ba1,_0x39d2ce,_0x1a2018,_0x4d7eca,_0x33d3d8);}else{return{};}});break;case'lead':_0x36f919[_0x70d4('0x4a')]=_0x70d4('0x3b')+_0x378ba1+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1a2018+'))';return getZohoUser(_0x36f919,'Leads')[_0x70d4('0x25')](function(_0x23c0e5){if(_0x23c0e5)return _0x23c0e5;if(_0x33d3d8['moduleCreate']!=_0x70d4('0x48')){return createEndUser(_0x499302,_0x378ba1,_0x39d2ce,_0x1a2018,_0x4d7eca,_0x33d3d8);}else{return{};}});break;}}function getCall(_0x1816be,_0x5f1efb,_0x4bd616,_0x234c87,_0x40806e,_0x36e9f6,_0x2bae0e,_0x465ab8){logger['info'](_0x70d4('0x4b'));var _0x43507b={};_0x43507b[_0x70d4('0x4c')]={'name':!_[_0x70d4('0x17')](_0x234c87[_0x70d4('0x3f')][_0x70d4('0x14')])&&!_[_0x70d4('0x17')](_0x234c87[_0x70d4('0x36')]['name'])&&_0x234c87[_0x70d4('0x36')][_0x70d4('0x14')]===_0x70d4('0x4d')?_0x234c87[_0x70d4('0x3f')][_0x70d4('0x14')]:!_[_0x70d4('0x17')](_0x234c87['first_name'])?_0x234c87[_0x70d4('0x40')]+'\x20'+_0x234c87[_0x70d4('0x41')]:_0x234c87[_0x70d4('0x41')],'id':_0x234c87['id']};_0x43507b[_0x70d4('0x4e')]=intUtil['getString'](_0x36e9f6[_0x70d4('0x4f')],_0x2bae0e,'\x20');_0x43507b[_0x70d4('0x50')]=intUtil[_0x70d4('0x51')](_0x36e9f6[_0x70d4('0x52')],_0x2bae0e,'\x0a');if(_0x40806e['enduserType']===_0x70d4('0x53')){_0x43507b[_0x70d4('0x54')]={'name':!_[_0x70d4('0x17')](_0x40806e[_0x70d4('0x55')])?_0x40806e[_0x70d4('0x55')]:!_[_0x70d4('0x17')](_0x40806e[_0x70d4('0x56')])?_0x40806e['First_Name']+'\x20'+_0x40806e[_0x70d4('0x57')]:_0x40806e[_0x70d4('0x57')],'id':_0x40806e['id']};}if(_0x40806e[_0x70d4('0x3a')]==='Leads'){_0x43507b[_0x70d4('0x58')]={'name':!_[_0x70d4('0x17')](_0x40806e[_0x70d4('0x55')])?_0x40806e[_0x70d4('0x55')]:!_[_0x70d4('0x17')](_0x40806e[_0x70d4('0x56')])?_0x40806e[_0x70d4('0x56')]+'\x20'+_0x40806e[_0x70d4('0x57')]:_0x40806e[_0x70d4('0x57')],'id':_0x40806e['id']};_0x43507b[_0x70d4('0x59')]=_[_0x70d4('0x3d')](_0x40806e['enduserType']);}if(_0x2bae0e['talktime']){_0x43507b[_0x70d4('0x5a')]=moment[_0x70d4('0x5b')](parseInt(_0x2bae0e[_0x70d4('0x5c')])*0x3e8)[_0x70d4('0x5d')](_0x70d4('0x5e'));}else if(_0x2bae0e['answertime']&&_0x2bae0e['endtime']){_0x43507b[_0x70d4('0x5a')]=moment['utc'](moment(_0x2bae0e[_0x70d4('0x5f')],_0x70d4('0x60'))[_0x70d4('0x61')](moment(_0x2bae0e[_0x70d4('0x62')],_0x70d4('0x60'))))[_0x70d4('0x5d')](_0x70d4('0x5e'));}switch(_0x2bae0e['lastevent']){case _0x70d4('0x63'):_0x43507b[_0x70d4('0x64')]=_0x70d4('0x65');break;case _0x70d4('0x66'):case'connect':_0x43507b[_0x70d4('0x64')]=_0x70d4('0x67');break;case _0x70d4('0x68'):_0x43507b[_0x70d4('0x64')]=_0x70d4('0x69');break;case _0x70d4('0x6a'):_0x43507b[_0x70d4('0x64')]=_0x70d4('0x6b');break;case _0x70d4('0x6c'):_0x43507b[_0x70d4('0x64')]=_0x70d4('0x6d');default:}_0x43507b['Call_Start_Time']=(_0x465ab8===_0x70d4('0x6e')?moment(_0x2bae0e[_0x70d4('0x62')])['format'](_0x70d4('0x60')):moment(_0x2bae0e[_0x70d4('0x6f')])['format'](_0x70d4('0x60')))||moment()[_0x70d4('0x5d')]('YYYY-MM-DDTHH:mm:ss');_0x43507b[_0x70d4('0x70')]=_0x465ab8||'Inbound';_0x43507b=_[_0x70d4('0x71')](_0x43507b,getCustomFields(_0x36e9f6[_0x70d4('0x72')],_0x2bae0e));return request({'method':_0x70d4('0x20'),'uri':_0x70d4('0x3b')+_0x5f1efb+_0x70d4('0x73'),'headers':{'Authorization':_0x70d4('0x2e')+_0x1816be},'body':{'data':[_0x43507b]},'json':!![]})[_0x70d4('0x25')](function(_0xda35f8){if(_0xda35f8&&_0xda35f8[_0x70d4('0x39')][0x0][_0x70d4('0x74')]===_0x70d4('0x42')){logger[_0x70d4('0x2b')](_0x70d4('0x75'));return{'id':_0xda35f8['data'][0x0][_0x70d4('0x43')]['id']};}})[_0x70d4('0x28')](function(_0x5a3f6b){logger['info']('err',_0x5a3f6b[_0x70d4('0x76')]);console[_0x70d4('0x44')]('err',_0x5a3f6b);});}exports[_0x70d4('0x77')]=function(_0x52e13f,_0x2cd98d,_0x4db842,_0x52d357,_0x278464,_0x1ba276){var _0x15ff0b,_0x5f3c14,_0x2c4d25;_0x1ba276[_0x70d4('0x78')]=intUtil[_0x70d4('0x79')](_0x1ba276[_0x70d4('0x78')]);_0x1ba276[_0x70d4('0x7a')]=intUtil['stripTrailingSlash'](_0x1ba276[_0x70d4('0x7a')]);if(_0x278464&&_0x278464[_0x70d4('0x7b')]){logger[_0x70d4('0x2b')](_0x70d4('0x7c'),'Recording\x20is\x20enabled!');_0x2cd98d['recordingURL']=_0x1ba276[_0x70d4('0x7a')]+'/api/voice/recordings/'+_0x2cd98d[_0x70d4('0x7d')]+_0x70d4('0x7e')+md5(_0x2cd98d[_0x70d4('0x7d')]);}else{_0x2cd98d[_0x70d4('0x7f')]='';}var _0x408f46=_0x1ba276[_0x70d4('0x78')]===_0x70d4('0x80')?'eu':_0x70d4('0x81');return getAccessToken(_0x1ba276)[_0x70d4('0x25')](function(_0xaab035){_0x2c4d25=_0xaab035;return getUser(_0x2c4d25,_0x408f46,_0x1ba276,_0x52d357[_0x70d4('0x32')]);})[_0x70d4('0x25')](function(_0x2019fe){_0x15ff0b=_0x2019fe;logger['info'](_0x70d4('0x82'),_0x15ff0b['id']);return getEndUser(_0x2c4d25,_0x408f46,_0x1ba276,_0x2cd98d[_0x70d4('0x83')],_0x2cd98d['calleridnum'],_0x15ff0b,_0x4db842);})[_0x70d4('0x25')](function(_0x53c789){_0x5f3c14=_0x53c789;return getCall(_0x2c4d25,_0x408f46,_0x1ba276,_0x15ff0b,_0x5f3c14,_0x4db842,_0x2cd98d,_0x70d4('0x84'));})[_0x70d4('0x25')](function(_0x2e8879){if(_0x2e8879){logger['info'](_0x70d4('0x85'),_0x2e8879['id']);logger[_0x70d4('0x2b')](_0x70d4('0x7c'),_0x70d4('0x86'));emit(util[_0x70d4('0x5d')](_0x70d4('0x87'),_0x52d357[_0x70d4('0x14')]),_0x70d4('0x88'),{'uri':'https://crm.'+_0x1ba276['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2e8879['id']});}})[_0x70d4('0x28')](function(_0x45efc3){logger[_0x70d4('0x29')](_0x70d4('0x7c'),JSON[_0x70d4('0xa')](_0x45efc3));});};exports[_0x70d4('0x6e')]=function(_0x1f855c,_0x16be69,_0x2df830,_0x2b9516,_0x352c93,_0x52ee45,_0x4a441e){var _0x1d6e3c,_0x5b489d,_0x4f8c57;_0x52ee45[_0x70d4('0x78')]=intUtil[_0x70d4('0x79')](_0x52ee45['host']);_0x52ee45[_0x70d4('0x7a')]=intUtil[_0x70d4('0x79')](_0x52ee45[_0x70d4('0x7a')]);if(_0x4a441e&&_0x4a441e[_0x70d4('0x89')]&&_0x4a441e[_0x70d4('0x89')]!==_0x70d4('0x8a')){logger[_0x70d4('0x2b')](_0x70d4('0x8b'),_0x70d4('0x8c'));_0x16be69['recordingURL']=_0x52ee45['serverUrl']+'/api/voice/recordings/'+_0x16be69['uniqueid']+_0x70d4('0x7e')+md5(_0x16be69[_0x70d4('0x7d')]);}var _0xec70f8=_0x52ee45['host']===_0x70d4('0x80')?'eu':_0x70d4('0x81');return getAccessToken(_0x52ee45)['then'](function(_0x153467){_0x4f8c57=_0x153467;return getUser(_0x4f8c57,_0xec70f8,_0x52ee45,_0x2b9516[_0x70d4('0x32')]);})[_0x70d4('0x25')](function(_0x177a9c){_0x1d6e3c=_0x177a9c;logger[_0x70d4('0x2b')](_0x70d4('0x82'),_0x1d6e3c['id']);return getEndUser(_0x4f8c57,_0xec70f8,_0x52ee45,_0x16be69[_0x70d4('0x8d')],_0x16be69['destcalleridnum'],_0x1d6e3c,_0x2df830);})[_0x70d4('0x25')](function(_0x2e34f7){_0x5b489d=_0x2e34f7;return getCall(_0x4f8c57,_0xec70f8,_0x52ee45,_0x1d6e3c,_0x5b489d,_0x2df830,_0x16be69,_0x70d4('0x8e'));})[_0x70d4('0x25')](function(_0x2f05a3){if(_0x2f05a3){logger[_0x70d4('0x2b')]('The\x20Call\x20ID\x20is:',_0x2f05a3['id']);logger['info'](_0x70d4('0x8b'),_0x70d4('0x86'));emit(util[_0x70d4('0x5d')]('user:%s',_0x2b9516[_0x70d4('0x14')]),_0x70d4('0x88'),{'uri':'https://crm.'+_0x52ee45['host']+_0x70d4('0x8f')+_0x2f05a3['id']});}})[_0x70d4('0x28')](function(_0xb24a0){logger['error'](_0x70d4('0x8b'),JSON[_0x70d4('0xa')](_0xb24a0));});};exports[_0x70d4('0x90')]=function(_0x59e548,_0x245d78,_0x124605,_0x2a366b,_0x52c643,_0x2b9b70){var _0x46d1ed,_0x3895ca,_0x301399;_0x2b9b70['host']=intUtil[_0x70d4('0x79')](_0x2b9b70['host']);_0x2b9b70[_0x70d4('0x7a')]=intUtil[_0x70d4('0x79')](_0x2b9b70[_0x70d4('0x7a')]);if(_0x52c643&&_0x52c643[_0x70d4('0x7b')]){logger[_0x70d4('0x2b')]('['+_0x245d78[_0x70d4('0x91')][_0x70d4('0x92')]()+']','Recording\x20is\x20enabled!');_0x245d78[_0x70d4('0x7f')]=_0x2b9b70[_0x70d4('0x7a')]+_0x70d4('0x93')+_0x245d78['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x245d78[_0x70d4('0x7d')]);}else{_0x245d78[_0x70d4('0x7f')]='';}var _0x90a4b2=_0x2b9b70[_0x70d4('0x78')]===_0x70d4('0x80')?'eu':_0x70d4('0x81');return getAccessToken(_0x2b9b70)[_0x70d4('0x25')](function(_0x5455c8){_0x301399=_0x5455c8;return getUser(_0x301399,_0x90a4b2,_0x2b9b70);})['then'](function(_0x519d83){_0x46d1ed=_0x519d83;logger['info'](_0x70d4('0x82'),_0x46d1ed['id']);return getEndUser(_0x301399,_0x90a4b2,_0x2b9b70,_0x245d78['calleridname'],_0x245d78[_0x70d4('0x94')],_0x46d1ed,_0x124605);})[_0x70d4('0x25')](function(_0x5de2e7){_0x3895ca=_0x5de2e7;return getCall(_0x301399,_0x90a4b2,_0x2b9b70,_0x46d1ed,_0x3895ca,_0x124605,_0x245d78,_0x70d4('0x84'));})[_0x70d4('0x25')](function(_0x6e0ca4){if(_0x6e0ca4){logger[_0x70d4('0x2b')](_0x70d4('0x85'),_0x6e0ca4['id']);}})[_0x70d4('0x28')](function(_0x3265af){logger[_0x70d4('0x29')]('['+_0x245d78[_0x70d4('0x91')][_0x70d4('0x92')]()+']',JSON[_0x70d4('0xa')](_0x3265af));});}; \ No newline at end of file +var _0x3368=['/oauth/v2/token','clientId','refresh_token','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','moduleCreate','role','first_name','last_name','SUCCESS','data','startCase','Error:\x20','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','complete','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Type','Fields','/crm/v2/Calls','code','Call\x20created!','details','stack','log','err','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','zoho.eu','destcalleridname','destcalleridnum','Outbound','https://crm.','unmanaged','toUpperCase','lodash','md5','ioredis','../../../../config/environment','zoho','redis','localhost','emit','debug','[HTTP]','stringify','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x3368,0x19f));var _0x8336=function(_0x25ff42,_0x1dd28a){_0x25ff42=_0x25ff42-0x0;var _0x2b9f64=_0x3368[_0x25ff42];return _0x2b9f64;};'use strict';var _=require(_0x8336('0x0'));var rp=require('request-promise');var md5=require(_0x8336('0x1'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x8336('0x2'));var BPromise=require('bluebird');var config=require(_0x8336('0x3'));var logger=require('../../../../config/logger')(_0x8336('0x4'));config[_0x8336('0x5')]=_['defaults'](config[_0x8336('0x5')],{'host':_0x8336('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x40f371,_0x590d2f,_0x3c6f1a){io['to'](_0x40f371)[_0x8336('0x7')](_0x590d2f,_0x3c6f1a);}function request(_0x102e26){logger[_0x8336('0x8')](_0x8336('0x9'),JSON[_0x8336('0xa')](_0x102e26));return rp(_0x102e26);}function getCustomFields(_0x2f60d7,_0x49a11d){var _0x35daa4={};if(_0x2f60d7['length']>0x0){_['forEach'](_0x2f60d7,function(_0x462920){if(_[_0x8336('0xb')](['string',_0x8336('0xc')],_0x462920['type'])&&_0x462920[_0x8336('0xd')]){_0x35daa4[_0x462920[_0x8336('0xd')]]=_0x462920[_0x8336('0xe')][_0x8336('0xf')]();}else if(_0x462920[_0x8336('0x10')]===_0x8336('0x11')&&_0x462920[_0x8336('0x12')]&&_0x462920[_0x8336('0xd')]&&_0x49a11d[_0x462920[_0x8336('0x12')]]){_0x35daa4[_0x462920[_0x8336('0xd')]]=_0x49a11d[_0x462920[_0x8336('0x12')]][_0x8336('0xf')]();}else if(_0x462920[_0x8336('0x10')]===_0x8336('0x13')&&_0x462920[_0x8336('0x14')]&&_0x462920[_0x8336('0x14')][_0x8336('0x15')]&&_0x462920[_0x8336('0xd')]&&_0x49a11d[_0x462920['Variable']['name']['toLowerCase']()]){_0x35daa4[_0x462920['idField']]=_0x49a11d[_0x462920['Variable']['name'][_0x8336('0x16')]()][_0x8336('0xf')]();}});}return _0x35daa4;}function getName(_0x5a76f6){if(_0x5a76f6['indexOf']('\x20')>0x0){var _0xdd30dd=_0x5a76f6['split'](/ (.+)/);if(_0xdd30dd[0x1]){return _0xdd30dd;}}return[_0x5a76f6,_0x5a76f6];}var accountsTokens={};function getAccessToken(_0x386a16){return new Promise(function(_0x3d9b16,_0x6b459a){if(!_[_0x8336('0x17')](accountsTokens[_0x386a16['id']])&&!_['isNil'](accountsTokens[_0x386a16['id']][_0x8336('0x18')])){if(moment()[_0x8336('0x19')](accountsTokens[_0x386a16['id']][_0x8336('0x1a')])){_0x3d9b16(accountsTokens[_0x386a16['id']][_0x8336('0x18')]);}}var _0x1971aa;switch(_0x386a16[_0x8336('0x1b')]){case'US':_0x1971aa=_0x8336('0x1c');break;case'AU':_0x1971aa='https://accounts.zoho.com.au';break;case'EU':_0x1971aa=_0x8336('0x1d');break;case'IN':_0x1971aa='https://accounts.zoho.in';break;case'CN':_0x1971aa=_0x8336('0x1e');break;default:_0x1971aa='https://accounts.zoho.eu';break;}var _0x3413c5={'method':_0x8336('0x1f'),'uri':_0x1971aa+_0x8336('0x20'),'qs':{'refresh_token':_0x386a16['refreshToken'],'client_id':_0x386a16[_0x8336('0x21')],'client_secret':_0x386a16['clientSecret'],'grant_type':_0x8336('0x22')},'json':!![]};return rp(_0x3413c5)['then'](function(_0x10ebba){accountsTokens[_0x386a16['id']]={'access_token':_0x10ebba[_0x8336('0x18')],'expires_in':moment()['add'](_0x10ebba[_0x8336('0x1a')],_0x8336('0x23'))};_0x3d9b16(_0x10ebba['access_token']);})[_0x8336('0x24')](function(_0x1e1468){logger['error'](_0x8336('0x25'),_0x1e1468['stack']);_0x6b459a(_0x1e1468);});});}function getUser(_0x619bbe,_0x73f04e,_0x2db2fa,_0x508192){logger[_0x8336('0x26')](_0x8336('0x27'));return request({'method':_0x8336('0x28'),'uri':util[_0x8336('0x29')](_0x8336('0x2a'),_0x73f04e),'qs':{'type':_0x8336('0x2b')},'headers':{'Authorization':_0x8336('0x2c')+_0x619bbe},'json':!![]})[_0x8336('0x2d')](function(_0x5185dd){if(_0x5185dd[_0x8336('0x2e')]){var _0x346ad6=-0x1;if(_[_0x8336('0x2f')](_0x5185dd[_0x8336('0x2e')])){if(!_[_0x8336('0x17')](_0x508192)){_0x346ad6=_[_0x8336('0x30')](_0x5185dd[_0x8336('0x2e')],function(_0x429152){return _0x429152[_0x8336('0x31')]===_0x508192;});}if(_0x346ad6>=0x0){logger[_0x8336('0x26')](_0x8336('0x32'));}else{logger[_0x8336('0x26')](_0x8336('0x33'));_0x346ad6=_[_0x8336('0x30')](_0x5185dd[_0x8336('0x2e')],function(_0x4d9606){return _0x4d9606[_0x8336('0x34')][_0x8336('0x15')]==='Administrator';});}return _0x5185dd[_0x8336('0x2e')][_0x346ad6];}else{if(_0x5185dd[_0x8336('0x35')][_0x8336('0x34')]['name']==='Administrator'){logger['info'](_0x8336('0x33'));user=_0x5185dd[_0x8336('0x35')];return user;}else{logger[_0x8336('0x36')](_0x8336('0x37'),JSON['stringify'](_0x5185dd));throw new Error(_0x8336('0x38')+JSON['stringify'](_0x5185dd));}}}else{logger[_0x8336('0x36')](_0x8336('0x37'),JSON[_0x8336('0xa')](_0x5185dd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5185dd));}})[_0x8336('0x24')](function(_0x20246e){console[_0x8336('0x36')](_0x20246e);});}function getZohoUser(_0x48d732,_0x2b6fb7){return new BPromise(function(_0x1d5ec8,_0x458ae0){request(_0x48d732)[_0x8336('0x2d')](function(_0xa77b21){var _0x14b786=null;if(_0xa77b21){_0x14b786=_0xa77b21['data'][0x0];_0x14b786[_0x8336('0x39')]=_0x2b6fb7;}_0x1d5ec8(_0x14b786);})[_0x8336('0x24')](function(_0x412216){_0x458ae0(_0x412216);});});}function createEndUser(_0x2b57d9,_0x19ef60,_0x170e56,_0x4fd3e0,_0x79ae3a,_0x28436f){var _0x170e56=getName(_0x170e56);return request({'method':_0x8336('0x1f'),'uri':_0x8336('0x3a')+_0x19ef60+'/crm/v2/'+_['startCase'](_0x28436f[_0x8336('0x3b')])+'s','body':{'data':[{'Last_Name':_0x170e56[0x1],'First_Name':_0x170e56[0x0],'Phone':_0x4fd3e0,'Owner':{'name':!_[_0x8336('0x17')](_0x79ae3a[_0x8336('0x3c')][_0x8336('0x15')])?_0x79ae3a[_0x8336('0x3c')][_0x8336('0x15')]:!_[_0x8336('0x17')](_0x79ae3a[_0x8336('0x3d')])?_0x79ae3a[_0x8336('0x3d')]+'\x20'+_0x79ae3a[_0x8336('0x3e')]:_0x79ae3a[_0x8336('0x3e')],'id':_0x79ae3a['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2b57d9},'json':!![]})[_0x8336('0x2d')](function(_0x20f629){if(_0x20f629&&_0x20f629['data'][0x0]['code']===_0x8336('0x3f')){var _0x19a836=_0x20f629[_0x8336('0x40')][0x0]['details'];_0x19a836[_0x8336('0x39')]=_[_0x8336('0x41')](_0x28436f[_0x8336('0x3b')])+'s';return _0x19a836;}logger[_0x8336('0x36')](_0x8336('0x37'),JSON[_0x8336('0xa')](data));throw new Error(_0x8336('0x42')+JSON[_0x8336('0xa')](data));})['catch'](function(_0x417e17){console['log'](_0x8336('0x43'),_0x417e17);});}function getEndUser(_0xb2782e,_0x15fb36,_0x1ed184,_0x5d1b0f,_0x167074,_0x4051ab,_0x37ca97){var _0x3cbb81={'method':_0x8336('0x28'),'uri':'','headers':{'Authorization':_0x8336('0x2c')+_0xb2782e},'json':!![]};switch(_0x37ca97['moduleSearch']){case _0x8336('0x44'):_0x3cbb81['uri']=_0x8336('0x3a')+_0x15fb36+_0x8336('0x45')+_0x167074+'))';return getZohoUser(_0x3cbb81,_0x8336('0x46'))['then'](function(_0x12502a){if(_0x12502a)return _0x12502a;_0x3cbb81[_0x8336('0x47')]=_0x8336('0x3a')+_0x15fb36+_0x8336('0x48')+_0x167074+'))';return getZohoUser(_0x3cbb81,_0x8336('0x49'))[_0x8336('0x2d')](function(_0x21a751){if(_0x21a751)return _0x21a751;if(_0x37ca97[_0x8336('0x3b')]!='nothing'){return createEndUser(_0xb2782e,_0x15fb36,_0x5d1b0f,_0x167074,_0x4051ab,_0x37ca97);}else{return{};}});});break;case _0x8336('0x4a'):_0x3cbb81[_0x8336('0x47')]=_0x8336('0x3a')+_0x15fb36+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x167074+'))';return getZohoUser(_0x3cbb81,_0x8336('0x46'))[_0x8336('0x2d')](function(_0x3af80f){if(_0x3af80f)return _0x3af80f;if(_0x37ca97[_0x8336('0x3b')]!=_0x8336('0x4b')){return createEndUser(_0xb2782e,_0x15fb36,_0x5d1b0f,_0x167074,_0x4051ab,_0x37ca97);}else{return{};}});break;case'lead':_0x3cbb81[_0x8336('0x47')]=_0x8336('0x3a')+_0x15fb36+_0x8336('0x48')+_0x167074+'))';return getZohoUser(_0x3cbb81,_0x8336('0x49'))[_0x8336('0x2d')](function(_0x57f936){if(_0x57f936)return _0x57f936;if(_0x37ca97['moduleCreate']!='nothing'){return createEndUser(_0xb2782e,_0x15fb36,_0x5d1b0f,_0x167074,_0x4051ab,_0x37ca97);}else{return{};}});break;}}function getCall(_0x17d09b,_0x3eff7b,_0x3f861,_0x2195ca,_0x3c5688,_0x4216ad,_0x48ab12,_0x5b478e){logger['info'](_0x8336('0x4c'));var _0x13174e={};_0x13174e[_0x8336('0x4d')]={'name':!_['isNil'](_0x2195ca[_0x8336('0x3c')]['name'])&&!_['isNil'](_0x2195ca[_0x8336('0x34')]['name'])&&_0x2195ca[_0x8336('0x34')][_0x8336('0x15')]==='administrator'?_0x2195ca[_0x8336('0x3c')]['name']:!_[_0x8336('0x17')](_0x2195ca[_0x8336('0x3d')])?_0x2195ca[_0x8336('0x3d')]+'\x20'+_0x2195ca[_0x8336('0x3e')]:_0x2195ca[_0x8336('0x3e')],'id':_0x2195ca['id']};_0x13174e[_0x8336('0x4e')]=intUtil[_0x8336('0x4f')](_0x4216ad[_0x8336('0x50')],_0x48ab12,'\x20');_0x13174e[_0x8336('0x51')]=intUtil[_0x8336('0x4f')](_0x4216ad[_0x8336('0x52')],_0x48ab12,'\x0a');if(_0x3c5688[_0x8336('0x39')]===_0x8336('0x46')){_0x13174e[_0x8336('0x53')]={'name':!_[_0x8336('0x17')](_0x3c5688[_0x8336('0x54')])?_0x3c5688['Full_Name']:!_[_0x8336('0x17')](_0x3c5688['First_Name'])?_0x3c5688['First_Name']+'\x20'+_0x3c5688['Last_Name']:_0x3c5688[_0x8336('0x55')],'id':_0x3c5688['id']};}if(_0x3c5688[_0x8336('0x39')]===_0x8336('0x49')){_0x13174e[_0x8336('0x56')]={'name':!_[_0x8336('0x17')](_0x3c5688['Full_Name'])?_0x3c5688[_0x8336('0x54')]:!_[_0x8336('0x17')](_0x3c5688[_0x8336('0x57')])?_0x3c5688['First_Name']+'\x20'+_0x3c5688[_0x8336('0x55')]:_0x3c5688['Last_Name'],'id':_0x3c5688['id']};_0x13174e[_0x8336('0x58')]=_[_0x8336('0x41')](_0x3c5688[_0x8336('0x39')]);}if(_0x48ab12[_0x8336('0x59')]){_0x13174e[_0x8336('0x5a')]=moment[_0x8336('0x5b')](parseInt(_0x48ab12[_0x8336('0x59')])*0x3e8)['format'](_0x8336('0x5c'));}else if(_0x48ab12[_0x8336('0x5d')]&&_0x48ab12[_0x8336('0x5e')]){_0x13174e['Call_Duration']=moment[_0x8336('0x5b')](moment(_0x48ab12['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x8336('0x5f')](moment(_0x48ab12[_0x8336('0x60')],_0x8336('0x61'))))[_0x8336('0x29')](_0x8336('0x5c'));}switch(_0x48ab12[_0x8336('0x62')]){case _0x8336('0x63'):_0x13174e[_0x8336('0x64')]='Called';break;case _0x8336('0x65'):case'connect':_0x13174e[_0x8336('0x64')]=_0x8336('0x66');break;case _0x8336('0x67'):_0x13174e['Call_Result']=_0x8336('0x68');break;case _0x8336('0x69'):_0x13174e[_0x8336('0x64')]='Abandoned';break;case _0x8336('0x6a'):_0x13174e[_0x8336('0x64')]=_0x8336('0x6b');default:}_0x13174e['Call_Start_Time']=(_0x5b478e==='outbound'?moment(_0x48ab12[_0x8336('0x60')])[_0x8336('0x29')](_0x8336('0x61')):moment(_0x48ab12['agentcalledAt'])['format'](_0x8336('0x61')))||moment()['format'](_0x8336('0x61'));_0x13174e[_0x8336('0x6c')]=_0x5b478e||'Inbound';_0x13174e=_['merge'](_0x13174e,getCustomFields(_0x4216ad[_0x8336('0x6d')],_0x48ab12));return request({'method':_0x8336('0x1f'),'uri':'https://www.zohoapis.'+_0x3eff7b+_0x8336('0x6e'),'headers':{'Authorization':_0x8336('0x2c')+_0x17d09b},'body':{'data':[_0x13174e]},'json':!![]})['then'](function(_0x10fce6){if(_0x10fce6&&_0x10fce6[_0x8336('0x40')][0x0][_0x8336('0x6f')]===_0x8336('0x3f')){logger['info'](_0x8336('0x70'));return{'id':_0x10fce6['data'][0x0][_0x8336('0x71')]['id']};}})[_0x8336('0x24')](function(_0x1ab718){logger[_0x8336('0x26')]('err',_0x1ab718[_0x8336('0x72')]);console[_0x8336('0x73')](_0x8336('0x74'),_0x1ab718);});}exports[_0x8336('0x75')]=function(_0x1a09fa,_0x1a5e67,_0x24365d,_0x2f83c2,_0x55a295,_0x3dc239){var _0x4de069,_0x47c283,_0x32a5c3;_0x3dc239[_0x8336('0x76')]=intUtil[_0x8336('0x77')](_0x3dc239[_0x8336('0x76')]);_0x3dc239['serverUrl']=intUtil[_0x8336('0x77')](_0x3dc239['serverUrl']);if(_0x55a295&&_0x55a295[_0x8336('0x78')]){logger['info'](_0x8336('0x79'),_0x8336('0x7a'));_0x1a5e67[_0x8336('0x7b')]=_0x3dc239[_0x8336('0x7c')]+'/api/voice/recordings/'+_0x1a5e67[_0x8336('0x7d')]+_0x8336('0x7e')+md5(_0x1a5e67[_0x8336('0x7d')]);}else{_0x1a5e67[_0x8336('0x7b')]='';}var _0x16a98b=_0x3dc239[_0x8336('0x76')]==='zoho.eu'?'eu':_0x8336('0x7f');return getAccessToken(_0x3dc239)['then'](function(_0x5423c5){_0x32a5c3=_0x5423c5;return getUser(_0x32a5c3,_0x16a98b,_0x3dc239,_0x2f83c2['email']);})[_0x8336('0x2d')](function(_0x295754){_0x4de069=_0x295754;logger[_0x8336('0x26')](_0x8336('0x80'),_0x4de069['id']);return getEndUser(_0x32a5c3,_0x16a98b,_0x3dc239,_0x1a5e67[_0x8336('0x81')],_0x1a5e67[_0x8336('0x82')],_0x4de069,_0x24365d);})[_0x8336('0x2d')](function(_0x32c950){_0x47c283=_0x32c950;return getCall(_0x32a5c3,_0x16a98b,_0x3dc239,_0x4de069,_0x47c283,_0x24365d,_0x1a5e67,_0x8336('0x83'));})['then'](function(_0x3d9a89){if(_0x3d9a89){logger['info'](_0x8336('0x84'),_0x3d9a89['id']);logger[_0x8336('0x26')](_0x8336('0x79'),_0x8336('0x85'));emit(util['format'](_0x8336('0x86'),_0x2f83c2[_0x8336('0x15')]),_0x8336('0x87'),{'uri':'https://crm.'+_0x3dc239[_0x8336('0x76')]+_0x8336('0x88')+_0x3d9a89['id']});}})[_0x8336('0x24')](function(_0x3a6e68){logger[_0x8336('0x36')](_0x8336('0x79'),JSON[_0x8336('0xa')](_0x3a6e68));});};exports[_0x8336('0x89')]=function(_0x5512af,_0x2d50e2,_0x49cedb,_0xa2a61e,_0x3a68b8,_0x1e8e3,_0x1a5cbd){var _0x5af4e2,_0x14dea4,_0x3bf321;_0x1e8e3[_0x8336('0x76')]=intUtil[_0x8336('0x77')](_0x1e8e3[_0x8336('0x76')]);_0x1e8e3[_0x8336('0x7c')]=intUtil[_0x8336('0x77')](_0x1e8e3[_0x8336('0x7c')]);if(_0x1a5cbd&&_0x1a5cbd[_0x8336('0x8a')]&&_0x1a5cbd[_0x8336('0x8a')]!==_0x8336('0x8b')){logger['info'](_0x8336('0x8c'),'Recording\x20is\x20enabled!');_0x2d50e2[_0x8336('0x7b')]=_0x1e8e3[_0x8336('0x7c')]+_0x8336('0x8d')+_0x2d50e2[_0x8336('0x7d')]+_0x8336('0x7e')+md5(_0x2d50e2[_0x8336('0x7d')]);}var _0x51d573=_0x1e8e3['host']===_0x8336('0x8e')?'eu':_0x8336('0x7f');return getAccessToken(_0x1e8e3)[_0x8336('0x2d')](function(_0x27ed1a){_0x3bf321=_0x27ed1a;return getUser(_0x3bf321,_0x51d573,_0x1e8e3,_0xa2a61e[_0x8336('0x31')]);})[_0x8336('0x2d')](function(_0x12e5a2){_0x5af4e2=_0x12e5a2;logger[_0x8336('0x26')]('The\x20User\x20ID\x20is:',_0x5af4e2['id']);return getEndUser(_0x3bf321,_0x51d573,_0x1e8e3,_0x2d50e2[_0x8336('0x8f')],_0x2d50e2[_0x8336('0x90')],_0x5af4e2,_0x49cedb);})[_0x8336('0x2d')](function(_0x16325e){_0x14dea4=_0x16325e;return getCall(_0x3bf321,_0x51d573,_0x1e8e3,_0x5af4e2,_0x14dea4,_0x49cedb,_0x2d50e2,_0x8336('0x91'));})[_0x8336('0x2d')](function(_0x269a46){if(_0x269a46){logger[_0x8336('0x26')](_0x8336('0x84'),_0x269a46['id']);logger['info'](_0x8336('0x8c'),_0x8336('0x85'));emit(util[_0x8336('0x29')](_0x8336('0x86'),_0xa2a61e[_0x8336('0x15')]),_0x8336('0x87'),{'uri':_0x8336('0x92')+_0x1e8e3[_0x8336('0x76')]+_0x8336('0x88')+_0x269a46['id']});}})[_0x8336('0x24')](function(_0x446d8b){logger[_0x8336('0x36')](_0x8336('0x8c'),JSON[_0x8336('0xa')](_0x446d8b));});};exports[_0x8336('0x93')]=function(_0x19f7e9,_0x3c58e9,_0x4bb17b,_0x413758,_0x1e2353,_0x8dc28){var _0x33da74,_0x5e5a5b,_0x14424a;_0x8dc28[_0x8336('0x76')]=intUtil['stripTrailingSlash'](_0x8dc28[_0x8336('0x76')]);_0x8dc28[_0x8336('0x7c')]=intUtil[_0x8336('0x77')](_0x8dc28[_0x8336('0x7c')]);if(_0x1e2353&&_0x1e2353[_0x8336('0x78')]){logger['info']('['+_0x3c58e9[_0x8336('0x62')][_0x8336('0x94')]()+']','Recording\x20is\x20enabled!');_0x3c58e9[_0x8336('0x7b')]=_0x8dc28[_0x8336('0x7c')]+_0x8336('0x8d')+_0x3c58e9[_0x8336('0x7d')]+_0x8336('0x7e')+md5(_0x3c58e9[_0x8336('0x7d')]);}else{_0x3c58e9['recordingURL']='';}var _0x15466e=_0x8dc28[_0x8336('0x76')]===_0x8336('0x8e')?'eu':'com';return getAccessToken(_0x8dc28)[_0x8336('0x2d')](function(_0x30fb7c){_0x14424a=_0x30fb7c;return getUser(_0x14424a,_0x15466e,_0x8dc28);})[_0x8336('0x2d')](function(_0x1c0f01){_0x33da74=_0x1c0f01;logger[_0x8336('0x26')](_0x8336('0x80'),_0x33da74['id']);return getEndUser(_0x14424a,_0x15466e,_0x8dc28,_0x3c58e9['calleridname'],_0x3c58e9['calleridnum'],_0x33da74,_0x4bb17b);})[_0x8336('0x2d')](function(_0x33b55f){_0x5e5a5b=_0x33b55f;return getCall(_0x14424a,_0x15466e,_0x8dc28,_0x33da74,_0x5e5a5b,_0x4bb17b,_0x3c58e9,_0x8336('0x83'));})['then'](function(_0x3e68e4){if(_0x3e68e4){logger[_0x8336('0x26')](_0x8336('0x84'),_0x3e68e4['id']);}})[_0x8336('0x24')](function(_0x4b9e3c){logger[_0x8336('0x36')]('['+_0x3c58e9['lastevent'][_0x8336('0x94')]()+']',JSON[_0x8336('0xa')](_0x4b9e3c));});}; \ 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 7281503..c7dbd0c 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 _0x1a16=['data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script'];(function(_0xbb1dd2,_0x25f832){var _0x551936=function(_0x1e9cef){while(--_0x1e9cef){_0xbb1dd2['push'](_0xbb1dd2['shift']());}};_0x551936(++_0x25f832);}(_0x1a16,0x1b8));var _0x61a1=function(_0x46bed5,_0x141b81){_0x46bed5=_0x46bed5-0x0;var _0x1205ae=_0x1a16[_0x46bed5];return _0x1205ae;};'use strict';var util=require(_0x61a1('0x0'));var sh=require(_0x61a1('0x1'));var Mustache=require(_0x61a1('0x2'));var logger=require(_0x61a1('0x3'))(_0x61a1('0x4'));exports[_0x61a1('0x5')]=function(_0x3e2c14,_0x3785c6){var _0x504d19=_0x3e2c14[_0x61a1('0x6')]?_0x3e2c14[_0x61a1('0x6')]:_0x61a1('0x7');var _0x24002d=_0x3e2c14[_0x61a1('0x8')]?Mustache[_0x61a1('0x9')](_0x3e2c14['data3'],_0x3785c6):_0x3785c6;sh[_0x61a1('0x5')](_0x24002d,function(_0x2c09e0,_0x460cb8,_0x17395a){if(_0x2c09e0!==0x0){logger['error'](util[_0x61a1('0xa')](_0x61a1('0xb'),_0x504d19,_0x24002d,_0x2c09e0,_0x17395a));}else{logger[_0x61a1('0xc')](util[_0x61a1('0xa')](_0x61a1('0xd'),_0x504d19,_0x24002d,_0x460cb8));}});}; \ No newline at end of file +var _0x3623=['shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','util'];(function(_0x498f1a,_0x2dba93){var _0x89ce72=function(_0x536770){while(--_0x536770){_0x498f1a['push'](_0x498f1a['shift']());}};_0x89ce72(++_0x2dba93);}(_0x3623,0x6b));var _0x3362=function(_0x5e13af,_0x5461e0){_0x5e13af=_0x5e13af-0x0;var _0x3dbfa0=_0x3623[_0x5e13af];return _0x3dbfa0;};'use strict';var util=require(_0x3362('0x0'));var sh=require(_0x3362('0x1'));var Mustache=require(_0x3362('0x2'));var logger=require(_0x3362('0x3'))('trigger');exports[_0x3362('0x4')]=function(_0x3194d0,_0x3d3de9){var _0x5e6c95=_0x3194d0[_0x3362('0x5')]?_0x3194d0[_0x3362('0x5')]:_0x3362('0x6');var _0x4ac7b0=_0x3194d0[_0x3362('0x7')]?Mustache[_0x3362('0x8')](_0x3194d0[_0x3362('0x7')],_0x3d3de9):_0x3d3de9;sh['exec'](_0x4ac7b0,function(_0xc6fc21,_0x5e7845,_0x25a13c){if(_0xc6fc21!==0x0){logger[_0x3362('0x9')](util['format'](_0x3362('0xa'),_0x5e6c95,_0x4ac7b0,_0xc6fc21,_0x25a13c));}else{logger['info'](util[_0x3362('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x5e6c95,_0x4ac7b0,_0x5e7845));}});}; \ 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 3661039..42b2480 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 _0xb506=['%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','format','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data2','data5','number','headers','data6','error','stack','data1','GET','DELETE','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0x19e278,_0x3a9473){var _0x5f5681=function(_0x23945f){while(--_0x23945f){_0x19e278['push'](_0x19e278['shift']());}};_0x5f5681(++_0x3a9473);}(_0xb506,0x1b7));var _0x6b50=function(_0xceac83,_0x20bcf0){_0xceac83=_0xceac83-0x0;var _0x2c0d44=_0xb506[_0xceac83];return _0x2c0d44;};'use strict';var rp=require(_0x6b50('0x0'));var util=require(_0x6b50('0x1'));var _=require('lodash');var Mustache=require(_0x6b50('0x2'));var logger=require(_0x6b50('0x3'))(_0x6b50('0x4'));exports[_0x6b50('0x5')]=function(_0x51bce0,_0x491005){var _0x53c5f4,_0x5cd13d;var _0x35e0fc={'method':_0x51bce0['data1'][_0x6b50('0x6')](),'uri':Mustache[_0x6b50('0x7')](_0x51bce0[_0x6b50('0x8')],_0x491005),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x51bce0[_0x6b50('0x9')])===_0x6b50('0xa')&&parseInt(_0x51bce0['data5'])>=0x1&&parseInt(_0x51bce0[_0x6b50('0x9')])<=0xa?parseInt(_0x51bce0[_0x6b50('0x9')])*0x3e8:0x5*0x3e8};try{_0x35e0fc[_0x6b50('0xb')]=_0x51bce0[_0x6b50('0xc')]?JSON['parse'](Mustache[_0x6b50('0x7')](_0x51bce0[_0x6b50('0xc')],_0x491005)):{};}catch(_0x2eb7a0){logger[_0x6b50('0xd')](_0x2eb7a0[_0x6b50('0xe')]);}switch(_0x51bce0[_0x6b50('0xf')][_0x6b50('0x6')]()){case _0x6b50('0x10'):case _0x6b50('0x11'):_0x53c5f4=null;_0x35e0fc['qs']=_0x491005;break;case _0x6b50('0x12'):case'PUT':if(_0x51bce0[_0x6b50('0x13')]){try{_0x53c5f4=JSON[_0x6b50('0x14')](Mustache['render'](_0x51bce0[_0x6b50('0x13')],_0x491005));_0x35e0fc[_0x6b50('0x15')]=_0x53c5f4;}catch(_0xfdf28c){logger[_0x6b50('0xd')](_0xfdf28c['stack']);logger[_0x6b50('0xd')](_0x6b50('0x16'));}}else{_0x53c5f4=_0x491005;_0x35e0fc[_0x6b50('0x15')]=_0x53c5f4;}break;}logger['info'](util['format'](_0x6b50('0x17'),_0x51bce0[_0x6b50('0xf')],_0x51bce0[_0x6b50('0x8')],JSON['stringify'](_0x35e0fc)));rp(_0x35e0fc)[_0x6b50('0x18')](function(_0x15a9e0){_0x53c5f4=!_[_0x6b50('0x19')](_0x53c5f4)?',\x20request\x20body:\x20'+_0x53c5f4:'';_0x5cd13d=typeof _0x15a9e0[_0x6b50('0x15')]===_0x6b50('0x1a')?JSON['stringify'](_0x15a9e0['body']):_0x15a9e0['body'];logger[_0x6b50('0x1b')](util['format'](_0x6b50('0x1c'),_0x51bce0[_0x6b50('0xf')],_0x51bce0[_0x6b50('0x8')],_0x15a9e0[_0x6b50('0x1d')],_0x5cd13d));})[_0x6b50('0x1e')](function(_0x104286){logger['error'](util[_0x6b50('0x1f')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x51bce0[_0x6b50('0xf')],_0x51bce0[_0x6b50('0x8')],_0x104286['statusCode'],_0x104286['name'],_0x104286[_0x6b50('0x20')]));});}; \ No newline at end of file +var _0x147b=['isNil','object','data2','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','lodash','mustache','trigger','exec','data1','render','number','data5','headers','data6','error','toUpperCase','GET','DELETE','POST','data7','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x147b,0xe0));var _0xb147=function(_0x454f20,_0x59efa2){_0x454f20=_0x454f20-0x0;var _0x18331c=_0x147b[_0x454f20];return _0x18331c;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xb147('0x0'));var Mustache=require(_0xb147('0x1'));var logger=require('../../../../config/logger')(_0xb147('0x2'));exports[_0xb147('0x3')]=function(_0x47ecbc,_0x53ec5d){var _0x339b9e,_0x547fe2;var _0x34ec1d={'method':_0x47ecbc[_0xb147('0x4')]['toUpperCase'](),'uri':Mustache[_0xb147('0x5')](_0x47ecbc['data2'],_0x53ec5d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x47ecbc['data5'])===_0xb147('0x6')&&parseInt(_0x47ecbc[_0xb147('0x7')])>=0x1&&parseInt(_0x47ecbc['data5'])<=0xa?parseInt(_0x47ecbc[_0xb147('0x7')])*0x3e8:0x5*0x3e8};try{_0x34ec1d[_0xb147('0x8')]=_0x47ecbc[_0xb147('0x9')]?JSON['parse'](Mustache[_0xb147('0x5')](_0x47ecbc['data6'],_0x53ec5d)):{};}catch(_0x470690){logger[_0xb147('0xa')](_0x470690['stack']);}switch(_0x47ecbc[_0xb147('0x4')][_0xb147('0xb')]()){case _0xb147('0xc'):case _0xb147('0xd'):_0x339b9e=null;_0x34ec1d['qs']=_0x53ec5d;break;case _0xb147('0xe'):case'PUT':if(_0x47ecbc[_0xb147('0xf')]){try{_0x339b9e=JSON['parse'](Mustache['render'](_0x47ecbc[_0xb147('0xf')],_0x53ec5d));_0x34ec1d['body']=_0x339b9e;}catch(_0x3d668c){logger[_0xb147('0xa')](_0x3d668c[_0xb147('0x10')]);logger[_0xb147('0xa')](_0xb147('0x11'));}}else{_0x339b9e=_0x53ec5d;_0x34ec1d[_0xb147('0x12')]=_0x339b9e;}break;}logger[_0xb147('0x13')](util[_0xb147('0x14')](_0xb147('0x15'),_0x47ecbc[_0xb147('0x4')],_0x47ecbc['data2'],JSON[_0xb147('0x16')](_0x34ec1d)));rp(_0x34ec1d)[_0xb147('0x17')](function(_0x18f563){_0x339b9e=!_[_0xb147('0x18')](_0x339b9e)?',\x20request\x20body:\x20'+_0x339b9e:'';_0x547fe2=typeof _0x18f563['body']===_0xb147('0x19')?JSON[_0xb147('0x16')](_0x18f563[_0xb147('0x12')]):_0x18f563[_0xb147('0x12')];logger[_0xb147('0x13')](util[_0xb147('0x14')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x47ecbc[_0xb147('0x4')],_0x47ecbc[_0xb147('0x1a')],_0x18f563[_0xb147('0x1b')],_0x547fe2));})[_0xb147('0x1c')](function(_0xf67b7c){logger[_0xb147('0xa')](util[_0xb147('0x14')](_0xb147('0x1d'),_0x47ecbc[_0xb147('0x4')],_0x47ecbc[_0xb147('0x1a')],_0xf67b7c[_0xb147('0x1b')],_0xf67b7c[_0xb147('0x1e')],_0xf67b7c['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index a917dd0..d1223fa 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 _0xe14a=['Request','request','then','rpc','error','message','exports','bluebird','../../config/logger','routing','client','http'];(function(_0x38266b,_0x52e26b){var _0x1c1b43=function(_0x3e7c52){while(--_0x3e7c52){_0x38266b['push'](_0x38266b['shift']());}};_0x1c1b43(++_0x52e26b);}(_0xe14a,0x193));var _0xae14=function(_0x37f01a,_0x4ef283){_0x37f01a=_0x37f01a-0x0;var _0x215f10=_0xe14a[_0x37f01a];return _0x215f10;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xae14('0x0'));var logger=require(_0xae14('0x1'))(_0xae14('0x2'));var client=jayson[_0xae14('0x3')][_0xae14('0x4')]({'port':0x2329});client[_0xae14('0x5')]=function(_0xcf5933,_0x52ce5f){return new BPromise(function(_0x5d0a36,_0x21a4b3){return client[_0xae14('0x6')](_0xcf5933,_0x52ce5f)[_0xae14('0x7')](function(_0x5273c4){logger['debug'](_0xae14('0x8'),'routing',_0xcf5933,_0x52ce5f,_0x5273c4);if(_0x5273c4[_0xae14('0x9')]){logger[_0xae14('0x9')]('rpc','routing',_0xcf5933,_0x5273c4['error'][_0xae14('0xa')],_0x52ce5f);return _0x21a4b3(_0x5273c4[_0xae14('0x9')][_0xae14('0xa')]);}else{return _0x5d0a36(_0x5273c4['result']);}})['catch'](function(_0x4e883e){logger[_0xae14('0x9')](_0xae14('0x8'),_0xae14('0x2'),_0xcf5933,_0x4e883e,_0x52ce5f);return _0x21a4b3(_0x4e883e);});});};module[_0xae14('0xb')]=client; \ No newline at end of file +var _0x8d36=['then','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x8d36,0x11f));var _0x68d3=function(_0x713076,_0x20c1e7){_0x713076=_0x713076-0x0;var _0x1dabdd=_0x8d36[_0x713076];return _0x1dabdd;};'use strict';var jayson=require(_0x68d3('0x0'));var BPromise=require(_0x68d3('0x1'));var logger=require(_0x68d3('0x2'))(_0x68d3('0x3'));var client=jayson[_0x68d3('0x4')][_0x68d3('0x5')]({'port':0x2329});client[_0x68d3('0x6')]=function(_0x172d80,_0x30adfd){return new BPromise(function(_0xdbdc10,_0x4a92f6){return client['request'](_0x172d80,_0x30adfd)[_0x68d3('0x7')](function(_0x20099f){logger[_0x68d3('0x8')](_0x68d3('0x9'),_0x68d3('0x3'),_0x172d80,_0x30adfd,_0x20099f);if(_0x20099f[_0x68d3('0xa')]){logger['error'](_0x68d3('0x9'),'routing',_0x172d80,_0x20099f['error'][_0x68d3('0xb')],_0x30adfd);return _0x4a92f6(_0x20099f[_0x68d3('0xa')][_0x68d3('0xb')]);}else{return _0xdbdc10(_0x20099f[_0x68d3('0xc')]);}})[_0x68d3('0xd')](function(_0x53b181){logger[_0x68d3('0xa')](_0x68d3('0x9'),'routing',_0x172d80,_0x53b181,_0x30adfd);return _0x4a92f6(_0x53b181);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 63593de..8c3997a 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 _0xf84a=['getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','log','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','then'];(function(_0x5235a7,_0x3a065b){var _0x463bbf=function(_0x5934bc){while(--_0x5934bc){_0x5235a7['push'](_0x5235a7['shift']());}};_0x463bbf(++_0x3a065b);}(_0xf84a,0x97));var _0xaf84=function(_0x521b95,_0x4882f1){_0x521b95=_0x521b95-0x0;var _0x8ce25=_0xf84a[_0x521b95];return _0x8ce25;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xaf84('0x0'));var EmailChannel=require(_0xaf84('0x1'));var mailAccount=require(_0xaf84('0x2'));var setting=require(_0xaf84('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xaf84('0x4')](mailAccount[_0xaf84('0x5')]())['then'](realtime[_0xaf84('0x6')]())[_0xaf84('0x4')](function(){email[_0xaf84('0x7')](realtime[_0xaf84('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xaf84('0x4')](function(){return initRealtime();})[_0xaf84('0x4')](function(){return setting[_0xaf84('0x9')]();})[_0xaf84('0x4')](function(_0x5a8671){return setInterval(initRealtime,_0x5a8671[_0xaf84('0xa')]*0x3e8);})[_0xaf84('0xb')](function(_0x4124cf){console[_0xaf84('0xc')](_0x4124cf);});}main(); \ No newline at end of file +var _0x849a=['initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts'];(function(_0x3e2783,_0x599e82){var _0x276835=function(_0x3bbcac){while(--_0x3bbcac){_0x3e2783['push'](_0x3e2783['shift']());}};_0x276835(++_0x599e82);}(_0x849a,0x1ba));var _0xa849=function(_0x429b26,_0x5adf80){_0x429b26=_0x429b26-0x0;var _0x269017=_0x849a[_0x429b26];return _0x269017;};'use strict';var BPromise=require(_0xa849('0x0'));var server=require(_0xa849('0x1'));var Realtime=require(_0xa849('0x2'));var EmailChannel=require(_0xa849('0x3'));var mailAccount=require(_0xa849('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xa849('0x5')]()[_0xa849('0x6')](mailAccount[_0xa849('0x7')]())[_0xa849('0x6')](realtime[_0xa849('0x8')]())[_0xa849('0x6')](function(){email[_0xa849('0x9')](realtime[_0xa849('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xa849('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0xa849('0xb')]();})[_0xa849('0x6')](function(_0x47cd64){return setInterval(initRealtime,_0x47cd64[_0xa849('0xc')]*0x3e8);})[_0xa849('0xd')](function(_0x71e74d){console[_0xa849('0xe')](_0x71e74d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1968d01..f7604f5 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 _0x1bb1=['bluebird','md5','../../../config/environment','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','imapAccounts','email','handleImapBox','bind','end','handleImapEnd','error','handleImapError','messages','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','lastSync','sendMail','send','verifySmtp','Smtp','smtp','verified','verify','exports','lodash','moment'];(function(_0x306b9a,_0x88b898){var _0x5a29bc=function(_0x5414be){while(--_0x5414be){_0x306b9a['push'](_0x306b9a['shift']());}};_0x5a29bc(++_0x88b898);}(_0x1bb1,0x1a6));var _0x11bb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bb1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x11bb('0x0'));var moment=require(_0x11bb('0x1'));var BPromise=require(_0x11bb('0x2'));var md5=require(_0x11bb('0x3'));var Redis=require('ioredis');var config=require(_0x11bb('0x4'));var logger=require('../../../config/logger')('email');config[_0x11bb('0x5')]=_['defaults'](config[_0x11bb('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x11bb('0x6'))(new Redis(config[_0x11bb('0x5')]));var EmailImap=require(_0x11bb('0x7'));var EmailSmtp=require(_0x11bb('0x8'));var mailAccount=require(_0x11bb('0x9'));var md5Accounts={};function EmailChannel(_0x4d95a9){logger[_0x11bb('0xa')](_0x11bb('0xb'));this[_0x11bb('0xc')]=_0x4d95a9[_0x11bb('0xc')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x11bb('0xd')]=function(_0x3dd5cc){var _0x2a4605=this[_0x11bb('0xc')][_0x3dd5cc];var _0x1f62b2={'id':_0x2a4605['id'],'name':_0x2a4605[_0x11bb('0xe')],'key':_0x2a4605[_0x11bb('0xf')],'active':_0x2a4605[_0x11bb('0x10')],'Imap':{'status':_0x2a4605['Imap'][_0x11bb('0x11')],'messageStatus':_0x2a4605[_0x11bb('0x12')][_0x11bb('0x13')],'total':_0x2a4605[_0x11bb('0x12')][_0x11bb('0x14')]}};if(_[_0x11bb('0x15')](md5Accounts[_0x3dd5cc])){md5Accounts[_0x3dd5cc]={};}var _0x325922=md5(JSON[_0x11bb('0x16')](_0x1f62b2));if(md5Accounts[_0x3dd5cc][_0x11bb('0x3')]!==_0x325922){md5Accounts[_0x3dd5cc][_0x11bb('0x3')]=_0x325922;io[_0x11bb('0xd')](_0x11bb('0x17'),_0x1f62b2);}};EmailChannel[_0x11bb('0x18')][_0x11bb('0x19')]=function(_0x1f15ed){for(var _0x3d15d3 in _0x1f15ed){if(_0x1f15ed[_0x11bb('0x1a')](_0x3d15d3)){if(_0x1f15ed[_0x3d15d3][_0x11bb('0x12')]&&_0x1f15ed[_0x3d15d3][_0x11bb('0x10')]){var _0x11e20b=_0x1f15ed[_0x3d15d3][_0x11bb('0x12')];if(!this[_0x11bb('0x1b')]['hasOwnProperty'](_0x11e20b['id'])){this[_0x11bb('0x1b')][_0x11e20b['id']]=new EmailImap(_0x11e20b,_0x1f15ed[_0x3d15d3][_0x11bb('0x1c')]);this[_0x11bb('0x1b')][_0x11e20b['id']]['on']('box',this[_0x11bb('0x1d')][_0x11bb('0x1e')](this,_0x3d15d3));this[_0x11bb('0x1b')][_0x11e20b['id']]['on'](_0x11bb('0x1c'),this['handleImapEmail'][_0x11bb('0x1e')](this,_0x3d15d3));this[_0x11bb('0x1b')][_0x11e20b['id']]['on'](_0x11bb('0x1f'),this[_0x11bb('0x20')][_0x11bb('0x1e')](this,_0x3d15d3));this[_0x11bb('0x1b')][_0x11e20b['id']]['on'](_0x11bb('0x21'),this[_0x11bb('0x22')][_0x11bb('0x1e')](this,_0x3d15d3));}}else{if(_[_0x11bb('0x15')](this['mailAccounts'][_0x3d15d3]['Imap'])){this[_0x11bb('0xc')][_0x3d15d3][_0x11bb('0x12')]={};}this[_0x11bb('0xc')][_0x3d15d3][_0x11bb('0x12')][_0x11bb('0x11')]='disabled';this[_0x11bb('0xc')][_0x3d15d3][_0x11bb('0x12')][_0x11bb('0x13')]='';this[_0x11bb('0xd')](_0x3d15d3);}}}};EmailChannel[_0x11bb('0x18')]['handleImapBox']=function(_0x2f03e3,_0x15e491){if(this[_0x11bb('0xc')][_0x2f03e3]){this[_0x11bb('0xc')][_0x2f03e3][_0x11bb('0x12')][_0x11bb('0x11')]='connected';this['mailAccounts'][_0x2f03e3][_0x11bb('0x12')][_0x11bb('0x13')]=_0x15e491[_0x11bb('0xe')];if(_0x15e491[_0x11bb('0x23')]){this[_0x11bb('0xc')][_0x2f03e3][_0x11bb('0x12')][_0x11bb('0x14')]=_0x15e491['messages']['total'];}return this['emit'](_0x2f03e3);}};EmailChannel[_0x11bb('0x18')]['handleImapEmail']=function(_0x350d93,_0x4e542f){logger['info'](_0x11bb('0x24'),_0x4e542f[_0x11bb('0x25')],_0x4e542f['lastName'],_0x4e542f[_0x11bb('0x26')],_0x350d93);if(this['mailAccounts'][_0x350d93]){return mailAccount[_0x11bb('0x27')](_0x350d93,_0x4e542f)[_0x11bb('0x28')](function(_0x266d60){if(_0x266d60){logger['info'](_0x11bb('0x29'));}})[_0x11bb('0x2a')](function(_0x5c69dc){logger['error'](_0x11bb('0x2b'),JSON['stringify'](_0x5c69dc));});}};EmailChannel[_0x11bb('0x18')][_0x11bb('0x20')]=function(_0x2035a5){if(this['mailAccounts'][_0x2035a5]&&this[_0x11bb('0xc')][_0x2035a5][_0x11bb('0x12')]){if(this[_0x11bb('0x1b')][this[_0x11bb('0xc')][_0x2035a5][_0x11bb('0x12')]['id']]){delete this[_0x11bb('0x1b')][this[_0x11bb('0xc')][_0x2035a5]['Imap']['id']];}this[_0x11bb('0xc')][_0x2035a5][_0x11bb('0x12')][_0x11bb('0x2c')]=moment();this[_0x11bb('0xd')](_0x2035a5);}};EmailChannel['prototype'][_0x11bb('0x22')]=function(_0x4ea974,_0x58b294){if(this[_0x11bb('0xc')][_0x4ea974]){this['mailAccounts'][_0x4ea974][_0x11bb('0x12')]['status']='error';this[_0x11bb('0xc')][_0x4ea974][_0x11bb('0x12')]['messageStatus']=_0x58b294;return this[_0x11bb('0xd')](_0x4ea974);}};EmailChannel[_0x11bb('0x18')][_0x11bb('0x2d')]=function(_0x5a0c8d,_0x6f6bc9){return this['smtp'][_0x11bb('0x2e')](_0x5a0c8d,_0x6f6bc9);};EmailChannel[_0x11bb('0x18')][_0x11bb('0x2f')]=function(_0x45ae56){var _0x48f0aa=this;if(this['mailAccounts'][_0x45ae56['id']]){if(_['isNil'](this[_0x11bb('0xc')][_0x45ae56['id']][_0x11bb('0x30')])){this[_0x11bb('0xc')][_0x45ae56['id']][_0x11bb('0x30')]={};}this[_0x11bb('0xc')][_0x45ae56['id']][_0x11bb('0x30')]['lastSync']=moment();return new BPromise(function(_0x7256b1,_0x260019){return _0x48f0aa[_0x11bb('0x31')]['verify'](_0x45ae56)['then'](function(_0x306da0){_0x48f0aa['mailAccounts'][_0x45ae56['id']][_0x11bb('0x30')][_0x11bb('0x11')]=_0x11bb('0x32');_0x48f0aa[_0x11bb('0xc')][_0x45ae56['id']][_0x11bb('0x30')][_0x11bb('0x13')]='';_0x48f0aa[_0x11bb('0xd')](_0x45ae56['id']);_0x7256b1(_0x306da0);})[_0x11bb('0x2a')](function(_0x448bb2){_0x48f0aa[_0x11bb('0xc')][_0x45ae56['id']][_0x11bb('0x30')][_0x11bb('0x11')]=_0x11bb('0x21');_0x48f0aa[_0x11bb('0xc')][_0x45ae56['id']]['Smtp'][_0x11bb('0x13')]=_0x448bb2;_0x48f0aa[_0x11bb('0xd')](_0x45ae56['id']);_0x260019(_0x448bb2);});});}return this['smtp'][_0x11bb('0x33')](_0x45ae56);};module[_0x11bb('0x34')]=EmailChannel; \ No newline at end of file +var _0x859f=['prototype','emit','name','key','active','Imap','status','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messageStatus','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','moment','bluebird','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','mailAccounts','imapAccounts','smtp'];(function(_0x49b082,_0x24007c){var _0x5806ce=function(_0x1c5acf){while(--_0x1c5acf){_0x49b082['push'](_0x49b082['shift']());}};_0x5806ce(++_0x24007c);}(_0x859f,0x141));var _0xf859=function(_0x1beb8b,_0x3124bd){_0x1beb8b=_0x1beb8b-0x0;var _0x28dd55=_0x859f[_0x1beb8b];return _0x28dd55;};'use strict';var _=require(_0xf859('0x0'));var moment=require(_0xf859('0x1'));var BPromise=require(_0xf859('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf859('0x3'))(_0xf859('0x4'));config[_0xf859('0x5')]=_[_0xf859('0x6')](config[_0xf859('0x5')],{'host':_0xf859('0x7'),'port':0x18eb});var io=require(_0xf859('0x8'))(new Redis(config[_0xf859('0x5')]));var EmailImap=require(_0xf859('0x9'));var EmailSmtp=require(_0xf859('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x290ca2){logger[_0xf859('0xb')]('start\x20email\x20channel');this['mailAccounts']=_0x290ca2[_0xf859('0xc')];this[_0xf859('0xd')]={};this[_0xf859('0xe')]=new EmailSmtp();}EmailChannel[_0xf859('0xf')][_0xf859('0x10')]=function(_0x30b37a){var _0x40e698=this['mailAccounts'][_0x30b37a];var _0x3c8e28={'id':_0x40e698['id'],'name':_0x40e698[_0xf859('0x11')],'key':_0x40e698[_0xf859('0x12')],'active':_0x40e698[_0xf859('0x13')],'Imap':{'status':_0x40e698[_0xf859('0x14')][_0xf859('0x15')],'messageStatus':_0x40e698[_0xf859('0x14')]['messageStatus'],'total':_0x40e698[_0xf859('0x14')]['total']}};if(_[_0xf859('0x16')](md5Accounts[_0x30b37a])){md5Accounts[_0x30b37a]={};}var _0x40c0de=md5(JSON[_0xf859('0x17')](_0x3c8e28));if(md5Accounts[_0x30b37a][_0xf859('0x18')]!==_0x40c0de){md5Accounts[_0x30b37a][_0xf859('0x18')]=_0x40c0de;io['emit'](_0xf859('0x19'),_0x3c8e28);}};EmailChannel[_0xf859('0xf')][_0xf859('0x1a')]=function(_0x1eb41f){for(var _0x55d1d5 in _0x1eb41f){if(_0x1eb41f[_0xf859('0x1b')](_0x55d1d5)){if(_0x1eb41f[_0x55d1d5]['Imap']&&_0x1eb41f[_0x55d1d5][_0xf859('0x13')]){var _0x5dec29=_0x1eb41f[_0x55d1d5][_0xf859('0x14')];if(!this[_0xf859('0xd')][_0xf859('0x1b')](_0x5dec29['id'])){this[_0xf859('0xd')][_0x5dec29['id']]=new EmailImap(_0x5dec29,_0x1eb41f[_0x55d1d5][_0xf859('0x4')]);this['imapAccounts'][_0x5dec29['id']]['on'](_0xf859('0x1c'),this[_0xf859('0x1d')][_0xf859('0x1e')](this,_0x55d1d5));this['imapAccounts'][_0x5dec29['id']]['on'](_0xf859('0x4'),this[_0xf859('0x1f')]['bind'](this,_0x55d1d5));this[_0xf859('0xd')][_0x5dec29['id']]['on'](_0xf859('0x20'),this[_0xf859('0x21')][_0xf859('0x1e')](this,_0x55d1d5));this[_0xf859('0xd')][_0x5dec29['id']]['on']('error',this[_0xf859('0x22')]['bind'](this,_0x55d1d5));}}else{if(_[_0xf859('0x16')](this[_0xf859('0xc')][_0x55d1d5]['Imap'])){this[_0xf859('0xc')][_0x55d1d5][_0xf859('0x14')]={};}this[_0xf859('0xc')][_0x55d1d5][_0xf859('0x14')][_0xf859('0x15')]=_0xf859('0x23');this['mailAccounts'][_0x55d1d5][_0xf859('0x14')]['messageStatus']='';this[_0xf859('0x10')](_0x55d1d5);}}}};EmailChannel[_0xf859('0xf')][_0xf859('0x1d')]=function(_0x570c8a,_0x5bebf0){if(this[_0xf859('0xc')][_0x570c8a]){this[_0xf859('0xc')][_0x570c8a]['Imap'][_0xf859('0x15')]=_0xf859('0x24');this[_0xf859('0xc')][_0x570c8a][_0xf859('0x14')][_0xf859('0x25')]=_0x5bebf0[_0xf859('0x11')];if(_0x5bebf0[_0xf859('0x26')]){this[_0xf859('0xc')][_0x570c8a][_0xf859('0x14')][_0xf859('0x27')]=_0x5bebf0[_0xf859('0x26')][_0xf859('0x27')];}return this[_0xf859('0x10')](_0x570c8a);}};EmailChannel[_0xf859('0xf')][_0xf859('0x1f')]=function(_0x3dacf9,_0x941e7f){logger[_0xf859('0xb')](_0xf859('0x28'),_0x941e7f[_0xf859('0x29')],_0x941e7f[_0xf859('0x2a')],_0x941e7f[_0xf859('0x2b')],_0x3dacf9);if(this['mailAccounts'][_0x3dacf9]){return mailAccount['notify'](_0x3dacf9,_0x941e7f)[_0xf859('0x2c')](function(_0x162c94){if(_0x162c94){logger[_0xf859('0xb')](_0xf859('0x2d'));}})[_0xf859('0x2e')](function(_0x482777){logger[_0xf859('0x2f')](_0xf859('0x30'),JSON['stringify'](_0x482777));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x40274d){if(this[_0xf859('0xc')][_0x40274d]&&this[_0xf859('0xc')][_0x40274d]['Imap']){if(this[_0xf859('0xd')][this[_0xf859('0xc')][_0x40274d]['Imap']['id']]){delete this[_0xf859('0xd')][this[_0xf859('0xc')][_0x40274d][_0xf859('0x14')]['id']];}this['mailAccounts'][_0x40274d][_0xf859('0x14')]['lastSync']=moment();this['emit'](_0x40274d);}};EmailChannel[_0xf859('0xf')][_0xf859('0x22')]=function(_0x4a18a6,_0x26d78e){if(this[_0xf859('0xc')][_0x4a18a6]){this['mailAccounts'][_0x4a18a6][_0xf859('0x14')][_0xf859('0x15')]=_0xf859('0x2f');this[_0xf859('0xc')][_0x4a18a6][_0xf859('0x14')][_0xf859('0x25')]=_0x26d78e;return this[_0xf859('0x10')](_0x4a18a6);}};EmailChannel[_0xf859('0xf')]['sendMail']=function(_0x122b05,_0x12e037){return this['smtp'][_0xf859('0x31')](_0x122b05,_0x12e037);};EmailChannel[_0xf859('0xf')][_0xf859('0x32')]=function(_0x4dbac5){var _0x54393d=this;if(this[_0xf859('0xc')][_0x4dbac5['id']]){if(_[_0xf859('0x16')](this[_0xf859('0xc')][_0x4dbac5['id']]['Smtp'])){this[_0xf859('0xc')][_0x4dbac5['id']][_0xf859('0x33')]={};}this[_0xf859('0xc')][_0x4dbac5['id']][_0xf859('0x33')][_0xf859('0x34')]=moment();return new BPromise(function(_0x48caf4,_0x3f5a6c){return _0x54393d['smtp'][_0xf859('0x35')](_0x4dbac5)[_0xf859('0x2c')](function(_0x5d1b5d){_0x54393d[_0xf859('0xc')][_0x4dbac5['id']][_0xf859('0x33')]['status']=_0xf859('0x36');_0x54393d['mailAccounts'][_0x4dbac5['id']][_0xf859('0x33')]['messageStatus']='';_0x54393d[_0xf859('0x10')](_0x4dbac5['id']);_0x48caf4(_0x5d1b5d);})['catch'](function(_0x242eec){_0x54393d['mailAccounts'][_0x4dbac5['id']][_0xf859('0x33')][_0xf859('0x15')]='error';_0x54393d[_0xf859('0xc')][_0x4dbac5['id']][_0xf859('0x33')][_0xf859('0x25')]=_0x242eec;_0x54393d[_0xf859('0x10')](_0x4dbac5['id']);_0x3f5a6c(_0x242eec);});});}return this[_0xf859('0xe')]['verify'](_0x4dbac5);};module[_0xf859('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 26a8533..16aaea0 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 _0x3d55=['handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','account','textCode','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','once','end','handleEnd','bind','error','connect','inherits','prototype','connTimeout','authTimeout','user','host','port','tls','autotls','password','getHost','service','anonymous@xcally.com','handleReady','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchEnd','closeBox','body'];(function(_0x54f12d,_0x2d3a4d){var _0x21cf8e=function(_0x42b6cb){while(--_0x42b6cb){_0x54f12d['push'](_0x54f12d['shift']());}};_0x21cf8e(++_0x2d3a4d);}(_0x3d55,0x141));var _0x53d5=function(_0x1ee293,_0x465cda){_0x1ee293=_0x1ee293-0x0;var _0x161342=_0x3d55[_0x1ee293];return _0x161342;};'use strict';var fs=require('fs');var path=require(_0x53d5('0x0'));var util=require(_0x53d5('0x1'));var Imap=require(_0x53d5('0x2'));var _=require(_0x53d5('0x3'));var rs=require(_0x53d5('0x4'));var simpleParser=require(_0x53d5('0x5'))['simpleParser'];var Iconv=require(_0x53d5('0x6'))[_0x53d5('0x7')];var EventEmitter=require(_0x53d5('0x8'))['EventEmitter'];var utils=require(_0x53d5('0x9'));var logger=require(_0x53d5('0xa'))(_0x53d5('0xb'));function EmailImap(_0x4a7757,_0x508d0a){this[_0x53d5('0xc')]=_0x53d5('0xd');this['account']=this[_0x53d5('0xe')](_0x4a7757,_0x508d0a);this[_0x53d5('0x2')]=new Imap(this['account']);this['imap'][_0x53d5('0xf')]('ready',this['handleReady']['bind'](this));this[_0x53d5('0x2')][_0x53d5('0xf')](_0x53d5('0x10'),this[_0x53d5('0x11')][_0x53d5('0x12')](this));this['imap']['on'](_0x53d5('0x13'),this['handleError'][_0x53d5('0x12')](this));this[_0x53d5('0x2')][_0x53d5('0x14')]();}util[_0x53d5('0x15')](EmailImap,EventEmitter);EmailImap[_0x53d5('0x16')][_0x53d5('0xe')]=function(_0x30f4fe,_0x40a701){var _0x4edce9={'connTimeout':_0x30f4fe[_0x53d5('0x17')]?_0x30f4fe[_0x53d5('0x17')]*0x3e8:0x2710,'authTimeout':_0x30f4fe['authTimeout']?_0x30f4fe[_0x53d5('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x30f4fe['service'])){if(_0x30f4fe['authentication']){_0x4edce9[_0x53d5('0x19')]=_0x30f4fe[_0x53d5('0x19')];_0x4edce9['password']=_0x30f4fe['password'];}_0x4edce9[_0x53d5('0x1a')]=_0x30f4fe[_0x53d5('0x1a')];_0x4edce9[_0x53d5('0x1b')]=_0x30f4fe[_0x53d5('0x1b')]||0x3e1;if(_0x30f4fe[_0x53d5('0x1c')]){_0x4edce9[_0x53d5('0x1c')]=!![];}else{_0x4edce9[_0x53d5('0x1c')]=![];_0x4edce9[_0x53d5('0x1d')]='required';}}else{_0x4edce9[_0x53d5('0x19')]=_0x30f4fe[_0x53d5('0x19')];_0x4edce9['password']=_0x30f4fe[_0x53d5('0x1e')];_0x4edce9['host']=utils[_0x53d5('0x1f')](_0x30f4fe[_0x53d5('0x20')]);_0x4edce9['port']=0x3e1;_0x4edce9[_0x53d5('0x1c')]=!![];}_0x4edce9[_0x53d5('0xb')]=_0x40a701||_0x30f4fe[_0x53d5('0x19')]||_0x53d5('0x21');return _0x4edce9;};EmailImap[_0x53d5('0x16')][_0x53d5('0x22')]=function(){this[_0x53d5('0x2')][_0x53d5('0x23')](this[_0x53d5('0xc')],![],this[_0x53d5('0x24')][_0x53d5('0x12')](this));};EmailImap['prototype'][_0x53d5('0x24')]=function(_0x5dfb26,_0x22b0ca){if(_0x5dfb26){this[_0x53d5('0x25')](_0x5dfb26,!![]);}else{this[_0x53d5('0x26')](_0x53d5('0x27'),_0x22b0ca);this[_0x53d5('0x28')]();}};EmailImap[_0x53d5('0x16')][_0x53d5('0x29')]=function(_0x4529e3){if(_0x4529e3){this[_0x53d5('0x25')](_0x4529e3,!![]);}else{this[_0x53d5('0x2')][_0x53d5('0x10')]();}};EmailImap[_0x53d5('0x16')]['readUnseen']=function(){this[_0x53d5('0x2')][_0x53d5('0x2a')]([_0x53d5('0x2b')],this[_0x53d5('0x2c')][_0x53d5('0x12')](this));};EmailImap[_0x53d5('0x16')][_0x53d5('0x2c')]=function(_0x3b5f3e,_0x2b1324){if(_0x3b5f3e){this[_0x53d5('0x25')](_0x3b5f3e,!![]);}else{if(_0x2b1324[_0x53d5('0x2d')]){try{var _0x348f18=this[_0x53d5('0x2')][_0x53d5('0x2e')](_0x2b1324,{'bodies':'','markSeen':!![]});_0x348f18['on'](_0x53d5('0x2f'),this['handleFetchMessage']['bind'](this));_0x348f18[_0x53d5('0xf')](_0x53d5('0x13'),this['handleFetchError'][_0x53d5('0x12')](this));_0x348f18[_0x53d5('0xf')](_0x53d5('0x10'),this[_0x53d5('0x30')]['bind'](this));}catch(_0x2c29b1){logger[_0x53d5('0x13')](_0x2c29b1);}}else{this[_0x53d5('0x2')][_0x53d5('0x31')](!![],this['handleCloseBox'][_0x53d5('0x12')](this));}}};EmailImap[_0x53d5('0x16')]['handleFetchMessage']=function(_0x2b6ae5,_0x12da1f){_0x2b6ae5['on'](_0x53d5('0x32'),this[_0x53d5('0x33')][_0x53d5('0x12')](this));_0x2b6ae5[_0x53d5('0xf')](_0x53d5('0x34'),this[_0x53d5('0x35')][_0x53d5('0x12')](this));_0x2b6ae5[_0x53d5('0xf')]('end',this[_0x53d5('0x36')][_0x53d5('0x12')](this));};EmailImap[_0x53d5('0x16')][_0x53d5('0x33')]=function(_0x400cea,_0x299995){simpleParser(_0x400cea,{'Iconv':Iconv},this['handleSimpleParser'][_0x53d5('0x12')](this));};EmailImap[_0x53d5('0x16')][_0x53d5('0x35')]=function(_0x5692b1){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x53d5('0x16')][_0x53d5('0x37')]=function(_0x1252f0,_0x79b84f){if(_0x1252f0){logger[_0x53d5('0x13')](_0x1252f0);}else{var _0x4d2358=this;utils[_0x53d5('0x38')](this['account'],_0x79b84f,function(_0x56a18f){_0x4d2358[_0x53d5('0x26')]('email',_0x56a18f);});}};EmailImap[_0x53d5('0x16')][_0x53d5('0x30')]=function(){this[_0x53d5('0x2')][_0x53d5('0x31')](!![],this['handleCloseBox'][_0x53d5('0x12')](this));};EmailImap['prototype'][_0x53d5('0x39')]=function(_0xef6291){this[_0x53d5('0x25')](_0xef6291);this[_0x53d5('0x2')][_0x53d5('0x31')](!![],this[_0x53d5('0x29')][_0x53d5('0x12')](this));};EmailImap[_0x53d5('0x16')]['handleEnd']=function(){this[_0x53d5('0x26')]('end');};EmailImap[_0x53d5('0x16')][_0x53d5('0x25')]=function(_0x289775,_0x3a406c){logger[_0x53d5('0x13')](_0x53d5('0x25'),this[_0x53d5('0x3a')]['email'],JSON['stringify'](_0x289775));var _0x558308='';if(_0x289775){if(_0x289775[_0x53d5('0x3b')]){_0x558308=_0x289775[_0x53d5('0x3b')];}else{for(var _0x4c784b in _0x289775){if(_0x289775['hasOwnProperty'](_0x4c784b)){_0x558308+=_[_0x53d5('0x3c')](_0x4c784b)+':\x20'+_0x289775[_0x4c784b]+'\x0a';}}}}if(_0x3a406c){this['imap']['end']();}else{this[_0x53d5('0x26')](_0x53d5('0x13'),_0x558308);this[_0x53d5('0x26')]('end');}};module[_0x53d5('0x3d')]=EmailImap; \ No newline at end of file +var _0x4b96=['length','message','handleFetchError','end','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','textCode','hasOwnProperty','exports','path','util','imap','randomstring','mailparser','iconv','Iconv','events','email','mailbox','INBOX','account','getAccount','once','handleReady','bind','handleEnd','error','handleError','connect','inherits','connTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','prototype','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen'];(function(_0x1334e8,_0x307547){var _0x5a3e22=function(_0xfb0392){while(--_0xfb0392){_0x1334e8['push'](_0x1334e8['shift']());}};_0x5a3e22(++_0x307547);}(_0x4b96,0x12e));var _0x64b9=function(_0x12d40f,_0xf564f7){_0x12d40f=_0x12d40f-0x0;var _0x3cf0f7=_0x4b96[_0x12d40f];return _0x3cf0f7;};'use strict';var fs=require('fs');var path=require(_0x64b9('0x0'));var util=require(_0x64b9('0x1'));var Imap=require(_0x64b9('0x2'));var _=require('lodash');var rs=require(_0x64b9('0x3'));var simpleParser=require(_0x64b9('0x4'))['simpleParser'];var Iconv=require(_0x64b9('0x5'))[_0x64b9('0x6')];var EventEmitter=require(_0x64b9('0x7'))['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')(_0x64b9('0x8'));function EmailImap(_0x51433b,_0x46adab){this[_0x64b9('0x9')]=_0x64b9('0xa');this[_0x64b9('0xb')]=this[_0x64b9('0xc')](_0x51433b,_0x46adab);this['imap']=new Imap(this[_0x64b9('0xb')]);this[_0x64b9('0x2')][_0x64b9('0xd')]('ready',this[_0x64b9('0xe')][_0x64b9('0xf')](this));this[_0x64b9('0x2')][_0x64b9('0xd')]('end',this[_0x64b9('0x10')][_0x64b9('0xf')](this));this['imap']['on'](_0x64b9('0x11'),this[_0x64b9('0x12')][_0x64b9('0xf')](this));this[_0x64b9('0x2')][_0x64b9('0x13')]();}util[_0x64b9('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x64b9('0xc')]=function(_0x52ccb8,_0x310e85){var _0x1c4b63={'connTimeout':_0x52ccb8[_0x64b9('0x15')]?_0x52ccb8[_0x64b9('0x15')]*0x3e8:0x2710,'authTimeout':_0x52ccb8['authTimeout']?_0x52ccb8['authTimeout']*0x3e8:0x1388};if(_[_0x64b9('0x16')](_0x52ccb8['service'])){if(_0x52ccb8[_0x64b9('0x17')]){_0x1c4b63[_0x64b9('0x18')]=_0x52ccb8[_0x64b9('0x18')];_0x1c4b63[_0x64b9('0x19')]=_0x52ccb8['password'];}_0x1c4b63[_0x64b9('0x1a')]=_0x52ccb8[_0x64b9('0x1a')];_0x1c4b63[_0x64b9('0x1b')]=_0x52ccb8[_0x64b9('0x1b')]||0x3e1;if(_0x52ccb8[_0x64b9('0x1c')]){_0x1c4b63[_0x64b9('0x1c')]=!![];}else{_0x1c4b63['tls']=![];_0x1c4b63[_0x64b9('0x1d')]=_0x64b9('0x1e');}}else{_0x1c4b63[_0x64b9('0x18')]=_0x52ccb8[_0x64b9('0x18')];_0x1c4b63[_0x64b9('0x19')]=_0x52ccb8[_0x64b9('0x19')];_0x1c4b63['host']=utils[_0x64b9('0x1f')](_0x52ccb8[_0x64b9('0x20')]);_0x1c4b63[_0x64b9('0x1b')]=0x3e1;_0x1c4b63[_0x64b9('0x1c')]=!![];}_0x1c4b63[_0x64b9('0x8')]=_0x310e85||_0x52ccb8[_0x64b9('0x18')]||'anonymous@xcally.com';return _0x1c4b63;};EmailImap[_0x64b9('0x21')][_0x64b9('0xe')]=function(){this[_0x64b9('0x2')]['openBox'](this[_0x64b9('0x9')],![],this['handleOpenBox'][_0x64b9('0xf')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x1ac26e,_0x3f0e31){if(_0x1ac26e){this['handleError'](_0x1ac26e,!![]);}else{this[_0x64b9('0x22')]('box',_0x3f0e31);this[_0x64b9('0x23')]();}};EmailImap[_0x64b9('0x21')][_0x64b9('0x24')]=function(_0x48f1ac){if(_0x48f1ac){this[_0x64b9('0x12')](_0x48f1ac,!![]);}else{this[_0x64b9('0x2')]['end']();}};EmailImap['prototype'][_0x64b9('0x23')]=function(){this[_0x64b9('0x2')][_0x64b9('0x25')]([_0x64b9('0x26')],this[_0x64b9('0x27')][_0x64b9('0xf')](this));};EmailImap['prototype'][_0x64b9('0x27')]=function(_0xbb4b2,_0x25376b){if(_0xbb4b2){this['handleError'](_0xbb4b2,!![]);}else{if(_0x25376b[_0x64b9('0x28')]){try{var _0x9a3da=this['imap']['fetch'](_0x25376b,{'bodies':'','markSeen':!![]});_0x9a3da['on'](_0x64b9('0x29'),this['handleFetchMessage'][_0x64b9('0xf')](this));_0x9a3da[_0x64b9('0xd')](_0x64b9('0x11'),this[_0x64b9('0x2a')][_0x64b9('0xf')](this));_0x9a3da['once'](_0x64b9('0x2b'),this[_0x64b9('0x2c')][_0x64b9('0xf')](this));}catch(_0x64d8e7){logger[_0x64b9('0x11')](_0x64d8e7);}}else{this['imap'][_0x64b9('0x2d')](!![],this[_0x64b9('0x24')][_0x64b9('0xf')](this));}}};EmailImap['prototype'][_0x64b9('0x2e')]=function(_0x218a9e,_0x2c291a){_0x218a9e['on'](_0x64b9('0x2f'),this[_0x64b9('0x30')]['bind'](this));_0x218a9e[_0x64b9('0xd')](_0x64b9('0x31'),this['handleMessageAttributes'][_0x64b9('0xf')](this));_0x218a9e[_0x64b9('0xd')](_0x64b9('0x2b'),this[_0x64b9('0x32')][_0x64b9('0xf')](this));};EmailImap[_0x64b9('0x21')][_0x64b9('0x30')]=function(_0x26e4ed,_0x4a49d7){simpleParser(_0x26e4ed,{'Iconv':Iconv},this[_0x64b9('0x33')][_0x64b9('0xf')](this));};EmailImap[_0x64b9('0x21')][_0x64b9('0x34')]=function(_0x1977b5){};EmailImap[_0x64b9('0x21')][_0x64b9('0x32')]=function(){};EmailImap[_0x64b9('0x21')]['handleSimpleParser']=function(_0x22bde7,_0xb0d655){if(_0x22bde7){logger['error'](_0x22bde7);}else{var _0x7fdc83=this;utils[_0x64b9('0x35')](this[_0x64b9('0xb')],_0xb0d655,function(_0x5536ee){_0x7fdc83['emit'](_0x64b9('0x8'),_0x5536ee);});}};EmailImap[_0x64b9('0x21')][_0x64b9('0x2c')]=function(){this['imap'][_0x64b9('0x2d')](!![],this[_0x64b9('0x24')]['bind'](this));};EmailImap['prototype'][_0x64b9('0x2a')]=function(_0x475173){this['handleError'](_0x475173);this['imap'][_0x64b9('0x2d')](!![],this[_0x64b9('0x24')][_0x64b9('0xf')](this));};EmailImap[_0x64b9('0x21')][_0x64b9('0x10')]=function(){this[_0x64b9('0x22')](_0x64b9('0x2b'));};EmailImap[_0x64b9('0x21')][_0x64b9('0x12')]=function(_0x490dc4,_0x4bf52b){logger[_0x64b9('0x11')]('handleError',this['account'][_0x64b9('0x8')],JSON['stringify'](_0x490dc4));var _0x4ddfa2='';if(_0x490dc4){if(_0x490dc4[_0x64b9('0x36')]){_0x4ddfa2=_0x490dc4[_0x64b9('0x36')];}else{for(var _0x2e728b in _0x490dc4){if(_0x490dc4[_0x64b9('0x37')](_0x2e728b)){_0x4ddfa2+=_['upperFirst'](_0x2e728b)+':\x20'+_0x490dc4[_0x2e728b]+'\x0a';}}}}if(_0x4bf52b){this[_0x64b9('0x2')][_0x64b9('0x2b')]();}else{this[_0x64b9('0x22')](_0x64b9('0x11'),_0x4ddfa2);this[_0x64b9('0x22')](_0x64b9('0x2b'));}};module[_0x64b9('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 151b140..9b46602 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038a=['exports','nodemailer','nodemailer-plugin-inline-base64','send','use','compile','sendMail','toString','prototype','verify','createTransport','Not\x20verifired'];(function(_0x3d9a94,_0x518fc2){var _0x21ca25=function(_0x12cd3d){while(--_0x12cd3d){_0x3d9a94['push'](_0x3d9a94['shift']());}};_0x21ca25(++_0x518fc2);}(_0x038a,0x1b1));var _0xa038=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x038a[_0x1ad926];return _0x1b81dc;};'use strict';var nodemailer=require(_0xa038('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xa038('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xa038('0x2')]=function(_0x1e2775,_0x56114e){return new BPromise(function(_0x23c235,_0x5ce186){var _0x1bfd78=nodemailer['createTransport'](_0x1e2775);_0x1bfd78[_0xa038('0x3')](_0xa038('0x4'),inlineBase64());_0x1bfd78[_0xa038('0x5')](_0x56114e,function(_0x4870e6,_0x1e7dc5){if(_0x4870e6){_0x5ce186(_0x4870e6[_0xa038('0x6')]());}else{_0x23c235(_0x1e7dc5);}});});};EmailSmtp[_0xa038('0x7')][_0xa038('0x8')]=function(_0x3e8917){return new BPromise(function(_0x1ceead,_0x126b32){var _0x503575=nodemailer[_0xa038('0x9')](_0x3e8917);_0x503575[_0xa038('0x8')](function(_0x1a9a29,_0x4791b4){if(_0x1a9a29){_0x126b32(_0x1a9a29['toString']());}else{if(_0x4791b4){_0x1ceead(_0x4791b4);}else{_0x126b32(_0xa038('0xa'));}}});});};module[_0xa038('0xb')]=EmailSmtp; \ No newline at end of file +var _0xc29d=['toString','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','sendMail'];(function(_0x1c14ae,_0x25ecce){var _0x24c7cf=function(_0x167c24){while(--_0x167c24){_0x1c14ae['push'](_0x1c14ae['shift']());}};_0x24c7cf(++_0x25ecce);}(_0xc29d,0x1bb));var _0xdc29=function(_0x31e581,_0x1d38b8){_0x31e581=_0x31e581-0x0;var _0x592ed5=_0xc29d[_0x31e581];return _0x592ed5;};'use strict';var nodemailer=require(_0xdc29('0x0'));var BPromise=require(_0xdc29('0x1'));var inlineBase64=require(_0xdc29('0x2'));function EmailSmtp(){}EmailSmtp[_0xdc29('0x3')][_0xdc29('0x4')]=function(_0xed31ce,_0x387497){return new BPromise(function(_0x4402e9,_0x45eb6d){var _0x555162=nodemailer[_0xdc29('0x5')](_0xed31ce);_0x555162['use']('compile',inlineBase64());_0x555162[_0xdc29('0x6')](_0x387497,function(_0x16324f,_0xd9940b){if(_0x16324f){_0x45eb6d(_0x16324f[_0xdc29('0x7')]());}else{_0x4402e9(_0xd9940b);}});});};EmailSmtp[_0xdc29('0x3')]['verify']=function(_0xbff786){return new BPromise(function(_0x3c6fec,_0x319a06){var _0x207af1=nodemailer[_0xdc29('0x5')](_0xbff786);_0x207af1[_0xdc29('0x8')](function(_0x16ee2f,_0x3247ac){if(_0x16ee2f){_0x319a06(_0x16ee2f[_0xdc29('0x7')]());}else{if(_0x3247ac){_0x3c6fec(_0x3247ac);}else{_0x319a06('Not\x20verifired');}}});});};module[_0xdc29('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1ad8b47..615aa99 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7b3=['includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','push','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','generate','html','test','replace'];(function(_0xc9926,_0x348a8c){var _0x57b380=function(_0x1afe75){while(--_0x1afe75){_0xc9926['push'](_0xc9926['shift']());}};_0x57b380(++_0x348a8c);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc7b3[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x3c7b('0x0'));var moment=require(_0x3c7b('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x3c7b('0x2'));var util=require(_0x3c7b('0x3'));var tnef=require(_0x3c7b('0x4'));var logger=require(_0x3c7b('0x5'))(_0x3c7b('0x6'));var config=require(_0x3c7b('0x7'));function getAddress(_0x48ad4b){var _0x12d9a9=_[_0x3c7b('0x8')](_0x48ad4b[_0x3c7b('0x9')]);return _0x12d9a9&&_0x12d9a9['address']?_0x12d9a9[_0x3c7b('0xa')]:_0x3c7b('0xb')+random['generate'](0x6)+_0x3c7b('0xc');}function getFirstName(_0x3990fe){var _0x5cf03b=_[_0x3c7b('0x8')](_0x3990fe[_0x3c7b('0x9')]);if(_0x5cf03b&&_0x5cf03b[_0x3c7b('0xd')]){if(_0x5cf03b['name']==_0x5cf03b[_0x3c7b('0xa')]){return _0x5cf03b['name'][_0x3c7b('0xe')](0x0,_0x5cf03b[_0x3c7b('0xd')]['indexOf']('@'));}var _0x6452a1=_0x5cf03b[_0x3c7b('0xd')][_0x3c7b('0xf')](/\s+/);return _0x6452a1[_0x3c7b('0x10')]>0x1?_0x6452a1[_0x3c7b('0x11')](0x0,-0x1)[_0x3c7b('0x12')]('\x20'):_0x5cf03b['name'];}return _0x3c7b('0x13');}function getLastName(_0x53e7e4){var _0x1c77a5=_[_0x3c7b('0x8')](_0x53e7e4[_0x3c7b('0x9')]);if(_0x1c77a5&&_0x1c77a5[_0x3c7b('0xd')]){var _0x1b5490=_0x1c77a5[_0x3c7b('0xd')][_0x3c7b('0xf')](/\s+/);return _0x1b5490[_0x3c7b('0x10')]>0x1?_0x1b5490[_0x3c7b('0x14')]():'';}return'';}function getMails(_0x38a02c,_0x1df4a7){var _0x220f9d='';for(var _0x4ce512=0x0;_0x4ce512<_0x1df4a7[_0x3c7b('0x9')][_0x3c7b('0x10')];_0x4ce512+=0x1){if(_0x1df4a7[_0x3c7b('0x9')][_0x4ce512][_0x3c7b('0xa')]!==_0x38a02c){if(!_[_0x3c7b('0x15')](_0x220f9d)){_0x220f9d+=',';}_0x220f9d+=_0x1df4a7[_0x3c7b('0x9')][_0x4ce512][_0x3c7b('0xd')]||_0x1df4a7[_0x3c7b('0x9')][_0x4ce512][_0x3c7b('0xa')]||'';_0x220f9d+='\x20<';_0x220f9d+=_0x1df4a7[_0x3c7b('0x9')][_0x4ce512][_0x3c7b('0xa')]?_0x1df4a7[_0x3c7b('0x9')][_0x4ce512][_0x3c7b('0xa')]:_0x3c7b('0xb')+random[_0x3c7b('0x16')](0x6)+_0x3c7b('0xc');_0x220f9d+='>';}}return _0x220f9d;}function parseEmail(_0x2b4598,_0xd05d3,_0x5572ab){if(_0xd05d3[_0x3c7b('0x17')]){var _0x2d93eb=/)<[^<]*)*<\/script>/gi;while(_0x2d93eb[_0x3c7b('0x18')](_0xd05d3[_0x3c7b('0x17')])){_0xd05d3[_0x3c7b('0x17')]=_0xd05d3[_0x3c7b('0x17')][_0x3c7b('0x19')](_0x2d93eb,'');}if(_0xd05d3[_0x3c7b('0x17')][_0x3c7b('0x1a')](_0x3c7b('0x1b'))){var _0x1de2ae=[];_0xd05d3[_0x3c7b('0x1c')][_0x3c7b('0x1d')](_0x31f6fc=>{_0x1de2ae['push'](_0x31f6fc['filename']);});var _0x416f8d=/]+>/g;var _0x3740da=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4d4193=_0xd05d3[_0x3c7b('0x17')][_0x3c7b('0x19')](_0x3740da,_0x3c7b('0x1e'));var _0xed56ee=_0x4d4193[_0x3c7b('0x19')](_0x416f8d,_0x3c7b('0x1f'));for(let _0x3127a2=0x0;_0x3127a2<_0x1de2ae[_0x3c7b('0x10')];_0x3127a2++){var _0x3c0dcf=_0xed56ee['replace']('_IMG',_0x3c7b('0x20')+_0x1de2ae[_0x3127a2]+_0x3c7b('0x21'));_0xed56ee=_0x3c0dcf;}_0xd05d3[_0x3c7b('0x17')]=_0xed56ee;}_0x5572ab[_0x3c7b('0x22')]=_0xd05d3[_0x3c7b('0x17')];}else{_0x5572ab[_0x3c7b('0x22')]=_0xd05d3[_0x3c7b('0x23')];}if(_0x5572ab[_0x3c7b('0x22')]){_0x5572ab['body']=_0x5572ab[_0x3c7b('0x22')][_0x3c7b('0x19')](/0x0){var _0x46b2cb=[_0x3c7b('0x35'),_0x3c7b('0x36'),'Precedence:\x20auto_reply'];for(var _0x432246=0x0;_0x432246<_0xd05d3[_0x3c7b('0x34')][_0x3c7b('0x10')];_0x432246++){var _0x4697bf=_[_0x3c7b('0x37')](_0x46b2cb,_0xd05d3[_0x3c7b('0x34')][_0x432246]['line']);if(_0x4697bf>=0x0){_0x5572ab[_0x3c7b('0x38')]=!![];}}}return _0x5572ab;}exports[_0x3c7b('0x39')]=function(_0xd58cbf,_0x44828e,_0x573d32){var _0x4a9e7b={'from':getAddress(_0x44828e[_0x3c7b('0x3a')]),'firstName':getFirstName(_0x44828e[_0x3c7b('0x3a')]),'lastName':getLastName(_0x44828e[_0x3c7b('0x3a')]),'mapKey':_0x3c7b('0x6'),'message':{'from':getMails(_0xd58cbf[_0x3c7b('0x6')],_0x44828e['from']),'to':_0xd58cbf[_0x3c7b('0x6')],'cc':'','subject':_0x44828e[_0x3c7b('0x3b')]||'','messageId':_0x44828e['messageId'],'inReplyTo':_0x44828e['inReplyTo'],'sentAt':moment(_0x44828e[_0x3c7b('0x3c')])[_0x3c7b('0x2c')](_0x3c7b('0x3d')),'attach':![],'attachments':[]}};if(!_0x44828e[_0x3c7b('0x17')]&&!_0x44828e[_0x3c7b('0x23')]){var _0x592600=_[_0x3c7b('0x3e')](_0x44828e['attachments'],{'contentType':_0x3c7b('0x3f')});if(_0x592600[_0x3c7b('0x10')]){logger[_0x3c7b('0x40')](util['format'](_0x3c7b('0x41'),_0x44828e['messageId']));tnef['parseBuffer'](_[_0x3c7b('0x42')](_0x592600)[_0x3c7b('0x32')],function(_0x174800,_0x3896e2){if(_0x3896e2){_0x44828e['html']=_0x3896e2[_0x3c7b('0x43')]||_0x3c7b('0x44');if(_0x3896e2['Attachments']){for(var _0x4d28eb=0x0;_0x4d28eb<_0x3896e2[_0x3c7b('0x45')]['length'];_0x4d28eb++){var _0x5a156a=_0x3896e2[_0x3c7b('0x45')][_0x4d28eb];_0x4a9e7b[_0x3c7b('0x26')]['attachments'][_0x3c7b('0x46')]({'filename':_0x5a156a['Title'],'content':Buffer[_0x3c7b('0x3a')](_0x5a156a[_0x3c7b('0x47')])});}}}_0x573d32(parseEmail(_0xd58cbf,_0x44828e,_0x4a9e7b));});}else{_0x44828e[_0x3c7b('0x17')]=_0x3c7b('0x44');_0x573d32(parseEmail(_0xd58cbf,_0x44828e,_0x4a9e7b));}}else{_0x573d32(parseEmail(_0xd58cbf,_0x44828e,_0x4a9e7b));}};exports[_0x3c7b('0x48')]=function(_0x5270e5){switch(_0x5270e5){case _0x3c7b('0x49'):return _0x3c7b('0x4a');case _0x3c7b('0x4b'):return _0x3c7b('0x4c');case'hotmail':return _0x3c7b('0x4d');case _0x3c7b('0x4e'):return'outlook.office365.com';}return _0x3c7b('0x4f');}; \ No newline at end of file +var _0xd26f=['email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','Anonymous','split','length','pop','isEmpty','html','replace','\x20[Attachment:\x20','body','Empty\x20message

','Attachments','Title','getHost','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','lodash','moment','util','node-tnef','../../../config/logger'];(function(_0x815712,_0x27a650){var _0x234dc8=function(_0x687a24){while(--_0x687a24){_0x815712['push'](_0x815712['shift']());}};_0x234dc8(++_0x27a650);}(_0xd26f,0x113));var _0xfd26=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xd26f[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xfd26('0x0'));var moment=require(_0xfd26('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xfd26('0x2'));var tnef=require(_0xfd26('0x3'));var logger=require(_0xfd26('0x4'))(_0xfd26('0x5'));var config=require(_0xfd26('0x6'));function getAddress(_0x29c235){var _0x3983a2=_[_0xfd26('0x7')](_0x29c235[_0xfd26('0x8')]);return _0x3983a2&&_0x3983a2['address']?_0x3983a2[_0xfd26('0x9')]:_0xfd26('0xa')+random[_0xfd26('0xb')](0x6)+_0xfd26('0xc');}function getFirstName(_0x3c9154){var _0x447f02=_['head'](_0x3c9154[_0xfd26('0x8')]);if(_0x447f02&&_0x447f02[_0xfd26('0xd')]){if(_0x447f02[_0xfd26('0xd')]==_0x447f02[_0xfd26('0x9')]){return _0x447f02[_0xfd26('0xd')][_0xfd26('0xe')](0x0,_0x447f02['name'][_0xfd26('0xf')]('@'));}var _0x5144d1=_0x447f02[_0xfd26('0xd')]['split'](/\s+/);return _0x5144d1['length']>0x1?_0x5144d1['slice'](0x0,-0x1)['join']('\x20'):_0x447f02['name'];}return _0xfd26('0x10');}function getLastName(_0x30c10a){var _0x37ef27=_[_0xfd26('0x7')](_0x30c10a[_0xfd26('0x8')]);if(_0x37ef27&&_0x37ef27[_0xfd26('0xd')]){var _0x382b89=_0x37ef27[_0xfd26('0xd')][_0xfd26('0x11')](/\s+/);return _0x382b89[_0xfd26('0x12')]>0x1?_0x382b89[_0xfd26('0x13')]():'';}return'';}function getMails(_0x186d30,_0xc10394){var _0xbdcbbb='';for(var _0x2f9b37=0x0;_0x2f9b37<_0xc10394['value'][_0xfd26('0x12')];_0x2f9b37+=0x1){if(_0xc10394[_0xfd26('0x8')][_0x2f9b37][_0xfd26('0x9')]!==_0x186d30){if(!_[_0xfd26('0x14')](_0xbdcbbb)){_0xbdcbbb+=',';}_0xbdcbbb+=_0xc10394[_0xfd26('0x8')][_0x2f9b37]['name']||_0xc10394[_0xfd26('0x8')][_0x2f9b37]['address']||'';_0xbdcbbb+='\x20<';_0xbdcbbb+=_0xc10394['value'][_0x2f9b37]['address']?_0xc10394[_0xfd26('0x8')][_0x2f9b37][_0xfd26('0x9')]:'anonymous'+random['generate'](0x6)+_0xfd26('0xc');_0xbdcbbb+='>';}}return _0xbdcbbb;}function parseEmail(_0x25d3a1,_0x5b4004,_0xe7d6d9){if(_0x5b4004['html']){var _0x8c6df1=/)<[^<]*)*<\/script>/gi;while(_0x8c6df1['test'](_0x5b4004[_0xfd26('0x15')])){_0x5b4004['html']=_0x5b4004[_0xfd26('0x15')][_0xfd26('0x16')](_0x8c6df1,'');}if(_0x5b4004['html']['includes'](_0xfd26('0x17'))){var _0x4bc02c=[];_0x5b4004[_0xfd26('0x18')][_0xfd26('0x19')](_0x162a04=>{_0x4bc02c[_0xfd26('0x1a')](_0x162a04[_0xfd26('0x1b')]);});var _0x49cabd=/]+>/g;var _0xd0ed59=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x49fc03=_0x5b4004[_0xfd26('0x15')][_0xfd26('0x16')](_0xd0ed59,'_SRC');var _0xd193c9=_0x49fc03[_0xfd26('0x16')](_0x49cabd,_0xfd26('0x1c'));for(let _0x3d4279=0x0;_0x3d4279<_0x4bc02c[_0xfd26('0x12')];_0x3d4279++){var _0x10368c=_0xd193c9[_0xfd26('0x16')](_0xfd26('0x1c'),_0xfd26('0x1d')+_0x4bc02c[_0x3d4279]+'\x20]');_0xd193c9=_0x10368c;}_0x5b4004['html']=_0xd193c9;}_0xe7d6d9['body']=_0x5b4004['html'];}else{_0xe7d6d9[_0xfd26('0x1e')]=_0x5b4004['textAsHtml'];}if(_0xe7d6d9[_0xfd26('0x1e')]){_0xe7d6d9[_0xfd26('0x1e')]=_0xe7d6d9['body']['replace'](/0x0){var _0x3ef628=[_0xfd26('0x2f'),_0xfd26('0x30'),_0xfd26('0x31')];for(var _0x2f4218=0x0;_0x2f4218<_0x5b4004[_0xfd26('0x2e')]['length'];_0x2f4218++){var _0x2bbe91=_['indexOf'](_0x3ef628,_0x5b4004[_0xfd26('0x2e')][_0x2f4218][_0xfd26('0x32')]);if(_0x2bbe91>=0x0){_0xe7d6d9[_0xfd26('0x33')]=!![];}}}return _0xe7d6d9;}exports[_0xfd26('0x34')]=function(_0x1beb27,_0x5aaf78,_0x43166a){var _0x10718a={'from':getAddress(_0x5aaf78['from']),'firstName':getFirstName(_0x5aaf78[_0xfd26('0x35')]),'lastName':getLastName(_0x5aaf78[_0xfd26('0x35')]),'mapKey':'email','message':{'from':getMails(_0x1beb27['email'],_0x5aaf78[_0xfd26('0x35')]),'to':_0x1beb27[_0xfd26('0x5')],'cc':'','subject':_0x5aaf78[_0xfd26('0x36')]||'','messageId':_0x5aaf78[_0xfd26('0x37')],'inReplyTo':_0x5aaf78[_0xfd26('0x38')],'sentAt':moment(_0x5aaf78['date'])['format'](_0xfd26('0x39')),'attach':![],'attachments':[]}};if(!_0x5aaf78[_0xfd26('0x15')]&&!_0x5aaf78[_0xfd26('0x3a')]){var _0x508124=_['filter'](_0x5aaf78[_0xfd26('0x18')],{'contentType':_0xfd26('0x3b')});if(_0x508124[_0xfd26('0x12')]){logger['info'](util[_0xfd26('0x26')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5aaf78['messageId']));tnef[_0xfd26('0x3c')](_['first'](_0x508124)['content'],function(_0x442212,_0x4a53b3){if(_0x4a53b3){_0x5aaf78['html']=_0x4a53b3[_0xfd26('0x3d')]||_0xfd26('0x3e');if(_0x4a53b3[_0xfd26('0x3f')]){for(var _0x170148=0x0;_0x170148<_0x4a53b3['Attachments'][_0xfd26('0x12')];_0x170148++){var _0x4aec87=_0x4a53b3[_0xfd26('0x3f')][_0x170148];_0x10718a[_0xfd26('0x20')][_0xfd26('0x18')][_0xfd26('0x1a')]({'filename':_0x4aec87[_0xfd26('0x40')],'content':Buffer[_0xfd26('0x35')](_0x4aec87['Data'])});}}}_0x43166a(parseEmail(_0x1beb27,_0x5aaf78,_0x10718a));});}else{_0x5aaf78['html']=_0xfd26('0x3e');_0x43166a(parseEmail(_0x1beb27,_0x5aaf78,_0x10718a));}}else{_0x43166a(parseEmail(_0x1beb27,_0x5aaf78,_0x10718a));}};exports[_0xfd26('0x41')]=function(_0xa44fc1){switch(_0xa44fc1){case'gmail':return'imap.gmail.com';case'yahoo':return _0xfd26('0x42');case _0xfd26('0x43'):return'imap-mail.outlook.com';case _0xfd26('0x44'):return _0xfd26('0x45');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 7000c45..269e902 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 _0x808d=['key','SERV','active','Smtp','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x808d,0x161));var _0xd808=function(_0x2085e0,_0x8b39f4){_0x2085e0=_0x2085e0-0x0;var _0x250c17=_0x808d[_0x2085e0];return _0x250c17;};'use strict';var _=require('lodash');function MailAccount(_0x4cc730){this['id']=_0x4cc730['id']||0x0;this[_0xd808('0x0')]=_0x4cc730['name']||'Service';this[_0xd808('0x1')]=_0x4cc730['key']||_0xd808('0x2');this[_0xd808('0x3')]=_0x4cc730[_0xd808('0x3')]||![];this['Imap']=_0x4cc730['Imap']||[];this['Smtp']=_0x4cc730[_0xd808('0x4')]||[];}module[_0xd808('0x5')]=MailAccount; \ No newline at end of file +var _0xe0d8=['Smtp','exports','name','Service','key','SERV','active','Imap'];(function(_0x26366f,_0x4594ef){var _0x439bf8=function(_0x3604a9){while(--_0x3604a9){_0x26366f['push'](_0x26366f['shift']());}};_0x439bf8(++_0x4594ef);}(_0xe0d8,0x18a));var _0x8e0d=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xe0d8[_0x231b2e];return _0x3feb2a;};'use strict';var _=require('lodash');function MailAccount(_0x2d70a8){this['id']=_0x2d70a8['id']||0x0;this[_0x8e0d('0x0')]=_0x2d70a8[_0x8e0d('0x0')]||_0x8e0d('0x1');this['key']=_0x2d70a8[_0x8e0d('0x2')]||_0x8e0d('0x3');this[_0x8e0d('0x4')]=_0x2d70a8[_0x8e0d('0x4')]||![];this[_0x8e0d('0x5')]=_0x2d70a8[_0x8e0d('0x5')]||[];this[_0x8e0d('0x6')]=_0x2d70a8[_0x8e0d('0x6')]||[];}module[_0x8e0d('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 4c3dbed..182d27c 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 _0x6300=['lodash','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','merge','exports'];(function(_0x18d99e,_0x282528){var _0x2e3ef5=function(_0x936b74){while(--_0x936b74){_0x18d99e['push'](_0x18d99e['shift']());}};_0x2e3ef5(++_0x282528);}(_0x6300,0x132));var _0x0630=function(_0x113ae2,_0x43f6ea){_0x113ae2=_0x113ae2-0x0;var _0x431b53=_0x6300[_0x113ae2];return _0x431b53;};'use strict';var _=require(_0x0630('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x0630('0x1')]={};};function freeIsNotKey(_0x1835ac,_0x320e69,_0x41f55b){var _0x364235=_['mapKeys'](_0x1835ac,function(_0x478bac,_0x1309a7){return _0x478bac[_0x41f55b];});for(var _0x289593 in _0x320e69){if(_0x320e69[_0x0630('0x2')](_0x289593)){if(!_0x364235[_0x289593]){delete _0x320e69[_0x289593];}}}}Realtime['prototype'][_0x0630('0x3')]=function(_0x2e73b2,_0x28cd4f){for(var _0x172c95 in _0x28cd4f){if(_0x2e73b2[_0x0630('0x2')](_0x172c95)){_0x2e73b2[_0x172c95]=_0x28cd4f[_0x172c95];}}};Realtime[_0x0630('0x4')][_0x0630('0x5')]=function(){var _0x2f8106=this;return function(_0x44a50a){if(_0x44a50a){freeIsNotKey(_0x44a50a,_0x2f8106[_0x0630('0x1')],'id');for(var _0x998485=0x0,_0x610d35={},_0x277e37={};_0x998485<_0x44a50a[_0x0630('0x6')];_0x998485+=0x1){_0x610d35=_0x44a50a[_0x998485];if(_['isUndefined'](_0x2f8106[_0x0630('0x1')][_0x610d35['id']])){_0x2f8106['mailAccounts'][_0x610d35['id']]=new MailAccount(_0x610d35);}else{_[_0x0630('0x7')](_0x2f8106['mailAccounts'][_0x610d35['id']],_0x610d35);}}}return _0x2f8106['mailAccounts'];};};module[_0x0630('0x8')]=Realtime; \ No newline at end of file +var _0x7de2=['prototype','initMailAccounts','length','merge','lodash','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7de2,0xaf));var _0x27de=function(_0xc81c2d,_0x1e7be2){_0xc81c2d=_0xc81c2d-0x0;var _0x405dee=_0x7de2[_0xc81c2d];return _0x405dee;};'use strict';var _=require(_0x27de('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x27de('0x1')]={};};function freeIsNotKey(_0x59b083,_0x10ad1e,_0x2c81a4){var _0x7d32f3=_[_0x27de('0x2')](_0x59b083,function(_0x237415,_0x116111){return _0x237415[_0x2c81a4];});for(var _0x2f199d in _0x10ad1e){if(_0x10ad1e[_0x27de('0x3')](_0x2f199d)){if(!_0x7d32f3[_0x2f199d]){delete _0x10ad1e[_0x2f199d];}}}}Realtime['prototype'][_0x27de('0x4')]=function(_0xf566f,_0x12c9b1){for(var _0x2b0906 in _0x12c9b1){if(_0xf566f[_0x27de('0x3')](_0x2b0906)){_0xf566f[_0x2b0906]=_0x12c9b1[_0x2b0906];}}};Realtime[_0x27de('0x5')][_0x27de('0x6')]=function(){var _0x557587=this;return function(_0x21b187){if(_0x21b187){freeIsNotKey(_0x21b187,_0x557587[_0x27de('0x1')],'id');for(var _0x452f91=0x0,_0x100493={},_0xa85b93={};_0x452f91<_0x21b187[_0x27de('0x7')];_0x452f91+=0x1){_0x100493=_0x21b187[_0x452f91];if(_['isUndefined'](_0x557587[_0x27de('0x1')][_0x100493['id']])){_0x557587[_0x27de('0x1')][_0x100493['id']]=new MailAccount(_0x100493);}else{_[_0x27de('0x8')](_0x557587[_0x27de('0x1')][_0x100493['id']],_0x100493);}}}return _0x557587[_0x27de('0x1')];};};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 5cd794a..33f55f4 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 _0x71ab=['getMailAccount','notify','Request','NotifyMailAccount','getMailAccounts','GetMailAccount','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp'];(function(_0x4dc9ba,_0x12f74d){var _0x1221c8=function(_0xef653d){while(--_0xef653d){_0x4dc9ba['push'](_0x4dc9ba['shift']());}};_0x1221c8(++_0x12f74d);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require('../client');exports[_0xb71a('0x0')]=function(){return function(){return client['Request'](_0xb71a('0x1'),{'options':{'attributes':['id','name',_0xb71a('0x2'),_0xb71a('0x3'),_0xb71a('0x4'),_0xb71a('0x5'),_0xb71a('0x6'),_0xb71a('0x7')],'raw':![],'include':[{'model':_0xb71a('0x8'),'as':_0xb71a('0x9')},{'model':_0xb71a('0xa'),'as':_0xb71a('0xb')}]},'log':_0xb71a('0xc')});};};exports[_0xb71a('0xd')]=function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xe')](_0xb71a('0xf'),{'account':{'id':_0x43ca14},'body':_0x471ab6,'log':_0xb71a('0xf')});}; \ No newline at end of file +var _0x8200=['getMailAccounts','Request','name','service','email','key','MailServerIn','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x8200,0x11f));var _0x0820=function(_0x28ae24,_0x5741c0){_0x28ae24=_0x28ae24-0x0;var _0x4e22c5=_0x8200[_0x28ae24];return _0x4e22c5;};'use strict';var client=require(_0x0820('0x0'));exports[_0x0820('0x1')]=function(){return function(){return client[_0x0820('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x0820('0x3'),_0x0820('0x4'),_0x0820('0x5'),'active',_0x0820('0x6'),'ListId','TemplateId'],'raw':![],'include':[{'model':_0x0820('0x7'),'as':'Imap'},{'model':_0x0820('0x8'),'as':_0x0820('0x9')}]},'log':_0x0820('0xa')});};};exports['notify']=function(_0x4f9cf6,_0x101123){return client['Request'](_0x0820('0xb'),{'account':{'id':_0x4f9cf6},'body':_0x101123,'log':_0x0820('0xb')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 459b1b7..30a5a6c 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 _0xac90=['getSettings','Request','ShowSetting','GetSettings'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xac90,0x78));var _0x0ac9=function(_0x2a1a31,_0x1b8b1a){_0x2a1a31=_0x2a1a31-0x0;var _0xe175e8=_0xac90[_0x2a1a31];return _0xe175e8;};'use strict';var client=require('../client');exports[_0x0ac9('0x0')]=function(){return client[_0x0ac9('0x1')](_0x0ac9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x0ac9('0x3')});}; \ No newline at end of file +var _0x5dc7=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x496151,_0x53cc87){var _0x2fd394=function(_0x878f8c){while(--_0x878f8c){_0x496151['push'](_0x496151['shift']());}};_0x2fd394(++_0x53cc87);}(_0x5dc7,0x1df));var _0x75dc=function(_0x5b22e4,_0x38a2ef){_0x5b22e4=_0x5b22e4-0x0;var _0x584118=_0x5dc7[_0x5b22e4];return _0x584118;};'use strict';var client=require(_0x75dc('0x0'));exports[_0x75dc('0x1')]=function(){return client[_0x75dc('0x2')](_0x75dc('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x75dc('0x4')]},'log':_0x75dc('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 56508bb..6148b1b 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 c7bfca1..c4e9e8f 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 _0x5aa7=['http','ioredis','createServer','timeout','listen','port','polling','redis','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','exports','lodash'];(function(_0x40eb1b,_0x15da41){var _0x2e3102=function(_0x47219e){while(--_0x47219e){_0x40eb1b['push'](_0x40eb1b['shift']());}};_0x2e3102(++_0x15da41);}(_0x5aa7,0x11c));var _0x75aa=function(_0x2ddcdd,_0x1fe7c7){_0x2ddcdd=_0x2ddcdd-0x0;var _0x13e59c=_0x5aa7[_0x2ddcdd];return _0x13e59c;};'use strict';var _=require(_0x75aa('0x0'));var http=require(_0x75aa('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x75aa('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x75aa('0x3')](app);server[_0x75aa('0x4')]=0xdbba0;if(sticky[_0x75aa('0x5')](server,config[_0x75aa('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x75aa('0x7')]});config[_0x75aa('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x75aa('0x9')](require(_0x75aa('0xa'))({'pubClient':new Redis(config[_0x75aa('0x8')]),'subClient':new Redis(config[_0x75aa('0x8')])}));require(_0x75aa('0xb'))['default']();require(_0x75aa('0xc'))[_0x75aa('0xd')](socketio);require(_0x75aa('0xe'))['default'](app);require(_0x75aa('0xf'))['default'](app);}else{server[_0x75aa('0x10')](_0x75aa('0x11'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x75aa('0x6')]);});}exports=module[_0x75aa('0x12')]=app; \ No newline at end of file +var _0x1d35=['defaults','localhost','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','redis'];(function(_0x1bbc38,_0xe1dbe){var _0x2dcc77=function(_0x3416a0){while(--_0x3416a0){_0x1bbc38['push'](_0x1bbc38['shift']());}};_0x2dcc77(++_0xe1dbe);}(_0x1d35,0x181));var _0x51d3=function(_0x3e7f5a,_0x120038){_0x3e7f5a=_0x3e7f5a-0x0;var _0x20d3d5=_0x1d35[_0x3e7f5a];return _0x20d3d5;};'use strict';var _=require(_0x51d3('0x0'));var http=require(_0x51d3('0x1'));var express=require(_0x51d3('0x2'));var sticky=require('sticky-session');var Redis=require(_0x51d3('0x3'));var config=require(_0x51d3('0x4'));var app=express();var server=http[_0x51d3('0x5')](app);server[_0x51d3('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x51d3('0x7')])){var socketio=require(_0x51d3('0x8'))(server,{'transports':[_0x51d3('0x9'),'polling']});config[_0x51d3('0xa')]=_[_0x51d3('0xb')](config[_0x51d3('0xa')],{'host':_0x51d3('0xc'),'port':0x18eb});socketio['adapter'](require(_0x51d3('0xd'))({'pubClient':new Redis(config[_0x51d3('0xa')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x51d3('0xe')]();require(_0x51d3('0xf'))[_0x51d3('0xe')](socketio);require(_0x51d3('0x10'))[_0x51d3('0xe')](app);require(_0x51d3('0x11'))[_0x51d3('0xe')](app);}else{server[_0x51d3('0x12')](_0x51d3('0x13'),function(){console[_0x51d3('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x51d3('0x7')]);});}exports=module[_0x51d3('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 835dbe1..9e2fc0d 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 _0x42f9=['message','exports','bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error'];(function(_0xc940bf,_0x4a378f){var _0x36e7f2=function(_0x2533c5){while(--_0x2533c5){_0xc940bf['push'](_0xc940bf['shift']());}};_0x36e7f2(++_0x4a378f);}(_0x42f9,0x9e));var _0x942f=function(_0x5d6b9c,_0x51e708){_0x5d6b9c=_0x5d6b9c-0x0;var _0xcee260=_0x42f9[_0x5d6b9c];return _0xcee260;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x942f('0x0'));var logger=require(_0x942f('0x1'))(_0x942f('0x2'));var client=jayson[_0x942f('0x3')][_0x942f('0x4')]({'port':0x2329});client['Request']=function(_0x37d825,_0x38dfe2){return new BPromise(function(_0x42a6c3,_0x4df186){return client[_0x942f('0x5')](_0x37d825,_0x38dfe2)[_0x942f('0x6')](function(_0xf77bd7){logger[_0x942f('0x7')](_0x942f('0x8'),_0x942f('0x2'),_0x37d825,_0x38dfe2,_0xf77bd7);if(_0xf77bd7[_0x942f('0x9')]){logger[_0x942f('0x9')](_0x942f('0x8'),'routing',_0x37d825,_0xf77bd7[_0x942f('0x9')]['message'],_0x38dfe2);return _0x4df186(_0xf77bd7[_0x942f('0x9')][_0x942f('0xa')]);}else{return _0x42a6c3(_0xf77bd7['result']);}})['catch'](function(_0x8a7289){logger[_0x942f('0x9')](_0x942f('0x8'),_0x942f('0x2'),_0x37d825,_0x8a7289,_0x38dfe2);return _0x4df186(_0x8a7289);});});};module[_0x942f('0xb')]=client; \ No newline at end of file +var _0x9cdf=['message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error'];(function(_0x55a03f,_0x400154){var _0x38d2b0=function(_0x506616){while(--_0x506616){_0x55a03f['push'](_0x55a03f['shift']());}};_0x38d2b0(++_0x400154);}(_0x9cdf,0x1e5));var _0xf9cd=function(_0x57d82b,_0x26dcf8){_0x57d82b=_0x57d82b-0x0;var _0x293add=_0x9cdf[_0x57d82b];return _0x293add;};'use strict';var jayson=require(_0xf9cd('0x0'));var BPromise=require(_0xf9cd('0x1'));var logger=require(_0xf9cd('0x2'))(_0xf9cd('0x3'));var client=jayson[_0xf9cd('0x4')][_0xf9cd('0x5')]({'port':0x2329});client[_0xf9cd('0x6')]=function(_0x369f2a,_0x1c7bdd){return new BPromise(function(_0x4ca9d5,_0x45434c){return client[_0xf9cd('0x7')](_0x369f2a,_0x1c7bdd)[_0xf9cd('0x8')](function(_0x49fb68){logger[_0xf9cd('0x9')]('rpc','routing',_0x369f2a,_0x1c7bdd,_0x49fb68);if(_0x49fb68[_0xf9cd('0xa')]){logger['error']('rpc',_0xf9cd('0x3'),_0x369f2a,_0x49fb68['error'][_0xf9cd('0xb')],_0x1c7bdd);return _0x45434c(_0x49fb68[_0xf9cd('0xa')]['message']);}else{return _0x4ca9d5(_0x49fb68[_0xf9cd('0xc')]);}})[_0xf9cd('0xd')](function(_0x1c0916){logger['error'](_0xf9cd('0xe'),_0xf9cd('0x3'),_0x369f2a,_0x1c0916,_0x1c7bdd);return _0x45434c(_0x1c0916);});});};module[_0xf9cd('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 30b8830..6977d85 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 _0xcf84=['then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','./server','./rpc/user','./rpc/interval','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x245624,_0x1f5ea8){var _0x4be808=function(_0x186977){while(--_0x186977){_0x245624['push'](_0x245624['shift']());}};_0x4be808(++_0x1f5ea8);}(_0xcf84,0x1c7));var _0x4cf8=function(_0x35d239,_0x234a02){_0x35d239=_0x35d239-0x0;var _0x42f8fe=_0xcf84[_0x35d239];return _0x42f8fe;};'use strict';var BPromise=require('bluebird');var server=require(_0x4cf8('0x0'));var Realtime=require('./realtime');var user=require(_0x4cf8('0x1'));var interval=require(_0x4cf8('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x4cf8('0x3'));var faxQueue=require(_0x4cf8('0x4'));var whatsappQueue=require(_0x4cf8('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4cf8('0x6')]()[_0x4cf8('0x7')](user['getAgents']())[_0x4cf8('0x7')](realtime[_0x4cf8('0x8')]())[_0x4cf8('0x7')](interval[_0x4cf8('0x9')]())[_0x4cf8('0x7')](realtime[_0x4cf8('0xa')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0x4cf8('0x7')](realtime[_0x4cf8('0xb')]())[_0x4cf8('0x7')](chatQueue['getChatQueues']())[_0x4cf8('0x7')](realtime[_0x4cf8('0xc')]())[_0x4cf8('0x7')](smsQueue[_0x4cf8('0xd')]())[_0x4cf8('0x7')](realtime[_0x4cf8('0xe')]())[_0x4cf8('0x7')](mailQueue[_0x4cf8('0xf')]())[_0x4cf8('0x7')](realtime['initMailQueues']())[_0x4cf8('0x7')](faxQueue[_0x4cf8('0x10')]())[_0x4cf8('0x7')](realtime[_0x4cf8('0x11')]())[_0x4cf8('0x7')](whatsappQueue[_0x4cf8('0x12')]())[_0x4cf8('0x7')](realtime['initWhatsappQueues']())[_0x4cf8('0x7')](function(){return realtime;});}function main(){return server[_0x4cf8('0x13')](realtime)[_0x4cf8('0x7')](function(_0x38ff43){return initRealtime();})[_0x4cf8('0x7')](function(_0x737767){return setInterval(initRealtime,0x1388);})[_0x4cf8('0x14')](function(_0x11f0d3){console['log'](_0x11f0d3);});}main(); \ No newline at end of file +var _0x50bb=['initMailQueues','getFaxQueues','initFaxQueues','listen','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues'];(function(_0x4359d7,_0x4d6f6f){var _0xcbfa46=function(_0x1b3fae){while(--_0x1b3fae){_0x4359d7['push'](_0x4359d7['shift']());}};_0xcbfa46(++_0x4d6f6f);}(_0x50bb,0xd4));var _0xb50b=function(_0x303a30,_0x2d44c7){_0x303a30=_0x303a30-0x0;var _0x4a8e3c=_0x50bb[_0x303a30];return _0x4a8e3c;};'use strict';var BPromise=require(_0xb50b('0x0'));var server=require(_0xb50b('0x1'));var Realtime=require(_0xb50b('0x2'));var user=require('./rpc/user');var interval=require(_0xb50b('0x3'));var openchannelQueue=require(_0xb50b('0x4'));var chatQueue=require(_0xb50b('0x5'));var smsQueue=require(_0xb50b('0x6'));var mailQueue=require(_0xb50b('0x7'));var faxQueue=require(_0xb50b('0x8'));var whatsappQueue=require(_0xb50b('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xb50b('0xa')](user['getAgents']())[_0xb50b('0xa')](realtime['initAgents']())[_0xb50b('0xa')](interval[_0xb50b('0xb')]())[_0xb50b('0xa')](realtime[_0xb50b('0xc')]())[_0xb50b('0xa')](openchannelQueue[_0xb50b('0xd')]())['then'](realtime['initOpenchannelQueues']())[_0xb50b('0xa')](chatQueue[_0xb50b('0xe')]())[_0xb50b('0xa')](realtime[_0xb50b('0xf')]())[_0xb50b('0xa')](smsQueue['getSmsQueues']())[_0xb50b('0xa')](realtime[_0xb50b('0x10')]())[_0xb50b('0xa')](mailQueue[_0xb50b('0x11')]())['then'](realtime[_0xb50b('0x12')]())[_0xb50b('0xa')](faxQueue[_0xb50b('0x13')]())[_0xb50b('0xa')](realtime[_0xb50b('0x14')]())[_0xb50b('0xa')](whatsappQueue['getWhatsappQueues']())[_0xb50b('0xa')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0xb50b('0x15')](realtime)[_0xb50b('0xa')](function(_0x2a4642){return initRealtime();})[_0xb50b('0xa')](function(_0x50694c){return setInterval(initRealtime,0x1388);})['catch'](function(_0x43dbdd){console[_0xb50b('0x16')](_0x43dbdd);});}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 494d23d..aeafc7f 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x37c9a3,_0x35276f){var _0x34f5ac=function(_0x10ccaa){while(--_0x10ccaa){_0x37c9a3['push'](_0x37c9a3['shift']());}};_0x34f5ac(++_0x35276f);}(_0xe14b,0x93));var _0xbe14=function(_0x48fd10,_0x30a0d8){_0x48fd10=_0x48fd10-0x0;var _0x5610d6=_0xe14b[_0x48fd10];return _0x5610d6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x48b044,_0x3f823c){var _0x235c87=function(_0x2d9116){while(--_0x2d9116){_0x48b044['push'](_0x48b044['shift']());}};_0x235c87(++_0x3f823c);}(_0x7a54,0x106));var _0x47a5=function(_0x37d9d1,_0x175894){_0x37d9d1=_0x37d9d1-0x0;var _0x40d71d=_0x7a54[_0x37d9d1];return _0x40d71d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 34deae4..6f38ff1 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 _0x4fc6=['error','message','result','catch','sendMailMessage','bluebird','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4fc6,0x181));var _0x64fc=function(_0x222fb8,_0x54fe17){_0x222fb8=_0x222fb8-0x0;var _0x1d35ca=_0x4fc6[_0x222fb8];return _0x1d35ca;};'use strict';var BPromise=require(_0x64fc('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x64fc('0x1')][_0x64fc('0x2')]({'port':0x232b});function request(_0x58ee8e,_0x2b2d67){return new BPromise(function(_0x9b6288,_0x4b7135){return client[_0x64fc('0x3')](_0x58ee8e,_0x2b2d67)[_0x64fc('0x4')](function(_0x5334c5){if(_0x5334c5[_0x64fc('0x5')]){return _0x4b7135(_0x5334c5[_0x64fc('0x5')][_0x64fc('0x6')]);}else{return _0x9b6288(_0x5334c5[_0x64fc('0x7')]);}})[_0x64fc('0x8')](function(_0x66337b){return _0x4b7135(_0x66337b);});});}exports[_0x64fc('0x9')]=function(_0xfe78ea,_0x5a10e1){return request('SendMail',{'account':_0xfe78ea,'message':_0x5a10e1});}; \ No newline at end of file +var _0x326e=['message','result','catch','sendMailMessage','SendMail','bluebird','client','http','request','then','error'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x326e,0x170));var _0xe326=function(_0x3674aa,_0x22535f){_0x3674aa=_0x3674aa-0x0;var _0x1ecb2e=_0x326e[_0x3674aa];return _0x1ecb2e;};'use strict';var BPromise=require(_0xe326('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xe326('0x1')][_0xe326('0x2')]({'port':0x232b});function request(_0x3d48f9,_0x2a0542){return new BPromise(function(_0x42511b,_0x34e3f2){return client[_0xe326('0x3')](_0x3d48f9,_0x2a0542)[_0xe326('0x4')](function(_0x302b97){if(_0x302b97[_0xe326('0x5')]){return _0x34e3f2(_0x302b97[_0xe326('0x5')][_0xe326('0x6')]);}else{return _0x42511b(_0x302b97[_0xe326('0x7')]);}})[_0xe326('0x8')](function(_0xe0c0f6){return _0x34e3f2(_0xe0c0f6);});});}exports[_0xe326('0x9')]=function(_0x238192,_0x3cec7f){return request(_0xe326('0xa'),{'account':_0x238192,'message':_0x3cec7f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 340ca78..a52bfe2 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 _0xbe67=['online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','fax','length','getChannelStatus','Status','toNumber','format','mailStatus','faxStatusTime','whatsappStatus','stringify','md5','user:save','lodash','ioredis','../../../config/environment','redis','localhost','name'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xbe67,0x1e9));var _0x7be6=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xbe67[_0x24392f];return _0x591e33;};'use strict';var _=require(_0x7be6('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x7be6('0x1'));var config=require(_0x7be6('0x2'));config[_0x7be6('0x3')]=_['defaults'](config['redis'],{'host':_0x7be6('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7be6('0x3')]));function Agent(_0xac24e8){this['id']=_0xac24e8['id']||0x0;this[_0x7be6('0x5')]=_0xac24e8[_0x7be6('0x5')]||'';this[_0x7be6('0x6')]=_0xac24e8[_0x7be6('0x6')]||!![];this[_0x7be6('0x7')]=_0xac24e8[_0x7be6('0x7')]||![];this[_0x7be6('0x8')]=_0xac24e8[_0x7be6('0x8')]||![];this[_0x7be6('0x9')]=_0xac24e8['mailPause']||![];this[_0x7be6('0xa')]=_0xac24e8[_0x7be6('0xa')]||![];this[_0x7be6('0xb')]=_0xac24e8[_0x7be6('0xb')]||![];this[_0x7be6('0xc')]=_0xac24e8[_0x7be6('0xc')]||![];this[_0x7be6('0xd')]=_0x7be6('0xe');this[_0x7be6('0xf')]=0x0;this[_0x7be6('0x10')]=_0xac24e8[_0x7be6('0x10')]||0x0;this[_0x7be6('0x11')]=0x0;this['mailStatus']=_0x7be6('0xe');this[_0x7be6('0x12')]=0x0;this[_0x7be6('0x13')]=_0xac24e8['mailCapacity']||0x0;this[_0x7be6('0x14')]=0x0;this[_0x7be6('0x15')]=_0x7be6('0xe');this['faxStatusTime']=0x0;this['faxCapacity']=_0xac24e8['faxCapacity']||0x0;this[_0x7be6('0x16')]=0x0;this[_0x7be6('0x17')]=_0x7be6('0xe');this[_0x7be6('0x18')]=0x0;this[_0x7be6('0x19')]=_0xac24e8['smsCapacity']||0x0;this[_0x7be6('0x1a')]=0x0;this['whatsappStatus']=_0x7be6('0xe');this[_0x7be6('0x1b')]=0x0;this['whatsappCapacity']=_0xac24e8[_0x7be6('0x1c')]||0x0;this[_0x7be6('0x1d')]=0x0;this['openchannelStatus']=_0x7be6('0xe');this[_0x7be6('0x1e')]=0x0;this[_0x7be6('0x1f')]=_0xac24e8['openchannelCapacity']||0x0;this[_0x7be6('0x20')]=0x0;this[_0x7be6('0x21')]=![];this[_0x7be6('0x22')]=undefined;this['md5']='';this[_0x7be6('0x23')]();}Agent[_0x7be6('0x24')]['getChannelStatus']=function(_0x49e917){if(this[_0x49e917+_0x7be6('0x25')]>0x0){if(this[_0x49e917+_0x7be6('0x26')]>0x0&&this[_0x49e917+'CurrentCapacity']>=this[_0x49e917+_0x7be6('0x26')]){return _0x7be6('0x27');}else{return'working';}}else{return _0x7be6('0x28');}};Agent[_0x7be6('0x24')][_0x7be6('0x23')]=function(){var _0x3d04cd=[_0x7be6('0x29'),_0x7be6('0x2a'),'openchannel',_0x7be6('0x2b'),'sms','whatsapp'];for(var _0x4d0be1=0x0;_0x4d0be1<_0x3d04cd[_0x7be6('0x2c')];_0x4d0be1+=0x1){var _0x5cac44=this[_0x7be6('0x2d')](_0x3d04cd[_0x4d0be1]);if(this[_0x3d04cd[_0x4d0be1]+_0x7be6('0x2e')]!==_0x5cac44){this[_0x3d04cd[_0x4d0be1]+'StatusTime']=_[_0x7be6('0x2f')](moment()[_0x7be6('0x30')]('x'));}this[_0x3d04cd[_0x4d0be1]+'Status']=_0x5cac44;}var _0x348dfb={'id':this['id'],'name':this[_0x7be6('0x5')],'online':this[_0x7be6('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0x7be6('0x8')],'mailPause':this['mailPause'],'smsPause':this[_0x7be6('0xb')],'faxPause':this[_0x7be6('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x7be6('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x7be6('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x7be6('0x31')],'mailStatusTime':this[_0x7be6('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x7be6('0x32')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7be6('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x7be6('0x1a')],'whatsappStatus':this[_0x7be6('0x33')],'whatsappStatusTime':this[_0x7be6('0x1b')],'whatsappCapacity':this[_0x7be6('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x7be6('0x20')],'busy':this[_0x7be6('0x21')],'busyQueue':this[_0x7be6('0x22')]};var _0x253d82=md5(JSON[_0x7be6('0x34')](_0x348dfb));if(this[_0x7be6('0x35')]!==_0x253d82){this[_0x7be6('0x35')]=_0x253d82;io['emit'](_0x7be6('0x36'),_0x348dfb);}};module['exports']=Agent; \ No newline at end of file +var _0x3f72=['md5','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','CurrentCapacity','Capacity','maxcapacity','idle','updateRealtime','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','mailStatusTime','whatsappStatus','stringify','user:save','lodash','moment'];(function(_0x561197,_0x2d7d64){var _0x191270=function(_0x32d6e2){while(--_0x32d6e2){_0x561197['push'](_0x561197['shift']());}};_0x191270(++_0x2d7d64);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x23f7('0x0'));var moment=require(_0x23f7('0x1'));var md5=require(_0x23f7('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x23f7('0x3')]=_[_0x23f7('0x4')](config[_0x23f7('0x3')],{'host':_0x23f7('0x5'),'port':0x18eb});var io=require(_0x23f7('0x6'))(new Redis(config['redis']));function Agent(_0x3dcbeb){this['id']=_0x3dcbeb['id']||0x0;this['name']=_0x3dcbeb[_0x23f7('0x7')]||'';this['online']=_0x3dcbeb[_0x23f7('0x8')]||!![];this[_0x23f7('0x9')]=_0x3dcbeb[_0x23f7('0x9')]||![];this[_0x23f7('0xa')]=_0x3dcbeb[_0x23f7('0xa')]||![];this[_0x23f7('0xb')]=_0x3dcbeb[_0x23f7('0xb')]||![];this[_0x23f7('0xc')]=_0x3dcbeb[_0x23f7('0xc')]||![];this[_0x23f7('0xd')]=_0x3dcbeb['smsPause']||![];this[_0x23f7('0xe')]=_0x3dcbeb[_0x23f7('0xe')]||![];this[_0x23f7('0xf')]='unknown';this['chatStatusTime']=0x0;this[_0x23f7('0x10')]=_0x3dcbeb[_0x23f7('0x10')]||0x0;this[_0x23f7('0x11')]=0x0;this[_0x23f7('0x12')]=_0x23f7('0x13');this['mailStatusTime']=0x0;this[_0x23f7('0x14')]=_0x3dcbeb[_0x23f7('0x14')]||0x0;this[_0x23f7('0x15')]=0x0;this[_0x23f7('0x16')]='unknown';this[_0x23f7('0x17')]=0x0;this[_0x23f7('0x18')]=_0x3dcbeb[_0x23f7('0x18')]||0x0;this[_0x23f7('0x19')]=0x0;this[_0x23f7('0x1a')]=_0x23f7('0x13');this[_0x23f7('0x1b')]=0x0;this['smsCapacity']=_0x3dcbeb[_0x23f7('0x1c')]||0x0;this[_0x23f7('0x1d')]=0x0;this['whatsappStatus']='unknown';this[_0x23f7('0x1e')]=0x0;this[_0x23f7('0x1f')]=_0x3dcbeb[_0x23f7('0x1f')]||0x0;this[_0x23f7('0x20')]=0x0;this[_0x23f7('0x21')]=_0x23f7('0x13');this[_0x23f7('0x22')]=0x0;this[_0x23f7('0x23')]=_0x3dcbeb['openchannelCapacity']||0x0;this[_0x23f7('0x24')]=0x0;this[_0x23f7('0x25')]=![];this[_0x23f7('0x26')]=undefined;this['md5']='';this['updateRealtime']();}Agent[_0x23f7('0x27')]['getChannelStatus']=function(_0x5cd508){if(this[_0x5cd508+_0x23f7('0x28')]>0x0){if(this[_0x5cd508+_0x23f7('0x29')]>0x0&&this[_0x5cd508+'CurrentCapacity']>=this[_0x5cd508+_0x23f7('0x29')]){return _0x23f7('0x2a');}else{return'working';}}else{return _0x23f7('0x2b');}};Agent[_0x23f7('0x27')][_0x23f7('0x2c')]=function(){var _0x500825=['mail',_0x23f7('0x2d'),_0x23f7('0x2e'),_0x23f7('0x2f'),'sms',_0x23f7('0x30')];for(var _0x52a823=0x0;_0x52a823<_0x500825[_0x23f7('0x31')];_0x52a823+=0x1){var _0x1cc5e4=this['getChannelStatus'](_0x500825[_0x52a823]);if(this[_0x500825[_0x52a823]+_0x23f7('0x32')]!==_0x1cc5e4){this[_0x500825[_0x52a823]+_0x23f7('0x33')]=_[_0x23f7('0x34')](moment()[_0x23f7('0x35')]('x'));}this[_0x500825[_0x52a823]+_0x23f7('0x32')]=_0x1cc5e4;}var _0x58f5c6={'id':this['id'],'name':this[_0x23f7('0x7')],'online':this[_0x23f7('0x8')],'voicePause':this[_0x23f7('0x9')],'chatPause':this[_0x23f7('0xa')],'mailPause':this[_0x23f7('0xb')],'smsPause':this[_0x23f7('0xd')],'faxPause':this[_0x23f7('0xc')],'openchannelPause':this[_0x23f7('0xe')],'chatStatus':this[_0x23f7('0xf')],'chatStatusTime':this[_0x23f7('0x36')],'chatCapacity':this[_0x23f7('0x10')],'chatCurrentCapacity':this[_0x23f7('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x23f7('0x37')],'mailCapacity':this[_0x23f7('0x14')],'mailCurrentCapacity':this[_0x23f7('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x23f7('0x17')],'faxCapacity':this[_0x23f7('0x18')],'faxCurrentCapacity':this[_0x23f7('0x19')],'smsStatus':this[_0x23f7('0x1a')],'smsStatusTime':this[_0x23f7('0x1b')],'smsCapacity':this[_0x23f7('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x23f7('0x38')],'whatsappStatusTime':this[_0x23f7('0x1e')],'whatsappCapacity':this[_0x23f7('0x1f')],'whatsappCurrentCapacity':this[_0x23f7('0x20')],'openchannelStatus':this[_0x23f7('0x21')],'openchannelStatusTime':this[_0x23f7('0x22')],'openchannelCapacity':this[_0x23f7('0x23')],'openchannelCurrentCapacity':this[_0x23f7('0x24')],'busy':this['busy'],'busyQueue':this[_0x23f7('0x26')]};var _0x2a702f=md5(JSON[_0x23f7('0x39')](_0x58f5c6));if(this[_0x23f7('0x2')]!==_0x2a702f){this['md5']=_0x2a702f;io['emit'](_0x23f7('0x3a'),_0x58f5c6);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ac589d1..57827ec 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 _0x0aba=['length','online','chatPause','available','waiting','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused'];(function(_0x56f141,_0x42415f){var _0x269ff7=function(_0x5f2fe0){while(--_0x5f2fe0){_0x56f141['push'](_0x56f141['shift']());}};_0x269ff7(++_0x42415f);}(_0x0aba,0x86));var _0xa0ab=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x0aba[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xa0ab('0x0'));var md5=require(_0xa0ab('0x1'));var util=require(_0xa0ab('0x2'));var Redis=require(_0xa0ab('0x3'));var config=require(_0xa0ab('0x4'));config[_0xa0ab('0x5')]=_[_0xa0ab('0x6')](config['redis'],{'host':_0xa0ab('0x7'),'port':0x18eb});var io=require(_0xa0ab('0x8'))(new Redis(config[_0xa0ab('0x5')]));function ChatQueue(_0x679de4){this['id']=_0x679de4['id']||0x0;this[_0xa0ab('0x9')]=_0x679de4[_0xa0ab('0x9')]||'';this[_0xa0ab('0xa')]=_0x679de4[_0xa0ab('0xa')]||0xa;this[_0xa0ab('0xb')]=_0x679de4[_0xa0ab('0xb')]||'beepall';this[_0xa0ab('0xc')]=_0x679de4['Agents'];this[_0xa0ab('0xd')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0xa0ab('0xe')]();}ChatQueue[_0xa0ab('0xf')][_0xa0ab('0x10')]=function(){var _0x555b98=this[_0xa0ab('0xd')][_0xa0ab('0x11')];this[_0xa0ab('0xd')]=_[_0xa0ab('0x12')](this['Agents'],'id');this[_0xa0ab('0xd')][_0xa0ab('0x11')]=_0x555b98;};ChatQueue[_0xa0ab('0xf')][_0xa0ab('0xe')]=function(){this[_0xa0ab('0x13')]=0x0;this[_0xa0ab('0x14')]=0x0;for(var _0x5f20b4=0x0;_0x5f20b4=0x0?this['available']:0x0;var _0x168a6b={'id':this['id'],'available':this[_0xa0ab('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xa0ab('0x9')],'paused':this[_0xa0ab('0x14')],'waiting':this[_0xa0ab('0x19')]};var _0x2fd0e2=md5(JSON[_0xa0ab('0x1a')](_0x168a6b));if(this[_0xa0ab('0x1')]!==_0x2fd0e2){this[_0xa0ab('0x1')]=_0x2fd0e2;io['to'](util[_0xa0ab('0x1b')]('chat:queue:%s',_0x168a6b[_0xa0ab('0x9')]))[_0xa0ab('0x1c')](_0xa0ab('0x1d'),_0x168a6b);}};module[_0xa0ab('0x1e')]=ChatQueue; \ No newline at end of file +var _0xcbee=['stringify','md5','format','chat:queue:%s','chat_queue:save','lodash','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','chatPause','paused','available'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xcbee,0x164));var _0xecbe=function(_0x1ad658,_0x107098){_0x1ad658=_0x1ad658-0x0;var _0x51a788=_0xcbee[_0x1ad658];return _0x51a788;};'use strict';var _=require(_0xecbe('0x0'));var md5=require('md5');var util=require(_0xecbe('0x1'));var Redis=require('ioredis');var config=require(_0xecbe('0x2'));config[_0xecbe('0x3')]=_['defaults'](config[_0xecbe('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xecbe('0x4'))(new Redis(config[_0xecbe('0x3')]));function ChatQueue(_0x584388){this['id']=_0x584388['id']||0x0;this[_0xecbe('0x5')]=_0x584388[_0xecbe('0x5')]||'';this[_0xecbe('0x6')]=_0x584388['timeout']||0xa;this[_0xecbe('0x7')]=_0x584388[_0xecbe('0x7')]||_0xecbe('0x8');this[_0xecbe('0x9')]=_0x584388[_0xecbe('0x9')];this[_0xecbe('0xa')]={};this[_0xecbe('0xb')]=0x0;this['md5']='';this[_0xecbe('0xc')]();this[_0xecbe('0xd')]();}ChatQueue[_0xecbe('0xe')][_0xecbe('0xc')]=function(){var _0x459855=this[_0xecbe('0xa')][_0xecbe('0xf')];this[_0xecbe('0xa')]=_[_0xecbe('0x10')](this[_0xecbe('0x9')],'id');this[_0xecbe('0xa')][_0xecbe('0xf')]=_0x459855;};ChatQueue[_0xecbe('0xe')]['updateRealtime']=function(){this[_0xecbe('0x11')]=0x0;this['paused']=0x0;for(var _0x65ab0c=0x0;_0x65ab0c=0x0?this['available']:0x0;var _0x5e861f={'id':this['id'],'available':this[_0xecbe('0x15')],'loggedIn':this[_0xecbe('0x11')],'name':this[_0xecbe('0x5')],'paused':this[_0xecbe('0x14')],'waiting':this[_0xecbe('0xb')]};var _0x2d681c=md5(JSON[_0xecbe('0x16')](_0x5e861f));if(this['md5']!==_0x2d681c){this[_0xecbe('0x17')]=_0x2d681c;io['to'](util[_0xecbe('0x18')](_0xecbe('0x19'),_0x5e861f[_0xecbe('0x5')]))['emit'](_0xecbe('0x1a'),_0x5e861f);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index a690597..943231b 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 _0x4ce3=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','fax:queue:%s','fax_queue:save','exports'];(function(_0x292380,_0x2c9565){var _0x148f5d=function(_0x1b9a10){while(--_0x1b9a10){_0x292380['push'](_0x292380['shift']());}};_0x148f5d(++_0x2c9565);}(_0x4ce3,0x1ee));var _0x34ce=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x4ce3[_0x14e9f0];return _0xa63f7e;};'use strict';var _=require('lodash');var md5=require(_0x34ce('0x0'));var util=require('util');var Redis=require(_0x34ce('0x1'));var config=require(_0x34ce('0x2'));config[_0x34ce('0x3')]=_[_0x34ce('0x4')](config[_0x34ce('0x3')],{'host':_0x34ce('0x5'),'port':0x18eb});var io=require(_0x34ce('0x6'))(new Redis(config['redis']));function FaxQueue(_0xe4fa60){this['id']=_0xe4fa60['id']||0x0;this[_0x34ce('0x7')]=_0xe4fa60[_0x34ce('0x7')]||'';this[_0x34ce('0x8')]=_0xe4fa60[_0x34ce('0x8')]||0xa;this[_0x34ce('0x9')]=_0xe4fa60[_0x34ce('0x9')]||_0x34ce('0xa');this[_0x34ce('0xb')]=_0xe4fa60[_0x34ce('0xb')];this[_0x34ce('0xc')]={};this[_0x34ce('0xd')]=0x0;this[_0x34ce('0x0')]='';this[_0x34ce('0xe')]();this[_0x34ce('0xf')]();}FaxQueue[_0x34ce('0x10')][_0x34ce('0xe')]=function(){var _0x529981=this[_0x34ce('0xc')][_0x34ce('0x11')];this['mapAgentsId']=_['map'](this[_0x34ce('0xb')],'id');this[_0x34ce('0xc')]['_rr']=_0x529981;};FaxQueue[_0x34ce('0x10')]['updateRealtime']=function(){this[_0x34ce('0x12')]=0x0;this[_0x34ce('0x13')]=0x0;for(var _0x10d6ff=0x0;_0x10d6ff=0x0?this[_0x34ce('0x16')]:0x0;var _0x3c4141={'id':this['id'],'available':this['available'],'loggedIn':this[_0x34ce('0x12')],'name':this[_0x34ce('0x7')],'paused':this['paused'],'waiting':this[_0x34ce('0xd')]};var _0x13286a=md5(JSON['stringify'](_0x3c4141));if(this[_0x34ce('0x0')]!==_0x13286a){this[_0x34ce('0x0')]=_0x13286a;io['to'](util['format'](_0x34ce('0x17'),_0x3c4141[_0x34ce('0x7')]))['emit'](_0x34ce('0x18'),_0x3c4141);}};module[_0x34ce('0x19')]=FaxQueue; \ No newline at end of file +var _0xdf83=['updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','waiting','updateRouting'];(function(_0x10357f,_0x16ecef){var _0x15d266=function(_0x4a041c){while(--_0x4a041c){_0x10357f['push'](_0x10357f['shift']());}};_0x15d266(++_0x16ecef);}(_0xdf83,0xbd));var _0x3df8=function(_0x22de70,_0x243f39){_0x22de70=_0x22de70-0x0;var _0x34050e=_0xdf83[_0x22de70];return _0x34050e;};'use strict';var _=require(_0x3df8('0x0'));var md5=require(_0x3df8('0x1'));var util=require(_0x3df8('0x2'));var Redis=require('ioredis');var config=require(_0x3df8('0x3'));config[_0x3df8('0x4')]=_[_0x3df8('0x5')](config[_0x3df8('0x4')],{'host':_0x3df8('0x6'),'port':0x18eb});var io=require(_0x3df8('0x7'))(new Redis(config[_0x3df8('0x4')]));function FaxQueue(_0x8cf71f){this['id']=_0x8cf71f['id']||0x0;this[_0x3df8('0x8')]=_0x8cf71f[_0x3df8('0x8')]||'';this['timeout']=_0x8cf71f[_0x3df8('0x9')]||0xa;this['strategy']=_0x8cf71f['strategy']||_0x3df8('0xa');this[_0x3df8('0xb')]=_0x8cf71f[_0x3df8('0xb')];this['mapAgentsId']={};this[_0x3df8('0xc')]=0x0;this[_0x3df8('0x1')]='';this[_0x3df8('0xd')]();this[_0x3df8('0xe')]();}FaxQueue[_0x3df8('0xf')][_0x3df8('0xd')]=function(){var _0x1040dc=this[_0x3df8('0x10')][_0x3df8('0x11')];this[_0x3df8('0x10')]=_['map'](this[_0x3df8('0xb')],'id');this['mapAgentsId'][_0x3df8('0x11')]=_0x1040dc;};FaxQueue[_0x3df8('0xf')][_0x3df8('0xe')]=function(){this[_0x3df8('0x12')]=0x0;this[_0x3df8('0x13')]=0x0;for(var _0x39f822=0x0;_0x39f822=0x0?this[_0x3df8('0x17')]:0x0;var _0x3be937={'id':this['id'],'available':this[_0x3df8('0x17')],'loggedIn':this[_0x3df8('0x12')],'name':this[_0x3df8('0x8')],'paused':this[_0x3df8('0x13')],'waiting':this[_0x3df8('0xc')]};var _0x30b3e2=md5(JSON[_0x3df8('0x18')](_0x3be937));if(this['md5']!==_0x30b3e2){this['md5']=_0x30b3e2;io['to'](util[_0x3df8('0x19')](_0x3df8('0x1a'),_0x3be937[_0x3df8('0x8')]))[_0x3df8('0x1b')](_0x3df8('0x1c'),_0x3be937);}};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 566afde..f1304f0 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 _0x6469=['Intervals','exports','name'];(function(_0x36fa51,_0x55ad58){var _0x337877=function(_0xfde693){while(--_0xfde693){_0x36fa51['push'](_0x36fa51['shift']());}};_0x337877(++_0x55ad58);}(_0x6469,0x1c1));var _0x9646=function(_0x4cab47,_0x586b2a){_0x4cab47=_0x4cab47-0x0;var _0x519c91=_0x6469[_0x4cab47];return _0x519c91;};'use strict';function Interval(_0xa6cedb){this['id']=_0xa6cedb['id']||0x0;this[_0x9646('0x0')]=_0xa6cedb[_0x9646('0x0')]||'';this[_0x9646('0x1')]=_0xa6cedb['Intervals']||{};}module[_0x9646('0x2')]=Interval; \ No newline at end of file +var _0xadd8=['exports','name','Intervals'];(function(_0x4a49fd,_0xdf7290){var _0x352773=function(_0x40e0e3){while(--_0x40e0e3){_0x4a49fd['push'](_0x4a49fd['shift']());}};_0x352773(++_0xdf7290);}(_0xadd8,0x103));var _0x8add=function(_0x18b1ea,_0x8af47e){_0x18b1ea=_0x18b1ea-0x0;var _0x494630=_0xadd8[_0x18b1ea];return _0x494630;};'use strict';function Interval(_0x526284){this['id']=_0x526284['id']||0x0;this[_0x8add('0x0')]=_0x526284['name']||'';this['Intervals']=_0x526284[_0x8add('0x1')]||{};}module[_0x8add('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 899792e..37a5e95 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 _0x9303=['updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','mail:queue:%s','emit','mail_queue:save','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x9303,0x8e));var _0x3930=function(_0x5adbb4,_0x5092e0){_0x5adbb4=_0x5adbb4-0x0;var _0x48e176=_0x9303[_0x5adbb4];return _0x48e176;};'use strict';var _=require('lodash');var md5=require(_0x3930('0x0'));var util=require(_0x3930('0x1'));var Redis=require(_0x3930('0x2'));var config=require(_0x3930('0x3'));config['redis']=_[_0x3930('0x4')](config[_0x3930('0x5')],{'host':_0x3930('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3930('0x5')]));function MailQueue(_0x13f753){this['id']=_0x13f753['id']||0x0;this[_0x3930('0x7')]=_0x13f753[_0x3930('0x7')]||'';this[_0x3930('0x8')]=_0x13f753['timeout']||0xa;this['strategy']=_0x13f753[_0x3930('0x9')]||_0x3930('0xa');this[_0x3930('0xb')]=_0x13f753[_0x3930('0xb')];this[_0x3930('0xc')]={};this[_0x3930('0xd')]=0x0;this[_0x3930('0x0')]='';this[_0x3930('0xe')]();this[_0x3930('0xf')]();}MailQueue[_0x3930('0x10')]['updateRouting']=function(){var _0x7cfa08=this['mapAgentsId'][_0x3930('0x11')];this[_0x3930('0xc')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x3930('0x11')]=_0x7cfa08;};MailQueue[_0x3930('0x10')][_0x3930('0xf')]=function(){this[_0x3930('0x12')]=0x0;this[_0x3930('0x13')]=0x0;for(var _0x20b54e=0x0;_0x20b54e=0x0?this[_0x3930('0x16')]:0x0;var _0x239346={'id':this['id'],'available':this[_0x3930('0x16')],'loggedIn':this[_0x3930('0x12')],'name':this[_0x3930('0x7')],'paused':this['paused'],'waiting':this[_0x3930('0xd')]};var _0xab1343=md5(JSON['stringify'](_0x239346));if(this[_0x3930('0x0')]!==_0xab1343){this['md5']=_0xab1343;io['to'](util['format'](_0x3930('0x17'),_0x239346[_0x3930('0x7')]))[_0x3930('0x18')](_0x3930('0x19'),_0x239346);}};module['exports']=MailQueue; \ No newline at end of file +var _0x311f=['util','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','mailPause','available','loggedIn','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5'];(function(_0x1740a7,_0x56b1e6){var _0xeadac9=function(_0x50e268){while(--_0x50e268){_0x1740a7['push'](_0x1740a7['shift']());}};_0xeadac9(++_0x56b1e6);}(_0x311f,0x15d));var _0xf311=function(_0x205725,_0x582a1b){_0x205725=_0x205725-0x0;var _0x4c86ed=_0x311f[_0x205725];return _0x4c86ed;};'use strict';var _=require(_0xf311('0x0'));var md5=require(_0xf311('0x1'));var util=require(_0xf311('0x2'));var Redis=require('ioredis');var config=require(_0xf311('0x3'));config[_0xf311('0x4')]=_['defaults'](config[_0xf311('0x4')],{'host':_0xf311('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf311('0x4')]));function MailQueue(_0x5b6cce){this['id']=_0x5b6cce['id']||0x0;this[_0xf311('0x6')]=_0x5b6cce[_0xf311('0x6')]||'';this[_0xf311('0x7')]=_0x5b6cce['timeout']||0xa;this[_0xf311('0x8')]=_0x5b6cce[_0xf311('0x8')]||'beepall';this[_0xf311('0x9')]=_0x5b6cce['Agents'];this[_0xf311('0xa')]={};this[_0xf311('0xb')]=0x0;this['md5']='';this[_0xf311('0xc')]();this[_0xf311('0xd')]();}MailQueue[_0xf311('0xe')][_0xf311('0xc')]=function(){var _0x11e2bb=this['mapAgentsId'][_0xf311('0xf')];this[_0xf311('0xa')]=_[_0xf311('0x10')](this[_0xf311('0x9')],'id');this[_0xf311('0xa')]['_rr']=_0x11e2bb;};MailQueue[_0xf311('0xe')][_0xf311('0xd')]=function(){this['loggedIn']=0x0;this[_0xf311('0x11')]=0x0;for(var _0x1f3b18=0x0;_0x1f3b18=0x0?this[_0xf311('0x14')]:0x0;var _0x144cde={'id':this['id'],'available':this[_0xf311('0x14')],'loggedIn':this[_0xf311('0x15')],'name':this[_0xf311('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x486e59=md5(JSON[_0xf311('0x16')](_0x144cde));if(this[_0xf311('0x1')]!==_0x486e59){this['md5']=_0x486e59;io['to'](util[_0xf311('0x17')](_0xf311('0x18'),_0x144cde[_0xf311('0x6')]))['emit'](_0xf311('0x19'),_0x144cde);}};module[_0xf311('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 49e24b8..46cabc0 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x527697,_0x2fa399){var _0x2aae6e=function(_0xab865){while(--_0xab865){_0x527697['push'](_0x527697['shift']());}};_0x2aae6e(++_0x2fa399);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x5fc3[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x22f39d,_0x10c8b5){var _0x24d05f=function(_0x574505){while(--_0x574505){_0x22f39d['push'](_0x22f39d['shift']());}};_0x24d05f(++_0x10c8b5);}(_0x814b,0x1a2));var _0xb814=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x814b[_0x225f50];return _0x19d003;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3320a94..e04ee95 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 _0x2e35=['redis','defaults','socket.io-emitter','name','strategy','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','map','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','../../../config/environment'];(function(_0xa95459,_0x3880ac){var _0x1db4f0=function(_0x228568){while(--_0x228568){_0xa95459['push'](_0xa95459['shift']());}};_0x1db4f0(++_0x3880ac);}(_0x2e35,0x1d0));var _0x52e3=function(_0xc541f7,_0x233f57){_0xc541f7=_0xc541f7-0x0;var _0x18b577=_0x2e35[_0xc541f7];return _0x18b577;};'use strict';var _=require(_0x52e3('0x0'));var md5=require(_0x52e3('0x1'));var util=require(_0x52e3('0x2'));var Redis=require('ioredis');var config=require(_0x52e3('0x3'));config[_0x52e3('0x4')]=_[_0x52e3('0x5')](config[_0x52e3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x52e3('0x6'))(new Redis(config[_0x52e3('0x4')]));function SmsQueue(_0x1f6987){this['id']=_0x1f6987['id']||0x0;this[_0x52e3('0x7')]=_0x1f6987['name']||'';this['timeout']=_0x1f6987['timeout']||0xa;this[_0x52e3('0x8')]=_0x1f6987['strategy']||'beepall';this[_0x52e3('0x9')]=_0x1f6987[_0x52e3('0x9')];this['mapAgentsId']={};this[_0x52e3('0xa')]=0x0;this[_0x52e3('0x1')]='';this['updateRouting']();this[_0x52e3('0xb')]();}SmsQueue['prototype'][_0x52e3('0xc')]=function(){var _0x10f70f=this[_0x52e3('0xd')]['_rr'];this[_0x52e3('0xd')]=_[_0x52e3('0xe')](this['Agents'],'id');this[_0x52e3('0xd')]['_rr']=_0x10f70f;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x105c80=0x0;_0x105c80=0x0?this['available']:0x0;var _0x3088a2={'id':this['id'],'available':this[_0x52e3('0x14')],'loggedIn':this[_0x52e3('0x11')],'name':this[_0x52e3('0x7')],'paused':this[_0x52e3('0x13')],'waiting':this[_0x52e3('0xa')]};var _0x3f628a=md5(JSON[_0x52e3('0x15')](_0x3088a2));if(this[_0x52e3('0x1')]!==_0x3f628a){this[_0x52e3('0x1')]=_0x3f628a;io['to'](util[_0x52e3('0x16')](_0x52e3('0x17'),_0x3088a2[_0x52e3('0x7')]))[_0x52e3('0x18')](_0x52e3('0x19'),_0x3088a2);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xd4b6=['loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x771573,_0x1c737d){var _0x996804=function(_0x467207){while(--_0x467207){_0x771573['push'](_0x771573['shift']());}};_0x996804(++_0x1c737d);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x18ef7f,_0x238c09){_0x18ef7f=_0x18ef7f-0x0;var _0x2b0853=_0xd4b6[_0x18ef7f];return _0x2b0853;};'use strict';var _=require(_0x6d4b('0x0'));var md5=require(_0x6d4b('0x1'));var util=require('util');var Redis=require(_0x6d4b('0x2'));var config=require(_0x6d4b('0x3'));config['redis']=_[_0x6d4b('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d4b('0x5')]));function SmsQueue(_0x1e1826){this['id']=_0x1e1826['id']||0x0;this[_0x6d4b('0x6')]=_0x1e1826['name']||'';this[_0x6d4b('0x7')]=_0x1e1826[_0x6d4b('0x7')]||0xa;this[_0x6d4b('0x8')]=_0x1e1826[_0x6d4b('0x8')]||'beepall';this[_0x6d4b('0x9')]=_0x1e1826[_0x6d4b('0x9')];this[_0x6d4b('0xa')]={};this[_0x6d4b('0xb')]=0x0;this['md5']='';this[_0x6d4b('0xc')]();this[_0x6d4b('0xd')]();}SmsQueue[_0x6d4b('0xe')][_0x6d4b('0xc')]=function(){var _0x401e05=this[_0x6d4b('0xa')][_0x6d4b('0xf')];this['mapAgentsId']=_[_0x6d4b('0x10')](this[_0x6d4b('0x9')],'id');this[_0x6d4b('0xa')]['_rr']=_0x401e05;};SmsQueue[_0x6d4b('0xe')][_0x6d4b('0xd')]=function(){this[_0x6d4b('0x11')]=0x0;this[_0x6d4b('0x12')]=0x0;for(var _0x296cc2=0x0;_0x296cc2=0x0?this[_0x6d4b('0x16')]:0x0;var _0x318b0f={'id':this['id'],'available':this[_0x6d4b('0x16')],'loggedIn':this[_0x6d4b('0x11')],'name':this[_0x6d4b('0x6')],'paused':this[_0x6d4b('0x12')],'waiting':this[_0x6d4b('0xb')]};var _0x31cc24=md5(JSON[_0x6d4b('0x17')](_0x318b0f));if(this['md5']!==_0x31cc24){this['md5']=_0x31cc24;io['to'](util[_0x6d4b('0x18')](_0x6d4b('0x19'),_0x318b0f[_0x6d4b('0x6')]))['emit'](_0x6d4b('0x1a'),_0x318b0f);}};module[_0x6d4b('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0cc39e6..2c71f66 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 _0x0fb2=['updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','whatsappPause','available','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x1fe530,_0x38eb95){var _0x64a74b=function(_0x6f001c){while(--_0x6f001c){_0x1fe530['push'](_0x1fe530['shift']());}};_0x64a74b(++_0x38eb95);}(_0x0fb2,0xe8));var _0x20fb=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x0fb2[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x20fb('0x0'));var md5=require(_0x20fb('0x1'));var util=require(_0x20fb('0x2'));var Redis=require(_0x20fb('0x3'));var config=require(_0x20fb('0x4'));config[_0x20fb('0x5')]=_[_0x20fb('0x6')](config[_0x20fb('0x5')],{'host':_0x20fb('0x7'),'port':0x18eb});var io=require(_0x20fb('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x421b2f){this['id']=_0x421b2f['id']||0x0;this['name']=_0x421b2f[_0x20fb('0x9')]||'';this[_0x20fb('0xa')]=_0x421b2f[_0x20fb('0xa')]||0xa;this[_0x20fb('0xb')]=_0x421b2f[_0x20fb('0xb')]||_0x20fb('0xc');this[_0x20fb('0xd')]=_0x421b2f[_0x20fb('0xd')];this[_0x20fb('0xe')]={};this[_0x20fb('0xf')]=0x0;this[_0x20fb('0x1')]='';this[_0x20fb('0x10')]();this[_0x20fb('0x11')]();}WhatsappQueue[_0x20fb('0x12')][_0x20fb('0x10')]=function(){var _0x58c3de=this[_0x20fb('0xe')][_0x20fb('0x13')];this[_0x20fb('0xe')]=_[_0x20fb('0x14')](this['Agents'],'id');this['mapAgentsId'][_0x20fb('0x13')]=_0x58c3de;};WhatsappQueue['prototype'][_0x20fb('0x11')]=function(){this['loggedIn']=0x0;this[_0x20fb('0x15')]=0x0;for(var _0x443432=0x0;_0x443432=0x0?this[_0x20fb('0x1a')]:0x0;var _0x478ad0={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x20fb('0x9')],'paused':this['paused'],'waiting':this[_0x20fb('0xf')]};var _0x56ca49=md5(JSON[_0x20fb('0x1b')](_0x478ad0));if(this[_0x20fb('0x1')]!==_0x56ca49){this[_0x20fb('0x1')]=_0x56ca49;io['to'](util['format']('whatsapp:queue:%s',_0x478ad0[_0x20fb('0x9')]))[_0x20fb('0x1c')](_0x20fb('0x1d'),_0x478ad0);}};module[_0x20fb('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xb907=['util','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','whatsappPause','available','waiting','format','whatsapp_queue:save','exports','lodash','md5'];(function(_0x27112d,_0x5cbc56){var _0x33ec4c=function(_0x4421a9){while(--_0x4421a9){_0x27112d['push'](_0x27112d['shift']());}};_0x33ec4c(++_0x5cbc56);}(_0xb907,0x136));var _0x7b90=function(_0x3bd499,_0x1d0749){_0x3bd499=_0x3bd499-0x0;var _0x4dfe9c=_0xb907[_0x3bd499];return _0x4dfe9c;};'use strict';var _=require(_0x7b90('0x0'));var md5=require(_0x7b90('0x1'));var util=require(_0x7b90('0x2'));var Redis=require(_0x7b90('0x3'));var config=require('../../../config/environment');config[_0x7b90('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7b90('0x5'))(new Redis(config[_0x7b90('0x4')]));function WhatsappQueue(_0x36b0b6){this['id']=_0x36b0b6['id']||0x0;this[_0x7b90('0x6')]=_0x36b0b6[_0x7b90('0x6')]||'';this[_0x7b90('0x7')]=_0x36b0b6[_0x7b90('0x7')]||0xa;this[_0x7b90('0x8')]=_0x36b0b6['strategy']||_0x7b90('0x9');this[_0x7b90('0xa')]=_0x36b0b6['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7b90('0x1')]='';this['updateRouting']();this[_0x7b90('0xb')]();}WhatsappQueue['prototype'][_0x7b90('0xc')]=function(){var _0x41cc92=this[_0x7b90('0xd')][_0x7b90('0xe')];this[_0x7b90('0xd')]=_[_0x7b90('0xf')](this['Agents'],'id');this[_0x7b90('0xd')][_0x7b90('0xe')]=_0x41cc92;};WhatsappQueue[_0x7b90('0x10')][_0x7b90('0xb')]=function(){this[_0x7b90('0x11')]=0x0;this[_0x7b90('0x12')]=0x0;for(var _0x166d20=0x0;_0x166d20=0x0?this[_0x7b90('0x15')]:0x0;var _0xeb6683={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7b90('0x11')],'name':this[_0x7b90('0x6')],'paused':this['paused'],'waiting':this[_0x7b90('0x16')]};var _0x19386f=md5(JSON['stringify'](_0xeb6683));if(this[_0x7b90('0x1')]!==_0x19386f){this['md5']=_0x19386f;io['to'](util[_0x7b90('0x17')]('whatsapp:queue:%s',_0xeb6683[_0x7b90('0x6')]))['emit'](_0x7b90('0x18'),_0xeb6683);}};module[_0x7b90('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e0075e1..7c0d152 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(_0x2b2095,_0x15446b){var _0x28e6f4=function(_0xf82f40){while(--_0xf82f40){_0x2b2095['push'](_0x2b2095['shift']());}};_0x28e6f4(++_0x15446b);}(_0xb10b,0x12a));var _0xbb10=function(_0x477b8a,_0x2a198d){_0x477b8a=_0x477b8a-0x0;var _0x4183f9=_0xb10b[_0x477b8a];return _0x4183f9;};'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 _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(_0x58820d,_0x387ce2){var _0x3b902c=function(_0x221b0d){while(--_0x221b0d){_0x58820d['push'](_0x58820d['shift']());}};_0x3b902c(++_0x387ce2);}(_0xb10b,0x12a));var _0xbb10=function(_0x104662,_0x53a7a7){_0x104662=_0x104662-0x0;var _0x19cba7=_0xb10b[_0x104662];return _0x19cba7;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index afbe362..1aa5a03 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 _0xedcc=['addTagsToChatInteraction','update','Request','AddTagsToChatInteraction'];(function(_0x58b9e1,_0x30b306){var _0x1991cc=function(_0x390abe){while(--_0x390abe){_0x58b9e1['push'](_0x58b9e1['shift']());}};_0x1991cc(++_0x30b306);}(_0xedcc,0x105));var _0xcedc=function(_0x321ddd,_0x225a7d){_0x321ddd=_0x321ddd-0x0;var _0x1a53cf=_0xedcc[_0x321ddd];return _0x1a53cf;};'use strict';var client=require('../client');exports[_0xcedc('0x0')]=function(_0x2f3ac9,_0x270469){return client[_0xcedc('0x1')]('UpdateChatInteraction',{'body':_0x270469,'options':{'where':{'id':_0x2f3ac9}},'log':'updateChatInteraction'});};exports['addTags']=function(_0xcf4e05,_0x5e553e){return client['Request'](_0xcedc('0x2'),{'body':_0x5e553e,'options':{'where':{'id':_0xcf4e05}},'log':_0xcedc('0x3')});}; \ No newline at end of file +var _0x719b=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0x591a23,_0x259170){var _0x41d98a=function(_0x1b1810){while(--_0x1b1810){_0x591a23['push'](_0x591a23['shift']());}};_0x41d98a(++_0x259170);}(_0x719b,0xf9));var _0xb719=function(_0x55380a,_0x536668){_0x55380a=_0x55380a-0x0;var _0x333037=_0x719b[_0x55380a];return _0x333037;};'use strict';var client=require(_0xb719('0x0'));exports[_0xb719('0x1')]=function(_0x154a19,_0xebdda4){return client['Request'](_0xb719('0x2'),{'body':_0xebdda4,'options':{'where':{'id':_0x154a19}},'log':_0xb719('0x3')});};exports[_0xb719('0x4')]=function(_0x1d6b93,_0x1e6ef7){return client[_0xb719('0x5')](_0xb719('0x6'),{'body':_0x1e6ef7,'options':{'where':{'id':_0x1d6b93}},'log':_0xb719('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1445682..095505b 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 _0x254b=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0x254b,0xfd));var _0xb254=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x254b[_0x18cac4];return _0x2227c6;};'use strict';var client=require(_0xb254('0x0'));exports[_0xb254('0x1')]=function(_0xe9f3a5){return client[_0xb254('0x2')](_0xb254('0x3'),{'body':_0xe9f3a5,'log':_0xb254('0x4')});}; \ No newline at end of file +var _0x35cf=['createChatMessage','../client','create','CreateChatMessage'];(function(_0x37fcf3,_0x3cf1e5){var _0x1e1545=function(_0x5aff14){while(--_0x5aff14){_0x37fcf3['push'](_0x37fcf3['shift']());}};_0x1e1545(++_0x3cf1e5);}(_0x35cf,0x1b1));var _0xf35c=function(_0x35b99b,_0x2efd45){_0x35b99b=_0x35b99b-0x0;var _0xc34057=_0x35cf[_0x35b99b];return _0xc34057;};'use strict';var client=require(_0xf35c('0x0'));exports[_0xf35c('0x1')]=function(_0x8236c8){return client['Request'](_0xf35c('0x2'),{'body':_0x8236c8,'log':_0xf35c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 7715574..352c011 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 _0x99fb=['chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','Agents'];(function(_0x2d1971,_0x20b764){var _0x4d7759=function(_0x56a550){while(--_0x56a550){_0x2d1971['push'](_0x2d1971['shift']());}};_0x4d7759(++_0x20b764);}(_0x99fb,0x92));var _0xb99f=function(_0x49864e,_0x42d273){_0x49864e=_0x49864e-0x0;var _0x4daf4e=_0x99fb[_0x49864e];return _0x4daf4e;};'use strict';var client=require(_0xb99f('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xb99f('0x1')](_0xb99f('0x2'),{'options':{'raw':![],'attributes':['id',_0xb99f('0x3'),_0xb99f('0x4'),_0xb99f('0x5')],'include':[{'model':'User','as':_0xb99f('0x6'),'attributes':['id',_0xb99f('0x3'),'online',_0xb99f('0x7')]}]},'log':_0xb99f('0x8')});};}; \ No newline at end of file +var _0xe799=['timeout','User','Agents','chatPause','../client','Request','name'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe799,0x170));var _0x9e79=function(_0x243185,_0x4576da){_0x243185=_0x243185-0x0;var _0xdfb1c8=_0xe799[_0x243185];return _0xdfb1c8;};'use strict';var client=require(_0x9e79('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x9e79('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x9e79('0x2'),_0x9e79('0x3'),'strategy'],'include':[{'model':_0x9e79('0x4'),'as':_0x9e79('0x5'),'attributes':['id',_0x9e79('0x2'),'online',_0x9e79('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 35e3824..99caee2 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 _0xd816=['UpdateChatQueueReport','../client','create','Request'];(function(_0x7e7d0f,_0x420259){var _0x4e4935=function(_0x50f9a2){while(--_0x50f9a2){_0x7e7d0f['push'](_0x7e7d0f['shift']());}};_0x4e4935(++_0x420259);}(_0xd816,0xd5));var _0x6d81=function(_0x3d2997,_0x3cc053){_0x3d2997=_0x3d2997-0x0;var _0x1eed96=_0xd816[_0x3d2997];return _0x1eed96;};'use strict';var client=require(_0x6d81('0x0'));exports[_0x6d81('0x1')]=function(_0x5449cb){return client[_0x6d81('0x2')]('CreateChatQueueReport',{'body':_0x5449cb,'log':'CreateChatQueueReport'});};exports['update']=function(_0x2a4988,_0x39a52f){return client[_0x6d81('0x2')](_0x6d81('0x3'),{'body':_0x39a52f,'options':{'where':{'uniqueid':_0x2a4988},'order':[['id','DESC']],'limit':0x1},'log':_0x6d81('0x3')});}; \ No newline at end of file +var _0xe14d=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x49f1ee,_0xb7693f){var _0x4070a4=function(_0x44bd7b){while(--_0x44bd7b){_0x49f1ee['push'](_0x49f1ee['shift']());}};_0x4070a4(++_0xb7693f);}(_0xe14d,0x1ee));var _0xde14=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xe14d[_0x1ddedd];return _0xa3e1ac;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return client[_0xde14('0x2')]('CreateChatQueueReport',{'body':_0x1b5d3b,'log':_0xde14('0x3')});};exports[_0xde14('0x4')]=function(_0x4b20e2,_0x1c3e94){return client[_0xde14('0x2')](_0xde14('0x5'),{'body':_0x1c3e94,'options':{'where':{'uniqueid':_0x4b20e2},'order':[['id',_0xde14('0x6')]],'limit':0x1},'log':_0xde14('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index d84d43c..956bbd0 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(_0x268202,_0x4ff2ff){var _0x1847aa=function(_0x23ac03){while(--_0x23ac03){_0x268202['push'](_0x268202['shift']());}};_0x1847aa(++_0x4ff2ff);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_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(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x7a54,0x106));var _0x47a5=function(_0x4d2c1f,_0x16bdbd){_0x4d2c1f=_0x4d2c1f-0x0;var _0x4792e6=_0x7a54[_0x4d2c1f];return _0x4792e6;};'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 ebf12d6..0a10cfb 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 _0x918b=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x5695e5,_0x563dd9){var _0x190c97=function(_0x27a950){while(--_0x27a950){_0x5695e5['push'](_0x5695e5['shift']());}};_0x190c97(++_0x563dd9);}(_0x918b,0x7e));var _0xb918=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x918b[_0x1488cd];return _0x63fa13;};'use strict';var client=require('../client');exports[_0xb918('0x0')]=function(_0x57bd33){return client[_0xb918('0x1')](_0xb918('0x2'),{'body':_0x57bd33,'log':_0xb918('0x3')});}; \ No newline at end of file +var _0x2bd7=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x24e9e1,_0xa16bca){var _0xf0f144=function(_0x30c62c){while(--_0x30c62c){_0x24e9e1['push'](_0x24e9e1['shift']());}};_0xf0f144(++_0xa16bca);}(_0x2bd7,0x67));var _0x72bd=function(_0x1fa238,_0x396dab){_0x1fa238=_0x1fa238-0x0;var _0x6d54e5=_0x2bd7[_0x1fa238];return _0x6d54e5;};'use strict';var client=require(_0x72bd('0x0'));exports[_0x72bd('0x1')]=function(_0x55dcbf){return client[_0x72bd('0x2')](_0x72bd('0x3'),{'body':_0x55dcbf,'log':_0x72bd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2ee436c..a4009b5 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 _0x95b3=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','online'];(function(_0x361d06,_0x88eab2){var _0x14e7b2=function(_0x532899){while(--_0x532899){_0x361d06['push'](_0x361d06['shift']());}};_0x14e7b2(++_0x88eab2);}(_0x95b3,0x14b));var _0x395b=function(_0x28a9ec,_0x2f48c3){_0x28a9ec=_0x28a9ec-0x0;var _0x43358d=_0x95b3[_0x28a9ec];return _0x43358d;};'use strict';var client=require(_0x395b('0x0'));exports[_0x395b('0x1')]=function(){return function(){return client[_0x395b('0x2')](_0x395b('0x3'),{'options':{'raw':![],'attributes':['id',_0x395b('0x4'),_0x395b('0x5'),_0x395b('0x6')],'include':[{'model':_0x395b('0x7'),'as':'Agents','attributes':['id','name',_0x395b('0x8'),_0x395b('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xe606=['name','timeout','strategy','User','faxPause','../client','getFaxQueues'];(function(_0x54a10e,_0x53fbff){var _0x14cd42=function(_0x2a2f88){while(--_0x2a2f88){_0x54a10e['push'](_0x54a10e['shift']());}};_0x14cd42(++_0x53fbff);}(_0xe606,0xad));var _0x6e60=function(_0x5383f4,_0x11c58a){_0x5383f4=_0x5383f4-0x0;var _0xce8610=_0xe606[_0x5383f4];return _0xce8610;};'use strict';var client=require(_0x6e60('0x0'));exports[_0x6e60('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x6e60('0x2'),_0x6e60('0x3'),_0x6e60('0x4')],'include':[{'model':_0x6e60('0x5'),'as':'Agents','attributes':['id',_0x6e60('0x2'),'online',_0x6e60('0x6')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index eb90b05..547b841 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 _0x822a=['DESC','../client','create','Request','UpdateFaxQueueReport'];(function(_0x16f6fe,_0x762b3c){var _0x16c0cd=function(_0xc27afa){while(--_0xc27afa){_0x16f6fe['push'](_0x16f6fe['shift']());}};_0x16c0cd(++_0x762b3c);}(_0x822a,0xa1));var _0xa822=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x822a[_0x3a7257];return _0x467d25;};'use strict';var client=require(_0xa822('0x0'));exports[_0xa822('0x1')]=function(_0x4178cf){return client['Request']('CreateFaxQueueReport',{'body':_0x4178cf,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x1fe064,_0x11b6cb){return client[_0xa822('0x2')](_0xa822('0x3'),{'body':_0x11b6cb,'options':{'where':{'uniqueid':_0x1fe064},'order':[['id',_0xa822('0x4')]],'limit':0x1},'log':_0xa822('0x3')});}; \ No newline at end of file +var _0x0b6d=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x45366c,_0x2faa4e){var _0x5375a1=function(_0xeb3b31){while(--_0xeb3b31){_0x45366c['push'](_0x45366c['shift']());}};_0x5375a1(++_0x2faa4e);}(_0x0b6d,0x12c));var _0xd0b6=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x0b6d[_0x20589d];return _0x422de9;};'use strict';var client=require('../client');exports[_0xd0b6('0x0')]=function(_0x2481cc){return client[_0xd0b6('0x1')](_0xd0b6('0x2'),{'body':_0x2481cc,'log':'CreateFaxQueueReport'});};exports[_0xd0b6('0x3')]=function(_0x38a7e6,_0x1b919a){return client[_0xd0b6('0x1')](_0xd0b6('0x4'),{'body':_0x1b919a,'options':{'where':{'uniqueid':_0x38a7e6},'order':[['id',_0xd0b6('0x5')]],'limit':0x1},'log':_0xd0b6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index bd85d09..feebb66 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 _0x47a1=['name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x5a75ca,_0x2d8f77){var _0x590a69=function(_0x1208b3){while(--_0x1208b3){_0x5a75ca['push'](_0x5a75ca['shift']());}};_0x590a69(++_0x2d8f77);}(_0x47a1,0x1d2));var _0x147a=function(_0x5e470a,_0x11e51c){_0x5e470a=_0x5e470a-0x0;var _0x4a9d0f=_0x47a1[_0x5e470a];return _0x4a9d0f;};'use strict';var client=require(_0x147a('0x0'));exports[_0x147a('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x147a('0x2')],'include':[{'model':_0x147a('0x3'),'as':_0x147a('0x4'),'attributes':['id','name',_0x147a('0x5')]}]},'log':_0x147a('0x1')});};}; \ No newline at end of file +var _0x2729=['Request','name','Interval','interval','getIntervals'];(function(_0x5b5b47,_0x4705bd){var _0x15bb96=function(_0x5b7a12){while(--_0x5b7a12){_0x5b5b47['push'](_0x5b5b47['shift']());}};_0x15bb96(++_0x4705bd);}(_0x2729,0x18b));var _0x9272=function(_0xe61919,_0xbb3d51){_0xe61919=_0xe61919-0x0;var _0x1374ab=_0x2729[_0xe61919];return _0x1374ab;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x9272('0x0')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9272('0x1')],'include':[{'model':_0x9272('0x2'),'as':'Intervals','attributes':['id',_0x9272('0x1'),_0x9272('0x3')]}]},'log':_0x9272('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a767802..c2b148d 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 _0x7d25=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7d25,0x8a));var _0x57d2=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7d25[_0x46d0c9];return _0x174506;};'use strict';var client=require('../client');exports[_0x57d2('0x0')]=function(_0x1537a7,_0x35bca8){return client[_0x57d2('0x1')](_0x57d2('0x2'),{'body':_0x35bca8,'options':{'where':{'id':_0x1537a7}},'log':_0x57d2('0x3')});};exports[_0x57d2('0x4')]=function(_0x5c1baa,_0x5337ca){return client['Request']('AddTagsToMailInteraction',{'body':_0x5337ca,'options':{'where':{'id':_0x5c1baa}},'log':_0x57d2('0x5')});}; \ No newline at end of file +var _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x409106,_0x22e9a0){var _0x62019b=function(_0x582747){while(--_0x582747){_0x409106['push'](_0x409106['shift']());}};_0x62019b(++_0x22e9a0);}(_0x77e6,0x1a6));var _0x677e=function(_0x31d84e,_0x2a59e9){_0x31d84e=_0x31d84e-0x0;var _0x59b809=_0x77e6[_0x31d84e];return _0x59b809;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e274f94..1d65a78 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 _0xab47=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0x210b93,_0x133e6d){var _0x2b020f=function(_0x3f9601){while(--_0x3f9601){_0x210b93['push'](_0x210b93['shift']());}};_0x2b020f(++_0x133e6d);}(_0xab47,0xba));var _0x7ab4=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xab47[_0x40dd56];return _0x4f850f;};'use strict';var client=require(_0x7ab4('0x0'));exports['create']=function(_0x285e6a){return client[_0x7ab4('0x1')](_0x7ab4('0x2'),{'body':_0x285e6a,'log':_0x7ab4('0x3')});}; \ No newline at end of file +var _0xf1ae=['CreateMailMessage','createMailMessage','create'];(function(_0x16b982,_0x4f9ff3){var _0x55ad3e=function(_0x428097){while(--_0x428097){_0x16b982['push'](_0x16b982['shift']());}};_0x55ad3e(++_0x4f9ff3);}(_0xf1ae,0xf8));var _0xef1a=function(_0x1b0910,_0x358e84){_0x1b0910=_0x1b0910-0x0;var _0x25aa05=_0xf1ae[_0x1b0910];return _0x25aa05;};'use strict';var client=require('../client');exports[_0xef1a('0x0')]=function(_0x5ab5f7){return client['Request'](_0xef1a('0x1'),{'body':_0x5ab5f7,'log':_0xef1a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 97e0d68..5b9a95b 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 _0x4844=['Agents','name','online','../client','Request','GetMailQueue','timeout','strategy','User'];(function(_0x78b541,_0x222e1a){var _0x1243bb=function(_0x404373){while(--_0x404373){_0x78b541['push'](_0x78b541['shift']());}};_0x1243bb(++_0x222e1a);}(_0x4844,0x1f2));var _0x4484=function(_0x4b2f8a,_0x25c50b){_0x4b2f8a=_0x4b2f8a-0x0;var _0x5bc064=_0x4844[_0x4b2f8a];return _0x5bc064;};'use strict';var client=require(_0x4484('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x4484('0x1')](_0x4484('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4484('0x3'),_0x4484('0x4')],'include':[{'model':_0x4484('0x5'),'as':_0x4484('0x6'),'attributes':['id',_0x4484('0x7'),_0x4484('0x8'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x3089=['name','User','online','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x3089,0x19c));var _0x9308=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x3089[_0x5b78e8];return _0xf2c321;};'use strict';var client=require(_0x9308('0x0'));exports[_0x9308('0x1')]=function(){return function(){return client[_0x9308('0x2')](_0x9308('0x3'),{'options':{'raw':![],'attributes':['id',_0x9308('0x4'),'timeout','strategy'],'include':[{'model':_0x9308('0x5'),'as':'Agents','attributes':['id','name',_0x9308('0x6'),_0x9308('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 32160bd..0f6ce4e 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 _0x0b9b=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x288d33,_0x58ee36){var _0x1033bd=function(_0x2e22f1){while(--_0x2e22f1){_0x288d33['push'](_0x288d33['shift']());}};_0x1033bd(++_0x58ee36);}(_0x0b9b,0x83));var _0xb0b9=function(_0x113338,_0x4b6d97){_0x113338=_0x113338-0x0;var _0x380ef3=_0x0b9b[_0x113338];return _0x380ef3;};'use strict';var client=require(_0xb0b9('0x0'));exports[_0xb0b9('0x1')]=function(_0x14a8ea){return client[_0xb0b9('0x2')]('CreateMailQueueReport',{'body':_0x14a8ea,'log':_0xb0b9('0x3')});};exports[_0xb0b9('0x4')]=function(_0x4127ce,_0x34422e){return client[_0xb0b9('0x2')](_0xb0b9('0x5'),{'body':_0x34422e,'options':{'where':{'uniqueid':_0x4127ce},'order':[['id',_0xb0b9('0x6')]],'limit':0x1},'log':_0xb0b9('0x5')});}; \ No newline at end of file +var _0xc901=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0x473b41,_0x1c320f){var _0x4e521d=function(_0x19a745){while(--_0x19a745){_0x473b41['push'](_0x473b41['shift']());}};_0x4e521d(++_0x1c320f);}(_0xc901,0x10a));var _0x1c90=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc901[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0x1c90('0x0')]=function(_0xd7ad1f){return client[_0x1c90('0x1')](_0x1c90('0x2'),{'body':_0xd7ad1f,'log':_0x1c90('0x2')});};exports[_0x1c90('0x3')]=function(_0x29cd29,_0x586c79){return client[_0x1c90('0x1')](_0x1c90('0x4'),{'body':_0x586c79,'options':{'where':{'uniqueid':_0x29cd29},'order':[['id',_0x1c90('0x5')]],'limit':0x1},'log':_0x1c90('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c79b6e9..6c43d6b 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 _0xca75=['Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x28ef66,_0x698e26){var _0x2bc9f5=function(_0x52f878){while(--_0x52f878){_0x28ef66['push'](_0x28ef66['shift']());}};_0x2bc9f5(++_0x698e26);}(_0xca75,0xbd));var _0x5ca7=function(_0x76d2ec,_0x45ea7c){_0x76d2ec=_0x76d2ec-0x0;var _0x540bdc=_0xca75[_0x76d2ec];return _0x540bdc;};'use strict';var client=require(_0x5ca7('0x0'));exports['update']=function(_0x531124,_0x5b3771){return client[_0x5ca7('0x1')]('UpdateOpenchannelInteraction',{'body':_0x5b3771,'options':{'where':{'id':_0x531124}},'log':_0x5ca7('0x2')});};exports['addTags']=function(_0x5c8fa5,_0x276211){return client[_0x5ca7('0x1')](_0x5ca7('0x3'),{'body':_0x276211,'options':{'where':{'id':_0x5c8fa5}},'log':_0x5ca7('0x4')});}; \ No newline at end of file +var _0xa974=['addTags','AddTagsToOpenchannelInteraction','../client','Request','UpdateOpenchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa974,0x1ab));var _0x4a97=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xa974[_0x1db251];return _0x56685a;};'use strict';var client=require(_0x4a97('0x0'));exports['update']=function(_0x58bd57,_0x16b682){return client[_0x4a97('0x1')](_0x4a97('0x2'),{'body':_0x16b682,'options':{'where':{'id':_0x58bd57}},'log':'updateOpenchannelInteraction'});};exports[_0x4a97('0x3')]=function(_0x2ad149,_0x416c10){return client[_0x4a97('0x1')](_0x4a97('0x4'),{'body':_0x416c10,'options':{'where':{'id':_0x2ad149}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e676eae..1faa68a 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 _0x5f2e=['Request','CreateOpenchannelMessage','../client','create'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x5f2e,0x1ba));var _0xe5f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f2e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xe5f2('0x0'));exports[_0xe5f2('0x1')]=function(_0x23f942){return client[_0xe5f2('0x2')](_0xe5f2('0x3'),{'body':_0x23f942,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x0560=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x15f9d9,_0x1602cc){var _0x1514b7=function(_0x2f5c4c){while(--_0x2f5c4c){_0x15f9d9['push'](_0x15f9d9['shift']());}};_0x1514b7(++_0x1602cc);}(_0x0560,0x6b));var _0x0056=function(_0x37ba70,_0x550cea){_0x37ba70=_0x37ba70-0x0;var _0xabaef8=_0x0560[_0x37ba70];return _0xabaef8;};'use strict';var client=require(_0x0056('0x0'));exports[_0x0056('0x1')]=function(_0x3ec2e6){return client[_0x0056('0x2')](_0x0056('0x3'),{'body':_0x3ec2e6,'log':_0x0056('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 96e54d4..133b2a1 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 _0x32ee=['getOpenchannelQueues','Request','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x28bde5,_0x4c9bf4){var _0x4ea8a9=function(_0x191945){while(--_0x191945){_0x28bde5['push'](_0x28bde5['shift']());}};_0x4ea8a9(++_0x4c9bf4);}(_0x32ee,0x10e));var _0xe32e=function(_0x29e0b2,_0x281eb9){_0x29e0b2=_0x29e0b2-0x0;var _0x3e0ef7=_0x32ee[_0x29e0b2];return _0x3e0ef7;};'use strict';var client=require('../client');exports[_0xe32e('0x0')]=function(){return function(){return client[_0xe32e('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xe32e('0x2'),_0xe32e('0x3'),_0xe32e('0x4')],'include':[{'model':_0xe32e('0x5'),'as':_0xe32e('0x6'),'attributes':['id',_0xe32e('0x2'),_0xe32e('0x7'),_0xe32e('0x8')]}]},'log':_0xe32e('0x0')});};}; \ No newline at end of file +var _0x49aa=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents'];(function(_0x180cac,_0x4f9042){var _0x3542e0=function(_0x5a0c9c){while(--_0x5a0c9c){_0x180cac['push'](_0x180cac['shift']());}};_0x3542e0(++_0x4f9042);}(_0x49aa,0x66));var _0xa49a=function(_0x461c67,_0x546a13){_0x461c67=_0x461c67-0x0;var _0x2bbac3=_0x49aa[_0x461c67];return _0x2bbac3;};'use strict';var client=require(_0xa49a('0x0'));exports[_0xa49a('0x1')]=function(){return function(){return client[_0xa49a('0x2')](_0xa49a('0x3'),{'options':{'raw':![],'attributes':['id',_0xa49a('0x4'),_0xa49a('0x5'),'strategy'],'include':[{'model':_0xa49a('0x6'),'as':_0xa49a('0x7'),'attributes':['id',_0xa49a('0x4'),_0xa49a('0x8'),_0xa49a('0x9')]}]},'log':_0xa49a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ea6e105..0a4cbbd 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 _0x458d=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x3b584b,_0x39dc34){var _0x38559d=function(_0x2cbf9e){while(--_0x2cbf9e){_0x3b584b['push'](_0x3b584b['shift']());}};_0x38559d(++_0x39dc34);}(_0x458d,0xe2));var _0xd458=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x458d[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0xd458('0x0'));exports[_0xd458('0x1')]=function(_0x33a9e1){return client[_0xd458('0x2')](_0xd458('0x3'),{'body':_0x33a9e1,'log':'CreateOpenchannelQueueReport'});};exports[_0xd458('0x4')]=function(_0x3966e3,_0x138bd8){return client[_0xd458('0x2')](_0xd458('0x5'),{'body':_0x138bd8,'options':{'where':{'uniqueid':_0x3966e3},'order':[['id',_0xd458('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xb12d=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x339fe3,_0x4a0207){var _0x112247=function(_0xc5a984){while(--_0xc5a984){_0x339fe3['push'](_0x339fe3['shift']());}};_0x112247(++_0x4a0207);}(_0xb12d,0x124));var _0xdb12=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xb12d[_0x242a4f];return _0x122117;};'use strict';var client=require(_0xdb12('0x0'));exports[_0xdb12('0x1')]=function(_0x6a951d){return client['Request'](_0xdb12('0x2'),{'body':_0x6a951d,'log':'CreateOpenchannelQueueReport'});};exports[_0xdb12('0x3')]=function(_0x621a14,_0x19ee68){return client[_0xdb12('0x4')](_0xdb12('0x5'),{'body':_0x19ee68,'options':{'where':{'uniqueid':_0x621a14},'order':[['id',_0xdb12('0x6')]],'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 dd0ba69..1efc84d 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 _0x6898=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x203970,_0x2f0f2c){var _0x3c86f8=function(_0x1f0f46){while(--_0x1f0f46){_0x203970['push'](_0x203970['shift']());}};_0x3c86f8(++_0x2f0f2c);}(_0x6898,0x11b));var _0x8689=function(_0x32c9d4,_0x4daf5c){_0x32c9d4=_0x32c9d4-0x0;var _0x4d7325=_0x6898[_0x32c9d4];return _0x4d7325;};'use strict';var client=require(_0x8689('0x0'));exports['update']=function(_0x3b6c93,_0x15c5c2){return client[_0x8689('0x1')](_0x8689('0x2'),{'body':_0x15c5c2,'options':{'where':{'id':_0x3b6c93}},'log':_0x8689('0x3')});};exports[_0x8689('0x4')]=function(_0x524f81,_0x5038aa){return client[_0x8689('0x1')](_0x8689('0x5'),{'body':_0x5038aa,'options':{'where':{'id':_0x524f81}},'log':_0x8689('0x6')});}; \ No newline at end of file +var _0xac31=['Request','UpdateSmsInteraction','updateSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x3e8fde,_0xcaa508){var _0xc3e7ae=function(_0x36a18e){while(--_0x36a18e){_0x3e8fde['push'](_0x3e8fde['shift']());}};_0xc3e7ae(++_0xcaa508);}(_0xac31,0xca));var _0x1ac3=function(_0x2c11c1,_0x304272){_0x2c11c1=_0x2c11c1-0x0;var _0x54a282=_0xac31[_0x2c11c1];return _0x54a282;};'use strict';var client=require(_0x1ac3('0x0'));exports[_0x1ac3('0x1')]=function(_0x1cd966,_0x3086c0){return client[_0x1ac3('0x2')](_0x1ac3('0x3'),{'body':_0x3086c0,'options':{'where':{'id':_0x1cd966}},'log':_0x1ac3('0x4')});};exports['addTags']=function(_0x33b5ab,_0x434b5e){return client['Request']('AddTagsToSmsInteraction',{'body':_0x434b5e,'options':{'where':{'id':_0x33b5ab}},'log':_0x1ac3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ea1e8c0..13120ee 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 _0x4656=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x26de19,_0x226dff){var _0x4065ab=function(_0x5d9e51){while(--_0x5d9e51){_0x26de19['push'](_0x26de19['shift']());}};_0x4065ab(++_0x226dff);}(_0x4656,0xca));var _0x6465=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0x4656[_0x316904];return _0xfa9a21;};'use strict';var client=require(_0x6465('0x0'));exports[_0x6465('0x1')]=function(_0x143f65){return client[_0x6465('0x2')](_0x6465('0x3'),{'body':_0x143f65,'log':_0x6465('0x4')});}; \ No newline at end of file +var _0x10f7=['createSmsMessage','create'];(function(_0x42164,_0x44fff7){var _0x58b577=function(_0x3db9a8){while(--_0x3db9a8){_0x42164['push'](_0x42164['shift']());}};_0x58b577(++_0x44fff7);}(_0x10f7,0x177));var _0x710f=function(_0x2f19d1,_0x2867df){_0x2f19d1=_0x2f19d1-0x0;var _0x9fd241=_0x10f7[_0x2f19d1];return _0x9fd241;};'use strict';var client=require('../client');exports[_0x710f('0x0')]=function(_0x78e805){return client['Request']('CreateSmsMessage',{'body':_0x78e805,'log':_0x710f('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 16594b2..7a25bf3 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x5e72f5,_0x6d7fb0){var _0x12417f=function(_0x582eb1){while(--_0x582eb1){_0x5e72f5['push'](_0x5e72f5['shift']());}};_0x12417f(++_0x6d7fb0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x58fbb0,_0xe497b5){var _0x1783d2=function(_0x5554a8){while(--_0x5554a8){_0x58fbb0['push'](_0x58fbb0['shift']());}};_0x1783d2(++_0xe497b5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a6b2902..4acc49e 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x4760f7,_0x42f4dd){var _0x370a0e=function(_0x1f37ee){while(--_0x1f37ee){_0x4760f7['push'](_0x4760f7['shift']());}};_0x370a0e(++_0x42f4dd);}(_0x34e8,0x12c));var _0x834e=function(_0x3cd88f,_0x1c5ae2){_0x3cd88f=_0x3cd88f-0x0;var _0x380818=_0x34e8[_0x3cd88f];return _0x380818;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x37236d,_0x3e8445){var _0x5ea146=function(_0xb36353){while(--_0xb36353){_0x37236d['push'](_0x37236d['shift']());}};_0x5ea146(++_0x3e8445);}(_0x008c,0x188));var _0xc008=function(_0x35906a,_0x9e0b54){_0x35906a=_0x35906a-0x0;var _0x43ba69=_0x008c[_0x35906a];return _0x43ba69;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 99b571d..d8bbc0e 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(_0x20469b,_0x2e13f8){var _0x543f54=function(_0xe0dcf3){while(--_0xe0dcf3){_0x20469b['push'](_0x20469b['shift']());}};_0x543f54(++_0x2e13f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x509428,_0x30293b){var _0x1b33fd=function(_0xb6b265){while(--_0xb6b265){_0x509428['push'](_0x509428['shift']());}};_0x1b33fd(++_0x30293b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 92a2548..44a45cb 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 _0x7dee=['addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x424c67,_0x45e66c){var _0x5d2b4a=function(_0x1185f8){while(--_0x1185f8){_0x424c67['push'](_0x424c67['shift']());}};_0x5d2b4a(++_0x45e66c);}(_0x7dee,0xb0));var _0xe7de=function(_0x4a7c68,_0x19fc2d){_0x4a7c68=_0x4a7c68-0x0;var _0x3c9350=_0x7dee[_0x4a7c68];return _0x3c9350;};'use strict';var client=require(_0xe7de('0x0'));exports['update']=function(_0x339ee2,_0x51419e){return client[_0xe7de('0x1')](_0xe7de('0x2'),{'body':_0x51419e,'options':{'where':{'id':_0x339ee2}},'log':_0xe7de('0x3')});};exports[_0xe7de('0x4')]=function(_0x4b846b,_0x12be83){return client['Request'](_0xe7de('0x5'),{'body':_0x12be83,'options':{'where':{'id':_0x4b846b}},'log':_0xe7de('0x6')});}; \ No newline at end of file +var _0x8d0a=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0x8d0a,0x172));var _0xa8d0=function(_0x31d32a,_0x4821d2){_0x31d32a=_0x31d32a-0x0;var _0xddba68=_0x8d0a[_0x31d32a];return _0xddba68;};'use strict';var client=require(_0xa8d0('0x0'));exports[_0xa8d0('0x1')]=function(_0x42a78b,_0x51c455){return client[_0xa8d0('0x2')](_0xa8d0('0x3'),{'body':_0x51c455,'options':{'where':{'id':_0x42a78b}},'log':'updateWhatsappInteraction'});};exports[_0xa8d0('0x4')]=function(_0x3812b4,_0x33c4b1){return client['Request'](_0xa8d0('0x5'),{'body':_0x33c4b1,'options':{'where':{'id':_0x3812b4}},'log':_0xa8d0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 1dcea47..1079964 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 _0x090a=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x522079,_0x6fb5cb){var _0x57ac72=function(_0x4cbd65){while(--_0x4cbd65){_0x522079['push'](_0x522079['shift']());}};_0x57ac72(++_0x6fb5cb);}(_0x090a,0x7a));var _0xa090=function(_0x5a95e,_0x49cb4a){_0x5a95e=_0x5a95e-0x0;var _0x5beaa8=_0x090a[_0x5a95e];return _0x5beaa8;};'use strict';var client=require(_0xa090('0x0'));exports[_0xa090('0x1')]=function(_0x5c307b){return client[_0xa090('0x2')](_0xa090('0x3'),{'body':_0x5c307b,'log':_0xa090('0x4')});}; \ No newline at end of file +var _0xa72c=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa72c,0x1e4));var _0xca72=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xa72c[_0x95942];return _0x6d7f81;};'use strict';var client=require('../client');exports[_0xca72('0x0')]=function(_0xa862a9){return client[_0xca72('0x1')](_0xca72('0x2'),{'body':_0xa862a9,'log':_0xca72('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index df4a003..9ee1f3a 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 _0x53e7=['GetWhatsappQueue','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x53e7,0x11e));var _0x753e=function(_0xd83f3e,_0x3c909e){_0xd83f3e=_0xd83f3e-0x0;var _0x3afffc=_0x53e7[_0xd83f3e];return _0x3afffc;};'use strict';var client=require(_0x753e('0x0'));exports[_0x753e('0x1')]=function(){return function(){return client['Request'](_0x753e('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':'User','as':_0x753e('0x3'),'attributes':['id','name',_0x753e('0x4'),_0x753e('0x5')]}]},'log':_0x753e('0x1')});};}; \ No newline at end of file +var _0xb9c2=['../client','getWhatsappQueues','Request','name','timeout','strategy','Agents','online','whatsappPause'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb9c2,0xea));var _0x2b9c=function(_0x3c691c,_0x75c10a){_0x3c691c=_0x3c691c-0x0;var _0x5703a0=_0xb9c2[_0x3c691c];return _0x5703a0;};'use strict';var client=require(_0x2b9c('0x0'));exports[_0x2b9c('0x1')]=function(){return function(){return client[_0x2b9c('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x2b9c('0x3'),_0x2b9c('0x4'),_0x2b9c('0x5')],'include':[{'model':'User','as':_0x2b9c('0x6'),'attributes':['id',_0x2b9c('0x3'),_0x2b9c('0x7'),_0x2b9c('0x8')]}]},'log':_0x2b9c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 584420e..7671001 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 _0xeea9=['DESC','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0xfb8251,_0x22867e){var _0x2fcd5f=function(_0x2d47c0){while(--_0x2d47c0){_0xfb8251['push'](_0xfb8251['shift']());}};_0x2fcd5f(++_0x22867e);}(_0xeea9,0xd9));var _0x9eea=function(_0x470e45,_0x20b22f){_0x470e45=_0x470e45-0x0;var _0x91c965=_0xeea9[_0x470e45];return _0x91c965;};'use strict';var client=require('../client');exports[_0x9eea('0x0')]=function(_0x3a8801){return client['Request'](_0x9eea('0x1'),{'body':_0x3a8801,'log':_0x9eea('0x1')});};exports[_0x9eea('0x2')]=function(_0x17259b,_0x166c08){return client[_0x9eea('0x3')](_0x9eea('0x4'),{'body':_0x166c08,'options':{'where':{'uniqueid':_0x17259b},'order':[['id',_0x9eea('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x2963=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x2963,0x156));var _0x3296=function(_0x421ad5,_0x2ef149){_0x421ad5=_0x421ad5-0x0;var _0x59c66d=_0x2963[_0x421ad5];return _0x59c66d;};'use strict';var client=require(_0x3296('0x0'));exports[_0x3296('0x1')]=function(_0x24ed05){return client[_0x3296('0x2')](_0x3296('0x3'),{'body':_0x24ed05,'log':'CreateWhatsappQueueReport'});};exports[_0x3296('0x4')]=function(_0x450c0a,_0x241829){return client[_0x3296('0x2')](_0x3296('0x5'),{'body':_0x241829,'options':{'where':{'uniqueid':_0x450c0a},'order':[['id',_0x3296('0x6')]],'limit':0x1},'log':_0x3296('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 380a14d..ea6c00f 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 _0xc510=['join','find','agents','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','message'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc510,0x189));var _0x0c51=function(_0x10f277,_0x50b2e9){_0x10f277=_0x10f277-0x0;var _0x576403=_0xc510[_0x10f277];return _0x576403;};'use strict';var schema=require(_0x0c51('0x0'));var _=require(_0x0c51('0x1'));var util=require(_0x0c51('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x0c51('0x3'))(_0x0c51('0x4'));var strategy=require(_0x0c51('0x5'));var queue=schema({'name':{'type':_0x0c51('0x6'),'required':!![],'message':_0x0c51('0x7')},'timeout':{'type':_0x0c51('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5dbf10,_0x24a1bd,_0x213e78){return logger[_0x0c51('0x9')](util[_0x0c51('0xa')](_0x0c51('0xb'),_0x5dbf10,_0x24a1bd[_0x0c51('0xc')],_0x213e78));}function handleFindAgent(_0x54ad68){return function(_0x5cacd3){return _0x5cacd3[_0x0c51('0xc')]['toLowerCase']()===_0x54ad68[_0x0c51('0xd')]();};}exports['consequence']=function(_0x1007d4,_0x545e22,_0x796319,_0x1f6c09){return function(_0x24f0c4){try{var _0x4b2f8a={'name':_0x545e22[0x0],'timeout':_0x545e22[0x1]};var _0x39dffc=queue[_0x0c51('0x0')](_0x4b2f8a,{'typecast':!![]});if(_0x39dffc['length']){logger['error']('[%s][AGENT]\x20%s',_0x1007d4,_['map'](_0x39dffc,_0x0c51('0xe'))[_0x0c51('0xf')](',\x20'));_0x24f0c4['stop']();}else{var _0x257c4e=_[_0x0c51('0x10')](_0x796319[_0x0c51('0x11')],handleFindAgent(_0x4b2f8a['name']));if(_0x257c4e){var _0x4dcddf=(_0x4b2f8a['timeout']||0xa)*0x3e8;var _0x26a89a,_0x1b221a;var _0xc636e9=seqqueue['createQueue'](_0x4dcddf);_0xc636e9['id']=_0x1007d4;_0xc636e9[_0x0c51('0x12')]=_0x4dcddf;_0xc636e9[_0x0c51('0x13')]=_0x1f6c09[_0x0c51('0x13')];writeLog(_0x1007d4,_0x257c4e,util[_0x0c51('0xa')](_0x0c51('0x14'),_0x4dcddf));_0x796319['rules'][_0x1007d4]['on'](_0x0c51('0x15'),function(){logger[_0x0c51('0x9')](_0x0c51('0x16'),_0x1007d4);clearTimeout(_0x1b221a);_0x1b221a=undefined;_0xc636e9[_0x0c51('0x17')]();if(_0x796319['rules'][_0x1007d4]){delete _0x796319[_0x0c51('0x18')][_0x1007d4];}_0x24f0c4[_0x0c51('0x19')]();});_0x796319[_0x0c51('0x18')][_0x1007d4]['on'](_0x0c51('0x1a'),function(){if(_0x796319[_0x0c51('0x18')][_0x1007d4]){delete _0x796319['rules'][_0x1007d4];}});_0x1b221a=setTimeout(function(){logger[_0x0c51('0x9')](_0x0c51('0x1b'),_0x1007d4);clearTimeout(_0x1b221a);_0xc636e9[_0x0c51('0x17')]();_0x24f0c4[_0x0c51('0x1c')]();},_0x4dcddf);strategy[_0x0c51('0x1d')](_0xc636e9,_0x257c4e,_0x796319,_0x1f6c09);}else{logger[_0x0c51('0x1e')](_0x0c51('0x1f'),_0x1007d4,_0x4b2f8a['name']);_0x24f0c4['stop']();}}}catch(_0x1868dd){console[_0x0c51('0x20')](_0x1868dd);logger['error']('[%s][QUEUE]\x20%s',_0x1007d4,_0x1868dd[_0x0c51('0x21')]);_0x24f0c4[_0x0c51('0x19')]();}};}; \ No newline at end of file +var _0x2c01=['seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','error','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2c01,0x16a));var _0x12c0=function(_0x5d8b03,_0x352fb7){_0x5d8b03=_0x5d8b03-0x0;var _0x35c323=_0x2c01[_0x5d8b03];return _0x35c323;};'use strict';var schema=require('validate');var _=require(_0x12c0('0x0'));var util=require('util');var seqqueue=require(_0x12c0('0x1'));var logger=require(_0x12c0('0x2'))(_0x12c0('0x3'));var strategy=require(_0x12c0('0x4'));var queue=schema({'name':{'type':_0x12c0('0x5'),'required':!![],'message':_0x12c0('0x6')},'timeout':{'type':_0x12c0('0x7'),'message':_0x12c0('0x8')}});function writeLog(_0x4c8428,_0x23802d,_0x525f9e){return logger[_0x12c0('0x9')](util[_0x12c0('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4c8428,_0x23802d[_0x12c0('0xb')],_0x525f9e));}function handleFindAgent(_0x3a49e9){return function(_0x336d23){return _0x336d23['name'][_0x12c0('0xc')]()===_0x3a49e9[_0x12c0('0xc')]();};}exports['consequence']=function(_0x3bdb88,_0x16832b,_0x5805d3,_0x20da65){return function(_0x7cc7ca){try{var _0xe76bf1={'name':_0x16832b[0x0],'timeout':_0x16832b[0x1]};var _0x1411ad=queue['validate'](_0xe76bf1,{'typecast':!![]});if(_0x1411ad['length']){logger[_0x12c0('0xd')]('[%s][AGENT]\x20%s',_0x3bdb88,_['map'](_0x1411ad,_0x12c0('0xe'))[_0x12c0('0xf')](',\x20'));_0x7cc7ca[_0x12c0('0x10')]();}else{var _0x302724=_[_0x12c0('0x11')](_0x5805d3[_0x12c0('0x12')],handleFindAgent(_0xe76bf1[_0x12c0('0xb')]));if(_0x302724){var _0x4501d3=(_0xe76bf1[_0x12c0('0x13')]||0xa)*0x3e8;var _0x292c44,_0x4ab1aa;var _0x1b44d0=seqqueue[_0x12c0('0x14')](_0x4501d3);_0x1b44d0['id']=_0x3bdb88;_0x1b44d0[_0x12c0('0x15')]=_0x4501d3;_0x1b44d0[_0x12c0('0x16')]=_0x20da65[_0x12c0('0x16')];writeLog(_0x3bdb88,_0x302724,util[_0x12c0('0xa')](_0x12c0('0x17'),_0x4501d3));_0x5805d3['rules'][_0x3bdb88]['on']('end',function(){logger[_0x12c0('0x9')](_0x12c0('0x18'),_0x3bdb88);clearTimeout(_0x4ab1aa);_0x4ab1aa=undefined;_0x1b44d0[_0x12c0('0x19')]();if(_0x5805d3['rules'][_0x3bdb88]){delete _0x5805d3[_0x12c0('0x1a')][_0x3bdb88];}_0x7cc7ca[_0x12c0('0x10')]();});_0x5805d3[_0x12c0('0x1a')][_0x3bdb88]['on'](_0x12c0('0x1b'),function(){if(_0x5805d3['rules'][_0x3bdb88]){delete _0x5805d3[_0x12c0('0x1a')][_0x3bdb88];}});_0x4ab1aa=setTimeout(function(){logger[_0x12c0('0x9')](_0x12c0('0x1c'),_0x3bdb88);clearTimeout(_0x4ab1aa);_0x1b44d0['close']();_0x7cc7ca['next']();},_0x4501d3);strategy[_0x12c0('0x1d')](_0x1b44d0,_0x302724,_0x5805d3,_0x20da65);}else{logger[_0x12c0('0xd')](_0x12c0('0x1e'),_0x3bdb88,_0xe76bf1[_0x12c0('0xb')]);_0x7cc7ca[_0x12c0('0x10')]();}}}catch(_0x5df8b4){console['log'](_0x5df8b4);logger[_0x12c0('0xd')](_0x12c0('0x1f'),_0x3bdb88,_0x5df8b4[_0x12c0('0x20')]);_0x7cc7ca[_0x12c0('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index dc3afdd..3ae2b73 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 _0x1809=['UserId','info','[%s][AMAZONLEX]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','error','next','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1809,0x15f));var _0x9180=function(_0x912920,_0x4b7c8b){_0x912920=_0x912920-0x0;var _0x1886b8=_0x1809[_0x912920];return _0x1886b8;};'use strict';var _=require(_0x9180('0x0'));var moment=require(_0x9180('0x1'));var AWS=require(_0x9180('0x2'));var utils=require('./utils');var logger=require(_0x9180('0x3'))(_0x9180('0x4'));var rpc={'chatMessage':require(_0x9180('0x5')),'openchannelMessage':require(_0x9180('0x6')),'mailMessage':require(_0x9180('0x7')),'smsMessage':require(_0x9180('0x8')),'faxMessage':require(_0x9180('0x9')),'whatsappMessage':require(_0x9180('0xa'))};exports['consequence']=function(_0x5b88c7,_0x570fda){return function(_0x2e5bc6){try{if(!_[_0x9180('0xb')](this[_0x9180('0xc')][_0x9180('0xd')])){logger[_0x9180('0xe')](_0x9180('0xf'),_0x5b88c7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e5bc6['next']();}var _0x330932={'ContactId':this[_0x9180('0x10')]['id'],'sentAt':moment()['format'](_0x9180('0x11')),'direction':_0x9180('0x12')};if(this[_0x9180('0x13')]==='sms'||this['channel']===_0x9180('0x14')){_0x330932[_0x9180('0x15')]=this[_0x9180('0xc')][_0x9180('0x15')];}var _0x36d753=this[_0x9180('0x13')];if(_0x36d753===_0x9180('0x16')){_0x330932[_0x9180('0x17')]=this['account']['id'];}else{_0x330932[_['upperFirst'](_0x36d753)+'AccountId']=this[_0x9180('0x18')]['id'];}_0x330932[_[_0x9180('0x19')](_0x36d753)+_0x9180('0x1a')]=this[_0x9180('0xc')]['id'];if(this[_0x9180('0xc')][_0x9180('0x1b')]){var _0x4018b0=_0x570fda[0x4];if(!_[_0x9180('0x1c')](_0x4018b0)){_0x330932[_0x9180('0x1d')]=utils[_0x9180('0x1e')](_0x4018b0,this);return rpc[_0x36d753+_0x9180('0x1f')][_0x9180('0x20')](_0x330932)[_0x9180('0x21')](function(_0x5029f6){logger[_0x9180('0xe')](_0x9180('0xf'),_0x5b88c7,_0x330932[_0x9180('0x1d')]);})[_0x9180('0x22')](function(_0x413796){logger['error'](_0x9180('0xf'),_0x5b88c7,JSON[_0x9180('0x23')](_0x413796));})[_0x9180('0x24')](function(){logger[_0x9180('0xe')](_0x9180('0x25'),_0x5b88c7);_0x2e5bc6['stop']();});}else{logger[_0x9180('0xe')](_0x9180('0x26'),_0x5b88c7);_0x2e5bc6[_0x9180('0x27')]();}}else{var _0x4e1dd3=this;var _0x4a1f7c=new AWS[(_0x9180('0x28'))]({'accessKeyId':_0x570fda[0x0],'secretAccessKey':_0x570fda[0x1],'region':_0x570fda[0x2]});var _0x1cecb9={'botAlias':_0x9180('0x29'),'botName':_0x570fda[0x3],'inputText':this[_0x9180('0x2a')][_0x9180('0x1d')],'userId':this[_0x9180('0x13')]+':'+this[_0x9180('0xc')]['id'][_0x9180('0x2b')]()};_0x4a1f7c[_0x9180('0x2c')](_0x1cecb9,function(_0x2c7b82,_0x2f2ab9){if(_0x2c7b82){logger[_0x9180('0x2d')](_0x9180('0xf'),_0x5b88c7,_0x2c7b82[_0x9180('0x2a')]);_0x2e5bc6[_0x9180('0x2e')]();}else if(_0x2f2ab9&&_0x2f2ab9[_0x9180('0x2a')]){_0x4e1dd3['body'][_0x9180('0x2f')]=_0x2f2ab9;_0x330932['body']=_0x2f2ab9[_0x9180('0x2a')];_0x330932[_0x9180('0x30')]=_0x9180('0x2f');_0x330932[_0x9180('0x31')]=JSON[_0x9180('0x23')](_0x2f2ab9);return rpc[_0x36d753+_0x9180('0x1f')]['create'](_0x330932)[_0x9180('0x21')](function(_0x5ecc9a){logger[_0x9180('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5b88c7,_0x330932[_0x9180('0x1d')]);if(_0x2f2ab9[_0x9180('0x32')]==_0x9180('0x33')){_0x2e5bc6['next']();}else{_0x2e5bc6[_0x9180('0x27')]();}})[_0x9180('0x22')](function(_0x45ed3e){logger[_0x9180('0x2d')](_0x9180('0xf'),_0x5b88c7,JSON[_0x9180('0x23')](_0x45ed3e));_0x2e5bc6['next']();});}else{_0x2e5bc6[_0x9180('0x2e')]();}});}}catch(_0x3e235f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x5b88c7,JSON[_0x9180('0x23')](_0x3e235f));_0x2e5bc6['stop']();}};}; \ No newline at end of file +var _0x4b16=['getMustacheRender','Message','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','toString','postText','amazonlex','providerName','dialogState','catch','lodash','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body'];(function(_0x54f08a,_0x37daf8){var _0x1279fb=function(_0x377fd6){while(--_0x377fd6){_0x54f08a['push'](_0x54f08a['shift']());}};_0x1279fb(++_0x37daf8);}(_0x4b16,0x101));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x64b1('0x0'));var moment=require('moment');var AWS=require(_0x64b1('0x1'));var utils=require(_0x64b1('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x64b1('0x3')),'openchannelMessage':require(_0x64b1('0x4')),'mailMessage':require(_0x64b1('0x5')),'smsMessage':require(_0x64b1('0x6')),'faxMessage':require(_0x64b1('0x7')),'whatsappMessage':require(_0x64b1('0x8'))};exports[_0x64b1('0x9')]=function(_0x4c86f9,_0x3e0092){return function(_0x45fe11){try{if(!_[_0x64b1('0xa')](this['interaction']['UserId'])){logger[_0x64b1('0xb')](_0x64b1('0xc'),_0x4c86f9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x45fe11[_0x64b1('0xd')]();}var _0x53520a={'ContactId':this[_0x64b1('0xe')]['id'],'sentAt':moment()[_0x64b1('0xf')](_0x64b1('0x10')),'direction':_0x64b1('0x11')};if(this[_0x64b1('0x12')]===_0x64b1('0x13')||this['channel']===_0x64b1('0x14')){_0x53520a[_0x64b1('0x15')]=this[_0x64b1('0x16')]['phone'];}var _0x1f9321=this[_0x64b1('0x12')];if(_0x1f9321===_0x64b1('0x17')){_0x53520a[_0x64b1('0x18')]=this[_0x64b1('0x19')]['id'];}else{_0x53520a[_[_0x64b1('0x1a')](_0x1f9321)+'AccountId']=this[_0x64b1('0x19')]['id'];}_0x53520a[_['upperFirst'](_0x1f9321)+_0x64b1('0x1b')]=this[_0x64b1('0x16')]['id'];if(this['interaction'][_0x64b1('0x1c')]){var _0xb6d662=_0x3e0092[0x4];if(!_[_0x64b1('0x1d')](_0xb6d662)){_0x53520a[_0x64b1('0x1e')]=utils[_0x64b1('0x1f')](_0xb6d662,this);return rpc[_0x1f9321+_0x64b1('0x20')][_0x64b1('0x21')](_0x53520a)[_0x64b1('0x22')](function(_0x1a74f1){logger[_0x64b1('0xb')](_0x64b1('0xc'),_0x4c86f9,_0x53520a[_0x64b1('0x1e')]);})['catch'](function(_0x4963af){logger[_0x64b1('0x23')]('[%s][AMAZONLEX]\x20%s',_0x4c86f9,JSON[_0x64b1('0x24')](_0x4963af));})[_0x64b1('0x25')](function(){logger['info'](_0x64b1('0x26'),_0x4c86f9);_0x45fe11['stop']();});}else{logger[_0x64b1('0xb')](_0x64b1('0x27'),_0x4c86f9);_0x45fe11[_0x64b1('0x28')]();}}else{var _0x3001d0=this;var _0x44a6b1=new AWS['LexRuntime']({'accessKeyId':_0x3e0092[0x0],'secretAccessKey':_0x3e0092[0x1],'region':_0x3e0092[0x2]});var _0x58f3b3={'botAlias':'$LATEST','botName':_0x3e0092[0x3],'inputText':this[_0x64b1('0x29')][_0x64b1('0x1e')],'userId':this[_0x64b1('0x12')]+':'+this[_0x64b1('0x16')]['id'][_0x64b1('0x2a')]()};_0x44a6b1[_0x64b1('0x2b')](_0x58f3b3,function(_0x164b14,_0x521bfb){if(_0x164b14){logger[_0x64b1('0x23')](_0x64b1('0xc'),_0x4c86f9,_0x164b14[_0x64b1('0x29')]);_0x45fe11['next']();}else if(_0x521bfb&&_0x521bfb['message']){_0x3001d0['body'][_0x64b1('0x2c')]=_0x521bfb;_0x53520a['body']=_0x521bfb[_0x64b1('0x29')];_0x53520a[_0x64b1('0x2d')]=_0x64b1('0x2c');_0x53520a['providerResponse']=JSON[_0x64b1('0x24')](_0x521bfb);return rpc[_0x1f9321+_0x64b1('0x20')][_0x64b1('0x21')](_0x53520a)[_0x64b1('0x22')](function(_0x4050aa){logger[_0x64b1('0xb')](_0x64b1('0xc'),_0x4c86f9,_0x53520a[_0x64b1('0x1e')]);if(_0x521bfb[_0x64b1('0x2e')]=='Failed'){_0x45fe11[_0x64b1('0xd')]();}else{_0x45fe11[_0x64b1('0x28')]();}})[_0x64b1('0x2f')](function(_0x519f7b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4c86f9,JSON[_0x64b1('0x24')](_0x519f7b));_0x45fe11[_0x64b1('0xd')]();});}else{_0x45fe11[_0x64b1('0xd')]();}});}}catch(_0x5e27f3){logger[_0x64b1('0x23')](_0x64b1('0xc'),_0x4c86f9,JSON[_0x64b1('0x24')](_0x5e27f3));_0x45fe11['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 3ebb31a..6758712 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 _0x4e65=['../../rpc/openchannelInteraction','../../mailRpc','consequence','channel','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','','replace','';_0x2cb478[_0x54e6('0x38')]={'Auto-Submitted':_0x54e6('0x39'),'X-Auto-Response-Suppress':_0x54e6('0x3a'),'Precedence':_0x54e6('0x3b')};return mailRpc[_0x54e6('0x3c')](_0x2c6fe3,_0x2cb478)[_0x54e6('0x3d')](function(_0x27db2d){logger[_0x54e6('0x17')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x20cac0);_0x2cb478[_0x54e6('0x3e')]=_0x27db2d[_0x54e6('0x20')][_0x54e6('0x3e')];return rpc[_0x25e113+'Message'][_0x54e6('0x3f')](_0x2cb478);})[_0x54e6('0x3d')](function(_0x12a12c){logger[_0x54e6('0x17')](_0x54e6('0xf'),_0x20cac0,JSON[_0x54e6('0x40')](_0x12a12c));})[_0x54e6('0x41')](function(_0x4def14){logger[_0x54e6('0x42')]('[RPC][%s][AUTOREPLY]\x20%s',_0x20cac0,JSON[_0x54e6('0x40')](_0x4def14));})['finally'](function(){Promise[_0x54e6('0x43')]()[_0x54e6('0x3d')](function(){if(_0x1eb121[0x0]!=='2'||_0x4a44cb['autoreplyExecuted'])return;return rpc[_0x25e113+_0x54e6('0x44')]['update'](_0x4a44cb['id'],{'autoreplyExecuted':!![]})[_0x54e6('0x3d')](function(_0x2ed88d){logger['info'](_0x54e6('0x18'),_0x20cac0,JSON['stringify'](_0x2ed88d));})['catch'](function(_0xa2e0e3){logger[_0x54e6('0x42')](_0x54e6('0x45'),_0x20cac0,JSON['stringify'](_0xa2e0e3));});})[_0x54e6('0x3d')](function(){_0x59565a[_0x54e6('0x11')]();});});}else{return rpc[this[_0x54e6('0xc')]+'Message'][_0x54e6('0x3f')](_0x2cb478)[_0x54e6('0x3d')](function(_0x11bd14){logger[_0x54e6('0x17')]('[%s][AUTOREPLY]\x20%s',_0x20cac0,_0x2cb478[_0x54e6('0xd')]);})[_0x54e6('0x41')](function(_0x5e7ab4){logger[_0x54e6('0x42')](_0x54e6('0xf'),_0x20cac0,JSON[_0x54e6('0x40')](_0x5e7ab4));})['finally'](function(){Promise[_0x54e6('0x43')]()[_0x54e6('0x3d')](function(){if(_0x1eb121[0x0]!=='2'||_0x4a44cb['autoreplyExecuted'])return;return rpc[_0x25e113+_0x54e6('0x44')][_0x54e6('0x46')](_0x4a44cb['id'],{'autoreplyExecuted':!![]})[_0x54e6('0x3d')](function(_0x37a592){logger[_0x54e6('0x17')](_0x54e6('0x18'),_0x20cac0,JSON['stringify'](_0x37a592));})['catch'](function(_0x31937d){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x20cac0,JSON[_0x54e6('0x40')](_0x31937d));});})['then'](function(){_0x59565a['next']();});});}}}catch(_0x285270){logger[_0x54e6('0x42')](_0x54e6('0xf'),_0x20cac0,JSON['stringify'](_0x285270));_0x59565a[_0x54e6('0x47')]();}};}; \ No newline at end of file +var _0xb3ed=['','auto-replied','auto_reply','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stringify','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../mailRpc','channel','body','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','subject','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Smtp','service','port','secure','authentication','user','pass','inReplyTo','','replace',']+(>|$)/g,''),'priorityTrue':_0x48ac1b[0x1],'priorityFalse':_0x48ac1b[0x2]};var _0x21721e=gotoif[_0x33a8('0x0')](_0x401466,{'typecast':!![]});if(_0x21721e['length']){logger[_0x33a8('0xe')](_0x33a8('0xf'),_0x1d9e63,_['map'](_0x21721e,_0x33a8('0x10'))[_0x33a8('0x11')](',\x20'));_0x4fa1ed[_0x33a8('0x12')]();}else{try{var _0x260c71=eval('('+_0x401466[_0x33a8('0x13')]+')');var _0x4b2e84=_0x260c71?_0x401466['priorityTrue']:_0x401466[_0x33a8('0x14')];logger[_0x33a8('0x15')](_0x33a8('0x16'),_0x1d9e63,_0x401466['condition'],_0x260c71,_0x4b2e84||_0x33a8('0x17'));if(_0x4b2e84){var _0x3ecaeb=_[_0x33a8('0x18')](_0x4fa1ed[_0x33a8('0x19')](),{'p':_0x4b2e84});if(_0x3ecaeb>=0x0){logger[_0x33a8('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1d9e63,_0x4b2e84||_0x33a8('0x17'),_0x3ecaeb);_0x4fa1ed[_0x33a8('0x17')](_0x3ecaeb);}else{logger[_0x33a8('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1d9e63,_0x4b2e84||'next');_0x4fa1ed['stop']();}}else{_0x4fa1ed[_0x33a8('0x17')]();}}catch(_0x254d5f){logger[_0x33a8('0xe')](_0x33a8('0x1a'),_0x1d9e63,_0x254d5f[_0x33a8('0x10')]);_0x4fa1ed[_0x33a8('0x12')]();}}}catch(_0x223ff6){logger[_0x33a8('0xe')](_0x33a8('0xf'),_0x1d9e63,JSON[_0x33a8('0x1b')](_0x223ff6));_0x4fa1ed[_0x33a8('0x12')]();}};}; \ No newline at end of file +var _0xa3ab=['stop','condition','priorityTrue','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','join'];(function(_0x5db1b1,_0x50dbea){var _0x3cea83=function(_0xd1e051){while(--_0xd1e051){_0x5db1b1['push'](_0x5db1b1['shift']());}};_0x3cea83(++_0x50dbea);}(_0xa3ab,0x91));var _0xba3a=function(_0xec72d3,_0x436feb){_0xec72d3=_0xec72d3-0x0;var _0x371286=_0xa3ab[_0xec72d3];return _0x371286;};'use strict';var schema=require('validate');var _=require(_0xba3a('0x0'));var htmlToText=require(_0xba3a('0x1'));var utils=require(_0xba3a('0x2'));var logger=require('../../../../config/logger')(_0xba3a('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xba3a('0x4'),'message':_0xba3a('0x5')},'priorityFalse':{'type':_0xba3a('0x4'),'message':_0xba3a('0x6')}});exports[_0xba3a('0x7')]=function(_0x4d81f8,_0x32fb40){return function(_0x5b37aa){try{var _0x35c4c8={'condition':htmlToText[_0xba3a('0x8')](utils[_0xba3a('0x9')](_0x32fb40[0x0],this),{'wordwrap':![]})[_0xba3a('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x32fb40[0x1],'priorityFalse':_0x32fb40[0x2]};var _0x5e731f=gotoif[_0xba3a('0xb')](_0x35c4c8,{'typecast':!![]});if(_0x5e731f['length']){logger[_0xba3a('0xc')](_0xba3a('0xd'),_0x4d81f8,_[_0xba3a('0xe')](_0x5e731f,_0xba3a('0xf'))[_0xba3a('0x10')](',\x20'));_0x5b37aa[_0xba3a('0x11')]();}else{try{var _0x2a2061=eval('('+_0x35c4c8[_0xba3a('0x12')]+')');var _0x3d9ade=_0x2a2061?_0x35c4c8[_0xba3a('0x13')]:_0x35c4c8[_0xba3a('0x14')];logger[_0xba3a('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4d81f8,_0x35c4c8['condition'],_0x2a2061,_0x3d9ade||_0xba3a('0x16'));if(_0x3d9ade){var _0x1d4de4=_['findIndex'](_0x5b37aa[_0xba3a('0x17')](),{'p':_0x3d9ade});if(_0x1d4de4>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4d81f8,_0x3d9ade||'next',_0x1d4de4);_0x5b37aa[_0xba3a('0x16')](_0x1d4de4);}else{logger[_0xba3a('0x15')](_0xba3a('0x18'),_0x4d81f8,_0x3d9ade||_0xba3a('0x16'));_0x5b37aa[_0xba3a('0x11')]();}}else{_0x5b37aa[_0xba3a('0x16')]();}}catch(_0x14e764){logger[_0xba3a('0xc')](_0xba3a('0x19'),_0x4d81f8,_0x14e764['message']);_0x5b37aa[_0xba3a('0x11')]();}}}catch(_0x1feb21){logger[_0xba3a('0xc')](_0xba3a('0xd'),_0x4d81f8,JSON[_0xba3a('0x1a')](_0x1feb21));_0x5b37aa[_0xba3a('0x11')]();}};}; \ 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 0764605..3bcfb38 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 _0x7bd6=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','consequence','length','[%s][GOTOP]\x20%s','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority'];(function(_0x2902cc,_0x4d1d00){var _0x5f418f=function(_0x5e3846){while(--_0x5e3846){_0x2902cc['push'](_0x2902cc['shift']());}};_0x5f418f(++_0x4d1d00);}(_0x7bd6,0x1d0));var _0x67bd=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x7bd6[_0x4206f5];return _0xa29cf3;};'use strict';var schema=require(_0x67bd('0x0'));var _=require(_0x67bd('0x1'));var logger=require(_0x67bd('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x67bd('0x3')]=function(_0x266481,_0x4011a4){return function(_0x4da04f){try{var _0x88bbd1={'priority':_0x4011a4[0x0]};var _0x5e3e6a=gotop[_0x67bd('0x0')](_0x88bbd1,{'typecast':!![]});if(_0x5e3e6a[_0x67bd('0x4')]){logger['error'](_0x67bd('0x5'),_0x266481,_['map'](_0x5e3e6a,'message')['join'](',\x20'));_0x4da04f[_0x67bd('0x6')]();}else{logger[_0x67bd('0x7')](_0x67bd('0x8'),_0x266481,_0x88bbd1['priority']);if(_0x88bbd1['priority']){var _0xd98f60=_[_0x67bd('0x9')](_0x4da04f[_0x67bd('0xa')](),{'p':_0x88bbd1[_0x67bd('0xb')]});if(_0xd98f60>=0x0){logger['info'](_0x67bd('0xc'),_0x266481,_0x88bbd1[_0x67bd('0xb')]||_0x67bd('0xd'),_0xd98f60);_0x4da04f[_0x67bd('0xd')](_0xd98f60);}else{logger[_0x67bd('0x7')](_0x67bd('0xe'),_0x266481,_0x88bbd1[_0x67bd('0xb')]||'next');_0x4da04f['stop']();}}else{_0x4da04f[_0x67bd('0xd')]();}}}catch(_0x58dd41){logger[_0x67bd('0xf')]('[%s][GOTOP]\x20%s',_0x266481,JSON[_0x67bd('0x10')](_0x58dd41));_0x4da04f[_0x67bd('0x6')]();}};}; \ No newline at end of file +var _0x5eaa=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate'];(function(_0x32aa68,_0x102e89){var _0x292133=function(_0x444c56){while(--_0x444c56){_0x32aa68['push'](_0x32aa68['shift']());}};_0x292133(++_0x102e89);}(_0x5eaa,0x110));var _0xa5ea=function(_0x66ae08,_0x36d4ea){_0x66ae08=_0x66ae08-0x0;var _0xbcb259=_0x5eaa[_0x66ae08];return _0xbcb259;};'use strict';var schema=require(_0xa5ea('0x0'));var _=require('lodash');var logger=require(_0xa5ea('0x1'))(_0xa5ea('0x2'));var gotop=schema({'priority':{'type':_0xa5ea('0x3'),'required':!![],'message':_0xa5ea('0x4')}});exports[_0xa5ea('0x5')]=function(_0x672c7,_0x383ad6){return function(_0xd18398){try{var _0x450faf={'priority':_0x383ad6[0x0]};var _0x5f1d11=gotop['validate'](_0x450faf,{'typecast':!![]});if(_0x5f1d11[_0xa5ea('0x6')]){logger[_0xa5ea('0x7')](_0xa5ea('0x8'),_0x672c7,_[_0xa5ea('0x9')](_0x5f1d11,'message')[_0xa5ea('0xa')](',\x20'));_0xd18398['stop']();}else{logger['info'](_0xa5ea('0xb'),_0x672c7,_0x450faf[_0xa5ea('0xc')]);if(_0x450faf[_0xa5ea('0xc')]){var _0x5bccb9=_[_0xa5ea('0xd')](_0xd18398[_0xa5ea('0xe')](),{'p':_0x450faf[_0xa5ea('0xc')]});if(_0x5bccb9>=0x0){logger[_0xa5ea('0xf')](_0xa5ea('0x10'),_0x672c7,_0x450faf[_0xa5ea('0xc')]||'next',_0x5bccb9);_0xd18398[_0xa5ea('0x11')](_0x5bccb9);}else{logger[_0xa5ea('0xf')](_0xa5ea('0x12'),_0x672c7,_0x450faf[_0xa5ea('0xc')]||_0xa5ea('0x11'));_0xd18398[_0xa5ea('0x13')]();}}else{_0xd18398[_0xa5ea('0x11')]();}}}catch(_0x54d364){logger[_0xa5ea('0x7')](_0xa5ea('0x8'),_0x672c7,JSON[_0xa5ea('0x14')](_0x54d364));_0xd18398[_0xa5ea('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 586686f..fd5cbb3 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 _0xfb9c=['catch','stringify','stop','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','then','info','[%s][MESSAGE]\x20%s','body','next'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfb9c,0xb2));var _0xcfb9=function(_0x1c1780,_0x93cb2){_0x1c1780=_0x1c1780-0x0;var _0x5eb4ae=_0xfb9c[_0x1c1780];return _0x5eb4ae;};'use strict';var _=require('lodash');var utils=require(_0xcfb9('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xcfb9('0x1')),'openchannelMessage':require(_0xcfb9('0x2')),'mailMessage':require(_0xcfb9('0x3')),'smsMessage':require(_0xcfb9('0x4')),'faxMessage':require(_0xcfb9('0x5')),'whatsappMessage':require(_0xcfb9('0x6'))};exports[_0xcfb9('0x7')]=function(_0x101a60,_0x5c23d9){return function(_0x55e5f2){try{var _0x21df34={'body':utils[_0xcfb9('0x8')](_0x5c23d9[0x0],this),'ContactId':this[_0xcfb9('0x9')]['id']};if(this[_0xcfb9('0xa')]===_0xcfb9('0xb')){_0x21df34[_0xcfb9('0xc')]=this['account']['id'];}else{_0x21df34[_[_0xcfb9('0xd')](this[_0xcfb9('0xa')])+_0xcfb9('0xe')]=this['account']['id'];}_0x21df34[_[_0xcfb9('0xd')](this['channel'])+_0xcfb9('0xf')]=this['interaction']['id'];if(rpc[this[_0xcfb9('0xa')]+_0xcfb9('0x10')]){return rpc[this[_0xcfb9('0xa')]+_0xcfb9('0x10')]['create'](_0x21df34)[_0xcfb9('0x11')](function(_0x47e20c){logger[_0xcfb9('0x12')](_0xcfb9('0x13'),_0x101a60,_0x21df34[_0xcfb9('0x14')]);_0x55e5f2[_0xcfb9('0x15')]();})[_0xcfb9('0x16')](function(_0xff09b3){logger['error'](_0xcfb9('0x13'),_0x101a60,JSON[_0xcfb9('0x17')](_0xff09b3));_0x55e5f2[_0xcfb9('0x18')]();});}}catch(_0x5c4b95){logger['error']('[%s][MESSAGE]\x20%s',_0x101a60,JSON[_0xcfb9('0x17')](_0x5c4b95));_0x55e5f2[_0xcfb9('0x18')]();}};}; \ No newline at end of file +var _0x462e=['getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','Message','then','info','body','next','catch','error','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x335ce3,_0x3e412d){var _0x25d9b5=function(_0x36a587){while(--_0x36a587){_0x335ce3['push'](_0x335ce3['shift']());}};_0x25d9b5(++_0x3e412d);}(_0x462e,0x13c));var _0xe462=function(_0x56684b,_0x17a75f){_0x56684b=_0x56684b-0x0;var _0x2af7f1=_0x462e[_0x56684b];return _0x2af7f1;};'use strict';var _=require(_0xe462('0x0'));var utils=require(_0xe462('0x1'));var logger=require(_0xe462('0x2'))(_0xe462('0x3'));var rpc={'chatMessage':require(_0xe462('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe462('0x5')),'smsMessage':require(_0xe462('0x6')),'faxMessage':require(_0xe462('0x7')),'whatsappMessage':require(_0xe462('0x8'))};exports['consequence']=function(_0x11f3a6,_0x264a02){return function(_0x208cb5){try{var _0xdb3d0b={'body':utils[_0xe462('0x9')](_0x264a02[0x0],this),'ContactId':this['contact']['id']};if(this[_0xe462('0xa')]===_0xe462('0xb')){_0xdb3d0b[_0xe462('0xc')]=this[_0xe462('0xd')]['id'];}else{_0xdb3d0b[_['upperFirst'](this[_0xe462('0xa')])+_0xe462('0xe')]=this[_0xe462('0xd')]['id'];}_0xdb3d0b[_['upperFirst'](this[_0xe462('0xa')])+_0xe462('0xf')]=this[_0xe462('0x10')]['id'];if(rpc[this['channel']+_0xe462('0x11')]){return rpc[this[_0xe462('0xa')]+_0xe462('0x11')]['create'](_0xdb3d0b)[_0xe462('0x12')](function(_0x5925ef){logger[_0xe462('0x13')]('[%s][MESSAGE]\x20%s',_0x11f3a6,_0xdb3d0b[_0xe462('0x14')]);_0x208cb5[_0xe462('0x15')]();})[_0xe462('0x16')](function(_0x50b70b){logger[_0xe462('0x17')]('[%s][MESSAGE]\x20%s',_0x11f3a6,JSON[_0xe462('0x18')](_0x50b70b));_0x208cb5['stop']();});}}catch(_0x20ee82){logger['error']('[%s][MESSAGE]\x20%s',_0x11f3a6,JSON[_0xe462('0x18')](_0x20ee82));_0x208cb5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 722411d..1f07e5e 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 _0x6d98=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stop','../../../../config/logger','routing'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0x6d98,0x146));var _0x86d9=function(_0x2e41b6,_0x78c0da){_0x2e41b6=_0x2e41b6-0x0;var _0x1d4cd6=_0x6d98[_0x2e41b6];return _0x1d4cd6;};'use strict';var utils=require('./utils');var logger=require(_0x86d9('0x0'))(_0x86d9('0x1'));exports[_0x86d9('0x2')]=function(_0x9b2627,_0x58e40b){return function(_0x44b6cd){try{logger[_0x86d9('0x3')](_0x86d9('0x4'),_0x9b2627,utils[_0x86d9('0x5')](_0x58e40b[0x0],this));_0x44b6cd[_0x86d9('0x6')]();}catch(_0x4dab9b){logger['error'](_0x86d9('0x4'),_0x9b2627,JSON['stringify'](_0x4dab9b));_0x44b6cd[_0x86d9('0x7')]();}};}; \ No newline at end of file +var _0x89c8=['../../../../config/logger','routing','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','./utils'];(function(_0x2f1663,_0x3dae40){var _0x2accb6=function(_0x523d4f){while(--_0x523d4f){_0x2f1663['push'](_0x2f1663['shift']());}};_0x2accb6(++_0x3dae40);}(_0x89c8,0x12f));var _0x889c=function(_0x58b33d,_0x4c1c82){_0x58b33d=_0x58b33d-0x0;var _0x3335c3=_0x89c8[_0x58b33d];return _0x3335c3;};'use strict';var utils=require(_0x889c('0x0'));var logger=require(_0x889c('0x1'))(_0x889c('0x2'));exports['consequence']=function(_0x592472,_0x4467a8){return function(_0x1eb048){try{logger['info']('[%s][NOOP]\x20%s',_0x592472,utils[_0x889c('0x3')](_0x4467a8[0x0],this));_0x1eb048[_0x889c('0x4')]();}catch(_0x8670e3){logger[_0x889c('0x5')](_0x889c('0x6'),_0x592472,JSON[_0x889c('0x7')](_0x8670e3));_0x1eb048['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 57189f5..88f8b9b 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 _0xe08b=['account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','InteractionId','interaction','channel','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','info','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','length','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','close','next','strategy','rrmemory','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe08b,0x184));var _0xbe08=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xe08b[_0x2160a9];return _0xa88cf7;};'use strict';var schema=require('validate');var _=require(_0xbe08('0x0'));var util=require(_0xbe08('0x1'));var seqqueue=require(_0xbe08('0x2'));var moment=require(_0xbe08('0x3'));var Redis=require(_0xbe08('0x4'));var config=require(_0xbe08('0x5'));var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var strategy=require('./strategy');config[_0xbe08('0x8')]=_['defaults'](config[_0xbe08('0x8')],{'host':_0xbe08('0x9'),'port':0x18eb});var io=require(_0xbe08('0xa'))(new Redis(config[_0xbe08('0x8')]));var attributes=['id',_0xbe08('0xb'),_0xbe08('0xc'),_0xbe08('0xd'),_0xbe08('0xe'),_0xbe08('0xf')];function emit(_0x6ea1d8,_0x438ca1,_0x29b3fa){io['to'](_0x6ea1d8)[_0xbe08('0x10')](_0x438ca1,_0x29b3fa);}function emitChannelQueueInteraction(_0x2bf1db,_0x504852,_0x28049f,_0x1a0c25,_0x393650,_0x410555,_0x56043b,_0x4d9bc7){var _0x349272=_['clone'](_0x28049f);_0x349272[_0xbe08('0xb')]=_0x4d9bc7;_0x349272['queue']=_0x504852;_0x349272[_0xbe08('0xc')]=_0x1a0c25;_0x349272['id']=_0x393650;if(_0x410555){_0x56043b[util[_0xbe08('0x11')](_0xbe08('0x12'),_0x2bf1db)][_0x393650]=_['pick'](_0x349272,attributes);}else{delete _0x56043b[util['format']('%sQueuesWaitingInteractions',_0x2bf1db)][_0x393650];}emit(util[_0xbe08('0x11')](_0xbe08('0x13'),_0x2bf1db,_0x504852),util[_0xbe08('0x11')]('%s_queue_waiting_interaction:%s',_0x2bf1db,_0x410555?_0xbe08('0x14'):_0xbe08('0x15')),_[_0xbe08('0x16')](_0x349272,attributes));}var rpc={'openchannelQueueReport':require(_0xbe08('0x17')),'mailQueueReport':require(_0xbe08('0x18')),'chatQueueReport':require(_0xbe08('0x19')),'smsQueueReport':require(_0xbe08('0x1a')),'faxQueueReport':require(_0xbe08('0x1b')),'whatsappQueueReport':require(_0xbe08('0x1c'))};var queue=schema({'name':{'type':_0xbe08('0x1d'),'required':!![],'message':_0xbe08('0x1e')},'timeout':{'type':'number','message':_0xbe08('0x1f')}});function startRouting(_0x134458,_0x1bec70,_0x15880a,_0x3a6e6d){if(_0x134458&&_0x1bec70&&_0x15880a){_0x1bec70['waiting']+=0x1;var _0x334dbc={'uniqueid':_0x134458,'from':_0x15880a['body']?_0x15880a[_0xbe08('0x20')]['from']:'','joinAt':moment()[_0xbe08('0x11')](_0xbe08('0x21')),'ContactId':_0x15880a[_0xbe08('0x22')]?_0x15880a[_0xbe08('0x22')]['id']:null,'ListId':_0x15880a[_0xbe08('0x23')]?_0x15880a[_0xbe08('0x23')]['id']:null};_0x334dbc[_[_0xbe08('0x24')](_0x15880a['channel'])+'QueueId']=_0x1bec70['id']||null;_0x334dbc[_[_0xbe08('0x24')](_0x15880a['channel'])+_0xbe08('0x25')]=_0x15880a[_0xbe08('0x26')]?_0x15880a['interaction']['id']:null;_0x334dbc[_[_0xbe08('0x24')](_0x15880a[_0xbe08('0x27')])+_0xbe08('0x28')]=_0x15880a[_0xbe08('0x29')]?_0x15880a[_0xbe08('0x29')]['id']:null;_0x334dbc[_['upperFirst'](_0x15880a[_0xbe08('0x27')])+(_0x15880a[_0xbe08('0x27')]!=='chat'?_0xbe08('0x2a'):_0xbe08('0x2b'))]=_0x15880a[_0xbe08('0xc')]?_0x15880a[_0xbe08('0xc')]['id']:null;logger['info'](util[_0xbe08('0x11')](_0xbe08('0x2c'),_0x134458,_0x1bec70[_0xbe08('0x2d')]));emitChannelQueueInteraction(_0x15880a[_0xbe08('0x27')],_0x1bec70[_0xbe08('0x2d')],_0x334dbc,_0x15880a[_0xbe08('0xc')][_0xbe08('0x2d')],_0x15880a[_0xbe08('0x29')]['id'],!![],_0x3a6e6d,_0x1bec70['id']);if(rpc[_0x15880a[_0xbe08('0x27')]+_0xbe08('0x2e')]){return rpc[_0x15880a[_0xbe08('0x27')]+'QueueReport'][_0xbe08('0x2f')](_0x334dbc)[_0xbe08('0x30')](function(_0x292664){logger['error'](_0xbe08('0x31'));});}}}function stopRouting(_0x43c529,_0x37a299,_0xbbebcf,_0x11e058){if(_0x43c529&&_0x37a299){_0x37a299[_0xbe08('0x32')]-=0x1;var _0xf5adf2={'leaveAt':moment()['format'](_0xbe08('0x21')),'acceptAt':moment()[_0xbe08('0x11')](_0xbe08('0x21')),'reason':_0xbe08('0x33')};logger['info'](util['format'](_0xbe08('0x34'),_0x43c529,_0x37a299[_0xbe08('0x2d')]));emitChannelQueueInteraction(_0xbbebcf['channel'],_0x37a299[_0xbe08('0x2d')],_0xbbebcf['body'],_0xbbebcf['account'][_0xbe08('0x2d')],_0xbbebcf['message']['id'],![],_0x11e058,_0x37a299['id']);if(rpc[_0xbbebcf[_0xbe08('0x27')]+'QueueReport']){return rpc[_0xbbebcf['channel']+'QueueReport']['update'](_0x43c529,_0xf5adf2)[_0xbe08('0x30')](function(_0x10f303){logger[_0xbe08('0x35')](_0xbe08('0x36'));});}}}function endRouting(_0x4eaaac,_0x1eb482,_0x9039f7,_0x1ec70f){if(_0x4eaaac&&_0x1eb482){_0x1eb482[_0xbe08('0x32')]-=0x1;var _0x9ad9f9={'leaveAt':moment()[_0xbe08('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0xbe08('0x37')](util[_0xbe08('0x11')](_0xbe08('0x38'),_0x4eaaac,_0x1eb482[_0xbe08('0x2d')]));emitChannelQueueInteraction(_0x9039f7[_0xbe08('0x27')],_0x1eb482[_0xbe08('0x2d')],_0x9039f7[_0xbe08('0x20')],_0x9039f7[_0xbe08('0xc')][_0xbe08('0x2d')],_0x9039f7[_0xbe08('0x29')]['id'],![],_0x1ec70f);if(rpc[_0x9039f7[_0xbe08('0x27')]+_0xbe08('0x2e')]){return rpc[_0x9039f7[_0xbe08('0x27')]+_0xbe08('0x2e')][_0xbe08('0x39')](_0x4eaaac,_0x9ad9f9)['catch'](function(_0x45b689){logger[_0xbe08('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x3d2d6a){return function(_0x1709fd){return _0x1709fd[_0xbe08('0x2d')]['toLowerCase']()===_0x3d2d6a[_0xbe08('0x3a')]();};}exports[_0xbe08('0x3b')]=function(_0x567b9f,_0x2f7aa5,_0x389e98,_0x130684){return function(_0x5188f7){try{var _0x3e31fd={'name':_0x2f7aa5[0x0],'timeout':_0x2f7aa5[0x1]};var _0x1b8998=queue[_0xbe08('0x3c')](_0x3e31fd,{'typecast':!![]});if(_0x1b8998[_0xbe08('0x3d')]){logger['error']('[%s][QUEUE]\x20%s',_0x567b9f,_[_0xbe08('0x3e')](_0x1b8998,_0xbe08('0x29'))[_0xbe08('0x3f')](',\x20'));_0x5188f7[_0xbe08('0x40')]();}else{var _0x2cc622=_[_0xbe08('0x41')](_0x389e98[_0x130684[_0xbe08('0x27')]+_0xbe08('0x42')],handleFindQueue(_0x3e31fd['name']));if(_0x2cc622){startRouting(_0x567b9f,_0x2cc622,_0x130684,_0x389e98);var _0x2995ab=(_0x2cc622[_0xbe08('0x43')]||0xa)*0x3e8;var _0x222c22=(_0x3e31fd[_0xbe08('0x43')]||0x14)*0x3e8;var _0x48e47b,_0x4c3ab6;if(_0x2995ab>_0x222c22){_0x222c22=_0x2995ab;}var _0xbee424=seqqueue[_0xbe08('0x44')](_0x2995ab);_0xbee424['id']=_0x567b9f;_0xbee424[_0xbe08('0x45')]=_0x2995ab;_0xbee424[_0xbe08('0x46')]=_0x222c22;_0xbee424[_0xbe08('0x27')]=_0x130684[_0xbe08('0x27')];_0x389e98[_0xbe08('0x47')][_0x567b9f]['on'](_0xbe08('0x48'),function(){logger[_0xbe08('0x37')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x567b9f);stopRouting(_0x567b9f,_0x2cc622,_0x130684,_0x389e98);clearTimeout(_0x48e47b);_0x48e47b=undefined;_0xbee424[_0xbe08('0x49')](!![]);if(_0x389e98[_0xbe08('0x47')][_0x567b9f]){delete _0x389e98[_0xbe08('0x47')][_0x567b9f];}_0x5188f7[_0xbe08('0x40')]();});_0x389e98[_0xbe08('0x47')][_0x567b9f]['on']('complete',function(){if(_0x389e98['rules'][_0x567b9f]){delete _0x389e98[_0xbe08('0x47')][_0x567b9f];}});_0x48e47b=setTimeout(function(){logger[_0xbe08('0x37')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x567b9f);endRouting(_0x567b9f,_0x2cc622,_0x130684,_0x389e98);clearTimeout(_0x48e47b);_0xbee424['close'](!![]);_0x5188f7[_0xbe08('0x4a')]();},_0x222c22);switch(_0x2cc622[_0xbe08('0x4b')]){case _0xbe08('0x4c'):strategy[_0xbe08('0x4c')](_0xbee424,_0x2cc622,_0x389e98,_0x130684);break;default:strategy['beepall'](_0xbee424,_0x2cc622,_0x389e98,_0x130684);}}else{logger[_0xbe08('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x567b9f,_0x3e31fd[_0xbe08('0x2d')]);_0x5188f7['stop']();}}}catch(_0x46c0a3){console[_0xbe08('0x4d')](_0x46c0a3);logger['error'](_0xbe08('0x4e'),_0x567b9f,_0x46c0a3[_0xbe08('0x4f')]);_0x5188f7[_0xbe08('0x40')]();}};}; \ No newline at end of file +var _0xb6fa=['from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','name','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','seq-queue','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue'];(function(_0x29379a,_0x16b64f){var _0x125b52=function(_0xea6150){while(--_0xea6150){_0x29379a['push'](_0x29379a['shift']());}};_0x125b52(++_0x16b64f);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xb6fa[_0x10dbf6];return _0x452147;};'use strict';var schema=require(_0xab6f('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0xab6f('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xab6f('0x2'));var logger=require(_0xab6f('0x3'))('routing');var strategy=require(_0xab6f('0x4'));config[_0xab6f('0x5')]=_[_0xab6f('0x6')](config[_0xab6f('0x5')],{'host':_0xab6f('0x7'),'port':0x18eb});var io=require(_0xab6f('0x8'))(new Redis(config[_0xab6f('0x5')]));var attributes=['id',_0xab6f('0x9'),_0xab6f('0xa'),_0xab6f('0xb'),_0xab6f('0xc'),_0xab6f('0xd')];function emit(_0x199f2d,_0x67bfd1,_0x85d4c1){io['to'](_0x199f2d)[_0xab6f('0xe')](_0x67bfd1,_0x85d4c1);}function emitChannelQueueInteraction(_0x4838a8,_0x599560,_0x20ada3,_0x2a7588,_0x48c542,_0x224e2c,_0x39fee7,_0x318c53){var _0x437b32=_[_0xab6f('0xf')](_0x20ada3);_0x437b32[_0xab6f('0x9')]=_0x318c53;_0x437b32[_0xab6f('0xb')]=_0x599560;_0x437b32['account']=_0x2a7588;_0x437b32['id']=_0x48c542;if(_0x224e2c){_0x39fee7[util[_0xab6f('0x10')](_0xab6f('0x11'),_0x4838a8)][_0x48c542]=_[_0xab6f('0x12')](_0x437b32,attributes);}else{delete _0x39fee7[util['format'](_0xab6f('0x11'),_0x4838a8)][_0x48c542];}emit(util['format']('%s:queue:%s',_0x4838a8,_0x599560),util[_0xab6f('0x10')]('%s_queue_waiting_interaction:%s',_0x4838a8,_0x224e2c?_0xab6f('0x13'):_0xab6f('0x14')),_[_0xab6f('0x12')](_0x437b32,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xab6f('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xab6f('0x16')),'faxQueueReport':require(_0xab6f('0x17')),'whatsappQueueReport':require(_0xab6f('0x18'))};var queue=schema({'name':{'type':_0xab6f('0x19'),'required':!![],'message':_0xab6f('0x1a')},'timeout':{'type':_0xab6f('0x1b'),'message':_0xab6f('0x1c')}});function startRouting(_0x48601f,_0x1f7322,_0x247e68,_0x175426){if(_0x48601f&&_0x1f7322&&_0x247e68){_0x1f7322['waiting']+=0x1;var _0x43eda0={'uniqueid':_0x48601f,'from':_0x247e68[_0xab6f('0x1d')]?_0x247e68[_0xab6f('0x1d')][_0xab6f('0xc')]:'','joinAt':moment()[_0xab6f('0x10')](_0xab6f('0x1e')),'ContactId':_0x247e68['contact']?_0x247e68['contact']['id']:null,'ListId':_0x247e68[_0xab6f('0x1f')]?_0x247e68[_0xab6f('0x1f')]['id']:null};_0x43eda0[_[_0xab6f('0x20')](_0x247e68[_0xab6f('0x21')])+_0xab6f('0x22')]=_0x1f7322['id']||null;_0x43eda0[_[_0xab6f('0x20')](_0x247e68[_0xab6f('0x21')])+'InteractionId']=_0x247e68[_0xab6f('0x23')]?_0x247e68[_0xab6f('0x23')]['id']:null;_0x43eda0[_['upperFirst'](_0x247e68[_0xab6f('0x21')])+_0xab6f('0x24')]=_0x247e68[_0xab6f('0x25')]?_0x247e68[_0xab6f('0x25')]['id']:null;_0x43eda0[_[_0xab6f('0x20')](_0x247e68['channel'])+(_0x247e68[_0xab6f('0x21')]!==_0xab6f('0x26')?'AccountId':_0xab6f('0x27'))]=_0x247e68[_0xab6f('0xa')]?_0x247e68[_0xab6f('0xa')]['id']:null;logger[_0xab6f('0x28')](util[_0xab6f('0x10')](_0xab6f('0x29'),_0x48601f,_0x1f7322['name']));emitChannelQueueInteraction(_0x247e68[_0xab6f('0x21')],_0x1f7322['name'],_0x43eda0,_0x247e68['account']['name'],_0x247e68['message']['id'],!![],_0x175426,_0x1f7322['id']);if(rpc[_0x247e68['channel']+_0xab6f('0x2a')]){return rpc[_0x247e68[_0xab6f('0x21')]+_0xab6f('0x2a')][_0xab6f('0x2b')](_0x43eda0)[_0xab6f('0x2c')](function(_0x4b5a4d){logger[_0xab6f('0x2d')](_0xab6f('0x2e'));});}}}function stopRouting(_0x86ed70,_0x26c62b,_0x160fe6,_0x44f19d){if(_0x86ed70&&_0x26c62b){_0x26c62b[_0xab6f('0x2f')]-=0x1;var _0x5b5966={'leaveAt':moment()[_0xab6f('0x10')](_0xab6f('0x1e')),'acceptAt':moment()[_0xab6f('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xab6f('0x30')};logger['info'](util[_0xab6f('0x10')](_0xab6f('0x31'),_0x86ed70,_0x26c62b[_0xab6f('0x32')]));emitChannelQueueInteraction(_0x160fe6[_0xab6f('0x21')],_0x26c62b[_0xab6f('0x32')],_0x160fe6[_0xab6f('0x1d')],_0x160fe6[_0xab6f('0xa')][_0xab6f('0x32')],_0x160fe6[_0xab6f('0x25')]['id'],![],_0x44f19d,_0x26c62b['id']);if(rpc[_0x160fe6['channel']+_0xab6f('0x2a')]){return rpc[_0x160fe6['channel']+'QueueReport'][_0xab6f('0x33')](_0x86ed70,_0x5b5966)[_0xab6f('0x2c')](function(_0x26d2ac){logger[_0xab6f('0x2d')](_0xab6f('0x34'));});}}}function endRouting(_0x1606f6,_0x5401a5,_0x47f22c,_0x5baf96){if(_0x1606f6&&_0x5401a5){_0x5401a5[_0xab6f('0x2f')]-=0x1;var _0x8e49b0={'leaveAt':moment()[_0xab6f('0x10')](_0xab6f('0x1e')),'exitAt':moment()['format'](_0xab6f('0x1e')),'reason':_0xab6f('0x35')};logger['info'](util['format'](_0xab6f('0x36'),_0x1606f6,_0x5401a5[_0xab6f('0x32')]));emitChannelQueueInteraction(_0x47f22c[_0xab6f('0x21')],_0x5401a5[_0xab6f('0x32')],_0x47f22c['body'],_0x47f22c['account'][_0xab6f('0x32')],_0x47f22c[_0xab6f('0x25')]['id'],![],_0x5baf96);if(rpc[_0x47f22c[_0xab6f('0x21')]+_0xab6f('0x2a')]){return rpc[_0x47f22c[_0xab6f('0x21')]+_0xab6f('0x2a')]['update'](_0x1606f6,_0x8e49b0)[_0xab6f('0x2c')](function(_0xedcac4){logger[_0xab6f('0x2d')](_0xab6f('0x34'));});}}}function handleFindQueue(_0x19c5dc){return function(_0x53377b){return _0x53377b[_0xab6f('0x32')][_0xab6f('0x37')]()===_0x19c5dc[_0xab6f('0x37')]();};}exports[_0xab6f('0x38')]=function(_0x3df7f1,_0x3f6fcb,_0x2360d3,_0x11eb10){return function(_0x383667){try{var _0x40d67e={'name':_0x3f6fcb[0x0],'timeout':_0x3f6fcb[0x1]};var _0x552ba0=queue[_0xab6f('0x0')](_0x40d67e,{'typecast':!![]});if(_0x552ba0[_0xab6f('0x39')]){logger[_0xab6f('0x2d')](_0xab6f('0x3a'),_0x3df7f1,_[_0xab6f('0x3b')](_0x552ba0,'message')['join'](',\x20'));_0x383667[_0xab6f('0x3c')]();}else{var _0x2afa4a=_[_0xab6f('0x3d')](_0x2360d3[_0x11eb10[_0xab6f('0x21')]+_0xab6f('0x3e')],handleFindQueue(_0x40d67e['name']));if(_0x2afa4a){startRouting(_0x3df7f1,_0x2afa4a,_0x11eb10,_0x2360d3);var _0x207934=(_0x2afa4a[_0xab6f('0x35')]||0xa)*0x3e8;var _0x52baee=(_0x40d67e['timeout']||0x14)*0x3e8;var _0x38221c,_0x3243f4;if(_0x207934>_0x52baee){_0x52baee=_0x207934;}var _0x4a3db6=seqqueue[_0xab6f('0x3f')](_0x207934);_0x4a3db6['id']=_0x3df7f1;_0x4a3db6[_0xab6f('0x40')]=_0x207934;_0x4a3db6[_0xab6f('0x41')]=_0x52baee;_0x4a3db6[_0xab6f('0x21')]=_0x11eb10[_0xab6f('0x21')];_0x2360d3[_0xab6f('0x42')][_0x3df7f1]['on']('end',function(){logger[_0xab6f('0x28')](_0xab6f('0x43'),_0x3df7f1);stopRouting(_0x3df7f1,_0x2afa4a,_0x11eb10,_0x2360d3);clearTimeout(_0x38221c);_0x38221c=undefined;_0x4a3db6[_0xab6f('0x44')](!![]);if(_0x2360d3[_0xab6f('0x42')][_0x3df7f1]){delete _0x2360d3[_0xab6f('0x42')][_0x3df7f1];}_0x383667[_0xab6f('0x3c')]();});_0x2360d3[_0xab6f('0x42')][_0x3df7f1]['on'](_0xab6f('0x45'),function(){if(_0x2360d3[_0xab6f('0x42')][_0x3df7f1]){delete _0x2360d3[_0xab6f('0x42')][_0x3df7f1];}});_0x38221c=setTimeout(function(){logger[_0xab6f('0x28')](_0xab6f('0x46'),_0x3df7f1);endRouting(_0x3df7f1,_0x2afa4a,_0x11eb10,_0x2360d3);clearTimeout(_0x38221c);_0x4a3db6[_0xab6f('0x44')](!![]);_0x383667['next']();},_0x52baee);switch(_0x2afa4a[_0xab6f('0x47')]){case _0xab6f('0x48'):strategy['rrmemory'](_0x4a3db6,_0x2afa4a,_0x2360d3,_0x11eb10);break;default:strategy[_0xab6f('0x49')](_0x4a3db6,_0x2afa4a,_0x2360d3,_0x11eb10);}}else{logger[_0xab6f('0x2d')](_0xab6f('0x4a'),_0x3df7f1,_0x40d67e[_0xab6f('0x32')]);_0x383667[_0xab6f('0x3c')]();}}}catch(_0xd2c82f){console[_0xab6f('0x4b')](_0xd2c82f);logger[_0xab6f('0x2d')](_0xab6f('0x3a'),_0x3df7f1,_0xd2c82f[_0xab6f('0x4c')]);_0x383667[_0xab6f('0x3c')]();}};}; \ 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 d917f84..6b08628 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 _0x4d41=['lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','timeout','drained','handleDrained','prototype','handleRun','handleTimeout','agent','isNil','agents','info','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP','TIMEOUT'];(function(_0x142fb1,_0x381c93){var _0x18fd19=function(_0x5bf479){while(--_0x5bf479){_0x142fb1['push'](_0x142fb1['shift']());}};_0x18fd19(++_0x381c93);}(_0x4d41,0xe0));var _0x14d4=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x4d41[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0x14d4('0x0'));var uuid=require(_0x14d4('0x1'));var util=require('./util');var logger=require(_0x14d4('0x2'))(_0x14d4('0x3'));var Agent=function(_0x946d8d,_0x2be2f9,_0x11d441,_0x17587f){this[_0x14d4('0x4')]=uuid['v4']();this[_0x14d4('0x5')]=_0x946d8d;this['agent']=_0x2be2f9;this[_0x14d4('0x6')]=_0x11d441;this[_0x14d4('0x3')]=_0x17587f;this[_0x14d4('0x5')][_0x14d4('0x7')](this['handleRun']['bind'](this),this['handleTimeout'][_0x14d4('0x8')](this));this[_0x14d4('0x5')]['on'](_0x14d4('0x9'),this['handleTimeout'][_0x14d4('0x8')](this));this[_0x14d4('0x5')]['on'](_0x14d4('0xa'),this[_0x14d4('0xb')][_0x14d4('0x8')](this));};Agent[_0x14d4('0xc')][_0x14d4('0x7')]=function(){this[_0x14d4('0x5')][_0x14d4('0x7')](this[_0x14d4('0xd')][_0x14d4('0x8')](this),this[_0x14d4('0xe')][_0x14d4('0x8')](this));};Agent[_0x14d4('0xc')]['handleDrained']=function(){this[_0x14d4('0xe')](!![]);};Agent[_0x14d4('0xc')][_0x14d4('0xd')]=function(_0x2b6e37){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x14d4('0x5')]['id'],this[_0x14d4('0xf')]['id']);if(_[_0x14d4('0x10')](this[_0x14d4('0x6')][_0x14d4('0x11')][this['agent']['id']])){logger[_0x14d4('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x14d4('0x5')]['id'],this[_0x14d4('0xf')]['id']);setTimeout(this['push'][_0x14d4('0x8')](this),0x3e8);}else{if(this['routing'][_0x14d4('0x13')]||util[_0x14d4('0x14')](this[_0x14d4('0x5')]['id'],this['realtime'][_0x14d4('0x11')][this[_0x14d4('0xf')]['id']],this['squeue'][_0x14d4('0x15')],![])){this[_0x14d4('0x6')][_0x14d4('0x11')][this[_0x14d4('0xf')]['id']]['busy']=!![];this['realtime'][_0x14d4('0x11')][this[_0x14d4('0xf')]['id']][_0x14d4('0x16')]=undefined;util[_0x14d4('0x17')](this[_0x14d4('0x4')],this[_0x14d4('0x5')]['id'],this[_0x14d4('0x6')][_0x14d4('0x11')][this['agent']['id']],null,this[_0x14d4('0x3')]);util['writeLog'](this[_0x14d4('0x5')]['id'],this[_0x14d4('0x6')][_0x14d4('0x11')][this[_0x14d4('0xf')]['id']],_0x14d4('0x18')+(this[_0x14d4('0x3')][_0x14d4('0x13')]?_0x14d4('0x19'):''));}else{logger[_0x14d4('0x12')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x14d4('0xf')]['id']);setTimeout(this[_0x14d4('0x7')][_0x14d4('0x8')](this),0x3e8);}}};Agent[_0x14d4('0xc')][_0x14d4('0xe')]=function(_0x450e06){if(_['isNil'](this[_0x14d4('0x6')][_0x14d4('0x11')][this[_0x14d4('0xf')]['id']])){return logger[_0x14d4('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x14d4('0x5')]['id'],this[_0x14d4('0xf')]['id']);}else{logger[_0x14d4('0x12')](_0x14d4('0x1a'),this[_0x14d4('0x5')]['id'],this[_0x14d4('0xf')]['id']);util[_0x14d4('0x1b')](this[_0x14d4('0x4')],this['squeue']['id'],this[_0x14d4('0x6')]['agents'][this[_0x14d4('0xf')]['id']],null,this[_0x14d4('0x3')]);this['realtime'][_0x14d4('0x11')][this[_0x14d4('0xf')]['id']][_0x14d4('0x1c')]=![];this['realtime']['agents'][this[_0x14d4('0xf')]['id']]['busyQueue']=undefined;util[_0x14d4('0x1d')](this[_0x14d4('0x5')]['id'],this[_0x14d4('0x6')][_0x14d4('0x11')][this[_0x14d4('0xf')]['id']],_0x450e06?_0x14d4('0x1e'):_0x14d4('0x1f'));}if(!_0x450e06){setTimeout(this[_0x14d4('0x7')][_0x14d4('0x8')](this),0x3e8);}};function agent(_0x1ebf6e,_0x113085,_0x2ed3e7,_0x55241e){return new Agent(_0x1ebf6e,_0x113085,_0x2ed3e7,_0x55241e);}module['exports']=agent; \ No newline at end of file +var _0x3e18=['timeout','handleTimeout','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','notificationId','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','writeLog','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','squeue','realtime','handleRun','bind'];(function(_0x35f832,_0x459482){var _0x2ac223=function(_0x2e439f){while(--_0x2e439f){_0x35f832['push'](_0x35f832['shift']());}};_0x2ac223(++_0x459482);}(_0x3e18,0x19c));var _0x83e1=function(_0x3e08a9,_0xbea9b){_0x3e08a9=_0x3e08a9-0x0;var _0x2f3edd=_0x3e18[_0x3e08a9];return _0x2f3edd;};'use strict';var _=require(_0x83e1('0x0'));var uuid=require(_0x83e1('0x1'));var util=require('./util');var logger=require(_0x83e1('0x2'))(_0x83e1('0x3'));var Agent=function(_0x505af6,_0x223e67,_0x376480,_0x513101){this['notificationId']=uuid['v4']();this[_0x83e1('0x4')]=_0x505af6;this['agent']=_0x223e67;this[_0x83e1('0x5')]=_0x376480;this['routing']=_0x513101;this[_0x83e1('0x4')]['push'](this[_0x83e1('0x6')][_0x83e1('0x7')](this),this['handleTimeout'][_0x83e1('0x7')](this));this['squeue']['on'](_0x83e1('0x8'),this[_0x83e1('0x9')][_0x83e1('0x7')](this));this['squeue']['on']('drained',this[_0x83e1('0xa')][_0x83e1('0x7')](this));};Agent[_0x83e1('0xb')]['push']=function(){this[_0x83e1('0x4')][_0x83e1('0xc')](this[_0x83e1('0x6')][_0x83e1('0x7')](this),this[_0x83e1('0x9')]['bind'](this));};Agent[_0x83e1('0xb')][_0x83e1('0xa')]=function(){this[_0x83e1('0x9')](!![]);};Agent[_0x83e1('0xb')]['handleRun']=function(_0x1ac600){logger[_0x83e1('0xd')](_0x83e1('0xe'),this[_0x83e1('0x4')]['id'],this[_0x83e1('0xf')]['id']);if(_[_0x83e1('0x10')](this[_0x83e1('0x5')]['agents'][this[_0x83e1('0xf')]['id']])){logger['info'](_0x83e1('0x11'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x83e1('0x7')](this),0x3e8);}else{if(this[_0x83e1('0x3')]['forcedOwnership']||util[_0x83e1('0x12')](this[_0x83e1('0x4')]['id'],this['realtime'][_0x83e1('0x13')][this[_0x83e1('0xf')]['id']],this['squeue']['channel'],![])){this[_0x83e1('0x5')][_0x83e1('0x13')][this[_0x83e1('0xf')]['id']]['busy']=!![];this['realtime'][_0x83e1('0x13')][this[_0x83e1('0xf')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x83e1('0x14')],this[_0x83e1('0x4')]['id'],this[_0x83e1('0x5')][_0x83e1('0x13')][this['agent']['id']],null,this['routing']);util['writeLog'](this[_0x83e1('0x4')]['id'],this['realtime'][_0x83e1('0x13')][this[_0x83e1('0xf')]['id']],_0x83e1('0x15')+(this[_0x83e1('0x3')]['forcedOwnership']?_0x83e1('0x16'):''));}else{logger[_0x83e1('0xd')](_0x83e1('0x17'),this[_0x83e1('0x4')]['id'],this[_0x83e1('0xf')]['id']);setTimeout(this[_0x83e1('0xc')][_0x83e1('0x7')](this),0x3e8);}}};Agent['prototype'][_0x83e1('0x9')]=function(_0x4b6e0b){if(_[_0x83e1('0x10')](this[_0x83e1('0x5')][_0x83e1('0x13')][this[_0x83e1('0xf')]['id']])){return logger[_0x83e1('0xd')](_0x83e1('0x11'),this[_0x83e1('0x4')]['id'],this[_0x83e1('0xf')]['id']);}else{logger[_0x83e1('0xd')](_0x83e1('0x18'),this[_0x83e1('0x4')]['id'],this[_0x83e1('0xf')]['id']);util['hideNotification'](this['notificationId'],this[_0x83e1('0x4')]['id'],this[_0x83e1('0x5')]['agents'][this[_0x83e1('0xf')]['id']],null,this[_0x83e1('0x3')]);this[_0x83e1('0x5')][_0x83e1('0x13')][this[_0x83e1('0xf')]['id']][_0x83e1('0x19')]=![];this[_0x83e1('0x5')]['agents'][this[_0x83e1('0xf')]['id']][_0x83e1('0x1a')]=undefined;util[_0x83e1('0x1b')](this[_0x83e1('0x4')]['id'],this[_0x83e1('0x5')][_0x83e1('0x13')][this[_0x83e1('0xf')]['id']],_0x4b6e0b?_0x83e1('0x1c'):_0x83e1('0x1d'));}if(!_0x4b6e0b){setTimeout(this['push'][_0x83e1('0x7')](this),0x3e8);}};function agent(_0x55a6e4,_0x4d01ab,_0x37986c,_0x36009b){return new Agent(_0x55a6e4,_0x4d01ab,_0x37986c,_0x36009b);}module['exports']=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 0e757b5..a8b3f16 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 _0x3edc=['routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','RINGING','busy','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','TIMEOUT','busyQueue','lodash','uuid','./util','../../../../../config/logger'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x3dedad,_0x435b1f){_0x3dedad=_0x3dedad-0x0;var _0x5470ba=_0x3edc[_0x3dedad];return _0x5470ba;};'use strict';var _=require(_0xc3ed('0x0'));var uuid=require(_0xc3ed('0x1'));var util=require(_0xc3ed('0x2'));var logger=require(_0xc3ed('0x3'))(_0xc3ed('0x4'));var Beepall=function(_0x47a242,_0x2a8714,_0x47efb0,_0x3519ab){this[_0xc3ed('0x5')]=uuid['v4']();this[_0xc3ed('0x6')]=_0x47a242;this[_0xc3ed('0x7')]=_0x2a8714;this[_0xc3ed('0x8')]=_0x47efb0;this['routing']=_0x3519ab;this[_0xc3ed('0x6')][_0xc3ed('0x9')](this[_0xc3ed('0xa')][_0xc3ed('0xb')](this),this[_0xc3ed('0xc')][_0xc3ed('0xb')](this));this['squeue']['on'](_0xc3ed('0xd'),this[_0xc3ed('0xc')][_0xc3ed('0xb')](this));this['squeue']['on']('drained',this['handleDrained'][_0xc3ed('0xb')](this));};Beepall[_0xc3ed('0xe')][_0xc3ed('0x9')]=function(){this[_0xc3ed('0x6')][_0xc3ed('0x9')](this[_0xc3ed('0xa')][_0xc3ed('0xb')](this),this[_0xc3ed('0xc')][_0xc3ed('0xb')](this));};Beepall[_0xc3ed('0xe')]['handleDrained']=function(_0x450c05){this[_0xc3ed('0xc')](!![]);};Beepall[_0xc3ed('0xe')][_0xc3ed('0xa')]=function(_0x5f5d0b){var _0x5f487b=!![];if(!_['isNil'](this['queue'])&&!_[_0xc3ed('0xf')](this[_0xc3ed('0x7')]['Agents'])&&this[_0xc3ed('0x7')][_0xc3ed('0x10')]['length']>0x0){for(var _0x498d53=0x0,_0x3132ad;_0x498d530x0){for(var _0x540741=0x0,_0x2e1f8a;_0x5407410x0&&_0x2a1bdd[_0x3b118f+_0x7ef1('0x22')]>=_0x2a1bdd[_0x3b118f+'Capacity']){writeLog(_0x490162,_0x2a1bdd,_0x3b118f[_0x7ef1('0x23')]()+_0x7ef1('0x24'));return![];}}return!![];};exports[_0x7ef1('0x25')]=function(_0x4af5f5,_0x232f4e,_0x238fdc,_0x21e8c5,_0x58e7ee){return sendNotification(!![],_0x4af5f5,_0x232f4e,_0x238fdc,_0x21e8c5,_0x58e7ee);};exports[_0x7ef1('0x26')]=function(_0x4b0380,_0x3306b0,_0x2546bf,_0x4b5fde,_0x5f25de){return sendNotification(![],_0x4b0380,_0x3306b0,_0x2546bf,_0x4b5fde,_0x5f25de);};exports[_0x7ef1('0x27')]=writeLog; \ No newline at end of file +var _0xd101=['account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','info','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','split','\x20interaction'];(function(_0x17e982,_0x1cd5ca){var _0x333c1e=function(_0x3a9a6c){while(--_0x3a9a6c){_0x17e982['push'](_0x17e982['shift']());}};_0x333c1e(++_0x1cd5ca);}(_0xd101,0xc1));var _0x1d10=function(_0x1f27b4,_0x559ae4){_0x1f27b4=_0x1f27b4-0x0;var _0xc0933b=_0xd101[_0x1f27b4];return _0xc0933b;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var utils=require(_0x1d10('0x1'));var Mustache=require(_0x1d10('0x2'));var Redis=require(_0x1d10('0x3'));var config=require(_0x1d10('0x4'));var logger=require(_0x1d10('0x5'))(_0x1d10('0x6'));config[_0x1d10('0x7')]=_[_0x1d10('0x8')](config['redis'],{'host':_0x1d10('0x9'),'port':0x18eb});var io=require(_0x1d10('0xa'))(new Redis(config[_0x1d10('0x7')]));function emit(_0x27d569,_0xb9e08,_0x36335e){io['to'](_0x27d569)[_0x1d10('0xb')](_0xb9e08,_0x36335e);}function sendNotification(_0x43df2c,_0x3a15c8,_0x182c87,_0xf7926b,_0x14e4df,_0x1610b4){io['to'](util[_0x1d10('0xc')](_0x1d10('0xd'),_0xf7926b[_0x1d10('0xe')]))[_0x1d10('0xb')]('user:save',_0xf7926b);var _0x3a2050=_0x1610b4||{};var _0x93cb59=_0x182c87[_0x1d10('0xf')]('.');var _0x190d4c={'uniqueid':_0x3a15c8,'channel':_0x93cb59[0x0],'id':_0x93cb59[0x1],'title':_0x93cb59[0x0]+_0x1d10('0x10'),'interactionId':_0x93cb59[0x2],'queue':_0x14e4df?_0x14e4df['name']:null,'sound':_0x3a2050[_0x1d10('0x11')][_0x1d10('0x12')],'shake':_0x3a2050[_0x1d10('0x11')][_0x1d10('0x13')]};try{if(!_0x3a2050[_0x1d10('0x14')]){_0x3a2050[_0x1d10('0x14')]={};}if(_0x14e4df){_0x3a2050['body'][_0x1d10('0x15')]=_0x14e4df;}else if(_0x3a2050[_0x1d10('0x14')][_0x1d10('0x15')]){delete _0x3a2050[_0x1d10('0x14')]['queue'];}_0x190d4c[_0x1d10('0x16')]=utils[_0x1d10('0x17')](_0x3a2050[_0x1d10('0x11')][_0x1d10('0x18')],_0x3a2050);}catch(_0x1b2051){_0x190d4c[_0x1d10('0x16')]=_0x1d10('0x19');logger['error'](util[_0x1d10('0xc')](_0x1d10('0x1a'),_0x3a15c8,_0x1b2051[_0x1d10('0x1b')]));}io['to'](util[_0x1d10('0xc')](_0x1d10('0xd'),_0xf7926b['name']))['emit'](util[_0x1d10('0xc')]('notification:%s',_0x43df2c?'save':'remove'),_0x190d4c);}function writeLog(_0x237b92,_0x2496bc,_0x24717c){return logger[_0x1d10('0x1c')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x237b92,_0x2496bc[_0x1d10('0xe')],_0x24717c));}exports['isAgentAvailable']=function(_0x68b09,_0x474321,_0x160802,_0x37f22d){if(_0x474321[_0x1d10('0x1d')]){writeLog(_0x68b09,_0x474321,_0x1d10('0x1e'));return![];}if(!_0x474321[_0x1d10('0x1f')]){writeLog(_0x68b09,_0x474321,_0x1d10('0x20'));return![];}if(_0x474321[_0x160802+_0x1d10('0x21')]){writeLog(_0x68b09,_0x474321,_0x1d10('0x22'));return![];}if(_0x37f22d&&_0x474321[_0x1d10('0x23')](_0x160802+'Capacity')&&_0x474321[_0x1d10('0x23')](_0x160802+_0x1d10('0x24'))){if(_0x474321[_0x160802+_0x1d10('0x25')]>0x0&&_0x474321[_0x160802+_0x1d10('0x24')]>=_0x474321[_0x160802+_0x1d10('0x25')]){writeLog(_0x68b09,_0x474321,_0x160802[_0x1d10('0x26')]()+_0x1d10('0x27'));return![];}}return!![];};exports[_0x1d10('0x28')]=function(_0x4f7837,_0x355e10,_0x24eb47,_0x59b5eb,_0x13a3dc){return sendNotification(!![],_0x4f7837,_0x355e10,_0x24eb47,_0x59b5eb,_0x13a3dc);};exports['hideNotification']=function(_0x4db221,_0x41b5b8,_0x597aea,_0xa4e6aa,_0x21a02e){return sendNotification(![],_0x4db221,_0x41b5b8,_0x597aea,_0xa4e6aa,_0x21a02e);};exports[_0x1d10('0x29')]=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 8401be5..a1952ef 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 _0x078a=['next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','isObject','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','info'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x078a,0x1c1));var _0xa078=function(_0x3fe5cf,_0x54f96c){_0x3fe5cf=_0x3fe5cf-0x0;var _0x1115f4=_0x078a[_0x3fe5cf];return _0x1115f4;};'use strict';var schema=require(_0xa078('0x0'));var sh=require(_0xa078('0x1'));var _=require(_0xa078('0x2'));var utils=require('./utils');var logger=require(_0xa078('0x3'))(_0xa078('0x4'));var system=schema({'command':{'type':_0xa078('0x5'),'required':!![],'message':_0xa078('0x6')}});exports[_0xa078('0x7')]=function(_0x3fe945,_0x2b150f){return function(_0x410d79){try{var _0x3ba0d={'command':_0x2b150f[0x0]};var _0x330a65=system[_0xa078('0x0')](_0x3ba0d,{'typecast':!![]});if(_0x330a65['length']){logger[_0xa078('0x8')](_0xa078('0x9'),_0x3fe945,_[_0xa078('0xa')](_0x330a65,_0xa078('0xb'))['join'](',\x20'));logger[_0xa078('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3fe945);_0x410d79[_0xa078('0xd')]();}else{var _0xd20509=this;var _0x55ccb3=utils[_0xa078('0xe')](_0x2b150f[0x0],this);logger[_0xa078('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x3fe945,_0x55ccb3);sh['exec'](_[_0xa078('0xf')](_0x55ccb3),function(_0x2245f4,_0x811453){logger[_0xa078('0xc')](_0xa078('0x10'),_0x3fe945,_0x2245f4);if(_0x2245f4==0x0){var _0x24654c=_0x811453[_0xa078('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xa078('0x12')](_0x2b150f[0x1])||_[_0xa078('0x13')](_0x2b150f[0x1])){logger[_0xa078('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x3fe945);_0xd20509[_0xa078('0x14')][_0x2b150f[0x1]]=_0x24654c;}else{logger[_0xa078('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3fe945,_0x2b150f[0x1],_0x24654c);_0xd20509[_0xa078('0x14')][_0x2b150f[0x1]]=_0x24654c;}}_0x410d79['next']();});}}catch(_0x1bdd3a){logger['error']('[%s][SYSTEM]\x20%s',_0x3fe945,_[_0xa078('0x15')](_0x1bdd3a)?JSON['stringify'](_0x1bdd3a):_0x1bdd3a);logger[_0xa078('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3fe945);_0x410d79['next']();}};}; \ No newline at end of file +var _0x4717=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','shelljs','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','map','message','join','info'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4717,0x1e1));var _0x7471=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x4717[_0x3de8a4];return _0x4635cf;};'use strict';var schema=require('validate');var sh=require(_0x7471('0x0'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x7471('0x1'))(_0x7471('0x2'));var system=schema({'command':{'type':_0x7471('0x3'),'required':!![],'message':_0x7471('0x4')}});exports[_0x7471('0x5')]=function(_0x39dc81,_0x361c12){return function(_0x248a56){try{var _0x3220ea={'command':_0x361c12[0x0]};var _0x1e1a3f=system[_0x7471('0x6')](_0x3220ea,{'typecast':!![]});if(_0x1e1a3f[_0x7471('0x7')]){logger['error'](_0x7471('0x8'),_0x39dc81,_[_0x7471('0x9')](_0x1e1a3f,_0x7471('0xa'))[_0x7471('0xb')](',\x20'));logger[_0x7471('0xc')](_0x7471('0xd'),_0x39dc81);_0x248a56[_0x7471('0xe')]();}else{var _0x24faa7=this;var _0x14229e=utils['getMustacheRender'](_0x361c12[0x0],this);logger['info'](_0x7471('0xf'),_0x39dc81,_0x14229e);sh[_0x7471('0x10')](_['trim'](_0x14229e),function(_0xb750b8,_0x33f07f){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x39dc81,_0xb750b8);if(_0xb750b8==0x0){var _0x52bb65=_0x33f07f[_0x7471('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x7471('0x12')](_0x361c12[0x1])||_[_0x7471('0x13')](_0x361c12[0x1])){logger[_0x7471('0xc')](_0x7471('0x14'),_0x39dc81);_0x24faa7[_0x7471('0x15')][_0x361c12[0x1]]=_0x52bb65;}else{logger[_0x7471('0xc')](_0x7471('0x16'),_0x39dc81,_0x361c12[0x1],_0x52bb65);_0x24faa7[_0x7471('0x15')][_0x361c12[0x1]]=_0x52bb65;}}_0x248a56[_0x7471('0xe')]();});}}catch(_0x49f518){logger[_0x7471('0x17')]('[%s][SYSTEM]\x20%s',_0x39dc81,_[_0x7471('0x18')](_0x49f518)?JSON[_0x7471('0x19')](_0x49f518):_0x49f518);logger[_0x7471('0xc')](_0x7471('0xd'),_0x39dc81);_0x248a56['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index d68c166..08f3f02 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 _0x1e76=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','[%s][TAG]\x20%s','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction'];(function(_0x21cf14,_0x2e5991){var _0x5b44e7=function(_0x1ff660){while(--_0x1ff660){_0x21cf14['push'](_0x21cf14['shift']());}};_0x5b44e7(++_0x2e5991);}(_0x1e76,0x96));var _0x61e7=function(_0x23841d,_0x1a2a41){_0x23841d=_0x23841d-0x0;var _0x46e261=_0x1e76[_0x23841d];return _0x46e261;};'use strict';var schema=require(_0x61e7('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x61e7('0x1')),'openchannelInteraction':require(_0x61e7('0x2')),'smsInteraction':require(_0x61e7('0x3')),'mailInteraction':require(_0x61e7('0x4')),'faxInteraction':require(_0x61e7('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x61e7('0x6')}});exports[_0x61e7('0x7')]=function(_0xa1369a,_0x2b69fa,_0x2c7775,_0x15761c){return function(_0x5d723a){try{var _0x590d2e={'tag':_0x2b69fa[0x0]};var _0x24128f=tag[_0x61e7('0x0')](_0x590d2e,{'typecast':!![]});if(_0x24128f[_0x61e7('0x8')]){logger[_0x61e7('0x9')]('[%s][TAG]\x20%s',_0xa1369a,_['map'](_0x24128f,_0x61e7('0xa'))['join'](',\x20'));logger[_0x61e7('0xb')](_0x61e7('0xc'),_0xa1369a);_0x5d723a[_0x61e7('0xd')]();}else{var _0x544058={'ids':[_0x2b69fa[0x0]]};if(rpc[_0x15761c[_0x61e7('0xe')]+_0x61e7('0xf')]){rpc[_0x15761c[_0x61e7('0xe')]+'Interaction'][_0x61e7('0x10')](_0x15761c[_0x61e7('0x11')]['id'],_0x544058)[_0x61e7('0x12')](function(_0x30bb1c){logger['info'](_0x61e7('0x13'),_0xa1369a,_0x2b69fa[0x1],_0x15761c[_0x61e7('0xe')],_0x15761c['interaction']['id']);})[_0x61e7('0x14')](function(_0xc0a03d){logger['error']('[%s][TAG]\x20%s',_0xa1369a,JSON[_0x61e7('0x15')](_0xc0a03d));logger['info'](_0x61e7('0xc'),_0xa1369a);})[_0x61e7('0x16')](function(){_0x5d723a[_0x61e7('0xd')]();});}}}catch(_0x2582bf){logger[_0x61e7('0x9')](_0x61e7('0x17'),_0xa1369a,_['isObject'](_0x2582bf)?JSON[_0x61e7('0x15')](_0x2582bf):_0x2582bf);logger[_0x61e7('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xa1369a);_0x5d723a[_0x61e7('0xd')]();}};}; \ No newline at end of file +var _0x9448=['../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','next','error','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x47087,_0x24eadd){var _0x2fba8c=function(_0x343679){while(--_0x343679){_0x47087['push'](_0x47087['shift']());}};_0x2fba8c(++_0x24eadd);}(_0x9448,0x173));var _0x8944=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x9448[_0x31b5b2];return _0x364f13;};'use strict';var schema=require('validate');var _=require(_0x8944('0x0'));var rpc={'chatInteraction':require(_0x8944('0x1')),'openchannelInteraction':require(_0x8944('0x2')),'smsInteraction':require(_0x8944('0x3')),'mailInteraction':require(_0x8944('0x4')),'faxInteraction':require(_0x8944('0x5')),'whatsappInteraction':require(_0x8944('0x6'))};var logger=require(_0x8944('0x7'))(_0x8944('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x8944('0x9')}});exports[_0x8944('0xa')]=function(_0x4852d3,_0x41f80d,_0x512ea9,_0x19d2e2){return function(_0x149245){try{var _0x549eb2={'tag':_0x41f80d[0x0]};var _0x166bed=tag[_0x8944('0xb')](_0x549eb2,{'typecast':!![]});if(_0x166bed['length']){logger['error']('[%s][TAG]\x20%s',_0x4852d3,_[_0x8944('0xc')](_0x166bed,'message')['join'](',\x20'));logger[_0x8944('0xd')](_0x8944('0xe'),_0x4852d3);_0x149245['next']();}else{var _0x3ac6af={'ids':[_0x41f80d[0x0]]};if(rpc[_0x19d2e2[_0x8944('0xf')]+_0x8944('0x10')]){rpc[_0x19d2e2['channel']+_0x8944('0x10')]['addTags'](_0x19d2e2[_0x8944('0x11')]['id'],_0x3ac6af)[_0x8944('0x12')](function(_0x410029){logger[_0x8944('0xd')](_0x8944('0x13'),_0x4852d3,_0x41f80d[0x1],_0x19d2e2['channel'],_0x19d2e2['interaction']['id']);})[_0x8944('0x14')](function(_0x540054){logger['error'](_0x8944('0x15'),_0x4852d3,JSON[_0x8944('0x16')](_0x540054));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4852d3);})[_0x8944('0x17')](function(){_0x149245[_0x8944('0x18')]();});}}}catch(_0x379764){logger[_0x8944('0x19')](_0x8944('0x15'),_0x4852d3,_[_0x8944('0x1a')](_0x379764)?JSON[_0x8944('0x16')](_0x379764):_0x379764);logger['info'](_0x8944('0xe'),_0x4852d3);_0x149245[_0x8944('0x18')]();}};}; \ 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 8bd5cc9..64462c7 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x318412,_0x332841){var _0x22ecd2=function(_0x3ed926){while(--_0x3ed926){_0x318412['push'](_0x318412['shift']());}};_0x22ecd2(++_0x332841);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x5c9180,_0x46865b){var _0x4205cf=function(_0x146af8){while(--_0x146af8){_0x5c9180['push'](_0x5c9180['shift']());}};_0x4205cf(++_0x46865b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 248d66b..8cd70d5 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 _0x7560=['routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','Intervals','isNil','interval','listen','rules','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','channel','mail','push','slice','split','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','./interval','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','error','execute','info','Applications\x20executed','stringify','emit','complete','stack'];(function(_0x2cb563,_0xd8dbbe){var _0x4845b9=function(_0x57ed54){while(--_0x57ed54){_0x2cb563['push'](_0x2cb563['shift']());}};_0x4845b9(++_0xd8dbbe);}(_0x7560,0x1ee));var _0x0756=function(_0x1071d6,_0x293323){_0x1071d6=_0x1071d6-0x0;var _0x4c6be4=_0x7560[_0x1071d6];return _0x4c6be4;};'use strict';var _=require('lodash');var util=require(_0x0756('0x0'));var path=require(_0x0756('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x0756('0x2'));var uuid=require(_0x0756('0x3'));var config=require(_0x0756('0x4'));var logger=require(_0x0756('0x5'))(_0x0756('0x6'));var rpc={'openchannelQueueReport':require(_0x0756('0x7')),'mailQueueReport':require(_0x0756('0x8')),'chatQueueReport':require(_0x0756('0x9')),'smsQueueReport':require(_0x0756('0xa')),'faxQueueReport':require(_0x0756('0xb')),'whatsappQueueReport':require(_0x0756('0xc'))};var RuleEngine=require(_0x0756('0xd'));function getId(_0x716b53,_0xa7002e,_0x5d90cf){return util['format'](_0x0756('0xe'),_0x716b53,_0xa7002e||0x0,_0x5d90cf||0x0);}function getIntervals(_0x691384,_0x3d67a0){var _0x4d98ff=[];if(!_['isNil'](_0x3d67a0[_0x0756('0xf')])&&!_['isNil'](_0x691384[_0x3d67a0['IntervalId']])&&!_['isNil'](_0x691384[_0x3d67a0[_0x0756('0xf')]][_0x0756('0x10')])){_0x4d98ff=_['map'](_0x691384[_0x3d67a0[_0x0756('0xf')]]['Intervals'],'interval');}else if(!_[_0x0756('0x11')](_0x3d67a0[_0x0756('0x12')])){_0x4d98ff=[_0x3d67a0['interval']];}return _0x4d98ff;}exports[_0x0756('0x13')]=function(_0x511355){_0x511355[_0x0756('0x14')]={};return new BPromise(function(_0x3554bf,_0x53a4e2){var _0x1fe997={'Start':function(_0x7b7504){var _0x367856=this;return new Promise(function(_0x4fc786,_0x11509b){if(_0x7b7504){try{var _0x3caa16=[];var _0x4f6862=getId(_0x7b7504['channel'],_0x7b7504[_0x0756('0x15')]?_0x7b7504['message']['id']:0x0,_0x7b7504[_0x0756('0x16')]?_0x7b7504[_0x0756('0x16')]['id']:0x0);if(_0x7b7504['applications']&&_[_0x0756('0x17')](_0x7b7504[_0x0756('0x18')])&&_0x7b7504[_0x0756('0x18')][_0x0756('0x19')]){for(var _0x40121f=0x0;_0x40121f<_0x7b7504['applications'][_0x0756('0x19')];_0x40121f+=0x1){var _0x403bcd=_0x7b7504[_0x0756('0x18')][_0x40121f];if(fs[_0x0756('0x1a')](path[_0x0756('0x1b')](__dirname,_0x0756('0x18'),_0x403bcd[_0x0756('0x1c')]+_0x0756('0x1d')))){var _0x30610c=[];switch(_0x403bcd[_0x0756('0x1c')][_0x0756('0x1e')]()){case _0x0756('0x1f'):var _0x38f0dd=_0x403bcd[_0x0756('0x20')]['split'](',');if(_0x7b7504[_0x0756('0x21')]===_0x0756('0x22')){_0x30610c['push'](_0x38f0dd[0x0]);_0x30610c[_0x0756('0x23')](_0x38f0dd[0x1]);_0x30610c[_0x0756('0x23')](_0x38f0dd[_0x0756('0x24')](0x2,_0x38f0dd[_0x0756('0x19')])[_0x0756('0x1b')](','));}else{_0x30610c[_0x0756('0x23')](_0x38f0dd[0x0]);_0x30610c[_0x0756('0x23')](_0x38f0dd[_0x0756('0x24')](0x1,_0x38f0dd[_0x0756('0x19')])[_0x0756('0x1b')](','));}break;case'dialogflow':var _0x3fc4c6=_0x403bcd[_0x0756('0x20')][_0x0756('0x25')](',');_0x30610c[_0x0756('0x23')](_0x3fc4c6[0x0]);_0x30610c[_0x0756('0x23')](_0x3fc4c6[0x1]);_0x30610c[_0x0756('0x23')](_0x3fc4c6[_0x0756('0x24')](0x2,_0x3fc4c6[_0x0756('0x19')])[_0x0756('0x1b')](','));break;case _0x0756('0x26'):var _0xf9fafe=_0x403bcd[_0x0756('0x20')][_0x0756('0x25')](',');_0x30610c[_0x0756('0x23')](_0xf9fafe[0x0]);_0x30610c[_0x0756('0x23')](_0xf9fafe[0x1]);_0x30610c[_0x0756('0x23')](_0xf9fafe[0x2]);_0x30610c[_0x0756('0x23')](_0xf9fafe[0x3]);_0x30610c[_0x0756('0x23')](_0xf9fafe[_0x0756('0x24')](0x4,_0xf9fafe[_0x0756('0x19')])[_0x0756('0x1b')](','));break;case _0x0756('0x27'):var _0x35837d=_0x403bcd[_0x0756('0x20')]['split'](',');_0x30610c[_0x0756('0x23')](_0x35837d[0x0]);_0x30610c[_0x0756('0x23')](_0x35837d[0x1]);_0x30610c[_0x0756('0x23')](_0x35837d[0x2]);_0x30610c[_0x0756('0x23')](_0x35837d[0x3]);_0x30610c[_0x0756('0x23')](_0x35837d[_0x0756('0x24')](0x4,_0x35837d[_0x0756('0x19')])[_0x0756('0x1b')](','));break;case _0x0756('0x15'):_0x30610c[_0x0756('0x23')](_0x403bcd[_0x0756('0x20')]);break;case _0x0756('0x28'):_0x30610c[_0x0756('0x23')](_0x403bcd[_0x0756('0x29')]);_0x30610c['push'](_0x403bcd['appdata']);break;default:_0x30610c=_[_0x0756('0x11')](_0x403bcd['appdata'])?[]:_0x403bcd[_0x0756('0x20')]['split'](',');}var _0x47ce4e={'id':util[_0x0756('0x2a')](_0x0756('0x2b'),_0x4f6862,_0x403bcd['id'],_0x403bcd[_0x0756('0x1c')]),'condition':require(_0x0756('0x2c'))['condition'](_0x4f6862,getIntervals(_0x511355[_0x0756('0x2d')],_0x403bcd),_0x511355),'consequence':require(_0x0756('0x2e')+_0x403bcd[_0x0756('0x1c')])['consequence'](_0x4f6862,_0x30610c,_0x511355,_0x7b7504),'p':_0x403bcd[_0x0756('0x2f')]||0x0};logger['info'](_0x0756('0x30'),_0x47ce4e['id'],_0x0756('0x31'),getIntervals(_0x511355[_0x0756('0x2d')],_0x403bcd)[_0x0756('0x1b')]('\x20|\x20'));_0x3caa16[_0x0756('0x23')](_0x47ce4e);}else{logger[_0x0756('0x32')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x0756('0x1b')](__dirname,_0x0756('0x18'),_0x403bcd[_0x0756('0x1c')]+_0x0756('0x1d')));}}_0x511355[_0x0756('0x14')][_0x4f6862]=new RuleEngine(_0x3caa16);_0x511355[_0x0756('0x14')][_0x4f6862][_0x0756('0x33')](_0x7b7504,function(_0x2198a1){logger[_0x0756('0x34')](_0x0756('0x35'),JSON[_0x0756('0x36')](_0x2198a1['matchPath']));if(_0x511355[_0x0756('0x14')][_0x4f6862]){_0x511355[_0x0756('0x14')][_0x4f6862][_0x0756('0x37')](_0x0756('0x38'));}});return _0x4fc786({'code':0xc8,'message':_0x7b7504});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x4fc786({'code':0xc8,'message':_0x7b7504});}}catch(_0x3f7a63){logger[_0x0756('0x32')](_0x3f7a63[_0x0756('0x39')]);return _0x11509b(_0x367856['error'](0x1f4,_0x3f7a63));}}return _0x11509b(_0x0756('0x3a'));});},'AcceptMessage':function(_0x3aeed4){var _0x3325f3=this;return new Promise(function(_0x4049a1,_0x305c5d){if(_0x3aeed4['agent']&&_0x3aeed4[_0x0756('0x3b')]['id']){if(_0x511355['agents'][_0x3aeed4[_0x0756('0x3b')]['id']]){_0x511355[_0x0756('0x3c')][_0x3aeed4[_0x0756('0x3b')]['id']][_0x0756('0x3d')]=![];_0x511355['agents'][_0x3aeed4[_0x0756('0x3b')]['id']][_0x0756('0x3e')]=undefined;}}if(_0x3aeed4[_0x0756('0x15')]&&_0x3aeed4[_0x0756('0x15')]['id']){try{var _0x4e9737=getId(_0x3aeed4[_0x0756('0x21')],_0x3aeed4[_0x0756('0x15')]?_0x3aeed4[_0x0756('0x15')]['id']:0x0,_0x3aeed4['interaction']?_0x3aeed4[_0x0756('0x16')]['id']:0x0);if(_0x511355[_0x0756('0x14')][_0x4e9737]){_0x511355['rules'][_0x4e9737][_0x0756('0x37')]('end');if(rpc[_0x3aeed4[_0x0756('0x21')]+_0x0756('0x3f')]){rpc[_0x3aeed4[_0x0756('0x21')]+_0x0756('0x3f')][_0x0756('0x40')](_0x4e9737,{'UserId':_0x3aeed4['message'][_0x0756('0x41')]})['catch'](function(_0x5f1fd8){logger[_0x0756('0x32')](_0x0756('0x42'));});}}return _0x4049a1({'code':0xc8,'message':_0x3aeed4});}catch(_0x559e7d){logger[_0x0756('0x32')](_0x559e7d[_0x0756('0x39')]);return _0x305c5d(_0x3325f3['error'](0x1f4,_0x559e7d));}}logger[_0x0756('0x32')](_0x0756('0x43'));return _0x305c5d(_0x3325f3[_0x0756('0x32')](0x1f4,_0x0756('0x43')));});},'RejectMessage':function(_0x179031){var _0x4bef29=this;return new Promise(function(_0x14b338,_0x51a350){if(_0x179031[_0x0756('0x3b')]&&_0x179031[_0x0756('0x3b')]['id']){try{if(_0x511355[_0x0756('0x3c')][_0x179031[_0x0756('0x3b')]['id']]){_0x511355[_0x0756('0x3c')][_0x179031[_0x0756('0x3b')]['id']][_0x0756('0x3d')]=![];_0x511355[_0x0756('0x3c')][_0x179031[_0x0756('0x3b')]['id']][_0x0756('0x3e')]=undefined;}return _0x14b338({'code':0xc8,'message':_0x179031});}catch(_0x55cf59){logger[_0x0756('0x32')](_0x55cf59[_0x0756('0x39')]);return _0x51a350(_0x4bef29['error'](0x1f4,_0x55cf59));}}logger[_0x0756('0x32')]('message\x20is\x20empty');return _0x51a350(_0x4bef29[_0x0756('0x32')](0x1f4,_0x0756('0x43')));});},'AbandonInteraction':function(_0x3b2660){var _0x498056=this;return new Promise(function(_0x25318c,_0x2f9279){if(_0x3b2660[_0x0756('0x21')]&&_0x3b2660['interaction']&&_0x3b2660[_0x0756('0x16')]['id']){try{var _0x3e83ba=getId(_0x3b2660[_0x0756('0x21')],_0x3b2660[_0x0756('0x15')]?_0x3b2660['message']['id']:0x0,_0x3b2660[_0x0756('0x16')]?_0x3b2660[_0x0756('0x16')]['id']:0x0);if(_0x511355['rules'][_0x3e83ba]){_0x511355[_0x0756('0x14')][_0x3e83ba][_0x0756('0x37')](_0x0756('0x44'));}return _0x25318c({'code':0xc8,'message':_0x3b2660});}catch(_0x58e887){logger['error'](_0x58e887[_0x0756('0x39')]);return _0x2f9279(_0x498056[_0x0756('0x32')](0x1f4,_0x58e887));}}logger['error'](_0x0756('0x43'));return _0x2f9279(_0x498056[_0x0756('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5b8321){var _0xeaaba7=this;return new Promise(function(_0x5c23f2,_0x2d8f15){if(_0x511355[_0x0756('0x3c')][_0x0756('0x45')](_0x5b8321['id'])){for(var _0x115bbf in _0x5b8321[_0x0756('0x46')]){if(_0x5b8321[_0x0756('0x46')]['hasOwnProperty'](_0x115bbf)){if(_0x511355[_0x0756('0x3c')][_0x5b8321['id']][_0x0756('0x45')](_0x115bbf+_0x0756('0x47'))){_0x511355[_0x0756('0x3c')][_0x5b8321['id']][_0x115bbf+_0x0756('0x47')]=parseInt(_0x5b8321[_0x0756('0x46')][_0x115bbf],0xa);}}}_0x511355['agents'][_0x5b8321['id']][_0x0756('0x48')]();return _0x5c23f2({'code':0xc8,'message':_0x511355[_0x0756('0x3c')][_0x5b8321['id']]});}else{return _0x2d8f15(_0xeaaba7['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3f4880){return new Promise(function(_0x3f093c,_0x33111f){var _0x547fae=_[_0x0756('0x49')](_0x511355[_0x0756('0x3c')]);_0x3f093c({'count':_0x547fae['length'],'rows':_0x547fae});});},'ChatQueues':function(_0x59a9ff){return new Promise(function(_0x5b2aae,_0x560315){var _0x207b26=[];for(var _0xfee24a in _0x511355['chatQueues']){if(_0x511355['chatQueues']['hasOwnProperty'](_0xfee24a)){var _0x55f650=_0x511355[_0x0756('0x4a')][_0xfee24a];var _0x1ed7fe={'id':_0x55f650['id'],'available':_0x55f650[_0x0756('0x4b')],'loggedIn':_0x55f650[_0x0756('0x4c')],'name':_0x55f650[_0x0756('0x4d')],'paused':_0x55f650[_0x0756('0x4e')],'waiting':_0x55f650[_0x0756('0x4f')]};_0x207b26[_0x0756('0x23')](_0x1ed7fe);}}_0x5b2aae({'count':_0x207b26[_0x0756('0x19')],'rows':_0x207b26});});},'MailQueues':function(_0x13b027){return new Promise(function(_0x1fb6cd,_0x1939d0){var _0x8f16a7=[];for(var _0x4363a0 in _0x511355['mailQueues']){if(_0x511355[_0x0756('0x50')][_0x0756('0x45')](_0x4363a0)){var _0x142872=_0x511355[_0x0756('0x50')][_0x4363a0];var _0x416410={'id':_0x142872['id'],'available':_0x142872[_0x0756('0x4b')],'loggedIn':_0x142872[_0x0756('0x4c')],'name':_0x142872[_0x0756('0x4d')],'paused':_0x142872[_0x0756('0x4e')],'waiting':_0x142872['waiting']};_0x8f16a7[_0x0756('0x23')](_0x416410);}}_0x1fb6cd({'count':_0x8f16a7[_0x0756('0x19')],'rows':_0x8f16a7});});},'OpenchannelQueues':function(_0x5948b5){return new Promise(function(_0x52d700,_0x16c296){var _0x3de3b0=[];for(var _0x4a3910 in _0x511355['openchannelQueues']){if(_0x511355['openchannelQueues'][_0x0756('0x45')](_0x4a3910)){var _0x2270a4=_0x511355[_0x0756('0x51')][_0x4a3910];var _0x546bc9={'id':_0x2270a4['id'],'available':_0x2270a4['available'],'loggedIn':_0x2270a4[_0x0756('0x4c')],'name':_0x2270a4[_0x0756('0x4d')],'paused':_0x2270a4[_0x0756('0x4e')],'waiting':_0x2270a4[_0x0756('0x4f')]};_0x3de3b0[_0x0756('0x23')](_0x546bc9);}}_0x52d700({'count':_0x3de3b0[_0x0756('0x19')],'rows':_0x3de3b0});});},'SmsQueues':function(_0x10b1ec){return new Promise(function(_0x5d85fc,_0x1ce6c7){var _0x50153d=[];for(var _0x54968d in _0x511355[_0x0756('0x52')]){if(_0x511355['smsQueues'][_0x0756('0x45')](_0x54968d)){var _0xf1bf79=_0x511355[_0x0756('0x52')][_0x54968d];var _0x2048f3={'id':_0xf1bf79['id'],'available':_0xf1bf79[_0x0756('0x4b')],'loggedIn':_0xf1bf79['loggedIn'],'name':_0xf1bf79[_0x0756('0x4d')],'paused':_0xf1bf79[_0x0756('0x4e')],'waiting':_0xf1bf79[_0x0756('0x4f')]};_0x50153d[_0x0756('0x23')](_0x2048f3);}}_0x5d85fc({'count':_0x50153d['length'],'rows':_0x50153d});});},'FaxQueues':function(_0x32645b){return new Promise(function(_0xbcd410,_0x55aedd){var _0x8219ac=[];for(var _0x517bb6 in _0x511355[_0x0756('0x53')]){if(_0x511355['faxQueues']['hasOwnProperty'](_0x517bb6)){var _0x1e2870=_0x511355[_0x0756('0x53')][_0x517bb6];var _0x252972={'id':_0x1e2870['id'],'available':_0x1e2870[_0x0756('0x4b')],'loggedIn':_0x1e2870[_0x0756('0x4c')],'name':_0x1e2870[_0x0756('0x4d')],'paused':_0x1e2870['paused'],'waiting':_0x1e2870['waiting']};_0x8219ac['push'](_0x252972);}}_0xbcd410({'count':_0x8219ac['length'],'rows':_0x8219ac});});},'WhatsappQueues':function(_0x5d6a8f){return new Promise(function(_0x1fb6b8,_0x5ebc44){var _0x1d1253=[];for(var _0xffaa37 in _0x511355['whatsappQueues']){if(_0x511355[_0x0756('0x54')][_0x0756('0x45')](_0xffaa37)){var _0x2a39ea=_0x511355[_0x0756('0x54')][_0xffaa37];var _0x13e37c={'id':_0x2a39ea['id'],'available':_0x2a39ea['available'],'loggedIn':_0x2a39ea[_0x0756('0x4c')],'name':_0x2a39ea[_0x0756('0x4d')],'paused':_0x2a39ea[_0x0756('0x4e')],'waiting':_0x2a39ea['waiting']};_0x1d1253['push'](_0x13e37c);}}_0x1fb6b8({'count':_0x1d1253['length'],'rows':_0x1d1253});});},'ChatQueuesWaitingInteractions':function(_0x288e3b){return new Promise(function(_0x53e601,_0x582f32){var _0x25ce91=_[_0x0756('0x49')](_0x511355['chatQueuesWaitingInteractions']);_0x53e601({'count':_0x25ce91['length'],'rows':_0x25ce91});});},'MailQueuesWaitingInteractions':function(_0x561610){return new Promise(function(_0x1c372d,_0x1ac4fb){var _0xff5802=_[_0x0756('0x49')](_0x511355[_0x0756('0x55')]);_0x1c372d({'count':_0xff5802[_0x0756('0x19')],'rows':_0xff5802});});},'OpenchannelQueuesWaitingInteractions':function(_0x286fba){return new Promise(function(_0xfa2367,_0x510613){var _0x455f72=_[_0x0756('0x49')](_0x511355['openchannelQueuesWaitingInteractions']);_0xfa2367({'count':_0x455f72[_0x0756('0x19')],'rows':_0x455f72});});},'SmsQueuesWaitingInteractions':function(_0x56dc98){return new Promise(function(_0x5b864c,_0x9c574a){var _0x32edeb=_['values'](_0x511355[_0x0756('0x56')]);_0x5b864c({'count':_0x32edeb[_0x0756('0x19')],'rows':_0x32edeb});});},'FaxQueuesWaitingInteractions':function(_0x307379){return new Promise(function(_0x1aa446,_0x162ee6){var _0x26f672=_[_0x0756('0x49')](_0x511355['faxQueuesWaitingInteractions']);_0x1aa446({'count':_0x26f672['length'],'rows':_0x26f672});});},'WhatsappQueuesWaitingInteractions':function(_0x1923d7){return new Promise(function(_0x5ae06e,_0x4b39d2){var _0x39b2fb=_['values'](_0x511355['whatsappQueuesWaitingInteractions']);_0x5ae06e({'count':_0x39b2fb[_0x0756('0x19')],'rows':_0x39b2fb});});}};var _0x122f35=jayson[_0x0756('0x57')](_0x1fe997)[_0x0756('0x58')]();_0x122f35['on']('error',function(_0x4a4afc){logger[_0x0756('0x32')](JSON[_0x0756('0x36')](_0x4a4afc));return _0x53a4e2(_0x4a4afc);});_0x122f35[_0x0756('0x13')](0x232c,_0x0756('0x59'),function(){console[_0x0756('0x5a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3554bf(_0x0756('0x5b')+0x232c);});});}; \ No newline at end of file +var _0xfaca=['bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','app','toLowerCase','appdata','split','push','slice','join','dialogflow','dialogflowv2','amazonlex','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise'];(function(_0x2fcc91,_0x3fdbde){var _0x4a4d78=function(_0x1699af){while(--_0x1699af){_0x2fcc91['push'](_0x2fcc91['shift']());}};_0x4a4d78(++_0x3fdbde);}(_0xfaca,0x114));var _0xafac=function(_0x4701a3,_0x107b3b){_0x4701a3=_0x4701a3-0x0;var _0x30e6aa=_0xfaca[_0x4701a3];return _0x30e6aa;};'use strict';var _=require(_0xafac('0x0'));var util=require(_0xafac('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xafac('0x2'));var BPromise=require(_0xafac('0x3'));var uuid=require(_0xafac('0x4'));var config=require(_0xafac('0x5'));var logger=require(_0xafac('0x6'))(_0xafac('0x7'));var rpc={'openchannelQueueReport':require(_0xafac('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xafac('0x9')),'faxQueueReport':require(_0xafac('0xa')),'whatsappQueueReport':require(_0xafac('0xb'))};var RuleEngine=require(_0xafac('0xc'));function getId(_0x1f48ae,_0x57b978,_0x13ed3b){return util[_0xafac('0xd')](_0xafac('0xe'),_0x1f48ae,_0x57b978||0x0,_0x13ed3b||0x0);}function getIntervals(_0x2df8fb,_0x48f516){var _0x2c11ae=[];if(!_[_0xafac('0xf')](_0x48f516['IntervalId'])&&!_['isNil'](_0x2df8fb[_0x48f516[_0xafac('0x10')]])&&!_[_0xafac('0xf')](_0x2df8fb[_0x48f516[_0xafac('0x10')]][_0xafac('0x11')])){_0x2c11ae=_[_0xafac('0x12')](_0x2df8fb[_0x48f516['IntervalId']]['Intervals'],'interval');}else if(!_[_0xafac('0xf')](_0x48f516[_0xafac('0x13')])){_0x2c11ae=[_0x48f516[_0xafac('0x13')]];}return _0x2c11ae;}exports[_0xafac('0x14')]=function(_0x35de10){_0x35de10[_0xafac('0x15')]={};return new BPromise(function(_0x4306f1,_0xa7114f){var _0x3eec3e={'Start':function(_0x38e33d){var _0x1ef516=this;return new Promise(function(_0x3ebb3e,_0x577c63){if(_0x38e33d){try{var _0x153cb0=[];var _0x41ccd6=getId(_0x38e33d[_0xafac('0x16')],_0x38e33d[_0xafac('0x17')]?_0x38e33d[_0xafac('0x17')]['id']:0x0,_0x38e33d[_0xafac('0x18')]?_0x38e33d['interaction']['id']:0x0);if(_0x38e33d[_0xafac('0x19')]&&_[_0xafac('0x1a')](_0x38e33d['applications'])&&_0x38e33d[_0xafac('0x19')][_0xafac('0x1b')]){for(var _0x2ae3e=0x0;_0x2ae3e<_0x38e33d[_0xafac('0x19')]['length'];_0x2ae3e+=0x1){var _0x26b1f7=_0x38e33d[_0xafac('0x19')][_0x2ae3e];if(fs['existsSync'](path['join'](__dirname,_0xafac('0x19'),_0x26b1f7['app']+'.js'))){var _0x14305e=[];switch(_0x26b1f7[_0xafac('0x1c')][_0xafac('0x1d')]()){case'autoreply':var _0x5b41ec=_0x26b1f7[_0xafac('0x1e')][_0xafac('0x1f')](',');if(_0x38e33d[_0xafac('0x16')]==='mail'){_0x14305e[_0xafac('0x20')](_0x5b41ec[0x0]);_0x14305e[_0xafac('0x20')](_0x5b41ec[0x1]);_0x14305e[_0xafac('0x20')](_0x5b41ec[_0xafac('0x21')](0x2,_0x5b41ec['length'])[_0xafac('0x22')](','));}else{_0x14305e[_0xafac('0x20')](_0x5b41ec[0x0]);_0x14305e[_0xafac('0x20')](_0x5b41ec[_0xafac('0x21')](0x1,_0x5b41ec['length'])['join'](','));}break;case _0xafac('0x23'):var _0x4cf074=_0x26b1f7[_0xafac('0x1e')]['split'](',');_0x14305e['push'](_0x4cf074[0x0]);_0x14305e['push'](_0x4cf074[0x1]);_0x14305e[_0xafac('0x20')](_0x4cf074['slice'](0x2,_0x4cf074['length'])[_0xafac('0x22')](','));break;case _0xafac('0x24'):var _0x32580a=_0x26b1f7[_0xafac('0x1e')][_0xafac('0x1f')](',');_0x14305e[_0xafac('0x20')](_0x32580a[0x0]);_0x14305e[_0xafac('0x20')](_0x32580a[0x1]);_0x14305e[_0xafac('0x20')](_0x32580a[0x2]);_0x14305e[_0xafac('0x20')](_0x32580a[0x3]);_0x14305e[_0xafac('0x20')](_0x32580a[_0xafac('0x21')](0x4,_0x32580a[_0xafac('0x1b')])['join'](','));break;case _0xafac('0x25'):var _0x3a1141=_0x26b1f7[_0xafac('0x1e')]['split'](',');_0x14305e['push'](_0x3a1141[0x0]);_0x14305e[_0xafac('0x20')](_0x3a1141[0x1]);_0x14305e['push'](_0x3a1141[0x2]);_0x14305e['push'](_0x3a1141[0x3]);_0x14305e[_0xafac('0x20')](_0x3a1141[_0xafac('0x21')](0x4,_0x3a1141['length'])['join'](','));break;case _0xafac('0x17'):_0x14305e[_0xafac('0x20')](_0x26b1f7[_0xafac('0x1e')]);break;case'tag':_0x14305e[_0xafac('0x20')](_0x26b1f7[_0xafac('0x26')]);_0x14305e[_0xafac('0x20')](_0x26b1f7[_0xafac('0x1e')]);break;default:_0x14305e=_['isNil'](_0x26b1f7['appdata'])?[]:_0x26b1f7[_0xafac('0x1e')][_0xafac('0x1f')](',');}var _0x3793e8={'id':util['format'](_0xafac('0x27'),_0x41ccd6,_0x26b1f7['id'],_0x26b1f7[_0xafac('0x1c')]),'condition':require(_0xafac('0x28'))[_0xafac('0x29')](_0x41ccd6,getIntervals(_0x35de10[_0xafac('0x2a')],_0x26b1f7),_0x35de10),'consequence':require(_0xafac('0x2b')+_0x26b1f7['app'])[_0xafac('0x2c')](_0x41ccd6,_0x14305e,_0x35de10,_0x38e33d),'p':_0x26b1f7[_0xafac('0x2d')]||0x0};logger[_0xafac('0x2e')](_0xafac('0x2f'),_0x3793e8['id'],'on\x20interval',getIntervals(_0x35de10[_0xafac('0x2a')],_0x26b1f7)[_0xafac('0x22')]('\x20|\x20'));_0x153cb0[_0xafac('0x20')](_0x3793e8);}else{logger[_0xafac('0x30')](_0xafac('0x31'),path[_0xafac('0x22')](__dirname,_0xafac('0x19'),_0x26b1f7[_0xafac('0x1c')]+_0xafac('0x32')));}}_0x35de10[_0xafac('0x15')][_0x41ccd6]=new RuleEngine(_0x153cb0);_0x35de10[_0xafac('0x15')][_0x41ccd6][_0xafac('0x33')](_0x38e33d,function(_0x34b912){logger[_0xafac('0x2e')](_0xafac('0x34'),JSON[_0xafac('0x35')](_0x34b912[_0xafac('0x36')]));if(_0x35de10[_0xafac('0x15')][_0x41ccd6]){_0x35de10[_0xafac('0x15')][_0x41ccd6][_0xafac('0x37')](_0xafac('0x38'));}});return _0x3ebb3e({'code':0xc8,'message':_0x38e33d});}else{logger['info'](_0xafac('0x39'));return _0x3ebb3e({'code':0xc8,'message':_0x38e33d});}}catch(_0x1ebd9a){logger['error'](_0x1ebd9a[_0xafac('0x3a')]);return _0x577c63(_0x1ef516[_0xafac('0x30')](0x1f4,_0x1ebd9a));}}return _0x577c63(_0xafac('0x3b'));});},'AcceptMessage':function(_0xc270d1){var _0x254a23=this;return new Promise(function(_0x338ad1,_0x4ed9a8){if(_0xc270d1[_0xafac('0x3c')]&&_0xc270d1[_0xafac('0x3c')]['id']){if(_0x35de10[_0xafac('0x3d')][_0xc270d1[_0xafac('0x3c')]['id']]){_0x35de10[_0xafac('0x3d')][_0xc270d1[_0xafac('0x3c')]['id']][_0xafac('0x3e')]=![];_0x35de10['agents'][_0xc270d1[_0xafac('0x3c')]['id']]['busyQueue']=undefined;}}if(_0xc270d1[_0xafac('0x17')]&&_0xc270d1['message']['id']){try{var _0x511bc0=getId(_0xc270d1['channel'],_0xc270d1['message']?_0xc270d1['message']['id']:0x0,_0xc270d1[_0xafac('0x18')]?_0xc270d1[_0xafac('0x18')]['id']:0x0);if(_0x35de10['rules'][_0x511bc0]){_0x35de10[_0xafac('0x15')][_0x511bc0][_0xafac('0x37')](_0xafac('0x3f'));if(rpc[_0xc270d1['channel']+_0xafac('0x40')]){rpc[_0xc270d1[_0xafac('0x16')]+'QueueReport'][_0xafac('0x41')](_0x511bc0,{'UserId':_0xc270d1[_0xafac('0x17')][_0xafac('0x42')]})['catch'](function(_0x62372d){logger[_0xafac('0x30')](_0xafac('0x43'));});}}return _0x338ad1({'code':0xc8,'message':_0xc270d1});}catch(_0x3d9f6e){logger['error'](_0x3d9f6e[_0xafac('0x3a')]);return _0x4ed9a8(_0x254a23[_0xafac('0x30')](0x1f4,_0x3d9f6e));}}logger[_0xafac('0x30')](_0xafac('0x44'));return _0x4ed9a8(_0x254a23[_0xafac('0x30')](0x1f4,_0xafac('0x44')));});},'RejectMessage':function(_0x3f27de){var _0x24340e=this;return new Promise(function(_0x3f9400,_0x3050b0){if(_0x3f27de[_0xafac('0x3c')]&&_0x3f27de['agent']['id']){try{if(_0x35de10[_0xafac('0x3d')][_0x3f27de[_0xafac('0x3c')]['id']]){_0x35de10[_0xafac('0x3d')][_0x3f27de['agent']['id']][_0xafac('0x3e')]=![];_0x35de10[_0xafac('0x3d')][_0x3f27de[_0xafac('0x3c')]['id']]['busyQueue']=undefined;}return _0x3f9400({'code':0xc8,'message':_0x3f27de});}catch(_0x51af7f){logger[_0xafac('0x30')](_0x51af7f['stack']);return _0x3050b0(_0x24340e[_0xafac('0x30')](0x1f4,_0x51af7f));}}logger[_0xafac('0x30')](_0xafac('0x44'));return _0x3050b0(_0x24340e[_0xafac('0x30')](0x1f4,_0xafac('0x44')));});},'AbandonInteraction':function(_0x4cc5b4){var _0x32fe2d=this;return new Promise(function(_0x5b36b9,_0x219b16){if(_0x4cc5b4[_0xafac('0x16')]&&_0x4cc5b4[_0xafac('0x18')]&&_0x4cc5b4[_0xafac('0x18')]['id']){try{var _0x48399f=getId(_0x4cc5b4[_0xafac('0x16')],_0x4cc5b4[_0xafac('0x17')]?_0x4cc5b4[_0xafac('0x17')]['id']:0x0,_0x4cc5b4[_0xafac('0x18')]?_0x4cc5b4[_0xafac('0x18')]['id']:0x0);if(_0x35de10['rules'][_0x48399f]){_0x35de10['rules'][_0x48399f]['emit']('end');}return _0x5b36b9({'code':0xc8,'message':_0x4cc5b4});}catch(_0x380546){logger[_0xafac('0x30')](_0x380546[_0xafac('0x3a')]);return _0x219b16(_0x32fe2d[_0xafac('0x30')](0x1f4,_0x380546));}}logger[_0xafac('0x30')](_0xafac('0x44'));return _0x219b16(_0x32fe2d[_0xafac('0x30')](0x1f4,_0xafac('0x44')));});},'AgentCapacity':function(_0x23f6d1){var _0xb384e6=this;return new Promise(function(_0x4295af,_0x4f276d){if(_0x35de10[_0xafac('0x3d')][_0xafac('0x45')](_0x23f6d1['id'])){for(var _0x1f79f3 in _0x23f6d1[_0xafac('0x46')]){if(_0x23f6d1[_0xafac('0x46')][_0xafac('0x45')](_0x1f79f3)){if(_0x35de10['agents'][_0x23f6d1['id']][_0xafac('0x45')](_0x1f79f3+_0xafac('0x47'))){_0x35de10['agents'][_0x23f6d1['id']][_0x1f79f3+_0xafac('0x47')]=parseInt(_0x23f6d1[_0xafac('0x46')][_0x1f79f3],0xa);}}}_0x35de10[_0xafac('0x3d')][_0x23f6d1['id']][_0xafac('0x48')]();return _0x4295af({'code':0xc8,'message':_0x35de10[_0xafac('0x3d')][_0x23f6d1['id']]});}else{return _0x4f276d(_0xb384e6['error'](0x1f4,_0xafac('0x49')));}});},'Agents':function(_0xf72d8a){return new Promise(function(_0xedd6cd,_0x1661bb){var _0xb36cf=_[_0xafac('0x4a')](_0x35de10[_0xafac('0x3d')]);_0xedd6cd({'count':_0xb36cf[_0xafac('0x1b')],'rows':_0xb36cf});});},'ChatQueues':function(_0x56c222){return new Promise(function(_0x1ceb19,_0x47be55){var _0x1f9c15=[];for(var _0x317de5 in _0x35de10[_0xafac('0x4b')]){if(_0x35de10[_0xafac('0x4b')]['hasOwnProperty'](_0x317de5)){var _0x4199c7=_0x35de10[_0xafac('0x4b')][_0x317de5];var _0x2a3ff6={'id':_0x4199c7['id'],'available':_0x4199c7[_0xafac('0x4c')],'loggedIn':_0x4199c7[_0xafac('0x4d')],'name':_0x4199c7['name'],'paused':_0x4199c7[_0xafac('0x4e')],'waiting':_0x4199c7['waiting']};_0x1f9c15['push'](_0x2a3ff6);}}_0x1ceb19({'count':_0x1f9c15[_0xafac('0x1b')],'rows':_0x1f9c15});});},'MailQueues':function(_0x5cb7e5){return new Promise(function(_0x3f9081,_0x5d7bde){var _0x2a27fa=[];for(var _0x2aacdf in _0x35de10['mailQueues']){if(_0x35de10['mailQueues']['hasOwnProperty'](_0x2aacdf)){var _0x4a3be2=_0x35de10[_0xafac('0x4f')][_0x2aacdf];var _0x51e0c8={'id':_0x4a3be2['id'],'available':_0x4a3be2['available'],'loggedIn':_0x4a3be2[_0xafac('0x4d')],'name':_0x4a3be2[_0xafac('0x50')],'paused':_0x4a3be2[_0xafac('0x4e')],'waiting':_0x4a3be2[_0xafac('0x51')]};_0x2a27fa['push'](_0x51e0c8);}}_0x3f9081({'count':_0x2a27fa[_0xafac('0x1b')],'rows':_0x2a27fa});});},'OpenchannelQueues':function(_0x941dc9){return new Promise(function(_0x49f00c,_0x29ae0a){var _0x519471=[];for(var _0x357a92 in _0x35de10[_0xafac('0x52')]){if(_0x35de10[_0xafac('0x52')]['hasOwnProperty'](_0x357a92)){var _0x4036e5=_0x35de10[_0xafac('0x52')][_0x357a92];var _0x5793b2={'id':_0x4036e5['id'],'available':_0x4036e5[_0xafac('0x4c')],'loggedIn':_0x4036e5[_0xafac('0x4d')],'name':_0x4036e5[_0xafac('0x50')],'paused':_0x4036e5[_0xafac('0x4e')],'waiting':_0x4036e5['waiting']};_0x519471[_0xafac('0x20')](_0x5793b2);}}_0x49f00c({'count':_0x519471[_0xafac('0x1b')],'rows':_0x519471});});},'SmsQueues':function(_0x1798ca){return new Promise(function(_0x3314f4,_0x4966d5){var _0x187423=[];for(var _0x49d45c in _0x35de10['smsQueues']){if(_0x35de10[_0xafac('0x53')][_0xafac('0x45')](_0x49d45c)){var _0x3bd3ac=_0x35de10[_0xafac('0x53')][_0x49d45c];var _0xf19799={'id':_0x3bd3ac['id'],'available':_0x3bd3ac[_0xafac('0x4c')],'loggedIn':_0x3bd3ac[_0xafac('0x4d')],'name':_0x3bd3ac[_0xafac('0x50')],'paused':_0x3bd3ac[_0xafac('0x4e')],'waiting':_0x3bd3ac[_0xafac('0x51')]};_0x187423[_0xafac('0x20')](_0xf19799);}}_0x3314f4({'count':_0x187423['length'],'rows':_0x187423});});},'FaxQueues':function(_0x1b1a04){return new Promise(function(_0x15131d,_0x3972f5){var _0xe35c1c=[];for(var _0x289650 in _0x35de10[_0xafac('0x54')]){if(_0x35de10[_0xafac('0x54')][_0xafac('0x45')](_0x289650)){var _0x4fbbea=_0x35de10[_0xafac('0x54')][_0x289650];var _0x521956={'id':_0x4fbbea['id'],'available':_0x4fbbea['available'],'loggedIn':_0x4fbbea[_0xafac('0x4d')],'name':_0x4fbbea[_0xafac('0x50')],'paused':_0x4fbbea['paused'],'waiting':_0x4fbbea[_0xafac('0x51')]};_0xe35c1c[_0xafac('0x20')](_0x521956);}}_0x15131d({'count':_0xe35c1c[_0xafac('0x1b')],'rows':_0xe35c1c});});},'WhatsappQueues':function(_0x49fa26){return new Promise(function(_0xc0f071,_0x5b0a4a){var _0x3f880e=[];for(var _0x225a3e in _0x35de10[_0xafac('0x55')]){if(_0x35de10['whatsappQueues']['hasOwnProperty'](_0x225a3e)){var _0x2bce83=_0x35de10[_0xafac('0x55')][_0x225a3e];var _0x41742a={'id':_0x2bce83['id'],'available':_0x2bce83[_0xafac('0x4c')],'loggedIn':_0x2bce83['loggedIn'],'name':_0x2bce83[_0xafac('0x50')],'paused':_0x2bce83['paused'],'waiting':_0x2bce83['waiting']};_0x3f880e[_0xafac('0x20')](_0x41742a);}}_0xc0f071({'count':_0x3f880e[_0xafac('0x1b')],'rows':_0x3f880e});});},'ChatQueuesWaitingInteractions':function(_0x1c1f00){return new Promise(function(_0x4eb217,_0x1d6fa0){var _0x247725=_[_0xafac('0x4a')](_0x35de10['chatQueuesWaitingInteractions']);_0x4eb217({'count':_0x247725[_0xafac('0x1b')],'rows':_0x247725});});},'MailQueuesWaitingInteractions':function(_0x1cc235){return new Promise(function(_0x423e00,_0x18860d){var _0xc2421e=_[_0xafac('0x4a')](_0x35de10[_0xafac('0x56')]);_0x423e00({'count':_0xc2421e['length'],'rows':_0xc2421e});});},'OpenchannelQueuesWaitingInteractions':function(_0x4916ab){return new Promise(function(_0x222a73,_0x18bb35){var _0x101918=_[_0xafac('0x4a')](_0x35de10[_0xafac('0x57')]);_0x222a73({'count':_0x101918[_0xafac('0x1b')],'rows':_0x101918});});},'SmsQueuesWaitingInteractions':function(_0x3b96b5){return new Promise(function(_0x34a597,_0x55c227){var _0x402011=_['values'](_0x35de10['smsQueuesWaitingInteractions']);_0x34a597({'count':_0x402011[_0xafac('0x1b')],'rows':_0x402011});});},'FaxQueuesWaitingInteractions':function(_0x1d58e0){return new Promise(function(_0x243e56,_0x257897){var _0x42a655=_[_0xafac('0x4a')](_0x35de10[_0xafac('0x58')]);_0x243e56({'count':_0x42a655['length'],'rows':_0x42a655});});},'WhatsappQueuesWaitingInteractions':function(_0x357c91){return new Promise(function(_0x2984b0,_0x3f7315){var _0x18dafc=_[_0xafac('0x4a')](_0x35de10['whatsappQueuesWaitingInteractions']);_0x2984b0({'count':_0x18dafc['length'],'rows':_0x18dafc});});}};var _0xeda24b=jayson[_0xafac('0x59')](_0x3eec3e)[_0xafac('0x5a')]();_0xeda24b['on'](_0xafac('0x30'),function(_0x1a2bdd){logger[_0xafac('0x30')](JSON[_0xafac('0x35')](_0x1a2bdd));return _0xa7114f(_0x1a2bdd);});_0xeda24b[_0xafac('0x14')](0x232c,'127.0.0.1',function(){console[_0xafac('0x5b')](_0xafac('0x5c'),0x232c);return _0x4306f1('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 148056d..e32c905 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 _0x3fc3=['catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','Command','format','iftime\x20%s','message','indexOf','true','error','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','stop','bluebird','lodash','../../../config/logger','routing','client','request','then','result'];(function(_0x589f44,_0x5c449b){var _0x3429b8=function(_0x334884){while(--_0x334884){_0x589f44['push'](_0x589f44['shift']());}};_0x3429b8(++_0x5c449b);}(_0x3fc3,0xc3));var _0x33fc=function(_0x16e2ee,_0x3444a9){_0x16e2ee=_0x16e2ee-0x0;var _0x460cae=_0x3fc3[_0x16e2ee];return _0x460cae;};'use strict';var util=require('util');var BPromise=require(_0x33fc('0x0'));var jayson=require('jayson/promise');var _=require(_0x33fc('0x1'));var logger=require(_0x33fc('0x2'))(_0x33fc('0x3'));var client=jayson[_0x33fc('0x4')]['http']({'port':0x232a});function request(_0x9e6c31,_0x30a2d3){return new BPromise(function(_0x5c9428,_0x780705){return client[_0x33fc('0x5')](_0x9e6c31,_0x30a2d3)[_0x33fc('0x6')](function(_0x4900ec){if(_0x4900ec['error']){return _0x780705(_0x4900ec['error']['message']);}else{return _0x5c9428(_0x4900ec[_0x33fc('0x7')]);}})[_0x33fc('0x8')](function(_0x58c955){return _0x780705(_0x58c955);});});}exports['condition']=function(_0x22b976,_0x7aaf3b,_0x310845){return function(_0x3814d1){if(_0x310845[_0x33fc('0x9')]&&!_0x310845[_0x33fc('0x9')][_0x22b976]){logger[_0x33fc('0xa')](_0x33fc('0xb'),_0x22b976);return _0x3814d1['stop']();}var _0x55e5c0=[];for(var _0x79af46=0x0;_0x79af46<_0x7aaf3b[_0x33fc('0xc')];_0x79af46+=0x1){_0x55e5c0['push'](request(_0x33fc('0xd'),{'command':util[_0x33fc('0xe')](_0x33fc('0xf'),_0x7aaf3b[_0x79af46])})['then'](function(_0x2cd80a){return _0x2cd80a&&_0x2cd80a[_0x33fc('0x10')]&&_0x2cd80a['message'][_0x33fc('0x11')](_0x33fc('0x12'))>=0x0?!![]:![];})[_0x33fc('0x8')](function(_0x1dc64f){logger[_0x33fc('0x13')](_0x33fc('0x14'),_0x22b976,_0x7aaf3b[_0x79af46]);}));}BPromise[_0x33fc('0x15')](_0x55e5c0)[_0x33fc('0x6')](function(_0x56f57b){var _0x85d9fe=_[_0x33fc('0x16')](_0x56f57b);logger[_0x33fc('0xa')](_0x33fc('0x17'),_0x22b976,_0x7aaf3b[_0x33fc('0x18')](_0x33fc('0x19')),_0x85d9fe);_0x3814d1[_0x33fc('0x1a')](_0x85d9fe);})[_0x33fc('0x8')](function(_0x3c3fcb){console['log'](_0x3c3fcb);logger[_0x33fc('0x13')](_0x33fc('0x17'),_0x22b976,_0x7aaf3b['join']('\x20|\x20'),_0x3c3fcb[_0x33fc('0x1b')]);_0x3814d1[_0x33fc('0x1c')]();});};}; \ No newline at end of file +var _0xa390=['http','request','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','\x20|\x20','when','catch','[%s][INTERVAL]\x20%s\x20%s','join','stack','util','lodash','../../../config/logger','routing'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa390,0x1f4));var _0x0a39=function(_0x28d640,_0x384fda){_0x28d640=_0x28d640-0x0;var _0x3e05a0=_0xa390[_0x28d640];return _0x3e05a0;};'use strict';var util=require(_0x0a39('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x0a39('0x1'));var logger=require(_0x0a39('0x2'))(_0x0a39('0x3'));var client=jayson['client'][_0x0a39('0x4')]({'port':0x232a});function request(_0x1f4df7,_0x524fc0){return new BPromise(function(_0x3e818b,_0x178dcf){return client[_0x0a39('0x5')](_0x1f4df7,_0x524fc0)['then'](function(_0x263eaf){if(_0x263eaf['error']){return _0x178dcf(_0x263eaf[_0x0a39('0x6')][_0x0a39('0x7')]);}else{return _0x3e818b(_0x263eaf['result']);}})['catch'](function(_0x17ae23){return _0x178dcf(_0x17ae23);});});}exports[_0x0a39('0x8')]=function(_0x3faa93,_0x30c8ff,_0x5e74b3){return function(_0x7c96fa){if(_0x5e74b3[_0x0a39('0x9')]&&!_0x5e74b3['rules'][_0x3faa93]){logger[_0x0a39('0xa')](_0x0a39('0xb'),_0x3faa93);return _0x7c96fa[_0x0a39('0xc')]();}var _0x22d362=[];for(var _0x3a07be=0x0;_0x3a07be<_0x30c8ff['length'];_0x3a07be+=0x1){_0x22d362[_0x0a39('0xd')](request(_0x0a39('0xe'),{'command':util[_0x0a39('0xf')](_0x0a39('0x10'),_0x30c8ff[_0x3a07be])})[_0x0a39('0x11')](function(_0xb6a46b){return _0xb6a46b&&_0xb6a46b[_0x0a39('0x7')]&&_0xb6a46b[_0x0a39('0x7')][_0x0a39('0x12')](_0x0a39('0x13'))>=0x0?!![]:![];})['catch'](function(_0x309f79){logger[_0x0a39('0x6')](_0x0a39('0x14'),_0x3faa93,_0x30c8ff[_0x3a07be]);}));}BPromise[_0x0a39('0x15')](_0x22d362)[_0x0a39('0x11')](function(_0x3f0dec){var _0x1f9931=_['some'](_0x3f0dec);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x3faa93,_0x30c8ff['join'](_0x0a39('0x16')),_0x1f9931);_0x7c96fa[_0x0a39('0x17')](_0x1f9931);})[_0x0a39('0x18')](function(_0x57663b){console['log'](_0x57663b);logger[_0x0a39('0x6')](_0x0a39('0x19'),_0x3faa93,_0x30c8ff[_0x0a39('0x1a')]('\x20|\x20'),_0x57663b[_0x0a39('0x1b')]);_0x7c96fa[_0x0a39('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index fe0fd00..7c58913 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 _0x58a4=['clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','debug','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','transfer','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid'];(function(_0x57c8ee,_0x14af44){var _0x4ea46c=function(_0x4e267e){while(--_0x4e267e){_0x57c8ee['push'](_0x57c8ee['shift']());}};_0x4ea46c(++_0x14af44);}(_0x58a4,0xbf));var _0x458a=function(_0x462bff,_0x151a16){_0x462bff=_0x462bff-0x0;var _0x27229a=_0x58a4[_0x462bff];return _0x27229a;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var utils=require(_0x458a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e23ea,_0xd2a36e){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x5'),_0x1e23ea[_0x458a('0x6')],_0x1e23ea[_0x458a('0x7')],_0x1e23ea[_0x458a('0x8')],_0x1e23ea[_0x458a('0x9')],_0x1e23ea[_0x458a('0xa')],_0x1e23ea['calleridnum'],_0x1e23ea['connectedlinenum'],_0x1e23ea[_0x458a('0xb')]));if(_0x1e23ea[_0x458a('0x8')]){utils[_0x458a('0xc')](_0x1e23ea[_0x458a('0x8')])[_0x458a('0xd')](function(_0x55bf10){if(_0x55bf10){_0x1e23ea['type']=_0x55bf10[_0x458a('0xe')];_0x1e23ea[_0x458a('0xf')]=_0x1e23ea[_0x458a('0x10')]?_0x55bf10[_0x458a('0x11')]:![];_0x1e23ea[_0x458a('0x12')]=_0x1e23ea['agentacw']?_0x55bf10[_0x458a('0x13')]:0x0;}utils[_0x458a('0x14')]('CreateVoiceAgentReport',_0x1e23ea);});}else{utils[_0x458a('0x14')](_0x458a('0x15'),_0x1e23ea);}if(_0xd2a36e){delete transfers[_0x1e23ea[_0x458a('0x6')]];}else{delete agents[_0x1e23ea[_0x458a('0x16')]];}}exports[_0x458a('0x17')]=function(_0x5bd09e){try{utils['debug'](util[_0x458a('0x4')]('[%s][agents][agentcalled]',_0x5bd09e[_0x458a('0x6')]),_0x5bd09e);agents[_0x5bd09e[_0x458a('0x16')]]=_0x5bd09e;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();agents[_0x5bd09e[_0x458a('0x16')]]['lastevent']='called';agents[_0x5bd09e['destuniqueid']][_0x458a('0x1a')]=null;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x1b')]=null;utils['info'](util[_0x458a('0x4')](_0x458a('0x1c'),_0x5bd09e[_0x458a('0x6')],agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x9')],_0x5bd09e['destuniqueid']));}catch(_0x4f57e3){utils[_0x458a('0x1d')](util['format'](_0x458a('0x1e'),_0x5bd09e[_0x458a('0x6')]),_0x4f57e3);}};exports['agentringnoanswer']=function(_0x468416){try{if(!_['isNil'](agents[_0x468416[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util['format'](_0x458a('0x20'),_0x468416[_0x458a('0x6')]),_0x468416);utils['info'](util[_0x458a('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x468416[_0x458a('0x6')],agents[_0x468416['destuniqueid']][_0x458a('0x9')],_0x468416['destuniqueid']));agents[_0x468416[_0x458a('0x16')]][_0x458a('0x21')]=!![];agents[_0x468416[_0x458a('0x16')]][_0x458a('0x22')]=utils[_0x458a('0x19')]();agents[_0x468416[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x24')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x25')]=_0x468416['ringtime']?parseInt(_0x468416[_0x458a('0x26')])/0x3e8:0x0;agents[_0x468416[_0x458a('0x16')]]['talktime']=0x0;unanswered['push'](_0x468416[_0x458a('0x16')]);}}catch(_0x596fe2){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x20'),_0x468416['uniqueid']),_0x596fe2);}};exports[_0x458a('0x27')]=function(_0x2531f7){try{_[_0x458a('0x28')](agents,function(_0x562c36,_0x47e20d){if(_0x562c36[_0x458a('0x6')]==_0x2531f7['uniqueid']&&!_[_0x458a('0x29')](unanswered,_0x562c36['destuniqueid'])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]',_0x2531f7[_0x458a('0x6')]),_0x2531f7);utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2531f7[_0x458a('0x6')],_0x562c36[_0x458a('0x9')],_0x562c36[_0x458a('0x16')]));_0x562c36[_0x458a('0x21')]=!![];_0x562c36[_0x458a('0x22')]=utils['now']();_0x562c36[_0x458a('0xb')]=_0x458a('0x2a');_0x562c36[_0x458a('0x24')]=_0x458a('0x2a');_0x562c36[_0x458a('0x25')]=_0x2531f7[_0x458a('0x25')];_0x562c36['talktime']=0x0;writeDB(_0x562c36);}});}catch(_0x2a6b9c){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x2b'),_0x2531f7[_0x458a('0x6')]),_0x2a6b9c);}};exports[_0x458a('0x2c')]=function(_0x262ad0){try{if(agents[_0x262ad0[_0x458a('0x16')]]){utils[_0x458a('0x1f')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x262ad0);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x2e'),_0x262ad0[_0x458a('0x6')],agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x9')],_0x262ad0[_0x458a('0x16')]));agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x2f')]=utils[_0x458a('0x19')]();agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x1a')]=_0x262ad0[_0x458a('0x1a')];agents[_0x262ad0['destuniqueid']][_0x458a('0x1b')]=_0x262ad0[_0x458a('0x1b')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x30');_[_0x458a('0x28')](agents,function(_0x44c5ba,_0x20cf10){if(_0x44c5ba['destuniqueid']!=_0x262ad0[_0x458a('0x16')]&&_0x44c5ba[_0x458a('0x6')]==_0x262ad0['uniqueid']){_0x44c5ba[_0x458a('0x31')]=0x0;_0x44c5ba[_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];_0x44c5ba['agentringnoanswer']=!![];_0x44c5ba[_0x458a('0x22')]=utils[_0x458a('0x19')]();_0x44c5ba[_0x458a('0xb')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x24')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x33')]=_0x262ad0[_0x458a('0x16')];_0x44c5ba['answeredelsewheremembername']=_0x262ad0[_0x458a('0x9')];writeDB(_0x44c5ba);}});}}catch(_0x145e3c){utils[_0x458a('0x1d')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x145e3c);}};exports['agentcomplete']=function(_0x598707){try{if(!_[_0x458a('0x34')](agents[_0x598707[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][agentcomplete]',_0x598707['uniqueid']),_0x598707);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x35'),_0x598707[_0x458a('0x6')],agents[_0x598707['destuniqueid']][_0x458a('0x9')],_0x598707[_0x458a('0x16')]));agents[_0x598707['destuniqueid']][_0x458a('0x10')]=!![];agents[_0x598707['destuniqueid']][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x598707[_0x458a('0x16')]]['talktime']=utils[_0x458a('0x37')](agents[_0x598707[_0x458a('0x16')]][_0x458a('0x36')],agents[_0x598707['destuniqueid']]['agentconnectAt']);agents[_0x598707[_0x458a('0x16')]][_0x458a('0x24')]=_0x598707[_0x458a('0x24')];agents[_0x598707['destuniqueid']]['lastevent']=_0x458a('0x38');writeDB(agents[_0x598707[_0x458a('0x16')]]);}}catch(_0x25bee8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x39'),_0x598707[_0x458a('0x6')]),_0x25bee8);}};exports[_0x458a('0x3a')]=function(_0xb22232){try{if(!_[_0x458a('0x34')](agents[_0xb22232[_0x458a('0x3b')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232[_0x458a('0x6')]),_0xb22232);utils[_0x458a('0x3')](util['format'](_0x458a('0x3d'),_0xb22232[_0x458a('0x6')],agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x9')],agents[_0xb22232[_0x458a('0x3b')]]['uniqueid']));agents[_0xb22232['transfereruniqueid']]['transfer']=!![];agents[_0xb22232[_0x458a('0x3b')]]['transfertype']=_0x458a('0x3e');agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x3f')]=_0xb22232[_0x458a('0x40')];agents[_0xb22232[_0x458a('0x3b')]]['transferuniqueid']=agents[_0xb22232['transfereruniqueid']][_0x458a('0x6')];}}catch(_0x2d8b77){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232['uniqueid']),_0x2d8b77);}};exports[_0x458a('0x41')]=function(_0x4eed01){try{utils[_0x458a('0x1f')](util['format'](_0x458a('0x42'),_0x4eed01['origtransfereruniqueid']),_0x4eed01);if(_0x4eed01['origtransfereruniqueid']==_0x4eed01['origtransfererlinkedid']){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x43')]])){utils['info'](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01[_0x458a('0x45')],agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x9')]));agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x47')]=_0x458a('0x48');agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x3f')]=_0x4eed01[_0x458a('0x49')];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4a')]=_0x4eed01[_0x458a('0x45')];}if(_0x4eed01[_0x458a('0x4b')]&&agents[_0x4eed01[_0x458a('0x4b')]]){agents[_0x4eed01[_0x458a('0x4b')]]['agententerreason']=0x1;transfers[_0x4eed01[_0x458a('0x4b')]]=_['clone'](agents[_0x4eed01[_0x458a('0x4b')]]);transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x43')]]['calleridnum'];transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x2f')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x25')]=0x0;transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4e')]=0x2;}}else if(_0x4eed01[_0x458a('0x43')]==_0x4eed01[_0x458a('0x4f')]){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x45')]])){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01['origtransfereruniqueid'],agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x9')]));agents[_0x4eed01['origtransfereruniqueid']][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x45')]]['transfertype']=_0x458a('0x48');agents[_0x4eed01[_0x458a('0x45')]]['transferexten']=_0x4eed01[_0x458a('0x50')];agents[_0x4eed01[_0x458a('0x45')]]['transferuniqueid']=_0x4eed01[_0x458a('0x43')];}if(_0x4eed01[_0x458a('0x51')]&&agents[_0x4eed01[_0x458a('0x51')]]){agents[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x1;transfers[_0x4eed01[_0x458a('0x51')]]=_[_0x458a('0x52')](agents[_0x4eed01[_0x458a('0x51')]]);transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4c')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x2f')]=utils['now']();transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x25')]=0x0;transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x2;}}}catch(_0xfb99c8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x42'),_0x4eed01[_0x458a('0x45')]),_0xfb99c8);}};exports[_0x458a('0x53')]=function(_0x31074e){try{utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x31074e);if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e['uniqueid']][_0x458a('0x24')]==='timeout'){if(_0x31074e[_0x458a('0x55')]==='21'){agents[_0x31074e[_0x458a('0x6')]]['reason']=_0x458a('0x56');agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]='rejected';}utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x57'),_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e['uniqueid']][_0x458a('0x24')],agents[_0x31074e['uniqueid']]['lastevent']));writeDB(agents[_0x31074e[_0x458a('0x6')]]);var _0x36ba6e=unanswered[_0x458a('0x58')](_0x31074e[_0x458a('0x6')]);if(_0x36ba6e>-0x1){unanswered[_0x458a('0x59')](_0x36ba6e,0x1);}}if(transfers[_0x31074e[_0x458a('0x6')]]){transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x10')]=!![];transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](transfers[_0x31074e['uniqueid']]['agentcompleteAt'],transfers[_0x31074e['uniqueid']][_0x458a('0x2f')]);transfers[_0x31074e['uniqueid']][_0x458a('0x24')]=_0x458a('0x5a');transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],transfers[_0x31074e[_0x458a('0x6')]]['membername'],transfers[_0x31074e[_0x458a('0x6')]]['reason'],transfers[_0x31074e[_0x458a('0x6')]]['lastevent']));writeDB(transfers[_0x31074e[_0x458a('0x6')]],!![]);}if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]){agents[_0x31074e['uniqueid']][_0x458a('0x10')]=!![];agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](agents[_0x31074e[_0x458a('0x6')]]['agentcompleteAt'],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]);agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')]=agents[_0x31074e['uniqueid']][_0x458a('0x46')]?_0x458a('0x46'):'agent';agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]));writeDB(agents[_0x31074e['uniqueid']]);}}catch(_0x1f9925){utils['error'](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x1f9925);}}; \ No newline at end of file +var _0xf7b4=['acw','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','push','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','forIn','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','complete','lodash','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete'];(function(_0x347b96,_0x18ba98){var _0x19c17e=function(_0x48d37f){while(--_0x48d37f){_0x347b96['push'](_0x347b96['shift']());}};_0x19c17e(++_0x18ba98);}(_0xf7b4,0x152));var _0x4f7b=function(_0x24d15c,_0x3018fc){_0x24d15c=_0x24d15c-0x0;var _0x20e557=_0xf7b4[_0x24d15c];return _0x20e557;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5ccf30,_0x103165){utils['info'](util['format'](_0x4f7b('0x1'),_0x5ccf30[_0x4f7b('0x2')],_0x5ccf30[_0x4f7b('0x3')],_0x5ccf30[_0x4f7b('0x4')],_0x5ccf30[_0x4f7b('0x5')],_0x5ccf30[_0x4f7b('0x6')],_0x5ccf30[_0x4f7b('0x7')],_0x5ccf30[_0x4f7b('0x8')],_0x5ccf30[_0x4f7b('0x9')]));if(_0x5ccf30[_0x4f7b('0x4')]){utils[_0x4f7b('0xa')](_0x5ccf30[_0x4f7b('0x4')])[_0x4f7b('0xb')](function(_0x5c714d){if(_0x5c714d){_0x5ccf30[_0x4f7b('0xc')]=_0x5c714d[_0x4f7b('0xc')];_0x5ccf30['agentacw']=_0x5ccf30[_0x4f7b('0xd')]?_0x5c714d[_0x4f7b('0xe')]:![];_0x5ccf30[_0x4f7b('0xf')]=_0x5ccf30[_0x4f7b('0x10')]?_0x5c714d[_0x4f7b('0x11')]:0x0;}utils['request'](_0x4f7b('0x12'),_0x5ccf30);});}else{utils['request']('CreateVoiceAgentReport',_0x5ccf30);}if(_0x103165){delete transfers[_0x5ccf30[_0x4f7b('0x2')]];}else{delete agents[_0x5ccf30[_0x4f7b('0x13')]];}}exports[_0x4f7b('0x14')]=function(_0x41a050){try{utils['debug'](util[_0x4f7b('0x15')](_0x4f7b('0x16'),_0x41a050[_0x4f7b('0x2')]),_0x41a050);agents[_0x41a050[_0x4f7b('0x13')]]=_0x41a050;agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x17')]=utils[_0x4f7b('0x18')]();agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x9')]=_0x4f7b('0x19');agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x8')]=null;agents[_0x41a050['destuniqueid']][_0x4f7b('0x1a')]=null;utils['info'](util['format'](_0x4f7b('0x1b'),_0x41a050[_0x4f7b('0x2')],agents[_0x41a050['destuniqueid']][_0x4f7b('0x5')],_0x41a050[_0x4f7b('0x13')]));}catch(_0x13a0f5){utils[_0x4f7b('0x1c')](util['format'](_0x4f7b('0x16'),_0x41a050['uniqueid']),_0x13a0f5);}};exports[_0x4f7b('0x1d')]=function(_0x12374b){try{if(!_[_0x4f7b('0x1e')](agents[_0x12374b[_0x4f7b('0x13')]])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x20'),_0x12374b[_0x4f7b('0x2')]),_0x12374b);utils[_0x4f7b('0x21')](util['format'](_0x4f7b('0x22'),_0x12374b[_0x4f7b('0x2')],agents[_0x12374b[_0x4f7b('0x13')]]['membername'],_0x12374b[_0x4f7b('0x13')]));agents[_0x12374b[_0x4f7b('0x13')]]['agentringnoanswer']=!![];agents[_0x12374b[_0x4f7b('0x13')]]['agentringnoanswerAt']=utils[_0x4f7b('0x18')]();agents[_0x12374b[_0x4f7b('0x13')]][_0x4f7b('0x9')]=_0x4f7b('0x23');agents[_0x12374b[_0x4f7b('0x13')]][_0x4f7b('0x24')]=_0x4f7b('0x23');agents[_0x12374b[_0x4f7b('0x13')]]['holdtime']=_0x12374b[_0x4f7b('0x25')]?parseInt(_0x12374b[_0x4f7b('0x25')])/0x3e8:0x0;agents[_0x12374b[_0x4f7b('0x13')]]['talktime']=0x0;unanswered[_0x4f7b('0x26')](_0x12374b[_0x4f7b('0x13')]);}}catch(_0x1db684){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')]('[%s][agents][agentringnoanswer]',_0x12374b[_0x4f7b('0x2')]),_0x1db684);}};exports[_0x4f7b('0x27')]=function(_0x9a675c){try{_['forIn'](agents,function(_0x7de561,_0x5d13a1){if(_0x7de561['uniqueid']==_0x9a675c[_0x4f7b('0x2')]&&!_['includes'](unanswered,_0x7de561[_0x4f7b('0x13')])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x28'),_0x9a675c[_0x4f7b('0x2')]),_0x9a675c);utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x29'),_0x9a675c[_0x4f7b('0x2')],_0x7de561[_0x4f7b('0x5')],_0x7de561[_0x4f7b('0x13')]));_0x7de561[_0x4f7b('0x1d')]=!![];_0x7de561[_0x4f7b('0x2a')]=utils[_0x4f7b('0x18')]();_0x7de561[_0x4f7b('0x9')]=_0x4f7b('0x2b');_0x7de561[_0x4f7b('0x24')]=_0x4f7b('0x2b');_0x7de561[_0x4f7b('0x2c')]=_0x9a675c[_0x4f7b('0x2c')];_0x7de561[_0x4f7b('0x2d')]=0x0;writeDB(_0x7de561);}});}catch(_0x172235){utils['error'](util[_0x4f7b('0x15')]('[%s][agents][queuecallerabandon]',_0x9a675c[_0x4f7b('0x2')]),_0x172235);}};exports[_0x4f7b('0x2e')]=function(_0x579ad4){try{if(agents[_0x579ad4[_0x4f7b('0x13')]]){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')]('[%s][agents][agentconnect]',_0x579ad4[_0x4f7b('0x2')]),_0x579ad4);utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x2f'),_0x579ad4[_0x4f7b('0x2')],agents[_0x579ad4[_0x4f7b('0x13')]][_0x4f7b('0x5')],_0x579ad4['destuniqueid']));agents[_0x579ad4[_0x4f7b('0x13')]]['agentconnectAt']=utils[_0x4f7b('0x18')]();agents[_0x579ad4[_0x4f7b('0x13')]][_0x4f7b('0x8')]=_0x579ad4['connectedlinenum'];agents[_0x579ad4[_0x4f7b('0x13')]]['connectedlinename']=_0x579ad4[_0x4f7b('0x1a')];agents[_0x579ad4[_0x4f7b('0x13')]]['holdtime']=_0x579ad4['ringtime'];agents[_0x579ad4[_0x4f7b('0x13')]]['lastevent']=_0x4f7b('0x30');_[_0x4f7b('0x31')](agents,function(_0x54f9e8,_0x1d0746){if(_0x54f9e8['destuniqueid']!=_0x579ad4['destuniqueid']&&_0x54f9e8['uniqueid']==_0x579ad4[_0x4f7b('0x2')]){_0x54f9e8[_0x4f7b('0x2d')]=0x0;_0x54f9e8[_0x4f7b('0x2c')]=_0x579ad4[_0x4f7b('0x25')];_0x54f9e8['agentringnoanswer']=!![];_0x54f9e8[_0x4f7b('0x2a')]=utils['now']();_0x54f9e8[_0x4f7b('0x9')]='answered_elsewhere';_0x54f9e8[_0x4f7b('0x24')]='answered_elsewhere';_0x54f9e8[_0x4f7b('0x32')]=_0x579ad4[_0x4f7b('0x13')];_0x54f9e8[_0x4f7b('0x33')]=_0x579ad4[_0x4f7b('0x5')];writeDB(_0x54f9e8);}});}}catch(_0x2986cd){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x34'),_0x579ad4[_0x4f7b('0x2')]),_0x2986cd);}};exports[_0x4f7b('0xd')]=function(_0x2d0be3){try{if(!_[_0x4f7b('0x1e')](agents[_0x2d0be3[_0x4f7b('0x13')]])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x35'),_0x2d0be3[_0x4f7b('0x2')]),_0x2d0be3);utils[_0x4f7b('0x21')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2d0be3[_0x4f7b('0x2')],agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x5')],_0x2d0be3[_0x4f7b('0x13')]));agents[_0x2d0be3['destuniqueid']]['agentcomplete']=!![];agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x36')]=utils[_0x4f7b('0x18')]();agents[_0x2d0be3[_0x4f7b('0x13')]]['talktime']=utils['diffTime'](agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x36')],agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x37')]);agents[_0x2d0be3[_0x4f7b('0x13')]]['reason']=_0x2d0be3[_0x4f7b('0x24')];agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x9')]='complete';writeDB(agents[_0x2d0be3[_0x4f7b('0x13')]]);}}catch(_0x104e7f){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x35'),_0x2d0be3[_0x4f7b('0x2')]),_0x104e7f);}};exports[_0x4f7b('0x38')]=function(_0x2e563f){try{if(!_[_0x4f7b('0x1e')](agents[_0x2e563f[_0x4f7b('0x39')]])){utils['debug'](util[_0x4f7b('0x15')](_0x4f7b('0x3a'),_0x2e563f[_0x4f7b('0x2')]),_0x2e563f);utils['info'](util[_0x4f7b('0x15')](_0x4f7b('0x3b'),_0x2e563f[_0x4f7b('0x2')],agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x5')],agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x2')]));agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3c')]=!![];agents[_0x2e563f[_0x4f7b('0x39')]]['transfertype']=_0x4f7b('0x3d');agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3e')]=_0x2e563f['extension'];agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3f')]=agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x2')];}}catch(_0x3437a8){utils[_0x4f7b('0x1c')](util['format'](_0x4f7b('0x3a'),_0x2e563f[_0x4f7b('0x2')]),_0x3437a8);}};exports[_0x4f7b('0x40')]=function(_0x4c9496){try{utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x41'),_0x4c9496[_0x4f7b('0x42')]),_0x4c9496);if(_0x4c9496[_0x4f7b('0x42')]==_0x4c9496[_0x4f7b('0x43')]){if(!_['isNil'](agents[_0x4c9496[_0x4f7b('0x44')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x4c9496[_0x4f7b('0x42')],agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x5')]));agents[_0x4c9496['secondtransfereruniqueid']]['transfer']=!![];agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x45')]='ATTENDED';agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x3e')]=_0x4c9496[_0x4f7b('0x46')];agents[_0x4c9496[_0x4f7b('0x44')]]['transferuniqueid']=_0x4c9496[_0x4f7b('0x42')];}if(_0x4c9496[_0x4f7b('0x47')]&&agents[_0x4c9496[_0x4f7b('0x47')]]){agents[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x48')]=0x1;transfers[_0x4c9496[_0x4f7b('0x47')]]=_[_0x4f7b('0x49')](agents[_0x4c9496['transfereeuniqueid']]);transfers[_0x4c9496['transfereeuniqueid']]['calleridnum']=agents[_0x4c9496[_0x4f7b('0x44')]]['calleridnum'];transfers[_0x4c9496['transfereeuniqueid']]['calleridname']=agents[_0x4c9496['secondtransfereruniqueid']][_0x4f7b('0x4a')];transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x17')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x37')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x2c')]=0x0;transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x48')]=0x2;}}else if(_0x4c9496[_0x4f7b('0x44')]==_0x4c9496[_0x4f7b('0x4b')]){if(!_[_0x4f7b('0x1e')](agents[_0x4c9496[_0x4f7b('0x42')]])){utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x4c'),_0x4c9496['origtransfereruniqueid'],agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x5')]));agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x3c')]=!![];agents[_0x4c9496[_0x4f7b('0x42')]]['transfertype']='ATTENDED';agents[_0x4c9496[_0x4f7b('0x42')]]['transferexten']=_0x4c9496[_0x4f7b('0x4d')];agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x3f')]=_0x4c9496[_0x4f7b('0x44')];}if(_0x4c9496['transfertargetuniqueid']&&agents[_0x4c9496[_0x4f7b('0x4e')]]){agents[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x48')]=0x1;transfers[_0x4c9496['transfertargetuniqueid']]=_['clone'](agents[_0x4c9496['transfertargetuniqueid']]);transfers[_0x4c9496[_0x4f7b('0x4e')]]['calleridnum']=agents[_0x4c9496['origtransfereruniqueid']]['calleridnum'];transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x4a')]=agents[_0x4c9496[_0x4f7b('0x42')]]['calleridname'];transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x17')]=utils['now']();transfers[_0x4c9496['transfertargetuniqueid']][_0x4f7b('0x37')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x2c')]=0x0;transfers[_0x4c9496['transfertargetuniqueid']][_0x4f7b('0x48')]=0x2;}}}catch(_0x40534d){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x41'),_0x4c9496[_0x4f7b('0x42')]),_0x40534d);}};exports['hangup']=function(_0x1fa0fd){try{utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x4f'),_0x1fa0fd[_0x4f7b('0x2')]),_0x1fa0fd);if(agents[_0x1fa0fd['uniqueid']]&&agents[_0x1fa0fd['uniqueid']]['reason']===_0x4f7b('0x23')){if(_0x1fa0fd[_0x4f7b('0x50')]==='21'){agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=_0x4f7b('0x51');agents[_0x1fa0fd['uniqueid']][_0x4f7b('0x9')]=_0x4f7b('0x51');}utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x5')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]));writeDB(agents[_0x1fa0fd[_0x4f7b('0x2')]]);var _0x19e4ab=unanswered[_0x4f7b('0x53')](_0x1fa0fd[_0x4f7b('0x2')]);if(_0x19e4ab>-0x1){unanswered[_0x4f7b('0x54')](_0x19e4ab,0x1);}}if(transfers[_0x1fa0fd[_0x4f7b('0x2')]]){transfers[_0x1fa0fd['uniqueid']]['agentcomplete']=!![];transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x36')]=utils[_0x4f7b('0x18')]();transfers[_0x1fa0fd[_0x4f7b('0x2')]]['talktime']=utils[_0x4f7b('0x55')](transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x36')],transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x37')]);transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=_0x4f7b('0x56');transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]=_0x4f7b('0x57');utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],transfers[_0x1fa0fd['uniqueid']][_0x4f7b('0x5')],transfers[_0x1fa0fd[_0x4f7b('0x2')]]['reason'],transfers[_0x1fa0fd['uniqueid']][_0x4f7b('0x9')]));writeDB(transfers[_0x1fa0fd[_0x4f7b('0x2')]],!![]);}if(agents[_0x1fa0fd[_0x4f7b('0x2')]]&&agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x37')]){agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0xd')]=!![];agents[_0x1fa0fd['uniqueid']]['agentcompleteAt']=utils[_0x4f7b('0x18')]();agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x2d')]=utils[_0x4f7b('0x55')](agents[_0x1fa0fd['uniqueid']][_0x4f7b('0x36')],agents[_0x1fa0fd[_0x4f7b('0x2')]]['agentconnectAt']);agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=agents[_0x1fa0fd['uniqueid']]['transfer']?_0x4f7b('0x3c'):'agent';agents[_0x1fa0fd['uniqueid']]['lastevent']=_0x4f7b('0x57');utils['info'](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x5')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]));writeDB(agents[_0x1fa0fd['uniqueid']]);}}catch(_0x476637){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x4f'),_0x1fa0fd[_0x4f7b('0x2')]),_0x476637);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 505884c..dcddd2a 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 _0x2042=['[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime'];(function(_0x224705,_0x135167){var _0x3354b1=function(_0x188bd7){while(--_0x188bd7){_0x224705['push'](_0x224705['shift']());}};_0x3354b1(++_0x135167);}(_0x2042,0xfe));var _0x2204=function(_0x24946f,_0x623783){_0x24946f=_0x24946f-0x0;var _0x4e4f15=_0x2042[_0x24946f];return _0x4e4f15;};'use strict';var _=require(_0x2204('0x0'));var util=require(_0x2204('0x1'));var utils=require(_0x2204('0x2'));var transfers=require(_0x2204('0x3'));var dispositions=[_0x2204('0x4'),_0x2204('0x5'),_0x2204('0x5'),'NO\x20ANSWER',_0x2204('0x4'),_0x2204('0x4'),_0x2204('0x6'),_0x2204('0x7'),'FAILED',_0x2204('0x5'),_0x2204('0x5')];var channels={};function writeDB(_0x322f01){var _0x11fa2f;if(transfers[_0x2204('0x8')][_0x322f01[_0x2204('0x9')]]){_0x11fa2f=_0x322f01[_0x2204('0x9')];_0x322f01[_0x2204('0x9')]=transfers[_0x2204('0x8')][_0x322f01[_0x2204('0x9')]][_0x2204('0xa')];}utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0xd'),_0x322f01[_0x2204('0x9')],_0x322f01[_0x2204('0xe')],_0x322f01[_0x2204('0xf')],_0x322f01[_0x2204('0x10')],_0x322f01['interface'],_0x322f01[_0x2204('0x11')],_0x322f01['connectedlinenum'],_0x322f01['lastevent']));if(_0x322f01[_0x2204('0x12')]){utils['getUserByInternal'](_0x322f01[_0x2204('0x12')])[_0x2204('0x13')](function(_0xc24301){if(_0xc24301){_0x322f01[_0x2204('0x14')]=_0xc24301['id'];}utils[_0x2204('0x15')](_0x2204('0x16'),_0x322f01);});}else{utils[_0x2204('0x15')](_0x2204('0x16'),_0x322f01);}if(channels[_0x322f01[_0x2204('0x9')]]){delete channels[_0x322f01['uniqueid']];}else if(_0x11fa2f&&channels[_0x11fa2f]){delete transfers[_0x2204('0x8')][_0x11fa2f];delete channels[_0x11fa2f];}}exports[_0x2204('0x17')]=function(_0x34193c){try{utils[_0x2204('0x18')](util[_0x2204('0xc')](_0x2204('0x19'),_0x34193c[_0x2204('0x9')]),_0x34193c);if(_0x34193c[_0x2204('0x9')]==_0x34193c[_0x2204('0x1a')]&&_0x34193c[_0x2204('0xe')]!=_0x2204('0x1b')){utils['info'](util[_0x2204('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x34193c[_0x2204('0x9')],_0x34193c[_0x2204('0x1c')],_0x34193c[_0x2204('0x1d')]));channels[_0x34193c['uniqueid']]={'uniqueid':_0x34193c[_0x2204('0x9')],'accountcode':_0x34193c[_0x2204('0x12')],'source':_0x34193c[_0x2204('0x11')],'destination':_0x34193c[_0x2204('0x1d')],'destinationcontext':_0x34193c[_0x2204('0x1c')],'channel':_0x34193c[_0x2204('0xe')],'starttime':utils[_0x2204('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2204('0x1f')};}}catch(_0xf6a7e){utils['error'](util[_0x2204('0xc')](_0x2204('0x19'),_0x34193c['uniqueid']),_0xf6a7e);}};exports[_0x2204('0x20')]=function(_0x5e6108){try{utils[_0x2204('0x18')](util[_0x2204('0xc')]('[%s][calls][newstate]',_0x5e6108[_0x2204('0x9')]),_0x5e6108);if(!_[_0x2204('0x21')](channels[_0x5e6108[_0x2204('0x9')]])&&_0x5e6108[_0x2204('0x22')]==0x6){utils['info'](util[_0x2204('0xc')](_0x2204('0x23'),_0x5e6108[_0x2204('0x9')],_0x5e6108['context'],_0x5e6108[_0x2204('0xe')]));if(_['isNil'](channels[_0x5e6108[_0x2204('0x9')]]['systemanswertime'])){channels[_0x5e6108[_0x2204('0x9')]][_0x2204('0x24')]=utils[_0x2204('0x1e')]();}}else if(!_[_0x2204('0x21')](channels[_0x5e6108[_0x2204('0x1a')]])&&_0x5e6108[_0x2204('0x22')]==0x6&&_0x5e6108[_0x2204('0x1c')]!='transfer'){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x25'),_0x5e6108[_0x2204('0x9')],_0x5e6108['linkedid'],_0x5e6108[_0x2204('0x1c')],_0x5e6108[_0x2204('0xe')]));channels[_0x5e6108[_0x2204('0x1a')]]['accountcode']=_0x5e6108[_0x2204('0x12')];channels[_0x5e6108['linkedid']][_0x2204('0x26')]=_0x5e6108[_0x2204('0xe')];if(_[_0x2204('0x21')](channels[_0x5e6108[_0x2204('0x1a')]][_0x2204('0x27')])){channels[_0x5e6108[_0x2204('0x1a')]][_0x2204('0x27')]=utils[_0x2204('0x1e')]();}channels[_0x5e6108['linkedid']][_0x2204('0x28')]=dispositions[_[_0x2204('0x29')](_0x5e6108[_0x2204('0x22')])]||'ANSWERED';}}catch(_0x176867){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x2b'),_0x5e6108[_0x2204('0x9')]),_0x176867);}};exports[_0x2204('0x2c')]=function(_0x1dd5c6){try{if(!_[_0x2204('0x21')](channels[_0x1dd5c6[_0x2204('0x9')]])){utils['debug'](util[_0x2204('0xc')](_0x2204('0x2d'),_0x1dd5c6[_0x2204('0x9')]),_0x1dd5c6);if(_[_0x2204('0x21')](channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x2e')])){channels[_0x1dd5c6[_0x2204('0x9')]]['callerid']=_0x1dd5c6[_0x2204('0x2f')]+'\x20<'+_0x1dd5c6['calleridnum']+'>';}utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x30'),_0x1dd5c6['uniqueid'],channels[_0x1dd5c6[_0x2204('0x9')]]['callerid'],_0x1dd5c6[_0x2204('0x31')]));channels[_0x1dd5c6[_0x2204('0x9')]]['endtime']=utils['now']();channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x32')]=utils[_0x2204('0x33')](channels[_0x1dd5c6['uniqueid']]['endtime'],channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x34')]);channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x35')]=channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x27')]?utils['diffTime'](channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x36')],channels[_0x1dd5c6[_0x2204('0x9')]]['answertime']):0x0;writeDB(channels[_0x1dd5c6[_0x2204('0x9')]]);}}catch(_0x3d44aa){utils['error'](util[_0x2204('0xc')](_0x2204('0x2d'),_0x1dd5c6['uniqueid']),_0x3d44aa);}};exports['attendedtransfer']=function(_0x3b033e){try{if(!_[_0x2204('0x21')](channels[_0x3b033e[_0x2204('0x37')]])){utils['debug'](util[_0x2204('0xc')](_0x2204('0x38'),_0x3b033e[_0x2204('0x39')]),_0x3b033e);if(channels[_0x3b033e[_0x2204('0x37')]][_0x2204('0xe')]==_0x3b033e[_0x2204('0x3a')]){utils[_0x2204('0xb')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3b033e['origtransfereruniqueid'],_0x3b033e['localtwolinkedid'],_0x3b033e[_0x2204('0x3b')]));channels[_0x3b033e['localtwolinkedid']][_0x2204('0x26')]=_0x3b033e[_0x2204('0x3b')];channels[_0x3b033e[_0x2204('0x37')]]['userfield']=_0x2204('0x3c');}else if(channels[_0x3b033e[_0x2204('0x37')]]['channel']=_0x3b033e['transfertargetchannel']){utils[_0x2204('0xb')](util[_0x2204('0xc')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3b033e['origtransfereruniqueid'],_0x3b033e[_0x2204('0x37')],_0x3b033e[_0x2204('0x3d')]));channels[_0x3b033e[_0x2204('0x37')]][_0x2204('0x26')]=_0x3b033e[_0x2204('0x3d')];channels[_0x3b033e[_0x2204('0x37')]][_0x2204('0x3e')]=_0x2204('0x3c');}}}catch(_0x20852d){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x38'),_0x3b033e[_0x2204('0x39')]),_0x20852d);}};exports[_0x2204('0x3f')]=function(_0x5cb7d4){try{if(!_[_0x2204('0x21')](channels[_0x5cb7d4['uniqueid']])){utils['debug'](util['format'](_0x2204('0x40'),_0x5cb7d4[_0x2204('0x9')]),_0x5cb7d4);channels[_0x5cb7d4[_0x2204('0x9')]][_0x2204('0x41')]=utils[_0x2204('0x1e')]();utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x42'),_0x5cb7d4[_0x2204('0x9')],channels[_0x5cb7d4['uniqueid']]['musiconholdstartAt']));}}catch(_0x32d0e1){utils[_0x2204('0x2a')](util['format'](_0x2204('0x40'),_0x5cb7d4[_0x2204('0x9')]),_0x32d0e1);}};exports[_0x2204('0x43')]=function(_0x3edd02){try{if(!_[_0x2204('0x21')](channels[_0x3edd02['uniqueid']])){utils['debug'](util['format'](_0x2204('0x44'),_0x3edd02[_0x2204('0x9')]),_0x3edd02);if(!_[_0x2204('0x21')](channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x41')])){channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x45')]+=utils[_0x2204('0x33')](utils[_0x2204('0x1e')](),channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x41')]);utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x46'),_0x3edd02['uniqueid'],channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x45')]));delete channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x41')];}}}catch(_0x189cb2){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x44'),_0x3edd02[_0x2204('0x9')]),_0x189cb2);}};exports[_0x2204('0x47')]=function(_0x5073fd){try{if(!_['isNil'](channels[_0x5073fd[_0x2204('0x9')]])){utils['debug'](util[_0x2204('0xc')](_0x2204('0x48'),_0x5073fd[_0x2204('0x9')]),_0x5073fd);if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')][_0x2204('0x4a')])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x4b'),_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x4d')]=_0x5073fd[_0x2204('0x4c')];}if(!_['isNil'](_0x5073fd[_0x2204('0x49')][_0x2204('0x4e')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x4f')]=_0x5073fd[_0x2204('0x4c')];channels[_0x5073fd[_0x2204('0x9')]][_0x2204('0x2e')]='\x22'+_0x5073fd[_0x2204('0x4c')]+_0x2204('0x50')+_0x5073fd['value']+'>';}if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')]['xmd-callerid-preview'])||!_[_0x2204('0x21')](_0x5073fd['variable'][_0x2204('0x51')])){utils['info'](util[_0x2204('0xc')](_0x2204('0x52'),_0x5073fd[_0x2204('0x9')],!_[_0x2204('0x21')](_0x5073fd['variable'][_0x2204('0x53')])?_0x2204('0x53'):_0x2204('0x51'),_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x2e')]=_0x5073fd[_0x2204('0x4c')];}if(!_[_0x2204('0x21')](_0x5073fd['variable'][_0x2204('0x54')])||!_['isNil'](_0x5073fd['variable'][_0x2204('0x55')])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x52'),_0x5073fd[_0x2204('0x9')],!_['isNil'](_0x5073fd[_0x2204('0x49')][_0x2204('0x54')])?_0x2204('0x54'):'xmcs-queue',_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x56')]=_0x2204('0x57');channels[_0x5073fd[_0x2204('0x9')]][_0x2204('0x58')]=_0x5073fd[_0x2204('0x4c')];channels[_0x5073fd[_0x2204('0x9')]][_0x2204('0xf')]=!![];}if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')]['xmd-contactid'])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x59'),_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x5a')]=_0x5073fd[_0x2204('0x4c')];}if(!_['isNil'](_0x5073fd[_0x2204('0x49')]['xmd-cdrtype'])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x5b'),_0x5073fd['uniqueid'],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd[_0x2204('0x9')]]['type']=_0x5073fd['value'];}if(!_['isNil'](_0x5073fd['variable']['outboundrouteid'])){utils['info'](util[_0x2204('0xc')](_0x2204('0x5c'),_0x5073fd[_0x2204('0x9')],_0x5073fd['value']));channels[_0x5073fd['uniqueid']][_0x2204('0x5d')]=_0x5073fd['value'];}if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')]['sipcallid'])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x5e'),_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd[_0x2204('0x9')]]['sipcallid']=_0x5073fd['value'];}}}catch(_0x933d89){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x48'),_0x5073fd[_0x2204('0x9')]),_0x933d89);}};exports[_0x2204('0x5f')]=function(_0x319a64){try{if(!_[_0x2204('0x21')](channels[_0x319a64['uniqueid']])){utils[_0x2204('0x18')](util['format']('[%s][calls][newexten]',_0x319a64[_0x2204('0x9')]),_0x319a64);utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x60'),_0x319a64['uniqueid'],_0x319a64['application'],_0x319a64[_0x2204('0x61')]));if(_0x319a64[_0x2204('0x62')][_0x2204('0x63')]()==_0x2204('0x64')&&_['startsWith'](_0x319a64[_0x2204('0x61')]['toLowerCase'](),_0x2204('0x65'))){var _0x1c9f12=_0x319a64['appdata'][_0x2204('0x66')]('=');var _0x355cbb=_0x1c9f12[0x0][_0x2204('0x67')](_0x1c9f12[0x0][_0x2204('0x68')]('(')+0x1,_0x1c9f12[0x0][_0x2204('0x68')](')'));var _0x19b16e=_0x1c9f12[0x1];channels[_0x319a64[_0x2204('0x9')]][_0x355cbb]=_0x19b16e;}if(!_[_0x2204('0x69')]([_0x2204('0x2c'),_0x2204('0x6a'),'execif',_0x2204('0x64'),'gotoif'],_0x319a64[_0x2204('0x62')][_0x2204('0x63')]())){channels[_0x319a64[_0x2204('0x9')]][_0x2204('0x56')]=_0x319a64[_0x2204('0x62')];channels[_0x319a64[_0x2204('0x9')]]['lastdata']=_0x319a64[_0x2204('0x61')];}}}catch(_0x552816){utils[_0x2204('0x2a')](util['format'](_0x2204('0x6b'),_0x319a64[_0x2204('0x9')]),_0x552816);}}; \ No newline at end of file +var _0x53ac=['musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','destination','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','application','set','appdata','cdr','split','substring','lastIndexOf','includes','execif','toLowerCase','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','starttime','billableseconds','diffTime','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x53ac,0xfb));var _0xc53a=function(_0x22617e,_0x5544c5){_0x22617e=_0x22617e-0x0;var _0x4f6458=_0x53ac[_0x22617e];return _0x4f6458;};'use strict';var _=require(_0xc53a('0x0'));var util=require(_0xc53a('0x1'));var utils=require(_0xc53a('0x2'));var transfers=require(_0xc53a('0x3'));var dispositions=[_0xc53a('0x4'),'FAILED',_0xc53a('0x5'),_0xc53a('0x4'),'NO\x20ANSWER',_0xc53a('0x4'),_0xc53a('0x6'),_0xc53a('0x7'),_0xc53a('0x5'),'FAILED',_0xc53a('0x5')];var channels={};function writeDB(_0x1282c6){var _0x45eefb;if(transfers[_0xc53a('0x8')][_0x1282c6[_0xc53a('0x9')]]){_0x45eefb=_0x1282c6['uniqueid'];_0x1282c6[_0xc53a('0x9')]=transfers['blinds'][_0x1282c6[_0xc53a('0x9')]][_0xc53a('0xa')];}utils[_0xc53a('0xb')](util[_0xc53a('0xc')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1282c6['uniqueid'],_0x1282c6[_0xc53a('0xd')],_0x1282c6[_0xc53a('0xe')],_0x1282c6['membername'],_0x1282c6['interface'],_0x1282c6['calleridnum'],_0x1282c6[_0xc53a('0xf')],_0x1282c6[_0xc53a('0x10')]));if(_0x1282c6[_0xc53a('0x11')]){utils[_0xc53a('0x12')](_0x1282c6[_0xc53a('0x11')])[_0xc53a('0x13')](function(_0x5c0fec){if(_0x5c0fec){_0x1282c6[_0xc53a('0x14')]=_0x5c0fec['id'];}utils[_0xc53a('0x15')](_0xc53a('0x16'),_0x1282c6);});}else{utils[_0xc53a('0x15')](_0xc53a('0x16'),_0x1282c6);}if(channels[_0x1282c6[_0xc53a('0x9')]]){delete channels[_0x1282c6['uniqueid']];}else if(_0x45eefb&&channels[_0x45eefb]){delete transfers[_0xc53a('0x8')][_0x45eefb];delete channels[_0x45eefb];}}exports[_0xc53a('0x17')]=function(_0x22bdd9){try{utils[_0xc53a('0x18')](util[_0xc53a('0xc')]('[%s][calls][newchannel]',_0x22bdd9[_0xc53a('0x9')]),_0x22bdd9);if(_0x22bdd9[_0xc53a('0x9')]==_0x22bdd9[_0xc53a('0x19')]&&_0x22bdd9[_0xc53a('0xd')]!=_0xc53a('0x1a')){utils[_0xc53a('0xb')](util['format'](_0xc53a('0x1b'),_0x22bdd9[_0xc53a('0x9')],_0x22bdd9[_0xc53a('0x1c')],_0x22bdd9[_0xc53a('0x1d')]));channels[_0x22bdd9['uniqueid']]={'uniqueid':_0x22bdd9[_0xc53a('0x9')],'accountcode':_0x22bdd9[_0xc53a('0x11')],'source':_0x22bdd9[_0xc53a('0x1e')],'destination':_0x22bdd9[_0xc53a('0x1d')],'destinationcontext':_0x22bdd9[_0xc53a('0x1c')],'channel':_0x22bdd9['channel'],'starttime':utils[_0xc53a('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc53a('0x4'),'amaflags':_0xc53a('0x20')};}}catch(_0x35dbf9){utils['error'](util[_0xc53a('0xc')](_0xc53a('0x21'),_0x22bdd9[_0xc53a('0x9')]),_0x35dbf9);}};exports[_0xc53a('0x22')]=function(_0x4c3e17){try{utils[_0xc53a('0x18')](util['format'](_0xc53a('0x23'),_0x4c3e17[_0xc53a('0x9')]),_0x4c3e17);if(!_[_0xc53a('0x24')](channels[_0x4c3e17[_0xc53a('0x9')]])&&_0x4c3e17[_0xc53a('0x25')]==0x6){utils['info'](util['format'](_0xc53a('0x26'),_0x4c3e17[_0xc53a('0x9')],_0x4c3e17['context'],_0x4c3e17[_0xc53a('0xd')]));if(_[_0xc53a('0x24')](channels[_0x4c3e17['uniqueid']][_0xc53a('0x27')])){channels[_0x4c3e17['uniqueid']][_0xc53a('0x27')]=utils[_0xc53a('0x1f')]();}}else if(!_[_0xc53a('0x24')](channels[_0x4c3e17[_0xc53a('0x19')]])&&_0x4c3e17['channelstate']==0x6&&_0x4c3e17[_0xc53a('0x1c')]!='transfer'){utils[_0xc53a('0xb')](util[_0xc53a('0xc')](_0xc53a('0x28'),_0x4c3e17[_0xc53a('0x9')],_0x4c3e17['linkedid'],_0x4c3e17['context'],_0x4c3e17[_0xc53a('0xd')]));channels[_0x4c3e17[_0xc53a('0x19')]]['accountcode']=_0x4c3e17['accountcode'];channels[_0x4c3e17['linkedid']][_0xc53a('0x29')]=_0x4c3e17['channel'];if(_[_0xc53a('0x24')](channels[_0x4c3e17['linkedid']][_0xc53a('0x2a')])){channels[_0x4c3e17[_0xc53a('0x19')]][_0xc53a('0x2a')]=utils[_0xc53a('0x1f')]();}channels[_0x4c3e17[_0xc53a('0x19')]]['disposition']=dispositions[_[_0xc53a('0x2b')](_0x4c3e17[_0xc53a('0x25')])]||_0xc53a('0x6');}}catch(_0x320ad1){utils['error'](util[_0xc53a('0xc')](_0xc53a('0x23'),_0x4c3e17['uniqueid']),_0x320ad1);}};exports[_0xc53a('0x2c')]=function(_0x3ba5a2){try{if(!_['isNil'](channels[_0x3ba5a2[_0xc53a('0x9')]])){utils['debug'](util[_0xc53a('0xc')](_0xc53a('0x2d'),_0x3ba5a2[_0xc53a('0x9')]),_0x3ba5a2);if(_['isNil'](channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x2e')])){channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x2e')]=_0x3ba5a2[_0xc53a('0x2f')]+'\x20<'+_0x3ba5a2[_0xc53a('0x1e')]+'>';}utils['info'](util[_0xc53a('0xc')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3ba5a2[_0xc53a('0x9')],channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x2e')],_0x3ba5a2[_0xc53a('0x30')]));channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x31')]=utils['now']();channels[_0x3ba5a2['uniqueid']][_0xc53a('0x32')]=utils['diffTime'](channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x31')],channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x33')]);channels[_0x3ba5a2['uniqueid']][_0xc53a('0x34')]=channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x2a')]?utils[_0xc53a('0x35')](channels[_0x3ba5a2['uniqueid']]['endtime'],channels[_0x3ba5a2[_0xc53a('0x9')]][_0xc53a('0x2a')]):0x0;writeDB(channels[_0x3ba5a2[_0xc53a('0x9')]]);}}catch(_0x3f6625){utils[_0xc53a('0x36')](util['format'](_0xc53a('0x2d'),_0x3ba5a2[_0xc53a('0x9')]),_0x3f6625);}};exports[_0xc53a('0x37')]=function(_0x4ed172){try{if(!_[_0xc53a('0x24')](channels[_0x4ed172[_0xc53a('0x38')]])){utils['debug'](util['format'](_0xc53a('0x39'),_0x4ed172[_0xc53a('0x3a')]),_0x4ed172);if(channels[_0x4ed172[_0xc53a('0x38')]][_0xc53a('0xd')]==_0x4ed172[_0xc53a('0x3b')]){utils['info'](util[_0xc53a('0xc')](_0xc53a('0x3c'),_0x4ed172[_0xc53a('0x3a')],_0x4ed172[_0xc53a('0x38')],_0x4ed172[_0xc53a('0x3d')]));channels[_0x4ed172['localtwolinkedid']]['destinationchannel']=_0x4ed172[_0xc53a('0x3d')];channels[_0x4ed172[_0xc53a('0x38')]][_0xc53a('0x3e')]=_0xc53a('0x3f');}else if(channels[_0x4ed172[_0xc53a('0x38')]]['channel']=_0x4ed172[_0xc53a('0x40')]){utils[_0xc53a('0xb')](util[_0xc53a('0xc')](_0xc53a('0x3c'),_0x4ed172[_0xc53a('0x3a')],_0x4ed172[_0xc53a('0x38')],_0x4ed172['origtransfererchannel']));channels[_0x4ed172['localtwolinkedid']]['destinationchannel']=_0x4ed172[_0xc53a('0x41')];channels[_0x4ed172[_0xc53a('0x38')]][_0xc53a('0x3e')]=_0xc53a('0x3f');}}}catch(_0x4353f9){utils[_0xc53a('0x36')](util[_0xc53a('0xc')](_0xc53a('0x39'),_0x4ed172[_0xc53a('0x3a')]),_0x4353f9);}};exports[_0xc53a('0x42')]=function(_0x446072){try{if(!_[_0xc53a('0x24')](channels[_0x446072[_0xc53a('0x9')]])){utils[_0xc53a('0x18')](util[_0xc53a('0xc')]('[%s][calls][musiconholdstart]',_0x446072[_0xc53a('0x9')]),_0x446072);channels[_0x446072[_0xc53a('0x9')]]['musiconholdstartAt']=utils[_0xc53a('0x1f')]();utils[_0xc53a('0xb')](util[_0xc53a('0xc')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x446072[_0xc53a('0x9')],channels[_0x446072[_0xc53a('0x9')]][_0xc53a('0x43')]));}}catch(_0x33d63d){utils['error'](util['format'](_0xc53a('0x44'),_0x446072['uniqueid']),_0x33d63d);}};exports[_0xc53a('0x45')]=function(_0x486c24){try{if(!_[_0xc53a('0x24')](channels[_0x486c24['uniqueid']])){utils[_0xc53a('0x18')](util[_0xc53a('0xc')](_0xc53a('0x46'),_0x486c24['uniqueid']),_0x486c24);if(!_[_0xc53a('0x24')](channels[_0x486c24['uniqueid']][_0xc53a('0x43')])){channels[_0x486c24[_0xc53a('0x9')]]['mohtime']+=utils[_0xc53a('0x35')](utils[_0xc53a('0x1f')](),channels[_0x486c24[_0xc53a('0x9')]]['musiconholdstartAt']);utils[_0xc53a('0xb')](util['format'](_0xc53a('0x47'),_0x486c24['uniqueid'],channels[_0x486c24[_0xc53a('0x9')]]['mohtime']));delete channels[_0x486c24[_0xc53a('0x9')]][_0xc53a('0x43')];}}}catch(_0x25e2ae){utils[_0xc53a('0x36')](util['format'](_0xc53a('0x46'),_0x486c24[_0xc53a('0x9')]),_0x25e2ae);}};exports[_0xc53a('0x48')]=function(_0x3be41c){try{if(!_[_0xc53a('0x24')](channels[_0x3be41c[_0xc53a('0x9')]])){utils[_0xc53a('0x18')](util[_0xc53a('0xc')](_0xc53a('0x49'),_0x3be41c[_0xc53a('0x9')]),_0x3be41c);if(!_[_0xc53a('0x24')](_0x3be41c[_0xc53a('0x4a')][_0xc53a('0x4b')])){utils['info'](util['format'](_0xc53a('0x4c'),_0x3be41c[_0xc53a('0x9')],_0x3be41c[_0xc53a('0x4d')]));channels[_0x3be41c[_0xc53a('0x9')]]['source']=_0x3be41c[_0xc53a('0x4d')];}if(!_['isNil'](_0x3be41c[_0xc53a('0x4a')]['xmd-phone'])){utils[_0xc53a('0xb')](util[_0xc53a('0xc')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3be41c[_0xc53a('0x9')],_0x3be41c[_0xc53a('0x4d')]));channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x4e')]=_0x3be41c[_0xc53a('0x4d')];channels[_0x3be41c['uniqueid']][_0xc53a('0x2e')]='\x22'+_0x3be41c[_0xc53a('0x4d')]+'\x22\x20<'+_0x3be41c['value']+'>';}if(!_[_0xc53a('0x24')](_0x3be41c[_0xc53a('0x4a')]['xmd-callerid-preview'])||!_[_0xc53a('0x24')](_0x3be41c[_0xc53a('0x4a')]['xmd-callerid'])){utils['info'](util['format'](_0xc53a('0x4f'),_0x3be41c['uniqueid'],!_[_0xc53a('0x24')](_0x3be41c['variable'][_0xc53a('0x50')])?_0xc53a('0x50'):_0xc53a('0x51'),_0x3be41c[_0xc53a('0x4d')]));channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x2e')]=_0x3be41c['value'];}if(!_['isNil'](_0x3be41c[_0xc53a('0x4a')][_0xc53a('0x52')])||!_[_0xc53a('0x24')](_0x3be41c[_0xc53a('0x4a')][_0xc53a('0x53')])){utils[_0xc53a('0xb')](util[_0xc53a('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3be41c[_0xc53a('0x9')],!_[_0xc53a('0x24')](_0x3be41c[_0xc53a('0x4a')]['xmd-queue'])?_0xc53a('0x52'):_0xc53a('0x53'),_0x3be41c[_0xc53a('0x4d')]));channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x54')]=_0xc53a('0x55');channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x56')]=_0x3be41c[_0xc53a('0x4d')];channels[_0x3be41c['uniqueid']][_0xc53a('0xe')]=!![];}if(!_['isNil'](_0x3be41c[_0xc53a('0x4a')][_0xc53a('0x57')])){utils[_0xc53a('0xb')](util[_0xc53a('0xc')](_0xc53a('0x58'),_0x3be41c['uniqueid'],_0x3be41c[_0xc53a('0x4d')]));channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x59')]=_0x3be41c['value'];}if(!_[_0xc53a('0x24')](_0x3be41c[_0xc53a('0x4a')][_0xc53a('0x5a')])){utils[_0xc53a('0xb')](util[_0xc53a('0xc')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3be41c[_0xc53a('0x9')],_0x3be41c[_0xc53a('0x4d')]));channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x5b')]=_0x3be41c[_0xc53a('0x4d')];}if(!_['isNil'](_0x3be41c[_0xc53a('0x4a')]['outboundrouteid'])){utils['info'](util[_0xc53a('0xc')](_0xc53a('0x5c'),_0x3be41c[_0xc53a('0x9')],_0x3be41c[_0xc53a('0x4d')]));channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x5d')]=_0x3be41c[_0xc53a('0x4d')];}if(!_[_0xc53a('0x24')](_0x3be41c['variable']['sipcallid'])){utils[_0xc53a('0xb')](util[_0xc53a('0xc')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x3be41c[_0xc53a('0x9')],_0x3be41c['value']));channels[_0x3be41c[_0xc53a('0x9')]][_0xc53a('0x5e')]=_0x3be41c['value'];}}}catch(_0x14fbfc){utils[_0xc53a('0x36')](util['format']('[%s][calls][varset]',_0x3be41c[_0xc53a('0x9')]),_0x14fbfc);}};exports['newexten']=function(_0x4f2ab5){try{if(!_['isNil'](channels[_0x4f2ab5[_0xc53a('0x9')]])){utils[_0xc53a('0x18')](util[_0xc53a('0xc')](_0xc53a('0x5f'),_0x4f2ab5[_0xc53a('0x9')]),_0x4f2ab5);utils[_0xc53a('0xb')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x4f2ab5[_0xc53a('0x9')],_0x4f2ab5['application'],_0x4f2ab5['appdata']));if(_0x4f2ab5[_0xc53a('0x60')]['toLowerCase']()==_0xc53a('0x61')&&_['startsWith'](_0x4f2ab5[_0xc53a('0x62')]['toLowerCase'](),_0xc53a('0x63'))){var _0x26e44b=_0x4f2ab5['appdata'][_0xc53a('0x64')]('=');var _0x440c29=_0x26e44b[0x0][_0xc53a('0x65')](_0x26e44b[0x0][_0xc53a('0x66')]('(')+0x1,_0x26e44b[0x0]['lastIndexOf'](')'));var _0x268cca=_0x26e44b[0x1];channels[_0x4f2ab5['uniqueid']][_0x440c29]=_0x268cca;}if(!_[_0xc53a('0x67')](['hangup','noop',_0xc53a('0x68'),_0xc53a('0x61'),'gotoif'],_0x4f2ab5[_0xc53a('0x60')][_0xc53a('0x69')]())){channels[_0x4f2ab5[_0xc53a('0x9')]][_0xc53a('0x54')]=_0x4f2ab5[_0xc53a('0x60')];channels[_0x4f2ab5[_0xc53a('0x9')]][_0xc53a('0x56')]=_0x4f2ab5[_0xc53a('0x62')];}}}catch(_0x29d58a){utils['error'](util[_0xc53a('0xc')](_0xc53a('0x5f'),_0x4f2ab5['uniqueid']),_0x29d58a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 2fbb089..7a7d785 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 _0x7246=['managerevent','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x15a93e,_0xe96e83){var _0x317797=function(_0x37211b){while(--_0x37211b){_0x15a93e['push'](_0x15a93e['shift']());}};_0x317797(++_0xe96e83);}(_0x7246,0x155));var _0x6724=function(_0x33bc0d,_0x54fc1a){_0x33bc0d=_0x33bc0d-0x0;var _0x3e79a3=_0x7246[_0x33bc0d];return _0x3e79a3;};'use strict';var utils=require('./utils');exports['connect']=function(){utils['info'](_0x6724('0x0'));};exports[_0x6724('0x1')]=function(){utils[_0x6724('0x2')](_0x6724('0x3'));};exports[_0x6724('0x4')]=function(){utils[_0x6724('0x2')]('[core]\x20fullybooted');};exports[_0x6724('0x5')]=function(_0x40566a){utils[_0x6724('0x5')](_0x6724('0x6'),_0x40566a);};exports[_0x6724('0x7')]=function(){utils['info'](_0x6724('0x8'));};exports[_0x6724('0x9')]=function(_0x2c5d0d){}; \ No newline at end of file +var _0x6a82=['[core]\x20fullybooted','error','close','managerevent','info','[core]\x20connected'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x6a82,0x1e4));var _0x26a8=function(_0x198e3b,_0x240f85){_0x198e3b=_0x198e3b-0x0;var _0x1ca62c=_0x6a82[_0x198e3b];return _0x1ca62c;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x26a8('0x0')](_0x26a8('0x1'));};exports['shutdown']=function(){utils[_0x26a8('0x0')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x26a8('0x0')](_0x26a8('0x2'));};exports[_0x26a8('0x3')]=function(_0x338844){utils[_0x26a8('0x3')]('[core]\x20error',_0x338844);};exports[_0x26a8('0x4')]=function(){utils[_0x26a8('0x0')]('[core]\x20close');};exports[_0x26a8('0x5')]=function(_0x1b2c2f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c4399a8..0dea97c 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 _0xe0a6=['[%s][dials][newexten]','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','debug','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','diffTime','endtime','holdtime','lodash','util','./utils','info','format','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten'];(function(_0x3e2a0b,_0x17f9a6){var _0x5e66d6=function(_0xebf0fb){while(--_0xebf0fb){_0x3e2a0b['push'](_0x3e2a0b['shift']());}};_0x5e66d6(++_0x17f9a6);}(_0xe0a6,0x1bf));var _0x6e0a=function(_0x58f2cf,_0x3f03dd){_0x58f2cf=_0x58f2cf-0x0;var _0x54bd3d=_0xe0a6[_0x58f2cf];return _0x54bd3d;};'use strict';var _=require(_0x6e0a('0x0'));var util=require(_0x6e0a('0x1'));var utils=require(_0x6e0a('0x2'));var dials={};function writeDB(_0x51ad5d){utils[_0x6e0a('0x3')](util[_0x6e0a('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x51ad5d[_0x6e0a('0x5')],_0x51ad5d[_0x6e0a('0x6')],_0x51ad5d[_0x6e0a('0x7')],_0x51ad5d['calleridnum'],_0x51ad5d[_0x6e0a('0x8')],_0x51ad5d[_0x6e0a('0x9')]));utils[_0x6e0a('0xa')](_0x6e0a('0xb'),_0x51ad5d);delete dials[_0x51ad5d[_0x6e0a('0x5')]];}exports[_0x6e0a('0xc')]=function(_0x161441){try{utils['debug'](util[_0x6e0a('0x4')](_0x6e0a('0xd'),_0x161441[_0x6e0a('0x5')]),_0x161441);utils['info'](util[_0x6e0a('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x161441[_0x6e0a('0x5')],_0x161441[_0x6e0a('0xe')],_0x161441[_0x6e0a('0xf')]));if(_0x161441[_0x6e0a('0xe')][_0x6e0a('0x10')]()==_0x6e0a('0x11')&&_[_0x6e0a('0x12')](_0x161441['appdata'][_0x6e0a('0x10')](),_0x6e0a('0x13'))){var _0xba8600=_0x161441[_0x6e0a('0xf')]['split']('=');dials[_0x161441[_0x6e0a('0x5')]]={'routeId':_0xba8600[0x1]};}}catch(_0x534022){utils['error'](util[_0x6e0a('0x4')](_0x6e0a('0xd'),_0x161441['uniqueid']),_0x534022);}};exports['varset']=function(_0x928b76){try{utils[_0x6e0a('0x14')](util[_0x6e0a('0x4')]('[%s][dials][varset]',_0x928b76['uniqueid']),_0x928b76);if(!_[_0x6e0a('0x15')](_0x928b76[_0x6e0a('0x16')][_0x6e0a('0x17')])){utils[_0x6e0a('0x3')](util['format'](_0x6e0a('0x18'),_0x928b76[_0x6e0a('0x5')],_0x928b76['value']));dials[_0x928b76[_0x6e0a('0x5')]]={'routeId':_0x928b76[_0x6e0a('0x19')]};}}catch(_0xb5c2ad){utils[_0x6e0a('0x1a')](util['format']('[%s][dials][varset]',_0x928b76[_0x6e0a('0x5')]),_0xb5c2ad);}};exports[_0x6e0a('0x1b')]=function(_0x2f94dc){try{if(!_[_0x6e0a('0x15')](dials[_0x2f94dc[_0x6e0a('0x5')]])){utils[_0x6e0a('0x14')](util['format'](_0x6e0a('0x1c'),_0x2f94dc[_0x6e0a('0x5')]),_0x2f94dc);dials[_0x2f94dc['uniqueid']]=_[_0x6e0a('0x1d')](dials[_0x2f94dc[_0x6e0a('0x5')]],_0x2f94dc);dials[_0x2f94dc['uniqueid']][_0x6e0a('0x1e')]=utils['now']();dials[_0x2f94dc['uniqueid']][_0x6e0a('0x1f')]=_0x6e0a('0x20');utils['info'](util[_0x6e0a('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2f94dc['uniqueid'],dials[_0x2f94dc[_0x6e0a('0x5')]][_0x6e0a('0x1e')]));}}catch(_0x19d4e9){utils[_0x6e0a('0x1a')](util[_0x6e0a('0x4')](_0x6e0a('0x1c'),_0x2f94dc[_0x6e0a('0x5')]),_0x19d4e9);}};exports['dialend']=function(_0x58bc68){try{if(!_['isNil'](dials[_0x58bc68['uniqueid']])){utils['debug'](util[_0x6e0a('0x4')]('[%s][dials][dialend]',_0x58bc68[_0x6e0a('0x5')]),_0x58bc68);dials[_0x58bc68[_0x6e0a('0x5')]][_0x6e0a('0x9')]=_0x58bc68[_0x6e0a('0x9')];if(_0x58bc68[_0x6e0a('0x9')]=='ANSWER'){dials[_0x58bc68[_0x6e0a('0x5')]]=_[_0x6e0a('0x1d')](dials[_0x58bc68[_0x6e0a('0x5')]],_0x58bc68);dials[_0x58bc68[_0x6e0a('0x5')]][_0x6e0a('0x21')]=utils[_0x6e0a('0x22')]();dials[_0x58bc68[_0x6e0a('0x5')]][_0x6e0a('0x1f')]=_0x6e0a('0x23');utils[_0x6e0a('0x3')](util[_0x6e0a('0x4')](_0x6e0a('0x24'),_0x58bc68[_0x6e0a('0x5')],_0x58bc68['dialstatus'],dials[_0x58bc68[_0x6e0a('0x5')]][_0x6e0a('0x21')]));}else{utils[_0x6e0a('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x58bc68[_0x6e0a('0x5')],_0x58bc68[_0x6e0a('0x9')]));}}}catch(_0x4efddb){utils['error'](util['format'](_0x6e0a('0x25'),_0x58bc68[_0x6e0a('0x5')]),_0x4efddb);}};exports[_0x6e0a('0x26')]=function(_0x82a4ea){try{if(!_[_0x6e0a('0x15')](dials[_0x82a4ea[_0x6e0a('0x5')]])){utils[_0x6e0a('0x14')](util[_0x6e0a('0x4')]('[%s][dials][hangup]',_0x82a4ea['uniqueid']),_0x82a4ea);utils['info'](util[_0x6e0a('0x4')](_0x6e0a('0x27'),_0x82a4ea[_0x6e0a('0x5')],_0x82a4ea[_0x6e0a('0x28')],_0x82a4ea['calleridname'],_0x82a4ea[_0x6e0a('0x29')]));dials[_0x82a4ea[_0x6e0a('0x5')]]=_[_0x6e0a('0x1d')](dials[_0x82a4ea[_0x6e0a('0x5')]],{'endtime':utils[_0x6e0a('0x22')](),'lastevent':_0x6e0a('0x2a')});dials[_0x82a4ea[_0x6e0a('0x5')]]['duration']=utils[_0x6e0a('0x2b')](dials[_0x82a4ea[_0x6e0a('0x5')]][_0x6e0a('0x2c')],dials[_0x82a4ea['uniqueid']][_0x6e0a('0x1e')]);dials[_0x82a4ea[_0x6e0a('0x5')]][_0x6e0a('0x2d')]=utils[_0x6e0a('0x2b')](dials[_0x82a4ea[_0x6e0a('0x5')]][_0x6e0a('0x21')]||dials[_0x82a4ea[_0x6e0a('0x5')]][_0x6e0a('0x2c')],dials[_0x82a4ea[_0x6e0a('0x5')]][_0x6e0a('0x1e')]);dials[_0x82a4ea['uniqueid']]['billableseconds']=dials[_0x82a4ea['uniqueid']][_0x6e0a('0x21')]?utils['diffTime'](dials[_0x82a4ea[_0x6e0a('0x5')]]['endtime'],dials[_0x82a4ea[_0x6e0a('0x5')]][_0x6e0a('0x21')]):0x0;writeDB(dials[_0x82a4ea['uniqueid']]);}}catch(_0x4ff428){utils[_0x6e0a('0x1a')](util[_0x6e0a('0x4')]('[%s][dials][hangup]',_0x82a4ea[_0x6e0a('0x5')]),_0x4ff428);}}; \ No newline at end of file +var _0x8198=['calleridnum','calleridname','complete','diffTime','endtime','lodash','util','./utils','info','format','uniqueid','channel','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr(routeid)','error','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0x8198,0x1db));var _0x8819=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0x8198[_0x2211ed];return _0x4d78cc;};'use strict';var _=require(_0x8819('0x0'));var util=require(_0x8819('0x1'));var utils=require(_0x8819('0x2'));var dials={};function writeDB(_0x273d96){utils[_0x8819('0x3')](util[_0x8819('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x273d96[_0x8819('0x5')],_0x273d96[_0x8819('0x6')],_0x273d96['dialstring'],_0x273d96['calleridnum'],_0x273d96[_0x8819('0x7')],_0x273d96['dialstatus']));utils[_0x8819('0x8')](_0x8819('0x9'),_0x273d96);delete dials[_0x273d96[_0x8819('0x5')]];}exports[_0x8819('0xa')]=function(_0x17e793){try{utils[_0x8819('0xb')](util[_0x8819('0x4')](_0x8819('0xc'),_0x17e793[_0x8819('0x5')]),_0x17e793);utils['info'](util[_0x8819('0x4')](_0x8819('0xd'),_0x17e793[_0x8819('0x5')],_0x17e793['application'],_0x17e793['appdata']));if(_0x17e793[_0x8819('0xe')][_0x8819('0xf')]()==_0x8819('0x10')&&_['startsWith'](_0x17e793[_0x8819('0x11')][_0x8819('0xf')](),_0x8819('0x12'))){var _0x1ca831=_0x17e793[_0x8819('0x11')]['split']('=');dials[_0x17e793[_0x8819('0x5')]]={'routeId':_0x1ca831[0x1]};}}catch(_0x14c82f){utils[_0x8819('0x13')](util[_0x8819('0x4')]('[%s][dials][newexten]',_0x17e793['uniqueid']),_0x14c82f);}};exports['varset']=function(_0x50a5f2){try{utils['debug'](util['format'](_0x8819('0x14'),_0x50a5f2[_0x8819('0x5')]),_0x50a5f2);if(!_[_0x8819('0x15')](_0x50a5f2['variable'][_0x8819('0x16')])){utils[_0x8819('0x3')](util[_0x8819('0x4')](_0x8819('0x17'),_0x50a5f2['uniqueid'],_0x50a5f2[_0x8819('0x18')]));dials[_0x50a5f2[_0x8819('0x5')]]={'routeId':_0x50a5f2['value']};}}catch(_0x924dcb){utils[_0x8819('0x13')](util['format'](_0x8819('0x14'),_0x50a5f2[_0x8819('0x5')]),_0x924dcb);}};exports[_0x8819('0x19')]=function(_0x3560dd){try{if(!_[_0x8819('0x15')](dials[_0x3560dd['uniqueid']])){utils[_0x8819('0xb')](util[_0x8819('0x4')](_0x8819('0x1a'),_0x3560dd[_0x8819('0x5')]),_0x3560dd);dials[_0x3560dd[_0x8819('0x5')]]=_[_0x8819('0x1b')](dials[_0x3560dd['uniqueid']],_0x3560dd);dials[_0x3560dd[_0x8819('0x5')]][_0x8819('0x1c')]=utils[_0x8819('0x1d')]();dials[_0x3560dd[_0x8819('0x5')]][_0x8819('0x1e')]=_0x8819('0x1f');utils['info'](util['format'](_0x8819('0x20'),_0x3560dd[_0x8819('0x5')],dials[_0x3560dd['uniqueid']][_0x8819('0x1c')]));}}catch(_0x2d5808){utils[_0x8819('0x13')](util[_0x8819('0x4')](_0x8819('0x1a'),_0x3560dd[_0x8819('0x5')]),_0x2d5808);}};exports[_0x8819('0x21')]=function(_0x2bf903){try{if(!_[_0x8819('0x15')](dials[_0x2bf903['uniqueid']])){utils['debug'](util[_0x8819('0x4')](_0x8819('0x22'),_0x2bf903[_0x8819('0x5')]),_0x2bf903);dials[_0x2bf903[_0x8819('0x5')]][_0x8819('0x23')]=_0x2bf903[_0x8819('0x23')];if(_0x2bf903['dialstatus']=='ANSWER'){dials[_0x2bf903[_0x8819('0x5')]]=_['assign'](dials[_0x2bf903[_0x8819('0x5')]],_0x2bf903);dials[_0x2bf903[_0x8819('0x5')]][_0x8819('0x24')]=utils[_0x8819('0x1d')]();dials[_0x2bf903['uniqueid']][_0x8819('0x1e')]=_0x8819('0x25');utils[_0x8819('0x3')](util['format'](_0x8819('0x26'),_0x2bf903['uniqueid'],_0x2bf903['dialstatus'],dials[_0x2bf903[_0x8819('0x5')]][_0x8819('0x24')]));}else{utils[_0x8819('0x3')](util[_0x8819('0x4')](_0x8819('0x27'),_0x2bf903['uniqueid'],_0x2bf903[_0x8819('0x23')]));}}}catch(_0x2d9d23){utils[_0x8819('0x13')](util[_0x8819('0x4')](_0x8819('0x22'),_0x2bf903[_0x8819('0x5')]),_0x2d9d23);}};exports[_0x8819('0x28')]=function(_0x58aebf){try{if(!_[_0x8819('0x15')](dials[_0x58aebf[_0x8819('0x5')]])){utils['debug'](util[_0x8819('0x4')]('[%s][dials][hangup]',_0x58aebf[_0x8819('0x5')]),_0x58aebf);utils['info'](util[_0x8819('0x4')](_0x8819('0x29'),_0x58aebf[_0x8819('0x5')],_0x58aebf[_0x8819('0x2a')],_0x58aebf[_0x8819('0x2b')],_0x58aebf['cause-txt']));dials[_0x58aebf[_0x8819('0x5')]]=_[_0x8819('0x1b')](dials[_0x58aebf[_0x8819('0x5')]],{'endtime':utils[_0x8819('0x1d')](),'lastevent':_0x8819('0x2c')});dials[_0x58aebf[_0x8819('0x5')]]['duration']=utils[_0x8819('0x2d')](dials[_0x58aebf[_0x8819('0x5')]]['endtime'],dials[_0x58aebf['uniqueid']]['starttime']);dials[_0x58aebf['uniqueid']]['holdtime']=utils[_0x8819('0x2d')](dials[_0x58aebf[_0x8819('0x5')]]['answertime']||dials[_0x58aebf[_0x8819('0x5')]]['endtime'],dials[_0x58aebf['uniqueid']][_0x8819('0x1c')]);dials[_0x58aebf['uniqueid']]['billableseconds']=dials[_0x58aebf[_0x8819('0x5')]]['answertime']?utils['diffTime'](dials[_0x58aebf[_0x8819('0x5')]][_0x8819('0x2e')],dials[_0x58aebf['uniqueid']][_0x8819('0x24')]):0x0;writeDB(dials[_0x58aebf[_0x8819('0x5')]]);}}catch(_0x271ac9){utils[_0x8819('0x13')](util['format']('[%s][dials][hangup]',_0x58aebf[_0x8819('0x5')]),_0x271ac9);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 2aec5f7..f3c245c 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 _0x4274=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','port','password','keepConnected','xdr','disabled','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','format','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]'];(function(_0xad661e,_0x181e73){var _0x52b42c=function(_0x2b8eb6){while(--_0x2b8eb6){_0xad661e['push'](_0xad661e['shift']());}};_0x52b42c(++_0x181e73);}(_0x4274,0xa2));var _0x4427=function(_0x44c4a3,_0x5a38fa){_0x44c4a3=_0x44c4a3-0x0;var _0x11982d=_0x4274[_0x44c4a3];return _0x11982d;};var AsteriskManager=require(_0x4427('0x0'));var config=require(_0x4427('0x1'));var utils=require(_0x4427('0x2'));var util=require(_0x4427('0x3'));var ami=new AsteriskManager(config[_0x4427('0x4')][_0x4427('0x5')],config[_0x4427('0x4')]['ip'],config[_0x4427('0x4')]['username'],config[_0x4427('0x4')][_0x4427('0x6')],!![]);ami[_0x4427('0x7')]();if(config[_0x4427('0x8')]&&config['xdr'][_0x4427('0x9')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x4427('0xa'));var calls=require(_0x4427('0xb'));var queues=require(_0x4427('0xc'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x4427('0xd'));var transfers=require(_0x4427('0xe'));var core=require(_0x4427('0xf'));ami['on'](_0x4427('0x10'),core[_0x4427('0x10')]);ami['on'](_0x4427('0x11'),core[_0x4427('0x11')]);ami['on'](_0x4427('0x12'),core['fullybooted']);ami['on']('error',core[_0x4427('0x13')]);ami['on']('close',core['close']);ami['on']('managerevent',core[_0x4427('0x14')]);ami['on']('devicestatechange',function(_0x21cac6){try{utils[_0x4427('0x15')](util['format'](_0x4427('0x16'),_0x21cac6[_0x4427('0x17')]),_0x21cac6);members[_0x4427('0x18')](_0x21cac6);}catch(_0x1eb2ac){utils[_0x4427('0x13')](util['format'](_0x4427('0x16'),_0x21cac6[_0x4427('0x17')]),_0x1eb2ac);}});ami['on']('agentcalled',function(_0x1f6644){try{utils['debug'](util[_0x4427('0x19')](_0x4427('0x1a'),_0x1f6644[_0x4427('0x1b')]),_0x1f6644);agents[_0x4427('0x1c')](_0x1f6644);}catch(_0x3192bb){utils['error'](util[_0x4427('0x19')]('[%s][index][agentcalled]',_0x1f6644[_0x4427('0x1b')]),_0x3192bb);}});ami['on']('agentringnoanswer',function(_0xadddaa){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x1d'),_0xadddaa[_0x4427('0x1b')]),_0xadddaa);agents[_0x4427('0x1e')](_0xadddaa);}catch(_0xd5fc1b){utils[_0x4427('0x13')](util[_0x4427('0x19')](_0x4427('0x1d'),_0xadddaa[_0x4427('0x1b')]),_0xd5fc1b);}});ami['on'](_0x4427('0x1f'),function(_0x1aa936){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x20'),_0x1aa936[_0x4427('0x1b')]),_0x1aa936);agents[_0x4427('0x1f')](_0x1aa936);queues['agentconnect'](_0x1aa936);}catch(_0x39377a){utils[_0x4427('0x13')](util[_0x4427('0x19')]('[%s][index][agentconnect]',_0x1aa936[_0x4427('0x1b')]),_0x39377a);}});ami['on'](_0x4427('0x21'),function(_0x2721b8){try{utils['debug'](util[_0x4427('0x19')]('[%s][index][agentcomplete]',_0x2721b8[_0x4427('0x1b')]),_0x2721b8);agents[_0x4427('0x21')](_0x2721b8);queues[_0x4427('0x21')](_0x2721b8);members[_0x4427('0x21')](_0x2721b8);}catch(_0x602e1d){utils['error'](util[_0x4427('0x19')](_0x4427('0x22'),_0x2721b8[_0x4427('0x1b')]),_0x602e1d);}});ami['on'](_0x4427('0x23'),function(_0x566dce){try{utils[_0x4427('0x15')](util['format'](_0x4427('0x24'),_0x566dce[_0x4427('0x1b')]),_0x566dce);agents[_0x4427('0x23')](_0x566dce);queues[_0x4427('0x23')](_0x566dce);}catch(_0x270ac6){utils[_0x4427('0x13')](util['format']('[%s][index][queuecallerabandon]',_0x566dce['uniqueid']),_0x270ac6);}});ami['on'](_0x4427('0x25'),function(_0x42452d){try{utils[_0x4427('0x15')](util[_0x4427('0x19')]('[%s][index][queuecallerjoin]',_0x42452d[_0x4427('0x1b')]),_0x42452d);queues['queuecallerjoin'](_0x42452d);recordings[_0x4427('0x25')](_0x42452d);}catch(_0x3a68eb){utils[_0x4427('0x13')](util[_0x4427('0x19')]('[%s][index][queuecallerjoin]',_0x42452d[_0x4427('0x1b')]),_0x3a68eb);}});ami['on'](_0x4427('0x26'),function(_0x3fa5b8){try{utils[_0x4427('0x15')](util['format'](_0x4427('0x27'),_0x3fa5b8['uniqueid']),_0x3fa5b8);queues[_0x4427('0x26')](_0x3fa5b8);}catch(_0x16229a){utils[_0x4427('0x13')](util[_0x4427('0x19')](_0x4427('0x27'),_0x3fa5b8['uniqueid']),_0x16229a);}});ami['on'](_0x4427('0x28'),function(_0xc7c17){try{utils[_0x4427('0x15')](util['format']('[%s][index][musiconholdstart]',_0xc7c17[_0x4427('0x1b')]),_0xc7c17);queues[_0x4427('0x28')](_0xc7c17);calls[_0x4427('0x28')](_0xc7c17);}catch(_0x3def1b){utils['error'](util[_0x4427('0x19')](_0x4427('0x29'),_0xc7c17[_0x4427('0x1b')]),_0x3def1b);}});ami['on'](_0x4427('0x2a'),function(_0x4bc33b){try{utils[_0x4427('0x15')](util[_0x4427('0x19')]('[%s][index][musiconholdstop]',_0x4bc33b[_0x4427('0x1b')]),_0x4bc33b);queues[_0x4427('0x2a')](_0x4bc33b);calls[_0x4427('0x2a')](_0x4bc33b);}catch(_0x4e0bb2){utils[_0x4427('0x13')](util[_0x4427('0x19')](_0x4427('0x2b'),_0x4bc33b[_0x4427('0x1b')]),_0x4e0bb2);}});ami['on']('newstate',function(_0x345852){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x2c'),_0x345852[_0x4427('0x1b')]),_0x345852);calls['newstate'](_0x345852);recordings['newstate'](_0x345852);}catch(_0x32a400){utils[_0x4427('0x13')](util['format']('[%s][index][newstate]',_0x345852[_0x4427('0x1b')]),_0x32a400);}});ami['on']('hangup',function(_0x238ad0){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x2d'),_0x238ad0[_0x4427('0x1b')]),_0x238ad0);calls[_0x4427('0x2e')](_0x238ad0);recordings[_0x4427('0x2e')](_0x238ad0);dials[_0x4427('0x2e')](_0x238ad0);agents['hangup'](_0x238ad0);queues['hangup'](_0x238ad0);}catch(_0x3e859e){utils[_0x4427('0x13')](util[_0x4427('0x19')](_0x4427('0x2d'),_0x238ad0[_0x4427('0x1b')]),_0x3e859e);}});ami['on'](_0x4427('0x2f'),function(_0x544750){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x30'),_0x544750['uniqueid']),_0x544750);members[_0x4427('0x2f')](_0x544750);}catch(_0x54290d){utils[_0x4427('0x13')](util[_0x4427('0x19')]('[%s][index][cdr]',_0x544750[_0x4427('0x1b')]),_0x54290d);}});ami['on']('blindtransfer',function(_0x1c02a2){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x31'),_0x1c02a2[_0x4427('0x1b')]),_0x1c02a2);queues[_0x4427('0x32')](_0x1c02a2);agents['blindtransfer'](_0x1c02a2);transfers[_0x4427('0x32')](_0x1c02a2);}catch(_0x382b24){utils['error'](util[_0x4427('0x19')](_0x4427('0x31'),_0x1c02a2[_0x4427('0x1b')]),_0x382b24);}});ami['on'](_0x4427('0x33'),function(_0x116599){try{utils[_0x4427('0x15')](util['format'](_0x4427('0x34'),_0x116599[_0x4427('0x35')]),_0x116599);queues['attendedtransfer'](_0x116599);transfers[_0x4427('0x33')](_0x116599);agents[_0x4427('0x33')](_0x116599);calls[_0x4427('0x33')](_0x116599);}catch(_0x3ffb91){utils['error'](util[_0x4427('0x19')](_0x4427('0x34'),_0x116599[_0x4427('0x35')]),_0x3ffb91);}});ami['on'](_0x4427('0x36'),function(_0x121097){try{utils[_0x4427('0x15')](util[_0x4427('0x19')]('[%s][index][varset]',_0x121097[_0x4427('0x1b')]),_0x121097);queues['varset'](_0x121097);recordings[_0x4427('0x36')](_0x121097);calls[_0x4427('0x36')](_0x121097);dials[_0x4427('0x36')](_0x121097);}catch(_0x5a4c57){utils[_0x4427('0x13')](util[_0x4427('0x19')](_0x4427('0x37'),_0x121097['uniqueid']),_0x5a4c57);}});ami['on'](_0x4427('0x38'),function(_0x146adc){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x39'),_0x146adc[_0x4427('0x1b')]),_0x146adc);calls[_0x4427('0x38')](_0x146adc);recordings[_0x4427('0x38')](_0x146adc);dials[_0x4427('0x38')](_0x146adc);}catch(_0x457e53){utils[_0x4427('0x13')](util[_0x4427('0x19')](_0x4427('0x39'),_0x146adc['uniqueid']),_0x457e53);}});ami['on'](_0x4427('0x3a'),function(_0x592b3c){try{utils['debug'](util[_0x4427('0x19')](_0x4427('0x3b'),_0x592b3c['uniqueid']),_0x592b3c);calls[_0x4427('0x3a')](_0x592b3c);recordings['newchannel'](_0x592b3c);}catch(_0x3b5ece){utils['error'](util['format']('[%s][index][newchannel]',_0x592b3c[_0x4427('0x1b')]),_0x3b5ece);}});ami['on'](_0x4427('0x3c'),function(_0x1a2518){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x3d'),_0x1a2518['uniqueid']),_0x1a2518);dials['dialbegin'](_0x1a2518);}catch(_0x330816){utils[_0x4427('0x13')](util['format'](_0x4427('0x3e'),_0x1a2518[_0x4427('0x1b')]),_0x330816);}});ami['on']('dialend',function(_0x3528e4){try{utils[_0x4427('0x15')](util[_0x4427('0x19')](_0x4427('0x3f'),_0x3528e4[_0x4427('0x1b')]),_0x3528e4);dials[_0x4427('0x40')](_0x3528e4);}catch(_0x3899a2){utils[_0x4427('0x13')](util[_0x4427('0x19')](_0x4427('0x3f'),_0x3528e4[_0x4427('0x1b')]),_0x3899a2);}});} \ No newline at end of file +var _0xa09a=['queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','asterisk-manager','./utils','util','asterisk','port','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','debug','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','uniqueid','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x2db025,_0x1cf6de){var _0x47afbe=function(_0x37840e){while(--_0x37840e){_0x2db025['push'](_0x2db025['shift']());}};_0x47afbe(++_0x1cf6de);}(_0xa09a,0xe3));var _0xaa09=function(_0x270890,_0x3c331a){_0x270890=_0x270890-0x0;var _0x27dd0c=_0xa09a[_0x270890];return _0x27dd0c;};var AsteriskManager=require(_0xaa09('0x0'));var config=require('../../config/environment');var utils=require(_0xaa09('0x1'));var util=require(_0xaa09('0x2'));var ami=new AsteriskManager(config[_0xaa09('0x3')][_0xaa09('0x4')],config['asterisk']['ip'],config[_0xaa09('0x3')][_0xaa09('0x5')],config['asterisk']['password'],!![]);ami[_0xaa09('0x6')]();if(config[_0xaa09('0x7')]&&config[_0xaa09('0x7')][_0xaa09('0x8')]){utils[_0xaa09('0x9')](_0xaa09('0xa'));}else{var agents=require(_0xaa09('0xb'));var calls=require(_0xaa09('0xc'));var queues=require(_0xaa09('0xd'));var recordings=require('./recordings.controller');var members=require(_0xaa09('0xe'));var dials=require(_0xaa09('0xf'));var transfers=require(_0xaa09('0x10'));var core=require('./core.controller');ami['on'](_0xaa09('0x11'),core[_0xaa09('0x11')]);ami['on'](_0xaa09('0x12'),core['shutdown']);ami['on'](_0xaa09('0x13'),core[_0xaa09('0x13')]);ami['on'](_0xaa09('0x14'),core['error']);ami['on']('close',core[_0xaa09('0x15')]);ami['on']('managerevent',core[_0xaa09('0x16')]);ami['on'](_0xaa09('0x17'),function(_0x5096b7){try{utils['debug'](util[_0xaa09('0x18')](_0xaa09('0x19'),_0x5096b7[_0xaa09('0x1a')]),_0x5096b7);members[_0xaa09('0x17')](_0x5096b7);}catch(_0x17a014){utils['error'](util[_0xaa09('0x18')](_0xaa09('0x19'),_0x5096b7['device']),_0x17a014);}});ami['on'](_0xaa09('0x1b'),function(_0x1fc53f){try{utils['debug'](util[_0xaa09('0x18')](_0xaa09('0x1c'),_0x1fc53f['uniqueid']),_0x1fc53f);agents[_0xaa09('0x1b')](_0x1fc53f);}catch(_0x1e6662){utils[_0xaa09('0x14')](util[_0xaa09('0x18')]('[%s][index][agentcalled]',_0x1fc53f['uniqueid']),_0x1e6662);}});ami['on']('agentringnoanswer',function(_0x1bc5b8){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')](_0xaa09('0x1e'),_0x1bc5b8['uniqueid']),_0x1bc5b8);agents[_0xaa09('0x1f')](_0x1bc5b8);}catch(_0x2a243a){utils['error'](util[_0xaa09('0x18')](_0xaa09('0x1e'),_0x1bc5b8['uniqueid']),_0x2a243a);}});ami['on'](_0xaa09('0x20'),function(_0x4f7e2d){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')]('[%s][index][agentconnect]',_0x4f7e2d[_0xaa09('0x21')]),_0x4f7e2d);agents[_0xaa09('0x20')](_0x4f7e2d);queues['agentconnect'](_0x4f7e2d);}catch(_0x40259f){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x22'),_0x4f7e2d['uniqueid']),_0x40259f);}});ami['on'](_0xaa09('0x23'),function(_0x2be5e2){try{utils['debug'](util[_0xaa09('0x18')](_0xaa09('0x24'),_0x2be5e2[_0xaa09('0x21')]),_0x2be5e2);agents[_0xaa09('0x23')](_0x2be5e2);queues['agentcomplete'](_0x2be5e2);members[_0xaa09('0x23')](_0x2be5e2);}catch(_0x32bdd8){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x24'),_0x2be5e2[_0xaa09('0x21')]),_0x32bdd8);}});ami['on'](_0xaa09('0x25'),function(_0x19edd3){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')]('[%s][index][queuecallerabandon]',_0x19edd3['uniqueid']),_0x19edd3);agents[_0xaa09('0x25')](_0x19edd3);queues[_0xaa09('0x25')](_0x19edd3);}catch(_0x1709f2){utils[_0xaa09('0x14')](util[_0xaa09('0x18')]('[%s][index][queuecallerabandon]',_0x19edd3['uniqueid']),_0x1709f2);}});ami['on'](_0xaa09('0x26'),function(_0x30a70b){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')]('[%s][index][queuecallerjoin]',_0x30a70b[_0xaa09('0x21')]),_0x30a70b);queues[_0xaa09('0x26')](_0x30a70b);recordings[_0xaa09('0x26')](_0x30a70b);}catch(_0x4e0096){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x27'),_0x30a70b[_0xaa09('0x21')]),_0x4e0096);}});ami['on'](_0xaa09('0x28'),function(_0x518f41){try{utils[_0xaa09('0x1d')](util['format']('[%s][index][queuecallerleave]',_0x518f41[_0xaa09('0x21')]),_0x518f41);queues[_0xaa09('0x28')](_0x518f41);}catch(_0x5bd9c4){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x29'),_0x518f41[_0xaa09('0x21')]),_0x5bd9c4);}});ami['on'](_0xaa09('0x2a'),function(_0x25f581){try{utils[_0xaa09('0x1d')](util['format'](_0xaa09('0x2b'),_0x25f581[_0xaa09('0x21')]),_0x25f581);queues[_0xaa09('0x2a')](_0x25f581);calls[_0xaa09('0x2a')](_0x25f581);}catch(_0x248e91){utils[_0xaa09('0x14')](util[_0xaa09('0x18')]('[%s][index][musiconholdstart]',_0x25f581[_0xaa09('0x21')]),_0x248e91);}});ami['on']('musiconholdstop',function(_0x6ff3b6){try{utils[_0xaa09('0x1d')](util['format'](_0xaa09('0x2c'),_0x6ff3b6[_0xaa09('0x21')]),_0x6ff3b6);queues[_0xaa09('0x2d')](_0x6ff3b6);calls[_0xaa09('0x2d')](_0x6ff3b6);}catch(_0x14b9e9){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x2c'),_0x6ff3b6[_0xaa09('0x21')]),_0x14b9e9);}});ami['on']('newstate',function(_0x5c508d){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')](_0xaa09('0x2e'),_0x5c508d[_0xaa09('0x21')]),_0x5c508d);calls['newstate'](_0x5c508d);recordings['newstate'](_0x5c508d);}catch(_0x43e236){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x2e'),_0x5c508d[_0xaa09('0x21')]),_0x43e236);}});ami['on'](_0xaa09('0x2f'),function(_0x35b2a6){try{utils['debug'](util['format'](_0xaa09('0x30'),_0x35b2a6[_0xaa09('0x21')]),_0x35b2a6);calls[_0xaa09('0x2f')](_0x35b2a6);recordings[_0xaa09('0x2f')](_0x35b2a6);dials['hangup'](_0x35b2a6);agents['hangup'](_0x35b2a6);queues[_0xaa09('0x2f')](_0x35b2a6);}catch(_0x1eeddf){utils[_0xaa09('0x14')](util[_0xaa09('0x18')]('[%s][index][hangup]',_0x35b2a6[_0xaa09('0x21')]),_0x1eeddf);}});ami['on']('cdr',function(_0x3eb78f){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')](_0xaa09('0x31'),_0x3eb78f[_0xaa09('0x21')]),_0x3eb78f);members[_0xaa09('0x32')](_0x3eb78f);}catch(_0x367e69){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x31'),_0x3eb78f[_0xaa09('0x21')]),_0x367e69);}});ami['on']('blindtransfer',function(_0x64d420){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')](_0xaa09('0x33'),_0x64d420[_0xaa09('0x21')]),_0x64d420);queues[_0xaa09('0x34')](_0x64d420);agents['blindtransfer'](_0x64d420);transfers[_0xaa09('0x34')](_0x64d420);}catch(_0xe67f5d){utils[_0xaa09('0x14')](util['format'](_0xaa09('0x33'),_0x64d420[_0xaa09('0x21')]),_0xe67f5d);}});ami['on'](_0xaa09('0x35'),function(_0x4a160c){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')]('[%s][index][attendedtransfer]',_0x4a160c[_0xaa09('0x36')]),_0x4a160c);queues[_0xaa09('0x35')](_0x4a160c);transfers[_0xaa09('0x35')](_0x4a160c);agents[_0xaa09('0x35')](_0x4a160c);calls['attendedtransfer'](_0x4a160c);}catch(_0x5ac5cf){utils['error'](util[_0xaa09('0x18')](_0xaa09('0x37'),_0x4a160c[_0xaa09('0x36')]),_0x5ac5cf);}});ami['on'](_0xaa09('0x38'),function(_0x500b9e){try{utils[_0xaa09('0x1d')](util['format'](_0xaa09('0x39'),_0x500b9e[_0xaa09('0x21')]),_0x500b9e);queues[_0xaa09('0x38')](_0x500b9e);recordings[_0xaa09('0x38')](_0x500b9e);calls[_0xaa09('0x38')](_0x500b9e);dials[_0xaa09('0x38')](_0x500b9e);}catch(_0x1959af){utils[_0xaa09('0x14')](util['format'](_0xaa09('0x39'),_0x500b9e[_0xaa09('0x21')]),_0x1959af);}});ami['on'](_0xaa09('0x3a'),function(_0x48970e){try{utils['debug'](util[_0xaa09('0x18')](_0xaa09('0x3b'),_0x48970e['uniqueid']),_0x48970e);calls['newexten'](_0x48970e);recordings[_0xaa09('0x3a')](_0x48970e);dials['newexten'](_0x48970e);}catch(_0x5a6354){utils['error'](util[_0xaa09('0x18')]('[%s][index][newexten]',_0x48970e[_0xaa09('0x21')]),_0x5a6354);}});ami['on'](_0xaa09('0x3c'),function(_0x27451e){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')]('[%s][index][newchannel]',_0x27451e[_0xaa09('0x21')]),_0x27451e);calls[_0xaa09('0x3c')](_0x27451e);recordings[_0xaa09('0x3c')](_0x27451e);}catch(_0x1a033c){utils['error'](util[_0xaa09('0x18')](_0xaa09('0x3d'),_0x27451e[_0xaa09('0x21')]),_0x1a033c);}});ami['on']('dialbegin',function(_0x3df2c8){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')](_0xaa09('0x3e'),_0x3df2c8[_0xaa09('0x21')]),_0x3df2c8);dials[_0xaa09('0x3f')](_0x3df2c8);}catch(_0x81a34e){utils[_0xaa09('0x14')](util[_0xaa09('0x18')](_0xaa09('0x40'),_0x3df2c8['uniqueid']),_0x81a34e);}});ami['on'](_0xaa09('0x41'),function(_0xd47d){try{utils[_0xaa09('0x1d')](util[_0xaa09('0x18')]('[%s][index][dialend]',_0xd47d[_0xaa09('0x21')]),_0xd47d);dials[_0xaa09('0x41')](_0xd47d);}catch(_0x21ffb6){utils[_0xaa09('0x14')](util[_0xaa09('0x18')]('[%s][index][dialend]',_0xd47d['uniqueid']),_0x21ffb6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e74828f..d699cf4 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 _0x1db3=['NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','assign','[%s][members][agentcomplete]','[%s][members][cdr]','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','split','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now'];(function(_0x1c8f35,_0x1375a6){var _0x4d0f41=function(_0x1d9f5d){while(--_0x1d9f5d){_0x1c8f35['push'](_0x1c8f35['shift']());}};_0x4d0f41(++_0x1375a6);}(_0x1db3,0x1e5));var _0x31db=function(_0x2703ce,_0x42c0f1){_0x2703ce=_0x2703ce-0x0;var _0x559acd=_0x1db3[_0x2703ce];return _0x559acd;};'use strict';var _=require('lodash');var util=require(_0x31db('0x0'));var utils=require(_0x31db('0x1'));var members={};var exclude=[_0x31db('0x2'),_0x31db('0x3')];function writeDB(_0x840c38){utils[_0x31db('0x4')](util[_0x31db('0x5')](_0x31db('0x6'),_0x840c38[_0x31db('0x7')],_0x840c38[_0x31db('0x8')],_0x840c38[_0x31db('0x9')],_0x840c38[_0x31db('0xa')],_0x840c38[_0x31db('0xb')],_0x840c38[_0x31db('0xc')]));if(_0x840c38[_0x31db('0x8')]){utils[_0x31db('0xd')](_0x840c38[_0x31db('0x8')])[_0x31db('0xe')](function(_0x34ee71){if(_0x34ee71){_0x840c38['membername']=_0x34ee71[_0x31db('0xf')];_0x840c38[_0x31db('0x10')]=_0x34ee71[_0x31db('0x10')];utils[_0x31db('0x11')](_0x31db('0x12'),_0x840c38);}else{utils['getUserByName'](_0x840c38[_0x31db('0x8')][_0x31db('0x13')]('/')[0x1])[_0x31db('0xe')](function(_0x49ce46){if(_0x49ce46){_0x840c38[_0x31db('0xb')]=_0x49ce46[_0x31db('0xf')];_0x840c38[_0x31db('0x10')]=_0x49ce46[_0x31db('0x10')];utils[_0x31db('0x11')](_0x31db('0x12'),_0x840c38);}});}})['catch'](function(_0x5ccd23){utils[_0x31db('0x14')](util['format'](_0x31db('0x15'),_0x840c38[_0x31db('0x7')]),_0x5ccd23);});}delete members[_0x840c38[_0x31db('0x8')]];}function startsWith(_0x2009c7,_0x29f691){return _['some'](_0x2009c7,function(_0x557907){return _['startsWith'](_0x29f691,_0x557907);});}exports[_0x31db('0x16')]=function(_0x22aa89){try{utils[_0x31db('0x17')](util[_0x31db('0x5')](_0x31db('0x18'),members[_0x22aa89[_0x31db('0x19')]]?members[_0x22aa89[_0x31db('0x19')]][_0x31db('0x7')]:_0x22aa89[_0x31db('0x19')]),_0x22aa89);utils[_0x31db('0x4')](util[_0x31db('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x22aa89[_0x31db('0x19')]]?members[_0x22aa89['device']]['uniqueid']:_0x22aa89[_0x31db('0x19')],_0x22aa89[_0x31db('0x1a')],_0x22aa89[_0x31db('0x19')]));switch(_0x22aa89[_0x31db('0x1a')]){case _0x31db('0x1b'):case _0x31db('0x1c'):if(!startsWith(exclude,_0x22aa89[_0x31db('0x19')])){members[_0x22aa89[_0x31db('0x19')]]={'channel':_0x31db('0x1d'),'interface':_0x22aa89[_0x31db('0x19')],'type':_0x31db('0x1e'),'enterAt':utils[_0x31db('0x1f')](),'role':'agent'};}break;case _0x31db('0x20'):if(!_[_0x31db('0x21')](members[_0x22aa89[_0x31db('0x19')]])){members[_0x22aa89['device']][_0x31db('0x22')]=utils['now']();members[_0x22aa89['device']][_0x31db('0x23')]=utils[_0x31db('0x24')](members[_0x22aa89['device']]['exitAt'],members[_0x22aa89['device']][_0x31db('0x25')]);if(members[_0x22aa89['device']][_0x31db('0x7')]){writeDB(members[_0x22aa89[_0x31db('0x19')]]);}}break;default:break;}}catch(_0x1f3355){utils[_0x31db('0x14')](util[_0x31db('0x5')](_0x31db('0x18'),members[_0x22aa89[_0x31db('0x19')]]?members[_0x22aa89[_0x31db('0x19')]][_0x31db('0x7')]:_0x22aa89['device']),_0x1f3355);}};exports[_0x31db('0x26')]=function(_0x3a7386){try{if(!_['isNil'](members[_0x3a7386['interface']])){utils[_0x31db('0x17')](util['format']('[%s][members][agentcomplete]',_0x3a7386['uniqueid']),_0x3a7386);utils[_0x31db('0x4')](util[_0x31db('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3a7386[_0x31db('0x7')],_0x3a7386['interface'],_0x3a7386['queue']));members[_0x3a7386[_0x31db('0x8')]]=_[_0x31db('0x27')](members[_0x3a7386[_0x31db('0x8')]],{'data4':_0x3a7386['queue'],'uniqueid':_0x3a7386['uniqueid']});}}catch(_0x38c545){utils[_0x31db('0x14')](util[_0x31db('0x5')](_0x31db('0x28'),_0x3a7386[_0x31db('0x7')]),_0x38c545);}};exports['cdr']=function(_0x555cb5){try{utils[_0x31db('0x17')](util['format'](_0x31db('0x29'),_0x555cb5['uniqueid']),_0x555cb5);if(_0x555cb5[_0x31db('0x9')]){var _0x3204f6=_0x555cb5[_0x31db('0x9')][_0x31db('0x13')]('-')[0x0];if(!_['isNil'](members[_0x3204f6])){members[_0x3204f6]=_[_0x31db('0x27')](members[_0x3204f6],{'data1':members[_0x3204f6][_0x31db('0x2a')]||_0x555cb5['type'],'data2':members[_0x3204f6]['data2']||_0x555cb5[_0x31db('0x2b')],'data3':members[_0x3204f6][_0x31db('0x2c')]||_0x555cb5['destination'],'uniqueid':members[_0x3204f6]['uniqueid']||_0x555cb5[_0x31db('0x7')]});utils[_0x31db('0x4')](util[_0x31db('0x5')](_0x31db('0x2d'),_0x555cb5['uniqueid'],members[_0x3204f6][_0x31db('0x2a')],members[_0x3204f6][_0x31db('0xa')],members[_0x3204f6][_0x31db('0x2c')]));if(members[_0x3204f6]['exitAt']){writeDB(members[_0x3204f6]);}}}if(_0x555cb5[_0x31db('0x2e')]){var _0x5d2ed7=_0x555cb5[_0x31db('0x2e')][_0x31db('0x13')]('-')[0x0];if(!_[_0x31db('0x21')](members[_0x5d2ed7])){members[_0x5d2ed7]=_[_0x31db('0x27')](members[_0x5d2ed7],{'data1':members[_0x5d2ed7]['data1']||_0x555cb5[_0x31db('0xc')],'data2':members[_0x5d2ed7][_0x31db('0xa')]||_0x555cb5[_0x31db('0x2b')],'data3':members[_0x5d2ed7][_0x31db('0x2c')]||_0x555cb5['destination'],'uniqueid':members[_0x5d2ed7][_0x31db('0x7')]||_0x555cb5[_0x31db('0x7')]});utils[_0x31db('0x4')](util[_0x31db('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x555cb5[_0x31db('0x7')],members[_0x5d2ed7][_0x31db('0x2a')],members[_0x5d2ed7][_0x31db('0xa')],members[_0x5d2ed7][_0x31db('0x2c')]));if(members[_0x5d2ed7][_0x31db('0x22')]){writeDB(members[_0x5d2ed7]);}}}}catch(_0x97e7f7){utils[_0x31db('0x14')](util[_0x31db('0x5')](_0x31db('0x29'),_0x555cb5[_0x31db('0x7')]),_0x97e7f7);}}; \ No newline at end of file +var _0x87f3=['error','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','channel','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','source','util','./utils','Local/_attended@transfer','info','format','uniqueid','interface','data2','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','membername','name','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt'];(function(_0x4d68f8,_0x35ca6f){var _0x5cad9d=function(_0x252836){while(--_0x252836){_0x4d68f8['push'](_0x4d68f8['shift']());}};_0x5cad9d(++_0x35ca6f);}(_0x87f3,0x165));var _0x387f=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x87f3[_0x37a7c6];return _0x539905;};'use strict';var _=require('lodash');var util=require(_0x387f('0x0'));var utils=require(_0x387f('0x1'));var members={};var exclude=[_0x387f('0x2'),'Queue:'];function writeDB(_0x1ac688){utils[_0x387f('0x3')](util[_0x387f('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x1ac688[_0x387f('0x5')],_0x1ac688[_0x387f('0x6')],_0x1ac688['channel'],_0x1ac688[_0x387f('0x7')],_0x1ac688['membername'],_0x1ac688[_0x387f('0x8')]));if(_0x1ac688[_0x387f('0x6')]){utils[_0x387f('0x9')](_0x1ac688[_0x387f('0x6')])[_0x387f('0xa')](function(_0x1d9971){if(_0x1d9971){_0x1ac688['membername']=_0x1d9971['name'];_0x1ac688['internal']=_0x1d9971[_0x387f('0xb')];utils[_0x387f('0xc')](_0x387f('0xd'),_0x1ac688);}else{utils[_0x387f('0xe')](_0x1ac688['interface'][_0x387f('0xf')]('/')[0x1])[_0x387f('0xa')](function(_0x25fe10){if(_0x25fe10){_0x1ac688[_0x387f('0x10')]=_0x25fe10[_0x387f('0x11')];_0x1ac688[_0x387f('0xb')]=_0x25fe10['internal'];utils['request'](_0x387f('0xd'),_0x1ac688);}});}})['catch'](function(_0x48361e){utils['error'](util[_0x387f('0x4')](_0x387f('0x12'),_0x1ac688['uniqueid']),_0x48361e);});}delete members[_0x1ac688[_0x387f('0x6')]];}function startsWith(_0x396045,_0x5928d9){return _[_0x387f('0x13')](_0x396045,function(_0xa16ca1){return _['startsWith'](_0x5928d9,_0xa16ca1);});}exports['devicestatechange']=function(_0xf029b6){try{utils[_0x387f('0x14')](util[_0x387f('0x4')](_0x387f('0x15'),members[_0xf029b6['device']]?members[_0xf029b6['device']][_0x387f('0x5')]:_0xf029b6['device']),_0xf029b6);utils['info'](util[_0x387f('0x4')](_0x387f('0x16'),members[_0xf029b6[_0x387f('0x17')]]?members[_0xf029b6[_0x387f('0x17')]]['uniqueid']:_0xf029b6[_0x387f('0x17')],_0xf029b6[_0x387f('0x18')],_0xf029b6[_0x387f('0x17')]));switch(_0xf029b6['state']){case'INUSE':case _0x387f('0x19'):if(!startsWith(exclude,_0xf029b6[_0x387f('0x17')])){members[_0xf029b6[_0x387f('0x17')]]={'channel':_0x387f('0x1a'),'interface':_0xf029b6['device'],'type':'TALKING','enterAt':utils[_0x387f('0x1b')](),'role':_0x387f('0x1c')};}break;case _0x387f('0x1d'):if(!_[_0x387f('0x1e')](members[_0xf029b6['device']])){members[_0xf029b6[_0x387f('0x17')]][_0x387f('0x1f')]=utils[_0x387f('0x1b')]();members[_0xf029b6['device']][_0x387f('0x20')]=utils[_0x387f('0x21')](members[_0xf029b6[_0x387f('0x17')]][_0x387f('0x1f')],members[_0xf029b6[_0x387f('0x17')]][_0x387f('0x22')]);if(members[_0xf029b6[_0x387f('0x17')]]['uniqueid']){writeDB(members[_0xf029b6[_0x387f('0x17')]]);}}break;default:break;}}catch(_0x225ac1){utils[_0x387f('0x23')](util[_0x387f('0x4')](_0x387f('0x15'),members[_0xf029b6[_0x387f('0x17')]]?members[_0xf029b6[_0x387f('0x17')]][_0x387f('0x5')]:_0xf029b6[_0x387f('0x17')]),_0x225ac1);}};exports[_0x387f('0x24')]=function(_0x51765c){try{if(!_[_0x387f('0x1e')](members[_0x51765c[_0x387f('0x6')]])){utils[_0x387f('0x14')](util[_0x387f('0x4')](_0x387f('0x25'),_0x51765c[_0x387f('0x5')]),_0x51765c);utils[_0x387f('0x3')](util[_0x387f('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x51765c['uniqueid'],_0x51765c[_0x387f('0x6')],_0x51765c[_0x387f('0x26')]));members[_0x51765c[_0x387f('0x6')]]=_[_0x387f('0x27')](members[_0x51765c['interface']],{'data4':_0x51765c[_0x387f('0x26')],'uniqueid':_0x51765c[_0x387f('0x5')]});}}catch(_0x1ff9e8){utils['error'](util[_0x387f('0x4')](_0x387f('0x25'),_0x51765c[_0x387f('0x5')]),_0x1ff9e8);}};exports[_0x387f('0x28')]=function(_0x37f0ed){try{utils[_0x387f('0x14')](util['format'](_0x387f('0x29'),_0x37f0ed[_0x387f('0x5')]),_0x37f0ed);if(_0x37f0ed['channel']){var _0x27605e=_0x37f0ed[_0x387f('0x2a')][_0x387f('0xf')]('-')[0x0];if(!_['isNil'](members[_0x27605e])){members[_0x27605e]=_['assign'](members[_0x27605e],{'data1':members[_0x27605e]['data1']||_0x37f0ed['type'],'data2':members[_0x27605e][_0x387f('0x7')]||_0x37f0ed['source'],'data3':members[_0x27605e][_0x387f('0x2b')]||_0x37f0ed[_0x387f('0x2c')],'uniqueid':members[_0x27605e][_0x387f('0x5')]||_0x37f0ed[_0x387f('0x5')]});utils[_0x387f('0x3')](util[_0x387f('0x4')](_0x387f('0x2d'),_0x37f0ed['uniqueid'],members[_0x27605e][_0x387f('0x2e')],members[_0x27605e][_0x387f('0x7')],members[_0x27605e][_0x387f('0x2b')]));if(members[_0x27605e]['exitAt']){writeDB(members[_0x27605e]);}}}if(_0x37f0ed[_0x387f('0x2f')]){var _0x26cde4=_0x37f0ed[_0x387f('0x2f')][_0x387f('0xf')]('-')[0x0];if(!_[_0x387f('0x1e')](members[_0x26cde4])){members[_0x26cde4]=_[_0x387f('0x27')](members[_0x26cde4],{'data1':members[_0x26cde4][_0x387f('0x2e')]||_0x37f0ed[_0x387f('0x8')],'data2':members[_0x26cde4][_0x387f('0x7')]||_0x37f0ed[_0x387f('0x30')],'data3':members[_0x26cde4][_0x387f('0x2b')]||_0x37f0ed['destination'],'uniqueid':members[_0x26cde4][_0x387f('0x5')]||_0x37f0ed[_0x387f('0x5')]});utils[_0x387f('0x3')](util[_0x387f('0x4')](_0x387f('0x2d'),_0x37f0ed[_0x387f('0x5')],members[_0x26cde4][_0x387f('0x2e')],members[_0x26cde4][_0x387f('0x7')],members[_0x26cde4]['data3']));if(members[_0x26cde4]['exitAt']){writeDB(members[_0x26cde4]);}}}}catch(_0x5b60bd){utils[_0x387f('0x23')](util['format'](_0x387f('0x29'),_0x37f0ed[_0x387f('0x5')]),_0x5b60bd);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 702bc60..c372c5e 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 _0xa70d=['count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','position','assign','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt'];(function(_0x28f947,_0x1f3a25){var _0x52d24c=function(_0x335aca){while(--_0x335aca){_0x28f947['push'](_0x28f947['shift']());}};_0x52d24c(++_0x1f3a25);}(_0xa70d,0x99));var _0xda70=function(_0x440cdf,_0x4ff55f){_0x440cdf=_0x440cdf-0x0;var _0x492529=_0xa70d[_0x440cdf];return _0x492529;};'use strict';var _=require('lodash');var util=require(_0xda70('0x0'));var utils=require(_0xda70('0x1'));var queues={};function writeDB(_0x5bad15){utils[_0xda70('0x2')](util[_0xda70('0x3')](_0xda70('0x4'),_0x5bad15[_0xda70('0x5')],_0x5bad15['channel'],_0x5bad15['queue'],_0x5bad15[_0xda70('0x6')],_0x5bad15[_0xda70('0x7')],_0x5bad15[_0xda70('0x8')],_0x5bad15[_0xda70('0x9')]));if(_0x5bad15[_0xda70('0xa')]){utils[_0xda70('0xb')](_0x5bad15[_0xda70('0xa')])[_0xda70('0xc')](function(_0x5b345f){if(_0x5b345f){_0x5bad15[_0xda70('0xd')]=_0x5b345f[_0xda70('0xd')];}utils[_0xda70('0xe')](_0xda70('0xf'),_0x5bad15);});}else{utils[_0xda70('0xe')]('CreateVoiceQueueReport',_0x5bad15);}if(_0x5bad15[_0xda70('0x10')]){delete queues[_0x5bad15['transfereduniqueid']];}else{delete queues[_0x5bad15[_0xda70('0x5')]];}}exports[_0xda70('0x11')]=function(_0x2c6f25){try{utils[_0xda70('0x12')](util[_0xda70('0x3')]('[%s][queues][queuecallerjoin]',_0x2c6f25[_0xda70('0x5')]),_0x2c6f25);utils[_0xda70('0x2')](util[_0xda70('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x2c6f25[_0xda70('0x5')],_0x2c6f25[_0xda70('0xa')],_0x2c6f25[_0xda70('0x13')]));queues[_0x2c6f25[_0xda70('0x5')]]=_[_0xda70('0x14')](_0x2c6f25,{'originalposition':_0x2c6f25['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x7bd189){utils['error'](util[_0xda70('0x3')](_0xda70('0x15'),_0x2c6f25[_0xda70('0x5')]),_0x7bd189);}};exports[_0xda70('0x16')]=function(_0x1c3f68){try{if(!_[_0xda70('0x17')](queues[_0x1c3f68[_0xda70('0x5')]])){utils[_0xda70('0x12')](util[_0xda70('0x3')](_0xda70('0x18'),_0x1c3f68[_0xda70('0x5')]),_0x1c3f68);if(queues[_0x1c3f68[_0xda70('0x5')]][_0xda70('0x19')]){if(!queues[_0x1c3f68['uniqueid']][_0xda70('0x1a')]&&!queues[_0x1c3f68['uniqueid']][_0xda70('0x1b')]){queues[_0x1c3f68[_0xda70('0x5')]]['queuecallercomplete']=!![];queues[_0x1c3f68[_0xda70('0x5')]][_0xda70('0x1c')]=utils[_0xda70('0x1d')]();queues[_0x1c3f68[_0xda70('0x5')]][_0xda70('0x9')]=_0xda70('0x1e');}utils[_0xda70('0x2')](util[_0xda70('0x3')](_0xda70('0x1f'),_0x1c3f68[_0xda70('0x5')],queues[_0x1c3f68['uniqueid']][_0xda70('0x20')],queues[_0x1c3f68[_0xda70('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x1c3f68['uniqueid']]);}else if(queues[_0x1c3f68[_0xda70('0x5')]][_0xda70('0x10')]){utils[_0xda70('0x2')](util[_0xda70('0x3')](_0xda70('0x21'),_0x1c3f68[_0xda70('0x5')],queues[_0x1c3f68[_0xda70('0x5')]]['name'],queues[_0x1c3f68[_0xda70('0x5')]][_0xda70('0x10')]));queues[queues[_0x1c3f68[_0xda70('0x5')]][_0xda70('0x10')]]=queues[_0x1c3f68[_0xda70('0x5')]];queues[queues[_0x1c3f68['uniqueid']][_0xda70('0x10')]][_0xda70('0x22')]=0x2;delete queues[_0x1c3f68[_0xda70('0x5')]];}}}catch(_0x2a2a84){utils[_0xda70('0x23')](util[_0xda70('0x3')](_0xda70('0x18'),_0x1c3f68[_0xda70('0x5')]),_0x2a2a84);}};exports[_0xda70('0x24')]=function(_0x4d57de){try{utils[_0xda70('0x12')](util[_0xda70('0x3')](_0xda70('0x25'),_0x4d57de[_0xda70('0x5')]),_0x4d57de);if(!_[_0xda70('0x17')](_0x4d57de[_0xda70('0x26')][_0xda70('0x27')])&&_0x4d57de[_0xda70('0x28')]['toUpperCase']()!==_0xda70('0x29')){if(!_[_0xda70('0x17')](queues[_0x4d57de[_0xda70('0x5')]])){queues[_0x4d57de['uniqueid']][_0xda70('0x1a')]=![];queues[_0x4d57de['uniqueid']][_0xda70('0x2a')]=null;queues[_0x4d57de['uniqueid']][_0xda70('0x1b')]=!![];queues[_0x4d57de['uniqueid']][_0xda70('0x2b')]=utils[_0xda70('0x1d')]();queues[_0x4d57de[_0xda70('0x5')]]['queuecallerexitreason']=_0x4d57de[_0xda70('0x28')]['toUpperCase']();utils['info'](util[_0xda70('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4d57de[_0xda70('0x5')],queues[_0x4d57de[_0xda70('0x5')]][_0xda70('0x20')],_0x4d57de[_0xda70('0x28')],queues[_0x4d57de[_0xda70('0x5')]][_0xda70('0x9')]));writeDB(queues[_0x4d57de[_0xda70('0x5')]]);}}else if(!_[_0xda70('0x17')](_0x4d57de['variable'][_0xda70('0x2c')])){if(!_[_0xda70('0x17')](queues[_0x4d57de[_0xda70('0x5')]])&&!queues[_0x4d57de[_0xda70('0x5')]][_0xda70('0x1a')]){queues[_0x4d57de['uniqueid']]['queuecallerabandon']=![];queues[_0x4d57de[_0xda70('0x5')]][_0xda70('0x2a')]=null;queues[_0x4d57de[_0xda70('0x5')]][_0xda70('0x1b')]=!![];queues[_0x4d57de[_0xda70('0x5')]]['queuecallerexitAt']=utils[_0xda70('0x1d')]();queues[_0x4d57de[_0xda70('0x5')]][_0xda70('0x9')]=_0xda70('0x2d');utils[_0xda70('0x2')](util[_0xda70('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4d57de[_0xda70('0x5')],queues[_0x4d57de[_0xda70('0x5')]]['name'],_0x4d57de[_0xda70('0x28')],queues[_0x4d57de[_0xda70('0x5')]][_0xda70('0x9')]));}}}catch(_0x254c14){utils[_0xda70('0x23')](util['format'](_0xda70('0x25'),_0x4d57de[_0xda70('0x5')]),_0x254c14);}};exports['queuecallerabandon']=function(_0x18f205){try{if(!_[_0xda70('0x17')](queues[_0x18f205['uniqueid']])){utils[_0xda70('0x12')](util[_0xda70('0x3')](_0xda70('0x2e'),_0x18f205[_0xda70('0x5')]),_0x18f205);queues[_0x18f205[_0xda70('0x5')]][_0xda70('0x1b')]=![];queues[_0x18f205[_0xda70('0x5')]][_0xda70('0x2b')]=null;queues[_0x18f205[_0xda70('0x5')]][_0xda70('0x1a')]=!![];queues[_0x18f205[_0xda70('0x5')]][_0xda70('0x2a')]=utils['now']();queues[_0x18f205[_0xda70('0x5')]]['queuecallerexitreason']=_0xda70('0x2f');utils[_0xda70('0x2')](util[_0xda70('0x3')](_0xda70('0x30'),_0x18f205[_0xda70('0x5')],queues[_0x18f205['uniqueid']][_0xda70('0x20')],queues[_0x18f205['uniqueid']][_0xda70('0x9')]));}}catch(_0x1ca3a3){utils['error'](util['format'](_0xda70('0x2e'),_0x18f205[_0xda70('0x5')]),_0x1ca3a3);}};exports[_0xda70('0x31')]=function(_0x2cdd63){try{if(!_[_0xda70('0x17')](queues[_0x2cdd63['uniqueid']])){utils[_0xda70('0x12')](util[_0xda70('0x3')](_0xda70('0x32'),_0x2cdd63[_0xda70('0x5')]),_0x2cdd63);utils[_0xda70('0x2')](util['format'](_0xda70('0x33'),_0x2cdd63[_0xda70('0x5')],queues[_0x2cdd63[_0xda70('0x5')]][_0xda70('0x20')],_0x2cdd63[_0xda70('0x34')],_0x2cdd63[_0xda70('0x35')]));queues[_0x2cdd63[_0xda70('0x5')]][_0xda70('0x31')]=!![];queues[_0x2cdd63['uniqueid']]['queuecallerleaveAt']=utils[_0xda70('0x1d')]();queues[_0x2cdd63[_0xda70('0x5')]][_0xda70('0x36')]=utils[_0xda70('0x37')](queues[_0x2cdd63['uniqueid']][_0xda70('0x19')],queues[_0x2cdd63[_0xda70('0x5')]][_0xda70('0x38')]);queues[_0x2cdd63['uniqueid']]['position']=_0x2cdd63[_0xda70('0x13')];queues[_0x2cdd63[_0xda70('0x5')]][_0xda70('0x39')]=_0x2cdd63[_0xda70('0x39')];queues[_0x2cdd63[_0xda70('0x5')]]['connectedlinenum']=_0x2cdd63['connectedlinenum'];queues[_0x2cdd63[_0xda70('0x5')]][_0xda70('0x35')]=_0x2cdd63['connectedlinename'];}}catch(_0x508e0f){utils[_0xda70('0x23')](util[_0xda70('0x3')](_0xda70('0x32'),_0x2cdd63[_0xda70('0x5')]),_0x508e0f);}};exports[_0xda70('0x3a')]=function(_0x2a6585){try{if(!_[_0xda70('0x17')](queues[_0x2a6585['uniqueid']])){utils[_0xda70('0x12')](util[_0xda70('0x3')]('[%s][queues][agentconnect]',_0x2a6585[_0xda70('0x5')]),_0x2a6585);utils[_0xda70('0x2')](util[_0xda70('0x3')](_0xda70('0x3b'),_0x2a6585[_0xda70('0x5')],queues[_0x2a6585[_0xda70('0x5')]][_0xda70('0x20')],_0x2a6585[_0xda70('0x3c')],_0x2a6585[_0xda70('0x3d')]));queues[_0x2a6585[_0xda70('0x5')]]['queuecallerabandon']=![];queues[_0x2a6585[_0xda70('0x5')]][_0xda70('0x1a')]=![];queues[_0x2a6585[_0xda70('0x5')]]['queuecallerabandonAt']=null;queues[_0x2a6585[_0xda70('0x5')]][_0xda70('0x1b')]=![];queues[_0x2a6585[_0xda70('0x5')]][_0xda70('0x9')]=null;queues[_0x2a6585[_0xda70('0x5')]][_0xda70('0x2b')]=null;queues[_0x2a6585['uniqueid']][_0xda70('0x3e')]=!![];queues[_0x2a6585[_0xda70('0x5')]][_0xda70('0x8')]=_0x2a6585[_0xda70('0x3d')];queues[_0x2a6585['uniqueid']]['lastAssignedTo']=_0x2a6585[_0xda70('0x3c')];}}catch(_0x2271c6){utils[_0xda70('0x23')](util[_0xda70('0x3')](_0xda70('0x3f'),_0x2a6585['uniqueid']),_0x2271c6);}};exports[_0xda70('0x40')]=function(_0x32e77e){try{if(!_[_0xda70('0x17')](queues[_0x32e77e['uniqueid']])){if(queues[_0x32e77e[_0xda70('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0xda70('0x3')]('[%s][queues][agentcomplete]',_0x32e77e[_0xda70('0x5')]),_0x32e77e);queues[_0x32e77e[_0xda70('0x5')]][_0xda70('0x1a')]=![];queues[_0x32e77e['uniqueid']][_0xda70('0x1a')]=![];queues[_0x32e77e['uniqueid']][_0xda70('0x2a')]=null;queues[_0x32e77e[_0xda70('0x5')]][_0xda70('0x1b')]=![];queues[_0x32e77e[_0xda70('0x5')]]['queuecallerexitAt']=null;queues[_0x32e77e[_0xda70('0x5')]][_0xda70('0x3e')]=!![];queues[_0x32e77e['uniqueid']][_0xda70('0x6')]=_0x32e77e[_0xda70('0x3c')];queues[_0x32e77e[_0xda70('0x5')]][_0xda70('0x41')]=!![];queues[_0x32e77e['uniqueid']][_0xda70('0x1c')]=utils[_0xda70('0x1d')]();if(_0x32e77e[_0xda70('0x42')]==_0xda70('0x43')){if(!queues[_0x32e77e['uniqueid']][_0xda70('0x43')]){queues[_0x32e77e[_0xda70('0x5')]]['queuecallerexitreason']=_0xda70('0x44');}}else{queues[_0x32e77e[_0xda70('0x5')]][_0xda70('0x9')]='COMPLETEDBY'+_0x32e77e[_0xda70('0x42')][_0xda70('0x45')]();}utils[_0xda70('0x2')](util['format'](_0xda70('0x46'),_0x32e77e[_0xda70('0x5')],queues[_0x32e77e[_0xda70('0x5')]]['name'],_0x32e77e[_0xda70('0x3c')],queues[_0x32e77e['uniqueid']][_0xda70('0x9')]));writeDB(queues[_0x32e77e['uniqueid']]);}}}catch(_0x1cd7d4){utils[_0xda70('0x23')](util[_0xda70('0x3')](_0xda70('0x47'),_0x32e77e[_0xda70('0x5')]),_0x1cd7d4);}};exports[_0xda70('0x48')]=function(_0x27a588){try{if(!_[_0xda70('0x17')](queues[_0x27a588[_0xda70('0x49')]])){utils[_0xda70('0x12')](util[_0xda70('0x3')](_0xda70('0x4a'),_0x27a588[_0xda70('0x5')]),_0x27a588);queues[_0x27a588[_0xda70('0x49')]][_0xda70('0x43')]=!![];queues[_0x27a588[_0xda70('0x49')]][_0xda70('0x4b')]=_0xda70('0x4c');queues[_0x27a588['transfereeuniqueid']]['transferexten']=_0x27a588[_0xda70('0x4d')];queues[_0x27a588['transfereeuniqueid']][_0xda70('0x4e')]=_0x27a588['transfereeuniqueid'];queues[_0x27a588[_0xda70('0x49')]][_0xda70('0x9')]='BLINDTRANSFER';utils['info'](util[_0xda70('0x3')](_0xda70('0x4f'),_0x27a588[_0xda70('0x5')],queues[_0x27a588[_0xda70('0x49')]][_0xda70('0x20')],_0x27a588[_0xda70('0x49')],_0x27a588[_0xda70('0x4d')]));}}catch(_0x539746){utils[_0xda70('0x23')](util[_0xda70('0x3')](_0xda70('0x4a'),_0x27a588[_0xda70('0x5')]),_0x539746);}};exports[_0xda70('0x50')]=function(_0x53b577){try{utils['debug'](util['format'](_0xda70('0x51'),_0x53b577[_0xda70('0x52')]),_0x53b577);if(_0x53b577[_0xda70('0x52')]==_0x53b577[_0xda70('0x53')]){if(!_['isNil'](queues[_0x53b577[_0xda70('0x54')]])){utils[_0xda70('0x2')](util[_0xda70('0x3')](_0xda70('0x55'),_0x53b577['origtransfereruniqueid'],queues[_0x53b577[_0xda70('0x54')]][_0xda70('0x20')],_0x53b577['origtransfererexten']));queues[_0x53b577[_0xda70('0x54')]][_0xda70('0x43')]=!![];queues[_0x53b577[_0xda70('0x54')]]['transfertype']='ATTENDED';queues[_0x53b577[_0xda70('0x54')]][_0xda70('0x56')]=_0x53b577[_0xda70('0x57')];queues[_0x53b577[_0xda70('0x54')]][_0xda70('0x4e')]=_0x53b577[_0xda70('0x52')];queues[_0x53b577[_0xda70('0x54')]]['queuecallerexitreason']=_0xda70('0x58');}if(!_[_0xda70('0x17')](queues[_0x53b577[_0xda70('0x53')]])){if(_0x53b577[_0xda70('0x59')]&&queues[_0x53b577[_0xda70('0x59')]]){queues[_0x53b577[_0xda70('0x59')]][_0xda70('0x22')]=0x1;queues[_0x53b577[_0xda70('0x49')]]=_[_0xda70('0x5a')](queues[_0x53b577[_0xda70('0x59')]]);queues[_0x53b577[_0xda70('0x49')]]['transfereduniqueid']=_0x53b577[_0xda70('0x5b')];queues[_0x53b577['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x7')]=queues[_0x53b577[_0xda70('0x54')]][_0xda70('0x7')];queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x5c')]=queues[_0x53b577[_0xda70('0x54')]][_0xda70('0x5c')];queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x38')]=utils[_0xda70('0x1d')]();queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x19')]=utils[_0xda70('0x1d')]();queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x36')]=0x0;queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x5d')]=0x0;utils[_0xda70('0x2')](util[_0xda70('0x3')](_0xda70('0x5e'),_0x53b577['origtransfereruniqueid'],queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x20')],queues[_0x53b577[_0xda70('0x49')]]['calleridnum'],queues[_0x53b577[_0xda70('0x49')]][_0xda70('0x5c')]));}else{utils['info'](util[_0xda70('0x3')](_0xda70('0x5f'),_0x53b577[_0xda70('0x52')],queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x20')],_0x53b577[_0xda70('0x54')]));queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x10')]=_0x53b577[_0xda70('0x54')];}}}else if(_0x53b577[_0xda70('0x60')]==_0x53b577[_0xda70('0x54')]){if(!_[_0xda70('0x17')](queues[_0x53b577[_0xda70('0x53')]])){utils[_0xda70('0x2')](util[_0xda70('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x53b577[_0xda70('0x52')],queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x20')],_0x53b577[_0xda70('0x60')],_0x53b577[_0xda70('0x61')]));queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x43')]=!![];queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x4b')]=_0xda70('0x62');queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x56')]=_0x53b577[_0xda70('0x61')];queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x4e')]=_0x53b577[_0xda70('0x60')];queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x9')]=_0xda70('0x58');}if(!_[_0xda70('0x17')](queues[_0x53b577['secondtransfererlinkedid']])){if(_0x53b577[_0xda70('0x63')]&&queues[_0x53b577[_0xda70('0x63')]]){queues[_0x53b577[_0xda70('0x63')]][_0xda70('0x22')]=0x1;queues[_0x53b577[_0xda70('0x5b')]]=_[_0xda70('0x5a')](queues[_0x53b577[_0xda70('0x63')]]);queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x10')]=_0x53b577[_0xda70('0x5b')];queues[_0x53b577['transfertargetuniqueid']][_0xda70('0x22')]=0x2;queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x7')]=queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x7')];queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x5c')]=queues[_0x53b577[_0xda70('0x53')]][_0xda70('0x5c')];queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x38')]=utils[_0xda70('0x1d')]();queues[_0x53b577['transfertargetuniqueid']][_0xda70('0x19')]=utils['now']();queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x36')]=0x0;queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x5d')]=0x0;utils['info'](util[_0xda70('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x53b577[_0xda70('0x52')],queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x20')],queues[_0x53b577['transfertargetuniqueid']][_0xda70('0x10')],queues[_0x53b577[_0xda70('0x5b')]]['calleridnum'],queues[_0x53b577[_0xda70('0x5b')]][_0xda70('0x5c')]));}else{utils['info'](util[_0xda70('0x3')](_0xda70('0x5f'),_0x53b577[_0xda70('0x52')],queues[_0x53b577['secondtransfererlinkedid']][_0xda70('0x20')],_0x53b577[_0xda70('0x53')]));queues[_0x53b577[_0xda70('0x54')]][_0xda70('0x10')]=_0x53b577['origtransfererlinkedid'];}}}}catch(_0x50c372){utils[_0xda70('0x23')](util['format'](_0xda70('0x51'),_0x53b577[_0xda70('0x52')]),_0x50c372);}};exports[_0xda70('0x64')]=function(_0x16ac90){try{if(!_[_0xda70('0x17')](queues[_0x16ac90[_0xda70('0x5')]])){utils[_0xda70('0x12')](util[_0xda70('0x3')](_0xda70('0x65'),_0x16ac90[_0xda70('0x5')]),_0x16ac90);queues[_0x16ac90[_0xda70('0x5')]][_0xda70('0x66')]=utils[_0xda70('0x1d')]();utils[_0xda70('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x16ac90[_0xda70('0x5')],queues[_0x16ac90['uniqueid']][_0xda70('0x20')],queues[_0x16ac90[_0xda70('0x5')]][_0xda70('0x66')]));}}catch(_0x296c8c){utils[_0xda70('0x23')](util[_0xda70('0x3')](_0xda70('0x65'),_0x16ac90[_0xda70('0x5')]),_0x296c8c);}};exports['musiconholdstop']=function(_0x22b18f){try{if(!_[_0xda70('0x17')](queues[_0x22b18f[_0xda70('0x5')]])){if(!_['isNil'](queues[_0x22b18f[_0xda70('0x5')]]['musiconholdstartAt'])){utils[_0xda70('0x12')](util[_0xda70('0x3')](_0xda70('0x67'),_0x22b18f['uniqueid']),_0x22b18f);queues[_0x22b18f[_0xda70('0x5')]][_0xda70('0x5d')]+=utils['diffTime'](utils[_0xda70('0x1d')](),queues[_0x22b18f[_0xda70('0x5')]][_0xda70('0x66')]);utils['info'](util[_0xda70('0x3')](_0xda70('0x68'),_0x22b18f[_0xda70('0x5')],queues[_0x22b18f[_0xda70('0x5')]][_0xda70('0x20')],queues[_0x22b18f[_0xda70('0x5')]][_0xda70('0x5d')]));delete queues[_0x22b18f[_0xda70('0x5')]][_0xda70('0x66')];}}}catch(_0x161ccc){utils['error'](util[_0xda70('0x3')](_0xda70('0x67'),_0x22b18f[_0xda70('0x5')]),_0x161ccc);}}; \ No newline at end of file +var _0x6032=['variable','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','extension','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','diffTime','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]','varset','[%s][queues][varset]','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x4e1035,_0x5bf731){var _0x14060b=function(_0x77678d){while(--_0x77678d){_0x4e1035['push'](_0x4e1035['shift']());}};_0x14060b(++_0x5bf731);}(_0x6032,0x1d0));var _0x2603=function(_0x44b865,_0x4e95d6){_0x44b865=_0x44b865-0x0;var _0x60248c=_0x6032[_0x44b865];return _0x60248c;};'use strict';var _=require(_0x2603('0x0'));var util=require(_0x2603('0x1'));var utils=require(_0x2603('0x2'));var queues={};function writeDB(_0x1ea492){utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x5'),_0x1ea492[_0x2603('0x6')],_0x1ea492[_0x2603('0x7')],_0x1ea492[_0x2603('0x8')],_0x1ea492[_0x2603('0x9')],_0x1ea492[_0x2603('0xa')],_0x1ea492['accountcode'],_0x1ea492[_0x2603('0xb')]));if(_0x1ea492[_0x2603('0x8')]){utils[_0x2603('0xc')](_0x1ea492[_0x2603('0x8')])[_0x2603('0xd')](function(_0x3fd64d){if(_0x3fd64d){_0x1ea492[_0x2603('0xe')]=_0x3fd64d[_0x2603('0xe')];}utils[_0x2603('0xf')]('CreateVoiceQueueReport',_0x1ea492);});}else{utils[_0x2603('0xf')]('CreateVoiceQueueReport',_0x1ea492);}if(_0x1ea492[_0x2603('0x10')]){delete queues[_0x1ea492['transfereduniqueid']];}else{delete queues[_0x1ea492[_0x2603('0x6')]];}}exports[_0x2603('0x11')]=function(_0x28d13e){try{utils[_0x2603('0x12')](util[_0x2603('0x4')](_0x2603('0x13'),_0x28d13e['uniqueid']),_0x28d13e);utils['info'](util[_0x2603('0x4')](_0x2603('0x14'),_0x28d13e[_0x2603('0x6')],_0x28d13e[_0x2603('0x8')],_0x28d13e['position']));queues[_0x28d13e[_0x2603('0x6')]]=_['assign'](_0x28d13e,{'originalposition':_0x28d13e[_0x2603('0x15')],'queuecallerjoinAt':utils[_0x2603('0x16')](),'mohtime':0x0});}catch(_0x15268a){utils[_0x2603('0x17')](util[_0x2603('0x4')]('[%s][queues][queuecallerjoin]',_0x28d13e['uniqueid']),_0x15268a);}};exports['hangup']=function(_0x36c5f4){try{if(!_[_0x2603('0x18')](queues[_0x36c5f4[_0x2603('0x6')]])){utils[_0x2603('0x12')](util[_0x2603('0x4')]('[%s][queues][hangup]',_0x36c5f4['uniqueid']),_0x36c5f4);if(queues[_0x36c5f4[_0x2603('0x6')]][_0x2603('0x19')]){if(!queues[_0x36c5f4[_0x2603('0x6')]][_0x2603('0x1a')]&&!queues[_0x36c5f4[_0x2603('0x6')]][_0x2603('0x1b')]){queues[_0x36c5f4[_0x2603('0x6')]][_0x2603('0x1c')]=!![];queues[_0x36c5f4['uniqueid']][_0x2603('0x1d')]=utils[_0x2603('0x16')]();queues[_0x36c5f4[_0x2603('0x6')]][_0x2603('0xb')]=_0x2603('0x1e');}utils['info'](util[_0x2603('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x36c5f4[_0x2603('0x6')],queues[_0x36c5f4[_0x2603('0x6')]][_0x2603('0x1f')],queues[_0x36c5f4[_0x2603('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x36c5f4[_0x2603('0x6')]]);}else if(queues[_0x36c5f4[_0x2603('0x6')]][_0x2603('0x10')]){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x36c5f4[_0x2603('0x6')],queues[_0x36c5f4['uniqueid']][_0x2603('0x1f')],queues[_0x36c5f4[_0x2603('0x6')]]['transfereduniqueid']));queues[queues[_0x36c5f4[_0x2603('0x6')]]['transfereduniqueid']]=queues[_0x36c5f4[_0x2603('0x6')]];queues[queues[_0x36c5f4['uniqueid']][_0x2603('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x36c5f4[_0x2603('0x6')]];}}}catch(_0x523533){utils[_0x2603('0x17')](util[_0x2603('0x4')](_0x2603('0x20'),_0x36c5f4['uniqueid']),_0x523533);}};exports[_0x2603('0x21')]=function(_0x1f2c4a){try{utils[_0x2603('0x12')](util['format'](_0x2603('0x22'),_0x1f2c4a[_0x2603('0x6')]),_0x1f2c4a);if(!_[_0x2603('0x18')](_0x1f2c4a['variable']['queuestatus'])&&_0x1f2c4a[_0x2603('0x23')][_0x2603('0x24')]()!==_0x2603('0x25')){if(!_['isNil'](queues[_0x1f2c4a[_0x2603('0x6')]])){queues[_0x1f2c4a['uniqueid']][_0x2603('0x1a')]=![];queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0x26')]=null;queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0x1b')]=!![];queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0x27')]=utils['now']();queues[_0x1f2c4a['uniqueid']][_0x2603('0xb')]=_0x1f2c4a[_0x2603('0x23')][_0x2603('0x24')]();utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x28'),_0x1f2c4a[_0x2603('0x6')],queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0x1f')],_0x1f2c4a['value'],queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0xb')]));writeDB(queues[_0x1f2c4a[_0x2603('0x6')]]);}}else if(!_[_0x2603('0x18')](_0x1f2c4a[_0x2603('0x29')][_0x2603('0x2a')])){if(!_[_0x2603('0x18')](queues[_0x1f2c4a['uniqueid']])&&!queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0x1a')]){queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0x1a')]=![];queues[_0x1f2c4a[_0x2603('0x6')]]['queuecallerabandonAt']=null;queues[_0x1f2c4a['uniqueid']][_0x2603('0x1b')]=!![];queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0x27')]=utils[_0x2603('0x16')]();queues[_0x1f2c4a[_0x2603('0x6')]][_0x2603('0xb')]=_0x2603('0x2b');utils[_0x2603('0x3')](util[_0x2603('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1f2c4a[_0x2603('0x6')],queues[_0x1f2c4a['uniqueid']][_0x2603('0x1f')],_0x1f2c4a[_0x2603('0x23')],queues[_0x1f2c4a[_0x2603('0x6')]]['queuecallerexitreason']));}}}catch(_0x3134cc){utils[_0x2603('0x17')](util[_0x2603('0x4')](_0x2603('0x22'),_0x1f2c4a[_0x2603('0x6')]),_0x3134cc);}};exports[_0x2603('0x1a')]=function(_0x46b1a7){try{if(!_[_0x2603('0x18')](queues[_0x46b1a7[_0x2603('0x6')]])){utils['debug'](util['format'](_0x2603('0x2c'),_0x46b1a7['uniqueid']),_0x46b1a7);queues[_0x46b1a7['uniqueid']][_0x2603('0x1b')]=![];queues[_0x46b1a7[_0x2603('0x6')]][_0x2603('0x27')]=null;queues[_0x46b1a7[_0x2603('0x6')]][_0x2603('0x1a')]=!![];queues[_0x46b1a7[_0x2603('0x6')]]['queuecallerabandonAt']=utils[_0x2603('0x16')]();queues[_0x46b1a7[_0x2603('0x6')]][_0x2603('0xb')]=_0x2603('0x2d');utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x2e'),_0x46b1a7[_0x2603('0x6')],queues[_0x46b1a7[_0x2603('0x6')]][_0x2603('0x1f')],queues[_0x46b1a7['uniqueid']][_0x2603('0xb')]));}}catch(_0x40a5ce){utils[_0x2603('0x17')](util[_0x2603('0x4')](_0x2603('0x2c'),_0x46b1a7[_0x2603('0x6')]),_0x40a5ce);}};exports[_0x2603('0x2f')]=function(_0x4da975){try{if(!_['isNil'](queues[_0x4da975[_0x2603('0x6')]])){utils[_0x2603('0x12')](util[_0x2603('0x4')](_0x2603('0x30'),_0x4da975['uniqueid']),_0x4da975);utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x31'),_0x4da975[_0x2603('0x6')],queues[_0x4da975[_0x2603('0x6')]]['name'],_0x4da975[_0x2603('0x32')],_0x4da975[_0x2603('0x33')]));queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x2f')]=!![];queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x19')]=utils[_0x2603('0x16')]();queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x34')]=utils['diffTime'](queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x19')],queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x35')]);queues[_0x4da975['uniqueid']][_0x2603('0x15')]=_0x4da975[_0x2603('0x15')];queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x36')]=_0x4da975[_0x2603('0x36')];queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x32')]=_0x4da975[_0x2603('0x32')];queues[_0x4da975[_0x2603('0x6')]][_0x2603('0x33')]=_0x4da975['connectedlinename'];}}catch(_0xa55426){utils['error'](util[_0x2603('0x4')](_0x2603('0x30'),_0x4da975['uniqueid']),_0xa55426);}};exports[_0x2603('0x37')]=function(_0x5bf6a1){try{if(!_['isNil'](queues[_0x5bf6a1[_0x2603('0x6')]])){utils[_0x2603('0x12')](util[_0x2603('0x4')](_0x2603('0x38'),_0x5bf6a1[_0x2603('0x6')]),_0x5bf6a1);utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x39'),_0x5bf6a1['uniqueid'],queues[_0x5bf6a1['uniqueid']][_0x2603('0x1f')],_0x5bf6a1[_0x2603('0x3a')],_0x5bf6a1['destaccountcode']));queues[_0x5bf6a1[_0x2603('0x6')]][_0x2603('0x1a')]=![];queues[_0x5bf6a1['uniqueid']][_0x2603('0x1a')]=![];queues[_0x5bf6a1[_0x2603('0x6')]][_0x2603('0x26')]=null;queues[_0x5bf6a1[_0x2603('0x6')]][_0x2603('0x1b')]=![];queues[_0x5bf6a1['uniqueid']][_0x2603('0xb')]=null;queues[_0x5bf6a1['uniqueid']][_0x2603('0x27')]=null;queues[_0x5bf6a1[_0x2603('0x6')]][_0x2603('0x3b')]=!![];queues[_0x5bf6a1[_0x2603('0x6')]]['accountcode']=_0x5bf6a1[_0x2603('0x3c')];queues[_0x5bf6a1[_0x2603('0x6')]][_0x2603('0x9')]=_0x5bf6a1['membername'];}}catch(_0x366ed5){utils[_0x2603('0x17')](util[_0x2603('0x4')](_0x2603('0x38'),_0x5bf6a1[_0x2603('0x6')]),_0x366ed5);}};exports['agentcomplete']=function(_0x4f449b){try{if(!_[_0x2603('0x18')](queues[_0x4f449b['uniqueid']])){if(queues[_0x4f449b[_0x2603('0x6')]][_0x2603('0x19')]){utils[_0x2603('0x12')](util['format'](_0x2603('0x3d'),_0x4f449b[_0x2603('0x6')]),_0x4f449b);queues[_0x4f449b[_0x2603('0x6')]][_0x2603('0x1a')]=![];queues[_0x4f449b[_0x2603('0x6')]][_0x2603('0x1a')]=![];queues[_0x4f449b['uniqueid']][_0x2603('0x26')]=null;queues[_0x4f449b[_0x2603('0x6')]]['queuecallerexit']=![];queues[_0x4f449b['uniqueid']][_0x2603('0x27')]=null;queues[_0x4f449b[_0x2603('0x6')]]['assigned']=!![];queues[_0x4f449b[_0x2603('0x6')]]['lastAssignedTo']=_0x4f449b[_0x2603('0x3a')];queues[_0x4f449b[_0x2603('0x6')]]['queuecallercomplete']=!![];queues[_0x4f449b[_0x2603('0x6')]][_0x2603('0x1d')]=utils[_0x2603('0x16')]();if(_0x4f449b[_0x2603('0x3e')]==_0x2603('0x3f')){if(!queues[_0x4f449b[_0x2603('0x6')]][_0x2603('0x3f')]){queues[_0x4f449b[_0x2603('0x6')]][_0x2603('0xb')]='TRANSFER';}}else{queues[_0x4f449b[_0x2603('0x6')]]['queuecallerexitreason']=_0x2603('0x40')+_0x4f449b[_0x2603('0x3e')][_0x2603('0x24')]();}utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x41'),_0x4f449b[_0x2603('0x6')],queues[_0x4f449b[_0x2603('0x6')]][_0x2603('0x1f')],_0x4f449b['membername'],queues[_0x4f449b['uniqueid']][_0x2603('0xb')]));writeDB(queues[_0x4f449b['uniqueid']]);}}}catch(_0x288cc5){utils[_0x2603('0x17')](util['format'](_0x2603('0x3d'),_0x4f449b[_0x2603('0x6')]),_0x288cc5);}};exports[_0x2603('0x42')]=function(_0x3e1201){try{if(!_[_0x2603('0x18')](queues[_0x3e1201['transfereeuniqueid']])){utils[_0x2603('0x12')](util['format']('[%s][queues][blindtransfer]',_0x3e1201[_0x2603('0x6')]),_0x3e1201);queues[_0x3e1201[_0x2603('0x43')]][_0x2603('0x3f')]=!![];queues[_0x3e1201[_0x2603('0x43')]][_0x2603('0x44')]=_0x2603('0x45');queues[_0x3e1201['transfereeuniqueid']]['transferexten']=_0x3e1201['extension'];queues[_0x3e1201['transfereeuniqueid']][_0x2603('0x46')]=_0x3e1201['transfereeuniqueid'];queues[_0x3e1201[_0x2603('0x43')]][_0x2603('0xb')]=_0x2603('0x47');utils[_0x2603('0x3')](util[_0x2603('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3e1201[_0x2603('0x6')],queues[_0x3e1201[_0x2603('0x43')]]['name'],_0x3e1201['transfereeuniqueid'],_0x3e1201[_0x2603('0x48')]));}}catch(_0x247f96){utils[_0x2603('0x17')](util[_0x2603('0x4')](_0x2603('0x49'),_0x3e1201[_0x2603('0x6')]),_0x247f96);}};exports[_0x2603('0x4a')]=function(_0x3e22f7){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x3e22f7[_0x2603('0x4b')]),_0x3e22f7);if(_0x3e22f7[_0x2603('0x4b')]==_0x3e22f7[_0x2603('0x4c')]){if(!_[_0x2603('0x18')](queues[_0x3e22f7[_0x2603('0x4d')]])){utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x4e'),_0x3e22f7['origtransfereruniqueid'],queues[_0x3e22f7['secondtransfererlinkedid']]['name'],_0x3e22f7[_0x2603('0x4f')]));queues[_0x3e22f7[_0x2603('0x4d')]]['transfer']=!![];queues[_0x3e22f7['secondtransfererlinkedid']]['transfertype']=_0x2603('0x50');queues[_0x3e22f7[_0x2603('0x4d')]]['transferexten']=_0x3e22f7[_0x2603('0x4f')];queues[_0x3e22f7[_0x2603('0x4d')]]['transferuniqueid']=_0x3e22f7[_0x2603('0x4b')];queues[_0x3e22f7[_0x2603('0x4d')]][_0x2603('0xb')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3e22f7[_0x2603('0x4c')]])){if(_0x3e22f7[_0x2603('0x51')]&&queues[_0x3e22f7[_0x2603('0x51')]]){queues[_0x3e22f7[_0x2603('0x51')]][_0x2603('0x52')]=0x1;queues[_0x3e22f7['transfereeuniqueid']]=_['clone'](queues[_0x3e22f7[_0x2603('0x51')]]);queues[_0x3e22f7['transfereeuniqueid']]['transfereduniqueid']=_0x3e22f7['transfertargetuniqueid'];queues[_0x3e22f7[_0x2603('0x43')]][_0x2603('0x52')]=0x2;queues[_0x3e22f7['transfereeuniqueid']][_0x2603('0xa')]=queues[_0x3e22f7[_0x2603('0x4d')]]['calleridnum'];queues[_0x3e22f7[_0x2603('0x43')]][_0x2603('0x53')]=queues[_0x3e22f7[_0x2603('0x4d')]]['calleridname'];queues[_0x3e22f7[_0x2603('0x43')]]['queuecallerjoinAt']=utils[_0x2603('0x16')]();queues[_0x3e22f7[_0x2603('0x43')]][_0x2603('0x19')]=utils[_0x2603('0x16')]();queues[_0x3e22f7[_0x2603('0x43')]][_0x2603('0x34')]=0x0;queues[_0x3e22f7[_0x2603('0x43')]][_0x2603('0x54')]=0x0;utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x55'),_0x3e22f7[_0x2603('0x4b')],queues[_0x3e22f7['transfereeuniqueid']][_0x2603('0x1f')],queues[_0x3e22f7['transfereeuniqueid']][_0x2603('0xa')],queues[_0x3e22f7[_0x2603('0x43')]][_0x2603('0x53')]));}else{utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x56'),_0x3e22f7[_0x2603('0x4b')],queues[_0x3e22f7[_0x2603('0x4c')]]['name'],_0x3e22f7[_0x2603('0x4d')]));queues[_0x3e22f7[_0x2603('0x4c')]][_0x2603('0x10')]=_0x3e22f7[_0x2603('0x4d')];}}}else if(_0x3e22f7[_0x2603('0x57')]==_0x3e22f7[_0x2603('0x4d')]){if(!_[_0x2603('0x18')](queues[_0x3e22f7['origtransfererlinkedid']])){utils[_0x2603('0x3')](util['format'](_0x2603('0x58'),_0x3e22f7[_0x2603('0x4b')],queues[_0x3e22f7[_0x2603('0x4c')]][_0x2603('0x1f')],_0x3e22f7[_0x2603('0x57')],_0x3e22f7['secondtransfererexten']));queues[_0x3e22f7[_0x2603('0x4c')]][_0x2603('0x3f')]=!![];queues[_0x3e22f7[_0x2603('0x4c')]]['transfertype']=_0x2603('0x50');queues[_0x3e22f7[_0x2603('0x4c')]]['transferexten']=_0x3e22f7[_0x2603('0x59')];queues[_0x3e22f7[_0x2603('0x4c')]][_0x2603('0x46')]=_0x3e22f7[_0x2603('0x57')];queues[_0x3e22f7[_0x2603('0x4c')]][_0x2603('0xb')]=_0x2603('0x5a');}if(!_[_0x2603('0x18')](queues[_0x3e22f7[_0x2603('0x4d')]])){if(_0x3e22f7[_0x2603('0x5b')]&&queues[_0x3e22f7['transfertargetlinkedid']]){queues[_0x3e22f7[_0x2603('0x5b')]][_0x2603('0x52')]=0x1;queues[_0x3e22f7[_0x2603('0x5c')]]=_['clone'](queues[_0x3e22f7[_0x2603('0x5b')]]);queues[_0x3e22f7[_0x2603('0x5c')]][_0x2603('0x10')]=_0x3e22f7[_0x2603('0x5c')];queues[_0x3e22f7[_0x2603('0x5c')]][_0x2603('0x52')]=0x2;queues[_0x3e22f7[_0x2603('0x5c')]]['calleridnum']=queues[_0x3e22f7['origtransfererlinkedid']][_0x2603('0xa')];queues[_0x3e22f7['transfertargetuniqueid']][_0x2603('0x53')]=queues[_0x3e22f7[_0x2603('0x4c')]]['calleridname'];queues[_0x3e22f7[_0x2603('0x5c')]][_0x2603('0x35')]=utils[_0x2603('0x16')]();queues[_0x3e22f7[_0x2603('0x5c')]][_0x2603('0x19')]=utils[_0x2603('0x16')]();queues[_0x3e22f7[_0x2603('0x5c')]]['holdtime']=0x0;queues[_0x3e22f7['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x2603('0x3')](util[_0x2603('0x4')](_0x2603('0x5d'),_0x3e22f7[_0x2603('0x4b')],queues[_0x3e22f7[_0x2603('0x5c')]][_0x2603('0x1f')],queues[_0x3e22f7[_0x2603('0x5c')]][_0x2603('0x10')],queues[_0x3e22f7['transfertargetuniqueid']]['calleridnum'],queues[_0x3e22f7[_0x2603('0x5c')]][_0x2603('0x53')]));}else{utils[_0x2603('0x3')](util[_0x2603('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3e22f7[_0x2603('0x4b')],queues[_0x3e22f7[_0x2603('0x4d')]][_0x2603('0x1f')],_0x3e22f7['origtransfererlinkedid']));queues[_0x3e22f7[_0x2603('0x4d')]][_0x2603('0x10')]=_0x3e22f7[_0x2603('0x4c')];}}}}catch(_0x576c07){utils[_0x2603('0x17')](util[_0x2603('0x4')](_0x2603('0x5e'),_0x3e22f7['origtransfereruniqueid']),_0x576c07);}};exports[_0x2603('0x5f')]=function(_0x464a6f){try{if(!_['isNil'](queues[_0x464a6f[_0x2603('0x6')]])){utils['debug'](util['format'](_0x2603('0x60'),_0x464a6f['uniqueid']),_0x464a6f);queues[_0x464a6f[_0x2603('0x6')]]['musiconholdstartAt']=utils[_0x2603('0x16')]();utils[_0x2603('0x3')](util[_0x2603('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x464a6f[_0x2603('0x6')],queues[_0x464a6f[_0x2603('0x6')]][_0x2603('0x1f')],queues[_0x464a6f['uniqueid']]['musiconholdstartAt']));}}catch(_0xb5856c){utils[_0x2603('0x17')](util['format'](_0x2603('0x60'),_0x464a6f['uniqueid']),_0xb5856c);}};exports[_0x2603('0x61')]=function(_0x4a0c73){try{if(!_[_0x2603('0x18')](queues[_0x4a0c73[_0x2603('0x6')]])){if(!_[_0x2603('0x18')](queues[_0x4a0c73[_0x2603('0x6')]][_0x2603('0x62')])){utils[_0x2603('0x12')](util[_0x2603('0x4')](_0x2603('0x63'),_0x4a0c73[_0x2603('0x6')]),_0x4a0c73);queues[_0x4a0c73['uniqueid']]['mohtime']+=utils[_0x2603('0x64')](utils[_0x2603('0x16')](),queues[_0x4a0c73[_0x2603('0x6')]]['musiconholdstartAt']);utils[_0x2603('0x3')](util[_0x2603('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4a0c73[_0x2603('0x6')],queues[_0x4a0c73[_0x2603('0x6')]][_0x2603('0x1f')],queues[_0x4a0c73[_0x2603('0x6')]][_0x2603('0x54')]));delete queues[_0x4a0c73['uniqueid']][_0x2603('0x62')];}}}catch(_0x4599ae){utils['error'](util[_0x2603('0x4')]('[%s][queues][musiconholdstop]',_0x4a0c73['uniqueid']),_0x4599ae);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5231755..3b9e4a9 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 _0xae61=['debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','error','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate'];(function(_0x45dfde,_0x597ea9){var _0x26ca3b=function(_0x35598a){while(--_0x35598a){_0x45dfde['push'](_0x45dfde['shift']());}};_0x26ca3b(++_0x597ea9);}(_0xae61,0x17d));var _0x1ae6=function(_0x2c6cbe,_0x4fde41){_0x2c6cbe=_0x2c6cbe-0x0;var _0x5d1539=_0xae61[_0x2c6cbe];return _0x5d1539;};'use strict';var _=require('lodash');var util=require(_0x1ae6('0x0'));var utils=require(_0x1ae6('0x1'));var recordings={};function writeDB(_0x3ca743){utils[_0x1ae6('0x2')](util[_0x1ae6('0x3')](_0x1ae6('0x4'),_0x3ca743[_0x1ae6('0x5')]));if(_0x3ca743[_0x1ae6('0x6')]){utils[_0x1ae6('0x7')](_0x3ca743[_0x1ae6('0x6')])['then'](function(_0x44678c){if(_0x44678c){_0x3ca743[_0x1ae6('0x8')]=_0x44678c[_0x1ae6('0x9')];_0x3ca743[_0x1ae6('0xa')]=_0x44678c['id'];}utils[_0x1ae6('0xb')]('CreateVoiceRecording',_0x3ca743);});}else{utils[_0x1ae6('0xb')](_0x1ae6('0xc'),_0x3ca743);}}exports[_0x1ae6('0xd')]=function(_0x376ceb){try{utils['debug'](util[_0x1ae6('0x3')](_0x1ae6('0xe'),_0x376ceb[_0x1ae6('0x5')]),_0x376ceb);if(_0x376ceb['uniqueid']==_0x376ceb[_0x1ae6('0xf')]){utils[_0x1ae6('0x2')](util[_0x1ae6('0x3')](_0x1ae6('0x10'),_0x376ceb[_0x1ae6('0x5')],_0x376ceb[_0x1ae6('0x11')],_0x376ceb[_0x1ae6('0x12')]));recordings[_0x376ceb['uniqueid']]={'uniqueid':_0x376ceb[_0x1ae6('0x5')],'accountcode':_0x376ceb[_0x1ae6('0x6')],'exten':_0x376ceb[_0x1ae6('0x12')],'context':_0x376ceb['context'],'channel':_0x376ceb[_0x1ae6('0x13')],'monitors':[]};}}catch(_0x53799b){utils['error'](util[_0x1ae6('0x3')]('[%s][recordings][newchannel]',_0x376ceb['uniqueid']),_0x53799b);}};exports[_0x1ae6('0x14')]=function(_0x34e05a){try{utils[_0x1ae6('0x15')](util[_0x1ae6('0x3')](_0x1ae6('0x16'),_0x34e05a['uniqueid']),_0x34e05a);if(!_[_0x1ae6('0x17')](recordings[_0x34e05a[_0x1ae6('0x5')]])&&_0x34e05a[_0x1ae6('0x18')]==0x6){utils[_0x1ae6('0x2')](util[_0x1ae6('0x3')](_0x1ae6('0x19'),_0x34e05a[_0x1ae6('0x5')],_0x34e05a[_0x1ae6('0x11')],_0x34e05a[_0x1ae6('0x13')]));}else if(!_[_0x1ae6('0x17')](recordings[_0x34e05a[_0x1ae6('0xf')]])&&_0x34e05a[_0x1ae6('0x18')]==0x6&&_0x34e05a['context']!=_0x1ae6('0x1a')){utils[_0x1ae6('0x2')](util[_0x1ae6('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x34e05a[_0x1ae6('0x5')],_0x34e05a[_0x1ae6('0xf')],_0x34e05a[_0x1ae6('0x11')],_0x34e05a['channel']));recordings[_0x34e05a[_0x1ae6('0xf')]][_0x1ae6('0x6')]=_0x34e05a[_0x1ae6('0x6')];}}catch(_0x92f902){utils['error'](util[_0x1ae6('0x3')](_0x1ae6('0x16'),_0x34e05a[_0x1ae6('0x5')]),_0x92f902);}};exports[_0x1ae6('0x1b')]=function(_0x4cf531){try{if(!_['isNil'](_0x4cf531[_0x1ae6('0x1c')])&&!_[_0x1ae6('0x17')](_0x4cf531['variable'][_0x1ae6('0x1d')])){utils['debug'](util[_0x1ae6('0x3')]('[%s][recordings][varset]',_0x4cf531[_0x1ae6('0x5')]),_0x4cf531);utils['info'](util[_0x1ae6('0x3')](_0x1ae6('0x1e'),_0x4cf531[_0x1ae6('0x5')],_0x4cf531[_0x1ae6('0x1c')],_0x4cf531[_0x1ae6('0x1f')]));if(_[_0x1ae6('0x20')](_0x4cf531['value'],'.wav49')){_0x4cf531['value']=_0x4cf531[_0x1ae6('0x1f')][_0x1ae6('0x21')](_0x1ae6('0x22'),_0x1ae6('0x23'));}if(recordings[_0x4cf531[_0x1ae6('0xf')]]){var _0x2635df=_[_0x1ae6('0x24')](recordings[_0x4cf531[_0x1ae6('0xf')]]['monitors'],{'value':_0x4cf531[_0x1ae6('0x1f')]});if(_['isNil'](_0x2635df)){recordings[_0x4cf531[_0x1ae6('0xf')]]['monitors']['push']({'value':_0x4cf531[_0x1ae6('0x1f')]});}}}}catch(_0x5b1661){utils[_0x1ae6('0x25')](util[_0x1ae6('0x3')](_0x1ae6('0x26'),_0x4cf531[_0x1ae6('0x5')]),_0x5b1661);}};exports[_0x1ae6('0x27')]=function(_0x449e18){try{if(!_[_0x1ae6('0x17')](recordings[_0x449e18['uniqueid']])){utils['debug'](util[_0x1ae6('0x3')](_0x1ae6('0x28'),_0x449e18['uniqueid']),_0x449e18);utils[_0x1ae6('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x449e18[_0x1ae6('0x5')],_0x449e18[_0x1ae6('0x29')],_0x449e18['calleridname'],_0x449e18[_0x1ae6('0x2a')]));recordings[_0x449e18[_0x1ae6('0x5')]][_0x1ae6('0x29')]=_0x449e18[_0x1ae6('0x29')];recordings[_0x449e18['uniqueid']][_0x1ae6('0x2b')]=_0x449e18[_0x1ae6('0x2b')];recordings[_0x449e18['uniqueid']][_0x1ae6('0x2c')]=_0x449e18[_0x1ae6('0x2c')];recordings[_0x449e18[_0x1ae6('0x5')]][_0x1ae6('0x2d')]=_0x449e18['connectedlinename'];if(recordings[_0x449e18['uniqueid']][_0x1ae6('0x2e')]==_0x1ae6('0x2f')&&recordings[_0x449e18[_0x1ae6('0x5')]][_0x1ae6('0x6')]){recordings[_0x449e18[_0x1ae6('0x5')]][_0x1ae6('0x2c')]=recordings[_0x449e18['uniqueid']]['accountcode'];recordings[_0x449e18['uniqueid']][_0x1ae6('0x2d')]='';}recordings[_0x449e18[_0x1ae6('0x5')]][_0x1ae6('0x30')][_0x1ae6('0x31')](function(_0x116733){var _0x57c8a7=_[_0x1ae6('0x32')](recordings[_0x449e18[_0x1ae6('0x5')]]);_0x57c8a7['value']=_0x116733[_0x1ae6('0x1f')];writeDB(_0x57c8a7);});delete recordings[_0x449e18['uniqueid']];}}catch(_0xd138d1){utils[_0x1ae6('0x25')](util[_0x1ae6('0x3')]('[%s][recordings][hangup]',_0x449e18[_0x1ae6('0x5')]),_0xd138d1);}};exports[_0x1ae6('0x33')]=function(_0x26838a){try{if(!_[_0x1ae6('0x17')](recordings[_0x26838a[_0x1ae6('0x5')]])){utils[_0x1ae6('0x15')](util['format'](_0x1ae6('0x34'),_0x26838a['uniqueid']),_0x26838a);utils['info'](util[_0x1ae6('0x3')](_0x1ae6('0x35'),_0x26838a[_0x1ae6('0x5')],_0x26838a['application'],_0x26838a['appdata']));if(_0x26838a[_0x1ae6('0x36')]['toLowerCase']()==_0x1ae6('0x37')&&_[_0x1ae6('0x38')](_0x26838a[_0x1ae6('0x39')][_0x1ae6('0x3a')](),_0x1ae6('0x3b'))){var _0x11d2ce=_0x26838a[_0x1ae6('0x39')][_0x1ae6('0x3c')]('=');var _0x91ef1=_0x11d2ce[0x0][_0x1ae6('0x3d')](_0x11d2ce[0x0][_0x1ae6('0x3e')]('(')+0x1,_0x11d2ce[0x0][_0x1ae6('0x3e')](')'));var _0xd6a777=_0x11d2ce[0x1];recordings[_0x26838a[_0x1ae6('0x5')]][_0x91ef1]=_0xd6a777;}}}catch(_0x22d66e){utils[_0x1ae6('0x25')](util[_0x1ae6('0x3')](_0x1ae6('0x34'),_0x26838a[_0x1ae6('0x5')]),_0x22d66e);}};exports[_0x1ae6('0x3f')]=function(_0xab9fd1){try{if(!_[_0x1ae6('0x17')](recordings[_0xab9fd1[_0x1ae6('0x5')]])){utils[_0x1ae6('0x15')](util[_0x1ae6('0x3')](_0x1ae6('0x40'),_0xab9fd1[_0x1ae6('0x5')]),_0xab9fd1);utils[_0x1ae6('0x2')](util[_0x1ae6('0x3')](_0x1ae6('0x41'),_0xab9fd1[_0x1ae6('0x5')],_0xab9fd1[_0x1ae6('0x42')]));recordings[_0xab9fd1[_0x1ae6('0x5')]][_0x1ae6('0x42')]=_0xab9fd1[_0x1ae6('0x42')];}}catch(_0x181014){utils[_0x1ae6('0x25')](util['format']('[%s][recordings][queuecallerjoin]',_0xab9fd1['uniqueid']),_0x181014);}}; \ No newline at end of file +var _0xea10=['cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','channel','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith'];(function(_0x43de71,_0x3e8fc1){var _0x5dd72b=function(_0x1cecd7){while(--_0x1cecd7){_0x43de71['push'](_0x43de71['shift']());}};_0x5dd72b(++_0x3e8fc1);}(_0xea10,0x1c7));var _0x0ea1=function(_0x369638,_0x19f33c){_0x369638=_0x369638-0x0;var _0x359551=_0xea10[_0x369638];return _0x359551;};'use strict';var _=require(_0x0ea1('0x0'));var util=require(_0x0ea1('0x1'));var utils=require(_0x0ea1('0x2'));var recordings={};function writeDB(_0x109229){utils[_0x0ea1('0x3')](util['format'](_0x0ea1('0x4'),_0x109229[_0x0ea1('0x5')]));if(_0x109229[_0x0ea1('0x6')]){utils['getUserByInternal'](_0x109229[_0x0ea1('0x6')])[_0x0ea1('0x7')](function(_0x335c39){if(_0x335c39){_0x109229[_0x0ea1('0x8')]=_0x335c39['name'];_0x109229['UserId']=_0x335c39['id'];}utils[_0x0ea1('0x9')](_0x0ea1('0xa'),_0x109229);});}else{utils['request'](_0x0ea1('0xa'),_0x109229);}}exports[_0x0ea1('0xb')]=function(_0x49adec){try{utils[_0x0ea1('0xc')](util['format'](_0x0ea1('0xd'),_0x49adec[_0x0ea1('0x5')]),_0x49adec);if(_0x49adec[_0x0ea1('0x5')]==_0x49adec[_0x0ea1('0xe')]){utils[_0x0ea1('0x3')](util[_0x0ea1('0xf')](_0x0ea1('0x10'),_0x49adec[_0x0ea1('0x5')],_0x49adec[_0x0ea1('0x11')],_0x49adec['exten']));recordings[_0x49adec['uniqueid']]={'uniqueid':_0x49adec[_0x0ea1('0x5')],'accountcode':_0x49adec[_0x0ea1('0x6')],'exten':_0x49adec[_0x0ea1('0x12')],'context':_0x49adec[_0x0ea1('0x11')],'channel':_0x49adec['channel'],'monitors':[]};}}catch(_0xe79a48){utils[_0x0ea1('0x13')](util['format']('[%s][recordings][newchannel]',_0x49adec['uniqueid']),_0xe79a48);}};exports[_0x0ea1('0x14')]=function(_0x1f7b3b){try{utils[_0x0ea1('0xc')](util[_0x0ea1('0xf')]('[%s][recordings][newstate]',_0x1f7b3b[_0x0ea1('0x5')]),_0x1f7b3b);if(!_[_0x0ea1('0x15')](recordings[_0x1f7b3b[_0x0ea1('0x5')]])&&_0x1f7b3b[_0x0ea1('0x16')]==0x6){utils[_0x0ea1('0x3')](util[_0x0ea1('0xf')](_0x0ea1('0x17'),_0x1f7b3b[_0x0ea1('0x5')],_0x1f7b3b['context'],_0x1f7b3b['channel']));}else if(!_[_0x0ea1('0x15')](recordings[_0x1f7b3b[_0x0ea1('0xe')]])&&_0x1f7b3b[_0x0ea1('0x16')]==0x6&&_0x1f7b3b[_0x0ea1('0x11')]!=_0x0ea1('0x18')){utils[_0x0ea1('0x3')](util[_0x0ea1('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1f7b3b['uniqueid'],_0x1f7b3b['linkedid'],_0x1f7b3b[_0x0ea1('0x11')],_0x1f7b3b[_0x0ea1('0x19')]));recordings[_0x1f7b3b['linkedid']][_0x0ea1('0x6')]=_0x1f7b3b['accountcode'];}}catch(_0x4f601f){utils['error'](util[_0x0ea1('0xf')](_0x0ea1('0x1a'),_0x1f7b3b[_0x0ea1('0x5')]),_0x4f601f);}};exports[_0x0ea1('0x1b')]=function(_0x16a18d){try{if(!_['isNil'](_0x16a18d[_0x0ea1('0x1c')])&&!_[_0x0ea1('0x15')](_0x16a18d[_0x0ea1('0x1c')][_0x0ea1('0x1d')])){utils[_0x0ea1('0xc')](util[_0x0ea1('0xf')](_0x0ea1('0x1e'),_0x16a18d[_0x0ea1('0x5')]),_0x16a18d);utils['info'](util[_0x0ea1('0xf')](_0x0ea1('0x1f'),_0x16a18d[_0x0ea1('0x5')],_0x16a18d['variable'],_0x16a18d[_0x0ea1('0x20')]));if(_[_0x0ea1('0x21')](_0x16a18d[_0x0ea1('0x20')],'.wav49')){_0x16a18d[_0x0ea1('0x20')]=_0x16a18d[_0x0ea1('0x20')][_0x0ea1('0x22')](_0x0ea1('0x23'),_0x0ea1('0x24'));}if(recordings[_0x16a18d[_0x0ea1('0xe')]]){var _0x49e752=_[_0x0ea1('0x25')](recordings[_0x16a18d[_0x0ea1('0xe')]]['monitors'],{'value':_0x16a18d[_0x0ea1('0x20')]});if(_['isNil'](_0x49e752)){recordings[_0x16a18d[_0x0ea1('0xe')]][_0x0ea1('0x26')]['push']({'value':_0x16a18d[_0x0ea1('0x20')]});}}}}catch(_0x21ab0f){utils[_0x0ea1('0x13')](util['format'](_0x0ea1('0x1e'),_0x16a18d[_0x0ea1('0x5')]),_0x21ab0f);}};exports[_0x0ea1('0x27')]=function(_0x2aff8d){try{if(!_[_0x0ea1('0x15')](recordings[_0x2aff8d['uniqueid']])){utils['debug'](util['format']('[%s][recordings][hangup]',_0x2aff8d[_0x0ea1('0x5')]),_0x2aff8d);utils[_0x0ea1('0x3')](util['format'](_0x0ea1('0x28'),_0x2aff8d['uniqueid'],_0x2aff8d[_0x0ea1('0x29')],_0x2aff8d[_0x0ea1('0x2a')],_0x2aff8d[_0x0ea1('0x2b')]));recordings[_0x2aff8d[_0x0ea1('0x5')]][_0x0ea1('0x29')]=_0x2aff8d[_0x0ea1('0x29')];recordings[_0x2aff8d[_0x0ea1('0x5')]][_0x0ea1('0x2a')]=_0x2aff8d[_0x0ea1('0x2a')];recordings[_0x2aff8d[_0x0ea1('0x5')]][_0x0ea1('0x2c')]=_0x2aff8d[_0x0ea1('0x2c')];recordings[_0x2aff8d['uniqueid']][_0x0ea1('0x2d')]=_0x2aff8d[_0x0ea1('0x2d')];if(recordings[_0x2aff8d[_0x0ea1('0x5')]]['type']==_0x0ea1('0x2e')&&recordings[_0x2aff8d[_0x0ea1('0x5')]][_0x0ea1('0x6')]){recordings[_0x2aff8d[_0x0ea1('0x5')]]['connectedlinenum']=recordings[_0x2aff8d[_0x0ea1('0x5')]][_0x0ea1('0x6')];recordings[_0x2aff8d['uniqueid']]['connectedlinename']='';}recordings[_0x2aff8d['uniqueid']][_0x0ea1('0x26')][_0x0ea1('0x2f')](function(_0xa0c2b2){var _0x43ef1b=_[_0x0ea1('0x30')](recordings[_0x2aff8d[_0x0ea1('0x5')]]);_0x43ef1b[_0x0ea1('0x20')]=_0xa0c2b2[_0x0ea1('0x20')];writeDB(_0x43ef1b);});delete recordings[_0x2aff8d[_0x0ea1('0x5')]];}}catch(_0x2b8f86){utils[_0x0ea1('0x13')](util[_0x0ea1('0xf')](_0x0ea1('0x31'),_0x2aff8d[_0x0ea1('0x5')]),_0x2b8f86);}};exports[_0x0ea1('0x32')]=function(_0x12659b){try{if(!_[_0x0ea1('0x15')](recordings[_0x12659b[_0x0ea1('0x5')]])){utils[_0x0ea1('0xc')](util[_0x0ea1('0xf')](_0x0ea1('0x33'),_0x12659b[_0x0ea1('0x5')]),_0x12659b);utils[_0x0ea1('0x3')](util[_0x0ea1('0xf')](_0x0ea1('0x34'),_0x12659b[_0x0ea1('0x5')],_0x12659b[_0x0ea1('0x35')],_0x12659b[_0x0ea1('0x36')]));if(_0x12659b[_0x0ea1('0x35')][_0x0ea1('0x37')]()=='set'&&_[_0x0ea1('0x38')](_0x12659b[_0x0ea1('0x36')][_0x0ea1('0x37')](),_0x0ea1('0x39'))){var _0x8a2806=_0x12659b[_0x0ea1('0x36')][_0x0ea1('0x3a')]('=');var _0xbfa010=_0x8a2806[0x0][_0x0ea1('0x3b')](_0x8a2806[0x0][_0x0ea1('0x3c')]('(')+0x1,_0x8a2806[0x0]['lastIndexOf'](')'));var _0x5155d0=_0x8a2806[0x1];recordings[_0x12659b[_0x0ea1('0x5')]][_0xbfa010]=_0x5155d0;}}}catch(_0x28469a){utils[_0x0ea1('0x13')](util['format'](_0x0ea1('0x33'),_0x12659b['uniqueid']),_0x28469a);}};exports[_0x0ea1('0x3d')]=function(_0x358a03){try{if(!_[_0x0ea1('0x15')](recordings[_0x358a03[_0x0ea1('0x5')]])){utils[_0x0ea1('0xc')](util[_0x0ea1('0xf')](_0x0ea1('0x3e'),_0x358a03[_0x0ea1('0x5')]),_0x358a03);utils[_0x0ea1('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x358a03['uniqueid'],_0x358a03[_0x0ea1('0x3f')]));recordings[_0x358a03[_0x0ea1('0x5')]][_0x0ea1('0x3f')]=_0x358a03[_0x0ea1('0x3f')];}}catch(_0x58d022){utils['error'](util[_0x0ea1('0xf')]('[%s][recordings][queuecallerjoin]',_0x358a03[_0x0ea1('0x5')]),_0x58d022);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8d106d3..017a3cd 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 _0xfaa7=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','error','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xfaa7,0x89));var _0x7faa=function(_0x3bdaee,_0x468633){_0x3bdaee=_0x3bdaee-0x0;var _0x4df44e=_0xfaa7[_0x3bdaee];return _0x4df44e;};'use strict';var _=require(_0x7faa('0x0'));var util=require(_0x7faa('0x1'));var utils=require(_0x7faa('0x2'));function writeDB(_0x5d8f80){utils[_0x7faa('0x3')](util['format'](_0x7faa('0x4'),_0x5d8f80['type']==='attended'?_0x5d8f80[_0x7faa('0x5')]:_0x5d8f80['uniqueid'],_0x5d8f80[_0x7faa('0x6')]));utils[_0x7faa('0x7')](_0x7faa('0x8'),_0x5d8f80);}exports[_0x7faa('0x9')]={};exports[_0x7faa('0xa')]=function(_0x5922aa){try{utils[_0x7faa('0xb')](util[_0x7faa('0xc')]('[%s][transfers][blindtransfer]',_0x5922aa[_0x7faa('0xd')]),_0x5922aa);utils['info'](util[_0x7faa('0xc')](_0x7faa('0xe'),_0x5922aa[_0x7faa('0xd')],_0x5922aa[_0x7faa('0xf')],_0x5922aa[_0x7faa('0x10')],_0x5922aa[_0x7faa('0x11')],_0x5922aa[_0x7faa('0x12')]));_0x5922aa['type']=_0x7faa('0x13');exports[_0x7faa('0x9')][_0x5922aa[_0x7faa('0x14')]]=_0x5922aa;writeDB(_0x5922aa);}catch(_0x46eb45){utils['error'](util[_0x7faa('0xc')](_0x7faa('0x15'),_0x5922aa[_0x7faa('0xd')]),_0x46eb45);}};exports['attendedtransfer']=function(_0x1687a1){try{utils[_0x7faa('0xb')](util[_0x7faa('0xc')](_0x7faa('0x16'),_0x1687a1[_0x7faa('0x5')]),_0x1687a1);utils['info'](util[_0x7faa('0xc')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1687a1[_0x7faa('0x5')],_0x1687a1[_0x7faa('0x17')],_0x1687a1[_0x7faa('0x18')],_0x1687a1[_0x7faa('0x19')],_0x1687a1[_0x7faa('0x1a')]));_0x1687a1=_[_0x7faa('0x1b')](_0x1687a1,{'transfererchannel':_0x1687a1[_0x7faa('0x1c')],'transferercalleridnum':_0x1687a1['origtransferercalleridnum'],'transferercalleridname':_0x1687a1[_0x7faa('0x18')],'transfererconnectedlinenum':_0x1687a1[_0x7faa('0x1d')],'transfererconnectedlinename':_0x1687a1['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1687a1[_0x7faa('0x1e')],'transferercontext':_0x1687a1[_0x7faa('0x1f')],'transfererexten':_0x1687a1[_0x7faa('0x20')],'transfererlinkedid':_0x1687a1[_0x7faa('0x21')],'context':_0x1687a1[_0x7faa('0x22')],'extension':_0x1687a1[_0x7faa('0x23')],'type':_0x7faa('0x24')});if(_[_0x7faa('0x25')](_0x1687a1['transfereechannel'])){_0x1687a1=_['assign'](_0x1687a1,{'transfereechannel':_0x1687a1['transfertargetchannel'],'transfereecalleridnum':_0x1687a1['transfertargetcalleridnum'],'transfereecalleridname':_0x1687a1[_0x7faa('0x1a')],'transfereeconnectedlinenum':_0x1687a1[_0x7faa('0x26')],'transfereeconnectedlinename':_0x1687a1[_0x7faa('0x27')],'transfereeaccountcode':_0x1687a1['transfertargetaccountcode'],'transfereecontext':_0x1687a1[_0x7faa('0x28')],'transfereeexten':_0x1687a1['transfertargetexten'],'transfereelinkedid':_0x1687a1['transfertargetlinkedid']});}writeDB(_0x1687a1);}catch(_0x58c5a8){utils[_0x7faa('0x29')](util[_0x7faa('0xc')](_0x7faa('0x16'),_0x1687a1['origtransfereruniqueid']),_0x58c5a8);}}; \ No newline at end of file +var _0xb8da=['origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0x42c903,_0x5c81bc){var _0xcfd717=function(_0x34fd31){while(--_0x34fd31){_0x42c903['push'](_0x42c903['shift']());}};_0xcfd717(++_0x5c81bc);}(_0xb8da,0x68));var _0xab8d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb8da[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xab8d('0x0'));var utils=require('./utils');function writeDB(_0x5999b5){utils[_0xab8d('0x1')](util[_0xab8d('0x2')](_0xab8d('0x3'),_0x5999b5[_0xab8d('0x4')]==='attended'?_0x5999b5['origtransfereruniqueid']:_0x5999b5[_0xab8d('0x5')],_0x5999b5[_0xab8d('0x4')]));utils[_0xab8d('0x6')](_0xab8d('0x7'),_0x5999b5);}exports['blinds']={};exports[_0xab8d('0x8')]=function(_0xad681){try{utils[_0xab8d('0x9')](util['format'](_0xab8d('0xa'),_0xad681[_0xab8d('0x5')]),_0xad681);utils[_0xab8d('0x1')](util[_0xab8d('0x2')](_0xab8d('0xb'),_0xad681['uniqueid'],_0xad681[_0xab8d('0xc')],_0xad681[_0xab8d('0xd')],_0xad681[_0xab8d('0xe')],_0xad681['transfereecalleridname']));_0xad681[_0xab8d('0x4')]=_0xab8d('0xf');exports[_0xab8d('0x10')][_0xad681[_0xab8d('0x11')]]=_0xad681;writeDB(_0xad681);}catch(_0x4dd29f){utils['error'](util['format']('[%s][transfers][blindtransfer]',_0xad681[_0xab8d('0x5')]),_0x4dd29f);}};exports[_0xab8d('0x12')]=function(_0x198166){try{utils[_0xab8d('0x9')](util[_0xab8d('0x2')]('[%s][transfers][attendedtransfer]',_0x198166[_0xab8d('0x13')]),_0x198166);utils['info'](util['format'](_0xab8d('0x14'),_0x198166[_0xab8d('0x13')],_0x198166['origtransferercalleridnum'],_0x198166['origtransferercalleridname'],_0x198166['transfertargetcalleridnum'],_0x198166[_0xab8d('0x15')]));_0x198166=_[_0xab8d('0x16')](_0x198166,{'transfererchannel':_0x198166['origtransfererchannel'],'transferercalleridnum':_0x198166[_0xab8d('0x17')],'transferercalleridname':_0x198166[_0xab8d('0x18')],'transfererconnectedlinenum':_0x198166[_0xab8d('0x19')],'transfererconnectedlinename':_0x198166[_0xab8d('0x1a')],'transfereraccountcode':_0x198166['origtransfereraccountcode'],'transferercontext':_0x198166[_0xab8d('0x1b')],'transfererexten':_0x198166['secondtransfererexten'],'transfererlinkedid':_0x198166[_0xab8d('0x1c')],'context':_0x198166[_0xab8d('0x1d')],'extension':_0x198166[_0xab8d('0x1e')],'type':_0xab8d('0x1f')});if(_[_0xab8d('0x20')](_0x198166[_0xab8d('0x21')])){_0x198166=_[_0xab8d('0x16')](_0x198166,{'transfereechannel':_0x198166[_0xab8d('0x22')],'transfereecalleridnum':_0x198166[_0xab8d('0x23')],'transfereecalleridname':_0x198166[_0xab8d('0x15')],'transfereeconnectedlinenum':_0x198166[_0xab8d('0x24')],'transfereeconnectedlinename':_0x198166[_0xab8d('0x25')],'transfereeaccountcode':_0x198166[_0xab8d('0x26')],'transfereecontext':_0x198166[_0xab8d('0x27')],'transfereeexten':_0x198166[_0xab8d('0x28')],'transfereelinkedid':_0x198166[_0xab8d('0x29')]});}writeDB(_0x198166);}catch(_0x27031d){utils[_0xab8d('0x2a')](util[_0xab8d('0x2')](_0xab8d('0x2b'),_0x198166[_0xab8d('0x13')]),_0x27031d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8efdaea..9cad4a6 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 _0xe54c=['addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','then','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]'];(function(_0x400f2a,_0x52a559){var _0x3dd8d1=function(_0x12d129){while(--_0x12d129){_0x400f2a['push'](_0x400f2a['shift']());}};_0x3dd8d1(++_0x52a559);}(_0xe54c,0x119));var _0xce54=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0xe54c[_0x41ed37];return _0x13f7ea;};'use strict';var BPromise=require(_0xce54('0x0'));var jayson=require(_0xce54('0x1'));var moment=require(_0xce54('0x2'));var util=require(_0xce54('0x3'));var client=jayson[_0xce54('0x4')][_0xce54('0x5')]({'port':0x2329});var logger=require(_0xce54('0x6'))(_0xce54('0x7'));exports[_0xce54('0x8')]=function(_0x133e7b,_0x39b4eb){logger[_0xce54('0x8')](_0x133e7b,_0x39b4eb?util[_0xce54('0x9')](_0x39b4eb,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x200753,_0x1bcf07){logger[_0xce54('0xa')](_0x200753,_0x1bcf07?util[_0xce54('0x9')](_0x1bcf07,{'showHidden':![],'depth':null}):'');};exports[_0xce54('0xb')]=function(_0x44c481,_0x3f76d4){logger[_0xce54('0xb')](_0x44c481,_0x3f76d4?util[_0xce54('0x9')](_0x3f76d4,{'showHidden':![],'depth':null}):'');};exports[_0xce54('0xc')]=function(_0x29ea85,_0x5c023d){return client[_0xce54('0xc')](_0x29ea85,{'body':_0x5c023d})['then'](function(_0x4f8d66){logger[_0xce54('0xa')](_0xce54('0xd'),_0x29ea85,_0x4f8d66?util[_0xce54('0x9')](_0x4f8d66,{'showHidden':![],'depth':null}):'');})[_0xce54('0xe')](function(_0x4be85e){logger[_0xce54('0xb')](_0xce54('0xd'),_0x29ea85,_0x4be85e?util[_0xce54('0x9')](_0x4be85e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x48d25e){return client[_0xce54('0xc')](_0xce54('0xf'),{'options':{'raw':!![],'attributes':['id',_0xce54('0x10'),'name','interface'],'where':_0x48d25e,'limit':0x1}})[_0xce54('0x11')](function(_0xc94f4e){logger[_0xce54('0xa')](_0xce54('0x12'),JSON['stringify'](_0x48d25e),_0xc94f4e?util['inspect'](_0xc94f4e,{'showHidden':![],'depth':null}):'');return _0xc94f4e[_0xce54('0x13')][_0xce54('0x14')]?_0xc94f4e[_0xce54('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x3ceba0){return new BPromise(function(_0x3f26ac,_0x79fe5b){if(_0x3ceba0){return getUser({'internal':_0x3ceba0})['then'](function(_0x45ebdd){logger['info'](_0xce54('0x15'),_0x3ceba0,_0x45ebdd?_0xce54('0x16'):_0xce54('0x17'));return _0x3f26ac(_0x45ebdd);})[_0xce54('0xe')](function(_0x214d74){logger[_0xce54('0xb')](_0xce54('0x18'),_0x214d74?util[_0xce54('0x9')](_0x214d74,{'showHidden':![],'depth':null}):'');return _0x3f26ac(null);});}return _0x3f26ac(null);});};exports[_0xce54('0x19')]=function(_0x5aa7bf){return new BPromise(function(_0x41fd72,_0x5c9fd4){if(_0x5aa7bf){return getUser({'interface':_0x5aa7bf})[_0xce54('0x11')](function(_0x2bf11c){logger['info'](_0xce54('0x1a'),_0x5aa7bf,_0x2bf11c?'found':'notfound');return _0x41fd72(_0x2bf11c);})[_0xce54('0xe')](function(_0x643208){logger[_0xce54('0xb')](_0xce54('0x1b'),_0x643208?util[_0xce54('0x9')](_0x643208,{'showHidden':![],'depth':null}):'');return _0x41fd72(null);});}return _0x41fd72(null);});};exports['getUserByName']=function(_0x27fd44){return new BPromise(function(_0x43a354,_0xd037b4){if(_0x27fd44){return getUser({'name':_0x27fd44})[_0xce54('0x11')](function(_0x3ee92e){logger[_0xce54('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x27fd44,_0x3ee92e?_0xce54('0x16'):'notfound');return _0x43a354(_0x3ee92e);})['catch'](function(_0x551bcb){logger[_0xce54('0xb')]('[utils][getUserByName]',_0x551bcb?util[_0xce54('0x9')](_0x551bcb,{'showHidden':![],'depth':null}):'');return _0x43a354(null);});}return _0x43a354(null);});};exports[_0xce54('0x1c')]=function(_0x4f2812){return new BPromise(function(_0x1de8c7,_0x49bff3){if(_0x4f2812){return client['request'](_0xce54('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0xce54('0x1e'),_0xce54('0x1f'),'acwTimeout'],'where':{'name':_0x4f2812},'limit':0x1}})[_0xce54('0x11')](function(_0x3c461e){logger[_0xce54('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4f2812,_0x3c461e?util[_0xce54('0x9')](_0x3c461e,{'showHidden':![],'depth':null}):'');logger[_0xce54('0x8')](_0xce54('0x20'),_0x4f2812,_0x3c461e?_0xce54('0x16'):_0xce54('0x17'));return _0x1de8c7(_0x3c461e['result'][_0xce54('0x14')]?_0x3c461e[_0xce54('0x13')][0x0]:null);})[_0xce54('0xe')](function(_0x5df92a){logger[_0xce54('0xb')](_0xce54('0x21'),_0x5df92a?util[_0xce54('0x9')](_0x5df92a,{'showHidden':![],'depth':null}):'');return _0x1de8c7(null);});}return _0x1de8c7(null);});};exports[_0xce54('0x22')]=function(_0x4d2fec,_0x27c01c){return moment(_0x4d2fec)[_0xce54('0x23')](_0x27c01c,'seconds')['format'](_0xce54('0x24'));};exports[_0xce54('0x25')]=function(_0x5245d6,_0x43e140){return moment(_0x5245d6)['subtract'](_0x43e140,_0xce54('0x26'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xce54('0x27')]=function(_0x44561a,_0x3a78b8){return moment(_0x44561a)[_0xce54('0x28')](moment(_0x3a78b8),'seconds');};exports[_0xce54('0x29')]=function(_0x5bd3da,_0x6c9c6){return parseInt(_0x5bd3da,0xa)+parseInt(_0x6c9c6,0xa);};exports[_0xce54('0x2a')]=function(){return moment()['format'](_0xce54('0x24'));};exports[_0xce54('0x2b')]=function(_0x51ffb7,_0x4894a1){if(_0x4894a1){return moment(_0x51ffb7)[_0xce54('0x2b')](_0x4894a1);}return!![];};exports[_0xce54('0x2c')]=function(_0x372c72,_0x2a3417){if(_0x2a3417){return moment(_0x372c72)['isBefore'](_0x2a3417);}else if(_0x372c72){return!![];}return![];}; \ No newline at end of file +var _0xf1a2=['[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','getUserByInternal','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw'];(function(_0x286260,_0x2264bd){var _0x4d47c7=function(_0x5aa940){while(--_0x5aa940){_0x286260['push'](_0x286260['shift']());}};_0x4d47c7(++_0x2264bd);}(_0xf1a2,0x15f));var _0x2f1a=function(_0x3a94e7,_0x28739b){_0x3a94e7=_0x3a94e7-0x0;var _0x5e2979=_0xf1a2[_0x3a94e7];return _0x5e2979;};'use strict';var BPromise=require(_0x2f1a('0x0'));var jayson=require('jayson/promise');var moment=require(_0x2f1a('0x1'));var util=require(_0x2f1a('0x2'));var client=jayson['client'][_0x2f1a('0x3')]({'port':0x2329});var logger=require(_0x2f1a('0x4'))('xdr');exports[_0x2f1a('0x5')]=function(_0x588bc9,_0x224eaa){logger[_0x2f1a('0x5')](_0x588bc9,_0x224eaa?util[_0x2f1a('0x6')](_0x224eaa,{'showHidden':![],'depth':null}):'');};exports[_0x2f1a('0x7')]=function(_0xae44b,_0x504fbb){logger[_0x2f1a('0x7')](_0xae44b,_0x504fbb?util[_0x2f1a('0x6')](_0x504fbb,{'showHidden':![],'depth':null}):'');};exports[_0x2f1a('0x8')]=function(_0x49d53b,_0x260f0d){logger[_0x2f1a('0x8')](_0x49d53b,_0x260f0d?util['inspect'](_0x260f0d,{'showHidden':![],'depth':null}):'');};exports[_0x2f1a('0x9')]=function(_0x319449,_0x35825e){return client[_0x2f1a('0x9')](_0x319449,{'body':_0x35825e})[_0x2f1a('0xa')](function(_0x4a5255){logger[_0x2f1a('0x7')](_0x2f1a('0xb'),_0x319449,_0x4a5255?util[_0x2f1a('0x6')](_0x4a5255,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x6c7f28){logger[_0x2f1a('0x8')]('[utils][request]\x20name:%s',_0x319449,_0x6c7f28?util[_0x2f1a('0x6')](_0x6c7f28,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3df2fd){return client[_0x2f1a('0x9')](_0x2f1a('0xc'),{'options':{'raw':!![],'attributes':['id',_0x2f1a('0xd'),_0x2f1a('0xe'),_0x2f1a('0xf')],'where':_0x3df2fd,'limit':0x1}})[_0x2f1a('0xa')](function(_0xf6615f){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x2f1a('0x10')](_0x3df2fd),_0xf6615f?util[_0x2f1a('0x6')](_0xf6615f,{'showHidden':![],'depth':null}):'');return _0xf6615f[_0x2f1a('0x11')][_0x2f1a('0x12')]?_0xf6615f['result'][0x0]:null;});}exports[_0x2f1a('0x13')]=function(_0x1e0128){return new BPromise(function(_0x1ab2fb,_0x26584c){if(_0x1e0128){return getUser({'internal':_0x1e0128})[_0x2f1a('0xa')](function(_0x24c8c4){logger[_0x2f1a('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x1e0128,_0x24c8c4?_0x2f1a('0x14'):_0x2f1a('0x15'));return _0x1ab2fb(_0x24c8c4);})[_0x2f1a('0x16')](function(_0x2995d1){logger[_0x2f1a('0x8')](_0x2f1a('0x17'),_0x2995d1?util['inspect'](_0x2995d1,{'showHidden':![],'depth':null}):'');return _0x1ab2fb(null);});}return _0x1ab2fb(null);});};exports[_0x2f1a('0x18')]=function(_0x528c7d){return new BPromise(function(_0x529880,_0x429c7e){if(_0x528c7d){return getUser({'interface':_0x528c7d})[_0x2f1a('0xa')](function(_0x35793b){logger[_0x2f1a('0x5')](_0x2f1a('0x19'),_0x528c7d,_0x35793b?_0x2f1a('0x14'):_0x2f1a('0x15'));return _0x529880(_0x35793b);})[_0x2f1a('0x16')](function(_0x502ffe){logger[_0x2f1a('0x8')](_0x2f1a('0x1a'),_0x502ffe?util[_0x2f1a('0x6')](_0x502ffe,{'showHidden':![],'depth':null}):'');return _0x529880(null);});}return _0x529880(null);});};exports['getUserByName']=function(_0x419d90){return new BPromise(function(_0x5b371f,_0x322c0f){if(_0x419d90){return getUser({'name':_0x419d90})[_0x2f1a('0xa')](function(_0x309782){logger['info'](_0x2f1a('0x1b'),_0x419d90,_0x309782?'found':_0x2f1a('0x15'));return _0x5b371f(_0x309782);})[_0x2f1a('0x16')](function(_0x4f57fc){logger[_0x2f1a('0x8')](_0x2f1a('0x1c'),_0x4f57fc?util[_0x2f1a('0x6')](_0x4f57fc,{'showHidden':![],'depth':null}):'');return _0x5b371f(null);});}return _0x5b371f(null);});};exports[_0x2f1a('0x1d')]=function(_0x51b698){return new BPromise(function(_0x47913a,_0x564aaa){if(_0x51b698){return client[_0x2f1a('0x9')](_0x2f1a('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x2f1a('0xe'),_0x2f1a('0x1f'),_0x2f1a('0x20'),'acwTimeout'],'where':{'name':_0x51b698},'limit':0x1}})[_0x2f1a('0xa')](function(_0x66225){logger[_0x2f1a('0x7')](_0x2f1a('0x21'),_0x51b698,_0x66225?util[_0x2f1a('0x6')](_0x66225,{'showHidden':![],'depth':null}):'');logger[_0x2f1a('0x5')](_0x2f1a('0x22'),_0x51b698,_0x66225?'found':_0x2f1a('0x15'));return _0x47913a(_0x66225[_0x2f1a('0x11')]['length']?_0x66225[_0x2f1a('0x11')][0x0]:null);})['catch'](function(_0x2f2191){logger[_0x2f1a('0x8')](_0x2f1a('0x23'),_0x2f2191?util['inspect'](_0x2f2191,{'showHidden':![],'depth':null}):'');return _0x47913a(null);});}return _0x47913a(null);});};exports[_0x2f1a('0x24')]=function(_0x26e17e,_0x5a68aa){return moment(_0x26e17e)[_0x2f1a('0x25')](_0x5a68aa,_0x2f1a('0x26'))[_0x2f1a('0x27')](_0x2f1a('0x28'));};exports['subtractTime']=function(_0x363117,_0x544d33){return moment(_0x363117)[_0x2f1a('0x29')](_0x544d33,_0x2f1a('0x26'))['format'](_0x2f1a('0x28'));};exports[_0x2f1a('0x2a')]=function(_0x2ca3b7,_0x43e277){return moment(_0x2ca3b7)[_0x2f1a('0x2b')](moment(_0x43e277),'seconds');};exports[_0x2f1a('0x2c')]=function(_0x7a9526,_0xb0d37f){return parseInt(_0x7a9526,0xa)+parseInt(_0xb0d37f,0xa);};exports[_0x2f1a('0x2d')]=function(){return moment()[_0x2f1a('0x27')](_0x2f1a('0x28'));};exports[_0x2f1a('0x2e')]=function(_0x1abf14,_0x16fe88){if(_0x16fe88){return moment(_0x1abf14)['isAfter'](_0x16fe88);}return!![];};exports[_0x2f1a('0x2f')]=function(_0x1ba8cb,_0x2bd1ca){if(_0x2bd1ca){return moment(_0x1ba8cb)[_0x2f1a('0x2f')](_0x2bd1ca);}else if(_0x1ba8cb){return!![];}return![];}; \ No newline at end of file